From: support Date: Tue, 22 Nov 2022 12:17:12 +0000 (+0000) Subject: Built motion from commit 2a6dfb68.|2.6.23 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png//%22%27?a=commitdiff_plain;h=5a23b42d160b2ece751ed104b7961de83c5ad576;p=motion2.git Built motion from commit 2a6dfb68.|2.6.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6ef4e82..3b089bb 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.22", + "version": "2.6.23", "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": "2022-11-21T15:47:29.376Z", + "time": "2022-11-22T12:08:41.046Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c2f3e7b..e83c9d9 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.22", + "version": "2.6.23", "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": "2022-11-21T15:47:29.376Z", + "time": "2022-11-22T12:08:41.046Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index e40c91e..b9ad350 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.22", + "version": "2.6.23", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 2279703..da326f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.22", + "version": "2.6.23", "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/api/action/action.attributes.js b/server/api/action/action.attributes.js index dfc966c..f8e4b9b 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 _0x4fef=['TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','contactManager','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x2f70b6,_0x4b7db6){var _0x77a5b0=function(_0x3778e0){while(--_0x3778e0){_0x2f70b6['push'](_0x2f70b6['shift']());}};_0x77a5b0(++_0x4b7db6);}(_0x4fef,0x1dd));var _0xf4fe=function(_0x4bdc99,_0xa77058){_0x4bdc99=_0x4bdc99-0x0;var _0xc320f7=_0x4fef[_0x4bdc99];return _0xc320f7;};'use strict';var Sequelize=require(_0xf4fe('0x0'));module[_0xf4fe('0x1')]={'name':{'type':Sequelize[_0xf4fe('0x2')],'get':function(_0x3ce3eb){return this['getDataValue'](_0xf4fe('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xf4fe('0x4'),_0xf4fe('0x5'),_0xf4fe('0x6'),_0xf4fe('0x7'),'urlForward',_0xf4fe('0x8'),'bot',_0xf4fe('0x9')]],'msg':_0xf4fe('0xa')}},'comment':_0xf4fe('0xa')},'data1':{'type':Sequelize[_0xf4fe('0xb')](0x1000),'comment':_0xf4fe('0xc')},'data2':{'type':Sequelize[_0xf4fe('0xb')](0x1000),'comment':_0xf4fe('0xd')},'data3':{'type':Sequelize[_0xf4fe('0xb')](0x1000),'comment':_0xf4fe('0xe')},'data4':{'type':Sequelize[_0xf4fe('0xb')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xf4fe('0xb')](0x1000),'comments':_0xf4fe('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0xf4fe('0x10')},'data7':{'type':Sequelize[_0xf4fe('0x11')],'comments':_0xf4fe('0x12')}}; \ No newline at end of file +var _0xe78a=['getDataValue','STRING','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x18550a,_0xd97082){var _0x517dda=function(_0x4f8be9){while(--_0x4f8be9){_0x18550a['push'](_0x18550a['shift']());}};_0x517dda(++_0xd97082);}(_0xe78a,0x1d9));var _0xae78=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe78a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae78('0x0'));module[_0xae78('0x1')]={'name':{'type':Sequelize[_0xae78('0x2')],'get':function(_0x5e296f){return this[_0xae78('0x3')]('action');}},'action':{'type':Sequelize[_0xae78('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xae78('0x5'),_0xae78('0x6'),_0xae78('0x7'),_0xae78('0x8'),'browser',_0xae78('0x9'),_0xae78('0xa')]],'msg':_0xae78('0xb')}},'comment':_0xae78('0xb')},'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[_0xae78('0x4')](0x1000),'comment':_0xae78('0xc')},'data3':{'type':Sequelize[_0xae78('0x4')](0x1000),'comment':_0xae78('0xd')},'data4':{'type':Sequelize[_0xae78('0x4')](0x1000),'comments':_0xae78('0xe')},'data5':{'type':Sequelize[_0xae78('0x4')](0x1000),'comments':_0xae78('0xf')},'data6':{'type':Sequelize[_0xae78('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0xae78('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c56623b..0f0f76e 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 _0x034f=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','limit','count','set','Content-Range','apply','reject','save','update','then','stack','body','Action'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x034f,0x179));var _0xf034=function(_0x45dd9b,_0x35fa24){_0x45dd9b=_0x45dd9b-0x0;var _0x410941=_0x034f[_0x45dd9b];return _0x410941;};'use strict';var emlformat=require(_0xf034('0x0'));var rimraf=require(_0xf034('0x1'));var zipdir=require(_0xf034('0x2'));var jsonpatch=require(_0xf034('0x3'));var rp=require(_0xf034('0x4'));var moment=require('moment');var BPromise=require(_0xf034('0x5'));var Mustache=require(_0xf034('0x6'));var util=require(_0xf034('0x7'));var path=require(_0xf034('0x8'));var sox=require(_0xf034('0x9'));var csv=require('to-csv');var ejs=require(_0xf034('0xa'));var fs=require('fs');var fs_extra=require(_0xf034('0xb'));var _=require(_0xf034('0xc'));var squel=require(_0xf034('0xd'));var crypto=require(_0xf034('0xe'));var jsforce=require(_0xf034('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf034('0x10'));var querystring=require(_0xf034('0x11'));var Papa=require(_0xf034('0x12'));var Redis=require(_0xf034('0x13'));var authService=require(_0xf034('0x14'));var qs=require(_0xf034('0x15'));var as=require(_0xf034('0x16'));var hardwareService=require(_0xf034('0x17'));var logger=require('../../config/logger')(_0xf034('0x18'));var utils=require(_0xf034('0x19'));var config=require(_0xf034('0x1a'));var licenseUtil=require(_0xf034('0x1b'));var db=require(_0xf034('0x1c'))['db'];function respondWithStatusCode(_0x4631c2,_0xd4f5d){_0xd4f5d=_0xd4f5d||0xcc;return function(_0x14c563){if(_0x14c563){return _0x4631c2[_0xf034('0x1d')](_0xd4f5d);}return _0x4631c2['status'](_0xd4f5d)[_0xf034('0x1e')]();};}function respondWithResult(_0x446aae,_0x1fc133){_0x1fc133=_0x1fc133||0xc8;return function(_0x40df00){if(_0x40df00){return _0x446aae[_0xf034('0x1f')](_0x1fc133)[_0xf034('0x20')](_0x40df00);}};}function respondWithFilteredResult(_0x5d20b8,_0x4e5044){return function(_0x113a32){if(_0x113a32){var _0x33cd3d=typeof _0x4e5044[_0xf034('0x21')]==='undefined'&&typeof _0x4e5044[_0xf034('0x22')]==='undefined';var _0x2b1f7e=_0x113a32[_0xf034('0x23')];var _0x194eb7=_0x33cd3d?0x0:_0x4e5044[_0xf034('0x21')];var _0x50e8e3=_0x33cd3d?_0x113a32[_0xf034('0x23')]:_0x4e5044['offset']+_0x4e5044['limit'];var _0x2bd3bc;if(_0x50e8e3>=_0x2b1f7e){_0x50e8e3=_0x2b1f7e;_0x2bd3bc=0xc8;}else{_0x2bd3bc=0xce;}_0x5d20b8[_0xf034('0x1f')](_0x2bd3bc);return _0x5d20b8[_0xf034('0x24')](_0xf034('0x25'),_0x194eb7+'-'+_0x50e8e3+'/'+_0x2b1f7e)[_0xf034('0x20')](_0x113a32);}return null;};}function patchUpdates(_0x1be8a9){return function(_0x38f93a){try{jsonpatch[_0xf034('0x26')](_0x38f93a,_0x1be8a9,!![]);}catch(_0x5126e0){return BPromise[_0xf034('0x27')](_0x5126e0);}return _0x38f93a[_0xf034('0x28')]();};}function saveUpdates(_0x111e32,_0x57fd78){return function(_0x21b8b1){if(_0x21b8b1){return _0x21b8b1[_0xf034('0x29')](_0x111e32)[_0xf034('0x2a')](function(_0x1ddccc){return _0x1ddccc;});}return null;};}function removeEntity(_0x2990da,_0x323349){return function(_0x296940){if(_0x296940){return _0x296940['destroy']()[_0xf034('0x2a')](function(){_0x2990da['status'](0xcc)[_0xf034('0x1e')]();});}};}function handleEntityNotFound(_0x3ccb9,_0xad0cbb){return function(_0x17ac34){if(!_0x17ac34){_0x3ccb9[_0xf034('0x1d')](0x194);}return _0x17ac34;};}function handleError(_0x443122,_0x378a2d){_0x378a2d=_0x378a2d||0x1f4;return function(_0x332f91){logger['error'](_0x332f91[_0xf034('0x2b')]);if(_0x332f91['name']){delete _0x332f91['name'];}_0x443122[_0xf034('0x1f')](_0x378a2d)['send'](_0x332f91);};}exports[_0xf034('0x29')]=function(_0x2764c6,_0x350b91){if(_0x2764c6[_0xf034('0x2c')]['id']){delete _0x2764c6[_0xf034('0x2c')]['id'];}return db[_0xf034('0x2d')][_0xf034('0x2e')]({'where':{'id':_0x2764c6['params']['id']}})['then'](handleEntityNotFound(_0x350b91,null))[_0xf034('0x2a')](saveUpdates(_0x2764c6[_0xf034('0x2c')],null))[_0xf034('0x2a')](respondWithResult(_0x350b91,null))['catch'](handleError(_0x350b91,null));};exports['destroy']=function(_0x7ddbe,_0x10b4d8){return db[_0xf034('0x2d')][_0xf034('0x2e')]({'where':{'id':_0x7ddbe['params']['id']}})['then'](handleEntityNotFound(_0x10b4d8,null))['then'](removeEntity(_0x10b4d8,null))['catch'](handleError(_0x10b4d8,null));}; \ No newline at end of file +var _0x3fc5=['offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x28f1c6,_0x4b5cef){var _0x2e0870=function(_0x545d78){while(--_0x545d78){_0x28f1c6['push'](_0x28f1c6['shift']());}};_0x2e0870(++_0x4b5cef);}(_0x3fc5,0x13f));var _0x53fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3fc5[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53fc('0x0'));var zipdir=require(_0x53fc('0x1'));var jsonpatch=require(_0x53fc('0x2'));var rp=require(_0x53fc('0x3'));var moment=require(_0x53fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53fc('0x5'));var util=require(_0x53fc('0x6'));var path=require(_0x53fc('0x7'));var sox=require(_0x53fc('0x8'));var csv=require(_0x53fc('0x9'));var ejs=require(_0x53fc('0xa'));var fs=require('fs');var fs_extra=require(_0x53fc('0xb'));var _=require(_0x53fc('0xc'));var squel=require(_0x53fc('0xd'));var crypto=require(_0x53fc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x53fc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x53fc('0x10'));var Papa=require(_0x53fc('0x11'));var Redis=require(_0x53fc('0x12'));var authService=require(_0x53fc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x53fc('0x14'));var hardwareService=require(_0x53fc('0x15'));var logger=require(_0x53fc('0x16'))(_0x53fc('0x17'));var utils=require('../../config/utils');var config=require(_0x53fc('0x18'));var licenseUtil=require(_0x53fc('0x19'));var db=require(_0x53fc('0x1a'))['db'];function respondWithStatusCode(_0x436766,_0x3a82bd){_0x3a82bd=_0x3a82bd||0xcc;return function(_0x36994a){if(_0x36994a){return _0x436766[_0x53fc('0x1b')](_0x3a82bd);}return _0x436766[_0x53fc('0x1c')](_0x3a82bd)[_0x53fc('0x1d')]();};}function respondWithResult(_0x35a63f,_0xcc10b7){_0xcc10b7=_0xcc10b7||0xc8;return function(_0x172ae0){if(_0x172ae0){return _0x35a63f[_0x53fc('0x1c')](_0xcc10b7)[_0x53fc('0x1e')](_0x172ae0);}};}function respondWithFilteredResult(_0x215d6a,_0x4bfa1d){return function(_0x48fa7e){if(_0x48fa7e){var _0x16505e=typeof _0x4bfa1d[_0x53fc('0x1f')]==='undefined'&&typeof _0x4bfa1d[_0x53fc('0x20')]===_0x53fc('0x21');var _0x3d4658=_0x48fa7e[_0x53fc('0x22')];var _0x273e13=_0x16505e?0x0:_0x4bfa1d[_0x53fc('0x1f')];var _0x3f8e4c=_0x16505e?_0x48fa7e[_0x53fc('0x22')]:_0x4bfa1d[_0x53fc('0x1f')]+_0x4bfa1d[_0x53fc('0x20')];var _0x2f01ee;if(_0x3f8e4c>=_0x3d4658){_0x3f8e4c=_0x3d4658;_0x2f01ee=0xc8;}else{_0x2f01ee=0xce;}_0x215d6a[_0x53fc('0x1c')](_0x2f01ee);return _0x215d6a['set'](_0x53fc('0x23'),_0x273e13+'-'+_0x3f8e4c+'/'+_0x3d4658)[_0x53fc('0x1e')](_0x48fa7e);}return null;};}function patchUpdates(_0x1b4383){return function(_0x4ee205){try{jsonpatch['apply'](_0x4ee205,_0x1b4383,!![]);}catch(_0x171ccd){return BPromise[_0x53fc('0x24')](_0x171ccd);}return _0x4ee205[_0x53fc('0x25')]();};}function saveUpdates(_0x542b47,_0xacf7e){return function(_0x4edfbf){if(_0x4edfbf){return _0x4edfbf[_0x53fc('0x26')](_0x542b47)[_0x53fc('0x27')](function(_0x211089){return _0x211089;});}return null;};}function removeEntity(_0x17a9f8,_0x2a931b){return function(_0x1335c0){if(_0x1335c0){return _0x1335c0[_0x53fc('0x28')]()[_0x53fc('0x27')](function(){_0x17a9f8[_0x53fc('0x1c')](0xcc)[_0x53fc('0x1d')]();});}};}function handleEntityNotFound(_0x58b1f0,_0x1d1520){return function(_0xf0d2bb){if(!_0xf0d2bb){_0x58b1f0[_0x53fc('0x1b')](0x194);}return _0xf0d2bb;};}function handleError(_0x38ffa6,_0x37da23){_0x37da23=_0x37da23||0x1f4;return function(_0x190742){logger[_0x53fc('0x29')](_0x190742[_0x53fc('0x2a')]);if(_0x190742[_0x53fc('0x2b')]){delete _0x190742[_0x53fc('0x2b')];}_0x38ffa6[_0x53fc('0x1c')](_0x37da23)[_0x53fc('0x2c')](_0x190742);};}exports[_0x53fc('0x26')]=function(_0x426a9e,_0x2c2d31){if(_0x426a9e[_0x53fc('0x2d')]['id']){delete _0x426a9e[_0x53fc('0x2d')]['id'];}return db[_0x53fc('0x2e')][_0x53fc('0x2f')]({'where':{'id':_0x426a9e[_0x53fc('0x30')]['id']}})[_0x53fc('0x27')](handleEntityNotFound(_0x2c2d31,null))[_0x53fc('0x27')](saveUpdates(_0x426a9e[_0x53fc('0x2d')],null))['then'](respondWithResult(_0x2c2d31,null))['catch'](handleError(_0x2c2d31,null));};exports[_0x53fc('0x28')]=function(_0x34587e,_0x49f392){return db[_0x53fc('0x2e')][_0x53fc('0x2f')]({'where':{'id':_0x34587e[_0x53fc('0x30')]['id']}})[_0x53fc('0x27')](handleEntityNotFound(_0x49f392,null))[_0x53fc('0x27')](removeEntity(_0x49f392,null))[_0x53fc('0x31')](handleError(_0x49f392,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index da0be4a..edc1c61 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 _0xaeff=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action','tools_actions','lodash','../../config/logger','api','moment'];(function(_0x992a7a,_0x47c106){var _0x16b3bf=function(_0x1064d0){while(--_0x1064d0){_0x992a7a['push'](_0x992a7a['shift']());}};_0x16b3bf(++_0x47c106);}(_0xaeff,0x71));var _0xfaef=function(_0x44a56b,_0x40cab5){_0x44a56b=_0x44a56b-0x0;var _0x3eba36=_0xaeff[_0x44a56b];return _0x3eba36;};'use strict';var _=require(_0xfaef('0x0'));var util=require('util');var logger=require(_0xfaef('0x1'))(_0xfaef('0x2'));var moment=require(_0xfaef('0x3'));var BPromise=require(_0xfaef('0x4'));var rp=require(_0xfaef('0x5'));var fs=require('fs');var path=require(_0xfaef('0x6'));var rimraf=require(_0xfaef('0x7'));var config=require(_0xfaef('0x8'));var attributes=require('./action.attributes');module[_0xfaef('0x9')]=function(_0x13850f,_0x493beb){return _0x13850f[_0xfaef('0xa')](_0xfaef('0xb'),attributes,{'tableName':_0xfaef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1fe=['moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api'];(function(_0x38e953,_0x1003a5){var _0x55b726=function(_0x3ea840){while(--_0x3ea840){_0x38e953['push'](_0x38e953['shift']());}};_0x55b726(++_0x1003a5);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x28128f,_0x3ab1d5){_0x28128f=_0x28128f-0x0;var _0x3543ae=_0xe1fe[_0x28128f];return _0x3543ae;};'use strict';var _=require(_0xee1f('0x0'));var util=require(_0xee1f('0x1'));var logger=require(_0xee1f('0x2'))(_0xee1f('0x3'));var moment=require(_0xee1f('0x4'));var BPromise=require(_0xee1f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xee1f('0x6'));var config=require(_0xee1f('0x7'));var attributes=require(_0xee1f('0x8'));module[_0xee1f('0x9')]=function(_0x27cec4,_0x13f2d9){return _0x27cec4[_0xee1f('0xa')](_0xee1f('0xb'),attributes,{'tableName':_0xee1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 941102e..9eba9b8 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 _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x413e23,_0x4c8289){var _0x5cab0c=function(_0x97dc9c){while(--_0x97dc9c){_0x413e23['push'](_0x413e23['shift']());}};_0x5cab0c(++_0x4c8289);}(_0x326f,0xd1));var _0xf326=function(_0x5bcd71,_0x2c7c7f){_0x5bcd71=_0x5bcd71-0x0;var _0x60b542=_0x326f[_0x5bcd71];return _0x60b542;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x4b5fd7,_0xe85d64){var _0x1997df=function(_0x2798b6){while(--_0x2798b6){_0x4b5fd7['push'](_0x4b5fd7['shift']());}};_0x1997df(++_0xe85d64);}(_0xe14b,0x93));var _0xbe14=function(_0x372bff,_0x2bb900){_0x372bff=_0x372bff-0x0;var _0x25b72b=_0xe14b[_0x372bff];return _0x25b72b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ce5dc5f..ebfcdfe 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 _0x5ae4=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x5a37f2,_0x41611a){var _0x28ab89=function(_0x138f5c){while(--_0x138f5c){_0x5a37f2['push'](_0x5a37f2['shift']());}};_0x28ab89(++_0x41611a);}(_0x5ae4,0xb1));var _0x45ae=function(_0x362f26,_0x5ce460){_0x362f26=_0x362f26-0x0;var _0x324fb7=_0x5ae4[_0x362f26];return _0x324fb7;};'use strict';var multer=require('multer');var util=require(_0x45ae('0x0'));var path=require(_0x45ae('0x1'));var timeout=require(_0x45ae('0x2'));var express=require('express');var router=express[_0x45ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x45ae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x45ae('0x5'));var controller=require(_0x45ae('0x6'));router[_0x45ae('0x7')](_0x45ae('0x8'),auth[_0x45ae('0x9')](),controller['update']);router['delete'](_0x45ae('0x8'),auth[_0x45ae('0x9')](),controller['destroy']);module[_0x45ae('0xa')]=router; \ No newline at end of file +var _0x6a63=['./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x540201,_0x2a7c63){var _0x28edbc=function(_0x1c2178){while(--_0x1c2178){_0x540201['push'](_0x540201['shift']());}};_0x28edbc(++_0x2a7c63);}(_0x6a63,0x86));var _0x36a6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6a63[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x36a6('0x0'));var path=require(_0x36a6('0x1'));var timeout=require(_0x36a6('0x2'));var express=require('express');var router=express[_0x36a6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x36a6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x36a6('0x5'));var controller=require(_0x36a6('0x6'));router[_0x36a6('0x7')](_0x36a6('0x8'),auth[_0x36a6('0x9')](),controller[_0x36a6('0xa')]);router[_0x36a6('0xb')]('/:id',auth[_0x36a6('0x9')](),controller[_0x36a6('0xc')]);module[_0x36a6('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0d57528..5f079ca 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 _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x49887f,_0x5a025e){var _0x289ab8=function(_0xe6de34){while(--_0xe6de34){_0x49887f['push'](_0x49887f['shift']());}};_0x289ab8(++_0x5a025e);}(_0xeec6,0x1c2));var _0x6eec=function(_0x39f097,_0x17116b){_0x39f097=_0x39f097-0x0;var _0x544f6a=_0xeec6[_0x39f097];return _0x544f6a;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','TEXT'];(function(_0x3922,_0x4eea26){var _0x54f26f=function(_0x1ce396){while(--_0x1ce396){_0x3922['push'](_0x3922['shift']());}};_0x54f26f(++_0x4eea26);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7721('0x1')]},'parent':{'type':Sequelize[_0x7721('0x1')]},'table':{'type':Sequelize[_0x7721('0x1')]},'conditions':{'type':Sequelize[_0x7721('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1b279da..ce30fc8 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 _0xbd7b=['filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','intersection','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','debug','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','AVG(%s)','DATE(%s)','IS\x20NOT\x20EMPTY','operator','value','getFields','metric','%s.%s\x20=\x20%s.%s','clone','output','fullPath','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','replace','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x918995,_0x26561a){var _0x49c093=function(_0x238807){while(--_0x238807){_0x918995['push'](_0x918995['shift']());}};_0x49c093(++_0x26561a);}(_0xbd7b,0x10c));var _0xbbd7=function(_0x1e8bea,_0x47bde9){_0x1e8bea=_0x1e8bea-0x0;var _0x29f756=_0xbd7b[_0x1e8bea];return _0x29f756;};'use strict';var emlformat=require(_0xbbd7('0x0'));var rimraf=require(_0xbbd7('0x1'));var zipdir=require(_0xbbd7('0x2'));var jsonpatch=require(_0xbbd7('0x3'));var rp=require(_0xbbd7('0x4'));var moment=require(_0xbbd7('0x5'));var BPromise=require(_0xbbd7('0x6'));var Mustache=require(_0xbbd7('0x7'));var util=require(_0xbbd7('0x8'));var path=require('path');var sox=require(_0xbbd7('0x9'));var csv=require(_0xbbd7('0xa'));var ejs=require(_0xbbd7('0xb'));var fs=require('fs');var fs_extra=require(_0xbbd7('0xc'));var _=require(_0xbbd7('0xd'));var squel=require(_0xbbd7('0xe'));var crypto=require('crypto');var jsforce=require(_0xbbd7('0xf'));var deskjs=require(_0xbbd7('0x10'));var toCsv=require(_0xbbd7('0xa'));var querystring=require(_0xbbd7('0x11'));var Papa=require('papaparse');var Redis=require(_0xbbd7('0x12'));var authService=require(_0xbbd7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbbd7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbd7('0x15'))(_0xbbd7('0x16'));var utils=require(_0xbbd7('0x17'));var config=require(_0xbbd7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbd7('0x19'))['db'];var dbH=require(_0xbbd7('0x19'))[_0xbbd7('0x1a')];function respondWithStatusCode(_0x22a0a9,_0x269617){_0x269617=_0x269617||0xcc;return function(_0x2f5045){if(_0x2f5045){return _0x22a0a9[_0xbbd7('0x1b')](_0x269617);}return _0x22a0a9[_0xbbd7('0x1c')](_0x269617)[_0xbbd7('0x1d')]();};}function respondWithResult(_0x242e47,_0x475acf){_0x475acf=_0x475acf||0xc8;return function(_0x32ad90){if(_0x32ad90){return _0x242e47[_0xbbd7('0x1c')](_0x475acf)['json'](_0x32ad90);}};}function respondWithFilteredResult(_0x36a1df,_0x3e2a90){return function(_0x2c2ff0){if(_0x2c2ff0){var _0x572217=typeof _0x3e2a90['offset']==='undefined'&&typeof _0x3e2a90['limit']===_0xbbd7('0x1e');var _0x2afbd4=_0x2c2ff0[_0xbbd7('0x1f')];var _0xf9634=_0x572217?0x0:_0x3e2a90[_0xbbd7('0x20')];var _0x45cdbb=_0x572217?_0x2c2ff0[_0xbbd7('0x1f')]:_0x3e2a90[_0xbbd7('0x20')]+_0x3e2a90[_0xbbd7('0x21')];var _0xa76ebe;if(_0x45cdbb>=_0x2afbd4){_0x45cdbb=_0x2afbd4;_0xa76ebe=0xc8;}else{_0xa76ebe=0xce;}_0x36a1df[_0xbbd7('0x1c')](_0xa76ebe);return _0x36a1df[_0xbbd7('0x22')](_0xbbd7('0x23'),_0xf9634+'-'+_0x45cdbb+'/'+_0x2afbd4)[_0xbbd7('0x24')](_0x2c2ff0);}return null;};}function patchUpdates(_0x5ac496){return function(_0x2ceaf3){try{jsonpatch[_0xbbd7('0x25')](_0x2ceaf3,_0x5ac496,!![]);}catch(_0x12621a){return BPromise[_0xbbd7('0x26')](_0x12621a);}return _0x2ceaf3[_0xbbd7('0x27')]();};}function saveUpdates(_0x2cb62a,_0x5ea98a){return function(_0x3ac08e){if(_0x3ac08e){return _0x3ac08e[_0xbbd7('0x28')](_0x2cb62a)[_0xbbd7('0x29')](function(_0x1842e5){return _0x1842e5;});}return null;};}function removeEntity(_0x49bf26,_0x5217a0){return function(_0x8e7e64){if(_0x8e7e64){return _0x8e7e64[_0xbbd7('0x2a')]()[_0xbbd7('0x29')](function(){var _0x4badff=_0x8e7e64['get']({'plain':!![]});var _0x30de='CustomReports';return db['UserProfileResource'][_0xbbd7('0x2a')]({'where':{'type':_0x30de,'resourceId':_0x4badff['id']}})[_0xbbd7('0x29')](function(){return _0x8e7e64;});})['then'](function(){_0x49bf26[_0xbbd7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e05e,_0x3e8e6a){return function(_0x1f1ac2){if(!_0x1f1ac2){_0x51e05e[_0xbbd7('0x1b')](0x194);}return _0x1f1ac2;};}function handleError(_0x2073de,_0x4e7dca){_0x4e7dca=_0x4e7dca||0x1f4;return function(_0x36cd6d){logger['error'](_0x36cd6d[_0xbbd7('0x2b')]);if(_0x36cd6d[_0xbbd7('0x2c')]){delete _0x36cd6d[_0xbbd7('0x2c')];}_0x2073de['status'](_0x4e7dca)['send'](_0x36cd6d);};}exports['index']=function(_0x27b6b2,_0x1d5ae9){var _0x5eeddb={},_0x1974fa={},_0xb1bb78={'count':0x0,'rows':[]};var _0xc3fbbe=_[_0xbbd7('0x2d')](db['AnalyticCustomReport'][_0xbbd7('0x2e')],function(_0x5414fe){return{'name':_0x5414fe[_0xbbd7('0x2f')],'type':_0x5414fe[_0xbbd7('0x30')][_0xbbd7('0x31')]};});_0x1974fa[_0xbbd7('0x32')]=_['map'](_0xc3fbbe,_0xbbd7('0x2c'));_0x1974fa[_0xbbd7('0x33')]=_[_0xbbd7('0x34')](_0x27b6b2[_0xbbd7('0x33')]);_0x1974fa[_0xbbd7('0x35')]=_['intersection'](_0x1974fa['model'],_0x1974fa['query']);_0x5eeddb[_0xbbd7('0x36')]=_['intersection'](_0x1974fa['model'],qs[_0xbbd7('0x37')](_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x37')]));_0x5eeddb[_0xbbd7('0x36')]=_0x5eeddb[_0xbbd7('0x36')][_0xbbd7('0x38')]?_0x5eeddb[_0xbbd7('0x36')]:_0x1974fa['model'];if(!_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x39')]('nolimit')){_0x5eeddb[_0xbbd7('0x21')]=qs['limit'](_0x27b6b2['query'][_0xbbd7('0x21')]);_0x5eeddb['offset']=qs[_0xbbd7('0x20')](_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x20')]);}_0x5eeddb[_0xbbd7('0x3a')]=qs[_0xbbd7('0x3b')](_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x3b')]);_0x5eeddb[_0xbbd7('0x3c')]=qs[_0xbbd7('0x35')](_[_0xbbd7('0x3d')](_0x27b6b2[_0xbbd7('0x33')],_0x1974fa[_0xbbd7('0x35')]),_0xc3fbbe);if(_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x3e')]){_0x5eeddb[_0xbbd7('0x3c')]=_[_0xbbd7('0x3f')](_0x5eeddb[_0xbbd7('0x3c')],{'$or':_[_0xbbd7('0x2d')](_0xc3fbbe,function(_0xa7ed39){if(_0xa7ed39[_0xbbd7('0x30')]!==_0xbbd7('0x40')){var _0x543eb7={};_0x543eb7[_0xa7ed39[_0xbbd7('0x2c')]]={'$like':'%'+_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x3e')]+'%'};return _0x543eb7;}})});}_0x5eeddb=_[_0xbbd7('0x3f')]({},_0x5eeddb,_0x27b6b2[_0xbbd7('0x41')]);var _0x59d02b={'where':_0x5eeddb[_0xbbd7('0x3c')]};return db[_0xbbd7('0x42')][_0xbbd7('0x1f')](_0x59d02b)[_0xbbd7('0x29')](function(_0x3b622b){_0xb1bb78[_0xbbd7('0x1f')]=_0x3b622b;if(_0x27b6b2[_0xbbd7('0x33')][_0xbbd7('0x43')]){_0x5eeddb[_0xbbd7('0x44')]=[{'all':!![]}];}return db[_0xbbd7('0x42')][_0xbbd7('0x45')](_0x5eeddb);})['then'](function(_0x38dc1b){_0xb1bb78[_0xbbd7('0x46')]=_0x38dc1b;return _0xb1bb78;})[_0xbbd7('0x29')](respondWithFilteredResult(_0x1d5ae9,_0x5eeddb))['catch'](handleError(_0x1d5ae9,null));};exports['show']=function(_0x135e41,_0x2c01ad){var _0x3042d1={'raw':![],'where':{'id':_0x135e41['params']['id']}},_0x63bd9b={};_0x63bd9b[_0xbbd7('0x32')]=_[_0xbbd7('0x34')](db[_0xbbd7('0x42')][_0xbbd7('0x2e')]);_0x63bd9b[_0xbbd7('0x33')]=_[_0xbbd7('0x34')](_0x135e41[_0xbbd7('0x33')]);_0x63bd9b['filters']=_['intersection'](_0x63bd9b[_0xbbd7('0x32')],_0x63bd9b[_0xbbd7('0x33')]);_0x3042d1[_0xbbd7('0x36')]=_[_0xbbd7('0x47')](_0x63bd9b[_0xbbd7('0x32')],qs[_0xbbd7('0x37')](_0x135e41[_0xbbd7('0x33')][_0xbbd7('0x37')]));_0x3042d1[_0xbbd7('0x36')]=_0x3042d1[_0xbbd7('0x36')][_0xbbd7('0x38')]?_0x3042d1[_0xbbd7('0x36')]:_0x63bd9b[_0xbbd7('0x32')];if(_0x135e41[_0xbbd7('0x33')][_0xbbd7('0x43')]){_0x3042d1[_0xbbd7('0x44')]=[{'all':!![]}];}_0x3042d1=_[_0xbbd7('0x3f')]({},_0x3042d1,_0x135e41['options']);return db['AnalyticCustomReport'][_0xbbd7('0x48')](_0x3042d1)[_0xbbd7('0x29')](handleEntityNotFound(_0x2c01ad,null))[_0xbbd7('0x29')](respondWithResult(_0x2c01ad,null))[_0xbbd7('0x49')](handleError(_0x2c01ad,null));};exports[_0xbbd7('0x4a')]=function(_0x864056,_0x5c6f28){return db['AnalyticCustomReport'][_0xbbd7('0x4a')](_0x864056['body'],{})[_0xbbd7('0x29')](function(_0x87f316){var _0x4a04e1=_0x864056['user'][_0xbbd7('0x4b')]({'plain':!![]});if(!_0x4a04e1)throw new Error(_0xbbd7('0x4c'));if(_0x4a04e1[_0xbbd7('0x4d')]==='user'){var _0x2334ad=_0x87f316[_0xbbd7('0x4b')]({'plain':!![]});var _0x5cf40a=_0xbbd7('0x4e');return db['UserProfileSection'][_0xbbd7('0x48')]({'where':{'name':_0x5cf40a,'userProfileId':_0x4a04e1[_0xbbd7('0x4f')]},'raw':!![]})[_0xbbd7('0x29')](function(_0x30d05d){if(_0x30d05d&&_0x30d05d[_0xbbd7('0x50')]===0x0){return db[_0xbbd7('0x51')][_0xbbd7('0x4a')]({'name':_0x2334ad[_0xbbd7('0x2c')],'resourceId':_0x2334ad['id'],'type':_0xbbd7('0x52'),'sectionId':_0x30d05d['id']},{})[_0xbbd7('0x29')](function(){return _0x87f316;});}else{return _0x87f316;}})[_0xbbd7('0x49')](function(_0x597481){logger['error'](_0xbbd7('0x53'),_0x597481);throw _0x597481;});}return _0x87f316;})[_0xbbd7('0x29')](respondWithResult(_0x5c6f28,0xc9))[_0xbbd7('0x49')](handleError(_0x5c6f28,null));};exports[_0xbbd7('0x28')]=function(_0x412b08,_0x4f6c82){if(_0x412b08[_0xbbd7('0x54')]['id']){delete _0x412b08[_0xbbd7('0x54')]['id'];}return db['AnalyticCustomReport'][_0xbbd7('0x48')]({'where':{'id':_0x412b08['params']['id']}})[_0xbbd7('0x29')](handleEntityNotFound(_0x4f6c82,null))['then'](saveUpdates(_0x412b08[_0xbbd7('0x54')],null))[_0xbbd7('0x29')](respondWithResult(_0x4f6c82,null))[_0xbbd7('0x49')](handleError(_0x4f6c82,null));};exports[_0xbbd7('0x2a')]=function(_0x47eabd,_0xe8c16e){return db['AnalyticCustomReport']['find']({'where':{'id':_0x47eabd[_0xbbd7('0x55')]['id']}})[_0xbbd7('0x29')](handleEntityNotFound(_0xe8c16e,null))[_0xbbd7('0x29')](removeEntity(_0xe8c16e,null))[_0xbbd7('0x49')](handleError(_0xe8c16e,null));};exports[_0xbbd7('0x56')]=function(_0x4976c8,_0x3f8b60){var _0x33bd6f=0xa;var _0xb109bf=[_0xbbd7('0x57'),_0xbbd7('0x58'),'right_join','cross_join'];var _0x4c8ab4={'SUM':_0xbbd7('0x59'),'COUNT':_0xbbd7('0x5a'),'COUNT DISTINCT':_0xbbd7('0x5b'),'MAX':'MAX(%s)','MIN':_0xbbd7('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbbd7('0x5d'),'GROUP_CONCAT ASC':_0xbbd7('0x5e'),'GROUP_CONCAT DESC':_0xbbd7('0x5f')};var _0x177abb={'SEC_TO_TIME':_0xbbd7('0x60'),'DATE':'DATE(%s)','HOUR':_0xbbd7('0x61'),'ROUND':_0xbbd7('0x62'),'UNIX_TIMESTAMP':_0xbbd7('0x63')};var _0x4b9314=function(_0x3de454){return!_['includes']([_0xbbd7('0x64'),_0xbbd7('0x65'),_0xbbd7('0x66'),'IS\x20NOT\x20EMPTY'],_0x3de454);};var _0x4331ab=function(_0x20f41b){if(!_0x20f41b||!_0x20f41b[_0xbbd7('0x67')][_0xbbd7('0x38')]){return'';}for(var _0x19265f='(',_0x46edbb=0x0;_0x46edbb<_0x20f41b[_0xbbd7('0x67')][_0xbbd7('0x38')];_0x46edbb+=0x1){_0x46edbb>0x0&&(_0x19265f+='\x20'+_0x20f41b['operator']+'\x20');_0x19265f+=_0x20f41b[_0xbbd7('0x67')][_0x46edbb][_0xbbd7('0x68')]?_0x4331ab(_0x20f41b[_0xbbd7('0x67')][_0x46edbb]['group']):_0x20f41b['rules'][_0x46edbb]['field']+'\x20'+_0x20f41b[_0xbbd7('0x67')][_0x46edbb][_0xbbd7('0x69')]+(_0x4b9314(_0x20f41b[_0xbbd7('0x67')][_0x46edbb][_0xbbd7('0x69')])?'\x20'+_0x20f41b['rules'][_0x46edbb]['value']:'');}return _0x19265f+')';};var _0x1cf366={'where':{'id':_0x4976c8[_0xbbd7('0x55')]['id']}},_0x5e471c,_0x1e640b,_0x1d39e0,_0x4c5c05,_0x5de3b6;_0x1cf366=_[_0xbbd7('0x3f')]({},_0x1cf366,_0x4976c8[_0xbbd7('0x41')]);return db[_0xbbd7('0x42')][_0xbbd7('0x48')](_0x1cf366)[_0xbbd7('0x29')](function(_0x306444){if(_0x306444){_0x5e471c=_0x306444;return _0x306444['getFields']();}return null;})['then'](function(_0xb0e1a3){if(_0xb0e1a3){if(!_0xb0e1a3['length']){throw new db[(_0xbbd7('0x6a'))][(_0xbbd7('0x6b'))](_0xbbd7('0x6c'),0x193);}_0x1e640b=_0xb0e1a3;return db[_0xbbd7('0x6d')][_0xbbd7('0x45')]({'raw':!![]});}return null;})[_0xbbd7('0x29')](function(_0x41f6bd){if(_0x41f6bd){_0x1d39e0=_[_0xbbd7('0x6e')](_0x41f6bd,'id');var _0x3fca93;var _0x30c361=squel[_0xbbd7('0x6f')]();_0x30c361[_0xbbd7('0x70')](_0x5e471c[_0xbbd7('0x71')]);for(var _0x1954b5=0x0;_0x1954b5<_0x1e640b[_0xbbd7('0x38')];_0x1954b5+=0x1){_0x3fca93=_0x1e640b[_0x1954b5]['MetricId']?_0x1d39e0[_0x1e640b[_0x1954b5][_0xbbd7('0x72')]]['metric']:_0x1e640b[_0x1954b5][_0xbbd7('0x73')];_0x3fca93=_0x1e640b[_0x1954b5][_0xbbd7('0x74')]?_['replace'](_0x4c8ab4[_0x1e640b[_0x1954b5][_0xbbd7('0x74')]],'%s',_0x3fca93):_0x3fca93;_0x3fca93=_0x1e640b[_0x1954b5][_0xbbd7('0x75')]?_['replace'](_0x177abb[_0x1e640b[_0x1954b5][_0xbbd7('0x75')]],'%s',_0x3fca93):_0x3fca93;if(_0x1e640b[_0x1954b5][_0xbbd7('0x76')]){_0x30c361['group'](_0x3fca93);}_0x1e640b[_0x1954b5][_0xbbd7('0x77')]&&_0x30c361[_0xbbd7('0x3a')](_0x3fca93,_0x1e640b[_0x1954b5]['orderBy']===_0xbbd7('0x78')?![]:!![]);_0x30c361[_0xbbd7('0x73')](_0x3fca93,_0x1e640b[_0x1954b5][_0xbbd7('0x79')]||_0x3fca93);}if(_0x5e471c[_0xbbd7('0x7a')]){_0x5e471c[_0xbbd7('0x7a')]=JSON[_0xbbd7('0x7b')](_0x5e471c[_0xbbd7('0x7a')]);for(var _0x4496d4=0x0;_0x4496d4<_0x5e471c[_0xbbd7('0x7a')][_0xbbd7('0x38')];_0x4496d4+=0x1){if(_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x30')]&&_[_0xbbd7('0x7c')](_0xb109bf,_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x30')])&&_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x7d')]&&_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x7e')]&&_0x5e471c[_0xbbd7('0x7a')][_0x4496d4]['foreignKey']){_0x30c361[_0x5e471c['joins'][_0x4496d4][_0xbbd7('0x30')]](_0x5e471c['joins'][_0x4496d4][_0xbbd7('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5e471c[_0xbbd7('0x71')],_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x7d')],_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x7e')],_0x5e471c[_0xbbd7('0x7a')][_0x4496d4][_0xbbd7('0x7f')]));}}}if(_0x5e471c[_0xbbd7('0x80')]){_0x5e471c[_0xbbd7('0x80')]=JSON[_0xbbd7('0x7b')](_0x5e471c[_0xbbd7('0x80')]);_0x30c361[_0xbbd7('0x3c')](_0x4331ab(_0x5e471c[_0xbbd7('0x80')][_0xbbd7('0x68')]));}_0x5de3b6=_0x30c361['clone']();_0x30c361[_0xbbd7('0x21')](_0x33bd6f);_0x30c361[_0xbbd7('0x20')](0x0);logger[_0xbbd7('0x81')]('Limited\x20Query:',_0x30c361[_0xbbd7('0x82')]());return dbH[_0xbbd7('0x83')]['query'](_0x30c361[_0xbbd7('0x82')](),{'type':dbH[_0xbbd7('0x83')][_0xbbd7('0x84')][_0xbbd7('0x85')]});}})[_0xbbd7('0x29')](respondWithResult(_0x3f8b60,null))[_0xbbd7('0x49')](handleError(_0x3f8b60,null));};function runReport(_0x37b528,_0x5f0206,_0x3b3f44){var _0x116a95=_0x5f0206[_0xbbd7('0x2c')];var _0x1333aa=0xa;var _0x52124b=[_0xbbd7('0x57'),_0xbbd7('0x58'),'right_join',_0xbbd7('0x86')];var _0xa387cf={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbbd7('0x5b'),'MAX':_0xbbd7('0x87'),'MIN':_0xbbd7('0x5c'),'AVG':_0xbbd7('0x88'),'GROUP_CONCAT':_0xbbd7('0x5d'),'GROUP_CONCAT ASC':_0xbbd7('0x5e'),'GROUP_CONCAT DESC':_0xbbd7('0x5f')};var _0x1ea571={'SEC_TO_TIME':_0xbbd7('0x60'),'DATE':_0xbbd7('0x89'),'HOUR':_0xbbd7('0x61'),'ROUND':_0xbbd7('0x62'),'UNIX_TIMESTAMP':_0xbbd7('0x63')};var _0x2b45ac=function(_0x139f99){return!_[_0xbbd7('0x7c')]([_0xbbd7('0x64'),_0xbbd7('0x65'),_0xbbd7('0x66'),_0xbbd7('0x8a')],_0x139f99);};var _0x48e49e=function(_0x1bde48){if(!_0x1bde48||!_0x1bde48[_0xbbd7('0x67')][_0xbbd7('0x38')]){return'';}for(var _0x2947c2='(',_0x5a217d=0x0;_0x5a217d<_0x1bde48[_0xbbd7('0x67')]['length'];_0x5a217d+=0x1){_0x5a217d>0x0&&(_0x2947c2+='\x20'+_0x1bde48[_0xbbd7('0x8b')]+'\x20');_0x2947c2+=_0x1bde48[_0xbbd7('0x67')][_0x5a217d]['group']?_0x48e49e(_0x1bde48['rules'][_0x5a217d]['group']):_0x1bde48[_0xbbd7('0x67')][_0x5a217d]['field']+'\x20'+_0x1bde48[_0xbbd7('0x67')][_0x5a217d][_0xbbd7('0x69')]+(_0x2b45ac(_0x1bde48[_0xbbd7('0x67')][_0x5a217d]['condition'])?'\x20'+_0x1bde48[_0xbbd7('0x67')][_0x5a217d][_0xbbd7('0x8c')]:'');}return _0x2947c2+')';};var _0x5d303d={'where':{'id':_0x37b528['id']}},_0x4de02d,_0x1869c2,_0x3ed0c8,_0xb47b5b,_0xdcef54;_0x5d303d=_['merge']({},_0x5d303d,_0x3b3f44);return db[_0xbbd7('0x42')][_0xbbd7('0x48')](_0x5d303d)[_0xbbd7('0x29')](function(_0x4d2a8f){if(_0x4d2a8f){_0x4de02d=_0x4d2a8f;return _0x4d2a8f[_0xbbd7('0x8d')]();}return null;})['then'](function(_0x44abc9){if(_0x44abc9){if(!_0x44abc9['length']){throw new db['Sequelize'][(_0xbbd7('0x6b'))](_0xbbd7('0x6c'),0x193);}_0x1869c2=_0x44abc9;return db[_0xbbd7('0x6d')][_0xbbd7('0x45')]({'raw':!![]});}return null;})[_0xbbd7('0x29')](function(_0x1ee357){if(_0x1ee357){_0x3ed0c8=_[_0xbbd7('0x6e')](_0x1ee357,'id');var _0x385665;var _0x225e60=squel['select']();_0x225e60['from'](_0x4de02d['table']);for(var _0x3725c5=0x0;_0x3725c5<_0x1869c2[_0xbbd7('0x38')];_0x3725c5+=0x1){_0x385665=_0x1869c2[_0x3725c5]['MetricId']?_0x3ed0c8[_0x1869c2[_0x3725c5][_0xbbd7('0x72')]][_0xbbd7('0x8e')]:_0x1869c2[_0x3725c5]['field'];_0x385665=_0x1869c2[_0x3725c5][_0xbbd7('0x74')]?_['replace'](_0xa387cf[_0x1869c2[_0x3725c5][_0xbbd7('0x74')]],'%s',_0x385665):_0x385665;_0x385665=_0x1869c2[_0x3725c5]['format']?_['replace'](_0x1ea571[_0x1869c2[_0x3725c5][_0xbbd7('0x75')]],'%s',_0x385665):_0x385665;if(_0x1869c2[_0x3725c5][_0xbbd7('0x76')]){_0x225e60[_0xbbd7('0x68')](_0x385665);}_0x1869c2[_0x3725c5]['orderBy']&&_0x225e60['order'](_0x385665,_0x1869c2[_0x3725c5][_0xbbd7('0x77')]===_0xbbd7('0x78')?![]:!![]);_0x225e60['field'](_0x385665,_0x1869c2[_0x3725c5][_0xbbd7('0x79')]||_0x385665);}if(_0x4de02d['joins']){_0x4de02d[_0xbbd7('0x7a')]=JSON[_0xbbd7('0x7b')](_0x4de02d[_0xbbd7('0x7a')]);for(var _0x32c132=0x0;_0x32c132<_0x4de02d['joins'][_0xbbd7('0x38')];_0x32c132+=0x1){if(_0x4de02d[_0xbbd7('0x7a')][_0x32c132][_0xbbd7('0x30')]&&_[_0xbbd7('0x7c')](_0x52124b,_0x4de02d['joins'][_0x32c132][_0xbbd7('0x30')])&&_0x4de02d['joins'][_0x32c132][_0xbbd7('0x7d')]&&_0x4de02d[_0xbbd7('0x7a')][_0x32c132][_0xbbd7('0x7e')]&&_0x4de02d[_0xbbd7('0x7a')][_0x32c132][_0xbbd7('0x7f')]){_0x225e60[_0x4de02d[_0xbbd7('0x7a')][_0x32c132][_0xbbd7('0x30')]](_0x4de02d[_0xbbd7('0x7a')][_0x32c132][_0xbbd7('0x7e')],null,util[_0xbbd7('0x75')](_0xbbd7('0x8f'),_0x4de02d[_0xbbd7('0x71')],_0x4de02d[_0xbbd7('0x7a')][_0x32c132]['parentKey'],_0x4de02d['joins'][_0x32c132][_0xbbd7('0x7e')],_0x4de02d['joins'][_0x32c132]['foreignKey']));}}}if(_0x4de02d[_0xbbd7('0x80')]){_0x4de02d[_0xbbd7('0x80')]=JSON[_0xbbd7('0x7b')](_0x4de02d['conditions']);_0x225e60[_0xbbd7('0x3c')](_0x48e49e(_0x4de02d['conditions'][_0xbbd7('0x68')]));}_0xdcef54=_0x225e60[_0xbbd7('0x90')]();_0x225e60[_0xbbd7('0x21')](_0x1333aa);_0x225e60[_0xbbd7('0x20')](0x0);return;}})[_0xbbd7('0x29')](function(){if(_0x5f0206[_0xbbd7('0x91')]==='web'){return null;}var _0x30a060=_[_0xbbd7('0x3f')](_0x5f0206,{'name':_0x5f0206[_0xbbd7('0x92')]||_0x5f0206[_0xbbd7('0x2c')]||_0x4de02d[_0xbbd7('0x2c')],'basename':_0x116a95,'savename':util[_0xbbd7('0x75')](_0xbbd7('0x93'),_0x5f0206[_0xbbd7('0x2c')]||_0x4de02d[_0xbbd7('0x2c')],require(_0xbbd7('0x94'))[_0xbbd7('0x95')](0x4),_0x5f0206[_0xbbd7('0x91')]||'csv'),'reportId':_0x4de02d['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xbbd7('0x4a')](_0x30a060,{'raw':!![]});})[_0xbbd7('0x29')](function(_0xc11665){if(_0x4de02d[_0xbbd7('0x71')]===_0xbbd7('0x96')){_0xdcef54[_0xbbd7('0x3c')](_0x4de02d['table']+_0xbbd7('0x97'),_0x5f0206[_0xbbd7('0x98')],_0x5f0206[_0xbbd7('0x99')]);}else{_0xdcef54[_0xbbd7('0x3c')](_0x4de02d[_0xbbd7('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5f0206[_0xbbd7('0x98')],_0x5f0206[_0xbbd7('0x99')]);}if(_0xc11665){logger[_0xbbd7('0x9a')]('Run\x20Query:',_0xdcef54['toString']());require(_0xbbd7('0x9b'))[_0xbbd7('0x9c')](path[_0xbbd7('0x57')](__dirname,_0xbbd7('0x9d'),_0xc11665[_0xbbd7('0x91')]),[_0xc11665['id'],_0xdcef54['toString'](),path[_0xbbd7('0x57')](__dirname,_0xbbd7('0x9e'),_0xc11665['savename']),_0x116a95]);return _0xc11665;}else{var _0x256a5a=squel[_0xbbd7('0x6f')]();_0x256a5a[_0xbbd7('0x70')]('('+_0xdcef54[_0xbbd7('0x82')]()+')',_0xbbd7('0x9f'));_0x256a5a[_0xbbd7('0x73')](_0xbbd7('0xa0'),'count');_0xdcef54[_0xbbd7('0x21')](_0x5f0206[_0xbbd7('0x21')]||_0x1333aa);_0xdcef54[_0xbbd7('0x20')](_0x5f0206[_0xbbd7('0x20')]||0x0);return dbH[_0xbbd7('0x83')]['query'](_0x256a5a['toString'](),{'type':dbH[_0xbbd7('0x83')][_0xbbd7('0x84')]['SELECT']})['then'](function(_0x13a456){if(!_0x13a456['length']){_0xb47b5b=0x0;}else{_0xb47b5b=_0x13a456[0x0][_0xbbd7('0x1f')]||0x0;}return dbH[_0xbbd7('0x83')]['query'](_0xdcef54[_0xbbd7('0x82')](),{'type':dbH[_0xbbd7('0x83')][_0xbbd7('0x84')][_0xbbd7('0x85')]});})[_0xbbd7('0x29')](function(_0x6d6049){return{'rows':_0x6d6049||[],'count':_0xb47b5b};});}});}exports[_0xbbd7('0xa1')]=function(_0x479b55,_0x232db1){return runReport(_0x479b55[_0xbbd7('0x55')],_0x479b55[_0xbbd7('0x33')],_0x479b55[_0xbbd7('0x41')])[_0xbbd7('0x29')](respondWithResult(_0x232db1,null))[_0xbbd7('0x49')](handleError(_0x232db1,null));};exports[_0xbbd7('0xa2')]=runReport;exports[_0xbbd7('0x33')]=function(_0x41eef0,_0xbf2320){var _0x5daabd=0xa;var _0x231020=['join',_0xbbd7('0x58'),'right_join',_0xbbd7('0x86')];var _0x905401={'SUM':_0xbbd7('0x59'),'COUNT':_0xbbd7('0x5a'),'COUNT DISTINCT':_0xbbd7('0x5b'),'MAX':_0xbbd7('0x87'),'MIN':_0xbbd7('0x5c'),'AVG':_0xbbd7('0x88'),'GROUP_CONCAT':_0xbbd7('0x5d'),'GROUP_CONCAT ASC':_0xbbd7('0x5e'),'GROUP_CONCAT DESC':_0xbbd7('0x5f')};var _0xe7710d={'SEC_TO_TIME':_0xbbd7('0x60'),'DATE':'DATE(%s)','HOUR':_0xbbd7('0x61'),'ROUND':_0xbbd7('0x62'),'UNIX_TIMESTAMP':_0xbbd7('0x63')};var _0x59c0c0=function(_0x4b525f){return!_[_0xbbd7('0x7c')]([_0xbbd7('0x64'),_0xbbd7('0x65'),_0xbbd7('0x66'),'IS\x20NOT\x20EMPTY'],_0x4b525f);};var _0x572724=function(_0x24215b){if(!_0x24215b||!_0x24215b[_0xbbd7('0x67')][_0xbbd7('0x38')]){return'';}for(var _0x14cce9='(',_0x2d23d9=0x0;_0x2d23d9<_0x24215b['rules'][_0xbbd7('0x38')];_0x2d23d9+=0x1){_0x2d23d9>0x0&&(_0x14cce9+='\x20'+_0x24215b[_0xbbd7('0x8b')]+'\x20');_0x14cce9+=_0x24215b[_0xbbd7('0x67')][_0x2d23d9][_0xbbd7('0x68')]?_0x572724(_0x24215b[_0xbbd7('0x67')][_0x2d23d9][_0xbbd7('0x68')]):_0x24215b[_0xbbd7('0x67')][_0x2d23d9][_0xbbd7('0x73')]+'\x20'+_0x24215b['rules'][_0x2d23d9][_0xbbd7('0x69')]+(_0x59c0c0(_0x24215b[_0xbbd7('0x67')][_0x2d23d9][_0xbbd7('0x69')])?'\x20'+_0x24215b['rules'][_0x2d23d9][_0xbbd7('0x8c')]:'');}return _0x14cce9+')';};var _0x185b27={'where':{'id':_0x41eef0[_0xbbd7('0x55')]['id']}},_0x46a097,_0x42a282,_0x544701,_0x3f0252,_0x12335c;_0x185b27=_[_0xbbd7('0x3f')]({},_0x185b27,_0x41eef0[_0xbbd7('0x41')]);return db[_0xbbd7('0x42')][_0xbbd7('0x48')](_0x185b27)[_0xbbd7('0x29')](function(_0x308ede){if(_0x308ede){_0x46a097=_0x308ede;return _0x308ede[_0xbbd7('0x8d')]();}return null;})['then'](function(_0x4f470c){if(_0x4f470c){if(!_0x4f470c[_0xbbd7('0x38')]){throw new db['Sequelize']['ValidationErrorItem'](_0xbbd7('0x6c'),0x193);}_0x42a282=_0x4f470c;return db[_0xbbd7('0x6d')][_0xbbd7('0x45')]({'raw':!![]});}return null;})['then'](function(_0x522fdd){if(_0x522fdd){_0x544701=_[_0xbbd7('0x6e')](_0x522fdd,'id');var _0x42ff51;var _0x2c8dff=squel['select']();_0x2c8dff[_0xbbd7('0x70')](_0x46a097[_0xbbd7('0x71')]);for(var _0x44ea21=0x0;_0x44ea21<_0x42a282[_0xbbd7('0x38')];_0x44ea21+=0x1){_0x42ff51=_0x42a282[_0x44ea21]['MetricId']?_0x544701[_0x42a282[_0x44ea21]['MetricId']][_0xbbd7('0x8e')]:_0x42a282[_0x44ea21]['field'];_0x42ff51=_0x42a282[_0x44ea21][_0xbbd7('0x74')]?_[_0xbbd7('0xa3')](_0x905401[_0x42a282[_0x44ea21][_0xbbd7('0x74')]],'%s',_0x42ff51):_0x42ff51;_0x42ff51=_0x42a282[_0x44ea21][_0xbbd7('0x75')]?_[_0xbbd7('0xa3')](_0xe7710d[_0x42a282[_0x44ea21][_0xbbd7('0x75')]],'%s',_0x42ff51):_0x42ff51;if(_0x42a282[_0x44ea21]['groupBy']){_0x2c8dff[_0xbbd7('0x68')](_0x42ff51);}_0x42a282[_0x44ea21]['orderBy']&&_0x2c8dff['order'](_0x42ff51,_0x42a282[_0x44ea21][_0xbbd7('0x77')]===_0xbbd7('0x78')?![]:!![]);_0x2c8dff[_0xbbd7('0x73')](_0x42ff51,_0x42a282[_0x44ea21][_0xbbd7('0x79')]||_0x42ff51);}if(_0x46a097[_0xbbd7('0x7a')]){_0x46a097[_0xbbd7('0x7a')]=JSON[_0xbbd7('0x7b')](_0x46a097[_0xbbd7('0x7a')]);for(var _0x54082f=0x0;_0x54082f<_0x46a097[_0xbbd7('0x7a')]['length'];_0x54082f+=0x1){if(_0x46a097[_0xbbd7('0x7a')][_0x54082f][_0xbbd7('0x30')]&&_[_0xbbd7('0x7c')](_0x231020,_0x46a097[_0xbbd7('0x7a')][_0x54082f]['type'])&&_0x46a097[_0xbbd7('0x7a')][_0x54082f]['parentKey']&&_0x46a097['joins'][_0x54082f][_0xbbd7('0x7e')]&&_0x46a097[_0xbbd7('0x7a')][_0x54082f]['foreignKey']){_0x2c8dff[_0x46a097['joins'][_0x54082f][_0xbbd7('0x30')]](_0x46a097[_0xbbd7('0x7a')][_0x54082f][_0xbbd7('0x7e')],null,util[_0xbbd7('0x75')]('%s.%s\x20=\x20%s.%s',_0x46a097[_0xbbd7('0x71')],_0x46a097[_0xbbd7('0x7a')][_0x54082f][_0xbbd7('0x7d')],_0x46a097[_0xbbd7('0x7a')][_0x54082f][_0xbbd7('0x7e')],_0x46a097[_0xbbd7('0x7a')][_0x54082f][_0xbbd7('0x7f')]));}}}if(_0x46a097[_0xbbd7('0x80')]){_0x46a097[_0xbbd7('0x80')]=JSON['parse'](_0x46a097[_0xbbd7('0x80')]);_0x2c8dff[_0xbbd7('0x3c')](_0x572724(_0x46a097[_0xbbd7('0x80')][_0xbbd7('0x68')]));}_0x12335c=_0x2c8dff[_0xbbd7('0x90')]();_0x2c8dff[_0xbbd7('0x21')](_0x5daabd);_0x2c8dff[_0xbbd7('0x20')](0x0);logger[_0xbbd7('0x81')](_0xbbd7('0xa4'),_0x2c8dff[_0xbbd7('0x82')]());return dbH[_0xbbd7('0x83')]['query'](_0x2c8dff[_0xbbd7('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0xbbd7('0x85')]});}})[_0xbbd7('0x29')](function(){return{'sql':_0x12335c['toString']()};})[_0xbbd7('0x29')](respondWithResult(_0xbf2320,null))[_0xbbd7('0x49')](handleError(_0xbf2320,null));}; \ No newline at end of file +var _0x64e6=['fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticCustomReport','includeAll','findAll','rows','catch','show','intersection','include','find','create','user','Reports','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','join','COUNT(DISTINCT\x20%s)','DATE(%s)','IS\x20EMPTY','condition','from','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../files/reports','savename','COUNT(*)','QueryTypes','SELECT','run','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes'];(function(_0x488820,_0x18e13a){var _0x4f0366=function(_0x4fda9e){while(--_0x4fda9e){_0x488820['push'](_0x488820['shift']());}};_0x4f0366(++_0x18e13a);}(_0x64e6,0x1b2));var _0x664e=function(_0x288b5a,_0x337e71){_0x288b5a=_0x288b5a-0x0;var _0x1f5241=_0x64e6[_0x288b5a];return _0x1f5241;};'use strict';var emlformat=require(_0x664e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x664e('0x1'));var jsonpatch=require(_0x664e('0x2'));var rp=require(_0x664e('0x3'));var moment=require(_0x664e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x664e('0x5'));var path=require('path');var sox=require(_0x664e('0x6'));var csv=require(_0x664e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x664e('0x8'));var _=require(_0x664e('0x9'));var squel=require(_0x664e('0xa'));var crypto=require('crypto');var jsforce=require(_0x664e('0xb'));var deskjs=require(_0x664e('0xc'));var toCsv=require(_0x664e('0x7'));var querystring=require(_0x664e('0xd'));var Papa=require(_0x664e('0xe'));var Redis=require(_0x664e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x664e('0x10'));var as=require(_0x664e('0x11'));var hardwareService=require(_0x664e('0x12'));var logger=require(_0x664e('0x13'))(_0x664e('0x14'));var utils=require('../../config/utils');var config=require(_0x664e('0x15'));var licenseUtil=require(_0x664e('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0x664e('0x17'))['dbH'];function respondWithStatusCode(_0x14671b,_0x32d217){_0x32d217=_0x32d217||0xcc;return function(_0x575407){if(_0x575407){return _0x14671b['sendStatus'](_0x32d217);}return _0x14671b[_0x664e('0x18')](_0x32d217)[_0x664e('0x19')]();};}function respondWithResult(_0x48df4e,_0x34ef62){_0x34ef62=_0x34ef62||0xc8;return function(_0x3f2fb5){if(_0x3f2fb5){return _0x48df4e[_0x664e('0x18')](_0x34ef62)[_0x664e('0x1a')](_0x3f2fb5);}};}function respondWithFilteredResult(_0x2a967f,_0x4e9a56){return function(_0xb1da9e){if(_0xb1da9e){var _0x47c019=typeof _0x4e9a56[_0x664e('0x1b')]==='undefined'&&typeof _0x4e9a56[_0x664e('0x1c')]==='undefined';var _0x677349=_0xb1da9e[_0x664e('0x1d')];var _0x5c783d=_0x47c019?0x0:_0x4e9a56[_0x664e('0x1b')];var _0x39e9f0=_0x47c019?_0xb1da9e[_0x664e('0x1d')]:_0x4e9a56['offset']+_0x4e9a56[_0x664e('0x1c')];var _0x49b444;if(_0x39e9f0>=_0x677349){_0x39e9f0=_0x677349;_0x49b444=0xc8;}else{_0x49b444=0xce;}_0x2a967f[_0x664e('0x18')](_0x49b444);return _0x2a967f[_0x664e('0x1e')](_0x664e('0x1f'),_0x5c783d+'-'+_0x39e9f0+'/'+_0x677349)['json'](_0xb1da9e);}return null;};}function patchUpdates(_0x593be0){return function(_0x364641){try{jsonpatch['apply'](_0x364641,_0x593be0,!![]);}catch(_0x149490){return BPromise[_0x664e('0x20')](_0x149490);}return _0x364641[_0x664e('0x21')]();};}function saveUpdates(_0x3fbc90,_0x5f36e4){return function(_0x4fdc8f){if(_0x4fdc8f){return _0x4fdc8f[_0x664e('0x22')](_0x3fbc90)[_0x664e('0x23')](function(_0x14f7f5){return _0x14f7f5;});}return null;};}function removeEntity(_0x351336,_0x1f7801){return function(_0x51cbd2){if(_0x51cbd2){return _0x51cbd2[_0x664e('0x24')]()[_0x664e('0x23')](function(){var _0x393212=_0x51cbd2[_0x664e('0x25')]({'plain':!![]});var _0x7e3679='CustomReports';return db[_0x664e('0x26')][_0x664e('0x24')]({'where':{'type':_0x7e3679,'resourceId':_0x393212['id']}})['then'](function(){return _0x51cbd2;});})[_0x664e('0x23')](function(){_0x351336[_0x664e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6ae86e,_0x12f3f6){return function(_0x460af4){if(!_0x460af4){_0x6ae86e['sendStatus'](0x194);}return _0x460af4;};}function handleError(_0x35220f,_0x54f4a1){_0x54f4a1=_0x54f4a1||0x1f4;return function(_0x5b5371){logger['error'](_0x5b5371[_0x664e('0x27')]);if(_0x5b5371[_0x664e('0x28')]){delete _0x5b5371[_0x664e('0x28')];}_0x35220f[_0x664e('0x18')](_0x54f4a1)[_0x664e('0x29')](_0x5b5371);};}exports[_0x664e('0x2a')]=function(_0x3cbaf6,_0x4d9612){var _0x5d6639={},_0x17944f={},_0x180085={'count':0x0,'rows':[]};var _0x5f82f3=_[_0x664e('0x2b')](db['AnalyticCustomReport'][_0x664e('0x2c')],function(_0x22b618){return{'name':_0x22b618[_0x664e('0x2d')],'type':_0x22b618[_0x664e('0x2e')]['key']};});_0x17944f[_0x664e('0x2f')]=_[_0x664e('0x2b')](_0x5f82f3,_0x664e('0x28'));_0x17944f[_0x664e('0x30')]=_[_0x664e('0x31')](_0x3cbaf6[_0x664e('0x30')]);_0x17944f[_0x664e('0x32')]=_['intersection'](_0x17944f[_0x664e('0x2f')],_0x17944f[_0x664e('0x30')]);_0x5d6639[_0x664e('0x33')]=_['intersection'](_0x17944f[_0x664e('0x2f')],qs[_0x664e('0x34')](_0x3cbaf6['query'][_0x664e('0x34')]));_0x5d6639[_0x664e('0x33')]=_0x5d6639['attributes'][_0x664e('0x35')]?_0x5d6639[_0x664e('0x33')]:_0x17944f['model'];if(!_0x3cbaf6[_0x664e('0x30')][_0x664e('0x36')]('nolimit')){_0x5d6639['limit']=qs[_0x664e('0x1c')](_0x3cbaf6[_0x664e('0x30')][_0x664e('0x1c')]);_0x5d6639[_0x664e('0x1b')]=qs[_0x664e('0x1b')](_0x3cbaf6['query'][_0x664e('0x1b')]);}_0x5d6639[_0x664e('0x37')]=qs[_0x664e('0x38')](_0x3cbaf6[_0x664e('0x30')][_0x664e('0x38')]);_0x5d6639[_0x664e('0x39')]=qs[_0x664e('0x32')](_[_0x664e('0x3a')](_0x3cbaf6['query'],_0x17944f[_0x664e('0x32')]),_0x5f82f3);if(_0x3cbaf6[_0x664e('0x30')][_0x664e('0x3b')]){_0x5d6639['where']=_['merge'](_0x5d6639[_0x664e('0x39')],{'$or':_[_0x664e('0x2b')](_0x5f82f3,function(_0x1b5528){if(_0x1b5528['type']!==_0x664e('0x3c')){var _0x2de92e={};_0x2de92e[_0x1b5528[_0x664e('0x28')]]={'$like':'%'+_0x3cbaf6['query'][_0x664e('0x3b')]+'%'};return _0x2de92e;}})});}_0x5d6639=_[_0x664e('0x3d')]({},_0x5d6639,_0x3cbaf6[_0x664e('0x3e')]);var _0x79b8a4={'where':_0x5d6639[_0x664e('0x39')]};return db[_0x664e('0x3f')][_0x664e('0x1d')](_0x79b8a4)[_0x664e('0x23')](function(_0x42f1db){_0x180085['count']=_0x42f1db;if(_0x3cbaf6[_0x664e('0x30')][_0x664e('0x40')]){_0x5d6639['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x664e('0x41')](_0x5d6639);})[_0x664e('0x23')](function(_0xc10e25){_0x180085[_0x664e('0x42')]=_0xc10e25;return _0x180085;})[_0x664e('0x23')](respondWithFilteredResult(_0x4d9612,_0x5d6639))[_0x664e('0x43')](handleError(_0x4d9612,null));};exports[_0x664e('0x44')]=function(_0x427624,_0x4fe9bd){var _0x237f89={'raw':![],'where':{'id':_0x427624['params']['id']}},_0xfa8fd9={};_0xfa8fd9['model']=_[_0x664e('0x31')](db[_0x664e('0x3f')][_0x664e('0x2c')]);_0xfa8fd9[_0x664e('0x30')]=_['keys'](_0x427624['query']);_0xfa8fd9[_0x664e('0x32')]=_[_0x664e('0x45')](_0xfa8fd9['model'],_0xfa8fd9[_0x664e('0x30')]);_0x237f89[_0x664e('0x33')]=_['intersection'](_0xfa8fd9[_0x664e('0x2f')],qs[_0x664e('0x34')](_0x427624['query'][_0x664e('0x34')]));_0x237f89[_0x664e('0x33')]=_0x237f89[_0x664e('0x33')][_0x664e('0x35')]?_0x237f89['attributes']:_0xfa8fd9[_0x664e('0x2f')];if(_0x427624[_0x664e('0x30')][_0x664e('0x40')]){_0x237f89[_0x664e('0x46')]=[{'all':!![]}];}_0x237f89=_[_0x664e('0x3d')]({},_0x237f89,_0x427624['options']);return db[_0x664e('0x3f')][_0x664e('0x47')](_0x237f89)[_0x664e('0x23')](handleEntityNotFound(_0x4fe9bd,null))['then'](respondWithResult(_0x4fe9bd,null))[_0x664e('0x43')](handleError(_0x4fe9bd,null));};exports[_0x664e('0x48')]=function(_0x1f3e89,_0x42fb4e){return db[_0x664e('0x3f')][_0x664e('0x48')](_0x1f3e89['body'],{})[_0x664e('0x23')](function(_0x42bd7f){var _0x43a54f=_0x1f3e89[_0x664e('0x49')][_0x664e('0x25')]({'plain':!![]});if(!_0x43a54f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a54f['role']===_0x664e('0x49')){var _0x28f8c9=_0x42bd7f[_0x664e('0x25')]({'plain':!![]});var _0x4b8a76=_0x664e('0x4a');return db['UserProfileSection'][_0x664e('0x47')]({'where':{'name':_0x4b8a76,'userProfileId':_0x43a54f['userProfileId']},'raw':!![]})['then'](function(_0x52ec36){if(_0x52ec36&&_0x52ec36[_0x664e('0x4b')]===0x0){return db[_0x664e('0x26')]['create']({'name':_0x28f8c9[_0x664e('0x28')],'resourceId':_0x28f8c9['id'],'type':_0x664e('0x4c'),'sectionId':_0x52ec36['id']},{})[_0x664e('0x23')](function(){return _0x42bd7f;});}else{return _0x42bd7f;}})['catch'](function(_0x44509d){logger[_0x664e('0x4d')](_0x664e('0x4e'),_0x44509d);throw _0x44509d;});}return _0x42bd7f;})[_0x664e('0x23')](respondWithResult(_0x42fb4e,0xc9))[_0x664e('0x43')](handleError(_0x42fb4e,null));};exports[_0x664e('0x22')]=function(_0x187881,_0x37f122){if(_0x187881[_0x664e('0x4f')]['id']){delete _0x187881[_0x664e('0x4f')]['id'];}return db[_0x664e('0x3f')][_0x664e('0x47')]({'where':{'id':_0x187881['params']['id']}})['then'](handleEntityNotFound(_0x37f122,null))[_0x664e('0x23')](saveUpdates(_0x187881[_0x664e('0x4f')],null))[_0x664e('0x23')](respondWithResult(_0x37f122,null))['catch'](handleError(_0x37f122,null));};exports[_0x664e('0x24')]=function(_0x2cccdb,_0x17645d){return db[_0x664e('0x3f')][_0x664e('0x47')]({'where':{'id':_0x2cccdb[_0x664e('0x50')]['id']}})[_0x664e('0x23')](handleEntityNotFound(_0x17645d,null))['then'](removeEntity(_0x17645d,null))[_0x664e('0x43')](handleError(_0x17645d,null));};exports[_0x664e('0x51')]=function(_0x38f326,_0x141a6f){var _0xe81685=0xa;var _0x6d16ad=['join',_0x664e('0x52'),_0x664e('0x53'),_0x664e('0x54')];var _0x4ebbd5={'SUM':_0x664e('0x55'),'COUNT':_0x664e('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x664e('0x57'),'MIN':_0x664e('0x58'),'AVG':_0x664e('0x59'),'GROUP_CONCAT':_0x664e('0x5a'),'GROUP_CONCAT ASC':_0x664e('0x5b'),'GROUP_CONCAT DESC':_0x664e('0x5c')};var _0x5a4e02={'SEC_TO_TIME':_0x664e('0x5d'),'DATE':'DATE(%s)','HOUR':_0x664e('0x5e'),'ROUND':_0x664e('0x5f'),'UNIX_TIMESTAMP':_0x664e('0x60')};var _0xe02cc9=function(_0x16a651){return!_[_0x664e('0x61')]([_0x664e('0x62'),_0x664e('0x63'),'IS\x20EMPTY',_0x664e('0x64')],_0x16a651);};var _0x348131=function(_0x3fed0c){if(!_0x3fed0c||!_0x3fed0c[_0x664e('0x65')][_0x664e('0x35')]){return'';}for(var _0x38158f='(',_0x276d02=0x0;_0x276d02<_0x3fed0c['rules'][_0x664e('0x35')];_0x276d02+=0x1){_0x276d02>0x0&&(_0x38158f+='\x20'+_0x3fed0c[_0x664e('0x66')]+'\x20');_0x38158f+=_0x3fed0c['rules'][_0x276d02][_0x664e('0x67')]?_0x348131(_0x3fed0c[_0x664e('0x65')][_0x276d02][_0x664e('0x67')]):_0x3fed0c[_0x664e('0x65')][_0x276d02][_0x664e('0x68')]+'\x20'+_0x3fed0c[_0x664e('0x65')][_0x276d02]['condition']+(_0xe02cc9(_0x3fed0c[_0x664e('0x65')][_0x276d02]['condition'])?'\x20'+_0x3fed0c[_0x664e('0x65')][_0x276d02][_0x664e('0x69')]:'');}return _0x38158f+')';};var _0xf7b09f={'where':{'id':_0x38f326[_0x664e('0x50')]['id']}},_0x261fb7,_0x2fb2ac,_0x4cc9a3,_0x1a57f0,_0x26f561;_0xf7b09f=_[_0x664e('0x3d')]({},_0xf7b09f,_0x38f326['options']);return db[_0x664e('0x3f')][_0x664e('0x47')](_0xf7b09f)[_0x664e('0x23')](function(_0xcbb404){if(_0xcbb404){_0x261fb7=_0xcbb404;return _0xcbb404[_0x664e('0x6a')]();}return null;})[_0x664e('0x23')](function(_0x15a698){if(_0x15a698){if(!_0x15a698['length']){throw new db[(_0x664e('0x6b'))][(_0x664e('0x6c'))](_0x664e('0x6d'),0x193);}_0x2fb2ac=_0x15a698;return db[_0x664e('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x664e('0x23')](function(_0x8bb879){if(_0x8bb879){_0x4cc9a3=_[_0x664e('0x6f')](_0x8bb879,'id');var _0x3c9fe2;var _0x224930=squel[_0x664e('0x70')]();_0x224930['from'](_0x261fb7[_0x664e('0x71')]);for(var _0x248d23=0x0;_0x248d23<_0x2fb2ac[_0x664e('0x35')];_0x248d23+=0x1){_0x3c9fe2=_0x2fb2ac[_0x248d23][_0x664e('0x72')]?_0x4cc9a3[_0x2fb2ac[_0x248d23][_0x664e('0x72')]][_0x664e('0x73')]:_0x2fb2ac[_0x248d23][_0x664e('0x68')];_0x3c9fe2=_0x2fb2ac[_0x248d23][_0x664e('0x74')]?_['replace'](_0x4ebbd5[_0x2fb2ac[_0x248d23][_0x664e('0x74')]],'%s',_0x3c9fe2):_0x3c9fe2;_0x3c9fe2=_0x2fb2ac[_0x248d23][_0x664e('0x75')]?_[_0x664e('0x76')](_0x5a4e02[_0x2fb2ac[_0x248d23][_0x664e('0x75')]],'%s',_0x3c9fe2):_0x3c9fe2;if(_0x2fb2ac[_0x248d23][_0x664e('0x77')]){_0x224930[_0x664e('0x67')](_0x3c9fe2);}_0x2fb2ac[_0x248d23][_0x664e('0x78')]&&_0x224930[_0x664e('0x37')](_0x3c9fe2,_0x2fb2ac[_0x248d23]['orderBy']===_0x664e('0x79')?![]:!![]);_0x224930[_0x664e('0x68')](_0x3c9fe2,_0x2fb2ac[_0x248d23][_0x664e('0x7a')]||_0x3c9fe2);}if(_0x261fb7[_0x664e('0x7b')]){_0x261fb7[_0x664e('0x7b')]=JSON[_0x664e('0x7c')](_0x261fb7[_0x664e('0x7b')]);for(var _0x53b1a5=0x0;_0x53b1a5<_0x261fb7[_0x664e('0x7b')]['length'];_0x53b1a5+=0x1){if(_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x2e')]&&_['includes'](_0x6d16ad,_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x2e')])&&_0x261fb7['joins'][_0x53b1a5][_0x664e('0x7d')]&&_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x7e')]&&_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x7f')]){_0x224930[_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x2e')]](_0x261fb7[_0x664e('0x7b')][_0x53b1a5]['foreignTable'],null,util[_0x664e('0x75')](_0x664e('0x80'),_0x261fb7[_0x664e('0x71')],_0x261fb7['joins'][_0x53b1a5][_0x664e('0x7d')],_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x7e')],_0x261fb7[_0x664e('0x7b')][_0x53b1a5][_0x664e('0x7f')]));}}}if(_0x261fb7[_0x664e('0x81')]){_0x261fb7[_0x664e('0x81')]=JSON[_0x664e('0x7c')](_0x261fb7[_0x664e('0x81')]);_0x224930[_0x664e('0x39')](_0x348131(_0x261fb7['conditions']['group']));}_0x26f561=_0x224930[_0x664e('0x82')]();_0x224930[_0x664e('0x1c')](_0xe81685);_0x224930[_0x664e('0x1b')](0x0);logger[_0x664e('0x83')](_0x664e('0x84'),_0x224930[_0x664e('0x85')]());return dbH[_0x664e('0x86')][_0x664e('0x30')](_0x224930[_0x664e('0x85')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x664e('0x23')](respondWithResult(_0x141a6f,null))[_0x664e('0x43')](handleError(_0x141a6f,null));};function runReport(_0x240636,_0x33a256,_0x4d1e1c){var _0x594087=_0x33a256[_0x664e('0x28')];var _0xf293f2=0xa;var _0x36f1b5=[_0x664e('0x87'),'left_join',_0x664e('0x53'),_0x664e('0x54')];var _0x49f452={'SUM':'SUM(%s)','COUNT':_0x664e('0x56'),'COUNT DISTINCT':_0x664e('0x88'),'MAX':_0x664e('0x57'),'MIN':_0x664e('0x58'),'AVG':_0x664e('0x59'),'GROUP_CONCAT':_0x664e('0x5a'),'GROUP_CONCAT ASC':_0x664e('0x5b'),'GROUP_CONCAT DESC':_0x664e('0x5c')};var _0x21ef4d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x664e('0x89'),'HOUR':_0x664e('0x5e'),'ROUND':_0x664e('0x5f'),'UNIX_TIMESTAMP':_0x664e('0x60')};var _0x3f1eef=function(_0x4d2c2c){return!_['includes']([_0x664e('0x62'),_0x664e('0x63'),_0x664e('0x8a'),_0x664e('0x64')],_0x4d2c2c);};var _0x103b2b=function(_0x3083e8){if(!_0x3083e8||!_0x3083e8[_0x664e('0x65')][_0x664e('0x35')]){return'';}for(var _0x54b8d1='(',_0x3e26c8=0x0;_0x3e26c8<_0x3083e8[_0x664e('0x65')]['length'];_0x3e26c8+=0x1){_0x3e26c8>0x0&&(_0x54b8d1+='\x20'+_0x3083e8[_0x664e('0x66')]+'\x20');_0x54b8d1+=_0x3083e8['rules'][_0x3e26c8][_0x664e('0x67')]?_0x103b2b(_0x3083e8[_0x664e('0x65')][_0x3e26c8][_0x664e('0x67')]):_0x3083e8[_0x664e('0x65')][_0x3e26c8][_0x664e('0x68')]+'\x20'+_0x3083e8[_0x664e('0x65')][_0x3e26c8]['condition']+(_0x3f1eef(_0x3083e8['rules'][_0x3e26c8][_0x664e('0x8b')])?'\x20'+_0x3083e8[_0x664e('0x65')][_0x3e26c8]['value']:'');}return _0x54b8d1+')';};var _0x31599d={'where':{'id':_0x240636['id']}},_0x260107,_0x45dc8b,_0x36aa92,_0x58377,_0x36d988;_0x31599d=_['merge']({},_0x31599d,_0x4d1e1c);return db[_0x664e('0x3f')]['find'](_0x31599d)[_0x664e('0x23')](function(_0x516bbb){if(_0x516bbb){_0x260107=_0x516bbb;return _0x516bbb[_0x664e('0x6a')]();}return null;})[_0x664e('0x23')](function(_0x2dcefb){if(_0x2dcefb){if(!_0x2dcefb[_0x664e('0x35')]){throw new db['Sequelize'][(_0x664e('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x45dc8b=_0x2dcefb;return db[_0x664e('0x6e')][_0x664e('0x41')]({'raw':!![]});}return null;})[_0x664e('0x23')](function(_0x4d6cce){if(_0x4d6cce){_0x36aa92=_[_0x664e('0x6f')](_0x4d6cce,'id');var _0x228f73;var _0x3bf324=squel[_0x664e('0x70')]();_0x3bf324[_0x664e('0x8c')](_0x260107[_0x664e('0x71')]);for(var _0x50ed6a=0x0;_0x50ed6a<_0x45dc8b[_0x664e('0x35')];_0x50ed6a+=0x1){_0x228f73=_0x45dc8b[_0x50ed6a]['MetricId']?_0x36aa92[_0x45dc8b[_0x50ed6a][_0x664e('0x72')]]['metric']:_0x45dc8b[_0x50ed6a][_0x664e('0x68')];_0x228f73=_0x45dc8b[_0x50ed6a]['function']?_['replace'](_0x49f452[_0x45dc8b[_0x50ed6a][_0x664e('0x74')]],'%s',_0x228f73):_0x228f73;_0x228f73=_0x45dc8b[_0x50ed6a]['format']?_[_0x664e('0x76')](_0x21ef4d[_0x45dc8b[_0x50ed6a][_0x664e('0x75')]],'%s',_0x228f73):_0x228f73;if(_0x45dc8b[_0x50ed6a][_0x664e('0x77')]){_0x3bf324[_0x664e('0x67')](_0x228f73);}_0x45dc8b[_0x50ed6a]['orderBy']&&_0x3bf324[_0x664e('0x37')](_0x228f73,_0x45dc8b[_0x50ed6a][_0x664e('0x78')]==='DESC'?![]:!![]);_0x3bf324[_0x664e('0x68')](_0x228f73,_0x45dc8b[_0x50ed6a]['alias']||_0x228f73);}if(_0x260107[_0x664e('0x7b')]){_0x260107['joins']=JSON[_0x664e('0x7c')](_0x260107['joins']);for(var _0x19966e=0x0;_0x19966e<_0x260107[_0x664e('0x7b')][_0x664e('0x35')];_0x19966e+=0x1){if(_0x260107[_0x664e('0x7b')][_0x19966e][_0x664e('0x2e')]&&_[_0x664e('0x61')](_0x36f1b5,_0x260107[_0x664e('0x7b')][_0x19966e][_0x664e('0x2e')])&&_0x260107[_0x664e('0x7b')][_0x19966e][_0x664e('0x7d')]&&_0x260107['joins'][_0x19966e][_0x664e('0x7e')]&&_0x260107[_0x664e('0x7b')][_0x19966e][_0x664e('0x7f')]){_0x3bf324[_0x260107[_0x664e('0x7b')][_0x19966e]['type']](_0x260107[_0x664e('0x7b')][_0x19966e][_0x664e('0x7e')],null,util[_0x664e('0x75')]('%s.%s\x20=\x20%s.%s',_0x260107['table'],_0x260107[_0x664e('0x7b')][_0x19966e][_0x664e('0x7d')],_0x260107[_0x664e('0x7b')][_0x19966e]['foreignTable'],_0x260107['joins'][_0x19966e][_0x664e('0x7f')]));}}}if(_0x260107[_0x664e('0x81')]){_0x260107[_0x664e('0x81')]=JSON[_0x664e('0x7c')](_0x260107['conditions']);_0x3bf324[_0x664e('0x39')](_0x103b2b(_0x260107[_0x664e('0x81')]['group']));}_0x36d988=_0x3bf324[_0x664e('0x82')]();_0x3bf324[_0x664e('0x1c')](_0xf293f2);_0x3bf324['offset'](0x0);return;}})[_0x664e('0x23')](function(){if(_0x33a256[_0x664e('0x8d')]===_0x664e('0x8e')){return null;}var _0xfef594=_[_0x664e('0x3d')](_0x33a256,{'name':_0x33a256[_0x664e('0x8f')]||_0x33a256[_0x664e('0x28')]||_0x260107[_0x664e('0x28')],'basename':_0x594087,'savename':util[_0x664e('0x75')](_0x664e('0x90'),_0x33a256[_0x664e('0x28')]||_0x260107[_0x664e('0x28')],require(_0x664e('0x91'))[_0x664e('0x92')](0x4),_0x33a256['output']||'csv'),'reportId':_0x260107['id'],'reportType':_0x664e('0x93')});return db[_0x664e('0x94')]['create'](_0xfef594,{'raw':!![]});})['then'](function(_0x538502){if(_0x260107[_0x664e('0x71')]==='cdr'){_0x36d988[_0x664e('0x39')](_0x260107[_0x664e('0x71')]+_0x664e('0x95'),_0x33a256[_0x664e('0x96')],_0x33a256[_0x664e('0x97')]);}else{_0x36d988[_0x664e('0x39')](_0x260107['table']+_0x664e('0x98'),_0x33a256['startDate'],_0x33a256[_0x664e('0x97')]);}if(_0x538502){logger[_0x664e('0x99')]('Run\x20Query:',_0x36d988[_0x664e('0x85')]());require(_0x664e('0x9a'))[_0x664e('0x9b')](path[_0x664e('0x87')](__dirname,'../../components/export/',_0x538502[_0x664e('0x8d')]),[_0x538502['id'],_0x36d988[_0x664e('0x85')](),path['join'](__dirname,_0x664e('0x9c'),_0x538502[_0x664e('0x9d')]),_0x594087]);return _0x538502;}else{var _0x3acdbb=squel[_0x664e('0x70')]();_0x3acdbb['from']('('+_0x36d988[_0x664e('0x85')]()+')','countTable');_0x3acdbb[_0x664e('0x68')](_0x664e('0x9e'),_0x664e('0x1d'));_0x36d988[_0x664e('0x1c')](_0x33a256[_0x664e('0x1c')]||_0xf293f2);_0x36d988[_0x664e('0x1b')](_0x33a256[_0x664e('0x1b')]||0x0);return dbH[_0x664e('0x86')]['query'](_0x3acdbb[_0x664e('0x85')](),{'type':dbH[_0x664e('0x86')][_0x664e('0x9f')][_0x664e('0xa0')]})[_0x664e('0x23')](function(_0x5da381){if(!_0x5da381[_0x664e('0x35')]){_0x58377=0x0;}else{_0x58377=_0x5da381[0x0][_0x664e('0x1d')]||0x0;}return dbH[_0x664e('0x86')]['query'](_0x36d988[_0x664e('0x85')](),{'type':dbH[_0x664e('0x86')]['QueryTypes']['SELECT']});})['then'](function(_0x484160){return{'rows':_0x484160||[],'count':_0x58377};});}});}exports[_0x664e('0xa1')]=function(_0x1836da,_0x40aaa7){return runReport(_0x1836da[_0x664e('0x50')],_0x1836da[_0x664e('0x30')],_0x1836da[_0x664e('0x3e')])[_0x664e('0x23')](respondWithResult(_0x40aaa7,null))[_0x664e('0x43')](handleError(_0x40aaa7,null));};exports['runReport']=runReport;exports['query']=function(_0xd36dba,_0x144ee9){var _0x317f3e=0xa;var _0x590716=['join',_0x664e('0x52'),_0x664e('0x53'),_0x664e('0x54')];var _0x4bf20e={'SUM':_0x664e('0x55'),'COUNT':_0x664e('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x664e('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x664e('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x664e('0x5c')};var _0xa56c7e={'SEC_TO_TIME':_0x664e('0x5d'),'DATE':'DATE(%s)','HOUR':_0x664e('0x5e'),'ROUND':_0x664e('0x5f'),'UNIX_TIMESTAMP':_0x664e('0x60')};var _0x5091db=function(_0x3dc054){return!_[_0x664e('0x61')]([_0x664e('0x62'),'IS\x20NOT\x20NULL',_0x664e('0x8a'),_0x664e('0x64')],_0x3dc054);};var _0x3907db=function(_0x2eb354){if(!_0x2eb354||!_0x2eb354['rules'][_0x664e('0x35')]){return'';}for(var _0x221ce8='(',_0x357c46=0x0;_0x357c46<_0x2eb354[_0x664e('0x65')][_0x664e('0x35')];_0x357c46+=0x1){_0x357c46>0x0&&(_0x221ce8+='\x20'+_0x2eb354[_0x664e('0x66')]+'\x20');_0x221ce8+=_0x2eb354['rules'][_0x357c46][_0x664e('0x67')]?_0x3907db(_0x2eb354[_0x664e('0x65')][_0x357c46][_0x664e('0x67')]):_0x2eb354[_0x664e('0x65')][_0x357c46][_0x664e('0x68')]+'\x20'+_0x2eb354['rules'][_0x357c46][_0x664e('0x8b')]+(_0x5091db(_0x2eb354[_0x664e('0x65')][_0x357c46]['condition'])?'\x20'+_0x2eb354[_0x664e('0x65')][_0x357c46]['value']:'');}return _0x221ce8+')';};var _0x4a58d6={'where':{'id':_0xd36dba[_0x664e('0x50')]['id']}},_0x1fa99c,_0x1abc9f,_0x131659,_0xb55e9b,_0x1c506f;_0x4a58d6=_['merge']({},_0x4a58d6,_0xd36dba['options']);return db['AnalyticCustomReport'][_0x664e('0x47')](_0x4a58d6)[_0x664e('0x23')](function(_0x375c62){if(_0x375c62){_0x1fa99c=_0x375c62;return _0x375c62[_0x664e('0x6a')]();}return null;})[_0x664e('0x23')](function(_0x1f8482){if(_0x1f8482){if(!_0x1f8482[_0x664e('0x35')]){throw new db['Sequelize'][(_0x664e('0x6c'))](_0x664e('0x6d'),0x193);}_0x1abc9f=_0x1f8482;return db[_0x664e('0x6e')][_0x664e('0x41')]({'raw':!![]});}return null;})[_0x664e('0x23')](function(_0x27584b){if(_0x27584b){_0x131659=_['keyBy'](_0x27584b,'id');var _0x383e6b;var _0x4d4024=squel[_0x664e('0x70')]();_0x4d4024[_0x664e('0x8c')](_0x1fa99c[_0x664e('0x71')]);for(var _0x2c9810=0x0;_0x2c9810<_0x1abc9f[_0x664e('0x35')];_0x2c9810+=0x1){_0x383e6b=_0x1abc9f[_0x2c9810][_0x664e('0x72')]?_0x131659[_0x1abc9f[_0x2c9810][_0x664e('0x72')]]['metric']:_0x1abc9f[_0x2c9810][_0x664e('0x68')];_0x383e6b=_0x1abc9f[_0x2c9810][_0x664e('0x74')]?_['replace'](_0x4bf20e[_0x1abc9f[_0x2c9810][_0x664e('0x74')]],'%s',_0x383e6b):_0x383e6b;_0x383e6b=_0x1abc9f[_0x2c9810]['format']?_[_0x664e('0x76')](_0xa56c7e[_0x1abc9f[_0x2c9810][_0x664e('0x75')]],'%s',_0x383e6b):_0x383e6b;if(_0x1abc9f[_0x2c9810]['groupBy']){_0x4d4024[_0x664e('0x67')](_0x383e6b);}_0x1abc9f[_0x2c9810][_0x664e('0x78')]&&_0x4d4024[_0x664e('0x37')](_0x383e6b,_0x1abc9f[_0x2c9810][_0x664e('0x78')]==='DESC'?![]:!![]);_0x4d4024[_0x664e('0x68')](_0x383e6b,_0x1abc9f[_0x2c9810]['alias']||_0x383e6b);}if(_0x1fa99c[_0x664e('0x7b')]){_0x1fa99c['joins']=JSON[_0x664e('0x7c')](_0x1fa99c[_0x664e('0x7b')]);for(var _0x39e0ad=0x0;_0x39e0ad<_0x1fa99c[_0x664e('0x7b')][_0x664e('0x35')];_0x39e0ad+=0x1){if(_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x2e')]&&_[_0x664e('0x61')](_0x590716,_0x1fa99c['joins'][_0x39e0ad][_0x664e('0x2e')])&&_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x7d')]&&_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x7e')]&&_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x7f')]){_0x4d4024[_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x2e')]](_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x7e')],null,util['format'](_0x664e('0x80'),_0x1fa99c[_0x664e('0x71')],_0x1fa99c[_0x664e('0x7b')][_0x39e0ad]['parentKey'],_0x1fa99c[_0x664e('0x7b')][_0x39e0ad][_0x664e('0x7e')],_0x1fa99c[_0x664e('0x7b')][_0x39e0ad]['foreignKey']));}}}if(_0x1fa99c[_0x664e('0x81')]){_0x1fa99c[_0x664e('0x81')]=JSON[_0x664e('0x7c')](_0x1fa99c[_0x664e('0x81')]);_0x4d4024['where'](_0x3907db(_0x1fa99c[_0x664e('0x81')][_0x664e('0x67')]));}_0x1c506f=_0x4d4024['clone']();_0x4d4024[_0x664e('0x1c')](_0x317f3e);_0x4d4024[_0x664e('0x1b')](0x0);logger[_0x664e('0x83')](_0x664e('0x84'),_0x4d4024[_0x664e('0x85')]());return dbH[_0x664e('0x86')][_0x664e('0x30')](_0x4d4024['toString'](),{'type':dbH[_0x664e('0x86')][_0x664e('0x9f')][_0x664e('0xa0')]});}})['then'](function(){return{'sql':_0x1c506f[_0x664e('0x85')]()};})[_0x664e('0x23')](respondWithResult(_0x144ee9,null))[_0x664e('0x43')](handleError(_0x144ee9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 47f1bf9..4b9b403 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 _0x6a1c=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a1c,0xb0));var _0xc6a1=function(_0x50c7e1,_0x3e134a){_0x50c7e1=_0x50c7e1-0x0;var _0x48fbd6=_0x6a1c[_0x50c7e1];return _0x48fbd6;};'use strict';var _=require(_0xc6a1('0x0'));var util=require(_0xc6a1('0x1'));var logger=require('../../config/logger')(_0xc6a1('0x2'));var moment=require(_0xc6a1('0x3'));var BPromise=require('bluebird');var rp=require(_0xc6a1('0x4'));var fs=require('fs');var path=require(_0xc6a1('0x5'));var rimraf=require(_0xc6a1('0x6'));var config=require(_0xc6a1('0x7'));var attributes=require(_0xc6a1('0x8'));module['exports']=function(_0x1d5114,_0x411f9b){return _0x1d5114[_0xc6a1('0x9')](_0xc6a1('0xa'),attributes,{'tableName':_0xc6a1('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd5e=['path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','util','moment','bluebird','request-promise'];(function(_0x38aabb,_0x477305){var _0x5ba3e4=function(_0xd486f9){while(--_0xd486f9){_0x38aabb['push'](_0x38aabb['shift']());}};_0x5ba3e4(++_0x477305);}(_0xbd5e,0xa6));var _0xebd5=function(_0x283630,_0x22f536){_0x283630=_0x283630-0x0;var _0x5e28fd=_0xbd5e[_0x283630];return _0x5e28fd;};'use strict';var _=require('lodash');var util=require(_0xebd5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xebd5('0x1'));var BPromise=require(_0xebd5('0x2'));var rp=require(_0xebd5('0x3'));var fs=require('fs');var path=require(_0xebd5('0x4'));var rimraf=require(_0xebd5('0x5'));var config=require('../../config/environment');var attributes=require(_0xebd5('0x6'));module[_0xebd5('0x7')]=function(_0x2895c9,_0x152177){return _0x2895c9['define'](_0xebd5('0x8'),attributes,{'tableName':_0xebd5('0x9'),'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 70d4c1f..99f1a9e 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 _0xafb6=['code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c4b99,_0xe8bf48){var _0x171ccb=function(_0x88db28){while(--_0x88db28){_0x5c4b99['push'](_0x5c4b99['shift']());}};_0x171ccb(++_0xe8bf48);}(_0xafb6,0x156));var _0x6afb=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0xafb6[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0x6afb('0x0'));var util=require(_0x6afb('0x1'));var moment=require(_0x6afb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6afb('0x3'));var fs=require('fs');var Redis=require(_0x6afb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6afb('0x5'));var logger=require(_0x6afb('0x6'))(_0x6afb('0x7'));var config=require(_0x6afb('0x8'));var jayson=require(_0x6afb('0x9'));var client=jayson['client'][_0x6afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ccaf3,_0x44730a,_0x5d7b4b){return new BPromise(function(_0x282aa2,_0x414340){return client[_0x6afb('0xb')](_0x5ccaf3,_0x5d7b4b)[_0x6afb('0xc')](function(_0x26aa52){logger['info'](_0x6afb('0xd'),_0x44730a,_0x6afb('0xe'));logger[_0x6afb('0xf')](_0x6afb('0x10'),_0x44730a,_0x6afb('0xe'),JSON[_0x6afb('0x11')](_0x26aa52));if(_0x26aa52['error']){if(_0x26aa52['error'][_0x6afb('0x12')]===0x1f4){logger[_0x6afb('0x13')](_0x6afb('0xd'),_0x44730a,_0x26aa52[_0x6afb('0x13')][_0x6afb('0x14')]);return _0x414340(_0x26aa52[_0x6afb('0x13')][_0x6afb('0x14')]);}logger[_0x6afb('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x44730a,_0x26aa52[_0x6afb('0x13')]['message']);return _0x282aa2(_0x26aa52[_0x6afb('0x13')][_0x6afb('0x14')]);}else{logger[_0x6afb('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x44730a,'request\x20sent');_0x282aa2(_0x26aa52[_0x6afb('0x16')][_0x6afb('0x14')]);}})[_0x6afb('0x17')](function(_0x4561d2){logger[_0x6afb('0x13')](_0x6afb('0xd'),_0x44730a,_0x4561d2);_0x414340(_0x4561d2);});});} \ No newline at end of file +var _0xb788=['error','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb788,0x17f));var _0x8b78=function(_0x5016c9,_0x57cdf0){_0x5016c9=_0x5016c9-0x0;var _0x5371ee=_0xb788[_0x5016c9];return _0x5371ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b78('0x0'));var BPromise=require('bluebird');var rs=require(_0x8b78('0x1'));var fs=require('fs');var Redis=require(_0x8b78('0x2'));var db=require(_0x8b78('0x3'))['db'];var utils=require(_0x8b78('0x4'));var logger=require(_0x8b78('0x5'))(_0x8b78('0x6'));var config=require(_0x8b78('0x7'));var jayson=require(_0x8b78('0x8'));var client=jayson[_0x8b78('0x9')][_0x8b78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2caad0,_0x378387,_0x4aeac4){return new BPromise(function(_0xd22869,_0x53cc82){return client['request'](_0x2caad0,_0x4aeac4)[_0x8b78('0xb')](function(_0x1c9cbf){logger[_0x8b78('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x378387,_0x8b78('0xd'));logger[_0x8b78('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x378387,_0x8b78('0xd'),JSON[_0x8b78('0xf')](_0x1c9cbf));if(_0x1c9cbf[_0x8b78('0x10')]){if(_0x1c9cbf[_0x8b78('0x10')]['code']===0x1f4){logger[_0x8b78('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x378387,_0x1c9cbf['error'][_0x8b78('0x11')]);return _0x53cc82(_0x1c9cbf[_0x8b78('0x10')][_0x8b78('0x11')]);}logger[_0x8b78('0x10')](_0x8b78('0x12'),_0x378387,_0x1c9cbf['error'][_0x8b78('0x11')]);return _0xd22869(_0x1c9cbf['error'][_0x8b78('0x11')]);}else{logger[_0x8b78('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x378387,_0x8b78('0xd'));_0xd22869(_0x1c9cbf[_0x8b78('0x13')]['message']);}})[_0x8b78('0x14')](function(_0x473edc){logger['error'](_0x8b78('0x12'),_0x378387,_0x473edc);_0x53cc82(_0x473edc);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 974c48f..0be5305 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 _0xea11=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/preview','preview','/:id/run','/:id/query','post','create','put','update','delete'];(function(_0x48c387,_0x55baa6){var _0x379f28=function(_0x2f7d79){while(--_0x2f7d79){_0x48c387['push'](_0x48c387['shift']());}};_0x379f28(++_0x55baa6);}(_0xea11,0x6f));var _0x1ea1=function(_0x30c66b,_0x3e10e9){_0x30c66b=_0x30c66b-0x0;var _0x54f719=_0xea11[_0x30c66b];return _0x54f719;};'use strict';var multer=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var path=require(_0x1ea1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ea1('0x3')]();var fs_extra=require(_0x1ea1('0x4'));var auth=require(_0x1ea1('0x5'));var interaction=require(_0x1ea1('0x6'));var config=require(_0x1ea1('0x7'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1ea1('0x8')]);router[_0x1ea1('0x9')](_0x1ea1('0xa'),auth[_0x1ea1('0xb')](),controller['show']);router[_0x1ea1('0x9')](_0x1ea1('0xc'),auth[_0x1ea1('0xb')](),controller[_0x1ea1('0xd')]);router[_0x1ea1('0x9')](_0x1ea1('0xe'),auth[_0x1ea1('0xb')](),controller['run']);router[_0x1ea1('0x9')](_0x1ea1('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x1ea1('0x10')]('/',auth['isAuthenticated'](),controller[_0x1ea1('0x11')]);router[_0x1ea1('0x12')](_0x1ea1('0xa'),auth[_0x1ea1('0xb')](),controller[_0x1ea1('0x13')]);router[_0x1ea1('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1ea1('0x15')]=router; \ No newline at end of file +var _0x1db3=['/:id/query','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run'];(function(_0x2b47e7,_0x4c3bc0){var _0x360cbd=function(_0x250e96){while(--_0x250e96){_0x2b47e7['push'](_0x2b47e7['shift']());}};_0x360cbd(++_0x4c3bc0);}(_0x1db3,0x7e));var _0x31db=function(_0x53b39d,_0x279d8e){_0x53b39d=_0x53b39d-0x0;var _0x55171b=_0x1db3[_0x53b39d];return _0x55171b;};'use strict';var multer=require(_0x31db('0x0'));var util=require(_0x31db('0x1'));var path=require(_0x31db('0x2'));var timeout=require('connect-timeout');var express=require(_0x31db('0x3'));var router=express[_0x31db('0x4')]();var fs_extra=require(_0x31db('0x5'));var auth=require(_0x31db('0x6'));var interaction=require(_0x31db('0x7'));var config=require(_0x31db('0x8'));var controller=require(_0x31db('0x9'));router[_0x31db('0xa')]('/',auth[_0x31db('0xb')](),controller[_0x31db('0xc')]);router[_0x31db('0xa')](_0x31db('0xd'),auth[_0x31db('0xb')](),controller[_0x31db('0xe')]);router['get'](_0x31db('0xf'),auth[_0x31db('0xb')](),controller[_0x31db('0x10')]);router[_0x31db('0xa')]('/:id/run',auth[_0x31db('0xb')](),controller[_0x31db('0x11')]);router[_0x31db('0xa')](_0x31db('0x12'),auth[_0x31db('0xb')](),controller['query']);router[_0x31db('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x31db('0x14')](_0x31db('0xd'),auth[_0x31db('0xb')](),controller[_0x31db('0x15')]);router['delete'](_0x31db('0xd'),auth[_0x31db('0xb')](),controller[_0x31db('0x16')]);module[_0x31db('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 2a50101..beea5ff 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x2675,0x75));var _0x5267=function(_0x316fb3,_0x57ac35){_0x316fb3=_0x316fb3-0x0;var _0x24b833=_0x2675[_0x316fb3];return _0x24b833;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0xdc97,0x13b));var _0x7dc9=function(_0x534714,_0x2abe44){_0x534714=_0x534714-0x0;var _0x5c1c6f=_0xdc97[_0x534714];return _0x5c1c6f;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a8bc421..a28e344 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x5361dd,_0x56dfb2){var _0x4f4077=function(_0x15819f){while(--_0x15819f){_0x5361dd['push'](_0x5361dd['shift']());}};_0x4f4077(++_0x56dfb2);}(_0xba34,0x119));var _0x4ba3=function(_0x468502,_0x202602){_0x468502=_0x468502-0x0;var _0x39901c=_0xba34[_0x468502];return _0x39901c;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x3073ac,_0x29dc2b){var _0x31d3bd=function(_0x163b3b){while(--_0x163b3b){_0x3073ac['push'](_0x3073ac['shift']());}};_0x31d3bd(++_0x29dc2b);}(_0xda19,0xd5));var _0x9da1=function(_0x20cbc2,_0xf68490){_0x20cbc2=_0x20cbc2-0x0;var _0x28b0b7=_0xda19[_0x20cbc2];return _0x28b0b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index fa35968..a092132 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 _0xb238=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','api','moment'];(function(_0x4b2ed7,_0x5b3100){var _0x55a953=function(_0x4b7abd){while(--_0x4b7abd){_0x4b2ed7['push'](_0x4b2ed7['shift']());}};_0x55a953(++_0x5b3100);}(_0xb238,0x17e));var _0x8b23=function(_0x591ec5,_0x2c94c5){_0x591ec5=_0x591ec5-0x0;var _0x56ed11=_0xb238[_0x591ec5];return _0x56ed11;};'use strict';var _=require(_0x8b23('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8b23('0x1'));var moment=require(_0x8b23('0x2'));var BPromise=require(_0x8b23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b23('0x4'));var rimraf=require(_0x8b23('0x5'));var config=require(_0x8b23('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x8b23('0x7')]=function(_0x20acf8,_0x539487){return _0x20acf8[_0x8b23('0x8')](_0x8b23('0x9'),attributes,{'tableName':_0x8b23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe32d=['rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','moment','request-promise','path'];(function(_0xf1acc1,_0x58a444){var _0x364215=function(_0x3f333c){while(--_0x3f333c){_0xf1acc1['push'](_0xf1acc1['shift']());}};_0x364215(++_0x58a444);}(_0xe32d,0x92));var _0xde32=function(_0x21596a,_0x597558){_0x21596a=_0x21596a-0x0;var _0x207c9b=_0xe32d[_0x21596a];return _0x207c9b;};'use strict';var _=require(_0xde32('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xde32('0x1'));var BPromise=require('bluebird');var rp=require(_0xde32('0x2'));var fs=require('fs');var path=require(_0xde32('0x3'));var rimraf=require(_0xde32('0x4'));var config=require(_0xde32('0x5'));var attributes=require(_0xde32('0x6'));module['exports']=function(_0x17677d,_0xd2876b){return _0x17677d[_0xde32('0x7')](_0xde32('0x8'),attributes,{'tableName':_0xde32('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 ba0af79..27bd772 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 _0xb2b5=['request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','client'];(function(_0x596e98,_0xc326c9){var _0x1c09ac=function(_0x3d839d){while(--_0x3d839d){_0x596e98['push'](_0x596e98['shift']());}};_0x1c09ac(++_0xc326c9);}(_0xb2b5,0xc0));var _0x5b2b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb2b5[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x5b2b('0x0'));var util=require(_0x5b2b('0x1'));var moment=require(_0x5b2b('0x2'));var BPromise=require(_0x5b2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b2b('0x4'));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[_0x5b2b('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4236bc,_0x30a670,_0x5d1f93){return new BPromise(function(_0x504f75,_0x1a5ea9){return client[_0x5b2b('0x6')](_0x4236bc,_0x5d1f93)[_0x5b2b('0x7')](function(_0x430c04){logger['info'](_0x5b2b('0x8'),_0x30a670,_0x5b2b('0x9'));logger['debug'](_0x5b2b('0xa'),_0x30a670,_0x5b2b('0x9'),JSON[_0x5b2b('0xb')](_0x430c04));if(_0x430c04[_0x5b2b('0xc')]){if(_0x430c04[_0x5b2b('0xc')][_0x5b2b('0xd')]===0x1f4){logger[_0x5b2b('0xc')](_0x5b2b('0x8'),_0x30a670,_0x430c04[_0x5b2b('0xc')][_0x5b2b('0xe')]);return _0x1a5ea9(_0x430c04[_0x5b2b('0xc')][_0x5b2b('0xe')]);}logger[_0x5b2b('0xc')](_0x5b2b('0x8'),_0x30a670,_0x430c04[_0x5b2b('0xc')][_0x5b2b('0xe')]);return _0x504f75(_0x430c04[_0x5b2b('0xc')][_0x5b2b('0xe')]);}else{logger[_0x5b2b('0xf')](_0x5b2b('0x8'),_0x30a670,_0x5b2b('0x9'));_0x504f75(_0x430c04[_0x5b2b('0x10')][_0x5b2b('0xe')]);}})[_0x5b2b('0x11')](function(_0x57d35b){logger[_0x5b2b('0xc')](_0x5b2b('0x8'),_0x30a670,_0x57d35b);_0x1a5ea9(_0x57d35b);});});} \ No newline at end of file +var _0x3f8f=['AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x3f8f,0x1cb));var _0xf3f8=function(_0x1c8fd3,_0x57cb04){_0x1c8fd3=_0x1c8fd3-0x0;var _0x2592cd=_0x3f8f[_0x1c8fd3];return _0x2592cd;};'use strict';var _=require(_0xf3f8('0x0'));var util=require('util');var moment=require(_0xf3f8('0x1'));var BPromise=require(_0xf3f8('0x2'));var rs=require(_0xf3f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3f8('0x4'))['db'];var utils=require(_0xf3f8('0x5'));var logger=require(_0xf3f8('0x6'))('rpc');var config=require(_0xf3f8('0x7'));var jayson=require(_0xf3f8('0x8'));var client=jayson[_0xf3f8('0x9')][_0xf3f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4663a9,_0x5997ca,_0xdba019){return new BPromise(function(_0x2bb008,_0x1e3f24){return client['request'](_0x4663a9,_0xdba019)[_0xf3f8('0xb')](function(_0xfd5b63){logger[_0xf3f8('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5997ca,'request\x20sent');logger[_0xf3f8('0xd')](_0xf3f8('0xe'),_0x5997ca,'request\x20sent',JSON['stringify'](_0xfd5b63));if(_0xfd5b63[_0xf3f8('0xf')]){if(_0xfd5b63[_0xf3f8('0xf')]['code']===0x1f4){logger[_0xf3f8('0xf')](_0xf3f8('0x10'),_0x5997ca,_0xfd5b63[_0xf3f8('0xf')][_0xf3f8('0x11')]);return _0x1e3f24(_0xfd5b63[_0xf3f8('0xf')][_0xf3f8('0x11')]);}logger[_0xf3f8('0xf')](_0xf3f8('0x10'),_0x5997ca,_0xfd5b63[_0xf3f8('0xf')][_0xf3f8('0x11')]);return _0x2bb008(_0xfd5b63[_0xf3f8('0xf')][_0xf3f8('0x11')]);}else{logger[_0xf3f8('0xc')](_0xf3f8('0x10'),_0x5997ca,'request\x20sent');_0x2bb008(_0xfd5b63[_0xf3f8('0x12')][_0xf3f8('0x11')]);}})['catch'](function(_0x44b38d){logger[_0xf3f8('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5997ca,_0x44b38d);_0x1e3f24(_0x44b38d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 19daa54..7df7dc8 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 _0x37f8=['update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','post','create'];(function(_0x48adc5,_0x3f2723){var _0x1e532f=function(_0x360bd9){while(--_0x360bd9){_0x48adc5['push'](_0x48adc5['shift']());}};_0x1e532f(++_0x3f2723);}(_0x37f8,0xb3));var _0x837f=function(_0x2da707,_0x20ca44){_0x2da707=_0x2da707-0x0;var _0x211651=_0x37f8[_0x2da707];return _0x211651;};'use strict';var multer=require('multer');var util=require(_0x837f('0x0'));var path=require(_0x837f('0x1'));var timeout=require(_0x837f('0x2'));var express=require('express');var router=express[_0x837f('0x3')]();var fs_extra=require(_0x837f('0x4'));var auth=require(_0x837f('0x5'));var interaction=require(_0x837f('0x6'));var config=require(_0x837f('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x837f('0x8')]('/',auth[_0x837f('0x9')](),controller[_0x837f('0xa')]);router[_0x837f('0x8')](_0x837f('0xb'),auth['isAuthenticated'](),controller[_0x837f('0xc')]);router['get'](_0x837f('0xd'),auth[_0x837f('0x9')](),controller['preview']);router[_0x837f('0x8')](_0x837f('0xe'),auth['isAuthenticated'](),controller[_0x837f('0xf')]);router[_0x837f('0x8')](_0x837f('0x10'),auth[_0x837f('0x9')](),controller['query']);router[_0x837f('0x11')]('/',auth[_0x837f('0x9')](),controller[_0x837f('0x12')]);router['put']('/:id',auth[_0x837f('0x9')](),controller[_0x837f('0x13')]);router[_0x837f('0x14')](_0x837f('0xb'),auth[_0x837f('0x9')](),controller['destroy']);module[_0x837f('0x15')]=router; \ No newline at end of file +var _0x3402=['express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','put','destroy','exports','multer','path'];(function(_0x2e26f5,_0x226f4d){var _0x2f9b1c=function(_0x4825e4){while(--_0x4825e4){_0x2e26f5['push'](_0x2e26f5['shift']());}};_0x2f9b1c(++_0x226f4d);}(_0x3402,0x163));var _0x2340=function(_0x6b7e40,_0xe65904){_0x6b7e40=_0x6b7e40-0x0;var _0xe33bb4=_0x3402[_0x6b7e40];return _0xe33bb4;};'use strict';var multer=require(_0x2340('0x0'));var util=require('util');var path=require(_0x2340('0x1'));var timeout=require('connect-timeout');var express=require(_0x2340('0x2'));var router=express[_0x2340('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2340('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2340('0x5'));var controller=require(_0x2340('0x6'));router[_0x2340('0x7')]('/',auth[_0x2340('0x8')](),controller[_0x2340('0x9')]);router[_0x2340('0x7')](_0x2340('0xa'),auth[_0x2340('0x8')](),controller[_0x2340('0xb')]);router[_0x2340('0x7')](_0x2340('0xc'),auth['isAuthenticated'](),controller[_0x2340('0xd')]);router[_0x2340('0x7')]('/:id/run',auth[_0x2340('0x8')](),controller[_0x2340('0xe')]);router['get'](_0x2340('0xf'),auth[_0x2340('0x8')](),controller[_0x2340('0x10')]);router[_0x2340('0x11')]('/',auth[_0x2340('0x8')](),controller['create']);router[_0x2340('0x12')](_0x2340('0xa'),auth[_0x2340('0x8')](),controller['update']);router['delete']('/:id',auth[_0x2340('0x8')](),controller[_0x2340('0x13')]);module[_0x2340('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f00d0e6..1888842 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 _0x4356=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','UNSIGNED','sequelize','moment'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0x4356,0xe2));var _0x6435=function(_0x4bcc2a,_0x2528a7){_0x4bcc2a=_0x4bcc2a-0x0;var _0x20eaab=_0x4356[_0x4bcc2a];return _0x20eaab;};'use strict';var Sequelize=require(_0x6435('0x0'));var moment=require(_0x6435('0x1'));module[_0x6435('0x2')]={'name':{'type':Sequelize[_0x6435('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x6435('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x6435('0x4')](_0x6435('0x5'),_0x6435('0x6'),_0x6435('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x6435('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6435('0x8')]},'endDate':{'type':Sequelize[_0x6435('0x8')]},'status':{'type':Sequelize[_0x6435('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x6435('0x9'),_0x6435('0xa')),'allowNull':![],'defaultValue':_0x6435('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6435('0xb')]},'reportType':{'type':Sequelize[_0x6435('0x3')]}}; \ No newline at end of file +var _0xf126=['exports','STRING','ENUM','csv','pdf','DATE','scheduled','manual','UNSIGNED','sequelize','moment'];(function(_0x587e10,_0x29b3a9){var _0x203454=function(_0x18dfc6){while(--_0x18dfc6){_0x587e10['push'](_0x587e10['shift']());}};_0x203454(++_0x29b3a9);}(_0xf126,0x11c));var _0x6f12=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xf126[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0x6f12('0x0'));var moment=require(_0x6f12('0x1'));module[_0x6f12('0x2')]={'name':{'type':Sequelize[_0x6f12('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x6f12('0x4')](_0x6f12('0x5'),_0x6f12('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0x6f12('0x5')},'savename':{'type':Sequelize[_0x6f12('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6f12('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x6f12('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x6f12('0x4')]('manual',_0x6f12('0x8')),'allowNull':![],'defaultValue':_0x6f12('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6f12('0xa')]},'reportType':{'type':Sequelize[_0x6f12('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index bc23e83..1fa6022 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 _0xb4e4=['model','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','rows','catch','params','length','includeAll','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','keys','filters'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0xb4e4,0x89));var _0x4b4e=function(_0x36afc3,_0x4956c9){_0x36afc3=_0x36afc3-0x0;var _0x405cb9=_0xb4e4[_0x36afc3];return _0x405cb9;};'use strict';var emlformat=require(_0x4b4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b4e('0x1'));var rp=require(_0x4b4e('0x2'));var moment=require('moment');var BPromise=require(_0x4b4e('0x3'));var Mustache=require(_0x4b4e('0x4'));var util=require(_0x4b4e('0x5'));var path=require(_0x4b4e('0x6'));var sox=require('sox');var csv=require(_0x4b4e('0x7'));var ejs=require(_0x4b4e('0x8'));var fs=require('fs');var fs_extra=require(_0x4b4e('0x9'));var _=require(_0x4b4e('0xa'));var squel=require(_0x4b4e('0xb'));var crypto=require(_0x4b4e('0xc'));var jsforce=require(_0x4b4e('0xd'));var deskjs=require(_0x4b4e('0xe'));var toCsv=require(_0x4b4e('0x7'));var querystring=require(_0x4b4e('0xf'));var Papa=require(_0x4b4e('0x10'));var Redis=require('ioredis');var authService=require(_0x4b4e('0x11'));var qs=require(_0x4b4e('0x12'));var as=require(_0x4b4e('0x13'));var hardwareService=require(_0x4b4e('0x14'));var logger=require(_0x4b4e('0x15'))(_0x4b4e('0x16'));var utils=require(_0x4b4e('0x17'));var config=require(_0x4b4e('0x18'));var licenseUtil=require(_0x4b4e('0x19'));var db=require(_0x4b4e('0x1a'))['db'];function respondWithStatusCode(_0x26d8fa,_0x2c3dd6){_0x2c3dd6=_0x2c3dd6||0xcc;return function(_0x53c83d){if(_0x53c83d){return _0x26d8fa['sendStatus'](_0x2c3dd6);}return _0x26d8fa[_0x4b4e('0x1b')](_0x2c3dd6)[_0x4b4e('0x1c')]();};}function respondWithResult(_0x2ec170,_0x1ff8d8){_0x1ff8d8=_0x1ff8d8||0xc8;return function(_0x3bf9db){if(_0x3bf9db){return _0x2ec170['status'](_0x1ff8d8)[_0x4b4e('0x1d')](_0x3bf9db);}};}function respondWithFilteredResult(_0x186083,_0x5716ae){return function(_0x553845){if(_0x553845){var _0x13ddb3=typeof _0x5716ae[_0x4b4e('0x1e')]===_0x4b4e('0x1f')&&typeof _0x5716ae[_0x4b4e('0x20')]===_0x4b4e('0x1f');var _0x4b6c21=_0x553845[_0x4b4e('0x21')];var _0xe4f17a=_0x13ddb3?0x0:_0x5716ae[_0x4b4e('0x1e')];var _0x510d7a=_0x13ddb3?_0x553845[_0x4b4e('0x21')]:_0x5716ae[_0x4b4e('0x1e')]+_0x5716ae[_0x4b4e('0x20')];var _0x4bb061;if(_0x510d7a>=_0x4b6c21){_0x510d7a=_0x4b6c21;_0x4bb061=0xc8;}else{_0x4bb061=0xce;}_0x186083['status'](_0x4bb061);return _0x186083[_0x4b4e('0x22')](_0x4b4e('0x23'),_0xe4f17a+'-'+_0x510d7a+'/'+_0x4b6c21)[_0x4b4e('0x1d')](_0x553845);}return null;};}function patchUpdates(_0x236a09){return function(_0x329d4b){try{jsonpatch['apply'](_0x329d4b,_0x236a09,!![]);}catch(_0x8fea27){return BPromise[_0x4b4e('0x24')](_0x8fea27);}return _0x329d4b[_0x4b4e('0x25')]();};}function saveUpdates(_0x577870,_0x286fb0){return function(_0x5711b5){if(_0x5711b5){return _0x5711b5[_0x4b4e('0x26')](_0x577870)[_0x4b4e('0x27')](function(_0x3c4fff){return _0x3c4fff;});}return null;};}function removeEntity(_0x9d5fb2,_0x1a0ae3){return function(_0x4cd308){if(_0x4cd308){return _0x4cd308[_0x4b4e('0x28')]()[_0x4b4e('0x27')](function(){var _0xa4063b=_0x4cd308[_0x4b4e('0x29')]({'plain':!![]});var _0x12bf37='ExtractedReports';return db['UserProfileResource'][_0x4b4e('0x28')]({'where':{'type':_0x12bf37,'resourceId':_0xa4063b['id']}})[_0x4b4e('0x27')](function(){return _0x4cd308;});})['then'](function(){_0x9d5fb2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26acae,_0x2f0a93){return function(_0x25ecd1){if(!_0x25ecd1){_0x26acae[_0x4b4e('0x2a')](0x194);}return _0x25ecd1;};}function handleError(_0x3a3ecc,_0x47c22d){_0x47c22d=_0x47c22d||0x1f4;return function(_0x5846ba){logger[_0x4b4e('0x2b')](_0x5846ba[_0x4b4e('0x2c')]);if(_0x5846ba[_0x4b4e('0x2d')]){delete _0x5846ba['name'];}_0x3a3ecc[_0x4b4e('0x1b')](_0x47c22d)[_0x4b4e('0x2e')](_0x5846ba);};}exports[_0x4b4e('0x2f')]=function(_0x3fdc23,_0x36efef){var _0x1751bb={},_0x12ad6a={},_0xabeb5c={'count':0x0,'rows':[]};var _0x4d635b=_['map'](db[_0x4b4e('0x30')][_0x4b4e('0x31')],function(_0x2f6284){return{'name':_0x2f6284[_0x4b4e('0x32')],'type':_0x2f6284[_0x4b4e('0x33')][_0x4b4e('0x34')]};});_0x12ad6a['model']=_[_0x4b4e('0x35')](_0x4d635b,_0x4b4e('0x2d'));_0x12ad6a[_0x4b4e('0x36')]=_[_0x4b4e('0x37')](_0x3fdc23[_0x4b4e('0x36')]);_0x12ad6a[_0x4b4e('0x38')]=_['intersection'](_0x12ad6a['model'],_0x12ad6a[_0x4b4e('0x36')]);_0x1751bb['attributes']=_['intersection'](_0x12ad6a[_0x4b4e('0x39')],qs[_0x4b4e('0x3a')](_0x3fdc23[_0x4b4e('0x36')][_0x4b4e('0x3a')]));_0x1751bb[_0x4b4e('0x3b')]=_0x1751bb[_0x4b4e('0x3b')]['length']?_0x1751bb['attributes']:_0x12ad6a['model'];if(!_0x3fdc23[_0x4b4e('0x36')]['hasOwnProperty'](_0x4b4e('0x3c'))){_0x1751bb['limit']=qs[_0x4b4e('0x20')](_0x3fdc23[_0x4b4e('0x36')][_0x4b4e('0x20')]);_0x1751bb[_0x4b4e('0x1e')]=qs[_0x4b4e('0x1e')](_0x3fdc23[_0x4b4e('0x36')][_0x4b4e('0x1e')]);}_0x1751bb[_0x4b4e('0x3d')]=qs[_0x4b4e('0x3e')](_0x3fdc23['query'][_0x4b4e('0x3e')]);_0x1751bb[_0x4b4e('0x3f')]=qs[_0x4b4e('0x38')](_[_0x4b4e('0x40')](_0x3fdc23[_0x4b4e('0x36')],_0x12ad6a[_0x4b4e('0x38')]),_0x4d635b);if(_0x3fdc23[_0x4b4e('0x36')][_0x4b4e('0x41')]){_0x1751bb[_0x4b4e('0x3f')]=_['merge'](_0x1751bb[_0x4b4e('0x3f')],{'$or':_[_0x4b4e('0x35')](_0x4d635b,function(_0x14b06b){if(_0x14b06b['type']!==_0x4b4e('0x42')){var _0x2b12ff={};_0x2b12ff[_0x14b06b[_0x4b4e('0x2d')]]={'$like':'%'+_0x3fdc23[_0x4b4e('0x36')]['filter']+'%'};return _0x2b12ff;}})});}_0x1751bb=_[_0x4b4e('0x43')]({},_0x1751bb,_0x3fdc23['options']);var _0x5c82ef={'where':_0x1751bb[_0x4b4e('0x3f')]};return db['AnalyticExtractedReport'][_0x4b4e('0x21')](_0x5c82ef)[_0x4b4e('0x27')](function(_0x12fe18){_0xabeb5c['count']=_0x12fe18;if(_0x3fdc23[_0x4b4e('0x36')]['includeAll']){_0x1751bb['include']=[{'all':!![]}];}return db[_0x4b4e('0x30')]['findAll'](_0x1751bb);})['then'](function(_0x35a304){_0xabeb5c[_0x4b4e('0x44')]=_0x35a304;return _0xabeb5c;})[_0x4b4e('0x27')](respondWithFilteredResult(_0x36efef,_0x1751bb))[_0x4b4e('0x45')](handleError(_0x36efef,null));};exports['show']=function(_0x147c79,_0x89c59a){var _0x1c97d5={'raw':!![],'where':{'id':_0x147c79[_0x4b4e('0x46')]['id']}},_0x323798={};_0x323798['model']=_[_0x4b4e('0x37')](db[_0x4b4e('0x30')]['rawAttributes']);_0x323798[_0x4b4e('0x36')]=_['keys'](_0x147c79[_0x4b4e('0x36')]);_0x323798[_0x4b4e('0x38')]=_['intersection'](_0x323798[_0x4b4e('0x39')],_0x323798[_0x4b4e('0x36')]);_0x1c97d5[_0x4b4e('0x3b')]=_['intersection'](_0x323798[_0x4b4e('0x39')],qs[_0x4b4e('0x3a')](_0x147c79[_0x4b4e('0x36')][_0x4b4e('0x3a')]));_0x1c97d5[_0x4b4e('0x3b')]=_0x1c97d5[_0x4b4e('0x3b')][_0x4b4e('0x47')]?_0x1c97d5['attributes']:_0x323798[_0x4b4e('0x39')];if(_0x147c79[_0x4b4e('0x36')][_0x4b4e('0x48')]){_0x1c97d5[_0x4b4e('0x49')]=[{'all':!![]}];}_0x1c97d5=_['merge']({},_0x1c97d5,_0x147c79[_0x4b4e('0x4a')]);return db[_0x4b4e('0x30')]['find'](_0x1c97d5)['then'](handleEntityNotFound(_0x89c59a,null))[_0x4b4e('0x27')](respondWithResult(_0x89c59a,null))[_0x4b4e('0x45')](handleError(_0x89c59a,null));};exports[_0x4b4e('0x4b')]=function(_0x12338,_0x1bd553){return db[_0x4b4e('0x30')][_0x4b4e('0x4b')](_0x12338['body'],{})[_0x4b4e('0x27')](function(_0x5a7104){var _0x261e00=_0x12338[_0x4b4e('0x4c')]['get']({'plain':!![]});if(!_0x261e00)throw new Error(_0x4b4e('0x4d'));if(_0x261e00[_0x4b4e('0x4e')]===_0x4b4e('0x4c')){var _0x53e5ea=_0x5a7104[_0x4b4e('0x29')]({'plain':!![]});var _0xb48917='ExtractedReports';return db[_0x4b4e('0x4f')][_0x4b4e('0x50')]({'where':{'name':_0xb48917,'userProfileId':_0x261e00['userProfileId']},'raw':!![]})['then'](function(_0x352cb4){if(_0x352cb4&&_0x352cb4[_0x4b4e('0x51')]===0x0){return db[_0x4b4e('0x52')][_0x4b4e('0x4b')]({'name':_0x53e5ea['name'],'resourceId':_0x53e5ea['id'],'type':_0x352cb4[_0x4b4e('0x2d')],'sectionId':_0x352cb4['id']},{})['then'](function(){return _0x5a7104;});}else{return _0x5a7104;}})[_0x4b4e('0x45')](function(_0x52b178){logger[_0x4b4e('0x2b')](_0x4b4e('0x53'),_0x52b178);throw _0x52b178;});}return _0x5a7104;})['then'](respondWithResult(_0x1bd553,0xc9))['catch'](handleError(_0x1bd553,null));};exports[_0x4b4e('0x26')]=function(_0x6f45f7,_0x4dd592){if(_0x6f45f7['body']['id']){delete _0x6f45f7['body']['id'];}return db[_0x4b4e('0x30')][_0x4b4e('0x50')]({'where':{'id':_0x6f45f7[_0x4b4e('0x46')]['id']}})[_0x4b4e('0x27')](handleEntityNotFound(_0x4dd592,null))[_0x4b4e('0x27')](saveUpdates(_0x6f45f7[_0x4b4e('0x54')],null))['then'](respondWithResult(_0x4dd592,null))[_0x4b4e('0x45')](handleError(_0x4dd592,null));};exports[_0x4b4e('0x28')]=function(_0x483b29,_0x98eb3d){return db['AnalyticExtractedReport'][_0x4b4e('0x50')]({'where':{'id':_0x483b29['params']['id']}})[_0x4b4e('0x27')](handleEntityNotFound(_0x98eb3d,null))['then'](removeEntity(_0x98eb3d,null))[_0x4b4e('0x45')](handleError(_0x98eb3d,null));};exports[_0x4b4e('0x55')]=function(_0x457477,_0x20372e,_0x24536e){return db[_0x4b4e('0x30')][_0x4b4e('0x50')]({'where':{'id':_0x457477[_0x4b4e('0x46')]['id']},'attributes':['name',_0x4b4e('0x56'),_0x4b4e('0x57'),_0x4b4e('0x58')],'raw':!![]})[_0x4b4e('0x27')](handleEntityNotFound(_0x20372e,null))['then'](function(_0x4a5c2d){if(_0x4a5c2d){if(!fs['existsSync'](path[_0x4b4e('0x59')](config[_0x4b4e('0x5a')],_0x4b4e('0x5b'),_0x4a5c2d['savename']))){throw new db[(_0x4b4e('0x5c'))][(_0x4b4e('0x5d'))](_0x4b4e('0x5e'));}if(_0x457477[_0x4b4e('0x36')][_0x4b4e('0x5f')]){return _0x20372e[_0x4b4e('0x2a')](0xc8);}return _0x20372e['download'](path[_0x4b4e('0x59')](config[_0x4b4e('0x5a')],'server/files/reports',_0x4a5c2d['savename']),util['format']('%s.%s',_0x4a5c2d['basename']||_0x4a5c2d[_0x4b4e('0x2d')],_0x4a5c2d['output'][_0x4b4e('0x60')]()));}})[_0x4b4e('0x45')](handleError(_0x20372e,null));}; \ No newline at end of file +var _0x6cad=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','apply','save','update','then','destroy','get','stack','name','index','map','AnalyticExtractedReport','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','keys','rawAttributes','length'];(function(_0x497141,_0x365823){var _0x281aa5=function(_0x42a167){while(--_0x42a167){_0x497141['push'](_0x497141['shift']());}};_0x281aa5(++_0x365823);}(_0x6cad,0x78));var _0xd6ca=function(_0x592110,_0x4f56a1){_0x592110=_0x592110-0x0;var _0x1a01c5=_0x6cad[_0x592110];return _0x1a01c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6ca('0x0'));var zipdir=require(_0xd6ca('0x1'));var jsonpatch=require(_0xd6ca('0x2'));var rp=require(_0xd6ca('0x3'));var moment=require(_0xd6ca('0x4'));var BPromise=require(_0xd6ca('0x5'));var Mustache=require(_0xd6ca('0x6'));var util=require(_0xd6ca('0x7'));var path=require(_0xd6ca('0x8'));var sox=require(_0xd6ca('0x9'));var csv=require('to-csv');var ejs=require(_0xd6ca('0xa'));var fs=require('fs');var fs_extra=require(_0xd6ca('0xb'));var _=require(_0xd6ca('0xc'));var squel=require(_0xd6ca('0xd'));var crypto=require(_0xd6ca('0xe'));var jsforce=require(_0xd6ca('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6ca('0x10'));var Redis=require(_0xd6ca('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd6ca('0x12'));var hardwareService=require(_0xd6ca('0x13'));var logger=require('../../config/logger')(_0xd6ca('0x14'));var utils=require(_0xd6ca('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd6ca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x922eb6,_0x2fa82b){_0x2fa82b=_0x2fa82b||0xcc;return function(_0x365c98){if(_0x365c98){return _0x922eb6[_0xd6ca('0x17')](_0x2fa82b);}return _0x922eb6['status'](_0x2fa82b)['end']();};}function respondWithResult(_0x4b58f1,_0x43bb00){_0x43bb00=_0x43bb00||0xc8;return function(_0x296ba7){if(_0x296ba7){return _0x4b58f1[_0xd6ca('0x18')](_0x43bb00)['json'](_0x296ba7);}};}function respondWithFilteredResult(_0x553d01,_0x46c69d){return function(_0xf5b04b){if(_0xf5b04b){var _0x8aff05=typeof _0x46c69d['offset']==='undefined'&&typeof _0x46c69d[_0xd6ca('0x19')]===_0xd6ca('0x1a');var _0x32d86c=_0xf5b04b['count'];var _0x51d48d=_0x8aff05?0x0:_0x46c69d[_0xd6ca('0x1b')];var _0x1ddd61=_0x8aff05?_0xf5b04b[_0xd6ca('0x1c')]:_0x46c69d[_0xd6ca('0x1b')]+_0x46c69d[_0xd6ca('0x19')];var _0x49f457;if(_0x1ddd61>=_0x32d86c){_0x1ddd61=_0x32d86c;_0x49f457=0xc8;}else{_0x49f457=0xce;}_0x553d01[_0xd6ca('0x18')](_0x49f457);return _0x553d01[_0xd6ca('0x1d')](_0xd6ca('0x1e'),_0x51d48d+'-'+_0x1ddd61+'/'+_0x32d86c)[_0xd6ca('0x1f')](_0xf5b04b);}return null;};}function patchUpdates(_0xbefee0){return function(_0x281504){try{jsonpatch[_0xd6ca('0x20')](_0x281504,_0xbefee0,!![]);}catch(_0x221378){return BPromise['reject'](_0x221378);}return _0x281504[_0xd6ca('0x21')]();};}function saveUpdates(_0x469bb0,_0xcc120f){return function(_0x2122f8){if(_0x2122f8){return _0x2122f8[_0xd6ca('0x22')](_0x469bb0)[_0xd6ca('0x23')](function(_0x4e7fff){return _0x4e7fff;});}return null;};}function removeEntity(_0x317a36,_0x57ee58){return function(_0x59df78){if(_0x59df78){return _0x59df78[_0xd6ca('0x24')]()[_0xd6ca('0x23')](function(){var _0x5545ca=_0x59df78[_0xd6ca('0x25')]({'plain':!![]});var _0x2e6868='ExtractedReports';return db['UserProfileResource'][_0xd6ca('0x24')]({'where':{'type':_0x2e6868,'resourceId':_0x5545ca['id']}})[_0xd6ca('0x23')](function(){return _0x59df78;});})[_0xd6ca('0x23')](function(){_0x317a36[_0xd6ca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ffeb,_0x4aea19){return function(_0x409778){if(!_0x409778){_0x28ffeb[_0xd6ca('0x17')](0x194);}return _0x409778;};}function handleError(_0x1598af,_0x438043){_0x438043=_0x438043||0x1f4;return function(_0xf466e){logger['error'](_0xf466e[_0xd6ca('0x26')]);if(_0xf466e['name']){delete _0xf466e[_0xd6ca('0x27')];}_0x1598af['status'](_0x438043)['send'](_0xf466e);};}exports[_0xd6ca('0x28')]=function(_0x38c736,_0x3aff06){var _0x408b92={},_0x2b9405={},_0xd61588={'count':0x0,'rows':[]};var _0x16c1da=_[_0xd6ca('0x29')](db[_0xd6ca('0x2a')]['rawAttributes'],function(_0x59cb03){return{'name':_0x59cb03[_0xd6ca('0x2b')],'type':_0x59cb03[_0xd6ca('0x2c')]['key']};});_0x2b9405[_0xd6ca('0x2d')]=_['map'](_0x16c1da,_0xd6ca('0x27'));_0x2b9405[_0xd6ca('0x2e')]=_['keys'](_0x38c736[_0xd6ca('0x2e')]);_0x2b9405[_0xd6ca('0x2f')]=_[_0xd6ca('0x30')](_0x2b9405[_0xd6ca('0x2d')],_0x2b9405['query']);_0x408b92['attributes']=_[_0xd6ca('0x30')](_0x2b9405['model'],qs[_0xd6ca('0x31')](_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x31')]));_0x408b92[_0xd6ca('0x32')]=_0x408b92['attributes']['length']?_0x408b92[_0xd6ca('0x32')]:_0x2b9405[_0xd6ca('0x2d')];if(!_0x38c736['query'][_0xd6ca('0x33')]('nolimit')){_0x408b92[_0xd6ca('0x19')]=qs[_0xd6ca('0x19')](_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x19')]);_0x408b92[_0xd6ca('0x1b')]=qs[_0xd6ca('0x1b')](_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x1b')]);}_0x408b92[_0xd6ca('0x34')]=qs[_0xd6ca('0x35')](_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x35')]);_0x408b92[_0xd6ca('0x36')]=qs['filters'](_[_0xd6ca('0x37')](_0x38c736[_0xd6ca('0x2e')],_0x2b9405['filters']),_0x16c1da);if(_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x38')]){_0x408b92[_0xd6ca('0x36')]=_['merge'](_0x408b92[_0xd6ca('0x36')],{'$or':_['map'](_0x16c1da,function(_0x1962b2){if(_0x1962b2[_0xd6ca('0x2c')]!=='VIRTUAL'){var _0x574521={};_0x574521[_0x1962b2['name']]={'$like':'%'+_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x38')]+'%'};return _0x574521;}})});}_0x408b92=_[_0xd6ca('0x39')]({},_0x408b92,_0x38c736[_0xd6ca('0x3a')]);var _0x4c5cc4={'where':_0x408b92[_0xd6ca('0x36')]};return db[_0xd6ca('0x2a')][_0xd6ca('0x1c')](_0x4c5cc4)[_0xd6ca('0x23')](function(_0x55d62a){_0xd61588[_0xd6ca('0x1c')]=_0x55d62a;if(_0x38c736[_0xd6ca('0x2e')][_0xd6ca('0x3b')]){_0x408b92[_0xd6ca('0x3c')]=[{'all':!![]}];}return db[_0xd6ca('0x2a')][_0xd6ca('0x3d')](_0x408b92);})[_0xd6ca('0x23')](function(_0x1ee404){_0xd61588['rows']=_0x1ee404;return _0xd61588;})[_0xd6ca('0x23')](respondWithFilteredResult(_0x3aff06,_0x408b92))[_0xd6ca('0x3e')](handleError(_0x3aff06,null));};exports['show']=function(_0x4978bf,_0x377916){var _0x1387dd={'raw':!![],'where':{'id':_0x4978bf['params']['id']}},_0x1225a6={};_0x1225a6[_0xd6ca('0x2d')]=_[_0xd6ca('0x3f')](db[_0xd6ca('0x2a')][_0xd6ca('0x40')]);_0x1225a6['query']=_[_0xd6ca('0x3f')](_0x4978bf[_0xd6ca('0x2e')]);_0x1225a6[_0xd6ca('0x2f')]=_[_0xd6ca('0x30')](_0x1225a6['model'],_0x1225a6['query']);_0x1387dd[_0xd6ca('0x32')]=_[_0xd6ca('0x30')](_0x1225a6[_0xd6ca('0x2d')],qs[_0xd6ca('0x31')](_0x4978bf['query'][_0xd6ca('0x31')]));_0x1387dd[_0xd6ca('0x32')]=_0x1387dd[_0xd6ca('0x32')][_0xd6ca('0x41')]?_0x1387dd[_0xd6ca('0x32')]:_0x1225a6[_0xd6ca('0x2d')];if(_0x4978bf[_0xd6ca('0x2e')][_0xd6ca('0x3b')]){_0x1387dd[_0xd6ca('0x3c')]=[{'all':!![]}];}_0x1387dd=_[_0xd6ca('0x39')]({},_0x1387dd,_0x4978bf[_0xd6ca('0x3a')]);return db['AnalyticExtractedReport']['find'](_0x1387dd)[_0xd6ca('0x23')](handleEntityNotFound(_0x377916,null))[_0xd6ca('0x23')](respondWithResult(_0x377916,null))[_0xd6ca('0x3e')](handleError(_0x377916,null));};exports[_0xd6ca('0x42')]=function(_0x1f7062,_0x35356c){return db['AnalyticExtractedReport'][_0xd6ca('0x42')](_0x1f7062['body'],{})['then'](function(_0x81c2c8){var _0x32517e=_0x1f7062['user'][_0xd6ca('0x25')]({'plain':!![]});if(!_0x32517e)throw new Error(_0xd6ca('0x43'));if(_0x32517e['role']===_0xd6ca('0x44')){var _0x544970=_0x81c2c8[_0xd6ca('0x25')]({'plain':!![]});var _0x55a58e=_0xd6ca('0x45');return db[_0xd6ca('0x46')][_0xd6ca('0x47')]({'where':{'name':_0x55a58e,'userProfileId':_0x32517e[_0xd6ca('0x48')]},'raw':!![]})[_0xd6ca('0x23')](function(_0x1f7cf9){if(_0x1f7cf9&&_0x1f7cf9[_0xd6ca('0x49')]===0x0){return db[_0xd6ca('0x4a')][_0xd6ca('0x42')]({'name':_0x544970[_0xd6ca('0x27')],'resourceId':_0x544970['id'],'type':_0x1f7cf9[_0xd6ca('0x27')],'sectionId':_0x1f7cf9['id']},{})[_0xd6ca('0x23')](function(){return _0x81c2c8;});}else{return _0x81c2c8;}})['catch'](function(_0x192a63){logger[_0xd6ca('0x4b')](_0xd6ca('0x4c'),_0x192a63);throw _0x192a63;});}return _0x81c2c8;})[_0xd6ca('0x23')](respondWithResult(_0x35356c,0xc9))[_0xd6ca('0x3e')](handleError(_0x35356c,null));};exports[_0xd6ca('0x22')]=function(_0x4ffcce,_0x43ccdd){if(_0x4ffcce['body']['id']){delete _0x4ffcce['body']['id'];}return db[_0xd6ca('0x2a')]['find']({'where':{'id':_0x4ffcce[_0xd6ca('0x4d')]['id']}})[_0xd6ca('0x23')](handleEntityNotFound(_0x43ccdd,null))[_0xd6ca('0x23')](saveUpdates(_0x4ffcce[_0xd6ca('0x4e')],null))['then'](respondWithResult(_0x43ccdd,null))[_0xd6ca('0x3e')](handleError(_0x43ccdd,null));};exports[_0xd6ca('0x24')]=function(_0x28271d,_0x15005e){return db[_0xd6ca('0x2a')][_0xd6ca('0x47')]({'where':{'id':_0x28271d[_0xd6ca('0x4d')]['id']}})[_0xd6ca('0x23')](handleEntityNotFound(_0x15005e,null))[_0xd6ca('0x23')](removeEntity(_0x15005e,null))['catch'](handleError(_0x15005e,null));};exports[_0xd6ca('0x4f')]=function(_0x1d21a4,_0x1b77bc,_0x3501bb){return db[_0xd6ca('0x2a')][_0xd6ca('0x47')]({'where':{'id':_0x1d21a4[_0xd6ca('0x4d')]['id']},'attributes':[_0xd6ca('0x27'),_0xd6ca('0x50'),_0xd6ca('0x51'),_0xd6ca('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x1b77bc,null))[_0xd6ca('0x23')](function(_0x15bf18){if(_0x15bf18){if(!fs[_0xd6ca('0x53')](path[_0xd6ca('0x54')](config[_0xd6ca('0x55')],_0xd6ca('0x56'),_0x15bf18['savename']))){throw new db[(_0xd6ca('0x57'))][(_0xd6ca('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1d21a4[_0xd6ca('0x2e')][_0xd6ca('0x59')]){return _0x1b77bc[_0xd6ca('0x17')](0xc8);}return _0x1b77bc[_0xd6ca('0x4f')](path[_0xd6ca('0x54')](config[_0xd6ca('0x55')],'server/files/reports',_0x15bf18[_0xd6ca('0x51')]),util[_0xd6ca('0x5a')](_0xd6ca('0x5b'),_0x15bf18['basename']||_0x15bf18[_0xd6ca('0x27')],_0x15bf18[_0xd6ca('0x52')][_0xd6ca('0x5c')]()));}})['catch'](handleError(_0x1b77bc,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d86257e..abf9b71 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 _0x4702=['moment','bluebird','request-promise','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x2a1d58,_0x130e30){var _0x231fdf=function(_0x33b191){while(--_0x33b191){_0x2a1d58['push'](_0x2a1d58['shift']());}};_0x231fdf(++_0x130e30);}(_0x4702,0xd9));var _0x2470=function(_0x3b178d,_0x225115){_0x3b178d=_0x3b178d-0x0;var _0x1d4a81=_0x4702[_0x3b178d];return _0x1d4a81;};'use strict';var _=require(_0x2470('0x0'));var util=require(_0x2470('0x1'));var logger=require(_0x2470('0x2'))(_0x2470('0x3'));var moment=require(_0x2470('0x4'));var BPromise=require(_0x2470('0x5'));var rp=require(_0x2470('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2470('0x7'));var config=require('../../config/environment');var attributes=require(_0x2470('0x8'));module[_0x2470('0x9')]=function(_0x367651,_0x5c405f){return _0x367651[_0x2470('0xa')](_0x2470('0xb'),attributes,{'tableName':_0x2470('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e9b=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash','../../config/logger','bluebird','request-promise'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x5e9b,0x1aa));var _0xb5e9=function(_0x3a2b29,_0x5481ca){_0x3a2b29=_0x3a2b29-0x0;var _0x3832a6=_0x5e9b[_0x3a2b29];return _0x3832a6;};'use strict';var _=require(_0xb5e9('0x0'));var util=require('util');var logger=require(_0xb5e9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb5e9('0x2'));var rp=require(_0xb5e9('0x3'));var fs=require('fs');var path=require(_0xb5e9('0x4'));var rimraf=require(_0xb5e9('0x5'));var config=require(_0xb5e9('0x6'));var attributes=require(_0xb5e9('0x7'));module[_0xb5e9('0x8')]=function(_0x2141f2,_0x1e9d57){return _0x2141f2['define']('AnalyticExtractedReport',attributes,{'tableName':_0xb5e9('0x9'),'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 11a8329..256fcdd 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 _0xf729=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis'];(function(_0x47794f,_0x3a0baf){var _0x423604=function(_0x379cd6){while(--_0x379cd6){_0x47794f['push'](_0x47794f['shift']());}};_0x423604(++_0x3a0baf);}(_0xf729,0x1b4));var _0x9f72=function(_0x4765c6,_0x47036e){_0x4765c6=_0x4765c6-0x0;var _0x28f9bd=_0xf729[_0x4765c6];return _0x28f9bd;};'use strict';var _=require(_0x9f72('0x0'));var util=require(_0x9f72('0x1'));var moment=require(_0x9f72('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f72('0x4'));var logger=require(_0x9f72('0x5'))(_0x9f72('0x6'));var config=require(_0x9f72('0x7'));var jayson=require(_0x9f72('0x8'));var client=jayson[_0x9f72('0x9')][_0x9f72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x287d43,_0x4c545a,_0x4a8d2d){return new BPromise(function(_0x236c1c,_0x45453e){return client['request'](_0x287d43,_0x4a8d2d)[_0x9f72('0xb')](function(_0x9771c3){logger[_0x9f72('0xc')](_0x9f72('0xd'),_0x4c545a,_0x9f72('0xe'));logger[_0x9f72('0xf')](_0x9f72('0x10'),_0x4c545a,_0x9f72('0xe'),JSON[_0x9f72('0x11')](_0x9771c3));if(_0x9771c3[_0x9f72('0x12')]){if(_0x9771c3[_0x9f72('0x12')][_0x9f72('0x13')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4c545a,_0x9771c3[_0x9f72('0x12')]['message']);return _0x45453e(_0x9771c3[_0x9f72('0x12')][_0x9f72('0x14')]);}logger[_0x9f72('0x12')](_0x9f72('0xd'),_0x4c545a,_0x9771c3[_0x9f72('0x12')][_0x9f72('0x14')]);return _0x236c1c(_0x9771c3[_0x9f72('0x12')][_0x9f72('0x14')]);}else{logger[_0x9f72('0xc')](_0x9f72('0xd'),_0x4c545a,_0x9f72('0xe'));_0x236c1c(_0x9771c3['result']['message']);}})[_0x9f72('0x15')](function(_0x5c73ed){logger[_0x9f72('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4c545a,_0x5c73ed);_0x45453e(_0x5c73ed);});});} \ No newline at end of file +var _0x5b38=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x31e12a,_0x57b4bc){var _0x420db1=function(_0x2b8f3e){while(--_0x2b8f3e){_0x31e12a['push'](_0x31e12a['shift']());}};_0x420db1(++_0x57b4bc);}(_0x5b38,0x81));var _0x85b3=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x5b38[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0x85b3('0x0'));var util=require(_0x85b3('0x1'));var moment=require(_0x85b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x85b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x85b3('0x4'));var logger=require(_0x85b3('0x5'))(_0x85b3('0x6'));var config=require(_0x85b3('0x7'));var jayson=require(_0x85b3('0x8'));var client=jayson[_0x85b3('0x9')][_0x85b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40d41b,_0x18020a,_0x3e3607){return new BPromise(function(_0x1999d4,_0xa8087a){return client[_0x85b3('0xb')](_0x40d41b,_0x3e3607)[_0x85b3('0xc')](function(_0x4ae3fd){logger[_0x85b3('0xd')](_0x85b3('0xe'),_0x18020a,_0x85b3('0xf'));logger[_0x85b3('0x10')](_0x85b3('0x11'),_0x18020a,_0x85b3('0xf'),JSON[_0x85b3('0x12')](_0x4ae3fd));if(_0x4ae3fd['error']){if(_0x4ae3fd[_0x85b3('0x13')][_0x85b3('0x14')]===0x1f4){logger[_0x85b3('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x18020a,_0x4ae3fd[_0x85b3('0x13')][_0x85b3('0x15')]);return _0xa8087a(_0x4ae3fd['error'][_0x85b3('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x18020a,_0x4ae3fd[_0x85b3('0x13')][_0x85b3('0x15')]);return _0x1999d4(_0x4ae3fd[_0x85b3('0x13')][_0x85b3('0x15')]);}else{logger['info'](_0x85b3('0xe'),_0x18020a,'request\x20sent');_0x1999d4(_0x4ae3fd[_0x85b3('0x16')][_0x85b3('0x15')]);}})[_0x85b3('0x17')](function(_0x43bd54){logger[_0x85b3('0x13')](_0x85b3('0xe'),_0x18020a,_0x43bd54);_0xa8087a(_0x43bd54);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 60ea4b6..e90e96d 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 _0xd633=['./analyticExtractedReport.controller','get','isAuthenticated','index','download','create','/:id','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a8130,_0x2b7f50){var _0x55931f=function(_0x5340bb){while(--_0x5340bb){_0x5a8130['push'](_0x5a8130['shift']());}};_0x55931f(++_0x2b7f50);}(_0xd633,0x15b));var _0x3d63=function(_0x371b87,_0x177b5f){_0x371b87=_0x371b87-0x0;var _0x2aca85=_0xd633[_0x371b87];return _0x2aca85;};'use strict';var multer=require(_0x3d63('0x0'));var util=require(_0x3d63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d63('0x2'));var auth=require(_0x3d63('0x3'));var interaction=require(_0x3d63('0x4'));var config=require('../../config/environment');var controller=require(_0x3d63('0x5'));router[_0x3d63('0x6')]('/',auth[_0x3d63('0x7')](),controller[_0x3d63('0x8')]);router['get']('/:id',auth[_0x3d63('0x7')](),controller['show']);router['get']('/:id/download',auth[_0x3d63('0x7')](),controller[_0x3d63('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d63('0xa')]);router['put'](_0x3d63('0xb'),auth[_0x3d63('0x7')](),controller[_0x3d63('0xc')]);router[_0x3d63('0xd')]('/:id',auth[_0x3d63('0x7')](),controller[_0x3d63('0xe')]);module[_0x3d63('0xf')]=router; \ No newline at end of file +var _0x9a23=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5a88bf,_0x51775e){var _0x3820de=function(_0x4d4463){while(--_0x4d4463){_0x5a88bf['push'](_0x5a88bf['shift']());}};_0x3820de(++_0x51775e);}(_0x9a23,0x1df));var _0x39a2=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x9a23[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x39a2('0x0'));var util=require(_0x39a2('0x1'));var path=require(_0x39a2('0x2'));var timeout=require(_0x39a2('0x3'));var express=require(_0x39a2('0x4'));var router=express[_0x39a2('0x5')]();var fs_extra=require(_0x39a2('0x6'));var auth=require(_0x39a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x39a2('0x8'));var controller=require(_0x39a2('0x9'));router[_0x39a2('0xa')]('/',auth['isAuthenticated'](),controller[_0x39a2('0xb')]);router[_0x39a2('0xa')]('/:id',auth[_0x39a2('0xc')](),controller[_0x39a2('0xd')]);router[_0x39a2('0xa')](_0x39a2('0xe'),auth[_0x39a2('0xc')](),controller[_0x39a2('0xf')]);router[_0x39a2('0x10')]('/',auth['isAuthenticated'](),controller[_0x39a2('0x11')]);router[_0x39a2('0x12')](_0x39a2('0x13'),auth[_0x39a2('0xc')](),controller[_0x39a2('0x14')]);router[_0x39a2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x39a2('0x16')]);module[_0x39a2('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f97dab5..236d6db 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 _0xc7e0=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x4d3a9b,_0x20b47d){var _0x1b5471=function(_0x51bf57){while(--_0x51bf57){_0x4d3a9b['push'](_0x4d3a9b['shift']());}};_0x1b5471(++_0x20b47d);}(_0xc7e0,0x1e3));var _0x0c7e=function(_0xfb8dec,_0x436634){_0xfb8dec=_0xfb8dec-0x0;var _0x3c4114=_0xc7e0[_0xfb8dec];return _0x3c4114;};'use strict';var Sequelize=require(_0x0c7e('0x0'));module[_0x0c7e('0x1')]={'field':{'type':Sequelize[_0x0c7e('0x2')]},'alias':{'type':Sequelize[_0x0c7e('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0c7e('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0c7e('0x3')]},'custom':{'type':Sequelize[_0x0c7e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8c9b=['exports','TEXT','STRING','BOOLEAN'];(function(_0x2d8efc,_0x58e635){var _0x4a7f2d=function(_0x5404e7){while(--_0x5404e7){_0x2d8efc['push'](_0x2d8efc['shift']());}};_0x4a7f2d(++_0x58e635);}(_0x8c9b,0xa8));var _0xb8c9=function(_0x49f7e0,_0x15a064){_0x49f7e0=_0x49f7e0-0x0;var _0x556090=_0x8c9b[_0x49f7e0];return _0x556090;};'use strict';var Sequelize=require('sequelize');module[_0xb8c9('0x0')]={'field':{'type':Sequelize[_0xb8c9('0x1')]},'alias':{'type':Sequelize[_0xb8c9('0x2')]},'function':{'type':Sequelize[_0xb8c9('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xb8c9('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xb8c9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 81c7fcc..5ab417e 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 _0x43de=['name','send','map','AnalyticFieldReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','filter','includeAll','include','findAll','rows','params','rawAttributes','options','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','save','update','then','destroy','stack'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x43de,0x163));var _0xe43d=function(_0x53e8c1,_0x1a6586){_0x53e8c1=_0x53e8c1-0x0;var _0x416748=_0x43de[_0x53e8c1];return _0x416748;};'use strict';var emlformat=require(_0xe43d('0x0'));var rimraf=require(_0xe43d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe43d('0x2'));var rp=require('request-promise');var moment=require(_0xe43d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe43d('0x4'));var util=require(_0xe43d('0x5'));var path=require(_0xe43d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe43d('0x7'));var fs=require('fs');var fs_extra=require(_0xe43d('0x8'));var _=require(_0xe43d('0x9'));var squel=require(_0xe43d('0xa'));var crypto=require(_0xe43d('0xb'));var jsforce=require(_0xe43d('0xc'));var deskjs=require(_0xe43d('0xd'));var toCsv=require(_0xe43d('0xe'));var querystring=require(_0xe43d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe43d('0x10'));var qs=require(_0xe43d('0x11'));var as=require(_0xe43d('0x12'));var hardwareService=require(_0xe43d('0x13'));var logger=require(_0xe43d('0x14'))(_0xe43d('0x15'));var utils=require(_0xe43d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe43d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49ec0b,_0x28ee70){_0x28ee70=_0x28ee70||0xcc;return function(_0x32c3b9){if(_0x32c3b9){return _0x49ec0b[_0xe43d('0x18')](_0x28ee70);}return _0x49ec0b['status'](_0x28ee70)[_0xe43d('0x19')]();};}function respondWithResult(_0x4e1af2,_0x2f3ccf){_0x2f3ccf=_0x2f3ccf||0xc8;return function(_0x55f9b5){if(_0x55f9b5){return _0x4e1af2['status'](_0x2f3ccf)['json'](_0x55f9b5);}};}function respondWithFilteredResult(_0x2ea3d8,_0x1d7b40){return function(_0x1491cd){if(_0x1491cd){var _0xc221d8=typeof _0x1d7b40[_0xe43d('0x1a')]===_0xe43d('0x1b')&&typeof _0x1d7b40['limit']===_0xe43d('0x1b');var _0x258752=_0x1491cd[_0xe43d('0x1c')];var _0x712a1c=_0xc221d8?0x0:_0x1d7b40[_0xe43d('0x1a')];var _0x3fe86a=_0xc221d8?_0x1491cd['count']:_0x1d7b40[_0xe43d('0x1a')]+_0x1d7b40[_0xe43d('0x1d')];var _0x2cb1c8;if(_0x3fe86a>=_0x258752){_0x3fe86a=_0x258752;_0x2cb1c8=0xc8;}else{_0x2cb1c8=0xce;}_0x2ea3d8[_0xe43d('0x1e')](_0x2cb1c8);return _0x2ea3d8[_0xe43d('0x1f')](_0xe43d('0x20'),_0x712a1c+'-'+_0x3fe86a+'/'+_0x258752)[_0xe43d('0x21')](_0x1491cd);}return null;};}function patchUpdates(_0x4d338a){return function(_0x1f9967){try{jsonpatch[_0xe43d('0x22')](_0x1f9967,_0x4d338a,!![]);}catch(_0x271ab9){return BPromise['reject'](_0x271ab9);}return _0x1f9967[_0xe43d('0x23')]();};}function saveUpdates(_0x2c33cd,_0x2e34f1){return function(_0x4fa4f1){if(_0x4fa4f1){return _0x4fa4f1[_0xe43d('0x24')](_0x2c33cd)[_0xe43d('0x25')](function(_0x866a14){return _0x866a14;});}return null;};}function removeEntity(_0x3af291,_0x2bf1fa){return function(_0x3f40b6){if(_0x3f40b6){return _0x3f40b6[_0xe43d('0x26')]()['then'](function(){_0x3af291[_0xe43d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453a8b,_0x243d83){return function(_0x37cac2){if(!_0x37cac2){_0x453a8b[_0xe43d('0x18')](0x194);}return _0x37cac2;};}function handleError(_0x4a173e,_0x27c765){_0x27c765=_0x27c765||0x1f4;return function(_0x228300){logger['error'](_0x228300[_0xe43d('0x27')]);if(_0x228300[_0xe43d('0x28')]){delete _0x228300['name'];}_0x4a173e[_0xe43d('0x1e')](_0x27c765)[_0xe43d('0x29')](_0x228300);};}exports['index']=function(_0x41ef33,_0x2053c3){var _0x3b8e38={},_0x16d999={},_0x407f03={'count':0x0,'rows':[]};var _0x441f34=_[_0xe43d('0x2a')](db[_0xe43d('0x2b')]['rawAttributes'],function(_0x3af35f){return{'name':_0x3af35f[_0xe43d('0x2c')],'type':_0x3af35f[_0xe43d('0x2d')]['key']};});_0x16d999[_0xe43d('0x2e')]=_[_0xe43d('0x2a')](_0x441f34,'name');_0x16d999[_0xe43d('0x2f')]=_[_0xe43d('0x30')](_0x41ef33[_0xe43d('0x2f')]);_0x16d999[_0xe43d('0x31')]=_[_0xe43d('0x32')](_0x16d999[_0xe43d('0x2e')],_0x16d999[_0xe43d('0x2f')]);_0x3b8e38['attributes']=_[_0xe43d('0x32')](_0x16d999[_0xe43d('0x2e')],qs['fields'](_0x41ef33[_0xe43d('0x2f')][_0xe43d('0x33')]));_0x3b8e38[_0xe43d('0x34')]=_0x3b8e38[_0xe43d('0x34')][_0xe43d('0x35')]?_0x3b8e38[_0xe43d('0x34')]:_0x16d999[_0xe43d('0x2e')];if(!_0x41ef33[_0xe43d('0x2f')][_0xe43d('0x36')]('nolimit')){_0x3b8e38[_0xe43d('0x1d')]=qs['limit'](_0x41ef33[_0xe43d('0x2f')]['limit']);_0x3b8e38[_0xe43d('0x1a')]=qs[_0xe43d('0x1a')](_0x41ef33[_0xe43d('0x2f')][_0xe43d('0x1a')]);}_0x3b8e38[_0xe43d('0x37')]=qs['sort'](_0x41ef33[_0xe43d('0x2f')][_0xe43d('0x38')]);_0x3b8e38['where']=qs['filters'](_[_0xe43d('0x39')](_0x41ef33['query'],_0x16d999[_0xe43d('0x31')]),_0x441f34);if(_0x41ef33[_0xe43d('0x2f')]['filter']){_0x3b8e38[_0xe43d('0x3a')]=_[_0xe43d('0x3b')](_0x3b8e38[_0xe43d('0x3a')],{'$or':_[_0xe43d('0x2a')](_0x441f34,function(_0x2bf985){if(_0x2bf985[_0xe43d('0x2d')]!=='VIRTUAL'){var _0x30b0b6={};_0x30b0b6[_0x2bf985[_0xe43d('0x28')]]={'$like':'%'+_0x41ef33['query'][_0xe43d('0x3c')]+'%'};return _0x30b0b6;}})});}_0x3b8e38=_[_0xe43d('0x3b')]({},_0x3b8e38,_0x41ef33['options']);var _0x205c28={'where':_0x3b8e38[_0xe43d('0x3a')]};return db[_0xe43d('0x2b')]['count'](_0x205c28)['then'](function(_0x4a3cd8){_0x407f03[_0xe43d('0x1c')]=_0x4a3cd8;if(_0x41ef33['query'][_0xe43d('0x3d')]){_0x3b8e38[_0xe43d('0x3e')]=[{'all':!![]}];}return db[_0xe43d('0x2b')][_0xe43d('0x3f')](_0x3b8e38);})['then'](function(_0x230257){_0x407f03[_0xe43d('0x40')]=_0x230257;return _0x407f03;})[_0xe43d('0x25')](respondWithFilteredResult(_0x2053c3,_0x3b8e38))['catch'](handleError(_0x2053c3,null));};exports['show']=function(_0x528bb2,_0x932821){var _0x3d2770={'raw':![],'where':{'id':_0x528bb2[_0xe43d('0x41')]['id']}},_0x414b56={};_0x414b56['model']=_[_0xe43d('0x30')](db[_0xe43d('0x2b')][_0xe43d('0x42')]);_0x414b56['query']=_[_0xe43d('0x30')](_0x528bb2[_0xe43d('0x2f')]);_0x414b56['filters']=_[_0xe43d('0x32')](_0x414b56[_0xe43d('0x2e')],_0x414b56[_0xe43d('0x2f')]);_0x3d2770['attributes']=_[_0xe43d('0x32')](_0x414b56['model'],qs[_0xe43d('0x33')](_0x528bb2[_0xe43d('0x2f')][_0xe43d('0x33')]));_0x3d2770[_0xe43d('0x34')]=_0x3d2770['attributes'][_0xe43d('0x35')]?_0x3d2770[_0xe43d('0x34')]:_0x414b56[_0xe43d('0x2e')];if(_0x528bb2[_0xe43d('0x2f')][_0xe43d('0x3d')]){_0x3d2770['include']=[{'all':!![]}];}_0x3d2770=_[_0xe43d('0x3b')]({},_0x3d2770,_0x528bb2[_0xe43d('0x43')]);return db[_0xe43d('0x2b')][_0xe43d('0x44')](_0x3d2770)[_0xe43d('0x25')](handleEntityNotFound(_0x932821,null))[_0xe43d('0x25')](respondWithResult(_0x932821,null))[_0xe43d('0x45')](handleError(_0x932821,null));};exports[_0xe43d('0x46')]=function(_0x5e6cd4,_0x3f805f){return db['AnalyticFieldReport'][_0xe43d('0x46')](_0x5e6cd4[_0xe43d('0x47')],{})[_0xe43d('0x25')](respondWithResult(_0x3f805f,0xc9))[_0xe43d('0x45')](handleError(_0x3f805f,null));};exports['bulkCreate']=function(_0xc1836,_0x181693){return db['AnalyticFieldReport'][_0xe43d('0x48')](_0xc1836['body'],{'raw':![],'individualHooks':!![]})[_0xe43d('0x25')](respondWithResult(_0x181693,0xc9))[_0xe43d('0x45')](handleError(_0x181693,null));};exports['update']=function(_0xfacc7,_0x2d4f0b){if(_0xfacc7['body']['id']){delete _0xfacc7[_0xe43d('0x47')]['id'];}return db[_0xe43d('0x2b')][_0xe43d('0x44')]({'where':{'id':_0xfacc7['params']['id']}})[_0xe43d('0x25')](handleEntityNotFound(_0x2d4f0b,null))[_0xe43d('0x25')](saveUpdates(_0xfacc7['body'],null))[_0xe43d('0x25')](respondWithResult(_0x2d4f0b,null))[_0xe43d('0x45')](handleError(_0x2d4f0b,null));};exports[_0xe43d('0x26')]=function(_0x282bc7,_0x3e174f){return db[_0xe43d('0x2b')][_0xe43d('0x44')]({'where':{'id':_0x282bc7[_0xe43d('0x41')]['id']}})[_0xe43d('0x25')](handleEntityNotFound(_0x3e174f,null))[_0xe43d('0x25')](removeEntity(_0x3e174f,null))[_0xe43d('0x45')](handleError(_0x3e174f,null));};exports[_0xe43d('0x49')]=function(_0x9c54a8,_0x1a62ac){return db[_0xe43d('0x2b')][_0xe43d('0x26')]({'where':{'id':_0x9c54a8[_0xe43d('0x2f')][_0xe43d('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1a62ac,0xcc))['catch'](handleError(_0x1a62ac,null));};exports[_0xe43d('0x4b')]=function(_0x1bb592,_0x6f22b7,_0x29b0cc){return db[_0xe43d('0x4c')][_0xe43d('0x4d')]({'where':{'id':_0x1bb592[_0xe43d('0x41')]['id']}})[_0xe43d('0x25')](handleEntityNotFound(_0x6f22b7,null))[_0xe43d('0x25')](function(_0x51193c){if(_0x51193c){return db[_0xe43d('0x4e')]['transaction'](function(_0x310bbe){return db[_0xe43d('0x2b')][_0xe43d('0x26')]({'where':{'CustomReportId':_0x1bb592['params']['id']},'transaction':_0x310bbe})['then'](function(_0x5e4a46){var _0x5b288c=_[_0xe43d('0x2a')](_0x1bb592['body'],function(_0x2af97a){delete _0x2af97a['id'];_0x2af97a['CustomReportId']=_0x1bb592['params']['id'];return _0x2af97a;});return db[_0xe43d('0x2b')][_0xe43d('0x48')](_0x5b288c,{'transaction':_0x310bbe});});})[_0xe43d('0x25')](function(){return db[_0xe43d('0x2b')][_0xe43d('0x3f')]({'where':{'CustomReportId':_0x1bb592[_0xe43d('0x41')]['id']}});});}})[_0xe43d('0x25')](respondWithResult(_0x6f22b7,null))[_0xe43d('0x45')](handleError(_0x6f22b7,null));}; \ No newline at end of file +var _0x49c1=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','destroy','error','stack','send','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','AnalyticFieldReport','then','include','findAll','rows','catch','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x402d00,_0x46761f){var _0x23df42=function(_0x55eac8){while(--_0x55eac8){_0x402d00['push'](_0x402d00['shift']());}};_0x23df42(++_0x46761f);}(_0x49c1,0x184));var _0x149c=function(_0x5c4893,_0x491e7b){_0x5c4893=_0x5c4893-0x0;var _0x299145=_0x49c1[_0x5c4893];return _0x299145;};'use strict';var emlformat=require(_0x149c('0x0'));var rimraf=require(_0x149c('0x1'));var zipdir=require(_0x149c('0x2'));var jsonpatch=require(_0x149c('0x3'));var rp=require(_0x149c('0x4'));var moment=require('moment');var BPromise=require(_0x149c('0x5'));var Mustache=require('mustache');var util=require(_0x149c('0x6'));var path=require(_0x149c('0x7'));var sox=require(_0x149c('0x8'));var csv=require(_0x149c('0x9'));var ejs=require(_0x149c('0xa'));var fs=require('fs');var fs_extra=require(_0x149c('0xb'));var _=require(_0x149c('0xc'));var squel=require('squel');var crypto=require(_0x149c('0xd'));var jsforce=require(_0x149c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x149c('0x9'));var querystring=require(_0x149c('0xf'));var Papa=require(_0x149c('0x10'));var Redis=require('ioredis');var authService=require(_0x149c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x149c('0x12'));var hardwareService=require(_0x149c('0x13'));var logger=require(_0x149c('0x14'))(_0x149c('0x15'));var utils=require('../../config/utils');var config=require(_0x149c('0x16'));var licenseUtil=require(_0x149c('0x17'));var db=require(_0x149c('0x18'))['db'];function respondWithStatusCode(_0x24eca3,_0x2c3fe7){_0x2c3fe7=_0x2c3fe7||0xcc;return function(_0x55fce4){if(_0x55fce4){return _0x24eca3[_0x149c('0x19')](_0x2c3fe7);}return _0x24eca3[_0x149c('0x1a')](_0x2c3fe7)[_0x149c('0x1b')]();};}function respondWithResult(_0x2dc8d0,_0x1704fd){_0x1704fd=_0x1704fd||0xc8;return function(_0x20d480){if(_0x20d480){return _0x2dc8d0['status'](_0x1704fd)[_0x149c('0x1c')](_0x20d480);}};}function respondWithFilteredResult(_0x4fec04,_0xaf16f7){return function(_0x46d1b8){if(_0x46d1b8){var _0x9088e=typeof _0xaf16f7[_0x149c('0x1d')]==='undefined'&&typeof _0xaf16f7[_0x149c('0x1e')]==='undefined';var _0x5d4a0b=_0x46d1b8[_0x149c('0x1f')];var _0x1076dc=_0x9088e?0x0:_0xaf16f7[_0x149c('0x1d')];var _0x299612=_0x9088e?_0x46d1b8[_0x149c('0x1f')]:_0xaf16f7['offset']+_0xaf16f7['limit'];var _0x4edd23;if(_0x299612>=_0x5d4a0b){_0x299612=_0x5d4a0b;_0x4edd23=0xc8;}else{_0x4edd23=0xce;}_0x4fec04[_0x149c('0x1a')](_0x4edd23);return _0x4fec04[_0x149c('0x20')]('Content-Range',_0x1076dc+'-'+_0x299612+'/'+_0x5d4a0b)['json'](_0x46d1b8);}return null;};}function patchUpdates(_0x4704b8){return function(_0x1590a0){try{jsonpatch[_0x149c('0x21')](_0x1590a0,_0x4704b8,!![]);}catch(_0x505c06){return BPromise['reject'](_0x505c06);}return _0x1590a0['save']();};}function saveUpdates(_0x337891,_0x59e0f8){return function(_0x584205){if(_0x584205){return _0x584205['update'](_0x337891)['then'](function(_0x2956e3){return _0x2956e3;});}return null;};}function removeEntity(_0x373133,_0xde3a7){return function(_0x18193d){if(_0x18193d){return _0x18193d[_0x149c('0x22')]()['then'](function(){_0x373133[_0x149c('0x1a')](0xcc)[_0x149c('0x1b')]();});}};}function handleEntityNotFound(_0x408a5c,_0x3b6fbc){return function(_0x4cd3c3){if(!_0x4cd3c3){_0x408a5c['sendStatus'](0x194);}return _0x4cd3c3;};}function handleError(_0x5b29ff,_0x4ba85b){_0x4ba85b=_0x4ba85b||0x1f4;return function(_0x2a8717){logger[_0x149c('0x23')](_0x2a8717[_0x149c('0x24')]);if(_0x2a8717['name']){delete _0x2a8717['name'];}_0x5b29ff[_0x149c('0x1a')](_0x4ba85b)[_0x149c('0x25')](_0x2a8717);};}exports['index']=function(_0x4ea959,_0x328f93){var _0x52037d={},_0xe65f6b={},_0x3bd0c9={'count':0x0,'rows':[]};var _0x54dd19=_['map'](db['AnalyticFieldReport']['rawAttributes'],function(_0x59d330){return{'name':_0x59d330[_0x149c('0x26')],'type':_0x59d330[_0x149c('0x27')][_0x149c('0x28')]};});_0xe65f6b[_0x149c('0x29')]=_[_0x149c('0x2a')](_0x54dd19,_0x149c('0x2b'));_0xe65f6b[_0x149c('0x2c')]=_[_0x149c('0x2d')](_0x4ea959[_0x149c('0x2c')]);_0xe65f6b[_0x149c('0x2e')]=_[_0x149c('0x2f')](_0xe65f6b[_0x149c('0x29')],_0xe65f6b['query']);_0x52037d['attributes']=_[_0x149c('0x2f')](_0xe65f6b[_0x149c('0x29')],qs[_0x149c('0x30')](_0x4ea959[_0x149c('0x2c')]['fields']));_0x52037d[_0x149c('0x31')]=_0x52037d[_0x149c('0x31')][_0x149c('0x32')]?_0x52037d[_0x149c('0x31')]:_0xe65f6b[_0x149c('0x29')];if(!_0x4ea959[_0x149c('0x2c')][_0x149c('0x33')](_0x149c('0x34'))){_0x52037d[_0x149c('0x1e')]=qs[_0x149c('0x1e')](_0x4ea959['query']['limit']);_0x52037d[_0x149c('0x1d')]=qs[_0x149c('0x1d')](_0x4ea959[_0x149c('0x2c')][_0x149c('0x1d')]);}_0x52037d[_0x149c('0x35')]=qs['sort'](_0x4ea959[_0x149c('0x2c')]['sort']);_0x52037d['where']=qs['filters'](_[_0x149c('0x36')](_0x4ea959['query'],_0xe65f6b['filters']),_0x54dd19);if(_0x4ea959[_0x149c('0x2c')][_0x149c('0x37')]){_0x52037d[_0x149c('0x38')]=_['merge'](_0x52037d[_0x149c('0x38')],{'$or':_[_0x149c('0x2a')](_0x54dd19,function(_0x466211){if(_0x466211['type']!==_0x149c('0x39')){var _0x366ff0={};_0x366ff0[_0x466211['name']]={'$like':'%'+_0x4ea959[_0x149c('0x2c')]['filter']+'%'};return _0x366ff0;}})});}_0x52037d=_[_0x149c('0x3a')]({},_0x52037d,_0x4ea959['options']);var _0x35a282={'where':_0x52037d['where']};return db[_0x149c('0x3b')][_0x149c('0x1f')](_0x35a282)[_0x149c('0x3c')](function(_0x2f4548){_0x3bd0c9[_0x149c('0x1f')]=_0x2f4548;if(_0x4ea959[_0x149c('0x2c')]['includeAll']){_0x52037d[_0x149c('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x149c('0x3e')](_0x52037d);})[_0x149c('0x3c')](function(_0x14da52){_0x3bd0c9[_0x149c('0x3f')]=_0x14da52;return _0x3bd0c9;})[_0x149c('0x3c')](respondWithFilteredResult(_0x328f93,_0x52037d))[_0x149c('0x40')](handleError(_0x328f93,null));};exports['show']=function(_0x38c260,_0x1d70ef){var _0xf2b44c={'raw':![],'where':{'id':_0x38c260[_0x149c('0x41')]['id']}},_0x25536e={};_0x25536e[_0x149c('0x29')]=_[_0x149c('0x2d')](db[_0x149c('0x3b')][_0x149c('0x42')]);_0x25536e['query']=_[_0x149c('0x2d')](_0x38c260['query']);_0x25536e['filters']=_[_0x149c('0x2f')](_0x25536e[_0x149c('0x29')],_0x25536e[_0x149c('0x2c')]);_0xf2b44c['attributes']=_[_0x149c('0x2f')](_0x25536e[_0x149c('0x29')],qs[_0x149c('0x30')](_0x38c260['query']['fields']));_0xf2b44c[_0x149c('0x31')]=_0xf2b44c[_0x149c('0x31')][_0x149c('0x32')]?_0xf2b44c[_0x149c('0x31')]:_0x25536e[_0x149c('0x29')];if(_0x38c260[_0x149c('0x2c')]['includeAll']){_0xf2b44c[_0x149c('0x3d')]=[{'all':!![]}];}_0xf2b44c=_[_0x149c('0x3a')]({},_0xf2b44c,_0x38c260['options']);return db[_0x149c('0x3b')][_0x149c('0x43')](_0xf2b44c)[_0x149c('0x3c')](handleEntityNotFound(_0x1d70ef,null))['then'](respondWithResult(_0x1d70ef,null))[_0x149c('0x40')](handleError(_0x1d70ef,null));};exports[_0x149c('0x44')]=function(_0x245412,_0x12e076){return db[_0x149c('0x3b')][_0x149c('0x44')](_0x245412[_0x149c('0x45')],{})[_0x149c('0x3c')](respondWithResult(_0x12e076,0xc9))['catch'](handleError(_0x12e076,null));};exports[_0x149c('0x46')]=function(_0x13333a,_0x2523e7){return db[_0x149c('0x3b')][_0x149c('0x46')](_0x13333a[_0x149c('0x45')],{'raw':![],'individualHooks':!![]})[_0x149c('0x3c')](respondWithResult(_0x2523e7,0xc9))[_0x149c('0x40')](handleError(_0x2523e7,null));};exports['update']=function(_0x42d75f,_0x2ee3ec){if(_0x42d75f[_0x149c('0x45')]['id']){delete _0x42d75f[_0x149c('0x45')]['id'];}return db[_0x149c('0x3b')][_0x149c('0x43')]({'where':{'id':_0x42d75f[_0x149c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ee3ec,null))[_0x149c('0x3c')](saveUpdates(_0x42d75f[_0x149c('0x45')],null))['then'](respondWithResult(_0x2ee3ec,null))[_0x149c('0x40')](handleError(_0x2ee3ec,null));};exports['destroy']=function(_0x3dda7b,_0x2538f2){return db[_0x149c('0x3b')]['find']({'where':{'id':_0x3dda7b['params']['id']}})['then'](handleEntityNotFound(_0x2538f2,null))[_0x149c('0x3c')](removeEntity(_0x2538f2,null))[_0x149c('0x40')](handleError(_0x2538f2,null));};exports[_0x149c('0x47')]=function(_0x30cfd9,_0x5b8f86){return db[_0x149c('0x3b')][_0x149c('0x22')]({'where':{'id':_0x30cfd9[_0x149c('0x2c')][_0x149c('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x149c('0x3c')](respondWithResult(_0x5b8f86,0xcc))[_0x149c('0x40')](handleError(_0x5b8f86,null));};exports[_0x149c('0x49')]=function(_0x31c581,_0x37dafa,_0x50c3f3){return db[_0x149c('0x4a')][_0x149c('0x4b')]({'where':{'id':_0x31c581['params']['id']}})[_0x149c('0x3c')](handleEntityNotFound(_0x37dafa,null))[_0x149c('0x3c')](function(_0x4440a2){if(_0x4440a2){return db[_0x149c('0x4c')][_0x149c('0x4d')](function(_0x136204){return db[_0x149c('0x3b')][_0x149c('0x22')]({'where':{'CustomReportId':_0x31c581['params']['id']},'transaction':_0x136204})[_0x149c('0x3c')](function(_0x3e873d){var _0xabe33d=_[_0x149c('0x2a')](_0x31c581[_0x149c('0x45')],function(_0x5295d2){delete _0x5295d2['id'];_0x5295d2[_0x149c('0x4e')]=_0x31c581[_0x149c('0x41')]['id'];return _0x5295d2;});return db[_0x149c('0x3b')]['bulkCreate'](_0xabe33d,{'transaction':_0x136204});});})[_0x149c('0x3c')](function(){return db[_0x149c('0x3b')]['findAll']({'where':{'CustomReportId':_0x31c581['params']['id']}});});}})[_0x149c('0x3c')](respondWithResult(_0x37dafa,null))[_0x149c('0x40')](handleError(_0x37dafa,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ce7ae0a..715f6a7 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 _0x6d74=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x1bebb5,_0x550e89){var _0x22c83d=function(_0x1a9ed2){while(--_0x1a9ed2){_0x1bebb5['push'](_0x1bebb5['shift']());}};_0x22c83d(++_0x550e89);}(_0x6d74,0x182));var _0x46d7=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x6d74[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x46d7('0x0'));var util=require(_0x46d7('0x1'));var logger=require(_0x46d7('0x2'))(_0x46d7('0x3'));var moment=require(_0x46d7('0x4'));var BPromise=require(_0x46d7('0x5'));var rp=require(_0x46d7('0x6'));var fs=require('fs');var path=require(_0x46d7('0x7'));var rimraf=require(_0x46d7('0x8'));var config=require(_0x46d7('0x9'));var attributes=require(_0x46d7('0xa'));module[_0x46d7('0xb')]=function(_0x306f39,_0x3255a3){return _0x306f39[_0x46d7('0xc')](_0x46d7('0xd'),attributes,{'tableName':_0x46d7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74d5=['exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment','request-promise','path','./analyticFieldReport.attributes'];(function(_0x12526d,_0x7fada3){var _0xefd69a=function(_0xbd146c){while(--_0xbd146c){_0x12526d['push'](_0x12526d['shift']());}};_0xefd69a(++_0x7fada3);}(_0x74d5,0x1b1));var _0x574d=function(_0x20cf10,_0x465f55){_0x20cf10=_0x20cf10-0x0;var _0x53fe52=_0x74d5[_0x20cf10];return _0x53fe52;};'use strict';var _=require(_0x574d('0x0'));var util=require(_0x574d('0x1'));var logger=require(_0x574d('0x2'))('api');var moment=require(_0x574d('0x3'));var BPromise=require('bluebird');var rp=require(_0x574d('0x4'));var fs=require('fs');var path=require(_0x574d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x574d('0x6'));module[_0x574d('0x7')]=function(_0x3173a2,_0x349cab){return _0x3173a2[_0x574d('0x8')](_0x574d('0x9'),attributes,{'tableName':'analytics_report_fields','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 70280a0..b13c7f3 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 _0x2196=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x300f86,_0x356a2f){var _0x1e9ac4=function(_0x549f9f){while(--_0x549f9f){_0x300f86['push'](_0x300f86['shift']());}};_0x1e9ac4(++_0x356a2f);}(_0x2196,0x197));var _0x6219=function(_0x3765ff,_0x16916e){_0x3765ff=_0x3765ff-0x0;var _0x333f28=_0x2196[_0x3765ff];return _0x333f28;};'use strict';var _=require(_0x6219('0x0'));var util=require(_0x6219('0x1'));var moment=require(_0x6219('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6219('0x3'));var db=require(_0x6219('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6219('0x5'))(_0x6219('0x6'));var config=require(_0x6219('0x7'));var jayson=require(_0x6219('0x8'));var client=jayson[_0x6219('0x9')][_0x6219('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aeefb,_0x375f16,_0x324c64){return new BPromise(function(_0x53358e,_0x39b784){return client[_0x6219('0xb')](_0x3aeefb,_0x324c64)[_0x6219('0xc')](function(_0x1de215){logger[_0x6219('0xd')](_0x6219('0xe'),_0x375f16,'request\x20sent');logger['debug'](_0x6219('0xf'),_0x375f16,_0x6219('0x10'),JSON['stringify'](_0x1de215));if(_0x1de215['error']){if(_0x1de215[_0x6219('0x11')]['code']===0x1f4){logger[_0x6219('0x11')](_0x6219('0xe'),_0x375f16,_0x1de215[_0x6219('0x11')]['message']);return _0x39b784(_0x1de215[_0x6219('0x11')][_0x6219('0x12')]);}logger[_0x6219('0x11')](_0x6219('0xe'),_0x375f16,_0x1de215[_0x6219('0x11')][_0x6219('0x12')]);return _0x53358e(_0x1de215['error']['message']);}else{logger[_0x6219('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x375f16,_0x6219('0x10'));_0x53358e(_0x1de215['result'][_0x6219('0x12')]);}})['catch'](function(_0x5424ba){logger['error'](_0x6219('0xe'),_0x375f16,_0x5424ba);_0x39b784(_0x5424ba);});});} \ No newline at end of file +var _0x9a3c=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x122932,_0x989fcb){var _0x2391c=function(_0x2df1f9){while(--_0x2df1f9){_0x122932['push'](_0x122932['shift']());}};_0x2391c(++_0x989fcb);}(_0x9a3c,0x1ed));var _0xc9a3=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x9a3c[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0xc9a3('0x0'));var util=require(_0xc9a3('0x1'));var moment=require(_0xc9a3('0x2'));var BPromise=require(_0xc9a3('0x3'));var rs=require(_0xc9a3('0x4'));var fs=require('fs');var Redis=require(_0xc9a3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a3('0x6'));var logger=require(_0xc9a3('0x7'))(_0xc9a3('0x8'));var config=require(_0xc9a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc9a3('0xa')][_0xc9a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d00e2,_0x5a8010,_0x5edb0b){return new BPromise(function(_0x2f2c65,_0x362351){return client[_0xc9a3('0xc')](_0x4d00e2,_0x5edb0b)['then'](function(_0x1f7752){logger[_0xc9a3('0xd')](_0xc9a3('0xe'),_0x5a8010,_0xc9a3('0xf'));logger['debug'](_0xc9a3('0x10'),_0x5a8010,_0xc9a3('0xf'),JSON[_0xc9a3('0x11')](_0x1f7752));if(_0x1f7752[_0xc9a3('0x12')]){if(_0x1f7752['error'][_0xc9a3('0x13')]===0x1f4){logger[_0xc9a3('0x12')](_0xc9a3('0xe'),_0x5a8010,_0x1f7752['error'][_0xc9a3('0x14')]);return _0x362351(_0x1f7752[_0xc9a3('0x12')][_0xc9a3('0x14')]);}logger[_0xc9a3('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5a8010,_0x1f7752[_0xc9a3('0x12')][_0xc9a3('0x14')]);return _0x2f2c65(_0x1f7752[_0xc9a3('0x12')][_0xc9a3('0x14')]);}else{logger['info'](_0xc9a3('0xe'),_0x5a8010,'request\x20sent');_0x2f2c65(_0x1f7752[_0xc9a3('0x15')][_0xc9a3('0x14')]);}})[_0xc9a3('0x16')](function(_0x349d4e){logger[_0xc9a3('0x12')](_0xc9a3('0xe'),_0x5a8010,_0x349d4e);_0x362351(_0x349d4e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 55ec5e2..1569d20 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(_0x1f92c7,_0x351ccb){var _0x564e90=function(_0x5d6770){while(--_0x5d6770){_0x1f92c7['push'](_0x1f92c7['shift']());}};_0x564e90(++_0x351ccb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x114e4f,_0xbe96ca){var _0x27010e=function(_0x167474){while(--_0x167474){_0x114e4f['push'](_0x114e4f['shift']());}};_0x27010e(++_0xbe96ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 5a9774b..3e806d5 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 _0xffda=['sequelize','exports','STRING','name','TEXT'];(function(_0x31bb9e,_0x218f3f){var _0xa50bb8=function(_0x54e9c3){while(--_0x54e9c3){_0x31bb9e['push'](_0x31bb9e['shift']());}};_0xa50bb8(++_0x218f3f);}(_0xffda,0x73));var _0xaffd=function(_0x6ad3bf,_0x1418d7){_0x6ad3bf=_0x6ad3bf-0x0;var _0xe332e8=_0xffda[_0x6ad3bf];return _0xe332e8;};'use strict';var Sequelize=require(_0xaffd('0x0'));module[_0xaffd('0x1')]={'name':{'type':Sequelize[_0xaffd('0x2')],'allowNull':![],'unique':_0xaffd('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xaffd('0x4')]},'description':{'type':Sequelize[_0xaffd('0x2')]}}; \ No newline at end of file +var _0xd87e=['STRING','TEXT','sequelize','exports','name'];(function(_0x575627,_0x5f2c9f){var _0xac789a=function(_0x178836){while(--_0x178836){_0x575627['push'](_0x575627['shift']());}};_0xac789a(++_0x5f2c9f);}(_0xd87e,0x1bf));var _0xed87=function(_0xf0bbde,_0x1e8776){_0xf0bbde=_0xf0bbde-0x0;var _0x450001=_0xd87e[_0xf0bbde];return _0x450001;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed87('0x2')},'table':{'type':Sequelize[_0xed87('0x3')]},'metric':{'type':Sequelize[_0xed87('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7a42df5..c28c485 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 _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x205a6e,_0x571a14){var _0x43adb6=function(_0xb71d8b){while(--_0xb71d8b){_0x205a6e['push'](_0x205a6e['shift']());}};_0x43adb6(++_0x571a14);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3334cb,_0x38c266){_0x3334cb=_0x3334cb-0x0;var _0x60be26=_0x9c5a[_0x3334cb];return _0x60be26;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3a1b92,_0x28d1ff){var _0x3c35ae=function(_0x3a0de8){while(--_0x3a0de8){_0x3a1b92['push'](_0x3a1b92['shift']());}};_0x3c35ae(++_0x28d1ff);}(_0x55ca,0x126));var _0xa55c=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x55ca[_0x3f6bcf];return _0x1c5350;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5d45338..44fe502 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 _0xed08=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f8fee,_0x1a0bff){var _0x51643b=function(_0x414bd5){while(--_0x414bd5){_0x1f8fee['push'](_0x1f8fee['shift']());}};_0x51643b(++_0x1a0bff);}(_0xed08,0x67));var _0x8ed0=function(_0x85a9bf,_0x111dcd){_0x85a9bf=_0x85a9bf-0x0;var _0x6d94aa=_0xed08[_0x85a9bf];return _0x6d94aa;};'use strict';var _=require('lodash');var util=require(_0x8ed0('0x0'));var logger=require(_0x8ed0('0x1'))(_0x8ed0('0x2'));var moment=require(_0x8ed0('0x3'));var BPromise=require(_0x8ed0('0x4'));var rp=require(_0x8ed0('0x5'));var fs=require('fs');var path=require(_0x8ed0('0x6'));var rimraf=require(_0x8ed0('0x7'));var config=require(_0x8ed0('0x8'));var attributes=require(_0x8ed0('0x9'));module[_0x8ed0('0xa')]=function(_0x43ca60,_0x5c1343){return _0x43ca60[_0x8ed0('0xb')](_0x8ed0('0xc'),attributes,{'tableName':_0x8ed0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0xba7351,_0x13dea5){var _0x38347b=function(_0x19f72a){while(--_0x19f72a){_0xba7351['push'](_0xba7351['shift']());}};_0x38347b(++_0x13dea5);}(_0x814b,0x1a2));var _0xb814=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x814b[_0x1857c6];return _0x51011c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c2a79b5..e0dd3fe 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 _0xb9e3=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0xb9e3,0x150));var _0x3b9e=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xb9e3[_0x3712e2];return _0x1faff4;};'use strict';var _=require(_0x3b9e('0x0'));var util=require(_0x3b9e('0x1'));var moment=require(_0x3b9e('0x2'));var BPromise=require(_0x3b9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b9e('0x5'));var logger=require(_0x3b9e('0x6'))(_0x3b9e('0x7'));var config=require(_0x3b9e('0x8'));var jayson=require(_0x3b9e('0x9'));var client=jayson[_0x3b9e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3430cd,_0x3d828a,_0x20452d){return new BPromise(function(_0x413d31,_0x5d03b2){return client[_0x3b9e('0xb')](_0x3430cd,_0x20452d)[_0x3b9e('0xc')](function(_0x121d85){logger[_0x3b9e('0xd')](_0x3b9e('0xe'),_0x3d828a,'request\x20sent');logger[_0x3b9e('0xf')](_0x3b9e('0x10'),_0x3d828a,_0x3b9e('0x11'),JSON[_0x3b9e('0x12')](_0x121d85));if(_0x121d85[_0x3b9e('0x13')]){if(_0x121d85[_0x3b9e('0x13')][_0x3b9e('0x14')]===0x1f4){logger['error'](_0x3b9e('0xe'),_0x3d828a,_0x121d85[_0x3b9e('0x13')][_0x3b9e('0x15')]);return _0x5d03b2(_0x121d85['error'][_0x3b9e('0x15')]);}logger[_0x3b9e('0x13')](_0x3b9e('0xe'),_0x3d828a,_0x121d85['error']['message']);return _0x413d31(_0x121d85[_0x3b9e('0x13')]['message']);}else{logger['info'](_0x3b9e('0xe'),_0x3d828a,_0x3b9e('0x11'));_0x413d31(_0x121d85[_0x3b9e('0x16')]['message']);}})[_0x3b9e('0x17')](function(_0x4edbff){logger[_0x3b9e('0x13')](_0x3b9e('0xe'),_0x3d828a,_0x4edbff);_0x5d03b2(_0x4edbff);});});} \ No newline at end of file +var _0x5699=['moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x12f891,_0x2ea175){var _0x124954=function(_0x5085b4){while(--_0x5085b4){_0x12f891['push'](_0x12f891['shift']());}};_0x124954(++_0x2ea175);}(_0x5699,0x1a2));var _0x9569=function(_0x2b6ec7,_0x514fd5){_0x2b6ec7=_0x2b6ec7-0x0;var _0x41063d=_0x5699[_0x2b6ec7];return _0x41063d;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var moment=require(_0x9569('0x2'));var BPromise=require(_0x9569('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9569('0x4'));var db=require(_0x9569('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9569('0x6'));var jayson=require(_0x9569('0x7'));var client=jayson[_0x9569('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12dd20,_0x12e385,_0x3ecdc7){return new BPromise(function(_0x35254b,_0x4e9c24){return client[_0x9569('0x9')](_0x12dd20,_0x3ecdc7)['then'](function(_0x1f0d7d){logger[_0x9569('0xa')](_0x9569('0xb'),_0x12e385,_0x9569('0xc'));logger[_0x9569('0xd')](_0x9569('0xe'),_0x12e385,_0x9569('0xc'),JSON[_0x9569('0xf')](_0x1f0d7d));if(_0x1f0d7d[_0x9569('0x10')]){if(_0x1f0d7d[_0x9569('0x10')][_0x9569('0x11')]===0x1f4){logger[_0x9569('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x12e385,_0x1f0d7d[_0x9569('0x10')]['message']);return _0x4e9c24(_0x1f0d7d['error'][_0x9569('0x12')]);}logger[_0x9569('0x10')](_0x9569('0xb'),_0x12e385,_0x1f0d7d[_0x9569('0x10')][_0x9569('0x12')]);return _0x35254b(_0x1f0d7d[_0x9569('0x10')][_0x9569('0x12')]);}else{logger['info'](_0x9569('0xb'),_0x12e385,'request\x20sent');_0x35254b(_0x1f0d7d[_0x9569('0x13')][_0x9569('0x12')]);}})[_0x9569('0x14')](function(_0x5cda0e){logger['error'](_0x9569('0xb'),_0x12e385,_0x5cda0e);_0x4e9c24(_0x5cda0e);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1de9ff0..4790353 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 _0xce1a=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','get','/:id','put','update','exports','multer','express','Router','fs-extra'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xce1a,0xbf));var _0xace1=function(_0x1be143,_0x2f58ed){_0x1be143=_0x1be143-0x0;var _0xaa3f65=_0xce1a[_0x1be143];return _0xaa3f65;};'use strict';var multer=require(_0xace1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace1('0x1'));var router=express[_0xace1('0x2')]();var fs_extra=require(_0xace1('0x3'));var auth=require(_0xace1('0x4'));var interaction=require(_0xace1('0x5'));var config=require('../../config/environment');var controller=require(_0xace1('0x6'));router['get']('/',auth[_0xace1('0x7')](),controller['index']);router[_0xace1('0x8')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['show']);router['post']('/',auth[_0xace1('0x7')](),controller['create']);router[_0xace1('0xa')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller[_0xace1('0xb')]);router['delete'](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['destroy']);module[_0xace1('0xc')]=router; \ No newline at end of file +var _0xb073=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1fca71,_0x19bbe2){var _0x3de03f=function(_0x1f0cf0){while(--_0x1f0cf0){_0x1fca71['push'](_0x1fca71['shift']());}};_0x3de03f(++_0x19bbe2);}(_0xb073,0x187));var _0x3b07=function(_0xc39b1d,_0x52a3b6){_0xc39b1d=_0xc39b1d-0x0;var _0x358fad=_0xb073[_0xc39b1d];return _0x358fad;};'use strict';var multer=require('multer');var util=require(_0x3b07('0x0'));var path=require('path');var timeout=require(_0x3b07('0x1'));var express=require(_0x3b07('0x2'));var router=express[_0x3b07('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3b07('0x4'));var interaction=require(_0x3b07('0x5'));var config=require(_0x3b07('0x6'));var controller=require('./analyticMetric.controller');router[_0x3b07('0x7')]('/',auth[_0x3b07('0x8')](),controller[_0x3b07('0x9')]);router[_0x3b07('0x7')](_0x3b07('0xa'),auth[_0x3b07('0x8')](),controller[_0x3b07('0xb')]);router[_0x3b07('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b07('0xd')](_0x3b07('0xa'),auth[_0x3b07('0x8')](),controller[_0x3b07('0xe')]);router[_0x3b07('0xf')](_0x3b07('0xa'),auth[_0x3b07('0x8')](),controller[_0x3b07('0x10')]);module[_0x3b07('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 341506e..ffa8c12 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 _0xa4ba=['TEXT','exports'];(function(_0x265793,_0x1184c5){var _0x1fbad1=function(_0x420cb8){while(--_0x420cb8){_0x265793['push'](_0x265793['shift']());}};_0x1fbad1(++_0x1184c5);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xa4ba[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module[_0xaa4b('0x0')]={'tree':{'type':Sequelize[_0xaa4b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x71ef=['TEXT','sequelize','exports'];(function(_0x5f2498,_0x43d481){var _0x34813f=function(_0x53c206){while(--_0x53c206){_0x5f2498['push'](_0x5f2498['shift']());}};_0x34813f(++_0x43d481);}(_0x71ef,0x100));var _0xf71e=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x71ef[_0x2f6f50];return _0x2cf365;};'use strict';var Sequelize=require(_0xf71e('0x0'));module[_0xf71e('0x1')]={'tree':{'type':Sequelize[_0xf71e('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 7fdd74d..c0c4e09 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 _0x0e84=['offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','type','options','AnalyticTreeReport','includeAll','include','rows','catch','show','params','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x2dca3e,_0x4bf28c){var _0x3f1878=function(_0x798aab){while(--_0x798aab){_0x2dca3e['push'](_0x2dca3e['shift']());}};_0x3f1878(++_0x4bf28c);}(_0x0e84,0xb6));var _0x40e8=function(_0x1c7639,_0x2280c6){_0x1c7639=_0x1c7639-0x0;var _0x3229aa=_0x0e84[_0x1c7639];return _0x3229aa;};'use strict';var emlformat=require(_0x40e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40e8('0x1'));var jsonpatch=require(_0x40e8('0x2'));var rp=require(_0x40e8('0x3'));var moment=require(_0x40e8('0x4'));var BPromise=require(_0x40e8('0x5'));var Mustache=require('mustache');var util=require(_0x40e8('0x6'));var path=require(_0x40e8('0x7'));var sox=require(_0x40e8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40e8('0x9'));var _=require(_0x40e8('0xa'));var squel=require(_0x40e8('0xb'));var crypto=require(_0x40e8('0xc'));var jsforce=require(_0x40e8('0xd'));var deskjs=require(_0x40e8('0xe'));var toCsv=require(_0x40e8('0xf'));var querystring=require(_0x40e8('0x10'));var Papa=require(_0x40e8('0x11'));var Redis=require(_0x40e8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x40e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x40e8('0x14'))(_0x40e8('0x15'));var utils=require(_0x40e8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x40e8('0x17'))['db'];function respondWithStatusCode(_0x1bcf80,_0x1e9d20){_0x1e9d20=_0x1e9d20||0xcc;return function(_0x294737){if(_0x294737){return _0x1bcf80[_0x40e8('0x18')](_0x1e9d20);}return _0x1bcf80[_0x40e8('0x19')](_0x1e9d20)[_0x40e8('0x1a')]();};}function respondWithResult(_0x2a0cf5,_0x49d193){_0x49d193=_0x49d193||0xc8;return function(_0x48b53a){if(_0x48b53a){return _0x2a0cf5['status'](_0x49d193)[_0x40e8('0x1b')](_0x48b53a);}};}function respondWithFilteredResult(_0x543f8f,_0x1fae1d){return function(_0x55104d){if(_0x55104d){var _0x8af40b=typeof _0x1fae1d['offset']===_0x40e8('0x1c')&&typeof _0x1fae1d[_0x40e8('0x1d')]===_0x40e8('0x1c');var _0x25a3dc=_0x55104d[_0x40e8('0x1e')];var _0x5a04df=_0x8af40b?0x0:_0x1fae1d[_0x40e8('0x1f')];var _0x1c264c=_0x8af40b?_0x55104d['count']:_0x1fae1d[_0x40e8('0x1f')]+_0x1fae1d['limit'];var _0x1fbb10;if(_0x1c264c>=_0x25a3dc){_0x1c264c=_0x25a3dc;_0x1fbb10=0xc8;}else{_0x1fbb10=0xce;}_0x543f8f[_0x40e8('0x19')](_0x1fbb10);return _0x543f8f[_0x40e8('0x20')](_0x40e8('0x21'),_0x5a04df+'-'+_0x1c264c+'/'+_0x25a3dc)[_0x40e8('0x1b')](_0x55104d);}return null;};}function patchUpdates(_0x4ce9f7){return function(_0x404a2c){try{jsonpatch['apply'](_0x404a2c,_0x4ce9f7,!![]);}catch(_0x411e94){return BPromise['reject'](_0x411e94);}return _0x404a2c['save']();};}function saveUpdates(_0x524333,_0x14e91b){return function(_0x5532e9){if(_0x5532e9){return _0x5532e9[_0x40e8('0x22')](_0x524333)[_0x40e8('0x23')](function(_0x124845){return _0x124845;});}return null;};}function removeEntity(_0x10eabc,_0x526106){return function(_0x4bec02){if(_0x4bec02){return _0x4bec02[_0x40e8('0x24')]()[_0x40e8('0x23')](function(){_0x10eabc['status'](0xcc)[_0x40e8('0x1a')]();});}};}function handleEntityNotFound(_0x1f672d,_0xb4b807){return function(_0x13126e){if(!_0x13126e){_0x1f672d[_0x40e8('0x18')](0x194);}return _0x13126e;};}function handleError(_0x25c9dd,_0x10eda7){_0x10eda7=_0x10eda7||0x1f4;return function(_0x120958){logger[_0x40e8('0x25')](_0x120958[_0x40e8('0x26')]);if(_0x120958[_0x40e8('0x27')]){delete _0x120958[_0x40e8('0x27')];}_0x25c9dd[_0x40e8('0x19')](_0x10eda7)[_0x40e8('0x28')](_0x120958);};}exports[_0x40e8('0x29')]=function(_0x5d248d,_0x3cdb61){var _0x10bed3={},_0x27ad15={},_0x12f994={'count':0x0,'rows':[]};var _0x45d926=_[_0x40e8('0x2a')](db['AnalyticTreeReport'][_0x40e8('0x2b')],function(_0x34b22a){return{'name':_0x34b22a[_0x40e8('0x2c')],'type':_0x34b22a['type'][_0x40e8('0x2d')]};});_0x27ad15[_0x40e8('0x2e')]=_['map'](_0x45d926,_0x40e8('0x27'));_0x27ad15[_0x40e8('0x2f')]=_['keys'](_0x5d248d[_0x40e8('0x2f')]);_0x27ad15[_0x40e8('0x30')]=_[_0x40e8('0x31')](_0x27ad15[_0x40e8('0x2e')],_0x27ad15[_0x40e8('0x2f')]);_0x10bed3['attributes']=_['intersection'](_0x27ad15[_0x40e8('0x2e')],qs[_0x40e8('0x32')](_0x5d248d[_0x40e8('0x2f')][_0x40e8('0x32')]));_0x10bed3[_0x40e8('0x33')]=_0x10bed3['attributes'][_0x40e8('0x34')]?_0x10bed3[_0x40e8('0x33')]:_0x27ad15[_0x40e8('0x2e')];if(!_0x5d248d[_0x40e8('0x2f')][_0x40e8('0x35')](_0x40e8('0x36'))){_0x10bed3[_0x40e8('0x1d')]=qs[_0x40e8('0x1d')](_0x5d248d[_0x40e8('0x2f')][_0x40e8('0x1d')]);_0x10bed3['offset']=qs[_0x40e8('0x1f')](_0x5d248d[_0x40e8('0x2f')][_0x40e8('0x1f')]);}_0x10bed3[_0x40e8('0x37')]=qs['sort'](_0x5d248d['query']['sort']);_0x10bed3[_0x40e8('0x38')]=qs['filters'](_['pick'](_0x5d248d[_0x40e8('0x2f')],_0x27ad15[_0x40e8('0x30')]),_0x45d926);if(_0x5d248d['query'][_0x40e8('0x39')]){_0x10bed3[_0x40e8('0x38')]=_[_0x40e8('0x3a')](_0x10bed3['where'],{'$or':_[_0x40e8('0x2a')](_0x45d926,function(_0x43e2f9){if(_0x43e2f9[_0x40e8('0x3b')]!=='VIRTUAL'){var _0x15fea2={};_0x15fea2[_0x43e2f9[_0x40e8('0x27')]]={'$like':'%'+_0x5d248d['query'][_0x40e8('0x39')]+'%'};return _0x15fea2;}})});}_0x10bed3=_['merge']({},_0x10bed3,_0x5d248d[_0x40e8('0x3c')]);var _0x517a98={'where':_0x10bed3['where']};return db[_0x40e8('0x3d')]['count'](_0x517a98)[_0x40e8('0x23')](function(_0x2494bb){_0x12f994[_0x40e8('0x1e')]=_0x2494bb;if(_0x5d248d['query'][_0x40e8('0x3e')]){_0x10bed3[_0x40e8('0x3f')]=[{'all':!![]}];}return db[_0x40e8('0x3d')]['findAll'](_0x10bed3);})[_0x40e8('0x23')](function(_0x4a78e8){_0x12f994[_0x40e8('0x40')]=_0x4a78e8;return _0x12f994;})[_0x40e8('0x23')](respondWithFilteredResult(_0x3cdb61,_0x10bed3))[_0x40e8('0x41')](handleError(_0x3cdb61,null));};exports[_0x40e8('0x42')]=function(_0x144165,_0x2b0fb2){var _0x49abd4={'raw':!![],'where':{'id':_0x144165[_0x40e8('0x43')]['id']}},_0x67f8cc={};_0x67f8cc[_0x40e8('0x2e')]=_['keys'](db[_0x40e8('0x3d')]['rawAttributes']);_0x67f8cc[_0x40e8('0x2f')]=_['keys'](_0x144165[_0x40e8('0x2f')]);_0x67f8cc['filters']=_[_0x40e8('0x31')](_0x67f8cc[_0x40e8('0x2e')],_0x67f8cc[_0x40e8('0x2f')]);_0x49abd4['attributes']=_[_0x40e8('0x31')](_0x67f8cc[_0x40e8('0x2e')],qs[_0x40e8('0x32')](_0x144165['query']['fields']));_0x49abd4[_0x40e8('0x33')]=_0x49abd4[_0x40e8('0x33')]['length']?_0x49abd4['attributes']:_0x67f8cc[_0x40e8('0x2e')];if(_0x144165[_0x40e8('0x2f')][_0x40e8('0x3e')]){_0x49abd4[_0x40e8('0x3f')]=[{'all':!![]}];}_0x49abd4=_[_0x40e8('0x3a')]({},_0x49abd4,_0x144165[_0x40e8('0x3c')]);return db[_0x40e8('0x3d')]['find'](_0x49abd4)['then'](handleEntityNotFound(_0x2b0fb2,null))['then'](respondWithResult(_0x2b0fb2,null))[_0x40e8('0x41')](handleError(_0x2b0fb2,null));};exports[_0x40e8('0x44')]=function(_0x39dc3d,_0x1e95f5){return db[_0x40e8('0x3d')][_0x40e8('0x44')](_0x39dc3d[_0x40e8('0x45')],{})[_0x40e8('0x23')](respondWithResult(_0x1e95f5,0xc9))[_0x40e8('0x41')](handleError(_0x1e95f5,null));};exports['update']=function(_0x3a6bcb,_0x4f23b8){if(_0x3a6bcb[_0x40e8('0x45')]['id']){delete _0x3a6bcb[_0x40e8('0x45')]['id'];}return db[_0x40e8('0x3d')]['find']({'where':{'id':_0x3a6bcb['params']['id']}})[_0x40e8('0x23')](handleEntityNotFound(_0x4f23b8,null))[_0x40e8('0x23')](saveUpdates(_0x3a6bcb[_0x40e8('0x45')],null))[_0x40e8('0x23')](respondWithResult(_0x4f23b8,null))['catch'](handleError(_0x4f23b8,null));};exports[_0x40e8('0x24')]=function(_0x1c1faa,_0x53c800){return db['AnalyticTreeReport'][_0x40e8('0x46')]({'where':{'id':_0x1c1faa[_0x40e8('0x43')]['id']}})[_0x40e8('0x23')](handleEntityNotFound(_0x53c800,null))['then'](removeEntity(_0x53c800,null))[_0x40e8('0x41')](handleError(_0x53c800,null));}; \ No newline at end of file +var _0x57dd=['query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','fields','length','create','body','params','destroy','find','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','key','model','keys'];(function(_0x39d381,_0x1b56fd){var _0x42b529=function(_0x5e7a79){while(--_0x5e7a79){_0x39d381['push'](_0x39d381['shift']());}};_0x42b529(++_0x1b56fd);}(_0x57dd,0x186));var _0xd57d=function(_0x3d0b5e,_0x42c004){_0x3d0b5e=_0x3d0b5e-0x0;var _0x274e50=_0x57dd[_0x3d0b5e];return _0x274e50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd57d('0x0'));var jsonpatch=require(_0xd57d('0x1'));var rp=require(_0xd57d('0x2'));var moment=require('moment');var BPromise=require(_0xd57d('0x3'));var Mustache=require(_0xd57d('0x4'));var util=require(_0xd57d('0x5'));var path=require('path');var sox=require(_0xd57d('0x6'));var csv=require(_0xd57d('0x7'));var ejs=require(_0xd57d('0x8'));var fs=require('fs');var fs_extra=require(_0xd57d('0x9'));var _=require('lodash');var squel=require(_0xd57d('0xa'));var crypto=require(_0xd57d('0xb'));var jsforce=require(_0xd57d('0xc'));var deskjs=require(_0xd57d('0xd'));var toCsv=require(_0xd57d('0x7'));var querystring=require('querystring');var Papa=require(_0xd57d('0xe'));var Redis=require(_0xd57d('0xf'));var authService=require(_0xd57d('0x10'));var qs=require(_0xd57d('0x11'));var as=require(_0xd57d('0x12'));var hardwareService=require(_0xd57d('0x13'));var logger=require('../../config/logger')(_0xd57d('0x14'));var utils=require('../../config/utils');var config=require(_0xd57d('0x15'));var licenseUtil=require(_0xd57d('0x16'));var db=require(_0xd57d('0x17'))['db'];function respondWithStatusCode(_0xfba75f,_0x1c9f9b){_0x1c9f9b=_0x1c9f9b||0xcc;return function(_0x2e87fb){if(_0x2e87fb){return _0xfba75f[_0xd57d('0x18')](_0x1c9f9b);}return _0xfba75f[_0xd57d('0x19')](_0x1c9f9b)['end']();};}function respondWithResult(_0x21d24b,_0x54e1cf){_0x54e1cf=_0x54e1cf||0xc8;return function(_0x728c3e){if(_0x728c3e){return _0x21d24b[_0xd57d('0x19')](_0x54e1cf)[_0xd57d('0x1a')](_0x728c3e);}};}function respondWithFilteredResult(_0x22e5bf,_0x973fc2){return function(_0x307bce){if(_0x307bce){var _0x2534f4=typeof _0x973fc2[_0xd57d('0x1b')]===_0xd57d('0x1c')&&typeof _0x973fc2[_0xd57d('0x1d')]===_0xd57d('0x1c');var _0x25b0af=_0x307bce[_0xd57d('0x1e')];var _0x34f325=_0x2534f4?0x0:_0x973fc2['offset'];var _0x5d7a37=_0x2534f4?_0x307bce[_0xd57d('0x1e')]:_0x973fc2[_0xd57d('0x1b')]+_0x973fc2[_0xd57d('0x1d')];var _0x3b3a20;if(_0x5d7a37>=_0x25b0af){_0x5d7a37=_0x25b0af;_0x3b3a20=0xc8;}else{_0x3b3a20=0xce;}_0x22e5bf[_0xd57d('0x19')](_0x3b3a20);return _0x22e5bf['set'](_0xd57d('0x1f'),_0x34f325+'-'+_0x5d7a37+'/'+_0x25b0af)[_0xd57d('0x1a')](_0x307bce);}return null;};}function patchUpdates(_0x1a8f45){return function(_0x20957a){try{jsonpatch[_0xd57d('0x20')](_0x20957a,_0x1a8f45,!![]);}catch(_0x464f84){return BPromise[_0xd57d('0x21')](_0x464f84);}return _0x20957a['save']();};}function saveUpdates(_0xff735d,_0x29a7a3){return function(_0x367a7e){if(_0x367a7e){return _0x367a7e[_0xd57d('0x22')](_0xff735d)[_0xd57d('0x23')](function(_0x618f52){return _0x618f52;});}return null;};}function removeEntity(_0x232ddd,_0x2d5c05){return function(_0x72e8ec){if(_0x72e8ec){return _0x72e8ec['destroy']()[_0xd57d('0x23')](function(){_0x232ddd[_0xd57d('0x19')](0xcc)[_0xd57d('0x24')]();});}};}function handleEntityNotFound(_0x2fefce,_0x1919bd){return function(_0x208995){if(!_0x208995){_0x2fefce[_0xd57d('0x18')](0x194);}return _0x208995;};}function handleError(_0x2bfd37,_0x2e94e6){_0x2e94e6=_0x2e94e6||0x1f4;return function(_0x35f5d5){logger[_0xd57d('0x25')](_0x35f5d5[_0xd57d('0x26')]);if(_0x35f5d5['name']){delete _0x35f5d5[_0xd57d('0x27')];}_0x2bfd37[_0xd57d('0x19')](_0x2e94e6)[_0xd57d('0x28')](_0x35f5d5);};}exports[_0xd57d('0x29')]=function(_0x51d01e,_0x5dca86){var _0x17bb9b={},_0x4d3b23={},_0x2b2606={'count':0x0,'rows':[]};var _0x4a8a53=_[_0xd57d('0x2a')](db[_0xd57d('0x2b')]['rawAttributes'],function(_0x492207){return{'name':_0x492207[_0xd57d('0x2c')],'type':_0x492207['type'][_0xd57d('0x2d')]};});_0x4d3b23[_0xd57d('0x2e')]=_[_0xd57d('0x2a')](_0x4a8a53,_0xd57d('0x27'));_0x4d3b23['query']=_[_0xd57d('0x2f')](_0x51d01e[_0xd57d('0x30')]);_0x4d3b23[_0xd57d('0x31')]=_['intersection'](_0x4d3b23[_0xd57d('0x2e')],_0x4d3b23[_0xd57d('0x30')]);_0x17bb9b['attributes']=_[_0xd57d('0x32')](_0x4d3b23['model'],qs['fields'](_0x51d01e[_0xd57d('0x30')]['fields']));_0x17bb9b[_0xd57d('0x33')]=_0x17bb9b[_0xd57d('0x33')]['length']?_0x17bb9b[_0xd57d('0x33')]:_0x4d3b23[_0xd57d('0x2e')];if(!_0x51d01e[_0xd57d('0x30')][_0xd57d('0x34')]('nolimit')){_0x17bb9b[_0xd57d('0x1d')]=qs[_0xd57d('0x1d')](_0x51d01e[_0xd57d('0x30')][_0xd57d('0x1d')]);_0x17bb9b[_0xd57d('0x1b')]=qs['offset'](_0x51d01e[_0xd57d('0x30')][_0xd57d('0x1b')]);}_0x17bb9b[_0xd57d('0x35')]=qs[_0xd57d('0x36')](_0x51d01e[_0xd57d('0x30')]['sort']);_0x17bb9b[_0xd57d('0x37')]=qs[_0xd57d('0x31')](_[_0xd57d('0x38')](_0x51d01e[_0xd57d('0x30')],_0x4d3b23[_0xd57d('0x31')]),_0x4a8a53);if(_0x51d01e[_0xd57d('0x30')][_0xd57d('0x39')]){_0x17bb9b[_0xd57d('0x37')]=_[_0xd57d('0x3a')](_0x17bb9b[_0xd57d('0x37')],{'$or':_[_0xd57d('0x2a')](_0x4a8a53,function(_0x47be4a){if(_0x47be4a[_0xd57d('0x3b')]!=='VIRTUAL'){var _0x961e36={};_0x961e36[_0x47be4a[_0xd57d('0x27')]]={'$like':'%'+_0x51d01e[_0xd57d('0x30')][_0xd57d('0x39')]+'%'};return _0x961e36;}})});}_0x17bb9b=_[_0xd57d('0x3a')]({},_0x17bb9b,_0x51d01e[_0xd57d('0x3c')]);var _0x338697={'where':_0x17bb9b[_0xd57d('0x37')]};return db[_0xd57d('0x2b')][_0xd57d('0x1e')](_0x338697)[_0xd57d('0x23')](function(_0x30b220){_0x2b2606[_0xd57d('0x1e')]=_0x30b220;if(_0x51d01e[_0xd57d('0x30')][_0xd57d('0x3d')]){_0x17bb9b[_0xd57d('0x3e')]=[{'all':!![]}];}return db[_0xd57d('0x2b')][_0xd57d('0x3f')](_0x17bb9b);})['then'](function(_0x4c1116){_0x2b2606[_0xd57d('0x40')]=_0x4c1116;return _0x2b2606;})['then'](respondWithFilteredResult(_0x5dca86,_0x17bb9b))[_0xd57d('0x41')](handleError(_0x5dca86,null));};exports['show']=function(_0x2ea787,_0x3007ce){var _0x5243a0={'raw':!![],'where':{'id':_0x2ea787['params']['id']}},_0x4782dc={};_0x4782dc[_0xd57d('0x2e')]=_[_0xd57d('0x2f')](db[_0xd57d('0x2b')]['rawAttributes']);_0x4782dc['query']=_[_0xd57d('0x2f')](_0x2ea787[_0xd57d('0x30')]);_0x4782dc[_0xd57d('0x31')]=_['intersection'](_0x4782dc['model'],_0x4782dc['query']);_0x5243a0[_0xd57d('0x33')]=_[_0xd57d('0x32')](_0x4782dc[_0xd57d('0x2e')],qs[_0xd57d('0x42')](_0x2ea787[_0xd57d('0x30')]['fields']));_0x5243a0[_0xd57d('0x33')]=_0x5243a0[_0xd57d('0x33')][_0xd57d('0x43')]?_0x5243a0['attributes']:_0x4782dc[_0xd57d('0x2e')];if(_0x2ea787[_0xd57d('0x30')][_0xd57d('0x3d')]){_0x5243a0[_0xd57d('0x3e')]=[{'all':!![]}];}_0x5243a0=_[_0xd57d('0x3a')]({},_0x5243a0,_0x2ea787[_0xd57d('0x3c')]);return db[_0xd57d('0x2b')]['find'](_0x5243a0)[_0xd57d('0x23')](handleEntityNotFound(_0x3007ce,null))['then'](respondWithResult(_0x3007ce,null))[_0xd57d('0x41')](handleError(_0x3007ce,null));};exports[_0xd57d('0x44')]=function(_0x342cee,_0x1195bc){return db[_0xd57d('0x2b')][_0xd57d('0x44')](_0x342cee[_0xd57d('0x45')],{})['then'](respondWithResult(_0x1195bc,0xc9))['catch'](handleError(_0x1195bc,null));};exports[_0xd57d('0x22')]=function(_0x2ba2dc,_0x53f440){if(_0x2ba2dc['body']['id']){delete _0x2ba2dc[_0xd57d('0x45')]['id'];}return db[_0xd57d('0x2b')]['find']({'where':{'id':_0x2ba2dc[_0xd57d('0x46')]['id']}})[_0xd57d('0x23')](handleEntityNotFound(_0x53f440,null))[_0xd57d('0x23')](saveUpdates(_0x2ba2dc[_0xd57d('0x45')],null))['then'](respondWithResult(_0x53f440,null))['catch'](handleError(_0x53f440,null));};exports[_0xd57d('0x47')]=function(_0xacfaa4,_0x1d5020){return db['AnalyticTreeReport'][_0xd57d('0x48')]({'where':{'id':_0xacfaa4['params']['id']}})[_0xd57d('0x23')](handleEntityNotFound(_0x1d5020,null))[_0xd57d('0x23')](removeEntity(_0x1d5020,null))[_0xd57d('0x41')](handleError(_0x1d5020,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index fe868af..e4981a7 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 _0xd8d8=['api','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util'];(function(_0x2859bb,_0x3dd473){var _0x477110=function(_0xe4e169){while(--_0xe4e169){_0x2859bb['push'](_0x2859bb['shift']());}};_0x477110(++_0x3dd473);}(_0xd8d8,0xdb));var _0x8d8d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd8d8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x8d8d('0x0'));var logger=require('../../config/logger')(_0x8d8d('0x1'));var moment=require('moment');var BPromise=require(_0x8d8d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d8d('0x3'));var rimraf=require(_0x8d8d('0x4'));var config=require(_0x8d8d('0x5'));var attributes=require(_0x8d8d('0x6'));module[_0x8d8d('0x7')]=function(_0x52c823,_0x23d8d4){return _0x52c823[_0x8d8d('0x8')](_0x8d8d('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce9b=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0xce9b,0x161));var _0xbce9=function(_0x285471,_0x459f2c){_0x285471=_0x285471-0x0;var _0x419a80=_0xce9b[_0x285471];return _0x419a80;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var logger=require(_0xbce9('0x2'))(_0xbce9('0x3'));var moment=require(_0xbce9('0x4'));var BPromise=require(_0xbce9('0x5'));var rp=require(_0xbce9('0x6'));var fs=require('fs');var path=require(_0xbce9('0x7'));var rimraf=require(_0xbce9('0x8'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0xbce9('0x9')]=function(_0xabb3be,_0x492687){return _0xabb3be[_0xbce9('0xa')](_0xbce9('0xb'),attributes,{'tableName':_0xbce9('0xc'),'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 040b6ee..ac1c0c7 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4247e5,_0x30b7bb){var _0x5ee3d5=function(_0x5056cd){while(--_0x5056cd){_0x4247e5['push'](_0x4247e5['shift']());}};_0x5ee3d5(++_0x30b7bb);}(_0xadb5,0xad));var _0x5adb=function(_0x5e1029,_0xc7cc71){_0x5e1029=_0x5e1029-0x0;var _0xb06136=_0xadb5[_0x5e1029];return _0xb06136;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x6b475b,_0x3b9f10){var _0x472550=function(_0x3af4f2){while(--_0x3af4f2){_0x6b475b['push'](_0x6b475b['shift']());}};_0x472550(++_0x3b9f10);}(_0x2ef3,0xba));var _0x32ef=function(_0x22ad81,_0x328bca){_0x22ad81=_0x22ad81-0x0;var _0x5f0a47=_0x2ef3[_0x22ad81];return _0x5f0a47;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 2ee1ada..5cd6a4c 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 _0xb64f=['isAuthenticated','index','show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3cfc96,_0x4a9b0b){var _0x3b5b7c=function(_0x54e966){while(--_0x54e966){_0x3cfc96['push'](_0x3cfc96['shift']());}};_0x3b5b7c(++_0x4a9b0b);}(_0xb64f,0x1a6));var _0xfb64=function(_0x2077be,_0x26136a){_0x2077be=_0x2077be-0x0;var _0x198bbf=_0xb64f[_0x2077be];return _0x198bbf;};'use strict';var multer=require('multer');var util=require(_0xfb64('0x0'));var path=require(_0xfb64('0x1'));var timeout=require(_0xfb64('0x2'));var express=require(_0xfb64('0x3'));var router=express[_0xfb64('0x4')]();var fs_extra=require(_0xfb64('0x5'));var auth=require(_0xfb64('0x6'));var interaction=require(_0xfb64('0x7'));var config=require(_0xfb64('0x8'));var controller=require('./analyticTreeReport.controller');router[_0xfb64('0x9')]('/',auth[_0xfb64('0xa')](),controller[_0xfb64('0xb')]);router[_0xfb64('0x9')]('/:id',auth[_0xfb64('0xa')](),controller[_0xfb64('0xc')]);router['post']('/',auth[_0xfb64('0xa')](),controller[_0xfb64('0xd')]);router[_0xfb64('0xe')](_0xfb64('0xf'),auth[_0xfb64('0xa')](),controller[_0xfb64('0x10')]);router[_0xfb64('0x11')](_0xfb64('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x408c=['isAuthenticated','show','create','put','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x397017,_0x40fdfd){var _0x58a0d1=function(_0x4bd681){while(--_0x4bd681){_0x397017['push'](_0x397017['shift']());}};_0x58a0d1(++_0x40fdfd);}(_0x408c,0x1e7));var _0xc408=function(_0x3ab5cb,_0x5b9e3d){_0x3ab5cb=_0x3ab5cb-0x0;var _0x46facb=_0x408c[_0x3ab5cb];return _0x46facb;};'use strict';var multer=require('multer');var util=require(_0xc408('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc408('0x1'));var router=express[_0xc408('0x2')]();var fs_extra=require(_0xc408('0x3'));var auth=require(_0xc408('0x4'));var interaction=require(_0xc408('0x5'));var config=require(_0xc408('0x6'));var controller=require('./analyticTreeReport.controller');router[_0xc408('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc408('0x8'),auth[_0xc408('0x9')](),controller[_0xc408('0xa')]);router['post']('/',auth[_0xc408('0x9')](),controller[_0xc408('0xb')]);router[_0xc408('0xc')]('/:id',auth[_0xc408('0x9')](),controller[_0xc408('0xd')]);router[_0xc408('0xe')](_0xc408('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xc408('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 84ba3e6..89ff408 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 _0xbed7=['STRING','sequelize','exports'];(function(_0x312cdb,_0x181ba2){var _0x2e1e2e=function(_0x1e8115){while(--_0x1e8115){_0x312cdb['push'](_0x312cdb['shift']());}};_0x2e1e2e(++_0x181ba2);}(_0xbed7,0x14b));var _0x7bed=function(_0x5e096c,_0x2ebcb9){_0x5e096c=_0x5e096c-0x0;var _0x78ab6c=_0xbed7[_0x5e096c];return _0x78ab6c;};'use strict';var Sequelize=require(_0x7bed('0x0'));module[_0x7bed('0x1')]={'name':{'type':Sequelize[_0x7bed('0x2')]},'basename':{'type':Sequelize[_0x7bed('0x2')]},'type':{'type':Sequelize[_0x7bed('0x2')]}}; \ No newline at end of file +var _0xc818=['sequelize','exports','STRING'];(function(_0x364779,_0x1e70a1){var _0x243d94=function(_0xde1cba){while(--_0xde1cba){_0x364779['push'](_0x364779['shift']());}};_0x243d94(++_0x1e70a1);}(_0xc818,0x1e3));var _0x8c81=function(_0x24cecc,_0x29b88b){_0x24cecc=_0x24cecc-0x0;var _0x3b9e78=_0xc818[_0x24cecc];return _0x3b9e78;};'use strict';var Sequelize=require(_0x8c81('0x0'));module[_0x8c81('0x1')]={'name':{'type':Sequelize[_0x8c81('0x2')]},'basename':{'type':Sequelize[_0x8c81('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1c1ec97..dbd065e 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 _0xdd36=['map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xdd36,0xe7));var _0x6dd3=function(_0x389b1a,_0x155431){_0x389b1a=_0x389b1a-0x0;var _0x1e035a=_0xdd36[_0x389b1a];return _0x1e035a;};'use strict';var emlformat=require(_0x6dd3('0x0'));var rimraf=require(_0x6dd3('0x1'));var zipdir=require(_0x6dd3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dd3('0x3'));var moment=require(_0x6dd3('0x4'));var BPromise=require(_0x6dd3('0x5'));var Mustache=require(_0x6dd3('0x6'));var util=require(_0x6dd3('0x7'));var path=require(_0x6dd3('0x8'));var sox=require(_0x6dd3('0x9'));var csv=require(_0x6dd3('0xa'));var ejs=require(_0x6dd3('0xb'));var fs=require('fs');var fs_extra=require(_0x6dd3('0xc'));var _=require(_0x6dd3('0xd'));var squel=require(_0x6dd3('0xe'));var crypto=require('crypto');var jsforce=require(_0x6dd3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6dd3('0xa'));var querystring=require(_0x6dd3('0x10'));var Papa=require(_0x6dd3('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6dd3('0x12'));var as=require(_0x6dd3('0x13'));var hardwareService=require(_0x6dd3('0x14'));var logger=require(_0x6dd3('0x15'))(_0x6dd3('0x16'));var utils=require(_0x6dd3('0x17'));var config=require(_0x6dd3('0x18'));var licenseUtil=require(_0x6dd3('0x19'));var db=require(_0x6dd3('0x1a'))['db'];function respondWithStatusCode(_0x13ca0b,_0x54e006){_0x54e006=_0x54e006||0xcc;return function(_0x38bf61){if(_0x38bf61){return _0x13ca0b[_0x6dd3('0x1b')](_0x54e006);}return _0x13ca0b[_0x6dd3('0x1c')](_0x54e006)[_0x6dd3('0x1d')]();};}function respondWithResult(_0x5811d9,_0x59d946){_0x59d946=_0x59d946||0xc8;return function(_0x52d904){if(_0x52d904){return _0x5811d9[_0x6dd3('0x1c')](_0x59d946)[_0x6dd3('0x1e')](_0x52d904);}};}function respondWithFilteredResult(_0x1a187d,_0x42a91a){return function(_0x57a7b7){if(_0x57a7b7){var _0x2f0add=typeof _0x42a91a[_0x6dd3('0x1f')]==='undefined'&&typeof _0x42a91a[_0x6dd3('0x20')]===_0x6dd3('0x21');var _0x55be36=_0x57a7b7[_0x6dd3('0x22')];var _0x398450=_0x2f0add?0x0:_0x42a91a[_0x6dd3('0x1f')];var _0x2d1646=_0x2f0add?_0x57a7b7[_0x6dd3('0x22')]:_0x42a91a['offset']+_0x42a91a[_0x6dd3('0x20')];var _0x128fc5;if(_0x2d1646>=_0x55be36){_0x2d1646=_0x55be36;_0x128fc5=0xc8;}else{_0x128fc5=0xce;}_0x1a187d[_0x6dd3('0x1c')](_0x128fc5);return _0x1a187d[_0x6dd3('0x23')](_0x6dd3('0x24'),_0x398450+'-'+_0x2d1646+'/'+_0x55be36)[_0x6dd3('0x1e')](_0x57a7b7);}return null;};}function patchUpdates(_0x3b0772){return function(_0x9808a0){try{jsonpatch[_0x6dd3('0x25')](_0x9808a0,_0x3b0772,!![]);}catch(_0x184588){return BPromise[_0x6dd3('0x26')](_0x184588);}return _0x9808a0[_0x6dd3('0x27')]();};}function saveUpdates(_0x1962ee,_0x28d67d){return function(_0x54b21d){if(_0x54b21d){return _0x54b21d[_0x6dd3('0x28')](_0x1962ee)['then'](function(_0x1c6b96){return _0x1c6b96;});}return null;};}function removeEntity(_0x1d6282,_0x4fe6b3){return function(_0x5b54c6){if(_0x5b54c6){return _0x5b54c6[_0x6dd3('0x29')]()[_0x6dd3('0x2a')](function(){_0x1d6282[_0x6dd3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21d2ed,_0x381066){return function(_0x35fd9b){if(!_0x35fd9b){_0x21d2ed[_0x6dd3('0x1b')](0x194);}return _0x35fd9b;};}function handleError(_0x2c2649,_0x3a0717){_0x3a0717=_0x3a0717||0x1f4;return function(_0x199b8a){logger[_0x6dd3('0x2b')](_0x199b8a[_0x6dd3('0x2c')]);if(_0x199b8a[_0x6dd3('0x2d')]){delete _0x199b8a['name'];}_0x2c2649[_0x6dd3('0x1c')](_0x3a0717)[_0x6dd3('0x2e')](_0x199b8a);};}exports[_0x6dd3('0x2f')]=function(_0x271418,_0x498510){var _0x11e703={},_0x1089f0={},_0xe25d87={'count':0x0,'rows':[]};var _0xedc8c4=_[_0x6dd3('0x30')](db[_0x6dd3('0x31')][_0x6dd3('0x32')],function(_0x55841d){return{'name':_0x55841d[_0x6dd3('0x33')],'type':_0x55841d[_0x6dd3('0x34')][_0x6dd3('0x35')]};});_0x1089f0[_0x6dd3('0x36')]=_[_0x6dd3('0x30')](_0xedc8c4,_0x6dd3('0x2d'));_0x1089f0[_0x6dd3('0x37')]=_[_0x6dd3('0x38')](_0x271418[_0x6dd3('0x37')]);_0x1089f0['filters']=_[_0x6dd3('0x39')](_0x1089f0[_0x6dd3('0x36')],_0x1089f0[_0x6dd3('0x37')]);_0x11e703[_0x6dd3('0x3a')]=_[_0x6dd3('0x39')](_0x1089f0['model'],qs[_0x6dd3('0x3b')](_0x271418['query'][_0x6dd3('0x3b')]));_0x11e703['attributes']=_0x11e703[_0x6dd3('0x3a')][_0x6dd3('0x3c')]?_0x11e703['attributes']:_0x1089f0[_0x6dd3('0x36')];if(!_0x271418[_0x6dd3('0x37')]['hasOwnProperty']('nolimit')){_0x11e703[_0x6dd3('0x20')]=qs[_0x6dd3('0x20')](_0x271418[_0x6dd3('0x37')][_0x6dd3('0x20')]);_0x11e703[_0x6dd3('0x1f')]=qs['offset'](_0x271418[_0x6dd3('0x37')][_0x6dd3('0x1f')]);}_0x11e703[_0x6dd3('0x3d')]=qs[_0x6dd3('0x3e')](_0x271418[_0x6dd3('0x37')][_0x6dd3('0x3e')]);_0x11e703[_0x6dd3('0x3f')]=qs[_0x6dd3('0x40')](_[_0x6dd3('0x41')](_0x271418[_0x6dd3('0x37')],_0x1089f0[_0x6dd3('0x40')]),_0xedc8c4);if(_0x271418[_0x6dd3('0x37')][_0x6dd3('0x42')]){_0x11e703[_0x6dd3('0x3f')]=_[_0x6dd3('0x43')](_0x11e703[_0x6dd3('0x3f')],{'$or':_[_0x6dd3('0x30')](_0xedc8c4,function(_0x305a8){if(_0x305a8[_0x6dd3('0x34')]!==_0x6dd3('0x44')){var _0x2d47ce={};_0x2d47ce[_0x305a8[_0x6dd3('0x2d')]]={'$like':'%'+_0x271418[_0x6dd3('0x37')]['filter']+'%'};return _0x2d47ce;}})});}_0x11e703=_[_0x6dd3('0x43')]({},_0x11e703,_0x271418[_0x6dd3('0x45')]);var _0x5381cd={'where':_0x11e703[_0x6dd3('0x3f')]};return db[_0x6dd3('0x31')][_0x6dd3('0x22')](_0x5381cd)[_0x6dd3('0x2a')](function(_0x4f0f0f){_0xe25d87[_0x6dd3('0x22')]=_0x4f0f0f;if(_0x271418[_0x6dd3('0x37')][_0x6dd3('0x46')]){_0x11e703[_0x6dd3('0x47')]=[{'all':!![]}];}return db[_0x6dd3('0x31')][_0x6dd3('0x48')](_0x11e703);})[_0x6dd3('0x2a')](function(_0x4e7e51){_0xe25d87['rows']=_0x4e7e51;return _0xe25d87;})[_0x6dd3('0x2a')](respondWithFilteredResult(_0x498510,_0x11e703))[_0x6dd3('0x49')](handleError(_0x498510,null));};exports[_0x6dd3('0x4a')]=function(_0x56c3c6,_0x51cdc6){var _0x5b706f={'raw':!![],'where':{'id':_0x56c3c6[_0x6dd3('0x4b')]['id']}},_0x5abc81={};_0x5abc81[_0x6dd3('0x36')]=_[_0x6dd3('0x38')](db[_0x6dd3('0x31')][_0x6dd3('0x32')]);_0x5abc81[_0x6dd3('0x37')]=_[_0x6dd3('0x38')](_0x56c3c6[_0x6dd3('0x37')]);_0x5abc81['filters']=_[_0x6dd3('0x39')](_0x5abc81[_0x6dd3('0x36')],_0x5abc81[_0x6dd3('0x37')]);_0x5b706f[_0x6dd3('0x3a')]=_[_0x6dd3('0x39')](_0x5abc81[_0x6dd3('0x36')],qs[_0x6dd3('0x3b')](_0x56c3c6[_0x6dd3('0x37')][_0x6dd3('0x3b')]));_0x5b706f[_0x6dd3('0x3a')]=_0x5b706f[_0x6dd3('0x3a')][_0x6dd3('0x3c')]?_0x5b706f['attributes']:_0x5abc81[_0x6dd3('0x36')];if(_0x56c3c6[_0x6dd3('0x37')][_0x6dd3('0x46')]){_0x5b706f['include']=[{'all':!![]}];}_0x5b706f=_[_0x6dd3('0x43')]({},_0x5b706f,_0x56c3c6[_0x6dd3('0x45')]);return db[_0x6dd3('0x31')][_0x6dd3('0x4c')](_0x5b706f)[_0x6dd3('0x2a')](handleEntityNotFound(_0x51cdc6,null))[_0x6dd3('0x2a')](respondWithResult(_0x51cdc6,null))[_0x6dd3('0x49')](handleError(_0x51cdc6,null));};exports['clone']=function(_0x1b3842,_0x16281d){var _0x81d607={'where':{'id':_0x1b3842[_0x6dd3('0x4b')]['id']}},_0x467c28={};_0x467c28['model']=_[_0x6dd3('0x38')](db['Attachment'][_0x6dd3('0x32')]);_0x81d607[_0x6dd3('0x3a')]=_['intersection'](_0x467c28[_0x6dd3('0x36')],qs['fields'](_0x1b3842[_0x6dd3('0x37')]['fields']));_0x81d607[_0x6dd3('0x3a')]=_0x81d607['attributes'][_0x6dd3('0x3c')]?_0x81d607[_0x6dd3('0x3a')]:_0x467c28[_0x6dd3('0x36')];if(_0x1b3842[_0x6dd3('0x37')][_0x6dd3('0x46')]){_0x81d607[_0x6dd3('0x47')]=[{'all':!![]}];}_0x81d607=_[_0x6dd3('0x43')]({},_0x81d607,_0x1b3842[_0x6dd3('0x45')]);return db[_0x6dd3('0x31')][_0x6dd3('0x4c')](_0x81d607)[_0x6dd3('0x2a')](handleEntityNotFound(_0x16281d,null))[_0x6dd3('0x2a')](function(_0x40889c){if(_0x40889c){var _0x310e98=_0x40889c[_0x6dd3('0x4d')]({'plain':!![]});_0x310e98=qs[_0x6dd3('0x4e')](_0x310e98,['id',_0x6dd3('0x4f'),_0x6dd3('0x50')]);_0x1b3842[_0x6dd3('0x51')]=_[_0x6dd3('0x4e')](_0x1b3842['body'],['id',_0x6dd3('0x4f'),'updatedAt']);return db[_0x6dd3('0x31')][_0x6dd3('0x52')](_[_0x6dd3('0x43')](_0x310e98,_0x1b3842[_0x6dd3('0x51')]),{'include':_0x1b3842[_0x6dd3('0x37')][_0x6dd3('0x46')]?[{'all':!![]}]:undefined});}})[_0x6dd3('0x2a')](respondWithResult(_0x16281d,0xc9))['catch'](handleError(_0x16281d,null));};exports[_0x6dd3('0x28')]=function(_0x596bb4,_0x30713c){if(_0x596bb4[_0x6dd3('0x51')]['id']){delete _0x596bb4[_0x6dd3('0x51')]['id'];}return db[_0x6dd3('0x31')]['find']({'where':{'id':_0x596bb4['params']['id']}})[_0x6dd3('0x2a')](handleEntityNotFound(_0x30713c,null))[_0x6dd3('0x2a')](saveUpdates(_0x596bb4[_0x6dd3('0x51')],null))[_0x6dd3('0x2a')](respondWithResult(_0x30713c,null))[_0x6dd3('0x49')](handleError(_0x30713c,null));};exports[_0x6dd3('0x29')]=function(_0x155074,_0x4396ea){return db[_0x6dd3('0x31')]['find']({'where':{'id':_0x155074[_0x6dd3('0x4b')]['id']}})[_0x6dd3('0x2a')](handleEntityNotFound(_0x4396ea,null))[_0x6dd3('0x2a')](removeEntity(_0x4396ea,null))[_0x6dd3('0x49')](handleError(_0x4396ea,null));};exports['create']=function(_0x4c6fac,_0x5b7337,_0x222753){_0x4c6fac['body'][_0x6dd3('0x2d')]=_0x4c6fac[_0x6dd3('0x53')][_0x6dd3('0x54')];_0x4c6fac[_0x6dd3('0x51')][_0x6dd3('0x55')]=_0x4c6fac[_0x6dd3('0x53')]['filename'];_0x4c6fac[_0x6dd3('0x51')][_0x6dd3('0x34')]=_0x4c6fac[_0x6dd3('0x53')][_0x6dd3('0x56')];return db[_0x6dd3('0x31')][_0x6dd3('0x52')](_0x4c6fac[_0x6dd3('0x51')])[_0x6dd3('0x2a')](respondWithResult(_0x5b7337,0xc9))[_0x6dd3('0x49')](handleError(_0x5b7337,null));};exports['download']=function(_0x5716fd,_0x495af7,_0x2b1109){return db['Attachment'][_0x6dd3('0x57')]({'where':{'id':_0x5716fd[_0x6dd3('0x4b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x495af7,null))[_0x6dd3('0x2a')](function(_0x38ded8){if(_0x38ded8){var _0x4f9ac1=_0x38ded8[_0x6dd3('0x58')]!==null;var _0x3e3653=path[_0x6dd3('0x59')](config[_0x6dd3('0x5a')],_0x6dd3('0x5b'));if(_0x4f9ac1){_0x3e3653=path[_0x6dd3('0x59')](_0x3e3653,'offline-chat/');}var _0x3e888b=path['join'](_0x3e3653,_0x38ded8[_0x6dd3('0x55')]);return _0x495af7[_0x6dd3('0x5c')](_0x3e888b);}})[_0x6dd3('0x49')](handleError(_0x495af7,null));}; \ No newline at end of file +var _0xacfa=['createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','download','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','status','offset','undefined','count','limit','set','apply','save','update','destroy','stack','name','send','Attachment','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','params','length','clone','find','get'];(function(_0x247d6d,_0x26be90){var _0x2e56f4=function(_0x365e10){while(--_0x365e10){_0x247d6d['push'](_0x247d6d['shift']());}};_0x2e56f4(++_0x26be90);}(_0xacfa,0x1bd));var _0xaacf=function(_0x124817,_0x1888f2){_0x124817=_0x124817-0x0;var _0x1d80a9=_0xacfa[_0x124817];return _0x1d80a9;};'use strict';var emlformat=require(_0xaacf('0x0'));var rimraf=require(_0xaacf('0x1'));var zipdir=require(_0xaacf('0x2'));var jsonpatch=require(_0xaacf('0x3'));var rp=require(_0xaacf('0x4'));var moment=require(_0xaacf('0x5'));var BPromise=require(_0xaacf('0x6'));var Mustache=require('mustache');var util=require(_0xaacf('0x7'));var path=require(_0xaacf('0x8'));var sox=require(_0xaacf('0x9'));var csv=require(_0xaacf('0xa'));var ejs=require(_0xaacf('0xb'));var fs=require('fs');var fs_extra=require(_0xaacf('0xc'));var _=require('lodash');var squel=require(_0xaacf('0xd'));var crypto=require(_0xaacf('0xe'));var jsforce=require(_0xaacf('0xf'));var deskjs=require(_0xaacf('0x10'));var toCsv=require(_0xaacf('0xa'));var querystring=require(_0xaacf('0x11'));var Papa=require(_0xaacf('0x12'));var Redis=require(_0xaacf('0x13'));var authService=require(_0xaacf('0x14'));var qs=require(_0xaacf('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaacf('0x16'))(_0xaacf('0x17'));var utils=require(_0xaacf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x344ec5,_0x4d2edf){_0x4d2edf=_0x4d2edf||0xcc;return function(_0x344520){if(_0x344520){return _0x344ec5[_0xaacf('0x19')](_0x4d2edf);}return _0x344ec5['status'](_0x4d2edf)[_0xaacf('0x1a')]();};}function respondWithResult(_0x4d7d3d,_0x5551bc){_0x5551bc=_0x5551bc||0xc8;return function(_0x39afad){if(_0x39afad){return _0x4d7d3d[_0xaacf('0x1b')](_0x5551bc)['json'](_0x39afad);}};}function respondWithFilteredResult(_0x2bacbc,_0xd9d502){return function(_0x1b2a4a){if(_0x1b2a4a){var _0x341fd5=typeof _0xd9d502[_0xaacf('0x1c')]==='undefined'&&typeof _0xd9d502['limit']===_0xaacf('0x1d');var _0x4fbabb=_0x1b2a4a[_0xaacf('0x1e')];var _0x53b12b=_0x341fd5?0x0:_0xd9d502['offset'];var _0x29bd38=_0x341fd5?_0x1b2a4a['count']:_0xd9d502[_0xaacf('0x1c')]+_0xd9d502[_0xaacf('0x1f')];var _0x2ae06a;if(_0x29bd38>=_0x4fbabb){_0x29bd38=_0x4fbabb;_0x2ae06a=0xc8;}else{_0x2ae06a=0xce;}_0x2bacbc[_0xaacf('0x1b')](_0x2ae06a);return _0x2bacbc[_0xaacf('0x20')]('Content-Range',_0x53b12b+'-'+_0x29bd38+'/'+_0x4fbabb)['json'](_0x1b2a4a);}return null;};}function patchUpdates(_0x4ff008){return function(_0x3e7bd9){try{jsonpatch[_0xaacf('0x21')](_0x3e7bd9,_0x4ff008,!![]);}catch(_0x4ddfea){return BPromise['reject'](_0x4ddfea);}return _0x3e7bd9[_0xaacf('0x22')]();};}function saveUpdates(_0x5c10a0,_0x314cfb){return function(_0x813a9e){if(_0x813a9e){return _0x813a9e[_0xaacf('0x23')](_0x5c10a0)['then'](function(_0x30e197){return _0x30e197;});}return null;};}function removeEntity(_0x349a31,_0x2445ec){return function(_0x160173){if(_0x160173){return _0x160173[_0xaacf('0x24')]()['then'](function(){_0x349a31[_0xaacf('0x1b')](0xcc)[_0xaacf('0x1a')]();});}};}function handleEntityNotFound(_0x9071fc,_0x3e5496){return function(_0x235979){if(!_0x235979){_0x9071fc[_0xaacf('0x19')](0x194);}return _0x235979;};}function handleError(_0x4b6a1a,_0x5049de){_0x5049de=_0x5049de||0x1f4;return function(_0x1baa47){logger['error'](_0x1baa47[_0xaacf('0x25')]);if(_0x1baa47[_0xaacf('0x26')]){delete _0x1baa47[_0xaacf('0x26')];}_0x4b6a1a[_0xaacf('0x1b')](_0x5049de)[_0xaacf('0x27')](_0x1baa47);};}exports['index']=function(_0x4a2ea4,_0x282c0c){var _0x1eacf9={},_0x127221={},_0x71ac1b={'count':0x0,'rows':[]};var _0x2eeaa0=_['map'](db[_0xaacf('0x28')][_0xaacf('0x29')],function(_0x570a43){return{'name':_0x570a43[_0xaacf('0x2a')],'type':_0x570a43['type'][_0xaacf('0x2b')]};});_0x127221[_0xaacf('0x2c')]=_[_0xaacf('0x2d')](_0x2eeaa0,_0xaacf('0x26'));_0x127221['query']=_[_0xaacf('0x2e')](_0x4a2ea4[_0xaacf('0x2f')]);_0x127221[_0xaacf('0x30')]=_[_0xaacf('0x31')](_0x127221[_0xaacf('0x2c')],_0x127221['query']);_0x1eacf9[_0xaacf('0x32')]=_[_0xaacf('0x31')](_0x127221[_0xaacf('0x2c')],qs[_0xaacf('0x33')](_0x4a2ea4[_0xaacf('0x2f')][_0xaacf('0x33')]));_0x1eacf9['attributes']=_0x1eacf9[_0xaacf('0x32')]['length']?_0x1eacf9['attributes']:_0x127221[_0xaacf('0x2c')];if(!_0x4a2ea4[_0xaacf('0x2f')][_0xaacf('0x34')](_0xaacf('0x35'))){_0x1eacf9['limit']=qs[_0xaacf('0x1f')](_0x4a2ea4['query'][_0xaacf('0x1f')]);_0x1eacf9['offset']=qs[_0xaacf('0x1c')](_0x4a2ea4[_0xaacf('0x2f')]['offset']);}_0x1eacf9['order']=qs[_0xaacf('0x36')](_0x4a2ea4[_0xaacf('0x2f')]['sort']);_0x1eacf9[_0xaacf('0x37')]=qs[_0xaacf('0x30')](_['pick'](_0x4a2ea4[_0xaacf('0x2f')],_0x127221[_0xaacf('0x30')]),_0x2eeaa0);if(_0x4a2ea4[_0xaacf('0x2f')][_0xaacf('0x38')]){_0x1eacf9[_0xaacf('0x37')]=_[_0xaacf('0x39')](_0x1eacf9[_0xaacf('0x37')],{'$or':_[_0xaacf('0x2d')](_0x2eeaa0,function(_0x37d3fa){if(_0x37d3fa[_0xaacf('0x3a')]!==_0xaacf('0x3b')){var _0x283f7f={};_0x283f7f[_0x37d3fa['name']]={'$like':'%'+_0x4a2ea4['query']['filter']+'%'};return _0x283f7f;}})});}_0x1eacf9=_['merge']({},_0x1eacf9,_0x4a2ea4[_0xaacf('0x3c')]);var _0xe008e7={'where':_0x1eacf9[_0xaacf('0x37')]};return db['Attachment'][_0xaacf('0x1e')](_0xe008e7)[_0xaacf('0x3d')](function(_0x3c62d7){_0x71ac1b['count']=_0x3c62d7;if(_0x4a2ea4[_0xaacf('0x2f')][_0xaacf('0x3e')]){_0x1eacf9['include']=[{'all':!![]}];}return db[_0xaacf('0x28')][_0xaacf('0x3f')](_0x1eacf9);})[_0xaacf('0x3d')](function(_0x3dc0ee){_0x71ac1b[_0xaacf('0x40')]=_0x3dc0ee;return _0x71ac1b;})[_0xaacf('0x3d')](respondWithFilteredResult(_0x282c0c,_0x1eacf9))[_0xaacf('0x41')](handleError(_0x282c0c,null));};exports['show']=function(_0x1a9de7,_0x64cf93){var _0x3f2a0d={'raw':!![],'where':{'id':_0x1a9de7[_0xaacf('0x42')]['id']}},_0x3c0c20={};_0x3c0c20[_0xaacf('0x2c')]=_[_0xaacf('0x2e')](db[_0xaacf('0x28')][_0xaacf('0x29')]);_0x3c0c20[_0xaacf('0x2f')]=_[_0xaacf('0x2e')](_0x1a9de7[_0xaacf('0x2f')]);_0x3c0c20[_0xaacf('0x30')]=_[_0xaacf('0x31')](_0x3c0c20['model'],_0x3c0c20[_0xaacf('0x2f')]);_0x3f2a0d[_0xaacf('0x32')]=_[_0xaacf('0x31')](_0x3c0c20['model'],qs[_0xaacf('0x33')](_0x1a9de7[_0xaacf('0x2f')][_0xaacf('0x33')]));_0x3f2a0d[_0xaacf('0x32')]=_0x3f2a0d[_0xaacf('0x32')][_0xaacf('0x43')]?_0x3f2a0d[_0xaacf('0x32')]:_0x3c0c20[_0xaacf('0x2c')];if(_0x1a9de7[_0xaacf('0x2f')]['includeAll']){_0x3f2a0d['include']=[{'all':!![]}];}_0x3f2a0d=_['merge']({},_0x3f2a0d,_0x1a9de7[_0xaacf('0x3c')]);return db[_0xaacf('0x28')]['find'](_0x3f2a0d)[_0xaacf('0x3d')](handleEntityNotFound(_0x64cf93,null))[_0xaacf('0x3d')](respondWithResult(_0x64cf93,null))['catch'](handleError(_0x64cf93,null));};exports[_0xaacf('0x44')]=function(_0x53c2dd,_0x36d2cb){var _0x57cdab={'where':{'id':_0x53c2dd[_0xaacf('0x42')]['id']}},_0x18e3e0={};_0x18e3e0[_0xaacf('0x2c')]=_[_0xaacf('0x2e')](db[_0xaacf('0x28')]['rawAttributes']);_0x57cdab[_0xaacf('0x32')]=_[_0xaacf('0x31')](_0x18e3e0[_0xaacf('0x2c')],qs[_0xaacf('0x33')](_0x53c2dd[_0xaacf('0x2f')][_0xaacf('0x33')]));_0x57cdab[_0xaacf('0x32')]=_0x57cdab[_0xaacf('0x32')]['length']?_0x57cdab[_0xaacf('0x32')]:_0x18e3e0['model'];if(_0x53c2dd['query'][_0xaacf('0x3e')]){_0x57cdab['include']=[{'all':!![]}];}_0x57cdab=_[_0xaacf('0x39')]({},_0x57cdab,_0x53c2dd['options']);return db[_0xaacf('0x28')][_0xaacf('0x45')](_0x57cdab)[_0xaacf('0x3d')](handleEntityNotFound(_0x36d2cb,null))[_0xaacf('0x3d')](function(_0x33ceb6){if(_0x33ceb6){var _0x1000ef=_0x33ceb6[_0xaacf('0x46')]({'plain':!![]});_0x1000ef=qs['omit'](_0x1000ef,['id',_0xaacf('0x47'),_0xaacf('0x48')]);_0x53c2dd[_0xaacf('0x49')]=_[_0xaacf('0x4a')](_0x53c2dd[_0xaacf('0x49')],['id',_0xaacf('0x47'),_0xaacf('0x48')]);return db[_0xaacf('0x28')][_0xaacf('0x4b')](_[_0xaacf('0x39')](_0x1000ef,_0x53c2dd['body']),{'include':_0x53c2dd['query'][_0xaacf('0x3e')]?[{'all':!![]}]:undefined});}})[_0xaacf('0x3d')](respondWithResult(_0x36d2cb,0xc9))[_0xaacf('0x41')](handleError(_0x36d2cb,null));};exports[_0xaacf('0x23')]=function(_0x4c11dc,_0x16f859){if(_0x4c11dc['body']['id']){delete _0x4c11dc[_0xaacf('0x49')]['id'];}return db[_0xaacf('0x28')][_0xaacf('0x45')]({'where':{'id':_0x4c11dc[_0xaacf('0x42')]['id']}})[_0xaacf('0x3d')](handleEntityNotFound(_0x16f859,null))[_0xaacf('0x3d')](saveUpdates(_0x4c11dc['body'],null))[_0xaacf('0x3d')](respondWithResult(_0x16f859,null))['catch'](handleError(_0x16f859,null));};exports['destroy']=function(_0xa7443,_0x5677bd){return db[_0xaacf('0x28')][_0xaacf('0x45')]({'where':{'id':_0xa7443[_0xaacf('0x42')]['id']}})[_0xaacf('0x3d')](handleEntityNotFound(_0x5677bd,null))[_0xaacf('0x3d')](removeEntity(_0x5677bd,null))[_0xaacf('0x41')](handleError(_0x5677bd,null));};exports[_0xaacf('0x4b')]=function(_0x3cb229,_0xa6457a,_0x4e57ad){_0x3cb229[_0xaacf('0x49')][_0xaacf('0x26')]=_0x3cb229[_0xaacf('0x4c')][_0xaacf('0x4d')];_0x3cb229[_0xaacf('0x49')][_0xaacf('0x4e')]=_0x3cb229[_0xaacf('0x4c')][_0xaacf('0x4f')];_0x3cb229[_0xaacf('0x49')][_0xaacf('0x3a')]=_0x3cb229[_0xaacf('0x4c')][_0xaacf('0x50')];return db['Attachment'][_0xaacf('0x4b')](_0x3cb229[_0xaacf('0x49')])[_0xaacf('0x3d')](respondWithResult(_0xa6457a,0xc9))[_0xaacf('0x41')](handleError(_0xa6457a,null));};exports[_0xaacf('0x51')]=function(_0x22fad1,_0x129ed7,_0x507975){return db['Attachment']['findOne']({'where':{'id':_0x22fad1[_0xaacf('0x42')]['id']},'raw':!![]})[_0xaacf('0x3d')](handleEntityNotFound(_0x129ed7,null))[_0xaacf('0x3d')](function(_0x508ee6){if(_0x508ee6){var _0x4c9ad8=_0x508ee6['ChatOfflineMessageId']!==null;var _0x3ab995=path[_0xaacf('0x52')](config[_0xaacf('0x53')],_0xaacf('0x54'));if(_0x4c9ad8){_0x3ab995=path[_0xaacf('0x52')](_0x3ab995,_0xaacf('0x55'));}var _0x1243ba=path['join'](_0x3ab995,_0x508ee6['basename']);return _0x129ed7['download'](_0x1243ba);}})[_0xaacf('0x41')](handleError(_0x129ed7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index e2fb6c3..5babb4e 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 _0xdee1=['exports','define','attachments','util','../../config/logger','bluebird','request-promise','path','./attachment.attributes'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xdee1,0x9c));var _0x1dee=function(_0x35dc52,_0x5c666f){_0x35dc52=_0x35dc52-0x0;var _0x4134cd=_0xdee1[_0x35dc52];return _0x4134cd;};'use strict';var _=require('lodash');var util=require(_0x1dee('0x0'));var logger=require(_0x1dee('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1dee('0x2'));var rp=require(_0x1dee('0x3'));var fs=require('fs');var path=require(_0x1dee('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1dee('0x5'));module[_0x1dee('0x6')]=function(_0x17bcd5,_0x4444ff){return _0x17bcd5[_0x1dee('0x7')]('Attachment',attributes,{'tableName':_0x1dee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee41=['attachments','lodash','util','api','moment','path','rimraf','../../config/environment','define'];(function(_0x13fd61,_0x57e527){var _0x13dfb8=function(_0x4ce2d1){while(--_0x4ce2d1){_0x13fd61['push'](_0x13fd61['shift']());}};_0x13dfb8(++_0x57e527);}(_0xee41,0x1e7));var _0x1ee4=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xee41[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x1ee4('0x0'));var util=require(_0x1ee4('0x1'));var logger=require('../../config/logger')(_0x1ee4('0x2'));var moment=require(_0x1ee4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ee4('0x4'));var rimraf=require(_0x1ee4('0x5'));var config=require(_0x1ee4('0x6'));var attributes=require('./attachment.attributes');module['exports']=function(_0x57c008,_0x481ebd){return _0x57c008[_0x1ee4('0x7')]('Attachment',attributes,{'tableName':_0x1ee4('0x8'),'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 6016ecd..501334a 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 _0x74f0=['body','raw','then','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x74f0,0xf3));var _0x074f=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0x74f0[_0x10e653];return _0x328dfd;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('Attachment,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});}exports[_0x074f('0x14')]=function(_0x200e43){var _0x3facd8=this;return new Promise(function(_0x315e7d,_0x1c5406){return db['Attachment']['create'](_0x200e43[_0x074f('0x15')],{'raw':_0x200e43['options']?_0x200e43['options'][_0x074f('0x16')]===undefined?!![]:![]:!![]})[_0x074f('0x17')](function(_0x1563f3){logger[_0x074f('0xa')](_0x074f('0x14'),_0x200e43);logger[_0x074f('0xd')](_0x074f('0x14'),_0x200e43,JSON[_0x074f('0xe')](_0x1563f3));_0x315e7d(_0x1563f3);})[_0x074f('0x13')](function(_0x2c3b23){logger[_0x074f('0xf')](_0x074f('0x14'),_0x2c3b23[_0x074f('0x11')],_0x200e43);_0x1c5406(_0x3facd8[_0x074f('0xf')](0x1f4,_0x2c3b23[_0x074f('0x11')]));});});}; \ No newline at end of file +var _0xb7c8=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','body','options'];(function(_0x5874ca,_0xf90b52){var _0x4b41d7=function(_0x3342f3){while(--_0x3342f3){_0x5874ca['push'](_0x5874ca['shift']());}};_0x4b41d7(++_0xf90b52);}(_0xb7c8,0x119));var _0x8b7c=function(_0x16f83e,_0xd9d70){_0x16f83e=_0x16f83e-0x0;var _0x573f2c=_0xb7c8[_0x16f83e];return _0x573f2c;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var BPromise=require(_0x8b7c('0x2'));var rs=require(_0x8b7c('0x3'));var fs=require('fs');var Redis=require(_0x8b7c('0x4'));var db=require(_0x8b7c('0x5'))['db'];var utils=require(_0x8b7c('0x6'));var logger=require('../../config/logger')(_0x8b7c('0x7'));var config=require(_0x8b7c('0x8'));var jayson=require(_0x8b7c('0x9'));var client=jayson[_0x8b7c('0xa')][_0x8b7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12665c,_0x7a3850,_0x3c8fd6){return new BPromise(function(_0x6afb55,_0x30a924){return client[_0x8b7c('0xc')](_0x12665c,_0x3c8fd6)[_0x8b7c('0xd')](function(_0x48370e){logger[_0x8b7c('0xe')]('Attachment,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'));logger[_0x8b7c('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'),JSON[_0x8b7c('0x11')](_0x48370e));if(_0x48370e[_0x8b7c('0x12')]){if(_0x48370e['error']['code']===0x1f4){logger[_0x8b7c('0x12')](_0x8b7c('0x13'),_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x30a924(_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);}logger[_0x8b7c('0x12')]('Attachment,\x20%s,\x20%s',_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x6afb55(_0x48370e[_0x8b7c('0x12')]['message']);}else{logger[_0x8b7c('0xe')](_0x8b7c('0x13'),_0x7a3850,'request\x20sent');_0x6afb55(_0x48370e[_0x8b7c('0x15')][_0x8b7c('0x14')]);}})[_0x8b7c('0x16')](function(_0x1682fd){logger[_0x8b7c('0x12')]('Attachment,\x20%s,\x20%s',_0x7a3850,_0x1682fd);_0x30a924(_0x1682fd);});});}exports[_0x8b7c('0x17')]=function(_0x3ef583){var _0x3c2cc6=this;return new Promise(function(_0x2ac635,_0x77c9b7){return db['Attachment'][_0x8b7c('0x18')](_0x3ef583[_0x8b7c('0x19')],{'raw':_0x3ef583[_0x8b7c('0x1a')]?_0x3ef583[_0x8b7c('0x1a')][_0x8b7c('0x1b')]===undefined?!![]:![]:!![]})[_0x8b7c('0xd')](function(_0x3f587b){logger[_0x8b7c('0xe')](_0x8b7c('0x17'),_0x3ef583);logger[_0x8b7c('0x10')](_0x8b7c('0x17'),_0x3ef583,JSON[_0x8b7c('0x11')](_0x3f587b));_0x2ac635(_0x3f587b);})['catch'](function(_0x4222ab){logger[_0x8b7c('0x12')](_0x8b7c('0x17'),_0x4222ab[_0x8b7c('0x14')],_0x3ef583);_0x77c9b7(_0x3c2cc6[_0x8b7c('0x12')](0x1f4,_0x4222ab[_0x8b7c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e35a87f..4244b04 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x5e0f94,_0x4a9ae7){var _0x55345a=function(_0x443222){while(--_0x443222){_0x5e0f94['push'](_0x5e0f94['shift']());}};_0x55345a(++_0x4a9ae7);}(_0xb10b,0x12a));var _0xbb10=function(_0x263714,_0x399b37){_0x263714=_0x263714-0x0;var _0x1cd43d=_0xb10b[_0x263714];return _0x1cd43d;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x164bc9,_0x4229ec){_0x164bc9=_0x164bc9-0x0;var _0x3bdeaf=_0xdb28[_0x164bc9];return _0x3bdeaf;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 3be65f2..29ddade 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 _0xb644=['blockedAt','online','name','add','minutes','clearBlockUser','getLicense','catch','ad-login','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','blockDuration','then','adSsoEnabled','password','salt','role','disabled','blocked'];(function(_0x219750,_0x4b83c1){var _0x4c90c1=function(_0x471d36){while(--_0x471d36){_0x219750['push'](_0x219750['shift']());}};_0x4c90c1(++_0x4b83c1);}(_0xb644,0x15c));var _0x4b64=function(_0x1ccd29,_0x3c456b){_0x1ccd29=_0x1ccd29-0x0;var _0x207fbb=_0xb644[_0x1ccd29];return _0x207fbb;};'use strict';var passport=require(_0x4b64('0x0'));var LocalStrategy=require(_0x4b64('0x1'))[_0x4b64('0x2')];var moment=require(_0x4b64('0x3'));var ActiveDirectory=require(_0x4b64('0x4'));var BPromise=require('bluebird');var util=require('util');var db=require(_0x4b64('0x5'))['db'];var authService=require(_0x4b64('0x6'));var utils=require('../../config/utils');var config=require(_0x4b64('0x7'));var logger=require(_0x4b64('0x8'))(_0x4b64('0x9'));function isActiveDirectoryConfigured(_0x477da6){var _0x583e05=![];if(typeof _0x477da6[_0x4b64('0xa')]!==_0x4b64('0xb')){_0x583e05=_0x477da6[_0x4b64('0xa')][_0x4b64('0xc')]&&_0x477da6[_0x4b64('0xa')]['url']&&_0x477da6[_0x4b64('0xa')][_0x4b64('0xd')];}return _0x583e05;}function adAuthenticate(_0x2f5147,_0x4a43bc,_0x3731c2){return new BPromise(function(_0x21b76f,_0x42f461){try{var _0x4bebc7=new ActiveDirectory(_0x2f5147);_0x4bebc7[_0x4b64('0xe')](_0x4a43bc,_0x3731c2,function(_0x17b0e8,_0x282f9a){if(_0x17b0e8){logger[_0x4b64('0xf')](_0x4b64('0x10'),_0x4a43bc,util[_0x4b64('0x11')](_0x17b0e8,{'showHidden':![],'depth':null}));_0x42f461('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x282f9a){logger[_0x4b64('0xf')](_0x4b64('0x12'),_0x4a43bc);_0x42f461(_0x4b64('0x13'));}else{_0x21b76f(_0x282f9a);}});}catch(_0x5d507a){_0x42f461(_0x5d507a);}});}function ActiveDirectoryAuthenticate(_0x19a168,_0x364192,_0x8cd928,_0x1d95b8){var _0x3cf154,_0x2322a0;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4b64('0x14'),_0x364192);return _0x1d95b8(null,![],{'message':_0x4b64('0x13')});}return db['Setting'][_0x4b64('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x4b64('0x16')],'raw':!![]})[_0x4b64('0x17')](function(_0x2649bb){_0x3cf154=_0x2649bb;if(!_0x3cf154[_0x4b64('0x18')]){logger[_0x4b64('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x364192);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x19a168['findOne']({'attributes':['id','name',_0x4b64('0x19'),_0x4b64('0x1a'),_0x4b64('0x1b'),_0x4b64('0x1c'),_0x4b64('0x1d'),_0x4b64('0x1e'),_0x4b64('0x1f')],'where':{'name':_0x364192,'role':{'$or':['admin','user','agent']},'adSsoEnabled':!![]}});})[_0x4b64('0x17')](function(_0x5bae1b){if(!_0x5bae1b||_0x5bae1b&&_0x5bae1b[_0x4b64('0x20')]!==_0x364192){throw new Error(_0x4b64('0x13'));}_0x2322a0=_0x5bae1b;var _0x2406bb=_0x2322a0[_0x4b64('0x20')]+'@'+config[_0x4b64('0xa')][_0x4b64('0xd')];return adAuthenticate(config[_0x4b64('0xa')],_0x2406bb,_0x8cd928);})[_0x4b64('0x17')](function(_0x2cb563){if(_0x2322a0[_0x4b64('0x1c')]){throw new Error(_0x4b64('0x13'));}if(_0x3cf154[_0x4b64('0x16')]>0x0){if(_0x2322a0[_0x4b64('0x1d')]){if(moment(_0x2322a0[_0x4b64('0x1e')])[_0x4b64('0x21')](_0x3cf154[_0x4b64('0x16')],_0x4b64('0x22'))>moment()){throw new Error(_0x4b64('0x13'));}return utils[_0x4b64('0x23')](_0x2322a0,0x0,![],null)[_0x4b64('0x17')](function(){return utils['getLicense'](_0x2322a0);})['then'](function(){return _0x1d95b8(null,_0x2322a0);});}else{return utils[_0x4b64('0x24')](_0x2322a0)['then'](function(){return _0x1d95b8(null,_0x2322a0);});}}else{return utils[_0x4b64('0x24')](_0x2322a0)['then'](function(){return _0x1d95b8(null,_0x2322a0);});}})[_0x4b64('0x25')](function(_0x2a3374){return _0x1d95b8(null,![],_0x2a3374);});}function handleError(_0x57c235,_0x2ab215,_0x5c59e2){return _0x57c235['status'](_0x2ab215||0x1f4)['send']({'message':_0x5c59e2?_0x5c59e2['message']||_0x5c59e2:''});}exports['login']=function(_0x875216,_0x49db32,_0x1c63a0){passport[_0x4b64('0xe')](_0x4b64('0x26'),function(_0x2b7d22,_0x11de08,_0x13c9ee){var _0x39de48=_0x2b7d22||_0x13c9ee;if(_0x39de48){return handleError(_0x49db32,0x191,_0x39de48);}if(!_0x11de08){return handleError(_0x49db32,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xa5eb94={'payload':{'id':_0x11de08['id'],'role':_0x11de08['role']},'options':{'expiresIn':0x15180}};return authService[_0x4b64('0x27')](_0xa5eb94)['then'](function(_0x29172e){_0x49db32[_0x4b64('0x28')]({'id':_0x11de08['id'],'token':_0x29172e,'statusCall':'','isAlreadyLogged':_0x11de08[_0x4b64('0x1f')]});});}})(_0x875216,_0x49db32,_0x1c63a0);};passport['use'](_0x4b64('0x26'),new LocalStrategy({'usernameField':_0x4b64('0x20'),'passwordField':_0x4b64('0x19')},function(_0x7b48d6,_0x3b5899,_0x33931b){return ActiveDirectoryAuthenticate(db[_0x4b64('0x29')],_0x7b48d6,_0x3b5899,_0x33931b);})); \ No newline at end of file +var _0xef17=['online','admin','user','agent','then','blocked','add','minutes','clearBlockUser','getLicense','catch','send','message','ad-login','role','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','api','activedirectory','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','blockDuration','name','password','disabled','blockedAt'];(function(_0x49218f,_0x4248b6){var _0x1b9f85=function(_0x4eb59c){while(--_0x4eb59c){_0x49218f['push'](_0x49218f['shift']());}};_0x1b9f85(++_0x4248b6);}(_0xef17,0x136));var _0x7ef1=function(_0x4b2a4d,_0x14d7d4){_0x4b2a4d=_0x4b2a4d-0x0;var _0x3bac6d=_0xef17[_0x4b2a4d];return _0x3bac6d;};'use strict';var passport=require(_0x7ef1('0x0'));var LocalStrategy=require(_0x7ef1('0x1'))[_0x7ef1('0x2')];var moment=require(_0x7ef1('0x3'));var ActiveDirectory=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var util=require(_0x7ef1('0x6'));var db=require(_0x7ef1('0x7'))['db'];var authService=require(_0x7ef1('0x8'));var utils=require('../../config/utils');var config=require(_0x7ef1('0x9'));var logger=require('../../config/logger')(_0x7ef1('0xa'));function isActiveDirectoryConfigured(_0x498596){var _0x34a040=![];if(typeof _0x498596['activedirectory']!=='undefined'){_0x34a040=_0x498596[_0x7ef1('0xb')][_0x7ef1('0xc')]&&_0x498596['activedirectory'][_0x7ef1('0xd')]&&_0x498596[_0x7ef1('0xb')][_0x7ef1('0xe')];}return _0x34a040;}function adAuthenticate(_0x3d47e2,_0x2cb9b0,_0x3ce78d){return new BPromise(function(_0x642de7,_0x4bedd1){try{var _0x4da8e8=new ActiveDirectory(_0x3d47e2);_0x4da8e8[_0x7ef1('0xf')](_0x2cb9b0,_0x3ce78d,function(_0x4dc653,_0x5ab4a4){if(_0x4dc653){logger['error'](_0x7ef1('0x10'),_0x2cb9b0,util['inspect'](_0x4dc653,{'showHidden':![],'depth':null}));_0x4bedd1(_0x7ef1('0x11'));}else if(!_0x5ab4a4){logger[_0x7ef1('0x12')](_0x7ef1('0x13'),_0x2cb9b0);_0x4bedd1(_0x7ef1('0x11'));}else{_0x642de7(_0x5ab4a4);}});}catch(_0x39ea9c){_0x4bedd1(_0x39ea9c);}});}function ActiveDirectoryAuthenticate(_0x317125,_0x26e9fb,_0x44d304,_0x57296a){var _0x4de80f,_0x267f0e;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x7ef1('0x14'),_0x26e9fb);return _0x57296a(null,![],{'message':_0x7ef1('0x11')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7ef1('0x15')],'raw':!![]})['then'](function(_0x3a5835){_0x4de80f=_0x3a5835;if(!_0x4de80f['adSsoEnabled']){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x26e9fb);throw new Error(_0x7ef1('0x11'));}return _0x317125['findOne']({'attributes':['id',_0x7ef1('0x16'),_0x7ef1('0x17'),'salt','role',_0x7ef1('0x18'),'blocked',_0x7ef1('0x19'),_0x7ef1('0x1a')],'where':{'name':_0x26e9fb,'role':{'$or':[_0x7ef1('0x1b'),_0x7ef1('0x1c'),_0x7ef1('0x1d')]},'adSsoEnabled':!![]}});})[_0x7ef1('0x1e')](function(_0x20887b){if(!_0x20887b||_0x20887b&&_0x20887b[_0x7ef1('0x16')]!==_0x26e9fb){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x267f0e=_0x20887b;var _0x2a1bdd=_0x267f0e[_0x7ef1('0x16')]+'@'+config[_0x7ef1('0xb')][_0x7ef1('0xe')];return adAuthenticate(config[_0x7ef1('0xb')],_0x2a1bdd,_0x44d304);})[_0x7ef1('0x1e')](function(_0x423c42){if(_0x267f0e[_0x7ef1('0x18')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4de80f['blockDuration']>0x0){if(_0x267f0e[_0x7ef1('0x1f')]){if(moment(_0x267f0e[_0x7ef1('0x19')])[_0x7ef1('0x20')](_0x4de80f[_0x7ef1('0x15')],_0x7ef1('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x7ef1('0x22')](_0x267f0e,0x0,![],null)[_0x7ef1('0x1e')](function(){return utils[_0x7ef1('0x23')](_0x267f0e);})[_0x7ef1('0x1e')](function(){return _0x57296a(null,_0x267f0e);});}else{return utils[_0x7ef1('0x23')](_0x267f0e)[_0x7ef1('0x1e')](function(){return _0x57296a(null,_0x267f0e);});}}else{return utils[_0x7ef1('0x23')](_0x267f0e)['then'](function(){return _0x57296a(null,_0x267f0e);});}})[_0x7ef1('0x24')](function(_0x4b0380){return _0x57296a(null,![],_0x4b0380);});}function handleError(_0x3306b0,_0x2546bf,_0x4b5fde){return _0x3306b0['status'](_0x2546bf||0x1f4)[_0x7ef1('0x25')]({'message':_0x4b5fde?_0x4b5fde[_0x7ef1('0x26')]||_0x4b5fde:''});}exports['login']=function(_0xbf918d,_0x56fe40,_0x3aa113){passport['authenticate'](_0x7ef1('0x27'),function(_0x23414f,_0x585238,_0x536083){var _0x4e5831=_0x23414f||_0x536083;if(_0x4e5831){return handleError(_0x56fe40,0x191,_0x4e5831);}if(!_0x585238){return handleError(_0x56fe40,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1b72a1={'payload':{'id':_0x585238['id'],'role':_0x585238[_0x7ef1('0x28')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1b72a1)[_0x7ef1('0x1e')](function(_0x4dbb22){_0x56fe40['json']({'id':_0x585238['id'],'token':_0x4dbb22,'statusCall':'','isAlreadyLogged':_0x585238[_0x7ef1('0x1a')]});});}})(_0xbf918d,_0x56fe40,_0x3aa113);};passport['use'](_0x7ef1('0x27'),new LocalStrategy({'usernameField':_0x7ef1('0x16'),'passwordField':_0x7ef1('0x17')},function(_0x1bfa7b,_0x47e0e1,_0x191575){return ActiveDirectoryAuthenticate(db[_0x7ef1('0x29')],_0x1bfa7b,_0x47e0e1,_0x191575);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index d65eaef..41c1024 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 _0x97bf=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x278a74,_0x4ea713){var _0xc065b1=function(_0x4064b7){while(--_0x4064b7){_0x278a74['push'](_0x278a74['shift']());}};_0xc065b1(++_0x4ea713);}(_0x97bf,0x15b));var _0xf97b=function(_0x408380,_0x587b99){_0x408380=_0x408380-0x0;var _0x10e025=_0x97bf[_0x408380];return _0x10e025;};'use strict';var express=require(_0xf97b('0x0'));var router=express[_0xf97b('0x1')]();var controller=require(_0xf97b('0x2'));router['post']('/',controller[_0xf97b('0x3')]);module[_0xf97b('0x4')]=router; \ No newline at end of file +var _0x32d5=['post','login','exports','express','Router'];(function(_0x20a125,_0x309dfc){var _0x220b9a=function(_0x421ee5){while(--_0x421ee5){_0x20a125['push'](_0x20a125['shift']());}};_0x220b9a(++_0x309dfc);}(_0x32d5,0x18e));var _0x532d=function(_0x14afd5,_0x41bdeb){_0x14afd5=_0x14afd5-0x0;var _0x2a2f6c=_0x32d5[_0x14afd5];return _0x2a2f6c;};'use strict';var express=require(_0x532d('0x0'));var router=express[_0x532d('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x532d('0x2')]('/',controller[_0x532d('0x3')]);module[_0x532d('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 f94de0a..e7525dc 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x13e6ff,_0x991288){_0x13e6ff=_0x13e6ff-0x0;var _0x4aee8b=_0x7a54[_0x13e6ff];return _0x4aee8b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x7a54,0x106));var _0x47a5=function(_0x24eda3,_0x3d89c0){_0x24eda3=_0x24eda3-0x0;var _0x54d22d=_0x7a54[_0x24eda3];return _0x54d22d;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 47c6377..c59627e 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 _0x1fc7=['../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller'];(function(_0x3ed1c1,_0x45fe0a){var _0x11797d=function(_0x26bad3){while(--_0x26bad3){_0x3ed1c1['push'](_0x3ed1c1['shift']());}};_0x11797d(++_0x45fe0a);}(_0x1fc7,0x1ca));var _0x71fc=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x1fc7[_0x1694f5];return _0x5b4321;};'use strict';var express=require(_0x71fc('0x0'));var passport=require(_0x71fc('0x1'));var router=express[_0x71fc('0x2')]();var controller=require(_0x71fc('0x3'));var userController=require(_0x71fc('0x4'));var authService=require(_0x71fc('0x5'));router[_0x71fc('0x6')]('/',controller[_0x71fc('0x7')]);router[_0x71fc('0x6')]('/callback',controller[_0x71fc('0x8')],authService[_0x71fc('0x9')],userController[_0x71fc('0x7')],authService['setTokenCookie']);module[_0x71fc('0xa')]=router; \ No newline at end of file +var _0x536e=['/callback','callback','isMiddleware','setTokenCookie','exports','express','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x528d5e,_0x533d1e){var _0x56916f=function(_0x44123a){while(--_0x44123a){_0x528d5e['push'](_0x528d5e['shift']());}};_0x56916f(++_0x533d1e);}(_0x536e,0x19f));var _0xe536=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x536e[_0x3f4891];return _0x54f2d8;};'use strict';var express=require(_0xe536('0x0'));var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xe536('0x1'));var authService=require(_0xe536('0x2'));router[_0xe536('0x3')]('/',controller[_0xe536('0x4')]);router[_0xe536('0x3')](_0xe536('0x5'),controller[_0xe536('0x6')],authService[_0xe536('0x7')],userController[_0xe536('0x4')],authService[_0xe536('0x8')]);module[_0xe536('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6f6d91a..b8db503 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 _0x44b0=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','merge','format','\x22%s\x22\x20<%s>','SendMail'];(function(_0xdb8e6c,_0x15df30){var _0x12c7e9=function(_0x2ae495){while(--_0x2ae495){_0xdb8e6c['push'](_0xdb8e6c['shift']());}};_0x12c7e9(++_0x15df30);}(_0x44b0,0x120));var _0x044b=function(_0x58403c,_0x45d162){_0x58403c=_0x58403c-0x0;var _0x117a7e=_0x44b0[_0x58403c];return _0x117a7e;};'use strict';var util=require(_0x044b('0x0'));var passport=require(_0x044b('0x1'));var LocalStrategy=require('passport-local')[_0x044b('0x2')];var jayson=require(_0x044b('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x044b('0x4'));var db=require(_0x044b('0x5'))['db'];var authService=require(_0x044b('0x6'));var utils=require(_0x044b('0x7'));var client=jayson[_0x044b('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x1242bb,_0x1ae22b,_0x1c960a,_0x7d0105){var _0x2ca4d3,_0x3f5c63;return db[_0x044b('0x9')][_0x044b('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x044b('0xb')],'raw':!![]})[_0x044b('0xc')](function(_0x9e2ddd){_0x2ca4d3=_0x9e2ddd;return _0x1242bb[_0x044b('0xa')]({'attributes':['id',_0x044b('0xd'),_0x044b('0xe'),_0x044b('0xf'),_0x044b('0x10'),_0x044b('0x11'),'blocked',_0x044b('0x12'),_0x044b('0x13')],'where':{'name':_0x1ae22b,'role':{'$or':[_0x044b('0x14'),_0x044b('0x15'),'agent']}}});})[_0x044b('0xc')](function(_0x4fbe79){if(!_0x4fbe79||_0x4fbe79&&_0x4fbe79[_0x044b('0xd')]!==_0x1ae22b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3f5c63=_0x4fbe79;return _0x3f5c63;}})[_0x044b('0xc')](function(){_0x3f5c63[_0x044b('0x16')](_0x1c960a,function(_0x17eea1,_0xc8c131){var _0x55e853=_0x3f5c63[_0x044b('0x13')]+0x1;if(_0x17eea1){return _0x7d0105(_0x17eea1);}else if(!_0xc8c131){if(_0x3f5c63['disabled']){return _0x7d0105(null,![],{'message':_0x044b('0x17')});}else if(_0x2ca4d3[_0x044b('0x18')]>0x0){if(_0x3f5c63['blocked']){if(_0x2ca4d3['blockDuration']>0x0){if(moment(_0x3f5c63[_0x044b('0x12')])[_0x044b('0x19')](_0x2ca4d3['blockDuration'],_0x044b('0x1a'))>moment()){return _0x7d0105(null,![],{'message':_0x044b('0x17')});}else{return utils['clearBlockUser'](_0x3f5c63,_0x55e853,![],null)[_0x044b('0xc')](function(){return _0x7d0105(null,![],{'message':_0x044b('0x17')});});}}else{return _0x7d0105(null,![],{'message':_0x044b('0x17')});}}else{if(_0x55e853>=_0x2ca4d3[_0x044b('0x18')]){return utils[_0x044b('0x1b')](_0x3f5c63,0x0,!![],moment())[_0x044b('0xc')](function(){return _0x7d0105(null,![],{'message':_0x044b('0x17')});});}else{return utils[_0x044b('0x1b')](_0x3f5c63,_0x55e853,![],null)[_0x044b('0xc')](function(){return _0x7d0105(null,![],{'message':_0x044b('0x17')});});}}}else{return _0x7d0105(null,![],{'message':_0x044b('0x17')});}}else{if(_0x3f5c63[_0x044b('0x11')]){return _0x7d0105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2ca4d3[_0x044b('0x18')]>0x0){if(_0x3f5c63[_0x044b('0x1c')]){if(_0x2ca4d3[_0x044b('0xb')]>0x0){if(moment(_0x3f5c63[_0x044b('0x12')])[_0x044b('0x19')](_0x2ca4d3['blockDuration'],_0x044b('0x1a'))>moment()){return _0x7d0105(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x3f5c63,0x0,![],null)[_0x044b('0xc')](function(){return utils['getLicense'](_0x3f5c63);})[_0x044b('0xc')](function(){return _0x7d0105(null,_0x3f5c63);});}}else{return _0x7d0105(null,![],{'message':_0x044b('0x17')});}}else{return utils[_0x044b('0x1b')](_0x3f5c63,0x0,![],null)['then'](function(){return utils[_0x044b('0x1d')](_0x3f5c63);})[_0x044b('0xc')](function(){return _0x7d0105(null,_0x3f5c63);})[_0x044b('0x1e')](function(_0xcc00ba){return _0x7d0105(null,![],_0xcc00ba);});}}else{if(_0x3f5c63[_0x044b('0x1c')]){return _0x7d0105(null,![],{'message':_0x044b('0x17')});}else{return utils[_0x044b('0x1d')](_0x3f5c63)[_0x044b('0xc')](function(){return _0x7d0105(null,_0x3f5c63);});}}}});})[_0x044b('0x1e')](function(_0x142b1b){return _0x7d0105(null,![],_0x142b1b);});}function sendServiceMail(_0x4b576f){return db[_0x044b('0x1f')][_0x044b('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x044b('0x21')],'include':[{'model':db[_0x044b('0x22')],'as':'Smtp','include':[{'model':db[_0x044b('0x23')],'as':'CloudProvider'}]}]})[_0x044b('0xc')](function(_0x33618d){if(!_0x33618d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3d7f6f=_0x33618d['getSmtpOptions']();var _0x24b358={'account':_0x3d7f6f,'message':_[_0x044b('0x24')]({'from':util[_0x044b('0x25')](_0x044b('0x26'),_0x33618d[_0x044b('0xd')],_0x33618d[_0x044b('0x21')]||_0x33618d['Smtp']['user'])},_0x4b576f)};return client['request'](_0x044b('0x27'),_0x24b358);})[_0x044b('0xc')](function(_0x5b2954){if(_0x5b2954[_0x044b('0x28')]){throw new Error(util[_0x044b('0x25')](_0x044b('0x29'),_0x5b2954[_0x044b('0x28')]['message']||JSON[_0x044b('0x2a')](_0x5b2954[_0x044b('0x28')])));}return!![];});}function handleError(_0x12bcc5,_0x17d17a,_0x5bb150){return _0x12bcc5[_0x044b('0x2b')](_0x17d17a||0x1f4)[_0x044b('0x2c')]({'message':_0x5bb150?_0x5bb150[_0x044b('0x2d')]||_0x5bb150:''});}exports[_0x044b('0x2e')]=function(_0x1e4bf6,_0x89bfb3,_0x9d5e5f){passport[_0x044b('0x16')](_0x044b('0x2f'),function(_0x5e9d53,_0x19e279,_0x333a2e){var _0x357501=_0x5e9d53||_0x333a2e;if(_0x357501){return handleError(_0x89bfb3,0x191,_0x357501);}if(!_0x19e279){return handleError(_0x89bfb3,0x194,{'message':_0x044b('0x30')});}else{var _0x1b7592={'payload':{'id':_0x19e279['id'],'role':_0x19e279[_0x044b('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x044b('0x31')](_0x1b7592)[_0x044b('0xc')](function(_0x30ca9e){_0x89bfb3[_0x044b('0x32')]({'id':_0x19e279['id'],'token':_0x30ca9e,'statusCall':'','isAlreadyLogged':_0x19e279[_0x044b('0x33')]});});}})(_0x1e4bf6,_0x89bfb3,_0x9d5e5f);};exports[_0x044b('0x34')]=function(_0x122cc7,_0x352ed9){if(!_0x122cc7[_0x044b('0x35')]['email']){return handleError(_0x352ed9,0x1f4,{'message':_0x044b('0x36')});}var _0x413c4a=rs['generate']();_0x122cc7['body'][_0x044b('0x21')]=_0x122cc7[_0x044b('0x35')]['email'][_0x044b('0x37')]()[_0x044b('0x38')]();var _0xd9522c;return db[_0x044b('0x9')][_0x044b('0xa')]({'where':{'id':0x1},'attributes':[_0x044b('0x18'),_0x044b('0xb')],'raw':!![]})[_0x044b('0xc')](function(_0x104cf0){_0xd9522c=_0x104cf0;return db[_0x044b('0x39')]['find']({'where':{'email':_0x122cc7['body'][_0x044b('0x21')]}});})['then'](function(_0x30a5a1){if(!_0x30a5a1){throw new Error(_0x044b('0x3a'));}if(_0x30a5a1[_0x044b('0x11')]){throw new Error(_0x044b('0x3b'));}if(_0x30a5a1[_0x044b('0x1c')]){if(moment(_0x30a5a1[_0x044b('0x12')])[_0x044b('0x19')](_0xd9522c[_0x044b('0xb')],_0x044b('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x30a5a1['blocked']=![];_0x30a5a1[_0x044b('0x12')]=null;}}_0x30a5a1[_0x044b('0x3c')]=_0x413c4a;_0x30a5a1[_0x044b('0x3d')]=Date[_0x044b('0x3e')]()+0x36ee80;return _0x30a5a1[_0x044b('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x122cc7[_0x044b('0x35')][_0x044b('0x21')],'subject':_0x044b('0x40'),'text':_0x044b('0x41')+_0x044b('0x42')+_0x044b('0x43')+_0x122cc7[_0x044b('0x44')][_0x044b('0x45')]+_0x044b('0x46')+_0x413c4a+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x044b('0xc')](function(){_0x352ed9[_0x044b('0x2b')](0xc8)[_0x044b('0x2c')]({'message':_0x044b('0x47')});})[_0x044b('0x1e')](function(_0x53aa05){return handleError(_0x352ed9,0x1f4,_0x53aa05);});};exports['reset']=function(_0x564198,_0x35a52f){return db['User'][_0x044b('0x20')]({'where':{'resetPasswordToken':_0x564198['params'][_0x044b('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x044b('0xc')](function(_0x37a79b){if(!_0x37a79b){throw new Error(_0x044b('0x49'));}return db[_0x044b('0x9')][_0x044b('0xa')]({'attributes':['id','securePassword',_0x044b('0x4a'),_0x044b('0x4b')]})[_0x044b('0xc')](function(_0x354905){if(_0x354905[_0x044b('0x4c')])authService[_0x044b('0x4d')](_0x564198[_0x044b('0x35')][_0x044b('0xe')]);if(!_0x354905[_0x044b('0x4a')]||!_0x37a79b[_0x044b('0x4e')])return _0x37a79b;authService[_0x044b('0x4f')](_0x564198[_0x044b('0x35')]['password'],_0x37a79b[_0x044b('0x4e')],_0x354905[_0x044b('0x4b')]);return _0x37a79b;})[_0x044b('0xc')](function(){_0x37a79b[_0x044b('0xe')]=_0x564198[_0x044b('0x35')][_0x044b('0xe')];_0x37a79b[_0x044b('0x3c')]=null;_0x37a79b['resetPasswordExpires']=null;return _0x37a79b[_0x044b('0x3f')]();});})[_0x044b('0xc')](function(){_0x35a52f[_0x044b('0x2b')](0xc8)[_0x044b('0x2c')]({'message':_0x044b('0x50')});})[_0x044b('0x1e')](function(_0x49d8a4){return handleError(_0x35a52f,0x1f4,_0x49d8a4);});};passport[_0x044b('0x51')](_0x044b('0x2f'),new LocalStrategy({'usernameField':_0x044b('0xd'),'passwordField':_0x044b('0xe')},function(_0x509c7e,_0x48162f,_0x26a25b){return localAuthenticate(db[_0x044b('0x39')],_0x509c7e,_0x48162f,_0x26a25b);})); \ No newline at end of file +var _0xd61c=['previousPasswords','validatePasswordHistory','resetPasswordExpires','save','Password\x20reset!','use','local-login','util','passport','passport-local','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','disabled','blocked','blockedAt','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','Smtp','CloudProvider','merge','format','\x22%s\x22\x20<%s>','email','user','request','SendMail','error','message','stringify','login','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern'];(function(_0x141775,_0x574d3b){var _0x46c892=function(_0x2577ce){while(--_0x2577ce){_0x141775['push'](_0x141775['shift']());}};_0x46c892(++_0x574d3b);}(_0xd61c,0xb1));var _0xcd61=function(_0x27bbad,_0x558ef0){_0x27bbad=_0x27bbad-0x0;var _0x188c0b=_0xd61c[_0x27bbad];return _0x188c0b;};'use strict';var util=require(_0xcd61('0x0'));var passport=require(_0xcd61('0x1'));var LocalStrategy=require(_0xcd61('0x2'))['Strategy'];var jayson=require(_0xcd61('0x3'));var _=require('lodash');var rs=require(_0xcd61('0x4'));var moment=require(_0xcd61('0x5'));var db=require(_0xcd61('0x6'))['db'];var authService=require(_0xcd61('0x7'));var utils=require(_0xcd61('0x8'));var client=jayson[_0xcd61('0x9')][_0xcd61('0xa')]({'port':0x232b});function localAuthenticate(_0x3f1299,_0x1bf94f,_0x1947d7,_0x47dddf){var _0x42bff7,_0x4927b1;return db[_0xcd61('0xb')][_0xcd61('0xc')]({'where':{'id':0x1},'attributes':[_0xcd61('0xd'),'blockDuration'],'raw':!![]})[_0xcd61('0xe')](function(_0x269ca8){_0x42bff7=_0x269ca8;return _0x3f1299[_0xcd61('0xc')]({'attributes':['id',_0xcd61('0xf'),_0xcd61('0x10'),'salt','role',_0xcd61('0x11'),_0xcd61('0x12'),_0xcd61('0x13'),'loginAttempts'],'where':{'name':_0x1bf94f,'role':{'$or':[_0xcd61('0x14'),'user','agent']}}});})['then'](function(_0x23a289){if(!_0x23a289||_0x23a289&&_0x23a289[_0xcd61('0xf')]!==_0x1bf94f){throw new Error(_0xcd61('0x15'));}else{_0x4927b1=_0x23a289;return _0x4927b1;}})[_0xcd61('0xe')](function(){_0x4927b1[_0xcd61('0x16')](_0x1947d7,function(_0x2b58a4,_0xa30220){var _0x11d8ed=_0x4927b1[_0xcd61('0x17')]+0x1;if(_0x2b58a4){return _0x47dddf(_0x2b58a4);}else if(!_0xa30220){if(_0x4927b1[_0xcd61('0x11')]){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});}else if(_0x42bff7[_0xcd61('0xd')]>0x0){if(_0x4927b1[_0xcd61('0x12')]){if(_0x42bff7[_0xcd61('0x18')]>0x0){if(moment(_0x4927b1['blockedAt'])[_0xcd61('0x19')](_0x42bff7[_0xcd61('0x18')],_0xcd61('0x1a'))>moment()){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});}else{return utils[_0xcd61('0x1b')](_0x4927b1,_0x11d8ed,![],null)['then'](function(){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});});}}else{return _0x47dddf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x11d8ed>=_0x42bff7[_0xcd61('0xd')]){return utils[_0xcd61('0x1b')](_0x4927b1,0x0,!![],moment())[_0xcd61('0xe')](function(){return _0x47dddf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xcd61('0x1b')](_0x4927b1,_0x11d8ed,![],null)['then'](function(){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});});}}}else{return _0x47dddf(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4927b1[_0xcd61('0x11')]){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});}else if(_0x42bff7[_0xcd61('0xd')]>0x0){if(_0x4927b1[_0xcd61('0x12')]){if(_0x42bff7['blockDuration']>0x0){if(moment(_0x4927b1['blockedAt'])[_0xcd61('0x19')](_0x42bff7['blockDuration'],'minutes')>moment()){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});}else{return utils[_0xcd61('0x1b')](_0x4927b1,0x0,![],null)[_0xcd61('0xe')](function(){return utils[_0xcd61('0x1c')](_0x4927b1);})[_0xcd61('0xe')](function(){return _0x47dddf(null,_0x4927b1);});}}else{return _0x47dddf(null,![],{'message':_0xcd61('0x15')});}}else{return utils[_0xcd61('0x1b')](_0x4927b1,0x0,![],null)[_0xcd61('0xe')](function(){return utils[_0xcd61('0x1c')](_0x4927b1);})[_0xcd61('0xe')](function(){return _0x47dddf(null,_0x4927b1);})[_0xcd61('0x1d')](function(_0x2d81b6){return _0x47dddf(null,![],_0x2d81b6);});}}else{if(_0x4927b1[_0xcd61('0x12')]){return _0x47dddf(null,![],{'message':_0xcd61('0x15')});}else{return utils[_0xcd61('0x1c')](_0x4927b1)[_0xcd61('0xe')](function(){return _0x47dddf(null,_0x4927b1);});}}}});})[_0xcd61('0x1d')](function(_0x3a3d1d){return _0x47dddf(null,![],_0x3a3d1d);});}function sendServiceMail(_0x592514){return db[_0xcd61('0x1e')][_0xcd61('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xcd61('0xf'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xcd61('0x20'),'include':[{'model':db[_0xcd61('0x21')],'as':_0xcd61('0x21')}]}]})[_0xcd61('0xe')](function(_0x1f0fbb){if(!_0x1f0fbb){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x56eaee=_0x1f0fbb['getSmtpOptions']();var _0x2356a2={'account':_0x56eaee,'message':_[_0xcd61('0x22')]({'from':util[_0xcd61('0x23')](_0xcd61('0x24'),_0x1f0fbb['name'],_0x1f0fbb[_0xcd61('0x25')]||_0x1f0fbb['Smtp'][_0xcd61('0x26')])},_0x592514)};return client[_0xcd61('0x27')](_0xcd61('0x28'),_0x2356a2);})['then'](function(_0x468118){if(_0x468118[_0xcd61('0x29')]){throw new Error(util[_0xcd61('0x23')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x468118[_0xcd61('0x29')][_0xcd61('0x2a')]||JSON[_0xcd61('0x2b')](_0x468118[_0xcd61('0x29')])));}return!![];});}function handleError(_0x3ef2fa,_0x5465d7,_0x5f18dc){return _0x3ef2fa['status'](_0x5465d7||0x1f4)['send']({'message':_0x5f18dc?_0x5f18dc[_0xcd61('0x2a')]||_0x5f18dc:''});}exports[_0xcd61('0x2c')]=function(_0x165d90,_0x4b097d,_0x16dd1f){passport['authenticate']('local-login',function(_0x5ef3c1,_0x54144f,_0x710dff){var _0x14c854=_0x5ef3c1||_0x710dff;if(_0x14c854){return handleError(_0x4b097d,0x191,_0x14c854);}if(!_0x54144f){return handleError(_0x4b097d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x90196b={'payload':{'id':_0x54144f['id'],'role':_0x54144f[_0xcd61('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0xcd61('0x2e')](_0x90196b)['then'](function(_0x569be2){_0x4b097d[_0xcd61('0x2f')]({'id':_0x54144f['id'],'token':_0x569be2,'statusCall':'','isAlreadyLogged':_0x54144f[_0xcd61('0x30')]});});}})(_0x165d90,_0x4b097d,_0x16dd1f);};exports[_0xcd61('0x31')]=function(_0x328937,_0x3ebf99){if(!_0x328937[_0xcd61('0x32')][_0xcd61('0x25')]){return handleError(_0x3ebf99,0x1f4,{'message':_0xcd61('0x33')});}var _0x323128=rs[_0xcd61('0x34')]();_0x328937['body'][_0xcd61('0x25')]=_0x328937[_0xcd61('0x32')][_0xcd61('0x25')][_0xcd61('0x35')]()[_0xcd61('0x36')]();var _0x2beb26;return db[_0xcd61('0xb')][_0xcd61('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcd61('0x18')],'raw':!![]})['then'](function(_0x153bf8){_0x2beb26=_0x153bf8;return db[_0xcd61('0x37')][_0xcd61('0x1f')]({'where':{'email':_0x328937[_0xcd61('0x32')][_0xcd61('0x25')]}});})['then'](function(_0x4bc4b4){if(!_0x4bc4b4){throw new Error(_0xcd61('0x38'));}if(_0x4bc4b4[_0xcd61('0x11')]){throw new Error(_0xcd61('0x39'));}if(_0x4bc4b4[_0xcd61('0x12')]){if(moment(_0x4bc4b4[_0xcd61('0x13')])[_0xcd61('0x19')](_0x2beb26[_0xcd61('0x18')],'minutes')>moment()){throw new Error(_0xcd61('0x3a'));}else{_0x4bc4b4[_0xcd61('0x12')]=![];_0x4bc4b4[_0xcd61('0x13')]=null;}}_0x4bc4b4[_0xcd61('0x3b')]=_0x323128;_0x4bc4b4['resetPasswordExpires']=Date[_0xcd61('0x3c')]()+0x36ee80;return _0x4bc4b4['save']();})[_0xcd61('0xe')](function(){return sendServiceMail({'to':_0x328937['body'][_0xcd61('0x25')],'subject':_0xcd61('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xcd61('0x3e')+_0xcd61('0x3f')+_0x328937[_0xcd61('0x40')][_0xcd61('0x41')]+_0xcd61('0x42')+_0x323128+'\x0a\x0a'+_0xcd61('0x43')});})[_0xcd61('0xe')](function(){_0x3ebf99[_0xcd61('0x44')](0xc8)[_0xcd61('0x45')]({'message':_0xcd61('0x46')});})[_0xcd61('0x1d')](function(_0xec250e){return handleError(_0x3ebf99,0x1f4,_0xec250e);});};exports[_0xcd61('0x47')]=function(_0x445383,_0x17e962){return db[_0xcd61('0x37')][_0xcd61('0x1f')]({'where':{'resetPasswordToken':_0x445383['params'][_0xcd61('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xcd61('0xe')](function(_0x4ff590){if(!_0x4ff590){throw new Error(_0xcd61('0x49'));}return db[_0xcd61('0xb')][_0xcd61('0xc')]({'attributes':['id',_0xcd61('0x4a'),_0xcd61('0x4b'),_0xcd61('0x4c')]})[_0xcd61('0xe')](function(_0x2c5da6){if(_0x2c5da6[_0xcd61('0x4a')])authService[_0xcd61('0x4d')](_0x445383[_0xcd61('0x32')][_0xcd61('0x10')]);if(!_0x2c5da6[_0xcd61('0x4b')]||!_0x4ff590[_0xcd61('0x4e')])return _0x4ff590;authService[_0xcd61('0x4f')](_0x445383[_0xcd61('0x32')][_0xcd61('0x10')],_0x4ff590['previousPasswords'],_0x2c5da6[_0xcd61('0x4c')]);return _0x4ff590;})[_0xcd61('0xe')](function(){_0x4ff590[_0xcd61('0x10')]=_0x445383[_0xcd61('0x32')][_0xcd61('0x10')];_0x4ff590[_0xcd61('0x3b')]=null;_0x4ff590[_0xcd61('0x50')]=null;return _0x4ff590[_0xcd61('0x51')]();});})['then'](function(){_0x17e962[_0xcd61('0x44')](0xc8)[_0xcd61('0x45')]({'message':_0xcd61('0x52')});})[_0xcd61('0x1d')](function(_0x226f88){return handleError(_0x17e962,0x1f4,_0x226f88);});};passport[_0xcd61('0x53')](_0xcd61('0x54'),new LocalStrategy({'usernameField':_0xcd61('0xf'),'passwordField':'password'},function(_0xd12c8f,_0xb34feb,_0x6d6dc1){return localAuthenticate(db[_0xcd61('0x37')],_0xd12c8f,_0xb34feb,_0x6d6dc1);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 966c080..09aa122 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 _0x38bc=['exports','express','Router','./authLocal.controller','login','post','/forgot','/reset/:token','reset'];(function(_0x3e41c0,_0x592a69){var _0x3e2903=function(_0xc2db0b){while(--_0xc2db0b){_0x3e41c0['push'](_0x3e41c0['shift']());}};_0x3e2903(++_0x592a69);}(_0x38bc,0x1c3));var _0xc38b=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x38bc[_0x4d613c];return _0x301fe3;};'use strict';var express=require(_0xc38b('0x0'));var router=express[_0xc38b('0x1')]();var controller=require(_0xc38b('0x2'));router['post']('/',controller[_0xc38b('0x3')]);router[_0xc38b('0x4')](_0xc38b('0x5'),controller['forgot']);router['post'](_0xc38b('0x6'),controller[_0xc38b('0x7')]);module[_0xc38b('0x8')]=router; \ No newline at end of file +var _0xd449=['exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x3df10f,_0x4c73ec){var _0x5519d6=function(_0x338ceb){while(--_0x338ceb){_0x3df10f['push'](_0x3df10f['shift']());}};_0x5519d6(++_0x4c73ec);}(_0xd449,0x1b9));var _0x9d44=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0xd449[_0xea1570];return _0x579e74;};'use strict';var express=require(_0x9d44('0x0'));var router=express[_0x9d44('0x1')]();var controller=require(_0x9d44('0x2'));router[_0x9d44('0x3')]('/',controller[_0x9d44('0x4')]);router[_0x9d44('0x3')](_0x9d44('0x5'),controller[_0x9d44('0x6')]);router['post'](_0x9d44('0x7'),controller[_0x9d44('0x8')]);module[_0x9d44('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 342d543..73fe361 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 _0xedbd=['sequelize','STRING'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xedbd,0x162));var _0xdedb=function(_0x182812,_0x564202){_0x182812=_0x182812-0x0;var _0x182927=_0xedbd[_0x182812];return _0x182927;};'use strict';var Sequelize=require(_0xdedb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdedb('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xdedb('0x1')]},'description':{'type':Sequelize[_0xdedb('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x6183=['STRING','INTEGER','exports'];(function(_0x95cc9d,_0x361445){var _0x2d53f6=function(_0x21b659){while(--_0x21b659){_0x95cc9d['push'](_0x95cc9d['shift']());}};_0x2d53f6(++_0x361445);}(_0x6183,0x95));var _0x3618=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x6183[_0x209ec9];return _0x129b1b;};'use strict';var Sequelize=require('sequelize');module[_0x3618('0x0')]={'name':{'type':Sequelize[_0x3618('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x3618('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3618('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0b4e65e..3eaead2 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 _0x3f7b=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','addConditions','omit','ids','findOne','Condition','length','getConditions','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x5773b4,_0x460374){var _0x5a8181=function(_0x2bd576){while(--_0x2bd576){_0x5773b4['push'](_0x5773b4['shift']());}};_0x5a8181(++_0x460374);}(_0x3f7b,0x117));var _0xb3f7=function(_0x2211d4,_0x592254){_0x2211d4=_0x2211d4-0x0;var _0x565b56=_0x3f7b[_0x2211d4];return _0x565b56;};'use strict';var emlformat=require(_0xb3f7('0x0'));var rimraf=require(_0xb3f7('0x1'));var zipdir=require(_0xb3f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3f7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb3f7('0x4'));var util=require(_0xb3f7('0x5'));var path=require('path');var sox=require(_0xb3f7('0x6'));var csv=require('to-csv');var ejs=require(_0xb3f7('0x7'));var fs=require('fs');var fs_extra=require(_0xb3f7('0x8'));var _=require(_0xb3f7('0x9'));var squel=require(_0xb3f7('0xa'));var crypto=require(_0xb3f7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3f7('0xc'));var toCsv=require(_0xb3f7('0xd'));var querystring=require(_0xb3f7('0xe'));var Papa=require('papaparse');var Redis=require(_0xb3f7('0xf'));var authService=require(_0xb3f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb3f7('0x11'));var hardwareService=require(_0xb3f7('0x12'));var logger=require(_0xb3f7('0x13'))(_0xb3f7('0x14'));var utils=require('../../config/utils');var config=require(_0xb3f7('0x15'));var licenseUtil=require(_0xb3f7('0x16'));var db=require(_0xb3f7('0x17'))['db'];function respondWithStatusCode(_0x587205,_0x435b93){_0x435b93=_0x435b93||0xcc;return function(_0x3ee2b3){if(_0x3ee2b3){return _0x587205[_0xb3f7('0x18')](_0x435b93);}return _0x587205[_0xb3f7('0x19')](_0x435b93)[_0xb3f7('0x1a')]();};}function respondWithResult(_0x5a3a3f,_0x129749){_0x129749=_0x129749||0xc8;return function(_0xcf28c4){if(_0xcf28c4){return _0x5a3a3f['status'](_0x129749)[_0xb3f7('0x1b')](_0xcf28c4);}};}function respondWithFilteredResult(_0x543573,_0x317bdd){return function(_0x12e1d2){if(_0x12e1d2){var _0x19dadd=typeof _0x317bdd[_0xb3f7('0x1c')]===_0xb3f7('0x1d')&&typeof _0x317bdd[_0xb3f7('0x1e')]===_0xb3f7('0x1d');var _0xcf97f7=_0x12e1d2[_0xb3f7('0x1f')];var _0x3dfeb7=_0x19dadd?0x0:_0x317bdd[_0xb3f7('0x1c')];var _0x5ba469=_0x19dadd?_0x12e1d2[_0xb3f7('0x1f')]:_0x317bdd[_0xb3f7('0x1c')]+_0x317bdd[_0xb3f7('0x1e')];var _0x370ac2;if(_0x5ba469>=_0xcf97f7){_0x5ba469=_0xcf97f7;_0x370ac2=0xc8;}else{_0x370ac2=0xce;}_0x543573[_0xb3f7('0x19')](_0x370ac2);return _0x543573[_0xb3f7('0x20')]('Content-Range',_0x3dfeb7+'-'+_0x5ba469+'/'+_0xcf97f7)[_0xb3f7('0x1b')](_0x12e1d2);}return null;};}function patchUpdates(_0x1d44a2){return function(_0xc5f1f1){try{jsonpatch[_0xb3f7('0x21')](_0xc5f1f1,_0x1d44a2,!![]);}catch(_0x2699ca){return BPromise['reject'](_0x2699ca);}return _0xc5f1f1['save']();};}function saveUpdates(_0x2daf74,_0x1a270d){return function(_0x389329){if(_0x389329){return _0x389329[_0xb3f7('0x22')](_0x2daf74)[_0xb3f7('0x23')](function(_0x13549c){return _0x13549c;});}return null;};}function removeEntity(_0x4e8de9,_0x2b3d7a){return function(_0x49f3f0){if(_0x49f3f0){return _0x49f3f0[_0xb3f7('0x24')]()['then'](function(){_0x4e8de9['status'](0xcc)[_0xb3f7('0x1a')]();});}};}function handleEntityNotFound(_0x80b12b,_0x79a3b2){return function(_0x32e4d4){if(!_0x32e4d4){_0x80b12b[_0xb3f7('0x18')](0x194);}return _0x32e4d4;};}function handleError(_0x4adbfe,_0x3b9698){_0x3b9698=_0x3b9698||0x1f4;return function(_0x4f48bb){logger[_0xb3f7('0x25')](_0x4f48bb[_0xb3f7('0x26')]);if(_0x4f48bb[_0xb3f7('0x27')]){delete _0x4f48bb[_0xb3f7('0x27')];}_0x4adbfe['status'](_0x3b9698)[_0xb3f7('0x28')](_0x4f48bb);};}exports[_0xb3f7('0x29')]=function(_0x2a0d38,_0x17755d){var _0x3a6b68={},_0x5a2566={},_0x38d823={'count':0x0,'rows':[]};var _0x243a02=_[_0xb3f7('0x2a')](db[_0xb3f7('0x2b')][_0xb3f7('0x2c')],function(_0xe04496){return{'name':_0xe04496[_0xb3f7('0x2d')],'type':_0xe04496[_0xb3f7('0x2e')][_0xb3f7('0x2f')]};});_0x5a2566[_0xb3f7('0x30')]=_[_0xb3f7('0x2a')](_0x243a02,_0xb3f7('0x27'));_0x5a2566[_0xb3f7('0x31')]=_['keys'](_0x2a0d38[_0xb3f7('0x31')]);_0x5a2566[_0xb3f7('0x32')]=_[_0xb3f7('0x33')](_0x5a2566[_0xb3f7('0x30')],_0x5a2566[_0xb3f7('0x31')]);_0x3a6b68[_0xb3f7('0x34')]=_[_0xb3f7('0x33')](_0x5a2566[_0xb3f7('0x30')],qs['fields'](_0x2a0d38[_0xb3f7('0x31')][_0xb3f7('0x35')]));_0x3a6b68[_0xb3f7('0x34')]=_0x3a6b68['attributes']['length']?_0x3a6b68[_0xb3f7('0x34')]:_0x5a2566[_0xb3f7('0x30')];if(!_0x2a0d38[_0xb3f7('0x31')][_0xb3f7('0x36')](_0xb3f7('0x37'))){_0x3a6b68[_0xb3f7('0x1e')]=qs[_0xb3f7('0x1e')](_0x2a0d38['query'][_0xb3f7('0x1e')]);_0x3a6b68[_0xb3f7('0x1c')]=qs['offset'](_0x2a0d38[_0xb3f7('0x31')][_0xb3f7('0x1c')]);}_0x3a6b68[_0xb3f7('0x38')]=qs[_0xb3f7('0x39')](_0x2a0d38[_0xb3f7('0x31')][_0xb3f7('0x39')]);_0x3a6b68[_0xb3f7('0x3a')]=qs[_0xb3f7('0x32')](_[_0xb3f7('0x3b')](_0x2a0d38[_0xb3f7('0x31')],_0x5a2566['filters']),_0x243a02);if(_0x2a0d38[_0xb3f7('0x31')][_0xb3f7('0x3c')]){_0x3a6b68[_0xb3f7('0x3a')]=_[_0xb3f7('0x3d')](_0x3a6b68[_0xb3f7('0x3a')],{'$or':_['map'](_0x243a02,function(_0x5b4cc2){if(_0x5b4cc2['type']!=='VIRTUAL'){var _0x3bf5bb={};_0x3bf5bb[_0x5b4cc2[_0xb3f7('0x27')]]={'$like':'%'+_0x2a0d38['query'][_0xb3f7('0x3c')]+'%'};return _0x3bf5bb;}})});}_0x3a6b68=_[_0xb3f7('0x3d')]({},_0x3a6b68,_0x2a0d38[_0xb3f7('0x3e')]);var _0x2fd149={'where':_0x3a6b68[_0xb3f7('0x3a')]};return db[_0xb3f7('0x2b')][_0xb3f7('0x1f')](_0x2fd149)[_0xb3f7('0x23')](function(_0x376af2){_0x38d823[_0xb3f7('0x1f')]=_0x376af2;if(_0x2a0d38['query'][_0xb3f7('0x3f')]){_0x3a6b68[_0xb3f7('0x40')]=[{'all':!![]}];}return db[_0xb3f7('0x2b')][_0xb3f7('0x41')](_0x3a6b68);})[_0xb3f7('0x23')](function(_0x97f317){_0x38d823['rows']=_0x97f317;return _0x38d823;})[_0xb3f7('0x23')](respondWithFilteredResult(_0x17755d,_0x3a6b68))['catch'](handleError(_0x17755d,null));};exports[_0xb3f7('0x42')]=function(_0x54887f,_0x1fa88c){var _0x150e39={'raw':![],'where':{'id':_0x54887f[_0xb3f7('0x43')]['id']}},_0x6cb41e={};_0x6cb41e[_0xb3f7('0x30')]=_[_0xb3f7('0x44')](db['Automation']['rawAttributes']);_0x6cb41e[_0xb3f7('0x31')]=_[_0xb3f7('0x44')](_0x54887f[_0xb3f7('0x31')]);_0x6cb41e[_0xb3f7('0x32')]=_['intersection'](_0x6cb41e[_0xb3f7('0x30')],_0x6cb41e['query']);_0x150e39[_0xb3f7('0x34')]=_[_0xb3f7('0x33')](_0x6cb41e['model'],qs[_0xb3f7('0x35')](_0x54887f[_0xb3f7('0x31')][_0xb3f7('0x35')]));_0x150e39['attributes']=_0x150e39[_0xb3f7('0x34')]['length']?_0x150e39[_0xb3f7('0x34')]:_0x6cb41e['model'];if(_0x54887f[_0xb3f7('0x31')]['includeAll']){_0x150e39[_0xb3f7('0x40')]=[{'all':!![]}];}_0x150e39=_[_0xb3f7('0x3d')]({},_0x150e39,_0x54887f['options']);return db[_0xb3f7('0x2b')][_0xb3f7('0x45')](_0x150e39)['then'](handleEntityNotFound(_0x1fa88c,null))[_0xb3f7('0x23')](respondWithResult(_0x1fa88c,null))[_0xb3f7('0x46')](handleError(_0x1fa88c,null));};exports[_0xb3f7('0x47')]=function(_0x472c2c,_0x55ed1d){return db[_0xb3f7('0x2b')][_0xb3f7('0x47')](_0x472c2c[_0xb3f7('0x48')],{})[_0xb3f7('0x23')](respondWithResult(_0x55ed1d,0xc9))[_0xb3f7('0x46')](handleError(_0x55ed1d,null));};exports['update']=function(_0x1f9adb,_0x50361f){if(_0x1f9adb[_0xb3f7('0x48')]['id']){delete _0x1f9adb[_0xb3f7('0x48')]['id'];}return db[_0xb3f7('0x2b')][_0xb3f7('0x45')]({'where':{'id':_0x1f9adb[_0xb3f7('0x43')]['id']}})[_0xb3f7('0x23')](handleEntityNotFound(_0x50361f,null))[_0xb3f7('0x23')](saveUpdates(_0x1f9adb[_0xb3f7('0x48')],null))['then'](respondWithResult(_0x50361f,null))['catch'](handleError(_0x50361f,null));};exports[_0xb3f7('0x24')]=function(_0x43ddcc,_0x1f88f5){return db[_0xb3f7('0x2b')][_0xb3f7('0x45')]({'where':{'id':_0x43ddcc[_0xb3f7('0x43')]['id']}})[_0xb3f7('0x23')](handleEntityNotFound(_0x1f88f5,null))[_0xb3f7('0x23')](removeEntity(_0x1f88f5,null))[_0xb3f7('0x46')](handleError(_0x1f88f5,null));};exports[_0xb3f7('0x49')]=function(_0x5128de,_0x2ac948,_0x5ba4e3){return db['Condition'][_0xb3f7('0x45')]({'where':{'id':_0x5128de[_0xb3f7('0x43')]['id']}})[_0xb3f7('0x23')](handleEntityNotFound(_0x2ac948,null))[_0xb3f7('0x23')](function(_0x1dc1e5){if(_0x1dc1e5){return _0x1dc1e5[_0xb3f7('0x49')](_0x5128de[_0xb3f7('0x48')]['ids'],_[_0xb3f7('0x4a')](_0x5128de[_0xb3f7('0x48')],[_0xb3f7('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x2ac948,null))[_0xb3f7('0x46')](handleError(_0x2ac948,null));};exports['getConditions']=function(_0x10c917,_0x65c1d4,_0x1de412){var _0x33803e={};var _0x5d3573={};var _0x1f79b8;var _0x426ec7;return db[_0xb3f7('0x2b')][_0xb3f7('0x4c')]({'where':{'id':_0x10c917[_0xb3f7('0x43')]['id']}})[_0xb3f7('0x23')](handleEntityNotFound(_0x65c1d4,null))[_0xb3f7('0x23')](function(_0xe631ea){if(_0xe631ea){_0x1f79b8=_0xe631ea;_0x5d3573['model']=_[_0xb3f7('0x44')](db[_0xb3f7('0x4d')][_0xb3f7('0x2c')]);_0x5d3573['query']=_[_0xb3f7('0x44')](_0x10c917[_0xb3f7('0x31')]);_0x5d3573[_0xb3f7('0x32')]=_[_0xb3f7('0x33')](_0x5d3573['model'],_0x5d3573[_0xb3f7('0x31')]);_0x33803e[_0xb3f7('0x34')]=_[_0xb3f7('0x33')](_0x5d3573[_0xb3f7('0x30')],qs['fields'](_0x10c917[_0xb3f7('0x31')]['fields']));_0x33803e['attributes']=_0x33803e[_0xb3f7('0x34')][_0xb3f7('0x4e')]?_0x33803e[_0xb3f7('0x34')]:_0x5d3573[_0xb3f7('0x30')];_0x33803e[_0xb3f7('0x38')]=qs['sort'](_0x10c917['query']['sort']);_0x33803e[_0xb3f7('0x3a')]=qs[_0xb3f7('0x32')](_['pick'](_0x10c917[_0xb3f7('0x31')],_0x5d3573[_0xb3f7('0x32')]));if(_0x10c917[_0xb3f7('0x31')]['filter']){_0x33803e[_0xb3f7('0x3a')]=_[_0xb3f7('0x3d')](_0x33803e[_0xb3f7('0x3a')],{'$or':_[_0xb3f7('0x2a')](_0x33803e[_0xb3f7('0x34')],function(_0x128617){var _0x5f84c4={};_0x5f84c4[_0x128617]={'$like':'%'+_0x10c917[_0xb3f7('0x31')][_0xb3f7('0x3c')]+'%'};return _0x5f84c4;})});}_0x33803e=_[_0xb3f7('0x3d')]({},_0x33803e,_0x10c917[_0xb3f7('0x3e')]);return _0x1f79b8[_0xb3f7('0x4f')](_0x33803e);}})['then'](function(_0x31cd87){if(_0x31cd87){_0x426ec7=_0x31cd87[_0xb3f7('0x4e')];if(!_0x10c917[_0xb3f7('0x31')]['hasOwnProperty'](_0xb3f7('0x37'))){_0x33803e['limit']=qs[_0xb3f7('0x1e')](_0x10c917[_0xb3f7('0x31')][_0xb3f7('0x1e')]);_0x33803e[_0xb3f7('0x1c')]=qs[_0xb3f7('0x1c')](_0x10c917[_0xb3f7('0x31')][_0xb3f7('0x1c')]);}return _0x1f79b8['getConditions'](_0x33803e);}})[_0xb3f7('0x23')](function(_0x257457){if(_0x257457){return _0x257457?{'count':_0x426ec7,'rows':_0x257457}:null;}})[_0xb3f7('0x23')](respondWithResult(_0x65c1d4,null))[_0xb3f7('0x46')](handleError(_0x65c1d4,null));};exports[_0xb3f7('0x50')]=function(_0x469861,_0x4463a9,_0xdb8e8f){return db[_0xb3f7('0x51')][_0xb3f7('0x45')]({'where':{'id':_0x469861['params']['id']}})[_0xb3f7('0x23')](handleEntityNotFound(_0x4463a9,null))[_0xb3f7('0x23')](function(_0x26dbaf){if(_0x26dbaf){return _0x26dbaf[_0xb3f7('0x50')](_0x469861[_0xb3f7('0x48')]['ids'],_[_0xb3f7('0x4a')](_0x469861[_0xb3f7('0x48')],[_0xb3f7('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x4463a9,null))[_0xb3f7('0x46')](handleError(_0x4463a9,null));};exports[_0xb3f7('0x52')]=function(_0x24f1d4,_0x810f1c,_0x80288c){var _0x5e672e={};var _0x1826e2={};var _0xce6175;var _0x1d18f6;return db[_0xb3f7('0x2b')]['findOne']({'where':{'id':_0x24f1d4[_0xb3f7('0x43')]['id']}})[_0xb3f7('0x23')](handleEntityNotFound(_0x810f1c,null))[_0xb3f7('0x23')](function(_0x705bb3){if(_0x705bb3){_0xce6175=_0x705bb3;_0x1826e2[_0xb3f7('0x30')]=_['keys'](db[_0xb3f7('0x51')][_0xb3f7('0x2c')]);_0x1826e2[_0xb3f7('0x31')]=_[_0xb3f7('0x44')](_0x24f1d4[_0xb3f7('0x31')]);_0x1826e2['filters']=_[_0xb3f7('0x33')](_0x1826e2[_0xb3f7('0x30')],_0x1826e2[_0xb3f7('0x31')]);_0x5e672e['attributes']=_[_0xb3f7('0x33')](_0x1826e2[_0xb3f7('0x30')],qs[_0xb3f7('0x35')](_0x24f1d4[_0xb3f7('0x31')][_0xb3f7('0x35')]));_0x5e672e[_0xb3f7('0x34')]=_0x5e672e['attributes'][_0xb3f7('0x4e')]?_0x5e672e[_0xb3f7('0x34')]:_0x1826e2[_0xb3f7('0x30')];_0x5e672e['order']=qs[_0xb3f7('0x39')](_0x24f1d4[_0xb3f7('0x31')][_0xb3f7('0x39')]);_0x5e672e['where']=qs['filters'](_[_0xb3f7('0x3b')](_0x24f1d4[_0xb3f7('0x31')],_0x1826e2[_0xb3f7('0x32')]));if(_0x24f1d4[_0xb3f7('0x31')][_0xb3f7('0x3c')]){_0x5e672e[_0xb3f7('0x3a')]=_[_0xb3f7('0x3d')](_0x5e672e['where'],{'$or':_[_0xb3f7('0x2a')](_0x5e672e[_0xb3f7('0x34')],function(_0x536d77){var _0x2214fa={};_0x2214fa[_0x536d77]={'$like':'%'+_0x24f1d4['query']['filter']+'%'};return _0x2214fa;})});}_0x5e672e=_['merge']({},_0x5e672e,_0x24f1d4['options']);return _0xce6175[_0xb3f7('0x52')](_0x5e672e);}})[_0xb3f7('0x23')](function(_0x4ccf43){if(_0x4ccf43){_0x1d18f6=_0x4ccf43[_0xb3f7('0x4e')];if(!_0x24f1d4[_0xb3f7('0x31')][_0xb3f7('0x36')](_0xb3f7('0x37'))){_0x5e672e[_0xb3f7('0x1e')]=qs['limit'](_0x24f1d4[_0xb3f7('0x31')]['limit']);_0x5e672e['offset']=qs['offset'](_0x24f1d4[_0xb3f7('0x31')][_0xb3f7('0x1c')]);}return _0xce6175[_0xb3f7('0x52')](_0x5e672e);}})[_0xb3f7('0x23')](function(_0x1f8227){if(_0x1f8227){return _0x1f8227?{'count':_0x1d18f6,'rows':_0x1f8227}:null;}})[_0xb3f7('0x23')](respondWithResult(_0x810f1c,null))[_0xb3f7('0x46')](handleError(_0x810f1c,null));}; \ No newline at end of file +var _0xf4cc=['status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Automation','findAll','rows','catch','show','params','includeAll','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','nolimit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x217751,_0x5a0349){var _0x66446b=function(_0x10a50d){while(--_0x10a50d){_0x217751['push'](_0x217751['shift']());}};_0x66446b(++_0x5a0349);}(_0xf4cc,0x197));var _0xcf4c=function(_0xc26892,_0x2bb25b){_0xc26892=_0xc26892-0x0;var _0x14b0b4=_0xf4cc[_0xc26892];return _0x14b0b4;};'use strict';var emlformat=require(_0xcf4c('0x0'));var rimraf=require(_0xcf4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf4c('0x2'));var rp=require(_0xcf4c('0x3'));var moment=require('moment');var BPromise=require(_0xcf4c('0x4'));var Mustache=require(_0xcf4c('0x5'));var util=require(_0xcf4c('0x6'));var path=require(_0xcf4c('0x7'));var sox=require(_0xcf4c('0x8'));var csv=require(_0xcf4c('0x9'));var ejs=require(_0xcf4c('0xa'));var fs=require('fs');var fs_extra=require(_0xcf4c('0xb'));var _=require(_0xcf4c('0xc'));var squel=require(_0xcf4c('0xd'));var crypto=require(_0xcf4c('0xe'));var jsforce=require(_0xcf4c('0xf'));var deskjs=require(_0xcf4c('0x10'));var toCsv=require(_0xcf4c('0x9'));var querystring=require(_0xcf4c('0x11'));var Papa=require(_0xcf4c('0x12'));var Redis=require(_0xcf4c('0x13'));var authService=require(_0xcf4c('0x14'));var qs=require(_0xcf4c('0x15'));var as=require(_0xcf4c('0x16'));var hardwareService=require(_0xcf4c('0x17'));var logger=require(_0xcf4c('0x18'))(_0xcf4c('0x19'));var utils=require('../../config/utils');var config=require(_0xcf4c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf4c('0x1b'))['db'];function respondWithStatusCode(_0x53d171,_0x199bab){_0x199bab=_0x199bab||0xcc;return function(_0x252fcf){if(_0x252fcf){return _0x53d171['sendStatus'](_0x199bab);}return _0x53d171[_0xcf4c('0x1c')](_0x199bab)[_0xcf4c('0x1d')]();};}function respondWithResult(_0x42af8d,_0x3cdc74){_0x3cdc74=_0x3cdc74||0xc8;return function(_0x2b5620){if(_0x2b5620){return _0x42af8d[_0xcf4c('0x1c')](_0x3cdc74)[_0xcf4c('0x1e')](_0x2b5620);}};}function respondWithFilteredResult(_0x9f4533,_0x2eccf8){return function(_0x56a4f3){if(_0x56a4f3){var _0x1894ab=typeof _0x2eccf8[_0xcf4c('0x1f')]==='undefined'&&typeof _0x2eccf8[_0xcf4c('0x20')]===_0xcf4c('0x21');var _0x1e11f7=_0x56a4f3[_0xcf4c('0x22')];var _0x22b01e=_0x1894ab?0x0:_0x2eccf8[_0xcf4c('0x1f')];var _0x1297e1=_0x1894ab?_0x56a4f3['count']:_0x2eccf8[_0xcf4c('0x1f')]+_0x2eccf8[_0xcf4c('0x20')];var _0x573be8;if(_0x1297e1>=_0x1e11f7){_0x1297e1=_0x1e11f7;_0x573be8=0xc8;}else{_0x573be8=0xce;}_0x9f4533[_0xcf4c('0x1c')](_0x573be8);return _0x9f4533['set'](_0xcf4c('0x23'),_0x22b01e+'-'+_0x1297e1+'/'+_0x1e11f7)[_0xcf4c('0x1e')](_0x56a4f3);}return null;};}function patchUpdates(_0x3e80dc){return function(_0x568b4e){try{jsonpatch[_0xcf4c('0x24')](_0x568b4e,_0x3e80dc,!![]);}catch(_0x443430){return BPromise[_0xcf4c('0x25')](_0x443430);}return _0x568b4e[_0xcf4c('0x26')]();};}function saveUpdates(_0x560f97,_0x40f841){return function(_0x1ba4bb){if(_0x1ba4bb){return _0x1ba4bb[_0xcf4c('0x27')](_0x560f97)[_0xcf4c('0x28')](function(_0x12b56a){return _0x12b56a;});}return null;};}function removeEntity(_0x188dc0,_0x2eec88){return function(_0x238eb6){if(_0x238eb6){return _0x238eb6[_0xcf4c('0x29')]()['then'](function(){_0x188dc0[_0xcf4c('0x1c')](0xcc)[_0xcf4c('0x1d')]();});}};}function handleEntityNotFound(_0x243930,_0x2c1925){return function(_0x4094f8){if(!_0x4094f8){_0x243930['sendStatus'](0x194);}return _0x4094f8;};}function handleError(_0x1dad7a,_0x5ca4ae){_0x5ca4ae=_0x5ca4ae||0x1f4;return function(_0x3a4a94){logger[_0xcf4c('0x2a')](_0x3a4a94[_0xcf4c('0x2b')]);if(_0x3a4a94[_0xcf4c('0x2c')]){delete _0x3a4a94[_0xcf4c('0x2c')];}_0x1dad7a[_0xcf4c('0x1c')](_0x5ca4ae)[_0xcf4c('0x2d')](_0x3a4a94);};}exports[_0xcf4c('0x2e')]=function(_0x2b0f05,_0x2c7b64){var _0x15e170={},_0xcaa680={},_0x26d12d={'count':0x0,'rows':[]};var _0x26a829=_[_0xcf4c('0x2f')](db['Automation'][_0xcf4c('0x30')],function(_0x5bd96e){return{'name':_0x5bd96e[_0xcf4c('0x31')],'type':_0x5bd96e[_0xcf4c('0x32')]['key']};});_0xcaa680[_0xcf4c('0x33')]=_[_0xcf4c('0x2f')](_0x26a829,_0xcf4c('0x2c'));_0xcaa680[_0xcf4c('0x34')]=_[_0xcf4c('0x35')](_0x2b0f05['query']);_0xcaa680[_0xcf4c('0x36')]=_[_0xcf4c('0x37')](_0xcaa680['model'],_0xcaa680[_0xcf4c('0x34')]);_0x15e170[_0xcf4c('0x38')]=_[_0xcf4c('0x37')](_0xcaa680[_0xcf4c('0x33')],qs[_0xcf4c('0x39')](_0x2b0f05[_0xcf4c('0x34')][_0xcf4c('0x39')]));_0x15e170[_0xcf4c('0x38')]=_0x15e170[_0xcf4c('0x38')][_0xcf4c('0x3a')]?_0x15e170[_0xcf4c('0x38')]:_0xcaa680[_0xcf4c('0x33')];if(!_0x2b0f05['query'][_0xcf4c('0x3b')]('nolimit')){_0x15e170[_0xcf4c('0x20')]=qs[_0xcf4c('0x20')](_0x2b0f05[_0xcf4c('0x34')][_0xcf4c('0x20')]);_0x15e170[_0xcf4c('0x1f')]=qs[_0xcf4c('0x1f')](_0x2b0f05[_0xcf4c('0x34')][_0xcf4c('0x1f')]);}_0x15e170[_0xcf4c('0x3c')]=qs[_0xcf4c('0x3d')](_0x2b0f05[_0xcf4c('0x34')][_0xcf4c('0x3d')]);_0x15e170[_0xcf4c('0x3e')]=qs['filters'](_[_0xcf4c('0x3f')](_0x2b0f05[_0xcf4c('0x34')],_0xcaa680[_0xcf4c('0x36')]),_0x26a829);if(_0x2b0f05[_0xcf4c('0x34')]['filter']){_0x15e170[_0xcf4c('0x3e')]=_['merge'](_0x15e170['where'],{'$or':_[_0xcf4c('0x2f')](_0x26a829,function(_0x1fc9ff){if(_0x1fc9ff[_0xcf4c('0x32')]!=='VIRTUAL'){var _0x291495={};_0x291495[_0x1fc9ff['name']]={'$like':'%'+_0x2b0f05['query'][_0xcf4c('0x40')]+'%'};return _0x291495;}})});}_0x15e170=_[_0xcf4c('0x41')]({},_0x15e170,_0x2b0f05[_0xcf4c('0x42')]);var _0xd3886e={'where':_0x15e170[_0xcf4c('0x3e')]};return db['Automation'][_0xcf4c('0x22')](_0xd3886e)[_0xcf4c('0x28')](function(_0x455d33){_0x26d12d['count']=_0x455d33;if(_0x2b0f05['query']['includeAll']){_0x15e170['include']=[{'all':!![]}];}return db[_0xcf4c('0x43')][_0xcf4c('0x44')](_0x15e170);})[_0xcf4c('0x28')](function(_0x4af220){_0x26d12d[_0xcf4c('0x45')]=_0x4af220;return _0x26d12d;})[_0xcf4c('0x28')](respondWithFilteredResult(_0x2c7b64,_0x15e170))[_0xcf4c('0x46')](handleError(_0x2c7b64,null));};exports[_0xcf4c('0x47')]=function(_0x3eb309,_0x276da6){var _0x4d5be7={'raw':![],'where':{'id':_0x3eb309[_0xcf4c('0x48')]['id']}},_0xde32c8={};_0xde32c8[_0xcf4c('0x33')]=_['keys'](db[_0xcf4c('0x43')][_0xcf4c('0x30')]);_0xde32c8[_0xcf4c('0x34')]=_[_0xcf4c('0x35')](_0x3eb309[_0xcf4c('0x34')]);_0xde32c8[_0xcf4c('0x36')]=_[_0xcf4c('0x37')](_0xde32c8[_0xcf4c('0x33')],_0xde32c8['query']);_0x4d5be7['attributes']=_[_0xcf4c('0x37')](_0xde32c8['model'],qs[_0xcf4c('0x39')](_0x3eb309[_0xcf4c('0x34')][_0xcf4c('0x39')]));_0x4d5be7[_0xcf4c('0x38')]=_0x4d5be7[_0xcf4c('0x38')][_0xcf4c('0x3a')]?_0x4d5be7[_0xcf4c('0x38')]:_0xde32c8[_0xcf4c('0x33')];if(_0x3eb309['query'][_0xcf4c('0x49')]){_0x4d5be7['include']=[{'all':!![]}];}_0x4d5be7=_[_0xcf4c('0x41')]({},_0x4d5be7,_0x3eb309[_0xcf4c('0x42')]);return db[_0xcf4c('0x43')][_0xcf4c('0x4a')](_0x4d5be7)['then'](handleEntityNotFound(_0x276da6,null))['then'](respondWithResult(_0x276da6,null))[_0xcf4c('0x46')](handleError(_0x276da6,null));};exports['create']=function(_0x5cf5b2,_0x4bc1a3){return db[_0xcf4c('0x43')][_0xcf4c('0x4b')](_0x5cf5b2[_0xcf4c('0x4c')],{})[_0xcf4c('0x28')](respondWithResult(_0x4bc1a3,0xc9))['catch'](handleError(_0x4bc1a3,null));};exports['update']=function(_0x3f9836,_0x8fad9f){if(_0x3f9836[_0xcf4c('0x4c')]['id']){delete _0x3f9836[_0xcf4c('0x4c')]['id'];}return db[_0xcf4c('0x43')]['find']({'where':{'id':_0x3f9836[_0xcf4c('0x48')]['id']}})['then'](handleEntityNotFound(_0x8fad9f,null))[_0xcf4c('0x28')](saveUpdates(_0x3f9836[_0xcf4c('0x4c')],null))[_0xcf4c('0x28')](respondWithResult(_0x8fad9f,null))['catch'](handleError(_0x8fad9f,null));};exports['destroy']=function(_0xfd8193,_0x381ae2){return db['Automation'][_0xcf4c('0x4a')]({'where':{'id':_0xfd8193['params']['id']}})[_0xcf4c('0x28')](handleEntityNotFound(_0x381ae2,null))[_0xcf4c('0x28')](removeEntity(_0x381ae2,null))[_0xcf4c('0x46')](handleError(_0x381ae2,null));};exports[_0xcf4c('0x4d')]=function(_0x35d89f,_0x265bcf,_0x1f066b){return db[_0xcf4c('0x4e')][_0xcf4c('0x4a')]({'where':{'id':_0x35d89f[_0xcf4c('0x48')]['id']}})[_0xcf4c('0x28')](handleEntityNotFound(_0x265bcf,null))[_0xcf4c('0x28')](function(_0x3e0b53){if(_0x3e0b53){return _0x3e0b53['addConditions'](_0x35d89f[_0xcf4c('0x4c')][_0xcf4c('0x4f')],_[_0xcf4c('0x50')](_0x35d89f['body'],[_0xcf4c('0x4f'),'id'])||{});}})[_0xcf4c('0x28')](respondWithResult(_0x265bcf,null))[_0xcf4c('0x46')](handleError(_0x265bcf,null));};exports[_0xcf4c('0x51')]=function(_0x402d1b,_0x59b8b4,_0x3d85ad){var _0x2cf6fd={};var _0x347b41={};var _0x593e10;var _0x2f54f4;return db['Automation'][_0xcf4c('0x52')]({'where':{'id':_0x402d1b[_0xcf4c('0x48')]['id']}})['then'](handleEntityNotFound(_0x59b8b4,null))[_0xcf4c('0x28')](function(_0x5aa39f){if(_0x5aa39f){_0x593e10=_0x5aa39f;_0x347b41[_0xcf4c('0x33')]=_[_0xcf4c('0x35')](db[_0xcf4c('0x4e')][_0xcf4c('0x30')]);_0x347b41[_0xcf4c('0x34')]=_['keys'](_0x402d1b[_0xcf4c('0x34')]);_0x347b41[_0xcf4c('0x36')]=_[_0xcf4c('0x37')](_0x347b41[_0xcf4c('0x33')],_0x347b41[_0xcf4c('0x34')]);_0x2cf6fd[_0xcf4c('0x38')]=_[_0xcf4c('0x37')](_0x347b41[_0xcf4c('0x33')],qs[_0xcf4c('0x39')](_0x402d1b[_0xcf4c('0x34')]['fields']));_0x2cf6fd['attributes']=_0x2cf6fd[_0xcf4c('0x38')]['length']?_0x2cf6fd[_0xcf4c('0x38')]:_0x347b41[_0xcf4c('0x33')];_0x2cf6fd['order']=qs[_0xcf4c('0x3d')](_0x402d1b[_0xcf4c('0x34')][_0xcf4c('0x3d')]);_0x2cf6fd[_0xcf4c('0x3e')]=qs[_0xcf4c('0x36')](_['pick'](_0x402d1b[_0xcf4c('0x34')],_0x347b41[_0xcf4c('0x36')]));if(_0x402d1b[_0xcf4c('0x34')][_0xcf4c('0x40')]){_0x2cf6fd[_0xcf4c('0x3e')]=_['merge'](_0x2cf6fd[_0xcf4c('0x3e')],{'$or':_[_0xcf4c('0x2f')](_0x2cf6fd[_0xcf4c('0x38')],function(_0x24cfba){var _0x4b1e69={};_0x4b1e69[_0x24cfba]={'$like':'%'+_0x402d1b[_0xcf4c('0x34')]['filter']+'%'};return _0x4b1e69;})});}_0x2cf6fd=_[_0xcf4c('0x41')]({},_0x2cf6fd,_0x402d1b['options']);return _0x593e10[_0xcf4c('0x51')](_0x2cf6fd);}})[_0xcf4c('0x28')](function(_0x297f29){if(_0x297f29){_0x2f54f4=_0x297f29[_0xcf4c('0x3a')];if(!_0x402d1b[_0xcf4c('0x34')][_0xcf4c('0x3b')]('nolimit')){_0x2cf6fd[_0xcf4c('0x20')]=qs[_0xcf4c('0x20')](_0x402d1b[_0xcf4c('0x34')][_0xcf4c('0x20')]);_0x2cf6fd[_0xcf4c('0x1f')]=qs[_0xcf4c('0x1f')](_0x402d1b['query']['offset']);}return _0x593e10[_0xcf4c('0x51')](_0x2cf6fd);}})[_0xcf4c('0x28')](function(_0x181607){if(_0x181607){return _0x181607?{'count':_0x2f54f4,'rows':_0x181607}:null;}})[_0xcf4c('0x28')](respondWithResult(_0x59b8b4,null))[_0xcf4c('0x46')](handleError(_0x59b8b4,null));};exports[_0xcf4c('0x53')]=function(_0x350fb6,_0x17f579,_0x271be6){return db[_0xcf4c('0x54')][_0xcf4c('0x4a')]({'where':{'id':_0x350fb6[_0xcf4c('0x48')]['id']}})[_0xcf4c('0x28')](handleEntityNotFound(_0x17f579,null))['then'](function(_0x1a9560){if(_0x1a9560){return _0x1a9560[_0xcf4c('0x53')](_0x350fb6[_0xcf4c('0x4c')][_0xcf4c('0x4f')],_[_0xcf4c('0x50')](_0x350fb6['body'],['ids','id'])||{});}})[_0xcf4c('0x28')](respondWithResult(_0x17f579,null))[_0xcf4c('0x46')](handleError(_0x17f579,null));};exports[_0xcf4c('0x55')]=function(_0x256c61,_0x117925,_0xcbefe8){var _0x48c5ba={};var _0x27a95f={};var _0x39396a;var _0x1fcb12;return db['Automation'][_0xcf4c('0x52')]({'where':{'id':_0x256c61[_0xcf4c('0x48')]['id']}})['then'](handleEntityNotFound(_0x117925,null))['then'](function(_0x24e378){if(_0x24e378){_0x39396a=_0x24e378;_0x27a95f[_0xcf4c('0x33')]=_[_0xcf4c('0x35')](db[_0xcf4c('0x54')]['rawAttributes']);_0x27a95f[_0xcf4c('0x34')]=_['keys'](_0x256c61[_0xcf4c('0x34')]);_0x27a95f[_0xcf4c('0x36')]=_[_0xcf4c('0x37')](_0x27a95f[_0xcf4c('0x33')],_0x27a95f[_0xcf4c('0x34')]);_0x48c5ba[_0xcf4c('0x38')]=_['intersection'](_0x27a95f[_0xcf4c('0x33')],qs[_0xcf4c('0x39')](_0x256c61[_0xcf4c('0x34')][_0xcf4c('0x39')]));_0x48c5ba[_0xcf4c('0x38')]=_0x48c5ba['attributes'][_0xcf4c('0x3a')]?_0x48c5ba[_0xcf4c('0x38')]:_0x27a95f['model'];_0x48c5ba[_0xcf4c('0x3c')]=qs['sort'](_0x256c61[_0xcf4c('0x34')][_0xcf4c('0x3d')]);_0x48c5ba[_0xcf4c('0x3e')]=qs['filters'](_[_0xcf4c('0x3f')](_0x256c61[_0xcf4c('0x34')],_0x27a95f[_0xcf4c('0x36')]));if(_0x256c61[_0xcf4c('0x34')][_0xcf4c('0x40')]){_0x48c5ba[_0xcf4c('0x3e')]=_[_0xcf4c('0x41')](_0x48c5ba['where'],{'$or':_['map'](_0x48c5ba[_0xcf4c('0x38')],function(_0x11ea42){var _0x392426={};_0x392426[_0x11ea42]={'$like':'%'+_0x256c61[_0xcf4c('0x34')][_0xcf4c('0x40')]+'%'};return _0x392426;})});}_0x48c5ba=_[_0xcf4c('0x41')]({},_0x48c5ba,_0x256c61['options']);return _0x39396a[_0xcf4c('0x55')](_0x48c5ba);}})[_0xcf4c('0x28')](function(_0x47aa3b){if(_0x47aa3b){_0x1fcb12=_0x47aa3b[_0xcf4c('0x3a')];if(!_0x256c61[_0xcf4c('0x34')][_0xcf4c('0x3b')](_0xcf4c('0x56'))){_0x48c5ba[_0xcf4c('0x20')]=qs['limit'](_0x256c61['query'][_0xcf4c('0x20')]);_0x48c5ba['offset']=qs['offset'](_0x256c61[_0xcf4c('0x34')][_0xcf4c('0x1f')]);}return _0x39396a[_0xcf4c('0x55')](_0x48c5ba);}})[_0xcf4c('0x28')](function(_0x1293e9){if(_0x1293e9){return _0x1293e9?{'count':_0x1fcb12,'rows':_0x1293e9}:null;}})['then'](respondWithResult(_0x117925,null))[_0xcf4c('0x46')](handleError(_0x117925,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 646ea64..2f5e17b 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 _0x2b65=['path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','api','moment','request-promise'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x2b65,0x131));var _0x52b6=function(_0x5f584a,_0x47f064){_0x5f584a=_0x5f584a-0x0;var _0x3788d9=_0x2b65[_0x5f584a];return _0x3788d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x52b6('0x0'));var moment=require(_0x52b6('0x1'));var BPromise=require('bluebird');var rp=require(_0x52b6('0x2'));var fs=require('fs');var path=require(_0x52b6('0x3'));var rimraf=require(_0x52b6('0x4'));var config=require(_0x52b6('0x5'));var attributes=require(_0x52b6('0x6'));module[_0x52b6('0x7')]=function(_0x900710,_0x5779b0){return _0x900710[_0x52b6('0x8')](_0x52b6('0x9'),attributes,{'tableName':_0x52b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf097=['exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./automation.attributes'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xf097,0x1a4));var _0x7f09=function(_0x4cc860,_0xf7eea3){_0x4cc860=_0x4cc860-0x0;var _0x1d01ff=_0xf097[_0x4cc860];return _0x1d01ff;};'use strict';var _=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var logger=require(_0x7f09('0x2'))(_0x7f09('0x3'));var moment=require('moment');var BPromise=require(_0x7f09('0x4'));var rp=require(_0x7f09('0x5'));var fs=require('fs');var path=require(_0x7f09('0x6'));var rimraf=require('rimraf');var config=require(_0x7f09('0x7'));var attributes=require(_0x7f09('0x8'));module[_0x7f09('0x9')]=function(_0xd5de49,_0x2f080c){return _0xd5de49[_0x7f09('0xa')](_0x7f09('0xb'),attributes,{'tableName':_0x7f09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c3667ab..29e94e4 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 _0x225b=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x476036,_0x13c6a6){var _0x30b0ef=function(_0x35af25){while(--_0x35af25){_0x476036['push'](_0x476036['shift']());}};_0x30b0ef(++_0x13c6a6);}(_0x225b,0xb1));var _0xb225=function(_0x3e9d9f,_0x55766d){_0x3e9d9f=_0x3e9d9f-0x0;var _0xd04a20=_0x225b[_0x3e9d9f];return _0xd04a20;};'use strict';var _=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var moment=require('moment');var BPromise=require(_0xb225('0x2'));var rs=require(_0xb225('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb225('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb225('0x5'))('rpc');var config=require(_0xb225('0x6'));var jayson=require(_0xb225('0x7'));var client=jayson[_0xb225('0x8')][_0xb225('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37e0a1,_0x3f25e6,_0x31a718){return new BPromise(function(_0x4da794,_0x168aa8){return client[_0xb225('0xa')](_0x37e0a1,_0x31a718)[_0xb225('0xb')](function(_0xccc2e3){logger['info'](_0xb225('0xc'),_0x3f25e6,_0xb225('0xd'));logger[_0xb225('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x3f25e6,_0xb225('0xd'),JSON[_0xb225('0xf')](_0xccc2e3));if(_0xccc2e3[_0xb225('0x10')]){if(_0xccc2e3[_0xb225('0x10')][_0xb225('0x11')]===0x1f4){logger['error'](_0xb225('0xc'),_0x3f25e6,_0xccc2e3[_0xb225('0x10')][_0xb225('0x12')]);return _0x168aa8(_0xccc2e3[_0xb225('0x10')][_0xb225('0x12')]);}logger['error']('Automation,\x20%s,\x20%s',_0x3f25e6,_0xccc2e3[_0xb225('0x10')][_0xb225('0x12')]);return _0x4da794(_0xccc2e3[_0xb225('0x10')][_0xb225('0x12')]);}else{logger[_0xb225('0x13')](_0xb225('0xc'),_0x3f25e6,_0xb225('0xd'));_0x4da794(_0xccc2e3[_0xb225('0x14')][_0xb225('0x12')]);}})[_0xb225('0x15')](function(_0x343ff8){logger[_0xb225('0x10')]('Automation,\x20%s,\x20%s',_0x3f25e6,_0x343ff8);_0x168aa8(_0x343ff8);});});} \ No newline at end of file +var _0xfa94=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa94,0xef));var _0x4fa9=function(_0x51f012,_0x629f0d){_0x51f012=_0x51f012-0x0;var _0x1e3e8f=_0xfa94[_0x51f012];return _0x1e3e8f;};'use strict';var _=require(_0x4fa9('0x0'));var util=require('util');var moment=require(_0x4fa9('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fa9('0x2'));var fs=require('fs');var Redis=require(_0x4fa9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fa9('0x4'));var logger=require(_0x4fa9('0x5'))(_0x4fa9('0x6'));var config=require(_0x4fa9('0x7'));var jayson=require(_0x4fa9('0x8'));var client=jayson[_0x4fa9('0x9')][_0x4fa9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56faa9,_0xd4dcad,_0x2fb0b3){return new BPromise(function(_0x48fe52,_0x500b64){return client[_0x4fa9('0xb')](_0x56faa9,_0x2fb0b3)['then'](function(_0x2049ea){logger[_0x4fa9('0xc')](_0x4fa9('0xd'),_0xd4dcad,'request\x20sent');logger[_0x4fa9('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0xd4dcad,_0x4fa9('0xf'),JSON[_0x4fa9('0x10')](_0x2049ea));if(_0x2049ea['error']){if(_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x12')]===0x1f4){logger[_0x4fa9('0x11')]('Automation,\x20%s,\x20%s',_0xd4dcad,_0x2049ea[_0x4fa9('0x11')]['message']);return _0x500b64(_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x13')]);}logger['error'](_0x4fa9('0xd'),_0xd4dcad,_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x13')]);return _0x48fe52(_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x13')]);}else{logger[_0x4fa9('0xc')](_0x4fa9('0xd'),_0xd4dcad,_0x4fa9('0xf'));_0x48fe52(_0x2049ea[_0x4fa9('0x14')]['message']);}})[_0x4fa9('0x15')](function(_0x1a1117){logger['error']('Automation,\x20%s,\x20%s',_0xd4dcad,_0x1a1117);_0x500b64(_0x1a1117);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 20e2ea4..be13e0d 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 _0x9901=['create','addConditions','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0x149b5f,_0x522e4a){var _0x1222fb=function(_0x3d420f){while(--_0x3d420f){_0x149b5f['push'](_0x149b5f['shift']());}};_0x1222fb(++_0x522e4a);}(_0x9901,0x15e));var _0x1990=function(_0x5b3946,_0x23053c){_0x5b3946=_0x5b3946-0x0;var _0x2bd577=_0x9901[_0x5b3946];return _0x2bd577;};'use strict';var multer=require('multer');var util=require(_0x1990('0x0'));var path=require('path');var timeout=require(_0x1990('0x1'));var express=require(_0x1990('0x2'));var router=express[_0x1990('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1990('0x4'));var interaction=require(_0x1990('0x5'));var config=require(_0x1990('0x6'));var controller=require(_0x1990('0x7'));router[_0x1990('0x8')]('/',auth[_0x1990('0x9')](),controller[_0x1990('0xa')]);router[_0x1990('0x8')](_0x1990('0xb'),auth[_0x1990('0x9')](),controller[_0x1990('0xc')]);router['get'](_0x1990('0xd'),auth[_0x1990('0x9')](),controller[_0x1990('0xe')]);router[_0x1990('0x8')](_0x1990('0xf'),auth[_0x1990('0x9')](),controller[_0x1990('0x10')]);router[_0x1990('0x11')]('/',auth[_0x1990('0x9')](),controller[_0x1990('0x12')]);router[_0x1990('0x11')](_0x1990('0xd'),auth['isAuthenticated'](),controller[_0x1990('0x13')]);router['post']('/:id/actions',auth[_0x1990('0x9')](),controller['addActions']);router[_0x1990('0x14')](_0x1990('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1990('0x15')](_0x1990('0xb'),auth[_0x1990('0x9')](),controller[_0x1990('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb024=['getConditions','/:id/actions','getActions','create','post','addConditions','addActions','put','/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','show','isAuthenticated'];(function(_0x443eb1,_0x17c7bf){var _0x122dd5=function(_0x1a14f0){while(--_0x1a14f0){_0x443eb1['push'](_0x443eb1['shift']());}};_0x122dd5(++_0x17c7bf);}(_0xb024,0x1ad));var _0x4b02=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb024[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x4b02('0x0'));var path=require(_0x4b02('0x1'));var timeout=require(_0x4b02('0x2'));var express=require(_0x4b02('0x3'));var router=express[_0x4b02('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4b02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4b02('0x6'));var controller=require('./automation.controller');router[_0x4b02('0x7')]('/',auth['isAuthenticated'](),controller[_0x4b02('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4b02('0x9')]);router[_0x4b02('0x7')]('/:id/conditions',auth[_0x4b02('0xa')](),controller[_0x4b02('0xb')]);router[_0x4b02('0x7')](_0x4b02('0xc'),auth[_0x4b02('0xa')](),controller[_0x4b02('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4b02('0xe')]);router[_0x4b02('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x4b02('0x10')]);router[_0x4b02('0xf')]('/:id/actions',auth[_0x4b02('0xa')](),controller[_0x4b02('0x11')]);router[_0x4b02('0x12')](_0x4b02('0x13'),auth[_0x4b02('0xa')](),controller['update']);router[_0x4b02('0x14')](_0x4b02('0x13'),auth['isAuthenticated'](),controller[_0x4b02('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index aa24fe9..eac3221 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 _0x0111=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence'];(function(_0x16a645,_0x4743bc){var _0x41dccb=function(_0xc681bf){while(--_0xc681bf){_0x16a645['push'](_0x16a645['shift']());}};_0x41dccb(++_0x4743bc);}(_0x0111,0x1cb));var _0x1011=function(_0xa0cc6f,_0x2cf629){_0xa0cc6f=_0xa0cc6f-0x0;var _0x2705b0=_0x0111[_0xa0cc6f];return _0x2705b0;};'use strict';var Sequelize=require(_0x1011('0x0'));module['exports']={'name':{'type':Sequelize[_0x1011('0x1')],'unique':_0x1011('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1011('0x3')](_0x1011('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1011('0x1')]},'active':{'type':Sequelize[_0x1011('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1011('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1011('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1011('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1011('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1011('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1011('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1011('0x6')](0x5)[_0x1011('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1011('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1011('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1011('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1011('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1011('0x1')],'defaultValue':_0x1011('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1011('0x3')](_0x1011('0xf'),_0x1011('0x10'),'onlyIfOpen'),'defaultValue':_0x1011('0xf')},'dialAMDActive':{'type':Sequelize[_0x1011('0x5')],'defaultValue':0x0,'comment':_0x1011('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x1011('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1011('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x1011('0x6')](0x9)[_0x1011('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1011('0x6')](0x9)[_0x1011('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1011('0x6')](0x9)[_0x1011('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1011('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1011('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1011('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1011('0x6')](0x9)[_0x1011('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1011('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1011('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1011('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1011('0x6')](0x9)[_0x1011('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1011('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1011('0x3')](_0x1011('0x18'),_0x1011('0x19')),'defaultValue':_0x1011('0x18')},'dialPrefix':{'type':Sequelize[_0x1011('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1011('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1011('0x6')](0x5)[_0x1011('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1011('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x1011('0x6')](0x5)[_0x1011('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1011('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1011('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1011('0x1d')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1011('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1011('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1011('0x6')](0x3)[_0x1011('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1011('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1011('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xc482=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#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\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)'];(function(_0x23e3a6,_0x160687){var _0x3330c=function(_0x47fe6f){while(--_0x47fe6f){_0x23e3a6['push'](_0x23e3a6['shift']());}};_0x3330c(++_0x160687);}(_0xc482,0x96));var _0x2c48=function(_0x535251,_0x646da){_0x535251=_0x535251-0x0;var _0x43f6f9=_0xc482[_0x535251];return _0x43f6f9;};'use strict';var Sequelize=require(_0x2c48('0x0'));module[_0x2c48('0x1')]={'name':{'type':Sequelize[_0x2c48('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2c48('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x2c48('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2c48('0x5')},'limitCalls':{'type':Sequelize[_0x2c48('0x6')](0x4)[_0x2c48('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x2c48('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2c48('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2c48('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)[_0x2c48('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2c48('0x6')](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2c48('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2c48('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2c48('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2c48('0x2')],'defaultValue':_0x2c48('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x2c48('0xf'),'onlyIfOpen'),'defaultValue':_0x2c48('0x10')},'dialAMDActive':{'type':Sequelize[_0x2c48('0x11')],'defaultValue':0x0,'comment':_0x2c48('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x2c48('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2c48('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x2c48('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2c48('0x6')](0x9)[_0x2c48('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2c48('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2c48('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x2c48('0x6')](0x9)[_0x2c48('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2c48('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2c48('0x6')](0x9)[_0x2c48('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2c48('0x6')](0x9)[_0x2c48('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2c48('0x6')](0x5)[_0x2c48('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2c48('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2c48('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2c48('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2c48('0x3')](_0x2c48('0x19'),_0x2c48('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x2c48('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2c48('0x6')](0x3)[_0x2c48('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2c48('0x1b')},'dialCutDigit':{'type':Sequelize[_0x2c48('0x6')](0x3)[_0x2c48('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2c48('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2c48('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2c48('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2c48('0x6')](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)[_0x2c48('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2c48('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x2c48('0x6')](0x3)[_0x2c48('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2c48('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2c48('0x6')](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2c48('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2c48('0x6')](0x5)[_0x2c48('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2c48('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3006d58..4dd73cd 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 _0xbe99=['Content-Range','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','send','index','map','Campaign','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','getHoppers','CmHopper','findAll','rows','findOne','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into','scheduledAt','select','field','phone','NOW()','ContactId','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','insert','fromQuery','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set'];(function(_0x19fc44,_0x4bca56){var _0x3414ec=function(_0x696b3d){while(--_0x696b3d){_0x19fc44['push'](_0x19fc44['shift']());}};_0x3414ec(++_0x4bca56);}(_0xbe99,0x196));var _0x9be9=function(_0x2b41e8,_0x86e285){_0x2b41e8=_0x2b41e8-0x0;var _0x396ab3=_0xbe99[_0x2b41e8];return _0x396ab3;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require(_0x9be9('0x2'));var jsonpatch=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var moment=require('moment');var BPromise=require(_0x9be9('0x5'));var Mustache=require('mustache');var util=require(_0x9be9('0x6'));var path=require(_0x9be9('0x7'));var sox=require(_0x9be9('0x8'));var csv=require(_0x9be9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be9('0xc'));var deskjs=require(_0x9be9('0xd'));var toCsv=require(_0x9be9('0x9'));var querystring=require(_0x9be9('0xe'));var Papa=require(_0x9be9('0xf'));var Redis=require(_0x9be9('0x10'));var authService=require(_0x9be9('0x11'));var qs=require(_0x9be9('0x12'));var as=require(_0x9be9('0x13'));var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];function respondWithStatusCode(_0x33c2cd,_0x4b6d99){_0x4b6d99=_0x4b6d99||0xcc;return function(_0x1251e4){if(_0x1251e4){return _0x33c2cd[_0x9be9('0x1b')](_0x4b6d99);}return _0x33c2cd[_0x9be9('0x1c')](_0x4b6d99)[_0x9be9('0x1d')]();};}function respondWithResult(_0x2cc374,_0x50a7fb){_0x50a7fb=_0x50a7fb||0xc8;return function(_0x2798bd){if(_0x2798bd){return _0x2cc374[_0x9be9('0x1c')](_0x50a7fb)[_0x9be9('0x1e')](_0x2798bd);}};}function respondWithFilteredResult(_0x5a8a3d,_0x2d3e45){return function(_0x418c1e){if(_0x418c1e){var _0x3c92cc=typeof _0x2d3e45[_0x9be9('0x1f')]===_0x9be9('0x20')&&typeof _0x2d3e45['limit']===_0x9be9('0x20');var _0x1cbff7=_0x418c1e[_0x9be9('0x21')];var _0x5f2612=_0x3c92cc?0x0:_0x2d3e45['offset'];var _0x9a37a0=_0x3c92cc?_0x418c1e[_0x9be9('0x21')]:_0x2d3e45[_0x9be9('0x1f')]+_0x2d3e45['limit'];var _0x5aeca2;if(_0x9a37a0>=_0x1cbff7){_0x9a37a0=_0x1cbff7;_0x5aeca2=0xc8;}else{_0x5aeca2=0xce;}_0x5a8a3d[_0x9be9('0x1c')](_0x5aeca2);return _0x5a8a3d[_0x9be9('0x22')](_0x9be9('0x23'),_0x5f2612+'-'+_0x9a37a0+'/'+_0x1cbff7)[_0x9be9('0x1e')](_0x418c1e);}return null;};}function patchUpdates(_0x1b041b){return function(_0x3761c7){try{jsonpatch[_0x9be9('0x24')](_0x3761c7,_0x1b041b,!![]);}catch(_0x2c1f2f){return BPromise[_0x9be9('0x25')](_0x2c1f2f);}return _0x3761c7[_0x9be9('0x26')]();};}function saveUpdates(_0xd700ff,_0x100637){return function(_0x599429){if(_0x599429){return _0x599429[_0x9be9('0x27')](_0xd700ff)['then'](function(_0x2d543d){return _0x2d543d;});}return null;};}function removeEntity(_0xf87e6d,_0x451e60){return function(_0x3fe959){if(_0x3fe959){return _0x3fe959['destroy']()[_0x9be9('0x28')](function(){var _0xfb4266=_0x3fe959[_0x9be9('0x29')]({'plain':!![]});var _0x42a486=_0x9be9('0x2a');return db[_0x9be9('0x2b')][_0x9be9('0x2c')]({'where':{'type':_0x42a486,'resourceId':_0xfb4266['id']}})[_0x9be9('0x28')](function(){return _0x3fe959;});})[_0x9be9('0x28')](function(){_0xf87e6d[_0x9be9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x195330,_0x2f8466){return function(_0x26db60){if(!_0x26db60){_0x195330[_0x9be9('0x1b')](0x194);}return _0x26db60;};}function handleError(_0x10ac46,_0x54de1f){_0x54de1f=_0x54de1f||0x1f4;return function(_0x22c898){logger[_0x9be9('0x2d')](_0x22c898['stack']);if(_0x22c898[_0x9be9('0x2e')]){delete _0x22c898['name'];}_0x10ac46[_0x9be9('0x1c')](_0x54de1f)[_0x9be9('0x2f')](_0x22c898);};}exports[_0x9be9('0x30')]=function(_0x199cbd,_0x5a527a){var _0x133eca={},_0x3f6fff={},_0xb61721={'count':0x0,'rows':[]};var _0x35665c=_[_0x9be9('0x31')](db[_0x9be9('0x32')][_0x9be9('0x33')],function(_0x3dcb2a){return{'name':_0x3dcb2a['fieldName'],'type':_0x3dcb2a['type'][_0x9be9('0x34')]};});_0x3f6fff['model']=_[_0x9be9('0x31')](_0x35665c,_0x9be9('0x2e'));_0x3f6fff[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x199cbd['query']);_0x3f6fff[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x3f6fff[_0x9be9('0x39')],_0x3f6fff[_0x9be9('0x35')]);_0x133eca[_0x9be9('0x3a')]=_['intersection'](_0x3f6fff[_0x9be9('0x39')],qs['fields'](_0x199cbd['query']['fields']));_0x133eca['attributes']=_0x133eca[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x133eca['attributes']:_0x3f6fff[_0x9be9('0x39')];if(!_0x199cbd[_0x9be9('0x35')][_0x9be9('0x3c')](_0x9be9('0x3d'))){_0x133eca[_0x9be9('0x3e')]=qs['limit'](_0x199cbd[_0x9be9('0x35')][_0x9be9('0x3e')]);_0x133eca[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x199cbd[_0x9be9('0x35')][_0x9be9('0x1f')]);}_0x133eca[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x199cbd[_0x9be9('0x35')][_0x9be9('0x40')]);_0x133eca[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_[_0x9be9('0x42')](_0x199cbd[_0x9be9('0x35')],_0x3f6fff[_0x9be9('0x37')]),_0x35665c);if(_0x199cbd[_0x9be9('0x35')][_0x9be9('0x43')]){_0x133eca[_0x9be9('0x41')]=_[_0x9be9('0x44')](_0x133eca[_0x9be9('0x41')],{'$or':_[_0x9be9('0x31')](_0x35665c,function(_0x1c1d9a){if(_0x1c1d9a[_0x9be9('0x45')]!==_0x9be9('0x46')){var _0x56a49d={};_0x56a49d[_0x1c1d9a[_0x9be9('0x2e')]]={'$like':'%'+_0x199cbd[_0x9be9('0x35')][_0x9be9('0x43')]+'%'};return _0x56a49d;}})});}_0x133eca=_[_0x9be9('0x44')]({},_0x133eca,_0x199cbd[_0x9be9('0x47')]);var _0x51e6fe={'where':_0x133eca[_0x9be9('0x41')]};return db[_0x9be9('0x32')][_0x9be9('0x21')](_0x51e6fe)[_0x9be9('0x28')](function(_0x1f7775){_0xb61721[_0x9be9('0x21')]=_0x1f7775;if(_0x199cbd[_0x9be9('0x35')][_0x9be9('0x48')]){_0x133eca[_0x9be9('0x49')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x133eca);})[_0x9be9('0x28')](function(_0x56bf39){_0xb61721['rows']=_0x56bf39;return _0xb61721;})[_0x9be9('0x28')](respondWithFilteredResult(_0x5a527a,_0x133eca))[_0x9be9('0x4a')](handleError(_0x5a527a,null));};exports[_0x9be9('0x4b')]=function(_0x59ed83,_0x5ab632){var _0x24c121={'raw':![],'where':{'id':_0x59ed83[_0x9be9('0x4c')]['id']}},_0x4f4168={};_0x4f4168[_0x9be9('0x39')]=_['keys'](db[_0x9be9('0x32')][_0x9be9('0x33')]);_0x4f4168[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x59ed83[_0x9be9('0x35')]);_0x4f4168['filters']=_[_0x9be9('0x38')](_0x4f4168[_0x9be9('0x39')],_0x4f4168[_0x9be9('0x35')]);_0x24c121['attributes']=_[_0x9be9('0x38')](_0x4f4168['model'],qs[_0x9be9('0x4d')](_0x59ed83[_0x9be9('0x35')][_0x9be9('0x4d')]));_0x24c121[_0x9be9('0x3a')]=_0x24c121['attributes']['length']?_0x24c121[_0x9be9('0x3a')]:_0x4f4168[_0x9be9('0x39')];if(_0x59ed83['query'][_0x9be9('0x48')]){_0x24c121[_0x9be9('0x49')]=[{'all':!![]}];}_0x24c121=_[_0x9be9('0x44')]({},_0x24c121,_0x59ed83[_0x9be9('0x47')]);return db[_0x9be9('0x32')][_0x9be9('0x4e')](_0x24c121)[_0x9be9('0x28')](handleEntityNotFound(_0x5ab632,null))[_0x9be9('0x28')](respondWithResult(_0x5ab632,null))[_0x9be9('0x4a')](handleError(_0x5ab632,null));};exports[_0x9be9('0x4f')]=function(_0x1385ac,_0x31faa8){return db['Campaign'][_0x9be9('0x4f')](_0x1385ac[_0x9be9('0x50')],{})[_0x9be9('0x28')](function(_0x31928f){var _0x47e6c8=_0x1385ac['user'][_0x9be9('0x29')]({'plain':!![]});if(!_0x47e6c8)throw new Error(_0x9be9('0x51'));if(_0x47e6c8[_0x9be9('0x52')]===_0x9be9('0x53')){var _0x18450a=_0x31928f['get']({'plain':!![]});var _0x240265=_0x9be9('0x2a');return db['UserProfileSection'][_0x9be9('0x4e')]({'where':{'name':_0x240265,'userProfileId':_0x47e6c8[_0x9be9('0x54')]},'raw':!![]})['then'](function(_0x5a4795){if(_0x5a4795&&_0x5a4795[_0x9be9('0x55')]===0x0){return db[_0x9be9('0x2b')][_0x9be9('0x4f')]({'name':_0x18450a['name'],'resourceId':_0x18450a['id'],'type':_0x5a4795[_0x9be9('0x2e')],'sectionId':_0x5a4795['id']},{})[_0x9be9('0x28')](function(){return _0x31928f;});}else{return _0x31928f;}})[_0x9be9('0x4a')](function(_0x46a7d2){logger[_0x9be9('0x2d')](_0x9be9('0x56'),_0x46a7d2);throw _0x46a7d2;});}return _0x31928f;})[_0x9be9('0x28')](respondWithResult(_0x31faa8,0xc9))[_0x9be9('0x4a')](handleError(_0x31faa8,null));};exports[_0x9be9('0x57')]=function(_0x156637,_0x4dd1d0){var _0x489f39={'where':{'id':_0x156637[_0x9be9('0x4c')]['id']}},_0x5862ef={};_0x5862ef[_0x9be9('0x39')]=_['keys'](db[_0x9be9('0x32')][_0x9be9('0x33')]);_0x489f39[_0x9be9('0x3a')]=_[_0x9be9('0x38')](_0x5862ef[_0x9be9('0x39')],qs[_0x9be9('0x4d')](_0x156637[_0x9be9('0x35')]['fields']));_0x489f39[_0x9be9('0x3a')]=_0x489f39['attributes'][_0x9be9('0x3b')]?_0x489f39[_0x9be9('0x3a')]:_0x5862ef['model'];if(_0x156637[_0x9be9('0x35')][_0x9be9('0x48')]){_0x489f39[_0x9be9('0x49')]=[{'all':!![]}];}_0x489f39=_['merge']({},_0x489f39,_0x156637[_0x9be9('0x47')]);return db[_0x9be9('0x32')][_0x9be9('0x4e')](_0x489f39)[_0x9be9('0x28')](handleEntityNotFound(_0x4dd1d0,null))[_0x9be9('0x28')](function(_0x1b9d96){if(_0x1b9d96){var _0x2e025f=_0x1b9d96['get']({'plain':!![]});_0x2e025f=qs[_0x9be9('0x58')](_0x2e025f,['id',_0x9be9('0x59'),_0x9be9('0x5a')]);_0x156637[_0x9be9('0x50')]=_[_0x9be9('0x58')](_0x156637[_0x9be9('0x50')],['id',_0x9be9('0x59'),_0x9be9('0x5a')]);return db[_0x9be9('0x32')][_0x9be9('0x4f')](_[_0x9be9('0x44')](_0x2e025f,_0x156637['body']),{'include':_0x156637[_0x9be9('0x35')][_0x9be9('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x4bc3f0){var _0x2d0f36=_0x156637[_0x9be9('0x53')][_0x9be9('0x29')]({'plain':!![]});if(!_0x2d0f36)throw new Error(_0x9be9('0x51'));if(_0x2d0f36[_0x9be9('0x52')]==='user'){var _0x4dcf4d=_0x4bc3f0[_0x9be9('0x29')]({'plain':!![]});var _0x3bf990=_0x9be9('0x2a');return db[_0x9be9('0x5b')][_0x9be9('0x4e')]({'where':{'name':_0x3bf990,'userProfileId':_0x2d0f36[_0x9be9('0x54')]},'raw':!![]})[_0x9be9('0x28')](function(_0x11d7e9){if(_0x11d7e9&&_0x11d7e9['autoAssociation']===0x0){return db[_0x9be9('0x2b')][_0x9be9('0x4f')]({'name':_0x4dcf4d[_0x9be9('0x2e')],'resourceId':_0x4dcf4d['id'],'type':_0x11d7e9[_0x9be9('0x2e')],'sectionId':_0x11d7e9['id']},{})['then'](function(){return _0x4bc3f0;});}else{return _0x4bc3f0;}})[_0x9be9('0x4a')](function(_0x32d4ba){logger[_0x9be9('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d4ba);throw _0x32d4ba;});}return _0x4bc3f0;});}})[_0x9be9('0x28')](respondWithResult(_0x4dd1d0,0xc9))[_0x9be9('0x4a')](handleError(_0x4dd1d0,null));};exports['update']=function(_0xcb0a1c,_0x5e961f){if(_0xcb0a1c['body']['id']){delete _0xcb0a1c[_0x9be9('0x50')]['id'];}return db['Campaign']['find']({'where':{'id':_0xcb0a1c[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x5e961f,null))[_0x9be9('0x28')](saveUpdates(_0xcb0a1c[_0x9be9('0x50')],null))[_0x9be9('0x28')](respondWithResult(_0x5e961f,null))[_0x9be9('0x4a')](handleError(_0x5e961f,null));};exports['destroy']=function(_0x37e5f9,_0xb101cc){return db[_0x9be9('0x32')][_0x9be9('0x4e')]({'where':{'id':_0x37e5f9[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb101cc,null))[_0x9be9('0x28')](removeEntity(_0xb101cc,null))[_0x9be9('0x4a')](handleError(_0xb101cc,null));};exports[_0x9be9('0x5c')]=function(_0x4dd055,_0x502d7b,_0x1f0623){var _0x179c64={'raw':!![],'where':{}};var _0x2425e0={};var _0x36a097={'count':0x0,'rows':[]};return db[_0x9be9('0x32')]['findOne']({'where':{'id':_0x4dd055[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x502d7b,null))[_0x9be9('0x28')](function(_0x133801){if(_0x133801){_0x2425e0['model']=_[_0x9be9('0x36')](db[_0x9be9('0x5d')][_0x9be9('0x33')]);_0x2425e0['query']=_[_0x9be9('0x36')](_0x4dd055[_0x9be9('0x35')]);_0x2425e0[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x2425e0[_0x9be9('0x39')],_0x2425e0[_0x9be9('0x35')]);_0x179c64['attributes']=_['intersection'](_0x2425e0[_0x9be9('0x39')],qs[_0x9be9('0x4d')](_0x4dd055[_0x9be9('0x35')]['fields']));_0x179c64['attributes']=_0x179c64[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x179c64[_0x9be9('0x3a')]:_0x2425e0[_0x9be9('0x39')];if(!_0x4dd055[_0x9be9('0x35')][_0x9be9('0x3c')](_0x9be9('0x3d'))){_0x179c64[_0x9be9('0x3e')]=qs['limit'](_0x4dd055['query'][_0x9be9('0x3e')]);_0x179c64[_0x9be9('0x1f')]=qs['offset'](_0x4dd055[_0x9be9('0x35')][_0x9be9('0x1f')]);}_0x179c64[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x4dd055[_0x9be9('0x35')][_0x9be9('0x40')]);_0x179c64[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_[_0x9be9('0x42')](_0x4dd055['query'],_0x2425e0[_0x9be9('0x37')]));_0x179c64['where']['CampaignId']=_0x133801['id'];if(_0x4dd055[_0x9be9('0x35')]['filter']){_0x179c64['where']=_[_0x9be9('0x44')](_0x179c64['where'],{'$or':_[_0x9be9('0x31')](_0x179c64[_0x9be9('0x3a')],function(_0x230c0b){var _0x5a617a={};_0x5a617a[_0x230c0b]={'$like':'%'+_0x4dd055['query']['filter']+'%'};return _0x5a617a;})});}_0x179c64=_[_0x9be9('0x44')]({},_0x179c64,_0x4dd055[_0x9be9('0x47')]);return db[_0x9be9('0x5d')][_0x9be9('0x21')]({'where':_0x179c64[_0x9be9('0x41')]})['then'](function(_0x2f0478){_0x36a097[_0x9be9('0x21')]=_0x2f0478;if(_0x4dd055[_0x9be9('0x35')][_0x9be9('0x48')]){_0x179c64[_0x9be9('0x49')]=[{'all':!![]}];}return db[_0x9be9('0x5d')][_0x9be9('0x5e')](_0x179c64);})['then'](function(_0x3f3684){_0x36a097[_0x9be9('0x5f')]=_0x3f3684;return _0x36a097;});}})[_0x9be9('0x28')](respondWithFilteredResult(_0x502d7b,_0x179c64))[_0x9be9('0x4a')](handleError(_0x502d7b,null));};exports['getHopperHistories']=function(_0x385c5d,_0x314816,_0x4ce25a){var _0x3a21eb={'raw':!![],'where':{}};var _0x348ecc={};var _0x5b9c66={'count':0x0,'rows':[]};return db[_0x9be9('0x32')][_0x9be9('0x60')]({'where':{'id':_0x385c5d['params']['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x314816,null))[_0x9be9('0x28')](function(_0x2e97c9){if(_0x2e97c9){_0x348ecc[_0x9be9('0x39')]=_[_0x9be9('0x36')](db[_0x9be9('0x61')][_0x9be9('0x33')]);_0x348ecc[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x385c5d[_0x9be9('0x35')]);_0x348ecc['filters']=_[_0x9be9('0x38')](_0x348ecc[_0x9be9('0x39')],_0x348ecc[_0x9be9('0x35')]);_0x3a21eb['attributes']=_[_0x9be9('0x38')](_0x348ecc[_0x9be9('0x39')],qs[_0x9be9('0x4d')](_0x385c5d['query'][_0x9be9('0x4d')]));_0x3a21eb[_0x9be9('0x3a')]=_0x3a21eb[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x3a21eb[_0x9be9('0x3a')]:_0x348ecc['model'];if(!_0x385c5d['query']['hasOwnProperty'](_0x9be9('0x3d'))){_0x3a21eb['limit']=qs[_0x9be9('0x3e')](_0x385c5d['query'][_0x9be9('0x3e')]);_0x3a21eb['offset']=qs['offset'](_0x385c5d[_0x9be9('0x35')]['offset']);}_0x3a21eb[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x385c5d[_0x9be9('0x35')][_0x9be9('0x40')]);_0x3a21eb['where']=qs['filters'](_['pick'](_0x385c5d[_0x9be9('0x35')],_0x348ecc[_0x9be9('0x37')]));_0x3a21eb[_0x9be9('0x41')][_0x9be9('0x62')]=_0x2e97c9['id'];if(_0x385c5d[_0x9be9('0x35')][_0x9be9('0x43')]){_0x3a21eb[_0x9be9('0x41')]=_['merge'](_0x3a21eb[_0x9be9('0x41')],{'$or':_[_0x9be9('0x31')](_0x3a21eb[_0x9be9('0x3a')],function(_0x52e019){var _0xbb5e51={};_0xbb5e51[_0x52e019]={'$like':'%'+_0x385c5d['query']['filter']+'%'};return _0xbb5e51;})});}_0x3a21eb=_[_0x9be9('0x44')]({},_0x3a21eb,_0x385c5d[_0x9be9('0x47')]);return db[_0x9be9('0x61')][_0x9be9('0x21')]({'where':_0x3a21eb[_0x9be9('0x41')]})[_0x9be9('0x28')](function(_0x1d6019){_0x5b9c66[_0x9be9('0x21')]=_0x1d6019;if(_0x385c5d[_0x9be9('0x35')]['includeAll']){_0x3a21eb['include']=[{'all':!![]}];}return db[_0x9be9('0x61')][_0x9be9('0x5e')](_0x3a21eb);})[_0x9be9('0x28')](function(_0x5464df){_0x5b9c66['rows']=_0x5464df;return _0x5b9c66;});}})[_0x9be9('0x28')](respondWithFilteredResult(_0x314816,_0x3a21eb))[_0x9be9('0x4a')](handleError(_0x314816,null));};exports['getHopperFinals']=function(_0x2b6511,_0x11a231,_0x3e3352){var _0x44b2d5={'raw':!![],'where':{}};var _0x18c40b={};var _0x1054aa={'count':0x0,'rows':[]};return db[_0x9be9('0x32')][_0x9be9('0x60')]({'where':{'id':_0x2b6511['params']['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x11a231,null))[_0x9be9('0x28')](function(_0x1722ff){if(_0x1722ff){_0x18c40b[_0x9be9('0x39')]=_[_0x9be9('0x36')](db[_0x9be9('0x63')][_0x9be9('0x33')]);_0x18c40b['query']=_[_0x9be9('0x36')](_0x2b6511[_0x9be9('0x35')]);_0x18c40b[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x18c40b[_0x9be9('0x39')],_0x18c40b[_0x9be9('0x35')]);_0x44b2d5[_0x9be9('0x3a')]=_[_0x9be9('0x38')](_0x18c40b['model'],qs[_0x9be9('0x4d')](_0x2b6511['query'][_0x9be9('0x4d')]));_0x44b2d5[_0x9be9('0x3a')]=_0x44b2d5[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x44b2d5[_0x9be9('0x3a')]:_0x18c40b[_0x9be9('0x39')];if(!_0x2b6511[_0x9be9('0x35')][_0x9be9('0x3c')](_0x9be9('0x3d'))){_0x44b2d5[_0x9be9('0x3e')]=qs[_0x9be9('0x3e')](_0x2b6511[_0x9be9('0x35')][_0x9be9('0x3e')]);_0x44b2d5[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x2b6511[_0x9be9('0x35')][_0x9be9('0x1f')]);}_0x44b2d5[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x2b6511['query']['sort']);_0x44b2d5[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_[_0x9be9('0x42')](_0x2b6511[_0x9be9('0x35')],_0x18c40b[_0x9be9('0x37')]));_0x44b2d5[_0x9be9('0x41')][_0x9be9('0x62')]=_0x1722ff['id'];if(_0x2b6511[_0x9be9('0x35')][_0x9be9('0x43')]){_0x44b2d5[_0x9be9('0x41')]=_[_0x9be9('0x44')](_0x44b2d5[_0x9be9('0x41')],{'$or':_[_0x9be9('0x31')](_0x44b2d5[_0x9be9('0x3a')],function(_0x5576f7){var _0x414357={};_0x414357[_0x5576f7]={'$like':'%'+_0x2b6511[_0x9be9('0x35')]['filter']+'%'};return _0x414357;})});}_0x44b2d5=_['merge']({},_0x44b2d5,_0x2b6511['options']);return db[_0x9be9('0x63')][_0x9be9('0x21')]({'where':_0x44b2d5[_0x9be9('0x41')]})[_0x9be9('0x28')](function(_0x46abb4){_0x1054aa[_0x9be9('0x21')]=_0x46abb4;if(_0x2b6511[_0x9be9('0x35')]['includeAll']){_0x44b2d5[_0x9be9('0x49')]=[{'all':!![]}];}return db[_0x9be9('0x63')][_0x9be9('0x5e')](_0x44b2d5);})[_0x9be9('0x28')](function(_0x56ea74){_0x1054aa[_0x9be9('0x5f')]=_0x56ea74;return _0x1054aa;});}})[_0x9be9('0x28')](respondWithFilteredResult(_0x11a231,_0x44b2d5))['catch'](handleError(_0x11a231,null));};exports[_0x9be9('0x64')]=function(_0x5be199,_0x3e6908,_0x172351){var _0x3e3fab={'raw':!![],'where':{}};var _0x536259={};var _0x2e24c7={'count':0x0,'rows':[]};return db[_0x9be9('0x32')][_0x9be9('0x60')]({'where':{'id':_0x5be199[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x3e6908,null))[_0x9be9('0x28')](function(_0x55c9e9){if(_0x55c9e9){_0x536259[_0x9be9('0x39')]=_[_0x9be9('0x36')](db[_0x9be9('0x65')][_0x9be9('0x33')]);_0x536259[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x5be199[_0x9be9('0x35')]);_0x536259[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x536259[_0x9be9('0x39')],_0x536259[_0x9be9('0x35')]);_0x3e3fab[_0x9be9('0x3a')]=_[_0x9be9('0x38')](_0x536259[_0x9be9('0x39')],qs[_0x9be9('0x4d')](_0x5be199['query'][_0x9be9('0x4d')]));_0x3e3fab[_0x9be9('0x3a')]=_0x3e3fab[_0x9be9('0x3a')]['length']?_0x3e3fab[_0x9be9('0x3a')]:_0x536259[_0x9be9('0x39')];if(!_0x5be199['query']['hasOwnProperty'](_0x9be9('0x3d'))){_0x3e3fab[_0x9be9('0x3e')]=qs[_0x9be9('0x3e')](_0x5be199['query'][_0x9be9('0x3e')]);_0x3e3fab['offset']=qs[_0x9be9('0x1f')](_0x5be199[_0x9be9('0x35')]['offset']);}_0x3e3fab[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x5be199[_0x9be9('0x35')][_0x9be9('0x40')]);_0x3e3fab[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_[_0x9be9('0x42')](_0x5be199[_0x9be9('0x35')],_0x536259[_0x9be9('0x37')]));_0x3e3fab[_0x9be9('0x41')][_0x9be9('0x62')]=_0x55c9e9['id'];if(_0x5be199[_0x9be9('0x35')]['filter']){_0x3e3fab[_0x9be9('0x41')]=_[_0x9be9('0x44')](_0x3e3fab[_0x9be9('0x41')],{'$or':_[_0x9be9('0x31')](_0x3e3fab[_0x9be9('0x3a')],function(_0x366d2d){var _0x1a01dc={};_0x1a01dc[_0x366d2d]={'$like':'%'+_0x5be199[_0x9be9('0x35')]['filter']+'%'};return _0x1a01dc;})});}_0x3e3fab=_['merge']({},_0x3e3fab,_0x5be199[_0x9be9('0x47')]);return db[_0x9be9('0x65')][_0x9be9('0x21')]({'where':_0x3e3fab[_0x9be9('0x41')]})[_0x9be9('0x28')](function(_0x3c2dd6){_0x2e24c7[_0x9be9('0x21')]=_0x3c2dd6;if(_0x5be199[_0x9be9('0x35')]['includeAll']){_0x3e3fab['include']=[{'all':!![]}];}return db[_0x9be9('0x65')][_0x9be9('0x5e')](_0x3e3fab);})[_0x9be9('0x28')](function(_0x2300ed){_0x2e24c7[_0x9be9('0x5f')]=_0x2300ed;return _0x2e24c7;});}})[_0x9be9('0x28')](respondWithFilteredResult(_0x3e6908,_0x3e3fab))['catch'](handleError(_0x3e6908,null));};exports[_0x9be9('0x66')]=function(_0x244992,_0x4a4aa9,_0x24e468){var _0x1cbb84={};var _0xbdd102={};var _0x11f44d;var _0x5f5263;return db[_0x9be9('0x32')][_0x9be9('0x60')]({'where':{'id':_0x244992[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a4aa9,null))[_0x9be9('0x28')](function(_0x538e7e){if(_0x538e7e){_0x11f44d=_0x538e7e;_0xbdd102[_0x9be9('0x39')]=_[_0x9be9('0x36')](db[_0x9be9('0x67')][_0x9be9('0x33')]);_0xbdd102[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x244992['query']);_0xbdd102[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0xbdd102[_0x9be9('0x39')],_0xbdd102[_0x9be9('0x35')]);_0x1cbb84[_0x9be9('0x3a')]=_['intersection'](_0xbdd102[_0x9be9('0x39')],qs[_0x9be9('0x4d')](_0x244992[_0x9be9('0x35')][_0x9be9('0x4d')]));_0x1cbb84[_0x9be9('0x3a')]=_0x1cbb84[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x1cbb84[_0x9be9('0x3a')]:_0xbdd102[_0x9be9('0x39')];_0x1cbb84[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x244992[_0x9be9('0x35')][_0x9be9('0x40')]);_0x1cbb84[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_[_0x9be9('0x42')](_0x244992[_0x9be9('0x35')],_0xbdd102['filters']));if(_0x244992[_0x9be9('0x35')]['filter']){_0x1cbb84[_0x9be9('0x41')]=_['merge'](_0x1cbb84['where'],{'$or':_[_0x9be9('0x31')](_0x1cbb84['attributes'],function(_0x34a538){var _0x5023ff={};_0x5023ff[_0x34a538]={'$like':'%'+_0x244992[_0x9be9('0x35')]['filter']+'%'};return _0x5023ff;})});}_0x1cbb84=_[_0x9be9('0x44')]({},_0x1cbb84,_0x244992[_0x9be9('0x47')]);return _0x11f44d['getLists'](_0x1cbb84);}})[_0x9be9('0x28')](function(_0x5b06a2){if(_0x5b06a2){_0x5f5263=_0x5b06a2[_0x9be9('0x3b')];if(!_0x244992['query'][_0x9be9('0x3c')](_0x9be9('0x3d'))){_0x1cbb84[_0x9be9('0x3e')]=qs[_0x9be9('0x3e')](_0x244992[_0x9be9('0x35')][_0x9be9('0x3e')]);_0x1cbb84[_0x9be9('0x1f')]=qs['offset'](_0x244992['query'][_0x9be9('0x1f')]);}return _0x11f44d[_0x9be9('0x66')](_0x1cbb84);}})[_0x9be9('0x28')](function(_0x22cb72){if(_0x22cb72){return _0x22cb72?{'count':_0x5f5263,'rows':_0x22cb72}:null;}})['then'](respondWithResult(_0x4a4aa9,null))['catch'](handleError(_0x4a4aa9,null));};exports[_0x9be9('0x68')]=function(_0x38ffff,_0x19c4d0,_0x5cb511){var _0x146977,_0x42bd13;var _0x4a6162=[];var _0x485f2a=moment()[_0x9be9('0x69')](_0x9be9('0x6a'));return db[_0x9be9('0x32')][_0x9be9('0x4e')]({'where':{'id':_0x38ffff[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x19c4d0,null))[_0x9be9('0x28')](function(_0xa37285){if(_0xa37285){_0x42bd13=_0xa37285;return _0xa37285[_0x9be9('0x68')](_0x38ffff[_0x9be9('0x50')][_0x9be9('0x6b')],_[_0x9be9('0x58')](_0x38ffff[_0x9be9('0x50')],[_0x9be9('0x6b'),'id'])||{});}return null;})[_0x9be9('0x6c')](function(_0x4a1b0a){var _0x1189ad;var _0x421383;_0x146977=_0x4a1b0a||[];var _0x399015=[];if(_0x4a1b0a){for(var _0x184724=0x0;_0x184724<_0x4a1b0a[_0x9be9('0x3b')];_0x184724+=0x1){var _0x23f523=_0x4a1b0a[_0x184724][_0x9be9('0x29')]({'plain':!![]});_0x42bd13[_0x9be9('0x6d')]=_0x38ffff['body'][_0x9be9('0x6d')]?_0x38ffff[_0x9be9('0x50')][_0x9be9('0x6d')]:_0x42bd13['dialCheckDuplicateType'];switch(_0x42bd13[_0x9be9('0x6d')]){case'always':_0x1189ad=squel['insert']()[_0x9be9('0x6e')]('cm_hopper')['fromQuery'](['phone',_0x9be9('0x6f'),'ContactId','ListId','CampaignId',_0x9be9('0x59'),_0x9be9('0x5a')],squel[_0x9be9('0x70')]()[_0x9be9('0x71')](_0x9be9('0x72'),_0x9be9('0x72'))[_0x9be9('0x71')](_0x9be9('0x73'),'scheduledAt')[_0x9be9('0x71')]('id',_0x9be9('0x74'))[_0x9be9('0x71')](_0x23f523[_0x9be9('0x75')][_0x9be9('0x76')](),_0x9be9('0x77'))['field'](_0x38ffff[_0x9be9('0x4c')]['id'][_0x9be9('0x76')](),_0x9be9('0x62'))[_0x9be9('0x71')]('\x27'+_0x485f2a+'\x27',_0x9be9('0x59'))[_0x9be9('0x71')]('\x27'+_0x485f2a+'\x27',_0x9be9('0x5a'))[_0x9be9('0x78')]('cm_contacts')[_0x9be9('0x41')](_0x9be9('0x79'))[_0x9be9('0x41')](_0x9be9('0x7a'),_0x23f523[_0x9be9('0x75')][_0x9be9('0x76')]())[_0x9be9('0x41')](_0x9be9('0x7b'))['where'](_0x9be9('0x7c'),squel['select']()[_0x9be9('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x9be9('0x78')]('cm_hopper_final')[_0x9be9('0x41')]('CampaignId\x20=\x20?',_0x38ffff[_0x9be9('0x4c')]['id'][_0x9be9('0x76')]()))[_0x9be9('0x41')](_0x9be9('0x7c'),squel['select']()[_0x9be9('0x71')](_0x9be9('0x7d'))['from'](_0x9be9('0x7e'))[_0x9be9('0x41')]('CampaignId\x20=\x20?',_0x38ffff[_0x9be9('0x4c')]['id'][_0x9be9('0x76')]())))[_0x9be9('0x76')]();break;case _0x9be9('0x7f'):_0x1189ad=squel['insert']()[_0x9be9('0x6e')](_0x9be9('0x7e'))['fromQuery']([_0x9be9('0x72'),'scheduledAt','ContactId',_0x9be9('0x77'),_0x9be9('0x62'),_0x9be9('0x59'),_0x9be9('0x5a')],squel['select']()['field'](_0x9be9('0x72'),_0x9be9('0x72'))[_0x9be9('0x71')](_0x9be9('0x73'),'scheduledAt')[_0x9be9('0x71')]('id','ContactId')[_0x9be9('0x71')](_0x23f523[_0x9be9('0x75')][_0x9be9('0x76')](),_0x9be9('0x77'))[_0x9be9('0x71')](_0x38ffff[_0x9be9('0x4c')]['id'][_0x9be9('0x76')](),_0x9be9('0x62'))[_0x9be9('0x71')]('\x27'+_0x485f2a+'\x27',_0x9be9('0x59'))[_0x9be9('0x71')]('\x27'+_0x485f2a+'\x27',_0x9be9('0x5a'))[_0x9be9('0x78')](_0x9be9('0x80'))['where'](_0x9be9('0x79'))[_0x9be9('0x41')](_0x9be9('0x7a'),_0x23f523[_0x9be9('0x75')][_0x9be9('0x76')]())['where'](_0x9be9('0x7b'))[_0x9be9('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9be9('0x70')]()[_0x9be9('0x71')]('COALESCE(phone,\x27\x27)')['from'](_0x9be9('0x7e'))[_0x9be9('0x41')]('CampaignId\x20=\x20?',_0x38ffff[_0x9be9('0x4c')]['id']['toString']())))[_0x9be9('0x76')]();break;default:_0x1189ad=squel[_0x9be9('0x81')]()[_0x9be9('0x6e')]('cm_hopper')[_0x9be9('0x82')]([_0x9be9('0x72'),_0x9be9('0x6f'),_0x9be9('0x74'),_0x9be9('0x77'),_0x9be9('0x62'),_0x9be9('0x59'),_0x9be9('0x5a')],squel[_0x9be9('0x70')]()[_0x9be9('0x71')]('phone',_0x9be9('0x72'))[_0x9be9('0x71')](_0x9be9('0x73'),_0x9be9('0x6f'))[_0x9be9('0x71')]('id',_0x9be9('0x74'))['field'](_0x23f523[_0x9be9('0x75')]['toString'](),'ListId')[_0x9be9('0x71')](_0x38ffff[_0x9be9('0x4c')]['id'][_0x9be9('0x76')](),_0x9be9('0x62'))['field']('\x27'+_0x485f2a+'\x27',_0x9be9('0x59'))[_0x9be9('0x71')]('\x27'+_0x485f2a+'\x27','updatedAt')[_0x9be9('0x78')]('cm_contacts')[_0x9be9('0x41')](_0x9be9('0x79'))[_0x9be9('0x41')](_0x9be9('0x7a'),_0x23f523[_0x9be9('0x75')][_0x9be9('0x76')]())[_0x9be9('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x9be9('0x76')]();}_0x421383=squel[_0x9be9('0x81')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x9be9('0x83'),_0x9be9('0x6f'),'phone',_0x9be9('0x84'),_0x9be9('0x59'),_0x9be9('0x5a')],squel['select']()[_0x9be9('0x71')](_0x9be9('0x85'),'id')['field']('NOW()',_0x9be9('0x6f'))['field']('ci.item',_0x9be9('0x72'))[_0x9be9('0x71')](_0x9be9('0x86'),_0x9be9('0x84'))[_0x9be9('0x71')]('\x27'+_0x485f2a+'\x27',_0x9be9('0x59'))['field']('\x27'+_0x485f2a+'\x27',_0x9be9('0x5a'))[_0x9be9('0x78')](_0x9be9('0x87'),'ci')[_0x9be9('0x88')](_0x9be9('0x7e'),'h',_0x9be9('0x89'))[_0x9be9('0x41')](_0x9be9('0x8a'),_0x23f523['CmListId'][_0x9be9('0x76')]())[_0x9be9('0x41')](_0x9be9('0x8b'),_0x38ffff[_0x9be9('0x4c')]['id'][_0x9be9('0x76')]())[_0x9be9('0x41')]('h.createdAt\x20=\x20?',_0x485f2a))[_0x9be9('0x76')]();_0x399015['push'](db['sequelize'][_0x9be9('0x35')](_0x1189ad));_0x4a6162[_0x9be9('0x8c')](db[_0x9be9('0x8d')][_0x9be9('0x35')](_0x421383));}return BPromise[_0x9be9('0x8e')](_0x399015);}})[_0x9be9('0x28')](function(){return BPromise[_0x9be9('0x8e')](_0x4a6162);})[_0x9be9('0x28')](function(){return _0x146977;})[_0x9be9('0x28')](respondWithResult(_0x19c4d0,null))[_0x9be9('0x4a')](handleError(_0x19c4d0,null));};exports[_0x9be9('0x8f')]=function(_0x2e2cdf,_0x37b5fa,_0x233e0b){return db[_0x9be9('0x32')][_0x9be9('0x4e')]({'where':{'id':_0x2e2cdf[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37b5fa,null))[_0x9be9('0x28')](function(_0x4e624b){if(_0x4e624b){return _0x4e624b[_0x9be9('0x8f')](_0x2e2cdf['query'][_0x9be9('0x6b')]);}})[_0x9be9('0x28')](function(_0x34a5e2){if(_0x34a5e2){return db[_0x9be9('0x5d')]['destroy']({'where':{'ListId':_0x2e2cdf['query'][_0x9be9('0x6b')],'CampaignId':_0x2e2cdf[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](function(){return _0x34a5e2;});}})[_0x9be9('0x28')](respondWithStatusCode(_0x37b5fa,null))[_0x9be9('0x4a')](handleError(_0x37b5fa,null));};exports[_0x9be9('0x90')]=function(_0x945e1a,_0x25a5bc,_0x49d1ee){var _0x4c0d0e={};var _0x3e9851={};var _0x1b3bd4;var _0x3855a0;return db[_0x9be9('0x32')][_0x9be9('0x60')]({'where':{'id':_0x945e1a[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25a5bc,null))[_0x9be9('0x28')](function(_0x15cf5e){if(_0x15cf5e){_0x1b3bd4=_0x15cf5e;_0x3e9851[_0x9be9('0x39')]=_['keys'](db[_0x9be9('0x67')]['rawAttributes']);_0x3e9851['query']=_[_0x9be9('0x36')](_0x945e1a[_0x9be9('0x35')]);_0x3e9851['filters']=_['intersection'](_0x3e9851[_0x9be9('0x39')],_0x3e9851['query']);_0x4c0d0e['attributes']=_[_0x9be9('0x38')](_0x3e9851[_0x9be9('0x39')],qs[_0x9be9('0x4d')](_0x945e1a['query'][_0x9be9('0x4d')]));_0x4c0d0e['attributes']=_0x4c0d0e[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x4c0d0e['attributes']:_0x3e9851['model'];_0x4c0d0e[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x945e1a[_0x9be9('0x35')][_0x9be9('0x40')]);_0x4c0d0e[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_['pick'](_0x945e1a[_0x9be9('0x35')],_0x3e9851[_0x9be9('0x37')]));if(_0x945e1a[_0x9be9('0x35')][_0x9be9('0x43')]){_0x4c0d0e[_0x9be9('0x41')]=_[_0x9be9('0x44')](_0x4c0d0e[_0x9be9('0x41')],{'$or':_[_0x9be9('0x31')](_0x4c0d0e[_0x9be9('0x3a')],function(_0x2c54b2){var _0x580312={};_0x580312[_0x2c54b2]={'$like':'%'+_0x945e1a['query'][_0x9be9('0x43')]+'%'};return _0x580312;})});}_0x4c0d0e=_[_0x9be9('0x44')]({},_0x4c0d0e,_0x945e1a[_0x9be9('0x47')]);return _0x1b3bd4['getBlackLists'](_0x4c0d0e);}})['then'](function(_0x5b643b){if(_0x5b643b){_0x3855a0=_0x5b643b[_0x9be9('0x3b')];if(!_0x945e1a[_0x9be9('0x35')][_0x9be9('0x3c')](_0x9be9('0x3d'))){_0x4c0d0e[_0x9be9('0x3e')]=qs[_0x9be9('0x3e')](_0x945e1a[_0x9be9('0x35')][_0x9be9('0x3e')]);_0x4c0d0e[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x945e1a[_0x9be9('0x35')][_0x9be9('0x1f')]);}return _0x1b3bd4[_0x9be9('0x90')](_0x4c0d0e);}})[_0x9be9('0x28')](function(_0x412b53){if(_0x412b53){return _0x412b53?{'count':_0x3855a0,'rows':_0x412b53}:null;}})[_0x9be9('0x28')](respondWithResult(_0x25a5bc,null))[_0x9be9('0x4a')](handleError(_0x25a5bc,null));};exports[_0x9be9('0x91')]=function(_0x1d2e3e,_0x639d41,_0x299ffc){var _0x308eca,_0x4fe7e5;var _0x49be00=[];var _0x58fc7d=moment()['format'](_0x9be9('0x6a'));return db[_0x9be9('0x32')][_0x9be9('0x4e')]({'where':{'id':_0x1d2e3e[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x639d41,null))[_0x9be9('0x28')](function(_0x2db33b){if(_0x2db33b){_0x4fe7e5=_0x2db33b;return _0x2db33b['addBlackLists'](_0x1d2e3e[_0x9be9('0x50')][_0x9be9('0x6b')],_[_0x9be9('0x58')](_0x1d2e3e[_0x9be9('0x50')],['ids','id'])||{});}return null;})['spread'](function(_0x3c1cfa){var _0x81087f;var _0xb6b1f9;_0x308eca=_0x3c1cfa||[];var _0x3684fd=[];if(_0x3c1cfa){for(var _0x4a2f1e=0x0;_0x4a2f1e<_0x3c1cfa['length'];_0x4a2f1e+=0x1){var _0x756c25=_0x3c1cfa[_0x4a2f1e][_0x9be9('0x29')]({'plain':!![]});_0x81087f=squel[_0x9be9('0x81')]()[_0x9be9('0x6e')]('cm_hopper_black')['fromQuery']([_0x9be9('0x72'),'ContactId',_0x9be9('0x77'),'CampaignId','createdAt','updatedAt'],squel[_0x9be9('0x70')]()[_0x9be9('0x71')]('phone','phone')['field']('id',_0x9be9('0x74'))['field'](_0x756c25[_0x9be9('0x75')]['toString'](),_0x9be9('0x77'))[_0x9be9('0x71')](_0x1d2e3e[_0x9be9('0x4c')]['id'][_0x9be9('0x76')](),_0x9be9('0x62'))[_0x9be9('0x71')](_0x9be9('0x73'),_0x9be9('0x59'))[_0x9be9('0x71')](_0x9be9('0x73'),_0x9be9('0x5a'))[_0x9be9('0x78')]('cm_contacts')[_0x9be9('0x41')](_0x9be9('0x79'))[_0x9be9('0x41')](_0x9be9('0x7a'),_0x756c25[_0x9be9('0x75')][_0x9be9('0x76')]())[_0x9be9('0x41')](_0x9be9('0x7b')))[_0x9be9('0x76')]();_0x3684fd[_0x9be9('0x8c')](db[_0x9be9('0x8d')][_0x9be9('0x35')](_0x81087f));}return BPromise[_0x9be9('0x8e')](_0x3684fd);}})[_0x9be9('0x28')](function(){return _0x308eca;})['then'](respondWithResult(_0x639d41,null))[_0x9be9('0x4a')](handleError(_0x639d41,null));};exports['removeBlackLists']=function(_0x3f32fd,_0x40ec04,_0x30965b){return db[_0x9be9('0x32')][_0x9be9('0x4e')]({'where':{'id':_0x3f32fd[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x40ec04,null))[_0x9be9('0x28')](function(_0x185b20){if(_0x185b20){return _0x185b20[_0x9be9('0x92')](_0x3f32fd[_0x9be9('0x35')][_0x9be9('0x6b')]);}})[_0x9be9('0x28')](function(_0x199e54){if(_0x199e54){return db[_0x9be9('0x65')]['destroy']({'where':{'ListId':_0x3f32fd['query'][_0x9be9('0x6b')],'CampaignId':_0x3f32fd[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](function(){return _0x199e54;});}})[_0x9be9('0x28')](respondWithStatusCode(_0x40ec04,null))['catch'](handleError(_0x40ec04,null));}; \ No newline at end of file +var _0xa30e=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','error','stack','name','index','map','Campaign','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','user','UserProfileResource','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','ListId\x20=\x20?','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa30e,0x117));var _0xea30=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0xa30e[_0x2cdcf9];return _0x39412d;};'use strict';var emlformat=require(_0xea30('0x0'));var rimraf=require(_0xea30('0x1'));var zipdir=require(_0xea30('0x2'));var jsonpatch=require(_0xea30('0x3'));var rp=require(_0xea30('0x4'));var moment=require(_0xea30('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xea30('0x6'));var sox=require(_0xea30('0x7'));var csv=require(_0xea30('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea30('0x9'));var _=require(_0xea30('0xa'));var squel=require(_0xea30('0xb'));var crypto=require(_0xea30('0xc'));var jsforce=require(_0xea30('0xd'));var deskjs=require(_0xea30('0xe'));var toCsv=require(_0xea30('0x8'));var querystring=require(_0xea30('0xf'));var Papa=require(_0xea30('0x10'));var Redis=require(_0xea30('0x11'));var authService=require(_0xea30('0x12'));var qs=require(_0xea30('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea30('0x14'))(_0xea30('0x15'));var utils=require(_0xea30('0x16'));var config=require(_0xea30('0x17'));var licenseUtil=require(_0xea30('0x18'));var db=require(_0xea30('0x19'))['db'];function respondWithStatusCode(_0x13fb06,_0x26fe96){_0x26fe96=_0x26fe96||0xcc;return function(_0x348aad){if(_0x348aad){return _0x13fb06[_0xea30('0x1a')](_0x26fe96);}return _0x13fb06[_0xea30('0x1b')](_0x26fe96)[_0xea30('0x1c')]();};}function respondWithResult(_0x3a15fc,_0x597009){_0x597009=_0x597009||0xc8;return function(_0x2b0add){if(_0x2b0add){return _0x3a15fc[_0xea30('0x1b')](_0x597009)[_0xea30('0x1d')](_0x2b0add);}};}function respondWithFilteredResult(_0x54235a,_0x27e663){return function(_0x4151a6){if(_0x4151a6){var _0x1e2c8f=typeof _0x27e663[_0xea30('0x1e')]===_0xea30('0x1f')&&typeof _0x27e663[_0xea30('0x20')]===_0xea30('0x1f');var _0x598d66=_0x4151a6[_0xea30('0x21')];var _0x2e7504=_0x1e2c8f?0x0:_0x27e663[_0xea30('0x1e')];var _0x225bb7=_0x1e2c8f?_0x4151a6[_0xea30('0x21')]:_0x27e663[_0xea30('0x1e')]+_0x27e663['limit'];var _0x25eaad;if(_0x225bb7>=_0x598d66){_0x225bb7=_0x598d66;_0x25eaad=0xc8;}else{_0x25eaad=0xce;}_0x54235a[_0xea30('0x1b')](_0x25eaad);return _0x54235a[_0xea30('0x22')](_0xea30('0x23'),_0x2e7504+'-'+_0x225bb7+'/'+_0x598d66)[_0xea30('0x1d')](_0x4151a6);}return null;};}function patchUpdates(_0x2c3cc0){return function(_0x21dd56){try{jsonpatch[_0xea30('0x24')](_0x21dd56,_0x2c3cc0,!![]);}catch(_0x5b4fd7){return BPromise[_0xea30('0x25')](_0x5b4fd7);}return _0x21dd56['save']();};}function saveUpdates(_0x54d817,_0x50951f){return function(_0x2f95e8){if(_0x2f95e8){return _0x2f95e8[_0xea30('0x26')](_0x54d817)[_0xea30('0x27')](function(_0x4345e0){return _0x4345e0;});}return null;};}function removeEntity(_0x23fc0f,_0x527a28){return function(_0x74ceb1){if(_0x74ceb1){return _0x74ceb1[_0xea30('0x28')]()[_0xea30('0x27')](function(){var _0x2b7805=_0x74ceb1[_0xea30('0x29')]({'plain':!![]});var _0x4092a8=_0xea30('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x4092a8,'resourceId':_0x2b7805['id']}})[_0xea30('0x27')](function(){return _0x74ceb1;});})[_0xea30('0x27')](function(){_0x23fc0f[_0xea30('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203554,_0x3c70dd){return function(_0x2b5b4c){if(!_0x2b5b4c){_0x203554[_0xea30('0x1a')](0x194);}return _0x2b5b4c;};}function handleError(_0x4a256e,_0x593e71){_0x593e71=_0x593e71||0x1f4;return function(_0x32d2f3){logger[_0xea30('0x2b')](_0x32d2f3[_0xea30('0x2c')]);if(_0x32d2f3[_0xea30('0x2d')]){delete _0x32d2f3[_0xea30('0x2d')];}_0x4a256e[_0xea30('0x1b')](_0x593e71)['send'](_0x32d2f3);};}exports[_0xea30('0x2e')]=function(_0xdcf47e,_0x35292c){var _0x2e957a={},_0x43de29={},_0x143f53={'count':0x0,'rows':[]};var _0x2b3396=_[_0xea30('0x2f')](db[_0xea30('0x30')]['rawAttributes'],function(_0x594168){return{'name':_0x594168[_0xea30('0x31')],'type':_0x594168[_0xea30('0x32')]['key']};});_0x43de29['model']=_[_0xea30('0x2f')](_0x2b3396,_0xea30('0x2d'));_0x43de29[_0xea30('0x33')]=_[_0xea30('0x34')](_0xdcf47e[_0xea30('0x33')]);_0x43de29['filters']=_[_0xea30('0x35')](_0x43de29[_0xea30('0x36')],_0x43de29[_0xea30('0x33')]);_0x2e957a[_0xea30('0x37')]=_[_0xea30('0x35')](_0x43de29['model'],qs['fields'](_0xdcf47e[_0xea30('0x33')][_0xea30('0x38')]));_0x2e957a[_0xea30('0x37')]=_0x2e957a[_0xea30('0x37')][_0xea30('0x39')]?_0x2e957a[_0xea30('0x37')]:_0x43de29[_0xea30('0x36')];if(!_0xdcf47e[_0xea30('0x33')][_0xea30('0x3a')](_0xea30('0x3b'))){_0x2e957a[_0xea30('0x20')]=qs[_0xea30('0x20')](_0xdcf47e['query'][_0xea30('0x20')]);_0x2e957a[_0xea30('0x1e')]=qs[_0xea30('0x1e')](_0xdcf47e['query']['offset']);}_0x2e957a[_0xea30('0x3c')]=qs[_0xea30('0x3d')](_0xdcf47e[_0xea30('0x33')][_0xea30('0x3d')]);_0x2e957a[_0xea30('0x3e')]=qs[_0xea30('0x3f')](_['pick'](_0xdcf47e['query'],_0x43de29[_0xea30('0x3f')]),_0x2b3396);if(_0xdcf47e[_0xea30('0x33')]['filter']){_0x2e957a[_0xea30('0x3e')]=_[_0xea30('0x40')](_0x2e957a[_0xea30('0x3e')],{'$or':_['map'](_0x2b3396,function(_0x2e4802){if(_0x2e4802[_0xea30('0x32')]!==_0xea30('0x41')){var _0x1dbd4e={};_0x1dbd4e[_0x2e4802[_0xea30('0x2d')]]={'$like':'%'+_0xdcf47e[_0xea30('0x33')][_0xea30('0x42')]+'%'};return _0x1dbd4e;}})});}_0x2e957a=_[_0xea30('0x40')]({},_0x2e957a,_0xdcf47e['options']);var _0x37a2de={'where':_0x2e957a[_0xea30('0x3e')]};return db[_0xea30('0x30')][_0xea30('0x21')](_0x37a2de)['then'](function(_0x4e2f17){_0x143f53[_0xea30('0x21')]=_0x4e2f17;if(_0xdcf47e[_0xea30('0x33')]['includeAll']){_0x2e957a[_0xea30('0x43')]=[{'all':!![]}];}return db[_0xea30('0x30')][_0xea30('0x44')](_0x2e957a);})[_0xea30('0x27')](function(_0x14a530){_0x143f53[_0xea30('0x45')]=_0x14a530;return _0x143f53;})[_0xea30('0x27')](respondWithFilteredResult(_0x35292c,_0x2e957a))[_0xea30('0x46')](handleError(_0x35292c,null));};exports[_0xea30('0x47')]=function(_0x4ecdef,_0x52e533){var _0x331ccb={'raw':![],'where':{'id':_0x4ecdef['params']['id']}},_0x3e058c={};_0x3e058c[_0xea30('0x36')]=_[_0xea30('0x34')](db[_0xea30('0x30')][_0xea30('0x48')]);_0x3e058c[_0xea30('0x33')]=_[_0xea30('0x34')](_0x4ecdef[_0xea30('0x33')]);_0x3e058c[_0xea30('0x3f')]=_[_0xea30('0x35')](_0x3e058c[_0xea30('0x36')],_0x3e058c[_0xea30('0x33')]);_0x331ccb[_0xea30('0x37')]=_[_0xea30('0x35')](_0x3e058c[_0xea30('0x36')],qs['fields'](_0x4ecdef[_0xea30('0x33')]['fields']));_0x331ccb['attributes']=_0x331ccb[_0xea30('0x37')]['length']?_0x331ccb['attributes']:_0x3e058c[_0xea30('0x36')];if(_0x4ecdef['query'][_0xea30('0x49')]){_0x331ccb[_0xea30('0x43')]=[{'all':!![]}];}_0x331ccb=_[_0xea30('0x40')]({},_0x331ccb,_0x4ecdef[_0xea30('0x4a')]);return db['Campaign'][_0xea30('0x4b')](_0x331ccb)[_0xea30('0x27')](handleEntityNotFound(_0x52e533,null))[_0xea30('0x27')](respondWithResult(_0x52e533,null))[_0xea30('0x46')](handleError(_0x52e533,null));};exports[_0xea30('0x4c')]=function(_0x1c5daf,_0x3bdc06){return db[_0xea30('0x30')][_0xea30('0x4c')](_0x1c5daf[_0xea30('0x4d')],{})[_0xea30('0x27')](function(_0x3757e3){var _0x5266de=_0x1c5daf['user'][_0xea30('0x29')]({'plain':!![]});if(!_0x5266de)throw new Error(_0xea30('0x4e'));if(_0x5266de[_0xea30('0x4f')]==='user'){var _0x1f1e57=_0x3757e3[_0xea30('0x29')]({'plain':!![]});var _0x28b582=_0xea30('0x2a');return db[_0xea30('0x50')][_0xea30('0x4b')]({'where':{'name':_0x28b582,'userProfileId':_0x5266de[_0xea30('0x51')]},'raw':!![]})[_0xea30('0x27')](function(_0x2a9868){if(_0x2a9868&&_0x2a9868[_0xea30('0x52')]===0x0){return db['UserProfileResource'][_0xea30('0x4c')]({'name':_0x1f1e57['name'],'resourceId':_0x1f1e57['id'],'type':_0x2a9868[_0xea30('0x2d')],'sectionId':_0x2a9868['id']},{})[_0xea30('0x27')](function(){return _0x3757e3;});}else{return _0x3757e3;}})['catch'](function(_0x20dce6){logger[_0xea30('0x2b')](_0xea30('0x53'),_0x20dce6);throw _0x20dce6;});}return _0x3757e3;})['then'](respondWithResult(_0x3bdc06,0xc9))[_0xea30('0x46')](handleError(_0x3bdc06,null));};exports[_0xea30('0x54')]=function(_0x5183e5,_0x2ad5b8){var _0x2a4bfb={'where':{'id':_0x5183e5[_0xea30('0x55')]['id']}},_0x35300b={};_0x35300b['model']=_[_0xea30('0x34')](db[_0xea30('0x30')]['rawAttributes']);_0x2a4bfb['attributes']=_['intersection'](_0x35300b[_0xea30('0x36')],qs[_0xea30('0x38')](_0x5183e5['query'][_0xea30('0x38')]));_0x2a4bfb[_0xea30('0x37')]=_0x2a4bfb[_0xea30('0x37')]['length']?_0x2a4bfb[_0xea30('0x37')]:_0x35300b[_0xea30('0x36')];if(_0x5183e5[_0xea30('0x33')][_0xea30('0x49')]){_0x2a4bfb['include']=[{'all':!![]}];}_0x2a4bfb=_['merge']({},_0x2a4bfb,_0x5183e5[_0xea30('0x4a')]);return db['Campaign'][_0xea30('0x4b')](_0x2a4bfb)[_0xea30('0x27')](handleEntityNotFound(_0x2ad5b8,null))['then'](function(_0x9fdc7e){if(_0x9fdc7e){var _0x32e5bb=_0x9fdc7e[_0xea30('0x29')]({'plain':!![]});_0x32e5bb=qs['omit'](_0x32e5bb,['id',_0xea30('0x56'),_0xea30('0x57')]);_0x5183e5[_0xea30('0x4d')]=_[_0xea30('0x58')](_0x5183e5[_0xea30('0x4d')],['id','createdAt',_0xea30('0x57')]);return db['Campaign'][_0xea30('0x4c')](_[_0xea30('0x40')](_0x32e5bb,_0x5183e5['body']),{'include':_0x5183e5[_0xea30('0x33')][_0xea30('0x49')]?[{'all':!![]}]:undefined})[_0xea30('0x27')](function(_0x4ea130){var _0x474180=_0x5183e5[_0xea30('0x59')][_0xea30('0x29')]({'plain':!![]});if(!_0x474180)throw new Error(_0xea30('0x4e'));if(_0x474180[_0xea30('0x4f')]==='user'){var _0xfedf04=_0x4ea130[_0xea30('0x29')]({'plain':!![]});var _0xe72409=_0xea30('0x2a');return db[_0xea30('0x50')][_0xea30('0x4b')]({'where':{'name':_0xe72409,'userProfileId':_0x474180[_0xea30('0x51')]},'raw':!![]})[_0xea30('0x27')](function(_0x24e6ec){if(_0x24e6ec&&_0x24e6ec[_0xea30('0x52')]===0x0){return db[_0xea30('0x5a')][_0xea30('0x4c')]({'name':_0xfedf04[_0xea30('0x2d')],'resourceId':_0xfedf04['id'],'type':_0x24e6ec['name'],'sectionId':_0x24e6ec['id']},{})[_0xea30('0x27')](function(){return _0x4ea130;});}else{return _0x4ea130;}})[_0xea30('0x46')](function(_0x1e3e0b){logger[_0xea30('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e3e0b);throw _0x1e3e0b;});}return _0x4ea130;});}})[_0xea30('0x27')](respondWithResult(_0x2ad5b8,0xc9))['catch'](handleError(_0x2ad5b8,null));};exports[_0xea30('0x26')]=function(_0x41cc6c,_0x1fa9f3){if(_0x41cc6c[_0xea30('0x4d')]['id']){delete _0x41cc6c['body']['id'];}return db[_0xea30('0x30')][_0xea30('0x4b')]({'where':{'id':_0x41cc6c[_0xea30('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fa9f3,null))['then'](saveUpdates(_0x41cc6c[_0xea30('0x4d')],null))['then'](respondWithResult(_0x1fa9f3,null))[_0xea30('0x46')](handleError(_0x1fa9f3,null));};exports[_0xea30('0x28')]=function(_0xfc3c94,_0x43d622){return db[_0xea30('0x30')]['find']({'where':{'id':_0xfc3c94[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x43d622,null))[_0xea30('0x27')](removeEntity(_0x43d622,null))[_0xea30('0x46')](handleError(_0x43d622,null));};exports[_0xea30('0x5b')]=function(_0x4a35b9,_0x52df2c,_0x29ceb8){var _0x573c30={'raw':!![],'where':{}};var _0x49ce5a={};var _0x3ce8ac={'count':0x0,'rows':[]};return db[_0xea30('0x30')][_0xea30('0x5c')]({'where':{'id':_0x4a35b9[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x52df2c,null))['then'](function(_0x40e1c7){if(_0x40e1c7){_0x49ce5a['model']=_[_0xea30('0x34')](db[_0xea30('0x5d')][_0xea30('0x48')]);_0x49ce5a[_0xea30('0x33')]=_[_0xea30('0x34')](_0x4a35b9[_0xea30('0x33')]);_0x49ce5a[_0xea30('0x3f')]=_[_0xea30('0x35')](_0x49ce5a[_0xea30('0x36')],_0x49ce5a['query']);_0x573c30[_0xea30('0x37')]=_[_0xea30('0x35')](_0x49ce5a[_0xea30('0x36')],qs['fields'](_0x4a35b9['query'][_0xea30('0x38')]));_0x573c30[_0xea30('0x37')]=_0x573c30['attributes']['length']?_0x573c30[_0xea30('0x37')]:_0x49ce5a[_0xea30('0x36')];if(!_0x4a35b9[_0xea30('0x33')]['hasOwnProperty']('nolimit')){_0x573c30[_0xea30('0x20')]=qs[_0xea30('0x20')](_0x4a35b9[_0xea30('0x33')]['limit']);_0x573c30['offset']=qs[_0xea30('0x1e')](_0x4a35b9['query'][_0xea30('0x1e')]);}_0x573c30['order']=qs[_0xea30('0x3d')](_0x4a35b9[_0xea30('0x33')][_0xea30('0x3d')]);_0x573c30[_0xea30('0x3e')]=qs[_0xea30('0x3f')](_[_0xea30('0x5e')](_0x4a35b9[_0xea30('0x33')],_0x49ce5a['filters']));_0x573c30[_0xea30('0x3e')][_0xea30('0x5f')]=_0x40e1c7['id'];if(_0x4a35b9['query'][_0xea30('0x42')]){_0x573c30[_0xea30('0x3e')]=_[_0xea30('0x40')](_0x573c30[_0xea30('0x3e')],{'$or':_[_0xea30('0x2f')](_0x573c30[_0xea30('0x37')],function(_0x1d5b86){var _0x5ba113={};_0x5ba113[_0x1d5b86]={'$like':'%'+_0x4a35b9[_0xea30('0x33')][_0xea30('0x42')]+'%'};return _0x5ba113;})});}_0x573c30=_[_0xea30('0x40')]({},_0x573c30,_0x4a35b9[_0xea30('0x4a')]);return db[_0xea30('0x5d')][_0xea30('0x21')]({'where':_0x573c30[_0xea30('0x3e')]})[_0xea30('0x27')](function(_0x39bdaf){_0x3ce8ac[_0xea30('0x21')]=_0x39bdaf;if(_0x4a35b9['query']['includeAll']){_0x573c30['include']=[{'all':!![]}];}return db[_0xea30('0x5d')]['findAll'](_0x573c30);})['then'](function(_0x11ce38){_0x3ce8ac[_0xea30('0x45')]=_0x11ce38;return _0x3ce8ac;});}})[_0xea30('0x27')](respondWithFilteredResult(_0x52df2c,_0x573c30))['catch'](handleError(_0x52df2c,null));};exports[_0xea30('0x60')]=function(_0x165f33,_0x48b03f,_0x392549){var _0x285d43={'raw':!![],'where':{}};var _0x54542a={};var _0x462b3f={'count':0x0,'rows':[]};return db[_0xea30('0x30')][_0xea30('0x5c')]({'where':{'id':_0x165f33[_0xea30('0x55')]['id']}})['then'](handleEntityNotFound(_0x48b03f,null))['then'](function(_0x186ed0){if(_0x186ed0){_0x54542a['model']=_[_0xea30('0x34')](db['CmHopperHistory'][_0xea30('0x48')]);_0x54542a[_0xea30('0x33')]=_[_0xea30('0x34')](_0x165f33[_0xea30('0x33')]);_0x54542a['filters']=_['intersection'](_0x54542a[_0xea30('0x36')],_0x54542a[_0xea30('0x33')]);_0x285d43[_0xea30('0x37')]=_[_0xea30('0x35')](_0x54542a['model'],qs[_0xea30('0x38')](_0x165f33[_0xea30('0x33')][_0xea30('0x38')]));_0x285d43[_0xea30('0x37')]=_0x285d43[_0xea30('0x37')][_0xea30('0x39')]?_0x285d43[_0xea30('0x37')]:_0x54542a[_0xea30('0x36')];if(!_0x165f33[_0xea30('0x33')]['hasOwnProperty'](_0xea30('0x3b'))){_0x285d43[_0xea30('0x20')]=qs['limit'](_0x165f33['query'][_0xea30('0x20')]);_0x285d43[_0xea30('0x1e')]=qs[_0xea30('0x1e')](_0x165f33[_0xea30('0x33')][_0xea30('0x1e')]);}_0x285d43[_0xea30('0x3c')]=qs['sort'](_0x165f33[_0xea30('0x33')][_0xea30('0x3d')]);_0x285d43[_0xea30('0x3e')]=qs[_0xea30('0x3f')](_[_0xea30('0x5e')](_0x165f33[_0xea30('0x33')],_0x54542a[_0xea30('0x3f')]));_0x285d43[_0xea30('0x3e')][_0xea30('0x5f')]=_0x186ed0['id'];if(_0x165f33[_0xea30('0x33')][_0xea30('0x42')]){_0x285d43[_0xea30('0x3e')]=_[_0xea30('0x40')](_0x285d43[_0xea30('0x3e')],{'$or':_[_0xea30('0x2f')](_0x285d43[_0xea30('0x37')],function(_0x5a2b9c){var _0x5cb674={};_0x5cb674[_0x5a2b9c]={'$like':'%'+_0x165f33['query'][_0xea30('0x42')]+'%'};return _0x5cb674;})});}_0x285d43=_['merge']({},_0x285d43,_0x165f33[_0xea30('0x4a')]);return db[_0xea30('0x61')][_0xea30('0x21')]({'where':_0x285d43[_0xea30('0x3e')]})['then'](function(_0x2bd215){_0x462b3f[_0xea30('0x21')]=_0x2bd215;if(_0x165f33[_0xea30('0x33')][_0xea30('0x49')]){_0x285d43[_0xea30('0x43')]=[{'all':!![]}];}return db[_0xea30('0x61')][_0xea30('0x44')](_0x285d43);})[_0xea30('0x27')](function(_0x45c21a){_0x462b3f[_0xea30('0x45')]=_0x45c21a;return _0x462b3f;});}})[_0xea30('0x27')](respondWithFilteredResult(_0x48b03f,_0x285d43))[_0xea30('0x46')](handleError(_0x48b03f,null));};exports['getHopperFinals']=function(_0x165734,_0x1e02a3,_0x1f876a){var _0x546310={'raw':!![],'where':{}};var _0x2c11cd={};var _0x106b77={'count':0x0,'rows':[]};return db[_0xea30('0x30')][_0xea30('0x5c')]({'where':{'id':_0x165734[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x1e02a3,null))['then'](function(_0x3ed3c3){if(_0x3ed3c3){_0x2c11cd['model']=_[_0xea30('0x34')](db[_0xea30('0x62')][_0xea30('0x48')]);_0x2c11cd['query']=_[_0xea30('0x34')](_0x165734['query']);_0x2c11cd[_0xea30('0x3f')]=_[_0xea30('0x35')](_0x2c11cd[_0xea30('0x36')],_0x2c11cd[_0xea30('0x33')]);_0x546310[_0xea30('0x37')]=_[_0xea30('0x35')](_0x2c11cd['model'],qs['fields'](_0x165734['query'][_0xea30('0x38')]));_0x546310[_0xea30('0x37')]=_0x546310[_0xea30('0x37')]['length']?_0x546310[_0xea30('0x37')]:_0x2c11cd[_0xea30('0x36')];if(!_0x165734[_0xea30('0x33')][_0xea30('0x3a')]('nolimit')){_0x546310[_0xea30('0x20')]=qs[_0xea30('0x20')](_0x165734['query'][_0xea30('0x20')]);_0x546310[_0xea30('0x1e')]=qs[_0xea30('0x1e')](_0x165734['query'][_0xea30('0x1e')]);}_0x546310[_0xea30('0x3c')]=qs[_0xea30('0x3d')](_0x165734['query'][_0xea30('0x3d')]);_0x546310[_0xea30('0x3e')]=qs[_0xea30('0x3f')](_['pick'](_0x165734['query'],_0x2c11cd[_0xea30('0x3f')]));_0x546310['where']['CampaignId']=_0x3ed3c3['id'];if(_0x165734[_0xea30('0x33')]['filter']){_0x546310['where']=_[_0xea30('0x40')](_0x546310[_0xea30('0x3e')],{'$or':_[_0xea30('0x2f')](_0x546310[_0xea30('0x37')],function(_0x124d4f){var _0x525a63={};_0x525a63[_0x124d4f]={'$like':'%'+_0x165734[_0xea30('0x33')][_0xea30('0x42')]+'%'};return _0x525a63;})});}_0x546310=_[_0xea30('0x40')]({},_0x546310,_0x165734[_0xea30('0x4a')]);return db['CmHopperFinal'][_0xea30('0x21')]({'where':_0x546310['where']})[_0xea30('0x27')](function(_0x23a939){_0x106b77['count']=_0x23a939;if(_0x165734[_0xea30('0x33')][_0xea30('0x49')]){_0x546310['include']=[{'all':!![]}];}return db[_0xea30('0x62')][_0xea30('0x44')](_0x546310);})['then'](function(_0xd1c51c){_0x106b77[_0xea30('0x45')]=_0xd1c51c;return _0x106b77;});}})[_0xea30('0x27')](respondWithFilteredResult(_0x1e02a3,_0x546310))[_0xea30('0x46')](handleError(_0x1e02a3,null));};exports[_0xea30('0x63')]=function(_0x3e3e8a,_0x3904e5,_0x22e372){var _0xef3dc6={'raw':!![],'where':{}};var _0x286450={};var _0x4fb17b={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3e3e8a['params']['id']}})['then'](handleEntityNotFound(_0x3904e5,null))[_0xea30('0x27')](function(_0xb8af39){if(_0xb8af39){_0x286450['model']=_[_0xea30('0x34')](db[_0xea30('0x64')][_0xea30('0x48')]);_0x286450[_0xea30('0x33')]=_['keys'](_0x3e3e8a[_0xea30('0x33')]);_0x286450['filters']=_['intersection'](_0x286450[_0xea30('0x36')],_0x286450[_0xea30('0x33')]);_0xef3dc6[_0xea30('0x37')]=_[_0xea30('0x35')](_0x286450[_0xea30('0x36')],qs[_0xea30('0x38')](_0x3e3e8a[_0xea30('0x33')][_0xea30('0x38')]));_0xef3dc6[_0xea30('0x37')]=_0xef3dc6[_0xea30('0x37')][_0xea30('0x39')]?_0xef3dc6[_0xea30('0x37')]:_0x286450[_0xea30('0x36')];if(!_0x3e3e8a[_0xea30('0x33')]['hasOwnProperty'](_0xea30('0x3b'))){_0xef3dc6['limit']=qs['limit'](_0x3e3e8a[_0xea30('0x33')]['limit']);_0xef3dc6['offset']=qs[_0xea30('0x1e')](_0x3e3e8a[_0xea30('0x33')]['offset']);}_0xef3dc6[_0xea30('0x3c')]=qs[_0xea30('0x3d')](_0x3e3e8a[_0xea30('0x33')][_0xea30('0x3d')]);_0xef3dc6[_0xea30('0x3e')]=qs[_0xea30('0x3f')](_[_0xea30('0x5e')](_0x3e3e8a[_0xea30('0x33')],_0x286450[_0xea30('0x3f')]));_0xef3dc6[_0xea30('0x3e')][_0xea30('0x5f')]=_0xb8af39['id'];if(_0x3e3e8a['query']['filter']){_0xef3dc6[_0xea30('0x3e')]=_[_0xea30('0x40')](_0xef3dc6['where'],{'$or':_['map'](_0xef3dc6[_0xea30('0x37')],function(_0xca83e0){var _0x34a092={};_0x34a092[_0xca83e0]={'$like':'%'+_0x3e3e8a[_0xea30('0x33')][_0xea30('0x42')]+'%'};return _0x34a092;})});}_0xef3dc6=_['merge']({},_0xef3dc6,_0x3e3e8a[_0xea30('0x4a')]);return db[_0xea30('0x64')][_0xea30('0x21')]({'where':_0xef3dc6[_0xea30('0x3e')]})[_0xea30('0x27')](function(_0x24de70){_0x4fb17b['count']=_0x24de70;if(_0x3e3e8a[_0xea30('0x33')]['includeAll']){_0xef3dc6['include']=[{'all':!![]}];}return db[_0xea30('0x64')]['findAll'](_0xef3dc6);})[_0xea30('0x27')](function(_0x4f9f81){_0x4fb17b[_0xea30('0x45')]=_0x4f9f81;return _0x4fb17b;});}})[_0xea30('0x27')](respondWithFilteredResult(_0x3904e5,_0xef3dc6))[_0xea30('0x46')](handleError(_0x3904e5,null));};exports['getLists']=function(_0x35f181,_0x1e3342,_0x59d726){var _0x1f56e3={};var _0x20b402={};var _0x3c1ab0;var _0x3e9ce8;return db[_0xea30('0x30')][_0xea30('0x5c')]({'where':{'id':_0x35f181[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x1e3342,null))[_0xea30('0x27')](function(_0x3101ae){if(_0x3101ae){_0x3c1ab0=_0x3101ae;_0x20b402[_0xea30('0x36')]=_[_0xea30('0x34')](db[_0xea30('0x65')][_0xea30('0x48')]);_0x20b402[_0xea30('0x33')]=_[_0xea30('0x34')](_0x35f181['query']);_0x20b402[_0xea30('0x3f')]=_[_0xea30('0x35')](_0x20b402[_0xea30('0x36')],_0x20b402[_0xea30('0x33')]);_0x1f56e3[_0xea30('0x37')]=_['intersection'](_0x20b402[_0xea30('0x36')],qs[_0xea30('0x38')](_0x35f181['query'][_0xea30('0x38')]));_0x1f56e3[_0xea30('0x37')]=_0x1f56e3[_0xea30('0x37')]['length']?_0x1f56e3[_0xea30('0x37')]:_0x20b402[_0xea30('0x36')];_0x1f56e3['order']=qs[_0xea30('0x3d')](_0x35f181[_0xea30('0x33')][_0xea30('0x3d')]);_0x1f56e3['where']=qs[_0xea30('0x3f')](_[_0xea30('0x5e')](_0x35f181[_0xea30('0x33')],_0x20b402[_0xea30('0x3f')]));if(_0x35f181[_0xea30('0x33')][_0xea30('0x42')]){_0x1f56e3[_0xea30('0x3e')]=_[_0xea30('0x40')](_0x1f56e3[_0xea30('0x3e')],{'$or':_[_0xea30('0x2f')](_0x1f56e3['attributes'],function(_0x47b973){var _0x292dec={};_0x292dec[_0x47b973]={'$like':'%'+_0x35f181['query'][_0xea30('0x42')]+'%'};return _0x292dec;})});}_0x1f56e3=_[_0xea30('0x40')]({},_0x1f56e3,_0x35f181[_0xea30('0x4a')]);return _0x3c1ab0[_0xea30('0x66')](_0x1f56e3);}})['then'](function(_0x32e19b){if(_0x32e19b){_0x3e9ce8=_0x32e19b[_0xea30('0x39')];if(!_0x35f181[_0xea30('0x33')][_0xea30('0x3a')]('nolimit')){_0x1f56e3[_0xea30('0x20')]=qs[_0xea30('0x20')](_0x35f181[_0xea30('0x33')][_0xea30('0x20')]);_0x1f56e3[_0xea30('0x1e')]=qs[_0xea30('0x1e')](_0x35f181[_0xea30('0x33')][_0xea30('0x1e')]);}return _0x3c1ab0[_0xea30('0x66')](_0x1f56e3);}})[_0xea30('0x27')](function(_0x4533dd){if(_0x4533dd){return _0x4533dd?{'count':_0x3e9ce8,'rows':_0x4533dd}:null;}})[_0xea30('0x27')](respondWithResult(_0x1e3342,null))['catch'](handleError(_0x1e3342,null));};exports[_0xea30('0x67')]=function(_0x1d5f40,_0x1fc94b,_0x2ec151){var _0x93cf67,_0x4f84cc;var _0x4c7cca=[];var _0x2e0473=moment()[_0xea30('0x68')](_0xea30('0x69'));return db[_0xea30('0x30')][_0xea30('0x4b')]({'where':{'id':_0x1d5f40[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x1fc94b,null))[_0xea30('0x27')](function(_0x2965df){if(_0x2965df){_0x4f84cc=_0x2965df;return _0x2965df[_0xea30('0x67')](_0x1d5f40[_0xea30('0x4d')][_0xea30('0x6a')],_[_0xea30('0x58')](_0x1d5f40[_0xea30('0x4d')],[_0xea30('0x6a'),'id'])||{});}return null;})[_0xea30('0x6b')](function(_0xbb9d60){var _0x5038d2;var _0x28b878;_0x93cf67=_0xbb9d60||[];var _0x420aac=[];if(_0xbb9d60){for(var _0x26e165=0x0;_0x26e165<_0xbb9d60[_0xea30('0x39')];_0x26e165+=0x1){var _0x4fd6ed=_0xbb9d60[_0x26e165]['get']({'plain':!![]});_0x4f84cc[_0xea30('0x6c')]=_0x1d5f40[_0xea30('0x4d')][_0xea30('0x6c')]?_0x1d5f40['body'][_0xea30('0x6c')]:_0x4f84cc['dialCheckDuplicateType'];switch(_0x4f84cc[_0xea30('0x6c')]){case _0xea30('0x6d'):_0x5038d2=squel[_0xea30('0x6e')]()[_0xea30('0x6f')](_0xea30('0x70'))[_0xea30('0x71')]([_0xea30('0x72'),_0xea30('0x73'),_0xea30('0x74'),_0xea30('0x75'),_0xea30('0x5f'),_0xea30('0x56'),_0xea30('0x57')],squel['select']()['field'](_0xea30('0x72'),_0xea30('0x72'))[_0xea30('0x76')]('NOW()',_0xea30('0x73'))[_0xea30('0x76')]('id',_0xea30('0x74'))['field'](_0x4fd6ed[_0xea30('0x77')][_0xea30('0x78')](),_0xea30('0x75'))[_0xea30('0x76')](_0x1d5f40[_0xea30('0x55')]['id'][_0xea30('0x78')](),_0xea30('0x5f'))['field']('\x27'+_0x2e0473+'\x27',_0xea30('0x56'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x57'))[_0xea30('0x79')](_0xea30('0x7a'))[_0xea30('0x3e')](_0xea30('0x7b'))[_0xea30('0x3e')]('ListId\x20=\x20?',_0x4fd6ed[_0xea30('0x77')][_0xea30('0x78')]())[_0xea30('0x3e')](_0xea30('0x7c'))[_0xea30('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xea30('0x7d')]()['field'](_0xea30('0x7e'))[_0xea30('0x79')](_0xea30('0x7f'))[_0xea30('0x3e')](_0xea30('0x80'),_0x1d5f40[_0xea30('0x55')]['id']['toString']()))[_0xea30('0x3e')](_0xea30('0x81'),squel['select']()['field'](_0xea30('0x82'))[_0xea30('0x79')](_0xea30('0x70'))[_0xea30('0x3e')](_0xea30('0x80'),_0x1d5f40[_0xea30('0x55')]['id']['toString']())))['toString']();break;case _0xea30('0x83'):_0x5038d2=squel[_0xea30('0x6e')]()['into']('cm_hopper')[_0xea30('0x71')]([_0xea30('0x72'),_0xea30('0x73'),_0xea30('0x74'),_0xea30('0x75'),'CampaignId',_0xea30('0x56'),_0xea30('0x57')],squel[_0xea30('0x7d')]()[_0xea30('0x76')](_0xea30('0x72'),_0xea30('0x72'))[_0xea30('0x76')](_0xea30('0x84'),'scheduledAt')[_0xea30('0x76')]('id',_0xea30('0x74'))[_0xea30('0x76')](_0x4fd6ed['CmListId'][_0xea30('0x78')](),_0xea30('0x75'))[_0xea30('0x76')](_0x1d5f40['params']['id'][_0xea30('0x78')](),_0xea30('0x5f'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x56'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x57'))[_0xea30('0x79')](_0xea30('0x7a'))[_0xea30('0x3e')](_0xea30('0x7b'))[_0xea30('0x3e')](_0xea30('0x85'),_0x4fd6ed[_0xea30('0x77')][_0xea30('0x78')]())['where'](_0xea30('0x7c'))[_0xea30('0x3e')](_0xea30('0x81'),squel[_0xea30('0x7d')]()[_0xea30('0x76')](_0xea30('0x82'))[_0xea30('0x79')](_0xea30('0x70'))[_0xea30('0x3e')](_0xea30('0x80'),_0x1d5f40[_0xea30('0x55')]['id'][_0xea30('0x78')]())))['toString']();break;default:_0x5038d2=squel['insert']()[_0xea30('0x6f')](_0xea30('0x70'))[_0xea30('0x71')](['phone','scheduledAt',_0xea30('0x74'),'ListId',_0xea30('0x5f'),_0xea30('0x56'),'updatedAt'],squel['select']()[_0xea30('0x76')](_0xea30('0x72'),_0xea30('0x72'))['field'](_0xea30('0x84'),_0xea30('0x73'))[_0xea30('0x76')]('id',_0xea30('0x74'))[_0xea30('0x76')](_0x4fd6ed[_0xea30('0x77')][_0xea30('0x78')](),_0xea30('0x75'))['field'](_0x1d5f40[_0xea30('0x55')]['id'][_0xea30('0x78')](),_0xea30('0x5f'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x56'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x57'))['from'](_0xea30('0x7a'))['where'](_0xea30('0x7b'))[_0xea30('0x3e')](_0xea30('0x85'),_0x4fd6ed['CmListId'][_0xea30('0x78')]())[_0xea30('0x3e')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x28b878=squel['insert']()[_0xea30('0x6f')]('cm_hopper_additional_phones')[_0xea30('0x71')](['cmHopperId','scheduledAt','phone',_0xea30('0x86'),'createdAt',_0xea30('0x57')],squel[_0xea30('0x7d')]()[_0xea30('0x76')](_0xea30('0x87'),'id')[_0xea30('0x76')](_0xea30('0x84'),'scheduledAt')['field'](_0xea30('0x88'),_0xea30('0x72'))[_0xea30('0x76')](_0xea30('0x89'),_0xea30('0x86'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x56'))[_0xea30('0x76')]('\x27'+_0x2e0473+'\x27',_0xea30('0x57'))['from'](_0xea30('0x8a'),'ci')[_0xea30('0x8b')](_0xea30('0x70'),'h',_0xea30('0x8c'))[_0xea30('0x3e')](_0xea30('0x8d'),_0x4fd6ed[_0xea30('0x77')][_0xea30('0x78')]())[_0xea30('0x3e')]('h.CampaignId=?',_0x1d5f40[_0xea30('0x55')]['id']['toString']())[_0xea30('0x3e')]('h.createdAt\x20=\x20?',_0x2e0473))[_0xea30('0x78')]();_0x420aac[_0xea30('0x8e')](db[_0xea30('0x8f')][_0xea30('0x33')](_0x5038d2));_0x4c7cca[_0xea30('0x8e')](db[_0xea30('0x8f')][_0xea30('0x33')](_0x28b878));}return BPromise['all'](_0x420aac);}})[_0xea30('0x27')](function(){return BPromise['all'](_0x4c7cca);})[_0xea30('0x27')](function(){return _0x93cf67;})[_0xea30('0x27')](respondWithResult(_0x1fc94b,null))[_0xea30('0x46')](handleError(_0x1fc94b,null));};exports[_0xea30('0x90')]=function(_0x1790a6,_0x48892c,_0x3693a7){return db[_0xea30('0x30')][_0xea30('0x4b')]({'where':{'id':_0x1790a6[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x48892c,null))[_0xea30('0x27')](function(_0x443087){if(_0x443087){return _0x443087['removeLists'](_0x1790a6[_0xea30('0x33')][_0xea30('0x6a')]);}})['then'](function(_0x16966e){if(_0x16966e){return db[_0xea30('0x5d')][_0xea30('0x28')]({'where':{'ListId':_0x1790a6[_0xea30('0x33')]['ids'],'CampaignId':_0x1790a6[_0xea30('0x55')]['id']}})[_0xea30('0x27')](function(){return _0x16966e;});}})[_0xea30('0x27')](respondWithStatusCode(_0x48892c,null))[_0xea30('0x46')](handleError(_0x48892c,null));};exports[_0xea30('0x91')]=function(_0x523a53,_0x46ebcb,_0x331e5b){var _0x3792c0={};var _0x2d9faa={};var _0x21ca14;var _0x89e72b;return db[_0xea30('0x30')][_0xea30('0x5c')]({'where':{'id':_0x523a53[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x46ebcb,null))[_0xea30('0x27')](function(_0x1a285e){if(_0x1a285e){_0x21ca14=_0x1a285e;_0x2d9faa[_0xea30('0x36')]=_[_0xea30('0x34')](db[_0xea30('0x65')]['rawAttributes']);_0x2d9faa['query']=_[_0xea30('0x34')](_0x523a53[_0xea30('0x33')]);_0x2d9faa['filters']=_[_0xea30('0x35')](_0x2d9faa[_0xea30('0x36')],_0x2d9faa[_0xea30('0x33')]);_0x3792c0[_0xea30('0x37')]=_[_0xea30('0x35')](_0x2d9faa['model'],qs[_0xea30('0x38')](_0x523a53[_0xea30('0x33')]['fields']));_0x3792c0['attributes']=_0x3792c0[_0xea30('0x37')]['length']?_0x3792c0[_0xea30('0x37')]:_0x2d9faa[_0xea30('0x36')];_0x3792c0['order']=qs['sort'](_0x523a53[_0xea30('0x33')]['sort']);_0x3792c0['where']=qs[_0xea30('0x3f')](_['pick'](_0x523a53[_0xea30('0x33')],_0x2d9faa[_0xea30('0x3f')]));if(_0x523a53[_0xea30('0x33')][_0xea30('0x42')]){_0x3792c0[_0xea30('0x3e')]=_['merge'](_0x3792c0[_0xea30('0x3e')],{'$or':_['map'](_0x3792c0[_0xea30('0x37')],function(_0x4ae3a8){var _0x5c60d7={};_0x5c60d7[_0x4ae3a8]={'$like':'%'+_0x523a53[_0xea30('0x33')]['filter']+'%'};return _0x5c60d7;})});}_0x3792c0=_[_0xea30('0x40')]({},_0x3792c0,_0x523a53[_0xea30('0x4a')]);return _0x21ca14[_0xea30('0x91')](_0x3792c0);}})[_0xea30('0x27')](function(_0x2f6b15){if(_0x2f6b15){_0x89e72b=_0x2f6b15[_0xea30('0x39')];if(!_0x523a53[_0xea30('0x33')][_0xea30('0x3a')](_0xea30('0x3b'))){_0x3792c0[_0xea30('0x20')]=qs[_0xea30('0x20')](_0x523a53[_0xea30('0x33')][_0xea30('0x20')]);_0x3792c0[_0xea30('0x1e')]=qs[_0xea30('0x1e')](_0x523a53[_0xea30('0x33')][_0xea30('0x1e')]);}return _0x21ca14[_0xea30('0x91')](_0x3792c0);}})[_0xea30('0x27')](function(_0x34f23f){if(_0x34f23f){return _0x34f23f?{'count':_0x89e72b,'rows':_0x34f23f}:null;}})[_0xea30('0x27')](respondWithResult(_0x46ebcb,null))[_0xea30('0x46')](handleError(_0x46ebcb,null));};exports[_0xea30('0x92')]=function(_0x2757df,_0x28a585,_0x4fd895){var _0x2b6892,_0x2d285b;var _0x8ad151=[];var _0x50fc3c=moment()[_0xea30('0x68')](_0xea30('0x69'));return db[_0xea30('0x30')][_0xea30('0x4b')]({'where':{'id':_0x2757df[_0xea30('0x55')]['id']}})[_0xea30('0x27')](handleEntityNotFound(_0x28a585,null))[_0xea30('0x27')](function(_0x5808da){if(_0x5808da){_0x2d285b=_0x5808da;return _0x5808da[_0xea30('0x92')](_0x2757df['body'][_0xea30('0x6a')],_[_0xea30('0x58')](_0x2757df[_0xea30('0x4d')],[_0xea30('0x6a'),'id'])||{});}return null;})[_0xea30('0x6b')](function(_0xcd9f7c){var _0x1c6264;var _0x35c435;_0x2b6892=_0xcd9f7c||[];var _0x1a909f=[];if(_0xcd9f7c){for(var _0x287177=0x0;_0x287177<_0xcd9f7c['length'];_0x287177+=0x1){var _0x3779af=_0xcd9f7c[_0x287177][_0xea30('0x29')]({'plain':!![]});_0x1c6264=squel['insert']()['into'](_0xea30('0x93'))[_0xea30('0x71')](['phone',_0xea30('0x74'),_0xea30('0x75'),'CampaignId',_0xea30('0x56'),_0xea30('0x57')],squel[_0xea30('0x7d')]()[_0xea30('0x76')](_0xea30('0x72'),'phone')[_0xea30('0x76')]('id','ContactId')[_0xea30('0x76')](_0x3779af[_0xea30('0x77')]['toString'](),_0xea30('0x75'))['field'](_0x2757df['params']['id'][_0xea30('0x78')](),'CampaignId')[_0xea30('0x76')](_0xea30('0x84'),_0xea30('0x56'))['field'](_0xea30('0x84'),_0xea30('0x57'))['from'](_0xea30('0x7a'))[_0xea30('0x3e')](_0xea30('0x7b'))['where'](_0xea30('0x85'),_0x3779af[_0xea30('0x77')][_0xea30('0x78')]())['where'](_0xea30('0x7c')))[_0xea30('0x78')]();_0x1a909f[_0xea30('0x8e')](db[_0xea30('0x8f')]['query'](_0x1c6264));}return BPromise[_0xea30('0x94')](_0x1a909f);}})[_0xea30('0x27')](function(){return _0x2b6892;})['then'](respondWithResult(_0x28a585,null))[_0xea30('0x46')](handleError(_0x28a585,null));};exports[_0xea30('0x95')]=function(_0x15177e,_0x34be1f,_0xc7807){return db[_0xea30('0x30')][_0xea30('0x4b')]({'where':{'id':_0x15177e[_0xea30('0x55')]['id']}})['then'](handleEntityNotFound(_0x34be1f,null))[_0xea30('0x27')](function(_0xa4692e){if(_0xa4692e){return _0xa4692e[_0xea30('0x95')](_0x15177e[_0xea30('0x33')][_0xea30('0x6a')]);}})['then'](function(_0x21c13b){if(_0x21c13b){return db['CmHopperBlack'][_0xea30('0x28')]({'where':{'ListId':_0x15177e[_0xea30('0x33')][_0xea30('0x6a')],'CampaignId':_0x15177e[_0xea30('0x55')]['id']}})['then'](function(){return _0x21c13b;});}})[_0xea30('0x27')](respondWithStatusCode(_0x34be1f,null))[_0xea30('0x46')](handleError(_0x34be1f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 47e5806..38ff8d6 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4f51cb,_0x3d7bd4){var _0x4b34b1=function(_0x1bab33){while(--_0x1bab33){_0x4f51cb['push'](_0x4f51cb['shift']());}};_0x4b34b1(++_0x3d7bd4);}(_0x7a54,0x106));var _0x47a5=function(_0x1b4a7b,_0x42cf67){_0x1b4a7b=_0x1b4a7b-0x0;var _0x4478aa=_0x7a54[_0x1b4a7b];return _0x4478aa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1f7928,_0xdafed0){var _0x498443=function(_0x2da729){while(--_0x2da729){_0x1f7928['push'](_0x1f7928['shift']());}};_0x498443(++_0xdafed0);}(_0x7a54,0x106));var _0x47a5=function(_0x37adb3,_0x46c3a9){_0x37adb3=_0x37adb3-0x0;var _0x4502f7=_0x7a54[_0x37adb3];return _0x4502f7;};'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 b9b4f37..d593ee1 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 _0xb7fc=['include','map','model','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCampaign','findAll','options','attributes','limit'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x14eba8,_0x1b1b10){_0x14eba8=_0x14eba8-0x0;var _0x4ca2c5=_0xb7fc[_0x14eba8];return _0x4ca2c5;};'use strict';var _=require(_0xcb7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcb7f('0x1'));var rs=require(_0xcb7f('0x2'));var fs=require('fs');var Redis=require(_0xcb7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb7f('0x4'))(_0xcb7f('0x5'));var config=require(_0xcb7f('0x6'));var jayson=require(_0xcb7f('0x7'));var client=jayson[_0xcb7f('0x8')][_0xcb7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5059ca,_0x226ba8,_0x31de8e){return new BPromise(function(_0x1f8ba3,_0x4dde1f){return client[_0xcb7f('0xa')](_0x5059ca,_0x31de8e)[_0xcb7f('0xb')](function(_0x4d8d72){logger[_0xcb7f('0xc')](_0xcb7f('0xd'),_0x226ba8,'request\x20sent');logger[_0xcb7f('0xe')](_0xcb7f('0xf'),_0x226ba8,_0xcb7f('0x10'),JSON[_0xcb7f('0x11')](_0x4d8d72));if(_0x4d8d72[_0xcb7f('0x12')]){if(_0x4d8d72['error']['code']===0x1f4){logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);return _0x4dde1f(_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);}logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);return _0x1f8ba3(_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);}else{logger[_0xcb7f('0xc')](_0xcb7f('0xd'),_0x226ba8,_0xcb7f('0x10'));_0x1f8ba3(_0x4d8d72[_0xcb7f('0x14')][_0xcb7f('0x13')]);}})[_0xcb7f('0x15')](function(_0x2c2799){logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x2c2799);_0x4dde1f(_0x2c2799);});});}exports[_0xcb7f('0x16')]=function(_0x5d43b6){var _0x2430b3=this;return new Promise(function(_0x1d1d4c,_0x57274b){return db['Campaign'][_0xcb7f('0x17')]({'raw':_0x5d43b6[_0xcb7f('0x18')]?_0x5d43b6[_0xcb7f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d43b6['options']?_0x5d43b6[_0xcb7f('0x18')]['where']||null:null,'attributes':_0x5d43b6['options']?_0x5d43b6['options'][_0xcb7f('0x19')]||null:null,'limit':_0x5d43b6[_0xcb7f('0x18')]?_0x5d43b6['options'][_0xcb7f('0x1a')]||null:null,'include':_0x5d43b6[_0xcb7f('0x18')]?_0x5d43b6[_0xcb7f('0x18')][_0xcb7f('0x1b')]?_[_0xcb7f('0x1c')](_0x5d43b6[_0xcb7f('0x18')]['include'],function(_0x588a4b){return{'model':db[_0x588a4b[_0xcb7f('0x1d')]],'as':_0x588a4b['as'],'attributes':_0x588a4b[_0xcb7f('0x19')],'include':_0x588a4b[_0xcb7f('0x1b')]?_[_0xcb7f('0x1c')](_0x588a4b[_0xcb7f('0x1b')],function(_0x2a1a8c){return{'model':db[_0x2a1a8c['model']],'as':_0x2a1a8c['as'],'attributes':_0x2a1a8c[_0xcb7f('0x19')],'include':_0x2a1a8c[_0xcb7f('0x1b')]?_[_0xcb7f('0x1c')](_0x2a1a8c['include'],function(_0x30ecb7){return{'model':db[_0x30ecb7[_0xcb7f('0x1d')]],'as':_0x30ecb7['as'],'attributes':_0x30ecb7[_0xcb7f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8879a1){logger['info'](_0xcb7f('0x16'),_0x5d43b6);logger['debug'](_0xcb7f('0x16'),_0x5d43b6,JSON[_0xcb7f('0x11')](_0x8879a1));_0x1d1d4c(_0x8879a1);})['catch'](function(_0x597a82){logger['error'](_0xcb7f('0x16'),_0x597a82[_0xcb7f('0x13')],_0x5d43b6);_0x57274b(_0x2430b3['error'](0x1f4,_0x597a82[_0xcb7f('0x13')]));});});}; \ No newline at end of file +var _0x8b7c=['debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x17b647,_0x3d0d8a){var _0x14d603=function(_0x5d3b75){while(--_0x5d3b75){_0x17b647['push'](_0x17b647['shift']());}};_0x14d603(++_0x3d0d8a);}(_0x8b7c,0x119));var _0xc8b7=function(_0x3c2efd,_0x405f28){_0x3c2efd=_0x3c2efd-0x0;var _0x433b01=_0x8b7c[_0x3c2efd];return _0x433b01;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var moment=require(_0xc8b7('0x2'));var BPromise=require(_0xc8b7('0x3'));var rs=require(_0xc8b7('0x4'));var fs=require('fs');var Redis=require(_0xc8b7('0x5'));var db=require(_0xc8b7('0x6'))['db'];var utils=require(_0xc8b7('0x7'));var logger=require('../../config/logger')(_0xc8b7('0x8'));var config=require(_0xc8b7('0x9'));var jayson=require(_0xc8b7('0xa'));var client=jayson['client'][_0xc8b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x90cb38,_0x42d65e,_0x2c7807){return new BPromise(function(_0x9e4763,_0x2f149d){return client['request'](_0x90cb38,_0x2c7807)[_0xc8b7('0xc')](function(_0x504550){logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x42d65e,_0xc8b7('0xf'));logger[_0xc8b7('0x10')](_0xc8b7('0x11'),_0x42d65e,'request\x20sent',JSON['stringify'](_0x504550));if(_0x504550['error']){if(_0x504550[_0xc8b7('0x12')][_0xc8b7('0x13')]===0x1f4){logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x504550['error']['message']);return _0x2f149d(_0x504550['error'][_0xc8b7('0x14')]);}logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x504550['error'][_0xc8b7('0x14')]);return _0x9e4763(_0x504550[_0xc8b7('0x12')][_0xc8b7('0x14')]);}else{logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x42d65e,'request\x20sent');_0x9e4763(_0x504550[_0xc8b7('0x15')][_0xc8b7('0x14')]);}})[_0xc8b7('0x16')](function(_0x3323de){logger[_0xc8b7('0x12')](_0xc8b7('0xe'),_0x42d65e,_0x3323de);_0x2f149d(_0x3323de);});});}exports[_0xc8b7('0x17')]=function(_0x485415){var _0x5ae36a=this;return new Promise(function(_0x1cf47c,_0x403659){return db[_0xc8b7('0x18')]['findAll']({'raw':_0x485415['options']?_0x485415[_0xc8b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1a')]||null:null,'attributes':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1b')]||null:null,'limit':_0x485415['options']?_0x485415[_0xc8b7('0x19')][_0xc8b7('0x1c')]||null:null,'include':_0x485415[_0xc8b7('0x19')]?_0x485415['options'][_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x485415[_0xc8b7('0x19')]['include'],function(_0x3b0e47){return{'model':db[_0x3b0e47[_0xc8b7('0x1f')]],'as':_0x3b0e47['as'],'attributes':_0x3b0e47[_0xc8b7('0x1b')],'include':_0x3b0e47[_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x3b0e47[_0xc8b7('0x1d')],function(_0x2acda2){return{'model':db[_0x2acda2[_0xc8b7('0x1f')]],'as':_0x2acda2['as'],'attributes':_0x2acda2[_0xc8b7('0x1b')],'include':_0x2acda2[_0xc8b7('0x1d')]?_[_0xc8b7('0x1e')](_0x2acda2['include'],function(_0x28e65d){return{'model':db[_0x28e65d[_0xc8b7('0x1f')]],'as':_0x28e65d['as'],'attributes':_0x28e65d[_0xc8b7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8b7('0xc')](function(_0x2046f5){logger[_0xc8b7('0xd')]('GetCampaign',_0x485415);logger['debug'](_0xc8b7('0x17'),_0x485415,JSON[_0xc8b7('0x20')](_0x2046f5));_0x1cf47c(_0x2046f5);})[_0xc8b7('0x16')](function(_0x2a2b25){logger[_0xc8b7('0x12')](_0xc8b7('0x17'),_0x2a2b25[_0xc8b7('0x14')],_0x485415);_0x403659(_0x5ae36a['error'](0x1f4,_0x2a2b25[_0xc8b7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 74acadc..d9bf349 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 _0x1da7=['./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','util','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x429ce2,_0x387314){var _0x4045bc=function(_0x1b11a4){while(--_0x1b11a4){_0x429ce2['push'](_0x429ce2['shift']());}};_0x4045bc(++_0x387314);}(_0x1da7,0xee));var _0x71da=function(_0x166548,_0x12113b){_0x166548=_0x166548-0x0;var _0x5837ad=_0x1da7[_0x166548];return _0x5837ad;};'use strict';var multer=require('multer');var util=require(_0x71da('0x0'));var path=require('path');var timeout=require(_0x71da('0x1'));var express=require('express');var router=express[_0x71da('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x71da('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x71da('0x4'));var controller=require(_0x71da('0x5'));router[_0x71da('0x6')]('/',auth[_0x71da('0x7')](),controller['index']);router[_0x71da('0x6')](_0x71da('0x8'),auth['isAuthenticated'](),controller[_0x71da('0x9')]);router[_0x71da('0x6')](_0x71da('0xa'),auth[_0x71da('0x7')](),controller['getHoppers']);router['get'](_0x71da('0xb'),auth[_0x71da('0x7')](),controller['getHopperHistories']);router[_0x71da('0x6')]('/:id/hopper_finals',auth[_0x71da('0x7')](),controller['getHopperFinals']);router[_0x71da('0x6')](_0x71da('0xc'),auth['isAuthenticated'](),controller[_0x71da('0xd')]);router[_0x71da('0x6')](_0x71da('0xe'),auth[_0x71da('0x7')](),controller[_0x71da('0xf')]);router[_0x71da('0x6')](_0x71da('0x10'),auth['isAuthenticated'](),controller[_0x71da('0x11')]);router[_0x71da('0x12')]('/',auth[_0x71da('0x7')](),controller['create']);router[_0x71da('0x12')]('/:id/clone',auth[_0x71da('0x7')](),controller['clone']);router[_0x71da('0x12')]('/:id/lists',auth['isAuthenticated'](),controller[_0x71da('0x13')]);router[_0x71da('0x12')]('/:id/blacklists',auth[_0x71da('0x7')](),controller[_0x71da('0x14')]);router[_0x71da('0x15')](_0x71da('0x8'),auth[_0x71da('0x7')](),controller[_0x71da('0x16')]);router[_0x71da('0x17')](_0x71da('0x8'),auth[_0x71da('0x7')](),controller[_0x71da('0x18')]);router['delete'](_0x71da('0xe'),auth[_0x71da('0x7')](),controller[_0x71da('0x19')]);router[_0x71da('0x17')](_0x71da('0x10'),auth[_0x71da('0x7')](),controller[_0x71da('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd164=['addLists','/:id/blacklists','put','update','delete','destroy','removeBlackLists','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','create','post','/:id/clone'];(function(_0x16aa10,_0xc22da3){var _0x3bc706=function(_0x1fd6a7){while(--_0x1fd6a7){_0x16aa10['push'](_0x16aa10['shift']());}};_0x3bc706(++_0xc22da3);}(_0xd164,0x9e));var _0x4d16=function(_0x3ac201,_0x2ffa10){_0x3ac201=_0x3ac201-0x0;var _0x29b81d=_0xd164[_0x3ac201];return _0x29b81d;};'use strict';var multer=require('multer');var util=require(_0x4d16('0x0'));var path=require(_0x4d16('0x1'));var timeout=require(_0x4d16('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d16('0x3'));var auth=require(_0x4d16('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4d16('0x5'));var controller=require('./campaign.controller');router[_0x4d16('0x6')]('/',auth[_0x4d16('0x7')](),controller['index']);router['get'](_0x4d16('0x8'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x9')]);router[_0x4d16('0x6')](_0x4d16('0xa'),auth['isAuthenticated'](),controller[_0x4d16('0xb')]);router[_0x4d16('0x6')]('/:id/hopper_histories',auth[_0x4d16('0x7')](),controller[_0x4d16('0xc')]);router[_0x4d16('0x6')](_0x4d16('0xd'),auth[_0x4d16('0x7')](),controller[_0x4d16('0xe')]);router['get'](_0x4d16('0xf'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x10')]);router[_0x4d16('0x6')](_0x4d16('0x11'),auth[_0x4d16('0x7')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x4d16('0x7')](),controller[_0x4d16('0x12')]);router['post']('/',auth[_0x4d16('0x7')](),controller[_0x4d16('0x13')]);router[_0x4d16('0x14')](_0x4d16('0x15'),auth[_0x4d16('0x7')](),controller['clone']);router[_0x4d16('0x14')](_0x4d16('0x11'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x16')]);router['post'](_0x4d16('0x17'),auth[_0x4d16('0x7')](),controller['addBlackLists']);router[_0x4d16('0x18')](_0x4d16('0x8'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x19')]);router[_0x4d16('0x1a')](_0x4d16('0x8'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x1b')]);router[_0x4d16('0x1a')](_0x4d16('0x11'),auth[_0x4d16('0x7')](),controller['removeLists']);router['delete'](_0x4d16('0x17'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x1c')]);module[_0x4d16('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 81185e5..4d017c3 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 _0x937a=['medium','VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x5c8fa9,_0x26415f){var _0x35ae19=function(_0x42a1a6){while(--_0x42a1a6){_0x5c8fa9['push'](_0x5c8fa9['shift']());}};_0x35ae19(++_0x26415f);}(_0x937a,0x94));var _0xa937=function(_0x4d69a6,_0x44cbe8){_0x4d69a6=_0x4d69a6-0x0;var _0x56739a=_0x937a[_0x4d69a6];return _0x56739a;};'use strict';var Sequelize=require(_0xa937('0x0'));module['exports']={'key':{'type':Sequelize[_0xa937('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xa937('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa937('0x3')],'get':function(){return this[_0xa937('0x4')](_0xa937('0x5'));}}}; \ No newline at end of file +var _0x8535=['VIRTUAL','getDataValue','key','exports','TEXT','medium'];(function(_0xac4af,_0x309efb){var _0x473b46=function(_0x1bb587){while(--_0x1bb587){_0xac4af['push'](_0xac4af['shift']());}};_0x473b46(++_0x309efb);}(_0x8535,0x13b));var _0x5853=function(_0x56ceb5,_0x517b43){_0x56ceb5=_0x56ceb5-0x0;var _0x24139c=_0x8535[_0x56ceb5];return _0x24139c;};'use strict';var Sequelize=require('sequelize');module[_0x5853('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x5853('0x1')],'length':_0x5853('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x5853('0x3')],'get':function(){return this[_0x5853('0x4')](_0x5853('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index dda11b3..5b4e3d6 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 _0x2bfd=['fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','CannedAnswers','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x3b3092,_0x1eee2a){var _0x399002=function(_0x54b829){while(--_0x54b829){_0x3b3092['push'](_0x3b3092['shift']());}};_0x399002(++_0x1eee2a);}(_0x2bfd,0x77));var _0xd2bf=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x2bfd[_0x36f243];return _0x426436;};'use strict';var emlformat=require(_0xd2bf('0x0'));var rimraf=require(_0xd2bf('0x1'));var zipdir=require(_0xd2bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2bf('0x3'));var moment=require('moment');var BPromise=require(_0xd2bf('0x4'));var Mustache=require(_0xd2bf('0x5'));var util=require(_0xd2bf('0x6'));var path=require('path');var sox=require(_0xd2bf('0x7'));var csv=require(_0xd2bf('0x8'));var ejs=require(_0xd2bf('0x9'));var fs=require('fs');var fs_extra=require(_0xd2bf('0xa'));var _=require(_0xd2bf('0xb'));var squel=require(_0xd2bf('0xc'));var crypto=require(_0xd2bf('0xd'));var jsforce=require(_0xd2bf('0xe'));var deskjs=require(_0xd2bf('0xf'));var toCsv=require(_0xd2bf('0x8'));var querystring=require('querystring');var Papa=require(_0xd2bf('0x10'));var Redis=require(_0xd2bf('0x11'));var authService=require(_0xd2bf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd2bf('0x13'));var hardwareService=require(_0xd2bf('0x14'));var logger=require('../../config/logger')(_0xd2bf('0x15'));var utils=require(_0xd2bf('0x16'));var config=require(_0xd2bf('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30e636,_0x3099f8){_0x3099f8=_0x3099f8||0xcc;return function(_0x2fe218){if(_0x2fe218){return _0x30e636[_0xd2bf('0x18')](_0x3099f8);}return _0x30e636[_0xd2bf('0x19')](_0x3099f8)[_0xd2bf('0x1a')]();};}function respondWithResult(_0x71d706,_0x3d2af4){_0x3d2af4=_0x3d2af4||0xc8;return function(_0x3bf98e){if(_0x3bf98e){return _0x71d706[_0xd2bf('0x19')](_0x3d2af4)['json'](_0x3bf98e);}};}function respondWithFilteredResult(_0x497359,_0x50261f){return function(_0x1b76b1){if(_0x1b76b1){var _0x4283af=typeof _0x50261f['offset']==='undefined'&&typeof _0x50261f[_0xd2bf('0x1b')]===_0xd2bf('0x1c');var _0x1d2b4a=_0x1b76b1[_0xd2bf('0x1d')];var _0x5a702b=_0x4283af?0x0:_0x50261f['offset'];var _0x170fbb=_0x4283af?_0x1b76b1[_0xd2bf('0x1d')]:_0x50261f[_0xd2bf('0x1e')]+_0x50261f[_0xd2bf('0x1b')];var _0x589c18;if(_0x170fbb>=_0x1d2b4a){_0x170fbb=_0x1d2b4a;_0x589c18=0xc8;}else{_0x589c18=0xce;}_0x497359['status'](_0x589c18);return _0x497359[_0xd2bf('0x1f')](_0xd2bf('0x20'),_0x5a702b+'-'+_0x170fbb+'/'+_0x1d2b4a)[_0xd2bf('0x21')](_0x1b76b1);}return null;};}function patchUpdates(_0x1c6711){return function(_0x32f9c9){try{jsonpatch[_0xd2bf('0x22')](_0x32f9c9,_0x1c6711,!![]);}catch(_0x43fc35){return BPromise[_0xd2bf('0x23')](_0x43fc35);}return _0x32f9c9['save']();};}function saveUpdates(_0x47cd27,_0x26bd76){return function(_0x80d19d){if(_0x80d19d){return _0x80d19d[_0xd2bf('0x24')](_0x47cd27)[_0xd2bf('0x25')](function(_0x55b513){return _0x55b513;});}return null;};}function removeEntity(_0x39f9d6,_0x1edd13){return function(_0x34c7a7){if(_0x34c7a7){return _0x34c7a7[_0xd2bf('0x26')]()[_0xd2bf('0x25')](function(){var _0x57bde6=_0x34c7a7[_0xd2bf('0x27')]({'plain':!![]});var _0x37ffa9=_0xd2bf('0x28');return db['UserProfileResource'][_0xd2bf('0x26')]({'where':{'type':_0x37ffa9,'resourceId':_0x57bde6['id']}})[_0xd2bf('0x25')](function(){return _0x34c7a7;});})[_0xd2bf('0x25')](function(){_0x39f9d6['status'](0xcc)[_0xd2bf('0x1a')]();});}};}function handleEntityNotFound(_0x1ace01,_0x1d2441){return function(_0x491668){if(!_0x491668){_0x1ace01[_0xd2bf('0x18')](0x194);}return _0x491668;};}function handleError(_0x376c3b,_0x3dd61d){_0x3dd61d=_0x3dd61d||0x1f4;return function(_0x41b45f){logger[_0xd2bf('0x29')](_0x41b45f[_0xd2bf('0x2a')]);if(_0x41b45f[_0xd2bf('0x2b')]){delete _0x41b45f[_0xd2bf('0x2b')];}_0x376c3b[_0xd2bf('0x19')](_0x3dd61d)[_0xd2bf('0x2c')](_0x41b45f);};}exports['index']=function(_0x20da60,_0x414e13){var _0x487215={},_0x595ac0={},_0x2fdfee={'count':0x0,'rows':[]};var _0x338a40=_[_0xd2bf('0x2d')](db[_0xd2bf('0x2e')][_0xd2bf('0x2f')],function(_0x27f379){return{'name':_0x27f379[_0xd2bf('0x30')],'type':_0x27f379[_0xd2bf('0x31')][_0xd2bf('0x32')]};});_0x595ac0[_0xd2bf('0x33')]=_[_0xd2bf('0x2d')](_0x338a40,'name');_0x595ac0[_0xd2bf('0x34')]=_[_0xd2bf('0x35')](_0x20da60[_0xd2bf('0x34')]);_0x595ac0[_0xd2bf('0x36')]=_[_0xd2bf('0x37')](_0x595ac0[_0xd2bf('0x33')],_0x595ac0[_0xd2bf('0x34')]);_0x487215[_0xd2bf('0x38')]=_['intersection'](_0x595ac0[_0xd2bf('0x33')],qs[_0xd2bf('0x39')](_0x20da60['query'][_0xd2bf('0x39')]));_0x487215[_0xd2bf('0x38')]=_0x487215[_0xd2bf('0x38')][_0xd2bf('0x3a')]?_0x487215[_0xd2bf('0x38')]:_0x595ac0[_0xd2bf('0x33')];if(!_0x20da60['query']['hasOwnProperty'](_0xd2bf('0x3b'))){_0x487215[_0xd2bf('0x1b')]=qs[_0xd2bf('0x1b')](_0x20da60[_0xd2bf('0x34')][_0xd2bf('0x1b')]);_0x487215[_0xd2bf('0x1e')]=qs[_0xd2bf('0x1e')](_0x20da60[_0xd2bf('0x34')][_0xd2bf('0x1e')]);}_0x487215[_0xd2bf('0x3c')]=qs[_0xd2bf('0x3d')](_0x20da60[_0xd2bf('0x34')][_0xd2bf('0x3d')]);_0x487215[_0xd2bf('0x3e')]=qs[_0xd2bf('0x36')](_[_0xd2bf('0x3f')](_0x20da60[_0xd2bf('0x34')],_0x595ac0[_0xd2bf('0x36')]),_0x338a40);if(_0x20da60[_0xd2bf('0x34')]['filter']){_0x487215[_0xd2bf('0x3e')]=_[_0xd2bf('0x40')](_0x487215[_0xd2bf('0x3e')],{'$or':[{'key':{'$like':'%'+_0x20da60[_0xd2bf('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x20da60['query'][_0xd2bf('0x41')]+'%'}}]});}_0x487215=_['merge']({},_0x487215,_0x20da60[_0xd2bf('0x42')]);var _0x5e8124={'where':_0x487215[_0xd2bf('0x3e')]};return db['CannedAnswer'][_0xd2bf('0x1d')](_0x5e8124)['then'](function(_0x22f92a){_0x2fdfee[_0xd2bf('0x1d')]=_0x22f92a;if(_0x20da60[_0xd2bf('0x34')][_0xd2bf('0x43')]){_0x487215[_0xd2bf('0x44')]=[{'all':!![]}];}return db[_0xd2bf('0x2e')][_0xd2bf('0x45')](_0x487215);})[_0xd2bf('0x25')](function(_0x585d23){_0x2fdfee[_0xd2bf('0x46')]=_0x585d23;return _0x2fdfee;})['then'](respondWithFilteredResult(_0x414e13,_0x487215))[_0xd2bf('0x47')](handleError(_0x414e13,null));};exports['show']=function(_0xa0a4af,_0x337759){var _0x52e74c={'raw':!![],'where':{'id':_0xa0a4af['params']['id']}},_0x5c5da4={};_0x5c5da4['model']=_[_0xd2bf('0x35')](db[_0xd2bf('0x2e')][_0xd2bf('0x2f')]);_0x5c5da4[_0xd2bf('0x34')]=_[_0xd2bf('0x35')](_0xa0a4af[_0xd2bf('0x34')]);_0x5c5da4[_0xd2bf('0x36')]=_['intersection'](_0x5c5da4['model'],_0x5c5da4[_0xd2bf('0x34')]);_0x52e74c[_0xd2bf('0x38')]=_[_0xd2bf('0x37')](_0x5c5da4[_0xd2bf('0x33')],qs[_0xd2bf('0x39')](_0xa0a4af['query'][_0xd2bf('0x39')]));_0x52e74c['attributes']=_0x52e74c[_0xd2bf('0x38')][_0xd2bf('0x3a')]?_0x52e74c[_0xd2bf('0x38')]:_0x5c5da4['model'];if(_0xa0a4af['query'][_0xd2bf('0x43')]){_0x52e74c[_0xd2bf('0x44')]=[{'all':!![]}];}_0x52e74c=_['merge']({},_0x52e74c,_0xa0a4af[_0xd2bf('0x42')]);return db[_0xd2bf('0x2e')][_0xd2bf('0x48')](_0x52e74c)[_0xd2bf('0x25')](handleEntityNotFound(_0x337759,null))[_0xd2bf('0x25')](respondWithResult(_0x337759,null))[_0xd2bf('0x47')](handleError(_0x337759,null));};exports[_0xd2bf('0x24')]=function(_0x488508,_0x4f3c4b){if(_0x488508[_0xd2bf('0x49')]['id']){delete _0x488508[_0xd2bf('0x49')]['id'];}return db['CannedAnswer'][_0xd2bf('0x48')]({'where':{'id':_0x488508[_0xd2bf('0x4a')]['id']}})[_0xd2bf('0x25')](handleEntityNotFound(_0x4f3c4b,null))[_0xd2bf('0x25')](saveUpdates(_0x488508['body'],null))[_0xd2bf('0x25')](respondWithResult(_0x4f3c4b,null))['catch'](handleError(_0x4f3c4b,null));};exports['destroy']=function(_0x43e801,_0x5bce20){return db[_0xd2bf('0x2e')][_0xd2bf('0x48')]({'where':{'id':_0x43e801[_0xd2bf('0x4a')]['id']}})[_0xd2bf('0x25')](handleEntityNotFound(_0x5bce20,null))[_0xd2bf('0x25')](removeEntity(_0x5bce20,null))[_0xd2bf('0x47')](handleError(_0x5bce20,null));};exports[_0xd2bf('0x4b')]=function(_0xd23076,_0x1408a2){var _0x108b27={'key':_0xd23076['body'][_0xd2bf('0x32')]};if(_0xd23076[_0xd2bf('0x49')][_0xd2bf('0x4c')]){_0x108b27[_0xd2bf('0x4c')]=_0xd23076[_0xd2bf('0x49')][_0xd2bf('0x4c')];}else if(_0xd23076[_0xd2bf('0x49')][_0xd2bf('0x4d')]){_0x108b27['SmsAccountId']=_0xd23076[_0xd2bf('0x49')][_0xd2bf('0x4d')];}else if(_0xd23076[_0xd2bf('0x49')][_0xd2bf('0x4e')]){_0x108b27[_0xd2bf('0x4e')]=_0xd23076[_0xd2bf('0x49')][_0xd2bf('0x4e')];}else if(_0xd23076[_0xd2bf('0x49')]['ChatWebsiteId']){_0x108b27[_0xd2bf('0x4f')]=_0xd23076['body'][_0xd2bf('0x4f')];}return db['CannedAnswer']['find']({'where':_0x108b27})[_0xd2bf('0x25')](function(_0x198ce2){if(_0x198ce2){throw new db['Sequelize'][(_0xd2bf('0x50'))](_0xd2bf('0x51'));}return db[_0xd2bf('0x2e')][_0xd2bf('0x4b')](_0xd23076[_0xd2bf('0x49')]);})[_0xd2bf('0x25')](function(_0x30e6bd){var _0xd23240=_0xd23076['user'][_0xd2bf('0x27')]({'plain':!![]});if(!_0xd23240)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd23240['role']===_0xd2bf('0x52')){var _0x171d85=_0x30e6bd[_0xd2bf('0x27')]({'plain':!![]});return db[_0xd2bf('0x53')][_0xd2bf('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0xd23240[_0xd2bf('0x54')]},'raw':!![]})['then'](function(_0x6044dd){if(_0x6044dd&&_0x6044dd[_0xd2bf('0x55')]===0x0){return db[_0xd2bf('0x56')][_0xd2bf('0x4b')]({'name':_0x171d85[_0xd2bf('0x2b')],'resourceId':_0x171d85['id'],'type':_0x6044dd[_0xd2bf('0x2b')],'sectionId':_0x6044dd['id']},{})[_0xd2bf('0x25')](function(){return _0x30e6bd;});}else{return _0x30e6bd;}})[_0xd2bf('0x47')](function(_0x37cdfb){logger['error'](_0xd2bf('0x57'),_0x37cdfb);throw _0x37cdfb;});}return _0x30e6bd;})['then'](respondWithResult(_0x1408a2,0xc9))[_0xd2bf('0x47')](handleError(_0x1408a2,null));}; \ No newline at end of file +var _0x6b14=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','index','map','CannedAnswer','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','length','options','find','params','destroy','create','MailAccountId','body','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','UserProfileResource'];(function(_0x2b72c0,_0x1bc08f){var _0x12af91=function(_0x5ccb77){while(--_0x5ccb77){_0x2b72c0['push'](_0x2b72c0['shift']());}};_0x12af91(++_0x1bc08f);}(_0x6b14,0x168));var _0x46b1=function(_0x5b5fa6,_0x26eb1f){_0x5b5fa6=_0x5b5fa6-0x0;var _0x2a06b4=_0x6b14[_0x5b5fa6];return _0x2a06b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b1('0x0'));var zipdir=require(_0x46b1('0x1'));var jsonpatch=require(_0x46b1('0x2'));var rp=require('request-promise');var moment=require(_0x46b1('0x3'));var BPromise=require(_0x46b1('0x4'));var Mustache=require(_0x46b1('0x5'));var util=require(_0x46b1('0x6'));var path=require(_0x46b1('0x7'));var sox=require(_0x46b1('0x8'));var csv=require(_0x46b1('0x9'));var ejs=require(_0x46b1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46b1('0xb'));var squel=require(_0x46b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x46b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x46b1('0x9'));var querystring=require(_0x46b1('0xe'));var Papa=require(_0x46b1('0xf'));var Redis=require(_0x46b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x46b1('0x11'));var as=require(_0x46b1('0x12'));var hardwareService=require(_0x46b1('0x13'));var logger=require(_0x46b1('0x14'))(_0x46b1('0x15'));var utils=require('../../config/utils');var config=require(_0x46b1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x46b1('0x17'))['db'];function respondWithStatusCode(_0x484a7d,_0x3043a3){_0x3043a3=_0x3043a3||0xcc;return function(_0x90a936){if(_0x90a936){return _0x484a7d['sendStatus'](_0x3043a3);}return _0x484a7d['status'](_0x3043a3)[_0x46b1('0x18')]();};}function respondWithResult(_0x5006be,_0x2f9d78){_0x2f9d78=_0x2f9d78||0xc8;return function(_0xdc5b85){if(_0xdc5b85){return _0x5006be[_0x46b1('0x19')](_0x2f9d78)['json'](_0xdc5b85);}};}function respondWithFilteredResult(_0x49e1d7,_0x5022d3){return function(_0x4667cd){if(_0x4667cd){var _0x28367e=typeof _0x5022d3[_0x46b1('0x1a')]==='undefined'&&typeof _0x5022d3[_0x46b1('0x1b')]===_0x46b1('0x1c');var _0x448495=_0x4667cd['count'];var _0x398923=_0x28367e?0x0:_0x5022d3[_0x46b1('0x1a')];var _0x545b74=_0x28367e?_0x4667cd[_0x46b1('0x1d')]:_0x5022d3['offset']+_0x5022d3[_0x46b1('0x1b')];var _0x95e9da;if(_0x545b74>=_0x448495){_0x545b74=_0x448495;_0x95e9da=0xc8;}else{_0x95e9da=0xce;}_0x49e1d7['status'](_0x95e9da);return _0x49e1d7[_0x46b1('0x1e')](_0x46b1('0x1f'),_0x398923+'-'+_0x545b74+'/'+_0x448495)[_0x46b1('0x20')](_0x4667cd);}return null;};}function patchUpdates(_0x27d281){return function(_0x5b3061){try{jsonpatch[_0x46b1('0x21')](_0x5b3061,_0x27d281,!![]);}catch(_0x4eaa8c){return BPromise[_0x46b1('0x22')](_0x4eaa8c);}return _0x5b3061[_0x46b1('0x23')]();};}function saveUpdates(_0x5bffde,_0x189ec6){return function(_0x17b600){if(_0x17b600){return _0x17b600[_0x46b1('0x24')](_0x5bffde)[_0x46b1('0x25')](function(_0x47be61){return _0x47be61;});}return null;};}function removeEntity(_0x22884b,_0x27e86b){return function(_0x4e202f){if(_0x4e202f){return _0x4e202f['destroy']()[_0x46b1('0x25')](function(){var _0x40f5de=_0x4e202f['get']({'plain':!![]});var _0x425e94='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x425e94,'resourceId':_0x40f5de['id']}})[_0x46b1('0x25')](function(){return _0x4e202f;});})[_0x46b1('0x25')](function(){_0x22884b[_0x46b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3539,_0x2dbcea){return function(_0xbfd9ac){if(!_0xbfd9ac){_0x2d3539[_0x46b1('0x26')](0x194);}return _0xbfd9ac;};}function handleError(_0x4d5e1a,_0x28575a){_0x28575a=_0x28575a||0x1f4;return function(_0x10985d){logger[_0x46b1('0x27')](_0x10985d['stack']);if(_0x10985d[_0x46b1('0x28')]){delete _0x10985d[_0x46b1('0x28')];}_0x4d5e1a[_0x46b1('0x19')](_0x28575a)['send'](_0x10985d);};}exports[_0x46b1('0x29')]=function(_0xc8d1bb,_0x4b7aca){var _0x21594b={},_0x170ae4={},_0x3f4a4e={'count':0x0,'rows':[]};var _0x3664d2=_[_0x46b1('0x2a')](db[_0x46b1('0x2b')]['rawAttributes'],function(_0x5c3df3){return{'name':_0x5c3df3[_0x46b1('0x2c')],'type':_0x5c3df3['type'][_0x46b1('0x2d')]};});_0x170ae4[_0x46b1('0x2e')]=_['map'](_0x3664d2,_0x46b1('0x28'));_0x170ae4[_0x46b1('0x2f')]=_[_0x46b1('0x30')](_0xc8d1bb[_0x46b1('0x2f')]);_0x170ae4[_0x46b1('0x31')]=_[_0x46b1('0x32')](_0x170ae4[_0x46b1('0x2e')],_0x170ae4[_0x46b1('0x2f')]);_0x21594b[_0x46b1('0x33')]=_[_0x46b1('0x32')](_0x170ae4['model'],qs[_0x46b1('0x34')](_0xc8d1bb['query']['fields']));_0x21594b[_0x46b1('0x33')]=_0x21594b[_0x46b1('0x33')]['length']?_0x21594b['attributes']:_0x170ae4[_0x46b1('0x2e')];if(!_0xc8d1bb['query'][_0x46b1('0x35')](_0x46b1('0x36'))){_0x21594b[_0x46b1('0x1b')]=qs[_0x46b1('0x1b')](_0xc8d1bb[_0x46b1('0x2f')][_0x46b1('0x1b')]);_0x21594b['offset']=qs[_0x46b1('0x1a')](_0xc8d1bb[_0x46b1('0x2f')][_0x46b1('0x1a')]);}_0x21594b[_0x46b1('0x37')]=qs['sort'](_0xc8d1bb[_0x46b1('0x2f')][_0x46b1('0x38')]);_0x21594b[_0x46b1('0x39')]=qs[_0x46b1('0x31')](_[_0x46b1('0x3a')](_0xc8d1bb[_0x46b1('0x2f')],_0x170ae4[_0x46b1('0x31')]),_0x3664d2);if(_0xc8d1bb[_0x46b1('0x2f')][_0x46b1('0x3b')]){_0x21594b[_0x46b1('0x39')]=_[_0x46b1('0x3c')](_0x21594b[_0x46b1('0x39')],{'$or':[{'key':{'$like':'%'+_0xc8d1bb[_0x46b1('0x2f')][_0x46b1('0x3b')]+'%'}},{'value':{'$like':'%'+_0xc8d1bb[_0x46b1('0x2f')]['filter']+'%'}}]});}_0x21594b=_[_0x46b1('0x3c')]({},_0x21594b,_0xc8d1bb['options']);var _0x2c08ce={'where':_0x21594b[_0x46b1('0x39')]};return db[_0x46b1('0x2b')]['count'](_0x2c08ce)[_0x46b1('0x25')](function(_0x4d861f){_0x3f4a4e[_0x46b1('0x1d')]=_0x4d861f;if(_0xc8d1bb[_0x46b1('0x2f')][_0x46b1('0x3d')]){_0x21594b[_0x46b1('0x3e')]=[{'all':!![]}];}return db[_0x46b1('0x2b')][_0x46b1('0x3f')](_0x21594b);})[_0x46b1('0x25')](function(_0x4626ab){_0x3f4a4e[_0x46b1('0x40')]=_0x4626ab;return _0x3f4a4e;})[_0x46b1('0x25')](respondWithFilteredResult(_0x4b7aca,_0x21594b))[_0x46b1('0x41')](handleError(_0x4b7aca,null));};exports[_0x46b1('0x42')]=function(_0x473d6d,_0x5731f9){var _0x69e58d={'raw':!![],'where':{'id':_0x473d6d['params']['id']}},_0x329ee4={};_0x329ee4['model']=_['keys'](db[_0x46b1('0x2b')]['rawAttributes']);_0x329ee4[_0x46b1('0x2f')]=_[_0x46b1('0x30')](_0x473d6d[_0x46b1('0x2f')]);_0x329ee4[_0x46b1('0x31')]=_[_0x46b1('0x32')](_0x329ee4['model'],_0x329ee4[_0x46b1('0x2f')]);_0x69e58d[_0x46b1('0x33')]=_['intersection'](_0x329ee4[_0x46b1('0x2e')],qs['fields'](_0x473d6d[_0x46b1('0x2f')][_0x46b1('0x34')]));_0x69e58d['attributes']=_0x69e58d[_0x46b1('0x33')][_0x46b1('0x43')]?_0x69e58d[_0x46b1('0x33')]:_0x329ee4[_0x46b1('0x2e')];if(_0x473d6d['query'][_0x46b1('0x3d')]){_0x69e58d['include']=[{'all':!![]}];}_0x69e58d=_[_0x46b1('0x3c')]({},_0x69e58d,_0x473d6d[_0x46b1('0x44')]);return db[_0x46b1('0x2b')]['find'](_0x69e58d)[_0x46b1('0x25')](handleEntityNotFound(_0x5731f9,null))[_0x46b1('0x25')](respondWithResult(_0x5731f9,null))['catch'](handleError(_0x5731f9,null));};exports['update']=function(_0x4e4601,_0x1ae613){if(_0x4e4601['body']['id']){delete _0x4e4601['body']['id'];}return db[_0x46b1('0x2b')][_0x46b1('0x45')]({'where':{'id':_0x4e4601[_0x46b1('0x46')]['id']}})[_0x46b1('0x25')](handleEntityNotFound(_0x1ae613,null))[_0x46b1('0x25')](saveUpdates(_0x4e4601['body'],null))[_0x46b1('0x25')](respondWithResult(_0x1ae613,null))[_0x46b1('0x41')](handleError(_0x1ae613,null));};exports[_0x46b1('0x47')]=function(_0x107624,_0x3fb7d9){return db['CannedAnswer'][_0x46b1('0x45')]({'where':{'id':_0x107624[_0x46b1('0x46')]['id']}})[_0x46b1('0x25')](handleEntityNotFound(_0x3fb7d9,null))[_0x46b1('0x25')](removeEntity(_0x3fb7d9,null))[_0x46b1('0x41')](handleError(_0x3fb7d9,null));};exports[_0x46b1('0x48')]=function(_0x58c45e,_0x19a491){var _0xdb29e7={'key':_0x58c45e['body'][_0x46b1('0x2d')]};if(_0x58c45e['body'][_0x46b1('0x49')]){_0xdb29e7['MailAccountId']=_0x58c45e[_0x46b1('0x4a')][_0x46b1('0x49')];}else if(_0x58c45e[_0x46b1('0x4a')][_0x46b1('0x4b')]){_0xdb29e7[_0x46b1('0x4b')]=_0x58c45e['body'][_0x46b1('0x4b')];}else if(_0x58c45e[_0x46b1('0x4a')]['OpenchannelAccountId']){_0xdb29e7['OpenchannelAccountId']=_0x58c45e['body'][_0x46b1('0x4c')];}else if(_0x58c45e['body'][_0x46b1('0x4d')]){_0xdb29e7[_0x46b1('0x4d')]=_0x58c45e[_0x46b1('0x4a')][_0x46b1('0x4d')];}return db[_0x46b1('0x2b')][_0x46b1('0x45')]({'where':_0xdb29e7})[_0x46b1('0x25')](function(_0x43603d){if(_0x43603d){throw new db[(_0x46b1('0x4e'))][(_0x46b1('0x4f'))](_0x46b1('0x50'));}return db['CannedAnswer'][_0x46b1('0x48')](_0x58c45e[_0x46b1('0x4a')]);})['then'](function(_0x36fcdd){var _0x1299fb=_0x58c45e['user']['get']({'plain':!![]});if(!_0x1299fb)throw new Error(_0x46b1('0x51'));if(_0x1299fb[_0x46b1('0x52')]===_0x46b1('0x53')){var _0x597cb2=_0x36fcdd[_0x46b1('0x54')]({'plain':!![]});return db[_0x46b1('0x55')]['find']({'where':{'name':_0x46b1('0x56'),'userProfileId':_0x1299fb[_0x46b1('0x57')]},'raw':!![]})[_0x46b1('0x25')](function(_0x587cb1){if(_0x587cb1&&_0x587cb1[_0x46b1('0x58')]===0x0){return db[_0x46b1('0x59')][_0x46b1('0x48')]({'name':_0x597cb2[_0x46b1('0x28')],'resourceId':_0x597cb2['id'],'type':_0x587cb1['name'],'sectionId':_0x587cb1['id']},{})[_0x46b1('0x25')](function(){return _0x36fcdd;});}else{return _0x36fcdd;}})[_0x46b1('0x41')](function(_0x711ab5){logger[_0x46b1('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x711ab5);throw _0x711ab5;});}return _0x36fcdd;})[_0x46b1('0x25')](respondWithResult(_0x19a491,0xc9))[_0x46b1('0x41')](handleError(_0x19a491,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6c9ab49..8aec05b 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 _0x0de3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4_unicode_ci','lodash','util'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x0de3,0x184));var _0x30de=function(_0x235b75,_0x322c34){_0x235b75=_0x235b75-0x0;var _0x38d797=_0x0de3[_0x235b75];return _0x38d797;};'use strict';var _=require(_0x30de('0x0'));var util=require(_0x30de('0x1'));var logger=require('../../config/logger')(_0x30de('0x2'));var moment=require(_0x30de('0x3'));var BPromise=require(_0x30de('0x4'));var rp=require(_0x30de('0x5'));var fs=require('fs');var path=require(_0x30de('0x6'));var rimraf=require(_0x30de('0x7'));var config=require(_0x30de('0x8'));var attributes=require(_0x30de('0x9'));module[_0x30de('0xa')]=function(_0x512874,_0x55e5e9){return _0x512874[_0x30de('0xb')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x30de('0xc')});}; \ No newline at end of file +var _0x160b=['CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x233277,_0x2568a0){var _0x5d215e=function(_0x419752){while(--_0x419752){_0x233277['push'](_0x233277['shift']());}};_0x5d215e(++_0x2568a0);}(_0x160b,0xff));var _0xb160=function(_0x4d7d6d,_0x1f67c0){_0x4d7d6d=_0x4d7d6d-0x0;var _0x447c3b=_0x160b[_0x4d7d6d];return _0x447c3b;};'use strict';var _=require(_0xb160('0x0'));var util=require(_0xb160('0x1'));var logger=require(_0xb160('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb160('0x3'));var rp=require(_0xb160('0x4'));var fs=require('fs');var path=require(_0xb160('0x5'));var rimraf=require(_0xb160('0x6'));var config=require(_0xb160('0x7'));var attributes=require(_0xb160('0x8'));module[_0xb160('0x9')]=function(_0x42a9c4,_0x29248e){return _0x42a9c4[_0xb160('0xa')](_0xb160('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb160('0xc'),'collate':_0xb160('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 93d5f8b..27ba989 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(_0xbfa2b4,_0x4e3706){var _0x34024e=function(_0x5825a3){while(--_0x5825a3){_0xbfa2b4['push'](_0xbfa2b4['shift']());}};_0x34024e(++_0x4e3706);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x7efe61,_0x38754f){var _0x333432=function(_0x16d078){while(--_0x16d078){_0x7efe61['push'](_0x7efe61['shift']());}};_0x333432(++_0x38754f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 45079ac..709395a 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 _0x0d7d=['isAuthenticated','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x0d7d,0x1db));var _0xd0d7=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x0d7d[_0x4851ff];return _0x26773b;};'use strict';var multer=require(_0xd0d7('0x0'));var util=require(_0xd0d7('0x1'));var path=require(_0xd0d7('0x2'));var timeout=require(_0xd0d7('0x3'));var express=require(_0xd0d7('0x4'));var router=express['Router']();var fs_extra=require(_0xd0d7('0x5'));var auth=require(_0xd0d7('0x6'));var interaction=require(_0xd0d7('0x7'));var config=require(_0xd0d7('0x8'));var controller=require(_0xd0d7('0x9'));router[_0xd0d7('0xa')]('/',auth[_0xd0d7('0xb')](),controller['index']);router['get'](_0xd0d7('0xc'),auth[_0xd0d7('0xb')](),controller['show']);router[_0xd0d7('0xd')]('/',auth[_0xd0d7('0xb')](),controller[_0xd0d7('0xe')]);router['put']('/:id',auth[_0xd0d7('0xb')](),controller[_0xd0d7('0xf')]);router[_0xd0d7('0x10')]('/:id',auth[_0xd0d7('0xb')](),controller[_0xd0d7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1293=['put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x969954,_0x31293f){var _0x1585dc=function(_0x8be733){while(--_0x8be733){_0x969954['push'](_0x969954['shift']());}};_0x1585dc(++_0x31293f);}(_0x1293,0x10d));var _0x3129=function(_0x3290b0,_0x381109){_0x3290b0=_0x3290b0-0x0;var _0x52d0d8=_0x1293[_0x3290b0];return _0x52d0d8;};'use strict';var multer=require('multer');var util=require(_0x3129('0x0'));var path=require(_0x3129('0x1'));var timeout=require(_0x3129('0x2'));var express=require(_0x3129('0x3'));var router=express[_0x3129('0x4')]();var fs_extra=require(_0x3129('0x5'));var auth=require(_0x3129('0x6'));var interaction=require(_0x3129('0x7'));var config=require(_0x3129('0x8'));var controller=require(_0x3129('0x9'));router[_0x3129('0xa')]('/',auth['isAuthenticated'](),controller[_0x3129('0xb')]);router['get'](_0x3129('0xc'),auth[_0x3129('0xd')](),controller['show']);router[_0x3129('0xe')]('/',auth[_0x3129('0xd')](),controller[_0x3129('0xf')]);router[_0x3129('0x10')]('/:id',auth[_0x3129('0xd')](),controller['update']);router[_0x3129('0x11')](_0x3129('0xc'),auth[_0x3129('0xd')](),controller[_0x3129('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index b7563c5..070d279 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 _0xa508=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x553c61,_0x594716){var _0x20d786=function(_0x4f1c62){while(--_0x4f1c62){_0x553c61['push'](_0x553c61['shift']());}};_0x20d786(++_0x594716);}(_0xa508,0x187));var _0x8a50=function(_0x15a5b4,_0x90b469){_0x15a5b4=_0x15a5b4-0x0;var _0x26f037=_0xa508[_0x15a5b4];return _0x26f037;};'use strict';var Sequelize=require(_0x8a50('0x0'));module[_0x8a50('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x8a50('0x2')},'clid':{'type':Sequelize[_0x8a50('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x8a50('0x3')]},'channel':{'type':Sequelize[_0x8a50('0x3')]},'dstchannel':{'type':Sequelize[_0x8a50('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x8a50('0x3')]},'duration':{'type':Sequelize[_0x8a50('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8a50('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x8a50('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8a50('0x3')]},'userfield':{'type':Sequelize[_0x8a50('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x8a50('0x3')]},'sequence':{'type':Sequelize[_0x8a50('0x3')]},'peeraccount':{'type':Sequelize[_0x8a50('0x3')]},'type':{'type':Sequelize[_0x8a50('0x3')]},'tag':{'type':Sequelize[_0x8a50('0x3')]}}; \ No newline at end of file +var _0x5bb7=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1a3fe2,_0x553b71){var _0x490ee2=function(_0xc569b4){while(--_0xc569b4){_0x1a3fe2['push'](_0x1a3fe2['shift']());}};_0x490ee2(++_0x553b71);}(_0x5bb7,0x104));var _0x75bb=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x5bb7[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0x75bb('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x75bb('0x1')],'allowNull':![],'defaultValue':_0x75bb('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x75bb('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x75bb('0x3')]},'dstchannel':{'type':Sequelize[_0x75bb('0x3')]},'lastapp':{'type':Sequelize[_0x75bb('0x3')]},'lastdata':{'type':Sequelize[_0x75bb('0x3')]},'duration':{'type':Sequelize[_0x75bb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x75bb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75bb('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x75bb('0x3')]},'userfield':{'type':Sequelize[_0x75bb('0x3')]},'uniqueid':{'type':Sequelize[_0x75bb('0x3')]},'linkedid':{'type':Sequelize[_0x75bb('0x3')]},'sequence':{'type':Sequelize[_0x75bb('0x3')]},'peeraccount':{'type':Sequelize[_0x75bb('0x3')]},'type':{'type':Sequelize[_0x75bb('0x3')]},'tag':{'type':Sequelize[_0x75bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index bbc659b..2be2f10 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 _0x032e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Cdr','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xc48470,_0x2561ad){var _0x2152be=function(_0x2a0a34){while(--_0x2a0a34){_0xc48470['push'](_0xc48470['shift']());}};_0x2152be(++_0x2561ad);}(_0x032e,0x124));var _0xe032=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x032e[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['index']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={},_0x469290={},_0xae116e={'count':0x0,'rows':[]};var _0x4e8b72=_['map'](db['Cdr'][_0xe032('0x2b')],function(_0x1dd34f){return{'name':_0x1dd34f[_0xe032('0x2c')],'type':_0x1dd34f[_0xe032('0x2d')]['key']};});_0x469290[_0xe032('0x2e')]=_[_0xe032('0x2f')](_0x4e8b72,_0xe032('0x29'));_0x469290[_0xe032('0x30')]=_[_0xe032('0x31')](_0x5573e4['query']);_0x469290[_0xe032('0x32')]=_[_0xe032('0x33')](_0x469290[_0xe032('0x2e')],_0x469290[_0xe032('0x30')]);_0x38e7ea['attributes']=_[_0xe032('0x33')](_0x469290['model'],qs[_0xe032('0x34')](_0x5573e4['query'][_0xe032('0x34')]));_0x38e7ea['attributes']=_0x38e7ea[_0xe032('0x35')]['length']?_0x38e7ea[_0xe032('0x35')]:_0x469290[_0xe032('0x2e')];if(!_0x5573e4['query'][_0xe032('0x36')](_0xe032('0x37'))){_0x38e7ea[_0xe032('0x21')]=qs[_0xe032('0x21')](_0x5573e4['query'][_0xe032('0x21')]);_0x38e7ea['offset']=qs[_0xe032('0x1f')](_0x5573e4[_0xe032('0x30')]['offset']);}_0x38e7ea[_0xe032('0x38')]=qs[_0xe032('0x39')](_0x5573e4['query'][_0xe032('0x39')]);_0x38e7ea[_0xe032('0x3a')]=qs[_0xe032('0x32')](_[_0xe032('0x3b')](_0x5573e4[_0xe032('0x30')],_0x469290[_0xe032('0x32')]),_0x4e8b72);if(_0x5573e4[_0xe032('0x30')][_0xe032('0x3c')]){_0x38e7ea[_0xe032('0x3a')]=_[_0xe032('0x3d')](_0x38e7ea[_0xe032('0x3a')],{'$or':_[_0xe032('0x2f')](_0x4e8b72,function(_0x30571c){if(_0x30571c[_0xe032('0x2d')]!==_0xe032('0x3e')){var _0x14ea1a={};_0x14ea1a[_0x30571c[_0xe032('0x29')]]={'$like':'%'+_0x5573e4['query'][_0xe032('0x3c')]+'%'};return _0x14ea1a;}})});}_0x38e7ea=_['merge']({},_0x38e7ea,_0x5573e4[_0xe032('0x3f')]);var _0x2bcfb4={'where':_0x38e7ea[_0xe032('0x3a')]};return db[_0xe032('0x40')][_0xe032('0x22')](_0x2bcfb4)['then'](function(_0x132d25){_0xae116e['count']=_0x132d25;if(_0x5573e4[_0xe032('0x30')]['includeAll']){_0x38e7ea[_0xe032('0x41')]=[{'all':!![]}];}return db[_0xe032('0x40')][_0xe032('0x42')](_0x38e7ea);})[_0xe032('0x27')](function(_0x4dc836){_0xae116e[_0xe032('0x43')]=_0x4dc836;return _0xae116e;})['then'](respondWithFilteredResult(_0x3e2575,_0x38e7ea))[_0xe032('0x44')](handleError(_0x3e2575,null));};exports[_0xe032('0x45')]=function(_0x3c43f1,_0xe572b6){var _0x4b58eb={'raw':!![],'where':{'id':_0x3c43f1[_0xe032('0x46')]['id']}},_0x513b0c={};_0x513b0c[_0xe032('0x2e')]=_['keys'](db[_0xe032('0x40')][_0xe032('0x2b')]);_0x513b0c[_0xe032('0x30')]=_[_0xe032('0x31')](_0x3c43f1[_0xe032('0x30')]);_0x513b0c['filters']=_[_0xe032('0x33')](_0x513b0c[_0xe032('0x2e')],_0x513b0c[_0xe032('0x30')]);_0x4b58eb[_0xe032('0x35')]=_[_0xe032('0x33')](_0x513b0c[_0xe032('0x2e')],qs[_0xe032('0x34')](_0x3c43f1[_0xe032('0x30')]['fields']));_0x4b58eb['attributes']=_0x4b58eb[_0xe032('0x35')]['length']?_0x4b58eb[_0xe032('0x35')]:_0x513b0c[_0xe032('0x2e')];if(_0x3c43f1[_0xe032('0x30')][_0xe032('0x47')]){_0x4b58eb[_0xe032('0x41')]=[{'all':!![]}];}_0x4b58eb=_[_0xe032('0x3d')]({},_0x4b58eb,_0x3c43f1[_0xe032('0x3f')]);return db[_0xe032('0x40')][_0xe032('0x48')](_0x4b58eb)['then'](handleEntityNotFound(_0xe572b6,null))[_0xe032('0x27')](respondWithResult(_0xe572b6,null))['catch'](handleError(_0xe572b6,null));};exports['create']=function(_0x28f973,_0x2583e9){return db[_0xe032('0x40')][_0xe032('0x49')](_0x28f973['body'],{})[_0xe032('0x27')](respondWithResult(_0x2583e9,0xc9))[_0xe032('0x44')](handleError(_0x2583e9,null));};exports[_0xe032('0x26')]=function(_0x39ffb7,_0x1b3172){if(_0x39ffb7[_0xe032('0x4a')]['id']){delete _0x39ffb7[_0xe032('0x4a')]['id'];}return db['Cdr'][_0xe032('0x48')]({'where':{'id':_0x39ffb7[_0xe032('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b3172,null))[_0xe032('0x27')](saveUpdates(_0x39ffb7[_0xe032('0x4a')],null))[_0xe032('0x27')](respondWithResult(_0x1b3172,null))[_0xe032('0x44')](handleError(_0x1b3172,null));};exports[_0xe032('0x4b')]=function(_0x434f1a,_0x24b013){return db[_0xe032('0x40')][_0xe032('0x48')]({'where':{'id':_0x434f1a[_0xe032('0x46')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x24b013,null))[_0xe032('0x27')](removeEntity(_0x24b013,null))[_0xe032('0x44')](handleError(_0x24b013,null));};exports[_0xe032('0x4c')]=function(_0x4eabfc,_0x1c8b32){return db['Cdr'][_0xe032('0x4c')]()[_0xe032('0x27')](respondWithResult(_0x1c8b32,null))[_0xe032('0x44')](handleError(_0x1c8b32,null));}; \ No newline at end of file +var _0x1cb9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr'];(function(_0x1501ef,_0x2c3cd9){var _0x2e18df=function(_0x30664e){while(--_0x30664e){_0x1501ef['push'](_0x1501ef['shift']());}};_0x2e18df(++_0x2c3cd9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x404030,_0x3cdbb2){_0x404030=_0x404030-0x0;var _0x1fcd75=_0x1cb9[_0x404030];return _0x1fcd75;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29'));_0x504275[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x3b3ee6[_0x91cb('0x33')]);_0x504275['filters']=_[_0x91cb('0x35')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x33')]);_0x468908[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x504275['model'],qs[_0x91cb('0x37')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x37')]));_0x468908[_0x91cb('0x36')]=_0x468908[_0x91cb('0x36')]['length']?_0x468908[_0x91cb('0x36')]:_0x504275['model'];if(!_0x3b3ee6['query']['hasOwnProperty'](_0x91cb('0x38'))){_0x468908['limit']=qs[_0x91cb('0x1d')](_0x3b3ee6['query']['limit']);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x1f')]);}_0x468908[_0x91cb('0x39')]=qs['sort'](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3a')]);_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_['pick'](_0x3b3ee6['query'],_0x504275[_0x91cb('0x3c')]),_0x52670a);if(_0x3b3ee6[_0x91cb('0x33')]['filter']){_0x468908[_0x91cb('0x3b')]=_[_0x91cb('0x3d')](_0x468908['where'],{'$or':_[_0x91cb('0x2c')](_0x52670a,function(_0xddc409){if(_0xddc409['type']!==_0x91cb('0x3e')){var _0x545687={};_0x545687[_0xddc409[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3f')]+'%'};return _0x545687;}})});}_0x468908=_[_0x91cb('0x3d')]({},_0x468908,_0x3b3ee6[_0x91cb('0x40')]);var _0x20bf50={'where':_0x468908['where']};return db[_0x91cb('0x2d')][_0x91cb('0x1e')](_0x20bf50)['then'](function(_0x312581){_0x2f04a3['count']=_0x312581;if(_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x41')]){_0x468908[_0x91cb('0x42')]=[{'all':!![]}];}return db[_0x91cb('0x2d')]['findAll'](_0x468908);})[_0x91cb('0x25')](function(_0x5af0e6){_0x2f04a3[_0x91cb('0x43')]=_0x5af0e6;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x44')](handleError(_0x2fb473,null));};exports[_0x91cb('0x45')]=function(_0x451463,_0x111cc0){var _0x325dca={'raw':!![],'where':{'id':_0x451463['params']['id']}},_0x3cc4c1={};_0x3cc4c1[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x3cc4c1[_0x91cb('0x33')]=_['keys'](_0x451463[_0x91cb('0x33')]);_0x3cc4c1[_0x91cb('0x3c')]=_[_0x91cb('0x35')](_0x3cc4c1[_0x91cb('0x32')],_0x3cc4c1['query']);_0x325dca[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x3cc4c1['model'],qs[_0x91cb('0x37')](_0x451463[_0x91cb('0x33')][_0x91cb('0x37')]));_0x325dca[_0x91cb('0x36')]=_0x325dca[_0x91cb('0x36')][_0x91cb('0x46')]?_0x325dca[_0x91cb('0x36')]:_0x3cc4c1[_0x91cb('0x32')];if(_0x451463[_0x91cb('0x33')]['includeAll']){_0x325dca[_0x91cb('0x42')]=[{'all':!![]}];}_0x325dca=_[_0x91cb('0x3d')]({},_0x325dca,_0x451463[_0x91cb('0x40')]);return db[_0x91cb('0x2d')][_0x91cb('0x47')](_0x325dca)[_0x91cb('0x25')](handleEntityNotFound(_0x111cc0,null))[_0x91cb('0x25')](respondWithResult(_0x111cc0,null))[_0x91cb('0x44')](handleError(_0x111cc0,null));};exports['create']=function(_0x348d78,_0x46caf1){return db[_0x91cb('0x2d')][_0x91cb('0x48')](_0x348d78['body'],{})[_0x91cb('0x25')](respondWithResult(_0x46caf1,0xc9))[_0x91cb('0x44')](handleError(_0x46caf1,null));};exports['update']=function(_0x212473,_0x47cdb7){if(_0x212473[_0x91cb('0x49')]['id']){delete _0x212473['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x212473[_0x91cb('0x4a')]['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x47cdb7,null))[_0x91cb('0x25')](saveUpdates(_0x212473[_0x91cb('0x49')],null))[_0x91cb('0x25')](respondWithResult(_0x47cdb7,null))['catch'](handleError(_0x47cdb7,null));};exports['destroy']=function(_0x1d26b8,_0xfe6692){return db[_0x91cb('0x2d')][_0x91cb('0x47')]({'where':{'id':_0x1d26b8['params']['id']}})['then'](handleEntityNotFound(_0xfe6692,null))['then'](removeEntity(_0xfe6692,null))[_0x91cb('0x44')](handleError(_0xfe6692,null));};exports['describe']=function(_0x3f22a1,_0x4aa670){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]()[_0x91cb('0x25')](respondWithResult(_0x4aa670,null))[_0x91cb('0x44')](handleError(_0x4aa670,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8000500..8a4b76b 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3f62d8,_0x4ebd4a){var _0x4a649d=function(_0x2b69dc){while(--_0x2b69dc){_0x3f62d8['push'](_0x3f62d8['shift']());}};_0x4a649d(++_0x4ebd4a);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x20f0dd,_0x52b93f){var _0x575364=function(_0x1b86cf){while(--_0x1b86cf){_0x20f0dd['push'](_0x20f0dd['shift']());}};_0x575364(++_0x52b93f);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6963d7c..ba9faec 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 _0x1131=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4e6e33,_0x507530){var _0x79305a=function(_0x12308b){while(--_0x12308b){_0x4e6e33['push'](_0x4e6e33['shift']());}};_0x79305a(++_0x507530);}(_0x1131,0x8b));var _0x1113=function(_0x229689,_0xa87582){_0x229689=_0x229689-0x0;var _0x3e7163=_0x1131[_0x229689];return _0x3e7163;};'use strict';var _=require('lodash');var util=require(_0x1113('0x0'));var moment=require(_0x1113('0x1'));var BPromise=require(_0x1113('0x2'));var rs=require(_0x1113('0x3'));var fs=require('fs');var Redis=require(_0x1113('0x4'));var db=require(_0x1113('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1113('0x6'))(_0x1113('0x7'));var config=require('../../config/environment');var jayson=require(_0x1113('0x8'));var client=jayson[_0x1113('0x9')][_0x1113('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c8ff1,_0x26bfeb,_0x523a29){return new BPromise(function(_0x268c69,_0x5cae96){return client[_0x1113('0xb')](_0x4c8ff1,_0x523a29)[_0x1113('0xc')](function(_0x2a662a){logger[_0x1113('0xd')](_0x1113('0xe'),_0x26bfeb,_0x1113('0xf'));logger[_0x1113('0x10')](_0x1113('0x11'),_0x26bfeb,_0x1113('0xf'),JSON[_0x1113('0x12')](_0x2a662a));if(_0x2a662a['error']){if(_0x2a662a['error'][_0x1113('0x13')]===0x1f4){logger[_0x1113('0x14')](_0x1113('0xe'),_0x26bfeb,_0x2a662a[_0x1113('0x14')][_0x1113('0x15')]);return _0x5cae96(_0x2a662a[_0x1113('0x14')][_0x1113('0x15')]);}logger['error'](_0x1113('0xe'),_0x26bfeb,_0x2a662a[_0x1113('0x14')][_0x1113('0x15')]);return _0x268c69(_0x2a662a[_0x1113('0x14')]['message']);}else{logger[_0x1113('0xd')](_0x1113('0xe'),_0x26bfeb,_0x1113('0xf'));_0x268c69(_0x2a662a[_0x1113('0x16')]['message']);}})[_0x1113('0x17')](function(_0x482070){logger[_0x1113('0x14')]('Cdr,\x20%s,\x20%s',_0x26bfeb,_0x482070);_0x5cae96(_0x482070);});});} \ No newline at end of file +var _0x7da8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','lodash'];(function(_0x407bd8,_0x277add){var _0x20b6c9=function(_0x215b6c){while(--_0x215b6c){_0x407bd8['push'](_0x407bd8['shift']());}};_0x20b6c9(++_0x277add);}(_0x7da8,0x1a3));var _0x87da=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7da8[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x87da('0x0'));var util=require(_0x87da('0x1'));var moment=require(_0x87da('0x2'));var BPromise=require(_0x87da('0x3'));var rs=require(_0x87da('0x4'));var fs=require('fs');var Redis=require(_0x87da('0x5'));var db=require(_0x87da('0x6'))['db'];var utils=require(_0x87da('0x7'));var logger=require(_0x87da('0x8'))('rpc');var config=require(_0x87da('0x9'));var jayson=require(_0x87da('0xa'));var client=jayson['client'][_0x87da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x407a47,_0x3d0435,_0x2fac84){return new BPromise(function(_0x298d3b,_0x54b7f7){return client['request'](_0x407a47,_0x2fac84)['then'](function(_0x38b983){logger[_0x87da('0xc')]('Cdr,\x20%s,\x20%s',_0x3d0435,_0x87da('0xd'));logger[_0x87da('0xe')](_0x87da('0xf'),_0x3d0435,_0x87da('0xd'),JSON['stringify'](_0x38b983));if(_0x38b983[_0x87da('0x10')]){if(_0x38b983['error'][_0x87da('0x11')]===0x1f4){logger['error'](_0x87da('0x12'),_0x3d0435,_0x38b983[_0x87da('0x10')][_0x87da('0x13')]);return _0x54b7f7(_0x38b983[_0x87da('0x10')][_0x87da('0x13')]);}logger[_0x87da('0x10')]('Cdr,\x20%s,\x20%s',_0x3d0435,_0x38b983['error'][_0x87da('0x13')]);return _0x298d3b(_0x38b983['error']['message']);}else{logger[_0x87da('0xc')](_0x87da('0x12'),_0x3d0435,_0x87da('0xd'));_0x298d3b(_0x38b983['result'][_0x87da('0x13')]);}})['catch'](function(_0x1fd398){logger['error'](_0x87da('0x12'),_0x3d0435,_0x1fd398);_0x54b7f7(_0x1fd398);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 749b741..680e3d8 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x45e647,_0x2c482c){var _0x2deace=function(_0x12e383){while(--_0x12e383){_0x45e647['push'](_0x45e647['shift']());}};_0x2deace(++_0x2c482c);}(_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 +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x22ebd5,_0x30bb61){var _0x23da9a=function(_0x38fd97){while(--_0x38fd97){_0x22ebd5['push'](_0x22ebd5['shift']());}};_0x23da9a(++_0x30bb61);}(_0xb10b,0x12a));var _0xbb10=function(_0x9b14ee,_0x574340){_0x9b14ee=_0x9b14ee-0x0;var _0xc3fa3c=_0xb10b[_0x9b14ee];return _0xc3fa3c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index ea1f84c..4db0c16 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 _0xdf0e=['exports','STRING','TEXT','sequelize'];(function(_0x3aa341,_0xf2becc){var _0x4bd698=function(_0x5b7c81){while(--_0x5b7c81){_0x3aa341['push'](_0x3aa341['shift']());}};_0x4bd698(++_0xf2becc);}(_0xdf0e,0xa7));var _0xedf0=function(_0x5ea326,_0x3d52fa){_0x5ea326=_0x5ea326-0x0;var _0x48cf87=_0xdf0e[_0x5ea326];return _0x48cf87;};'use strict';var Sequelize=require(_0xedf0('0x0'));module[_0xedf0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xedf0('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xedf0('0x3')]()},'description':{'type':Sequelize[_0xedf0('0x2')]},'interval':{'type':Sequelize[_0xedf0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4996=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1c1ae5,_0x2eaccf){var _0x15bf42=function(_0x122796){while(--_0x122796){_0x1c1ae5['push'](_0x1c1ae5['shift']());}};_0x15bf42(++_0x2eaccf);}(_0x4996,0x74));var _0x6499=function(_0x4f680c,_0x292aba){_0x4f680c=_0x4f680c-0x0;var _0x5326b2=_0x4996[_0x4f680c];return _0x5326b2;};'use strict';var Sequelize=require(_0x6499('0x0'));module[_0x6499('0x1')]={'priority':{'type':Sequelize[_0x6499('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6499('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6499('0x4')]()},'description':{'type':Sequelize[_0x6499('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6499('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fb302fa..db3f177 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 _0x1ddc=['ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','options','find','update','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x2e7054,_0x3e955e){_0x2e7054=_0x2e7054-0x0;var _0x5b08a0=_0x1ddc[_0x2e7054];return _0x5b08a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1dd('0x0'));var zipdir=require(_0xc1dd('0x1'));var jsonpatch=require(_0xc1dd('0x2'));var rp=require('request-promise');var moment=require(_0xc1dd('0x3'));var BPromise=require(_0xc1dd('0x4'));var Mustache=require('mustache');var util=require(_0xc1dd('0x5'));var path=require(_0xc1dd('0x6'));var sox=require('sox');var csv=require(_0xc1dd('0x7'));var ejs=require(_0xc1dd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1dd('0x9'));var squel=require(_0xc1dd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc1dd('0xb'));var toCsv=require(_0xc1dd('0x7'));var querystring=require(_0xc1dd('0xc'));var Papa=require(_0xc1dd('0xd'));var Redis=require('ioredis');var authService=require(_0xc1dd('0xe'));var qs=require(_0xc1dd('0xf'));var as=require(_0xc1dd('0x10'));var hardwareService=require(_0xc1dd('0x11'));var logger=require('../../config/logger')(_0xc1dd('0x12'));var utils=require(_0xc1dd('0x13'));var config=require(_0xc1dd('0x14'));var licenseUtil=require(_0xc1dd('0x15'));var db=require(_0xc1dd('0x16'))['db'];function respondWithStatusCode(_0x2613c9,_0x1d9815){_0x1d9815=_0x1d9815||0xcc;return function(_0x83a291){if(_0x83a291){return _0x2613c9[_0xc1dd('0x17')](_0x1d9815);}return _0x2613c9[_0xc1dd('0x18')](_0x1d9815)[_0xc1dd('0x19')]();};}function respondWithResult(_0x576fc1,_0x3d4c7f){_0x3d4c7f=_0x3d4c7f||0xc8;return function(_0x30f49a){if(_0x30f49a){return _0x576fc1[_0xc1dd('0x18')](_0x3d4c7f)[_0xc1dd('0x1a')](_0x30f49a);}};}function respondWithFilteredResult(_0x104177,_0x52a9b8){return function(_0xe5a17a){if(_0xe5a17a){var _0x76994c=typeof _0x52a9b8[_0xc1dd('0x1b')]===_0xc1dd('0x1c')&&typeof _0x52a9b8['limit']==='undefined';var _0x3e7e6f=_0xe5a17a['count'];var _0x35139a=_0x76994c?0x0:_0x52a9b8['offset'];var _0x6198a7=_0x76994c?_0xe5a17a[_0xc1dd('0x1d')]:_0x52a9b8[_0xc1dd('0x1b')]+_0x52a9b8[_0xc1dd('0x1e')];var _0x312054;if(_0x6198a7>=_0x3e7e6f){_0x6198a7=_0x3e7e6f;_0x312054=0xc8;}else{_0x312054=0xce;}_0x104177[_0xc1dd('0x18')](_0x312054);return _0x104177['set'](_0xc1dd('0x1f'),_0x35139a+'-'+_0x6198a7+'/'+_0x3e7e6f)[_0xc1dd('0x1a')](_0xe5a17a);}return null;};}function patchUpdates(_0x5e99a6){return function(_0x3d22bb){try{jsonpatch[_0xc1dd('0x20')](_0x3d22bb,_0x5e99a6,!![]);}catch(_0x3650fd){return BPromise[_0xc1dd('0x21')](_0x3650fd);}return _0x3d22bb[_0xc1dd('0x22')]();};}function saveUpdates(_0x266147,_0x228626){return function(_0x60ef4a){if(_0x60ef4a){return _0x60ef4a['update'](_0x266147)[_0xc1dd('0x23')](function(_0x16a2b0){return _0x16a2b0;});}return null;};}function removeEntity(_0x22f9be,_0x3363ff){return function(_0x5f4c9e){if(_0x5f4c9e){return _0x5f4c9e[_0xc1dd('0x24')]()[_0xc1dd('0x23')](function(){_0x22f9be[_0xc1dd('0x18')](0xcc)[_0xc1dd('0x19')]();});}};}function handleEntityNotFound(_0x16fb8b,_0x1aea60){return function(_0x3c3a32){if(!_0x3c3a32){_0x16fb8b[_0xc1dd('0x17')](0x194);}return _0x3c3a32;};}function handleError(_0x29dc08,_0x41d319){_0x41d319=_0x41d319||0x1f4;return function(_0x1212c3){logger[_0xc1dd('0x25')](_0x1212c3[_0xc1dd('0x26')]);if(_0x1212c3[_0xc1dd('0x27')]){delete _0x1212c3['name'];}_0x29dc08['status'](_0x41d319)[_0xc1dd('0x28')](_0x1212c3);};}exports[_0xc1dd('0x29')]=function(_0x25a651,_0x1e112){var _0x2b5dbe={'raw':!![],'where':{'id':_0x25a651[_0xc1dd('0x2a')]['id']}},_0x39b8ac={};_0x39b8ac['model']=_[_0xc1dd('0x2b')](db[_0xc1dd('0x2c')][_0xc1dd('0x2d')]);_0x39b8ac[_0xc1dd('0x2e')]=_['keys'](_0x25a651[_0xc1dd('0x2e')]);_0x39b8ac[_0xc1dd('0x2f')]=_[_0xc1dd('0x30')](_0x39b8ac['model'],_0x39b8ac[_0xc1dd('0x2e')]);_0x2b5dbe['attributes']=_[_0xc1dd('0x30')](_0x39b8ac[_0xc1dd('0x31')],qs[_0xc1dd('0x32')](_0x25a651['query'][_0xc1dd('0x32')]));_0x2b5dbe[_0xc1dd('0x33')]=_0x2b5dbe[_0xc1dd('0x33')][_0xc1dd('0x34')]?_0x2b5dbe['attributes']:_0x39b8ac[_0xc1dd('0x31')];if(_0x25a651[_0xc1dd('0x2e')][_0xc1dd('0x35')]){_0x2b5dbe['include']=[{'all':!![]}];}_0x2b5dbe=_['merge']({},_0x2b5dbe,_0x25a651[_0xc1dd('0x36')]);return db[_0xc1dd('0x2c')][_0xc1dd('0x37')](_0x2b5dbe)[_0xc1dd('0x23')](handleEntityNotFound(_0x1e112,null))[_0xc1dd('0x23')](respondWithResult(_0x1e112,null))['catch'](handleError(_0x1e112,null));};exports[_0xc1dd('0x38')]=function(_0xe09168,_0x544b71){if(_0xe09168[_0xc1dd('0x39')]['id']){delete _0xe09168[_0xc1dd('0x39')]['id'];}return db[_0xc1dd('0x2c')]['find']({'where':{'id':_0xe09168[_0xc1dd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x544b71,null))[_0xc1dd('0x23')](saveUpdates(_0xe09168[_0xc1dd('0x39')],null))['then'](respondWithResult(_0x544b71,null))[_0xc1dd('0x3a')](handleError(_0x544b71,null));};exports[_0xc1dd('0x24')]=function(_0x28723c,_0x299842){return db[_0xc1dd('0x2c')][_0xc1dd('0x37')]({'where':{'id':_0x28723c[_0xc1dd('0x2a')]['id']}})[_0xc1dd('0x23')](handleEntityNotFound(_0x299842,null))[_0xc1dd('0x23')](removeEntity(_0x299842,null))[_0xc1dd('0x3a')](handleError(_0x299842,null));}; \ No newline at end of file +var _0xfdb5=['sendStatus','stack','name','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','update','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xfdb5[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0x5fdb('0x0'));var rimraf=require(_0x5fdb('0x1'));var zipdir=require(_0x5fdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fdb('0x3'));var moment=require(_0x5fdb('0x4'));var BPromise=require(_0x5fdb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fdb('0x6'));var sox=require('sox');var csv=require(_0x5fdb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5fdb('0x8'));var _=require(_0x5fdb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5fdb('0xa'));var toCsv=require(_0x5fdb('0x7'));var querystring=require(_0x5fdb('0xb'));var Papa=require(_0x5fdb('0xc'));var Redis=require(_0x5fdb('0xd'));var authService=require(_0x5fdb('0xe'));var qs=require(_0x5fdb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fdb('0x10'));var logger=require('../../config/logger')(_0x5fdb('0x11'));var utils=require(_0x5fdb('0x12'));var config=require(_0x5fdb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fdb('0x14'))['db'];function respondWithStatusCode(_0x573f40,_0x27433e){_0x27433e=_0x27433e||0xcc;return function(_0x368750){if(_0x368750){return _0x573f40['sendStatus'](_0x27433e);}return _0x573f40[_0x5fdb('0x15')](_0x27433e)[_0x5fdb('0x16')]();};}function respondWithResult(_0x3a2e29,_0x59f815){_0x59f815=_0x59f815||0xc8;return function(_0x3d15a2){if(_0x3d15a2){return _0x3a2e29[_0x5fdb('0x15')](_0x59f815)[_0x5fdb('0x17')](_0x3d15a2);}};}function respondWithFilteredResult(_0xaf6b0e,_0x40c32d){return function(_0x2d620c){if(_0x2d620c){var _0x58ae27=typeof _0x40c32d['offset']===_0x5fdb('0x18')&&typeof _0x40c32d['limit']===_0x5fdb('0x18');var _0x148223=_0x2d620c[_0x5fdb('0x19')];var _0x47a10f=_0x58ae27?0x0:_0x40c32d[_0x5fdb('0x1a')];var _0xb8c99f=_0x58ae27?_0x2d620c[_0x5fdb('0x19')]:_0x40c32d[_0x5fdb('0x1a')]+_0x40c32d[_0x5fdb('0x1b')];var _0x30d7d1;if(_0xb8c99f>=_0x148223){_0xb8c99f=_0x148223;_0x30d7d1=0xc8;}else{_0x30d7d1=0xce;}_0xaf6b0e['status'](_0x30d7d1);return _0xaf6b0e[_0x5fdb('0x1c')]('Content-Range',_0x47a10f+'-'+_0xb8c99f+'/'+_0x148223)['json'](_0x2d620c);}return null;};}function patchUpdates(_0x8937c){return function(_0x2ab3a4){try{jsonpatch[_0x5fdb('0x1d')](_0x2ab3a4,_0x8937c,!![]);}catch(_0x571802){return BPromise[_0x5fdb('0x1e')](_0x571802);}return _0x2ab3a4[_0x5fdb('0x1f')]();};}function saveUpdates(_0x47e13a,_0x3e755a){return function(_0x170ad5){if(_0x170ad5){return _0x170ad5['update'](_0x47e13a)['then'](function(_0x4dc591){return _0x4dc591;});}return null;};}function removeEntity(_0x56997a,_0x15d2ec){return function(_0x573132){if(_0x573132){return _0x573132['destroy']()[_0x5fdb('0x20')](function(){_0x56997a[_0x5fdb('0x15')](0xcc)[_0x5fdb('0x16')]();});}};}function handleEntityNotFound(_0x49e795,_0x3b47f5){return function(_0x848e51){if(!_0x848e51){_0x49e795[_0x5fdb('0x21')](0x194);}return _0x848e51;};}function handleError(_0x2b043b,_0x5893a9){_0x5893a9=_0x5893a9||0x1f4;return function(_0x200eaf){logger['error'](_0x200eaf[_0x5fdb('0x22')]);if(_0x200eaf[_0x5fdb('0x23')]){delete _0x200eaf['name'];}_0x2b043b[_0x5fdb('0x15')](_0x5893a9)['send'](_0x200eaf);};}exports[_0x5fdb('0x24')]=function(_0x474217,_0x5bd442){var _0x57e93a={'raw':!![],'where':{'id':_0x474217[_0x5fdb('0x25')]['id']}},_0xa5c0e2={};_0xa5c0e2[_0x5fdb('0x26')]=_[_0x5fdb('0x27')](db[_0x5fdb('0x28')]['rawAttributes']);_0xa5c0e2['query']=_[_0x5fdb('0x27')](_0x474217[_0x5fdb('0x29')]);_0xa5c0e2[_0x5fdb('0x2a')]=_[_0x5fdb('0x2b')](_0xa5c0e2[_0x5fdb('0x26')],_0xa5c0e2[_0x5fdb('0x29')]);_0x57e93a[_0x5fdb('0x2c')]=_[_0x5fdb('0x2b')](_0xa5c0e2[_0x5fdb('0x26')],qs[_0x5fdb('0x2d')](_0x474217[_0x5fdb('0x29')][_0x5fdb('0x2d')]));_0x57e93a[_0x5fdb('0x2c')]=_0x57e93a[_0x5fdb('0x2c')][_0x5fdb('0x2e')]?_0x57e93a['attributes']:_0xa5c0e2[_0x5fdb('0x26')];if(_0x474217[_0x5fdb('0x29')][_0x5fdb('0x2f')]){_0x57e93a[_0x5fdb('0x30')]=[{'all':!![]}];}_0x57e93a=_[_0x5fdb('0x31')]({},_0x57e93a,_0x474217[_0x5fdb('0x32')]);return db[_0x5fdb('0x28')][_0x5fdb('0x33')](_0x57e93a)[_0x5fdb('0x20')](handleEntityNotFound(_0x5bd442,null))[_0x5fdb('0x20')](respondWithResult(_0x5bd442,null))['catch'](handleError(_0x5bd442,null));};exports[_0x5fdb('0x34')]=function(_0x12ce07,_0x217641){if(_0x12ce07[_0x5fdb('0x35')]['id']){delete _0x12ce07[_0x5fdb('0x35')]['id'];}return db[_0x5fdb('0x28')]['find']({'where':{'id':_0x12ce07['params']['id']}})[_0x5fdb('0x20')](handleEntityNotFound(_0x217641,null))[_0x5fdb('0x20')](saveUpdates(_0x12ce07[_0x5fdb('0x35')],null))[_0x5fdb('0x20')](respondWithResult(_0x217641,null))[_0x5fdb('0x36')](handleError(_0x217641,null));};exports[_0x5fdb('0x37')]=function(_0xbbd7f2,_0x58ed74){return db[_0x5fdb('0x28')][_0x5fdb('0x33')]({'where':{'id':_0xbbd7f2[_0x5fdb('0x25')]['id']}})[_0x5fdb('0x20')](handleEntityNotFound(_0x58ed74,null))[_0x5fdb('0x20')](removeEntity(_0x58ed74,null))[_0x5fdb('0x36')](handleError(_0x58ed74,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 6a625d6..665188a 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 _0x6953=['chat_applications','utf8mb4','lodash','util','bluebird','path','rimraf','../../config/environment','exports','define','ChatApplication'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x6953,0x91));var _0x3695=function(_0x1ba4c1,_0x3f409f){_0x1ba4c1=_0x1ba4c1-0x0;var _0x42304c=_0x6953[_0x1ba4c1];return _0x42304c;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./chatApplication.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3695('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2d6e=['ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports'];(function(_0x435254,_0x167b7a){var _0x4964fb=function(_0x477265){while(--_0x477265){_0x435254['push'](_0x435254['shift']());}};_0x4964fb(++_0x167b7a);}(_0x2d6e,0x107));var _0xe2d6=function(_0x18a032,_0x347bc1){_0x18a032=_0x18a032-0x0;var _0x1337f7=_0x2d6e[_0x18a032];return _0x1337f7;};'use strict';var _=require(_0xe2d6('0x0'));var util=require(_0xe2d6('0x1'));var logger=require(_0xe2d6('0x2'))('api');var moment=require(_0xe2d6('0x3'));var BPromise=require(_0xe2d6('0x4'));var rp=require(_0xe2d6('0x5'));var fs=require('fs');var path=require(_0xe2d6('0x6'));var rimraf=require(_0xe2d6('0x7'));var config=require('../../config/environment');var attributes=require(_0xe2d6('0x8'));module[_0xe2d6('0x9')]=function(_0x4ef03e,_0x3a9764){return _0x4ef03e['define'](_0xe2d6('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2d6('0xb'),'collate':_0xe2d6('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index da1d9a9..50d8970 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 _0x1838=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash'];(function(_0x59347e,_0x5a45aa){var _0x56cadd=function(_0x34ae1b){while(--_0x34ae1b){_0x59347e['push'](_0x59347e['shift']());}};_0x56cadd(++_0x5a45aa);}(_0x1838,0x1a3));var _0x8183=function(_0x203374,_0x314eb7){_0x203374=_0x203374-0x0;var _0x469bf3=_0x1838[_0x203374];return _0x469bf3;};'use strict';var _=require(_0x8183('0x0'));var util=require('util');var moment=require(_0x8183('0x1'));var BPromise=require('bluebird');var rs=require(_0x8183('0x2'));var fs=require('fs');var Redis=require(_0x8183('0x3'));var db=require(_0x8183('0x4'))['db'];var utils=require(_0x8183('0x5'));var logger=require(_0x8183('0x6'))(_0x8183('0x7'));var config=require(_0x8183('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8183('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcd26c8,_0x394359,_0x362c94){return new BPromise(function(_0x15e265,_0x480f6b){return client[_0x8183('0xa')](_0xcd26c8,_0x362c94)['then'](function(_0x42fe35){logger[_0x8183('0xb')]('ChatApplication,\x20%s,\x20%s',_0x394359,_0x8183('0xc'));logger[_0x8183('0xd')](_0x8183('0xe'),_0x394359,_0x8183('0xc'),JSON[_0x8183('0xf')](_0x42fe35));if(_0x42fe35[_0x8183('0x10')]){if(_0x42fe35[_0x8183('0x10')][_0x8183('0x11')]===0x1f4){logger['error'](_0x8183('0x12'),_0x394359,_0x42fe35['error'][_0x8183('0x13')]);return _0x480f6b(_0x42fe35[_0x8183('0x10')][_0x8183('0x13')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x394359,_0x42fe35[_0x8183('0x10')][_0x8183('0x13')]);return _0x15e265(_0x42fe35['error'][_0x8183('0x13')]);}else{logger[_0x8183('0xb')]('ChatApplication,\x20%s,\x20%s',_0x394359,_0x8183('0xc'));_0x15e265(_0x42fe35['result'][_0x8183('0x13')]);}})[_0x8183('0x14')](function(_0x1f3722){logger[_0x8183('0x10')](_0x8183('0x12'),_0x394359,_0x1f3722);_0x480f6b(_0x1f3722);});});} \ No newline at end of file +var _0xa657=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xa657,0x1de));var _0x7a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa657[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a65('0x0'));var util=require(_0x7a65('0x1'));var moment=require(_0x7a65('0x2'));var BPromise=require(_0x7a65('0x3'));var rs=require(_0x7a65('0x4'));var fs=require('fs');var Redis=require(_0x7a65('0x5'));var db=require(_0x7a65('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a65('0x7'))(_0x7a65('0x8'));var config=require(_0x7a65('0x9'));var jayson=require(_0x7a65('0xa'));var client=jayson[_0x7a65('0xb')][_0x7a65('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cc1f2,_0x426856,_0x5a963d){return new BPromise(function(_0x421dc4,_0x38ca16){return client['request'](_0x3cc1f2,_0x5a963d)['then'](function(_0x29b811){logger[_0x7a65('0xd')](_0x7a65('0xe'),_0x426856,_0x7a65('0xf'));logger['debug'](_0x7a65('0x10'),_0x426856,'request\x20sent',JSON[_0x7a65('0x11')](_0x29b811));if(_0x29b811[_0x7a65('0x12')]){if(_0x29b811['error'][_0x7a65('0x13')]===0x1f4){logger[_0x7a65('0x12')](_0x7a65('0xe'),_0x426856,_0x29b811[_0x7a65('0x12')][_0x7a65('0x14')]);return _0x38ca16(_0x29b811[_0x7a65('0x12')]['message']);}logger[_0x7a65('0x12')](_0x7a65('0xe'),_0x426856,_0x29b811[_0x7a65('0x12')][_0x7a65('0x14')]);return _0x421dc4(_0x29b811[_0x7a65('0x12')][_0x7a65('0x14')]);}else{logger[_0x7a65('0xd')](_0x7a65('0xe'),_0x426856,_0x7a65('0xf'));_0x421dc4(_0x29b811[_0x7a65('0x15')][_0x7a65('0x14')]);}})[_0x7a65('0x16')](function(_0x7a338f){logger[_0x7a65('0x12')](_0x7a65('0xe'),_0x426856,_0x7a338f);_0x38ca16(_0x7a338f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2756adc..98ca7da 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 _0x17b7=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','show','put','/:id'];(function(_0x464582,_0x3cf4c6){var _0x1e161c=function(_0x236733){while(--_0x236733){_0x464582['push'](_0x464582['shift']());}};_0x1e161c(++_0x3cf4c6);}(_0x17b7,0xc3));var _0x717b=function(_0x1a19f2,_0x44c1eb){_0x1a19f2=_0x1a19f2-0x0;var _0xeb7e0=_0x17b7[_0x1a19f2];return _0xeb7e0;};'use strict';var multer=require(_0x717b('0x0'));var util=require(_0x717b('0x1'));var path=require(_0x717b('0x2'));var timeout=require(_0x717b('0x3'));var express=require(_0x717b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x717b('0x5'));var interaction=require(_0x717b('0x6'));var config=require('../../config/environment');var controller=require(_0x717b('0x7'));router[_0x717b('0x8')]('/:id',auth[_0x717b('0x9')](),controller[_0x717b('0xa')]);router[_0x717b('0xb')](_0x717b('0xc'),auth[_0x717b('0x9')](),controller[_0x717b('0xd')]);router[_0x717b('0xe')](_0x717b('0xc'),auth['isAuthenticated'](),controller[_0x717b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7541=['show','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0xc47c11,_0x943516){var _0x3bcd85=function(_0x134a47){while(--_0x134a47){_0xc47c11['push'](_0xc47c11['shift']());}};_0x3bcd85(++_0x943516);}(_0x7541,0x83));var _0x1754=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x7541[_0x2652ef];return _0x2db578;};'use strict';var multer=require(_0x1754('0x0'));var util=require(_0x1754('0x1'));var path=require('path');var timeout=require(_0x1754('0x2'));var express=require(_0x1754('0x3'));var router=express[_0x1754('0x4')]();var fs_extra=require(_0x1754('0x5'));var auth=require(_0x1754('0x6'));var interaction=require(_0x1754('0x7'));var config=require(_0x1754('0x8'));var controller=require(_0x1754('0x9'));router[_0x1754('0xa')](_0x1754('0xb'),auth[_0x1754('0xc')](),controller[_0x1754('0xd')]);router[_0x1754('0xe')](_0x1754('0xb'),auth[_0x1754('0xc')](),controller[_0x1754('0xf')]);router['delete'](_0x1754('0xb'),auth[_0x1754('0xc')](),controller[_0x1754('0x10')]);module[_0x1754('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e5e86b8..6130d98 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 _0x961e=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1b40cf,_0x341a7a){var _0x16f16b=function(_0x12f14e){while(--_0x12f14e){_0x1b40cf['push'](_0x1b40cf['shift']());}};_0x16f16b(++_0x341a7a);}(_0x961e,0xd2));var _0xe961=function(_0x25ddeb,_0x167818){_0x25ddeb=_0x25ddeb-0x0;var _0x3d5ed5=_0x961e[_0x25ddeb];return _0x3d5ed5;};'use strict';var Sequelize=require(_0xe961('0x0'));module[_0xe961('0x1')]={'name':{'type':Sequelize[_0xe961('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe961('0x2')]},'write':{'type':Sequelize[_0xe961('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb209=['STRING','sequelize','exports'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0xb209,0x6d));var _0x9b20=function(_0x2fce1b,_0x18bfe9){_0x2fce1b=_0x2fce1b-0x0;var _0x5d2b69=_0xb209[_0x2fce1b];return _0x5d2b69;};'use strict';var Sequelize=require(_0x9b20('0x0'));module[_0x9b20('0x1')]={'name':{'type':Sequelize[_0x9b20('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9b20('0x2')]},'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 d9ff2c5..e22ee29 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 _0x14d4=['catch','create','body','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','options','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','stack','name','send','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','rows','show','params','rawAttributes'];(function(_0x21b916,_0x2f1c29){var _0x4df8bc=function(_0x33de8c){while(--_0x33de8c){_0x21b916['push'](_0x21b916['shift']());}};_0x4df8bc(++_0x2f1c29);}(_0x14d4,0x78));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x414d('0x0'));var rimraf=require(_0x414d('0x1'));var zipdir=require(_0x414d('0x2'));var jsonpatch=require(_0x414d('0x3'));var rp=require(_0x414d('0x4'));var moment=require(_0x414d('0x5'));var BPromise=require(_0x414d('0x6'));var Mustache=require(_0x414d('0x7'));var util=require(_0x414d('0x8'));var path=require(_0x414d('0x9'));var sox=require(_0x414d('0xa'));var csv=require(_0x414d('0xb'));var ejs=require(_0x414d('0xc'));var fs=require('fs');var fs_extra=require(_0x414d('0xd'));var _=require(_0x414d('0xe'));var squel=require(_0x414d('0xf'));var crypto=require('crypto');var jsforce=require(_0x414d('0x10'));var deskjs=require(_0x414d('0x11'));var toCsv=require(_0x414d('0xb'));var querystring=require('querystring');var Papa=require(_0x414d('0x12'));var Redis=require(_0x414d('0x13'));var authService=require(_0x414d('0x14'));var qs=require(_0x414d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x414d('0x16'))('api');var utils=require(_0x414d('0x17'));var config=require(_0x414d('0x18'));var licenseUtil=require(_0x414d('0x19'));var db=require('../../mysqldb')['db'];config[_0x414d('0x1a')]=_[_0x414d('0x1b')](config[_0x414d('0x1a')],{'host':_0x414d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x414d('0x1a')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0xf93be2,_0x565dcc){_0x565dcc=_0x565dcc||0xcc;return function(_0x2ba939){if(_0x2ba939){return _0xf93be2[_0x414d('0x1d')](_0x565dcc);}return _0xf93be2[_0x414d('0x1e')](_0x565dcc)['end']();};}function respondWithResult(_0x33f141,_0x576fe1){_0x576fe1=_0x576fe1||0xc8;return function(_0x520e05){if(_0x520e05){return _0x33f141[_0x414d('0x1e')](_0x576fe1)[_0x414d('0x1f')](_0x520e05);}};}function respondWithFilteredResult(_0x485858,_0x32b806){return function(_0x20e8de){if(_0x20e8de){var _0x44e5ef=typeof _0x32b806[_0x414d('0x20')]===_0x414d('0x21')&&typeof _0x32b806[_0x414d('0x22')]===_0x414d('0x21');var _0x3270a4=_0x20e8de[_0x414d('0x23')];var _0x5bc72b=_0x44e5ef?0x0:_0x32b806[_0x414d('0x20')];var _0x51bc87=_0x44e5ef?_0x20e8de['count']:_0x32b806[_0x414d('0x20')]+_0x32b806[_0x414d('0x22')];var _0x9a2c3b;if(_0x51bc87>=_0x3270a4){_0x51bc87=_0x3270a4;_0x9a2c3b=0xc8;}else{_0x9a2c3b=0xce;}_0x485858[_0x414d('0x1e')](_0x9a2c3b);return _0x485858[_0x414d('0x24')](_0x414d('0x25'),_0x5bc72b+'-'+_0x51bc87+'/'+_0x3270a4)[_0x414d('0x1f')](_0x20e8de);}return null;};}function patchUpdates(_0x170882){return function(_0x43da98){try{jsonpatch['apply'](_0x43da98,_0x170882,!![]);}catch(_0x494875){return BPromise[_0x414d('0x26')](_0x494875);}return _0x43da98[_0x414d('0x27')]();};}function saveUpdates(_0x26406a,_0x510d03){return function(_0x4a5481){if(_0x4a5481){return _0x4a5481[_0x414d('0x28')](_0x26406a)['then'](function(_0x516bbd){return _0x516bbd;});}return null;};}function removeEntity(_0x511018,_0x4ec885){return function(_0x5b554d){if(_0x5b554d){return _0x5b554d['destroy']()[_0x414d('0x29')](function(){_0x511018[_0x414d('0x1e')](0xcc)[_0x414d('0x2a')]();});}};}function handleEntityNotFound(_0x4200b7,_0x51205f){return function(_0x3f60e0){if(!_0x3f60e0){_0x4200b7[_0x414d('0x1d')](0x194);}return _0x3f60e0;};}function handleError(_0xad511f,_0x20d904){_0x20d904=_0x20d904||0x1f4;return function(_0x2912f1){logger['error'](_0x2912f1[_0x414d('0x2b')]);if(_0x2912f1[_0x414d('0x2c')]){delete _0x2912f1['name'];}_0xad511f[_0x414d('0x1e')](_0x20d904)[_0x414d('0x2d')](_0x2912f1);};}exports['index']=function(_0x4ed3fa,_0x3ae9a0){var _0xb245d5={},_0x49ce83={},_0x1d87ef={'count':0x0,'rows':[]};var _0x16149c=_['map'](db['ChatGroup']['rawAttributes'],function(_0x297354){return{'name':_0x297354[_0x414d('0x2e')],'type':_0x297354[_0x414d('0x2f')][_0x414d('0x30')]};});_0x49ce83['model']=_[_0x414d('0x31')](_0x16149c,_0x414d('0x2c'));_0x49ce83[_0x414d('0x32')]=_[_0x414d('0x33')](_0x4ed3fa[_0x414d('0x32')]);_0x49ce83[_0x414d('0x34')]=_[_0x414d('0x35')](_0x49ce83[_0x414d('0x36')],_0x49ce83[_0x414d('0x32')]);_0xb245d5[_0x414d('0x37')]=_[_0x414d('0x35')](_0x49ce83[_0x414d('0x36')],qs[_0x414d('0x38')](_0x4ed3fa['query'][_0x414d('0x38')]));_0xb245d5['attributes']=_0xb245d5['attributes'][_0x414d('0x39')]?_0xb245d5[_0x414d('0x37')]:_0x49ce83[_0x414d('0x36')];if(!_0x4ed3fa[_0x414d('0x32')][_0x414d('0x3a')]('nolimit')){_0xb245d5['limit']=qs[_0x414d('0x22')](_0x4ed3fa['query'][_0x414d('0x22')]);_0xb245d5[_0x414d('0x20')]=qs['offset'](_0x4ed3fa[_0x414d('0x32')][_0x414d('0x20')]);}_0xb245d5[_0x414d('0x3b')]=qs[_0x414d('0x3c')](_0x4ed3fa['query'][_0x414d('0x3c')]);_0xb245d5[_0x414d('0x3d')]=qs[_0x414d('0x34')](_[_0x414d('0x3e')](_0x4ed3fa[_0x414d('0x32')],_0x49ce83[_0x414d('0x34')]),_0x16149c);if(_0x4ed3fa[_0x414d('0x32')][_0x414d('0x3f')]){_0xb245d5[_0x414d('0x3d')]=_[_0x414d('0x40')](_0xb245d5[_0x414d('0x3d')],{'$or':_[_0x414d('0x31')](_0x16149c,function(_0x3d744c){if(_0x3d744c[_0x414d('0x2f')]!==_0x414d('0x41')){var _0x36fb91={};_0x36fb91[_0x3d744c[_0x414d('0x2c')]]={'$like':'%'+_0x4ed3fa[_0x414d('0x32')][_0x414d('0x3f')]+'%'};return _0x36fb91;}})});}_0xb245d5=_[_0x414d('0x40')]({},_0xb245d5,_0x4ed3fa['options']);var _0x5e1fa2={'where':_0xb245d5[_0x414d('0x3d')]};return db[_0x414d('0x42')][_0x414d('0x23')](_0x5e1fa2)['then'](function(_0x3b96a8){_0x1d87ef[_0x414d('0x23')]=_0x3b96a8;if(_0x4ed3fa[_0x414d('0x32')][_0x414d('0x43')]){_0xb245d5[_0x414d('0x44')]=[{'all':!![]}];}return db[_0x414d('0x42')][_0x414d('0x45')](_0xb245d5);})[_0x414d('0x29')](function(_0x2e5122){_0x1d87ef[_0x414d('0x46')]=_0x2e5122;return _0x1d87ef;})[_0x414d('0x29')](respondWithFilteredResult(_0x3ae9a0,_0xb245d5))['catch'](handleError(_0x3ae9a0,null));};exports[_0x414d('0x47')]=function(_0xb51350,_0x40a092){var _0x21cf34={'raw':!![],'where':{'id':_0xb51350[_0x414d('0x48')]['id']}},_0x2c2c8d={};_0x2c2c8d['model']=_[_0x414d('0x33')](db[_0x414d('0x42')][_0x414d('0x49')]);_0x2c2c8d[_0x414d('0x32')]=_['keys'](_0xb51350[_0x414d('0x32')]);_0x2c2c8d[_0x414d('0x34')]=_[_0x414d('0x35')](_0x2c2c8d[_0x414d('0x36')],_0x2c2c8d[_0x414d('0x32')]);_0x21cf34[_0x414d('0x37')]=_[_0x414d('0x35')](_0x2c2c8d['model'],qs[_0x414d('0x38')](_0xb51350[_0x414d('0x32')][_0x414d('0x38')]));_0x21cf34['attributes']=_0x21cf34[_0x414d('0x37')]['length']?_0x21cf34[_0x414d('0x37')]:_0x2c2c8d[_0x414d('0x36')];if(_0xb51350[_0x414d('0x32')][_0x414d('0x43')]){_0x21cf34[_0x414d('0x44')]=[{'all':!![]}];}_0x21cf34=_[_0x414d('0x40')]({},_0x21cf34,_0xb51350['options']);return db[_0x414d('0x42')]['find'](_0x21cf34)[_0x414d('0x29')](handleEntityNotFound(_0x40a092,null))[_0x414d('0x29')](respondWithResult(_0x40a092,null))[_0x414d('0x4a')](handleError(_0x40a092,null));};exports[_0x414d('0x4b')]=function(_0x72e8e9,_0x457767){return db[_0x414d('0x42')]['create'](_0x72e8e9[_0x414d('0x4c')],{})[_0x414d('0x29')](respondWithResult(_0x457767,0xc9))[_0x414d('0x4a')](handleError(_0x457767,null));};exports['update']=function(_0xc4d472,_0x3f4cf9){if(_0xc4d472[_0x414d('0x4c')]['id']){delete _0xc4d472[_0x414d('0x4c')]['id'];}return db[_0x414d('0x42')][_0x414d('0x4d')]({'where':{'id':_0xc4d472[_0x414d('0x48')]['id']}})[_0x414d('0x29')](handleEntityNotFound(_0x3f4cf9,null))[_0x414d('0x29')](saveUpdates(_0xc4d472[_0x414d('0x4c')],null))[_0x414d('0x29')](respondWithResult(_0x3f4cf9,null))[_0x414d('0x4a')](handleError(_0x3f4cf9,null));};exports[_0x414d('0x4e')]=function(_0x1c3090,_0x2005e0){return db[_0x414d('0x42')][_0x414d('0x4d')]({'where':{'id':_0x1c3090[_0x414d('0x48')]['id']}})[_0x414d('0x29')](handleEntityNotFound(_0x2005e0,null))[_0x414d('0x29')](removeEntity(_0x2005e0,null))[_0x414d('0x4a')](handleError(_0x2005e0,null));};exports[_0x414d('0x4f')]=function(_0x9d42c3,_0x427412){return db[_0x414d('0x42')]['describe']()[_0x414d('0x29')](respondWithResult(_0x427412,null))[_0x414d('0x4a')](handleError(_0x427412,null));};exports[_0x414d('0x50')]=function(_0x368cc0,_0x2a5e28,_0x55f829){return db[_0x414d('0x51')][_0x414d('0x23')]({'where':{'ChatGroupId':_0x368cc0[_0x414d('0x48')]['id'],'ToId':_0x368cc0[_0x414d('0x52')]['id'],'read':![]}})[_0x414d('0x29')](function(_0x3c7733){return{'id':_[_0x414d('0x53')](_0x368cc0[_0x414d('0x48')]['id']),'count':_0x3c7733};})[_0x414d('0x29')](respondWithResult(_0x2a5e28,null))[_0x414d('0x4a')](handleError(_0x2a5e28,null));};exports[_0x414d('0x54')]=function(_0x14ddb7,_0x260b52,_0x166deb){return db[_0x414d('0x42')][_0x414d('0x4d')]({'where':{'id':_0x14ddb7[_0x414d('0x48')]['id']}})[_0x414d('0x29')](handleEntityNotFound(_0x260b52,null))['then'](function(_0x421a2b){if(_0x421a2b){return _0x421a2b[_0x414d('0x54')](_0x14ddb7['body'][_0x414d('0x55')],_['omit'](_0x14ddb7[_0x414d('0x4c')],['ids','id'])||{});}})[_0x414d('0x29')](respondWithResult(_0x260b52,null))['catch'](handleError(_0x260b52,null));};exports['getMembers']=function(_0x52ef8a,_0x4a1b39,_0x5da766){var _0x389187={};var _0x1bc860={};var _0x2b529b;var _0x1f5f70;return db[_0x414d('0x42')]['findOne']({'where':{'id':_0x52ef8a[_0x414d('0x48')]['id']}})[_0x414d('0x29')](handleEntityNotFound(_0x4a1b39,null))[_0x414d('0x29')](function(_0x142a4b){if(_0x142a4b){_0x2b529b=_0x142a4b;_0x1bc860[_0x414d('0x36')]=_['keys'](db['User'][_0x414d('0x49')]);_0x1bc860[_0x414d('0x32')]=_[_0x414d('0x33')](_0x52ef8a[_0x414d('0x32')]);_0x1bc860[_0x414d('0x34')]=_[_0x414d('0x35')](_0x1bc860['model'],_0x1bc860[_0x414d('0x32')]);_0x389187['attributes']=_[_0x414d('0x35')](_0x1bc860[_0x414d('0x36')],qs['fields'](_0x52ef8a['query'][_0x414d('0x38')]));_0x389187[_0x414d('0x37')]=_0x389187[_0x414d('0x37')][_0x414d('0x39')]?_0x389187[_0x414d('0x37')]:_0x1bc860[_0x414d('0x36')];_0x389187['order']=qs[_0x414d('0x3c')](_0x52ef8a[_0x414d('0x32')][_0x414d('0x3c')]);_0x389187[_0x414d('0x3d')]=qs[_0x414d('0x34')](_['pick'](_0x52ef8a['query'],_0x1bc860[_0x414d('0x34')]));if(_0x52ef8a[_0x414d('0x32')][_0x414d('0x3f')]){_0x389187[_0x414d('0x3d')]=_[_0x414d('0x40')](_0x389187[_0x414d('0x3d')],{'$or':_['map'](_0x389187[_0x414d('0x37')],function(_0x1fa70f){var _0x49b11e={};_0x49b11e[_0x1fa70f]={'$like':'%'+_0x52ef8a[_0x414d('0x32')][_0x414d('0x3f')]+'%'};return _0x49b11e;})});}_0x389187=_[_0x414d('0x40')]({},_0x389187,_0x52ef8a['options']);return _0x2b529b[_0x414d('0x56')](_0x389187);}})[_0x414d('0x29')](function(_0x2bff97){if(_0x2bff97){_0x1f5f70=_0x2bff97['length'];if(!_0x52ef8a[_0x414d('0x32')][_0x414d('0x3a')](_0x414d('0x57'))){_0x389187[_0x414d('0x22')]=qs['limit'](_0x52ef8a[_0x414d('0x32')]['limit']);_0x389187[_0x414d('0x20')]=qs[_0x414d('0x20')](_0x52ef8a['query']['offset']);}return _0x2b529b[_0x414d('0x56')](_0x389187);}})['then'](function(_0x2982e4){if(_0x2982e4){return _0x2982e4?{'count':_0x1f5f70,'rows':_0x2982e4}:null;}})[_0x414d('0x29')](respondWithResult(_0x4a1b39,null))['catch'](handleError(_0x4a1b39,null));};exports['removeMembers']=function(_0xfefb3e,_0x28198c,_0x13ad4b){return db['ChatGroup']['find']({'where':{'id':_0xfefb3e[_0x414d('0x48')]['id']}})[_0x414d('0x29')](handleEntityNotFound(_0x28198c,null))[_0x414d('0x29')](function(_0x2b7f53){if(_0x2b7f53){return _0x2b7f53[_0x414d('0x58')](_0xfefb3e[_0x414d('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x28198c,null))[_0x414d('0x4a')](handleError(_0x28198c,null));};exports[_0x414d('0x59')]=function(_0x13951f,_0x3fe896,_0x1829be){if(_0x13951f['body']['id']){delete _0x13951f[_0x414d('0x4c')]['id'];}return db[_0x414d('0x42')][_0x414d('0x4d')]({'where':{'id':_0x13951f[_0x414d('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fe896,null))[_0x414d('0x29')](function(_0x1b399d){if(_0x1b399d){_0x13951f[_0x414d('0x4c')][_0x414d('0x5a')]=_0x1b399d['id'];return db['ChatInternalMessage'][_0x414d('0x4b')](_0x13951f[_0x414d('0x4c')]);}})['then'](respondWithResult(_0x3fe896,null))['catch'](handleError(_0x3fe896,null));};exports[_0x414d('0x5b')]=function(_0x96f052,_0x5af5fc,_0x47b508){var _0x30f1eb={};var _0x2e874c={};var _0x7a67b9;var _0x4aba48;return db['ChatGroup'][_0x414d('0x5c')]({'where':{'id':_0x96f052[_0x414d('0x48')]['id']}})[_0x414d('0x29')](handleEntityNotFound(_0x5af5fc,null))[_0x414d('0x29')](function(_0x22f024){if(_0x22f024){_0x7a67b9=_0x22f024;_0x2e874c[_0x414d('0x36')]=_[_0x414d('0x33')](db[_0x414d('0x51')]['rawAttributes']);_0x2e874c['query']=_['keys'](_0x96f052[_0x414d('0x32')]);_0x2e874c[_0x414d('0x34')]=_[_0x414d('0x35')](_0x2e874c[_0x414d('0x36')],_0x2e874c[_0x414d('0x32')]);_0x30f1eb['attributes']=_[_0x414d('0x35')](_0x2e874c[_0x414d('0x36')],qs[_0x414d('0x38')](_0x96f052[_0x414d('0x32')][_0x414d('0x38')]));_0x30f1eb[_0x414d('0x37')]=_0x30f1eb[_0x414d('0x37')][_0x414d('0x39')]?_0x30f1eb[_0x414d('0x37')]:_0x2e874c[_0x414d('0x36')];_0x30f1eb['order']=qs[_0x414d('0x3c')](_0x96f052[_0x414d('0x32')][_0x414d('0x3c')]);_0x30f1eb[_0x414d('0x3d')]=qs[_0x414d('0x34')](_[_0x414d('0x3e')](_0x96f052[_0x414d('0x32')],_0x2e874c[_0x414d('0x34')]));if(_0x96f052[_0x414d('0x32')][_0x414d('0x3f')]){_0x30f1eb[_0x414d('0x3d')]=_['merge'](_0x30f1eb['where'],{'$or':_[_0x414d('0x31')](_0x30f1eb[_0x414d('0x37')],function(_0x387b2a){var _0x773189={};_0x773189[_0x387b2a]={'$like':'%'+_0x96f052[_0x414d('0x32')]['filter']+'%'};return _0x773189;})});}if(_0x96f052['query'][_0x414d('0x5d')]){var _0x5c826f=_0x96f052[_0x414d('0x32')][_0x414d('0x5d')][_0x414d('0x5e')](',');var _0x458e54={};_0x458e54[_0x5c826f[0x0]]={'$gte':moment(_0x5c826f[0x1])[_0x414d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30f1eb[_0x414d('0x3d')]=_['merge'](_0x30f1eb['where'],_0x458e54);}_0x30f1eb=_['merge']({},_0x30f1eb,_0x96f052[_0x414d('0x60')]);return _0x7a67b9[_0x414d('0x5b')](_0x30f1eb);}})[_0x414d('0x29')](function(_0x4c8604){if(_0x4c8604){_0x4aba48=_0x4c8604[_0x414d('0x39')];if(!_0x96f052[_0x414d('0x32')][_0x414d('0x3a')](_0x414d('0x57'))){_0x30f1eb[_0x414d('0x22')]=qs[_0x414d('0x22')](_0x96f052[_0x414d('0x32')][_0x414d('0x22')]);_0x30f1eb[_0x414d('0x20')]=qs[_0x414d('0x20')](_0x96f052[_0x414d('0x32')]['offset']);}return _0x7a67b9['getMessages'](_0x30f1eb);}})['then'](function(_0x1f759f){if(_0x1f759f){return _0x1f759f?{'count':_0x4aba48,'rows':_0x1f759f}:null;}})[_0x414d('0x29')](respondWithResult(_0x5af5fc,null))[_0x414d('0x4a')](handleError(_0x5af5fc,null));}; \ No newline at end of file +var _0x0f88=['getMembers','hasOwnProperty','removeMembers','ids','ChatInternalMessage','getMessages','pick','$gte','format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatGroup','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','getUnread','user','addMembers','omit','findOne','User','merge'];(function(_0x41dc14,_0xfe7034){var _0x254684=function(_0x32a649){while(--_0x32a649){_0x41dc14['push'](_0x41dc14['shift']());}};_0x254684(++_0xfe7034);}(_0x0f88,0x64));var _0x80f8=function(_0x402845,_0x34addd){_0x402845=_0x402845-0x0;var _0x47fd8f=_0x0f88[_0x402845];return _0x47fd8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80f8('0x1'));var rp=require('request-promise');var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var Mustache=require('mustache');var util=require(_0x80f8('0x4'));var path=require(_0x80f8('0x5'));var sox=require(_0x80f8('0x6'));var csv=require(_0x80f8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80f8('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x80f8('0x9'));var jsforce=require(_0x80f8('0xa'));var deskjs=require(_0x80f8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x80f8('0xc'));var Papa=require(_0x80f8('0xd'));var Redis=require(_0x80f8('0xe'));var authService=require(_0x80f8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x80f8('0x10'));var hardwareService=require(_0x80f8('0x11'));var logger=require('../../config/logger')(_0x80f8('0x12'));var utils=require(_0x80f8('0x13'));var config=require(_0x80f8('0x14'));var licenseUtil=require(_0x80f8('0x15'));var db=require(_0x80f8('0x16'))['db'];config[_0x80f8('0x17')]=_[_0x80f8('0x18')](config['redis'],{'host':_0x80f8('0x19'),'port':0x18eb});var socket=require(_0x80f8('0x1a'))(new Redis(config[_0x80f8('0x17')]));require(_0x80f8('0x1b'))[_0x80f8('0x1c')](socket);function respondWithStatusCode(_0x5d01b0,_0x2ba5e5){_0x2ba5e5=_0x2ba5e5||0xcc;return function(_0x34361e){if(_0x34361e){return _0x5d01b0['sendStatus'](_0x2ba5e5);}return _0x5d01b0[_0x80f8('0x1d')](_0x2ba5e5)['end']();};}function respondWithResult(_0xb19aba,_0x340fed){_0x340fed=_0x340fed||0xc8;return function(_0xba2f93){if(_0xba2f93){return _0xb19aba['status'](_0x340fed)[_0x80f8('0x1e')](_0xba2f93);}};}function respondWithFilteredResult(_0x1ea7df,_0x573c1a){return function(_0xf09c0c){if(_0xf09c0c){var _0x2c657b=typeof _0x573c1a['offset']==='undefined'&&typeof _0x573c1a[_0x80f8('0x1f')]===_0x80f8('0x20');var _0x7667ed=_0xf09c0c[_0x80f8('0x21')];var _0x40f345=_0x2c657b?0x0:_0x573c1a[_0x80f8('0x22')];var _0x5ec78c=_0x2c657b?_0xf09c0c[_0x80f8('0x21')]:_0x573c1a[_0x80f8('0x22')]+_0x573c1a[_0x80f8('0x1f')];var _0x239060;if(_0x5ec78c>=_0x7667ed){_0x5ec78c=_0x7667ed;_0x239060=0xc8;}else{_0x239060=0xce;}_0x1ea7df[_0x80f8('0x1d')](_0x239060);return _0x1ea7df[_0x80f8('0x23')](_0x80f8('0x24'),_0x40f345+'-'+_0x5ec78c+'/'+_0x7667ed)['json'](_0xf09c0c);}return null;};}function patchUpdates(_0x260876){return function(_0x3445e2){try{jsonpatch[_0x80f8('0x25')](_0x3445e2,_0x260876,!![]);}catch(_0x51b0ab){return BPromise[_0x80f8('0x26')](_0x51b0ab);}return _0x3445e2[_0x80f8('0x27')]();};}function saveUpdates(_0x3daf3e,_0x47fe91){return function(_0x1721a6){if(_0x1721a6){return _0x1721a6[_0x80f8('0x28')](_0x3daf3e)[_0x80f8('0x29')](function(_0x105016){return _0x105016;});}return null;};}function removeEntity(_0xb6fe6a,_0x230583){return function(_0xe1f710){if(_0xe1f710){return _0xe1f710[_0x80f8('0x2a')]()[_0x80f8('0x29')](function(){_0xb6fe6a[_0x80f8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ad5b0,_0x40787d){return function(_0x27e146){if(!_0x27e146){_0x5ad5b0['sendStatus'](0x194);}return _0x27e146;};}function handleError(_0x3796e3,_0x523340){_0x523340=_0x523340||0x1f4;return function(_0x29d97c){logger['error'](_0x29d97c[_0x80f8('0x2b')]);if(_0x29d97c[_0x80f8('0x2c')]){delete _0x29d97c['name'];}_0x3796e3[_0x80f8('0x1d')](_0x523340)[_0x80f8('0x2d')](_0x29d97c);};}exports[_0x80f8('0x2e')]=function(_0x4672f6,_0x5123f9){var _0x437194={},_0x29c403={},_0x403100={'count':0x0,'rows':[]};var _0x51c774=_[_0x80f8('0x2f')](db[_0x80f8('0x30')]['rawAttributes'],function(_0x445250){return{'name':_0x445250['fieldName'],'type':_0x445250[_0x80f8('0x31')]['key']};});_0x29c403[_0x80f8('0x32')]=_[_0x80f8('0x2f')](_0x51c774,'name');_0x29c403[_0x80f8('0x33')]=_[_0x80f8('0x34')](_0x4672f6[_0x80f8('0x33')]);_0x29c403[_0x80f8('0x35')]=_[_0x80f8('0x36')](_0x29c403['model'],_0x29c403[_0x80f8('0x33')]);_0x437194[_0x80f8('0x37')]=_[_0x80f8('0x36')](_0x29c403[_0x80f8('0x32')],qs[_0x80f8('0x38')](_0x4672f6[_0x80f8('0x33')][_0x80f8('0x38')]));_0x437194[_0x80f8('0x37')]=_0x437194['attributes'][_0x80f8('0x39')]?_0x437194[_0x80f8('0x37')]:_0x29c403[_0x80f8('0x32')];if(!_0x4672f6[_0x80f8('0x33')]['hasOwnProperty'](_0x80f8('0x3a'))){_0x437194['limit']=qs['limit'](_0x4672f6[_0x80f8('0x33')][_0x80f8('0x1f')]);_0x437194[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x4672f6[_0x80f8('0x33')][_0x80f8('0x22')]);}_0x437194[_0x80f8('0x3b')]=qs[_0x80f8('0x3c')](_0x4672f6[_0x80f8('0x33')][_0x80f8('0x3c')]);_0x437194[_0x80f8('0x3d')]=qs['filters'](_['pick'](_0x4672f6[_0x80f8('0x33')],_0x29c403[_0x80f8('0x35')]),_0x51c774);if(_0x4672f6[_0x80f8('0x33')][_0x80f8('0x3e')]){_0x437194[_0x80f8('0x3d')]=_['merge'](_0x437194[_0x80f8('0x3d')],{'$or':_[_0x80f8('0x2f')](_0x51c774,function(_0x6bd059){if(_0x6bd059[_0x80f8('0x31')]!==_0x80f8('0x3f')){var _0x4269de={};_0x4269de[_0x6bd059['name']]={'$like':'%'+_0x4672f6['query']['filter']+'%'};return _0x4269de;}})});}_0x437194=_['merge']({},_0x437194,_0x4672f6[_0x80f8('0x40')]);var _0x341a4f={'where':_0x437194['where']};return db['ChatGroup'][_0x80f8('0x21')](_0x341a4f)[_0x80f8('0x29')](function(_0xbba104){_0x403100[_0x80f8('0x21')]=_0xbba104;if(_0x4672f6[_0x80f8('0x33')][_0x80f8('0x41')]){_0x437194[_0x80f8('0x42')]=[{'all':!![]}];}return db[_0x80f8('0x30')][_0x80f8('0x43')](_0x437194);})['then'](function(_0x16e6e8){_0x403100['rows']=_0x16e6e8;return _0x403100;})[_0x80f8('0x29')](respondWithFilteredResult(_0x5123f9,_0x437194))[_0x80f8('0x44')](handleError(_0x5123f9,null));};exports['show']=function(_0x3b591c,_0x238674){var _0x393ae9={'raw':!![],'where':{'id':_0x3b591c[_0x80f8('0x45')]['id']}},_0x103380={};_0x103380[_0x80f8('0x32')]=_[_0x80f8('0x34')](db[_0x80f8('0x30')][_0x80f8('0x46')]);_0x103380[_0x80f8('0x33')]=_[_0x80f8('0x34')](_0x3b591c[_0x80f8('0x33')]);_0x103380[_0x80f8('0x35')]=_[_0x80f8('0x36')](_0x103380[_0x80f8('0x32')],_0x103380[_0x80f8('0x33')]);_0x393ae9[_0x80f8('0x37')]=_[_0x80f8('0x36')](_0x103380[_0x80f8('0x32')],qs[_0x80f8('0x38')](_0x3b591c[_0x80f8('0x33')][_0x80f8('0x38')]));_0x393ae9[_0x80f8('0x37')]=_0x393ae9[_0x80f8('0x37')][_0x80f8('0x39')]?_0x393ae9[_0x80f8('0x37')]:_0x103380[_0x80f8('0x32')];if(_0x3b591c[_0x80f8('0x33')][_0x80f8('0x41')]){_0x393ae9[_0x80f8('0x42')]=[{'all':!![]}];}_0x393ae9=_['merge']({},_0x393ae9,_0x3b591c[_0x80f8('0x40')]);return db[_0x80f8('0x30')][_0x80f8('0x47')](_0x393ae9)[_0x80f8('0x29')](handleEntityNotFound(_0x238674,null))[_0x80f8('0x29')](respondWithResult(_0x238674,null))[_0x80f8('0x44')](handleError(_0x238674,null));};exports[_0x80f8('0x48')]=function(_0x314a6f,_0x56c4b){return db[_0x80f8('0x30')][_0x80f8('0x48')](_0x314a6f[_0x80f8('0x49')],{})[_0x80f8('0x29')](respondWithResult(_0x56c4b,0xc9))[_0x80f8('0x44')](handleError(_0x56c4b,null));};exports[_0x80f8('0x28')]=function(_0xa6468,_0x2bb230){if(_0xa6468[_0x80f8('0x49')]['id']){delete _0xa6468['body']['id'];}return db[_0x80f8('0x30')]['find']({'where':{'id':_0xa6468['params']['id']}})[_0x80f8('0x29')](handleEntityNotFound(_0x2bb230,null))[_0x80f8('0x29')](saveUpdates(_0xa6468['body'],null))[_0x80f8('0x29')](respondWithResult(_0x2bb230,null))[_0x80f8('0x44')](handleError(_0x2bb230,null));};exports[_0x80f8('0x2a')]=function(_0x59e9c1,_0x6e585e){return db['ChatGroup']['find']({'where':{'id':_0x59e9c1['params']['id']}})[_0x80f8('0x29')](handleEntityNotFound(_0x6e585e,null))[_0x80f8('0x29')](removeEntity(_0x6e585e,null))[_0x80f8('0x44')](handleError(_0x6e585e,null));};exports[_0x80f8('0x4a')]=function(_0x59c5b1,_0x4919a9){return db[_0x80f8('0x30')][_0x80f8('0x4a')]()['then'](respondWithResult(_0x4919a9,null))[_0x80f8('0x44')](handleError(_0x4919a9,null));};exports[_0x80f8('0x4b')]=function(_0x2c8262,_0x53849d,_0x166bfd){return db['ChatInternalMessage'][_0x80f8('0x21')]({'where':{'ChatGroupId':_0x2c8262['params']['id'],'ToId':_0x2c8262[_0x80f8('0x4c')]['id'],'read':![]}})[_0x80f8('0x29')](function(_0x56283f){return{'id':_['toInteger'](_0x2c8262['params']['id']),'count':_0x56283f};})[_0x80f8('0x29')](respondWithResult(_0x53849d,null))[_0x80f8('0x44')](handleError(_0x53849d,null));};exports[_0x80f8('0x4d')]=function(_0x2d8111,_0x34c2ff,_0x14e481){return db[_0x80f8('0x30')][_0x80f8('0x47')]({'where':{'id':_0x2d8111[_0x80f8('0x45')]['id']}})['then'](handleEntityNotFound(_0x34c2ff,null))['then'](function(_0x105746){if(_0x105746){return _0x105746[_0x80f8('0x4d')](_0x2d8111[_0x80f8('0x49')]['ids'],_[_0x80f8('0x4e')](_0x2d8111['body'],['ids','id'])||{});}})[_0x80f8('0x29')](respondWithResult(_0x34c2ff,null))['catch'](handleError(_0x34c2ff,null));};exports['getMembers']=function(_0x9ece10,_0x6f3bc0,_0x37850e){var _0x48e043={};var _0x4a9503={};var _0x7445ac;var _0x26948e;return db[_0x80f8('0x30')][_0x80f8('0x4f')]({'where':{'id':_0x9ece10[_0x80f8('0x45')]['id']}})[_0x80f8('0x29')](handleEntityNotFound(_0x6f3bc0,null))['then'](function(_0x361b90){if(_0x361b90){_0x7445ac=_0x361b90;_0x4a9503[_0x80f8('0x32')]=_[_0x80f8('0x34')](db[_0x80f8('0x50')][_0x80f8('0x46')]);_0x4a9503['query']=_['keys'](_0x9ece10[_0x80f8('0x33')]);_0x4a9503[_0x80f8('0x35')]=_[_0x80f8('0x36')](_0x4a9503['model'],_0x4a9503['query']);_0x48e043[_0x80f8('0x37')]=_['intersection'](_0x4a9503[_0x80f8('0x32')],qs[_0x80f8('0x38')](_0x9ece10['query'][_0x80f8('0x38')]));_0x48e043[_0x80f8('0x37')]=_0x48e043[_0x80f8('0x37')][_0x80f8('0x39')]?_0x48e043[_0x80f8('0x37')]:_0x4a9503[_0x80f8('0x32')];_0x48e043[_0x80f8('0x3b')]=qs[_0x80f8('0x3c')](_0x9ece10[_0x80f8('0x33')]['sort']);_0x48e043['where']=qs[_0x80f8('0x35')](_['pick'](_0x9ece10[_0x80f8('0x33')],_0x4a9503[_0x80f8('0x35')]));if(_0x9ece10['query'][_0x80f8('0x3e')]){_0x48e043[_0x80f8('0x3d')]=_['merge'](_0x48e043[_0x80f8('0x3d')],{'$or':_[_0x80f8('0x2f')](_0x48e043[_0x80f8('0x37')],function(_0x6b9deb){var _0x43b321={};_0x43b321[_0x6b9deb]={'$like':'%'+_0x9ece10[_0x80f8('0x33')][_0x80f8('0x3e')]+'%'};return _0x43b321;})});}_0x48e043=_[_0x80f8('0x51')]({},_0x48e043,_0x9ece10[_0x80f8('0x40')]);return _0x7445ac[_0x80f8('0x52')](_0x48e043);}})[_0x80f8('0x29')](function(_0x561da1){if(_0x561da1){_0x26948e=_0x561da1[_0x80f8('0x39')];if(!_0x9ece10[_0x80f8('0x33')][_0x80f8('0x53')](_0x80f8('0x3a'))){_0x48e043[_0x80f8('0x1f')]=qs[_0x80f8('0x1f')](_0x9ece10[_0x80f8('0x33')][_0x80f8('0x1f')]);_0x48e043[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x9ece10['query']['offset']);}return _0x7445ac[_0x80f8('0x52')](_0x48e043);}})[_0x80f8('0x29')](function(_0x199a56){if(_0x199a56){return _0x199a56?{'count':_0x26948e,'rows':_0x199a56}:null;}})[_0x80f8('0x29')](respondWithResult(_0x6f3bc0,null))[_0x80f8('0x44')](handleError(_0x6f3bc0,null));};exports[_0x80f8('0x54')]=function(_0x1f8573,_0x22ab61,_0x15caa8){return db[_0x80f8('0x30')][_0x80f8('0x47')]({'where':{'id':_0x1f8573[_0x80f8('0x45')]['id']}})[_0x80f8('0x29')](handleEntityNotFound(_0x22ab61,null))[_0x80f8('0x29')](function(_0x23cc9c){if(_0x23cc9c){return _0x23cc9c[_0x80f8('0x54')](_0x1f8573[_0x80f8('0x33')][_0x80f8('0x55')]);}})['then'](respondWithStatusCode(_0x22ab61,null))['catch'](handleError(_0x22ab61,null));};exports['addMessage']=function(_0xab136,_0x188aa7,_0x266e02){if(_0xab136[_0x80f8('0x49')]['id']){delete _0xab136['body']['id'];}return db[_0x80f8('0x30')][_0x80f8('0x47')]({'where':{'id':_0xab136['params']['id']}})['then'](handleEntityNotFound(_0x188aa7,null))['then'](function(_0x2a048e){if(_0x2a048e){_0xab136[_0x80f8('0x49')]['ChatGroupId']=_0x2a048e['id'];return db[_0x80f8('0x56')][_0x80f8('0x48')](_0xab136[_0x80f8('0x49')]);}})['then'](respondWithResult(_0x188aa7,null))[_0x80f8('0x44')](handleError(_0x188aa7,null));};exports[_0x80f8('0x57')]=function(_0x2ef811,_0x139a36,_0x581286){var _0x678a63={};var _0x1355a5={};var _0x52812a;var _0x4bea63;return db[_0x80f8('0x30')][_0x80f8('0x4f')]({'where':{'id':_0x2ef811['params']['id']}})[_0x80f8('0x29')](handleEntityNotFound(_0x139a36,null))[_0x80f8('0x29')](function(_0x302525){if(_0x302525){_0x52812a=_0x302525;_0x1355a5[_0x80f8('0x32')]=_[_0x80f8('0x34')](db[_0x80f8('0x56')]['rawAttributes']);_0x1355a5[_0x80f8('0x33')]=_[_0x80f8('0x34')](_0x2ef811[_0x80f8('0x33')]);_0x1355a5[_0x80f8('0x35')]=_[_0x80f8('0x36')](_0x1355a5[_0x80f8('0x32')],_0x1355a5[_0x80f8('0x33')]);_0x678a63['attributes']=_[_0x80f8('0x36')](_0x1355a5[_0x80f8('0x32')],qs['fields'](_0x2ef811[_0x80f8('0x33')][_0x80f8('0x38')]));_0x678a63[_0x80f8('0x37')]=_0x678a63[_0x80f8('0x37')][_0x80f8('0x39')]?_0x678a63[_0x80f8('0x37')]:_0x1355a5[_0x80f8('0x32')];_0x678a63['order']=qs[_0x80f8('0x3c')](_0x2ef811['query'][_0x80f8('0x3c')]);_0x678a63[_0x80f8('0x3d')]=qs[_0x80f8('0x35')](_[_0x80f8('0x58')](_0x2ef811[_0x80f8('0x33')],_0x1355a5['filters']));if(_0x2ef811[_0x80f8('0x33')][_0x80f8('0x3e')]){_0x678a63[_0x80f8('0x3d')]=_[_0x80f8('0x51')](_0x678a63[_0x80f8('0x3d')],{'$or':_[_0x80f8('0x2f')](_0x678a63['attributes'],function(_0x157651){var _0x1dca2b={};_0x1dca2b[_0x157651]={'$like':'%'+_0x2ef811[_0x80f8('0x33')]['filter']+'%'};return _0x1dca2b;})});}if(_0x2ef811[_0x80f8('0x33')][_0x80f8('0x59')]){var _0x1b4a3d=_0x2ef811[_0x80f8('0x33')]['$gte']['split'](',');var _0x44177a={};_0x44177a[_0x1b4a3d[0x0]]={'$gte':moment(_0x1b4a3d[0x1])[_0x80f8('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x678a63[_0x80f8('0x3d')]=_[_0x80f8('0x51')](_0x678a63[_0x80f8('0x3d')],_0x44177a);}_0x678a63=_[_0x80f8('0x51')]({},_0x678a63,_0x2ef811[_0x80f8('0x40')]);return _0x52812a[_0x80f8('0x57')](_0x678a63);}})[_0x80f8('0x29')](function(_0x20c181){if(_0x20c181){_0x4bea63=_0x20c181[_0x80f8('0x39')];if(!_0x2ef811[_0x80f8('0x33')][_0x80f8('0x53')](_0x80f8('0x3a'))){_0x678a63['limit']=qs['limit'](_0x2ef811[_0x80f8('0x33')][_0x80f8('0x1f')]);_0x678a63[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x2ef811['query'][_0x80f8('0x22')]);}return _0x52812a['getMessages'](_0x678a63);}})[_0x80f8('0x29')](function(_0x3c52fb){if(_0x3c52fb){return _0x3c52fb?{'count':_0x4bea63,'rows':_0x3c52fb}:null;}})['then'](respondWithResult(_0x139a36,null))[_0x80f8('0x44')](handleError(_0x139a36,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index bfb8034..5dfa53b 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 _0x74d3=['hook','events','../../mysqldb','ChatGroup','save','remove','emit','hasOwnProperty'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x74d3,0x159));var _0x374d=function(_0x305be7,_0x527c99){_0x305be7=_0x305be7-0x0;var _0x122e11=_0x74d3[_0x305be7];return _0x122e11;};'use strict';var EventEmitter=require(_0x374d('0x0'));var ChatGroup=require(_0x374d('0x1'))['db'][_0x374d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x374d('0x3'),'afterUpdate':'update','afterDestroy':_0x374d('0x4')};function emitEvent(_0x9f6268){return function(_0x1a79ae,_0x5e7908,_0x2ef1fc){ChatGroupEvents['emit'](_0x9f6268+':'+_0x1a79ae['id'],_0x1a79ae);ChatGroupEvents[_0x374d('0x5')](_0x9f6268,_0x1a79ae);_0x2ef1fc(null);};}for(var e in events){if(events[_0x374d('0x6')](e)){var event=events[e];ChatGroup[_0x374d('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x7a02=['exports','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x7a02,0x1ba));var _0x27a0=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x7a02[_0x486f4a];return _0x135d99;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x27a0('0x0'))['db'][_0x27a0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x27a0('0x2')](0x0);var events={'afterCreate':_0x27a0('0x3'),'afterUpdate':_0x27a0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x939042){return function(_0x2b3fe8,_0x380a04,_0x46d249){ChatGroupEvents[_0x27a0('0x5')](_0x939042+':'+_0x2b3fe8['id'],_0x2b3fe8);ChatGroupEvents[_0x27a0('0x5')](_0x939042,_0x2b3fe8);_0x46d249(null);};}for(var e in events){if(events[_0x27a0('0x6')](e)){var event=events[e];ChatGroup[_0x27a0('0x7')](e,emitEvent(event));}}module[_0x27a0('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ce13707..28a7b37 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 _0x5cdd=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','chat_groups'];(function(_0x5a4d1f,_0x11e801){var _0x327268=function(_0x310d46){while(--_0x310d46){_0x5a4d1f['push'](_0x5a4d1f['shift']());}};_0x327268(++_0x11e801);}(_0x5cdd,0x6c));var _0xd5cd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5cdd[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd5cd('0x0'));var util=require(_0xd5cd('0x1'));var logger=require('../../config/logger')(_0xd5cd('0x2'));var moment=require(_0xd5cd('0x3'));var BPromise=require(_0xd5cd('0x4'));var rp=require(_0xd5cd('0x5'));var fs=require('fs');var path=require(_0xd5cd('0x6'));var rimraf=require(_0xd5cd('0x7'));var config=require(_0xd5cd('0x8'));var attributes=require(_0xd5cd('0x9'));module[_0xd5cd('0xa')]=function(_0x3e9305,_0x5adbe6){return _0x3e9305['define']('ChatGroup',attributes,{'tableName':_0xd5cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65c2=['./chatGroup.attributes','ChatGroup','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x65c2,0x142));var _0x265c=function(_0x45847f,_0x3f579d){_0x45847f=_0x45847f-0x0;var _0x5439d0=_0x65c2[_0x45847f];return _0x5439d0;};'use strict';var _=require(_0x265c('0x0'));var util=require('util');var logger=require(_0x265c('0x1'))(_0x265c('0x2'));var moment=require('moment');var BPromise=require(_0x265c('0x3'));var rp=require(_0x265c('0x4'));var fs=require('fs');var path=require(_0x265c('0x5'));var rimraf=require(_0x265c('0x6'));var config=require(_0x265c('0x7'));var attributes=require(_0x265c('0x8'));module['exports']=function(_0x15b436,_0x2810a8){return _0x15b436['define'](_0x265c('0x9'),attributes,{'tableName':'chat_groups','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 e2aea39..ddd5e00 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 _0x0fda=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x1d72ef,_0x251f64){_0x1d72ef=_0x1d72ef-0x0;var _0x35fc66=_0x0fda[_0x1d72ef];return _0x35fc66;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa0fd('0x9')]=_[_0xa0fd('0xa')](config[_0xa0fd('0x9')],{'host':_0xa0fd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0fd('0x9')]));require(_0xa0fd('0xc'))[_0xa0fd('0xd')](socket);function respondWithRpcPromise(_0x322a1a,_0x4e1873,_0x31088d){return new BPromise(function(_0x423616,_0x36634c){return client['request'](_0x322a1a,_0x31088d)[_0xa0fd('0xe')](function(_0x332e66){logger[_0xa0fd('0xf')](_0xa0fd('0x10'),_0x4e1873,_0xa0fd('0x11'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4e1873,_0xa0fd('0x11'),JSON[_0xa0fd('0x12')](_0x332e66));if(_0x332e66['error']){if(_0x332e66[_0xa0fd('0x13')][_0xa0fd('0x14')]===0x1f4){logger[_0xa0fd('0x13')](_0xa0fd('0x10'),_0x4e1873,_0x332e66[_0xa0fd('0x13')][_0xa0fd('0x15')]);return _0x36634c(_0x332e66[_0xa0fd('0x13')]['message']);}logger[_0xa0fd('0x13')](_0xa0fd('0x10'),_0x4e1873,_0x332e66['error']['message']);return _0x423616(_0x332e66[_0xa0fd('0x13')][_0xa0fd('0x15')]);}else{logger['info'](_0xa0fd('0x10'),_0x4e1873,_0xa0fd('0x11'));_0x423616(_0x332e66[_0xa0fd('0x16')]['message']);}})['catch'](function(_0x46e15a){logger['error'](_0xa0fd('0x10'),_0x4e1873,_0x46e15a);_0x36634c(_0x46e15a);});});} \ No newline at end of file +var _0x29fb=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0xa2d90a,_0x721950){var _0x3962f0=function(_0x34d303){while(--_0x34d303){_0xa2d90a['push'](_0xa2d90a['shift']());}};_0x3962f0(++_0x721950);}(_0x29fb,0x13d));var _0xb29f=function(_0x58e1fd,_0x2d6689){_0x58e1fd=_0x58e1fd-0x0;var _0x23f756=_0x29fb[_0x58e1fd];return _0x23f756;};'use strict';var _=require(_0xb29f('0x0'));var util=require('util');var moment=require(_0xb29f('0x1'));var BPromise=require(_0xb29f('0x2'));var rs=require(_0xb29f('0x3'));var fs=require('fs');var Redis=require(_0xb29f('0x4'));var db=require(_0xb29f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb29f('0x6'))('rpc');var config=require(_0xb29f('0x7'));var jayson=require(_0xb29f('0x8'));var client=jayson[_0xb29f('0x9')][_0xb29f('0xa')]({'port':0x232a});config[_0xb29f('0xb')]=_[_0xb29f('0xc')](config[_0xb29f('0xb')],{'host':_0xb29f('0xd'),'port':0x18eb});var socket=require(_0xb29f('0xe'))(new Redis(config[_0xb29f('0xb')]));require(_0xb29f('0xf'))[_0xb29f('0x10')](socket);function respondWithRpcPromise(_0x45d8bb,_0x16a06b,_0x4f0325){return new BPromise(function(_0x3c51e1,_0x4acb9f){return client['request'](_0x45d8bb,_0x4f0325)['then'](function(_0x3694a8){logger['info'](_0xb29f('0x11'),_0x16a06b,_0xb29f('0x12'));logger[_0xb29f('0x13')](_0xb29f('0x14'),_0x16a06b,_0xb29f('0x12'),JSON['stringify'](_0x3694a8));if(_0x3694a8[_0xb29f('0x15')]){if(_0x3694a8[_0xb29f('0x15')]['code']===0x1f4){logger[_0xb29f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x16a06b,_0x3694a8[_0xb29f('0x15')][_0xb29f('0x16')]);return _0x4acb9f(_0x3694a8[_0xb29f('0x15')]['message']);}logger[_0xb29f('0x15')](_0xb29f('0x11'),_0x16a06b,_0x3694a8[_0xb29f('0x15')][_0xb29f('0x16')]);return _0x3c51e1(_0x3694a8[_0xb29f('0x15')][_0xb29f('0x16')]);}else{logger[_0xb29f('0x17')](_0xb29f('0x11'),_0x16a06b,'request\x20sent');_0x3c51e1(_0x3694a8[_0xb29f('0x18')][_0xb29f('0x16')]);}})[_0xb29f('0x19')](function(_0x44e0e3){logger['error'](_0xb29f('0x11'),_0x16a06b,_0x44e0e3);_0x4acb9f(_0x44e0e3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2fec8d9..215fd52 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 _0x3526=['save','remove','length','chatGroup:','./chatGroup.events'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x3526,0x1ad));var _0x6352=function(_0x4d2ea7,_0x2b2459){_0x4d2ea7=_0x4d2ea7-0x0;var _0x5875f6=_0x3526[_0x4d2ea7];return _0x5875f6;};'use strict';var ChatGroupEvents=require(_0x6352('0x0'));var events=[_0x6352('0x1'),_0x6352('0x2'),'update'];function createListener(_0x46d183,_0x5e2f1b){return function(_0x5a20f7){_0x5e2f1b['emit'](_0x46d183,_0x5a20f7);};}function removeListener(_0x3e9ea8,_0x3a7282){return function(){ChatGroupEvents['removeListener'](_0x3e9ea8,_0x3a7282);};}exports['register']=function(_0x1c34da){for(var _0x3f726d=0x0,_0x577b97=events[_0x6352('0x3')];_0x3f726d<_0x577b97;_0x3f726d++){var _0x2a1d45=events[_0x3f726d];var _0x1d138a=createListener(_0x6352('0x4')+_0x2a1d45,_0x1c34da);ChatGroupEvents['on'](_0x2a1d45,_0x1d138a);}}; \ No newline at end of file +var _0x25c5=['remove','update','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x1e9562,_0x155d5e){var _0x31f51c=function(_0x563970){while(--_0x563970){_0x1e9562['push'](_0x1e9562['shift']());}};_0x31f51c(++_0x155d5e);}(_0x25c5,0x176));var _0x525c=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x25c5[_0x13b330];return _0x1f666c;};'use strict';var ChatGroupEvents=require(_0x525c('0x0'));var events=[_0x525c('0x1'),_0x525c('0x2'),_0x525c('0x3')];function createListener(_0x1f24fb,_0x21e312){return function(_0x3c9511){_0x21e312[_0x525c('0x4')](_0x1f24fb,_0x3c9511);};}function removeListener(_0x5ea338,_0x135d6e){return function(){ChatGroupEvents[_0x525c('0x5')](_0x5ea338,_0x135d6e);};}exports[_0x525c('0x6')]=function(_0x51c0de){for(var _0x2e0c13=0x0,_0x2cf5cb=events[_0x525c('0x7')];_0x2e0c13<_0x2cf5cb;_0x2e0c13++){var _0x5ed67b=events[_0x2e0c13];var _0x4dd49c=createListener('chatGroup:'+_0x5ed67b,_0x51c0de);ChatGroupEvents['on'](_0x5ed67b,_0x4dd49c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e007245..7e2367e 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 _0xcc2a=['show','/:id/unread','getUnread','getMembers','getMessages','post','/:id/members','addMembers','/:id/messages','update','delete','destroy','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0xcc2a,0xb0));var _0xacc2=function(_0x2b8271,_0x182807){_0x2b8271=_0x2b8271-0x0;var _0x5a863f=_0xcc2a[_0x2b8271];return _0x5a863f;};'use strict';var multer=require(_0xacc2('0x0'));var util=require(_0xacc2('0x1'));var path=require(_0xacc2('0x2'));var timeout=require('connect-timeout');var express=require(_0xacc2('0x3'));var router=express[_0xacc2('0x4')]();var fs_extra=require(_0xacc2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xacc2('0x6'));var config=require(_0xacc2('0x7'));var controller=require('./chatGroup.controller');router[_0xacc2('0x8')]('/',auth['isAuthenticated'](),controller[_0xacc2('0x9')]);router[_0xacc2('0x8')]('/describe',auth[_0xacc2('0xa')](),controller[_0xacc2('0xb')]);router['get'](_0xacc2('0xc'),auth[_0xacc2('0xa')](),controller[_0xacc2('0xd')]);router[_0xacc2('0x8')](_0xacc2('0xe'),auth['isAuthenticated'](),controller[_0xacc2('0xf')]);router[_0xacc2('0x8')]('/:id/members',auth[_0xacc2('0xa')](),controller[_0xacc2('0x10')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xacc2('0x11')]);router[_0xacc2('0x12')]('/',auth[_0xacc2('0xa')](),controller['create']);router[_0xacc2('0x12')](_0xacc2('0x13'),auth[_0xacc2('0xa')](),controller[_0xacc2('0x14')]);router[_0xacc2('0x12')](_0xacc2('0x15'),auth[_0xacc2('0xa')](),controller['addMessage']);router['put'](_0xacc2('0xc'),auth[_0xacc2('0xa')](),controller[_0xacc2('0x16')]);router[_0xacc2('0x17')](_0xacc2('0xc'),auth['isAuthenticated'](),controller[_0xacc2('0x18')]);router[_0xacc2('0x17')](_0xacc2('0x13'),auth[_0xacc2('0xa')](),controller[_0xacc2('0x19')]);module[_0xacc2('0x1a')]=router; \ No newline at end of file +var _0x7e73=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','create','post','addMembers','addMessage','put','update','delete','destroy','exports','multer','util'];(function(_0x212a61,_0x441195){var _0x2979e9=function(_0x28019b){while(--_0x28019b){_0x212a61['push'](_0x212a61['shift']());}};_0x2979e9(++_0x441195);}(_0x7e73,0x15a));var _0x37e7=function(_0x478b5f,_0x341096){_0x478b5f=_0x478b5f-0x0;var _0x4c09fc=_0x7e73[_0x478b5f];return _0x4c09fc;};'use strict';var multer=require(_0x37e7('0x0'));var util=require(_0x37e7('0x1'));var path=require('path');var timeout=require(_0x37e7('0x2'));var express=require('express');var router=express[_0x37e7('0x3')]();var fs_extra=require(_0x37e7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x37e7('0x5'));var config=require(_0x37e7('0x6'));var controller=require(_0x37e7('0x7'));router[_0x37e7('0x8')]('/',auth[_0x37e7('0x9')](),controller[_0x37e7('0xa')]);router[_0x37e7('0x8')](_0x37e7('0xb'),auth[_0x37e7('0x9')](),controller[_0x37e7('0xc')]);router[_0x37e7('0x8')](_0x37e7('0xd'),auth[_0x37e7('0x9')](),controller[_0x37e7('0xe')]);router[_0x37e7('0x8')](_0x37e7('0xf'),auth[_0x37e7('0x9')](),controller[_0x37e7('0x10')]);router[_0x37e7('0x8')](_0x37e7('0x11'),auth[_0x37e7('0x9')](),controller[_0x37e7('0x12')]);router[_0x37e7('0x8')](_0x37e7('0x13'),auth[_0x37e7('0x9')](),controller['getMessages']);router['post']('/',auth[_0x37e7('0x9')](),controller[_0x37e7('0x14')]);router[_0x37e7('0x15')](_0x37e7('0x11'),auth[_0x37e7('0x9')](),controller[_0x37e7('0x16')]);router['post']('/:id/messages',auth[_0x37e7('0x9')](),controller[_0x37e7('0x17')]);router[_0x37e7('0x18')](_0x37e7('0xd'),auth[_0x37e7('0x9')](),controller[_0x37e7('0x19')]);router[_0x37e7('0x1a')](_0x37e7('0xd'),auth['isAuthenticated'](),controller[_0x37e7('0x1b')]);router[_0x37e7('0x1a')](_0x37e7('0x11'),auth[_0x37e7('0x9')](),controller['removeMembers']);module[_0x37e7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0d914da..390ccac 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 _0x190f=['star','thumb','STRING','DATE','TEXT','long','out','INTEGER','sequelize','exports','BOOLEAN','ENUM'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x190f,0x1d0));var _0xf190=function(_0x42c04b,_0x4a7d52){_0x42c04b=_0x42c04b-0x0;var _0xdd038d=_0x190f[_0x42c04b];return _0xdd038d;};'use strict';var Sequelize=require(_0xf190('0x0'));module[_0xf190('0x1')]={'closed':{'type':Sequelize[_0xf190('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xf190('0x3')](_0xf190('0x4'),_0xf190('0x5')),'defaultValue':_0xf190('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xf190('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf190('0x7')]},'disposition':{'type':Sequelize[_0xf190('0x6')]},'secondDisposition':{'type':Sequelize[_0xf190('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xf190('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xf190('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xf190('0x6')]},'deviceVendor':{'type':Sequelize[_0xf190('0x6')]},'deviceType':{'type':Sequelize[_0xf190('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf190('0x6')]},'formData':{'type':Sequelize[_0xf190('0x8')](_0xf190('0x9'))},'read1stAt':{'type':Sequelize[_0xf190('0x7')]},'lastMsgAt':{'type':Sequelize[_0xf190('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xf190('0x3')]('in',_0xf190('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf190('0x6')]},'customerPort':{'type':Sequelize[_0xf190('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xf190('0x8')]},'autoreplyExecuted':{'type':Sequelize[_0xf190('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf190('0xb')]}}; \ No newline at end of file +var _0x7195=['TEXT','STRING','long','DATE','ENUM','out','BOOLEAN','INTEGER','thumb','star'];(function(_0x5a66bd,_0x22713b){var _0x18e264=function(_0x51b5d3){while(--_0x51b5d3){_0x5a66bd['push'](_0x5a66bd['shift']());}};_0x18e264(++_0x22713b);}(_0x7195,0xd8));var _0x5719=function(_0xe80621,_0x31c622){_0xe80621=_0xe80621-0x0;var _0x4a2fb7=_0x7195[_0xe80621];return _0x4a2fb7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x5719('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5719('0x1')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x5719('0x2')),'defaultValue':_0x5719('0x3')},'ratingMessage':{'type':Sequelize[_0x5719('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x5719('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5719('0x5')]},'thirdDisposition':{'type':Sequelize[_0x5719('0x5')]},'note':{'type':Sequelize[_0x5719('0x5')]},'browserName':{'type':Sequelize[_0x5719('0x5')]},'browserVersion':{'type':Sequelize[_0x5719('0x5')]},'osName':{'type':Sequelize[_0x5719('0x5')]},'osVersion':{'type':Sequelize[_0x5719('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x5719('0x5')]},'deviceType':{'type':Sequelize[_0x5719('0x5')]},'referer':{'type':Sequelize[_0x5719('0x4')]},'customerIp':{'type':Sequelize[_0x5719('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x5719('0x6'))},'read1stAt':{'type':Sequelize[_0x5719('0x7')]},'lastMsgAt':{'type':Sequelize[_0x5719('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x5719('0x8')]('in',_0x5719('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5719('0x5')]},'customerPort':{'type':Sequelize[_0x5719('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x5719('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x5719('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5719('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 51d0e69..8de1fe1 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 _0x016d=['ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatMessage','Messages','User','length','%s%d','System','ContactId','agentIdentifier','agentAlias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','keys','hasOwnProperty','order','sort','where','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','nolimit','pick','includeAgent','push','rows','addTags','setTags','ids','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','closedAt','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','index','ChatInteraction','rawAttributes','fieldName','key','findAll','chat','query','show','params','filters','intersection','model','attributes','fields','includeAll','include','find','create','describe','createVidaooSession','findOne'];(function(_0x28fccf,_0x72a99c){var _0x3a1889=function(_0x47cc32){while(--_0x47cc32){_0x28fccf['push'](_0x28fccf['shift']());}};_0x3a1889(++_0x72a99c);}(_0x016d,0x15c));var _0xd016=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x016d[_0x20a584];return _0x4b41a8;};'use strict';var rimraf=require(_0xd016('0x0'));var zipdir=require(_0xd016('0x1'));var rp=require(_0xd016('0x2'));var moment=require(_0xd016('0x3'));var BPromise=require(_0xd016('0x4'));var Mustache=require(_0xd016('0x5'));var util=require(_0xd016('0x6'));var path=require(_0xd016('0x7'));var ejs=require(_0xd016('0x8'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd016('0x9'));var interaction=require(_0xd016('0xa'));var qs=require(_0xd016('0xb'));var pdf=require(_0xd016('0xc'));var logger=require(_0xd016('0xd'))(_0xd016('0xe'));var config=require(_0xd016('0xf'));var db=require(_0xd016('0x10'))['db'];config[_0xd016('0x11')]=_['defaults'](config['redis'],{'host':_0xd016('0x12'),'port':0x18eb});var socket=require(_0xd016('0x13'))(new Redis(config[_0xd016('0x11')]));require('./chatInteraction.socket')[_0xd016('0x14')](socket);var jayson=require(_0xd016('0x15'));var client=jayson['client'][_0xd016('0x16')]({'port':0x232b});var client9004=jayson[_0xd016('0x17')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3ba57c,_0x15220e,_0x4d6682,_0x1782c3){return new BPromise(function(_0x4e8cfe,_0x3539e2){var _0x4505cc=_0x1782c3||client;return _0x4505cc[_0xd016('0x18')](_0x3ba57c,_0x4d6682)[_0xd016('0x19')](function(_0x379ee8){logger[_0xd016('0x1a')](_0xd016('0x1b'),_0x15220e,_0xd016('0x1c'));logger[_0xd016('0x1d')](_0xd016('0x1e'),_0x15220e,_0xd016('0x1c'),JSON[_0xd016('0x1f')](_0x379ee8));if(_0x379ee8[_0xd016('0x20')]){if(_0x379ee8[_0xd016('0x20')][_0xd016('0x21')]===0x1f4){logger[_0xd016('0x20')](_0xd016('0x1b'),_0x15220e,_0x379ee8[_0xd016('0x20')][_0xd016('0x22')]);return _0x3539e2(_0x379ee8['error'][_0xd016('0x22')]);}logger[_0xd016('0x20')](_0xd016('0x1b'),_0x15220e,_0x379ee8[_0xd016('0x20')][_0xd016('0x22')]);return _0x4e8cfe(_0x379ee8['error']['message']);}else{logger['info'](_0xd016('0x1b'),_0x15220e,_0xd016('0x1c'));_0x4e8cfe(_0x379ee8['result'][_0xd016('0x22')]);}})[_0xd016('0x23')](function(_0x192d9e){logger[_0xd016('0x20')](_0xd016('0x1b'),_0x15220e,_0x192d9e);_0x3539e2(_0x192d9e);});});}function respondWithStatusCode(_0x2f3e92,_0x2d5901){_0x2d5901=_0x2d5901||0xcc;return function(_0x3ee7a2){if(_0x3ee7a2){return _0x2f3e92[_0xd016('0x24')](_0x2d5901);}return _0x2f3e92[_0xd016('0x25')](_0x2d5901)[_0xd016('0x26')]();};}function respondWithResult(_0x52d0e,_0x4051b7){_0x4051b7=_0x4051b7||0xc8;return function(_0x45af3d){if(_0x45af3d){return _0x52d0e[_0xd016('0x25')](_0x4051b7)[_0xd016('0x27')](_0x45af3d);}};}function respondWithFilteredResult(_0x83ce98,_0x3a6549){return function(_0x5953a9){if(_0x5953a9){var _0xcfc002=typeof _0x3a6549['offset']==='undefined'&&typeof _0x3a6549[_0xd016('0x28')]===_0xd016('0x29');var _0x27fc96=_0x5953a9[_0xd016('0x2a')];var _0x28280d=_0xcfc002?0x0:_0x3a6549['offset'];var _0x4cbb8b=_0xcfc002?_0x5953a9[_0xd016('0x2a')]:_0x3a6549[_0xd016('0x2b')]+_0x3a6549[_0xd016('0x28')];var _0x49a69c;if(_0x4cbb8b>=_0x27fc96){_0x4cbb8b=_0x27fc96;_0x49a69c=0xc8;}else{_0x49a69c=0xce;}_0x83ce98[_0xd016('0x25')](_0x49a69c);return _0x83ce98[_0xd016('0x2c')]('Content-Range',_0x28280d+'-'+_0x4cbb8b+'/'+_0x27fc96)[_0xd016('0x27')](_0x5953a9);}return null;};}function saveUpdates(_0x8af6af){return function(_0x28e2c3){if(_0x28e2c3){return _0x28e2c3[_0xd016('0x2d')](_0x8af6af)[_0xd016('0x19')](function(_0x2c0fe9){return _0x2c0fe9;});}return null;};}function removeEntity(_0x425509){return function(_0x44cea1){if(_0x44cea1){return _0x44cea1[_0xd016('0x2e')]()['then'](function(){_0x425509[_0xd016('0x25')](0xcc)[_0xd016('0x26')]();});}};}function handleEntityNotFound(_0xe6c200){return function(_0x1f7fcf){if(!_0x1f7fcf){_0xe6c200[_0xd016('0x24')](0x194);}return _0x1f7fcf;};}function handleError(_0x5bbe8a,_0xf43041){_0xf43041=_0xf43041||0x1f4;return function(_0x1cbb5c){logger[_0xd016('0x20')](_0x1cbb5c[_0xd016('0x2f')]);if(_0x1cbb5c[_0xd016('0x30')]){delete _0x1cbb5c[_0xd016('0x30')];}_0x5bbe8a[_0xd016('0x25')](_0xf43041)[_0xd016('0x31')](_0x1cbb5c);};}function getMustacheRender(_0x50cc65,_0x2b5a3d){return Mustache[_0xd016('0x32')](_0x50cc65,_[_0xd016('0x33')](_0x2b5a3d[_0xd016('0x34')],{'contact':_0x2b5a3d[_0xd016('0x35')],'message':_0x2b5a3d['message'],'agent':_0x2b5a3d[_0xd016('0x36')],'interaction':_0x2b5a3d[_0xd016('0x37')],'account':_0x2b5a3d['account']}))||'';}exports[_0xd016('0x38')]=function(_0x923d2d,_0x19f25c){var _0x1bc210={};var _0x30c3fc=_['map'](db[_0xd016('0x39')][_0xd016('0x3a')],function(_0x42e9c5){return{'name':_0x42e9c5[_0xd016('0x3b')],'type':_0x42e9c5['type'][_0xd016('0x3c')]};});_0x1bc210=qs['getOptions'](_0x30c3fc,_0x923d2d);return interaction[_0xd016('0x3d')](_0xd016('0x3e'),_0x923d2d[_0xd016('0x3f')],_0x923d2d['user'],_0x1bc210,_0x30c3fc)['then'](respondWithFilteredResult(_0x19f25c,_0x1bc210))['catch'](handleError(_0x19f25c,null));};exports[_0xd016('0x40')]=function(_0x4de15c,_0x281496){var _0x37bcc8={'raw':![],'where':{'id':_0x4de15c[_0xd016('0x41')]['id']}},_0x3098c0={};_0x3098c0['model']=_['keys'](db[_0xd016('0x39')][_0xd016('0x3a')]);_0x3098c0['query']=_['keys'](_0x4de15c[_0xd016('0x3f')]);_0x3098c0[_0xd016('0x42')]=_[_0xd016('0x43')](_0x3098c0[_0xd016('0x44')],_0x3098c0[_0xd016('0x3f')]);_0x37bcc8[_0xd016('0x45')]=_[_0xd016('0x43')](_0x3098c0[_0xd016('0x44')],qs[_0xd016('0x46')](_0x4de15c[_0xd016('0x3f')][_0xd016('0x46')]));_0x37bcc8[_0xd016('0x45')]=_0x37bcc8[_0xd016('0x45')]['length']?_0x37bcc8[_0xd016('0x45')]:_0x3098c0[_0xd016('0x44')];if(_0x4de15c['query'][_0xd016('0x47')]){_0x37bcc8[_0xd016('0x48')]=[{'all':!![]}];}_0x37bcc8=_['merge']({},_0x37bcc8,_0x4de15c['options']);return db[_0xd016('0x39')][_0xd016('0x49')](_0x37bcc8)[_0xd016('0x19')](handleEntityNotFound(_0x281496,null))[_0xd016('0x19')](respondWithResult(_0x281496,null))[_0xd016('0x23')](handleError(_0x281496,null));};exports[_0xd016('0x4a')]=function(_0x1a8cce,_0x4f57fd){return db['ChatInteraction'][_0xd016('0x4a')](_0x1a8cce[_0xd016('0x34')],{})[_0xd016('0x19')](respondWithResult(_0x4f57fd,0xc9))[_0xd016('0x23')](handleError(_0x4f57fd,null));};exports[_0xd016('0x2d')]=function(_0xe4de6a,_0x51949f){if(_0xe4de6a[_0xd016('0x34')]['id']){delete _0xe4de6a['body']['id'];}return db[_0xd016('0x39')][_0xd016('0x49')]({'where':{'id':_0xe4de6a[_0xd016('0x41')]['id']}})['then'](handleEntityNotFound(_0x51949f,null))['then'](saveUpdates(_0xe4de6a['body'],null))[_0xd016('0x19')](respondWithResult(_0x51949f,null))[_0xd016('0x23')](handleError(_0x51949f,null));};exports[_0xd016('0x2e')]=function(_0x4923b2,_0x41c47b){return db[_0xd016('0x39')][_0xd016('0x49')]({'where':{'id':_0x4923b2['params']['id']}})[_0xd016('0x19')](handleEntityNotFound(_0x41c47b,null))[_0xd016('0x19')](removeEntity(_0x41c47b,null))[_0xd016('0x23')](handleError(_0x41c47b,null));};exports[_0xd016('0x4b')]=function(_0x427dca,_0x47b4ad){return db[_0xd016('0x39')][_0xd016('0x4b')]()['then'](respondWithResult(_0x47b4ad,null))[_0xd016('0x23')](handleError(_0x47b4ad,null));};exports[_0xd016('0x4c')]=function(_0x3d06f9,_0x36a903){var _0x2ade32=_0x3d06f9['params']['id'];var _0x5d2729;var _0x5689e2;var _0x11524e;return db[_0xd016('0x39')][_0xd016('0x4d')]({'where':{'id':_0x2ade32}})['then'](function(_0x446bdd){_0x5d2729=_0x446bdd;return db[_0xd016('0x4e')][_0xd016('0x4d')]({'where':{'id':_0x446bdd[_0xd016('0x4f')]},'attributes':['id',_0xd016('0x50'),_0xd016('0x51'),_0xd016('0x52'),_0xd016('0x53'),_0xd016('0x54')],'raw':!![]});})[_0xd016('0x19')](function(_0x310c34){if(_0x310c34&&_0x310c34['vidaooApiKey']&&_0x310c34[_0xd016('0x51')]){_0x5689e2=_0x310c34;var _0x43ef97={'interaction':{'id':_0x2ade32},'agent':{'id':_0x3d06f9['user']['id'],'name':_0x3d06f9[_0xd016('0x55')][_0xd016('0x30')],'fullname':_0x3d06f9[_0xd016('0x55')][_0xd016('0x56')],'email':_0x3d06f9[_0xd016('0x55')][_0xd016('0x57')]},'contact':_0x3d06f9[_0xd016('0x34')][_0xd016('0x35')],'account':_0x3d06f9[_0xd016('0x34')][_0xd016('0x58')]};var _0x305f21={'rejectUnauthorized':![],'method':_0xd016('0x59'),'url':_0xd016('0x5a'),'headers':{'X-APIKEY':_0x310c34[_0xd016('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3d06f9['user'][_0xd016('0x57')]],'buttons':null,'topic':_0x5689e2[_0xd016('0x52')],'note':_[_0xd016('0x5b')](_0x5689e2['vidaooNote'])?null:getMustacheRender(_0x5689e2[_0xd016('0x53')],_0x43ef97),'metadata':null},'redirect':_0xd016('0x5c'),'json':!![]};try{if(!_['isNull'](_0x5689e2['vidaooMetadata'])){var _0x293407=getMustacheRender(_0x5689e2['vidaooMetadata'],_0x43ef97);var _0x211d57=JSON[_0xd016('0x5d')](_0x293407);_0x305f21[_0xd016('0x34')][_0xd016('0x5e')]=_0x211d57;}}catch(_0x43944a){throw new db[(_0xd016('0x5f'))]['ValidationError'](_0xd016('0x60'));}return rp(_0x305f21);}else{throw new db[(_0xd016('0x5f'))][(_0xd016('0x61'))](_0xd016('0x62'));}})['then'](function(_0x7a24b6){_0x11524e=_0x7a24b6;if(_0x11524e['id']){var _0x383f19={'body':_0x11524e[_0xd016('0x63')],'ChatWebsiteId':_0x5689e2['id'],'ChatInteractionId':_0x5d2729['id'],'direction':_0xd016('0x64'),'UserId':_0x3d06f9['user']['id']};return db['ChatMessage'][_0xd016('0x4a')](_0x383f19,{});}else{throw new db['Sequelize'][(_0xd016('0x61'))](_0xd016('0x65'));}})['then'](function(){return _0x5d2729[_0xd016('0x66')]({'vidaooSessionId':_0x11524e['id']});})[_0xd016('0x19')](respondWithResult(_0x36a903,null))[_0xd016('0x23')](handleError(_0x36a903,null));};exports[_0xd016('0x67')]=function(_0x501916,_0x5a2499){if(_0x501916['body']['id']){delete _0x501916[_0xd016('0x34')]['id'];}return db['ChatInteraction'][_0xd016('0x49')]({'where':{'id':_0x501916['params']['id']},'include':[{'model':db['CmContact'],'as':_0xd016('0x68')}]})['then'](handleEntityNotFound(_0x5a2499,null))[_0xd016('0x19')](saveUpdates(_0x501916['body'],null))['then'](respondWithResult(_0x5a2499,null))[_0xd016('0x23')](handleError(_0x5a2499,null));};exports['abandon']=function(_0xe6affc,_0x3b9a5f){if(_0xe6affc[_0xd016('0x34')]['id']){delete _0xe6affc[_0xd016('0x34')]['id'];}return db[_0xd016('0x39')]['find']({'where':{'id':_0xe6affc['params']['id']}})[_0xd016('0x19')](function(_0xffe302){if(!_0xffe302){logger[_0xd016('0x20')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xd016('0x69'),0x194,_0xd016('0x6a'));_0x3b9a5f[_0xd016('0x24')](0x194);}else{if(_0xffe302[_0xd016('0x6b')]){throw new db[(_0xd016('0x5f'))][(_0xd016('0x61'))](_0xd016('0x6c'));}}return _0xffe302;})[_0xd016('0x19')](function(_0x10a90a){if(_0x10a90a){return _0x10a90a[_0xd016('0x2d')]({'closed':_0xe6affc[_0xd016('0x34')][_0xd016('0x6d')],'disposition':_0xe6affc[_0xd016('0x34')][_0xd016('0x6e')]})[_0xd016('0x19')](function(_0x51f13a){return _0x51f13a;});}})[_0xd016('0x19')](function(){return respondWithRpcPromise(_0xd016('0x6f'),_0xd016('0x69'),_0xe6affc[_0xd016('0x34')],client9004);})['then'](respondWithResult(_0x3b9a5f,null))[_0xd016('0x23')](handleError(_0x3b9a5f,null));};exports[_0xd016('0x70')]=function(_0x1b194d,_0x40056b){_0x1b194d[_0xd016('0x34')]['name']=_0x1b194d['file'][_0xd016('0x71')];_0x1b194d['body'][_0xd016('0x72')]=_0x1b194d[_0xd016('0x73')][_0xd016('0x74')];_0x1b194d['body']['type']=_0x1b194d[_0xd016('0x73')][_0xd016('0x75')];return db[_0xd016('0x76')][_0xd016('0x4a')](_0x1b194d[_0xd016('0x34')])['then'](respondWithResult(_0x40056b,0xc9))[_0xd016('0x23')](handleError(_0x40056b,null));};exports['attachmentDownload']=function(_0x439949,_0x2538f3){return db[_0xd016('0x39')][_0xd016('0x4d')]({'where':{'id':_0x439949[_0xd016('0x41')]['id']},'raw':!![]})[_0xd016('0x19')](handleEntityNotFound(_0x2538f3,null))[_0xd016('0x19')](function(_0x302914){if(_0x302914){if(_0x302914[_0xd016('0x6d')]){return _0x2538f3[_0xd016('0x25')](0x193)[_0xd016('0x27')]({'status':0x193,'message':_0xd016('0x77')});}return db[_0xd016('0x76')][_0xd016('0x4d')]({'where':{'id':_0x439949['query'][_0xd016('0x78')]},'raw':!![]})[_0xd016('0x19')](handleEntityNotFound(_0x2538f3,null));}})[_0xd016('0x19')](function(_0x2edcfb){if(_0x2edcfb){var _0x48f3cf=_0x2edcfb[_0xd016('0x79')]!==null;var _0x2e0cc9=path[_0xd016('0x7a')](config[_0xd016('0x7b')],_0xd016('0x7c'));if(_0x48f3cf){_0x2e0cc9=path[_0xd016('0x7a')](_0x2e0cc9,_0xd016('0x7d'));}var _0x53a56f=path[_0xd016('0x7a')](_0x2e0cc9,_0x2edcfb[_0xd016('0x72')]);return _0x2538f3[_0xd016('0x7e')](_0x53a56f);}})[_0xd016('0x23')](handleError(_0x2538f3,null));};exports['close']=function(_0x5afb85,_0x3082e9){var _0x3f4131=null;var _0x543e75=null;var _0x4469d1=null;if(_0x5afb85[_0xd016('0x34')]['id']){delete _0x5afb85[_0xd016('0x34')]['id'];}if(_0x5afb85[_0xd016('0x34')][_0xd016('0x7f')]){_0x4469d1=path[_0xd016('0x7a')](config['root'],_0xd016('0x80'),util[_0xd016('0x81')]('transcript-%s.txt',Date[_0xd016('0x82')]()));_0x5afb85[_0xd016('0x34')][_0xd016('0x83')]=_0x4469d1;}return db[_0xd016('0x39')][_0xd016('0x49')]({'where':{'id':_0x5afb85[_0xd016('0x41')]['id']},'include':[{'model':db[_0xd016('0x84')],'as':_0xd016('0x85'),'include':[{'model':db[_0xd016('0x86')],'as':'User'}]}]})[_0xd016('0x19')](handleEntityNotFound(_0x3082e9,null))[_0xd016('0x19')](saveUpdates(_0x5afb85[_0xd016('0x34')],null))[_0xd016('0x19')](function(_0x2e12fd){if(_0x2e12fd){_0x3f4131=_0x2e12fd;return db[_0xd016('0x4e')][_0xd016('0x49')]({'where':{'id':_0x3f4131[_0xd016('0x4f')]}});}})[_0xd016('0x19')](function(_0x3670a0){if(_0x3670a0){_0x543e75=_0x3670a0;return db['CmContact'][_0xd016('0x49')]({'where':{'id':_0x3f4131['ContactId']}});}})['then'](function(_0x40284c){if(_0x40284c){if(_0x4469d1){var _0x1cf0f7=null;for(var _0x1f6351=0x1;_0x1f6351<_0x3f4131[_0xd016('0x85')][_0xd016('0x87')];++_0x1f6351){_0x1cf0f7=_0x3f4131['Messages'][_0x1f6351];var _0x91f191=_0x1cf0f7[_0xd016('0x6b')]?util['format'](_0xd016('0x88'),_0x543e75['agentAlias'],_0x1cf0f7[_0xd016('0x6b')]):_0xd016('0x89');var _0x32269a=_0x5afb85['body']['customer']||util['format'](_0xd016('0x88'),'Visitor',_0x1cf0f7[_0xd016('0x8a')]);switch(_0x543e75[_0xd016('0x8b')]){case'website_alias':_0x91f191=_0x1cf0f7['UserId']?util[_0xd016('0x81')](_0xd016('0x88'),_0x543e75[_0xd016('0x8c')],_0x1cf0f7[_0xd016('0x6b')]):_0xd016('0x89');break;case'agent_alias':_0x91f191=_0x1cf0f7[_0xd016('0x6b')]?_0x1cf0f7[_0xd016('0x86')][_0xd016('0x8d')]||_0x1cf0f7[_0xd016('0x86')][_0xd016('0x56')]:'System';break;case _0xd016('0x8e'):_0x91f191=_0x1cf0f7[_0xd016('0x6b')]?_0x1cf0f7[_0xd016('0x86')][_0xd016('0x56')]:_0xd016('0x89');break;default:_0x91f191=_0x1cf0f7['UserId']?util[_0xd016('0x81')](_0xd016('0x88'),_0x543e75['agentAlias'],_0x1cf0f7[_0xd016('0x6b')]):_0xd016('0x89');}var _0x29d762=util[_0xd016('0x81')](_0xd016('0x8f'),moment(_0x1cf0f7[_0xd016('0x90')])['format'](_0xd016('0x91')),_0x1cf0f7[_0xd016('0x92')]==='in'?_0x32269a:_0x91f191,_0x1cf0f7[_0xd016('0x34')]);if(!_0x1cf0f7[_0xd016('0x93')]){fs['appendFileSync'](_0x4469d1,_0x29d762);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd016('0x94'),'raw':!![],'include':[{'model':db[_0xd016('0x95')],'as':_0xd016('0x95'),'raw':!![]}]}]});}}})[_0xd016('0x19')](function(_0x2aa679){if(!_0x2aa679||!_0x2aa679[_0xd016('0x94')]||!_0x5afb85[_0xd016('0x34')])return _0x3f4131;var _0x53fa9e=_0x2aa679[_0xd016('0x96')]();return respondWithRpcPromise(_0xd016('0x97'),_0xd016('0x98'),{'account':_0x53fa9e,'message':{'from':util[_0xd016('0x81')](_0xd016('0x99'),_0x2aa679[_0xd016('0x30')],_0x2aa679[_0xd016('0x57')]||_0x2aa679[_0xd016('0x94')][_0xd016('0x55')]),'to':_0x5afb85[_0xd016('0x34')][_0xd016('0x7f')],'subject':_0xd016('0x9a'),'text':util[_0xd016('0x81')](_0xd016('0x9b'),_0x5afb85['body']['mailTranscript']),'attachments':[{'path':_0x4469d1}]}})[_0xd016('0x19')](function(){return _0x3f4131;})['catch'](function(_0x2f2e02){logger[_0xd016('0x20')](_0x2f2e02);});})[_0xd016('0x19')](respondWithStatusCode(_0x3082e9,0xc8))[_0xd016('0x23')](handleError(_0x3082e9,null));};exports[_0xd016('0x9c')]=function(_0x31769c,_0x356a73){return db[_0xd016('0x84')][_0xd016('0x49')]({'where':{'id':_0x31769c[_0xd016('0x41')]['id']}})['then'](handleEntityNotFound(_0x356a73,null))[_0xd016('0x19')](function(_0x4edf0e){if(_0x4edf0e){return _0x4edf0e[_0xd016('0x9c')](_0x31769c['body']['ids'],_[_0xd016('0x9d')](_0x31769c[_0xd016('0x34')],['ids','id'])||{});}})[_0xd016('0x19')](respondWithResult(_0x356a73,null))[_0xd016('0x23')](handleError(_0x356a73,null));};exports[_0xd016('0x9e')]=function(_0x2cc602,_0x42afed){var _0x219084={'raw':![],'where':{}};var _0x1529de={};var _0x3ccf84={'count':0x0,'rows':[]};return db[_0xd016('0x39')][_0xd016('0x4d')]({'where':{'id':_0x2cc602['params']['id']}})[_0xd016('0x19')](handleEntityNotFound(_0x42afed,null))[_0xd016('0x19')](function(_0x575f8e){if(_0x575f8e){_0x1529de['model']=_['keys'](db['ChatMessage'][_0xd016('0x3a')]);_0x1529de['query']=_[_0xd016('0x9f')](_0x2cc602['query']);_0x1529de[_0xd016('0x42')]=_[_0xd016('0x43')](_0x1529de[_0xd016('0x44')],_0x1529de['query']);_0x219084[_0xd016('0x45')]=_[_0xd016('0x43')](_0x1529de[_0xd016('0x44')],qs[_0xd016('0x46')](_0x2cc602[_0xd016('0x3f')][_0xd016('0x46')]));_0x219084['attributes']=_0x219084[_0xd016('0x45')]['length']?_0x219084[_0xd016('0x45')]:_0x1529de[_0xd016('0x44')];if(!_0x2cc602[_0xd016('0x3f')][_0xd016('0xa0')]('nolimit')){_0x219084['limit']=qs['limit'](_0x2cc602[_0xd016('0x3f')][_0xd016('0x28')]);_0x219084[_0xd016('0x2b')]=qs[_0xd016('0x2b')](_0x2cc602[_0xd016('0x3f')][_0xd016('0x2b')]);}_0x219084[_0xd016('0xa1')]=qs[_0xd016('0xa2')](_0x2cc602[_0xd016('0x3f')]['sort']);_0x219084[_0xd016('0xa3')]=qs['filters'](_['pick'](_0x2cc602[_0xd016('0x3f')],_0x1529de[_0xd016('0x42')]));_0x219084[_0xd016('0xa3')][_0xd016('0xa4')]=_0x575f8e['id'];if(_0x2cc602[_0xd016('0x3f')][_0xd016('0xa5')]){_0x219084[_0xd016('0xa3')]=_[_0xd016('0x33')](_0x219084[_0xd016('0xa3')],{'$or':_[_0xd016('0xa6')](_0x219084[_0xd016('0x45')],function(_0x34e4c9){var _0x2a8a4a={};_0x2a8a4a[_0x34e4c9]={'$like':'%'+_0x2cc602['query']['filter']+'%'};return _0x2a8a4a;})});}if(_0x2cc602[_0xd016('0x3f')][_0xd016('0xa7')]){var _0x3e1029=_0x2cc602['query'][_0xd016('0xa7')][_0xd016('0xa8')](',');var _0x370941={};_0x370941[_0x3e1029[0x0]]={'$gte':moment(_0x3e1029[0x1])['format'](_0xd016('0xa9'))};_0x219084[_0xd016('0xa3')]=_[_0xd016('0x33')](_0x219084['where'],_0x370941);}_0x219084=_['merge']({},_0x219084,_0x2cc602[_0xd016('0xaa')]);return db['ChatMessage'][_0xd016('0x2a')]({'where':_0x219084[_0xd016('0xa3')]})[_0xd016('0x19')](function(_0x3bbcbb){_0x3ccf84[_0xd016('0x2a')]=_0x3bbcbb;if(_0x2cc602['query'][_0xd016('0x47')]){_0x219084['include']=[{'all':!![]}];}return db[_0xd016('0x84')][_0xd016('0x3d')](_0x219084);})[_0xd016('0x19')](function(_0x158045){_0x3ccf84['rows']=_0x158045;return _0x3ccf84;});}})[_0xd016('0x19')](respondWithFilteredResult(_0x42afed,_0x219084))[_0xd016('0x23')](handleError(_0x42afed,null));};exports['getMyMessages']=function(_0x886201,_0x11e002){var _0x4a4966={'where':{}},_0x3c1353={},_0x19e32e={'count':0x0,'rows':[]};return db[_0xd016('0x39')][_0xd016('0x4d')]({'where':{'id':_0x886201[_0xd016('0x41')]['id']}})['then'](handleEntityNotFound(_0x11e002,null))['then'](function(_0x5aab1f){if(_0x5aab1f){_0x3c1353['model']=_['keys'](db['ChatMessage'][_0xd016('0x3a')]);_0x3c1353[_0xd016('0x3f')]=_[_0xd016('0x9f')](_0x886201[_0xd016('0x3f')]);_0x3c1353[_0xd016('0x42')]=_[_0xd016('0x43')](_0x3c1353[_0xd016('0x44')],_0x3c1353[_0xd016('0x3f')]);_0x4a4966[_0xd016('0x45')]=_[_0xd016('0x43')](_0x3c1353[_0xd016('0x44')],qs['fields'](_0x886201[_0xd016('0x3f')][_0xd016('0x46')]));_0x4a4966[_0xd016('0x45')]=_0x4a4966[_0xd016('0x45')][_0xd016('0x87')]?_0x4a4966[_0xd016('0x45')]:_0x3c1353['model'];if(!_0x886201[_0xd016('0x3f')][_0xd016('0xa0')](_0xd016('0xab'))){_0x4a4966['limit']=qs[_0xd016('0x28')](_0x886201[_0xd016('0x3f')][_0xd016('0x28')]);_0x4a4966['offset']=qs['offset'](_0x886201[_0xd016('0x3f')][_0xd016('0x2b')]);}_0x4a4966[_0xd016('0xa1')]=qs[_0xd016('0xa2')](_0x886201[_0xd016('0x3f')][_0xd016('0xa2')]);_0x4a4966['where']=qs[_0xd016('0x42')](_[_0xd016('0xac')](_0x886201['query'],_0x3c1353[_0xd016('0x42')]));_0x4a4966['where']['ChatInteractionId']=_0x5aab1f['id'];if(_0x886201[_0xd016('0x3f')]['filter']){_0x4a4966[_0xd016('0xa3')]=_[_0xd016('0x33')](_0x4a4966[_0xd016('0xa3')],{'$or':_['map'](_0x4a4966['attributes'],function(_0x2426be){var _0x54fa77={};_0x54fa77[_0x2426be]={'$like':'%'+_0x886201[_0xd016('0x3f')]['filter']+'%'};return _0x54fa77;})});}_0x4a4966['where']['secret']=![];if(_0x886201[_0xd016('0x3f')]['id']){_0x4a4966[_0xd016('0xa3')]['id']={'$gt':_0x886201[_0xd016('0x3f')]['id']};}_0x4a4966=_[_0xd016('0x33')]({},_0x4a4966,_0x886201['options']);return db[_0xd016('0x84')][_0xd016('0x2a')]({'where':_0x4a4966[_0xd016('0xa3')]})['then'](function(_0x333eb6){_0x19e32e['count']=_0x333eb6;_0x4a4966['include']=[];if(_0x886201['query'][_0xd016('0xad')]){_0x4a4966['include'][_0xd016('0xae')]({'model':db[_0xd016('0x86')],'as':_0xd016('0x86'),'attributes':['id',_0xd016('0x56'),_0xd016('0x8d')]});}if(_0x886201[_0xd016('0x3f')][_0xd016('0x47')]){_0x4a4966[_0xd016('0x48')]=[{'all':!![]}];}return db[_0xd016('0x84')]['findAll'](_0x4a4966);})[_0xd016('0x19')](function(_0x2cc157){_0x19e32e[_0xd016('0xaf')]=_0x2cc157;return _0x19e32e;});}})[_0xd016('0x19')](respondWithFilteredResult(_0x11e002,_0x4a4966))[_0xd016('0x23')](handleError(_0x11e002,null));};exports[_0xd016('0xb0')]=function(_0x48035f,_0x43bb41){return db[_0xd016('0x39')][_0xd016('0x49')]({'where':{'id':_0x48035f[_0xd016('0x41')]['id']}})['then'](handleEntityNotFound(_0x43bb41,null))[_0xd016('0x19')](function(_0x210108){if(_0x210108){return _0x210108[_0xd016('0xb1')](_0x48035f[_0xd016('0x34')][_0xd016('0xb2')],_[_0xd016('0x9d')](_0x48035f[_0xd016('0x34')],[_0xd016('0xb2'),'id'])||{})['spread'](function(){return db['Tag'][_0xd016('0x3d')]({'attributes':['id','name','color'],'where':{'id':_0x48035f['body']['ids']}});})['then'](function(_0x277324){socket['emit'](_0xd016('0xb3'),{'id':Number(_0x48035f[_0xd016('0x41')]['id']),'tags':_0x277324||[]});return{'id':Number(_0x48035f[_0xd016('0x41')]['id']),'tags':_0x277324||[]};});}})['then'](respondWithResult(_0x43bb41,null))[_0xd016('0x23')](handleError(_0x43bb41,null));};exports[_0xd016('0xb4')]=function(_0x2f89d5,_0x268208){return db[_0xd016('0x39')][_0xd016('0x49')]({'where':{'id':_0x2f89d5['params']['id']}})['then'](handleEntityNotFound(_0x268208,null))[_0xd016('0x19')](function(_0x3d98c4){if(_0x3d98c4){return _0x3d98c4[_0xd016('0xb4')](_0x2f89d5[_0xd016('0x3f')][_0xd016('0xb2')]);}})[_0xd016('0x19')](respondWithStatusCode(_0x268208,null))[_0xd016('0x23')](handleError(_0x268208,null));};exports['download']=function(_0x2b93a8,_0x51f259){var _0x23b17d=moment()[_0xd016('0xb5')]()[_0xd016('0xb6')]();var _0x4d9c15=path['join'](config['root'],_0xd016('0xb7'),_0xd016('0xb8'),_0xd016('0xb9'));var _0x552197=path[_0xd016('0x7a')](config[_0xd016('0x7b')],_0xd016('0xb7'),'files',_0xd016('0xba'));var _0x249b94=path[_0xd016('0x7a')](_0x4d9c15,_0x23b17d);var _0x4ce0a5=util[_0xd016('0x81')](_0xd016('0xbb'),_0x2b93a8[_0xd016('0x41')]['id'],_0x23b17d);var _0x103dc0=path['join'](_0x4d9c15,_0x4ce0a5);var _0x2653f9=[];_0x2653f9[_0xd016('0xae')]({'model':db[_0xd016('0x86')],'as':_0xd016('0x86'),'attributes':['id',_0xd016('0x56')],'raw':!![]});_0x2653f9[_0xd016('0xae')]({'model':db[_0xd016('0xbc')],'as':'Contact','attributes':['id',_0xd016('0xbd'),_0xd016('0xbe')],'raw':!![]});if(_0x2b93a8['query'][_0xd016('0xba')]){_0x2653f9[_0xd016('0xae')]({'model':db[_0xd016('0x76')],'as':_0xd016('0x76'),'raw':!![]});}var _0x453cb9=[{'model':db[_0xd016('0x84')],'as':_0xd016('0x85'),'attributes':['id',_0xd016('0x34'),_0xd016('0x90'),_0xd016('0x92'),'secret',_0xd016('0xbf')],'include':_0x2653f9}];_0x453cb9['push']({'model':db[_0xd016('0x4e')],'as':_0xd016('0xc0'),'attributes':['id','name']});_0x453cb9['push']({'model':db[_0xd016('0x86')],'as':_0xd016('0xc1'),'attributes':['id',_0xd016('0x56')]});return db[_0xd016('0x39')][_0xd016('0x49')]({'where':{'id':_0x2b93a8[_0xd016('0x41')]['id']},'include':_0x453cb9})[_0xd016('0x19')](handleEntityNotFound(_0x51f259,null))[_0xd016('0x19')](function(_0x230231){if(_0x230231){var _0x486641=_0x230231[_0xd016('0xc2')]({'plain':!![]});fs[_0xd016('0xc3')](_0x249b94);var _0x450a37={'channel':_0xd016('0xc4'),'account':_0x486641[_0xd016('0xc0')]['name'],'agent':_0x486641['Owner']?_0x486641[_0xd016('0xc1')][_0xd016('0x56')]:'N.A.','createdAt':moment(_0x486641[_0xd016('0x90')])[_0xd016('0x81')](_0xd016('0xa9'))[_0xd016('0xb6')](),'closedAt':_0x486641[_0xd016('0x6d')]?moment(_0x486641[_0xd016('0xc5')])[_0xd016('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd016('0xb6')]():'','disposition':_0x486641[_0xd016('0x6e')],'chatInfo':{'browser':_0x486641['browserName'],'os':_0x486641[_0xd016('0xc6')],'referer':_0x486641[_0xd016('0xc7')],'customerIp':_0x486641[_0xd016('0xc8')],'customerPort':_0x486641['customerPort']?_0x486641[_0xd016('0xc9')]:_0xd016('0xca')},'messages':_(_0x486641['Messages'])[_0xd016('0xcb')]()[_0xd016('0xa5')]({'secret':![]})[_0xd016('0xa6')](function(_0x1c5af3){if(_0x1c5af3['Attachment']){var _0x34c8a8=path[_0xd016('0x7a')](_0x552197,_0x1c5af3[_0xd016('0x76')][_0xd016('0x72')]);if(fs[_0xd016('0xcc')](_0x34c8a8)){fs[_0xd016('0xcd')](_0x34c8a8)['pipe'](fs['createWriteStream'](path[_0xd016('0x7a')](_0x249b94,_0x1c5af3['Attachment'][_0xd016('0x72')])));}}return{'date':moment(_0x1c5af3[_0xd016('0x90')])[_0xd016('0x81')](_0xd016('0xa9'))[_0xd016('0xb6')](),'sender':_0x1c5af3[_0xd016('0x92')]===_0xd016('0x64')?_0x1c5af3[_0xd016('0x86')]?_0x1c5af3['User'][_0xd016('0x56')]:_0xd016('0x89'):_0x1c5af3[_0xd016('0x68')][_0xd016('0xbd')]+(_0x1c5af3[_0xd016('0x68')]['lastName']?'\x20'+_0x1c5af3[_0xd016('0x68')][_0xd016('0xbe')]:''),'body':_0x1c5af3['Attachment']?_0x1c5af3[_0xd016('0x76')][_0xd016('0x72')]:_0x1c5af3[_0xd016('0x34')],'direction':_0x1c5af3[_0xd016('0x92')]===_0xd016('0x64')?'A':'C','secret':_0x1c5af3[_0xd016('0x93')],'read':_0x1c5af3[_0xd016('0xbf')],'attachment':_0x1c5af3[_0xd016('0x76')]};})[_0xd016('0xce')]()};return ejs[_0xd016('0xcf')](path['join'](config[_0xd016('0x7b')],_0xd016('0xb7'),_0xd016('0xd0'),'downloadInteraction.ejs'),{'interaction':_0x450a37})[_0xd016('0x19')](function(_0x2ade34){var _0x187540=path[_0xd016('0x7a')](_0x249b94,_0xd016('0xd1')+_0x486641['id']+'-'+_0x23b17d+_0xd016('0xd2'));var _0x4f5366={'path':_0x187540,'channel':'Chat','interactionId':_0x486641['id']};return pdf[_0xd016('0xd3')](_0x2ade34,_0x4f5366);})[_0xd016('0x19')](function(){return new Promise(function(_0x305b77,_0x4a1809){zipdir(_0x249b94,{'saveTo':_0x103dc0},function(_0x6d77d2,_0x4726b8){if(_0x6d77d2)return _0x4a1809(_0x6d77d2);return _0x305b77(_0x4726b8);});})[_0xd016('0x19')](function(){return new BPromise(function(_0x1772f0,_0x588119){rimraf(_0x249b94,function(_0x504741){if(_0x504741)_0x588119(_0x504741);return _0x1772f0();});});})[_0xd016('0x19')](function(){return _0x51f259[_0xd016('0x7e')](_0x103dc0,_0x4ce0a5,function(_0x2c5b7c){if(_0x2c5b7c){logger['error'](_0xd016('0xd4'),_0x2c5b7c);}else{fs['unlinkSync'](_0x103dc0);}});});});}else{return _0x51f259[_0xd016('0x24')](0xc8);}})[_0xd016('0x23')](handleError(_0x51f259,null));}; \ No newline at end of file +var _0xc44e=['alias','includeAll','addTags','setTags','omit','spread','Tag','color','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','mkdirSync','N.A.','toString','closedAt','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','read','value','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','render','body','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','type','chat','user','show','params','model','rawAttributes','keys','query','intersection','attributes','fields','merge','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','email','POST','isNull','vidaooNote','follow','vidaooMetadata','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','attachmentDownload','json','Unauthorized','Attachment','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','ContactId','length','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','CloudProvider','getSmtpOptions','SendMail','sendMail','Smtp','Mail\x20Transcript','addMessage','ids','getMessages','filters','hasOwnProperty','nolimit','offset','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','order','secret','options','includeAgent','push'];(function(_0x53fa0c,_0x2cb21d){var _0x361347=function(_0x5020bd){while(--_0x5020bd){_0x53fa0c['push'](_0x53fa0c['shift']());}};_0x361347(++_0x2cb21d);}(_0xc44e,0xff));var _0xec44=function(_0x5bcd0a,_0x2a552d){_0x5bcd0a=_0x5bcd0a-0x0;var _0x5293a6=_0xc44e[_0x5bcd0a];return _0x5293a6;};'use strict';var rimraf=require(_0xec44('0x0'));var zipdir=require('zip-dir');var rp=require(_0xec44('0x1'));var moment=require(_0xec44('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xec44('0x3'));var util=require(_0xec44('0x4'));var path=require(_0xec44('0x5'));var ejs=require(_0xec44('0x6'));var fs=require('fs');var _=require(_0xec44('0x7'));var Redis=require(_0xec44('0x8'));var interaction=require(_0xec44('0x9'));var qs=require(_0xec44('0xa'));var pdf=require(_0xec44('0xb'));var logger=require(_0xec44('0xc'))(_0xec44('0xd'));var config=require(_0xec44('0xe'));var db=require(_0xec44('0xf'))['db'];config['redis']=_[_0xec44('0x10')](config[_0xec44('0x11')],{'host':_0xec44('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec44('0x11')]));require(_0xec44('0x13'))[_0xec44('0x14')](socket);var jayson=require(_0xec44('0x15'));var client=jayson[_0xec44('0x16')][_0xec44('0x17')]({'port':0x232b});var client9004=jayson[_0xec44('0x16')][_0xec44('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x34858f,_0x20b142,_0x405565,_0x3ddca2){return new BPromise(function(_0x34afab,_0x2d05e3){var _0x16825c=_0x3ddca2||client;return _0x16825c[_0xec44('0x18')](_0x34858f,_0x405565)[_0xec44('0x19')](function(_0x85266d){logger['info'](_0xec44('0x1a'),_0x20b142,_0xec44('0x1b'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x20b142,_0xec44('0x1b'),JSON[_0xec44('0x1c')](_0x85266d));if(_0x85266d['error']){if(_0x85266d[_0xec44('0x1d')]['code']===0x1f4){logger[_0xec44('0x1d')](_0xec44('0x1a'),_0x20b142,_0x85266d[_0xec44('0x1d')][_0xec44('0x1e')]);return _0x2d05e3(_0x85266d[_0xec44('0x1d')][_0xec44('0x1e')]);}logger[_0xec44('0x1d')](_0xec44('0x1a'),_0x20b142,_0x85266d[_0xec44('0x1d')][_0xec44('0x1e')]);return _0x34afab(_0x85266d['error'][_0xec44('0x1e')]);}else{logger[_0xec44('0x1f')](_0xec44('0x1a'),_0x20b142,_0xec44('0x1b'));_0x34afab(_0x85266d[_0xec44('0x20')][_0xec44('0x1e')]);}})[_0xec44('0x21')](function(_0x40f599){logger[_0xec44('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x20b142,_0x40f599);_0x2d05e3(_0x40f599);});});}function respondWithStatusCode(_0x1069ce,_0x351607){_0x351607=_0x351607||0xcc;return function(_0x20c979){if(_0x20c979){return _0x1069ce[_0xec44('0x22')](_0x351607);}return _0x1069ce[_0xec44('0x23')](_0x351607)[_0xec44('0x24')]();};}function respondWithResult(_0x5b7f8b,_0x4b140d){_0x4b140d=_0x4b140d||0xc8;return function(_0x1e8535){if(_0x1e8535){return _0x5b7f8b[_0xec44('0x23')](_0x4b140d)['json'](_0x1e8535);}};}function respondWithFilteredResult(_0x476d32,_0x33922a){return function(_0x3a2c1c){if(_0x3a2c1c){var _0xd095c6=typeof _0x33922a['offset']===_0xec44('0x25')&&typeof _0x33922a['limit']===_0xec44('0x25');var _0x245a20=_0x3a2c1c[_0xec44('0x26')];var _0x4bfb7a=_0xd095c6?0x0:_0x33922a['offset'];var _0x270afc=_0xd095c6?_0x3a2c1c[_0xec44('0x26')]:_0x33922a['offset']+_0x33922a[_0xec44('0x27')];var _0xf6849a;if(_0x270afc>=_0x245a20){_0x270afc=_0x245a20;_0xf6849a=0xc8;}else{_0xf6849a=0xce;}_0x476d32['status'](_0xf6849a);return _0x476d32[_0xec44('0x28')](_0xec44('0x29'),_0x4bfb7a+'-'+_0x270afc+'/'+_0x245a20)['json'](_0x3a2c1c);}return null;};}function saveUpdates(_0x173e13){return function(_0x5ab60a){if(_0x5ab60a){return _0x5ab60a[_0xec44('0x2a')](_0x173e13)[_0xec44('0x19')](function(_0x24434e){return _0x24434e;});}return null;};}function removeEntity(_0x540bed){return function(_0x2b0ee3){if(_0x2b0ee3){return _0x2b0ee3[_0xec44('0x2b')]()[_0xec44('0x19')](function(){_0x540bed[_0xec44('0x23')](0xcc)[_0xec44('0x24')]();});}};}function handleEntityNotFound(_0x18bd0b){return function(_0x1bceb6){if(!_0x1bceb6){_0x18bd0b['sendStatus'](0x194);}return _0x1bceb6;};}function handleError(_0x5bace8,_0x404d3a){_0x404d3a=_0x404d3a||0x1f4;return function(_0x440248){logger[_0xec44('0x1d')](_0x440248[_0xec44('0x2c')]);if(_0x440248[_0xec44('0x2d')]){delete _0x440248['name'];}_0x5bace8[_0xec44('0x23')](_0x404d3a)[_0xec44('0x2e')](_0x440248);};}function getMustacheRender(_0x55fa9f,_0x307224){return Mustache[_0xec44('0x2f')](_0x55fa9f,_['merge'](_0x307224[_0xec44('0x30')],{'contact':_0x307224[_0xec44('0x31')],'message':_0x307224['message'],'agent':_0x307224[_0xec44('0x32')],'interaction':_0x307224[_0xec44('0x33')],'account':_0x307224[_0xec44('0x34')]}))||'';}exports[_0xec44('0x35')]=function(_0xb26c3a,_0x559fe7){var _0x13b716={};var _0x14bcd4=_[_0xec44('0x36')](db[_0xec44('0x37')]['rawAttributes'],function(_0x2caa61){return{'name':_0x2caa61[_0xec44('0x38')],'type':_0x2caa61[_0xec44('0x39')]['key']};});_0x13b716=qs['getOptions'](_0x14bcd4,_0xb26c3a);return interaction['findAll'](_0xec44('0x3a'),_0xb26c3a['query'],_0xb26c3a[_0xec44('0x3b')],_0x13b716,_0x14bcd4)[_0xec44('0x19')](respondWithFilteredResult(_0x559fe7,_0x13b716))[_0xec44('0x21')](handleError(_0x559fe7,null));};exports[_0xec44('0x3c')]=function(_0x2636f9,_0x5224c2){var _0x4ae698={'raw':![],'where':{'id':_0x2636f9[_0xec44('0x3d')]['id']}},_0x4f2643={};_0x4f2643[_0xec44('0x3e')]=_['keys'](db[_0xec44('0x37')][_0xec44('0x3f')]);_0x4f2643['query']=_[_0xec44('0x40')](_0x2636f9[_0xec44('0x41')]);_0x4f2643['filters']=_[_0xec44('0x42')](_0x4f2643['model'],_0x4f2643[_0xec44('0x41')]);_0x4ae698[_0xec44('0x43')]=_[_0xec44('0x42')](_0x4f2643[_0xec44('0x3e')],qs[_0xec44('0x44')](_0x2636f9[_0xec44('0x41')][_0xec44('0x44')]));_0x4ae698[_0xec44('0x43')]=_0x4ae698[_0xec44('0x43')]['length']?_0x4ae698[_0xec44('0x43')]:_0x4f2643[_0xec44('0x3e')];if(_0x2636f9[_0xec44('0x41')]['includeAll']){_0x4ae698['include']=[{'all':!![]}];}_0x4ae698=_[_0xec44('0x45')]({},_0x4ae698,_0x2636f9['options']);return db[_0xec44('0x37')][_0xec44('0x46')](_0x4ae698)[_0xec44('0x19')](handleEntityNotFound(_0x5224c2,null))[_0xec44('0x19')](respondWithResult(_0x5224c2,null))[_0xec44('0x21')](handleError(_0x5224c2,null));};exports[_0xec44('0x47')]=function(_0x530a90,_0x59f554){return db[_0xec44('0x37')][_0xec44('0x47')](_0x530a90[_0xec44('0x30')],{})['then'](respondWithResult(_0x59f554,0xc9))[_0xec44('0x21')](handleError(_0x59f554,null));};exports[_0xec44('0x2a')]=function(_0x369c2e,_0x2b6c36){if(_0x369c2e[_0xec44('0x30')]['id']){delete _0x369c2e[_0xec44('0x30')]['id'];}return db[_0xec44('0x37')][_0xec44('0x46')]({'where':{'id':_0x369c2e[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0x2b6c36,null))[_0xec44('0x19')](saveUpdates(_0x369c2e[_0xec44('0x30')],null))[_0xec44('0x19')](respondWithResult(_0x2b6c36,null))['catch'](handleError(_0x2b6c36,null));};exports[_0xec44('0x2b')]=function(_0xf95877,_0x3bcc67){return db[_0xec44('0x37')]['find']({'where':{'id':_0xf95877[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0x3bcc67,null))[_0xec44('0x19')](removeEntity(_0x3bcc67,null))[_0xec44('0x21')](handleError(_0x3bcc67,null));};exports[_0xec44('0x48')]=function(_0x5242e8,_0x47e239){return db[_0xec44('0x37')][_0xec44('0x48')]()['then'](respondWithResult(_0x47e239,null))['catch'](handleError(_0x47e239,null));};exports[_0xec44('0x49')]=function(_0x48f92b,_0x11d612){var _0x28d8f6=_0x48f92b['params']['id'];var _0x1eca4c;var _0x5beb54;var _0x24a70e;return db[_0xec44('0x37')][_0xec44('0x4a')]({'where':{'id':_0x28d8f6}})['then'](function(_0x422d78){_0x1eca4c=_0x422d78;return db[_0xec44('0x4b')][_0xec44('0x4a')]({'where':{'id':_0x422d78[_0xec44('0x4c')]},'attributes':['id',_0xec44('0x4d'),_0xec44('0x4e'),_0xec44('0x4f'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xec44('0x19')](function(_0x2441a8){if(_0x2441a8&&_0x2441a8[_0xec44('0x4d')]&&_0x2441a8[_0xec44('0x4e')]){_0x5beb54=_0x2441a8;var _0xf1fabb={'interaction':{'id':_0x28d8f6},'agent':{'id':_0x48f92b[_0xec44('0x3b')]['id'],'name':_0x48f92b[_0xec44('0x3b')][_0xec44('0x2d')],'fullname':_0x48f92b[_0xec44('0x3b')]['fullname'],'email':_0x48f92b['user'][_0xec44('0x50')]},'contact':_0x48f92b[_0xec44('0x30')][_0xec44('0x31')],'account':_0x48f92b[_0xec44('0x30')]['account']};var _0x163d34={'rejectUnauthorized':![],'method':_0xec44('0x51'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2441a8[_0xec44('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x48f92b[_0xec44('0x3b')][_0xec44('0x50')]],'buttons':null,'topic':_0x5beb54[_0xec44('0x4f')],'note':_[_0xec44('0x52')](_0x5beb54[_0xec44('0x53')])?null:getMustacheRender(_0x5beb54[_0xec44('0x53')],_0xf1fabb),'metadata':null},'redirect':_0xec44('0x54'),'json':!![]};try{if(!_[_0xec44('0x52')](_0x5beb54[_0xec44('0x55')])){var _0x37ba3c=getMustacheRender(_0x5beb54[_0xec44('0x55')],_0xf1fabb);var _0x1b8c25=JSON[_0xec44('0x56')](_0x37ba3c);_0x163d34[_0xec44('0x30')][_0xec44('0x57')]=_0x1b8c25;}}catch(_0x4b742a){throw new db['Sequelize'][(_0xec44('0x58'))](_0xec44('0x59'));}return rp(_0x163d34);}else{throw new db['Sequelize'][(_0xec44('0x58'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xec44('0x19')](function(_0x3ffc13){_0x24a70e=_0x3ffc13;if(_0x24a70e['id']){var _0x12cf4b={'body':_0x24a70e[_0xec44('0x5a')],'ChatWebsiteId':_0x5beb54['id'],'ChatInteractionId':_0x1eca4c['id'],'direction':_0xec44('0x5b'),'UserId':_0x48f92b[_0xec44('0x3b')]['id']};return db[_0xec44('0x5c')][_0xec44('0x47')](_0x12cf4b,{});}else{throw new db[(_0xec44('0x5d'))][(_0xec44('0x58'))](_0xec44('0x5e'));}})[_0xec44('0x19')](function(){return _0x1eca4c[_0xec44('0x5f')]({'vidaooSessionId':_0x24a70e['id']});})[_0xec44('0x19')](respondWithResult(_0x11d612,null))[_0xec44('0x21')](handleError(_0x11d612,null));};exports[_0xec44('0x60')]=function(_0x193581,_0xb3edfd){if(_0x193581[_0xec44('0x30')]['id']){delete _0x193581[_0xec44('0x30')]['id'];}return db[_0xec44('0x37')][_0xec44('0x46')]({'where':{'id':_0x193581[_0xec44('0x3d')]['id']},'include':[{'model':db[_0xec44('0x61')],'as':_0xec44('0x62')}]})['then'](handleEntityNotFound(_0xb3edfd,null))[_0xec44('0x19')](saveUpdates(_0x193581[_0xec44('0x30')],null))[_0xec44('0x19')](respondWithResult(_0xb3edfd,null))[_0xec44('0x21')](handleError(_0xb3edfd,null));};exports['abandon']=function(_0x1516ec,_0x37e904){if(_0x1516ec[_0xec44('0x30')]['id']){delete _0x1516ec[_0xec44('0x30')]['id'];}return db[_0xec44('0x37')][_0xec44('0x46')]({'where':{'id':_0x1516ec[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](function(_0x32c1d8){if(!_0x32c1d8){logger[_0xec44('0x1d')](_0xec44('0x63'),_0xec44('0x64'),0x194,_0xec44('0x65'));_0x37e904[_0xec44('0x22')](0x194);}else{if(_0x32c1d8[_0xec44('0x66')]){throw new db[(_0xec44('0x5d'))][(_0xec44('0x58'))](_0xec44('0x67'));}}return _0x32c1d8;})[_0xec44('0x19')](function(_0x4eae39){if(_0x4eae39){return _0x4eae39[_0xec44('0x2a')]({'closed':_0x1516ec[_0xec44('0x30')][_0xec44('0x68')],'disposition':_0x1516ec[_0xec44('0x30')][_0xec44('0x69')]})[_0xec44('0x19')](function(_0x376199){return _0x376199;});}})[_0xec44('0x19')](function(){return respondWithRpcPromise(_0xec44('0x6a'),_0xec44('0x64'),_0x1516ec['body'],client9004);})[_0xec44('0x19')](respondWithResult(_0x37e904,null))[_0xec44('0x21')](handleError(_0x37e904,null));};exports['attachmentUpload']=function(_0x494a16,_0x5df05a){_0x494a16['body'][_0xec44('0x2d')]=_0x494a16[_0xec44('0x6b')][_0xec44('0x6c')];_0x494a16['body'][_0xec44('0x6d')]=_0x494a16[_0xec44('0x6b')][_0xec44('0x6e')];_0x494a16[_0xec44('0x30')]['type']=_0x494a16[_0xec44('0x6b')][_0xec44('0x6f')];return db['Attachment']['create'](_0x494a16['body'])[_0xec44('0x19')](respondWithResult(_0x5df05a,0xc9))['catch'](handleError(_0x5df05a,null));};exports[_0xec44('0x70')]=function(_0x333c38,_0x2575a7){return db[_0xec44('0x37')][_0xec44('0x4a')]({'where':{'id':_0x333c38['params']['id']},'raw':!![]})[_0xec44('0x19')](handleEntityNotFound(_0x2575a7,null))[_0xec44('0x19')](function(_0x11bc50){if(_0x11bc50){if(_0x11bc50[_0xec44('0x68')]){return _0x2575a7[_0xec44('0x23')](0x193)[_0xec44('0x71')]({'status':0x193,'message':_0xec44('0x72')});}return db[_0xec44('0x73')][_0xec44('0x4a')]({'where':{'id':_0x333c38[_0xec44('0x41')][_0xec44('0x74')]},'raw':!![]})[_0xec44('0x19')](handleEntityNotFound(_0x2575a7,null));}})[_0xec44('0x19')](function(_0x387c2b){if(_0x387c2b){var _0x25feca=_0x387c2b[_0xec44('0x75')]!==null;var _0x2e0971=path['join'](config[_0xec44('0x76')],_0xec44('0x77'));if(_0x25feca){_0x2e0971=path['join'](_0x2e0971,_0xec44('0x78'));}var _0x509595=path[_0xec44('0x79')](_0x2e0971,_0x387c2b['basename']);return _0x2575a7[_0xec44('0x7a')](_0x509595);}})[_0xec44('0x21')](handleError(_0x2575a7,null));};exports[_0xec44('0x7b')]=function(_0x25e76a,_0x533c2b){var _0x256a9f=null;var _0x27fa57=null;var _0x32d8d2=null;if(_0x25e76a['body']['id']){delete _0x25e76a[_0xec44('0x30')]['id'];}if(_0x25e76a[_0xec44('0x30')][_0xec44('0x7c')]){_0x32d8d2=path[_0xec44('0x79')](config[_0xec44('0x76')],_0xec44('0x7d'),util[_0xec44('0x7e')](_0xec44('0x7f'),Date[_0xec44('0x80')]()));_0x25e76a[_0xec44('0x30')]['pathTranscript']=_0x32d8d2;}return db[_0xec44('0x37')][_0xec44('0x46')]({'where':{'id':_0x25e76a[_0xec44('0x3d')]['id']},'include':[{'model':db[_0xec44('0x5c')],'as':_0xec44('0x81'),'include':[{'model':db[_0xec44('0x82')],'as':'User'}]}]})[_0xec44('0x19')](handleEntityNotFound(_0x533c2b,null))['then'](saveUpdates(_0x25e76a[_0xec44('0x30')],null))[_0xec44('0x19')](function(_0x2acb3a){if(_0x2acb3a){_0x256a9f=_0x2acb3a;return db[_0xec44('0x4b')][_0xec44('0x46')]({'where':{'id':_0x256a9f[_0xec44('0x4c')]}});}})['then'](function(_0x5c2113){if(_0x5c2113){_0x27fa57=_0x5c2113;return db[_0xec44('0x61')][_0xec44('0x46')]({'where':{'id':_0x256a9f[_0xec44('0x83')]}});}})[_0xec44('0x19')](function(_0x2e4f51){if(_0x2e4f51){if(_0x32d8d2){var _0x23e995=null;for(var _0x2549c7=0x1;_0x2549c7<_0x256a9f[_0xec44('0x81')][_0xec44('0x84')];++_0x2549c7){_0x23e995=_0x256a9f['Messages'][_0x2549c7];var _0x5b3209=_0x23e995[_0xec44('0x66')]?util[_0xec44('0x7e')](_0xec44('0x85'),_0x27fa57[_0xec44('0x86')],_0x23e995[_0xec44('0x66')]):_0xec44('0x87');var _0x50072a=_0x25e76a[_0xec44('0x30')][_0xec44('0x88')]||util[_0xec44('0x7e')](_0xec44('0x85'),_0xec44('0x89'),_0x23e995[_0xec44('0x83')]);switch(_0x27fa57[_0xec44('0x8a')]){case _0xec44('0x8b'):_0x5b3209=_0x23e995[_0xec44('0x66')]?util['format'](_0xec44('0x85'),_0x27fa57[_0xec44('0x86')],_0x23e995[_0xec44('0x66')]):_0xec44('0x87');break;case _0xec44('0x8c'):_0x5b3209=_0x23e995[_0xec44('0x66')]?_0x23e995[_0xec44('0x82')]['alias']||_0x23e995[_0xec44('0x82')][_0xec44('0x8d')]:_0xec44('0x87');break;case'agent_fullname':_0x5b3209=_0x23e995[_0xec44('0x66')]?_0x23e995[_0xec44('0x82')][_0xec44('0x8d')]:'System';break;default:_0x5b3209=_0x23e995[_0xec44('0x66')]?util[_0xec44('0x7e')]('%s%d',_0x27fa57[_0xec44('0x86')],_0x23e995['UserId']):_0xec44('0x87');}var _0x5770d0=util['format'](_0xec44('0x8e'),moment(_0x23e995['createdAt'])[_0xec44('0x7e')]('MM/DD/YYYY\x20HH:mm:ss'),_0x23e995[_0xec44('0x8f')]==='in'?_0x50072a:_0x5b3209,_0x23e995['body']);if(!_0x23e995['secret']){fs[_0xec44('0x90')](_0x32d8d2,_0x5770d0);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xec44('0x91')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xec44('0x92'),'raw':!![]}]}]});}}})[_0xec44('0x19')](function(_0x2537c1){if(!_0x2537c1||!_0x2537c1['Smtp']||!_0x25e76a[_0xec44('0x30')])return _0x256a9f;var _0x478497=_0x2537c1[_0xec44('0x93')]();return respondWithRpcPromise(_0xec44('0x94'),_0xec44('0x95'),{'account':_0x478497,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2537c1['name'],_0x2537c1[_0xec44('0x50')]||_0x2537c1[_0xec44('0x96')][_0xec44('0x3b')]),'to':_0x25e76a[_0xec44('0x30')]['mailTranscript'],'subject':_0xec44('0x97'),'text':util[_0xec44('0x7e')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x25e76a['body'][_0xec44('0x7c')]),'attachments':[{'path':_0x32d8d2}]}})['then'](function(){return _0x256a9f;})['catch'](function(_0x19608a){logger[_0xec44('0x1d')](_0x19608a);});})[_0xec44('0x19')](respondWithStatusCode(_0x533c2b,0xc8))[_0xec44('0x21')](handleError(_0x533c2b,null));};exports[_0xec44('0x98')]=function(_0x60ebf4,_0x5ee31d){return db['ChatMessage'][_0xec44('0x46')]({'where':{'id':_0x60ebf4[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0x5ee31d,null))[_0xec44('0x19')](function(_0x3d6384){if(_0x3d6384){return _0x3d6384[_0xec44('0x98')](_0x60ebf4['body'][_0xec44('0x99')],_['omit'](_0x60ebf4['body'],[_0xec44('0x99'),'id'])||{});}})['then'](respondWithResult(_0x5ee31d,null))[_0xec44('0x21')](handleError(_0x5ee31d,null));};exports[_0xec44('0x9a')]=function(_0x2d4118,_0xd99666){var _0x5dcde8={'raw':![],'where':{}};var _0x32fa08={};var _0x155eaf={'count':0x0,'rows':[]};return db[_0xec44('0x37')][_0xec44('0x4a')]({'where':{'id':_0x2d4118[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0xd99666,null))[_0xec44('0x19')](function(_0x22626b){if(_0x22626b){_0x32fa08[_0xec44('0x3e')]=_[_0xec44('0x40')](db[_0xec44('0x5c')]['rawAttributes']);_0x32fa08['query']=_[_0xec44('0x40')](_0x2d4118[_0xec44('0x41')]);_0x32fa08[_0xec44('0x9b')]=_[_0xec44('0x42')](_0x32fa08[_0xec44('0x3e')],_0x32fa08[_0xec44('0x41')]);_0x5dcde8[_0xec44('0x43')]=_[_0xec44('0x42')](_0x32fa08[_0xec44('0x3e')],qs[_0xec44('0x44')](_0x2d4118['query']['fields']));_0x5dcde8[_0xec44('0x43')]=_0x5dcde8['attributes'][_0xec44('0x84')]?_0x5dcde8[_0xec44('0x43')]:_0x32fa08[_0xec44('0x3e')];if(!_0x2d4118['query'][_0xec44('0x9c')](_0xec44('0x9d'))){_0x5dcde8[_0xec44('0x27')]=qs['limit'](_0x2d4118['query']['limit']);_0x5dcde8[_0xec44('0x9e')]=qs['offset'](_0x2d4118[_0xec44('0x41')]['offset']);}_0x5dcde8['order']=qs[_0xec44('0x9f')](_0x2d4118[_0xec44('0x41')][_0xec44('0x9f')]);_0x5dcde8[_0xec44('0xa0')]=qs[_0xec44('0x9b')](_[_0xec44('0xa1')](_0x2d4118[_0xec44('0x41')],_0x32fa08[_0xec44('0x9b')]));_0x5dcde8['where'][_0xec44('0xa2')]=_0x22626b['id'];if(_0x2d4118['query'][_0xec44('0xa3')]){_0x5dcde8[_0xec44('0xa0')]=_[_0xec44('0x45')](_0x5dcde8[_0xec44('0xa0')],{'$or':_[_0xec44('0x36')](_0x5dcde8['attributes'],function(_0xc8be28){var _0x37974d={};_0x37974d[_0xc8be28]={'$like':'%'+_0x2d4118['query'][_0xec44('0xa3')]+'%'};return _0x37974d;})});}if(_0x2d4118[_0xec44('0x41')][_0xec44('0xa4')]){var _0x6130ce=_0x2d4118[_0xec44('0x41')][_0xec44('0xa4')][_0xec44('0xa5')](',');var _0x119bf5={};_0x119bf5[_0x6130ce[0x0]]={'$gte':moment(_0x6130ce[0x1])[_0xec44('0x7e')](_0xec44('0xa6'))};_0x5dcde8[_0xec44('0xa0')]=_[_0xec44('0x45')](_0x5dcde8[_0xec44('0xa0')],_0x119bf5);}_0x5dcde8=_[_0xec44('0x45')]({},_0x5dcde8,_0x2d4118['options']);return db[_0xec44('0x5c')][_0xec44('0x26')]({'where':_0x5dcde8[_0xec44('0xa0')]})['then'](function(_0x5bdbd7){_0x155eaf['count']=_0x5bdbd7;if(_0x2d4118[_0xec44('0x41')]['includeAll']){_0x5dcde8[_0xec44('0xa7')]=[{'all':!![]}];}return db[_0xec44('0x5c')][_0xec44('0xa8')](_0x5dcde8);})[_0xec44('0x19')](function(_0x370d21){_0x155eaf[_0xec44('0xa9')]=_0x370d21;return _0x155eaf;});}})['then'](respondWithFilteredResult(_0xd99666,_0x5dcde8))[_0xec44('0x21')](handleError(_0xd99666,null));};exports['getMyMessages']=function(_0x40c53d,_0x11e3fb){var _0x4ca176={'where':{}},_0x5e4cae={},_0x4de9a2={'count':0x0,'rows':[]};return db[_0xec44('0x37')][_0xec44('0x4a')]({'where':{'id':_0x40c53d[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0x11e3fb,null))['then'](function(_0x445ac6){if(_0x445ac6){_0x5e4cae[_0xec44('0x3e')]=_[_0xec44('0x40')](db['ChatMessage'][_0xec44('0x3f')]);_0x5e4cae['query']=_['keys'](_0x40c53d[_0xec44('0x41')]);_0x5e4cae[_0xec44('0x9b')]=_['intersection'](_0x5e4cae['model'],_0x5e4cae['query']);_0x4ca176[_0xec44('0x43')]=_[_0xec44('0x42')](_0x5e4cae[_0xec44('0x3e')],qs[_0xec44('0x44')](_0x40c53d[_0xec44('0x41')][_0xec44('0x44')]));_0x4ca176[_0xec44('0x43')]=_0x4ca176['attributes'][_0xec44('0x84')]?_0x4ca176[_0xec44('0x43')]:_0x5e4cae[_0xec44('0x3e')];if(!_0x40c53d[_0xec44('0x41')][_0xec44('0x9c')](_0xec44('0x9d'))){_0x4ca176[_0xec44('0x27')]=qs['limit'](_0x40c53d[_0xec44('0x41')][_0xec44('0x27')]);_0x4ca176[_0xec44('0x9e')]=qs[_0xec44('0x9e')](_0x40c53d[_0xec44('0x41')][_0xec44('0x9e')]);}_0x4ca176[_0xec44('0xaa')]=qs[_0xec44('0x9f')](_0x40c53d[_0xec44('0x41')][_0xec44('0x9f')]);_0x4ca176['where']=qs['filters'](_[_0xec44('0xa1')](_0x40c53d[_0xec44('0x41')],_0x5e4cae[_0xec44('0x9b')]));_0x4ca176['where'][_0xec44('0xa2')]=_0x445ac6['id'];if(_0x40c53d[_0xec44('0x41')]['filter']){_0x4ca176[_0xec44('0xa0')]=_[_0xec44('0x45')](_0x4ca176['where'],{'$or':_['map'](_0x4ca176[_0xec44('0x43')],function(_0xd9ca9c){var _0x2c24e9={};_0x2c24e9[_0xd9ca9c]={'$like':'%'+_0x40c53d[_0xec44('0x41')][_0xec44('0xa3')]+'%'};return _0x2c24e9;})});}_0x4ca176[_0xec44('0xa0')][_0xec44('0xab')]=![];if(_0x40c53d[_0xec44('0x41')]['id']){_0x4ca176[_0xec44('0xa0')]['id']={'$gt':_0x40c53d[_0xec44('0x41')]['id']};}_0x4ca176=_['merge']({},_0x4ca176,_0x40c53d[_0xec44('0xac')]);return db[_0xec44('0x5c')]['count']({'where':_0x4ca176[_0xec44('0xa0')]})[_0xec44('0x19')](function(_0x2e485f){_0x4de9a2[_0xec44('0x26')]=_0x2e485f;_0x4ca176[_0xec44('0xa7')]=[];if(_0x40c53d[_0xec44('0x41')][_0xec44('0xad')]){_0x4ca176[_0xec44('0xa7')][_0xec44('0xae')]({'model':db['User'],'as':'User','attributes':['id','fullname',_0xec44('0xaf')]});}if(_0x40c53d[_0xec44('0x41')][_0xec44('0xb0')]){_0x4ca176['include']=[{'all':!![]}];}return db[_0xec44('0x5c')][_0xec44('0xa8')](_0x4ca176);})[_0xec44('0x19')](function(_0x196ca0){_0x4de9a2['rows']=_0x196ca0;return _0x4de9a2;});}})[_0xec44('0x19')](respondWithFilteredResult(_0x11e3fb,_0x4ca176))[_0xec44('0x21')](handleError(_0x11e3fb,null));};exports[_0xec44('0xb1')]=function(_0x5b3548,_0x23452a){return db[_0xec44('0x37')][_0xec44('0x46')]({'where':{'id':_0x5b3548[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0x23452a,null))[_0xec44('0x19')](function(_0x483b0c){if(_0x483b0c){return _0x483b0c[_0xec44('0xb2')](_0x5b3548[_0xec44('0x30')]['ids'],_[_0xec44('0xb3')](_0x5b3548[_0xec44('0x30')],['ids','id'])||{})[_0xec44('0xb4')](function(){return db[_0xec44('0xb5')][_0xec44('0xa8')]({'attributes':['id','name',_0xec44('0xb6')],'where':{'id':_0x5b3548['body'][_0xec44('0x99')]}});})[_0xec44('0x19')](function(_0x4f15ad){socket['emit'](_0xec44('0xb7'),{'id':Number(_0x5b3548['params']['id']),'tags':_0x4f15ad||[]});return{'id':Number(_0x5b3548[_0xec44('0x3d')]['id']),'tags':_0x4f15ad||[]};});}})[_0xec44('0x19')](respondWithResult(_0x23452a,null))[_0xec44('0x21')](handleError(_0x23452a,null));};exports[_0xec44('0xb8')]=function(_0x464fce,_0x17f9ba){return db[_0xec44('0x37')][_0xec44('0x46')]({'where':{'id':_0x464fce[_0xec44('0x3d')]['id']}})[_0xec44('0x19')](handleEntityNotFound(_0x17f9ba,null))['then'](function(_0x5dd26b){if(_0x5dd26b){return _0x5dd26b[_0xec44('0xb8')](_0x464fce[_0xec44('0x41')][_0xec44('0x99')]);}})['then'](respondWithStatusCode(_0x17f9ba,null))[_0xec44('0x21')](handleError(_0x17f9ba,null));};exports[_0xec44('0x7a')]=function(_0x3b68c8,_0x5bb446){var _0x35c4aa=moment()[_0xec44('0xb9')]()['toString']();var _0x5b8c87=path['join'](config[_0xec44('0x76')],_0xec44('0xba'),_0xec44('0xbb'),'tmp');var _0x3911ad=path[_0xec44('0x79')](config[_0xec44('0x76')],_0xec44('0xba'),'files',_0xec44('0xbc'));var _0xce081c=path[_0xec44('0x79')](_0x5b8c87,_0x35c4aa);var _0x5e6bd0=util[_0xec44('0x7e')](_0xec44('0xbd'),_0x3b68c8[_0xec44('0x3d')]['id'],_0x35c4aa);var _0x1551db=path[_0xec44('0x79')](_0x5b8c87,_0x5e6bd0);var _0x14671e=[];_0x14671e[_0xec44('0xae')]({'model':db[_0xec44('0x82')],'as':_0xec44('0x82'),'attributes':['id',_0xec44('0x8d')],'raw':!![]});_0x14671e[_0xec44('0xae')]({'model':db[_0xec44('0x61')],'as':'Contact','attributes':['id',_0xec44('0xbe'),_0xec44('0xbf')],'raw':!![]});if(_0x3b68c8[_0xec44('0x41')][_0xec44('0xbc')]){_0x14671e[_0xec44('0xae')]({'model':db[_0xec44('0x73')],'as':_0xec44('0x73'),'raw':!![]});}var _0x4a35b0=[{'model':db[_0xec44('0x5c')],'as':_0xec44('0x81'),'attributes':['id',_0xec44('0x30'),_0xec44('0xc0'),_0xec44('0x8f'),'secret','read'],'include':_0x14671e}];_0x4a35b0[_0xec44('0xae')]({'model':db[_0xec44('0x4b')],'as':_0xec44('0xc1'),'attributes':['id',_0xec44('0x2d')]});_0x4a35b0[_0xec44('0xae')]({'model':db[_0xec44('0x82')],'as':_0xec44('0xc2'),'attributes':['id',_0xec44('0x8d')]});return db[_0xec44('0x37')]['find']({'where':{'id':_0x3b68c8[_0xec44('0x3d')]['id']},'include':_0x4a35b0})[_0xec44('0x19')](handleEntityNotFound(_0x5bb446,null))[_0xec44('0x19')](function(_0x3c4170){if(_0x3c4170){var _0x416ef8=_0x3c4170[_0xec44('0xc3')]({'plain':!![]});fs[_0xec44('0xc4')](_0xce081c);var _0x53dea2={'channel':'Chat','account':_0x416ef8[_0xec44('0xc1')][_0xec44('0x2d')],'agent':_0x416ef8[_0xec44('0xc2')]?_0x416ef8['Owner'][_0xec44('0x8d')]:_0xec44('0xc5'),'createdAt':moment(_0x416ef8[_0xec44('0xc0')])[_0xec44('0x7e')](_0xec44('0xa6'))[_0xec44('0xc6')](),'closedAt':_0x416ef8['closed']?moment(_0x416ef8[_0xec44('0xc7')])[_0xec44('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0xec44('0xc6')]():'','disposition':_0x416ef8[_0xec44('0x69')],'chatInfo':{'browser':_0x416ef8['browserName'],'os':_0x416ef8[_0xec44('0xc8')],'referer':_0x416ef8[_0xec44('0xc9')],'customerIp':_0x416ef8[_0xec44('0xca')],'customerPort':_0x416ef8[_0xec44('0xcb')]?_0x416ef8[_0xec44('0xcb')]:_0xec44('0xc5')},'messages':_(_0x416ef8['Messages'])[_0xec44('0xcc')]()['filter']({'secret':![]})[_0xec44('0x36')](function(_0x6b012d){if(_0x6b012d['Attachment']){var _0x40d765=path['join'](_0x3911ad,_0x6b012d[_0xec44('0x73')][_0xec44('0x6d')]);if(fs['existsSync'](_0x40d765)){fs[_0xec44('0xcd')](_0x40d765)['pipe'](fs[_0xec44('0xce')](path[_0xec44('0x79')](_0xce081c,_0x6b012d[_0xec44('0x73')][_0xec44('0x6d')])));}}return{'date':moment(_0x6b012d['createdAt'])[_0xec44('0x7e')](_0xec44('0xa6'))[_0xec44('0xc6')](),'sender':_0x6b012d[_0xec44('0x8f')]===_0xec44('0x5b')?_0x6b012d['User']?_0x6b012d[_0xec44('0x82')][_0xec44('0x8d')]:_0xec44('0x87'):_0x6b012d['Contact'][_0xec44('0xbe')]+(_0x6b012d[_0xec44('0x62')][_0xec44('0xbf')]?'\x20'+_0x6b012d[_0xec44('0x62')][_0xec44('0xbf')]:''),'body':_0x6b012d[_0xec44('0x73')]?_0x6b012d[_0xec44('0x73')][_0xec44('0x6d')]:_0x6b012d[_0xec44('0x30')],'direction':_0x6b012d['direction']===_0xec44('0x5b')?'A':'C','secret':_0x6b012d['secret'],'read':_0x6b012d[_0xec44('0xcf')],'attachment':_0x6b012d['Attachment']};})[_0xec44('0xd0')]()};return ejs[_0xec44('0xd1')](path[_0xec44('0x79')](config['root'],_0xec44('0xba'),'views','downloadInteraction.ejs'),{'interaction':_0x53dea2})[_0xec44('0x19')](function(_0x338022){var _0x468524=path[_0xec44('0x79')](_0xce081c,_0xec44('0xd2')+_0x416ef8['id']+'-'+_0x35c4aa+_0xec44('0xd3'));var _0x217661={'path':_0x468524,'channel':'Chat','interactionId':_0x416ef8['id']};return pdf[_0xec44('0xd4')](_0x338022,_0x217661);})[_0xec44('0x19')](function(){return new Promise(function(_0x3b836e,_0x4f0e38){zipdir(_0xce081c,{'saveTo':_0x1551db},function(_0x4cdb55,_0x39b22b){if(_0x4cdb55)return _0x4f0e38(_0x4cdb55);return _0x3b836e(_0x39b22b);});})[_0xec44('0x19')](function(){return new BPromise(function(_0x388392,_0x557b5e){rimraf(_0xce081c,function(_0x18f659){if(_0x18f659)_0x557b5e(_0x18f659);return _0x388392();});});})[_0xec44('0x19')](function(){return _0x5bb446['download'](_0x1551db,_0x5e6bd0,function(_0xf24c02){if(_0xf24c02){logger[_0xec44('0x1d')](_0xec44('0xd5'),_0xf24c02);}else{fs[_0xec44('0xd6')](_0x1551db);}});});});}else{return _0x5bb446[_0xec44('0x22')](0xc8);}})[_0xec44('0x21')](handleError(_0x5bb446,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c848f4c..296b76d 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 _0xbfc1=['../../mysqldb','ChatMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hook','ChatInteraction'];(function(_0x1ddfe2,_0x41e6a4){var _0xa19e17=function(_0x585cb8){while(--_0x585cb8){_0x1ddfe2['push'](_0x1ddfe2['shift']());}};_0xa19e17(++_0x41e6a4);}(_0xbfc1,0x1df));var _0x1bfc=function(_0xa66bc1,_0x26010d){_0xa66bc1=_0xa66bc1-0x0;var _0x3783a8=_0xbfc1[_0xa66bc1];return _0x3783a8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x1bfc('0x0')];var ChatMessage=require(_0x1bfc('0x1'))['db'][_0x1bfc('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1bfc('0x3'),'afterUpdate':_0x1bfc('0x4'),'afterDestroy':_0x1bfc('0x5')};function emitEvent(_0x324dd6){return function(_0x852547,_0x50d39f,_0x2aabb5){_0x852547[_0x1bfc('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5eda9c){_0x852547[_0x1bfc('0x7')](_0x1bfc('0x8'),_0x5eda9c[_0x1bfc('0x9')](function(_0x15321e){return{'id':_0x15321e['id']};}));return ChatMessage[_0x1bfc('0xa')]({'where':{'ChatInteractionId':_0x852547['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1bfc('0xb')](function(_0x1a9410){_0x852547[_0x1bfc('0x7')]('unreadMessages',_0x1a9410[_0x1bfc('0xc')]);ChatInteractionEvents[_0x1bfc('0xd')](_0x324dd6+':'+_0x852547['id'],_0x852547);ChatInteractionEvents[_0x1bfc('0xd')](_0x324dd6,_0x852547);_0x2aabb5(null);})[_0x1bfc('0xe')](_0x2aabb5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1bfc('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x50f1=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue'];(function(_0x24cc3e,_0x3b2f20){var _0x299210=function(_0x19e3f5){while(--_0x19e3f5){_0x24cc3e['push'](_0x24cc3e['shift']());}};_0x299210(++_0x3b2f20);}(_0x50f1,0x180));var _0x150f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x50f1[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x150f('0x0'));var ChatInteraction=require(_0x150f('0x1'))['db'][_0x150f('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x150f('0x3')](0x0);var events={'afterCreate':_0x150f('0x4'),'afterUpdate':_0x150f('0x5'),'afterDestroy':_0x150f('0x6')};function emitEvent(_0x318465){return function(_0x59830c,_0x3b6f74,_0x47ce97){_0x59830c['getUsers']({'attributes':['id'],'raw':!![]})[_0x150f('0x7')](function(_0x122c95){_0x59830c['setDataValue'](_0x150f('0x8'),_0x122c95[_0x150f('0x9')](function(_0xc5ad76){return{'id':_0xc5ad76['id']};}));return ChatMessage[_0x150f('0xa')]({'where':{'ChatInteractionId':_0x59830c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x150f('0x7')](function(_0xb2555f){_0x59830c[_0x150f('0xb')](_0x150f('0xc'),_0xb2555f[_0x150f('0xd')]);ChatInteractionEvents[_0x150f('0xe')](_0x318465+':'+_0x59830c['id'],_0x59830c);ChatInteractionEvents[_0x150f('0xe')](_0x318465,_0x59830c);_0x47ce97(null);})[_0x150f('0xf')](_0x47ce97(null));};}for(var e in events){if(events[_0x150f('0x10')](e)){var event=events[e];ChatInteraction[_0x150f('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index cd88ac5..865db10 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 _0xebcc=['exports','define','ChatInteraction','changed','closedAt','format','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xebcc,0x107));var _0xcebc=function(_0x4b0388,_0x3749fb){_0x4b0388=_0x4b0388-0x0;var _0x5c3406=_0xebcc[_0x4b0388];return _0x5c3406;};'use strict';var _=require(_0xcebc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcebc('0x1'));var moment=require(_0xcebc('0x2'));var BPromise=require(_0xcebc('0x3'));var rp=require(_0xcebc('0x4'));var fs=require('fs');var path=require(_0xcebc('0x5'));var rimraf=require(_0xcebc('0x6'));var config=require(_0xcebc('0x7'));var attributes=require(_0xcebc('0x8'));module[_0xcebc('0x9')]=function(_0x1a10f3,_0x3e238b){return _0x1a10f3[_0xcebc('0xa')](_0xcebc('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x581360,_0x2dfe33,_0x3ea8ba){if(_0x581360[_0xcebc('0xc')]('closed')){_0x581360[_0xcebc('0xd')]=moment()[_0xcebc('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3ea8ba(null,_0x581360);}},'charset':'utf8mb4','collate':_0xcebc('0xf')});}; \ No newline at end of file +var _0xd47e=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path'];(function(_0x1bf737,_0x4c3631){var _0x1629d1=function(_0x10c5d6){while(--_0x10c5d6){_0x1bf737['push'](_0x1bf737['shift']());}};_0x1629d1(++_0x4c3631);}(_0xd47e,0x11b));var _0xed47=function(_0xe3ca7f,_0x2fa923){_0xe3ca7f=_0xe3ca7f-0x0;var _0x22650c=_0xd47e[_0xe3ca7f];return _0x22650c;};'use strict';var _=require(_0xed47('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xed47('0x1'));var moment=require(_0xed47('0x2'));var BPromise=require(_0xed47('0x3'));var rp=require(_0xed47('0x4'));var fs=require('fs');var path=require(_0xed47('0x5'));var rimraf=require(_0xed47('0x6'));var config=require(_0xed47('0x7'));var attributes=require(_0xed47('0x8'));module[_0xed47('0x9')]=function(_0x3057b5,_0x5c7b74){return _0x3057b5[_0xed47('0xa')]('ChatInteraction',attributes,{'tableName':_0xed47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c6665,_0x39f557,_0x26a537){if(_0x1c6665['changed'](_0xed47('0xc'))){_0x1c6665[_0xed47('0xd')]=moment()[_0xed47('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x26a537(null,_0x1c6665);}},'charset':_0xed47('0xf'),'collate':_0xed47('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7bc119f..bb34709 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 _0xaec7=['error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xaec7,0x1b9));var _0x7aec=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xaec7[_0x20e7e3];return _0x14b9de;};'use strict';var _=require(_0x7aec('0x0'));var util=require(_0x7aec('0x1'));var moment=require(_0x7aec('0x2'));var BPromise=require('bluebird');var rs=require(_0x7aec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7aec('0x4'));var logger=require(_0x7aec('0x5'))(_0x7aec('0x6'));var config=require(_0x7aec('0x7'));var jayson=require(_0x7aec('0x8'));var client=jayson[_0x7aec('0x9')][_0x7aec('0xa')]({'port':0x232a});config[_0x7aec('0xb')]=_['defaults'](config['redis'],{'host':_0x7aec('0xc'),'port':0x18eb});var socket=require(_0x7aec('0xd'))(new Redis(config[_0x7aec('0xb')]));require(_0x7aec('0xe'))[_0x7aec('0xf')](socket);function respondWithRpcPromise(_0x112457,_0x4a7ca1,_0x2be259){return new BPromise(function(_0x3bec6a,_0x58e819){return client['request'](_0x112457,_0x2be259)[_0x7aec('0x10')](function(_0x43ce87){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4a7ca1,_0x7aec('0x11'));logger[_0x7aec('0x12')](_0x7aec('0x13'),_0x4a7ca1,_0x7aec('0x11'),JSON[_0x7aec('0x14')](_0x43ce87));if(_0x43ce87[_0x7aec('0x15')]){if(_0x43ce87['error'][_0x7aec('0x16')]===0x1f4){logger['error'](_0x7aec('0x17'),_0x4a7ca1,_0x43ce87['error'][_0x7aec('0x18')]);return _0x58e819(_0x43ce87[_0x7aec('0x15')][_0x7aec('0x18')]);}logger[_0x7aec('0x15')](_0x7aec('0x17'),_0x4a7ca1,_0x43ce87[_0x7aec('0x15')][_0x7aec('0x18')]);return _0x3bec6a(_0x43ce87[_0x7aec('0x15')][_0x7aec('0x18')]);}else{logger[_0x7aec('0x19')](_0x7aec('0x17'),_0x4a7ca1,_0x7aec('0x11'));_0x3bec6a(_0x43ce87['result']['message']);}})[_0x7aec('0x1a')](function(_0x2bf09f){logger[_0x7aec('0x15')](_0x7aec('0x17'),_0x4a7ca1,_0x2bf09f);_0x58e819(_0x2bf09f);});});}exports[_0x7aec('0x1b')]=function(_0x56573b){var _0x2323e7=this;return new Promise(function(_0x5d05d0,_0x56268d){return db[_0x7aec('0x1c')][_0x7aec('0x1d')](_0x56573b[_0x7aec('0x1e')],{'raw':_0x56573b[_0x7aec('0x1f')]?_0x56573b[_0x7aec('0x1f')][_0x7aec('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56573b['options']?_0x56573b['options'][_0x7aec('0x21')]||null:null,'attributes':_0x56573b[_0x7aec('0x1f')]?_0x56573b[_0x7aec('0x1f')]['attributes']||null:null,'limit':_0x56573b[_0x7aec('0x1f')]?_0x56573b[_0x7aec('0x1f')][_0x7aec('0x22')]||null:null})[_0x7aec('0x10')](function(_0x16772c){logger[_0x7aec('0x19')](_0x7aec('0x1b'),_0x56573b);logger['debug']('UpdateChatInteraction',_0x56573b,JSON[_0x7aec('0x14')](_0x16772c));_0x5d05d0(_0x16772c);})['catch'](function(_0x266453){logger[_0x7aec('0x15')](_0x7aec('0x1b'),_0x266453[_0x7aec('0x18')],_0x56573b);_0x56268d(_0x2323e7['error'](0x1f4,_0x266453[_0x7aec('0x18')]));});});};exports[_0x7aec('0x23')]=function(_0xa66034){return new Promise(function(_0x5e8dc1,_0x3de67a){return db['ChatInteraction'][_0x7aec('0x24')]({'where':_0xa66034['options']?_0xa66034[_0x7aec('0x1f')][_0x7aec('0x21')]||null:null})[_0x7aec('0x10')](function(_0xe87c37){if(_0xe87c37){return _0xe87c37[_0x7aec('0x25')](_0xa66034[_0x7aec('0x1e')]['ids'],_[_0x7aec('0x26')](_0xa66034[_0x7aec('0x1e')],[_0x7aec('0x27'),'id'])||{});}})[_0x7aec('0x28')](function(_0x23931c){logger[_0x7aec('0x19')]('AddTags',_0xa66034);logger[_0x7aec('0x12')](_0x7aec('0x29'),_0xa66034,JSON[_0x7aec('0x14')](_0x23931c));_0x5e8dc1(_0x23931c);})['catch'](function(_0xa9ead6){logger[_0x7aec('0x15')](_0x7aec('0x29'),_0xa9ead6[_0x7aec('0x18')],_0xa66034);_0x3de67a(_this['error'](0x1f4,_0xa9ead6[_0x7aec('0x18')]));});});}; \ No newline at end of file +var _0xd17a=['request\x20sent','result','catch','UpdateChatInteraction','update','options','raw','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','addTags','body','ids','spread','AddTags','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xd17a,0xc3));var _0xad17=function(_0x27a848,_0x2dfc9a){_0x27a848=_0x27a848-0x0;var _0x57dbb0=_0xd17a[_0x27a848];return _0x57dbb0;};'use strict';var _=require(_0xad17('0x0'));var util=require('util');var moment=require(_0xad17('0x1'));var BPromise=require(_0xad17('0x2'));var rs=require(_0xad17('0x3'));var fs=require('fs');var Redis=require(_0xad17('0x4'));var db=require(_0xad17('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xad17('0x6'))(_0xad17('0x7'));var config=require(_0xad17('0x8'));var jayson=require(_0xad17('0x9'));var client=jayson['client'][_0xad17('0xa')]({'port':0x232a});config[_0xad17('0xb')]=_[_0xad17('0xc')](config[_0xad17('0xb')],{'host':_0xad17('0xd'),'port':0x18eb});var socket=require(_0xad17('0xe'))(new Redis(config[_0xad17('0xb')]));require(_0xad17('0xf'))['register'](socket);function respondWithRpcPromise(_0x20d13c,_0x5abbfd,_0xdce258){return new BPromise(function(_0x10755c,_0x2dba04){return client[_0xad17('0x10')](_0x20d13c,_0xdce258)[_0xad17('0x11')](function(_0x31f695){logger['info'](_0xad17('0x12'),_0x5abbfd,'request\x20sent');logger['debug'](_0xad17('0x13'),_0x5abbfd,'request\x20sent',JSON[_0xad17('0x14')](_0x31f695));if(_0x31f695[_0xad17('0x15')]){if(_0x31f695[_0xad17('0x15')][_0xad17('0x16')]===0x1f4){logger[_0xad17('0x15')](_0xad17('0x12'),_0x5abbfd,_0x31f695[_0xad17('0x15')][_0xad17('0x17')]);return _0x2dba04(_0x31f695['error']['message']);}logger[_0xad17('0x15')](_0xad17('0x12'),_0x5abbfd,_0x31f695[_0xad17('0x15')]['message']);return _0x10755c(_0x31f695[_0xad17('0x15')][_0xad17('0x17')]);}else{logger[_0xad17('0x18')](_0xad17('0x12'),_0x5abbfd,_0xad17('0x19'));_0x10755c(_0x31f695[_0xad17('0x1a')][_0xad17('0x17')]);}})[_0xad17('0x1b')](function(_0xfa24d3){logger[_0xad17('0x15')](_0xad17('0x12'),_0x5abbfd,_0xfa24d3);_0x2dba04(_0xfa24d3);});});}exports[_0xad17('0x1c')]=function(_0x285487){var _0x195f93=this;return new Promise(function(_0x17e1cf,_0x1c6a13){return db['ChatInteraction'][_0xad17('0x1d')](_0x285487['body'],{'raw':_0x285487[_0xad17('0x1e')]?_0x285487[_0xad17('0x1e')][_0xad17('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285487[_0xad17('0x1e')]?_0x285487['options'][_0xad17('0x20')]||null:null,'attributes':_0x285487[_0xad17('0x1e')]?_0x285487[_0xad17('0x1e')][_0xad17('0x21')]||null:null,'limit':_0x285487[_0xad17('0x1e')]?_0x285487['options'][_0xad17('0x22')]||null:null})[_0xad17('0x11')](function(_0x155046){logger['info'](_0xad17('0x1c'),_0x285487);logger['debug'](_0xad17('0x1c'),_0x285487,JSON[_0xad17('0x14')](_0x155046));_0x17e1cf(_0x155046);})[_0xad17('0x1b')](function(_0x5b7096){logger[_0xad17('0x15')]('UpdateChatInteraction',_0x5b7096[_0xad17('0x17')],_0x285487);_0x1c6a13(_0x195f93[_0xad17('0x15')](0x1f4,_0x5b7096['message']));});});};exports[_0xad17('0x23')]=function(_0xbfa9ea){return new Promise(function(_0x512250,_0x22e7d9){return db[_0xad17('0x24')][_0xad17('0x25')]({'where':_0xbfa9ea['options']?_0xbfa9ea[_0xad17('0x1e')][_0xad17('0x20')]||null:null})[_0xad17('0x11')](function(_0x381dc0){if(_0x381dc0){return _0x381dc0[_0xad17('0x26')](_0xbfa9ea[_0xad17('0x27')][_0xad17('0x28')],_['omit'](_0xbfa9ea[_0xad17('0x27')],[_0xad17('0x28'),'id'])||{});}})[_0xad17('0x29')](function(_0x413e16){logger[_0xad17('0x18')](_0xad17('0x2a'),_0xbfa9ea);logger[_0xad17('0x2b')](_0xad17('0x2a'),_0xbfa9ea,JSON['stringify'](_0x413e16));_0x512250(_0x413e16);})[_0xad17('0x1b')](function(_0x5439ff){logger[_0xad17('0x15')](_0xad17('0x2a'),_0x5439ff[_0xad17('0x17')],_0xbfa9ea);_0x22e7d9(_this[_0xad17('0x15')](0x1f4,_0x5439ff['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 207e507..9b937b7 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 _0x5d15=['save','remove','update','emit','register','length','./chatInteraction.events'];(function(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0x5d15,0x76));var _0x55d1=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x5d15[_0x5550b3];return _0x4b8fc4;};'use strict';var ChatInteractionEvents=require(_0x55d1('0x0'));var events=[_0x55d1('0x1'),_0x55d1('0x2'),_0x55d1('0x3')];function createListener(_0x532365,_0x53d4b8){return function(_0x2f31be){_0x53d4b8[_0x55d1('0x4')](_0x532365,_0x2f31be);};}function removeListener(_0x11fb4b,_0x14f2cf){return function(){ChatInteractionEvents['removeListener'](_0x11fb4b,_0x14f2cf);};}exports[_0x55d1('0x5')]=function(_0x38136b){for(var _0x40e406=0x0,_0x3aba1a=events[_0x55d1('0x6')];_0x40e406<_0x3aba1a;_0x40e406++){var _0x3e9d0d=events[_0x40e406];var _0x2ee6c1=createListener('chatInteraction:'+_0x3e9d0d,_0x38136b);ChatInteractionEvents['on'](_0x3e9d0d,_0x2ee6c1);}}; \ No newline at end of file +var _0x4d39=['save','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x29cb3f,_0x3386cf){var _0x4b90b9=function(_0x20e0f3){while(--_0x20e0f3){_0x29cb3f['push'](_0x29cb3f['shift']());}};_0x4b90b9(++_0x3386cf);}(_0x4d39,0x18f));var _0x94d3=function(_0xcad83b,_0x1bbb16){_0xcad83b=_0xcad83b-0x0;var _0x15fe13=_0x4d39[_0xcad83b];return _0x15fe13;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x94d3('0x0'),'remove',_0x94d3('0x1')];function createListener(_0x3e46e4,_0x4626f7){return function(_0x3311ee){_0x4626f7[_0x94d3('0x2')](_0x3e46e4,_0x3311ee);};}function removeListener(_0x388891,_0x29ac3d){return function(){ChatInteractionEvents[_0x94d3('0x3')](_0x388891,_0x29ac3d);};}exports[_0x94d3('0x4')]=function(_0x227559){for(var _0x454327=0x0,_0x5768bd=events[_0x94d3('0x5')];_0x454327<_0x5768bd;_0x454327++){var _0x1f4dff=events[_0x454327];var _0x847975=createListener(_0x94d3('0x6')+_0x1f4dff,_0x227559);ChatInteractionEvents['on'](_0x1f4dff,_0x847975);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2ca150c..155331d 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 _0x37e3=['put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x19ccd3,_0x3cb70c){var _0x134097=function(_0x32fdb6){while(--_0x32fdb6){_0x19ccd3['push'](_0x19ccd3['shift']());}};_0x134097(++_0x3cb70c);}(_0x37e3,0xbc));var _0x337e=function(_0x51a6ea,_0x4789e7){_0x51a6ea=_0x51a6ea-0x0;var _0x4c6e17=_0x37e3[_0x51a6ea];return _0x4c6e17;};'use strict';var multer=require(_0x337e('0x0'));var util=require(_0x337e('0x1'));var path=require(_0x337e('0x2'));var timeout=require(_0x337e('0x3'));var express=require(_0x337e('0x4'));var router=express[_0x337e('0x5')]();var fs_extra=require(_0x337e('0x6'));var auth=require(_0x337e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x337e('0x8'));var controller=require(_0x337e('0x9'));router[_0x337e('0xa')]('/',auth['isAuthenticated'](),controller[_0x337e('0xb')]);router[_0x337e('0xa')](_0x337e('0xc'),auth[_0x337e('0xd')](),controller[_0x337e('0xe')]);router['get']('/:id',auth[_0x337e('0xf')](),controller[_0x337e('0x10')]);router[_0x337e('0xa')]('/:id/attachment_download',auth[_0x337e('0xf')](),controller[_0x337e('0x11')]);router[_0x337e('0xa')](_0x337e('0x12'),auth[_0x337e('0xd')](),controller[_0x337e('0x13')]);router[_0x337e('0xa')](_0x337e('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x337e('0x15')]);router['get'](_0x337e('0x16'),auth[_0x337e('0xd')](),controller[_0x337e('0x17')]);router[_0x337e('0x18')]('/',auth[_0x337e('0xd')](),controller[_0x337e('0x19')]);router[_0x337e('0x18')](_0x337e('0x1a'),auth[_0x337e('0xd')](),controller[_0x337e('0x1b')]);var upload=multer({'storage':multer[_0x337e('0x1c')]({'destination':function(_0xfb5c13,_0x31649e,_0x5b9c9a){_0x5b9c9a(null,path['join'](config[_0x337e('0x1d')],_0x337e('0x1e')));},'filename':function(_0x31460b,_0x37bc46,_0x469719){_0x469719(null,util[_0x337e('0x1f')](_0x337e('0x20'),Date[_0x337e('0x21')](),_0x37bc46['originalname'][_0x337e('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x337e('0x18')](_0x337e('0x23'),upload[_0x337e('0x24')](_0x337e('0x25')),controller[_0x337e('0x26')]);router['post'](_0x337e('0x12'),auth[_0x337e('0xf')](),controller[_0x337e('0x27')]);router[_0x337e('0x18')]('/:id/tags',auth[_0x337e('0xd')](),interaction[_0x337e('0x28')](_0x337e('0x29'),_0x337e('0x2a')),controller[_0x337e('0x2b')]);router[_0x337e('0x2c')](_0x337e('0x2d'),auth['isAuthenticated'](),interaction[_0x337e('0x28')](_0x337e('0x29'),_0x337e('0x2e')),controller[_0x337e('0x2f')]);router[_0x337e('0x2c')](_0x337e('0x30'),controller[_0x337e('0x31')]);router[_0x337e('0x2c')](_0x337e('0x32'),auth[_0x337e('0xf')](),controller['abandon']);router[_0x337e('0x2c')](_0x337e('0x33'),controller[_0x337e('0x34')]);router[_0x337e('0x35')]('/:id',auth[_0x337e('0xd')](),interaction[_0x337e('0x28')](_0x337e('0x29'),_0x337e('0x36')),controller[_0x337e('0x37')]);router['delete']('/:id/tags',auth[_0x337e('0xd')](),controller[_0x337e('0x38')]);module[_0x337e('0x39')]=router; \ No newline at end of file +var _0x38e0=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','show'];(function(_0x548467,_0x5ef1f2){var _0x53c1b0=function(_0x38644a){while(--_0x38644a){_0x548467['push'](_0x548467['shift']());}};_0x53c1b0(++_0x5ef1f2);}(_0x38e0,0xb5));var _0x038e=function(_0x4f02e,_0x4ac328){_0x4f02e=_0x4f02e-0x0;var _0x5a09cd=_0x38e0[_0x4f02e];return _0x5a09cd;};'use strict';var multer=require(_0x038e('0x0'));var util=require(_0x038e('0x1'));var path=require(_0x038e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x038e('0x3')]();var fs_extra=require(_0x038e('0x4'));var auth=require(_0x038e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x038e('0x6'));var controller=require(_0x038e('0x7'));router['get']('/',auth[_0x038e('0x8')](),controller[_0x038e('0x9')]);router[_0x038e('0xa')](_0x038e('0xb'),auth[_0x038e('0x8')](),controller['describe']);router[_0x038e('0xa')](_0x038e('0xc'),auth[_0x038e('0xd')](),controller[_0x038e('0xe')]);router['get'](_0x038e('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x038e('0x10')]);router[_0x038e('0xa')](_0x038e('0x11'),auth['isAuthenticated'](),controller[_0x038e('0x12')]);router[_0x038e('0xa')](_0x038e('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0x038e('0x14'),auth[_0x038e('0x8')](),controller[_0x038e('0x15')]);router[_0x038e('0x16')]('/',auth[_0x038e('0x8')](),controller['create']);router[_0x038e('0x16')](_0x038e('0x17'),auth[_0x038e('0x8')](),controller[_0x038e('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49d547,_0x307d6f,_0xbd8e38){_0xbd8e38(null,path['join'](config[_0x038e('0x19')],_0x038e('0x1a')));},'filename':function(_0x347fb8,_0x389e8e,_0x3ad64f){_0x3ad64f(null,util[_0x038e('0x1b')](_0x038e('0x1c'),Date['now'](),_0x389e8e[_0x038e('0x1d')][_0x038e('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x038e('0x1f'),upload[_0x038e('0x20')]('file'),controller[_0x038e('0x21')]);router[_0x038e('0x16')](_0x038e('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x038e('0x22')]);router[_0x038e('0x16')](_0x038e('0x23'),auth['isAuthenticated'](),interaction[_0x038e('0x24')](_0x038e('0x25'),'chatinteraction:addtags'),controller[_0x038e('0x26')]);router[_0x038e('0x27')](_0x038e('0xc'),auth[_0x038e('0x8')](),interaction['tracked'](_0x038e('0x25'),_0x038e('0x28')),controller[_0x038e('0x29')]);router[_0x038e('0x27')]('/:id/custom_update',controller[_0x038e('0x2a')]);router[_0x038e('0x27')](_0x038e('0x2b'),auth[_0x038e('0xd')](),controller[_0x038e('0x2c')]);router[_0x038e('0x27')]('/:id/close',controller['close']);router[_0x038e('0x2d')](_0x038e('0xc'),auth[_0x038e('0x8')](),interaction[_0x038e('0x24')](_0x038e('0x25'),_0x038e('0x2e')),controller[_0x038e('0x2f')]);router[_0x038e('0x2d')](_0x038e('0x23'),auth[_0x038e('0x8')](),controller[_0x038e('0x30')]);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 e882857..ed19a6f 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 _0xe426=['TEXT','medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe426,0xac));var _0x6e42=function(_0x316b7b,_0x4f7b7b){_0x316b7b=_0x316b7b-0x0;var _0x2a7b74=_0xe426[_0x316b7b];return _0x2a7b74;};'use strict';var Sequelize=require(_0x6e42('0x0'));module[_0x6e42('0x1')]={'body':{'type':Sequelize[_0x6e42('0x2')](_0x6e42('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6e42('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6e42('0x5')]}}; \ No newline at end of file +var _0x07d6=['INTEGER','exports','TEXT'];(function(_0x195223,_0x121404){var _0x3a62dd=function(_0x3adeda){while(--_0x3adeda){_0x195223['push'](_0x195223['shift']());}};_0x3a62dd(++_0x121404);}(_0x07d6,0x1f0));var _0x607d=function(_0x456f08,_0x150572){_0x456f08=_0x456f08-0x0;var _0x4a10bc=_0x07d6[_0x456f08];return _0x4a10bc;};'use strict';var Sequelize=require('sequelize');module[_0x607d('0x0')]={'body':{'type':Sequelize[_0x607d('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x607d('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ca11b76..05f73e1 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 _0xae5f=['-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatInternalMessage','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','keys','includeAll','options','create','body','find','params','describe','get','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','push','FromId','read'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0xae5f,0xdc));var _0xfae5=function(_0x55b6f2,_0x178fbf){_0x55b6f2=_0x55b6f2-0x0;var _0x1fc1ab=_0xae5f[_0x55b6f2];return _0x1fc1ab;};'use strict';var emlformat=require(_0xfae5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfae5('0x1'));var jsonpatch=require(_0xfae5('0x2'));var rp=require(_0xfae5('0x3'));var moment=require(_0xfae5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfae5('0x5'));var util=require(_0xfae5('0x6'));var path=require(_0xfae5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfae5('0x8'));var fs=require('fs');var fs_extra=require(_0xfae5('0x9'));var _=require(_0xfae5('0xa'));var squel=require(_0xfae5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfae5('0xc'));var toCsv=require(_0xfae5('0xd'));var querystring=require(_0xfae5('0xe'));var Papa=require(_0xfae5('0xf'));var Redis=require(_0xfae5('0x10'));var authService=require(_0xfae5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfae5('0x12'));var hardwareService=require(_0xfae5('0x13'));var logger=require('../../config/logger')(_0xfae5('0x14'));var utils=require('../../config/utils');var config=require(_0xfae5('0x15'));var licenseUtil=require(_0xfae5('0x16'));var db=require(_0xfae5('0x17'))['db'];config[_0xfae5('0x18')]=_[_0xfae5('0x19')](config['redis'],{'host':_0xfae5('0x1a'),'port':0x18eb});var socket=require(_0xfae5('0x1b'))(new Redis(config[_0xfae5('0x18')]));require(_0xfae5('0x1c'))[_0xfae5('0x1d')](socket);function respondWithStatusCode(_0x561cfe,_0x8c1f49){_0x8c1f49=_0x8c1f49||0xcc;return function(_0x1d3ba6){if(_0x1d3ba6){return _0x561cfe[_0xfae5('0x1e')](_0x8c1f49);}return _0x561cfe[_0xfae5('0x1f')](_0x8c1f49)[_0xfae5('0x20')]();};}function respondWithResult(_0x4d7573,_0x15565c){_0x15565c=_0x15565c||0xc8;return function(_0x26370b){if(_0x26370b){return _0x4d7573['status'](_0x15565c)[_0xfae5('0x21')](_0x26370b);}};}function respondWithFilteredResult(_0x323378,_0x1dbc2e){return function(_0x281e85){if(_0x281e85){var _0x4acc40=typeof _0x1dbc2e[_0xfae5('0x22')]===_0xfae5('0x23')&&typeof _0x1dbc2e[_0xfae5('0x24')]==='undefined';var _0x3493d9=_0x281e85['count'];var _0x16821a=_0x4acc40?0x0:_0x1dbc2e[_0xfae5('0x22')];var _0x1a1a32=_0x4acc40?_0x281e85[_0xfae5('0x25')]:_0x1dbc2e['offset']+_0x1dbc2e['limit'];var _0x5979b7;if(_0x1a1a32>=_0x3493d9){_0x1a1a32=_0x3493d9;_0x5979b7=0xc8;}else{_0x5979b7=0xce;}_0x323378[_0xfae5('0x1f')](_0x5979b7);return _0x323378[_0xfae5('0x26')](_0xfae5('0x27'),_0x16821a+'-'+_0x1a1a32+'/'+_0x3493d9)[_0xfae5('0x21')](_0x281e85);}return null;};}function patchUpdates(_0x2b3991){return function(_0x3a1933){try{jsonpatch[_0xfae5('0x28')](_0x3a1933,_0x2b3991,!![]);}catch(_0x3be144){return BPromise['reject'](_0x3be144);}return _0x3a1933[_0xfae5('0x29')]();};}function saveUpdates(_0x540eb3,_0x53ce28){return function(_0x2d8db2){if(_0x2d8db2){return _0x2d8db2[_0xfae5('0x2a')](_0x540eb3)[_0xfae5('0x2b')](function(_0x4e8f64){return _0x4e8f64;});}return null;};}function removeEntity(_0x6e2538,_0x4b7cb2){return function(_0x12d739){if(_0x12d739){return _0x12d739[_0xfae5('0x2c')]()['then'](function(){_0x6e2538[_0xfae5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8fc92d,_0x14c14d){return function(_0x1e5984){if(!_0x1e5984){_0x8fc92d[_0xfae5('0x1e')](0x194);}return _0x1e5984;};}function handleError(_0x243d00,_0x9da725){_0x9da725=_0x9da725||0x1f4;return function(_0x3ae786){logger[_0xfae5('0x2d')](_0x3ae786[_0xfae5('0x2e')]);if(_0x3ae786[_0xfae5('0x2f')]){delete _0x3ae786[_0xfae5('0x2f')];}_0x243d00[_0xfae5('0x1f')](_0x9da725)['send'](_0x3ae786);};}exports[_0xfae5('0x30')]=function(_0x299133,_0x4d4518){var _0x266a4a={},_0x54c734={},_0x1648ab={'count':0x0,'rows':[]};var _0x3303d9=_[_0xfae5('0x31')](db[_0xfae5('0x32')][_0xfae5('0x33')],function(_0x15c492){return{'name':_0x15c492['fieldName'],'type':_0x15c492[_0xfae5('0x34')]['key']};});_0x54c734['model']=_[_0xfae5('0x31')](_0x3303d9,_0xfae5('0x2f'));_0x54c734[_0xfae5('0x35')]=_['keys'](_0x299133[_0xfae5('0x35')]);_0x54c734[_0xfae5('0x36')]=_[_0xfae5('0x37')](_0x54c734[_0xfae5('0x38')],_0x54c734[_0xfae5('0x35')]);_0x266a4a[_0xfae5('0x39')]=_[_0xfae5('0x37')](_0x54c734[_0xfae5('0x38')],qs['fields'](_0x299133['query'][_0xfae5('0x3a')]));_0x266a4a[_0xfae5('0x39')]=_0x266a4a['attributes'][_0xfae5('0x3b')]?_0x266a4a[_0xfae5('0x39')]:_0x54c734[_0xfae5('0x38')];if(!_0x299133[_0xfae5('0x35')][_0xfae5('0x3c')]('nolimit')){_0x266a4a[_0xfae5('0x24')]=qs[_0xfae5('0x24')](_0x299133['query'][_0xfae5('0x24')]);_0x266a4a[_0xfae5('0x22')]=qs[_0xfae5('0x22')](_0x299133[_0xfae5('0x35')]['offset']);}_0x266a4a[_0xfae5('0x3d')]=qs[_0xfae5('0x3e')](_0x299133[_0xfae5('0x35')][_0xfae5('0x3e')]);_0x266a4a[_0xfae5('0x3f')]=qs[_0xfae5('0x36')](_[_0xfae5('0x40')](_0x299133[_0xfae5('0x35')],_0x54c734[_0xfae5('0x36')]),_0x3303d9);if(_0x299133[_0xfae5('0x35')][_0xfae5('0x41')]){_0x266a4a[_0xfae5('0x3f')]=_[_0xfae5('0x42')](_0x266a4a['where'],{'$or':_[_0xfae5('0x31')](_0x3303d9,function(_0x498f1b){if(_0x498f1b['type']!=='VIRTUAL'){var _0x39c8af={};_0x39c8af[_0x498f1b[_0xfae5('0x2f')]]={'$like':'%'+_0x299133[_0xfae5('0x35')][_0xfae5('0x41')]+'%'};return _0x39c8af;}})});}_0x266a4a=_[_0xfae5('0x42')]({},_0x266a4a,_0x299133['options']);var _0x678fbf={'where':_0x266a4a[_0xfae5('0x3f')]};return db[_0xfae5('0x32')][_0xfae5('0x25')](_0x678fbf)[_0xfae5('0x2b')](function(_0x680ef4){_0x1648ab['count']=_0x680ef4;if(_0x299133[_0xfae5('0x35')]['includeAll']){_0x266a4a[_0xfae5('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xfae5('0x44')](_0x266a4a);})[_0xfae5('0x2b')](function(_0x1406ce){_0x1648ab[_0xfae5('0x45')]=_0x1406ce;return _0x1648ab;})['then'](respondWithFilteredResult(_0x4d4518,_0x266a4a))[_0xfae5('0x46')](handleError(_0x4d4518,null));};exports['show']=function(_0x23ef0d,_0x262b38){var _0x4fd014={'raw':!![],'where':{'id':_0x23ef0d['params']['id']}},_0x5ec947={};_0x5ec947['model']=_[_0xfae5('0x47')](db[_0xfae5('0x32')][_0xfae5('0x33')]);_0x5ec947[_0xfae5('0x35')]=_[_0xfae5('0x47')](_0x23ef0d[_0xfae5('0x35')]);_0x5ec947[_0xfae5('0x36')]=_['intersection'](_0x5ec947[_0xfae5('0x38')],_0x5ec947['query']);_0x4fd014[_0xfae5('0x39')]=_[_0xfae5('0x37')](_0x5ec947[_0xfae5('0x38')],qs['fields'](_0x23ef0d['query'][_0xfae5('0x3a')]));_0x4fd014[_0xfae5('0x39')]=_0x4fd014['attributes'][_0xfae5('0x3b')]?_0x4fd014[_0xfae5('0x39')]:_0x5ec947[_0xfae5('0x38')];if(_0x23ef0d['query'][_0xfae5('0x48')]){_0x4fd014['include']=[{'all':!![]}];}_0x4fd014=_['merge']({},_0x4fd014,_0x23ef0d[_0xfae5('0x49')]);return db['ChatInternalMessage']['find'](_0x4fd014)[_0xfae5('0x2b')](handleEntityNotFound(_0x262b38,null))[_0xfae5('0x2b')](respondWithResult(_0x262b38,null))[_0xfae5('0x46')](handleError(_0x262b38,null));};exports['create']=function(_0x1b6e83,_0xa6a595){return db[_0xfae5('0x32')][_0xfae5('0x4a')](_0x1b6e83['body'],{})[_0xfae5('0x2b')](respondWithResult(_0xa6a595,0xc9))['catch'](handleError(_0xa6a595,null));};exports[_0xfae5('0x2a')]=function(_0x36cbf3,_0x442f02){if(_0x36cbf3[_0xfae5('0x4b')]['id']){delete _0x36cbf3[_0xfae5('0x4b')]['id'];}return db[_0xfae5('0x32')][_0xfae5('0x4c')]({'where':{'id':_0x36cbf3[_0xfae5('0x4d')]['id']}})[_0xfae5('0x2b')](handleEntityNotFound(_0x442f02,null))[_0xfae5('0x2b')](saveUpdates(_0x36cbf3[_0xfae5('0x4b')],null))[_0xfae5('0x2b')](respondWithResult(_0x442f02,null))['catch'](handleError(_0x442f02,null));};exports[_0xfae5('0x2c')]=function(_0x12a5a3,_0x463143){return db[_0xfae5('0x32')][_0xfae5('0x4c')]({'where':{'id':_0x12a5a3[_0xfae5('0x4d')]['id']}})[_0xfae5('0x2b')](handleEntityNotFound(_0x463143,null))[_0xfae5('0x2b')](removeEntity(_0x463143,null))['catch'](handleError(_0x463143,null));};exports['describe']=function(_0x512369,_0x5d52f8){return db[_0xfae5('0x32')][_0xfae5('0x4e')]()[_0xfae5('0x2b')](respondWithResult(_0x5d52f8,null))[_0xfae5('0x46')](handleError(_0x5d52f8,null));};function wrapUser(_0xfd144a){return function(_0x1ad3be){var _0x3cbf52=_0xfd144a[_0xfae5('0x4f')]({'plain':!![]});_0x3cbf52[_0xfae5('0x50')]=[];if(_0x1ad3be){_0x3cbf52['lastMessageAt']=_0x1ad3be[_0xfae5('0x51')];_0x3cbf52[_0xfae5('0x52')]=_0x1ad3be;}else{_0x3cbf52[_0xfae5('0x53')]=moment(0x0)['format'](_0xfae5('0x54'));_0x3cbf52[_0xfae5('0x52')]={};}return _0x3cbf52;};}exports[_0xfae5('0x55')]=function(_0x7714bc,_0x31bdcf,_0x144c42){var _0x306a70=[];return db['User'][_0xfae5('0x44')]({'where':{'role':[_0xfae5('0x56'),_0xfae5('0x57'),_0xfae5('0x58')]},'attributes':['id',_0xfae5('0x59'),_0xfae5('0x2f'),_0xfae5('0x5a'),_0xfae5('0x5b'),_0xfae5('0x5c'),_0xfae5('0x5d'),_0xfae5('0x5e'),_0xfae5('0x5f'),'showWebBar'],'order':qs[_0xfae5('0x3e')]('-online'),'include':[{'model':db[_0xfae5('0x60')],'as':_0xfae5('0x61'),'attributes':['id',_0xfae5('0x2f'),_0xfae5('0x34')],'through':{'attributes':[]}}]})[_0xfae5('0x2b')](function(_0x413dce){if(_0x413dce){var _0x12a642=_0x7714bc[_0xfae5('0x58')]['get']({'plain':!![]});if(!_0x12a642)throw new Error(_0xfae5('0x62'));if(_0x12a642[_0xfae5('0x5a')]===_0xfae5('0x58')){return db[_0xfae5('0x63')]['find']({'where':{'name':_0xfae5('0x64'),'userProfileId':_0x12a642['userProfileId']},'raw':!![]})[_0xfae5('0x2b')](function(_0x1be189){if(_0x1be189){if(_0x1be189[_0xfae5('0x65')]===0x0){return db[_0xfae5('0x66')][_0xfae5('0x44')]({'where':{'sectionId':_0x1be189['id']},'raw':!![]})[_0xfae5('0x2b')](function(_0x1faf0b){var _0x52e39a=[];if(_[_0xfae5('0x67')](_0x1faf0b)){_0x52e39a=_[_0xfae5('0x41')](_0x413dce,function(_0x351132){if(_0x351132['role']!==_0xfae5('0x56')){return _0x351132;}});return _0x52e39a;}else{for(var _0x132ac2=0x0;_0x132ac2<_0x413dce[_0xfae5('0x3b')];_0x132ac2++){var _0x4556b9=_0x413dce[_0x132ac2];if(_0x4556b9['role']===_0xfae5('0x56')){var _0xd16d53=_['find'](_0x1faf0b,function(_0x4488a0){return _0x4488a0['resourceId']===_0x4556b9['id'];});if(_0xd16d53)_0x52e39a[_0xfae5('0x68')](_0x4556b9);}else{_0x52e39a['push'](_0x4556b9);}}return _0x52e39a;}});}else{return _0x413dce;}}else{var _0x5780b9=_['filter'](_0x413dce,function(_0x4a11fc){if(_0x4a11fc[_0xfae5('0x5a')]!=='agent'){return _0x4a11fc;}});return _0x5780b9;}});}else{return _0x413dce;}}})[_0xfae5('0x2b')](function(_0x40e063){var _0xebcdea=[];if(_0x40e063){_0x306a70=_0x40e063;for(var _0x3d2430=0x0;_0x3d2430<_0x40e063[_0xfae5('0x3b')];_0x3d2430+=0x1){_0x306a70[_0x3d2430]['messages']=[];_0xebcdea[_0xfae5('0x68')](db[_0xfae5('0x32')][_0xfae5('0x4c')]({'where':{'FromId':[_0x7714bc[_0xfae5('0x58')]['id'],_0x40e063[_0x3d2430]['id']],'ToId':[_0x7714bc[_0xfae5('0x58')]['id'],_0x40e063[_0x3d2430]['id']],'ChatGroupId':null},'attributes':['id',_0xfae5('0x51'),_0xfae5('0x69'),'ToId',_0xfae5('0x6a'),_0xfae5('0x4b')],'order':qs[_0xfae5('0x3e')](_0xfae5('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfae5('0x2b')](wrapUser(_0x40e063[_0x3d2430])));}return BPromise[_0xfae5('0x6c')](_0xebcdea);}return[];})[_0xfae5('0x2b')](function(_0x15afd3){return{'rows':_0x15afd3,'count':_0x15afd3[_0xfae5('0x3b')]};})[_0xfae5('0x2b')](respondWithResult(_0x31bdcf,null))[_0xfae5('0x46')](handleError(_0x31bdcf,null));}; \ No newline at end of file +var _0xd89d=['length','find','create','update','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','fullname','role','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','user','UserProfileSection','Agents','userProfileId','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./chatInternalMessage.socket','register','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','ChatInternalMessage','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','catch','show','params','keys'];(function(_0x2920dd,_0x19d049){var _0x5d4e52=function(_0x46c751){while(--_0x46c751){_0x2920dd['push'](_0x2920dd['shift']());}};_0x5d4e52(++_0x19d049);}(_0xd89d,0x1c3));var _0xdd89=function(_0xbb3efa,_0x43ae72){_0xbb3efa=_0xbb3efa-0x0;var _0x281171=_0xd89d[_0xbb3efa];return _0x281171;};'use strict';var emlformat=require(_0xdd89('0x0'));var rimraf=require(_0xdd89('0x1'));var zipdir=require(_0xdd89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd89('0x3'));var moment=require(_0xdd89('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd89('0x5'));var util=require(_0xdd89('0x6'));var path=require('path');var sox=require(_0xdd89('0x7'));var csv=require(_0xdd89('0x8'));var ejs=require(_0xdd89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd89('0xa'));var squel=require(_0xdd89('0xb'));var crypto=require(_0xdd89('0xc'));var jsforce=require(_0xdd89('0xd'));var deskjs=require(_0xdd89('0xe'));var toCsv=require(_0xdd89('0x8'));var querystring=require(_0xdd89('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd89('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdd89('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd89('0x12'))('api');var utils=require(_0xdd89('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xdd89('0x14'));var db=require(_0xdd89('0x15'))['db'];config[_0xdd89('0x16')]=_[_0xdd89('0x17')](config[_0xdd89('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdd89('0x18'))[_0xdd89('0x19')](socket);function respondWithStatusCode(_0x22b0e4,_0x37e9cd){_0x37e9cd=_0x37e9cd||0xcc;return function(_0x2c3643){if(_0x2c3643){return _0x22b0e4['sendStatus'](_0x37e9cd);}return _0x22b0e4['status'](_0x37e9cd)[_0xdd89('0x1a')]();};}function respondWithResult(_0x4e728f,_0x32cce8){_0x32cce8=_0x32cce8||0xc8;return function(_0x51107d){if(_0x51107d){return _0x4e728f['status'](_0x32cce8)[_0xdd89('0x1b')](_0x51107d);}};}function respondWithFilteredResult(_0x31b242,_0x4af1e4){return function(_0x191999){if(_0x191999){var _0x2b9d56=typeof _0x4af1e4[_0xdd89('0x1c')]==='undefined'&&typeof _0x4af1e4[_0xdd89('0x1d')]===_0xdd89('0x1e');var _0x458915=_0x191999[_0xdd89('0x1f')];var _0x447a7a=_0x2b9d56?0x0:_0x4af1e4[_0xdd89('0x1c')];var _0x2bd687=_0x2b9d56?_0x191999[_0xdd89('0x1f')]:_0x4af1e4[_0xdd89('0x1c')]+_0x4af1e4[_0xdd89('0x1d')];var _0x2219d3;if(_0x2bd687>=_0x458915){_0x2bd687=_0x458915;_0x2219d3=0xc8;}else{_0x2219d3=0xce;}_0x31b242[_0xdd89('0x20')](_0x2219d3);return _0x31b242[_0xdd89('0x21')](_0xdd89('0x22'),_0x447a7a+'-'+_0x2bd687+'/'+_0x458915)['json'](_0x191999);}return null;};}function patchUpdates(_0x49f157){return function(_0x1654ec){try{jsonpatch[_0xdd89('0x23')](_0x1654ec,_0x49f157,!![]);}catch(_0x25f342){return BPromise[_0xdd89('0x24')](_0x25f342);}return _0x1654ec[_0xdd89('0x25')]();};}function saveUpdates(_0xe8c91d,_0x41a761){return function(_0x35914f){if(_0x35914f){return _0x35914f['update'](_0xe8c91d)[_0xdd89('0x26')](function(_0x1f78e6){return _0x1f78e6;});}return null;};}function removeEntity(_0x5d2601,_0x3989d1){return function(_0x4f466f){if(_0x4f466f){return _0x4f466f[_0xdd89('0x27')]()[_0xdd89('0x26')](function(){_0x5d2601['status'](0xcc)[_0xdd89('0x1a')]();});}};}function handleEntityNotFound(_0xba0ad6,_0x2b0825){return function(_0x349c98){if(!_0x349c98){_0xba0ad6[_0xdd89('0x28')](0x194);}return _0x349c98;};}function handleError(_0x26e589,_0xd66b3a){_0xd66b3a=_0xd66b3a||0x1f4;return function(_0x13d5e2){logger[_0xdd89('0x29')](_0x13d5e2['stack']);if(_0x13d5e2[_0xdd89('0x2a')]){delete _0x13d5e2['name'];}_0x26e589[_0xdd89('0x20')](_0xd66b3a)[_0xdd89('0x2b')](_0x13d5e2);};}exports[_0xdd89('0x2c')]=function(_0x4a8ae2,_0x32b1f3){var _0x4fba07={},_0x17362c={},_0x3067b2={'count':0x0,'rows':[]};var _0x3199f8=_['map'](db[_0xdd89('0x2d')]['rawAttributes'],function(_0x18502f){return{'name':_0x18502f[_0xdd89('0x2e')],'type':_0x18502f[_0xdd89('0x2f')][_0xdd89('0x30')]};});_0x17362c[_0xdd89('0x31')]=_[_0xdd89('0x32')](_0x3199f8,'name');_0x17362c[_0xdd89('0x33')]=_['keys'](_0x4a8ae2[_0xdd89('0x33')]);_0x17362c[_0xdd89('0x34')]=_[_0xdd89('0x35')](_0x17362c[_0xdd89('0x31')],_0x17362c[_0xdd89('0x33')]);_0x4fba07['attributes']=_[_0xdd89('0x35')](_0x17362c[_0xdd89('0x31')],qs[_0xdd89('0x36')](_0x4a8ae2[_0xdd89('0x33')][_0xdd89('0x36')]));_0x4fba07[_0xdd89('0x37')]=_0x4fba07[_0xdd89('0x37')]['length']?_0x4fba07['attributes']:_0x17362c[_0xdd89('0x31')];if(!_0x4a8ae2[_0xdd89('0x33')][_0xdd89('0x38')](_0xdd89('0x39'))){_0x4fba07[_0xdd89('0x1d')]=qs[_0xdd89('0x1d')](_0x4a8ae2[_0xdd89('0x33')][_0xdd89('0x1d')]);_0x4fba07[_0xdd89('0x1c')]=qs[_0xdd89('0x1c')](_0x4a8ae2['query'][_0xdd89('0x1c')]);}_0x4fba07['order']=qs['sort'](_0x4a8ae2['query'][_0xdd89('0x3a')]);_0x4fba07[_0xdd89('0x3b')]=qs['filters'](_[_0xdd89('0x3c')](_0x4a8ae2['query'],_0x17362c[_0xdd89('0x34')]),_0x3199f8);if(_0x4a8ae2['query']['filter']){_0x4fba07[_0xdd89('0x3b')]=_[_0xdd89('0x3d')](_0x4fba07[_0xdd89('0x3b')],{'$or':_[_0xdd89('0x32')](_0x3199f8,function(_0x655ee3){if(_0x655ee3[_0xdd89('0x2f')]!==_0xdd89('0x3e')){var _0x1511a6={};_0x1511a6[_0x655ee3[_0xdd89('0x2a')]]={'$like':'%'+_0x4a8ae2[_0xdd89('0x33')]['filter']+'%'};return _0x1511a6;}})});}_0x4fba07=_['merge']({},_0x4fba07,_0x4a8ae2['options']);var _0x3b1ad0={'where':_0x4fba07[_0xdd89('0x3b')]};return db[_0xdd89('0x2d')]['count'](_0x3b1ad0)[_0xdd89('0x26')](function(_0x2b37db){_0x3067b2[_0xdd89('0x1f')]=_0x2b37db;if(_0x4a8ae2[_0xdd89('0x33')][_0xdd89('0x3f')]){_0x4fba07[_0xdd89('0x40')]=[{'all':!![]}];}return db[_0xdd89('0x2d')]['findAll'](_0x4fba07);})['then'](function(_0x131500){_0x3067b2['rows']=_0x131500;return _0x3067b2;})[_0xdd89('0x26')](respondWithFilteredResult(_0x32b1f3,_0x4fba07))[_0xdd89('0x41')](handleError(_0x32b1f3,null));};exports[_0xdd89('0x42')]=function(_0x170bf6,_0x18ed0b){var _0xb8911={'raw':!![],'where':{'id':_0x170bf6[_0xdd89('0x43')]['id']}},_0x5a5a92={};_0x5a5a92[_0xdd89('0x31')]=_[_0xdd89('0x44')](db[_0xdd89('0x2d')]['rawAttributes']);_0x5a5a92[_0xdd89('0x33')]=_[_0xdd89('0x44')](_0x170bf6[_0xdd89('0x33')]);_0x5a5a92['filters']=_['intersection'](_0x5a5a92[_0xdd89('0x31')],_0x5a5a92[_0xdd89('0x33')]);_0xb8911[_0xdd89('0x37')]=_[_0xdd89('0x35')](_0x5a5a92[_0xdd89('0x31')],qs[_0xdd89('0x36')](_0x170bf6[_0xdd89('0x33')][_0xdd89('0x36')]));_0xb8911[_0xdd89('0x37')]=_0xb8911[_0xdd89('0x37')][_0xdd89('0x45')]?_0xb8911[_0xdd89('0x37')]:_0x5a5a92[_0xdd89('0x31')];if(_0x170bf6[_0xdd89('0x33')][_0xdd89('0x3f')]){_0xb8911[_0xdd89('0x40')]=[{'all':!![]}];}_0xb8911=_[_0xdd89('0x3d')]({},_0xb8911,_0x170bf6['options']);return db[_0xdd89('0x2d')][_0xdd89('0x46')](_0xb8911)[_0xdd89('0x26')](handleEntityNotFound(_0x18ed0b,null))[_0xdd89('0x26')](respondWithResult(_0x18ed0b,null))['catch'](handleError(_0x18ed0b,null));};exports[_0xdd89('0x47')]=function(_0x54edef,_0x2f53eb){return db[_0xdd89('0x2d')]['create'](_0x54edef['body'],{})['then'](respondWithResult(_0x2f53eb,0xc9))[_0xdd89('0x41')](handleError(_0x2f53eb,null));};exports[_0xdd89('0x48')]=function(_0x2686cf,_0x203164){if(_0x2686cf[_0xdd89('0x49')]['id']){delete _0x2686cf[_0xdd89('0x49')]['id'];}return db[_0xdd89('0x2d')][_0xdd89('0x46')]({'where':{'id':_0x2686cf[_0xdd89('0x43')]['id']}})['then'](handleEntityNotFound(_0x203164,null))[_0xdd89('0x26')](saveUpdates(_0x2686cf[_0xdd89('0x49')],null))[_0xdd89('0x26')](respondWithResult(_0x203164,null))['catch'](handleError(_0x203164,null));};exports[_0xdd89('0x27')]=function(_0x1c427c,_0x3b05ed){return db[_0xdd89('0x2d')]['find']({'where':{'id':_0x1c427c[_0xdd89('0x43')]['id']}})[_0xdd89('0x26')](handleEntityNotFound(_0x3b05ed,null))['then'](removeEntity(_0x3b05ed,null))['catch'](handleError(_0x3b05ed,null));};exports[_0xdd89('0x4a')]=function(_0x34b8cb,_0x2b0507){return db[_0xdd89('0x2d')]['describe']()[_0xdd89('0x26')](respondWithResult(_0x2b0507,null))[_0xdd89('0x41')](handleError(_0x2b0507,null));};function wrapUser(_0x4ed577){return function(_0xdc3386){var _0x28f2c8=_0x4ed577[_0xdd89('0x4b')]({'plain':!![]});_0x28f2c8[_0xdd89('0x4c')]=[];if(_0xdc3386){_0x28f2c8[_0xdd89('0x4d')]=_0xdc3386[_0xdd89('0x4e')];_0x28f2c8[_0xdd89('0x4f')]=_0xdc3386;}else{_0x28f2c8[_0xdd89('0x4d')]=moment(0x0)['format'](_0xdd89('0x50'));_0x28f2c8[_0xdd89('0x4f')]={};}return _0x28f2c8;};}exports['getUsers']=function(_0x63b24c,_0x441f71,_0x4f52a0){var _0x4fd363=[];return db[_0xdd89('0x51')][_0xdd89('0x52')]({'where':{'role':[_0xdd89('0x53'),_0xdd89('0x54'),'user']},'attributes':['id',_0xdd89('0x55'),'name',_0xdd89('0x56'),'userpic',_0xdd89('0x57'),_0xdd89('0x58'),_0xdd89('0x59'),'allowmessenger','showWebBar'],'order':qs['sort'](_0xdd89('0x5a')),'include':[{'model':db[_0xdd89('0x5b')],'as':_0xdd89('0x5c'),'attributes':['id','name',_0xdd89('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x51fad6){if(_0x51fad6){var _0x2d2b7d=_0x63b24c[_0xdd89('0x5d')][_0xdd89('0x4b')]({'plain':!![]});if(!_0x2d2b7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d2b7d['role']==='user'){return db[_0xdd89('0x5e')][_0xdd89('0x46')]({'where':{'name':_0xdd89('0x5f'),'userProfileId':_0x2d2b7d[_0xdd89('0x60')]},'raw':!![]})[_0xdd89('0x26')](function(_0x11cc89){if(_0x11cc89){if(_0x11cc89['autoAssociation']===0x0){return db[_0xdd89('0x61')][_0xdd89('0x52')]({'where':{'sectionId':_0x11cc89['id']},'raw':!![]})[_0xdd89('0x26')](function(_0x27cd8e){var _0x4a8df1=[];if(_['isEmpty'](_0x27cd8e)){_0x4a8df1=_['filter'](_0x51fad6,function(_0x84eeda){if(_0x84eeda[_0xdd89('0x56')]!==_0xdd89('0x53')){return _0x84eeda;}});return _0x4a8df1;}else{for(var _0x4e1daa=0x0;_0x4e1daa<_0x51fad6[_0xdd89('0x45')];_0x4e1daa++){var _0x512672=_0x51fad6[_0x4e1daa];if(_0x512672[_0xdd89('0x56')]===_0xdd89('0x53')){var _0x473c13=_[_0xdd89('0x46')](_0x27cd8e,function(_0x18a072){return _0x18a072[_0xdd89('0x62')]===_0x512672['id'];});if(_0x473c13)_0x4a8df1[_0xdd89('0x63')](_0x512672);}else{_0x4a8df1['push'](_0x512672);}}return _0x4a8df1;}});}else{return _0x51fad6;}}else{var _0x3a1d0c=_['filter'](_0x51fad6,function(_0x400da9){if(_0x400da9[_0xdd89('0x56')]!=='agent'){return _0x400da9;}});return _0x3a1d0c;}});}else{return _0x51fad6;}}})[_0xdd89('0x26')](function(_0x1680bb){var _0x400b39=[];if(_0x1680bb){_0x4fd363=_0x1680bb;for(var _0x127652=0x0;_0x127652<_0x1680bb[_0xdd89('0x45')];_0x127652+=0x1){_0x4fd363[_0x127652][_0xdd89('0x4c')]=[];_0x400b39[_0xdd89('0x63')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x63b24c[_0xdd89('0x5d')]['id'],_0x1680bb[_0x127652]['id']],'ToId':[_0x63b24c[_0xdd89('0x5d')]['id'],_0x1680bb[_0x127652]['id']],'ChatGroupId':null},'attributes':['id',_0xdd89('0x4e'),_0xdd89('0x64'),_0xdd89('0x65'),_0xdd89('0x66'),_0xdd89('0x49')],'order':qs[_0xdd89('0x3a')](_0xdd89('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x1680bb[_0x127652])));}return BPromise['all'](_0x400b39);}return[];})['then'](function(_0x39618f){return{'rows':_0x39618f,'count':_0x39618f[_0xdd89('0x45')]};})[_0xdd89('0x26')](respondWithResult(_0x441f71,null))['catch'](handleError(_0x441f71,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 424363a..b38d156 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 _0x943d=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x4a464e,_0x250abf){var _0x54d070=function(_0xf56d7){while(--_0xf56d7){_0x4a464e['push'](_0x4a464e['shift']());}};_0x54d070(++_0x250abf);}(_0x943d,0x155));var _0xd943=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x943d[_0x305486];return _0xa04940;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xd943('0x0'))['db'][_0xd943('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd943('0x2')](0x0);var events={'afterCreate':_0xd943('0x3'),'afterUpdate':_0xd943('0x4'),'afterDestroy':_0xd943('0x5')};function emitEvent(_0x21052e){return function(_0x3cbb0d,_0xf6c0e3,_0xd005c7){ChatInternalMessageEvents[_0xd943('0x6')](_0x21052e+':'+_0x3cbb0d['id'],_0x3cbb0d);ChatInternalMessageEvents[_0xd943('0x6')](_0x21052e,_0x3cbb0d);_0xd005c7(null);};}for(var e in events){if(events[_0xd943('0x7')](e)){var event=events[e];ChatInternalMessage[_0xd943('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x2902=['hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x2902,0x77));var _0x2290=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x2902[_0x5b1c50];return _0x2d379b;};'use strict';var EventEmitter=require(_0x2290('0x0'));var ChatInternalMessage=require(_0x2290('0x1'))['db'][_0x2290('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2290('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2290('0x4'),'afterDestroy':_0x2290('0x5')};function emitEvent(_0x1beffb){return function(_0x511ff6,_0x585868,_0x208f8a){ChatInternalMessageEvents[_0x2290('0x6')](_0x1beffb+':'+_0x511ff6['id'],_0x511ff6);ChatInternalMessageEvents['emit'](_0x1beffb,_0x511ff6);_0x208f8a(null);};}for(var e in events){if(events[_0x2290('0x7')](e)){var event=events[e];ChatInternalMessage[_0x2290('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d1d928b..cbf36dd 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 _0x4d68=['api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util'];(function(_0x93b6aa,_0x19ca6e){var _0x580214=function(_0x55888b){while(--_0x55888b){_0x93b6aa['push'](_0x93b6aa['shift']());}};_0x580214(++_0x19ca6e);}(_0x4d68,0x19e));var _0x84d6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4d68[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var logger=require('../../config/logger')(_0x84d6('0x2'));var moment=require(_0x84d6('0x3'));var BPromise=require(_0x84d6('0x4'));var rp=require(_0x84d6('0x5'));var fs=require('fs');var path=require(_0x84d6('0x6'));var rimraf=require(_0x84d6('0x7'));var config=require('../../config/environment');var attributes=require(_0x84d6('0x8'));module['exports']=function(_0x49e5c6,_0x57be95){return _0x49e5c6[_0x84d6('0x9')](_0x84d6('0xa'),attributes,{'tableName':_0x84d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x84d6('0xc')});}; \ No newline at end of file +var _0xdbdf=['define','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xdbdf,0x106));var _0xfdbd=function(_0x271466,_0x13f1d9){_0x271466=_0x271466-0x0;var _0x26d395=_0xdbdf[_0x271466];return _0x26d395;};'use strict';var _=require(_0xfdbd('0x0'));var util=require(_0xfdbd('0x1'));var logger=require(_0xfdbd('0x2'))(_0xfdbd('0x3'));var moment=require(_0xfdbd('0x4'));var BPromise=require(_0xfdbd('0x5'));var rp=require(_0xfdbd('0x6'));var fs=require('fs');var path=require(_0xfdbd('0x7'));var rimraf=require(_0xfdbd('0x8'));var config=require('../../config/environment');var attributes=require(_0xfdbd('0x9'));module[_0xfdbd('0xa')]=function(_0x158cf1,_0x4e239b){return _0x158cf1[_0xfdbd('0xb')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfdbd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 466c071..a795390 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 _0xe1ce=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x46f736,_0x39930d){var _0x480865=function(_0x531f1e){while(--_0x531f1e){_0x46f736['push'](_0x46f736['shift']());}};_0x480865(++_0x39930d);}(_0xe1ce,0x15e));var _0xee1c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe1ce[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xee1c('0x0'));var util=require(_0xee1c('0x1'));var moment=require(_0xee1c('0x2'));var BPromise=require(_0xee1c('0x3'));var rs=require(_0xee1c('0x4'));var fs=require('fs');var Redis=require(_0xee1c('0x5'));var db=require(_0xee1c('0x6'))['db'];var utils=require(_0xee1c('0x7'));var logger=require(_0xee1c('0x8'))(_0xee1c('0x9'));var config=require('../../config/environment');var jayson=require(_0xee1c('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xee1c('0xb')]=_[_0xee1c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee1c('0xb')]));require(_0xee1c('0xd'))[_0xee1c('0xe')](socket);function respondWithRpcPromise(_0x1b1cca,_0x4e5fcd,_0x458b53){return new BPromise(function(_0x451be7,_0x56fe63){return client[_0xee1c('0xf')](_0x1b1cca,_0x458b53)[_0xee1c('0x10')](function(_0x562266){logger['info'](_0xee1c('0x11'),_0x4e5fcd,_0xee1c('0x12'));logger[_0xee1c('0x13')](_0xee1c('0x14'),_0x4e5fcd,_0xee1c('0x12'),JSON[_0xee1c('0x15')](_0x562266));if(_0x562266['error']){if(_0x562266[_0xee1c('0x16')][_0xee1c('0x17')]===0x1f4){logger['error'](_0xee1c('0x11'),_0x4e5fcd,_0x562266['error']['message']);return _0x56fe63(_0x562266[_0xee1c('0x16')]['message']);}logger[_0xee1c('0x16')](_0xee1c('0x11'),_0x4e5fcd,_0x562266['error'][_0xee1c('0x18')]);return _0x451be7(_0x562266[_0xee1c('0x16')][_0xee1c('0x18')]);}else{logger['info'](_0xee1c('0x11'),_0x4e5fcd,_0xee1c('0x12'));_0x451be7(_0x562266[_0xee1c('0x19')][_0xee1c('0x18')]);}})[_0xee1c('0x1a')](function(_0x3994b4){logger[_0xee1c('0x16')](_0xee1c('0x11'),_0x4e5fcd,_0x3994b4);_0x56fe63(_0x3994b4);});});} \ No newline at end of file +var _0xe142=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2f2a6f,_0xe63e10){var _0x14441d=function(_0x3ab031){while(--_0x3ab031){_0x2f2a6f['push'](_0x2f2a6f['shift']());}};_0x14441d(++_0xe63e10);}(_0xe142,0xaa));var _0x2e14=function(_0x212860,_0x114464){_0x212860=_0x212860-0x0;var _0x577708=_0xe142[_0x212860];return _0x577708;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e14('0x0'));var BPromise=require('bluebird');var rs=require(_0x2e14('0x1'));var fs=require('fs');var Redis=require(_0x2e14('0x2'));var db=require(_0x2e14('0x3'))['db'];var utils=require(_0x2e14('0x4'));var logger=require(_0x2e14('0x5'))(_0x2e14('0x6'));var config=require('../../config/environment');var jayson=require(_0x2e14('0x7'));var client=jayson[_0x2e14('0x8')][_0x2e14('0x9')]({'port':0x232a});config[_0x2e14('0xa')]=_[_0x2e14('0xb')](config[_0x2e14('0xa')],{'host':_0x2e14('0xc'),'port':0x18eb});var socket=require(_0x2e14('0xd'))(new Redis(config[_0x2e14('0xa')]));require('./chatInternalMessage.socket')[_0x2e14('0xe')](socket);function respondWithRpcPromise(_0x9d235b,_0x5a48d6,_0x5d921d){return new BPromise(function(_0x1e3713,_0x22f1b3){return client['request'](_0x9d235b,_0x5d921d)[_0x2e14('0xf')](function(_0x2be8db){logger['info'](_0x2e14('0x10'),_0x5a48d6,_0x2e14('0x11'));logger[_0x2e14('0x12')](_0x2e14('0x13'),_0x5a48d6,_0x2e14('0x11'),JSON[_0x2e14('0x14')](_0x2be8db));if(_0x2be8db[_0x2e14('0x15')]){if(_0x2be8db[_0x2e14('0x15')]['code']===0x1f4){logger[_0x2e14('0x15')](_0x2e14('0x10'),_0x5a48d6,_0x2be8db[_0x2e14('0x15')]['message']);return _0x22f1b3(_0x2be8db[_0x2e14('0x15')][_0x2e14('0x16')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x5a48d6,_0x2be8db[_0x2e14('0x15')]['message']);return _0x1e3713(_0x2be8db[_0x2e14('0x15')][_0x2e14('0x16')]);}else{logger['info'](_0x2e14('0x10'),_0x5a48d6,_0x2e14('0x11'));_0x1e3713(_0x2be8db[_0x2e14('0x17')][_0x2e14('0x16')]);}})[_0x2e14('0x18')](function(_0x2e6760){logger[_0x2e14('0x15')](_0x2e14('0x10'),_0x5a48d6,_0x2e6760);_0x22f1b3(_0x2e6760);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 57e1e7e..d19b2cb 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 _0x3f67=['chatInternalMessage:','save','remove','update','emit','removeListener','register','length'];(function(_0x52015b,_0x14e87b){var _0x5f01be=function(_0x513d45){while(--_0x513d45){_0x52015b['push'](_0x52015b['shift']());}};_0x5f01be(++_0x14e87b);}(_0x3f67,0x89));var _0x73f6=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0x3f67[_0x5c6ceb];return _0x28821b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x73f6('0x0'),_0x73f6('0x1'),_0x73f6('0x2')];function createListener(_0x35be9f,_0x3e4dec){return function(_0x14c773){_0x3e4dec[_0x73f6('0x3')](_0x35be9f,_0x14c773);};}function removeListener(_0x2e0ad5,_0x3cd3c4){return function(){ChatInternalMessageEvents[_0x73f6('0x4')](_0x2e0ad5,_0x3cd3c4);};}exports[_0x73f6('0x5')]=function(_0x37679f){for(var _0x4b2323=0x0,_0x1a7d71=events[_0x73f6('0x6')];_0x4b2323<_0x1a7d71;_0x4b2323++){var _0x3fcce5=events[_0x4b2323];var _0x30b6f2=createListener(_0x73f6('0x7')+_0x3fcce5,_0x37679f);ChatInternalMessageEvents['on'](_0x3fcce5,_0x30b6f2);}}; \ No newline at end of file +var _0xb2e9=['remove','update','emit','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x4d6993,_0x46c55a){var _0x32caaf=function(_0x22e4e3){while(--_0x22e4e3){_0x4d6993['push'](_0x4d6993['shift']());}};_0x32caaf(++_0x46c55a);}(_0xb2e9,0xbb));var _0x9b2e=function(_0x3bdba1,_0x50a91f){_0x3bdba1=_0x3bdba1-0x0;var _0x222f1d=_0xb2e9[_0x3bdba1];return _0x222f1d;};'use strict';var ChatInternalMessageEvents=require(_0x9b2e('0x0'));var events=[_0x9b2e('0x1'),_0x9b2e('0x2'),_0x9b2e('0x3')];function createListener(_0x4c34b8,_0xa94f22){return function(_0x54ae4e){_0xa94f22[_0x9b2e('0x4')](_0x4c34b8,_0x54ae4e);};}function removeListener(_0x370c58,_0x205730){return function(){ChatInternalMessageEvents['removeListener'](_0x370c58,_0x205730);};}exports['register']=function(_0x440cdd){for(var _0x3d122a=0x0,_0x43982c=events[_0x9b2e('0x5')];_0x3d122a<_0x43982c;_0x3d122a++){var _0x5ac3e5=events[_0x3d122a];var _0x26e8ca=createListener(_0x9b2e('0x6')+_0x5ac3e5,_0x440cdd);ChatInternalMessageEvents['on'](_0x5ac3e5,_0x26e8ca);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 37c0d4a..01d2664 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 _0x7eec=['get','isAuthenticated','index','/describe','describe','/users','getUsers','post','create','put','/:id','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x202d12,_0x232a5e){var _0x100006=function(_0x43778f){while(--_0x43778f){_0x202d12['push'](_0x202d12['shift']());}};_0x100006(++_0x232a5e);}(_0x7eec,0x149));var _0xc7ee=function(_0x2ef2ae,_0x4a740a){_0x2ef2ae=_0x2ef2ae-0x0;var _0x276928=_0x7eec[_0x2ef2ae];return _0x276928;};'use strict';var multer=require(_0xc7ee('0x0'));var util=require(_0xc7ee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc7ee('0x2')]();var fs_extra=require(_0xc7ee('0x3'));var auth=require(_0xc7ee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc7ee('0x5'));var controller=require(_0xc7ee('0x6'));router[_0xc7ee('0x7')]('/',auth[_0xc7ee('0x8')](),controller[_0xc7ee('0x9')]);router[_0xc7ee('0x7')](_0xc7ee('0xa'),auth[_0xc7ee('0x8')](),controller[_0xc7ee('0xb')]);router[_0xc7ee('0x7')](_0xc7ee('0xc'),auth[_0xc7ee('0x8')](),controller[_0xc7ee('0xd')]);router[_0xc7ee('0x7')]('/:id',auth[_0xc7ee('0x8')](),controller['show']);router[_0xc7ee('0xe')]('/',auth[_0xc7ee('0x8')](),controller[_0xc7ee('0xf')]);router[_0xc7ee('0x10')](_0xc7ee('0x11'),controller[_0xc7ee('0x12')]);router[_0xc7ee('0x13')](_0xc7ee('0x11'),auth['isAuthenticated'](),controller[_0xc7ee('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc3ed=['isAuthenticated','index','/describe','describe','/users','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','./chatInternalMessage.controller','get'];(function(_0x42befc,_0x8b04cf){var _0x1ccf6b=function(_0x1c6e0f){while(--_0x1c6e0f){_0x42befc['push'](_0x42befc['shift']());}};_0x1ccf6b(++_0x8b04cf);}(_0xc3ed,0x19d));var _0xdc3e=function(_0x25428f,_0x3e4c19){_0x25428f=_0x25428f-0x0;var _0xda115a=_0xc3ed[_0x25428f];return _0xda115a;};'use strict';var multer=require('multer');var util=require(_0xdc3e('0x0'));var path=require(_0xdc3e('0x1'));var timeout=require(_0xdc3e('0x2'));var express=require('express');var router=express[_0xdc3e('0x3')]();var fs_extra=require(_0xdc3e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc3e('0x5'));router[_0xdc3e('0x6')]('/',auth[_0xdc3e('0x7')](),controller[_0xdc3e('0x8')]);router[_0xdc3e('0x6')](_0xdc3e('0x9'),auth[_0xdc3e('0x7')](),controller[_0xdc3e('0xa')]);router['get'](_0xdc3e('0xb'),auth['isAuthenticated'](),controller['getUsers']);router[_0xdc3e('0x6')](_0xdc3e('0xc'),auth['isAuthenticated'](),controller[_0xdc3e('0xd')]);router[_0xdc3e('0xe')]('/',auth[_0xdc3e('0x7')](),controller[_0xdc3e('0xf')]);router[_0xdc3e('0x10')](_0xdc3e('0xc'),controller[_0xdc3e('0x11')]);router[_0xdc3e('0x12')]('/:id',auth[_0xdc3e('0x7')](),controller[_0xdc3e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1ca478c..52c0c11 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 _0x4c71=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x51448c,_0x17e9dc){var _0x47e735=function(_0x187ff6){while(--_0x187ff6){_0x51448c['push'](_0x51448c['shift']());}};_0x47e735(++_0x17e9dc);}(_0x4c71,0x12b));var _0x14c7=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x4c71[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x14c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x14c7('0x4')]('in',_0x14c7('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x14c7('0x6')]},'providerName':{'type':Sequelize[_0x14c7('0x7')]},'providerResponse':{'type':Sequelize[_0x14c7('0x8')]}}; \ No newline at end of file +var _0x4483=['exports','TEXT','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x1b55b5,_0xcc53e0){var _0xb4335e=function(_0x5dd98c){while(--_0x5dd98c){_0x1b55b5['push'](_0x1b55b5['shift']());}};_0xb4335e(++_0xcc53e0);}(_0x4483,0x1a3));var _0x3448=function(_0x24fe49,_0x9ea218){_0x24fe49=_0x24fe49-0x0;var _0x32adf5=_0x4483[_0x24fe49];return _0x32adf5;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'body':{'type':Sequelize[_0x3448('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3448('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3448('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3448('0x4')]('in',_0x3448('0x5')),'defaultValue':_0x3448('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3448('0x6')]},'providerResponse':{'type':Sequelize[_0x3448('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8c6d47d..37ea515 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 _0x5579=['map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','parse','chat-interactions','chat','RejectMessage','rejectMessage','User','fullname','event','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','ChatMessage','rawAttributes','fieldName','type','key'];(function(_0x4cd3f8,_0x534557){var _0x1660f8=function(_0x170ac1){while(--_0x170ac1){_0x4cd3f8['push'](_0x4cd3f8['shift']());}};_0x1660f8(++_0x534557);}(_0x5579,0x151));var _0x9557=function(_0xffd205,_0x392c2a){_0xffd205=_0xffd205-0x0;var _0x106a92=_0x5579[_0xffd205];return _0x106a92;};'use strict';var emlformat=require(_0x9557('0x0'));var rimraf=require(_0x9557('0x1'));var zipdir=require(_0x9557('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9557('0x3'));var moment=require(_0x9557('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9557('0x5'));var util=require(_0x9557('0x6'));var path=require(_0x9557('0x7'));var sox=require(_0x9557('0x8'));var csv=require(_0x9557('0x9'));var ejs=require(_0x9557('0xa'));var fs=require('fs');var fs_extra=require(_0x9557('0xb'));var _=require(_0x9557('0xc'));var squel=require(_0x9557('0xd'));var crypto=require('crypto');var jsforce=require(_0x9557('0xe'));var deskjs=require(_0x9557('0xf'));var toCsv=require(_0x9557('0x9'));var querystring=require(_0x9557('0x10'));var Papa=require(_0x9557('0x11'));var Redis=require(_0x9557('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9557('0x13'));var hardwareService=require(_0x9557('0x14'));var logger=require(_0x9557('0x15'))('api');var utils=require(_0x9557('0x16'));var config=require(_0x9557('0x17'));var licenseUtil=require(_0x9557('0x18'));var db=require(_0x9557('0x19'))['db'];config['redis']=_['defaults'](config[_0x9557('0x1a')],{'host':_0x9557('0x1b'),'port':0x18eb});var socket=require(_0x9557('0x1c'))(new Redis(config[_0x9557('0x1a')]));require('./chatMessage.socket')[_0x9557('0x1d')](socket);var jayson=require(_0x9557('0x1e'));var client=jayson['client'][_0x9557('0x1f')]({'port':0x232c});var client9002=jayson[_0x9557('0x20')][_0x9557('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3fa294,_0x879b9e,_0x4a6f66,_0x4f2c00){return new BPromise(function(_0x207be3,_0x59871b){var _0x4a509a=_0x4f2c00||client;return _0x4a509a['request'](_0x3fa294,_0x4a6f66)['then'](function(_0x7c83eb){logger['info'](_0x9557('0x21'),_0x879b9e,_0x9557('0x22'));logger[_0x9557('0x23')](_0x9557('0x24'),_0x879b9e,_0x9557('0x22'),JSON[_0x9557('0x25')](_0x7c83eb));if(_0x7c83eb[_0x9557('0x26')]){if(_0x7c83eb[_0x9557('0x26')][_0x9557('0x27')]===0x1f4){logger[_0x9557('0x26')]('ChatMessage,\x20%s,\x20%s',_0x879b9e,_0x7c83eb[_0x9557('0x26')]['message']);return _0x59871b(_0x7c83eb[_0x9557('0x26')][_0x9557('0x28')]);}logger[_0x9557('0x26')]('ChatMessage,\x20%s,\x20%s',_0x879b9e,_0x7c83eb[_0x9557('0x26')][_0x9557('0x28')]);return _0x207be3(_0x7c83eb['error'][_0x9557('0x28')]);}else{logger[_0x9557('0x29')]('ChatMessage,\x20%s,\x20%s',_0x879b9e,_0x9557('0x22'));_0x207be3(_0x7c83eb['result'][_0x9557('0x28')]);}})['catch'](function(_0x50fba2){logger[_0x9557('0x26')](_0x9557('0x21'),_0x879b9e,_0x50fba2);_0x59871b(_0x50fba2);});});}function respondWithStatusCode(_0x467081,_0x307b5c){_0x307b5c=_0x307b5c||0xcc;return function(_0x3e6917){if(_0x3e6917){return _0x467081[_0x9557('0x2a')](_0x307b5c);}return _0x467081[_0x9557('0x2b')](_0x307b5c)['end']();};}function respondWithResult(_0x4b5bc0,_0x5d8ecd){_0x5d8ecd=_0x5d8ecd||0xc8;return function(_0x5b5ab9){if(_0x5b5ab9){return _0x4b5bc0[_0x9557('0x2b')](_0x5d8ecd)[_0x9557('0x2c')](_0x5b5ab9);}};}function respondWithFilteredResult(_0x9416b5,_0x599c79){return function(_0x240c06){if(_0x240c06){var _0x474d61=typeof _0x599c79[_0x9557('0x2d')]===_0x9557('0x2e')&&typeof _0x599c79[_0x9557('0x2f')]===_0x9557('0x2e');var _0x4ca41b=_0x240c06[_0x9557('0x30')];var _0x42c433=_0x474d61?0x0:_0x599c79['offset'];var _0x591953=_0x474d61?_0x240c06[_0x9557('0x30')]:_0x599c79[_0x9557('0x2d')]+_0x599c79[_0x9557('0x2f')];var _0x25ac80;if(_0x591953>=_0x4ca41b){_0x591953=_0x4ca41b;_0x25ac80=0xc8;}else{_0x25ac80=0xce;}_0x9416b5['status'](_0x25ac80);return _0x9416b5['set'](_0x9557('0x31'),_0x42c433+'-'+_0x591953+'/'+_0x4ca41b)[_0x9557('0x2c')](_0x240c06);}return null;};}function patchUpdates(_0x314712){return function(_0x227085){try{jsonpatch[_0x9557('0x32')](_0x227085,_0x314712,!![]);}catch(_0x54c91d){return BPromise[_0x9557('0x33')](_0x54c91d);}return _0x227085[_0x9557('0x34')]();};}function saveUpdates(_0xdca481,_0x280390){return function(_0x234377){if(_0x234377){return _0x234377[_0x9557('0x35')](_0xdca481)[_0x9557('0x36')](function(_0x5e86b7){return _0x5e86b7;});}return null;};}function removeEntity(_0x29309c,_0x48136b){return function(_0x4f930a){if(_0x4f930a){return _0x4f930a[_0x9557('0x37')]()[_0x9557('0x36')](function(){_0x29309c[_0x9557('0x2b')](0xcc)[_0x9557('0x38')]();});}};}function handleEntityNotFound(_0x4d0a95,_0x45534a){return function(_0x5484b6){if(!_0x5484b6){_0x4d0a95[_0x9557('0x2a')](0x194);}return _0x5484b6;};}function handleError(_0x3e207b,_0x5ee5a1){_0x5ee5a1=_0x5ee5a1||0x1f4;return function(_0x4c254b){logger[_0x9557('0x26')](_0x4c254b[_0x9557('0x39')]);if(_0x4c254b[_0x9557('0x3a')]){delete _0x4c254b[_0x9557('0x3a')];}_0x3e207b[_0x9557('0x2b')](_0x5ee5a1)[_0x9557('0x3b')](_0x4c254b);};}exports['index']=function(_0x1bc276,_0xdb9c3c){var _0x2ecd8e={},_0x1e13a7={},_0x35802e={'count':0x0,'rows':[]};var _0xdba233=_['map'](db[_0x9557('0x3c')][_0x9557('0x3d')],function(_0x5af36c){return{'name':_0x5af36c[_0x9557('0x3e')],'type':_0x5af36c[_0x9557('0x3f')][_0x9557('0x40')]};});_0x1e13a7['model']=_[_0x9557('0x41')](_0xdba233,'name');_0x1e13a7[_0x9557('0x42')]=_[_0x9557('0x43')](_0x1bc276[_0x9557('0x42')]);_0x1e13a7[_0x9557('0x44')]=_['intersection'](_0x1e13a7['model'],_0x1e13a7[_0x9557('0x42')]);_0x2ecd8e['attributes']=_[_0x9557('0x45')](_0x1e13a7[_0x9557('0x46')],qs[_0x9557('0x47')](_0x1bc276[_0x9557('0x42')][_0x9557('0x47')]));_0x2ecd8e['attributes']=_0x2ecd8e[_0x9557('0x48')][_0x9557('0x49')]?_0x2ecd8e[_0x9557('0x48')]:_0x1e13a7[_0x9557('0x46')];if(!_0x1bc276[_0x9557('0x42')][_0x9557('0x4a')](_0x9557('0x4b'))){_0x2ecd8e[_0x9557('0x2f')]=qs[_0x9557('0x2f')](_0x1bc276[_0x9557('0x42')][_0x9557('0x2f')]);_0x2ecd8e[_0x9557('0x2d')]=qs[_0x9557('0x2d')](_0x1bc276[_0x9557('0x42')]['offset']);}_0x2ecd8e[_0x9557('0x4c')]=qs[_0x9557('0x4d')](_0x1bc276[_0x9557('0x42')]['sort']);_0x2ecd8e[_0x9557('0x4e')]=qs['filters'](_[_0x9557('0x4f')](_0x1bc276[_0x9557('0x42')],_0x1e13a7[_0x9557('0x44')]),_0xdba233);if(_0x1bc276[_0x9557('0x42')][_0x9557('0x50')]){_0x2ecd8e['where']=_[_0x9557('0x51')](_0x2ecd8e[_0x9557('0x4e')],{'$or':_[_0x9557('0x41')](_0xdba233,function(_0x3d0db3){if(_0x3d0db3[_0x9557('0x3f')]!==_0x9557('0x52')){var _0x24548a={};_0x24548a[_0x3d0db3[_0x9557('0x3a')]]={'$like':'%'+_0x1bc276[_0x9557('0x42')][_0x9557('0x50')]+'%'};return _0x24548a;}})});}_0x2ecd8e=_[_0x9557('0x51')]({},_0x2ecd8e,_0x1bc276[_0x9557('0x53')]);var _0x2ef387={'where':_0x2ecd8e[_0x9557('0x4e')]};return db[_0x9557('0x3c')][_0x9557('0x30')](_0x2ef387)[_0x9557('0x36')](function(_0x2f8ef5){_0x35802e['count']=_0x2f8ef5;if(_0x1bc276[_0x9557('0x42')][_0x9557('0x54')]){_0x2ecd8e[_0x9557('0x55')]=[{'all':!![]}];}return db[_0x9557('0x3c')]['findAll'](_0x2ecd8e);})[_0x9557('0x36')](function(_0x1e76ae){_0x35802e['rows']=_0x1e76ae;return _0x35802e;})[_0x9557('0x36')](respondWithFilteredResult(_0xdb9c3c,_0x2ecd8e))[_0x9557('0x56')](handleError(_0xdb9c3c,null));};exports['show']=function(_0x4110e9,_0x306530){var _0x189121={'raw':!![],'where':{'id':_0x4110e9[_0x9557('0x57')]['id']}},_0x1df139={};_0x1df139[_0x9557('0x46')]=_['keys'](db[_0x9557('0x3c')][_0x9557('0x3d')]);_0x1df139[_0x9557('0x42')]=_[_0x9557('0x43')](_0x4110e9[_0x9557('0x42')]);_0x1df139[_0x9557('0x44')]=_['intersection'](_0x1df139[_0x9557('0x46')],_0x1df139['query']);_0x189121['attributes']=_[_0x9557('0x45')](_0x1df139[_0x9557('0x46')],qs[_0x9557('0x47')](_0x4110e9['query'][_0x9557('0x47')]));_0x189121[_0x9557('0x48')]=_0x189121['attributes'][_0x9557('0x49')]?_0x189121[_0x9557('0x48')]:_0x1df139[_0x9557('0x46')];if(_0x4110e9[_0x9557('0x42')][_0x9557('0x54')]){_0x189121[_0x9557('0x55')]=[{'all':!![]}];}_0x189121=_[_0x9557('0x51')]({},_0x189121,_0x4110e9[_0x9557('0x53')]);return db['ChatMessage'][_0x9557('0x58')](_0x189121)[_0x9557('0x36')](handleEntityNotFound(_0x306530,null))[_0x9557('0x36')](respondWithResult(_0x306530,null))['catch'](handleError(_0x306530,null));};exports[_0x9557('0x59')]=function(_0x392712,_0x276b13){return db[_0x9557('0x3c')][_0x9557('0x59')](_0x392712['body'],{})['then'](respondWithResult(_0x276b13,0xc9))[_0x9557('0x56')](handleError(_0x276b13,null));};exports['update']=function(_0x44875a,_0x18aa64){if(_0x44875a[_0x9557('0x5a')]['id']){delete _0x44875a[_0x9557('0x5a')]['id'];}return db[_0x9557('0x3c')]['find']({'where':{'id':_0x44875a[_0x9557('0x57')]['id']}})[_0x9557('0x36')](handleEntityNotFound(_0x18aa64,null))[_0x9557('0x36')](saveUpdates(_0x44875a[_0x9557('0x5a')],null))[_0x9557('0x36')](respondWithResult(_0x18aa64,null))[_0x9557('0x56')](handleError(_0x18aa64,null));};exports[_0x9557('0x37')]=function(_0x5b986d,_0x4ff6c4){return db[_0x9557('0x3c')][_0x9557('0x58')]({'where':{'id':_0x5b986d[_0x9557('0x57')]['id']}})[_0x9557('0x36')](handleEntityNotFound(_0x4ff6c4,null))[_0x9557('0x36')](removeEntity(_0x4ff6c4,null))[_0x9557('0x56')](handleError(_0x4ff6c4,null));};exports['describe']=function(_0x2edf89,_0x3911e5){return db['ChatMessage'][_0x9557('0x5b')]()[_0x9557('0x36')](respondWithResult(_0x3911e5,null))[_0x9557('0x56')](handleError(_0x3911e5,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x9557('0x5c')]=function(_0x42bc90,_0x4697ef,_0x835396){var _0x2c15eb={'agent':{},'channel':'chat'};if(_0x42bc90['body']['id']){delete _0x42bc90['body']['id'];}_0x42bc90[_0x9557('0x5a')][_0x9557('0x5d')]=!![];_0x42bc90[_0x9557('0x5a')][_0x9557('0x5e')]=moment()[_0x9557('0x5f')](_0x9557('0x60'));_0x42bc90['body'][_0x9557('0x61')]=_0x42bc90[_0x9557('0x5a')][_0x9557('0x61')]||_0x42bc90[_0x9557('0x62')]['id'];_0x2c15eb[_0x9557('0x63')]['id']=_0x42bc90[_0x9557('0x5a')][_0x9557('0x61')];return db[_0x9557('0x3c')]['find']({'where':{'id':_0x42bc90[_0x9557('0x57')]['id'],'UserId':null}})[_0x9557('0x36')](handleEntityNotFound(_0x4697ef,null))[_0x9557('0x36')](saveUpdates(_0x42bc90[_0x9557('0x5a')],null))[_0x9557('0x36')](function(_0x5f165b){if(_0x5f165b){_0x2c15eb[_0x9557('0x28')]=_0x5f165b[_0x9557('0x64')]({'plain':!![]});return db[_0x9557('0x65')][_0x9557('0x58')]({'where':{'id':_0x5f165b[_0x9557('0x66')]}});}return null;})[_0x9557('0x36')](handleEntityNotFound(_0x4697ef,null))[_0x9557('0x36')](function(_0x5f2572){if(_0x5f2572){return _0x5f2572['update']({'UserId':_0x42bc90[_0x9557('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x5f2572['read1stAt'])?moment()['format'](_0x9557('0x60')):undefined});}return null;})[_0x9557('0x36')](function(_0x17314f){if(_0x17314f){_0x2c15eb[_0x9557('0x67')]=_0x17314f[_0x9557('0x64')]({'plain':!![]});interaction_log[_0x9557('0x29')](_0x9557('0x68'),_0x42bc90[_0x9557('0x62')]['id'],_0x42bc90['user']['name'],_0x42bc90[_0x9557('0x62')][_0x9557('0x69')],_0x2c15eb['interaction']['id'],_0x42bc90[_0x9557('0x5a')]?JSON[_0x9557('0x25')](_0x42bc90[_0x9557('0x5a')]):_0x9557('0x6a'));return respondWithRpcPromise(_0x9557('0x6b'),_0x9557('0x6c'),_0x2c15eb);}return null;})[_0x9557('0x36')](function(_0x5573be){var _0x38e20c=_0x9557('0x6d')+_0x5573be[_0x9557('0x28')][_0x9557('0x6e')];return db[_0x9557('0x6f')]['query'](_0x38e20c,{'type':db[_0x9557('0x70')][_0x9557('0x71')][_0x9557('0x72')],'raw':!![]})[_0x9557('0x36')](function(_0x381569){return _0x381569;});})[_0x9557('0x36')](function(_0x40a01f){if(_0x40a01f){_0x2c15eb['message'][_0x9557('0x73')]=_0x40a01f[0x0];if(!_0x42bc90[_0x9557('0x5a')][_0x9557('0x61')])return;return db['User'][_0x9557('0x58')]({'where':{'id':_0x42bc90['body'][_0x9557('0x61')],'role':_0x9557('0x63')},'attributes':['id',_0x9557('0x3a'),'fullname',_0x9557('0x74'),_0x9557('0x75')],'raw':!![]});}return null;})[_0x9557('0x36')](function(_0x1bea5e){if(!_0x1bea5e)return null;_0x2c15eb[_0x9557('0x28')]['agent']=_0x1bea5e;return _0x2c15eb;})[_0x9557('0x36')](function(_0x369bf1){if(_0x369bf1){if(_0x42bc90[_0x9557('0x5a')][_0x9557('0x76')]){_0x2c15eb[_0x9557('0x28')][_0x9557('0x77')]=util[_0x9557('0x5f')](_0x9557('0x78'),_0x42bc90[_0x9557('0x62')][_0x9557('0x3a')]);_0x2c15eb[_0x9557('0x28')][_0x9557('0x79')]=_0x2c15eb[_0x9557('0x79')];_0x2c15eb[_0x9557('0x28')]['motionChannel']=_0x2c15eb[_0x9557('0x79')];_0x2c15eb[_0x9557('0x28')]['event']='accept';return respondWithRpcPromise(_0x9557('0x7a'),_0x9557('0x7a'),{'event':_0x9557('0x7b'),'message':_[_0x9557('0x51')](_0x2c15eb['message'],JSON[_0x9557('0x7c')](_0x2c15eb['interaction']['formData']))},client9002)[_0x9557('0x36')](function(){return _0x2c15eb;});}return _0x2c15eb;}return null;})[_0x9557('0x36')](respondWithResult(_0x4697ef,null))[_0x9557('0x56')](handleError(_0x4697ef,null));};var interaction_log=require(_0x9557('0x15'))(_0x9557('0x7d'));exports[_0x9557('0x33')]=function(_0x59b3de,_0x49f028,_0x45f270){var _0x2db267={'agent':{},'channel':_0x9557('0x7e')};if(_0x59b3de['body']['id']){delete _0x59b3de[_0x9557('0x5a')]['id'];}_0x59b3de[_0x9557('0x5a')][_0x9557('0x61')]=_0x59b3de[_0x9557('0x5a')][_0x9557('0x61')]||_0x59b3de['user']['id'];_0x2db267[_0x9557('0x63')]['id']=_0x59b3de[_0x9557('0x5a')][_0x9557('0x61')];return db['ChatMessage']['find']({'where':{'id':_0x59b3de[_0x9557('0x57')]['id'],'UserId':null}})[_0x9557('0x36')](handleEntityNotFound(_0x49f028,null))[_0x9557('0x36')](function(_0x1699ee){if(_0x1699ee){_0x2db267[_0x9557('0x28')]=_0x1699ee['get']({'plain':!![]});return db[_0x9557('0x65')][_0x9557('0x58')]({'where':{'id':_0x1699ee[_0x9557('0x66')]}});}return null;})[_0x9557('0x36')](handleEntityNotFound(_0x49f028,null))[_0x9557('0x36')](function(_0xe25db6){if(_0xe25db6){_0x2db267['interaction']=_0xe25db6['get']({'plain':!![]});interaction_log[_0x9557('0x29')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59b3de['user']['id'],_0x59b3de[_0x9557('0x62')][_0x9557('0x3a')],_0x59b3de[_0x9557('0x62')][_0x9557('0x69')],_0x2db267['interaction']['id'],_0x59b3de['body']?JSON[_0x9557('0x25')](_0x59b3de[_0x9557('0x5a')]):_0x9557('0x6a'));return respondWithRpcPromise(_0x9557('0x7f'),_0x9557('0x80'),_0x2db267);}return null;})[_0x9557('0x36')](function(_0x5d6d8c){var _0x37a559='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d6d8c[_0x9557('0x28')][_0x9557('0x6e')];return db['sequelize'][_0x9557('0x42')](_0x37a559,{'type':db[_0x9557('0x70')][_0x9557('0x71')][_0x9557('0x72')],'raw':!![]})['then'](function(_0x2e7cb6){return _0x2e7cb6;});})['then'](function(_0x17bfa0){if(_0x17bfa0){_0x2db267[_0x9557('0x28')]['contact']=_0x17bfa0[0x0];if(!_0x59b3de[_0x9557('0x5a')]['UserId'])return;return db[_0x9557('0x81')][_0x9557('0x58')]({'where':{'id':_0x59b3de[_0x9557('0x5a')][_0x9557('0x61')],'role':_0x9557('0x63')},'attributes':['id',_0x9557('0x3a'),_0x9557('0x82'),_0x9557('0x74'),_0x9557('0x75')],'raw':!![]});}return null;})['then'](function(_0x1f94e1){if(!_0x1f94e1)return null;_0x2db267['message'][_0x9557('0x63')]=_0x1f94e1;return _0x2db267;})[_0x9557('0x36')](function(_0x242a05){if(_0x242a05){_0x242a05['message'][_0x9557('0x77')]=util[_0x9557('0x5f')](_0x9557('0x78'),_0x59b3de[_0x9557('0x62')][_0x9557('0x3a')]);_0x242a05[_0x9557('0x28')][_0x9557('0x79')]=_0x2db267[_0x9557('0x79')];_0x242a05[_0x9557('0x28')]['motionChannel']=_0x2db267[_0x9557('0x79')];_0x242a05[_0x9557('0x28')][_0x9557('0x83')]='reject';respondWithRpcPromise('EventManager',_0x9557('0x7a'),{'event':_0x9557('0x84'),'message':_[_0x9557('0x51')](_0x2db267[_0x9557('0x28')],JSON[_0x9557('0x7c')](_0x2db267['interaction'][_0x9557('0x85')]))},client9002);return _0x2db267;}return null;})[_0x9557('0x36')](respondWithResult(_0x49f028,null))['catch'](handleError(_0x49f028,null));}; \ No newline at end of file +var _0x2226=['SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','parse','formData','role','User','motionChannel','event','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','http','request','info','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0x2226,0x191));var _0x6222=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x2226[_0x5550b3];return _0x4b8fc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6222('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6222('0x1'));var moment=require('moment');var BPromise=require(_0x6222('0x2'));var Mustache=require(_0x6222('0x3'));var util=require(_0x6222('0x4'));var path=require(_0x6222('0x5'));var sox=require(_0x6222('0x6'));var csv=require(_0x6222('0x7'));var ejs=require(_0x6222('0x8'));var fs=require('fs');var fs_extra=require(_0x6222('0x9'));var _=require(_0x6222('0xa'));var squel=require('squel');var crypto=require(_0x6222('0xb'));var jsforce=require(_0x6222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6222('0x7'));var querystring=require(_0x6222('0xd'));var Papa=require(_0x6222('0xe'));var Redis=require(_0x6222('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6222('0x10'));var as=require(_0x6222('0x11'));var hardwareService=require(_0x6222('0x12'));var logger=require(_0x6222('0x13'))(_0x6222('0x14'));var utils=require(_0x6222('0x15'));var config=require(_0x6222('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6222('0x17'))['db'];config[_0x6222('0x18')]=_[_0x6222('0x19')](config[_0x6222('0x18')],{'host':_0x6222('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6222('0x18')]));require(_0x6222('0x1b'))[_0x6222('0x1c')](socket);var jayson=require(_0x6222('0x1d'));var client=jayson['client'][_0x6222('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x6222('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3d7fa3,_0xa445d3,_0x21bb63,_0x220e08){return new BPromise(function(_0x5f0b44,_0x1aac02){var _0x1838f0=_0x220e08||client;return _0x1838f0[_0x6222('0x1f')](_0x3d7fa3,_0x21bb63)['then'](function(_0xc6ff70){logger[_0x6222('0x20')]('ChatMessage,\x20%s,\x20%s',_0xa445d3,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xa445d3,'request\x20sent',JSON[_0x6222('0x21')](_0xc6ff70));if(_0xc6ff70[_0x6222('0x22')]){if(_0xc6ff70['error'][_0x6222('0x23')]===0x1f4){logger[_0x6222('0x22')](_0x6222('0x24'),_0xa445d3,_0xc6ff70[_0x6222('0x22')]['message']);return _0x1aac02(_0xc6ff70['error'][_0x6222('0x25')]);}logger[_0x6222('0x22')](_0x6222('0x24'),_0xa445d3,_0xc6ff70[_0x6222('0x22')][_0x6222('0x25')]);return _0x5f0b44(_0xc6ff70[_0x6222('0x22')][_0x6222('0x25')]);}else{logger[_0x6222('0x20')](_0x6222('0x24'),_0xa445d3,_0x6222('0x26'));_0x5f0b44(_0xc6ff70['result']['message']);}})['catch'](function(_0x68724c){logger[_0x6222('0x22')](_0x6222('0x24'),_0xa445d3,_0x68724c);_0x1aac02(_0x68724c);});});}function respondWithStatusCode(_0x454ed8,_0x10f84e){_0x10f84e=_0x10f84e||0xcc;return function(_0x32d5da){if(_0x32d5da){return _0x454ed8[_0x6222('0x27')](_0x10f84e);}return _0x454ed8[_0x6222('0x28')](_0x10f84e)[_0x6222('0x29')]();};}function respondWithResult(_0x3c898a,_0x16dcf6){_0x16dcf6=_0x16dcf6||0xc8;return function(_0x58b773){if(_0x58b773){return _0x3c898a[_0x6222('0x28')](_0x16dcf6)['json'](_0x58b773);}};}function respondWithFilteredResult(_0x5c7065,_0x3b21f6){return function(_0xbd7e87){if(_0xbd7e87){var _0x371cbf=typeof _0x3b21f6[_0x6222('0x2a')]===_0x6222('0x2b')&&typeof _0x3b21f6['limit']==='undefined';var _0x2f0319=_0xbd7e87[_0x6222('0x2c')];var _0x2bfc62=_0x371cbf?0x0:_0x3b21f6[_0x6222('0x2a')];var _0x579764=_0x371cbf?_0xbd7e87[_0x6222('0x2c')]:_0x3b21f6[_0x6222('0x2a')]+_0x3b21f6[_0x6222('0x2d')];var _0x7163d9;if(_0x579764>=_0x2f0319){_0x579764=_0x2f0319;_0x7163d9=0xc8;}else{_0x7163d9=0xce;}_0x5c7065[_0x6222('0x28')](_0x7163d9);return _0x5c7065[_0x6222('0x2e')](_0x6222('0x2f'),_0x2bfc62+'-'+_0x579764+'/'+_0x2f0319)['json'](_0xbd7e87);}return null;};}function patchUpdates(_0xb97d0){return function(_0x567f4d){try{jsonpatch[_0x6222('0x30')](_0x567f4d,_0xb97d0,!![]);}catch(_0x1b742b){return BPromise[_0x6222('0x31')](_0x1b742b);}return _0x567f4d[_0x6222('0x32')]();};}function saveUpdates(_0x58d743,_0x3dc770){return function(_0xd2134b){if(_0xd2134b){return _0xd2134b[_0x6222('0x33')](_0x58d743)[_0x6222('0x34')](function(_0x410e1b){return _0x410e1b;});}return null;};}function removeEntity(_0x419c62,_0x33066f){return function(_0x3b9f39){if(_0x3b9f39){return _0x3b9f39[_0x6222('0x35')]()[_0x6222('0x34')](function(){_0x419c62[_0x6222('0x28')](0xcc)[_0x6222('0x29')]();});}};}function handleEntityNotFound(_0x1815c4,_0x36a997){return function(_0x285bed){if(!_0x285bed){_0x1815c4['sendStatus'](0x194);}return _0x285bed;};}function handleError(_0x23f5ab,_0x201593){_0x201593=_0x201593||0x1f4;return function(_0xf56940){logger[_0x6222('0x22')](_0xf56940['stack']);if(_0xf56940['name']){delete _0xf56940[_0x6222('0x36')];}_0x23f5ab['status'](_0x201593)[_0x6222('0x37')](_0xf56940);};}exports[_0x6222('0x38')]=function(_0x51381d,_0x4cbc9b){var _0x43f3ec={},_0x49890a={},_0x885591={'count':0x0,'rows':[]};var _0x575fce=_[_0x6222('0x39')](db[_0x6222('0x3a')][_0x6222('0x3b')],function(_0x494edc){return{'name':_0x494edc['fieldName'],'type':_0x494edc[_0x6222('0x3c')][_0x6222('0x3d')]};});_0x49890a[_0x6222('0x3e')]=_['map'](_0x575fce,'name');_0x49890a['query']=_['keys'](_0x51381d[_0x6222('0x3f')]);_0x49890a[_0x6222('0x40')]=_[_0x6222('0x41')](_0x49890a[_0x6222('0x3e')],_0x49890a[_0x6222('0x3f')]);_0x43f3ec[_0x6222('0x42')]=_['intersection'](_0x49890a[_0x6222('0x3e')],qs[_0x6222('0x43')](_0x51381d[_0x6222('0x3f')][_0x6222('0x43')]));_0x43f3ec[_0x6222('0x42')]=_0x43f3ec[_0x6222('0x42')]['length']?_0x43f3ec[_0x6222('0x42')]:_0x49890a[_0x6222('0x3e')];if(!_0x51381d[_0x6222('0x3f')]['hasOwnProperty'](_0x6222('0x44'))){_0x43f3ec[_0x6222('0x2d')]=qs[_0x6222('0x2d')](_0x51381d['query'][_0x6222('0x2d')]);_0x43f3ec['offset']=qs[_0x6222('0x2a')](_0x51381d[_0x6222('0x3f')][_0x6222('0x2a')]);}_0x43f3ec[_0x6222('0x45')]=qs[_0x6222('0x46')](_0x51381d[_0x6222('0x3f')][_0x6222('0x46')]);_0x43f3ec[_0x6222('0x47')]=qs['filters'](_['pick'](_0x51381d['query'],_0x49890a[_0x6222('0x40')]),_0x575fce);if(_0x51381d['query'][_0x6222('0x48')]){_0x43f3ec[_0x6222('0x47')]=_[_0x6222('0x49')](_0x43f3ec[_0x6222('0x47')],{'$or':_[_0x6222('0x39')](_0x575fce,function(_0x202ed1){if(_0x202ed1[_0x6222('0x3c')]!==_0x6222('0x4a')){var _0x3cb8b9={};_0x3cb8b9[_0x202ed1[_0x6222('0x36')]]={'$like':'%'+_0x51381d['query'][_0x6222('0x48')]+'%'};return _0x3cb8b9;}})});}_0x43f3ec=_['merge']({},_0x43f3ec,_0x51381d[_0x6222('0x4b')]);var _0x3b67bd={'where':_0x43f3ec[_0x6222('0x47')]};return db[_0x6222('0x3a')][_0x6222('0x2c')](_0x3b67bd)['then'](function(_0x271042){_0x885591[_0x6222('0x2c')]=_0x271042;if(_0x51381d[_0x6222('0x3f')][_0x6222('0x4c')]){_0x43f3ec[_0x6222('0x4d')]=[{'all':!![]}];}return db[_0x6222('0x3a')][_0x6222('0x4e')](_0x43f3ec);})[_0x6222('0x34')](function(_0x1282b0){_0x885591[_0x6222('0x4f')]=_0x1282b0;return _0x885591;})[_0x6222('0x34')](respondWithFilteredResult(_0x4cbc9b,_0x43f3ec))['catch'](handleError(_0x4cbc9b,null));};exports[_0x6222('0x50')]=function(_0x194c2a,_0x161bb1){var _0x502765={'raw':!![],'where':{'id':_0x194c2a[_0x6222('0x51')]['id']}},_0xf14961={};_0xf14961['model']=_[_0x6222('0x52')](db[_0x6222('0x3a')][_0x6222('0x3b')]);_0xf14961[_0x6222('0x3f')]=_[_0x6222('0x52')](_0x194c2a[_0x6222('0x3f')]);_0xf14961[_0x6222('0x40')]=_[_0x6222('0x41')](_0xf14961[_0x6222('0x3e')],_0xf14961[_0x6222('0x3f')]);_0x502765[_0x6222('0x42')]=_['intersection'](_0xf14961[_0x6222('0x3e')],qs[_0x6222('0x43')](_0x194c2a[_0x6222('0x3f')][_0x6222('0x43')]));_0x502765[_0x6222('0x42')]=_0x502765[_0x6222('0x42')]['length']?_0x502765[_0x6222('0x42')]:_0xf14961[_0x6222('0x3e')];if(_0x194c2a[_0x6222('0x3f')]['includeAll']){_0x502765['include']=[{'all':!![]}];}_0x502765=_[_0x6222('0x49')]({},_0x502765,_0x194c2a[_0x6222('0x4b')]);return db[_0x6222('0x3a')]['find'](_0x502765)['then'](handleEntityNotFound(_0x161bb1,null))['then'](respondWithResult(_0x161bb1,null))[_0x6222('0x53')](handleError(_0x161bb1,null));};exports['create']=function(_0x759f5e,_0x16f2f3){return db[_0x6222('0x3a')][_0x6222('0x54')](_0x759f5e[_0x6222('0x55')],{})[_0x6222('0x34')](respondWithResult(_0x16f2f3,0xc9))[_0x6222('0x53')](handleError(_0x16f2f3,null));};exports[_0x6222('0x33')]=function(_0x26b71e,_0x23a55f){if(_0x26b71e[_0x6222('0x55')]['id']){delete _0x26b71e[_0x6222('0x55')]['id'];}return db[_0x6222('0x3a')][_0x6222('0x56')]({'where':{'id':_0x26b71e[_0x6222('0x51')]['id']}})[_0x6222('0x34')](handleEntityNotFound(_0x23a55f,null))[_0x6222('0x34')](saveUpdates(_0x26b71e['body'],null))['then'](respondWithResult(_0x23a55f,null))[_0x6222('0x53')](handleError(_0x23a55f,null));};exports[_0x6222('0x35')]=function(_0x280244,_0x40f71b){return db[_0x6222('0x3a')][_0x6222('0x56')]({'where':{'id':_0x280244[_0x6222('0x51')]['id']}})[_0x6222('0x34')](handleEntityNotFound(_0x40f71b,null))[_0x6222('0x34')](removeEntity(_0x40f71b,null))[_0x6222('0x53')](handleError(_0x40f71b,null));};exports[_0x6222('0x57')]=function(_0x1a571c,_0x23c237){return db[_0x6222('0x3a')][_0x6222('0x57')]()[_0x6222('0x34')](respondWithResult(_0x23c237,null))[_0x6222('0x53')](handleError(_0x23c237,null));};var interaction_log=require('../../config/logger')(_0x6222('0x58'));exports['accept']=function(_0x2fcdab,_0x5c4eb1,_0x41be7c){var _0x284c62={'agent':{},'channel':_0x6222('0x59')};if(_0x2fcdab['body']['id']){delete _0x2fcdab['body']['id'];}_0x2fcdab[_0x6222('0x55')][_0x6222('0x5a')]=!![];_0x2fcdab[_0x6222('0x55')][_0x6222('0x5b')]=moment()[_0x6222('0x5c')](_0x6222('0x5d'));_0x2fcdab[_0x6222('0x55')][_0x6222('0x5e')]=_0x2fcdab['body'][_0x6222('0x5e')]||_0x2fcdab[_0x6222('0x5f')]['id'];_0x284c62[_0x6222('0x60')]['id']=_0x2fcdab['body'][_0x6222('0x5e')];return db['ChatMessage']['find']({'where':{'id':_0x2fcdab['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c4eb1,null))[_0x6222('0x34')](saveUpdates(_0x2fcdab[_0x6222('0x55')],null))['then'](function(_0x504cd5){if(_0x504cd5){_0x284c62[_0x6222('0x25')]=_0x504cd5[_0x6222('0x61')]({'plain':!![]});return db[_0x6222('0x62')]['find']({'where':{'id':_0x504cd5[_0x6222('0x63')]}});}return null;})[_0x6222('0x34')](handleEntityNotFound(_0x5c4eb1,null))[_0x6222('0x34')](function(_0x43eadd){if(_0x43eadd){return _0x43eadd[_0x6222('0x33')]({'UserId':_0x2fcdab[_0x6222('0x55')][_0x6222('0x5e')],'read1stAt':_[_0x6222('0x64')](_0x43eadd[_0x6222('0x65')])?moment()[_0x6222('0x5c')](_0x6222('0x5d')):undefined});}return null;})['then'](function(_0xa78dc1){if(_0xa78dc1){_0x284c62[_0x6222('0x66')]=_0xa78dc1[_0x6222('0x61')]({'plain':!![]});interaction_log[_0x6222('0x20')](_0x6222('0x67'),_0x2fcdab['user']['id'],_0x2fcdab[_0x6222('0x5f')]['name'],_0x2fcdab[_0x6222('0x5f')]['role'],_0x284c62[_0x6222('0x66')]['id'],_0x2fcdab[_0x6222('0x55')]?JSON[_0x6222('0x21')](_0x2fcdab[_0x6222('0x55')]):_0x6222('0x68'));return respondWithRpcPromise('AcceptMessage',_0x6222('0x69'),_0x284c62);}return null;})['then'](function(_0x3ec2af){var _0xda5032=_0x6222('0x6a')+_0x3ec2af[_0x6222('0x25')][_0x6222('0x6b')];return db[_0x6222('0x6c')][_0x6222('0x3f')](_0xda5032,{'type':db[_0x6222('0x6d')][_0x6222('0x6e')][_0x6222('0x6f')],'raw':!![]})[_0x6222('0x34')](function(_0x3cf1fc){return _0x3cf1fc;});})[_0x6222('0x34')](function(_0x4883dd){if(_0x4883dd){_0x284c62[_0x6222('0x25')]['contact']=_0x4883dd[0x0];if(!_0x2fcdab['body'][_0x6222('0x5e')])return;return db['User']['find']({'where':{'id':_0x2fcdab['body']['UserId'],'role':'agent'},'attributes':['id',_0x6222('0x36'),_0x6222('0x70'),_0x6222('0x71'),_0x6222('0x72')],'raw':!![]});}return null;})[_0x6222('0x34')](function(_0x546841){if(!_0x546841)return null;_0x284c62[_0x6222('0x25')][_0x6222('0x60')]=_0x546841;return _0x284c62;})[_0x6222('0x34')](function(_0xd13442){if(_0xd13442){if(_0x2fcdab[_0x6222('0x55')][_0x6222('0x73')]){_0x284c62[_0x6222('0x25')][_0x6222('0x74')]=util[_0x6222('0x5c')](_0x6222('0x75'),_0x2fcdab[_0x6222('0x5f')]['name']);_0x284c62[_0x6222('0x25')][_0x6222('0x76')]=_0x284c62['channel'];_0x284c62['message']['motionChannel']=_0x284c62[_0x6222('0x76')];_0x284c62[_0x6222('0x25')]['event']=_0x6222('0x77');return respondWithRpcPromise(_0x6222('0x78'),_0x6222('0x78'),{'event':_0x6222('0x79'),'message':_['merge'](_0x284c62[_0x6222('0x25')],JSON[_0x6222('0x7a')](_0x284c62[_0x6222('0x66')][_0x6222('0x7b')]))},client9002)[_0x6222('0x34')](function(){return _0x284c62;});}return _0x284c62;}return null;})['then'](respondWithResult(_0x5c4eb1,null))[_0x6222('0x53')](handleError(_0x5c4eb1,null));};var interaction_log=require(_0x6222('0x13'))(_0x6222('0x58'));exports[_0x6222('0x31')]=function(_0x702d16,_0x108587,_0x52fe46){var _0x57dae5={'agent':{},'channel':_0x6222('0x59')};if(_0x702d16[_0x6222('0x55')]['id']){delete _0x702d16['body']['id'];}_0x702d16['body'][_0x6222('0x5e')]=_0x702d16['body'][_0x6222('0x5e')]||_0x702d16[_0x6222('0x5f')]['id'];_0x57dae5[_0x6222('0x60')]['id']=_0x702d16[_0x6222('0x55')][_0x6222('0x5e')];return db[_0x6222('0x3a')][_0x6222('0x56')]({'where':{'id':_0x702d16[_0x6222('0x51')]['id'],'UserId':null}})[_0x6222('0x34')](handleEntityNotFound(_0x108587,null))['then'](function(_0x133890){if(_0x133890){_0x57dae5['message']=_0x133890[_0x6222('0x61')]({'plain':!![]});return db['ChatInteraction'][_0x6222('0x56')]({'where':{'id':_0x133890[_0x6222('0x63')]}});}return null;})[_0x6222('0x34')](handleEntityNotFound(_0x108587,null))[_0x6222('0x34')](function(_0x3a76c4){if(_0x3a76c4){_0x57dae5[_0x6222('0x66')]=_0x3a76c4[_0x6222('0x61')]({'plain':!![]});interaction_log[_0x6222('0x20')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x702d16[_0x6222('0x5f')]['id'],_0x702d16[_0x6222('0x5f')][_0x6222('0x36')],_0x702d16['user'][_0x6222('0x7c')],_0x57dae5[_0x6222('0x66')]['id'],_0x702d16['body']?JSON[_0x6222('0x21')](_0x702d16[_0x6222('0x55')]):_0x6222('0x68'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x57dae5);}return null;})[_0x6222('0x34')](function(_0x1bb1a7){var _0x240cb4=_0x6222('0x6a')+_0x1bb1a7[_0x6222('0x25')][_0x6222('0x6b')];return db[_0x6222('0x6c')][_0x6222('0x3f')](_0x240cb4,{'type':db[_0x6222('0x6d')]['QueryTypes'][_0x6222('0x6f')],'raw':!![]})['then'](function(_0x1ec295){return _0x1ec295;});})[_0x6222('0x34')](function(_0x32fcf9){if(_0x32fcf9){_0x57dae5[_0x6222('0x25')]['contact']=_0x32fcf9[0x0];if(!_0x702d16[_0x6222('0x55')][_0x6222('0x5e')])return;return db[_0x6222('0x7d')]['find']({'where':{'id':_0x702d16[_0x6222('0x55')]['UserId'],'role':_0x6222('0x60')},'attributes':['id',_0x6222('0x36'),_0x6222('0x70'),_0x6222('0x71'),_0x6222('0x72')],'raw':!![]});}return null;})[_0x6222('0x34')](function(_0x328adc){if(!_0x328adc)return null;_0x57dae5[_0x6222('0x25')][_0x6222('0x60')]=_0x328adc;return _0x57dae5;})[_0x6222('0x34')](function(_0x3576e9){if(_0x3576e9){_0x3576e9['message'][_0x6222('0x74')]=util[_0x6222('0x5c')]('SIP/%s',_0x702d16[_0x6222('0x5f')][_0x6222('0x36')]);_0x3576e9[_0x6222('0x25')]['channel']=_0x57dae5[_0x6222('0x76')];_0x3576e9['message'][_0x6222('0x7e')]=_0x57dae5['channel'];_0x3576e9[_0x6222('0x25')][_0x6222('0x7f')]=_0x6222('0x31');respondWithRpcPromise('EventManager',_0x6222('0x78'),{'event':'rejectmessage','message':_[_0x6222('0x49')](_0x57dae5['message'],JSON[_0x6222('0x7a')](_0x57dae5[_0x6222('0x66')][_0x6222('0x7b')]))},client9002);return _0x57dae5;}return null;})[_0x6222('0x34')](respondWithResult(_0x108587,null))['catch'](handleError(_0x108587,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7d15879..61b793c 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 _0xaffe=['hasOwnProperty','hook','exports','events','ChatMessage','update','remove','emit'];(function(_0x2b2cc3,_0x5277d7){var _0x49d8a6=function(_0x1b604c){while(--_0x1b604c){_0x2b2cc3['push'](_0x2b2cc3['shift']());}};_0x49d8a6(++_0x5277d7);}(_0xaffe,0x17b));var _0xeaff=function(_0x165244,_0x26f339){_0x165244=_0x165244-0x0;var _0x1778bf=_0xaffe[_0x165244];return _0x1778bf;};'use strict';var EventEmitter=require(_0xeaff('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xeaff('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xeaff('0x2'),'afterDestroy':_0xeaff('0x3')};function emitEvent(_0x552990){return function(_0x1df606,_0x435fef,_0x23ced4){ChatMessageEvents[_0xeaff('0x4')](_0x552990+':'+_0x1df606['id'],_0x1df606);ChatMessageEvents[_0xeaff('0x4')](_0x552990,_0x1df606);_0x23ced4(null);};}for(var e in events){if(events[_0xeaff('0x5')](e)){var event=events[e];ChatMessage[_0xeaff('0x6')](e,emitEvent(event));}}module[_0xeaff('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9ca8=['remove','emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x5b3b9c,_0x5698b7){var _0x42e769=function(_0x2bbf27){while(--_0x2bbf27){_0x5b3b9c['push'](_0x5b3b9c['shift']());}};_0x42e769(++_0x5698b7);}(_0x9ca8,0xf6));var _0x89ca=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0x9ca8[_0x4695ba];return _0x524b7d;};'use strict';var EventEmitter=require(_0x89ca('0x0'));var ChatMessage=require(_0x89ca('0x1'))['db'][_0x89ca('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x89ca('0x3')](0x0);var events={'afterCreate':_0x89ca('0x4'),'afterUpdate':_0x89ca('0x5'),'afterDestroy':_0x89ca('0x6')};function emitEvent(_0x3758f3){return function(_0x1e2af1,_0x4462c3,_0x437aee){ChatMessageEvents['emit'](_0x3758f3+':'+_0x1e2af1['id'],_0x1e2af1);ChatMessageEvents[_0x89ca('0x7')](_0x3758f3,_0x1e2af1);_0x437aee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x89ca('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b59f743..7e5867a 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 _0xf57b=['utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','update','createdAt','error','utf8mb4'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xf57b,0x1c3));var _0xbf57=function(_0x1a9845,_0x5f1ca7){_0x1a9845=_0x1a9845-0x0;var _0x4f4490=_0xf57b[_0x1a9845];return _0x4f4490;};'use strict';var _=require(_0xbf57('0x0'));var util=require(_0xbf57('0x1'));var logger=require(_0xbf57('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbf57('0x3'));var fs=require('fs');var path=require(_0xbf57('0x4'));var rimraf=require(_0xbf57('0x5'));var config=require(_0xbf57('0x6'));var attributes=require(_0xbf57('0x7'));module['exports']=function(_0x4140bf,_0x16c741){return _0x4140bf[_0xbf57('0x8')](_0xbf57('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xbf57('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x459ed6,_0x3be804,_0x128fa3){var _0x6e95cb=_0x4140bf[_0xbf57('0xb')];var _0x454b0b=_0x459ed6[_0xbf57('0xc')]({'plain':!![]});if(_0x454b0b['direction'][_0xbf57('0xd')]()==='in'||_0x454b0b[_0xbf57('0xe')][_0xbf57('0xd')]()===_0xbf57('0xf')&&!_0x454b0b[_0xbf57('0x10')]&&!_[_0xbf57('0x11')](_0x454b0b[_0xbf57('0x12')])){_0x6e95cb['ChatInteraction'][_0xbf57('0x13')]({'where':{'id':_0x454b0b['ChatInteractionId']}})['then'](function(_0x2dcef1){if(_0x2dcef1){_0x2dcef1[_0xbf57('0x14')]({'lastMsgAt':_0x454b0b[_0xbf57('0x15')],'lastMsgDirection':_0x454b0b[_0xbf57('0xe')][_0xbf57('0xd')]()});}})['catch'](function(_0x391e34){console[_0xbf57('0x16')](_0x391e34);});}_0x128fa3();}},'charset':_0xbf57('0x17'),'collate':_0xbf57('0x18')});}; \ No newline at end of file +var _0xb2b1=['path','rimraf','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55a317,_0x454d14){var _0x217680=function(_0x47d962){while(--_0x47d962){_0x55a317['push'](_0x55a317['shift']());}};_0x217680(++_0x454d14);}(_0xb2b1,0x190));var _0x1b2b=function(_0x179a65,_0x16a31b){_0x179a65=_0x179a65-0x0;var _0x2cff46=_0xb2b1[_0x179a65];return _0x2cff46;};'use strict';var _=require(_0x1b2b('0x0'));var util=require(_0x1b2b('0x1'));var logger=require(_0x1b2b('0x2'))(_0x1b2b('0x3'));var moment=require(_0x1b2b('0x4'));var BPromise=require(_0x1b2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b2b('0x6'));var rimraf=require(_0x1b2b('0x7'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x1b2b('0x8')]=function(_0x298b57,_0x4587ba){return _0x298b57[_0x1b2b('0x9')](_0x1b2b('0xa'),attributes,{'tableName':_0x1b2b('0xb'),'paranoid':![],'indexes':[{'name':_0x1b2b('0xc'),'fields':[_0x1b2b('0xd')],'type':_0x1b2b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x517ce5,_0x2f116f,_0x309ff9){var _0x52a32d=_0x298b57['models'];var _0x58e8d8=_0x517ce5[_0x1b2b('0xf')]({'plain':!![]});if(_0x58e8d8[_0x1b2b('0x10')]['toLowerCase']()==='in'||_0x58e8d8[_0x1b2b('0x10')][_0x1b2b('0x11')]()===_0x1b2b('0x12')&&!_0x58e8d8[_0x1b2b('0x13')]&&!_['isNil'](_0x58e8d8[_0x1b2b('0x14')])){_0x52a32d[_0x1b2b('0x15')][_0x1b2b('0x16')]({'where':{'id':_0x58e8d8[_0x1b2b('0x17')]}})[_0x1b2b('0x18')](function(_0x4e02e5){if(_0x4e02e5){_0x4e02e5[_0x1b2b('0x19')]({'lastMsgAt':_0x58e8d8[_0x1b2b('0x1a')],'lastMsgDirection':_0x58e8d8['direction']['toLowerCase']()});}})['catch'](function(_0x3f1624){console['error'](_0x3f1624);});}_0x309ff9();}},'charset':_0x1b2b('0x1b'),'collate':_0x1b2b('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4fc8585..b280b82 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 _0xa981=['error','code','message','result','CreateChatMessage','ChatMessage','body','options','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xa981,0xa9));var _0x1a98=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0xa981[_0x512e72];return _0x143086;};'use strict';var _=require('lodash');var util=require(_0x1a98('0x0'));var moment=require('moment');var BPromise=require(_0x1a98('0x1'));var rs=require(_0x1a98('0x2'));var fs=require('fs');var Redis=require(_0x1a98('0x3'));var db=require(_0x1a98('0x4'))['db'];var utils=require(_0x1a98('0x5'));var logger=require('../../config/logger')(_0x1a98('0x6'));var config=require(_0x1a98('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a98('0x8')][_0x1a98('0x9')]({'port':0x232a});config[_0x1a98('0xa')]=_[_0x1a98('0xb')](config[_0x1a98('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a98('0xc'))(new Redis(config[_0x1a98('0xa')]));require(_0x1a98('0xd'))[_0x1a98('0xe')](socket);function respondWithRpcPromise(_0x137a44,_0x45c260,_0x1d01c3){return new BPromise(function(_0x2b7877,_0x3ccd5b){return client[_0x1a98('0xf')](_0x137a44,_0x1d01c3)[_0x1a98('0x10')](function(_0x4647af){logger[_0x1a98('0x11')](_0x1a98('0x12'),_0x45c260,_0x1a98('0x13'));logger[_0x1a98('0x14')](_0x1a98('0x15'),_0x45c260,_0x1a98('0x13'),JSON[_0x1a98('0x16')](_0x4647af));if(_0x4647af[_0x1a98('0x17')]){if(_0x4647af[_0x1a98('0x17')][_0x1a98('0x18')]===0x1f4){logger['error'](_0x1a98('0x12'),_0x45c260,_0x4647af[_0x1a98('0x17')][_0x1a98('0x19')]);return _0x3ccd5b(_0x4647af[_0x1a98('0x17')][_0x1a98('0x19')]);}logger[_0x1a98('0x17')]('ChatMessage,\x20%s,\x20%s',_0x45c260,_0x4647af[_0x1a98('0x17')]['message']);return _0x2b7877(_0x4647af[_0x1a98('0x17')][_0x1a98('0x19')]);}else{logger[_0x1a98('0x11')](_0x1a98('0x12'),_0x45c260,_0x1a98('0x13'));_0x2b7877(_0x4647af[_0x1a98('0x1a')][_0x1a98('0x19')]);}})['catch'](function(_0x47a04b){logger['error'](_0x1a98('0x12'),_0x45c260,_0x47a04b);_0x3ccd5b(_0x47a04b);});});}exports[_0x1a98('0x1b')]=function(_0x2067e5){var _0x590c52=this;return new Promise(function(_0x5d426c,_0x25182e){return db[_0x1a98('0x1c')]['create'](_0x2067e5[_0x1a98('0x1d')],{'raw':_0x2067e5['options']?_0x2067e5[_0x1a98('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x1a98('0x10')](function(_0x17fd92){logger['info'](_0x1a98('0x1b'),_0x2067e5);logger[_0x1a98('0x14')](_0x1a98('0x1b'),_0x2067e5,JSON['stringify'](_0x17fd92));_0x5d426c(_0x17fd92);})[_0x1a98('0x1f')](function(_0x3b4bef){logger[_0x1a98('0x17')]('CreateChatMessage',_0x3b4bef[_0x1a98('0x19')],_0x2067e5);_0x25182e(_0x590c52[_0x1a98('0x17')](0x1f4,_0x3b4bef[_0x1a98('0x19')]));});});}; \ No newline at end of file +var _0xb6f9=['body','options','raw','then','stringify','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','request\x20sent','debug','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage'];(function(_0x26a682,_0x4319b7){var _0x18a562=function(_0x235879){while(--_0x235879){_0x26a682['push'](_0x26a682['shift']());}};_0x18a562(++_0x4319b7);}(_0xb6f9,0x145));var _0x9b6f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb6f9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9b6f('0x0'));var moment=require(_0x9b6f('0x1'));var BPromise=require(_0x9b6f('0x2'));var rs=require(_0x9b6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9b6f('0x4'))(_0x9b6f('0x5'));var config=require(_0x9b6f('0x6'));var jayson=require(_0x9b6f('0x7'));var client=jayson[_0x9b6f('0x8')][_0x9b6f('0x9')]({'port':0x232a});config['redis']=_[_0x9b6f('0xa')](config[_0x9b6f('0xb')],{'host':_0x9b6f('0xc'),'port':0x18eb});var socket=require(_0x9b6f('0xd'))(new Redis(config[_0x9b6f('0xb')]));require(_0x9b6f('0xe'))[_0x9b6f('0xf')](socket);function respondWithRpcPromise(_0x36f708,_0xd923fd,_0x45d24e){return new BPromise(function(_0x239847,_0x2c4637){return client[_0x9b6f('0x10')](_0x36f708,_0x45d24e)['then'](function(_0x58c080){logger[_0x9b6f('0x11')]('ChatMessage,\x20%s,\x20%s',_0xd923fd,_0x9b6f('0x12'));logger[_0x9b6f('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xd923fd,'request\x20sent',JSON['stringify'](_0x58c080));if(_0x58c080['error']){if(_0x58c080[_0x9b6f('0x14')][_0x9b6f('0x15')]===0x1f4){logger[_0x9b6f('0x14')](_0x9b6f('0x16'),_0xd923fd,_0x58c080['error'][_0x9b6f('0x17')]);return _0x2c4637(_0x58c080[_0x9b6f('0x14')][_0x9b6f('0x17')]);}logger['error'](_0x9b6f('0x16'),_0xd923fd,_0x58c080[_0x9b6f('0x14')][_0x9b6f('0x17')]);return _0x239847(_0x58c080[_0x9b6f('0x14')][_0x9b6f('0x17')]);}else{logger[_0x9b6f('0x11')](_0x9b6f('0x16'),_0xd923fd,_0x9b6f('0x12'));_0x239847(_0x58c080['result'][_0x9b6f('0x17')]);}})[_0x9b6f('0x18')](function(_0x1d2a25){logger[_0x9b6f('0x14')](_0x9b6f('0x16'),_0xd923fd,_0x1d2a25);_0x2c4637(_0x1d2a25);});});}exports[_0x9b6f('0x19')]=function(_0x19832e){var _0x2f5ce2=this;return new Promise(function(_0xaf4273,_0x1605f9){return db[_0x9b6f('0x1a')]['create'](_0x19832e[_0x9b6f('0x1b')],{'raw':_0x19832e[_0x9b6f('0x1c')]?_0x19832e['options'][_0x9b6f('0x1d')]===undefined?!![]:![]:!![]})[_0x9b6f('0x1e')](function(_0x461200){logger[_0x9b6f('0x11')](_0x9b6f('0x19'),_0x19832e);logger[_0x9b6f('0x13')]('CreateChatMessage',_0x19832e,JSON[_0x9b6f('0x1f')](_0x461200));_0xaf4273(_0x461200);})['catch'](function(_0x236a4d){logger[_0x9b6f('0x14')](_0x9b6f('0x19'),_0x236a4d[_0x9b6f('0x17')],_0x19832e);_0x1605f9(_0x2f5ce2[_0x9b6f('0x14')](0x1f4,_0x236a4d[_0x9b6f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1aadc51..f11485d 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 _0x5162=['chatMessage:','./chatMessage.events','emit','removeListener','register','length'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x5162,0x103));var _0x2516=function(_0x425af8,_0x366c35){_0x425af8=_0x425af8-0x0;var _0x5c2eb1=_0x5162[_0x425af8];return _0x5c2eb1;};'use strict';var ChatMessageEvents=require(_0x2516('0x0'));var events=['save','remove','update'];function createListener(_0x4db25c,_0x41fd28){return function(_0x2aaef5){_0x41fd28[_0x2516('0x1')](_0x4db25c,_0x2aaef5);};}function removeListener(_0x2d0b53,_0x2e48b6){return function(){ChatMessageEvents[_0x2516('0x2')](_0x2d0b53,_0x2e48b6);};}exports[_0x2516('0x3')]=function(_0x5b71b5){for(var _0x48f411=0x0,_0x5beeb3=events[_0x2516('0x4')];_0x48f411<_0x5beeb3;_0x48f411++){var _0xba4b36=events[_0x48f411];var _0xa1557=createListener(_0x2516('0x5')+_0xba4b36,_0x5b71b5);ChatMessageEvents['on'](_0xba4b36,_0xa1557);}}; \ No newline at end of file +var _0x6108=['register','chatMessage:','./chatMessage.events','remove','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6108,0xbc));var _0x8610=function(_0x139bcf,_0x43779b){_0x139bcf=_0x139bcf-0x0;var _0x143cc3=_0x6108[_0x139bcf];return _0x143cc3;};'use strict';var ChatMessageEvents=require(_0x8610('0x0'));var events=['save',_0x8610('0x1'),_0x8610('0x2')];function createListener(_0x19a0a6,_0x49e7c9){return function(_0x4a9c20){_0x49e7c9[_0x8610('0x3')](_0x19a0a6,_0x4a9c20);};}function removeListener(_0x42741d,_0x54802f){return function(){ChatMessageEvents['removeListener'](_0x42741d,_0x54802f);};}exports[_0x8610('0x4')]=function(_0x1ca62b){for(var _0x28a680=0x0,_0x26dab3=events['length'];_0x28a680<_0x26dab3;_0x28a680++){var _0x174f41=events[_0x28a680];var _0x49e0a2=createListener(_0x8610('0x5')+_0x174f41,_0x1ca62b);ChatMessageEvents['on'](_0x174f41,_0x49e0a2);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 328ce50..26afe79 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 _0x2248=['show','post','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x57b5d0,_0xf302ef){var _0x7c212e=function(_0x3c6cef){while(--_0x3c6cef){_0x57b5d0['push'](_0x57b5d0['shift']());}};_0x7c212e(++_0xf302ef);}(_0x2248,0x93));var _0x8224=function(_0x5218db,_0x388fc7){_0x5218db=_0x5218db-0x0;var _0x157852=_0x2248[_0x5218db];return _0x157852;};'use strict';var multer=require(_0x8224('0x0'));var util=require(_0x8224('0x1'));var path=require(_0x8224('0x2'));var timeout=require('connect-timeout');var express=require(_0x8224('0x3'));var router=express[_0x8224('0x4')]();var fs_extra=require(_0x8224('0x5'));var auth=require(_0x8224('0x6'));var interaction=require(_0x8224('0x7'));var config=require('../../config/environment');var controller=require(_0x8224('0x8'));router[_0x8224('0x9')]('/',auth[_0x8224('0xa')](),controller[_0x8224('0xb')]);router[_0x8224('0x9')](_0x8224('0xc'),auth['isAuthenticated'](),controller[_0x8224('0xd')]);router[_0x8224('0x9')](_0x8224('0xe'),auth[_0x8224('0xa')](),controller[_0x8224('0xf')]);router[_0x8224('0x10')]('/',auth['isAuthenticated'](),interaction[_0x8224('0x11')](_0x8224('0x12'),_0x8224('0x13')),controller['create']);router[_0x8224('0x14')](_0x8224('0xe'),controller[_0x8224('0x15')]);router[_0x8224('0x14')](_0x8224('0x16'),auth[_0x8224('0xa')](),controller[_0x8224('0x17')]);router[_0x8224('0x14')](_0x8224('0x18'),auth[_0x8224('0xa')](),controller['reject']);router['delete'](_0x8224('0xe'),auth[_0x8224('0xa')](),controller[_0x8224('0x19')]);module[_0x8224('0x1a')]=router; \ No newline at end of file +var _0x1322=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x54ff03,_0x49684c){var _0x52eef7=function(_0x515fff){while(--_0x515fff){_0x54ff03['push'](_0x54ff03['shift']());}};_0x52eef7(++_0x49684c);}(_0x1322,0x1d3));var _0x2132=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x1322[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0x2132('0x0'));var util=require(_0x2132('0x1'));var path=require(_0x2132('0x2'));var timeout=require(_0x2132('0x3'));var express=require(_0x2132('0x4'));var router=express[_0x2132('0x5')]();var fs_extra=require(_0x2132('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2132('0x7'));var config=require(_0x2132('0x8'));var controller=require(_0x2132('0x9'));router[_0x2132('0xa')]('/',auth[_0x2132('0xb')](),controller[_0x2132('0xc')]);router[_0x2132('0xa')](_0x2132('0xd'),auth['isAuthenticated'](),controller[_0x2132('0xe')]);router[_0x2132('0xa')](_0x2132('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x2132('0x10')]('/',auth['isAuthenticated'](),interaction[_0x2132('0x11')](_0x2132('0x12'),_0x2132('0x13')),controller[_0x2132('0x14')]);router['put'](_0x2132('0xf'),controller[_0x2132('0x15')]);router[_0x2132('0x16')](_0x2132('0x17'),auth['isAuthenticated'](),controller[_0x2132('0x18')]);router[_0x2132('0x16')](_0x2132('0x19'),auth[_0x2132('0xb')](),controller[_0x2132('0x1a')]);router[_0x2132('0x1b')](_0x2132('0xf'),auth[_0x2132('0xb')](),controller[_0x2132('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 04e34bf..7cad98a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['medium','exports','TEXT'];(function(_0x40c656,_0x27b0fa){var _0x553a28=function(_0x49ce84){while(--_0x49ce84){_0x40c656['push'](_0x40c656['shift']());}};_0x553a28(++_0x27b0fa);}(_0x2032,0xd9));var _0x2203=function(_0x3b1a3e,_0xfed716){_0x3b1a3e=_0x3b1a3e-0x0;var _0x343add=_0x2032[_0x3b1a3e];return _0x343add;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x3c705c,_0x4b7a52){var _0x530a9e=function(_0x8bd485){while(--_0x8bd485){_0x3c705c['push'](_0x3c705c['shift']());}};_0x530a9e(++_0x4b7a52);}(_0xb10b,0x12a));var _0xbb10=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xb10b[_0x256b72];return _0x2183e3;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 938e9ee..d6c62b2 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(_0x22d268,_0x1347fc){var _0x30def5=function(_0xc83fc8){while(--_0xc83fc8){_0x22d268['push'](_0x22d268['shift']());}};_0x30def5(++_0x1347fc);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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(_0x2ab4d6,_0x2e501d){var _0x1666f4=function(_0x96d727){while(--_0x96d727){_0x2ab4d6['push'](_0x2ab4d6['shift']());}};_0x1666f4(++_0x2e501d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['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 11f351b..33e2558 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 _0xe396=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xc8c149,_0x104184){var _0x261259=function(_0x314df3){while(--_0x314df3){_0xc8c149['push'](_0xc8c149['shift']());}};_0x261259(++_0x104184);}(_0xe396,0xa3));var _0x6e39=function(_0x6f7355,_0x3246eb){_0x6f7355=_0x6f7355-0x0;var _0xbd5cb5=_0xe396[_0x6f7355];return _0xbd5cb5;};'use strict';var EventEmitter=require(_0x6e39('0x0'));var ChatOfflineMessage=require(_0x6e39('0x1'))['db'][_0x6e39('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x6e39('0x3')](0x0);var events={'afterCreate':_0x6e39('0x4'),'afterUpdate':_0x6e39('0x5'),'afterDestroy':_0x6e39('0x6')};function emitEvent(_0x2e51f0){return function(_0x34bb99,_0x59bce9,_0x3e8e20){ChatOfflineMessageEvents[_0x6e39('0x7')](_0x2e51f0+':'+_0x34bb99['id'],_0x34bb99);ChatOfflineMessageEvents[_0x6e39('0x7')](_0x2e51f0,_0x34bb99);_0x3e8e20(null);};}for(var e in events){if(events[_0x6e39('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x6e39('0x9')](e,emitEvent(event));}}module[_0x6e39('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3408=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x23729c,_0x26718d){var _0x7fa9ca=function(_0x513933){while(--_0x513933){_0x23729c['push'](_0x23729c['shift']());}};_0x7fa9ca(++_0x26718d);}(_0x3408,0x177));var _0x8340=function(_0x59c60e,_0x58abdc){_0x59c60e=_0x59c60e-0x0;var _0x199ee4=_0x3408[_0x59c60e];return _0x199ee4;};'use strict';var EventEmitter=require(_0x8340('0x0'));var ChatOfflineMessage=require(_0x8340('0x1'))['db'][_0x8340('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x8340('0x3')](0x0);var events={'afterCreate':_0x8340('0x4'),'afterUpdate':_0x8340('0x5'),'afterDestroy':_0x8340('0x6')};function emitEvent(_0x3c8360){return function(_0x1ca22c,_0x33ee17,_0x67180){ChatOfflineMessageEvents[_0x8340('0x7')](_0x3c8360+':'+_0x1ca22c['id'],_0x1ca22c);ChatOfflineMessageEvents[_0x8340('0x7')](_0x3c8360,_0x1ca22c);_0x67180(null);};}for(var e in events){if(events[_0x8340('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x8340('0x9')](e,emitEvent(event));}}module[_0x8340('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 330ce09..c05a60f 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 _0x823b=['exports','define','ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes'];(function(_0x4b5714,_0x4a8ff6){var _0x384f28=function(_0x1a97a5){while(--_0x1a97a5){_0x4b5714['push'](_0x4b5714['shift']());}};_0x384f28(++_0x4a8ff6);}(_0x823b,0xcc));var _0xb823=function(_0x52a9c3,_0x54a987){_0x52a9c3=_0x52a9c3-0x0;var _0x5b9422=_0x823b[_0x52a9c3];return _0x5b9422;};'use strict';var attributes=require(_0xb823('0x0'));module[_0xb823('0x1')]=function(_0x231efe){return _0x231efe[_0xb823('0x2')](_0xb823('0x3'),attributes,{'tableName':_0xb823('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xde59=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','ChatOfflineMessage','utf8mb4'];(function(_0x3c30f7,_0x5c663f){var _0xabf72e=function(_0x1eb9d0){while(--_0x1eb9d0){_0x3c30f7['push'](_0x3c30f7['shift']());}};_0xabf72e(++_0x5c663f);}(_0xde59,0x175));var _0x9de5=function(_0x46672b,_0x3943d2){_0x46672b=_0x46672b-0x0;var _0x13af10=_0xde59[_0x46672b];return _0x13af10;};'use strict';var attributes=require(_0x9de5('0x0'));module['exports']=function(_0x29e249){return _0x29e249['define'](_0x9de5('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9de5('0x2'),'collate':_0x9de5('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6f980c4..3c9c2c9 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 _0xe20a=['info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe20a,0xf7));var _0xae20=function(_0x9f2ca5,_0x575ffd){_0x9f2ca5=_0x9f2ca5-0x0;var _0x3ff23e=_0xe20a[_0x9f2ca5];return _0x3ff23e;};'use strict';var _=require(_0xae20('0x0'));var util=require(_0xae20('0x1'));var moment=require(_0xae20('0x2'));var BPromise=require(_0xae20('0x3'));var rs=require(_0xae20('0x4'));var fs=require('fs');var Redis=require(_0xae20('0x5'));var db=require(_0xae20('0x6'))['db'];var utils=require(_0xae20('0x7'));var logger=require(_0xae20('0x8'))(_0xae20('0x9'));var config=require('../../config/environment');var jayson=require(_0xae20('0xa'));var client=jayson[_0xae20('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcb526d,_0x11bba1,_0x1159d7){return new BPromise(function(_0x407652,_0x47b731){return client['request'](_0xcb526d,_0x1159d7)[_0xae20('0xc')](function(_0x520a6a){logger[_0xae20('0xd')](_0xae20('0xe'),_0x11bba1,_0xae20('0xf'));logger[_0xae20('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x11bba1,_0xae20('0xf'),JSON[_0xae20('0x11')](_0x520a6a));if(_0x520a6a['error']){if(_0x520a6a[_0xae20('0x12')]['code']===0x1f4){logger['error'](_0xae20('0xe'),_0x11bba1,_0x520a6a[_0xae20('0x12')][_0xae20('0x13')]);return _0x47b731(_0x520a6a[_0xae20('0x12')][_0xae20('0x13')]);}logger[_0xae20('0x12')](_0xae20('0xe'),_0x11bba1,_0x520a6a[_0xae20('0x12')][_0xae20('0x13')]);return _0x407652(_0x520a6a['error'][_0xae20('0x13')]);}else{logger[_0xae20('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x11bba1,_0xae20('0xf'));_0x407652(_0x520a6a['result']['message']);}})['catch'](function(_0x27e6e7){logger[_0xae20('0x12')](_0xae20('0xe'),_0x11bba1,_0x27e6e7);_0x47b731(_0x27e6e7);});});} \ No newline at end of file +var _0x06bf=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x5f0c5f,_0x1a58ae){var _0x2112e3=function(_0x419017){while(--_0x419017){_0x5f0c5f['push'](_0x5f0c5f['shift']());}};_0x2112e3(++_0x1a58ae);}(_0x06bf,0x105));var _0xf06b=function(_0x1a23d3,_0x19d8c0){_0x1a23d3=_0x1a23d3-0x0;var _0x14fff5=_0x06bf[_0x1a23d3];return _0x14fff5;};'use strict';var _=require(_0xf06b('0x0'));var util=require(_0xf06b('0x1'));var moment=require(_0xf06b('0x2'));var BPromise=require(_0xf06b('0x3'));var rs=require(_0xf06b('0x4'));var fs=require('fs');var Redis=require(_0xf06b('0x5'));var db=require(_0xf06b('0x6'))['db'];var utils=require(_0xf06b('0x7'));var logger=require('../../config/logger')(_0xf06b('0x8'));var config=require(_0xf06b('0x9'));var jayson=require(_0xf06b('0xa'));var client=jayson['client'][_0xf06b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb69d30,_0x2458d6,_0x7a4950){return new BPromise(function(_0x5196ed,_0x158086){return client[_0xf06b('0xc')](_0xb69d30,_0x7a4950)['then'](function(_0x531593){logger[_0xf06b('0xd')](_0xf06b('0xe'),_0x2458d6,_0xf06b('0xf'));logger[_0xf06b('0x10')](_0xf06b('0x11'),_0x2458d6,_0xf06b('0xf'),JSON[_0xf06b('0x12')](_0x531593));if(_0x531593[_0xf06b('0x13')]){if(_0x531593['error']['code']===0x1f4){logger['error'](_0xf06b('0xe'),_0x2458d6,_0x531593[_0xf06b('0x13')]['message']);return _0x158086(_0x531593['error'][_0xf06b('0x14')]);}logger[_0xf06b('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2458d6,_0x531593[_0xf06b('0x13')][_0xf06b('0x14')]);return _0x5196ed(_0x531593[_0xf06b('0x13')]['message']);}else{logger[_0xf06b('0xd')](_0xf06b('0xe'),_0x2458d6,_0xf06b('0xf'));_0x5196ed(_0x531593['result'][_0xf06b('0x14')]);}})[_0xf06b('0x15')](function(_0x1559ef){logger[_0xf06b('0x13')](_0xf06b('0xe'),_0x2458d6,_0x1559ef);_0x158086(_0x1559ef);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e2ba43e..6619a6d 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 _0xa738=['show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2d8db5,_0x3c9c8d){var _0xdc5579=function(_0x36f14f){while(--_0x36f14f){_0x2d8db5['push'](_0x2d8db5['shift']());}};_0xdc5579(++_0x3c9c8d);}(_0xa738,0x86));var _0x8a73=function(_0x50804b,_0x34b219){_0x50804b=_0x50804b-0x0;var _0x1e3a47=_0xa738[_0x50804b];return _0x1e3a47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8a73('0x0'));var timeout=require(_0x8a73('0x1'));var express=require(_0x8a73('0x2'));var router=express[_0x8a73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a73('0x4'));var interaction=require(_0x8a73('0x5'));var config=require(_0x8a73('0x6'));var controller=require(_0x8a73('0x7'));router[_0x8a73('0x8')]('/',auth[_0x8a73('0x9')](),controller['index']);router['get'](_0x8a73('0xa'),auth[_0x8a73('0x9')](),controller[_0x8a73('0xb')]);router[_0x8a73('0x8')](_0x8a73('0xc'),auth[_0x8a73('0x9')](),controller[_0x8a73('0xd')]);router[_0x8a73('0xe')]('/',auth[_0x8a73('0x9')](),controller[_0x8a73('0xf')]);router[_0x8a73('0x10')](_0x8a73('0xc'),auth[_0x8a73('0x9')](),controller[_0x8a73('0x11')]);router[_0x8a73('0x12')]('/:id',auth[_0x8a73('0x9')](),controller[_0x8a73('0x13')]);module[_0x8a73('0x14')]=router; \ No newline at end of file +var _0xb4d6=['describe','get','/:id','post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','./chatOfflineMessage.controller','isAuthenticated','/describe'];(function(_0xfa7ae8,_0x1286a9){var _0x3f698c=function(_0x96e55){while(--_0x96e55){_0xfa7ae8['push'](_0xfa7ae8['shift']());}};_0x3f698c(++_0x1286a9);}(_0xb4d6,0x70));var _0x6b4d=function(_0x50e89b,_0x4bded8){_0x50e89b=_0x50e89b-0x0;var _0x4b9202=_0xb4d6[_0x50e89b];return _0x4b9202;};'use strict';var multer=require(_0x6b4d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b4d('0x1'));var router=express[_0x6b4d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6b4d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b4d('0x4'));router['get']('/',auth[_0x6b4d('0x5')](),controller['index']);router['get'](_0x6b4d('0x6'),auth['isAuthenticated'](),controller[_0x6b4d('0x7')]);router[_0x6b4d('0x8')](_0x6b4d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6b4d('0xa')]('/',auth[_0x6b4d('0x5')](),controller[_0x6b4d('0xb')]);router[_0x6b4d('0xc')](_0x6b4d('0x9'),auth[_0x6b4d('0x5')](),controller[_0x6b4d('0xd')]);router[_0x6b4d('0xe')](_0x6b4d('0x9'),auth[_0x6b4d('0x5')](),controller[_0x6b4d('0xf')]);module[_0x6b4d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6767485..1237e25 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 _0xae29=['STRING','mouseOver','INTEGER','sequelize','exports'];(function(_0x2c7b11,_0x19a38e){var _0x222b49=function(_0x57a52d){while(--_0x57a52d){_0x2c7b11['push'](_0x2c7b11['shift']());}};_0x222b49(++_0x19a38e);}(_0xae29,0xad));var _0x9ae2=function(_0x3f3f75,_0x5e215f){_0x3f3f75=_0x3f3f75-0x0;var _0x322635=_0xae29[_0x3f3f75];return _0x322635;};'use strict';var Sequelize=require(_0x9ae2('0x0'));module[_0x9ae2('0x1')]={'name':{'type':Sequelize[_0x9ae2('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0x9ae2('0x3')},'selector':{'type':Sequelize[_0x9ae2('0x2')]},'timeout':{'type':Sequelize[_0x9ae2('0x4')]}}; \ No newline at end of file +var _0xf807=['mouseOver','INTEGER','exports','STRING'];(function(_0x2952b7,_0x18b173){var _0x1b86cd=function(_0x6b9a0e){while(--_0x6b9a0e){_0x2952b7['push'](_0x2952b7['shift']());}};_0x1b86cd(++_0x18b173);}(_0xf807,0xb2));var _0x7f80=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0xf807[_0x108d5f];return _0x456ea3;};'use strict';var Sequelize=require('sequelize');module[_0x7f80('0x0')]={'name':{'type':Sequelize[_0x7f80('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7f80('0x2'),'timeout'),'defaultValue':_0x7f80('0x2')},'selector':{'type':Sequelize[_0x7f80('0x1')]},'timeout':{'type':Sequelize[_0x7f80('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 04175db..c0daece 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 _0x9a19=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','params','keys','ChatProactiveAction','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x18ca81,_0x5698ae){var _0x4c8c5c=function(_0x57477f){while(--_0x57477f){_0x18ca81['push'](_0x18ca81['shift']());}};_0x4c8c5c(++_0x5698ae);}(_0x9a19,0x114));var _0x99a1=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x9a19[_0x32b542];return _0x554d54;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0x3c813,_0x491341){return function(_0x4fe7f7){if(!_0x4fe7f7){_0x3c813[_0x99a1('0x19')](0x194);}return _0x4fe7f7;};}function handleError(_0x5dabd9,_0x5dc733){_0x5dc733=_0x5dc733||0x1f4;return function(_0xafea84){logger[_0x99a1('0x25')](_0xafea84[_0x99a1('0x26')]);if(_0xafea84[_0x99a1('0x27')]){delete _0xafea84[_0x99a1('0x27')];}_0x5dabd9[_0x99a1('0x1a')](_0x5dc733)[_0x99a1('0x28')](_0xafea84);};}exports['show']=function(_0xf41b0d,_0x499eef){var _0x255197={'raw':!![],'where':{'id':_0xf41b0d[_0x99a1('0x29')]['id']}},_0x1137f2={};_0x1137f2['model']=_[_0x99a1('0x2a')](db[_0x99a1('0x2b')]['rawAttributes']);_0x1137f2[_0x99a1('0x2c')]=_[_0x99a1('0x2a')](_0xf41b0d[_0x99a1('0x2c')]);_0x1137f2[_0x99a1('0x2d')]=_[_0x99a1('0x2e')](_0x1137f2[_0x99a1('0x2f')],_0x1137f2[_0x99a1('0x2c')]);_0x255197[_0x99a1('0x30')]=_['intersection'](_0x1137f2['model'],qs[_0x99a1('0x31')](_0xf41b0d['query'][_0x99a1('0x31')]));_0x255197[_0x99a1('0x30')]=_0x255197['attributes'][_0x99a1('0x32')]?_0x255197[_0x99a1('0x30')]:_0x1137f2[_0x99a1('0x2f')];if(_0xf41b0d[_0x99a1('0x2c')][_0x99a1('0x33')]){_0x255197[_0x99a1('0x34')]=[{'all':!![]}];}_0x255197=_[_0x99a1('0x35')]({},_0x255197,_0xf41b0d[_0x99a1('0x36')]);return db[_0x99a1('0x2b')][_0x99a1('0x37')](_0x255197)[_0x99a1('0x23')](handleEntityNotFound(_0x499eef,null))[_0x99a1('0x23')](respondWithResult(_0x499eef,null))[_0x99a1('0x38')](handleError(_0x499eef,null));};exports[_0x99a1('0x39')]=function(_0x55005e,_0x53fed5){return db[_0x99a1('0x2b')][_0x99a1('0x39')](_0x55005e[_0x99a1('0x3a')],{})[_0x99a1('0x23')](respondWithResult(_0x53fed5,0xc9))[_0x99a1('0x38')](handleError(_0x53fed5,null));};exports[_0x99a1('0x3b')]=function(_0x318dab,_0x54840d){if(_0x318dab[_0x99a1('0x3a')]['id']){delete _0x318dab[_0x99a1('0x3a')]['id'];}return db['ChatProactiveAction'][_0x99a1('0x37')]({'where':{'id':_0x318dab[_0x99a1('0x29')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x54840d,null))[_0x99a1('0x23')](saveUpdates(_0x318dab[_0x99a1('0x3a')],null))[_0x99a1('0x23')](respondWithResult(_0x54840d,null))[_0x99a1('0x38')](handleError(_0x54840d,null));};exports[_0x99a1('0x24')]=function(_0x1a44c6,_0x17bb50){return db[_0x99a1('0x2b')][_0x99a1('0x37')]({'where':{'id':_0x1a44c6[_0x99a1('0x29')]['id']}})['then'](handleEntityNotFound(_0x17bb50,null))['then'](removeEntity(_0x17bb50,null))['catch'](handleError(_0x17bb50,null));}; \ No newline at end of file +var _0x1666=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatProactiveAction','filters','intersection','query','attributes','fields','length','merge','options','find','create','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x1666,0x75));var _0x6166=function(_0x25e6df,_0x2efa38){_0x25e6df=_0x25e6df-0x0;var _0x2dfaf6=_0x1666[_0x25e6df];return _0x2dfaf6;};'use strict';var emlformat=require(_0x6166('0x0'));var rimraf=require(_0x6166('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6166('0x2'));var rp=require(_0x6166('0x3'));var moment=require(_0x6166('0x4'));var BPromise=require(_0x6166('0x5'));var Mustache=require(_0x6166('0x6'));var util=require(_0x6166('0x7'));var path=require(_0x6166('0x8'));var sox=require(_0x6166('0x9'));var csv=require('to-csv');var ejs=require(_0x6166('0xa'));var fs=require('fs');var fs_extra=require(_0x6166('0xb'));var _=require(_0x6166('0xc'));var squel=require(_0x6166('0xd'));var crypto=require(_0x6166('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6166('0xf'));var Papa=require('papaparse');var Redis=require(_0x6166('0x10'));var authService=require(_0x6166('0x11'));var qs=require(_0x6166('0x12'));var as=require(_0x6166('0x13'));var hardwareService=require(_0x6166('0x14'));var logger=require(_0x6166('0x15'))(_0x6166('0x16'));var utils=require('../../config/utils');var config=require(_0x6166('0x17'));var licenseUtil=require(_0x6166('0x18'));var db=require(_0x6166('0x19'))['db'];function respondWithStatusCode(_0x5b2335,_0x320728){_0x320728=_0x320728||0xcc;return function(_0x2ce997){if(_0x2ce997){return _0x5b2335[_0x6166('0x1a')](_0x320728);}return _0x5b2335[_0x6166('0x1b')](_0x320728)['end']();};}function respondWithResult(_0x1316f2,_0x33789f){_0x33789f=_0x33789f||0xc8;return function(_0x42abca){if(_0x42abca){return _0x1316f2[_0x6166('0x1b')](_0x33789f)[_0x6166('0x1c')](_0x42abca);}};}function respondWithFilteredResult(_0x147874,_0x56520c){return function(_0x3d2f83){if(_0x3d2f83){var _0x12f0a5=typeof _0x56520c[_0x6166('0x1d')]===_0x6166('0x1e')&&typeof _0x56520c[_0x6166('0x1f')]===_0x6166('0x1e');var _0x15f2e3=_0x3d2f83['count'];var _0x29764d=_0x12f0a5?0x0:_0x56520c[_0x6166('0x1d')];var _0x171795=_0x12f0a5?_0x3d2f83[_0x6166('0x20')]:_0x56520c[_0x6166('0x1d')]+_0x56520c['limit'];var _0x1c823b;if(_0x171795>=_0x15f2e3){_0x171795=_0x15f2e3;_0x1c823b=0xc8;}else{_0x1c823b=0xce;}_0x147874[_0x6166('0x1b')](_0x1c823b);return _0x147874[_0x6166('0x21')](_0x6166('0x22'),_0x29764d+'-'+_0x171795+'/'+_0x15f2e3)[_0x6166('0x1c')](_0x3d2f83);}return null;};}function patchUpdates(_0x28d90c){return function(_0x2411de){try{jsonpatch[_0x6166('0x23')](_0x2411de,_0x28d90c,!![]);}catch(_0x3b5a7e){return BPromise[_0x6166('0x24')](_0x3b5a7e);}return _0x2411de[_0x6166('0x25')]();};}function saveUpdates(_0x49c474,_0x1646ff){return function(_0x438ed3){if(_0x438ed3){return _0x438ed3[_0x6166('0x26')](_0x49c474)[_0x6166('0x27')](function(_0x33bc9b){return _0x33bc9b;});}return null;};}function removeEntity(_0x1d23c3,_0x3ffd46){return function(_0x26d926){if(_0x26d926){return _0x26d926['destroy']()[_0x6166('0x27')](function(){_0x1d23c3['status'](0xcc)[_0x6166('0x28')]();});}};}function handleEntityNotFound(_0x10a23e,_0x489b88){return function(_0x3b7452){if(!_0x3b7452){_0x10a23e[_0x6166('0x1a')](0x194);}return _0x3b7452;};}function handleError(_0x3b6107,_0x38fdb1){_0x38fdb1=_0x38fdb1||0x1f4;return function(_0x494838){logger[_0x6166('0x29')](_0x494838[_0x6166('0x2a')]);if(_0x494838[_0x6166('0x2b')]){delete _0x494838[_0x6166('0x2b')];}_0x3b6107[_0x6166('0x1b')](_0x38fdb1)[_0x6166('0x2c')](_0x494838);};}exports['show']=function(_0x54213b,_0x2c1167){var _0x2c1e5f={'raw':!![],'where':{'id':_0x54213b[_0x6166('0x2d')]['id']}},_0x357525={};_0x357525[_0x6166('0x2e')]=_[_0x6166('0x2f')](db[_0x6166('0x30')]['rawAttributes']);_0x357525['query']=_[_0x6166('0x2f')](_0x54213b['query']);_0x357525[_0x6166('0x31')]=_[_0x6166('0x32')](_0x357525[_0x6166('0x2e')],_0x357525[_0x6166('0x33')]);_0x2c1e5f[_0x6166('0x34')]=_['intersection'](_0x357525[_0x6166('0x2e')],qs[_0x6166('0x35')](_0x54213b[_0x6166('0x33')][_0x6166('0x35')]));_0x2c1e5f[_0x6166('0x34')]=_0x2c1e5f[_0x6166('0x34')][_0x6166('0x36')]?_0x2c1e5f['attributes']:_0x357525[_0x6166('0x2e')];if(_0x54213b[_0x6166('0x33')]['includeAll']){_0x2c1e5f['include']=[{'all':!![]}];}_0x2c1e5f=_[_0x6166('0x37')]({},_0x2c1e5f,_0x54213b[_0x6166('0x38')]);return db['ChatProactiveAction'][_0x6166('0x39')](_0x2c1e5f)[_0x6166('0x27')](handleEntityNotFound(_0x2c1167,null))[_0x6166('0x27')](respondWithResult(_0x2c1167,null))['catch'](handleError(_0x2c1167,null));};exports[_0x6166('0x3a')]=function(_0x45d518,_0x228790){return db['ChatProactiveAction']['create'](_0x45d518['body'],{})[_0x6166('0x27')](respondWithResult(_0x228790,0xc9))[_0x6166('0x3b')](handleError(_0x228790,null));};exports[_0x6166('0x26')]=function(_0x443a20,_0x38bb21){if(_0x443a20['body']['id']){delete _0x443a20[_0x6166('0x3c')]['id'];}return db[_0x6166('0x30')][_0x6166('0x39')]({'where':{'id':_0x443a20[_0x6166('0x2d')]['id']}})['then'](handleEntityNotFound(_0x38bb21,null))[_0x6166('0x27')](saveUpdates(_0x443a20[_0x6166('0x3c')],null))[_0x6166('0x27')](respondWithResult(_0x38bb21,null))[_0x6166('0x3b')](handleError(_0x38bb21,null));};exports['destroy']=function(_0x3a9917,_0x111d3b){return db[_0x6166('0x30')][_0x6166('0x39')]({'where':{'id':_0x3a9917[_0x6166('0x2d')]['id']}})[_0x6166('0x27')](handleEntityNotFound(_0x111d3b,null))['then'](removeEntity(_0x111d3b,null))[_0x6166('0x3b')](handleError(_0x111d3b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e0a7170..fd38e91 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 _0xd28e=['request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','api','bluebird'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xd28e,0x105));var _0xed28=function(_0x2d9c49,_0xc40595){_0x2d9c49=_0x2d9c49-0x0;var _0x4b86f3=_0xd28e[_0x2d9c49];return _0x4b86f3;};'use strict';var _=require('lodash');var util=require(_0xed28('0x0'));var logger=require('../../config/logger')(_0xed28('0x1'));var moment=require('moment');var BPromise=require(_0xed28('0x2'));var rp=require(_0xed28('0x3'));var fs=require('fs');var path=require(_0xed28('0x4'));var rimraf=require(_0xed28('0x5'));var config=require(_0xed28('0x6'));var attributes=require(_0xed28('0x7'));module[_0xed28('0x8')]=function(_0x594d16,_0x471f93){return _0x594d16[_0xed28('0x9')](_0xed28('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x911b=['../../config/environment','./chatProactiveAction.attributes','exports','util','moment','request-promise','rimraf'];(function(_0x2bdf1d,_0x4239d5){var _0xcc6155=function(_0x4deccf){while(--_0x4deccf){_0x2bdf1d['push'](_0x2bdf1d['shift']());}};_0xcc6155(++_0x4239d5);}(_0x911b,0xce));var _0xb911=function(_0x460a02,_0x341a72){_0x460a02=_0x460a02-0x0;var _0x4aad44=_0x911b[_0x460a02];return _0x4aad44;};'use strict';var _=require('lodash');var util=require(_0xb911('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb911('0x1'));var BPromise=require('bluebird');var rp=require(_0xb911('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb911('0x3'));var config=require(_0xb911('0x4'));var attributes=require(_0xb911('0x5'));module[_0xb911('0x6')]=function(_0x4ac950,_0x3ba514){return _0x4ac950['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index a03f93a..8f8559e 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 _0x6c32=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','debug','error','code','message','result','catch','util','moment'];(function(_0x305a8a,_0x52b422){var _0x31e245=function(_0x4722c0){while(--_0x4722c0){_0x305a8a['push'](_0x305a8a['shift']());}};_0x31e245(++_0x52b422);}(_0x6c32,0xda));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x26c3('0x0'));var moment=require(_0x26c3('0x1'));var BPromise=require(_0x26c3('0x2'));var rs=require(_0x26c3('0x3'));var fs=require('fs');var Redis=require(_0x26c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26c3('0x5'));var logger=require('../../config/logger')(_0x26c3('0x6'));var config=require(_0x26c3('0x7'));var jayson=require(_0x26c3('0x8'));var client=jayson[_0x26c3('0x9')][_0x26c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3483,_0x1a3450,_0x42be62){return new BPromise(function(_0x452612,_0x4a8126){return client[_0x26c3('0xb')](_0x4c3483,_0x42be62)['then'](function(_0xb3294e){logger[_0x26c3('0xc')](_0x26c3('0xd'),_0x1a3450,'request\x20sent');logger[_0x26c3('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1a3450,'request\x20sent',JSON['stringify'](_0xb3294e));if(_0xb3294e['error']){if(_0xb3294e[_0x26c3('0xf')][_0x26c3('0x10')]===0x1f4){logger[_0x26c3('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a3450,_0xb3294e[_0x26c3('0xf')][_0x26c3('0x11')]);return _0x4a8126(_0xb3294e[_0x26c3('0xf')][_0x26c3('0x11')]);}logger[_0x26c3('0xf')](_0x26c3('0xd'),_0x1a3450,_0xb3294e[_0x26c3('0xf')][_0x26c3('0x11')]);return _0x452612(_0xb3294e[_0x26c3('0xf')][_0x26c3('0x11')]);}else{logger[_0x26c3('0xc')](_0x26c3('0xd'),_0x1a3450,'request\x20sent');_0x452612(_0xb3294e[_0x26c3('0x12')]['message']);}})[_0x26c3('0x13')](function(_0xb0af8){logger[_0x26c3('0xf')](_0x26c3('0xd'),_0x1a3450,_0xb0af8);_0x4a8126(_0xb0af8);});});} \ No newline at end of file +var _0xa8e0=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x390a8e,_0x76f621){var _0x42bc00=function(_0x2e03ab){while(--_0x2e03ab){_0x390a8e['push'](_0x390a8e['shift']());}};_0x42bc00(++_0x76f621);}(_0xa8e0,0xf0));var _0x0a8e=function(_0x2f7725,_0x4d913b){_0x2f7725=_0x2f7725-0x0;var _0x498fa9=_0xa8e0[_0x2f7725];return _0x498fa9;};'use strict';var _=require('lodash');var util=require(_0x0a8e('0x0'));var moment=require('moment');var BPromise=require(_0x0a8e('0x1'));var rs=require(_0x0a8e('0x2'));var fs=require('fs');var Redis=require(_0x0a8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0a8e('0x4'));var jayson=require(_0x0a8e('0x5'));var client=jayson[_0x0a8e('0x6')][_0x0a8e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5349cd,_0x236c5e,_0x23baeb){return new BPromise(function(_0x1a825a,_0x427e24){return client[_0x0a8e('0x8')](_0x5349cd,_0x23baeb)[_0x0a8e('0x9')](function(_0x4a6812){logger['info'](_0x0a8e('0xa'),_0x236c5e,_0x0a8e('0xb'));logger[_0x0a8e('0xc')](_0x0a8e('0xd'),_0x236c5e,'request\x20sent',JSON[_0x0a8e('0xe')](_0x4a6812));if(_0x4a6812[_0x0a8e('0xf')]){if(_0x4a6812[_0x0a8e('0xf')][_0x0a8e('0x10')]===0x1f4){logger[_0x0a8e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x236c5e,_0x4a6812[_0x0a8e('0xf')]['message']);return _0x427e24(_0x4a6812[_0x0a8e('0xf')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x236c5e,_0x4a6812[_0x0a8e('0xf')][_0x0a8e('0x11')]);return _0x1a825a(_0x4a6812[_0x0a8e('0xf')][_0x0a8e('0x11')]);}else{logger[_0x0a8e('0x12')](_0x0a8e('0xa'),_0x236c5e,_0x0a8e('0xb'));_0x1a825a(_0x4a6812[_0x0a8e('0x13')][_0x0a8e('0x11')]);}})[_0x0a8e('0x14')](function(_0x9a717c){logger[_0x0a8e('0xf')](_0x0a8e('0xa'),_0x236c5e,_0x9a717c);_0x427e24(_0x9a717c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 06d6c50..dcb687d 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 _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x4852bf,_0x56c4a0){var _0x205695=function(_0x307f9b){while(--_0x307f9b){_0x4852bf['push'](_0x4852bf['shift']());}};_0x205695(++_0x56c4a0);}(_0x032e,0x124));var _0xe032=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x032e[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=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(_0x247998,_0x4a91be){var _0xacbe8c=function(_0x1ad715){while(--_0x1ad715){_0x247998['push'](_0x247998['shift']());}};_0xacbe8c(++_0x4a91be);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0xf2ca[_0x565fed];return _0x3e018f;};'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 2134800..21922ae 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 _0xf6b1=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x43ce33,_0x300b57){var _0x26f433=function(_0x2a473e){while(--_0x2a473e){_0x43ce33['push'](_0x43ce33['shift']());}};_0x26f433(++_0x300b57);}(_0xf6b1,0x1ae));var _0x1f6b=function(_0x24c803,_0xaf258c){_0x24c803=_0x24c803-0x0;var _0x59a954=_0xf6b1[_0x24c803];return _0x59a954;};'use strict';var Sequelize=require(_0x1f6b('0x0'));module[_0x1f6b('0x1')]={'name':{'type':Sequelize[_0x1f6b('0x2')],'unique':_0x1f6b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1f6b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1f6b('0x5')](_0x1f6b('0x6'),_0x1f6b('0x7'),_0x1f6b('0x8'))}}; \ No newline at end of file +var _0x08ca=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x3b15f7,_0x2cf95b){var _0x4f373a=function(_0x44053d){while(--_0x44053d){_0x3b15f7['push'](_0x3b15f7['shift']());}};_0x4f373a(++_0x2cf95b);}(_0x08ca,0x9b));var _0xa08c=function(_0x4faa64,_0x2dfdbe){_0x4faa64=_0x4faa64-0x0;var _0x2f2487=_0x08ca[_0x4faa64];return _0x2f2487;};'use strict';var Sequelize=require(_0xa08c('0x0'));module[_0xa08c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa08c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa08c('0x3')]},'timeout':{'type':Sequelize[_0xa08c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa08c('0x5'),_0xa08c('0x6'),_0xa08c('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a407885..f4d4817 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 _0x115a=['spread','emit','userChatQueue:save','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','then','ChatQueues','UserProfileResource','end','error','name','send','ChatQueue','fieldName','type','key','getOptions','include','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','create','body','user','role','UserProfileSection','describe','findOne','get','UserChatQueue','hasOwnProperty','order','sort','where','ChatQueueId','filter','map','options','findAll','User','findAndCountAll','agent','updatedAt','format','%s/%s','chatPause','Team','pick','getTeams','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','every','TeamId','includes','union','compact','value','find','isEmpty','removeAgents','userChatQueue:remove','addAgents'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x115a,0x1d1));var _0xa115=function(_0x3a5e13,_0x3b89c6){_0x3a5e13=_0x3a5e13-0x0;var _0xe67c37=_0x115a[_0x3a5e13];return _0xe67c37;};'use strict';var BPromise=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var _=require(_0xa115('0x2'));var squel=require(_0xa115('0x3'));var Redis=require('ioredis');var qs=require(_0xa115('0x4'));var logger=require(_0xa115('0x5'))('api');var config=require('../../config/environment');var db=require(_0xa115('0x6'))['db'];config[_0xa115('0x7')]=_['defaults'](config['redis'],{'host':_0xa115('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa115('0x7')]));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x51440b,_0x24a5ba){_0x24a5ba=_0x24a5ba||0xcc;return function(_0x3fd2a2){if(_0x3fd2a2){return _0x51440b[_0xa115('0x9')](_0x24a5ba);}return _0x51440b[_0xa115('0xa')](_0x24a5ba)['end']();};}function respondWithResult(_0x225b46,_0x40e14d){_0x40e14d=_0x40e14d||0xc8;return function(_0x35b61c){if(_0x35b61c){return _0x225b46['status'](_0x40e14d)['json'](_0x35b61c);}};}function respondWithFilteredResult(_0x2b6441,_0x27864e){return function(_0x60f9b){if(_0x60f9b){var _0x4e0660=typeof _0x27864e[_0xa115('0xb')]==='undefined'&&typeof _0x27864e['limit']===_0xa115('0xc');var _0x4ffe54=_0x60f9b[_0xa115('0xd')];var _0x46e550=_0x4e0660?0x0:_0x27864e['offset'];var _0x2d1432=_0x4e0660?_0x60f9b[_0xa115('0xd')]:_0x27864e[_0xa115('0xb')]+_0x27864e[_0xa115('0xe')];var _0x41a46f;if(_0x2d1432>=_0x4ffe54){_0x2d1432=_0x4ffe54;_0x41a46f=0xc8;}else{_0x41a46f=0xce;}_0x2b6441[_0xa115('0xa')](_0x41a46f);return _0x2b6441[_0xa115('0xf')](_0xa115('0x10'),_0x46e550+'-'+_0x2d1432+'/'+_0x4ffe54)[_0xa115('0x11')](_0x60f9b);}return null;};}function saveUpdates(_0x2d07fd){return function(_0x3c58f1){if(_0x3c58f1){return _0x3c58f1[_0xa115('0x12')](_0x2d07fd)['then'](function(_0x26d328){return _0x26d328;});}return null;};}function removeEntity(_0x86fed3){return function(_0x183e6e){if(_0x183e6e){return _0x183e6e[_0xa115('0x13')]()[_0xa115('0x14')](function(){var _0x3514ac=_0x183e6e['get']({'plain':!![]});var _0x2d2bf5=_0xa115('0x15');return db[_0xa115('0x16')]['destroy']({'where':{'type':_0x2d2bf5,'resourceId':_0x3514ac['id']}})[_0xa115('0x14')](function(){return _0x183e6e;});})[_0xa115('0x14')](function(){_0x86fed3[_0xa115('0xa')](0xcc)[_0xa115('0x17')]();});}};}function handleEntityNotFound(_0x504d7c){return function(_0x3a620a){if(!_0x3a620a){_0x504d7c[_0xa115('0x9')](0x194);}return _0x3a620a;};}function handleError(_0x54a4ad,_0x28593d){_0x28593d=_0x28593d||0x1f4;return function(_0x3c679f){logger[_0xa115('0x18')](_0x3c679f['stack']);if(_0x3c679f[_0xa115('0x19')]){delete _0x3c679f[_0xa115('0x19')];}_0x54a4ad[_0xa115('0xa')](_0x28593d)[_0xa115('0x1a')](_0x3c679f);};}exports['index']=function(_0x12415e,_0x40f0cf){var _0x452cd3={};var _0x41eec1={'count':0x0,'rows':[]};var _0x51a666=_['map'](db[_0xa115('0x1b')]['rawAttributes'],function(_0x4c977b){return{'name':_0x4c977b[_0xa115('0x1c')],'type':_0x4c977b[_0xa115('0x1d')][_0xa115('0x1e')]};});_0x452cd3=qs[_0xa115('0x1f')](_0x51a666,_0x12415e);var _0x1b1eca={'where':_0x452cd3['where']};return db[_0xa115('0x1b')]['count'](_0x1b1eca)[_0xa115('0x14')](function(_0x1d2d73){_0x41eec1['count']=_0x1d2d73;_0x452cd3[_0xa115('0x20')]=qs['include'](_0x12415e['query']);return db[_0xa115('0x1b')]['findAll'](_0x452cd3);})[_0xa115('0x14')](function(_0xd95335){_0x41eec1[_0xa115('0x21')]=_0xd95335;return _0x41eec1;})[_0xa115('0x14')](respondWithFilteredResult(_0x40f0cf,_0x452cd3))[_0xa115('0x22')](handleError(_0x40f0cf,null));};exports[_0xa115('0x23')]=function(_0x52794a,_0x407bf3){var _0x62d4e4={'raw':!![],'where':{'id':_0x52794a[_0xa115('0x24')]['id']}},_0x3f45e6={};_0x3f45e6[_0xa115('0x25')]=_[_0xa115('0x26')](db[_0xa115('0x1b')][_0xa115('0x27')]);_0x3f45e6[_0xa115('0x28')]=_[_0xa115('0x26')](_0x52794a['query']);_0x3f45e6[_0xa115('0x29')]=_[_0xa115('0x2a')](_0x3f45e6[_0xa115('0x25')],_0x3f45e6[_0xa115('0x28')]);_0x62d4e4[_0xa115('0x2b')]=_[_0xa115('0x2a')](_0x3f45e6[_0xa115('0x25')],qs[_0xa115('0x2c')](_0x52794a[_0xa115('0x28')][_0xa115('0x2c')]));_0x62d4e4[_0xa115('0x2b')]=_0x62d4e4[_0xa115('0x2b')][_0xa115('0x2d')]?_0x62d4e4[_0xa115('0x2b')]:_0x3f45e6[_0xa115('0x25')];if(_0x52794a[_0xa115('0x28')]['includeAll']){_0x62d4e4[_0xa115('0x20')]=[{'all':!![]}];}_0x62d4e4=_[_0xa115('0x2e')]({},_0x62d4e4,_0x52794a['options']);return db[_0xa115('0x1b')]['find'](_0x62d4e4)[_0xa115('0x14')](handleEntityNotFound(_0x407bf3,null))[_0xa115('0x14')](respondWithResult(_0x407bf3,null))[_0xa115('0x22')](handleError(_0x407bf3,null));};exports[_0xa115('0x2f')]=function(_0x14f525,_0x11153d){return db['ChatQueue']['create'](_0x14f525[_0xa115('0x30')],{})[_0xa115('0x14')](function(_0x385d7b){var _0x243426=_0x14f525[_0xa115('0x31')]['get']({'plain':!![]});if(!_0x243426)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x243426[_0xa115('0x32')]===_0xa115('0x31')){var _0x241c74=_0x385d7b['get']({'plain':!![]});var _0x259d71='ChatQueues';return db[_0xa115('0x33')]['find']({'where':{'name':_0x259d71,'userProfileId':_0x243426['userProfileId']},'raw':!![]})[_0xa115('0x14')](function(_0x19a16b){if(_0x19a16b&&_0x19a16b['autoAssociation']===0x0){return db['UserProfileResource'][_0xa115('0x2f')]({'name':_0x241c74[_0xa115('0x19')],'resourceId':_0x241c74['id'],'type':_0x19a16b[_0xa115('0x19')],'sectionId':_0x19a16b['id']},{})[_0xa115('0x14')](function(){return _0x385d7b;});}else{return _0x385d7b;}})[_0xa115('0x22')](function(_0x465b5d){logger[_0xa115('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x465b5d);throw _0x465b5d;});}return _0x385d7b;})[_0xa115('0x14')](respondWithResult(_0x11153d,0xc9))[_0xa115('0x22')](handleError(_0x11153d,null));};exports[_0xa115('0x12')]=function(_0x136dc4,_0xe430d6){if(_0x136dc4[_0xa115('0x30')]['id']){delete _0x136dc4['body']['id'];}return db[_0xa115('0x1b')]['find']({'where':{'id':_0x136dc4[_0xa115('0x24')]['id']}})[_0xa115('0x14')](handleEntityNotFound(_0xe430d6,null))[_0xa115('0x14')](saveUpdates(_0x136dc4[_0xa115('0x30')],null))[_0xa115('0x14')](respondWithResult(_0xe430d6,null))[_0xa115('0x22')](handleError(_0xe430d6,null));};exports[_0xa115('0x13')]=function(_0x3b65c8,_0x5aa5ef){return db[_0xa115('0x1b')]['find']({'where':{'id':_0x3b65c8[_0xa115('0x24')]['id']}})[_0xa115('0x14')](handleEntityNotFound(_0x5aa5ef,null))[_0xa115('0x14')](removeEntity(_0x5aa5ef,null))[_0xa115('0x22')](handleError(_0x5aa5ef,null));};exports[_0xa115('0x34')]=function(_0x427663,_0x5b74ce){return db[_0xa115('0x1b')][_0xa115('0x34')]()[_0xa115('0x14')](respondWithResult(_0x5b74ce,null))[_0xa115('0x22')](handleError(_0x5b74ce,null));};exports['getMembers']=function(_0x113bc9,_0xdc88f9){var _0x4cff11={'raw':!![],'where':{}},_0x425e94={},_0x1c4080;return db[_0xa115('0x1b')][_0xa115('0x35')]({'where':{'id':_0x113bc9[_0xa115('0x24')]['id']}})[_0xa115('0x14')](handleEntityNotFound(_0xdc88f9,null))[_0xa115('0x14')](function(_0x51940b){if(_0x51940b){_0x1c4080=_0x51940b[_0xa115('0x36')]({'plain':!![]});_0x425e94[_0xa115('0x25')]=_[_0xa115('0x26')](db[_0xa115('0x37')][_0xa115('0x27')]);_0x425e94['query']=_[_0xa115('0x26')](_0x113bc9['query']);_0x425e94[_0xa115('0x29')]=_['intersection'](_0x425e94[_0xa115('0x25')],_0x425e94[_0xa115('0x28')]);_0x4cff11[_0xa115('0x2b')]=_[_0xa115('0x2a')](_0x425e94['model'],qs[_0xa115('0x2c')](_0x113bc9['query'][_0xa115('0x2c')]));_0x4cff11['attributes']=_0x4cff11[_0xa115('0x2b')][_0xa115('0x2d')]?_0x4cff11[_0xa115('0x2b')]:_0x425e94[_0xa115('0x25')];if(!_0x113bc9[_0xa115('0x28')][_0xa115('0x38')]('nolimit')){_0x4cff11[_0xa115('0xe')]=qs[_0xa115('0xe')](_0x113bc9[_0xa115('0x28')][_0xa115('0xe')]);_0x4cff11['offset']=qs[_0xa115('0xb')](_0x113bc9[_0xa115('0x28')]['offset']);}_0x4cff11[_0xa115('0x39')]=qs[_0xa115('0x3a')](_0x113bc9['query']['sort']);_0x4cff11['where']=qs['filters'](_['pick'](_0x113bc9[_0xa115('0x28')],_0x425e94[_0xa115('0x29')]));_0x4cff11[_0xa115('0x3b')][_0xa115('0x3c')]=_0x51940b['id'];if(_0x113bc9[_0xa115('0x28')][_0xa115('0x3d')]){_0x4cff11[_0xa115('0x3b')]=_[_0xa115('0x2e')](_0x4cff11[_0xa115('0x3b')],{'$or':_[_0xa115('0x3e')](_0x4cff11[_0xa115('0x2b')],function(_0x267e6b){var _0x3fd5c3={};_0x3fd5c3[_0x267e6b]={'$like':'%'+_0x113bc9[_0xa115('0x28')][_0xa115('0x3d')]+'%'};return _0x3fd5c3;})});}_0x4cff11=_[_0xa115('0x2e')]({},_0x4cff11,_0x113bc9[_0xa115('0x3f')]);return db[_0xa115('0x37')][_0xa115('0x40')](_0x4cff11);}})[_0xa115('0x14')](function(_0x28f64d){if(_0x28f64d){return db[_0xa115('0x41')][_0xa115('0x42')]({'where':{'id':_['map'](_0x28f64d,'UserId'),'role':_0xa115('0x43')},'attributes':['id',_0xa115('0x19'),'chatPause',_0xa115('0x44'),'createdAt']});}})[_0xa115('0x14')](function(_0x2ba5d5){if(_0x2ba5d5){return{'count':_0x2ba5d5[_0xa115('0xd')],'rows':_[_0xa115('0x3e')](_0x2ba5d5[_0xa115('0x21')],function(_0x1f58cf){return{'membername':_0x1f58cf[_0xa115('0x19')],'UserId':_0x1f58cf['id'],'queue_name':_0x1c4080['name'],'ChatQueueId':_0x1c4080['id'],'interface':util[_0xa115('0x45')](_0xa115('0x46'),'SIP',_0x1f58cf[_0xa115('0x19')]),'penalty':0x0,'paused':_0x1f58cf[_0xa115('0x47')],'createdAt':_0x1f58cf['createdAt'],'updatedAt':_0x1f58cf[_0xa115('0x44')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa115('0x14')](respondWithFilteredResult(_0xdc88f9,_0x4cff11))[_0xa115('0x22')](handleError(_0xdc88f9,null));};exports['getTeams']=function(_0x957ace,_0xe4961e){var _0x746d54={};var _0xed6839={};var _0x191ccc;var _0x585a7f;return db[_0xa115('0x1b')][_0xa115('0x35')]({'where':{'id':_0x957ace['params']['id']}})[_0xa115('0x14')](handleEntityNotFound(_0xe4961e,null))[_0xa115('0x14')](function(_0x385498){if(_0x385498){_0x191ccc=_0x385498;_0xed6839[_0xa115('0x25')]=_['keys'](db[_0xa115('0x48')][_0xa115('0x27')]);_0xed6839[_0xa115('0x28')]=_['keys'](_0x957ace[_0xa115('0x28')]);_0xed6839[_0xa115('0x29')]=_[_0xa115('0x2a')](_0xed6839['model'],_0xed6839[_0xa115('0x28')]);_0x746d54[_0xa115('0x2b')]=_[_0xa115('0x2a')](_0xed6839[_0xa115('0x25')],qs[_0xa115('0x2c')](_0x957ace[_0xa115('0x28')]['fields']));_0x746d54[_0xa115('0x2b')]=_0x746d54['attributes'][_0xa115('0x2d')]?_0x746d54[_0xa115('0x2b')]:_0xed6839['model'];_0x746d54[_0xa115('0x39')]=qs[_0xa115('0x3a')](_0x957ace[_0xa115('0x28')][_0xa115('0x3a')]);_0x746d54['where']=qs[_0xa115('0x29')](_[_0xa115('0x49')](_0x957ace[_0xa115('0x28')],_0xed6839[_0xa115('0x29')]));if(_0x957ace[_0xa115('0x28')][_0xa115('0x3d')]){_0x746d54['where']=_[_0xa115('0x2e')](_0x746d54[_0xa115('0x3b')],{'$or':_[_0xa115('0x3e')](_0x746d54[_0xa115('0x2b')],function(_0x3d0c6b){var _0x55beb9={};_0x55beb9[_0x3d0c6b]={'$like':'%'+_0x957ace[_0xa115('0x28')][_0xa115('0x3d')]+'%'};return _0x55beb9;})});}_0x746d54=_[_0xa115('0x2e')]({},_0x746d54,_0x957ace[_0xa115('0x3f')]);return _0x191ccc[_0xa115('0x4a')](_0x746d54);}})[_0xa115('0x14')](function(_0x29ede4){if(_0x29ede4){_0x585a7f=_0x29ede4[_0xa115('0x2d')];if(!_0x957ace[_0xa115('0x28')][_0xa115('0x38')](_0xa115('0x4b'))){_0x746d54['limit']=qs[_0xa115('0xe')](_0x957ace[_0xa115('0x28')][_0xa115('0xe')]);_0x746d54[_0xa115('0xb')]=qs[_0xa115('0xb')](_0x957ace[_0xa115('0x28')][_0xa115('0xb')]);}return _0x191ccc[_0xa115('0x4a')](_0x746d54);}})[_0xa115('0x14')](function(_0xca918f){if(_0xca918f){return _0xca918f?{'count':_0x585a7f,'rows':_0xca918f}:null;}})['then'](respondWithResult(_0xe4961e,null))[_0xa115('0x22')](handleError(_0xe4961e,null));};exports[_0xa115('0x4c')]=function(_0x8845a0,_0x5e2b2f){var _0x1c9fcc=_0x8845a0[_0xa115('0x30')][_0xa115('0x4d')];return db[_0xa115('0x48')][_0xa115('0x40')]({'where':{'id':_0x1c9fcc},'attributes':['id'],'include':[{'model':db[_0xa115('0x41')],'as':_0xa115('0x4e'),'attributes':['id',_0xa115('0x19'),_0xa115('0x4f'),_0xa115('0x50'),_0xa115('0x51')],'raw':!![]}]})['then'](function(_0xa70db9){if(_0xa70db9){var _0x101f92=_[_0xa115('0x52')](_0xa70db9,function(_0x4dde33){var _0x34d3a7=_0x4dde33[_0xa115('0x36')]({'plain':!![]});return _0x34d3a7[_0xa115('0x4e')];});return db[_0xa115('0x1b')]['find']({'where':{'id':_0x8845a0[_0xa115('0x24')]['id']}})[_0xa115('0x14')](function(_0x59bf81){return db[_0xa115('0x53')][_0xa115('0x54')](function(_0x41b5e4){return _0x59bf81[_0xa115('0x4c')](_0x1c9fcc,{'transaction':_0x41b5e4})[_0xa115('0x14')](function(){return BPromise[_0xa115('0x55')](_0x101f92,function(_0x2a6274){return db['UserChatQueue'][_0xa115('0x56')]({'where':{'UserId':_0x2a6274['id'],'ChatQueueId':_0x8845a0[_0xa115('0x24')]['id']},'transaction':_0x41b5e4});});})['then'](function(){_0x101f92[_0xa115('0x57')](function(_0x29ddc9){socket['emit']('userChatQueue:save',{'UserId':_0x29ddc9['id'],'ChatQueueId':_0x59bf81['id']});});});});});}})['then'](respondWithStatusCode(_0x5e2b2f,null))['catch'](handleError(_0x5e2b2f,null));};exports[_0xa115('0x58')]=function(_0x22f7e0,_0x18b0c6){return db[_0xa115('0x48')]['findAll']({'where':{'id':_0x22f7e0[_0xa115('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa115('0x41')],'as':_0xa115('0x4e'),'attributes':['id'],'raw':!![]}]})[_0xa115('0x14')](handleEntityNotFound(_0x18b0c6,null))[_0xa115('0x14')](function(_0x46baae){var _0x1da862=_['map'](_0x46baae,'id');var _0x354c0e=[];var _0x5a45ab=[];var _0x40113c=squel[_0xa115('0x59')]();_0x40113c[_0xa115('0x5a')](_0xa115('0x5b'))[_0xa115('0x5c')](_0xa115('0x5d'),'tq')[_0xa115('0x5e')](_0xa115('0x5f'),'ut',_0xa115('0x60'))['where']('ChatQueueId\x20=\x20?',_0x22f7e0['params']['id']);for(var _0x573ea4=0x0;_0x573ea4<_0x46baae[_0xa115('0x2d')];_0x573ea4+=0x1){let _0x4645a7=_0x46baae[_0x573ea4];for(var _0xe96020=0x0;_0xe96020<_0x4645a7[_0xa115('0x4e')][_0xa115('0x2d')];_0xe96020+=0x1){let _0x4702c6=_0x4645a7['Agents'][_0xe96020];var _0x10a149=_0x40113c['clone']();_0x10a149[_0xa115('0x3b')](_0xa115('0x61'),_0x4702c6['id']);_0x5a45ab[_0xa115('0x62')](db[_0xa115('0x53')][_0xa115('0x28')](_0x10a149['toString'](),{'type':db[_0xa115('0x53')]['QueryTypes']['SELECT']})[_0xa115('0x14')](function(_0x14d7f4){if(_0x14d7f4[_0xa115('0x2d')]===0x1){return _0x4702c6['id'];}else{var _0x383c34=_[_0xa115('0x63')](_['map'](_0x14d7f4,_0xa115('0x64')),function(_0x8f2f29){return _[_0xa115('0x65')](_0x1da862,_0x8f2f29);});if(_0x383c34){return _0x4702c6['id'];}}}));}}return BPromise['all'](_0x5a45ab)[_0xa115('0x14')](function(_0x43dea5){_0x354c0e=_(_0x354c0e)[_0xa115('0x66')](_0x43dea5)[_0xa115('0x67')]()[_0xa115('0x68')]();return db[_0xa115('0x1b')][_0xa115('0x69')]({'where':{'id':_0x22f7e0[_0xa115('0x24')]['id']}})[_0xa115('0x14')](function(_0x2a3693){return db['sequelize'][_0xa115('0x54')](function(_0x2dfb31){return _0x2a3693[_0xa115('0x58')](_0x22f7e0[_0xa115('0x28')][_0xa115('0x4d')],{'transaction':_0x2dfb31})[_0xa115('0x14')](function(){if(!_[_0xa115('0x6a')](_0x354c0e)){return _0x2a3693[_0xa115('0x6b')](_0x354c0e,{'transaction':_0x2dfb31});}})[_0xa115('0x14')](function(){_0x354c0e[_0xa115('0x57')](function(_0x5ee327){socket['emit'](_0xa115('0x6c'),{'UserId':_0x5ee327,'ChatQueueId':_0x2a3693['id']});});});});});});})[_0xa115('0x14')](respondWithStatusCode(_0x18b0c6,null))['catch'](handleError(_0x18b0c6,null));};exports['addAgents']=function(_0x2adc87,_0x133f84){return db[_0xa115('0x1b')][_0xa115('0x69')]({'where':{'id':_0x2adc87[_0xa115('0x24')]['id']}})['then'](handleEntityNotFound(_0x133f84,null))[_0xa115('0x14')](function(_0x2d8635){if(_0x2d8635){return _0x2d8635[_0xa115('0x6d')](_0x2adc87[_0xa115('0x30')]['ids'],_['omit'](_0x2adc87[_0xa115('0x30')],['ids','id'])||{})[_0xa115('0x6e')](function(_0x3d2ee2){for(var _0x53bf58=0x0;_0x53bf58<_0x2adc87[_0xa115('0x30')][_0xa115('0x4d')][_0xa115('0x2d')];_0x53bf58+=0x1){socket[_0xa115('0x6f')](_0xa115('0x70'),{'UserId':Number(_0x2adc87['body'][_0xa115('0x4d')][_0x53bf58]),'ChatQueueId':Number(_0x2adc87['params']['id'])});}return _0x3d2ee2;});}})['then'](respondWithResult(_0x133f84,null))[_0xa115('0x22')](handleError(_0x133f84,null));};exports[_0xa115('0x6b')]=function(_0x301a7c,_0x2e274b){return db[_0xa115('0x1b')][_0xa115('0x69')]({'where':{'id':_0x301a7c['params']['id']}})[_0xa115('0x14')](handleEntityNotFound(_0x2e274b,null))['then'](function(_0x3e4618){if(_0x3e4618){return _0x3e4618[_0xa115('0x6b')](_0x301a7c['query'][_0xa115('0x4d')])['then'](function(){if(_[_0xa115('0x71')](_0x301a7c[_0xa115('0x28')][_0xa115('0x4d')])){for(var _0x14738b=0x0;_0x14738b<_0x301a7c[_0xa115('0x28')][_0xa115('0x4d')][_0xa115('0x2d')];_0x14738b+=0x1){socket['emit'](_0xa115('0x6c'),{'UserId':Number(_0x301a7c[_0xa115('0x28')]['ids'][_0x14738b]),'ChatQueueId':Number(_0x301a7c['params']['id'])});}}else{socket[_0xa115('0x6f')](_0xa115('0x6c'),{'UserId':Number(_0x301a7c[_0xa115('0x28')][_0xa115('0x4d')]),'ChatQueueId':Number(_0x301a7c[_0xa115('0x24')]['id'])});}});}})[_0xa115('0x14')](respondWithStatusCode(_0x2e274b,null))[_0xa115('0x22')](handleError(_0x2e274b,null));};exports[_0xa115('0x72')]=function(_0x1d004b,_0x241791){var _0x568615={};var _0x470925={};var _0x34417e;var _0x5a2832;return db[_0xa115('0x1b')][_0xa115('0x35')]({'where':{'id':_0x1d004b[_0xa115('0x24')]['id']}})['then'](handleEntityNotFound(_0x241791,null))['then'](function(_0x318a58){if(_0x318a58){_0x34417e=_0x318a58;_0x470925[_0xa115('0x25')]=_[_0xa115('0x26')](db[_0xa115('0x41')][_0xa115('0x27')]);_0x470925[_0xa115('0x28')]=_[_0xa115('0x26')](_0x1d004b['query']);_0x470925[_0xa115('0x29')]=_[_0xa115('0x2a')](_0x470925[_0xa115('0x25')],_0x470925[_0xa115('0x28')]);_0x568615[_0xa115('0x2b')]=_[_0xa115('0x2a')](_0x470925[_0xa115('0x25')],qs[_0xa115('0x2c')](_0x1d004b[_0xa115('0x28')]['fields']));_0x568615['attributes']=_0x568615[_0xa115('0x2b')]['length']?_0x568615['attributes']:_0x470925[_0xa115('0x25')];_0x568615['order']=qs[_0xa115('0x3a')](_0x1d004b['query']['sort']);_0x568615[_0xa115('0x3b')]=qs['filters'](_[_0xa115('0x49')](_0x1d004b[_0xa115('0x28')],_0x470925[_0xa115('0x29')]));if(_0x1d004b[_0xa115('0x28')]['filter']){_0x568615['where']=_['merge'](_0x568615['where'],{'$or':_[_0xa115('0x3e')](_0x568615['attributes'],function(_0x5c622e){var _0x4e9575={};_0x4e9575[_0x5c622e]={'$like':'%'+_0x1d004b[_0xa115('0x28')][_0xa115('0x3d')]+'%'};return _0x4e9575;})});}_0x568615=_[_0xa115('0x2e')]({},_0x568615,_0x1d004b[_0xa115('0x3f')]);return _0x34417e[_0xa115('0x72')](_0x568615);}})['then'](function(_0x29ce60){if(_0x29ce60){_0x5a2832=_0x29ce60[_0xa115('0x2d')];if(!_0x1d004b['query'][_0xa115('0x38')]('nolimit')){_0x568615[_0xa115('0xe')]=qs['limit'](_0x1d004b['query'][_0xa115('0xe')]);_0x568615['offset']=qs[_0xa115('0xb')](_0x1d004b['query'][_0xa115('0xb')]);}return _0x34417e[_0xa115('0x72')](_0x568615);}})[_0xa115('0x14')](function(_0x797ca){if(_0x797ca){return _0x797ca?{'count':_0x5a2832,'rows':_0x797ca}:null;}})['then'](respondWithResult(_0x241791,null))[_0xa115('0x22')](handleError(_0x241791,null));}; \ No newline at end of file +var _0x8e2a=['SIP','getTeams','Team','order','hasOwnProperty','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','emit','addAgents','omit','spread','userChatQueue:save','removeAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','destroy','then','get','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','params','model','keys','intersection','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','limit','sort','filters','pick','where','filter','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s'];(function(_0x4c7bc9,_0x1428a7){var _0x220db8=function(_0x1e1b21){while(--_0x1e1b21){_0x4c7bc9['push'](_0x4c7bc9['shift']());}};_0x220db8(++_0x1428a7);}(_0x8e2a,0x139));var _0xa8e2=function(_0x771f80,_0x279715){_0x771f80=_0x771f80-0x0;var _0x2090ec=_0x8e2a[_0x771f80];return _0x2090ec;};'use strict';var BPromise=require(_0xa8e2('0x0'));var util=require(_0xa8e2('0x1'));var _=require(_0xa8e2('0x2'));var squel=require(_0xa8e2('0x3'));var Redis=require(_0xa8e2('0x4'));var qs=require(_0xa8e2('0x5'));var logger=require(_0xa8e2('0x6'))(_0xa8e2('0x7'));var config=require('../../config/environment');var db=require(_0xa8e2('0x8'))['db'];config[_0xa8e2('0x9')]=_[_0xa8e2('0xa')](config[_0xa8e2('0x9')],{'host':_0xa8e2('0xb'),'port':0x18eb});var socket=require(_0xa8e2('0xc'))(new Redis(config[_0xa8e2('0x9')]));require(_0xa8e2('0xd'))[_0xa8e2('0xe')](socket);function respondWithStatusCode(_0x5d973c,_0x319cbd){_0x319cbd=_0x319cbd||0xcc;return function(_0x3f0be1){if(_0x3f0be1){return _0x5d973c[_0xa8e2('0xf')](_0x319cbd);}return _0x5d973c['status'](_0x319cbd)['end']();};}function respondWithResult(_0x38b0f9,_0x1bb55a){_0x1bb55a=_0x1bb55a||0xc8;return function(_0x499514){if(_0x499514){return _0x38b0f9[_0xa8e2('0x10')](_0x1bb55a)[_0xa8e2('0x11')](_0x499514);}};}function respondWithFilteredResult(_0x5372e5,_0x1535b7){return function(_0x46ea9f){if(_0x46ea9f){var _0xed8660=typeof _0x1535b7[_0xa8e2('0x12')]===_0xa8e2('0x13')&&typeof _0x1535b7['limit']===_0xa8e2('0x13');var _0x317f3b=_0x46ea9f[_0xa8e2('0x14')];var _0x2776ef=_0xed8660?0x0:_0x1535b7[_0xa8e2('0x12')];var _0x2235ab=_0xed8660?_0x46ea9f[_0xa8e2('0x14')]:_0x1535b7['offset']+_0x1535b7['limit'];var _0x5657b5;if(_0x2235ab>=_0x317f3b){_0x2235ab=_0x317f3b;_0x5657b5=0xc8;}else{_0x5657b5=0xce;}_0x5372e5[_0xa8e2('0x10')](_0x5657b5);return _0x5372e5[_0xa8e2('0x15')](_0xa8e2('0x16'),_0x2776ef+'-'+_0x2235ab+'/'+_0x317f3b)[_0xa8e2('0x11')](_0x46ea9f);}return null;};}function saveUpdates(_0x1f22fa){return function(_0x30a786){if(_0x30a786){return _0x30a786['update'](_0x1f22fa)['then'](function(_0x4f9dfe){return _0x4f9dfe;});}return null;};}function removeEntity(_0x3695ea){return function(_0x22b7bc){if(_0x22b7bc){return _0x22b7bc[_0xa8e2('0x17')]()[_0xa8e2('0x18')](function(){var _0x1b9867=_0x22b7bc[_0xa8e2('0x19')]({'plain':!![]});var _0x3dc5f3='ChatQueues';return db[_0xa8e2('0x1a')]['destroy']({'where':{'type':_0x3dc5f3,'resourceId':_0x1b9867['id']}})[_0xa8e2('0x18')](function(){return _0x22b7bc;});})['then'](function(){_0x3695ea['status'](0xcc)[_0xa8e2('0x1b')]();});}};}function handleEntityNotFound(_0x1d7fc3){return function(_0xb88c7e){if(!_0xb88c7e){_0x1d7fc3[_0xa8e2('0xf')](0x194);}return _0xb88c7e;};}function handleError(_0x4366db,_0x4e8edb){_0x4e8edb=_0x4e8edb||0x1f4;return function(_0x571c0a){logger['error'](_0x571c0a[_0xa8e2('0x1c')]);if(_0x571c0a['name']){delete _0x571c0a[_0xa8e2('0x1d')];}_0x4366db['status'](_0x4e8edb)[_0xa8e2('0x1e')](_0x571c0a);};}exports[_0xa8e2('0x1f')]=function(_0x44710d,_0x3b52bf){var _0x451734={};var _0x28ccc6={'count':0x0,'rows':[]};var _0x13ca7a=_[_0xa8e2('0x20')](db[_0xa8e2('0x21')][_0xa8e2('0x22')],function(_0x2304df){return{'name':_0x2304df[_0xa8e2('0x23')],'type':_0x2304df[_0xa8e2('0x24')][_0xa8e2('0x25')]};});_0x451734=qs[_0xa8e2('0x26')](_0x13ca7a,_0x44710d);var _0x305749={'where':_0x451734['where']};return db[_0xa8e2('0x21')][_0xa8e2('0x14')](_0x305749)[_0xa8e2('0x18')](function(_0x508247){_0x28ccc6[_0xa8e2('0x14')]=_0x508247;_0x451734['include']=qs[_0xa8e2('0x27')](_0x44710d[_0xa8e2('0x28')]);return db[_0xa8e2('0x21')]['findAll'](_0x451734);})['then'](function(_0x4f79fb){_0x28ccc6[_0xa8e2('0x29')]=_0x4f79fb;return _0x28ccc6;})['then'](respondWithFilteredResult(_0x3b52bf,_0x451734))[_0xa8e2('0x2a')](handleError(_0x3b52bf,null));};exports['show']=function(_0x50b398,_0x1da902){var _0x2dd150={'raw':!![],'where':{'id':_0x50b398[_0xa8e2('0x2b')]['id']}},_0x116891={};_0x116891[_0xa8e2('0x2c')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x116891[_0xa8e2('0x28')]=_[_0xa8e2('0x2d')](_0x50b398[_0xa8e2('0x28')]);_0x116891['filters']=_[_0xa8e2('0x2e')](_0x116891['model'],_0x116891[_0xa8e2('0x28')]);_0x2dd150['attributes']=_[_0xa8e2('0x2e')](_0x116891[_0xa8e2('0x2c')],qs['fields'](_0x50b398[_0xa8e2('0x28')][_0xa8e2('0x2f')]));_0x2dd150[_0xa8e2('0x30')]=_0x2dd150[_0xa8e2('0x30')][_0xa8e2('0x31')]?_0x2dd150[_0xa8e2('0x30')]:_0x116891[_0xa8e2('0x2c')];if(_0x50b398[_0xa8e2('0x28')]['includeAll']){_0x2dd150[_0xa8e2('0x27')]=[{'all':!![]}];}_0x2dd150=_[_0xa8e2('0x32')]({},_0x2dd150,_0x50b398[_0xa8e2('0x33')]);return db[_0xa8e2('0x21')][_0xa8e2('0x34')](_0x2dd150)[_0xa8e2('0x18')](handleEntityNotFound(_0x1da902,null))[_0xa8e2('0x18')](respondWithResult(_0x1da902,null))[_0xa8e2('0x2a')](handleError(_0x1da902,null));};exports[_0xa8e2('0x35')]=function(_0x553775,_0x4c7e40){return db[_0xa8e2('0x21')][_0xa8e2('0x35')](_0x553775[_0xa8e2('0x36')],{})[_0xa8e2('0x18')](function(_0x2b08a0){var _0x59eb63=_0x553775[_0xa8e2('0x37')][_0xa8e2('0x19')]({'plain':!![]});if(!_0x59eb63)throw new Error(_0xa8e2('0x38'));if(_0x59eb63[_0xa8e2('0x39')]==='user'){var _0x4ab5e2=_0x2b08a0[_0xa8e2('0x19')]({'plain':!![]});var _0x2b5dc6=_0xa8e2('0x3a');return db[_0xa8e2('0x3b')][_0xa8e2('0x34')]({'where':{'name':_0x2b5dc6,'userProfileId':_0x59eb63[_0xa8e2('0x3c')]},'raw':!![]})['then'](function(_0x50454f){if(_0x50454f&&_0x50454f[_0xa8e2('0x3d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4ab5e2[_0xa8e2('0x1d')],'resourceId':_0x4ab5e2['id'],'type':_0x50454f[_0xa8e2('0x1d')],'sectionId':_0x50454f['id']},{})[_0xa8e2('0x18')](function(){return _0x2b08a0;});}else{return _0x2b08a0;}})[_0xa8e2('0x2a')](function(_0x57472c){logger[_0xa8e2('0x3e')](_0xa8e2('0x3f'),_0x57472c);throw _0x57472c;});}return _0x2b08a0;})[_0xa8e2('0x18')](respondWithResult(_0x4c7e40,0xc9))[_0xa8e2('0x2a')](handleError(_0x4c7e40,null));};exports[_0xa8e2('0x40')]=function(_0x3de02c,_0x143d7b){if(_0x3de02c['body']['id']){delete _0x3de02c[_0xa8e2('0x36')]['id'];}return db['ChatQueue'][_0xa8e2('0x34')]({'where':{'id':_0x3de02c[_0xa8e2('0x2b')]['id']}})[_0xa8e2('0x18')](handleEntityNotFound(_0x143d7b,null))['then'](saveUpdates(_0x3de02c['body'],null))['then'](respondWithResult(_0x143d7b,null))[_0xa8e2('0x2a')](handleError(_0x143d7b,null));};exports['destroy']=function(_0x221dc4,_0x49dab2){return db[_0xa8e2('0x21')][_0xa8e2('0x34')]({'where':{'id':_0x221dc4[_0xa8e2('0x2b')]['id']}})[_0xa8e2('0x18')](handleEntityNotFound(_0x49dab2,null))[_0xa8e2('0x18')](removeEntity(_0x49dab2,null))[_0xa8e2('0x2a')](handleError(_0x49dab2,null));};exports[_0xa8e2('0x41')]=function(_0x1322bf,_0x2faaa9){return db[_0xa8e2('0x21')][_0xa8e2('0x41')]()['then'](respondWithResult(_0x2faaa9,null))[_0xa8e2('0x2a')](handleError(_0x2faaa9,null));};exports[_0xa8e2('0x42')]=function(_0x3cb6b3,_0x4b9b79){var _0x453cda={'raw':!![],'where':{}},_0x163e0b={},_0x279d05;return db['ChatQueue'][_0xa8e2('0x43')]({'where':{'id':_0x3cb6b3[_0xa8e2('0x2b')]['id']}})[_0xa8e2('0x18')](handleEntityNotFound(_0x4b9b79,null))[_0xa8e2('0x18')](function(_0x29a6cb){if(_0x29a6cb){_0x279d05=_0x29a6cb[_0xa8e2('0x19')]({'plain':!![]});_0x163e0b[_0xa8e2('0x2c')]=_[_0xa8e2('0x2d')](db['UserChatQueue'][_0xa8e2('0x22')]);_0x163e0b[_0xa8e2('0x28')]=_[_0xa8e2('0x2d')](_0x3cb6b3[_0xa8e2('0x28')]);_0x163e0b['filters']=_['intersection'](_0x163e0b[_0xa8e2('0x2c')],_0x163e0b[_0xa8e2('0x28')]);_0x453cda[_0xa8e2('0x30')]=_[_0xa8e2('0x2e')](_0x163e0b['model'],qs[_0xa8e2('0x2f')](_0x3cb6b3[_0xa8e2('0x28')]['fields']));_0x453cda[_0xa8e2('0x30')]=_0x453cda[_0xa8e2('0x30')][_0xa8e2('0x31')]?_0x453cda[_0xa8e2('0x30')]:_0x163e0b[_0xa8e2('0x2c')];if(!_0x3cb6b3[_0xa8e2('0x28')]['hasOwnProperty'](_0xa8e2('0x44'))){_0x453cda[_0xa8e2('0x45')]=qs[_0xa8e2('0x45')](_0x3cb6b3[_0xa8e2('0x28')][_0xa8e2('0x45')]);_0x453cda[_0xa8e2('0x12')]=qs[_0xa8e2('0x12')](_0x3cb6b3[_0xa8e2('0x28')][_0xa8e2('0x12')]);}_0x453cda['order']=qs[_0xa8e2('0x46')](_0x3cb6b3['query'][_0xa8e2('0x46')]);_0x453cda['where']=qs[_0xa8e2('0x47')](_[_0xa8e2('0x48')](_0x3cb6b3[_0xa8e2('0x28')],_0x163e0b['filters']));_0x453cda[_0xa8e2('0x49')]['ChatQueueId']=_0x29a6cb['id'];if(_0x3cb6b3[_0xa8e2('0x28')][_0xa8e2('0x4a')]){_0x453cda['where']=_['merge'](_0x453cda[_0xa8e2('0x49')],{'$or':_['map'](_0x453cda['attributes'],function(_0x3db500){var _0x1a93ff={};_0x1a93ff[_0x3db500]={'$like':'%'+_0x3cb6b3[_0xa8e2('0x28')][_0xa8e2('0x4a')]+'%'};return _0x1a93ff;})});}_0x453cda=_[_0xa8e2('0x32')]({},_0x453cda,_0x3cb6b3[_0xa8e2('0x33')]);return db[_0xa8e2('0x4b')][_0xa8e2('0x4c')](_0x453cda);}})[_0xa8e2('0x18')](function(_0x2d3433){if(_0x2d3433){return db[_0xa8e2('0x4d')][_0xa8e2('0x4e')]({'where':{'id':_[_0xa8e2('0x20')](_0x2d3433,_0xa8e2('0x4f')),'role':_0xa8e2('0x50')},'attributes':['id',_0xa8e2('0x1d'),_0xa8e2('0x51'),_0xa8e2('0x52'),_0xa8e2('0x53')]});}})[_0xa8e2('0x18')](function(_0x4ce073){if(_0x4ce073){return{'count':_0x4ce073[_0xa8e2('0x14')],'rows':_[_0xa8e2('0x20')](_0x4ce073[_0xa8e2('0x29')],function(_0x4a530f){return{'membername':_0x4a530f[_0xa8e2('0x1d')],'UserId':_0x4a530f['id'],'queue_name':_0x279d05[_0xa8e2('0x1d')],'ChatQueueId':_0x279d05['id'],'interface':util[_0xa8e2('0x54')](_0xa8e2('0x55'),_0xa8e2('0x56'),_0x4a530f['name']),'penalty':0x0,'paused':_0x4a530f[_0xa8e2('0x51')],'createdAt':_0x4a530f[_0xa8e2('0x53')],'updatedAt':_0x4a530f[_0xa8e2('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa8e2('0x18')](respondWithFilteredResult(_0x4b9b79,_0x453cda))['catch'](handleError(_0x4b9b79,null));};exports[_0xa8e2('0x57')]=function(_0x20d250,_0x8390d8){var _0x1579d0={};var _0x458e12={};var _0x483da2;var _0x2f6201;return db['ChatQueue'][_0xa8e2('0x43')]({'where':{'id':_0x20d250[_0xa8e2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x8390d8,null))['then'](function(_0x65a782){if(_0x65a782){_0x483da2=_0x65a782;_0x458e12[_0xa8e2('0x2c')]=_[_0xa8e2('0x2d')](db[_0xa8e2('0x58')][_0xa8e2('0x22')]);_0x458e12['query']=_[_0xa8e2('0x2d')](_0x20d250[_0xa8e2('0x28')]);_0x458e12['filters']=_[_0xa8e2('0x2e')](_0x458e12['model'],_0x458e12['query']);_0x1579d0['attributes']=_[_0xa8e2('0x2e')](_0x458e12['model'],qs['fields'](_0x20d250[_0xa8e2('0x28')][_0xa8e2('0x2f')]));_0x1579d0[_0xa8e2('0x30')]=_0x1579d0[_0xa8e2('0x30')][_0xa8e2('0x31')]?_0x1579d0[_0xa8e2('0x30')]:_0x458e12['model'];_0x1579d0[_0xa8e2('0x59')]=qs[_0xa8e2('0x46')](_0x20d250[_0xa8e2('0x28')][_0xa8e2('0x46')]);_0x1579d0[_0xa8e2('0x49')]=qs['filters'](_[_0xa8e2('0x48')](_0x20d250[_0xa8e2('0x28')],_0x458e12[_0xa8e2('0x47')]));if(_0x20d250['query']['filter']){_0x1579d0[_0xa8e2('0x49')]=_[_0xa8e2('0x32')](_0x1579d0[_0xa8e2('0x49')],{'$or':_[_0xa8e2('0x20')](_0x1579d0[_0xa8e2('0x30')],function(_0x38e3ef){var _0x21557f={};_0x21557f[_0x38e3ef]={'$like':'%'+_0x20d250[_0xa8e2('0x28')]['filter']+'%'};return _0x21557f;})});}_0x1579d0=_[_0xa8e2('0x32')]({},_0x1579d0,_0x20d250[_0xa8e2('0x33')]);return _0x483da2['getTeams'](_0x1579d0);}})['then'](function(_0x2860ad){if(_0x2860ad){_0x2f6201=_0x2860ad[_0xa8e2('0x31')];if(!_0x20d250[_0xa8e2('0x28')][_0xa8e2('0x5a')](_0xa8e2('0x44'))){_0x1579d0[_0xa8e2('0x45')]=qs['limit'](_0x20d250['query'][_0xa8e2('0x45')]);_0x1579d0[_0xa8e2('0x12')]=qs['offset'](_0x20d250['query']['offset']);}return _0x483da2['getTeams'](_0x1579d0);}})[_0xa8e2('0x18')](function(_0x4cc798){if(_0x4cc798){return _0x4cc798?{'count':_0x2f6201,'rows':_0x4cc798}:null;}})[_0xa8e2('0x18')](respondWithResult(_0x8390d8,null))['catch'](handleError(_0x8390d8,null));};exports[_0xa8e2('0x5b')]=function(_0x372d24,_0x39ffd0){var _0x16991b=_0x372d24[_0xa8e2('0x36')]['ids'];return db[_0xa8e2('0x58')][_0xa8e2('0x4c')]({'where':{'id':_0x16991b},'attributes':['id'],'include':[{'model':db[_0xa8e2('0x4d')],'as':_0xa8e2('0x5c'),'attributes':['id',_0xa8e2('0x1d'),_0xa8e2('0x5d'),_0xa8e2('0x5e'),_0xa8e2('0x5f')],'raw':!![]}]})[_0xa8e2('0x18')](function(_0x8b4814){if(_0x8b4814){var _0x565df1=_[_0xa8e2('0x60')](_0x8b4814,function(_0x3a34b6){var _0x367aa3=_0x3a34b6[_0xa8e2('0x19')]({'plain':!![]});return _0x367aa3[_0xa8e2('0x5c')];});return db[_0xa8e2('0x21')][_0xa8e2('0x34')]({'where':{'id':_0x372d24['params']['id']}})['then'](function(_0x870bbe){return db[_0xa8e2('0x61')][_0xa8e2('0x62')](function(_0x19ea0f){return _0x870bbe[_0xa8e2('0x5b')](_0x16991b,{'transaction':_0x19ea0f})[_0xa8e2('0x18')](function(){return BPromise[_0xa8e2('0x63')](_0x565df1,function(_0x8dbd0e){return db[_0xa8e2('0x4b')]['findOrCreate']({'where':{'UserId':_0x8dbd0e['id'],'ChatQueueId':_0x372d24[_0xa8e2('0x2b')]['id']},'transaction':_0x19ea0f});});})['then'](function(){_0x565df1[_0xa8e2('0x64')](function(_0x317f60){socket['emit']('userChatQueue:save',{'UserId':_0x317f60['id'],'ChatQueueId':_0x870bbe['id']});});});});});}})[_0xa8e2('0x18')](respondWithStatusCode(_0x39ffd0,null))[_0xa8e2('0x2a')](handleError(_0x39ffd0,null));};exports[_0xa8e2('0x65')]=function(_0x57e734,_0x57e5b3){return db['Team'][_0xa8e2('0x4c')]({'where':{'id':_0x57e734['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa8e2('0x4d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa8e2('0x18')](handleEntityNotFound(_0x57e5b3,null))[_0xa8e2('0x18')](function(_0x54a33b){var _0x3c27df=_[_0xa8e2('0x20')](_0x54a33b,'id');var _0x375a4b=[];var _0x10f97f=[];var _0x2fc8f4=squel[_0xa8e2('0x66')]();_0x2fc8f4[_0xa8e2('0x67')](_0xa8e2('0x68'))[_0xa8e2('0x69')](_0xa8e2('0x6a'),'tq')[_0xa8e2('0x6b')](_0xa8e2('0x6c'),'ut',_0xa8e2('0x6d'))['where'](_0xa8e2('0x6e'),_0x57e734[_0xa8e2('0x2b')]['id']);for(var _0x18c8dd=0x0;_0x18c8dd<_0x54a33b[_0xa8e2('0x31')];_0x18c8dd+=0x1){let _0x16e9bc=_0x54a33b[_0x18c8dd];for(var _0x2814b9=0x0;_0x2814b9<_0x16e9bc[_0xa8e2('0x5c')][_0xa8e2('0x31')];_0x2814b9+=0x1){let _0x2bcc81=_0x16e9bc[_0xa8e2('0x5c')][_0x2814b9];var _0x1a260b=_0x2fc8f4[_0xa8e2('0x6f')]();_0x1a260b['where'](_0xa8e2('0x70'),_0x2bcc81['id']);_0x10f97f[_0xa8e2('0x71')](db[_0xa8e2('0x61')][_0xa8e2('0x28')](_0x1a260b['toString'](),{'type':db[_0xa8e2('0x61')][_0xa8e2('0x72')][_0xa8e2('0x73')]})[_0xa8e2('0x18')](function(_0x40bc03){if(_0x40bc03[_0xa8e2('0x31')]===0x1){return _0x2bcc81['id'];}else{var _0x25c31f=_[_0xa8e2('0x74')](_[_0xa8e2('0x20')](_0x40bc03,_0xa8e2('0x75')),function(_0x1364a1){return _[_0xa8e2('0x76')](_0x3c27df,_0x1364a1);});if(_0x25c31f){return _0x2bcc81['id'];}}}));}}return BPromise[_0xa8e2('0x77')](_0x10f97f)[_0xa8e2('0x18')](function(_0x135ef1){_0x375a4b=_(_0x375a4b)[_0xa8e2('0x78')](_0x135ef1)[_0xa8e2('0x79')]()['value']();return db[_0xa8e2('0x21')][_0xa8e2('0x34')]({'where':{'id':_0x57e734[_0xa8e2('0x2b')]['id']}})['then'](function(_0x559d03){return db[_0xa8e2('0x61')][_0xa8e2('0x62')](function(_0x1b73f5){return _0x559d03[_0xa8e2('0x65')](_0x57e734['query'][_0xa8e2('0x7a')],{'transaction':_0x1b73f5})[_0xa8e2('0x18')](function(){if(!_[_0xa8e2('0x7b')](_0x375a4b)){return _0x559d03['removeAgents'](_0x375a4b,{'transaction':_0x1b73f5});}})[_0xa8e2('0x18')](function(){_0x375a4b[_0xa8e2('0x64')](function(_0x194377){socket[_0xa8e2('0x7c')]('userChatQueue:remove',{'UserId':_0x194377,'ChatQueueId':_0x559d03['id']});});});});});});})[_0xa8e2('0x18')](respondWithStatusCode(_0x57e5b3,null))['catch'](handleError(_0x57e5b3,null));};exports['addAgents']=function(_0x2d883b,_0x1ec6e3){return db[_0xa8e2('0x21')][_0xa8e2('0x34')]({'where':{'id':_0x2d883b[_0xa8e2('0x2b')]['id']}})[_0xa8e2('0x18')](handleEntityNotFound(_0x1ec6e3,null))[_0xa8e2('0x18')](function(_0x440b1c){if(_0x440b1c){return _0x440b1c[_0xa8e2('0x7d')](_0x2d883b[_0xa8e2('0x36')][_0xa8e2('0x7a')],_[_0xa8e2('0x7e')](_0x2d883b[_0xa8e2('0x36')],[_0xa8e2('0x7a'),'id'])||{})[_0xa8e2('0x7f')](function(_0x37b39a){for(var _0x36179f=0x0;_0x36179f<_0x2d883b[_0xa8e2('0x36')][_0xa8e2('0x7a')]['length'];_0x36179f+=0x1){socket['emit'](_0xa8e2('0x80'),{'UserId':Number(_0x2d883b[_0xa8e2('0x36')][_0xa8e2('0x7a')][_0x36179f]),'ChatQueueId':Number(_0x2d883b[_0xa8e2('0x2b')]['id'])});}return _0x37b39a;});}})[_0xa8e2('0x18')](respondWithResult(_0x1ec6e3,null))[_0xa8e2('0x2a')](handleError(_0x1ec6e3,null));};exports['removeAgents']=function(_0x23f42f,_0x7bcb0e){return db[_0xa8e2('0x21')][_0xa8e2('0x34')]({'where':{'id':_0x23f42f[_0xa8e2('0x2b')]['id']}})[_0xa8e2('0x18')](handleEntityNotFound(_0x7bcb0e,null))[_0xa8e2('0x18')](function(_0x413ce4){if(_0x413ce4){return _0x413ce4[_0xa8e2('0x81')](_0x23f42f[_0xa8e2('0x28')][_0xa8e2('0x7a')])['then'](function(){if(_[_0xa8e2('0x82')](_0x23f42f[_0xa8e2('0x28')][_0xa8e2('0x7a')])){for(var _0x4120e3=0x0;_0x4120e3<_0x23f42f['query']['ids'][_0xa8e2('0x31')];_0x4120e3+=0x1){socket['emit'](_0xa8e2('0x83'),{'UserId':Number(_0x23f42f[_0xa8e2('0x28')][_0xa8e2('0x7a')][_0x4120e3]),'ChatQueueId':Number(_0x23f42f[_0xa8e2('0x2b')]['id'])});}}else{socket[_0xa8e2('0x7c')](_0xa8e2('0x83'),{'UserId':Number(_0x23f42f[_0xa8e2('0x28')][_0xa8e2('0x7a')]),'ChatQueueId':Number(_0x23f42f[_0xa8e2('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x7bcb0e,null))['catch'](handleError(_0x7bcb0e,null));};exports[_0xa8e2('0x84')]=function(_0x47aa24,_0x52758b){var _0x1913ac={};var _0x5f0fe6={};var _0x57bdff;var _0x371dff;return db[_0xa8e2('0x21')]['findOne']({'where':{'id':_0x47aa24[_0xa8e2('0x2b')]['id']}})[_0xa8e2('0x18')](handleEntityNotFound(_0x52758b,null))[_0xa8e2('0x18')](function(_0x1bd028){if(_0x1bd028){_0x57bdff=_0x1bd028;_0x5f0fe6[_0xa8e2('0x2c')]=_[_0xa8e2('0x2d')](db[_0xa8e2('0x4d')][_0xa8e2('0x22')]);_0x5f0fe6['query']=_[_0xa8e2('0x2d')](_0x47aa24[_0xa8e2('0x28')]);_0x5f0fe6[_0xa8e2('0x47')]=_[_0xa8e2('0x2e')](_0x5f0fe6[_0xa8e2('0x2c')],_0x5f0fe6[_0xa8e2('0x28')]);_0x1913ac[_0xa8e2('0x30')]=_['intersection'](_0x5f0fe6['model'],qs[_0xa8e2('0x2f')](_0x47aa24[_0xa8e2('0x28')][_0xa8e2('0x2f')]));_0x1913ac[_0xa8e2('0x30')]=_0x1913ac['attributes'][_0xa8e2('0x31')]?_0x1913ac[_0xa8e2('0x30')]:_0x5f0fe6[_0xa8e2('0x2c')];_0x1913ac[_0xa8e2('0x59')]=qs[_0xa8e2('0x46')](_0x47aa24[_0xa8e2('0x28')]['sort']);_0x1913ac[_0xa8e2('0x49')]=qs[_0xa8e2('0x47')](_[_0xa8e2('0x48')](_0x47aa24[_0xa8e2('0x28')],_0x5f0fe6['filters']));if(_0x47aa24[_0xa8e2('0x28')][_0xa8e2('0x4a')]){_0x1913ac[_0xa8e2('0x49')]=_[_0xa8e2('0x32')](_0x1913ac[_0xa8e2('0x49')],{'$or':_['map'](_0x1913ac[_0xa8e2('0x30')],function(_0x1093c3){var _0x4bf724={};_0x4bf724[_0x1093c3]={'$like':'%'+_0x47aa24[_0xa8e2('0x28')][_0xa8e2('0x4a')]+'%'};return _0x4bf724;})});}_0x1913ac=_[_0xa8e2('0x32')]({},_0x1913ac,_0x47aa24[_0xa8e2('0x33')]);return _0x57bdff['getAgents'](_0x1913ac);}})[_0xa8e2('0x18')](function(_0x1ce8f2){if(_0x1ce8f2){_0x371dff=_0x1ce8f2[_0xa8e2('0x31')];if(!_0x47aa24[_0xa8e2('0x28')][_0xa8e2('0x5a')](_0xa8e2('0x44'))){_0x1913ac[_0xa8e2('0x45')]=qs[_0xa8e2('0x45')](_0x47aa24[_0xa8e2('0x28')][_0xa8e2('0x45')]);_0x1913ac[_0xa8e2('0x12')]=qs['offset'](_0x47aa24['query'][_0xa8e2('0x12')]);}return _0x57bdff[_0xa8e2('0x84')](_0x1913ac);}})[_0xa8e2('0x18')](function(_0x2bc091){if(_0x2bc091){return _0x2bc091?{'count':_0x371dff,'rows':_0x2bc091}:null;}})[_0xa8e2('0x18')](respondWithResult(_0x52758b,null))['catch'](handleError(_0x52758b,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c093031..925800d 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 _0x0bca=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','update'];(function(_0x57bc96,_0x445aeb){var _0x56351f=function(_0x13515c){while(--_0x13515c){_0x57bc96['push'](_0x57bc96['shift']());}};_0x56351f(++_0x445aeb);}(_0x0bca,0xa7));var _0xa0bc=function(_0x207a0a,_0x10eceb){_0x207a0a=_0x207a0a-0x0;var _0x50445c=_0x0bca[_0x207a0a];return _0x50445c;};'use strict';var EventEmitter=require(_0xa0bc('0x0'));var ChatQueue=require(_0xa0bc('0x1'))['db'][_0xa0bc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0bc('0x3'),'afterDestroy':_0xa0bc('0x4')};function emitEvent(_0x529431){return function(_0x4c76a5,_0x549f88,_0xff60c0){ChatQueueEvents[_0xa0bc('0x5')](_0x529431+':'+_0x4c76a5['id'],_0x4c76a5);ChatQueueEvents[_0xa0bc('0x5')](_0x529431,_0x4c76a5);_0xff60c0(null);};}for(var e in events){if(events[_0xa0bc('0x6')](e)){var event=events[e];ChatQueue[_0xa0bc('0x7')](e,emitEvent(event));}}module[_0xa0bc('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x520e=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x520e,0x90));var _0xe520=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x520e[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0xe520('0x0'));var ChatQueue=require(_0xe520('0x1'))['db'][_0xe520('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe520('0x3')](0x0);var events={'afterCreate':_0xe520('0x4'),'afterUpdate':_0xe520('0x5'),'afterDestroy':_0xe520('0x6')};function emitEvent(_0x53ed75){return function(_0x2724f4,_0x120b9f,_0x56ab37){ChatQueueEvents[_0xe520('0x7')](_0x53ed75+':'+_0x2724f4['id'],_0x2724f4);ChatQueueEvents[_0xe520('0x7')](_0x53ed75,_0x2724f4);_0x56ab37(null);};}for(var e in events){if(events[_0xe520('0x8')](e)){var event=events[e];ChatQueue[_0xe520('0x9')](e,emitEvent(event));}}module[_0xe520('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 6086cda..e4d9433 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 _0x540d=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3c2004,_0x113d1c){var _0xe7b655=function(_0x476065){while(--_0x476065){_0x3c2004['push'](_0x3c2004['shift']());}};_0xe7b655(++_0x113d1c);}(_0x540d,0x19f));var _0xd540=function(_0x5e8bcc,_0x4bc996){_0x5e8bcc=_0x5e8bcc-0x0;var _0x2c23da=_0x540d[_0x5e8bcc];return _0x2c23da;};'use strict';var _=require(_0xd540('0x0'));var util=require('util');var logger=require(_0xd540('0x1'))(_0xd540('0x2'));var moment=require(_0xd540('0x3'));var BPromise=require(_0xd540('0x4'));var rp=require(_0xd540('0x5'));var fs=require('fs');var path=require(_0xd540('0x6'));var rimraf=require(_0xd540('0x7'));var config=require(_0xd540('0x8'));var attributes=require(_0xd540('0x9'));module[_0xd540('0xa')]=function(_0x33ac9b,_0x266354){return _0x33ac9b[_0xd540('0xb')](_0xd540('0xc'),attributes,{'tableName':_0xd540('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf98d=['moment','bluebird','request-promise','path','rimraf','exports','define','chat_queues','lodash','../../config/logger','api'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0xf98d,0x81));var _0xdf98=function(_0x364588,_0xef20c6){_0x364588=_0x364588-0x0;var _0x1a7a7d=_0xf98d[_0x364588];return _0x1a7a7d;};'use strict';var _=require(_0xdf98('0x0'));var util=require('util');var logger=require(_0xdf98('0x1'))(_0xdf98('0x2'));var moment=require(_0xdf98('0x3'));var BPromise=require(_0xdf98('0x4'));var rp=require(_0xdf98('0x5'));var fs=require('fs');var path=require(_0xdf98('0x6'));var rimraf=require(_0xdf98('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0xdf98('0x8')]=function(_0x7dce23,_0xb09f4e){return _0x7dce23[_0xdf98('0x9')]('ChatQueue',attributes,{'tableName':_0xdf98('0xa'),'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 72d239b..b241d71 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 _0xe99c=['ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','options','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x4162e6,_0x3f2dfd){var _0x50b0fc=function(_0x3d1ba0){while(--_0x3d1ba0){_0x4162e6['push'](_0x4162e6['shift']());}};_0x50b0fc(++_0x3f2dfd);}(_0xe99c,0x197));var _0xce99=function(_0x29b00a,_0x3a8303){_0x29b00a=_0x29b00a-0x0;var _0x1451c5=_0xe99c[_0x29b00a];return _0x1451c5;};'use strict';var _=require(_0xce99('0x0'));var util=require('util');var moment=require(_0xce99('0x1'));var BPromise=require(_0xce99('0x2'));var rs=require(_0xce99('0x3'));var fs=require('fs');var Redis=require(_0xce99('0x4'));var db=require(_0xce99('0x5'))['db'];var utils=require(_0xce99('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xce99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce99('0x8')]['http']({'port':0x232a});config[_0xce99('0x9')]=_[_0xce99('0xa')](config[_0xce99('0x9')],{'host':_0xce99('0xb'),'port':0x18eb});var socket=require(_0xce99('0xc'))(new Redis(config[_0xce99('0x9')]));require(_0xce99('0xd'))[_0xce99('0xe')](socket);function respondWithRpcPromise(_0x5727f2,_0x3ceb6f,_0xed09d1){return new BPromise(function(_0x4c7423,_0x26ac93){return client[_0xce99('0xf')](_0x5727f2,_0xed09d1)[_0xce99('0x10')](function(_0x57a7f0){logger[_0xce99('0x11')]('ChatQueue,\x20%s,\x20%s',_0x3ceb6f,_0xce99('0x12'));logger[_0xce99('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3ceb6f,'request\x20sent',JSON[_0xce99('0x14')](_0x57a7f0));if(_0x57a7f0[_0xce99('0x15')]){if(_0x57a7f0[_0xce99('0x15')]['code']===0x1f4){logger['error'](_0xce99('0x16'),_0x3ceb6f,_0x57a7f0['error'][_0xce99('0x17')]);return _0x26ac93(_0x57a7f0['error'][_0xce99('0x17')]);}logger[_0xce99('0x15')](_0xce99('0x16'),_0x3ceb6f,_0x57a7f0['error']['message']);return _0x4c7423(_0x57a7f0[_0xce99('0x15')][_0xce99('0x17')]);}else{logger[_0xce99('0x11')]('ChatQueue,\x20%s,\x20%s',_0x3ceb6f,_0xce99('0x12'));_0x4c7423(_0x57a7f0[_0xce99('0x18')][_0xce99('0x17')]);}})[_0xce99('0x19')](function(_0x3f2427){logger[_0xce99('0x15')](_0xce99('0x16'),_0x3ceb6f,_0x3f2427);_0x26ac93(_0x3f2427);});});}exports['GetChatQueue']=function(_0x1de34e){var _0x5444b9=this;return new Promise(function(_0x1d55f0,_0x1c79a9){return db[_0xce99('0x1a')][_0xce99('0x1b')]({'raw':_0x1de34e[_0xce99('0x1c')]?_0x1de34e[_0xce99('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1de34e[_0xce99('0x1c')]?_0x1de34e[_0xce99('0x1c')]['where']||null:null,'attributes':_0x1de34e[_0xce99('0x1c')]?_0x1de34e[_0xce99('0x1c')][_0xce99('0x1d')]||null:null,'limit':_0x1de34e[_0xce99('0x1c')]?_0x1de34e[_0xce99('0x1c')][_0xce99('0x1e')]||null:null,'include':_0x1de34e[_0xce99('0x1c')]?_0x1de34e[_0xce99('0x1c')][_0xce99('0x1f')]?_[_0xce99('0x20')](_0x1de34e[_0xce99('0x1c')][_0xce99('0x1f')],function(_0x223863){return{'model':db[_0x223863[_0xce99('0x21')]],'as':_0x223863['as'],'attributes':_0x223863[_0xce99('0x1d')],'include':_0x223863[_0xce99('0x1f')]?_[_0xce99('0x20')](_0x223863[_0xce99('0x1f')],function(_0x17a30f){return{'model':db[_0x17a30f[_0xce99('0x21')]],'as':_0x17a30f['as'],'attributes':_0x17a30f['attributes'],'include':_0x17a30f['include']?_[_0xce99('0x20')](_0x17a30f[_0xce99('0x1f')],function(_0x4139e4){return{'model':db[_0x4139e4['model']],'as':_0x4139e4['as'],'attributes':_0x4139e4[_0xce99('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xce99('0x10')](function(_0x1ce793){logger['info']('GetChatQueue',_0x1de34e);logger[_0xce99('0x13')]('GetChatQueue',_0x1de34e,JSON[_0xce99('0x14')](_0x1ce793));_0x1d55f0(_0x1ce793);})['catch'](function(_0x2e2d7b){logger[_0xce99('0x15')](_0xce99('0x22'),_0x2e2d7b['message'],_0x1de34e);_0x1c79a9(_0x5444b9[_0xce99('0x15')](0x1f4,_0x2e2d7b[_0xce99('0x17')]));});});};exports[_0xce99('0x23')]=function(_0x4ac587){var _0x521a82=this;return new Promise(function(_0x118070,_0x5203af){return db[_0xce99('0x1a')][_0xce99('0x24')]({'raw':_0x4ac587[_0xce99('0x1c')]?_0x4ac587[_0xce99('0x1c')][_0xce99('0x25')]===undefined?!![]:![]:!![],'where':_0x4ac587[_0xce99('0x1c')]?_0x4ac587[_0xce99('0x1c')][_0xce99('0x26')]||null:null,'attributes':_0x4ac587['options']?_0x4ac587[_0xce99('0x1c')][_0xce99('0x1d')]||null:null,'include':_0x4ac587[_0xce99('0x1c')]?_0x4ac587[_0xce99('0x1c')]['include']?_[_0xce99('0x20')](_0x4ac587['options'][_0xce99('0x1f')],function(_0x22e889){return{'model':db[_0x22e889[_0xce99('0x21')]],'as':_0x22e889['as'],'attributes':_0x22e889['attributes'],'include':_0x22e889[_0xce99('0x1f')]?_[_0xce99('0x20')](_0x22e889[_0xce99('0x1f')],function(_0x338250){return{'model':db[_0x338250[_0xce99('0x21')]],'as':_0x338250['as'],'attributes':_0x338250[_0xce99('0x1d')],'include':_0x338250[_0xce99('0x1f')]?_[_0xce99('0x20')](_0x338250['include'],function(_0x3fc690){return{'model':db[_0x3fc690[_0xce99('0x21')]],'as':_0x3fc690['as'],'attributes':_0x3fc690['attributes']};}):[]};}):[]};}):[]:[]})[_0xce99('0x10')](function(_0x3642c0){logger[_0xce99('0x11')]('ShowChatQueue',_0x4ac587);logger[_0xce99('0x13')]('ShowChatQueue',_0x4ac587,JSON[_0xce99('0x14')](_0x3642c0));_0x118070(_0x3642c0);})[_0xce99('0x19')](function(_0x4061ee){logger[_0xce99('0x15')](_0xce99('0x23'),_0x4061ee[_0xce99('0x17')],_0x4ac587);_0x5203af(_0x521a82['error'](0x1f4,_0x4061ee[_0xce99('0x17')]));});});}; \ No newline at end of file +var _0x42f4=['limit','include','model','map','ShowChatQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes'];(function(_0x2ab559,_0x3f4e89){var _0x22ceb9=function(_0x7d8f21){while(--_0x7d8f21){_0x2ab559['push'](_0x2ab559['shift']());}};_0x22ceb9(++_0x3f4e89);}(_0x42f4,0x19d));var _0x442f=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x42f4[_0x581960];return _0x4ee892;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var moment=require(_0x442f('0x1'));var BPromise=require(_0x442f('0x2'));var rs=require(_0x442f('0x3'));var fs=require('fs');var Redis=require(_0x442f('0x4'));var db=require(_0x442f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x442f('0x6'));var jayson=require(_0x442f('0x7'));var client=jayson['client'][_0x442f('0x8')]({'port':0x232a});config[_0x442f('0x9')]=_[_0x442f('0xa')](config[_0x442f('0x9')],{'host':_0x442f('0xb'),'port':0x18eb});var socket=require(_0x442f('0xc'))(new Redis(config['redis']));require(_0x442f('0xd'))['register'](socket);function respondWithRpcPromise(_0x541889,_0x57c026,_0x46e693){return new BPromise(function(_0x3dd176,_0x3d3baf){return client[_0x442f('0xe')](_0x541889,_0x46e693)[_0x442f('0xf')](function(_0x203d7b){logger[_0x442f('0x10')](_0x442f('0x11'),_0x57c026,_0x442f('0x12'));logger[_0x442f('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x57c026,_0x442f('0x12'),JSON[_0x442f('0x14')](_0x203d7b));if(_0x203d7b[_0x442f('0x15')]){if(_0x203d7b[_0x442f('0x15')][_0x442f('0x16')]===0x1f4){logger[_0x442f('0x15')](_0x442f('0x11'),_0x57c026,_0x203d7b[_0x442f('0x15')][_0x442f('0x17')]);return _0x3d3baf(_0x203d7b[_0x442f('0x15')][_0x442f('0x17')]);}logger[_0x442f('0x15')](_0x442f('0x11'),_0x57c026,_0x203d7b[_0x442f('0x15')][_0x442f('0x17')]);return _0x3dd176(_0x203d7b[_0x442f('0x15')]['message']);}else{logger[_0x442f('0x10')]('ChatQueue,\x20%s,\x20%s',_0x57c026,'request\x20sent');_0x3dd176(_0x203d7b['result']['message']);}})[_0x442f('0x18')](function(_0x3c9661){logger[_0x442f('0x15')](_0x442f('0x11'),_0x57c026,_0x3c9661);_0x3d3baf(_0x3c9661);});});}exports[_0x442f('0x19')]=function(_0x13b37a){var _0x520d2f=this;return new Promise(function(_0x2ded18,_0x552f81){return db[_0x442f('0x1a')][_0x442f('0x1b')]({'raw':_0x13b37a[_0x442f('0x1c')]?_0x13b37a['options'][_0x442f('0x1d')]===undefined?!![]:![]:!![],'where':_0x13b37a[_0x442f('0x1c')]?_0x13b37a['options']['where']||null:null,'attributes':_0x13b37a[_0x442f('0x1c')]?_0x13b37a[_0x442f('0x1c')][_0x442f('0x1e')]||null:null,'limit':_0x13b37a[_0x442f('0x1c')]?_0x13b37a[_0x442f('0x1c')][_0x442f('0x1f')]||null:null,'include':_0x13b37a[_0x442f('0x1c')]?_0x13b37a[_0x442f('0x1c')][_0x442f('0x20')]?_['map'](_0x13b37a[_0x442f('0x1c')][_0x442f('0x20')],function(_0x31b66a){return{'model':db[_0x31b66a[_0x442f('0x21')]],'as':_0x31b66a['as'],'attributes':_0x31b66a['attributes'],'include':_0x31b66a[_0x442f('0x20')]?_[_0x442f('0x22')](_0x31b66a[_0x442f('0x20')],function(_0x3bcae2){return{'model':db[_0x3bcae2['model']],'as':_0x3bcae2['as'],'attributes':_0x3bcae2[_0x442f('0x1e')],'include':_0x3bcae2[_0x442f('0x20')]?_[_0x442f('0x22')](_0x3bcae2['include'],function(_0x37da9d){return{'model':db[_0x37da9d['model']],'as':_0x37da9d['as'],'attributes':_0x37da9d[_0x442f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x442f('0xf')](function(_0x75f990){logger['info'](_0x442f('0x19'),_0x13b37a);logger[_0x442f('0x13')](_0x442f('0x19'),_0x13b37a,JSON[_0x442f('0x14')](_0x75f990));_0x2ded18(_0x75f990);})[_0x442f('0x18')](function(_0x59d0d8){logger['error'](_0x442f('0x19'),_0x59d0d8['message'],_0x13b37a);_0x552f81(_0x520d2f[_0x442f('0x15')](0x1f4,_0x59d0d8[_0x442f('0x17')]));});});};exports[_0x442f('0x23')]=function(_0x1b9a60){var _0x39684d=this;return new Promise(function(_0x1232fe,_0x44ac9b){return db[_0x442f('0x1a')][_0x442f('0x24')]({'raw':_0x1b9a60['options']?_0x1b9a60[_0x442f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9a60[_0x442f('0x1c')]?_0x1b9a60[_0x442f('0x1c')]['where']||null:null,'attributes':_0x1b9a60[_0x442f('0x1c')]?_0x1b9a60[_0x442f('0x1c')][_0x442f('0x1e')]||null:null,'include':_0x1b9a60[_0x442f('0x1c')]?_0x1b9a60[_0x442f('0x1c')]['include']?_[_0x442f('0x22')](_0x1b9a60[_0x442f('0x1c')][_0x442f('0x20')],function(_0x12d02b){return{'model':db[_0x12d02b[_0x442f('0x21')]],'as':_0x12d02b['as'],'attributes':_0x12d02b['attributes'],'include':_0x12d02b[_0x442f('0x20')]?_[_0x442f('0x22')](_0x12d02b['include'],function(_0x5f2575){return{'model':db[_0x5f2575[_0x442f('0x21')]],'as':_0x5f2575['as'],'attributes':_0x5f2575['attributes'],'include':_0x5f2575[_0x442f('0x20')]?_[_0x442f('0x22')](_0x5f2575[_0x442f('0x20')],function(_0x1e6266){return{'model':db[_0x1e6266[_0x442f('0x21')]],'as':_0x1e6266['as'],'attributes':_0x1e6266[_0x442f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x442f('0xf')](function(_0x5eceab){logger[_0x442f('0x10')](_0x442f('0x23'),_0x1b9a60);logger['debug'](_0x442f('0x23'),_0x1b9a60,JSON['stringify'](_0x5eceab));_0x1232fe(_0x5eceab);})[_0x442f('0x18')](function(_0x341d94){logger[_0x442f('0x15')]('ShowChatQueue',_0x341d94['message'],_0x1b9a60);_0x44ac9b(_0x39684d['error'](0x1f4,_0x341d94[_0x442f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 981855c..a640793 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 _0x9b67=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x56a761,_0x9fce38){var _0x248e40=function(_0x3d438d){while(--_0x3d438d){_0x56a761['push'](_0x56a761['shift']());}};_0x248e40(++_0x9fce38);}(_0x9b67,0xf6));var _0x79b6=function(_0x28d018,_0x5c5125){_0x28d018=_0x28d018-0x0;var _0x2626ba=_0x9b67[_0x28d018];return _0x2626ba;};'use strict';var ChatQueueEvents=require(_0x79b6('0x0'));var events=[_0x79b6('0x1'),_0x79b6('0x2'),_0x79b6('0x3')];function createListener(_0x29728d,_0x5523a1){return function(_0x3ba25a){_0x5523a1[_0x79b6('0x4')](_0x29728d,_0x3ba25a);};}function removeListener(_0x5297d0,_0x4e8794){return function(){ChatQueueEvents[_0x79b6('0x5')](_0x5297d0,_0x4e8794);};}exports[_0x79b6('0x6')]=function(_0x258103){for(var _0xec367e=0x0,_0xfa6a05=events[_0x79b6('0x7')];_0xec367e<_0xfa6a05;_0xec367e++){var _0x34adbe=events[_0xec367e];var _0x58ae2d=createListener(_0x79b6('0x8')+_0x34adbe,_0x258103);ChatQueueEvents['on'](_0x34adbe,_0x58ae2d);}}; \ No newline at end of file +var _0xd6d6=['chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x373276,_0x42c878){var _0xdefed0=function(_0x30d136){while(--_0x30d136){_0x373276['push'](_0x373276['shift']());}};_0xdefed0(++_0x42c878);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3cadd4,_0x2a1011){_0x3cadd4=_0x3cadd4-0x0;var _0x1a0d55=_0xd6d6[_0x3cadd4];return _0x1a0d55;};'use strict';var ChatQueueEvents=require(_0x6d6d('0x0'));var events=[_0x6d6d('0x1'),_0x6d6d('0x2'),_0x6d6d('0x3')];function createListener(_0x536523,_0x2e1aed){return function(_0x3b743d){_0x2e1aed[_0x6d6d('0x4')](_0x536523,_0x3b743d);};}function removeListener(_0x2a838a,_0x5207c9){return function(){ChatQueueEvents[_0x6d6d('0x5')](_0x2a838a,_0x5207c9);};}exports[_0x6d6d('0x6')]=function(_0x5702dc){for(var _0x210ff7=0x0,_0x1bf731=events[_0x6d6d('0x7')];_0x210ff7<_0x1bf731;_0x210ff7++){var _0x18f824=events[_0x210ff7];var _0xd49f57=createListener(_0x6d6d('0x8')+_0x18f824,_0x5702dc);ChatQueueEvents['on'](_0x18f824,_0xd49f57);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 45da786..0b234eb 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x267ae4,_0x58c7cf){var _0x519990=function(_0x42b0f3){while(--_0x42b0f3){_0x267ae4['push'](_0x267ae4['shift']());}};_0x519990(++_0x58c7cf);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _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(_0x4b09e4,_0xfa6265){var _0x5408f4=function(_0x68b42d){while(--_0x68b42d){_0x4b09e4['push'](_0x4b09e4['shift']());}};_0x5408f4(++_0xfa6265);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 7b0555e..143dd99 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 _0xb501=['STRING','DATE','moment','exports'];(function(_0x7bb463,_0x1b100f){var _0xf95e1b=function(_0x26661f){while(--_0x26661f){_0x7bb463['push'](_0x7bb463['shift']());}};_0xf95e1b(++_0x1b100f);}(_0xb501,0x1ce));var _0x1b50=function(_0x3bab7f,_0x291900){_0x3bab7f=_0x3bab7f-0x0;var _0xc0648=_0xb501[_0x3bab7f];return _0xc0648;};'use strict';var moment=require(_0x1b50('0x0'));var Sequelize=require('sequelize');module[_0x1b50('0x1')]={'uniqueid':{'type':Sequelize[_0x1b50('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1b50('0x3')]},'leaveAt':{'type':Sequelize[_0x1b50('0x3')]},'acceptAt':{'type':Sequelize[_0x1b50('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf2c9=['moment','exports','STRING','DATE'];(function(_0x2364f6,_0x37184e){var _0x3c9a0e=function(_0xf68dce){while(--_0xf68dce){_0x2364f6['push'](_0x2364f6['shift']());}};_0x3c9a0e(++_0x37184e);}(_0xf2c9,0xf4));var _0x9f2c=function(_0x1e8e02,_0x4e9df0){_0x1e8e02=_0x1e8e02-0x0;var _0x3aa4c5=_0xf2c9[_0x1e8e02];return _0x3aa4c5;};'use strict';var moment=require(_0x9f2c('0x0'));var Sequelize=require('sequelize');module[_0x9f2c('0x1')]={'uniqueid':{'type':Sequelize[_0x9f2c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9f2c('0x2')]},'joinAt':{'type':Sequelize[_0x9f2c('0x3')]},'leaveAt':{'type':Sequelize[_0x9f2c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 3e6436f..eca76eb 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 _0xc7a3=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x5a8ef6,_0x36dd17){var _0x39966e=function(_0x5f0a4a){while(--_0x5f0a4a){_0x5a8ef6['push'](_0x5a8ef6['shift']());}};_0x39966e(++_0x36dd17);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x2aa9c1,_0x3321e7){_0x2aa9c1=_0x2aa9c1-0x0;var _0x5d4f10=_0xc7a3[_0x2aa9c1];return _0x5d4f10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c7a('0x0'));var zipdir=require(_0x3c7a('0x1'));var jsonpatch=require(_0x3c7a('0x2'));var rp=require(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var BPromise=require(_0x3c7a('0x5'));var Mustache=require('mustache');var util=require(_0x3c7a('0x6'));var path=require(_0x3c7a('0x7'));var sox=require('sox');var csv=require(_0x3c7a('0x8'));var ejs=require(_0x3c7a('0x9'));var fs=require('fs');var fs_extra=require(_0x3c7a('0xa'));var _=require('lodash');var squel=require(_0x3c7a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c7a('0x8'));var querystring=require(_0x3c7a('0xd'));var Papa=require(_0x3c7a('0xe'));var Redis=require('ioredis');var authService=require(_0x3c7a('0xf'));var qs=require(_0x3c7a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7a('0x11'));var logger=require('../../config/logger')(_0x3c7a('0x12'));var utils=require('../../config/utils');var config=require(_0x3c7a('0x13'));var licenseUtil=require(_0x3c7a('0x14'));var db=require(_0x3c7a('0x15'))['db'];function respondWithStatusCode(_0x16ea63,_0x3d47c3){_0x3d47c3=_0x3d47c3||0xcc;return function(_0x53e5d7){if(_0x53e5d7){return _0x16ea63[_0x3c7a('0x16')](_0x3d47c3);}return _0x16ea63[_0x3c7a('0x17')](_0x3d47c3)[_0x3c7a('0x18')]();};}function respondWithResult(_0x36185c,_0x24d188){_0x24d188=_0x24d188||0xc8;return function(_0x4e6ca5){if(_0x4e6ca5){return _0x36185c[_0x3c7a('0x17')](_0x24d188)[_0x3c7a('0x19')](_0x4e6ca5);}};}function respondWithFilteredResult(_0x5af0a6,_0x539270){return function(_0x3044e6){if(_0x3044e6){var _0xb9201c=typeof _0x539270[_0x3c7a('0x1a')]==='undefined'&&typeof _0x539270[_0x3c7a('0x1b')]==='undefined';var _0x74fd1e=_0x3044e6[_0x3c7a('0x1c')];var _0x36e8c2=_0xb9201c?0x0:_0x539270[_0x3c7a('0x1a')];var _0x3cb5bf=_0xb9201c?_0x3044e6[_0x3c7a('0x1c')]:_0x539270['offset']+_0x539270[_0x3c7a('0x1b')];var _0x2db9df;if(_0x3cb5bf>=_0x74fd1e){_0x3cb5bf=_0x74fd1e;_0x2db9df=0xc8;}else{_0x2db9df=0xce;}_0x5af0a6[_0x3c7a('0x17')](_0x2db9df);return _0x5af0a6[_0x3c7a('0x1d')](_0x3c7a('0x1e'),_0x36e8c2+'-'+_0x3cb5bf+'/'+_0x74fd1e)[_0x3c7a('0x19')](_0x3044e6);}return null;};}function patchUpdates(_0x11a06b){return function(_0x34f4a6){try{jsonpatch[_0x3c7a('0x1f')](_0x34f4a6,_0x11a06b,!![]);}catch(_0x544742){return BPromise[_0x3c7a('0x20')](_0x544742);}return _0x34f4a6['save']();};}function saveUpdates(_0x3c75ff,_0x557518){return function(_0x40d24e){if(_0x40d24e){return _0x40d24e[_0x3c7a('0x21')](_0x3c75ff)[_0x3c7a('0x22')](function(_0x7dbe38){return _0x7dbe38;});}return null;};}function removeEntity(_0x283568,_0x245dde){return function(_0x8251d4){if(_0x8251d4){return _0x8251d4[_0x3c7a('0x23')]()[_0x3c7a('0x22')](function(){_0x283568[_0x3c7a('0x17')](0xcc)[_0x3c7a('0x18')]();});}};}function handleEntityNotFound(_0x317fbd,_0x56539f){return function(_0x3984a1){if(!_0x3984a1){_0x317fbd[_0x3c7a('0x16')](0x194);}return _0x3984a1;};}function handleError(_0x37cc40,_0x3829de){_0x3829de=_0x3829de||0x1f4;return function(_0x9b910c){logger[_0x3c7a('0x24')](_0x9b910c[_0x3c7a('0x25')]);if(_0x9b910c[_0x3c7a('0x26')]){delete _0x9b910c['name'];}_0x37cc40[_0x3c7a('0x17')](_0x3829de)[_0x3c7a('0x27')](_0x9b910c);};}exports[_0x3c7a('0x28')]=function(_0x197012,_0x33065b){var _0x1a96a0={},_0xccf304={},_0x1ff595={'count':0x0,'rows':[]};var _0x508d2e=_[_0x3c7a('0x29')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')],function(_0x18a346){return{'name':_0x18a346[_0x3c7a('0x2c')],'type':_0x18a346[_0x3c7a('0x2d')][_0x3c7a('0x2e')]};});_0xccf304[_0x3c7a('0x2f')]=_[_0x3c7a('0x29')](_0x508d2e,_0x3c7a('0x26'));_0xccf304[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x197012[_0x3c7a('0x30')]);_0xccf304['filters']=_['intersection'](_0xccf304['model'],_0xccf304['query']);_0x1a96a0[_0x3c7a('0x32')]=_[_0x3c7a('0x33')](_0xccf304[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x1a96a0[_0x3c7a('0x32')]=_0x1a96a0[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x1a96a0[_0x3c7a('0x32')]:_0xccf304[_0x3c7a('0x2f')];if(!_0x197012[_0x3c7a('0x30')][_0x3c7a('0x36')](_0x3c7a('0x37'))){_0x1a96a0['limit']=qs[_0x3c7a('0x1b')](_0x197012[_0x3c7a('0x30')]['limit']);_0x1a96a0[_0x3c7a('0x1a')]=qs['offset'](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x1a')]);}_0x1a96a0['order']=qs[_0x3c7a('0x38')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x38')]);_0x1a96a0[_0x3c7a('0x39')]=qs[_0x3c7a('0x3a')](_[_0x3c7a('0x3b')](_0x197012[_0x3c7a('0x30')],_0xccf304[_0x3c7a('0x3a')]),_0x508d2e);if(_0x197012[_0x3c7a('0x30')][_0x3c7a('0x3c')]){_0x1a96a0['where']=_[_0x3c7a('0x3d')](_0x1a96a0[_0x3c7a('0x39')],{'$or':_[_0x3c7a('0x29')](_0x508d2e,function(_0x43c236){if(_0x43c236[_0x3c7a('0x2d')]!==_0x3c7a('0x3e')){var _0x101e5d={};_0x101e5d[_0x43c236[_0x3c7a('0x26')]]={'$like':'%'+_0x197012['query'][_0x3c7a('0x3c')]+'%'};return _0x101e5d;}})});}_0x1a96a0=_[_0x3c7a('0x3d')]({},_0x1a96a0,_0x197012['options']);var _0x442087={'where':_0x1a96a0['where']};return db['ChatQueueReport']['count'](_0x442087)['then'](function(_0x44e935){_0x1ff595[_0x3c7a('0x1c')]=_0x44e935;if(_0x197012[_0x3c7a('0x30')]['includeAll']){_0x1a96a0[_0x3c7a('0x3f')]=[{'all':!![]}];}return db[_0x3c7a('0x2a')]['findAll'](_0x1a96a0);})['then'](function(_0x491335){_0x1ff595[_0x3c7a('0x40')]=_0x491335;return _0x1ff595;})[_0x3c7a('0x22')](respondWithFilteredResult(_0x33065b,_0x1a96a0))[_0x3c7a('0x41')](handleError(_0x33065b,null));};exports[_0x3c7a('0x42')]=function(_0x8d805a,_0x3e6a70){var _0x3f6060={'raw':!![],'where':{'id':_0x8d805a[_0x3c7a('0x43')]['id']}},_0x302556={};_0x302556[_0x3c7a('0x2f')]=_[_0x3c7a('0x31')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')]);_0x302556[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x8d805a['query']);_0x302556[_0x3c7a('0x3a')]=_[_0x3c7a('0x33')](_0x302556['model'],_0x302556['query']);_0x3f6060['attributes']=_[_0x3c7a('0x33')](_0x302556[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x8d805a[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x3f6060[_0x3c7a('0x32')]=_0x3f6060[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x3f6060[_0x3c7a('0x32')]:_0x302556[_0x3c7a('0x2f')];if(_0x8d805a[_0x3c7a('0x30')]['includeAll']){_0x3f6060['include']=[{'all':!![]}];}_0x3f6060=_['merge']({},_0x3f6060,_0x8d805a[_0x3c7a('0x44')]);return db[_0x3c7a('0x2a')][_0x3c7a('0x45')](_0x3f6060)[_0x3c7a('0x22')](handleEntityNotFound(_0x3e6a70,null))[_0x3c7a('0x22')](respondWithResult(_0x3e6a70,null))['catch'](handleError(_0x3e6a70,null));};exports[_0x3c7a('0x46')]=function(_0x12b69a,_0x2eb9e2){return db[_0x3c7a('0x2a')][_0x3c7a('0x46')](_0x12b69a[_0x3c7a('0x47')],{})[_0x3c7a('0x22')](respondWithResult(_0x2eb9e2,0xc9))['catch'](handleError(_0x2eb9e2,null));};exports['update']=function(_0x420fa7,_0x350ea7){if(_0x420fa7[_0x3c7a('0x47')]['id']){delete _0x420fa7[_0x3c7a('0x47')]['id'];}return db[_0x3c7a('0x2a')][_0x3c7a('0x45')]({'where':{'id':_0x420fa7['params']['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x350ea7,null))['then'](saveUpdates(_0x420fa7['body'],null))[_0x3c7a('0x22')](respondWithResult(_0x350ea7,null))[_0x3c7a('0x41')](handleError(_0x350ea7,null));};exports[_0x3c7a('0x23')]=function(_0x50b5e4,_0x5759a0){return db['ChatQueueReport']['find']({'where':{'id':_0x50b5e4[_0x3c7a('0x43')]['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x5759a0,null))[_0x3c7a('0x22')](removeEntity(_0x5759a0,null))[_0x3c7a('0x41')](handleError(_0x5759a0,null));};exports[_0x3c7a('0x48')]=function(_0x11f7ee,_0x124411){return db[_0x3c7a('0x2a')][_0x3c7a('0x48')]()[_0x3c7a('0x22')](respondWithResult(_0x124411,null))[_0x3c7a('0x41')](handleError(_0x124411,null));}; \ No newline at end of file +var _0x29b1=['where','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','order','sort','pick','filter'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x29b1,0x13b));var _0x129b=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x29b1[_0x1e3c16];return _0x47a0c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x129b('0x0'));var jsonpatch=require(_0x129b('0x1'));var rp=require(_0x129b('0x2'));var moment=require(_0x129b('0x3'));var BPromise=require(_0x129b('0x4'));var Mustache=require(_0x129b('0x5'));var util=require(_0x129b('0x6'));var path=require(_0x129b('0x7'));var sox=require(_0x129b('0x8'));var csv=require(_0x129b('0x9'));var ejs=require(_0x129b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x129b('0xb'));var squel=require('squel');var crypto=require(_0x129b('0xc'));var jsforce=require(_0x129b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x129b('0xe'));var Papa=require('papaparse');var Redis=require(_0x129b('0xf'));var authService=require(_0x129b('0x10'));var qs=require(_0x129b('0x11'));var as=require(_0x129b('0x12'));var hardwareService=require(_0x129b('0x13'));var logger=require(_0x129b('0x14'))('api');var utils=require(_0x129b('0x15'));var config=require(_0x129b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x129b('0x17'))['db'];function respondWithStatusCode(_0x1e5102,_0x4b8f35){_0x4b8f35=_0x4b8f35||0xcc;return function(_0x3cf7c5){if(_0x3cf7c5){return _0x1e5102[_0x129b('0x18')](_0x4b8f35);}return _0x1e5102[_0x129b('0x19')](_0x4b8f35)[_0x129b('0x1a')]();};}function respondWithResult(_0x379cd1,_0x4f3ff3){_0x4f3ff3=_0x4f3ff3||0xc8;return function(_0x94390d){if(_0x94390d){return _0x379cd1[_0x129b('0x19')](_0x4f3ff3)[_0x129b('0x1b')](_0x94390d);}};}function respondWithFilteredResult(_0x4edd0e,_0x139d4b){return function(_0x30beb8){if(_0x30beb8){var _0x5b49a8=typeof _0x139d4b[_0x129b('0x1c')]==='undefined'&&typeof _0x139d4b[_0x129b('0x1d')]===_0x129b('0x1e');var _0x1ba4c7=_0x30beb8[_0x129b('0x1f')];var _0x463095=_0x5b49a8?0x0:_0x139d4b[_0x129b('0x1c')];var _0x5d704e=_0x5b49a8?_0x30beb8[_0x129b('0x1f')]:_0x139d4b[_0x129b('0x1c')]+_0x139d4b['limit'];var _0x12899c;if(_0x5d704e>=_0x1ba4c7){_0x5d704e=_0x1ba4c7;_0x12899c=0xc8;}else{_0x12899c=0xce;}_0x4edd0e[_0x129b('0x19')](_0x12899c);return _0x4edd0e[_0x129b('0x20')](_0x129b('0x21'),_0x463095+'-'+_0x5d704e+'/'+_0x1ba4c7)[_0x129b('0x1b')](_0x30beb8);}return null;};}function patchUpdates(_0x1062ab){return function(_0x54c15b){try{jsonpatch[_0x129b('0x22')](_0x54c15b,_0x1062ab,!![]);}catch(_0x352dd4){return BPromise['reject'](_0x352dd4);}return _0x54c15b[_0x129b('0x23')]();};}function saveUpdates(_0x4ecb00,_0x352e71){return function(_0x575a01){if(_0x575a01){return _0x575a01[_0x129b('0x24')](_0x4ecb00)['then'](function(_0x26d9d5){return _0x26d9d5;});}return null;};}function removeEntity(_0x11f11c,_0x1c3022){return function(_0x5bae73){if(_0x5bae73){return _0x5bae73[_0x129b('0x25')]()[_0x129b('0x26')](function(){_0x11f11c[_0x129b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59819b,_0x458f11){return function(_0x168beb){if(!_0x168beb){_0x59819b['sendStatus'](0x194);}return _0x168beb;};}function handleError(_0x2aeaee,_0x17b6f4){_0x17b6f4=_0x17b6f4||0x1f4;return function(_0x245abd){logger[_0x129b('0x27')](_0x245abd[_0x129b('0x28')]);if(_0x245abd[_0x129b('0x29')]){delete _0x245abd[_0x129b('0x29')];}_0x2aeaee[_0x129b('0x19')](_0x17b6f4)[_0x129b('0x2a')](_0x245abd);};}exports[_0x129b('0x2b')]=function(_0x3979eb,_0xf262aa){var _0x15cf9b={},_0x1cbac9={},_0x424f90={'count':0x0,'rows':[]};var _0x1747c0=_['map'](db[_0x129b('0x2c')][_0x129b('0x2d')],function(_0x5c2b10){return{'name':_0x5c2b10[_0x129b('0x2e')],'type':_0x5c2b10[_0x129b('0x2f')]['key']};});_0x1cbac9['model']=_[_0x129b('0x30')](_0x1747c0,'name');_0x1cbac9[_0x129b('0x31')]=_[_0x129b('0x32')](_0x3979eb[_0x129b('0x31')]);_0x1cbac9[_0x129b('0x33')]=_[_0x129b('0x34')](_0x1cbac9[_0x129b('0x35')],_0x1cbac9[_0x129b('0x31')]);_0x15cf9b[_0x129b('0x36')]=_[_0x129b('0x34')](_0x1cbac9[_0x129b('0x35')],qs[_0x129b('0x37')](_0x3979eb['query']['fields']));_0x15cf9b[_0x129b('0x36')]=_0x15cf9b[_0x129b('0x36')]['length']?_0x15cf9b[_0x129b('0x36')]:_0x1cbac9[_0x129b('0x35')];if(!_0x3979eb['query']['hasOwnProperty']('nolimit')){_0x15cf9b[_0x129b('0x1d')]=qs[_0x129b('0x1d')](_0x3979eb[_0x129b('0x31')]['limit']);_0x15cf9b['offset']=qs[_0x129b('0x1c')](_0x3979eb[_0x129b('0x31')][_0x129b('0x1c')]);}_0x15cf9b[_0x129b('0x38')]=qs[_0x129b('0x39')](_0x3979eb[_0x129b('0x31')][_0x129b('0x39')]);_0x15cf9b['where']=qs[_0x129b('0x33')](_[_0x129b('0x3a')](_0x3979eb[_0x129b('0x31')],_0x1cbac9[_0x129b('0x33')]),_0x1747c0);if(_0x3979eb[_0x129b('0x31')][_0x129b('0x3b')]){_0x15cf9b[_0x129b('0x3c')]=_[_0x129b('0x3d')](_0x15cf9b[_0x129b('0x3c')],{'$or':_[_0x129b('0x30')](_0x1747c0,function(_0x3d92f8){if(_0x3d92f8[_0x129b('0x2f')]!=='VIRTUAL'){var _0xabc270={};_0xabc270[_0x3d92f8[_0x129b('0x29')]]={'$like':'%'+_0x3979eb[_0x129b('0x31')][_0x129b('0x3b')]+'%'};return _0xabc270;}})});}_0x15cf9b=_['merge']({},_0x15cf9b,_0x3979eb[_0x129b('0x3e')]);var _0x503b07={'where':_0x15cf9b[_0x129b('0x3c')]};return db[_0x129b('0x2c')][_0x129b('0x1f')](_0x503b07)[_0x129b('0x26')](function(_0x348e06){_0x424f90[_0x129b('0x1f')]=_0x348e06;if(_0x3979eb[_0x129b('0x31')][_0x129b('0x3f')]){_0x15cf9b['include']=[{'all':!![]}];}return db[_0x129b('0x2c')][_0x129b('0x40')](_0x15cf9b);})[_0x129b('0x26')](function(_0x49bdce){_0x424f90[_0x129b('0x41')]=_0x49bdce;return _0x424f90;})[_0x129b('0x26')](respondWithFilteredResult(_0xf262aa,_0x15cf9b))[_0x129b('0x42')](handleError(_0xf262aa,null));};exports[_0x129b('0x43')]=function(_0x33c741,_0x14810f){var _0x5273c6={'raw':!![],'where':{'id':_0x33c741[_0x129b('0x44')]['id']}},_0x4b5b8d={};_0x4b5b8d[_0x129b('0x35')]=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x4b5b8d[_0x129b('0x31')]=_['keys'](_0x33c741['query']);_0x4b5b8d[_0x129b('0x33')]=_[_0x129b('0x34')](_0x4b5b8d['model'],_0x4b5b8d[_0x129b('0x31')]);_0x5273c6['attributes']=_[_0x129b('0x34')](_0x4b5b8d['model'],qs['fields'](_0x33c741[_0x129b('0x31')][_0x129b('0x37')]));_0x5273c6[_0x129b('0x36')]=_0x5273c6[_0x129b('0x36')][_0x129b('0x45')]?_0x5273c6['attributes']:_0x4b5b8d[_0x129b('0x35')];if(_0x33c741['query'][_0x129b('0x3f')]){_0x5273c6[_0x129b('0x46')]=[{'all':!![]}];}_0x5273c6=_[_0x129b('0x3d')]({},_0x5273c6,_0x33c741[_0x129b('0x3e')]);return db[_0x129b('0x2c')]['find'](_0x5273c6)[_0x129b('0x26')](handleEntityNotFound(_0x14810f,null))['then'](respondWithResult(_0x14810f,null))[_0x129b('0x42')](handleError(_0x14810f,null));};exports[_0x129b('0x47')]=function(_0xa0244d,_0x2f034e){return db[_0x129b('0x2c')][_0x129b('0x47')](_0xa0244d[_0x129b('0x48')],{})['then'](respondWithResult(_0x2f034e,0xc9))['catch'](handleError(_0x2f034e,null));};exports[_0x129b('0x24')]=function(_0x29bbcc,_0x1989f6){if(_0x29bbcc[_0x129b('0x48')]['id']){delete _0x29bbcc[_0x129b('0x48')]['id'];}return db[_0x129b('0x2c')][_0x129b('0x49')]({'where':{'id':_0x29bbcc[_0x129b('0x44')]['id']}})[_0x129b('0x26')](handleEntityNotFound(_0x1989f6,null))['then'](saveUpdates(_0x29bbcc[_0x129b('0x48')],null))[_0x129b('0x26')](respondWithResult(_0x1989f6,null))['catch'](handleError(_0x1989f6,null));};exports[_0x129b('0x25')]=function(_0x2105c2,_0x173263){return db[_0x129b('0x2c')]['find']({'where':{'id':_0x2105c2['params']['id']}})[_0x129b('0x26')](handleEntityNotFound(_0x173263,null))[_0x129b('0x26')](removeEntity(_0x173263,null))[_0x129b('0x42')](handleError(_0x173263,null));};exports[_0x129b('0x4a')]=function(_0x22560b,_0x4317d1){return db[_0x129b('0x2c')][_0x129b('0x4a')]()[_0x129b('0x26')](respondWithResult(_0x4317d1,null))[_0x129b('0x42')](handleError(_0x4317d1,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 875a5fe..906f12d 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29aae6,_0x14c536){var _0x4be4e0=function(_0x16048e){while(--_0x16048e){_0x29aae6['push'](_0x29aae6['shift']());}};_0x4be4e0(++_0x14c536);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0xb10b,0x12a));var _0xbb10=function(_0xc1078,_0x87768b){_0xc1078=_0xc1078-0x0;var _0x1eb9bd=_0xb10b[_0xc1078];return _0x1eb9bd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d99713a..d75d208 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 _0x663a=['result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','../../mysqldb','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x663a,0x119));var _0xa663=function(_0xe9b2c4,_0xac14d4){_0xe9b2c4=_0xe9b2c4-0x0;var _0x1fbda2=_0x663a[_0xe9b2c4];return _0x1fbda2;};'use strict';var _=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var moment=require(_0xa663('0x2'));var BPromise=require(_0xa663('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa663('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa663('0x5'));var client=jayson['client'][_0xa663('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c3abd,_0x583cbf,_0x11730c){return new BPromise(function(_0x527c06,_0xeb2d61){return client[_0xa663('0x7')](_0x4c3abd,_0x11730c)[_0xa663('0x8')](function(_0x4535ff){logger[_0xa663('0x9')](_0xa663('0xa'),_0x583cbf,'request\x20sent');logger[_0xa663('0xb')](_0xa663('0xc'),_0x583cbf,'request\x20sent',JSON[_0xa663('0xd')](_0x4535ff));if(_0x4535ff[_0xa663('0xe')]){if(_0x4535ff[_0xa663('0xe')]['code']===0x1f4){logger[_0xa663('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x583cbf,_0x4535ff[_0xa663('0xe')][_0xa663('0xf')]);return _0xeb2d61(_0x4535ff[_0xa663('0xe')][_0xa663('0xf')]);}logger[_0xa663('0xe')](_0xa663('0xa'),_0x583cbf,_0x4535ff['error'][_0xa663('0xf')]);return _0x527c06(_0x4535ff[_0xa663('0xe')][_0xa663('0xf')]);}else{logger[_0xa663('0x9')](_0xa663('0xa'),_0x583cbf,'request\x20sent');_0x527c06(_0x4535ff[_0xa663('0x10')][_0xa663('0xf')]);}})[_0xa663('0x11')](function(_0x25d390){logger['error'](_0xa663('0xa'),_0x583cbf,_0x25d390);_0xeb2d61(_0x25d390);});});}exports[_0xa663('0x12')]=function(_0x5abb3d){var _0x2efeb9=this;return new Promise(function(_0x30f00e,_0x1e967c){return db[_0xa663('0x13')][_0xa663('0x14')](_0x5abb3d[_0xa663('0x15')],{'raw':_0x5abb3d['options']?_0x5abb3d[_0xa663('0x16')][_0xa663('0x17')]===undefined?!![]:![]:!![]})[_0xa663('0x8')](function(_0x5e7116){logger[_0xa663('0x9')]('CreateChatQueueReport',_0x5abb3d);logger[_0xa663('0xb')](_0xa663('0x12'),_0x5abb3d,JSON[_0xa663('0xd')](_0x5e7116));_0x30f00e(_0x5e7116);})[_0xa663('0x11')](function(_0x1abd78){logger['error']('CreateChatQueueReport',_0x1abd78[_0xa663('0xf')],_0x5abb3d);_0x1e967c(_0x2efeb9['error'](0x1f4,_0x1abd78[_0xa663('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x3d080c){var _0x63a259=this;return new Promise(function(_0x5f016e,_0x1f467b){return db['ChatQueueReport']['update'](_0x3d080c[_0xa663('0x15')],{'raw':_0x3d080c[_0xa663('0x16')]?_0x3d080c[_0xa663('0x16')][_0xa663('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d080c[_0xa663('0x16')]?_0x3d080c[_0xa663('0x16')][_0xa663('0x18')]||null:null,'attributes':_0x3d080c[_0xa663('0x16')]?_0x3d080c[_0xa663('0x16')]['attributes']||null:null,'limit':_0x3d080c[_0xa663('0x16')]?_0x3d080c[_0xa663('0x16')][_0xa663('0x19')]||null:null})[_0xa663('0x8')](function(_0x16fc80){logger['info']('UpdateChatQueueReport',_0x3d080c);logger[_0xa663('0xb')](_0xa663('0x1a'),_0x3d080c,JSON[_0xa663('0xd')](_0x16fc80));_0x5f016e(_0x16fc80);})[_0xa663('0x11')](function(_0x282556){logger[_0xa663('0xe')](_0xa663('0x1a'),_0x282556[_0xa663('0xf')],_0x3d080c);_0x1f467b(_0x63a259[_0xa663('0xe')](0x1f4,_0x282556['message']));});});}; \ No newline at end of file +var _0x40b2=['stringify','error','message','result','catch','CreateChatQueueReport','create','options','raw','debug','UpdateChatQueueReport','ChatQueueReport','where','attributes','limit','util','moment','randomstring','ioredis','../../config/logger','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x23ed03,_0x4e008c){var _0x58ab9d=function(_0xc57b84){while(--_0xc57b84){_0x23ed03['push'](_0x23ed03['shift']());}};_0x58ab9d(++_0x4e008c);}(_0x40b2,0x143));var _0x240b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x40b2[_0x134c2e];return _0x2825db;};'use strict';var _=require('lodash');var util=require(_0x240b('0x0'));var moment=require(_0x240b('0x1'));var BPromise=require('bluebird');var rs=require(_0x240b('0x2'));var fs=require('fs');var Redis=require(_0x240b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x240b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x240b('0x5')][_0x240b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x528a9a,_0x1b7264,_0x41c313){return new BPromise(function(_0x34cda0,_0x59644c){return client[_0x240b('0x7')](_0x528a9a,_0x41c313)[_0x240b('0x8')](function(_0x16ac5d){logger[_0x240b('0x9')](_0x240b('0xa'),_0x1b7264,_0x240b('0xb'));logger['debug'](_0x240b('0xc'),_0x1b7264,_0x240b('0xb'),JSON[_0x240b('0xd')](_0x16ac5d));if(_0x16ac5d[_0x240b('0xe')]){if(_0x16ac5d[_0x240b('0xe')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1b7264,_0x16ac5d[_0x240b('0xe')]['message']);return _0x59644c(_0x16ac5d[_0x240b('0xe')][_0x240b('0xf')]);}logger['error'](_0x240b('0xa'),_0x1b7264,_0x16ac5d['error'][_0x240b('0xf')]);return _0x34cda0(_0x16ac5d[_0x240b('0xe')][_0x240b('0xf')]);}else{logger[_0x240b('0x9')](_0x240b('0xa'),_0x1b7264,_0x240b('0xb'));_0x34cda0(_0x16ac5d[_0x240b('0x10')]['message']);}})[_0x240b('0x11')](function(_0xb1b2b8){logger[_0x240b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x1b7264,_0xb1b2b8);_0x59644c(_0xb1b2b8);});});}exports[_0x240b('0x12')]=function(_0x34f2b8){var _0x1997d0=this;return new Promise(function(_0x40852c,_0x594dfa){return db['ChatQueueReport'][_0x240b('0x13')](_0x34f2b8['body'],{'raw':_0x34f2b8[_0x240b('0x14')]?_0x34f2b8['options'][_0x240b('0x15')]===undefined?!![]:![]:!![]})[_0x240b('0x8')](function(_0x1c045a){logger[_0x240b('0x9')](_0x240b('0x12'),_0x34f2b8);logger[_0x240b('0x16')]('CreateChatQueueReport',_0x34f2b8,JSON[_0x240b('0xd')](_0x1c045a));_0x40852c(_0x1c045a);})[_0x240b('0x11')](function(_0x5dccf1){logger[_0x240b('0xe')](_0x240b('0x12'),_0x5dccf1[_0x240b('0xf')],_0x34f2b8);_0x594dfa(_0x1997d0[_0x240b('0xe')](0x1f4,_0x5dccf1['message']));});});};exports[_0x240b('0x17')]=function(_0x3a278f){var _0x525c4e=this;return new Promise(function(_0x202085,_0x40d9d8){return db[_0x240b('0x18')]['update'](_0x3a278f['body'],{'raw':_0x3a278f[_0x240b('0x14')]?_0x3a278f[_0x240b('0x14')][_0x240b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a278f[_0x240b('0x14')]?_0x3a278f[_0x240b('0x14')][_0x240b('0x19')]||null:null,'attributes':_0x3a278f['options']?_0x3a278f[_0x240b('0x14')][_0x240b('0x1a')]||null:null,'limit':_0x3a278f[_0x240b('0x14')]?_0x3a278f[_0x240b('0x14')][_0x240b('0x1b')]||null:null})[_0x240b('0x8')](function(_0x5ee8d4){logger[_0x240b('0x9')](_0x240b('0x17'),_0x3a278f);logger[_0x240b('0x16')](_0x240b('0x17'),_0x3a278f,JSON['stringify'](_0x5ee8d4));_0x202085(_0x5ee8d4);})['catch'](function(_0xab3292){logger[_0x240b('0xe')](_0x240b('0x17'),_0xab3292[_0x240b('0xf')],_0x3a278f);_0x40d9d8(_0x525c4e[_0x240b('0xe')](0x1f4,_0xab3292[_0x240b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bf81ed8..6e86178 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 _0xc355=['get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x4afd7f,_0x124b6f){var _0x4d1b6c=function(_0xaae48d){while(--_0xaae48d){_0x4afd7f['push'](_0x4afd7f['shift']());}};_0x4d1b6c(++_0x124b6f);}(_0xc355,0x12a));var _0x5c35=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xc355[_0x49c68e];return _0x33032b;};'use strict';var multer=require('multer');var util=require(_0x5c35('0x0'));var path=require('path');var timeout=require(_0x5c35('0x1'));var express=require(_0x5c35('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5c35('0x3'));var config=require(_0x5c35('0x4'));var controller=require(_0x5c35('0x5'));router[_0x5c35('0x6')]('/',auth[_0x5c35('0x7')](),controller['index']);router[_0x5c35('0x6')](_0x5c35('0x8'),auth[_0x5c35('0x7')](),controller['describe']);router['get'](_0x5c35('0x9'),auth['isAuthenticated'](),controller[_0x5c35('0xa')]);router[_0x5c35('0xb')]('/',auth[_0x5c35('0x7')](),controller[_0x5c35('0xc')]);router[_0x5c35('0xd')](_0x5c35('0x9'),auth['isAuthenticated'](),controller[_0x5c35('0xe')]);router[_0x5c35('0xf')](_0x5c35('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x08ef=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create','/:id','update','exports','util'];(function(_0x5da4f9,_0x5526be){var _0x157e2b=function(_0x3d5069){while(--_0x3d5069){_0x5da4f9['push'](_0x5da4f9['shift']());}};_0x157e2b(++_0x5526be);}(_0x08ef,0xfb));var _0xf08e=function(_0x11d094,_0xba01a8){_0x11d094=_0x11d094-0x0;var _0x6c9744=_0x08ef[_0x11d094];return _0x6c9744;};'use strict';var multer=require('multer');var util=require(_0xf08e('0x0'));var path=require(_0xf08e('0x1'));var timeout=require(_0xf08e('0x2'));var express=require(_0xf08e('0x3'));var router=express[_0xf08e('0x4')]();var fs_extra=require(_0xf08e('0x5'));var auth=require(_0xf08e('0x6'));var interaction=require(_0xf08e('0x7'));var config=require(_0xf08e('0x8'));var controller=require(_0xf08e('0x9'));router['get']('/',auth[_0xf08e('0xa')](),controller[_0xf08e('0xb')]);router['get'](_0xf08e('0xc'),auth[_0xf08e('0xa')](),controller[_0xf08e('0xd')]);router[_0xf08e('0xe')]('/:id',auth[_0xf08e('0xa')](),controller[_0xf08e('0xf')]);router[_0xf08e('0x10')]('/',auth[_0xf08e('0xa')](),controller[_0xf08e('0x11')]);router['put'](_0xf08e('0x12'),auth[_0xf08e('0xa')](),controller[_0xf08e('0x13')]);router['delete'](_0xf08e('0x12'),auth[_0xf08e('0xa')](),controller['destroy']);module[_0xf08e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9ecc5fa..48f5344 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x269a42,_0x13c53c){var _0x1e76c1=function(_0x42c070){while(--_0x42c070){_0x269a42['push'](_0x269a42['shift']());}};_0x1e76c1(++_0x13c53c);}(_0x70e0,0x17b));var _0x070e=function(_0x340546,_0x4a08df){_0x340546=_0x340546-0x0;var _0x11ba79=_0x70e0[_0x340546];return _0x11ba79;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x33ad03,_0x107fb0){var _0x14c4eb=function(_0x28a6c6){while(--_0x28a6c6){_0x33ad03['push'](_0x33ad03['shift']());}};_0x14c4eb(++_0x107fb0);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a8749,_0x2e0709){_0x5a8749=_0x5a8749-0x0;var _0xa0f9=_0xedd9[_0x5a8749];return _0xa0f9;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a8d9122..14776ca 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 _0x4688=['count','set','Content-Range','apply','then','destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','describe','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined'];(function(_0x89933d,_0x4f62c7){var _0x1ff617=function(_0x593584){while(--_0x593584){_0x89933d['push'](_0x89933d['shift']());}};_0x1ff617(++_0x4f62c7);}(_0x4688,0xbb));var _0x8468=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x4688[_0x16a223];return _0x5ded66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8468('0x0'));var zipdir=require(_0x8468('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8468('0x2'));var BPromise=require(_0x8468('0x3'));var Mustache=require(_0x8468('0x4'));var util=require(_0x8468('0x5'));var path=require('path');var sox=require(_0x8468('0x6'));var csv=require('to-csv');var ejs=require(_0x8468('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8468('0x8'));var squel=require(_0x8468('0x9'));var crypto=require(_0x8468('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8468('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8468('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8468('0xd'));var as=require(_0x8468('0xe'));var hardwareService=require(_0x8468('0xf'));var logger=require(_0x8468('0x10'))('api');var utils=require(_0x8468('0x11'));var config=require(_0x8468('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x390488,_0x339b2b){_0x339b2b=_0x339b2b||0xcc;return function(_0x4abf9e){if(_0x4abf9e){return _0x390488[_0x8468('0x13')](_0x339b2b);}return _0x390488['status'](_0x339b2b)[_0x8468('0x14')]();};}function respondWithResult(_0x3f8391,_0x4e6bc6){_0x4e6bc6=_0x4e6bc6||0xc8;return function(_0x41e388){if(_0x41e388){return _0x3f8391[_0x8468('0x15')](_0x4e6bc6)[_0x8468('0x16')](_0x41e388);}};}function respondWithFilteredResult(_0x30a6ce,_0x4852f8){return function(_0x2dfdb5){if(_0x2dfdb5){var _0x4df04c=typeof _0x4852f8[_0x8468('0x17')]==='undefined'&&typeof _0x4852f8[_0x8468('0x18')]===_0x8468('0x19');var _0x47a564=_0x2dfdb5[_0x8468('0x1a')];var _0x519da9=_0x4df04c?0x0:_0x4852f8[_0x8468('0x17')];var _0x4f1bdf=_0x4df04c?_0x2dfdb5[_0x8468('0x1a')]:_0x4852f8[_0x8468('0x17')]+_0x4852f8[_0x8468('0x18')];var _0x5adca2;if(_0x4f1bdf>=_0x47a564){_0x4f1bdf=_0x47a564;_0x5adca2=0xc8;}else{_0x5adca2=0xce;}_0x30a6ce[_0x8468('0x15')](_0x5adca2);return _0x30a6ce[_0x8468('0x1b')](_0x8468('0x1c'),_0x519da9+'-'+_0x4f1bdf+'/'+_0x47a564)[_0x8468('0x16')](_0x2dfdb5);}return null;};}function patchUpdates(_0x417ce6){return function(_0x47b3b4){try{jsonpatch[_0x8468('0x1d')](_0x47b3b4,_0x417ce6,!![]);}catch(_0x138b9d){return BPromise['reject'](_0x138b9d);}return _0x47b3b4['save']();};}function saveUpdates(_0x53e976,_0x5b4b67){return function(_0x5ba6d1){if(_0x5ba6d1){return _0x5ba6d1['update'](_0x53e976)[_0x8468('0x1e')](function(_0x3ee1f5){return _0x3ee1f5;});}return null;};}function removeEntity(_0x3640c5,_0x534cd4){return function(_0x691a7b){if(_0x691a7b){return _0x691a7b[_0x8468('0x1f')]()[_0x8468('0x1e')](function(){_0x3640c5[_0x8468('0x15')](0xcc)[_0x8468('0x14')]();});}};}function handleEntityNotFound(_0x246137,_0xb51f71){return function(_0x42e7a1){if(!_0x42e7a1){_0x246137[_0x8468('0x13')](0x194);}return _0x42e7a1;};}function handleError(_0x1e1058,_0x313431){_0x313431=_0x313431||0x1f4;return function(_0x5ecdad){logger[_0x8468('0x20')](_0x5ecdad[_0x8468('0x21')]);if(_0x5ecdad[_0x8468('0x22')]){delete _0x5ecdad[_0x8468('0x22')];}_0x1e1058[_0x8468('0x15')](_0x313431)[_0x8468('0x23')](_0x5ecdad);};}exports['index']=function(_0x4ff73b,_0x3602a8){var _0x54743c={},_0x4df0af={},_0x495571={'count':0x0,'rows':[]};var _0x2fe030=_[_0x8468('0x24')](db[_0x8468('0x25')][_0x8468('0x26')],function(_0xe2026e){return{'name':_0xe2026e[_0x8468('0x27')],'type':_0xe2026e['type'][_0x8468('0x28')]};});_0x4df0af[_0x8468('0x29')]=_[_0x8468('0x24')](_0x2fe030,_0x8468('0x22'));_0x4df0af['query']=_[_0x8468('0x2a')](_0x4ff73b[_0x8468('0x2b')]);_0x4df0af[_0x8468('0x2c')]=_[_0x8468('0x2d')](_0x4df0af[_0x8468('0x29')],_0x4df0af['query']);_0x54743c['attributes']=_[_0x8468('0x2d')](_0x4df0af[_0x8468('0x29')],qs['fields'](_0x4ff73b[_0x8468('0x2b')][_0x8468('0x2e')]));_0x54743c[_0x8468('0x2f')]=_0x54743c[_0x8468('0x2f')]['length']?_0x54743c[_0x8468('0x2f')]:_0x4df0af[_0x8468('0x29')];if(!_0x4ff73b[_0x8468('0x2b')][_0x8468('0x30')](_0x8468('0x31'))){_0x54743c[_0x8468('0x18')]=qs[_0x8468('0x18')](_0x4ff73b[_0x8468('0x2b')][_0x8468('0x18')]);_0x54743c['offset']=qs[_0x8468('0x17')](_0x4ff73b[_0x8468('0x2b')][_0x8468('0x17')]);}_0x54743c[_0x8468('0x32')]=qs[_0x8468('0x33')](_0x4ff73b['query'][_0x8468('0x33')]);_0x54743c[_0x8468('0x34')]=qs[_0x8468('0x2c')](_[_0x8468('0x35')](_0x4ff73b['query'],_0x4df0af['filters']),_0x2fe030);if(_0x4ff73b[_0x8468('0x2b')][_0x8468('0x36')]){_0x54743c[_0x8468('0x34')]=_[_0x8468('0x37')](_0x54743c[_0x8468('0x34')],{'$or':_[_0x8468('0x24')](_0x2fe030,function(_0xede5f6){if(_0xede5f6[_0x8468('0x38')]!=='VIRTUAL'){var _0x2a0528={};_0x2a0528[_0xede5f6[_0x8468('0x22')]]={'$like':'%'+_0x4ff73b[_0x8468('0x2b')][_0x8468('0x36')]+'%'};return _0x2a0528;}})});}_0x54743c=_['merge']({},_0x54743c,_0x4ff73b[_0x8468('0x39')]);var _0x522941={'where':_0x54743c[_0x8468('0x34')]};return db[_0x8468('0x25')][_0x8468('0x1a')](_0x522941)['then'](function(_0x4fd13f){_0x495571['count']=_0x4fd13f;if(_0x4ff73b[_0x8468('0x2b')]['includeAll']){_0x54743c[_0x8468('0x3a')]=[{'all':!![]}];}return db[_0x8468('0x25')][_0x8468('0x3b')](_0x54743c);})[_0x8468('0x1e')](function(_0x726f05){_0x495571[_0x8468('0x3c')]=_0x726f05;return _0x495571;})[_0x8468('0x1e')](respondWithFilteredResult(_0x3602a8,_0x54743c))[_0x8468('0x3d')](handleError(_0x3602a8,null));};exports[_0x8468('0x3e')]=function(_0x2e9c6e,_0x236bc9){var _0x44af13={'raw':!![],'where':{'id':_0x2e9c6e[_0x8468('0x3f')]['id']}},_0x5cea07={};_0x5cea07['model']=_[_0x8468('0x2a')](db['ChatTransferReport'][_0x8468('0x26')]);_0x5cea07['query']=_[_0x8468('0x2a')](_0x2e9c6e['query']);_0x5cea07[_0x8468('0x2c')]=_[_0x8468('0x2d')](_0x5cea07['model'],_0x5cea07[_0x8468('0x2b')]);_0x44af13[_0x8468('0x2f')]=_[_0x8468('0x2d')](_0x5cea07['model'],qs[_0x8468('0x2e')](_0x2e9c6e['query'][_0x8468('0x2e')]));_0x44af13[_0x8468('0x2f')]=_0x44af13[_0x8468('0x2f')][_0x8468('0x40')]?_0x44af13[_0x8468('0x2f')]:_0x5cea07['model'];if(_0x2e9c6e[_0x8468('0x2b')][_0x8468('0x41')]){_0x44af13[_0x8468('0x3a')]=[{'all':!![]}];}_0x44af13=_[_0x8468('0x37')]({},_0x44af13,_0x2e9c6e[_0x8468('0x39')]);return db[_0x8468('0x25')][_0x8468('0x42')](_0x44af13)[_0x8468('0x1e')](handleEntityNotFound(_0x236bc9,null))['then'](respondWithResult(_0x236bc9,null))['catch'](handleError(_0x236bc9,null));};exports[_0x8468('0x43')]=function(_0x5468e3,_0x5def89){return db[_0x8468('0x25')]['create'](_0x5468e3[_0x8468('0x44')],{})['then'](respondWithResult(_0x5def89,0xc9))[_0x8468('0x3d')](handleError(_0x5def89,null));};exports[_0x8468('0x45')]=function(_0x5e4bc8,_0x1e6105){if(_0x5e4bc8['body']['id']){delete _0x5e4bc8[_0x8468('0x44')]['id'];}return db[_0x8468('0x25')]['find']({'where':{'id':_0x5e4bc8[_0x8468('0x3f')]['id']}})[_0x8468('0x1e')](handleEntityNotFound(_0x1e6105,null))[_0x8468('0x1e')](saveUpdates(_0x5e4bc8['body'],null))[_0x8468('0x1e')](respondWithResult(_0x1e6105,null))[_0x8468('0x3d')](handleError(_0x1e6105,null));};exports[_0x8468('0x1f')]=function(_0x486552,_0x3d2a75){return db[_0x8468('0x25')][_0x8468('0x42')]({'where':{'id':_0x486552[_0x8468('0x3f')]['id']}})[_0x8468('0x1e')](handleEntityNotFound(_0x3d2a75,null))[_0x8468('0x1e')](removeEntity(_0x3d2a75,null))[_0x8468('0x3d')](handleError(_0x3d2a75,null));};exports[_0x8468('0x46')]=function(_0x4c1ef0,_0x2b1de8){return db[_0x8468('0x25')][_0x8468('0x46')]()['then'](respondWithResult(_0x2b1de8,null))[_0x8468('0x3d')](handleError(_0x2b1de8,null));}; \ No newline at end of file +var _0x7d4a=['attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','include','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','offset','set','apply','reject','update','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','model','query','keys','filters','intersection','fields'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x7d4a,0xf5));var _0xa7d4=function(_0x3b40ab,_0x524ba7){_0x3b40ab=_0x3b40ab-0x0;var _0x570838=_0x7d4a[_0x3b40ab];return _0x570838;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7d4('0x0'));var zipdir=require(_0xa7d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7d4('0x2'));var moment=require(_0xa7d4('0x3'));var BPromise=require(_0xa7d4('0x4'));var Mustache=require('mustache');var util=require(_0xa7d4('0x5'));var path=require(_0xa7d4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa7d4('0x7'));var fs=require('fs');var fs_extra=require(_0xa7d4('0x8'));var _=require(_0xa7d4('0x9'));var squel=require(_0xa7d4('0xa'));var crypto=require(_0xa7d4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa7d4('0xc'));var toCsv=require(_0xa7d4('0xd'));var querystring=require(_0xa7d4('0xe'));var Papa=require(_0xa7d4('0xf'));var Redis=require(_0xa7d4('0x10'));var authService=require(_0xa7d4('0x11'));var qs=require(_0xa7d4('0x12'));var as=require(_0xa7d4('0x13'));var hardwareService=require(_0xa7d4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa7d4('0x15'));var config=require(_0xa7d4('0x16'));var licenseUtil=require(_0xa7d4('0x17'));var db=require(_0xa7d4('0x18'))['db'];function respondWithStatusCode(_0x2ef4e8,_0x40c59d){_0x40c59d=_0x40c59d||0xcc;return function(_0x542e77){if(_0x542e77){return _0x2ef4e8['sendStatus'](_0x40c59d);}return _0x2ef4e8[_0xa7d4('0x19')](_0x40c59d)['end']();};}function respondWithResult(_0x2bc4a9,_0x402802){_0x402802=_0x402802||0xc8;return function(_0x152d58){if(_0x152d58){return _0x2bc4a9[_0xa7d4('0x19')](_0x402802)[_0xa7d4('0x1a')](_0x152d58);}};}function respondWithFilteredResult(_0x1dc179,_0x5c9d7b){return function(_0x2e7c08){if(_0x2e7c08){var _0x57d442=typeof _0x5c9d7b['offset']==='undefined'&&typeof _0x5c9d7b[_0xa7d4('0x1b')]===_0xa7d4('0x1c');var _0x3eec15=_0x2e7c08['count'];var _0x3ba413=_0x57d442?0x0:_0x5c9d7b['offset'];var _0x5b4578=_0x57d442?_0x2e7c08['count']:_0x5c9d7b[_0xa7d4('0x1d')]+_0x5c9d7b['limit'];var _0x651020;if(_0x5b4578>=_0x3eec15){_0x5b4578=_0x3eec15;_0x651020=0xc8;}else{_0x651020=0xce;}_0x1dc179[_0xa7d4('0x19')](_0x651020);return _0x1dc179[_0xa7d4('0x1e')]('Content-Range',_0x3ba413+'-'+_0x5b4578+'/'+_0x3eec15)[_0xa7d4('0x1a')](_0x2e7c08);}return null;};}function patchUpdates(_0x55126b){return function(_0x38f81a){try{jsonpatch[_0xa7d4('0x1f')](_0x38f81a,_0x55126b,!![]);}catch(_0x2d65fc){return BPromise[_0xa7d4('0x20')](_0x2d65fc);}return _0x38f81a['save']();};}function saveUpdates(_0x3a217b,_0x4db5de){return function(_0x1eb81a){if(_0x1eb81a){return _0x1eb81a[_0xa7d4('0x21')](_0x3a217b)[_0xa7d4('0x22')](function(_0x5980c0){return _0x5980c0;});}return null;};}function removeEntity(_0x57a7fd,_0x522dcb){return function(_0x48e152){if(_0x48e152){return _0x48e152['destroy']()['then'](function(){_0x57a7fd['status'](0xcc)[_0xa7d4('0x23')]();});}};}function handleEntityNotFound(_0x34ffec,_0x82dfe0){return function(_0x336a91){if(!_0x336a91){_0x34ffec['sendStatus'](0x194);}return _0x336a91;};}function handleError(_0x17f493,_0x339773){_0x339773=_0x339773||0x1f4;return function(_0x23533a){logger[_0xa7d4('0x24')](_0x23533a[_0xa7d4('0x25')]);if(_0x23533a[_0xa7d4('0x26')]){delete _0x23533a[_0xa7d4('0x26')];}_0x17f493[_0xa7d4('0x19')](_0x339773)[_0xa7d4('0x27')](_0x23533a);};}exports[_0xa7d4('0x28')]=function(_0x189e71,_0x1b1911){var _0x2677c2={},_0x4bc1cc={},_0x4d621f={'count':0x0,'rows':[]};var _0x13ab42=_[_0xa7d4('0x29')](db[_0xa7d4('0x2a')][_0xa7d4('0x2b')],function(_0x41fb8e){return{'name':_0x41fb8e['fieldName'],'type':_0x41fb8e[_0xa7d4('0x2c')]['key']};});_0x4bc1cc[_0xa7d4('0x2d')]=_[_0xa7d4('0x29')](_0x13ab42,_0xa7d4('0x26'));_0x4bc1cc[_0xa7d4('0x2e')]=_[_0xa7d4('0x2f')](_0x189e71['query']);_0x4bc1cc[_0xa7d4('0x30')]=_[_0xa7d4('0x31')](_0x4bc1cc[_0xa7d4('0x2d')],_0x4bc1cc[_0xa7d4('0x2e')]);_0x2677c2['attributes']=_[_0xa7d4('0x31')](_0x4bc1cc[_0xa7d4('0x2d')],qs['fields'](_0x189e71[_0xa7d4('0x2e')][_0xa7d4('0x32')]));_0x2677c2[_0xa7d4('0x33')]=_0x2677c2[_0xa7d4('0x33')][_0xa7d4('0x34')]?_0x2677c2[_0xa7d4('0x33')]:_0x4bc1cc[_0xa7d4('0x2d')];if(!_0x189e71[_0xa7d4('0x2e')]['hasOwnProperty'](_0xa7d4('0x35'))){_0x2677c2['limit']=qs['limit'](_0x189e71[_0xa7d4('0x2e')]['limit']);_0x2677c2[_0xa7d4('0x1d')]=qs['offset'](_0x189e71[_0xa7d4('0x2e')]['offset']);}_0x2677c2[_0xa7d4('0x36')]=qs[_0xa7d4('0x37')](_0x189e71[_0xa7d4('0x2e')]['sort']);_0x2677c2['where']=qs['filters'](_[_0xa7d4('0x38')](_0x189e71[_0xa7d4('0x2e')],_0x4bc1cc[_0xa7d4('0x30')]),_0x13ab42);if(_0x189e71[_0xa7d4('0x2e')][_0xa7d4('0x39')]){_0x2677c2['where']=_['merge'](_0x2677c2[_0xa7d4('0x3a')],{'$or':_[_0xa7d4('0x29')](_0x13ab42,function(_0x42c89c){if(_0x42c89c[_0xa7d4('0x2c')]!==_0xa7d4('0x3b')){var _0x3bb247={};_0x3bb247[_0x42c89c[_0xa7d4('0x26')]]={'$like':'%'+_0x189e71[_0xa7d4('0x2e')][_0xa7d4('0x39')]+'%'};return _0x3bb247;}})});}_0x2677c2=_[_0xa7d4('0x3c')]({},_0x2677c2,_0x189e71[_0xa7d4('0x3d')]);var _0x3700b7={'where':_0x2677c2[_0xa7d4('0x3a')]};return db[_0xa7d4('0x2a')][_0xa7d4('0x3e')](_0x3700b7)['then'](function(_0x1314c0){_0x4d621f[_0xa7d4('0x3e')]=_0x1314c0;if(_0x189e71[_0xa7d4('0x2e')][_0xa7d4('0x3f')]){_0x2677c2['include']=[{'all':!![]}];}return db[_0xa7d4('0x2a')]['findAll'](_0x2677c2);})['then'](function(_0x32c8c1){_0x4d621f[_0xa7d4('0x40')]=_0x32c8c1;return _0x4d621f;})[_0xa7d4('0x22')](respondWithFilteredResult(_0x1b1911,_0x2677c2))[_0xa7d4('0x41')](handleError(_0x1b1911,null));};exports[_0xa7d4('0x42')]=function(_0x46f967,_0x125ccf){var _0x1195e3={'raw':!![],'where':{'id':_0x46f967[_0xa7d4('0x43')]['id']}},_0xd9f1f={};_0xd9f1f[_0xa7d4('0x2d')]=_[_0xa7d4('0x2f')](db['ChatTransferReport'][_0xa7d4('0x2b')]);_0xd9f1f[_0xa7d4('0x2e')]=_[_0xa7d4('0x2f')](_0x46f967[_0xa7d4('0x2e')]);_0xd9f1f[_0xa7d4('0x30')]=_[_0xa7d4('0x31')](_0xd9f1f[_0xa7d4('0x2d')],_0xd9f1f[_0xa7d4('0x2e')]);_0x1195e3[_0xa7d4('0x33')]=_[_0xa7d4('0x31')](_0xd9f1f['model'],qs[_0xa7d4('0x32')](_0x46f967[_0xa7d4('0x2e')][_0xa7d4('0x32')]));_0x1195e3[_0xa7d4('0x33')]=_0x1195e3[_0xa7d4('0x33')][_0xa7d4('0x34')]?_0x1195e3[_0xa7d4('0x33')]:_0xd9f1f[_0xa7d4('0x2d')];if(_0x46f967[_0xa7d4('0x2e')]['includeAll']){_0x1195e3[_0xa7d4('0x44')]=[{'all':!![]}];}_0x1195e3=_[_0xa7d4('0x3c')]({},_0x1195e3,_0x46f967[_0xa7d4('0x3d')]);return db[_0xa7d4('0x2a')][_0xa7d4('0x45')](_0x1195e3)[_0xa7d4('0x22')](handleEntityNotFound(_0x125ccf,null))['then'](respondWithResult(_0x125ccf,null))[_0xa7d4('0x41')](handleError(_0x125ccf,null));};exports[_0xa7d4('0x46')]=function(_0xeae1cb,_0x361568){return db[_0xa7d4('0x2a')][_0xa7d4('0x46')](_0xeae1cb[_0xa7d4('0x47')],{})[_0xa7d4('0x22')](respondWithResult(_0x361568,0xc9))[_0xa7d4('0x41')](handleError(_0x361568,null));};exports['update']=function(_0x58fde9,_0x5bf86d){if(_0x58fde9[_0xa7d4('0x47')]['id']){delete _0x58fde9['body']['id'];}return db[_0xa7d4('0x2a')][_0xa7d4('0x45')]({'where':{'id':_0x58fde9[_0xa7d4('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bf86d,null))['then'](saveUpdates(_0x58fde9['body'],null))['then'](respondWithResult(_0x5bf86d,null))['catch'](handleError(_0x5bf86d,null));};exports[_0xa7d4('0x48')]=function(_0xc49b8,_0x5098b5){return db[_0xa7d4('0x2a')][_0xa7d4('0x45')]({'where':{'id':_0xc49b8[_0xa7d4('0x43')]['id']}})['then'](handleEntityNotFound(_0x5098b5,null))['then'](removeEntity(_0x5098b5,null))[_0xa7d4('0x41')](handleError(_0x5098b5,null));};exports[_0xa7d4('0x49')]=function(_0x5d8c05,_0x3337c2){return db[_0xa7d4('0x2a')][_0xa7d4('0x49')]()[_0xa7d4('0x22')](respondWithResult(_0x3337c2,null))[_0xa7d4('0x41')](handleError(_0x3337c2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c14098a..3b7dd63 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 _0x2d15=['./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2d15,0xe9));var _0x52d1=function(_0xf0c3b7,_0x33e9ce){_0xf0c3b7=_0xf0c3b7-0x0;var _0x1ef874=_0x2d15[_0xf0c3b7];return _0x1ef874;};'use strict';var _=require(_0x52d1('0x0'));var util=require(_0x52d1('0x1'));var logger=require(_0x52d1('0x2'))('api');var moment=require(_0x52d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x52d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52d1('0x5'));var config=require(_0x52d1('0x6'));var attributes=require(_0x52d1('0x7'));module[_0x52d1('0x8')]=function(_0x2bc645,_0x144e81){return _0x2bc645[_0x52d1('0x9')](_0x52d1('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x52d1('0xb'),'fields':[_0x52d1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc17a=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x13f583,_0x23b5a4){var _0x5c27fc=function(_0x10cac1){while(--_0x10cac1){_0x13f583['push'](_0x13f583['shift']());}};_0x5c27fc(++_0x23b5a4);}(_0xc17a,0x1bc));var _0xac17=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc17a[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xac17('0x0'));var util=require(_0xac17('0x1'));var logger=require(_0xac17('0x2'))(_0xac17('0x3'));var moment=require('moment');var BPromise=require(_0xac17('0x4'));var rp=require(_0xac17('0x5'));var fs=require('fs');var path=require(_0xac17('0x6'));var rimraf=require(_0xac17('0x7'));var config=require(_0xac17('0x8'));var attributes=require(_0xac17('0x9'));module[_0xac17('0xa')]=function(_0x3e08fb,_0x238265){return _0x3e08fb[_0xac17('0xb')](_0xac17('0xc'),attributes,{'tableName':_0xac17('0xd'),'paranoid':![],'indexes':[{'name':_0xac17('0xe'),'fields':[_0xac17('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 85e2ba8..b5bd837 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 _0x10e0=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0x10e0,0x12e));var _0x010e=function(_0x16dfa1,_0x3f9429){_0x16dfa1=_0x16dfa1-0x0;var _0x5c9ad5=_0x10e0[_0x16dfa1];return _0x5c9ad5;};'use strict';var _=require(_0x010e('0x0'));var util=require(_0x010e('0x1'));var moment=require(_0x010e('0x2'));var BPromise=require(_0x010e('0x3'));var rs=require(_0x010e('0x4'));var fs=require('fs');var Redis=require(_0x010e('0x5'));var db=require(_0x010e('0x6'))['db'];var utils=require(_0x010e('0x7'));var logger=require(_0x010e('0x8'))('rpc');var config=require(_0x010e('0x9'));var jayson=require(_0x010e('0xa'));var client=jayson[_0x010e('0xb')][_0x010e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12b5f0,_0x776e9b,_0x5c7f5f){return new BPromise(function(_0x1d28a8,_0x285ab3){return client[_0x010e('0xd')](_0x12b5f0,_0x5c7f5f)['then'](function(_0x535558){logger[_0x010e('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x776e9b,_0x010e('0xf'));logger[_0x010e('0x10')](_0x010e('0x11'),_0x776e9b,'request\x20sent',JSON[_0x010e('0x12')](_0x535558));if(_0x535558['error']){if(_0x535558[_0x010e('0x13')][_0x010e('0x14')]===0x1f4){logger[_0x010e('0x13')](_0x010e('0x15'),_0x776e9b,_0x535558[_0x010e('0x13')]['message']);return _0x285ab3(_0x535558[_0x010e('0x13')][_0x010e('0x16')]);}logger[_0x010e('0x13')](_0x010e('0x15'),_0x776e9b,_0x535558[_0x010e('0x13')][_0x010e('0x16')]);return _0x1d28a8(_0x535558['error'][_0x010e('0x16')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x776e9b,_0x010e('0xf'));_0x1d28a8(_0x535558[_0x010e('0x17')][_0x010e('0x16')]);}})[_0x010e('0x18')](function(_0x42032){logger[_0x010e('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x776e9b,_0x42032);_0x285ab3(_0x42032);});});} \ No newline at end of file +var _0xe852=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xe852,0x18b));var _0x2e85=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xe852[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x2e85('0x0'));var util=require(_0x2e85('0x1'));var moment=require(_0x2e85('0x2'));var BPromise=require(_0x2e85('0x3'));var rs=require(_0x2e85('0x4'));var fs=require('fs');var Redis=require(_0x2e85('0x5'));var db=require(_0x2e85('0x6'))['db'];var utils=require(_0x2e85('0x7'));var logger=require(_0x2e85('0x8'))(_0x2e85('0x9'));var config=require(_0x2e85('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2e85('0xb')][_0x2e85('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55233a,_0x1db24c,_0x421a5c){return new BPromise(function(_0x6b3582,_0x3e6155){return client[_0x2e85('0xd')](_0x55233a,_0x421a5c)['then'](function(_0xdfd770){logger[_0x2e85('0xe')](_0x2e85('0xf'),_0x1db24c,_0x2e85('0x10'));logger['debug'](_0x2e85('0x11'),_0x1db24c,'request\x20sent',JSON[_0x2e85('0x12')](_0xdfd770));if(_0xdfd770[_0x2e85('0x13')]){if(_0xdfd770[_0x2e85('0x13')][_0x2e85('0x14')]===0x1f4){logger[_0x2e85('0x13')](_0x2e85('0xf'),_0x1db24c,_0xdfd770[_0x2e85('0x13')]['message']);return _0x3e6155(_0xdfd770[_0x2e85('0x13')][_0x2e85('0x15')]);}logger[_0x2e85('0x13')](_0x2e85('0xf'),_0x1db24c,_0xdfd770[_0x2e85('0x13')][_0x2e85('0x15')]);return _0x6b3582(_0xdfd770['error'][_0x2e85('0x15')]);}else{logger[_0x2e85('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x1db24c,_0x2e85('0x10'));_0x6b3582(_0xdfd770['result'][_0x2e85('0x15')]);}})[_0x2e85('0x16')](function(_0x25ebb5){logger['error'](_0x2e85('0xf'),_0x1db24c,_0x25ebb5);_0x3e6155(_0x25ebb5);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ff55af9..c580aff 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 _0x3cd0=['fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x1439e6,_0x2634b8){var _0x1101a9=function(_0x591d44){while(--_0x591d44){_0x1439e6['push'](_0x1439e6['shift']());}};_0x1101a9(++_0x2634b8);}(_0x3cd0,0xf8));var _0x03cd=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x3cd0[_0x79b649];return _0x1af9b1;};'use strict';var multer=require(_0x03cd('0x0'));var util=require(_0x03cd('0x1'));var path=require('path');var timeout=require(_0x03cd('0x2'));var express=require('express');var router=express[_0x03cd('0x3')]();var fs_extra=require(_0x03cd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x03cd('0x5'));var controller=require(_0x03cd('0x6'));router[_0x03cd('0x7')]('/',auth[_0x03cd('0x8')](),controller['index']);router['get'](_0x03cd('0x9'),auth[_0x03cd('0x8')](),controller[_0x03cd('0xa')]);router[_0x03cd('0x7')](_0x03cd('0xb'),auth[_0x03cd('0x8')](),controller[_0x03cd('0xc')]);router['post']('/',auth[_0x03cd('0x8')](),controller[_0x03cd('0xd')]);router[_0x03cd('0xe')]('/:id',auth[_0x03cd('0x8')](),controller['update']);router[_0x03cd('0xf')](_0x03cd('0xb'),auth[_0x03cd('0x8')](),controller[_0x03cd('0x10')]);module[_0x03cd('0x11')]=router; \ No newline at end of file +var _0xd4d6=['put','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x5baf6d,_0x439aa7){var _0x285208=function(_0x1c7bc9){while(--_0x1c7bc9){_0x5baf6d['push'](_0x5baf6d['shift']());}};_0x285208(++_0x439aa7);}(_0xd4d6,0x15b));var _0x6d4d=function(_0x59ffb9,_0x2405a9){_0x59ffb9=_0x59ffb9-0x0;var _0x1b649a=_0xd4d6[_0x59ffb9];return _0x1b649a;};'use strict';var multer=require(_0x6d4d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6d4d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6d4d('0x2'));var auth=require(_0x6d4d('0x3'));var interaction=require(_0x6d4d('0x4'));var config=require(_0x6d4d('0x5'));var controller=require(_0x6d4d('0x6'));router[_0x6d4d('0x7')]('/',auth[_0x6d4d('0x8')](),controller[_0x6d4d('0x9')]);router[_0x6d4d('0x7')](_0x6d4d('0xa'),auth[_0x6d4d('0x8')](),controller['describe']);router[_0x6d4d('0x7')](_0x6d4d('0xb'),auth['isAuthenticated'](),controller[_0x6d4d('0xc')]);router[_0x6d4d('0xd')]('/',auth[_0x6d4d('0x8')](),controller['create']);router[_0x6d4d('0xe')](_0x6d4d('0xb'),auth[_0x6d4d('0x8')](),controller[_0x6d4d('0xf')]);router[_0x6d4d('0x10')](_0x6d4d('0xb'),auth[_0x6d4d('0x8')](),controller[_0x6d4d('0x11')]);module[_0x6d4d('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 051fa00..01a3558 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 _0xa934=['input','name','text','getDataValue','parse','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','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','squared','rounded','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!','Skip','Feedback','star','thumb','INTEGER','stringify'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xa934,0x83));var _0x4a93=function(_0x2e8986,_0x5e612c){_0x2e8986=_0x2e8986-0x0;var _0x30647f=_0xa934[_0x2e8986];return _0x30647f;};'use strict';var Sequelize=require(_0x4a93('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'unique':_0x4a93('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x4')},'customerAlias':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':_0x4a93('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a93('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':_0x4a93('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4a93('0x1')]},'animation':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4a93('0x8')]('rounded',_0x4a93('0x9')),'defaultValue':_0x4a93('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0xb')},'offline_chat_button':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0xc')},'header_offline':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0xd')},'download_transcript':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4a93('0xf')]},'closingQuestion':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x12')},'noteTitle':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x14')},'closingMessage':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x15')},'closingMessageButton':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x16')},'conditionAgreement':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x17')},'ratingType':{'type':Sequelize[_0x4a93('0x8')](_0x4a93('0x18'),_0x4a93('0x19')),'defaultValue':_0x4a93('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x4a93('0x1a')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4a93('0xf')],'defaultValue':function(){return JSON[_0x4a93('0x1b')]({'items':[{'type':_0x4a93('0x1c'),'variable':null,'config':{'placeholder':_0x4a93('0x1d'),'type':_0x4a93('0x1e'),'required':!![]},'props':{'title':_0x4a93('0x1d'),'helpText':''}},{'type':_0x4a93('0x1c'),'props':{'title':_0x4a93('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x4a93('0x3'),'type':_0x4a93('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4a93('0x1f')]('onlineForm')?JSON[_0x4a93('0x20')](this[_0x4a93('0x1f')](_0x4a93('0x21'))):{};},'set':function(_0x41784c){return this[_0x4a93('0x22')]('onlineForm',JSON[_0x4a93('0x1b')](_0x41784c));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4a93('0x1b')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x4a93('0x3'),'type':_0x4a93('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x4a93('0x23')},'props':{'title':_0x4a93('0x23'),'helpText':_0x4a93('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x4a93('0x1f')]('offlineForm')?JSON[_0x4a93('0x20')](this[_0x4a93('0x1f')](_0x4a93('0x25'))):{};},'set':function(_0x510e50){return this[_0x4a93('0x22')](_0x4a93('0x25'),JSON[_0x4a93('0x1b')](_0x510e50));}},'token':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':function(){return rs[_0x4a93('0x26')]();}},'autoclose':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4a93('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x27')},'waitingMessage':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4a93('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4a93('0x1')]},'notificationTemplate':{'type':Sequelize[_0x4a93('0xf')],'defaultValue':function(){return _0x4a93('0x2b');}},'notificationSound':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x4a93('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4a93('0x1a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4a93('0x1a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x2d')},'messagesAlignment':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x2e')},'defaultTitle':{'type':Sequelize[_0x4a93('0x1')]},'customerAvatar':{'type':Sequelize[_0x4a93('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':_0x4a93('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4a93('0x1a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4a93('0x1a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':_0x4a93('0x30')},'systemAvatar':{'type':Sequelize[_0x4a93('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4a93('0x1a')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4a93('0x31'),'set':function(_0xd3c023){if(!_0xd3c023)this[_0x4a93('0x22')]('mandatoryDispositionPauseId',null);this[_0x4a93('0x22')](_0x4a93('0x32'),_0xd3c023);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4a93('0x1')]},'vidaooTopic':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':_0x4a93('0x33')},'vidaooNote':{'type':Sequelize[_0x4a93('0x1')],'defaultValue':function(){return _0x4a93('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x4a93('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4a93('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4a93('0xf')]}}; \ No newline at end of file +var _0x4a9d=['setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','ENUM','thumb','star','stringify','input','name','text','getDataValue','parse','onlineForm','Comments','Leave\x20your\x20comments','offlineForm'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0x4a9d,0x115));var _0xd4a9=function(_0x5ce15d,_0x57429f){_0x5ce15d=_0x5ce15d-0x0;var _0x4568c0=_0x4a9d[_0x5ce15d];return _0x4568c0;};'use strict';var Sequelize=require(_0xd4a9('0x0'));var rs=require(_0xd4a9('0x1'));module[_0xd4a9('0x2')]={'name':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'unique':_0xd4a9('0x4')},'description':{'type':Sequelize[_0xd4a9('0x3')]},'mapKey':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd4a9('0x5')},'key':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x6')},'customerAlias':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'defaultValue':_0xd4a9('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd4a9('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd4a9('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xd4a9('0x9')),'defaultValue':_0xd4a9('0xa')},'header_online':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0xb')},'start_chat_button':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0xc')},'offline_chat_button':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0xd')},'header_offline':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xd4a9('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd4a9('0x11')]},'closingQuestion':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd4a9('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x14')},'placeholderMessage':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x15')},'closingMessage':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xd4a9('0x16')]('star',_0xd4a9('0x17')),'defaultValue':_0xd4a9('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd4a9('0x11')],'defaultValue':function(){return JSON[_0xd4a9('0x19')]({'items':[{'type':_0xd4a9('0x1a'),'variable':null,'config':{'placeholder':_0xd4a9('0x1b'),'type':_0xd4a9('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xd4a9('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd4a9('0x1d')]('onlineForm')?JSON[_0xd4a9('0x1e')](this['getDataValue'](_0xd4a9('0x1f'))):{};},'set':function(_0x38c4fd){return this['setDataValue']('onlineForm',JSON[_0xd4a9('0x19')](_0x38c4fd));}},'offlineForm':{'type':Sequelize[_0xd4a9('0x11')],'defaultValue':function(){return JSON[_0xd4a9('0x19')]({'items':[{'type':_0xd4a9('0x1a'),'props':{'title':_0xd4a9('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd4a9('0x5'),'type':_0xd4a9('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xd4a9('0x20')},'props':{'title':'Comments','helpText':_0xd4a9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xd4a9('0x1d')](_0xd4a9('0x22'))?JSON[_0xd4a9('0x1e')](this[_0xd4a9('0x1d')](_0xd4a9('0x22'))):{};},'set':function(_0x3c9132){return this[_0xd4a9('0x23')]('offlineForm',JSON['stringify'](_0x3c9132));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd4a9('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd4a9('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x25')},'waitingMessage':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x27')},'sendUnmanaged':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd4a9('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd4a9('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd4a9('0x11')],'defaultValue':function(){return _0xd4a9('0x28');}},'notificationSound':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd4a9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd4a9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x2a')},'verticalAlignment':{'type':Sequelize[_0xd4a9('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x2b')},'messagesAlignment':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x2c')},'defaultTitle':{'type':Sequelize[_0xd4a9('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'defaultValue':_0xd4a9('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd4a9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':_0xd4a9('0x2e')},'systemAvatar':{'type':Sequelize[_0xd4a9('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd4a9('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![],'comment':_0xd4a9('0x30'),'set':function(_0x14d1fb){if(!_0x14d1fb)this[_0xd4a9('0x23')](_0xd4a9('0x31'),null);this['setDataValue']('mandatoryDisposition',_0x14d1fb);}},'vidaooEscalation':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd4a9('0x3')]},'vidaooTopic':{'type':Sequelize[_0xd4a9('0x3')],'allowNull':![],'defaultValue':_0xd4a9('0x32')},'vidaooNote':{'type':Sequelize[_0xd4a9('0x3')],'defaultValue':function(){return _0xd4a9('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xd4a9('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd4a9('0x10')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd4a9('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7f1b55e..4b3598e 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 _0x4a5a=['addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','html-to-text','jayson/promise','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','handleError','redis','defaults','localhost','socket.io-emitter','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','map','Interval','all','user-agent-parser','setUA','user-agent','getResult','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','model','%s\x20%s\x20%s','vendor','type','stringify','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','describe','ChatWebsiteId','Disposition','getDispositions','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','systemAvatar','file','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','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','List','DESC','Intervals','spread','list','applications','orderBy','Applications','priority','asc','account','Contacts','contact','headers','threadId','ChatInteraction','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','openNewInteraction','transaction','Attachment','findOne','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','Tags','color','tag','getProactiveActions','virtual','License','URL','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','replace','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','ChatApplication','bulkCreate','finally','getApplications','addProactiveActions','chatProactiveAction','online','false','items','fromKey','getOfflineMessages','Attachments'];(function(_0x24e18e,_0x52ce1b){var _0x35263a=function(_0x170d56){while(--_0x170d56){_0x24e18e['push'](_0x24e18e['shift']());}};_0x35263a(++_0x52ce1b);}(_0x4a5a,0x12f));var _0xa4a5=function(_0x1204dd,_0x30c6e0){_0x1204dd=_0x1204dd-0x0;var _0x482b6d=_0x4a5a[_0x1204dd];return _0x482b6d;};'use strict';var Mustache=require(_0xa4a5('0x0'));var util=require(_0xa4a5('0x1'));var path=require(_0xa4a5('0x2'));var ejs=require(_0xa4a5('0x3'));var fs=require('fs');var fs_extra=require(_0xa4a5('0x4'));var _=require(_0xa4a5('0x5'));var querystring=require('querystring');var htmlToText=require(_0xa4a5('0x6'));var Redis=require('ioredis');var jayson=require(_0xa4a5('0x7'));var url=require(_0xa4a5('0x8'));var qs=require(_0xa4a5('0x9'));var logger=require(_0xa4a5('0xa'))(_0xa4a5('0xb'));var config=require(_0xa4a5('0xc'));var APIOutOfIntervalError=require(_0xa4a5('0xd'))['APIOutOfIntervalError'];var APINotFoundError=require(_0xa4a5('0xd'))[_0xa4a5('0xe')];var APIHandleError=require('../../errors/api')[_0xa4a5('0xf')];var db=require('../../mysqldb')['db'];config[_0xa4a5('0x10')]=_[_0xa4a5('0x11')](config[_0xa4a5('0x10')],{'host':_0xa4a5('0x12'),'port':0x18eb});var socket=require(_0xa4a5('0x13'))(new Redis(config[_0xa4a5('0x10')]));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0xa4a5('0x14')][_0xa4a5('0x15')]({'port':0x232c});var client9002=jayson['client'][_0xa4a5('0x15')]({'port':0x232a});var client9003=jayson[_0xa4a5('0x14')][_0xa4a5('0x15')]({'port':0x232b});var client9001=jayson['client'][_0xa4a5('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x48944e,_0x4e679f,_0x188444,_0x490948){return new Promise(function(_0x5cd4bc,_0x1afc39){var _0x163907=_0x490948||client;return _0x163907['request'](_0x48944e,_0x188444)['then'](function(_0x32387e){logger['info'](_0xa4a5('0x16'),_0x4e679f,_0xa4a5('0x17'));logger[_0xa4a5('0x18')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4e679f,_0xa4a5('0x17'),JSON['stringify'](_0x32387e));if(_0x32387e[_0xa4a5('0x19')]){if(_0x32387e[_0xa4a5('0x19')]['code']===0x1f4){logger[_0xa4a5('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4e679f,_0x32387e[_0xa4a5('0x19')][_0xa4a5('0x1a')]);return _0x1afc39(_0x32387e[_0xa4a5('0x19')][_0xa4a5('0x1a')]);}logger[_0xa4a5('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4e679f,_0x32387e['error']['message']);return _0x5cd4bc(_0x32387e[_0xa4a5('0x19')]['message']);}else{logger['info'](_0xa4a5('0x16'),_0x4e679f,_0xa4a5('0x17'));_0x5cd4bc(_0x32387e[_0xa4a5('0x1b')]['message']);}})[_0xa4a5('0x1c')](function(_0x283428){logger[_0xa4a5('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4e679f,_0x283428);_0x1afc39(_0x283428);});});}function respondWithStatusCode(_0x42ecbe,_0x2e0301){_0x2e0301=_0x2e0301||0xcc;return function(_0x5e5009){if(_0x5e5009){return _0x42ecbe[_0xa4a5('0x1d')](_0x2e0301);}return _0x42ecbe[_0xa4a5('0x1e')](_0x2e0301)[_0xa4a5('0x1f')]();};}function respondWithResult(_0x538bac,_0x272e4e){_0x272e4e=_0x272e4e||0xc8;return function(_0x1e02c1){if(_0x1e02c1){return _0x538bac[_0xa4a5('0x1e')](_0x272e4e)['json'](_0x1e02c1);}};}function respondWithFilteredResult(_0x439243,_0x1d0d1d){return function(_0x5deb77){if(_0x5deb77){var _0x423189=typeof _0x1d0d1d[_0xa4a5('0x20')]===_0xa4a5('0x21')&&typeof _0x1d0d1d[_0xa4a5('0x22')]===_0xa4a5('0x21');var _0x1d7df8=_0x5deb77['count'];var _0x5c7357=_0x423189?0x0:_0x1d0d1d[_0xa4a5('0x20')];var _0x2c887f=_0x423189?_0x5deb77[_0xa4a5('0x23')]:_0x1d0d1d['offset']+_0x1d0d1d[_0xa4a5('0x22')];var _0x3aa9ed;if(_0x2c887f>=_0x1d7df8){_0x2c887f=_0x1d7df8;_0x3aa9ed=0xc8;}else{_0x3aa9ed=0xce;}_0x439243['status'](_0x3aa9ed);return _0x439243[_0xa4a5('0x24')]('Content-Range',_0x5c7357+'-'+_0x2c887f+'/'+_0x1d7df8)[_0xa4a5('0x25')](_0x5deb77);}return null;};}function saveUpdates(_0x475f8d){return function(_0x306b58){if(_0x306b58){return _0x306b58[_0xa4a5('0x26')](_0x475f8d)[_0xa4a5('0x27')](function(_0x68e4c3){return _0x68e4c3;});}return null;};}function removeEntity(_0x17448a){return function(_0x3bc3ad){if(_0x3bc3ad){return _0x3bc3ad[_0xa4a5('0x28')]()[_0xa4a5('0x27')](function(){var _0x5bda0a=_0x3bc3ad[_0xa4a5('0x29')]({'plain':!![]});var _0x20544d=_0xa4a5('0x2a');return db[_0xa4a5('0x2b')]['destroy']({'where':{'type':_0x20544d,'resourceId':_0x5bda0a['id']}})[_0xa4a5('0x27')](function(){return _0x3bc3ad;});})[_0xa4a5('0x27')](function(){_0x17448a[_0xa4a5('0x1e')](0xcc)[_0xa4a5('0x1f')]();});}};}function handleEntityNotFound(_0x41eaa2){return function(_0x305c73){if(!_0x305c73){_0x41eaa2[_0xa4a5('0x1d')](0x194);}return _0x305c73;};}function handleError(_0x4facda,_0x383396){_0x383396=_0x383396||0x1f4;return function(_0x45ec64){logger[_0xa4a5('0x19')](_0x45ec64[_0xa4a5('0x2c')]);if(_0x45ec64[_0xa4a5('0x2d')]){delete _0x45ec64[_0xa4a5('0x2d')];}_0x4facda[_0xa4a5('0x1e')](_0x383396)[_0xa4a5('0x2e')](_0x45ec64);};}function iftimePromise(_0x321ca6,_0x1677ac){return respondWithRpcPromise(_0xa4a5('0x2f'),_0xa4a5('0x30'),{'command':_0x1677ac[_0xa4a5('0x31')]?util['format'](_0xa4a5('0x32'),_0x321ca6[_0xa4a5('0x33')],_0x1677ac[_0xa4a5('0x31')]):util['format']('iftime\x20%s',_0x321ca6[_0xa4a5('0x33')])},client9002)[_0xa4a5('0x27')](function(_0x13f0e5){var _0x43b888=_0x13f0e5&&_0x13f0e5[_0xa4a5('0x34')](_0xa4a5('0x35'))>=0x0?!![]:![];logger[_0xa4a5('0x36')](_0xa4a5('0x37'),_0x1677ac['id'],_0x321ca6['id'],_0x321ca6[_0xa4a5('0x33')],_0x43b888?_0xa4a5('0x38'):_0xa4a5('0x39'),_0x1677ac[_0xa4a5('0x31')]?_0x1677ac['timezone']:'No\x20timezone');return _0x43b888;})['catch'](function(_0x4ff844){logger[_0xa4a5('0x19')](_0xa4a5('0x37'),_0x1677ac['id'],_0x321ca6['id'],_0x321ca6[_0xa4a5('0x33')],util[_0xa4a5('0x3a')](_0x4ff844,{'showHidden':![],'depth':null}),_0x1677ac[_0xa4a5('0x31')]?_0x1677ac[_0xa4a5('0x31')]:_0xa4a5('0x3b'));return![];});}function checkWebsiteIntervals(_0x1641e3){var _0x2a38fd=_[_0xa4a5('0x3c')](_0x1641e3[_0xa4a5('0x3d')]['Intervals'],function(_0xf6c31){var _0x14fcbb=_0xf6c31[_0xa4a5('0x29')]({'plain':!![]});return iftimePromise(_0x14fcbb,_0x1641e3);});return Promise[_0xa4a5('0x3e')](_0x2a38fd)[_0xa4a5('0x27')](function(_0x3a0dc7){return _['some'](_0x3a0dc7);});}function createInteractionObject(_0x41d178,_0x411c33,_0x43ba53,_0x3aecfa){var _0x15fc03=require(_0xa4a5('0x3f'));var _0x17a86d=new _0x15fc03();var _0x10ac15=_0x17a86d[_0xa4a5('0x40')](_0x43ba53[_0xa4a5('0x41')])[_0xa4a5('0x42')]();var _0x18ea4b=_0x411c33['customerIp'];if(_0x43ba53['cf-connecting-ip']){_0x18ea4b=_0x43ba53['cf-connecting-ip'];}else if(_0x43ba53[_0xa4a5('0x43')]){_0x18ea4b=_['first'](_0x43ba53['x-forwarded-for'][_0xa4a5('0x44')](','));}return{'ContactId':_0x3aecfa['id'],'ChatWebsiteId':_0x41d178,'from':(_0x3aecfa[_0xa4a5('0x45')]||'')+'\x20'+(_0x3aecfa[_0xa4a5('0x46')]||''),'customerIp':_0x18ea4b,'customerPort':_0x43ba53['x-real-port']?_0x43ba53[_0xa4a5('0x47')]:null,'referer':_0x411c33[_0xa4a5('0x48')],'browserName':_0x10ac15['browser'][_0xa4a5('0x2d')]&&_0x10ac15[_0xa4a5('0x49')]['version']?util[_0xa4a5('0x4a')](_0xa4a5('0x4b'),_0x10ac15['browser'][_0xa4a5('0x2d')],_0x10ac15[_0xa4a5('0x49')][_0xa4a5('0x4c')]):_0xa4a5('0x4d'),'browserVersion':_0x10ac15[_0xa4a5('0x49')][_0xa4a5('0x4c')]||_0xa4a5('0x4d'),'osName':util[_0xa4a5('0x4a')](_0xa4a5('0x4b'),_0x10ac15['os']['name'],_0x10ac15['os']['version']),'osVersion':_0x10ac15['os']['version'],'deviceModel':_0x10ac15[_0xa4a5('0x4e')][_0xa4a5('0x4f')]&&_0x10ac15['device']['vendor']?util[_0xa4a5('0x4a')](_0xa4a5('0x50'),_0x10ac15[_0xa4a5('0x4e')]['model'],_0x10ac15[_0xa4a5('0x4e')][_0xa4a5('0x51')],_0x10ac15['device'][_0xa4a5('0x52')]):null,'deviceVendor':_0x10ac15[_0xa4a5('0x4e')]['vendor'],'deviceType':_0x10ac15[_0xa4a5('0x4e')][_0xa4a5('0x52')],'formData':JSON[_0xa4a5('0x53')](_0x411c33)};}exports[_0xa4a5('0x54')]=function(_0x2460f3,_0x4613b4){var _0xb381ff={'include':[{'model':db[_0xa4a5('0x55')],'as':_0xa4a5('0x56')}]},_0x48aa89={},_0x6f47c9={'count':0x0,'rows':[]};var _0x8e41be=_['map'](db[_0xa4a5('0x57')][_0xa4a5('0x58')],function(_0x56fb51){return{'name':_0x56fb51[_0xa4a5('0x59')],'type':_0x56fb51[_0xa4a5('0x52')][_0xa4a5('0x5a')]};});_0x48aa89[_0xa4a5('0x4f')]=_[_0xa4a5('0x3c')](_0x8e41be,'name');_0x48aa89['query']=_[_0xa4a5('0x5b')](_0x2460f3['query']);_0x48aa89[_0xa4a5('0x5c')]=_[_0xa4a5('0x5d')](_0x48aa89[_0xa4a5('0x4f')],_0x48aa89['query']);_0xb381ff[_0xa4a5('0x5e')]=_[_0xa4a5('0x5d')](_0x48aa89[_0xa4a5('0x4f')],qs[_0xa4a5('0x5f')](_0x2460f3[_0xa4a5('0x60')][_0xa4a5('0x5f')]));_0xb381ff[_0xa4a5('0x5e')]=_0xb381ff[_0xa4a5('0x5e')][_0xa4a5('0x61')]?_0xb381ff[_0xa4a5('0x5e')]:_0x48aa89[_0xa4a5('0x4f')];if(!_0x2460f3['query'][_0xa4a5('0x62')]('nolimit')){_0xb381ff['limit']=qs['limit'](_0x2460f3[_0xa4a5('0x60')][_0xa4a5('0x22')]);_0xb381ff[_0xa4a5('0x20')]=qs['offset'](_0x2460f3['query']['offset']);}_0xb381ff[_0xa4a5('0x63')]=qs[_0xa4a5('0x64')](_0x2460f3[_0xa4a5('0x60')][_0xa4a5('0x64')]);_0xb381ff[_0xa4a5('0x65')]=qs['filters'](_[_0xa4a5('0x66')](_0x2460f3['query'],_0x48aa89[_0xa4a5('0x5c')]),_0x8e41be);if(_0x2460f3['query'][_0xa4a5('0x67')]){_0xb381ff[_0xa4a5('0x65')]=_[_0xa4a5('0x68')](_0xb381ff['where'],{'$or':_[_0xa4a5('0x3c')](_0x8e41be,function(_0x2696a3){if(_0x2696a3['type']!==_0xa4a5('0x69')){var _0x3accce={};_0x3accce[_0x2696a3['name']]={'$like':'%'+_0x2460f3['query'][_0xa4a5('0x67')]+'%'};return _0x3accce;}})});}_0xb381ff=_[_0xa4a5('0x68')]({},_0xb381ff,_0x2460f3[_0xa4a5('0x6a')]);var _0x326388={'where':_0xb381ff[_0xa4a5('0x65')]};return db[_0xa4a5('0x57')][_0xa4a5('0x23')](_0x326388)[_0xa4a5('0x27')](function(_0x5e0006){_0x6f47c9[_0xa4a5('0x23')]=_0x5e0006;if(_0x2460f3[_0xa4a5('0x60')]['includeAll']){_0xb381ff['include']=[{'all':!![]}];}return db[_0xa4a5('0x57')][_0xa4a5('0x6b')](_0xb381ff);})[_0xa4a5('0x27')](function(_0x178b68){_0x6f47c9[_0xa4a5('0x6c')]=_0x178b68;return _0x6f47c9;})[_0xa4a5('0x27')](respondWithFilteredResult(_0x4613b4,_0xb381ff))[_0xa4a5('0x1c')](handleError(_0x4613b4,null));};exports['show']=function(_0x176397,_0x112fea){var _0x5539d4={'raw':![],'where':{'id':_0x176397[_0xa4a5('0x6d')]['id']},'include':[{'model':db[_0xa4a5('0x55')],'as':_0xa4a5('0x56')}]},_0x31eb7b={};_0x31eb7b[_0xa4a5('0x4f')]=_[_0xa4a5('0x5b')](db['ChatWebsite'][_0xa4a5('0x58')]);_0x31eb7b[_0xa4a5('0x60')]=_[_0xa4a5('0x5b')](_0x176397[_0xa4a5('0x60')]);_0x31eb7b['filters']=_[_0xa4a5('0x5d')](_0x31eb7b['model'],_0x31eb7b[_0xa4a5('0x60')]);_0x5539d4['attributes']=_['intersection'](_0x31eb7b[_0xa4a5('0x4f')],qs['fields'](_0x176397['query'][_0xa4a5('0x5f')]));_0x5539d4[_0xa4a5('0x5e')]=_0x5539d4['attributes']['length']?_0x5539d4[_0xa4a5('0x5e')]:_0x31eb7b[_0xa4a5('0x4f')];if(_0x176397['query'][_0xa4a5('0x6e')]){_0x5539d4[_0xa4a5('0x6f')]=[{'all':!![]}];}_0x5539d4=_[_0xa4a5('0x68')]({},_0x5539d4,_0x176397[_0xa4a5('0x6a')]);return db[_0xa4a5('0x57')][_0xa4a5('0x70')](_0x5539d4)[_0xa4a5('0x27')](handleEntityNotFound(_0x112fea,null))[_0xa4a5('0x27')](respondWithResult(_0x112fea,null))[_0xa4a5('0x1c')](handleError(_0x112fea,null));};exports[_0xa4a5('0x71')]=function(_0xd9687d,_0x18b396){return db['ChatWebsite'][_0xa4a5('0x71')](_0xd9687d[_0xa4a5('0x72')],{})[_0xa4a5('0x27')](function(_0x2996db){var _0x5bfba6=_0xd9687d[_0xa4a5('0x73')][_0xa4a5('0x29')]({'plain':!![]});if(!_0x5bfba6)throw new Error(_0xa4a5('0x74'));if(_0x5bfba6[_0xa4a5('0x75')]===_0xa4a5('0x73')){var _0x3e78bb=_0x2996db[_0xa4a5('0x29')]({'plain':!![]});var _0x188343='ChatWebsites';return db['UserProfileSection'][_0xa4a5('0x70')]({'where':{'name':_0x188343,'userProfileId':_0x5bfba6[_0xa4a5('0x76')]},'raw':!![]})[_0xa4a5('0x27')](function(_0xb3b114){if(_0xb3b114&&_0xb3b114['autoAssociation']===0x0){return db['UserProfileResource'][_0xa4a5('0x71')]({'name':_0x3e78bb[_0xa4a5('0x2d')],'resourceId':_0x3e78bb['id'],'type':_0xb3b114['name'],'sectionId':_0xb3b114['id']},{})['then'](function(){return _0x2996db;});}else{return _0x2996db;}})[_0xa4a5('0x1c')](function(_0x164257){logger[_0xa4a5('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x164257);throw _0x164257;});}return _0x2996db;})['then'](respondWithResult(_0x18b396,0xc9))[_0xa4a5('0x1c')](handleError(_0x18b396,null));};exports[_0xa4a5('0x26')]=function(_0x8016f7,_0x43c8c7){if(_0x8016f7[_0xa4a5('0x72')]['id']){delete _0x8016f7[_0xa4a5('0x72')]['id'];}return db['ChatWebsite'][_0xa4a5('0x70')]({'where':{'id':_0x8016f7['params']['id']},'include':[{'model':db[_0xa4a5('0x55')],'as':_0xa4a5('0x56')}]})[_0xa4a5('0x27')](handleEntityNotFound(_0x43c8c7,null))[_0xa4a5('0x27')](saveUpdates(_0x8016f7[_0xa4a5('0x72')],null))[_0xa4a5('0x27')](respondWithResult(_0x43c8c7,null))['catch'](handleError(_0x43c8c7,null));};exports[_0xa4a5('0x28')]=function(_0x2ff662,_0x5aee3a){return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x2ff662['params']['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x5aee3a,null))[_0xa4a5('0x27')](removeEntity(_0x5aee3a,null))[_0xa4a5('0x1c')](handleError(_0x5aee3a,null));};exports['describe']=function(_0x44631a,_0xe52a94){return db['ChatWebsite'][_0xa4a5('0x77')]()[_0xa4a5('0x27')](respondWithResult(_0xe52a94,null))[_0xa4a5('0x1c')](handleError(_0xe52a94,null));};exports['addDisposition']=function(_0x2d98fd,_0x17eb88){if(_0x2d98fd['body']['id']){delete _0x2d98fd[_0xa4a5('0x72')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2d98fd[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x17eb88,null))[_0xa4a5('0x27')](function(_0x3727f8){if(_0x3727f8){_0x2d98fd[_0xa4a5('0x72')][_0xa4a5('0x78')]=_0x3727f8['id'];return db[_0xa4a5('0x79')][_0xa4a5('0x71')](_0x2d98fd[_0xa4a5('0x72')]);}})[_0xa4a5('0x27')](respondWithResult(_0x17eb88,null))[_0xa4a5('0x1c')](handleError(_0x17eb88,null));};exports[_0xa4a5('0x7a')]=function(_0x902ae,_0x557484){var _0x27a34a={'raw':![],'where':{}};var _0x52e0b1={};var _0x15fcd4={'count':0x0,'rows':[]};return db[_0xa4a5('0x57')]['findOne']({'where':{'id':_0x902ae[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x557484,null))['then'](function(_0x4ef480){if(_0x4ef480){_0x52e0b1[_0xa4a5('0x4f')]=_[_0xa4a5('0x5b')](db[_0xa4a5('0x79')][_0xa4a5('0x58')]);_0x52e0b1['query']=_['keys'](_0x902ae['query']);_0x52e0b1[_0xa4a5('0x5c')]=_['intersection'](_0x52e0b1[_0xa4a5('0x4f')],_0x52e0b1[_0xa4a5('0x60')]);_0x27a34a[_0xa4a5('0x5e')]=_[_0xa4a5('0x5d')](_0x52e0b1[_0xa4a5('0x4f')],qs[_0xa4a5('0x5f')](_0x902ae['query'][_0xa4a5('0x5f')]));_0x27a34a[_0xa4a5('0x5e')]=_0x27a34a[_0xa4a5('0x5e')]['length']?_0x27a34a[_0xa4a5('0x5e')]:_0x52e0b1[_0xa4a5('0x4f')];if(!_0x902ae[_0xa4a5('0x60')][_0xa4a5('0x62')](_0xa4a5('0x7b'))){_0x27a34a[_0xa4a5('0x22')]=qs[_0xa4a5('0x22')](_0x902ae[_0xa4a5('0x60')][_0xa4a5('0x22')]);_0x27a34a['offset']=qs[_0xa4a5('0x20')](_0x902ae['query'][_0xa4a5('0x20')]);}_0x27a34a['order']=qs[_0xa4a5('0x64')](_0x902ae[_0xa4a5('0x60')][_0xa4a5('0x64')]);_0x27a34a[_0xa4a5('0x65')]=qs['filters'](_[_0xa4a5('0x66')](_0x902ae[_0xa4a5('0x60')],_0x52e0b1[_0xa4a5('0x5c')]));_0x27a34a[_0xa4a5('0x65')][_0xa4a5('0x78')]=_0x4ef480['id'];if(_0x902ae[_0xa4a5('0x60')][_0xa4a5('0x67')]){_0x27a34a[_0xa4a5('0x65')]=_[_0xa4a5('0x68')](_0x27a34a[_0xa4a5('0x65')],{'$or':_[_0xa4a5('0x3c')](_0x27a34a[_0xa4a5('0x5e')],function(_0x4f50eb){var _0x1d0e64={};_0x1d0e64[_0x4f50eb]={'$like':'%'+_0x902ae[_0xa4a5('0x60')][_0xa4a5('0x67')]+'%'};return _0x1d0e64;})});}_0x27a34a=_[_0xa4a5('0x68')]({},_0x27a34a,_0x902ae[_0xa4a5('0x6a')]);return db['Disposition'][_0xa4a5('0x23')]({'where':_0x27a34a[_0xa4a5('0x65')]})[_0xa4a5('0x27')](function(_0x48aaaf){_0x15fcd4[_0xa4a5('0x23')]=_0x48aaaf;if(_0x902ae[_0xa4a5('0x60')]['includeAll']){_0x27a34a['include']=[{'all':!![]}];}return db[_0xa4a5('0x79')][_0xa4a5('0x6b')](_0x27a34a);})['then'](function(_0xac1aa3){_0x15fcd4[_0xa4a5('0x6c')]=_0xac1aa3;return _0x15fcd4;});}})[_0xa4a5('0x27')](respondWithFilteredResult(_0x557484,_0x27a34a))[_0xa4a5('0x1c')](handleError(_0x557484,null));};exports['removeDispositions']=function(_0xd91077,_0x4ffe55){return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0xd91077[_0xa4a5('0x6d')]['id']}})['then'](handleEntityNotFound(_0x4ffe55,null))[_0xa4a5('0x27')](function(_0x35e77e){if(_0x35e77e){return _0x35e77e[_0xa4a5('0x7c')](_0xd91077[_0xa4a5('0x60')][_0xa4a5('0x7d')]);}})[_0xa4a5('0x27')](respondWithStatusCode(_0x4ffe55,null))['catch'](handleError(_0x4ffe55,null));};exports['addAnswer']=function(_0x4cfc5a,_0x468f70){if(_0x4cfc5a[_0xa4a5('0x72')]['id']){delete _0x4cfc5a[_0xa4a5('0x72')]['id'];}return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x4cfc5a[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x468f70,null))['then'](function(_0xd4cad1){if(_0xd4cad1){_0x4cfc5a[_0xa4a5('0x72')][_0xa4a5('0x78')]=_0xd4cad1['id'];return db[_0xa4a5('0x7e')][_0xa4a5('0x71')](_0x4cfc5a[_0xa4a5('0x72')]);}})['then'](respondWithResult(_0x468f70,null))['catch'](handleError(_0x468f70,null));};exports[_0xa4a5('0x7f')]=function(_0x563947,_0x2d8f0c){var _0x153385={'raw':![],'where':{}};var _0x532332={};var _0x1ae6d8={'count':0x0,'rows':[]};return db[_0xa4a5('0x57')]['findOne']({'where':{'id':_0x563947[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x2d8f0c,null))[_0xa4a5('0x27')](function(_0x9a3be){if(_0x9a3be){_0x532332[_0xa4a5('0x4f')]=_[_0xa4a5('0x5b')](db['CannedAnswer'][_0xa4a5('0x58')]);_0x532332['query']=_[_0xa4a5('0x5b')](_0x563947['query']);_0x532332['filters']=_[_0xa4a5('0x5d')](_0x532332[_0xa4a5('0x4f')],_0x532332['query']);_0x153385[_0xa4a5('0x5e')]=_[_0xa4a5('0x5d')](_0x532332[_0xa4a5('0x4f')],qs[_0xa4a5('0x5f')](_0x563947['query'][_0xa4a5('0x5f')]));_0x153385[_0xa4a5('0x5e')]=_0x153385[_0xa4a5('0x5e')]['length']?_0x153385[_0xa4a5('0x5e')]:_0x532332[_0xa4a5('0x4f')];if(!_0x563947[_0xa4a5('0x60')]['hasOwnProperty'](_0xa4a5('0x7b'))){_0x153385[_0xa4a5('0x22')]=qs[_0xa4a5('0x22')](_0x563947['query'][_0xa4a5('0x22')]);_0x153385[_0xa4a5('0x20')]=qs[_0xa4a5('0x20')](_0x563947[_0xa4a5('0x60')][_0xa4a5('0x20')]);}_0x153385[_0xa4a5('0x63')]=qs[_0xa4a5('0x64')](_0x563947[_0xa4a5('0x60')][_0xa4a5('0x64')]);_0x153385[_0xa4a5('0x65')]=qs['filters'](_[_0xa4a5('0x66')](_0x563947['query'],_0x532332[_0xa4a5('0x5c')]));_0x153385[_0xa4a5('0x65')][_0xa4a5('0x78')]=_0x9a3be['id'];if(_0x563947[_0xa4a5('0x60')][_0xa4a5('0x67')]){_0x153385[_0xa4a5('0x65')]=_['merge'](_0x153385[_0xa4a5('0x65')],{'$or':_[_0xa4a5('0x3c')](_0x153385[_0xa4a5('0x5e')],function(_0x3a273e){var _0x526624={};_0x526624[_0x3a273e]={'$like':'%'+_0x563947[_0xa4a5('0x60')][_0xa4a5('0x67')]+'%'};return _0x526624;})});}_0x153385=_['merge']({},_0x153385,_0x563947['options']);return db[_0xa4a5('0x7e')][_0xa4a5('0x23')]({'where':_0x153385[_0xa4a5('0x65')]})[_0xa4a5('0x27')](function(_0x52f0c1){_0x1ae6d8[_0xa4a5('0x23')]=_0x52f0c1;if(_0x563947[_0xa4a5('0x60')]['includeAll']){_0x153385[_0xa4a5('0x6f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa4a5('0x6b')](_0x153385);})[_0xa4a5('0x27')](function(_0x31b915){_0x1ae6d8['rows']=_0x31b915;return _0x1ae6d8;});}})['then'](respondWithFilteredResult(_0x2d8f0c,_0x153385))['catch'](handleError(_0x2d8f0c,null));};exports[_0xa4a5('0x80')]=function(_0x35aa50,_0x4ff4bd){return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x35aa50[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x4ff4bd,null))[_0xa4a5('0x27')](function(_0x55b408){if(_0x55b408){return _0x55b408[_0xa4a5('0x80')](_0x35aa50[_0xa4a5('0x60')]['ids']);}})[_0xa4a5('0x27')](respondWithStatusCode(_0x4ff4bd,null))[_0xa4a5('0x1c')](handleError(_0x4ff4bd,null));};exports['addLogo']=function(_0x37203a,_0x5803cc){_0x37203a[_0xa4a5('0x72')][_0xa4a5('0x81')]=_0x37203a['file'][_0xa4a5('0x82')];return db[_0xa4a5('0x57')]['find']({'where':{'id':_0x37203a[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x5803cc,null))[_0xa4a5('0x27')](saveUpdates(_0x37203a[_0xa4a5('0x72')],null))[_0xa4a5('0x27')](respondWithResult(_0x5803cc,null))['catch'](handleError(_0x5803cc,null));};exports[_0xa4a5('0x83')]=function(_0x33ba91,_0x14022c){_0x33ba91['body'][_0xa4a5('0x84')]=_0x33ba91['file']['filename'];return db['ChatWebsite'][_0xa4a5('0x70')]({'where':{'id':_0x33ba91['params']['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x14022c,null))[_0xa4a5('0x27')](saveUpdates(_0x33ba91[_0xa4a5('0x72')],null))[_0xa4a5('0x27')](respondWithResult(_0x14022c,null))[_0xa4a5('0x1c')](handleError(_0x14022c,null));};exports[_0xa4a5('0x85')]=function(_0x1360c6,_0x6c00cc){_0x1360c6[_0xa4a5('0x72')]['customerAvatar']=_0x1360c6['file'][_0xa4a5('0x82')];return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x1360c6['params']['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x6c00cc,null))[_0xa4a5('0x27')](saveUpdates(_0x1360c6[_0xa4a5('0x72')],null))[_0xa4a5('0x27')](respondWithResult(_0x6c00cc,null))[_0xa4a5('0x1c')](handleError(_0x6c00cc,null));};exports['addSystemAvatar']=function(_0x1d774f,_0xd02afc){_0x1d774f[_0xa4a5('0x72')][_0xa4a5('0x86')]=_0x1d774f[_0xa4a5('0x87')][_0xa4a5('0x82')];return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x1d774f['params']['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0xd02afc,null))[_0xa4a5('0x27')](saveUpdates(_0x1d774f[_0xa4a5('0x72')],null))[_0xa4a5('0x27')](respondWithResult(_0xd02afc,null))[_0xa4a5('0x1c')](handleError(_0xd02afc,null));};exports['getLogo']=function(_0x39c9b1,_0x291608){var _0xe2e176=path[_0xa4a5('0x88')](config['root'],_0xa4a5('0x89'));var _0x155408={'where':{'id':_0x39c9b1[_0xa4a5('0x6d')]['id']},'attributes':['id',_0xa4a5('0x81')],'raw':!![]};var _0x3b7c85=![];return require(_0xa4a5('0x8a'))[_0xa4a5('0x8b')]()[_0xa4a5('0x27')](function(_0x3fca8b){if(_0x3fca8b){_0x3b7c85=_0x3fca8b[_0xa4a5('0x8c')];}})['then'](function(){return db[_0xa4a5('0x57')][_0xa4a5('0x70')](_0x155408);})['then'](handleEntityNotFound(_0x291608,null))[_0xa4a5('0x27')](function(_0x98b92b){if(_0x98b92b){if(!_['isNil'](_0x98b92b['sitepic'])){if(fs[_0xa4a5('0x8d')](path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],'server/files/images/logos/',_0x98b92b['sitepic']))&&_0x3b7c85){_0xe2e176=path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],_0xa4a5('0x8f'),_0x98b92b[_0xa4a5('0x81')]);}}return _0x291608['download'](_0xe2e176);}})[_0xa4a5('0x1c')](handleError(_0x291608,null));};exports[_0xa4a5('0x90')]=function(_0x160975,_0x278dd8){var _0x3bd042=path['join'](config[_0xa4a5('0x8e')],_0xa4a5('0x91'));var _0x26b2f6={'where':{'id':_0x160975['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa4a5('0x57')][_0xa4a5('0x70')](_0x26b2f6)[_0xa4a5('0x27')](handleEntityNotFound(_0x278dd8,null))[_0xa4a5('0x27')](function(_0x35c09f){if(_0x35c09f){if(!_[_0xa4a5('0x92')](_0x35c09f[_0xa4a5('0x84')])){if(fs[_0xa4a5('0x8d')](path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],_0xa4a5('0x93'),_0x35c09f[_0xa4a5('0x84')]))){_0x3bd042=path['join'](config['root'],'server/files/images/avatars/',_0x35c09f[_0xa4a5('0x84')]);}}return _0x278dd8[_0xa4a5('0x94')](_0x3bd042);}})['catch'](handleError(_0x278dd8,null));};exports[_0xa4a5('0x95')]=function(_0xade522,_0x2c07a7){var _0x12080c=path['join'](config['root'],_0xa4a5('0x96'));var _0x2f9d68={'where':{'id':_0xade522['params']['id']},'attributes':['id',_0xa4a5('0x97'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xa4a5('0x70')](_0x2f9d68)[_0xa4a5('0x27')](handleEntityNotFound(_0x2c07a7,null))[_0xa4a5('0x27')](function(_0xa2ba5){if(_0xa2ba5){if(!_[_0xa4a5('0x92')](_0xa2ba5[_0xa4a5('0x97')])){if(fs['existsSync'](path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],_0xa4a5('0x93'),_0xa2ba5[_0xa4a5('0x97')]))&&_0xa2ba5['showCustomerAvatar']){_0x12080c=path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],'server/files/images/avatars/',_0xa2ba5[_0xa4a5('0x97')]);}}return _0x2c07a7[_0xa4a5('0x94')](_0x12080c);}})[_0xa4a5('0x1c')](handleError(_0x2c07a7,null));};exports[_0xa4a5('0x98')]=function(_0x415331,_0x10a2fd){var _0x512272=path[_0xa4a5('0x88')](config['root'],_0xa4a5('0x99'));var _0xbe88d3={'where':{'id':_0x415331[_0xa4a5('0x6d')]['id']},'attributes':['id',_0xa4a5('0x86')],'raw':!![]};return db['ChatWebsite']['find'](_0xbe88d3)['then'](handleEntityNotFound(_0x10a2fd,null))[_0xa4a5('0x27')](function(_0x301217){if(_0x301217){if(!_[_0xa4a5('0x92')](_0x301217[_0xa4a5('0x86')])){if(fs[_0xa4a5('0x8d')](path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],'server/files/images/avatars/',_0x301217[_0xa4a5('0x86')]))){_0x512272=path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],_0xa4a5('0x93'),_0x301217[_0xa4a5('0x86')]);}}return _0x10a2fd['download'](_0x512272);}})['catch'](handleError(_0x10a2fd,null));};exports[_0xa4a5('0x9a')]=function(_0x5375e9,_0xec46fb){var _0x234cbe={'body':_0x5375e9['body'],'channel':_0xa4a5('0x9b')};var _0x3cc69b=[];var _0x3454a3=[];var _0x29de26={};var _0x32719f=![];return db[_0xa4a5('0x9c')][_0xa4a5('0x77')]()['then'](function(_0x2b4c32){if(!_0x2b4c32){throw new db['Sequelize'][(_0xa4a5('0x9d'))](_0xa4a5('0x9e'));}_0x3cc69b=_[_0xa4a5('0x9f')](_[_0xa4a5('0x5b')](_0x2b4c32),['createdAt',_0xa4a5('0xa0')]);_0x3454a3=_[_0xa4a5('0x9f')](_['keys'](_0x2b4c32),[_0xa4a5('0xa1'),'updatedAt',_0xa4a5('0xa2'),_0xa4a5('0xa3')]);if(_0x5375e9[_0xa4a5('0x72')]['id']){delete _0x5375e9[_0xa4a5('0x72')]['id'];}if(_[_0xa4a5('0x92')](_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xa4')])){throw new db[(_0xa4a5('0xa5'))][(_0xa4a5('0x9d'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0x72')])||_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0x72')]===''){throw new db[(_0xa4a5('0xa5'))][(_0xa4a5('0x9d'))](_0xa4a5('0xa6'));}if(_['isNil'](_0x5375e9['body']['mapKey'])){throw new db['Sequelize'][(_0xa4a5('0x9d'))](_0xa4a5('0xa7')+_0x3454a3);}if(!_[_0xa4a5('0xa8')](_0x3454a3,_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xa9')])){throw new db['Sequelize']['ValidationError'](_0xa4a5('0xaa')+_0x3454a3);}_0x29de26[_0x5375e9['body'][_0xa4a5('0xa9')]]=_0x5375e9[_0xa4a5('0x72')]['from'];})['then'](function(){return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x5375e9[_0xa4a5('0x6d')]['id']},'include':[{'model':db['CmList'],'as':_0xa4a5('0xab'),'include':[{'model':db[_0xa4a5('0x9c')],'as':'Contacts','where':_0x29de26,'limit':0x1,'order':[['updatedAt',_0xa4a5('0xac')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db[_0xa4a5('0x3d')],'as':_0xa4a5('0x3d'),'include':[{'model':db[_0xa4a5('0x3d')],'as':_0xa4a5('0xad'),'attributes':['id',_0xa4a5('0x33')],'raw':!![]}]}]});})[_0xa4a5('0x27')](function(_0x40b617){if(!_0x40b617)throw new APINotFoundError(util[_0xa4a5('0x4a')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x5375e9['params']['id']));if(!_0x40b617[_0xa4a5('0x3d')]||!_0x40b617[_0xa4a5('0x3d')]['Intervals'])return[_0x40b617,!![]];return[_0x40b617,checkWebsiteIntervals(_0x40b617)];})[_0xa4a5('0xae')](function(_0x5148c7,_0xd42e9a){if(!_0xd42e9a)throw new APIOutOfIntervalError();if(!_0x5148c7[_0xa4a5('0xab')])return;_0x234cbe['account']=_0x5148c7;_0x234cbe[_0xa4a5('0xaf')]=_0x5148c7[_0xa4a5('0xab')];_0x234cbe[_0xa4a5('0xb0')]=_[_0xa4a5('0xb1')](_0x5148c7[_0xa4a5('0xb2')],[_0xa4a5('0xb3')],[_0xa4a5('0xb4')]);if(_0x234cbe[_0xa4a5('0xb5')][_0xa4a5('0xb2')]){delete _0x234cbe[_0xa4a5('0xb5')][_0xa4a5('0xb2')];}if(_0x234cbe['account'][_0xa4a5('0xab')]&&_0x234cbe[_0xa4a5('0xb5')]['List'][_0xa4a5('0xb6')][_0xa4a5('0x61')]){return _0x234cbe[_0xa4a5('0xb5')][_0xa4a5('0xab')][_0xa4a5('0xb6')][0x0];}var _0x57122c=_[_0xa4a5('0x11')](_0x5375e9[_0xa4a5('0x72')],{'firstName':_0x5375e9[_0xa4a5('0x72')]['from'],'ListId':_0x5148c7[_0xa4a5('0xa3')]});_0x57122c[_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xa9')]]=_0x5375e9[_0xa4a5('0x72')]['from'];return db[_0xa4a5('0x9c')][_0xa4a5('0x71')](_0x57122c,{'fields':_0x3cc69b,'raw':!![]});})[_0xa4a5('0x27')](function(_0x3b93a0){_0x234cbe[_0xa4a5('0xb7')]=_0x3b93a0;var _0x331722=createInteractionObject(_0x5375e9[_0xa4a5('0x6d')]['id'],_0x5375e9[_0xa4a5('0x72')],_0x5375e9[_0xa4a5('0xb8')],_0x3b93a0);var _0x16e72d={'ChatWebsiteId':_0x5375e9[_0xa4a5('0x6d')]['id'],'closed':![]};if(_0x5375e9[_0xa4a5('0x72')]['threadId']){_0x16e72d[_0xa4a5('0xb9')]=_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xb9')];return db['ChatInteraction'][_0xa4a5('0x70')]({'where':_0x16e72d})[_0xa4a5('0x27')](function(_0x5065b7){if(_0x5065b7){_0x32719f=!![];return _0x5065b7;}_0x331722[_0xa4a5('0xb9')]=_0x5375e9[_0xa4a5('0x72')]['threadId'];_0x331722['externalUrl']=_0x5375e9[_0xa4a5('0x72')]['externalUrl'];return db[_0xa4a5('0xba')][_0xa4a5('0x71')](_0x331722);});}_0x16e72d[_0xa4a5('0xbb')]=_0x3b93a0['id'];if(_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xbc')]&&_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xbc')]['id']){_0x16e72d['id']=_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xbc')]['id'];return db['ChatInteraction'][_0xa4a5('0x70')]({'where':_0x16e72d})[_0xa4a5('0x27')](function(_0x336530){if(_0x336530){_0x32719f=!![];return _0x336530;}return db[_0xa4a5('0xba')][_0xa4a5('0x71')](_0x331722);});}return db[_0xa4a5('0xba')][_0xa4a5('0x71')](_0x331722);})[_0xa4a5('0x27')](function(_0x1d2da0){if(!_0x32719f)return _0x1d2da0;var _0x4de047={'from':(_0x234cbe[_0xa4a5('0xb7')][_0xa4a5('0x45')]||'')+'\x20'+(_0x234cbe[_0xa4a5('0xb7')][_0xa4a5('0x46')]||'')};if(_0x5375e9[_0xa4a5('0x72')]['threadId']&&_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xbd')]&&_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xb9')]!=_0x5375e9[_0xa4a5('0x72')]['messageId']){_0x4de047[_0xa4a5('0xb9')]=_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0xbd')];}return _0x1d2da0['update'](_0x4de047);})[_0xa4a5('0x27')](function(_0x1e3de2){_0x234cbe[_0xa4a5('0xbc')]=_0x1e3de2[_0xa4a5('0x29')]({'plain':!![]});_0x234cbe[_0xa4a5('0xbc')][_0xa4a5('0xbe')]=!_0x32719f;if(_0x234cbe['interaction'][_0xa4a5('0xbe')]){if(_0x234cbe[_0xa4a5('0xb5')][_0xa4a5('0xbf')]){_0x234cbe[_0xa4a5('0xb0')][_0xa4a5('0xc0')]({'id':0x0,'priority':_0x234cbe[_0xa4a5('0xb0')][_0xa4a5('0x61')]+0x1,'app':_0xa4a5('0xc1'),'appdata':_0xa4a5('0xc2'),'interval':_0xa4a5('0xc3')});}}return db[_0xa4a5('0xc4')][_0xa4a5('0x71')]({'body':_0x5375e9[_0xa4a5('0x72')][_0xa4a5('0x72')],'ChatWebsiteId':_0x5375e9[_0xa4a5('0x6d')]['id'],'ChatInteractionId':_0x1e3de2['id'],'direction':'in','ContactId':_0x234cbe[_0xa4a5('0xb7')]['id'],'AttachmentId':_0x5375e9['body']['AttachmentId']});})[_0xa4a5('0x27')](function(_0xcc5246){_0x234cbe[_0xa4a5('0x1a')]=_0xcc5246;if(!_0x234cbe[_0xa4a5('0xbc')][_0xa4a5('0xc5')]){return;}return db[_0xa4a5('0xc6')][_0xa4a5('0x70')]({'attributes':['id',_0xa4a5('0x2d')],'where':{'id':_0x234cbe[_0xa4a5('0xbc')][_0xa4a5('0xc5')]}});})[_0xa4a5('0x27')](function(_0x1636bf){if(_0x1636bf){_0x234cbe[_0xa4a5('0xb0')][_0xa4a5('0xc7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1636bf['name']+','+(_0x234cbe[_0xa4a5('0xb5')][_0xa4a5('0xc8')]||0xa),'interval':_0xa4a5('0xc3')});_0x234cbe[_0xa4a5('0xc9')]=!![];}if(!_0x234cbe[_0xa4a5('0xbc')][_0xa4a5('0xca')]){return;}return db[_0xa4a5('0xcb')]['find']({'attributes':['id',_0xa4a5('0x2d')],'where':{'id':_0x234cbe[_0xa4a5('0xbc')][_0xa4a5('0xca')]}});})[_0xa4a5('0x27')](function(_0xdd7647){if(_0xdd7647){_0x234cbe[_0xa4a5('0xb0')][_0xa4a5('0xc7')]({'id':0x0,'priority':0x1,'app':_0xa4a5('0xcc'),'appdata':_0xdd7647[_0xa4a5('0x2d')]+','+(_0x234cbe['account'][_0xa4a5('0xcd')]||0x12c),'interval':_0xa4a5('0xc3')});}return respondWithRpcPromise(_0xa4a5('0xce'),'startRouting',_0x234cbe);})[_0xa4a5('0x27')](function(_0x2a4d31){respondWithRpcPromise(_0xa4a5('0xcf'),_0xa4a5('0xcf'),{'event':'notify','message':_0x2a4d31},client9002);return _0x2a4d31;})[_0xa4a5('0x27')](respondWithResult(_0xec46fb,null))['catch'](APIHandleError(_0xec46fb));};exports['offline']=function(_0x2f5f16,_0x44450c){var _0x1c6969,_0x527b8d,_0x180ff4;var _0x1e0b61=[];var _0x38ab89={};var _0x290370=_0x2f5f16[_0xa4a5('0xd0')]||[];var _0x55551b=[];var _0xb32507;return db[_0xa4a5('0x9c')]['describe']()[_0xa4a5('0x27')](function(_0x682607){if(!_0x682607){throw new db[(_0xa4a5('0xa5'))][(_0xa4a5('0x9d'))]('no\x20available\x20attributes');}_0x1e0b61=_[_0xa4a5('0x9f')](_[_0xa4a5('0x5b')](_0x682607),[_0xa4a5('0xa1'),'updatedAt',_0xa4a5('0xa2'),_0xa4a5('0xa3')]);if(_0x2f5f16[_0xa4a5('0x72')]['id']){delete _0x2f5f16['body']['id'];}if(_[_0xa4a5('0x92')](_0x2f5f16[_0xa4a5('0x72')]['from'])){throw _0x44450c[_0xa4a5('0x1e')](0x1f4)['send'](new db[(_0xa4a5('0xa5'))][(_0xa4a5('0x9d'))](_0xa4a5('0xd1')));}if(_[_0xa4a5('0x92')](_0x2f5f16[_0xa4a5('0x72')][_0xa4a5('0x72')])||_0x2f5f16['body'][_0xa4a5('0x72')]===''){throw _0x44450c['status'](0x1f4)[_0xa4a5('0x2e')](new db[(_0xa4a5('0xa5'))]['ValidationError'](_0xa4a5('0xa6')));}if(_[_0xa4a5('0x92')](_0x2f5f16[_0xa4a5('0x72')][_0xa4a5('0xd2')])){throw _0x44450c[_0xa4a5('0x1e')](0x1f4)[_0xa4a5('0x2e')](new db[(_0xa4a5('0xa5'))][(_0xa4a5('0x9d'))](_0xa4a5('0xd3')+_0x1e0b61));}if(!_[_0xa4a5('0xa8')](_0x1e0b61,_0x2f5f16[_0xa4a5('0x72')][_0xa4a5('0xd2')])){throw _0x44450c['status'](0x1f4)[_0xa4a5('0x2e')](new db[(_0xa4a5('0xa5'))][(_0xa4a5('0x9d'))](_0xa4a5('0xd4')+_0x1e0b61));}_0x38ab89[_0x2f5f16[_0xa4a5('0x72')][_0xa4a5('0xd2')]]=_0x2f5f16[_0xa4a5('0x72')]['from'];})[_0xa4a5('0x27')](function(){return db[_0xa4a5('0x57')]['find']({'where':{'id':_0x2f5f16['params']['id']},'include':[{'model':db[_0xa4a5('0xd5')],'as':'List'},{'model':db[_0xa4a5('0xd6')],'as':_0xa4a5('0xd6')}]});})[_0xa4a5('0x27')](handleEntityNotFound(_0x44450c,null))['then'](function(_0x6cc227){if(_0x6cc227&&_0x6cc227[_0xa4a5('0xab')]){_0x527b8d=_0x6cc227;var _0x1894b1=_['defaults'](_0x2f5f16[_0xa4a5('0x72')],{'firstName':_0x2f5f16[_0xa4a5('0x72')][_0xa4a5('0xa4')],'phone':_0x2f5f16['body'][_0xa4a5('0xa4')],'ListId':_0x6cc227[_0xa4a5('0xa3')]});_0x1894b1[_0x2f5f16[_0xa4a5('0x72')][_0xa4a5('0xd2')]]=_0x2f5f16['body']['from'];return db[_0xa4a5('0x9c')][_0xa4a5('0xd7')]({'where':_0x38ab89,'defaults':_0x1894b1});}})['spread'](function(_0x5ba75b){if(_0x5ba75b){_0x180ff4=_0x5ba75b;var _0x150fb0=fs[_0xa4a5('0xd8')](path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],_0xa4a5('0xd9')),_0xa4a5('0xda'));var _0x1fcc8b=ejs[_0xa4a5('0xdb')](_0x150fb0,{'body':_[_0xa4a5('0xdc')](_0x2f5f16['body']['body']),'bodyTitle':_0x527b8d['offlineMessageBody']});return db[_0xa4a5('0xdd')]['create']({'body':_0x1fcc8b,'plainBody':htmlToText[_0xa4a5('0xde')](_0x1fcc8b),'ContactId':_0x5ba75b['id'],'ChatWebsiteId':_0x527b8d['id']});}})[_0xa4a5('0x27')](function(_0x484f61){_0xb32507=_0x484f61;if(_0x290370[_0xa4a5('0x61')]){var _0x16c485=_0x290370[_0xa4a5('0x3c')](function(_0x448182){return{'name':_0x448182[_0xa4a5('0xdf')],'basename':_0x448182[_0xa4a5('0x82')],'type':_0x448182[_0xa4a5('0xe0')],'ChatOfflineMessageId':_0x484f61['id']};});_0x55551b=_0x16c485['map'](_0x4581c0=>{var _0x5e550a={'filename':_0x4581c0[_0xa4a5('0x2d')],'path':path[_0xa4a5('0x88')](config[_0xa4a5('0x8e')],_0xa4a5('0xe1'),_0xa4a5('0xd0'),_0xa4a5('0xe2'),'offline-chat',_0x4581c0['basename'])};return _0x5e550a;});if(!_0x527b8d[_0xa4a5('0xe3')]){return db['sequelize'][_0xa4a5('0xe4')](function(_0x142cfd){return db[_0xa4a5('0xe5')]['bulkCreate'](_0x16c485,{'transaction':_0x142cfd});});}}})['then'](function(){if(_0xb32507){_0x1c6969=_0xb32507;return db[_0xa4a5('0xd6')][_0xa4a5('0xe6')]({'where':{'service':!![]},'include':[{'model':db[_0xa4a5('0xe7')],'as':_0xa4a5('0xe8'),'raw':!![],'include':[{'model':db[_0xa4a5('0xe9')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xa4a5('0x27')](function(_0x1c67d8){if(_0x1c67d8&&_0x1c67d8[_0xa4a5('0xe8')]&&_0x527b8d[_0xa4a5('0xea')]&&_0x527b8d[_0xa4a5('0xeb')]){var _0x3bc88e=_0x1c67d8[_0xa4a5('0xec')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x3bc88e,'message':{'from':util[_0xa4a5('0x4a')]('\x22%s\x22\x20<%s>',_0x1c67d8[_0xa4a5('0x2d')],_0x1c67d8[_0xa4a5('0xed')]||_0x1c67d8[_0xa4a5('0xe8')][_0xa4a5('0x73')]),'to':_0x527b8d[_0xa4a5('0xeb')],'subject':_0x527b8d[_0xa4a5('0xee')],'html':_0x1c6969['body'],'attachments':_0x55551b}},client9003)[_0xa4a5('0x27')](function(){return _0x1c6969;})[_0xa4a5('0x1c')](function(_0x56d0bd){logger[_0xa4a5('0x19')](_0x56d0bd);});}})[_0xa4a5('0x27')](function(){if(_0x527b8d&&_0x527b8d[_0xa4a5('0xe3')]&&_0x527b8d[_0xa4a5('0xef')]){var _0x2858c8=[];if(_0x290370['length']){_0x2858c8=_0x290370['map'](function(_0x4b06fc){return{'name':_0x4b06fc[_0xa4a5('0xdf')],'basename':_0x4b06fc[_0xa4a5('0x82')],'type':_0x4b06fc[_0xa4a5('0xe0')],'ChatOfflineMessageId':_0xb32507['id']};});}var _0x121e25;if(!_[_0xa4a5('0x92')](_0x527b8d[_0xa4a5('0xf0')])){var _0x53de59=_[_0xa4a5('0x3c')](_0x2f5f16[_0xa4a5('0x72')],function(_0x455aec){return _0x455aec;});var _0xbfc3e3=_[_0xa4a5('0xf1')](_0x53de59)[0x0];var _0x57361d=_[_0xa4a5('0xf2')](_0xbfc3e3,function(_0x50331e){return _0x50331e;});_0x121e25=_0x57361d[0x1][_0x527b8d[_0xa4a5('0xf0')]];}var _0x25d2ed={'from':_0x180ff4[_0xa4a5('0xed')],'firstName':_0x180ff4[_0xa4a5('0x45')],'lastName':_0x180ff4[_0xa4a5('0x46')],'mapKey':_0xa4a5('0xed'),'message':{'from':_0x180ff4[_0xa4a5('0xed')],'to':_0x527b8d[_0xa4a5('0xd6')]['email'],'cc':'','subject':_[_0xa4a5('0x92')](_0x121e25)?_0x527b8d[_0xa4a5('0xee')]:_0x121e25,'messageId':'','sentAt':new Date(),'attach':_0x2858c8[_0xa4a5('0x61')],'attachments':_0x2858c8,'originChannel':_0xa4a5('0xf3'),'ChatWebsiteId':_0x527b8d['id'],'ChatOfflineMessageId':_0x1c6969['id'],'originTo':_0x527b8d[_0xa4a5('0xd6')][_0xa4a5('0xed')]},'body':_0x1c6969[_0xa4a5('0x72')]};var _0x3225a6={'account':{'id':_0x527b8d[_0xa4a5('0xef')]},'body':_0x25d2ed,'log':_0xa4a5('0xf4')};return respondWithRpcPromise(_0xa4a5('0xf4'),_0xa4a5('0xf5'),_0x3225a6,client9001)[_0xa4a5('0x27')](function(){return _0x1c6969;})[_0xa4a5('0x1c')](function(_0x29740c){logger[_0xa4a5('0x19')](_0x29740c);});}return;})['then'](function(){if(_0x1c6969){return _0x1c6969;}})['then'](respondWithResult(_0x44450c,null))[_0xa4a5('0x1c')](function(){for(var _0xbee19e of _0x290370){var _0x1be088=path['join'](config[_0xa4a5('0x8e')],_0xa4a5('0xe1'),_0xa4a5('0xd0'),'attachments',_0xa4a5('0xf6'),_0xbee19e[_0xa4a5('0x82')]);fs_extra[_0xa4a5('0xf7')](_0x1be088)[_0xa4a5('0x1c')](function(_0x215afc){logger[_0xa4a5('0x19')](_0xa4a5('0xf8'),_0x1be088,_0x215afc);});}});};exports[_0xa4a5('0xf9')]=function(_0x502541,_0x4d4c37){return db[_0xa4a5('0xba')][_0xa4a5('0x70')]({'where':{'id':_0x502541[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x4d4c37,null))[_0xa4a5('0x27')](function(_0x3996c4){if(_0x3996c4){return _0x3996c4[_0xa4a5('0xf9')](_0x502541[_0xa4a5('0x72')][_0xa4a5('0x7d')],_[_0xa4a5('0xfa')](_0x502541[_0xa4a5('0x72')],[_0xa4a5('0x7d'),'id'])||{});}})[_0xa4a5('0x27')](respondWithResult(_0x4d4c37,null))[_0xa4a5('0x1c')](handleError(_0x4d4c37,null));};exports[_0xa4a5('0xfb')]=function(_0x17ed3e,_0x6cbe37){var _0x4e2098={'raw':![],'where':{}};var _0x4bd425={};var _0x1da67b={'count':0x0,'rows':[]};return db[_0xa4a5('0x57')][_0xa4a5('0xe6')]({'where':{'id':_0x17ed3e[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x6cbe37,null))[_0xa4a5('0x27')](function(_0x4aa109){if(_0x4aa109){_0x4bd425[_0xa4a5('0x4f')]=_[_0xa4a5('0x5b')](db[_0xa4a5('0xba')][_0xa4a5('0x58')]);_0x4bd425[_0xa4a5('0x60')]=_[_0xa4a5('0x5b')](_0x17ed3e['query']);_0x4bd425[_0xa4a5('0x5c')]=_[_0xa4a5('0x5d')](_0x4bd425[_0xa4a5('0x4f')],_0x4bd425['query']);_0x4e2098[_0xa4a5('0x5e')]=_[_0xa4a5('0x5d')](_0x4bd425[_0xa4a5('0x4f')],qs[_0xa4a5('0x5f')](_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0x5f')]));_0x4e2098[_0xa4a5('0x5e')]=_0x4e2098['attributes'][_0xa4a5('0x61')]?_0x4e2098['attributes']:_0x4bd425['model'];if(!_0x17ed3e['query'][_0xa4a5('0x62')](_0xa4a5('0x7b'))){_0x4e2098[_0xa4a5('0x22')]=qs[_0xa4a5('0x22')](_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0x22')]);_0x4e2098[_0xa4a5('0x20')]=qs[_0xa4a5('0x20')](_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0x20')]);}_0x4e2098[_0xa4a5('0x63')]=qs[_0xa4a5('0x64')](_0x17ed3e[_0xa4a5('0x60')]['sort']);_0x4e2098[_0xa4a5('0x65')]=qs[_0xa4a5('0x5c')](_['pick'](_0x17ed3e[_0xa4a5('0x60')],_0x4bd425[_0xa4a5('0x5c')]));_0x4e2098[_0xa4a5('0x65')][_0xa4a5('0x78')]=_0x4aa109['id'];if(_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0x67')]){_0x4e2098[_0xa4a5('0x65')]=_[_0xa4a5('0x68')](_0x4e2098[_0xa4a5('0x65')],{'$or':_[_0xa4a5('0x3c')](_0x4e2098['attributes'],function(_0x1d01be){var _0x59178f={};_0x59178f[_0x1d01be]={'$like':'%'+_0x17ed3e['query']['filter']+'%'};return _0x59178f;})});}_0x4e2098=_[_0xa4a5('0x68')]({},_0x4e2098,_0x17ed3e[_0xa4a5('0x6a')]);return db[_0xa4a5('0xba')][_0xa4a5('0x23')]({'where':_0x4e2098[_0xa4a5('0x65')]})[_0xa4a5('0x27')](function(_0x1ecc43){_0x1da67b[_0xa4a5('0x23')]=_0x1ecc43;if(_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0x6e')]){_0x4e2098['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xa4a5('0xc6')],'as':_0xa4a5('0xfc'),'attributes':[_0xa4a5('0x2d'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xa4a5('0xfd'),'attributes':['id',_0xa4a5('0x2d'),_0xa4a5('0xfe')],'where':_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0xff')]?{'id':_0x17ed3e[_0xa4a5('0x60')][_0xa4a5('0xff')]}:undefined,'required':_0x17ed3e[_0xa4a5('0x60')]['tag']?!![]:![]}];}return db[_0xa4a5('0xba')]['findAll'](_0x4e2098);})[_0xa4a5('0x27')](function(_0x1cb9eb){_0x1da67b[_0xa4a5('0x6c')]=_0x1cb9eb;return _0x1da67b;});}})[_0xa4a5('0x27')](respondWithFilteredResult(_0x6cbe37,_0x4e2098))[_0xa4a5('0x1c')](handleError(_0x6cbe37,null));};exports[_0xa4a5('0x30')]=function(_0xa97daf,_0x4f9ccc){var _0x23393a=0x0;var _0x1755a5=0x0;var _0x58cd81=![];var _0x49226b;var _0x2691c6;return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0xa97daf[_0xa4a5('0x6d')]['id']},'include':[{'model':db[_0xa4a5('0x3d')],'as':_0xa4a5('0x3d'),'include':[{'model':db[_0xa4a5('0x3d')],'as':_0xa4a5('0xad'),'attributes':['id',_0xa4a5('0x33')]}]}]})[_0xa4a5('0x27')](handleEntityNotFound(_0x4f9ccc,null))[_0xa4a5('0x27')](function(_0x49e451){if(_0x49e451){_0x49226b=_0x49e451;return _0x49e451[_0xa4a5('0x100')]({'raw':!![]});}})[_0xa4a5('0x27')](function(_0x822841){if(_0x49226b){if(_0x822841){_0x2691c6=_0x822841;}}return require('../../config/license/util')[_0xa4a5('0x8b')]();})['then'](function(_0x50d3f3){if(_0x50d3f3){_0x1755a5=_0x50d3f3[_0xa4a5('0x101')];_0x58cd81=_0x50d3f3[_0xa4a5('0x8c')];}})[_0xa4a5('0x27')](function(){return db['ChatInteraction'][_0xa4a5('0x23')]({'where':{'closed':![]}});})[_0xa4a5('0x27')](function(_0x582071){_0x23393a=_0x582071;if(_0x1755a5&&_0x582071>_0x1755a5){return db[_0xa4a5('0x102')]['findOne']({'where':{'id':0x1}})[_0xa4a5('0x27')](function(_0x1cc639){if(_0x1cc639){_0x1cc639['increment']('chatLicenseExceeded');}});}})[_0xa4a5('0x27')](function(){if(!_0x49226b['Interval']||!_0x49226b[_0xa4a5('0x3d')][_0xa4a5('0xad')])return!![];return checkWebsiteIntervals(_0x49226b);})['then'](function(_0x185f9a){var _0x3e2f94=fs['readFileSync'](path[_0xa4a5('0x88')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0xe8e81e=new url[(_0xa4a5('0x103'))](_0x49226b[_0xa4a5('0x104')])[_0xa4a5('0x105')];var _0x5e191a=_0xa4a5('0x106');var _0x202cf7=![];var _0x13bd94={'chatVersion':_0x5e191a,'chatWebsiteAddressOrigin':_0xe8e81e,'remote':_0x49226b[_0xa4a5('0x107')],'query':querystring['stringify'](_[_0xa4a5('0x68')](_0x49226b[_0xa4a5('0x29')]({'plain':!![]}),{'customerIp':_0xa97daf[_0xa4a5('0xb8')][_0xa4a5('0x43')]||_0xa97daf[_0xa4a5('0xb8')][_0xa4a5('0x108')]||_0xa97daf[_0xa4a5('0x109')][_0xa4a5('0x10a')]||_0xa97daf['ip'],'referer':_0xa97daf[_0xa4a5('0xb8')][_0xa4a5('0x48')],'openedInteractions':_0x23393a,'maxInteractions':_0x1755a5,'virtual':_0x58cd81[_0xa4a5('0x101')],'online':_0x185f9a,'custom':_0x58cd81}))[_0xa4a5('0x10b')](/'/g,'\x5c\x27')};_0x4f9ccc[_0xa4a5('0x2e')](ejs[_0xa4a5('0xdb')](Mustache[_0xa4a5('0xdb')](_0x3e2f94,_0x13bd94),{'proactiveActions':_0x2691c6,'alignment':_0x49226b['alignment'],'verticalAlignment':_0x49226b['verticalAlignment'],'div_color':_0x49226b[_0xa4a5('0xfe')],'labelText':_0x49226b[_0xa4a5('0x10c')],'text_color':_0x49226b[_0xa4a5('0x10d')],'text_button_color':_0x49226b[_0xa4a5('0x10e')],'button_color':_0x49226b[_0xa4a5('0x10f')],'background_color':_0x49226b[_0xa4a5('0x110')],'hideWhenOffline':_0x49226b[_0xa4a5('0x111')],'intervalId':_0x49226b[_0xa4a5('0x112')],'isDevelopment':_0x202cf7,'chatVersion':_0x5e191a}));})[_0xa4a5('0x1c')](handleError(_0x4f9ccc,null));};exports[_0xa4a5('0x113')]=function(_0x12e97e,_0xe1ded6){var _0x16c733=_0x12e97e[_0xa4a5('0x6d')]['id'];var _0x2e379d=_0x12e97e[_0xa4a5('0x72')];var _0x2777a3=0xc8;var _0x5a2c6e=null;return db[_0xa4a5('0x114')][_0xa4a5('0xe4')]({'isolationLevel':db['sequelize'][_0xa4a5('0x115')][_0xa4a5('0x116')]['READ_COMMITTED']},function(_0xf25743){return db[_0xa4a5('0x57')][_0xa4a5('0xe6')]({'where':{'id':_0x16c733},'transaction':_0xf25743})[_0xa4a5('0x27')](function(_0xfcfbb7){if(_0xfcfbb7){return db[_0xa4a5('0x117')][_0xa4a5('0x28')]({'where':{'ChatWebsiteId':_0x16c733},'transaction':_0xf25743})[_0xa4a5('0x27')](function(){var _0x2fc572=_[_0xa4a5('0x3c')](_0x2e379d,function(_0x3c8297){_0x3c8297[_0xa4a5('0x78')]=_0x16c733;return _0x3c8297;});return db[_0xa4a5('0x117')][_0xa4a5('0x118')](_0x2fc572,{'transaction':_0xf25743});});}else{_0x2777a3=0x194;_0x5a2c6e=[];}});})['then'](function(){if(_0x2777a3!==0x194){return db[_0xa4a5('0x117')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x16c733},'order':_0xa4a5('0xb3')})[_0xa4a5('0x27')](function(_0x525a30){_0x5a2c6e=_0x525a30;});}})[_0xa4a5('0x1c')](function(_0x3d7782){_0x2777a3=0x1f4;logger[_0xa4a5('0x19')](_0x3d7782[_0xa4a5('0x2c')]);if(_0x3d7782[_0xa4a5('0x2d')]){delete _0x3d7782[_0xa4a5('0x2d')];}_0x5a2c6e=_0x3d7782;})[_0xa4a5('0x119')](function(){if(_0x5a2c6e===null){_0xe1ded6[_0xa4a5('0x1d')](_0x2777a3);}else{if(_0x2777a3===0x1f4){_0xe1ded6[_0xa4a5('0x1e')](_0x2777a3)[_0xa4a5('0x2e')](_0x5a2c6e);}else{_0xe1ded6['status'](_0x2777a3)[_0xa4a5('0x25')](_0x5a2c6e);}}});};exports['getApplications']=function(_0x474f34,_0x19c315){var _0x5c8508={};var _0x4c71f4={};var _0x1dbb32;var _0x3568b8;return db[_0xa4a5('0x57')][_0xa4a5('0xe6')]({'where':{'id':_0x474f34[_0xa4a5('0x6d')]['id']}})['then'](handleEntityNotFound(_0x19c315,null))['then'](function(_0x29b71d){if(_0x29b71d){_0x1dbb32=_0x29b71d;_0x4c71f4[_0xa4a5('0x4f')]=_['keys'](db[_0xa4a5('0x117')][_0xa4a5('0x58')]);_0x4c71f4[_0xa4a5('0x60')]=_['keys'](_0x474f34[_0xa4a5('0x60')]);_0x4c71f4[_0xa4a5('0x5c')]=_[_0xa4a5('0x5d')](_0x4c71f4[_0xa4a5('0x4f')],_0x4c71f4[_0xa4a5('0x60')]);_0x5c8508[_0xa4a5('0x5e')]=_['intersection'](_0x4c71f4['model'],qs[_0xa4a5('0x5f')](_0x474f34[_0xa4a5('0x60')][_0xa4a5('0x5f')]));_0x5c8508[_0xa4a5('0x5e')]=_0x5c8508[_0xa4a5('0x5e')][_0xa4a5('0x61')]?_0x5c8508[_0xa4a5('0x5e')]:_0x4c71f4['model'];_0x5c8508[_0xa4a5('0x63')]=qs[_0xa4a5('0x64')](_0x474f34[_0xa4a5('0x60')]['sort']);_0x5c8508[_0xa4a5('0x65')]=qs['filters'](_[_0xa4a5('0x66')](_0x474f34[_0xa4a5('0x60')],_0x4c71f4[_0xa4a5('0x5c')]));if(_0x474f34['query'][_0xa4a5('0x67')]){_0x5c8508[_0xa4a5('0x65')]=_['merge'](_0x5c8508[_0xa4a5('0x65')],{'$or':_['map'](_0x5c8508['attributes'],function(_0xb44f0a){var _0x4fbeb2={};_0x4fbeb2[_0xb44f0a]={'$like':'%'+_0x474f34['query'][_0xa4a5('0x67')]+'%'};return _0x4fbeb2;})});}_0x5c8508=_[_0xa4a5('0x68')]({},_0x5c8508,_0x474f34[_0xa4a5('0x6a')]);return _0x1dbb32[_0xa4a5('0x11a')](_0x5c8508);}})[_0xa4a5('0x27')](function(_0x1e558f){if(_0x1e558f){_0x3568b8=_0x1e558f['length'];if(!_0x474f34[_0xa4a5('0x60')][_0xa4a5('0x62')](_0xa4a5('0x7b'))){_0x5c8508[_0xa4a5('0x22')]=qs[_0xa4a5('0x22')](_0x474f34[_0xa4a5('0x60')][_0xa4a5('0x22')]);_0x5c8508[_0xa4a5('0x20')]=qs[_0xa4a5('0x20')](_0x474f34[_0xa4a5('0x60')]['offset']);}return _0x1dbb32['getApplications'](_0x5c8508);}})[_0xa4a5('0x27')](function(_0x21905e){if(_0x21905e){return _0x21905e?{'count':_0x3568b8,'rows':_0x21905e}:null;}})['then'](respondWithResult(_0x19c315,null))[_0xa4a5('0x1c')](handleError(_0x19c315,null));};exports[_0xa4a5('0x11b')]=function(_0x35f250,_0x3e9f5a){return db[_0xa4a5('0x11c')][_0xa4a5('0x70')]({'where':{'id':_0x35f250[_0xa4a5('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3e9f5a,null))[_0xa4a5('0x27')](function(_0x130480){if(_0x130480){return _0x130480[_0xa4a5('0x11b')](_0x35f250[_0xa4a5('0x72')][_0xa4a5('0x7d')],_[_0xa4a5('0xfa')](_0x35f250['body'],[_0xa4a5('0x7d'),'id'])||{});}})['then'](respondWithResult(_0x3e9f5a,null))[_0xa4a5('0x1c')](handleError(_0x3e9f5a,null));};exports[_0xa4a5('0x100')]=function(_0xd77566,_0x3afac4){var _0x5eaa2b={};var _0x29a039={};var _0x321ade;var _0x119e28;return db[_0xa4a5('0x57')][_0xa4a5('0xe6')]({'where':{'id':_0xd77566[_0xa4a5('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3afac4,null))[_0xa4a5('0x27')](function(_0xd76c83){if(_0xd76c83){_0x321ade=_0xd76c83;_0x29a039['model']=_[_0xa4a5('0x5b')](db['ChatProactiveAction']['rawAttributes']);_0x29a039[_0xa4a5('0x60')]=_[_0xa4a5('0x5b')](_0xd77566[_0xa4a5('0x60')]);_0x29a039[_0xa4a5('0x5c')]=_['intersection'](_0x29a039[_0xa4a5('0x4f')],_0x29a039['query']);_0x5eaa2b[_0xa4a5('0x5e')]=_['intersection'](_0x29a039[_0xa4a5('0x4f')],qs[_0xa4a5('0x5f')](_0xd77566[_0xa4a5('0x60')][_0xa4a5('0x5f')]));_0x5eaa2b[_0xa4a5('0x5e')]=_0x5eaa2b[_0xa4a5('0x5e')][_0xa4a5('0x61')]?_0x5eaa2b['attributes']:_0x29a039[_0xa4a5('0x4f')];_0x5eaa2b[_0xa4a5('0x63')]=qs[_0xa4a5('0x64')](_0xd77566[_0xa4a5('0x60')][_0xa4a5('0x64')]);_0x5eaa2b[_0xa4a5('0x65')]=qs['filters'](_['pick'](_0xd77566['query'],_0x29a039[_0xa4a5('0x5c')]));if(_0xd77566['query'][_0xa4a5('0x67')]){_0x5eaa2b[_0xa4a5('0x65')]=_[_0xa4a5('0x68')](_0x5eaa2b[_0xa4a5('0x65')],{'$or':_[_0xa4a5('0x3c')](_0x5eaa2b[_0xa4a5('0x5e')],function(_0x1ac9d5){var _0x3e80f8={};_0x3e80f8[_0x1ac9d5]={'$like':'%'+_0xd77566[_0xa4a5('0x60')][_0xa4a5('0x67')]+'%'};return _0x3e80f8;})});}_0x5eaa2b=_[_0xa4a5('0x68')]({},_0x5eaa2b,_0xd77566[_0xa4a5('0x6a')]);return _0x321ade['getProactiveActions'](_0x5eaa2b);}})[_0xa4a5('0x27')](function(_0x480cd4){if(_0x480cd4){_0x119e28=_0x480cd4[_0xa4a5('0x61')];if(!_0xd77566[_0xa4a5('0x60')][_0xa4a5('0x62')](_0xa4a5('0x7b'))){_0x5eaa2b['limit']=qs[_0xa4a5('0x22')](_0xd77566[_0xa4a5('0x60')][_0xa4a5('0x22')]);_0x5eaa2b[_0xa4a5('0x20')]=qs[_0xa4a5('0x20')](_0xd77566['query'][_0xa4a5('0x20')]);}return _0x321ade[_0xa4a5('0x100')](_0x5eaa2b);}})['then'](function(_0x2db12a){if(_0x2db12a){return _0x2db12a?{'count':_0x119e28,'rows':_0x2db12a}:null;}})[_0xa4a5('0x27')](respondWithResult(_0x3afac4,null))[_0xa4a5('0x1c')](handleError(_0x3afac4,null));};exports['getFields']=function(_0x3340b7,_0x4e041c){var _0x3d7d51=_0x3340b7[_0xa4a5('0x60')][_0xa4a5('0x11d')]===_0xa4a5('0x11e')?'offlineForm':'onlineForm';return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'attributes':['id',_0x3d7d51],'where':{'id':_0x3340b7[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x4e041c,null))[_0xa4a5('0x27')](function(_0x21608d){if(_0x21608d){var _0x228236=_0x21608d[_0x3d7d51];var _0x15229b=_0x228236&&_0x228236[_0xa4a5('0x11f')]?_0x228236[_0xa4a5('0x11f')]:[];_0x4e041c[_0xa4a5('0x2e')]({'fromKey':_[_0xa4a5('0x92')](_0x228236[_0xa4a5('0x120')])?undefined:_0x228236[_0xa4a5('0x120')],'count':_0x15229b[_0xa4a5('0x61')],'rows':_0x15229b});}})[_0xa4a5('0x1c')](handleError(_0x4e041c,null));};exports[_0xa4a5('0x121')]=function(_0x18e10f,_0xdf727d){var _0x477724={'raw':![],'where':{}};var _0x2f557f={};var _0x589a76={'count':0x0,'rows':[]};return db[_0xa4a5('0x57')][_0xa4a5('0xe6')]({'where':{'id':_0x18e10f[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0xdf727d,null))['then'](function(_0x1ce8d1){if(_0x1ce8d1){_0x2f557f[_0xa4a5('0x4f')]=_[_0xa4a5('0x5b')](db['ChatOfflineMessage'][_0xa4a5('0x58')]);_0x2f557f[_0xa4a5('0x60')]=_[_0xa4a5('0x5b')](_0x18e10f[_0xa4a5('0x60')]);_0x2f557f['filters']=_['intersection'](_0x2f557f[_0xa4a5('0x4f')],_0x2f557f[_0xa4a5('0x60')]);_0x477724['attributes']=_[_0xa4a5('0x5d')](_0x2f557f[_0xa4a5('0x4f')],qs['fields'](_0x18e10f[_0xa4a5('0x60')][_0xa4a5('0x5f')]));_0x477724['attributes']=_0x477724['attributes'][_0xa4a5('0x61')]?_0x477724[_0xa4a5('0x5e')]:_0x2f557f[_0xa4a5('0x4f')];if(!_0x18e10f[_0xa4a5('0x60')][_0xa4a5('0x62')](_0xa4a5('0x7b'))){_0x477724[_0xa4a5('0x22')]=qs[_0xa4a5('0x22')](_0x18e10f[_0xa4a5('0x60')]['limit']);_0x477724[_0xa4a5('0x20')]=qs['offset'](_0x18e10f[_0xa4a5('0x60')]['offset']);}_0x477724[_0xa4a5('0x63')]=qs[_0xa4a5('0x64')](_0x18e10f[_0xa4a5('0x60')][_0xa4a5('0x64')]);_0x477724[_0xa4a5('0x65')]=qs[_0xa4a5('0x5c')](_['pick'](_0x18e10f[_0xa4a5('0x60')],_0x2f557f[_0xa4a5('0x5c')]));_0x477724['where'][_0xa4a5('0x78')]=_0x1ce8d1['id'];if(_0x18e10f[_0xa4a5('0x60')]['filter']){_0x477724[_0xa4a5('0x65')]=_[_0xa4a5('0x68')](_0x477724[_0xa4a5('0x65')],{'$or':_[_0xa4a5('0x3c')](_0x477724['attributes'],function(_0x509bad){var _0x144a58={};_0x144a58[_0x509bad]={'$like':'%'+_0x18e10f[_0xa4a5('0x60')][_0xa4a5('0x67')]+'%'};return _0x144a58;})});}_0x477724=_[_0xa4a5('0x68')]({},_0x477724,_0x18e10f[_0xa4a5('0x6a')]);return db[_0xa4a5('0xdd')][_0xa4a5('0x23')]({'where':_0x477724[_0xa4a5('0x65')]})['then'](function(_0x2fe416){_0x589a76[_0xa4a5('0x23')]=_0x2fe416;if(_0x18e10f[_0xa4a5('0x60')][_0xa4a5('0x6e')]){_0x477724[_0xa4a5('0x6f')]=[{'all':!![]}];}else{_0x477724[_0xa4a5('0x6f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xa4a5('0xe5')],'as':_0xa4a5('0x122'),'required':![]}];}return db[_0xa4a5('0xdd')][_0xa4a5('0x6b')](_0x477724);})[_0xa4a5('0x27')](function(_0x3eaa09){_0x589a76[_0xa4a5('0x6c')]=_0x3eaa09;return _0x589a76;});}})[_0xa4a5('0x27')](respondWithFilteredResult(_0xdf727d,_0x477724))[_0xa4a5('0x1c')](handleError(_0xdf727d,null));};exports[_0xa4a5('0x123')]=function(_0x476d53,_0x30e324){return db[_0xa4a5('0x57')]['find']({'where':{'id':_0x476d53['params']['id']}})['then'](handleEntityNotFound(_0x30e324,null))[_0xa4a5('0x27')](function(_0x4ddb3c){if(_0x4ddb3c){return _0x4ddb3c[_0xa4a5('0x123')](_0x476d53[_0xa4a5('0x72')][_0xa4a5('0x7d')],_[_0xa4a5('0xfa')](_0x476d53['body'],[_0xa4a5('0x7d'),'id'])||{})[_0xa4a5('0xae')](function(_0x14614a){for(var _0x492b7a=0x0;_0x492b7a<_0x476d53['body'][_0xa4a5('0x7d')][_0xa4a5('0x61')];_0x492b7a+=0x1){socket[_0xa4a5('0x124')]('userChatWebsite:save',{'UserId':Number(_0x476d53['body'][_0xa4a5('0x7d')][_0x492b7a]),'ChatWebsiteId':Number(_0x476d53[_0xa4a5('0x6d')]['id'])});}return _0x14614a;});}})['then'](respondWithResult(_0x30e324,null))[_0xa4a5('0x1c')](handleError(_0x30e324,null));};exports[_0xa4a5('0x125')]=function(_0x1a9003,_0x40ab83){return db[_0xa4a5('0x57')][_0xa4a5('0x70')]({'where':{'id':_0x1a9003[_0xa4a5('0x6d')]['id']}})[_0xa4a5('0x27')](handleEntityNotFound(_0x40ab83,null))[_0xa4a5('0x27')](function(_0x42c5d0){if(_0x42c5d0){return _0x42c5d0[_0xa4a5('0x125')](_0x1a9003[_0xa4a5('0x60')][_0xa4a5('0x7d')])[_0xa4a5('0x27')](function(){if(_[_0xa4a5('0x126')](_0x1a9003[_0xa4a5('0x60')][_0xa4a5('0x7d')])){for(var _0x3838ed=0x0;_0x3838ed<_0x1a9003[_0xa4a5('0x60')][_0xa4a5('0x7d')][_0xa4a5('0x61')];_0x3838ed+=0x1){socket[_0xa4a5('0x124')](_0xa4a5('0x127'),{'UserId':Number(_0x1a9003['query'][_0xa4a5('0x7d')][_0x3838ed]),'ChatWebsiteId':Number(_0x1a9003[_0xa4a5('0x6d')]['id'])});}}else{socket[_0xa4a5('0x124')](_0xa4a5('0x127'),{'UserId':Number(_0x1a9003[_0xa4a5('0x60')]['ids']),'ChatWebsiteId':Number(_0x1a9003['params']['id'])});}});}})[_0xa4a5('0x27')](respondWithStatusCode(_0x40ab83,null))['catch'](handleError(_0x40ab83,null));};exports[_0xa4a5('0x128')]=function(_0x5ef8f9,_0x4a81ca){var _0x190208={};var _0x354782={};var _0x1a4d98;var _0x511794;return db['ChatWebsite'][_0xa4a5('0xe6')]({'where':{'id':_0x5ef8f9[_0xa4a5('0x6d')]['id']}})['then'](handleEntityNotFound(_0x4a81ca,null))[_0xa4a5('0x27')](function(_0x20da55){if(_0x20da55){_0x1a4d98=_0x20da55;_0x354782[_0xa4a5('0x4f')]=_[_0xa4a5('0x5b')](db['User'][_0xa4a5('0x58')]);_0x354782[_0xa4a5('0x60')]=_[_0xa4a5('0x5b')](_0x5ef8f9['query']);_0x354782[_0xa4a5('0x5c')]=_[_0xa4a5('0x5d')](_0x354782['model'],_0x354782[_0xa4a5('0x60')]);_0x190208['attributes']=_[_0xa4a5('0x5d')](_0x354782[_0xa4a5('0x4f')],qs['fields'](_0x5ef8f9[_0xa4a5('0x60')][_0xa4a5('0x5f')]));_0x190208[_0xa4a5('0x5e')]=_0x190208[_0xa4a5('0x5e')]['length']?_0x190208['attributes']:_0x354782[_0xa4a5('0x4f')];_0x190208[_0xa4a5('0x63')]=qs['sort'](_0x5ef8f9[_0xa4a5('0x60')]['sort']);_0x190208['where']=qs['filters'](_[_0xa4a5('0x66')](_0x5ef8f9[_0xa4a5('0x60')],_0x354782[_0xa4a5('0x5c')]));if(_0x5ef8f9[_0xa4a5('0x60')][_0xa4a5('0x67')]){_0x190208[_0xa4a5('0x65')]=_[_0xa4a5('0x68')](_0x190208[_0xa4a5('0x65')],{'$or':_[_0xa4a5('0x3c')](_0x190208[_0xa4a5('0x5e')],function(_0x12ef64){var _0x306ed4={};_0x306ed4[_0x12ef64]={'$like':'%'+_0x5ef8f9[_0xa4a5('0x60')][_0xa4a5('0x67')]+'%'};return _0x306ed4;})});}_0x190208=_[_0xa4a5('0x68')]({},_0x190208,_0x5ef8f9[_0xa4a5('0x6a')]);return _0x1a4d98[_0xa4a5('0x128')](_0x190208);}})[_0xa4a5('0x27')](function(_0xcc9d){if(_0xcc9d){_0x511794=_0xcc9d[_0xa4a5('0x61')];if(!_0x5ef8f9[_0xa4a5('0x60')][_0xa4a5('0x62')](_0xa4a5('0x7b'))){_0x190208[_0xa4a5('0x22')]=qs[_0xa4a5('0x22')](_0x5ef8f9[_0xa4a5('0x60')][_0xa4a5('0x22')]);_0x190208[_0xa4a5('0x20')]=qs['offset'](_0x5ef8f9[_0xa4a5('0x60')][_0xa4a5('0x20')]);}return _0x1a4d98[_0xa4a5('0x128')](_0x190208);}})['then'](function(_0x35ab93){if(_0x35ab93){return _0x35ab93?{'count':_0x511794,'rows':_0x35ab93}:null;}})[_0xa4a5('0x27')](respondWithResult(_0x4a81ca,null))['catch'](handleError(_0x4a81ca,null));}; \ No newline at end of file +var _0xa01f=['getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','handleError','redis','defaults','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','ChatWebsites','end','sendStatus','stack','name','send','getSnippet','timezone','format','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','get','all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','unknown','%s\x20%s','device','model','%s\x20%s\x20%s','type','stringify','index','Pause','mandatoryDispositionPause','ChatWebsite','key','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','fields','options','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addLogo','sitepic','file','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','notify','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','account','list','applications','priority','asc','Contacts','contact','threadId','externalUrl','ChatInteraction','ContactId','interaction','firstName','messageId','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','waitForTheAssignedQueue','Start','EventManager','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','files','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','offlineMessageSubject','openNewInteraction','mimetype','subjectOffline','toPairsIn','mapValues','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','headers','connection','remoteAddress','replace','alignment','textColor','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa01f,0x13e));var _0xfa01=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa01f[_0x220dbb];return _0x2b77de;};'use strict';var Mustache=require(_0xfa01('0x0'));var util=require(_0xfa01('0x1'));var path=require(_0xfa01('0x2'));var ejs=require(_0xfa01('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa01('0x4'));var querystring=require(_0xfa01('0x5'));var htmlToText=require(_0xfa01('0x6'));var Redis=require(_0xfa01('0x7'));var jayson=require(_0xfa01('0x8'));var url=require(_0xfa01('0x9'));var qs=require(_0xfa01('0xa'));var logger=require(_0xfa01('0xb'))('api');var config=require(_0xfa01('0xc'));var APIOutOfIntervalError=require(_0xfa01('0xd'))['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0xfa01('0xe')];var db=require('../../mysqldb')['db'];config[_0xfa01('0xf')]=_[_0xfa01('0x10')](config[_0xfa01('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa01('0x11'))(new Redis(config[_0xfa01('0xf')]));require(_0xfa01('0x12'))['register'](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xfa01('0x13')]['http']({'port':0x232a});var client9003=jayson[_0xfa01('0x13')][_0xfa01('0x14')]({'port':0x232b});var client9001=jayson['client'][_0xfa01('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x8b9389,_0x1d1e17,_0x166815,_0xe0927f){return new Promise(function(_0x1244c9,_0xb23d63){var _0x1f0d56=_0xe0927f||client;return _0x1f0d56[_0xfa01('0x15')](_0x8b9389,_0x166815)['then'](function(_0x40a86b){logger[_0xfa01('0x16')](_0xfa01('0x17'),_0x1d1e17,_0xfa01('0x18'));logger[_0xfa01('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1d1e17,'request\x20sent',JSON['stringify'](_0x40a86b));if(_0x40a86b[_0xfa01('0x1a')]){if(_0x40a86b[_0xfa01('0x1a')][_0xfa01('0x1b')]===0x1f4){logger['error'](_0xfa01('0x17'),_0x1d1e17,_0x40a86b[_0xfa01('0x1a')][_0xfa01('0x1c')]);return _0xb23d63(_0x40a86b[_0xfa01('0x1a')][_0xfa01('0x1c')]);}logger[_0xfa01('0x1a')](_0xfa01('0x17'),_0x1d1e17,_0x40a86b[_0xfa01('0x1a')]['message']);return _0x1244c9(_0x40a86b['error'][_0xfa01('0x1c')]);}else{logger['info'](_0xfa01('0x17'),_0x1d1e17,_0xfa01('0x18'));_0x1244c9(_0x40a86b[_0xfa01('0x1d')][_0xfa01('0x1c')]);}})[_0xfa01('0x1e')](function(_0x44516a){logger['error'](_0xfa01('0x17'),_0x1d1e17,_0x44516a);_0xb23d63(_0x44516a);});});}function respondWithStatusCode(_0x19962f,_0x48070a){_0x48070a=_0x48070a||0xcc;return function(_0x4bb131){if(_0x4bb131){return _0x19962f['sendStatus'](_0x48070a);}return _0x19962f[_0xfa01('0x1f')](_0x48070a)['end']();};}function respondWithResult(_0x4f7b9d,_0x3a848e){_0x3a848e=_0x3a848e||0xc8;return function(_0x3f7a8b){if(_0x3f7a8b){return _0x4f7b9d[_0xfa01('0x1f')](_0x3a848e)['json'](_0x3f7a8b);}};}function respondWithFilteredResult(_0x471adb,_0x3c810b){return function(_0x14406e){if(_0x14406e){var _0x58c0a8=typeof _0x3c810b[_0xfa01('0x20')]===_0xfa01('0x21')&&typeof _0x3c810b[_0xfa01('0x22')]===_0xfa01('0x21');var _0x834869=_0x14406e[_0xfa01('0x23')];var _0x4768c4=_0x58c0a8?0x0:_0x3c810b[_0xfa01('0x20')];var _0x30d3ad=_0x58c0a8?_0x14406e[_0xfa01('0x23')]:_0x3c810b[_0xfa01('0x20')]+_0x3c810b[_0xfa01('0x22')];var _0x2e759e;if(_0x30d3ad>=_0x834869){_0x30d3ad=_0x834869;_0x2e759e=0xc8;}else{_0x2e759e=0xce;}_0x471adb['status'](_0x2e759e);return _0x471adb[_0xfa01('0x24')](_0xfa01('0x25'),_0x4768c4+'-'+_0x30d3ad+'/'+_0x834869)[_0xfa01('0x26')](_0x14406e);}return null;};}function saveUpdates(_0x34a91d){return function(_0x531a79){if(_0x531a79){return _0x531a79[_0xfa01('0x27')](_0x34a91d)[_0xfa01('0x28')](function(_0x303ce3){return _0x303ce3;});}return null;};}function removeEntity(_0x334d9b){return function(_0x28454f){if(_0x28454f){return _0x28454f[_0xfa01('0x29')]()[_0xfa01('0x28')](function(){var _0x5bf117=_0x28454f['get']({'plain':!![]});var _0x203f27=_0xfa01('0x2a');return db['UserProfileResource'][_0xfa01('0x29')]({'where':{'type':_0x203f27,'resourceId':_0x5bf117['id']}})[_0xfa01('0x28')](function(){return _0x28454f;});})[_0xfa01('0x28')](function(){_0x334d9b[_0xfa01('0x1f')](0xcc)[_0xfa01('0x2b')]();});}};}function handleEntityNotFound(_0x1fded0){return function(_0x2c4cbe){if(!_0x2c4cbe){_0x1fded0[_0xfa01('0x2c')](0x194);}return _0x2c4cbe;};}function handleError(_0x25d653,_0xc9c7ed){_0xc9c7ed=_0xc9c7ed||0x1f4;return function(_0x3941ca){logger[_0xfa01('0x1a')](_0x3941ca[_0xfa01('0x2d')]);if(_0x3941ca[_0xfa01('0x2e')]){delete _0x3941ca[_0xfa01('0x2e')];}_0x25d653[_0xfa01('0x1f')](_0xc9c7ed)[_0xfa01('0x2f')](_0x3941ca);};}function iftimePromise(_0xa7ab86,_0x2c56ef){return respondWithRpcPromise('Command',_0xfa01('0x30'),{'command':_0x2c56ef[_0xfa01('0x31')]?util[_0xfa01('0x32')]('iftime\x20%s,%s',_0xa7ab86[_0xfa01('0x33')],_0x2c56ef[_0xfa01('0x31')]):util['format'](_0xfa01('0x34'),_0xa7ab86['interval'])},client9002)[_0xfa01('0x28')](function(_0x4dc8f5){var _0x2c0722=_0x4dc8f5&&_0x4dc8f5['indexOf'](_0xfa01('0x35'))>=0x0?!![]:![];logger['info'](_0xfa01('0x36'),_0x2c56ef['id'],_0xa7ab86['id'],_0xa7ab86[_0xfa01('0x33')],_0x2c0722?_0xfa01('0x37'):_0xfa01('0x38'),_0x2c56ef[_0xfa01('0x31')]?_0x2c56ef[_0xfa01('0x31')]:_0xfa01('0x39'));return _0x2c0722;})[_0xfa01('0x1e')](function(_0x5dd215){logger[_0xfa01('0x1a')](_0xfa01('0x36'),_0x2c56ef['id'],_0xa7ab86['id'],_0xa7ab86[_0xfa01('0x33')],util[_0xfa01('0x3a')](_0x5dd215,{'showHidden':![],'depth':null}),_0x2c56ef[_0xfa01('0x31')]?_0x2c56ef[_0xfa01('0x31')]:_0xfa01('0x39'));return![];});}function checkWebsiteIntervals(_0x556b54){var _0x109212=_['map'](_0x556b54[_0xfa01('0x3b')][_0xfa01('0x3c')],function(_0x588969){var _0x12a887=_0x588969[_0xfa01('0x3d')]({'plain':!![]});return iftimePromise(_0x12a887,_0x556b54);});return Promise[_0xfa01('0x3e')](_0x109212)[_0xfa01('0x28')](function(_0x201897){return _[_0xfa01('0x3f')](_0x201897);});}function createInteractionObject(_0x36666a,_0x1f02c6,_0x3615a7,_0x1b0af4){var _0x57e873=require(_0xfa01('0x40'));var _0x31b534=new _0x57e873();var _0x2344ad=_0x31b534[_0xfa01('0x41')](_0x3615a7[_0xfa01('0x42')])[_0xfa01('0x43')]();var _0x3d468a=_0x1f02c6[_0xfa01('0x44')];if(_0x3615a7[_0xfa01('0x45')]){_0x3d468a=_0x3615a7[_0xfa01('0x45')];}else if(_0x3615a7[_0xfa01('0x46')]){_0x3d468a=_[_0xfa01('0x47')](_0x3615a7[_0xfa01('0x46')][_0xfa01('0x48')](','));}return{'ContactId':_0x1b0af4['id'],'ChatWebsiteId':_0x36666a,'from':(_0x1b0af4['firstName']||'')+'\x20'+(_0x1b0af4[_0xfa01('0x49')]||''),'customerIp':_0x3d468a,'customerPort':_0x3615a7[_0xfa01('0x4a')]?_0x3615a7[_0xfa01('0x4a')]:null,'referer':_0x1f02c6[_0xfa01('0x4b')],'browserName':_0x2344ad[_0xfa01('0x4c')][_0xfa01('0x2e')]&&_0x2344ad['browser'][_0xfa01('0x4d')]?util['format']('%s\x20%s',_0x2344ad[_0xfa01('0x4c')][_0xfa01('0x2e')],_0x2344ad[_0xfa01('0x4c')][_0xfa01('0x4d')]):'unknown','browserVersion':_0x2344ad[_0xfa01('0x4c')][_0xfa01('0x4d')]||_0xfa01('0x4e'),'osName':util[_0xfa01('0x32')](_0xfa01('0x4f'),_0x2344ad['os'][_0xfa01('0x2e')],_0x2344ad['os']['version']),'osVersion':_0x2344ad['os']['version'],'deviceModel':_0x2344ad[_0xfa01('0x50')][_0xfa01('0x51')]&&_0x2344ad[_0xfa01('0x50')]['vendor']?util[_0xfa01('0x32')](_0xfa01('0x52'),_0x2344ad[_0xfa01('0x50')][_0xfa01('0x51')],_0x2344ad[_0xfa01('0x50')]['vendor'],_0x2344ad[_0xfa01('0x50')]['type']):null,'deviceVendor':_0x2344ad[_0xfa01('0x50')]['vendor'],'deviceType':_0x2344ad['device'][_0xfa01('0x53')],'formData':JSON[_0xfa01('0x54')](_0x1f02c6)};}exports[_0xfa01('0x55')]=function(_0x57f9c9,_0x2aa582){var _0x44c728={'include':[{'model':db[_0xfa01('0x56')],'as':_0xfa01('0x57')}]},_0x4ec461={},_0x32f7bd={'count':0x0,'rows':[]};var _0x5a16b7=_['map'](db[_0xfa01('0x58')]['rawAttributes'],function(_0x4805fb){return{'name':_0x4805fb['fieldName'],'type':_0x4805fb[_0xfa01('0x53')][_0xfa01('0x59')]};});_0x4ec461[_0xfa01('0x51')]=_[_0xfa01('0x5a')](_0x5a16b7,'name');_0x4ec461[_0xfa01('0x5b')]=_['keys'](_0x57f9c9[_0xfa01('0x5b')]);_0x4ec461[_0xfa01('0x5c')]=_[_0xfa01('0x5d')](_0x4ec461['model'],_0x4ec461[_0xfa01('0x5b')]);_0x44c728[_0xfa01('0x5e')]=_[_0xfa01('0x5d')](_0x4ec461['model'],qs['fields'](_0x57f9c9['query']['fields']));_0x44c728['attributes']=_0x44c728[_0xfa01('0x5e')][_0xfa01('0x5f')]?_0x44c728[_0xfa01('0x5e')]:_0x4ec461[_0xfa01('0x51')];if(!_0x57f9c9[_0xfa01('0x5b')][_0xfa01('0x60')](_0xfa01('0x61'))){_0x44c728[_0xfa01('0x22')]=qs[_0xfa01('0x22')](_0x57f9c9['query'][_0xfa01('0x22')]);_0x44c728[_0xfa01('0x20')]=qs[_0xfa01('0x20')](_0x57f9c9['query']['offset']);}_0x44c728[_0xfa01('0x62')]=qs[_0xfa01('0x63')](_0x57f9c9['query'][_0xfa01('0x63')]);_0x44c728['where']=qs['filters'](_[_0xfa01('0x64')](_0x57f9c9[_0xfa01('0x5b')],_0x4ec461[_0xfa01('0x5c')]),_0x5a16b7);if(_0x57f9c9['query'][_0xfa01('0x65')]){_0x44c728[_0xfa01('0x66')]=_[_0xfa01('0x67')](_0x44c728[_0xfa01('0x66')],{'$or':_[_0xfa01('0x5a')](_0x5a16b7,function(_0x4ebc51){if(_0x4ebc51[_0xfa01('0x53')]!==_0xfa01('0x68')){var _0x3abf53={};_0x3abf53[_0x4ebc51['name']]={'$like':'%'+_0x57f9c9[_0xfa01('0x5b')][_0xfa01('0x65')]+'%'};return _0x3abf53;}})});}_0x44c728=_[_0xfa01('0x67')]({},_0x44c728,_0x57f9c9['options']);var _0x35d770={'where':_0x44c728['where']};return db[_0xfa01('0x58')][_0xfa01('0x23')](_0x35d770)[_0xfa01('0x28')](function(_0x184df3){_0x32f7bd[_0xfa01('0x23')]=_0x184df3;if(_0x57f9c9[_0xfa01('0x5b')][_0xfa01('0x69')]){_0x44c728[_0xfa01('0x6a')]=[{'all':!![]}];}return db[_0xfa01('0x58')][_0xfa01('0x6b')](_0x44c728);})[_0xfa01('0x28')](function(_0x45babe){_0x32f7bd[_0xfa01('0x6c')]=_0x45babe;return _0x32f7bd;})['then'](respondWithFilteredResult(_0x2aa582,_0x44c728))[_0xfa01('0x1e')](handleError(_0x2aa582,null));};exports[_0xfa01('0x6d')]=function(_0x128f62,_0xdf8941){var _0x4e5568={'raw':![],'where':{'id':_0x128f62[_0xfa01('0x6e')]['id']},'include':[{'model':db[_0xfa01('0x56')],'as':'mandatoryDispositionPause'}]},_0x5df919={};_0x5df919[_0xfa01('0x51')]=_[_0xfa01('0x6f')](db[_0xfa01('0x58')][_0xfa01('0x70')]);_0x5df919[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0x128f62['query']);_0x5df919['filters']=_[_0xfa01('0x5d')](_0x5df919[_0xfa01('0x51')],_0x5df919['query']);_0x4e5568['attributes']=_[_0xfa01('0x5d')](_0x5df919[_0xfa01('0x51')],qs[_0xfa01('0x71')](_0x128f62['query'][_0xfa01('0x71')]));_0x4e5568['attributes']=_0x4e5568[_0xfa01('0x5e')][_0xfa01('0x5f')]?_0x4e5568[_0xfa01('0x5e')]:_0x5df919[_0xfa01('0x51')];if(_0x128f62[_0xfa01('0x5b')][_0xfa01('0x69')]){_0x4e5568[_0xfa01('0x6a')]=[{'all':!![]}];}_0x4e5568=_[_0xfa01('0x67')]({},_0x4e5568,_0x128f62[_0xfa01('0x72')]);return db[_0xfa01('0x58')][_0xfa01('0x73')](_0x4e5568)[_0xfa01('0x28')](handleEntityNotFound(_0xdf8941,null))['then'](respondWithResult(_0xdf8941,null))[_0xfa01('0x1e')](handleError(_0xdf8941,null));};exports[_0xfa01('0x74')]=function(_0x5829c0,_0x1e7560){return db['ChatWebsite'][_0xfa01('0x74')](_0x5829c0[_0xfa01('0x75')],{})[_0xfa01('0x28')](function(_0xa52269){var _0x1f3d6e=_0x5829c0['user']['get']({'plain':!![]});if(!_0x1f3d6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f3d6e[_0xfa01('0x76')]===_0xfa01('0x77')){var _0x23a65c=_0xa52269['get']({'plain':!![]});var _0xc2769a=_0xfa01('0x2a');return db[_0xfa01('0x78')][_0xfa01('0x73')]({'where':{'name':_0xc2769a,'userProfileId':_0x1f3d6e[_0xfa01('0x79')]},'raw':!![]})[_0xfa01('0x28')](function(_0x13c7d3){if(_0x13c7d3&&_0x13c7d3['autoAssociation']===0x0){return db[_0xfa01('0x7a')][_0xfa01('0x74')]({'name':_0x23a65c[_0xfa01('0x2e')],'resourceId':_0x23a65c['id'],'type':_0x13c7d3['name'],'sectionId':_0x13c7d3['id']},{})[_0xfa01('0x28')](function(){return _0xa52269;});}else{return _0xa52269;}})[_0xfa01('0x1e')](function(_0x3df986){logger[_0xfa01('0x1a')](_0xfa01('0x7b'),_0x3df986);throw _0x3df986;});}return _0xa52269;})['then'](respondWithResult(_0x1e7560,0xc9))['catch'](handleError(_0x1e7560,null));};exports['update']=function(_0xe20704,_0x26726e){if(_0xe20704[_0xfa01('0x75')]['id']){delete _0xe20704[_0xfa01('0x75')]['id'];}return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0xe20704['params']['id']},'include':[{'model':db[_0xfa01('0x56')],'as':_0xfa01('0x57')}]})['then'](handleEntityNotFound(_0x26726e,null))[_0xfa01('0x28')](saveUpdates(_0xe20704[_0xfa01('0x75')],null))[_0xfa01('0x28')](respondWithResult(_0x26726e,null))[_0xfa01('0x1e')](handleError(_0x26726e,null));};exports['destroy']=function(_0x5d0b19,_0x38fe79){return db[_0xfa01('0x58')]['find']({'where':{'id':_0x5d0b19[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x38fe79,null))[_0xfa01('0x28')](removeEntity(_0x38fe79,null))[_0xfa01('0x1e')](handleError(_0x38fe79,null));};exports[_0xfa01('0x7c')]=function(_0x29b6b6,_0x3091f1){return db[_0xfa01('0x58')]['describe']()[_0xfa01('0x28')](respondWithResult(_0x3091f1,null))[_0xfa01('0x1e')](handleError(_0x3091f1,null));};exports['addDisposition']=function(_0x36f678,_0x205675){if(_0x36f678[_0xfa01('0x75')]['id']){delete _0x36f678[_0xfa01('0x75')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x36f678[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x205675,null))['then'](function(_0x5658be){if(_0x5658be){_0x36f678[_0xfa01('0x75')][_0xfa01('0x7d')]=_0x5658be['id'];return db[_0xfa01('0x7e')][_0xfa01('0x74')](_0x36f678['body']);}})[_0xfa01('0x28')](respondWithResult(_0x205675,null))['catch'](handleError(_0x205675,null));};exports[_0xfa01('0x7f')]=function(_0x329f2c,_0x3df010){var _0x5013ad={'raw':![],'where':{}};var _0xe85444={};var _0x1d2a9c={'count':0x0,'rows':[]};return db[_0xfa01('0x58')]['findOne']({'where':{'id':_0x329f2c['params']['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x3df010,null))[_0xfa01('0x28')](function(_0x23b148){if(_0x23b148){_0xe85444[_0xfa01('0x51')]=_[_0xfa01('0x6f')](db['Disposition'][_0xfa01('0x70')]);_0xe85444[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0x329f2c[_0xfa01('0x5b')]);_0xe85444['filters']=_[_0xfa01('0x5d')](_0xe85444[_0xfa01('0x51')],_0xe85444[_0xfa01('0x5b')]);_0x5013ad[_0xfa01('0x5e')]=_[_0xfa01('0x5d')](_0xe85444[_0xfa01('0x51')],qs[_0xfa01('0x71')](_0x329f2c[_0xfa01('0x5b')][_0xfa01('0x71')]));_0x5013ad[_0xfa01('0x5e')]=_0x5013ad['attributes'][_0xfa01('0x5f')]?_0x5013ad['attributes']:_0xe85444[_0xfa01('0x51')];if(!_0x329f2c[_0xfa01('0x5b')][_0xfa01('0x60')](_0xfa01('0x61'))){_0x5013ad['limit']=qs['limit'](_0x329f2c[_0xfa01('0x5b')][_0xfa01('0x22')]);_0x5013ad[_0xfa01('0x20')]=qs[_0xfa01('0x20')](_0x329f2c[_0xfa01('0x5b')]['offset']);}_0x5013ad[_0xfa01('0x62')]=qs[_0xfa01('0x63')](_0x329f2c[_0xfa01('0x5b')][_0xfa01('0x63')]);_0x5013ad[_0xfa01('0x66')]=qs[_0xfa01('0x5c')](_[_0xfa01('0x64')](_0x329f2c[_0xfa01('0x5b')],_0xe85444[_0xfa01('0x5c')]));_0x5013ad[_0xfa01('0x66')]['ChatWebsiteId']=_0x23b148['id'];if(_0x329f2c[_0xfa01('0x5b')]['filter']){_0x5013ad['where']=_['merge'](_0x5013ad['where'],{'$or':_['map'](_0x5013ad['attributes'],function(_0x627efe){var _0x316e1c={};_0x316e1c[_0x627efe]={'$like':'%'+_0x329f2c[_0xfa01('0x5b')][_0xfa01('0x65')]+'%'};return _0x316e1c;})});}_0x5013ad=_['merge']({},_0x5013ad,_0x329f2c[_0xfa01('0x72')]);return db[_0xfa01('0x7e')][_0xfa01('0x23')]({'where':_0x5013ad['where']})[_0xfa01('0x28')](function(_0x272bc9){_0x1d2a9c[_0xfa01('0x23')]=_0x272bc9;if(_0x329f2c['query'][_0xfa01('0x69')]){_0x5013ad[_0xfa01('0x6a')]=[{'all':!![]}];}return db[_0xfa01('0x7e')][_0xfa01('0x6b')](_0x5013ad);})[_0xfa01('0x28')](function(_0x218b84){_0x1d2a9c[_0xfa01('0x6c')]=_0x218b84;return _0x1d2a9c;});}})['then'](respondWithFilteredResult(_0x3df010,_0x5013ad))['catch'](handleError(_0x3df010,null));};exports[_0xfa01('0x80')]=function(_0x27c93e,_0x59f528){return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x27c93e[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x59f528,null))['then'](function(_0x4ce351){if(_0x4ce351){return _0x4ce351[_0xfa01('0x80')](_0x27c93e[_0xfa01('0x5b')][_0xfa01('0x81')]);}})[_0xfa01('0x28')](respondWithStatusCode(_0x59f528,null))['catch'](handleError(_0x59f528,null));};exports[_0xfa01('0x82')]=function(_0x524551,_0x54fbfe){if(_0x524551[_0xfa01('0x75')]['id']){delete _0x524551['body']['id'];}return db['ChatWebsite'][_0xfa01('0x73')]({'where':{'id':_0x524551[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x54fbfe,null))['then'](function(_0x536805){if(_0x536805){_0x524551[_0xfa01('0x75')][_0xfa01('0x7d')]=_0x536805['id'];return db[_0xfa01('0x83')][_0xfa01('0x74')](_0x524551[_0xfa01('0x75')]);}})[_0xfa01('0x28')](respondWithResult(_0x54fbfe,null))['catch'](handleError(_0x54fbfe,null));};exports[_0xfa01('0x84')]=function(_0x2f9d5f,_0x18a7e0){var _0x3f35e2={'raw':![],'where':{}};var _0x293d96={};var _0x519748={'count':0x0,'rows':[]};return db[_0xfa01('0x58')][_0xfa01('0x85')]({'where':{'id':_0x2f9d5f[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x18a7e0,null))[_0xfa01('0x28')](function(_0x1a2297){if(_0x1a2297){_0x293d96['model']=_['keys'](db['CannedAnswer'][_0xfa01('0x70')]);_0x293d96[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0x2f9d5f[_0xfa01('0x5b')]);_0x293d96[_0xfa01('0x5c')]=_['intersection'](_0x293d96['model'],_0x293d96['query']);_0x3f35e2[_0xfa01('0x5e')]=_[_0xfa01('0x5d')](_0x293d96[_0xfa01('0x51')],qs['fields'](_0x2f9d5f['query'][_0xfa01('0x71')]));_0x3f35e2[_0xfa01('0x5e')]=_0x3f35e2[_0xfa01('0x5e')][_0xfa01('0x5f')]?_0x3f35e2[_0xfa01('0x5e')]:_0x293d96[_0xfa01('0x51')];if(!_0x2f9d5f[_0xfa01('0x5b')][_0xfa01('0x60')](_0xfa01('0x61'))){_0x3f35e2[_0xfa01('0x22')]=qs[_0xfa01('0x22')](_0x2f9d5f['query']['limit']);_0x3f35e2[_0xfa01('0x20')]=qs[_0xfa01('0x20')](_0x2f9d5f[_0xfa01('0x5b')][_0xfa01('0x20')]);}_0x3f35e2[_0xfa01('0x62')]=qs[_0xfa01('0x63')](_0x2f9d5f[_0xfa01('0x5b')][_0xfa01('0x63')]);_0x3f35e2[_0xfa01('0x66')]=qs[_0xfa01('0x5c')](_['pick'](_0x2f9d5f['query'],_0x293d96[_0xfa01('0x5c')]));_0x3f35e2['where'][_0xfa01('0x7d')]=_0x1a2297['id'];if(_0x2f9d5f[_0xfa01('0x5b')][_0xfa01('0x65')]){_0x3f35e2[_0xfa01('0x66')]=_[_0xfa01('0x67')](_0x3f35e2['where'],{'$or':_[_0xfa01('0x5a')](_0x3f35e2[_0xfa01('0x5e')],function(_0x1f3bbc){var _0x2d1858={};_0x2d1858[_0x1f3bbc]={'$like':'%'+_0x2f9d5f[_0xfa01('0x5b')]['filter']+'%'};return _0x2d1858;})});}_0x3f35e2=_[_0xfa01('0x67')]({},_0x3f35e2,_0x2f9d5f[_0xfa01('0x72')]);return db[_0xfa01('0x83')][_0xfa01('0x23')]({'where':_0x3f35e2[_0xfa01('0x66')]})['then'](function(_0x43bb34){_0x519748['count']=_0x43bb34;if(_0x2f9d5f['query'][_0xfa01('0x69')]){_0x3f35e2['include']=[{'all':!![]}];}return db[_0xfa01('0x83')]['findAll'](_0x3f35e2);})[_0xfa01('0x28')](function(_0xeb64f8){_0x519748[_0xfa01('0x6c')]=_0xeb64f8;return _0x519748;});}})[_0xfa01('0x28')](respondWithFilteredResult(_0x18a7e0,_0x3f35e2))[_0xfa01('0x1e')](handleError(_0x18a7e0,null));};exports['removeAnswers']=function(_0x2d02ee,_0x29c867){return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x2d02ee[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x29c867,null))[_0xfa01('0x28')](function(_0x452c41){if(_0x452c41){return _0x452c41['removeAnswers'](_0x2d02ee['query'][_0xfa01('0x81')]);}})[_0xfa01('0x28')](respondWithStatusCode(_0x29c867,null))['catch'](handleError(_0x29c867,null));};exports[_0xfa01('0x86')]=function(_0x2b2744,_0x384db9){_0x2b2744['body'][_0xfa01('0x87')]=_0x2b2744[_0xfa01('0x88')]['filename'];return db['ChatWebsite'][_0xfa01('0x73')]({'where':{'id':_0x2b2744[_0xfa01('0x6e')]['id']}})['then'](handleEntityNotFound(_0x384db9,null))['then'](saveUpdates(_0x2b2744[_0xfa01('0x75')],null))[_0xfa01('0x28')](respondWithResult(_0x384db9,null))[_0xfa01('0x1e')](handleError(_0x384db9,null));};exports['addAvatar']=function(_0x320c65,_0x3a4770){_0x320c65[_0xfa01('0x75')][_0xfa01('0x89')]=_0x320c65[_0xfa01('0x88')][_0xfa01('0x8a')];return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x320c65[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x3a4770,null))[_0xfa01('0x28')](saveUpdates(_0x320c65[_0xfa01('0x75')],null))[_0xfa01('0x28')](respondWithResult(_0x3a4770,null))['catch'](handleError(_0x3a4770,null));};exports[_0xfa01('0x8b')]=function(_0x75a1af,_0x423f94){_0x75a1af[_0xfa01('0x75')][_0xfa01('0x8c')]=_0x75a1af[_0xfa01('0x88')][_0xfa01('0x8a')];return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x75a1af[_0xfa01('0x6e')]['id']}})['then'](handleEntityNotFound(_0x423f94,null))[_0xfa01('0x28')](saveUpdates(_0x75a1af[_0xfa01('0x75')],null))[_0xfa01('0x28')](respondWithResult(_0x423f94,null))[_0xfa01('0x1e')](handleError(_0x423f94,null));};exports[_0xfa01('0x8d')]=function(_0x387f7b,_0x21bc2c){_0x387f7b[_0xfa01('0x75')][_0xfa01('0x8e')]=_0x387f7b[_0xfa01('0x88')][_0xfa01('0x8a')];return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x387f7b[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x21bc2c,null))[_0xfa01('0x28')](saveUpdates(_0x387f7b[_0xfa01('0x75')],null))['then'](respondWithResult(_0x21bc2c,null))[_0xfa01('0x1e')](handleError(_0x21bc2c,null));};exports[_0xfa01('0x8f')]=function(_0x32654d,_0x2cecb3){var _0x7f3d6c=path['join'](config[_0xfa01('0x90')],'server/files/images/logos/default_logo.svg');var _0x42aab7={'where':{'id':_0x32654d['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x33ed99=![];return require(_0xfa01('0x91'))[_0xfa01('0x92')]()[_0xfa01('0x28')](function(_0x4904ae){if(_0x4904ae){_0x33ed99=_0x4904ae['custom'];}})['then'](function(){return db[_0xfa01('0x58')][_0xfa01('0x73')](_0x42aab7);})[_0xfa01('0x28')](handleEntityNotFound(_0x2cecb3,null))[_0xfa01('0x28')](function(_0x45b30b){if(_0x45b30b){if(!_[_0xfa01('0x93')](_0x45b30b[_0xfa01('0x87')])){if(fs[_0xfa01('0x94')](path[_0xfa01('0x95')](config[_0xfa01('0x90')],_0xfa01('0x96'),_0x45b30b[_0xfa01('0x87')]))&&_0x33ed99){_0x7f3d6c=path[_0xfa01('0x95')](config[_0xfa01('0x90')],_0xfa01('0x96'),_0x45b30b[_0xfa01('0x87')]);}}return _0x2cecb3[_0xfa01('0x97')](_0x7f3d6c);}})[_0xfa01('0x1e')](handleError(_0x2cecb3,null));};exports[_0xfa01('0x98')]=function(_0x443801,_0x494099){var _0x22862e=path[_0xfa01('0x95')](config['root'],_0xfa01('0x99'));var _0x419511={'where':{'id':_0x443801[_0xfa01('0x6e')]['id']},'attributes':['id',_0xfa01('0x89')],'raw':!![]};return db[_0xfa01('0x58')][_0xfa01('0x73')](_0x419511)[_0xfa01('0x28')](handleEntityNotFound(_0x494099,null))[_0xfa01('0x28')](function(_0x3ccc2e){if(_0x3ccc2e){if(!_[_0xfa01('0x93')](_0x3ccc2e['agentAvatar'])){if(fs[_0xfa01('0x94')](path[_0xfa01('0x95')](config[_0xfa01('0x90')],_0xfa01('0x9a'),_0x3ccc2e['agentAvatar']))){_0x22862e=path[_0xfa01('0x95')](config[_0xfa01('0x90')],_0xfa01('0x9a'),_0x3ccc2e['agentAvatar']);}}return _0x494099[_0xfa01('0x97')](_0x22862e);}})[_0xfa01('0x1e')](handleError(_0x494099,null));};exports['getCustomerAvatar']=function(_0x4b6a5b,_0x53ffea){var _0x2360d1=path['join'](config[_0xfa01('0x90')],_0xfa01('0x9b'));var _0x4db772={'where':{'id':_0x4b6a5b[_0xfa01('0x6e')]['id']},'attributes':['id',_0xfa01('0x8c'),'showCustomerAvatar'],'raw':!![]};return db[_0xfa01('0x58')]['find'](_0x4db772)[_0xfa01('0x28')](handleEntityNotFound(_0x53ffea,null))[_0xfa01('0x28')](function(_0xd2c2e7){if(_0xd2c2e7){if(!_[_0xfa01('0x93')](_0xd2c2e7[_0xfa01('0x8c')])){if(fs[_0xfa01('0x94')](path[_0xfa01('0x95')](config['root'],_0xfa01('0x9a'),_0xd2c2e7[_0xfa01('0x8c')]))&&_0xd2c2e7[_0xfa01('0x9c')]){_0x2360d1=path['join'](config['root'],_0xfa01('0x9a'),_0xd2c2e7[_0xfa01('0x8c')]);}}return _0x53ffea['download'](_0x2360d1);}})[_0xfa01('0x1e')](handleError(_0x53ffea,null));};exports['getSystemAvatar']=function(_0x2921a4,_0xd06084){var _0x31c118=path[_0xfa01('0x95')](config[_0xfa01('0x90')],'server/files/images/avatars/system_avatar.png');var _0x3af595={'where':{'id':_0x2921a4[_0xfa01('0x6e')]['id']},'attributes':['id',_0xfa01('0x8e')],'raw':!![]};return db['ChatWebsite'][_0xfa01('0x73')](_0x3af595)[_0xfa01('0x28')](handleEntityNotFound(_0xd06084,null))[_0xfa01('0x28')](function(_0x1f9045){if(_0x1f9045){if(!_[_0xfa01('0x93')](_0x1f9045['systemAvatar'])){if(fs[_0xfa01('0x94')](path[_0xfa01('0x95')](config[_0xfa01('0x90')],'server/files/images/avatars/',_0x1f9045[_0xfa01('0x8e')]))){_0x31c118=path[_0xfa01('0x95')](config['root'],_0xfa01('0x9a'),_0x1f9045[_0xfa01('0x8e')]);}}return _0xd06084[_0xfa01('0x97')](_0x31c118);}})['catch'](handleError(_0xd06084,null));};exports[_0xfa01('0x9d')]=function(_0x6728fc,_0x136f0c){var _0x5a0a98={'body':_0x6728fc[_0xfa01('0x75')],'channel':'chat'};var _0x43dc86=[];var _0x59c59a=[];var _0x412e04={};var _0x2695aa=![];return db[_0xfa01('0x9e')][_0xfa01('0x7c')]()['then'](function(_0x18a305){if(!_0x18a305){throw new db['Sequelize'][(_0xfa01('0x9f'))](_0xfa01('0xa0'));}_0x43dc86=_['difference'](_['keys'](_0x18a305),[_0xfa01('0xa1'),_0xfa01('0xa2')]);_0x59c59a=_[_0xfa01('0xa3')](_['keys'](_0x18a305),['createdAt',_0xfa01('0xa2'),_0xfa01('0xa4'),_0xfa01('0xa5')]);if(_0x6728fc['body']['id']){delete _0x6728fc['body']['id'];}if(_[_0xfa01('0x93')](_0x6728fc[_0xfa01('0x75')][_0xfa01('0xa6')])){throw new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))](_0xfa01('0xa8'));}if(_['isNil'](_0x6728fc[_0xfa01('0x75')]['body'])||_0x6728fc['body'][_0xfa01('0x75')]===''){throw new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))](_0xfa01('0xa9'));}if(_[_0xfa01('0x93')](_0x6728fc[_0xfa01('0x75')][_0xfa01('0xaa')])){throw new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59c59a);}if(!_[_0xfa01('0xab')](_0x59c59a,_0x6728fc[_0xfa01('0x75')][_0xfa01('0xaa')])){throw new db['Sequelize'][(_0xfa01('0x9f'))](_0xfa01('0xac')+_0x59c59a);}_0x412e04[_0x6728fc[_0xfa01('0x75')][_0xfa01('0xaa')]]=_0x6728fc['body'][_0xfa01('0xa6')];})['then'](function(){return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x6728fc[_0xfa01('0x6e')]['id']},'include':[{'model':db[_0xfa01('0xad')],'as':'List','include':[{'model':db[_0xfa01('0x9e')],'as':'Contacts','where':_0x412e04,'limit':0x1,'order':[['updatedAt',_0xfa01('0xae')]]}]},{'model':db[_0xfa01('0xaf')],'as':_0xfa01('0xb0')},{'model':db[_0xfa01('0x3b')],'as':_0xfa01('0x3b'),'include':[{'model':db['Interval'],'as':_0xfa01('0x3c'),'attributes':['id',_0xfa01('0x33')],'raw':!![]}]}]});})[_0xfa01('0x28')](function(_0x1d2eeb){if(!_0x1d2eeb)throw new APINotFoundError(util[_0xfa01('0x32')](_0xfa01('0xb1'),_0x6728fc['params']['id']));if(!_0x1d2eeb[_0xfa01('0x3b')]||!_0x1d2eeb['Interval'][_0xfa01('0x3c')])return[_0x1d2eeb,!![]];return[_0x1d2eeb,checkWebsiteIntervals(_0x1d2eeb)];})[_0xfa01('0xb2')](function(_0x3a534f,_0x320417){if(!_0x320417)throw new APIOutOfIntervalError();if(!_0x3a534f[_0xfa01('0xb3')])return;_0x5a0a98[_0xfa01('0xb4')]=_0x3a534f;_0x5a0a98[_0xfa01('0xb5')]=_0x3a534f[_0xfa01('0xb3')];_0x5a0a98[_0xfa01('0xb6')]=_['orderBy'](_0x3a534f[_0xfa01('0xb0')],[_0xfa01('0xb7')],[_0xfa01('0xb8')]);if(_0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xb0')]){delete _0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xb0')];}if(_0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xb3')]&&_0x5a0a98['account'][_0xfa01('0xb3')][_0xfa01('0xb9')][_0xfa01('0x5f')]){return _0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xb3')][_0xfa01('0xb9')][0x0];}var _0x361458=_[_0xfa01('0x10')](_0x6728fc[_0xfa01('0x75')],{'firstName':_0x6728fc['body']['from'],'ListId':_0x3a534f[_0xfa01('0xa5')]});_0x361458[_0x6728fc[_0xfa01('0x75')][_0xfa01('0xaa')]]=_0x6728fc[_0xfa01('0x75')][_0xfa01('0xa6')];return db[_0xfa01('0x9e')][_0xfa01('0x74')](_0x361458,{'fields':_0x43dc86,'raw':!![]});})['then'](function(_0x26ba5e){_0x5a0a98[_0xfa01('0xba')]=_0x26ba5e;var _0x2d3810=createInteractionObject(_0x6728fc[_0xfa01('0x6e')]['id'],_0x6728fc['body'],_0x6728fc['headers'],_0x26ba5e);var _0x409684={'ChatWebsiteId':_0x6728fc[_0xfa01('0x6e')]['id'],'closed':![]};if(_0x6728fc[_0xfa01('0x75')][_0xfa01('0xbb')]){_0x409684[_0xfa01('0xbb')]=_0x6728fc['body'][_0xfa01('0xbb')];return db['ChatInteraction'][_0xfa01('0x73')]({'where':_0x409684})['then'](function(_0x4b9ffb){if(_0x4b9ffb){_0x2695aa=!![];return _0x4b9ffb;}_0x2d3810[_0xfa01('0xbb')]=_0x6728fc[_0xfa01('0x75')][_0xfa01('0xbb')];_0x2d3810[_0xfa01('0xbc')]=_0x6728fc[_0xfa01('0x75')]['externalUrl'];return db[_0xfa01('0xbd')]['create'](_0x2d3810);});}_0x409684[_0xfa01('0xbe')]=_0x26ba5e['id'];if(_0x6728fc[_0xfa01('0x75')][_0xfa01('0xbf')]&&_0x6728fc[_0xfa01('0x75')][_0xfa01('0xbf')]['id']){_0x409684['id']=_0x6728fc[_0xfa01('0x75')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x409684})[_0xfa01('0x28')](function(_0x3d2111){if(_0x3d2111){_0x2695aa=!![];return _0x3d2111;}return db['ChatInteraction'][_0xfa01('0x74')](_0x2d3810);});}return db[_0xfa01('0xbd')][_0xfa01('0x74')](_0x2d3810);})[_0xfa01('0x28')](function(_0x34cbd4){if(!_0x2695aa)return _0x34cbd4;var _0x559c3d={'from':(_0x5a0a98[_0xfa01('0xba')][_0xfa01('0xc0')]||'')+'\x20'+(_0x5a0a98['contact'][_0xfa01('0x49')]||'')};if(_0x6728fc[_0xfa01('0x75')]['threadId']&&_0x6728fc['body'][_0xfa01('0xc1')]&&_0x6728fc[_0xfa01('0x75')][_0xfa01('0xbb')]!=_0x6728fc[_0xfa01('0x75')][_0xfa01('0xc1')]){_0x559c3d['threadId']=_0x6728fc[_0xfa01('0x75')][_0xfa01('0xc1')];}return _0x34cbd4[_0xfa01('0x27')](_0x559c3d);})['then'](function(_0x38ff9f){_0x5a0a98['interaction']=_0x38ff9f[_0xfa01('0x3d')]({'plain':!![]});_0x5a0a98[_0xfa01('0xbf')]['created']=!_0x2695aa;if(_0x5a0a98['interaction']['created']){if(_0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xc2')]){_0x5a0a98[_0xfa01('0xb6')]['push']({'id':0x0,'priority':_0x5a0a98[_0xfa01('0xb6')][_0xfa01('0x5f')]+0x1,'app':'close','appdata':_0xfa01('0xc3'),'interval':_0xfa01('0xc4')});}}return db[_0xfa01('0xc5')][_0xfa01('0x74')]({'body':_0x6728fc[_0xfa01('0x75')][_0xfa01('0x75')],'ChatWebsiteId':_0x6728fc[_0xfa01('0x6e')]['id'],'ChatInteractionId':_0x38ff9f['id'],'direction':'in','ContactId':_0x5a0a98[_0xfa01('0xba')]['id'],'AttachmentId':_0x6728fc[_0xfa01('0x75')][_0xfa01('0xc6')]});})[_0xfa01('0x28')](function(_0x25f185){_0x5a0a98[_0xfa01('0x1c')]=_0x25f185;if(!_0x5a0a98['interaction'][_0xfa01('0xc7')]){return;}return db['User'][_0xfa01('0x73')]({'attributes':['id',_0xfa01('0x2e')],'where':{'id':_0x5a0a98[_0xfa01('0xbf')]['UserId']}});})[_0xfa01('0x28')](function(_0x34c2e4){if(_0x34c2e4){_0x5a0a98['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xfa01('0xc8'),'appdata':_0x34c2e4['name']+','+(_0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xc9')]||0xa),'interval':_0xfa01('0xc4')});_0x5a0a98[_0xfa01('0xca')]=!![];}if(!_0x5a0a98[_0xfa01('0xbf')][_0xfa01('0xcb')]){return;}return db['ChatQueue']['find']({'attributes':['id',_0xfa01('0x2e')],'where':{'id':_0x5a0a98[_0xfa01('0xbf')][_0xfa01('0xcb')]}});})[_0xfa01('0x28')](function(_0x3a4e27){if(_0x3a4e27){_0x5a0a98[_0xfa01('0xb6')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3a4e27[_0xfa01('0x2e')]+','+(_0x5a0a98[_0xfa01('0xb4')][_0xfa01('0xcc')]||0x12c),'interval':_0xfa01('0xc4')});}return respondWithRpcPromise(_0xfa01('0xcd'),'startRouting',_0x5a0a98);})[_0xfa01('0x28')](function(_0x29ad8f){respondWithRpcPromise(_0xfa01('0xce'),_0xfa01('0xce'),{'event':_0xfa01('0x9d'),'message':_0x29ad8f},client9002);return _0x29ad8f;})['then'](respondWithResult(_0x136f0c,null))[_0xfa01('0x1e')](APIHandleError(_0x136f0c));};exports[_0xfa01('0xcf')]=function(_0x1381cb,_0x40260b){var _0x3ae686,_0x3930d9,_0x407f07;var _0x14e3a5=[];var _0x2f973f={};var _0x3c0be3=_0x1381cb['files']||[];var _0x56af1b=[];var _0x22f9a2;return db['CmContact'][_0xfa01('0x7c')]()[_0xfa01('0x28')](function(_0x4d713e){if(!_0x4d713e){throw new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))]('no\x20available\x20attributes');}_0x14e3a5=_[_0xfa01('0xa3')](_[_0xfa01('0x6f')](_0x4d713e),[_0xfa01('0xa1'),_0xfa01('0xa2'),_0xfa01('0xa4'),_0xfa01('0xa5')]);if(_0x1381cb[_0xfa01('0x75')]['id']){delete _0x1381cb['body']['id'];}if(_[_0xfa01('0x93')](_0x1381cb[_0xfa01('0x75')][_0xfa01('0xa6')])){throw _0x40260b[_0xfa01('0x1f')](0x1f4)[_0xfa01('0x2f')](new db['Sequelize'][(_0xfa01('0x9f'))](_0xfa01('0xa8')));}if(_[_0xfa01('0x93')](_0x1381cb[_0xfa01('0x75')][_0xfa01('0x75')])||_0x1381cb[_0xfa01('0x75')][_0xfa01('0x75')]===''){throw _0x40260b['status'](0x1f4)['send'](new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))](_0xfa01('0xa9')));}if(_['isNil'](_0x1381cb[_0xfa01('0x75')]['mapKeyOffline'])){throw _0x40260b[_0xfa01('0x1f')](0x1f4)[_0xfa01('0x2f')](new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))](_0xfa01('0xd0')+_0x14e3a5));}if(!_[_0xfa01('0xab')](_0x14e3a5,_0x1381cb[_0xfa01('0x75')][_0xfa01('0xd1')])){throw _0x40260b[_0xfa01('0x1f')](0x1f4)['send'](new db[(_0xfa01('0xa7'))][(_0xfa01('0x9f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14e3a5));}_0x2f973f[_0x1381cb[_0xfa01('0x75')][_0xfa01('0xd1')]]=_0x1381cb[_0xfa01('0x75')]['from'];})[_0xfa01('0x28')](function(){return db['ChatWebsite'][_0xfa01('0x73')]({'where':{'id':_0x1381cb[_0xfa01('0x6e')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xfa01('0xd2')],'as':_0xfa01('0xd2')}]});})[_0xfa01('0x28')](handleEntityNotFound(_0x40260b,null))['then'](function(_0x27017c){if(_0x27017c&&_0x27017c[_0xfa01('0xb3')]){_0x3930d9=_0x27017c;var _0x17c166=_['defaults'](_0x1381cb[_0xfa01('0x75')],{'firstName':_0x1381cb[_0xfa01('0x75')][_0xfa01('0xa6')],'phone':_0x1381cb[_0xfa01('0x75')][_0xfa01('0xa6')],'ListId':_0x27017c[_0xfa01('0xa5')]});_0x17c166[_0x1381cb['body'][_0xfa01('0xd1')]]=_0x1381cb['body'][_0xfa01('0xa6')];return db[_0xfa01('0x9e')][_0xfa01('0xd3')]({'where':_0x2f973f,'defaults':_0x17c166});}})[_0xfa01('0xb2')](function(_0x1f9b25){if(_0x1f9b25){_0x407f07=_0x1f9b25;var _0x5b17b7=fs['readFileSync'](path['join'](config['root'],_0xfa01('0xd4')),_0xfa01('0xd5'));var _0x4f1188=ejs[_0xfa01('0xd6')](_0x5b17b7,{'body':_[_0xfa01('0xd7')](_0x1381cb[_0xfa01('0x75')][_0xfa01('0x75')]),'bodyTitle':_0x3930d9[_0xfa01('0xd8')]});return db[_0xfa01('0xd9')]['create']({'body':_0x4f1188,'plainBody':htmlToText['fromString'](_0x4f1188),'ContactId':_0x1f9b25['id'],'ChatWebsiteId':_0x3930d9['id']});}})[_0xfa01('0x28')](function(_0x37f354){_0x22f9a2=_0x37f354;if(_0x3c0be3[_0xfa01('0x5f')]){var _0x5206f0=_0x3c0be3['map'](function(_0x1b7ee0){return{'name':_0x1b7ee0[_0xfa01('0xda')],'basename':_0x1b7ee0['filename'],'type':_0x1b7ee0['mimetype'],'ChatOfflineMessageId':_0x37f354['id']};});_0x56af1b=_0x5206f0['map'](_0x597d9c=>{var _0x1e974a={'filename':_0x597d9c[_0xfa01('0x2e')],'path':path[_0xfa01('0x95')](config['root'],_0xfa01('0xdb'),_0xfa01('0xdc'),_0xfa01('0xdd'),_0xfa01('0xde'),_0x597d9c[_0xfa01('0xdf')])};return _0x1e974a;});if(!_0x3930d9['openNewInteraction']){return db[_0xfa01('0xe0')][_0xfa01('0xe1')](function(_0x394df1){return db[_0xfa01('0xe2')][_0xfa01('0xe3')](_0x5206f0,{'transaction':_0x394df1});});}}})[_0xfa01('0x28')](function(){if(_0x22f9a2){_0x3ae686=_0x22f9a2;return db[_0xfa01('0xd2')][_0xfa01('0x85')]({'where':{'service':!![]},'include':[{'model':db[_0xfa01('0xe4')],'as':_0xfa01('0xe5'),'raw':!![],'include':[{'model':db[_0xfa01('0xe6')],'as':_0xfa01('0xe6'),'raw':!![]}]}]});}})['then'](function(_0x14a999){if(_0x14a999&&_0x14a999['Smtp']&&_0x3930d9['forwardOffline']&&_0x3930d9[_0xfa01('0xe7')]){var _0x4f852c=_0x14a999[_0xfa01('0xe8')]();return respondWithRpcPromise(_0xfa01('0xe9'),_0xfa01('0xea'),{'account':_0x4f852c,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x14a999[_0xfa01('0x2e')],_0x14a999['email']||_0x14a999[_0xfa01('0xe5')][_0xfa01('0x77')]),'to':_0x3930d9['forwardOfflineAddress'],'subject':_0x3930d9[_0xfa01('0xeb')],'html':_0x3ae686[_0xfa01('0x75')],'attachments':_0x56af1b}},client9003)[_0xfa01('0x28')](function(){return _0x3ae686;})[_0xfa01('0x1e')](function(_0x1f2dae){logger[_0xfa01('0x1a')](_0x1f2dae);});}})[_0xfa01('0x28')](function(){if(_0x3930d9&&_0x3930d9[_0xfa01('0xec')]&&_0x3930d9['MailAccountId']){var _0x258e51=[];if(_0x3c0be3[_0xfa01('0x5f')]){_0x258e51=_0x3c0be3[_0xfa01('0x5a')](function(_0x55c231){return{'name':_0x55c231[_0xfa01('0xda')],'basename':_0x55c231[_0xfa01('0x8a')],'type':_0x55c231[_0xfa01('0xed')],'ChatOfflineMessageId':_0x22f9a2['id']};});}var _0x440c82;if(!_[_0xfa01('0x93')](_0x3930d9[_0xfa01('0xee')])){var _0x3cad20=_['map'](_0x1381cb[_0xfa01('0x75')],function(_0x1e3a9a){return _0x1e3a9a;});var _0x1543c2=_[_0xfa01('0xef')](_0x3cad20)[0x0];var _0x2813d8=_[_0xfa01('0xf0')](_0x1543c2,function(_0x54d8d0){return _0x54d8d0;});_0x440c82=_0x2813d8[0x1][_0x3930d9[_0xfa01('0xee')]];}var _0x328b57={'from':_0x407f07[_0xfa01('0xf1')],'firstName':_0x407f07[_0xfa01('0xc0')],'lastName':_0x407f07[_0xfa01('0x49')],'mapKey':_0xfa01('0xf1'),'message':{'from':_0x407f07[_0xfa01('0xf1')],'to':_0x3930d9[_0xfa01('0xd2')][_0xfa01('0xf1')],'cc':'','subject':_['isNil'](_0x440c82)?_0x3930d9['offlineMessageSubject']:_0x440c82,'messageId':'','sentAt':new Date(),'attach':_0x258e51[_0xfa01('0x5f')],'attachments':_0x258e51,'originChannel':_0xfa01('0xf2'),'ChatWebsiteId':_0x3930d9['id'],'ChatOfflineMessageId':_0x3ae686['id'],'originTo':_0x3930d9[_0xfa01('0xd2')][_0xfa01('0xf1')]},'body':_0x3ae686['body']};var _0x11ae40={'account':{'id':_0x3930d9[_0xfa01('0xf3')]},'body':_0x328b57,'log':_0xfa01('0xf4')};return respondWithRpcPromise(_0xfa01('0xf4'),_0xfa01('0xf5'),_0x11ae40,client9001)[_0xfa01('0x28')](function(){return _0x3ae686;})[_0xfa01('0x1e')](function(_0x424098){logger[_0xfa01('0x1a')](_0x424098);});}return;})[_0xfa01('0x28')](function(){if(_0x3ae686){return _0x3ae686;}})[_0xfa01('0x28')](respondWithResult(_0x40260b,null))['catch'](function(){for(var _0x552b13 of _0x3c0be3){var _0x376ecc=path[_0xfa01('0x95')](config[_0xfa01('0x90')],_0xfa01('0xdb'),_0xfa01('0xdc'),_0xfa01('0xdd'),_0xfa01('0xde'),_0x552b13[_0xfa01('0x8a')]);fs_extra[_0xfa01('0xf6')](_0x376ecc)['catch'](function(_0x482e11){logger['error'](_0xfa01('0xf7'),_0x376ecc,_0x482e11);});}});};exports['addInteraction']=function(_0x11bfa6,_0x19f365){return db[_0xfa01('0xbd')][_0xfa01('0x73')]({'where':{'id':_0x11bfa6['params']['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x19f365,null))['then'](function(_0x2e719a){if(_0x2e719a){return _0x2e719a[_0xfa01('0xf8')](_0x11bfa6['body'][_0xfa01('0x81')],_['omit'](_0x11bfa6[_0xfa01('0x75')],[_0xfa01('0x81'),'id'])||{});}})['then'](respondWithResult(_0x19f365,null))[_0xfa01('0x1e')](handleError(_0x19f365,null));};exports[_0xfa01('0xf9')]=function(_0x371738,_0x488ba5){var _0x24f7c6={'raw':![],'where':{}};var _0x674f40={};var _0x207879={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa01('0x85')]({'where':{'id':_0x371738[_0xfa01('0x6e')]['id']}})['then'](handleEntityNotFound(_0x488ba5,null))['then'](function(_0x51597a){if(_0x51597a){_0x674f40['model']=_[_0xfa01('0x6f')](db[_0xfa01('0xbd')]['rawAttributes']);_0x674f40[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0x371738[_0xfa01('0x5b')]);_0x674f40[_0xfa01('0x5c')]=_[_0xfa01('0x5d')](_0x674f40[_0xfa01('0x51')],_0x674f40[_0xfa01('0x5b')]);_0x24f7c6['attributes']=_[_0xfa01('0x5d')](_0x674f40['model'],qs['fields'](_0x371738[_0xfa01('0x5b')][_0xfa01('0x71')]));_0x24f7c6[_0xfa01('0x5e')]=_0x24f7c6[_0xfa01('0x5e')]['length']?_0x24f7c6[_0xfa01('0x5e')]:_0x674f40['model'];if(!_0x371738['query'][_0xfa01('0x60')](_0xfa01('0x61'))){_0x24f7c6[_0xfa01('0x22')]=qs['limit'](_0x371738['query'][_0xfa01('0x22')]);_0x24f7c6[_0xfa01('0x20')]=qs[_0xfa01('0x20')](_0x371738[_0xfa01('0x5b')][_0xfa01('0x20')]);}_0x24f7c6[_0xfa01('0x62')]=qs[_0xfa01('0x63')](_0x371738[_0xfa01('0x5b')][_0xfa01('0x63')]);_0x24f7c6[_0xfa01('0x66')]=qs[_0xfa01('0x5c')](_[_0xfa01('0x64')](_0x371738[_0xfa01('0x5b')],_0x674f40[_0xfa01('0x5c')]));_0x24f7c6[_0xfa01('0x66')]['ChatWebsiteId']=_0x51597a['id'];if(_0x371738[_0xfa01('0x5b')][_0xfa01('0x65')]){_0x24f7c6[_0xfa01('0x66')]=_[_0xfa01('0x67')](_0x24f7c6[_0xfa01('0x66')],{'$or':_[_0xfa01('0x5a')](_0x24f7c6[_0xfa01('0x5e')],function(_0x35d02b){var _0x942791={};_0x942791[_0x35d02b]={'$like':'%'+_0x371738[_0xfa01('0x5b')][_0xfa01('0x65')]+'%'};return _0x942791;})});}_0x24f7c6=_[_0xfa01('0x67')]({},_0x24f7c6,_0x371738[_0xfa01('0x72')]);return db['ChatInteraction'][_0xfa01('0x23')]({'where':_0x24f7c6[_0xfa01('0x66')]})[_0xfa01('0x28')](function(_0x4159ec){_0x207879[_0xfa01('0x23')]=_0x4159ec;if(_0x371738['query']['includeAll']){_0x24f7c6['include']=[{'model':db[_0xfa01('0x9e')],'as':_0xfa01('0xfa'),'required':![]},{'model':db[_0xfa01('0xfb')],'as':_0xfa01('0xfc'),'attributes':['name',_0xfa01('0xfd'),_0xfa01('0xfe')],'required':![]},{'model':db[_0xfa01('0xff')],'as':'Tags','attributes':['id',_0xfa01('0x2e'),_0xfa01('0x100')],'where':_0x371738[_0xfa01('0x5b')][_0xfa01('0x101')]?{'id':_0x371738[_0xfa01('0x5b')]['tag']}:undefined,'required':_0x371738[_0xfa01('0x5b')][_0xfa01('0x101')]?!![]:![]}];}return db[_0xfa01('0xbd')][_0xfa01('0x6b')](_0x24f7c6);})[_0xfa01('0x28')](function(_0x5c6758){_0x207879['rows']=_0x5c6758;return _0x207879;});}})['then'](respondWithFilteredResult(_0x488ba5,_0x24f7c6))['catch'](handleError(_0x488ba5,null));};exports[_0xfa01('0x30')]=function(_0x57cccf,_0x378d27){var _0x1a699a=0x0;var _0x362a07=0x0;var _0x4cdc65=![];var _0x5d6056;var _0x1784a6;return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x57cccf[_0xfa01('0x6e')]['id']},'include':[{'model':db['Interval'],'as':_0xfa01('0x3b'),'include':[{'model':db['Interval'],'as':_0xfa01('0x3c'),'attributes':['id',_0xfa01('0x33')]}]}]})[_0xfa01('0x28')](handleEntityNotFound(_0x378d27,null))['then'](function(_0x47e03d){if(_0x47e03d){_0x5d6056=_0x47e03d;return _0x47e03d[_0xfa01('0x102')]({'raw':!![]});}})[_0xfa01('0x28')](function(_0x1de5e8){if(_0x5d6056){if(_0x1de5e8){_0x1784a6=_0x1de5e8;}}return require('../../config/license/util')[_0xfa01('0x92')]();})[_0xfa01('0x28')](function(_0x555e92){if(_0x555e92){_0x362a07=_0x555e92[_0xfa01('0x103')];_0x4cdc65=_0x555e92[_0xfa01('0x104')];}})[_0xfa01('0x28')](function(){return db['ChatInteraction'][_0xfa01('0x23')]({'where':{'closed':![]}});})[_0xfa01('0x28')](function(_0x21aedf){_0x1a699a=_0x21aedf;if(_0x362a07&&_0x21aedf>_0x362a07){return db[_0xfa01('0x105')][_0xfa01('0x85')]({'where':{'id':0x1}})[_0xfa01('0x28')](function(_0x4ef094){if(_0x4ef094){_0x4ef094[_0xfa01('0x106')](_0xfa01('0x107'));}});}})[_0xfa01('0x28')](function(){if(!_0x5d6056[_0xfa01('0x3b')]||!_0x5d6056['Interval'][_0xfa01('0x3c')])return!![];return checkWebsiteIntervals(_0x5d6056);})[_0xfa01('0x28')](function(_0x2df48f){var _0x19ee75=fs[_0xfa01('0x108')](path['join'](config[_0xfa01('0x90')],_0xfa01('0x109')),_0xfa01('0xd5'));var _0x3175c6=new url[(_0xfa01('0x10a'))](_0x5d6056[_0xfa01('0x10b')])[_0xfa01('0x10c')];var _0x382667=_0xfa01('0x10d');var _0x47848c=![];var _0x3a8692={'chatVersion':_0x382667,'chatWebsiteAddressOrigin':_0x3175c6,'remote':_0x5d6056[_0xfa01('0x10e')],'query':querystring[_0xfa01('0x54')](_[_0xfa01('0x67')](_0x5d6056[_0xfa01('0x3d')]({'plain':!![]}),{'customerIp':_0x57cccf[_0xfa01('0x10f')][_0xfa01('0x46')]||_0x57cccf['headers']['x-real-ip']||_0x57cccf[_0xfa01('0x110')][_0xfa01('0x111')]||_0x57cccf['ip'],'referer':_0x57cccf[_0xfa01('0x10f')]['referer'],'openedInteractions':_0x1a699a,'maxInteractions':_0x362a07,'virtual':_0x4cdc65['virtual'],'online':_0x2df48f,'custom':_0x4cdc65}))[_0xfa01('0x112')](/'/g,'\x5c\x27')};_0x378d27['send'](ejs['render'](Mustache[_0xfa01('0xd6')](_0x19ee75,_0x3a8692),{'proactiveActions':_0x1784a6,'alignment':_0x5d6056[_0xfa01('0x113')],'verticalAlignment':_0x5d6056['verticalAlignment'],'div_color':_0x5d6056[_0xfa01('0x100')],'labelText':_0x5d6056['labelText'],'text_color':_0x5d6056[_0xfa01('0x114')],'text_button_color':_0x5d6056['textButtonColor'],'button_color':_0x5d6056['color_button'],'background_color':_0x5d6056[_0xfa01('0x115')],'hideWhenOffline':_0x5d6056[_0xfa01('0x116')],'intervalId':_0x5d6056[_0xfa01('0x117')],'isDevelopment':_0x47848c,'chatVersion':_0x382667}));})[_0xfa01('0x1e')](handleError(_0x378d27,null));};exports['addApplications']=function(_0x1aa2cc,_0x32049e){var _0x4c5f4f=_0x1aa2cc['params']['id'];var _0x525de1=_0x1aa2cc[_0xfa01('0x75')];var _0x489965=0xc8;var _0x547a47=null;return db[_0xfa01('0xe0')]['transaction']({'isolationLevel':db[_0xfa01('0xe0')][_0xfa01('0x118')][_0xfa01('0x119')][_0xfa01('0x11a')]},function(_0x2b68e5){return db[_0xfa01('0x58')][_0xfa01('0x85')]({'where':{'id':_0x4c5f4f},'transaction':_0x2b68e5})[_0xfa01('0x28')](function(_0xa95480){if(_0xa95480){return db['ChatApplication'][_0xfa01('0x29')]({'where':{'ChatWebsiteId':_0x4c5f4f},'transaction':_0x2b68e5})[_0xfa01('0x28')](function(){var _0x1dd5a5=_[_0xfa01('0x5a')](_0x525de1,function(_0x325a65){_0x325a65[_0xfa01('0x7d')]=_0x4c5f4f;return _0x325a65;});return db['ChatApplication'][_0xfa01('0xe3')](_0x1dd5a5,{'transaction':_0x2b68e5});});}else{_0x489965=0x194;_0x547a47=[];}});})['then'](function(){if(_0x489965!==0x194){return db[_0xfa01('0xaf')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4c5f4f},'order':'priority'})['then'](function(_0x656b04){_0x547a47=_0x656b04;});}})[_0xfa01('0x1e')](function(_0x9e0f65){_0x489965=0x1f4;logger[_0xfa01('0x1a')](_0x9e0f65['stack']);if(_0x9e0f65[_0xfa01('0x2e')]){delete _0x9e0f65[_0xfa01('0x2e')];}_0x547a47=_0x9e0f65;})[_0xfa01('0x11b')](function(){if(_0x547a47===null){_0x32049e[_0xfa01('0x2c')](_0x489965);}else{if(_0x489965===0x1f4){_0x32049e[_0xfa01('0x1f')](_0x489965)[_0xfa01('0x2f')](_0x547a47);}else{_0x32049e['status'](_0x489965)[_0xfa01('0x26')](_0x547a47);}}});};exports[_0xfa01('0x11c')]=function(_0x614232,_0x2711f8){var _0x2a9129={};var _0x3ff5ef={};var _0x559e47;var _0x43afe0;return db[_0xfa01('0x58')][_0xfa01('0x85')]({'where':{'id':_0x614232[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x2711f8,null))[_0xfa01('0x28')](function(_0x45649f){if(_0x45649f){_0x559e47=_0x45649f;_0x3ff5ef[_0xfa01('0x51')]=_[_0xfa01('0x6f')](db['ChatApplication']['rawAttributes']);_0x3ff5ef[_0xfa01('0x5b')]=_['keys'](_0x614232[_0xfa01('0x5b')]);_0x3ff5ef[_0xfa01('0x5c')]=_[_0xfa01('0x5d')](_0x3ff5ef[_0xfa01('0x51')],_0x3ff5ef['query']);_0x2a9129[_0xfa01('0x5e')]=_['intersection'](_0x3ff5ef['model'],qs[_0xfa01('0x71')](_0x614232[_0xfa01('0x5b')]['fields']));_0x2a9129[_0xfa01('0x5e')]=_0x2a9129[_0xfa01('0x5e')]['length']?_0x2a9129[_0xfa01('0x5e')]:_0x3ff5ef[_0xfa01('0x51')];_0x2a9129[_0xfa01('0x62')]=qs[_0xfa01('0x63')](_0x614232[_0xfa01('0x5b')][_0xfa01('0x63')]);_0x2a9129['where']=qs[_0xfa01('0x5c')](_[_0xfa01('0x64')](_0x614232[_0xfa01('0x5b')],_0x3ff5ef['filters']));if(_0x614232[_0xfa01('0x5b')]['filter']){_0x2a9129['where']=_[_0xfa01('0x67')](_0x2a9129[_0xfa01('0x66')],{'$or':_[_0xfa01('0x5a')](_0x2a9129[_0xfa01('0x5e')],function(_0x55b027){var _0x4a2982={};_0x4a2982[_0x55b027]={'$like':'%'+_0x614232[_0xfa01('0x5b')]['filter']+'%'};return _0x4a2982;})});}_0x2a9129=_[_0xfa01('0x67')]({},_0x2a9129,_0x614232['options']);return _0x559e47['getApplications'](_0x2a9129);}})['then'](function(_0x313137){if(_0x313137){_0x43afe0=_0x313137[_0xfa01('0x5f')];if(!_0x614232[_0xfa01('0x5b')][_0xfa01('0x60')](_0xfa01('0x61'))){_0x2a9129['limit']=qs['limit'](_0x614232[_0xfa01('0x5b')][_0xfa01('0x22')]);_0x2a9129[_0xfa01('0x20')]=qs[_0xfa01('0x20')](_0x614232[_0xfa01('0x5b')][_0xfa01('0x20')]);}return _0x559e47[_0xfa01('0x11c')](_0x2a9129);}})[_0xfa01('0x28')](function(_0x94dbef){if(_0x94dbef){return _0x94dbef?{'count':_0x43afe0,'rows':_0x94dbef}:null;}})['then'](respondWithResult(_0x2711f8,null))[_0xfa01('0x1e')](handleError(_0x2711f8,null));};exports[_0xfa01('0x11d')]=function(_0x232d61,_0x4a6932){return db[_0xfa01('0x11e')][_0xfa01('0x73')]({'where':{'id':_0x232d61[_0xfa01('0x6e')]['id']}})['then'](handleEntityNotFound(_0x4a6932,null))[_0xfa01('0x28')](function(_0x136e0d){if(_0x136e0d){return _0x136e0d[_0xfa01('0x11d')](_0x232d61[_0xfa01('0x75')][_0xfa01('0x81')],_[_0xfa01('0x11f')](_0x232d61[_0xfa01('0x75')],[_0xfa01('0x81'),'id'])||{});}})[_0xfa01('0x28')](respondWithResult(_0x4a6932,null))[_0xfa01('0x1e')](handleError(_0x4a6932,null));};exports[_0xfa01('0x102')]=function(_0x30af47,_0x40b5e2){var _0x5bc14d={};var _0x54100a={};var _0x44739d;var _0x22b34e;return db[_0xfa01('0x58')]['findOne']({'where':{'id':_0x30af47[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x40b5e2,null))[_0xfa01('0x28')](function(_0xa63c6a){if(_0xa63c6a){_0x44739d=_0xa63c6a;_0x54100a[_0xfa01('0x51')]=_[_0xfa01('0x6f')](db[_0xfa01('0x120')][_0xfa01('0x70')]);_0x54100a[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0x30af47[_0xfa01('0x5b')]);_0x54100a['filters']=_[_0xfa01('0x5d')](_0x54100a[_0xfa01('0x51')],_0x54100a[_0xfa01('0x5b')]);_0x5bc14d[_0xfa01('0x5e')]=_[_0xfa01('0x5d')](_0x54100a['model'],qs[_0xfa01('0x71')](_0x30af47[_0xfa01('0x5b')][_0xfa01('0x71')]));_0x5bc14d['attributes']=_0x5bc14d['attributes'][_0xfa01('0x5f')]?_0x5bc14d[_0xfa01('0x5e')]:_0x54100a[_0xfa01('0x51')];_0x5bc14d[_0xfa01('0x62')]=qs['sort'](_0x30af47[_0xfa01('0x5b')]['sort']);_0x5bc14d[_0xfa01('0x66')]=qs['filters'](_[_0xfa01('0x64')](_0x30af47[_0xfa01('0x5b')],_0x54100a[_0xfa01('0x5c')]));if(_0x30af47[_0xfa01('0x5b')][_0xfa01('0x65')]){_0x5bc14d[_0xfa01('0x66')]=_[_0xfa01('0x67')](_0x5bc14d[_0xfa01('0x66')],{'$or':_['map'](_0x5bc14d[_0xfa01('0x5e')],function(_0x51b17a){var _0x21fca7={};_0x21fca7[_0x51b17a]={'$like':'%'+_0x30af47[_0xfa01('0x5b')][_0xfa01('0x65')]+'%'};return _0x21fca7;})});}_0x5bc14d=_['merge']({},_0x5bc14d,_0x30af47['options']);return _0x44739d['getProactiveActions'](_0x5bc14d);}})[_0xfa01('0x28')](function(_0x3bcb62){if(_0x3bcb62){_0x22b34e=_0x3bcb62[_0xfa01('0x5f')];if(!_0x30af47[_0xfa01('0x5b')]['hasOwnProperty'](_0xfa01('0x61'))){_0x5bc14d[_0xfa01('0x22')]=qs['limit'](_0x30af47[_0xfa01('0x5b')][_0xfa01('0x22')]);_0x5bc14d[_0xfa01('0x20')]=qs[_0xfa01('0x20')](_0x30af47[_0xfa01('0x5b')][_0xfa01('0x20')]);}return _0x44739d['getProactiveActions'](_0x5bc14d);}})[_0xfa01('0x28')](function(_0x4ef0fe){if(_0x4ef0fe){return _0x4ef0fe?{'count':_0x22b34e,'rows':_0x4ef0fe}:null;}})[_0xfa01('0x28')](respondWithResult(_0x40b5e2,null))[_0xfa01('0x1e')](handleError(_0x40b5e2,null));};exports[_0xfa01('0x121')]=function(_0x5a0e95,_0xe11493){var _0x2bb41a=_0x5a0e95['query']['online']===_0xfa01('0x122')?_0xfa01('0x123'):'onlineForm';return db[_0xfa01('0x58')][_0xfa01('0x73')]({'attributes':['id',_0x2bb41a],'where':{'id':_0x5a0e95['params']['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0xe11493,null))['then'](function(_0x4ebba2){if(_0x4ebba2){var _0x33c070=_0x4ebba2[_0x2bb41a];var _0x306140=_0x33c070&&_0x33c070[_0xfa01('0x124')]?_0x33c070['items']:[];_0xe11493[_0xfa01('0x2f')]({'fromKey':_['isNil'](_0x33c070['fromKey'])?undefined:_0x33c070[_0xfa01('0x125')],'count':_0x306140[_0xfa01('0x5f')],'rows':_0x306140});}})[_0xfa01('0x1e')](handleError(_0xe11493,null));};exports['getOfflineMessages']=function(_0xfd0a2d,_0x5c63e9){var _0xd0bc83={'raw':![],'where':{}};var _0x347e4f={};var _0x3a175c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa01('0x85')]({'where':{'id':_0xfd0a2d[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x5c63e9,null))[_0xfa01('0x28')](function(_0x183493){if(_0x183493){_0x347e4f[_0xfa01('0x51')]=_[_0xfa01('0x6f')](db[_0xfa01('0xd9')][_0xfa01('0x70')]);_0x347e4f[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0xfd0a2d[_0xfa01('0x5b')]);_0x347e4f[_0xfa01('0x5c')]=_[_0xfa01('0x5d')](_0x347e4f[_0xfa01('0x51')],_0x347e4f[_0xfa01('0x5b')]);_0xd0bc83[_0xfa01('0x5e')]=_['intersection'](_0x347e4f['model'],qs['fields'](_0xfd0a2d[_0xfa01('0x5b')][_0xfa01('0x71')]));_0xd0bc83[_0xfa01('0x5e')]=_0xd0bc83[_0xfa01('0x5e')][_0xfa01('0x5f')]?_0xd0bc83[_0xfa01('0x5e')]:_0x347e4f[_0xfa01('0x51')];if(!_0xfd0a2d[_0xfa01('0x5b')]['hasOwnProperty']('nolimit')){_0xd0bc83['limit']=qs[_0xfa01('0x22')](_0xfd0a2d[_0xfa01('0x5b')][_0xfa01('0x22')]);_0xd0bc83['offset']=qs[_0xfa01('0x20')](_0xfd0a2d[_0xfa01('0x5b')]['offset']);}_0xd0bc83[_0xfa01('0x62')]=qs[_0xfa01('0x63')](_0xfd0a2d[_0xfa01('0x5b')]['sort']);_0xd0bc83[_0xfa01('0x66')]=qs[_0xfa01('0x5c')](_[_0xfa01('0x64')](_0xfd0a2d[_0xfa01('0x5b')],_0x347e4f[_0xfa01('0x5c')]));_0xd0bc83[_0xfa01('0x66')][_0xfa01('0x7d')]=_0x183493['id'];if(_0xfd0a2d[_0xfa01('0x5b')]['filter']){_0xd0bc83['where']=_[_0xfa01('0x67')](_0xd0bc83[_0xfa01('0x66')],{'$or':_[_0xfa01('0x5a')](_0xd0bc83[_0xfa01('0x5e')],function(_0x1d970d){var _0x373207={};_0x373207[_0x1d970d]={'$like':'%'+_0xfd0a2d[_0xfa01('0x5b')][_0xfa01('0x65')]+'%'};return _0x373207;})});}_0xd0bc83=_['merge']({},_0xd0bc83,_0xfd0a2d[_0xfa01('0x72')]);return db[_0xfa01('0xd9')][_0xfa01('0x23')]({'where':_0xd0bc83['where']})[_0xfa01('0x28')](function(_0x417afe){_0x3a175c[_0xfa01('0x23')]=_0x417afe;if(_0xfd0a2d[_0xfa01('0x5b')]['includeAll']){_0xd0bc83[_0xfa01('0x6a')]=[{'all':!![]}];}else{_0xd0bc83[_0xfa01('0x6a')]=[{'model':db[_0xfa01('0x9e')],'as':_0xfa01('0xfa'),'required':![]},{'model':db[_0xfa01('0xe2')],'as':'Attachments','required':![]}];}return db[_0xfa01('0xd9')][_0xfa01('0x6b')](_0xd0bc83);})[_0xfa01('0x28')](function(_0x5a3019){_0x3a175c[_0xfa01('0x6c')]=_0x5a3019;return _0x3a175c;});}})[_0xfa01('0x28')](respondWithFilteredResult(_0x5c63e9,_0xd0bc83))[_0xfa01('0x1e')](handleError(_0x5c63e9,null));};exports['addAgents']=function(_0x3fdd58,_0x39f070){return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x3fdd58['params']['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x39f070,null))[_0xfa01('0x28')](function(_0x22be42){if(_0x22be42){return _0x22be42[_0xfa01('0x126')](_0x3fdd58['body'][_0xfa01('0x81')],_[_0xfa01('0x11f')](_0x3fdd58['body'],[_0xfa01('0x81'),'id'])||{})[_0xfa01('0xb2')](function(_0xee3953){for(var _0x20d7d1=0x0;_0x20d7d1<_0x3fdd58['body'][_0xfa01('0x81')][_0xfa01('0x5f')];_0x20d7d1+=0x1){socket[_0xfa01('0x127')](_0xfa01('0x128'),{'UserId':Number(_0x3fdd58['body'][_0xfa01('0x81')][_0x20d7d1]),'ChatWebsiteId':Number(_0x3fdd58[_0xfa01('0x6e')]['id'])});}return _0xee3953;});}})[_0xfa01('0x28')](respondWithResult(_0x39f070,null))['catch'](handleError(_0x39f070,null));};exports[_0xfa01('0x129')]=function(_0x19a977,_0x4df93d){return db[_0xfa01('0x58')][_0xfa01('0x73')]({'where':{'id':_0x19a977['params']['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x4df93d,null))[_0xfa01('0x28')](function(_0x5649dc){if(_0x5649dc){return _0x5649dc[_0xfa01('0x129')](_0x19a977[_0xfa01('0x5b')][_0xfa01('0x81')])[_0xfa01('0x28')](function(){if(_[_0xfa01('0x12a')](_0x19a977[_0xfa01('0x5b')][_0xfa01('0x81')])){for(var _0x344ef3=0x0;_0x344ef3<_0x19a977['query'][_0xfa01('0x81')][_0xfa01('0x5f')];_0x344ef3+=0x1){socket['emit'](_0xfa01('0x12b'),{'UserId':Number(_0x19a977[_0xfa01('0x5b')][_0xfa01('0x81')][_0x344ef3]),'ChatWebsiteId':Number(_0x19a977[_0xfa01('0x6e')]['id'])});}}else{socket[_0xfa01('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x19a977[_0xfa01('0x5b')][_0xfa01('0x81')]),'ChatWebsiteId':Number(_0x19a977[_0xfa01('0x6e')]['id'])});}});}})[_0xfa01('0x28')](respondWithStatusCode(_0x4df93d,null))['catch'](handleError(_0x4df93d,null));};exports[_0xfa01('0x12c')]=function(_0x2f55b7,_0x3ab7e9){var _0x454b24={};var _0x1b55d6={};var _0x1ad7b5;var _0x5a95a1;return db[_0xfa01('0x58')][_0xfa01('0x85')]({'where':{'id':_0x2f55b7[_0xfa01('0x6e')]['id']}})[_0xfa01('0x28')](handleEntityNotFound(_0x3ab7e9,null))[_0xfa01('0x28')](function(_0x4ebd8a){if(_0x4ebd8a){_0x1ad7b5=_0x4ebd8a;_0x1b55d6[_0xfa01('0x51')]=_[_0xfa01('0x6f')](db[_0xfa01('0xfb')][_0xfa01('0x70')]);_0x1b55d6[_0xfa01('0x5b')]=_[_0xfa01('0x6f')](_0x2f55b7[_0xfa01('0x5b')]);_0x1b55d6[_0xfa01('0x5c')]=_['intersection'](_0x1b55d6[_0xfa01('0x51')],_0x1b55d6[_0xfa01('0x5b')]);_0x454b24[_0xfa01('0x5e')]=_['intersection'](_0x1b55d6['model'],qs[_0xfa01('0x71')](_0x2f55b7[_0xfa01('0x5b')]['fields']));_0x454b24['attributes']=_0x454b24[_0xfa01('0x5e')][_0xfa01('0x5f')]?_0x454b24['attributes']:_0x1b55d6['model'];_0x454b24['order']=qs['sort'](_0x2f55b7[_0xfa01('0x5b')][_0xfa01('0x63')]);_0x454b24['where']=qs[_0xfa01('0x5c')](_[_0xfa01('0x64')](_0x2f55b7[_0xfa01('0x5b')],_0x1b55d6[_0xfa01('0x5c')]));if(_0x2f55b7['query'][_0xfa01('0x65')]){_0x454b24[_0xfa01('0x66')]=_[_0xfa01('0x67')](_0x454b24[_0xfa01('0x66')],{'$or':_['map'](_0x454b24['attributes'],function(_0x4496bc){var _0x5e9419={};_0x5e9419[_0x4496bc]={'$like':'%'+_0x2f55b7['query'][_0xfa01('0x65')]+'%'};return _0x5e9419;})});}_0x454b24=_[_0xfa01('0x67')]({},_0x454b24,_0x2f55b7[_0xfa01('0x72')]);return _0x1ad7b5[_0xfa01('0x12c')](_0x454b24);}})['then'](function(_0x39343c){if(_0x39343c){_0x5a95a1=_0x39343c[_0xfa01('0x5f')];if(!_0x2f55b7[_0xfa01('0x5b')][_0xfa01('0x60')](_0xfa01('0x61'))){_0x454b24['limit']=qs[_0xfa01('0x22')](_0x2f55b7[_0xfa01('0x5b')][_0xfa01('0x22')]);_0x454b24[_0xfa01('0x20')]=qs['offset'](_0x2f55b7[_0xfa01('0x5b')][_0xfa01('0x20')]);}return _0x1ad7b5[_0xfa01('0x12c')](_0x454b24);}})[_0xfa01('0x28')](function(_0x2a7abe){if(_0x2a7abe){return _0x2a7abe?{'count':_0x5a95a1,'rows':_0x2a7abe}:null;}})['then'](respondWithResult(_0x3ab7e9,null))[_0xfa01('0x1e')](handleError(_0x3ab7e9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e59ad5d..499cf84 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 _0x2d17=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x2d17,0x17e));var _0x72d1=function(_0x45b43b,_0x1037a9){_0x45b43b=_0x45b43b-0x0;var _0x41f6c7=_0x2d17[_0x45b43b];return _0x41f6c7;};'use strict';var EventEmitter=require(_0x72d1('0x0'));var ChatWebsite=require(_0x72d1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x72d1('0x2')](0x0);var events={'afterCreate':_0x72d1('0x3'),'afterUpdate':'update','afterDestroy':_0x72d1('0x4')};function emitEvent(_0x38fec7){return function(_0x55b722,_0x1dd6d8,_0x4dfee1){ChatWebsiteEvents[_0x72d1('0x5')](_0x38fec7+':'+_0x55b722['id'],_0x55b722);ChatWebsiteEvents['emit'](_0x38fec7,_0x55b722);_0x4dfee1(null);};}for(var e in events){if(events[_0x72d1('0x6')](e)){var event=events[e];ChatWebsite[_0x72d1('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xdc03=['update','remove','emit','hasOwnProperty','hook','events','ChatWebsite','setMaxListeners'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0xdc03,0x65));var _0x3dc0=function(_0x272dc7,_0xddef1e){_0x272dc7=_0x272dc7-0x0;var _0x540f00=_0xdc03[_0x272dc7];return _0x540f00;};'use strict';var EventEmitter=require(_0x3dc0('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x3dc0('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3dc0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dc0('0x3'),'afterDestroy':_0x3dc0('0x4')};function emitEvent(_0x2971c1){return function(_0x10c75a,_0x3b41f0,_0x221975){ChatWebsiteEvents['emit'](_0x2971c1+':'+_0x10c75a['id'],_0x10c75a);ChatWebsiteEvents[_0x3dc0('0x5')](_0x2971c1,_0x10c75a);_0x221975(null);};}for(var e in events){if(events[_0x3dc0('0x6')](e)){var event=events[e];ChatWebsite[_0x3dc0('0x7')](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 9f63dc5..7d1215e 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 _0xe80e=['moment','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe80e,0x12a));var _0xee80=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xe80e[_0x236d24];return _0x1574cf;};'use strict';var _=require('lodash');var util=require(_0xee80('0x0'));var logger=require('../../config/logger')(_0xee80('0x1'));var moment=require(_0xee80('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee80('0x3'));var rimraf=require(_0xee80('0x4'));var config=require(_0xee80('0x5'));var attributes=require(_0xee80('0x6'));module[_0xee80('0x7')]=function(_0x10e12a,_0x36c211){return _0x10e12a[_0xee80('0x8')]('ChatWebsite',attributes,{'tableName':_0xee80('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b77=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8b77,0x155));var _0x78b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8b77[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x78b7('0x0'));var logger=require('../../config/logger')(_0x78b7('0x1'));var moment=require(_0x78b7('0x2'));var BPromise=require(_0x78b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78b7('0x4'));var rimraf=require(_0x78b7('0x5'));var config=require(_0x78b7('0x6'));var attributes=require(_0x78b7('0x7'));module[_0x78b7('0x8')]=function(_0x80a212,_0x4b5c23){return _0x80a212[_0x78b7('0x9')](_0x78b7('0xa'),attributes,{'tableName':_0x78b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index db028f9..614dde3 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 _0x0246=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/environment','client','redis','defaults','localhost','./chatWebsite.socket','then'];(function(_0x240c03,_0x132524){var _0x455f30=function(_0x4912f4){while(--_0x4912f4){_0x240c03['push'](_0x240c03['shift']());}};_0x455f30(++_0x132524);}(_0x0246,0xa9));var _0x6024=function(_0x2229d4,_0x366868){_0x2229d4=_0x2229d4-0x0;var _0x5ae869=_0x0246[_0x2229d4];return _0x5ae869;};'use strict';var _=require('lodash');var util=require(_0x6024('0x0'));var moment=require('moment');var BPromise=require(_0x6024('0x1'));var rs=require(_0x6024('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6024('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6024('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x6024('0x5')]['http']({'port':0x232a});config[_0x6024('0x6')]=_[_0x6024('0x7')](config['redis'],{'host':_0x6024('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6024('0x6')]));require(_0x6024('0x9'))['register'](socket);function respondWithRpcPromise(_0x4ed962,_0x5823bf,_0x397dbf){return new BPromise(function(_0x21278a,_0x288965){return client['request'](_0x4ed962,_0x397dbf)[_0x6024('0xa')](function(_0x4c1e33){logger[_0x6024('0xb')](_0x6024('0xc'),_0x5823bf,_0x6024('0xd'));logger['debug'](_0x6024('0xe'),_0x5823bf,_0x6024('0xd'),JSON[_0x6024('0xf')](_0x4c1e33));if(_0x4c1e33['error']){if(_0x4c1e33['error']['code']===0x1f4){logger[_0x6024('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x5823bf,_0x4c1e33[_0x6024('0x10')][_0x6024('0x11')]);return _0x288965(_0x4c1e33['error'][_0x6024('0x11')]);}logger[_0x6024('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x5823bf,_0x4c1e33[_0x6024('0x10')][_0x6024('0x11')]);return _0x21278a(_0x4c1e33[_0x6024('0x10')][_0x6024('0x11')]);}else{logger['info'](_0x6024('0xc'),_0x5823bf,'request\x20sent');_0x21278a(_0x4c1e33[_0x6024('0x12')][_0x6024('0x11')]);}})[_0x6024('0x13')](function(_0x169f9e){logger['error'](_0x6024('0xc'),_0x5823bf,_0x169f9e);_0x288965(_0x169f9e);});});} \ No newline at end of file +var _0xfda4=['ChatWebsite,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3f903b,_0x243493){var _0x5d8519=function(_0x3e6d5d){while(--_0x3e6d5d){_0x3f903b['push'](_0x3f903b['shift']());}};_0x5d8519(++_0x243493);}(_0xfda4,0x17b));var _0x4fda=function(_0x472ca8,_0x2c8c37){_0x472ca8=_0x472ca8-0x0;var _0x14c783=_0xfda4[_0x472ca8];return _0x14c783;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4fda('0x0'));var BPromise=require(_0x4fda('0x1'));var rs=require(_0x4fda('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4fda('0x3'))(_0x4fda('0x4'));var config=require(_0x4fda('0x5'));var jayson=require(_0x4fda('0x6'));var client=jayson[_0x4fda('0x7')][_0x4fda('0x8')]({'port':0x232a});config[_0x4fda('0x9')]=_[_0x4fda('0xa')](config[_0x4fda('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fda('0xb'))(new Redis(config[_0x4fda('0x9')]));require(_0x4fda('0xc'))[_0x4fda('0xd')](socket);function respondWithRpcPromise(_0x273341,_0x183da2,_0x4c33b8){return new BPromise(function(_0xbecaeb,_0x1b32d0){return client[_0x4fda('0xe')](_0x273341,_0x4c33b8)[_0x4fda('0xf')](function(_0x432845){logger[_0x4fda('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x183da2,_0x4fda('0x11'));logger['debug'](_0x4fda('0x12'),_0x183da2,_0x4fda('0x11'),JSON['stringify'](_0x432845));if(_0x432845[_0x4fda('0x13')]){if(_0x432845[_0x4fda('0x13')][_0x4fda('0x14')]===0x1f4){logger[_0x4fda('0x13')](_0x4fda('0x15'),_0x183da2,_0x432845[_0x4fda('0x13')][_0x4fda('0x16')]);return _0x1b32d0(_0x432845[_0x4fda('0x13')][_0x4fda('0x16')]);}logger[_0x4fda('0x13')](_0x4fda('0x15'),_0x183da2,_0x432845[_0x4fda('0x13')][_0x4fda('0x16')]);return _0xbecaeb(_0x432845[_0x4fda('0x13')]['message']);}else{logger['info'](_0x4fda('0x15'),_0x183da2,_0x4fda('0x11'));_0xbecaeb(_0x432845[_0x4fda('0x17')]['message']);}})[_0x4fda('0x18')](function(_0x4b51e0){logger[_0x4fda('0x13')](_0x4fda('0x15'),_0x183da2,_0x4b51e0);_0x1b32d0(_0x4b51e0);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 268cb3e..ee1f3e9 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 _0x26ba=['update','removeListener','./chatWebsite.events','save','remove'];(function(_0x512132,_0x360c5c){var _0x2a6fab=function(_0x542bac){while(--_0x542bac){_0x512132['push'](_0x512132['shift']());}};_0x2a6fab(++_0x360c5c);}(_0x26ba,0x1ba));var _0xa26b=function(_0x54af0d,_0x3e5db0){_0x54af0d=_0x54af0d-0x0;var _0x57b08d=_0x26ba[_0x54af0d];return _0x57b08d;};'use strict';var ChatWebsiteEvents=require(_0xa26b('0x0'));var events=[_0xa26b('0x1'),_0xa26b('0x2'),_0xa26b('0x3')];function createListener(_0x14674a,_0x4abec5){return function(_0x700185){_0x4abec5['emit'](_0x14674a,_0x700185);};}function removeListener(_0x426635,_0x51c119){return function(){ChatWebsiteEvents[_0xa26b('0x4')](_0x426635,_0x51c119);};}exports['register']=function(_0x104f55){for(var _0x5a099d=0x0,_0x5a08b8=events['length'];_0x5a099d<_0x5a08b8;_0x5a099d++){var _0x16b406=events[_0x5a099d];var _0x39cafb=createListener('chatWebsite:'+_0x16b406,_0x104f55);ChatWebsiteEvents['on'](_0x16b406,_0x39cafb);}}; \ No newline at end of file +var _0xa435=['save','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0xa435,0xe7));var _0x5a43=function(_0x363b90,_0x25fb45){_0x363b90=_0x363b90-0x0;var _0x5e7841=_0xa435[_0x363b90];return _0x5e7841;};'use strict';var ChatWebsiteEvents=require(_0x5a43('0x0'));var events=[_0x5a43('0x1'),'remove',_0x5a43('0x2')];function createListener(_0x45aa05,_0x518c13){return function(_0x2a26c6){_0x518c13[_0x5a43('0x3')](_0x45aa05,_0x2a26c6);};}function removeListener(_0x445d57,_0x14e889){return function(){ChatWebsiteEvents[_0x5a43('0x4')](_0x445d57,_0x14e889);};}exports[_0x5a43('0x5')]=function(_0x457f7d){for(var _0x5764ef=0x0,_0x2aa524=events[_0x5a43('0x6')];_0x5764ef<_0x2aa524;_0x5764ef++){var _0x102930=events[_0x5764ef];var _0x1149fe=createListener(_0x5a43('0x7')+_0x102930,_0x457f7d);ChatWebsiteEvents['on'](_0x102930,_0x1149fe);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8c7165f..8be3bd3 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 _0xc3a3=['addApplications','addProactiveActions','addAgents','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','show','/:id/canned_answers','isAuthenticated','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction'];(function(_0x12f56b,_0x534bf4){var _0x10e4e4=function(_0x49b772){while(--_0x49b772){_0x12f56b['push'](_0x12f56b['shift']());}};_0x10e4e4(++_0x534bf4);}(_0xc3a3,0x9a));var _0x3c3a=function(_0x4004e1,_0x4a241d){_0x4004e1=_0x4004e1-0x0;var _0x360efb=_0xc3a3[_0x4004e1];return _0x360efb;};'use strict';var multer=require(_0x3c3a('0x0'));var util=require(_0x3c3a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c3a('0x2'));var router=express[_0x3c3a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3c3a('0x4'));var interaction=require(_0x3c3a('0x5'));var config=require(_0x3c3a('0x6'));var controller=require(_0x3c3a('0x7'));router[_0x3c3a('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c3a('0x9')]);router[_0x3c3a('0x8')](_0x3c3a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x3c3a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3c3a('0xb')]);router[_0x3c3a('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x3c3a('0xc'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0xe')]);router['get'](_0x3c3a('0xf'),controller[_0x3c3a('0x10')]);router[_0x3c3a('0x8')](_0x3c3a('0x11'),controller[_0x3c3a('0x12')]);router[_0x3c3a('0x8')](_0x3c3a('0x13'),controller[_0x3c3a('0x14')]);router[_0x3c3a('0x8')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x3c3a('0x8')](_0x3c3a('0x15'),auth['isAuthenticated'](),controller[_0x3c3a('0x16')]);router['get'](_0x3c3a('0x17'),controller[_0x3c3a('0x18')]);router[_0x3c3a('0x8')](_0x3c3a('0x19'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x1a')]);router[_0x3c3a('0x8')](_0x3c3a('0x1b'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x1c')]);router[_0x3c3a('0x8')]('/:id/fields',controller['getFields']);router[_0x3c3a('0x8')](_0x3c3a('0x1d'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x1e')]);router[_0x3c3a('0x8')](_0x3c3a('0x1f'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x20')]);router[_0x3c3a('0x21')]('/',auth['isAuthenticated'](),controller[_0x3c3a('0x22')]);router['post'](_0x3c3a('0x23'),auth['isAuthenticated'](),controller[_0x3c3a('0x24')]);router['post'](_0x3c3a('0xc'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x25')]);var upload=multer({'storage':multer[_0x3c3a('0x26')]({'destination':function(_0x2ebb12,_0x10a9eb,_0x5750f8){_0x5750f8(null,path['join'](config[_0x3c3a('0x27')],_0x3c3a('0x28')));},'filename':function(_0x46d87f,_0x2f1b22,_0x5292cf){_0x5292cf(null,util[_0x3c3a('0x29')](_0x3c3a('0x2a'),Date[_0x3c3a('0x2b')](),_0x2f1b22[_0x3c3a('0x2c')]));}})});router[_0x3c3a('0x21')]('/:id/logo',upload[_0x3c3a('0x2d')](_0x3c3a('0x2e')),controller[_0x3c3a('0x2f')]);var upload=multer({'storage':multer[_0x3c3a('0x26')]({'destination':function(_0x537d7a,_0x43afb0,_0x582966){_0x582966(null,path[_0x3c3a('0x30')](config[_0x3c3a('0x27')],_0x3c3a('0x31')));},'filename':function(_0x51c602,_0x5d4f47,_0x57ff31){_0x57ff31(null,util['format']('%s-%s',Date[_0x3c3a('0x2b')](),_0x5d4f47[_0x3c3a('0x2c')]));}})});router[_0x3c3a('0x21')](_0x3c3a('0x11'),upload[_0x3c3a('0x2d')](_0x3c3a('0x2e')),controller[_0x3c3a('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52a8f3,_0x3e8557,_0x129442){_0x129442(null,path[_0x3c3a('0x30')](config[_0x3c3a('0x27')],_0x3c3a('0x31')));},'filename':function(_0x139264,_0x3859f2,_0x12cde3){_0x12cde3(null,util['format']('%s-%s',Date[_0x3c3a('0x2b')](),_0x3859f2[_0x3c3a('0x2c')]));}})});router['post'](_0x3c3a('0x13'),upload[_0x3c3a('0x2d')](_0x3c3a('0x2e')),controller[_0x3c3a('0x33')]);var upload=multer({'storage':multer[_0x3c3a('0x26')]({'destination':function(_0x144788,_0x91486b,_0x884e6d){_0x884e6d(null,path['join'](config[_0x3c3a('0x27')],_0x3c3a('0x31')));},'filename':function(_0x25fa49,_0x1e5d74,_0x272693){_0x272693(null,util[_0x3c3a('0x29')](_0x3c3a('0x2a'),Date[_0x3c3a('0x2b')](),_0x1e5d74[_0x3c3a('0x2c')]));}})});router['post']('/:id/system_avatar',upload[_0x3c3a('0x2d')](_0x3c3a('0x2e')),controller['addSystemAvatar']);router[_0x3c3a('0x21')](_0x3c3a('0x34'),controller[_0x3c3a('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x3c3a('0x26')]({'destination':function(_0x24009d,_0x48bef8,_0x29f3e2){const _0x4dc6c0=path[_0x3c3a('0x30')](config[_0x3c3a('0x27')],_0x3c3a('0x36'),'attachments',_0x3c3a('0x37'));fs_extra[_0x3c3a('0x38')](_0x4dc6c0,function(){_0x29f3e2(null,_0x4dc6c0);});},'filename':function(_0x29f1ba,_0x458dfb,_0x30251e){const _0x1c5494=_0x458dfb['originalname'][_0x3c3a('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x42ebd7=path['extname'](_0x1c5494);const _0x1802b5=Date['now']()+'-'+_0x1c5494[_0x3c3a('0x39')](_0x42ebd7,'')+_0x42ebd7;_0x30251e(null,_0x1802b5);}})});router[_0x3c3a('0x21')](_0x3c3a('0x3a'),offlineUploadMulter[_0x3c3a('0x3b')](),controller[_0x3c3a('0x3c')]);router['post'](_0x3c3a('0x15'),auth['isAuthenticated'](),controller[_0x3c3a('0x3d')]);router['post'](_0x3c3a('0x19'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x3e')]);router[_0x3c3a('0x21')](_0x3c3a('0x1b'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x3f')]);router[_0x3c3a('0x21')](_0x3c3a('0x1f'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x40')]);router['put'](_0x3c3a('0x41'),auth[_0x3c3a('0xd')](),controller['update']);router[_0x3c3a('0x42')](_0x3c3a('0x41'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x43')]);router[_0x3c3a('0x42')](_0x3c3a('0x23'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x44')]);router[_0x3c3a('0x42')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3c3a('0x45')]);router['delete'](_0x3c3a('0x1f'),auth[_0x3c3a('0xd')](),controller[_0x3c3a('0x46')]);module[_0x3c3a('0x47')]=router; \ No newline at end of file +var _0x3c9c=['put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','/:id/dispositions','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','create','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','addAvatar','/:id/customer_avatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents'];(function(_0x463b5e,_0x13d524){var _0x379243=function(_0x3dabb3){while(--_0x3dabb3){_0x463b5e['push'](_0x463b5e['shift']());}};_0x379243(++_0x13d524);}(_0x3c9c,0x9f));var _0xc3c9=function(_0x11eade,_0x162e34){_0x11eade=_0x11eade-0x0;var _0x3b948f=_0x3c9c[_0x11eade];return _0x3b948f;};'use strict';var multer=require(_0xc3c9('0x0'));var util=require(_0xc3c9('0x1'));var path=require('path');var timeout=require(_0xc3c9('0x2'));var express=require(_0xc3c9('0x3'));var router=express[_0xc3c9('0x4')]();var fs_extra=require(_0xc3c9('0x5'));var auth=require(_0xc3c9('0x6'));var interaction=require(_0xc3c9('0x7'));var config=require(_0xc3c9('0x8'));var controller=require('./chatWebsite.controller');router[_0xc3c9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c9('0xa')]);router[_0xc3c9('0x9')]('/describe',auth[_0xc3c9('0xb')](),controller['describe']);router[_0xc3c9('0x9')](_0xc3c9('0xc'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0xd')]);router[_0xc3c9('0x9')](_0xc3c9('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xc3c9('0x9')]('/:id/canned_answers',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0xf')]);router[_0xc3c9('0x9')]('/:id/logo',controller[_0xc3c9('0x10')]);router[_0xc3c9('0x9')](_0xc3c9('0x11'),controller[_0xc3c9('0x12')]);router['get']('/:id/customer_avatar',controller[_0xc3c9('0x13')]);router[_0xc3c9('0x9')]('/:id/system_avatar',controller[_0xc3c9('0x14')]);router[_0xc3c9('0x9')](_0xc3c9('0x15'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x16')]);router['get'](_0xc3c9('0x17'),controller[_0xc3c9('0x18')]);router[_0xc3c9('0x9')]('/:id/applications',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x19')]);router[_0xc3c9('0x9')](_0xc3c9('0x1a'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x1b')]);router[_0xc3c9('0x9')](_0xc3c9('0x1c'),controller[_0xc3c9('0x1d')]);router[_0xc3c9('0x9')](_0xc3c9('0x1e'),auth[_0xc3c9('0xb')](),controller['getOfflineMessages']);router[_0xc3c9('0x9')]('/:id/users',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x1f')]);router[_0xc3c9('0x20')]('/',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x21')]);router[_0xc3c9('0x20')](_0xc3c9('0xe'),auth[_0xc3c9('0xb')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xc3c9('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xc3c9('0x22')]({'destination':function(_0x59d73e,_0x48ceaa,_0x306e60){_0x306e60(null,path['join'](config[_0xc3c9('0x23')],_0xc3c9('0x24')));},'filename':function(_0x20a334,_0xa3cb87,_0x264c31){_0x264c31(null,util[_0xc3c9('0x25')](_0xc3c9('0x26'),Date[_0xc3c9('0x27')](),_0xa3cb87[_0xc3c9('0x28')]));}})});router[_0xc3c9('0x20')]('/:id/logo',upload[_0xc3c9('0x29')](_0xc3c9('0x2a')),controller[_0xc3c9('0x2b')]);var upload=multer({'storage':multer[_0xc3c9('0x22')]({'destination':function(_0x5c0733,_0x6e787,_0x4f76aa){_0x4f76aa(null,path[_0xc3c9('0x2c')](config[_0xc3c9('0x23')],'server/files/images/avatars/'));},'filename':function(_0x324206,_0xad3a38,_0x5812da){_0x5812da(null,util[_0xc3c9('0x25')]('%s-%s',Date[_0xc3c9('0x27')](),_0xad3a38['originalname']));}})});router['post'](_0xc3c9('0x11'),upload[_0xc3c9('0x29')]('file'),controller[_0xc3c9('0x2d')]);var upload=multer({'storage':multer[_0xc3c9('0x22')]({'destination':function(_0x544a94,_0x502314,_0x133ab5){_0x133ab5(null,path[_0xc3c9('0x2c')](config[_0xc3c9('0x23')],'server/files/images/avatars/'));},'filename':function(_0xfc98f5,_0x28df7d,_0x5155ef){_0x5155ef(null,util[_0xc3c9('0x25')](_0xc3c9('0x26'),Date[_0xc3c9('0x27')](),_0x28df7d[_0xc3c9('0x28')]));}})});router[_0xc3c9('0x20')](_0xc3c9('0x2e'),upload[_0xc3c9('0x29')]('file'),controller[_0xc3c9('0x2f')]);var upload=multer({'storage':multer[_0xc3c9('0x22')]({'destination':function(_0x3bdaa5,_0x244c86,_0x32fedf){_0x32fedf(null,path[_0xc3c9('0x2c')](config['root'],_0xc3c9('0x30')));},'filename':function(_0xcccc08,_0x2b8192,_0x2ac8ac){_0x2ac8ac(null,util['format'](_0xc3c9('0x26'),Date['now'](),_0x2b8192[_0xc3c9('0x28')]));}})});router[_0xc3c9('0x20')]('/:id/system_avatar',upload['single']('file'),controller[_0xc3c9('0x31')]);router[_0xc3c9('0x20')](_0xc3c9('0x32'),controller[_0xc3c9('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xc3c9('0x22')]({'destination':function(_0x38b459,_0x5d7438,_0x58ead2){const _0x3f20f0=path[_0xc3c9('0x2c')](config[_0xc3c9('0x23')],_0xc3c9('0x34'),_0xc3c9('0x35'),_0xc3c9('0x36'));fs_extra['ensureDir'](_0x3f20f0,function(){_0x58ead2(null,_0x3f20f0);});},'filename':function(_0x6f9d5c,_0x228bf4,_0x538ad3){const _0x2ac978=_0x228bf4[_0xc3c9('0x28')][_0xc3c9('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1357b7=path[_0xc3c9('0x38')](_0x2ac978);const _0x4a75e4=Date[_0xc3c9('0x27')]()+'-'+_0x2ac978[_0xc3c9('0x37')](_0x1357b7,'')+_0x1357b7;_0x538ad3(null,_0x4a75e4);}})});router[_0xc3c9('0x20')](_0xc3c9('0x39'),offlineUploadMulter[_0xc3c9('0x3a')](),controller[_0xc3c9('0x3b')]);router[_0xc3c9('0x20')]('/:id/interactions',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x3c')]);router[_0xc3c9('0x20')](_0xc3c9('0x3d'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x3e')]);router[_0xc3c9('0x20')](_0xc3c9('0x1a'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x3f')]);router[_0xc3c9('0x20')](_0xc3c9('0x40'),auth['isAuthenticated'](),controller[_0xc3c9('0x41')]);router[_0xc3c9('0x42')](_0xc3c9('0xc'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x43')]);router[_0xc3c9('0x44')](_0xc3c9('0xc'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x45')]);router[_0xc3c9('0x44')]('/:id/dispositions',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x46')]);router['delete'](_0xc3c9('0x47'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x48')]);router['delete'](_0xc3c9('0x40'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0x49')]);module[_0xc3c9('0x4a')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 5e03972..b669d27 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 _0x1942=['beaver-logger/server','express','../config/environment','Router','env','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports'];(function(_0x8774d0,_0x5989f9){var _0x27ebed=function(_0x296fc7){while(--_0x296fc7){_0x8774d0['push'](_0x8774d0['shift']());}};_0x27ebed(++_0x5989f9);}(_0x1942,0x179));var _0x2194=function(_0x271d63,_0x40ca6f){_0x271d63=_0x271d63-0x0;var _0x16d485=_0x1942[_0x271d63];return _0x16d485;};var beaverLogger=require(_0x2194('0x0'));var express=require(_0x2194('0x1'));var auth=require('../components/auth/service');var config=require(_0x2194('0x2'));var router=express[_0x2194('0x3')]();var isProduction=config[_0x2194('0x4')]==='production'||![];function clientSideLogs(_0x459464,_0x526c81,_0x5571b9){var _0x390bd7=_0x459464[_0x2194('0x5')]['get'](_0x2194('0x6'));if(!_0x390bd7){throw new Error(_0x2194('0x7'));}return beaverLogger[_0x2194('0x8')]({'uri':_0x2194('0x9'),'logger':_0x390bd7,'enableCors':!isProduction})(_0x459464,_0x526c81,_0x5571b9);}router[_0x2194('0xa')](auth[_0x2194('0xb')](),clientSideLogs);module[_0x2194('0xc')]=router; \ No newline at end of file +var _0x1ba4=['env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../config/environment'];(function(_0x12fb17,_0xfb6eb6){var _0x56a609=function(_0x877d01){while(--_0x877d01){_0x12fb17['push'](_0x12fb17['shift']());}};_0x56a609(++_0xfb6eb6);}(_0x1ba4,0x17e));var _0x41ba=function(_0x245505,_0x18c203){_0x245505=_0x245505-0x0;var _0x2dfa0d=_0x1ba4[_0x245505];return _0x2dfa0d;};var beaverLogger=require('beaver-logger/server');var express=require(_0x41ba('0x0'));var auth=require('../components/auth/service');var config=require(_0x41ba('0x1'));var router=express['Router']();var isProduction=config[_0x41ba('0x2')]===_0x41ba('0x3')||![];function clientSideLogs(_0x31a81d,_0x5377eb,_0x506673){var _0x401578=_0x31a81d['app'][_0x41ba('0x4')](_0x41ba('0x5'));if(!_0x401578){throw new Error(_0x41ba('0x6'));}return beaverLogger[_0x41ba('0x7')]({'uri':_0x41ba('0x8'),'logger':_0x401578,'enableCors':!isProduction})(_0x31a81d,_0x5377eb,_0x506673);}router[_0x41ba('0x9')](auth[_0x41ba('0xa')](),clientSideLogs);module[_0x41ba('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index fa89edb..4b52266 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 _0x759d=['TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token'];(function(_0x2d2ff4,_0x1f59bc){var _0x18513a=function(_0x19d6e6){while(--_0x19d6e6){_0x2d2ff4['push'](_0x2d2ff4['shift']());}};_0x18513a(++_0x1f59bc);}(_0x759d,0x161));var _0xd759=function(_0x2bc84e,_0x1fcf67){_0x2bc84e=_0x2bc84e-0x0;var _0x4ad0b9=_0x759d[_0x2bc84e];return _0x4ad0b9;};'use strict';var Sequelize=require(_0xd759('0x0'));module[_0xd759('0x1')]={'name':{'type':Sequelize[_0xd759('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd759('0x3')](_0xd759('0x4'),'Google',_0xd759('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd759('0x3')](_0xd759('0x6'),_0xd759('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':_0xd759('0x8')},'data2':{'type':Sequelize[_0xd759('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xd759('0x2')],'comment':_0xd759('0x9')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0xd759('0xa')},'data6':{'type':Sequelize[_0xd759('0xb')],'comment':_0xd759('0xc')},'data7':{'type':Sequelize[_0xd759('0xb')],'comment':_0xd759('0xd')}}; \ No newline at end of file +var _0xcf13=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x4fa484,_0x306897){var _0x5be185=function(_0x299968){while(--_0x299968){_0x4fa484['push'](_0x4fa484['shift']());}};_0x5be185(++_0x306897);}(_0xcf13,0xf2));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3cf1('0x0'));module[_0x3cf1('0x1')]={'name':{'type':Sequelize[_0x3cf1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3cf1('0x3')](_0x3cf1('0x4'),'Google',_0x3cf1('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3cf1('0x3')](_0x3cf1('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x3cf1('0x2')],'comment':_0x3cf1('0x7')},'data2':{'type':Sequelize[_0x3cf1('0x2')],'comment':_0x3cf1('0x8')},'data3':{'type':Sequelize[_0x3cf1('0x2')],'comment':_0x3cf1('0x9')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x3cf1('0xa')],'comment':_0x3cf1('0xb')},'data6':{'type':Sequelize[_0x3cf1('0xa')],'comment':_0x3cf1('0xc')},'data7':{'type':Sequelize[_0x3cf1('0xa')],'comment':_0x3cf1('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6706975..1112ad9 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 _0xaa80=['update','then','destroy','end','sendStatus','error','name','send','padEnd','map','CloudProvider','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','rawAttributes','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','status','offset','undefined','limit','count','set','json'];(function(_0x49a94c,_0xd3fe12){var _0x1e57e9=function(_0x3f4585){while(--_0x3f4585){_0x49a94c['push'](_0x49a94c['shift']());}};_0x1e57e9(++_0xd3fe12);}(_0xaa80,0x1d0));var _0x0aa8=function(_0x54f03d,_0x5a6ce8){_0x54f03d=_0x54f03d-0x0;var _0x568f29=_0xaa80[_0x54f03d];return _0x568f29;};'use strict';var _=require('lodash');var Redis=require(_0x0aa8('0x0'));var qs=require(_0x0aa8('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x0aa8('0x2'))(_0x0aa8('0x3'));var db=require(_0x0aa8('0x4'))['db'];var oauth=require(_0x0aa8('0x5'));config[_0x0aa8('0x6')]=_[_0x0aa8('0x7')](config[_0x0aa8('0x6')],{'host':_0x0aa8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0aa8('0x6')]));var redis=new Redis(config[_0x0aa8('0x6')]);function respondWithStatusCode(_0x285923,_0x1c8df9){_0x1c8df9=_0x1c8df9||0xcc;return function(_0x3954b6){if(_0x3954b6){return _0x285923['sendStatus'](_0x1c8df9);}return _0x285923['status'](_0x1c8df9)['end']();};}function respondWithResult(_0x17abf7,_0x4a8d03){_0x4a8d03=_0x4a8d03||0xc8;return function(_0x218e64){if(_0x218e64){return _0x17abf7[_0x0aa8('0x9')](_0x4a8d03)['json'](_0x218e64);}};}function respondWithFilteredResult(_0x3cba6b,_0x250fd7){return function(_0x1cdaa6){if(_0x1cdaa6){var _0x1bac96=typeof _0x250fd7[_0x0aa8('0xa')]===_0x0aa8('0xb')&&typeof _0x250fd7[_0x0aa8('0xc')]===_0x0aa8('0xb');var _0x2dd6fc=_0x1cdaa6[_0x0aa8('0xd')];var _0x37a56d=_0x1bac96?0x0:_0x250fd7[_0x0aa8('0xa')];var _0x3603a6=_0x1bac96?_0x1cdaa6['count']:_0x250fd7[_0x0aa8('0xa')]+_0x250fd7[_0x0aa8('0xc')];var _0x485f87;if(_0x3603a6>=_0x2dd6fc){_0x3603a6=_0x2dd6fc;_0x485f87=0xc8;}else{_0x485f87=0xce;}_0x3cba6b[_0x0aa8('0x9')](_0x485f87);return _0x3cba6b[_0x0aa8('0xe')]('Content-Range',_0x37a56d+'-'+_0x3603a6+'/'+_0x2dd6fc)[_0x0aa8('0xf')](_0x1cdaa6);}return null;};}function saveUpdates(_0x2a0773){return function(_0x33c3d9){if(_0x33c3d9){return _0x33c3d9[_0x0aa8('0x10')](_0x2a0773)[_0x0aa8('0x11')](function(_0x29b053){return _0x29b053;});}return null;};}function removeEntity(_0x11d8e6){return function(_0x14cff9){if(_0x14cff9){return _0x14cff9[_0x0aa8('0x12')]()['then'](function(){_0x11d8e6['status'](0xcc)[_0x0aa8('0x13')]();});}};}function handleEntityNotFound(_0x17fa59){return function(_0x515abc){if(!_0x515abc){_0x17fa59[_0x0aa8('0x14')](0x194);}return _0x515abc;};}function handleError(_0x2b8bb2,_0x1dca15){_0x1dca15=_0x1dca15||0x1f4;return function(_0x5169d3){logger[_0x0aa8('0x15')](_0x5169d3['stack']);if(_0x5169d3[_0x0aa8('0x16')]){delete _0x5169d3['name'];}_0x2b8bb2[_0x0aa8('0x9')](_0x1dca15)[_0x0aa8('0x17')](_0x5169d3);};}function maskClientSecret(_0x3c84c7){return _[_0x0aa8('0x18')](_0x3c84c7['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x57c36a,_0x5b4685){var _0x109d72={},_0x134c2e={},_0x5d0262={'count':0x0,'rows':[]};var _0x1ef9c9=_[_0x0aa8('0x19')](db[_0x0aa8('0x1a')]['rawAttributes'],function(_0x8dc5e4){return{'name':_0x8dc5e4[_0x0aa8('0x1b')],'type':_0x8dc5e4[_0x0aa8('0x1c')][_0x0aa8('0x1d')]};});_0x134c2e[_0x0aa8('0x1e')]=_[_0x0aa8('0x19')](_0x1ef9c9,'name');_0x134c2e[_0x0aa8('0x1f')]=_[_0x0aa8('0x20')](_0x57c36a[_0x0aa8('0x1f')]);_0x134c2e['filters']=_[_0x0aa8('0x21')](_0x134c2e[_0x0aa8('0x1e')],_0x134c2e[_0x0aa8('0x1f')]);_0x109d72['attributes']=_[_0x0aa8('0x21')](_0x134c2e[_0x0aa8('0x1e')],qs[_0x0aa8('0x22')](_0x57c36a['query'][_0x0aa8('0x22')]));_0x109d72[_0x0aa8('0x23')]=_0x109d72['attributes'][_0x0aa8('0x24')]?_0x109d72[_0x0aa8('0x23')]:_0x134c2e[_0x0aa8('0x1e')];if(!_0x57c36a[_0x0aa8('0x1f')][_0x0aa8('0x25')](_0x0aa8('0x26'))){_0x109d72[_0x0aa8('0xc')]=qs[_0x0aa8('0xc')](_0x57c36a[_0x0aa8('0x1f')][_0x0aa8('0xc')]);_0x109d72[_0x0aa8('0xa')]=qs['offset'](_0x57c36a[_0x0aa8('0x1f')][_0x0aa8('0xa')]);}_0x109d72['order']=qs[_0x0aa8('0x27')](_0x57c36a[_0x0aa8('0x1f')][_0x0aa8('0x27')]);_0x109d72[_0x0aa8('0x28')]=qs[_0x0aa8('0x29')](_[_0x0aa8('0x2a')](_0x57c36a[_0x0aa8('0x1f')],_0x134c2e[_0x0aa8('0x29')]),_0x1ef9c9);if(_0x57c36a['query'][_0x0aa8('0x2b')]){_0x109d72[_0x0aa8('0x28')]=_[_0x0aa8('0x2c')](_0x109d72['where'],{'$or':_[_0x0aa8('0x19')](_0x1ef9c9,function(_0x2af270){if(_0x2af270['type']!=='VIRTUAL'){var _0x123ecf={};_0x123ecf[_0x2af270[_0x0aa8('0x16')]]={'$like':'%'+_0x57c36a[_0x0aa8('0x1f')][_0x0aa8('0x2b')]+'%'};return _0x123ecf;}})});}_0x109d72=_[_0x0aa8('0x2c')]({},_0x109d72,_0x57c36a[_0x0aa8('0x2d')]);var _0x48eaf2={'where':_0x109d72[_0x0aa8('0x28')]};return db[_0x0aa8('0x1a')][_0x0aa8('0xd')](_0x48eaf2)['then'](function(_0x10b5de){_0x5d0262[_0x0aa8('0xd')]=_0x10b5de;if(_0x57c36a[_0x0aa8('0x1f')][_0x0aa8('0x2e')]){_0x109d72[_0x0aa8('0x2f')]=[{'all':!![]}];}return db[_0x0aa8('0x1a')][_0x0aa8('0x30')](_0x109d72);})[_0x0aa8('0x11')](function(_0x417051){_0x5d0262[_0x0aa8('0x31')]=_[_0x0aa8('0x19')](_0x417051,function(_0x1684cb){if(_0x1684cb[_0x0aa8('0x32')]==='MicrosoftAzure'){var _0x1db669=encryptor[_0x0aa8('0x33')](_0x1684cb['data3']);_0x1684cb[_0x0aa8('0x34')]=maskClientSecret(_0x1db669);}return _0x1684cb;});return _0x5d0262;})[_0x0aa8('0x11')](respondWithFilteredResult(_0x5b4685,_0x109d72))[_0x0aa8('0x35')](handleError(_0x5b4685,null));};exports[_0x0aa8('0x36')]=function(_0x57f299,_0x208026){var _0x19b46e={'raw':!![],'where':{'id':_0x57f299['params']['id']}},_0x53ec36={};_0x53ec36[_0x0aa8('0x1e')]=_[_0x0aa8('0x20')](db['CloudProvider'][_0x0aa8('0x37')]);_0x53ec36['query']=_[_0x0aa8('0x20')](_0x57f299[_0x0aa8('0x1f')]);_0x53ec36[_0x0aa8('0x29')]=_[_0x0aa8('0x21')](_0x53ec36['model'],_0x53ec36[_0x0aa8('0x1f')]);_0x19b46e[_0x0aa8('0x23')]=_[_0x0aa8('0x21')](_0x53ec36[_0x0aa8('0x1e')],qs[_0x0aa8('0x22')](_0x57f299[_0x0aa8('0x1f')]['fields']));_0x19b46e[_0x0aa8('0x23')]=_0x19b46e['attributes'][_0x0aa8('0x24')]?_0x19b46e[_0x0aa8('0x23')]:_0x53ec36[_0x0aa8('0x1e')];if(_0x57f299[_0x0aa8('0x1f')]['includeAll']){_0x19b46e['include']=[{'all':!![]}];}_0x19b46e=_[_0x0aa8('0x2c')]({},_0x19b46e,_0x57f299[_0x0aa8('0x2d')]);return db[_0x0aa8('0x1a')][_0x0aa8('0x38')](_0x19b46e)[_0x0aa8('0x11')](handleEntityNotFound(_0x208026,null))[_0x0aa8('0x11')](function(_0x1d32ad){if(_0x1d32ad[_0x0aa8('0x32')]===_0x0aa8('0x39')){var _0x3b8e60=encryptor['decryptString'](_0x1d32ad['data3']);_0x1d32ad['data3']=maskClientSecret(_0x3b8e60);}return _0x1d32ad;})[_0x0aa8('0x11')](respondWithResult(_0x208026,null))[_0x0aa8('0x35')](handleError(_0x208026,null));};exports[_0x0aa8('0x3a')]=function(_0x475c2a,_0x54661a){if(!_0x475c2a[_0x0aa8('0x3b')]['name'])throw new Error(_0x0aa8('0x3c'));if(!_0x475c2a[_0x0aa8('0x3b')]['service'])throw new Error(_0x0aa8('0x3d'));var _0x238bb1=db[_0x0aa8('0x1a')]['rawAttributes']['service'][_0x0aa8('0x3e')];if(!_0x238bb1[_0x0aa8('0x3f')](_0x475c2a[_0x0aa8('0x3b')][_0x0aa8('0x32')]))throw new Error(_0x0aa8('0x40')+_0x238bb1[_0x0aa8('0x41')](',\x20'));if(_0x475c2a[_0x0aa8('0x3b')][_0x0aa8('0x32')]===_0x0aa8('0x39')&&_0x475c2a[_0x0aa8('0x3b')][_0x0aa8('0x34')]){_0x475c2a['body'][_0x0aa8('0x34')]=encryptor[_0x0aa8('0x42')](_0x475c2a['body'][_0x0aa8('0x34')]);}return db['CloudProvider'][_0x0aa8('0x3a')](_0x475c2a[_0x0aa8('0x3b')],{})[_0x0aa8('0x11')](respondWithResult(_0x54661a,0xc9))[_0x0aa8('0x35')](handleError(_0x54661a,null));};exports[_0x0aa8('0x10')]=function(_0x4efb32,_0x30165a){if(_0x4efb32['body']['id']){delete _0x4efb32[_0x0aa8('0x3b')]['id'];}return db[_0x0aa8('0x1a')]['find']({'where':{'id':_0x4efb32[_0x0aa8('0x43')]['id']}})[_0x0aa8('0x11')](handleEntityNotFound(_0x30165a,null))[_0x0aa8('0x11')](function(_0x116ecb){if(_0x116ecb['service']===_0x0aa8('0x39')&&_0x4efb32['body'][_0x0aa8('0x34')]){_0x4efb32[_0x0aa8('0x3b')][_0x0aa8('0x34')]=encryptor[_0x0aa8('0x42')](_0x4efb32['body'][_0x0aa8('0x34')]);}return _0x116ecb;})[_0x0aa8('0x11')](saveUpdates(_0x4efb32['body'],null))[_0x0aa8('0x11')](respondWithResult(_0x30165a,null))[_0x0aa8('0x35')](handleError(_0x30165a,null));};exports[_0x0aa8('0x12')]=function(_0x5724b1,_0x53dda7){return db['CloudProvider']['find']({'where':{'id':_0x5724b1[_0x0aa8('0x43')]['id']}})['then'](handleEntityNotFound(_0x53dda7,null))[_0x0aa8('0x11')](removeEntity(_0x53dda7,null))[_0x0aa8('0x35')](handleError(_0x53dda7,null));};exports[_0x0aa8('0x44')]=function(_0x20d6c8,_0x4c38ee){return db['CloudProvider'][_0x0aa8('0x45')]({'where':{'id':_0x20d6c8[_0x0aa8('0x43')]['id']},'raw':!![]})[_0x0aa8('0x11')](function(_0x15e861){if(!_0x15e861)return _0x4c38ee[_0x0aa8('0x14')](0x194);return{'url':oauth[_0x0aa8('0x46')](_0x15e861,_0x20d6c8[_0x0aa8('0x47')]['id'])};})[_0x0aa8('0x11')](respondWithResult(_0x4c38ee,null))[_0x0aa8('0x35')](handleError(_0x4c38ee,null));};exports[_0x0aa8('0x48')]=function(_0x562609,_0x3fd1d3){var _0x53048c=_0x562609[_0x0aa8('0x3b')];var _0x415602;var _0x272a34;if(_0x53048c['error'])throw _0x53048c;redis['get'](_0x53048c[_0x0aa8('0x49')])[_0x0aa8('0x11')](function(_0x39a3f0){if(!_0x39a3f0)throw new Error(_0x0aa8('0x4a'));_0x415602=JSON['parse'](_0x39a3f0);var _0x270680=Buffer[_0x0aa8('0x4b')](_0x53048c[_0x0aa8('0x49')],_0x0aa8('0x4c'))[_0x0aa8('0x4d')](_0x0aa8('0x4e'));_0x272a34=JSON['parse'](_0x270680);if(!oauth[_0x0aa8('0x4f')](_0x53048c['id_token'],_0x415602[_0x0aa8('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x0aa8('0x51')](_0x53048c[_0x0aa8('0x49')]);return oauth[_0x0aa8('0x52')](_0x53048c[_0x0aa8('0x53')],_0x415602);})['then'](function(_0x3ca306){_0x415602[_0x0aa8('0x54')]=_0x3ca306[_0x0aa8('0x55')];_0x415602[_0x0aa8('0x56')]=_0x3ca306[_0x0aa8('0x57')];return db['CloudProvider']['update']({'data5':_0x415602['data5'],'data6':_0x415602[_0x0aa8('0x56')]},{'where':{'id':_0x415602['id']}});})[_0x0aa8('0x11')](function(){oauth[_0x0aa8('0x58')](_0x415602);socket[_0x0aa8('0x59')](_0x0aa8('0x5a'),{'id':_0x272a34['id']});return;})[_0x0aa8('0x11')](respondWithStatusCode(_0x3fd1d3,null))[_0x0aa8('0x35')](function(_0x352466){if(_0x272a34){socket[_0x0aa8('0x59')](_0x0aa8('0x5b'),{'id':_0x272a34['id']});}if(!_0x415602){logger[_0x0aa8('0x15')](_0x0aa8('0x5c'),_0x352466);return _0x3fd1d3[_0x0aa8('0x9')](0x1f4)['send'](_0x352466[_0x0aa8('0x5d')]);}logger[_0x0aa8('0x15')](_0x0aa8('0x5e'),_0x415602['id'],JSON[_0x0aa8('0x5f')](_0x352466));});}; \ No newline at end of file +var _0xe25e=['ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','map','CloudProvider','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','includeAll','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','catch','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','parse','from','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash'];(function(_0x48ffb9,_0x1155de){var _0x4da8a8=function(_0x40a759){while(--_0x40a759){_0x48ffb9['push'](_0x48ffb9['shift']());}};_0x4da8a8(++_0x1155de);}(_0xe25e,0x177));var _0xee25=function(_0x53a489,_0x4855b4){_0x53a489=_0x53a489-0x0;var _0x239ddc=_0xe25e[_0x53a489];return _0x239ddc;};'use strict';var _=require(_0xee25('0x0'));var Redis=require(_0xee25('0x1'));var qs=require(_0xee25('0x2'));var encryptor=require(_0xee25('0x3'));var config=require(_0xee25('0x4'));var logger=require(_0xee25('0x5'))(_0xee25('0x6'));var db=require(_0xee25('0x7'))['db'];var oauth=require(_0xee25('0x8'));config['redis']=_[_0xee25('0x9')](config['redis'],{'host':_0xee25('0xa'),'port':0x18eb});var socket=require(_0xee25('0xb'))(new Redis(config[_0xee25('0xc')]));var redis=new Redis(config[_0xee25('0xc')]);function respondWithStatusCode(_0x3fc608,_0x522951){_0x522951=_0x522951||0xcc;return function(_0x495684){if(_0x495684){return _0x3fc608[_0xee25('0xd')](_0x522951);}return _0x3fc608[_0xee25('0xe')](_0x522951)[_0xee25('0xf')]();};}function respondWithResult(_0x590629,_0x478281){_0x478281=_0x478281||0xc8;return function(_0x9c9bcb){if(_0x9c9bcb){return _0x590629[_0xee25('0xe')](_0x478281)[_0xee25('0x10')](_0x9c9bcb);}};}function respondWithFilteredResult(_0xf117fa,_0x1dfa30){return function(_0xf6f368){if(_0xf6f368){var _0x329e1a=typeof _0x1dfa30[_0xee25('0x11')]===_0xee25('0x12')&&typeof _0x1dfa30[_0xee25('0x13')]==='undefined';var _0x1fe203=_0xf6f368[_0xee25('0x14')];var _0x52bae1=_0x329e1a?0x0:_0x1dfa30[_0xee25('0x11')];var _0x36cd43=_0x329e1a?_0xf6f368['count']:_0x1dfa30[_0xee25('0x11')]+_0x1dfa30[_0xee25('0x13')];var _0x520b53;if(_0x36cd43>=_0x1fe203){_0x36cd43=_0x1fe203;_0x520b53=0xc8;}else{_0x520b53=0xce;}_0xf117fa[_0xee25('0xe')](_0x520b53);return _0xf117fa[_0xee25('0x15')](_0xee25('0x16'),_0x52bae1+'-'+_0x36cd43+'/'+_0x1fe203)[_0xee25('0x10')](_0xf6f368);}return null;};}function saveUpdates(_0x1bd475){return function(_0x31b484){if(_0x31b484){return _0x31b484[_0xee25('0x17')](_0x1bd475)[_0xee25('0x18')](function(_0x4b1c1d){return _0x4b1c1d;});}return null;};}function removeEntity(_0x57d4c6){return function(_0x37a50e){if(_0x37a50e){return _0x37a50e[_0xee25('0x19')]()[_0xee25('0x18')](function(){_0x57d4c6[_0xee25('0xe')](0xcc)[_0xee25('0xf')]();});}};}function handleEntityNotFound(_0x513ef9){return function(_0x4ddbc0){if(!_0x4ddbc0){_0x513ef9[_0xee25('0xd')](0x194);}return _0x4ddbc0;};}function handleError(_0x3f605b,_0x5bc267){_0x5bc267=_0x5bc267||0x1f4;return function(_0x858d8b){logger[_0xee25('0x1a')](_0x858d8b[_0xee25('0x1b')]);if(_0x858d8b[_0xee25('0x1c')]){delete _0x858d8b[_0xee25('0x1c')];}_0x3f605b[_0xee25('0xe')](_0x5bc267)[_0xee25('0x1d')](_0x858d8b);};}function maskClientSecret(_0x594224){return _[_0xee25('0x1e')](_0x594224[_0xee25('0x1f')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3e1f43,_0x5490e3){var _0x31f6c3={},_0x575da4={},_0x10624b={'count':0x0,'rows':[]};var _0x18652b=_[_0xee25('0x20')](db[_0xee25('0x21')][_0xee25('0x22')],function(_0x2ecaab){return{'name':_0x2ecaab['fieldName'],'type':_0x2ecaab[_0xee25('0x23')][_0xee25('0x24')]};});_0x575da4['model']=_[_0xee25('0x20')](_0x18652b,_0xee25('0x1c'));_0x575da4[_0xee25('0x25')]=_[_0xee25('0x26')](_0x3e1f43[_0xee25('0x25')]);_0x575da4['filters']=_[_0xee25('0x27')](_0x575da4[_0xee25('0x28')],_0x575da4[_0xee25('0x25')]);_0x31f6c3[_0xee25('0x29')]=_[_0xee25('0x27')](_0x575da4[_0xee25('0x28')],qs[_0xee25('0x2a')](_0x3e1f43[_0xee25('0x25')][_0xee25('0x2a')]));_0x31f6c3['attributes']=_0x31f6c3[_0xee25('0x29')][_0xee25('0x2b')]?_0x31f6c3[_0xee25('0x29')]:_0x575da4[_0xee25('0x28')];if(!_0x3e1f43[_0xee25('0x25')][_0xee25('0x2c')]('nolimit')){_0x31f6c3[_0xee25('0x13')]=qs['limit'](_0x3e1f43[_0xee25('0x25')][_0xee25('0x13')]);_0x31f6c3[_0xee25('0x11')]=qs[_0xee25('0x11')](_0x3e1f43[_0xee25('0x25')][_0xee25('0x11')]);}_0x31f6c3[_0xee25('0x2d')]=qs[_0xee25('0x2e')](_0x3e1f43[_0xee25('0x25')][_0xee25('0x2e')]);_0x31f6c3[_0xee25('0x2f')]=qs[_0xee25('0x30')](_[_0xee25('0x31')](_0x3e1f43[_0xee25('0x25')],_0x575da4[_0xee25('0x30')]),_0x18652b);if(_0x3e1f43[_0xee25('0x25')]['filter']){_0x31f6c3['where']=_['merge'](_0x31f6c3[_0xee25('0x2f')],{'$or':_[_0xee25('0x20')](_0x18652b,function(_0x34c06c){if(_0x34c06c['type']!=='VIRTUAL'){var _0x345fa9={};_0x345fa9[_0x34c06c[_0xee25('0x1c')]]={'$like':'%'+_0x3e1f43[_0xee25('0x25')][_0xee25('0x32')]+'%'};return _0x345fa9;}})});}_0x31f6c3=_[_0xee25('0x33')]({},_0x31f6c3,_0x3e1f43[_0xee25('0x34')]);var _0x65bdaa={'where':_0x31f6c3[_0xee25('0x2f')]};return db[_0xee25('0x21')][_0xee25('0x14')](_0x65bdaa)[_0xee25('0x18')](function(_0x5205e3){_0x10624b[_0xee25('0x14')]=_0x5205e3;if(_0x3e1f43['query']['includeAll']){_0x31f6c3[_0xee25('0x35')]=[{'all':!![]}];}return db[_0xee25('0x21')][_0xee25('0x36')](_0x31f6c3);})[_0xee25('0x18')](function(_0x37e066){_0x10624b[_0xee25('0x37')]=_[_0xee25('0x20')](_0x37e066,function(_0x5315c0){if(_0x5315c0[_0xee25('0x38')]===_0xee25('0x39')){var _0x279d51=encryptor[_0xee25('0x3a')](_0x5315c0['data3']);_0x5315c0[_0xee25('0x3b')]=maskClientSecret(_0x279d51);}return _0x5315c0;});return _0x10624b;})[_0xee25('0x18')](respondWithFilteredResult(_0x5490e3,_0x31f6c3))['catch'](handleError(_0x5490e3,null));};exports[_0xee25('0x3c')]=function(_0x4317be,_0x52f3d3){var _0xca8b98={'raw':!![],'where':{'id':_0x4317be['params']['id']}},_0x209f00={};_0x209f00[_0xee25('0x28')]=_['keys'](db[_0xee25('0x21')][_0xee25('0x22')]);_0x209f00['query']=_[_0xee25('0x26')](_0x4317be[_0xee25('0x25')]);_0x209f00[_0xee25('0x30')]=_[_0xee25('0x27')](_0x209f00[_0xee25('0x28')],_0x209f00[_0xee25('0x25')]);_0xca8b98[_0xee25('0x29')]=_[_0xee25('0x27')](_0x209f00[_0xee25('0x28')],qs['fields'](_0x4317be[_0xee25('0x25')][_0xee25('0x2a')]));_0xca8b98[_0xee25('0x29')]=_0xca8b98[_0xee25('0x29')][_0xee25('0x2b')]?_0xca8b98[_0xee25('0x29')]:_0x209f00[_0xee25('0x28')];if(_0x4317be[_0xee25('0x25')][_0xee25('0x3d')]){_0xca8b98['include']=[{'all':!![]}];}_0xca8b98=_[_0xee25('0x33')]({},_0xca8b98,_0x4317be[_0xee25('0x34')]);return db['CloudProvider'][_0xee25('0x3e')](_0xca8b98)[_0xee25('0x18')](handleEntityNotFound(_0x52f3d3,null))['then'](function(_0x3e816f){if(_0x3e816f['service']==='MicrosoftAzure'){var _0x5ac705=encryptor[_0xee25('0x3a')](_0x3e816f[_0xee25('0x3b')]);_0x3e816f[_0xee25('0x3b')]=maskClientSecret(_0x5ac705);}return _0x3e816f;})['then'](respondWithResult(_0x52f3d3,null))['catch'](handleError(_0x52f3d3,null));};exports[_0xee25('0x3f')]=function(_0x5ed9db,_0x1b93c){if(!_0x5ed9db[_0xee25('0x40')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5ed9db['body'][_0xee25('0x38')])throw new Error(_0xee25('0x41'));var _0x202f38=db[_0xee25('0x21')][_0xee25('0x22')][_0xee25('0x38')][_0xee25('0x42')];if(!_0x202f38[_0xee25('0x43')](_0x5ed9db[_0xee25('0x40')][_0xee25('0x38')]))throw new Error(_0xee25('0x44')+_0x202f38['join'](',\x20'));if(_0x5ed9db[_0xee25('0x40')][_0xee25('0x38')]==='MicrosoftAzure'&&_0x5ed9db[_0xee25('0x40')][_0xee25('0x3b')]){_0x5ed9db[_0xee25('0x40')][_0xee25('0x3b')]=encryptor[_0xee25('0x45')](_0x5ed9db['body'][_0xee25('0x3b')]);}return db[_0xee25('0x21')][_0xee25('0x3f')](_0x5ed9db[_0xee25('0x40')],{})[_0xee25('0x18')](respondWithResult(_0x1b93c,0xc9))[_0xee25('0x46')](handleError(_0x1b93c,null));};exports[_0xee25('0x17')]=function(_0x3556f3,_0x38511f){if(_0x3556f3[_0xee25('0x40')]['id']){delete _0x3556f3['body']['id'];}return db[_0xee25('0x21')]['find']({'where':{'id':_0x3556f3[_0xee25('0x47')]['id']}})[_0xee25('0x18')](handleEntityNotFound(_0x38511f,null))['then'](function(_0x355538){if(_0x355538[_0xee25('0x38')]===_0xee25('0x39')&&_0x3556f3['body'][_0xee25('0x3b')]){_0x3556f3['body'][_0xee25('0x3b')]=encryptor[_0xee25('0x45')](_0x3556f3[_0xee25('0x40')][_0xee25('0x3b')]);}return _0x355538;})['then'](saveUpdates(_0x3556f3[_0xee25('0x40')],null))['then'](respondWithResult(_0x38511f,null))[_0xee25('0x46')](handleError(_0x38511f,null));};exports[_0xee25('0x19')]=function(_0x52a8fc,_0x695fb5){return db[_0xee25('0x21')][_0xee25('0x3e')]({'where':{'id':_0x52a8fc['params']['id']}})[_0xee25('0x18')](handleEntityNotFound(_0x695fb5,null))[_0xee25('0x18')](removeEntity(_0x695fb5,null))[_0xee25('0x46')](handleError(_0x695fb5,null));};exports[_0xee25('0x48')]=function(_0x245d5a,_0x472734){return db[_0xee25('0x21')][_0xee25('0x49')]({'where':{'id':_0x245d5a[_0xee25('0x47')]['id']},'raw':!![]})['then'](function(_0x22026e){if(!_0x22026e)return _0x472734[_0xee25('0xd')](0x194);return{'url':oauth[_0xee25('0x4a')](_0x22026e,_0x245d5a[_0xee25('0x4b')]['id'])};})['then'](respondWithResult(_0x472734,null))['catch'](handleError(_0x472734,null));};exports['oauth2MicrosoftCallback']=function(_0x6cddcf,_0x17fbc0){var _0x16393d=_0x6cddcf[_0xee25('0x40')];var _0x34245e;var _0x22e007;if(_0x16393d['error'])throw _0x16393d;redis[_0xee25('0x4c')](_0x16393d[_0xee25('0x4d')])['then'](function(_0x3fa321){if(!_0x3fa321)throw new Error('Invalid\x20state\x20parameter');_0x34245e=JSON[_0xee25('0x4e')](_0x3fa321);var _0x298d39=Buffer[_0xee25('0x4f')](_0x16393d[_0xee25('0x4d')],'base64')[_0xee25('0x50')](_0xee25('0x51'));_0x22e007=JSON[_0xee25('0x4e')](_0x298d39);if(!oauth['isValidIdToken'](_0x16393d[_0xee25('0x52')],_0x34245e[_0xee25('0x53')]))throw new Error(_0xee25('0x54'));redis['del'](_0x16393d[_0xee25('0x4d')]);return oauth['getOauth2MicrosoftAccessToken'](_0x16393d[_0xee25('0x55')],_0x34245e);})['then'](function(_0x3fa696){_0x34245e[_0xee25('0x56')]=_0x3fa696[_0xee25('0x57')];_0x34245e['data6']=_0x3fa696[_0xee25('0x58')];return db['CloudProvider']['update']({'data5':_0x34245e[_0xee25('0x56')],'data6':_0x34245e['data6']},{'where':{'id':_0x34245e['id']}});})['then'](function(){oauth[_0xee25('0x59')](_0x34245e);socket[_0xee25('0x5a')](_0xee25('0x5b'),{'id':_0x22e007['id']});return;})[_0xee25('0x18')](respondWithStatusCode(_0x17fbc0,null))[_0xee25('0x46')](function(_0x49d575){if(_0x22e007){socket[_0xee25('0x5a')]('microsoftAuthorization:error',{'id':_0x22e007['id']});}if(!_0x34245e){logger['error'](_0xee25('0x5c'),_0x49d575);return _0x17fbc0[_0xee25('0xe')](0x1f4)['send'](_0x49d575['message']);}logger[_0xee25('0x1a')](_0xee25('0x5d'),_0x34245e['id'],JSON['stringify'](_0x49d575));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7402aa0..c6a925a 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 _0x39c0=['cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x3b80c0,_0x48642f){var _0x5e497a=function(_0x5ca4eb){while(--_0x5ca4eb){_0x3b80c0['push'](_0x3b80c0['shift']());}};_0x5e497a(++_0x48642f);}(_0x39c0,0x10b));var _0x039c=function(_0x3d3b5d,_0x2deb32){_0x3d3b5d=_0x3d3b5d-0x0;var _0x147b76=_0x39c0[_0x3d3b5d];return _0x147b76;};'use strict';var _=require(_0x039c('0x0'));var util=require(_0x039c('0x1'));var logger=require(_0x039c('0x2'))(_0x039c('0x3'));var moment=require(_0x039c('0x4'));var BPromise=require(_0x039c('0x5'));var rp=require(_0x039c('0x6'));var fs=require('fs');var path=require(_0x039c('0x7'));var rimraf=require(_0x039c('0x8'));var config=require(_0x039c('0x9'));var attributes=require('./cloudProvider.attributes');module[_0x039c('0xa')]=function(_0x37182d,_0x25c52d){return _0x37182d[_0x039c('0xb')](_0x039c('0xc'),attributes,{'tableName':_0x039c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2db4=['moment','bluebird','request-promise','path','../../config/environment','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2db4,0xd5));var _0x42db=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2db4[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x42db('0x0'));var logger=require(_0x42db('0x1'))(_0x42db('0x2'));var moment=require(_0x42db('0x3'));var BPromise=require(_0x42db('0x4'));var rp=require(_0x42db('0x5'));var fs=require('fs');var path=require(_0x42db('0x6'));var rimraf=require('rimraf');var config=require(_0x42db('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x42db('0x8')]=function(_0x1bccb4,_0x3b612c){return _0x1bccb4[_0x42db('0x9')](_0x42db('0xa'),attributes,{'tableName':_0x42db('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 53e9356..31f46f1 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 _0x1dcc=['code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','join','data4','form_post','state','login','key','value','set','decode','issuer','aud','audience','nonce','isAfter','exp','resolve','then','data3','findOne','refresh_token','decryptString','POST','data2','data5','access_token','data6','CloudProvider','update','catch','error','authorization_code','intervals','bind','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','/.default','Outlook365','Dynamics365','replace','{TENANT_ID}'];(function(_0x1c3c09,_0x5ed170){var _0x28a78e=function(_0x43d486){while(--_0x43d486){_0x1c3c09['push'](_0x1c3c09['shift']());}};_0x28a78e(++_0x5ed170);}(_0x1dcc,0x79));var _0xc1dc=function(_0x5c0251,_0xc32d67){_0x5c0251=_0x5c0251-0x0;var _0x3fe699=_0x1dcc[_0x5c0251];return _0x3fe699;};'use strict';var _=require(_0xc1dc('0x0'));var crypto=require('crypto');var jwt=require(_0xc1dc('0x1'));var moment=require(_0xc1dc('0x2'));var Redis=require('ioredis');var rp=require(_0xc1dc('0x3'));var util=require(_0xc1dc('0x4'));var encryptor=require(_0xc1dc('0x5'));var config=require(_0xc1dc('0x6'));var logger=require('../../config/logger')(_0xc1dc('0x7'));var schedule=require(_0xc1dc('0x8'));var db=require('../../mysqldb')['db'];config[_0xc1dc('0x9')]=_[_0xc1dc('0xa')](config[_0xc1dc('0x9')],{'host':_0xc1dc('0xb'),'port':0x18eb});var redis=new Redis(config[_0xc1dc('0x9')]);var MICROSOFT_AUTH_URL=_0xc1dc('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xc1dc('0xd'),'profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0xc1dc('0xe'),_0xc1dc('0xf')],'Dynamics365':[_0xc1dc('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xc1dc('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0xc1dc('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2d503e){var _0x44a348=_[_0xc1dc('0x12')](AZURE_AUTH_SCOPES[_0x2d503e['type']]);if(_0x2d503e[_0xc1dc('0x13')]==='Dynamics365')_0x44a348[_0xc1dc('0x14')](_0x2d503e[_0xc1dc('0x15')]+_0xc1dc('0x16'));return _0x44a348['join']('\x20');}function getAccessTokenScope(_0x572cdb){if(_0x572cdb[_0xc1dc('0x13')]===_0xc1dc('0x17'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x572cdb[_0xc1dc('0x13')]===_0xc1dc('0x18'))return _0x572cdb[_0xc1dc('0x15')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x489ed2,_0x1750a5){var _0x40bf64=MICROSOFT_AUTH_URL[_0xc1dc('0x19')](_0xc1dc('0x1a'),_0x489ed2['data2']);var _0x424c3f=[_0xc1dc('0x1b'),_0xc1dc('0x1c')];var _0x41f31c=Buffer[_0xc1dc('0x1d')](JSON[_0xc1dc('0x1e')]({'id':_0x1750a5}))['toString'](_0xc1dc('0x1f'));var _0x2803a8=crypto[_0xc1dc('0x20')](0x10)[_0xc1dc('0x21')](_0xc1dc('0x22'));var _0x22a689=getAuthorizationScopes(_0x489ed2);var _0x1949a5=[{'key':_0xc1dc('0x23'),'value':_0x489ed2[_0xc1dc('0x24')]},{'key':_0xc1dc('0x25'),'value':encodeURIComponent(_0x424c3f[_0xc1dc('0x26')]('\x20'))},{'key':'redirect_uri','value':_0x489ed2[_0xc1dc('0x27')]},{'key':'response_mode','value':_0xc1dc('0x28')},{'key':'scope','value':encodeURIComponent(_0x22a689)},{'key':_0xc1dc('0x29'),'value':_0x41f31c},{'key':'nonce','value':_0x2803a8},{'key':'prompt','value':_0xc1dc('0x2a')}];var _0x3a3479=_0x40bf64+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x1949a5,function(_0x1f6d64){return _0x1f6d64[_0xc1dc('0x2b')]+'='+_0x1f6d64[_0xc1dc('0x2c')];})[_0xc1dc('0x26')]('&');_0x489ed2['oauth2Claims']={'issuer':_0x40bf64['replace']('oauth2/',''),'audience':_0x489ed2[_0xc1dc('0x24')],'state':_0x41f31c,'nonce':_0x2803a8};redis[_0xc1dc('0x2d')](_0x41f31c,JSON[_0xc1dc('0x1e')](_0x489ed2));return _0x3a3479;}function isValidIdToken(_0x3aa0b2,_0x49a9a9){try{var _0x1b8993=jwt[_0xc1dc('0x2e')](_0x3aa0b2,{'complete':!![]});var _0x59bc61=_0x1b8993['payload'];if(_0x59bc61['iss']!==_0x49a9a9[_0xc1dc('0x2f')])return![];if(_0x59bc61[_0xc1dc('0x30')]!==_0x49a9a9[_0xc1dc('0x31')])return![];if(_0x59bc61['nonce']!==_0x49a9a9[_0xc1dc('0x32')])return![];if(moment()[_0xc1dc('0x33')](moment['unix'](_0x59bc61[_0xc1dc('0x34')])))return![];return!![];}catch(_0x1d12ac){throw _0x1d12ac;}}function refreshOauth2MicrosoftAccessToken(_0x43a699){return Promise[_0xc1dc('0x35')]()[_0xc1dc('0x36')](function(){if(_0x43a699[_0xc1dc('0x37')])return _0x43a699;return db['CloudProvider'][_0xc1dc('0x38')]({'where':{'id':_0x43a699['id']},'raw':!![]});})[_0xc1dc('0x36')](function(_0x5cff2f){var _0x3f0c78={'grant_type':_0xc1dc('0x39'),'refresh_token':_0x5cff2f['data6'],'scope':getAccessTokenScope(_0x5cff2f),'redirect_uri':_0x5cff2f[_0xc1dc('0x27')],'client_id':_0x5cff2f[_0xc1dc('0x24')],'client_secret':encryptor[_0xc1dc('0x3a')](_0x5cff2f[_0xc1dc('0x37')])};var _0x3e8cd3={'method':_0xc1dc('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xc1dc('0x19')](_0xc1dc('0x1a'),_0x5cff2f[_0xc1dc('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f0c78,'json':!![]};return rp(_0x3e8cd3);})[_0xc1dc('0x36')](function(_0x2810dc){_0x43a699[_0xc1dc('0x3d')]=_0x2810dc[_0xc1dc('0x3e')];_0x43a699[_0xc1dc('0x3f')]=_0x2810dc[_0xc1dc('0x39')];return db[_0xc1dc('0x40')][_0xc1dc('0x41')]({'data5':_0x43a699[_0xc1dc('0x3d')],'data6':_0x43a699[_0xc1dc('0x3f')]},{'where':{'id':_0x43a699['id']}});})['then'](function(){return _0x43a699;})[_0xc1dc('0x42')](function(_0x1a03b1){logger[_0xc1dc('0x43')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x43a699['id'],_0x1a03b1);});}function getOauth2MicrosoftAccessToken(_0x5d0ae4,_0x4e1387){var _0x302826={'grant_type':_0xc1dc('0x44'),'code':_0x5d0ae4,'scope':getAccessTokenScope(_0x4e1387),'redirect_uri':_0x4e1387[_0xc1dc('0x27')],'client_id':_0x4e1387[_0xc1dc('0x24')],'client_secret':encryptor['decryptString'](_0x4e1387[_0xc1dc('0x37')])};var _0x2c6dcf={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc1dc('0x19')]('{TENANT_ID}',_0x4e1387['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x302826,'json':!![]};return rp(_0x2c6dcf);}function startRefreshInterval(_0x24d756){var _0x723f3e=schedule[_0xc1dc('0x45')];if(_0x723f3e[_0x24d756['id']])clearInterval(_0x723f3e[_0x24d756['id']]);_0x723f3e[_0x24d756['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xc1dc('0x46')](this,{'id':_0x24d756['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xc1dc('0x45')]=_0x723f3e;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xc1dc('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc1dc('0x36')](function(_0x27a87b){var _0x573c74=_0x27a87b[_0xc1dc('0x12')](function(_0x4d0340){return refreshOauth2MicrosoftAccessToken(_0x4d0340)['then'](function(_0x36d173){startRefreshInterval(_0x36d173);});});return Promise['all'](_0x573c74);})[_0xc1dc('0x42')](function(_0x9f7ed8){var _0x391a05=_0x9f7ed8?util[_0xc1dc('0x48')](_0x9f7ed8,{'showHidden':![],'depth':null}):'';logger['error'](_0xc1dc('0x49'),_0x391a05);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x0ed4=['https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','value','oauth2/','data1','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','../../config/environment','api','redis','defaults','localhost'];(function(_0x389ae9,_0x506e63){var _0x3effc8=function(_0x20d8a4){while(--_0x20d8a4){_0x389ae9['push'](_0x389ae9['shift']());}};_0x3effc8(++_0x506e63);}(_0x0ed4,0x1d0));var _0x40ed=function(_0x22342c,_0x218835){_0x22342c=_0x22342c-0x0;var _0xd3b434=_0x0ed4[_0x22342c];return _0xd3b434;};'use strict';var _=require(_0x40ed('0x0'));var crypto=require(_0x40ed('0x1'));var jwt=require(_0x40ed('0x2'));var moment=require(_0x40ed('0x3'));var Redis=require(_0x40ed('0x4'));var rp=require('request-promise');var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x40ed('0x5'));var logger=require('../../config/logger')(_0x40ed('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x40ed('0x7')]=_[_0x40ed('0x8')](config[_0x40ed('0x7')],{'host':_0x40ed('0x9'),'port':0x18eb});var redis=new Redis(config[_0x40ed('0x7')]);var MICROSOFT_AUTH_URL=_0x40ed('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x40ed('0xb'),_0x40ed('0xc'),'email',_0x40ed('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0x40ed('0xe')],'Dynamics365':[_0x40ed('0xb'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x40ed('0xf');var MICROSOFT_TOKEN_ENDPOINT=_0x40ed('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5bb5a1){var _0x2b3b4f=_[_0x40ed('0x11')](AZURE_AUTH_SCOPES[_0x5bb5a1['type']]);if(_0x5bb5a1[_0x40ed('0x12')]===_0x40ed('0x13'))_0x2b3b4f[_0x40ed('0x14')](_0x5bb5a1[_0x40ed('0x15')]+_0x40ed('0x16'));return _0x2b3b4f[_0x40ed('0x17')]('\x20');}function getAccessTokenScope(_0xc35046){if(_0xc35046[_0x40ed('0x12')]===_0x40ed('0x18'))return _0x40ed('0x19');if(_0xc35046[_0x40ed('0x12')]==='Dynamics365')return _0xc35046['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x30f7c0,_0x2535a9){var _0x4f3ed8=MICROSOFT_AUTH_URL[_0x40ed('0x1a')](_0x40ed('0x1b'),_0x30f7c0[_0x40ed('0x1c')]);var _0x40ee1b=[_0x40ed('0x1d'),_0x40ed('0x1e')];var _0x35b848=Buffer[_0x40ed('0x1f')](JSON[_0x40ed('0x20')]({'id':_0x2535a9}))[_0x40ed('0x21')](_0x40ed('0x22'));var _0x164011=crypto[_0x40ed('0x23')](0x10)[_0x40ed('0x21')]('hex');var _0x403f98=getAuthorizationScopes(_0x30f7c0);var _0xa5445c=[{'key':'client_id','value':_0x30f7c0['data1']},{'key':_0x40ed('0x24'),'value':encodeURIComponent(_0x40ee1b['join']('\x20'))},{'key':_0x40ed('0x25'),'value':_0x30f7c0[_0x40ed('0x26')]},{'key':_0x40ed('0x27'),'value':_0x40ed('0x28')},{'key':_0x40ed('0x29'),'value':encodeURIComponent(_0x403f98)},{'key':'state','value':_0x35b848},{'key':_0x40ed('0x2a'),'value':_0x164011},{'key':'prompt','value':'login'}];var _0x55d20b=_0x4f3ed8+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x40ed('0x11')](_0xa5445c,function(_0x33d264){return _0x33d264['key']+'='+_0x33d264[_0x40ed('0x2b')];})['join']('&');_0x30f7c0['oauth2Claims']={'issuer':_0x4f3ed8[_0x40ed('0x1a')](_0x40ed('0x2c'),''),'audience':_0x30f7c0[_0x40ed('0x2d')],'state':_0x35b848,'nonce':_0x164011};redis[_0x40ed('0x2e')](_0x35b848,JSON[_0x40ed('0x20')](_0x30f7c0));return _0x55d20b;}function isValidIdToken(_0x24ad16,_0x474962){try{var _0x197f19=jwt[_0x40ed('0x2f')](_0x24ad16,{'complete':!![]});var _0x40eb00=_0x197f19[_0x40ed('0x30')];if(_0x40eb00[_0x40ed('0x31')]!==_0x474962[_0x40ed('0x32')])return![];if(_0x40eb00[_0x40ed('0x33')]!==_0x474962[_0x40ed('0x34')])return![];if(_0x40eb00[_0x40ed('0x2a')]!==_0x474962[_0x40ed('0x2a')])return![];if(moment()[_0x40ed('0x35')](moment[_0x40ed('0x36')](_0x40eb00[_0x40ed('0x37')])))return![];return!![];}catch(_0x12621c){throw _0x12621c;}}function refreshOauth2MicrosoftAccessToken(_0x2680a5){return Promise[_0x40ed('0x38')]()[_0x40ed('0x39')](function(){if(_0x2680a5['data3'])return _0x2680a5;return db[_0x40ed('0x3a')][_0x40ed('0x3b')]({'where':{'id':_0x2680a5['id']},'raw':!![]});})['then'](function(_0x1e286d){var _0x3a5e79={'grant_type':_0x40ed('0x3c'),'refresh_token':_0x1e286d[_0x40ed('0x3d')],'scope':getAccessTokenScope(_0x1e286d),'redirect_uri':_0x1e286d['data4'],'client_id':_0x1e286d['data1'],'client_secret':encryptor[_0x40ed('0x3e')](_0x1e286d[_0x40ed('0x3f')])};var _0x4eb172={'method':_0x40ed('0x40'),'uri':MICROSOFT_AUTH_URL[_0x40ed('0x1a')](_0x40ed('0x1b'),_0x1e286d[_0x40ed('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3a5e79,'json':!![]};return rp(_0x4eb172);})[_0x40ed('0x39')](function(_0x108da5){_0x2680a5[_0x40ed('0x41')]=_0x108da5[_0x40ed('0x42')];_0x2680a5[_0x40ed('0x3d')]=_0x108da5['refresh_token'];return db['CloudProvider'][_0x40ed('0x43')]({'data5':_0x2680a5['data5'],'data6':_0x2680a5[_0x40ed('0x3d')]},{'where':{'id':_0x2680a5['id']}});})['then'](function(){return _0x2680a5;})[_0x40ed('0x44')](function(_0x481a62){logger[_0x40ed('0x45')](_0x40ed('0x46'),_0x2680a5['id'],_0x481a62);});}function getOauth2MicrosoftAccessToken(_0x81782e,_0x30a454){var _0x38c655={'grant_type':_0x40ed('0x47'),'code':_0x81782e,'scope':getAccessTokenScope(_0x30a454),'redirect_uri':_0x30a454[_0x40ed('0x26')],'client_id':_0x30a454[_0x40ed('0x2d')],'client_secret':encryptor[_0x40ed('0x3e')](_0x30a454[_0x40ed('0x3f')])};var _0x5ed4bb={'method':_0x40ed('0x40'),'uri':MICROSOFT_AUTH_URL[_0x40ed('0x1a')](_0x40ed('0x1b'),_0x30a454[_0x40ed('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x38c655,'json':!![]};return rp(_0x5ed4bb);}function startRefreshInterval(_0x523879){var _0x1db4f2=schedule[_0x40ed('0x48')];if(_0x1db4f2[_0x523879['id']])clearInterval(_0x1db4f2[_0x523879['id']]);_0x1db4f2[_0x523879['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x40ed('0x49')](this,{'id':_0x523879['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x40ed('0x48')]=_0x1db4f2;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x40ed('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2e57b3){var _0x2b4057=_0x2e57b3[_0x40ed('0x11')](function(_0x1641ae){return refreshOauth2MicrosoftAccessToken(_0x1641ae)[_0x40ed('0x39')](function(_0x377b27){startRefreshInterval(_0x377b27);});});return Promise[_0x40ed('0x4b')](_0x2b4057);})[_0x40ed('0x44')](function(_0x26f481){var _0x498778=_0x26f481?util[_0x40ed('0x4c')](_0x26f481,{'showHidden':![],'depth':null}):'';logger['error'](_0x40ed('0x4d'),_0x498778);});}module[_0x40ed('0x4e')]={'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 caa51bd..d863a47 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 _0x36fe=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x381080,_0x2ed325){var _0x529ae7=function(_0x3e8197){while(--_0x3e8197){_0x381080['push'](_0x381080['shift']());}};_0x529ae7(++_0x2ed325);}(_0x36fe,0x127));var _0xe36f=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x36fe[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var moment=require(_0xe36f('0x2'));var BPromise=require(_0xe36f('0x3'));var rs=require(_0xe36f('0x4'));var fs=require('fs');var Redis=require(_0xe36f('0x5'));var db=require(_0xe36f('0x6'))['db'];var utils=require(_0xe36f('0x7'));var logger=require(_0xe36f('0x8'))(_0xe36f('0x9'));var config=require(_0xe36f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe36f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349c9e,_0xdae131,_0x5a0d3c){return new BPromise(function(_0x1ecd6b,_0x21f2a5){return client['request'](_0x349c9e,_0x5a0d3c)[_0xe36f('0xc')](function(_0x386c00){logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,_0xe36f('0xf'));logger['debug'](_0xe36f('0x10'),_0xdae131,'request\x20sent',JSON[_0xe36f('0x11')](_0x386c00));if(_0x386c00[_0xe36f('0x12')]){if(_0x386c00[_0xe36f('0x12')]['code']===0x1f4){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x386c00['error'][_0xe36f('0x13')]);return _0x21f2a5(_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);}logger[_0xe36f('0x12')]('CloudProvider,\x20%s,\x20%s',_0xdae131,_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);return _0x1ecd6b(_0x386c00[_0xe36f('0x12')]['message']);}else{logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,'request\x20sent');_0x1ecd6b(_0x386c00[_0xe36f('0x14')][_0xe36f('0x13')]);}})[_0xe36f('0x15')](function(_0x3f8f9f){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x3f8f9f);_0x21f2a5(_0x3f8f9f);});});} \ No newline at end of file +var _0xc6d7=['rpc','../../config/environment','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1d0f18,_0x3ba667){var _0x2df54a=function(_0x1853a3){while(--_0x1853a3){_0x1d0f18['push'](_0x1d0f18['shift']());}};_0x2df54a(++_0x3ba667);}(_0xc6d7,0x71));var _0x7c6d=function(_0x478517,_0x3733ad){_0x478517=_0x478517-0x0;var _0x1dc7be=_0xc6d7[_0x478517];return _0x1dc7be;};'use strict';var _=require(_0x7c6d('0x0'));var util=require(_0x7c6d('0x1'));var moment=require(_0x7c6d('0x2'));var BPromise=require(_0x7c6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c6d('0x4'))['db'];var utils=require(_0x7c6d('0x5'));var logger=require(_0x7c6d('0x6'))(_0x7c6d('0x7'));var config=require(_0x7c6d('0x8'));var jayson=require(_0x7c6d('0x9'));var client=jayson[_0x7c6d('0xa')][_0x7c6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x446b68,_0x45713e,_0x338f94){return new BPromise(function(_0x1ad7e2,_0x22755d){return client[_0x7c6d('0xc')](_0x446b68,_0x338f94)['then'](function(_0x477a41){logger['info'](_0x7c6d('0xd'),_0x45713e,_0x7c6d('0xe'));logger[_0x7c6d('0xf')](_0x7c6d('0x10'),_0x45713e,'request\x20sent',JSON[_0x7c6d('0x11')](_0x477a41));if(_0x477a41[_0x7c6d('0x12')]){if(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x13')]===0x1f4){logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x477a41[_0x7c6d('0x12')]['message']);return _0x22755d(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);}logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);return _0x1ad7e2(_0x477a41[_0x7c6d('0x12')][_0x7c6d('0x14')]);}else{logger[_0x7c6d('0x15')]('CloudProvider,\x20%s,\x20%s',_0x45713e,_0x7c6d('0xe'));_0x1ad7e2(_0x477a41[_0x7c6d('0x16')]['message']);}})[_0x7c6d('0x17')](function(_0x220bae){logger[_0x7c6d('0x12')](_0x7c6d('0xd'),_0x45713e,_0x220bae);_0x22755d(_0x220bae);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a408557..81114fc 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23e1f6,_0x3b658f){_0x23e1f6=_0x23e1f6-0x0;var _0x33de91=_0x5f2f[_0x23e1f6];return _0x33de91;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x19d685,_0x90a37b){var _0x297d4d=function(_0x425549){while(--_0x425549){_0x19d685['push'](_0x19d685['shift']());}};_0x297d4d(++_0x90a37b);}(_0xadb5,0xad));var _0x5adb=function(_0x32e8ba,_0x44474e){_0x32e8ba=_0x32e8ba-0x0;var _0x17f047=_0xadb5[_0x32e8ba];return _0x17f047;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('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 98c1175..46a5a37 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 _0x0d1a=['sequelize','exports','STRING'];(function(_0x1562a3,_0x2c6cad){var _0x58476f=function(_0x225512){while(--_0x225512){_0x1562a3['push'](_0x1562a3['shift']());}};_0x58476f(++_0x2c6cad);}(_0x0d1a,0x1e6));var _0xa0d1=function(_0x933730,_0x197943){_0x933730=_0x933730-0x0;var _0x5543e1=_0x0d1a[_0x933730];return _0x5543e1;};'use strict';var Sequelize=require(_0xa0d1('0x0'));module[_0xa0d1('0x1')]={'name':{'type':Sequelize[_0xa0d1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa0d1('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xa0d1('0x2')]},'phone':{'type':Sequelize[_0xa0d1('0x2')]},'fax':{'type':Sequelize[_0xa0d1('0x2')]},'type':{'type':Sequelize[_0xa0d1('0x2')]},'street':{'type':Sequelize[_0xa0d1('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa0d1('0x2')]},'country':{'type':Sequelize[_0xa0d1('0x2')]},'email':{'type':Sequelize[_0xa0d1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa0d1('0x2')]},'sStreet':{'type':Sequelize[_0xa0d1('0x2')]},'sPostalCode':{'type':Sequelize[_0xa0d1('0x2')]},'sCity':{'type':Sequelize[_0xa0d1('0x2')]},'sCountry':{'type':Sequelize[_0xa0d1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4dca=['STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4dca,0x1c0));var _0xa4dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4dca[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa4dc('0x0'));module[_0xa4dc('0x1')]={'name':{'type':Sequelize[_0xa4dc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa4dc('0x2')]},'companyId':{'type':Sequelize[_0xa4dc('0x2')]},'website':{'type':Sequelize[_0xa4dc('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa4dc('0x2')]},'type':{'type':Sequelize[_0xa4dc('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa4dc('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa4dc('0x2')]},'email':{'type':Sequelize[_0xa4dc('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa4dc('0x2')]},'sStreet':{'type':Sequelize[_0xa4dc('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xa4dc('0x2')]},'sCountry':{'type':Sequelize[_0xa4dc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 11e9b9a..1749818 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 _0xe06e=['sox','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','CmContact','omit','ids','getContacts','findOne','map','nolimit','rimraf','request-promise','bluebird','mustache','util','path'];(function(_0x2e6859,_0xc33939){var _0x6077ab=function(_0x3d63ec){while(--_0x3d63ec){_0x2e6859['push'](_0x2e6859['shift']());}};_0x6077ab(++_0xc33939);}(_0xe06e,0x98));var _0xee06=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0xe06e[_0x5bf2b3];return _0x5e8a9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee06('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee06('0x1'));var moment=require('moment');var BPromise=require(_0xee06('0x2'));var Mustache=require(_0xee06('0x3'));var util=require(_0xee06('0x4'));var path=require(_0xee06('0x5'));var sox=require(_0xee06('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee06('0x7'));var squel=require(_0xee06('0x8'));var crypto=require('crypto');var jsforce=require(_0xee06('0x9'));var deskjs=require(_0xee06('0xa'));var toCsv=require('to-csv');var querystring=require(_0xee06('0xb'));var Papa=require(_0xee06('0xc'));var Redis=require(_0xee06('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xee06('0xe'));var as=require(_0xee06('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee06('0x10'))('api');var utils=require(_0xee06('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xee06('0x12'));var db=require(_0xee06('0x13'))['db'];function respondWithStatusCode(_0x4b27c4,_0x1281ee){_0x1281ee=_0x1281ee||0xcc;return function(_0x2cb778){if(_0x2cb778){return _0x4b27c4[_0xee06('0x14')](_0x1281ee);}return _0x4b27c4['status'](_0x1281ee)[_0xee06('0x15')]();};}function respondWithResult(_0x5c24df,_0x390694){_0x390694=_0x390694||0xc8;return function(_0x1aa41e){if(_0x1aa41e){return _0x5c24df[_0xee06('0x16')](_0x390694)['json'](_0x1aa41e);}};}function respondWithFilteredResult(_0x1d91de,_0xb86363){return function(_0x1fae04){if(_0x1fae04){var _0x3a42bf=typeof _0xb86363['offset']==='undefined'&&typeof _0xb86363[_0xee06('0x17')]==='undefined';var _0x36b559=_0x1fae04[_0xee06('0x18')];var _0x4c6f9c=_0x3a42bf?0x0:_0xb86363[_0xee06('0x19')];var _0x545d9f=_0x3a42bf?_0x1fae04[_0xee06('0x18')]:_0xb86363['offset']+_0xb86363[_0xee06('0x17')];var _0x3665bc;if(_0x545d9f>=_0x36b559){_0x545d9f=_0x36b559;_0x3665bc=0xc8;}else{_0x3665bc=0xce;}_0x1d91de[_0xee06('0x16')](_0x3665bc);return _0x1d91de['set'](_0xee06('0x1a'),_0x4c6f9c+'-'+_0x545d9f+'/'+_0x36b559)[_0xee06('0x1b')](_0x1fae04);}return null;};}function patchUpdates(_0x54f6bc){return function(_0x329d21){try{jsonpatch[_0xee06('0x1c')](_0x329d21,_0x54f6bc,!![]);}catch(_0x3a7851){return BPromise['reject'](_0x3a7851);}return _0x329d21[_0xee06('0x1d')]();};}function saveUpdates(_0x48bb57,_0x1023b6){return function(_0x57cb8e){if(_0x57cb8e){return _0x57cb8e[_0xee06('0x1e')](_0x48bb57)[_0xee06('0x1f')](function(_0x106500){return _0x106500;});}return null;};}function removeEntity(_0x16f3b4,_0x34e9a9){return function(_0x489e31){if(_0x489e31){return _0x489e31[_0xee06('0x20')]()['then'](function(){var _0x3ae4b2=_0x489e31[_0xee06('0x21')]({'plain':!![]});var _0x395338=_0xee06('0x22');return db[_0xee06('0x23')][_0xee06('0x20')]({'where':{'type':_0x395338,'resourceId':_0x3ae4b2['id']}})['then'](function(){return _0x489e31;});})['then'](function(){_0x16f3b4[_0xee06('0x16')](0xcc)[_0xee06('0x15')]();});}};}function handleEntityNotFound(_0x2369ef,_0x5c897b){return function(_0x16f506){if(!_0x16f506){_0x2369ef[_0xee06('0x14')](0x194);}return _0x16f506;};}function handleError(_0x2232ff,_0x5c29c5){_0x5c29c5=_0x5c29c5||0x1f4;return function(_0x23e1fb){logger[_0xee06('0x24')](_0x23e1fb[_0xee06('0x25')]);if(_0x23e1fb[_0xee06('0x26')]){delete _0x23e1fb[_0xee06('0x26')];}_0x2232ff[_0xee06('0x16')](_0x5c29c5)[_0xee06('0x27')](_0x23e1fb);};}exports['index']=function(_0x1cf26c,_0x436596){var _0x320e29={},_0x3fa44b={},_0x1e5382={'count':0x0,'rows':[]};return db[_0xee06('0x28')][_0xee06('0x29')]()[_0xee06('0x1f')](function(_0x12b866){_0x3fa44b[_0xee06('0x2a')]=_[_0xee06('0x2b')](_0x12b866);_0x3fa44b[_0xee06('0x2c')]=_[_0xee06('0x2b')](_0x1cf26c[_0xee06('0x2c')]);_0x3fa44b[_0xee06('0x2d')]=_['intersection'](_0x3fa44b[_0xee06('0x2a')],_0x3fa44b['query']);_0x320e29[_0xee06('0x2e')]=_[_0xee06('0x2f')](_0x3fa44b[_0xee06('0x2a')],qs[_0xee06('0x30')](_0x1cf26c['query'][_0xee06('0x30')]));_0x320e29[_0xee06('0x2e')]=_0x320e29[_0xee06('0x2e')]['length']?_0x320e29[_0xee06('0x2e')]:_0x3fa44b['model'];if(!_0x1cf26c[_0xee06('0x2c')][_0xee06('0x31')]('nolimit')){_0x320e29[_0xee06('0x17')]=qs[_0xee06('0x17')](_0x1cf26c[_0xee06('0x2c')][_0xee06('0x17')]);_0x320e29[_0xee06('0x19')]=qs[_0xee06('0x19')](_0x1cf26c[_0xee06('0x2c')][_0xee06('0x19')]);}_0x320e29[_0xee06('0x32')]=qs[_0xee06('0x33')](_0x1cf26c[_0xee06('0x2c')]['sort']);_0x320e29[_0xee06('0x34')]=qs[_0xee06('0x2d')](_[_0xee06('0x35')](_0x1cf26c['query'],_0x3fa44b[_0xee06('0x2d')]),_0x12b866);if(_0x1cf26c['query'][_0xee06('0x36')]){_0x320e29['where']=_[_0xee06('0x37')](_0x320e29['where'],{'$or':_['map'](_0x320e29[_0xee06('0x2e')],function(_0x8e8a0b){var _0xcd3e0f={};_0xcd3e0f[_0x8e8a0b]={'$like':'%'+_0x1cf26c[_0xee06('0x2c')][_0xee06('0x36')]+'%'};return _0xcd3e0f;})});}_0x320e29=_[_0xee06('0x37')]({},_0x320e29,_0x1cf26c[_0xee06('0x38')]);var _0x383ce2={'where':_0x320e29[_0xee06('0x34')]};return db[_0xee06('0x28')]['count'](_0x383ce2)['then'](function(_0x4635a9){_0x1e5382['count']=_0x4635a9;if(_0x1cf26c[_0xee06('0x2c')][_0xee06('0x39')]){_0x320e29[_0xee06('0x3a')]=[{'all':!![]}];}return db[_0xee06('0x28')]['findAll'](_0x320e29);})['then'](function(_0x5badcf){_0x1e5382['rows']=_0x5badcf;return _0x1e5382;})[_0xee06('0x1f')](respondWithFilteredResult(_0x436596,_0x320e29))[_0xee06('0x3b')](handleError(_0x436596,null));})[_0xee06('0x3b')](handleError(_0x436596,null));};exports[_0xee06('0x3c')]=function(_0xba88d7,_0x32c6f7){var _0x33a6c3={'raw':![],'where':{'id':_0xba88d7[_0xee06('0x3d')]['id']}},_0x4af1df={};_0x4af1df['model']=_['keys'](db[_0xee06('0x28')][_0xee06('0x3e')]);_0x4af1df[_0xee06('0x2c')]=_[_0xee06('0x2b')](_0xba88d7[_0xee06('0x2c')]);_0x4af1df[_0xee06('0x2d')]=_[_0xee06('0x2f')](_0x4af1df[_0xee06('0x2a')],_0x4af1df[_0xee06('0x2c')]);_0x33a6c3[_0xee06('0x2e')]=_[_0xee06('0x2f')](_0x4af1df[_0xee06('0x2a')],qs['fields'](_0xba88d7[_0xee06('0x2c')][_0xee06('0x30')]));_0x33a6c3[_0xee06('0x2e')]=_0x33a6c3[_0xee06('0x2e')][_0xee06('0x3f')]?_0x33a6c3[_0xee06('0x2e')]:_0x4af1df['model'];if(_0xba88d7['query'][_0xee06('0x39')]){_0x33a6c3[_0xee06('0x3a')]=[{'all':!![]}];}_0x33a6c3=_['merge']({},_0x33a6c3,_0xba88d7[_0xee06('0x38')]);return db[_0xee06('0x28')][_0xee06('0x40')](_0x33a6c3)[_0xee06('0x1f')](handleEntityNotFound(_0x32c6f7,null))['then'](respondWithResult(_0x32c6f7,null))['catch'](handleError(_0x32c6f7,null));};exports[_0xee06('0x41')]=function(_0x4626ac,_0x3055b6){return db[_0xee06('0x28')][_0xee06('0x41')](_0x4626ac[_0xee06('0x42')],{})[_0xee06('0x1f')](function(_0x1d0f82){var _0x3524ee=_0x4626ac[_0xee06('0x43')][_0xee06('0x21')]({'plain':!![]});if(!_0x3524ee)throw new Error(_0xee06('0x44'));if(_0x3524ee['role']===_0xee06('0x43')){var _0x59844c=_0x1d0f82['get']({'plain':!![]});var _0xdfdc94='Companies';return db[_0xee06('0x45')][_0xee06('0x40')]({'where':{'name':_0xdfdc94,'userProfileId':_0x3524ee[_0xee06('0x46')]},'raw':!![]})[_0xee06('0x1f')](function(_0x2ce0ea){if(_0x2ce0ea&&_0x2ce0ea[_0xee06('0x47')]===0x0){return db[_0xee06('0x23')][_0xee06('0x41')]({'name':_0x59844c['name'],'resourceId':_0x59844c['id'],'type':_0x2ce0ea[_0xee06('0x26')],'sectionId':_0x2ce0ea['id']},{})[_0xee06('0x1f')](function(){return _0x1d0f82;});}else{return _0x1d0f82;}})[_0xee06('0x3b')](function(_0x4bd131){logger[_0xee06('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bd131);throw _0x4bd131;});}return _0x1d0f82;})[_0xee06('0x1f')](respondWithResult(_0x3055b6,0xc9))[_0xee06('0x3b')](handleError(_0x3055b6,null));};exports[_0xee06('0x1e')]=function(_0x1bd580,_0x455a2f){if(_0x1bd580[_0xee06('0x42')]['id']){delete _0x1bd580[_0xee06('0x42')]['id'];}return db[_0xee06('0x28')][_0xee06('0x40')]({'where':{'id':_0x1bd580['params']['id']}})[_0xee06('0x1f')](handleEntityNotFound(_0x455a2f,null))[_0xee06('0x1f')](saveUpdates(_0x1bd580[_0xee06('0x42')],null))[_0xee06('0x1f')](respondWithResult(_0x455a2f,null))[_0xee06('0x3b')](handleError(_0x455a2f,null));};exports[_0xee06('0x20')]=function(_0xa569b3,_0x31fc5d){return db['CmCompany'][_0xee06('0x40')]({'where':{'id':_0xa569b3['params']['id']}})[_0xee06('0x1f')](handleEntityNotFound(_0x31fc5d,null))[_0xee06('0x1f')](removeEntity(_0x31fc5d,null))[_0xee06('0x3b')](handleError(_0x31fc5d,null));};exports[_0xee06('0x29')]=function(_0x5bfae6,_0x59d310){return db[_0xee06('0x28')][_0xee06('0x29')]()[_0xee06('0x1f')](respondWithResult(_0x59d310,null))['catch'](handleError(_0x59d310,null));};exports['addContacts']=function(_0x356dd2,_0x138564,_0x11b4f9){return db[_0xee06('0x48')]['find']({'where':{'id':_0x356dd2[_0xee06('0x3d')]['id']}})[_0xee06('0x1f')](handleEntityNotFound(_0x138564,null))[_0xee06('0x1f')](function(_0x5c6b05){if(_0x5c6b05){return _0x5c6b05['addContacts'](_0x356dd2[_0xee06('0x42')]['ids'],_[_0xee06('0x49')](_0x356dd2[_0xee06('0x42')],[_0xee06('0x4a'),'id'])||{});}})[_0xee06('0x1f')](respondWithResult(_0x138564,null))[_0xee06('0x3b')](handleError(_0x138564,null));};exports[_0xee06('0x4b')]=function(_0x5a8c45,_0x3d9b8b,_0xdd9dbc){var _0x578405={};var _0x570d1b={};var _0x98a245;var _0x4d37af;return db[_0xee06('0x28')][_0xee06('0x4c')]({'where':{'id':_0x5a8c45[_0xee06('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3d9b8b,null))[_0xee06('0x1f')](function(_0x42608d){if(_0x42608d){_0x98a245=_0x42608d;_0x570d1b[_0xee06('0x2a')]=_[_0xee06('0x2b')](db[_0xee06('0x48')][_0xee06('0x3e')]);_0x570d1b['query']=_[_0xee06('0x2b')](_0x5a8c45['query']);_0x570d1b[_0xee06('0x2d')]=_[_0xee06('0x2f')](_0x570d1b[_0xee06('0x2a')],_0x570d1b[_0xee06('0x2c')]);_0x578405[_0xee06('0x2e')]=_[_0xee06('0x2f')](_0x570d1b[_0xee06('0x2a')],qs[_0xee06('0x30')](_0x5a8c45[_0xee06('0x2c')][_0xee06('0x30')]));_0x578405[_0xee06('0x2e')]=_0x578405[_0xee06('0x2e')][_0xee06('0x3f')]?_0x578405['attributes']:_0x570d1b[_0xee06('0x2a')];_0x578405['order']=qs[_0xee06('0x33')](_0x5a8c45[_0xee06('0x2c')]['sort']);_0x578405[_0xee06('0x34')]=qs['filters'](_[_0xee06('0x35')](_0x5a8c45[_0xee06('0x2c')],_0x570d1b['filters']));if(_0x5a8c45[_0xee06('0x2c')][_0xee06('0x36')]){_0x578405[_0xee06('0x34')]=_[_0xee06('0x37')](_0x578405[_0xee06('0x34')],{'$or':_[_0xee06('0x4d')](_0x578405[_0xee06('0x2e')],function(_0x373b03){var _0x452049={};_0x452049[_0x373b03]={'$like':'%'+_0x5a8c45[_0xee06('0x2c')][_0xee06('0x36')]+'%'};return _0x452049;})});}_0x578405=_[_0xee06('0x37')]({},_0x578405,_0x5a8c45[_0xee06('0x38')]);return _0x98a245[_0xee06('0x4b')](_0x578405);}})['then'](function(_0x179622){if(_0x179622){_0x4d37af=_0x179622[_0xee06('0x3f')];if(!_0x5a8c45['query'][_0xee06('0x31')](_0xee06('0x4e'))){_0x578405[_0xee06('0x17')]=qs[_0xee06('0x17')](_0x5a8c45[_0xee06('0x2c')][_0xee06('0x17')]);_0x578405[_0xee06('0x19')]=qs['offset'](_0x5a8c45['query'][_0xee06('0x19')]);}return _0x98a245[_0xee06('0x4b')](_0x578405);}})[_0xee06('0x1f')](function(_0x422798){if(_0x422798){return _0x422798?{'count':_0x4d37af,'rows':_0x422798}:null;}})[_0xee06('0x1f')](respondWithResult(_0x3d9b8b,null))['catch'](handleError(_0x3d9b8b,null));}; \ No newline at end of file +var _0xcc64=['CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','map','options','count','findAll','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','length','nolimit','eml-format','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','index'];(function(_0x54786d,_0x487ec5){var _0x588f09=function(_0x1ca5ac){while(--_0x1ca5ac){_0x54786d['push'](_0x54786d['shift']());}};_0x588f09(++_0x487ec5);}(_0xcc64,0xd5));var _0x4cc6=function(_0x24eecb,_0x311df3){_0x24eecb=_0x24eecb-0x0;var _0x5366fe=_0xcc64[_0x24eecb];return _0x5366fe;};'use strict';var emlformat=require(_0x4cc6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4cc6('0x1'));var rp=require('request-promise');var moment=require(_0x4cc6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4cc6('0x3'));var util=require(_0x4cc6('0x4'));var path=require(_0x4cc6('0x5'));var sox=require('sox');var csv=require(_0x4cc6('0x6'));var ejs=require(_0x4cc6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cc6('0x8'));var crypto=require('crypto');var jsforce=require(_0x4cc6('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4cc6('0x6'));var querystring=require(_0x4cc6('0xa'));var Papa=require(_0x4cc6('0xb'));var Redis=require(_0x4cc6('0xc'));var authService=require(_0x4cc6('0xd'));var qs=require(_0x4cc6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cc6('0xf'));var logger=require(_0x4cc6('0x10'))(_0x4cc6('0x11'));var utils=require(_0x4cc6('0x12'));var config=require(_0x4cc6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4cc6('0x14'))['db'];function respondWithStatusCode(_0x348b12,_0x4ef568){_0x4ef568=_0x4ef568||0xcc;return function(_0x287e74){if(_0x287e74){return _0x348b12[_0x4cc6('0x15')](_0x4ef568);}return _0x348b12[_0x4cc6('0x16')](_0x4ef568)[_0x4cc6('0x17')]();};}function respondWithResult(_0x241d08,_0x2439ef){_0x2439ef=_0x2439ef||0xc8;return function(_0x19fe15){if(_0x19fe15){return _0x241d08[_0x4cc6('0x16')](_0x2439ef)[_0x4cc6('0x18')](_0x19fe15);}};}function respondWithFilteredResult(_0x38de85,_0x5d1878){return function(_0x200082){if(_0x200082){var _0x4eb252=typeof _0x5d1878[_0x4cc6('0x19')]===_0x4cc6('0x1a')&&typeof _0x5d1878[_0x4cc6('0x1b')]===_0x4cc6('0x1a');var _0x2313d7=_0x200082['count'];var _0x202dc6=_0x4eb252?0x0:_0x5d1878['offset'];var _0x9216c0=_0x4eb252?_0x200082['count']:_0x5d1878['offset']+_0x5d1878[_0x4cc6('0x1b')];var _0x2540c6;if(_0x9216c0>=_0x2313d7){_0x9216c0=_0x2313d7;_0x2540c6=0xc8;}else{_0x2540c6=0xce;}_0x38de85[_0x4cc6('0x16')](_0x2540c6);return _0x38de85[_0x4cc6('0x1c')](_0x4cc6('0x1d'),_0x202dc6+'-'+_0x9216c0+'/'+_0x2313d7)[_0x4cc6('0x18')](_0x200082);}return null;};}function patchUpdates(_0x3246c9){return function(_0x587e16){try{jsonpatch[_0x4cc6('0x1e')](_0x587e16,_0x3246c9,!![]);}catch(_0x21d8fb){return BPromise[_0x4cc6('0x1f')](_0x21d8fb);}return _0x587e16[_0x4cc6('0x20')]();};}function saveUpdates(_0x3013bb,_0x2ca178){return function(_0x376f23){if(_0x376f23){return _0x376f23[_0x4cc6('0x21')](_0x3013bb)[_0x4cc6('0x22')](function(_0x461efa){return _0x461efa;});}return null;};}function removeEntity(_0x4bd61d,_0x193ab1){return function(_0x2cab47){if(_0x2cab47){return _0x2cab47[_0x4cc6('0x23')]()[_0x4cc6('0x22')](function(){var _0x276986=_0x2cab47[_0x4cc6('0x24')]({'plain':!![]});var _0x429164=_0x4cc6('0x25');return db[_0x4cc6('0x26')][_0x4cc6('0x23')]({'where':{'type':_0x429164,'resourceId':_0x276986['id']}})[_0x4cc6('0x22')](function(){return _0x2cab47;});})['then'](function(){_0x4bd61d[_0x4cc6('0x16')](0xcc)[_0x4cc6('0x17')]();});}};}function handleEntityNotFound(_0x95cbb7,_0x4503e6){return function(_0xede3d5){if(!_0xede3d5){_0x95cbb7['sendStatus'](0x194);}return _0xede3d5;};}function handleError(_0x5a66f0,_0x532ee4){_0x532ee4=_0x532ee4||0x1f4;return function(_0xb9daaa){logger[_0x4cc6('0x27')](_0xb9daaa['stack']);if(_0xb9daaa['name']){delete _0xb9daaa[_0x4cc6('0x28')];}_0x5a66f0[_0x4cc6('0x16')](_0x532ee4)['send'](_0xb9daaa);};}exports[_0x4cc6('0x29')]=function(_0x283464,_0x254f65){var _0xbdea66={},_0x3086c0={},_0x5e9423={'count':0x0,'rows':[]};return db[_0x4cc6('0x2a')][_0x4cc6('0x2b')]()[_0x4cc6('0x22')](function(_0x574205){_0x3086c0[_0x4cc6('0x2c')]=_[_0x4cc6('0x2d')](_0x574205);_0x3086c0['query']=_[_0x4cc6('0x2d')](_0x283464[_0x4cc6('0x2e')]);_0x3086c0[_0x4cc6('0x2f')]=_['intersection'](_0x3086c0[_0x4cc6('0x2c')],_0x3086c0['query']);_0xbdea66[_0x4cc6('0x30')]=_[_0x4cc6('0x31')](_0x3086c0[_0x4cc6('0x2c')],qs[_0x4cc6('0x32')](_0x283464['query'][_0x4cc6('0x32')]));_0xbdea66[_0x4cc6('0x30')]=_0xbdea66[_0x4cc6('0x30')]['length']?_0xbdea66[_0x4cc6('0x30')]:_0x3086c0[_0x4cc6('0x2c')];if(!_0x283464[_0x4cc6('0x2e')][_0x4cc6('0x33')]('nolimit')){_0xbdea66[_0x4cc6('0x1b')]=qs[_0x4cc6('0x1b')](_0x283464[_0x4cc6('0x2e')][_0x4cc6('0x1b')]);_0xbdea66['offset']=qs[_0x4cc6('0x19')](_0x283464[_0x4cc6('0x2e')][_0x4cc6('0x19')]);}_0xbdea66[_0x4cc6('0x34')]=qs[_0x4cc6('0x35')](_0x283464['query']['sort']);_0xbdea66[_0x4cc6('0x36')]=qs[_0x4cc6('0x2f')](_['pick'](_0x283464['query'],_0x3086c0[_0x4cc6('0x2f')]),_0x574205);if(_0x283464[_0x4cc6('0x2e')][_0x4cc6('0x37')]){_0xbdea66[_0x4cc6('0x36')]=_[_0x4cc6('0x38')](_0xbdea66[_0x4cc6('0x36')],{'$or':_[_0x4cc6('0x39')](_0xbdea66['attributes'],function(_0x54f090){var _0x120f48={};_0x120f48[_0x54f090]={'$like':'%'+_0x283464[_0x4cc6('0x2e')][_0x4cc6('0x37')]+'%'};return _0x120f48;})});}_0xbdea66=_[_0x4cc6('0x38')]({},_0xbdea66,_0x283464[_0x4cc6('0x3a')]);var _0x4c59d5={'where':_0xbdea66[_0x4cc6('0x36')]};return db[_0x4cc6('0x2a')][_0x4cc6('0x3b')](_0x4c59d5)[_0x4cc6('0x22')](function(_0x4b1692){_0x5e9423['count']=_0x4b1692;if(_0x283464[_0x4cc6('0x2e')]['includeAll']){_0xbdea66['include']=[{'all':!![]}];}return db[_0x4cc6('0x2a')][_0x4cc6('0x3c')](_0xbdea66);})[_0x4cc6('0x22')](function(_0x32a691){_0x5e9423[_0x4cc6('0x3d')]=_0x32a691;return _0x5e9423;})['then'](respondWithFilteredResult(_0x254f65,_0xbdea66))[_0x4cc6('0x3e')](handleError(_0x254f65,null));})[_0x4cc6('0x3e')](handleError(_0x254f65,null));};exports[_0x4cc6('0x3f')]=function(_0x206bd1,_0x3e7af2){var _0x2dc065={'raw':![],'where':{'id':_0x206bd1[_0x4cc6('0x40')]['id']}},_0x2c7509={};_0x2c7509[_0x4cc6('0x2c')]=_['keys'](db[_0x4cc6('0x2a')][_0x4cc6('0x41')]);_0x2c7509[_0x4cc6('0x2e')]=_[_0x4cc6('0x2d')](_0x206bd1[_0x4cc6('0x2e')]);_0x2c7509[_0x4cc6('0x2f')]=_[_0x4cc6('0x31')](_0x2c7509['model'],_0x2c7509['query']);_0x2dc065['attributes']=_[_0x4cc6('0x31')](_0x2c7509[_0x4cc6('0x2c')],qs['fields'](_0x206bd1[_0x4cc6('0x2e')][_0x4cc6('0x32')]));_0x2dc065[_0x4cc6('0x30')]=_0x2dc065[_0x4cc6('0x30')]['length']?_0x2dc065[_0x4cc6('0x30')]:_0x2c7509[_0x4cc6('0x2c')];if(_0x206bd1[_0x4cc6('0x2e')]['includeAll']){_0x2dc065[_0x4cc6('0x42')]=[{'all':!![]}];}_0x2dc065=_[_0x4cc6('0x38')]({},_0x2dc065,_0x206bd1[_0x4cc6('0x3a')]);return db['CmCompany']['find'](_0x2dc065)['then'](handleEntityNotFound(_0x3e7af2,null))[_0x4cc6('0x22')](respondWithResult(_0x3e7af2,null))[_0x4cc6('0x3e')](handleError(_0x3e7af2,null));};exports[_0x4cc6('0x43')]=function(_0x19d316,_0xb85ab){return db[_0x4cc6('0x2a')][_0x4cc6('0x43')](_0x19d316[_0x4cc6('0x44')],{})[_0x4cc6('0x22')](function(_0xbd44ba){var _0x42ed5a=_0x19d316[_0x4cc6('0x45')][_0x4cc6('0x24')]({'plain':!![]});if(!_0x42ed5a)throw new Error(_0x4cc6('0x46'));if(_0x42ed5a[_0x4cc6('0x47')]===_0x4cc6('0x45')){var _0x167bdc=_0xbd44ba['get']({'plain':!![]});var _0x51a531=_0x4cc6('0x25');return db[_0x4cc6('0x48')][_0x4cc6('0x49')]({'where':{'name':_0x51a531,'userProfileId':_0x42ed5a[_0x4cc6('0x4a')]},'raw':!![]})[_0x4cc6('0x22')](function(_0x43712f){if(_0x43712f&&_0x43712f[_0x4cc6('0x4b')]===0x0){return db[_0x4cc6('0x26')][_0x4cc6('0x43')]({'name':_0x167bdc[_0x4cc6('0x28')],'resourceId':_0x167bdc['id'],'type':_0x43712f[_0x4cc6('0x28')],'sectionId':_0x43712f['id']},{})[_0x4cc6('0x22')](function(){return _0xbd44ba;});}else{return _0xbd44ba;}})['catch'](function(_0x5e1b53){logger[_0x4cc6('0x27')](_0x4cc6('0x4c'),_0x5e1b53);throw _0x5e1b53;});}return _0xbd44ba;})['then'](respondWithResult(_0xb85ab,0xc9))[_0x4cc6('0x3e')](handleError(_0xb85ab,null));};exports[_0x4cc6('0x21')]=function(_0x3d50be,_0x3c35f5){if(_0x3d50be[_0x4cc6('0x44')]['id']){delete _0x3d50be[_0x4cc6('0x44')]['id'];}return db[_0x4cc6('0x2a')][_0x4cc6('0x49')]({'where':{'id':_0x3d50be['params']['id']}})['then'](handleEntityNotFound(_0x3c35f5,null))[_0x4cc6('0x22')](saveUpdates(_0x3d50be[_0x4cc6('0x44')],null))['then'](respondWithResult(_0x3c35f5,null))[_0x4cc6('0x3e')](handleError(_0x3c35f5,null));};exports[_0x4cc6('0x23')]=function(_0x400a02,_0x519f81){return db[_0x4cc6('0x2a')][_0x4cc6('0x49')]({'where':{'id':_0x400a02['params']['id']}})[_0x4cc6('0x22')](handleEntityNotFound(_0x519f81,null))[_0x4cc6('0x22')](removeEntity(_0x519f81,null))[_0x4cc6('0x3e')](handleError(_0x519f81,null));};exports[_0x4cc6('0x2b')]=function(_0x274e31,_0xa0106d){return db[_0x4cc6('0x2a')]['describe']()[_0x4cc6('0x22')](respondWithResult(_0xa0106d,null))[_0x4cc6('0x3e')](handleError(_0xa0106d,null));};exports[_0x4cc6('0x4d')]=function(_0x2835e7,_0x227a87,_0x282ca4){return db[_0x4cc6('0x4e')]['find']({'where':{'id':_0x2835e7[_0x4cc6('0x40')]['id']}})[_0x4cc6('0x22')](handleEntityNotFound(_0x227a87,null))[_0x4cc6('0x22')](function(_0x54c7c3){if(_0x54c7c3){return _0x54c7c3[_0x4cc6('0x4d')](_0x2835e7['body']['ids'],_[_0x4cc6('0x4f')](_0x2835e7[_0x4cc6('0x44')],[_0x4cc6('0x50'),'id'])||{});}})[_0x4cc6('0x22')](respondWithResult(_0x227a87,null))[_0x4cc6('0x3e')](handleError(_0x227a87,null));};exports[_0x4cc6('0x51')]=function(_0x105ca5,_0x19b15f,_0x5180fb){var _0x43b2db={};var _0x1fe272={};var _0x257a60;var _0x2f8028;return db['CmCompany'][_0x4cc6('0x52')]({'where':{'id':_0x105ca5[_0x4cc6('0x40')]['id']}})[_0x4cc6('0x22')](handleEntityNotFound(_0x19b15f,null))[_0x4cc6('0x22')](function(_0x24f6ec){if(_0x24f6ec){_0x257a60=_0x24f6ec;_0x1fe272[_0x4cc6('0x2c')]=_[_0x4cc6('0x2d')](db[_0x4cc6('0x4e')][_0x4cc6('0x41')]);_0x1fe272[_0x4cc6('0x2e')]=_[_0x4cc6('0x2d')](_0x105ca5['query']);_0x1fe272['filters']=_['intersection'](_0x1fe272[_0x4cc6('0x2c')],_0x1fe272[_0x4cc6('0x2e')]);_0x43b2db[_0x4cc6('0x30')]=_[_0x4cc6('0x31')](_0x1fe272[_0x4cc6('0x2c')],qs['fields'](_0x105ca5['query'][_0x4cc6('0x32')]));_0x43b2db[_0x4cc6('0x30')]=_0x43b2db[_0x4cc6('0x30')][_0x4cc6('0x53')]?_0x43b2db[_0x4cc6('0x30')]:_0x1fe272[_0x4cc6('0x2c')];_0x43b2db[_0x4cc6('0x34')]=qs[_0x4cc6('0x35')](_0x105ca5['query'][_0x4cc6('0x35')]);_0x43b2db[_0x4cc6('0x36')]=qs[_0x4cc6('0x2f')](_['pick'](_0x105ca5[_0x4cc6('0x2e')],_0x1fe272[_0x4cc6('0x2f')]));if(_0x105ca5['query'][_0x4cc6('0x37')]){_0x43b2db[_0x4cc6('0x36')]=_['merge'](_0x43b2db[_0x4cc6('0x36')],{'$or':_[_0x4cc6('0x39')](_0x43b2db[_0x4cc6('0x30')],function(_0x56e320){var _0x5e1c02={};_0x5e1c02[_0x56e320]={'$like':'%'+_0x105ca5[_0x4cc6('0x2e')][_0x4cc6('0x37')]+'%'};return _0x5e1c02;})});}_0x43b2db=_[_0x4cc6('0x38')]({},_0x43b2db,_0x105ca5[_0x4cc6('0x3a')]);return _0x257a60['getContacts'](_0x43b2db);}})[_0x4cc6('0x22')](function(_0x5ce81a){if(_0x5ce81a){_0x2f8028=_0x5ce81a[_0x4cc6('0x53')];if(!_0x105ca5[_0x4cc6('0x2e')]['hasOwnProperty'](_0x4cc6('0x54'))){_0x43b2db['limit']=qs[_0x4cc6('0x1b')](_0x105ca5[_0x4cc6('0x2e')][_0x4cc6('0x1b')]);_0x43b2db[_0x4cc6('0x19')]=qs[_0x4cc6('0x19')](_0x105ca5['query']['offset']);}return _0x257a60[_0x4cc6('0x51')](_0x43b2db);}})[_0x4cc6('0x22')](function(_0x15859b){if(_0x15859b){return _0x15859b?{'count':_0x2f8028,'rows':_0x15859b}:null;}})[_0x4cc6('0x22')](respondWithResult(_0x19b15f,null))['catch'](handleError(_0x19b15f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7103984..874b941 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 _0xc327=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x260468,_0x27498d){var _0x1f8c7f=function(_0x5ad4dd){while(--_0x5ad4dd){_0x260468['push'](_0x260468['shift']());}};_0x1f8c7f(++_0x27498d);}(_0xc327,0x1ac));var _0x7c32=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xc327[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x7c32('0x0'));var util=require(_0x7c32('0x1'));var logger=require(_0x7c32('0x2'))(_0x7c32('0x3'));var moment=require(_0x7c32('0x4'));var BPromise=require(_0x7c32('0x5'));var rp=require(_0x7c32('0x6'));var fs=require('fs');var path=require(_0x7c32('0x7'));var rimraf=require(_0x7c32('0x8'));var config=require(_0x7c32('0x9'));var attributes=require(_0x7c32('0xa'));module[_0x7c32('0xb')]=function(_0x1090c5,_0x118706){return _0x1090c5[_0x7c32('0xc')](_0x7c32('0xd'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b85=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x3b85,0x17e));var _0x53b8=function(_0x55ee91,_0x160100){_0x55ee91=_0x55ee91-0x0;var _0x2a17c9=_0x3b85[_0x55ee91];return _0x2a17c9;};'use strict';var _=require(_0x53b8('0x0'));var util=require(_0x53b8('0x1'));var logger=require('../../config/logger')(_0x53b8('0x2'));var moment=require(_0x53b8('0x3'));var BPromise=require(_0x53b8('0x4'));var rp=require(_0x53b8('0x5'));var fs=require('fs');var path=require(_0x53b8('0x6'));var rimraf=require('rimraf');var config=require(_0x53b8('0x7'));var attributes=require(_0x53b8('0x8'));module[_0x53b8('0x9')]=function(_0x281abe,_0xfa1b3d){return _0x281abe[_0x53b8('0xa')](_0x53b8('0xb'),attributes,{'tableName':_0x53b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 01222e4..4299bf8 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 _0xd248=['../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x20ea5b,_0x663129){var _0x45c501=function(_0x10743d){while(--_0x10743d){_0x20ea5b['push'](_0x20ea5b['shift']());}};_0x45c501(++_0x663129);}(_0xd248,0xe9));var _0x8d24=function(_0x5627a2,_0x43c8ce){_0x5627a2=_0x5627a2-0x0;var _0x3f8e87=_0xd248[_0x5627a2];return _0x3f8e87;};'use strict';var _=require(_0x8d24('0x0'));var util=require(_0x8d24('0x1'));var moment=require(_0x8d24('0x2'));var BPromise=require(_0x8d24('0x3'));var rs=require(_0x8d24('0x4'));var fs=require('fs');var Redis=require(_0x8d24('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d24('0x6'));var logger=require(_0x8d24('0x7'))(_0x8d24('0x8'));var config=require(_0x8d24('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d24('0xa')][_0x8d24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f480d,_0xac1fa6,_0x15e272){return new BPromise(function(_0xbc5696,_0x3cea27){return client[_0x8d24('0xc')](_0x4f480d,_0x15e272)[_0x8d24('0xd')](function(_0x40eeb0){logger['info'](_0x8d24('0xe'),_0xac1fa6,_0x8d24('0xf'));logger[_0x8d24('0x10')](_0x8d24('0x11'),_0xac1fa6,_0x8d24('0xf'),JSON['stringify'](_0x40eeb0));if(_0x40eeb0[_0x8d24('0x12')]){if(_0x40eeb0[_0x8d24('0x12')][_0x8d24('0x13')]===0x1f4){logger[_0x8d24('0x12')](_0x8d24('0xe'),_0xac1fa6,_0x40eeb0[_0x8d24('0x12')][_0x8d24('0x14')]);return _0x3cea27(_0x40eeb0[_0x8d24('0x12')][_0x8d24('0x14')]);}logger['error'](_0x8d24('0xe'),_0xac1fa6,_0x40eeb0['error'][_0x8d24('0x14')]);return _0xbc5696(_0x40eeb0['error'][_0x8d24('0x14')]);}else{logger['info'](_0x8d24('0xe'),_0xac1fa6,_0x8d24('0xf'));_0xbc5696(_0x40eeb0['result']['message']);}})[_0x8d24('0x15')](function(_0x1b5d3d){logger['error'](_0x8d24('0xe'),_0xac1fa6,_0x1b5d3d);_0x3cea27(_0x1b5d3d);});});} \ No newline at end of file +var _0xbfa5=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xdbd8a0,_0x1e6a6d){var _0x1d0c8d=function(_0x1f0f0c){while(--_0x1f0f0c){_0xdbd8a0['push'](_0xdbd8a0['shift']());}};_0x1d0c8d(++_0x1e6a6d);}(_0xbfa5,0x16a));var _0x5bfa=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xbfa5[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x5bfa('0x0'));var moment=require(_0x5bfa('0x1'));var BPromise=require(_0x5bfa('0x2'));var rs=require(_0x5bfa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bfa('0x4'))['db'];var utils=require(_0x5bfa('0x5'));var logger=require(_0x5bfa('0x6'))(_0x5bfa('0x7'));var config=require(_0x5bfa('0x8'));var jayson=require(_0x5bfa('0x9'));var client=jayson[_0x5bfa('0xa')][_0x5bfa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b1231,_0x47b58e,_0x502cf3){return new BPromise(function(_0x13b919,_0x299df8){return client[_0x5bfa('0xc')](_0x5b1231,_0x502cf3)[_0x5bfa('0xd')](function(_0x343e6f){logger[_0x5bfa('0xe')](_0x5bfa('0xf'),_0x47b58e,_0x5bfa('0x10'));logger[_0x5bfa('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x47b58e,_0x5bfa('0x10'),JSON['stringify'](_0x343e6f));if(_0x343e6f['error']){if(_0x343e6f[_0x5bfa('0x12')][_0x5bfa('0x13')]===0x1f4){logger['error'](_0x5bfa('0xf'),_0x47b58e,_0x343e6f[_0x5bfa('0x12')][_0x5bfa('0x14')]);return _0x299df8(_0x343e6f[_0x5bfa('0x12')][_0x5bfa('0x14')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x47b58e,_0x343e6f['error'][_0x5bfa('0x14')]);return _0x13b919(_0x343e6f[_0x5bfa('0x12')]['message']);}else{logger[_0x5bfa('0xe')](_0x5bfa('0xf'),_0x47b58e,'request\x20sent');_0x13b919(_0x343e6f[_0x5bfa('0x15')][_0x5bfa('0x14')]);}})['catch'](function(_0x413c21){logger['error'](_0x5bfa('0xf'),_0x47b58e,_0x413c21);_0x299df8(_0x413c21);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9e3ff0c..eb285a4 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 _0x82f7=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','delete','destroy'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x82f7,0x8b));var _0x782f=function(_0xe2f1bc,_0x4eb312){_0xe2f1bc=_0xe2f1bc-0x0;var _0x8cf39d=_0x82f7[_0xe2f1bc];return _0x8cf39d;};'use strict';var multer=require(_0x782f('0x0'));var util=require(_0x782f('0x1'));var path=require(_0x782f('0x2'));var timeout=require(_0x782f('0x3'));var express=require(_0x782f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x782f('0x5'));var interaction=require(_0x782f('0x6'));var config=require(_0x782f('0x7'));var controller=require(_0x782f('0x8'));router[_0x782f('0x9')]('/',auth['isAuthenticated'](),controller[_0x782f('0xa')]);router['get']('/describe',auth[_0x782f('0xb')](),controller[_0x782f('0xc')]);router['get'](_0x782f('0xd'),auth[_0x782f('0xb')](),controller[_0x782f('0xe')]);router['get'](_0x782f('0xf'),auth['isAuthenticated'](),controller[_0x782f('0x10')]);router[_0x782f('0x11')]('/',auth[_0x782f('0xb')](),controller['create']);router[_0x782f('0x11')](_0x782f('0xf'),auth['isAuthenticated'](),controller[_0x782f('0x12')]);router[_0x782f('0x13')](_0x782f('0xd'),auth[_0x782f('0xb')](),controller['update']);router[_0x782f('0x14')](_0x782f('0xd'),auth[_0x782f('0xb')](),controller[_0x782f('0x15')]);module[_0x782f('0x16')]=router; \ No newline at end of file +var _0xeeda=['/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','get'];(function(_0x323acd,_0x520e66){var _0x3bc3cb=function(_0x262506){while(--_0x262506){_0x323acd['push'](_0x323acd['shift']());}};_0x3bc3cb(++_0x520e66);}(_0xeeda,0x1be));var _0xaeed=function(_0x4b51d2,_0x286d4d){_0x4b51d2=_0x4b51d2-0x0;var _0x49ee75=_0xeeda[_0x4b51d2];return _0x49ee75;};'use strict';var multer=require(_0xaeed('0x0'));var util=require(_0xaeed('0x1'));var path=require(_0xaeed('0x2'));var timeout=require(_0xaeed('0x3'));var express=require(_0xaeed('0x4'));var router=express[_0xaeed('0x5')]();var fs_extra=require(_0xaeed('0x6'));var auth=require(_0xaeed('0x7'));var interaction=require(_0xaeed('0x8'));var config=require(_0xaeed('0x9'));var controller=require(_0xaeed('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xaeed('0xb')]);router[_0xaeed('0xc')](_0xaeed('0xd'),auth[_0xaeed('0xe')](),controller[_0xaeed('0xf')]);router[_0xaeed('0xc')](_0xaeed('0x10'),auth[_0xaeed('0xe')](),controller[_0xaeed('0x11')]);router[_0xaeed('0xc')](_0xaeed('0x12'),auth[_0xaeed('0xe')](),controller[_0xaeed('0x13')]);router[_0xaeed('0x14')]('/',auth[_0xaeed('0xe')](),controller[_0xaeed('0x15')]);router[_0xaeed('0x14')]('/:id/contacts',auth[_0xaeed('0xe')](),controller[_0xaeed('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaeed('0x17')]);router[_0xaeed('0x18')](_0xaeed('0x10'),auth['isAuthenticated'](),controller[_0xaeed('0x19')]);module[_0xaeed('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index b012755..c9e5766 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 _0x0291=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x3134c9,_0x5670c8){var _0x19b94a=function(_0x2c68de){while(--_0x2c68de){_0x3134c9['push'](_0x3134c9['shift']());}};_0x19b94a(++_0x5670c8);}(_0x0291,0xad));var _0x1029=function(_0x3bc179,_0x392c5b){_0x3bc179=_0x3bc179-0x0;var _0x25dfb4=_0x0291[_0x3bc179];return _0x25dfb4;};'use strict';var _=require(_0x1029('0x0'));var Sequelize=require(_0x1029('0x1'));module[_0x1029('0x2')]={'firstName':{'type':Sequelize[_0x1029('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1029('0x3')]},'street':{'type':Sequelize[_0x1029('0x3')]},'postalCode':{'type':Sequelize[_0x1029('0x3')]},'city':{'type':Sequelize[_0x1029('0x3')]},'country':{'type':Sequelize[_0x1029('0x3')]},'dateOfBirth':{'type':Sequelize[_0x1029('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x1029('0x3')]},'mobile':{'type':Sequelize[_0x1029('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1029('0x3')]},'url':{'type':Sequelize[_0x1029('0x3')]},'facebook':{'type':Sequelize[_0x1029('0x3')]},'fb_data':{'type':Sequelize[_0x1029('0x3')]},'twitter':{'type':Sequelize[_0x1029('0x3')]},'skype':{'type':Sequelize[_0x1029('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x1029('0x3')]},'line':{'type':Sequelize[_0x1029('0x3')]},'wechat':{'type':Sequelize[_0x1029('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1029('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x1029('0x3')]},'priority':{'type':Sequelize[_0x1029('0x4')](0x2)[_0x1029('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1029('0x6')],'defaultValue':Sequelize[_0x1029('0x7')]},'dialTimezone':{'type':Sequelize[_0x1029('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0a42=['STRING','TEXT','INTEGER','NOW','lodash','exports'];(function(_0x1997ae,_0x19a6e4){var _0x3b4ac4=function(_0x1bc089){while(--_0x1bc089){_0x1997ae['push'](_0x1997ae['shift']());}};_0x3b4ac4(++_0x19a6e4);}(_0x0a42,0x82));var _0x20a4=function(_0x1f21bd,_0x47b870){_0x1f21bd=_0x1f21bd-0x0;var _0x3a1064=_0x0a42[_0x1f21bd];return _0x3a1064;};'use strict';var _=require(_0x20a4('0x0'));var Sequelize=require('sequelize');module[_0x20a4('0x1')]={'firstName':{'type':Sequelize[_0x20a4('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x20a4('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x20a4('0x2')]},'city':{'type':Sequelize[_0x20a4('0x2')]},'country':{'type':Sequelize[_0x20a4('0x2')]},'dateOfBirth':{'type':Sequelize[_0x20a4('0x2')]},'description':{'type':Sequelize[_0x20a4('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x20a4('0x2')]},'fax':{'type':Sequelize[_0x20a4('0x2')]},'email':{'type':Sequelize[_0x20a4('0x2')]},'url':{'type':Sequelize[_0x20a4('0x2')]},'facebook':{'type':Sequelize[_0x20a4('0x2')]},'fb_data':{'type':Sequelize[_0x20a4('0x2')]},'twitter':{'type':Sequelize[_0x20a4('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x20a4('0x2')]},'viber':{'type':Sequelize[_0x20a4('0x2')]},'line':{'type':Sequelize[_0x20a4('0x2')]},'wechat':{'type':Sequelize[_0x20a4('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x20a4('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x20a4('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x20a4('0x5')]},'dialTimezone':{'type':Sequelize[_0x20a4('0x2')]},'utcOffset':{'type':Sequelize[_0x20a4('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index fe2b568..28a8fe2 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 _0x6140=['duplicates','where','ListId','spread','push','all','show','Tag','Tags','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','cf_%d','pickBy','map','format','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','hasOwnProperty','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','item','PHONE','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','include','rows','getHopperHistories','getHopperFinals','ContactId','includeAll','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','createReadStream','parse','meta','import','User','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','sms','fax','whatsapp','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','alias','startCase','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','key','Owner','color','DESC','chat','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','findAll','query','user','catch','CmContact','find','params','describe','tags','keys','length','startsWith','analytics','CmCustomField','cf_','columnName','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','from','get','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6140,0x1a4));var _0x0614=function(_0x483f56,_0x4b6339){_0x483f56=_0x483f56-0x0;var _0x31a5b8=_0x6140[_0x483f56];return _0x31a5b8;};'use strict';var moment=require(_0x0614('0x0'));var BPromise=require(_0x0614('0x1'));var util=require(_0x0614('0x2'));var path=require(_0x0614('0x3'));var fs=require('fs');var _=require(_0x0614('0x4'));var squel=require(_0x0614('0x5'));var Papa=require(_0x0614('0x6'));var Redis=require(_0x0614('0x7'));var contacts=require(_0x0614('0x8'));var qs=require(_0x0614('0x9'));var logger=require(_0x0614('0xa'))(_0x0614('0xb'));var config=require(_0x0614('0xc'));var shared=require(_0x0614('0xd'));var db=require(_0x0614('0xe'))['db'];config[_0x0614('0xf')]=_['defaults'](config[_0x0614('0xf')],{'host':_0x0614('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0614('0xf')]));require('./cmContact.socket')[_0x0614('0x11')](socket);function respondWithResult(_0x4b7049,_0x4c63ed){_0x4c63ed=_0x4c63ed||0xc8;return function(_0x13774c){if(_0x13774c){return _0x4b7049[_0x0614('0x12')](_0x4c63ed)['json'](_0x13774c);}};}function respondWithFilteredResult(_0x21d8b2,_0x27487a){return function(_0x4e8f3d){if(_0x4e8f3d){var _0x514254=typeof _0x27487a[_0x0614('0x13')]===_0x0614('0x14')&&typeof _0x27487a[_0x0614('0x15')]===_0x0614('0x14');var _0x37d91e=_0x4e8f3d['count'];var _0x577ca9=_0x514254?0x0:_0x27487a[_0x0614('0x13')];var _0x458dd1=_0x514254?_0x4e8f3d[_0x0614('0x16')]:_0x27487a[_0x0614('0x13')]+_0x27487a['limit'];var _0x589353;if(_0x458dd1>=_0x37d91e){_0x458dd1=_0x37d91e;_0x589353=0xc8;}else{_0x589353=0xce;}_0x21d8b2[_0x0614('0x12')](_0x589353);return _0x21d8b2[_0x0614('0x17')](_0x0614('0x18'),_0x577ca9+'-'+_0x458dd1+'/'+_0x37d91e)[_0x0614('0x19')](_0x4e8f3d);}return null;};}function saveUpdates(_0x5ad72b){return function(_0x59cee0){if(_0x59cee0){return _0x59cee0[_0x0614('0x1a')](_0x5ad72b)[_0x0614('0x1b')](function(_0x48e280){return _0x48e280;});}return null;};}function removeEntity(_0xd4909d){return function(_0x863f3){if(_0x863f3){return _0x863f3[_0x0614('0x1c')]()['then'](function(){_0xd4909d[_0x0614('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35c012){return function(_0x267308){if(!_0x267308){_0x35c012[_0x0614('0x1d')](0x194);}return _0x267308;};}function handleError(_0x531850,_0x30612d){_0x30612d=_0x30612d||0x1f4;return function(_0xb41c67){logger[_0x0614('0x1e')](_0xb41c67[_0x0614('0x1f')]);if(_0xb41c67[_0x0614('0x20')]){delete _0xb41c67['name'];}_0x531850[_0x0614('0x12')](_0x30612d)['send'](_0xb41c67);};}exports['index']=function(_0x523102,_0x5eab5a){var _0xd13516={};return contacts['describe']()[_0x0614('0x1b')](function(_0x71a516){_0xd13516=qs['getOptions'](_0x71a516,_0x523102);return contacts[_0x0614('0x21')](_0x523102[_0x0614('0x22')],_0x523102[_0x0614('0x23')],_0xd13516,_0x71a516);})[_0x0614('0x1b')](respondWithFilteredResult(_0x5eab5a,_0xd13516))[_0x0614('0x24')](handleError(_0x5eab5a,null));};exports['destroy']=function(_0x13bddd,_0xc5356c){return db[_0x0614('0x25')][_0x0614('0x26')]({'where':{'id':_0x13bddd[_0x0614('0x27')]['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0xc5356c,null))[_0x0614('0x1b')](removeEntity(_0xc5356c,null))[_0x0614('0x24')](handleError(_0xc5356c,null));};exports[_0x0614('0x28')]=function(_0x3e6931,_0x1f100e){return db[_0x0614('0x25')][_0x0614('0x28')]()['then'](function(_0x55a2e7){delete _0x55a2e7[_0x0614('0x29')];for(var _0x4fc6d4=0x0;_0x4fc6d40x0){return new Promise(function(_0x383b24){var _0x1b93c0=[];for(var _0x1ef310=0x0;_0x1ef310<_0x540d44[_0x0614('0x2b')];_0x1ef310++){_0x1b93c0[_0x0614('0x60')](insertAdditionalPhones(_0x540d44[_0x1ef310]['contact'],_0x540d44[_0x1ef310]['additionalPhones']));}Promise[_0x0614('0x61')](_0x1b93c0)['then'](function(){_0x383b24(0x1);});})['then'](function(){return{'success':_0x24e9a2,'failure':_0xcf3b05,'duplicates':_0x339dbf};});}else{return{'success':_0x24e9a2,'failure':_0xcf3b05,'duplicates':_0x339dbf};}}})[_0x0614('0x1b')](respondWithResult(_0x142066,0xc9))[_0x0614('0x24')](handleError(_0x142066,null));};exports[_0x0614('0x62')]=function(_0xbfd6e5,_0x2d7e52){var _0x4fdae0;return db[_0x0614('0x25')][_0x0614('0x28')]()[_0x0614('0x1b')](function(_0x4e52f5){return db[_0x0614('0x25')]['find']({'where':{'id':_0xbfd6e5[_0x0614('0x27')]['id']},'include':[{'model':db[_0x0614('0x63')],'as':_0x0614('0x64'),'attributes':['id',_0x0614('0x20'),'color'],'required':_0xbfd6e5[_0x0614('0x22')][_0x0614('0x65')]?!![]:![]},{'model':db[_0x0614('0x66')],'as':_0x0614('0x67'),'where':{'CmContactId':_0xbfd6e5['params']['id']},'required':![],'include':[{'model':db[_0x0614('0x68')],'as':_0x0614('0x69')}]}],'order':[db[_0x0614('0x6a')][_0x0614('0x6b')](_0x0614('0x6c'))],'attributes':_[_0x0614('0x2a')](_0x4e52f5)});})['then'](function(_0x4d7ad0){if(!_['isNil'](_0x4d7ad0)){_0x4fdae0=_0x4d7ad0[_0x0614('0x39')]({'plain':!![]});var _0x5c1a75={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4d7ad0&&_0x4d7ad0[_0x0614('0x5e')]){if(_0x4d7ad0[_0x0614('0x5e')]){_0x5c1a75[_0x0614('0x5d')][_0x0614('0x6d')][_0x0614('0x60')]({'ListId':{'$ne':_0x4d7ad0[_0x0614('0x5e')]}});}}return db[_0x0614('0x2e')]['findAll'](_0x5c1a75);}})[_0x0614('0x1b')](function(_0x33e912){if(!_[_0x0614('0x56')](_0x33e912)){return _[_0x0614('0x6e')](_0x4fdae0,_['map'](_0x33e912,function(_0x438f9b){return util['format'](_0x0614('0x6f'),_0x438f9b['id']);}));}})[_0x0614('0x1b')](handleEntityNotFound(_0x2d7e52,null))['then'](respondWithResult(_0x2d7e52,null))[_0x0614('0x24')](handleError(_0x2d7e52,null));};exports['update']=function(_0x16e176,_0x2f7d21){var _0x1b4d9c;if(_0x16e176[_0x0614('0x37')]['id']){delete _0x16e176['body']['id'];}if(!_[_0x0614('0x56')](_0x16e176[_0x0614('0x37')][_0x0614('0x55')])){var _0x388d32=_0x16e176['body'][_0x0614('0x55')];if(!_[_0x0614('0x56')](shared[_0x0614('0x57')][_0x388d32]))_0x16e176['body'][_0x0614('0x58')]=shared[_0x0614('0x57')][_0x388d32][_0x0614('0x58')];}return db[_0x0614('0x25')]['find']({'where':{'id':_0x16e176['params']['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0x2f7d21,null))['then'](saveUpdates(_0x16e176[_0x0614('0x37')],null))[_0x0614('0x1b')](function(_0xb9603c){_0x1b4d9c=_0xb9603c;var _0x2c00ff={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xb9603c&&_0xb9603c[_0x0614('0x5e')]){if(_0xb9603c['ListId']){_0x2c00ff['where'][_0x0614('0x6d')][_0x0614('0x60')]({'ListId':{'$ne':_0xb9603c['ListId']}});}}return db[_0x0614('0x2e')][_0x0614('0x21')](_0x2c00ff);})['then'](function(_0x2c7b53){if(_0x2c7b53){return _[_0x0614('0x6e')](_[_0x0614('0x70')](_0x16e176[_0x0614('0x37')],function(_0x34990d,_0x4da1f8){return _['startsWith'](_0x4da1f8,_0x0614('0x2f'));}),_[_0x0614('0x71')](_0x2c7b53,function(_0x5b0d71){return util[_0x0614('0x72')](_0x0614('0x6f'),_0x5b0d71['id']);}));}})[_0x0614('0x1b')](function(_0x1c6e7b){if(_0x1c6e7b&&!_['isEmpty'](_0x1c6e7b)){var _0x48a1a0=squel['update']()[_0x0614('0x73')](_0x0614('0x74'))[_0x0614('0x75')](_0x1c6e7b)[_0x0614('0x5d')](_0x0614('0x76'),_0x16e176[_0x0614('0x27')]['id'])[_0x0614('0x77')]();return db[_0x0614('0x6a')]['query'](_0x48a1a0['text'],{'replacements':_0x48a1a0[_0x0614('0x33')]});}})[_0x0614('0x1b')](function(){if(_0x16e176[_0x0614('0x37')]['phone']&&_0x1b4d9c){return db[_0x0614('0x3d')][_0x0614('0x1a')]({'phone':_0x16e176[_0x0614('0x37')][_0x0614('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x1b4d9c['id']}});}})[_0x0614('0x1b')](function(){return _0x1b4d9c;})[_0x0614('0x1b')](respondWithResult(_0x2f7d21,null))[_0x0614('0x24')](handleError(_0x2f7d21,null));};exports['getTags']=function(_0x2417db,_0x172146){var _0x329746={};var _0x376160={};var _0x18ffba;var _0x3c40f6;return db[_0x0614('0x25')][_0x0614('0x79')]({'where':{'id':_0x2417db['params']['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0x172146,null))[_0x0614('0x1b')](function(_0x1e1c55){if(_0x1e1c55){_0x18ffba=_0x1e1c55;_0x376160['model']=_[_0x0614('0x2a')](db['Tag'][_0x0614('0x7a')]);_0x376160[_0x0614('0x22')]=_[_0x0614('0x2a')](_0x2417db[_0x0614('0x22')]);_0x376160[_0x0614('0x7b')]=_[_0x0614('0x7c')](_0x376160[_0x0614('0x7d')],_0x376160[_0x0614('0x22')]);_0x329746[_0x0614('0x7e')]=_[_0x0614('0x7c')](_0x376160[_0x0614('0x7d')],qs[_0x0614('0x7f')](_0x2417db['query']['fields']));_0x329746[_0x0614('0x7e')]=_0x329746[_0x0614('0x7e')][_0x0614('0x2b')]?_0x329746[_0x0614('0x7e')]:_0x376160[_0x0614('0x7d')];_0x329746[_0x0614('0x80')]=qs[_0x0614('0x81')](_0x2417db[_0x0614('0x22')][_0x0614('0x81')]);_0x329746[_0x0614('0x5d')]=qs[_0x0614('0x7b')](_[_0x0614('0x82')](_0x2417db[_0x0614('0x22')],_0x376160['filters']));if(_0x2417db[_0x0614('0x22')][_0x0614('0x83')]){_0x329746[_0x0614('0x5d')]=_['merge'](_0x329746[_0x0614('0x5d')],{'$or':_[_0x0614('0x71')](_0x329746['attributes'],function(_0x329846){var _0x4da55c={};_0x4da55c[_0x329846]={'$like':'%'+_0x2417db[_0x0614('0x22')][_0x0614('0x83')]+'%'};return _0x4da55c;})});}_0x329746=_['merge']({},_0x329746,_0x2417db[_0x0614('0x84')]);return _0x18ffba['getTags'](_0x329746);}})[_0x0614('0x1b')](function(_0x38f9ab){if(_0x38f9ab){_0x3c40f6=_0x38f9ab[_0x0614('0x2b')];if(!_0x2417db[_0x0614('0x22')][_0x0614('0x85')]('nolimit')){_0x329746[_0x0614('0x15')]=qs[_0x0614('0x15')](_0x2417db['query'][_0x0614('0x15')]);_0x329746[_0x0614('0x13')]=qs[_0x0614('0x13')](_0x2417db[_0x0614('0x22')][_0x0614('0x13')]);}return _0x18ffba['getTags'](_0x329746);}})['then'](function(_0x560fb2){if(_0x560fb2){return _0x560fb2?{'count':_0x3c40f6,'rows':_0x560fb2}:null;}})[_0x0614('0x1b')](respondWithResult(_0x172146,null))['catch'](handleError(_0x172146,null));};exports[_0x0614('0x86')]=function(_0x3572c6,_0x268093){if(_0x3572c6['body']['id']){delete _0x3572c6['body']['id'];}return db[_0x0614('0x25')]['findOne']({'where':{'id':_0x3572c6[_0x0614('0x27')]['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0x268093,null))[_0x0614('0x1b')](function(_0x4c1a95){if(_0x4c1a95){return _0x4c1a95[_0x0614('0x86')](_0x3572c6[_0x0614('0x37')][_0x0614('0x87')]||[]);}return null;})['then'](respondWithResult(_0x268093,null))[_0x0614('0x24')](handleError(_0x268093,null));};exports['setAdditionalPhones']=function(_0x267cbb,_0x391243){var _0x479a14=[];_0x479a14[_0x0614('0x60')](addAdditionalPhones(_0x267cbb[_0x0614('0x37')]));Promise[_0x0614('0x61')](_0x479a14)[_0x0614('0x1b')](function(){_0x479a14=[];_0x479a14[_0x0614('0x60')](deleteCmHopperPhones(_0x267cbb[_0x0614('0x37')]['id']));_0x479a14[_0x0614('0x60')](addCmHopperPhones(_0x267cbb['body']['id']));Promise[_0x0614('0x61')](_0x479a14)[_0x0614('0x1b')](function(){return[0x1];})[_0x0614('0x1b')](respondWithResult(_0x391243,null));});};function addAdditionalPhones(_0x10bf46){var _0x22e6e0;return new Promise(function(_0x2d18b2){return db[_0x0614('0x66')][_0x0614('0x1c')]({'where':{'CmContactId':_0x10bf46['id']}})[_0x0614('0x1b')](function(){db[_0x0614('0x68')][_0x0614('0x21')]({'raw':!![],'attributes':['id',_0x0614('0x88')]})[_0x0614('0x1b')](function(_0x3bcd04){var _0x40a9ff=[];for(var _0x5df1a9=0x0;_0x5df1a9<_0x10bf46[_0x0614('0x89')][_0x0614('0x2b')];_0x5df1a9++){var _0x1fdd83=_0x10bf46[_0x0614('0x8a')]?_['isNil'](_0x10bf46[_0x0614('0x8a')][_0x5df1a9])?'':_0x10bf46[_0x0614('0x8a')][_0x5df1a9]:_0x10bf46[_0x0614('0x89')][_0x5df1a9][_0x0614('0x8b')]?_0x10bf46[_0x0614('0x89')][_0x5df1a9][_0x0614('0x8b')]:'';var _0x49e2cf=_['isNil'](_0x10bf46['items'][_0x5df1a9][_0x0614('0x8c')])?'':_0x10bf46[_0x0614('0x89')][_0x5df1a9]['description'];var _0x1b91e4=_0x1fdd83+':'+_0x10bf46[_0x0614('0x89')][_0x5df1a9][_0x0614('0x78')]+'§'+_0x49e2cf;if(_['isNil'](_0x22e6e0))_0x22e6e0=_0x1b91e4;else _0x22e6e0+=';'+_0x1b91e4;var _0x27a36b=null;var _0x3ac239=null;if(_0x10bf46[_0x0614('0x8a')]){if(!_[_0x0614('0x56')](_0x10bf46[_0x0614('0x8a')][_0x5df1a9])){_0x3ac239=_[_0x0614('0x26')](_0x3bcd04,function(_0x4981c2){return _0x4981c2['id']===_0x10bf46['item_types'][_0x5df1a9];});if(!_[_0x0614('0x56')](_0x3ac239)){_0x27a36b=_0x3ac239['OrderBy'];}}}else{if(!_[_0x0614('0x56')](_0x10bf46['items'][_0x5df1a9])){_0x3ac239=_[_0x0614('0x26')](_0x3bcd04,function(_0x4b60da){return _0x4b60da['id']===_0x10bf46[_0x0614('0x89')][_0x5df1a9]['ItemTypeId'];});if(!_[_0x0614('0x56')](_0x3ac239)){_0x27a36b=_0x5df1a9;}}}if(_['isNil'](_0x27a36b)){_0x27a36b=0x64;}_0x40a9ff['push'](addAdditionalPhone(_0x10bf46['id'],_0x10bf46[_0x0614('0x89')][_0x5df1a9]['phone'],_0x10bf46[_0x0614('0x8a')]?_[_0x0614('0x56')](_0x10bf46[_0x0614('0x8a')][_0x5df1a9])?null:_0x10bf46['item_types'][_0x5df1a9]:_0x10bf46[_0x0614('0x89')][_0x5df1a9]['ItemTypeId']?_0x10bf46[_0x0614('0x89')][_0x5df1a9][_0x0614('0x8b')]:null,_0x27a36b,_0x49e2cf));}Promise[_0x0614('0x61')](_0x40a9ff)[_0x0614('0x1b')](function(){db[_0x0614('0x25')][_0x0614('0x1a')]({'AdditionalPhones':_0x22e6e0},{'where':{'id':_0x10bf46['id']}})['then'](function(){_0x2d18b2(0x1);});});});});});}function addAdditionalPhone(_0x41b22a,_0x38db4a,_0x57b87b,_0x424306,_0x49b202){return db[_0x0614('0x66')]['find']({'where':{'CmContactId':_0x41b22a,'item':_0x38db4a}})[_0x0614('0x1b')](function(_0x1bcee2){if(_0x1bcee2)logger[_0x0614('0x34')](_0x0614('0x8d'),_0x1bcee2);else{db['CmContactHasItem'][_0x0614('0x40')]({'CmContactId':_0x41b22a,'item':_0x38db4a,'ItemTypeId':_0x57b87b,'OrderBy':_0x424306,'ItemClass':'PHONE','description':_0x49b202});}});}function deleteCmHopperPhones(_0x2f6a5d){return new Promise(function(_0x3c78c0){return db['CmHopper'][_0x0614('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2f6a5d}})[_0x0614('0x1b')](function(_0x16c2d3){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x0614('0x71')](_0x16c2d3,'id')}}});})[_0x0614('0x1b')](function(){_0x3c78c0(0x1);});});}function addCmHopperPhones(_0x5803b9){return new Promise(function(_0x11ba4c){return db[_0x0614('0x3d')][_0x0614('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5803b9}})[_0x0614('0x1b')](function(_0x9202ff){var _0x28622f=[];_[_0x0614('0x71')](_0x9202ff,function(_0x5a0867){_0x28622f[_0x0614('0x60')](createCmHopperPhone(_0x5803b9,_0x5a0867['id']));});Promise[_0x0614('0x61')](_0x28622f)[_0x0614('0x1b')](function(){_0x11ba4c(0x1);});});});}function createCmHopperPhone(_0x57a30c,_0x2693f8){return new Promise(function(_0x4a9a4f){db[_0x0614('0x66')][_0x0614('0x21')]({'raw':!![],'attributes':[_0x0614('0x8e'),'OrderBy'],'where':{'CmContactId':_0x57a30c,'ItemClass':_0x0614('0x8f')},'include':[{'model':db['ContactItemType'],'attributes':[_0x0614('0x88')],'as':'ItemType'}],'order':[_0x0614('0x88'),db[_0x0614('0x6a')]['literal'](_0x0614('0x90'))]})[_0x0614('0x1b')](function(_0x2110c9){var _0x2e111a=0x1;var _0x213481=_[_0x0614('0x71')](_0x2110c9,function(_0x3319e6){_0x3319e6[_0x0614('0x91')]=_0x2693f8;_0x3319e6[_0x0614('0x78')]=_0x3319e6['item'];_0x3319e6[_0x0614('0x88')]=_0x2e111a;delete _0x3319e6['ItemType.OrderBy'];_0x2e111a=_0x2e111a+0x1;return _0x3319e6;});return db[_0x0614('0x92')][_0x0614('0x5a')](_0x213481,{});})['then'](function(){_0x4a9a4f(0x1);});});}function insertAdditionalPhones(_0x534d27,_0xe2435c){return new Promise(function(_0x596076){var _0x2845d8=[];for(var _0x407634=0x0;_0x407634<_0xe2435c[_0x0614('0x2b')];_0x407634++){var _0x48537c=_0xe2435c[_0x407634];_0x2845d8[_0x0614('0x60')](parseContactItemType(_0x48537c));}Promise['all'](_0x2845d8)[_0x0614('0x1b')](function(){var _0x42cba7={'id':_0x534d27['id'],'items':_0xe2435c};return addAdditionalPhones(_0x42cba7)[_0x0614('0x1b')](function(){return addCmHopperPhones(_0x534d27['id']);});})[_0x0614('0x1b')](function(){_0x596076(_0x534d27);});});}function parseContactItemType(_0x3a3d91){return new Promise(function(_0x1ff941){if(_0x3a3d91['hasOwnProperty']('ItemTypeId')){_0x1ff941(_0x3a3d91);}else{return db['ContactItemType']['find']({'where':{'name':_0x3a3d91[_0x0614('0x69')]}})[_0x0614('0x1b')](function(_0x170c0b){if(_[_0x0614('0x56')](_0x170c0b))_0x3a3d91[_0x0614('0x8b')]=null;else _0x3a3d91[_0x0614('0x8b')]=_0x170c0b['id'];_0x1ff941(_0x3a3d91);});}});}exports[_0x0614('0x93')]=function(_0x198feb,_0x22b290){return db[_0x0614('0x66')][_0x0614('0x21')]({'raw':!![],'where':{'CmContactId':_0x198feb[_0x0614('0x27')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x0614('0x68')],'as':_0x0614('0x69')}],'order':[[_0x0614('0x88')],[db[_0x0614('0x6a')][_0x0614('0x6b')]('`ItemType`.OrderBy')]]})[_0x0614('0x1b')](function(_0x5936cc){return _0x5936cc;})['then'](respondWithResult(_0x22b290,null))['catch'](handleError(_0x22b290,null));};exports[_0x0614('0x94')]=function(_0x15ee8a,_0x467d89){return db['CmContactHasItem'][_0x0614('0x21')]({'raw':!![],'where':{'CmContactId':_0x15ee8a[_0x0614('0x37')][_0x0614('0x95')]}})[_0x0614('0x1b')](function(_0x41c139){var _0x168b6d=_[_0x0614('0x71')](_0x41c139,function(_0x5ce71c){_0x5ce71c[_0x0614('0x96')]=_0x15ee8a[_0x0614('0x37')][_0x0614('0x97')];return _0x5ce71c;});return db[_0x0614('0x66')][_0x0614('0x5a')](_0x168b6d,{});})[_0x0614('0x1b')](function(){return addCmHopperPhones(_0x15ee8a[_0x0614('0x37')]['toContactId']);})[_0x0614('0x1b')](function(){return['ok'];})[_0x0614('0x1b')](respondWithResult(_0x467d89,null))[_0x0614('0x24')](handleError(_0x467d89,null));};exports[_0x0614('0x98')]=function(_0x117e31,_0x4960f9){var _0x484952=[];_0x484952['push'](createCmHopperPhone(_0x117e31[_0x0614('0x37')]['id'],_0x117e31[_0x0614('0x37')][_0x0614('0x99')]));Promise[_0x0614('0x61')](_0x484952)[_0x0614('0x1b')](function(){return[0x1];})[_0x0614('0x1b')](respondWithResult(_0x4960f9,null));};exports[_0x0614('0x9a')]=function(_0x548f85,_0xa221d9){var _0x2daf01={'raw':![],'where':{}};var _0x366e4c={};var _0x3f952d={'count':0x0,'rows':[]};return db[_0x0614('0x25')]['findOne']({'where':{'id':_0x548f85[_0x0614('0x27')]['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0xa221d9,null))[_0x0614('0x1b')](function(_0x23a019){if(_0x23a019){_0x366e4c[_0x0614('0x7d')]=_['keys'](db['CmHopper'][_0x0614('0x7a')]);_0x366e4c['query']=_[_0x0614('0x2a')](_0x548f85[_0x0614('0x22')]);_0x366e4c['filters']=_[_0x0614('0x7c')](_0x366e4c[_0x0614('0x7d')],_0x366e4c['query']);_0x2daf01['attributes']=_[_0x0614('0x7c')](_0x366e4c[_0x0614('0x7d')],qs[_0x0614('0x7f')](_0x548f85['query'][_0x0614('0x7f')]));_0x2daf01[_0x0614('0x7e')]=_0x2daf01[_0x0614('0x7e')][_0x0614('0x2b')]?_0x2daf01['attributes']:_0x366e4c[_0x0614('0x7d')];if(!_0x548f85[_0x0614('0x22')][_0x0614('0x85')](_0x0614('0x9b'))){_0x2daf01[_0x0614('0x15')]=qs[_0x0614('0x15')](_0x548f85[_0x0614('0x22')][_0x0614('0x15')]);_0x2daf01['offset']=qs[_0x0614('0x13')](_0x548f85[_0x0614('0x22')][_0x0614('0x13')]);}_0x2daf01[_0x0614('0x80')]=qs['sort'](_0x548f85['query'][_0x0614('0x81')]);_0x2daf01[_0x0614('0x5d')]=qs[_0x0614('0x7b')](_['pick'](_0x548f85['query'],_0x366e4c[_0x0614('0x7b')]));_0x2daf01[_0x0614('0x5d')]['ContactId']=_0x23a019['id'];if(_0x548f85[_0x0614('0x22')][_0x0614('0x83')]){_0x2daf01[_0x0614('0x5d')]=_[_0x0614('0x36')](_0x2daf01[_0x0614('0x5d')],{'$or':_[_0x0614('0x71')](_0x2daf01[_0x0614('0x7e')],function(_0x1b88ba){var _0x273e99={};_0x273e99[_0x1b88ba]={'$like':'%'+_0x548f85[_0x0614('0x22')][_0x0614('0x83')]+'%'};return _0x273e99;})});}_0x2daf01=_[_0x0614('0x36')]({},_0x2daf01,_0x548f85['options']);return db['CmHopper']['count']({'where':_0x2daf01[_0x0614('0x5d')]})[_0x0614('0x1b')](function(_0x547f6e){_0x3f952d['count']=_0x547f6e;if(_0x548f85[_0x0614('0x22')]['includeAll']){_0x2daf01[_0x0614('0x9c')]=[{'all':!![]}];}return db[_0x0614('0x3d')]['findAll'](_0x2daf01);})[_0x0614('0x1b')](function(_0x4a9582){_0x3f952d[_0x0614('0x9d')]=_0x4a9582;return _0x3f952d;});}})[_0x0614('0x1b')](respondWithFilteredResult(_0xa221d9,_0x2daf01))[_0x0614('0x24')](handleError(_0xa221d9,null));};exports[_0x0614('0x9e')]=function(_0x21cd66,_0x13db9c){var _0x795e02={'raw':!![],'where':{}};var _0x36ea1c={};var _0x173c35={'count':0x0,'rows':[]};return db[_0x0614('0x25')][_0x0614('0x79')]({'where':{'id':_0x21cd66[_0x0614('0x27')]['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0x13db9c,null))['then'](function(_0x3ee915){if(_0x3ee915){_0x36ea1c[_0x0614('0x7d')]=_[_0x0614('0x2a')](db['CmHopperHistory']['rawAttributes']);_0x36ea1c['query']=_[_0x0614('0x2a')](_0x21cd66['query']);_0x36ea1c['filters']=_[_0x0614('0x7c')](_0x36ea1c[_0x0614('0x7d')],_0x36ea1c[_0x0614('0x22')]);_0x795e02['attributes']=_[_0x0614('0x7c')](_0x36ea1c[_0x0614('0x7d')],qs[_0x0614('0x7f')](_0x21cd66[_0x0614('0x22')]['fields']));_0x795e02[_0x0614('0x7e')]=_0x795e02['attributes'][_0x0614('0x2b')]?_0x795e02[_0x0614('0x7e')]:_0x36ea1c[_0x0614('0x7d')];if(!_0x21cd66['query'][_0x0614('0x85')]('nolimit')){_0x795e02[_0x0614('0x15')]=qs[_0x0614('0x15')](_0x21cd66[_0x0614('0x22')][_0x0614('0x15')]);_0x795e02[_0x0614('0x13')]=qs[_0x0614('0x13')](_0x21cd66[_0x0614('0x22')]['offset']);}_0x795e02[_0x0614('0x80')]=qs[_0x0614('0x81')](_0x21cd66[_0x0614('0x22')][_0x0614('0x81')]);_0x795e02[_0x0614('0x5d')]=qs['filters'](_[_0x0614('0x82')](_0x21cd66['query'],_0x36ea1c[_0x0614('0x7b')]));_0x795e02[_0x0614('0x5d')]['ContactId']=_0x3ee915['id'];if(_0x21cd66[_0x0614('0x22')]['filter']){_0x795e02[_0x0614('0x5d')]=_[_0x0614('0x36')](_0x795e02[_0x0614('0x5d')],{'$or':_[_0x0614('0x71')](_0x795e02[_0x0614('0x7e')],function(_0x42375f){var _0x194865={};_0x194865[_0x42375f]={'$like':'%'+_0x21cd66[_0x0614('0x22')][_0x0614('0x83')]+'%'};return _0x194865;})});}_0x795e02=_[_0x0614('0x36')]({},_0x795e02,_0x21cd66[_0x0614('0x84')]);return db[_0x0614('0x4c')][_0x0614('0x16')]({'where':_0x795e02[_0x0614('0x5d')]})['then'](function(_0x346153){_0x173c35[_0x0614('0x16')]=_0x346153;if(_0x21cd66[_0x0614('0x22')]['includeAll']){_0x795e02['include']=[{'all':!![]}];}return db[_0x0614('0x4c')][_0x0614('0x21')](_0x795e02);})['then'](function(_0x1d7169){_0x173c35[_0x0614('0x9d')]=_0x1d7169;return _0x173c35;});}})[_0x0614('0x1b')](respondWithFilteredResult(_0x13db9c,_0x795e02))[_0x0614('0x24')](handleError(_0x13db9c,null));};exports[_0x0614('0x9f')]=function(_0x5bc345,_0x26db2b){var _0x5726cd={'raw':!![],'where':{}};var _0x2978c0={};var _0x52ca35={'count':0x0,'rows':[]};return db[_0x0614('0x25')][_0x0614('0x79')]({'where':{'id':_0x5bc345[_0x0614('0x27')]['id']}})[_0x0614('0x1b')](handleEntityNotFound(_0x26db2b,null))[_0x0614('0x1b')](function(_0x4d0490){if(_0x4d0490){_0x2978c0[_0x0614('0x7d')]=_[_0x0614('0x2a')](db[_0x0614('0x4b')][_0x0614('0x7a')]);_0x2978c0['query']=_[_0x0614('0x2a')](_0x5bc345[_0x0614('0x22')]);_0x2978c0['filters']=_[_0x0614('0x7c')](_0x2978c0[_0x0614('0x7d')],_0x2978c0[_0x0614('0x22')]);_0x5726cd[_0x0614('0x7e')]=_['intersection'](_0x2978c0['model'],qs[_0x0614('0x7f')](_0x5bc345['query'][_0x0614('0x7f')]));_0x5726cd[_0x0614('0x7e')]=_0x5726cd[_0x0614('0x7e')]['length']?_0x5726cd[_0x0614('0x7e')]:_0x2978c0[_0x0614('0x7d')];if(!_0x5bc345[_0x0614('0x22')]['hasOwnProperty'](_0x0614('0x9b'))){_0x5726cd[_0x0614('0x15')]=qs[_0x0614('0x15')](_0x5bc345[_0x0614('0x22')]['limit']);_0x5726cd[_0x0614('0x13')]=qs[_0x0614('0x13')](_0x5bc345[_0x0614('0x22')][_0x0614('0x13')]);}_0x5726cd['order']=qs[_0x0614('0x81')](_0x5bc345['query'][_0x0614('0x81')]);_0x5726cd[_0x0614('0x5d')]=qs[_0x0614('0x7b')](_[_0x0614('0x82')](_0x5bc345[_0x0614('0x22')],_0x2978c0[_0x0614('0x7b')]));_0x5726cd[_0x0614('0x5d')][_0x0614('0xa0')]=_0x4d0490['id'];if(_0x5bc345[_0x0614('0x22')][_0x0614('0x83')]){_0x5726cd['where']=_[_0x0614('0x36')](_0x5726cd['where'],{'$or':_[_0x0614('0x71')](_0x5726cd[_0x0614('0x7e')],function(_0x5417c3){var _0x3faa70={};_0x3faa70[_0x5417c3]={'$like':'%'+_0x5bc345['query'][_0x0614('0x83')]+'%'};return _0x3faa70;})});}_0x5726cd=_[_0x0614('0x36')]({},_0x5726cd,_0x5bc345[_0x0614('0x84')]);return db[_0x0614('0x4b')][_0x0614('0x16')]({'where':_0x5726cd[_0x0614('0x5d')]})[_0x0614('0x1b')](function(_0x14f0b9){_0x52ca35[_0x0614('0x16')]=_0x14f0b9;if(_0x5bc345[_0x0614('0x22')][_0x0614('0xa1')]){_0x5726cd[_0x0614('0x9c')]=[{'all':!![]}];}return db[_0x0614('0x4b')]['findAll'](_0x5726cd);})[_0x0614('0x1b')](function(_0x59c94d){_0x52ca35[_0x0614('0x9d')]=_0x59c94d;return _0x52ca35;});}})['then'](respondWithFilteredResult(_0x26db2b,_0x5726cd))[_0x0614('0x24')](handleError(_0x26db2b,null));};exports['getJscriptySessions']=function(_0xc27155,_0x363787){var _0x210177={'raw':!![],'where':{}};var _0x1cc200={};var _0x14f4b2={'count':0x0,'rows':[]};return db['CmContact'][_0x0614('0x79')]({'where':{'id':_0xc27155['params']['id']}})['then'](handleEntityNotFound(_0x363787,null))[_0x0614('0x1b')](function(_0x434354){if(_0x434354){_0x1cc200['model']=_[_0x0614('0x2a')](db['JscriptySessionReport'][_0x0614('0x7a')]);_0x1cc200[_0x0614('0x22')]=_['keys'](_0xc27155[_0x0614('0x22')]);_0x1cc200[_0x0614('0x7b')]=_[_0x0614('0x7c')](_0x1cc200['model'],_0x1cc200[_0x0614('0x22')]);_0x210177[_0x0614('0x7e')]=_[_0x0614('0x7c')](_0x1cc200[_0x0614('0x7d')],qs[_0x0614('0x7f')](_0xc27155['query']['fields']));_0x210177[_0x0614('0x7e')]=_0x210177['attributes'][_0x0614('0x2b')]?_0x210177['attributes']:_0x1cc200[_0x0614('0x7d')];if(!_0xc27155[_0x0614('0x22')][_0x0614('0x85')](_0x0614('0x9b'))){_0x210177[_0x0614('0x15')]=qs[_0x0614('0x15')](_0xc27155['query'][_0x0614('0x15')]);_0x210177[_0x0614('0x13')]=qs[_0x0614('0x13')](_0xc27155[_0x0614('0x22')][_0x0614('0x13')]);}_0x210177[_0x0614('0x80')]=qs['sort'](_0xc27155[_0x0614('0x22')][_0x0614('0x81')]);_0x210177[_0x0614('0x5d')]=qs[_0x0614('0x7b')](_[_0x0614('0x82')](_0xc27155[_0x0614('0x22')],_0x1cc200[_0x0614('0x7b')]));_0x210177[_0x0614('0x5d')][_0x0614('0xa0')]=_0x434354['id'];if(_0xc27155[_0x0614('0x22')]['filter']){_0x210177[_0x0614('0x5d')]=_['merge'](_0x210177[_0x0614('0x5d')],{'$or':_[_0x0614('0x71')](_0x210177[_0x0614('0x7e')],function(_0x238271){var _0x3169f1={};_0x3169f1[_0x238271]={'$like':'%'+_0xc27155[_0x0614('0x22')][_0x0614('0x83')]+'%'};return _0x3169f1;})});}_0x210177=_[_0x0614('0x36')]({},_0x210177,_0xc27155[_0x0614('0x84')]);return db[_0x0614('0x51')][_0x0614('0x16')]({'where':_0x210177['where']})['then'](function(_0x3ebecb){_0x14f4b2[_0x0614('0x16')]=_0x3ebecb;if(_0xc27155[_0x0614('0x22')][_0x0614('0xa1')]){_0x210177[_0x0614('0x9c')]=[{'all':!![]}];}return db[_0x0614('0x51')][_0x0614('0x21')](_0x210177);})[_0x0614('0x1b')](function(_0x3efad6){_0x14f4b2[_0x0614('0x9d')]=_0x3efad6;return _0x14f4b2;});}})[_0x0614('0x1b')](respondWithFilteredResult(_0x363787,_0x210177))[_0x0614('0x24')](handleError(_0x363787,null));};exports[_0x0614('0xa2')]=function(_0x4f592d,_0x50fbed){try{if(!_0x4f592d[_0x0614('0x37')][_0x0614('0x5e')]){throw new Error(_0x0614('0xa3'));}if(!_0x4f592d[_0x0614('0x37')][_0x0614('0xa4')]){throw new Error(_0x0614('0xa5'));}if(!_0x4f592d[_0x0614('0x37')][_0x0614('0xa6')]){throw new Error(_0x0614('0xa7'));}if(!_0x4f592d['body'][_0x0614('0xa8')]){throw new Error(_0x0614('0xa9'));}var _0x2fe012=_0x4f592d['body'][_0x0614('0xa4')][_0x0614('0xaa')](',');var _0x32974f=_0x4f592d['body'][_0x0614('0xa6')][_0x0614('0xaa')](',');if(!_0x2fe012[_0x0614('0x2b')]||!_0x32974f['length']||_0x2fe012[_0x0614('0x2b')]!==_0x32974f[_0x0614('0x2b')]){throw new Error(_0x0614('0xab'));}_0x4f592d[_0x0614('0x37')][_0x0614('0x7f')]=_['zipObject'](_0x2fe012,_0x32974f);if(!_0x4f592d[_0x0614('0x37')][_0x0614('0x7f')][_0x0614('0x78')]){throw new Error(_0x0614('0xac'));}if(!_0x4f592d[_0x0614('0x37')][_0x0614('0x7f')][_0x0614('0xad')]){throw new Error(_0x0614('0xae'));}var _0x3812d8=path[_0x0614('0x3c')](config[_0x0614('0xaf')],'server/files/tmp',_0x4f592d[_0x0614('0xb0')][_0x0614('0xb1')]);fs[_0x0614('0xb2')](_0x3812d8,parseInt(_0x0614('0xb3'),0x8));var _0x4b8e9f=require(_0x0614('0xb4'))[_0x0614('0xb5')](path['join'](__dirname,_0x0614('0xb6')),[_0x3812d8,_0x4f592d[_0x0614('0x37')]['binding_keys'],_0x4f592d['body'][_0x0614('0xa6')],_0x4f592d['body'][_0x0614('0x5e')],_0x4f592d['body'][_0x0614('0xb7')],_0x4f592d[_0x0614('0x37')][_0x0614('0x5c')],_0x4f592d['body'][_0x0614('0xa8')]]);return _0x50fbed[_0x0614('0x12')](0xc8)[_0x0614('0x19')]({'message':'File\x20uploaded\x20correctly!','pid':_0x4b8e9f[_0x0614('0xb8')]});}catch(_0x430c53){return _0x50fbed['status'](0x1f4)['send'](_0x430c53);}};exports[_0x0614('0xb9')]=function(_0x219a07,_0x504a52){var _0x5d0b44=fs[_0x0614('0xba')](_0x219a07['file'][_0x0614('0x3')]);Papa[_0x0614('0xbb')](_0x5d0b44,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2e0cf4){return _0x504a52[_0x0614('0x12')](0xc8)[_0x0614('0x19')]({'file':_0x219a07['file'],'fields':_0x2e0cf4[_0x0614('0xbc')][_0x0614('0x7f')]});}});};exports[_0x0614('0xbd')]=function(_0x3c7c49,_0x2a53cb){return db[_0x0614('0xbe')][_0x0614('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0614('0xbf')}})[_0x0614('0x1b')](function(_0x57ad5b){var _0x3a122c=![];if(!_0x3c7c49['body']['ListId']){throw new Error(_0x0614('0xa3'));}if(!_0x3c7c49[_0x0614('0x37')][_0x0614('0xc0')]['phone']){throw new Error(_0x0614('0xac'));}if(!_0x3c7c49['body']['binding'][_0x0614('0xad')]){throw new Error(_0x0614('0xae'));}if(!_0x3c7c49[_0x0614('0x37')][_0x0614('0xa8')]){throw new Error(_0x0614('0xa9'));}var _0x17c075=require(_0x0614('0xb4'))[_0x0614('0xb5')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x3c7c49['params']['id'],JSON[_0x0614('0xc1')](_0x3c7c49[_0x0614('0x37')]),JSON[_0x0614('0xc1')](_0x57ad5b)]);_0x17c075['on'](_0x0614('0xc2'),function(){_0x3a122c=!![];return _0x2a53cb[_0x0614('0x12')](0xc8)[_0x0614('0x19')]({'message':_0x0614('0xc3'),'pid':_0x17c075[_0x0614('0xb8')]});});_0x17c075['on'](_0x0614('0xc4'),function(_0x10e2e7){if(_0x10e2e7&&!_0x3a122c){return _0x2a53cb[_0x0614('0x12')](0x1f4)[_0x0614('0x19')]({'message':_0x0614('0xc5'),'pid':_0x17c075[_0x0614('0xb8')]});}});})[_0x0614('0x24')](handleError(_0x2a53cb,null));};exports[_0x0614('0xc6')]=function(_0x53ea21,_0x46c3f6){return db['User'][_0x0614('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0614('0xbf')}})[_0x0614('0x1b')](function(_0x2eb688){var _0xb9165c=![];if(!_0x53ea21[_0x0614('0x37')][_0x0614('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x53ea21[_0x0614('0x37')]['binding'][_0x0614('0x78')]){throw new Error(_0x0614('0xac'));}if(!_0x53ea21[_0x0614('0x37')]['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x53ea21['body'][_0x0614('0xa8')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x99913d=require(_0x0614('0xb4'))[_0x0614('0xb5')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x53ea21[_0x0614('0x27')]['id'],JSON[_0x0614('0xc1')](_0x53ea21[_0x0614('0x37')]),JSON['stringify'](_0x2eb688)]);_0x99913d['on'](_0x0614('0xc2'),function(){_0xb9165c=!![];return _0x46c3f6[_0x0614('0x12')](0xc8)[_0x0614('0x19')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x99913d['pid']});});_0x99913d['on'](_0x0614('0xc4'),function(_0x162130){if(_0x162130&&!_0xb9165c){return _0x46c3f6['status'](0x1f4)[_0x0614('0x19')]({'message':'error\x20child\x20process','pid':_0x99913d['pid']});}});})[_0x0614('0x24')](handleError(_0x46c3f6,null));};exports[_0x0614('0xc7')]=function(_0x2757f0,_0x2889c1){var _0x483e61=[_0x0614('0xc8'),'chat',_0x0614('0xc9'),'openchannel',_0x0614('0xca'),_0x0614('0xcb'),'voice'];var _0x33ff48={'offset':0x0,'order':qs[_0x0614('0x81')](_0x0614('0xcc'))},_0x4afa27={'count':0x0,'rows':[]};Promise[_0x0614('0xcd')]()['then'](function(){if(_0x2757f0['query'][_0x0614('0xce')]){if(!_[_0x0614('0xcf')](_0x483e61,_0x2757f0[_0x0614('0x22')][_0x0614('0xce')][_0x0614('0xd0')]())){throw new Error(_0x0614('0xd1'));}_0x483e61=[_0x2757f0[_0x0614('0x22')]['channel'][_0x0614('0xd0')]()];}if(_0x2757f0['query'][_0x0614('0xd2')]){try{var _0x5b6877=JSON['parse'](_0x2757f0['query'][_0x0614('0xd2')]);if(!moment(_0x5b6877[_0x0614('0x38')])[_0x0614('0xd3')]()){throw new Error(_0x0614('0xd4'));}if(!moment(_0x5b6877['to'])[_0x0614('0xd3')]()){throw new Error(_0x0614('0xd5'));}}catch(_0x27dcc5){throw new Error(_0x0614('0xd6'));}}if(!_0x2757f0[_0x0614('0x22')][_0x0614('0x85')]('nolimit')){_0x33ff48[_0x0614('0x15')]=qs[_0x0614('0x15')](_0x2757f0['query'][_0x0614('0x15')]||0xa);_0x33ff48['offset']=qs['offset'](_0x2757f0[_0x0614('0x22')][_0x0614('0x13')]);}var _0x225798=_0x483e61['map'](function(_0xedb624){if(_0xedb624===_0x0614('0xd7')){var _0xd23422={'attributes':['id',_0x0614('0xd8'),_0x0614('0x32'),_0x0614('0xd9'),_0x0614('0xda'),'callerid',_0x0614('0xdb'),_0x0614('0xdc'),_0x0614('0xdd'),_0x0614('0xde'),_0x0614('0xdf'),'userDisposition','userSecondDisposition',_0x0614('0xe0'),_0x0614('0xe1')],'where':{'ContactId':_0x2757f0[_0x0614('0x27')]['id']},'include':[{'model':db[_0x0614('0xbe')],'as':_0x0614('0xbe'),'attributes':['id',_0x0614('0x20'),_0x0614('0xe2'),'alias']}],'order':[[_0x0614('0xdf'),'DESC']]};if(_0x2757f0[_0x0614('0x22')][_0x0614('0xd2')]){_0xd23422[_0x0614('0x5d')][_0x0614('0xdf')]={'$gte':_0x5b6877[_0x0614('0x38')],'$lte':_0x5b6877['to']};}return db[_0x0614('0xe3')][_0x0614('0xe4')](_0xd23422)[_0x0614('0x1b')](function(_0x190d82){_0x4afa27[_0x0614('0x16')]+=_0x190d82[_0x0614('0x16')];return _[_0x0614('0x71')](_0x190d82[_0x0614('0x9d')],function(_0x16a3b2){var _0x474e5a=_0x16a3b2[_0x0614('0x39')]({'plain':!![]});_0x474e5a[_0x0614('0xce')]=_0xedb624;if(_0x474e5a[_0x0614('0xbe')]){_0x474e5a['User']={'id':_0x474e5a['User']['id'],'name':_0x474e5a[_0x0614('0xbe')][_0x0614('0x20')],'fullname':_0x474e5a['User'][_0x0614('0xe2')],'alias':_0x474e5a['User'][_0x0614('0xe5')]};}return _0x474e5a;});});}else{var _0x2da453=_[_0x0614('0xe6')](_0xedb624)+(_0xedb624==='chat'?_0x0614('0xe7'):_0x0614('0xe8'));var _0x277ca6={'attributes':['id',_0x0614('0xe9'),_0x0614('0xea'),_0x0614('0xdf'),_0x0614('0xde'),'disposition',_0x0614('0xeb'),_0x0614('0xec'),'UserId',_0x2da453+'Id'],'where':{'ContactId':_0x2757f0[_0x0614('0x27')]['id']},'include':[{'model':db[_0x2da453],'as':_0x0614('0xe8'),'attributes':['id','name',_0x0614('0xed')]},{'model':db['User'],'as':_0x0614('0xee'),'attributes':['id',_0x0614('0x20'),_0x0614('0xe2')]},{'model':db[_0x0614('0x63')],'as':'Tags','attributes':['id',_0x0614('0x20'),_0x0614('0xef')],'through':{'attributes':[]}}],'order':[['createdAt',_0x0614('0xf0')]]};if(_0x2757f0[_0x0614('0x22')]['range']){_0x277ca6[_0x0614('0x5d')][_0x0614('0xdf')]={'$gte':_0x5b6877[_0x0614('0x38')],'$lte':_0x5b6877['to']};}switch(_0xedb624){case _0x0614('0xf1'):_0x277ca6[_0x0614('0x7e')]['push']('browserName','customerIp','customerPort',_0x0614('0xf2'),_0x0614('0xf3'),_0x0614('0xf4'),'ratingType',_0x0614('0xf5'),_0x0614('0xf6'));break;case'mail':_0x277ca6['attributes'][_0x0614('0x60')](_0x0614('0xf7'),_0x0614('0xf8'));break;case _0x0614('0xf9'):_0x277ca6[_0x0614('0x7e')]['push'](_0x0614('0xfa'),_0x0614('0xfb'));break;}return db[_[_0x0614('0xe6')](_0xedb624)+'Interaction'][_0x0614('0xe4')](_0x277ca6)[_0x0614('0x1b')](function(_0x4a640c){_0x4afa27[_0x0614('0x16')]+=_0x4a640c[_0x0614('0x16')];return _[_0x0614('0x71')](_0x4a640c[_0x0614('0x9d')],function(_0x403652){var _0x30e85b=_0x403652[_0x0614('0x39')]({'plain':!![]});_0x30e85b[_0x0614('0xce')]=_0xedb624;if(_0x30e85b[_0x0614('0xee')]){_0x30e85b[_0x0614('0xee')]={'id':_0x30e85b['Owner']['id'],'name':_0x30e85b['Owner'][_0x0614('0x20')],'fullname':_0x30e85b[_0x0614('0xee')][_0x0614('0xe2')]};}return _0x30e85b;});});}});return Promise[_0x0614('0x61')](_0x225798);})[_0x0614('0x1b')](function(_0x48316c){return _(_0x48316c)[_0x0614('0xfc')]()[_0x0614('0xfd')]('createdAt')[_0x0614('0xfe')]()[_0x0614('0xff')]();})['then'](function(_0x506618){_0x4afa27[_0x0614('0x9d')]=_0x33ff48[_0x0614('0x15')]?_0x506618['slice'](_0x33ff48[_0x0614('0x13')],_0x33ff48[_0x0614('0x13')]+_0x33ff48[_0x0614('0x15')]):_0x506618;return _0x4afa27;})[_0x0614('0x1b')](respondWithFilteredResult(_0x2889c1,_0x33ff48))['catch'](handleError(_0x2889c1,null));}; \ No newline at end of file +var _0xf9a0=['map','cf_%d','omit','pickBy','format','setFields','id\x20=\x20?','sequelize','text','phone','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','setAdditionalPhones','OrderBy','item_types','ItemTypeId','items','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','getHopperHistories','ContactId','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','filename','chmodSync','0777','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','import','binding','child_process','../../components/import/cm/csv2','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','firstName','fork','../../components/import/cm/csvUpdates','stringify','message','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','callerid','starttime','note','createdAt','userDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','threadId','Interaction','Owner','flatten','sortBy','value','slice','bluebird','util','path','squel','papaparse','ioredis','../../config/logger','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','offset','undefined','limit','count','status','set','json','update','then','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','destroy','CmContact','params','catch','tags','keys','length','startsWith','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','values','info','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','ListId','findOrCreate','spread','contact','all','show','find','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','push'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf9a0,0x8c));var _0x0f9a=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xf9a0[_0x1f0724];return _0x253ffb;};'use strict';var moment=require('moment');var BPromise=require(_0x0f9a('0x0'));var util=require(_0x0f9a('0x1'));var path=require(_0x0f9a('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f9a('0x3'));var Papa=require(_0x0f9a('0x4'));var Redis=require(_0x0f9a('0x5'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x0f9a('0x6'))('api');var config=require(_0x0f9a('0x7'));var shared=require(_0x0f9a('0x8'));var db=require('../../mysqldb')['db'];config[_0x0f9a('0x9')]=_[_0x0f9a('0xa')](config[_0x0f9a('0x9')],{'host':_0x0f9a('0xb'),'port':0x18eb});var socket=require(_0x0f9a('0xc'))(new Redis(config[_0x0f9a('0x9')]));require(_0x0f9a('0xd'))['register'](socket);function respondWithResult(_0xc38cd1,_0x18aa81){_0x18aa81=_0x18aa81||0xc8;return function(_0x4d97b5){if(_0x4d97b5){return _0xc38cd1['status'](_0x18aa81)['json'](_0x4d97b5);}};}function respondWithFilteredResult(_0x2f8acb,_0x11656f){return function(_0x1b4b91){if(_0x1b4b91){var _0x47d242=typeof _0x11656f[_0x0f9a('0xe')]===_0x0f9a('0xf')&&typeof _0x11656f[_0x0f9a('0x10')]==='undefined';var _0x60381a=_0x1b4b91[_0x0f9a('0x11')];var _0x55f9d6=_0x47d242?0x0:_0x11656f['offset'];var _0x2ab6d8=_0x47d242?_0x1b4b91[_0x0f9a('0x11')]:_0x11656f['offset']+_0x11656f[_0x0f9a('0x10')];var _0x253ee5;if(_0x2ab6d8>=_0x60381a){_0x2ab6d8=_0x60381a;_0x253ee5=0xc8;}else{_0x253ee5=0xce;}_0x2f8acb[_0x0f9a('0x12')](_0x253ee5);return _0x2f8acb[_0x0f9a('0x13')]('Content-Range',_0x55f9d6+'-'+_0x2ab6d8+'/'+_0x60381a)[_0x0f9a('0x14')](_0x1b4b91);}return null;};}function saveUpdates(_0xc41528){return function(_0x30c313){if(_0x30c313){return _0x30c313[_0x0f9a('0x15')](_0xc41528)[_0x0f9a('0x16')](function(_0x473878){return _0x473878;});}return null;};}function removeEntity(_0x4c077f){return function(_0x511426){if(_0x511426){return _0x511426['destroy']()[_0x0f9a('0x16')](function(){_0x4c077f[_0x0f9a('0x12')](0xcc)[_0x0f9a('0x17')]();});}};}function handleEntityNotFound(_0x5bb898){return function(_0x1987a1){if(!_0x1987a1){_0x5bb898[_0x0f9a('0x18')](0x194);}return _0x1987a1;};}function handleError(_0x2a1de8,_0x242dfc){_0x242dfc=_0x242dfc||0x1f4;return function(_0x357ba3){logger['error'](_0x357ba3[_0x0f9a('0x19')]);if(_0x357ba3[_0x0f9a('0x1a')]){delete _0x357ba3[_0x0f9a('0x1a')];}_0x2a1de8[_0x0f9a('0x12')](_0x242dfc)[_0x0f9a('0x1b')](_0x357ba3);};}exports[_0x0f9a('0x1c')]=function(_0x4e0896,_0x5240d5){var _0x2412c1={};return contacts[_0x0f9a('0x1d')]()[_0x0f9a('0x16')](function(_0x2dd84e){_0x2412c1=qs[_0x0f9a('0x1e')](_0x2dd84e,_0x4e0896);return contacts[_0x0f9a('0x1f')](_0x4e0896[_0x0f9a('0x20')],_0x4e0896[_0x0f9a('0x21')],_0x2412c1,_0x2dd84e);})[_0x0f9a('0x16')](respondWithFilteredResult(_0x5240d5,_0x2412c1))['catch'](handleError(_0x5240d5,null));};exports[_0x0f9a('0x22')]=function(_0x1d1716,_0x2f5930){return db[_0x0f9a('0x23')]['find']({'where':{'id':_0x1d1716[_0x0f9a('0x24')]['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x2f5930,null))['then'](removeEntity(_0x2f5930,null))[_0x0f9a('0x25')](handleError(_0x2f5930,null));};exports[_0x0f9a('0x1d')]=function(_0x1cc670,_0x1932cf){return db[_0x0f9a('0x23')]['describe']()[_0x0f9a('0x16')](function(_0x25825){delete _0x25825[_0x0f9a('0x26')];for(var _0x151e89=0x0;_0x151e890x0){return new Promise(function(_0x1898c6){var _0x203f55=[];for(var _0x2a3103=0x0;_0x2a3103<_0xfccf10[_0x0f9a('0x28')];_0x2a3103++){_0x203f55['push'](insertAdditionalPhones(_0xfccf10[_0x2a3103][_0x0f9a('0x5e')],_0xfccf10[_0x2a3103][_0x0f9a('0x56')]));}Promise[_0x0f9a('0x5f')](_0x203f55)['then'](function(){_0x1898c6(0x1);});})[_0x0f9a('0x16')](function(){return{'success':_0x4ace5e,'failure':_0x3eef7b,'duplicates':_0x16ac01};});}else{return{'success':_0x4ace5e,'failure':_0x3eef7b,'duplicates':_0x16ac01};}}})[_0x0f9a('0x16')](respondWithResult(_0x10fd18,0xc9))['catch'](handleError(_0x10fd18,null));};exports[_0x0f9a('0x60')]=function(_0x5b6004,_0x111e3){var _0x56afbb;return db[_0x0f9a('0x23')][_0x0f9a('0x1d')]()[_0x0f9a('0x16')](function(_0x291ef0){return db[_0x0f9a('0x23')][_0x0f9a('0x61')]({'where':{'id':_0x5b6004['params']['id']},'include':[{'model':db[_0x0f9a('0x62')],'as':_0x0f9a('0x63'),'attributes':['id','name',_0x0f9a('0x64')],'required':_0x5b6004[_0x0f9a('0x20')][_0x0f9a('0x65')]?!![]:![]},{'model':db[_0x0f9a('0x49')],'as':_0x0f9a('0x66'),'where':{'CmContactId':_0x5b6004[_0x0f9a('0x24')]['id']},'required':![],'include':[{'model':db[_0x0f9a('0x67')],'as':_0x0f9a('0x68')}]}],'order':[db['sequelize'][_0x0f9a('0x69')](_0x0f9a('0x6a'))],'attributes':_[_0x0f9a('0x27')](_0x291ef0)});})[_0x0f9a('0x16')](function(_0x305b08){if(!_[_0x0f9a('0x52')](_0x305b08)){_0x56afbb=_0x305b08['get']({'plain':!![]});var _0x655e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x305b08&&_0x305b08[_0x0f9a('0x5b')]){if(_0x305b08['ListId']){_0x655e[_0x0f9a('0x5a')][_0x0f9a('0x6b')][_0x0f9a('0x6c')]({'ListId':{'$ne':_0x305b08[_0x0f9a('0x5b')]}});}}return db[_0x0f9a('0x2d')][_0x0f9a('0x1f')](_0x655e);}})[_0x0f9a('0x16')](function(_0x65425e){if(!_[_0x0f9a('0x52')](_0x65425e)){return _['omit'](_0x56afbb,_[_0x0f9a('0x6d')](_0x65425e,function(_0x37f494){return util['format'](_0x0f9a('0x6e'),_0x37f494['id']);}));}})[_0x0f9a('0x16')](handleEntityNotFound(_0x111e3,null))[_0x0f9a('0x16')](respondWithResult(_0x111e3,null))['catch'](handleError(_0x111e3,null));};exports['update']=function(_0xbf29aa,_0x4869fc){var _0x2af4ca;if(_0xbf29aa[_0x0f9a('0x36')]['id']){delete _0xbf29aa[_0x0f9a('0x36')]['id'];}if(!_[_0x0f9a('0x52')](_0xbf29aa[_0x0f9a('0x36')][_0x0f9a('0x53')])){var _0x15ace0=_0xbf29aa['body'][_0x0f9a('0x53')];if(!_[_0x0f9a('0x52')](shared[_0x0f9a('0x54')][_0x15ace0]))_0xbf29aa[_0x0f9a('0x36')][_0x0f9a('0x55')]=shared[_0x0f9a('0x54')][_0x15ace0][_0x0f9a('0x55')];}return db['CmContact'][_0x0f9a('0x61')]({'where':{'id':_0xbf29aa[_0x0f9a('0x24')]['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x4869fc,null))['then'](saveUpdates(_0xbf29aa[_0x0f9a('0x36')],null))[_0x0f9a('0x16')](function(_0x5eeccf){_0x2af4ca=_0x5eeccf;var _0x2b79f3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5eeccf&&_0x5eeccf[_0x0f9a('0x5b')]){if(_0x5eeccf[_0x0f9a('0x5b')]){_0x2b79f3[_0x0f9a('0x5a')][_0x0f9a('0x6b')]['push']({'ListId':{'$ne':_0x5eeccf['ListId']}});}}return db[_0x0f9a('0x2d')][_0x0f9a('0x1f')](_0x2b79f3);})[_0x0f9a('0x16')](function(_0x3829c4){if(_0x3829c4){return _[_0x0f9a('0x6f')](_[_0x0f9a('0x70')](_0xbf29aa[_0x0f9a('0x36')],function(_0xe5911f,_0x4b61af){return _[_0x0f9a('0x29')](_0x4b61af,_0x0f9a('0x2a'));}),_[_0x0f9a('0x6d')](_0x3829c4,function(_0x58097e){return util[_0x0f9a('0x71')](_0x0f9a('0x6e'),_0x58097e['id']);}));}})[_0x0f9a('0x16')](function(_0x550e18){if(_0x550e18&&!_['isEmpty'](_0x550e18)){var _0x6fa3ff=squel[_0x0f9a('0x15')]()['table']('cm_contacts')[_0x0f9a('0x72')](_0x550e18)[_0x0f9a('0x5a')](_0x0f9a('0x73'),_0xbf29aa[_0x0f9a('0x24')]['id'])['toParam']();return db[_0x0f9a('0x74')][_0x0f9a('0x20')](_0x6fa3ff[_0x0f9a('0x75')],{'replacements':_0x6fa3ff['values']});}})[_0x0f9a('0x16')](function(){if(_0xbf29aa[_0x0f9a('0x36')][_0x0f9a('0x76')]&&_0x2af4ca){return db[_0x0f9a('0x3d')]['update']({'phone':_0xbf29aa[_0x0f9a('0x36')][_0x0f9a('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x2af4ca['id']}});}})['then'](function(){return _0x2af4ca;})[_0x0f9a('0x16')](respondWithResult(_0x4869fc,null))[_0x0f9a('0x25')](handleError(_0x4869fc,null));};exports[_0x0f9a('0x77')]=function(_0x2fbbb1,_0x19a84e){var _0xf07f42={};var _0x34c649={};var _0x40327f;var _0x2a08d1;return db[_0x0f9a('0x23')][_0x0f9a('0x78')]({'where':{'id':_0x2fbbb1[_0x0f9a('0x24')]['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x19a84e,null))[_0x0f9a('0x16')](function(_0x3a01cd){if(_0x3a01cd){_0x40327f=_0x3a01cd;_0x34c649['model']=_[_0x0f9a('0x27')](db[_0x0f9a('0x62')][_0x0f9a('0x79')]);_0x34c649['query']=_[_0x0f9a('0x27')](_0x2fbbb1[_0x0f9a('0x20')]);_0x34c649[_0x0f9a('0x7a')]=_[_0x0f9a('0x7b')](_0x34c649[_0x0f9a('0x7c')],_0x34c649[_0x0f9a('0x20')]);_0xf07f42[_0x0f9a('0x7d')]=_[_0x0f9a('0x7b')](_0x34c649['model'],qs[_0x0f9a('0x7e')](_0x2fbbb1['query'][_0x0f9a('0x7e')]));_0xf07f42[_0x0f9a('0x7d')]=_0xf07f42[_0x0f9a('0x7d')]['length']?_0xf07f42[_0x0f9a('0x7d')]:_0x34c649['model'];_0xf07f42[_0x0f9a('0x7f')]=qs[_0x0f9a('0x80')](_0x2fbbb1['query'][_0x0f9a('0x80')]);_0xf07f42[_0x0f9a('0x5a')]=qs[_0x0f9a('0x7a')](_[_0x0f9a('0x81')](_0x2fbbb1[_0x0f9a('0x20')],_0x34c649[_0x0f9a('0x7a')]));if(_0x2fbbb1[_0x0f9a('0x20')][_0x0f9a('0x82')]){_0xf07f42[_0x0f9a('0x5a')]=_['merge'](_0xf07f42[_0x0f9a('0x5a')],{'$or':_['map'](_0xf07f42[_0x0f9a('0x7d')],function(_0x16c0ad){var _0x2943d1={};_0x2943d1[_0x16c0ad]={'$like':'%'+_0x2fbbb1[_0x0f9a('0x20')][_0x0f9a('0x82')]+'%'};return _0x2943d1;})});}_0xf07f42=_['merge']({},_0xf07f42,_0x2fbbb1[_0x0f9a('0x83')]);return _0x40327f[_0x0f9a('0x77')](_0xf07f42);}})['then'](function(_0x28a743){if(_0x28a743){_0x2a08d1=_0x28a743['length'];if(!_0x2fbbb1[_0x0f9a('0x20')][_0x0f9a('0x34')](_0x0f9a('0x84'))){_0xf07f42['limit']=qs[_0x0f9a('0x10')](_0x2fbbb1[_0x0f9a('0x20')][_0x0f9a('0x10')]);_0xf07f42[_0x0f9a('0xe')]=qs[_0x0f9a('0xe')](_0x2fbbb1['query']['offset']);}return _0x40327f[_0x0f9a('0x77')](_0xf07f42);}})[_0x0f9a('0x16')](function(_0x158447){if(_0x158447){return _0x158447?{'count':_0x2a08d1,'rows':_0x158447}:null;}})['then'](respondWithResult(_0x19a84e,null))[_0x0f9a('0x25')](handleError(_0x19a84e,null));};exports[_0x0f9a('0x85')]=function(_0x37c93e,_0x15eb6f){if(_0x37c93e[_0x0f9a('0x36')]['id']){delete _0x37c93e[_0x0f9a('0x36')]['id'];}return db['CmContact'][_0x0f9a('0x78')]({'where':{'id':_0x37c93e['params']['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x15eb6f,null))[_0x0f9a('0x16')](function(_0x3608f6){if(_0x3608f6){return _0x3608f6[_0x0f9a('0x85')](_0x37c93e[_0x0f9a('0x36')]['ids']||[]);}return null;})[_0x0f9a('0x16')](respondWithResult(_0x15eb6f,null))[_0x0f9a('0x25')](handleError(_0x15eb6f,null));};exports[_0x0f9a('0x86')]=function(_0x2425bc,_0x1d51de){var _0x2a4e39=[];_0x2a4e39['push'](addAdditionalPhones(_0x2425bc[_0x0f9a('0x36')]));Promise['all'](_0x2a4e39)[_0x0f9a('0x16')](function(){_0x2a4e39=[];_0x2a4e39[_0x0f9a('0x6c')](deleteCmHopperPhones(_0x2425bc[_0x0f9a('0x36')]['id']));_0x2a4e39[_0x0f9a('0x6c')](addCmHopperPhones(_0x2425bc[_0x0f9a('0x36')]['id']));Promise[_0x0f9a('0x5f')](_0x2a4e39)[_0x0f9a('0x16')](function(){return[0x1];})[_0x0f9a('0x16')](respondWithResult(_0x1d51de,null));});};function addAdditionalPhones(_0x224879){var _0x4b59bb;return new Promise(function(_0x248e23){return db[_0x0f9a('0x49')]['destroy']({'where':{'CmContactId':_0x224879['id']}})[_0x0f9a('0x16')](function(){db[_0x0f9a('0x67')][_0x0f9a('0x1f')]({'raw':!![],'attributes':['id',_0x0f9a('0x87')]})[_0x0f9a('0x16')](function(_0x587c28){var _0x2b15a3=[];for(var _0x56ce86=0x0;_0x56ce86<_0x224879['items']['length'];_0x56ce86++){var _0x394212=_0x224879['item_types']?_[_0x0f9a('0x52')](_0x224879[_0x0f9a('0x88')][_0x56ce86])?'':_0x224879['item_types'][_0x56ce86]:_0x224879['items'][_0x56ce86][_0x0f9a('0x89')]?_0x224879[_0x0f9a('0x8a')][_0x56ce86]['ItemTypeId']:'';var _0x221751=_[_0x0f9a('0x52')](_0x224879[_0x0f9a('0x8a')][_0x56ce86][_0x0f9a('0x8b')])?'':_0x224879['items'][_0x56ce86][_0x0f9a('0x8b')];var _0x4864c0=_0x394212+':'+_0x224879['items'][_0x56ce86][_0x0f9a('0x76')]+'§'+_0x221751;if(_['isNil'](_0x4b59bb))_0x4b59bb=_0x4864c0;else _0x4b59bb+=';'+_0x4864c0;var _0x30eb86=null;var _0x483222=null;if(_0x224879['item_types']){if(!_[_0x0f9a('0x52')](_0x224879[_0x0f9a('0x88')][_0x56ce86])){_0x483222=_['find'](_0x587c28,function(_0x3e9fd7){return _0x3e9fd7['id']===_0x224879['item_types'][_0x56ce86];});if(!_[_0x0f9a('0x52')](_0x483222)){_0x30eb86=_0x483222[_0x0f9a('0x87')];}}}else{if(!_['isNil'](_0x224879[_0x0f9a('0x8a')][_0x56ce86])){_0x483222=_['find'](_0x587c28,function(_0x3b77c7){return _0x3b77c7['id']===_0x224879[_0x0f9a('0x8a')][_0x56ce86][_0x0f9a('0x89')];});if(!_[_0x0f9a('0x52')](_0x483222)){_0x30eb86=_0x56ce86;}}}if(_[_0x0f9a('0x52')](_0x30eb86)){_0x30eb86=0x64;}_0x2b15a3[_0x0f9a('0x6c')](addAdditionalPhone(_0x224879['id'],_0x224879['items'][_0x56ce86][_0x0f9a('0x76')],_0x224879[_0x0f9a('0x88')]?_[_0x0f9a('0x52')](_0x224879[_0x0f9a('0x88')][_0x56ce86])?null:_0x224879[_0x0f9a('0x88')][_0x56ce86]:_0x224879[_0x0f9a('0x8a')][_0x56ce86]['ItemTypeId']?_0x224879[_0x0f9a('0x8a')][_0x56ce86][_0x0f9a('0x89')]:null,_0x30eb86,_0x221751));}Promise['all'](_0x2b15a3)['then'](function(){db[_0x0f9a('0x23')]['update']({'AdditionalPhones':_0x4b59bb},{'where':{'id':_0x224879['id']}})[_0x0f9a('0x16')](function(){_0x248e23(0x1);});});});});});}function addAdditionalPhone(_0x6660c6,_0x162eb8,_0x4b7f1e,_0x137a2b,_0x3a6999){return db[_0x0f9a('0x49')][_0x0f9a('0x61')]({'where':{'CmContactId':_0x6660c6,'item':_0x162eb8}})[_0x0f9a('0x16')](function(_0x2a2fde){if(_0x2a2fde)logger['info'](_0x0f9a('0x8c'),_0x2a2fde);else{db[_0x0f9a('0x49')][_0x0f9a('0x40')]({'CmContactId':_0x6660c6,'item':_0x162eb8,'ItemTypeId':_0x4b7f1e,'OrderBy':_0x137a2b,'ItemClass':_0x0f9a('0x8d'),'description':_0x3a6999});}});}function deleteCmHopperPhones(_0x59fc20){return new Promise(function(_0x4c5f61){return db[_0x0f9a('0x3d')][_0x0f9a('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x59fc20}})[_0x0f9a('0x16')](function(_0x462ac5){db[_0x0f9a('0x8e')][_0x0f9a('0x22')]({'where':{'CmHopperId':{'$in':_[_0x0f9a('0x6d')](_0x462ac5,'id')}}});})[_0x0f9a('0x16')](function(){_0x4c5f61(0x1);});});}function addCmHopperPhones(_0x5c3b50){return new Promise(function(_0x487a8c){return db['CmHopper'][_0x0f9a('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5c3b50}})[_0x0f9a('0x16')](function(_0x32c627){var _0x18fb73=[];_[_0x0f9a('0x6d')](_0x32c627,function(_0x44e451){_0x18fb73[_0x0f9a('0x6c')](createCmHopperPhone(_0x5c3b50,_0x44e451['id']));});Promise[_0x0f9a('0x5f')](_0x18fb73)[_0x0f9a('0x16')](function(){_0x487a8c(0x1);});});});}function createCmHopperPhone(_0x59cad3,_0x53f5db){return new Promise(function(_0x2b79ff){db[_0x0f9a('0x49')][_0x0f9a('0x1f')]({'raw':!![],'attributes':[_0x0f9a('0x8f'),'OrderBy'],'where':{'CmContactId':_0x59cad3,'ItemClass':_0x0f9a('0x8d')},'include':[{'model':db[_0x0f9a('0x67')],'attributes':[_0x0f9a('0x87')],'as':_0x0f9a('0x68')}],'order':[_0x0f9a('0x87'),db[_0x0f9a('0x74')][_0x0f9a('0x69')](_0x0f9a('0x90'))]})[_0x0f9a('0x16')](function(_0x11a611){var _0x3cf9ff=0x1;var _0x8c2318=_['map'](_0x11a611,function(_0x43ce3c){_0x43ce3c['CmHopperId']=_0x53f5db;_0x43ce3c[_0x0f9a('0x76')]=_0x43ce3c['item'];_0x43ce3c['OrderBy']=_0x3cf9ff;delete _0x43ce3c['ItemType.OrderBy'];_0x3cf9ff=_0x3cf9ff+0x1;return _0x43ce3c;});return db[_0x0f9a('0x8e')][_0x0f9a('0x57')](_0x8c2318,{});})['then'](function(){_0x2b79ff(0x1);});});}function insertAdditionalPhones(_0x285f37,_0x2237da){return new Promise(function(_0x17a2ac){var _0x397201=[];for(var _0x4c2a49=0x0;_0x4c2a49<_0x2237da['length'];_0x4c2a49++){var _0x563c8b=_0x2237da[_0x4c2a49];_0x397201['push'](parseContactItemType(_0x563c8b));}Promise[_0x0f9a('0x5f')](_0x397201)[_0x0f9a('0x16')](function(){var _0x4322af={'id':_0x285f37['id'],'items':_0x2237da};return addAdditionalPhones(_0x4322af)[_0x0f9a('0x16')](function(){return addCmHopperPhones(_0x285f37['id']);});})['then'](function(){_0x17a2ac(_0x285f37);});});}function parseContactItemType(_0x3d6de3){return new Promise(function(_0x3e5e08){if(_0x3d6de3[_0x0f9a('0x34')]('ItemTypeId')){_0x3e5e08(_0x3d6de3);}else{return db[_0x0f9a('0x67')][_0x0f9a('0x61')]({'where':{'name':_0x3d6de3['ItemType']}})[_0x0f9a('0x16')](function(_0x4e37ca){if(_[_0x0f9a('0x52')](_0x4e37ca))_0x3d6de3[_0x0f9a('0x89')]=null;else _0x3d6de3['ItemTypeId']=_0x4e37ca['id'];_0x3e5e08(_0x3d6de3);});}});}exports[_0x0f9a('0x91')]=function(_0x570f2d,_0x1aad6c){return db[_0x0f9a('0x49')][_0x0f9a('0x1f')]({'raw':!![],'where':{'CmContactId':_0x570f2d['params']['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x0f9a('0x67')],'as':_0x0f9a('0x68')}],'order':[['OrderBy'],[db[_0x0f9a('0x74')][_0x0f9a('0x69')](_0x0f9a('0x90'))]]})[_0x0f9a('0x16')](function(_0x7745a0){return _0x7745a0;})[_0x0f9a('0x16')](respondWithResult(_0x1aad6c,null))[_0x0f9a('0x25')](handleError(_0x1aad6c,null));};exports[_0x0f9a('0x92')]=function(_0x267c8c,_0x154371){return db[_0x0f9a('0x49')]['findAll']({'raw':!![],'where':{'CmContactId':_0x267c8c['body'][_0x0f9a('0x93')]}})[_0x0f9a('0x16')](function(_0x33bcbc){var _0x25ec26=_['map'](_0x33bcbc,function(_0x1ad912){_0x1ad912[_0x0f9a('0x94')]=_0x267c8c[_0x0f9a('0x36')][_0x0f9a('0x95')];return _0x1ad912;});return db[_0x0f9a('0x49')][_0x0f9a('0x57')](_0x25ec26,{});})[_0x0f9a('0x16')](function(){return addCmHopperPhones(_0x267c8c['body'][_0x0f9a('0x95')]);})[_0x0f9a('0x16')](function(){return['ok'];})[_0x0f9a('0x16')](respondWithResult(_0x154371,null))['catch'](handleError(_0x154371,null));};exports[_0x0f9a('0x96')]=function(_0x780ad9,_0x5d0a2f){var _0x127a49=[];_0x127a49['push'](createCmHopperPhone(_0x780ad9[_0x0f9a('0x36')]['id'],_0x780ad9[_0x0f9a('0x36')][_0x0f9a('0x97')]));Promise[_0x0f9a('0x5f')](_0x127a49)['then'](function(){return[0x1];})['then'](respondWithResult(_0x5d0a2f,null));};exports[_0x0f9a('0x98')]=function(_0x31f9cf,_0x16675b){var _0xc6e3b8={'raw':![],'where':{}};var _0x3b0fce={};var _0x854923={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x31f9cf[_0x0f9a('0x24')]['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x16675b,null))[_0x0f9a('0x16')](function(_0x3a88c8){if(_0x3a88c8){_0x3b0fce[_0x0f9a('0x7c')]=_[_0x0f9a('0x27')](db[_0x0f9a('0x3d')][_0x0f9a('0x79')]);_0x3b0fce[_0x0f9a('0x20')]=_['keys'](_0x31f9cf[_0x0f9a('0x20')]);_0x3b0fce[_0x0f9a('0x7a')]=_['intersection'](_0x3b0fce['model'],_0x3b0fce['query']);_0xc6e3b8[_0x0f9a('0x7d')]=_[_0x0f9a('0x7b')](_0x3b0fce['model'],qs[_0x0f9a('0x7e')](_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0x7e')]));_0xc6e3b8[_0x0f9a('0x7d')]=_0xc6e3b8[_0x0f9a('0x7d')][_0x0f9a('0x28')]?_0xc6e3b8['attributes']:_0x3b0fce[_0x0f9a('0x7c')];if(!_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0x34')]('nolimit')){_0xc6e3b8[_0x0f9a('0x10')]=qs['limit'](_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0x10')]);_0xc6e3b8[_0x0f9a('0xe')]=qs['offset'](_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0xe')]);}_0xc6e3b8[_0x0f9a('0x7f')]=qs[_0x0f9a('0x80')](_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0x80')]);_0xc6e3b8[_0x0f9a('0x5a')]=qs[_0x0f9a('0x7a')](_[_0x0f9a('0x81')](_0x31f9cf[_0x0f9a('0x20')],_0x3b0fce['filters']));_0xc6e3b8['where']['ContactId']=_0x3a88c8['id'];if(_0x31f9cf['query'][_0x0f9a('0x82')]){_0xc6e3b8[_0x0f9a('0x5a')]=_[_0x0f9a('0x35')](_0xc6e3b8[_0x0f9a('0x5a')],{'$or':_[_0x0f9a('0x6d')](_0xc6e3b8[_0x0f9a('0x7d')],function(_0x42ad6e){var _0x461039={};_0x461039[_0x42ad6e]={'$like':'%'+_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0x82')]+'%'};return _0x461039;})});}_0xc6e3b8=_[_0x0f9a('0x35')]({},_0xc6e3b8,_0x31f9cf[_0x0f9a('0x83')]);return db[_0x0f9a('0x3d')][_0x0f9a('0x11')]({'where':_0xc6e3b8[_0x0f9a('0x5a')]})[_0x0f9a('0x16')](function(_0x440a8c){_0x854923[_0x0f9a('0x11')]=_0x440a8c;if(_0x31f9cf[_0x0f9a('0x20')][_0x0f9a('0x99')]){_0xc6e3b8[_0x0f9a('0x9a')]=[{'all':!![]}];}return db['CmHopper'][_0x0f9a('0x1f')](_0xc6e3b8);})[_0x0f9a('0x16')](function(_0x47f11c){_0x854923[_0x0f9a('0x9b')]=_0x47f11c;return _0x854923;});}})[_0x0f9a('0x16')](respondWithFilteredResult(_0x16675b,_0xc6e3b8))[_0x0f9a('0x25')](handleError(_0x16675b,null));};exports[_0x0f9a('0x9c')]=function(_0x183dc1,_0x3d3948){var _0x3b2739={'raw':!![],'where':{}};var _0x3fb488={};var _0x343842={'count':0x0,'rows':[]};return db[_0x0f9a('0x23')][_0x0f9a('0x78')]({'where':{'id':_0x183dc1[_0x0f9a('0x24')]['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x3d3948,null))['then'](function(_0x19b0d1){if(_0x19b0d1){_0x3fb488['model']=_['keys'](db[_0x0f9a('0x4b')][_0x0f9a('0x79')]);_0x3fb488['query']=_[_0x0f9a('0x27')](_0x183dc1[_0x0f9a('0x20')]);_0x3fb488[_0x0f9a('0x7a')]=_[_0x0f9a('0x7b')](_0x3fb488[_0x0f9a('0x7c')],_0x3fb488[_0x0f9a('0x20')]);_0x3b2739[_0x0f9a('0x7d')]=_[_0x0f9a('0x7b')](_0x3fb488['model'],qs[_0x0f9a('0x7e')](_0x183dc1[_0x0f9a('0x20')][_0x0f9a('0x7e')]));_0x3b2739[_0x0f9a('0x7d')]=_0x3b2739[_0x0f9a('0x7d')]['length']?_0x3b2739[_0x0f9a('0x7d')]:_0x3fb488[_0x0f9a('0x7c')];if(!_0x183dc1[_0x0f9a('0x20')][_0x0f9a('0x34')]('nolimit')){_0x3b2739['limit']=qs['limit'](_0x183dc1['query'][_0x0f9a('0x10')]);_0x3b2739['offset']=qs['offset'](_0x183dc1[_0x0f9a('0x20')][_0x0f9a('0xe')]);}_0x3b2739[_0x0f9a('0x7f')]=qs[_0x0f9a('0x80')](_0x183dc1[_0x0f9a('0x20')][_0x0f9a('0x80')]);_0x3b2739[_0x0f9a('0x5a')]=qs[_0x0f9a('0x7a')](_['pick'](_0x183dc1[_0x0f9a('0x20')],_0x3fb488['filters']));_0x3b2739[_0x0f9a('0x5a')][_0x0f9a('0x9d')]=_0x19b0d1['id'];if(_0x183dc1[_0x0f9a('0x20')][_0x0f9a('0x82')]){_0x3b2739[_0x0f9a('0x5a')]=_[_0x0f9a('0x35')](_0x3b2739[_0x0f9a('0x5a')],{'$or':_[_0x0f9a('0x6d')](_0x3b2739[_0x0f9a('0x7d')],function(_0x4fe552){var _0x5788a7={};_0x5788a7[_0x4fe552]={'$like':'%'+_0x183dc1['query'][_0x0f9a('0x82')]+'%'};return _0x5788a7;})});}_0x3b2739=_[_0x0f9a('0x35')]({},_0x3b2739,_0x183dc1[_0x0f9a('0x83')]);return db[_0x0f9a('0x4b')]['count']({'where':_0x3b2739[_0x0f9a('0x5a')]})[_0x0f9a('0x16')](function(_0x1196a3){_0x343842['count']=_0x1196a3;if(_0x183dc1[_0x0f9a('0x20')][_0x0f9a('0x99')]){_0x3b2739[_0x0f9a('0x9a')]=[{'all':!![]}];}return db[_0x0f9a('0x4b')]['findAll'](_0x3b2739);})[_0x0f9a('0x16')](function(_0x1571db){_0x343842[_0x0f9a('0x9b')]=_0x1571db;return _0x343842;});}})[_0x0f9a('0x16')](respondWithFilteredResult(_0x3d3948,_0x3b2739))[_0x0f9a('0x25')](handleError(_0x3d3948,null));};exports['getHopperFinals']=function(_0x283f5e,_0x112863){var _0x444333={'raw':!![],'where':{}};var _0x429329={};var _0x537cb7={'count':0x0,'rows':[]};return db['CmContact'][_0x0f9a('0x78')]({'where':{'id':_0x283f5e[_0x0f9a('0x24')]['id']}})[_0x0f9a('0x16')](handleEntityNotFound(_0x112863,null))[_0x0f9a('0x16')](function(_0x454aba){if(_0x454aba){_0x429329[_0x0f9a('0x7c')]=_[_0x0f9a('0x27')](db[_0x0f9a('0x4a')][_0x0f9a('0x79')]);_0x429329[_0x0f9a('0x20')]=_[_0x0f9a('0x27')](_0x283f5e['query']);_0x429329['filters']=_['intersection'](_0x429329[_0x0f9a('0x7c')],_0x429329[_0x0f9a('0x20')]);_0x444333[_0x0f9a('0x7d')]=_[_0x0f9a('0x7b')](_0x429329[_0x0f9a('0x7c')],qs[_0x0f9a('0x7e')](_0x283f5e['query'][_0x0f9a('0x7e')]));_0x444333[_0x0f9a('0x7d')]=_0x444333[_0x0f9a('0x7d')][_0x0f9a('0x28')]?_0x444333[_0x0f9a('0x7d')]:_0x429329['model'];if(!_0x283f5e[_0x0f9a('0x20')]['hasOwnProperty']('nolimit')){_0x444333[_0x0f9a('0x10')]=qs[_0x0f9a('0x10')](_0x283f5e[_0x0f9a('0x20')][_0x0f9a('0x10')]);_0x444333[_0x0f9a('0xe')]=qs['offset'](_0x283f5e[_0x0f9a('0x20')][_0x0f9a('0xe')]);}_0x444333[_0x0f9a('0x7f')]=qs[_0x0f9a('0x80')](_0x283f5e[_0x0f9a('0x20')]['sort']);_0x444333[_0x0f9a('0x5a')]=qs[_0x0f9a('0x7a')](_[_0x0f9a('0x81')](_0x283f5e[_0x0f9a('0x20')],_0x429329[_0x0f9a('0x7a')]));_0x444333[_0x0f9a('0x5a')][_0x0f9a('0x9d')]=_0x454aba['id'];if(_0x283f5e[_0x0f9a('0x20')]['filter']){_0x444333[_0x0f9a('0x5a')]=_['merge'](_0x444333[_0x0f9a('0x5a')],{'$or':_[_0x0f9a('0x6d')](_0x444333[_0x0f9a('0x7d')],function(_0x53a21f){var _0x5c05df={};_0x5c05df[_0x53a21f]={'$like':'%'+_0x283f5e[_0x0f9a('0x20')][_0x0f9a('0x82')]+'%'};return _0x5c05df;})});}_0x444333=_[_0x0f9a('0x35')]({},_0x444333,_0x283f5e['options']);return db[_0x0f9a('0x4a')]['count']({'where':_0x444333[_0x0f9a('0x5a')]})['then'](function(_0x2c609a){_0x537cb7[_0x0f9a('0x11')]=_0x2c609a;if(_0x283f5e[_0x0f9a('0x20')][_0x0f9a('0x99')]){_0x444333['include']=[{'all':!![]}];}return db[_0x0f9a('0x4a')][_0x0f9a('0x1f')](_0x444333);})[_0x0f9a('0x16')](function(_0x29f0a9){_0x537cb7[_0x0f9a('0x9b')]=_0x29f0a9;return _0x537cb7;});}})[_0x0f9a('0x16')](respondWithFilteredResult(_0x112863,_0x444333))[_0x0f9a('0x25')](handleError(_0x112863,null));};exports[_0x0f9a('0x9e')]=function(_0x488126,_0x5c4ee9){var _0x358dd6={'raw':!![],'where':{}};var _0x401506={};var _0x125f71={'count':0x0,'rows':[]};return db[_0x0f9a('0x23')][_0x0f9a('0x78')]({'where':{'id':_0x488126[_0x0f9a('0x24')]['id']}})['then'](handleEntityNotFound(_0x5c4ee9,null))[_0x0f9a('0x16')](function(_0x5c4c4d){if(_0x5c4c4d){_0x401506[_0x0f9a('0x7c')]=_[_0x0f9a('0x27')](db[_0x0f9a('0x4e')][_0x0f9a('0x79')]);_0x401506[_0x0f9a('0x20')]=_['keys'](_0x488126[_0x0f9a('0x20')]);_0x401506[_0x0f9a('0x7a')]=_[_0x0f9a('0x7b')](_0x401506['model'],_0x401506['query']);_0x358dd6['attributes']=_[_0x0f9a('0x7b')](_0x401506[_0x0f9a('0x7c')],qs[_0x0f9a('0x7e')](_0x488126['query'][_0x0f9a('0x7e')]));_0x358dd6[_0x0f9a('0x7d')]=_0x358dd6[_0x0f9a('0x7d')][_0x0f9a('0x28')]?_0x358dd6[_0x0f9a('0x7d')]:_0x401506[_0x0f9a('0x7c')];if(!_0x488126['query']['hasOwnProperty'](_0x0f9a('0x84'))){_0x358dd6[_0x0f9a('0x10')]=qs[_0x0f9a('0x10')](_0x488126['query']['limit']);_0x358dd6[_0x0f9a('0xe')]=qs[_0x0f9a('0xe')](_0x488126[_0x0f9a('0x20')][_0x0f9a('0xe')]);}_0x358dd6['order']=qs[_0x0f9a('0x80')](_0x488126[_0x0f9a('0x20')]['sort']);_0x358dd6[_0x0f9a('0x5a')]=qs[_0x0f9a('0x7a')](_['pick'](_0x488126['query'],_0x401506[_0x0f9a('0x7a')]));_0x358dd6[_0x0f9a('0x5a')]['ContactId']=_0x5c4c4d['id'];if(_0x488126['query'][_0x0f9a('0x82')]){_0x358dd6[_0x0f9a('0x5a')]=_[_0x0f9a('0x35')](_0x358dd6[_0x0f9a('0x5a')],{'$or':_[_0x0f9a('0x6d')](_0x358dd6[_0x0f9a('0x7d')],function(_0x32c636){var _0xbe6f57={};_0xbe6f57[_0x32c636]={'$like':'%'+_0x488126['query']['filter']+'%'};return _0xbe6f57;})});}_0x358dd6=_[_0x0f9a('0x35')]({},_0x358dd6,_0x488126[_0x0f9a('0x83')]);return db[_0x0f9a('0x4e')]['count']({'where':_0x358dd6[_0x0f9a('0x5a')]})[_0x0f9a('0x16')](function(_0x59226e){_0x125f71[_0x0f9a('0x11')]=_0x59226e;if(_0x488126['query'][_0x0f9a('0x99')]){_0x358dd6['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x358dd6);})[_0x0f9a('0x16')](function(_0x530527){_0x125f71['rows']=_0x530527;return _0x125f71;});}})[_0x0f9a('0x16')](respondWithFilteredResult(_0x5c4ee9,_0x358dd6))['catch'](handleError(_0x5c4ee9,null));};exports['uploadCsv']=function(_0x3922ea,_0x4beb39){try{if(!_0x3922ea['body'][_0x0f9a('0x5b')]){throw new Error(_0x0f9a('0x9f'));}if(!_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0xa0')]){throw new Error(_0x0f9a('0xa1'));}if(!_0x3922ea['body'][_0x0f9a('0xa2')]){throw new Error(_0x0f9a('0xa3'));}if(!_0x3922ea[_0x0f9a('0x36')]['socket_timestamp']){throw new Error(_0x0f9a('0xa4'));}var _0x3c767b=_0x3922ea['body'][_0x0f9a('0xa0')][_0x0f9a('0xa5')](',');var _0x48b5c8=_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0xa2')][_0x0f9a('0xa5')](',');if(!_0x3c767b[_0x0f9a('0x28')]||!_0x48b5c8[_0x0f9a('0x28')]||_0x3c767b['length']!==_0x48b5c8['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0x7e')]=_[_0x0f9a('0xa6')](_0x3c767b,_0x48b5c8);if(!_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0x7e')][_0x0f9a('0x76')]){throw new Error(_0x0f9a('0xa7'));}if(!_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0x7e')]['firstName']){throw new Error(_0x0f9a('0xa8'));}var _0x1d9880=path[_0x0f9a('0x3b')](config[_0x0f9a('0xa9')],'server/files/tmp',_0x3922ea['file'][_0x0f9a('0xaa')]);fs[_0x0f9a('0xab')](_0x1d9880,parseInt(_0x0f9a('0xac'),0x8));var _0x2f176e=require('child_process')['fork'](path[_0x0f9a('0x3b')](__dirname,_0x0f9a('0xad')),[_0x1d9880,_0x3922ea['body'][_0x0f9a('0xa0')],_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0xa2')],_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0x5b')],_0x3922ea[_0x0f9a('0x36')][_0x0f9a('0xae')],_0x3922ea['body'][_0x0f9a('0x59')],_0x3922ea['body'][_0x0f9a('0xaf')]]);return _0x4beb39[_0x0f9a('0x12')](0xc8)[_0x0f9a('0x14')]({'message':_0x0f9a('0xb0'),'pid':_0x2f176e[_0x0f9a('0xb1')]});}catch(_0x28f74e){return _0x4beb39[_0x0f9a('0x12')](0x1f4)[_0x0f9a('0x1b')](_0x28f74e);}};exports[_0x0f9a('0xb2')]=function(_0x3734b6,_0x544742){var _0x42353e=fs[_0x0f9a('0xb3')](_0x3734b6['file']['path']);Papa['parse'](_0x42353e,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4b1c3d){return _0x544742[_0x0f9a('0x12')](0xc8)[_0x0f9a('0x14')]({'file':_0x3734b6['file'],'fields':_0x4b1c3d['meta'][_0x0f9a('0x7e')]});}});};exports[_0x0f9a('0xb4')]=function(_0xaadd9e,_0x1bc2e2){return db['User'][_0x0f9a('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x0f9a('0x16')](function(_0x390b70){var _0xb7558f=![];if(!_0xaadd9e[_0x0f9a('0x36')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0xaadd9e[_0x0f9a('0x36')]['binding'][_0x0f9a('0x76')]){throw new Error(_0x0f9a('0xa7'));}if(!_0xaadd9e[_0x0f9a('0x36')][_0x0f9a('0xb5')]['firstName']){throw new Error(_0x0f9a('0xa8'));}if(!_0xaadd9e['body'][_0x0f9a('0xaf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x202b87=require(_0x0f9a('0xb6'))['fork'](path['join'](__dirname,_0x0f9a('0xb7')),[_0xaadd9e['params']['id'],JSON['stringify'](_0xaadd9e[_0x0f9a('0x36')]),JSON['stringify'](_0x390b70)]);_0x202b87['on']('message',function(){_0xb7558f=!![];return _0x1bc2e2[_0x0f9a('0x12')](0xc8)[_0x0f9a('0x14')]({'message':_0x0f9a('0xb8'),'pid':_0x202b87[_0x0f9a('0xb1')]});});_0x202b87['on'](_0x0f9a('0xb9'),function(_0x196c81){if(_0x196c81&&!_0xb7558f){return _0x1bc2e2['status'](0x1f4)[_0x0f9a('0x14')]({'message':_0x0f9a('0xba'),'pid':_0x202b87[_0x0f9a('0xb1')]});}});})[_0x0f9a('0x25')](handleError(_0x1bc2e2,null));};exports[_0x0f9a('0xbb')]=function(_0x40875c,_0x51bd28){return db[_0x0f9a('0xbc')][_0x0f9a('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x0f9a('0x16')](function(_0x17b9bc){var _0x1a61fa=![];if(!_0x40875c['body'][_0x0f9a('0x5b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x40875c[_0x0f9a('0x36')]['binding']['phone']){throw new Error(_0x0f9a('0xa7'));}if(!_0x40875c[_0x0f9a('0x36')]['binding'][_0x0f9a('0xbd')]){throw new Error(_0x0f9a('0xa8'));}if(!_0x40875c[_0x0f9a('0x36')][_0x0f9a('0xaf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5e21d9=require(_0x0f9a('0xb6'))[_0x0f9a('0xbe')](path[_0x0f9a('0x3b')](__dirname,_0x0f9a('0xbf')),[_0x40875c[_0x0f9a('0x24')]['id'],JSON[_0x0f9a('0xc0')](_0x40875c[_0x0f9a('0x36')]),JSON[_0x0f9a('0xc0')](_0x17b9bc)]);_0x5e21d9['on'](_0x0f9a('0xc1'),function(){_0x1a61fa=!![];return _0x51bd28[_0x0f9a('0x12')](0xc8)[_0x0f9a('0x14')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x5e21d9['pid']});});_0x5e21d9['on'](_0x0f9a('0xb9'),function(_0x30df28){if(_0x30df28&&!_0x1a61fa){return _0x51bd28[_0x0f9a('0x12')](0x1f4)['json']({'message':_0x0f9a('0xba'),'pid':_0x5e21d9[_0x0f9a('0xb1')]});}});})[_0x0f9a('0x25')](handleError(_0x51bd28,null));};exports['getJourney']=function(_0x49a61b,_0x289a40){var _0x3ddce1=[_0x0f9a('0xc2'),_0x0f9a('0xc3'),'sms',_0x0f9a('0xc4'),_0x0f9a('0xc5'),_0x0f9a('0xc6'),_0x0f9a('0xc7')];var _0x13b6c5={'offset':0x0,'order':qs['sort'](_0x0f9a('0xc8'))},_0x4b99e7={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x49a61b['query'][_0x0f9a('0xc9')]){if(!_[_0x0f9a('0xca')](_0x3ddce1,_0x49a61b['query'][_0x0f9a('0xc9')]['toLowerCase']())){throw new Error(_0x0f9a('0xcb'));}_0x3ddce1=[_0x49a61b[_0x0f9a('0x20')][_0x0f9a('0xc9')][_0x0f9a('0xcc')]()];}if(_0x49a61b[_0x0f9a('0x20')][_0x0f9a('0xcd')]){try{var _0x29ec38=JSON[_0x0f9a('0xce')](_0x49a61b[_0x0f9a('0x20')]['range']);if(!moment(_0x29ec38[_0x0f9a('0x37')])['isValid']()){throw new Error(_0x0f9a('0xcf'));}if(!moment(_0x29ec38['to'])['isValid']()){throw new Error(_0x0f9a('0xd0'));}}catch(_0x27c101){throw new Error(_0x0f9a('0xd1'));}}if(!_0x49a61b[_0x0f9a('0x20')]['hasOwnProperty'](_0x0f9a('0x84'))){_0x13b6c5[_0x0f9a('0x10')]=qs[_0x0f9a('0x10')](_0x49a61b[_0x0f9a('0x20')]['limit']||0xa);_0x13b6c5[_0x0f9a('0xe')]=qs['offset'](_0x49a61b['query'][_0x0f9a('0xe')]);}var _0x240b23=_0x3ddce1[_0x0f9a('0x6d')](function(_0x680c95){if(_0x680c95==='voice'){var _0x1830b5={'attributes':['id',_0x0f9a('0xd2'),_0x0f9a('0xd3'),_0x0f9a('0xd4'),_0x0f9a('0xd5'),_0x0f9a('0xd6'),_0x0f9a('0xd7'),'endtime','duration',_0x0f9a('0xd8'),_0x0f9a('0xd9'),_0x0f9a('0xda'),'userSecondDisposition',_0x0f9a('0xdb'),_0x0f9a('0xdc')],'where':{'ContactId':_0x49a61b[_0x0f9a('0x24')]['id']},'include':[{'model':db[_0x0f9a('0xbc')],'as':_0x0f9a('0xbc'),'attributes':['id',_0x0f9a('0x1a'),'fullname',_0x0f9a('0x2f')]}],'order':[[_0x0f9a('0xd9'),_0x0f9a('0xdd')]]};if(_0x49a61b[_0x0f9a('0x20')][_0x0f9a('0xcd')]){_0x1830b5[_0x0f9a('0x5a')]['createdAt']={'$gte':_0x29ec38[_0x0f9a('0x37')],'$lte':_0x29ec38['to']};}return db[_0x0f9a('0x4c')][_0x0f9a('0xde')](_0x1830b5)[_0x0f9a('0x16')](function(_0x2d29fe){_0x4b99e7[_0x0f9a('0x11')]+=_0x2d29fe[_0x0f9a('0x11')];return _['map'](_0x2d29fe['rows'],function(_0x5d88d6){var _0x49becb=_0x5d88d6[_0x0f9a('0x38')]({'plain':!![]});_0x49becb[_0x0f9a('0xc9')]=_0x680c95;if(_0x49becb['User']){_0x49becb['User']={'id':_0x49becb[_0x0f9a('0xbc')]['id'],'name':_0x49becb[_0x0f9a('0xbc')][_0x0f9a('0x1a')],'fullname':_0x49becb[_0x0f9a('0xbc')][_0x0f9a('0xdf')],'alias':_0x49becb[_0x0f9a('0xbc')][_0x0f9a('0x2f')]};}return _0x49becb;});});}else{var _0x5b7063=_[_0x0f9a('0xe0')](_0x680c95)+(_0x680c95===_0x0f9a('0xc3')?_0x0f9a('0xe1'):'Account');var _0x218856={'attributes':['id',_0x0f9a('0xe2'),_0x0f9a('0xe3'),_0x0f9a('0xd9'),_0x0f9a('0xd8'),_0x0f9a('0xe4'),_0x0f9a('0xe5'),_0x0f9a('0xe6'),_0x0f9a('0xdc'),_0x5b7063+'Id'],'where':{'ContactId':_0x49a61b['params']['id']},'include':[{'model':db[_0x5b7063],'as':_0x0f9a('0xe7'),'attributes':['id',_0x0f9a('0x1a'),_0x0f9a('0xe8')]},{'model':db['User'],'as':'Owner','attributes':['id',_0x0f9a('0x1a'),_0x0f9a('0xdf')]},{'model':db['Tag'],'as':_0x0f9a('0x63'),'attributes':['id',_0x0f9a('0x1a'),_0x0f9a('0x64')],'through':{'attributes':[]}}],'order':[['createdAt',_0x0f9a('0xdd')]]};if(_0x49a61b[_0x0f9a('0x20')][_0x0f9a('0xcd')]){_0x218856[_0x0f9a('0x5a')][_0x0f9a('0xd9')]={'$gte':_0x29ec38[_0x0f9a('0x37')],'$lte':_0x29ec38['to']};}switch(_0x680c95){case _0x0f9a('0xc3'):_0x218856['attributes'][_0x0f9a('0x6c')](_0x0f9a('0xe9'),'customerIp',_0x0f9a('0xea'),_0x0f9a('0xeb'),_0x0f9a('0xec'),_0x0f9a('0xed'),_0x0f9a('0xee'),'ratingValue',_0x0f9a('0xef'));break;case'mail':_0x218856[_0x0f9a('0x7d')][_0x0f9a('0x6c')](_0x0f9a('0xf0'),_0x0f9a('0xf1'));break;case _0x0f9a('0xc4'):_0x218856[_0x0f9a('0x7d')]['push']('externalUrl',_0x0f9a('0xf2'));break;}return db[_[_0x0f9a('0xe0')](_0x680c95)+_0x0f9a('0xf3')]['findAndCountAll'](_0x218856)['then'](function(_0x4cb984){_0x4b99e7[_0x0f9a('0x11')]+=_0x4cb984[_0x0f9a('0x11')];return _['map'](_0x4cb984['rows'],function(_0x4efddf){var _0x1716df=_0x4efddf[_0x0f9a('0x38')]({'plain':!![]});_0x1716df['channel']=_0x680c95;if(_0x1716df[_0x0f9a('0xf4')]){_0x1716df[_0x0f9a('0xf4')]={'id':_0x1716df[_0x0f9a('0xf4')]['id'],'name':_0x1716df['Owner'][_0x0f9a('0x1a')],'fullname':_0x1716df[_0x0f9a('0xf4')][_0x0f9a('0xdf')]};}return _0x1716df;});});}});return Promise['all'](_0x240b23);})['then'](function(_0x5bea9f){return _(_0x5bea9f)[_0x0f9a('0xf5')]()[_0x0f9a('0xf6')](_0x0f9a('0xd9'))['reverse']()[_0x0f9a('0xf7')]();})[_0x0f9a('0x16')](function(_0x10cbb0){_0x4b99e7[_0x0f9a('0x9b')]=_0x13b6c5[_0x0f9a('0x10')]?_0x10cbb0[_0x0f9a('0xf8')](_0x13b6c5[_0x0f9a('0xe')],_0x13b6c5['offset']+_0x13b6c5[_0x0f9a('0x10')]):_0x10cbb0;return _0x4b99e7;})[_0x0f9a('0x16')](respondWithFilteredResult(_0x289a40,_0x13b6c5))['catch'](handleError(_0x289a40,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index a9cbcb8..d2c10fc 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 _0x5070=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x29c42c,_0x12a918){var _0x5ea3db=function(_0x45424e){while(--_0x45424e){_0x29c42c['push'](_0x29c42c['shift']());}};_0x5ea3db(++_0x12a918);}(_0x5070,0xb0));var _0x0507=function(_0x3905ed,_0x5350e3){_0x3905ed=_0x3905ed-0x0;var _0x33e9ea=_0x5070[_0x3905ed];return _0x33e9ea;};'use strict';var EventEmitter=require(_0x0507('0x0'));var CmContact=require(_0x0507('0x1'))['db'][_0x0507('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0507('0x3')](0x0);var events={'afterCreate':_0x0507('0x4'),'afterUpdate':_0x0507('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b4a21){return function(_0x34422a,_0xa9ab66,_0x44f8d5){CmContactEvents['emit'](_0x5b4a21+':'+_0x34422a['id'],_0x34422a);CmContactEvents[_0x0507('0x6')](_0x5b4a21,_0x34422a);_0x44f8d5(null);};}for(var e in events){if(events[_0x0507('0x7')](e)){var event=events[e];CmContact[_0x0507('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x2e72=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x3dc53b,_0x5271aa){var _0xe99dcb=function(_0x2244e9){while(--_0x2244e9){_0x3dc53b['push'](_0x3dc53b['shift']());}};_0xe99dcb(++_0x5271aa);}(_0x2e72,0x19a));var _0x22e7=function(_0x218756,_0x419c39){_0x218756=_0x218756-0x0;var _0x1b90ec=_0x2e72[_0x218756];return _0x1b90ec;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x22e7('0x0'))['db'][_0x22e7('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x22e7('0x2')](0x0);var events={'afterCreate':_0x22e7('0x3'),'afterUpdate':'update','afterDestroy':_0x22e7('0x4')};function emitEvent(_0x5a2e78){return function(_0x5ccc97,_0x326f17,_0x54bfdd){CmContactEvents['emit'](_0x5a2e78+':'+_0x5ccc97['id'],_0x5ccc97);CmContactEvents[_0x22e7('0x5')](_0x5a2e78,_0x5ccc97);_0x54bfdd(null);};}for(var e in events){if(events[_0x22e7('0x6')](e)){var event=events[e];CmContact[_0x22e7('0x7')](e,emitEvent(event));}}module[_0x22e7('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index cb1978a..a846b00 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 _0x4db2=['create','error','cmContact','afterCreate','Campaign','timezones','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','CmHopperBlack','message','ContactId','VoiceQueueId','CampaignId','all','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','ListId','priority','callbackUniqueid','CmHopperFinal'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4db2,0xab));var _0x24db=function(_0x1058ed,_0x109d8d){_0x1058ed=_0x1058ed-0x0;var _0x4e4661=_0x4db2[_0x1058ed];return _0x4e4661;};'use strict';var _=require(_0x24db('0x0'));var util=require(_0x24db('0x1'));var logger=require(_0x24db('0x2'))(_0x24db('0x3'));var moment=require(_0x24db('0x4'));var BPromise=require(_0x24db('0x5'));var rp=require(_0x24db('0x6'));var fs=require('fs');var path=require(_0x24db('0x7'));var rimraf=require(_0x24db('0x8'));var config=require(_0x24db('0x9'));var shared=require(_0x24db('0xa'));var attributes=require(_0x24db('0xb'));module['exports']=function(_0x238749,_0x3b5d78){return _0x238749[_0x24db('0xc')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x24db('0xd'),'fields':[_0x24db('0xd')]},{'name':_0x24db('0xe'),'fields':[_0x24db('0xf'),'lastName',_0x24db('0xd'),_0x24db('0x10'),_0x24db('0x11'),_0x24db('0x12')],'type':_0x24db('0x13')}],'timestamps':!![],'charset':_0x24db('0x14'),'collate':_0x24db('0x15'),'hooks':{'afterCreate':function(_0x201e0e,_0xfd1a13,_0x13a633){var _0x39802f=_0x238749[_0x24db('0x16')];var _0x1d13a6=_0x201e0e['get']({'plain':!![]});function _0x4b0689(){return function(_0x3bb167){logger['error']('cmContact','afterCreate',util[_0x24db('0x17')](_0x3bb167,{'showHidden':![],'depth':null}));};}function _0x4f8d6c(_0x2e8501,_0xb66f29){var _0x2cbb5d=_0xb66f29[_0x24db('0x18')]?_0xb66f29[_0x24db('0x18')]:moment()[_0x24db('0x19')](_0x24db('0x1a'));return new BPromise(function(_0x46a514,_0x42244d){if(_[_0x24db('0x1b')](_0xb66f29[_0x24db('0x1c')])){_0x46a514({'ret':_0x2cbb5d});}else{_0x39802f[_0x24db('0x1d')][_0x24db('0x1e')]({'where':{'id':_0x2e8501['id']}})[_0x24db('0x1f')](function(_0xb9758e){if(!_[_0x24db('0x1b')](_0xb9758e)){var _0x103596=_0xb9758e[_0x24db('0x1c')];if(!_[_0x24db('0x1b')](_0x103596)){var _0x2408f8=shared['timezones'];var _0x481ccb=_0x2408f8[_0x103596];var _0x579533=_0x2408f8[_0xb66f29[_0x24db('0x1c')]];if(!_[_0x24db('0x1b')](_0x481ccb)&&!_['isNil'](_0x579533)){var _0x212712=_0x481ccb['utcOffset']-_0x579533[_0x24db('0x20')];_0x2cbb5d=_0xb66f29[_0x24db('0x18')]?_0xb66f29[_0x24db('0x18')]:moment();var _0x33f908=moment(_0x2cbb5d)['add'](_0x212712,_0x24db('0x21'));_0x46a514({'ret':_0x33f908[_0x24db('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x46a514({'ret':_0x2cbb5d});}else _0x46a514({'ret':_0x2cbb5d});}else{_0x46a514({'ret':_0x2cbb5d});}});}});return 0xa;}var _0x495905=function(_0x444fd3){return new BPromise(function(_0x4cd074,_0x3d31a8){_0x4f8d6c(_0x444fd3,_0x1d13a6)[_0x24db('0x1f')](function(_0x21daf8){_0x1d13a6['scheduledat']=_0x21daf8[_0x24db('0x22')];_0x39802f['CmHopper']['findOne']({'where':{'phone':_0x1d13a6[_0x24db('0xd')],'VoiceQueueId':_0x444fd3['id']}})[_0x24db('0x1f')](function(_0x298200){if(!_['isNil'](_0x298200)){throw new Error(_0x24db('0x23')+_0x1d13a6[_0x24db('0xd')]+_0x24db('0x24')+_0x444fd3['id']);}return _0x39802f[_0x24db('0x25')]['create']({'phone':_0x1d13a6['phone'],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'priority':_0x1d13a6[_0x24db('0x27')]?_0x1d13a6[_0x24db('0x27')]:0x2,'scheduledat':_0x1d13a6['scheduledat']?_0x1d13a6['scheduledat']:moment()['format'](_0x24db('0x1a')),'callback':_0x1d13a6[_0x24db('0x28')]?!![]:![],'callbackuniqueid':_0x1d13a6['callbackUniqueid']?_0x1d13a6[_0x24db('0x28')]:undefined,'callbackat':_0x1d13a6[_0x24db('0x28')]?moment()[_0x24db('0x19')](_0x24db('0x1a')):undefined,'VoiceQueueId':_0x444fd3['id']});})['catch'](function(_0x4dd720){_0x3d31a8(_0x4dd720);});});});};var _0x347a6a=function(_0x37a1c2){return new BPromise(function(_0x42958e,_0x55eafa){_0x4f8d6c(_0x37a1c2,_0x1d13a6)[_0x24db('0x1f')](function(_0x456070){_0x1d13a6[_0x24db('0x18')]=_0x456070['ret'];_0x39802f[_0x24db('0x25')][_0x24db('0x1e')]({'where':{'phone':_0x1d13a6[_0x24db('0xd')],'VoiceQueueId':_0x37a1c2['id']}})['then'](function(_0x5f582f){if(!_[_0x24db('0x1b')](_0x5f582f)){throw new Error(_0x24db('0x23')+_0x1d13a6[_0x24db('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x37a1c2['id']);}return _0x39802f[_0x24db('0x29')]['findOne']({'where':{'calleridnum':_0x1d13a6['phone'],'VoiceQueueId':_0x37a1c2['id']}});})[_0x24db('0x1f')](function(_0x2300ae){if(!_['isNil'](_0x2300ae)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1d13a6[_0x24db('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x37a1c2['id']);}return _0x39802f['CmHopper'][_0x24db('0x2a')]({'phone':_0x1d13a6[_0x24db('0xd')],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'priority':_0x1d13a6[_0x24db('0x27')]?_0x1d13a6[_0x24db('0x27')]:0x2,'scheduledat':_0x1d13a6['scheduledat']?_0x1d13a6['scheduledat']:moment()[_0x24db('0x19')](_0x24db('0x1a')),'callback':_0x1d13a6[_0x24db('0x28')]?!![]:![],'callbackuniqueid':_0x1d13a6['callbackUniqueid']?_0x1d13a6[_0x24db('0x28')]:undefined,'callbackat':_0x1d13a6[_0x24db('0x28')]?moment()['format'](_0x24db('0x1a')):undefined,'VoiceQueueId':_0x37a1c2['id']});})['catch'](function(_0x1406f4){_0x55eafa(_0x1406f4);});});});};function _0x42fb17(){return function(_0xa20e2e){logger[_0x24db('0x2b')](_0x24db('0x2c'),_0x24db('0x2d'),util[_0x24db('0x17')](_0xa20e2e,{'showHidden':![],'depth':null}));};}function _0xb17830(_0x32dca4,_0x58ab12){var _0x2990df=_0x58ab12[_0x24db('0x18')]?_0x58ab12[_0x24db('0x18')]:moment()[_0x24db('0x19')](_0x24db('0x1a'));return new BPromise(function(_0x2c50d1,_0x7a19e6){if(_[_0x24db('0x1b')](_0x58ab12[_0x24db('0x1c')])){_0x2c50d1({'ret':_0x2990df});}else{_0x39802f[_0x24db('0x2e')][_0x24db('0x1e')]({'where':{'id':_0x32dca4['id']}})[_0x24db('0x1f')](function(_0x3ead7e){if(!_[_0x24db('0x1b')](_0x3ead7e)){var _0x680faa=_0x3ead7e[_0x24db('0x1c')];if(!_[_0x24db('0x1b')](_0x680faa)){var _0x4b5368=shared[_0x24db('0x2f')];var _0x4c3898=_0x4b5368[_0x680faa];var _0x4b5b8d=_0x4b5368[_0x58ab12['dialTimezone']];if(!_[_0x24db('0x1b')](_0x4c3898)&&!_[_0x24db('0x1b')](_0x4b5b8d)){var _0x2df751=_0x4c3898[_0x24db('0x20')]-_0x4b5b8d[_0x24db('0x20')];_0x2990df=_0x58ab12['scheduledat']?_0x58ab12['scheduledat']:moment();var _0x44a21f=moment(_0x2990df)[_0x24db('0x30')](_0x2df751,_0x24db('0x21'));_0x2c50d1({'ret':_0x44a21f[_0x24db('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2c50d1({'ret':_0x2990df});}else _0x2c50d1({'ret':_0x2990df});}else{_0x2c50d1({'ret':_0x2990df});}});}});return 0xa;}var _0x1fcaf8=function(_0x758e36){return new BPromise(function(_0x3432c5,_0x41968a){_0xb17830(_0x758e36,_0x1d13a6)[_0x24db('0x1f')](function(_0x5a950d){_0x1d13a6[_0x24db('0x18')]=_0x5a950d[_0x24db('0x22')];_0x39802f[_0x24db('0x25')][_0x24db('0x1e')]({'where':{'phone':_0x1d13a6[_0x24db('0xd')],'CampaignId':_0x758e36['id']}})['then'](function(_0x164697){if(!_['isNil'](_0x164697)){throw new Error(_0x24db('0x23')+_0x1d13a6['phone']+_0x24db('0x31')+_0x758e36['id']);}return _0x39802f[_0x24db('0x25')][_0x24db('0x2a')]({'phone':_0x1d13a6[_0x24db('0xd')],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'priority':_0x1d13a6[_0x24db('0x27')]?_0x1d13a6[_0x24db('0x27')]:0x2,'scheduledat':_0x1d13a6[_0x24db('0x18')]?_0x1d13a6['scheduledat']:moment()[_0x24db('0x19')](_0x24db('0x1a')),'callback':_0x1d13a6[_0x24db('0x28')]?!![]:![],'callbackuniqueid':_0x1d13a6[_0x24db('0x28')]?_0x1d13a6[_0x24db('0x28')]:undefined,'callbackat':_0x1d13a6[_0x24db('0x28')]?moment()['format'](_0x24db('0x1a')):undefined,'CampaignId':_0x758e36['id']});})[_0x24db('0x32')](function(_0x1f4d99){_0x41968a(_0x1f4d99);});});});};var _0x3d86fc=function(_0x4a021f){return new BPromise(function(_0x5290ed,_0x27fec2){_0xb17830(_0x4a021f,_0x1d13a6)[_0x24db('0x1f')](function(_0x54e568){_0x1d13a6['scheduledat']=_0x54e568[_0x24db('0x22')];_0x39802f[_0x24db('0x25')]['findOne']({'where':{'phone':_0x1d13a6[_0x24db('0xd')],'CampaignId':_0x4a021f['id']}})[_0x24db('0x1f')](function(_0x1cabc2){if(!_[_0x24db('0x1b')](_0x1cabc2)){throw new Error(_0x24db('0x23')+_0x1d13a6['phone']+_0x24db('0x33')+_0x4a021f['id']);}return _0x39802f[_0x24db('0x29')][_0x24db('0x1e')]({'where':{'calleridnum':_0x1d13a6[_0x24db('0xd')],'CampaignId':_0x4a021f['id']}});})['then'](function(_0x853381){if(!_['isNil'](_0x853381)){throw new Error(_0x24db('0x34')+_0x1d13a6['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x4a021f['id']);}return _0x39802f[_0x24db('0x25')][_0x24db('0x2a')]({'phone':_0x1d13a6['phone'],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'priority':_0x1d13a6['priority']?_0x1d13a6[_0x24db('0x27')]:0x2,'scheduledat':_0x1d13a6[_0x24db('0x18')]?_0x1d13a6[_0x24db('0x18')]:moment()[_0x24db('0x19')](_0x24db('0x1a')),'callback':_0x1d13a6[_0x24db('0x28')]?!![]:![],'callbackuniqueid':_0x1d13a6[_0x24db('0x28')]?_0x1d13a6['callbackUniqueid']:undefined,'callbackat':_0x1d13a6[_0x24db('0x28')]?moment()[_0x24db('0x19')](_0x24db('0x1a')):undefined,'CampaignId':_0x4a021f['id']});})[_0x24db('0x32')](function(_0x388e48){_0x27fec2(_0x388e48);});});});};if(_0x1d13a6[_0x24db('0x26')]){_0x39802f[_0x24db('0x1d')][_0x24db('0x35')]({'where':{'type':_0x24db('0x36')},'attributes':['id',_0x24db('0x37'),'dialTimezone'],'include':[{'model':_0x39802f[_0x24db('0x38')],'as':_0x24db('0x39'),'where':{'id':_0x1d13a6['ListId']}}]})[_0x24db('0x1f')](function(_0x32d67d){if(_0x32d67d){var _0x27f9f0=[];for(var _0x335e98=0x0,_0x1de13e;_0x335e98<_0x32d67d[_0x24db('0x3a')];_0x335e98+=0x1){_0x1de13e=_0x32d67d[_0x335e98][_0x24db('0x3b')]({'plain':!![]});switch(_0x1de13e[_0x24db('0x37')]){case _0x24db('0x3c'):_0x347a6a(_0x1de13e)[_0x24db('0x32')](_0x4b0689());break;case _0x24db('0x3d'):_0x495905(_0x1de13e)[_0x24db('0x32')](_0x4b0689());break;default:_0xb17830(_0x1de13e,_0x1d13a6)[_0x24db('0x1f')](function(_0x56548b){_0x1d13a6[_0x24db('0x18')]=_0x56548b[_0x24db('0x22')];_0x39802f[_0x24db('0x25')][_0x24db('0x2a')]({'phone':_0x1d13a6[_0x24db('0xd')],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'scheduledat':_0x1d13a6[_0x24db('0x18')]?_0x1d13a6[_0x24db('0x18')]:moment()[_0x24db('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1d13a6[_0x24db('0x27')]?_0x1d13a6['priority']:0x2,'callback':_0x1d13a6[_0x24db('0x28')]?!![]:![],'callbackuniqueid':_0x1d13a6[_0x24db('0x28')]?_0x1d13a6[_0x24db('0x28')]:undefined,'callbackat':_0x1d13a6[_0x24db('0x28')]?moment()[_0x24db('0x19')](_0x24db('0x1a')):undefined,'VoiceQueueId':_0x1de13e['id']})['catch'](_0x4b0689());});}}}})[_0x24db('0x1f')](function(){return _0x39802f[_0x24db('0x1d')][_0x24db('0x35')]({'where':{'type':_0x24db('0x36')},'attributes':['id'],'include':[{'model':_0x39802f[_0x24db('0x38')],'as':_0x24db('0x3e'),'where':{'id':_0x1d13a6[_0x24db('0x26')]}}]})[_0x24db('0x1f')](function(_0x3bc653){if(_0x3bc653){var _0x107d0b=[];for(var _0x36d846=0x0,_0x125534;_0x36d846<_0x3bc653[_0x24db('0x3a')];_0x36d846+=0x1){_0x125534=_0x3bc653[_0x36d846][_0x24db('0x3b')]({'plain':!![]});_0x39802f['CmHopperBlack']['create']({'phone':_0x1d13a6[_0x24db('0xd')],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'VoiceQueueId':_0x125534['id']})[_0x24db('0x32')](function(_0xa742fa){logger[_0x24db('0x2b')](_0x24db('0x3f'),_0x24db('0x2d'),_0xa742fa['message']);});}}});})[_0x24db('0x1f')](function(){return _0x39802f['Campaign'][_0x24db('0x35')]({'attributes':['id',_0x24db('0x37'),_0x24db('0x1c')],'include':[{'model':_0x39802f[_0x24db('0x38')],'as':_0x24db('0x39'),'where':{'id':_0x1d13a6[_0x24db('0x26')]}}]})[_0x24db('0x1f')](function(_0x13d7bb){if(_0x13d7bb){var _0x42aa60=[];for(var _0x10782a=0x0,_0x35522c;_0x10782a<_0x13d7bb['length'];_0x10782a+=0x1){_0x35522c=_0x13d7bb[_0x10782a][_0x24db('0x3b')]({'plain':!![]});switch(_0x35522c['dialCheckDuplicateType']){case _0x24db('0x3c'):_0x3d86fc(_0x35522c)[_0x24db('0x32')](_0x42fb17());break;case _0x24db('0x3d'):_0x1fcaf8(_0x35522c)['catch'](_0x42fb17());break;default:_0x39802f[_0x24db('0x25')][_0x24db('0x2a')]({'phone':_0x1d13a6['phone'],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'scheduledat':_0x1d13a6['scheduledat']?_0x1d13a6[_0x24db('0x18')]:moment()[_0x24db('0x19')](_0x24db('0x1a')),'priority':_0x1d13a6[_0x24db('0x27')]?_0x1d13a6[_0x24db('0x27')]:0x2,'callback':_0x1d13a6[_0x24db('0x28')]?!![]:![],'callbackuniqueid':_0x1d13a6['callbackUniqueid']?_0x1d13a6[_0x24db('0x28')]:undefined,'callbackat':_0x1d13a6[_0x24db('0x28')]?moment()['format'](_0x24db('0x1a')):undefined,'CampaignId':_0x35522c['id']})[_0x24db('0x32')](_0x42fb17());}}}});})[_0x24db('0x1f')](function(){return _0x39802f[_0x24db('0x2e')][_0x24db('0x35')]({'attributes':['id'],'include':[{'model':_0x39802f[_0x24db('0x38')],'as':'BlackLists','where':{'id':_0x1d13a6['ListId']}}]})['then'](function(_0xf8cfd0){if(_0xf8cfd0){var _0xc56260=[];for(var _0x2bba65=0x0,_0x3865a5;_0x2bba65<_0xf8cfd0[_0x24db('0x3a')];_0x2bba65+=0x1){_0x3865a5=_0xf8cfd0[_0x2bba65][_0x24db('0x3b')]({'plain':!![]});_0x39802f[_0x24db('0x40')][_0x24db('0x2a')]({'phone':_0x1d13a6[_0x24db('0xd')],'ContactId':_0x1d13a6['id'],'ListId':_0x1d13a6[_0x24db('0x26')],'CampaignId':_0x3865a5['id']})[_0x24db('0x32')](function(_0x3bfb9f){logger['error'](_0x24db('0x3f'),'afterCreate',_0x3bfb9f[_0x24db('0x41')]);});}}});})['then'](function(){_0x13a633();})[_0x24db('0x32')](function(_0x2c89c0){logger[_0x24db('0x2b')]('cmContact,\x20%s,\x20%s',_0x24db('0x2d'),_0x2c89c0[_0x24db('0x41')]);_0x13a633(_0x2c89c0);});}else{_0x13a633(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x3ab194,_0x5f41d1,_0x3cdbfd){var _0x8206e5=_0x238749[_0x24db('0x16')];var _0x38be73=_0x3ab194[_0x24db('0x3b')]({'plain':!![]});return _0x8206e5[_0x24db('0x25')][_0x24db('0x35')]({'raw':!![],'where':{'ListId':_0x38be73[_0x24db('0x26')],'ContactId':_0x38be73['id']}})[_0x24db('0x1f')](function(_0x838835){if(!_['isEmpty'](_0x838835)){var _0x22ddcf=[];for(var _0x4f2c11=0x0;_0x4f2c11<_0x838835['length'];_0x4f2c11+=0x1){var _0x541c92=_0x8206e5[_0x24db('0x25')]['destroy']({'where':{'ListId':_0x838835[_0x4f2c11][_0x24db('0x26')],'ContactId':_0x838835[_0x4f2c11][_0x24db('0x42')],'VoiceQueueId':_0x838835[_0x4f2c11][_0x24db('0x43')],'CampaignId':_0x838835[_0x4f2c11][_0x24db('0x44')]}});_0x22ddcf['push'](_0x541c92);}return BPromise[_0x24db('0x45')](_0x22ddcf);}})['then'](function(_0xc6d2aa){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x24db('0x17')](_0xc6d2aa,{'showHidden':![],'depth':null}));_0x3cdbfd();})[_0x24db('0x32')](function(_0xd73099){logger['error'](_0x24db('0x46'),util[_0x24db('0x17')](_0xd73099,{'showHidden':![],'depth':null}));_0x3cdbfd(_0xd73099);});}}});}; \ No newline at end of file +var _0x3b34=['add','minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','findOne','cmContact,\x20afterCreate\x20','cmContact,\x20afterCreate,\x20','error','cmContact','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','afterCreate','message','always','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','bluebird','path','../../config/environment','../../config/environment/shared','exports','define','CmContact','phone','firstName','lastName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset'];(function(_0x19b4da,_0x10ac4){var _0x203ac0=function(_0x2edc64){while(--_0x2edc64){_0x19b4da['push'](_0x19b4da['shift']());}};_0x203ac0(++_0x10ac4);}(_0x3b34,0xb9));var _0x43b3=function(_0x4ff51e,_0xf66763){_0x4ff51e=_0x4ff51e-0x0;var _0x38951f=_0x3b34[_0x4ff51e];return _0x38951f;};'use strict';var _=require(_0x43b3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x43b3('0x1'));var moment=require('moment');var BPromise=require(_0x43b3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b3('0x3'));var rimraf=require('rimraf');var config=require(_0x43b3('0x4'));var shared=require(_0x43b3('0x5'));var attributes=require('./cmContact.attributes');module[_0x43b3('0x6')]=function(_0x72015e,_0x1a37eb){return _0x72015e[_0x43b3('0x7')](_0x43b3('0x8'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x43b3('0x9')]},{'name':'fti_cm_contacts','fields':[_0x43b3('0xa'),_0x43b3('0xb'),_0x43b3('0x9'),'mobile',_0x43b3('0xc'),'email'],'type':_0x43b3('0xd')}],'timestamps':!![],'charset':_0x43b3('0xe'),'collate':_0x43b3('0xf'),'hooks':{'afterCreate':function(_0x528612,_0x43eb53,_0x149ccc){var _0x44bca6=_0x72015e[_0x43b3('0x10')];var _0x484fce=_0x528612[_0x43b3('0x11')]({'plain':!![]});function _0x3de2a9(){return function(_0x410087){logger['error']('cmContact','afterCreate',util[_0x43b3('0x12')](_0x410087,{'showHidden':![],'depth':null}));};}function _0x4894df(_0x4f3e3f,_0x4ef44c){var _0x26e66e=_0x4ef44c['scheduledat']?_0x4ef44c[_0x43b3('0x13')]:moment()[_0x43b3('0x14')](_0x43b3('0x15'));return new BPromise(function(_0x59f5d5,_0x55becb){if(_[_0x43b3('0x16')](_0x4ef44c[_0x43b3('0x17')])){_0x59f5d5({'ret':_0x26e66e});}else{_0x44bca6[_0x43b3('0x18')]['findOne']({'where':{'id':_0x4f3e3f['id']}})[_0x43b3('0x19')](function(_0x151a85){if(!_[_0x43b3('0x16')](_0x151a85)){var _0x15b2ad=_0x151a85['dialTimezone'];if(!_[_0x43b3('0x16')](_0x15b2ad)){var _0x4a1db4=shared[_0x43b3('0x1a')];var _0x4b7103=_0x4a1db4[_0x15b2ad];var _0x521d94=_0x4a1db4[_0x4ef44c['dialTimezone']];if(!_['isNil'](_0x4b7103)&&!_[_0x43b3('0x16')](_0x521d94)){var _0x350ddc=_0x4b7103[_0x43b3('0x1b')]-_0x521d94[_0x43b3('0x1b')];_0x26e66e=_0x4ef44c['scheduledat']?_0x4ef44c[_0x43b3('0x13')]:moment();var _0x4565d9=moment(_0x26e66e)[_0x43b3('0x1c')](_0x350ddc,_0x43b3('0x1d'));_0x59f5d5({'ret':_0x4565d9[_0x43b3('0x14')](_0x43b3('0x15'))});}else _0x59f5d5({'ret':_0x26e66e});}else _0x59f5d5({'ret':_0x26e66e});}else{_0x59f5d5({'ret':_0x26e66e});}});}});return 0xa;}var _0x3e5310=function(_0x240a0c){return new BPromise(function(_0x5dc6be,_0x5f26ac){_0x4894df(_0x240a0c,_0x484fce)[_0x43b3('0x19')](function(_0x34776c){_0x484fce['scheduledat']=_0x34776c[_0x43b3('0x1e')];_0x44bca6[_0x43b3('0x1f')]['findOne']({'where':{'phone':_0x484fce[_0x43b3('0x9')],'VoiceQueueId':_0x240a0c['id']}})[_0x43b3('0x19')](function(_0x699d13){if(!_[_0x43b3('0x16')](_0x699d13)){throw new Error('cmContact,\x20afterCreate\x20'+_0x484fce[_0x43b3('0x9')]+_0x43b3('0x20')+_0x240a0c['id']);}return _0x44bca6['CmHopper'][_0x43b3('0x21')]({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'priority':_0x484fce['priority']?_0x484fce[_0x43b3('0x23')]:0x2,'scheduledat':_0x484fce[_0x43b3('0x13')]?_0x484fce[_0x43b3('0x13')]:moment()[_0x43b3('0x14')](_0x43b3('0x15')),'callback':_0x484fce[_0x43b3('0x24')]?!![]:![],'callbackuniqueid':_0x484fce[_0x43b3('0x24')]?_0x484fce[_0x43b3('0x24')]:undefined,'callbackat':_0x484fce[_0x43b3('0x24')]?moment()['format'](_0x43b3('0x15')):undefined,'VoiceQueueId':_0x240a0c['id']});})[_0x43b3('0x25')](function(_0xce7136){_0x5f26ac(_0xce7136);});});});};var _0x4d5388=function(_0x151682){return new BPromise(function(_0x487d78,_0x1b1af1){_0x4894df(_0x151682,_0x484fce)[_0x43b3('0x19')](function(_0x3b9c5d){_0x484fce[_0x43b3('0x13')]=_0x3b9c5d[_0x43b3('0x1e')];_0x44bca6['CmHopper'][_0x43b3('0x26')]({'where':{'phone':_0x484fce[_0x43b3('0x9')],'VoiceQueueId':_0x151682['id']}})[_0x43b3('0x19')](function(_0x4a8d6a){if(!_['isNil'](_0x4a8d6a)){throw new Error(_0x43b3('0x27')+_0x484fce[_0x43b3('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x151682['id']);}return _0x44bca6['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x484fce[_0x43b3('0x9')],'VoiceQueueId':_0x151682['id']}});})['then'](function(_0x2bbbb8){if(!_['isNil'](_0x2bbbb8)){throw new Error(_0x43b3('0x28')+_0x484fce[_0x43b3('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x151682['id']);}return _0x44bca6[_0x43b3('0x1f')][_0x43b3('0x21')]({'phone':_0x484fce['phone'],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'priority':_0x484fce[_0x43b3('0x23')]?_0x484fce['priority']:0x2,'scheduledat':_0x484fce['scheduledat']?_0x484fce[_0x43b3('0x13')]:moment()[_0x43b3('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x484fce[_0x43b3('0x24')]?!![]:![],'callbackuniqueid':_0x484fce[_0x43b3('0x24')]?_0x484fce[_0x43b3('0x24')]:undefined,'callbackat':_0x484fce[_0x43b3('0x24')]?moment()[_0x43b3('0x14')](_0x43b3('0x15')):undefined,'VoiceQueueId':_0x151682['id']});})[_0x43b3('0x25')](function(_0x60fdcb){_0x1b1af1(_0x60fdcb);});});});};function _0x20bdca(){return function(_0x4f907c){logger[_0x43b3('0x29')](_0x43b3('0x2a'),'afterCreate',util[_0x43b3('0x12')](_0x4f907c,{'showHidden':![],'depth':null}));};}function _0x13fb22(_0x4b952c,_0x4bacb9){var _0x354718=_0x4bacb9['scheduledat']?_0x4bacb9[_0x43b3('0x13')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x178cac,_0x420b41){if(_['isNil'](_0x4bacb9[_0x43b3('0x17')])){_0x178cac({'ret':_0x354718});}else{_0x44bca6[_0x43b3('0x2b')][_0x43b3('0x26')]({'where':{'id':_0x4b952c['id']}})[_0x43b3('0x19')](function(_0x52a997){if(!_[_0x43b3('0x16')](_0x52a997)){var _0x2e7af8=_0x52a997['dialTimezone'];if(!_[_0x43b3('0x16')](_0x2e7af8)){var _0x4e5499=shared['timezones'];var _0x60184b=_0x4e5499[_0x2e7af8];var _0x4efca1=_0x4e5499[_0x4bacb9[_0x43b3('0x17')]];if(!_['isNil'](_0x60184b)&&!_['isNil'](_0x4efca1)){var _0x6f2e11=_0x60184b[_0x43b3('0x1b')]-_0x4efca1[_0x43b3('0x1b')];_0x354718=_0x4bacb9[_0x43b3('0x13')]?_0x4bacb9[_0x43b3('0x13')]:moment();var _0x3a29e8=moment(_0x354718)['add'](_0x6f2e11,_0x43b3('0x1d'));_0x178cac({'ret':_0x3a29e8[_0x43b3('0x14')](_0x43b3('0x15'))});}else _0x178cac({'ret':_0x354718});}else _0x178cac({'ret':_0x354718});}else{_0x178cac({'ret':_0x354718});}});}});return 0xa;}var _0x1c07af=function(_0xfeefe5){return new BPromise(function(_0x4d09e0,_0x18615e){_0x13fb22(_0xfeefe5,_0x484fce)[_0x43b3('0x19')](function(_0x4072d8){_0x484fce[_0x43b3('0x13')]=_0x4072d8[_0x43b3('0x1e')];_0x44bca6[_0x43b3('0x1f')][_0x43b3('0x26')]({'where':{'phone':_0x484fce[_0x43b3('0x9')],'CampaignId':_0xfeefe5['id']}})[_0x43b3('0x19')](function(_0x16826b){if(!_['isNil'](_0x16826b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x484fce[_0x43b3('0x9')]+_0x43b3('0x2c')+_0xfeefe5['id']);}return _0x44bca6[_0x43b3('0x1f')]['create']({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'priority':_0x484fce['priority']?_0x484fce[_0x43b3('0x23')]:0x2,'scheduledat':_0x484fce['scheduledat']?_0x484fce['scheduledat']:moment()['format'](_0x43b3('0x15')),'callback':_0x484fce['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x484fce[_0x43b3('0x24')]?_0x484fce['callbackUniqueid']:undefined,'callbackat':_0x484fce[_0x43b3('0x24')]?moment()[_0x43b3('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xfeefe5['id']});})[_0x43b3('0x25')](function(_0x2d78b1){_0x18615e(_0x2d78b1);});});});};var _0x314f27=function(_0x401f21){return new BPromise(function(_0x1ecfa0,_0x3b57eb){_0x13fb22(_0x401f21,_0x484fce)[_0x43b3('0x19')](function(_0x2f6253){_0x484fce[_0x43b3('0x13')]=_0x2f6253[_0x43b3('0x1e')];_0x44bca6[_0x43b3('0x1f')]['findOne']({'where':{'phone':_0x484fce[_0x43b3('0x9')],'CampaignId':_0x401f21['id']}})[_0x43b3('0x19')](function(_0x32175d){if(!_[_0x43b3('0x16')](_0x32175d)){throw new Error(_0x43b3('0x27')+_0x484fce[_0x43b3('0x9')]+_0x43b3('0x2d')+_0x401f21['id']);}return _0x44bca6[_0x43b3('0x2e')][_0x43b3('0x26')]({'where':{'calleridnum':_0x484fce[_0x43b3('0x9')],'CampaignId':_0x401f21['id']}});})[_0x43b3('0x19')](function(_0xbeee71){if(!_[_0x43b3('0x16')](_0xbeee71)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x484fce[_0x43b3('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x401f21['id']);}return _0x44bca6[_0x43b3('0x1f')][_0x43b3('0x21')]({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'priority':_0x484fce[_0x43b3('0x23')]?_0x484fce[_0x43b3('0x23')]:0x2,'scheduledat':_0x484fce[_0x43b3('0x13')]?_0x484fce[_0x43b3('0x13')]:moment()[_0x43b3('0x14')](_0x43b3('0x15')),'callback':_0x484fce['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x484fce['callbackUniqueid']?_0x484fce[_0x43b3('0x24')]:undefined,'callbackat':_0x484fce[_0x43b3('0x24')]?moment()[_0x43b3('0x14')](_0x43b3('0x15')):undefined,'CampaignId':_0x401f21['id']});})['catch'](function(_0x265cc4){_0x3b57eb(_0x265cc4);});});});};if(_0x484fce[_0x43b3('0x22')]){_0x44bca6[_0x43b3('0x18')][_0x43b3('0x2f')]({'where':{'type':_0x43b3('0x30')},'attributes':['id',_0x43b3('0x31'),'dialTimezone'],'include':[{'model':_0x44bca6[_0x43b3('0x32')],'as':_0x43b3('0x33'),'where':{'id':_0x484fce[_0x43b3('0x22')]}}]})[_0x43b3('0x19')](function(_0x1750f4){if(_0x1750f4){var _0x43679e=[];for(var _0xc41ac3=0x0,_0x579715;_0xc41ac3<_0x1750f4[_0x43b3('0x34')];_0xc41ac3+=0x1){_0x579715=_0x1750f4[_0xc41ac3]['get']({'plain':!![]});switch(_0x579715[_0x43b3('0x31')]){case'always':_0x4d5388(_0x579715)[_0x43b3('0x25')](_0x3de2a9());break;case _0x43b3('0x35'):_0x3e5310(_0x579715)['catch'](_0x3de2a9());break;default:_0x13fb22(_0x579715,_0x484fce)[_0x43b3('0x19')](function(_0x44de10){_0x484fce[_0x43b3('0x13')]=_0x44de10[_0x43b3('0x1e')];_0x44bca6[_0x43b3('0x1f')][_0x43b3('0x21')]({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce['ListId'],'scheduledat':_0x484fce[_0x43b3('0x13')]?_0x484fce[_0x43b3('0x13')]:moment()[_0x43b3('0x14')](_0x43b3('0x15')),'priority':_0x484fce['priority']?_0x484fce[_0x43b3('0x23')]:0x2,'callback':_0x484fce[_0x43b3('0x24')]?!![]:![],'callbackuniqueid':_0x484fce[_0x43b3('0x24')]?_0x484fce['callbackUniqueid']:undefined,'callbackat':_0x484fce['callbackUniqueid']?moment()[_0x43b3('0x14')](_0x43b3('0x15')):undefined,'VoiceQueueId':_0x579715['id']})[_0x43b3('0x25')](_0x3de2a9());});}}}})[_0x43b3('0x19')](function(){return _0x44bca6[_0x43b3('0x18')][_0x43b3('0x2f')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x44bca6[_0x43b3('0x32')],'as':_0x43b3('0x36'),'where':{'id':_0x484fce[_0x43b3('0x22')]}}]})['then'](function(_0x27b384){if(_0x27b384){var _0x53593c=[];for(var _0x4ff0c3=0x0,_0x545c87;_0x4ff0c3<_0x27b384[_0x43b3('0x34')];_0x4ff0c3+=0x1){_0x545c87=_0x27b384[_0x4ff0c3][_0x43b3('0x11')]({'plain':!![]});_0x44bca6[_0x43b3('0x37')][_0x43b3('0x21')]({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'VoiceQueueId':_0x545c87['id']})[_0x43b3('0x25')](function(_0x4422b4){logger[_0x43b3('0x29')](_0x43b3('0x38'),_0x43b3('0x39'),_0x4422b4[_0x43b3('0x3a')]);});}}});})[_0x43b3('0x19')](function(){return _0x44bca6[_0x43b3('0x2b')][_0x43b3('0x2f')]({'attributes':['id',_0x43b3('0x31'),'dialTimezone'],'include':[{'model':_0x44bca6[_0x43b3('0x32')],'as':_0x43b3('0x33'),'where':{'id':_0x484fce[_0x43b3('0x22')]}}]})['then'](function(_0x1c3af4){if(_0x1c3af4){var _0x572cde=[];for(var _0x1b09a8=0x0,_0x2dae8c;_0x1b09a8<_0x1c3af4[_0x43b3('0x34')];_0x1b09a8+=0x1){_0x2dae8c=_0x1c3af4[_0x1b09a8][_0x43b3('0x11')]({'plain':!![]});switch(_0x2dae8c[_0x43b3('0x31')]){case _0x43b3('0x3b'):_0x314f27(_0x2dae8c)['catch'](_0x20bdca());break;case _0x43b3('0x35'):_0x1c07af(_0x2dae8c)['catch'](_0x20bdca());break;default:_0x44bca6[_0x43b3('0x1f')]['create']({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'scheduledat':_0x484fce[_0x43b3('0x13')]?_0x484fce[_0x43b3('0x13')]:moment()[_0x43b3('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x484fce[_0x43b3('0x23')]?_0x484fce['priority']:0x2,'callback':_0x484fce[_0x43b3('0x24')]?!![]:![],'callbackuniqueid':_0x484fce[_0x43b3('0x24')]?_0x484fce[_0x43b3('0x24')]:undefined,'callbackat':_0x484fce[_0x43b3('0x24')]?moment()[_0x43b3('0x14')](_0x43b3('0x15')):undefined,'CampaignId':_0x2dae8c['id']})[_0x43b3('0x25')](_0x20bdca());}}}});})[_0x43b3('0x19')](function(){return _0x44bca6[_0x43b3('0x2b')]['findAll']({'attributes':['id'],'include':[{'model':_0x44bca6['CmList'],'as':'BlackLists','where':{'id':_0x484fce[_0x43b3('0x22')]}}]})[_0x43b3('0x19')](function(_0x41f20f){if(_0x41f20f){var _0x5a96c1=[];for(var _0x49b355=0x0,_0x39c551;_0x49b355<_0x41f20f[_0x43b3('0x34')];_0x49b355+=0x1){_0x39c551=_0x41f20f[_0x49b355]['get']({'plain':!![]});_0x44bca6[_0x43b3('0x37')][_0x43b3('0x21')]({'phone':_0x484fce[_0x43b3('0x9')],'ContactId':_0x484fce['id'],'ListId':_0x484fce[_0x43b3('0x22')],'CampaignId':_0x39c551['id']})[_0x43b3('0x25')](function(_0x4e5a6f){logger[_0x43b3('0x29')]('cmContact,\x20%s,\x20%s',_0x43b3('0x39'),_0x4e5a6f[_0x43b3('0x3a')]);});}}});})[_0x43b3('0x19')](function(){_0x149ccc();})[_0x43b3('0x25')](function(_0x3a3973){logger[_0x43b3('0x29')]('cmContact,\x20%s,\x20%s','afterCreate',_0x3a3973['message']);_0x149ccc(_0x3a3973);});}else{_0x149ccc(new Error(_0x43b3('0x3c')));}},'afterDestroy':function(_0x4f43b1,_0x4e3639,_0x13b70f){var _0x1e05e8=_0x72015e[_0x43b3('0x10')];var _0x515345=_0x4f43b1['get']({'plain':!![]});return _0x1e05e8['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x515345[_0x43b3('0x22')],'ContactId':_0x515345['id']}})[_0x43b3('0x19')](function(_0x4582f0){if(!_[_0x43b3('0x3d')](_0x4582f0)){var _0x422d2b=[];for(var _0xe15864=0x0;_0xe15864<_0x4582f0['length'];_0xe15864+=0x1){var _0x4d589e=_0x1e05e8['CmHopper'][_0x43b3('0x3e')]({'where':{'ListId':_0x4582f0[_0xe15864][_0x43b3('0x22')],'ContactId':_0x4582f0[_0xe15864][_0x43b3('0x3f')],'VoiceQueueId':_0x4582f0[_0xe15864][_0x43b3('0x40')],'CampaignId':_0x4582f0[_0xe15864][_0x43b3('0x41')]}});_0x422d2b[_0x43b3('0x42')](_0x4d589e);}return BPromise[_0x43b3('0x43')](_0x422d2b);}})['then'](function(_0x5e69c6){logger[_0x43b3('0x44')](_0x43b3('0x45'),util[_0x43b3('0x12')](_0x5e69c6,{'showHidden':![],'depth':null}));_0x13b70f();})['catch'](function(_0x286a20){logger[_0x43b3('0x29')](_0x43b3('0x46'),util[_0x43b3('0x12')](_0x286a20,{'showHidden':![],'depth':null}));_0x13b70f(_0x286a20);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 9c7bbdd..77c82fa 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x30e7a5,_0x13ff0b){var _0x5b44e3=function(_0x597910){while(--_0x597910){_0x30e7a5['push'](_0x30e7a5['shift']());}};_0x5b44e3(++_0x13ff0b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x4827e7,_0x12ce60){var _0x15f811=function(_0x44364f){while(--_0x44364f){_0x4827e7['push'](_0x4827e7['shift']());}};_0x15f811(++_0x12ce60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index aaa9295..d3aeb81 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 _0x1542=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1542,0x116));var _0x2154=function(_0x495af5,_0x4da751){_0x495af5=_0x495af5-0x0;var _0x27fc50=_0x1542[_0x495af5];return _0x27fc50;};'use strict';var Sequelize=require(_0x2154('0x0'));module[_0x2154('0x1')]={'CmContactId':{'type':Sequelize[_0x2154('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2154('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2154('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x2154('0x4')},'OrderBy':{'type':Sequelize[_0x2154('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x2154('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xe79f=['INTEGER','STRING','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfe79('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xfe79('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xfe79('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xfe79('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 8b9dd47..4638e46 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 _0xd2d4=['findAll','rows','show','params','merge','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','update','then','destroy','get','CmContactHasItems','UserProfileResource','stack','name','send','index','map','CmContactHasItem','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include'];(function(_0x93be8e,_0x3fbb4c){var _0x5b9f49=function(_0x32cf9f){while(--_0x32cf9f){_0x93be8e['push'](_0x93be8e['shift']());}};_0x5b9f49(++_0x3fbb4c);}(_0xd2d4,0xb9));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4d2d('0x0'));var rimraf=require(_0x4d2d('0x1'));var zipdir=require(_0x4d2d('0x2'));var jsonpatch=require(_0x4d2d('0x3'));var rp=require(_0x4d2d('0x4'));var moment=require('moment');var BPromise=require(_0x4d2d('0x5'));var Mustache=require(_0x4d2d('0x6'));var util=require(_0x4d2d('0x7'));var path=require('path');var sox=require(_0x4d2d('0x8'));var csv=require(_0x4d2d('0x9'));var ejs=require(_0x4d2d('0xa'));var fs=require('fs');var fs_extra=require(_0x4d2d('0xb'));var _=require(_0x4d2d('0xc'));var squel=require('squel');var crypto=require(_0x4d2d('0xd'));var jsforce=require(_0x4d2d('0xe'));var deskjs=require(_0x4d2d('0xf'));var toCsv=require(_0x4d2d('0x9'));var querystring=require('querystring');var Papa=require(_0x4d2d('0x10'));var Redis=require(_0x4d2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4d2d('0x12'));var as=require(_0x4d2d('0x13'));var hardwareService=require(_0x4d2d('0x14'));var logger=require(_0x4d2d('0x15'))(_0x4d2d('0x16'));var utils=require(_0x4d2d('0x17'));var config=require(_0x4d2d('0x18'));var licenseUtil=require(_0x4d2d('0x19'));var db=require(_0x4d2d('0x1a'))['db'];function respondWithStatusCode(_0x557cd4,_0x55215b){_0x55215b=_0x55215b||0xcc;return function(_0x3ee9f1){if(_0x3ee9f1){return _0x557cd4[_0x4d2d('0x1b')](_0x55215b);}return _0x557cd4[_0x4d2d('0x1c')](_0x55215b)[_0x4d2d('0x1d')]();};}function respondWithResult(_0x3879b6,_0x223ad4){_0x223ad4=_0x223ad4||0xc8;return function(_0x348d78){if(_0x348d78){return _0x3879b6[_0x4d2d('0x1c')](_0x223ad4)[_0x4d2d('0x1e')](_0x348d78);}};}function respondWithFilteredResult(_0x2c8c76,_0x20518e){return function(_0x4c34ff){if(_0x4c34ff){var _0x49e0b8=typeof _0x20518e[_0x4d2d('0x1f')]===_0x4d2d('0x20')&&typeof _0x20518e[_0x4d2d('0x21')]===_0x4d2d('0x20');var _0x22a363=_0x4c34ff['count'];var _0x24f39f=_0x49e0b8?0x0:_0x20518e[_0x4d2d('0x1f')];var _0x4143c9=_0x49e0b8?_0x4c34ff[_0x4d2d('0x22')]:_0x20518e['offset']+_0x20518e['limit'];var _0x1eb6b1;if(_0x4143c9>=_0x22a363){_0x4143c9=_0x22a363;_0x1eb6b1=0xc8;}else{_0x1eb6b1=0xce;}_0x2c8c76[_0x4d2d('0x1c')](_0x1eb6b1);return _0x2c8c76['set'](_0x4d2d('0x23'),_0x24f39f+'-'+_0x4143c9+'/'+_0x22a363)['json'](_0x4c34ff);}return null;};}function patchUpdates(_0x5ad0a6){return function(_0x153ea0){try{jsonpatch[_0x4d2d('0x24')](_0x153ea0,_0x5ad0a6,!![]);}catch(_0x11130a){return BPromise['reject'](_0x11130a);}return _0x153ea0[_0x4d2d('0x25')]();};}function saveUpdates(_0x1ae2e5,_0x21fe32){return function(_0x46bbfb){if(_0x46bbfb){return _0x46bbfb[_0x4d2d('0x26')](_0x1ae2e5)[_0x4d2d('0x27')](function(_0x3ccd65){return _0x3ccd65;});}return null;};}function removeEntity(_0x2fae8a,_0x1e3b43){return function(_0x570b4d){if(_0x570b4d){return _0x570b4d[_0x4d2d('0x28')]()[_0x4d2d('0x27')](function(){var _0x556b4a=_0x570b4d[_0x4d2d('0x29')]({'plain':!![]});var _0x54ebb6=_0x4d2d('0x2a');return db[_0x4d2d('0x2b')]['destroy']({'where':{'type':_0x54ebb6,'resourceId':_0x556b4a['id']}})['then'](function(){return _0x570b4d;});})[_0x4d2d('0x27')](function(){_0x2fae8a['status'](0xcc)[_0x4d2d('0x1d')]();});}};}function handleEntityNotFound(_0x15d784,_0x5917b6){return function(_0x506903){if(!_0x506903){_0x15d784[_0x4d2d('0x1b')](0x194);}return _0x506903;};}function handleError(_0x6db0f0,_0x59fcea){_0x59fcea=_0x59fcea||0x1f4;return function(_0x433674){logger['error'](_0x433674[_0x4d2d('0x2c')]);if(_0x433674[_0x4d2d('0x2d')]){delete _0x433674['name'];}_0x6db0f0[_0x4d2d('0x1c')](_0x59fcea)[_0x4d2d('0x2e')](_0x433674);};}exports[_0x4d2d('0x2f')]=function(_0x5f1e02,_0x9e06ab){var _0x124fe9={},_0x279dfc={},_0x239f74={'count':0x0,'rows':[]};var _0x5b443e=_[_0x4d2d('0x30')](db[_0x4d2d('0x31')]['rawAttributes'],function(_0x2d81c7){return{'name':_0x2d81c7[_0x4d2d('0x32')],'type':_0x2d81c7[_0x4d2d('0x33')]['key']};});_0x279dfc['model']=_[_0x4d2d('0x30')](_0x5b443e,_0x4d2d('0x2d'));_0x279dfc[_0x4d2d('0x34')]=_[_0x4d2d('0x35')](_0x5f1e02[_0x4d2d('0x34')]);_0x279dfc[_0x4d2d('0x36')]=_[_0x4d2d('0x37')](_0x279dfc[_0x4d2d('0x38')],_0x279dfc[_0x4d2d('0x34')]);_0x124fe9[_0x4d2d('0x39')]=_[_0x4d2d('0x37')](_0x279dfc[_0x4d2d('0x38')],qs['fields'](_0x5f1e02['query'][_0x4d2d('0x3a')]));_0x124fe9[_0x4d2d('0x39')]=_0x124fe9[_0x4d2d('0x39')][_0x4d2d('0x3b')]?_0x124fe9[_0x4d2d('0x39')]:_0x279dfc['model'];if(!_0x5f1e02[_0x4d2d('0x34')][_0x4d2d('0x3c')](_0x4d2d('0x3d'))){_0x124fe9[_0x4d2d('0x21')]=qs['limit'](_0x5f1e02[_0x4d2d('0x34')][_0x4d2d('0x21')]);_0x124fe9[_0x4d2d('0x1f')]=qs[_0x4d2d('0x1f')](_0x5f1e02[_0x4d2d('0x34')]['offset']);}_0x124fe9[_0x4d2d('0x3e')]=qs[_0x4d2d('0x3f')](_0x5f1e02[_0x4d2d('0x34')]['sort']);_0x124fe9['where']=qs[_0x4d2d('0x36')](_[_0x4d2d('0x40')](_0x5f1e02[_0x4d2d('0x34')],_0x279dfc['filters']),_0x5b443e);if(_0x5f1e02[_0x4d2d('0x34')][_0x4d2d('0x41')]){_0x124fe9[_0x4d2d('0x42')]=_['merge'](_0x124fe9[_0x4d2d('0x42')],{'$or':_['map'](_0x5b443e,function(_0x5e8b8b){if(_0x5e8b8b['type']!==_0x4d2d('0x43')){var _0x2136b2={};_0x2136b2[_0x5e8b8b[_0x4d2d('0x2d')]]={'$like':'%'+_0x5f1e02['query'][_0x4d2d('0x41')]+'%'};return _0x2136b2;}})});}_0x124fe9=_['merge']({},_0x124fe9,_0x5f1e02['options']);var _0x1069ba={'where':_0x124fe9[_0x4d2d('0x42')]};return db[_0x4d2d('0x31')][_0x4d2d('0x22')](_0x1069ba)[_0x4d2d('0x27')](function(_0x1672a8){_0x239f74[_0x4d2d('0x22')]=_0x1672a8;if(_0x5f1e02['query'][_0x4d2d('0x44')]){_0x124fe9[_0x4d2d('0x45')]=[{'all':!![]}];}return db[_0x4d2d('0x31')][_0x4d2d('0x46')](_0x124fe9);})[_0x4d2d('0x27')](function(_0x80939b){_0x239f74[_0x4d2d('0x47')]=_0x80939b;return _0x239f74;})[_0x4d2d('0x27')](respondWithFilteredResult(_0x9e06ab,_0x124fe9))['catch'](handleError(_0x9e06ab,null));};exports[_0x4d2d('0x48')]=function(_0x501a31,_0x6b86f){var _0x1f8c01={'raw':!![],'where':{'id':_0x501a31[_0x4d2d('0x49')]['id']}},_0x28169b={};_0x28169b[_0x4d2d('0x38')]=_['keys'](db[_0x4d2d('0x31')]['rawAttributes']);_0x28169b[_0x4d2d('0x34')]=_['keys'](_0x501a31[_0x4d2d('0x34')]);_0x28169b[_0x4d2d('0x36')]=_['intersection'](_0x28169b[_0x4d2d('0x38')],_0x28169b[_0x4d2d('0x34')]);_0x1f8c01[_0x4d2d('0x39')]=_[_0x4d2d('0x37')](_0x28169b[_0x4d2d('0x38')],qs['fields'](_0x501a31[_0x4d2d('0x34')]['fields']));_0x1f8c01['attributes']=_0x1f8c01[_0x4d2d('0x39')][_0x4d2d('0x3b')]?_0x1f8c01[_0x4d2d('0x39')]:_0x28169b[_0x4d2d('0x38')];if(_0x501a31[_0x4d2d('0x34')]['includeAll']){_0x1f8c01[_0x4d2d('0x45')]=[{'all':!![]}];}_0x1f8c01=_[_0x4d2d('0x4a')]({},_0x1f8c01,_0x501a31[_0x4d2d('0x4b')]);return db[_0x4d2d('0x31')][_0x4d2d('0x4c')](_0x1f8c01)[_0x4d2d('0x27')](handleEntityNotFound(_0x6b86f,null))[_0x4d2d('0x27')](respondWithResult(_0x6b86f,null))[_0x4d2d('0x4d')](handleError(_0x6b86f,null));};exports[_0x4d2d('0x4e')]=function(_0x191a1d,_0x5976b9){return db[_0x4d2d('0x31')]['create'](_0x191a1d[_0x4d2d('0x4f')],{})[_0x4d2d('0x27')](function(_0x2f5f12){var _0x11677e=_0x191a1d[_0x4d2d('0x50')][_0x4d2d('0x29')]({'plain':!![]});if(!_0x11677e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11677e[_0x4d2d('0x51')]===_0x4d2d('0x50')){var _0x388392=_0x2f5f12[_0x4d2d('0x29')]({'plain':!![]});var _0x5e505e=_0x4d2d('0x2a');return db[_0x4d2d('0x52')][_0x4d2d('0x4c')]({'where':{'name':_0x5e505e,'userProfileId':_0x11677e[_0x4d2d('0x53')]},'raw':!![]})[_0x4d2d('0x27')](function(_0x5a6b7e){if(_0x5a6b7e&&_0x5a6b7e[_0x4d2d('0x54')]===0x0){return db[_0x4d2d('0x2b')][_0x4d2d('0x4e')]({'name':_0x388392['name'],'resourceId':_0x388392['id'],'type':_0x5a6b7e['name'],'sectionId':_0x5a6b7e['id']},{})[_0x4d2d('0x27')](function(){return _0x2f5f12;});}else{return _0x2f5f12;}})['catch'](function(_0x371d38){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x371d38);throw _0x371d38;});}return _0x2f5f12;})[_0x4d2d('0x27')](respondWithResult(_0x5976b9,0xc9))[_0x4d2d('0x4d')](handleError(_0x5976b9,null));};exports['update']=function(_0x1cadfd,_0x75d707){if(_0x1cadfd[_0x4d2d('0x4f')]['id']){delete _0x1cadfd[_0x4d2d('0x4f')]['id'];}return db[_0x4d2d('0x31')][_0x4d2d('0x4c')]({'where':{'id':_0x1cadfd[_0x4d2d('0x49')]['id']}})[_0x4d2d('0x27')](handleEntityNotFound(_0x75d707,null))[_0x4d2d('0x27')](saveUpdates(_0x1cadfd['body'],null))[_0x4d2d('0x27')](respondWithResult(_0x75d707,null))[_0x4d2d('0x4d')](handleError(_0x75d707,null));};exports[_0x4d2d('0x28')]=function(_0x27a2aa,_0x9a083c){return db[_0x4d2d('0x31')][_0x4d2d('0x4c')]({'where':{'id':_0x27a2aa['params']['id']}})[_0x4d2d('0x27')](handleEntityNotFound(_0x9a083c,null))[_0x4d2d('0x27')](removeEntity(_0x9a083c,null))['catch'](handleError(_0x9a083c,null));}; \ No newline at end of file +var _0x048a=['UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','save','then','destroy','get','CmContactHasItems','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','params','filters','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation'];(function(_0x1e647b,_0x359b5e){var _0x23b626=function(_0x4a9fe6){while(--_0x4a9fe6){_0x1e647b['push'](_0x1e647b['shift']());}};_0x23b626(++_0x359b5e);}(_0x048a,0xfb));var _0xa048=function(_0x3856d6,_0x4b1404){_0x3856d6=_0x3856d6-0x0;var _0x168aa2=_0x048a[_0x3856d6];return _0x168aa2;};'use strict';var emlformat=require(_0xa048('0x0'));var rimraf=require(_0xa048('0x1'));var zipdir=require(_0xa048('0x2'));var jsonpatch=require(_0xa048('0x3'));var rp=require(_0xa048('0x4'));var moment=require(_0xa048('0x5'));var BPromise=require(_0xa048('0x6'));var Mustache=require(_0xa048('0x7'));var util=require(_0xa048('0x8'));var path=require(_0xa048('0x9'));var sox=require('sox');var csv=require(_0xa048('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa048('0xb'));var _=require('lodash');var squel=require(_0xa048('0xc'));var crypto=require(_0xa048('0xd'));var jsforce=require(_0xa048('0xe'));var deskjs=require(_0xa048('0xf'));var toCsv=require(_0xa048('0xa'));var querystring=require(_0xa048('0x10'));var Papa=require('papaparse');var Redis=require(_0xa048('0x11'));var authService=require(_0xa048('0x12'));var qs=require(_0xa048('0x13'));var as=require(_0xa048('0x14'));var hardwareService=require(_0xa048('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa048('0x16'));var config=require(_0xa048('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b401c,_0x303733){_0x303733=_0x303733||0xcc;return function(_0x48557f){if(_0x48557f){return _0x1b401c[_0xa048('0x18')](_0x303733);}return _0x1b401c['status'](_0x303733)[_0xa048('0x19')]();};}function respondWithResult(_0x52eed1,_0x3d661b){_0x3d661b=_0x3d661b||0xc8;return function(_0x19cfa6){if(_0x19cfa6){return _0x52eed1['status'](_0x3d661b)[_0xa048('0x1a')](_0x19cfa6);}};}function respondWithFilteredResult(_0x44197b,_0x1b3402){return function(_0x2b8690){if(_0x2b8690){var _0x515b2e=typeof _0x1b3402[_0xa048('0x1b')]===_0xa048('0x1c')&&typeof _0x1b3402['limit']===_0xa048('0x1c');var _0x5c1370=_0x2b8690[_0xa048('0x1d')];var _0xb7ddf4=_0x515b2e?0x0:_0x1b3402[_0xa048('0x1b')];var _0x326379=_0x515b2e?_0x2b8690['count']:_0x1b3402[_0xa048('0x1b')]+_0x1b3402[_0xa048('0x1e')];var _0x5630f9;if(_0x326379>=_0x5c1370){_0x326379=_0x5c1370;_0x5630f9=0xc8;}else{_0x5630f9=0xce;}_0x44197b[_0xa048('0x1f')](_0x5630f9);return _0x44197b[_0xa048('0x20')]('Content-Range',_0xb7ddf4+'-'+_0x326379+'/'+_0x5c1370)[_0xa048('0x1a')](_0x2b8690);}return null;};}function patchUpdates(_0xf6802d){return function(_0x6d989a){try{jsonpatch[_0xa048('0x21')](_0x6d989a,_0xf6802d,!![]);}catch(_0x604cdb){return BPromise[_0xa048('0x22')](_0x604cdb);}return _0x6d989a[_0xa048('0x23')]();};}function saveUpdates(_0x1e3102,_0x1e961a){return function(_0x2ef976){if(_0x2ef976){return _0x2ef976['update'](_0x1e3102)[_0xa048('0x24')](function(_0x1d822d){return _0x1d822d;});}return null;};}function removeEntity(_0x37eb27,_0x27e694){return function(_0x5a4fe0){if(_0x5a4fe0){return _0x5a4fe0[_0xa048('0x25')]()[_0xa048('0x24')](function(){var _0xe34862=_0x5a4fe0[_0xa048('0x26')]({'plain':!![]});var _0x4450e0=_0xa048('0x27');return db['UserProfileResource'][_0xa048('0x25')]({'where':{'type':_0x4450e0,'resourceId':_0xe34862['id']}})['then'](function(){return _0x5a4fe0;});})['then'](function(){_0x37eb27[_0xa048('0x1f')](0xcc)[_0xa048('0x19')]();});}};}function handleEntityNotFound(_0x528c07,_0x11a112){return function(_0x29c999){if(!_0x29c999){_0x528c07[_0xa048('0x18')](0x194);}return _0x29c999;};}function handleError(_0x1e4db7,_0x1da8da){_0x1da8da=_0x1da8da||0x1f4;return function(_0x16b4f2){logger['error'](_0x16b4f2[_0xa048('0x28')]);if(_0x16b4f2[_0xa048('0x29')]){delete _0x16b4f2[_0xa048('0x29')];}_0x1e4db7[_0xa048('0x1f')](_0x1da8da)[_0xa048('0x2a')](_0x16b4f2);};}exports[_0xa048('0x2b')]=function(_0x3d13b0,_0x51d575){var _0x2755cf={},_0x14793a={},_0x40f55c={'count':0x0,'rows':[]};var _0x5cb14a=_[_0xa048('0x2c')](db[_0xa048('0x2d')][_0xa048('0x2e')],function(_0x5c905b){return{'name':_0x5c905b[_0xa048('0x2f')],'type':_0x5c905b[_0xa048('0x30')][_0xa048('0x31')]};});_0x14793a['model']=_['map'](_0x5cb14a,'name');_0x14793a[_0xa048('0x32')]=_[_0xa048('0x33')](_0x3d13b0[_0xa048('0x32')]);_0x14793a['filters']=_['intersection'](_0x14793a[_0xa048('0x34')],_0x14793a['query']);_0x2755cf['attributes']=_[_0xa048('0x35')](_0x14793a[_0xa048('0x34')],qs[_0xa048('0x36')](_0x3d13b0[_0xa048('0x32')][_0xa048('0x36')]));_0x2755cf['attributes']=_0x2755cf[_0xa048('0x37')]['length']?_0x2755cf['attributes']:_0x14793a['model'];if(!_0x3d13b0[_0xa048('0x32')][_0xa048('0x38')](_0xa048('0x39'))){_0x2755cf[_0xa048('0x1e')]=qs[_0xa048('0x1e')](_0x3d13b0[_0xa048('0x32')][_0xa048('0x1e')]);_0x2755cf['offset']=qs[_0xa048('0x1b')](_0x3d13b0['query'][_0xa048('0x1b')]);}_0x2755cf[_0xa048('0x3a')]=qs[_0xa048('0x3b')](_0x3d13b0['query'][_0xa048('0x3b')]);_0x2755cf[_0xa048('0x3c')]=qs['filters'](_['pick'](_0x3d13b0['query'],_0x14793a['filters']),_0x5cb14a);if(_0x3d13b0[_0xa048('0x32')][_0xa048('0x3d')]){_0x2755cf[_0xa048('0x3c')]=_[_0xa048('0x3e')](_0x2755cf[_0xa048('0x3c')],{'$or':_[_0xa048('0x2c')](_0x5cb14a,function(_0x235352){if(_0x235352[_0xa048('0x30')]!==_0xa048('0x3f')){var _0x3be81c={};_0x3be81c[_0x235352[_0xa048('0x29')]]={'$like':'%'+_0x3d13b0[_0xa048('0x32')][_0xa048('0x3d')]+'%'};return _0x3be81c;}})});}_0x2755cf=_[_0xa048('0x3e')]({},_0x2755cf,_0x3d13b0['options']);var _0x4dfb9e={'where':_0x2755cf[_0xa048('0x3c')]};return db[_0xa048('0x2d')][_0xa048('0x1d')](_0x4dfb9e)['then'](function(_0x2e66bf){_0x40f55c[_0xa048('0x1d')]=_0x2e66bf;if(_0x3d13b0['query'][_0xa048('0x40')]){_0x2755cf[_0xa048('0x41')]=[{'all':!![]}];}return db[_0xa048('0x2d')]['findAll'](_0x2755cf);})[_0xa048('0x24')](function(_0x441db8){_0x40f55c['rows']=_0x441db8;return _0x40f55c;})[_0xa048('0x24')](respondWithFilteredResult(_0x51d575,_0x2755cf))[_0xa048('0x42')](handleError(_0x51d575,null));};exports['show']=function(_0x4fdb7f,_0xe9a18d){var _0x93461d={'raw':!![],'where':{'id':_0x4fdb7f[_0xa048('0x43')]['id']}},_0x4d302a={};_0x4d302a[_0xa048('0x34')]=_[_0xa048('0x33')](db[_0xa048('0x2d')]['rawAttributes']);_0x4d302a[_0xa048('0x32')]=_[_0xa048('0x33')](_0x4fdb7f[_0xa048('0x32')]);_0x4d302a[_0xa048('0x44')]=_[_0xa048('0x35')](_0x4d302a[_0xa048('0x34')],_0x4d302a[_0xa048('0x32')]);_0x93461d[_0xa048('0x37')]=_[_0xa048('0x35')](_0x4d302a[_0xa048('0x34')],qs[_0xa048('0x36')](_0x4fdb7f[_0xa048('0x32')]['fields']));_0x93461d['attributes']=_0x93461d[_0xa048('0x37')][_0xa048('0x45')]?_0x93461d[_0xa048('0x37')]:_0x4d302a[_0xa048('0x34')];if(_0x4fdb7f[_0xa048('0x32')][_0xa048('0x40')]){_0x93461d[_0xa048('0x41')]=[{'all':!![]}];}_0x93461d=_[_0xa048('0x3e')]({},_0x93461d,_0x4fdb7f['options']);return db[_0xa048('0x2d')][_0xa048('0x46')](_0x93461d)[_0xa048('0x24')](handleEntityNotFound(_0xe9a18d,null))['then'](respondWithResult(_0xe9a18d,null))['catch'](handleError(_0xe9a18d,null));};exports[_0xa048('0x47')]=function(_0x15be97,_0x44fe91){return db[_0xa048('0x2d')][_0xa048('0x47')](_0x15be97['body'],{})['then'](function(_0x1c4b86){var _0x1b7185=_0x15be97[_0xa048('0x48')]['get']({'plain':!![]});if(!_0x1b7185)throw new Error(_0xa048('0x49'));if(_0x1b7185[_0xa048('0x4a')]===_0xa048('0x48')){var _0x41818d=_0x1c4b86[_0xa048('0x26')]({'plain':!![]});var _0x750eed='CmContactHasItems';return db[_0xa048('0x4b')][_0xa048('0x46')]({'where':{'name':_0x750eed,'userProfileId':_0x1b7185['userProfileId']},'raw':!![]})['then'](function(_0xefcd3c){if(_0xefcd3c&&_0xefcd3c[_0xa048('0x4c')]===0x0){return db[_0xa048('0x4d')][_0xa048('0x47')]({'name':_0x41818d[_0xa048('0x29')],'resourceId':_0x41818d['id'],'type':_0xefcd3c['name'],'sectionId':_0xefcd3c['id']},{})[_0xa048('0x24')](function(){return _0x1c4b86;});}else{return _0x1c4b86;}})['catch'](function(_0x5c5da3){logger[_0xa048('0x4e')](_0xa048('0x4f'),_0x5c5da3);throw _0x5c5da3;});}return _0x1c4b86;})[_0xa048('0x24')](respondWithResult(_0x44fe91,0xc9))[_0xa048('0x42')](handleError(_0x44fe91,null));};exports[_0xa048('0x50')]=function(_0x2755fe,_0x4d47c0){if(_0x2755fe[_0xa048('0x51')]['id']){delete _0x2755fe['body']['id'];}return db[_0xa048('0x2d')][_0xa048('0x46')]({'where':{'id':_0x2755fe[_0xa048('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d47c0,null))['then'](saveUpdates(_0x2755fe['body'],null))[_0xa048('0x24')](respondWithResult(_0x4d47c0,null))[_0xa048('0x42')](handleError(_0x4d47c0,null));};exports['destroy']=function(_0xacb17f,_0x4f1151){return db[_0xa048('0x2d')]['find']({'where':{'id':_0xacb17f[_0xa048('0x43')]['id']}})[_0xa048('0x24')](handleEntityNotFound(_0x4f1151,null))['then'](removeEntity(_0x4f1151,null))[_0xa048('0x42')](handleError(_0x4f1151,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index facdfdf..32f79b7 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 _0x92ee=['path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','moment','request-promise'];(function(_0x46ce98,_0x52d764){var _0x172f46=function(_0x10ccee){while(--_0x10ccee){_0x46ce98['push'](_0x46ce98['shift']());}};_0x172f46(++_0x52d764);}(_0x92ee,0xc2));var _0xe92e=function(_0x5c10d3,_0x3a3b3a){_0x5c10d3=_0x5c10d3-0x0;var _0x2cbab4=_0x92ee[_0x5c10d3];return _0x2cbab4;};'use strict';var _=require(_0xe92e('0x0'));var util=require(_0xe92e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe92e('0x2'));var BPromise=require('bluebird');var rp=require(_0xe92e('0x3'));var fs=require('fs');var path=require(_0xe92e('0x4'));var rimraf=require('rimraf');var config=require(_0xe92e('0x5'));var attributes=require(_0xe92e('0x6'));module[_0xe92e('0x7')]=function(_0x87889a,_0x1ed1d3){return _0x87889a[_0xe92e('0x8')](_0xe92e('0x9'),attributes,{'tableName':_0xe92e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc577=['exports','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes'];(function(_0x25019f,_0x243013){var _0x3f0abd=function(_0x3a4984){while(--_0x3a4984){_0x25019f['push'](_0x25019f['shift']());}};_0x3f0abd(++_0x243013);}(_0xc577,0x108));var _0x7c57=function(_0x3a4a66,_0x5afde4){_0x3a4a66=_0x3a4a66-0x0;var _0x2bd136=_0xc577[_0x3a4a66];return _0x2bd136;};'use strict';var _=require('lodash');var util=require(_0x7c57('0x0'));var logger=require(_0x7c57('0x1'))(_0x7c57('0x2'));var moment=require(_0x7c57('0x3'));var BPromise=require(_0x7c57('0x4'));var rp=require(_0x7c57('0x5'));var fs=require('fs');var path=require(_0x7c57('0x6'));var rimraf=require(_0x7c57('0x7'));var config=require('../../config/environment');var attributes=require(_0x7c57('0x8'));module[_0x7c57('0x9')]=function(_0x1687c6,_0x1e27fa){return _0x1687c6[_0x7c57('0xa')](_0x7c57('0xb'),attributes,{'tableName':_0x7c57('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 19d85a5..dcc2d2d 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 _0x8d37=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x5c0c37,_0x3d39fc){var _0x4c2a6b=function(_0x377379){while(--_0x377379){_0x5c0c37['push'](_0x5c0c37['shift']());}};_0x4c2a6b(++_0x3d39fc);}(_0x8d37,0x16e));var _0x78d3=function(_0x2a5fc9,_0x3ba271){_0x2a5fc9=_0x2a5fc9-0x0;var _0x138443=_0x8d37[_0x2a5fc9];return _0x138443;};'use strict';var _=require(_0x78d3('0x0'));var util=require('util');var moment=require(_0x78d3('0x1'));var BPromise=require(_0x78d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78d3('0x3'));var db=require(_0x78d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x78d3('0x5'))(_0x78d3('0x6'));var config=require(_0x78d3('0x7'));var jayson=require(_0x78d3('0x8'));var client=jayson['client'][_0x78d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b6b47,_0x5ad2e7,_0x4b478f){return new BPromise(function(_0x56eb4b,_0x6ff853){return client[_0x78d3('0xa')](_0x5b6b47,_0x4b478f)[_0x78d3('0xb')](function(_0x320afb){logger[_0x78d3('0xc')](_0x78d3('0xd'),_0x5ad2e7,_0x78d3('0xe'));logger[_0x78d3('0xf')](_0x78d3('0x10'),_0x5ad2e7,_0x78d3('0xe'),JSON[_0x78d3('0x11')](_0x320afb));if(_0x320afb[_0x78d3('0x12')]){if(_0x320afb['error'][_0x78d3('0x13')]===0x1f4){logger[_0x78d3('0x12')](_0x78d3('0xd'),_0x5ad2e7,_0x320afb[_0x78d3('0x12')]['message']);return _0x6ff853(_0x320afb['error']['message']);}logger[_0x78d3('0x12')](_0x78d3('0xd'),_0x5ad2e7,_0x320afb['error'][_0x78d3('0x14')]);return _0x56eb4b(_0x320afb[_0x78d3('0x12')][_0x78d3('0x14')]);}else{logger[_0x78d3('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x5ad2e7,_0x78d3('0xe'));_0x56eb4b(_0x320afb[_0x78d3('0x15')][_0x78d3('0x14')]);}})[_0x78d3('0x16')](function(_0x5af658){logger['error'](_0x78d3('0xd'),_0x5ad2e7,_0x5af658);_0x6ff853(_0x5af658);});});} \ No newline at end of file +var _0xd9af=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5f506f,_0xf3ec98){var _0x4ab880=function(_0x1a6c91){while(--_0x1a6c91){_0x5f506f['push'](_0x5f506f['shift']());}};_0x4ab880(++_0xf3ec98);}(_0xd9af,0x1b7));var _0xfd9a=function(_0x5ee6ea,_0x104dac){_0x5ee6ea=_0x5ee6ea-0x0;var _0x43d633=_0xd9af[_0x5ee6ea];return _0x43d633;};'use strict';var _=require(_0xfd9a('0x0'));var util=require(_0xfd9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd9a('0x3'))['db'];var utils=require(_0xfd9a('0x4'));var logger=require(_0xfd9a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd9a('0x6'));var client=jayson[_0xfd9a('0x7')][_0xfd9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912266,_0x4088de,_0x403c84){return new BPromise(function(_0x2d9988,_0x3659d0){return client[_0xfd9a('0x9')](_0x912266,_0x403c84)['then'](function(_0x141e90){logger[_0xfd9a('0xa')](_0xfd9a('0xb'),_0x4088de,_0xfd9a('0xc'));logger['debug'](_0xfd9a('0xd'),_0x4088de,_0xfd9a('0xc'),JSON[_0xfd9a('0xe')](_0x141e90));if(_0x141e90[_0xfd9a('0xf')]){if(_0x141e90['error'][_0xfd9a('0x10')]===0x1f4){logger[_0xfd9a('0xf')](_0xfd9a('0xb'),_0x4088de,_0x141e90[_0xfd9a('0xf')][_0xfd9a('0x11')]);return _0x3659d0(_0x141e90[_0xfd9a('0xf')]['message']);}logger[_0xfd9a('0xf')](_0xfd9a('0xb'),_0x4088de,_0x141e90['error'][_0xfd9a('0x11')]);return _0x2d9988(_0x141e90[_0xfd9a('0xf')]['message']);}else{logger['info'](_0xfd9a('0xb'),_0x4088de,_0xfd9a('0xc'));_0x2d9988(_0x141e90[_0xfd9a('0x12')][_0xfd9a('0x11')]);}})[_0xfd9a('0x13')](function(_0x112460){logger[_0xfd9a('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x4088de,_0x112460);_0x3659d0(_0x112460);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 25f8cce..246d484 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 _0xceee=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','show','post','create','put','/:id'];(function(_0x14da60,_0x5e6ae0){var _0x55dd8c=function(_0x5ac403){while(--_0x5ac403){_0x14da60['push'](_0x14da60['shift']());}};_0x55dd8c(++_0x5e6ae0);}(_0xceee,0xff));var _0xecee=function(_0xd711ab,_0x1a363e){_0xd711ab=_0xd711ab-0x0;var _0x4d05fb=_0xceee[_0xd711ab];return _0x4d05fb;};'use strict';var multer=require(_0xecee('0x0'));var util=require(_0xecee('0x1'));var path=require(_0xecee('0x2'));var timeout=require(_0xecee('0x3'));var express=require('express');var router=express[_0xecee('0x4')]();var fs_extra=require(_0xecee('0x5'));var auth=require(_0xecee('0x6'));var interaction=require(_0xecee('0x7'));var config=require(_0xecee('0x8'));var controller=require(_0xecee('0x9'));router['get']('/',auth[_0xecee('0xa')](),controller[_0xecee('0xb')]);router[_0xecee('0xc')]('/:id',auth[_0xecee('0xa')](),controller[_0xecee('0xd')]);router[_0xecee('0xe')]('/',auth[_0xecee('0xa')](),controller[_0xecee('0xf')]);router[_0xecee('0x10')](_0xecee('0x11'),auth[_0xecee('0xa')](),controller[_0xecee('0x12')]);router['delete'](_0xecee('0x11'),auth[_0xecee('0xa')](),controller[_0xecee('0x13')]);module[_0xecee('0x14')]=router; \ No newline at end of file +var _0xee12=['./cmContactHasItem.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3e89fe,_0x758fbe){var _0x40a300=function(_0xc8c2e0){while(--_0xc8c2e0){_0x3e89fe['push'](_0x3e89fe['shift']());}};_0x40a300(++_0x758fbe);}(_0xee12,0xc5));var _0x2ee1=function(_0x1eacde,_0x3282ed){_0x1eacde=_0x1eacde-0x0;var _0x481230=_0xee12[_0x1eacde];return _0x481230;};'use strict';var multer=require(_0x2ee1('0x0'));var util=require(_0x2ee1('0x1'));var path=require(_0x2ee1('0x2'));var timeout=require(_0x2ee1('0x3'));var express=require(_0x2ee1('0x4'));var router=express[_0x2ee1('0x5')]();var fs_extra=require(_0x2ee1('0x6'));var auth=require(_0x2ee1('0x7'));var interaction=require(_0x2ee1('0x8'));var config=require(_0x2ee1('0x9'));var controller=require(_0x2ee1('0xa'));router[_0x2ee1('0xb')]('/',auth['isAuthenticated'](),controller[_0x2ee1('0xc')]);router[_0x2ee1('0xb')](_0x2ee1('0xd'),auth['isAuthenticated'](),controller[_0x2ee1('0xe')]);router[_0x2ee1('0xf')]('/',auth[_0x2ee1('0x10')](),controller[_0x2ee1('0x11')]);router[_0x2ee1('0x12')](_0x2ee1('0xd'),auth[_0x2ee1('0x10')](),controller[_0x2ee1('0x13')]);router[_0x2ee1('0x14')](_0x2ee1('0xd'),auth['isAuthenticated'](),controller[_0x2ee1('0x15')]);module[_0x2ee1('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index c3e2b90..8f4859d 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 _0xa9b6=['select','parse','values','setDataValue','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','type'];(function(_0x33ccb6,_0x1ab105){var _0x478b54=function(_0x38708e){while(--_0x38708e){_0x33ccb6['push'](_0x33ccb6['shift']());}};_0x478b54(++_0x1ab105);}(_0xa9b6,0x1ba));var _0x6a9b=function(_0x281d51,_0xb81751){_0x281d51=_0x281d51-0x0;var _0x333b25=_0xa9b6[_0x281d51];return _0x333b25;};'use strict';var Sequelize=require(_0x6a9b('0x0'));var _=require(_0x6a9b('0x1'));module[_0x6a9b('0x2')]={'name':{'type':Sequelize[_0x6a9b('0x3')],'get':function(_0x452554){return this[_0x6a9b('0x4')](_0x6a9b('0x5'));}},'alias':{'type':Sequelize[_0x6a9b('0x6')],'allowNull':![],'set':function(_0x505f84){this['setDataValue'](_0x6a9b('0x5'),_0x505f84?_0x505f84:this[_0x6a9b('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0x6a9b('0x7'))===_0x6a9b('0x8')){return JSON[_0x6a9b('0x9')](this[_0x6a9b('0x4')](_0x6a9b('0xa')));}else{return this[_0x6a9b('0x4')](_0x6a9b('0xa'));}},'set':function(_0x7d4e28){if(Array['isArray'](_0x7d4e28)){this[_0x6a9b('0xb')](_0x6a9b('0xa'),JSON[_0x6a9b('0xc')](_0x7d4e28));}else{this['setDataValue'](_0x6a9b('0xa'),_0x7d4e28);}}},'required':{'type':Sequelize[_0x6a9b('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6a9b('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6a9b('0xe')]('voice')}}; \ No newline at end of file +var _0xde58=['STRING','setDataValue','name','type','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','alias'];(function(_0xebd5e7,_0x3185ff){var _0x11c2d5=function(_0x5537c6){while(--_0x5537c6){_0xebd5e7['push'](_0xebd5e7['shift']());}};_0x11c2d5(++_0x3185ff);}(_0xde58,0x6c));var _0x8de5=function(_0xec92ff,_0x6ff1f4){_0xec92ff=_0xec92ff-0x0;var _0x17fea7=_0xde58[_0xec92ff];return _0x17fea7;};'use strict';var Sequelize=require(_0x8de5('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x8de5('0x1')],'get':function(_0x27be22){return this[_0x8de5('0x2')](_0x8de5('0x3'));}},'alias':{'type':Sequelize[_0x8de5('0x4')],'allowNull':![],'set':function(_0x3eb91a){this[_0x8de5('0x5')](_0x8de5('0x3'),_0x3eb91a?_0x3eb91a:this['getDataValue'](_0x8de5('0x6')));}},'type':{'type':Sequelize[_0x8de5('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x8de5('0x2')](_0x8de5('0x7'))==='select'){return JSON[_0x8de5('0x8')](this[_0x8de5('0x2')](_0x8de5('0x9')));}else{return this[_0x8de5('0x2')](_0x8de5('0x9'));}},'set':function(_0x19a08f){if(Array['isArray'](_0x19a08f)){this[_0x8de5('0x5')](_0x8de5('0x9'),JSON[_0x8de5('0xa')](_0x19a08f));}else{this[_0x8de5('0x5')](_0x8de5('0x9'),_0x19a08f);}}},'required':{'type':Sequelize[_0x8de5('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8de5('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8de5('0xc')](_0x8de5('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4faf10d..6ae2be2 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 _0x1b1f=['update','body','create','Sequelize','TEXT','switch','BOOLEAN','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../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','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCustomField','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x5a9feb,_0x5b9fcf){var _0xcf1834=function(_0x120fb2){while(--_0x120fb2){_0x5a9feb['push'](_0x5a9feb['shift']());}};_0xcf1834(++_0x5b9fcf);}(_0x1b1f,0x1b4));var _0xf1b1=function(_0x42b456,_0x6d573){_0x42b456=_0x42b456-0x0;var _0x2126d7=_0x1b1f[_0x42b456];return _0x2126d7;};'use strict';var emlformat=require(_0xf1b1('0x0'));var rimraf=require(_0xf1b1('0x1'));var zipdir=require(_0xf1b1('0x2'));var jsonpatch=require(_0xf1b1('0x3'));var rp=require(_0xf1b1('0x4'));var moment=require(_0xf1b1('0x5'));var BPromise=require(_0xf1b1('0x6'));var Mustache=require(_0xf1b1('0x7'));var util=require(_0xf1b1('0x8'));var path=require('path');var sox=require(_0xf1b1('0x9'));var csv=require(_0xf1b1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1b1('0xb'));var _=require('lodash');var squel=require(_0xf1b1('0xc'));var crypto=require(_0xf1b1('0xd'));var jsforce=require(_0xf1b1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf1b1('0xa'));var querystring=require('querystring');var Papa=require(_0xf1b1('0xf'));var Redis=require('ioredis');var authService=require(_0xf1b1('0x10'));var qs=require(_0xf1b1('0x11'));var as=require(_0xf1b1('0x12'));var hardwareService=require(_0xf1b1('0x13'));var logger=require('../../config/logger')(_0xf1b1('0x14'));var utils=require(_0xf1b1('0x15'));var config=require(_0xf1b1('0x16'));var licenseUtil=require(_0xf1b1('0x17'));var db=require(_0xf1b1('0x18'))['db'];function respondWithStatusCode(_0x1291f2,_0x25a912){_0x25a912=_0x25a912||0xcc;return function(_0x445d6b){if(_0x445d6b){return _0x1291f2[_0xf1b1('0x19')](_0x25a912);}return _0x1291f2[_0xf1b1('0x1a')](_0x25a912)[_0xf1b1('0x1b')]();};}function respondWithResult(_0x22c5eb,_0x4ca47b){_0x4ca47b=_0x4ca47b||0xc8;return function(_0x14694d){if(_0x14694d){return _0x22c5eb['status'](_0x4ca47b)[_0xf1b1('0x1c')](_0x14694d);}};}function respondWithFilteredResult(_0x4d20d5,_0x41fe5f){return function(_0x3003e6){if(_0x3003e6){var _0x1a5e82=typeof _0x41fe5f['offset']===_0xf1b1('0x1d')&&typeof _0x41fe5f[_0xf1b1('0x1e')]===_0xf1b1('0x1d');var _0x1ba43e=_0x3003e6[_0xf1b1('0x1f')];var _0xd16d6f=_0x1a5e82?0x0:_0x41fe5f['offset'];var _0x253fcf=_0x1a5e82?_0x3003e6['count']:_0x41fe5f[_0xf1b1('0x20')]+_0x41fe5f['limit'];var _0x3482ad;if(_0x253fcf>=_0x1ba43e){_0x253fcf=_0x1ba43e;_0x3482ad=0xc8;}else{_0x3482ad=0xce;}_0x4d20d5[_0xf1b1('0x1a')](_0x3482ad);return _0x4d20d5[_0xf1b1('0x21')](_0xf1b1('0x22'),_0xd16d6f+'-'+_0x253fcf+'/'+_0x1ba43e)[_0xf1b1('0x1c')](_0x3003e6);}return null;};}function patchUpdates(_0x512906){return function(_0xd681d7){try{jsonpatch[_0xf1b1('0x23')](_0xd681d7,_0x512906,!![]);}catch(_0x3afc2c){return BPromise[_0xf1b1('0x24')](_0x3afc2c);}return _0xd681d7[_0xf1b1('0x25')]();};}function saveUpdates(_0x304d6b,_0x3bcf77){return function(_0x5b382a){if(_0x5b382a){return _0x5b382a['update'](_0x304d6b)[_0xf1b1('0x26')](function(_0x1e5e13){return _0x1e5e13;});}return null;};}function removeEntity(_0x15f6c0,_0x12fae0){return function(_0x39cb0d){if(_0x39cb0d){return _0x39cb0d[_0xf1b1('0x27')]()[_0xf1b1('0x26')](function(){_0x15f6c0[_0xf1b1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5b93,_0x1bf35c){return function(_0x500911){if(!_0x500911){_0x1c5b93[_0xf1b1('0x19')](0x194);}return _0x500911;};}function handleError(_0x3176ab,_0x463662){_0x463662=_0x463662||0x1f4;return function(_0x473dd8){logger[_0xf1b1('0x28')](_0x473dd8[_0xf1b1('0x29')]);if(_0x473dd8[_0xf1b1('0x2a')]){delete _0x473dd8[_0xf1b1('0x2a')];}_0x3176ab[_0xf1b1('0x1a')](_0x463662)['send'](_0x473dd8);};}exports['index']=function(_0x49baa0,_0x577a3e){var _0x9d5723={},_0x1b0a54={},_0x24ffad={'count':0x0,'rows':[]};var _0x1e2d66=_[_0xf1b1('0x2b')](db['CmCustomField'][_0xf1b1('0x2c')],function(_0xeee193){return{'name':_0xeee193[_0xf1b1('0x2d')],'type':_0xeee193[_0xf1b1('0x2e')][_0xf1b1('0x2f')]};});_0x1b0a54[_0xf1b1('0x30')]=_['differenceBy'](_['map'](_0x1e2d66,_0xf1b1('0x2a')),['name']);_0x1b0a54[_0xf1b1('0x31')]=_[_0xf1b1('0x32')](_0x49baa0['query']);_0x1b0a54[_0xf1b1('0x33')]=_[_0xf1b1('0x34')](_0x1b0a54[_0xf1b1('0x30')],_0x1b0a54[_0xf1b1('0x31')]);_0x9d5723[_0xf1b1('0x35')]=_[_0xf1b1('0x34')](_0x1b0a54['model'],qs[_0xf1b1('0x36')](_0x49baa0[_0xf1b1('0x31')][_0xf1b1('0x36')]));_0x9d5723[_0xf1b1('0x35')]=_0x9d5723[_0xf1b1('0x35')][_0xf1b1('0x37')]?_0x9d5723[_0xf1b1('0x35')]:_0x1b0a54[_0xf1b1('0x30')];if(!_0x49baa0[_0xf1b1('0x31')][_0xf1b1('0x38')](_0xf1b1('0x39'))){_0x9d5723[_0xf1b1('0x1e')]=qs[_0xf1b1('0x1e')](_0x49baa0[_0xf1b1('0x31')][_0xf1b1('0x1e')]);_0x9d5723[_0xf1b1('0x20')]=qs[_0xf1b1('0x20')](_0x49baa0[_0xf1b1('0x31')][_0xf1b1('0x20')]);}_0x9d5723[_0xf1b1('0x3a')]=qs[_0xf1b1('0x3b')](_0x49baa0[_0xf1b1('0x31')]['sort']);_0x9d5723[_0xf1b1('0x3c')]=qs['filters'](_[_0xf1b1('0x3d')](_0x49baa0[_0xf1b1('0x31')],_0x1b0a54[_0xf1b1('0x33')]),_0x1e2d66);if(_0x49baa0['query'][_0xf1b1('0x3e')]){_0x9d5723['where']=_[_0xf1b1('0x3f')](_0x9d5723[_0xf1b1('0x3c')],{'$or':_[_0xf1b1('0x2b')](_0x1e2d66,function(_0x138e10){if(_0x138e10[_0xf1b1('0x2e')]!=='VIRTUAL'){var _0x32282e={};_0x32282e[_0x138e10[_0xf1b1('0x2a')]]={'$like':'%'+_0x49baa0['query']['filter']+'%'};return _0x32282e;}})});}_0x9d5723=_['merge']({},_0x9d5723,_0x49baa0[_0xf1b1('0x40')]);var _0x59e8bc={'where':_0x9d5723[_0xf1b1('0x3c')]};return db[_0xf1b1('0x41')][_0xf1b1('0x1f')](_0x59e8bc)[_0xf1b1('0x26')](function(_0x2efa7d){_0x24ffad['count']=_0x2efa7d;if(_0x49baa0[_0xf1b1('0x31')][_0xf1b1('0x42')]){_0x9d5723[_0xf1b1('0x43')]=[{'all':!![]}];}return db[_0xf1b1('0x41')][_0xf1b1('0x44')](_0x9d5723);})['then'](function(_0x33e7a9){_0x24ffad[_0xf1b1('0x45')]=_0x33e7a9;return _0x24ffad;})[_0xf1b1('0x26')](respondWithFilteredResult(_0x577a3e,_0x9d5723))[_0xf1b1('0x46')](handleError(_0x577a3e,null));};exports[_0xf1b1('0x47')]=function(_0x5add3f,_0x4335e2){var _0x3c94a3={'raw':!![],'where':{'id':_0x5add3f[_0xf1b1('0x48')]['id']}},_0x36e7a8={};_0x36e7a8[_0xf1b1('0x30')]=_['keys'](db[_0xf1b1('0x41')]['rawAttributes']);_0x36e7a8[_0xf1b1('0x31')]=_[_0xf1b1('0x32')](_0x5add3f[_0xf1b1('0x31')]);_0x36e7a8[_0xf1b1('0x33')]=_[_0xf1b1('0x34')](_0x36e7a8[_0xf1b1('0x30')],_0x36e7a8['query']);_0x3c94a3[_0xf1b1('0x35')]=_['intersection'](_0x36e7a8['model'],qs[_0xf1b1('0x36')](_0x5add3f['query'][_0xf1b1('0x36')]));_0x3c94a3['attributes']=_0x3c94a3[_0xf1b1('0x35')][_0xf1b1('0x37')]?_0x3c94a3[_0xf1b1('0x35')]:_0x36e7a8['model'];if(_0x5add3f[_0xf1b1('0x31')][_0xf1b1('0x42')]){_0x3c94a3[_0xf1b1('0x43')]=[{'all':!![]}];}_0x3c94a3=_['merge']({},_0x3c94a3,_0x5add3f[_0xf1b1('0x40')]);return db[_0xf1b1('0x41')][_0xf1b1('0x49')](_0x3c94a3)[_0xf1b1('0x26')](handleEntityNotFound(_0x4335e2,null))[_0xf1b1('0x26')](respondWithResult(_0x4335e2,null))[_0xf1b1('0x46')](handleError(_0x4335e2,null));};exports[_0xf1b1('0x4a')]=function(_0x51930f,_0x34ae5e){if(_0x51930f[_0xf1b1('0x4b')]['id']){delete _0x51930f[_0xf1b1('0x4b')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x51930f[_0xf1b1('0x48')]['id']}})[_0xf1b1('0x26')](handleEntityNotFound(_0x34ae5e,null))[_0xf1b1('0x26')](saveUpdates(_0x51930f[_0xf1b1('0x4b')],null))[_0xf1b1('0x26')](respondWithResult(_0x34ae5e,null))[_0xf1b1('0x46')](handleError(_0x34ae5e,null));};exports[_0xf1b1('0x27')]=function(_0x5340b0,_0x1d4a8a){return db[_0xf1b1('0x41')][_0xf1b1('0x49')]({'where':{'id':_0x5340b0[_0xf1b1('0x48')]['id']}})[_0xf1b1('0x26')](handleEntityNotFound(_0x1d4a8a,null))[_0xf1b1('0x26')](removeEntity(_0x1d4a8a,null))[_0xf1b1('0x46')](handleError(_0x1d4a8a,null));};exports[_0xf1b1('0x4c')]=function(_0x222f4c,_0x132336){var _0x1e896a;return db['sequelize']['transaction'](function(_0x40a8e0){return db['CmCustomField'][_0xf1b1('0x4c')](_0x222f4c['body'],{'transaction':_0x40a8e0})[_0xf1b1('0x26')](function(_0x25ade0){_0x1e896a=_0x25ade0;var _0x46567b={'type':db[_0xf1b1('0x4d')][_0xf1b1('0x4e')],'transaction':_0x40a8e0};switch(_0x222f4c[_0xf1b1('0x4b')][_0xf1b1('0x2e')]){case'text':_0x46567b[_0xf1b1('0x2e')]=db[_0xf1b1('0x4d')][_0xf1b1('0x4e')];break;case'number':_0x46567b[_0xf1b1('0x2e')]=db['Sequelize']['INTEGER'];break;case _0xf1b1('0x4f'):_0x46567b[_0xf1b1('0x2e')]=db[_0xf1b1('0x4d')][_0xf1b1('0x50')];_0x46567b['defaultValue']=![];break;default:}return db['sequelize'][_0xf1b1('0x51')]['addColumn'](_0xf1b1('0x52'),util[_0xf1b1('0x53')](_0xf1b1('0x54'),_0x1e896a['id']),_0x46567b);})['then'](function(){return _0x1e896a;});})['then'](respondWithResult(_0x132336,0xc9))[_0xf1b1('0x46')](handleError(_0x132336,null));}; \ No newline at end of file +var _0x615e=['rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','then','catch','show','fields','length','find','body','params','create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','CmCustomField'];(function(_0x9ccc17,_0x1d087c){var _0x46e989=function(_0x302510){while(--_0x302510){_0x9ccc17['push'](_0x9ccc17['shift']());}};_0x46e989(++_0x1d087c);}(_0x615e,0x189));var _0xe615=function(_0x402126,_0x148aad){_0x402126=_0x402126-0x0;var _0x3de1d5=_0x615e[_0x402126];return _0x3de1d5;};'use strict';var emlformat=require(_0xe615('0x0'));var rimraf=require(_0xe615('0x1'));var zipdir=require(_0xe615('0x2'));var jsonpatch=require(_0xe615('0x3'));var rp=require('request-promise');var moment=require(_0xe615('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe615('0x5'));var util=require(_0xe615('0x6'));var path=require(_0xe615('0x7'));var sox=require('sox');var csv=require(_0xe615('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe615('0x9'));var crypto=require('crypto');var jsforce=require(_0xe615('0xa'));var deskjs=require(_0xe615('0xb'));var toCsv=require(_0xe615('0x8'));var querystring=require(_0xe615('0xc'));var Papa=require('papaparse');var Redis=require(_0xe615('0xd'));var authService=require(_0xe615('0xe'));var qs=require(_0xe615('0xf'));var as=require(_0xe615('0x10'));var hardwareService=require(_0xe615('0x11'));var logger=require(_0xe615('0x12'))(_0xe615('0x13'));var utils=require('../../config/utils');var config=require(_0xe615('0x14'));var licenseUtil=require(_0xe615('0x15'));var db=require(_0xe615('0x16'))['db'];function respondWithStatusCode(_0x4a4e76,_0x4196b7){_0x4196b7=_0x4196b7||0xcc;return function(_0x15c472){if(_0x15c472){return _0x4a4e76['sendStatus'](_0x4196b7);}return _0x4a4e76[_0xe615('0x17')](_0x4196b7)[_0xe615('0x18')]();};}function respondWithResult(_0x370f4e,_0x4e6344){_0x4e6344=_0x4e6344||0xc8;return function(_0x2657eb){if(_0x2657eb){return _0x370f4e[_0xe615('0x17')](_0x4e6344)[_0xe615('0x19')](_0x2657eb);}};}function respondWithFilteredResult(_0x25be5d,_0x44cb19){return function(_0x2b64d5){if(_0x2b64d5){var _0x190c3e=typeof _0x44cb19[_0xe615('0x1a')]===_0xe615('0x1b')&&typeof _0x44cb19[_0xe615('0x1c')]==='undefined';var _0x5696c3=_0x2b64d5['count'];var _0xb08b3f=_0x190c3e?0x0:_0x44cb19['offset'];var _0x3667e8=_0x190c3e?_0x2b64d5['count']:_0x44cb19['offset']+_0x44cb19[_0xe615('0x1c')];var _0x3a97c4;if(_0x3667e8>=_0x5696c3){_0x3667e8=_0x5696c3;_0x3a97c4=0xc8;}else{_0x3a97c4=0xce;}_0x25be5d[_0xe615('0x17')](_0x3a97c4);return _0x25be5d[_0xe615('0x1d')]('Content-Range',_0xb08b3f+'-'+_0x3667e8+'/'+_0x5696c3)[_0xe615('0x19')](_0x2b64d5);}return null;};}function patchUpdates(_0x3c9d8c){return function(_0xceec7d){try{jsonpatch[_0xe615('0x1e')](_0xceec7d,_0x3c9d8c,!![]);}catch(_0x1b44a6){return BPromise[_0xe615('0x1f')](_0x1b44a6);}return _0xceec7d[_0xe615('0x20')]();};}function saveUpdates(_0x5b53ab,_0x40d7ba){return function(_0x2bc9f5){if(_0x2bc9f5){return _0x2bc9f5[_0xe615('0x21')](_0x5b53ab)['then'](function(_0x571ea5){return _0x571ea5;});}return null;};}function removeEntity(_0x49dcb4,_0x23f048){return function(_0x3e4f90){if(_0x3e4f90){return _0x3e4f90[_0xe615('0x22')]()['then'](function(){_0x49dcb4[_0xe615('0x17')](0xcc)[_0xe615('0x18')]();});}};}function handleEntityNotFound(_0x520d1c,_0xca7197){return function(_0x25ec29){if(!_0x25ec29){_0x520d1c['sendStatus'](0x194);}return _0x25ec29;};}function handleError(_0x10ad1e,_0x268afd){_0x268afd=_0x268afd||0x1f4;return function(_0xca096f){logger[_0xe615('0x23')](_0xca096f[_0xe615('0x24')]);if(_0xca096f[_0xe615('0x25')]){delete _0xca096f[_0xe615('0x25')];}_0x10ad1e[_0xe615('0x17')](_0x268afd)[_0xe615('0x26')](_0xca096f);};}exports[_0xe615('0x27')]=function(_0x468261,_0x171901){var _0x24641f={},_0x3cc680={},_0x4aacbb={'count':0x0,'rows':[]};var _0x1bb45c=_[_0xe615('0x28')](db[_0xe615('0x29')][_0xe615('0x2a')],function(_0x19d542){return{'name':_0x19d542[_0xe615('0x2b')],'type':_0x19d542[_0xe615('0x2c')]['key']};});_0x3cc680[_0xe615('0x2d')]=_[_0xe615('0x2e')](_[_0xe615('0x28')](_0x1bb45c,'name'),[_0xe615('0x25')]);_0x3cc680[_0xe615('0x2f')]=_[_0xe615('0x30')](_0x468261[_0xe615('0x2f')]);_0x3cc680[_0xe615('0x31')]=_[_0xe615('0x32')](_0x3cc680['model'],_0x3cc680[_0xe615('0x2f')]);_0x24641f[_0xe615('0x33')]=_[_0xe615('0x32')](_0x3cc680[_0xe615('0x2d')],qs['fields'](_0x468261['query']['fields']));_0x24641f[_0xe615('0x33')]=_0x24641f[_0xe615('0x33')]['length']?_0x24641f[_0xe615('0x33')]:_0x3cc680[_0xe615('0x2d')];if(!_0x468261['query']['hasOwnProperty'](_0xe615('0x34'))){_0x24641f[_0xe615('0x1c')]=qs[_0xe615('0x1c')](_0x468261[_0xe615('0x2f')][_0xe615('0x1c')]);_0x24641f['offset']=qs['offset'](_0x468261[_0xe615('0x2f')][_0xe615('0x1a')]);}_0x24641f['order']=qs[_0xe615('0x35')](_0x468261[_0xe615('0x2f')][_0xe615('0x35')]);_0x24641f[_0xe615('0x36')]=qs[_0xe615('0x31')](_[_0xe615('0x37')](_0x468261[_0xe615('0x2f')],_0x3cc680[_0xe615('0x31')]),_0x1bb45c);if(_0x468261[_0xe615('0x2f')][_0xe615('0x38')]){_0x24641f[_0xe615('0x36')]=_[_0xe615('0x39')](_0x24641f[_0xe615('0x36')],{'$or':_['map'](_0x1bb45c,function(_0xd8a56f){if(_0xd8a56f['type']!==_0xe615('0x3a')){var _0x2a8b4b={};_0x2a8b4b[_0xd8a56f[_0xe615('0x25')]]={'$like':'%'+_0x468261[_0xe615('0x2f')][_0xe615('0x38')]+'%'};return _0x2a8b4b;}})});}_0x24641f=_[_0xe615('0x39')]({},_0x24641f,_0x468261[_0xe615('0x3b')]);var _0x59493c={'where':_0x24641f[_0xe615('0x36')]};return db[_0xe615('0x29')][_0xe615('0x3c')](_0x59493c)['then'](function(_0xc9fa8f){_0x4aacbb[_0xe615('0x3c')]=_0xc9fa8f;if(_0x468261['query'][_0xe615('0x3d')]){_0x24641f[_0xe615('0x3e')]=[{'all':!![]}];}return db['CmCustomField'][_0xe615('0x3f')](_0x24641f);})['then'](function(_0x50952a){_0x4aacbb[_0xe615('0x40')]=_0x50952a;return _0x4aacbb;})[_0xe615('0x41')](respondWithFilteredResult(_0x171901,_0x24641f))[_0xe615('0x42')](handleError(_0x171901,null));};exports[_0xe615('0x43')]=function(_0x26ae64,_0x3f3a79){var _0x307058={'raw':!![],'where':{'id':_0x26ae64['params']['id']}},_0x399830={};_0x399830[_0xe615('0x2d')]=_[_0xe615('0x30')](db[_0xe615('0x29')][_0xe615('0x2a')]);_0x399830[_0xe615('0x2f')]=_[_0xe615('0x30')](_0x26ae64[_0xe615('0x2f')]);_0x399830[_0xe615('0x31')]=_['intersection'](_0x399830[_0xe615('0x2d')],_0x399830[_0xe615('0x2f')]);_0x307058[_0xe615('0x33')]=_['intersection'](_0x399830['model'],qs['fields'](_0x26ae64[_0xe615('0x2f')][_0xe615('0x44')]));_0x307058[_0xe615('0x33')]=_0x307058[_0xe615('0x33')][_0xe615('0x45')]?_0x307058[_0xe615('0x33')]:_0x399830[_0xe615('0x2d')];if(_0x26ae64[_0xe615('0x2f')][_0xe615('0x3d')]){_0x307058[_0xe615('0x3e')]=[{'all':!![]}];}_0x307058=_[_0xe615('0x39')]({},_0x307058,_0x26ae64[_0xe615('0x3b')]);return db[_0xe615('0x29')][_0xe615('0x46')](_0x307058)['then'](handleEntityNotFound(_0x3f3a79,null))[_0xe615('0x41')](respondWithResult(_0x3f3a79,null))[_0xe615('0x42')](handleError(_0x3f3a79,null));};exports[_0xe615('0x21')]=function(_0x4cb031,_0x77deb8){if(_0x4cb031[_0xe615('0x47')]['id']){delete _0x4cb031[_0xe615('0x47')]['id'];}return db[_0xe615('0x29')]['find']({'where':{'id':_0x4cb031[_0xe615('0x48')]['id']}})[_0xe615('0x41')](handleEntityNotFound(_0x77deb8,null))[_0xe615('0x41')](saveUpdates(_0x4cb031[_0xe615('0x47')],null))[_0xe615('0x41')](respondWithResult(_0x77deb8,null))[_0xe615('0x42')](handleError(_0x77deb8,null));};exports[_0xe615('0x22')]=function(_0xf6a573,_0x529e49){return db[_0xe615('0x29')][_0xe615('0x46')]({'where':{'id':_0xf6a573[_0xe615('0x48')]['id']}})[_0xe615('0x41')](handleEntityNotFound(_0x529e49,null))[_0xe615('0x41')](removeEntity(_0x529e49,null))[_0xe615('0x42')](handleError(_0x529e49,null));};exports[_0xe615('0x49')]=function(_0x37a0a9,_0xa4848c){var _0x5394c3;return db['sequelize'][_0xe615('0x4a')](function(_0x1c71fe){return db[_0xe615('0x29')][_0xe615('0x49')](_0x37a0a9[_0xe615('0x47')],{'transaction':_0x1c71fe})[_0xe615('0x41')](function(_0x1f4eaa){_0x5394c3=_0x1f4eaa;var _0x505d30={'type':db['Sequelize']['TEXT'],'transaction':_0x1c71fe};switch(_0x37a0a9[_0xe615('0x47')]['type']){case'text':_0x505d30['type']=db[_0xe615('0x4b')][_0xe615('0x4c')];break;case _0xe615('0x4d'):_0x505d30[_0xe615('0x2c')]=db['Sequelize'][_0xe615('0x4e')];break;case _0xe615('0x4f'):_0x505d30[_0xe615('0x2c')]=db['Sequelize'][_0xe615('0x50')];_0x505d30[_0xe615('0x51')]=![];break;default:}return db[_0xe615('0x52')][_0xe615('0x53')][_0xe615('0x54')]('cm_contacts',util[_0xe615('0x55')](_0xe615('0x56'),_0x5394c3['id']),_0x505d30);})[_0xe615('0x41')](function(){return _0x5394c3;});})[_0xe615('0x41')](respondWithResult(_0xa4848c,0xc9))[_0xe615('0x42')](handleError(_0xa4848c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 873436f..22d8996 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 _0x54f3=['../../config/environment','./cmCustomField.attributes','exports','cm_custom_fields','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x49ad02,_0x1367dc){var _0x34506f=function(_0x3a3bd6){while(--_0x3a3bd6){_0x49ad02['push'](_0x49ad02['shift']());}};_0x34506f(++_0x1367dc);}(_0x54f3,0x164));var _0x354f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x54f3[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x354f('0x0'));var util=require(_0x354f('0x1'));var logger=require(_0x354f('0x2'))(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x354f('0x5'));var rimraf=require(_0x354f('0x6'));var config=require(_0x354f('0x7'));var attributes=require(_0x354f('0x8'));module[_0x354f('0x9')]=function(_0x496dba,_0x46d8aa){return _0x496dba['define']('CmCustomField',attributes,{'tableName':_0x354f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4589=['request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0x4589,0x117));var _0x9458=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x4589[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x9458('0x0'));var util=require(_0x9458('0x1'));var logger=require(_0x9458('0x2'))(_0x9458('0x3'));var moment=require(_0x9458('0x4'));var BPromise=require(_0x9458('0x5'));var rp=require(_0x9458('0x6'));var fs=require('fs');var path=require(_0x9458('0x7'));var rimraf=require(_0x9458('0x8'));var config=require(_0x9458('0x9'));var attributes=require(_0x9458('0xa'));module[_0x9458('0xb')]=function(_0x254ddc,_0x6b6462){return _0x254ddc[_0x9458('0xc')](_0x9458('0xd'),attributes,{'tableName':_0x9458('0xe'),'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 cadce6a..ffbd399 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 _0x0a93=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x37ac95,_0x2d39e4){var _0x4001f6=function(_0x226667){while(--_0x226667){_0x37ac95['push'](_0x37ac95['shift']());}};_0x4001f6(++_0x2d39e4);}(_0x0a93,0x6a));var _0x30a9=function(_0x398730,_0x57099b){_0x398730=_0x398730-0x0;var _0x3b0d30=_0x0a93[_0x398730];return _0x3b0d30;};'use strict';var _=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var moment=require(_0x30a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x30a9('0x3'));var fs=require('fs');var Redis=require(_0x30a9('0x4'));var db=require(_0x30a9('0x5'))['db'];var utils=require(_0x30a9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x30a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c46fb,_0x5ae289,_0x5ed9b4){return new BPromise(function(_0x312a90,_0x3a3f7e){return client[_0x30a9('0x8')](_0x1c46fb,_0x5ed9b4)['then'](function(_0x146fae){logger[_0x30a9('0x9')](_0x30a9('0xa'),_0x5ae289,_0x30a9('0xb'));logger[_0x30a9('0xc')](_0x30a9('0xd'),_0x5ae289,_0x30a9('0xb'),JSON[_0x30a9('0xe')](_0x146fae));if(_0x146fae[_0x30a9('0xf')]){if(_0x146fae['error'][_0x30a9('0x10')]===0x1f4){logger[_0x30a9('0xf')](_0x30a9('0xa'),_0x5ae289,_0x146fae[_0x30a9('0xf')]['message']);return _0x3a3f7e(_0x146fae[_0x30a9('0xf')]['message']);}logger[_0x30a9('0xf')](_0x30a9('0xa'),_0x5ae289,_0x146fae['error']['message']);return _0x312a90(_0x146fae[_0x30a9('0xf')][_0x30a9('0x11')]);}else{logger['info'](_0x30a9('0xa'),_0x5ae289,_0x30a9('0xb'));_0x312a90(_0x146fae[_0x30a9('0x12')][_0x30a9('0x11')]);}})[_0x30a9('0x13')](function(_0x1e7927){logger['error'](_0x30a9('0xa'),_0x5ae289,_0x1e7927);_0x3a3f7e(_0x1e7927);});});} \ No newline at end of file +var _0xde0a=['then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xde0a,0xcb));var _0xade0=function(_0x562a41,_0x57565d){_0x562a41=_0x562a41-0x0;var _0x1dee1c=_0xde0a[_0x562a41];return _0x1dee1c;};'use strict';var _=require(_0xade0('0x0'));var util=require(_0xade0('0x1'));var moment=require(_0xade0('0x2'));var BPromise=require(_0xade0('0x3'));var rs=require(_0xade0('0x4'));var fs=require('fs');var Redis=require(_0xade0('0x5'));var db=require(_0xade0('0x6'))['db'];var utils=require(_0xade0('0x7'));var logger=require(_0xade0('0x8'))(_0xade0('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xade0('0xa')][_0xade0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23abea,_0xd24511,_0x1f9471){return new BPromise(function(_0x5f3000,_0xb6264b){return client[_0xade0('0xc')](_0x23abea,_0x1f9471)[_0xade0('0xd')](function(_0x32b4b4){logger[_0xade0('0xe')](_0xade0('0xf'),_0xd24511,_0xade0('0x10'));logger[_0xade0('0x11')](_0xade0('0x12'),_0xd24511,_0xade0('0x10'),JSON[_0xade0('0x13')](_0x32b4b4));if(_0x32b4b4[_0xade0('0x14')]){if(_0x32b4b4[_0xade0('0x14')]['code']===0x1f4){logger[_0xade0('0x14')](_0xade0('0xf'),_0xd24511,_0x32b4b4['error'][_0xade0('0x15')]);return _0xb6264b(_0x32b4b4[_0xade0('0x14')][_0xade0('0x15')]);}logger[_0xade0('0x14')](_0xade0('0xf'),_0xd24511,_0x32b4b4[_0xade0('0x14')][_0xade0('0x15')]);return _0x5f3000(_0x32b4b4[_0xade0('0x14')][_0xade0('0x15')]);}else{logger[_0xade0('0xe')](_0xade0('0xf'),_0xd24511,_0xade0('0x10'));_0x5f3000(_0x32b4b4[_0xade0('0x16')][_0xade0('0x15')]);}})[_0xade0('0x17')](function(_0xf68a3c){logger['error'](_0xade0('0xf'),_0xd24511,_0xf68a3c);_0xb6264b(_0xf68a3c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 94bfa37..2b30e0d 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 _0x56a4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5d7b48,_0x1c8eaa){var _0x31bd82=function(_0x3632d5){while(--_0x3632d5){_0x5d7b48['push'](_0x5d7b48['shift']());}};_0x31bd82(++_0x1c8eaa);}(_0x56a4,0x11b));var _0x456a=function(_0x5c7055,_0x550d42){_0x5c7055=_0x5c7055-0x0;var _0x20d196=_0x56a4[_0x5c7055];return _0x20d196;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/:id',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0xc')]('/',auth['isAuthenticated'](),controller[_0x456a('0xd')]);router['put'](_0x456a('0xe'),auth[_0x456a('0xa')](),controller[_0x456a('0xf')]);router[_0x456a('0x10')](_0x456a('0xe'),auth[_0x456a('0xa')](),controller[_0x456a('0x11')]);module[_0x456a('0x12')]=router; \ No newline at end of file +var _0x5292=['/:id','post','isAuthenticated','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x5292,0xf7));var _0x2529=function(_0xce2009,_0x1f8cf8){_0xce2009=_0xce2009-0x0;var _0x1c83cb=_0x5292[_0xce2009];return _0x1c83cb;};'use strict';var multer=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var path=require('path');var timeout=require(_0x2529('0x2'));var express=require('express');var router=express[_0x2529('0x3')]();var fs_extra=require(_0x2529('0x4'));var auth=require(_0x2529('0x5'));var interaction=require(_0x2529('0x6'));var config=require('../../config/environment');var controller=require(_0x2529('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2529('0x8')](_0x2529('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2529('0xa')]('/',auth[_0x2529('0xb')](),controller['create']);router[_0x2529('0xc')](_0x2529('0x9'),auth[_0x2529('0xb')](),controller[_0x2529('0xd')]);router[_0x2529('0xe')](_0x2529('0x9'),auth[_0x2529('0xb')](),controller[_0x2529('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 312aaa4..33bd48b 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 _0xaa38=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','STRING'];(function(_0x5cda92,_0x53897d){var _0x395468=function(_0x2d0133){while(--_0x2d0133){_0x5cda92['push'](_0x5cda92['shift']());}};_0x395468(++_0x53897d);}(_0xaa38,0x156));var _0x8aa3=function(_0x1c0285,_0x1dc1ce){_0x1c0285=_0x1c0285-0x0;var _0x395e76=_0xaa38[_0x1c0285];return _0x395e76;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x8aa3('0x0')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8aa3('0x1')],'defaultValue':moment()['format'](_0x8aa3('0x2'))},'countbusyretry':{'type':Sequelize[_0x8aa3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8aa3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8aa3('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8aa3('0x1')]},'priority':{'type':Sequelize[_0x8aa3('0x3')](0x2)[_0x8aa3('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8aa3('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8aa3('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8aa3('0x3')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x8aa3('0x3')]},'VoiceQueueId':{'type':Sequelize[_0x8aa3('0x3')],'unique':_0x8aa3('0x6')},'CampaignId':{'type':Sequelize[_0x8aa3('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8aa3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8aa3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8aa3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8aa3('0x3')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8aa3('0x0')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8aa3('0x1')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa30e=['STRING','UNSIGNED','contactListQueue','moment','sequelize','BOOLEAN','format','INTEGER'];(function(_0x11ba9b,_0x3a1a80){var _0x3bbcaa=function(_0x1124b4){while(--_0x1124b4){_0x11ba9b['push'](_0x11ba9b['shift']());}};_0x3bbcaa(++_0x3a1a80);}(_0xa30e,0x163));var _0xea30=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0xa30e[_0x2a2e72];return _0x3cfb4a;};'use strict';var moment=require(_0xea30('0x0'));var Sequelize=require(_0xea30('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xea30('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xea30('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea30('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea30('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xea30('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea30('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xea30('0x4')](0x2)[_0xea30('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xea30('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea30('0x4')],'unique':_0xea30('0x7')},'ListId':{'type':Sequelize[_0xea30('0x4')],'unique':_0xea30('0x7')},'UserId':{'type':Sequelize[_0xea30('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xea30('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xea30('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xea30('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea30('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea30('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea30('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xea30('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea30('0x5')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e055f4d..ab3716b 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 _0x3baf=['then','sendStatus','stack','name','send','index','CmHopper','rawAttributes','type','key','model','map','query','keys','filters','concat','$gt','$gte','$lte','$ne','$between','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','create','body','find','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','recallme','UPDATE','getOpenContacts','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','limit','count','offset','set','Content-Range','update'];(function(_0x5ebe85,_0x1cd906){var _0x4ff5de=function(_0x7d9593){while(--_0x7d9593){_0x5ebe85['push'](_0x5ebe85['shift']());}};_0x4ff5de(++_0x1cd906);}(_0x3baf,0xf7));var _0xf3ba=function(_0x37ef38,_0x2cfe4e){_0x37ef38=_0x37ef38-0x0;var _0x499daa=_0x3baf[_0x37ef38];return _0x499daa;};'use strict';var moment=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));var qs=require(_0xf3ba('0x2'));var logger=require(_0xf3ba('0x3'))(_0xf3ba('0x4'));var shared=require(_0xf3ba('0x5'));var db=require(_0xf3ba('0x6'))['db'];function respondWithResult(_0x306bdd,_0x3e6058){_0x3e6058=_0x3e6058||0xc8;return function(_0x1ae6e6){if(_0x1ae6e6){return _0x306bdd[_0xf3ba('0x7')](_0x3e6058)[_0xf3ba('0x8')](_0x1ae6e6);}};}function respondWithFilteredResult(_0x475268,_0x2e6df2){return function(_0x1284b7){if(_0x1284b7){var _0x4de144=typeof _0x2e6df2['offset']==='undefined'&&typeof _0x2e6df2[_0xf3ba('0x9')]==='undefined';var _0x346f5b=_0x1284b7[_0xf3ba('0xa')];var _0x3ae5fb=_0x4de144?0x0:_0x2e6df2[_0xf3ba('0xb')];var _0x3a5714=_0x4de144?_0x1284b7[_0xf3ba('0xa')]:_0x2e6df2[_0xf3ba('0xb')]+_0x2e6df2[_0xf3ba('0x9')];var _0x32ecd1;if(_0x3a5714>=_0x346f5b){_0x3a5714=_0x346f5b;_0x32ecd1=0xc8;}else{_0x32ecd1=0xce;}_0x475268[_0xf3ba('0x7')](_0x32ecd1);return _0x475268[_0xf3ba('0xc')](_0xf3ba('0xd'),_0x3ae5fb+'-'+_0x3a5714+'/'+_0x346f5b)[_0xf3ba('0x8')](_0x1284b7);}return null;};}function saveUpdates(_0x85939e,_0x26cefe){return function(_0x17673a){if(_0x17673a){return _0x17673a[_0xf3ba('0xe')](_0x85939e)[_0xf3ba('0xf')](function(_0x505b8d){return _0x505b8d;});}return null;};}function handleEntityNotFound(_0x327675,_0x56816b){return function(_0x815037){if(!_0x815037){_0x327675[_0xf3ba('0x10')](0x194);}return _0x815037;};}function handleError(_0x4717be,_0x1e2969){_0x1e2969=_0x1e2969||0x1f4;return function(_0x235c8a){logger['error'](_0x235c8a[_0xf3ba('0x11')]);if(_0x235c8a[_0xf3ba('0x12')]){delete _0x235c8a[_0xf3ba('0x12')];}_0x4717be['status'](_0x1e2969)[_0xf3ba('0x13')](_0x235c8a);};}exports[_0xf3ba('0x14')]=function(_0x430d64,_0x44de40){var _0x4d3c0a={},_0x1e18ed={},_0x3b0d9e={'count':0x0,'rows':[]};var _0x4e601c=_['map'](db[_0xf3ba('0x15')][_0xf3ba('0x16')],function(_0x854fc4){return{'name':_0x854fc4['fieldName'],'type':_0x854fc4[_0xf3ba('0x17')][_0xf3ba('0x18')]};});_0x1e18ed[_0xf3ba('0x19')]=_[_0xf3ba('0x1a')](_0x4e601c,_0xf3ba('0x12'));_0x1e18ed[_0xf3ba('0x1b')]=_[_0xf3ba('0x1c')](_0x430d64['query']);_0x1e18ed['filters']=_['intersection'](_0x1e18ed[_0xf3ba('0x19')],_0x1e18ed[_0xf3ba('0x1b')]);_0x1e18ed[_0xf3ba('0x1d')]=_[_0xf3ba('0x1e')](_0x1e18ed[_0xf3ba('0x1d')],['$and','$or',_0xf3ba('0x1f'),_0xf3ba('0x20'),'$lt',_0xf3ba('0x21'),_0xf3ba('0x22'),'$eq','$not',_0xf3ba('0x23'),_0xf3ba('0x24'),'$in',_0xf3ba('0x25'),_0xf3ba('0x26'),_0xf3ba('0x27'),'$iLike',_0xf3ba('0x28'),'$like','$overlap',_0xf3ba('0x29'),_0xf3ba('0x2a'),'$any']);_0x4d3c0a[_0xf3ba('0x2b')]=_[_0xf3ba('0x2c')](_0x1e18ed['model'],qs['fields'](_0x430d64['query'][_0xf3ba('0x2d')]));_0x4d3c0a[_0xf3ba('0x2b')]=_0x4d3c0a['attributes'][_0xf3ba('0x2e')]?_0x4d3c0a['attributes']:_0x1e18ed['model'];if(!_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x2f')](_0xf3ba('0x30'))){_0x4d3c0a[_0xf3ba('0x9')]=qs[_0xf3ba('0x9')](_0x430d64[_0xf3ba('0x1b')]['limit']);_0x4d3c0a[_0xf3ba('0xb')]=qs['offset'](_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0xb')]);}_0x4d3c0a['order']=qs[_0xf3ba('0x31')](_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x31')]);_0x4d3c0a[_0xf3ba('0x32')]=qs['filters'](_[_0xf3ba('0x33')](_0x430d64['query'],_0x1e18ed['filters']),_0x4e601c);if(_0x430d64['query'][_0xf3ba('0x34')]){_0x4d3c0a[_0xf3ba('0x32')]=_[_0xf3ba('0x35')](_0x4d3c0a[_0xf3ba('0x32')],{'$or':_[_0xf3ba('0x1a')](_0x4e601c,function(_0x55b29b){if(_0x55b29b[_0xf3ba('0x17')]!=='VIRTUAL'){var _0x3a927e={};_0x3a927e[_0x55b29b['name']]={'$like':'%'+_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x34')]+'%'};return _0x3a927e;}})});}_0x4d3c0a=_[_0xf3ba('0x35')]({},_0x4d3c0a,_0x430d64[_0xf3ba('0x36')]);var _0x55d9be={'where':_0x4d3c0a[_0xf3ba('0x32')]};return db[_0xf3ba('0x15')]['count'](_0x55d9be)[_0xf3ba('0xf')](function(_0x2405e5){_0x3b0d9e[_0xf3ba('0xa')]=_0x2405e5;if(_0x430d64[_0xf3ba('0x1b')][_0xf3ba('0x37')]){_0x4d3c0a[_0xf3ba('0x38')]=[{'all':!![]}];}return db[_0xf3ba('0x15')]['findAll'](_0x4d3c0a);})[_0xf3ba('0xf')](function(_0x527092){_0x3b0d9e[_0xf3ba('0x39')]=_0x527092;return _0x3b0d9e;})['then'](respondWithFilteredResult(_0x44de40,_0x4d3c0a))[_0xf3ba('0x3a')](handleError(_0x44de40,null));};exports[_0xf3ba('0x3b')]=function(_0x1251b1,_0x39bbea){var _0x2cbfca={'raw':!![],'where':{'id':_0x1251b1['params']['id']}},_0x5f3dcc={};_0x5f3dcc[_0xf3ba('0x19')]=_[_0xf3ba('0x1c')](db[_0xf3ba('0x15')][_0xf3ba('0x16')]);_0x5f3dcc[_0xf3ba('0x1b')]=_[_0xf3ba('0x1c')](_0x1251b1['query']);_0x5f3dcc[_0xf3ba('0x1d')]=_['intersection'](_0x5f3dcc[_0xf3ba('0x19')],_0x5f3dcc[_0xf3ba('0x1b')]);_0x2cbfca[_0xf3ba('0x2b')]=_[_0xf3ba('0x2c')](_0x5f3dcc[_0xf3ba('0x19')],qs[_0xf3ba('0x2d')](_0x1251b1[_0xf3ba('0x1b')][_0xf3ba('0x2d')]));_0x2cbfca['attributes']=_0x2cbfca[_0xf3ba('0x2b')][_0xf3ba('0x2e')]?_0x2cbfca[_0xf3ba('0x2b')]:_0x5f3dcc[_0xf3ba('0x19')];if(_0x1251b1[_0xf3ba('0x1b')][_0xf3ba('0x37')]){_0x2cbfca[_0xf3ba('0x38')]=[{'all':!![]}];}_0x2cbfca=_['merge']({},_0x2cbfca,_0x1251b1[_0xf3ba('0x36')]);return db[_0xf3ba('0x15')]['find'](_0x2cbfca)[_0xf3ba('0xf')](handleEntityNotFound(_0x39bbea,null))[_0xf3ba('0xf')](respondWithResult(_0x39bbea,null))[_0xf3ba('0x3a')](handleError(_0x39bbea,null));};exports[_0xf3ba('0x3c')]=function(_0x3c454e,_0x6a0ca0){return db[_0xf3ba('0x15')][_0xf3ba('0x3c')](_0x3c454e[_0xf3ba('0x3d')],{})[_0xf3ba('0xf')](respondWithResult(_0x6a0ca0,0xc9))[_0xf3ba('0x3a')](handleError(_0x6a0ca0,null));};exports[_0xf3ba('0xe')]=function(_0x40c152,_0x422655){if(_0x40c152[_0xf3ba('0x3d')]['id']){delete _0x40c152[_0xf3ba('0x3d')]['id'];}return db[_0xf3ba('0x15')][_0xf3ba('0x3e')]({'where':{'id':_0x40c152['params']['id']}})[_0xf3ba('0xf')](handleEntityNotFound(_0x422655,null))[_0xf3ba('0xf')](saveUpdates(_0x40c152['body'],null))[_0xf3ba('0xf')](respondWithResult(_0x422655,null))[_0xf3ba('0x3a')](handleError(_0x422655,null));};exports[_0xf3ba('0x3f')]=function(_0x36f476,_0x52ef61){return db['CmHopper'][_0xf3ba('0x3f')]()[_0xf3ba('0xf')](respondWithResult(_0x52ef61,null))[_0xf3ba('0x3a')](handleError(_0x52ef61,null));};exports[_0xf3ba('0x40')]=function(_0x502483,_0x2d3a0d){var _0xdc71c8;var _0x221050=_0x502483['params']['id'];return db[_0xf3ba('0x15')][_0xf3ba('0x3e')]({'where':{'id':_0x502483[_0xf3ba('0x41')]['id']}})[_0xf3ba('0xf')](handleEntityNotFound(_0x2d3a0d,null))[_0xf3ba('0xf')](function(_0xaaf8b){if(_0xaaf8b){return _0xaaf8b[_0xf3ba('0x40')]()[_0xf3ba('0xf')](function(_0x4620c0){return _0x4620c0;});}})[_0xf3ba('0xf')](function(_0x534426){_0xdc71c8=_0x534426;if(_0x534426){if(_0x534426[_0xf3ba('0x42')]||_0x534426[_0xf3ba('0x43')]){return db[_0x534426[_0xf3ba('0x42')]?_0xf3ba('0x44'):'Campaign'][_0xf3ba('0x3e')]({'where':{'id':_0x534426['VoiceQueueId']?_0x534426['VoiceQueueId']:_0x534426[_0xf3ba('0x43')]},'attributes':['id',_0xf3ba('0x12')],'raw':!![]});}}})[_0xf3ba('0xf')](function(_0x1fc9e6){var _0x410cf6={};if(_0x1fc9e6){_[_0xf3ba('0x35')](_0x410cf6,_[_0xf3ba('0x45')](_0xdc71c8[_0xf3ba('0x46')],['createdAt',_0xf3ba('0x47'),'id']));_0x410cf6[_0xf3ba('0x48')]=0x15;_0x410cf6[_0xf3ba('0x49')]=_0xf3ba('0x4a');_0x410cf6['campaign']=_0x1fc9e6['name'];_0x410cf6[_0xf3ba('0x4b')]=_0x502483[_0xf3ba('0x4c')][_0xf3ba('0x12')];_0x410cf6[_0xf3ba('0x4d')]=_0x502483[_0xf3ba('0x4c')]['id'];_0x410cf6['deleted']=!![];_0x410cf6[_0xf3ba('0x4e')]=moment()['format'](_0xf3ba('0x4f'));_0x410cf6['calleridnum']=_0xdc71c8[_0xf3ba('0x50')];_0x410cf6['campaigntype']=_0xdc71c8[_0xf3ba('0x42')]?_0xf3ba('0x51'):_0xf3ba('0x52');return db[_0xf3ba('0x53')][_0xf3ba('0x3e')]({'where':{'id':_0x410cf6['ContactId']},'attributes':[_0xf3ba('0x54'),_0xf3ba('0x55')]})[_0xf3ba('0xf')](function(_0x494f83){if(!_[_0xf3ba('0x56')](_0x2d3a0d)&&!_['isNil'](_0x494f83[_0xf3ba('0x54')])){_0x410cf6[_0xf3ba('0x57')]=_0x494f83[_0xf3ba('0x54')];if(!_[_0xf3ba('0x56')](_0x494f83[_0xf3ba('0x55')])){_0x410cf6[_0xf3ba('0x57')]+='\x20'+_0x494f83[_0xf3ba('0x55')];}}})[_0xf3ba('0x58')](function(){return db[_0xf3ba('0x59')][_0xf3ba('0x3c')](_0x410cf6);});}})[_0xf3ba('0xf')](function(_0x4f731d){return db[_0xf3ba('0x5a')]['destroy']({'where':{'CmHopperId':_0x221050}});})[_0xf3ba('0xf')](function(){return _0x2d3a0d[_0xf3ba('0x7')](0xcc)[_0xf3ba('0x5b')]();})[_0xf3ba('0x3a')](handleError(_0x2d3a0d,null));};exports['getPreview']=function(_0x26fd3e,_0x307a22){var _0x437458=[];return db[_0xf3ba('0x53')][_0xf3ba('0x3f')]()[_0xf3ba('0xf')](function(_0x3cd4fc){_0x437458=_[_0xf3ba('0x1c')](_0x3cd4fc);return _0x26fd3e[_0xf3ba('0x4c')][_0xf3ba('0x5c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0xf3ba('0xf')](function(_0x172eb7){if(_0x172eb7&&_0x172eb7[_0xf3ba('0x2e')]){return db['sequelize'][_0xf3ba('0x5d')](function(_0x5797a5){var _0x102adb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf3ba('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x172eb7,'id')},'$or':[{'UserId':null},{'UserId':_0x26fd3e[_0xf3ba('0x4c')]['id']}]};var _0x522e55={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x172eb7)[_0xf3ba('0x34')](['dialPreviewAutoRecallMe',0x0])[_0xf3ba('0x1a')]('id')[_0xf3ba('0x5f')]()},'$or':[{'UserId':null},{'UserId':_0x26fd3e[_0xf3ba('0x4c')]['id']}]};var _0x44b33f={'$or':[_0x102adb,_0x522e55]};var _0x540228=[];if(_0x26fd3e[_0xf3ba('0x3d')]['direction']&&_0x26fd3e['body'][_0xf3ba('0x60')]===_0xf3ba('0x61')){if(!_[_0xf3ba('0x62')](_0x26fd3e[_0xf3ba('0x3d')][_0xf3ba('0x63')])){_0x44b33f['id']={'$in':_0x26fd3e[_0xf3ba('0x3d')]['hopperIds']};}_0x540228=[[_0xf3ba('0x64'),_0xf3ba('0x65')],[_0xf3ba('0x66'),_0x172eb7[0x0]['dialOrderByScheduledAt']===_0xf3ba('0x65')?_0xf3ba('0x67'):_0xf3ba('0x65')],db[_0xf3ba('0x68')]['literal'](_0xf3ba('0x69')),['id',_0xf3ba('0x67')]];}else{if(!_[_0xf3ba('0x62')](_0x26fd3e[_0xf3ba('0x3d')][_0xf3ba('0x63')])){_0x44b33f['id']={'$notIn':_0x26fd3e['body'][_0xf3ba('0x63')]};}_0x540228=[[_0xf3ba('0x64'),_0xf3ba('0x67')],[_0xf3ba('0x66'),_0x172eb7[0x0][_0xf3ba('0x6a')]],db[_0xf3ba('0x68')][_0xf3ba('0x6b')](_0xf3ba('0x6c')),['id',_0xf3ba('0x65')]];}return db[_0xf3ba('0x15')][_0xf3ba('0x6d')]({'attributes':['id',_0xf3ba('0x6e'),_0xf3ba('0x50'),'recallme'],'where':_0x44b33f,'order':_0x540228,'transaction':_0x5797a5,'lock':_0x5797a5[_0xf3ba('0x6f')]['UPDATE'],'include':[{'model':db[_0xf3ba('0x53')],'as':_0xf3ba('0x70'),'attributes':_0x437458,'include':[{'model':db[_0xf3ba('0x71')],'as':_0xf3ba('0x72'),'attributes':['id',_0xf3ba('0x12')]}]},{'model':db[_0xf3ba('0x73')],'as':_0xf3ba('0x74'),'attributes':['id',_0xf3ba('0x12')]},{'model':db['VoiceQueue'],'as':_0xf3ba('0x75'),'attributes':['id',_0xf3ba('0x12'),_0xf3ba('0x76')]}]})['then'](function(_0x3e1c39){if(_0x3e1c39){return _0x3e1c39[_0xf3ba('0xe')]({'UserId':_0x26fd3e[_0xf3ba('0x4c')]['id']},{'transaction':_0x5797a5});}});});}})[_0xf3ba('0xf')](handleEntityNotFound(_0x307a22,null))[_0xf3ba('0xf')](respondWithResult(_0x307a22,null))[_0xf3ba('0x3a')](handleError(_0x307a22,null));};exports[_0xf3ba('0x77')]=function(_0x3b1d98,_0x3d966b,_0x4b4267){var _0x588ef2=[];var _0x1060e4=_0x3b1d98[_0xf3ba('0x41')]['id'];var _0x4ce3fc=_0x3b1d98[_0xf3ba('0x4c')]['id'];return db['CmContact'][_0xf3ba('0x3f')]()['then'](function(_0x409f1f){_0x588ef2=_[_0xf3ba('0x1c')](_0x409f1f);return db['sequelize'][_0xf3ba('0x5d')](function(_0x57e5a6){const _0x1105d2={'id':_0x1060e4};return db[_0xf3ba('0x15')][_0xf3ba('0x6d')]({'attributes':['id',_0xf3ba('0x6e'),_0xf3ba('0x78')],'where':_0x1105d2,'transaction':_0x57e5a6,'lock':_0x57e5a6[_0xf3ba('0x6f')][_0xf3ba('0x79')],'include':[{'model':db[_0xf3ba('0x53')],'as':_0xf3ba('0x70'),'attributes':_0x588ef2,'include':[{'model':db['CmCompany'],'as':_0xf3ba('0x72'),'attributes':['id',_0xf3ba('0x12')]}]},{'model':db[_0xf3ba('0x73')],'as':_0xf3ba('0x74'),'attributes':['id',_0xf3ba('0x12')]},{'model':db[_0xf3ba('0x44')],'as':'Queue','attributes':['id',_0xf3ba('0x12'),_0xf3ba('0x76')]}]})[_0xf3ba('0xf')](function(_0x521341){if(_0x521341){return _0x521341[_0xf3ba('0xe')]({'UserId':_0x4ce3fc},{'transaction':_0x57e5a6});}});});})[_0xf3ba('0xf')](handleEntityNotFound(_0x3d966b,null))[_0xf3ba('0xf')](respondWithResult(_0x3d966b,null))[_0xf3ba('0x3a')](handleError(_0x3d966b,null));};exports[_0xf3ba('0x7a')]=function(_0x388170,_0x5b3aef){return _0x388170[_0xf3ba('0x4c')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xf3ba('0x7b')},'attributes':['id'],'raw':!![]})[_0xf3ba('0xf')](function(_0x5c488f){if(_0x5c488f&&_0x5c488f['length']){return db[_0xf3ba('0x15')][_0xf3ba('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf3ba('0x5e')](_0xf3ba('0x4f'))},'VoiceQueueId':{'$in':_[_0xf3ba('0x1a')](_0x5c488f,'id')},'$or':[{'UserId':null},{'UserId':_0x388170[_0xf3ba('0x4c')]['id']}]}});}return 0x0;})[_0xf3ba('0xf')](function(_0x5e78c2){if(!_[_0xf3ba('0x56')](_0x5e78c2)&&_[_0xf3ba('0x7c')](_0x5e78c2)){return _0x5b3aef['status'](0xc8)[_0xf3ba('0x8')]({'contacts':_0x5e78c2});}else{logger[_0xf3ba('0x7d')](_0xf3ba('0x7e'),_0xf3ba('0x7a'),0x194,_0xf3ba('0x7f'));_0x5b3aef[_0xf3ba('0x10')](0x194);}})[_0xf3ba('0x3a')](handleError(_0x5b3aef,null));};exports[_0xf3ba('0x80')]=function(_0x499ac3,_0x504e6a){var _0x5626a1=shared[_0xf3ba('0x81')];var _0x299fab=[];_['map'](_0x5626a1,function(_0x591fb1){_0x299fab['push']({'id':_0x591fb1[_0xf3ba('0x12')],'name':_0x591fb1[_0xf3ba('0x12')],'utcOffset':_0x591fb1['utcOffset']});});return _0x504e6a[_0xf3ba('0x7')](0xc8)[_0xf3ba('0x8')]({'tz':_0x299fab});};exports[_0xf3ba('0x82')]=function(_0x3de094,_0x41eb6b){var _0x2cd284=shared[_0xf3ba('0x81')];var _0x3bc463={};if(!_[_0xf3ba('0x56')](_0x2cd284[_0x3de094['body']['id']]))_0x3bc463=_0x2cd284[_0x3de094[_0xf3ba('0x3d')]['id']];return _0x41eb6b[_0xf3ba('0x7')](0xc8)[_0xf3ba('0x8')](_0x3bc463);}; \ No newline at end of file +var _0xd58c=['format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','CmContact','ContactId','lastName','isNil','calleridname','firstName','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','CmList','Queue','dialActive','getPreviewRecall','transaction','scheduledat','recallme','Company','List','getOpenContacts','isNumber','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','error','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','updatedAt','state','deleted','membername','user','UserId','deletedat'];(function(_0x40e50a,_0x549543){var _0x2802db=function(_0x15c41c){while(--_0x15c41c){_0x40e50a['push'](_0x40e50a['shift']());}};_0x2802db(++_0x549543);}(_0xd58c,0xb6));var _0xcd58=function(_0x531188,_0xc8a886){_0x531188=_0x531188-0x0;var _0x2537c5=_0xd58c[_0x531188];return _0x2537c5;};'use strict';var moment=require(_0xcd58('0x0'));var _=require(_0xcd58('0x1'));var qs=require(_0xcd58('0x2'));var logger=require('../../config/logger')(_0xcd58('0x3'));var shared=require('../../config/environment');var db=require(_0xcd58('0x4'))['db'];function respondWithResult(_0x4be7d0,_0xe6c68){_0xe6c68=_0xe6c68||0xc8;return function(_0x2a22bd){if(_0x2a22bd){return _0x4be7d0[_0xcd58('0x5')](_0xe6c68)[_0xcd58('0x6')](_0x2a22bd);}};}function respondWithFilteredResult(_0x45bc6f,_0x599c02){return function(_0x546187){if(_0x546187){var _0x3f2c97=typeof _0x599c02[_0xcd58('0x7')]===_0xcd58('0x8')&&typeof _0x599c02[_0xcd58('0x9')]===_0xcd58('0x8');var _0x491d5b=_0x546187[_0xcd58('0xa')];var _0x43732a=_0x3f2c97?0x0:_0x599c02['offset'];var _0x1e6f95=_0x3f2c97?_0x546187['count']:_0x599c02[_0xcd58('0x7')]+_0x599c02[_0xcd58('0x9')];var _0x440cf1;if(_0x1e6f95>=_0x491d5b){_0x1e6f95=_0x491d5b;_0x440cf1=0xc8;}else{_0x440cf1=0xce;}_0x45bc6f['status'](_0x440cf1);return _0x45bc6f[_0xcd58('0xb')]('Content-Range',_0x43732a+'-'+_0x1e6f95+'/'+_0x491d5b)[_0xcd58('0x6')](_0x546187);}return null;};}function saveUpdates(_0x51880c,_0x477d19){return function(_0x42b221){if(_0x42b221){return _0x42b221[_0xcd58('0xc')](_0x51880c)[_0xcd58('0xd')](function(_0x37561b){return _0x37561b;});}return null;};}function handleEntityNotFound(_0x202412,_0xda9091){return function(_0x3376f3){if(!_0x3376f3){_0x202412['sendStatus'](0x194);}return _0x3376f3;};}function handleError(_0x5d0aa3,_0x3ce190){_0x3ce190=_0x3ce190||0x1f4;return function(_0xa225e3){logger[_0xcd58('0xe')](_0xa225e3['stack']);if(_0xa225e3['name']){delete _0xa225e3[_0xcd58('0xf')];}_0x5d0aa3[_0xcd58('0x5')](_0x3ce190)[_0xcd58('0x10')](_0xa225e3);};}exports['index']=function(_0x4e9b76,_0x3686ad){var _0x53ad6a={},_0x21ef20={},_0x39dc9c={'count':0x0,'rows':[]};var _0x2824a6=_[_0xcd58('0x11')](db['CmHopper'][_0xcd58('0x12')],function(_0x49881d){return{'name':_0x49881d['fieldName'],'type':_0x49881d['type'][_0xcd58('0x13')]};});_0x21ef20[_0xcd58('0x14')]=_[_0xcd58('0x11')](_0x2824a6,'name');_0x21ef20[_0xcd58('0x15')]=_[_0xcd58('0x16')](_0x4e9b76['query']);_0x21ef20[_0xcd58('0x17')]=_[_0xcd58('0x18')](_0x21ef20[_0xcd58('0x14')],_0x21ef20['query']);_0x21ef20['filters']=_[_0xcd58('0x19')](_0x21ef20[_0xcd58('0x17')],[_0xcd58('0x1a'),_0xcd58('0x1b'),_0xcd58('0x1c'),_0xcd58('0x1d'),_0xcd58('0x1e'),'$lte','$ne',_0xcd58('0x1f'),_0xcd58('0x20'),'$between',_0xcd58('0x21'),'$in',_0xcd58('0x22'),_0xcd58('0x23'),_0xcd58('0x24'),_0xcd58('0x25'),_0xcd58('0x26'),_0xcd58('0x23'),'$overlap',_0xcd58('0x27'),'$contained',_0xcd58('0x28')]);_0x53ad6a['attributes']=_[_0xcd58('0x18')](_0x21ef20['model'],qs[_0xcd58('0x29')](_0x4e9b76['query'][_0xcd58('0x29')]));_0x53ad6a[_0xcd58('0x2a')]=_0x53ad6a[_0xcd58('0x2a')][_0xcd58('0x2b')]?_0x53ad6a['attributes']:_0x21ef20[_0xcd58('0x14')];if(!_0x4e9b76['query'][_0xcd58('0x2c')](_0xcd58('0x2d'))){_0x53ad6a[_0xcd58('0x9')]=qs[_0xcd58('0x9')](_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x9')]);_0x53ad6a['offset']=qs['offset'](_0x4e9b76[_0xcd58('0x15')]['offset']);}_0x53ad6a['order']=qs[_0xcd58('0x2e')](_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x2e')]);_0x53ad6a[_0xcd58('0x2f')]=qs[_0xcd58('0x17')](_[_0xcd58('0x30')](_0x4e9b76['query'],_0x21ef20['filters']),_0x2824a6);if(_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x31')]){_0x53ad6a[_0xcd58('0x2f')]=_['merge'](_0x53ad6a[_0xcd58('0x2f')],{'$or':_[_0xcd58('0x11')](_0x2824a6,function(_0x6a7872){if(_0x6a7872['type']!=='VIRTUAL'){var _0x3e2e37={};_0x3e2e37[_0x6a7872[_0xcd58('0xf')]]={'$like':'%'+_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x31')]+'%'};return _0x3e2e37;}})});}_0x53ad6a=_[_0xcd58('0x32')]({},_0x53ad6a,_0x4e9b76[_0xcd58('0x33')]);var _0x1fa80f={'where':_0x53ad6a[_0xcd58('0x2f')]};return db[_0xcd58('0x34')][_0xcd58('0xa')](_0x1fa80f)[_0xcd58('0xd')](function(_0x37e840){_0x39dc9c[_0xcd58('0xa')]=_0x37e840;if(_0x4e9b76[_0xcd58('0x15')][_0xcd58('0x35')]){_0x53ad6a[_0xcd58('0x36')]=[{'all':!![]}];}return db[_0xcd58('0x34')][_0xcd58('0x37')](_0x53ad6a);})[_0xcd58('0xd')](function(_0x48c097){_0x39dc9c[_0xcd58('0x38')]=_0x48c097;return _0x39dc9c;})['then'](respondWithFilteredResult(_0x3686ad,_0x53ad6a))[_0xcd58('0x39')](handleError(_0x3686ad,null));};exports[_0xcd58('0x3a')]=function(_0x464158,_0x5d774d){var _0x2e637c={'raw':!![],'where':{'id':_0x464158['params']['id']}},_0x41daa7={};_0x41daa7[_0xcd58('0x14')]=_['keys'](db['CmHopper'][_0xcd58('0x12')]);_0x41daa7['query']=_['keys'](_0x464158[_0xcd58('0x15')]);_0x41daa7[_0xcd58('0x17')]=_[_0xcd58('0x18')](_0x41daa7['model'],_0x41daa7['query']);_0x2e637c[_0xcd58('0x2a')]=_['intersection'](_0x41daa7[_0xcd58('0x14')],qs[_0xcd58('0x29')](_0x464158['query']['fields']));_0x2e637c[_0xcd58('0x2a')]=_0x2e637c[_0xcd58('0x2a')][_0xcd58('0x2b')]?_0x2e637c[_0xcd58('0x2a')]:_0x41daa7[_0xcd58('0x14')];if(_0x464158[_0xcd58('0x15')][_0xcd58('0x35')]){_0x2e637c[_0xcd58('0x36')]=[{'all':!![]}];}_0x2e637c=_[_0xcd58('0x32')]({},_0x2e637c,_0x464158[_0xcd58('0x33')]);return db[_0xcd58('0x34')][_0xcd58('0x3b')](_0x2e637c)[_0xcd58('0xd')](handleEntityNotFound(_0x5d774d,null))['then'](respondWithResult(_0x5d774d,null))[_0xcd58('0x39')](handleError(_0x5d774d,null));};exports[_0xcd58('0x3c')]=function(_0x415772,_0x4cb1b6){return db[_0xcd58('0x34')][_0xcd58('0x3c')](_0x415772[_0xcd58('0x3d')],{})[_0xcd58('0xd')](respondWithResult(_0x4cb1b6,0xc9))['catch'](handleError(_0x4cb1b6,null));};exports[_0xcd58('0xc')]=function(_0x26dd8f,_0x16be8c){if(_0x26dd8f[_0xcd58('0x3d')]['id']){delete _0x26dd8f[_0xcd58('0x3d')]['id'];}return db[_0xcd58('0x34')][_0xcd58('0x3b')]({'where':{'id':_0x26dd8f[_0xcd58('0x3e')]['id']}})[_0xcd58('0xd')](handleEntityNotFound(_0x16be8c,null))[_0xcd58('0xd')](saveUpdates(_0x26dd8f['body'],null))[_0xcd58('0xd')](respondWithResult(_0x16be8c,null))[_0xcd58('0x39')](handleError(_0x16be8c,null));};exports[_0xcd58('0x3f')]=function(_0x1ead66,_0x2bd4c9){return db[_0xcd58('0x34')][_0xcd58('0x3f')]()[_0xcd58('0xd')](respondWithResult(_0x2bd4c9,null))[_0xcd58('0x39')](handleError(_0x2bd4c9,null));};exports[_0xcd58('0x40')]=function(_0x1416fa,_0x1e39d8){var _0x5589bd;var _0xf01b8d=_0x1416fa[_0xcd58('0x3e')]['id'];return db['CmHopper'][_0xcd58('0x3b')]({'where':{'id':_0x1416fa[_0xcd58('0x3e')]['id']}})[_0xcd58('0xd')](handleEntityNotFound(_0x1e39d8,null))[_0xcd58('0xd')](function(_0x424cfb){if(_0x424cfb){return _0x424cfb[_0xcd58('0x40')]()['then'](function(_0x51735b){return _0x51735b;});}})[_0xcd58('0xd')](function(_0x50aebc){_0x5589bd=_0x50aebc;if(_0x50aebc){if(_0x50aebc[_0xcd58('0x41')]||_0x50aebc[_0xcd58('0x42')]){return db[_0x50aebc[_0xcd58('0x41')]?_0xcd58('0x43'):'Campaign']['find']({'where':{'id':_0x50aebc[_0xcd58('0x41')]?_0x50aebc['VoiceQueueId']:_0x50aebc['CampaignId']},'attributes':['id',_0xcd58('0xf')],'raw':!![]});}}})[_0xcd58('0xd')](function(_0x361422){var _0xc979ce={};if(_0x361422){_['merge'](_0xc979ce,_[_0xcd58('0x44')](_0x5589bd['dataValues'],['createdAt',_0xcd58('0x45'),'id']));_0xc979ce[_0xcd58('0x46')]=0x15;_0xc979ce['statedesc']=_0xcd58('0x47');_0xc979ce['campaign']=_0x361422[_0xcd58('0xf')];_0xc979ce[_0xcd58('0x48')]=_0x1416fa[_0xcd58('0x49')][_0xcd58('0xf')];_0xc979ce[_0xcd58('0x4a')]=_0x1416fa[_0xcd58('0x49')]['id'];_0xc979ce[_0xcd58('0x47')]=!![];_0xc979ce[_0xcd58('0x4b')]=moment()[_0xcd58('0x4c')](_0xcd58('0x4d'));_0xc979ce[_0xcd58('0x4e')]=_0x5589bd[_0xcd58('0x4f')];_0xc979ce['campaigntype']=_0x5589bd[_0xcd58('0x41')]?'queue':_0xcd58('0x50');return db[_0xcd58('0x51')][_0xcd58('0x3b')]({'where':{'id':_0xc979ce[_0xcd58('0x52')]},'attributes':['firstName',_0xcd58('0x53')]})[_0xcd58('0xd')](function(_0x458157){if(!_[_0xcd58('0x54')](_0x1e39d8)&&!_['isNil'](_0x458157['firstName'])){_0xc979ce[_0xcd58('0x55')]=_0x458157[_0xcd58('0x56')];if(!_[_0xcd58('0x54')](_0x458157[_0xcd58('0x53')])){_0xc979ce[_0xcd58('0x55')]+='\x20'+_0x458157[_0xcd58('0x53')];}}})[_0xcd58('0x57')](function(){return db['CmHopperFinal'][_0xcd58('0x3c')](_0xc979ce);});}})[_0xcd58('0xd')](function(_0x98d9b){return db[_0xcd58('0x58')][_0xcd58('0x40')]({'where':{'CmHopperId':_0xf01b8d}});})[_0xcd58('0xd')](function(){return _0x1e39d8[_0xcd58('0x5')](0xcc)[_0xcd58('0x59')]();})[_0xcd58('0x39')](handleError(_0x1e39d8,null));};exports[_0xcd58('0x5a')]=function(_0x11fdd4,_0x1ba71d){var _0x22579f=[];return db[_0xcd58('0x51')][_0xcd58('0x3f')]()[_0xcd58('0xd')](function(_0x11a622){_0x22579f=_['keys'](_0x11a622);return _0x11fdd4[_0xcd58('0x49')][_0xcd58('0x5b')]({'where':{'type':_0xcd58('0x5c'),'dialActive':!![],'dialMethod':_0xcd58('0x5d')},'attributes':['id','dialOrderByScheduledAt',_0xcd58('0x5e')],'raw':!![]});})[_0xcd58('0xd')](function(_0x2cee65){if(_0x2cee65&&_0x2cee65[_0xcd58('0x2b')]){return db[_0xcd58('0x5f')]['transaction'](function(_0xe8c2ea){var _0x343241={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcd58('0x4c')](_0xcd58('0x4d'))},'VoiceQueueId':{'$in':_[_0xcd58('0x11')](_0x2cee65,'id')},'$or':[{'UserId':null},{'UserId':_0x11fdd4[_0xcd58('0x49')]['id']}]};var _0x1bc688={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2cee65)[_0xcd58('0x31')]([_0xcd58('0x5e'),0x0])[_0xcd58('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x11fdd4['user']['id']}]};var _0xb50cd5={'$or':[_0x343241,_0x1bc688]};var _0x39c9c8=[];if(_0x11fdd4[_0xcd58('0x3d')]['direction']&&_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x60')]==='prev'){if(!_[_0xcd58('0x61')](_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x62')])){_0xb50cd5['id']={'$in':_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x62')]};}_0x39c9c8=[[_0xcd58('0x63'),_0xcd58('0x64')],[_0xcd58('0x65'),_0x2cee65[0x0]['dialOrderByScheduledAt']==='ASC'?_0xcd58('0x66'):'ASC'],db[_0xcd58('0x5f')]['literal'](_0xcd58('0x67')),['id',_0xcd58('0x66')]];}else{if(!_[_0xcd58('0x61')](_0x11fdd4[_0xcd58('0x3d')]['hopperIds'])){_0xb50cd5['id']={'$notIn':_0x11fdd4[_0xcd58('0x3d')][_0xcd58('0x62')]};}_0x39c9c8=[['priority',_0xcd58('0x66')],[_0xcd58('0x65'),_0x2cee65[0x0][_0xcd58('0x68')]],db[_0xcd58('0x5f')]['literal'](_0xcd58('0x69')),['id',_0xcd58('0x64')]];}return db[_0xcd58('0x34')][_0xcd58('0x6a')]({'attributes':['id','scheduledat',_0xcd58('0x4f'),'recallme'],'where':_0xb50cd5,'order':_0x39c9c8,'transaction':_0xe8c2ea,'lock':_0xe8c2ea[_0xcd58('0x6b')][_0xcd58('0x6c')],'include':[{'model':db[_0xcd58('0x51')],'as':_0xcd58('0x6d'),'attributes':_0x22579f,'include':[{'model':db[_0xcd58('0x6e')],'as':'Company','attributes':['id',_0xcd58('0xf')]}]},{'model':db[_0xcd58('0x6f')],'as':'List','attributes':['id',_0xcd58('0xf')]},{'model':db['VoiceQueue'],'as':_0xcd58('0x70'),'attributes':['id',_0xcd58('0xf'),_0xcd58('0x71')]}]})[_0xcd58('0xd')](function(_0x3f4643){if(_0x3f4643){return _0x3f4643[_0xcd58('0xc')]({'UserId':_0x11fdd4[_0xcd58('0x49')]['id']},{'transaction':_0xe8c2ea});}});});}})['then'](handleEntityNotFound(_0x1ba71d,null))[_0xcd58('0xd')](respondWithResult(_0x1ba71d,null))[_0xcd58('0x39')](handleError(_0x1ba71d,null));};exports[_0xcd58('0x72')]=function(_0xf0ae68,_0x374f9a,_0x4047dd){var _0xf5e38d=[];var _0xf9fcac=_0xf0ae68[_0xcd58('0x3e')]['id'];var _0x312a35=_0xf0ae68[_0xcd58('0x49')]['id'];return db[_0xcd58('0x51')]['describe']()['then'](function(_0xc6e97a){_0xf5e38d=_[_0xcd58('0x16')](_0xc6e97a);return db[_0xcd58('0x5f')][_0xcd58('0x73')](function(_0x202d96){const _0x46dfaa={'id':_0xf9fcac};return db[_0xcd58('0x34')]['findOne']({'attributes':['id',_0xcd58('0x74'),_0xcd58('0x75')],'where':_0x46dfaa,'transaction':_0x202d96,'lock':_0x202d96['LOCK'][_0xcd58('0x6c')],'include':[{'model':db[_0xcd58('0x51')],'as':_0xcd58('0x6d'),'attributes':_0xf5e38d,'include':[{'model':db[_0xcd58('0x6e')],'as':_0xcd58('0x76'),'attributes':['id',_0xcd58('0xf')]}]},{'model':db[_0xcd58('0x6f')],'as':_0xcd58('0x77'),'attributes':['id',_0xcd58('0xf')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xcd58('0xf'),'dialActive']}]})['then'](function(_0x353d9e){if(_0x353d9e){return _0x353d9e['update']({'UserId':_0x312a35},{'transaction':_0x202d96});}});});})[_0xcd58('0xd')](handleEntityNotFound(_0x374f9a,null))[_0xcd58('0xd')](respondWithResult(_0x374f9a,null))[_0xcd58('0x39')](handleError(_0x374f9a,null));};exports[_0xcd58('0x78')]=function(_0x400844,_0x573ed5){return _0x400844['user']['getVoiceQueues']({'where':{'type':_0xcd58('0x5c'),'dialActive':!![],'dialMethod':_0xcd58('0x5d')},'attributes':['id'],'raw':!![]})['then'](function(_0x381ee4){if(_0x381ee4&&_0x381ee4[_0xcd58('0x2b')]){return db[_0xcd58('0x34')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xcd58('0x4d'))},'VoiceQueueId':{'$in':_[_0xcd58('0x11')](_0x381ee4,'id')},'$or':[{'UserId':null},{'UserId':_0x400844[_0xcd58('0x49')]['id']}]}});}return 0x0;})[_0xcd58('0xd')](function(_0x5f3799){if(!_[_0xcd58('0x54')](_0x5f3799)&&_[_0xcd58('0x79')](_0x5f3799)){return _0x573ed5[_0xcd58('0x5')](0xc8)[_0xcd58('0x6')]({'contacts':_0x5f3799});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xcd58('0x78'),0x194,_0xcd58('0x7a'));_0x573ed5[_0xcd58('0x7b')](0x194);}})['catch'](handleError(_0x573ed5,null));};exports[_0xcd58('0x7c')]=function(_0x57cde7,_0x26e93b){var _0x2e92d1=shared[_0xcd58('0x7d')];var _0x10a5cc=[];_[_0xcd58('0x11')](_0x2e92d1,function(_0x155aa7){_0x10a5cc[_0xcd58('0x7e')]({'id':_0x155aa7[_0xcd58('0xf')],'name':_0x155aa7['name'],'utcOffset':_0x155aa7[_0xcd58('0x7f')]});});return _0x26e93b[_0xcd58('0x5')](0xc8)[_0xcd58('0x6')]({'tz':_0x10a5cc});};exports[_0xcd58('0x80')]=function(_0x2c298c,_0x20ee56){var _0x5e21a2=shared[_0xcd58('0x7d')];var _0x257c4e={};if(!_[_0xcd58('0x54')](_0x5e21a2[_0x2c298c[_0xcd58('0x3d')]['id']]))_0x257c4e=_0x5e21a2[_0x2c298c[_0xcd58('0x3d')]['id']];return _0x20ee56[_0xcd58('0x5')](0xc8)[_0xcd58('0x6')](_0x257c4e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f12709e..013cba3 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 _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xba34,0x119));var _0x4ba3=function(_0x4c59bb,_0x1f71b9){_0x4c59bb=_0x4c59bb-0x0;var _0x593907=_0xba34[_0x4c59bb];return _0x593907;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2d6297,_0x1d3f94){_0x2d6297=_0x2d6297-0x0;var _0x1ee549=_0xbd51[_0x2d6297];return _0x1ee549;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd5('0xa'),'fields':[_0x1bd5('0xa')]},{'name':'phone','fields':[_0x1bd5('0xb')]},{'name':'priority','fields':[_0x1bd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index f1b3db6..7a88edd 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 _0xd41a=['CountReScheduled','COUNT','literal','\x22%s\x22','format','\x20,\x201,\x20null','order','GetContactRecallMe','keys','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','lodash','util','bluebird','../../config/logger','rpc','CmHopper','findAll','options','raw','where','attributes','include','model','map','then','info','GetCmHopper','debug','stringify','error','message','ShowCmHopper','CreateCmHopper','catch','UpdateCmHopper','limit','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','LOCK','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','update','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x196776,_0x698086){var _0x232e39=function(_0xb3215c){while(--_0xb3215c){_0x196776['push'](_0x196776['shift']());}};_0x232e39(++_0x698086);}(_0xd41a,0x18e));var _0xad41=function(_0x3ddd29,_0x26f096){_0x3ddd29=_0x3ddd29-0x0;var _0x34cb20=_0xd41a[_0x3ddd29];return _0x34cb20;};'use strict';var _=require(_0xad41('0x0'));var util=require(_0xad41('0x1'));var moment=require('moment');var BPromise=require(_0xad41('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xad41('0x3'))(_0xad41('0x4'));exports['GetCmHopper']=function(_0x21d980){var _0x15eb91=this;return new Promise(function(_0x2876f7,_0x17d490){return db[_0xad41('0x5')][_0xad41('0x6')]({'raw':_0x21d980[_0xad41('0x7')]?_0x21d980[_0xad41('0x7')][_0xad41('0x8')]===undefined?!![]:![]:!![],'where':_0x21d980['options']?_0x21d980[_0xad41('0x7')][_0xad41('0x9')]||null:null,'attributes':_0x21d980['options']?_0x21d980[_0xad41('0x7')][_0xad41('0xa')]||null:null,'limit':_0x21d980[_0xad41('0x7')]?_0x21d980['options']['limit']||null:null,'include':_0x21d980[_0xad41('0x7')]?_0x21d980['options'][_0xad41('0xb')]?_['map'](_0x21d980['options'][_0xad41('0xb')],function(_0x52c701){return{'model':db[_0x52c701[_0xad41('0xc')]],'as':_0x52c701['as'],'attributes':_0x52c701[_0xad41('0xa')],'include':_0x52c701['include']?_[_0xad41('0xd')](_0x52c701[_0xad41('0xb')],function(_0x32c401){return{'model':db[_0x32c401[_0xad41('0xc')]],'as':_0x32c401['as'],'attributes':_0x32c401[_0xad41('0xa')],'include':_0x32c401[_0xad41('0xb')]?_[_0xad41('0xd')](_0x32c401['include'],function(_0x58c6fe){return{'model':db[_0x58c6fe[_0xad41('0xc')]],'as':_0x58c6fe['as'],'attributes':_0x58c6fe[_0xad41('0xa')]};}):[]};}):[]};}):[]:[]})[_0xad41('0xe')](function(_0x284101){logger[_0xad41('0xf')](_0xad41('0x10'),_0x21d980);logger[_0xad41('0x11')](_0xad41('0x10'),_0x21d980,JSON[_0xad41('0x12')](_0x284101));_0x2876f7(_0x284101);})['catch'](function(_0x30407c){logger[_0xad41('0x13')](_0xad41('0x10'),_0x30407c['message'],_0x21d980);_0x17d490(_0x15eb91[_0xad41('0x13')](0x1f4,_0x30407c[_0xad41('0x14')]));});});};exports[_0xad41('0x15')]=function(_0x4f5052){var _0x2354c2=this;return new Promise(function(_0x56e750,_0x49a22c){return db[_0xad41('0x5')]['find']({'raw':_0x4f5052[_0xad41('0x7')]?_0x4f5052[_0xad41('0x7')][_0xad41('0x8')]===undefined?!![]:![]:!![],'where':_0x4f5052[_0xad41('0x7')]?_0x4f5052[_0xad41('0x7')]['where']||null:null,'attributes':_0x4f5052[_0xad41('0x7')]?_0x4f5052[_0xad41('0x7')]['attributes']||null:null,'include':_0x4f5052[_0xad41('0x7')]?_0x4f5052['options'][_0xad41('0xb')]?_['map'](_0x4f5052[_0xad41('0x7')]['include'],function(_0x5f00ee){return{'model':db[_0x5f00ee[_0xad41('0xc')]],'as':_0x5f00ee['as'],'attributes':_0x5f00ee[_0xad41('0xa')],'include':_0x5f00ee['include']?_[_0xad41('0xd')](_0x5f00ee[_0xad41('0xb')],function(_0xba94ab){return{'model':db[_0xba94ab['model']],'as':_0xba94ab['as'],'attributes':_0xba94ab[_0xad41('0xa')],'include':_0xba94ab[_0xad41('0xb')]?_[_0xad41('0xd')](_0xba94ab['include'],function(_0x4ac070){return{'model':db[_0x4ac070['model']],'as':_0x4ac070['as'],'attributes':_0x4ac070['attributes']};}):[]};}):[]};}):[]:[]})[_0xad41('0xe')](function(_0x4785b3){logger['info'](_0xad41('0x15'),_0x4f5052);logger['debug'](_0xad41('0x15'),_0x4f5052,JSON['stringify'](_0x4785b3));_0x56e750(_0x4785b3);})['catch'](function(_0x3191f2){logger[_0xad41('0x13')](_0xad41('0x15'),_0x3191f2['message'],_0x4f5052);_0x49a22c(_0x2354c2[_0xad41('0x13')](0x1f4,_0x3191f2[_0xad41('0x14')]));});});};exports[_0xad41('0x16')]=function(_0x218910){var _0x25e7a8=this;return new Promise(function(_0x2ba97a,_0x3e32ce){return db[_0xad41('0x5')]['create'](_0x218910['body'],{'raw':_0x218910[_0xad41('0x7')]?_0x218910[_0xad41('0x7')]['raw']===undefined?!![]:![]:!![]})[_0xad41('0xe')](function(_0x11c478){logger[_0xad41('0xf')](_0xad41('0x16'),_0x218910);logger[_0xad41('0x11')](_0xad41('0x16'),_0x218910,JSON[_0xad41('0x12')](_0x11c478));_0x2ba97a(_0x11c478);})[_0xad41('0x17')](function(_0x281519){logger[_0xad41('0x13')](_0xad41('0x16'),_0x281519['message'],_0x218910);_0x3e32ce(_0x25e7a8[_0xad41('0x13')](0x1f4,_0x281519[_0xad41('0x14')]));});});};exports[_0xad41('0x18')]=function(_0x48f6f9){var _0xcf0fff=this;return new Promise(function(_0x23f382,_0x4e28a0){return db[_0xad41('0x5')]['update'](_0x48f6f9['body'],{'raw':_0x48f6f9[_0xad41('0x7')]?_0x48f6f9[_0xad41('0x7')][_0xad41('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48f6f9[_0xad41('0x7')]?_0x48f6f9['options'][_0xad41('0x9')]||null:null,'attributes':_0x48f6f9[_0xad41('0x7')]?_0x48f6f9[_0xad41('0x7')]['attributes']||null:null,'limit':_0x48f6f9[_0xad41('0x7')]?_0x48f6f9['options'][_0xad41('0x19')]||null:null})[_0xad41('0xe')](function(_0xb6808){logger['info'](_0xad41('0x18'),_0x48f6f9);logger[_0xad41('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xad41('0x12')](_0x48f6f9[_0xad41('0x7')][_0xad41('0x9')]),_0x48f6f9[_0xad41('0x1a')][_0xad41('0x1b')]);logger[_0xad41('0x11')](_0xad41('0x18'),_0x48f6f9,JSON[_0xad41('0x12')](_0xb6808));_0x23f382(_0xb6808);})[_0xad41('0x17')](function(_0x5455f2){logger[_0xad41('0x13')](_0xad41('0x18'),_0x5455f2[_0xad41('0x14')],_0x48f6f9);_0x4e28a0(_0xcf0fff['error'](0x1f4,_0x5455f2[_0xad41('0x14')]));});});};exports[_0xad41('0x1c')]=function(_0x4df6e0){var _0x55543c=this;return new Promise(function(_0xa9dfb9,_0xb76c6c){return db[_0xad41('0x5')][_0xad41('0x1d')]({'where':_0x4df6e0[_0xad41('0x7')]?_0x4df6e0[_0xad41('0x7')][_0xad41('0x9')]||null:null})['then'](function(_0x38f5ec){logger[_0xad41('0xf')](_0xad41('0x1c'),_0x4df6e0);logger[_0xad41('0x11')](_0xad41('0x1c'),_0x4df6e0,JSON['stringify'](_0x38f5ec));_0xa9dfb9(_0x38f5ec);})[_0xad41('0x17')](function(_0x3ae65a){logger['error'](_0xad41('0x1c'),_0x3ae65a[_0xad41('0x14')],_0x4df6e0);_0xb76c6c(_0x55543c[_0xad41('0x13')](0x1f4,_0x3ae65a[_0xad41('0x14')]));});});};exports[_0xad41('0x1e')]=function(_0x235a73){var _0x2bb3b8=this;return new Promise(function(_0x2c5522,_0x1d33bf){return db[_0xad41('0x1f')][_0xad41('0x20')]()['then'](function(_0x246366){return db['sequelize'][_0xad41('0x21')](function(_0x2e5758){return db[_0xad41('0x5')][_0xad41('0x6')]({'where':_0x235a73[_0xad41('0x7')]?_0x235a73[_0xad41('0x7')][_0xad41('0x9')]||null:null,'attributes':_0x235a73[_0xad41('0x7')]?_0x235a73[_0xad41('0x7')][_0xad41('0xa')]||null:null,'limit':_0x235a73[_0xad41('0x7')]?_0x235a73['options'][_0xad41('0x19')]||null:null,'order':_0x235a73[_0xad41('0x7')]?_0x235a73[_0xad41('0x7')]['order']||null:null,'transaction':_0x2e5758,'lock':_0x2e5758[_0xad41('0x22')][_0xad41('0x23')],'include':[{'model':db[_0xad41('0x1f')],'as':_0xad41('0x24'),'attributes':_['keys'](_0x246366)},{'model':db[_0xad41('0x25')],'as':_0xad41('0x26'),'attributes':['id',_0xad41('0x27'),_0xad41('0x28')]}]})[_0xad41('0xe')](function(_0x530b71){var _0x2e112a=[];var _0xa95044=[];for(var _0x1078bc=0x0;_0x1078bc<_0x530b71['length'];_0x1078bc+=0x1){var _0x37ba46=_0x530b71[_0x1078bc][_0xad41('0x29')];if(_0x37ba46===null){_0x2e112a[_0xad41('0x2a')](_0x530b71[_0x1078bc][_0xad41('0x2b')](_0x235a73[_0xad41('0x1a')],{'transaction':_0x2e5758}));}else if(!_0xa95044['includes'](_0x37ba46)){_0xa95044[_0xad41('0x2a')](_0x37ba46);_0x2e112a[_0xad41('0x2a')](_0x530b71[_0x1078bc][_0xad41('0x2b')](_0x235a73[_0xad41('0x1a')],{'transaction':_0x2e5758}));}}return BPromise['all'](_0x2e112a);});})[_0xad41('0xe')](function(_0x30eecd){logger[_0xad41('0xf')]('GetContactDialer',_0x235a73);if(_0x30eecd[_0xad41('0x2c')]>0x0){logger[_0xad41('0xf')](_0xad41('0x2d'),_0x30eecd[0x0][_0xad41('0x2e')]['id'],_0x30eecd[0x0][_0xad41('0x2e')][_0xad41('0x2f')],_0x30eecd[0x0][_0xad41('0x2e')][_0xad41('0x1b')]);}logger[_0xad41('0x11')](_0xad41('0x1e'),_0x235a73,JSON[_0xad41('0x12')](_0x30eecd));_0x2c5522(_0x30eecd);})[_0xad41('0x17')](function(_0x2039d4){logger['error'](_0xad41('0x1e'),_0x2039d4[_0xad41('0x14')],_0x235a73);_0x1d33bf(_0x2bb3b8[_0xad41('0x13')](0x1f4,_0x2039d4[_0xad41('0x14')]));});});});};exports[_0xad41('0x30')]=function(_0x5f2644){var _0x2000c1=this;return new Promise(function(_0x2f36f2,_0x325008){return db[_0xad41('0x31')][_0xad41('0x21')](function(_0x42b4ae){return db[_0xad41('0x32')]['create'](_0x5f2644['body'],{'raw':_0x5f2644[_0xad41('0x7')]?_0x5f2644['options'][_0xad41('0x8')]===undefined?!![]:![]:!![],'transaction':_0x42b4ae})[_0xad41('0xe')](function(){logger[_0xad41('0xf')](_0xad41('0x33'),JSON['stringify'](_0x5f2644[_0xad41('0x7')][_0xad41('0x9')]),_0x5f2644[_0xad41('0x7')][_0xad41('0x9')][_0xad41('0x1b')]);return db[_0xad41('0x5')][_0xad41('0x1d')]({'where':_0x5f2644[_0xad41('0x7')]?_0x5f2644[_0xad41('0x7')][_0xad41('0x9')]||null:null,'transaction':_0x42b4ae});});})[_0xad41('0xe')](function(_0x11765e){logger[_0xad41('0xf')](_0xad41('0x30'),_0x5f2644);logger[_0xad41('0x11')](_0xad41('0x30'),_0x5f2644,JSON[_0xad41('0x12')](_0x11765e));_0x2f36f2(_0x11765e);})[_0xad41('0x17')](function(_0x20c30d){logger[_0xad41('0x13')](_0xad41('0x30'),_0x20c30d[_0xad41('0x14')],_0x5f2644);_0x325008(_0x2000c1[_0xad41('0x13')](0x1f4,_0x20c30d['message']));});});};exports[_0xad41('0x34')]=function(_0x5d3ea3){var _0x565ce4=this;return new Promise(function(_0x177471,_0x36e2e3){return db[_0xad41('0x5')][_0xad41('0x6')]({'raw':_0x5d3ea3[_0xad41('0x7')]?_0x5d3ea3[_0xad41('0x7')][_0xad41('0x8')]===undefined?!![]:![]:!![],'where':_0x5d3ea3[_0xad41('0x7')]?_0x5d3ea3['options'][_0xad41('0x9')]||null:null,'attributes':[[db[_0xad41('0x31')]['fn'](_0xad41('0x35'),db[_0xad41('0x31')]['fn']('IF',db[_0xad41('0x31')][_0xad41('0x36')]('`scheduledat`\x20>=\x20'+util['format'](_0xad41('0x37'),moment()[_0xad41('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xad41('0x39')))),'contactsRescheduled']]})[_0xad41('0xe')](function(_0x12281a){logger['info'](_0xad41('0x34'),_0x5d3ea3);logger['debug'](_0xad41('0x34'),_0x5d3ea3,JSON[_0xad41('0x12')](_0x12281a));_0x177471(_0x12281a);})[_0xad41('0x17')](function(_0x30d0d2){logger[_0xad41('0x13')](_0xad41('0x34'),_0x30d0d2[_0xad41('0x14')],_0x5d3ea3);_0x36e2e3(_0x565ce4[_0xad41('0x13')](0x1f4,_0x30d0d2[_0xad41('0x14')]));});});};exports['GetContactRecallMe']=function(_0x4647d7){var _0x31aa14=this;return new Promise(function(_0x4da79e,_0x26da70){return db['CmContact'][_0xad41('0x20')]()[_0xad41('0xe')](function(){return db['sequelize'][_0xad41('0x21')](function(_0x4b44cb){return db[_0xad41('0x5')][_0xad41('0x6')]({'where':_0x4647d7[_0xad41('0x7')]?_0x4647d7[_0xad41('0x7')]['where']||null:null,'attributes':_0x4647d7[_0xad41('0x7')]?_0x4647d7[_0xad41('0x7')][_0xad41('0xa')]||null:null,'limit':0x1,'order':_0x4647d7[_0xad41('0x7')]?_0x4647d7[_0xad41('0x7')][_0xad41('0x3a')]||null:null,'group':db['CmHopper'][_0xad41('0x29')],'transaction':_0x4b44cb,'lock':_0x4b44cb['LOCK'][_0xad41('0x23')],'include':_0x4647d7['options']?_0x4647d7['options']['include']?_[_0xad41('0xd')](_0x4647d7['options'][_0xad41('0xb')],function(_0x5bae59){return{'model':db[_0x5bae59['model']],'as':_0x5bae59['as'],'attributes':_0x5bae59[_0xad41('0xa')],'include':_0x5bae59[_0xad41('0xb')]?_[_0xad41('0xd')](_0x5bae59[_0xad41('0xb')],function(_0x30fc81){return{'model':db[_0x30fc81[_0xad41('0xc')]],'as':_0x30fc81['as'],'attributes':_0x30fc81[_0xad41('0xa')],'include':_0x30fc81[_0xad41('0xb')]?_[_0xad41('0xd')](_0x30fc81['include'],function(_0x12d15b){return{'model':db[_0x12d15b[_0xad41('0xc')]],'as':_0x12d15b['as'],'attributes':_0x12d15b[_0xad41('0xa')]};}):[]};}):[]};}):[]:[]})[_0xad41('0xe')](function(_0x35a08e){var _0x5e2fc5=[];for(var _0xfd9393=0x0;_0xfd9393<_0x35a08e['length'];_0xfd9393+=0x1){_0x5e2fc5[_0xad41('0x2a')](_0x35a08e[_0xfd9393][_0xad41('0x2b')](_0x4647d7[_0xad41('0x1a')],{'transaction':_0x4b44cb}));}return BPromise['all'](_0x5e2fc5);});})['then'](function(_0x21a669){logger[_0xad41('0xf')](_0xad41('0x3b'),_0x4647d7);logger[_0xad41('0x11')]('GetContactRecallMe',_0x4647d7,JSON['stringify'](_0x21a669));_0x4da79e(_0x21a669);})[_0xad41('0x17')](function(_0x5e1e71){logger[_0xad41('0x13')]('GetContactRecallMe',_0x5e1e71[_0xad41('0x14')],_0x4647d7);_0x26da70(_0x31aa14[_0xad41('0x13')](0x1f4,_0x5e1e71[_0xad41('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x5049ff){var _0x482862=this;return new Promise(function(_0x7d85e,_0x8d3667){db['CmContact'][_0xad41('0x20')]()[_0xad41('0xe')](function(_0x1b78b1){return db[_0xad41('0x5')][_0xad41('0x6')]({'raw':_0x5049ff[_0xad41('0x7')]?_0x5049ff[_0xad41('0x7')][_0xad41('0x8')]===undefined?!![]:![]:!![],'where':_0x5049ff[_0xad41('0x7')]?_0x5049ff[_0xad41('0x7')][_0xad41('0x9')]||null:null,'attributes':_0x5049ff[_0xad41('0x7')]?_0x5049ff[_0xad41('0x7')][_0xad41('0xa')]||null:null,'limit':_0x5049ff['options']?_0x5049ff[_0xad41('0x7')]['limit']||null:null,'include':_0x5049ff[_0xad41('0x7')]?_0x5049ff[_0xad41('0x7')][_0xad41('0xb')]?_['map'](_0x5049ff[_0xad41('0x7')][_0xad41('0xb')],function(_0xe21b00){return{'model':db[_0xe21b00[_0xad41('0xc')]],'as':_0xe21b00['as'],'attributes':_0xe21b00['as']===_0xad41('0x24')?_[_0xad41('0x3c')](_0x1b78b1):_0xe21b00[_0xad41('0xa')],'include':_0xe21b00['include']?_[_0xad41('0xd')](_0xe21b00[_0xad41('0xb')],function(_0x23f5dd){return{'model':db[_0x23f5dd['model']],'as':_0x23f5dd['as'],'attributes':_0x23f5dd[_0xad41('0xa')],'include':_0x23f5dd[_0xad41('0xb')]?_[_0xad41('0xd')](_0x23f5dd['include'],function(_0x1cf1b1){return{'model':db[_0x1cf1b1[_0xad41('0xc')]],'as':_0x1cf1b1['as'],'attributes':_0x1cf1b1[_0xad41('0xa')]};}):[]};}):[]};}):[]:[]})[_0xad41('0xe')](function(_0x288edc){logger['info'](_0xad41('0x10'),_0x5049ff);logger['debug'](_0xad41('0x10'),_0x5049ff,JSON['stringify'](_0x288edc));_0x7d85e(_0x288edc);})[_0xad41('0x17')](function(_0x20c468){logger[_0xad41('0x13')]('GetCmHopper',_0x20c468[_0xad41('0x14')],_0x5049ff);_0x8d3667(_0x482862[_0xad41('0x13')](0x1f4,_0x20c468[_0xad41('0x14')]));});});});};exports['GetContactByPhone']=function(_0x35db36){var _0x535c01=this;return new Promise(function(_0x2c3b46,_0xcc1983){return db[_0xad41('0x1f')][_0xad41('0x3d')]({'raw':!![],'where':{'phone':_0x35db36[_0xad41('0x7')][_0xad41('0x9')][_0xad41('0x3e')]},'attributes':['id',_0xad41('0x3f')],'order':[['id','DESC']]})['then'](function(_0x186823){logger[_0xad41('0xf')](_0xad41('0x40'),_0x35db36);logger[_0xad41('0x11')]('getContactByPhone',_0x35db36,JSON['stringify'](_0x186823));_0x2c3b46(_0x186823);})[_0xad41('0x17')](function(_0x1fa992){logger['error'](_0xad41('0x40'),_0x1fa992[_0xad41('0x14')],_0x35db36);_0xcc1983(_0x535c01['error'](0x1f4,_0x1fa992[_0xad41('0x14')]));});});};exports['ResetActiveCalls']=function(_0x18a90b){var _0x49ce36=this;return new Promise(function(_0x5850aa,_0x2547bb){return db[_0xad41('0x31')][_0xad41('0x21')](function(_0x3a0ed2){var _0x158ecd=_0x18a90b[_0xad41('0x7')]&&_0x18a90b[_0xad41('0x7')][_0xad41('0x9')]?_0x18a90b[_0xad41('0x7')]['where']:{};return db[_0xad41('0x5')][_0xad41('0x2b')](_0x18a90b[_0xad41('0x1a')],{'where':_0x158ecd,'transaction':_0x3a0ed2})[_0xad41('0xe')](function(_0x11944f){logger['info'](_0xad41('0x41'),_0x18a90b);logger[_0xad41('0x11')](_0xad41('0x41'),_0x18a90b,JSON[_0xad41('0x12')](_0x11944f));_0x5850aa(_0x11944f);})[_0xad41('0x17')](function(_0x970885){logger['error'](_0xad41('0x41'),_0x970885[_0xad41('0x14')],_0x18a90b);_0x2547bb(_0x49ce36[_0xad41('0x13')](0x1f4,_0x970885[_0xad41('0x14')]));});});});};exports[_0xad41('0x42')]=function(_0x385683){var _0x42b36f=this;var _0x334383=_0x385683[_0xad41('0x1a')][_0xad41('0x9')][_0xad41('0x43')];var _0x4796c0=_0x385683[_0xad41('0x1a')][_0xad41('0x9')][_0xad41('0x44')];var _0x172902=_0x385683[_0xad41('0x1a')][_0xad41('0x9')][_0xad41('0x45')];return new Promise(function(_0x4a616d,_0x335aa3){return db['CmHopper'][_0xad41('0x6')]({'where':{'voiceQueueId':{'$in':_0x334383},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xad41('0x31')][_0xad41('0x36')](_0xad41('0x46')+_0x4796c0+_0xad41('0x47')),'$gt':db[_0xad41('0x31')][_0xad41('0x36')]('NOW()')}},'UserId':{'$in':_0x172902}},'include':[{'model':db[_0xad41('0x1f')],'as':_0xad41('0x24')},{'model':db[_0xad41('0x25')],'as':_0xad41('0x26'),'attributes':['id','name','voicePause']},{'model':db[_0xad41('0x48')],'as':_0xad41('0x49')}]})[_0xad41('0xe')](function(_0x2457ca){if(_0x2457ca[_0xad41('0x2c')]>0x0){return db[_0xad41('0x31')][_0xad41('0x21')](function(_0x114729){return db[_0xad41('0x5')]['update']({'recallmeNotifiedDate':db[_0xad41('0x31')][_0xad41('0x36')](_0xad41('0x4a'))},{'where':{'id':{'$in':_[_0xad41('0xd')](_0x2457ca,'id')}},'transaction':_0x114729})[_0xad41('0xe')](function(){_0x4a616d(_0x2457ca);})[_0xad41('0x17')](function(_0x4cd7cf){logger[_0xad41('0x13')](_0xad41('0x42'),_0x4cd7cf['message'],_0x385683);_0x335aa3(_0x42b36f[_0xad41('0x13')](0x1f4,_0x4cd7cf[_0xad41('0x14')]));});})['catch'](function(_0x55f77b){logger[_0xad41('0x13')](_0xad41('0x42'),_0x55f77b[_0xad41('0x14')],_0x385683);_0x335aa3(_0x42b36f[_0xad41('0x13')](0x1f4,_0x55f77b[_0xad41('0x14')]));});}else{_0x4a616d(_0x2457ca);}});});}; \ No newline at end of file +var _0x3aee=['info','debug','stringify','catch','error','message','ShowCmHopper','find','where','model','CreateCmHopper','body','UpdateCmHopper','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','sequelize','transaction','order','Contact','User','Agent','voicePause','length','UserId','update','includes','push','GetContactDialer','dataValues','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','LOCK','UPDATE','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','literal','NOW()','name','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','include','map','then'];(function(_0x3ed666,_0x3345f9){var _0x1587f5=function(_0x304fd0){while(--_0x304fd0){_0x3ed666['push'](_0x3ed666['shift']());}};_0x1587f5(++_0x3345f9);}(_0x3aee,0x131));var _0xe3ae=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x3aee[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0xe3ae('0x0'));var util=require(_0xe3ae('0x1'));var moment=require('moment');var BPromise=require(_0xe3ae('0x2'));var db=require(_0xe3ae('0x3'))['db'];var logger=require(_0xe3ae('0x4'))(_0xe3ae('0x5'));exports[_0xe3ae('0x6')]=function(_0xec17e5){var _0x5f256e=this;return new Promise(function(_0x5b9740,_0x349253){return db[_0xe3ae('0x7')][_0xe3ae('0x8')]({'raw':_0xec17e5[_0xe3ae('0x9')]?_0xec17e5[_0xe3ae('0x9')][_0xe3ae('0xa')]===undefined?!![]:![]:!![],'where':_0xec17e5['options']?_0xec17e5[_0xe3ae('0x9')]['where']||null:null,'attributes':_0xec17e5[_0xe3ae('0x9')]?_0xec17e5[_0xe3ae('0x9')][_0xe3ae('0xb')]||null:null,'limit':_0xec17e5['options']?_0xec17e5['options']['limit']||null:null,'include':_0xec17e5[_0xe3ae('0x9')]?_0xec17e5[_0xe3ae('0x9')][_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0xec17e5[_0xe3ae('0x9')][_0xe3ae('0xc')],function(_0x49f525){return{'model':db[_0x49f525['model']],'as':_0x49f525['as'],'attributes':_0x49f525[_0xe3ae('0xb')],'include':_0x49f525[_0xe3ae('0xc')]?_['map'](_0x49f525['include'],function(_0x2a3ea8){return{'model':db[_0x2a3ea8['model']],'as':_0x2a3ea8['as'],'attributes':_0x2a3ea8[_0xe3ae('0xb')],'include':_0x2a3ea8[_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x2a3ea8[_0xe3ae('0xc')],function(_0x1eb66c){return{'model':db[_0x1eb66c['model']],'as':_0x1eb66c['as'],'attributes':_0x1eb66c[_0xe3ae('0xb')]};}):[]};}):[]};}):[]:[]})[_0xe3ae('0xe')](function(_0x4e505a){logger[_0xe3ae('0xf')](_0xe3ae('0x6'),_0xec17e5);logger[_0xe3ae('0x10')]('GetCmHopper',_0xec17e5,JSON[_0xe3ae('0x11')](_0x4e505a));_0x5b9740(_0x4e505a);})[_0xe3ae('0x12')](function(_0x5b6872){logger[_0xe3ae('0x13')]('GetCmHopper',_0x5b6872[_0xe3ae('0x14')],_0xec17e5);_0x349253(_0x5f256e[_0xe3ae('0x13')](0x1f4,_0x5b6872[_0xe3ae('0x14')]));});});};exports[_0xe3ae('0x15')]=function(_0x2272c0){var _0x280266=this;return new Promise(function(_0x5dba66,_0x48743e){return db[_0xe3ae('0x7')][_0xe3ae('0x16')]({'raw':_0x2272c0[_0xe3ae('0x9')]?_0x2272c0['options'][_0xe3ae('0xa')]===undefined?!![]:![]:!![],'where':_0x2272c0[_0xe3ae('0x9')]?_0x2272c0[_0xe3ae('0x9')][_0xe3ae('0x17')]||null:null,'attributes':_0x2272c0[_0xe3ae('0x9')]?_0x2272c0[_0xe3ae('0x9')][_0xe3ae('0xb')]||null:null,'include':_0x2272c0[_0xe3ae('0x9')]?_0x2272c0[_0xe3ae('0x9')][_0xe3ae('0xc')]?_['map'](_0x2272c0[_0xe3ae('0x9')][_0xe3ae('0xc')],function(_0x38c6b1){return{'model':db[_0x38c6b1['model']],'as':_0x38c6b1['as'],'attributes':_0x38c6b1[_0xe3ae('0xb')],'include':_0x38c6b1[_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x38c6b1[_0xe3ae('0xc')],function(_0x4b03fa){return{'model':db[_0x4b03fa[_0xe3ae('0x18')]],'as':_0x4b03fa['as'],'attributes':_0x4b03fa[_0xe3ae('0xb')],'include':_0x4b03fa[_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x4b03fa['include'],function(_0x4c0a5c){return{'model':db[_0x4c0a5c[_0xe3ae('0x18')]],'as':_0x4c0a5c['as'],'attributes':_0x4c0a5c[_0xe3ae('0xb')]};}):[]};}):[]};}):[]:[]})[_0xe3ae('0xe')](function(_0x540bd5){logger[_0xe3ae('0xf')]('ShowCmHopper',_0x2272c0);logger[_0xe3ae('0x10')]('ShowCmHopper',_0x2272c0,JSON[_0xe3ae('0x11')](_0x540bd5));_0x5dba66(_0x540bd5);})[_0xe3ae('0x12')](function(_0x243921){logger[_0xe3ae('0x13')](_0xe3ae('0x15'),_0x243921[_0xe3ae('0x14')],_0x2272c0);_0x48743e(_0x280266[_0xe3ae('0x13')](0x1f4,_0x243921[_0xe3ae('0x14')]));});});};exports[_0xe3ae('0x19')]=function(_0x14d09d){var _0x39341e=this;return new Promise(function(_0x2f1321,_0x2e2147){return db[_0xe3ae('0x7')]['create'](_0x14d09d[_0xe3ae('0x1a')],{'raw':_0x14d09d[_0xe3ae('0x9')]?_0x14d09d[_0xe3ae('0x9')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1aa01b){logger['info'](_0xe3ae('0x19'),_0x14d09d);logger[_0xe3ae('0x10')](_0xe3ae('0x19'),_0x14d09d,JSON['stringify'](_0x1aa01b));_0x2f1321(_0x1aa01b);})[_0xe3ae('0x12')](function(_0x219da7){logger[_0xe3ae('0x13')](_0xe3ae('0x19'),_0x219da7[_0xe3ae('0x14')],_0x14d09d);_0x2e2147(_0x39341e[_0xe3ae('0x13')](0x1f4,_0x219da7['message']));});});};exports[_0xe3ae('0x1b')]=function(_0xac2b09){var _0x1dc87b=this;return new Promise(function(_0x38ddef,_0x37a841){return db['CmHopper']['update'](_0xac2b09[_0xe3ae('0x1a')],{'raw':_0xac2b09[_0xe3ae('0x9')]?_0xac2b09[_0xe3ae('0x9')][_0xe3ae('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xac2b09[_0xe3ae('0x9')]?_0xac2b09[_0xe3ae('0x9')][_0xe3ae('0x17')]||null:null,'attributes':_0xac2b09[_0xe3ae('0x9')]?_0xac2b09[_0xe3ae('0x9')]['attributes']||null:null,'limit':_0xac2b09[_0xe3ae('0x9')]?_0xac2b09['options'][_0xe3ae('0x1c')]||null:null})[_0xe3ae('0xe')](function(_0x910eb){logger[_0xe3ae('0xf')](_0xe3ae('0x1b'),_0xac2b09);logger[_0xe3ae('0xf')](_0xe3ae('0x1d'),JSON['stringify'](_0xac2b09[_0xe3ae('0x9')][_0xe3ae('0x17')]),_0xac2b09[_0xe3ae('0x1a')][_0xe3ae('0x1e')]);logger[_0xe3ae('0x10')](_0xe3ae('0x1b'),_0xac2b09,JSON[_0xe3ae('0x11')](_0x910eb));_0x38ddef(_0x910eb);})[_0xe3ae('0x12')](function(_0x2ddc29){logger[_0xe3ae('0x13')]('UpdateCmHopper',_0x2ddc29[_0xe3ae('0x14')],_0xac2b09);_0x37a841(_0x1dc87b['error'](0x1f4,_0x2ddc29[_0xe3ae('0x14')]));});});};exports[_0xe3ae('0x1f')]=function(_0x3ffa45){var _0x3195e2=this;return new Promise(function(_0x4c9f5e,_0x27080f){return db[_0xe3ae('0x7')][_0xe3ae('0x20')]({'where':_0x3ffa45[_0xe3ae('0x9')]?_0x3ffa45[_0xe3ae('0x9')]['where']||null:null})[_0xe3ae('0xe')](function(_0x16cfaa){logger[_0xe3ae('0xf')]('DestroyCmHopper',_0x3ffa45);logger[_0xe3ae('0x10')](_0xe3ae('0x1f'),_0x3ffa45,JSON['stringify'](_0x16cfaa));_0x4c9f5e(_0x16cfaa);})[_0xe3ae('0x12')](function(_0x28f8eb){logger['error'](_0xe3ae('0x1f'),_0x28f8eb[_0xe3ae('0x14')],_0x3ffa45);_0x27080f(_0x3195e2[_0xe3ae('0x13')](0x1f4,_0x28f8eb['message']));});});};exports['GetContactDialer']=function(_0x591106){var _0x5ed912=this;return new Promise(function(_0x375ea9,_0x1070b3){return db[_0xe3ae('0x21')]['describe']()['then'](function(_0x498a0e){return db[_0xe3ae('0x22')][_0xe3ae('0x23')](function(_0x5514f8){return db[_0xe3ae('0x7')][_0xe3ae('0x8')]({'where':_0x591106[_0xe3ae('0x9')]?_0x591106[_0xe3ae('0x9')]['where']||null:null,'attributes':_0x591106[_0xe3ae('0x9')]?_0x591106['options']['attributes']||null:null,'limit':_0x591106[_0xe3ae('0x9')]?_0x591106[_0xe3ae('0x9')]['limit']||null:null,'order':_0x591106[_0xe3ae('0x9')]?_0x591106[_0xe3ae('0x9')][_0xe3ae('0x24')]||null:null,'transaction':_0x5514f8,'lock':_0x5514f8['LOCK']['UPDATE'],'include':[{'model':db[_0xe3ae('0x21')],'as':_0xe3ae('0x25'),'attributes':_['keys'](_0x498a0e)},{'model':db[_0xe3ae('0x26')],'as':_0xe3ae('0x27'),'attributes':['id','name',_0xe3ae('0x28')]}]})[_0xe3ae('0xe')](function(_0x5ea0a0){var _0x46bc95=[];var _0x41f07d=[];for(var _0x5df0ce=0x0;_0x5df0ce<_0x5ea0a0[_0xe3ae('0x29')];_0x5df0ce+=0x1){var _0xab3897=_0x5ea0a0[_0x5df0ce][_0xe3ae('0x2a')];if(_0xab3897===null){_0x46bc95['push'](_0x5ea0a0[_0x5df0ce][_0xe3ae('0x2b')](_0x591106[_0xe3ae('0x1a')],{'transaction':_0x5514f8}));}else if(!_0x41f07d[_0xe3ae('0x2c')](_0xab3897)){_0x41f07d[_0xe3ae('0x2d')](_0xab3897);_0x46bc95[_0xe3ae('0x2d')](_0x5ea0a0[_0x5df0ce][_0xe3ae('0x2b')](_0x591106[_0xe3ae('0x1a')],{'transaction':_0x5514f8}));}}return BPromise['all'](_0x46bc95);});})['then'](function(_0x4b488e){logger[_0xe3ae('0xf')](_0xe3ae('0x2e'),_0x591106);if(_0x4b488e['length']>0x0){logger[_0xe3ae('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x4b488e[0x0][_0xe3ae('0x2f')]['id'],_0x4b488e[0x0][_0xe3ae('0x2f')]['ContactId'],_0x4b488e[0x0][_0xe3ae('0x2f')][_0xe3ae('0x1e')]);}logger[_0xe3ae('0x10')](_0xe3ae('0x2e'),_0x591106,JSON[_0xe3ae('0x11')](_0x4b488e));_0x375ea9(_0x4b488e);})[_0xe3ae('0x12')](function(_0x1d064c){logger[_0xe3ae('0x13')](_0xe3ae('0x2e'),_0x1d064c['message'],_0x591106);_0x1070b3(_0x5ed912['error'](0x1f4,_0x1d064c[_0xe3ae('0x14')]));});});});};exports[_0xe3ae('0x30')]=function(_0xd9fb41){var _0x13ea50=this;return new Promise(function(_0x3c0a32,_0x45c797){return db[_0xe3ae('0x22')][_0xe3ae('0x23')](function(_0x1f3619){return db[_0xe3ae('0x31')][_0xe3ae('0x32')](_0xd9fb41[_0xe3ae('0x1a')],{'raw':_0xd9fb41[_0xe3ae('0x9')]?_0xd9fb41[_0xe3ae('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1f3619})[_0xe3ae('0xe')](function(){logger[_0xe3ae('0xf')](_0xe3ae('0x33'),JSON['stringify'](_0xd9fb41[_0xe3ae('0x9')][_0xe3ae('0x17')]),_0xd9fb41['options'][_0xe3ae('0x17')]['active']);return db[_0xe3ae('0x7')][_0xe3ae('0x20')]({'where':_0xd9fb41[_0xe3ae('0x9')]?_0xd9fb41['options'][_0xe3ae('0x17')]||null:null,'transaction':_0x1f3619});});})['then'](function(_0x43393b){logger['info'](_0xe3ae('0x30'),_0xd9fb41);logger[_0xe3ae('0x10')](_0xe3ae('0x30'),_0xd9fb41,JSON['stringify'](_0x43393b));_0x3c0a32(_0x43393b);})['catch'](function(_0x1ee28b){logger[_0xe3ae('0x13')]('MoveContactManagedDialer',_0x1ee28b['message'],_0xd9fb41);_0x45c797(_0x13ea50[_0xe3ae('0x13')](0x1f4,_0x1ee28b['message']));});});};exports[_0xe3ae('0x34')]=function(_0x3d86ad){var _0x5ce8b0=this;return new Promise(function(_0x454160,_0x34e85f){return db[_0xe3ae('0x7')][_0xe3ae('0x8')]({'raw':_0x3d86ad['options']?_0x3d86ad[_0xe3ae('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x3d86ad[_0xe3ae('0x9')]?_0x3d86ad[_0xe3ae('0x9')]['where']||null:null,'attributes':[[db[_0xe3ae('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe3ae('0x35')+util[_0xe3ae('0x36')](_0xe3ae('0x37'),moment()[_0xe3ae('0x36')](_0xe3ae('0x38')))+'\x20,\x201,\x20null'))),_0xe3ae('0x39')]]})[_0xe3ae('0xe')](function(_0x1c63ed){logger[_0xe3ae('0xf')](_0xe3ae('0x34'),_0x3d86ad);logger['debug'](_0xe3ae('0x34'),_0x3d86ad,JSON[_0xe3ae('0x11')](_0x1c63ed));_0x454160(_0x1c63ed);})[_0xe3ae('0x12')](function(_0x592af3){logger[_0xe3ae('0x13')]('CountReScheduled',_0x592af3[_0xe3ae('0x14')],_0x3d86ad);_0x34e85f(_0x5ce8b0['error'](0x1f4,_0x592af3[_0xe3ae('0x14')]));});});};exports[_0xe3ae('0x3a')]=function(_0x2966c3){var _0x9d1029=this;return new Promise(function(_0x3a8e1c,_0x591382){return db[_0xe3ae('0x21')][_0xe3ae('0x3b')]()[_0xe3ae('0xe')](function(){return db[_0xe3ae('0x22')][_0xe3ae('0x23')](function(_0x3041b3){return db[_0xe3ae('0x7')]['findAll']({'where':_0x2966c3['options']?_0x2966c3['options'][_0xe3ae('0x17')]||null:null,'attributes':_0x2966c3['options']?_0x2966c3[_0xe3ae('0x9')][_0xe3ae('0xb')]||null:null,'limit':0x1,'order':_0x2966c3[_0xe3ae('0x9')]?_0x2966c3[_0xe3ae('0x9')][_0xe3ae('0x24')]||null:null,'group':db[_0xe3ae('0x7')][_0xe3ae('0x2a')],'transaction':_0x3041b3,'lock':_0x3041b3[_0xe3ae('0x3c')][_0xe3ae('0x3d')],'include':_0x2966c3['options']?_0x2966c3['options']['include']?_[_0xe3ae('0xd')](_0x2966c3[_0xe3ae('0x9')][_0xe3ae('0xc')],function(_0x379a7a){return{'model':db[_0x379a7a[_0xe3ae('0x18')]],'as':_0x379a7a['as'],'attributes':_0x379a7a[_0xe3ae('0xb')],'include':_0x379a7a[_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x379a7a[_0xe3ae('0xc')],function(_0x35bc68){return{'model':db[_0x35bc68[_0xe3ae('0x18')]],'as':_0x35bc68['as'],'attributes':_0x35bc68[_0xe3ae('0xb')],'include':_0x35bc68[_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x35bc68[_0xe3ae('0xc')],function(_0x34ee76){return{'model':db[_0x34ee76[_0xe3ae('0x18')]],'as':_0x34ee76['as'],'attributes':_0x34ee76['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3ae('0xe')](function(_0x1fbb30){var _0x43eaa3=[];for(var _0x2b0aa2=0x0;_0x2b0aa2<_0x1fbb30[_0xe3ae('0x29')];_0x2b0aa2+=0x1){_0x43eaa3['push'](_0x1fbb30[_0x2b0aa2][_0xe3ae('0x2b')](_0x2966c3[_0xe3ae('0x1a')],{'transaction':_0x3041b3}));}return BPromise['all'](_0x43eaa3);});})['then'](function(_0xe4af19){logger[_0xe3ae('0xf')](_0xe3ae('0x3a'),_0x2966c3);logger['debug'](_0xe3ae('0x3a'),_0x2966c3,JSON[_0xe3ae('0x11')](_0xe4af19));_0x3a8e1c(_0xe4af19);})[_0xe3ae('0x12')](function(_0x244294){logger[_0xe3ae('0x13')](_0xe3ae('0x3a'),_0x244294[_0xe3ae('0x14')],_0x2966c3);_0x591382(_0x9d1029[_0xe3ae('0x13')](0x1f4,_0x244294[_0xe3ae('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x1b995e){var _0xd154cd=this;return new Promise(function(_0x5e3cca,_0x124270){db['CmContact'][_0xe3ae('0x3b')]()[_0xe3ae('0xe')](function(_0x93c02f){return db['CmHopper']['findAll']({'raw':_0x1b995e[_0xe3ae('0x9')]?_0x1b995e[_0xe3ae('0x9')][_0xe3ae('0xa')]===undefined?!![]:![]:!![],'where':_0x1b995e[_0xe3ae('0x9')]?_0x1b995e[_0xe3ae('0x9')][_0xe3ae('0x17')]||null:null,'attributes':_0x1b995e['options']?_0x1b995e[_0xe3ae('0x9')][_0xe3ae('0xb')]||null:null,'limit':_0x1b995e[_0xe3ae('0x9')]?_0x1b995e['options']['limit']||null:null,'include':_0x1b995e['options']?_0x1b995e[_0xe3ae('0x9')][_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x1b995e[_0xe3ae('0x9')]['include'],function(_0x4696bd){return{'model':db[_0x4696bd[_0xe3ae('0x18')]],'as':_0x4696bd['as'],'attributes':_0x4696bd['as']==='Contact'?_[_0xe3ae('0x3e')](_0x93c02f):_0x4696bd[_0xe3ae('0xb')],'include':_0x4696bd['include']?_['map'](_0x4696bd[_0xe3ae('0xc')],function(_0x4fc4f9){return{'model':db[_0x4fc4f9[_0xe3ae('0x18')]],'as':_0x4fc4f9['as'],'attributes':_0x4fc4f9[_0xe3ae('0xb')],'include':_0x4fc4f9[_0xe3ae('0xc')]?_[_0xe3ae('0xd')](_0x4fc4f9[_0xe3ae('0xc')],function(_0x4bf982){return{'model':db[_0x4bf982[_0xe3ae('0x18')]],'as':_0x4bf982['as'],'attributes':_0x4bf982[_0xe3ae('0xb')]};}):[]};}):[]};}):[]:[]})[_0xe3ae('0xe')](function(_0x1d5104){logger[_0xe3ae('0xf')](_0xe3ae('0x6'),_0x1b995e);logger[_0xe3ae('0x10')](_0xe3ae('0x6'),_0x1b995e,JSON['stringify'](_0x1d5104));_0x5e3cca(_0x1d5104);})['catch'](function(_0x3ca789){logger[_0xe3ae('0x13')](_0xe3ae('0x6'),_0x3ca789['message'],_0x1b995e);_0x124270(_0xd154cd[_0xe3ae('0x13')](0x1f4,_0x3ca789[_0xe3ae('0x14')]));});});});};exports[_0xe3ae('0x3f')]=function(_0x3ff2aa){var _0x456edc=this;return new Promise(function(_0x5985b6,_0x4229de){return db['CmContact'][_0xe3ae('0x40')]({'raw':!![],'where':{'phone':_0x3ff2aa[_0xe3ae('0x9')][_0xe3ae('0x17')]['phone']},'attributes':['id',_0xe3ae('0x41')],'order':[['id',_0xe3ae('0x42')]]})[_0xe3ae('0xe')](function(_0x5eb360){logger['info']('getContactByPhone',_0x3ff2aa);logger[_0xe3ae('0x10')](_0xe3ae('0x43'),_0x3ff2aa,JSON[_0xe3ae('0x11')](_0x5eb360));_0x5985b6(_0x5eb360);})[_0xe3ae('0x12')](function(_0x22eacc){logger[_0xe3ae('0x13')]('getContactByPhone',_0x22eacc['message'],_0x3ff2aa);_0x4229de(_0x456edc[_0xe3ae('0x13')](0x1f4,_0x22eacc[_0xe3ae('0x14')]));});});};exports['ResetActiveCalls']=function(_0x3798e6){var _0x5952a8=this;return new Promise(function(_0x344493,_0x241def){return db[_0xe3ae('0x22')][_0xe3ae('0x23')](function(_0x405609){var _0x46b909=_0x3798e6['options']&&_0x3798e6[_0xe3ae('0x9')][_0xe3ae('0x17')]?_0x3798e6[_0xe3ae('0x9')][_0xe3ae('0x17')]:{};return db[_0xe3ae('0x7')][_0xe3ae('0x2b')](_0x3798e6[_0xe3ae('0x1a')],{'where':_0x46b909,'transaction':_0x405609})['then'](function(_0x396f9b){logger[_0xe3ae('0xf')]('ResetActiveCalls',_0x3798e6);logger[_0xe3ae('0x10')](_0xe3ae('0x44'),_0x3798e6,JSON['stringify'](_0x396f9b));_0x344493(_0x396f9b);})[_0xe3ae('0x12')](function(_0x30f011){logger[_0xe3ae('0x13')](_0xe3ae('0x44'),_0x30f011['message'],_0x3798e6);_0x241def(_0x5952a8['error'](0x1f4,_0x30f011['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x19d421){var _0x372e2b=this;var _0x11b1b2=_0x19d421['body']['where'][_0xe3ae('0x45')];var _0x40c6c0=_0x19d421[_0xe3ae('0x1a')][_0xe3ae('0x17')][_0xe3ae('0x46')];var _0x256c1e=_0x19d421[_0xe3ae('0x1a')][_0xe3ae('0x17')][_0xe3ae('0x47')];return new Promise(function(_0x26b4ad,_0x3ca3fc){return db[_0xe3ae('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x11b1b2},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe3ae('0x22')]['literal'](_0xe3ae('0x48')+_0x40c6c0+_0xe3ae('0x49')),'$gt':db[_0xe3ae('0x22')][_0xe3ae('0x4a')](_0xe3ae('0x4b'))}},'UserId':{'$in':_0x256c1e}},'include':[{'model':db[_0xe3ae('0x21')],'as':'Contact'},{'model':db[_0xe3ae('0x26')],'as':_0xe3ae('0x27'),'attributes':['id',_0xe3ae('0x4c'),_0xe3ae('0x28')]},{'model':db[_0xe3ae('0x4d')],'as':_0xe3ae('0x4e')}]})[_0xe3ae('0xe')](function(_0x720e8c){if(_0x720e8c[_0xe3ae('0x29')]>0x0){return db[_0xe3ae('0x22')]['transaction'](function(_0xd7435d){return db['CmHopper'][_0xe3ae('0x2b')]({'recallmeNotifiedDate':db[_0xe3ae('0x22')][_0xe3ae('0x4a')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x720e8c,'id')}},'transaction':_0xd7435d})[_0xe3ae('0xe')](function(){_0x26b4ad(_0x720e8c);})[_0xe3ae('0x12')](function(_0x3e2a2f){logger['error'](_0xe3ae('0x4f'),_0x3e2a2f[_0xe3ae('0x14')],_0x19d421);_0x3ca3fc(_0x372e2b[_0xe3ae('0x13')](0x1f4,_0x3e2a2f[_0xe3ae('0x14')]));});})[_0xe3ae('0x12')](function(_0x2ace6b){logger[_0xe3ae('0x13')](_0xe3ae('0x4f'),_0x2ace6b[_0xe3ae('0x14')],_0x19d421);_0x3ca3fc(_0x372e2b[_0xe3ae('0x13')](0x1f4,_0x2ace6b['message']));});}else{_0x26b4ad(_0x720e8c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 1e94778..c234b44 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 _0x4485=['/timezone','getTimezone','update','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post','/preview','getPreview'];(function(_0x288766,_0x3247a5){var _0x327187=function(_0x38501b){while(--_0x38501b){_0x288766['push'](_0x288766['shift']());}};_0x327187(++_0x3247a5);}(_0x4485,0xe1));var _0x5448=function(_0x2724e5,_0x229d74){_0x2724e5=_0x2724e5-0x0;var _0x4b6621=_0x4485[_0x2724e5];return _0x4b6621;};'use strict';var express=require('express');var router=express[_0x5448('0x0')]();var auth=require(_0x5448('0x1'));var controller=require(_0x5448('0x2'));router[_0x5448('0x3')]('/',auth[_0x5448('0x4')](),controller['index']);router['get'](_0x5448('0x5'),auth['isAuthenticated'](),controller[_0x5448('0x6')]);router[_0x5448('0x3')]('/opencontacts',auth[_0x5448('0x4')](),controller[_0x5448('0x7')]);router[_0x5448('0x3')](_0x5448('0x8'),auth[_0x5448('0x4')](),controller[_0x5448('0x9')]);router['get'](_0x5448('0xa'),auth[_0x5448('0x4')](),controller['show']);router[_0x5448('0x3')](_0x5448('0xb'),auth[_0x5448('0x4')](),controller['getPreviewRecall']);router[_0x5448('0xc')]('/',auth[_0x5448('0x4')](),controller['create']);router[_0x5448('0xc')](_0x5448('0xd'),auth[_0x5448('0x4')](),controller[_0x5448('0xe')]);router[_0x5448('0xc')](_0x5448('0xf'),auth[_0x5448('0x4')](),controller[_0x5448('0x10')]);router['put'](_0x5448('0xa'),auth[_0x5448('0x4')](),controller[_0x5448('0x11')]);router[_0x5448('0x12')](_0x5448('0xa'),auth[_0x5448('0x4')](),controller['destroy']);module[_0x5448('0x13')]=router; \ No newline at end of file +var _0xceb1=['index','/describe','describe','/opencontacts','/:id','show','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xceb1,0xc0));var _0x1ceb=function(_0x65006,_0x4deb59){_0x65006=_0x65006-0x0;var _0xbbe6a3=_0xceb1[_0x65006];return _0xbbe6a3;};'use strict';var express=require(_0x1ceb('0x0'));var router=express[_0x1ceb('0x1')]();var auth=require(_0x1ceb('0x2'));var controller=require(_0x1ceb('0x3'));router[_0x1ceb('0x4')]('/',auth[_0x1ceb('0x5')](),controller[_0x1ceb('0x6')]);router[_0x1ceb('0x4')](_0x1ceb('0x7'),auth[_0x1ceb('0x5')](),controller[_0x1ceb('0x8')]);router[_0x1ceb('0x4')](_0x1ceb('0x9'),auth[_0x1ceb('0x5')](),controller['getOpenContacts']);router['get']('/timezones',auth[_0x1ceb('0x5')](),controller['getTimezones']);router['get'](_0x1ceb('0xa'),auth[_0x1ceb('0x5')](),controller[_0x1ceb('0xb')]);router['get']('/:id/previewrecall',auth[_0x1ceb('0x5')](),controller[_0x1ceb('0xc')]);router[_0x1ceb('0xd')]('/',auth[_0x1ceb('0x5')](),controller['create']);router[_0x1ceb('0xd')](_0x1ceb('0xe'),auth[_0x1ceb('0x5')](),controller[_0x1ceb('0xf')]);router[_0x1ceb('0xd')](_0x1ceb('0x10'),auth[_0x1ceb('0x5')](),controller[_0x1ceb('0x11')]);router[_0x1ceb('0x12')](_0x1ceb('0xa'),auth[_0x1ceb('0x5')](),controller[_0x1ceb('0x13')]);router[_0x1ceb('0x14')](_0x1ceb('0xa'),auth[_0x1ceb('0x5')](),controller['destroy']);module[_0x1ceb('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ac06005..8fe2d9b 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 _0xcfa6=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment','sequelize','exports','STRING','DATE','format'];(function(_0x1825d1,_0x37c89c){var _0xefb147=function(_0x17b65b){while(--_0x17b65b){_0x1825d1['push'](_0x1825d1['shift']());}};_0xefb147(++_0x37c89c);}(_0xcfa6,0x19a));var _0x6cfa=function(_0x5e374a,_0x525a8c){_0x5e374a=_0x5e374a-0x0;var _0x4460db=_0xcfa6[_0x5e374a];return _0x4460db;};'use strict';var moment=require(_0x6cfa('0x0'));var Sequelize=require(_0x6cfa('0x1'));module[_0x6cfa('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x6cfa('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6cfa('0x4')],'defaultValue':moment()[_0x6cfa('0x5')](_0x6cfa('0x6'))},'countbusyretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6cfa('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x56b3=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x56b3,0x18c));var _0x356b=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x56b3[_0x2ab365];return _0x49fef3;};'use strict';var moment=require('moment');var Sequelize=require(_0x356b('0x0'));module[_0x356b('0x1')]={'CmHopperId':{'type':Sequelize[_0x356b('0x2')]},'phone':{'type':Sequelize[_0x356b('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x356b('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x356b('0x4')],'defaultValue':moment()[_0x356b('0x5')](_0x356b('0x6'))},'countbusyretry':{'type':Sequelize[_0x356b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x356b('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x356b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 3946eb5..4fcf082 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 _0x81f1=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x81f1,0x14f));var _0x181f=function(_0x2a6558,_0x86acaa){_0x2a6558=_0x2a6558-0x0;var _0x257640=_0x81f1[_0x2a6558];return _0x257640;};'use strict';var emlformat=require(_0x181f('0x0'));var rimraf=require(_0x181f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x181f('0x2'));var rp=require(_0x181f('0x3'));var moment=require('moment');var BPromise=require(_0x181f('0x4'));var Mustache=require('mustache');var util=require(_0x181f('0x5'));var path=require(_0x181f('0x6'));var sox=require(_0x181f('0x7'));var csv=require(_0x181f('0x8'));var ejs=require(_0x181f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x181f('0xa'));var squel=require(_0x181f('0xb'));var crypto=require(_0x181f('0xc'));var jsforce=require(_0x181f('0xd'));var deskjs=require(_0x181f('0xe'));var toCsv=require(_0x181f('0x8'));var querystring=require(_0x181f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x181f('0x10'));var as=require(_0x181f('0x11'));var hardwareService=require(_0x181f('0x12'));var logger=require(_0x181f('0x13'))(_0x181f('0x14'));var utils=require(_0x181f('0x15'));var config=require(_0x181f('0x16'));var licenseUtil=require(_0x181f('0x17'));var db=require(_0x181f('0x18'))['db'];function respondWithStatusCode(_0x46e428,_0x4010c1){_0x4010c1=_0x4010c1||0xcc;return function(_0x196fac){if(_0x196fac){return _0x46e428['sendStatus'](_0x4010c1);}return _0x46e428[_0x181f('0x19')](_0x4010c1)[_0x181f('0x1a')]();};}function respondWithResult(_0x2f2731,_0x56953e){_0x56953e=_0x56953e||0xc8;return function(_0x59a232){if(_0x59a232){return _0x2f2731[_0x181f('0x19')](_0x56953e)[_0x181f('0x1b')](_0x59a232);}};}function respondWithFilteredResult(_0x3888ab,_0x599783){return function(_0x3208c7){if(_0x3208c7){var _0x47646e=typeof _0x599783[_0x181f('0x1c')]===_0x181f('0x1d')&&typeof _0x599783[_0x181f('0x1e')]===_0x181f('0x1d');var _0x5e6631=_0x3208c7[_0x181f('0x1f')];var _0x310fdb=_0x47646e?0x0:_0x599783['offset'];var _0x48bffa=_0x47646e?_0x3208c7[_0x181f('0x1f')]:_0x599783['offset']+_0x599783[_0x181f('0x1e')];var _0x872f2;if(_0x48bffa>=_0x5e6631){_0x48bffa=_0x5e6631;_0x872f2=0xc8;}else{_0x872f2=0xce;}_0x3888ab['status'](_0x872f2);return _0x3888ab[_0x181f('0x20')](_0x181f('0x21'),_0x310fdb+'-'+_0x48bffa+'/'+_0x5e6631)[_0x181f('0x1b')](_0x3208c7);}return null;};}function patchUpdates(_0x5a8cfd){return function(_0x3cea0a){try{jsonpatch[_0x181f('0x22')](_0x3cea0a,_0x5a8cfd,!![]);}catch(_0x53c310){return BPromise[_0x181f('0x23')](_0x53c310);}return _0x3cea0a[_0x181f('0x24')]();};}function saveUpdates(_0x3ea165,_0x536b51){return function(_0x5c999a){if(_0x5c999a){return _0x5c999a['update'](_0x3ea165)[_0x181f('0x25')](function(_0x21382a){return _0x21382a;});}return null;};}function removeEntity(_0x50e9bb,_0x26de9e){return function(_0x3e6a3a){if(_0x3e6a3a){return _0x3e6a3a[_0x181f('0x26')]()[_0x181f('0x25')](function(){var _0x119cfc=_0x3e6a3a['get']({'plain':!![]});var _0x1aa916=_0x181f('0x27');return db[_0x181f('0x28')][_0x181f('0x26')]({'where':{'type':_0x1aa916,'resourceId':_0x119cfc['id']}})['then'](function(){return _0x3e6a3a;});})['then'](function(){_0x50e9bb[_0x181f('0x19')](0xcc)[_0x181f('0x1a')]();});}};}function handleEntityNotFound(_0x5c2d4b,_0x3549de){return function(_0x1aa003){if(!_0x1aa003){_0x5c2d4b[_0x181f('0x29')](0x194);}return _0x1aa003;};}function handleError(_0x374f5c,_0x57cbe0){_0x57cbe0=_0x57cbe0||0x1f4;return function(_0x5aedf7){logger['error'](_0x5aedf7[_0x181f('0x2a')]);if(_0x5aedf7['name']){delete _0x5aedf7[_0x181f('0x2b')];}_0x374f5c[_0x181f('0x19')](_0x57cbe0)[_0x181f('0x2c')](_0x5aedf7);};}exports[_0x181f('0x2d')]=function(_0x1e75d7,_0x164d1c){var _0x3b6233={},_0x2d854b={},_0x170259={'count':0x0,'rows':[]};var _0x1f46ab=_[_0x181f('0x2e')](db[_0x181f('0x2f')][_0x181f('0x30')],function(_0x4d9196){return{'name':_0x4d9196['fieldName'],'type':_0x4d9196[_0x181f('0x31')][_0x181f('0x32')]};});_0x2d854b['model']=_[_0x181f('0x2e')](_0x1f46ab,_0x181f('0x2b'));_0x2d854b[_0x181f('0x33')]=_[_0x181f('0x34')](_0x1e75d7['query']);_0x2d854b[_0x181f('0x35')]=_[_0x181f('0x36')](_0x2d854b[_0x181f('0x37')],_0x2d854b[_0x181f('0x33')]);_0x3b6233[_0x181f('0x38')]=_['intersection'](_0x2d854b['model'],qs[_0x181f('0x39')](_0x1e75d7['query'][_0x181f('0x39')]));_0x3b6233['attributes']=_0x3b6233[_0x181f('0x38')][_0x181f('0x3a')]?_0x3b6233[_0x181f('0x38')]:_0x2d854b[_0x181f('0x37')];if(!_0x1e75d7[_0x181f('0x33')]['hasOwnProperty'](_0x181f('0x3b'))){_0x3b6233['limit']=qs['limit'](_0x1e75d7[_0x181f('0x33')][_0x181f('0x1e')]);_0x3b6233[_0x181f('0x1c')]=qs['offset'](_0x1e75d7[_0x181f('0x33')][_0x181f('0x1c')]);}_0x3b6233[_0x181f('0x3c')]=qs[_0x181f('0x3d')](_0x1e75d7[_0x181f('0x33')]['sort']);_0x3b6233[_0x181f('0x3e')]=qs[_0x181f('0x35')](_[_0x181f('0x3f')](_0x1e75d7[_0x181f('0x33')],_0x2d854b[_0x181f('0x35')]),_0x1f46ab);if(_0x1e75d7['query'][_0x181f('0x40')]){_0x3b6233[_0x181f('0x3e')]=_[_0x181f('0x41')](_0x3b6233[_0x181f('0x3e')],{'$or':_[_0x181f('0x2e')](_0x1f46ab,function(_0xd0384b){if(_0xd0384b[_0x181f('0x31')]!=='VIRTUAL'){var _0xc4e94e={};_0xc4e94e[_0xd0384b[_0x181f('0x2b')]]={'$like':'%'+_0x1e75d7[_0x181f('0x33')][_0x181f('0x40')]+'%'};return _0xc4e94e;}})});}_0x3b6233=_['merge']({},_0x3b6233,_0x1e75d7[_0x181f('0x42')]);var _0x4fdbcf={'where':_0x3b6233[_0x181f('0x3e')]};return db[_0x181f('0x2f')][_0x181f('0x1f')](_0x4fdbcf)['then'](function(_0x1824c5){_0x170259['count']=_0x1824c5;if(_0x1e75d7[_0x181f('0x33')][_0x181f('0x43')]){_0x3b6233['include']=[{'all':!![]}];}return db[_0x181f('0x2f')][_0x181f('0x44')](_0x3b6233);})[_0x181f('0x25')](function(_0x384132){_0x170259[_0x181f('0x45')]=_0x384132;return _0x170259;})[_0x181f('0x25')](respondWithFilteredResult(_0x164d1c,_0x3b6233))[_0x181f('0x46')](handleError(_0x164d1c,null));};exports['show']=function(_0x6371c,_0x56ab94){var _0x3acd3b={'raw':!![],'where':{'id':_0x6371c[_0x181f('0x47')]['id']}},_0x4b837e={};_0x4b837e['model']=_[_0x181f('0x34')](db['CmHopperAdditionalPhone'][_0x181f('0x30')]);_0x4b837e[_0x181f('0x33')]=_['keys'](_0x6371c[_0x181f('0x33')]);_0x4b837e[_0x181f('0x35')]=_[_0x181f('0x36')](_0x4b837e[_0x181f('0x37')],_0x4b837e[_0x181f('0x33')]);_0x3acd3b['attributes']=_[_0x181f('0x36')](_0x4b837e['model'],qs[_0x181f('0x39')](_0x6371c[_0x181f('0x33')][_0x181f('0x39')]));_0x3acd3b['attributes']=_0x3acd3b[_0x181f('0x38')]['length']?_0x3acd3b[_0x181f('0x38')]:_0x4b837e['model'];if(_0x6371c[_0x181f('0x33')][_0x181f('0x43')]){_0x3acd3b[_0x181f('0x48')]=[{'all':!![]}];}_0x3acd3b=_[_0x181f('0x41')]({},_0x3acd3b,_0x6371c[_0x181f('0x42')]);return db[_0x181f('0x2f')][_0x181f('0x49')](_0x3acd3b)['then'](handleEntityNotFound(_0x56ab94,null))[_0x181f('0x25')](respondWithResult(_0x56ab94,null))['catch'](handleError(_0x56ab94,null));};exports[_0x181f('0x4a')]=function(_0xfa1fd,_0x40a92a){return db[_0x181f('0x2f')][_0x181f('0x4a')](_0xfa1fd['body'],{})['then'](function(_0x468a65){var _0x1985f7=_0xfa1fd[_0x181f('0x4b')][_0x181f('0x4c')]({'plain':!![]});if(!_0x1985f7)throw new Error(_0x181f('0x4d'));if(_0x1985f7[_0x181f('0x4e')]===_0x181f('0x4b')){var _0x2f847a=_0x468a65[_0x181f('0x4c')]({'plain':!![]});var _0x544832=_0x181f('0x27');return db[_0x181f('0x4f')]['find']({'where':{'name':_0x544832,'userProfileId':_0x1985f7[_0x181f('0x50')]},'raw':!![]})[_0x181f('0x25')](function(_0x3c7371){if(_0x3c7371&&_0x3c7371[_0x181f('0x51')]===0x0){return db[_0x181f('0x28')][_0x181f('0x4a')]({'name':_0x2f847a[_0x181f('0x2b')],'resourceId':_0x2f847a['id'],'type':_0x3c7371[_0x181f('0x2b')],'sectionId':_0x3c7371['id']},{})[_0x181f('0x25')](function(){return _0x468a65;});}else{return _0x468a65;}})[_0x181f('0x46')](function(_0x259fdf){logger[_0x181f('0x52')](_0x181f('0x53'),_0x259fdf);throw _0x259fdf;});}return _0x468a65;})[_0x181f('0x25')](respondWithResult(_0x40a92a,0xc9))['catch'](handleError(_0x40a92a,null));};exports[_0x181f('0x54')]=function(_0x595bf6,_0xd2bd5e){if(_0x595bf6[_0x181f('0x55')]['id']){delete _0x595bf6[_0x181f('0x55')]['id'];}return db[_0x181f('0x2f')][_0x181f('0x49')]({'where':{'id':_0x595bf6[_0x181f('0x47')]['id']}})[_0x181f('0x25')](handleEntityNotFound(_0xd2bd5e,null))[_0x181f('0x25')](saveUpdates(_0x595bf6[_0x181f('0x55')],null))['then'](respondWithResult(_0xd2bd5e,null))['catch'](handleError(_0xd2bd5e,null));};exports[_0x181f('0x26')]=function(_0x322262,_0x4ed174){return db[_0x181f('0x2f')]['find']({'where':{'id':_0x322262[_0x181f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ed174,null))[_0x181f('0x25')](removeEntity(_0x4ed174,null))[_0x181f('0x46')](handleError(_0x4ed174,null));}; \ No newline at end of file +var _0xdeed=['Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CmHopperAdditionalPhone','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set'];(function(_0x45638d,_0x35c778){var _0x36412e=function(_0x4bf2e0){while(--_0x4bf2e0){_0x45638d['push'](_0x45638d['shift']());}};_0x36412e(++_0x35c778);}(_0xdeed,0xd5));var _0xddee=function(_0x149489,_0x1486f4){_0x149489=_0x149489-0x0;var _0x1160a6=_0xdeed[_0x149489];return _0x1160a6;};'use strict';var emlformat=require(_0xddee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xddee('0x1'));var rp=require('request-promise');var moment=require(_0xddee('0x2'));var BPromise=require(_0xddee('0x3'));var Mustache=require('mustache');var util=require(_0xddee('0x4'));var path=require(_0xddee('0x5'));var sox=require(_0xddee('0x6'));var csv=require(_0xddee('0x7'));var ejs=require(_0xddee('0x8'));var fs=require('fs');var fs_extra=require(_0xddee('0x9'));var _=require(_0xddee('0xa'));var squel=require(_0xddee('0xb'));var crypto=require('crypto');var jsforce=require(_0xddee('0xc'));var deskjs=require(_0xddee('0xd'));var toCsv=require(_0xddee('0x7'));var querystring=require(_0xddee('0xe'));var Papa=require(_0xddee('0xf'));var Redis=require(_0xddee('0x10'));var authService=require(_0xddee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddee('0x12'));var hardwareService=require(_0xddee('0x13'));var logger=require(_0xddee('0x14'))('api');var utils=require(_0xddee('0x15'));var config=require(_0xddee('0x16'));var licenseUtil=require(_0xddee('0x17'));var db=require(_0xddee('0x18'))['db'];function respondWithStatusCode(_0x2f8389,_0x197a06){_0x197a06=_0x197a06||0xcc;return function(_0x40c0bd){if(_0x40c0bd){return _0x2f8389[_0xddee('0x19')](_0x197a06);}return _0x2f8389['status'](_0x197a06)[_0xddee('0x1a')]();};}function respondWithResult(_0x20135e,_0x123427){_0x123427=_0x123427||0xc8;return function(_0x8446bc){if(_0x8446bc){return _0x20135e['status'](_0x123427)[_0xddee('0x1b')](_0x8446bc);}};}function respondWithFilteredResult(_0x1f97f4,_0x5718a0){return function(_0x377d00){if(_0x377d00){var _0x240b26=typeof _0x5718a0[_0xddee('0x1c')]===_0xddee('0x1d')&&typeof _0x5718a0[_0xddee('0x1e')]===_0xddee('0x1d');var _0xe51095=_0x377d00[_0xddee('0x1f')];var _0x2032ee=_0x240b26?0x0:_0x5718a0[_0xddee('0x1c')];var _0x1fd203=_0x240b26?_0x377d00[_0xddee('0x1f')]:_0x5718a0[_0xddee('0x1c')]+_0x5718a0[_0xddee('0x1e')];var _0x4d12de;if(_0x1fd203>=_0xe51095){_0x1fd203=_0xe51095;_0x4d12de=0xc8;}else{_0x4d12de=0xce;}_0x1f97f4['status'](_0x4d12de);return _0x1f97f4[_0xddee('0x20')](_0xddee('0x21'),_0x2032ee+'-'+_0x1fd203+'/'+_0xe51095)['json'](_0x377d00);}return null;};}function patchUpdates(_0x32e1a9){return function(_0x30f523){try{jsonpatch[_0xddee('0x22')](_0x30f523,_0x32e1a9,!![]);}catch(_0x47326f){return BPromise['reject'](_0x47326f);}return _0x30f523[_0xddee('0x23')]();};}function saveUpdates(_0x40b618,_0x19b4b4){return function(_0x4b14a4){if(_0x4b14a4){return _0x4b14a4[_0xddee('0x24')](_0x40b618)[_0xddee('0x25')](function(_0x2246a3){return _0x2246a3;});}return null;};}function removeEntity(_0x3c5cd8,_0x278cef){return function(_0x513341){if(_0x513341){return _0x513341[_0xddee('0x26')]()['then'](function(){var _0x1d8772=_0x513341[_0xddee('0x27')]({'plain':!![]});var _0x27e215=_0xddee('0x28');return db[_0xddee('0x29')]['destroy']({'where':{'type':_0x27e215,'resourceId':_0x1d8772['id']}})[_0xddee('0x25')](function(){return _0x513341;});})[_0xddee('0x25')](function(){_0x3c5cd8['status'](0xcc)[_0xddee('0x1a')]();});}};}function handleEntityNotFound(_0x4244c6,_0x38ca01){return function(_0xbb27e3){if(!_0xbb27e3){_0x4244c6['sendStatus'](0x194);}return _0xbb27e3;};}function handleError(_0x2d6920,_0x4377d4){_0x4377d4=_0x4377d4||0x1f4;return function(_0xb54903){logger['error'](_0xb54903[_0xddee('0x2a')]);if(_0xb54903['name']){delete _0xb54903[_0xddee('0x2b')];}_0x2d6920['status'](_0x4377d4)[_0xddee('0x2c')](_0xb54903);};}exports[_0xddee('0x2d')]=function(_0x38792d,_0x53c97d){var _0x4dad3d={},_0x1374a8={},_0x5220ee={'count':0x0,'rows':[]};var _0x4f6f33=_[_0xddee('0x2e')](db['CmHopperAdditionalPhone'][_0xddee('0x2f')],function(_0x4f06de){return{'name':_0x4f06de['fieldName'],'type':_0x4f06de[_0xddee('0x30')]['key']};});_0x1374a8[_0xddee('0x31')]=_[_0xddee('0x2e')](_0x4f6f33,'name');_0x1374a8['query']=_[_0xddee('0x32')](_0x38792d['query']);_0x1374a8[_0xddee('0x33')]=_[_0xddee('0x34')](_0x1374a8[_0xddee('0x31')],_0x1374a8[_0xddee('0x35')]);_0x4dad3d[_0xddee('0x36')]=_[_0xddee('0x34')](_0x1374a8[_0xddee('0x31')],qs['fields'](_0x38792d[_0xddee('0x35')][_0xddee('0x37')]));_0x4dad3d[_0xddee('0x36')]=_0x4dad3d['attributes'][_0xddee('0x38')]?_0x4dad3d[_0xddee('0x36')]:_0x1374a8['model'];if(!_0x38792d[_0xddee('0x35')][_0xddee('0x39')](_0xddee('0x3a'))){_0x4dad3d['limit']=qs[_0xddee('0x1e')](_0x38792d['query'][_0xddee('0x1e')]);_0x4dad3d['offset']=qs[_0xddee('0x1c')](_0x38792d['query']['offset']);}_0x4dad3d[_0xddee('0x3b')]=qs['sort'](_0x38792d[_0xddee('0x35')][_0xddee('0x3c')]);_0x4dad3d[_0xddee('0x3d')]=qs[_0xddee('0x33')](_['pick'](_0x38792d[_0xddee('0x35')],_0x1374a8[_0xddee('0x33')]),_0x4f6f33);if(_0x38792d[_0xddee('0x35')][_0xddee('0x3e')]){_0x4dad3d[_0xddee('0x3d')]=_[_0xddee('0x3f')](_0x4dad3d[_0xddee('0x3d')],{'$or':_[_0xddee('0x2e')](_0x4f6f33,function(_0x24760a){if(_0x24760a[_0xddee('0x30')]!=='VIRTUAL'){var _0x2b42d6={};_0x2b42d6[_0x24760a[_0xddee('0x2b')]]={'$like':'%'+_0x38792d[_0xddee('0x35')]['filter']+'%'};return _0x2b42d6;}})});}_0x4dad3d=_[_0xddee('0x3f')]({},_0x4dad3d,_0x38792d[_0xddee('0x40')]);var _0x4807d0={'where':_0x4dad3d['where']};return db[_0xddee('0x41')][_0xddee('0x1f')](_0x4807d0)[_0xddee('0x25')](function(_0x42431c){_0x5220ee[_0xddee('0x1f')]=_0x42431c;if(_0x38792d[_0xddee('0x35')][_0xddee('0x42')]){_0x4dad3d['include']=[{'all':!![]}];}return db[_0xddee('0x41')][_0xddee('0x43')](_0x4dad3d);})[_0xddee('0x25')](function(_0x49b1e9){_0x5220ee['rows']=_0x49b1e9;return _0x5220ee;})[_0xddee('0x25')](respondWithFilteredResult(_0x53c97d,_0x4dad3d))[_0xddee('0x44')](handleError(_0x53c97d,null));};exports[_0xddee('0x45')]=function(_0x1ac425,_0xced781){var _0x53e017={'raw':!![],'where':{'id':_0x1ac425[_0xddee('0x46')]['id']}},_0x44d83d={};_0x44d83d[_0xddee('0x31')]=_[_0xddee('0x32')](db[_0xddee('0x41')]['rawAttributes']);_0x44d83d[_0xddee('0x35')]=_[_0xddee('0x32')](_0x1ac425[_0xddee('0x35')]);_0x44d83d[_0xddee('0x33')]=_[_0xddee('0x34')](_0x44d83d[_0xddee('0x31')],_0x44d83d[_0xddee('0x35')]);_0x53e017[_0xddee('0x36')]=_[_0xddee('0x34')](_0x44d83d[_0xddee('0x31')],qs[_0xddee('0x37')](_0x1ac425[_0xddee('0x35')]['fields']));_0x53e017[_0xddee('0x36')]=_0x53e017[_0xddee('0x36')][_0xddee('0x38')]?_0x53e017[_0xddee('0x36')]:_0x44d83d[_0xddee('0x31')];if(_0x1ac425['query'][_0xddee('0x42')]){_0x53e017[_0xddee('0x47')]=[{'all':!![]}];}_0x53e017=_['merge']({},_0x53e017,_0x1ac425[_0xddee('0x40')]);return db['CmHopperAdditionalPhone'][_0xddee('0x48')](_0x53e017)[_0xddee('0x25')](handleEntityNotFound(_0xced781,null))['then'](respondWithResult(_0xced781,null))['catch'](handleError(_0xced781,null));};exports['create']=function(_0x5f42f8,_0x2f4194){return db['CmHopperAdditionalPhone'][_0xddee('0x49')](_0x5f42f8[_0xddee('0x4a')],{})[_0xddee('0x25')](function(_0x78b691){var _0x37cb20=_0x5f42f8[_0xddee('0x4b')][_0xddee('0x27')]({'plain':!![]});if(!_0x37cb20)throw new Error(_0xddee('0x4c'));if(_0x37cb20[_0xddee('0x4d')]===_0xddee('0x4b')){var _0x46a0f0=_0x78b691[_0xddee('0x27')]({'plain':!![]});var _0x28caf8=_0xddee('0x28');return db[_0xddee('0x4e')]['find']({'where':{'name':_0x28caf8,'userProfileId':_0x37cb20[_0xddee('0x4f')]},'raw':!![]})[_0xddee('0x25')](function(_0x202f71){if(_0x202f71&&_0x202f71[_0xddee('0x50')]===0x0){return db[_0xddee('0x29')][_0xddee('0x49')]({'name':_0x46a0f0['name'],'resourceId':_0x46a0f0['id'],'type':_0x202f71[_0xddee('0x2b')],'sectionId':_0x202f71['id']},{})[_0xddee('0x25')](function(){return _0x78b691;});}else{return _0x78b691;}})[_0xddee('0x44')](function(_0x2ea700){logger[_0xddee('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ea700);throw _0x2ea700;});}return _0x78b691;})[_0xddee('0x25')](respondWithResult(_0x2f4194,0xc9))[_0xddee('0x44')](handleError(_0x2f4194,null));};exports[_0xddee('0x24')]=function(_0x4d29ce,_0x13bbf0){if(_0x4d29ce[_0xddee('0x4a')]['id']){delete _0x4d29ce[_0xddee('0x4a')]['id'];}return db[_0xddee('0x41')][_0xddee('0x48')]({'where':{'id':_0x4d29ce[_0xddee('0x46')]['id']}})[_0xddee('0x25')](handleEntityNotFound(_0x13bbf0,null))[_0xddee('0x25')](saveUpdates(_0x4d29ce[_0xddee('0x4a')],null))[_0xddee('0x25')](respondWithResult(_0x13bbf0,null))['catch'](handleError(_0x13bbf0,null));};exports[_0xddee('0x26')]=function(_0x5f3371,_0x325f4e){return db[_0xddee('0x41')][_0xddee('0x48')]({'where':{'id':_0x5f3371[_0xddee('0x46')]['id']}})[_0xddee('0x25')](handleEntityNotFound(_0x325f4e,null))['then'](removeEntity(_0x325f4e,null))[_0xddee('0x44')](handleError(_0x325f4e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f52f484..d3b6cf1 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 _0x3ee0=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x4e89e8,_0x50afec){var _0x10dee4=function(_0x3fb670){while(--_0x3fb670){_0x4e89e8['push'](_0x4e89e8['shift']());}};_0x10dee4(++_0x50afec);}(_0x3ee0,0x12b));var _0x03ee=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3ee0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x03ee('0x0'));var util=require(_0x03ee('0x1'));var logger=require(_0x03ee('0x2'))(_0x03ee('0x3'));var moment=require('moment');var BPromise=require(_0x03ee('0x4'));var rp=require(_0x03ee('0x5'));var fs=require('fs');var path=require(_0x03ee('0x6'));var rimraf=require('rimraf');var config=require(_0x03ee('0x7'));var attributes=require(_0x03ee('0x8'));module[_0x03ee('0x9')]=function(_0x247897,_0x11881f){return _0x247897[_0x03ee('0xa')](_0x03ee('0xb'),attributes,{'tableName':_0x03ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081c=['path','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x081c,0x17a));var _0xc081=function(_0x5a75e7,_0x3ad506){_0x5a75e7=_0x5a75e7-0x0;var _0x15c695=_0x081c[_0x5a75e7];return _0x15c695;};'use strict';var _=require(_0xc081('0x0'));var util=require(_0xc081('0x1'));var logger=require(_0xc081('0x2'))(_0xc081('0x3'));var moment=require('moment');var BPromise=require(_0xc081('0x4'));var rp=require(_0xc081('0x5'));var fs=require('fs');var path=require(_0xc081('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc081('0x7'));module[_0xc081('0x8')]=function(_0x19b440,_0x1a367c){return _0x19b440[_0xc081('0x9')](_0xc081('0xa'),attributes,{'tableName':_0xc081('0xb'),'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 32e35fc..63c9a25 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 _0xae64=['field','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','entity','dialGlobalMaxRetry','OrderBy','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','sequelize','update','IncrementPreviewCounters'];(function(_0x4bb055,_0x48257a){var _0x2ab87e=function(_0x4afb40){while(--_0x4afb40){_0x4bb055['push'](_0x4bb055['shift']());}};_0x2ab87e(++_0x48257a);}(_0xae64,0x190));var _0x4ae6=function(_0xf1aa01,_0x477960){_0xf1aa01=_0xf1aa01-0x0;var _0x2e8946=_0xae64[_0xf1aa01];return _0x2e8946;};'use strict';var _=require(_0x4ae6('0x0'));var util=require('util');var moment=require(_0x4ae6('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae6('0x2'));var fs=require('fs');var Redis=require(_0x4ae6('0x3'));var db=require(_0x4ae6('0x4'))['db'];var utils=require(_0x4ae6('0x5'));var logger=require(_0x4ae6('0x6'))(_0x4ae6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ae6('0x8')][_0x4ae6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a179b,_0x4f3764,_0x528552){return new BPromise(function(_0x203170,_0x542990){return client[_0x4ae6('0xa')](_0x4a179b,_0x528552)[_0x4ae6('0xb')](function(_0x19f9fb){logger[_0x4ae6('0xc')](_0x4ae6('0xd'),_0x4f3764,_0x4ae6('0xe'));logger[_0x4ae6('0xf')](_0x4ae6('0x10'),_0x4f3764,'request\x20sent',JSON['stringify'](_0x19f9fb));if(_0x19f9fb[_0x4ae6('0x11')]){if(_0x19f9fb[_0x4ae6('0x11')][_0x4ae6('0x12')]===0x1f4){logger[_0x4ae6('0x11')](_0x4ae6('0xd'),_0x4f3764,_0x19f9fb[_0x4ae6('0x11')][_0x4ae6('0x13')]);return _0x542990(_0x19f9fb[_0x4ae6('0x11')][_0x4ae6('0x13')]);}logger['error'](_0x4ae6('0xd'),_0x4f3764,_0x19f9fb['error']['message']);return _0x203170(_0x19f9fb['error'][_0x4ae6('0x13')]);}else{logger[_0x4ae6('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4f3764,_0x4ae6('0xe'));_0x203170(_0x19f9fb[_0x4ae6('0x14')][_0x4ae6('0x13')]);}})['catch'](function(_0x5445fa){logger[_0x4ae6('0x11')](_0x4ae6('0xd'),_0x4f3764,_0x5445fa);_0x542990(_0x5445fa);});});}exports[_0x4ae6('0x15')]=function(_0xb096fe){var _0x4d4dad=this;return new Promise(function(_0x550f6b,_0x26a0a3){return db[_0x4ae6('0x16')][_0x4ae6('0x17')]({'raw':!![],'where':{'ContactId':_0xb096fe[_0x4ae6('0x18')][_0x4ae6('0x19')],'ListId':_0xb096fe['body'][_0x4ae6('0x1a')],'VoiceQueueId':_0xb096fe[_0x4ae6('0x18')][_0x4ae6('0x1b')]===undefined?null:_0xb096fe[_0x4ae6('0x18')][_0x4ae6('0x1b')],'CampaignId':_0xb096fe['body'][_0x4ae6('0x1c')]===undefined?null:_0xb096fe[_0x4ae6('0x18')][_0x4ae6('0x1c')]}})['then'](function(_0x5f4003){if(_0x5f4003!=null){return db[_0x4ae6('0x1d')][_0x4ae6('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5f4003['id'],'OrderBy':{'$gt':_0x5f4003['OrderBy']}},'order':[['OrderBy',_0x4ae6('0x1e')]]})[_0x4ae6('0xb')](function(_0x4fe158){var _0x181da0=0x0;if(_0x4fe158){if(_0x4fe158['countbusyretry']+_0x4fe158[_0x4ae6('0x1f')]+_0x4fe158[_0x4ae6('0x20')]+_0x4fe158[_0x4ae6('0x21')]+_0x4fe158['countdropretry']+_0x4fe158[_0x4ae6('0x22')]+_0x4fe158['countmachineretry']+_0x4fe158['countagentrejectretry']<_0xb096fe[_0x4ae6('0x23')][_0x4ae6('0x24')])_0x181da0=0x1;_0x550f6b({'additional':_0x181da0});}else{return db[_0x4ae6('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f4003['id']},'order':[[_0x4ae6('0x25'),_0x4ae6('0x1e')]]})[_0x4ae6('0xb')](function(_0x3e1af4){var _0x5e92ac=0x0;if(_0x3e1af4){if(_0x3e1af4[_0x4ae6('0x26')]+_0x3e1af4[_0x4ae6('0x1f')]+_0x3e1af4[_0x4ae6('0x20')]+_0x3e1af4[_0x4ae6('0x21')]+_0x3e1af4[_0x4ae6('0x27')]+_0x3e1af4[_0x4ae6('0x22')]+_0x3e1af4[_0x4ae6('0x28')]+_0x3e1af4[_0x4ae6('0x29')]<_0xb096fe[_0x4ae6('0x23')][_0x4ae6('0x24')])_0x5e92ac=0x1;_0x550f6b({'additional':_0x5e92ac});}else{_0x550f6b({'additional':0x0});}})[_0x4ae6('0x2a')](function(_0x19e460){logger['error']('VerifyAdditionalPhones',_0x19e460[_0x4ae6('0x13')]);_0x26a0a3(_0x4d4dad['error'](0x1f4,_0x19e460['message']));});}})[_0x4ae6('0x2a')](function(_0x4d791f){logger[_0x4ae6('0x11')](_0x4ae6('0x15'),_0x4d791f[_0x4ae6('0x13')]);_0x26a0a3(_0x4d4dad[_0x4ae6('0x11')](0x1f4,_0x4d791f['message']));});}else _0x550f6b({'additional':0x0});});});};exports[_0x4ae6('0x2b')]=function(_0x10430b){var _0xb69a8c=this;return new Promise(function(_0x137d3d,_0x1cc7b2){return db['CmHopper'][_0x4ae6('0x17')]({'raw':!![],'where':{'ContactId':_0x10430b['body'][_0x4ae6('0x19')],'ListId':_0x10430b[_0x4ae6('0x18')][_0x4ae6('0x1a')],'VoiceQueueId':_0x10430b[_0x4ae6('0x18')][_0x4ae6('0x1b')]===undefined?null:_0x10430b[_0x4ae6('0x18')][_0x4ae6('0x1b')],'CampaignId':_0x10430b[_0x4ae6('0x18')]['CampaignId']===undefined?null:_0x10430b[_0x4ae6('0x18')][_0x4ae6('0x1c')]}})[_0x4ae6('0xb')](function(_0x3fd908){if(_0x3fd908!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3fd908['id'],'OrderBy':{'$gte':_0x3fd908['OrderBy']}},'order':[[_0x4ae6('0x25'),_0x4ae6('0x1e')]]})[_0x4ae6('0xb')](function(_0x323ca4){if(_0x323ca4)return activateAdditionalPhone(_0x3fd908,_0x10430b['body'],_0x323ca4,_0x10430b[_0x4ae6('0x2c')],_0x10430b[_0x4ae6('0x2d')])['then'](function(_0xe43e37){_0x137d3d(_0xe43e37);});else{return db[_0x4ae6('0x1d')][_0x4ae6('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fd908['id']},'order':[[_0x4ae6('0x25'),_0x4ae6('0x1e')]]})[_0x4ae6('0xb')](function(_0x2b3aee){if(_0x2b3aee)return activateAdditionalPhone(_0x3fd908,_0x10430b[_0x4ae6('0x18')],_0x2b3aee,_0x10430b[_0x4ae6('0x2c')],_0x10430b[_0x4ae6('0x2d')])[_0x4ae6('0xb')](function(_0xf921f4){_0x137d3d(_0xf921f4);});else{_0x137d3d({'id':_0x3fd908['id'],'phone':''});}})['catch'](function(_0x2e1110){logger[_0x4ae6('0x11')]('VerifyAdditionalPhones',_0x2e1110[_0x4ae6('0x13')]);_0x1cc7b2(_0xb69a8c[_0x4ae6('0x11')](0x1f4,_0x2e1110[_0x4ae6('0x13')]));});}})[_0x4ae6('0x2a')](function(_0x2306d9){logger['error'](_0x4ae6('0x15'),_0x2306d9[_0x4ae6('0x13')]);_0x1cc7b2(_0xb69a8c[_0x4ae6('0x11')](0x1f4,_0x2306d9[_0x4ae6('0x13')]));});}else _0x137d3d(0x1);});});};function activateAdditionalPhone(_0x3cdab4,_0x560402,_0x4a79e2,_0x19acb0,_0x3d70aa){return new Promise(function(_0x43b1a5,_0x5d4afe){var _0x556330;if(_[_0x4ae6('0x2e')](_0x4a79e2[_0x4ae6('0x2f')])){_0x4a79e2[_0x4ae6('0x2f')]=moment();}if(moment()>moment(_0x4a79e2['scheduledat'])){_0x556330=moment()[_0x4ae6('0x30')](_0x3d70aa||0x3,_0x4ae6('0x31'));}else{if(_0x4a79e2['OrderBy']==0x0){_0x556330=moment(_0x4a79e2[_0x4ae6('0x2f')]);}else{_0x556330=moment()[_0x4ae6('0x30')](_0x3d70aa||0x3,'minutes');}}if(_[_0x4ae6('0x2e')](_0x556330)){_0x556330=moment()[_0x4ae6('0x30')](_0x3d70aa||0x3,'minutes');}var _0x435cc1={'phone':_0x3cdab4['phone'],'active':0x0,'OrderBy':_[_0x4ae6('0x2e')](_0x3cdab4['OrderBy'])?0x0:_0x3cdab4[_0x4ae6('0x25')],'scheduledat':moment()[_0x4ae6('0x30')](_0x19acb0||0x1,_0x4ae6('0x31')),'countbusyretry':_0x560402[_0x4ae6('0x26')],'countcongestionretry':_0x560402[_0x4ae6('0x1f')],'countnoanswerretry':_0x560402[_0x4ae6('0x20')],'countnosuchnumberretry':_0x560402['countnosuchnumberretry'],'countdropretry':_0x560402[_0x4ae6('0x27')],'countabandonedretry':_0x560402['countabandonedretry'],'countmachineretry':_0x560402['countmachineretry'],'countagentrejectretry':_0x560402[_0x4ae6('0x29')],'createdAt':_0x560402[_0x4ae6('0x32')],'updatedAt':_0x560402[_0x4ae6('0x33')]};var _0x595d6b={'CmHopperId':_0x3cdab4['id'],'phone':_0x4a79e2[_0x4ae6('0x34')],'active':0x0,'OrderBy':_[_0x4ae6('0x2e')](_0x4a79e2['OrderBy'])?0x0:_0x4a79e2[_0x4ae6('0x25')],'scheduledat':_0x556330,'countbusyretry':_0x4a79e2[_0x4ae6('0x26')],'countcongestionretry':_0x4a79e2[_0x4ae6('0x1f')],'countnoanswerretry':_0x4a79e2[_0x4ae6('0x20')],'countnosuchnumberretry':_0x4a79e2[_0x4ae6('0x21')],'countdropretry':_0x4a79e2[_0x4ae6('0x27')],'countabandonedretry':_0x4a79e2['countabandonedretry'],'countmachineretry':_0x4a79e2['countmachineretry'],'countagentrejectretry':_0x4a79e2[_0x4ae6('0x29')],'createdAt':_0x4a79e2[_0x4ae6('0x32')],'updatedAt':_0x4a79e2[_0x4ae6('0x33')]};return db[_0x4ae6('0x35')]['transaction'](function(_0xa25ed){return db[_0x4ae6('0x1d')][_0x4ae6('0x36')](_0x435cc1,{'where':{'id':_0x4a79e2['id']}},{'transaction':_0xa25ed})[_0x4ae6('0xb')](function(){return db[_0x4ae6('0x16')][_0x4ae6('0x36')](_0x595d6b,{'where':{'id':_0x3cdab4['id']}},{'transaction':_0xa25ed});});})['then'](function(_0xe6fc6d){_0x43b1a5({'id':_0x3cdab4['id'],'phone':_0x4a79e2[_0x4ae6('0x34')]});})[_0x4ae6('0x2a')](function(_0x3c9401){logger[_0x4ae6('0x11')]('activateAdditionalPhone',_0x3c9401[_0x4ae6('0x13')]);_0x5d4afe({'error':_0x3c9401[_0x4ae6('0x13')]});});});}exports[_0x4ae6('0x37')]=function(_0x59ecd8){var _0x597dd5=this;return new Promise(function(_0x4bf3dd,_0x144b0b){return db[_0x4ae6('0x16')]['update'](_0x59ecd8[_0x4ae6('0x18')][_0x4ae6('0x38')],{'where':{'id':_0x59ecd8[_0x4ae6('0x18')]['id']}})['then'](function(_0x1f4974){_0x4bf3dd(_0x1f4974);})[_0x4ae6('0x2a')](function(_0x5d3d79){logger[_0x4ae6('0x11')](_0x4ae6('0x37'),_0x5d3d79[_0x4ae6('0x13')]);_0x144b0b(_0x597dd5[_0x4ae6('0x11')](0x1f4,_0x5d3d79[_0x4ae6('0x13')]));});});}; \ No newline at end of file +var _0x2148=['duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','findOne','ASC','countbusyretry','countcongestionretry','countabandonedretry','countmachineretry','entity','VerifyAdditionalPhones','ContactId','waitTime'];(function(_0xee4e7c,_0x20c913){var _0x2871f6=function(_0x5770a6){while(--_0x5770a6){_0xee4e7c['push'](_0xee4e7c['shift']());}};_0x2871f6(++_0x20c913);}(_0x2148,0x1d5));var _0x8214=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x2148[_0x3d27a];return _0x314fd7;};'use strict';var _=require('lodash');var util=require(_0x8214('0x0'));var moment=require(_0x8214('0x1'));var BPromise=require('bluebird');var rs=require(_0x8214('0x2'));var fs=require('fs');var Redis=require(_0x8214('0x3'));var db=require(_0x8214('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8214('0x5'))(_0x8214('0x6'));var config=require(_0x8214('0x7'));var jayson=require(_0x8214('0x8'));var client=jayson[_0x8214('0x9')][_0x8214('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6448,_0x13628a,_0x4dface){return new BPromise(function(_0x1a6be9,_0x3c8269){return client[_0x8214('0xb')](_0x4e6448,_0x4dface)[_0x8214('0xc')](function(_0x38e909){logger['info'](_0x8214('0xd'),_0x13628a,_0x8214('0xe'));logger['debug'](_0x8214('0xf'),_0x13628a,_0x8214('0xe'),JSON[_0x8214('0x10')](_0x38e909));if(_0x38e909['error']){if(_0x38e909[_0x8214('0x11')][_0x8214('0x12')]===0x1f4){logger[_0x8214('0x11')](_0x8214('0xd'),_0x13628a,_0x38e909[_0x8214('0x11')][_0x8214('0x13')]);return _0x3c8269(_0x38e909[_0x8214('0x11')]['message']);}logger[_0x8214('0x11')](_0x8214('0xd'),_0x13628a,_0x38e909[_0x8214('0x11')][_0x8214('0x13')]);return _0x1a6be9(_0x38e909[_0x8214('0x11')][_0x8214('0x13')]);}else{logger['info'](_0x8214('0xd'),_0x13628a,_0x8214('0xe'));_0x1a6be9(_0x38e909[_0x8214('0x14')]['message']);}})[_0x8214('0x15')](function(_0x367057){logger[_0x8214('0x11')](_0x8214('0xd'),_0x13628a,_0x367057);_0x3c8269(_0x367057);});});}exports['VerifyAdditionalPhones']=function(_0x4d1864){var _0x23ded3=this;return new Promise(function(_0x3d3b7f,_0x374d3d){return db[_0x8214('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x4d1864[_0x8214('0x17')]['ContactId'],'ListId':_0x4d1864[_0x8214('0x17')][_0x8214('0x18')],'VoiceQueueId':_0x4d1864['body']['VoiceQueueId']===undefined?null:_0x4d1864[_0x8214('0x17')][_0x8214('0x19')],'CampaignId':_0x4d1864['body'][_0x8214('0x1a')]===undefined?null:_0x4d1864[_0x8214('0x17')][_0x8214('0x1a')]}})[_0x8214('0xc')](function(_0x5933cc){if(_0x5933cc!=null){return db[_0x8214('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5933cc['id'],'OrderBy':{'$gt':_0x5933cc['OrderBy']}},'order':[[_0x8214('0x1c'),'ASC']]})[_0x8214('0xc')](function(_0x21fc32){var _0xc2b46c=0x0;if(_0x21fc32){if(_0x21fc32['countbusyretry']+_0x21fc32['countcongestionretry']+_0x21fc32[_0x8214('0x1d')]+_0x21fc32[_0x8214('0x1e')]+_0x21fc32[_0x8214('0x1f')]+_0x21fc32['countabandonedretry']+_0x21fc32['countmachineretry']+_0x21fc32[_0x8214('0x20')]<_0x4d1864['entity'][_0x8214('0x21')])_0xc2b46c=0x1;_0x3d3b7f({'additional':_0xc2b46c});}else{return db[_0x8214('0x1b')][_0x8214('0x22')]({'raw':!![],'where':{'CmHopperId':_0x5933cc['id']},'order':[[_0x8214('0x1c'),_0x8214('0x23')]]})['then'](function(_0x14e97e){var _0x3ac788=0x0;if(_0x14e97e){if(_0x14e97e[_0x8214('0x24')]+_0x14e97e[_0x8214('0x25')]+_0x14e97e['countnoanswerretry']+_0x14e97e[_0x8214('0x1e')]+_0x14e97e['countdropretry']+_0x14e97e[_0x8214('0x26')]+_0x14e97e[_0x8214('0x27')]+_0x14e97e['countagentrejectretry']<_0x4d1864[_0x8214('0x28')][_0x8214('0x21')])_0x3ac788=0x1;_0x3d3b7f({'additional':_0x3ac788});}else{_0x3d3b7f({'additional':0x0});}})[_0x8214('0x15')](function(_0x342d23){logger['error'](_0x8214('0x29'),_0x342d23[_0x8214('0x13')]);_0x374d3d(_0x23ded3[_0x8214('0x11')](0x1f4,_0x342d23[_0x8214('0x13')]));});}})[_0x8214('0x15')](function(_0x12555c){logger[_0x8214('0x11')](_0x8214('0x29'),_0x12555c[_0x8214('0x13')]);_0x374d3d(_0x23ded3[_0x8214('0x11')](0x1f4,_0x12555c[_0x8214('0x13')]));});}else _0x3d3b7f({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x287762){var _0x1325f3=this;return new Promise(function(_0x27ebd5,_0x13003e){return db[_0x8214('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x287762[_0x8214('0x17')][_0x8214('0x2a')],'ListId':_0x287762['body'][_0x8214('0x18')],'VoiceQueueId':_0x287762[_0x8214('0x17')]['VoiceQueueId']===undefined?null:_0x287762[_0x8214('0x17')][_0x8214('0x19')],'CampaignId':_0x287762[_0x8214('0x17')][_0x8214('0x1a')]===undefined?null:_0x287762[_0x8214('0x17')][_0x8214('0x1a')]}})[_0x8214('0xc')](function(_0x193d35){if(_0x193d35!=null){return db[_0x8214('0x1b')][_0x8214('0x22')]({'raw':!![],'where':{'CmHopperId':_0x193d35['id'],'OrderBy':{'$gte':_0x193d35['OrderBy']}},'order':[[_0x8214('0x1c'),_0x8214('0x23')]]})['then'](function(_0x245dd9){if(_0x245dd9)return activateAdditionalPhone(_0x193d35,_0x287762['body'],_0x245dd9,_0x287762['duration'],_0x287762[_0x8214('0x2b')])[_0x8214('0xc')](function(_0x3c2bb6){_0x27ebd5(_0x3c2bb6);});else{return db[_0x8214('0x1b')][_0x8214('0x22')]({'raw':!![],'where':{'CmHopperId':_0x193d35['id']},'order':[[_0x8214('0x1c'),_0x8214('0x23')]]})[_0x8214('0xc')](function(_0x33b5e0){if(_0x33b5e0)return activateAdditionalPhone(_0x193d35,_0x287762[_0x8214('0x17')],_0x33b5e0,_0x287762[_0x8214('0x2c')],_0x287762[_0x8214('0x2b')])[_0x8214('0xc')](function(_0xe340ee){_0x27ebd5(_0xe340ee);});else{_0x27ebd5({'id':_0x193d35['id'],'phone':''});}})[_0x8214('0x15')](function(_0x40edac){logger['error']('VerifyAdditionalPhones',_0x40edac['message']);_0x13003e(_0x1325f3[_0x8214('0x11')](0x1f4,_0x40edac['message']));});}})[_0x8214('0x15')](function(_0x37d3a5){logger[_0x8214('0x11')]('VerifyAdditionalPhones',_0x37d3a5[_0x8214('0x13')]);_0x13003e(_0x1325f3[_0x8214('0x11')](0x1f4,_0x37d3a5[_0x8214('0x13')]));});}else _0x27ebd5(0x1);});});};function activateAdditionalPhone(_0x259c28,_0xed6b71,_0x102bb8,_0x20630,_0x327809){return new Promise(function(_0x46d648,_0x5b9907){var _0x6938d6;if(_[_0x8214('0x2d')](_0x102bb8[_0x8214('0x2e')])){_0x102bb8[_0x8214('0x2e')]=moment();}if(moment()>moment(_0x102bb8[_0x8214('0x2e')])){_0x6938d6=moment()[_0x8214('0x2f')](_0x327809||0x3,_0x8214('0x30'));}else{if(_0x102bb8[_0x8214('0x1c')]==0x0){_0x6938d6=moment(_0x102bb8[_0x8214('0x2e')]);}else{_0x6938d6=moment()['add'](_0x327809||0x3,_0x8214('0x30'));}}if(_[_0x8214('0x2d')](_0x6938d6)){_0x6938d6=moment()[_0x8214('0x2f')](_0x327809||0x3,_0x8214('0x30'));}var _0x530072={'phone':_0x259c28[_0x8214('0x31')],'active':0x0,'OrderBy':_[_0x8214('0x2d')](_0x259c28[_0x8214('0x1c')])?0x0:_0x259c28[_0x8214('0x1c')],'scheduledat':moment()[_0x8214('0x2f')](_0x20630||0x1,_0x8214('0x30')),'countbusyretry':_0xed6b71[_0x8214('0x24')],'countcongestionretry':_0xed6b71[_0x8214('0x25')],'countnoanswerretry':_0xed6b71[_0x8214('0x1d')],'countnosuchnumberretry':_0xed6b71[_0x8214('0x1e')],'countdropretry':_0xed6b71['countdropretry'],'countabandonedretry':_0xed6b71[_0x8214('0x26')],'countmachineretry':_0xed6b71['countmachineretry'],'countagentrejectretry':_0xed6b71[_0x8214('0x20')],'createdAt':_0xed6b71[_0x8214('0x32')],'updatedAt':_0xed6b71[_0x8214('0x33')]};var _0x2b047d={'CmHopperId':_0x259c28['id'],'phone':_0x102bb8[_0x8214('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x102bb8[_0x8214('0x1c')])?0x0:_0x102bb8['OrderBy'],'scheduledat':_0x6938d6,'countbusyretry':_0x102bb8[_0x8214('0x24')],'countcongestionretry':_0x102bb8[_0x8214('0x25')],'countnoanswerretry':_0x102bb8['countnoanswerretry'],'countnosuchnumberretry':_0x102bb8[_0x8214('0x1e')],'countdropretry':_0x102bb8[_0x8214('0x1f')],'countabandonedretry':_0x102bb8['countabandonedretry'],'countmachineretry':_0x102bb8[_0x8214('0x27')],'countagentrejectretry':_0x102bb8['countagentrejectretry'],'createdAt':_0x102bb8[_0x8214('0x32')],'updatedAt':_0x102bb8[_0x8214('0x33')]};return db[_0x8214('0x34')][_0x8214('0x35')](function(_0x2e1560){return db[_0x8214('0x1b')][_0x8214('0x36')](_0x530072,{'where':{'id':_0x102bb8['id']}},{'transaction':_0x2e1560})['then'](function(){return db[_0x8214('0x16')]['update'](_0x2b047d,{'where':{'id':_0x259c28['id']}},{'transaction':_0x2e1560});});})['then'](function(_0x4dd943){_0x46d648({'id':_0x259c28['id'],'phone':_0x102bb8[_0x8214('0x31')]});})['catch'](function(_0x1810a4){logger[_0x8214('0x11')]('activateAdditionalPhone',_0x1810a4[_0x8214('0x13')]);_0x5b9907({'error':_0x1810a4[_0x8214('0x13')]});});});}exports[_0x8214('0x37')]=function(_0x4fb420){var _0x16db93=this;return new Promise(function(_0x362741,_0x11f64f){return db['CmHopper']['update'](_0x4fb420['body'][_0x8214('0x38')],{'where':{'id':_0x4fb420[_0x8214('0x17')]['id']}})['then'](function(_0x29cadb){_0x362741(_0x29cadb);})[_0x8214('0x15')](function(_0x3b6577){logger['error']('IncrementPreviewCounters',_0x3b6577[_0x8214('0x13')]);_0x11f64f(_0x16db93[_0x8214('0x11')](0x1f4,_0x3b6577[_0x8214('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 3ed274a..2b7faec 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 _0xc06e=['/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0xdf7d3b,_0x474cea){var _0x675076=function(_0x605a85){while(--_0x605a85){_0xdf7d3b['push'](_0xdf7d3b['shift']());}};_0x675076(++_0x474cea);}(_0xc06e,0xd5));var _0xec06=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0xc06e[_0x3b3210];return _0x5b5484;};'use strict';var multer=require(_0xec06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec06('0x1'));var express=require(_0xec06('0x2'));var router=express[_0xec06('0x3')]();var fs_extra=require(_0xec06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec06('0x5'));var config=require(_0xec06('0x6'));var controller=require(_0xec06('0x7'));router[_0xec06('0x8')]('/',auth[_0xec06('0x9')](),controller[_0xec06('0xa')]);router['get']('/:id',auth[_0xec06('0x9')](),controller[_0xec06('0xb')]);router[_0xec06('0xc')]('/',auth['isAuthenticated'](),controller[_0xec06('0xd')]);router[_0xec06('0xe')](_0xec06('0xf'),auth[_0xec06('0x9')](),controller[_0xec06('0x10')]);router[_0xec06('0x11')](_0xec06('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xec06('0x12')]=router; \ No newline at end of file +var _0x1c72=['/:id','create','put','update','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x1c72,0xca));var _0x21c7=function(_0x201c2c,_0x5ac646){_0x201c2c=_0x201c2c-0x0;var _0x562261=_0x1c72[_0x201c2c];return _0x562261;};'use strict';var multer=require(_0x21c7('0x0'));var util=require('util');var path=require(_0x21c7('0x1'));var timeout=require('connect-timeout');var express=require(_0x21c7('0x2'));var router=express['Router']();var fs_extra=require(_0x21c7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x21c7('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x21c7('0x5')]('/',auth[_0x21c7('0x6')](),controller[_0x21c7('0x7')]);router['get'](_0x21c7('0x8'),auth[_0x21c7('0x6')](),controller['show']);router['post']('/',auth[_0x21c7('0x6')](),controller[_0x21c7('0x9')]);router[_0x21c7('0xa')](_0x21c7('0x8'),auth[_0x21c7('0x6')](),controller[_0x21c7('0xb')]);router[_0x21c7('0xc')](_0x21c7('0x8'),auth[_0x21c7('0x6')](),controller['destroy']);module[_0x21c7('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4549971..0385deb 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 _0x10dc=['STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x1c712a,_0x41a447){var _0x39a74a=function(_0x2e9aaa){while(--_0x2e9aaa){_0x1c712a['push'](_0x1c712a['shift']());}};_0x39a74a(++_0x41a447);}(_0x10dc,0x107));var _0xc10d=function(_0x3e19fb,_0x3258e2){_0x3e19fb=_0x3e19fb-0x0;var _0x5b19bd=_0x10dc[_0x3e19fb];return _0x5b19bd;};'use strict';var moment=require(_0xc10d('0x0'));var Sequelize=require(_0xc10d('0x1'));module['exports']={'phone':{'type':Sequelize[_0xc10d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc10d('0x3')},'ListId':{'type':Sequelize[_0xc10d('0x4')],'unique':_0xc10d('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc10d('0x4')],'unique':_0xc10d('0x3')}}; \ No newline at end of file +var _0x3efa=['STRING','INTEGER','contactListQueue','sequelize'];(function(_0xe0c872,_0x492f79){var _0x529100=function(_0x15e81e){while(--_0x15e81e){_0xe0c872['push'](_0xe0c872['shift']());}};_0x529100(++_0x492f79);}(_0x3efa,0x147));var _0xa3ef=function(_0x305f86,_0x49a213){_0x305f86=_0x305f86-0x0;var _0x56fb0e=_0x3efa[_0x305f86];return _0x56fb0e;};'use strict';var moment=require('moment');var Sequelize=require(_0xa3ef('0x0'));module['exports']={'phone':{'type':Sequelize[_0xa3ef('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa3ef('0x2')],'unique':_0xa3ef('0x3')},'ListId':{'type':Sequelize[_0xa3ef('0x2')],'unique':_0xa3ef('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa3ef('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b237ce7..dac437a 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 _0x7cce=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','key','model','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','body','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring'];(function(_0x212a42,_0x344899){var _0x1c06d0=function(_0x56a5bd){while(--_0x56a5bd){_0x212a42['push'](_0x212a42['shift']());}};_0x1c06d0(++_0x344899);}(_0x7cce,0x143));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe7cc('0x0'));var rimraf=require(_0xe7cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cc('0x2'));var rp=require('request-promise');var moment=require(_0xe7cc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe7cc('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe7cc('0x5'));var csv=require(_0xe7cc('0x6'));var ejs=require(_0xe7cc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe7cc('0x8'));var jsforce=require(_0xe7cc('0x9'));var deskjs=require(_0xe7cc('0xa'));var toCsv=require(_0xe7cc('0x6'));var querystring=require(_0xe7cc('0xb'));var Papa=require(_0xe7cc('0xc'));var Redis=require('ioredis');var authService=require(_0xe7cc('0xd'));var qs=require(_0xe7cc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7cc('0xf'))(_0xe7cc('0x10'));var utils=require(_0xe7cc('0x11'));var config=require(_0xe7cc('0x12'));var licenseUtil=require(_0xe7cc('0x13'));var db=require(_0xe7cc('0x14'))['db'];function respondWithStatusCode(_0x5eabdb,_0x42be0e){_0x42be0e=_0x42be0e||0xcc;return function(_0x465553){if(_0x465553){return _0x5eabdb[_0xe7cc('0x15')](_0x42be0e);}return _0x5eabdb['status'](_0x42be0e)[_0xe7cc('0x16')]();};}function respondWithResult(_0x3df276,_0x300536){_0x300536=_0x300536||0xc8;return function(_0x1e52f7){if(_0x1e52f7){return _0x3df276[_0xe7cc('0x17')](_0x300536)[_0xe7cc('0x18')](_0x1e52f7);}};}function respondWithFilteredResult(_0x4b7676,_0x2f7aec){return function(_0x4853ed){if(_0x4853ed){var _0x7d135c=typeof _0x2f7aec[_0xe7cc('0x19')]===_0xe7cc('0x1a')&&typeof _0x2f7aec[_0xe7cc('0x1b')]===_0xe7cc('0x1a');var _0x169587=_0x4853ed[_0xe7cc('0x1c')];var _0x5e9307=_0x7d135c?0x0:_0x2f7aec[_0xe7cc('0x19')];var _0x1a67e2=_0x7d135c?_0x4853ed[_0xe7cc('0x1c')]:_0x2f7aec[_0xe7cc('0x19')]+_0x2f7aec[_0xe7cc('0x1b')];var _0xfcd6ab;if(_0x1a67e2>=_0x169587){_0x1a67e2=_0x169587;_0xfcd6ab=0xc8;}else{_0xfcd6ab=0xce;}_0x4b7676[_0xe7cc('0x17')](_0xfcd6ab);return _0x4b7676['set']('Content-Range',_0x5e9307+'-'+_0x1a67e2+'/'+_0x169587)[_0xe7cc('0x18')](_0x4853ed);}return null;};}function patchUpdates(_0x1449d6){return function(_0x37b4bc){try{jsonpatch['apply'](_0x37b4bc,_0x1449d6,!![]);}catch(_0x348c1b){return BPromise[_0xe7cc('0x1d')](_0x348c1b);}return _0x37b4bc['save']();};}function saveUpdates(_0xac2eca,_0x42a079){return function(_0x83edd5){if(_0x83edd5){return _0x83edd5[_0xe7cc('0x1e')](_0xac2eca)[_0xe7cc('0x1f')](function(_0x13f1d2){return _0x13f1d2;});}return null;};}function removeEntity(_0x23805b,_0x263aac){return function(_0x519772){if(_0x519772){return _0x519772[_0xe7cc('0x20')]()[_0xe7cc('0x1f')](function(){_0x23805b[_0xe7cc('0x17')](0xcc)[_0xe7cc('0x16')]();});}};}function handleEntityNotFound(_0x53a875,_0x13018b){return function(_0x591b8a){if(!_0x591b8a){_0x53a875[_0xe7cc('0x15')](0x194);}return _0x591b8a;};}function handleError(_0x1d780b,_0x5a0ef0){_0x5a0ef0=_0x5a0ef0||0x1f4;return function(_0x1e855d){logger[_0xe7cc('0x21')](_0x1e855d[_0xe7cc('0x22')]);if(_0x1e855d[_0xe7cc('0x23')]){delete _0x1e855d[_0xe7cc('0x23')];}_0x1d780b[_0xe7cc('0x17')](_0x5a0ef0)[_0xe7cc('0x24')](_0x1e855d);};}exports[_0xe7cc('0x25')]=function(_0x3566ce,_0x3ab18b){var _0x175845={},_0x11206b={},_0x579813={'count':0x0,'rows':[]};var _0x2db99b=_[_0xe7cc('0x26')](db[_0xe7cc('0x27')][_0xe7cc('0x28')],function(_0x335861){return{'name':_0x335861['fieldName'],'type':_0x335861['type'][_0xe7cc('0x29')]};});_0x11206b[_0xe7cc('0x2a')]=_[_0xe7cc('0x26')](_0x2db99b,_0xe7cc('0x23'));_0x11206b[_0xe7cc('0x2b')]=_['keys'](_0x3566ce[_0xe7cc('0x2b')]);_0x11206b['filters']=_[_0xe7cc('0x2c')](_0x11206b[_0xe7cc('0x2a')],_0x11206b['query']);_0x175845[_0xe7cc('0x2d')]=_[_0xe7cc('0x2c')](_0x11206b['model'],qs[_0xe7cc('0x2e')](_0x3566ce[_0xe7cc('0x2b')]['fields']));_0x175845[_0xe7cc('0x2d')]=_0x175845[_0xe7cc('0x2d')][_0xe7cc('0x2f')]?_0x175845['attributes']:_0x11206b['model'];if(!_0x3566ce[_0xe7cc('0x2b')]['hasOwnProperty']('nolimit')){_0x175845[_0xe7cc('0x1b')]=qs['limit'](_0x3566ce[_0xe7cc('0x2b')][_0xe7cc('0x1b')]);_0x175845[_0xe7cc('0x19')]=qs[_0xe7cc('0x19')](_0x3566ce[_0xe7cc('0x2b')][_0xe7cc('0x19')]);}_0x175845['order']=qs[_0xe7cc('0x30')](_0x3566ce[_0xe7cc('0x2b')]['sort']);_0x175845[_0xe7cc('0x31')]=qs[_0xe7cc('0x32')](_[_0xe7cc('0x33')](_0x3566ce[_0xe7cc('0x2b')],_0x11206b['filters']),_0x2db99b);if(_0x3566ce[_0xe7cc('0x2b')][_0xe7cc('0x34')]){_0x175845['where']=_[_0xe7cc('0x35')](_0x175845['where'],{'$or':_[_0xe7cc('0x26')](_0x2db99b,function(_0x1ebaa2){if(_0x1ebaa2[_0xe7cc('0x36')]!==_0xe7cc('0x37')){var _0xa4452a={};_0xa4452a[_0x1ebaa2[_0xe7cc('0x23')]]={'$like':'%'+_0x3566ce['query']['filter']+'%'};return _0xa4452a;}})});}_0x175845=_[_0xe7cc('0x35')]({},_0x175845,_0x3566ce[_0xe7cc('0x38')]);var _0x13ab3f={'where':_0x175845[_0xe7cc('0x31')]};return db[_0xe7cc('0x27')][_0xe7cc('0x1c')](_0x13ab3f)[_0xe7cc('0x1f')](function(_0x13b681){_0x579813[_0xe7cc('0x1c')]=_0x13b681;if(_0x3566ce[_0xe7cc('0x2b')][_0xe7cc('0x39')]){_0x175845['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xe7cc('0x3a')](_0x175845);})[_0xe7cc('0x1f')](function(_0x181bc4){_0x579813[_0xe7cc('0x3b')]=_0x181bc4;return _0x579813;})[_0xe7cc('0x1f')](respondWithFilteredResult(_0x3ab18b,_0x175845))[_0xe7cc('0x3c')](handleError(_0x3ab18b,null));};exports['show']=function(_0x3ff6d1,_0x1d0761){var _0x512cfb={'raw':!![],'where':{'id':_0x3ff6d1[_0xe7cc('0x3d')]['id']}},_0x6766e6={};_0x6766e6['model']=_[_0xe7cc('0x3e')](db[_0xe7cc('0x27')][_0xe7cc('0x28')]);_0x6766e6[_0xe7cc('0x2b')]=_[_0xe7cc('0x3e')](_0x3ff6d1[_0xe7cc('0x2b')]);_0x6766e6['filters']=_[_0xe7cc('0x2c')](_0x6766e6[_0xe7cc('0x2a')],_0x6766e6[_0xe7cc('0x2b')]);_0x512cfb[_0xe7cc('0x2d')]=_[_0xe7cc('0x2c')](_0x6766e6[_0xe7cc('0x2a')],qs[_0xe7cc('0x2e')](_0x3ff6d1[_0xe7cc('0x2b')][_0xe7cc('0x2e')]));_0x512cfb[_0xe7cc('0x2d')]=_0x512cfb[_0xe7cc('0x2d')][_0xe7cc('0x2f')]?_0x512cfb['attributes']:_0x6766e6[_0xe7cc('0x2a')];if(_0x3ff6d1['query'][_0xe7cc('0x39')]){_0x512cfb[_0xe7cc('0x3f')]=[{'all':!![]}];}_0x512cfb=_[_0xe7cc('0x35')]({},_0x512cfb,_0x3ff6d1[_0xe7cc('0x38')]);return db['CmHopperBlack'][_0xe7cc('0x40')](_0x512cfb)[_0xe7cc('0x1f')](handleEntityNotFound(_0x1d0761,null))[_0xe7cc('0x1f')](respondWithResult(_0x1d0761,null))['catch'](handleError(_0x1d0761,null));};exports[_0xe7cc('0x1e')]=function(_0x23ad66,_0x20c795){if(_0x23ad66[_0xe7cc('0x41')]['id']){delete _0x23ad66[_0xe7cc('0x41')]['id'];}return db[_0xe7cc('0x27')]['find']({'where':{'id':_0x23ad66[_0xe7cc('0x3d')]['id']}})[_0xe7cc('0x1f')](handleEntityNotFound(_0x20c795,null))[_0xe7cc('0x1f')](saveUpdates(_0x23ad66[_0xe7cc('0x41')],null))[_0xe7cc('0x1f')](respondWithResult(_0x20c795,null))['catch'](handleError(_0x20c795,null));};exports[_0xe7cc('0x20')]=function(_0x4a35cf,_0x456799){return db[_0xe7cc('0x27')][_0xe7cc('0x40')]({'where':{'id':_0x4a35cf['params']['id']}})['then'](handleEntityNotFound(_0x456799,null))['then'](removeEntity(_0x456799,null))[_0xe7cc('0x3c')](handleError(_0x456799,null));};exports[_0xe7cc('0x42')]=function(_0x9a344,_0x407883){return db[_0xe7cc('0x27')]['describe']()[_0xe7cc('0x1f')](respondWithResult(_0x407883,null))[_0xe7cc('0x3c')](handleError(_0x407883,null));}; \ No newline at end of file +var _0x59a1=['then','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update'];(function(_0x1aa59b,_0x26612c){var _0x33011c=function(_0x29d625){while(--_0x29d625){_0x1aa59b['push'](_0x1aa59b['shift']());}};_0x33011c(++_0x26612c);}(_0x59a1,0xb7));var _0x159a=function(_0x5348ae,_0x309b17){_0x5348ae=_0x5348ae-0x0;var _0x529eca=_0x59a1[_0x5348ae];return _0x529eca;};'use strict';var emlformat=require(_0x159a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x159a('0x1'));var rp=require(_0x159a('0x2'));var moment=require(_0x159a('0x3'));var BPromise=require(_0x159a('0x4'));var Mustache=require(_0x159a('0x5'));var util=require('util');var path=require(_0x159a('0x6'));var sox=require(_0x159a('0x7'));var csv=require(_0x159a('0x8'));var ejs=require(_0x159a('0x9'));var fs=require('fs');var fs_extra=require(_0x159a('0xa'));var _=require(_0x159a('0xb'));var squel=require('squel');var crypto=require(_0x159a('0xc'));var jsforce=require(_0x159a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x159a('0x8'));var querystring=require(_0x159a('0xe'));var Papa=require(_0x159a('0xf'));var Redis=require(_0x159a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x159a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x159a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x159a('0x13'));var config=require(_0x159a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x159a('0x15'))['db'];function respondWithStatusCode(_0x1205d3,_0x55004b){_0x55004b=_0x55004b||0xcc;return function(_0x333d28){if(_0x333d28){return _0x1205d3['sendStatus'](_0x55004b);}return _0x1205d3[_0x159a('0x16')](_0x55004b)[_0x159a('0x17')]();};}function respondWithResult(_0x2da463,_0x1c58d1){_0x1c58d1=_0x1c58d1||0xc8;return function(_0x4e9da3){if(_0x4e9da3){return _0x2da463[_0x159a('0x16')](_0x1c58d1)[_0x159a('0x18')](_0x4e9da3);}};}function respondWithFilteredResult(_0x3cbfe3,_0x2eb34a){return function(_0xfb25c3){if(_0xfb25c3){var _0x31df1f=typeof _0x2eb34a[_0x159a('0x19')]===_0x159a('0x1a')&&typeof _0x2eb34a[_0x159a('0x1b')]===_0x159a('0x1a');var _0x47788e=_0xfb25c3[_0x159a('0x1c')];var _0x41a600=_0x31df1f?0x0:_0x2eb34a[_0x159a('0x19')];var _0x441c09=_0x31df1f?_0xfb25c3[_0x159a('0x1c')]:_0x2eb34a[_0x159a('0x19')]+_0x2eb34a[_0x159a('0x1b')];var _0xb32489;if(_0x441c09>=_0x47788e){_0x441c09=_0x47788e;_0xb32489=0xc8;}else{_0xb32489=0xce;}_0x3cbfe3['status'](_0xb32489);return _0x3cbfe3[_0x159a('0x1d')](_0x159a('0x1e'),_0x41a600+'-'+_0x441c09+'/'+_0x47788e)['json'](_0xfb25c3);}return null;};}function patchUpdates(_0x407504){return function(_0x43f68d){try{jsonpatch['apply'](_0x43f68d,_0x407504,!![]);}catch(_0x40297f){return BPromise['reject'](_0x40297f);}return _0x43f68d[_0x159a('0x1f')]();};}function saveUpdates(_0x1ae8e9,_0x297637){return function(_0x3cfae5){if(_0x3cfae5){return _0x3cfae5[_0x159a('0x20')](_0x1ae8e9)[_0x159a('0x21')](function(_0x26067d){return _0x26067d;});}return null;};}function removeEntity(_0x1855e7,_0xbe33eb){return function(_0xd21dfc){if(_0xd21dfc){return _0xd21dfc['destroy']()[_0x159a('0x21')](function(){_0x1855e7[_0x159a('0x16')](0xcc)[_0x159a('0x17')]();});}};}function handleEntityNotFound(_0xd8b0e1,_0x18269f){return function(_0x12b9f8){if(!_0x12b9f8){_0xd8b0e1[_0x159a('0x22')](0x194);}return _0x12b9f8;};}function handleError(_0x281675,_0x3249a0){_0x3249a0=_0x3249a0||0x1f4;return function(_0x43c814){logger[_0x159a('0x23')](_0x43c814[_0x159a('0x24')]);if(_0x43c814[_0x159a('0x25')]){delete _0x43c814[_0x159a('0x25')];}_0x281675[_0x159a('0x16')](_0x3249a0)[_0x159a('0x26')](_0x43c814);};}exports[_0x159a('0x27')]=function(_0x122bea,_0x1ce791){var _0x46cfc0={},_0x210a19={},_0x2e113b={'count':0x0,'rows':[]};var _0x5be79f=_[_0x159a('0x28')](db[_0x159a('0x29')][_0x159a('0x2a')],function(_0x29ee9d){return{'name':_0x29ee9d[_0x159a('0x2b')],'type':_0x29ee9d[_0x159a('0x2c')][_0x159a('0x2d')]};});_0x210a19[_0x159a('0x2e')]=_[_0x159a('0x28')](_0x5be79f,'name');_0x210a19[_0x159a('0x2f')]=_[_0x159a('0x30')](_0x122bea[_0x159a('0x2f')]);_0x210a19['filters']=_[_0x159a('0x31')](_0x210a19[_0x159a('0x2e')],_0x210a19[_0x159a('0x2f')]);_0x46cfc0[_0x159a('0x32')]=_[_0x159a('0x31')](_0x210a19[_0x159a('0x2e')],qs[_0x159a('0x33')](_0x122bea[_0x159a('0x2f')]['fields']));_0x46cfc0[_0x159a('0x32')]=_0x46cfc0[_0x159a('0x32')][_0x159a('0x34')]?_0x46cfc0[_0x159a('0x32')]:_0x210a19[_0x159a('0x2e')];if(!_0x122bea[_0x159a('0x2f')]['hasOwnProperty']('nolimit')){_0x46cfc0[_0x159a('0x1b')]=qs['limit'](_0x122bea[_0x159a('0x2f')][_0x159a('0x1b')]);_0x46cfc0['offset']=qs[_0x159a('0x19')](_0x122bea[_0x159a('0x2f')][_0x159a('0x19')]);}_0x46cfc0[_0x159a('0x35')]=qs[_0x159a('0x36')](_0x122bea['query']['sort']);_0x46cfc0[_0x159a('0x37')]=qs[_0x159a('0x38')](_[_0x159a('0x39')](_0x122bea[_0x159a('0x2f')],_0x210a19['filters']),_0x5be79f);if(_0x122bea['query'][_0x159a('0x3a')]){_0x46cfc0[_0x159a('0x37')]=_[_0x159a('0x3b')](_0x46cfc0[_0x159a('0x37')],{'$or':_[_0x159a('0x28')](_0x5be79f,function(_0x16846d){if(_0x16846d['type']!==_0x159a('0x3c')){var _0x190782={};_0x190782[_0x16846d[_0x159a('0x25')]]={'$like':'%'+_0x122bea[_0x159a('0x2f')][_0x159a('0x3a')]+'%'};return _0x190782;}})});}_0x46cfc0=_[_0x159a('0x3b')]({},_0x46cfc0,_0x122bea[_0x159a('0x3d')]);var _0x4be32b={'where':_0x46cfc0[_0x159a('0x37')]};return db[_0x159a('0x29')][_0x159a('0x1c')](_0x4be32b)[_0x159a('0x21')](function(_0x1a4d88){_0x2e113b[_0x159a('0x1c')]=_0x1a4d88;if(_0x122bea[_0x159a('0x2f')][_0x159a('0x3e')]){_0x46cfc0['include']=[{'all':!![]}];}return db[_0x159a('0x29')][_0x159a('0x3f')](_0x46cfc0);})[_0x159a('0x21')](function(_0x43c859){_0x2e113b[_0x159a('0x40')]=_0x43c859;return _0x2e113b;})[_0x159a('0x21')](respondWithFilteredResult(_0x1ce791,_0x46cfc0))[_0x159a('0x41')](handleError(_0x1ce791,null));};exports[_0x159a('0x42')]=function(_0x35b058,_0x4bafeb){var _0x2d79ff={'raw':!![],'where':{'id':_0x35b058[_0x159a('0x43')]['id']}},_0x21c131={};_0x21c131[_0x159a('0x2e')]=_[_0x159a('0x30')](db[_0x159a('0x29')]['rawAttributes']);_0x21c131[_0x159a('0x2f')]=_[_0x159a('0x30')](_0x35b058['query']);_0x21c131['filters']=_[_0x159a('0x31')](_0x21c131['model'],_0x21c131[_0x159a('0x2f')]);_0x2d79ff[_0x159a('0x32')]=_['intersection'](_0x21c131['model'],qs[_0x159a('0x33')](_0x35b058[_0x159a('0x2f')]['fields']));_0x2d79ff[_0x159a('0x32')]=_0x2d79ff[_0x159a('0x32')][_0x159a('0x34')]?_0x2d79ff[_0x159a('0x32')]:_0x21c131[_0x159a('0x2e')];if(_0x35b058['query'][_0x159a('0x3e')]){_0x2d79ff[_0x159a('0x44')]=[{'all':!![]}];}_0x2d79ff=_['merge']({},_0x2d79ff,_0x35b058[_0x159a('0x3d')]);return db[_0x159a('0x29')][_0x159a('0x45')](_0x2d79ff)['then'](handleEntityNotFound(_0x4bafeb,null))[_0x159a('0x21')](respondWithResult(_0x4bafeb,null))[_0x159a('0x41')](handleError(_0x4bafeb,null));};exports['update']=function(_0xcdcef3,_0x198034){if(_0xcdcef3[_0x159a('0x46')]['id']){delete _0xcdcef3[_0x159a('0x46')]['id'];}return db['CmHopperBlack'][_0x159a('0x45')]({'where':{'id':_0xcdcef3[_0x159a('0x43')]['id']}})[_0x159a('0x21')](handleEntityNotFound(_0x198034,null))[_0x159a('0x21')](saveUpdates(_0xcdcef3[_0x159a('0x46')],null))[_0x159a('0x21')](respondWithResult(_0x198034,null))['catch'](handleError(_0x198034,null));};exports['destroy']=function(_0x509bcb,_0x2de69a){return db[_0x159a('0x29')][_0x159a('0x45')]({'where':{'id':_0x509bcb[_0x159a('0x43')]['id']}})[_0x159a('0x21')](handleEntityNotFound(_0x2de69a,null))['then'](removeEntity(_0x2de69a,null))['catch'](handleError(_0x2de69a,null));};exports[_0x159a('0x47')]=function(_0x50831e,_0x5ca690){return db[_0x159a('0x29')][_0x159a('0x47')]()[_0x159a('0x21')](respondWithResult(_0x5ca690,null))[_0x159a('0x41')](handleError(_0x5ca690,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8a1e54f..436562d 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 _0x4996=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x4996,0x95));var _0x6499=function(_0x2ed6ae,_0x4f257d){_0x2ed6ae=_0x2ed6ae-0x0;var _0x2461a0=_0x4996[_0x2ed6ae];return _0x2461a0;};'use strict';var _=require(_0x6499('0x0'));var util=require(_0x6499('0x1'));var logger=require(_0x6499('0x2'))(_0x6499('0x3'));var moment=require(_0x6499('0x4'));var BPromise=require('bluebird');var rp=require(_0x6499('0x5'));var fs=require('fs');var path=require(_0x6499('0x6'));var rimraf=require(_0x6499('0x7'));var config=require(_0x6499('0x8'));var attributes=require(_0x6499('0x9'));module[_0x6499('0xa')]=function(_0x15242a,_0xfc23f8){return _0x15242a['define'](_0x6499('0xb'),attributes,{'tableName':_0x6499('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x363c=['api','moment','bluebird','path','exports','cm_hopper_black','util'];(function(_0x5d2180,_0x3f9dbe){var _0x8bcff6=function(_0xa0bea2){while(--_0xa0bea2){_0x5d2180['push'](_0x5d2180['shift']());}};_0x8bcff6(++_0x3f9dbe);}(_0x363c,0x125));var _0xc363=function(_0x816de3,_0x38d085){_0x816de3=_0x816de3-0x0;var _0x1e539e=_0x363c[_0x816de3];return _0x1e539e;};'use strict';var _=require('lodash');var util=require(_0xc363('0x0'));var logger=require('../../config/logger')(_0xc363('0x1'));var moment=require(_0xc363('0x2'));var BPromise=require(_0xc363('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc363('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xc363('0x5')]=function(_0x2a028a,_0x17979f){return _0x2a028a['define']('CmHopperBlack',attributes,{'tableName':_0xc363('0x6'),'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 0309c0e..0f84349 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 _0x6f88=['error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','map','include','model','attributes','then','debug','stringify','update','body','limit','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x410058,_0xca4c1e){var _0xf52fe4=function(_0x48879d){while(--_0x48879d){_0x410058['push'](_0x410058['shift']());}};_0xf52fe4(++_0xca4c1e);}(_0x6f88,0x1c5));var _0x86f8=function(_0x486be1,_0x3fdf5e){_0x486be1=_0x486be1-0x0;var _0x586fa1=_0x6f88[_0x486be1];return _0x586fa1;};'use strict';var _=require(_0x86f8('0x0'));var util=require(_0x86f8('0x1'));var moment=require(_0x86f8('0x2'));var BPromise=require(_0x86f8('0x3'));var rs=require(_0x86f8('0x4'));var fs=require('fs');var Redis=require(_0x86f8('0x5'));var db=require(_0x86f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x86f8('0x7'))(_0x86f8('0x8'));var config=require(_0x86f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x86f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9e72b,_0x63e2b6,_0xbc2805){return new BPromise(function(_0x504c87,_0x9787fb){return client[_0x86f8('0xb')](_0xa9e72b,_0xbc2805)['then'](function(_0x18bc13){logger[_0x86f8('0xc')](_0x86f8('0xd'),_0x63e2b6,_0x86f8('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x63e2b6,_0x86f8('0xe'),JSON['stringify'](_0x18bc13));if(_0x18bc13[_0x86f8('0xf')]){if(_0x18bc13[_0x86f8('0xf')][_0x86f8('0x10')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x63e2b6,_0x18bc13[_0x86f8('0xf')][_0x86f8('0x11')]);return _0x9787fb(_0x18bc13[_0x86f8('0xf')][_0x86f8('0x11')]);}logger[_0x86f8('0xf')](_0x86f8('0xd'),_0x63e2b6,_0x18bc13[_0x86f8('0xf')]['message']);return _0x504c87(_0x18bc13[_0x86f8('0xf')][_0x86f8('0x11')]);}else{logger[_0x86f8('0xc')](_0x86f8('0xd'),_0x63e2b6,'request\x20sent');_0x504c87(_0x18bc13['result'][_0x86f8('0x11')]);}})[_0x86f8('0x12')](function(_0x1ca4f4){logger[_0x86f8('0xf')](_0x86f8('0xd'),_0x63e2b6,_0x1ca4f4);_0x9787fb(_0x1ca4f4);});});}exports[_0x86f8('0x13')]=function(_0x3ce14d){var _0x303f9c=this;return new Promise(function(_0x1801c1,_0xad84cc){return db[_0x86f8('0x14')]['findAll']({'raw':_0x3ce14d[_0x86f8('0x15')]?_0x3ce14d[_0x86f8('0x15')][_0x86f8('0x16')]===undefined?!![]:![]:!![],'where':_0x3ce14d[_0x86f8('0x15')]?_0x3ce14d[_0x86f8('0x15')][_0x86f8('0x17')]||null:null,'attributes':_0x3ce14d[_0x86f8('0x15')]?_0x3ce14d['options']['attributes']||null:null,'limit':_0x3ce14d['options']?_0x3ce14d['options']['limit']||null:null,'include':_0x3ce14d[_0x86f8('0x15')]?_0x3ce14d['options']['include']?_[_0x86f8('0x18')](_0x3ce14d[_0x86f8('0x15')][_0x86f8('0x19')],function(_0x95a94d){return{'model':db[_0x95a94d[_0x86f8('0x1a')]],'as':_0x95a94d['as'],'attributes':_0x95a94d['attributes'],'include':_0x95a94d[_0x86f8('0x19')]?_['map'](_0x95a94d[_0x86f8('0x19')],function(_0x102089){return{'model':db[_0x102089[_0x86f8('0x1a')]],'as':_0x102089['as'],'attributes':_0x102089[_0x86f8('0x1b')],'include':_0x102089[_0x86f8('0x19')]?_[_0x86f8('0x18')](_0x102089['include'],function(_0x3566e3){return{'model':db[_0x3566e3[_0x86f8('0x1a')]],'as':_0x3566e3['as'],'attributes':_0x3566e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x86f8('0x1c')](function(_0x13d637){logger['info'](_0x86f8('0x13'),_0x3ce14d);logger[_0x86f8('0x1d')](_0x86f8('0x13'),_0x3ce14d,JSON[_0x86f8('0x1e')](_0x13d637));_0x1801c1(_0x13d637);})[_0x86f8('0x12')](function(_0x5e3af9){logger[_0x86f8('0xf')](_0x86f8('0x13'),_0x5e3af9['message'],_0x3ce14d);_0xad84cc(_0x303f9c[_0x86f8('0xf')](0x1f4,_0x5e3af9[_0x86f8('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x45e003){var _0x3b9a3d=this;return new Promise(function(_0x50a223,_0x3a601b){return db[_0x86f8('0x14')][_0x86f8('0x1f')](_0x45e003[_0x86f8('0x20')],{'raw':_0x45e003['options']?_0x45e003['options'][_0x86f8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e003[_0x86f8('0x15')]?_0x45e003[_0x86f8('0x15')]['where']||null:null,'attributes':_0x45e003[_0x86f8('0x15')]?_0x45e003[_0x86f8('0x15')][_0x86f8('0x1b')]||null:null,'limit':_0x45e003[_0x86f8('0x15')]?_0x45e003[_0x86f8('0x15')][_0x86f8('0x21')]||null:null})[_0x86f8('0x1c')](function(_0x2def2d){logger[_0x86f8('0xc')]('UpdateCmHopperBlack',_0x45e003);logger['debug']('UpdateCmHopperBlack',_0x45e003,JSON[_0x86f8('0x1e')](_0x2def2d));_0x50a223(_0x2def2d);})[_0x86f8('0x12')](function(_0x1c5183){logger[_0x86f8('0xf')]('UpdateCmHopperBlack',_0x1c5183[_0x86f8('0x11')],_0x45e003);_0x3a601b(_0x3b9a3d[_0x86f8('0xf')](0x1f4,_0x1c5183[_0x86f8('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x283808){var _0x407c3d=this;return new Promise(function(_0x46d423,_0x529017){return db[_0x86f8('0x14')][_0x86f8('0x22')]({'where':_0x283808[_0x86f8('0x15')]?_0x283808['options'][_0x86f8('0x17')]||null:null})[_0x86f8('0x1c')](function(_0x5061fe){logger[_0x86f8('0xc')]('DestroyCmHopperBlack',_0x283808);logger['debug'](_0x86f8('0x23'),_0x283808,JSON[_0x86f8('0x1e')](_0x5061fe));_0x46d423(_0x5061fe);})[_0x86f8('0x12')](function(_0x248dda){logger[_0x86f8('0xf')]('DestroyCmHopperBlack',_0x248dda[_0x86f8('0x11')],_0x283808);_0x529017(_0x407c3d[_0x86f8('0xf')](0x1f4,_0x248dda['message']));});});}; \ No newline at end of file +var _0xca0f=['jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','catch','destroy','DestroyCmHopperBlack','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4480a5,_0x4da2d8){var _0x242494=function(_0x3cb4f0){while(--_0x3cb4f0){_0x4480a5['push'](_0x4480a5['shift']());}};_0x242494(++_0x4da2d8);}(_0xca0f,0x126));var _0xfca0=function(_0x461e6d,_0x3bcc94){_0x461e6d=_0x461e6d-0x0;var _0x2c5e61=_0xca0f[_0x461e6d];return _0x2c5e61;};'use strict';var _=require(_0xfca0('0x0'));var util=require(_0xfca0('0x1'));var moment=require(_0xfca0('0x2'));var BPromise=require(_0xfca0('0x3'));var rs=require(_0xfca0('0x4'));var fs=require('fs');var Redis=require(_0xfca0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfca0('0x6'));var logger=require(_0xfca0('0x7'))(_0xfca0('0x8'));var config=require(_0xfca0('0x9'));var jayson=require(_0xfca0('0xa'));var client=jayson[_0xfca0('0xb')][_0xfca0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x574b2d,_0x37d4b5,_0x6b5cd8){return new BPromise(function(_0x5ea8a3,_0x588ee0){return client[_0xfca0('0xd')](_0x574b2d,_0x6b5cd8)[_0xfca0('0xe')](function(_0x1e3f45){logger[_0xfca0('0xf')](_0xfca0('0x10'),_0x37d4b5,_0xfca0('0x11'));logger['debug'](_0xfca0('0x12'),_0x37d4b5,_0xfca0('0x11'),JSON[_0xfca0('0x13')](_0x1e3f45));if(_0x1e3f45['error']){if(_0x1e3f45[_0xfca0('0x14')]['code']===0x1f4){logger[_0xfca0('0x14')](_0xfca0('0x10'),_0x37d4b5,_0x1e3f45[_0xfca0('0x14')][_0xfca0('0x15')]);return _0x588ee0(_0x1e3f45[_0xfca0('0x14')][_0xfca0('0x15')]);}logger[_0xfca0('0x14')](_0xfca0('0x10'),_0x37d4b5,_0x1e3f45['error'][_0xfca0('0x15')]);return _0x5ea8a3(_0x1e3f45[_0xfca0('0x14')][_0xfca0('0x15')]);}else{logger[_0xfca0('0xf')](_0xfca0('0x10'),_0x37d4b5,_0xfca0('0x11'));_0x5ea8a3(_0x1e3f45[_0xfca0('0x16')][_0xfca0('0x15')]);}})['catch'](function(_0x325640){logger[_0xfca0('0x14')](_0xfca0('0x10'),_0x37d4b5,_0x325640);_0x588ee0(_0x325640);});});}exports[_0xfca0('0x17')]=function(_0x3cd9ee){var _0x5b0a86=this;return new Promise(function(_0x445796,_0x2e32e2){return db[_0xfca0('0x18')]['findAll']({'raw':_0x3cd9ee[_0xfca0('0x19')]?_0x3cd9ee[_0xfca0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd9ee[_0xfca0('0x19')]?_0x3cd9ee[_0xfca0('0x19')][_0xfca0('0x1a')]||null:null,'attributes':_0x3cd9ee['options']?_0x3cd9ee[_0xfca0('0x19')][_0xfca0('0x1b')]||null:null,'limit':_0x3cd9ee['options']?_0x3cd9ee[_0xfca0('0x19')][_0xfca0('0x1c')]||null:null,'include':_0x3cd9ee[_0xfca0('0x19')]?_0x3cd9ee[_0xfca0('0x19')][_0xfca0('0x1d')]?_[_0xfca0('0x1e')](_0x3cd9ee[_0xfca0('0x19')][_0xfca0('0x1d')],function(_0x32e618){return{'model':db[_0x32e618['model']],'as':_0x32e618['as'],'attributes':_0x32e618['attributes'],'include':_0x32e618[_0xfca0('0x1d')]?_[_0xfca0('0x1e')](_0x32e618[_0xfca0('0x1d')],function(_0x4b7a56){return{'model':db[_0x4b7a56[_0xfca0('0x1f')]],'as':_0x4b7a56['as'],'attributes':_0x4b7a56['attributes'],'include':_0x4b7a56[_0xfca0('0x1d')]?_[_0xfca0('0x1e')](_0x4b7a56['include'],function(_0x5a3c3b){return{'model':db[_0x5a3c3b['model']],'as':_0x5a3c3b['as'],'attributes':_0x5a3c3b[_0xfca0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfca0('0xe')](function(_0x41f4d3){logger[_0xfca0('0xf')](_0xfca0('0x17'),_0x3cd9ee);logger['debug']('GetCmHopperBlack',_0x3cd9ee,JSON['stringify'](_0x41f4d3));_0x445796(_0x41f4d3);})['catch'](function(_0x55b890){logger[_0xfca0('0x14')](_0xfca0('0x17'),_0x55b890[_0xfca0('0x15')],_0x3cd9ee);_0x2e32e2(_0x5b0a86[_0xfca0('0x14')](0x1f4,_0x55b890[_0xfca0('0x15')]));});});};exports[_0xfca0('0x20')]=function(_0x405ed8){var _0x4cd695=this;return new Promise(function(_0x47cc0f,_0x441167){return db[_0xfca0('0x18')][_0xfca0('0x21')](_0x405ed8['body'],{'raw':_0x405ed8[_0xfca0('0x19')]?_0x405ed8[_0xfca0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x405ed8[_0xfca0('0x19')]?_0x405ed8[_0xfca0('0x19')][_0xfca0('0x1a')]||null:null,'attributes':_0x405ed8[_0xfca0('0x19')]?_0x405ed8[_0xfca0('0x19')][_0xfca0('0x1b')]||null:null,'limit':_0x405ed8[_0xfca0('0x19')]?_0x405ed8[_0xfca0('0x19')]['limit']||null:null})[_0xfca0('0xe')](function(_0x45e956){logger['info']('UpdateCmHopperBlack',_0x405ed8);logger['debug']('UpdateCmHopperBlack',_0x405ed8,JSON[_0xfca0('0x13')](_0x45e956));_0x47cc0f(_0x45e956);})[_0xfca0('0x22')](function(_0x1f58ea){logger[_0xfca0('0x14')]('UpdateCmHopperBlack',_0x1f58ea[_0xfca0('0x15')],_0x405ed8);_0x441167(_0x4cd695['error'](0x1f4,_0x1f58ea['message']));});});};exports['DestroyCmHopperBlack']=function(_0x241a3d){var _0x56fb63=this;return new Promise(function(_0x17c602,_0x103399){return db['CmHopperBlack'][_0xfca0('0x23')]({'where':_0x241a3d[_0xfca0('0x19')]?_0x241a3d[_0xfca0('0x19')][_0xfca0('0x1a')]||null:null})[_0xfca0('0xe')](function(_0x2b32b3){logger[_0xfca0('0xf')](_0xfca0('0x24'),_0x241a3d);logger[_0xfca0('0x25')]('DestroyCmHopperBlack',_0x241a3d,JSON[_0xfca0('0x13')](_0x2b32b3));_0x17c602(_0x2b32b3);})[_0xfca0('0x22')](function(_0x41c712){logger[_0xfca0('0x14')](_0xfca0('0x24'),_0x41c712[_0xfca0('0x15')],_0x241a3d);_0x103399(_0x56fb63[_0xfca0('0x14')](0x1f4,_0x41c712['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 001ef6b..535354f 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 _0x5d17=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0x5d17,0x114));var _0x75d1=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0x5d17[_0x177cc9];return _0x2fe577;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/:id',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file +var _0xe3da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer'];(function(_0xce8183,_0x567545){var _0x27c555=function(_0x2b1dd5){while(--_0x2b1dd5){_0xce8183['push'](_0xce8183['shift']());}};_0x27c555(++_0x567545);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')](_0xae3d('0x12'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x13')]);router[_0xae3d('0x14')]('/:id',auth[_0xae3d('0xc')](),controller['destroy']);module[_0xae3d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 97fe84f..df22c2c 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 _0x3031=['DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x3d07f2,_0x19854d){var _0x26052a=function(_0x213834){while(--_0x213834){_0x3d07f2['push'](_0x3d07f2['shift']());}};_0x26052a(++_0x19854d);}(_0x3031,0xaf));var _0x1303=function(_0x433c46,_0x488941){_0x433c46=_0x433c46-0x0;var _0x5276a4=_0x3031[_0x433c46];return _0x5276a4;};'use strict';var Sequelize=require(_0x1303('0x0'));var moment=require(_0x1303('0x1'));module[_0x1303('0x2')]={'state':{'type':Sequelize[_0x1303('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x1303('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1303('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x1303('0x4')]},'originatecalleridname':{'type':Sequelize[_0x1303('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1303('0x4')]},'starttime':{'type':Sequelize[_0x1303('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1303('0x5')]},'endtime':{'type':Sequelize[_0x1303('0x5')]},'ringtime':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1303('0x4')]},'campaigntype':{'type':Sequelize[_0x1303('0x4')]},'membername':{'type':Sequelize[_0x1303('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1303('0x4')]},'secondDisposition':{'type':Sequelize[_0x1303('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1303('0x4')]},'dispositionat':{'type':Sequelize[_0x1303('0x5')],'set':function(_0x4ba695){var _0x1d860e=this[_0x1303('0x6')](_0x1303('0x7'));if(_0x1d860e&&_0x4ba695){this[_0x1303('0x8')]('followuptime',moment(_0x4ba695)[_0x1303('0x9')](moment(_0x1d860e),_0x1303('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1303('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1303('0x5')]},'callback':{'type':Sequelize[_0x1303('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1303('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1303('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1303('0x5')]},'recallme':{'type':Sequelize[_0x1303('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1303('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1303('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3bbd=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING','INTEGER','DATE','endtime'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x3bbd,0x71));var _0xd3bb=function(_0x5eeb0b,_0x293c14){_0x5eeb0b=_0x5eeb0b-0x0;var _0x270295=_0x3bbd[_0x5eeb0b];return _0x270295;};'use strict';var Sequelize=require(_0xd3bb('0x0'));var moment=require(_0xd3bb('0x1'));module[_0xd3bb('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd3bb('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd3bb('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd3bb('0x3')]},'calleridnum':{'type':Sequelize[_0xd3bb('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd3bb('0x5')]},'responsetime':{'type':Sequelize[_0xd3bb('0x5')]},'answertime':{'type':Sequelize[_0xd3bb('0x5')]},'droptime':{'type':Sequelize[_0xd3bb('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd3bb('0x3')]},'campaign':{'type':Sequelize[_0xd3bb('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd3bb('0x3')]},'reason':{'type':Sequelize[_0xd3bb('0x3')]},'disposition':{'type':Sequelize[_0xd3bb('0x3')]},'secondDisposition':{'type':Sequelize[_0xd3bb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xd3bb('0x5')],'set':function(_0x2e1603){var _0xf6585b=this['getDataValue'](_0xd3bb('0x6'));if(_0xf6585b&&_0x2e1603){this[_0xd3bb('0x7')](_0xd3bb('0x8'),moment(_0x2e1603)[_0xd3bb('0x9')](moment(_0xf6585b),_0xd3bb('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd3bb('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd3bb('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd3bb('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd3bb('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd3bb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd3bb('0x5')]},'deleted':{'type':Sequelize[_0xd3bb('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd3bb('0x5')]},'recallme':{'type':Sequelize[_0xd3bb('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd3bb('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd3bb('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd3bb('0x4')],'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 cb4a5b3..c2b87b8 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 _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file +var _0x4888=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','CmHopperFinal','includeAll','include','rows','catch','params','options','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ContactId'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x4888,0x198));var _0x8488=function(_0x4937b2,_0x2599cf){_0x4937b2=_0x4937b2-0x0;var _0x8da2fb=_0x4888[_0x4937b2];return _0x8da2fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')]()[_0x8488('0x21')](respondWithResult(_0x1f0516,null))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x42')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x43')][_0x8488('0x44')]){delete _0x886a9e[_0x8488('0x43')][_0x8488('0x44')];}return db[_0x8488('0x3a')]['find']({'where':{'uniqueid':_0x886a9e['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x299d8e,null))[_0x8488('0x21')](saveUpdates(_0x886a9e[_0x8488('0x43')],null))[_0x8488('0x21')](respondWithResult(_0x299d8e,null))[_0x8488('0x3e')](handleError(_0x299d8e,null));};exports[_0x8488('0x45')]=function(_0x25f2dc,_0x27dfd2,_0x24fa20){return db['CmHopperFinal'][_0x8488('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x25f2dc[_0x8488('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),_0x8488('0x4c')],[db['sequelize']['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x8488('0x4d')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x4f')))),'dropContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x52')))),_0x8488('0x53')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x27dfd2,null))[_0x8488('0x21')](respondWithResult(_0x27dfd2,null))[_0x8488('0x3e')](handleError(_0x27dfd2,null));};exports[_0x8488('0x55')]=function(_0x1971f3,_0x24ba2d,_0x4facfb){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x1971f3[_0x8488('0x3f')]['id']},'attributes':[[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x56')))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x57')))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8488('0x58')],[db[_0x8488('0x48')]['fn']('COUNT',db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x24ba2d,null))['then'](respondWithResult(_0x24ba2d,null))[_0x8488('0x3e')](handleError(_0x24ba2d,null));};exports[_0x8488('0x59')]=function(_0x44a50b,_0x5815cb,_0xbee86e){return db[_0x8488('0x5a')]['find']({'where':{'id':_0x44a50b['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x5815cb,null))[_0x8488('0x21')](function(_0xfedfd2){var _0x3ab1b6;if(_0xfedfd2){_0x3ab1b6=squel[_0x8488('0x5b')]()[_0x8488('0x5c')](_0x8488('0x5d'))[_0x8488('0x5e')]([_0x8488('0x5f'),_0x8488('0x60'),'ContactId',_0x8488('0x61'),'VoiceQueueId',_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')]('ANY_VALUE(calleridnum)',_0x8488('0x5f'))[_0x8488('0x65')]('NOW()',_0x8488('0x60'))['field'](_0x8488('0x66'),_0x8488('0x67'))[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x69'),_0x8488('0x6a'))['field'](_0x8488('0x6b'),'createdAt')['field'](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']())[_0x8488('0x35')](_0x8488('0x6e'),_0x44a50b[_0x8488('0x43')][_0x8488('0x6f')][_0x8488('0x70')]())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8488('0x35')](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x72'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x73')))[_0x8488('0x74')]('ContactId'))[_0x8488('0x70')]();return db['sequelize'][_0x8488('0x2c')](_0x3ab1b6);}return[];})['then'](respondWithResult(_0x5815cb,null))[_0x8488('0x3e')](handleError(_0x5815cb,null));};exports[_0x8488('0x75')]=function(_0x267401,_0x1e635a,_0x31ab35){return db[_0x8488('0x76')][_0x8488('0x77')]({'where':{'id':_0x267401[_0x8488('0x3f')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x8488('0x21')](function(_0xce1d1a){var _0xc9c221;if(_0xce1d1a){_0xc9c221=squel[_0x8488('0x5b')]()[_0x8488('0x5c')]('cm_hopper')[_0x8488('0x5e')]([_0x8488('0x5f'),'scheduledAt',_0x8488('0x67'),_0x8488('0x61'),_0x8488('0x78'),_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x79'),_0x8488('0x5f'))[_0x8488('0x65')](_0x8488('0x6b'),'scheduledAt')[_0x8488('0x65')](_0x8488('0x66'),'ContactId')[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x7a'),'CampaignId')['field'](_0x8488('0x6b'),_0x8488('0x62'))[_0x8488('0x65')](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')](_0x8488('0x7b'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x6e'),_0x267401[_0x8488('0x43')][_0x8488('0x6f')]['toString']())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x72'))[_0x8488('0x6c')](_0x8488('0x7b'))['where'](_0x8488('0x7c'),_0x267401['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')]('state\x20=\x204'))['group'](_0x8488('0x67')))[_0x8488('0x70')]();return db[_0x8488('0x48')][_0x8488('0x2c')](_0xc9c221);}return[];})[_0x8488('0x21')](respondWithResult(_0x1e635a,null))['catch'](handleError(_0x1e635a,null));};exports[_0x8488('0x7d')]=function(_0x19c5c6,_0x50f773,_0x52c750){return db[_0x8488('0x7e')][_0x8488('0x7f')]({'where':{'VoiceQueueId':_0x19c5c6[_0x8488('0x43')]['VoiceQueueId'],'CampaignId':_0x19c5c6['body'][_0x8488('0x78')],'ContactId':_0x19c5c6[_0x8488('0x43')][_0x8488('0x67')]}})['then'](handleEntityNotFound(_0x50f773,null))[_0x8488('0x21')](function(_0x1e4e51){if(_0x1e4e51){return _0x1e4e51;}return null;})[_0x8488('0x21')](respondWithResult(_0x50f773,null))[_0x8488('0x3e')](handleError(_0x50f773,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e2baec5..0181397 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 _0xf3fd=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x20c71c,_0x46b89f){var _0x2e8d49=function(_0x4d0742){while(--_0x4d0742){_0x20c71c['push'](_0x20c71c['shift']());}};_0x2e8d49(++_0x46b89f);}(_0xf3fd,0x176));var _0xdf3f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf3fd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdf3f('0x0'));var util=require('util');var logger=require(_0xdf3f('0x1'))(_0xdf3f('0x2'));var moment=require(_0xdf3f('0x3'));var BPromise=require(_0xdf3f('0x4'));var rp=require(_0xdf3f('0x5'));var fs=require('fs');var path=require(_0xdf3f('0x6'));var rimraf=require(_0xdf3f('0x7'));var config=require(_0xdf3f('0x8'));var attributes=require(_0xdf3f('0x9'));module[_0xdf3f('0xa')]=function(_0x829570,_0x45644b){return _0x829570[_0xdf3f('0xb')](_0xdf3f('0xc'),attributes,{'tableName':_0xdf3f('0xd'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xdf3f('0xe')]},{'name':'uniqueid','fields':[_0xdf3f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x130d=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x5bc85f,_0x599249){var _0xe2955d=function(_0x1b7067){while(--_0x1b7067){_0x5bc85f['push'](_0x5bc85f['shift']());}};_0xe2955d(++_0x599249);}(_0x130d,0x106));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require(_0xd130('0x1'));var logger=require(_0xd130('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd130('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd130('0x4'));var rimraf=require(_0xd130('0x5'));var config=require(_0xd130('0x6'));var attributes=require(_0xd130('0x7'));module[_0xd130('0x8')]=function(_0x553c41,_0x2c24e7){return _0x553c41[_0xd130('0x9')](_0xd130('0xa'),attributes,{'tableName':_0xd130('0xb'),'paranoid':![],'indexes':[{'name':_0xd130('0xc'),'fields':[_0xd130('0xc')]},{'name':_0xd130('0xd'),'fields':[_0xd130('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 4348318..67bf558 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x319689,_0x2d1c26){var _0x5347cc=function(_0x56a18c){while(--_0x56a18c){_0x319689['push'](_0x319689['shift']());}};_0x5347cc(++_0x2d1c26);}(_0xb10b,0x12a));var _0xbb10=function(_0x18175b,_0x4d7376){_0x18175b=_0x18175b-0x0;var _0x210d45=_0xb10b[_0x18175b];return _0x210d45;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3574a9,_0x4f1a9f){var _0x536f85=function(_0x3555a6){while(--_0x3555a6){_0x3574a9['push'](_0x3574a9['shift']());}};_0x536f85(++_0x4f1a9f);}(_0x7a54,0x106));var _0x47a5=function(_0x21fe4b,_0x1caa89){_0x21fe4b=_0x21fe4b-0x0;var _0x484e45=_0x7a54[_0x21fe4b];return _0x484e45;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 5b0a5fc..5a250e2 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 _0xa868=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','post','put','update','exports','multer','util'];(function(_0x450409,_0x75a308){var _0x479b90=function(_0x257d1f){while(--_0x257d1f){_0x450409['push'](_0x450409['shift']());}};_0x479b90(++_0x75a308);}(_0xa868,0x1b8));var _0x8a86=function(_0x70f515,_0x31a8a9){_0x70f515=_0x70f515-0x0;var _0x412225=_0xa868[_0x70f515];return _0x412225;};'use strict';var multer=require(_0x8a86('0x0'));var util=require(_0x8a86('0x1'));var path=require(_0x8a86('0x2'));var timeout=require(_0x8a86('0x3'));var express=require(_0x8a86('0x4'));var router=express[_0x8a86('0x5')]();var fs_extra=require(_0x8a86('0x6'));var auth=require(_0x8a86('0x7'));var interaction=require(_0x8a86('0x8'));var config=require(_0x8a86('0x9'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x8a86('0xa')](),controller[_0x8a86('0xb')]);router[_0x8a86('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8a86('0xc')](_0x8a86('0xd'),auth['isAuthenticated'](),controller[_0x8a86('0xe')]);router['get'](_0x8a86('0xf'),auth[_0x8a86('0xa')](),controller[_0x8a86('0x10')]);router[_0x8a86('0xc')](_0x8a86('0x11'),auth[_0x8a86('0xa')](),controller[_0x8a86('0x12')]);router['post'](_0x8a86('0x13'),auth[_0x8a86('0xa')](),controller[_0x8a86('0x14')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0x8a86('0xa')](),controller[_0x8a86('0x15')]);router[_0x8a86('0x16')]('/checkContactHopper',auth[_0x8a86('0xa')](),controller['checkContactHopper']);router[_0x8a86('0x17')](_0x8a86('0xd'),auth['isAuthenticated'](),controller[_0x8a86('0x18')]);module[_0x8a86('0x19')]=router; \ No newline at end of file +var _0x27c4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','util','connect-timeout','express'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x27c4,0x189));var _0x427c=function(_0x5552b4,_0x3d92ce){_0x5552b4=_0x5552b4-0x0;var _0x2ee108=_0x27c4[_0x5552b4];return _0x2ee108;};'use strict';var multer=require('multer');var util=require(_0x427c('0x0'));var path=require('path');var timeout=require(_0x427c('0x1'));var express=require(_0x427c('0x2'));var router=express[_0x427c('0x3')]();var fs_extra=require(_0x427c('0x4'));var auth=require(_0x427c('0x5'));var interaction=require(_0x427c('0x6'));var config=require(_0x427c('0x7'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x427c('0x8')](),controller['index']);router[_0x427c('0x9')]('/describe',auth[_0x427c('0x8')](),controller[_0x427c('0xa')]);router['get'](_0x427c('0xb'),auth[_0x427c('0x8')](),controller['show']);router['get'](_0x427c('0xc'),auth[_0x427c('0x8')](),controller[_0x427c('0xd')]);router['get'](_0x427c('0xe'),auth[_0x427c('0x8')](),controller[_0x427c('0xf')]);router[_0x427c('0x10')](_0x427c('0x11'),auth['isAuthenticated'](),controller[_0x427c('0x12')]);router[_0x427c('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x427c('0x8')](),controller[_0x427c('0x13')]);router[_0x427c('0x10')]('/checkContactHopper',auth[_0x427c('0x8')](),controller[_0x427c('0x14')]);router['put'](_0x427c('0xb'),auth[_0x427c('0x8')](),controller[_0x427c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 12047ef..f916fff 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 _0x99bb=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x576509,_0x44816b){var _0x5ebac1=function(_0x1d8158){while(--_0x1d8158){_0x576509['push'](_0x576509['shift']());}};_0x5ebac1(++_0x44816b);}(_0x99bb,0x11a));var _0xb99b=function(_0x17df77,_0x200e0b){_0x17df77=_0x17df77-0x0;var _0x35c153=_0x99bb[_0x17df77];return _0x35c153;};'use strict';var Sequelize=require(_0xb99b('0x0'));module[_0xb99b('0x1')]={'state':{'type':Sequelize[_0xb99b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb99b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb99b('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb99b('0x3')]},'calleridnum':{'type':Sequelize[_0xb99b('0x3')]},'calleridname':{'type':Sequelize[_0xb99b('0x3')]},'starttime':{'type':Sequelize[_0xb99b('0x4')]},'responsetime':{'type':Sequelize[_0xb99b('0x4')]},'answertime':{'type':Sequelize[_0xb99b('0x4')]},'droptime':{'type':Sequelize[_0xb99b('0x4')]},'endtime':{'type':Sequelize[_0xb99b('0x4')]},'ringtime':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb99b('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb99b('0x3')]},'membername':{'type':Sequelize[_0xb99b('0x3')]},'reason':{'type':Sequelize[_0xb99b('0x3')]},'amd':{'type':Sequelize[_0xb99b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb99b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb99b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb99b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb99b('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb99b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb99b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f19=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x86ca04,_0x77ec8c){var _0x3c4a3b=function(_0x178fc0){while(--_0x178fc0){_0x86ca04['push'](_0x86ca04['shift']());}};_0x3c4a3b(++_0x77ec8c);}(_0x3f19,0x157));var _0x93f1=function(_0x4c55c2,_0x5dde7e){_0x4c55c2=_0x4c55c2-0x0;var _0x469bab=_0x3f19[_0x4c55c2];return _0x469bab;};'use strict';var Sequelize=require(_0x93f1('0x0'));module[_0x93f1('0x1')]={'state':{'type':Sequelize[_0x93f1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x93f1('0x3')]},'scheduledat':{'type':Sequelize[_0x93f1('0x4')]},'countbusyretry':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x93f1('0x3')]},'calleridname':{'type':Sequelize[_0x93f1('0x3')]},'starttime':{'type':Sequelize[_0x93f1('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x93f1('0x4')]},'droptime':{'type':Sequelize[_0x93f1('0x4')]},'endtime':{'type':Sequelize[_0x93f1('0x4')]},'ringtime':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x93f1('0x3')]},'campaign':{'type':Sequelize[_0x93f1('0x3')]},'campaigntype':{'type':Sequelize[_0x93f1('0x3')]},'membername':{'type':Sequelize[_0x93f1('0x3')]},'reason':{'type':Sequelize[_0x93f1('0x3')]},'amd':{'type':Sequelize[_0x93f1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x93f1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x93f1('0x4')]},'recallme':{'type':Sequelize[_0x93f1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x93f1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x93f1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x93f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 26b9368..8f203c3 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 _0x1bd2=['status','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','map','CmHopperHistory','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1bd2,0x1e7));var _0x21bd=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x1bd2[_0x26462c];return _0x509a42;};'use strict';var emlformat=require(_0x21bd('0x0'));var rimraf=require(_0x21bd('0x1'));var zipdir=require(_0x21bd('0x2'));var jsonpatch=require(_0x21bd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21bd('0x4'));var Mustache=require(_0x21bd('0x5'));var util=require(_0x21bd('0x6'));var path=require(_0x21bd('0x7'));var sox=require(_0x21bd('0x8'));var csv=require(_0x21bd('0x9'));var ejs=require(_0x21bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21bd('0xb'));var squel=require('squel');var crypto=require(_0x21bd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21bd('0xd'));var Redis=require(_0x21bd('0xe'));var authService=require(_0x21bd('0xf'));var qs=require(_0x21bd('0x10'));var as=require(_0x21bd('0x11'));var hardwareService=require(_0x21bd('0x12'));var logger=require(_0x21bd('0x13'))('api');var utils=require(_0x21bd('0x14'));var config=require(_0x21bd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x309b28,_0x2fed07){_0x2fed07=_0x2fed07||0xcc;return function(_0x4b9ef4){if(_0x4b9ef4){return _0x309b28[_0x21bd('0x16')](_0x2fed07);}return _0x309b28['status'](_0x2fed07)[_0x21bd('0x17')]();};}function respondWithResult(_0x8ff227,_0x81150b){_0x81150b=_0x81150b||0xc8;return function(_0x3bd227){if(_0x3bd227){return _0x8ff227[_0x21bd('0x18')](_0x81150b)['json'](_0x3bd227);}};}function respondWithFilteredResult(_0x23f472,_0x3971c6){return function(_0x36a9ee){if(_0x36a9ee){var _0xf9c847=typeof _0x3971c6[_0x21bd('0x19')]==='undefined'&&typeof _0x3971c6[_0x21bd('0x1a')]===_0x21bd('0x1b');var _0x1ef727=_0x36a9ee['count'];var _0x537a4f=_0xf9c847?0x0:_0x3971c6[_0x21bd('0x19')];var _0x516d03=_0xf9c847?_0x36a9ee[_0x21bd('0x1c')]:_0x3971c6[_0x21bd('0x19')]+_0x3971c6['limit'];var _0x26a042;if(_0x516d03>=_0x1ef727){_0x516d03=_0x1ef727;_0x26a042=0xc8;}else{_0x26a042=0xce;}_0x23f472[_0x21bd('0x18')](_0x26a042);return _0x23f472[_0x21bd('0x1d')](_0x21bd('0x1e'),_0x537a4f+'-'+_0x516d03+'/'+_0x1ef727)[_0x21bd('0x1f')](_0x36a9ee);}return null;};}function patchUpdates(_0x20ee62){return function(_0x456caa){try{jsonpatch['apply'](_0x456caa,_0x20ee62,!![]);}catch(_0x4a488b){return BPromise[_0x21bd('0x20')](_0x4a488b);}return _0x456caa['save']();};}function saveUpdates(_0x11c772,_0x5a9b24){return function(_0x32a9f9){if(_0x32a9f9){return _0x32a9f9[_0x21bd('0x21')](_0x11c772)[_0x21bd('0x22')](function(_0x236390){return _0x236390;});}return null;};}function removeEntity(_0x29133d,_0x1e54dd){return function(_0x505877){if(_0x505877){return _0x505877[_0x21bd('0x23')]()[_0x21bd('0x22')](function(){_0x29133d[_0x21bd('0x18')](0xcc)[_0x21bd('0x17')]();});}};}function handleEntityNotFound(_0x35378d,_0x4cbabf){return function(_0x324821){if(!_0x324821){_0x35378d[_0x21bd('0x16')](0x194);}return _0x324821;};}function handleError(_0x105afd,_0x130e3e){_0x130e3e=_0x130e3e||0x1f4;return function(_0x6e8768){logger[_0x21bd('0x24')](_0x6e8768[_0x21bd('0x25')]);if(_0x6e8768[_0x21bd('0x26')]){delete _0x6e8768[_0x21bd('0x26')];}_0x105afd[_0x21bd('0x18')](_0x130e3e)['send'](_0x6e8768);};}exports[_0x21bd('0x27')]=function(_0x58e601,_0x521262){var _0x26314b={},_0x13a151={},_0x471869={'count':0x0,'rows':[]};var _0x1d7206=_[_0x21bd('0x28')](db[_0x21bd('0x29')][_0x21bd('0x2a')],function(_0x5c818c){return{'name':_0x5c818c['fieldName'],'type':_0x5c818c[_0x21bd('0x2b')]['key']};});_0x13a151[_0x21bd('0x2c')]=_[_0x21bd('0x28')](_0x1d7206,_0x21bd('0x26'));_0x13a151[_0x21bd('0x2d')]=_[_0x21bd('0x2e')](_0x58e601['query']);_0x13a151[_0x21bd('0x2f')]=_[_0x21bd('0x30')](_0x13a151[_0x21bd('0x2c')],_0x13a151['query']);_0x26314b['attributes']=_[_0x21bd('0x30')](_0x13a151[_0x21bd('0x2c')],qs['fields'](_0x58e601[_0x21bd('0x2d')][_0x21bd('0x31')]));_0x26314b[_0x21bd('0x32')]=_0x26314b[_0x21bd('0x32')][_0x21bd('0x33')]?_0x26314b['attributes']:_0x13a151[_0x21bd('0x2c')];if(!_0x58e601[_0x21bd('0x2d')][_0x21bd('0x34')]('nolimit')){_0x26314b[_0x21bd('0x1a')]=qs[_0x21bd('0x1a')](_0x58e601[_0x21bd('0x2d')]['limit']);_0x26314b[_0x21bd('0x19')]=qs[_0x21bd('0x19')](_0x58e601['query'][_0x21bd('0x19')]);}_0x26314b[_0x21bd('0x35')]=qs[_0x21bd('0x36')](_0x58e601['query'][_0x21bd('0x36')]);_0x26314b[_0x21bd('0x37')]=qs['filters'](_[_0x21bd('0x38')](_0x58e601[_0x21bd('0x2d')],_0x13a151[_0x21bd('0x2f')]),_0x1d7206);if(_0x58e601[_0x21bd('0x2d')][_0x21bd('0x39')]){_0x26314b[_0x21bd('0x37')]=_[_0x21bd('0x3a')](_0x26314b[_0x21bd('0x37')],{'$or':_['map'](_0x1d7206,function(_0x230f4a){if(_0x230f4a['type']!==_0x21bd('0x3b')){var _0x520286={};_0x520286[_0x230f4a[_0x21bd('0x26')]]={'$like':'%'+_0x58e601['query']['filter']+'%'};return _0x520286;}})});}_0x26314b=_[_0x21bd('0x3a')]({},_0x26314b,_0x58e601[_0x21bd('0x3c')]);var _0xab9e4c={'where':_0x26314b[_0x21bd('0x37')]};return db[_0x21bd('0x29')][_0x21bd('0x1c')](_0xab9e4c)[_0x21bd('0x22')](function(_0x3c5d9c){_0x471869['count']=_0x3c5d9c;if(_0x58e601[_0x21bd('0x2d')][_0x21bd('0x3d')]){_0x26314b['include']=[{'all':!![]}];}return db[_0x21bd('0x29')][_0x21bd('0x3e')](_0x26314b);})['then'](function(_0x5a90dc){_0x471869[_0x21bd('0x3f')]=_0x5a90dc;return _0x471869;})[_0x21bd('0x22')](respondWithFilteredResult(_0x521262,_0x26314b))['catch'](handleError(_0x521262,null));};exports[_0x21bd('0x40')]=function(_0x5a9baf,_0x147a5f){var _0x5d3e89={'raw':!![],'where':{'id':_0x5a9baf[_0x21bd('0x41')]['id']}},_0x505825={};_0x505825[_0x21bd('0x2c')]=_[_0x21bd('0x2e')](db['CmHopperHistory']['rawAttributes']);_0x505825[_0x21bd('0x2d')]=_['keys'](_0x5a9baf[_0x21bd('0x2d')]);_0x505825['filters']=_[_0x21bd('0x30')](_0x505825[_0x21bd('0x2c')],_0x505825['query']);_0x5d3e89[_0x21bd('0x32')]=_[_0x21bd('0x30')](_0x505825[_0x21bd('0x2c')],qs[_0x21bd('0x31')](_0x5a9baf[_0x21bd('0x2d')][_0x21bd('0x31')]));_0x5d3e89[_0x21bd('0x32')]=_0x5d3e89['attributes'][_0x21bd('0x33')]?_0x5d3e89['attributes']:_0x505825[_0x21bd('0x2c')];if(_0x5a9baf[_0x21bd('0x2d')][_0x21bd('0x3d')]){_0x5d3e89[_0x21bd('0x42')]=[{'all':!![]}];}_0x5d3e89=_[_0x21bd('0x3a')]({},_0x5d3e89,_0x5a9baf[_0x21bd('0x3c')]);return db['CmHopperHistory'][_0x21bd('0x43')](_0x5d3e89)[_0x21bd('0x22')](handleEntityNotFound(_0x147a5f,null))[_0x21bd('0x22')](respondWithResult(_0x147a5f,null))[_0x21bd('0x44')](handleError(_0x147a5f,null));};exports[_0x21bd('0x45')]=function(_0x1c5758,_0x5ac6c6){return db[_0x21bd('0x29')][_0x21bd('0x45')](_0x1c5758[_0x21bd('0x46')],{})[_0x21bd('0x22')](respondWithResult(_0x5ac6c6,0xc9))[_0x21bd('0x44')](handleError(_0x5ac6c6,null));};exports[_0x21bd('0x47')]=function(_0x3b5caf,_0x7a4fec){return db[_0x21bd('0x29')][_0x21bd('0x47')]()[_0x21bd('0x22')](respondWithResult(_0x7a4fec,null))[_0x21bd('0x44')](handleError(_0x7a4fec,null));};exports[_0x21bd('0x21')]=function(_0xec82d7,_0x2cbd66){if(_0xec82d7[_0x21bd('0x46')][_0x21bd('0x48')]){delete _0xec82d7[_0x21bd('0x46')][_0x21bd('0x48')];}return db['CmHopperHistory'][_0x21bd('0x43')]({'where':{'uniqueid':_0xec82d7[_0x21bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cbd66,null))[_0x21bd('0x22')](saveUpdates(_0xec82d7[_0x21bd('0x46')],null))[_0x21bd('0x22')](respondWithResult(_0x2cbd66,null))[_0x21bd('0x44')](handleError(_0x2cbd66,null));}; \ No newline at end of file +var _0x7cef=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','find','create','body','describe','uniqueid','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x50180c,_0x3fc232){var _0x5eaa41=function(_0x24fe64){while(--_0x24fe64){_0x50180c['push'](_0x50180c['shift']());}};_0x5eaa41(++_0x3fc232);}(_0x7cef,0xde));var _0xf7ce=function(_0x1ffc47,_0x485a79){_0x1ffc47=_0x1ffc47-0x0;var _0x2e7da4=_0x7cef[_0x1ffc47];return _0x2e7da4;};'use strict';var emlformat=require(_0xf7ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7ce('0x1'));var jsonpatch=require(_0xf7ce('0x2'));var rp=require(_0xf7ce('0x3'));var moment=require('moment');var BPromise=require(_0xf7ce('0x4'));var Mustache=require('mustache');var util=require(_0xf7ce('0x5'));var path=require(_0xf7ce('0x6'));var sox=require(_0xf7ce('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7ce('0x8'));var squel=require(_0xf7ce('0x9'));var crypto=require(_0xf7ce('0xa'));var jsforce=require(_0xf7ce('0xb'));var deskjs=require(_0xf7ce('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf7ce('0xd'));var Papa=require(_0xf7ce('0xe'));var Redis=require(_0xf7ce('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf7ce('0x10'));var as=require(_0xf7ce('0x11'));var hardwareService=require(_0xf7ce('0x12'));var logger=require(_0xf7ce('0x13'))(_0xf7ce('0x14'));var utils=require(_0xf7ce('0x15'));var config=require(_0xf7ce('0x16'));var licenseUtil=require(_0xf7ce('0x17'));var db=require(_0xf7ce('0x18'))['db'];function respondWithStatusCode(_0x188d4c,_0x15f7a0){_0x15f7a0=_0x15f7a0||0xcc;return function(_0x48811b){if(_0x48811b){return _0x188d4c[_0xf7ce('0x19')](_0x15f7a0);}return _0x188d4c[_0xf7ce('0x1a')](_0x15f7a0)[_0xf7ce('0x1b')]();};}function respondWithResult(_0x3b53de,_0x16f654){_0x16f654=_0x16f654||0xc8;return function(_0x22b1ca){if(_0x22b1ca){return _0x3b53de[_0xf7ce('0x1a')](_0x16f654)[_0xf7ce('0x1c')](_0x22b1ca);}};}function respondWithFilteredResult(_0x426ebd,_0x563b0b){return function(_0x2bf24b){if(_0x2bf24b){var _0x2ccdbe=typeof _0x563b0b[_0xf7ce('0x1d')]===_0xf7ce('0x1e')&&typeof _0x563b0b['limit']===_0xf7ce('0x1e');var _0x4134b9=_0x2bf24b[_0xf7ce('0x1f')];var _0x631a2b=_0x2ccdbe?0x0:_0x563b0b[_0xf7ce('0x1d')];var _0x58be94=_0x2ccdbe?_0x2bf24b[_0xf7ce('0x1f')]:_0x563b0b[_0xf7ce('0x1d')]+_0x563b0b[_0xf7ce('0x20')];var _0x3b5614;if(_0x58be94>=_0x4134b9){_0x58be94=_0x4134b9;_0x3b5614=0xc8;}else{_0x3b5614=0xce;}_0x426ebd[_0xf7ce('0x1a')](_0x3b5614);return _0x426ebd[_0xf7ce('0x21')](_0xf7ce('0x22'),_0x631a2b+'-'+_0x58be94+'/'+_0x4134b9)['json'](_0x2bf24b);}return null;};}function patchUpdates(_0x546cd0){return function(_0x3aa57e){try{jsonpatch[_0xf7ce('0x23')](_0x3aa57e,_0x546cd0,!![]);}catch(_0xb5823e){return BPromise[_0xf7ce('0x24')](_0xb5823e);}return _0x3aa57e[_0xf7ce('0x25')]();};}function saveUpdates(_0x4fd1d1,_0x51cff9){return function(_0x51d3be){if(_0x51d3be){return _0x51d3be[_0xf7ce('0x26')](_0x4fd1d1)[_0xf7ce('0x27')](function(_0x36f11f){return _0x36f11f;});}return null;};}function removeEntity(_0x33eaed,_0x2ad1fa){return function(_0x5b3805){if(_0x5b3805){return _0x5b3805['destroy']()[_0xf7ce('0x27')](function(){_0x33eaed['status'](0xcc)[_0xf7ce('0x1b')]();});}};}function handleEntityNotFound(_0x5f58f1,_0xc9f6c8){return function(_0x1052ba){if(!_0x1052ba){_0x5f58f1['sendStatus'](0x194);}return _0x1052ba;};}function handleError(_0x102226,_0x28cc43){_0x28cc43=_0x28cc43||0x1f4;return function(_0x36cdcf){logger[_0xf7ce('0x28')](_0x36cdcf[_0xf7ce('0x29')]);if(_0x36cdcf[_0xf7ce('0x2a')]){delete _0x36cdcf[_0xf7ce('0x2a')];}_0x102226[_0xf7ce('0x1a')](_0x28cc43)['send'](_0x36cdcf);};}exports[_0xf7ce('0x2b')]=function(_0x242665,_0x4aeca4){var _0x132017={},_0x5abcfd={},_0x333ecf={'count':0x0,'rows':[]};var _0x2837aa=_[_0xf7ce('0x2c')](db['CmHopperHistory'][_0xf7ce('0x2d')],function(_0x57a1d0){return{'name':_0x57a1d0[_0xf7ce('0x2e')],'type':_0x57a1d0[_0xf7ce('0x2f')][_0xf7ce('0x30')]};});_0x5abcfd[_0xf7ce('0x31')]=_[_0xf7ce('0x2c')](_0x2837aa,_0xf7ce('0x2a'));_0x5abcfd['query']=_[_0xf7ce('0x32')](_0x242665[_0xf7ce('0x33')]);_0x5abcfd[_0xf7ce('0x34')]=_[_0xf7ce('0x35')](_0x5abcfd[_0xf7ce('0x31')],_0x5abcfd['query']);_0x132017[_0xf7ce('0x36')]=_[_0xf7ce('0x35')](_0x5abcfd[_0xf7ce('0x31')],qs['fields'](_0x242665[_0xf7ce('0x33')][_0xf7ce('0x37')]));_0x132017['attributes']=_0x132017[_0xf7ce('0x36')][_0xf7ce('0x38')]?_0x132017['attributes']:_0x5abcfd['model'];if(!_0x242665[_0xf7ce('0x33')][_0xf7ce('0x39')](_0xf7ce('0x3a'))){_0x132017[_0xf7ce('0x20')]=qs[_0xf7ce('0x20')](_0x242665['query'][_0xf7ce('0x20')]);_0x132017[_0xf7ce('0x1d')]=qs[_0xf7ce('0x1d')](_0x242665[_0xf7ce('0x33')][_0xf7ce('0x1d')]);}_0x132017[_0xf7ce('0x3b')]=qs[_0xf7ce('0x3c')](_0x242665[_0xf7ce('0x33')][_0xf7ce('0x3c')]);_0x132017['where']=qs[_0xf7ce('0x34')](_[_0xf7ce('0x3d')](_0x242665[_0xf7ce('0x33')],_0x5abcfd[_0xf7ce('0x34')]),_0x2837aa);if(_0x242665[_0xf7ce('0x33')][_0xf7ce('0x3e')]){_0x132017[_0xf7ce('0x3f')]=_[_0xf7ce('0x40')](_0x132017[_0xf7ce('0x3f')],{'$or':_[_0xf7ce('0x2c')](_0x2837aa,function(_0xf00546){if(_0xf00546[_0xf7ce('0x2f')]!==_0xf7ce('0x41')){var _0x1d4987={};_0x1d4987[_0xf00546[_0xf7ce('0x2a')]]={'$like':'%'+_0x242665[_0xf7ce('0x33')][_0xf7ce('0x3e')]+'%'};return _0x1d4987;}})});}_0x132017=_[_0xf7ce('0x40')]({},_0x132017,_0x242665[_0xf7ce('0x42')]);var _0x306560={'where':_0x132017['where']};return db[_0xf7ce('0x43')][_0xf7ce('0x1f')](_0x306560)[_0xf7ce('0x27')](function(_0x4c7d73){_0x333ecf['count']=_0x4c7d73;if(_0x242665[_0xf7ce('0x33')][_0xf7ce('0x44')]){_0x132017[_0xf7ce('0x45')]=[{'all':!![]}];}return db[_0xf7ce('0x43')][_0xf7ce('0x46')](_0x132017);})[_0xf7ce('0x27')](function(_0x21ab8f){_0x333ecf[_0xf7ce('0x47')]=_0x21ab8f;return _0x333ecf;})['then'](respondWithFilteredResult(_0x4aeca4,_0x132017))[_0xf7ce('0x48')](handleError(_0x4aeca4,null));};exports[_0xf7ce('0x49')]=function(_0x14ad80,_0x26d5c1){var _0x470bbd={'raw':!![],'where':{'id':_0x14ad80['params']['id']}},_0x2a1aa4={};_0x2a1aa4['model']=_['keys'](db['CmHopperHistory'][_0xf7ce('0x2d')]);_0x2a1aa4[_0xf7ce('0x33')]=_[_0xf7ce('0x32')](_0x14ad80[_0xf7ce('0x33')]);_0x2a1aa4[_0xf7ce('0x34')]=_[_0xf7ce('0x35')](_0x2a1aa4['model'],_0x2a1aa4[_0xf7ce('0x33')]);_0x470bbd[_0xf7ce('0x36')]=_['intersection'](_0x2a1aa4[_0xf7ce('0x31')],qs[_0xf7ce('0x37')](_0x14ad80[_0xf7ce('0x33')][_0xf7ce('0x37')]));_0x470bbd['attributes']=_0x470bbd[_0xf7ce('0x36')]['length']?_0x470bbd[_0xf7ce('0x36')]:_0x2a1aa4[_0xf7ce('0x31')];if(_0x14ad80['query'][_0xf7ce('0x44')]){_0x470bbd['include']=[{'all':!![]}];}_0x470bbd=_[_0xf7ce('0x40')]({},_0x470bbd,_0x14ad80['options']);return db[_0xf7ce('0x43')][_0xf7ce('0x4a')](_0x470bbd)['then'](handleEntityNotFound(_0x26d5c1,null))[_0xf7ce('0x27')](respondWithResult(_0x26d5c1,null))[_0xf7ce('0x48')](handleError(_0x26d5c1,null));};exports[_0xf7ce('0x4b')]=function(_0xe810c6,_0x4e8120){return db[_0xf7ce('0x43')][_0xf7ce('0x4b')](_0xe810c6[_0xf7ce('0x4c')],{})[_0xf7ce('0x27')](respondWithResult(_0x4e8120,0xc9))[_0xf7ce('0x48')](handleError(_0x4e8120,null));};exports[_0xf7ce('0x4d')]=function(_0x2adf79,_0x2f7d9e){return db[_0xf7ce('0x43')]['describe']()['then'](respondWithResult(_0x2f7d9e,null))[_0xf7ce('0x48')](handleError(_0x2f7d9e,null));};exports[_0xf7ce('0x26')]=function(_0x5c65d9,_0x1a1f49){if(_0x5c65d9['body'][_0xf7ce('0x4e')]){delete _0x5c65d9[_0xf7ce('0x4c')][_0xf7ce('0x4e')];}return db[_0xf7ce('0x43')][_0xf7ce('0x4a')]({'where':{'uniqueid':_0x5c65d9[_0xf7ce('0x4f')]['id']}})[_0xf7ce('0x27')](handleEntityNotFound(_0x1a1f49,null))['then'](saveUpdates(_0x5c65d9[_0xf7ce('0x4c')],null))['then'](respondWithResult(_0x1a1f49,null))['catch'](handleError(_0x1a1f49,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4b283e3..1f0c2ba 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 _0xd1ca=['lodash','util','bluebird','request-promise','path','../../config/environment','define','cm_hopper_history','endtime','uniqueid'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd1ca,0x140));var _0xad1c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd1ca[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xad1c('0x2'));var rp=require(_0xad1c('0x3'));var fs=require('fs');var path=require(_0xad1c('0x4'));var rimraf=require('rimraf');var config=require(_0xad1c('0x5'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0xd08c6,_0x44ae9c){return _0xd08c6[_0xad1c('0x6')]('CmHopperHistory',attributes,{'tableName':_0xad1c('0x7'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xad1c('0x8')]},{'name':_0xad1c('0x9'),'fields':[_0xad1c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3a8=['util','../../config/logger','moment','path','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x693b8e,_0x5af6d9){var _0x1c491c=function(_0x5b685a){while(--_0x5b685a){_0x693b8e['push'](_0x693b8e['shift']());}};_0x1c491c(++_0x5af6d9);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x41ad87,_0x2f9560){_0x41ad87=_0x41ad87-0x0;var _0x5b1acc=_0xf3a8[_0x41ad87];return _0x5b1acc;};'use strict';var _=require('lodash');var util=require(_0x8f3a('0x0'));var logger=require(_0x8f3a('0x1'))('api');var moment=require(_0x8f3a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f3a('0x3'));var rimraf=require('rimraf');var config=require(_0x8f3a('0x4'));var attributes=require('./cmHopperHistory.attributes');module[_0x8f3a('0x5')]=function(_0x3d6e2d,_0x109997){return _0x3d6e2d[_0x8f3a('0x6')](_0x8f3a('0x7'),attributes,{'tableName':_0x8f3a('0x8'),'paranoid':![],'indexes':[{'name':_0x8f3a('0x9'),'fields':[_0x8f3a('0x9')]},{'name':_0x8f3a('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3aac683..f68f577 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 _0xd61e=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','create','body','options','raw','debug','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','CmHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null'];(function(_0x45f6e0,_0x3e4779){var _0x5909db=function(_0x982766){while(--_0x982766){_0x45f6e0['push'](_0x45f6e0['shift']());}};_0x5909db(++_0x3e4779);}(_0xd61e,0x13d));var _0xed61=function(_0x5f5de0,_0x153131){_0x5f5de0=_0x5f5de0-0x0;var _0x220f90=_0xd61e[_0x5f5de0];return _0x220f90;};'use strict';var _=require(_0xed61('0x0'));var util=require(_0xed61('0x1'));var moment=require(_0xed61('0x2'));var BPromise=require(_0xed61('0x3'));var rs=require(_0xed61('0x4'));var fs=require('fs');var Redis=require(_0xed61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed61('0x6'));var logger=require(_0xed61('0x7'))(_0xed61('0x8'));var config=require(_0xed61('0x9'));var jayson=require(_0xed61('0xa'));var client=jayson[_0xed61('0xb')][_0xed61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b7469,_0x5e6173,_0x59ef0e){return new BPromise(function(_0x5cbbd7,_0x4a2d4c){return client[_0xed61('0xd')](_0x5b7469,_0x59ef0e)[_0xed61('0xe')](function(_0x2964de){logger[_0xed61('0xf')](_0xed61('0x10'),_0x5e6173,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5e6173,_0xed61('0x11'),JSON[_0xed61('0x12')](_0x2964de));if(_0x2964de['error']){if(_0x2964de['error']['code']===0x1f4){logger['error'](_0xed61('0x10'),_0x5e6173,_0x2964de[_0xed61('0x13')][_0xed61('0x14')]);return _0x4a2d4c(_0x2964de[_0xed61('0x13')]['message']);}logger[_0xed61('0x13')](_0xed61('0x10'),_0x5e6173,_0x2964de[_0xed61('0x13')]['message']);return _0x5cbbd7(_0x2964de[_0xed61('0x13')][_0xed61('0x14')]);}else{logger[_0xed61('0xf')](_0xed61('0x10'),_0x5e6173,'request\x20sent');_0x5cbbd7(_0x2964de[_0xed61('0x15')][_0xed61('0x14')]);}})[_0xed61('0x16')](function(_0x6d05cd){logger['error'](_0xed61('0x10'),_0x5e6173,_0x6d05cd);_0x4a2d4c(_0x6d05cd);});});}exports[_0xed61('0x17')]=function(_0x4bd841){var _0x31b034=this;return new Promise(function(_0x11a277,_0x9d980e){return db['CmHopperHistory'][_0xed61('0x18')](_0x4bd841[_0xed61('0x19')],{'raw':_0x4bd841[_0xed61('0x1a')]?_0x4bd841['options'][_0xed61('0x1b')]===undefined?!![]:![]:!![]})[_0xed61('0xe')](function(_0xce408c){logger['info'](_0xed61('0x17'),_0x4bd841);logger[_0xed61('0x1c')]('CreateCmHopperHistory',_0x4bd841,JSON[_0xed61('0x12')](_0xce408c));_0x11a277(_0xce408c);})[_0xed61('0x16')](function(_0x864dfa){logger['error']('CreateCmHopperHistory',_0x864dfa[_0xed61('0x14')],_0x4bd841);_0x9d980e(_0x31b034['error'](0x1f4,_0x864dfa[_0xed61('0x14')]));});});};exports[_0xed61('0x1d')]=function(_0x2722d0){var _0x39a8ff=this;return new Promise(function(_0x40ea88,_0x5a71f0){return db['CmHopperHistory']['findAll']({'raw':_0x2722d0['options']?_0x2722d0['options'][_0xed61('0x1b')]===undefined?!![]:![]:!![],'where':_0x2722d0['options']?_0x2722d0[_0xed61('0x1a')][_0xed61('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xed61('0x1f')][_0xed61('0x20')]('id')),_0xed61('0x21')],[db['sequelize']['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')]['literal'](_0xed61('0x23')))),'predictiveIntervalAnsweredCalls'],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db['sequelize'][_0xed61('0x24')](_0xed61('0x25')))),_0xed61('0x26')],[db[_0xed61('0x1f')]['fn']('COUNT',db[_0xed61('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xed61('0x27')))),_0xed61('0x28')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x29'),db['sequelize']['fn']('IF',db['sequelize'][_0xed61('0x24')](_0xed61('0x2a')))),_0xed61('0x2b')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x29'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xed61('0x2c')]]})['then'](function(_0x251829){logger['info']('AvgHandleTime',_0x2722d0);logger['debug']('AvgHandleTime',_0x2722d0,JSON['stringify'](_0x251829));_0x40ea88(_0x251829);})[_0xed61('0x16')](function(_0x8470f8){logger[_0xed61('0x13')](_0xed61('0x1d'),_0x8470f8[_0xed61('0x14')],_0x2722d0);_0x5a71f0(_0x39a8ff[_0xed61('0x13')](0x1f4,_0x8470f8[_0xed61('0x14')]));});});};exports[_0xed61('0x2d')]=function(_0x5b1e4e){var _0x5d9cb3=this;return new Promise(function(_0x4b7688,_0x16391d){return db[_0xed61('0x2e')][_0xed61('0x2f')]({'raw':_0x5b1e4e['options']?_0x5b1e4e[_0xed61('0x1a')][_0xed61('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b1e4e['options']?_0x5b1e4e[_0xed61('0x1a')][_0xed61('0x1e')]||null:null,'attributes':[[_0xed61('0x30'),_0xed61('0x31')],[db['sequelize']['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x32')))),_0xed61('0x33')],[db[_0xed61('0x1f')]['fn']('COUNT',db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x34')))),_0xed61('0x35')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x23')))),_0xed61('0x36')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xed61('0x24')](_0xed61('0x37')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x38')))),_0xed61('0x39')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db['sequelize']['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x3a')))),'outboundDropCallsDayTimeout'],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')]['literal'](_0xed61('0x3b')))),_0xed61('0x3c')],[db[_0xed61('0x1f')]['fn']('COUNT',db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')]['literal'](_0xed61('0x3d')))),_0xed61('0x3e')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x3f')))),_0xed61('0x40')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x41')))),_0xed61('0x42')],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x43')))),_0xed61('0x44')],[db['sequelize']['fn']('COUNT',db[_0xed61('0x1f')]['fn']('IF',db[_0xed61('0x1f')][_0xed61('0x24')](_0xed61('0x45')))),'outboundRejectCallsDay'],[db[_0xed61('0x1f')]['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xed61('0x46')]],'group':[_0xed61('0x30')]})[_0xed61('0xe')](function(_0x1d3b9d){logger[_0xed61('0xf')](_0xed61('0x2d'),_0x5b1e4e);logger[_0xed61('0x1c')](_0xed61('0x2d'),_0x5b1e4e,JSON['stringify'](_0x1d3b9d));_0x4b7688(_0x1d3b9d);})[_0xed61('0x16')](function(_0x258a40){logger['error'](_0xed61('0x2d'),_0x258a40[_0xed61('0x14')],_0x5b1e4e);_0x16391d(_0x5d9cb3[_0xed61('0x13')](0x1f4,_0x258a40['message']));});});};exports[_0xed61('0x47')]=function(_0x5768d6){var _0xb93db9=this;return new Promise(function(_0x2c16a9,_0x361fd8){return db[_0xed61('0x2e')][_0xed61('0x2f')]({'raw':_0x5768d6[_0xed61('0x1a')]?_0x5768d6[_0xed61('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5768d6[_0xed61('0x1a')]?_0x5768d6[_0xed61('0x1a')][_0xed61('0x1e')]||null:null,'attributes':[[_0xed61('0x30'),_0xed61('0x31')],[db[_0xed61('0x1f')]['fn']('COUNT',db[_0xed61('0x1f')]['col']('id')),_0xed61('0x48')],[db['sequelize']['fn'](_0xed61('0x22'),db[_0xed61('0x1f')]['fn']('IF',db['sequelize'][_0xed61('0x24')](_0xed61('0x23')))),_0xed61('0x49')]],'group':[_0xed61('0x30')]})[_0xed61('0xe')](function(_0x546be2){logger[_0xed61('0xf')](_0xed61('0x47'),_0x5768d6);logger[_0xed61('0x1c')](_0xed61('0x47'),_0x5768d6,JSON[_0xed61('0x12')](_0x546be2));_0x2c16a9(_0x546be2);})[_0xed61('0x16')](function(_0x3ea371){logger['error']('GetCampaignHopperHistory',_0x3ea371[_0xed61('0x14')],_0x5768d6);_0x361fd8(_0xb93db9[_0xed61('0x13')](0x1f4,_0x3ea371[_0xed61('0x14')]));});});}; \ No newline at end of file +var _0x755e=['outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','findAll','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x755e,0x96));var _0xe755=function(_0x1558ee,_0x40ed70){_0x1558ee=_0x1558ee-0x0;var _0x252dba=_0x755e[_0x1558ee];return _0x252dba;};'use strict';var _=require(_0xe755('0x0'));var util=require(_0xe755('0x1'));var moment=require(_0xe755('0x2'));var BPromise=require(_0xe755('0x3'));var rs=require(_0xe755('0x4'));var fs=require('fs');var Redis=require(_0xe755('0x5'));var db=require(_0xe755('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe755('0x7'))('rpc');var config=require(_0xe755('0x8'));var jayson=require(_0xe755('0x9'));var client=jayson[_0xe755('0xa')][_0xe755('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3184c3,_0x58b2e7,_0x135a54){return new BPromise(function(_0x503412,_0x2f7288){return client['request'](_0x3184c3,_0x135a54)[_0xe755('0xc')](function(_0x232c36){logger[_0xe755('0xd')](_0xe755('0xe'),_0x58b2e7,_0xe755('0xf'));logger[_0xe755('0x10')](_0xe755('0x11'),_0x58b2e7,_0xe755('0xf'),JSON[_0xe755('0x12')](_0x232c36));if(_0x232c36[_0xe755('0x13')]){if(_0x232c36[_0xe755('0x13')][_0xe755('0x14')]===0x1f4){logger['error'](_0xe755('0xe'),_0x58b2e7,_0x232c36[_0xe755('0x13')]['message']);return _0x2f7288(_0x232c36[_0xe755('0x13')][_0xe755('0x15')]);}logger[_0xe755('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x58b2e7,_0x232c36[_0xe755('0x13')][_0xe755('0x15')]);return _0x503412(_0x232c36['error'][_0xe755('0x15')]);}else{logger[_0xe755('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x58b2e7,_0xe755('0xf'));_0x503412(_0x232c36['result'][_0xe755('0x15')]);}})[_0xe755('0x16')](function(_0xb75468){logger[_0xe755('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x58b2e7,_0xb75468);_0x2f7288(_0xb75468);});});}exports[_0xe755('0x17')]=function(_0x597ea9){var _0x29dda6=this;return new Promise(function(_0x5ede72,_0x415451){return db[_0xe755('0x18')]['create'](_0x597ea9[_0xe755('0x19')],{'raw':_0x597ea9[_0xe755('0x1a')]?_0x597ea9[_0xe755('0x1a')][_0xe755('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x7ff66c){logger[_0xe755('0xd')](_0xe755('0x17'),_0x597ea9);logger[_0xe755('0x10')](_0xe755('0x17'),_0x597ea9,JSON[_0xe755('0x12')](_0x7ff66c));_0x5ede72(_0x7ff66c);})[_0xe755('0x16')](function(_0x196df2){logger[_0xe755('0x13')](_0xe755('0x17'),_0x196df2['message'],_0x597ea9);_0x415451(_0x29dda6[_0xe755('0x13')](0x1f4,_0x196df2[_0xe755('0x15')]));});});};exports[_0xe755('0x1c')]=function(_0x4e56b6){var _0x2846f8=this;return new Promise(function(_0xf19c9a,_0x858774){return db[_0xe755('0x18')]['findAll']({'raw':_0x4e56b6['options']?_0x4e56b6[_0xe755('0x1a')][_0xe755('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e56b6[_0xe755('0x1a')]?_0x4e56b6[_0xe755('0x1a')][_0xe755('0x1d')]||null:null,'attributes':[[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['col']('id')),_0xe755('0x20')],[db[_0xe755('0x1e')]['fn']('COUNT',db[_0xe755('0x1e')]['fn']('IF',db['sequelize'][_0xe755('0x21')](_0xe755('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')]['literal'](_0xe755('0x23')))),_0xe755('0x24')],[db[_0xe755('0x1e')]['fn']('COUNT',db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x25')))),_0xe755('0x26')],[db['sequelize']['fn'](_0xe755('0x27'),db[_0xe755('0x1e')]['fn']('IF',db['sequelize'][_0xe755('0x21')](_0xe755('0x28')))),_0xe755('0x29')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x27'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xe755('0x2a')]]})[_0xe755('0xc')](function(_0x31bb04){logger['info'](_0xe755('0x1c'),_0x4e56b6);logger[_0xe755('0x10')]('AvgHandleTime',_0x4e56b6,JSON[_0xe755('0x12')](_0x31bb04));_0xf19c9a(_0x31bb04);})[_0xe755('0x16')](function(_0x3973c9){logger[_0xe755('0x13')](_0xe755('0x1c'),_0x3973c9[_0xe755('0x15')],_0x4e56b6);_0x858774(_0x2846f8[_0xe755('0x13')](0x1f4,_0x3973c9[_0xe755('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x40887b){var _0xbf4dc9=this;return new Promise(function(_0x16ae97,_0x5e4cea){return db[_0xe755('0x18')][_0xe755('0x2b')]({'raw':_0x40887b[_0xe755('0x1a')]?_0x40887b['options']['raw']===undefined?!![]:![]:!![],'where':_0x40887b[_0xe755('0x1a')]?_0x40887b[_0xe755('0x1a')][_0xe755('0x1d')]||null:null,'attributes':[['campaign','name'],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x2c')))),_0xe755('0x2d')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x2e')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x22')))),_0xe755('0x2f')],[db['sequelize']['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x30')))),_0xe755('0x31')],[db[_0xe755('0x1e')]['fn']('COUNT',db[_0xe755('0x1e')]['fn']('IF',db['sequelize'][_0xe755('0x21')](_0xe755('0x32')))),_0xe755('0x33')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x34')))),_0xe755('0x35')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db['sequelize'][_0xe755('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xe755('0x36')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x37')))),_0xe755('0x38')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db['sequelize'][_0xe755('0x21')](_0xe755('0x39')))),_0xe755('0x3a')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x3b')))),_0xe755('0x3c')],[db['sequelize']['fn'](_0xe755('0x1f'),db['sequelize']['fn']('IF',db[_0xe755('0x1e')][_0xe755('0x21')](_0xe755('0x3d')))),'outboundRejectCallsDay'],[db[_0xe755('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe755('0x3e')))),_0xe755('0x3f')],[db[_0xe755('0x1e')]['fn']('COUNT',db[_0xe755('0x1e')]['fn']('IF',db['sequelize'][_0xe755('0x21')](_0xe755('0x40')))),'outboundRejectCallsDay'],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xe755('0x21')](_0xe755('0x41')))),_0xe755('0x42')]],'group':[_0xe755('0x43')]})['then'](function(_0x2845b2){logger[_0xe755('0xd')](_0xe755('0x44'),_0x40887b);logger['debug']('GetVoiceQueueHopperHistory',_0x40887b,JSON[_0xe755('0x12')](_0x2845b2));_0x16ae97(_0x2845b2);})[_0xe755('0x16')](function(_0x17305c){logger['error'](_0xe755('0x44'),_0x17305c[_0xe755('0x15')],_0x40887b);_0x5e4cea(_0xbf4dc9['error'](0x1f4,_0x17305c[_0xe755('0x15')]));});});};exports[_0xe755('0x45')]=function(_0x8f2d59){var _0x48ad8a=this;return new Promise(function(_0x58983f,_0x403070){return db['CmHopperHistory'][_0xe755('0x2b')]({'raw':_0x8f2d59[_0xe755('0x1a')]?_0x8f2d59[_0xe755('0x1a')][_0xe755('0x1b')]===undefined?!![]:![]:!![],'where':_0x8f2d59[_0xe755('0x1a')]?_0x8f2d59[_0xe755('0x1a')][_0xe755('0x1d')]||null:null,'attributes':[[_0xe755('0x43'),_0xe755('0x46')],[db[_0xe755('0x1e')]['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['col']('id')),_0xe755('0x47')],[db['sequelize']['fn'](_0xe755('0x1f'),db[_0xe755('0x1e')]['fn']('IF',db[_0xe755('0x1e')]['literal'](_0xe755('0x22')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xe755('0xc')](function(_0x6b8511){logger[_0xe755('0xd')](_0xe755('0x45'),_0x8f2d59);logger[_0xe755('0x10')](_0xe755('0x45'),_0x8f2d59,JSON[_0xe755('0x12')](_0x6b8511));_0x58983f(_0x6b8511);})['catch'](function(_0x2ddfe6){logger['error'](_0xe755('0x45'),_0x2ddfe6[_0xe755('0x15')],_0x8f2d59);_0x403070(_0x48ad8a[_0xe755('0x13')](0x1f4,_0x2ddfe6['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4f8a79e..5fe2045 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 _0x3e54=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/:id','show','post','update','exports','multer'];(function(_0x3e6127,_0x37dc77){var _0x3db180=function(_0xcb7811){while(--_0xcb7811){_0x3e6127['push'](_0x3e6127['shift']());}};_0x3db180(++_0x37dc77);}(_0x3e54,0x8f));var _0x43e5=function(_0x4a66bb,_0x3c3a9e){_0x4a66bb=_0x4a66bb-0x0;var _0x2572f6=_0x3e54[_0x4a66bb];return _0x2572f6;};'use strict';var multer=require(_0x43e5('0x0'));var util=require(_0x43e5('0x1'));var path=require(_0x43e5('0x2'));var timeout=require(_0x43e5('0x3'));var express=require('express');var router=express[_0x43e5('0x4')]();var fs_extra=require(_0x43e5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x43e5('0x6'));var config=require(_0x43e5('0x7'));var controller=require(_0x43e5('0x8'));router[_0x43e5('0x9')]('/',auth[_0x43e5('0xa')](),controller['index']);router[_0x43e5('0x9')]('/describe',auth[_0x43e5('0xa')](),controller['describe']);router[_0x43e5('0x9')](_0x43e5('0xb'),auth['isAuthenticated'](),controller[_0x43e5('0xc')]);router[_0x43e5('0xd')]('/',auth[_0x43e5('0xa')](),controller['create']);router['put'](_0x43e5('0xb'),auth[_0x43e5('0xa')](),controller[_0x43e5('0xe')]);module[_0x43e5('0xf')]=router; \ No newline at end of file +var _0x3af3=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','util'];(function(_0x5482e4,_0x539e87){var _0x4828af=function(_0x1d2620){while(--_0x1d2620){_0x5482e4['push'](_0x5482e4['shift']());}};_0x4828af(++_0x539e87);}(_0x3af3,0x1ca));var _0x33af=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x3af3[_0x188d31];return _0x30ed33;};'use strict';var multer=require('multer');var util=require(_0x33af('0x0'));var path=require(_0x33af('0x1'));var timeout=require('connect-timeout');var express=require(_0x33af('0x2'));var router=express[_0x33af('0x3')]();var fs_extra=require(_0x33af('0x4'));var auth=require(_0x33af('0x5'));var interaction=require(_0x33af('0x6'));var config=require('../../config/environment');var controller=require(_0x33af('0x7'));router[_0x33af('0x8')]('/',auth['isAuthenticated'](),controller[_0x33af('0x9')]);router[_0x33af('0x8')](_0x33af('0xa'),auth[_0x33af('0xb')](),controller[_0x33af('0xc')]);router['get'](_0x33af('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x33af('0xe')]('/',auth['isAuthenticated'](),controller[_0x33af('0xf')]);router[_0x33af('0x10')](_0x33af('0xd'),auth[_0x33af('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 746a6a0..9260a44 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 _0xb43b=['STRING','name','sequelize'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0xb43b,0xbf));var _0xbb43=function(_0x40805e,_0x2d8a5a){_0x40805e=_0x40805e-0x0;var _0x2c3eca=_0xb43b[_0x40805e];return _0x2c3eca;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb43('0x1')],'unique':_0xbb43('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbb43('0x1')]},'dialPrefix':{'type':Sequelize[_0xbb43('0x1')]}}; \ No newline at end of file +var _0x6f72=['exports','STRING','name'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6f72,0xae));var _0x26f7=function(_0x475e3e,_0x5dc802){_0x475e3e=_0x475e3e-0x0;var _0x106a2f=_0x6f72[_0x475e3e];return _0x106a2f;};'use strict';var Sequelize=require('sequelize');module[_0x26f7('0x0')]={'name':{'type':Sequelize[_0x26f7('0x1')],'unique':_0x26f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x26f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 32b0796..7dc64a0 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 _0xa8c0=['info','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','json','undefined','offset','count','status','set','Content-Range','apply','save','then','destroy','get','Lists','end','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','params','describe','ListId','Disposition','getDispositions','findOne','order','filter','removeDispositions','ids','addContacts','CmContact','tags','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','concat','format','cf_%d','raw','getContacts','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents'];(function(_0xc2488,_0x5c5c57){var _0x419250=function(_0x4bf55e){while(--_0x4bf55e){_0xc2488['push'](_0xc2488['shift']());}};_0x419250(++_0x5c5c57);}(_0xa8c0,0x149));var _0x0a8c=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0xa8c0[_0x1a4a06];return _0x49ec08;};'use strict';var emlformat=require(_0x0a8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a8c('0x1'));var jsonpatch=require(_0x0a8c('0x2'));var rp=require(_0x0a8c('0x3'));var moment=require('moment');var BPromise=require(_0x0a8c('0x4'));var Mustache=require(_0x0a8c('0x5'));var util=require('util');var path=require(_0x0a8c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a8c('0x7'));var _=require(_0x0a8c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a8c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0a8c('0xa'));var querystring=require(_0x0a8c('0xb'));var Papa=require(_0x0a8c('0xc'));var Redis=require(_0x0a8c('0xd'));var authService=require(_0x0a8c('0xe'));var qs=require(_0x0a8c('0xf'));var as=require(_0x0a8c('0x10'));var hardwareService=require(_0x0a8c('0x11'));var logger=require(_0x0a8c('0x12'))(_0x0a8c('0x13'));var utils=require('../../config/utils');var config=require(_0x0a8c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a8c('0x15'))['db'];var csv_results;config[_0x0a8c('0x16')]=_[_0x0a8c('0x17')](config['redis'],{'host':_0x0a8c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a8c('0x16')]));require(_0x0a8c('0x19'))[_0x0a8c('0x1a')](socket);function respondWithStatusCode(_0x16b920,_0x2025f){_0x2025f=_0x2025f||0xcc;return function(_0x4eb47f){if(_0x4eb47f){return _0x16b920[_0x0a8c('0x1b')](_0x2025f);}return _0x16b920['status'](_0x2025f)['end']();};}function respondWithResult(_0x2016b1,_0x4aa1bb){_0x4aa1bb=_0x4aa1bb||0xc8;return function(_0x4d2f7e){if(_0x4d2f7e){return _0x2016b1['status'](_0x4aa1bb)[_0x0a8c('0x1c')](_0x4d2f7e);}};}function respondWithFilteredResult(_0x23faf4,_0x3f912a){return function(_0x227ada){if(_0x227ada){var _0x359e13=typeof _0x3f912a['offset']===_0x0a8c('0x1d')&&typeof _0x3f912a['limit']===_0x0a8c('0x1d');var _0x463df0=_0x227ada['count'];var _0x2965be=_0x359e13?0x0:_0x3f912a[_0x0a8c('0x1e')];var _0x2c55c2=_0x359e13?_0x227ada[_0x0a8c('0x1f')]:_0x3f912a[_0x0a8c('0x1e')]+_0x3f912a['limit'];var _0x35914b;if(_0x2c55c2>=_0x463df0){_0x2c55c2=_0x463df0;_0x35914b=0xc8;}else{_0x35914b=0xce;}_0x23faf4[_0x0a8c('0x20')](_0x35914b);return _0x23faf4[_0x0a8c('0x21')](_0x0a8c('0x22'),_0x2965be+'-'+_0x2c55c2+'/'+_0x463df0)[_0x0a8c('0x1c')](_0x227ada);}return null;};}function patchUpdates(_0x42c41d){return function(_0x3f5b44){try{jsonpatch[_0x0a8c('0x23')](_0x3f5b44,_0x42c41d,!![]);}catch(_0x47270f){return BPromise['reject'](_0x47270f);}return _0x3f5b44[_0x0a8c('0x24')]();};}function saveUpdates(_0x2ec7fd,_0x7edcc7){return function(_0x39d1df){if(_0x39d1df){return _0x39d1df['update'](_0x2ec7fd)[_0x0a8c('0x25')](function(_0x38a6c9){return _0x38a6c9;});}return null;};}function removeEntity(_0x49e34d,_0x4e91d2){return function(_0x411d6d){if(_0x411d6d){return _0x411d6d[_0x0a8c('0x26')]()['then'](function(){var _0x4e2db4=_0x411d6d[_0x0a8c('0x27')]({'plain':!![]});var _0x54b5f8=_0x0a8c('0x28');return db['UserProfileResource'][_0x0a8c('0x26')]({'where':{'type':_0x54b5f8,'resourceId':_0x4e2db4['id']}})['then'](function(){return _0x411d6d;});})[_0x0a8c('0x25')](function(){_0x49e34d[_0x0a8c('0x20')](0xcc)[_0x0a8c('0x29')]();});}};}function handleEntityNotFound(_0xf35e83,_0x3e9693){return function(_0x1b5c1a){if(!_0x1b5c1a){_0xf35e83[_0x0a8c('0x1b')](0x194);}return _0x1b5c1a;};}function handleError(_0x1997b2,_0x12fd0f){_0x12fd0f=_0x12fd0f||0x1f4;return function(_0x5bae13){logger['error'](_0x5bae13['stack']);if(_0x5bae13[_0x0a8c('0x2a')]){delete _0x5bae13[_0x0a8c('0x2a')];}_0x1997b2[_0x0a8c('0x20')](_0x12fd0f)[_0x0a8c('0x2b')](_0x5bae13);};}exports[_0x0a8c('0x2c')]=function(_0x426c74,_0x38cdda){var _0x40de1c={},_0xf05822={},_0x4548e8={'count':0x0,'rows':[]};var _0x54846f=_[_0x0a8c('0x2d')](db[_0x0a8c('0x2e')][_0x0a8c('0x2f')],function(_0x122d33){return{'name':_0x122d33[_0x0a8c('0x30')],'type':_0x122d33[_0x0a8c('0x31')][_0x0a8c('0x32')]};});_0xf05822['model']=_[_0x0a8c('0x2d')](_0x54846f,'name');_0xf05822[_0x0a8c('0x33')]=_[_0x0a8c('0x34')](_0x426c74[_0x0a8c('0x33')]);_0xf05822['filters']=_[_0x0a8c('0x35')](_0xf05822[_0x0a8c('0x36')],_0xf05822[_0x0a8c('0x33')]);_0x40de1c[_0x0a8c('0x37')]=_[_0x0a8c('0x35')](_0xf05822[_0x0a8c('0x36')],qs[_0x0a8c('0x38')](_0x426c74[_0x0a8c('0x33')][_0x0a8c('0x38')]));_0x40de1c[_0x0a8c('0x37')]=_0x40de1c[_0x0a8c('0x37')]['length']?_0x40de1c['attributes']:_0xf05822[_0x0a8c('0x36')];if(!_0x426c74[_0x0a8c('0x33')][_0x0a8c('0x39')](_0x0a8c('0x3a'))){_0x40de1c[_0x0a8c('0x3b')]=qs[_0x0a8c('0x3b')](_0x426c74['query'][_0x0a8c('0x3b')]);_0x40de1c[_0x0a8c('0x1e')]=qs[_0x0a8c('0x1e')](_0x426c74[_0x0a8c('0x33')][_0x0a8c('0x1e')]);}_0x40de1c['order']=qs['sort'](_0x426c74['query'][_0x0a8c('0x3c')]);_0x40de1c['where']=qs[_0x0a8c('0x3d')](_[_0x0a8c('0x3e')](_0x426c74[_0x0a8c('0x33')],_0xf05822[_0x0a8c('0x3d')]),_0x54846f);if(_0x426c74['query']['filter']){_0x40de1c[_0x0a8c('0x3f')]=_[_0x0a8c('0x40')](_0x40de1c['where'],{'$or':_[_0x0a8c('0x2d')](_0x54846f,function(_0x275d58){if(_0x275d58[_0x0a8c('0x31')]!==_0x0a8c('0x41')){var _0xe3f0bc={};_0xe3f0bc[_0x275d58[_0x0a8c('0x2a')]]={'$like':'%'+_0x426c74['query']['filter']+'%'};return _0xe3f0bc;}})});}_0x40de1c=_['merge']({},_0x40de1c,_0x426c74[_0x0a8c('0x42')]);var _0x237f30={'where':_0x40de1c[_0x0a8c('0x3f')]};return db[_0x0a8c('0x2e')][_0x0a8c('0x1f')](_0x237f30)[_0x0a8c('0x25')](function(_0x4e92dc){_0x4548e8['count']=_0x4e92dc;if(_0x426c74[_0x0a8c('0x33')][_0x0a8c('0x43')]){_0x40de1c['include']=[{'all':!![]}];}return db['CmList'][_0x0a8c('0x44')](_0x40de1c);})['then'](function(_0x1df6c9){_0x4548e8[_0x0a8c('0x45')]=_0x1df6c9;return _0x4548e8;})[_0x0a8c('0x25')](respondWithFilteredResult(_0x38cdda,_0x40de1c))[_0x0a8c('0x46')](handleError(_0x38cdda,null));};exports[_0x0a8c('0x47')]=function(_0x2f400b,_0x552dad){var _0xa57270={'raw':![],'where':{'id':_0x2f400b['params']['id']}},_0x3f7055={};_0x3f7055['model']=_[_0x0a8c('0x34')](db[_0x0a8c('0x2e')][_0x0a8c('0x2f')]);_0x3f7055[_0x0a8c('0x33')]=_[_0x0a8c('0x34')](_0x2f400b['query']);_0x3f7055['filters']=_[_0x0a8c('0x35')](_0x3f7055[_0x0a8c('0x36')],_0x3f7055['query']);_0xa57270[_0x0a8c('0x37')]=_[_0x0a8c('0x35')](_0x3f7055['model'],qs['fields'](_0x2f400b['query'][_0x0a8c('0x38')]));_0xa57270[_0x0a8c('0x37')]=_0xa57270[_0x0a8c('0x37')][_0x0a8c('0x48')]?_0xa57270[_0x0a8c('0x37')]:_0x3f7055[_0x0a8c('0x36')];if(_0x2f400b[_0x0a8c('0x33')][_0x0a8c('0x43')]){_0xa57270[_0x0a8c('0x49')]=[{'all':!![]}];}_0xa57270=_[_0x0a8c('0x40')]({},_0xa57270,_0x2f400b['options']);return db['CmList'][_0x0a8c('0x4a')](_0xa57270)[_0x0a8c('0x25')](handleEntityNotFound(_0x552dad,null))[_0x0a8c('0x25')](respondWithResult(_0x552dad,null))[_0x0a8c('0x46')](handleError(_0x552dad,null));};exports[_0x0a8c('0x4b')]=function(_0x482285,_0x5cdb37){return db[_0x0a8c('0x2e')][_0x0a8c('0x4b')](_0x482285[_0x0a8c('0x4c')],{})['then'](function(_0x1af319){var _0x2b8922=_0x482285[_0x0a8c('0x4d')][_0x0a8c('0x27')]({'plain':!![]});if(!_0x2b8922)throw new Error(_0x0a8c('0x4e'));if(_0x2b8922['role']===_0x0a8c('0x4d')){var _0x145d57=_0x1af319['get']({'plain':!![]});var _0x40a8d1='Lists';return db[_0x0a8c('0x4f')][_0x0a8c('0x4a')]({'where':{'name':_0x40a8d1,'userProfileId':_0x2b8922[_0x0a8c('0x50')]},'raw':!![]})[_0x0a8c('0x25')](function(_0x25125c){if(_0x25125c&&_0x25125c[_0x0a8c('0x51')]===0x0){return db[_0x0a8c('0x52')][_0x0a8c('0x4b')]({'name':_0x145d57[_0x0a8c('0x2a')],'resourceId':_0x145d57['id'],'type':_0x25125c[_0x0a8c('0x2a')],'sectionId':_0x25125c['id']},{})['then'](function(){return _0x1af319;});}else{return _0x1af319;}})['catch'](function(_0x279802){logger[_0x0a8c('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x279802);throw _0x279802;});}return _0x1af319;})['then'](respondWithResult(_0x5cdb37,0xc9))[_0x0a8c('0x46')](handleError(_0x5cdb37,null));};exports[_0x0a8c('0x54')]=function(_0x51d7c2,_0x37820c){if(_0x51d7c2[_0x0a8c('0x4c')]['id']){delete _0x51d7c2[_0x0a8c('0x4c')]['id'];}return db[_0x0a8c('0x2e')]['find']({'where':{'id':_0x51d7c2[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x37820c,null))[_0x0a8c('0x25')](saveUpdates(_0x51d7c2[_0x0a8c('0x4c')],null))[_0x0a8c('0x25')](respondWithResult(_0x37820c,null))[_0x0a8c('0x46')](handleError(_0x37820c,null));};exports[_0x0a8c('0x26')]=function(_0x15c6be,_0x5946f7){return db[_0x0a8c('0x2e')][_0x0a8c('0x4a')]({'where':{'id':_0x15c6be[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x5946f7,null))['then'](removeEntity(_0x5946f7,null))[_0x0a8c('0x46')](handleError(_0x5946f7,null));};exports[_0x0a8c('0x56')]=function(_0x2c96da,_0x3d0eac){return db[_0x0a8c('0x2e')][_0x0a8c('0x56')]()[_0x0a8c('0x25')](respondWithResult(_0x3d0eac,null))[_0x0a8c('0x46')](handleError(_0x3d0eac,null));};exports['addDisposition']=function(_0x160dac,_0x4511bb,_0x6d723e){if(_0x160dac[_0x0a8c('0x4c')]['id']){delete _0x160dac[_0x0a8c('0x4c')]['id'];}return db[_0x0a8c('0x2e')]['find']({'where':{'id':_0x160dac[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x4511bb,null))[_0x0a8c('0x25')](function(_0x19bff3){if(_0x19bff3){_0x160dac[_0x0a8c('0x4c')][_0x0a8c('0x57')]=_0x19bff3['id'];return db[_0x0a8c('0x58')]['create'](_0x160dac[_0x0a8c('0x4c')]);}})[_0x0a8c('0x25')](respondWithResult(_0x4511bb,null))[_0x0a8c('0x46')](handleError(_0x4511bb,null));};exports[_0x0a8c('0x59')]=function(_0x9362bd,_0x455898,_0x17b737){var _0x5bff92={'raw':![],'where':{}};var _0x4139c7={};var _0x41ceef={'count':0x0,'rows':[]};return db[_0x0a8c('0x2e')][_0x0a8c('0x5a')]({'where':{'id':_0x9362bd[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x455898,null))[_0x0a8c('0x25')](function(_0x4e4332){if(_0x4e4332){_0x4139c7[_0x0a8c('0x36')]=_['keys'](db['Disposition'][_0x0a8c('0x2f')]);_0x4139c7['query']=_[_0x0a8c('0x34')](_0x9362bd['query']);_0x4139c7[_0x0a8c('0x3d')]=_['intersection'](_0x4139c7[_0x0a8c('0x36')],_0x4139c7['query']);_0x5bff92['attributes']=_[_0x0a8c('0x35')](_0x4139c7['model'],qs[_0x0a8c('0x38')](_0x9362bd['query']['fields']));_0x5bff92['attributes']=_0x5bff92[_0x0a8c('0x37')][_0x0a8c('0x48')]?_0x5bff92[_0x0a8c('0x37')]:_0x4139c7[_0x0a8c('0x36')];if(!_0x9362bd[_0x0a8c('0x33')]['hasOwnProperty'](_0x0a8c('0x3a'))){_0x5bff92[_0x0a8c('0x3b')]=qs['limit'](_0x9362bd[_0x0a8c('0x33')][_0x0a8c('0x3b')]);_0x5bff92['offset']=qs[_0x0a8c('0x1e')](_0x9362bd['query']['offset']);}_0x5bff92[_0x0a8c('0x5b')]=qs[_0x0a8c('0x3c')](_0x9362bd[_0x0a8c('0x33')][_0x0a8c('0x3c')]);_0x5bff92[_0x0a8c('0x3f')]=qs[_0x0a8c('0x3d')](_['pick'](_0x9362bd[_0x0a8c('0x33')],_0x4139c7[_0x0a8c('0x3d')]));_0x5bff92[_0x0a8c('0x3f')][_0x0a8c('0x57')]=_0x4e4332['id'];if(_0x9362bd['query']['filter']){_0x5bff92[_0x0a8c('0x3f')]=_[_0x0a8c('0x40')](_0x5bff92[_0x0a8c('0x3f')],{'$or':_[_0x0a8c('0x2d')](_0x5bff92['attributes'],function(_0x9e0f0b){var _0x249af8={};_0x249af8[_0x9e0f0b]={'$like':'%'+_0x9362bd[_0x0a8c('0x33')][_0x0a8c('0x5c')]+'%'};return _0x249af8;})});}_0x5bff92=_[_0x0a8c('0x40')]({},_0x5bff92,_0x9362bd[_0x0a8c('0x42')]);return db[_0x0a8c('0x58')][_0x0a8c('0x1f')]({'where':_0x5bff92['where']})['then'](function(_0x2c9aae){_0x41ceef['count']=_0x2c9aae;if(_0x9362bd[_0x0a8c('0x33')][_0x0a8c('0x43')]){_0x5bff92[_0x0a8c('0x49')]=[{'all':!![]}];}return db[_0x0a8c('0x58')][_0x0a8c('0x44')](_0x5bff92);})[_0x0a8c('0x25')](function(_0x4c1d5f){_0x41ceef['rows']=_0x4c1d5f;return _0x41ceef;});}})['then'](respondWithFilteredResult(_0x455898,_0x5bff92))[_0x0a8c('0x46')](handleError(_0x455898,null));};exports[_0x0a8c('0x5d')]=function(_0x573b6a,_0x1b7e77,_0x3eaa3d){return db[_0x0a8c('0x2e')]['find']({'where':{'id':_0x573b6a[_0x0a8c('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b7e77,null))[_0x0a8c('0x25')](function(_0x34128e){if(_0x34128e){return _0x34128e['removeDispositions'](_0x573b6a['query'][_0x0a8c('0x5e')]);}})[_0x0a8c('0x25')](respondWithStatusCode(_0x1b7e77,null))[_0x0a8c('0x46')](handleError(_0x1b7e77,null));};exports[_0x0a8c('0x5f')]=function(_0x3b8a87,_0x460008,_0x286d40){return db[_0x0a8c('0x2e')][_0x0a8c('0x4a')]({'where':{'id':_0x3b8a87[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x460008,null))[_0x0a8c('0x25')](function(_0x1d5c8b){if(_0x1d5c8b){var _0x8fefbc=[];var _0x5219f1={'success':[],'errors':[]};return db[_0x0a8c('0x60')][_0x0a8c('0x56')]()['then'](function(_0x3c3c6d){if(_0x3b8a87[_0x0a8c('0x4c')][_0x0a8c('0x61')]&&_['isArray'](_0x3b8a87[_0x0a8c('0x4c')]['tags'])){if(_0x3b8a87[_0x0a8c('0x4c')][_0x0a8c('0x61')][_0x0a8c('0x48')]){_0x3b8a87[_0x0a8c('0x4c')][_0x0a8c('0x61')]=_0x3b8a87[_0x0a8c('0x4c')][_0x0a8c('0x61')]['join'](';')+';';}else{_0x3b8a87[_0x0a8c('0x4c')]['tags']=null;}}else{_0x3b8a87[_0x0a8c('0x4c')][_0x0a8c('0x61')]=null;}if(_0x3b8a87[_0x0a8c('0x4c')]&&_['isArray'](_0x3b8a87['body'])){for(var _0x57a96a=0x0;_0x57a96a<_0x3b8a87[_0x0a8c('0x4c')][_0x0a8c('0x48')];_0x57a96a+=0x1){_0x3b8a87['body'][_0x57a96a][_0x0a8c('0x57')]=_0x3b8a87[_0x0a8c('0x55')]['id'];_0x8fefbc[_0x0a8c('0x62')](_0x3b8a87[_0x0a8c('0x4c')][_0x57a96a]);}return BPromise[_0x0a8c('0x63')](_0x8fefbc,function(_0x4de2df){return db[_0x0a8c('0x60')][_0x0a8c('0x4b')](_[_0x0a8c('0x64')](_0x4de2df,[_0x0a8c('0x5e'),'id'])||{},{'fields':_[_0x0a8c('0x34')](_0x3c3c6d),'raw':!![]})['then'](function(_0x1218cc){_0x5219f1[_0x0a8c('0x65')][_0x0a8c('0x62')](_0x1218cc[_0x0a8c('0x66')]);})[_0x0a8c('0x46')](function(_0x3da9bd){_0x5219f1['errors'][_0x0a8c('0x62')]({'data':_0x4de2df,'error':_0x3da9bd[_0x0a8c('0x67')]});});})['then'](function(_0x25dc21){return _0x5219f1;})['catch'](function(_0x4bfbf5){return _0x4bfbf5;});}else{_0x460008[_0x0a8c('0x20')](0x190)[_0x0a8c('0x1c')]({'message':_0x0a8c('0x68')});}});}})[_0x0a8c('0x25')](respondWithResult(_0x460008,null))['catch'](handleError(_0x460008,null));};exports['getContacts']=function(_0x44f92c,_0x4a3113,_0x3574fb){var _0x470c0a;return db['CmList'][_0x0a8c('0x4a')]({'where':{'id':_0x44f92c[_0x0a8c('0x55')]['id']},'include':[{'model':db[_0x0a8c('0x69')],'as':'CustomFields'}]})[_0x0a8c('0x25')](handleEntityNotFound(_0x4a3113,null))[_0x0a8c('0x25')](function(_0x211099){if(_0x211099){_0x470c0a=_0x211099;return db['CmContact'][_0x0a8c('0x2f')];}})['then'](function(_0xe9a2fc){if(_0xe9a2fc){var _0x1efc9f={};var _0x53ec3f={};_0x53ec3f[_0x0a8c('0x36')]=_[_0x0a8c('0x6a')](_[_0x0a8c('0x34')](_0xe9a2fc),_[_0x0a8c('0x2d')](_0x470c0a['CustomFields'],function(_0x307775){return util[_0x0a8c('0x6b')](_0x0a8c('0x6c'),_0x307775['id']);}));_0x53ec3f['query']=_['keys'](_0x44f92c['query']);_0x53ec3f['filters']=_[_0x0a8c('0x35')](_0x53ec3f[_0x0a8c('0x36')],_0x53ec3f[_0x0a8c('0x33')]);_0x1efc9f['attributes']=_[_0x0a8c('0x35')](_0x53ec3f[_0x0a8c('0x36')],qs[_0x0a8c('0x38')](_0x44f92c[_0x0a8c('0x33')][_0x0a8c('0x38')]));_0x1efc9f[_0x0a8c('0x37')]=_0x1efc9f[_0x0a8c('0x37')]['length']?_0x1efc9f[_0x0a8c('0x37')]:_0x53ec3f['model'];if(!_0x44f92c['query']['hasOwnProperty'](_0x0a8c('0x3a'))){_0x1efc9f['limit']=qs['limit'](_0x44f92c[_0x0a8c('0x33')]['limit']);_0x1efc9f[_0x0a8c('0x1e')]=qs[_0x0a8c('0x1e')](_0x44f92c['query']['offset']);}_0x1efc9f[_0x0a8c('0x5b')]=qs[_0x0a8c('0x3c')](_0x44f92c[_0x0a8c('0x33')][_0x0a8c('0x3c')]);_0x1efc9f['where']=qs[_0x0a8c('0x3d')](_['pick'](_0x44f92c[_0x0a8c('0x33')],_0x53ec3f['filters']));_0x1efc9f[_0x0a8c('0x6d')]=!![];if(_0x44f92c[_0x0a8c('0x33')][_0x0a8c('0x5c')]){_0x1efc9f[_0x0a8c('0x3f')]=_[_0x0a8c('0x40')](_0x1efc9f[_0x0a8c('0x3f')],{'$or':_['map'](_0x1efc9f[_0x0a8c('0x37')],function(_0x239523){var _0x1838a3={};_0x1838a3[_0x239523]={'$like':'%'+_0x44f92c['query'][_0x0a8c('0x5c')]+'%'};return _0x1838a3;})});}_0x1efc9f=_[_0x0a8c('0x40')]({},_0x1efc9f,_0x44f92c['options']);return _0x470c0a[_0x0a8c('0x6e')](_0x1efc9f);}})[_0x0a8c('0x25')](respondWithResult(_0x4a3113,null))['catch'](handleError(_0x4a3113,null));};exports[_0x0a8c('0x6f')]=function(_0x4e080b,_0x22e651,_0x40f478){var _0x7cefb7;var _0x3c14e7;var _0x185186;var _0x59d3f3=_0x4e080b[_0x0a8c('0x55')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x0a8c('0x2a')],'raw':!![],'order':[_0x0a8c('0x70')]})[_0x0a8c('0x25')](function(_0x99bfec){_0x7cefb7=_0x99bfec;var _0x103f30=_[_0x0a8c('0x34')](db[_0x0a8c('0x60')][_0x0a8c('0x2f')]);return db['CmCustomField'][_0x0a8c('0x44')]({'raw':!![],'attributes':['id',_0x0a8c('0x71')]})[_0x0a8c('0x25')](function(_0x30e831){_0x3c14e7=_0x30e831;var _0x4e1f5d=squel[_0x0a8c('0x72')]()['fields'](_0x103f30)[_0x0a8c('0x73')](_0x0a8c('0x74'),'c')['where'](_0x0a8c('0x75'),_0x59d3f3)['where'](_0x0a8c('0x76'))[_0x0a8c('0x77')]();for(var _0x84d813=0x0;_0x84d813<_0x3c14e7[_0x0a8c('0x48')];_0x84d813++){_0x4e1f5d[_0x0a8c('0x78')](_0x0a8c('0x79')+_0x3c14e7[_0x84d813]['id'],'customField_'+_0x3c14e7[_0x84d813][_0x0a8c('0x71')]);}for(var _0x84d813=0x0;_0x84d813<_0x7cefb7[_0x0a8c('0x48')];_0x84d813++){_0x4e1f5d[_0x0a8c('0x78')](squel[_0x0a8c('0x72')]()[_0x0a8c('0x78')](_0x0a8c('0x7a'))[_0x0a8c('0x73')](_0x0a8c('0x7b'))['where'](_0x0a8c('0x7c'),_0x7cefb7[_0x84d813]['id'])[_0x0a8c('0x3f')](_0x0a8c('0x7d')),_0x0a8c('0x7e')+_0x7cefb7[_0x84d813]['name']);_0x4e1f5d[_0x0a8c('0x78')](squel[_0x0a8c('0x72')]()['field'](_0x0a8c('0x7f'))[_0x0a8c('0x73')]('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x7cefb7[_0x84d813]['id'])[_0x0a8c('0x3f')](_0x0a8c('0x7d')),'description_additionalPhone_'+_0x7cefb7[_0x84d813][_0x0a8c('0x2a')]);}var _0xf816df=[];_0xf816df[_0x0a8c('0x62')](_0x4e1f5d[_0x0a8c('0x80')]());BPromise[_0x0a8c('0x63')](_0xf816df,handleQuery)[_0x0a8c('0x25')](function(_0x3ed040){handleQuery(_0x4e1f5d[_0x0a8c('0x80')]());var _0x46ee4b=csv_results[0x0];if(!_[_0x0a8c('0x81')](_0x46ee4b)){var _0x4dac06=toCsv(_0x46ee4b);var _0x3e458e=Date[_0x0a8c('0x82')]();fs[_0x0a8c('0x83')](util['format'](_0x0a8c('0x84'),_0x59d3f3,_0x3e458e),_0x4dac06);_0x22e651['setHeader'](_0x0a8c('0x85'),_0x0a8c('0x86')+util['format'](_0x0a8c('0x87'),_0x59d3f3,_0x3e458e));_0x22e651[_0x0a8c('0x88')](_0x0a8c('0x89'),_0x0a8c('0x8a'));return _0x22e651['download'](util[_0x0a8c('0x6b')]('/tmp/list_%d_%s.csv',_0x59d3f3,_0x3e458e));}else{return _0x22e651[_0x0a8c('0x1b')](0xcc);}});});});};exports[_0x0a8c('0x8b')]=function(_0x1bfa7a,_0x1b5827,_0x101565){var _0x541b15;delete _0x1bfa7a[_0x0a8c('0x4c')]['id'];return db[_0x0a8c('0x2e')]['findOne']({'where':{'id':_0x1bfa7a[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x1b5827,null))[_0x0a8c('0x25')](function(_0x58a859){if(_0x58a859){return db[_0x0a8c('0x8c')][_0x0a8c('0x8d')](function(_0x4b7560){return db[_0x0a8c('0x69')]['create'](_0x1bfa7a['body'],{'transaction':_0x4b7560})[_0x0a8c('0x25')](function(_0x592c1e){_0x541b15=_0x592c1e;return _0x58a859[_0x0a8c('0x8e')](_0x592c1e,{'transaction':_0x4b7560});})['then'](function(){var _0x153817={'type':db[_0x0a8c('0x8f')][_0x0a8c('0x90')],'transaction':_0x4b7560};switch(_0x1bfa7a[_0x0a8c('0x4c')][_0x0a8c('0x31')]){case'text':_0x153817['type']=db[_0x0a8c('0x8f')]['TEXT'];break;case _0x0a8c('0x91'):_0x153817[_0x0a8c('0x31')]=db[_0x0a8c('0x8f')][_0x0a8c('0x92')];break;case _0x0a8c('0x93'):_0x153817[_0x0a8c('0x31')]=db[_0x0a8c('0x8f')][_0x0a8c('0x94')];_0x153817[_0x0a8c('0x95')]=![];break;default:}return db['sequelize'][_0x0a8c('0x96')]['addColumn'](_0x0a8c('0x74'),util[_0x0a8c('0x6b')](_0x0a8c('0x97'),_0x541b15['id']),_0x153817);})[_0x0a8c('0x25')](function(){return _0x541b15;});});}})[_0x0a8c('0x25')](respondWithResult(_0x1b5827,null))[_0x0a8c('0x46')](handleError(_0x1b5827,null));};exports[_0x0a8c('0x98')]=function(_0x4d3bb6,_0x363688,_0x29eddc){var _0x51ab34={};var _0x36dda7={};var _0x1d4e00;var _0x1c3d2d;return db['CmList'][_0x0a8c('0x5a')]({'where':{'id':_0x4d3bb6[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x363688,null))[_0x0a8c('0x25')](function(_0x187d7e){if(_0x187d7e){_0x1d4e00=_0x187d7e;_0x36dda7[_0x0a8c('0x36')]=_[_0x0a8c('0x34')](db[_0x0a8c('0x69')][_0x0a8c('0x2f')]);_0x36dda7['query']=_[_0x0a8c('0x34')](_0x4d3bb6[_0x0a8c('0x33')]);_0x36dda7[_0x0a8c('0x3d')]=_[_0x0a8c('0x35')](_0x36dda7[_0x0a8c('0x36')],_0x36dda7[_0x0a8c('0x33')]);_0x51ab34[_0x0a8c('0x37')]=_['intersection'](_0x36dda7['model'],qs['fields'](_0x4d3bb6[_0x0a8c('0x33')][_0x0a8c('0x38')]));_0x51ab34[_0x0a8c('0x37')]=_0x51ab34[_0x0a8c('0x37')]['length']?_0x51ab34[_0x0a8c('0x37')]:_0x36dda7[_0x0a8c('0x36')];_0x51ab34[_0x0a8c('0x5b')]=qs['sort'](_0x4d3bb6[_0x0a8c('0x33')]['sort']);_0x51ab34['where']=qs[_0x0a8c('0x3d')](_[_0x0a8c('0x3e')](_0x4d3bb6[_0x0a8c('0x33')],_0x36dda7[_0x0a8c('0x3d')]));_0x51ab34[_0x0a8c('0x3f')]=_[_0x0a8c('0x40')](_0x51ab34['where'],{'$or':[{'ListId':_0x187d7e['id']},{'ListId':null}]});if(_0x4d3bb6[_0x0a8c('0x33')][_0x0a8c('0x5c')]){_0x51ab34[_0x0a8c('0x3f')]=_[_0x0a8c('0x40')](_0x51ab34[_0x0a8c('0x3f')],{'$or':_[_0x0a8c('0x2d')](_0x51ab34[_0x0a8c('0x37')],function(_0xa7f2ad){var _0x5f2b41={};_0x5f2b41[_0xa7f2ad]={'$like':'%'+_0x4d3bb6['query']['filter']+'%'};return _0x5f2b41;})});}_0x51ab34=_[_0x0a8c('0x40')]({},_0x51ab34,_0x4d3bb6[_0x0a8c('0x42')]);return db[_0x0a8c('0x69')][_0x0a8c('0x99')](_0x51ab34);}})[_0x0a8c('0x25')](respondWithResult(_0x363688,null))['catch'](handleError(_0x363688,null));};exports[_0x0a8c('0x9a')]=function(_0x1d7e5e,_0x637036){return db[_0x0a8c('0x69')]['findAndCountAll']({'where':{'ListId':null}})[_0x0a8c('0x25')](handleEntityNotFound(_0x637036,null))[_0x0a8c('0x25')](function(_0x363cb5){return _0x363cb5;})[_0x0a8c('0x25')](respondWithResult(_0x637036,null))[_0x0a8c('0x46')](handleError(_0x637036,null));};exports[_0x0a8c('0x9b')]=function(_0x547d55,_0x357259,_0x237121){return db[_0x0a8c('0x2e')]['find']({'where':{'id':_0x547d55[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x357259,null))[_0x0a8c('0x25')](function(_0x138c51){if(_0x138c51){return _0x138c51[_0x0a8c('0x9b')](_0x547d55[_0x0a8c('0x4c')][_0x0a8c('0x5e')],_[_0x0a8c('0x64')](_0x547d55[_0x0a8c('0x4c')],['ids','id'])||{})[_0x0a8c('0x9c')](function(_0x5335f8){for(var _0x401387=0x0;_0x401387<_0x547d55[_0x0a8c('0x4c')][_0x0a8c('0x5e')][_0x0a8c('0x48')];_0x401387+=0x1){socket[_0x0a8c('0x9d')](_0x0a8c('0x9e'),{'UserId':Number(_0x547d55[_0x0a8c('0x4c')][_0x0a8c('0x5e')][_0x401387]),'CmListId':Number(_0x547d55['params']['id'])});}return _0x5335f8;});}})[_0x0a8c('0x25')](respondWithResult(_0x357259,null))[_0x0a8c('0x46')](handleError(_0x357259,null));};exports[_0x0a8c('0x9f')]=function(_0x5764b0,_0x2fff35,_0x52f16f){return db['CmList'][_0x0a8c('0x4a')]({'where':{'id':_0x5764b0[_0x0a8c('0x55')]['id']}})[_0x0a8c('0x25')](handleEntityNotFound(_0x2fff35,null))['then'](function(_0x3eeb59){if(_0x3eeb59){return _0x3eeb59[_0x0a8c('0x9f')](_0x5764b0[_0x0a8c('0x33')][_0x0a8c('0x5e')])[_0x0a8c('0x25')](function(){if(_[_0x0a8c('0xa0')](_0x5764b0['query'][_0x0a8c('0x5e')])){for(var _0x5a077b=0x0;_0x5a077b<_0x5764b0[_0x0a8c('0x33')][_0x0a8c('0x5e')]['length'];_0x5a077b+=0x1){socket[_0x0a8c('0x9d')](_0x0a8c('0xa1'),{'UserId':Number(_0x5764b0[_0x0a8c('0x33')][_0x0a8c('0x5e')][_0x5a077b]),'CmListId':Number(_0x5764b0[_0x0a8c('0x55')]['id'])});}}else{socket[_0x0a8c('0x9d')](_0x0a8c('0xa1'),{'UserId':Number(_0x5764b0[_0x0a8c('0x33')][_0x0a8c('0x5e')]),'CmListId':Number(_0x5764b0[_0x0a8c('0x55')]['id'])});}});}})[_0x0a8c('0x25')](respondWithStatusCode(_0x2fff35,null))[_0x0a8c('0x46')](handleError(_0x2fff35,null));};exports[_0x0a8c('0xa2')]=function(_0x32f704,_0x2fa317,_0xb63708){var _0x28e791={};var _0x190140={};var _0x108d3c;var _0x39faf4;return db['CmList'][_0x0a8c('0x5a')]({'where':{'id':_0x32f704[_0x0a8c('0x55')]['id']}})['then'](handleEntityNotFound(_0x2fa317,null))['then'](function(_0x223dba){if(_0x223dba){_0x108d3c=_0x223dba;_0x190140[_0x0a8c('0x36')]=_[_0x0a8c('0x34')](db['User'][_0x0a8c('0x2f')]);_0x190140[_0x0a8c('0x33')]=_[_0x0a8c('0x34')](_0x32f704[_0x0a8c('0x33')]);_0x190140['filters']=_['intersection'](_0x190140[_0x0a8c('0x36')],_0x190140['query']);_0x28e791[_0x0a8c('0x37')]=_[_0x0a8c('0x35')](_0x190140[_0x0a8c('0x36')],qs[_0x0a8c('0x38')](_0x32f704['query'][_0x0a8c('0x38')]));_0x28e791[_0x0a8c('0x37')]=_0x28e791[_0x0a8c('0x37')][_0x0a8c('0x48')]?_0x28e791[_0x0a8c('0x37')]:_0x190140[_0x0a8c('0x36')];_0x28e791[_0x0a8c('0x5b')]=qs['sort'](_0x32f704['query'][_0x0a8c('0x3c')]);_0x28e791[_0x0a8c('0x3f')]=qs['filters'](_[_0x0a8c('0x3e')](_0x32f704['query'],_0x190140[_0x0a8c('0x3d')]));if(_0x32f704[_0x0a8c('0x33')][_0x0a8c('0x5c')]){_0x28e791[_0x0a8c('0x3f')]=_[_0x0a8c('0x40')](_0x28e791[_0x0a8c('0x3f')],{'$or':_['map'](_0x28e791[_0x0a8c('0x37')],function(_0x4565cd){var _0x41f519={};_0x41f519[_0x4565cd]={'$like':'%'+_0x32f704[_0x0a8c('0x33')][_0x0a8c('0x5c')]+'%'};return _0x41f519;})});}_0x28e791=_[_0x0a8c('0x40')]({},_0x28e791,_0x32f704[_0x0a8c('0x42')]);return _0x108d3c[_0x0a8c('0xa2')](_0x28e791);}})['then'](function(_0x295c35){if(_0x295c35){_0x39faf4=_0x295c35['length'];if(!_0x32f704[_0x0a8c('0x33')][_0x0a8c('0x39')](_0x0a8c('0x3a'))){_0x28e791[_0x0a8c('0x3b')]=qs[_0x0a8c('0x3b')](_0x32f704['query'][_0x0a8c('0x3b')]);_0x28e791[_0x0a8c('0x1e')]=qs[_0x0a8c('0x1e')](_0x32f704[_0x0a8c('0x33')][_0x0a8c('0x1e')]);}return _0x108d3c[_0x0a8c('0xa2')](_0x28e791);}})['then'](function(_0x48739e){if(_0x48739e){return _0x48739e?{'count':_0x39faf4,'rows':_0x48739e}:null;}})[_0x0a8c('0x25')](respondWithResult(_0x2fa317,null))[_0x0a8c('0x46')](handleError(_0x2fa317,null));};function handleQuery(_0x36050d){logger[_0x0a8c('0xa3')](_0x36050d);return db[_0x0a8c('0x8c')][_0x0a8c('0x33')](_0x36050d)[_0x0a8c('0x9c')](function(_0x57c543){csv_results['push'](_0x57c543);})['catch'](function(_0xd1b505){logger[_0x0a8c('0x53')](_0xd1b505[_0x0a8c('0x67')]);});} \ No newline at end of file +var _0x15ae=['role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','getDispositions','Disposition','includeAll','removeDispositions','ids','tags','isArray','CmContact','success','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','each','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','removeAgents','userCmList:remove','emit','getAgents','User','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmList','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','findAll','rows','catch','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x15ae,0xee));var _0xe15a=function(_0x38f107,_0x31de9e){_0x38f107=_0x38f107-0x0;var _0x245532=_0x15ae[_0x38f107];return _0x245532;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe15a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe15a('0x1'));var rp=require('request-promise');var moment=require(_0xe15a('0x2'));var BPromise=require(_0xe15a('0x3'));var Mustache=require(_0xe15a('0x4'));var util=require(_0xe15a('0x5'));var path=require(_0xe15a('0x6'));var sox=require(_0xe15a('0x7'));var csv=require(_0xe15a('0x8'));var ejs=require(_0xe15a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe15a('0xa'));var crypto=require(_0xe15a('0xb'));var jsforce=require(_0xe15a('0xc'));var deskjs=require(_0xe15a('0xd'));var toCsv=require(_0xe15a('0x8'));var querystring=require(_0xe15a('0xe'));var Papa=require(_0xe15a('0xf'));var Redis=require(_0xe15a('0x10'));var authService=require(_0xe15a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe15a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe15a('0x13'));var config=require(_0xe15a('0x14'));var licenseUtil=require(_0xe15a('0x15'));var db=require(_0xe15a('0x16'))['db'];var csv_results;config[_0xe15a('0x17')]=_[_0xe15a('0x18')](config[_0xe15a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xe15a('0x19'))(new Redis(config[_0xe15a('0x17')]));require('./cmList.socket')[_0xe15a('0x1a')](socket);function respondWithStatusCode(_0x1c211c,_0xd11d2b){_0xd11d2b=_0xd11d2b||0xcc;return function(_0x2e9821){if(_0x2e9821){return _0x1c211c[_0xe15a('0x1b')](_0xd11d2b);}return _0x1c211c[_0xe15a('0x1c')](_0xd11d2b)['end']();};}function respondWithResult(_0x1570f1,_0xc2d73d){_0xc2d73d=_0xc2d73d||0xc8;return function(_0x210512){if(_0x210512){return _0x1570f1[_0xe15a('0x1c')](_0xc2d73d)[_0xe15a('0x1d')](_0x210512);}};}function respondWithFilteredResult(_0x231c28,_0x2de9d8){return function(_0x451ccb){if(_0x451ccb){var _0x361c93=typeof _0x2de9d8[_0xe15a('0x1e')]==='undefined'&&typeof _0x2de9d8[_0xe15a('0x1f')]===_0xe15a('0x20');var _0xf21f7b=_0x451ccb[_0xe15a('0x21')];var _0x15fb11=_0x361c93?0x0:_0x2de9d8[_0xe15a('0x1e')];var _0x6cc2c2=_0x361c93?_0x451ccb[_0xe15a('0x21')]:_0x2de9d8[_0xe15a('0x1e')]+_0x2de9d8[_0xe15a('0x1f')];var _0x345eab;if(_0x6cc2c2>=_0xf21f7b){_0x6cc2c2=_0xf21f7b;_0x345eab=0xc8;}else{_0x345eab=0xce;}_0x231c28[_0xe15a('0x1c')](_0x345eab);return _0x231c28['set'](_0xe15a('0x22'),_0x15fb11+'-'+_0x6cc2c2+'/'+_0xf21f7b)['json'](_0x451ccb);}return null;};}function patchUpdates(_0x20882f){return function(_0x1258b9){try{jsonpatch[_0xe15a('0x23')](_0x1258b9,_0x20882f,!![]);}catch(_0x27f850){return BPromise[_0xe15a('0x24')](_0x27f850);}return _0x1258b9[_0xe15a('0x25')]();};}function saveUpdates(_0x1b7a7b,_0x5cc2d3){return function(_0x383898){if(_0x383898){return _0x383898[_0xe15a('0x26')](_0x1b7a7b)['then'](function(_0x15a79c){return _0x15a79c;});}return null;};}function removeEntity(_0x21eb78,_0x3f4e37){return function(_0x7bf895){if(_0x7bf895){return _0x7bf895['destroy']()[_0xe15a('0x27')](function(){var _0xdff421=_0x7bf895[_0xe15a('0x28')]({'plain':!![]});var _0x53c983=_0xe15a('0x29');return db[_0xe15a('0x2a')][_0xe15a('0x2b')]({'where':{'type':_0x53c983,'resourceId':_0xdff421['id']}})['then'](function(){return _0x7bf895;});})['then'](function(){_0x21eb78['status'](0xcc)[_0xe15a('0x2c')]();});}};}function handleEntityNotFound(_0xd5b59b,_0x154f19){return function(_0x16f935){if(!_0x16f935){_0xd5b59b['sendStatus'](0x194);}return _0x16f935;};}function handleError(_0x11d6aa,_0x47739f){_0x47739f=_0x47739f||0x1f4;return function(_0x5b951d){logger[_0xe15a('0x2d')](_0x5b951d[_0xe15a('0x2e')]);if(_0x5b951d[_0xe15a('0x2f')]){delete _0x5b951d['name'];}_0x11d6aa['status'](_0x47739f)[_0xe15a('0x30')](_0x5b951d);};}exports[_0xe15a('0x31')]=function(_0x333ed4,_0x3d2b57){var _0x1a9274={},_0x45ecef={},_0x508a44={'count':0x0,'rows':[]};var _0x182660=_[_0xe15a('0x32')](db[_0xe15a('0x33')]['rawAttributes'],function(_0x2c823f){return{'name':_0x2c823f[_0xe15a('0x34')],'type':_0x2c823f[_0xe15a('0x35')][_0xe15a('0x36')]};});_0x45ecef['model']=_[_0xe15a('0x32')](_0x182660,_0xe15a('0x2f'));_0x45ecef[_0xe15a('0x37')]=_['keys'](_0x333ed4[_0xe15a('0x37')]);_0x45ecef['filters']=_[_0xe15a('0x38')](_0x45ecef[_0xe15a('0x39')],_0x45ecef['query']);_0x1a9274[_0xe15a('0x3a')]=_[_0xe15a('0x38')](_0x45ecef[_0xe15a('0x39')],qs[_0xe15a('0x3b')](_0x333ed4[_0xe15a('0x37')][_0xe15a('0x3b')]));_0x1a9274[_0xe15a('0x3a')]=_0x1a9274[_0xe15a('0x3a')][_0xe15a('0x3c')]?_0x1a9274['attributes']:_0x45ecef[_0xe15a('0x39')];if(!_0x333ed4[_0xe15a('0x37')][_0xe15a('0x3d')](_0xe15a('0x3e'))){_0x1a9274[_0xe15a('0x1f')]=qs[_0xe15a('0x1f')](_0x333ed4[_0xe15a('0x37')]['limit']);_0x1a9274[_0xe15a('0x1e')]=qs[_0xe15a('0x1e')](_0x333ed4['query']['offset']);}_0x1a9274[_0xe15a('0x3f')]=qs[_0xe15a('0x40')](_0x333ed4['query'][_0xe15a('0x40')]);_0x1a9274[_0xe15a('0x41')]=qs['filters'](_[_0xe15a('0x42')](_0x333ed4[_0xe15a('0x37')],_0x45ecef[_0xe15a('0x43')]),_0x182660);if(_0x333ed4[_0xe15a('0x37')]['filter']){_0x1a9274[_0xe15a('0x41')]=_[_0xe15a('0x44')](_0x1a9274[_0xe15a('0x41')],{'$or':_['map'](_0x182660,function(_0x156e9c){if(_0x156e9c[_0xe15a('0x35')]!==_0xe15a('0x45')){var _0x255e1d={};_0x255e1d[_0x156e9c['name']]={'$like':'%'+_0x333ed4[_0xe15a('0x37')][_0xe15a('0x46')]+'%'};return _0x255e1d;}})});}_0x1a9274=_[_0xe15a('0x44')]({},_0x1a9274,_0x333ed4[_0xe15a('0x47')]);var _0x473047={'where':_0x1a9274[_0xe15a('0x41')]};return db['CmList'][_0xe15a('0x21')](_0x473047)[_0xe15a('0x27')](function(_0x3f85dc){_0x508a44[_0xe15a('0x21')]=_0x3f85dc;if(_0x333ed4[_0xe15a('0x37')]['includeAll']){_0x1a9274[_0xe15a('0x48')]=[{'all':!![]}];}return db['CmList'][_0xe15a('0x49')](_0x1a9274);})['then'](function(_0x4a8397){_0x508a44[_0xe15a('0x4a')]=_0x4a8397;return _0x508a44;})['then'](respondWithFilteredResult(_0x3d2b57,_0x1a9274))[_0xe15a('0x4b')](handleError(_0x3d2b57,null));};exports['show']=function(_0x109cc5,_0x2fd6eb){var _0x25af16={'raw':![],'where':{'id':_0x109cc5['params']['id']}},_0x1c7c1c={};_0x1c7c1c['model']=_[_0xe15a('0x4c')](db[_0xe15a('0x33')][_0xe15a('0x4d')]);_0x1c7c1c[_0xe15a('0x37')]=_[_0xe15a('0x4c')](_0x109cc5[_0xe15a('0x37')]);_0x1c7c1c['filters']=_[_0xe15a('0x38')](_0x1c7c1c[_0xe15a('0x39')],_0x1c7c1c[_0xe15a('0x37')]);_0x25af16['attributes']=_[_0xe15a('0x38')](_0x1c7c1c['model'],qs[_0xe15a('0x3b')](_0x109cc5[_0xe15a('0x37')][_0xe15a('0x3b')]));_0x25af16['attributes']=_0x25af16[_0xe15a('0x3a')][_0xe15a('0x3c')]?_0x25af16[_0xe15a('0x3a')]:_0x1c7c1c[_0xe15a('0x39')];if(_0x109cc5[_0xe15a('0x37')]['includeAll']){_0x25af16[_0xe15a('0x48')]=[{'all':!![]}];}_0x25af16=_['merge']({},_0x25af16,_0x109cc5['options']);return db['CmList'][_0xe15a('0x4e')](_0x25af16)[_0xe15a('0x27')](handleEntityNotFound(_0x2fd6eb,null))[_0xe15a('0x27')](respondWithResult(_0x2fd6eb,null))[_0xe15a('0x4b')](handleError(_0x2fd6eb,null));};exports['create']=function(_0x2e37cc,_0x27ffd4){return db[_0xe15a('0x33')][_0xe15a('0x4f')](_0x2e37cc[_0xe15a('0x50')],{})[_0xe15a('0x27')](function(_0x428c7c){var _0x19e26e=_0x2e37cc['user'][_0xe15a('0x28')]({'plain':!![]});if(!_0x19e26e)throw new Error(_0xe15a('0x51'));if(_0x19e26e[_0xe15a('0x52')]===_0xe15a('0x53')){var _0x508211=_0x428c7c[_0xe15a('0x28')]({'plain':!![]});var _0x37e699=_0xe15a('0x29');return db[_0xe15a('0x54')]['find']({'where':{'name':_0x37e699,'userProfileId':_0x19e26e['userProfileId']},'raw':!![]})[_0xe15a('0x27')](function(_0xd01897){if(_0xd01897&&_0xd01897['autoAssociation']===0x0){return db[_0xe15a('0x2a')][_0xe15a('0x4f')]({'name':_0x508211[_0xe15a('0x2f')],'resourceId':_0x508211['id'],'type':_0xd01897[_0xe15a('0x2f')],'sectionId':_0xd01897['id']},{})['then'](function(){return _0x428c7c;});}else{return _0x428c7c;}})[_0xe15a('0x4b')](function(_0x5e1f9a){logger['error'](_0xe15a('0x55'),_0x5e1f9a);throw _0x5e1f9a;});}return _0x428c7c;})['then'](respondWithResult(_0x27ffd4,0xc9))[_0xe15a('0x4b')](handleError(_0x27ffd4,null));};exports[_0xe15a('0x26')]=function(_0x24948c,_0xc18786){if(_0x24948c[_0xe15a('0x50')]['id']){delete _0x24948c[_0xe15a('0x50')]['id'];}return db[_0xe15a('0x33')][_0xe15a('0x4e')]({'where':{'id':_0x24948c[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0xc18786,null))[_0xe15a('0x27')](saveUpdates(_0x24948c[_0xe15a('0x50')],null))[_0xe15a('0x27')](respondWithResult(_0xc18786,null))['catch'](handleError(_0xc18786,null));};exports[_0xe15a('0x2b')]=function(_0xec37bd,_0x5ed41f){return db[_0xe15a('0x33')][_0xe15a('0x4e')]({'where':{'id':_0xec37bd[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x5ed41f,null))['then'](removeEntity(_0x5ed41f,null))[_0xe15a('0x4b')](handleError(_0x5ed41f,null));};exports[_0xe15a('0x57')]=function(_0x4e0175,_0x99c634){return db['CmList'][_0xe15a('0x57')]()['then'](respondWithResult(_0x99c634,null))['catch'](handleError(_0x99c634,null));};exports[_0xe15a('0x58')]=function(_0x64f7a7,_0x228cae,_0x14bdef){if(_0x64f7a7[_0xe15a('0x50')]['id']){delete _0x64f7a7[_0xe15a('0x50')]['id'];}return db['CmList'][_0xe15a('0x4e')]({'where':{'id':_0x64f7a7[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x228cae,null))[_0xe15a('0x27')](function(_0x459d61){if(_0x459d61){_0x64f7a7[_0xe15a('0x50')][_0xe15a('0x59')]=_0x459d61['id'];return db['Disposition'][_0xe15a('0x4f')](_0x64f7a7[_0xe15a('0x50')]);}})[_0xe15a('0x27')](respondWithResult(_0x228cae,null))[_0xe15a('0x4b')](handleError(_0x228cae,null));};exports[_0xe15a('0x5a')]=function(_0x3b2918,_0x29a121,_0x4465cc){var _0x594396={'raw':![],'where':{}};var _0x111034={};var _0x2703a5={'count':0x0,'rows':[]};return db[_0xe15a('0x33')]['findOne']({'where':{'id':_0x3b2918[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x29a121,null))[_0xe15a('0x27')](function(_0x4b7624){if(_0x4b7624){_0x111034[_0xe15a('0x39')]=_[_0xe15a('0x4c')](db[_0xe15a('0x5b')]['rawAttributes']);_0x111034['query']=_[_0xe15a('0x4c')](_0x3b2918[_0xe15a('0x37')]);_0x111034[_0xe15a('0x43')]=_[_0xe15a('0x38')](_0x111034[_0xe15a('0x39')],_0x111034['query']);_0x594396[_0xe15a('0x3a')]=_[_0xe15a('0x38')](_0x111034[_0xe15a('0x39')],qs['fields'](_0x3b2918['query']['fields']));_0x594396[_0xe15a('0x3a')]=_0x594396['attributes'][_0xe15a('0x3c')]?_0x594396[_0xe15a('0x3a')]:_0x111034['model'];if(!_0x3b2918[_0xe15a('0x37')][_0xe15a('0x3d')](_0xe15a('0x3e'))){_0x594396[_0xe15a('0x1f')]=qs['limit'](_0x3b2918['query']['limit']);_0x594396[_0xe15a('0x1e')]=qs[_0xe15a('0x1e')](_0x3b2918[_0xe15a('0x37')][_0xe15a('0x1e')]);}_0x594396[_0xe15a('0x3f')]=qs[_0xe15a('0x40')](_0x3b2918[_0xe15a('0x37')][_0xe15a('0x40')]);_0x594396[_0xe15a('0x41')]=qs[_0xe15a('0x43')](_[_0xe15a('0x42')](_0x3b2918[_0xe15a('0x37')],_0x111034[_0xe15a('0x43')]));_0x594396[_0xe15a('0x41')][_0xe15a('0x59')]=_0x4b7624['id'];if(_0x3b2918['query'][_0xe15a('0x46')]){_0x594396['where']=_[_0xe15a('0x44')](_0x594396[_0xe15a('0x41')],{'$or':_[_0xe15a('0x32')](_0x594396[_0xe15a('0x3a')],function(_0x18e196){var _0x85f84a={};_0x85f84a[_0x18e196]={'$like':'%'+_0x3b2918[_0xe15a('0x37')]['filter']+'%'};return _0x85f84a;})});}_0x594396=_[_0xe15a('0x44')]({},_0x594396,_0x3b2918[_0xe15a('0x47')]);return db[_0xe15a('0x5b')][_0xe15a('0x21')]({'where':_0x594396[_0xe15a('0x41')]})['then'](function(_0x577931){_0x2703a5[_0xe15a('0x21')]=_0x577931;if(_0x3b2918[_0xe15a('0x37')][_0xe15a('0x5c')]){_0x594396[_0xe15a('0x48')]=[{'all':!![]}];}return db[_0xe15a('0x5b')]['findAll'](_0x594396);})['then'](function(_0x55530a){_0x2703a5[_0xe15a('0x4a')]=_0x55530a;return _0x2703a5;});}})[_0xe15a('0x27')](respondWithFilteredResult(_0x29a121,_0x594396))[_0xe15a('0x4b')](handleError(_0x29a121,null));};exports[_0xe15a('0x5d')]=function(_0x2ee44a,_0x47b1b6,_0x2c068a){return db['CmList']['find']({'where':{'id':_0x2ee44a[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x47b1b6,null))['then'](function(_0x4d4ee1){if(_0x4d4ee1){return _0x4d4ee1[_0xe15a('0x5d')](_0x2ee44a[_0xe15a('0x37')][_0xe15a('0x5e')]);}})[_0xe15a('0x27')](respondWithStatusCode(_0x47b1b6,null))[_0xe15a('0x4b')](handleError(_0x47b1b6,null));};exports['addContacts']=function(_0x48f9c9,_0x5a0a1d,_0x2f0625){return db['CmList'][_0xe15a('0x4e')]({'where':{'id':_0x48f9c9['params']['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x5a0a1d,null))[_0xe15a('0x27')](function(_0x307023){if(_0x307023){var _0x5e064d=[];var _0xd68a05={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xe15a('0x27')](function(_0x363e3f){if(_0x48f9c9[_0xe15a('0x50')]['tags']&&_['isArray'](_0x48f9c9['body'][_0xe15a('0x5f')])){if(_0x48f9c9[_0xe15a('0x50')][_0xe15a('0x5f')][_0xe15a('0x3c')]){_0x48f9c9[_0xe15a('0x50')]['tags']=_0x48f9c9['body'][_0xe15a('0x5f')]['join'](';')+';';}else{_0x48f9c9['body'][_0xe15a('0x5f')]=null;}}else{_0x48f9c9[_0xe15a('0x50')]['tags']=null;}if(_0x48f9c9[_0xe15a('0x50')]&&_[_0xe15a('0x60')](_0x48f9c9[_0xe15a('0x50')])){for(var _0x1b1d1c=0x0;_0x1b1d1c<_0x48f9c9[_0xe15a('0x50')][_0xe15a('0x3c')];_0x1b1d1c+=0x1){_0x48f9c9[_0xe15a('0x50')][_0x1b1d1c]['ListId']=_0x48f9c9[_0xe15a('0x56')]['id'];_0x5e064d['push'](_0x48f9c9[_0xe15a('0x50')][_0x1b1d1c]);}return BPromise['each'](_0x5e064d,function(_0x3e6f63){return db[_0xe15a('0x61')][_0xe15a('0x4f')](_['omit'](_0x3e6f63,[_0xe15a('0x5e'),'id'])||{},{'fields':_['keys'](_0x363e3f),'raw':!![]})['then'](function(_0x39dadc){_0xd68a05[_0xe15a('0x62')][_0xe15a('0x63')](_0x39dadc['dataValues']);})['catch'](function(_0x44f8b1){_0xd68a05['errors'][_0xe15a('0x63')]({'data':_0x3e6f63,'error':_0x44f8b1[_0xe15a('0x64')]});});})[_0xe15a('0x27')](function(_0x22a14b){return _0xd68a05;})[_0xe15a('0x4b')](function(_0x2942b6){return _0x2942b6;});}else{_0x5a0a1d[_0xe15a('0x1c')](0x190)['json']({'message':_0xe15a('0x65')});}});}})['then'](respondWithResult(_0x5a0a1d,null))[_0xe15a('0x4b')](handleError(_0x5a0a1d,null));};exports[_0xe15a('0x66')]=function(_0x5d2a88,_0x25bf37,_0x3ebe48){var _0x2bb410;return db['CmList']['find']({'where':{'id':_0x5d2a88[_0xe15a('0x56')]['id']},'include':[{'model':db[_0xe15a('0x67')],'as':_0xe15a('0x68')}]})[_0xe15a('0x27')](handleEntityNotFound(_0x25bf37,null))[_0xe15a('0x27')](function(_0x227533){if(_0x227533){_0x2bb410=_0x227533;return db['CmContact']['rawAttributes'];}})[_0xe15a('0x27')](function(_0x14dfeb){if(_0x14dfeb){var _0xb65759={};var _0x3f1a65={};_0x3f1a65[_0xe15a('0x39')]=_[_0xe15a('0x69')](_[_0xe15a('0x4c')](_0x14dfeb),_[_0xe15a('0x32')](_0x2bb410[_0xe15a('0x68')],function(_0x8c3f04){return util[_0xe15a('0x6a')](_0xe15a('0x6b'),_0x8c3f04['id']);}));_0x3f1a65['query']=_['keys'](_0x5d2a88[_0xe15a('0x37')]);_0x3f1a65[_0xe15a('0x43')]=_[_0xe15a('0x38')](_0x3f1a65['model'],_0x3f1a65['query']);_0xb65759[_0xe15a('0x3a')]=_[_0xe15a('0x38')](_0x3f1a65[_0xe15a('0x39')],qs[_0xe15a('0x3b')](_0x5d2a88[_0xe15a('0x37')]['fields']));_0xb65759[_0xe15a('0x3a')]=_0xb65759[_0xe15a('0x3a')]['length']?_0xb65759[_0xe15a('0x3a')]:_0x3f1a65[_0xe15a('0x39')];if(!_0x5d2a88['query'][_0xe15a('0x3d')](_0xe15a('0x3e'))){_0xb65759[_0xe15a('0x1f')]=qs['limit'](_0x5d2a88['query'][_0xe15a('0x1f')]);_0xb65759[_0xe15a('0x1e')]=qs[_0xe15a('0x1e')](_0x5d2a88[_0xe15a('0x37')]['offset']);}_0xb65759[_0xe15a('0x3f')]=qs['sort'](_0x5d2a88['query'][_0xe15a('0x40')]);_0xb65759[_0xe15a('0x41')]=qs[_0xe15a('0x43')](_[_0xe15a('0x42')](_0x5d2a88[_0xe15a('0x37')],_0x3f1a65[_0xe15a('0x43')]));_0xb65759[_0xe15a('0x6c')]=!![];if(_0x5d2a88['query'][_0xe15a('0x46')]){_0xb65759[_0xe15a('0x41')]=_[_0xe15a('0x44')](_0xb65759[_0xe15a('0x41')],{'$or':_['map'](_0xb65759['attributes'],function(_0x3c86b3){var _0x5d97bd={};_0x5d97bd[_0x3c86b3]={'$like':'%'+_0x5d2a88[_0xe15a('0x37')][_0xe15a('0x46')]+'%'};return _0x5d97bd;})});}_0xb65759=_[_0xe15a('0x44')]({},_0xb65759,_0x5d2a88[_0xe15a('0x47')]);return _0x2bb410['getContacts'](_0xb65759);}})['then'](respondWithResult(_0x25bf37,null))['catch'](handleError(_0x25bf37,null));};exports[_0xe15a('0x6d')]=function(_0x1e8e07,_0x5325fc,_0x39706f){var _0x2d0a24;var _0x320b63;var _0x2597ca;var _0x666644=_0x1e8e07[_0xe15a('0x56')]['id'];csv_results=[];return db[_0xe15a('0x6e')][_0xe15a('0x49')]({'attributes':['id',_0xe15a('0x2f')],'raw':!![],'order':[_0xe15a('0x6f')]})[_0xe15a('0x27')](function(_0x37329d){_0x2d0a24=_0x37329d;var _0x15a3da=_['keys'](db[_0xe15a('0x61')]['rawAttributes']);return db[_0xe15a('0x67')][_0xe15a('0x49')]({'raw':!![],'attributes':['id',_0xe15a('0x70')]})[_0xe15a('0x27')](function(_0x11bbe1){_0x320b63=_0x11bbe1;var _0x86a50c=squel[_0xe15a('0x71')]()['fields'](_0x15a3da)[_0xe15a('0x72')](_0xe15a('0x73'),'c')[_0xe15a('0x41')]('c.ListId\x20=\x20?',_0x666644)[_0xe15a('0x41')](_0xe15a('0x74'))[_0xe15a('0x75')]();for(var _0x1c04ff=0x0;_0x1c04ff<_0x320b63[_0xe15a('0x3c')];_0x1c04ff++){_0x86a50c[_0xe15a('0x76')]('c.cf_'+_0x320b63[_0x1c04ff]['id'],'customField_'+_0x320b63[_0x1c04ff]['alias']);}for(var _0x1c04ff=0x0;_0x1c04ff<_0x2d0a24[_0xe15a('0x3c')];_0x1c04ff++){_0x86a50c[_0xe15a('0x76')](squel[_0xe15a('0x71')]()[_0xe15a('0x76')](_0xe15a('0x77'))[_0xe15a('0x72')](_0xe15a('0x78'))[_0xe15a('0x41')](_0xe15a('0x79'),_0x2d0a24[_0x1c04ff]['id'])[_0xe15a('0x41')](_0xe15a('0x7a')),_0xe15a('0x7b')+_0x2d0a24[_0x1c04ff][_0xe15a('0x2f')]);_0x86a50c[_0xe15a('0x76')](squel['select']()['field'](_0xe15a('0x7c'))[_0xe15a('0x72')](_0xe15a('0x78'))[_0xe15a('0x41')](_0xe15a('0x79'),_0x2d0a24[_0x1c04ff]['id'])['where'](_0xe15a('0x7a')),_0xe15a('0x7d')+_0x2d0a24[_0x1c04ff][_0xe15a('0x2f')]);}var _0x3971e8=[];_0x3971e8[_0xe15a('0x63')](_0x86a50c['toString']());BPromise[_0xe15a('0x7e')](_0x3971e8,handleQuery)[_0xe15a('0x27')](function(_0x4ec41b){handleQuery(_0x86a50c['toString']());var _0x361933=csv_results[0x0];if(!_[_0xe15a('0x7f')](_0x361933)){var _0x1817b2=toCsv(_0x361933);var _0x1521a6=Date[_0xe15a('0x80')]();fs[_0xe15a('0x81')](util['format']('/tmp/list_%d_%s.csv',_0x666644,_0x1521a6),_0x1817b2);_0x5325fc[_0xe15a('0x82')]('Content-disposition',_0xe15a('0x83')+util[_0xe15a('0x6a')](_0xe15a('0x84'),_0x666644,_0x1521a6));_0x5325fc[_0xe15a('0x82')](_0xe15a('0x85'),'text/csv');return _0x5325fc[_0xe15a('0x86')](util[_0xe15a('0x6a')](_0xe15a('0x87'),_0x666644,_0x1521a6));}else{return _0x5325fc[_0xe15a('0x1b')](0xcc);}});});});};exports[_0xe15a('0x88')]=function(_0xc83b8f,_0x23532c,_0x357a1d){var _0x4d0e11;delete _0xc83b8f[_0xe15a('0x50')]['id'];return db[_0xe15a('0x33')][_0xe15a('0x89')]({'where':{'id':_0xc83b8f[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x23532c,null))[_0xe15a('0x27')](function(_0x1ac095){if(_0x1ac095){return db[_0xe15a('0x8a')][_0xe15a('0x8b')](function(_0x3fb77f){return db[_0xe15a('0x67')][_0xe15a('0x4f')](_0xc83b8f['body'],{'transaction':_0x3fb77f})[_0xe15a('0x27')](function(_0x2de2aa){_0x4d0e11=_0x2de2aa;return _0x1ac095[_0xe15a('0x8c')](_0x2de2aa,{'transaction':_0x3fb77f});})[_0xe15a('0x27')](function(){var _0x36a673={'type':db[_0xe15a('0x8d')][_0xe15a('0x8e')],'transaction':_0x3fb77f};switch(_0xc83b8f['body'][_0xe15a('0x35')]){case _0xe15a('0x8f'):_0x36a673[_0xe15a('0x35')]=db['Sequelize'][_0xe15a('0x8e')];break;case _0xe15a('0x90'):_0x36a673['type']=db['Sequelize']['INTEGER'];break;case'switch':_0x36a673[_0xe15a('0x35')]=db['Sequelize'][_0xe15a('0x91')];_0x36a673[_0xe15a('0x92')]=![];break;default:}return db[_0xe15a('0x8a')][_0xe15a('0x93')][_0xe15a('0x94')](_0xe15a('0x73'),util['format']('cf_%s',_0x4d0e11['id']),_0x36a673);})[_0xe15a('0x27')](function(){return _0x4d0e11;});});}})[_0xe15a('0x27')](respondWithResult(_0x23532c,null))[_0xe15a('0x4b')](handleError(_0x23532c,null));};exports[_0xe15a('0x95')]=function(_0x2ad1b1,_0x3d2008,_0x3c3af5){var _0x9ce208={};var _0x5962e1={};var _0x3bb174;var _0x5b4025;return db[_0xe15a('0x33')]['findOne']({'where':{'id':_0x2ad1b1['params']['id']}})['then'](handleEntityNotFound(_0x3d2008,null))['then'](function(_0x13527a){if(_0x13527a){_0x3bb174=_0x13527a;_0x5962e1[_0xe15a('0x39')]=_[_0xe15a('0x4c')](db[_0xe15a('0x67')]['rawAttributes']);_0x5962e1['query']=_[_0xe15a('0x4c')](_0x2ad1b1['query']);_0x5962e1['filters']=_[_0xe15a('0x38')](_0x5962e1[_0xe15a('0x39')],_0x5962e1[_0xe15a('0x37')]);_0x9ce208[_0xe15a('0x3a')]=_['intersection'](_0x5962e1[_0xe15a('0x39')],qs['fields'](_0x2ad1b1[_0xe15a('0x37')]['fields']));_0x9ce208['attributes']=_0x9ce208['attributes'][_0xe15a('0x3c')]?_0x9ce208[_0xe15a('0x3a')]:_0x5962e1[_0xe15a('0x39')];_0x9ce208[_0xe15a('0x3f')]=qs['sort'](_0x2ad1b1[_0xe15a('0x37')][_0xe15a('0x40')]);_0x9ce208[_0xe15a('0x41')]=qs[_0xe15a('0x43')](_[_0xe15a('0x42')](_0x2ad1b1[_0xe15a('0x37')],_0x5962e1[_0xe15a('0x43')]));_0x9ce208[_0xe15a('0x41')]=_[_0xe15a('0x44')](_0x9ce208[_0xe15a('0x41')],{'$or':[{'ListId':_0x13527a['id']},{'ListId':null}]});if(_0x2ad1b1[_0xe15a('0x37')][_0xe15a('0x46')]){_0x9ce208[_0xe15a('0x41')]=_[_0xe15a('0x44')](_0x9ce208[_0xe15a('0x41')],{'$or':_[_0xe15a('0x32')](_0x9ce208[_0xe15a('0x3a')],function(_0x1c8826){var _0x34b242={};_0x34b242[_0x1c8826]={'$like':'%'+_0x2ad1b1[_0xe15a('0x37')][_0xe15a('0x46')]+'%'};return _0x34b242;})});}_0x9ce208=_[_0xe15a('0x44')]({},_0x9ce208,_0x2ad1b1[_0xe15a('0x47')]);return db[_0xe15a('0x67')][_0xe15a('0x96')](_0x9ce208);}})['then'](respondWithResult(_0x3d2008,null))[_0xe15a('0x4b')](handleError(_0x3d2008,null));};exports[_0xe15a('0x97')]=function(_0x553340,_0x1ab978){return db[_0xe15a('0x67')][_0xe15a('0x96')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1ab978,null))['then'](function(_0x224adf){return _0x224adf;})[_0xe15a('0x27')](respondWithResult(_0x1ab978,null))[_0xe15a('0x4b')](handleError(_0x1ab978,null));};exports[_0xe15a('0x98')]=function(_0x4ba832,_0x1b82a7,_0x4be8fa){return db[_0xe15a('0x33')][_0xe15a('0x4e')]({'where':{'id':_0x4ba832['params']['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x1b82a7,null))['then'](function(_0x5a3cbe){if(_0x5a3cbe){return _0x5a3cbe[_0xe15a('0x98')](_0x4ba832['body'][_0xe15a('0x5e')],_[_0xe15a('0x99')](_0x4ba832[_0xe15a('0x50')],[_0xe15a('0x5e'),'id'])||{})[_0xe15a('0x9a')](function(_0x590914){for(var _0x386b94=0x0;_0x386b94<_0x4ba832[_0xe15a('0x50')]['ids'][_0xe15a('0x3c')];_0x386b94+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x4ba832[_0xe15a('0x50')][_0xe15a('0x5e')][_0x386b94]),'CmListId':Number(_0x4ba832[_0xe15a('0x56')]['id'])});}return _0x590914;});}})[_0xe15a('0x27')](respondWithResult(_0x1b82a7,null))[_0xe15a('0x4b')](handleError(_0x1b82a7,null));};exports[_0xe15a('0x9b')]=function(_0x4e5d2d,_0x372a48,_0x23a7f2){return db[_0xe15a('0x33')]['find']({'where':{'id':_0x4e5d2d[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x372a48,null))[_0xe15a('0x27')](function(_0x4ae800){if(_0x4ae800){return _0x4ae800[_0xe15a('0x9b')](_0x4e5d2d[_0xe15a('0x37')]['ids'])[_0xe15a('0x27')](function(){if(_[_0xe15a('0x60')](_0x4e5d2d[_0xe15a('0x37')]['ids'])){for(var _0x297c10=0x0;_0x297c10<_0x4e5d2d['query'][_0xe15a('0x5e')][_0xe15a('0x3c')];_0x297c10+=0x1){socket['emit'](_0xe15a('0x9c'),{'UserId':Number(_0x4e5d2d[_0xe15a('0x37')]['ids'][_0x297c10]),'CmListId':Number(_0x4e5d2d[_0xe15a('0x56')]['id'])});}}else{socket[_0xe15a('0x9d')](_0xe15a('0x9c'),{'UserId':Number(_0x4e5d2d[_0xe15a('0x37')][_0xe15a('0x5e')]),'CmListId':Number(_0x4e5d2d['params']['id'])});}});}})[_0xe15a('0x27')](respondWithStatusCode(_0x372a48,null))['catch'](handleError(_0x372a48,null));};exports[_0xe15a('0x9e')]=function(_0x3296f5,_0x1b7179,_0x4be498){var _0x43367b={};var _0x339760={};var _0x5d268d;var _0x4b4951;return db[_0xe15a('0x33')]['findOne']({'where':{'id':_0x3296f5[_0xe15a('0x56')]['id']}})[_0xe15a('0x27')](handleEntityNotFound(_0x1b7179,null))[_0xe15a('0x27')](function(_0x3c29a4){if(_0x3c29a4){_0x5d268d=_0x3c29a4;_0x339760['model']=_[_0xe15a('0x4c')](db[_0xe15a('0x9f')][_0xe15a('0x4d')]);_0x339760[_0xe15a('0x37')]=_[_0xe15a('0x4c')](_0x3296f5[_0xe15a('0x37')]);_0x339760[_0xe15a('0x43')]=_[_0xe15a('0x38')](_0x339760[_0xe15a('0x39')],_0x339760['query']);_0x43367b[_0xe15a('0x3a')]=_['intersection'](_0x339760[_0xe15a('0x39')],qs['fields'](_0x3296f5[_0xe15a('0x37')][_0xe15a('0x3b')]));_0x43367b[_0xe15a('0x3a')]=_0x43367b['attributes'][_0xe15a('0x3c')]?_0x43367b[_0xe15a('0x3a')]:_0x339760[_0xe15a('0x39')];_0x43367b[_0xe15a('0x3f')]=qs[_0xe15a('0x40')](_0x3296f5[_0xe15a('0x37')][_0xe15a('0x40')]);_0x43367b['where']=qs[_0xe15a('0x43')](_[_0xe15a('0x42')](_0x3296f5[_0xe15a('0x37')],_0x339760[_0xe15a('0x43')]));if(_0x3296f5[_0xe15a('0x37')]['filter']){_0x43367b[_0xe15a('0x41')]=_[_0xe15a('0x44')](_0x43367b[_0xe15a('0x41')],{'$or':_[_0xe15a('0x32')](_0x43367b[_0xe15a('0x3a')],function(_0xa160b3){var _0x229a95={};_0x229a95[_0xa160b3]={'$like':'%'+_0x3296f5[_0xe15a('0x37')][_0xe15a('0x46')]+'%'};return _0x229a95;})});}_0x43367b=_[_0xe15a('0x44')]({},_0x43367b,_0x3296f5[_0xe15a('0x47')]);return _0x5d268d['getAgents'](_0x43367b);}})[_0xe15a('0x27')](function(_0x5c5982){if(_0x5c5982){_0x4b4951=_0x5c5982[_0xe15a('0x3c')];if(!_0x3296f5['query']['hasOwnProperty'](_0xe15a('0x3e'))){_0x43367b[_0xe15a('0x1f')]=qs[_0xe15a('0x1f')](_0x3296f5[_0xe15a('0x37')]['limit']);_0x43367b[_0xe15a('0x1e')]=qs[_0xe15a('0x1e')](_0x3296f5['query'][_0xe15a('0x1e')]);}return _0x5d268d['getAgents'](_0x43367b);}})[_0xe15a('0x27')](function(_0x184744){if(_0x184744){return _0x184744?{'count':_0x4b4951,'rows':_0x184744}:null;}})[_0xe15a('0x27')](respondWithResult(_0x1b7179,null))['catch'](handleError(_0x1b7179,null));};function handleQuery(_0x371a62){logger['info'](_0x371a62);return db[_0xe15a('0x8a')]['query'](_0x371a62)[_0xe15a('0x9a')](function(_0x30f034){csv_results[_0xe15a('0x63')](_0x30f034);})[_0xe15a('0x4b')](function(_0x18589c){logger[_0xe15a('0x2d')](_0x18589c[_0xe15a('0x64')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1327393..3a1a0ef 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x4a5635,_0x443b90){var _0x18d602=function(_0x1ddd38){while(--_0x1ddd38){_0x4a5635['push'](_0x4a5635['shift']());}};_0x18d602(++_0x443b90);}(_0x814b,0x1a2));var _0xb814=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x814b[_0x3718b7];return _0xf8c91e;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2d4cf0,_0x209abe){var _0x22353c=function(_0x19cd19){while(--_0x19cd19){_0x2d4cf0['push'](_0x2d4cf0['shift']());}};_0x22353c(++_0x209abe);}(_0x814b,0x1a2));var _0xb814=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x814b[_0x1ee5be];return _0x177140;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 99d388f..0697f2f 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 _0x91a7=['bluebird','path','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0x91a7,0xe7));var _0x791a=function(_0x17f986,_0x18e5e7){_0x17f986=_0x17f986-0x0;var _0x155893=_0x91a7[_0x17f986];return _0x155893;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./cmList.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d7665,_0xa95e64){var _0x2fe722=function(_0xb8c446){while(--_0xb8c446){_0x1d7665['push'](_0x1d7665['shift']());}};_0x2fe722(++_0xa95e64);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0xb4e6[_0x27e811];return _0x1627fa;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('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 6f38a00..a4bf7bd 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 _0x0dc3=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmList,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xaf7943,_0x173e73){var _0x288e7b=function(_0x5609b0){while(--_0x5609b0){_0xaf7943['push'](_0xaf7943['shift']());}};_0x288e7b(++_0x173e73);}(_0x0dc3,0x1d8));var _0x30dc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x0dc3[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x30dc('0x0'));var util=require(_0x30dc('0x1'));var moment=require('moment');var BPromise=require(_0x30dc('0x2'));var rs=require(_0x30dc('0x3'));var fs=require('fs');var Redis=require(_0x30dc('0x4'));var db=require(_0x30dc('0x5'))['db'];var utils=require(_0x30dc('0x6'));var logger=require(_0x30dc('0x7'))('rpc');var config=require(_0x30dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x30dc('0x9')][_0x30dc('0xa')]({'port':0x232a});config[_0x30dc('0xb')]=_[_0x30dc('0xc')](config['redis'],{'host':_0x30dc('0xd'),'port':0x18eb});var socket=require(_0x30dc('0xe'))(new Redis(config[_0x30dc('0xb')]));require('./cmList.socket')[_0x30dc('0xf')](socket);function respondWithRpcPromise(_0x241881,_0x1f405b,_0x3f08f7){return new BPromise(function(_0x576ca0,_0x23e412){return client[_0x30dc('0x10')](_0x241881,_0x3f08f7)[_0x30dc('0x11')](function(_0x398376){logger['info']('CmList,\x20%s,\x20%s',_0x1f405b,'request\x20sent');logger['debug'](_0x30dc('0x12'),_0x1f405b,_0x30dc('0x13'),JSON['stringify'](_0x398376));if(_0x398376[_0x30dc('0x14')]){if(_0x398376[_0x30dc('0x14')]['code']===0x1f4){logger[_0x30dc('0x14')](_0x30dc('0x15'),_0x1f405b,_0x398376[_0x30dc('0x14')][_0x30dc('0x16')]);return _0x23e412(_0x398376[_0x30dc('0x14')][_0x30dc('0x16')]);}logger[_0x30dc('0x14')](_0x30dc('0x15'),_0x1f405b,_0x398376[_0x30dc('0x14')][_0x30dc('0x16')]);return _0x576ca0(_0x398376[_0x30dc('0x14')][_0x30dc('0x16')]);}else{logger[_0x30dc('0x17')](_0x30dc('0x15'),_0x1f405b,_0x30dc('0x13'));_0x576ca0(_0x398376['result'][_0x30dc('0x16')]);}})['catch'](function(_0x29b5e8){logger[_0x30dc('0x14')](_0x30dc('0x15'),_0x1f405b,_0x29b5e8);_0x23e412(_0x29b5e8);});});} \ No newline at end of file +var _0x4dd5=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x11a404,_0x4ae96a){var _0x2be6f7=function(_0x41c940){while(--_0x41c940){_0x11a404['push'](_0x11a404['shift']());}};_0x2be6f7(++_0x4ae96a);}(_0x4dd5,0x10f));var _0x54dd=function(_0x90d7c5,_0x5c9441){_0x90d7c5=_0x90d7c5-0x0;var _0x50661d=_0x4dd5[_0x90d7c5];return _0x50661d;};'use strict';var _=require('lodash');var util=require(_0x54dd('0x0'));var moment=require(_0x54dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x54dd('0x2'));var fs=require('fs');var Redis=require(_0x54dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54dd('0x4'));var config=require(_0x54dd('0x5'));var jayson=require(_0x54dd('0x6'));var client=jayson[_0x54dd('0x7')][_0x54dd('0x8')]({'port':0x232a});config[_0x54dd('0x9')]=_['defaults'](config[_0x54dd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x54dd('0xa'))(new Redis(config[_0x54dd('0x9')]));require(_0x54dd('0xb'))[_0x54dd('0xc')](socket);function respondWithRpcPromise(_0x34428f,_0x9db1a8,_0x117956){return new BPromise(function(_0x387001,_0x1181ea){return client[_0x54dd('0xd')](_0x34428f,_0x117956)[_0x54dd('0xe')](function(_0x3cadc3){logger[_0x54dd('0xf')](_0x54dd('0x10'),_0x9db1a8,_0x54dd('0x11'));logger[_0x54dd('0x12')](_0x54dd('0x13'),_0x9db1a8,_0x54dd('0x11'),JSON[_0x54dd('0x14')](_0x3cadc3));if(_0x3cadc3[_0x54dd('0x15')]){if(_0x3cadc3[_0x54dd('0x15')][_0x54dd('0x16')]===0x1f4){logger[_0x54dd('0x15')](_0x54dd('0x10'),_0x9db1a8,_0x3cadc3['error'][_0x54dd('0x17')]);return _0x1181ea(_0x3cadc3[_0x54dd('0x15')][_0x54dd('0x17')]);}logger[_0x54dd('0x15')]('CmList,\x20%s,\x20%s',_0x9db1a8,_0x3cadc3[_0x54dd('0x15')]['message']);return _0x387001(_0x3cadc3[_0x54dd('0x15')][_0x54dd('0x17')]);}else{logger[_0x54dd('0xf')](_0x54dd('0x10'),_0x9db1a8,_0x54dd('0x11'));_0x387001(_0x3cadc3['result']['message']);}})['catch'](function(_0x1fe696){logger['error'](_0x54dd('0x10'),_0x9db1a8,_0x1fe696);_0x1181ea(_0x1fe696);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 52f4385..5daeacc 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 _0x119c=['./cmList.events','update','emit','removeListener'];(function(_0x44ccbe,_0x3a88e7){var _0x328d99=function(_0x12ddb2){while(--_0x12ddb2){_0x44ccbe['push'](_0x44ccbe['shift']());}};_0x328d99(++_0x3a88e7);}(_0x119c,0xa0));var _0xc119=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x119c[_0xb5fc3e];return _0x2efc3c;};'use strict';var CmListEvents=require(_0xc119('0x0'));var events=['save','remove',_0xc119('0x1')];function createListener(_0xf428b4,_0x2cf552){return function(_0xde2e15){_0x2cf552[_0xc119('0x2')](_0xf428b4,_0xde2e15);};}function removeListener(_0x588a5d,_0x1a2818){return function(){CmListEvents[_0xc119('0x3')](_0x588a5d,_0x1a2818);};}exports['register']=function(_0x2df4e5){for(var _0x2d2572=0x0,_0x2f8c50=events['length'];_0x2d2572<_0x2f8c50;_0x2d2572++){var _0x5e1685=events[_0x2d2572];var _0x44c03d=createListener('cmList:'+_0x5e1685,_0x2df4e5);CmListEvents['on'](_0x5e1685,_0x44c03d);}}; \ No newline at end of file +var _0x7fe8=['length','./cmList.events','save','update','removeListener'];(function(_0x27fcea,_0x3b71c0){var _0x102ff7=function(_0x4cad83){while(--_0x4cad83){_0x27fcea['push'](_0x27fcea['shift']());}};_0x102ff7(++_0x3b71c0);}(_0x7fe8,0x13c));var _0x87fe=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x7fe8[_0xc40b9f];return _0x535b9c;};'use strict';var CmListEvents=require(_0x87fe('0x0'));var events=[_0x87fe('0x1'),'remove',_0x87fe('0x2')];function createListener(_0x57bd95,_0x48bbca){return function(_0x86dbad){_0x48bbca['emit'](_0x57bd95,_0x86dbad);};}function removeListener(_0x17eaaf,_0x53387a){return function(){CmListEvents[_0x87fe('0x3')](_0x17eaaf,_0x53387a);};}exports['register']=function(_0x5df68a){for(var _0x5afd4f=0x0,_0x6e6c6e=events[_0x87fe('0x4')];_0x5afd4f<_0x6e6c6e;_0x5afd4f++){var _0x40e4ee=events[_0x5afd4f];var _0x571b66=createListener('cmList:'+_0x40e4ee,_0x5df68a);CmListEvents['on'](_0x40e4ee,_0x571b66);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e0a0ba1..44f72ec 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 _0x1ee4=['index','isAuthenticated','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getAgents','post','create','addDisposition','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get'];(function(_0xef3ae2,_0x4c63b8){var _0x1cc22b=function(_0x4de2da){while(--_0x4de2da){_0xef3ae2['push'](_0xef3ae2['shift']());}};_0x1cc22b(++_0x4c63b8);}(_0x1ee4,0xbe));var _0x41ee=function(_0x4497a8,_0x5de053){_0x4497a8=_0x4497a8-0x0;var _0x5e6d7b=_0x1ee4[_0x4497a8];return _0x5e6d7b;};'use strict';var multer=require(_0x41ee('0x0'));var util=require(_0x41ee('0x1'));var path=require(_0x41ee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x41ee('0x3'));var auth=require(_0x41ee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x41ee('0x5'));var controller=require(_0x41ee('0x6'));router[_0x41ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x41ee('0x8')]);router[_0x41ee('0x7')]('/describe',auth[_0x41ee('0x9')](),controller[_0x41ee('0xa')]);router[_0x41ee('0x7')](_0x41ee('0xb'),auth[_0x41ee('0x9')](),controller['getGlobalCustomFields']);router['get'](_0x41ee('0xc'),auth[_0x41ee('0x9')](),controller[_0x41ee('0xd')]);router[_0x41ee('0x7')](_0x41ee('0xe'),auth[_0x41ee('0x9')](),controller[_0x41ee('0xf')]);router[_0x41ee('0x7')](_0x41ee('0x10'),auth[_0x41ee('0x9')](),controller[_0x41ee('0x11')]);router['get'](_0x41ee('0x12'),auth[_0x41ee('0x9')](),controller['getContactsCsv']);router[_0x41ee('0x7')](_0x41ee('0x13'),auth[_0x41ee('0x9')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x41ee('0x9')](),controller[_0x41ee('0x14')]);router[_0x41ee('0x15')]('/',auth[_0x41ee('0x9')](),controller[_0x41ee('0x16')]);router[_0x41ee('0x15')](_0x41ee('0xe'),auth[_0x41ee('0x9')](),controller[_0x41ee('0x17')]);router[_0x41ee('0x15')](_0x41ee('0x10'),auth[_0x41ee('0x9')](),controller['addContacts']);router[_0x41ee('0x15')](_0x41ee('0x13'),auth[_0x41ee('0x9')](),controller[_0x41ee('0x18')]);router[_0x41ee('0x15')](_0x41ee('0x19'),auth['isAuthenticated'](),controller[_0x41ee('0x1a')]);router[_0x41ee('0x1b')]('/:id',auth[_0x41ee('0x9')](),controller[_0x41ee('0x1c')]);router[_0x41ee('0x1d')](_0x41ee('0xc'),auth[_0x41ee('0x9')](),controller[_0x41ee('0x1e')]);router[_0x41ee('0x1d')](_0x41ee('0xe'),auth['isAuthenticated'](),controller[_0x41ee('0x1f')]);router[_0x41ee('0x1d')](_0x41ee('0x19'),auth[_0x41ee('0x9')](),controller['removeAgents']);module[_0x41ee('0x20')]=router; \ No newline at end of file +var _0x0a6d=['post','create','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents'];(function(_0x3e5a4b,_0x2c33b4){var _0x58db22=function(_0x43d4ec){while(--_0x43d4ec){_0x3e5a4b['push'](_0x3e5a4b['shift']());}};_0x58db22(++_0x2c33b4);}(_0x0a6d,0xd1));var _0xd0a6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0a6d[_0x21549c];return _0x426cbd;};'use strict';var multer=require(_0xd0a6('0x0'));var util=require(_0xd0a6('0x1'));var path=require('path');var timeout=require(_0xd0a6('0x2'));var express=require(_0xd0a6('0x3'));var router=express[_0xd0a6('0x4')]();var fs_extra=require(_0xd0a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0a6('0x6'));var config=require(_0xd0a6('0x7'));var controller=require(_0xd0a6('0x8'));router[_0xd0a6('0x9')]('/',auth[_0xd0a6('0xa')](),controller['index']);router['get']('/describe',auth[_0xd0a6('0xa')](),controller['describe']);router[_0xd0a6('0x9')]('/global_fields',auth[_0xd0a6('0xa')](),controller[_0xd0a6('0xb')]);router[_0xd0a6('0x9')](_0xd0a6('0xc'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0xd')]);router['get'](_0xd0a6('0xe'),auth[_0xd0a6('0xa')](),controller['getDispositions']);router[_0xd0a6('0x9')](_0xd0a6('0xf'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x10')]);router[_0xd0a6('0x9')](_0xd0a6('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0xd0a6('0x12'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x13')]);router[_0xd0a6('0x9')](_0xd0a6('0x14'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x15')]);router[_0xd0a6('0x16')]('/',auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x17')]);router[_0xd0a6('0x16')](_0xd0a6('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xd0a6('0xf'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x18')]);router[_0xd0a6('0x16')](_0xd0a6('0x12'),auth[_0xd0a6('0xa')](),controller['addCustomField']);router[_0xd0a6('0x16')](_0xd0a6('0x14'),auth['isAuthenticated'](),controller[_0xd0a6('0x19')]);router[_0xd0a6('0x1a')](_0xd0a6('0xc'),auth['isAuthenticated'](),controller[_0xd0a6('0x1b')]);router[_0xd0a6('0x1c')]('/:id',auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x1d')]);router['delete'](_0xd0a6('0xe'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x1e')]);router[_0xd0a6('0x1c')](_0xd0a6('0x14'),auth[_0xd0a6('0xa')](),controller[_0xd0a6('0x1f')]);module[_0xd0a6('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 017a998..d05c6d4 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 _0xebb1=['VIRTUAL','getDataValue','STRING','exports'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xebb1,0x113));var _0x1ebb=function(_0x201039,_0x22ea8f){_0x201039=_0x201039-0x0;var _0x5b424a=_0xebb1[_0x201039];return _0x5b424a;};'use strict';var Sequelize=require('sequelize');module[_0x1ebb('0x0')]={'name':{'type':Sequelize[_0x1ebb('0x1')],'get':function(_0x2342bd){return this[_0x1ebb('0x2')]('field');}},'field':{'type':Sequelize[_0x1ebb('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x1ebb('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xb0f7=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0x4a77e4,_0x556f71){var _0x1c68d8=function(_0x5d8ddf){while(--_0x5d8ddf){_0x4a77e4['push'](_0x4a77e4['shift']());}};_0x1c68d8(++_0x556f71);}(_0xb0f7,0x134));var _0x7b0f=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0xb0f7[_0x83c716];return _0xab9893;};'use strict';var Sequelize=require(_0x7b0f('0x0'));module[_0x7b0f('0x1')]={'name':{'type':Sequelize[_0x7b0f('0x2')],'get':function(_0x34d2b3){return this['getDataValue'](_0x7b0f('0x3'));}},'field':{'type':Sequelize[_0x7b0f('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7b0f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7b0f('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 5c4a96d..73c62a4 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(_0x3e92cf,_0x49d58e){var _0x35f5d3=function(_0x13a83d){while(--_0x13a83d){_0x3e92cf['push'](_0x3e92cf['shift']());}};_0x35f5d3(++_0x49d58e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xbb633,_0x4475ee){var _0x347250=function(_0x53106e){while(--_0x53106e){_0xbb633['push'](_0xbb633['shift']());}};_0x347250(++_0x4475ee);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 32fc450..1b4cc24 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 _0x5afd=['../../config/environment','./condition.attributes','exports','define','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5afd,0x155));var _0xd5af=function(_0x29271a,_0x232277){_0x29271a=_0x29271a-0x0;var _0x10dc39=_0x5afd[_0x29271a];return _0x10dc39;};'use strict';var _=require('lodash');var util=require(_0xd5af('0x0'));var logger=require(_0xd5af('0x1'))(_0xd5af('0x2'));var moment=require(_0xd5af('0x3'));var BPromise=require(_0xd5af('0x4'));var rp=require(_0xd5af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5af('0x6'));var config=require(_0xd5af('0x7'));var attributes=require(_0xd5af('0x8'));module[_0xd5af('0x9')]=function(_0x3acc74,_0x5735a3){return _0x3acc74[_0xd5af('0xa')]('Condition',attributes,{'tableName':_0xd5af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30b0=['Condition','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x4f60e9,_0x18069a){var _0x531656=function(_0x3272e4){while(--_0x3272e4){_0x4f60e9['push'](_0x4f60e9['shift']());}};_0x531656(++_0x18069a);}(_0x30b0,0x115));var _0x030b=function(_0x440448,_0x1371de){_0x440448=_0x440448-0x0;var _0x5aaa24=_0x30b0[_0x440448];return _0x5aaa24;};'use strict';var _=require(_0x030b('0x0'));var util=require(_0x030b('0x1'));var logger=require('../../config/logger')(_0x030b('0x2'));var moment=require(_0x030b('0x3'));var BPromise=require(_0x030b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x030b('0x5'));var rimraf=require(_0x030b('0x6'));var config=require(_0x030b('0x7'));var attributes=require(_0x030b('0x8'));module[_0x030b('0x9')]=function(_0x4c1bf3,_0x16484b){return _0x4c1bf3[_0x030b('0xa')](_0x030b('0xb'),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 3b81ef9..49e025f 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 _0x12ba=['randomstring','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','util','moment','bluebird'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x12ba,0xbb));var _0xa12b=function(_0x4298af,_0x4bdefd){_0x4298af=_0x4298af-0x0;var _0x54589e=_0x12ba[_0x4298af];return _0x54589e;};'use strict';var _=require('lodash');var util=require(_0xa12b('0x0'));var moment=require(_0xa12b('0x1'));var BPromise=require(_0xa12b('0x2'));var rs=require(_0xa12b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa12b('0x4'))(_0xa12b('0x5'));var config=require(_0xa12b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa12b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d9f71,_0x3b28af,_0x403d52){return new BPromise(function(_0x17fab4,_0x43485a){return client[_0xa12b('0x8')](_0x5d9f71,_0x403d52)[_0xa12b('0x9')](function(_0x1c9a69){logger[_0xa12b('0xa')]('Condition,\x20%s,\x20%s',_0x3b28af,_0xa12b('0xb'));logger[_0xa12b('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x3b28af,_0xa12b('0xb'),JSON[_0xa12b('0xd')](_0x1c9a69));if(_0x1c9a69['error']){if(_0x1c9a69[_0xa12b('0xe')][_0xa12b('0xf')]===0x1f4){logger[_0xa12b('0xe')](_0xa12b('0x10'),_0x3b28af,_0x1c9a69[_0xa12b('0xe')]['message']);return _0x43485a(_0x1c9a69['error'][_0xa12b('0x11')]);}logger[_0xa12b('0xe')](_0xa12b('0x10'),_0x3b28af,_0x1c9a69[_0xa12b('0xe')][_0xa12b('0x11')]);return _0x17fab4(_0x1c9a69[_0xa12b('0xe')][_0xa12b('0x11')]);}else{logger[_0xa12b('0xa')](_0xa12b('0x10'),_0x3b28af,_0xa12b('0xb'));_0x17fab4(_0x1c9a69[_0xa12b('0x12')][_0xa12b('0x11')]);}})['catch'](function(_0x95b99){logger[_0xa12b('0xe')](_0xa12b('0x10'),_0x3b28af,_0x95b99);_0x43485a(_0x95b99);});});} \ No newline at end of file +var _0xf15e=['Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','error','code'];(function(_0x12711a,_0x455f94){var _0x175027=function(_0x456248){while(--_0x456248){_0x12711a['push'](_0x12711a['shift']());}};_0x175027(++_0x455f94);}(_0xf15e,0xaf));var _0xef15=function(_0x1347d2,_0x552ad2){_0x1347d2=_0x1347d2-0x0;var _0x53b6aa=_0xf15e[_0x1347d2];return _0x53b6aa;};'use strict';var _=require(_0xef15('0x0'));var util=require(_0xef15('0x1'));var moment=require(_0xef15('0x2'));var BPromise=require(_0xef15('0x3'));var rs=require(_0xef15('0x4'));var fs=require('fs');var Redis=require(_0xef15('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xef15('0x6'));var logger=require('../../config/logger')(_0xef15('0x7'));var config=require(_0xef15('0x8'));var jayson=require(_0xef15('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1855ea,_0x102441,_0x494a0e){return new BPromise(function(_0x34631b,_0x32d275){return client['request'](_0x1855ea,_0x494a0e)['then'](function(_0x53f8f5){logger[_0xef15('0xa')]('Condition,\x20%s,\x20%s',_0x102441,_0xef15('0xb'));logger[_0xef15('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x102441,_0xef15('0xb'),JSON['stringify'](_0x53f8f5));if(_0x53f8f5[_0xef15('0xd')]){if(_0x53f8f5[_0xef15('0xd')][_0xef15('0xe')]===0x1f4){logger['error'](_0xef15('0xf'),_0x102441,_0x53f8f5[_0xef15('0xd')]['message']);return _0x32d275(_0x53f8f5[_0xef15('0xd')]['message']);}logger[_0xef15('0xd')](_0xef15('0xf'),_0x102441,_0x53f8f5[_0xef15('0xd')][_0xef15('0x10')]);return _0x34631b(_0x53f8f5[_0xef15('0xd')][_0xef15('0x10')]);}else{logger[_0xef15('0xa')]('Condition,\x20%s,\x20%s',_0x102441,'request\x20sent');_0x34631b(_0x53f8f5[_0xef15('0x11')][_0xef15('0x10')]);}})[_0xef15('0x12')](function(_0x682a1e){logger[_0xef15('0xd')](_0xef15('0xf'),_0x102441,_0x682a1e);_0x32d275(_0x682a1e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 9c5d737..08a7dd7 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 _0x2e33=['delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x2e33,0x1d2));var _0x32e3=function(_0x51da2d,_0xb74ab6){_0x51da2d=_0x51da2d-0x0;var _0x5e6668=_0x2e33[_0x51da2d];return _0x5e6668;};'use strict';var multer=require(_0x32e3('0x0'));var util=require(_0x32e3('0x1'));var path=require('path');var timeout=require(_0x32e3('0x2'));var express=require(_0x32e3('0x3'));var router=express['Router']();var fs_extra=require(_0x32e3('0x4'));var auth=require(_0x32e3('0x5'));var interaction=require(_0x32e3('0x6'));var config=require('../../config/environment');var controller=require(_0x32e3('0x7'));router[_0x32e3('0x8')](_0x32e3('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x32e3('0xa')]('/:id',auth[_0x32e3('0xb')](),controller[_0x32e3('0xc')]);module[_0x32e3('0xd')]=router; \ No newline at end of file +var _0x7195=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','delete','exports','multer','path'];(function(_0x33a8d5,_0x2a6abb){var _0x464e38=function(_0x3ab173){while(--_0x3ab173){_0x33a8d5['push'](_0x33a8d5['shift']());}};_0x464e38(++_0x2a6abb);}(_0x7195,0xb4));var _0x5719=function(_0x20e3c5,_0x579bb1){_0x20e3c5=_0x20e3c5-0x0;var _0x152499=_0x7195[_0x20e3c5];return _0x152499;};'use strict';var multer=require(_0x5719('0x0'));var util=require('util');var path=require(_0x5719('0x1'));var timeout=require(_0x5719('0x2'));var express=require(_0x5719('0x3'));var router=express[_0x5719('0x4')]();var fs_extra=require(_0x5719('0x5'));var auth=require(_0x5719('0x6'));var interaction=require(_0x5719('0x7'));var config=require(_0x5719('0x8'));var controller=require(_0x5719('0x9'));router['put'](_0x5719('0xa'),auth[_0x5719('0xb')](),controller['update']);router[_0x5719('0xc')](_0x5719('0xa'),auth[_0x5719('0xb')](),controller['destroy']);module[_0x5719('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 88621ca..7eca0b1 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 _0x9c8a=['STRING','sequelize','exports'];(function(_0x3e5237,_0x3845d8){var _0x252880=function(_0x580d15){while(--_0x580d15){_0x3e5237['push'](_0x3e5237['shift']());}};_0x252880(++_0x3845d8);}(_0x9c8a,0x103));var _0xa9c8=function(_0x34db7a,_0x56e382){_0x34db7a=_0x34db7a-0x0;var _0x47905e=_0x9c8a[_0x34db7a];return _0x47905e;};'use strict';var Sequelize=require(_0xa9c8('0x0'));module[_0xa9c8('0x1')]={'name':{'type':Sequelize[_0xa9c8('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa9c8('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4e53=['INTEGER','sequelize','exports','STRING','name'];(function(_0x262183,_0x1cfe27){var _0x255d63=function(_0x4cc495){while(--_0x4cc495){_0x262183['push'](_0x262183['shift']());}};_0x255d63(++_0x1cfe27);}(_0x4e53,0x1a5));var _0x34e5=function(_0x441979,_0x5c4608){_0x441979=_0x441979-0x0;var _0x4b19b8=_0x4e53[_0x441979];return _0x4b19b8;};'use strict';var Sequelize=require(_0x34e5('0x0'));module[_0x34e5('0x1')]={'name':{'type':Sequelize[_0x34e5('0x2')],'allowNull':![],'unique':_0x34e5('0x3')},'OrderBy':{'type':Sequelize[_0x34e5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x34e5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0ef6660..3d11b41 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 _0xfb11=['show','keys','rawAttributes','includeAll','include','find','body','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ContactItemType','findAll','rows','catch'];(function(_0x3c60cf,_0x3103d0){var _0xfb2d7=function(_0xa63de){while(--_0xa63de){_0x3c60cf['push'](_0x3c60cf['shift']());}};_0xfb2d7(++_0x3103d0);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xfb11[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){var _0x5fc9e6=_0x4272c7[_0x1fb1('0x25')]({'plain':!![]});var _0x1353a4=_0x1fb1('0x26');return db[_0x1fb1('0x27')]['destroy']({'where':{'type':_0x1353a4,'resourceId':_0x5fc9e6['id']}})[_0x1fb1('0x23')](function(){return _0x4272c7;});})[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1898e7,_0x29e1bd){return function(_0x1a74c4){if(!_0x1a74c4){_0x1898e7[_0x1fb1('0x28')](0x194);}return _0x1a74c4;};}function handleError(_0xa7bba,_0x33a3b7){_0x33a3b7=_0x33a3b7||0x1f4;return function(_0x5e99e7){logger[_0x1fb1('0x29')](_0x5e99e7[_0x1fb1('0x2a')]);if(_0x5e99e7[_0x1fb1('0x2b')]){delete _0x5e99e7[_0x1fb1('0x2b')];}_0xa7bba['status'](_0x33a3b7)[_0x1fb1('0x2c')](_0x5e99e7);};}exports[_0x1fb1('0x2d')]=function(_0x90d8ef,_0x1b71cb){var _0x5402e9={},_0x245f84={},_0x30c8eb={'count':0x0,'rows':[]};var _0x5d45a5=_[_0x1fb1('0x2e')](db['ContactItemType']['rawAttributes'],function(_0x354e92){return{'name':_0x354e92[_0x1fb1('0x2f')],'type':_0x354e92['type'][_0x1fb1('0x30')]};});_0x245f84[_0x1fb1('0x31')]=_[_0x1fb1('0x2e')](_0x5d45a5,_0x1fb1('0x2b'));_0x245f84[_0x1fb1('0x32')]=_['keys'](_0x90d8ef[_0x1fb1('0x32')]);_0x245f84[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],_0x245f84[_0x1fb1('0x32')]);_0x5402e9[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x245f84[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x90d8ef['query'][_0x1fb1('0x36')]));_0x5402e9['attributes']=_0x5402e9[_0x1fb1('0x35')]['length']?_0x5402e9[_0x1fb1('0x35')]:_0x245f84['model'];if(!_0x90d8ef['query'][_0x1fb1('0x37')](_0x1fb1('0x38'))){_0x5402e9[_0x1fb1('0x1d')]=qs[_0x1fb1('0x1d')](_0x90d8ef['query'][_0x1fb1('0x1d')]);_0x5402e9[_0x1fb1('0x1b')]=qs[_0x1fb1('0x1b')](_0x90d8ef['query'][_0x1fb1('0x1b')]);}_0x5402e9[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3a')]);_0x5402e9[_0x1fb1('0x3b')]=qs[_0x1fb1('0x33')](_['pick'](_0x90d8ef[_0x1fb1('0x32')],_0x245f84[_0x1fb1('0x33')]),_0x5d45a5);if(_0x90d8ef['query'][_0x1fb1('0x3c')]){_0x5402e9['where']=_[_0x1fb1('0x3d')](_0x5402e9[_0x1fb1('0x3b')],{'$or':_[_0x1fb1('0x2e')](_0x5d45a5,function(_0x439eec){if(_0x439eec[_0x1fb1('0x3e')]!==_0x1fb1('0x3f')){var _0x927301={};_0x927301[_0x439eec[_0x1fb1('0x2b')]]={'$like':'%'+_0x90d8ef[_0x1fb1('0x32')][_0x1fb1('0x3c')]+'%'};return _0x927301;}})});}_0x5402e9=_[_0x1fb1('0x3d')]({},_0x5402e9,_0x90d8ef[_0x1fb1('0x40')]);var _0xafc9a7={'where':_0x5402e9[_0x1fb1('0x3b')]};return db[_0x1fb1('0x41')]['count'](_0xafc9a7)[_0x1fb1('0x23')](function(_0xca1fd3){_0x30c8eb[_0x1fb1('0x1e')]=_0xca1fd3;if(_0x90d8ef[_0x1fb1('0x32')]['includeAll']){_0x5402e9['include']=[{'all':!![]}];}return db[_0x1fb1('0x41')][_0x1fb1('0x42')](_0x5402e9);})[_0x1fb1('0x23')](function(_0x3edc8a){_0x30c8eb[_0x1fb1('0x43')]=_0x3edc8a;return _0x30c8eb;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x1b71cb,_0x5402e9))[_0x1fb1('0x44')](handleError(_0x1b71cb,null));};exports[_0x1fb1('0x45')]=function(_0x14aa27,_0x320bda){var _0x4a943c={'raw':!![],'where':{'id':_0x14aa27['params']['id']}},_0x44ccbe={};_0x44ccbe['model']=_[_0x1fb1('0x46')](db[_0x1fb1('0x41')][_0x1fb1('0x47')]);_0x44ccbe[_0x1fb1('0x32')]=_['keys'](_0x14aa27['query']);_0x44ccbe[_0x1fb1('0x33')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],_0x44ccbe[_0x1fb1('0x32')]);_0x4a943c[_0x1fb1('0x35')]=_[_0x1fb1('0x34')](_0x44ccbe[_0x1fb1('0x31')],qs[_0x1fb1('0x36')](_0x14aa27[_0x1fb1('0x32')]['fields']));_0x4a943c['attributes']=_0x4a943c[_0x1fb1('0x35')]['length']?_0x4a943c[_0x1fb1('0x35')]:_0x44ccbe[_0x1fb1('0x31')];if(_0x14aa27[_0x1fb1('0x32')][_0x1fb1('0x48')]){_0x4a943c[_0x1fb1('0x49')]=[{'all':!![]}];}_0x4a943c=_[_0x1fb1('0x3d')]({},_0x4a943c,_0x14aa27['options']);return db[_0x1fb1('0x41')][_0x1fb1('0x4a')](_0x4a943c)[_0x1fb1('0x23')](handleEntityNotFound(_0x320bda,null))['then'](respondWithResult(_0x320bda,null))[_0x1fb1('0x44')](handleError(_0x320bda,null));};exports['create']=function(_0x6e105b,_0xba4fa7){return db[_0x1fb1('0x41')]['create'](_0x6e105b[_0x1fb1('0x4b')],{})[_0x1fb1('0x23')](function(_0x52271f){var _0xe492ab=_0x6e105b[_0x1fb1('0x4c')][_0x1fb1('0x25')]({'plain':!![]});if(!_0xe492ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe492ab['role']==='user'){var _0x31a85a=_0x52271f[_0x1fb1('0x25')]({'plain':!![]});var _0x1e2754=_0x1fb1('0x26');return db[_0x1fb1('0x4d')][_0x1fb1('0x4a')]({'where':{'name':_0x1e2754,'userProfileId':_0xe492ab['userProfileId']},'raw':!![]})['then'](function(_0x267c36){if(_0x267c36&&_0x267c36[_0x1fb1('0x4e')]===0x0){return db[_0x1fb1('0x27')][_0x1fb1('0x4f')]({'name':_0x31a85a['name'],'resourceId':_0x31a85a['id'],'type':_0x267c36['name'],'sectionId':_0x267c36['id']},{})[_0x1fb1('0x23')](function(){return _0x52271f;});}else{return _0x52271f;}})['catch'](function(_0x41fefb){logger['error'](_0x1fb1('0x50'),_0x41fefb);throw _0x41fefb;});}return _0x52271f;})['then'](respondWithResult(_0xba4fa7,0xc9))[_0x1fb1('0x44')](handleError(_0xba4fa7,null));};exports[_0x1fb1('0x22')]=function(_0x1475ee,_0xca9395){if(_0x1475ee[_0x1fb1('0x4b')]['id']){delete _0x1475ee['body']['id'];}return db['ContactItemType'][_0x1fb1('0x4a')]({'where':{'id':_0x1475ee[_0x1fb1('0x51')]['id']}})['then'](handleEntityNotFound(_0xca9395,null))['then'](saveUpdates(_0x1475ee[_0x1fb1('0x4b')],null))[_0x1fb1('0x23')](respondWithResult(_0xca9395,null))[_0x1fb1('0x44')](handleError(_0xca9395,null));};exports[_0x1fb1('0x24')]=function(_0x439670,_0xc9e8d4){return db['ContactItemType'][_0x1fb1('0x4a')]({'where':{'id':_0x439670[_0x1fb1('0x51')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xc9e8d4,null))[_0x1fb1('0x23')](db[_0x1fb1('0x52')][_0x1fb1('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x439670[_0x1fb1('0x51')]['id']}}))['then'](removeEntity(_0xc9e8d4,null))[_0x1fb1('0x44')](handleError(_0xc9e8d4,null));}; \ No newline at end of file +var _0x955f=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','user','catch'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x955f,0x1eb));var _0xf955=function(_0x4b9adf,_0x2d9552){_0x4b9adf=_0x4b9adf-0x0;var _0x2b4a52=_0x955f[_0x4b9adf];return _0x2b4a52;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){var _0x102e36=_0x3585c7[_0xf955('0x26')]({'plain':!![]});var _0x552cf3=_0xf955('0x27');return db[_0xf955('0x28')][_0xf955('0x25')]({'where':{'type':_0x552cf3,'resourceId':_0x102e36['id']}})[_0xf955('0x24')](function(){return _0x3585c7;});})[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x51f3ab,_0x3caea6){return function(_0x145098){if(!_0x145098){_0x51f3ab[_0xf955('0x17')](0x194);}return _0x145098;};}function handleError(_0xbd0b74,_0x28fa9c){_0x28fa9c=_0x28fa9c||0x1f4;return function(_0x264f6d){logger['error'](_0x264f6d[_0xf955('0x29')]);if(_0x264f6d[_0xf955('0x2a')]){delete _0x264f6d['name'];}_0xbd0b74[_0xf955('0x18')](_0x28fa9c)[_0xf955('0x2b')](_0x264f6d);};}exports[_0xf955('0x2c')]=function(_0x1ef794,_0x59bfb5){var _0x3a951c={},_0x518fb3={},_0x227104={'count':0x0,'rows':[]};var _0x2c222a=_[_0xf955('0x2d')](db[_0xf955('0x2e')][_0xf955('0x2f')],function(_0x32121b){return{'name':_0x32121b[_0xf955('0x30')],'type':_0x32121b[_0xf955('0x31')]['key']};});_0x518fb3[_0xf955('0x32')]=_[_0xf955('0x2d')](_0x2c222a,_0xf955('0x2a'));_0x518fb3[_0xf955('0x33')]=_['keys'](_0x1ef794[_0xf955('0x33')]);_0x518fb3[_0xf955('0x34')]=_[_0xf955('0x35')](_0x518fb3[_0xf955('0x32')],_0x518fb3[_0xf955('0x33')]);_0x3a951c['attributes']=_['intersection'](_0x518fb3['model'],qs[_0xf955('0x36')](_0x1ef794[_0xf955('0x33')][_0xf955('0x36')]));_0x3a951c[_0xf955('0x37')]=_0x3a951c[_0xf955('0x37')][_0xf955('0x38')]?_0x3a951c['attributes']:_0x518fb3[_0xf955('0x32')];if(!_0x1ef794['query'][_0xf955('0x39')](_0xf955('0x3a'))){_0x3a951c[_0xf955('0x1c')]=qs['limit'](_0x1ef794[_0xf955('0x33')]['limit']);_0x3a951c[_0xf955('0x1d')]=qs[_0xf955('0x1d')](_0x1ef794[_0xf955('0x33')][_0xf955('0x1d')]);}_0x3a951c['order']=qs[_0xf955('0x3b')](_0x1ef794[_0xf955('0x33')]['sort']);_0x3a951c[_0xf955('0x3c')]=qs[_0xf955('0x34')](_[_0xf955('0x3d')](_0x1ef794['query'],_0x518fb3[_0xf955('0x34')]),_0x2c222a);if(_0x1ef794[_0xf955('0x33')][_0xf955('0x3e')]){_0x3a951c['where']=_[_0xf955('0x3f')](_0x3a951c[_0xf955('0x3c')],{'$or':_[_0xf955('0x2d')](_0x2c222a,function(_0x2069f3){if(_0x2069f3[_0xf955('0x31')]!==_0xf955('0x40')){var _0x2b614d={};_0x2b614d[_0x2069f3[_0xf955('0x2a')]]={'$like':'%'+_0x1ef794['query'][_0xf955('0x3e')]+'%'};return _0x2b614d;}})});}_0x3a951c=_[_0xf955('0x3f')]({},_0x3a951c,_0x1ef794[_0xf955('0x41')]);var _0xe633fa={'where':_0x3a951c[_0xf955('0x3c')]};return db[_0xf955('0x2e')][_0xf955('0x1e')](_0xe633fa)[_0xf955('0x24')](function(_0x47651b){_0x227104[_0xf955('0x1e')]=_0x47651b;if(_0x1ef794[_0xf955('0x33')][_0xf955('0x42')]){_0x3a951c[_0xf955('0x43')]=[{'all':!![]}];}return db[_0xf955('0x2e')][_0xf955('0x44')](_0x3a951c);})[_0xf955('0x24')](function(_0x356ec2){_0x227104[_0xf955('0x45')]=_0x356ec2;return _0x227104;})[_0xf955('0x24')](respondWithFilteredResult(_0x59bfb5,_0x3a951c))['catch'](handleError(_0x59bfb5,null));};exports[_0xf955('0x46')]=function(_0x25d809,_0x2db18d){var _0x5f0ef9={'raw':!![],'where':{'id':_0x25d809['params']['id']}},_0x16fc1a={};_0x16fc1a[_0xf955('0x32')]=_['keys'](db[_0xf955('0x2e')][_0xf955('0x2f')]);_0x16fc1a[_0xf955('0x33')]=_[_0xf955('0x47')](_0x25d809['query']);_0x16fc1a[_0xf955('0x34')]=_[_0xf955('0x35')](_0x16fc1a[_0xf955('0x32')],_0x16fc1a['query']);_0x5f0ef9['attributes']=_[_0xf955('0x35')](_0x16fc1a[_0xf955('0x32')],qs[_0xf955('0x36')](_0x25d809[_0xf955('0x33')]['fields']));_0x5f0ef9[_0xf955('0x37')]=_0x5f0ef9[_0xf955('0x37')][_0xf955('0x38')]?_0x5f0ef9['attributes']:_0x16fc1a[_0xf955('0x32')];if(_0x25d809['query'][_0xf955('0x42')]){_0x5f0ef9[_0xf955('0x43')]=[{'all':!![]}];}_0x5f0ef9=_[_0xf955('0x3f')]({},_0x5f0ef9,_0x25d809['options']);return db[_0xf955('0x2e')][_0xf955('0x48')](_0x5f0ef9)[_0xf955('0x24')](handleEntityNotFound(_0x2db18d,null))[_0xf955('0x24')](respondWithResult(_0x2db18d,null))['catch'](handleError(_0x2db18d,null));};exports[_0xf955('0x49')]=function(_0x4ff0f1,_0x1c6d76){return db[_0xf955('0x2e')][_0xf955('0x49')](_0x4ff0f1['body'],{})[_0xf955('0x24')](function(_0x4e7269){var _0x35c23c=_0x4ff0f1['user'][_0xf955('0x26')]({'plain':!![]});if(!_0x35c23c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35c23c['role']===_0xf955('0x4a')){var _0x45c7fe=_0x4e7269['get']({'plain':!![]});var _0x142e8f='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x142e8f,'userProfileId':_0x35c23c['userProfileId']},'raw':!![]})[_0xf955('0x24')](function(_0x1abe1c){if(_0x1abe1c&&_0x1abe1c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf955('0x49')]({'name':_0x45c7fe[_0xf955('0x2a')],'resourceId':_0x45c7fe['id'],'type':_0x1abe1c[_0xf955('0x2a')],'sectionId':_0x1abe1c['id']},{})[_0xf955('0x24')](function(){return _0x4e7269;});}else{return _0x4e7269;}})[_0xf955('0x4b')](function(_0xa56483){logger[_0xf955('0x4c')](_0xf955('0x4d'),_0xa56483);throw _0xa56483;});}return _0x4e7269;})[_0xf955('0x24')](respondWithResult(_0x1c6d76,0xc9))[_0xf955('0x4b')](handleError(_0x1c6d76,null));};exports[_0xf955('0x23')]=function(_0x350873,_0x47a3a6){if(_0x350873[_0xf955('0x4e')]['id']){delete _0x350873[_0xf955('0x4e')]['id'];}return db[_0xf955('0x2e')][_0xf955('0x48')]({'where':{'id':_0x350873[_0xf955('0x4f')]['id']}})['then'](handleEntityNotFound(_0x47a3a6,null))[_0xf955('0x24')](saveUpdates(_0x350873[_0xf955('0x4e')],null))[_0xf955('0x24')](respondWithResult(_0x47a3a6,null))[_0xf955('0x4b')](handleError(_0x47a3a6,null));};exports[_0xf955('0x25')]=function(_0x9057df,_0x228d59){return db[_0xf955('0x2e')][_0xf955('0x48')]({'where':{'id':_0x9057df[_0xf955('0x4f')]['id']}})['then'](handleEntityNotFound(_0x228d59,null))[_0xf955('0x24')](db[_0xf955('0x50')][_0xf955('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x9057df[_0xf955('0x4f')]['id']}}))[_0xf955('0x24')](removeEntity(_0x228d59,null))[_0xf955('0x4b')](handleError(_0x228d59,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d587c88..6474173 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 _0xe924=['api','moment','bluebird','path','rimraf','./contactItemType.attributes','exports','define','lodash','../../config/logger'];(function(_0x51d98c,_0x591b77){var _0x52a73e=function(_0x2329d9){while(--_0x2329d9){_0x51d98c['push'](_0x51d98c['shift']());}};_0x52a73e(++_0x591b77);}(_0xe924,0x1de));var _0x4e92=function(_0x28b34a,_0x3d5f72){_0x28b34a=_0x28b34a-0x0;var _0x596278=_0xe924[_0x28b34a];return _0x596278;};'use strict';var _=require(_0x4e92('0x0'));var util=require('util');var logger=require(_0x4e92('0x1'))(_0x4e92('0x2'));var moment=require(_0x4e92('0x3'));var BPromise=require(_0x4e92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e92('0x5'));var rimraf=require(_0x4e92('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e92('0x7'));module[_0x4e92('0x8')]=function(_0x32829e,_0x517e6c){return _0x32829e[_0x4e92('0x9')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x180d=['define','ContactItemType','tools_contact_item_types','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x111073,_0x39cae3){var _0x12e5fd=function(_0x5ca26d){while(--_0x5ca26d){_0x111073['push'](_0x111073['shift']());}};_0x12e5fd(++_0x39cae3);}(_0x180d,0xdb));var _0xd180=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x180d[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd180('0x0'))(_0xd180('0x1'));var moment=require(_0xd180('0x2'));var BPromise=require(_0xd180('0x3'));var rp=require(_0xd180('0x4'));var fs=require('fs');var path=require(_0xd180('0x5'));var rimraf=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var attributes=require(_0xd180('0x8'));module['exports']=function(_0x4efafd,_0xc58974){return _0x4efafd[_0xd180('0x9')](_0xd180('0xa'),attributes,{'tableName':_0xd180('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 b315059..f66f796 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 _0x8547=['jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x374954,_0x18dc36){var _0x42073e=function(_0x1cb45f){while(--_0x1cb45f){_0x374954['push'](_0x374954['shift']());}};_0x42073e(++_0x18dc36);}(_0x8547,0x1ae));var _0x7854=function(_0x31ad4b,_0x86e879){_0x31ad4b=_0x31ad4b-0x0;var _0x4ebb69=_0x8547[_0x31ad4b];return _0x4ebb69;};'use strict';var _=require(_0x7854('0x0'));var util=require(_0x7854('0x1'));var moment=require(_0x7854('0x2'));var BPromise=require(_0x7854('0x3'));var rs=require(_0x7854('0x4'));var fs=require('fs');var Redis=require(_0x7854('0x5'));var db=require(_0x7854('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7854('0x7'))(_0x7854('0x8'));var config=require(_0x7854('0x9'));var jayson=require(_0x7854('0xa'));var client=jayson['client'][_0x7854('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe88928,_0x1e678c,_0xde5ac){return new BPromise(function(_0x19eea5,_0x342e3b){return client[_0x7854('0xc')](_0xe88928,_0xde5ac)[_0x7854('0xd')](function(_0x26a561){logger['info'](_0x7854('0xe'),_0x1e678c,_0x7854('0xf'));logger[_0x7854('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1e678c,_0x7854('0xf'),JSON[_0x7854('0x11')](_0x26a561));if(_0x26a561[_0x7854('0x12')]){if(_0x26a561['error']['code']===0x1f4){logger[_0x7854('0x12')](_0x7854('0xe'),_0x1e678c,_0x26a561['error'][_0x7854('0x13')]);return _0x342e3b(_0x26a561[_0x7854('0x12')][_0x7854('0x13')]);}logger[_0x7854('0x12')](_0x7854('0xe'),_0x1e678c,_0x26a561[_0x7854('0x12')][_0x7854('0x13')]);return _0x19eea5(_0x26a561[_0x7854('0x12')][_0x7854('0x13')]);}else{logger['info'](_0x7854('0xe'),_0x1e678c,_0x7854('0xf'));_0x19eea5(_0x26a561[_0x7854('0x14')][_0x7854('0x13')]);}})[_0x7854('0x15')](function(_0x1b57f0){logger[_0x7854('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1e678c,_0x1b57f0);_0x342e3b(_0x1b57f0);});});} \ No newline at end of file +var _0x0a6b=['http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x157784,_0x3be5bb){var _0x43909c=function(_0x4b02cd){while(--_0x4b02cd){_0x157784['push'](_0x157784['shift']());}};_0x43909c(++_0x3be5bb);}(_0x0a6b,0x120));var _0xb0a6=function(_0x3d44e9,_0x2e8d17){_0x3d44e9=_0x3d44e9-0x0;var _0x40f2cf=_0x0a6b[_0x3d44e9];return _0x40f2cf;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require(_0xb0a6('0x1'));var BPromise=require(_0xb0a6('0x2'));var rs=require(_0xb0a6('0x3'));var fs=require('fs');var Redis=require(_0xb0a6('0x4'));var db=require(_0xb0a6('0x5'))['db'];var utils=require(_0xb0a6('0x6'));var logger=require(_0xb0a6('0x7'))(_0xb0a6('0x8'));var config=require(_0xb0a6('0x9'));var jayson=require(_0xb0a6('0xa'));var client=jayson['client'][_0xb0a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x504a45,_0x23e004,_0x490cfc){return new BPromise(function(_0x597b68,_0xdaa894){return client['request'](_0x504a45,_0x490cfc)[_0xb0a6('0xc')](function(_0x423683){logger['info'](_0xb0a6('0xd'),_0x23e004,_0xb0a6('0xe'));logger['debug'](_0xb0a6('0xf'),_0x23e004,_0xb0a6('0xe'),JSON[_0xb0a6('0x10')](_0x423683));if(_0x423683[_0xb0a6('0x11')]){if(_0x423683[_0xb0a6('0x11')][_0xb0a6('0x12')]===0x1f4){logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x423683['error'][_0xb0a6('0x13')]);return _0xdaa894(_0x423683[_0xb0a6('0x11')][_0xb0a6('0x13')]);}logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x423683['error'][_0xb0a6('0x13')]);return _0x597b68(_0x423683[_0xb0a6('0x11')]['message']);}else{logger[_0xb0a6('0x14')]('ContactItemType,\x20%s,\x20%s',_0x23e004,'request\x20sent');_0x597b68(_0x423683[_0xb0a6('0x15')][_0xb0a6('0x13')]);}})[_0xb0a6('0x16')](function(_0x2ef938){logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x2ef938);_0xdaa894(_0x2ef938);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 0632ef9..5fd9d33 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 _0x26ae=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4520cf,_0x55a167){var _0x470206=function(_0x3de8a5){while(--_0x3de8a5){_0x4520cf['push'](_0x4520cf['shift']());}};_0x470206(++_0x55a167);}(_0x26ae,0x122));var _0xe26a=function(_0x729896,_0x101131){_0x729896=_0x729896-0x0;var _0x36c6aa=_0x26ae[_0x729896];return _0x36c6aa;};'use strict';var multer=require(_0xe26a('0x0'));var util=require(_0xe26a('0x1'));var path=require(_0xe26a('0x2'));var timeout=require(_0xe26a('0x3'));var express=require('express');var router=express[_0xe26a('0x4')]();var fs_extra=require(_0xe26a('0x5'));var auth=require(_0xe26a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe26a('0x7'));router[_0xe26a('0x8')]('/',auth[_0xe26a('0x9')](),controller[_0xe26a('0xa')]);router[_0xe26a('0x8')](_0xe26a('0xb'),auth['isAuthenticated'](),controller[_0xe26a('0xc')]);router[_0xe26a('0xd')]('/',auth[_0xe26a('0x9')](),controller[_0xe26a('0xe')]);router['put'](_0xe26a('0xb'),auth[_0xe26a('0x9')](),controller[_0xe26a('0xf')]);router[_0xe26a('0x10')](_0xe26a('0xb'),auth['isAuthenticated'](),controller[_0xe26a('0x11')]);module[_0xe26a('0x12')]=router; \ No newline at end of file +var _0x77aa=['index','get','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77aa,0x126));var _0xa77a=function(_0x5470ef,_0x1c9453){_0x5470ef=_0x5470ef-0x0;var _0x5a0e81=_0x77aa[_0x5470ef];return _0x5a0e81;};'use strict';var multer=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var path=require(_0xa77a('0x2'));var timeout=require(_0xa77a('0x3'));var express=require(_0xa77a('0x4'));var router=express[_0xa77a('0x5')]();var fs_extra=require(_0xa77a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa77a('0x7'));var config=require(_0xa77a('0x8'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0xa77a('0x9')](),controller[_0xa77a('0xa')]);router[_0xa77a('0xb')](_0xa77a('0xc'),auth[_0xa77a('0x9')](),controller[_0xa77a('0xd')]);router[_0xa77a('0xe')]('/',auth['isAuthenticated'](),controller[_0xa77a('0xf')]);router[_0xa77a('0x10')](_0xa77a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa77a('0x11')](_0xa77a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa77a('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 2560dc6..fec304a 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x1a4227,_0x24a351){var _0x47bf20=function(_0x20df4b){while(--_0x20df4b){_0x1a4227['push'](_0x1a4227['shift']());}};_0x47bf20(++_0x24a351);}(_0x2032,0xd9));var _0x2203=function(_0x293c0b,_0x4a0c11){_0x293c0b=_0x293c0b-0x0;var _0xf6743f=_0x2032[_0x293c0b];return _0xf6743f;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 087e2da..7a9ed44 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 _0x0285=['attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','register','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','get','CustomDashboards','status','end','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','merge','filter','options','includeAll','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','update','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x0285,0x17d));var _0x5028=function(_0xfcb0f1,_0x3f2d57){_0xfcb0f1=_0xfcb0f1-0x0;var _0x4ed14e=_0x0285[_0xfcb0f1];return _0x4ed14e;};'use strict';var emlformat=require(_0x5028('0x0'));var rimraf=require(_0x5028('0x1'));var zipdir=require(_0x5028('0x2'));var jsonpatch=require(_0x5028('0x3'));var rp=require(_0x5028('0x4'));var moment=require(_0x5028('0x5'));var BPromise=require(_0x5028('0x6'));var Mustache=require(_0x5028('0x7'));var util=require(_0x5028('0x8'));var path=require(_0x5028('0x9'));var sox=require('sox');var csv=require(_0x5028('0xa'));var ejs=require(_0x5028('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5028('0xc'));var squel=require('squel');var crypto=require(_0x5028('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5028('0xa'));var querystring=require(_0x5028('0xe'));var Papa=require(_0x5028('0xf'));var Redis=require(_0x5028('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5028('0x11'));var as=require(_0x5028('0x12'));var hardwareService=require(_0x5028('0x13'));var logger=require(_0x5028('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5028('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5028('0x16')](config[_0x5028('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5028('0x18'))(new Redis(config[_0x5028('0x17')]));require('./dashboard.socket')[_0x5028('0x19')](socket);function respondWithStatusCode(_0x42367c,_0x5efcd3){_0x5efcd3=_0x5efcd3||0xcc;return function(_0x5ca05d){if(_0x5ca05d){return _0x42367c[_0x5028('0x1a')](_0x5efcd3);}return _0x42367c['status'](_0x5efcd3)['end']();};}function respondWithResult(_0x506fd4,_0x18aec4){_0x18aec4=_0x18aec4||0xc8;return function(_0x2653fe){if(_0x2653fe){return _0x506fd4['status'](_0x18aec4)[_0x5028('0x1b')](_0x2653fe);}};}function respondWithFilteredResult(_0x2f73e3,_0x3e1d50){return function(_0x3524de){if(_0x3524de){var _0x11edb6=typeof _0x3e1d50[_0x5028('0x1c')]==='undefined'&&typeof _0x3e1d50[_0x5028('0x1d')]===_0x5028('0x1e');var _0x322842=_0x3524de[_0x5028('0x1f')];var _0x5199b1=_0x11edb6?0x0:_0x3e1d50[_0x5028('0x1c')];var _0x36b504=_0x11edb6?_0x3524de['count']:_0x3e1d50[_0x5028('0x1c')]+_0x3e1d50[_0x5028('0x1d')];var _0x26060d;if(_0x36b504>=_0x322842){_0x36b504=_0x322842;_0x26060d=0xc8;}else{_0x26060d=0xce;}_0x2f73e3['status'](_0x26060d);return _0x2f73e3['set'](_0x5028('0x20'),_0x5199b1+'-'+_0x36b504+'/'+_0x322842)[_0x5028('0x1b')](_0x3524de);}return null;};}function patchUpdates(_0x287543){return function(_0x1bf925){try{jsonpatch[_0x5028('0x21')](_0x1bf925,_0x287543,!![]);}catch(_0x2336ad){return BPromise[_0x5028('0x22')](_0x2336ad);}return _0x1bf925[_0x5028('0x23')]();};}function saveUpdates(_0x135b80,_0x4250e7){return function(_0x173d67){if(_0x173d67){return _0x173d67['update'](_0x135b80)['then'](function(_0x4cef5b){return _0x4cef5b;});}return null;};}function removeEntity(_0x1e33e4,_0x5d4bb7){return function(_0x526326){if(_0x526326){return _0x526326[_0x5028('0x24')]()[_0x5028('0x25')](function(){var _0x4a0326=_0x526326[_0x5028('0x26')]({'plain':!![]});var _0x31cadc=_0x5028('0x27');return db['UserProfileResource'][_0x5028('0x24')]({'where':{'type':_0x31cadc,'resourceId':_0x4a0326['id']}})[_0x5028('0x25')](function(){return _0x526326;});})['then'](function(){_0x1e33e4[_0x5028('0x28')](0xcc)[_0x5028('0x29')]();});}};}function handleEntityNotFound(_0x3eee52,_0x3b3a88){return function(_0x3ddae4){if(!_0x3ddae4){_0x3eee52[_0x5028('0x1a')](0x194);}return _0x3ddae4;};}function handleError(_0xf60305,_0x2e5955){_0x2e5955=_0x2e5955||0x1f4;return function(_0xfb3311){logger[_0x5028('0x2a')](_0xfb3311[_0x5028('0x2b')]);if(_0xfb3311[_0x5028('0x2c')]){delete _0xfb3311['name'];}_0xf60305[_0x5028('0x28')](_0x2e5955)['send'](_0xfb3311);};}exports[_0x5028('0x2d')]=function(_0x42cd51,_0x395ffe){var _0x17bef6={},_0x52449e={},_0x12cb0c={'count':0x0,'rows':[]};var _0x2ac7cc=_[_0x5028('0x2e')](db[_0x5028('0x2f')][_0x5028('0x30')],function(_0x426942){return{'name':_0x426942[_0x5028('0x31')],'type':_0x426942[_0x5028('0x32')][_0x5028('0x33')]};});_0x52449e[_0x5028('0x34')]=_[_0x5028('0x2e')](_0x2ac7cc,'name');_0x52449e[_0x5028('0x35')]=_[_0x5028('0x36')](_0x42cd51[_0x5028('0x35')]);_0x52449e['filters']=_[_0x5028('0x37')](_0x52449e[_0x5028('0x34')],_0x52449e[_0x5028('0x35')]);_0x17bef6[_0x5028('0x38')]=_[_0x5028('0x37')](_0x52449e['model'],qs[_0x5028('0x39')](_0x42cd51[_0x5028('0x35')][_0x5028('0x39')]));_0x17bef6[_0x5028('0x38')]=_0x17bef6[_0x5028('0x38')][_0x5028('0x3a')]?_0x17bef6[_0x5028('0x38')]:_0x52449e[_0x5028('0x34')];if(!_0x42cd51['query']['hasOwnProperty'](_0x5028('0x3b'))){_0x17bef6[_0x5028('0x1d')]=qs['limit'](_0x42cd51[_0x5028('0x35')][_0x5028('0x1d')]);_0x17bef6['offset']=qs['offset'](_0x42cd51[_0x5028('0x35')]['offset']);}_0x17bef6['order']=qs[_0x5028('0x3c')](_0x42cd51['query']['sort']);_0x17bef6[_0x5028('0x3d')]=qs['filters'](_[_0x5028('0x3e')](_0x42cd51['query'],_0x52449e[_0x5028('0x3f')]),_0x2ac7cc);if(_0x42cd51['query']['filter']){_0x17bef6[_0x5028('0x3d')]=_[_0x5028('0x40')](_0x17bef6['where'],{'$or':_['map'](_0x2ac7cc,function(_0x498054){if(_0x498054[_0x5028('0x32')]!=='VIRTUAL'){var _0xcde52f={};_0xcde52f[_0x498054[_0x5028('0x2c')]]={'$like':'%'+_0x42cd51['query'][_0x5028('0x41')]+'%'};return _0xcde52f;}})});}_0x17bef6=_[_0x5028('0x40')]({},_0x17bef6,_0x42cd51[_0x5028('0x42')]);var _0x5b8623={'where':_0x17bef6[_0x5028('0x3d')]};return db['Dashboard'][_0x5028('0x1f')](_0x5b8623)['then'](function(_0x1df06d){_0x12cb0c[_0x5028('0x1f')]=_0x1df06d;if(_0x42cd51[_0x5028('0x35')][_0x5028('0x43')]){_0x17bef6['include']=[{'all':!![]}];}return db[_0x5028('0x2f')][_0x5028('0x44')](_0x17bef6);})[_0x5028('0x25')](function(_0x241462){_0x12cb0c['rows']=_0x241462;return _0x12cb0c;})[_0x5028('0x25')](respondWithFilteredResult(_0x395ffe,_0x17bef6))[_0x5028('0x45')](handleError(_0x395ffe,null));};exports[_0x5028('0x46')]=function(_0x342caf,_0x2deff5){var _0x43b978={'raw':![],'where':{'id':_0x342caf[_0x5028('0x47')]['id']}},_0x522cde={};_0x522cde['model']=_[_0x5028('0x36')](db[_0x5028('0x2f')][_0x5028('0x30')]);_0x522cde[_0x5028('0x35')]=_['keys'](_0x342caf['query']);_0x522cde['filters']=_['intersection'](_0x522cde[_0x5028('0x34')],_0x522cde['query']);_0x43b978[_0x5028('0x38')]=_[_0x5028('0x37')](_0x522cde[_0x5028('0x34')],qs[_0x5028('0x39')](_0x342caf[_0x5028('0x35')][_0x5028('0x39')]));_0x43b978[_0x5028('0x38')]=_0x43b978['attributes'][_0x5028('0x3a')]?_0x43b978['attributes']:_0x522cde[_0x5028('0x34')];if(_0x342caf[_0x5028('0x35')][_0x5028('0x43')]){_0x43b978['include']=[{'all':!![]}];}_0x43b978=_[_0x5028('0x40')]({},_0x43b978,_0x342caf[_0x5028('0x42')]);return db[_0x5028('0x2f')][_0x5028('0x48')](_0x43b978)[_0x5028('0x25')](handleEntityNotFound(_0x2deff5,null))['then'](respondWithResult(_0x2deff5,null))[_0x5028('0x45')](handleError(_0x2deff5,null));};exports[_0x5028('0x49')]=function(_0x4a9bc1,_0x5906c6){return db['Dashboard']['create'](_0x4a9bc1[_0x5028('0x4a')],{})[_0x5028('0x25')](function(_0x3f8c43){var _0x1a53b5=_0x4a9bc1[_0x5028('0x4b')]['get']({'plain':!![]});if(!_0x1a53b5)throw new Error(_0x5028('0x4c'));if(_0x1a53b5[_0x5028('0x4d')]===_0x5028('0x4b')){var _0x4ab730=_0x3f8c43[_0x5028('0x26')]({'plain':!![]});var _0x361b79=_0x5028('0x27');return db[_0x5028('0x4e')][_0x5028('0x48')]({'where':{'name':_0x361b79,'userProfileId':_0x1a53b5[_0x5028('0x4f')]},'raw':!![]})[_0x5028('0x25')](function(_0x550933){if(_0x550933&&_0x550933[_0x5028('0x50')]===0x0){return db[_0x5028('0x51')][_0x5028('0x49')]({'name':_0x4ab730[_0x5028('0x2c')],'resourceId':_0x4ab730['id'],'type':_0x550933[_0x5028('0x2c')],'sectionId':_0x550933['id']},{})['then'](function(){return _0x3f8c43;});}else{return _0x3f8c43;}})[_0x5028('0x45')](function(_0x25c113){logger['error'](_0x5028('0x52'),_0x25c113);throw _0x25c113;});}return _0x3f8c43;})[_0x5028('0x25')](respondWithResult(_0x5906c6,0xc9))[_0x5028('0x45')](handleError(_0x5906c6,null));};exports[_0x5028('0x53')]=function(_0x4d0633,_0x307edc){var _0x526a2a={'where':{'id':_0x4d0633[_0x5028('0x47')]['id']}},_0x472f78={};_0x472f78[_0x5028('0x34')]=_[_0x5028('0x36')](db[_0x5028('0x2f')][_0x5028('0x30')]);_0x526a2a['attributes']=_[_0x5028('0x37')](_0x472f78['model'],qs[_0x5028('0x39')](_0x4d0633['query'][_0x5028('0x39')]));_0x526a2a['attributes']=_0x526a2a[_0x5028('0x38')]['length']?_0x526a2a['attributes']:_0x472f78[_0x5028('0x34')];if(_0x4d0633[_0x5028('0x35')][_0x5028('0x43')]){_0x526a2a[_0x5028('0x54')]=[{'all':!![]}];}_0x526a2a=_['merge']({},_0x526a2a,_0x4d0633[_0x5028('0x42')]);return db[_0x5028('0x2f')][_0x5028('0x48')](_0x526a2a)[_0x5028('0x25')](handleEntityNotFound(_0x307edc,null))[_0x5028('0x25')](function(_0x11ae56){if(_0x11ae56){var _0x277e3a=_0x11ae56[_0x5028('0x26')]({'plain':!![]});_0x277e3a=qs[_0x5028('0x55')](_0x277e3a,['id',_0x5028('0x56'),_0x5028('0x57')]);_0x4d0633[_0x5028('0x4a')]=_[_0x5028('0x55')](_0x4d0633[_0x5028('0x4a')],['id',_0x5028('0x56'),_0x5028('0x57')]);return db[_0x5028('0x2f')][_0x5028('0x49')](_[_0x5028('0x40')](_0x277e3a,_0x4d0633[_0x5028('0x4a')]),{'include':_0x4d0633[_0x5028('0x35')][_0x5028('0x43')]?[{'all':!![]}]:undefined})[_0x5028('0x25')](function(_0x4bd09e){var _0x19f101=_0x4d0633[_0x5028('0x4b')][_0x5028('0x26')]({'plain':!![]});if(!_0x19f101)throw new Error(_0x5028('0x4c'));if(_0x19f101[_0x5028('0x4d')]===_0x5028('0x4b')){var _0x839826=_0x4bd09e[_0x5028('0x26')]({'plain':!![]});var _0x438743=_0x5028('0x27');return db[_0x5028('0x4e')][_0x5028('0x48')]({'where':{'name':_0x438743,'userProfileId':_0x19f101['userProfileId']},'raw':!![]})[_0x5028('0x25')](function(_0xcbf5a8){if(_0xcbf5a8&&_0xcbf5a8[_0x5028('0x50')]===0x0){return db[_0x5028('0x51')][_0x5028('0x49')]({'name':_0x839826[_0x5028('0x2c')],'resourceId':_0x839826['id'],'type':_0xcbf5a8[_0x5028('0x2c')],'sectionId':_0xcbf5a8['id']},{})['then'](function(){return _0x4bd09e;});}else{return _0x4bd09e;}})[_0x5028('0x45')](function(_0x4bb454){logger[_0x5028('0x2a')](_0x5028('0x52'),_0x4bb454);throw _0x4bb454;});}return _0x4bd09e;});}})['then'](respondWithResult(_0x307edc,0xc9))[_0x5028('0x45')](handleError(_0x307edc,null));};exports[_0x5028('0x58')]=function(_0x323e0e,_0x2dc8ae){if(_0x323e0e['body']['id']){delete _0x323e0e[_0x5028('0x4a')]['id'];}return db[_0x5028('0x2f')][_0x5028('0x48')]({'where':{'id':_0x323e0e[_0x5028('0x47')]['id']}})['then'](handleEntityNotFound(_0x2dc8ae,null))[_0x5028('0x25')](saveUpdates(_0x323e0e[_0x5028('0x4a')],null))[_0x5028('0x25')](respondWithResult(_0x2dc8ae,null))[_0x5028('0x45')](handleError(_0x2dc8ae,null));};exports[_0x5028('0x24')]=function(_0x233622,_0x56afb2){return db[_0x5028('0x2f')][_0x5028('0x48')]({'where':{'id':_0x233622['params']['id']}})[_0x5028('0x25')](handleEntityNotFound(_0x56afb2,null))['then'](removeEntity(_0x56afb2,null))['catch'](handleError(_0x56afb2,null));};function widgetAttributes(_0x3a9d12){try{switch(_0x3a9d12['type']){case'iframe':return[{'name':'attrUrl','value':_0x3a9d12[_0x5028('0x59')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0]['value']:undefined)||_0x5028('0x5b')}];case'custom':return[{'name':_0x5028('0x5c'),'value':_0x3a9d12[_0x5028('0x5c')]||(_0x3a9d12['attrs']&&_0x3a9d12['attrs'][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0][_0x5028('0x5d')]:undefined)||''}];case _0x5028('0x5e'):return[{'name':_0x5028('0x5f'),'value':_0x3a9d12[_0x5028('0x5f')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0][_0x5028('0x5d')]:undefined)||_0x5028('0x60')},{'name':'attrTimezone','value':_0x3a9d12[_0x5028('0x61')]||(_0x3a9d12['attrs']&&_0x3a9d12[_0x5028('0x5a')][0x1]?_0x3a9d12[_0x5028('0x5a')][0x1]['value']:undefined)||_0x5028('0x62')},{'name':_0x5028('0x63'),'value':_0x3a9d12[_0x5028('0x63')]||(_0x3a9d12['attrs']&&_0x3a9d12['attrs'][0x2]?_0x3a9d12[_0x5028('0x5a')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x5028('0x64'),'value':_0x3a9d12['attrMetric']||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0][_0x5028('0x5d')]:undefined)||_0x5028('0x65')},{'name':_0x5028('0x66'),'value':_0x3a9d12[_0x5028('0x66')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x1]?_0x3a9d12[_0x5028('0x5a')][0x1][_0x5028('0x5d')]:undefined)||[]},{'name':_0x5028('0x63'),'value':_0x3a9d12[_0x5028('0x63')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x2]?_0x3a9d12[_0x5028('0x5a')][0x2][_0x5028('0x5d')]:undefined)||0x14},{'name':_0x5028('0x67'),'value':_0x3a9d12[_0x5028('0x67')]||(_0x3a9d12['attrs']&&_0x3a9d12[_0x5028('0x5a')][0x3]?_0x3a9d12[_0x5028('0x5a')][0x3][_0x5028('0x5d')]:undefined)||_0x5028('0x68')},{'name':_0x5028('0x69'),'value':_0x3a9d12[_0x5028('0x69')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x4]?_0x3a9d12[_0x5028('0x5a')][0x4][_0x5028('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3a9d12[_0x5028('0x6a')]||(_0x3a9d12['attrs']&&_0x3a9d12[_0x5028('0x5a')][0x5]?_0x3a9d12[_0x5028('0x5a')][0x5][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6b'),'value':_0x3a9d12[_0x5028('0x6b')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x6]?_0x3a9d12[_0x5028('0x5a')][0x6][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6c'),'value':_0x3a9d12[_0x5028('0x6c')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x7]?_0x3a9d12[_0x5028('0x5a')][0x7][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6d'),'value':_0x3a9d12[_0x5028('0x6d')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x8]?_0x3a9d12['attrs'][0x8][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6e'),'value':_0x3a9d12[_0x5028('0x6e')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x9]?_0x3a9d12['attrs'][0x9][_0x5028('0x5d')]:undefined)||''}];case _0x5028('0x6f'):case'pie-chart':return[{'name':_0x5028('0x70'),'value':_0x3a9d12['attrSerie1']||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0][_0x5028('0x5d')]:undefined)||_0x5028('0x65')},{'name':_0x5028('0x71'),'value':_0x3a9d12[_0x5028('0x71')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x1]?_0x3a9d12[_0x5028('0x5a')][0x1][_0x5028('0x5d')]:undefined)||null},{'name':_0x5028('0x72'),'value':_0x3a9d12[_0x5028('0x72')]||(_0x3a9d12['attrs']&&_0x3a9d12[_0x5028('0x5a')][0x2]?_0x3a9d12[_0x5028('0x5a')][0x2][_0x5028('0x5d')]:undefined)||null},{'name':_0x5028('0x66'),'value':_0x3a9d12['attrVoiceQueues']||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x3]?_0x3a9d12[_0x5028('0x5a')][0x3][_0x5028('0x5d')]:undefined)||[]},{'name':_0x5028('0x67'),'value':_0x3a9d12[_0x5028('0x67')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x4]?_0x3a9d12[_0x5028('0x5a')][0x4][_0x5028('0x5d')]:undefined)||_0x5028('0x68')},{'name':_0x5028('0x69'),'value':_0x3a9d12[_0x5028('0x69')]||(_0x3a9d12['attrs']&&_0x3a9d12[_0x5028('0x5a')][0x5]?_0x3a9d12[_0x5028('0x5a')][0x5][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6a'),'value':_0x3a9d12['attrFaxAccounts']||(_0x3a9d12['attrs']&&_0x3a9d12['attrs'][0x6]?_0x3a9d12['attrs'][0x6][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6b'),'value':_0x3a9d12[_0x5028('0x6b')]||(_0x3a9d12['attrs']&&_0x3a9d12['attrs'][0x7]?_0x3a9d12[_0x5028('0x5a')][0x7][_0x5028('0x5d')]:undefined)||''},{'name':_0x5028('0x6c'),'value':_0x3a9d12[_0x5028('0x6c')]||(_0x3a9d12['attrs']&&_0x3a9d12[_0x5028('0x5a')][0x8]?_0x3a9d12[_0x5028('0x5a')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3a9d12[_0x5028('0x6d')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x9]?_0x3a9d12[_0x5028('0x5a')][0x9]['value']:undefined)||''},{'name':_0x5028('0x6e'),'value':_0x3a9d12[_0x5028('0x6e')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0xa]?_0x3a9d12['attrs'][0xa][_0x5028('0x5d')]:undefined)||''}];case'web-report':return[{'name':_0x5028('0x73'),'type':_0x3a9d12[_0x5028('0x74')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0]['type']:undefined)||null,'value':_0x3a9d12[_0x5028('0x73')]||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12['attrs'][0x0]?_0x3a9d12[_0x5028('0x5a')][0x0][_0x5028('0x5d')]:undefined)||null},{'name':_0x5028('0x75'),'value':_0x3a9d12['attrRefresh']||(_0x3a9d12[_0x5028('0x5a')]&&_0x3a9d12[_0x5028('0x5a')][0x1]?_0x3a9d12[_0x5028('0x5a')][0x1][_0x5028('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x1726d8){logger[_0x5028('0x2a')](_0x5028('0x76'),JSON[_0x5028('0x77')](_0x1726d8));return[];}}exports['addItem']=function(_0x2e0655,_0x9caaa,_0x449a00){if(_0x2e0655['body']['id']){delete _0x2e0655[_0x5028('0x4a')]['id'];}return db['Dashboard'][_0x5028('0x48')]({'where':{'id':_0x2e0655['params']['id']}})[_0x5028('0x25')](handleEntityNotFound(_0x9caaa,null))[_0x5028('0x25')](function(_0xa4d41e){if(_0xa4d41e){_0x2e0655['body'][_0x5028('0x78')]=_0xa4d41e['id'];_0x2e0655[_0x5028('0x4a')][_0x5028('0x5a')]=widgetAttributes(_0x2e0655[_0x5028('0x4a')]);return db[_0x5028('0x79')][_0x5028('0x49')](_0x2e0655[_0x5028('0x4a')]);}})[_0x5028('0x25')](respondWithResult(_0x9caaa,null))[_0x5028('0x45')](handleError(_0x9caaa,null));};exports['getItems']=function(_0x3df2a9,_0x5f4946,_0x3bc53e){var _0x414dea={};var _0x546e54={};var _0x53e6b9;var _0x16be8d;return db[_0x5028('0x2f')][_0x5028('0x7a')]({'where':{'id':_0x3df2a9[_0x5028('0x47')]['id']}})[_0x5028('0x25')](handleEntityNotFound(_0x5f4946,null))[_0x5028('0x25')](function(_0x8acae6){if(_0x8acae6){_0x53e6b9=_0x8acae6;_0x546e54[_0x5028('0x34')]=_[_0x5028('0x36')](db['DashboardItem']['rawAttributes']);_0x546e54['query']=_['keys'](_0x3df2a9['query']);_0x546e54['filters']=_['intersection'](_0x546e54[_0x5028('0x34')],_0x546e54['query']);_0x414dea['attributes']=_['intersection'](_0x546e54[_0x5028('0x34')],qs[_0x5028('0x39')](_0x3df2a9['query']['fields']));_0x414dea[_0x5028('0x38')]=_0x414dea['attributes'][_0x5028('0x3a')]?_0x414dea['attributes']:_0x546e54[_0x5028('0x34')];_0x414dea['order']=qs[_0x5028('0x3c')](_0x3df2a9[_0x5028('0x35')]['sort']);_0x414dea[_0x5028('0x3d')]=qs['filters'](_[_0x5028('0x3e')](_0x3df2a9[_0x5028('0x35')],_0x546e54[_0x5028('0x3f')]));if(_0x3df2a9['query']['filter']){_0x414dea[_0x5028('0x3d')]=_[_0x5028('0x40')](_0x414dea[_0x5028('0x3d')],{'$or':_['map'](_0x414dea[_0x5028('0x38')],function(_0x4b8b27){var _0x4a2d9d={};_0x4a2d9d[_0x4b8b27]={'$like':'%'+_0x3df2a9[_0x5028('0x35')][_0x5028('0x41')]+'%'};return _0x4a2d9d;})});}_0x414dea=_[_0x5028('0x40')]({},_0x414dea,_0x3df2a9[_0x5028('0x42')]);return _0x53e6b9[_0x5028('0x7b')](_0x414dea);}})['then'](function(_0x135eac){if(_0x135eac){_0x16be8d=_0x135eac[_0x5028('0x3a')];if(!_0x3df2a9[_0x5028('0x35')]['hasOwnProperty'](_0x5028('0x3b'))){_0x414dea[_0x5028('0x1d')]=qs[_0x5028('0x1d')](_0x3df2a9[_0x5028('0x35')][_0x5028('0x1d')]);_0x414dea[_0x5028('0x1c')]=qs[_0x5028('0x1c')](_0x3df2a9[_0x5028('0x35')]['offset']);}return _0x53e6b9['getItems'](_0x414dea);}})['then'](function(_0x133267){if(_0x133267){return _0x133267?{'count':_0x16be8d,'rows':_0x133267}:null;}})[_0x5028('0x25')](respondWithResult(_0x5f4946,null))[_0x5028('0x45')](handleError(_0x5f4946,null));}; \ No newline at end of file +var _0xed6d=['./dashboard.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','end','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Dashboard','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','omit','error','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x3b62bf,_0x2393a1){var _0x2dbbe3=function(_0x3bd4f1){while(--_0x3bd4f1){_0x3b62bf['push'](_0x3b62bf['shift']());}};_0x2dbbe3(++_0x2393a1);}(_0xed6d,0x1de));var _0xded6=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xed6d[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0xded6('0x0'));var rimraf=require(_0xded6('0x1'));var zipdir=require(_0xded6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xded6('0x3'));var moment=require('moment');var BPromise=require(_0xded6('0x4'));var Mustache=require('mustache');var util=require(_0xded6('0x5'));var path=require('path');var sox=require(_0xded6('0x6'));var csv=require(_0xded6('0x7'));var ejs=require(_0xded6('0x8'));var fs=require('fs');var fs_extra=require(_0xded6('0x9'));var _=require(_0xded6('0xa'));var squel=require(_0xded6('0xb'));var crypto=require(_0xded6('0xc'));var jsforce=require(_0xded6('0xd'));var deskjs=require(_0xded6('0xe'));var toCsv=require(_0xded6('0x7'));var querystring=require(_0xded6('0xf'));var Papa=require('papaparse');var Redis=require(_0xded6('0x10'));var authService=require(_0xded6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xded6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xded6('0x13'))(_0xded6('0x14'));var utils=require('../../config/utils');var config=require(_0xded6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xded6('0x16')]=_[_0xded6('0x17')](config[_0xded6('0x16')],{'host':_0xded6('0x18'),'port':0x18eb});var socket=require(_0xded6('0x19'))(new Redis(config[_0xded6('0x16')]));require(_0xded6('0x1a'))[_0xded6('0x1b')](socket);function respondWithStatusCode(_0x1e7148,_0x201266){_0x201266=_0x201266||0xcc;return function(_0x347fc7){if(_0x347fc7){return _0x1e7148[_0xded6('0x1c')](_0x201266);}return _0x1e7148['status'](_0x201266)['end']();};}function respondWithResult(_0x87afa6,_0xa92cd7){_0xa92cd7=_0xa92cd7||0xc8;return function(_0x2c25a8){if(_0x2c25a8){return _0x87afa6[_0xded6('0x1d')](_0xa92cd7)[_0xded6('0x1e')](_0x2c25a8);}};}function respondWithFilteredResult(_0x29867e,_0x349973){return function(_0x3e9947){if(_0x3e9947){var _0x4aaef5=typeof _0x349973['offset']===_0xded6('0x1f')&&typeof _0x349973[_0xded6('0x20')]===_0xded6('0x1f');var _0xb58275=_0x3e9947['count'];var _0x3d5c00=_0x4aaef5?0x0:_0x349973[_0xded6('0x21')];var _0x4a6f9a=_0x4aaef5?_0x3e9947[_0xded6('0x22')]:_0x349973['offset']+_0x349973[_0xded6('0x20')];var _0xa66841;if(_0x4a6f9a>=_0xb58275){_0x4a6f9a=_0xb58275;_0xa66841=0xc8;}else{_0xa66841=0xce;}_0x29867e['status'](_0xa66841);return _0x29867e[_0xded6('0x23')](_0xded6('0x24'),_0x3d5c00+'-'+_0x4a6f9a+'/'+_0xb58275)['json'](_0x3e9947);}return null;};}function patchUpdates(_0x3c2943){return function(_0xc29e61){try{jsonpatch[_0xded6('0x25')](_0xc29e61,_0x3c2943,!![]);}catch(_0x5d9b2d){return BPromise[_0xded6('0x26')](_0x5d9b2d);}return _0xc29e61['save']();};}function saveUpdates(_0x1a1570,_0xd5c8bf){return function(_0x1cbc82){if(_0x1cbc82){return _0x1cbc82[_0xded6('0x27')](_0x1a1570)[_0xded6('0x28')](function(_0xf1b759){return _0xf1b759;});}return null;};}function removeEntity(_0x4eff89,_0x26b494){return function(_0x3fe8d7){if(_0x3fe8d7){return _0x3fe8d7['destroy']()[_0xded6('0x28')](function(){var _0x59f818=_0x3fe8d7[_0xded6('0x29')]({'plain':!![]});var _0x1738ab='CustomDashboards';return db[_0xded6('0x2a')]['destroy']({'where':{'type':_0x1738ab,'resourceId':_0x59f818['id']}})[_0xded6('0x28')](function(){return _0x3fe8d7;});})['then'](function(){_0x4eff89[_0xded6('0x1d')](0xcc)[_0xded6('0x2b')]();});}};}function handleEntityNotFound(_0x353d47,_0xd581de){return function(_0x23869a){if(!_0x23869a){_0x353d47['sendStatus'](0x194);}return _0x23869a;};}function handleError(_0xf4f1d5,_0xdb4b56){_0xdb4b56=_0xdb4b56||0x1f4;return function(_0x329dcc){logger['error'](_0x329dcc['stack']);if(_0x329dcc[_0xded6('0x2c')]){delete _0x329dcc['name'];}_0xf4f1d5[_0xded6('0x1d')](_0xdb4b56)['send'](_0x329dcc);};}exports['index']=function(_0x398e97,_0x5c76d4){var _0x5a66fc={},_0xd8fa04={},_0x37967c={'count':0x0,'rows':[]};var _0xedc061=_[_0xded6('0x2d')](db['Dashboard'][_0xded6('0x2e')],function(_0x597dc7){return{'name':_0x597dc7[_0xded6('0x2f')],'type':_0x597dc7[_0xded6('0x30')]['key']};});_0xd8fa04[_0xded6('0x31')]=_[_0xded6('0x2d')](_0xedc061,_0xded6('0x2c'));_0xd8fa04[_0xded6('0x32')]=_[_0xded6('0x33')](_0x398e97[_0xded6('0x32')]);_0xd8fa04[_0xded6('0x34')]=_[_0xded6('0x35')](_0xd8fa04[_0xded6('0x31')],_0xd8fa04[_0xded6('0x32')]);_0x5a66fc[_0xded6('0x36')]=_[_0xded6('0x35')](_0xd8fa04[_0xded6('0x31')],qs[_0xded6('0x37')](_0x398e97[_0xded6('0x32')][_0xded6('0x37')]));_0x5a66fc[_0xded6('0x36')]=_0x5a66fc['attributes']['length']?_0x5a66fc[_0xded6('0x36')]:_0xd8fa04[_0xded6('0x31')];if(!_0x398e97[_0xded6('0x32')][_0xded6('0x38')](_0xded6('0x39'))){_0x5a66fc[_0xded6('0x20')]=qs[_0xded6('0x20')](_0x398e97[_0xded6('0x32')][_0xded6('0x20')]);_0x5a66fc[_0xded6('0x21')]=qs[_0xded6('0x21')](_0x398e97[_0xded6('0x32')]['offset']);}_0x5a66fc[_0xded6('0x3a')]=qs['sort'](_0x398e97['query'][_0xded6('0x3b')]);_0x5a66fc[_0xded6('0x3c')]=qs[_0xded6('0x34')](_[_0xded6('0x3d')](_0x398e97[_0xded6('0x32')],_0xd8fa04[_0xded6('0x34')]),_0xedc061);if(_0x398e97[_0xded6('0x32')][_0xded6('0x3e')]){_0x5a66fc[_0xded6('0x3c')]=_[_0xded6('0x3f')](_0x5a66fc[_0xded6('0x3c')],{'$or':_['map'](_0xedc061,function(_0x4d96fa){if(_0x4d96fa['type']!==_0xded6('0x40')){var _0xeed879={};_0xeed879[_0x4d96fa[_0xded6('0x2c')]]={'$like':'%'+_0x398e97[_0xded6('0x32')]['filter']+'%'};return _0xeed879;}})});}_0x5a66fc=_[_0xded6('0x3f')]({},_0x5a66fc,_0x398e97[_0xded6('0x41')]);var _0x46d5f6={'where':_0x5a66fc[_0xded6('0x3c')]};return db['Dashboard'][_0xded6('0x22')](_0x46d5f6)['then'](function(_0x67246a){_0x37967c[_0xded6('0x22')]=_0x67246a;if(_0x398e97[_0xded6('0x32')][_0xded6('0x42')]){_0x5a66fc[_0xded6('0x43')]=[{'all':!![]}];}return db[_0xded6('0x44')][_0xded6('0x45')](_0x5a66fc);})[_0xded6('0x28')](function(_0x59551c){_0x37967c[_0xded6('0x46')]=_0x59551c;return _0x37967c;})[_0xded6('0x28')](respondWithFilteredResult(_0x5c76d4,_0x5a66fc))[_0xded6('0x47')](handleError(_0x5c76d4,null));};exports[_0xded6('0x48')]=function(_0xc868ec,_0x3ed69f){var _0x2eaba0={'raw':![],'where':{'id':_0xc868ec[_0xded6('0x49')]['id']}},_0x5344={};_0x5344[_0xded6('0x31')]=_[_0xded6('0x33')](db[_0xded6('0x44')][_0xded6('0x2e')]);_0x5344[_0xded6('0x32')]=_[_0xded6('0x33')](_0xc868ec['query']);_0x5344[_0xded6('0x34')]=_['intersection'](_0x5344['model'],_0x5344['query']);_0x2eaba0['attributes']=_['intersection'](_0x5344[_0xded6('0x31')],qs[_0xded6('0x37')](_0xc868ec[_0xded6('0x32')][_0xded6('0x37')]));_0x2eaba0[_0xded6('0x36')]=_0x2eaba0['attributes']['length']?_0x2eaba0['attributes']:_0x5344[_0xded6('0x31')];if(_0xc868ec[_0xded6('0x32')][_0xded6('0x42')]){_0x2eaba0[_0xded6('0x43')]=[{'all':!![]}];}_0x2eaba0=_['merge']({},_0x2eaba0,_0xc868ec[_0xded6('0x41')]);return db[_0xded6('0x44')]['find'](_0x2eaba0)[_0xded6('0x28')](handleEntityNotFound(_0x3ed69f,null))[_0xded6('0x28')](respondWithResult(_0x3ed69f,null))[_0xded6('0x47')](handleError(_0x3ed69f,null));};exports['create']=function(_0x53ee05,_0x1cab4f){return db['Dashboard']['create'](_0x53ee05[_0xded6('0x4a')],{})[_0xded6('0x28')](function(_0x5dfb45){var _0x100b9c=_0x53ee05[_0xded6('0x4b')][_0xded6('0x29')]({'plain':!![]});if(!_0x100b9c)throw new Error(_0xded6('0x4c'));if(_0x100b9c['role']===_0xded6('0x4b')){var _0x320449=_0x5dfb45[_0xded6('0x29')]({'plain':!![]});var _0x29c4e1=_0xded6('0x4d');return db[_0xded6('0x4e')][_0xded6('0x4f')]({'where':{'name':_0x29c4e1,'userProfileId':_0x100b9c[_0xded6('0x50')]},'raw':!![]})[_0xded6('0x28')](function(_0x493aa1){if(_0x493aa1&&_0x493aa1[_0xded6('0x51')]===0x0){return db[_0xded6('0x2a')][_0xded6('0x52')]({'name':_0x320449[_0xded6('0x2c')],'resourceId':_0x320449['id'],'type':_0x493aa1[_0xded6('0x2c')],'sectionId':_0x493aa1['id']},{})[_0xded6('0x28')](function(){return _0x5dfb45;});}else{return _0x5dfb45;}})[_0xded6('0x47')](function(_0x6d59bf){logger['error'](_0xded6('0x53'),_0x6d59bf);throw _0x6d59bf;});}return _0x5dfb45;})[_0xded6('0x28')](respondWithResult(_0x1cab4f,0xc9))[_0xded6('0x47')](handleError(_0x1cab4f,null));};exports[_0xded6('0x54')]=function(_0x2ad794,_0x75065e){var _0x5cea6d={'where':{'id':_0x2ad794['params']['id']}},_0x1909ee={};_0x1909ee['model']=_[_0xded6('0x33')](db[_0xded6('0x44')]['rawAttributes']);_0x5cea6d[_0xded6('0x36')]=_['intersection'](_0x1909ee[_0xded6('0x31')],qs[_0xded6('0x37')](_0x2ad794['query'][_0xded6('0x37')]));_0x5cea6d[_0xded6('0x36')]=_0x5cea6d[_0xded6('0x36')][_0xded6('0x55')]?_0x5cea6d[_0xded6('0x36')]:_0x1909ee[_0xded6('0x31')];if(_0x2ad794[_0xded6('0x32')][_0xded6('0x42')]){_0x5cea6d['include']=[{'all':!![]}];}_0x5cea6d=_[_0xded6('0x3f')]({},_0x5cea6d,_0x2ad794[_0xded6('0x41')]);return db['Dashboard']['find'](_0x5cea6d)[_0xded6('0x28')](handleEntityNotFound(_0x75065e,null))[_0xded6('0x28')](function(_0x54a3d3){if(_0x54a3d3){var _0x1a7f8b=_0x54a3d3[_0xded6('0x29')]({'plain':!![]});_0x1a7f8b=qs['omit'](_0x1a7f8b,['id',_0xded6('0x56'),_0xded6('0x57')]);_0x2ad794[_0xded6('0x4a')]=_[_0xded6('0x58')](_0x2ad794[_0xded6('0x4a')],['id',_0xded6('0x56'),'updatedAt']);return db[_0xded6('0x44')]['create'](_[_0xded6('0x3f')](_0x1a7f8b,_0x2ad794[_0xded6('0x4a')]),{'include':_0x2ad794[_0xded6('0x32')][_0xded6('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x5a10ee){var _0x1f9a19=_0x2ad794[_0xded6('0x4b')][_0xded6('0x29')]({'plain':!![]});if(!_0x1f9a19)throw new Error(_0xded6('0x4c'));if(_0x1f9a19['role']===_0xded6('0x4b')){var _0x1bdc3c=_0x5a10ee[_0xded6('0x29')]({'plain':!![]});var _0x55c96f=_0xded6('0x4d');return db['UserProfileSection'][_0xded6('0x4f')]({'where':{'name':_0x55c96f,'userProfileId':_0x1f9a19['userProfileId']},'raw':!![]})[_0xded6('0x28')](function(_0x4f3377){if(_0x4f3377&&_0x4f3377['autoAssociation']===0x0){return db[_0xded6('0x2a')][_0xded6('0x52')]({'name':_0x1bdc3c[_0xded6('0x2c')],'resourceId':_0x1bdc3c['id'],'type':_0x4f3377[_0xded6('0x2c')],'sectionId':_0x4f3377['id']},{})[_0xded6('0x28')](function(){return _0x5a10ee;});}else{return _0x5a10ee;}})[_0xded6('0x47')](function(_0x1ef2ed){logger[_0xded6('0x59')](_0xded6('0x53'),_0x1ef2ed);throw _0x1ef2ed;});}return _0x5a10ee;});}})[_0xded6('0x28')](respondWithResult(_0x75065e,0xc9))['catch'](handleError(_0x75065e,null));};exports[_0xded6('0x27')]=function(_0x1b10d8,_0x453318){if(_0x1b10d8['body']['id']){delete _0x1b10d8[_0xded6('0x4a')]['id'];}return db[_0xded6('0x44')][_0xded6('0x4f')]({'where':{'id':_0x1b10d8[_0xded6('0x49')]['id']}})[_0xded6('0x28')](handleEntityNotFound(_0x453318,null))['then'](saveUpdates(_0x1b10d8['body'],null))[_0xded6('0x28')](respondWithResult(_0x453318,null))[_0xded6('0x47')](handleError(_0x453318,null));};exports[_0xded6('0x5a')]=function(_0x5618d5,_0x4a599e){return db[_0xded6('0x44')][_0xded6('0x4f')]({'where':{'id':_0x5618d5[_0xded6('0x49')]['id']}})[_0xded6('0x28')](handleEntityNotFound(_0x4a599e,null))[_0xded6('0x28')](removeEntity(_0x4a599e,null))['catch'](handleError(_0x4a599e,null));};function widgetAttributes(_0x244a84){try{switch(_0x244a84[_0xded6('0x30')]){case _0xded6('0x5b'):return[{'name':_0xded6('0x5c'),'value':_0x244a84[_0xded6('0x5c')]||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x5e')]:undefined)||'https://'}];case _0xded6('0x5f'):return[{'name':_0xded6('0x60'),'value':_0x244a84[_0xded6('0x60')]||(_0x244a84['attrs']&&_0x244a84['attrs'][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x5e')]:undefined)||''}];case _0xded6('0x61'):return[{'name':_0xded6('0x62'),'value':_0x244a84['attrHourFormat']||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x5e')]:undefined)||_0xded6('0x63')},{'name':_0xded6('0x64'),'value':_0x244a84[_0xded6('0x64')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x1]?_0x244a84[_0xded6('0x5d')][0x1][_0xded6('0x5e')]:undefined)||_0xded6('0x65')},{'name':'attrFontSize','value':_0x244a84['attrFontSize']||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x2]?_0x244a84[_0xded6('0x5d')][0x2]['value']:undefined)||0xc}];case _0xded6('0x66'):return[{'name':_0xded6('0x67'),'value':_0x244a84[_0xded6('0x67')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x5e')]:undefined)||'total'},{'name':_0xded6('0x68'),'value':_0x244a84['attrVoiceQueues']||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0x1]?_0x244a84[_0xded6('0x5d')][0x1][_0xded6('0x5e')]:undefined)||[]},{'name':_0xded6('0x69'),'value':_0x244a84['attrFontSize']||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x2]?_0x244a84[_0xded6('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xded6('0x6a'),'value':_0x244a84[_0xded6('0x6a')]||(_0x244a84['attrs']&&_0x244a84['attrs'][0x3]?_0x244a84[_0xded6('0x5d')][0x3][_0xded6('0x5e')]:undefined)||_0xded6('0x6b')},{'name':_0xded6('0x6c'),'value':_0x244a84[_0xded6('0x6c')]||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0x4]?_0x244a84[_0xded6('0x5d')][0x4]['value']:undefined)||''},{'name':_0xded6('0x6d'),'value':_0x244a84[_0xded6('0x6d')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x5]?_0x244a84[_0xded6('0x5d')][0x5][_0xded6('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x244a84[_0xded6('0x6e')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x6]?_0x244a84[_0xded6('0x5d')][0x6][_0xded6('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x244a84[_0xded6('0x6f')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x7]?_0x244a84[_0xded6('0x5d')][0x7]['value']:undefined)||''},{'name':_0xded6('0x70'),'value':_0x244a84[_0xded6('0x70')]||(_0x244a84['attrs']&&_0x244a84['attrs'][0x8]?_0x244a84[_0xded6('0x5d')][0x8][_0xded6('0x5e')]:undefined)||''},{'name':_0xded6('0x71'),'value':_0x244a84[_0xded6('0x71')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x9]?_0x244a84[_0xded6('0x5d')][0x9][_0xded6('0x5e')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xded6('0x72'),'value':_0x244a84[_0xded6('0x72')]||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x5e')]:undefined)||_0xded6('0x73')},{'name':_0xded6('0x74'),'value':_0x244a84[_0xded6('0x74')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x1]?_0x244a84[_0xded6('0x5d')][0x1][_0xded6('0x5e')]:undefined)||null},{'name':_0xded6('0x75'),'value':_0x244a84[_0xded6('0x75')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x2]?_0x244a84[_0xded6('0x5d')][0x2][_0xded6('0x5e')]:undefined)||null},{'name':_0xded6('0x68'),'value':_0x244a84[_0xded6('0x68')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x3]?_0x244a84[_0xded6('0x5d')][0x3]['value']:undefined)||[]},{'name':_0xded6('0x6a'),'value':_0x244a84[_0xded6('0x6a')]||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0x4]?_0x244a84[_0xded6('0x5d')][0x4][_0xded6('0x5e')]:undefined)||_0xded6('0x6b')},{'name':_0xded6('0x6c'),'value':_0x244a84[_0xded6('0x6c')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x5]?_0x244a84[_0xded6('0x5d')][0x5][_0xded6('0x5e')]:undefined)||''},{'name':_0xded6('0x6d'),'value':_0x244a84[_0xded6('0x6d')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x6]?_0x244a84[_0xded6('0x5d')][0x6][_0xded6('0x5e')]:undefined)||''},{'name':_0xded6('0x6e'),'value':_0x244a84[_0xded6('0x6e')]||(_0x244a84['attrs']&&_0x244a84['attrs'][0x7]?_0x244a84[_0xded6('0x5d')][0x7][_0xded6('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x244a84[_0xded6('0x6f')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x8]?_0x244a84[_0xded6('0x5d')][0x8][_0xded6('0x5e')]:undefined)||''},{'name':_0xded6('0x70'),'value':_0x244a84[_0xded6('0x70')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84['attrs'][0x9]?_0x244a84[_0xded6('0x5d')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x244a84[_0xded6('0x71')]||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0xa]?_0x244a84[_0xded6('0x5d')][0xa][_0xded6('0x5e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x244a84[_0xded6('0x76')]||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x30')]:undefined)||null,'value':_0x244a84['attrReport']||(_0x244a84[_0xded6('0x5d')]&&_0x244a84[_0xded6('0x5d')][0x0]?_0x244a84[_0xded6('0x5d')][0x0][_0xded6('0x5e')]:undefined)||null},{'name':_0xded6('0x77'),'value':_0x244a84['attrRefresh']||(_0x244a84['attrs']&&_0x244a84[_0xded6('0x5d')][0x1]?_0x244a84['attrs'][0x1][_0xded6('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x462a15){logger[_0xded6('0x59')](_0xded6('0x78'),JSON['stringify'](_0x462a15));return[];}}exports[_0xded6('0x79')]=function(_0x5dc134,_0x119d1a,_0x27f009){if(_0x5dc134[_0xded6('0x4a')]['id']){delete _0x5dc134[_0xded6('0x4a')]['id'];}return db[_0xded6('0x44')]['find']({'where':{'id':_0x5dc134['params']['id']}})['then'](handleEntityNotFound(_0x119d1a,null))[_0xded6('0x28')](function(_0x150a63){if(_0x150a63){_0x5dc134[_0xded6('0x4a')][_0xded6('0x7a')]=_0x150a63['id'];_0x5dc134[_0xded6('0x4a')]['attrs']=widgetAttributes(_0x5dc134['body']);return db[_0xded6('0x7b')][_0xded6('0x52')](_0x5dc134[_0xded6('0x4a')]);}})['then'](respondWithResult(_0x119d1a,null))[_0xded6('0x47')](handleError(_0x119d1a,null));};exports['getItems']=function(_0x5e78f7,_0x1ea60f,_0x3ee7e5){var _0x2fc4f7={};var _0x410d02={};var _0x1722b6;var _0xdf249e;return db[_0xded6('0x44')][_0xded6('0x7c')]({'where':{'id':_0x5e78f7[_0xded6('0x49')]['id']}})[_0xded6('0x28')](handleEntityNotFound(_0x1ea60f,null))[_0xded6('0x28')](function(_0x1c5523){if(_0x1c5523){_0x1722b6=_0x1c5523;_0x410d02['model']=_['keys'](db[_0xded6('0x7b')][_0xded6('0x2e')]);_0x410d02[_0xded6('0x32')]=_['keys'](_0x5e78f7[_0xded6('0x32')]);_0x410d02[_0xded6('0x34')]=_[_0xded6('0x35')](_0x410d02['model'],_0x410d02[_0xded6('0x32')]);_0x2fc4f7[_0xded6('0x36')]=_[_0xded6('0x35')](_0x410d02['model'],qs[_0xded6('0x37')](_0x5e78f7[_0xded6('0x32')]['fields']));_0x2fc4f7[_0xded6('0x36')]=_0x2fc4f7[_0xded6('0x36')][_0xded6('0x55')]?_0x2fc4f7[_0xded6('0x36')]:_0x410d02[_0xded6('0x31')];_0x2fc4f7['order']=qs['sort'](_0x5e78f7[_0xded6('0x32')][_0xded6('0x3b')]);_0x2fc4f7[_0xded6('0x3c')]=qs[_0xded6('0x34')](_[_0xded6('0x3d')](_0x5e78f7[_0xded6('0x32')],_0x410d02[_0xded6('0x34')]));if(_0x5e78f7['query']['filter']){_0x2fc4f7[_0xded6('0x3c')]=_[_0xded6('0x3f')](_0x2fc4f7[_0xded6('0x3c')],{'$or':_['map'](_0x2fc4f7[_0xded6('0x36')],function(_0x4a1c90){var _0x2ea61c={};_0x2ea61c[_0x4a1c90]={'$like':'%'+_0x5e78f7[_0xded6('0x32')][_0xded6('0x3e')]+'%'};return _0x2ea61c;})});}_0x2fc4f7=_[_0xded6('0x3f')]({},_0x2fc4f7,_0x5e78f7[_0xded6('0x41')]);return _0x1722b6['getItems'](_0x2fc4f7);}})[_0xded6('0x28')](function(_0x3b1fec){if(_0x3b1fec){_0xdf249e=_0x3b1fec[_0xded6('0x55')];if(!_0x5e78f7[_0xded6('0x32')][_0xded6('0x38')]('nolimit')){_0x2fc4f7[_0xded6('0x20')]=qs[_0xded6('0x20')](_0x5e78f7[_0xded6('0x32')][_0xded6('0x20')]);_0x2fc4f7[_0xded6('0x21')]=qs[_0xded6('0x21')](_0x5e78f7['query'][_0xded6('0x21')]);}return _0x1722b6[_0xded6('0x7d')](_0x2fc4f7);}})['then'](function(_0x42f97b){if(_0x42f97b){return _0x42f97b?{'count':_0xdf249e,'rows':_0x42f97b}:null;}})[_0xded6('0x28')](respondWithResult(_0x1ea60f,null))[_0xded6('0x47')](handleError(_0x1ea60f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a526f22..a3cadb7 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 _0xe774=['emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','save','update','remove'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xe774,0x135));var _0x4e77=function(_0x29c209,_0x38118b){_0x29c209=_0x29c209-0x0;var _0x1d5ba1=_0xe774[_0x29c209];return _0x1d5ba1;};'use strict';var EventEmitter=require(_0x4e77('0x0'));var Dashboard=require(_0x4e77('0x1'))['db'][_0x4e77('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e77('0x3'),'afterUpdate':_0x4e77('0x4'),'afterDestroy':_0x4e77('0x5')};function emitEvent(_0x1e054d){return function(_0x1b8ffc,_0x436828,_0xcfe81e){DashboardEvents['emit'](_0x1e054d+':'+_0x1b8ffc['id'],_0x1b8ffc);DashboardEvents[_0x4e77('0x6')](_0x1e054d,_0x1b8ffc);_0xcfe81e(null);};}for(var e in events){if(events[_0x4e77('0x7')](e)){var event=events[e];Dashboard[_0x4e77('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xeadc=['remove','emit','hook','exports','events','../../mysqldb','Dashboard','update'];(function(_0x3a7ac8,_0x1ab67b){var _0x3acf7b=function(_0x32865f){while(--_0x32865f){_0x3a7ac8['push'](_0x3a7ac8['shift']());}};_0x3acf7b(++_0x1ab67b);}(_0xeadc,0x1d4));var _0xcead=function(_0x501667,_0x331fb0){_0x501667=_0x501667-0x0;var _0xa99aab=_0xeadc[_0x501667];return _0xa99aab;};'use strict';var EventEmitter=require(_0xcead('0x0'));var Dashboard=require(_0xcead('0x1'))['db'][_0xcead('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcead('0x3'),'afterDestroy':_0xcead('0x4')};function emitEvent(_0x10ae26){return function(_0x1d310,_0x30194d,_0x3e44c2){DashboardEvents['emit'](_0x10ae26+':'+_0x1d310['id'],_0x1d310);DashboardEvents[_0xcead('0x5')](_0x10ae26,_0x1d310);_0x3e44c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xcead('0x6')](e,emitEvent(event));}}module[_0xcead('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index cf8fde8..001245b 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 _0x9d62=['rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3476bb,_0xcddcee){var _0x6cdc68=function(_0x1a8b08){while(--_0x1a8b08){_0x3476bb['push'](_0x3476bb['shift']());}};_0x6cdc68(++_0xcddcee);}(_0x9d62,0xaf));var _0x29d6=function(_0x1291bd,_0x29bc1f){_0x1291bd=_0x1291bd-0x0;var _0x33eb14=_0x9d62[_0x1291bd];return _0x33eb14;};'use strict';var _=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var logger=require(_0x29d6('0x2'))(_0x29d6('0x3'));var moment=require(_0x29d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x29d6('0x5'));var fs=require('fs');var path=require(_0x29d6('0x6'));var rimraf=require(_0x29d6('0x7'));var config=require(_0x29d6('0x8'));var attributes=require(_0x29d6('0x9'));module['exports']=function(_0x2962a9,_0x468e41){return _0x2962a9[_0x29d6('0xa')](_0x29d6('0xb'),attributes,{'tableName':_0x29d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeec=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','dashboards','lodash','util','../../config/logger'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0xbeec,0x135));var _0xcbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcbee('0x0'));var util=require(_0xcbee('0x1'));var logger=require(_0xcbee('0x2'))(_0xcbee('0x3'));var moment=require(_0xcbee('0x4'));var BPromise=require(_0xcbee('0x5'));var rp=require(_0xcbee('0x6'));var fs=require('fs');var path=require(_0xcbee('0x7'));var rimraf=require(_0xcbee('0x8'));var config=require(_0xcbee('0x9'));var attributes=require(_0xcbee('0xa'));module['exports']=function(_0x505803,_0x5036af){return _0x505803['define']('Dashboard',attributes,{'tableName':_0xcbee('0xb'),'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 6e38123..9694b1f 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 _0xad36=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad36,0x11c));var _0x6ad3=function(_0x35c9ae,_0x263c3e){_0x35c9ae=_0x35c9ae-0x0;var _0x408df2=_0xad36[_0x35c9ae];return _0x408df2;};'use strict';var _=require('lodash');var util=require(_0x6ad3('0x0'));var moment=require(_0x6ad3('0x1'));var BPromise=require(_0x6ad3('0x2'));var rs=require(_0x6ad3('0x3'));var fs=require('fs');var Redis=require(_0x6ad3('0x4'));var db=require(_0x6ad3('0x5'))['db'];var utils=require(_0x6ad3('0x6'));var logger=require(_0x6ad3('0x7'))(_0x6ad3('0x8'));var config=require('../../config/environment');var jayson=require(_0x6ad3('0x9'));var client=jayson[_0x6ad3('0xa')][_0x6ad3('0xb')]({'port':0x232a});config[_0x6ad3('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ad3('0xc')]));require(_0x6ad3('0xd'))[_0x6ad3('0xe')](socket);function respondWithRpcPromise(_0x1de02d,_0x236745,_0xb64f36){return new BPromise(function(_0x22dbd1,_0x293c9d){return client[_0x6ad3('0xf')](_0x1de02d,_0xb64f36)['then'](function(_0x6bb2f5){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x236745,_0x6ad3('0x12'));logger[_0x6ad3('0x13')](_0x6ad3('0x14'),_0x236745,_0x6ad3('0x12'),JSON[_0x6ad3('0x15')](_0x6bb2f5));if(_0x6bb2f5['error']){if(_0x6bb2f5[_0x6ad3('0x16')]['code']===0x1f4){logger[_0x6ad3('0x16')](_0x6ad3('0x11'),_0x236745,_0x6bb2f5[_0x6ad3('0x16')][_0x6ad3('0x17')]);return _0x293c9d(_0x6bb2f5[_0x6ad3('0x16')]['message']);}logger[_0x6ad3('0x16')](_0x6ad3('0x11'),_0x236745,_0x6bb2f5[_0x6ad3('0x16')]['message']);return _0x22dbd1(_0x6bb2f5['error']['message']);}else{logger['info'](_0x6ad3('0x11'),_0x236745,'request\x20sent');_0x22dbd1(_0x6bb2f5[_0x6ad3('0x18')]['message']);}})[_0x6ad3('0x19')](function(_0x1d688f){logger[_0x6ad3('0x16')](_0x6ad3('0x11'),_0x236745,_0x1d688f);_0x293c9d(_0x1d688f);});});} \ No newline at end of file +var _0x3148=['register','request','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x3148,0x1d6));var _0x8314=function(_0x4198d6,_0x332030){_0x4198d6=_0x4198d6-0x0;var _0x145d70=_0x3148[_0x4198d6];return _0x145d70;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require(_0x8314('0x2'));var BPromise=require('bluebird');var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8314('0x5'));var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8314('0x9')][_0x8314('0xa')]({'port':0x232a});config[_0x8314('0xb')]=_[_0x8314('0xc')](config[_0x8314('0xb')],{'host':_0x8314('0xd'),'port':0x18eb});var socket=require(_0x8314('0xe'))(new Redis(config['redis']));require(_0x8314('0xf'))[_0x8314('0x10')](socket);function respondWithRpcPromise(_0x1606dc,_0x433589,_0x352d5d){return new BPromise(function(_0x3996f6,_0x32864c){return client[_0x8314('0x11')](_0x1606dc,_0x352d5d)['then'](function(_0x2d9976){logger[_0x8314('0x12')](_0x8314('0x13'),_0x433589,'request\x20sent');logger['debug'](_0x8314('0x14'),_0x433589,_0x8314('0x15'),JSON[_0x8314('0x16')](_0x2d9976));if(_0x2d9976[_0x8314('0x17')]){if(_0x2d9976['error'][_0x8314('0x18')]===0x1f4){logger[_0x8314('0x17')]('Dashboard,\x20%s,\x20%s',_0x433589,_0x2d9976[_0x8314('0x17')][_0x8314('0x19')]);return _0x32864c(_0x2d9976[_0x8314('0x17')][_0x8314('0x19')]);}logger[_0x8314('0x17')]('Dashboard,\x20%s,\x20%s',_0x433589,_0x2d9976['error']['message']);return _0x3996f6(_0x2d9976[_0x8314('0x17')][_0x8314('0x19')]);}else{logger[_0x8314('0x12')](_0x8314('0x13'),_0x433589,_0x8314('0x15'));_0x3996f6(_0x2d9976['result'][_0x8314('0x19')]);}})[_0x8314('0x1a')](function(_0x4f47cc){logger['error']('Dashboard,\x20%s,\x20%s',_0x433589,_0x4f47cc);_0x32864c(_0x4f47cc);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1919259..8a62804 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 _0xd730=['./dashboard.events','remove','update','register','dashboard:'];(function(_0x51a952,_0x10d16f){var _0x261f9a=function(_0x18659d){while(--_0x18659d){_0x51a952['push'](_0x51a952['shift']());}};_0x261f9a(++_0x10d16f);}(_0xd730,0x1bd));var _0x0d73=function(_0x9f8acb,_0x52bb25){_0x9f8acb=_0x9f8acb-0x0;var _0x373110=_0xd730[_0x9f8acb];return _0x373110;};'use strict';var DashboardEvents=require(_0x0d73('0x0'));var events=['save',_0x0d73('0x1'),_0x0d73('0x2')];function createListener(_0x2bf33f,_0x163cf8){return function(_0x53f646){_0x163cf8['emit'](_0x2bf33f,_0x53f646);};}function removeListener(_0x1f0a93,_0x43689f){return function(){DashboardEvents['removeListener'](_0x1f0a93,_0x43689f);};}exports[_0x0d73('0x3')]=function(_0x1975f2){for(var _0x25d87b=0x0,_0x531ffe=events['length'];_0x25d87b<_0x531ffe;_0x25d87b++){var _0x1112b2=events[_0x25d87b];var _0x289fed=createListener(_0x0d73('0x4')+_0x1112b2,_0x1975f2);DashboardEvents['on'](_0x1112b2,_0x289fed);}}; \ No newline at end of file +var _0x218f=['save','update','emit','removeListener','length','./dashboard.events'];(function(_0x34722d,_0x5292e8){var _0x5bfc6a=function(_0x31a3b5){while(--_0x31a3b5){_0x34722d['push'](_0x34722d['shift']());}};_0x5bfc6a(++_0x5292e8);}(_0x218f,0x191));var _0xf218=function(_0x43cdb6,_0x200525){_0x43cdb6=_0x43cdb6-0x0;var _0x10429c=_0x218f[_0x43cdb6];return _0x10429c;};'use strict';var DashboardEvents=require(_0xf218('0x0'));var events=[_0xf218('0x1'),'remove',_0xf218('0x2')];function createListener(_0x2ad016,_0xf22061){return function(_0x5f0c72){_0xf22061[_0xf218('0x3')](_0x2ad016,_0x5f0c72);};}function removeListener(_0x3dfe1d,_0x20b76d){return function(){DashboardEvents[_0xf218('0x4')](_0x3dfe1d,_0x20b76d);};}exports['register']=function(_0x3ecf69){for(var _0x4ece1b=0x0,_0x5506bf=events[_0xf218('0x5')];_0x4ece1b<_0x5506bf;_0x4ece1b++){var _0x5b7d32=events[_0x4ece1b];var _0xbef4d8=createListener('dashboard:'+_0x5b7d32,_0x3ecf69);DashboardEvents['on'](_0x5b7d32,_0xbef4d8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5b913e2..e592ed4 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 _0xb25f=['isAuthenticated','index','/:id','show','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get'];(function(_0x56a57a,_0x4d34e5){var _0x341a5c=function(_0x14327a){while(--_0x14327a){_0x56a57a['push'](_0x56a57a['shift']());}};_0x341a5c(++_0x4d34e5);}(_0xb25f,0x117));var _0xfb25=function(_0x243713,_0x498eba){_0x243713=_0x243713-0x0;var _0x5adf3e=_0xb25f[_0x243713];return _0x5adf3e;};'use strict';var multer=require(_0xfb25('0x0'));var util=require('util');var path=require(_0xfb25('0x1'));var timeout=require('connect-timeout');var express=require(_0xfb25('0x2'));var router=express[_0xfb25('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfb25('0x4'));var interaction=require(_0xfb25('0x5'));var config=require(_0xfb25('0x6'));var controller=require(_0xfb25('0x7'));router[_0xfb25('0x8')]('/',auth[_0xfb25('0x9')](),controller[_0xfb25('0xa')]);router[_0xfb25('0x8')](_0xfb25('0xb'),auth['isAuthenticated'](),controller[_0xfb25('0xc')]);router['get']('/:id/items',auth[_0xfb25('0x9')](),controller[_0xfb25('0xd')]);router[_0xfb25('0xe')]('/',auth[_0xfb25('0x9')](),controller[_0xfb25('0xf')]);router[_0xfb25('0xe')](_0xfb25('0x10'),auth[_0xfb25('0x9')](),controller[_0xfb25('0x11')]);router[_0xfb25('0xe')]('/:id/items',auth[_0xfb25('0x9')](),controller[_0xfb25('0x12')]);router[_0xfb25('0x13')](_0xfb25('0xb'),auth[_0xfb25('0x9')](),controller[_0xfb25('0x14')]);router[_0xfb25('0x15')]('/:id',auth[_0xfb25('0x9')](),controller[_0xfb25('0x16')]);module[_0xfb25('0x17')]=router; \ No newline at end of file +var _0xb090=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/clone','clone','/:id/items','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0x4d6506,_0x196b50){var _0xd25b4b=function(_0x206d94){while(--_0x206d94){_0x4d6506['push'](_0x4d6506['shift']());}};_0xd25b4b(++_0x196b50);}(_0xb090,0x1cb));var _0x0b09=function(_0x5436c0,_0x45beac){_0x5436c0=_0x5436c0-0x0;var _0x51a455=_0xb090[_0x5436c0];return _0x51a455;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b09('0x0'));var timeout=require(_0x0b09('0x1'));var express=require('express');var router=express[_0x0b09('0x2')]();var fs_extra=require(_0x0b09('0x3'));var auth=require(_0x0b09('0x4'));var interaction=require(_0x0b09('0x5'));var config=require(_0x0b09('0x6'));var controller=require(_0x0b09('0x7'));router[_0x0b09('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b09('0x9')]);router[_0x0b09('0x8')](_0x0b09('0xa'),auth[_0x0b09('0xb')](),controller[_0x0b09('0xc')]);router['get']('/:id/items',auth['isAuthenticated'](),controller['getItems']);router[_0x0b09('0xd')]('/',auth['isAuthenticated'](),controller[_0x0b09('0xe')]);router[_0x0b09('0xd')](_0x0b09('0xf'),auth[_0x0b09('0xb')](),controller[_0x0b09('0x10')]);router[_0x0b09('0xd')](_0x0b09('0x11'),auth[_0x0b09('0xb')](),controller['addItem']);router['put'](_0x0b09('0xa'),auth[_0x0b09('0xb')](),controller[_0x0b09('0x12')]);router[_0x0b09('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0b09('0x14')]);module[_0x0b09('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fd44882..faf3e2e 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 _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x540f2a,_0x496b69){_0x540f2a=_0x540f2a-0x0;var _0x3d9c44=_0xb4c7[_0x540f2a];return _0x3d9c44;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x45d94b,_0x1e09cc){var _0x48597f=function(_0x64c058){while(--_0x64c058){_0x45d94b['push'](_0x45d94b['shift']());}};_0x48597f(++_0x1e09cc);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3ec8ed,_0x292b75){_0x3ec8ed=_0x3ec8ed-0x0;var _0x54519f=_0xbd51[_0x3ec8ed];return _0x54519f;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'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 7d73a44..42c748a 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 _0x363e=['offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status'];(function(_0x487600,_0x593697){var _0x1ecfc4=function(_0x4f72eb){while(--_0x4f72eb){_0x487600['push'](_0x487600['shift']());}};_0x1ecfc4(++_0x593697);}(_0x363e,0x179));var _0xe363=function(_0x107240,_0x328580){_0x107240=_0x107240-0x0;var _0x3965d5=_0x363e[_0x107240];return _0x3965d5;};'use strict';var emlformat=require(_0xe363('0x0'));var rimraf=require(_0xe363('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe363('0x2'));var rp=require(_0xe363('0x3'));var moment=require(_0xe363('0x4'));var BPromise=require(_0xe363('0x5'));var Mustache=require(_0xe363('0x6'));var util=require(_0xe363('0x7'));var path=require(_0xe363('0x8'));var sox=require(_0xe363('0x9'));var csv=require(_0xe363('0xa'));var ejs=require(_0xe363('0xb'));var fs=require('fs');var fs_extra=require(_0xe363('0xc'));var _=require('lodash');var squel=require(_0xe363('0xd'));var crypto=require(_0xe363('0xe'));var jsforce=require(_0xe363('0xf'));var deskjs=require(_0xe363('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe363('0x11'));var Papa=require(_0xe363('0x12'));var Redis=require(_0xe363('0x13'));var authService=require(_0xe363('0x14'));var qs=require(_0xe363('0x15'));var as=require(_0xe363('0x16'));var hardwareService=require(_0xe363('0x17'));var logger=require('../../config/logger')(_0xe363('0x18'));var utils=require(_0xe363('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe363('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe363('0x1b')](config[_0xe363('0x1c')],{'host':_0xe363('0x1d'),'port':0x18eb});var socket=require(_0xe363('0x1e'))(new Redis(config[_0xe363('0x1c')]));require('./dashboardItem.socket')[_0xe363('0x1f')](socket);function respondWithStatusCode(_0x22b227,_0x4a3258){_0x4a3258=_0x4a3258||0xcc;return function(_0xdfce32){if(_0xdfce32){return _0x22b227[_0xe363('0x20')](_0x4a3258);}return _0x22b227['status'](_0x4a3258)[_0xe363('0x21')]();};}function respondWithResult(_0x73ef9a,_0x51e1a8){_0x51e1a8=_0x51e1a8||0xc8;return function(_0xd9d1b1){if(_0xd9d1b1){return _0x73ef9a[_0xe363('0x22')](_0x51e1a8)['json'](_0xd9d1b1);}};}function respondWithFilteredResult(_0xecbe2c,_0x17606f){return function(_0x2f2c20){if(_0x2f2c20){var _0x4dcba0=typeof _0x17606f[_0xe363('0x23')]===_0xe363('0x24')&&typeof _0x17606f['limit']===_0xe363('0x24');var _0x110e59=_0x2f2c20[_0xe363('0x25')];var _0x7d407d=_0x4dcba0?0x0:_0x17606f[_0xe363('0x23')];var _0x3f2c97=_0x4dcba0?_0x2f2c20['count']:_0x17606f[_0xe363('0x23')]+_0x17606f[_0xe363('0x26')];var _0x14ff95;if(_0x3f2c97>=_0x110e59){_0x3f2c97=_0x110e59;_0x14ff95=0xc8;}else{_0x14ff95=0xce;}_0xecbe2c[_0xe363('0x22')](_0x14ff95);return _0xecbe2c[_0xe363('0x27')](_0xe363('0x28'),_0x7d407d+'-'+_0x3f2c97+'/'+_0x110e59)[_0xe363('0x29')](_0x2f2c20);}return null;};}function patchUpdates(_0xaff56f){return function(_0x41d04b){try{jsonpatch[_0xe363('0x2a')](_0x41d04b,_0xaff56f,!![]);}catch(_0x1de673){return BPromise[_0xe363('0x2b')](_0x1de673);}return _0x41d04b[_0xe363('0x2c')]();};}function saveUpdates(_0x388223,_0x1ffed7){return function(_0x3f5dc2){if(_0x3f5dc2){return _0x3f5dc2[_0xe363('0x2d')](_0x388223)[_0xe363('0x2e')](function(_0x19c7b4){return _0x19c7b4;});}return null;};}function removeEntity(_0x3e24ad,_0x312d75){return function(_0x1e7eb7){if(_0x1e7eb7){return _0x1e7eb7['destroy']()[_0xe363('0x2e')](function(){_0x3e24ad[_0xe363('0x22')](0xcc)[_0xe363('0x21')]();});}};}function handleEntityNotFound(_0x276b93,_0x335c60){return function(_0x52cafe){if(!_0x52cafe){_0x276b93[_0xe363('0x20')](0x194);}return _0x52cafe;};}function handleError(_0x291841,_0x4dc950){_0x4dc950=_0x4dc950||0x1f4;return function(_0x3cc130){logger['error'](_0x3cc130[_0xe363('0x2f')]);if(_0x3cc130[_0xe363('0x30')]){delete _0x3cc130['name'];}_0x291841[_0xe363('0x22')](_0x4dc950)[_0xe363('0x31')](_0x3cc130);};}exports[_0xe363('0x32')]=function(_0x54c76c,_0x40671e){var _0x32c9ab={'raw':![],'where':{'id':_0x54c76c[_0xe363('0x33')]['id']}},_0x102030={};_0x102030['model']=_[_0xe363('0x34')](db[_0xe363('0x35')][_0xe363('0x36')]);_0x102030[_0xe363('0x37')]=_[_0xe363('0x34')](_0x54c76c[_0xe363('0x37')]);_0x102030[_0xe363('0x38')]=_[_0xe363('0x39')](_0x102030[_0xe363('0x3a')],_0x102030[_0xe363('0x37')]);_0x32c9ab['attributes']=_['intersection'](_0x102030[_0xe363('0x3a')],qs[_0xe363('0x3b')](_0x54c76c['query'][_0xe363('0x3b')]));_0x32c9ab[_0xe363('0x3c')]=_0x32c9ab['attributes'][_0xe363('0x3d')]?_0x32c9ab[_0xe363('0x3c')]:_0x102030[_0xe363('0x3a')];if(_0x54c76c[_0xe363('0x37')]['includeAll']){_0x32c9ab['include']=[{'all':!![]}];}_0x32c9ab=_[_0xe363('0x3e')]({},_0x32c9ab,_0x54c76c['options']);return db['DashboardItem'][_0xe363('0x3f')](_0x32c9ab)[_0xe363('0x2e')](handleEntityNotFound(_0x40671e,null))[_0xe363('0x2e')](respondWithResult(_0x40671e,null))[_0xe363('0x40')](handleError(_0x40671e,null));};exports[_0xe363('0x41')]=function(_0x1ad258,_0x249aa3){return db[_0xe363('0x35')][_0xe363('0x3f')]({'where':{'id':_0x1ad258[_0xe363('0x33')]['id']}})[_0xe363('0x2e')](handleEntityNotFound(_0x249aa3,null))[_0xe363('0x2e')](removeEntity(_0x249aa3,null))['catch'](handleError(_0x249aa3,null));};function widgetAttributes(_0x574af3){try{switch(_0x574af3[_0xe363('0x42')]){case _0xe363('0x43'):return[{'name':_0xe363('0x44'),'value':_0x574af3['attrUrl']||(_0x574af3['attrs']&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3[_0xe363('0x45')][0x0][_0xe363('0x46')]:undefined)||_0xe363('0x47')}];case'custom':return[{'name':_0xe363('0x48'),'value':_0x574af3['attrPath']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3[_0xe363('0x45')][0x0][_0xe363('0x46')]:undefined)||''}];case _0xe363('0x49'):return[{'name':_0xe363('0x4a'),'value':_0x574af3[_0xe363('0x4a')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3['attrs'][0x0]['value']:undefined)||_0xe363('0x4b')},{'name':_0xe363('0x4c'),'value':_0x574af3[_0xe363('0x4c')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x1]?_0x574af3[_0xe363('0x45')][0x1][_0xe363('0x46')]:undefined)||_0xe363('0x4d')},{'name':_0xe363('0x4e'),'value':_0x574af3['attrFontSize']||(_0x574af3[_0xe363('0x45')]&&_0x574af3['attrs'][0x2]?_0x574af3[_0xe363('0x45')][0x2]['value']:undefined)||0xc}];case _0xe363('0x4f'):return[{'name':_0xe363('0x50'),'value':_0x574af3['attrMetric']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3[_0xe363('0x45')][0x0][_0xe363('0x46')]:undefined)||_0xe363('0x51')},{'name':_0xe363('0x52'),'value':_0x574af3['attrVoiceQueues']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x1]?_0x574af3[_0xe363('0x45')][0x1][_0xe363('0x46')]:undefined)||[]},{'name':_0xe363('0x4e'),'value':_0x574af3['attrFontSize']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x2]?_0x574af3[_0xe363('0x45')][0x2][_0xe363('0x46')]:undefined)||0x14},{'name':_0xe363('0x53'),'value':_0x574af3[_0xe363('0x53')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3['attrs'][0x3]?_0x574af3['attrs'][0x3][_0xe363('0x46')]:undefined)||_0xe363('0x54')},{'name':_0xe363('0x55'),'value':_0x574af3['attrEmailAccounts']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x4]?_0x574af3['attrs'][0x4]['value']:undefined)||''},{'name':_0xe363('0x56'),'value':_0x574af3[_0xe363('0x56')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x5]?_0x574af3['attrs'][0x5][_0xe363('0x46')]:undefined)||''},{'name':_0xe363('0x57'),'value':_0x574af3['attrSmsAccounts']||(_0x574af3['attrs']&&_0x574af3[_0xe363('0x45')][0x6]?_0x574af3[_0xe363('0x45')][0x6]['value']:undefined)||''},{'name':_0xe363('0x58'),'value':_0x574af3['attrOpenchannelAccounts']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x7]?_0x574af3['attrs'][0x7][_0xe363('0x46')]:undefined)||''},{'name':_0xe363('0x59'),'value':_0x574af3['attrWhatsappAccounts']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x8]?_0x574af3['attrs'][0x8][_0xe363('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x574af3[_0xe363('0x5a')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x9]?_0x574af3[_0xe363('0x45')][0x9]['value']:undefined)||''}];case _0xe363('0x5b'):case _0xe363('0x5c'):return[{'name':_0xe363('0x5d'),'value':_0x574af3['attrSerie1']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3[_0xe363('0x45')][0x0]['value']:undefined)||_0xe363('0x51')},{'name':_0xe363('0x5e'),'value':_0x574af3['attrSerie2']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x1]?_0x574af3[_0xe363('0x45')][0x1][_0xe363('0x46')]:undefined)||null},{'name':_0xe363('0x5f'),'value':_0x574af3[_0xe363('0x5f')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x2]?_0x574af3[_0xe363('0x45')][0x2][_0xe363('0x46')]:undefined)||null},{'name':_0xe363('0x52'),'value':_0x574af3[_0xe363('0x52')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3['attrs'][0x3]?_0x574af3['attrs'][0x3][_0xe363('0x46')]:undefined)||[]},{'name':_0xe363('0x53'),'value':_0x574af3[_0xe363('0x53')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x4]?_0x574af3[_0xe363('0x45')][0x4][_0xe363('0x46')]:undefined)||_0xe363('0x54')},{'name':_0xe363('0x55'),'value':_0x574af3[_0xe363('0x55')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x5]?_0x574af3[_0xe363('0x45')][0x5]['value']:undefined)||''},{'name':_0xe363('0x56'),'value':_0x574af3[_0xe363('0x56')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3['attrs'][0x6]?_0x574af3[_0xe363('0x45')][0x6][_0xe363('0x46')]:undefined)||''},{'name':_0xe363('0x57'),'value':_0x574af3[_0xe363('0x57')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3['attrs'][0x7]?_0x574af3['attrs'][0x7][_0xe363('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x574af3[_0xe363('0x58')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x8]?_0x574af3[_0xe363('0x45')][0x8][_0xe363('0x46')]:undefined)||''},{'name':_0xe363('0x59'),'value':_0x574af3[_0xe363('0x59')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x9]?_0x574af3[_0xe363('0x45')][0x9][_0xe363('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x574af3[_0xe363('0x5a')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0xa]?_0x574af3['attrs'][0xa][_0xe363('0x46')]:undefined)||''}];case _0xe363('0x60'):return[{'name':_0xe363('0x61'),'type':_0x574af3[_0xe363('0x62')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3[_0xe363('0x45')][0x0][_0xe363('0x42')]:undefined)||null,'value':_0x574af3[_0xe363('0x61')]||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x0]?_0x574af3['attrs'][0x0]['value']:undefined)||null},{'name':_0xe363('0x63'),'value':_0x574af3['attrRefresh']||(_0x574af3[_0xe363('0x45')]&&_0x574af3[_0xe363('0x45')][0x1]?_0x574af3[_0xe363('0x45')][0x1][_0xe363('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x5d312a){logger['error']('widgetAttributes:\x20%s',JSON[_0xe363('0x64')](_0x5d312a));return[];}}exports[_0xe363('0x65')]=function(_0x2008f7,_0x123106){if(_0x2008f7['body']){_0x2008f7['body'][_0xe363('0x45')]=widgetAttributes(_0x2008f7['body']);}return db[_0xe363('0x35')][_0xe363('0x65')](_0x2008f7[_0xe363('0x66')],{})[_0xe363('0x2e')](respondWithResult(_0x123106,0xc9))[_0xe363('0x40')](handleError(_0x123106,null));};exports[_0xe363('0x2d')]=function(_0x3bdf90,_0x79d40b){if(_0x3bdf90['body']['id']){delete _0x3bdf90[_0xe363('0x66')]['id'];}_0x3bdf90[_0xe363('0x66')]['attrs']=widgetAttributes(_0x3bdf90[_0xe363('0x66')]);return db['DashboardItem']['find']({'where':{'id':_0x3bdf90[_0xe363('0x33')]['id']}})['then'](handleEntityNotFound(_0x79d40b,null))[_0xe363('0x2e')](saveUpdates(_0x3bdf90[_0xe363('0x66')],null))['then'](respondWithResult(_0x79d40b,null))[_0xe363('0x40')](handleError(_0x79d40b,null));}; \ No newline at end of file +var _0x11e5=['model','attributes','fields','length','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','body','create','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','params','keys','DashboardItem','rawAttributes','query','filters','intersection'];(function(_0x223bbd,_0x2f8c30){var _0x11e852=function(_0x5c03ab){while(--_0x5c03ab){_0x223bbd['push'](_0x223bbd['shift']());}};_0x11e852(++_0x2f8c30);}(_0x11e5,0x8b));var _0x511e=function(_0x1c9b46,_0x507d41){_0x1c9b46=_0x1c9b46-0x0;var _0x2d199c=_0x11e5[_0x1c9b46];return _0x2d199c;};'use strict';var emlformat=require(_0x511e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x511e('0x1'));var jsonpatch=require(_0x511e('0x2'));var rp=require('request-promise');var moment=require(_0x511e('0x3'));var BPromise=require(_0x511e('0x4'));var Mustache=require(_0x511e('0x5'));var util=require('util');var path=require(_0x511e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x511e('0x7'));var fs=require('fs');var fs_extra=require(_0x511e('0x8'));var _=require(_0x511e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x511e('0xa'));var deskjs=require(_0x511e('0xb'));var toCsv=require(_0x511e('0xc'));var querystring=require(_0x511e('0xd'));var Papa=require(_0x511e('0xe'));var Redis=require(_0x511e('0xf'));var authService=require(_0x511e('0x10'));var qs=require(_0x511e('0x11'));var as=require(_0x511e('0x12'));var hardwareService=require(_0x511e('0x13'));var logger=require(_0x511e('0x14'))('api');var utils=require(_0x511e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x511e('0x16'))['db'];config[_0x511e('0x17')]=_[_0x511e('0x18')](config[_0x511e('0x17')],{'host':_0x511e('0x19'),'port':0x18eb});var socket=require(_0x511e('0x1a'))(new Redis(config['redis']));require(_0x511e('0x1b'))[_0x511e('0x1c')](socket);function respondWithStatusCode(_0x4e6507,_0x14b34e){_0x14b34e=_0x14b34e||0xcc;return function(_0x43a329){if(_0x43a329){return _0x4e6507['sendStatus'](_0x14b34e);}return _0x4e6507[_0x511e('0x1d')](_0x14b34e)[_0x511e('0x1e')]();};}function respondWithResult(_0x3b990b,_0x17fd4a){_0x17fd4a=_0x17fd4a||0xc8;return function(_0x5b6cd6){if(_0x5b6cd6){return _0x3b990b[_0x511e('0x1d')](_0x17fd4a)[_0x511e('0x1f')](_0x5b6cd6);}};}function respondWithFilteredResult(_0x2e66b6,_0x577616){return function(_0x26af67){if(_0x26af67){var _0x5bd814=typeof _0x577616[_0x511e('0x20')]==='undefined'&&typeof _0x577616['limit']===_0x511e('0x21');var _0x5c4fb9=_0x26af67[_0x511e('0x22')];var _0x325278=_0x5bd814?0x0:_0x577616[_0x511e('0x20')];var _0x3cbc5a=_0x5bd814?_0x26af67[_0x511e('0x22')]:_0x577616[_0x511e('0x20')]+_0x577616[_0x511e('0x23')];var _0x452f20;if(_0x3cbc5a>=_0x5c4fb9){_0x3cbc5a=_0x5c4fb9;_0x452f20=0xc8;}else{_0x452f20=0xce;}_0x2e66b6['status'](_0x452f20);return _0x2e66b6[_0x511e('0x24')](_0x511e('0x25'),_0x325278+'-'+_0x3cbc5a+'/'+_0x5c4fb9)[_0x511e('0x1f')](_0x26af67);}return null;};}function patchUpdates(_0x1a273b){return function(_0xaea29d){try{jsonpatch[_0x511e('0x26')](_0xaea29d,_0x1a273b,!![]);}catch(_0x886b6){return BPromise[_0x511e('0x27')](_0x886b6);}return _0xaea29d[_0x511e('0x28')]();};}function saveUpdates(_0x26618d,_0x4c35e2){return function(_0x4ad22b){if(_0x4ad22b){return _0x4ad22b[_0x511e('0x29')](_0x26618d)['then'](function(_0x1ff5c4){return _0x1ff5c4;});}return null;};}function removeEntity(_0x53017d,_0x3fbd19){return function(_0x473f30){if(_0x473f30){return _0x473f30[_0x511e('0x2a')]()[_0x511e('0x2b')](function(){_0x53017d[_0x511e('0x1d')](0xcc)[_0x511e('0x1e')]();});}};}function handleEntityNotFound(_0x3c057c,_0x4d89a5){return function(_0x309695){if(!_0x309695){_0x3c057c[_0x511e('0x2c')](0x194);}return _0x309695;};}function handleError(_0x5b72fe,_0x2930b2){_0x2930b2=_0x2930b2||0x1f4;return function(_0x1d754d){logger[_0x511e('0x2d')](_0x1d754d[_0x511e('0x2e')]);if(_0x1d754d[_0x511e('0x2f')]){delete _0x1d754d['name'];}_0x5b72fe[_0x511e('0x1d')](_0x2930b2)['send'](_0x1d754d);};}exports['show']=function(_0x262dde,_0xb1d444){var _0xa3b110={'raw':![],'where':{'id':_0x262dde[_0x511e('0x30')]['id']}},_0x2fb396={};_0x2fb396['model']=_[_0x511e('0x31')](db[_0x511e('0x32')][_0x511e('0x33')]);_0x2fb396[_0x511e('0x34')]=_[_0x511e('0x31')](_0x262dde['query']);_0x2fb396[_0x511e('0x35')]=_[_0x511e('0x36')](_0x2fb396[_0x511e('0x37')],_0x2fb396[_0x511e('0x34')]);_0xa3b110[_0x511e('0x38')]=_[_0x511e('0x36')](_0x2fb396[_0x511e('0x37')],qs[_0x511e('0x39')](_0x262dde['query'][_0x511e('0x39')]));_0xa3b110[_0x511e('0x38')]=_0xa3b110[_0x511e('0x38')][_0x511e('0x3a')]?_0xa3b110['attributes']:_0x2fb396['model'];if(_0x262dde[_0x511e('0x34')]['includeAll']){_0xa3b110['include']=[{'all':!![]}];}_0xa3b110=_[_0x511e('0x3b')]({},_0xa3b110,_0x262dde[_0x511e('0x3c')]);return db[_0x511e('0x32')][_0x511e('0x3d')](_0xa3b110)[_0x511e('0x2b')](handleEntityNotFound(_0xb1d444,null))['then'](respondWithResult(_0xb1d444,null))[_0x511e('0x3e')](handleError(_0xb1d444,null));};exports[_0x511e('0x2a')]=function(_0x26fefa,_0x4a7a6c){return db[_0x511e('0x32')][_0x511e('0x3d')]({'where':{'id':_0x26fefa[_0x511e('0x30')]['id']}})['then'](handleEntityNotFound(_0x4a7a6c,null))[_0x511e('0x2b')](removeEntity(_0x4a7a6c,null))[_0x511e('0x3e')](handleError(_0x4a7a6c,null));};function widgetAttributes(_0x4f124f){try{switch(_0x4f124f[_0x511e('0x3f')]){case _0x511e('0x40'):return[{'name':_0x511e('0x41'),'value':_0x4f124f[_0x511e('0x41')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x0]?_0x4f124f[_0x511e('0x42')][0x0][_0x511e('0x43')]:undefined)||_0x511e('0x44')}];case _0x511e('0x45'):return[{'name':_0x511e('0x46'),'value':_0x4f124f['attrPath']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f['attrs'][0x0]?_0x4f124f['attrs'][0x0][_0x511e('0x43')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4f124f[_0x511e('0x47')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x0]?_0x4f124f[_0x511e('0x42')][0x0][_0x511e('0x43')]:undefined)||_0x511e('0x48')},{'name':_0x511e('0x49'),'value':_0x4f124f[_0x511e('0x49')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x1]?_0x4f124f[_0x511e('0x42')][0x1][_0x511e('0x43')]:undefined)||_0x511e('0x4a')},{'name':_0x511e('0x4b'),'value':_0x4f124f['attrFontSize']||(_0x4f124f['attrs']&&_0x4f124f[_0x511e('0x42')][0x2]?_0x4f124f[_0x511e('0x42')][0x2][_0x511e('0x43')]:undefined)||0xc}];case _0x511e('0x4c'):return[{'name':_0x511e('0x4d'),'value':_0x4f124f['attrMetric']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x0]?_0x4f124f[_0x511e('0x42')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4f124f[_0x511e('0x4e')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x1]?_0x4f124f['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x4f124f[_0x511e('0x4b')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x2]?_0x4f124f[_0x511e('0x42')][0x2][_0x511e('0x43')]:undefined)||0x14},{'name':_0x511e('0x4f'),'value':_0x4f124f[_0x511e('0x4f')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x3]?_0x4f124f[_0x511e('0x42')][0x3][_0x511e('0x43')]:undefined)||_0x511e('0x50')},{'name':_0x511e('0x51'),'value':_0x4f124f[_0x511e('0x51')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x4]?_0x4f124f[_0x511e('0x42')][0x4][_0x511e('0x43')]:undefined)||''},{'name':_0x511e('0x52'),'value':_0x4f124f[_0x511e('0x52')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x5]?_0x4f124f[_0x511e('0x42')][0x5][_0x511e('0x43')]:undefined)||''},{'name':_0x511e('0x53'),'value':_0x4f124f[_0x511e('0x53')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x6]?_0x4f124f[_0x511e('0x42')][0x6][_0x511e('0x43')]:undefined)||''},{'name':_0x511e('0x54'),'value':_0x4f124f['attrOpenchannelAccounts']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f['attrs'][0x7]?_0x4f124f[_0x511e('0x42')][0x7][_0x511e('0x43')]:undefined)||''},{'name':_0x511e('0x55'),'value':_0x4f124f['attrWhatsappAccounts']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x8]?_0x4f124f[_0x511e('0x42')][0x8]['value']:undefined)||''},{'name':_0x511e('0x56'),'value':_0x4f124f[_0x511e('0x56')]||(_0x4f124f['attrs']&&_0x4f124f[_0x511e('0x42')][0x9]?_0x4f124f[_0x511e('0x42')][0x9][_0x511e('0x43')]:undefined)||''}];case _0x511e('0x57'):case'pie-chart':return[{'name':_0x511e('0x58'),'value':_0x4f124f['attrSerie1']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x0]?_0x4f124f[_0x511e('0x42')][0x0]['value']:undefined)||_0x511e('0x59')},{'name':'attrSerie2','value':_0x4f124f[_0x511e('0x5a')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x1]?_0x4f124f[_0x511e('0x42')][0x1][_0x511e('0x43')]:undefined)||null},{'name':'attrSerie3','value':_0x4f124f[_0x511e('0x5b')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x2]?_0x4f124f[_0x511e('0x42')][0x2][_0x511e('0x43')]:undefined)||null},{'name':_0x511e('0x4e'),'value':_0x4f124f[_0x511e('0x4e')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f['attrs'][0x3]?_0x4f124f[_0x511e('0x42')][0x3][_0x511e('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x4f124f[_0x511e('0x4f')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x4]?_0x4f124f[_0x511e('0x42')][0x4][_0x511e('0x43')]:undefined)||_0x511e('0x50')},{'name':'attrEmailAccounts','value':_0x4f124f[_0x511e('0x51')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f['attrs'][0x5]?_0x4f124f[_0x511e('0x42')][0x5]['value']:undefined)||''},{'name':_0x511e('0x52'),'value':_0x4f124f[_0x511e('0x52')]||(_0x4f124f['attrs']&&_0x4f124f['attrs'][0x6]?_0x4f124f['attrs'][0x6]['value']:undefined)||''},{'name':_0x511e('0x53'),'value':_0x4f124f['attrSmsAccounts']||(_0x4f124f['attrs']&&_0x4f124f[_0x511e('0x42')][0x7]?_0x4f124f[_0x511e('0x42')][0x7]['value']:undefined)||''},{'name':_0x511e('0x54'),'value':_0x4f124f['attrOpenchannelAccounts']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f['attrs'][0x8]?_0x4f124f['attrs'][0x8]['value']:undefined)||''},{'name':_0x511e('0x55'),'value':_0x4f124f[_0x511e('0x55')]||(_0x4f124f['attrs']&&_0x4f124f['attrs'][0x9]?_0x4f124f['attrs'][0x9]['value']:undefined)||''},{'name':_0x511e('0x56'),'value':_0x4f124f['attrChatWebsites']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f['attrs'][0xa]?_0x4f124f[_0x511e('0x42')][0xa][_0x511e('0x43')]:undefined)||''}];case _0x511e('0x5c'):return[{'name':_0x511e('0x5d'),'type':_0x4f124f['reportType']||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x0]?_0x4f124f[_0x511e('0x42')][0x0][_0x511e('0x3f')]:undefined)||null,'value':_0x4f124f[_0x511e('0x5d')]||(_0x4f124f['attrs']&&_0x4f124f['attrs'][0x0]?_0x4f124f[_0x511e('0x42')][0x0][_0x511e('0x43')]:undefined)||null},{'name':_0x511e('0x5e'),'value':_0x4f124f[_0x511e('0x5e')]||(_0x4f124f[_0x511e('0x42')]&&_0x4f124f[_0x511e('0x42')][0x1]?_0x4f124f[_0x511e('0x42')][0x1][_0x511e('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x118582){logger[_0x511e('0x2d')]('widgetAttributes:\x20%s',JSON['stringify'](_0x118582));return[];}}exports['create']=function(_0x86f362,_0x5525ed){if(_0x86f362[_0x511e('0x5f')]){_0x86f362['body'][_0x511e('0x42')]=widgetAttributes(_0x86f362['body']);}return db[_0x511e('0x32')][_0x511e('0x60')](_0x86f362[_0x511e('0x5f')],{})[_0x511e('0x2b')](respondWithResult(_0x5525ed,0xc9))[_0x511e('0x3e')](handleError(_0x5525ed,null));};exports['update']=function(_0x2f3523,_0x5d1433){if(_0x2f3523[_0x511e('0x5f')]['id']){delete _0x2f3523[_0x511e('0x5f')]['id'];}_0x2f3523[_0x511e('0x5f')]['attrs']=widgetAttributes(_0x2f3523[_0x511e('0x5f')]);return db[_0x511e('0x32')][_0x511e('0x3d')]({'where':{'id':_0x2f3523[_0x511e('0x30')]['id']}})['then'](handleEntityNotFound(_0x5d1433,null))['then'](saveUpdates(_0x2f3523[_0x511e('0x5f')],null))[_0x511e('0x2b')](respondWithResult(_0x5d1433,null))['catch'](handleError(_0x5d1433,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a9ef57c..8d8e3a4 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 _0x070f=['DashboardItem','save','update','remove','emit','exports','events'];(function(_0x2b3a98,_0x3796c6){var _0xdf53c0=function(_0x2aac80){while(--_0x2aac80){_0x2b3a98['push'](_0x2b3a98['shift']());}};_0xdf53c0(++_0x3796c6);}(_0x070f,0x13a));var _0xf070=function(_0x237206,_0xc21d91){_0x237206=_0x237206-0x0;var _0x209f1a=_0x070f[_0x237206];return _0x209f1a;};'use strict';var EventEmitter=require(_0xf070('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xf070('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf070('0x2'),'afterUpdate':_0xf070('0x3'),'afterDestroy':_0xf070('0x4')};function emitEvent(_0x100840){return function(_0x2f656e,_0x124467,_0x585478){DashboardItemEvents[_0xf070('0x5')](_0x100840+':'+_0x2f656e['id'],_0x2f656e);DashboardItemEvents['emit'](_0x100840,_0x2f656e);_0x585478(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xf070('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xbc11=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2e4b57,_0x428aae){var _0x326652=function(_0x12803f){while(--_0x12803f){_0x2e4b57['push'](_0x2e4b57['shift']());}};_0x326652(++_0x428aae);}(_0xbc11,0xa0));var _0x1bc1=function(_0x490983,_0x562374){_0x490983=_0x490983-0x0;var _0x40ef8a=_0xbc11[_0x490983];return _0x40ef8a;};'use strict';var EventEmitter=require(_0x1bc1('0x0'));var DashboardItem=require(_0x1bc1('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1bc1('0x2'),'afterUpdate':_0x1bc1('0x3'),'afterDestroy':_0x1bc1('0x4')};function emitEvent(_0x3061e0){return function(_0x1e5e93,_0x26a3ba,_0x539566){DashboardItemEvents[_0x1bc1('0x5')](_0x3061e0+':'+_0x1e5e93['id'],_0x1e5e93);DashboardItemEvents[_0x1bc1('0x5')](_0x3061e0,_0x1e5e93);_0x539566(null);};}for(var e in events){if(events[_0x1bc1('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x1bc1('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index cbe909a..3080ac6 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 _0xe608=['dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','DashboardItem'];(function(_0xf8053,_0x4b5401){var _0x2fe82f=function(_0x3fb111){while(--_0x3fb111){_0xf8053['push'](_0xf8053['shift']());}};_0x2fe82f(++_0x4b5401);}(_0xe608,0xb5));var _0x8e60=function(_0x50856f,_0x262f2c){_0x50856f=_0x50856f-0x0;var _0x505ca2=_0xe608[_0x50856f];return _0x505ca2;};'use strict';var _=require(_0x8e60('0x0'));var util=require('util');var logger=require(_0x8e60('0x1'))(_0x8e60('0x2'));var moment=require(_0x8e60('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e60('0x4'));var fs=require('fs');var path=require(_0x8e60('0x5'));var rimraf=require(_0x8e60('0x6'));var config=require(_0x8e60('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x55b99d,_0x2f027d){return _0x55b99d['define'](_0x8e60('0x8'),attributes,{'tableName':_0x8e60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48e7=['moment','bluebird','request-promise','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','util','../../config/logger','api'];(function(_0x1c5835,_0x20431a){var _0x558ebf=function(_0x2bc9da){while(--_0x2bc9da){_0x1c5835['push'](_0x1c5835['shift']());}};_0x558ebf(++_0x20431a);}(_0x48e7,0x13d));var _0x748e=function(_0x342993,_0x17d720){_0x342993=_0x342993-0x0;var _0x200761=_0x48e7[_0x342993];return _0x200761;};'use strict';var _=require('lodash');var util=require(_0x748e('0x0'));var logger=require(_0x748e('0x1'))(_0x748e('0x2'));var moment=require(_0x748e('0x3'));var BPromise=require(_0x748e('0x4'));var rp=require(_0x748e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x748e('0x6'));module[_0x748e('0x7')]=function(_0x3b4ea9,_0x119f8c){return _0x3b4ea9['define'](_0x748e('0x8'),attributes,{'tableName':_0x748e('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 0a6affe..e788935 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 _0x4f3d=['DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./dashboardItem.socket','register','request','then','info'];(function(_0x58e2a5,_0x4e822c){var _0x440ba0=function(_0x375d68){while(--_0x375d68){_0x58e2a5['push'](_0x58e2a5['shift']());}};_0x440ba0(++_0x4e822c);}(_0x4f3d,0x1ca));var _0xd4f3=function(_0xbf1924,_0x506493){_0xbf1924=_0xbf1924-0x0;var _0x325b96=_0x4f3d[_0xbf1924];return _0x325b96;};'use strict';var _=require(_0xd4f3('0x0'));var util=require(_0xd4f3('0x1'));var moment=require(_0xd4f3('0x2'));var BPromise=require(_0xd4f3('0x3'));var rs=require(_0xd4f3('0x4'));var fs=require('fs');var Redis=require(_0xd4f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4f3('0x6'));var logger=require(_0xd4f3('0x7'))(_0xd4f3('0x8'));var config=require(_0xd4f3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd4f3('0xa')]['http']({'port':0x232a});config[_0xd4f3('0xb')]=_['defaults'](config[_0xd4f3('0xb')],{'host':_0xd4f3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd4f3('0xd'))[_0xd4f3('0xe')](socket);function respondWithRpcPromise(_0xfa8537,_0x38d5e4,_0x5c895b){return new BPromise(function(_0x4e4c9d,_0x49e83e){return client[_0xd4f3('0xf')](_0xfa8537,_0x5c895b)[_0xd4f3('0x10')](function(_0x3168a3){logger[_0xd4f3('0x11')](_0xd4f3('0x12'),_0x38d5e4,_0xd4f3('0x13'));logger[_0xd4f3('0x14')](_0xd4f3('0x15'),_0x38d5e4,_0xd4f3('0x13'),JSON[_0xd4f3('0x16')](_0x3168a3));if(_0x3168a3[_0xd4f3('0x17')]){if(_0x3168a3[_0xd4f3('0x17')][_0xd4f3('0x18')]===0x1f4){logger[_0xd4f3('0x17')](_0xd4f3('0x12'),_0x38d5e4,_0x3168a3[_0xd4f3('0x17')][_0xd4f3('0x19')]);return _0x49e83e(_0x3168a3[_0xd4f3('0x17')][_0xd4f3('0x19')]);}logger[_0xd4f3('0x17')]('DashboardItem,\x20%s,\x20%s',_0x38d5e4,_0x3168a3[_0xd4f3('0x17')][_0xd4f3('0x19')]);return _0x4e4c9d(_0x3168a3[_0xd4f3('0x17')][_0xd4f3('0x19')]);}else{logger['info'](_0xd4f3('0x12'),_0x38d5e4,'request\x20sent');_0x4e4c9d(_0x3168a3[_0xd4f3('0x1a')][_0xd4f3('0x19')]);}})[_0xd4f3('0x1b')](function(_0x34f6d9){logger[_0xd4f3('0x17')](_0xd4f3('0x12'),_0x38d5e4,_0x34f6d9);_0x49e83e(_0x34f6d9);});});} \ No newline at end of file +var _0x40dc=['localhost','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','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x40dc,0x15a));var _0xc40d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc40d('0x0'));var moment=require(_0xc40d('0x1'));var BPromise=require(_0xc40d('0x2'));var rs=require(_0xc40d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc40d('0x4'))['db'];var utils=require(_0xc40d('0x5'));var logger=require(_0xc40d('0x6'))(_0xc40d('0x7'));var config=require(_0xc40d('0x8'));var jayson=require(_0xc40d('0x9'));var client=jayson[_0xc40d('0xa')][_0xc40d('0xb')]({'port':0x232a});config[_0xc40d('0xc')]=_[_0xc40d('0xd')](config[_0xc40d('0xc')],{'host':_0xc40d('0xe'),'port':0x18eb});var socket=require(_0xc40d('0xf'))(new Redis(config[_0xc40d('0xc')]));require(_0xc40d('0x10'))[_0xc40d('0x11')](socket);function respondWithRpcPromise(_0x9876ae,_0x1b2932,_0x2c6017){return new BPromise(function(_0x141e03,_0x2162e7){return client[_0xc40d('0x12')](_0x9876ae,_0x2c6017)[_0xc40d('0x13')](function(_0xdd3922){logger['info'](_0xc40d('0x14'),_0x1b2932,_0xc40d('0x15'));logger[_0xc40d('0x16')](_0xc40d('0x17'),_0x1b2932,'request\x20sent',JSON[_0xc40d('0x18')](_0xdd3922));if(_0xdd3922['error']){if(_0xdd3922[_0xc40d('0x19')]['code']===0x1f4){logger[_0xc40d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x1b2932,_0xdd3922[_0xc40d('0x19')][_0xc40d('0x1a')]);return _0x2162e7(_0xdd3922[_0xc40d('0x19')]['message']);}logger[_0xc40d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x1b2932,_0xdd3922[_0xc40d('0x19')][_0xc40d('0x1a')]);return _0x141e03(_0xdd3922[_0xc40d('0x19')][_0xc40d('0x1a')]);}else{logger[_0xc40d('0x1b')](_0xc40d('0x14'),_0x1b2932,_0xc40d('0x15'));_0x141e03(_0xdd3922[_0xc40d('0x1c')]['message']);}})[_0xc40d('0x1d')](function(_0x1dfa43){logger['error']('DashboardItem,\x20%s,\x20%s',_0x1b2932,_0x1dfa43);_0x2162e7(_0x1dfa43);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ae8e5e0..c248eaa 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 _0x76b0=['save','remove','update','emit','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x200f72,_0x44be0e){var _0x58f4fd=function(_0xeef45f){while(--_0xeef45f){_0x200f72['push'](_0x200f72['shift']());}};_0x58f4fd(++_0x44be0e);}(_0x76b0,0x117));var _0x076b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x76b0[_0xaa1b3e];return _0x454d7d;};'use strict';var DashboardItemEvents=require(_0x076b('0x0'));var events=[_0x076b('0x1'),_0x076b('0x2'),_0x076b('0x3')];function createListener(_0x2caa22,_0x30c5c7){return function(_0x1afe53){_0x30c5c7[_0x076b('0x4')](_0x2caa22,_0x1afe53);};}function removeListener(_0x5c16da,_0x2ef43e){return function(){DashboardItemEvents['removeListener'](_0x5c16da,_0x2ef43e);};}exports[_0x076b('0x5')]=function(_0x2869fb){for(var _0x53d544=0x0,_0x2b0acc=events[_0x076b('0x6')];_0x53d544<_0x2b0acc;_0x53d544++){var _0x3f7f1e=events[_0x53d544];var _0x1d0dbb=createListener(_0x076b('0x7')+_0x3f7f1e,_0x2869fb);DashboardItemEvents['on'](_0x3f7f1e,_0x1d0dbb);}}; \ No newline at end of file +var _0xe5fa=['emit','register','dashboardItem:','remove','update'];(function(_0x5d1b6d,_0x1d1b02){var _0x3c7d95=function(_0x4627d7){while(--_0x4627d7){_0x5d1b6d['push'](_0x5d1b6d['shift']());}};_0x3c7d95(++_0x1d1b02);}(_0xe5fa,0x17f));var _0xae5f=function(_0x1434bf,_0x1dae5c){_0x1434bf=_0x1434bf-0x0;var _0x23da9c=_0xe5fa[_0x1434bf];return _0x23da9c;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xae5f('0x0'),_0xae5f('0x1')];function createListener(_0x1511c0,_0x5abd57){return function(_0xd56a61){_0x5abd57[_0xae5f('0x2')](_0x1511c0,_0xd56a61);};}function removeListener(_0x6d8472,_0x2df4d9){return function(){DashboardItemEvents['removeListener'](_0x6d8472,_0x2df4d9);};}exports[_0xae5f('0x3')]=function(_0x38a8a6){for(var _0x367111=0x0,_0x1c4e13=events['length'];_0x367111<_0x1c4e13;_0x367111++){var _0x373deb=events[_0x367111];var _0x36f7ce=createListener(_0xae5f('0x4')+_0x373deb,_0x38a8a6);DashboardItemEvents['on'](_0x373deb,_0x36f7ce);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c7309e5..be6ede0 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 _0x7a15=['./dashboardItem.controller','get','/:id','isAuthenticated','post','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f95f2,_0x307ecc){var _0x5a2a66=function(_0x17c4f7){while(--_0x17c4f7){_0x3f95f2['push'](_0x3f95f2['shift']());}};_0x5a2a66(++_0x307ecc);}(_0x7a15,0x149));var _0x57a1=function(_0x3d8152,_0x9d30dd){_0x3d8152=_0x3d8152-0x0;var _0x2c37e6=_0x7a15[_0x3d8152];return _0x2c37e6;};'use strict';var multer=require('multer');var util=require(_0x57a1('0x0'));var path=require(_0x57a1('0x1'));var timeout=require(_0x57a1('0x2'));var express=require(_0x57a1('0x3'));var router=express['Router']();var fs_extra=require(_0x57a1('0x4'));var auth=require(_0x57a1('0x5'));var interaction=require(_0x57a1('0x6'));var config=require('../../config/environment');var controller=require(_0x57a1('0x7'));router[_0x57a1('0x8')](_0x57a1('0x9'),auth[_0x57a1('0xa')](),controller['show']);router[_0x57a1('0xb')]('/',auth[_0x57a1('0xa')](),controller['create']);router['put']('/:id',auth[_0x57a1('0xa')](),controller[_0x57a1('0xc')]);router[_0x57a1('0xd')](_0x57a1('0x9'),auth['isAuthenticated'](),controller[_0x57a1('0xe')]);module[_0x57a1('0xf')]=router; \ No newline at end of file +var _0xd08e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','path','connect-timeout'];(function(_0x5acae3,_0x31d121){var _0x9a433d=function(_0x526ace){while(--_0x526ace){_0x5acae3['push'](_0x5acae3['shift']());}};_0x9a433d(++_0x31d121);}(_0xd08e,0x1c6));var _0xed08=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xd08e[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xed08('0x0'));var timeout=require(_0xed08('0x1'));var express=require(_0xed08('0x2'));var router=express[_0xed08('0x3')]();var fs_extra=require(_0xed08('0x4'));var auth=require(_0xed08('0x5'));var interaction=require(_0xed08('0x6'));var config=require(_0xed08('0x7'));var controller=require(_0xed08('0x8'));router[_0xed08('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xed08('0xa')]);router[_0xed08('0xb')]('/',auth[_0xed08('0xc')](),controller[_0xed08('0xd')]);router[_0xed08('0xe')](_0xed08('0xf'),auth['isAuthenticated'](),controller[_0xed08('0x10')]);router[_0xed08('0x11')](_0xed08('0xf'),auth[_0xed08('0xc')](),controller[_0xed08('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 5ff2aa2..291c871 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 _0xac5a=['second','third','exports','STRING','first'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xac5a,0x8e));var _0xaac5=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xac5a[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require('sequelize');module[_0xaac5('0x0')]={'name':{'type':Sequelize[_0xaac5('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xaac5('0x2'),_0xaac5('0x3'),_0xaac5('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xaac5('0x1')]}}; \ No newline at end of file +var _0x384b=['second','third','sequelize','STRING','first'];(function(_0x3d3e6e,_0x302dfa){var _0x557cee=function(_0x59507a){while(--_0x59507a){_0x3d3e6e['push'](_0x3d3e6e['shift']());}};_0x557cee(++_0x302dfa);}(_0x384b,0xa2));var _0xb384=function(_0x3148df,_0x5226bb){_0x3148df=_0x3148df-0x0;var _0x10a71f=_0x384b[_0x3148df];return _0x10a71f;};'use strict';var Sequelize=require(_0xb384('0x0'));module['exports']={'name':{'type':Sequelize[_0xb384('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xb384('0x2'),_0xb384('0x3'),_0xb384('0x4')),'allowNull':![],'defaultValue':_0xb384('0x2')},'description':{'type':Sequelize[_0xb384('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ec4ac6f..de95333 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 _0x8375=['status','json','offset','count','set','Content-Range','apply','reject','update','then','get','Dispositions','UserProfileResource','destroy','end','error','stack','name','send','index','Disposition','rawAttributes','type','key','model','map','query','filters','attributes','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','intersection','options','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x12df2d,_0x164072){var _0x575ec5=function(_0x45b093){while(--_0x45b093){_0x12df2d['push'](_0x12df2d['shift']());}};_0x575ec5(++_0x164072);}(_0x8375,0x132));var _0x5837=function(_0x257723,_0x1c80d0){_0x257723=_0x257723-0x0;var _0x24282d=_0x8375[_0x257723];return _0x24282d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5837('0x0'));var zipdir=require(_0x5837('0x1'));var jsonpatch=require(_0x5837('0x2'));var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require('mustache');var util=require(_0x5837('0x6'));var path=require(_0x5837('0x7'));var sox=require('sox');var csv=require(_0x5837('0x8'));var ejs=require(_0x5837('0x9'));var fs=require('fs');var fs_extra=require(_0x5837('0xa'));var _=require(_0x5837('0xb'));var squel=require('squel');var crypto=require(_0x5837('0xc'));var jsforce=require(_0x5837('0xd'));var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x8'));var querystring=require(_0x5837('0xf'));var Papa=require(_0x5837('0x10'));var Redis=require(_0x5837('0x11'));var authService=require(_0x5837('0x12'));var qs=require(_0x5837('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5837('0x14'));var logger=require(_0x5837('0x15'))('api');var utils=require(_0x5837('0x16'));var config=require(_0x5837('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x5abd5e,_0x2b0b43){_0x2b0b43=_0x2b0b43||0xcc;return function(_0x3ad5b3){if(_0x3ad5b3){return _0x5abd5e[_0x5837('0x19')](_0x2b0b43);}return _0x5abd5e[_0x5837('0x1a')](_0x2b0b43)['end']();};}function respondWithResult(_0x2b82a9,_0x103b9c){_0x103b9c=_0x103b9c||0xc8;return function(_0x2bc6f6){if(_0x2bc6f6){return _0x2b82a9['status'](_0x103b9c)[_0x5837('0x1b')](_0x2bc6f6);}};}function respondWithFilteredResult(_0x11f16c,_0x2f8af0){return function(_0x23c3af){if(_0x23c3af){var _0x304fe7=typeof _0x2f8af0[_0x5837('0x1c')]==='undefined'&&typeof _0x2f8af0['limit']==='undefined';var _0x37824b=_0x23c3af[_0x5837('0x1d')];var _0x1a5725=_0x304fe7?0x0:_0x2f8af0[_0x5837('0x1c')];var _0x128b4a=_0x304fe7?_0x23c3af[_0x5837('0x1d')]:_0x2f8af0[_0x5837('0x1c')]+_0x2f8af0['limit'];var _0x3c5ec9;if(_0x128b4a>=_0x37824b){_0x128b4a=_0x37824b;_0x3c5ec9=0xc8;}else{_0x3c5ec9=0xce;}_0x11f16c[_0x5837('0x1a')](_0x3c5ec9);return _0x11f16c[_0x5837('0x1e')](_0x5837('0x1f'),_0x1a5725+'-'+_0x128b4a+'/'+_0x37824b)[_0x5837('0x1b')](_0x23c3af);}return null;};}function patchUpdates(_0x50c42c){return function(_0x4bd76c){try{jsonpatch[_0x5837('0x20')](_0x4bd76c,_0x50c42c,!![]);}catch(_0x21c0bf){return BPromise[_0x5837('0x21')](_0x21c0bf);}return _0x4bd76c['save']();};}function saveUpdates(_0x31010b,_0x46786c){return function(_0x4b59b1){if(_0x4b59b1){return _0x4b59b1[_0x5837('0x22')](_0x31010b)[_0x5837('0x23')](function(_0x5e9c2e){return _0x5e9c2e;});}return null;};}function removeEntity(_0x332a90,_0x2709cf){return function(_0x1366c1){if(_0x1366c1){return _0x1366c1['destroy']()[_0x5837('0x23')](function(){var _0x4c431c=_0x1366c1[_0x5837('0x24')]({'plain':!![]});var _0x8e5a48=_0x5837('0x25');return db[_0x5837('0x26')][_0x5837('0x27')]({'where':{'type':_0x8e5a48,'resourceId':_0x4c431c['id']}})[_0x5837('0x23')](function(){return _0x1366c1;});})[_0x5837('0x23')](function(){_0x332a90[_0x5837('0x1a')](0xcc)[_0x5837('0x28')]();});}};}function handleEntityNotFound(_0x192883,_0x24b941){return function(_0x27848d){if(!_0x27848d){_0x192883[_0x5837('0x19')](0x194);}return _0x27848d;};}function handleError(_0x3a6cc8,_0x271e23){_0x271e23=_0x271e23||0x1f4;return function(_0x5c17dd){logger[_0x5837('0x29')](_0x5c17dd[_0x5837('0x2a')]);if(_0x5c17dd[_0x5837('0x2b')]){delete _0x5c17dd[_0x5837('0x2b')];}_0x3a6cc8[_0x5837('0x1a')](_0x271e23)[_0x5837('0x2c')](_0x5c17dd);};}exports[_0x5837('0x2d')]=function(_0x4e3259,_0x89e7e5){var _0x290e14={},_0x3a3a34={},_0x285186={'count':0x0,'rows':[]};var _0x55b71b=_['map'](db[_0x5837('0x2e')][_0x5837('0x2f')],function(_0x12cdcd){return{'name':_0x12cdcd['fieldName'],'type':_0x12cdcd[_0x5837('0x30')][_0x5837('0x31')]};});_0x3a3a34[_0x5837('0x32')]=_[_0x5837('0x33')](_0x55b71b,_0x5837('0x2b'));_0x3a3a34[_0x5837('0x34')]=_['keys'](_0x4e3259[_0x5837('0x34')]);_0x3a3a34[_0x5837('0x35')]=_['intersection'](_0x3a3a34[_0x5837('0x32')],_0x3a3a34[_0x5837('0x34')]);_0x290e14[_0x5837('0x36')]=_['intersection'](_0x3a3a34['model'],qs['fields'](_0x4e3259['query'][_0x5837('0x37')]));_0x290e14['attributes']=_0x290e14['attributes'][_0x5837('0x38')]?_0x290e14[_0x5837('0x36')]:_0x3a3a34['model'];if(!_0x4e3259[_0x5837('0x34')]['hasOwnProperty'](_0x5837('0x39'))){_0x290e14[_0x5837('0x3a')]=qs['limit'](_0x4e3259[_0x5837('0x34')][_0x5837('0x3a')]);_0x290e14['offset']=qs[_0x5837('0x1c')](_0x4e3259['query'][_0x5837('0x1c')]);}_0x290e14['order']=qs['sort'](_0x4e3259[_0x5837('0x34')][_0x5837('0x3b')]);_0x290e14[_0x5837('0x3c')]=qs[_0x5837('0x35')](_[_0x5837('0x3d')](_0x4e3259['query'],_0x3a3a34[_0x5837('0x35')]),_0x55b71b);if(_0x4e3259['query']['filter']){_0x290e14[_0x5837('0x3c')]=_[_0x5837('0x3e')](_0x290e14['where'],{'$or':_[_0x5837('0x33')](_0x55b71b,function(_0x3c27e8){if(_0x3c27e8[_0x5837('0x30')]!==_0x5837('0x3f')){var _0x1fefdb={};_0x1fefdb[_0x3c27e8[_0x5837('0x2b')]]={'$like':'%'+_0x4e3259[_0x5837('0x34')][_0x5837('0x40')]+'%'};return _0x1fefdb;}})});}_0x290e14=_[_0x5837('0x3e')]({},_0x290e14,_0x4e3259['options']);var _0xa8e83b={'where':_0x290e14['where']};return db['Disposition'][_0x5837('0x1d')](_0xa8e83b)[_0x5837('0x23')](function(_0x5e6916){_0x285186[_0x5837('0x1d')]=_0x5e6916;if(_0x4e3259[_0x5837('0x34')][_0x5837('0x41')]){_0x290e14[_0x5837('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x5837('0x43')](_0x290e14);})[_0x5837('0x23')](function(_0x84eff){_0x285186[_0x5837('0x44')]=_0x84eff;return _0x285186;})[_0x5837('0x23')](respondWithFilteredResult(_0x89e7e5,_0x290e14))['catch'](handleError(_0x89e7e5,null));};exports[_0x5837('0x45')]=function(_0x45513d,_0x3075da){var _0x50866e={'raw':!![],'where':{'id':_0x45513d[_0x5837('0x46')]['id']}},_0x45e6b8={};_0x45e6b8[_0x5837('0x32')]=_[_0x5837('0x47')](db[_0x5837('0x2e')][_0x5837('0x2f')]);_0x45e6b8[_0x5837('0x34')]=_[_0x5837('0x47')](_0x45513d[_0x5837('0x34')]);_0x45e6b8[_0x5837('0x35')]=_[_0x5837('0x48')](_0x45e6b8['model'],_0x45e6b8[_0x5837('0x34')]);_0x50866e[_0x5837('0x36')]=_['intersection'](_0x45e6b8['model'],qs[_0x5837('0x37')](_0x45513d['query'][_0x5837('0x37')]));_0x50866e[_0x5837('0x36')]=_0x50866e[_0x5837('0x36')][_0x5837('0x38')]?_0x50866e['attributes']:_0x45e6b8[_0x5837('0x32')];if(_0x45513d[_0x5837('0x34')][_0x5837('0x41')]){_0x50866e[_0x5837('0x42')]=[{'all':!![]}];}_0x50866e=_[_0x5837('0x3e')]({},_0x50866e,_0x45513d[_0x5837('0x49')]);return db[_0x5837('0x2e')][_0x5837('0x4a')](_0x50866e)[_0x5837('0x23')](handleEntityNotFound(_0x3075da,null))['then'](respondWithResult(_0x3075da,null))[_0x5837('0x4b')](handleError(_0x3075da,null));};exports[_0x5837('0x4c')]=function(_0xd49ba7,_0x16f12f){return db[_0x5837('0x2e')][_0x5837('0x4c')](_0xd49ba7['body'],{})[_0x5837('0x23')](function(_0x3d88df){var _0x3f5db9=_0xd49ba7[_0x5837('0x4d')][_0x5837('0x24')]({'plain':!![]});if(!_0x3f5db9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f5db9[_0x5837('0x4e')]==='user'){var _0x105315=_0x3d88df[_0x5837('0x24')]({'plain':!![]});var _0x42d0e2='Dispositions';return db[_0x5837('0x4f')][_0x5837('0x4a')]({'where':{'name':_0x42d0e2,'userProfileId':_0x3f5db9[_0x5837('0x50')]},'raw':!![]})[_0x5837('0x23')](function(_0xd28f94){if(_0xd28f94&&_0xd28f94[_0x5837('0x51')]===0x0){return db[_0x5837('0x26')][_0x5837('0x4c')]({'name':_0x105315[_0x5837('0x2b')],'resourceId':_0x105315['id'],'type':_0xd28f94['name'],'sectionId':_0xd28f94['id']},{})['then'](function(){return _0x3d88df;});}else{return _0x3d88df;}})[_0x5837('0x4b')](function(_0x219f2d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x219f2d);throw _0x219f2d;});}return _0x3d88df;})[_0x5837('0x23')](respondWithResult(_0x16f12f,0xc9))[_0x5837('0x4b')](handleError(_0x16f12f,null));};exports[_0x5837('0x22')]=function(_0x1e68b7,_0xda7373){if(_0x1e68b7['body']['id']){delete _0x1e68b7[_0x5837('0x52')]['id'];}return db[_0x5837('0x2e')][_0x5837('0x4a')]({'where':{'id':_0x1e68b7['params']['id']}})['then'](handleEntityNotFound(_0xda7373,null))[_0x5837('0x23')](saveUpdates(_0x1e68b7[_0x5837('0x52')],null))[_0x5837('0x23')](respondWithResult(_0xda7373,null))[_0x5837('0x4b')](handleError(_0xda7373,null));};exports['destroy']=function(_0x1ad14c,_0x4a66c4){return db['Disposition'][_0x5837('0x4a')]({'where':{'id':_0x1ad14c[_0x5837('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a66c4,null))[_0x5837('0x23')](removeEntity(_0x4a66c4,null))[_0x5837('0x4b')](handleError(_0x4a66c4,null));}; \ No newline at end of file +var _0x7163=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Disposition','include','rows','show','params','keys','length','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x412b6d,_0x3383b7){var _0x855f66=function(_0x27d9e8){while(--_0x27d9e8){_0x412b6d['push'](_0x412b6d['shift']());}};_0x855f66(++_0x3383b7);}(_0x7163,0x1ef));var _0x3716=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x7163[_0x523adf];return _0x283870;};'use strict';var emlformat=require(_0x3716('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3716('0x1'));var rp=require(_0x3716('0x2'));var moment=require(_0x3716('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3716('0x4'));var util=require(_0x3716('0x5'));var path=require(_0x3716('0x6'));var sox=require(_0x3716('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3716('0x8'));var _=require(_0x3716('0x9'));var squel=require(_0x3716('0xa'));var crypto=require(_0x3716('0xb'));var jsforce=require(_0x3716('0xc'));var deskjs=require(_0x3716('0xd'));var toCsv=require(_0x3716('0xe'));var querystring=require(_0x3716('0xf'));var Papa=require(_0x3716('0x10'));var Redis=require(_0x3716('0x11'));var authService=require(_0x3716('0x12'));var qs=require(_0x3716('0x13'));var as=require(_0x3716('0x14'));var hardwareService=require(_0x3716('0x15'));var logger=require(_0x3716('0x16'))(_0x3716('0x17'));var utils=require(_0x3716('0x18'));var config=require(_0x3716('0x19'));var licenseUtil=require(_0x3716('0x1a'));var db=require(_0x3716('0x1b'))['db'];function respondWithStatusCode(_0x2c32cf,_0x2bbb95){_0x2bbb95=_0x2bbb95||0xcc;return function(_0x21925a){if(_0x21925a){return _0x2c32cf[_0x3716('0x1c')](_0x2bbb95);}return _0x2c32cf[_0x3716('0x1d')](_0x2bbb95)[_0x3716('0x1e')]();};}function respondWithResult(_0xc095c4,_0x131c5a){_0x131c5a=_0x131c5a||0xc8;return function(_0x4d1791){if(_0x4d1791){return _0xc095c4['status'](_0x131c5a)['json'](_0x4d1791);}};}function respondWithFilteredResult(_0x493b7d,_0x372785){return function(_0x5bbc0a){if(_0x5bbc0a){var _0x166835=typeof _0x372785[_0x3716('0x1f')]===_0x3716('0x20')&&typeof _0x372785['limit']==='undefined';var _0x5f3833=_0x5bbc0a['count'];var _0x27fa57=_0x166835?0x0:_0x372785[_0x3716('0x1f')];var _0x5d16c4=_0x166835?_0x5bbc0a[_0x3716('0x21')]:_0x372785[_0x3716('0x1f')]+_0x372785[_0x3716('0x22')];var _0xf6c764;if(_0x5d16c4>=_0x5f3833){_0x5d16c4=_0x5f3833;_0xf6c764=0xc8;}else{_0xf6c764=0xce;}_0x493b7d[_0x3716('0x1d')](_0xf6c764);return _0x493b7d[_0x3716('0x23')](_0x3716('0x24'),_0x27fa57+'-'+_0x5d16c4+'/'+_0x5f3833)['json'](_0x5bbc0a);}return null;};}function patchUpdates(_0x4cd0a6){return function(_0x524db1){try{jsonpatch[_0x3716('0x25')](_0x524db1,_0x4cd0a6,!![]);}catch(_0x49a885){return BPromise[_0x3716('0x26')](_0x49a885);}return _0x524db1[_0x3716('0x27')]();};}function saveUpdates(_0x2cccca,_0x233517){return function(_0x2b5296){if(_0x2b5296){return _0x2b5296[_0x3716('0x28')](_0x2cccca)[_0x3716('0x29')](function(_0x12bc19){return _0x12bc19;});}return null;};}function removeEntity(_0x1f18b2,_0x483bdd){return function(_0xec15ce){if(_0xec15ce){return _0xec15ce[_0x3716('0x2a')]()[_0x3716('0x29')](function(){var _0x4a073e=_0xec15ce[_0x3716('0x2b')]({'plain':!![]});var _0x3e7452='Dispositions';return db[_0x3716('0x2c')]['destroy']({'where':{'type':_0x3e7452,'resourceId':_0x4a073e['id']}})[_0x3716('0x29')](function(){return _0xec15ce;});})[_0x3716('0x29')](function(){_0x1f18b2[_0x3716('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x150324,_0x5a4476){return function(_0x430ed4){if(!_0x430ed4){_0x150324[_0x3716('0x1c')](0x194);}return _0x430ed4;};}function handleError(_0x4f0f2b,_0x3aec25){_0x3aec25=_0x3aec25||0x1f4;return function(_0x3dcf6b){logger[_0x3716('0x2d')](_0x3dcf6b[_0x3716('0x2e')]);if(_0x3dcf6b[_0x3716('0x2f')]){delete _0x3dcf6b['name'];}_0x4f0f2b[_0x3716('0x1d')](_0x3aec25)[_0x3716('0x30')](_0x3dcf6b);};}exports[_0x3716('0x31')]=function(_0x16ed51,_0x4fee70){var _0x3e844f={},_0x27553a={},_0x440e7f={'count':0x0,'rows':[]};var _0x3f82c7=_[_0x3716('0x32')](db['Disposition'][_0x3716('0x33')],function(_0x1abb66){return{'name':_0x1abb66[_0x3716('0x34')],'type':_0x1abb66['type']['key']};});_0x27553a[_0x3716('0x35')]=_[_0x3716('0x32')](_0x3f82c7,_0x3716('0x2f'));_0x27553a[_0x3716('0x36')]=_['keys'](_0x16ed51[_0x3716('0x36')]);_0x27553a[_0x3716('0x37')]=_[_0x3716('0x38')](_0x27553a[_0x3716('0x35')],_0x27553a[_0x3716('0x36')]);_0x3e844f[_0x3716('0x39')]=_['intersection'](_0x27553a[_0x3716('0x35')],qs[_0x3716('0x3a')](_0x16ed51[_0x3716('0x36')]['fields']));_0x3e844f['attributes']=_0x3e844f[_0x3716('0x39')]['length']?_0x3e844f[_0x3716('0x39')]:_0x27553a[_0x3716('0x35')];if(!_0x16ed51[_0x3716('0x36')][_0x3716('0x3b')](_0x3716('0x3c'))){_0x3e844f[_0x3716('0x22')]=qs[_0x3716('0x22')](_0x16ed51[_0x3716('0x36')]['limit']);_0x3e844f[_0x3716('0x1f')]=qs[_0x3716('0x1f')](_0x16ed51[_0x3716('0x36')]['offset']);}_0x3e844f[_0x3716('0x3d')]=qs['sort'](_0x16ed51[_0x3716('0x36')][_0x3716('0x3e')]);_0x3e844f[_0x3716('0x3f')]=qs[_0x3716('0x37')](_[_0x3716('0x40')](_0x16ed51[_0x3716('0x36')],_0x27553a[_0x3716('0x37')]),_0x3f82c7);if(_0x16ed51[_0x3716('0x36')][_0x3716('0x41')]){_0x3e844f[_0x3716('0x3f')]=_[_0x3716('0x42')](_0x3e844f['where'],{'$or':_[_0x3716('0x32')](_0x3f82c7,function(_0x18a4b2){if(_0x18a4b2[_0x3716('0x43')]!==_0x3716('0x44')){var _0x57b8b2={};_0x57b8b2[_0x18a4b2[_0x3716('0x2f')]]={'$like':'%'+_0x16ed51[_0x3716('0x36')]['filter']+'%'};return _0x57b8b2;}})});}_0x3e844f=_[_0x3716('0x42')]({},_0x3e844f,_0x16ed51[_0x3716('0x45')]);var _0x56f193={'where':_0x3e844f[_0x3716('0x3f')]};return db[_0x3716('0x46')]['count'](_0x56f193)[_0x3716('0x29')](function(_0xe4b86a){_0x440e7f['count']=_0xe4b86a;if(_0x16ed51[_0x3716('0x36')]['includeAll']){_0x3e844f[_0x3716('0x47')]=[{'all':!![]}];}return db[_0x3716('0x46')]['findAll'](_0x3e844f);})['then'](function(_0x100807){_0x440e7f[_0x3716('0x48')]=_0x100807;return _0x440e7f;})[_0x3716('0x29')](respondWithFilteredResult(_0x4fee70,_0x3e844f))['catch'](handleError(_0x4fee70,null));};exports[_0x3716('0x49')]=function(_0x1517dd,_0x57fddb){var _0x2c5e55={'raw':!![],'where':{'id':_0x1517dd[_0x3716('0x4a')]['id']}},_0x550fda={};_0x550fda[_0x3716('0x35')]=_[_0x3716('0x4b')](db['Disposition']['rawAttributes']);_0x550fda[_0x3716('0x36')]=_[_0x3716('0x4b')](_0x1517dd['query']);_0x550fda[_0x3716('0x37')]=_[_0x3716('0x38')](_0x550fda[_0x3716('0x35')],_0x550fda[_0x3716('0x36')]);_0x2c5e55[_0x3716('0x39')]=_[_0x3716('0x38')](_0x550fda[_0x3716('0x35')],qs['fields'](_0x1517dd[_0x3716('0x36')][_0x3716('0x3a')]));_0x2c5e55[_0x3716('0x39')]=_0x2c5e55[_0x3716('0x39')][_0x3716('0x4c')]?_0x2c5e55[_0x3716('0x39')]:_0x550fda[_0x3716('0x35')];if(_0x1517dd['query']['includeAll']){_0x2c5e55['include']=[{'all':!![]}];}_0x2c5e55=_['merge']({},_0x2c5e55,_0x1517dd[_0x3716('0x45')]);return db[_0x3716('0x46')][_0x3716('0x4d')](_0x2c5e55)[_0x3716('0x29')](handleEntityNotFound(_0x57fddb,null))['then'](respondWithResult(_0x57fddb,null))[_0x3716('0x4e')](handleError(_0x57fddb,null));};exports['create']=function(_0xf06450,_0x524088){return db[_0x3716('0x46')]['create'](_0xf06450[_0x3716('0x4f')],{})[_0x3716('0x29')](function(_0x417ed6){var _0x259b7a=_0xf06450[_0x3716('0x50')][_0x3716('0x2b')]({'plain':!![]});if(!_0x259b7a)throw new Error(_0x3716('0x51'));if(_0x259b7a[_0x3716('0x52')]===_0x3716('0x50')){var _0xca5eca=_0x417ed6[_0x3716('0x2b')]({'plain':!![]});var _0x54b41a='Dispositions';return db[_0x3716('0x53')][_0x3716('0x4d')]({'where':{'name':_0x54b41a,'userProfileId':_0x259b7a['userProfileId']},'raw':!![]})[_0x3716('0x29')](function(_0x42db1a){if(_0x42db1a&&_0x42db1a[_0x3716('0x54')]===0x0){return db[_0x3716('0x2c')][_0x3716('0x55')]({'name':_0xca5eca['name'],'resourceId':_0xca5eca['id'],'type':_0x42db1a[_0x3716('0x2f')],'sectionId':_0x42db1a['id']},{})[_0x3716('0x29')](function(){return _0x417ed6;});}else{return _0x417ed6;}})['catch'](function(_0xa2c92c){logger[_0x3716('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa2c92c);throw _0xa2c92c;});}return _0x417ed6;})[_0x3716('0x29')](respondWithResult(_0x524088,0xc9))[_0x3716('0x4e')](handleError(_0x524088,null));};exports['update']=function(_0x534efd,_0x40698b){if(_0x534efd[_0x3716('0x4f')]['id']){delete _0x534efd[_0x3716('0x4f')]['id'];}return db[_0x3716('0x46')][_0x3716('0x4d')]({'where':{'id':_0x534efd[_0x3716('0x4a')]['id']}})[_0x3716('0x29')](handleEntityNotFound(_0x40698b,null))[_0x3716('0x29')](saveUpdates(_0x534efd[_0x3716('0x4f')],null))['then'](respondWithResult(_0x40698b,null))[_0x3716('0x4e')](handleError(_0x40698b,null));};exports[_0x3716('0x2a')]=function(_0xbcadc4,_0x50ceee){return db[_0x3716('0x46')][_0x3716('0x4d')]({'where':{'id':_0xbcadc4[_0x3716('0x4a')]['id']}})[_0x3716('0x29')](handleEntityNotFound(_0x50ceee,null))[_0x3716('0x29')](removeEntity(_0x50ceee,null))[_0x3716('0x4e')](handleError(_0x50ceee,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f92fe93..38ad774 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 _0x2db4=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0x483afa,_0x3b127d){var _0x35a382=function(_0x319975){while(--_0x319975){_0x483afa['push'](_0x483afa['shift']());}};_0x35a382(++_0x3b127d);}(_0x2db4,0xbd));var _0x42db=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2db4[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x42db('0x0'));var util=require(_0x42db('0x1'));var logger=require('../../config/logger')(_0x42db('0x2'));var moment=require(_0x42db('0x3'));var BPromise=require(_0x42db('0x4'));var rp=require(_0x42db('0x5'));var fs=require('fs');var path=require(_0x42db('0x6'));var rimraf=require(_0x42db('0x7'));var config=require(_0x42db('0x8'));var attributes=require(_0x42db('0x9'));module[_0x42db('0xa')]=function(_0x161adf,_0x5ded6a){return _0x161adf[_0x42db('0xb')](_0x42db('0xc'),attributes,{'tableName':_0x42db('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x42db('0xe'),'fields':[_0x42db('0xf'),_0x42db('0x10')]},{'unique':!![],'name':_0x42db('0x11'),'fields':[_0x42db('0xf'),_0x42db('0x12')]},{'unique':!![],'name':_0x42db('0x13'),'fields':['name',_0x42db('0x14')]},{'unique':!![],'name':_0x42db('0x15'),'fields':[_0x42db('0xf'),_0x42db('0x16')]},{'unique':!![],'name':_0x42db('0x17'),'fields':[_0x42db('0xf'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0x42db('0x18')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x42db('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc936=['name','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./disposition.attributes','exports','tools_dispositions','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0xbee07d,_0x255af8){var _0x4507de=function(_0xa35a24){while(--_0xa35a24){_0xbee07d['push'](_0xbee07d['shift']());}};_0x4507de(++_0x255af8);}(_0xc936,0xed));var _0x6c93=function(_0x52ff63,_0x32f56b){_0x52ff63=_0x52ff63-0x0;var _0x43a43a=_0xc936[_0x52ff63];return _0x43a43a;};'use strict';var _=require('lodash');var util=require(_0x6c93('0x0'));var logger=require(_0x6c93('0x1'))(_0x6c93('0x2'));var moment=require(_0x6c93('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c93('0x4'));var fs=require('fs');var path=require(_0x6c93('0x5'));var rimraf=require('rimraf');var config=require(_0x6c93('0x6'));var attributes=require(_0x6c93('0x7'));module[_0x6c93('0x8')]=function(_0x8a6db,_0x2680d9){return _0x8a6db['define']('Disposition',attributes,{'tableName':_0x6c93('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x6c93('0xa'),'fields':['name',_0x6c93('0xb')]},{'unique':!![],'name':_0x6c93('0xc'),'fields':['name',_0x6c93('0xd')]},{'unique':!![],'name':_0x6c93('0xe'),'fields':[_0x6c93('0xf'),_0x6c93('0x10')]},{'unique':!![],'name':_0x6c93('0x11'),'fields':[_0x6c93('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x6c93('0x12'),'fields':['name',_0x6c93('0x13')]},{'unique':!![],'name':_0x6c93('0x14'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 22c84fb..8bf2a2c 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(_0x28e829,_0x23fbf8){var _0xae03ec=function(_0x22cd6f){while(--_0x22cd6f){_0x28e829['push'](_0x28e829['shift']());}};_0xae03ec(++_0x23fbf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x42feaa,_0x50e04f){var _0x22382c=function(_0x3070b6){while(--_0x3070b6){_0x42feaa['push'](_0x42feaa['shift']());}};_0x22382c(++_0x50e04f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 f93ea38..8f5a4b9 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 _0x4b97=['update','delete','destroy','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','show','post','isAuthenticated','create','put','/:id'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4b97,0x6f));var _0x74b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b97[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x74b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74b9('0x1'));var router=express['Router']();var fs_extra=require(_0x74b9('0x2'));var auth=require(_0x74b9('0x3'));var interaction=require(_0x74b9('0x4'));var config=require(_0x74b9('0x5'));var controller=require(_0x74b9('0x6'));router[_0x74b9('0x7')]('/',auth['isAuthenticated'](),controller[_0x74b9('0x8')]);router[_0x74b9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x74b9('0x9')]);router[_0x74b9('0xa')]('/',auth[_0x74b9('0xb')](),controller[_0x74b9('0xc')]);router[_0x74b9('0xd')](_0x74b9('0xe'),auth[_0x74b9('0xb')](),controller[_0x74b9('0xf')]);router[_0x74b9('0x10')]('/:id',auth[_0x74b9('0xb')](),controller[_0x74b9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5f46=['../../config/environment','./disposition.controller','get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f46,0xb4));var _0x65f4=function(_0x5573a5,_0x2c888f){_0x5573a5=_0x5573a5-0x0;var _0x1eb86f=_0x5f46[_0x5573a5];return _0x1eb86f;};'use strict';var multer=require(_0x65f4('0x0'));var util=require(_0x65f4('0x1'));var path=require(_0x65f4('0x2'));var timeout=require(_0x65f4('0x3'));var express=require(_0x65f4('0x4'));var router=express[_0x65f4('0x5')]();var fs_extra=require(_0x65f4('0x6'));var auth=require(_0x65f4('0x7'));var interaction=require(_0x65f4('0x8'));var config=require(_0x65f4('0x9'));var controller=require(_0x65f4('0xa'));router[_0x65f4('0xb')]('/',auth[_0x65f4('0xc')](),controller['index']);router[_0x65f4('0xb')]('/:id',auth[_0x65f4('0xc')](),controller[_0x65f4('0xd')]);router[_0x65f4('0xe')]('/',auth[_0x65f4('0xc')](),controller[_0x65f4('0xf')]);router[_0x65f4('0x10')](_0x65f4('0x11'),auth[_0x65f4('0xc')](),controller['update']);router[_0x65f4('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x65f4('0x13')]);module[_0x65f4('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 389a1e5..6f534c0 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 _0x938d=['7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x314eea,_0x88e82c){var _0x4e0fc7=function(_0x2976b5){while(--_0x2976b5){_0x314eea['push'](_0x314eea['shift']());}};_0x4e0fc7(++_0x88e82c);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd938('0x2')]},'ecm':{'type':Sequelize[_0xd938('0x3')](_0xd938('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xd938('0x5')},'localstationid':{'type':Sequelize[_0xd938('0x2')],'unique':_0xd938('0x6')},'minrate':{'type':Sequelize['ENUM'](_0xd938('0x7'),_0xd938('0x8'),_0xd938('0x9'),_0xd938('0xa'),_0xd938('0xb'),_0xd938('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xd938('0x3')](_0xd938('0x7'),_0xd938('0x8'),_0xd938('0x9'),_0xd938('0xa'),_0xd938('0xb'),'14400'),'defaultValue':_0xd938('0xc')},'modem':{'type':Sequelize[_0xd938('0x2')],'defaultValue':_0xd938('0xd')},'gateway':{'type':Sequelize[_0xd938('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd938('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd938('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd938('0x3')](_0xd938('0xf'),_0xd938('0x10'),_0xd938('0x11'),_0xd938('0x12')),'defaultValue':_0xd938('0xf')},'key':{'type':Sequelize[_0xd938('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd938('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd938('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd938('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd938('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd938('0xe')],'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['BOOLEAN'],'defaultValue':![],'comment':_0xd938('0x14'),'set':function(_0x1e3c7f){if(!_0x1e3c7f)this[_0xd938('0x15')]('mandatoryDispositionPauseId',null);this[_0xd938('0x15')](_0xd938('0x16'),_0x1e3c7f);}}}; \ No newline at end of file +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(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2e66e3,_0x3db0ea){_0x2e66e3=_0x2e66e3-0x0;var _0x13ce11=_0xd8fb[_0x2e66e3];return _0x13ce11;};'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 diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8903bf7..bab62c8 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 _0xf202=['localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','end','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','localstationid','app','system','appdata','push','CDR(type)=inbound-fax','ecm','faxdetect','headerinfo','minrate','modem','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','removeAgents','isArray','emit','userFaxAccount:remove','User','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf202,0x174));var _0x2f20=function(_0x52e6bd,_0x1f42d9){_0x52e6bd=_0x52e6bd-0x0;var _0x1d0e6c=_0xf202[_0x52e6bd];return _0x1d0e6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f20('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f20('0x1'));var rp=require('request-promise');var moment=require(_0x2f20('0x2'));var BPromise=require(_0x2f20('0x3'));var Mustache=require(_0x2f20('0x4'));var util=require(_0x2f20('0x5'));var path=require(_0x2f20('0x6'));var sox=require(_0x2f20('0x7'));var csv=require(_0x2f20('0x8'));var ejs=require(_0x2f20('0x9'));var fs=require('fs');var fs_extra=require(_0x2f20('0xa'));var _=require('lodash');var squel=require(_0x2f20('0xb'));var crypto=require(_0x2f20('0xc'));var jsforce=require(_0x2f20('0xd'));var deskjs=require(_0x2f20('0xe'));var toCsv=require(_0x2f20('0x8'));var querystring=require(_0x2f20('0xf'));var Papa=require('papaparse');var Redis=require(_0x2f20('0x10'));var authService=require(_0x2f20('0x11'));var qs=require(_0x2f20('0x12'));var as=require(_0x2f20('0x13'));var hardwareService=require(_0x2f20('0x14'));var logger=require(_0x2f20('0x15'))('api');var utils=require(_0x2f20('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2f20('0x17'));var db=require('../../mysqldb')['db'];config[_0x2f20('0x18')]=_[_0x2f20('0x19')](config['redis'],{'host':_0x2f20('0x1a'),'port':0x18eb});var socket=require(_0x2f20('0x1b'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x2f20('0x1c')](socket);var jayson=require(_0x2f20('0x1d'));var client=jayson[_0x2f20('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x2f20('0x1e')][_0x2f20('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4fefcb,_0x2b26ec,_0x3aeabf,_0x2ce802){return new BPromise(function(_0x34b68c,_0x54ab2b){var _0x36cd70=_0x2ce802||client;return _0x36cd70[_0x2f20('0x20')](_0x4fefcb,_0x3aeabf)[_0x2f20('0x21')](function(_0x57e549){logger[_0x2f20('0x22')](_0x2f20('0x23'),_0x2b26ec,_0x2f20('0x24'));logger[_0x2f20('0x25')](_0x2f20('0x26'),_0x2b26ec,_0x2f20('0x24'),JSON[_0x2f20('0x27')](_0x57e549));if(_0x57e549[_0x2f20('0x28')]){if(_0x57e549[_0x2f20('0x28')][_0x2f20('0x29')]===0x1f4){logger[_0x2f20('0x28')]('FaxAccount,\x20%s,\x20%s',_0x2b26ec,_0x57e549[_0x2f20('0x28')][_0x2f20('0x2a')]);return _0x54ab2b(_0x57e549[_0x2f20('0x28')]['message']);}logger['error'](_0x2f20('0x23'),_0x2b26ec,_0x57e549['error'][_0x2f20('0x2a')]);return _0x34b68c(_0x57e549[_0x2f20('0x28')][_0x2f20('0x2a')]);}else{logger['info'](_0x2f20('0x23'),_0x2b26ec,_0x2f20('0x24'));_0x34b68c(_0x57e549[_0x2f20('0x2b')][_0x2f20('0x2a')]);}})['catch'](function(_0x2c75b8){logger[_0x2f20('0x28')](_0x2f20('0x23'),_0x2b26ec,_0x2c75b8);_0x54ab2b(_0x2c75b8);});});}function respondWithStatusCode(_0x452bb5,_0x2388b0){_0x2388b0=_0x2388b0||0xcc;return function(_0x58e180){if(_0x58e180){return _0x452bb5[_0x2f20('0x2c')](_0x2388b0);}return _0x452bb5[_0x2f20('0x2d')](_0x2388b0)['end']();};}function respondWithResult(_0x1f78e3,_0x41c3a5){_0x41c3a5=_0x41c3a5||0xc8;return function(_0x35a3ca){if(_0x35a3ca){return _0x1f78e3[_0x2f20('0x2d')](_0x41c3a5)[_0x2f20('0x2e')](_0x35a3ca);}};}function respondWithFilteredResult(_0x36b3d5,_0x38b7e8){return function(_0x213210){if(_0x213210){var _0x47b410=typeof _0x38b7e8[_0x2f20('0x2f')]===_0x2f20('0x30')&&typeof _0x38b7e8[_0x2f20('0x31')]===_0x2f20('0x30');var _0x58e2a8=_0x213210[_0x2f20('0x32')];var _0x46b000=_0x47b410?0x0:_0x38b7e8[_0x2f20('0x2f')];var _0x490924=_0x47b410?_0x213210[_0x2f20('0x32')]:_0x38b7e8[_0x2f20('0x2f')]+_0x38b7e8['limit'];var _0x51108a;if(_0x490924>=_0x58e2a8){_0x490924=_0x58e2a8;_0x51108a=0xc8;}else{_0x51108a=0xce;}_0x36b3d5[_0x2f20('0x2d')](_0x51108a);return _0x36b3d5[_0x2f20('0x33')](_0x2f20('0x34'),_0x46b000+'-'+_0x490924+'/'+_0x58e2a8)[_0x2f20('0x2e')](_0x213210);}return null;};}function patchUpdates(_0x4a3467){return function(_0x1393ee){try{jsonpatch['apply'](_0x1393ee,_0x4a3467,!![]);}catch(_0x8fc251){return BPromise[_0x2f20('0x35')](_0x8fc251);}return _0x1393ee[_0x2f20('0x36')]();};}function saveUpdates(_0x28e4ca,_0x29fc69){return function(_0x5ba73e){if(_0x5ba73e){return _0x5ba73e[_0x2f20('0x37')](_0x28e4ca)['then'](function(_0x4c24cd){return _0x4c24cd;});}return null;};}function removeEntity(_0x297c29,_0x359be5){return function(_0x3a1449){if(_0x3a1449){return _0x3a1449[_0x2f20('0x38')]()[_0x2f20('0x21')](function(){var _0x1e8474=_0x3a1449[_0x2f20('0x39')]({'plain':!![]});var _0x18a9cd=_0x2f20('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x18a9cd,'resourceId':_0x1e8474['id']}})[_0x2f20('0x21')](function(){return _0x3a1449;});})[_0x2f20('0x21')](function(){_0x297c29['status'](0xcc)[_0x2f20('0x3b')]();});}};}function handleEntityNotFound(_0x994f4b,_0x1bb242){return function(_0x44670c){if(!_0x44670c){_0x994f4b[_0x2f20('0x2c')](0x194);}return _0x44670c;};}function handleError(_0x25abcd,_0x23e9be){_0x23e9be=_0x23e9be||0x1f4;return function(_0x55bf4f){logger['error'](_0x55bf4f[_0x2f20('0x3c')]);if(_0x55bf4f['name']){delete _0x55bf4f[_0x2f20('0x3d')];}_0x25abcd['status'](_0x23e9be)['send'](_0x55bf4f);};}exports[_0x2f20('0x3e')]=function(_0x14943c,_0x1d877b){var _0x218da1={'include':[{'model':db[_0x2f20('0x3f')],'as':_0x2f20('0x40')}]},_0x51d9d0={},_0x3ddfee={'count':0x0,'rows':[]};var _0x577203=_[_0x2f20('0x41')](db[_0x2f20('0x42')][_0x2f20('0x43')],function(_0x9af997){return{'name':_0x9af997[_0x2f20('0x44')],'type':_0x9af997['type'][_0x2f20('0x45')]};});_0x51d9d0['model']=_[_0x2f20('0x41')](_0x577203,_0x2f20('0x3d'));_0x51d9d0['query']=_[_0x2f20('0x46')](_0x14943c['query']);_0x51d9d0[_0x2f20('0x47')]=_[_0x2f20('0x48')](_0x51d9d0[_0x2f20('0x49')],_0x51d9d0['query']);_0x218da1[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0x51d9d0[_0x2f20('0x49')],qs[_0x2f20('0x4b')](_0x14943c[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x218da1[_0x2f20('0x4a')]=_0x218da1[_0x2f20('0x4a')][_0x2f20('0x4d')]?_0x218da1[_0x2f20('0x4a')]:_0x51d9d0[_0x2f20('0x49')];if(!_0x14943c[_0x2f20('0x4c')][_0x2f20('0x4e')](_0x2f20('0x4f'))){_0x218da1['limit']=qs['limit'](_0x14943c[_0x2f20('0x4c')][_0x2f20('0x31')]);_0x218da1[_0x2f20('0x2f')]=qs[_0x2f20('0x2f')](_0x14943c['query'][_0x2f20('0x2f')]);}_0x218da1[_0x2f20('0x50')]=qs[_0x2f20('0x51')](_0x14943c[_0x2f20('0x4c')][_0x2f20('0x51')]);_0x218da1[_0x2f20('0x52')]=qs[_0x2f20('0x47')](_[_0x2f20('0x53')](_0x14943c[_0x2f20('0x4c')],_0x51d9d0[_0x2f20('0x47')]),_0x577203);if(_0x14943c[_0x2f20('0x4c')][_0x2f20('0x54')]){_0x218da1[_0x2f20('0x52')]=_[_0x2f20('0x55')](_0x218da1['where'],{'$or':_[_0x2f20('0x41')](_0x577203,function(_0x15d80d){if(_0x15d80d[_0x2f20('0x56')]!=='VIRTUAL'){var _0x146ef5={};_0x146ef5[_0x15d80d[_0x2f20('0x3d')]]={'$like':'%'+_0x14943c[_0x2f20('0x4c')][_0x2f20('0x54')]+'%'};return _0x146ef5;}})});}_0x218da1=_['merge']({},_0x218da1,_0x14943c['options']);var _0x766ca={'where':_0x218da1['where']};return db['FaxAccount'][_0x2f20('0x32')](_0x766ca)[_0x2f20('0x21')](function(_0x586e74){_0x3ddfee[_0x2f20('0x32')]=_0x586e74;if(_0x14943c[_0x2f20('0x4c')]['includeAll']){_0x218da1[_0x2f20('0x57')]=[{'all':!![]}];}return db[_0x2f20('0x42')][_0x2f20('0x58')](_0x218da1);})[_0x2f20('0x21')](function(_0x412126){_0x3ddfee[_0x2f20('0x59')]=_0x412126;return _0x3ddfee;})['then'](respondWithFilteredResult(_0x1d877b,_0x218da1))[_0x2f20('0x5a')](handleError(_0x1d877b,null));};exports[_0x2f20('0x5b')]=function(_0x10f578,_0x434953){var _0x16e61f={'raw':![],'where':{'id':_0x10f578[_0x2f20('0x5c')]['id']},'include':[{'model':db[_0x2f20('0x3f')],'as':_0x2f20('0x40')}]},_0x21e25d={};_0x21e25d[_0x2f20('0x49')]=_['keys'](db[_0x2f20('0x42')][_0x2f20('0x43')]);_0x21e25d[_0x2f20('0x4c')]=_[_0x2f20('0x46')](_0x10f578[_0x2f20('0x4c')]);_0x21e25d['filters']=_['intersection'](_0x21e25d[_0x2f20('0x49')],_0x21e25d[_0x2f20('0x4c')]);_0x16e61f[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0x21e25d[_0x2f20('0x49')],qs[_0x2f20('0x4b')](_0x10f578[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x16e61f[_0x2f20('0x4a')]=_0x16e61f[_0x2f20('0x4a')]['length']?_0x16e61f[_0x2f20('0x4a')]:_0x21e25d[_0x2f20('0x49')];if(_0x10f578[_0x2f20('0x4c')][_0x2f20('0x5d')]){_0x16e61f['include']=[{'all':!![]}];}_0x16e61f=_[_0x2f20('0x55')]({},_0x16e61f,_0x10f578[_0x2f20('0x5e')]);return db[_0x2f20('0x42')][_0x2f20('0x5f')](_0x16e61f)['then'](handleEntityNotFound(_0x434953,null))[_0x2f20('0x21')](respondWithResult(_0x434953,null))[_0x2f20('0x5a')](handleError(_0x434953,null));};exports['create']=function(_0x180893,_0x3a1c28){return db[_0x2f20('0x42')][_0x2f20('0x60')](_0x180893[_0x2f20('0x61')],{})[_0x2f20('0x21')](function(_0x3cc22b){var _0x464153=_0x180893[_0x2f20('0x62')]['get']({'plain':!![]});if(!_0x464153)throw new Error(_0x2f20('0x63'));if(_0x464153['role']===_0x2f20('0x62')){var _0x137863=_0x3cc22b[_0x2f20('0x39')]({'plain':!![]});var _0x464b45=_0x2f20('0x3a');return db['UserProfileSection'][_0x2f20('0x5f')]({'where':{'name':_0x464b45,'userProfileId':_0x464153[_0x2f20('0x64')]},'raw':!![]})[_0x2f20('0x21')](function(_0x474dbb){if(_0x474dbb&&_0x474dbb[_0x2f20('0x65')]===0x0){return db[_0x2f20('0x66')][_0x2f20('0x60')]({'name':_0x137863[_0x2f20('0x3d')],'resourceId':_0x137863['id'],'type':_0x474dbb['name'],'sectionId':_0x474dbb['id']},{})[_0x2f20('0x21')](function(){return _0x3cc22b;});}else{return _0x3cc22b;}})[_0x2f20('0x5a')](function(_0x4e8876){logger[_0x2f20('0x28')](_0x2f20('0x67'),_0x4e8876);throw _0x4e8876;});}return _0x3cc22b;})[_0x2f20('0x21')](respondWithResult(_0x3a1c28,0xc9))[_0x2f20('0x5a')](handleError(_0x3a1c28,null));};exports[_0x2f20('0x37')]=function(_0xd8a420,_0x3a5bf1){if(_0xd8a420[_0x2f20('0x61')]['id']){delete _0xd8a420[_0x2f20('0x61')]['id'];}return db['FaxAccount'][_0x2f20('0x5f')]({'where':{'id':_0xd8a420[_0x2f20('0x5c')]['id']},'include':[{'model':db[_0x2f20('0x3f')],'as':_0x2f20('0x40')}]})[_0x2f20('0x21')](handleEntityNotFound(_0x3a5bf1,null))[_0x2f20('0x21')](saveUpdates(_0xd8a420[_0x2f20('0x61')],null))[_0x2f20('0x21')](respondWithResult(_0x3a5bf1,null))[_0x2f20('0x5a')](handleError(_0x3a5bf1,null));};exports[_0x2f20('0x38')]=function(_0x29f256,_0x464fb5){return db[_0x2f20('0x42')]['find']({'where':{'id':_0x29f256[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x464fb5,null))[_0x2f20('0x21')](removeEntity(_0x464fb5,null))['catch'](handleError(_0x464fb5,null));};exports[_0x2f20('0x68')]=function(_0x3be826,_0x3db3f7){return db['FaxAccount'][_0x2f20('0x68')]()[_0x2f20('0x21')](respondWithResult(_0x3db3f7,null))[_0x2f20('0x5a')](handleError(_0x3db3f7,null));};exports[_0x2f20('0x69')]=function(_0x211c63,_0xdc6a1a,_0x54fa99){if(_0x211c63[_0x2f20('0x61')]['id']){delete _0x211c63['body']['id'];}return db[_0x2f20('0x42')][_0x2f20('0x5f')]({'where':{'id':_0x211c63['params']['id']}})['then'](handleEntityNotFound(_0xdc6a1a,null))[_0x2f20('0x21')](function(_0x32172b){if(_0x32172b){_0x211c63['body'][_0x2f20('0x6a')]=_0x32172b['id'];return db[_0x2f20('0x6b')]['create'](_0x211c63[_0x2f20('0x61')]);}})[_0x2f20('0x21')](respondWithResult(_0xdc6a1a,null))[_0x2f20('0x5a')](handleError(_0xdc6a1a,null));};exports[_0x2f20('0x6c')]=function(_0x26a115,_0x313ade,_0x33b16d){var _0x1e5f8={'raw':![],'where':{}};var _0x3a61c0={};var _0x49d29a={'count':0x0,'rows':[]};return db[_0x2f20('0x42')][_0x2f20('0x6d')]({'where':{'id':_0x26a115[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x313ade,null))[_0x2f20('0x21')](function(_0x350e5c){if(_0x350e5c){_0x3a61c0[_0x2f20('0x49')]=_[_0x2f20('0x46')](db[_0x2f20('0x6b')]['rawAttributes']);_0x3a61c0['query']=_[_0x2f20('0x46')](_0x26a115['query']);_0x3a61c0[_0x2f20('0x47')]=_[_0x2f20('0x48')](_0x3a61c0[_0x2f20('0x49')],_0x3a61c0[_0x2f20('0x4c')]);_0x1e5f8[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0x3a61c0[_0x2f20('0x49')],qs['fields'](_0x26a115[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x1e5f8['attributes']=_0x1e5f8[_0x2f20('0x4a')][_0x2f20('0x4d')]?_0x1e5f8['attributes']:_0x3a61c0[_0x2f20('0x49')];if(!_0x26a115[_0x2f20('0x4c')][_0x2f20('0x4e')](_0x2f20('0x4f'))){_0x1e5f8['limit']=qs[_0x2f20('0x31')](_0x26a115['query'][_0x2f20('0x31')]);_0x1e5f8['offset']=qs[_0x2f20('0x2f')](_0x26a115[_0x2f20('0x4c')]['offset']);}_0x1e5f8[_0x2f20('0x50')]=qs['sort'](_0x26a115[_0x2f20('0x4c')][_0x2f20('0x51')]);_0x1e5f8[_0x2f20('0x52')]=qs[_0x2f20('0x47')](_['pick'](_0x26a115['query'],_0x3a61c0[_0x2f20('0x47')]));_0x1e5f8[_0x2f20('0x52')]['FaxAccountId']=_0x350e5c['id'];if(_0x26a115['query'][_0x2f20('0x54')]){_0x1e5f8['where']=_[_0x2f20('0x55')](_0x1e5f8[_0x2f20('0x52')],{'$or':_[_0x2f20('0x41')](_0x1e5f8[_0x2f20('0x4a')],function(_0x3b1054){var _0x1dfd57={};_0x1dfd57[_0x3b1054]={'$like':'%'+_0x26a115[_0x2f20('0x4c')][_0x2f20('0x54')]+'%'};return _0x1dfd57;})});}_0x1e5f8=_[_0x2f20('0x55')]({},_0x1e5f8,_0x26a115[_0x2f20('0x5e')]);return db['Disposition']['count']({'where':_0x1e5f8[_0x2f20('0x52')]})[_0x2f20('0x21')](function(_0x52b05e){_0x49d29a[_0x2f20('0x32')]=_0x52b05e;if(_0x26a115[_0x2f20('0x4c')][_0x2f20('0x5d')]){_0x1e5f8['include']=[{'all':!![]}];}return db[_0x2f20('0x6b')][_0x2f20('0x58')](_0x1e5f8);})[_0x2f20('0x21')](function(_0x13a583){_0x49d29a['rows']=_0x13a583;return _0x49d29a;});}})[_0x2f20('0x21')](respondWithFilteredResult(_0x313ade,_0x1e5f8))[_0x2f20('0x5a')](handleError(_0x313ade,null));};exports[_0x2f20('0x6e')]=function(_0x4a337a,_0x4c10bb,_0x54a33c){return db[_0x2f20('0x42')][_0x2f20('0x5f')]({'where':{'id':_0x4a337a[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x4c10bb,null))[_0x2f20('0x21')](function(_0x5f1cb8){if(_0x5f1cb8){return _0x5f1cb8[_0x2f20('0x6e')](_0x4a337a[_0x2f20('0x4c')][_0x2f20('0x6f')]);}})[_0x2f20('0x21')](respondWithStatusCode(_0x4c10bb,null))['catch'](handleError(_0x4c10bb,null));};exports[_0x2f20('0x70')]=function(_0x80203a,_0x290d91,_0xeca8dc){if(_0x80203a[_0x2f20('0x61')]['id']){delete _0x80203a[_0x2f20('0x61')]['id'];}return db[_0x2f20('0x42')][_0x2f20('0x5f')]({'where':{'id':_0x80203a[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x290d91,null))[_0x2f20('0x21')](function(_0x49a924){if(_0x49a924){_0x80203a['body'][_0x2f20('0x6a')]=_0x49a924['id'];return db[_0x2f20('0x71')][_0x2f20('0x60')](_0x80203a[_0x2f20('0x61')]);}})[_0x2f20('0x21')](respondWithResult(_0x290d91,null))['catch'](handleError(_0x290d91,null));};exports[_0x2f20('0x72')]=function(_0x335414,_0x5311ae,_0x3db022){var _0x49fee1={'raw':![],'where':{}};var _0xe1789f={};var _0x13a2e9={'count':0x0,'rows':[]};return db[_0x2f20('0x42')][_0x2f20('0x6d')]({'where':{'id':_0x335414[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x5311ae,null))[_0x2f20('0x21')](function(_0x11efce){if(_0x11efce){_0xe1789f[_0x2f20('0x49')]=_['keys'](db[_0x2f20('0x71')][_0x2f20('0x43')]);_0xe1789f['query']=_[_0x2f20('0x46')](_0x335414['query']);_0xe1789f[_0x2f20('0x47')]=_[_0x2f20('0x48')](_0xe1789f['model'],_0xe1789f[_0x2f20('0x4c')]);_0x49fee1[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0xe1789f[_0x2f20('0x49')],qs['fields'](_0x335414['query'][_0x2f20('0x4b')]));_0x49fee1[_0x2f20('0x4a')]=_0x49fee1[_0x2f20('0x4a')][_0x2f20('0x4d')]?_0x49fee1['attributes']:_0xe1789f[_0x2f20('0x49')];if(!_0x335414[_0x2f20('0x4c')][_0x2f20('0x4e')](_0x2f20('0x4f'))){_0x49fee1[_0x2f20('0x31')]=qs[_0x2f20('0x31')](_0x335414[_0x2f20('0x4c')][_0x2f20('0x31')]);_0x49fee1[_0x2f20('0x2f')]=qs[_0x2f20('0x2f')](_0x335414[_0x2f20('0x4c')][_0x2f20('0x2f')]);}_0x49fee1[_0x2f20('0x50')]=qs[_0x2f20('0x51')](_0x335414['query'][_0x2f20('0x51')]);_0x49fee1[_0x2f20('0x52')]=qs[_0x2f20('0x47')](_[_0x2f20('0x53')](_0x335414['query'],_0xe1789f['filters']));_0x49fee1[_0x2f20('0x52')][_0x2f20('0x6a')]=_0x11efce['id'];if(_0x335414[_0x2f20('0x4c')][_0x2f20('0x54')]){_0x49fee1[_0x2f20('0x52')]=_[_0x2f20('0x55')](_0x49fee1['where'],{'$or':_[_0x2f20('0x41')](_0x49fee1[_0x2f20('0x4a')],function(_0x2994a6){var _0x33c451={};_0x33c451[_0x2994a6]={'$like':'%'+_0x335414['query'][_0x2f20('0x54')]+'%'};return _0x33c451;})});}_0x49fee1=_[_0x2f20('0x55')]({},_0x49fee1,_0x335414[_0x2f20('0x5e')]);return db[_0x2f20('0x71')][_0x2f20('0x32')]({'where':_0x49fee1[_0x2f20('0x52')]})['then'](function(_0x3216cc){_0x13a2e9[_0x2f20('0x32')]=_0x3216cc;if(_0x335414[_0x2f20('0x4c')][_0x2f20('0x5d')]){_0x49fee1[_0x2f20('0x57')]=[{'all':!![]}];}return db[_0x2f20('0x71')][_0x2f20('0x58')](_0x49fee1);})[_0x2f20('0x21')](function(_0x26b60f){_0x13a2e9[_0x2f20('0x59')]=_0x26b60f;return _0x13a2e9;});}})[_0x2f20('0x21')](respondWithFilteredResult(_0x5311ae,_0x49fee1))[_0x2f20('0x5a')](handleError(_0x5311ae,null));};exports['removeAnswers']=function(_0x5561fb,_0x2d1f45,_0x10c31d){return db[_0x2f20('0x42')]['find']({'where':{'id':_0x5561fb[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x2d1f45,null))[_0x2f20('0x21')](function(_0x4dd045){if(_0x4dd045){return _0x4dd045[_0x2f20('0x73')](_0x5561fb[_0x2f20('0x4c')]['ids']);}})[_0x2f20('0x21')](respondWithStatusCode(_0x2d1f45,null))[_0x2f20('0x5a')](handleError(_0x2d1f45,null));};exports[_0x2f20('0x74')]=function(_0x183053,_0x39dbb2,_0x14e0ec){return db[_0x2f20('0x75')][_0x2f20('0x5f')]({'where':{'id':_0x183053[_0x2f20('0x5c')]['id']}})['then'](handleEntityNotFound(_0x39dbb2,null))['then'](function(_0x43c4bb){if(_0x43c4bb){return _0x43c4bb[_0x2f20('0x74')](_0x183053[_0x2f20('0x61')][_0x2f20('0x6f')],_[_0x2f20('0x76')](_0x183053[_0x2f20('0x61')],[_0x2f20('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x39dbb2,null))[_0x2f20('0x5a')](handleError(_0x39dbb2,null));};exports['getInteractions']=function(_0x5b2514,_0xe55ed4,_0x46273c){var _0x56f60a={'raw':![],'where':{}};var _0x25a1f7={};var _0x44ed4a={'count':0x0,'rows':[]};return db[_0x2f20('0x42')]['findOne']({'where':{'id':_0x5b2514[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0xe55ed4,null))[_0x2f20('0x21')](function(_0x17a296){if(_0x17a296){_0x25a1f7[_0x2f20('0x49')]=_[_0x2f20('0x46')](db[_0x2f20('0x75')][_0x2f20('0x43')]);_0x25a1f7['query']=_[_0x2f20('0x46')](_0x5b2514['query']);_0x25a1f7[_0x2f20('0x47')]=_['intersection'](_0x25a1f7['model'],_0x25a1f7['query']);_0x56f60a['attributes']=_[_0x2f20('0x48')](_0x25a1f7[_0x2f20('0x49')],qs['fields'](_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x56f60a[_0x2f20('0x4a')]=_0x56f60a[_0x2f20('0x4a')][_0x2f20('0x4d')]?_0x56f60a['attributes']:_0x25a1f7[_0x2f20('0x49')];if(!_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x4e')](_0x2f20('0x4f'))){_0x56f60a[_0x2f20('0x31')]=qs[_0x2f20('0x31')](_0x5b2514['query'][_0x2f20('0x31')]);_0x56f60a[_0x2f20('0x2f')]=qs['offset'](_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x2f')]);}_0x56f60a[_0x2f20('0x50')]=qs[_0x2f20('0x51')](_0x5b2514['query'][_0x2f20('0x51')]);_0x56f60a[_0x2f20('0x52')]=qs[_0x2f20('0x47')](_[_0x2f20('0x53')](_0x5b2514[_0x2f20('0x4c')],_0x25a1f7[_0x2f20('0x47')]));_0x56f60a[_0x2f20('0x52')]['FaxAccountId']=_0x17a296['id'];if(_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x54')]){_0x56f60a['where']=_['merge'](_0x56f60a['where'],{'$or':_[_0x2f20('0x41')](_0x56f60a[_0x2f20('0x4a')],function(_0x8e9724){var _0x1db7bb={};_0x1db7bb[_0x8e9724]={'$like':'%'+_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x54')]+'%'};return _0x1db7bb;})});}_0x56f60a=_[_0x2f20('0x55')]({},_0x56f60a,_0x5b2514['options']);return db[_0x2f20('0x75')][_0x2f20('0x32')]({'where':_0x56f60a[_0x2f20('0x52')]})['then'](function(_0x6798a9){_0x44ed4a[_0x2f20('0x32')]=_0x6798a9;if(_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x5d')]){_0x56f60a[_0x2f20('0x57')]=[{'model':db[_0x2f20('0x77')],'as':_0x2f20('0x78'),'required':![]},{'model':db['User'],'as':_0x2f20('0x79'),'attributes':[_0x2f20('0x3d'),_0x2f20('0x7a'),'internal'],'required':![]},{'model':db[_0x2f20('0x7b')],'as':_0x2f20('0x7c'),'attributes':['id',_0x2f20('0x3d'),_0x2f20('0x7d')],'where':_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x7e')]?{'id':_0x5b2514['query'][_0x2f20('0x7e')]}:undefined,'required':_0x5b2514[_0x2f20('0x4c')][_0x2f20('0x7e')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x56f60a);})[_0x2f20('0x21')](function(_0x3ad80d){_0x44ed4a[_0x2f20('0x59')]=_0x3ad80d;return _0x44ed4a;});}})[_0x2f20('0x21')](respondWithFilteredResult(_0xe55ed4,_0x56f60a))[_0x2f20('0x5a')](handleError(_0xe55ed4,null));};exports[_0x2f20('0x7f')]=function(_0x18c195,_0x2e0d15){var _0x292211=_0x18c195[_0x2f20('0x5c')]['id'];var _0x54d5b0=_0x18c195[_0x2f20('0x61')];var _0x159409=0xc8;var _0x1acb7d=null;return db[_0x2f20('0x80')][_0x2f20('0x81')]({'isolationLevel':db[_0x2f20('0x80')][_0x2f20('0x82')][_0x2f20('0x83')][_0x2f20('0x84')]},function(_0x37fe5d){return db['FaxAccount'][_0x2f20('0x6d')]({'where':{'id':_0x292211},'transaction':_0x37fe5d})['then'](function(_0x355e69){if(_0x355e69){return db[_0x2f20('0x85')][_0x2f20('0x38')]({'where':{'FaxAccountId':_0x292211},'transaction':_0x37fe5d})[_0x2f20('0x21')](function(){var _0x4294e8=_[_0x2f20('0x41')](_0x54d5b0,function(_0xb9a4b1){_0xb9a4b1[_0x2f20('0x6a')]=_0x292211;return _0xb9a4b1;});return db[_0x2f20('0x85')][_0x2f20('0x86')](_0x4294e8,{'transaction':_0x37fe5d});});}else{_0x159409=0x194;_0x1acb7d=[];}});})[_0x2f20('0x21')](function(){if(_0x159409!==0x194){return db['FaxApplication'][_0x2f20('0x87')]({'where':{'FaxAccountId':_0x292211},'order':_0x2f20('0x88')})['then'](function(_0x198270){_0x1acb7d=_0x198270;});}})[_0x2f20('0x5a')](function(_0x45ef10){_0x159409=0x1f4;logger[_0x2f20('0x28')](_0x45ef10[_0x2f20('0x3c')]);if(_0x45ef10[_0x2f20('0x3d')]){delete _0x45ef10[_0x2f20('0x3d')];}_0x1acb7d=_0x45ef10;})[_0x2f20('0x89')](function(){if(_0x1acb7d===null){_0x2e0d15['sendStatus'](_0x159409);}else{if(_0x159409===0x1f4){_0x2e0d15[_0x2f20('0x2d')](_0x159409)[_0x2f20('0x8a')](_0x1acb7d);}else{_0x2e0d15[_0x2f20('0x2d')](_0x159409)[_0x2f20('0x2e')](_0x1acb7d);}}});};exports[_0x2f20('0x8b')]=function(_0x59d9eb,_0x407251,_0x19f11c){var _0x3c03e7={};var _0xb874da={};var _0x35a182;var _0x46ecb4;return db[_0x2f20('0x42')][_0x2f20('0x6d')]({'where':{'id':_0x59d9eb[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x407251,null))[_0x2f20('0x21')](function(_0x5c62e1){if(_0x5c62e1){_0x35a182=_0x5c62e1;_0xb874da[_0x2f20('0x49')]=_[_0x2f20('0x46')](db['FaxApplication'][_0x2f20('0x43')]);_0xb874da[_0x2f20('0x4c')]=_[_0x2f20('0x46')](_0x59d9eb['query']);_0xb874da['filters']=_[_0x2f20('0x48')](_0xb874da['model'],_0xb874da['query']);_0x3c03e7[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0xb874da[_0x2f20('0x49')],qs[_0x2f20('0x4b')](_0x59d9eb[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x3c03e7['attributes']=_0x3c03e7[_0x2f20('0x4a')][_0x2f20('0x4d')]?_0x3c03e7[_0x2f20('0x4a')]:_0xb874da[_0x2f20('0x49')];_0x3c03e7['order']=qs['sort'](_0x59d9eb['query'][_0x2f20('0x51')]);_0x3c03e7[_0x2f20('0x52')]=qs[_0x2f20('0x47')](_[_0x2f20('0x53')](_0x59d9eb['query'],_0xb874da[_0x2f20('0x47')]));if(_0x59d9eb[_0x2f20('0x4c')][_0x2f20('0x54')]){_0x3c03e7[_0x2f20('0x52')]=_[_0x2f20('0x55')](_0x3c03e7[_0x2f20('0x52')],{'$or':_[_0x2f20('0x41')](_0x3c03e7[_0x2f20('0x4a')],function(_0x9679a6){var _0x1a240c={};_0x1a240c[_0x9679a6]={'$like':'%'+_0x59d9eb[_0x2f20('0x4c')][_0x2f20('0x54')]+'%'};return _0x1a240c;})});}_0x3c03e7=_['merge']({},_0x3c03e7,_0x59d9eb['options']);return _0x35a182[_0x2f20('0x8b')](_0x3c03e7);}})[_0x2f20('0x21')](function(_0x36927c){if(_0x36927c){_0x46ecb4=_0x36927c[_0x2f20('0x4d')];if(!_0x59d9eb[_0x2f20('0x4c')]['hasOwnProperty'](_0x2f20('0x4f'))){_0x3c03e7[_0x2f20('0x31')]=qs[_0x2f20('0x31')](_0x59d9eb[_0x2f20('0x4c')][_0x2f20('0x31')]);_0x3c03e7[_0x2f20('0x2f')]=qs['offset'](_0x59d9eb[_0x2f20('0x4c')][_0x2f20('0x2f')]);}return _0x35a182['getApplications'](_0x3c03e7);}})['then'](function(_0x435a08){if(_0x435a08){return _0x435a08?{'count':_0x46ecb4,'rows':_0x435a08}:null;}})[_0x2f20('0x21')](respondWithResult(_0x407251,null))[_0x2f20('0x5a')](handleError(_0x407251,null));};function Extension(_0x449faa,_0x50b2f0,_0x3df303,_0x3f82ae){this[_0x2f20('0x8c')]=_0x2f20('0x8d');this['exten']=_0x449faa[_0x2f20('0x8e')];this[_0x2f20('0x8f')]=_0x3f82ae;this[_0x2f20('0x56')]=_0x2f20('0x90');this['description']='Fax\x20Extension';this[_0x2f20('0x6a')]=_0x449faa['id'];this['priority']=_0x50b2f0;this[_0x2f20('0x91')]=_0x3df303;}function createExtensionsReciveFax(_0x2660f0){var _0x3f7b41=0x1;var _0x4ce26d=[];_0x4ce26d[_0x2f20('0x92')](new Extension(_0x2660f0,_0x3f7b41,'','Answer'));_0x3f7b41+=0x1;_0x4ce26d[_0x2f20('0x92')](new Extension(_0x2660f0,_0x3f7b41,_0x2f20('0x93'),'Set'));_0x3f7b41+=0x1;for(var _0x52ce30 in _0x2660f0){if(_0x2660f0['hasOwnProperty'](_0x52ce30)&&(_0x52ce30===_0x2f20('0x94')||_0x52ce30===_0x2f20('0x8e')||_0x52ce30==='gateway'||_0x52ce30===_0x2f20('0x95')||_0x52ce30===_0x2f20('0x96')||_0x52ce30==='maxrate'||_0x52ce30===_0x2f20('0x97')||_0x52ce30===_0x2f20('0x98')||_0x52ce30==='t38timeout')){_0x4ce26d[_0x2f20('0x92')](new Extension(_0x2660f0,_0x3f7b41,_0x2f20('0x99')+_0x52ce30+')='+_0x2660f0[_0x52ce30],_0x2f20('0x9a')));_0x3f7b41+=0x1;}}_0x4ce26d[_0x2f20('0x92')](new Extension(_0x2660f0,_0x3f7b41,'6',_0x2f20('0x9b')));_0x3f7b41+=0x1;_0x4ce26d[_0x2f20('0x92')](new Extension(_0x2660f0,_0x3f7b41,_0x2f20('0x9c'),_0x2f20('0x9d')));_0x3f7b41=0x0;return _0x4ce26d;}exports[_0x2f20('0x9e')]=function(_0x3ae6ef,_0x585716,_0x3dcd1b){var _0x1380ce;return db['sequelize'][_0x2f20('0x81')](function(_0x79fa56){return db[_0x2f20('0x42')][_0x2f20('0x60')](_0x3ae6ef[_0x2f20('0x61')],{'transaction':_0x79fa56})[_0x2f20('0x21')](function(_0x24ab16){_0x1380ce=_0x24ab16[_0x2f20('0x39')]({'plain':!![]});return db['VoiceExtension'][_0x2f20('0x86')](createExtensionsReciveFax(_0x1380ce),{'transaction':_0x79fa56});});})[_0x2f20('0x21')](function(){return _0x1380ce;})[_0x2f20('0x21')](respondWithResult(_0x585716,null))[_0x2f20('0x5a')](handleError(_0x585716,null));};exports[_0x2f20('0x9f')]=function(_0x1532a6,_0x4382fe,_0x5b9bb4){var _0x46916c;return db[_0x2f20('0x80')][_0x2f20('0x81')](function(_0x3fc12e){return db[_0x2f20('0x42')][_0x2f20('0x37')](_0x1532a6[_0x2f20('0x61')],{'where':{'id':_0x1532a6[_0x2f20('0x61')]['id']},'transaction':_0x3fc12e})[_0x2f20('0x21')](function(_0x1b9a62){return db[_0x2f20('0xa0')][_0x2f20('0x38')]({'where':{'FaxAccountId':_0x1532a6[_0x2f20('0x61')]['id']},'transaction':_0x3fc12e})[_0x2f20('0x21')](function(_0x4dd464){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x2f20('0x76')](_0x1532a6[_0x2f20('0x61')],[_0x2f20('0xa1'),_0x2f20('0x45'),'createdAt',_0x2f20('0xa2'),_0x2f20('0xa3'),_0x2f20('0xa4')])),{'transaction':_0x3fc12e});});});})[_0x2f20('0x21')](function(){return db[_0x2f20('0x42')][_0x2f20('0xa5')](_0x1532a6[_0x2f20('0x61')]['id']);})['then'](respondWithResult(_0x4382fe,null))['catch'](handleError(_0x4382fe,null));};exports['getMessages']=function(_0x31960f,_0x43bd20,_0x21da0b){var _0x2ad086={'raw':!![],'where':{}};var _0x23b49e={};var _0x7e5355={'count':0x0,'rows':[]};return db[_0x2f20('0x42')][_0x2f20('0x6d')]({'where':{'id':_0x31960f[_0x2f20('0x5c')]['id']}})['then'](handleEntityNotFound(_0x43bd20,null))[_0x2f20('0x21')](function(_0x2cbbf4){if(_0x2cbbf4){_0x23b49e['model']=_[_0x2f20('0x46')](db[_0x2f20('0xa6')][_0x2f20('0x43')]);_0x23b49e[_0x2f20('0x4c')]=_[_0x2f20('0x46')](_0x31960f['query']);_0x23b49e[_0x2f20('0x47')]=_[_0x2f20('0x48')](_0x23b49e[_0x2f20('0x49')],_0x23b49e['query']);_0x2ad086[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0x23b49e[_0x2f20('0x49')],qs[_0x2f20('0x4b')](_0x31960f[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x2ad086[_0x2f20('0x4a')]=_0x2ad086[_0x2f20('0x4a')][_0x2f20('0x4d')]?_0x2ad086[_0x2f20('0x4a')]:_0x23b49e[_0x2f20('0x49')];if(!_0x31960f[_0x2f20('0x4c')][_0x2f20('0x4e')](_0x2f20('0x4f'))){_0x2ad086['limit']=qs[_0x2f20('0x31')](_0x31960f[_0x2f20('0x4c')]['limit']);_0x2ad086[_0x2f20('0x2f')]=qs[_0x2f20('0x2f')](_0x31960f[_0x2f20('0x4c')][_0x2f20('0x2f')]);}_0x2ad086[_0x2f20('0x50')]=qs[_0x2f20('0x51')](_0x31960f[_0x2f20('0x4c')][_0x2f20('0x51')]);_0x2ad086[_0x2f20('0x52')]=qs[_0x2f20('0x47')](_[_0x2f20('0x53')](_0x31960f['query'],_0x23b49e[_0x2f20('0x47')]));_0x2ad086[_0x2f20('0x52')]['FaxAccountId']=_0x2cbbf4['id'];if(_0x31960f[_0x2f20('0x4c')][_0x2f20('0x54')]){_0x2ad086['where']=_[_0x2f20('0x55')](_0x2ad086[_0x2f20('0x52')],{'$or':_['map'](_0x2ad086[_0x2f20('0x4a')],function(_0x5a5a4a){var _0x2b3c89={};_0x2b3c89[_0x5a5a4a]={'$like':'%'+_0x31960f[_0x2f20('0x4c')][_0x2f20('0x54')]+'%'};return _0x2b3c89;})});}if(_0x31960f[_0x2f20('0x4c')][_0x2f20('0xa7')]){var _0x48aeef=_0x31960f['query'][_0x2f20('0xa7')][_0x2f20('0xa8')](',');var _0x378ed9={};_0x378ed9[_0x48aeef[0x0]]={'$gte':moment(_0x48aeef[0x1])[_0x2f20('0xa9')](_0x2f20('0xaa'))};_0x2ad086[_0x2f20('0x52')]=_['merge'](_0x2ad086[_0x2f20('0x52')],_0x378ed9);}_0x2ad086=_[_0x2f20('0x55')]({},_0x2ad086,_0x31960f['options']);return db[_0x2f20('0xa6')][_0x2f20('0x32')]({'where':_0x2ad086[_0x2f20('0x52')]})[_0x2f20('0x21')](function(_0x8965cf){_0x7e5355['count']=_0x8965cf;if(_0x31960f[_0x2f20('0x4c')]['includeAll']){_0x2ad086[_0x2f20('0x57')]=[{'all':!![]}];}return db[_0x2f20('0xa6')][_0x2f20('0x58')](_0x2ad086);})[_0x2f20('0x21')](function(_0x534c6f){_0x7e5355[_0x2f20('0x59')]=_0x534c6f;return _0x7e5355;});}})[_0x2f20('0x21')](respondWithFilteredResult(_0x43bd20,_0x2ad086))[_0x2f20('0x5a')](handleError(_0x43bd20,null));};exports[_0x2f20('0x8a')]=function(_0x4ebdfe,_0x180edb,_0xba4fed){var _0x5693e7,_0x569687={},_0x990e6f;if(_0x4ebdfe[_0x2f20('0x61')]['to']){_0x990e6f=_0x4ebdfe[_0x2f20('0x61')]['to'][0x0];}return db[_0x2f20('0x42')][_0x2f20('0x5f')]({'where':{'id':_0x4ebdfe['params']['id']},'include':[{'model':db[_0x2f20('0xab')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2f20('0xac'),'where':{'fax':_0x990e6f},'limit':0x1,'order':[[_0x2f20('0xa2'),_0x2f20('0xad')]]}]}]})[_0x2f20('0x21')](handleEntityNotFound(_0x180edb,null))['then'](function(_0x77b769){_0x5693e7=_0x77b769;if(_0x4ebdfe[_0x2f20('0x61')]['attachments']&&_0x4ebdfe['body'][_0x2f20('0xae')]['length']){for(var _0x278a0c=0x0;_0x278a0c<_0x4ebdfe[_0x2f20('0x61')]['attachments'][_0x2f20('0x4d')];_0x278a0c+=0x1){_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][_0x278a0c]={'filename':_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][_0x278a0c][_0x2f20('0x3d')],'id':_0x4ebdfe['body'][_0x2f20('0xae')][_0x278a0c]['id'],'path':path[_0x2f20('0xaf')](config[_0x2f20('0xb0')],_0x2f20('0xb1'),_0x4ebdfe[_0x2f20('0x61')]['attachments'][_0x278a0c][_0x2f20('0xb2')])};}}return respondWithRpcPromise(_0x2f20('0xb3'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x4ebdfe[_0x2f20('0x5c')]['id'])?undefined:_0x4ebdfe[_0x2f20('0x5c')]['id'],'path':_[_0x2f20('0xb4')](_0x4ebdfe['body'][_0x2f20('0xae')][0x0][_0x2f20('0x6')])?undefined:_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0][_0x2f20('0x6')],'fax':_[_0x2f20('0xb4')](_0x4ebdfe['body']['to'][0x0])?undefined:_0x4ebdfe[_0x2f20('0x61')]['to'][0x0]},client9002);})[_0x2f20('0x21')](function(){if(_0x5693e7){if(_['isNil'](_0x4ebdfe['body'][_0x2f20('0xb5')])){_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xb5')]=util[_0x2f20('0xa9')]('\x22%s\x22\x20<%s>',_0x5693e7[_0x2f20('0x3d')],_0x5693e7[_0x2f20('0xb6')]);}if(_0x5693e7[_0x2f20('0xb7')]){if(_0x5693e7[_0x2f20('0xb7')][_0x2f20('0xac')]['length']){return _0x5693e7[_0x2f20('0xb7')][_0x2f20('0xac')][0x0];}else{return db[_0x2f20('0x77')][_0x2f20('0x60')](_['defaults'](_0x4ebdfe[_0x2f20('0x61')],{'firstName':_0x4ebdfe[_0x2f20('0x61')]['to'][0x0],'phone':_0x4ebdfe[_0x2f20('0x61')]['to'][0x0],'fax':_0x4ebdfe[_0x2f20('0x61')]['to'][0x0],'ListId':_0x5693e7['ListId']}));}}else{throw new Error(_0x2f20('0xb8'));}}else{throw new Error(_0x2f20('0xb9'));}})[_0x2f20('0x21')](function(_0x297869){if(_0x297869){return db[_0x2f20('0x75')][_0x2f20('0x5f')]({'where':{'ContactId':_0x297869['id'],'closed':![],'FaxAccountId':_0x5693e7['id']}})[_0x2f20('0x21')](function(_0x54f4b3){if(_0x54f4b3){return[_0x54f4b3,![]];}return db[_0x2f20('0x75')]['create']({'UserId':_0x4ebdfe[_0x2f20('0x62')]['id'],'ContactId':_0x297869['id'],'FaxAccountId':_0x5693e7['id'],'fax':_0x4ebdfe[_0x2f20('0x61')]['to'][0x0],'firstMsgDirection':_0x2f20('0xba'),'Messages':[_[_0x2f20('0x55')](_0x4ebdfe[_0x2f20('0x61')],{'read':![],'body':_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0][_0x2f20('0xbb')],'FaxAccountId':_0x5693e7['id'],'UserId':_0x4ebdfe['user']['id'],'ContactId':_0x297869['id'],'AttachmentId':_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x2f20('0xa6')],'as':'Messages'}]})[_0x2f20('0x21')](function(_0x1bb7c4){return[_0x1bb7c4,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5e5b31,_0x1a8f0a){if(_0x1a8f0a){return _0x5e5b31;}return db[_0x2f20('0xa6')][_0x2f20('0x60')]({'direction':'out','read':![],'body':_0x4ebdfe[_0x2f20('0x61')]['attachments'][0x0][_0x2f20('0xbb')],'FaxAccountId':_0x5693e7['id'],'FaxInteractionId':_0x5e5b31['id'],'UserId':_0x4ebdfe['user']['id'],'ContactId':_0x5e5b31[_0x2f20('0xbc')],'AttachmentId':_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0]['id']})[_0x2f20('0x21')](function(_0x4f21a5){_0x5e5b31[_0x2f20('0xbd')]['Messages']=[];_0x5e5b31[_0x2f20('0xbd')]['Messages'][_0x2f20('0x92')](_0x4f21a5['dataValues']);return _0x5e5b31;});})['then'](function(_0x1d1ec1){respondWithRpcPromise(_0x2f20('0xbe'),'SendFax',{'FaxAccountId':_['isNil'](_0x4ebdfe[_0x2f20('0x5c')]['id'])?undefined:_0x4ebdfe['params']['id'],'path':_[_0x2f20('0xb4')](_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0][_0x2f20('0x6')])?undefined:_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0]['path'],'fax':_['isNil'](_0x4ebdfe[_0x2f20('0x61')]['to'][0x0])?undefined:_0x4ebdfe[_0x2f20('0x61')]['to'][0x0],'AttachmentId':_0x4ebdfe[_0x2f20('0x61')][_0x2f20('0xae')][0x0]['id']},client9002)[_0x2f20('0x21')](function(_0x225b5e){logger[_0x2f20('0x22')](_0x2f20('0xbf'),_0x225b5e);})['catch'](function(_0x3ee73d){logger['info'](_0x2f20('0xbf'),_0x3ee73d);});return _0x1d1ec1;})[_0x2f20('0x21')](respondWithResult(_0x180edb,null))[_0x2f20('0x5a')](handleError(_0x180edb,null));};exports[_0x2f20('0xc0')]=function(_0x2d40f8,_0x1966a7,_0x5d3b70){return db['FaxAccount'][_0x2f20('0x5f')]({'where':{'id':_0x2d40f8[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x1966a7,null))[_0x2f20('0x21')](function(_0x2c9b82){if(_0x2c9b82){return _0x2c9b82[_0x2f20('0xc0')](_0x2d40f8['body']['ids'],_[_0x2f20('0x76')](_0x2d40f8[_0x2f20('0x61')],['ids','id'])||{})[_0x2f20('0xc1')](function(_0x1ec6e8){for(var _0x3a426a=0x0;_0x3a426a<_0x2d40f8[_0x2f20('0x61')][_0x2f20('0x6f')][_0x2f20('0x4d')];_0x3a426a+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x2d40f8[_0x2f20('0x61')][_0x2f20('0x6f')][_0x3a426a]),'FaxAccountId':Number(_0x2d40f8[_0x2f20('0x5c')]['id'])});}return _0x1ec6e8;});}})['then'](respondWithResult(_0x1966a7,null))[_0x2f20('0x5a')](handleError(_0x1966a7,null));};exports[_0x2f20('0xc2')]=function(_0x124c7a,_0x42d678,_0x45e82e){return db[_0x2f20('0x42')][_0x2f20('0x5f')]({'where':{'id':_0x124c7a[_0x2f20('0x5c')]['id']}})[_0x2f20('0x21')](handleEntityNotFound(_0x42d678,null))[_0x2f20('0x21')](function(_0x10c954){if(_0x10c954){return _0x10c954[_0x2f20('0xc2')](_0x124c7a['query']['ids'])[_0x2f20('0x21')](function(){if(_[_0x2f20('0xc3')](_0x124c7a[_0x2f20('0x4c')][_0x2f20('0x6f')])){for(var _0x56b59f=0x0;_0x56b59f<_0x124c7a[_0x2f20('0x4c')][_0x2f20('0x6f')][_0x2f20('0x4d')];_0x56b59f+=0x1){socket[_0x2f20('0xc4')](_0x2f20('0xc5'),{'UserId':Number(_0x124c7a[_0x2f20('0x4c')][_0x2f20('0x6f')][_0x56b59f]),'FaxAccountId':Number(_0x124c7a[_0x2f20('0x5c')]['id'])});}}else{socket['emit'](_0x2f20('0xc5'),{'UserId':Number(_0x124c7a[_0x2f20('0x4c')][_0x2f20('0x6f')]),'FaxAccountId':Number(_0x124c7a['params']['id'])});}});}})[_0x2f20('0x21')](respondWithStatusCode(_0x42d678,null))[_0x2f20('0x5a')](handleError(_0x42d678,null));};exports['getAgents']=function(_0x9b43f6,_0x16c7ab,_0x2f827f){var _0x518c0d={};var _0x28f2b8={};var _0x138b7a;var _0x10b13a;return db[_0x2f20('0x42')][_0x2f20('0x6d')]({'where':{'id':_0x9b43f6[_0x2f20('0x5c')]['id']}})['then'](handleEntityNotFound(_0x16c7ab,null))[_0x2f20('0x21')](function(_0x5b3d8c){if(_0x5b3d8c){_0x138b7a=_0x5b3d8c;_0x28f2b8['model']=_['keys'](db[_0x2f20('0xc6')][_0x2f20('0x43')]);_0x28f2b8[_0x2f20('0x4c')]=_[_0x2f20('0x46')](_0x9b43f6[_0x2f20('0x4c')]);_0x28f2b8[_0x2f20('0x47')]=_['intersection'](_0x28f2b8[_0x2f20('0x49')],_0x28f2b8[_0x2f20('0x4c')]);_0x518c0d[_0x2f20('0x4a')]=_[_0x2f20('0x48')](_0x28f2b8[_0x2f20('0x49')],qs[_0x2f20('0x4b')](_0x9b43f6[_0x2f20('0x4c')][_0x2f20('0x4b')]));_0x518c0d[_0x2f20('0x4a')]=_0x518c0d['attributes'][_0x2f20('0x4d')]?_0x518c0d['attributes']:_0x28f2b8[_0x2f20('0x49')];_0x518c0d[_0x2f20('0x50')]=qs['sort'](_0x9b43f6['query'][_0x2f20('0x51')]);_0x518c0d['where']=qs['filters'](_['pick'](_0x9b43f6[_0x2f20('0x4c')],_0x28f2b8[_0x2f20('0x47')]));if(_0x9b43f6['query'][_0x2f20('0x54')]){_0x518c0d['where']=_[_0x2f20('0x55')](_0x518c0d[_0x2f20('0x52')],{'$or':_[_0x2f20('0x41')](_0x518c0d['attributes'],function(_0x2dcee2){var _0x25d9d8={};_0x25d9d8[_0x2dcee2]={'$like':'%'+_0x9b43f6[_0x2f20('0x4c')][_0x2f20('0x54')]+'%'};return _0x25d9d8;})});}_0x518c0d=_[_0x2f20('0x55')]({},_0x518c0d,_0x9b43f6['options']);return _0x138b7a['getAgents'](_0x518c0d);}})[_0x2f20('0x21')](function(_0x302f53){if(_0x302f53){_0x10b13a=_0x302f53['length'];if(!_0x9b43f6[_0x2f20('0x4c')]['hasOwnProperty'](_0x2f20('0x4f'))){_0x518c0d[_0x2f20('0x31')]=qs[_0x2f20('0x31')](_0x9b43f6[_0x2f20('0x4c')][_0x2f20('0x31')]);_0x518c0d['offset']=qs[_0x2f20('0x2f')](_0x9b43f6[_0x2f20('0x4c')][_0x2f20('0x2f')]);}return _0x138b7a['getAgents'](_0x518c0d);}})['then'](function(_0x4cfc7e){if(_0x4cfc7e){return _0x4cfc7e?{'count':_0x10b13a,'rows':_0x4cfc7e}:null;}})[_0x2f20('0x21')](respondWithResult(_0x16c7ab,null))[_0x2f20('0x5a')](handleError(_0x16c7ab,null));}; \ No newline at end of file +var _0x227a=['dataValues','Messages','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','FaxAccounts','then','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','show','mandatoryDispositionPause','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','getDispositions','Disposition','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','getInteractions','findOne','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','sendStatus','getApplications','from-voip-provider','exten','localstationid','app','system','description','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId'];(function(_0x1b3a72,_0x3a1f98){var _0x8b247f=function(_0x17cc35){while(--_0x17cc35){_0x1b3a72['push'](_0x1b3a72['shift']());}};_0x8b247f(++_0x3a1f98);}(_0x227a,0xcf));var _0xa227=function(_0x5d1e36,_0x1ae76c){_0x5d1e36=_0x5d1e36-0x0;var _0x52d660=_0x227a[_0x5d1e36];return _0x52d660;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa227('0x0'));var zipdir=require(_0xa227('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa227('0x2'));var moment=require('moment');var BPromise=require(_0xa227('0x3'));var Mustache=require('mustache');var util=require(_0xa227('0x4'));var path=require(_0xa227('0x5'));var sox=require(_0xa227('0x6'));var csv=require(_0xa227('0x7'));var ejs=require(_0xa227('0x8'));var fs=require('fs');var fs_extra=require(_0xa227('0x9'));var _=require('lodash');var squel=require(_0xa227('0xa'));var crypto=require(_0xa227('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa227('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa227('0xd'));var Papa=require(_0xa227('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa227('0xf'));var as=require(_0xa227('0x10'));var hardwareService=require(_0xa227('0x11'));var logger=require(_0xa227('0x12'))(_0xa227('0x13'));var utils=require(_0xa227('0x14'));var config=require(_0xa227('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa227('0x16'))['db'];config[_0xa227('0x17')]=_['defaults'](config[_0xa227('0x17')],{'host':_0xa227('0x18'),'port':0x18eb});var socket=require(_0xa227('0x19'))(new Redis(config[_0xa227('0x17')]));require('./faxAccount.socket')[_0xa227('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa227('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa227('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2d2306,_0xcde3dd,_0x180f2a,_0x2cd5c8){return new BPromise(function(_0x15913d,_0x544885){var _0x10b048=_0x2cd5c8||client;return _0x10b048[_0xa227('0x1d')](_0x2d2306,_0x180f2a)['then'](function(_0x18e723){logger['info']('FaxAccount,\x20%s,\x20%s',_0xcde3dd,_0xa227('0x1e'));logger[_0xa227('0x1f')](_0xa227('0x20'),_0xcde3dd,_0xa227('0x1e'),JSON[_0xa227('0x21')](_0x18e723));if(_0x18e723[_0xa227('0x22')]){if(_0x18e723['error'][_0xa227('0x23')]===0x1f4){logger[_0xa227('0x22')](_0xa227('0x24'),_0xcde3dd,_0x18e723[_0xa227('0x22')][_0xa227('0x25')]);return _0x544885(_0x18e723['error']['message']);}logger[_0xa227('0x22')]('FaxAccount,\x20%s,\x20%s',_0xcde3dd,_0x18e723[_0xa227('0x22')][_0xa227('0x25')]);return _0x15913d(_0x18e723[_0xa227('0x22')][_0xa227('0x25')]);}else{logger[_0xa227('0x26')](_0xa227('0x24'),_0xcde3dd,'request\x20sent');_0x15913d(_0x18e723[_0xa227('0x27')][_0xa227('0x25')]);}})[_0xa227('0x28')](function(_0x3fe7ec){logger[_0xa227('0x22')](_0xa227('0x24'),_0xcde3dd,_0x3fe7ec);_0x544885(_0x3fe7ec);});});}function respondWithStatusCode(_0x857521,_0x298d13){_0x298d13=_0x298d13||0xcc;return function(_0x19d82){if(_0x19d82){return _0x857521['sendStatus'](_0x298d13);}return _0x857521[_0xa227('0x29')](_0x298d13)[_0xa227('0x2a')]();};}function respondWithResult(_0x5b5d23,_0x36e56d){_0x36e56d=_0x36e56d||0xc8;return function(_0x2572d4){if(_0x2572d4){return _0x5b5d23[_0xa227('0x29')](_0x36e56d)[_0xa227('0x2b')](_0x2572d4);}};}function respondWithFilteredResult(_0x34c4ca,_0x5bb8c0){return function(_0x20e153){if(_0x20e153){var _0x509541=typeof _0x5bb8c0[_0xa227('0x2c')]===_0xa227('0x2d')&&typeof _0x5bb8c0[_0xa227('0x2e')]===_0xa227('0x2d');var _0x17425b=_0x20e153[_0xa227('0x2f')];var _0x178c19=_0x509541?0x0:_0x5bb8c0[_0xa227('0x2c')];var _0x30df38=_0x509541?_0x20e153[_0xa227('0x2f')]:_0x5bb8c0[_0xa227('0x2c')]+_0x5bb8c0[_0xa227('0x2e')];var _0x3fe468;if(_0x30df38>=_0x17425b){_0x30df38=_0x17425b;_0x3fe468=0xc8;}else{_0x3fe468=0xce;}_0x34c4ca[_0xa227('0x29')](_0x3fe468);return _0x34c4ca['set'](_0xa227('0x30'),_0x178c19+'-'+_0x30df38+'/'+_0x17425b)[_0xa227('0x2b')](_0x20e153);}return null;};}function patchUpdates(_0x5f062a){return function(_0x292849){try{jsonpatch[_0xa227('0x31')](_0x292849,_0x5f062a,!![]);}catch(_0x844bec){return BPromise['reject'](_0x844bec);}return _0x292849[_0xa227('0x32')]();};}function saveUpdates(_0x31cc78,_0xc66cf7){return function(_0x191f7d){if(_0x191f7d){return _0x191f7d[_0xa227('0x33')](_0x31cc78)['then'](function(_0x2d413d){return _0x2d413d;});}return null;};}function removeEntity(_0x363b10,_0x31fd06){return function(_0x3d10e4){if(_0x3d10e4){return _0x3d10e4[_0xa227('0x34')]()['then'](function(){var _0x1708bd=_0x3d10e4['get']({'plain':!![]});var _0x599b7a=_0xa227('0x35');return db['UserProfileResource'][_0xa227('0x34')]({'where':{'type':_0x599b7a,'resourceId':_0x1708bd['id']}})[_0xa227('0x36')](function(){return _0x3d10e4;});})[_0xa227('0x36')](function(){_0x363b10[_0xa227('0x29')](0xcc)[_0xa227('0x2a')]();});}};}function handleEntityNotFound(_0x12cc3c,_0x16a2f4){return function(_0x5d1fa0){if(!_0x5d1fa0){_0x12cc3c['sendStatus'](0x194);}return _0x5d1fa0;};}function handleError(_0x201502,_0x2faa1a){_0x2faa1a=_0x2faa1a||0x1f4;return function(_0x1fa489){logger[_0xa227('0x22')](_0x1fa489['stack']);if(_0x1fa489[_0xa227('0x37')]){delete _0x1fa489[_0xa227('0x37')];}_0x201502['status'](_0x2faa1a)[_0xa227('0x38')](_0x1fa489);};}exports['index']=function(_0x3bfa3b,_0x2d9f24){var _0x279d1a={'include':[{'model':db[_0xa227('0x39')],'as':'mandatoryDispositionPause'}]},_0x31de5c={},_0x2565b2={'count':0x0,'rows':[]};var _0x569751=_[_0xa227('0x3a')](db[_0xa227('0x3b')][_0xa227('0x3c')],function(_0x4ec1ab){return{'name':_0x4ec1ab[_0xa227('0x3d')],'type':_0x4ec1ab[_0xa227('0x3e')][_0xa227('0x3f')]};});_0x31de5c[_0xa227('0x40')]=_[_0xa227('0x3a')](_0x569751,'name');_0x31de5c[_0xa227('0x41')]=_[_0xa227('0x42')](_0x3bfa3b[_0xa227('0x41')]);_0x31de5c[_0xa227('0x43')]=_[_0xa227('0x44')](_0x31de5c[_0xa227('0x40')],_0x31de5c[_0xa227('0x41')]);_0x279d1a[_0xa227('0x45')]=_[_0xa227('0x44')](_0x31de5c[_0xa227('0x40')],qs[_0xa227('0x46')](_0x3bfa3b[_0xa227('0x41')][_0xa227('0x46')]));_0x279d1a[_0xa227('0x45')]=_0x279d1a[_0xa227('0x45')][_0xa227('0x47')]?_0x279d1a[_0xa227('0x45')]:_0x31de5c[_0xa227('0x40')];if(!_0x3bfa3b[_0xa227('0x41')][_0xa227('0x48')](_0xa227('0x49'))){_0x279d1a[_0xa227('0x2e')]=qs[_0xa227('0x2e')](_0x3bfa3b[_0xa227('0x41')]['limit']);_0x279d1a[_0xa227('0x2c')]=qs[_0xa227('0x2c')](_0x3bfa3b[_0xa227('0x41')][_0xa227('0x2c')]);}_0x279d1a[_0xa227('0x4a')]=qs['sort'](_0x3bfa3b['query'][_0xa227('0x4b')]);_0x279d1a[_0xa227('0x4c')]=qs[_0xa227('0x43')](_[_0xa227('0x4d')](_0x3bfa3b[_0xa227('0x41')],_0x31de5c[_0xa227('0x43')]),_0x569751);if(_0x3bfa3b['query'][_0xa227('0x4e')]){_0x279d1a[_0xa227('0x4c')]=_['merge'](_0x279d1a['where'],{'$or':_[_0xa227('0x3a')](_0x569751,function(_0x4e3d56){if(_0x4e3d56[_0xa227('0x3e')]!==_0xa227('0x4f')){var _0x26a43b={};_0x26a43b[_0x4e3d56[_0xa227('0x37')]]={'$like':'%'+_0x3bfa3b[_0xa227('0x41')][_0xa227('0x4e')]+'%'};return _0x26a43b;}})});}_0x279d1a=_[_0xa227('0x50')]({},_0x279d1a,_0x3bfa3b[_0xa227('0x51')]);var _0x354295={'where':_0x279d1a[_0xa227('0x4c')]};return db[_0xa227('0x3b')][_0xa227('0x2f')](_0x354295)['then'](function(_0x3c0aa9){_0x2565b2['count']=_0x3c0aa9;if(_0x3bfa3b[_0xa227('0x41')][_0xa227('0x52')]){_0x279d1a['include']=[{'all':!![]}];}return db[_0xa227('0x3b')]['findAll'](_0x279d1a);})['then'](function(_0x17622d){_0x2565b2['rows']=_0x17622d;return _0x2565b2;})[_0xa227('0x36')](respondWithFilteredResult(_0x2d9f24,_0x279d1a))['catch'](handleError(_0x2d9f24,null));};exports[_0xa227('0x53')]=function(_0x32b7d6,_0x44bad9){var _0x158c35={'raw':![],'where':{'id':_0x32b7d6['params']['id']},'include':[{'model':db[_0xa227('0x39')],'as':_0xa227('0x54')}]},_0x4b6457={};_0x4b6457[_0xa227('0x40')]=_['keys'](db[_0xa227('0x3b')]['rawAttributes']);_0x4b6457[_0xa227('0x41')]=_[_0xa227('0x42')](_0x32b7d6[_0xa227('0x41')]);_0x4b6457['filters']=_[_0xa227('0x44')](_0x4b6457[_0xa227('0x40')],_0x4b6457[_0xa227('0x41')]);_0x158c35[_0xa227('0x45')]=_['intersection'](_0x4b6457['model'],qs[_0xa227('0x46')](_0x32b7d6[_0xa227('0x41')][_0xa227('0x46')]));_0x158c35['attributes']=_0x158c35[_0xa227('0x45')][_0xa227('0x47')]?_0x158c35['attributes']:_0x4b6457[_0xa227('0x40')];if(_0x32b7d6[_0xa227('0x41')][_0xa227('0x52')]){_0x158c35[_0xa227('0x55')]=[{'all':!![]}];}_0x158c35=_[_0xa227('0x50')]({},_0x158c35,_0x32b7d6[_0xa227('0x51')]);return db['FaxAccount'][_0xa227('0x56')](_0x158c35)['then'](handleEntityNotFound(_0x44bad9,null))['then'](respondWithResult(_0x44bad9,null))['catch'](handleError(_0x44bad9,null));};exports[_0xa227('0x57')]=function(_0x127a2d,_0x305866){return db['FaxAccount'][_0xa227('0x57')](_0x127a2d['body'],{})['then'](function(_0x369d2d){var _0x5a8447=_0x127a2d[_0xa227('0x58')][_0xa227('0x59')]({'plain':!![]});if(!_0x5a8447)throw new Error(_0xa227('0x5a'));if(_0x5a8447[_0xa227('0x5b')]===_0xa227('0x58')){var _0x486391=_0x369d2d['get']({'plain':!![]});var _0x345959=_0xa227('0x35');return db[_0xa227('0x5c')][_0xa227('0x56')]({'where':{'name':_0x345959,'userProfileId':_0x5a8447[_0xa227('0x5d')]},'raw':!![]})[_0xa227('0x36')](function(_0xf6ecec){if(_0xf6ecec&&_0xf6ecec[_0xa227('0x5e')]===0x0){return db[_0xa227('0x5f')][_0xa227('0x57')]({'name':_0x486391[_0xa227('0x37')],'resourceId':_0x486391['id'],'type':_0xf6ecec[_0xa227('0x37')],'sectionId':_0xf6ecec['id']},{})['then'](function(){return _0x369d2d;});}else{return _0x369d2d;}})[_0xa227('0x28')](function(_0x261609){logger[_0xa227('0x22')](_0xa227('0x60'),_0x261609);throw _0x261609;});}return _0x369d2d;})[_0xa227('0x36')](respondWithResult(_0x305866,0xc9))[_0xa227('0x28')](handleError(_0x305866,null));};exports[_0xa227('0x33')]=function(_0x38ab22,_0x1b05ba){if(_0x38ab22['body']['id']){delete _0x38ab22[_0xa227('0x61')]['id'];}return db['FaxAccount'][_0xa227('0x56')]({'where':{'id':_0x38ab22[_0xa227('0x62')]['id']},'include':[{'model':db[_0xa227('0x39')],'as':_0xa227('0x54')}]})[_0xa227('0x36')](handleEntityNotFound(_0x1b05ba,null))[_0xa227('0x36')](saveUpdates(_0x38ab22['body'],null))['then'](respondWithResult(_0x1b05ba,null))[_0xa227('0x28')](handleError(_0x1b05ba,null));};exports[_0xa227('0x34')]=function(_0xb0b9d6,_0x1417fd){return db[_0xa227('0x3b')][_0xa227('0x56')]({'where':{'id':_0xb0b9d6[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x1417fd,null))['then'](removeEntity(_0x1417fd,null))[_0xa227('0x28')](handleError(_0x1417fd,null));};exports[_0xa227('0x63')]=function(_0x2928f1,_0x3b6ecd){return db[_0xa227('0x3b')]['describe']()[_0xa227('0x36')](respondWithResult(_0x3b6ecd,null))[_0xa227('0x28')](handleError(_0x3b6ecd,null));};exports[_0xa227('0x64')]=function(_0x3b2e22,_0x39b5ef,_0x533178){if(_0x3b2e22[_0xa227('0x61')]['id']){delete _0x3b2e22[_0xa227('0x61')]['id'];}return db[_0xa227('0x3b')][_0xa227('0x56')]({'where':{'id':_0x3b2e22[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x39b5ef,null))['then'](function(_0x2fd163){if(_0x2fd163){_0x3b2e22['body'][_0xa227('0x65')]=_0x2fd163['id'];return db['Disposition'][_0xa227('0x57')](_0x3b2e22['body']);}})[_0xa227('0x36')](respondWithResult(_0x39b5ef,null))[_0xa227('0x28')](handleError(_0x39b5ef,null));};exports[_0xa227('0x66')]=function(_0x360485,_0x315503,_0x4ae64a){var _0x22f348={'raw':![],'where':{}};var _0x46da26={};var _0x45a222={'count':0x0,'rows':[]};return db[_0xa227('0x3b')]['findOne']({'where':{'id':_0x360485[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x315503,null))[_0xa227('0x36')](function(_0x4d7fbc){if(_0x4d7fbc){_0x46da26[_0xa227('0x40')]=_['keys'](db[_0xa227('0x67')][_0xa227('0x3c')]);_0x46da26[_0xa227('0x41')]=_[_0xa227('0x42')](_0x360485['query']);_0x46da26[_0xa227('0x43')]=_[_0xa227('0x44')](_0x46da26[_0xa227('0x40')],_0x46da26[_0xa227('0x41')]);_0x22f348[_0xa227('0x45')]=_[_0xa227('0x44')](_0x46da26[_0xa227('0x40')],qs['fields'](_0x360485['query'][_0xa227('0x46')]));_0x22f348['attributes']=_0x22f348[_0xa227('0x45')]['length']?_0x22f348[_0xa227('0x45')]:_0x46da26[_0xa227('0x40')];if(!_0x360485[_0xa227('0x41')][_0xa227('0x48')](_0xa227('0x49'))){_0x22f348[_0xa227('0x2e')]=qs['limit'](_0x360485[_0xa227('0x41')][_0xa227('0x2e')]);_0x22f348[_0xa227('0x2c')]=qs[_0xa227('0x2c')](_0x360485['query']['offset']);}_0x22f348[_0xa227('0x4a')]=qs[_0xa227('0x4b')](_0x360485[_0xa227('0x41')]['sort']);_0x22f348[_0xa227('0x4c')]=qs[_0xa227('0x43')](_['pick'](_0x360485['query'],_0x46da26[_0xa227('0x43')]));_0x22f348[_0xa227('0x4c')][_0xa227('0x65')]=_0x4d7fbc['id'];if(_0x360485[_0xa227('0x41')]['filter']){_0x22f348[_0xa227('0x4c')]=_[_0xa227('0x50')](_0x22f348[_0xa227('0x4c')],{'$or':_[_0xa227('0x3a')](_0x22f348[_0xa227('0x45')],function(_0x5c5d30){var _0x1d8f52={};_0x1d8f52[_0x5c5d30]={'$like':'%'+_0x360485[_0xa227('0x41')][_0xa227('0x4e')]+'%'};return _0x1d8f52;})});}_0x22f348=_[_0xa227('0x50')]({},_0x22f348,_0x360485['options']);return db[_0xa227('0x67')]['count']({'where':_0x22f348['where']})['then'](function(_0x11f58c){_0x45a222[_0xa227('0x2f')]=_0x11f58c;if(_0x360485['query'][_0xa227('0x52')]){_0x22f348[_0xa227('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xa227('0x68')](_0x22f348);})[_0xa227('0x36')](function(_0x4e04b8){_0x45a222[_0xa227('0x69')]=_0x4e04b8;return _0x45a222;});}})[_0xa227('0x36')](respondWithFilteredResult(_0x315503,_0x22f348))['catch'](handleError(_0x315503,null));};exports[_0xa227('0x6a')]=function(_0xacfe0,_0x39c029,_0x1ce044){return db[_0xa227('0x3b')][_0xa227('0x56')]({'where':{'id':_0xacfe0[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x39c029,null))['then'](function(_0x1693d5){if(_0x1693d5){return _0x1693d5[_0xa227('0x6a')](_0xacfe0[_0xa227('0x41')][_0xa227('0x6b')]);}})[_0xa227('0x36')](respondWithStatusCode(_0x39c029,null))[_0xa227('0x28')](handleError(_0x39c029,null));};exports['addAnswer']=function(_0x18f41d,_0x557921,_0x25fdf1){if(_0x18f41d[_0xa227('0x61')]['id']){delete _0x18f41d[_0xa227('0x61')]['id'];}return db['FaxAccount'][_0xa227('0x56')]({'where':{'id':_0x18f41d[_0xa227('0x62')]['id']}})['then'](handleEntityNotFound(_0x557921,null))[_0xa227('0x36')](function(_0x10bb35){if(_0x10bb35){_0x18f41d['body'][_0xa227('0x65')]=_0x10bb35['id'];return db[_0xa227('0x6c')]['create'](_0x18f41d[_0xa227('0x61')]);}})[_0xa227('0x36')](respondWithResult(_0x557921,null))[_0xa227('0x28')](handleError(_0x557921,null));};exports[_0xa227('0x6d')]=function(_0x394bc4,_0x4a7295,_0x8fdb61){var _0x253ff9={'raw':![],'where':{}};var _0x213e22={};var _0x426b53={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x394bc4[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x4a7295,null))[_0xa227('0x36')](function(_0x3ad498){if(_0x3ad498){_0x213e22[_0xa227('0x40')]=_[_0xa227('0x42')](db['CannedAnswer'][_0xa227('0x3c')]);_0x213e22[_0xa227('0x41')]=_[_0xa227('0x42')](_0x394bc4['query']);_0x213e22['filters']=_['intersection'](_0x213e22[_0xa227('0x40')],_0x213e22[_0xa227('0x41')]);_0x253ff9[_0xa227('0x45')]=_[_0xa227('0x44')](_0x213e22[_0xa227('0x40')],qs['fields'](_0x394bc4[_0xa227('0x41')]['fields']));_0x253ff9[_0xa227('0x45')]=_0x253ff9[_0xa227('0x45')][_0xa227('0x47')]?_0x253ff9[_0xa227('0x45')]:_0x213e22[_0xa227('0x40')];if(!_0x394bc4[_0xa227('0x41')][_0xa227('0x48')](_0xa227('0x49'))){_0x253ff9[_0xa227('0x2e')]=qs['limit'](_0x394bc4[_0xa227('0x41')][_0xa227('0x2e')]);_0x253ff9[_0xa227('0x2c')]=qs[_0xa227('0x2c')](_0x394bc4[_0xa227('0x41')][_0xa227('0x2c')]);}_0x253ff9[_0xa227('0x4a')]=qs['sort'](_0x394bc4[_0xa227('0x41')][_0xa227('0x4b')]);_0x253ff9['where']=qs[_0xa227('0x43')](_['pick'](_0x394bc4[_0xa227('0x41')],_0x213e22[_0xa227('0x43')]));_0x253ff9[_0xa227('0x4c')]['FaxAccountId']=_0x3ad498['id'];if(_0x394bc4[_0xa227('0x41')][_0xa227('0x4e')]){_0x253ff9[_0xa227('0x4c')]=_[_0xa227('0x50')](_0x253ff9[_0xa227('0x4c')],{'$or':_[_0xa227('0x3a')](_0x253ff9[_0xa227('0x45')],function(_0x356d5c){var _0x4ca568={};_0x4ca568[_0x356d5c]={'$like':'%'+_0x394bc4[_0xa227('0x41')][_0xa227('0x4e')]+'%'};return _0x4ca568;})});}_0x253ff9=_[_0xa227('0x50')]({},_0x253ff9,_0x394bc4[_0xa227('0x51')]);return db[_0xa227('0x6c')][_0xa227('0x2f')]({'where':_0x253ff9[_0xa227('0x4c')]})[_0xa227('0x36')](function(_0x18f9fa){_0x426b53[_0xa227('0x2f')]=_0x18f9fa;if(_0x394bc4[_0xa227('0x41')][_0xa227('0x52')]){_0x253ff9[_0xa227('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x253ff9);})[_0xa227('0x36')](function(_0x1d29a4){_0x426b53['rows']=_0x1d29a4;return _0x426b53;});}})['then'](respondWithFilteredResult(_0x4a7295,_0x253ff9))['catch'](handleError(_0x4a7295,null));};exports[_0xa227('0x6e')]=function(_0x2bb3e7,_0x40f70b,_0x39acbb){return db[_0xa227('0x3b')][_0xa227('0x56')]({'where':{'id':_0x2bb3e7[_0xa227('0x62')]['id']}})['then'](handleEntityNotFound(_0x40f70b,null))[_0xa227('0x36')](function(_0xa93da){if(_0xa93da){return _0xa93da[_0xa227('0x6e')](_0x2bb3e7[_0xa227('0x41')][_0xa227('0x6b')]);}})[_0xa227('0x36')](respondWithStatusCode(_0x40f70b,null))[_0xa227('0x28')](handleError(_0x40f70b,null));};exports['addInteraction']=function(_0x2c8d11,_0x19c529,_0x159360){return db[_0xa227('0x6f')]['find']({'where':{'id':_0x2c8d11[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x19c529,null))[_0xa227('0x36')](function(_0x42f710){if(_0x42f710){return _0x42f710[_0xa227('0x70')](_0x2c8d11[_0xa227('0x61')][_0xa227('0x6b')],_['omit'](_0x2c8d11[_0xa227('0x61')],[_0xa227('0x6b'),'id'])||{});}})[_0xa227('0x36')](respondWithResult(_0x19c529,null))[_0xa227('0x28')](handleError(_0x19c529,null));};exports[_0xa227('0x71')]=function(_0x1c54ee,_0x233833,_0xe842c2){var _0x5d4aed={'raw':![],'where':{}};var _0x154be6={};var _0x54d014={'count':0x0,'rows':[]};return db[_0xa227('0x3b')][_0xa227('0x72')]({'where':{'id':_0x1c54ee[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x233833,null))[_0xa227('0x36')](function(_0x109ba0){if(_0x109ba0){_0x154be6[_0xa227('0x40')]=_[_0xa227('0x42')](db[_0xa227('0x6f')][_0xa227('0x3c')]);_0x154be6['query']=_[_0xa227('0x42')](_0x1c54ee[_0xa227('0x41')]);_0x154be6[_0xa227('0x43')]=_[_0xa227('0x44')](_0x154be6[_0xa227('0x40')],_0x154be6['query']);_0x5d4aed['attributes']=_['intersection'](_0x154be6[_0xa227('0x40')],qs[_0xa227('0x46')](_0x1c54ee[_0xa227('0x41')]['fields']));_0x5d4aed['attributes']=_0x5d4aed[_0xa227('0x45')][_0xa227('0x47')]?_0x5d4aed[_0xa227('0x45')]:_0x154be6[_0xa227('0x40')];if(!_0x1c54ee[_0xa227('0x41')]['hasOwnProperty'](_0xa227('0x49'))){_0x5d4aed[_0xa227('0x2e')]=qs[_0xa227('0x2e')](_0x1c54ee[_0xa227('0x41')][_0xa227('0x2e')]);_0x5d4aed['offset']=qs['offset'](_0x1c54ee[_0xa227('0x41')][_0xa227('0x2c')]);}_0x5d4aed[_0xa227('0x4a')]=qs[_0xa227('0x4b')](_0x1c54ee['query'][_0xa227('0x4b')]);_0x5d4aed['where']=qs['filters'](_[_0xa227('0x4d')](_0x1c54ee[_0xa227('0x41')],_0x154be6[_0xa227('0x43')]));_0x5d4aed[_0xa227('0x4c')][_0xa227('0x65')]=_0x109ba0['id'];if(_0x1c54ee[_0xa227('0x41')][_0xa227('0x4e')]){_0x5d4aed[_0xa227('0x4c')]=_[_0xa227('0x50')](_0x5d4aed['where'],{'$or':_[_0xa227('0x3a')](_0x5d4aed['attributes'],function(_0x340dfd){var _0x216b74={};_0x216b74[_0x340dfd]={'$like':'%'+_0x1c54ee[_0xa227('0x41')][_0xa227('0x4e')]+'%'};return _0x216b74;})});}_0x5d4aed=_[_0xa227('0x50')]({},_0x5d4aed,_0x1c54ee[_0xa227('0x51')]);return db[_0xa227('0x6f')][_0xa227('0x2f')]({'where':_0x5d4aed[_0xa227('0x4c')]})[_0xa227('0x36')](function(_0x21402e){_0x54d014[_0xa227('0x2f')]=_0x21402e;if(_0x1c54ee[_0xa227('0x41')][_0xa227('0x52')]){_0x5d4aed[_0xa227('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0xa227('0x73'),'attributes':[_0xa227('0x37'),'fullname',_0xa227('0x74')],'required':![]},{'model':db[_0xa227('0x75')],'as':_0xa227('0x76'),'attributes':['id',_0xa227('0x37'),_0xa227('0x77')],'where':_0x1c54ee[_0xa227('0x41')][_0xa227('0x78')]?{'id':_0x1c54ee[_0xa227('0x41')]['tag']}:undefined,'required':_0x1c54ee['query'][_0xa227('0x78')]?!![]:![]}];}return db[_0xa227('0x6f')][_0xa227('0x68')](_0x5d4aed);})[_0xa227('0x36')](function(_0x5f0a8d){_0x54d014[_0xa227('0x69')]=_0x5f0a8d;return _0x54d014;});}})[_0xa227('0x36')](respondWithFilteredResult(_0x233833,_0x5d4aed))[_0xa227('0x28')](handleError(_0x233833,null));};exports[_0xa227('0x79')]=function(_0x2c4ae6,_0xc74973){var _0x5c566f=_0x2c4ae6[_0xa227('0x62')]['id'];var _0x44bc1d=_0x2c4ae6[_0xa227('0x61')];var _0x3c7b6f=0xc8;var _0x35b311=null;return db[_0xa227('0x7a')][_0xa227('0x7b')]({'isolationLevel':db[_0xa227('0x7a')][_0xa227('0x7c')][_0xa227('0x7d')]['READ_COMMITTED']},function(_0x5e5e1f){return db[_0xa227('0x3b')]['findOne']({'where':{'id':_0x5c566f},'transaction':_0x5e5e1f})[_0xa227('0x36')](function(_0x1e8995){if(_0x1e8995){return db[_0xa227('0x7e')]['destroy']({'where':{'FaxAccountId':_0x5c566f},'transaction':_0x5e5e1f})[_0xa227('0x36')](function(){var _0x3306f7=_[_0xa227('0x3a')](_0x44bc1d,function(_0x283fc5){_0x283fc5[_0xa227('0x65')]=_0x5c566f;return _0x283fc5;});return db[_0xa227('0x7e')][_0xa227('0x7f')](_0x3306f7,{'transaction':_0x5e5e1f});});}else{_0x3c7b6f=0x194;_0x35b311=[];}});})[_0xa227('0x36')](function(){if(_0x3c7b6f!==0x194){return db[_0xa227('0x7e')][_0xa227('0x80')]({'where':{'FaxAccountId':_0x5c566f},'order':_0xa227('0x81')})[_0xa227('0x36')](function(_0x271669){_0x35b311=_0x271669;});}})[_0xa227('0x28')](function(_0x1242fa){_0x3c7b6f=0x1f4;logger[_0xa227('0x22')](_0x1242fa[_0xa227('0x82')]);if(_0x1242fa[_0xa227('0x37')]){delete _0x1242fa[_0xa227('0x37')];}_0x35b311=_0x1242fa;})[_0xa227('0x83')](function(){if(_0x35b311===null){_0xc74973[_0xa227('0x84')](_0x3c7b6f);}else{if(_0x3c7b6f===0x1f4){_0xc74973[_0xa227('0x29')](_0x3c7b6f)[_0xa227('0x38')](_0x35b311);}else{_0xc74973[_0xa227('0x29')](_0x3c7b6f)['json'](_0x35b311);}}});};exports[_0xa227('0x85')]=function(_0x1b8b63,_0x1a53fd,_0x345b7d){var _0x3d242a={};var _0x1c52d1={};var _0x32c979;var _0x376a35;return db[_0xa227('0x3b')][_0xa227('0x72')]({'where':{'id':_0x1b8b63['params']['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x1a53fd,null))[_0xa227('0x36')](function(_0x4f4233){if(_0x4f4233){_0x32c979=_0x4f4233;_0x1c52d1['model']=_[_0xa227('0x42')](db[_0xa227('0x7e')][_0xa227('0x3c')]);_0x1c52d1[_0xa227('0x41')]=_[_0xa227('0x42')](_0x1b8b63[_0xa227('0x41')]);_0x1c52d1['filters']=_['intersection'](_0x1c52d1['model'],_0x1c52d1[_0xa227('0x41')]);_0x3d242a[_0xa227('0x45')]=_[_0xa227('0x44')](_0x1c52d1[_0xa227('0x40')],qs[_0xa227('0x46')](_0x1b8b63[_0xa227('0x41')][_0xa227('0x46')]));_0x3d242a['attributes']=_0x3d242a[_0xa227('0x45')]['length']?_0x3d242a[_0xa227('0x45')]:_0x1c52d1['model'];_0x3d242a['order']=qs[_0xa227('0x4b')](_0x1b8b63['query'][_0xa227('0x4b')]);_0x3d242a[_0xa227('0x4c')]=qs[_0xa227('0x43')](_['pick'](_0x1b8b63['query'],_0x1c52d1[_0xa227('0x43')]));if(_0x1b8b63[_0xa227('0x41')][_0xa227('0x4e')]){_0x3d242a[_0xa227('0x4c')]=_['merge'](_0x3d242a[_0xa227('0x4c')],{'$or':_[_0xa227('0x3a')](_0x3d242a[_0xa227('0x45')],function(_0xc0bad6){var _0x232036={};_0x232036[_0xc0bad6]={'$like':'%'+_0x1b8b63[_0xa227('0x41')][_0xa227('0x4e')]+'%'};return _0x232036;})});}_0x3d242a=_['merge']({},_0x3d242a,_0x1b8b63[_0xa227('0x51')]);return _0x32c979['getApplications'](_0x3d242a);}})[_0xa227('0x36')](function(_0xf7b320){if(_0xf7b320){_0x376a35=_0xf7b320[_0xa227('0x47')];if(!_0x1b8b63[_0xa227('0x41')]['hasOwnProperty'](_0xa227('0x49'))){_0x3d242a[_0xa227('0x2e')]=qs[_0xa227('0x2e')](_0x1b8b63[_0xa227('0x41')][_0xa227('0x2e')]);_0x3d242a['offset']=qs[_0xa227('0x2c')](_0x1b8b63[_0xa227('0x41')][_0xa227('0x2c')]);}return _0x32c979[_0xa227('0x85')](_0x3d242a);}})[_0xa227('0x36')](function(_0x17a63f){if(_0x17a63f){return _0x17a63f?{'count':_0x376a35,'rows':_0x17a63f}:null;}})[_0xa227('0x36')](respondWithResult(_0x1a53fd,null))[_0xa227('0x28')](handleError(_0x1a53fd,null));};function Extension(_0x104e81,_0x4b2bf0,_0x2ea697,_0x53ca87){this['context']=_0xa227('0x86');this[_0xa227('0x87')]=_0x104e81[_0xa227('0x88')];this[_0xa227('0x89')]=_0x53ca87;this[_0xa227('0x3e')]=_0xa227('0x8a');this[_0xa227('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x104e81['id'];this[_0xa227('0x81')]=_0x4b2bf0;this['appdata']=_0x2ea697;}function createExtensionsReciveFax(_0x15e17c){var _0x35b9ac=0x1;var _0x5017f8=[];_0x5017f8[_0xa227('0x8c')](new Extension(_0x15e17c,_0x35b9ac,'','Answer'));_0x35b9ac+=0x1;_0x5017f8[_0xa227('0x8c')](new Extension(_0x15e17c,_0x35b9ac,_0xa227('0x8d'),_0xa227('0x8e')));_0x35b9ac+=0x1;for(var _0x3890a3 in _0x15e17c){if(_0x15e17c['hasOwnProperty'](_0x3890a3)&&(_0x3890a3===_0xa227('0x8f')||_0x3890a3===_0xa227('0x88')||_0x3890a3===_0xa227('0x90')||_0x3890a3==='faxdetect'||_0x3890a3===_0xa227('0x91')||_0x3890a3==='maxrate'||_0x3890a3===_0xa227('0x92')||_0x3890a3===_0xa227('0x93')||_0x3890a3===_0xa227('0x94'))){_0x5017f8['push'](new Extension(_0x15e17c,_0x35b9ac,_0xa227('0x95')+_0x3890a3+')='+_0x15e17c[_0x3890a3],'Set'));_0x35b9ac+=0x1;}}_0x5017f8['push'](new Extension(_0x15e17c,_0x35b9ac,'6',_0xa227('0x96')));_0x35b9ac+=0x1;_0x5017f8[_0xa227('0x8c')](new Extension(_0x15e17c,_0x35b9ac,_0xa227('0x97'),_0xa227('0x98')));_0x35b9ac=0x0;return _0x5017f8;}exports['addAccountApplications']=function(_0x25441f,_0x3900b6,_0x5756eb){var _0x18896a;return db[_0xa227('0x7a')][_0xa227('0x7b')](function(_0x26764f){return db[_0xa227('0x3b')][_0xa227('0x57')](_0x25441f[_0xa227('0x61')],{'transaction':_0x26764f})[_0xa227('0x36')](function(_0x27cdb4){_0x18896a=_0x27cdb4[_0xa227('0x59')]({'plain':!![]});return db[_0xa227('0x99')][_0xa227('0x7f')](createExtensionsReciveFax(_0x18896a),{'transaction':_0x26764f});});})[_0xa227('0x36')](function(){return _0x18896a;})[_0xa227('0x36')](respondWithResult(_0x3900b6,null))[_0xa227('0x28')](handleError(_0x3900b6,null));};exports[_0xa227('0x9a')]=function(_0x25b7ae,_0x1e9c4f,_0x67f926){var _0xfe4ab8;return db[_0xa227('0x7a')]['transaction'](function(_0x4040d8){return db[_0xa227('0x3b')][_0xa227('0x33')](_0x25b7ae[_0xa227('0x61')],{'where':{'id':_0x25b7ae[_0xa227('0x61')]['id']},'transaction':_0x4040d8})[_0xa227('0x36')](function(_0x4a0adc){return db[_0xa227('0x99')][_0xa227('0x34')]({'where':{'FaxAccountId':_0x25b7ae['body']['id']},'transaction':_0x4040d8})['then'](function(_0x2a5f21){return db[_0xa227('0x99')][_0xa227('0x7f')](createExtensionsReciveFax(_['omit'](_0x25b7ae[_0xa227('0x61')],[_0xa227('0x9b'),_0xa227('0x3f'),_0xa227('0x9c'),_0xa227('0x9d'),_0xa227('0x9e'),_0xa227('0x9f')])),{'transaction':_0x4040d8});});});})[_0xa227('0x36')](function(){return db[_0xa227('0x3b')]['findById'](_0x25b7ae['body']['id']);})[_0xa227('0x36')](respondWithResult(_0x1e9c4f,null))['catch'](handleError(_0x1e9c4f,null));};exports[_0xa227('0xa0')]=function(_0x3de154,_0x4a5ff4,_0x1f311d){var _0x196007={'raw':!![],'where':{}};var _0x557ccd={};var _0x248e98={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa227('0x72')]({'where':{'id':_0x3de154['params']['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x4a5ff4,null))[_0xa227('0x36')](function(_0x38c7de){if(_0x38c7de){_0x557ccd[_0xa227('0x40')]=_[_0xa227('0x42')](db[_0xa227('0xa1')][_0xa227('0x3c')]);_0x557ccd[_0xa227('0x41')]=_[_0xa227('0x42')](_0x3de154['query']);_0x557ccd['filters']=_['intersection'](_0x557ccd['model'],_0x557ccd['query']);_0x196007['attributes']=_['intersection'](_0x557ccd['model'],qs[_0xa227('0x46')](_0x3de154[_0xa227('0x41')][_0xa227('0x46')]));_0x196007[_0xa227('0x45')]=_0x196007[_0xa227('0x45')]['length']?_0x196007[_0xa227('0x45')]:_0x557ccd[_0xa227('0x40')];if(!_0x3de154[_0xa227('0x41')][_0xa227('0x48')](_0xa227('0x49'))){_0x196007['limit']=qs[_0xa227('0x2e')](_0x3de154['query']['limit']);_0x196007[_0xa227('0x2c')]=qs['offset'](_0x3de154['query'][_0xa227('0x2c')]);}_0x196007[_0xa227('0x4a')]=qs[_0xa227('0x4b')](_0x3de154[_0xa227('0x41')]['sort']);_0x196007[_0xa227('0x4c')]=qs['filters'](_[_0xa227('0x4d')](_0x3de154['query'],_0x557ccd[_0xa227('0x43')]));_0x196007[_0xa227('0x4c')]['FaxAccountId']=_0x38c7de['id'];if(_0x3de154[_0xa227('0x41')][_0xa227('0x4e')]){_0x196007['where']=_[_0xa227('0x50')](_0x196007[_0xa227('0x4c')],{'$or':_[_0xa227('0x3a')](_0x196007[_0xa227('0x45')],function(_0x4faee0){var _0xd300d2={};_0xd300d2[_0x4faee0]={'$like':'%'+_0x3de154[_0xa227('0x41')]['filter']+'%'};return _0xd300d2;})});}if(_0x3de154[_0xa227('0x41')][_0xa227('0xa2')]){var _0x182317=_0x3de154['query']['$gte'][_0xa227('0xa3')](',');var _0x19349c={};_0x19349c[_0x182317[0x0]]={'$gte':moment(_0x182317[0x1])[_0xa227('0xa4')](_0xa227('0xa5'))};_0x196007[_0xa227('0x4c')]=_[_0xa227('0x50')](_0x196007[_0xa227('0x4c')],_0x19349c);}_0x196007=_[_0xa227('0x50')]({},_0x196007,_0x3de154[_0xa227('0x51')]);return db[_0xa227('0xa1')]['count']({'where':_0x196007[_0xa227('0x4c')]})['then'](function(_0x247923){_0x248e98['count']=_0x247923;if(_0x3de154[_0xa227('0x41')][_0xa227('0x52')]){_0x196007['include']=[{'all':!![]}];}return db[_0xa227('0xa1')]['findAll'](_0x196007);})[_0xa227('0x36')](function(_0x1a14bb){_0x248e98[_0xa227('0x69')]=_0x1a14bb;return _0x248e98;});}})[_0xa227('0x36')](respondWithFilteredResult(_0x4a5ff4,_0x196007))[_0xa227('0x28')](handleError(_0x4a5ff4,null));};exports[_0xa227('0x38')]=function(_0x22d173,_0xa4b359,_0x58ed2b){var _0x564c01,_0x55c932={},_0x826bfb;if(_0x22d173[_0xa227('0x61')]['to']){_0x826bfb=_0x22d173[_0xa227('0x61')]['to'][0x0];}return db[_0xa227('0x3b')][_0xa227('0x56')]({'where':{'id':_0x22d173['params']['id']},'include':[{'model':db[_0xa227('0xa6')],'as':_0xa227('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x826bfb},'limit':0x1,'order':[[_0xa227('0x9d'),_0xa227('0xa8')]]}]}]})['then'](handleEntityNotFound(_0xa4b359,null))[_0xa227('0x36')](function(_0x2980d4){_0x564c01=_0x2980d4;if(_0x22d173[_0xa227('0x61')][_0xa227('0xa9')]&&_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][_0xa227('0x47')]){for(var _0x4d13cf=0x0;_0x4d13cf<_0x22d173[_0xa227('0x61')][_0xa227('0xa9')]['length'];_0x4d13cf+=0x1){_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][_0x4d13cf]={'filename':_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][_0x4d13cf][_0xa227('0x37')],'id':_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][_0x4d13cf]['id'],'path':path[_0xa227('0xaa')](config[_0xa227('0xab')],_0xa227('0xac'),_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][_0x4d13cf][_0xa227('0xad')])};}}return respondWithRpcPromise(_0xa227('0xae'),_0xa227('0xae'),{'FaxAccountId':_[_0xa227('0xaf')](_0x22d173['params']['id'])?undefined:_0x22d173['params']['id'],'path':_[_0xa227('0xaf')](_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][0x0][_0xa227('0x5')])?undefined:_0x22d173[_0xa227('0x61')]['attachments'][0x0][_0xa227('0x5')],'fax':_[_0xa227('0xaf')](_0x22d173[_0xa227('0x61')]['to'][0x0])?undefined:_0x22d173[_0xa227('0x61')]['to'][0x0]},client9002);})[_0xa227('0x36')](function(){if(_0x564c01){if(_[_0xa227('0xaf')](_0x22d173['body'][_0xa227('0xb0')])){_0x22d173[_0xa227('0x61')][_0xa227('0xb0')]=util[_0xa227('0xa4')](_0xa227('0xb1'),_0x564c01['name'],_0x564c01[_0xa227('0xb2')]);}if(_0x564c01['List']){if(_0x564c01[_0xa227('0xa7')]['Contacts']['length']){return _0x564c01[_0xa227('0xa7')][_0xa227('0xb3')][0x0];}else{return db[_0xa227('0xb4')][_0xa227('0x57')](_[_0xa227('0xb5')](_0x22d173['body'],{'firstName':_0x22d173[_0xa227('0x61')]['to'][0x0],'phone':_0x22d173[_0xa227('0x61')]['to'][0x0],'fax':_0x22d173[_0xa227('0x61')]['to'][0x0],'ListId':_0x564c01[_0xa227('0x9f')]}));}}else{throw new Error(_0xa227('0xb6'));}}else{throw new Error(_0xa227('0xb7'));}})[_0xa227('0x36')](function(_0x3375a6){if(_0x3375a6){return db[_0xa227('0x6f')][_0xa227('0x56')]({'where':{'ContactId':_0x3375a6['id'],'closed':![],'FaxAccountId':_0x564c01['id']}})[_0xa227('0x36')](function(_0x41d01c){if(_0x41d01c){return[_0x41d01c,![]];}return db[_0xa227('0x6f')]['create']({'UserId':_0x22d173['user']['id'],'ContactId':_0x3375a6['id'],'FaxAccountId':_0x564c01['id'],'fax':_0x22d173[_0xa227('0x61')]['to'][0x0],'firstMsgDirection':_0xa227('0xb8'),'Messages':[_[_0xa227('0x50')](_0x22d173['body'],{'read':![],'body':_0x22d173['body']['attachments'][0x0][_0xa227('0xb9')],'FaxAccountId':_0x564c01['id'],'UserId':_0x22d173[_0xa227('0x58')]['id'],'ContactId':_0x3375a6['id'],'AttachmentId':_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xa227('0xa1')],'as':'Messages'}]})['then'](function(_0x361b3f){return[_0x361b3f,!![]];});});}else{throw new Error(_0xa227('0xba'));}})[_0xa227('0xbb')](function(_0x37fea3,_0x2bf1ae){if(_0x2bf1ae){return _0x37fea3;}return db[_0xa227('0xa1')][_0xa227('0x57')]({'direction':_0xa227('0xb8'),'read':![],'body':_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][0x0][_0xa227('0xb9')],'FaxAccountId':_0x564c01['id'],'FaxInteractionId':_0x37fea3['id'],'UserId':_0x22d173[_0xa227('0x58')]['id'],'ContactId':_0x37fea3[_0xa227('0xbc')],'AttachmentId':_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][0x0]['id']})[_0xa227('0x36')](function(_0x11eb9a){_0x37fea3[_0xa227('0xbd')][_0xa227('0xbe')]=[];_0x37fea3['dataValues'][_0xa227('0xbe')][_0xa227('0x8c')](_0x11eb9a[_0xa227('0xbd')]);return _0x37fea3;});})[_0xa227('0x36')](function(_0x4bc5b4){respondWithRpcPromise(_0xa227('0xbf'),_0xa227('0xbf'),{'FaxAccountId':_[_0xa227('0xaf')](_0x22d173[_0xa227('0x62')]['id'])?undefined:_0x22d173[_0xa227('0x62')]['id'],'path':_['isNil'](_0x22d173[_0xa227('0x61')]['attachments'][0x0][_0xa227('0x5')])?undefined:_0x22d173['body']['attachments'][0x0]['path'],'fax':_[_0xa227('0xaf')](_0x22d173[_0xa227('0x61')]['to'][0x0])?undefined:_0x22d173[_0xa227('0x61')]['to'][0x0],'AttachmentId':_0x22d173[_0xa227('0x61')][_0xa227('0xa9')][0x0]['id']},client9002)[_0xa227('0x36')](function(_0x1acf46){logger[_0xa227('0x26')]('SendFaxRpc,\x20%s',_0x1acf46);})[_0xa227('0x28')](function(_0x53a6b3){logger[_0xa227('0x26')]('SendFaxRpc,\x20%s',_0x53a6b3);});return _0x4bc5b4;})[_0xa227('0x36')](respondWithResult(_0xa4b359,null))['catch'](handleError(_0xa4b359,null));};exports['addAgents']=function(_0x53d567,_0x1d6155,_0x2b4a7c){return db[_0xa227('0x3b')][_0xa227('0x56')]({'where':{'id':_0x53d567[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x1d6155,null))[_0xa227('0x36')](function(_0x2db1a1){if(_0x2db1a1){return _0x2db1a1[_0xa227('0xc0')](_0x53d567['body'][_0xa227('0x6b')],_['omit'](_0x53d567['body'],['ids','id'])||{})[_0xa227('0xbb')](function(_0x47be8b){for(var _0xc06cf7=0x0;_0xc06cf7<_0x53d567[_0xa227('0x61')]['ids'][_0xa227('0x47')];_0xc06cf7+=0x1){socket[_0xa227('0xc1')](_0xa227('0xc2'),{'UserId':Number(_0x53d567[_0xa227('0x61')]['ids'][_0xc06cf7]),'FaxAccountId':Number(_0x53d567[_0xa227('0x62')]['id'])});}return _0x47be8b;});}})[_0xa227('0x36')](respondWithResult(_0x1d6155,null))['catch'](handleError(_0x1d6155,null));};exports[_0xa227('0xc3')]=function(_0x59cbb0,_0x484171,_0x4c1359){return db['FaxAccount'][_0xa227('0x56')]({'where':{'id':_0x59cbb0[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x484171,null))[_0xa227('0x36')](function(_0x349018){if(_0x349018){return _0x349018['removeAgents'](_0x59cbb0[_0xa227('0x41')]['ids'])[_0xa227('0x36')](function(){if(_['isArray'](_0x59cbb0[_0xa227('0x41')][_0xa227('0x6b')])){for(var _0x5616f1=0x0;_0x5616f1<_0x59cbb0[_0xa227('0x41')][_0xa227('0x6b')][_0xa227('0x47')];_0x5616f1+=0x1){socket[_0xa227('0xc1')](_0xa227('0xc4'),{'UserId':Number(_0x59cbb0['query']['ids'][_0x5616f1]),'FaxAccountId':Number(_0x59cbb0[_0xa227('0x62')]['id'])});}}else{socket[_0xa227('0xc1')](_0xa227('0xc4'),{'UserId':Number(_0x59cbb0[_0xa227('0x41')][_0xa227('0x6b')]),'FaxAccountId':Number(_0x59cbb0[_0xa227('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x484171,null))[_0xa227('0x28')](handleError(_0x484171,null));};exports['getAgents']=function(_0x58e2bc,_0x43f711,_0x2be215){var _0x29d19c={};var _0x4ae2db={};var _0x5849f0;var _0x5d04d0;return db['FaxAccount'][_0xa227('0x72')]({'where':{'id':_0x58e2bc[_0xa227('0x62')]['id']}})[_0xa227('0x36')](handleEntityNotFound(_0x43f711,null))[_0xa227('0x36')](function(_0x3db87d){if(_0x3db87d){_0x5849f0=_0x3db87d;_0x4ae2db[_0xa227('0x40')]=_['keys'](db['User']['rawAttributes']);_0x4ae2db[_0xa227('0x41')]=_['keys'](_0x58e2bc['query']);_0x4ae2db['filters']=_[_0xa227('0x44')](_0x4ae2db[_0xa227('0x40')],_0x4ae2db[_0xa227('0x41')]);_0x29d19c[_0xa227('0x45')]=_[_0xa227('0x44')](_0x4ae2db['model'],qs['fields'](_0x58e2bc[_0xa227('0x41')][_0xa227('0x46')]));_0x29d19c[_0xa227('0x45')]=_0x29d19c[_0xa227('0x45')][_0xa227('0x47')]?_0x29d19c[_0xa227('0x45')]:_0x4ae2db['model'];_0x29d19c[_0xa227('0x4a')]=qs[_0xa227('0x4b')](_0x58e2bc[_0xa227('0x41')][_0xa227('0x4b')]);_0x29d19c[_0xa227('0x4c')]=qs['filters'](_[_0xa227('0x4d')](_0x58e2bc[_0xa227('0x41')],_0x4ae2db[_0xa227('0x43')]));if(_0x58e2bc[_0xa227('0x41')]['filter']){_0x29d19c[_0xa227('0x4c')]=_[_0xa227('0x50')](_0x29d19c[_0xa227('0x4c')],{'$or':_[_0xa227('0x3a')](_0x29d19c[_0xa227('0x45')],function(_0x37c201){var _0x55ea9a={};_0x55ea9a[_0x37c201]={'$like':'%'+_0x58e2bc[_0xa227('0x41')][_0xa227('0x4e')]+'%'};return _0x55ea9a;})});}_0x29d19c=_['merge']({},_0x29d19c,_0x58e2bc[_0xa227('0x51')]);return _0x5849f0['getAgents'](_0x29d19c);}})['then'](function(_0x435d6d){if(_0x435d6d){_0x5d04d0=_0x435d6d['length'];if(!_0x58e2bc[_0xa227('0x41')][_0xa227('0x48')](_0xa227('0x49'))){_0x29d19c[_0xa227('0x2e')]=qs[_0xa227('0x2e')](_0x58e2bc[_0xa227('0x41')][_0xa227('0x2e')]);_0x29d19c[_0xa227('0x2c')]=qs[_0xa227('0x2c')](_0x58e2bc[_0xa227('0x41')][_0xa227('0x2c')]);}return _0x5849f0[_0xa227('0xc5')](_0x29d19c);}})['then'](function(_0x3bbc76){if(_0x3bbc76){return _0x3bbc76?{'count':_0x5d04d0,'rows':_0x3bbc76}:null;}})[_0xa227('0x36')](respondWithResult(_0x43f711,null))[_0xa227('0x28')](handleError(_0x43f711,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ff50188..35af22b 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 _0xf234=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x4bc820,_0x291096){var _0x336570=function(_0x48ae22){while(--_0x48ae22){_0x4bc820['push'](_0x4bc820['shift']());}};_0x336570(++_0x291096);}(_0xf234,0xeb));var _0x4f23=function(_0x282796,_0x217005){_0x282796=_0x282796-0x0;var _0x1a755f=_0xf234[_0x282796];return _0x1a755f;};'use strict';var EventEmitter=require(_0x4f23('0x0'));var FaxAccount=require(_0x4f23('0x1'))['db'][_0x4f23('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4f23('0x3')](0x0);var events={'afterCreate':_0x4f23('0x4'),'afterUpdate':_0x4f23('0x5'),'afterDestroy':_0x4f23('0x6')};function emitEvent(_0x15de96){return function(_0x4867e2,_0x396788,_0x171524){FaxAccountEvents[_0x4f23('0x7')](_0x15de96+':'+_0x4867e2['id'],_0x4867e2);FaxAccountEvents[_0x4f23('0x7')](_0x15de96,_0x4867e2);_0x171524(null);};}for(var e in events){if(events[_0x4f23('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x4f23('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x8e01=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update'];(function(_0x1d59b6,_0x2c49d7){var _0x18254f=function(_0x5b0815){while(--_0x5b0815){_0x1d59b6['push'](_0x1d59b6['shift']());}};_0x18254f(++_0x2c49d7);}(_0x8e01,0x1d8));var _0x18e0=function(_0x2c2525,_0xff7c0){_0x2c2525=_0x2c2525-0x0;var _0x2cc103=_0x8e01[_0x2c2525];return _0x2cc103;};'use strict';var EventEmitter=require(_0x18e0('0x0'));var FaxAccount=require(_0x18e0('0x1'))['db'][_0x18e0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x18e0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x18e0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fb1ac){return function(_0x18fc05,_0x1019da,_0xcc7738){FaxAccountEvents[_0x18e0('0x5')](_0x2fb1ac+':'+_0x18fc05['id'],_0x18fc05);FaxAccountEvents[_0x18e0('0x5')](_0x2fb1ac,_0x18fc05);_0xcc7738(null);};}for(var e in events){if(events[_0x18e0('0x6')](e)){var event=events[e];FaxAccount[_0x18e0('0x7')](e,emitEvent(event));}}module[_0x18e0('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 53f3faa..7e245c7 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 _0x6b4b=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x6b9f13,_0x243e7d){var _0x2e6e15=function(_0x44eb61){while(--_0x44eb61){_0x6b9f13['push'](_0x6b9f13['shift']());}};_0x2e6e15(++_0x243e7d);}(_0x6b4b,0x1d6));var _0xb6b4=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6b4b[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xb6b4('0x0'));var util=require(_0xb6b4('0x1'));var logger=require(_0xb6b4('0x2'))(_0xb6b4('0x3'));var moment=require('moment');var BPromise=require(_0xb6b4('0x4'));var rp=require(_0xb6b4('0x5'));var fs=require('fs');var path=require(_0xb6b4('0x6'));var rimraf=require(_0xb6b4('0x7'));var config=require(_0xb6b4('0x8'));var attributes=require('./faxAccount.attributes');module[_0xb6b4('0x9')]=function(_0x52d158,_0x408d26){return _0x52d158['define'](_0xb6b4('0xa'),attributes,{'tableName':_0xb6b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7268=['exports','FaxAccount','lodash','util','api','moment','rimraf','./faxAccount.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7268,0x132));var _0x8726=function(_0x11a335,_0x5de2da){_0x11a335=_0x11a335-0x0;var _0x2986db=_0x7268[_0x11a335];return _0x2986db;};'use strict';var _=require(_0x8726('0x0'));var util=require(_0x8726('0x1'));var logger=require('../../config/logger')(_0x8726('0x2'));var moment=require(_0x8726('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8726('0x4'));var config=require('../../config/environment');var attributes=require(_0x8726('0x5'));module[_0x8726('0x6')]=function(_0x314f93,_0x456834){return _0x314f93['define'](_0x8726('0x7'),attributes,{'tableName':'fax_accounts','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 995a768..d9bd12a 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 _0x9c9c=['queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','DESC','FaxApplication','Applications','get','list','applications','orderBy','asc','Contacts','length','defaults','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','User','interaction','UserId','unshift','name','waitForTheAssignedAgent','FaxQueue','queueId'];(function(_0x234ef1,_0x235c1d){var _0x324237=function(_0x502497){while(--_0x502497){_0x234ef1['push'](_0x234ef1['shift']());}};_0x324237(++_0x235c1d);}(_0x9c9c,0xc8));var _0xc9c9=function(_0x146beb,_0x57b1f4){_0x146beb=_0x146beb-0x0;var _0x404c81=_0x9c9c[_0x146beb];return _0x404c81;};'use strict';var _=require(_0xc9c9('0x0'));var util=require(_0xc9c9('0x1'));var moment=require(_0xc9c9('0x2'));var BPromise=require(_0xc9c9('0x3'));var rs=require(_0xc9c9('0x4'));var fs=require('fs');var Redis=require(_0xc9c9('0x5'));var db=require(_0xc9c9('0x6'))['db'];var utils=require(_0xc9c9('0x7'));var logger=require(_0xc9c9('0x8'))('rpc');var config=require(_0xc9c9('0x9'));var jayson=require(_0xc9c9('0xa'));var client=jayson[_0xc9c9('0xb')][_0xc9c9('0xc')]({'port':0x232c});config[_0xc9c9('0xd')]=_['defaults'](config[_0xc9c9('0xd')],{'host':_0xc9c9('0xe'),'port':0x18eb});var socket=require(_0xc9c9('0xf'))(new Redis(config[_0xc9c9('0xd')]));require(_0xc9c9('0x10'))[_0xc9c9('0x11')](socket);function respondWithRpcPromise(_0x3f26a6,_0x39ef4d,_0x8aafe5){return new BPromise(function(_0x160c2d,_0x2f693c){return client[_0xc9c9('0x12')](_0x3f26a6,_0x8aafe5)['then'](function(_0x5953dc){logger[_0xc9c9('0x13')](_0xc9c9('0x14'),_0x39ef4d,_0xc9c9('0x15'));logger[_0xc9c9('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x39ef4d,'request\x20sent',JSON['stringify'](_0x5953dc));if(_0x5953dc[_0xc9c9('0x17')]){if(_0x5953dc[_0xc9c9('0x17')][_0xc9c9('0x18')]===0x1f4){logger[_0xc9c9('0x17')](_0xc9c9('0x14'),_0x39ef4d,_0x5953dc[_0xc9c9('0x17')][_0xc9c9('0x19')]);return _0x2f693c(_0x5953dc['error'][_0xc9c9('0x19')]);}logger[_0xc9c9('0x17')](_0xc9c9('0x14'),_0x39ef4d,_0x5953dc[_0xc9c9('0x17')][_0xc9c9('0x19')]);return _0x160c2d(_0x5953dc['error'][_0xc9c9('0x19')]);}else{logger[_0xc9c9('0x13')](_0xc9c9('0x14'),_0x39ef4d,_0xc9c9('0x15'));_0x160c2d(_0x5953dc[_0xc9c9('0x1a')][_0xc9c9('0x19')]);}})[_0xc9c9('0x1b')](function(_0x54325e){logger[_0xc9c9('0x17')](_0xc9c9('0x14'),_0x39ef4d,_0x54325e);_0x2f693c(_0x54325e);});});}exports[_0xc9c9('0x1c')]=function(_0x1d9fa2){var _0x5811ec=this;return new Promise(function(_0x208b86,_0x177dbf){return db[_0xc9c9('0x1d')][_0xc9c9('0x1e')]({'raw':_0x1d9fa2[_0xc9c9('0x1f')]?_0x1d9fa2[_0xc9c9('0x1f')][_0xc9c9('0x20')]===undefined?!![]:![]:!![],'where':_0x1d9fa2['options']?_0x1d9fa2[_0xc9c9('0x1f')][_0xc9c9('0x21')]||null:null,'attributes':_0x1d9fa2[_0xc9c9('0x1f')]?_0x1d9fa2[_0xc9c9('0x1f')][_0xc9c9('0x22')]||null:null,'limit':_0x1d9fa2['options']?_0x1d9fa2[_0xc9c9('0x1f')][_0xc9c9('0x23')]||null:null,'include':_0x1d9fa2[_0xc9c9('0x1f')]?_0x1d9fa2[_0xc9c9('0x1f')][_0xc9c9('0x24')]?_[_0xc9c9('0x25')](_0x1d9fa2[_0xc9c9('0x1f')][_0xc9c9('0x24')],function(_0x4761d5){return{'model':db[_0x4761d5['model']],'as':_0x4761d5['as'],'attributes':_0x4761d5[_0xc9c9('0x22')],'include':_0x4761d5[_0xc9c9('0x24')]?_['map'](_0x4761d5[_0xc9c9('0x24')],function(_0x36b9a2){return{'model':db[_0x36b9a2['model']],'as':_0x36b9a2['as'],'attributes':_0x36b9a2[_0xc9c9('0x22')],'include':_0x36b9a2[_0xc9c9('0x24')]?_[_0xc9c9('0x25')](_0x36b9a2['include'],function(_0xefcff){return{'model':db[_0xefcff[_0xc9c9('0x26')]],'as':_0xefcff['as'],'attributes':_0xefcff['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9c9('0x27')](function(_0x2fbd3d){logger[_0xc9c9('0x13')]('GetFaxAccount',_0x1d9fa2);logger[_0xc9c9('0x16')]('GetFaxAccount',_0x1d9fa2,JSON['stringify'](_0x2fbd3d));_0x208b86(_0x2fbd3d);})[_0xc9c9('0x1b')](function(_0x5ba85a){logger[_0xc9c9('0x17')](_0xc9c9('0x1c'),_0x5ba85a[_0xc9c9('0x19')],_0x1d9fa2);_0x177dbf(_0x5811ec[_0xc9c9('0x17')](0x1f4,_0x5ba85a[_0xc9c9('0x19')]));});});};exports[_0xc9c9('0x28')]=function(_0x4a2195,_0x4801ec,_0x320027){var _0x183b96=this;return new Promise(function(_0x282080,_0x2e3a54){var _0x119c75={'body':_0x4a2195['body'],'channel':_0xc9c9('0x29')};var _0x336e6b=[];var _0x4d395e=[];var _0x30dbc8={};return db[_0xc9c9('0x2a')][_0xc9c9('0x2b')]()[_0xc9c9('0x27')](function(_0x34f5ae){if(!_0x34f5ae){throw new db[(_0xc9c9('0x2c'))][(_0xc9c9('0x2d'))](_0xc9c9('0x2e'));}_0x336e6b=_[_0xc9c9('0x2f')](_[_0xc9c9('0x30')](_0x34f5ae),[_0xc9c9('0x31'),_0xc9c9('0x32')]);_0x4d395e=_[_0xc9c9('0x2f')](_[_0xc9c9('0x30')](_0x34f5ae),[_0xc9c9('0x31'),'updatedAt',_0xc9c9('0x33'),_0xc9c9('0x34')]);if(_0x4a2195[_0xc9c9('0x35')]['id']){delete _0x4a2195[_0xc9c9('0x35')]['id'];}if(_[_0xc9c9('0x36')](_0x4a2195[_0xc9c9('0x35')][_0xc9c9('0x37')])){throw new db['Sequelize'][(_0xc9c9('0x2d'))](_0xc9c9('0x38'));}if(_[_0xc9c9('0x36')](_0x4a2195[_0xc9c9('0x35')][_0xc9c9('0x35')])||_0x4a2195['body'][_0xc9c9('0x35')]===''){throw new db['Sequelize'][(_0xc9c9('0x2d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4a2195[_0xc9c9('0x35')][_0xc9c9('0x39')])){throw new db[(_0xc9c9('0x2c'))]['ValidationError'](_0xc9c9('0x3a')+_0x4d395e);}if(!_['includes'](_0x4d395e,_0x4a2195['body'][_0xc9c9('0x39')])){throw new db[(_0xc9c9('0x2c'))][(_0xc9c9('0x2d'))](_0xc9c9('0x3b')+_0x4d395e);}_0x30dbc8[_0x4a2195[_0xc9c9('0x35')][_0xc9c9('0x39')]]=_0x4a2195[_0xc9c9('0x35')]['from'];})[_0xc9c9('0x27')](function(){return db['FaxAccount'][_0xc9c9('0x3c')]({'where':{'id':_0x4a2195[_0xc9c9('0x3d')]['id']},'include':[{'model':db['CmList'],'as':_0xc9c9('0x3e'),'include':[{'model':db[_0xc9c9('0x2a')],'as':'Contacts','where':_0x30dbc8,'limit':0x1,'order':[[_0xc9c9('0x32'),_0xc9c9('0x3f')]]}]},{'model':db[_0xc9c9('0x40')],'as':_0xc9c9('0x41')}]});})[_0xc9c9('0x27')](function(_0x3404d7){if(_0x3404d7&&_0x3404d7[_0xc9c9('0x3e')]){var _0x3e00fd=_0x3404d7[_0xc9c9('0x42')]({'plain':!![]});_0x119c75['account']=_0x3e00fd;_0x119c75['applications']=_0x3e00fd[_0xc9c9('0x41')];_0x119c75[_0xc9c9('0x43')]=_0x3e00fd[_0xc9c9('0x3e')];_0x119c75[_0xc9c9('0x44')]=_[_0xc9c9('0x45')](_0x119c75[_0xc9c9('0x44')],['priority'],[_0xc9c9('0x46')]);if(_0x119c75[_0xc9c9('0x3d')]['Applications']){delete _0x119c75[_0xc9c9('0x3d')][_0xc9c9('0x41')];}if(_0x119c75['account']['List']&&_0x119c75[_0xc9c9('0x3d')]['List'][_0xc9c9('0x47')][_0xc9c9('0x48')]){return _0x119c75[_0xc9c9('0x3d')][_0xc9c9('0x3e')][_0xc9c9('0x47')][0x0];}var _0x1ddc8f=_[_0xc9c9('0x49')](_0x4a2195[_0xc9c9('0x35')],{'firstName':_0x4a2195['body'][_0xc9c9('0x37')],'ListId':_0x3e00fd[_0xc9c9('0x34')]});_0x1ddc8f[_0x4a2195[_0xc9c9('0x35')]['mapKey']]=_0x4a2195['body'][_0xc9c9('0x37')];return db[_0xc9c9('0x2a')][_0xc9c9('0x4a')](_0x1ddc8f,{'fields':_0x336e6b,'raw':!![]});}})['then'](function(_0x90fdf8){_0x119c75['contact']=_0x90fdf8;if(_0x90fdf8){var _0x26aaff={'ContactId':_0x90fdf8['id'],'FaxAccountId':_0x4a2195[_0xc9c9('0x3d')]['id'],'fax':_0x90fdf8['fax']};return db[_0xc9c9('0x4b')][_0xc9c9('0x3c')]({'where':{'ContactId':_0x90fdf8['id'],'closed':![],'FaxAccountId':_0x4a2195[_0xc9c9('0x3d')]['id']}})['then'](function(_0x55c1c6){if(_0x55c1c6){return[_0x55c1c6,![]];}return db[_0xc9c9('0x4b')]['create'](_0x26aaff)[_0xc9c9('0x27')](function(_0x36421c){return[_0x36421c,!![]];});});}else{throw new Error(_0xc9c9('0x4c'));}})[_0xc9c9('0x4d')](function(_0x23a742,_0x3544fc){var _0x2219c1=_0x23a742[_0xc9c9('0x42')]({'plain':!![]});if(_0x3544fc){if(_0x119c75[_0xc9c9('0x3d')][_0xc9c9('0x4e')]){_0x119c75['applications'][_0xc9c9('0x4f')]({'id':0x0,'priority':_0x119c75[_0xc9c9('0x44')][_0xc9c9('0x48')]+0x1,'app':_0xc9c9('0x50'),'appdata':'unmanaged','interval':_0xc9c9('0x51')});}_0x2219c1[_0xc9c9('0x52')]=!![];}else{_0x2219c1[_0xc9c9('0x52')]=![];}_0x119c75['interaction']=_0x2219c1;return db[_0xc9c9('0x53')][_0xc9c9('0x4a')]({'body':_0x4a2195['body'][_0xc9c9('0x35')],'FaxAccountId':_0x4a2195[_0xc9c9('0x3d')]['id'],'FaxInteractionId':_0x23a742['id'],'direction':'in','ContactId':_0x23a742[_0xc9c9('0x54')],'AttachmentId':_0x4a2195[_0xc9c9('0x35')][_0xc9c9('0x55')]});})['then'](function(_0x25a635){_0x119c75['message']=_0x25a635;if(!_0x119c75['interaction']['UserId'])return;return db[_0xc9c9('0x56')][_0xc9c9('0x3c')]({'attributes':['id','name'],'where':{'id':_0x119c75[_0xc9c9('0x57')][_0xc9c9('0x58')]}});})['then'](function(_0xb99c95){if(_0xb99c95){_0x119c75['applications'][_0xc9c9('0x59')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb99c95[_0xc9c9('0x5a')]+','+(_0x119c75[_0xc9c9('0x3d')][_0xc9c9('0x5b')]||0xa),'interval':_0xc9c9('0x51')});}if(!_0x119c75[_0xc9c9('0x57')]['queueId'])return;return db[_0xc9c9('0x5c')][_0xc9c9('0x3c')]({'attributes':['id','name'],'where':{'id':_0x119c75[_0xc9c9('0x57')][_0xc9c9('0x5d')]}});})[_0xc9c9('0x27')](function(_0x3311e5){if(_0x3311e5){_0x119c75['applications'][_0xc9c9('0x59')]({'id':0x0,'priority':0x1,'app':_0xc9c9('0x5e'),'appdata':_0x3311e5[_0xc9c9('0x5a')]+','+(_0x119c75[_0xc9c9('0x3d')][_0xc9c9('0x5f')]||0x12c),'interval':_0xc9c9('0x51')});}return respondWithRpcPromise(_0xc9c9('0x60'),_0xc9c9('0x61'),_0x119c75);})[_0xc9c9('0x27')](function(_0x1d1fd6){_0x282080(_0x1d1fd6);})[_0xc9c9('0x1b')](function(_0x2d1b2f){_0x2e3a54(_0x183b96[_0xc9c9('0x17')](0x1f4,_0x2d1b2f[_0xc9c9('0x19')]));});});}; \ No newline at end of file +var _0xa650=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetFaxAccount','FaxAccount','options','raw','where','limit','include','map','model','attributes','catch','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','keys','CompanyId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','orderBy','priority','Contacts','length','ListId','create','FaxInteraction','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','FaxQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x5cb76d,_0x47d11a){var _0x34a1f2=function(_0x189bc8){while(--_0x189bc8){_0x5cb76d['push'](_0x5cb76d['shift']());}};_0x34a1f2(++_0x47d11a);}(_0xa650,0x1c1));var _0x0a65=function(_0x59a98b,_0x51fa57){_0x59a98b=_0x59a98b-0x0;var _0x4715c4=_0xa650[_0x59a98b];return _0x4715c4;};'use strict';var _=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var moment=require(_0x0a65('0x2'));var BPromise=require(_0x0a65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a65('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a65('0x5'))(_0x0a65('0x6'));var config=require('../../config/environment');var jayson=require(_0x0a65('0x7'));var client=jayson[_0x0a65('0x8')][_0x0a65('0x9')]({'port':0x232c});config[_0x0a65('0xa')]=_[_0x0a65('0xb')](config[_0x0a65('0xa')],{'host':_0x0a65('0xc'),'port':0x18eb});var socket=require(_0x0a65('0xd'))(new Redis(config['redis']));require(_0x0a65('0xe'))[_0x0a65('0xf')](socket);function respondWithRpcPromise(_0x3613bb,_0xc334dd,_0x3df511){return new BPromise(function(_0x481ead,_0x3fbde0){return client['request'](_0x3613bb,_0x3df511)[_0x0a65('0x10')](function(_0x18cad5){logger[_0x0a65('0x11')](_0x0a65('0x12'),_0xc334dd,'request\x20sent');logger[_0x0a65('0x13')](_0x0a65('0x14'),_0xc334dd,'request\x20sent',JSON['stringify'](_0x18cad5));if(_0x18cad5[_0x0a65('0x15')]){if(_0x18cad5[_0x0a65('0x15')][_0x0a65('0x16')]===0x1f4){logger[_0x0a65('0x15')](_0x0a65('0x12'),_0xc334dd,_0x18cad5[_0x0a65('0x15')][_0x0a65('0x17')]);return _0x3fbde0(_0x18cad5[_0x0a65('0x15')]['message']);}logger[_0x0a65('0x15')](_0x0a65('0x12'),_0xc334dd,_0x18cad5[_0x0a65('0x15')]['message']);return _0x481ead(_0x18cad5['error'][_0x0a65('0x17')]);}else{logger[_0x0a65('0x11')](_0x0a65('0x12'),_0xc334dd,_0x0a65('0x18'));_0x481ead(_0x18cad5[_0x0a65('0x19')][_0x0a65('0x17')]);}})['catch'](function(_0x8b6acb){logger[_0x0a65('0x15')](_0x0a65('0x12'),_0xc334dd,_0x8b6acb);_0x3fbde0(_0x8b6acb);});});}exports[_0x0a65('0x1a')]=function(_0x48ef85){var _0x2dc800=this;return new Promise(function(_0x564763,_0x3b6fd2){return db[_0x0a65('0x1b')]['findAll']({'raw':_0x48ef85[_0x0a65('0x1c')]?_0x48ef85[_0x0a65('0x1c')][_0x0a65('0x1d')]===undefined?!![]:![]:!![],'where':_0x48ef85[_0x0a65('0x1c')]?_0x48ef85['options'][_0x0a65('0x1e')]||null:null,'attributes':_0x48ef85[_0x0a65('0x1c')]?_0x48ef85[_0x0a65('0x1c')]['attributes']||null:null,'limit':_0x48ef85[_0x0a65('0x1c')]?_0x48ef85['options'][_0x0a65('0x1f')]||null:null,'include':_0x48ef85[_0x0a65('0x1c')]?_0x48ef85[_0x0a65('0x1c')][_0x0a65('0x20')]?_[_0x0a65('0x21')](_0x48ef85[_0x0a65('0x1c')][_0x0a65('0x20')],function(_0x51e876){return{'model':db[_0x51e876[_0x0a65('0x22')]],'as':_0x51e876['as'],'attributes':_0x51e876['attributes'],'include':_0x51e876[_0x0a65('0x20')]?_[_0x0a65('0x21')](_0x51e876['include'],function(_0x4196b9){return{'model':db[_0x4196b9['model']],'as':_0x4196b9['as'],'attributes':_0x4196b9[_0x0a65('0x23')],'include':_0x4196b9[_0x0a65('0x20')]?_[_0x0a65('0x21')](_0x4196b9[_0x0a65('0x20')],function(_0x4c996f){return{'model':db[_0x4c996f[_0x0a65('0x22')]],'as':_0x4c996f['as'],'attributes':_0x4c996f[_0x0a65('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0a65('0x10')](function(_0x543452){logger['info']('GetFaxAccount',_0x48ef85);logger['debug'](_0x0a65('0x1a'),_0x48ef85,JSON['stringify'](_0x543452));_0x564763(_0x543452);})[_0x0a65('0x24')](function(_0x2adfd0){logger[_0x0a65('0x15')](_0x0a65('0x1a'),_0x2adfd0[_0x0a65('0x17')],_0x48ef85);_0x3b6fd2(_0x2dc800[_0x0a65('0x15')](0x1f4,_0x2adfd0[_0x0a65('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x15b59f,_0x18d8ed,_0x4a6cbe){var _0x349e60=this;return new Promise(function(_0x176362,_0x5a01e4){var _0x253232={'body':_0x15b59f['body'],'channel':_0x0a65('0x25')};var _0x3df571=[];var _0x2d666a=[];var _0x5d79a1={};return db['CmContact'][_0x0a65('0x26')]()['then'](function(_0x7eca4e){if(!_0x7eca4e){throw new db[(_0x0a65('0x27'))][(_0x0a65('0x28'))](_0x0a65('0x29'));}_0x3df571=_['difference'](_['keys'](_0x7eca4e),[_0x0a65('0x2a'),_0x0a65('0x2b')]);_0x2d666a=_['difference'](_[_0x0a65('0x2c')](_0x7eca4e),[_0x0a65('0x2a'),_0x0a65('0x2b'),_0x0a65('0x2d'),'ListId']);if(_0x15b59f[_0x0a65('0x2e')]['id']){delete _0x15b59f['body']['id'];}if(_[_0x0a65('0x2f')](_0x15b59f[_0x0a65('0x2e')][_0x0a65('0x30')])){throw new db[(_0x0a65('0x27'))][(_0x0a65('0x28'))](_0x0a65('0x31'));}if(_['isNil'](_0x15b59f[_0x0a65('0x2e')]['body'])||_0x15b59f[_0x0a65('0x2e')]['body']===''){throw new db['Sequelize'][(_0x0a65('0x28'))](_0x0a65('0x32'));}if(_[_0x0a65('0x2f')](_0x15b59f[_0x0a65('0x2e')][_0x0a65('0x33')])){throw new db[(_0x0a65('0x27'))][(_0x0a65('0x28'))](_0x0a65('0x34')+_0x2d666a);}if(!_[_0x0a65('0x35')](_0x2d666a,_0x15b59f[_0x0a65('0x2e')]['mapKey'])){throw new db[(_0x0a65('0x27'))][(_0x0a65('0x28'))](_0x0a65('0x36')+_0x2d666a);}_0x5d79a1[_0x15b59f[_0x0a65('0x2e')][_0x0a65('0x33')]]=_0x15b59f[_0x0a65('0x2e')][_0x0a65('0x30')];})[_0x0a65('0x10')](function(){return db['FaxAccount'][_0x0a65('0x37')]({'where':{'id':_0x15b59f[_0x0a65('0x38')]['id']},'include':[{'model':db[_0x0a65('0x39')],'as':_0x0a65('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5d79a1,'limit':0x1,'order':[['updatedAt',_0x0a65('0x3b')]]}]},{'model':db[_0x0a65('0x3c')],'as':_0x0a65('0x3d')}]});})[_0x0a65('0x10')](function(_0x2f55ef){if(_0x2f55ef&&_0x2f55ef['List']){var _0x192121=_0x2f55ef[_0x0a65('0x3e')]({'plain':!![]});_0x253232['account']=_0x192121;_0x253232[_0x0a65('0x3f')]=_0x192121[_0x0a65('0x3d')];_0x253232['list']=_0x192121['List'];_0x253232[_0x0a65('0x3f')]=_[_0x0a65('0x40')](_0x253232['applications'],[_0x0a65('0x41')],['asc']);if(_0x253232[_0x0a65('0x38')][_0x0a65('0x3d')]){delete _0x253232[_0x0a65('0x38')][_0x0a65('0x3d')];}if(_0x253232[_0x0a65('0x38')]['List']&&_0x253232[_0x0a65('0x38')][_0x0a65('0x3a')][_0x0a65('0x42')][_0x0a65('0x43')]){return _0x253232['account'][_0x0a65('0x3a')][_0x0a65('0x42')][0x0];}var _0x10d426=_[_0x0a65('0xb')](_0x15b59f[_0x0a65('0x2e')],{'firstName':_0x15b59f[_0x0a65('0x2e')][_0x0a65('0x30')],'ListId':_0x192121[_0x0a65('0x44')]});_0x10d426[_0x15b59f['body'][_0x0a65('0x33')]]=_0x15b59f[_0x0a65('0x2e')]['from'];return db['CmContact'][_0x0a65('0x45')](_0x10d426,{'fields':_0x3df571,'raw':!![]});}})[_0x0a65('0x10')](function(_0x5b3459){_0x253232['contact']=_0x5b3459;if(_0x5b3459){var _0x304d65={'ContactId':_0x5b3459['id'],'FaxAccountId':_0x15b59f[_0x0a65('0x38')]['id'],'fax':_0x5b3459['fax']};return db[_0x0a65('0x46')]['find']({'where':{'ContactId':_0x5b3459['id'],'closed':![],'FaxAccountId':_0x15b59f[_0x0a65('0x38')]['id']}})[_0x0a65('0x10')](function(_0x1085aa){if(_0x1085aa){return[_0x1085aa,![]];}return db[_0x0a65('0x46')][_0x0a65('0x45')](_0x304d65)[_0x0a65('0x10')](function(_0x4fef08){return[_0x4fef08,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0a65('0x47')](function(_0x365ba8,_0x3a6e70){var _0x1f36d7=_0x365ba8['get']({'plain':!![]});if(_0x3a6e70){if(_0x253232[_0x0a65('0x38')]['autoclose']){_0x253232[_0x0a65('0x3f')]['push']({'id':0x0,'priority':_0x253232[_0x0a65('0x3f')][_0x0a65('0x43')]+0x1,'app':_0x0a65('0x48'),'appdata':_0x0a65('0x49'),'interval':_0x0a65('0x4a')});}_0x1f36d7[_0x0a65('0x4b')]=!![];}else{_0x1f36d7[_0x0a65('0x4b')]=![];}_0x253232[_0x0a65('0x4c')]=_0x1f36d7;return db[_0x0a65('0x4d')][_0x0a65('0x45')]({'body':_0x15b59f['body']['body'],'FaxAccountId':_0x15b59f[_0x0a65('0x38')]['id'],'FaxInteractionId':_0x365ba8['id'],'direction':'in','ContactId':_0x365ba8[_0x0a65('0x4e')],'AttachmentId':_0x15b59f[_0x0a65('0x2e')]['AttachmentId']});})[_0x0a65('0x10')](function(_0x32be01){_0x253232[_0x0a65('0x17')]=_0x32be01;if(!_0x253232[_0x0a65('0x4c')]['UserId'])return;return db[_0x0a65('0x4f')][_0x0a65('0x37')]({'attributes':['id',_0x0a65('0x50')],'where':{'id':_0x253232['interaction'][_0x0a65('0x51')]}});})[_0x0a65('0x10')](function(_0x417b6b){if(_0x417b6b){_0x253232[_0x0a65('0x3f')][_0x0a65('0x52')]({'id':0x0,'priority':0x0,'app':_0x0a65('0x53'),'appdata':_0x417b6b[_0x0a65('0x50')]+','+(_0x253232['account'][_0x0a65('0x54')]||0xa),'interval':_0x0a65('0x4a')});}if(!_0x253232[_0x0a65('0x4c')]['queueId'])return;return db[_0x0a65('0x55')][_0x0a65('0x37')]({'attributes':['id',_0x0a65('0x50')],'where':{'id':_0x253232['interaction'][_0x0a65('0x56')]}});})[_0x0a65('0x10')](function(_0x280a8e){if(_0x280a8e){_0x253232['applications'][_0x0a65('0x52')]({'id':0x0,'priority':0x1,'app':_0x0a65('0x57'),'appdata':_0x280a8e[_0x0a65('0x50')]+','+(_0x253232[_0x0a65('0x38')][_0x0a65('0x58')]||0x12c),'interval':_0x0a65('0x4a')});}return respondWithRpcPromise(_0x0a65('0x59'),_0x0a65('0x5a'),_0x253232);})[_0x0a65('0x10')](function(_0x517117){_0x176362(_0x517117);})['catch'](function(_0x5ca001){_0x5a01e4(_0x349e60[_0x0a65('0x15')](0x1f4,_0x5ca001['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7b668ef..99e353c 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 _0x87cf=['length','faxAccount:','./faxAccount.events','save','emit','register'];(function(_0x2e0e5a,_0x1f4eef){var _0x1240ab=function(_0x41e90d){while(--_0x41e90d){_0x2e0e5a['push'](_0x2e0e5a['shift']());}};_0x1240ab(++_0x1f4eef);}(_0x87cf,0xe0));var _0xf87c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x87cf[_0x321bb2];return _0x9c12ed;};'use strict';var FaxAccountEvents=require(_0xf87c('0x0'));var events=[_0xf87c('0x1'),'remove','update'];function createListener(_0x36c0bd,_0x5b3816){return function(_0x5da032){_0x5b3816[_0xf87c('0x2')](_0x36c0bd,_0x5da032);};}function removeListener(_0x56c865,_0x26d300){return function(){FaxAccountEvents['removeListener'](_0x56c865,_0x26d300);};}exports[_0xf87c('0x3')]=function(_0x44e141){for(var _0x10d352=0x0,_0x12173b=events[_0xf87c('0x4')];_0x10d352<_0x12173b;_0x10d352++){var _0x5bb2cf=events[_0x10d352];var _0xd2420c=createListener(_0xf87c('0x5')+_0x5bb2cf,_0x44e141);FaxAccountEvents['on'](_0x5bb2cf,_0xd2420c);}}; \ No newline at end of file +var _0xe74e=['update','emit','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x21c7aa,_0x34d629){var _0x5e8f84=function(_0x212620){while(--_0x212620){_0x21c7aa['push'](_0x21c7aa['shift']());}};_0x5e8f84(++_0x34d629);}(_0xe74e,0xc5));var _0xee74=function(_0x2dc2df,_0x5e8375){_0x2dc2df=_0x2dc2df-0x0;var _0x33d604=_0xe74e[_0x2dc2df];return _0x33d604;};'use strict';var FaxAccountEvents=require(_0xee74('0x0'));var events=[_0xee74('0x1'),_0xee74('0x2'),_0xee74('0x3')];function createListener(_0x5783d4,_0x422cbf){return function(_0x270b33){_0x422cbf[_0xee74('0x4')](_0x5783d4,_0x270b33);};}function removeListener(_0x571212,_0x22a339){return function(){FaxAccountEvents['removeListener'](_0x571212,_0x22a339);};}exports[_0xee74('0x5')]=function(_0x522fa9){for(var _0x5390b8=0x0,_0x24b22d=events[_0xee74('0x6')];_0x5390b8<_0x24b22d;_0x5390b8++){var _0x17bf3b=events[_0x5390b8];var _0x3727aa=createListener(_0xee74('0x7')+_0x17bf3b,_0x522fa9);FaxAccountEvents['on'](_0x17bf3b,_0x3727aa);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b0ab0b0..abfe105 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 _0xf031=['getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/applications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions'];(function(_0x2192ae,_0x197b1e){var _0x5d8404=function(_0x11e731){while(--_0x11e731){_0x2192ae['push'](_0x2192ae['shift']());}};_0x5d8404(++_0x197b1e);}(_0xf031,0x149));var _0x1f03=function(_0x49f638,_0x1ac3f5){_0x49f638=_0x49f638-0x0;var _0x3c5be4=_0xf031[_0x49f638];return _0x3c5be4;};'use strict';var multer=require(_0x1f03('0x0'));var util=require('util');var path=require(_0x1f03('0x1'));var timeout=require(_0x1f03('0x2'));var express=require('express');var router=express[_0x1f03('0x3')]();var fs_extra=require(_0x1f03('0x4'));var auth=require(_0x1f03('0x5'));var interaction=require(_0x1f03('0x6'));var config=require(_0x1f03('0x7'));var controller=require(_0x1f03('0x8'));router[_0x1f03('0x9')]('/',auth[_0x1f03('0xa')](),controller[_0x1f03('0xb')]);router[_0x1f03('0x9')](_0x1f03('0xc'),auth[_0x1f03('0xa')](),controller[_0x1f03('0xd')]);router[_0x1f03('0x9')]('/:id',auth[_0x1f03('0xa')](),controller['show']);router[_0x1f03('0x9')](_0x1f03('0xe'),auth['isAuthenticated'](),controller[_0x1f03('0xf')]);router[_0x1f03('0x9')](_0x1f03('0x10'),auth['isAuthenticated'](),controller[_0x1f03('0x11')]);router[_0x1f03('0x9')](_0x1f03('0x12'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x13')]);router[_0x1f03('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x1f03('0x9')](_0x1f03('0x14'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x15')]);router['get'](_0x1f03('0x16'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x17')]);router[_0x1f03('0x18')]('/',auth[_0x1f03('0xa')](),controller[_0x1f03('0x19')]);router[_0x1f03('0x18')](_0x1f03('0xe'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x1a')]);router[_0x1f03('0x18')](_0x1f03('0x10'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x1b')]);router[_0x1f03('0x18')](_0x1f03('0x12'),auth[_0x1f03('0xa')](),controller['addInteraction']);router[_0x1f03('0x18')](_0x1f03('0x1c'),auth[_0x1f03('0xa')](),controller['addApplications']);router['post'](_0x1f03('0x1d'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x1e')]);router[_0x1f03('0x18')](_0x1f03('0x1f'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x20')]);router[_0x1f03('0x18')]('/:id/send',auth[_0x1f03('0xa')](),controller[_0x1f03('0x21')]);router[_0x1f03('0x18')](_0x1f03('0x16'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x22')]);router[_0x1f03('0x23')]('/:id',auth[_0x1f03('0xa')](),controller['update']);router[_0x1f03('0x24')](_0x1f03('0x25'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x26')]);router[_0x1f03('0x24')](_0x1f03('0xe'),auth[_0x1f03('0xa')](),controller[_0x1f03('0x27')]);router[_0x1f03('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1f03('0x28')]);router[_0x1f03('0x24')]('/:id/users',auth[_0x1f03('0xa')](),controller[_0x1f03('0x29')]);module[_0x1f03('0x2a')]=router; \ No newline at end of file +var _0x456b=['updateAccountApplications','send','put','delete','removeDispositions','removeAgents','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications'];(function(_0x51f87e,_0x50f6bc){var _0x57bea7=function(_0x18c418){while(--_0x18c418){_0x51f87e['push'](_0x51f87e['shift']());}};_0x57bea7(++_0x50f6bc);}(_0x456b,0x1e8));var _0xb456=function(_0x4a0e40,_0x16f70c){_0x4a0e40=_0x4a0e40-0x0;var _0x53dc22=_0x456b[_0x4a0e40];return _0x53dc22;};'use strict';var multer=require(_0xb456('0x0'));var util=require('util');var path=require(_0xb456('0x1'));var timeout=require('connect-timeout');var express=require(_0xb456('0x2'));var router=express['Router']();var fs_extra=require(_0xb456('0x3'));var auth=require(_0xb456('0x4'));var interaction=require(_0xb456('0x5'));var config=require('../../config/environment');var controller=require(_0xb456('0x6'));router[_0xb456('0x7')]('/',auth[_0xb456('0x8')](),controller['index']);router[_0xb456('0x7')](_0xb456('0x9'),auth[_0xb456('0x8')](),controller[_0xb456('0xa')]);router[_0xb456('0x7')](_0xb456('0xb'),auth[_0xb456('0x8')](),controller[_0xb456('0xc')]);router[_0xb456('0x7')](_0xb456('0xd'),auth[_0xb456('0x8')](),controller['getDispositions']);router[_0xb456('0x7')](_0xb456('0xe'),auth[_0xb456('0x8')](),controller['getAnswers']);router['get'](_0xb456('0xf'),auth['isAuthenticated'](),controller[_0xb456('0x10')]);router[_0xb456('0x7')](_0xb456('0x11'),auth[_0xb456('0x8')](),controller[_0xb456('0x12')]);router[_0xb456('0x7')](_0xb456('0x13'),auth[_0xb456('0x8')](),controller['getMessages']);router[_0xb456('0x7')](_0xb456('0x14'),auth[_0xb456('0x8')](),controller[_0xb456('0x15')]);router[_0xb456('0x16')]('/',auth[_0xb456('0x8')](),controller[_0xb456('0x17')]);router[_0xb456('0x16')](_0xb456('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb456('0x16')](_0xb456('0xe'),auth[_0xb456('0x8')](),controller[_0xb456('0x18')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0xb456('0x19')]);router[_0xb456('0x16')](_0xb456('0x11'),auth[_0xb456('0x8')](),controller[_0xb456('0x1a')]);router['post'](_0xb456('0x1b'),auth[_0xb456('0x8')](),controller[_0xb456('0x1c')]);router[_0xb456('0x16')](_0xb456('0x1d'),auth[_0xb456('0x8')](),controller[_0xb456('0x1e')]);router[_0xb456('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0xb456('0x1f')]);router[_0xb456('0x16')](_0xb456('0x14'),auth[_0xb456('0x8')](),controller['addAgents']);router[_0xb456('0x20')](_0xb456('0xb'),auth[_0xb456('0x8')](),controller['update']);router[_0xb456('0x21')](_0xb456('0xb'),auth[_0xb456('0x8')](),controller['destroy']);router['delete'](_0xb456('0xd'),auth['isAuthenticated'](),controller[_0xb456('0x22')]);router[_0xb456('0x21')](_0xb456('0xe'),auth[_0xb456('0x8')](),controller['removeAnswers']);router[_0xb456('0x21')](_0xb456('0x14'),auth[_0xb456('0x8')](),controller[_0xb456('0x23')]);module[_0xb456('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 52dbe63..926c65c 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 _0x1f64=['TEXT','sequelize','exports','STRING'];(function(_0x2d6397,_0x288cf1){var _0x8bfcbc=function(_0x29c420){while(--_0x29c420){_0x2d6397['push'](_0x2d6397['shift']());}};_0x8bfcbc(++_0x288cf1);}(_0x1f64,0xfd));var _0x41f6=function(_0x5ce402,_0x5c811b){_0x5ce402=_0x5ce402-0x0;var _0x5d5ad3=_0x1f64[_0x5ce402];return _0x5d5ad3;};'use strict';var Sequelize=require(_0x41f6('0x0'));module[_0x41f6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x41f6('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x41f6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x41f6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb138=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xb138,0x1da));var _0x8b13=function(_0x1d5f62,_0x39ef57){_0x1d5f62=_0x1d5f62-0x0;var _0x43b086=_0xb138[_0x1d5f62];return _0x43b086;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'priority':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8b13('0x3')],'allowNull':![],'defaultValue':_0x8b13('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8b13('0x3')]},'interval':{'type':Sequelize[_0x8b13('0x3')],'defaultValue':_0x8b13('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3197f8e..7c19b10 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 _0xad0e=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x346115,_0x275219){var _0xa18bb6=function(_0xfc8fee){while(--_0xfc8fee){_0x346115['push'](_0x346115['shift']());}};_0xa18bb6(++_0x275219);}(_0xad0e,0x186));var _0xead0=function(_0xaa2d05,_0x3d9b62){_0xaa2d05=_0xaa2d05-0x0;var _0x10753c=_0xad0e[_0xaa2d05];return _0x10753c;};'use strict';var emlformat=require(_0xead0('0x0'));var rimraf=require(_0xead0('0x1'));var zipdir=require(_0xead0('0x2'));var jsonpatch=require(_0xead0('0x3'));var rp=require(_0xead0('0x4'));var moment=require(_0xead0('0x5'));var BPromise=require(_0xead0('0x6'));var Mustache=require('mustache');var util=require(_0xead0('0x7'));var path=require(_0xead0('0x8'));var sox=require(_0xead0('0x9'));var csv=require(_0xead0('0xa'));var ejs=require(_0xead0('0xb'));var fs=require('fs');var fs_extra=require(_0xead0('0xc'));var _=require(_0xead0('0xd'));var squel=require(_0xead0('0xe'));var crypto=require(_0xead0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xead0('0x10'));var toCsv=require(_0xead0('0xa'));var querystring=require(_0xead0('0x11'));var Papa=require(_0xead0('0x12'));var Redis=require(_0xead0('0x13'));var authService=require(_0xead0('0x14'));var qs=require(_0xead0('0x15'));var as=require(_0xead0('0x16'));var hardwareService=require(_0xead0('0x17'));var logger=require('../../config/logger')(_0xead0('0x18'));var utils=require('../../config/utils');var config=require(_0xead0('0x19'));var licenseUtil=require(_0xead0('0x1a'));var db=require(_0xead0('0x1b'))['db'];function respondWithStatusCode(_0x2148af,_0x2e5887){_0x2e5887=_0x2e5887||0xcc;return function(_0xff7b95){if(_0xff7b95){return _0x2148af[_0xead0('0x1c')](_0x2e5887);}return _0x2148af[_0xead0('0x1d')](_0x2e5887)['end']();};}function respondWithResult(_0x3b2cd0,_0x35b458){_0x35b458=_0x35b458||0xc8;return function(_0x5c38d2){if(_0x5c38d2){return _0x3b2cd0[_0xead0('0x1d')](_0x35b458)[_0xead0('0x1e')](_0x5c38d2);}};}function respondWithFilteredResult(_0x2bf842,_0xf909f9){return function(_0xaaf2c8){if(_0xaaf2c8){var _0x4057d0=typeof _0xf909f9['offset']===_0xead0('0x1f')&&typeof _0xf909f9[_0xead0('0x20')]===_0xead0('0x1f');var _0x6b3645=_0xaaf2c8[_0xead0('0x21')];var _0x45bd0f=_0x4057d0?0x0:_0xf909f9[_0xead0('0x22')];var _0x261441=_0x4057d0?_0xaaf2c8['count']:_0xf909f9[_0xead0('0x22')]+_0xf909f9[_0xead0('0x20')];var _0x327d96;if(_0x261441>=_0x6b3645){_0x261441=_0x6b3645;_0x327d96=0xc8;}else{_0x327d96=0xce;}_0x2bf842[_0xead0('0x1d')](_0x327d96);return _0x2bf842[_0xead0('0x23')](_0xead0('0x24'),_0x45bd0f+'-'+_0x261441+'/'+_0x6b3645)[_0xead0('0x1e')](_0xaaf2c8);}return null;};}function patchUpdates(_0x5e0028){return function(_0x383a00){try{jsonpatch[_0xead0('0x25')](_0x383a00,_0x5e0028,!![]);}catch(_0x235bdd){return BPromise[_0xead0('0x26')](_0x235bdd);}return _0x383a00[_0xead0('0x27')]();};}function saveUpdates(_0x484793,_0x97956a){return function(_0xbf9c00){if(_0xbf9c00){return _0xbf9c00['update'](_0x484793)[_0xead0('0x28')](function(_0x5bbbfc){return _0x5bbbfc;});}return null;};}function removeEntity(_0x1e4997,_0x125757){return function(_0x170aa4){if(_0x170aa4){return _0x170aa4[_0xead0('0x29')]()[_0xead0('0x28')](function(){_0x1e4997['status'](0xcc)[_0xead0('0x2a')]();});}};}function handleEntityNotFound(_0x46ef4d,_0x25e9c1){return function(_0x3ec67a){if(!_0x3ec67a){_0x46ef4d[_0xead0('0x1c')](0x194);}return _0x3ec67a;};}function handleError(_0x3b7c30,_0x5ee2ef){_0x5ee2ef=_0x5ee2ef||0x1f4;return function(_0x49ef09){logger[_0xead0('0x2b')](_0x49ef09[_0xead0('0x2c')]);if(_0x49ef09['name']){delete _0x49ef09[_0xead0('0x2d')];}_0x3b7c30[_0xead0('0x1d')](_0x5ee2ef)[_0xead0('0x2e')](_0x49ef09);};}exports[_0xead0('0x2f')]=function(_0x527c3f,_0x9cb1b9){var _0x411e0={},_0x4c7432={},_0x9a1d55={'count':0x0,'rows':[]};var _0x2e1753=_[_0xead0('0x30')](db[_0xead0('0x31')][_0xead0('0x32')],function(_0x35d6bf){return{'name':_0x35d6bf[_0xead0('0x33')],'type':_0x35d6bf[_0xead0('0x34')][_0xead0('0x35')]};});_0x4c7432['model']=_['map'](_0x2e1753,_0xead0('0x2d'));_0x4c7432['query']=_[_0xead0('0x36')](_0x527c3f[_0xead0('0x37')]);_0x4c7432[_0xead0('0x38')]=_[_0xead0('0x39')](_0x4c7432['model'],_0x4c7432[_0xead0('0x37')]);_0x411e0['attributes']=_[_0xead0('0x39')](_0x4c7432[_0xead0('0x3a')],qs[_0xead0('0x3b')](_0x527c3f['query'][_0xead0('0x3b')]));_0x411e0[_0xead0('0x3c')]=_0x411e0[_0xead0('0x3c')][_0xead0('0x3d')]?_0x411e0[_0xead0('0x3c')]:_0x4c7432['model'];if(!_0x527c3f[_0xead0('0x37')]['hasOwnProperty'](_0xead0('0x3e'))){_0x411e0[_0xead0('0x20')]=qs[_0xead0('0x20')](_0x527c3f['query'][_0xead0('0x20')]);_0x411e0['offset']=qs['offset'](_0x527c3f[_0xead0('0x37')]['offset']);}_0x411e0[_0xead0('0x3f')]=qs[_0xead0('0x40')](_0x527c3f[_0xead0('0x37')][_0xead0('0x40')]);_0x411e0[_0xead0('0x41')]=qs[_0xead0('0x38')](_[_0xead0('0x42')](_0x527c3f[_0xead0('0x37')],_0x4c7432['filters']),_0x2e1753);if(_0x527c3f['query'][_0xead0('0x43')]){_0x411e0[_0xead0('0x41')]=_['merge'](_0x411e0[_0xead0('0x41')],{'$or':_[_0xead0('0x30')](_0x2e1753,function(_0x370efd){if(_0x370efd[_0xead0('0x34')]!==_0xead0('0x44')){var _0x58dca5={};_0x58dca5[_0x370efd[_0xead0('0x2d')]]={'$like':'%'+_0x527c3f[_0xead0('0x37')]['filter']+'%'};return _0x58dca5;}})});}_0x411e0=_['merge']({},_0x411e0,_0x527c3f[_0xead0('0x45')]);var _0x6ad827={'where':_0x411e0['where']};return db[_0xead0('0x31')][_0xead0('0x21')](_0x6ad827)[_0xead0('0x28')](function(_0x3c89a3){_0x9a1d55[_0xead0('0x21')]=_0x3c89a3;if(_0x527c3f['query'][_0xead0('0x46')]){_0x411e0[_0xead0('0x47')]=[{'all':!![]}];}return db[_0xead0('0x31')][_0xead0('0x48')](_0x411e0);})[_0xead0('0x28')](function(_0x295be2){_0x9a1d55[_0xead0('0x49')]=_0x295be2;return _0x9a1d55;})[_0xead0('0x28')](respondWithFilteredResult(_0x9cb1b9,_0x411e0))[_0xead0('0x4a')](handleError(_0x9cb1b9,null));};exports['show']=function(_0x4c9d27,_0x5a1398){var _0x25f4cb={'raw':!![],'where':{'id':_0x4c9d27[_0xead0('0x4b')]['id']}},_0x4ce50b={};_0x4ce50b[_0xead0('0x3a')]=_[_0xead0('0x36')](db[_0xead0('0x31')]['rawAttributes']);_0x4ce50b['query']=_[_0xead0('0x36')](_0x4c9d27[_0xead0('0x37')]);_0x4ce50b[_0xead0('0x38')]=_[_0xead0('0x39')](_0x4ce50b[_0xead0('0x3a')],_0x4ce50b['query']);_0x25f4cb[_0xead0('0x3c')]=_[_0xead0('0x39')](_0x4ce50b['model'],qs[_0xead0('0x3b')](_0x4c9d27[_0xead0('0x37')][_0xead0('0x3b')]));_0x25f4cb['attributes']=_0x25f4cb[_0xead0('0x3c')]['length']?_0x25f4cb[_0xead0('0x3c')]:_0x4ce50b['model'];if(_0x4c9d27[_0xead0('0x37')][_0xead0('0x46')]){_0x25f4cb[_0xead0('0x47')]=[{'all':!![]}];}_0x25f4cb=_[_0xead0('0x4c')]({},_0x25f4cb,_0x4c9d27['options']);return db[_0xead0('0x31')][_0xead0('0x4d')](_0x25f4cb)['then'](handleEntityNotFound(_0x5a1398,null))[_0xead0('0x28')](respondWithResult(_0x5a1398,null))[_0xead0('0x4a')](handleError(_0x5a1398,null));};exports[_0xead0('0x4e')]=function(_0x16f201,_0x32b634){return db[_0xead0('0x31')]['create'](_0x16f201['body'],{})['then'](respondWithResult(_0x32b634,0xc9))[_0xead0('0x4a')](handleError(_0x32b634,null));};exports[_0xead0('0x4f')]=function(_0x10c833,_0x3731cb){if(_0x10c833[_0xead0('0x50')]['id']){delete _0x10c833[_0xead0('0x50')]['id'];}return db[_0xead0('0x31')]['find']({'where':{'id':_0x10c833[_0xead0('0x4b')]['id']}})[_0xead0('0x28')](handleEntityNotFound(_0x3731cb,null))['then'](saveUpdates(_0x10c833[_0xead0('0x50')],null))[_0xead0('0x28')](respondWithResult(_0x3731cb,null))[_0xead0('0x4a')](handleError(_0x3731cb,null));};exports[_0xead0('0x29')]=function(_0x121449,_0x430fa7){return db[_0xead0('0x31')]['find']({'where':{'id':_0x121449[_0xead0('0x4b')]['id']}})[_0xead0('0x28')](handleEntityNotFound(_0x430fa7,null))[_0xead0('0x28')](removeEntity(_0x430fa7,null))[_0xead0('0x4a')](handleError(_0x430fa7,null));}; \ No newline at end of file +var _0x9339=['options','includeAll','FaxApplication','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','Content-Range','json','apply','reject','save','then','end','error','stack','fieldName','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge'];(function(_0x188e3b,_0x4b8e01){var _0x5137c9=function(_0x167a06){while(--_0x167a06){_0x188e3b['push'](_0x188e3b['shift']());}};_0x5137c9(++_0x4b8e01);}(_0x9339,0xe1));var _0x9933=function(_0x4fb930,_0x4141c4){_0x4fb930=_0x4fb930-0x0;var _0x59adc4=_0x9339[_0x4fb930];return _0x59adc4;};'use strict';var emlformat=require(_0x9933('0x0'));var rimraf=require(_0x9933('0x1'));var zipdir=require(_0x9933('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9933('0x3'));var BPromise=require(_0x9933('0x4'));var Mustache=require('mustache');var util=require(_0x9933('0x5'));var path=require('path');var sox=require(_0x9933('0x6'));var csv=require(_0x9933('0x7'));var ejs=require(_0x9933('0x8'));var fs=require('fs');var fs_extra=require(_0x9933('0x9'));var _=require(_0x9933('0xa'));var squel=require(_0x9933('0xb'));var crypto=require(_0x9933('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9933('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9933('0xe'));var Papa=require(_0x9933('0xf'));var Redis=require(_0x9933('0x10'));var authService=require(_0x9933('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9933('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9933('0x13'))('api');var utils=require(_0x9933('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9933('0x15'));var db=require(_0x9933('0x16'))['db'];function respondWithStatusCode(_0x556f0e,_0xb854d2){_0xb854d2=_0xb854d2||0xcc;return function(_0x393f2e){if(_0x393f2e){return _0x556f0e[_0x9933('0x17')](_0xb854d2);}return _0x556f0e[_0x9933('0x18')](_0xb854d2)['end']();};}function respondWithResult(_0x385b5f,_0x39afda){_0x39afda=_0x39afda||0xc8;return function(_0x232fb7){if(_0x232fb7){return _0x385b5f[_0x9933('0x18')](_0x39afda)['json'](_0x232fb7);}};}function respondWithFilteredResult(_0x5ea3b1,_0x2afa9c){return function(_0x52d888){if(_0x52d888){var _0x26efc6=typeof _0x2afa9c[_0x9933('0x19')]==='undefined'&&typeof _0x2afa9c['limit']==='undefined';var _0x24f2cc=_0x52d888[_0x9933('0x1a')];var _0x576d7d=_0x26efc6?0x0:_0x2afa9c[_0x9933('0x19')];var _0x1b5a30=_0x26efc6?_0x52d888[_0x9933('0x1a')]:_0x2afa9c[_0x9933('0x19')]+_0x2afa9c[_0x9933('0x1b')];var _0x2d6644;if(_0x1b5a30>=_0x24f2cc){_0x1b5a30=_0x24f2cc;_0x2d6644=0xc8;}else{_0x2d6644=0xce;}_0x5ea3b1[_0x9933('0x18')](_0x2d6644);return _0x5ea3b1['set'](_0x9933('0x1c'),_0x576d7d+'-'+_0x1b5a30+'/'+_0x24f2cc)[_0x9933('0x1d')](_0x52d888);}return null;};}function patchUpdates(_0x4c5c86){return function(_0x5e9fcd){try{jsonpatch[_0x9933('0x1e')](_0x5e9fcd,_0x4c5c86,!![]);}catch(_0x5e947a){return BPromise[_0x9933('0x1f')](_0x5e947a);}return _0x5e9fcd[_0x9933('0x20')]();};}function saveUpdates(_0x5da2af,_0x472d7e){return function(_0x4c55ee){if(_0x4c55ee){return _0x4c55ee['update'](_0x5da2af)[_0x9933('0x21')](function(_0x38c70f){return _0x38c70f;});}return null;};}function removeEntity(_0x740784,_0xba189f){return function(_0x187e6e){if(_0x187e6e){return _0x187e6e['destroy']()[_0x9933('0x21')](function(){_0x740784[_0x9933('0x18')](0xcc)[_0x9933('0x22')]();});}};}function handleEntityNotFound(_0x3f2422,_0x4ec2ab){return function(_0x48b35e){if(!_0x48b35e){_0x3f2422['sendStatus'](0x194);}return _0x48b35e;};}function handleError(_0x599fcd,_0x531ea4){_0x531ea4=_0x531ea4||0x1f4;return function(_0x3a3866){logger[_0x9933('0x23')](_0x3a3866[_0x9933('0x24')]);if(_0x3a3866['name']){delete _0x3a3866['name'];}_0x599fcd['status'](_0x531ea4)['send'](_0x3a3866);};}exports['index']=function(_0x391ed6,_0xaa07ea){var _0x3ec4f5={},_0x2165ea={},_0x21a929={'count':0x0,'rows':[]};var _0x4ed1ff=_['map'](db['FaxApplication']['rawAttributes'],function(_0xf24f36){return{'name':_0xf24f36[_0x9933('0x25')],'type':_0xf24f36['type'][_0x9933('0x26')]};});_0x2165ea[_0x9933('0x27')]=_['map'](_0x4ed1ff,_0x9933('0x28'));_0x2165ea['query']=_[_0x9933('0x29')](_0x391ed6[_0x9933('0x2a')]);_0x2165ea[_0x9933('0x2b')]=_[_0x9933('0x2c')](_0x2165ea['model'],_0x2165ea[_0x9933('0x2a')]);_0x3ec4f5[_0x9933('0x2d')]=_[_0x9933('0x2c')](_0x2165ea[_0x9933('0x27')],qs[_0x9933('0x2e')](_0x391ed6[_0x9933('0x2a')]['fields']));_0x3ec4f5[_0x9933('0x2d')]=_0x3ec4f5[_0x9933('0x2d')]['length']?_0x3ec4f5[_0x9933('0x2d')]:_0x2165ea[_0x9933('0x27')];if(!_0x391ed6[_0x9933('0x2a')][_0x9933('0x2f')]('nolimit')){_0x3ec4f5[_0x9933('0x1b')]=qs[_0x9933('0x1b')](_0x391ed6[_0x9933('0x2a')]['limit']);_0x3ec4f5[_0x9933('0x19')]=qs['offset'](_0x391ed6['query']['offset']);}_0x3ec4f5['order']=qs[_0x9933('0x30')](_0x391ed6[_0x9933('0x2a')][_0x9933('0x30')]);_0x3ec4f5[_0x9933('0x31')]=qs['filters'](_[_0x9933('0x32')](_0x391ed6['query'],_0x2165ea[_0x9933('0x2b')]),_0x4ed1ff);if(_0x391ed6[_0x9933('0x2a')][_0x9933('0x33')]){_0x3ec4f5[_0x9933('0x31')]=_['merge'](_0x3ec4f5[_0x9933('0x31')],{'$or':_[_0x9933('0x34')](_0x4ed1ff,function(_0xb740df){if(_0xb740df['type']!==_0x9933('0x35')){var _0x20f59b={};_0x20f59b[_0xb740df[_0x9933('0x28')]]={'$like':'%'+_0x391ed6['query'][_0x9933('0x33')]+'%'};return _0x20f59b;}})});}_0x3ec4f5=_[_0x9933('0x36')]({},_0x3ec4f5,_0x391ed6[_0x9933('0x37')]);var _0x44fed0={'where':_0x3ec4f5[_0x9933('0x31')]};return db['FaxApplication']['count'](_0x44fed0)[_0x9933('0x21')](function(_0x2c4b3c){_0x21a929[_0x9933('0x1a')]=_0x2c4b3c;if(_0x391ed6['query'][_0x9933('0x38')]){_0x3ec4f5['include']=[{'all':!![]}];}return db[_0x9933('0x39')][_0x9933('0x3a')](_0x3ec4f5);})[_0x9933('0x21')](function(_0x3b45b7){_0x21a929[_0x9933('0x3b')]=_0x3b45b7;return _0x21a929;})[_0x9933('0x21')](respondWithFilteredResult(_0xaa07ea,_0x3ec4f5))['catch'](handleError(_0xaa07ea,null));};exports[_0x9933('0x3c')]=function(_0x39cbdb,_0x311021){var _0x5f0334={'raw':!![],'where':{'id':_0x39cbdb[_0x9933('0x3d')]['id']}},_0x1617f2={};_0x1617f2[_0x9933('0x27')]=_[_0x9933('0x29')](db[_0x9933('0x39')][_0x9933('0x3e')]);_0x1617f2[_0x9933('0x2a')]=_[_0x9933('0x29')](_0x39cbdb[_0x9933('0x2a')]);_0x1617f2[_0x9933('0x2b')]=_['intersection'](_0x1617f2[_0x9933('0x27')],_0x1617f2[_0x9933('0x2a')]);_0x5f0334[_0x9933('0x2d')]=_[_0x9933('0x2c')](_0x1617f2['model'],qs[_0x9933('0x2e')](_0x39cbdb[_0x9933('0x2a')][_0x9933('0x2e')]));_0x5f0334[_0x9933('0x2d')]=_0x5f0334['attributes'][_0x9933('0x3f')]?_0x5f0334[_0x9933('0x2d')]:_0x1617f2[_0x9933('0x27')];if(_0x39cbdb[_0x9933('0x2a')][_0x9933('0x38')]){_0x5f0334['include']=[{'all':!![]}];}_0x5f0334=_[_0x9933('0x36')]({},_0x5f0334,_0x39cbdb[_0x9933('0x37')]);return db['FaxApplication'][_0x9933('0x40')](_0x5f0334)['then'](handleEntityNotFound(_0x311021,null))[_0x9933('0x21')](respondWithResult(_0x311021,null))[_0x9933('0x41')](handleError(_0x311021,null));};exports[_0x9933('0x42')]=function(_0x5a0a83,_0x37cfab){return db[_0x9933('0x39')][_0x9933('0x42')](_0x5a0a83[_0x9933('0x43')],{})['then'](respondWithResult(_0x37cfab,0xc9))[_0x9933('0x41')](handleError(_0x37cfab,null));};exports[_0x9933('0x44')]=function(_0x80c360,_0x366e0d){if(_0x80c360[_0x9933('0x43')]['id']){delete _0x80c360[_0x9933('0x43')]['id'];}return db[_0x9933('0x39')][_0x9933('0x40')]({'where':{'id':_0x80c360[_0x9933('0x3d')]['id']}})[_0x9933('0x21')](handleEntityNotFound(_0x366e0d,null))[_0x9933('0x21')](saveUpdates(_0x80c360['body'],null))[_0x9933('0x21')](respondWithResult(_0x366e0d,null))[_0x9933('0x41')](handleError(_0x366e0d,null));};exports[_0x9933('0x45')]=function(_0x5bb8f0,_0x25c9a9){return db[_0x9933('0x39')]['find']({'where':{'id':_0x5bb8f0['params']['id']}})[_0x9933('0x21')](handleEntityNotFound(_0x25c9a9,null))['then'](removeEntity(_0x25c9a9,null))[_0x9933('0x41')](handleError(_0x25c9a9,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f52f64e..8a293fc 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 _0x2903=['path','rimraf','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x2903,0x157));var _0x3290=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2903[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3290('0x0'));var util=require(_0x3290('0x1'));var logger=require('../../config/logger')(_0x3290('0x2'));var moment=require('moment');var BPromise=require(_0x3290('0x3'));var rp=require(_0x3290('0x4'));var fs=require('fs');var path=require(_0x3290('0x5'));var rimraf=require(_0x3290('0x6'));var config=require('../../config/environment');var attributes=require(_0x3290('0x7'));module[_0x3290('0x8')]=function(_0x419f63,_0x185351){return _0x419f63[_0x3290('0x9')]('FaxApplication',attributes,{'tableName':_0x3290('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3290('0xb')});}; \ No newline at end of file +var _0xd807=['./faxApplication.attributes','exports','FaxApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xd807,0xfb));var _0x7d80=function(_0x3470df,_0x30df04){_0x3470df=_0x3470df-0x0;var _0x387878=_0xd807[_0x3470df];return _0x387878;};'use strict';var _=require('lodash');var util=require(_0x7d80('0x0'));var logger=require(_0x7d80('0x1'))(_0x7d80('0x2'));var moment=require(_0x7d80('0x3'));var BPromise=require(_0x7d80('0x4'));var rp=require(_0x7d80('0x5'));var fs=require('fs');var path=require(_0x7d80('0x6'));var rimraf=require(_0x7d80('0x7'));var config=require(_0x7d80('0x8'));var attributes=require(_0x7d80('0x9'));module[_0x7d80('0xa')]=function(_0x46444d,_0x502d88){return _0x46444d['define'](_0x7d80('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d80('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 22b9d54..5ccec64 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 _0x9e47=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x463532,_0x36f05d){var _0x3dae78=function(_0x47579a){while(--_0x47579a){_0x463532['push'](_0x463532['shift']());}};_0x3dae78(++_0x36f05d);}(_0x9e47,0xe4));var _0x79e4=function(_0x4d9596,_0x3e347b){_0x4d9596=_0x4d9596-0x0;var _0x58dd56=_0x9e47[_0x4d9596];return _0x58dd56;};'use strict';var _=require(_0x79e4('0x0'));var util=require('util');var moment=require(_0x79e4('0x1'));var BPromise=require('bluebird');var rs=require(_0x79e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79e4('0x3'))['db'];var utils=require(_0x79e4('0x4'));var logger=require(_0x79e4('0x5'))(_0x79e4('0x6'));var config=require(_0x79e4('0x7'));var jayson=require(_0x79e4('0x8'));var client=jayson[_0x79e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x150b3f,_0x34b8b9,_0x17851e){return new BPromise(function(_0x2298d5,_0x3eacdb){return client[_0x79e4('0xa')](_0x150b3f,_0x17851e)[_0x79e4('0xb')](function(_0x24e5eb){logger['info'](_0x79e4('0xc'),_0x34b8b9,_0x79e4('0xd'));logger[_0x79e4('0xe')](_0x79e4('0xf'),_0x34b8b9,_0x79e4('0xd'),JSON['stringify'](_0x24e5eb));if(_0x24e5eb['error']){if(_0x24e5eb[_0x79e4('0x10')]['code']===0x1f4){logger['error'](_0x79e4('0xc'),_0x34b8b9,_0x24e5eb[_0x79e4('0x10')][_0x79e4('0x11')]);return _0x3eacdb(_0x24e5eb['error']['message']);}logger['error'](_0x79e4('0xc'),_0x34b8b9,_0x24e5eb['error'][_0x79e4('0x11')]);return _0x2298d5(_0x24e5eb[_0x79e4('0x10')][_0x79e4('0x11')]);}else{logger[_0x79e4('0x12')](_0x79e4('0xc'),_0x34b8b9,_0x79e4('0xd'));_0x2298d5(_0x24e5eb[_0x79e4('0x13')][_0x79e4('0x11')]);}})[_0x79e4('0x14')](function(_0x251937){logger[_0x79e4('0x10')](_0x79e4('0xc'),_0x34b8b9,_0x251937);_0x3eacdb(_0x251937);});});}exports[_0x79e4('0x15')]=function(_0x5554b6){var _0x262b50=this;return new Promise(function(_0x3b074d,_0x2d782b){return db[_0x79e4('0x16')][_0x79e4('0x17')](_0x5554b6[_0x79e4('0x18')],{'raw':_0x5554b6[_0x79e4('0x19')]?_0x5554b6[_0x79e4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5554b6[_0x79e4('0x19')]?_0x5554b6['options'][_0x79e4('0x1a')]||null:null,'attributes':_0x5554b6[_0x79e4('0x19')]?_0x5554b6[_0x79e4('0x19')][_0x79e4('0x1b')]||null:null,'limit':_0x5554b6[_0x79e4('0x19')]?_0x5554b6[_0x79e4('0x19')][_0x79e4('0x1c')]||null:null})[_0x79e4('0xb')](function(_0x5486a9){logger['info'](_0x79e4('0x15'),_0x5554b6);logger['debug'](_0x79e4('0x15'),_0x5554b6,JSON[_0x79e4('0x1d')](_0x5486a9));_0x3b074d(_0x5486a9);})[_0x79e4('0x14')](function(_0x3c0361){logger[_0x79e4('0x10')]('UpdateFaxApplication',_0x3c0361['message'],_0x5554b6);_0x2d782b(_0x262b50['error'](0x1f4,_0x3c0361[_0x79e4('0x11')]));});});}; \ No newline at end of file +var _0xc2fc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2ca536,_0x3c62e4){var _0x204de1=function(_0x2e810a){while(--_0x2e810a){_0x2ca536['push'](_0x2ca536['shift']());}};_0x204de1(++_0x3c62e4);}(_0xc2fc,0xda));var _0xcc2f=function(_0x16be5f,_0x47e38d){_0x16be5f=_0x16be5f-0x0;var _0x52609b=_0xc2fc[_0x16be5f];return _0x52609b;};'use strict';var _=require(_0xcc2f('0x0'));var util=require(_0xcc2f('0x1'));var moment=require(_0xcc2f('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc2f('0x3'));var fs=require('fs');var Redis=require(_0xcc2f('0x4'));var db=require(_0xcc2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc2f('0x6'))(_0xcc2f('0x7'));var config=require(_0xcc2f('0x8'));var jayson=require(_0xcc2f('0x9'));var client=jayson[_0xcc2f('0xa')][_0xcc2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dae3b,_0x1a6918,_0x1c3749){return new BPromise(function(_0x49a841,_0x48f609){return client[_0xcc2f('0xc')](_0x2dae3b,_0x1c3749)[_0xcc2f('0xd')](function(_0x570315){logger[_0xcc2f('0xe')](_0xcc2f('0xf'),_0x1a6918,_0xcc2f('0x10'));logger[_0xcc2f('0x11')](_0xcc2f('0x12'),_0x1a6918,_0xcc2f('0x10'),JSON['stringify'](_0x570315));if(_0x570315[_0xcc2f('0x13')]){if(_0x570315[_0xcc2f('0x13')]['code']===0x1f4){logger['error'](_0xcc2f('0xf'),_0x1a6918,_0x570315[_0xcc2f('0x13')][_0xcc2f('0x14')]);return _0x48f609(_0x570315[_0xcc2f('0x13')]['message']);}logger[_0xcc2f('0x13')]('FaxApplication,\x20%s,\x20%s',_0x1a6918,_0x570315[_0xcc2f('0x13')]['message']);return _0x49a841(_0x570315[_0xcc2f('0x13')][_0xcc2f('0x14')]);}else{logger[_0xcc2f('0xe')](_0xcc2f('0xf'),_0x1a6918,_0xcc2f('0x10'));_0x49a841(_0x570315['result']['message']);}})[_0xcc2f('0x15')](function(_0x1a5642){logger[_0xcc2f('0x13')](_0xcc2f('0xf'),_0x1a6918,_0x1a5642);_0x48f609(_0x1a5642);});});}exports[_0xcc2f('0x16')]=function(_0x58f529){var _0x225af1=this;return new Promise(function(_0x275626,_0x7fbccd){return db[_0xcc2f('0x17')]['update'](_0x58f529['body'],{'raw':_0x58f529[_0xcc2f('0x18')]?_0x58f529['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58f529['options']?_0x58f529[_0xcc2f('0x18')][_0xcc2f('0x19')]||null:null,'attributes':_0x58f529[_0xcc2f('0x18')]?_0x58f529['options'][_0xcc2f('0x1a')]||null:null,'limit':_0x58f529[_0xcc2f('0x18')]?_0x58f529['options']['limit']||null:null})[_0xcc2f('0xd')](function(_0x281e6a){logger[_0xcc2f('0xe')]('UpdateFaxApplication',_0x58f529);logger[_0xcc2f('0x11')](_0xcc2f('0x16'),_0x58f529,JSON[_0xcc2f('0x1b')](_0x281e6a));_0x275626(_0x281e6a);})[_0xcc2f('0x15')](function(_0x178835){logger['error'](_0xcc2f('0x16'),_0x178835[_0xcc2f('0x14')],_0x58f529);_0x7fbccd(_0x225af1[_0xcc2f('0x13')](0x1f4,_0x178835['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4b92803..ebc7c6f 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 _0xb10b=['./faxApplication.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f583d,_0x4168a6){var _0x312c0e=function(_0x2f7690){while(--_0x2f7690){_0x4f583d['push'](_0x4f583d['shift']());}};_0x312c0e(++_0x4168a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x25bb4c,_0x1a0b53){_0x25bb4c=_0x25bb4c-0x0;var _0x4c78b2=_0xb10b[_0x25bb4c];return _0x4c78b2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0xce0b20,_0x2f6f89){var _0x345e42=function(_0x12ac5f){while(--_0x12ac5f){_0xce0b20['push'](_0xce0b20['shift']());}};_0x345e42(++_0x2f6f89);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3557af,_0x1ab748){_0x3557af=_0x3557af-0x0;var _0x42362b=_0xd4a2[_0x3557af];return _0x42362b;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7979932..74dbec1 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 _0x1399=['sequelize','exports','DATE','STRING','ENUM','out','INTEGER'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x1399,0x16c));var _0x9139=function(_0xc5d3c8,_0x43352b){_0xc5d3c8=_0xc5d3c8-0x0;var _0x3537e4=_0x1399[_0xc5d3c8];return _0x3537e4;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9139('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9139('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9139('0x3')]},'note':{'type':Sequelize[_0x9139('0x3')]},'read1stAt':{'type':Sequelize[_0x9139('0x2')]},'fax':{'type':Sequelize[_0x9139('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9139('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9139('0x4')]('in',_0x9139('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x9139('0x6')]}}; \ No newline at end of file +var _0x8f4c=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x230143,_0x22949b){var _0x5e9ee3=function(_0xe0aff2){while(--_0xe0aff2){_0x230143['push'](_0x230143['shift']());}};_0x5e9ee3(++_0x22949b);}(_0x8f4c,0x113));var _0xc8f4=function(_0x30db0a,_0x6561ab){_0x30db0a=_0x30db0a-0x0;var _0x23fea7=_0x8f4c[_0x30db0a];return _0x23fea7;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'closed':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8f4('0x3')]},'disposition':{'type':Sequelize[_0xc8f4('0x4')]},'secondDisposition':{'type':Sequelize[_0xc8f4('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc8f4('0x4')]},'read1stAt':{'type':Sequelize[_0xc8f4('0x3')]},'fax':{'type':Sequelize[_0xc8f4('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc8f4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc8f4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 93011c0..29193ef 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 _0xf4f1=['find','create','body','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','filters','nolimit','sort','pick','where','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','color','faxInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','findAll','user','catch','model','keys','FaxInteraction','query','intersection','fields','attributes','length','includeAll','include','options'];(function(_0x1390ff,_0x29b25a){var _0x4ea773=function(_0xf7a9e3){while(--_0xf7a9e3){_0x1390ff['push'](_0x1390ff['shift']());}};_0x4ea773(++_0x29b25a);}(_0xf4f1,0x15b));var _0x1f4f=function(_0x573e27,_0x5478fd){_0x573e27=_0x573e27-0x0;var _0x46c3a7=_0xf4f1[_0x573e27];return _0x46c3a7;};'use strict';var rimraf=require(_0x1f4f('0x0'));var zipdir=require(_0x1f4f('0x1'));var moment=require('moment');var BPromise=require(_0x1f4f('0x2'));var util=require(_0x1f4f('0x3'));var path=require(_0x1f4f('0x4'));var fs=require('fs');var _=require(_0x1f4f('0x5'));var Redis=require(_0x1f4f('0x6'));var interaction=require(_0x1f4f('0x7'));var qs=require(_0x1f4f('0x8'));var logger=require(_0x1f4f('0x9'))(_0x1f4f('0xa'));var config=require(_0x1f4f('0xb'));var db=require(_0x1f4f('0xc'))['db'];config[_0x1f4f('0xd')]=_[_0x1f4f('0xe')](config[_0x1f4f('0xd')],{'host':_0x1f4f('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1f4f('0x10'))[_0x1f4f('0x11')](socket);function respondWithStatusCode(_0x1643ed,_0x484206){_0x484206=_0x484206||0xcc;return function(_0x4f4b55){if(_0x4f4b55){return _0x1643ed[_0x1f4f('0x12')](_0x484206);}return _0x1643ed[_0x1f4f('0x13')](_0x484206)[_0x1f4f('0x14')]();};}function respondWithResult(_0xd86f7b,_0x42fd73){_0x42fd73=_0x42fd73||0xc8;return function(_0x11f2be){if(_0x11f2be){return _0xd86f7b[_0x1f4f('0x13')](_0x42fd73)[_0x1f4f('0x15')](_0x11f2be);}};}function respondWithFilteredResult(_0xa10dca,_0x10a84a){return function(_0x3d4823){if(_0x3d4823){var _0x4daeae=typeof _0x10a84a[_0x1f4f('0x16')]===_0x1f4f('0x17')&&typeof _0x10a84a['limit']==='undefined';var _0x2dc0a6=_0x3d4823[_0x1f4f('0x18')];var _0x1ca2ea=_0x4daeae?0x0:_0x10a84a[_0x1f4f('0x16')];var _0x241c0b=_0x4daeae?_0x3d4823[_0x1f4f('0x18')]:_0x10a84a[_0x1f4f('0x16')]+_0x10a84a[_0x1f4f('0x19')];var _0x3c7c62;if(_0x241c0b>=_0x2dc0a6){_0x241c0b=_0x2dc0a6;_0x3c7c62=0xc8;}else{_0x3c7c62=0xce;}_0xa10dca[_0x1f4f('0x13')](_0x3c7c62);return _0xa10dca[_0x1f4f('0x1a')]('Content-Range',_0x1ca2ea+'-'+_0x241c0b+'/'+_0x2dc0a6)[_0x1f4f('0x15')](_0x3d4823);}return null;};}function saveUpdates(_0x48edb5){return function(_0x27c8cf){if(_0x27c8cf){return _0x27c8cf[_0x1f4f('0x1b')](_0x48edb5)[_0x1f4f('0x1c')](function(_0xd478c8){return _0xd478c8;});}return null;};}function removeEntity(_0x35d52a){return function(_0x4aa23f){if(_0x4aa23f){return _0x4aa23f[_0x1f4f('0x1d')]()[_0x1f4f('0x1c')](function(){_0x35d52a[_0x1f4f('0x13')](0xcc)[_0x1f4f('0x14')]();});}};}function handleEntityNotFound(_0x19e905){return function(_0x594429){if(!_0x594429){_0x19e905[_0x1f4f('0x12')](0x194);}return _0x594429;};}function handleError(_0x37729,_0xa92f37){_0xa92f37=_0xa92f37||0x1f4;return function(_0x19c101){logger[_0x1f4f('0x1e')](_0x19c101[_0x1f4f('0x1f')]);if(_0x19c101[_0x1f4f('0x20')]){delete _0x19c101[_0x1f4f('0x20')];}_0x37729['status'](_0xa92f37)[_0x1f4f('0x21')](_0x19c101);};}exports['index']=function(_0x296df7,_0x904d2){var _0x59ffde={};var _0x2c301a=_[_0x1f4f('0x22')](db['FaxInteraction'][_0x1f4f('0x23')],function(_0x1038bb){return{'name':_0x1038bb[_0x1f4f('0x24')],'type':_0x1038bb[_0x1f4f('0x25')][_0x1f4f('0x26')]};});_0x59ffde=qs['getOptions'](_0x2c301a,_0x296df7);return interaction[_0x1f4f('0x27')]('fax',_0x296df7['query'],_0x296df7[_0x1f4f('0x28')],_0x59ffde,_0x2c301a)['then'](respondWithFilteredResult(_0x904d2,_0x59ffde))[_0x1f4f('0x29')](handleError(_0x904d2,null));};exports['show']=function(_0x2c4d73,_0x506ea6){var _0x134fb3={'raw':![],'where':{'id':_0x2c4d73['params']['id']}},_0x3e1bba={};_0x3e1bba[_0x1f4f('0x2a')]=_[_0x1f4f('0x2b')](db[_0x1f4f('0x2c')][_0x1f4f('0x23')]);_0x3e1bba[_0x1f4f('0x2d')]=_[_0x1f4f('0x2b')](_0x2c4d73[_0x1f4f('0x2d')]);_0x3e1bba['filters']=_[_0x1f4f('0x2e')](_0x3e1bba[_0x1f4f('0x2a')],_0x3e1bba['query']);_0x134fb3['attributes']=_['intersection'](_0x3e1bba['model'],qs[_0x1f4f('0x2f')](_0x2c4d73['query'][_0x1f4f('0x2f')]));_0x134fb3[_0x1f4f('0x30')]=_0x134fb3['attributes'][_0x1f4f('0x31')]?_0x134fb3['attributes']:_0x3e1bba['model'];if(_0x2c4d73[_0x1f4f('0x2d')][_0x1f4f('0x32')]){_0x134fb3[_0x1f4f('0x33')]=[{'all':!![]}];}_0x134fb3=_['merge']({},_0x134fb3,_0x2c4d73[_0x1f4f('0x34')]);return db[_0x1f4f('0x2c')][_0x1f4f('0x35')](_0x134fb3)[_0x1f4f('0x1c')](handleEntityNotFound(_0x506ea6,null))['then'](respondWithResult(_0x506ea6,null))['catch'](handleError(_0x506ea6,null));};exports['create']=function(_0x41b869,_0x1af9ad){return db[_0x1f4f('0x2c')][_0x1f4f('0x36')](_0x41b869[_0x1f4f('0x37')],{})[_0x1f4f('0x1c')](respondWithResult(_0x1af9ad,0xc9))[_0x1f4f('0x29')](handleError(_0x1af9ad,null));};exports['update']=function(_0x538748,_0x20e5c0){if(_0x538748[_0x1f4f('0x37')]['id']){delete _0x538748[_0x1f4f('0x37')]['id'];}return db['FaxInteraction'][_0x1f4f('0x35')]({'where':{'id':_0x538748[_0x1f4f('0x38')]['id']}})[_0x1f4f('0x1c')](handleEntityNotFound(_0x20e5c0,null))[_0x1f4f('0x1c')](saveUpdates(_0x538748['body'],null))['then'](respondWithResult(_0x20e5c0,null))[_0x1f4f('0x29')](handleError(_0x20e5c0,null));};exports[_0x1f4f('0x1d')]=function(_0x1f5600,_0x225e98){return db[_0x1f4f('0x2c')][_0x1f4f('0x35')]({'where':{'id':_0x1f5600['params']['id']}})[_0x1f4f('0x1c')](handleEntityNotFound(_0x225e98,null))['then'](removeEntity(_0x225e98,null))[_0x1f4f('0x29')](handleError(_0x225e98,null));};exports[_0x1f4f('0x39')]=function(_0x4d3cc5,_0x1f6ec5){return db[_0x1f4f('0x2c')][_0x1f4f('0x39')]()[_0x1f4f('0x1c')](respondWithResult(_0x1f6ec5,null))['catch'](handleError(_0x1f6ec5,null));};exports[_0x1f4f('0x3a')]=function(_0xee5e3f,_0x3bccb6){return db[_0x1f4f('0x3b')][_0x1f4f('0x35')]({'where':{'id':_0xee5e3f[_0x1f4f('0x38')]['id']}})[_0x1f4f('0x1c')](handleEntityNotFound(_0x3bccb6,null))[_0x1f4f('0x1c')](function(_0x28a80f){if(_0x28a80f){return _0x28a80f[_0x1f4f('0x3a')](_0xee5e3f[_0x1f4f('0x37')]['ids'],_['omit'](_0xee5e3f[_0x1f4f('0x37')],[_0x1f4f('0x3c'),'id'])||{});}})[_0x1f4f('0x1c')](respondWithResult(_0x3bccb6,null))[_0x1f4f('0x29')](handleError(_0x3bccb6,null));};exports[_0x1f4f('0x3d')]=function(_0x5ebcff,_0x31ed97){var _0x46694d={'raw':![],'where':{}};var _0x183f84={};var _0x43d8f9={'count':0x0,'rows':[]};return db[_0x1f4f('0x2c')][_0x1f4f('0x3e')]({'where':{'id':_0x5ebcff[_0x1f4f('0x38')]['id']}})['then'](handleEntityNotFound(_0x31ed97,null))[_0x1f4f('0x1c')](function(_0x1af883){if(_0x1af883){_0x183f84[_0x1f4f('0x2a')]=_[_0x1f4f('0x2b')](db[_0x1f4f('0x3b')][_0x1f4f('0x23')]);_0x183f84[_0x1f4f('0x2d')]=_[_0x1f4f('0x2b')](_0x5ebcff['query']);_0x183f84[_0x1f4f('0x3f')]=_[_0x1f4f('0x2e')](_0x183f84['model'],_0x183f84[_0x1f4f('0x2d')]);_0x46694d[_0x1f4f('0x30')]=_['intersection'](_0x183f84[_0x1f4f('0x2a')],qs['fields'](_0x5ebcff['query'][_0x1f4f('0x2f')]));_0x46694d[_0x1f4f('0x30')]=_0x46694d['attributes']['length']?_0x46694d[_0x1f4f('0x30')]:_0x183f84[_0x1f4f('0x2a')];if(!_0x5ebcff[_0x1f4f('0x2d')]['hasOwnProperty'](_0x1f4f('0x40'))){_0x46694d[_0x1f4f('0x19')]=qs['limit'](_0x5ebcff['query']['limit']);_0x46694d['offset']=qs[_0x1f4f('0x16')](_0x5ebcff[_0x1f4f('0x2d')][_0x1f4f('0x16')]);}_0x46694d['order']=qs[_0x1f4f('0x41')](_0x5ebcff[_0x1f4f('0x2d')][_0x1f4f('0x41')]);_0x46694d['where']=qs[_0x1f4f('0x3f')](_[_0x1f4f('0x42')](_0x5ebcff[_0x1f4f('0x2d')],_0x183f84[_0x1f4f('0x3f')]));_0x46694d[_0x1f4f('0x43')][_0x1f4f('0x44')]=_0x1af883['id'];if(_0x5ebcff[_0x1f4f('0x2d')][_0x1f4f('0x45')]){_0x46694d['where']=_[_0x1f4f('0x46')](_0x46694d['where'],{'$or':_[_0x1f4f('0x22')](_0x46694d['attributes'],function(_0x3cdc1f){var _0x26405e={};_0x26405e[_0x3cdc1f]={'$like':'%'+_0x5ebcff[_0x1f4f('0x2d')][_0x1f4f('0x45')]+'%'};return _0x26405e;})});}if(_0x5ebcff[_0x1f4f('0x2d')][_0x1f4f('0x47')]){var _0x5370e9=_0x5ebcff[_0x1f4f('0x2d')][_0x1f4f('0x47')][_0x1f4f('0x48')](',');var _0x3aa0ab={};_0x3aa0ab[_0x5370e9[0x0]]={'$gte':moment(_0x5370e9[0x1])[_0x1f4f('0x49')](_0x1f4f('0x4a'))};_0x46694d[_0x1f4f('0x43')]=_['merge'](_0x46694d['where'],_0x3aa0ab);}_0x46694d=_[_0x1f4f('0x46')]({},_0x46694d,_0x5ebcff[_0x1f4f('0x34')]);return db[_0x1f4f('0x3b')][_0x1f4f('0x18')]({'where':_0x46694d[_0x1f4f('0x43')]})[_0x1f4f('0x1c')](function(_0x359c18){_0x43d8f9[_0x1f4f('0x18')]=_0x359c18;if(_0x5ebcff['query'][_0x1f4f('0x32')]){_0x46694d[_0x1f4f('0x33')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x46694d);})[_0x1f4f('0x1c')](function(_0x188405){_0x43d8f9[_0x1f4f('0x4b')]=_0x188405;return _0x43d8f9;});}})[_0x1f4f('0x1c')](respondWithFilteredResult(_0x31ed97,_0x46694d))[_0x1f4f('0x29')](handleError(_0x31ed97,null));};exports[_0x1f4f('0x4c')]=function(_0x181dc8,_0x269913){return db[_0x1f4f('0x2c')]['find']({'where':{'id':_0x181dc8[_0x1f4f('0x38')]['id']}})['then'](handleEntityNotFound(_0x269913,null))[_0x1f4f('0x1c')](function(_0x6d4cf5){if(_0x6d4cf5){return _0x6d4cf5['setTags'](_0x181dc8['body'][_0x1f4f('0x3c')],_['omit'](_0x181dc8[_0x1f4f('0x37')],['ids','id'])||{})[_0x1f4f('0x4d')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1f4f('0x20'),_0x1f4f('0x4e')],'where':{'id':_0x181dc8[_0x1f4f('0x37')][_0x1f4f('0x3c')]}});})['then'](function(_0x52f5e2){socket['emit'](_0x1f4f('0x4f'),{'id':Number(_0x181dc8['params']['id']),'tags':_0x52f5e2||[]});return{'id':Number(_0x181dc8[_0x1f4f('0x38')]['id']),'tags':_0x52f5e2||[]};});}})['then'](respondWithResult(_0x269913,null))[_0x1f4f('0x29')](handleError(_0x269913,null));};exports[_0x1f4f('0x50')]=function(_0x56875d,_0x2f047a){return db[_0x1f4f('0x2c')][_0x1f4f('0x35')]({'where':{'id':_0x56875d[_0x1f4f('0x38')]['id']}})[_0x1f4f('0x1c')](handleEntityNotFound(_0x2f047a,null))['then'](function(_0x5812ba){if(_0x5812ba){return _0x5812ba[_0x1f4f('0x50')](_0x56875d['query'][_0x1f4f('0x3c')]);}})[_0x1f4f('0x1c')](respondWithStatusCode(_0x2f047a,null))[_0x1f4f('0x29')](handleError(_0x2f047a,null));};exports[_0x1f4f('0x51')]=function(_0x367dec,_0x49a9d0){var _0x112604=moment()['unix']()[_0x1f4f('0x52')]();var _0x5101a9=path[_0x1f4f('0x53')](config['root'],_0x1f4f('0x54'),_0x1f4f('0x55'),_0x1f4f('0x56'));var _0x15c208=path['join'](config[_0x1f4f('0x57')],_0x1f4f('0x54'),_0x1f4f('0x55'),'attachments');var _0x1c8d52=path['join'](_0x5101a9,_0x112604);var _0x502745=util[_0x1f4f('0x49')](_0x1f4f('0x58'),_0x367dec[_0x1f4f('0x38')]['id'],_0x112604);var _0x508c05=path[_0x1f4f('0x53')](_0x5101a9,_0x502745);var _0x116b13=[];_0x116b13['push']({'model':db[_0x1f4f('0x59')],'as':_0x1f4f('0x59'),'raw':!![]});var _0xd007d7=[{'model':db[_0x1f4f('0x3b')],'as':'Messages','attributes':['id',_0x1f4f('0x37'),_0x1f4f('0x5a')],'include':_0x116b13}];return db[_0x1f4f('0x2c')][_0x1f4f('0x35')]({'where':{'id':_0x367dec[_0x1f4f('0x38')]['id']},'include':_0xd007d7})[_0x1f4f('0x1c')](handleEntityNotFound(_0x49a9d0,null))['then'](function(_0xb1c62e){if(_0xb1c62e&&_0xb1c62e[_0x1f4f('0x5b')]){var _0x237a2b=_0xb1c62e[_0x1f4f('0x5c')]({'plain':!![]});fs[_0x1f4f('0x5d')](_0x1c8d52);for(var _0x5d41ec=0x0;_0x5d41ec<_0x237a2b[_0x1f4f('0x5b')][_0x1f4f('0x31')];_0x5d41ec++){var _0x367631=_0x237a2b[_0x1f4f('0x5b')][_0x5d41ec][_0x1f4f('0x59')];if(_0x367631){var _0x194cb1=path[_0x1f4f('0x53')](_0x15c208,_0x367631[_0x1f4f('0x5e')]);if(fs['existsSync'](_0x194cb1)){fs[_0x1f4f('0x5f')](_0x194cb1)['pipe'](fs[_0x1f4f('0x60')](path[_0x1f4f('0x53')](_0x1c8d52,_0x367631[_0x1f4f('0x5e')])));}}}return BPromise[_0x1f4f('0x61')]()[_0x1f4f('0x1c')](function(){return new BPromise(function(_0x43f005,_0x4df3a9){zipdir(_0x1c8d52,{'saveTo':_0x508c05},function(_0x59bfec,_0x366bf7){if(_0x59bfec)return _0x4df3a9(_0x59bfec);return _0x43f005(_0x366bf7);});})[_0x1f4f('0x1c')](function(){return new BPromise(function(_0x5b3b80,_0x47e0c7){rimraf(_0x1c8d52,function(_0xefdc4f){if(_0xefdc4f)_0x47e0c7(_0xefdc4f);return _0x5b3b80();});});})[_0x1f4f('0x1c')](function(){return _0x49a9d0[_0x1f4f('0x51')](_0x508c05,_0x502745,function(_0x4ca291){if(_0x4ca291){console['log'](_0x1f4f('0x62'),_0x4ca291);}else{fs[_0x1f4f('0x63')](_0x508c05);}});});});}else{return _0x49a9d0['sendStatus'](0xc8);}})[_0x1f4f('0x29')](handleError(_0x49a9d0,null));}; \ No newline at end of file +var _0xa25a=['unix','toString','server','files','join','root','attachments','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','log','err','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','merge','options','body','find','describe','FaxMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','order','sort','where','pick','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','addTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa25a,0x78));var _0xaa25=function(_0x103e39,_0x7db66){_0x103e39=_0x103e39-0x0;var _0x3e95c3=_0xa25a[_0x103e39];return _0x3e95c3;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xaa25('0x0'));var BPromise=require(_0xaa25('0x1'));var util=require(_0xaa25('0x2'));var path=require(_0xaa25('0x3'));var fs=require('fs');var _=require(_0xaa25('0x4'));var Redis=require(_0xaa25('0x5'));var interaction=require(_0xaa25('0x6'));var qs=require(_0xaa25('0x7'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xaa25('0x8'))['db'];config['redis']=_[_0xaa25('0x9')](config[_0xaa25('0xa')],{'host':_0xaa25('0xb'),'port':0x18eb});var socket=require(_0xaa25('0xc'))(new Redis(config[_0xaa25('0xa')]));require(_0xaa25('0xd'))[_0xaa25('0xe')](socket);function respondWithStatusCode(_0x4fdcea,_0x15e493){_0x15e493=_0x15e493||0xcc;return function(_0x5b7a8b){if(_0x5b7a8b){return _0x4fdcea[_0xaa25('0xf')](_0x15e493);}return _0x4fdcea[_0xaa25('0x10')](_0x15e493)[_0xaa25('0x11')]();};}function respondWithResult(_0x1cdd37,_0x570cb8){_0x570cb8=_0x570cb8||0xc8;return function(_0x48715f){if(_0x48715f){return _0x1cdd37['status'](_0x570cb8)['json'](_0x48715f);}};}function respondWithFilteredResult(_0x41f954,_0x37a64b){return function(_0x4b57c5){if(_0x4b57c5){var _0x4a9ce9=typeof _0x37a64b[_0xaa25('0x12')]==='undefined'&&typeof _0x37a64b[_0xaa25('0x13')]==='undefined';var _0x47bfa5=_0x4b57c5[_0xaa25('0x14')];var _0x595073=_0x4a9ce9?0x0:_0x37a64b[_0xaa25('0x12')];var _0xab3832=_0x4a9ce9?_0x4b57c5[_0xaa25('0x14')]:_0x37a64b[_0xaa25('0x12')]+_0x37a64b[_0xaa25('0x13')];var _0x1403fa;if(_0xab3832>=_0x47bfa5){_0xab3832=_0x47bfa5;_0x1403fa=0xc8;}else{_0x1403fa=0xce;}_0x41f954[_0xaa25('0x10')](_0x1403fa);return _0x41f954[_0xaa25('0x15')](_0xaa25('0x16'),_0x595073+'-'+_0xab3832+'/'+_0x47bfa5)['json'](_0x4b57c5);}return null;};}function saveUpdates(_0x24ec63){return function(_0x3321f8){if(_0x3321f8){return _0x3321f8[_0xaa25('0x17')](_0x24ec63)[_0xaa25('0x18')](function(_0x291093){return _0x291093;});}return null;};}function removeEntity(_0x1bfcd3){return function(_0x149764){if(_0x149764){return _0x149764[_0xaa25('0x19')]()[_0xaa25('0x18')](function(){_0x1bfcd3[_0xaa25('0x10')](0xcc)[_0xaa25('0x11')]();});}};}function handleEntityNotFound(_0xa3d644){return function(_0x2a2c60){if(!_0x2a2c60){_0xa3d644[_0xaa25('0xf')](0x194);}return _0x2a2c60;};}function handleError(_0x34f1d8,_0x41e0e3){_0x41e0e3=_0x41e0e3||0x1f4;return function(_0x273178){logger[_0xaa25('0x1a')](_0x273178[_0xaa25('0x1b')]);if(_0x273178['name']){delete _0x273178[_0xaa25('0x1c')];}_0x34f1d8['status'](_0x41e0e3)[_0xaa25('0x1d')](_0x273178);};}exports[_0xaa25('0x1e')]=function(_0x4d39cc,_0x345a0c){var _0x1fe7ca={};var _0x5ba5ee=_[_0xaa25('0x1f')](db[_0xaa25('0x20')][_0xaa25('0x21')],function(_0x419836){return{'name':_0x419836[_0xaa25('0x22')],'type':_0x419836['type'][_0xaa25('0x23')]};});_0x1fe7ca=qs[_0xaa25('0x24')](_0x5ba5ee,_0x4d39cc);return interaction[_0xaa25('0x25')]('fax',_0x4d39cc[_0xaa25('0x26')],_0x4d39cc[_0xaa25('0x27')],_0x1fe7ca,_0x5ba5ee)[_0xaa25('0x18')](respondWithFilteredResult(_0x345a0c,_0x1fe7ca))[_0xaa25('0x28')](handleError(_0x345a0c,null));};exports[_0xaa25('0x29')]=function(_0x22cab7,_0xc617d5){var _0x572207={'raw':![],'where':{'id':_0x22cab7[_0xaa25('0x2a')]['id']}},_0x4c88dd={};_0x4c88dd[_0xaa25('0x2b')]=_[_0xaa25('0x2c')](db['FaxInteraction']['rawAttributes']);_0x4c88dd['query']=_[_0xaa25('0x2c')](_0x22cab7[_0xaa25('0x26')]);_0x4c88dd[_0xaa25('0x2d')]=_[_0xaa25('0x2e')](_0x4c88dd[_0xaa25('0x2b')],_0x4c88dd[_0xaa25('0x26')]);_0x572207['attributes']=_[_0xaa25('0x2e')](_0x4c88dd['model'],qs[_0xaa25('0x2f')](_0x22cab7[_0xaa25('0x26')][_0xaa25('0x2f')]));_0x572207[_0xaa25('0x30')]=_0x572207[_0xaa25('0x30')][_0xaa25('0x31')]?_0x572207['attributes']:_0x4c88dd['model'];if(_0x22cab7['query']['includeAll']){_0x572207['include']=[{'all':!![]}];}_0x572207=_[_0xaa25('0x32')]({},_0x572207,_0x22cab7[_0xaa25('0x33')]);return db[_0xaa25('0x20')]['find'](_0x572207)[_0xaa25('0x18')](handleEntityNotFound(_0xc617d5,null))[_0xaa25('0x18')](respondWithResult(_0xc617d5,null))[_0xaa25('0x28')](handleError(_0xc617d5,null));};exports['create']=function(_0x41b1f4,_0x51c116){return db[_0xaa25('0x20')]['create'](_0x41b1f4[_0xaa25('0x34')],{})['then'](respondWithResult(_0x51c116,0xc9))[_0xaa25('0x28')](handleError(_0x51c116,null));};exports['update']=function(_0x3611a4,_0x5d7d68){if(_0x3611a4[_0xaa25('0x34')]['id']){delete _0x3611a4[_0xaa25('0x34')]['id'];}return db[_0xaa25('0x20')][_0xaa25('0x35')]({'where':{'id':_0x3611a4[_0xaa25('0x2a')]['id']}})[_0xaa25('0x18')](handleEntityNotFound(_0x5d7d68,null))[_0xaa25('0x18')](saveUpdates(_0x3611a4[_0xaa25('0x34')],null))[_0xaa25('0x18')](respondWithResult(_0x5d7d68,null))['catch'](handleError(_0x5d7d68,null));};exports[_0xaa25('0x19')]=function(_0x2d51be,_0x1fbca3){return db[_0xaa25('0x20')][_0xaa25('0x35')]({'where':{'id':_0x2d51be[_0xaa25('0x2a')]['id']}})[_0xaa25('0x18')](handleEntityNotFound(_0x1fbca3,null))[_0xaa25('0x18')](removeEntity(_0x1fbca3,null))[_0xaa25('0x28')](handleError(_0x1fbca3,null));};exports[_0xaa25('0x36')]=function(_0x39bdec,_0x57ce68){return db[_0xaa25('0x20')][_0xaa25('0x36')]()[_0xaa25('0x18')](respondWithResult(_0x57ce68,null))['catch'](handleError(_0x57ce68,null));};exports['addMessage']=function(_0x4d3fb9,_0x517b39){return db[_0xaa25('0x37')]['find']({'where':{'id':_0x4d3fb9[_0xaa25('0x2a')]['id']}})['then'](handleEntityNotFound(_0x517b39,null))['then'](function(_0x479a5e){if(_0x479a5e){return _0x479a5e[_0xaa25('0x38')](_0x4d3fb9[_0xaa25('0x34')]['ids'],_[_0xaa25('0x39')](_0x4d3fb9['body'],[_0xaa25('0x3a'),'id'])||{});}})[_0xaa25('0x18')](respondWithResult(_0x517b39,null))[_0xaa25('0x28')](handleError(_0x517b39,null));};exports[_0xaa25('0x3b')]=function(_0x1c09ef,_0x17cb98){var _0xeea9bb={'raw':![],'where':{}};var _0x2101c1={};var _0x57e641={'count':0x0,'rows':[]};return db[_0xaa25('0x20')][_0xaa25('0x3c')]({'where':{'id':_0x1c09ef[_0xaa25('0x2a')]['id']}})[_0xaa25('0x18')](handleEntityNotFound(_0x17cb98,null))['then'](function(_0x55a3bb){if(_0x55a3bb){_0x2101c1[_0xaa25('0x2b')]=_['keys'](db['FaxMessage'][_0xaa25('0x21')]);_0x2101c1[_0xaa25('0x26')]=_['keys'](_0x1c09ef[_0xaa25('0x26')]);_0x2101c1[_0xaa25('0x2d')]=_[_0xaa25('0x2e')](_0x2101c1['model'],_0x2101c1[_0xaa25('0x26')]);_0xeea9bb[_0xaa25('0x30')]=_['intersection'](_0x2101c1[_0xaa25('0x2b')],qs['fields'](_0x1c09ef[_0xaa25('0x26')][_0xaa25('0x2f')]));_0xeea9bb[_0xaa25('0x30')]=_0xeea9bb['attributes'][_0xaa25('0x31')]?_0xeea9bb[_0xaa25('0x30')]:_0x2101c1[_0xaa25('0x2b')];if(!_0x1c09ef[_0xaa25('0x26')][_0xaa25('0x3d')]('nolimit')){_0xeea9bb[_0xaa25('0x13')]=qs[_0xaa25('0x13')](_0x1c09ef[_0xaa25('0x26')]['limit']);_0xeea9bb[_0xaa25('0x12')]=qs['offset'](_0x1c09ef[_0xaa25('0x26')][_0xaa25('0x12')]);}_0xeea9bb[_0xaa25('0x3e')]=qs[_0xaa25('0x3f')](_0x1c09ef[_0xaa25('0x26')]['sort']);_0xeea9bb[_0xaa25('0x40')]=qs['filters'](_[_0xaa25('0x41')](_0x1c09ef[_0xaa25('0x26')],_0x2101c1[_0xaa25('0x2d')]));_0xeea9bb['where'][_0xaa25('0x42')]=_0x55a3bb['id'];if(_0x1c09ef[_0xaa25('0x26')]['filter']){_0xeea9bb[_0xaa25('0x40')]=_['merge'](_0xeea9bb[_0xaa25('0x40')],{'$or':_[_0xaa25('0x1f')](_0xeea9bb[_0xaa25('0x30')],function(_0x367e51){var _0x3f6bda={};_0x3f6bda[_0x367e51]={'$like':'%'+_0x1c09ef['query'][_0xaa25('0x43')]+'%'};return _0x3f6bda;})});}if(_0x1c09ef[_0xaa25('0x26')][_0xaa25('0x44')]){var _0x219db0=_0x1c09ef['query'][_0xaa25('0x44')]['split'](',');var _0x5e43e5={};_0x5e43e5[_0x219db0[0x0]]={'$gte':moment(_0x219db0[0x1])[_0xaa25('0x45')](_0xaa25('0x46'))};_0xeea9bb[_0xaa25('0x40')]=_[_0xaa25('0x32')](_0xeea9bb[_0xaa25('0x40')],_0x5e43e5);}_0xeea9bb=_[_0xaa25('0x32')]({},_0xeea9bb,_0x1c09ef[_0xaa25('0x33')]);return db[_0xaa25('0x37')][_0xaa25('0x14')]({'where':_0xeea9bb['where']})[_0xaa25('0x18')](function(_0x53f751){_0x57e641['count']=_0x53f751;if(_0x1c09ef[_0xaa25('0x26')][_0xaa25('0x47')]){_0xeea9bb[_0xaa25('0x48')]=[{'all':!![]}];}return db['FaxMessage'][_0xaa25('0x25')](_0xeea9bb);})['then'](function(_0xa92b41){_0x57e641[_0xaa25('0x49')]=_0xa92b41;return _0x57e641;});}})[_0xaa25('0x18')](respondWithFilteredResult(_0x17cb98,_0xeea9bb))[_0xaa25('0x28')](handleError(_0x17cb98,null));};exports[_0xaa25('0x4a')]=function(_0x3fa4cf,_0x233c31){return db[_0xaa25('0x20')][_0xaa25('0x35')]({'where':{'id':_0x3fa4cf[_0xaa25('0x2a')]['id']}})[_0xaa25('0x18')](handleEntityNotFound(_0x233c31,null))[_0xaa25('0x18')](function(_0x1da9a6){if(_0x1da9a6){return _0x1da9a6['setTags'](_0x3fa4cf[_0xaa25('0x34')]['ids'],_[_0xaa25('0x39')](_0x3fa4cf[_0xaa25('0x34')],[_0xaa25('0x3a'),'id'])||{})[_0xaa25('0x4b')](function(){return db[_0xaa25('0x4c')][_0xaa25('0x25')]({'attributes':['id',_0xaa25('0x1c'),_0xaa25('0x4d')],'where':{'id':_0x3fa4cf[_0xaa25('0x34')]['ids']}});})[_0xaa25('0x18')](function(_0x387bc2){socket[_0xaa25('0x4e')](_0xaa25('0x4f'),{'id':Number(_0x3fa4cf['params']['id']),'tags':_0x387bc2||[]});return{'id':Number(_0x3fa4cf[_0xaa25('0x2a')]['id']),'tags':_0x387bc2||[]};});}})['then'](respondWithResult(_0x233c31,null))[_0xaa25('0x28')](handleError(_0x233c31,null));};exports[_0xaa25('0x50')]=function(_0x5ed3b8,_0xf353c8){return db[_0xaa25('0x20')][_0xaa25('0x35')]({'where':{'id':_0x5ed3b8[_0xaa25('0x2a')]['id']}})[_0xaa25('0x18')](handleEntityNotFound(_0xf353c8,null))[_0xaa25('0x18')](function(_0x4f6755){if(_0x4f6755){return _0x4f6755[_0xaa25('0x50')](_0x5ed3b8[_0xaa25('0x26')]['ids']);}})[_0xaa25('0x18')](respondWithStatusCode(_0xf353c8,null))[_0xaa25('0x28')](handleError(_0xf353c8,null));};exports[_0xaa25('0x51')]=function(_0x594f51,_0x5a29d2){var _0x220ad6=moment()[_0xaa25('0x52')]()[_0xaa25('0x53')]();var _0x3c4063=path['join'](config['root'],_0xaa25('0x54'),_0xaa25('0x55'),'tmp');var _0x40330f=path[_0xaa25('0x56')](config[_0xaa25('0x57')],_0xaa25('0x54'),_0xaa25('0x55'),_0xaa25('0x58'));var _0x3afa92=path[_0xaa25('0x56')](_0x3c4063,_0x220ad6);var _0x12e705=util[_0xaa25('0x45')]('transcript-%d-%s.zip',_0x594f51[_0xaa25('0x2a')]['id'],_0x220ad6);var _0x48b6fa=path[_0xaa25('0x56')](_0x3c4063,_0x12e705);var _0x7690d2=[];_0x7690d2['push']({'model':db[_0xaa25('0x59')],'as':_0xaa25('0x59'),'raw':!![]});var _0x1485ab=[{'model':db[_0xaa25('0x37')],'as':_0xaa25('0x5a'),'attributes':['id','body',_0xaa25('0x5b')],'include':_0x7690d2}];return db[_0xaa25('0x20')][_0xaa25('0x35')]({'where':{'id':_0x594f51[_0xaa25('0x2a')]['id']},'include':_0x1485ab})[_0xaa25('0x18')](handleEntityNotFound(_0x5a29d2,null))['then'](function(_0x1788df){if(_0x1788df&&_0x1788df[_0xaa25('0x5a')]){var _0x13fe9a=_0x1788df[_0xaa25('0x5c')]({'plain':!![]});fs[_0xaa25('0x5d')](_0x3afa92);for(var _0x7849af=0x0;_0x7849af<_0x13fe9a[_0xaa25('0x5a')]['length'];_0x7849af++){var _0x5e97c9=_0x13fe9a[_0xaa25('0x5a')][_0x7849af][_0xaa25('0x59')];if(_0x5e97c9){var _0x48dfe4=path[_0xaa25('0x56')](_0x40330f,_0x5e97c9[_0xaa25('0x5e')]);if(fs['existsSync'](_0x48dfe4)){fs[_0xaa25('0x5f')](_0x48dfe4)[_0xaa25('0x60')](fs[_0xaa25('0x61')](path[_0xaa25('0x56')](_0x3afa92,_0x5e97c9['basename'])));}}}return BPromise[_0xaa25('0x62')]()[_0xaa25('0x18')](function(){return new BPromise(function(_0x51a5b0,_0x493613){zipdir(_0x3afa92,{'saveTo':_0x48b6fa},function(_0x1a841d,_0x4b21c5){if(_0x1a841d)return _0x493613(_0x1a841d);return _0x51a5b0(_0x4b21c5);});})['then'](function(){return new BPromise(function(_0x1ad411,_0x40fe42){rimraf(_0x3afa92,function(_0x14d89b){if(_0x14d89b)_0x40fe42(_0x14d89b);return _0x1ad411();});});})['then'](function(){return _0x5a29d2[_0xaa25('0x51')](_0x48b6fa,_0x12e705,function(_0x41dfc7){if(_0x41dfc7){console[_0xaa25('0x63')](_0xaa25('0x64'),_0x41dfc7);}else{fs['unlinkSync'](_0x48b6fa);}});});});}else{return _0x5a29d2[_0xaa25('0xf')](0xc8);}})['catch'](handleError(_0x5a29d2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7c2e890..1054d89 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 _0xd389=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','setDataValue','Users'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd389,0x107));var _0x9d38=function(_0x5aa640,_0x8b110e){_0x5aa640=_0x5aa640-0x0;var _0x11aebf=_0xd389[_0x5aa640];return _0x11aebf;};'use strict';var EventEmitter=require(_0x9d38('0x0'));var FaxInteraction=require(_0x9d38('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x9d38('0x1'))['db'][_0x9d38('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9d38('0x3')](0x0);var events={'afterCreate':_0x9d38('0x4'),'afterUpdate':_0x9d38('0x5'),'afterDestroy':_0x9d38('0x6')};function emitEvent(_0x10e5fc){return function(_0x33cc51,_0x6c881c,_0x1346c0){_0x33cc51['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x133063){_0x33cc51[_0x9d38('0x7')](_0x9d38('0x8'),_0x133063[_0x9d38('0x9')](function(_0x5598b8){return{'id':_0x5598b8['id']};}));return FaxMessage[_0x9d38('0xa')]({'where':{'FaxInteractionId':_0x33cc51['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xf6b152){_0x33cc51[_0x9d38('0x7')](_0x9d38('0xb'),_0xf6b152[_0x9d38('0xc')]);FaxInteractionEvents[_0x9d38('0xd')](_0x10e5fc+':'+_0x33cc51['id'],_0x33cc51);FaxInteractionEvents[_0x9d38('0xd')](_0x10e5fc,_0x33cc51);_0x1346c0(null);})[_0x9d38('0xe')](_0x1346c0(null));};}for(var e in events){if(events[_0x9d38('0xf')](e)){var event=events[e];FaxInteraction[_0x9d38('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x5ac7=['emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','save','then','setDataValue','map','findAll','unreadMessages'];(function(_0x2d5077,_0x2cd2af){var _0x4a582e=function(_0x291e82){while(--_0x291e82){_0x2d5077['push'](_0x2d5077['shift']());}};_0x4a582e(++_0x2cd2af);}(_0x5ac7,0xc6));var _0x75ac=function(_0x37030e,_0x228766){_0x37030e=_0x37030e-0x0;var _0x3fb2b2=_0x5ac7[_0x37030e];return _0x3fb2b2;};'use strict';var EventEmitter=require(_0x75ac('0x0'));var FaxInteraction=require(_0x75ac('0x1'))['db'][_0x75ac('0x2')];var FaxMessage=require(_0x75ac('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x75ac('0x3')](0x0);var events={'afterCreate':_0x75ac('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe5a332){return function(_0x1162b0,_0x407264,_0x2a647b){_0x1162b0['getUsers']({'attributes':['id'],'raw':!![]})[_0x75ac('0x5')](function(_0x5a775f){_0x1162b0[_0x75ac('0x6')]('Users',_0x5a775f[_0x75ac('0x7')](function(_0x441539){return{'id':_0x441539['id']};}));return FaxMessage[_0x75ac('0x8')]({'where':{'FaxInteractionId':_0x1162b0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x554e47){_0x1162b0['setDataValue'](_0x75ac('0x9'),_0x554e47['length']);FaxInteractionEvents['emit'](_0xe5a332+':'+_0x1162b0['id'],_0x1162b0);FaxInteractionEvents[_0x75ac('0xa')](_0xe5a332,_0x1162b0);_0x2a647b(null);})[_0x75ac('0xb')](_0x2a647b(null));};}for(var e in events){if(events[_0x75ac('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c90f46d..e7fb843 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 _0x2d18=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','changed'];(function(_0x262a6c,_0x24ed2d){var _0x4ce86a=function(_0x352258){while(--_0x352258){_0x262a6c['push'](_0x262a6c['shift']());}};_0x4ce86a(++_0x24ed2d);}(_0x2d18,0xd5));var _0x82d1=function(_0x2aa092,_0x321421){_0x2aa092=_0x2aa092-0x0;var _0x20dc3a=_0x2d18[_0x2aa092];return _0x20dc3a;};'use strict';var _=require(_0x82d1('0x0'));var util=require(_0x82d1('0x1'));var logger=require(_0x82d1('0x2'))(_0x82d1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x82d1('0x4'));var fs=require('fs');var path=require(_0x82d1('0x5'));var rimraf=require(_0x82d1('0x6'));var config=require(_0x82d1('0x7'));var attributes=require(_0x82d1('0x8'));module[_0x82d1('0x9')]=function(_0x32b9c8,_0x3e36a0){return _0x32b9c8[_0x82d1('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d5eca,_0x8fb9b2,_0x2e5191){if(_0x2d5eca[_0x82d1('0xb')](_0x82d1('0xc'))){_0x2d5eca['closedAt']=moment()[_0x82d1('0xd')](_0x82d1('0xe'));}_0x2e5191(null,_0x2d5eca);}}});}; \ No newline at end of file +var _0xae29=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0x48026e,_0x2bb295){var _0x4b42aa=function(_0x42c647){while(--_0x42c647){_0x48026e['push'](_0x48026e['shift']());}};_0x4b42aa(++_0x2bb295);}(_0xae29,0x147));var _0x9ae2=function(_0x549c25,_0x306e07){_0x549c25=_0x549c25-0x0;var _0x5ae518=_0xae29[_0x549c25];return _0x5ae518;};'use strict';var _=require(_0x9ae2('0x0'));var util=require(_0x9ae2('0x1'));var logger=require(_0x9ae2('0x2'))(_0x9ae2('0x3'));var moment=require(_0x9ae2('0x4'));var BPromise=require(_0x9ae2('0x5'));var rp=require(_0x9ae2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ae2('0x7'));var config=require(_0x9ae2('0x8'));var attributes=require(_0x9ae2('0x9'));module[_0x9ae2('0xa')]=function(_0x510b55,_0x56beaa){return _0x510b55[_0x9ae2('0xb')](_0x9ae2('0xc'),attributes,{'tableName':_0x9ae2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb602f2,_0x1fc927,_0x529858){if(_0xb602f2[_0x9ae2('0xe')](_0x9ae2('0xf'))){_0xb602f2['closedAt']=moment()[_0x9ae2('0x10')](_0x9ae2('0x11'));}_0x529858(null,_0xb602f2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3724081..a6de661 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 _0x2f1d=['addTags','ids','omit','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxInteraction.socket','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find'];(function(_0x1413c7,_0x338846){var _0x855596=function(_0x58a15a){while(--_0x58a15a){_0x1413c7['push'](_0x1413c7['shift']());}};_0x855596(++_0x338846);}(_0x2f1d,0x7c));var _0xd2f1=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x2f1d[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xd2f1('0x0'));var util=require(_0xd2f1('0x1'));var moment=require(_0xd2f1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2f1('0x3'));var db=require(_0xd2f1('0x4'))['db'];var utils=require(_0xd2f1('0x5'));var logger=require('../../config/logger')(_0xd2f1('0x6'));var config=require(_0xd2f1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2f1('0x8')][_0xd2f1('0x9')]({'port':0x232a});config[_0xd2f1('0xa')]=_[_0xd2f1('0xb')](config[_0xd2f1('0xa')],{'host':_0xd2f1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2f1('0xa')]));require(_0xd2f1('0xd'))['register'](socket);function respondWithRpcPromise(_0x135b57,_0x5ddbfc,_0x580645){return new BPromise(function(_0x9be4e8,_0x511d27){return client[_0xd2f1('0xe')](_0x135b57,_0x580645)[_0xd2f1('0xf')](function(_0x1784f1){logger[_0xd2f1('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x5ddbfc,_0xd2f1('0x11'));logger[_0xd2f1('0x12')](_0xd2f1('0x13'),_0x5ddbfc,'request\x20sent',JSON['stringify'](_0x1784f1));if(_0x1784f1['error']){if(_0x1784f1['error']['code']===0x1f4){logger[_0xd2f1('0x14')](_0xd2f1('0x15'),_0x5ddbfc,_0x1784f1[_0xd2f1('0x14')][_0xd2f1('0x16')]);return _0x511d27(_0x1784f1[_0xd2f1('0x14')]['message']);}logger[_0xd2f1('0x14')](_0xd2f1('0x15'),_0x5ddbfc,_0x1784f1[_0xd2f1('0x14')][_0xd2f1('0x16')]);return _0x9be4e8(_0x1784f1[_0xd2f1('0x14')][_0xd2f1('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5ddbfc,_0xd2f1('0x11'));_0x9be4e8(_0x1784f1[_0xd2f1('0x17')][_0xd2f1('0x16')]);}})[_0xd2f1('0x18')](function(_0x20c429){logger[_0xd2f1('0x14')](_0xd2f1('0x15'),_0x5ddbfc,_0x20c429);_0x511d27(_0x20c429);});});}exports['UpdateFaxInteraction']=function(_0xb27996){var _0x5c0c91=this;return new Promise(function(_0x48b55b,_0x9855d2){return db[_0xd2f1('0x19')][_0xd2f1('0x1a')](_0xb27996[_0xd2f1('0x1b')],{'raw':_0xb27996[_0xd2f1('0x1c')]?_0xb27996[_0xd2f1('0x1c')][_0xd2f1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb27996[_0xd2f1('0x1c')]?_0xb27996['options'][_0xd2f1('0x1e')]||null:null,'attributes':_0xb27996[_0xd2f1('0x1c')]?_0xb27996[_0xd2f1('0x1c')][_0xd2f1('0x1f')]||null:null,'limit':_0xb27996['options']?_0xb27996[_0xd2f1('0x1c')]['limit']||null:null})[_0xd2f1('0xf')](function(_0x4bc882){logger[_0xd2f1('0x10')](_0xd2f1('0x20'),_0xb27996);logger['debug'](_0xd2f1('0x20'),_0xb27996,JSON[_0xd2f1('0x21')](_0x4bc882));_0x48b55b(_0x4bc882);})[_0xd2f1('0x18')](function(_0x3fbca0){logger['error'](_0xd2f1('0x20'),_0x3fbca0[_0xd2f1('0x16')],_0xb27996);_0x9855d2(_0x5c0c91[_0xd2f1('0x14')](0x1f4,_0x3fbca0[_0xd2f1('0x16')]));});});};exports[_0xd2f1('0x22')]=function(_0x236fda){return new Promise(function(_0x2bc444,_0x1c2df0){return db[_0xd2f1('0x19')][_0xd2f1('0x23')]({'where':_0x236fda['options']?_0x236fda[_0xd2f1('0x1c')][_0xd2f1('0x1e')]||null:null})[_0xd2f1('0xf')](function(_0x1aef48){if(_0x1aef48){return _0x1aef48[_0xd2f1('0x24')](_0x236fda[_0xd2f1('0x1b')][_0xd2f1('0x25')],_[_0xd2f1('0x26')](_0x236fda[_0xd2f1('0x1b')],[_0xd2f1('0x25'),'id'])||{});}})['spread'](function(_0x112565){logger[_0xd2f1('0x10')]('AddTags',_0x236fda);logger[_0xd2f1('0x12')](_0xd2f1('0x27'),_0x236fda,JSON[_0xd2f1('0x21')](_0x112565));_0x2bc444(_0x112565);})['catch'](function(_0x36add9){logger[_0xd2f1('0x14')](_0xd2f1('0x27'),_0x36add9[_0xd2f1('0x16')],_0x236fda);_0x1c2df0(_this[_0xd2f1('0x14')](0x1f4,_0x36add9[_0xd2f1('0x16')]));});});}; \ No newline at end of file +var _0x935d=['util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','socket.io-emitter','redis','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxInteraction','body','options','where','limit','UpdateFaxInteraction','addTags','ids','omit','spread','AddTags','stringify','lodash'];(function(_0x30586b,_0x27653e){var _0x14483c=function(_0x5fa7c2){while(--_0x5fa7c2){_0x30586b['push'](_0x30586b['shift']());}};_0x14483c(++_0x27653e);}(_0x935d,0xb8));var _0xd935=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x935d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd935('0x0'));var util=require(_0xd935('0x1'));var moment=require('moment');var BPromise=require(_0xd935('0x2'));var rs=require(_0xd935('0x3'));var fs=require('fs');var Redis=require(_0xd935('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd935('0x5'));var logger=require('../../config/logger')(_0xd935('0x6'));var config=require(_0xd935('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd935('0x8')][_0xd935('0x9')]({'port':0x232a});config['redis']=_[_0xd935('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd935('0xb'))(new Redis(config[_0xd935('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2d98ca,_0x326aa8,_0x4676b2){return new BPromise(function(_0x2b3d1b,_0x4f2ae0){return client[_0xd935('0xd')](_0x2d98ca,_0x4676b2)[_0xd935('0xe')](function(_0x31650e){logger[_0xd935('0xf')](_0xd935('0x10'),_0x326aa8,_0xd935('0x11'));logger[_0xd935('0x12')](_0xd935('0x13'),_0x326aa8,_0xd935('0x11'),JSON['stringify'](_0x31650e));if(_0x31650e[_0xd935('0x14')]){if(_0x31650e['error'][_0xd935('0x15')]===0x1f4){logger['error'](_0xd935('0x10'),_0x326aa8,_0x31650e[_0xd935('0x14')][_0xd935('0x16')]);return _0x4f2ae0(_0x31650e[_0xd935('0x14')]['message']);}logger[_0xd935('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x326aa8,_0x31650e[_0xd935('0x14')][_0xd935('0x16')]);return _0x2b3d1b(_0x31650e[_0xd935('0x14')][_0xd935('0x16')]);}else{logger[_0xd935('0xf')](_0xd935('0x10'),_0x326aa8,_0xd935('0x11'));_0x2b3d1b(_0x31650e[_0xd935('0x17')][_0xd935('0x16')]);}})[_0xd935('0x18')](function(_0x4e545e){logger[_0xd935('0x14')](_0xd935('0x10'),_0x326aa8,_0x4e545e);_0x4f2ae0(_0x4e545e);});});}exports['UpdateFaxInteraction']=function(_0x4628d3){var _0x3bd9cc=this;return new Promise(function(_0x327aa0,_0x2f3092){return db[_0xd935('0x19')]['update'](_0x4628d3[_0xd935('0x1a')],{'raw':_0x4628d3['options']?_0x4628d3[_0xd935('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4628d3[_0xd935('0x1b')]?_0x4628d3['options'][_0xd935('0x1c')]||null:null,'attributes':_0x4628d3['options']?_0x4628d3[_0xd935('0x1b')]['attributes']||null:null,'limit':_0x4628d3[_0xd935('0x1b')]?_0x4628d3['options'][_0xd935('0x1d')]||null:null})[_0xd935('0xe')](function(_0x2ab0f8){logger[_0xd935('0xf')]('UpdateFaxInteraction',_0x4628d3);logger[_0xd935('0x12')]('UpdateFaxInteraction',_0x4628d3,JSON['stringify'](_0x2ab0f8));_0x327aa0(_0x2ab0f8);})[_0xd935('0x18')](function(_0x2c85b8){logger[_0xd935('0x14')](_0xd935('0x1e'),_0x2c85b8[_0xd935('0x16')],_0x4628d3);_0x2f3092(_0x3bd9cc['error'](0x1f4,_0x2c85b8['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x1cb11e){return new Promise(function(_0x3ed30e,_0x116d07){return db['FaxInteraction']['find']({'where':_0x1cb11e['options']?_0x1cb11e['options'][_0xd935('0x1c')]||null:null})[_0xd935('0xe')](function(_0x24c956){if(_0x24c956){return _0x24c956[_0xd935('0x1f')](_0x1cb11e[_0xd935('0x1a')][_0xd935('0x20')],_[_0xd935('0x21')](_0x1cb11e[_0xd935('0x1a')],[_0xd935('0x20'),'id'])||{});}})[_0xd935('0x22')](function(_0x2e8d5f){logger[_0xd935('0xf')](_0xd935('0x23'),_0x1cb11e);logger[_0xd935('0x12')]('AddTags',_0x1cb11e,JSON[_0xd935('0x24')](_0x2e8d5f));_0x3ed30e(_0x2e8d5f);})[_0xd935('0x18')](function(_0x525e29){logger[_0xd935('0x14')](_0xd935('0x23'),_0x525e29[_0xd935('0x16')],_0x1cb11e);_0x116d07(_this[_0xd935('0x14')](0x1f4,_0x525e29[_0xd935('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0df9a71..146916d 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 _0xaf64=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x27a3ac,_0xe952af){var _0x4a3f37=function(_0x382dc6){while(--_0x382dc6){_0x27a3ac['push'](_0x27a3ac['shift']());}};_0x4a3f37(++_0xe952af);}(_0xaf64,0x168));var _0x4af6=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0xaf64[_0x51b80a];return _0x22fdf0;};'use strict';var FaxInteractionEvents=require(_0x4af6('0x0'));var events=[_0x4af6('0x1'),_0x4af6('0x2'),_0x4af6('0x3')];function createListener(_0x434c89,_0x26807a){return function(_0x36fb9f){_0x26807a[_0x4af6('0x4')](_0x434c89,_0x36fb9f);};}function removeListener(_0x56a535,_0x36a2bf){return function(){FaxInteractionEvents[_0x4af6('0x5')](_0x56a535,_0x36a2bf);};}exports[_0x4af6('0x6')]=function(_0xfea959){for(var _0xce517c=0x0,_0x39b89e=events[_0x4af6('0x7')];_0xce517c<_0x39b89e;_0xce517c++){var _0x5663d0=events[_0xce517c];var _0xcbefb0=createListener('faxInteraction:'+_0x5663d0,_0xfea959);FaxInteractionEvents['on'](_0x5663d0,_0xcbefb0);}}; \ No newline at end of file +var _0x12a0=['length','faxInteraction:','save','emit','removeListener'];(function(_0x539d79,_0x4216f1){var _0x1c886f=function(_0x142e39){while(--_0x142e39){_0x539d79['push'](_0x539d79['shift']());}};_0x1c886f(++_0x4216f1);}(_0x12a0,0x19c));var _0x012a=function(_0x547f90,_0x3d0cb0){_0x547f90=_0x547f90-0x0;var _0x49b910=_0x12a0[_0x547f90];return _0x49b910;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x012a('0x0'),'remove','update'];function createListener(_0x267343,_0x7bfc33){return function(_0x23ae0d){_0x7bfc33[_0x012a('0x1')](_0x267343,_0x23ae0d);};}function removeListener(_0x1f32bc,_0x163601){return function(){FaxInteractionEvents[_0x012a('0x2')](_0x1f32bc,_0x163601);};}exports['register']=function(_0xa2f719){for(var _0x3b6a3f=0x0,_0x39c927=events[_0x012a('0x3')];_0x3b6a3f<_0x39c927;_0x3b6a3f++){var _0x27f127=events[_0x3b6a3f];var _0x33aa83=createListener(_0x012a('0x4')+_0x27f127,_0xa2f719);FaxInteractionEvents['on'](_0x27f127,_0x33aa83);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e95c0a6..77ad6b6 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 _0xd9ee=['faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','update'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xd9ee,0x1d3));var _0xed9e=function(_0x4d813b,_0x22dea3){_0x4d813b=_0x4d813b-0x0;var _0x4f6204=_0xd9ee[_0x4d813b];return _0x4f6204;};'use strict';var multer=require(_0xed9e('0x0'));var util=require(_0xed9e('0x1'));var path=require('path');var timeout=require(_0xed9e('0x2'));var express=require(_0xed9e('0x3'));var router=express[_0xed9e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed9e('0x5'));var controller=require(_0xed9e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xed9e('0x7')]);router[_0xed9e('0x8')](_0xed9e('0x9'),auth[_0xed9e('0xa')](),controller[_0xed9e('0xb')]);router[_0xed9e('0x8')](_0xed9e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xed9e('0x8')](_0xed9e('0xd'),auth[_0xed9e('0xa')](),controller[_0xed9e('0xe')]);router[_0xed9e('0x8')](_0xed9e('0xf'),auth[_0xed9e('0xa')](),controller[_0xed9e('0x10')]);router[_0xed9e('0x11')]('/',auth[_0xed9e('0xa')](),controller[_0xed9e('0x12')]);router[_0xed9e('0x11')]('/:id/messages',auth[_0xed9e('0xa')](),controller[_0xed9e('0x13')]);router[_0xed9e('0x11')](_0xed9e('0x14'),auth[_0xed9e('0xa')](),interaction['tracked']('fax',_0xed9e('0x15')),controller[_0xed9e('0x16')]);router[_0xed9e('0x17')](_0xed9e('0xc'),auth[_0xed9e('0xa')](),interaction[_0xed9e('0x18')](_0xed9e('0x19'),_0xed9e('0x1a')),controller[_0xed9e('0x1b')]);router['delete'](_0xed9e('0xc'),auth[_0xed9e('0xa')](),interaction[_0xed9e('0x18')](_0xed9e('0x19'),_0xed9e('0x1c')),controller[_0xed9e('0x1d')]);router[_0xed9e('0x1e')](_0xed9e('0x14'),auth[_0xed9e('0xa')](),controller[_0xed9e('0x1f')]);module[_0xed9e('0x20')]=router; \ No newline at end of file +var _0xd344=['download','create','post','/:id/tags','tracked','fax','addTags','put','/:id','faxinteraction:update','update','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download'];(function(_0x1ac002,_0x1f8b3d){var _0x5118d5=function(_0x5d7323){while(--_0x5d7323){_0x1ac002['push'](_0x1ac002['shift']());}};_0x5118d5(++_0x1f8b3d);}(_0xd344,0x104));var _0x4d34=function(_0x4acbef,_0x4754ca){_0x4acbef=_0x4acbef-0x0;var _0x44b38c=_0xd344[_0x4acbef];return _0x44b38c;};'use strict';var multer=require(_0x4d34('0x0'));var util=require(_0x4d34('0x1'));var path=require(_0x4d34('0x2'));var timeout=require(_0x4d34('0x3'));var express=require(_0x4d34('0x4'));var router=express[_0x4d34('0x5')]();var fs_extra=require(_0x4d34('0x6'));var auth=require(_0x4d34('0x7'));var interaction=require(_0x4d34('0x8'));var config=require(_0x4d34('0x9'));var controller=require(_0x4d34('0xa'));router[_0x4d34('0xb')]('/',auth[_0x4d34('0xc')](),controller[_0x4d34('0xd')]);router[_0x4d34('0xb')](_0x4d34('0xe'),auth['isAuthenticated'](),controller[_0x4d34('0xf')]);router[_0x4d34('0xb')]('/:id',auth[_0x4d34('0xc')](),controller[_0x4d34('0x10')]);router[_0x4d34('0xb')](_0x4d34('0x11'),auth[_0x4d34('0xc')](),controller[_0x4d34('0x12')]);router[_0x4d34('0xb')](_0x4d34('0x13'),auth[_0x4d34('0xc')](),controller[_0x4d34('0x14')]);router['post']('/',auth[_0x4d34('0xc')](),controller[_0x4d34('0x15')]);router[_0x4d34('0x16')](_0x4d34('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0x4d34('0x16')](_0x4d34('0x17'),auth['isAuthenticated'](),interaction[_0x4d34('0x18')](_0x4d34('0x19'),'faxinteraction:addtags'),controller[_0x4d34('0x1a')]);router[_0x4d34('0x1b')](_0x4d34('0x1c'),auth[_0x4d34('0xc')](),interaction['tracked'](_0x4d34('0x19'),_0x4d34('0x1d')),controller[_0x4d34('0x1e')]);router['delete'](_0x4d34('0x1c'),auth['isAuthenticated'](),interaction['tracked'](_0x4d34('0x19'),_0x4d34('0x1f')),controller[_0x4d34('0x20')]);router['delete'](_0x4d34('0x17'),auth[_0x4d34('0xc')](),controller[_0x4d34('0x21')]);module[_0x4d34('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f004a30..85e2463 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 _0xc112=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x5e0bfe,_0x971889){var _0x369dde=function(_0x5d4b7c){while(--_0x5d4b7c){_0x5e0bfe['push'](_0x5e0bfe['shift']());}};_0x369dde(++_0x971889);}(_0xc112,0xec));var _0x2c11=function(_0x2190f1,_0x39e05f){_0x2190f1=_0x2190f1-0x0;var _0x57b400=_0xc112[_0x2190f1];return _0x57b400;};'use strict';var Sequelize=require(_0x2c11('0x0'));module[_0x2c11('0x1')]={'body':{'type':Sequelize[_0x2c11('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2c11('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c11('0x4')]('in',_0x2c11('0x5')),'defaultValue':_0x2c11('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2c11('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2c11('0x6')]}}; \ No newline at end of file +var _0x4016=['DATE','exports','TEXT','out'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x4016,0x131));var _0x6401=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4016[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x6401('0x0')]={'body':{'type':Sequelize[_0x6401('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6401('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x6401('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6401('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3eff246..a0d5c3e 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 _0x1a8f=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','stack','send','index','map','FaxMessage','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','../../config/logger','fax-interactions','accept','fax','readAt','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','format','interaction','get','[FAXMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','SIP/%s','create','findOne','Attachment','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','redis','defaults','localhost','register','http','request','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus'];(function(_0xdc72ae,_0x84935d){var _0x512b60=function(_0x133f34){while(--_0x133f34){_0xdc72ae['push'](_0xdc72ae['shift']());}};_0x512b60(++_0x84935d);}(_0x1a8f,0xf1));var _0xf1a8=function(_0x2f5dad,_0x4313ad){_0x2f5dad=_0x2f5dad-0x0;var _0x38e02d=_0x1a8f[_0x2f5dad];return _0x38e02d;};'use strict';var emlformat=require(_0xf1a8('0x0'));var rimraf=require(_0xf1a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf1a8('0x2'));var moment=require('moment');var BPromise=require(_0xf1a8('0x3'));var Mustache=require(_0xf1a8('0x4'));var util=require('util');var path=require(_0xf1a8('0x5'));var sox=require('sox');var csv=require(_0xf1a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1a8('0x7'));var _=require(_0xf1a8('0x8'));var squel=require(_0xf1a8('0x9'));var crypto=require(_0xf1a8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf1a8('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf1a8('0xc'));var Papa=require('papaparse');var Redis=require(_0xf1a8('0xd'));var authService=require(_0xf1a8('0xe'));var qs=require(_0xf1a8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1a8('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf1a8('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf1a8('0x12')]=_[_0xf1a8('0x13')](config[_0xf1a8('0x12')],{'host':_0xf1a8('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0xf1a8('0x15')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf1a8('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xf1a8('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xf32d1,_0x3c79d2,_0xe9f5e1,_0x12bf9b){return new BPromise(function(_0x5e1d43,_0x11c9b5){var _0x4ffd84=_0x12bf9b||client;return _0x4ffd84[_0xf1a8('0x17')](_0xf32d1,_0xe9f5e1)[_0xf1a8('0x18')](function(_0xa2afc6){logger['info'](_0xf1a8('0x19'),_0x3c79d2,'request\x20sent');logger['debug'](_0xf1a8('0x1a'),_0x3c79d2,_0xf1a8('0x1b'),JSON['stringify'](_0xa2afc6));if(_0xa2afc6[_0xf1a8('0x1c')]){if(_0xa2afc6[_0xf1a8('0x1c')][_0xf1a8('0x1d')]===0x1f4){logger[_0xf1a8('0x1c')](_0xf1a8('0x19'),_0x3c79d2,_0xa2afc6[_0xf1a8('0x1c')][_0xf1a8('0x1e')]);return _0x11c9b5(_0xa2afc6['error']['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3c79d2,_0xa2afc6[_0xf1a8('0x1c')][_0xf1a8('0x1e')]);return _0x5e1d43(_0xa2afc6[_0xf1a8('0x1c')][_0xf1a8('0x1e')]);}else{logger[_0xf1a8('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x3c79d2,_0xf1a8('0x1b'));_0x5e1d43(_0xa2afc6[_0xf1a8('0x20')][_0xf1a8('0x1e')]);}})[_0xf1a8('0x21')](function(_0x28e544){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3c79d2,_0x28e544);_0x11c9b5(_0x28e544);});});}function respondWithStatusCode(_0x5e934b,_0x5e3853){_0x5e3853=_0x5e3853||0xcc;return function(_0x1c5368){if(_0x1c5368){return _0x5e934b[_0xf1a8('0x22')](_0x5e3853);}return _0x5e934b[_0xf1a8('0x23')](_0x5e3853)['end']();};}function respondWithResult(_0x2e2aee,_0x159fcf){_0x159fcf=_0x159fcf||0xc8;return function(_0x2f676c){if(_0x2f676c){return _0x2e2aee['status'](_0x159fcf)[_0xf1a8('0x24')](_0x2f676c);}};}function respondWithFilteredResult(_0x81604f,_0x269a18){return function(_0x27b257){if(_0x27b257){var _0x4b3918=typeof _0x269a18[_0xf1a8('0x25')]===_0xf1a8('0x26')&&typeof _0x269a18[_0xf1a8('0x27')]===_0xf1a8('0x26');var _0x36fc97=_0x27b257['count'];var _0x31676c=_0x4b3918?0x0:_0x269a18[_0xf1a8('0x25')];var _0x33a47b=_0x4b3918?_0x27b257[_0xf1a8('0x28')]:_0x269a18['offset']+_0x269a18[_0xf1a8('0x27')];var _0x31c75f;if(_0x33a47b>=_0x36fc97){_0x33a47b=_0x36fc97;_0x31c75f=0xc8;}else{_0x31c75f=0xce;}_0x81604f[_0xf1a8('0x23')](_0x31c75f);return _0x81604f[_0xf1a8('0x29')](_0xf1a8('0x2a'),_0x31676c+'-'+_0x33a47b+'/'+_0x36fc97)[_0xf1a8('0x24')](_0x27b257);}return null;};}function patchUpdates(_0x82b10b){return function(_0x1e5b11){try{jsonpatch[_0xf1a8('0x2b')](_0x1e5b11,_0x82b10b,!![]);}catch(_0x17e756){return BPromise[_0xf1a8('0x2c')](_0x17e756);}return _0x1e5b11['save']();};}function saveUpdates(_0x1e06aa,_0x2c9788){return function(_0x4a350c){if(_0x4a350c){return _0x4a350c[_0xf1a8('0x2d')](_0x1e06aa)[_0xf1a8('0x18')](function(_0x508cbb){return _0x508cbb;});}return null;};}function removeEntity(_0x484549,_0x101ffa){return function(_0x118bda){if(_0x118bda){return _0x118bda[_0xf1a8('0x2e')]()[_0xf1a8('0x18')](function(){_0x484549[_0xf1a8('0x23')](0xcc)[_0xf1a8('0x2f')]();});}};}function handleEntityNotFound(_0x4c1069,_0x2e3bd9){return function(_0x212745){if(!_0x212745){_0x4c1069[_0xf1a8('0x22')](0x194);}return _0x212745;};}function handleError(_0x12e635,_0x1bfc56){_0x1bfc56=_0x1bfc56||0x1f4;return function(_0x13c10a){logger[_0xf1a8('0x1c')](_0x13c10a[_0xf1a8('0x30')]);if(_0x13c10a['name']){delete _0x13c10a['name'];}_0x12e635[_0xf1a8('0x23')](_0x1bfc56)[_0xf1a8('0x31')](_0x13c10a);};}exports[_0xf1a8('0x32')]=function(_0x2f843e,_0x57ac20){var _0x221d68={},_0x544f16={},_0x5c1342={'count':0x0,'rows':[]};var _0x231bb9=_[_0xf1a8('0x33')](db[_0xf1a8('0x34')]['rawAttributes'],function(_0x4a9324){return{'name':_0x4a9324[_0xf1a8('0x35')],'type':_0x4a9324[_0xf1a8('0x36')]['key']};});_0x544f16[_0xf1a8('0x37')]=_[_0xf1a8('0x33')](_0x231bb9,_0xf1a8('0x38'));_0x544f16[_0xf1a8('0x39')]=_[_0xf1a8('0x3a')](_0x2f843e[_0xf1a8('0x39')]);_0x544f16[_0xf1a8('0x3b')]=_[_0xf1a8('0x3c')](_0x544f16[_0xf1a8('0x37')],_0x544f16[_0xf1a8('0x39')]);_0x221d68[_0xf1a8('0x3d')]=_[_0xf1a8('0x3c')](_0x544f16[_0xf1a8('0x37')],qs[_0xf1a8('0x3e')](_0x2f843e[_0xf1a8('0x39')]['fields']));_0x221d68[_0xf1a8('0x3d')]=_0x221d68['attributes'][_0xf1a8('0x3f')]?_0x221d68['attributes']:_0x544f16[_0xf1a8('0x37')];if(!_0x2f843e[_0xf1a8('0x39')][_0xf1a8('0x40')](_0xf1a8('0x41'))){_0x221d68[_0xf1a8('0x27')]=qs[_0xf1a8('0x27')](_0x2f843e[_0xf1a8('0x39')][_0xf1a8('0x27')]);_0x221d68[_0xf1a8('0x25')]=qs[_0xf1a8('0x25')](_0x2f843e[_0xf1a8('0x39')]['offset']);}_0x221d68[_0xf1a8('0x42')]=qs[_0xf1a8('0x43')](_0x2f843e[_0xf1a8('0x39')]['sort']);_0x221d68[_0xf1a8('0x44')]=qs['filters'](_['pick'](_0x2f843e[_0xf1a8('0x39')],_0x544f16[_0xf1a8('0x3b')]),_0x231bb9);if(_0x2f843e['query'][_0xf1a8('0x45')]){_0x221d68[_0xf1a8('0x44')]=_[_0xf1a8('0x46')](_0x221d68[_0xf1a8('0x44')],{'$or':_[_0xf1a8('0x33')](_0x231bb9,function(_0x3d3078){if(_0x3d3078[_0xf1a8('0x36')]!==_0xf1a8('0x47')){var _0x12cd93={};_0x12cd93[_0x3d3078[_0xf1a8('0x38')]]={'$like':'%'+_0x2f843e[_0xf1a8('0x39')][_0xf1a8('0x45')]+'%'};return _0x12cd93;}})});}_0x221d68=_[_0xf1a8('0x46')]({},_0x221d68,_0x2f843e[_0xf1a8('0x48')]);var _0x2e5547={'where':_0x221d68[_0xf1a8('0x44')]};return db[_0xf1a8('0x34')][_0xf1a8('0x28')](_0x2e5547)[_0xf1a8('0x18')](function(_0x27cc32){_0x5c1342[_0xf1a8('0x28')]=_0x27cc32;if(_0x2f843e['query'][_0xf1a8('0x49')]){_0x221d68[_0xf1a8('0x4a')]=[{'all':!![]}];}return db[_0xf1a8('0x34')][_0xf1a8('0x4b')](_0x221d68);})[_0xf1a8('0x18')](function(_0x18dc7c){_0x5c1342[_0xf1a8('0x4c')]=_0x18dc7c;return _0x5c1342;})[_0xf1a8('0x18')](respondWithFilteredResult(_0x57ac20,_0x221d68))[_0xf1a8('0x21')](handleError(_0x57ac20,null));};exports[_0xf1a8('0x4d')]=function(_0x26d4f6,_0x3c736b){var _0x2b0461={'raw':!![],'where':{'id':_0x26d4f6[_0xf1a8('0x4e')]['id']}},_0x403003={};_0x403003[_0xf1a8('0x37')]=_[_0xf1a8('0x3a')](db[_0xf1a8('0x34')][_0xf1a8('0x4f')]);_0x403003['query']=_[_0xf1a8('0x3a')](_0x26d4f6[_0xf1a8('0x39')]);_0x403003[_0xf1a8('0x3b')]=_[_0xf1a8('0x3c')](_0x403003[_0xf1a8('0x37')],_0x403003['query']);_0x2b0461[_0xf1a8('0x3d')]=_[_0xf1a8('0x3c')](_0x403003[_0xf1a8('0x37')],qs[_0xf1a8('0x3e')](_0x26d4f6[_0xf1a8('0x39')][_0xf1a8('0x3e')]));_0x2b0461[_0xf1a8('0x3d')]=_0x2b0461['attributes'][_0xf1a8('0x3f')]?_0x2b0461[_0xf1a8('0x3d')]:_0x403003['model'];if(_0x26d4f6[_0xf1a8('0x39')]['includeAll']){_0x2b0461['include']=[{'all':!![]}];}_0x2b0461=_[_0xf1a8('0x46')]({},_0x2b0461,_0x26d4f6['options']);return db[_0xf1a8('0x34')][_0xf1a8('0x50')](_0x2b0461)['then'](handleEntityNotFound(_0x3c736b,null))[_0xf1a8('0x18')](respondWithResult(_0x3c736b,null))[_0xf1a8('0x21')](handleError(_0x3c736b,null));};exports['update']=function(_0x417bed,_0x5d4806){if(_0x417bed[_0xf1a8('0x51')]['id']){delete _0x417bed[_0xf1a8('0x51')]['id'];}return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x417bed[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x18')](handleEntityNotFound(_0x5d4806,null))[_0xf1a8('0x18')](saveUpdates(_0x417bed[_0xf1a8('0x51')],null))[_0xf1a8('0x18')](respondWithResult(_0x5d4806,null))[_0xf1a8('0x21')](handleError(_0x5d4806,null));};exports['destroy']=function(_0x171dd3,_0x24b4c5){return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x171dd3[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x18')](handleEntityNotFound(_0x24b4c5,null))[_0xf1a8('0x18')](removeEntity(_0x24b4c5,null))[_0xf1a8('0x21')](handleError(_0x24b4c5,null));};exports[_0xf1a8('0x52')]=function(_0x310ff2,_0xb07d15){return db[_0xf1a8('0x34')][_0xf1a8('0x52')]()[_0xf1a8('0x18')](respondWithResult(_0xb07d15,null))['catch'](handleError(_0xb07d15,null));};var interaction_log=require(_0xf1a8('0x53'))(_0xf1a8('0x54'));exports[_0xf1a8('0x55')]=function(_0x37e134,_0x1bba5e,_0x427430){var _0x5a564d={'agent':{},'channel':_0xf1a8('0x56')};if(_0x37e134[_0xf1a8('0x51')]['id']){delete _0x37e134[_0xf1a8('0x51')]['id'];}_0x37e134['body']['read']=!![];_0x37e134[_0xf1a8('0x51')][_0xf1a8('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37e134['body'][_0xf1a8('0x58')]=_0x37e134[_0xf1a8('0x51')][_0xf1a8('0x58')]||_0x37e134[_0xf1a8('0x59')]['id'];_0x5a564d[_0xf1a8('0x5a')]['id']=_0x37e134[_0xf1a8('0x51')]['UserId'];return db[_0xf1a8('0x34')][_0xf1a8('0x50')]({'where':{'id':_0x37e134[_0xf1a8('0x4e')]['id'],'UserId':null}})[_0xf1a8('0x18')](handleEntityNotFound(_0x1bba5e,null))['then'](saveUpdates(_0x37e134[_0xf1a8('0x51')],null))[_0xf1a8('0x18')](function(_0x29da3e){if(_0x29da3e){_0x5a564d[_0xf1a8('0x1e')]=_0x29da3e['get']({'plain':!![]});return db[_0xf1a8('0x5b')]['find']({'where':{'id':_0x29da3e[_0xf1a8('0x5c')]}});}return null;})[_0xf1a8('0x18')](handleEntityNotFound(_0x1bba5e,null))[_0xf1a8('0x18')](function(_0x35f7bb){if(_0x35f7bb){return _0x35f7bb[_0xf1a8('0x2d')]({'UserId':_0x37e134[_0xf1a8('0x51')][_0xf1a8('0x58')],'read1stAt':_['isNil'](_0x35f7bb[_0xf1a8('0x5d')])?moment()[_0xf1a8('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf1a8('0x18')](function(_0x52dba8){if(_0x52dba8){_0x5a564d[_0xf1a8('0x5f')]=_0x52dba8[_0xf1a8('0x60')]({'plain':!![]});interaction_log[_0xf1a8('0x1f')](_0xf1a8('0x61'),_0x37e134[_0xf1a8('0x59')]['id'],_0x37e134[_0xf1a8('0x59')]['name'],_0x37e134[_0xf1a8('0x59')][_0xf1a8('0x62')],_0x5a564d[_0xf1a8('0x5f')]['id'],_0x37e134[_0xf1a8('0x51')]?JSON[_0xf1a8('0x63')](_0x37e134[_0xf1a8('0x51')]):_0xf1a8('0x64'));return respondWithRpcPromise(_0xf1a8('0x65'),_0xf1a8('0x66'),_0x5a564d);}return null;})['then'](function(_0xd9c16d){var _0x59daed=_0xf1a8('0x67')+_0xd9c16d[_0xf1a8('0x1e')][_0xf1a8('0x68')];return db[_0xf1a8('0x69')][_0xf1a8('0x39')](_0x59daed,{'type':db[_0xf1a8('0x6a')][_0xf1a8('0x6b')][_0xf1a8('0x6c')],'raw':!![]})[_0xf1a8('0x18')](function(_0x590355){return _0x590355;});})[_0xf1a8('0x18')](function(_0x13fe4c){if(_0x13fe4c){_0x5a564d[_0xf1a8('0x1e')][_0xf1a8('0x6d')]=_0x13fe4c[0x0];if(!_0x37e134['body'][_0xf1a8('0x58')])return;return db['User'][_0xf1a8('0x50')]({'where':{'id':_0x37e134['body'][_0xf1a8('0x58')],'role':_0xf1a8('0x5a')},'attributes':['id',_0xf1a8('0x38'),_0xf1a8('0x6e'),'email',_0xf1a8('0x6f')],'raw':!![]});}return null;})[_0xf1a8('0x18')](function(_0x22d78b){if(!_0x22d78b)return null;_0x5a564d[_0xf1a8('0x1e')][_0xf1a8('0x5a')]=_0x22d78b;return _0x5a564d;})[_0xf1a8('0x18')](function(_0x45da3c){if(_0x45da3c){if(_0x37e134[_0xf1a8('0x51')][_0xf1a8('0x70')]){_0x5a564d['message'][_0xf1a8('0x71')]=util[_0xf1a8('0x5e')]('SIP/%s',_0x37e134[_0xf1a8('0x59')][_0xf1a8('0x38')]);_0x5a564d[_0xf1a8('0x1e')][_0xf1a8('0x72')]=_0x5a564d['channel'];_0x5a564d['message'][_0xf1a8('0x73')]=_0x5a564d['channel'];_0x5a564d[_0xf1a8('0x1e')][_0xf1a8('0x74')]=_0xf1a8('0x55');return respondWithRpcPromise(_0xf1a8('0x75'),_0xf1a8('0x75'),{'event':'acceptmessage','message':_0x5a564d[_0xf1a8('0x1e')]},client9002)[_0xf1a8('0x18')](function(){return _0x5a564d;});}return _0x5a564d;}return null;})[_0xf1a8('0x18')](respondWithResult(_0x1bba5e,null))[_0xf1a8('0x21')](handleError(_0x1bba5e,null));};var interaction_log=require('../../config/logger')(_0xf1a8('0x54'));exports[_0xf1a8('0x2c')]=function(_0x5616d4,_0x4a369a,_0x508980){var _0x19f6f4={'agent':{},'channel':_0xf1a8('0x56')};if(_0x5616d4[_0xf1a8('0x51')]['id']){delete _0x5616d4['body']['id'];}_0x5616d4[_0xf1a8('0x51')][_0xf1a8('0x58')]=_0x5616d4[_0xf1a8('0x51')]['UserId']||_0x5616d4[_0xf1a8('0x59')]['id'];_0x19f6f4['agent']['id']=_0x5616d4['body'][_0xf1a8('0x58')];return db['FaxMessage']['find']({'where':{'id':_0x5616d4['params']['id'],'UserId':null}})[_0xf1a8('0x18')](handleEntityNotFound(_0x4a369a,null))[_0xf1a8('0x18')](function(_0x4289f3){if(_0x4289f3){_0x19f6f4[_0xf1a8('0x1e')]=_0x4289f3[_0xf1a8('0x60')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4289f3['FaxInteractionId']}});}return null;})[_0xf1a8('0x18')](handleEntityNotFound(_0x4a369a,null))[_0xf1a8('0x18')](function(_0x390fe0){if(_0x390fe0){_0x19f6f4[_0xf1a8('0x5f')]=_0x390fe0[_0xf1a8('0x60')]({'plain':!![]});interaction_log[_0xf1a8('0x1f')](_0xf1a8('0x76'),_0x5616d4[_0xf1a8('0x59')]['id'],_0x5616d4[_0xf1a8('0x59')][_0xf1a8('0x38')],_0x5616d4['user']['role'],_0x19f6f4[_0xf1a8('0x5f')]['id'],_0x5616d4[_0xf1a8('0x51')]?JSON[_0xf1a8('0x63')](_0x5616d4[_0xf1a8('0x51')]):'null');return respondWithRpcPromise(_0xf1a8('0x77'),_0xf1a8('0x78'),_0x19f6f4);}return null;})[_0xf1a8('0x18')](function(_0x5a544f){var _0x223fd0=_0xf1a8('0x67')+_0x5a544f[_0xf1a8('0x1e')][_0xf1a8('0x68')];return db[_0xf1a8('0x69')][_0xf1a8('0x39')](_0x223fd0,{'type':db[_0xf1a8('0x6a')][_0xf1a8('0x6b')]['SELECT'],'raw':!![]})[_0xf1a8('0x18')](function(_0xaf4bf1){return _0xaf4bf1;});})[_0xf1a8('0x18')](function(_0x1c6d45){if(_0x1c6d45){_0x19f6f4[_0xf1a8('0x1e')][_0xf1a8('0x6d')]=_0x1c6d45[0x0];if(!_0x5616d4['body'][_0xf1a8('0x58')])return;return db[_0xf1a8('0x79')][_0xf1a8('0x50')]({'where':{'id':_0x5616d4['body'][_0xf1a8('0x58')],'role':'agent'},'attributes':['id',_0xf1a8('0x38'),_0xf1a8('0x6e'),'email',_0xf1a8('0x6f')],'raw':!![]});}return null;})['then'](function(_0x589170){if(!_0x589170)return null;_0x19f6f4['message'][_0xf1a8('0x5a')]=_0x589170;return _0x19f6f4;})[_0xf1a8('0x18')](function(_0x13d2f2){if(_0x13d2f2){_0x13d2f2[_0xf1a8('0x1e')][_0xf1a8('0x71')]=util[_0xf1a8('0x5e')](_0xf1a8('0x7a'),_0x5616d4[_0xf1a8('0x59')][_0xf1a8('0x38')]);_0x13d2f2['message'][_0xf1a8('0x72')]=_0x19f6f4[_0xf1a8('0x72')];_0x13d2f2[_0xf1a8('0x1e')]['motionChannel']=_0x19f6f4['channel'];_0x13d2f2[_0xf1a8('0x1e')][_0xf1a8('0x74')]=_0xf1a8('0x2c');respondWithRpcPromise(_0xf1a8('0x75'),_0xf1a8('0x75'),{'event':'rejectmessage','message':_0x13d2f2['message']},client9002);return _0x19f6f4;}return null;})[_0xf1a8('0x18')](respondWithResult(_0x4a369a,null))[_0xf1a8('0x21')](handleError(_0x4a369a,null));};exports[_0xf1a8('0x7b')]=function(_0x2ed13a,_0x5d13d5){var _0x111330;return db[_0xf1a8('0x34')][_0xf1a8('0x7b')](_0x2ed13a[_0xf1a8('0x51')],{})[_0xf1a8('0x18')](function(_0x1511fb){_0x111330=_0x1511fb;return db['CmContact'][_0xf1a8('0x7c')]({'where':{'id':_0x111330[_0xf1a8('0x68')]}});})[_0xf1a8('0x18')](function(_0x168cc5){if(_['isNil'](_0x168cc5)){return;}else{_0x111330['fax']=_0x168cc5[_0xf1a8('0x56')];return db[_0xf1a8('0x7d')]['findOne']({'where':{'id':_0x111330[_0xf1a8('0x7e')]}});}})[_0xf1a8('0x18')](function(_0x21eba6){return respondWithRpcPromise(_0xf1a8('0x7f'),'SendFax',{'FaxAccountId':_[_0xf1a8('0x80')](_0x2ed13a[_0xf1a8('0x51')])?undefined:_0x2ed13a[_0xf1a8('0x51')][_0xf1a8('0x81')],'path':_['isNil'](_0x21eba6)?undefined:util[_0xf1a8('0x5e')](_0xf1a8('0x82'),_0x21eba6['basename']),'fax':_[_0xf1a8('0x80')](_0x111330[_0xf1a8('0x56')])?undefined:_0x111330[_0xf1a8('0x56')],'AttachmentId':_0x111330[_0xf1a8('0x7e')]},client9002);})[_0xf1a8('0x18')](respondWithResult(_0x5d13d5,0xc9))[_0xf1a8('0x21')](handleError(_0x5d13d5,null));};exports[_0xf1a8('0x83')]=function(_0x51a90c,_0x9f8c20){var _0x5c1746=path[_0xf1a8('0x84')](config[_0xf1a8('0x85')],_0xf1a8('0x86'),_0xf1a8('0x87'),_0xf1a8('0x88'));return db['FaxMessage'][_0xf1a8('0x50')]({'where':{'id':_0x51a90c['params']['id']},'include':[{'model':db['Attachment'],'as':_0xf1a8('0x7d')}]})['then'](handleEntityNotFound(_0x9f8c20,null))[_0xf1a8('0x18')](function(_0x4ab526){if(_0x4ab526){return _0x9f8c20[_0xf1a8('0x83')](path['join'](_0x5c1746,_0x4ab526['Attachment'][_0xf1a8('0x89')]));}})[_0xf1a8('0x21')](handleError(_0x9f8c20,null));}; \ No newline at end of file +var _0x9db3=['moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','stack','name','send','index','FaxMessage','rawAttributes','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','includeAll','findAll','rows','show','params','fields','length','include','merge','options','body','find','describe','../../config/logger','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','SIP/%s','EventManager','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','files','eml-format','request-promise'];(function(_0x59dff6,_0x722127){var _0x5dbabc=function(_0x14fc28){while(--_0x14fc28){_0x59dff6['push'](_0x59dff6['shift']());}};_0x5dbabc(++_0x722127);}(_0x9db3,0x1a8));var _0x39db=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9db3[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x39db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39db('0x1'));var moment=require(_0x39db('0x2'));var BPromise=require(_0x39db('0x3'));var Mustache=require(_0x39db('0x4'));var util=require(_0x39db('0x5'));var path=require(_0x39db('0x6'));var sox=require(_0x39db('0x7'));var csv=require(_0x39db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x39db('0x9'));var crypto=require(_0x39db('0xa'));var jsforce=require(_0x39db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x39db('0x8'));var querystring=require(_0x39db('0xc'));var Papa=require(_0x39db('0xd'));var Redis=require(_0x39db('0xe'));var authService=require(_0x39db('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39db('0x10'));var logger=require('../../config/logger')(_0x39db('0x11'));var utils=require(_0x39db('0x12'));var config=require(_0x39db('0x13'));var licenseUtil=require(_0x39db('0x14'));var db=require(_0x39db('0x15'))['db'];config[_0x39db('0x16')]=_[_0x39db('0x17')](config[_0x39db('0x16')],{'host':_0x39db('0x18'),'port':0x18eb});var socket=require(_0x39db('0x19'))(new Redis(config[_0x39db('0x16')]));require('./faxMessage.socket')[_0x39db('0x1a')](socket);var jayson=require(_0x39db('0x1b'));var client=jayson[_0x39db('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x39db('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe73864,_0x3673d1,_0x1b7e91,_0x5c16bc){return new BPromise(function(_0x59e82d,_0x597198){var _0x1d607e=_0x5c16bc||client;return _0x1d607e[_0x39db('0x1d')](_0xe73864,_0x1b7e91)[_0x39db('0x1e')](function(_0x574b44){logger[_0x39db('0x1f')](_0x39db('0x20'),_0x3673d1,'request\x20sent');logger[_0x39db('0x21')](_0x39db('0x22'),_0x3673d1,'request\x20sent',JSON[_0x39db('0x23')](_0x574b44));if(_0x574b44['error']){if(_0x574b44[_0x39db('0x24')][_0x39db('0x25')]===0x1f4){logger[_0x39db('0x24')](_0x39db('0x20'),_0x3673d1,_0x574b44[_0x39db('0x24')][_0x39db('0x26')]);return _0x597198(_0x574b44['error']['message']);}logger[_0x39db('0x24')](_0x39db('0x20'),_0x3673d1,_0x574b44['error'][_0x39db('0x26')]);return _0x59e82d(_0x574b44['error'][_0x39db('0x26')]);}else{logger[_0x39db('0x1f')](_0x39db('0x20'),_0x3673d1,_0x39db('0x27'));_0x59e82d(_0x574b44['result'][_0x39db('0x26')]);}})[_0x39db('0x28')](function(_0x398f16){logger[_0x39db('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3673d1,_0x398f16);_0x597198(_0x398f16);});});}function respondWithStatusCode(_0x28d4a1,_0x24261d){_0x24261d=_0x24261d||0xcc;return function(_0xaf5952){if(_0xaf5952){return _0x28d4a1[_0x39db('0x29')](_0x24261d);}return _0x28d4a1[_0x39db('0x2a')](_0x24261d)['end']();};}function respondWithResult(_0x3bf766,_0x7c3b05){_0x7c3b05=_0x7c3b05||0xc8;return function(_0x1e78db){if(_0x1e78db){return _0x3bf766[_0x39db('0x2a')](_0x7c3b05)['json'](_0x1e78db);}};}function respondWithFilteredResult(_0x2f51b0,_0x8b34c3){return function(_0x33fa42){if(_0x33fa42){var _0x5edfb1=typeof _0x8b34c3[_0x39db('0x2b')]===_0x39db('0x2c')&&typeof _0x8b34c3[_0x39db('0x2d')]==='undefined';var _0x391321=_0x33fa42[_0x39db('0x2e')];var _0x293ac1=_0x5edfb1?0x0:_0x8b34c3[_0x39db('0x2b')];var _0x3b6a07=_0x5edfb1?_0x33fa42['count']:_0x8b34c3[_0x39db('0x2b')]+_0x8b34c3[_0x39db('0x2d')];var _0x5a7a25;if(_0x3b6a07>=_0x391321){_0x3b6a07=_0x391321;_0x5a7a25=0xc8;}else{_0x5a7a25=0xce;}_0x2f51b0['status'](_0x5a7a25);return _0x2f51b0[_0x39db('0x2f')]('Content-Range',_0x293ac1+'-'+_0x3b6a07+'/'+_0x391321)['json'](_0x33fa42);}return null;};}function patchUpdates(_0x69cd15){return function(_0x469863){try{jsonpatch[_0x39db('0x30')](_0x469863,_0x69cd15,!![]);}catch(_0xd88315){return BPromise[_0x39db('0x31')](_0xd88315);}return _0x469863[_0x39db('0x32')]();};}function saveUpdates(_0x50d316,_0x164f10){return function(_0x1b0bc2){if(_0x1b0bc2){return _0x1b0bc2[_0x39db('0x33')](_0x50d316)[_0x39db('0x1e')](function(_0x1e7596){return _0x1e7596;});}return null;};}function removeEntity(_0x3f12bc,_0x3b6b9b){return function(_0x42186e){if(_0x42186e){return _0x42186e[_0x39db('0x34')]()[_0x39db('0x1e')](function(){_0x3f12bc[_0x39db('0x2a')](0xcc)[_0x39db('0x35')]();});}};}function handleEntityNotFound(_0x39bcbc,_0x5527e8){return function(_0xbd33bc){if(!_0xbd33bc){_0x39bcbc[_0x39db('0x29')](0x194);}return _0xbd33bc;};}function handleError(_0xdfb6c6,_0xebd205){_0xebd205=_0xebd205||0x1f4;return function(_0x43fb48){logger['error'](_0x43fb48[_0x39db('0x36')]);if(_0x43fb48[_0x39db('0x37')]){delete _0x43fb48['name'];}_0xdfb6c6[_0x39db('0x2a')](_0xebd205)[_0x39db('0x38')](_0x43fb48);};}exports[_0x39db('0x39')]=function(_0x590df2,_0xc90862){var _0x3f6829={},_0x1294e8={},_0x48c738={'count':0x0,'rows':[]};var _0x810c13=_['map'](db[_0x39db('0x3a')][_0x39db('0x3b')],function(_0x37a7ad){return{'name':_0x37a7ad['fieldName'],'type':_0x37a7ad['type'][_0x39db('0x3c')]};});_0x1294e8[_0x39db('0x3d')]=_[_0x39db('0x3e')](_0x810c13,_0x39db('0x37'));_0x1294e8[_0x39db('0x3f')]=_[_0x39db('0x40')](_0x590df2[_0x39db('0x3f')]);_0x1294e8['filters']=_[_0x39db('0x41')](_0x1294e8[_0x39db('0x3d')],_0x1294e8[_0x39db('0x3f')]);_0x3f6829['attributes']=_['intersection'](_0x1294e8[_0x39db('0x3d')],qs['fields'](_0x590df2[_0x39db('0x3f')]['fields']));_0x3f6829[_0x39db('0x42')]=_0x3f6829['attributes']['length']?_0x3f6829[_0x39db('0x42')]:_0x1294e8[_0x39db('0x3d')];if(!_0x590df2[_0x39db('0x3f')][_0x39db('0x43')](_0x39db('0x44'))){_0x3f6829[_0x39db('0x2d')]=qs['limit'](_0x590df2['query'][_0x39db('0x2d')]);_0x3f6829[_0x39db('0x2b')]=qs[_0x39db('0x2b')](_0x590df2[_0x39db('0x3f')][_0x39db('0x2b')]);}_0x3f6829['order']=qs[_0x39db('0x45')](_0x590df2[_0x39db('0x3f')][_0x39db('0x45')]);_0x3f6829[_0x39db('0x46')]=qs[_0x39db('0x47')](_[_0x39db('0x48')](_0x590df2[_0x39db('0x3f')],_0x1294e8[_0x39db('0x47')]),_0x810c13);if(_0x590df2[_0x39db('0x3f')][_0x39db('0x49')]){_0x3f6829[_0x39db('0x46')]=_['merge'](_0x3f6829[_0x39db('0x46')],{'$or':_[_0x39db('0x3e')](_0x810c13,function(_0x42151b){if(_0x42151b[_0x39db('0x4a')]!=='VIRTUAL'){var _0x126eb9={};_0x126eb9[_0x42151b[_0x39db('0x37')]]={'$like':'%'+_0x590df2[_0x39db('0x3f')][_0x39db('0x49')]+'%'};return _0x126eb9;}})});}_0x3f6829=_['merge']({},_0x3f6829,_0x590df2['options']);var _0x1b581b={'where':_0x3f6829[_0x39db('0x46')]};return db['FaxMessage']['count'](_0x1b581b)['then'](function(_0x4ccbfc){_0x48c738[_0x39db('0x2e')]=_0x4ccbfc;if(_0x590df2[_0x39db('0x3f')][_0x39db('0x4b')]){_0x3f6829['include']=[{'all':!![]}];}return db['FaxMessage'][_0x39db('0x4c')](_0x3f6829);})['then'](function(_0x4ca1d1){_0x48c738[_0x39db('0x4d')]=_0x4ca1d1;return _0x48c738;})[_0x39db('0x1e')](respondWithFilteredResult(_0xc90862,_0x3f6829))[_0x39db('0x28')](handleError(_0xc90862,null));};exports[_0x39db('0x4e')]=function(_0x5678f3,_0x2575c6){var _0x27cd97={'raw':!![],'where':{'id':_0x5678f3[_0x39db('0x4f')]['id']}},_0x3647c2={};_0x3647c2[_0x39db('0x3d')]=_[_0x39db('0x40')](db[_0x39db('0x3a')][_0x39db('0x3b')]);_0x3647c2[_0x39db('0x3f')]=_[_0x39db('0x40')](_0x5678f3[_0x39db('0x3f')]);_0x3647c2[_0x39db('0x47')]=_['intersection'](_0x3647c2[_0x39db('0x3d')],_0x3647c2[_0x39db('0x3f')]);_0x27cd97[_0x39db('0x42')]=_[_0x39db('0x41')](_0x3647c2[_0x39db('0x3d')],qs[_0x39db('0x50')](_0x5678f3['query']['fields']));_0x27cd97[_0x39db('0x42')]=_0x27cd97[_0x39db('0x42')][_0x39db('0x51')]?_0x27cd97[_0x39db('0x42')]:_0x3647c2[_0x39db('0x3d')];if(_0x5678f3[_0x39db('0x3f')][_0x39db('0x4b')]){_0x27cd97[_0x39db('0x52')]=[{'all':!![]}];}_0x27cd97=_[_0x39db('0x53')]({},_0x27cd97,_0x5678f3[_0x39db('0x54')]);return db[_0x39db('0x3a')]['find'](_0x27cd97)[_0x39db('0x1e')](handleEntityNotFound(_0x2575c6,null))[_0x39db('0x1e')](respondWithResult(_0x2575c6,null))[_0x39db('0x28')](handleError(_0x2575c6,null));};exports[_0x39db('0x33')]=function(_0x52fb7a,_0x1a749d){if(_0x52fb7a['body']['id']){delete _0x52fb7a[_0x39db('0x55')]['id'];}return db['FaxMessage'][_0x39db('0x56')]({'where':{'id':_0x52fb7a[_0x39db('0x4f')]['id']}})[_0x39db('0x1e')](handleEntityNotFound(_0x1a749d,null))['then'](saveUpdates(_0x52fb7a[_0x39db('0x55')],null))[_0x39db('0x1e')](respondWithResult(_0x1a749d,null))[_0x39db('0x28')](handleError(_0x1a749d,null));};exports[_0x39db('0x34')]=function(_0x4fe4b0,_0x3e3041){return db[_0x39db('0x3a')][_0x39db('0x56')]({'where':{'id':_0x4fe4b0[_0x39db('0x4f')]['id']}})[_0x39db('0x1e')](handleEntityNotFound(_0x3e3041,null))['then'](removeEntity(_0x3e3041,null))[_0x39db('0x28')](handleError(_0x3e3041,null));};exports[_0x39db('0x57')]=function(_0x3b4fb3,_0x2940d1){return db[_0x39db('0x3a')][_0x39db('0x57')]()[_0x39db('0x1e')](respondWithResult(_0x2940d1,null))[_0x39db('0x28')](handleError(_0x2940d1,null));};var interaction_log=require(_0x39db('0x58'))(_0x39db('0x59'));exports[_0x39db('0x5a')]=function(_0xe2e9ed,_0x3d3f4b,_0x4a351e){var _0x29e14f={'agent':{},'channel':'fax'};if(_0xe2e9ed[_0x39db('0x55')]['id']){delete _0xe2e9ed['body']['id'];}_0xe2e9ed[_0x39db('0x55')][_0x39db('0x5b')]=!![];_0xe2e9ed[_0x39db('0x55')][_0x39db('0x5c')]=moment()[_0x39db('0x5d')](_0x39db('0x5e'));_0xe2e9ed[_0x39db('0x55')]['UserId']=_0xe2e9ed['body']['UserId']||_0xe2e9ed[_0x39db('0x5f')]['id'];_0x29e14f[_0x39db('0x60')]['id']=_0xe2e9ed[_0x39db('0x55')][_0x39db('0x61')];return db[_0x39db('0x3a')][_0x39db('0x56')]({'where':{'id':_0xe2e9ed[_0x39db('0x4f')]['id'],'UserId':null}})[_0x39db('0x1e')](handleEntityNotFound(_0x3d3f4b,null))[_0x39db('0x1e')](saveUpdates(_0xe2e9ed['body'],null))[_0x39db('0x1e')](function(_0x58c4d5){if(_0x58c4d5){_0x29e14f['message']=_0x58c4d5[_0x39db('0x62')]({'plain':!![]});return db[_0x39db('0x63')][_0x39db('0x56')]({'where':{'id':_0x58c4d5[_0x39db('0x64')]}});}return null;})[_0x39db('0x1e')](handleEntityNotFound(_0x3d3f4b,null))[_0x39db('0x1e')](function(_0x1a8b25){if(_0x1a8b25){return _0x1a8b25[_0x39db('0x33')]({'UserId':_0xe2e9ed[_0x39db('0x55')][_0x39db('0x61')],'read1stAt':_[_0x39db('0x65')](_0x1a8b25[_0x39db('0x66')])?moment()[_0x39db('0x5d')](_0x39db('0x5e')):undefined});}return null;})[_0x39db('0x1e')](function(_0x5495be){if(_0x5495be){_0x29e14f[_0x39db('0x67')]=_0x5495be[_0x39db('0x62')]({'plain':!![]});interaction_log[_0x39db('0x1f')](_0x39db('0x68'),_0xe2e9ed[_0x39db('0x5f')]['id'],_0xe2e9ed['user'][_0x39db('0x37')],_0xe2e9ed[_0x39db('0x5f')][_0x39db('0x69')],_0x29e14f[_0x39db('0x67')]['id'],_0xe2e9ed['body']?JSON[_0x39db('0x23')](_0xe2e9ed['body']):_0x39db('0x6a'));return respondWithRpcPromise(_0x39db('0x6b'),'acceptMessage',_0x29e14f);}return null;})[_0x39db('0x1e')](function(_0x302879){var _0x2c1b08=_0x39db('0x6c')+_0x302879['message']['ContactId'];return db[_0x39db('0x6d')][_0x39db('0x3f')](_0x2c1b08,{'type':db[_0x39db('0x6e')][_0x39db('0x6f')][_0x39db('0x70')],'raw':!![]})[_0x39db('0x1e')](function(_0x391823){return _0x391823;});})[_0x39db('0x1e')](function(_0x2025c8){if(_0x2025c8){_0x29e14f['message'][_0x39db('0x71')]=_0x2025c8[0x0];if(!_0xe2e9ed['body']['UserId'])return;return db[_0x39db('0x72')][_0x39db('0x56')]({'where':{'id':_0xe2e9ed[_0x39db('0x55')][_0x39db('0x61')],'role':_0x39db('0x60')},'attributes':['id',_0x39db('0x37'),_0x39db('0x73'),_0x39db('0x74'),_0x39db('0x75')],'raw':!![]});}return null;})[_0x39db('0x1e')](function(_0x1f4eb2){if(!_0x1f4eb2)return null;_0x29e14f['message'][_0x39db('0x60')]=_0x1f4eb2;return _0x29e14f;})['then'](function(_0x2d7f89){if(_0x2d7f89){if(_0xe2e9ed[_0x39db('0x55')][_0x39db('0x76')]){_0x29e14f[_0x39db('0x26')][_0x39db('0x77')]=util[_0x39db('0x5d')]('SIP/%s',_0xe2e9ed[_0x39db('0x5f')][_0x39db('0x37')]);_0x29e14f[_0x39db('0x26')][_0x39db('0x78')]=_0x29e14f[_0x39db('0x78')];_0x29e14f['message'][_0x39db('0x79')]=_0x29e14f[_0x39db('0x78')];_0x29e14f[_0x39db('0x26')][_0x39db('0x7a')]=_0x39db('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x29e14f[_0x39db('0x26')]},client9002)['then'](function(){return _0x29e14f;});}return _0x29e14f;}return null;})[_0x39db('0x1e')](respondWithResult(_0x3d3f4b,null))[_0x39db('0x28')](handleError(_0x3d3f4b,null));};var interaction_log=require(_0x39db('0x58'))(_0x39db('0x59'));exports[_0x39db('0x31')]=function(_0x57a77b,_0x11b2fc,_0x3a3550){var _0x562e25={'agent':{},'channel':_0x39db('0x7b')};if(_0x57a77b[_0x39db('0x55')]['id']){delete _0x57a77b[_0x39db('0x55')]['id'];}_0x57a77b[_0x39db('0x55')][_0x39db('0x61')]=_0x57a77b['body'][_0x39db('0x61')]||_0x57a77b['user']['id'];_0x562e25['agent']['id']=_0x57a77b[_0x39db('0x55')]['UserId'];return db[_0x39db('0x3a')]['find']({'where':{'id':_0x57a77b[_0x39db('0x4f')]['id'],'UserId':null}})[_0x39db('0x1e')](handleEntityNotFound(_0x11b2fc,null))[_0x39db('0x1e')](function(_0x4bf627){if(_0x4bf627){_0x562e25['message']=_0x4bf627['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4bf627[_0x39db('0x64')]}});}return null;})[_0x39db('0x1e')](handleEntityNotFound(_0x11b2fc,null))[_0x39db('0x1e')](function(_0x3659aa){if(_0x3659aa){_0x562e25[_0x39db('0x67')]=_0x3659aa[_0x39db('0x62')]({'plain':!![]});interaction_log['info'](_0x39db('0x7c'),_0x57a77b[_0x39db('0x5f')]['id'],_0x57a77b[_0x39db('0x5f')]['name'],_0x57a77b['user'][_0x39db('0x69')],_0x562e25['interaction']['id'],_0x57a77b[_0x39db('0x55')]?JSON[_0x39db('0x23')](_0x57a77b[_0x39db('0x55')]):_0x39db('0x6a'));return respondWithRpcPromise(_0x39db('0x7d'),'rejectMessage',_0x562e25);}return null;})['then'](function(_0xa24e55){var _0x355e0b=_0x39db('0x6c')+_0xa24e55[_0x39db('0x26')][_0x39db('0x7e')];return db[_0x39db('0x6d')][_0x39db('0x3f')](_0x355e0b,{'type':db['Sequelize'][_0x39db('0x6f')][_0x39db('0x70')],'raw':!![]})[_0x39db('0x1e')](function(_0x4c005f){return _0x4c005f;});})['then'](function(_0x18906f){if(_0x18906f){_0x562e25['message']['contact']=_0x18906f[0x0];if(!_0x57a77b[_0x39db('0x55')][_0x39db('0x61')])return;return db[_0x39db('0x72')]['find']({'where':{'id':_0x57a77b['body'][_0x39db('0x61')],'role':_0x39db('0x60')},'attributes':['id',_0x39db('0x37'),_0x39db('0x73'),_0x39db('0x74'),_0x39db('0x75')],'raw':!![]});}return null;})[_0x39db('0x1e')](function(_0x4d4980){if(!_0x4d4980)return null;_0x562e25[_0x39db('0x26')]['agent']=_0x4d4980;return _0x562e25;})[_0x39db('0x1e')](function(_0x250880){if(_0x250880){_0x250880['message'][_0x39db('0x77')]=util[_0x39db('0x5d')](_0x39db('0x7f'),_0x57a77b[_0x39db('0x5f')][_0x39db('0x37')]);_0x250880['message'][_0x39db('0x78')]=_0x562e25[_0x39db('0x78')];_0x250880[_0x39db('0x26')][_0x39db('0x79')]=_0x562e25[_0x39db('0x78')];_0x250880[_0x39db('0x26')][_0x39db('0x7a')]=_0x39db('0x31');respondWithRpcPromise(_0x39db('0x80'),_0x39db('0x80'),{'event':_0x39db('0x81'),'message':_0x250880[_0x39db('0x26')]},client9002);return _0x562e25;}return null;})[_0x39db('0x1e')](respondWithResult(_0x11b2fc,null))[_0x39db('0x28')](handleError(_0x11b2fc,null));};exports[_0x39db('0x82')]=function(_0x5885d1,_0x2a778b){var _0xf359e2;return db[_0x39db('0x3a')][_0x39db('0x82')](_0x5885d1[_0x39db('0x55')],{})[_0x39db('0x1e')](function(_0x4b7c10){_0xf359e2=_0x4b7c10;return db[_0x39db('0x83')]['findOne']({'where':{'id':_0xf359e2[_0x39db('0x7e')]}});})[_0x39db('0x1e')](function(_0x3b6da9){if(_[_0x39db('0x65')](_0x3b6da9)){return;}else{_0xf359e2[_0x39db('0x7b')]=_0x3b6da9[_0x39db('0x7b')];return db[_0x39db('0x84')][_0x39db('0x85')]({'where':{'id':_0xf359e2[_0x39db('0x86')]}});}})[_0x39db('0x1e')](function(_0x294e48){return respondWithRpcPromise(_0x39db('0x87'),_0x39db('0x87'),{'FaxAccountId':_['isNil'](_0x5885d1[_0x39db('0x55')])?undefined:_0x5885d1[_0x39db('0x55')][_0x39db('0x88')],'path':_[_0x39db('0x65')](_0x294e48)?undefined:util[_0x39db('0x5d')](_0x39db('0x89'),_0x294e48[_0x39db('0x8a')]),'fax':_[_0x39db('0x65')](_0xf359e2[_0x39db('0x7b')])?undefined:_0xf359e2[_0x39db('0x7b')],'AttachmentId':_0xf359e2[_0x39db('0x86')]},client9002);})[_0x39db('0x1e')](respondWithResult(_0x2a778b,0xc9))[_0x39db('0x28')](handleError(_0x2a778b,null));};exports[_0x39db('0x8b')]=function(_0x46f762,_0x1e3f12){var _0x236676=path[_0x39db('0x8c')](config['root'],'server',_0x39db('0x8d'),'attachments');return db[_0x39db('0x3a')][_0x39db('0x56')]({'where':{'id':_0x46f762[_0x39db('0x4f')]['id']},'include':[{'model':db[_0x39db('0x84')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x1e3f12,null))[_0x39db('0x1e')](function(_0x423a9f){if(_0x423a9f){return _0x1e3f12[_0x39db('0x8b')](path[_0x39db('0x8c')](_0x236676,_0x423a9f[_0x39db('0x84')][_0x39db('0x8a')]));}})[_0x39db('0x28')](handleError(_0x1e3f12,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4272727..1d1db89 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 _0x5d58=['hook','update','remove','emit','hasOwnProperty'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5d58,0x187));var _0x85d5=function(_0x20c123,_0x40594a){_0x20c123=_0x20c123-0x0;var _0x5b8709=_0x5d58[_0x20c123];return _0x5b8709;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x85d5('0x0'),'afterDestroy':_0x85d5('0x1')};function emitEvent(_0x53ca58){return function(_0x1469fc,_0x30bfe8,_0x54207b){FaxMessageEvents[_0x85d5('0x2')](_0x53ca58+':'+_0x1469fc['id'],_0x1469fc);FaxMessageEvents[_0x85d5('0x2')](_0x53ca58,_0x1469fc);_0x54207b(null);};}for(var e in events){if(events[_0x85d5('0x3')](e)){var event=events[e];FaxMessage[_0x85d5('0x4')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x4351=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage'];(function(_0x22103c,_0x27346b){var _0x509853=function(_0x5754f9){while(--_0x5754f9){_0x22103c['push'](_0x22103c['shift']());}};_0x509853(++_0x27346b);}(_0x4351,0x1b5));var _0x1435=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4351[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x1435('0x0'));var FaxMessage=require(_0x1435('0x1'))['db'][_0x1435('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1435('0x3')](0x0);var events={'afterCreate':_0x1435('0x4'),'afterUpdate':_0x1435('0x5'),'afterDestroy':_0x1435('0x6')};function emitEvent(_0x1b5f1e){return function(_0x2fc1f2,_0x2fa227,_0x111bc6){FaxMessageEvents[_0x1435('0x7')](_0x1b5f1e+':'+_0x2fc1f2['id'],_0x2fc1f2);FaxMessageEvents[_0x1435('0x7')](_0x1b5f1e,_0x2fc1f2);_0x111bc6(null);};}for(var e in events){if(events[_0x1435('0x8')](e)){var event=events[e];FaxMessage[_0x1435('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 76e57fd..83f6b08 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 _0xd36a=['path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x417f52,_0x41ec6b){var _0x2e84e8=function(_0x37f0ac){while(--_0x37f0ac){_0x417f52['push'](_0x417f52['shift']());}};_0x2e84e8(++_0x41ec6b);}(_0xd36a,0xf1));var _0xad36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd36a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xad36('0x0'));var util=require(_0xad36('0x1'));var logger=require(_0xad36('0x2'))(_0xad36('0x3'));var moment=require(_0xad36('0x4'));var BPromise=require(_0xad36('0x5'));var rp=require(_0xad36('0x6'));var fs=require('fs');var path=require(_0xad36('0x7'));var rimraf=require(_0xad36('0x8'));var config=require(_0xad36('0x9'));var attributes=require(_0xad36('0xa'));module['exports']=function(_0x149398,_0x510874){return _0x149398[_0xad36('0xb')](_0xad36('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xad36('0xd'),'fields':[_0xad36('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x504e94,_0x2aa76f,_0x3f7bae){var _0x391399=_0x149398[_0xad36('0xf')];var _0x167302=_0x504e94[_0xad36('0x10')]({'plain':!![]});if(_0x167302[_0xad36('0x11')]['toLowerCase']()==='in'||_0x167302[_0xad36('0x11')][_0xad36('0x12')]()==='out'&&!_0x167302[_0xad36('0x13')]&&!_[_0xad36('0x14')](_0x167302[_0xad36('0x15')])){_0x391399[_0xad36('0x16')][_0xad36('0x17')]({'where':{'id':_0x167302[_0xad36('0x18')]}})[_0xad36('0x19')](function(_0x3ef2c4){if(_0x3ef2c4){_0x3ef2c4[_0xad36('0x1a')]({'lastMsgAt':_0x167302[_0xad36('0x1b')],'lastMsgDirection':_0x167302[_0xad36('0x11')]['toLowerCase']()});}})['catch'](function(_0xd8f5be){console[_0xad36('0x1c')](_0xd8f5be);});}_0x3f7bae();}},'charset':_0xad36('0x1d'),'collate':_0xad36('0x1e')});}; \ No newline at end of file +var _0x07c1=['api','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x07c1,0x127));var _0x107c=function(_0x30dcb1,_0x47eb46){_0x30dcb1=_0x30dcb1-0x0;var _0x98ed93=_0x07c1[_0x30dcb1];return _0x98ed93;};'use strict';var _=require(_0x107c('0x0'));var util=require(_0x107c('0x1'));var logger=require('../../config/logger')(_0x107c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x107c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x107c('0x4'));var config=require(_0x107c('0x5'));var attributes=require(_0x107c('0x6'));module[_0x107c('0x7')]=function(_0x58516e,_0x6c3fdb){return _0x58516e[_0x107c('0x8')](_0x107c('0x9'),attributes,{'tableName':_0x107c('0xa'),'paranoid':![],'indexes':[{'name':_0x107c('0xb'),'fields':[_0x107c('0xc')],'type':_0x107c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x380ecc,_0x7e2b50,_0x5e6851){var _0x1b833c=_0x58516e[_0x107c('0xe')];var _0x145074=_0x380ecc['get']({'plain':!![]});if(_0x145074['direction'][_0x107c('0xf')]()==='in'||_0x145074[_0x107c('0x10')][_0x107c('0xf')]()===_0x107c('0x11')&&!_0x145074[_0x107c('0x12')]&&!_[_0x107c('0x13')](_0x145074['UserId'])){_0x1b833c[_0x107c('0x14')][_0x107c('0x15')]({'where':{'id':_0x145074[_0x107c('0x16')]}})['then'](function(_0x39f61d){if(_0x39f61d){_0x39f61d[_0x107c('0x17')]({'lastMsgAt':_0x145074['createdAt'],'lastMsgDirection':_0x145074[_0x107c('0x10')][_0x107c('0xf')]()});}})['catch'](function(_0x29a27d){console[_0x107c('0x18')](_0x29a27d);});}_0x5e6851();}},'charset':_0x107c('0x19'),'collate':_0x107c('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c466061..ad7ba89 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 _0xa41a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','body','options','raw','then','FaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','bluebird','randomstring'];(function(_0x1bdb67,_0x4b8014){var _0x1a6781=function(_0x5b3ec6){while(--_0x5b3ec6){_0x1bdb67['push'](_0x1bdb67['shift']());}};_0x1a6781(++_0x4b8014);}(_0xa41a,0x6b));var _0xaa41=function(_0x250780,_0x4994e6){_0x250780=_0x250780-0x0;var _0x11f214=_0xa41a[_0x250780];return _0x11f214;};'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});config['redis']=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x1cc344,_0x4263d6,_0x38d930){return new BPromise(function(_0x806f08,_0x423a19){return client[_0xaa41('0x10')](_0x1cc344,_0x38d930)['then'](function(_0x1d3aac){logger[_0xaa41('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4263d6,'request\x20sent');logger[_0xaa41('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4263d6,_0xaa41('0x13'),JSON[_0xaa41('0x14')](_0x1d3aac));if(_0x1d3aac[_0xaa41('0x15')]){if(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x16')]===0x1f4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);return _0x423a19(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}logger[_0xaa41('0x15')](_0xaa41('0x17'),_0x4263d6,_0x1d3aac['error'][_0xaa41('0x18')]);return _0x806f08(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}else{logger[_0xaa41('0x11')](_0xaa41('0x17'),_0x4263d6,_0xaa41('0x13'));_0x806f08(_0x1d3aac[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x4fe1a4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x4fe1a4);_0x423a19(_0x4fe1a4);});});}exports[_0xaa41('0x1b')]=function(_0x35c753){var _0x54c488=this;return new Promise(function(_0x2bf794,_0x1f692b){return db['FaxMessage']['create'](_0x35c753[_0xaa41('0x1c')],{'raw':_0x35c753['options']?_0x35c753[_0xaa41('0x1d')][_0xaa41('0x1e')]===undefined?!![]:![]:!![]})[_0xaa41('0x1f')](function(_0x1f27f3){logger[_0xaa41('0x11')]('CreateFaxMessage',_0x35c753);logger[_0xaa41('0x12')](_0xaa41('0x1b'),_0x35c753,JSON[_0xaa41('0x14')](_0x1f27f3));_0x2bf794(_0x1f27f3);})[_0xaa41('0x1a')](function(_0x274630){logger[_0xaa41('0x15')]('CreateFaxMessage',_0x274630['message'],_0x35c753);_0x1f692b(_0x54c488[_0xaa41('0x15')](0x1f4,_0x274630['message']));});});};exports['UpdateFaxMessage']=function(_0x12e362){var _0x59707f=this;return new Promise(function(_0x536bed,_0x2d0ac0){return db[_0xaa41('0x20')][_0xaa41('0x21')](_0x12e362[_0xaa41('0x1c')],{'raw':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x22')]||null:null,'attributes':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x23')]||null:null,'limit':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['limit']||null:null})[_0xaa41('0x1f')](function(_0x48b48b){logger['info'](_0xaa41('0x24'),_0x12e362);logger[_0xaa41('0x12')]('UpdateFaxMessage',_0x12e362,JSON[_0xaa41('0x14')](_0x48b48b));_0x536bed(_0x48b48b);})[_0xaa41('0x1a')](function(_0x4e3b44){logger['error']('UpdateFaxMessage',_0x4e3b44[_0xaa41('0x18')],_0x12e362);_0x2d0ac0(_0x59707f[_0xaa41('0x15')](0x1f4,_0x4e3b44[_0xaa41('0x18')]));});});}; \ No newline at end of file +var _0x9a19=['http','redis','socket.io-emitter','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','update','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4cfb78,_0x4c1da6){var _0xc1250e=function(_0x217b6c){while(--_0x217b6c){_0x4cfb78['push'](_0x4cfb78['shift']());}};_0xc1250e(++_0x4c1da6);}(_0x9a19,0x114));var _0x99a1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9a19[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});config[_0x99a1('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99a1('0xe'))(new Redis(config[_0x99a1('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4696f6,_0xd7b568,_0x23db53){return new BPromise(function(_0x26473f,_0x1551a1){return client['request'](_0x4696f6,_0x23db53)[_0x99a1('0xf')](function(_0xdd29e1){logger[_0x99a1('0x10')](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));logger[_0x99a1('0x13')](_0x99a1('0x14'),_0xd7b568,_0x99a1('0x12'),JSON[_0x99a1('0x15')](_0xdd29e1));if(_0xdd29e1[_0x99a1('0x16')]){if(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x17')]===0x1f4){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')]['message']);return _0x1551a1(_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);}logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0xdd29e1[_0x99a1('0x16')][_0x99a1('0x18')]);return _0x26473f(_0xdd29e1[_0x99a1('0x16')]['message']);}else{logger['info'](_0x99a1('0x11'),_0xd7b568,_0x99a1('0x12'));_0x26473f(_0xdd29e1[_0x99a1('0x19')][_0x99a1('0x18')]);}})[_0x99a1('0x1a')](function(_0x209021){logger[_0x99a1('0x16')](_0x99a1('0x11'),_0xd7b568,_0x209021);_0x1551a1(_0x209021);});});}exports[_0x99a1('0x1b')]=function(_0x2d8cac){var _0x3c23c0=this;return new Promise(function(_0x5eabcb,_0x3023a1){return db[_0x99a1('0x1c')]['create'](_0x2d8cac[_0x99a1('0x1d')],{'raw':_0x2d8cac['options']?_0x2d8cac[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![]})[_0x99a1('0xf')](function(_0x2d3b82){logger['info'](_0x99a1('0x1b'),_0x2d8cac);logger[_0x99a1('0x13')]('CreateFaxMessage',_0x2d8cac,JSON[_0x99a1('0x15')](_0x2d3b82));_0x5eabcb(_0x2d3b82);})['catch'](function(_0x1f9800){logger[_0x99a1('0x16')](_0x99a1('0x1b'),_0x1f9800[_0x99a1('0x18')],_0x2d8cac);_0x3023a1(_0x3c23c0[_0x99a1('0x16')](0x1f4,_0x1f9800[_0x99a1('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x114b38){var _0x5dabd9=this;return new Promise(function(_0x5dc733,_0xafea84){return db[_0x99a1('0x1c')][_0x99a1('0x20')](_0x114b38[_0x99a1('0x1d')],{'raw':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')]['where']||null:null,'attributes':_0x114b38[_0x99a1('0x1e')]?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x21')]||null:null,'limit':_0x114b38['options']?_0x114b38[_0x99a1('0x1e')][_0x99a1('0x22')]||null:null})['then'](function(_0x37514e){logger[_0x99a1('0x10')](_0x99a1('0x23'),_0x114b38);logger[_0x99a1('0x13')](_0x99a1('0x23'),_0x114b38,JSON[_0x99a1('0x15')](_0x37514e));_0x5dc733(_0x37514e);})[_0x99a1('0x1a')](function(_0x26c23c){logger['error']('UpdateFaxMessage',_0x26c23c[_0x99a1('0x18')],_0x114b38);_0xafea84(_0x5dabd9['error'](0x1f4,_0x26c23c[_0x99a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6aac2a9..094205e 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 _0xc750=['remove','removeListener','faxMessage:','./faxMessage.events','save'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0xc750,0x18e));var _0x0c75=function(_0x50e55c,_0x1ca488){_0x50e55c=_0x50e55c-0x0;var _0x39c88d=_0xc750[_0x50e55c];return _0x39c88d;};'use strict';var FaxMessageEvents=require(_0x0c75('0x0'));var events=[_0x0c75('0x1'),_0x0c75('0x2'),'update'];function createListener(_0x5213d4,_0x32ed98){return function(_0x28131a){_0x32ed98['emit'](_0x5213d4,_0x28131a);};}function removeListener(_0x676f3b,_0x18f162){return function(){FaxMessageEvents[_0x0c75('0x3')](_0x676f3b,_0x18f162);};}exports['register']=function(_0xac314a){for(var _0x5099a8=0x0,_0xe484d7=events['length'];_0x5099a8<_0xe484d7;_0x5099a8++){var _0x152f3a=events[_0x5099a8];var _0x4c8329=createListener(_0x0c75('0x4')+_0x152f3a,_0xac314a);FaxMessageEvents['on'](_0x152f3a,_0x4c8329);}}; \ No newline at end of file +var _0x540a=['emit','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x58de31,_0x492d8b){var _0x149bc6=function(_0x159afa){while(--_0x159afa){_0x58de31['push'](_0x58de31['shift']());}};_0x149bc6(++_0x492d8b);}(_0x540a,0x1a0));var _0xa540=function(_0xb6d930,_0x4c9ca1){_0xb6d930=_0xb6d930-0x0;var _0x31e8b7=_0x540a[_0xb6d930];return _0x31e8b7;};'use strict';var FaxMessageEvents=require(_0xa540('0x0'));var events=[_0xa540('0x1'),_0xa540('0x2'),_0xa540('0x3')];function createListener(_0x4ab2df,_0x122aef){return function(_0x21ffaf){_0x122aef[_0xa540('0x4')](_0x4ab2df,_0x21ffaf);};}function removeListener(_0x2a93f5,_0x301ca6){return function(){FaxMessageEvents['removeListener'](_0x2a93f5,_0x301ca6);};}exports['register']=function(_0x75788e){for(var _0x192402=0x0,_0x24c82e=events[_0xa540('0x5')];_0x192402<_0x24c82e;_0x192402++){var _0x4ad9c2=events[_0x192402];var _0x4b43f8=createListener(_0xa540('0x6')+_0x4ad9c2,_0x75788e);FaxMessageEvents['on'](_0x4ad9c2,_0x4b43f8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index eb1ef67..faa02b7 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(_0xa8f9a3,_0x33e8e9){var _0x30b6d5=function(_0xca2b7d){while(--_0xca2b7d){_0xa8f9a3['push'](_0xa8f9a3['shift']());}};_0x30b6d5(++_0x33e8e9);}(_0xd404,0x15b));var _0x4d40=function(_0x41b6a7,_0x3feba8){_0x41b6a7=_0x41b6a7-0x0;var _0x5a8061=_0xd404[_0x41b6a7];return _0x5a8061;};'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 _0xd3d1=['put','update','accept','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create'];(function(_0x36e254,_0xd75634){var _0xd2251f=function(_0x109319){while(--_0x109319){_0x36e254['push'](_0x36e254['shift']());}};_0xd2251f(++_0xd75634);}(_0xd3d1,0x172));var _0x1d3d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd3d1[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['show']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),interaction[_0x1d3d('0x12')](_0x1d3d('0x13'),_0x1d3d('0x14')),controller[_0x1d3d('0x15')]);router[_0x1d3d('0x16')]('/:id',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x17')]);router['put']('/:id/accept',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x16')]('/:id/reject',auth[_0x1d3d('0xa')](),controller['reject']);router[_0x1d3d('0x19')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x1a')]);module[_0x1d3d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1b679fb..2aed184 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 _0x3ecc=['beepall','roundrobin','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ecc,0x12f));var _0xc3ec=function(_0x3e2a9a,_0x2053d6){_0x3e2a9a=_0x3e2a9a-0x0;var _0x16c7ae=_0x3ecc[_0x3e2a9a];return _0x16c7ae;};'use strict';var Sequelize=require('sequelize');module[_0xc3ec('0x0')]={'name':{'type':Sequelize[_0xc3ec('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc3ec('0x1')]},'timeout':{'type':Sequelize[_0xc3ec('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc3ec('0x3')](_0xc3ec('0x4'),_0xc3ec('0x5'),_0xc3ec('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc3ec('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe9e4=['rrmemory','roundrobin','exports','STRING','name','INTEGER'];(function(_0x57a048,_0x41a46c){var _0xfb3a76=function(_0xa87fe){while(--_0xa87fe){_0x57a048['push'](_0x57a048['shift']());}};_0xfb3a76(++_0x41a46c);}(_0xe9e4,0x1e2));var _0x4e9e=function(_0x384222,_0x121068){_0x384222=_0x384222-0x0;var _0x314878=_0xe9e4[_0x384222];return _0x314878;};'use strict';var Sequelize=require('sequelize');module[_0x4e9e('0x0')]={'name':{'type':Sequelize[_0x4e9e('0x1')],'unique':_0x4e9e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e9e('0x1')]},'timeout':{'type':Sequelize[_0x4e9e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4e9e('0x4'),'beepall',_0x4e9e('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4e9e('0x3')],'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 aaeb11a..c63a39b 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 _0xda19=['name','send','index','map','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','params','FaxQueue','keys','intersection','model','attributes','includeAll','merge','options','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','filters','fields','length','offset','order','sort','FaxQueueId','filter','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','SIP','getTeams','pick','nolimit','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','util','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack'];(function(_0x554af0,_0x3769a1){var _0x34d939=function(_0x69694f){while(--_0x69694f){_0x554af0['push'](_0x554af0['shift']());}};_0x34d939(++_0x3769a1);}(_0xda19,0xd5));var _0x9da1=function(_0x507436,_0x445faa){_0x507436=_0x507436-0x0;var _0x43b784=_0xda19[_0x507436];return _0x43b784;};'use strict';var BPromise=require('bluebird');var util=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));var squel=require('squel');var Redis=require(_0x9da1('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9da1('0x3'))('api');var config=require(_0x9da1('0x4'));var db=require(_0x9da1('0x5'))['db'];config[_0x9da1('0x6')]=_[_0x9da1('0x7')](config[_0x9da1('0x6')],{'host':_0x9da1('0x8'),'port':0x18eb});var socket=require(_0x9da1('0x9'))(new Redis(config[_0x9da1('0x6')]));require(_0x9da1('0xa'))[_0x9da1('0xb')](socket);function respondWithStatusCode(_0x47df89,_0x55f66b){_0x55f66b=_0x55f66b||0xcc;return function(_0x4cb9f7){if(_0x4cb9f7){return _0x47df89[_0x9da1('0xc')](_0x55f66b);}return _0x47df89['status'](_0x55f66b)[_0x9da1('0xd')]();};}function respondWithResult(_0x1cca84,_0x3ba3d3){_0x3ba3d3=_0x3ba3d3||0xc8;return function(_0x1ab988){if(_0x1ab988){return _0x1cca84[_0x9da1('0xe')](_0x3ba3d3)[_0x9da1('0xf')](_0x1ab988);}};}function respondWithFilteredResult(_0x9fd032,_0x5807ec){return function(_0x51bc88){if(_0x51bc88){var _0x3114f7=typeof _0x5807ec['offset']===_0x9da1('0x10')&&typeof _0x5807ec[_0x9da1('0x11')]===_0x9da1('0x10');var _0x1ffa2a=_0x51bc88['count'];var _0x2837e3=_0x3114f7?0x0:_0x5807ec['offset'];var _0x4d17e1=_0x3114f7?_0x51bc88[_0x9da1('0x12')]:_0x5807ec['offset']+_0x5807ec[_0x9da1('0x11')];var _0x43c093;if(_0x4d17e1>=_0x1ffa2a){_0x4d17e1=_0x1ffa2a;_0x43c093=0xc8;}else{_0x43c093=0xce;}_0x9fd032[_0x9da1('0xe')](_0x43c093);return _0x9fd032[_0x9da1('0x13')](_0x9da1('0x14'),_0x2837e3+'-'+_0x4d17e1+'/'+_0x1ffa2a)['json'](_0x51bc88);}return null;};}function saveUpdates(_0x16f75a){return function(_0x116a76){if(_0x116a76){return _0x116a76[_0x9da1('0x15')](_0x16f75a)[_0x9da1('0x16')](function(_0xfb278d){return _0xfb278d;});}return null;};}function removeEntity(_0x42a9c7){return function(_0x497676){if(_0x497676){return _0x497676['destroy']()[_0x9da1('0x16')](function(){var _0x8da712=_0x497676[_0x9da1('0x17')]({'plain':!![]});var _0x41e555=_0x9da1('0x18');return db[_0x9da1('0x19')][_0x9da1('0x1a')]({'where':{'type':_0x41e555,'resourceId':_0x8da712['id']}})['then'](function(){return _0x497676;});})[_0x9da1('0x16')](function(){_0x42a9c7[_0x9da1('0xe')](0xcc)[_0x9da1('0xd')]();});}};}function handleEntityNotFound(_0xacba30){return function(_0x1fc065){if(!_0x1fc065){_0xacba30['sendStatus'](0x194);}return _0x1fc065;};}function handleError(_0x5454d3,_0x14793b){_0x14793b=_0x14793b||0x1f4;return function(_0x3e6f85){logger[_0x9da1('0x1b')](_0x3e6f85[_0x9da1('0x1c')]);if(_0x3e6f85[_0x9da1('0x1d')]){delete _0x3e6f85[_0x9da1('0x1d')];}_0x5454d3['status'](_0x14793b)[_0x9da1('0x1e')](_0x3e6f85);};}exports[_0x9da1('0x1f')]=function(_0x4fd25a,_0x45fcce){var _0x3f5680={};var _0x534210={'count':0x0,'rows':[]};var _0x2fd49c=_[_0x9da1('0x20')](db['FaxQueue'][_0x9da1('0x21')],function(_0x1d6af5){return{'name':_0x1d6af5['fieldName'],'type':_0x1d6af5['type'][_0x9da1('0x22')]};});_0x3f5680=qs[_0x9da1('0x23')](_0x2fd49c,_0x4fd25a);var _0x5eca5b={'where':_0x3f5680[_0x9da1('0x24')]};return db['FaxQueue']['count'](_0x5eca5b)['then'](function(_0x31b826){_0x534210[_0x9da1('0x12')]=_0x31b826;_0x3f5680[_0x9da1('0x25')]=qs[_0x9da1('0x25')](_0x4fd25a[_0x9da1('0x26')]);return db['FaxQueue'][_0x9da1('0x27')](_0x3f5680);})['then'](function(_0x1feae0){_0x534210[_0x9da1('0x28')]=_0x1feae0;return _0x534210;})['then'](respondWithFilteredResult(_0x45fcce,_0x3f5680))[_0x9da1('0x29')](handleError(_0x45fcce,null));};exports[_0x9da1('0x2a')]=function(_0x4f318b,_0x1a0771){var _0x3fe97a={'raw':!![],'where':{'id':_0x4f318b[_0x9da1('0x2b')]['id']}},_0x1802e0={};_0x1802e0['model']=_['keys'](db[_0x9da1('0x2c')][_0x9da1('0x21')]);_0x1802e0[_0x9da1('0x26')]=_[_0x9da1('0x2d')](_0x4f318b[_0x9da1('0x26')]);_0x1802e0['filters']=_[_0x9da1('0x2e')](_0x1802e0[_0x9da1('0x2f')],_0x1802e0[_0x9da1('0x26')]);_0x3fe97a[_0x9da1('0x30')]=_[_0x9da1('0x2e')](_0x1802e0[_0x9da1('0x2f')],qs['fields'](_0x4f318b[_0x9da1('0x26')]['fields']));_0x3fe97a['attributes']=_0x3fe97a[_0x9da1('0x30')]['length']?_0x3fe97a[_0x9da1('0x30')]:_0x1802e0[_0x9da1('0x2f')];if(_0x4f318b[_0x9da1('0x26')][_0x9da1('0x31')]){_0x3fe97a[_0x9da1('0x25')]=[{'all':!![]}];}_0x3fe97a=_[_0x9da1('0x32')]({},_0x3fe97a,_0x4f318b[_0x9da1('0x33')]);return db[_0x9da1('0x2c')]['find'](_0x3fe97a)[_0x9da1('0x16')](handleEntityNotFound(_0x1a0771,null))['then'](respondWithResult(_0x1a0771,null))[_0x9da1('0x29')](handleError(_0x1a0771,null));};exports['create']=function(_0x5eaa7e,_0x1ce0f8){return db['FaxQueue'][_0x9da1('0x34')](_0x5eaa7e[_0x9da1('0x35')],{})['then'](function(_0x38242c){var _0x1b750f=_0x5eaa7e[_0x9da1('0x36')][_0x9da1('0x17')]({'plain':!![]});if(!_0x1b750f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b750f[_0x9da1('0x37')]==='user'){var _0x2bb9e4=_0x38242c['get']({'plain':!![]});var _0x26e8d3=_0x9da1('0x18');return db['UserProfileSection'][_0x9da1('0x38')]({'where':{'name':_0x26e8d3,'userProfileId':_0x1b750f[_0x9da1('0x39')]},'raw':!![]})[_0x9da1('0x16')](function(_0x4e9af3){if(_0x4e9af3&&_0x4e9af3['autoAssociation']===0x0){return db['UserProfileResource'][_0x9da1('0x34')]({'name':_0x2bb9e4['name'],'resourceId':_0x2bb9e4['id'],'type':_0x4e9af3[_0x9da1('0x1d')],'sectionId':_0x4e9af3['id']},{})[_0x9da1('0x16')](function(){return _0x38242c;});}else{return _0x38242c;}})[_0x9da1('0x29')](function(_0x43c064){logger['error'](_0x9da1('0x3a'),_0x43c064);throw _0x43c064;});}return _0x38242c;})[_0x9da1('0x16')](respondWithResult(_0x1ce0f8,0xc9))[_0x9da1('0x29')](handleError(_0x1ce0f8,null));};exports[_0x9da1('0x15')]=function(_0x28fc88,_0x26c225){if(_0x28fc88[_0x9da1('0x35')]['id']){delete _0x28fc88['body']['id'];}return db[_0x9da1('0x2c')]['find']({'where':{'id':_0x28fc88[_0x9da1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x26c225,null))[_0x9da1('0x16')](saveUpdates(_0x28fc88[_0x9da1('0x35')],null))['then'](respondWithResult(_0x26c225,null))[_0x9da1('0x29')](handleError(_0x26c225,null));};exports[_0x9da1('0x1a')]=function(_0x4ea83c,_0x1a193b){return db['FaxQueue'][_0x9da1('0x38')]({'where':{'id':_0x4ea83c[_0x9da1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1a193b,null))['then'](removeEntity(_0x1a193b,null))[_0x9da1('0x29')](handleError(_0x1a193b,null));};exports[_0x9da1('0x3b')]=function(_0x15bb24,_0x40f514){return db[_0x9da1('0x2c')][_0x9da1('0x3b')]()[_0x9da1('0x16')](respondWithResult(_0x40f514,null))[_0x9da1('0x29')](handleError(_0x40f514,null));};exports['getMembers']=function(_0xd7fb0a,_0x23b445){var _0x1eebc5={'raw':!![],'where':{}},_0x5cf7ef={},_0xd5b3da;return db[_0x9da1('0x2c')][_0x9da1('0x3c')]({'where':{'id':_0xd7fb0a['params']['id']}})[_0x9da1('0x16')](handleEntityNotFound(_0x23b445,null))[_0x9da1('0x16')](function(_0x28b1b0){if(_0x28b1b0){_0xd5b3da=_0x28b1b0['get']({'plain':!![]});_0x5cf7ef[_0x9da1('0x2f')]=_['keys'](db['UserFaxQueue'][_0x9da1('0x21')]);_0x5cf7ef[_0x9da1('0x26')]=_['keys'](_0xd7fb0a[_0x9da1('0x26')]);_0x5cf7ef[_0x9da1('0x3d')]=_['intersection'](_0x5cf7ef[_0x9da1('0x2f')],_0x5cf7ef[_0x9da1('0x26')]);_0x1eebc5[_0x9da1('0x30')]=_[_0x9da1('0x2e')](_0x5cf7ef[_0x9da1('0x2f')],qs[_0x9da1('0x3e')](_0xd7fb0a[_0x9da1('0x26')][_0x9da1('0x3e')]));_0x1eebc5[_0x9da1('0x30')]=_0x1eebc5['attributes'][_0x9da1('0x3f')]?_0x1eebc5[_0x9da1('0x30')]:_0x5cf7ef[_0x9da1('0x2f')];if(!_0xd7fb0a[_0x9da1('0x26')]['hasOwnProperty']('nolimit')){_0x1eebc5[_0x9da1('0x11')]=qs[_0x9da1('0x11')](_0xd7fb0a[_0x9da1('0x26')][_0x9da1('0x11')]);_0x1eebc5[_0x9da1('0x40')]=qs[_0x9da1('0x40')](_0xd7fb0a[_0x9da1('0x26')][_0x9da1('0x40')]);}_0x1eebc5[_0x9da1('0x41')]=qs[_0x9da1('0x42')](_0xd7fb0a[_0x9da1('0x26')][_0x9da1('0x42')]);_0x1eebc5[_0x9da1('0x24')]=qs[_0x9da1('0x3d')](_['pick'](_0xd7fb0a[_0x9da1('0x26')],_0x5cf7ef[_0x9da1('0x3d')]));_0x1eebc5['where'][_0x9da1('0x43')]=_0x28b1b0['id'];if(_0xd7fb0a['query'][_0x9da1('0x44')]){_0x1eebc5['where']=_[_0x9da1('0x32')](_0x1eebc5[_0x9da1('0x24')],{'$or':_[_0x9da1('0x20')](_0x1eebc5[_0x9da1('0x30')],function(_0x32d131){var _0x2cb7a4={};_0x2cb7a4[_0x32d131]={'$like':'%'+_0xd7fb0a[_0x9da1('0x26')][_0x9da1('0x44')]+'%'};return _0x2cb7a4;})});}_0x1eebc5=_[_0x9da1('0x32')]({},_0x1eebc5,_0xd7fb0a[_0x9da1('0x33')]);return db['UserFaxQueue'][_0x9da1('0x27')](_0x1eebc5);}})[_0x9da1('0x16')](function(_0x2e5aae){if(_0x2e5aae){return db[_0x9da1('0x45')][_0x9da1('0x46')]({'where':{'id':_[_0x9da1('0x20')](_0x2e5aae,_0x9da1('0x47')),'role':_0x9da1('0x48')},'attributes':['id',_0x9da1('0x1d'),_0x9da1('0x49'),'updatedAt',_0x9da1('0x4a')]});}})[_0x9da1('0x16')](function(_0x5bda2a){if(_0x5bda2a){return{'count':_0x5bda2a[_0x9da1('0x12')],'rows':_[_0x9da1('0x20')](_0x5bda2a[_0x9da1('0x28')],function(_0x1bd260){return{'membername':_0x1bd260[_0x9da1('0x1d')],'UserId':_0x1bd260['id'],'queue_name':_0xd5b3da[_0x9da1('0x1d')],'FaxQueueId':_0xd5b3da['id'],'interface':util[_0x9da1('0x4b')]('%s/%s',_0x9da1('0x4c'),_0x1bd260[_0x9da1('0x1d')]),'penalty':0x0,'paused':_0x1bd260[_0x9da1('0x49')],'createdAt':_0x1bd260[_0x9da1('0x4a')],'updatedAt':_0x1bd260['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9da1('0x16')](respondWithFilteredResult(_0x23b445,_0x1eebc5))['catch'](handleError(_0x23b445,null));};exports[_0x9da1('0x4d')]=function(_0x10ebc9,_0x15bb3a){var _0x432c8b={};var _0x464c41={};var _0x4445e2;var _0x5e262c;return db['FaxQueue'][_0x9da1('0x3c')]({'where':{'id':_0x10ebc9['params']['id']}})['then'](handleEntityNotFound(_0x15bb3a,null))['then'](function(_0x6f86c3){if(_0x6f86c3){_0x4445e2=_0x6f86c3;_0x464c41['model']=_[_0x9da1('0x2d')](db['Team'][_0x9da1('0x21')]);_0x464c41[_0x9da1('0x26')]=_['keys'](_0x10ebc9[_0x9da1('0x26')]);_0x464c41[_0x9da1('0x3d')]=_['intersection'](_0x464c41[_0x9da1('0x2f')],_0x464c41[_0x9da1('0x26')]);_0x432c8b['attributes']=_['intersection'](_0x464c41[_0x9da1('0x2f')],qs[_0x9da1('0x3e')](_0x10ebc9[_0x9da1('0x26')][_0x9da1('0x3e')]));_0x432c8b[_0x9da1('0x30')]=_0x432c8b[_0x9da1('0x30')]['length']?_0x432c8b[_0x9da1('0x30')]:_0x464c41['model'];_0x432c8b['order']=qs[_0x9da1('0x42')](_0x10ebc9[_0x9da1('0x26')][_0x9da1('0x42')]);_0x432c8b[_0x9da1('0x24')]=qs[_0x9da1('0x3d')](_[_0x9da1('0x4e')](_0x10ebc9[_0x9da1('0x26')],_0x464c41[_0x9da1('0x3d')]));if(_0x10ebc9[_0x9da1('0x26')]['filter']){_0x432c8b[_0x9da1('0x24')]=_[_0x9da1('0x32')](_0x432c8b[_0x9da1('0x24')],{'$or':_[_0x9da1('0x20')](_0x432c8b[_0x9da1('0x30')],function(_0x491fcb){var _0x1a934c={};_0x1a934c[_0x491fcb]={'$like':'%'+_0x10ebc9[_0x9da1('0x26')][_0x9da1('0x44')]+'%'};return _0x1a934c;})});}_0x432c8b=_[_0x9da1('0x32')]({},_0x432c8b,_0x10ebc9[_0x9da1('0x33')]);return _0x4445e2[_0x9da1('0x4d')](_0x432c8b);}})['then'](function(_0x197e1d){if(_0x197e1d){_0x5e262c=_0x197e1d['length'];if(!_0x10ebc9[_0x9da1('0x26')]['hasOwnProperty'](_0x9da1('0x4f'))){_0x432c8b[_0x9da1('0x11')]=qs[_0x9da1('0x11')](_0x10ebc9[_0x9da1('0x26')]['limit']);_0x432c8b['offset']=qs['offset'](_0x10ebc9[_0x9da1('0x26')][_0x9da1('0x40')]);}return _0x4445e2[_0x9da1('0x4d')](_0x432c8b);}})[_0x9da1('0x16')](function(_0x4aa5f3){if(_0x4aa5f3){return _0x4aa5f3?{'count':_0x5e262c,'rows':_0x4aa5f3}:null;}})['then'](respondWithResult(_0x15bb3a,null))[_0x9da1('0x29')](handleError(_0x15bb3a,null));};exports[_0x9da1('0x50')]=function(_0x3ed43e,_0x5d0e05){var _0x5b3114=_0x3ed43e[_0x9da1('0x35')][_0x9da1('0x51')];return db[_0x9da1('0x52')]['findAll']({'where':{'id':_0x5b3114},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9da1('0x53'),'attributes':['id',_0x9da1('0x1d'),_0x9da1('0x54'),_0x9da1('0x55'),_0x9da1('0x56')],'raw':!![]}]})['then'](function(_0x3dcb6b){if(_0x3dcb6b){var _0x1ea46a=_[_0x9da1('0x57')](_0x3dcb6b,function(_0x1f0369){var _0x4def4c=_0x1f0369[_0x9da1('0x17')]({'plain':!![]});return _0x4def4c[_0x9da1('0x53')];});return db[_0x9da1('0x2c')]['find']({'where':{'id':_0x3ed43e[_0x9da1('0x2b')]['id']}})[_0x9da1('0x16')](function(_0x17f032){return db['sequelize'][_0x9da1('0x58')](function(_0x1eb493){return _0x17f032['addTeams'](_0x5b3114,{'transaction':_0x1eb493})[_0x9da1('0x16')](function(){return BPromise['each'](_0x1ea46a,function(_0x247710){return db['UserFaxQueue'][_0x9da1('0x59')]({'where':{'UserId':_0x247710['id'],'FaxQueueId':_0x3ed43e[_0x9da1('0x2b')]['id']},'transaction':_0x1eb493});});})[_0x9da1('0x16')](function(){_0x1ea46a[_0x9da1('0x5a')](function(_0x3baa47){socket[_0x9da1('0x5b')](_0x9da1('0x5c'),{'UserId':_0x3baa47['id'],'FaxQueueId':_0x17f032['id']});});});});});}})[_0x9da1('0x16')](respondWithStatusCode(_0x5d0e05,null))[_0x9da1('0x29')](handleError(_0x5d0e05,null));};exports[_0x9da1('0x5d')]=function(_0x323cae,_0x2bd73d){return db[_0x9da1('0x52')]['findAll']({'where':{'id':_0x323cae[_0x9da1('0x26')][_0x9da1('0x51')]},'attributes':['id'],'include':[{'model':db[_0x9da1('0x45')],'as':_0x9da1('0x53'),'attributes':['id'],'raw':!![]}]})[_0x9da1('0x16')](handleEntityNotFound(_0x2bd73d,null))['then'](function(_0x1ca102){var _0x2eb5e6=_['map'](_0x1ca102,'id');var _0x4a4cda=[];var _0x84f8d8=[];var _0x2d0e01=squel[_0x9da1('0x5e')]();_0x2d0e01[_0x9da1('0x5f')](_0x9da1('0x60'))[_0x9da1('0x61')](_0x9da1('0x62'),'tq')[_0x9da1('0x63')](_0x9da1('0x64'),'ut',_0x9da1('0x65'))[_0x9da1('0x24')](_0x9da1('0x66'),_0x323cae[_0x9da1('0x2b')]['id']);for(var _0x49a95c=0x0;_0x49a95c<_0x1ca102[_0x9da1('0x3f')];_0x49a95c+=0x1){let _0x3a0a84=_0x1ca102[_0x49a95c];for(var _0x3f9782=0x0;_0x3f9782<_0x3a0a84[_0x9da1('0x53')][_0x9da1('0x3f')];_0x3f9782+=0x1){let _0x5e6b67=_0x3a0a84[_0x9da1('0x53')][_0x3f9782];var _0x354c5a=_0x2d0e01['clone']();_0x354c5a[_0x9da1('0x24')]('ut.UserId\x20=\x20?',_0x5e6b67['id']);_0x84f8d8[_0x9da1('0x67')](db['sequelize'][_0x9da1('0x26')](_0x354c5a[_0x9da1('0x68')](),{'type':db[_0x9da1('0x69')][_0x9da1('0x6a')][_0x9da1('0x6b')]})[_0x9da1('0x16')](function(_0x1f785c){if(_0x1f785c[_0x9da1('0x3f')]===0x1){return _0x5e6b67['id'];}else{var _0x118e26=_[_0x9da1('0x6c')](_[_0x9da1('0x20')](_0x1f785c,_0x9da1('0x6d')),function(_0x5d329c){return _[_0x9da1('0x6e')](_0x2eb5e6,_0x5d329c);});if(_0x118e26){return _0x5e6b67['id'];}}}));}}return BPromise[_0x9da1('0x6f')](_0x84f8d8)[_0x9da1('0x16')](function(_0x4015b9){_0x4a4cda=_(_0x4a4cda)[_0x9da1('0x70')](_0x4015b9)[_0x9da1('0x71')]()['value']();return db['FaxQueue'][_0x9da1('0x38')]({'where':{'id':_0x323cae[_0x9da1('0x2b')]['id']}})[_0x9da1('0x16')](function(_0x4cd85f){return db[_0x9da1('0x69')][_0x9da1('0x58')](function(_0x175b4b){return _0x4cd85f[_0x9da1('0x5d')](_0x323cae[_0x9da1('0x26')][_0x9da1('0x51')],{'transaction':_0x175b4b})[_0x9da1('0x16')](function(){if(!_['isEmpty'](_0x4a4cda)){return _0x4cd85f[_0x9da1('0x72')](_0x4a4cda,{'transaction':_0x175b4b});}})[_0x9da1('0x16')](function(){_0x4a4cda['forEach'](function(_0x56af13){socket[_0x9da1('0x5b')]('userFaxQueue:remove',{'UserId':_0x56af13,'FaxQueueId':_0x4cd85f['id']});});});});});});})['then'](respondWithStatusCode(_0x2bd73d,null))[_0x9da1('0x29')](handleError(_0x2bd73d,null));};exports[_0x9da1('0x73')]=function(_0x3f9010,_0x18ae08){return db[_0x9da1('0x2c')][_0x9da1('0x38')]({'where':{'id':_0x3f9010[_0x9da1('0x2b')]['id']}})[_0x9da1('0x16')](handleEntityNotFound(_0x18ae08,null))['then'](function(_0x5569d5){if(_0x5569d5){return _0x5569d5[_0x9da1('0x73')](_0x3f9010[_0x9da1('0x35')][_0x9da1('0x51')],_[_0x9da1('0x74')](_0x3f9010[_0x9da1('0x35')],[_0x9da1('0x51'),'id'])||{})[_0x9da1('0x75')](function(_0x440e2a){for(var _0x4c9aa5=0x0;_0x4c9aa5<_0x3f9010[_0x9da1('0x35')]['ids'][_0x9da1('0x3f')];_0x4c9aa5+=0x1){socket[_0x9da1('0x5b')](_0x9da1('0x5c'),{'UserId':Number(_0x3f9010[_0x9da1('0x35')][_0x9da1('0x51')][_0x4c9aa5]),'FaxQueueId':Number(_0x3f9010[_0x9da1('0x2b')]['id'])});}return _0x440e2a;});}})[_0x9da1('0x16')](respondWithResult(_0x18ae08,null))['catch'](handleError(_0x18ae08,null));};exports[_0x9da1('0x72')]=function(_0x532686,_0x174d15){return db[_0x9da1('0x2c')][_0x9da1('0x38')]({'where':{'id':_0x532686[_0x9da1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x174d15,null))[_0x9da1('0x16')](function(_0x1f93bf){if(_0x1f93bf){return _0x1f93bf[_0x9da1('0x72')](_0x532686[_0x9da1('0x26')][_0x9da1('0x51')])[_0x9da1('0x16')](function(){if(_[_0x9da1('0x76')](_0x532686[_0x9da1('0x26')][_0x9da1('0x51')])){for(var _0x1faea5=0x0;_0x1faea5<_0x532686[_0x9da1('0x26')][_0x9da1('0x51')][_0x9da1('0x3f')];_0x1faea5+=0x1){socket[_0x9da1('0x5b')]('userFaxQueue:remove',{'UserId':Number(_0x532686[_0x9da1('0x26')]['ids'][_0x1faea5]),'FaxQueueId':Number(_0x532686[_0x9da1('0x2b')]['id'])});}}else{socket['emit'](_0x9da1('0x77'),{'UserId':Number(_0x532686[_0x9da1('0x26')][_0x9da1('0x51')]),'FaxQueueId':Number(_0x532686[_0x9da1('0x2b')]['id'])});}});}})[_0x9da1('0x16')](respondWithStatusCode(_0x174d15,null))[_0x9da1('0x29')](handleError(_0x174d15,null));};exports[_0x9da1('0x78')]=function(_0x25afb2,_0x5e71f5){var _0xe8b0a5={};var _0x1d4552={};var _0x4fe1ff;var _0x329d99;return db[_0x9da1('0x2c')][_0x9da1('0x3c')]({'where':{'id':_0x25afb2['params']['id']}})['then'](handleEntityNotFound(_0x5e71f5,null))['then'](function(_0x1d0ca8){if(_0x1d0ca8){_0x4fe1ff=_0x1d0ca8;_0x1d4552[_0x9da1('0x2f')]=_[_0x9da1('0x2d')](db['User']['rawAttributes']);_0x1d4552[_0x9da1('0x26')]=_[_0x9da1('0x2d')](_0x25afb2['query']);_0x1d4552[_0x9da1('0x3d')]=_['intersection'](_0x1d4552['model'],_0x1d4552['query']);_0xe8b0a5[_0x9da1('0x30')]=_[_0x9da1('0x2e')](_0x1d4552[_0x9da1('0x2f')],qs[_0x9da1('0x3e')](_0x25afb2[_0x9da1('0x26')][_0x9da1('0x3e')]));_0xe8b0a5[_0x9da1('0x30')]=_0xe8b0a5[_0x9da1('0x30')][_0x9da1('0x3f')]?_0xe8b0a5[_0x9da1('0x30')]:_0x1d4552[_0x9da1('0x2f')];_0xe8b0a5['order']=qs['sort'](_0x25afb2['query'][_0x9da1('0x42')]);_0xe8b0a5[_0x9da1('0x24')]=qs['filters'](_[_0x9da1('0x4e')](_0x25afb2[_0x9da1('0x26')],_0x1d4552[_0x9da1('0x3d')]));if(_0x25afb2[_0x9da1('0x26')][_0x9da1('0x44')]){_0xe8b0a5[_0x9da1('0x24')]=_[_0x9da1('0x32')](_0xe8b0a5[_0x9da1('0x24')],{'$or':_['map'](_0xe8b0a5[_0x9da1('0x30')],function(_0x25fd3d){var _0x1eda44={};_0x1eda44[_0x25fd3d]={'$like':'%'+_0x25afb2[_0x9da1('0x26')][_0x9da1('0x44')]+'%'};return _0x1eda44;})});}_0xe8b0a5=_['merge']({},_0xe8b0a5,_0x25afb2[_0x9da1('0x33')]);return _0x4fe1ff['getAgents'](_0xe8b0a5);}})[_0x9da1('0x16')](function(_0x3516dc){if(_0x3516dc){_0x329d99=_0x3516dc[_0x9da1('0x3f')];if(!_0x25afb2['query']['hasOwnProperty'](_0x9da1('0x4f'))){_0xe8b0a5[_0x9da1('0x11')]=qs[_0x9da1('0x11')](_0x25afb2['query'][_0x9da1('0x11')]);_0xe8b0a5[_0x9da1('0x40')]=qs['offset'](_0x25afb2[_0x9da1('0x26')][_0x9da1('0x40')]);}return _0x4fe1ff['getAgents'](_0xe8b0a5);}})['then'](function(_0x489b3f){if(_0x489b3f){return _0x489b3f?{'count':_0x329d99,'rows':_0x489b3f}:null;}})[_0x9da1('0x16')](respondWithResult(_0x5e71f5,null))['catch'](handleError(_0x5e71f5,null));}; \ No newline at end of file +var _0xf03a=['Team','User','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','pick','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','update','then','get','FaxQueues','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','fields','attributes','length','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','sort','FaxQueueId','filter','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','order','addTeams','ids'];(function(_0x205b1c,_0x51c033){var _0x1605ac=function(_0x3b6895){while(--_0x3b6895){_0x205b1c['push'](_0x205b1c['shift']());}};_0x1605ac(++_0x51c033);}(_0xf03a,0x1a0));var _0xaf03=function(_0x40ef83,_0x5eb7b7){_0x40ef83=_0x40ef83-0x0;var _0x1a4853=_0xf03a[_0x40ef83];return _0x1a4853;};'use strict';var BPromise=require('bluebird');var util=require(_0xaf03('0x0'));var _=require(_0xaf03('0x1'));var squel=require(_0xaf03('0x2'));var Redis=require(_0xaf03('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xaf03('0x4'))(_0xaf03('0x5'));var config=require('../../config/environment');var db=require(_0xaf03('0x6'))['db'];config[_0xaf03('0x7')]=_[_0xaf03('0x8')](config[_0xaf03('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf03('0x9'))(new Redis(config['redis']));require(_0xaf03('0xa'))[_0xaf03('0xb')](socket);function respondWithStatusCode(_0x33a463,_0x28127e){_0x28127e=_0x28127e||0xcc;return function(_0x2e1964){if(_0x2e1964){return _0x33a463[_0xaf03('0xc')](_0x28127e);}return _0x33a463['status'](_0x28127e)[_0xaf03('0xd')]();};}function respondWithResult(_0x12e1a1,_0x4766d1){_0x4766d1=_0x4766d1||0xc8;return function(_0x33803e){if(_0x33803e){return _0x12e1a1[_0xaf03('0xe')](_0x4766d1)['json'](_0x33803e);}};}function respondWithFilteredResult(_0x1bc5a0,_0xa7a11c){return function(_0x2254d4){if(_0x2254d4){var _0x44255a=typeof _0xa7a11c[_0xaf03('0xf')]===_0xaf03('0x10')&&typeof _0xa7a11c[_0xaf03('0x11')]==='undefined';var _0x583919=_0x2254d4[_0xaf03('0x12')];var _0x525cfb=_0x44255a?0x0:_0xa7a11c[_0xaf03('0xf')];var _0x550e22=_0x44255a?_0x2254d4['count']:_0xa7a11c[_0xaf03('0xf')]+_0xa7a11c[_0xaf03('0x11')];var _0x38ca61;if(_0x550e22>=_0x583919){_0x550e22=_0x583919;_0x38ca61=0xc8;}else{_0x38ca61=0xce;}_0x1bc5a0[_0xaf03('0xe')](_0x38ca61);return _0x1bc5a0[_0xaf03('0x13')](_0xaf03('0x14'),_0x525cfb+'-'+_0x550e22+'/'+_0x583919)['json'](_0x2254d4);}return null;};}function saveUpdates(_0xcdc24){return function(_0x136ad9){if(_0x136ad9){return _0x136ad9[_0xaf03('0x15')](_0xcdc24)[_0xaf03('0x16')](function(_0x24a074){return _0x24a074;});}return null;};}function removeEntity(_0x27e625){return function(_0x5cede9){if(_0x5cede9){return _0x5cede9['destroy']()[_0xaf03('0x16')](function(){var _0xe4690a=_0x5cede9[_0xaf03('0x17')]({'plain':!![]});var _0xfe3672=_0xaf03('0x18');return db['UserProfileResource'][_0xaf03('0x19')]({'where':{'type':_0xfe3672,'resourceId':_0xe4690a['id']}})['then'](function(){return _0x5cede9;});})[_0xaf03('0x16')](function(){_0x27e625[_0xaf03('0xe')](0xcc)[_0xaf03('0xd')]();});}};}function handleEntityNotFound(_0x1f93c4){return function(_0x2962f5){if(!_0x2962f5){_0x1f93c4[_0xaf03('0xc')](0x194);}return _0x2962f5;};}function handleError(_0x230dd7,_0x1cefca){_0x1cefca=_0x1cefca||0x1f4;return function(_0x32370d){logger[_0xaf03('0x1a')](_0x32370d[_0xaf03('0x1b')]);if(_0x32370d['name']){delete _0x32370d[_0xaf03('0x1c')];}_0x230dd7[_0xaf03('0xe')](_0x1cefca)[_0xaf03('0x1d')](_0x32370d);};}exports[_0xaf03('0x1e')]=function(_0x4ef6cc,_0x5ea8c8){var _0x38aa61={};var _0x382e43={'count':0x0,'rows':[]};var _0x4db61b=_[_0xaf03('0x1f')](db[_0xaf03('0x20')][_0xaf03('0x21')],function(_0x1b1ac8){return{'name':_0x1b1ac8[_0xaf03('0x22')],'type':_0x1b1ac8[_0xaf03('0x23')]['key']};});_0x38aa61=qs['getOptions'](_0x4db61b,_0x4ef6cc);var _0x898120={'where':_0x38aa61[_0xaf03('0x24')]};return db[_0xaf03('0x20')][_0xaf03('0x12')](_0x898120)[_0xaf03('0x16')](function(_0x3a74b9){_0x382e43[_0xaf03('0x12')]=_0x3a74b9;_0x38aa61[_0xaf03('0x25')]=qs[_0xaf03('0x25')](_0x4ef6cc[_0xaf03('0x26')]);return db[_0xaf03('0x20')][_0xaf03('0x27')](_0x38aa61);})[_0xaf03('0x16')](function(_0x5be2ab){_0x382e43[_0xaf03('0x28')]=_0x5be2ab;return _0x382e43;})[_0xaf03('0x16')](respondWithFilteredResult(_0x5ea8c8,_0x38aa61))['catch'](handleError(_0x5ea8c8,null));};exports[_0xaf03('0x29')]=function(_0x480a3b,_0xfdaeb8){var _0xced6d0={'raw':!![],'where':{'id':_0x480a3b[_0xaf03('0x2a')]['id']}},_0x1bef3e={};_0x1bef3e[_0xaf03('0x2b')]=_[_0xaf03('0x2c')](db['FaxQueue'][_0xaf03('0x21')]);_0x1bef3e['query']=_[_0xaf03('0x2c')](_0x480a3b[_0xaf03('0x26')]);_0x1bef3e[_0xaf03('0x2d')]=_[_0xaf03('0x2e')](_0x1bef3e['model'],_0x1bef3e['query']);_0xced6d0['attributes']=_[_0xaf03('0x2e')](_0x1bef3e[_0xaf03('0x2b')],qs[_0xaf03('0x2f')](_0x480a3b[_0xaf03('0x26')]['fields']));_0xced6d0[_0xaf03('0x30')]=_0xced6d0[_0xaf03('0x30')][_0xaf03('0x31')]?_0xced6d0[_0xaf03('0x30')]:_0x1bef3e['model'];if(_0x480a3b[_0xaf03('0x26')]['includeAll']){_0xced6d0[_0xaf03('0x25')]=[{'all':!![]}];}_0xced6d0=_[_0xaf03('0x32')]({},_0xced6d0,_0x480a3b[_0xaf03('0x33')]);return db[_0xaf03('0x20')][_0xaf03('0x34')](_0xced6d0)[_0xaf03('0x16')](handleEntityNotFound(_0xfdaeb8,null))[_0xaf03('0x16')](respondWithResult(_0xfdaeb8,null))[_0xaf03('0x35')](handleError(_0xfdaeb8,null));};exports[_0xaf03('0x36')]=function(_0x5be50c,_0x2a72fd){return db[_0xaf03('0x20')][_0xaf03('0x36')](_0x5be50c[_0xaf03('0x37')],{})[_0xaf03('0x16')](function(_0x4e72e0){var _0x2e22c8=_0x5be50c['user'][_0xaf03('0x17')]({'plain':!![]});if(!_0x2e22c8)throw new Error(_0xaf03('0x38'));if(_0x2e22c8[_0xaf03('0x39')]===_0xaf03('0x3a')){var _0x4d25b8=_0x4e72e0[_0xaf03('0x17')]({'plain':!![]});var _0x369c20=_0xaf03('0x18');return db[_0xaf03('0x3b')][_0xaf03('0x34')]({'where':{'name':_0x369c20,'userProfileId':_0x2e22c8[_0xaf03('0x3c')]},'raw':!![]})[_0xaf03('0x16')](function(_0x49236c){if(_0x49236c&&_0x49236c['autoAssociation']===0x0){return db[_0xaf03('0x3d')]['create']({'name':_0x4d25b8[_0xaf03('0x1c')],'resourceId':_0x4d25b8['id'],'type':_0x49236c[_0xaf03('0x1c')],'sectionId':_0x49236c['id']},{})[_0xaf03('0x16')](function(){return _0x4e72e0;});}else{return _0x4e72e0;}})[_0xaf03('0x35')](function(_0x184a88){logger['error'](_0xaf03('0x3e'),_0x184a88);throw _0x184a88;});}return _0x4e72e0;})[_0xaf03('0x16')](respondWithResult(_0x2a72fd,0xc9))[_0xaf03('0x35')](handleError(_0x2a72fd,null));};exports[_0xaf03('0x15')]=function(_0x11c11e,_0x27ad10){if(_0x11c11e[_0xaf03('0x37')]['id']){delete _0x11c11e[_0xaf03('0x37')]['id'];}return db['FaxQueue'][_0xaf03('0x34')]({'where':{'id':_0x11c11e[_0xaf03('0x2a')]['id']}})[_0xaf03('0x16')](handleEntityNotFound(_0x27ad10,null))[_0xaf03('0x16')](saveUpdates(_0x11c11e['body'],null))[_0xaf03('0x16')](respondWithResult(_0x27ad10,null))[_0xaf03('0x35')](handleError(_0x27ad10,null));};exports[_0xaf03('0x19')]=function(_0x3150bf,_0x114792){return db[_0xaf03('0x20')]['find']({'where':{'id':_0x3150bf[_0xaf03('0x2a')]['id']}})[_0xaf03('0x16')](handleEntityNotFound(_0x114792,null))[_0xaf03('0x16')](removeEntity(_0x114792,null))[_0xaf03('0x35')](handleError(_0x114792,null));};exports['describe']=function(_0x246c6d,_0x2feb43){return db[_0xaf03('0x20')][_0xaf03('0x3f')]()[_0xaf03('0x16')](respondWithResult(_0x2feb43,null))[_0xaf03('0x35')](handleError(_0x2feb43,null));};exports[_0xaf03('0x40')]=function(_0x492759,_0x11cf1b){var _0x4466bc={'raw':!![],'where':{}},_0xc100cf={},_0x3cf586;return db['FaxQueue'][_0xaf03('0x41')]({'where':{'id':_0x492759['params']['id']}})['then'](handleEntityNotFound(_0x11cf1b,null))[_0xaf03('0x16')](function(_0x15fe5e){if(_0x15fe5e){_0x3cf586=_0x15fe5e[_0xaf03('0x17')]({'plain':!![]});_0xc100cf['model']=_[_0xaf03('0x2c')](db[_0xaf03('0x42')]['rawAttributes']);_0xc100cf['query']=_[_0xaf03('0x2c')](_0x492759[_0xaf03('0x26')]);_0xc100cf[_0xaf03('0x2d')]=_[_0xaf03('0x2e')](_0xc100cf[_0xaf03('0x2b')],_0xc100cf[_0xaf03('0x26')]);_0x4466bc[_0xaf03('0x30')]=_['intersection'](_0xc100cf[_0xaf03('0x2b')],qs['fields'](_0x492759['query'][_0xaf03('0x2f')]));_0x4466bc[_0xaf03('0x30')]=_0x4466bc[_0xaf03('0x30')][_0xaf03('0x31')]?_0x4466bc['attributes']:_0xc100cf[_0xaf03('0x2b')];if(!_0x492759[_0xaf03('0x26')][_0xaf03('0x43')](_0xaf03('0x44'))){_0x4466bc[_0xaf03('0x11')]=qs[_0xaf03('0x11')](_0x492759[_0xaf03('0x26')][_0xaf03('0x11')]);_0x4466bc[_0xaf03('0xf')]=qs[_0xaf03('0xf')](_0x492759[_0xaf03('0x26')][_0xaf03('0xf')]);}_0x4466bc['order']=qs[_0xaf03('0x45')](_0x492759['query']['sort']);_0x4466bc['where']=qs[_0xaf03('0x2d')](_['pick'](_0x492759['query'],_0xc100cf[_0xaf03('0x2d')]));_0x4466bc[_0xaf03('0x24')][_0xaf03('0x46')]=_0x15fe5e['id'];if(_0x492759[_0xaf03('0x26')][_0xaf03('0x47')]){_0x4466bc[_0xaf03('0x24')]=_[_0xaf03('0x32')](_0x4466bc[_0xaf03('0x24')],{'$or':_['map'](_0x4466bc[_0xaf03('0x30')],function(_0x3a4207){var _0xf8e158={};_0xf8e158[_0x3a4207]={'$like':'%'+_0x492759['query'][_0xaf03('0x47')]+'%'};return _0xf8e158;})});}_0x4466bc=_[_0xaf03('0x32')]({},_0x4466bc,_0x492759[_0xaf03('0x33')]);return db[_0xaf03('0x42')]['findAll'](_0x4466bc);}})[_0xaf03('0x16')](function(_0x18aea4){if(_0x18aea4){return db['User'][_0xaf03('0x48')]({'where':{'id':_[_0xaf03('0x1f')](_0x18aea4,_0xaf03('0x49')),'role':'agent'},'attributes':['id',_0xaf03('0x1c'),_0xaf03('0x4a'),_0xaf03('0x4b'),_0xaf03('0x4c')]});}})[_0xaf03('0x16')](function(_0x481aa4){if(_0x481aa4){return{'count':_0x481aa4[_0xaf03('0x12')],'rows':_[_0xaf03('0x1f')](_0x481aa4[_0xaf03('0x28')],function(_0x5d7043){return{'membername':_0x5d7043['name'],'UserId':_0x5d7043['id'],'queue_name':_0x3cf586[_0xaf03('0x1c')],'FaxQueueId':_0x3cf586['id'],'interface':util[_0xaf03('0x4d')](_0xaf03('0x4e'),_0xaf03('0x4f'),_0x5d7043[_0xaf03('0x1c')]),'penalty':0x0,'paused':_0x5d7043[_0xaf03('0x4a')],'createdAt':_0x5d7043['createdAt'],'updatedAt':_0x5d7043[_0xaf03('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf03('0x16')](respondWithFilteredResult(_0x11cf1b,_0x4466bc))['catch'](handleError(_0x11cf1b,null));};exports[_0xaf03('0x50')]=function(_0x490c63,_0x40e115){var _0x54034b={};var _0x342201={};var _0x47d9c6;var _0x4bcfdd;return db[_0xaf03('0x20')][_0xaf03('0x41')]({'where':{'id':_0x490c63[_0xaf03('0x2a')]['id']}})[_0xaf03('0x16')](handleEntityNotFound(_0x40e115,null))[_0xaf03('0x16')](function(_0x2a7e4d){if(_0x2a7e4d){_0x47d9c6=_0x2a7e4d;_0x342201[_0xaf03('0x2b')]=_[_0xaf03('0x2c')](db['Team'][_0xaf03('0x21')]);_0x342201[_0xaf03('0x26')]=_['keys'](_0x490c63['query']);_0x342201['filters']=_['intersection'](_0x342201[_0xaf03('0x2b')],_0x342201[_0xaf03('0x26')]);_0x54034b[_0xaf03('0x30')]=_[_0xaf03('0x2e')](_0x342201[_0xaf03('0x2b')],qs['fields'](_0x490c63[_0xaf03('0x26')]['fields']));_0x54034b[_0xaf03('0x30')]=_0x54034b[_0xaf03('0x30')]['length']?_0x54034b[_0xaf03('0x30')]:_0x342201[_0xaf03('0x2b')];_0x54034b[_0xaf03('0x51')]=qs['sort'](_0x490c63[_0xaf03('0x26')][_0xaf03('0x45')]);_0x54034b['where']=qs[_0xaf03('0x2d')](_['pick'](_0x490c63[_0xaf03('0x26')],_0x342201[_0xaf03('0x2d')]));if(_0x490c63[_0xaf03('0x26')][_0xaf03('0x47')]){_0x54034b['where']=_['merge'](_0x54034b[_0xaf03('0x24')],{'$or':_['map'](_0x54034b[_0xaf03('0x30')],function(_0x17cf6e){var _0x43e5cd={};_0x43e5cd[_0x17cf6e]={'$like':'%'+_0x490c63[_0xaf03('0x26')]['filter']+'%'};return _0x43e5cd;})});}_0x54034b=_['merge']({},_0x54034b,_0x490c63['options']);return _0x47d9c6[_0xaf03('0x50')](_0x54034b);}})[_0xaf03('0x16')](function(_0x163ee4){if(_0x163ee4){_0x4bcfdd=_0x163ee4[_0xaf03('0x31')];if(!_0x490c63[_0xaf03('0x26')][_0xaf03('0x43')]('nolimit')){_0x54034b[_0xaf03('0x11')]=qs[_0xaf03('0x11')](_0x490c63['query'][_0xaf03('0x11')]);_0x54034b['offset']=qs['offset'](_0x490c63[_0xaf03('0x26')]['offset']);}return _0x47d9c6[_0xaf03('0x50')](_0x54034b);}})[_0xaf03('0x16')](function(_0x246b32){if(_0x246b32){return _0x246b32?{'count':_0x4bcfdd,'rows':_0x246b32}:null;}})[_0xaf03('0x16')](respondWithResult(_0x40e115,null))['catch'](handleError(_0x40e115,null));};exports[_0xaf03('0x52')]=function(_0x183146,_0x1e0c95){var _0x13484b=_0x183146['body'][_0xaf03('0x53')];return db[_0xaf03('0x54')][_0xaf03('0x27')]({'where':{'id':_0x13484b},'attributes':['id'],'include':[{'model':db[_0xaf03('0x55')],'as':_0xaf03('0x56'),'attributes':['id',_0xaf03('0x1c'),'online',_0xaf03('0x57'),_0xaf03('0x58')],'raw':!![]}]})[_0xaf03('0x16')](function(_0x6780dd){if(_0x6780dd){var _0x282c54=_['flatMap'](_0x6780dd,function(_0x2faabe){var _0x5972e5=_0x2faabe[_0xaf03('0x17')]({'plain':!![]});return _0x5972e5[_0xaf03('0x56')];});return db[_0xaf03('0x20')][_0xaf03('0x34')]({'where':{'id':_0x183146[_0xaf03('0x2a')]['id']}})[_0xaf03('0x16')](function(_0x4dd99b){return db[_0xaf03('0x59')][_0xaf03('0x5a')](function(_0x505e5d){return _0x4dd99b[_0xaf03('0x52')](_0x13484b,{'transaction':_0x505e5d})[_0xaf03('0x16')](function(){return BPromise[_0xaf03('0x5b')](_0x282c54,function(_0x40bee5){return db['UserFaxQueue'][_0xaf03('0x5c')]({'where':{'UserId':_0x40bee5['id'],'FaxQueueId':_0x183146['params']['id']},'transaction':_0x505e5d});});})['then'](function(){_0x282c54[_0xaf03('0x5d')](function(_0x10ac09){socket[_0xaf03('0x5e')](_0xaf03('0x5f'),{'UserId':_0x10ac09['id'],'FaxQueueId':_0x4dd99b['id']});});});});});}})['then'](respondWithStatusCode(_0x1e0c95,null))['catch'](handleError(_0x1e0c95,null));};exports[_0xaf03('0x60')]=function(_0x1d73dc,_0x209a45){return db[_0xaf03('0x54')][_0xaf03('0x27')]({'where':{'id':_0x1d73dc[_0xaf03('0x26')][_0xaf03('0x53')]},'attributes':['id'],'include':[{'model':db[_0xaf03('0x55')],'as':_0xaf03('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x209a45,null))[_0xaf03('0x16')](function(_0x42c3aa){var _0xead01e=_[_0xaf03('0x1f')](_0x42c3aa,'id');var _0x3fcef3=[];var _0x423e1f=[];var _0x236f11=squel[_0xaf03('0x61')]();_0x236f11[_0xaf03('0x62')](_0xaf03('0x63'))[_0xaf03('0x64')](_0xaf03('0x65'),'tq')[_0xaf03('0x66')]('user_has_teams','ut',_0xaf03('0x67'))[_0xaf03('0x24')](_0xaf03('0x68'),_0x1d73dc[_0xaf03('0x2a')]['id']);for(var _0x403b48=0x0;_0x403b48<_0x42c3aa[_0xaf03('0x31')];_0x403b48+=0x1){let _0x31b476=_0x42c3aa[_0x403b48];for(var _0x3feeff=0x0;_0x3feeff<_0x31b476[_0xaf03('0x56')]['length'];_0x3feeff+=0x1){let _0x52c653=_0x31b476[_0xaf03('0x56')][_0x3feeff];var _0x4fd9b6=_0x236f11[_0xaf03('0x69')]();_0x4fd9b6['where'](_0xaf03('0x6a'),_0x52c653['id']);_0x423e1f[_0xaf03('0x6b')](db[_0xaf03('0x59')]['query'](_0x4fd9b6[_0xaf03('0x6c')](),{'type':db[_0xaf03('0x59')]['QueryTypes'][_0xaf03('0x6d')]})[_0xaf03('0x16')](function(_0x1ec879){if(_0x1ec879[_0xaf03('0x31')]===0x1){return _0x52c653['id'];}else{var _0x377f87=_[_0xaf03('0x6e')](_['map'](_0x1ec879,_0xaf03('0x6f')),function(_0x7aa07c){return _[_0xaf03('0x70')](_0xead01e,_0x7aa07c);});if(_0x377f87){return _0x52c653['id'];}}}));}}return BPromise[_0xaf03('0x71')](_0x423e1f)[_0xaf03('0x16')](function(_0x3afa23){_0x3fcef3=_(_0x3fcef3)[_0xaf03('0x72')](_0x3afa23)[_0xaf03('0x73')]()[_0xaf03('0x74')]();return db[_0xaf03('0x20')][_0xaf03('0x34')]({'where':{'id':_0x1d73dc[_0xaf03('0x2a')]['id']}})['then'](function(_0x280da1){return db['sequelize'][_0xaf03('0x5a')](function(_0x1af5cb){return _0x280da1[_0xaf03('0x60')](_0x1d73dc[_0xaf03('0x26')][_0xaf03('0x53')],{'transaction':_0x1af5cb})['then'](function(){if(!_['isEmpty'](_0x3fcef3)){return _0x280da1[_0xaf03('0x75')](_0x3fcef3,{'transaction':_0x1af5cb});}})[_0xaf03('0x16')](function(){_0x3fcef3[_0xaf03('0x5d')](function(_0x4a9003){socket[_0xaf03('0x5e')]('userFaxQueue:remove',{'UserId':_0x4a9003,'FaxQueueId':_0x280da1['id']});});});});});});})['then'](respondWithStatusCode(_0x209a45,null))[_0xaf03('0x35')](handleError(_0x209a45,null));};exports['addAgents']=function(_0x246101,_0x3c0f93){return db['FaxQueue'][_0xaf03('0x34')]({'where':{'id':_0x246101[_0xaf03('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3c0f93,null))[_0xaf03('0x16')](function(_0x511d6f){if(_0x511d6f){return _0x511d6f[_0xaf03('0x76')](_0x246101[_0xaf03('0x37')]['ids'],_[_0xaf03('0x77')](_0x246101[_0xaf03('0x37')],[_0xaf03('0x53'),'id'])||{})[_0xaf03('0x78')](function(_0x38ba93){for(var _0x24c160=0x0;_0x24c160<_0x246101[_0xaf03('0x37')][_0xaf03('0x53')][_0xaf03('0x31')];_0x24c160+=0x1){socket['emit'](_0xaf03('0x5f'),{'UserId':Number(_0x246101[_0xaf03('0x37')]['ids'][_0x24c160]),'FaxQueueId':Number(_0x246101[_0xaf03('0x2a')]['id'])});}return _0x38ba93;});}})[_0xaf03('0x16')](respondWithResult(_0x3c0f93,null))[_0xaf03('0x35')](handleError(_0x3c0f93,null));};exports[_0xaf03('0x75')]=function(_0x28d4de,_0x550ea9){return db[_0xaf03('0x20')][_0xaf03('0x34')]({'where':{'id':_0x28d4de[_0xaf03('0x2a')]['id']}})[_0xaf03('0x16')](handleEntityNotFound(_0x550ea9,null))['then'](function(_0x2af7f0){if(_0x2af7f0){return _0x2af7f0[_0xaf03('0x75')](_0x28d4de[_0xaf03('0x26')][_0xaf03('0x53')])['then'](function(){if(_[_0xaf03('0x79')](_0x28d4de[_0xaf03('0x26')]['ids'])){for(var _0x3924b6=0x0;_0x3924b6<_0x28d4de[_0xaf03('0x26')]['ids'][_0xaf03('0x31')];_0x3924b6+=0x1){socket[_0xaf03('0x5e')]('userFaxQueue:remove',{'UserId':Number(_0x28d4de[_0xaf03('0x26')][_0xaf03('0x53')][_0x3924b6]),'FaxQueueId':Number(_0x28d4de['params']['id'])});}}else{socket['emit'](_0xaf03('0x7a'),{'UserId':Number(_0x28d4de[_0xaf03('0x26')][_0xaf03('0x53')]),'FaxQueueId':Number(_0x28d4de[_0xaf03('0x2a')]['id'])});}});}})[_0xaf03('0x16')](respondWithStatusCode(_0x550ea9,null))[_0xaf03('0x35')](handleError(_0x550ea9,null));};exports['getAgents']=function(_0xb193c7,_0x2d245f){var _0x359ef7={};var _0x522afe={};var _0x24f1b1;var _0x52d23f;return db[_0xaf03('0x20')][_0xaf03('0x41')]({'where':{'id':_0xb193c7[_0xaf03('0x2a')]['id']}})[_0xaf03('0x16')](handleEntityNotFound(_0x2d245f,null))[_0xaf03('0x16')](function(_0x26551a){if(_0x26551a){_0x24f1b1=_0x26551a;_0x522afe['model']=_[_0xaf03('0x2c')](db[_0xaf03('0x55')][_0xaf03('0x21')]);_0x522afe[_0xaf03('0x26')]=_[_0xaf03('0x2c')](_0xb193c7[_0xaf03('0x26')]);_0x522afe[_0xaf03('0x2d')]=_[_0xaf03('0x2e')](_0x522afe[_0xaf03('0x2b')],_0x522afe['query']);_0x359ef7[_0xaf03('0x30')]=_[_0xaf03('0x2e')](_0x522afe[_0xaf03('0x2b')],qs[_0xaf03('0x2f')](_0xb193c7['query'][_0xaf03('0x2f')]));_0x359ef7[_0xaf03('0x30')]=_0x359ef7['attributes'][_0xaf03('0x31')]?_0x359ef7[_0xaf03('0x30')]:_0x522afe[_0xaf03('0x2b')];_0x359ef7[_0xaf03('0x51')]=qs[_0xaf03('0x45')](_0xb193c7[_0xaf03('0x26')][_0xaf03('0x45')]);_0x359ef7['where']=qs[_0xaf03('0x2d')](_[_0xaf03('0x7b')](_0xb193c7['query'],_0x522afe[_0xaf03('0x2d')]));if(_0xb193c7[_0xaf03('0x26')]['filter']){_0x359ef7['where']=_[_0xaf03('0x32')](_0x359ef7['where'],{'$or':_[_0xaf03('0x1f')](_0x359ef7['attributes'],function(_0x16f223){var _0x233695={};_0x233695[_0x16f223]={'$like':'%'+_0xb193c7[_0xaf03('0x26')][_0xaf03('0x47')]+'%'};return _0x233695;})});}_0x359ef7=_[_0xaf03('0x32')]({},_0x359ef7,_0xb193c7[_0xaf03('0x33')]);return _0x24f1b1[_0xaf03('0x7c')](_0x359ef7);}})['then'](function(_0x2c2ca2){if(_0x2c2ca2){_0x52d23f=_0x2c2ca2[_0xaf03('0x31')];if(!_0xb193c7[_0xaf03('0x26')][_0xaf03('0x43')](_0xaf03('0x44'))){_0x359ef7[_0xaf03('0x11')]=qs[_0xaf03('0x11')](_0xb193c7[_0xaf03('0x26')]['limit']);_0x359ef7['offset']=qs[_0xaf03('0xf')](_0xb193c7[_0xaf03('0x26')]['offset']);}return _0x24f1b1[_0xaf03('0x7c')](_0x359ef7);}})[_0xaf03('0x16')](function(_0x3f63c1){if(_0x3f63c1){return _0x3f63c1?{'count':_0x52d23f,'rows':_0x3f63c1}:null;}})['then'](respondWithResult(_0x2d245f,null))['catch'](handleError(_0x2d245f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 52c2e8a..f348ae5 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 _0x26f9=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x39a04c,_0x2b4002){var _0x580cb0=function(_0x138902){while(--_0x138902){_0x39a04c['push'](_0x39a04c['shift']());}};_0x580cb0(++_0x2b4002);}(_0x26f9,0x169));var _0x926f=function(_0x2212d3,_0x324f32){_0x2212d3=_0x2212d3-0x0;var _0x51c05d=_0x26f9[_0x2212d3];return _0x51c05d;};'use strict';var EventEmitter=require(_0x926f('0x0'));var FaxQueue=require(_0x926f('0x1'))['db'][_0x926f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x926f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x926f('0x4'),'afterDestroy':_0x926f('0x5')};function emitEvent(_0x39b052){return function(_0x236e8d,_0x5502c6,_0x409981){FaxQueueEvents[_0x926f('0x6')](_0x39b052+':'+_0x236e8d['id'],_0x236e8d);FaxQueueEvents[_0x926f('0x6')](_0x39b052,_0x236e8d);_0x409981(null);};}for(var e in events){if(events[_0x926f('0x7')](e)){var event=events[e];FaxQueue[_0x926f('0x8')](e,emitEvent(event));}}module[_0x926f('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x2281=['FaxQueue','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2281,0x85));var _0x1228=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2281[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x1228('0x0'));var FaxQueue=require(_0x1228('0x1'))['db'][_0x1228('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1228('0x3'),'afterUpdate':'update','afterDestroy':_0x1228('0x4')};function emitEvent(_0x1a2fb6){return function(_0x92ecd7,_0x4a19b3,_0x2a610e){FaxQueueEvents['emit'](_0x1a2fb6+':'+_0x92ecd7['id'],_0x92ecd7);FaxQueueEvents[_0x1228('0x5')](_0x1a2fb6,_0x92ecd7);_0x2a610e(null);};}for(var e in events){if(events[_0x1228('0x6')](e)){var event=events[e];FaxQueue[_0x1228('0x7')](e,emitEvent(event));}}module[_0x1228('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 8ba5b7b..7aaa434 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 _0x529f=['define','FaxQueue','fax_queues','lodash','util','moment','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x500d68,_0x332f52){var _0x54a496=function(_0x354f7a){while(--_0x354f7a){_0x500d68['push'](_0x500d68['shift']());}};_0x54a496(++_0x332f52);}(_0x529f,0xc9));var _0xf529=function(_0x5b44e5,_0x5e894f){_0x5b44e5=_0x5b44e5-0x0;var _0x233f61=_0x529f[_0x5b44e5];return _0x233f61;};'use strict';var _=require(_0xf529('0x0'));var util=require(_0xf529('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf529('0x2'));var BPromise=require('bluebird');var rp=require(_0xf529('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf529('0x4'));var config=require(_0xf529('0x5'));var attributes=require(_0xf529('0x6'));module[_0xf529('0x7')]=function(_0x41a415,_0x3e1f9a){return _0x41a415[_0xf529('0x8')](_0xf529('0x9'),attributes,{'tableName':_0xf529('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03fb=['../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x03fb,0x7b));var _0xb03f=function(_0x5c118f,_0x31b475){_0x5c118f=_0x5c118f-0x0;var _0x1406f8=_0x03fb[_0x5c118f];return _0x1406f8;};'use strict';var _=require(_0xb03f('0x0'));var util=require(_0xb03f('0x1'));var logger=require(_0xb03f('0x2'))(_0xb03f('0x3'));var moment=require(_0xb03f('0x4'));var BPromise=require(_0xb03f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb03f('0x6'));var rimraf=require('rimraf');var config=require(_0xb03f('0x7'));var attributes=require(_0xb03f('0x8'));module[_0xb03f('0x9')]=function(_0x4342c4,_0x52ea94){return _0x4342c4[_0xb03f('0xa')](_0xb03f('0xb'),attributes,{'tableName':_0xb03f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 69608b3..ee30fc1 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 _0xa505=['catch','ShowFaxQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa505,0x1d7));var _0x5a50=function(_0x12f166,_0x941053){_0x12f166=_0x12f166-0x0;var _0x5e197e=_0xa505[_0x12f166];return _0x5e197e;};'use strict';var _=require(_0x5a50('0x0'));var util=require(_0x5a50('0x1'));var moment=require(_0x5a50('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a50('0x3'));var fs=require('fs');var Redis=require(_0x5a50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a50('0x5'));var logger=require(_0x5a50('0x6'))('rpc');var config=require(_0x5a50('0x7'));var jayson=require(_0x5a50('0x8'));var client=jayson[_0x5a50('0x9')]['http']({'port':0x232a});config[_0x5a50('0xa')]=_['defaults'](config['redis'],{'host':_0x5a50('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a50('0xa')]));require(_0x5a50('0xc'))[_0x5a50('0xd')](socket);function respondWithRpcPromise(_0x27894c,_0x4b0131,_0x52f88b){return new BPromise(function(_0x82571,_0x4db96b){return client[_0x5a50('0xe')](_0x27894c,_0x52f88b)[_0x5a50('0xf')](function(_0x31ac04){logger[_0x5a50('0x10')](_0x5a50('0x11'),_0x4b0131,'request\x20sent');logger[_0x5a50('0x12')](_0x5a50('0x13'),_0x4b0131,'request\x20sent',JSON[_0x5a50('0x14')](_0x31ac04));if(_0x31ac04[_0x5a50('0x15')]){if(_0x31ac04[_0x5a50('0x15')][_0x5a50('0x16')]===0x1f4){logger[_0x5a50('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4b0131,_0x31ac04[_0x5a50('0x15')][_0x5a50('0x17')]);return _0x4db96b(_0x31ac04[_0x5a50('0x15')][_0x5a50('0x17')]);}logger[_0x5a50('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4b0131,_0x31ac04[_0x5a50('0x15')][_0x5a50('0x17')]);return _0x82571(_0x31ac04[_0x5a50('0x15')][_0x5a50('0x17')]);}else{logger[_0x5a50('0x10')](_0x5a50('0x11'),_0x4b0131,_0x5a50('0x18'));_0x82571(_0x31ac04[_0x5a50('0x19')][_0x5a50('0x17')]);}})['catch'](function(_0x4f13cc){logger[_0x5a50('0x15')](_0x5a50('0x11'),_0x4b0131,_0x4f13cc);_0x4db96b(_0x4f13cc);});});}exports[_0x5a50('0x1a')]=function(_0x289035){var _0x2efb40=this;return new Promise(function(_0x1b1785,_0x14dbf5){return db[_0x5a50('0x1b')][_0x5a50('0x1c')]({'raw':_0x289035[_0x5a50('0x1d')]?_0x289035[_0x5a50('0x1d')][_0x5a50('0x1e')]===undefined?!![]:![]:!![],'where':_0x289035[_0x5a50('0x1d')]?_0x289035['options'][_0x5a50('0x1f')]||null:null,'attributes':_0x289035[_0x5a50('0x1d')]?_0x289035[_0x5a50('0x1d')][_0x5a50('0x20')]||null:null,'limit':_0x289035['options']?_0x289035[_0x5a50('0x1d')]['limit']||null:null,'include':_0x289035['options']?_0x289035['options'][_0x5a50('0x21')]?_[_0x5a50('0x22')](_0x289035[_0x5a50('0x1d')][_0x5a50('0x21')],function(_0x3f688b){return{'model':db[_0x3f688b['model']],'as':_0x3f688b['as'],'attributes':_0x3f688b['attributes'],'include':_0x3f688b['include']?_[_0x5a50('0x22')](_0x3f688b[_0x5a50('0x21')],function(_0x258f0e){return{'model':db[_0x258f0e[_0x5a50('0x23')]],'as':_0x258f0e['as'],'attributes':_0x258f0e['attributes'],'include':_0x258f0e[_0x5a50('0x21')]?_[_0x5a50('0x22')](_0x258f0e[_0x5a50('0x21')],function(_0x25fc29){return{'model':db[_0x25fc29[_0x5a50('0x23')]],'as':_0x25fc29['as'],'attributes':_0x25fc29[_0x5a50('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xef67ea){logger[_0x5a50('0x10')](_0x5a50('0x1a'),_0x289035);logger['debug'](_0x5a50('0x1a'),_0x289035,JSON[_0x5a50('0x14')](_0xef67ea));_0x1b1785(_0xef67ea);})[_0x5a50('0x24')](function(_0x1f3b5c){logger[_0x5a50('0x15')](_0x5a50('0x1a'),_0x1f3b5c[_0x5a50('0x17')],_0x289035);_0x14dbf5(_0x2efb40[_0x5a50('0x15')](0x1f4,_0x1f3b5c[_0x5a50('0x17')]));});});};exports[_0x5a50('0x25')]=function(_0x3d7e40){var _0x59bcf9=this;return new Promise(function(_0x51cb69,_0x537c9b){return db['FaxQueue'][_0x5a50('0x26')]({'raw':_0x3d7e40[_0x5a50('0x1d')]?_0x3d7e40[_0x5a50('0x1d')][_0x5a50('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d7e40['options']?_0x3d7e40[_0x5a50('0x1d')]['where']||null:null,'attributes':_0x3d7e40['options']?_0x3d7e40[_0x5a50('0x1d')]['attributes']||null:null,'include':_0x3d7e40[_0x5a50('0x1d')]?_0x3d7e40[_0x5a50('0x1d')][_0x5a50('0x21')]?_[_0x5a50('0x22')](_0x3d7e40['options'][_0x5a50('0x21')],function(_0x3e06c1){return{'model':db[_0x3e06c1[_0x5a50('0x23')]],'as':_0x3e06c1['as'],'attributes':_0x3e06c1['attributes'],'include':_0x3e06c1[_0x5a50('0x21')]?_[_0x5a50('0x22')](_0x3e06c1[_0x5a50('0x21')],function(_0x51cc3b){return{'model':db[_0x51cc3b['model']],'as':_0x51cc3b['as'],'attributes':_0x51cc3b[_0x5a50('0x20')],'include':_0x51cc3b[_0x5a50('0x21')]?_['map'](_0x51cc3b['include'],function(_0x2efdb9){return{'model':db[_0x2efdb9[_0x5a50('0x23')]],'as':_0x2efdb9['as'],'attributes':_0x2efdb9[_0x5a50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5a50('0xf')](function(_0x1c9a3e){logger[_0x5a50('0x10')](_0x5a50('0x25'),_0x3d7e40);logger[_0x5a50('0x12')](_0x5a50('0x25'),_0x3d7e40,JSON[_0x5a50('0x14')](_0x1c9a3e));_0x51cb69(_0x1c9a3e);})['catch'](function(_0x1c6487){logger[_0x5a50('0x15')](_0x5a50('0x25'),_0x1c6487['message'],_0x3d7e40);_0x537c9b(_0x59bcf9[_0x5a50('0x15')](0x1f4,_0x1c6487[_0x5a50('0x17')]));});});}; \ No newline at end of file +var _0xb699=['redis','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','info','ShowFaxQueue','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xb699,0x15c));var _0x9b69=function(_0x458ac3,_0x1c09b4){_0x458ac3=_0x458ac3-0x0;var _0x5e337f=_0xb699[_0x458ac3];return _0x5e337f;};'use strict';var _=require(_0x9b69('0x0'));var util=require(_0x9b69('0x1'));var moment=require(_0x9b69('0x2'));var BPromise=require(_0x9b69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b69('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9b69('0x5'));var jayson=require(_0x9b69('0x6'));var client=jayson[_0x9b69('0x7')][_0x9b69('0x8')]({'port':0x232a});config['redis']=_[_0x9b69('0x9')](config['redis'],{'host':_0x9b69('0xa'),'port':0x18eb});var socket=require(_0x9b69('0xb'))(new Redis(config[_0x9b69('0xc')]));require(_0x9b69('0xd'))[_0x9b69('0xe')](socket);function respondWithRpcPromise(_0x5840e3,_0x63adeb,_0x2e927d){return new BPromise(function(_0x1164d8,_0x27fb04){return client[_0x9b69('0xf')](_0x5840e3,_0x2e927d)[_0x9b69('0x10')](function(_0x236e5c){logger['info'](_0x9b69('0x11'),_0x63adeb,_0x9b69('0x12'));logger[_0x9b69('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x63adeb,'request\x20sent',JSON[_0x9b69('0x14')](_0x236e5c));if(_0x236e5c[_0x9b69('0x15')]){if(_0x236e5c[_0x9b69('0x15')][_0x9b69('0x16')]===0x1f4){logger[_0x9b69('0x15')](_0x9b69('0x11'),_0x63adeb,_0x236e5c['error']['message']);return _0x27fb04(_0x236e5c['error'][_0x9b69('0x17')]);}logger[_0x9b69('0x15')](_0x9b69('0x11'),_0x63adeb,_0x236e5c[_0x9b69('0x15')]['message']);return _0x1164d8(_0x236e5c[_0x9b69('0x15')]['message']);}else{logger['info'](_0x9b69('0x11'),_0x63adeb,'request\x20sent');_0x1164d8(_0x236e5c['result']['message']);}})[_0x9b69('0x18')](function(_0xc7b5b4){logger[_0x9b69('0x15')](_0x9b69('0x11'),_0x63adeb,_0xc7b5b4);_0x27fb04(_0xc7b5b4);});});}exports[_0x9b69('0x19')]=function(_0x33894d){var _0x44f29a=this;return new Promise(function(_0x12a2d5,_0x19cc0d){return db[_0x9b69('0x1a')]['findAll']({'raw':_0x33894d[_0x9b69('0x1b')]?_0x33894d[_0x9b69('0x1b')][_0x9b69('0x1c')]===undefined?!![]:![]:!![],'where':_0x33894d[_0x9b69('0x1b')]?_0x33894d[_0x9b69('0x1b')][_0x9b69('0x1d')]||null:null,'attributes':_0x33894d[_0x9b69('0x1b')]?_0x33894d['options'][_0x9b69('0x1e')]||null:null,'limit':_0x33894d[_0x9b69('0x1b')]?_0x33894d['options']['limit']||null:null,'include':_0x33894d[_0x9b69('0x1b')]?_0x33894d[_0x9b69('0x1b')][_0x9b69('0x1f')]?_[_0x9b69('0x20')](_0x33894d['options'][_0x9b69('0x1f')],function(_0x2253d0){return{'model':db[_0x2253d0[_0x9b69('0x21')]],'as':_0x2253d0['as'],'attributes':_0x2253d0[_0x9b69('0x1e')],'include':_0x2253d0[_0x9b69('0x1f')]?_[_0x9b69('0x20')](_0x2253d0[_0x9b69('0x1f')],function(_0x38cb80){return{'model':db[_0x38cb80[_0x9b69('0x21')]],'as':_0x38cb80['as'],'attributes':_0x38cb80[_0x9b69('0x1e')],'include':_0x38cb80[_0x9b69('0x1f')]?_['map'](_0x38cb80['include'],function(_0x3e7d86){return{'model':db[_0x3e7d86[_0x9b69('0x21')]],'as':_0x3e7d86['as'],'attributes':_0x3e7d86['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a81cf){logger[_0x9b69('0x22')]('GetFaxQueue',_0x33894d);logger[_0x9b69('0x13')]('GetFaxQueue',_0x33894d,JSON['stringify'](_0x1a81cf));_0x12a2d5(_0x1a81cf);})[_0x9b69('0x18')](function(_0x4ee5b6){logger[_0x9b69('0x15')](_0x9b69('0x19'),_0x4ee5b6[_0x9b69('0x17')],_0x33894d);_0x19cc0d(_0x44f29a[_0x9b69('0x15')](0x1f4,_0x4ee5b6[_0x9b69('0x17')]));});});};exports[_0x9b69('0x23')]=function(_0x4acda1){var _0x92e7e1=this;return new Promise(function(_0x22d141,_0x339418){return db[_0x9b69('0x1a')]['find']({'raw':_0x4acda1['options']?_0x4acda1[_0x9b69('0x1b')][_0x9b69('0x1c')]===undefined?!![]:![]:!![],'where':_0x4acda1[_0x9b69('0x1b')]?_0x4acda1[_0x9b69('0x1b')][_0x9b69('0x1d')]||null:null,'attributes':_0x4acda1['options']?_0x4acda1['options']['attributes']||null:null,'include':_0x4acda1['options']?_0x4acda1[_0x9b69('0x1b')][_0x9b69('0x1f')]?_[_0x9b69('0x20')](_0x4acda1['options']['include'],function(_0x4340be){return{'model':db[_0x4340be[_0x9b69('0x21')]],'as':_0x4340be['as'],'attributes':_0x4340be[_0x9b69('0x1e')],'include':_0x4340be['include']?_[_0x9b69('0x20')](_0x4340be['include'],function(_0x2dbc3f){return{'model':db[_0x2dbc3f[_0x9b69('0x21')]],'as':_0x2dbc3f['as'],'attributes':_0x2dbc3f[_0x9b69('0x1e')],'include':_0x2dbc3f[_0x9b69('0x1f')]?_[_0x9b69('0x20')](_0x2dbc3f[_0x9b69('0x1f')],function(_0x3da574){return{'model':db[_0x3da574['model']],'as':_0x3da574['as'],'attributes':_0x3da574[_0x9b69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9b69('0x10')](function(_0x526fad){logger[_0x9b69('0x22')](_0x9b69('0x23'),_0x4acda1);logger[_0x9b69('0x13')]('ShowFaxQueue',_0x4acda1,JSON[_0x9b69('0x14')](_0x526fad));_0x22d141(_0x526fad);})['catch'](function(_0x12ac2b){logger[_0x9b69('0x15')](_0x9b69('0x23'),_0x12ac2b['message'],_0x4acda1);_0x339418(_0x92e7e1['error'](0x1f4,_0x12ac2b[_0x9b69('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2a53b7a..d7b31cb 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 _0x8ce1=['./faxQueue.events','save','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x5850b5,_0x4f5185){var _0x4101a4=function(_0x17b705){while(--_0x17b705){_0x5850b5['push'](_0x5850b5['shift']());}};_0x4101a4(++_0x4f5185);}(_0x8ce1,0x183));var _0x18ce=function(_0x5d07aa,_0x61055f){_0x5d07aa=_0x5d07aa-0x0;var _0x16b665=_0x8ce1[_0x5d07aa];return _0x16b665;};'use strict';var FaxQueueEvents=require(_0x18ce('0x0'));var events=[_0x18ce('0x1'),_0x18ce('0x2'),_0x18ce('0x3')];function createListener(_0x202f93,_0x22b196){return function(_0x211dc4){_0x22b196[_0x18ce('0x4')](_0x202f93,_0x211dc4);};}function removeListener(_0x1d842c,_0x15f55e){return function(){FaxQueueEvents[_0x18ce('0x5')](_0x1d842c,_0x15f55e);};}exports[_0x18ce('0x6')]=function(_0x13ff9d){for(var _0x36f8db=0x0,_0x682d4b=events[_0x18ce('0x7')];_0x36f8db<_0x682d4b;_0x36f8db++){var _0x4ebf82=events[_0x36f8db];var _0x1a60c5=createListener(_0x18ce('0x8')+_0x4ebf82,_0x13ff9d);FaxQueueEvents['on'](_0x4ebf82,_0x1a60c5);}}; \ No newline at end of file +var _0xb2ed=['save','remove','update','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0xce6716,_0x3555ad){var _0x38be3a=function(_0xcbed8a){while(--_0xcbed8a){_0xce6716['push'](_0xce6716['shift']());}};_0x38be3a(++_0x3555ad);}(_0xb2ed,0x127));var _0xdb2e=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0xb2ed[_0x1bbc08];return _0x5d825b;};'use strict';var FaxQueueEvents=require(_0xdb2e('0x0'));var events=[_0xdb2e('0x1'),_0xdb2e('0x2'),_0xdb2e('0x3')];function createListener(_0x4bb9b6,_0x367ea6){return function(_0x1b8b66){_0x367ea6['emit'](_0x4bb9b6,_0x1b8b66);};}function removeListener(_0x325f03,_0x293e03){return function(){FaxQueueEvents[_0xdb2e('0x4')](_0x325f03,_0x293e03);};}exports[_0xdb2e('0x5')]=function(_0x2761f1){for(var _0x1dcc25=0x0,_0x4bbcb5=events[_0xdb2e('0x6')];_0x1dcc25<_0x4bbcb5;_0x1dcc25++){var _0x4f3a6a=events[_0x1dcc25];var _0x19147b=createListener(_0xdb2e('0x7')+_0x4f3a6a,_0x2761f1);FaxQueueEvents['on'](_0x4f3a6a,_0x19147b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1157b20..bc7972d 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 _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x7b84,0x17c));var _0x47b8=function(_0x14d7bf,_0x1d9917){_0x14d7bf=_0x14d7bf-0x0;var _0x1d0b69=_0x7b84[_0x14d7bf];return _0x1d0b69;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x17')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0x17')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x17')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1c')]);router[_0x47b8('0x1d')]('/:id',auth[_0x47b8('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1e')]);router[_0x47b8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x47b8('0x1f')]=router; \ No newline at end of file +var _0x96f2=['post','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create'];(function(_0x3173a5,_0x4d7458){var _0x2d4cf4=function(_0x138573){while(--_0x138573){_0x3173a5['push'](_0x3173a5['shift']());}};_0x2d4cf4(++_0x4d7458);}(_0x96f2,0xb0));var _0x296f=function(_0x4eb261,_0x7c7aca){_0x4eb261=_0x4eb261-0x0;var _0x5819aa=_0x96f2[_0x4eb261];return _0x5819aa;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require(_0x296f('0x2'));var express=require(_0x296f('0x3'));var router=express['Router']();var fs_extra=require(_0x296f('0x4'));var auth=require(_0x296f('0x5'));var interaction=require(_0x296f('0x6'));var config=require('../../config/environment');var controller=require(_0x296f('0x7'));router[_0x296f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x296f('0x8')](_0x296f('0x9'),auth[_0x296f('0xa')](),controller[_0x296f('0xb')]);router[_0x296f('0x8')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller[_0x296f('0xd')]);router[_0x296f('0x8')](_0x296f('0xe'),auth['isAuthenticated'](),controller[_0x296f('0xf')]);router[_0x296f('0x8')](_0x296f('0x10'),auth['isAuthenticated'](),controller[_0x296f('0x11')]);router[_0x296f('0x8')](_0x296f('0x12'),auth[_0x296f('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x296f('0x13')]);router[_0x296f('0x14')](_0x296f('0x10'),auth[_0x296f('0xa')](),controller['addTeams']);router[_0x296f('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x296f('0x15')]);router[_0x296f('0x16')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller['update']);router['delete'](_0x296f('0xc'),auth['isAuthenticated'](),controller[_0x296f('0x17')]);router[_0x296f('0x18')](_0x296f('0x10'),auth['isAuthenticated'](),controller[_0x296f('0x19')]);router[_0x296f('0x18')]('/:id/users',auth[_0x296f('0xa')](),controller[_0x296f('0x1a')]);module[_0x296f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index fa47d66..66c6b9a 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 _0x1c7b=['exports','STRING','DATE','moment','sequelize'];(function(_0x412262,_0xc8a3cc){var _0x4d522b=function(_0x3cc4b2){while(--_0x3cc4b2){_0x412262['push'](_0x412262['shift']());}};_0x4d522b(++_0xc8a3cc);}(_0x1c7b,0x1d4));var _0xb1c7=function(_0x4863a2,_0x189822){_0x4863a2=_0x4863a2-0x0;var _0x185578=_0x1c7b[_0x4863a2];return _0x185578;};'use strict';var moment=require(_0xb1c7('0x0'));var Sequelize=require(_0xb1c7('0x1'));module[_0xb1c7('0x2')]={'uniqueid':{'type':Sequelize[_0xb1c7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb1c7('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb1c7('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb1c7('0x3')]}}; \ No newline at end of file +var _0xf9d7=['sequelize','STRING','DATE','moment'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0xf9d7,0x12f));var _0x7f9d=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xf9d7[_0x3f5dca];return _0x5b833a;};'use strict';var moment=require(_0x7f9d('0x0'));var Sequelize=require(_0x7f9d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7f9d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7f9d('0x2')]},'joinAt':{'type':Sequelize[_0x7f9d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7f9d('0x3')]},'exitAt':{'type':Sequelize[_0x7f9d('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 2fb5dad..0be3ac6 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 _0xab26=['request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','FaxQueueReport','rows','show','params','include','options','find','create','catch','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x12f401,_0x4afcc2){var _0x274dd0=function(_0x320699){while(--_0x320699){_0x12f401['push'](_0x12f401['shift']());}};_0x274dd0(++_0x4afcc2);}(_0xab26,0xd2));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x6ab2('0x0'));var rimraf=require(_0x6ab2('0x1'));var zipdir=require(_0x6ab2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ab2('0x3'));var moment=require(_0x6ab2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ab2('0x5'));var path=require('path');var sox=require(_0x6ab2('0x6'));var csv=require(_0x6ab2('0x7'));var ejs=require(_0x6ab2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ab2('0x9'));var squel=require(_0x6ab2('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ab2('0xb'));var deskjs=require(_0x6ab2('0xc'));var toCsv=require(_0x6ab2('0x7'));var querystring=require(_0x6ab2('0xd'));var Papa=require(_0x6ab2('0xe'));var Redis=require(_0x6ab2('0xf'));var authService=require(_0x6ab2('0x10'));var qs=require(_0x6ab2('0x11'));var as=require(_0x6ab2('0x12'));var hardwareService=require(_0x6ab2('0x13'));var logger=require(_0x6ab2('0x14'))('api');var utils=require(_0x6ab2('0x15'));var config=require(_0x6ab2('0x16'));var licenseUtil=require(_0x6ab2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6f7c,_0x10c3b1){_0x10c3b1=_0x10c3b1||0xcc;return function(_0x2bb464){if(_0x2bb464){return _0x5b6f7c[_0x6ab2('0x18')](_0x10c3b1);}return _0x5b6f7c[_0x6ab2('0x19')](_0x10c3b1)[_0x6ab2('0x1a')]();};}function respondWithResult(_0x432df4,_0x9f3aea){_0x9f3aea=_0x9f3aea||0xc8;return function(_0x13d31d){if(_0x13d31d){return _0x432df4['status'](_0x9f3aea)[_0x6ab2('0x1b')](_0x13d31d);}};}function respondWithFilteredResult(_0x55d6f4,_0x1bc335){return function(_0x429aba){if(_0x429aba){var _0x5ced24=typeof _0x1bc335['offset']==='undefined'&&typeof _0x1bc335[_0x6ab2('0x1c')]===_0x6ab2('0x1d');var _0x20f437=_0x429aba[_0x6ab2('0x1e')];var _0x272bd0=_0x5ced24?0x0:_0x1bc335[_0x6ab2('0x1f')];var _0x508376=_0x5ced24?_0x429aba[_0x6ab2('0x1e')]:_0x1bc335[_0x6ab2('0x1f')]+_0x1bc335['limit'];var _0x17f6e0;if(_0x508376>=_0x20f437){_0x508376=_0x20f437;_0x17f6e0=0xc8;}else{_0x17f6e0=0xce;}_0x55d6f4['status'](_0x17f6e0);return _0x55d6f4['set'](_0x6ab2('0x20'),_0x272bd0+'-'+_0x508376+'/'+_0x20f437)[_0x6ab2('0x1b')](_0x429aba);}return null;};}function patchUpdates(_0x2ca855){return function(_0x1851bf){try{jsonpatch[_0x6ab2('0x21')](_0x1851bf,_0x2ca855,!![]);}catch(_0x4a2584){return BPromise[_0x6ab2('0x22')](_0x4a2584);}return _0x1851bf[_0x6ab2('0x23')]();};}function saveUpdates(_0x3b7a1a,_0x3fad2b){return function(_0x25fa3f){if(_0x25fa3f){return _0x25fa3f[_0x6ab2('0x24')](_0x3b7a1a)[_0x6ab2('0x25')](function(_0x2b87a0){return _0x2b87a0;});}return null;};}function removeEntity(_0x2784f8,_0x1caf3d){return function(_0x4fd76d){if(_0x4fd76d){return _0x4fd76d['destroy']()['then'](function(){_0x2784f8[_0x6ab2('0x19')](0xcc)[_0x6ab2('0x1a')]();});}};}function handleEntityNotFound(_0x273aee,_0x4cb5e1){return function(_0x4620f2){if(!_0x4620f2){_0x273aee[_0x6ab2('0x18')](0x194);}return _0x4620f2;};}function handleError(_0x24ece3,_0x17d62d){_0x17d62d=_0x17d62d||0x1f4;return function(_0x573516){logger['error'](_0x573516['stack']);if(_0x573516[_0x6ab2('0x26')]){delete _0x573516['name'];}_0x24ece3['status'](_0x17d62d)[_0x6ab2('0x27')](_0x573516);};}exports[_0x6ab2('0x28')]=function(_0x161165,_0x3bfb16){var _0x22bbb8={},_0x890013={},_0x307beb={'count':0x0,'rows':[]};var _0x3d3fe7=_[_0x6ab2('0x29')](db['FaxQueueReport'][_0x6ab2('0x2a')],function(_0xd9c398){return{'name':_0xd9c398['fieldName'],'type':_0xd9c398[_0x6ab2('0x2b')]['key']};});_0x890013[_0x6ab2('0x2c')]=_[_0x6ab2('0x29')](_0x3d3fe7,_0x6ab2('0x26'));_0x890013[_0x6ab2('0x2d')]=_[_0x6ab2('0x2e')](_0x161165[_0x6ab2('0x2d')]);_0x890013['filters']=_[_0x6ab2('0x2f')](_0x890013[_0x6ab2('0x2c')],_0x890013[_0x6ab2('0x2d')]);_0x22bbb8[_0x6ab2('0x30')]=_[_0x6ab2('0x2f')](_0x890013[_0x6ab2('0x2c')],qs[_0x6ab2('0x31')](_0x161165['query'][_0x6ab2('0x31')]));_0x22bbb8[_0x6ab2('0x30')]=_0x22bbb8['attributes']['length']?_0x22bbb8[_0x6ab2('0x30')]:_0x890013[_0x6ab2('0x2c')];if(!_0x161165[_0x6ab2('0x2d')][_0x6ab2('0x32')](_0x6ab2('0x33'))){_0x22bbb8[_0x6ab2('0x1c')]=qs[_0x6ab2('0x1c')](_0x161165[_0x6ab2('0x2d')]['limit']);_0x22bbb8['offset']=qs[_0x6ab2('0x1f')](_0x161165[_0x6ab2('0x2d')][_0x6ab2('0x1f')]);}_0x22bbb8[_0x6ab2('0x34')]=qs[_0x6ab2('0x35')](_0x161165['query'][_0x6ab2('0x35')]);_0x22bbb8[_0x6ab2('0x36')]=qs[_0x6ab2('0x37')](_['pick'](_0x161165[_0x6ab2('0x2d')],_0x890013[_0x6ab2('0x37')]),_0x3d3fe7);if(_0x161165['query'][_0x6ab2('0x38')]){_0x22bbb8[_0x6ab2('0x36')]=_[_0x6ab2('0x39')](_0x22bbb8[_0x6ab2('0x36')],{'$or':_[_0x6ab2('0x29')](_0x3d3fe7,function(_0xb5afbf){if(_0xb5afbf[_0x6ab2('0x2b')]!=='VIRTUAL'){var _0xdcec9={};_0xdcec9[_0xb5afbf['name']]={'$like':'%'+_0x161165[_0x6ab2('0x2d')][_0x6ab2('0x38')]+'%'};return _0xdcec9;}})});}_0x22bbb8=_[_0x6ab2('0x39')]({},_0x22bbb8,_0x161165['options']);var _0x5630e6={'where':_0x22bbb8[_0x6ab2('0x36')]};return db['FaxQueueReport']['count'](_0x5630e6)[_0x6ab2('0x25')](function(_0xdb02a7){_0x307beb[_0x6ab2('0x1e')]=_0xdb02a7;if(_0x161165[_0x6ab2('0x2d')][_0x6ab2('0x3a')]){_0x22bbb8['include']=[{'all':!![]}];}return db[_0x6ab2('0x3b')]['findAll'](_0x22bbb8);})[_0x6ab2('0x25')](function(_0x1a3b61){_0x307beb[_0x6ab2('0x3c')]=_0x1a3b61;return _0x307beb;})[_0x6ab2('0x25')](respondWithFilteredResult(_0x3bfb16,_0x22bbb8))['catch'](handleError(_0x3bfb16,null));};exports[_0x6ab2('0x3d')]=function(_0x251f3b,_0x39392e){var _0x1cb791={'raw':!![],'where':{'id':_0x251f3b[_0x6ab2('0x3e')]['id']}},_0x12d4b6={};_0x12d4b6[_0x6ab2('0x2c')]=_[_0x6ab2('0x2e')](db[_0x6ab2('0x3b')][_0x6ab2('0x2a')]);_0x12d4b6[_0x6ab2('0x2d')]=_[_0x6ab2('0x2e')](_0x251f3b['query']);_0x12d4b6[_0x6ab2('0x37')]=_[_0x6ab2('0x2f')](_0x12d4b6[_0x6ab2('0x2c')],_0x12d4b6[_0x6ab2('0x2d')]);_0x1cb791[_0x6ab2('0x30')]=_[_0x6ab2('0x2f')](_0x12d4b6['model'],qs[_0x6ab2('0x31')](_0x251f3b[_0x6ab2('0x2d')][_0x6ab2('0x31')]));_0x1cb791[_0x6ab2('0x30')]=_0x1cb791['attributes']['length']?_0x1cb791[_0x6ab2('0x30')]:_0x12d4b6[_0x6ab2('0x2c')];if(_0x251f3b[_0x6ab2('0x2d')][_0x6ab2('0x3a')]){_0x1cb791[_0x6ab2('0x3f')]=[{'all':!![]}];}_0x1cb791=_['merge']({},_0x1cb791,_0x251f3b[_0x6ab2('0x40')]);return db[_0x6ab2('0x3b')][_0x6ab2('0x41')](_0x1cb791)[_0x6ab2('0x25')](handleEntityNotFound(_0x39392e,null))['then'](respondWithResult(_0x39392e,null))['catch'](handleError(_0x39392e,null));};exports[_0x6ab2('0x42')]=function(_0x2deb87,_0x56d800){return db[_0x6ab2('0x3b')]['create'](_0x2deb87['body'],{})['then'](respondWithResult(_0x56d800,0xc9))[_0x6ab2('0x43')](handleError(_0x56d800,null));};exports[_0x6ab2('0x24')]=function(_0x4fffb4,_0x186746){if(_0x4fffb4['body']['id']){delete _0x4fffb4[_0x6ab2('0x44')]['id'];}return db[_0x6ab2('0x3b')][_0x6ab2('0x41')]({'where':{'id':_0x4fffb4[_0x6ab2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x186746,null))[_0x6ab2('0x25')](saveUpdates(_0x4fffb4[_0x6ab2('0x44')],null))[_0x6ab2('0x25')](respondWithResult(_0x186746,null))[_0x6ab2('0x43')](handleError(_0x186746,null));};exports[_0x6ab2('0x45')]=function(_0x301270,_0x27d960){return db['FaxQueueReport'][_0x6ab2('0x41')]({'where':{'id':_0x301270[_0x6ab2('0x3e')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x27d960,null))[_0x6ab2('0x25')](removeEntity(_0x27d960,null))[_0x6ab2('0x43')](handleError(_0x27d960,null));};exports[_0x6ab2('0x46')]=function(_0x4f2a4e,_0x1db491){return db['FaxQueueReport'][_0x6ab2('0x46')]()[_0x6ab2('0x25')](respondWithResult(_0x1db491,null))[_0x6ab2('0x43')](handleError(_0x1db491,null));}; \ No newline at end of file +var _0x86dd=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x2bb9fa,_0x33f63d){var _0x18a068=function(_0x1b89c3){while(--_0x1b89c3){_0x2bb9fa['push'](_0x2bb9fa['shift']());}};_0x18a068(++_0x33f63d);}(_0x86dd,0x1ee));var _0xd86d=function(_0x34df79,_0x593a50){_0x34df79=_0x34df79-0x0;var _0x4f302b=_0x86dd[_0x34df79];return _0x4f302b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd86d('0x1'));var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require(_0xd86d('0x8'));var csv=require(_0xd86d('0x9'));var ejs=require(_0xd86d('0xa'));var fs=require('fs');var fs_extra=require(_0xd86d('0xb'));var _=require(_0xd86d('0xc'));var squel=require('squel');var crypto=require(_0xd86d('0xd'));var jsforce=require(_0xd86d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x9'));var querystring=require(_0xd86d('0xf'));var Papa=require(_0xd86d('0x10'));var Redis=require(_0xd86d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd86d('0x12'));var as=require(_0xd86d('0x13'));var hardwareService=require(_0xd86d('0x14'));var logger=require(_0xd86d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd86d('0x16'));var licenseUtil=require(_0xd86d('0x17'));var db=require(_0xd86d('0x18'))['db'];function respondWithStatusCode(_0x77012b,_0x28a283){_0x28a283=_0x28a283||0xcc;return function(_0x4f911b){if(_0x4f911b){return _0x77012b['sendStatus'](_0x28a283);}return _0x77012b['status'](_0x28a283)[_0xd86d('0x19')]();};}function respondWithResult(_0x2b8ef4,_0x3863a8){_0x3863a8=_0x3863a8||0xc8;return function(_0x13f90e){if(_0x13f90e){return _0x2b8ef4[_0xd86d('0x1a')](_0x3863a8)[_0xd86d('0x1b')](_0x13f90e);}};}function respondWithFilteredResult(_0x3aa815,_0x570ed1){return function(_0x1d2b33){if(_0x1d2b33){var _0x2cc4d9=typeof _0x570ed1[_0xd86d('0x1c')]===_0xd86d('0x1d')&&typeof _0x570ed1[_0xd86d('0x1e')]===_0xd86d('0x1d');var _0x1b176e=_0x1d2b33[_0xd86d('0x1f')];var _0x3086a5=_0x2cc4d9?0x0:_0x570ed1[_0xd86d('0x1c')];var _0x5aabdb=_0x2cc4d9?_0x1d2b33['count']:_0x570ed1[_0xd86d('0x1c')]+_0x570ed1[_0xd86d('0x1e')];var _0xb74a5f;if(_0x5aabdb>=_0x1b176e){_0x5aabdb=_0x1b176e;_0xb74a5f=0xc8;}else{_0xb74a5f=0xce;}_0x3aa815['status'](_0xb74a5f);return _0x3aa815[_0xd86d('0x20')](_0xd86d('0x21'),_0x3086a5+'-'+_0x5aabdb+'/'+_0x1b176e)[_0xd86d('0x1b')](_0x1d2b33);}return null;};}function patchUpdates(_0x5a632c){return function(_0x2caf8b){try{jsonpatch[_0xd86d('0x22')](_0x2caf8b,_0x5a632c,!![]);}catch(_0x5a3b58){return BPromise[_0xd86d('0x23')](_0x5a3b58);}return _0x2caf8b[_0xd86d('0x24')]();};}function saveUpdates(_0x74f57e,_0x539c83){return function(_0x2faef6){if(_0x2faef6){return _0x2faef6[_0xd86d('0x25')](_0x74f57e)[_0xd86d('0x26')](function(_0xb71958){return _0xb71958;});}return null;};}function removeEntity(_0x49845b,_0x2c33f0){return function(_0x3a5799){if(_0x3a5799){return _0x3a5799['destroy']()['then'](function(){_0x49845b['status'](0xcc)[_0xd86d('0x19')]();});}};}function handleEntityNotFound(_0x5d0e0c,_0x158dcb){return function(_0x4b42ca){if(!_0x4b42ca){_0x5d0e0c['sendStatus'](0x194);}return _0x4b42ca;};}function handleError(_0x327a2e,_0x3e4e3f){_0x3e4e3f=_0x3e4e3f||0x1f4;return function(_0x48dd45){logger[_0xd86d('0x27')](_0x48dd45['stack']);if(_0x48dd45[_0xd86d('0x28')]){delete _0x48dd45['name'];}_0x327a2e['status'](_0x3e4e3f)['send'](_0x48dd45);};}exports['index']=function(_0x345bb7,_0x5daa94){var _0x2897b5={},_0x525a87={},_0x3236a4={'count':0x0,'rows':[]};var _0x2fc237=_[_0xd86d('0x29')](db[_0xd86d('0x2a')]['rawAttributes'],function(_0x2be14e){return{'name':_0x2be14e[_0xd86d('0x2b')],'type':_0x2be14e[_0xd86d('0x2c')][_0xd86d('0x2d')]};});_0x525a87[_0xd86d('0x2e')]=_[_0xd86d('0x29')](_0x2fc237,'name');_0x525a87[_0xd86d('0x2f')]=_[_0xd86d('0x30')](_0x345bb7[_0xd86d('0x2f')]);_0x525a87[_0xd86d('0x31')]=_['intersection'](_0x525a87['model'],_0x525a87[_0xd86d('0x2f')]);_0x2897b5['attributes']=_[_0xd86d('0x32')](_0x525a87[_0xd86d('0x2e')],qs[_0xd86d('0x33')](_0x345bb7[_0xd86d('0x2f')]['fields']));_0x2897b5[_0xd86d('0x34')]=_0x2897b5[_0xd86d('0x34')]['length']?_0x2897b5[_0xd86d('0x34')]:_0x525a87[_0xd86d('0x2e')];if(!_0x345bb7[_0xd86d('0x2f')]['hasOwnProperty'](_0xd86d('0x35'))){_0x2897b5['limit']=qs[_0xd86d('0x1e')](_0x345bb7[_0xd86d('0x2f')][_0xd86d('0x1e')]);_0x2897b5[_0xd86d('0x1c')]=qs[_0xd86d('0x1c')](_0x345bb7['query'][_0xd86d('0x1c')]);}_0x2897b5['order']=qs[_0xd86d('0x36')](_0x345bb7['query'][_0xd86d('0x36')]);_0x2897b5[_0xd86d('0x37')]=qs[_0xd86d('0x31')](_[_0xd86d('0x38')](_0x345bb7[_0xd86d('0x2f')],_0x525a87['filters']),_0x2fc237);if(_0x345bb7[_0xd86d('0x2f')]['filter']){_0x2897b5[_0xd86d('0x37')]=_['merge'](_0x2897b5[_0xd86d('0x37')],{'$or':_['map'](_0x2fc237,function(_0x95c82){if(_0x95c82['type']!=='VIRTUAL'){var _0x3f0c60={};_0x3f0c60[_0x95c82[_0xd86d('0x28')]]={'$like':'%'+_0x345bb7[_0xd86d('0x2f')][_0xd86d('0x39')]+'%'};return _0x3f0c60;}})});}_0x2897b5=_['merge']({},_0x2897b5,_0x345bb7['options']);var _0x35c2b6={'where':_0x2897b5[_0xd86d('0x37')]};return db[_0xd86d('0x2a')][_0xd86d('0x1f')](_0x35c2b6)['then'](function(_0x136d9f){_0x3236a4[_0xd86d('0x1f')]=_0x136d9f;if(_0x345bb7[_0xd86d('0x2f')][_0xd86d('0x3a')]){_0x2897b5[_0xd86d('0x3b')]=[{'all':!![]}];}return db[_0xd86d('0x2a')][_0xd86d('0x3c')](_0x2897b5);})[_0xd86d('0x26')](function(_0x5dc07c){_0x3236a4[_0xd86d('0x3d')]=_0x5dc07c;return _0x3236a4;})['then'](respondWithFilteredResult(_0x5daa94,_0x2897b5))[_0xd86d('0x3e')](handleError(_0x5daa94,null));};exports[_0xd86d('0x3f')]=function(_0x3f0bb7,_0x41b49f){var _0x4d2523={'raw':!![],'where':{'id':_0x3f0bb7[_0xd86d('0x40')]['id']}},_0x3fea7c={};_0x3fea7c[_0xd86d('0x2e')]=_[_0xd86d('0x30')](db[_0xd86d('0x2a')][_0xd86d('0x41')]);_0x3fea7c[_0xd86d('0x2f')]=_['keys'](_0x3f0bb7[_0xd86d('0x2f')]);_0x3fea7c[_0xd86d('0x31')]=_[_0xd86d('0x32')](_0x3fea7c[_0xd86d('0x2e')],_0x3fea7c[_0xd86d('0x2f')]);_0x4d2523[_0xd86d('0x34')]=_[_0xd86d('0x32')](_0x3fea7c['model'],qs[_0xd86d('0x33')](_0x3f0bb7[_0xd86d('0x2f')]['fields']));_0x4d2523['attributes']=_0x4d2523['attributes'][_0xd86d('0x42')]?_0x4d2523[_0xd86d('0x34')]:_0x3fea7c['model'];if(_0x3f0bb7[_0xd86d('0x2f')][_0xd86d('0x3a')]){_0x4d2523[_0xd86d('0x3b')]=[{'all':!![]}];}_0x4d2523=_[_0xd86d('0x43')]({},_0x4d2523,_0x3f0bb7[_0xd86d('0x44')]);return db[_0xd86d('0x2a')][_0xd86d('0x45')](_0x4d2523)['then'](handleEntityNotFound(_0x41b49f,null))['then'](respondWithResult(_0x41b49f,null))[_0xd86d('0x3e')](handleError(_0x41b49f,null));};exports[_0xd86d('0x46')]=function(_0x519509,_0x3bc9d3){return db[_0xd86d('0x2a')][_0xd86d('0x46')](_0x519509[_0xd86d('0x47')],{})['then'](respondWithResult(_0x3bc9d3,0xc9))[_0xd86d('0x3e')](handleError(_0x3bc9d3,null));};exports[_0xd86d('0x25')]=function(_0x184e0b,_0x551b49){if(_0x184e0b[_0xd86d('0x47')]['id']){delete _0x184e0b[_0xd86d('0x47')]['id'];}return db[_0xd86d('0x2a')]['find']({'where':{'id':_0x184e0b[_0xd86d('0x40')]['id']}})[_0xd86d('0x26')](handleEntityNotFound(_0x551b49,null))[_0xd86d('0x26')](saveUpdates(_0x184e0b['body'],null))[_0xd86d('0x26')](respondWithResult(_0x551b49,null))[_0xd86d('0x3e')](handleError(_0x551b49,null));};exports['destroy']=function(_0x36d17e,_0x387cdd){return db[_0xd86d('0x2a')][_0xd86d('0x45')]({'where':{'id':_0x36d17e[_0xd86d('0x40')]['id']}})['then'](handleEntityNotFound(_0x387cdd,null))['then'](removeEntity(_0x387cdd,null))[_0xd86d('0x3e')](handleError(_0x387cdd,null));};exports[_0xd86d('0x48')]=function(_0x1e6b4a,_0x3fce30){return db[_0xd86d('0x2a')][_0xd86d('0x48')]()[_0xd86d('0x26')](respondWithResult(_0x3fce30,null))['catch'](handleError(_0x3fce30,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c3a7155..1c78055 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4464a2,_0x4a557f){var _0x26b25c=function(_0x4695ec){while(--_0x4695ec){_0x4464a2['push'](_0x4464a2['shift']());}};_0x26b25c(++_0x4a557f);}(_0x53ec,0x192));var _0xc53e=function(_0x1bd247,_0x14f195){_0x1bd247=_0x1bd247-0x0;var _0x54d8d5=_0x53ec[_0x1bd247];return _0x54d8d5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2158b7,_0x35866b){var _0x56cf3e=function(_0x1b1f75){while(--_0x1b1f75){_0x2158b7['push'](_0x2158b7['shift']());}};_0x56cf3e(++_0x35866b);}(_0xabce,0x103));var _0xeabc=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xabce[_0x28d18d];return _0x470640;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1e30411..0a5efc6 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 _0x04f6=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxQueueReport','body','options','raw','CreateFaxQueueReport','where','attributes','UpdateFaxQueueReport','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x04f6,0x132));var _0x604f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x04f6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x604f('0x0'));var moment=require('moment');var BPromise=require(_0x604f('0x1'));var rs=require(_0x604f('0x2'));var fs=require('fs');var Redis=require(_0x604f('0x3'));var db=require(_0x604f('0x4'))['db'];var utils=require(_0x604f('0x5'));var logger=require(_0x604f('0x6'))(_0x604f('0x7'));var config=require(_0x604f('0x8'));var jayson=require(_0x604f('0x9'));var client=jayson[_0x604f('0xa')][_0x604f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f0cac,_0x5ea161,_0x4dc720){return new BPromise(function(_0x39004d,_0x394277){return client[_0x604f('0xc')](_0x5f0cac,_0x4dc720)[_0x604f('0xd')](function(_0x16f062){logger['info'](_0x604f('0xe'),_0x5ea161,_0x604f('0xf'));logger[_0x604f('0x10')](_0x604f('0x11'),_0x5ea161,_0x604f('0xf'),JSON[_0x604f('0x12')](_0x16f062));if(_0x16f062[_0x604f('0x13')]){if(_0x16f062[_0x604f('0x13')][_0x604f('0x14')]===0x1f4){logger[_0x604f('0x13')](_0x604f('0xe'),_0x5ea161,_0x16f062[_0x604f('0x13')]['message']);return _0x394277(_0x16f062[_0x604f('0x13')][_0x604f('0x15')]);}logger['error'](_0x604f('0xe'),_0x5ea161,_0x16f062[_0x604f('0x13')][_0x604f('0x15')]);return _0x39004d(_0x16f062[_0x604f('0x13')]['message']);}else{logger[_0x604f('0x16')](_0x604f('0xe'),_0x5ea161,_0x604f('0xf'));_0x39004d(_0x16f062['result']['message']);}})['catch'](function(_0x3df84b){logger[_0x604f('0x13')](_0x604f('0xe'),_0x5ea161,_0x3df84b);_0x394277(_0x3df84b);});});}exports['CreateFaxQueueReport']=function(_0x5142d3){var _0x2299bf=this;return new Promise(function(_0x5a462a,_0x353727){return db[_0x604f('0x17')]['create'](_0x5142d3[_0x604f('0x18')],{'raw':_0x5142d3[_0x604f('0x19')]?_0x5142d3[_0x604f('0x19')][_0x604f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x21f91a){logger[_0x604f('0x16')]('CreateFaxQueueReport',_0x5142d3);logger[_0x604f('0x10')](_0x604f('0x1b'),_0x5142d3,JSON[_0x604f('0x12')](_0x21f91a));_0x5a462a(_0x21f91a);})['catch'](function(_0x43ed9e){logger[_0x604f('0x13')]('CreateFaxQueueReport',_0x43ed9e['message'],_0x5142d3);_0x353727(_0x2299bf[_0x604f('0x13')](0x1f4,_0x43ed9e[_0x604f('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x156026){var _0x3f9083=this;return new Promise(function(_0x228f09,_0x40671b){return db[_0x604f('0x17')]['update'](_0x156026['body'],{'raw':_0x156026[_0x604f('0x19')]?_0x156026[_0x604f('0x19')][_0x604f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x156026[_0x604f('0x19')]?_0x156026[_0x604f('0x19')][_0x604f('0x1c')]||null:null,'attributes':_0x156026[_0x604f('0x19')]?_0x156026[_0x604f('0x19')][_0x604f('0x1d')]||null:null,'limit':_0x156026['options']?_0x156026[_0x604f('0x19')]['limit']||null:null})[_0x604f('0xd')](function(_0x5604f1){logger[_0x604f('0x16')](_0x604f('0x1e'),_0x156026);logger[_0x604f('0x10')](_0x604f('0x1e'),_0x156026,JSON[_0x604f('0x12')](_0x5604f1));_0x228f09(_0x5604f1);})[_0x604f('0x1f')](function(_0x4cb297){logger[_0x604f('0x13')](_0x604f('0x1e'),_0x4cb297['message'],_0x156026);_0x40671b(_0x3f9083[_0x604f('0x13')](0x1f4,_0x4cb297[_0x604f('0x15')]));});});}; \ No newline at end of file +var _0xe114=['code','message','result','catch','create','raw','then','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','update','body','options','where','limit','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4bab4c,_0x510ce1){var _0x402aa7=function(_0x52067a){while(--_0x52067a){_0x4bab4c['push'](_0x4bab4c['shift']());}};_0x402aa7(++_0x510ce1);}(_0xe114,0xe9));var _0x4e11=function(_0x3d6672,_0x279b87){_0x3d6672=_0x3d6672-0x0;var _0x15bb02=_0xe114[_0x3d6672];return _0x15bb02;};'use strict';var _=require(_0x4e11('0x0'));var util=require(_0x4e11('0x1'));var moment=require('moment');var BPromise=require(_0x4e11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e11('0x3'));var db=require(_0x4e11('0x4'))['db'];var utils=require(_0x4e11('0x5'));var logger=require(_0x4e11('0x6'))('rpc');var config=require(_0x4e11('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23b957,_0x43afe4,_0x153448){return new BPromise(function(_0x1aede3,_0x225b9f){return client['request'](_0x23b957,_0x153448)['then'](function(_0x4aab06){logger[_0x4e11('0x9')](_0x4e11('0xa'),_0x43afe4,_0x4e11('0xb'));logger['debug'](_0x4e11('0xc'),_0x43afe4,_0x4e11('0xb'),JSON[_0x4e11('0xd')](_0x4aab06));if(_0x4aab06[_0x4e11('0xe')]){if(_0x4aab06[_0x4e11('0xe')][_0x4e11('0xf')]===0x1f4){logger[_0x4e11('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x43afe4,_0x4aab06[_0x4e11('0xe')][_0x4e11('0x10')]);return _0x225b9f(_0x4aab06[_0x4e11('0xe')][_0x4e11('0x10')]);}logger[_0x4e11('0xe')](_0x4e11('0xa'),_0x43afe4,_0x4aab06[_0x4e11('0xe')][_0x4e11('0x10')]);return _0x1aede3(_0x4aab06[_0x4e11('0xe')]['message']);}else{logger[_0x4e11('0x9')](_0x4e11('0xa'),_0x43afe4,_0x4e11('0xb'));_0x1aede3(_0x4aab06[_0x4e11('0x11')][_0x4e11('0x10')]);}})[_0x4e11('0x12')](function(_0x26c290){logger[_0x4e11('0xe')](_0x4e11('0xa'),_0x43afe4,_0x26c290);_0x225b9f(_0x26c290);});});}exports['CreateFaxQueueReport']=function(_0x412351){var _0x4f0adf=this;return new Promise(function(_0x324c75,_0x270837){return db['FaxQueueReport'][_0x4e11('0x13')](_0x412351['body'],{'raw':_0x412351['options']?_0x412351['options'][_0x4e11('0x14')]===undefined?!![]:![]:!![]})[_0x4e11('0x15')](function(_0x32f184){logger[_0x4e11('0x9')]('CreateFaxQueueReport',_0x412351);logger['debug']('CreateFaxQueueReport',_0x412351,JSON[_0x4e11('0xd')](_0x32f184));_0x324c75(_0x32f184);})[_0x4e11('0x12')](function(_0x1f60ed){logger[_0x4e11('0xe')](_0x4e11('0x16'),_0x1f60ed[_0x4e11('0x10')],_0x412351);_0x270837(_0x4f0adf[_0x4e11('0xe')](0x1f4,_0x1f60ed[_0x4e11('0x10')]));});});};exports[_0x4e11('0x17')]=function(_0x63c5c7){var _0xf3c437=this;return new Promise(function(_0x362299,_0x475a3f){return db[_0x4e11('0x18')][_0x4e11('0x19')](_0x63c5c7[_0x4e11('0x1a')],{'raw':_0x63c5c7[_0x4e11('0x1b')]?_0x63c5c7[_0x4e11('0x1b')][_0x4e11('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63c5c7[_0x4e11('0x1b')]?_0x63c5c7[_0x4e11('0x1b')][_0x4e11('0x1c')]||null:null,'attributes':_0x63c5c7[_0x4e11('0x1b')]?_0x63c5c7[_0x4e11('0x1b')]['attributes']||null:null,'limit':_0x63c5c7[_0x4e11('0x1b')]?_0x63c5c7[_0x4e11('0x1b')][_0x4e11('0x1d')]||null:null})[_0x4e11('0x15')](function(_0x366aa5){logger[_0x4e11('0x9')](_0x4e11('0x17'),_0x63c5c7);logger[_0x4e11('0x1e')](_0x4e11('0x17'),_0x63c5c7,JSON[_0x4e11('0xd')](_0x366aa5));_0x362299(_0x366aa5);})['catch'](function(_0x767950){logger[_0x4e11('0xe')](_0x4e11('0x17'),_0x767950[_0x4e11('0x10')],_0x63c5c7);_0x475a3f(_0xf3c437[_0x4e11('0xe')](0x1f4,_0x767950[_0x4e11('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bc33eeb..7bf72af 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 _0xad5f=['isAuthenticated','index','/describe','describe','/:id','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad5f,0xbe));var _0xfad5=function(_0x2cd8a4,_0x51fb40){_0x2cd8a4=_0x2cd8a4-0x0;var _0x375630=_0xad5f[_0x2cd8a4];return _0x375630;};'use strict';var multer=require('multer');var util=require(_0xfad5('0x0'));var path=require(_0xfad5('0x1'));var timeout=require(_0xfad5('0x2'));var express=require(_0xfad5('0x3'));var router=express['Router']();var fs_extra=require(_0xfad5('0x4'));var auth=require(_0xfad5('0x5'));var interaction=require(_0xfad5('0x6'));var config=require(_0xfad5('0x7'));var controller=require(_0xfad5('0x8'));router[_0xfad5('0x9')]('/',auth[_0xfad5('0xa')](),controller[_0xfad5('0xb')]);router[_0xfad5('0x9')](_0xfad5('0xc'),auth[_0xfad5('0xa')](),controller[_0xfad5('0xd')]);router[_0xfad5('0x9')](_0xfad5('0xe'),auth[_0xfad5('0xa')](),controller['show']);router[_0xfad5('0xf')]('/',auth[_0xfad5('0xa')](),controller[_0xfad5('0x10')]);router[_0xfad5('0x11')](_0xfad5('0xe'),auth[_0xfad5('0xa')](),controller['update']);router['delete'](_0xfad5('0xe'),auth[_0xfad5('0xa')](),controller[_0xfad5('0x12')]);module[_0xfad5('0x13')]=router; \ No newline at end of file +var _0x8d6e=['put','update','delete','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0xf5b16,_0x47cf1f){var _0x4dccad=function(_0x5f53fa){while(--_0x5f53fa){_0xf5b16['push'](_0xf5b16['shift']());}};_0x4dccad(++_0x47cf1f);}(_0x8d6e,0x1ce));var _0xe8d6=function(_0x5a01bb,_0x2f2427){_0x5a01bb=_0x5a01bb-0x0;var _0x285d1b=_0x8d6e[_0x5a01bb];return _0x285d1b;};'use strict';var multer=require(_0xe8d6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe8d6('0x1'));var router=express[_0xe8d6('0x2')]();var fs_extra=require(_0xe8d6('0x3'));var auth=require(_0xe8d6('0x4'));var interaction=require(_0xe8d6('0x5'));var config=require(_0xe8d6('0x6'));var controller=require(_0xe8d6('0x7'));router['get']('/',auth[_0xe8d6('0x8')](),controller[_0xe8d6('0x9')]);router[_0xe8d6('0xa')](_0xe8d6('0xb'),auth[_0xe8d6('0x8')](),controller['describe']);router[_0xe8d6('0xa')](_0xe8d6('0xc'),auth[_0xe8d6('0x8')](),controller[_0xe8d6('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe8d6('0xe')](_0xe8d6('0xc'),auth['isAuthenticated'](),controller[_0xe8d6('0xf')]);router[_0xe8d6('0x10')](_0xe8d6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 8dbc199..969084d 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xbb5c90,_0x44bbf7){var _0x1947c6=function(_0x5bdcce){while(--_0x5bdcce){_0xbb5c90['push'](_0xbb5c90['shift']());}};_0x1947c6(++_0x44bbf7);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f4561,_0x4611b9){_0x3f4561=_0x3f4561-0x0;var _0x3b6300=_0xedd9[_0x3f4561];return _0x3b6300;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x595363,_0x1c2721){_0x595363=_0x595363-0x0;var _0xcae8ab=_0x9bde[_0x595363];return _0xcae8ab;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 96e0c2f..f76cd54 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 _0xe847=['Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','model','query','keys','intersection','fields','length','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','rows','catch','show','params','attributes','options','find','create','body','describe','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','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x2f0e81,_0x5c62b7){var _0x20d42a=function(_0x3fc1c8){while(--_0x3fc1c8){_0x2f0e81['push'](_0x2f0e81['shift']());}};_0x20d42a(++_0x5c62b7);}(_0xe847,0x1b0));var _0x7e84=function(_0x5e17c9,_0x527a71){_0x5e17c9=_0x5e17c9-0x0;var _0x1aa0d9=_0xe847[_0x5e17c9];return _0x1aa0d9;};'use strict';var emlformat=require(_0x7e84('0x0'));var rimraf=require(_0x7e84('0x1'));var zipdir=require(_0x7e84('0x2'));var jsonpatch=require(_0x7e84('0x3'));var rp=require(_0x7e84('0x4'));var moment=require(_0x7e84('0x5'));var BPromise=require(_0x7e84('0x6'));var Mustache=require(_0x7e84('0x7'));var util=require(_0x7e84('0x8'));var path=require(_0x7e84('0x9'));var sox=require(_0x7e84('0xa'));var csv=require(_0x7e84('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e84('0xc'));var _=require(_0x7e84('0xd'));var squel=require(_0x7e84('0xe'));var crypto=require(_0x7e84('0xf'));var jsforce=require(_0x7e84('0x10'));var deskjs=require(_0x7e84('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7e84('0x12'));var Papa=require(_0x7e84('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e84('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e84('0x15'))(_0x7e84('0x16'));var utils=require(_0x7e84('0x17'));var config=require(_0x7e84('0x18'));var licenseUtil=require(_0x7e84('0x19'));var db=require(_0x7e84('0x1a'))['db'];function respondWithStatusCode(_0x4dc4de,_0x1424ba){_0x1424ba=_0x1424ba||0xcc;return function(_0x2fb533){if(_0x2fb533){return _0x4dc4de[_0x7e84('0x1b')](_0x1424ba);}return _0x4dc4de[_0x7e84('0x1c')](_0x1424ba)[_0x7e84('0x1d')]();};}function respondWithResult(_0x5b726d,_0x3c144e){_0x3c144e=_0x3c144e||0xc8;return function(_0x231584){if(_0x231584){return _0x5b726d[_0x7e84('0x1c')](_0x3c144e)[_0x7e84('0x1e')](_0x231584);}};}function respondWithFilteredResult(_0x3b5ef9,_0x7a1d70){return function(_0x24bd9d){if(_0x24bd9d){var _0x3838c1=typeof _0x7a1d70[_0x7e84('0x1f')]===_0x7e84('0x20')&&typeof _0x7a1d70[_0x7e84('0x21')]==='undefined';var _0x41788e=_0x24bd9d[_0x7e84('0x22')];var _0x1e0cae=_0x3838c1?0x0:_0x7a1d70[_0x7e84('0x1f')];var _0x1ca530=_0x3838c1?_0x24bd9d[_0x7e84('0x22')]:_0x7a1d70[_0x7e84('0x1f')]+_0x7a1d70[_0x7e84('0x21')];var _0xfcca95;if(_0x1ca530>=_0x41788e){_0x1ca530=_0x41788e;_0xfcca95=0xc8;}else{_0xfcca95=0xce;}_0x3b5ef9[_0x7e84('0x1c')](_0xfcca95);return _0x3b5ef9[_0x7e84('0x23')](_0x7e84('0x24'),_0x1e0cae+'-'+_0x1ca530+'/'+_0x41788e)['json'](_0x24bd9d);}return null;};}function patchUpdates(_0x239036){return function(_0x69eee9){try{jsonpatch['apply'](_0x69eee9,_0x239036,!![]);}catch(_0x2546c2){return BPromise[_0x7e84('0x25')](_0x2546c2);}return _0x69eee9[_0x7e84('0x26')]();};}function saveUpdates(_0x5e79cc,_0x3d235a){return function(_0x55a2aa){if(_0x55a2aa){return _0x55a2aa[_0x7e84('0x27')](_0x5e79cc)[_0x7e84('0x28')](function(_0x1fc76a){return _0x1fc76a;});}return null;};}function removeEntity(_0x5c7da0,_0x39f19a){return function(_0x5a557a){if(_0x5a557a){return _0x5a557a[_0x7e84('0x29')]()[_0x7e84('0x28')](function(){_0x5c7da0['status'](0xcc)[_0x7e84('0x1d')]();});}};}function handleEntityNotFound(_0x193bf5,_0x3c3d51){return function(_0x47ca1a){if(!_0x47ca1a){_0x193bf5[_0x7e84('0x1b')](0x194);}return _0x47ca1a;};}function handleError(_0x51a7f6,_0x164de1){_0x164de1=_0x164de1||0x1f4;return function(_0x31a069){logger[_0x7e84('0x2a')](_0x31a069[_0x7e84('0x2b')]);if(_0x31a069[_0x7e84('0x2c')]){delete _0x31a069[_0x7e84('0x2c')];}_0x51a7f6[_0x7e84('0x1c')](_0x164de1)[_0x7e84('0x2d')](_0x31a069);};}exports[_0x7e84('0x2e')]=function(_0x4ac88f,_0x1b7908){var _0x5a5ee6={},_0xa5214a={},_0x19d492={'count':0x0,'rows':[]};var _0x1421b4=_[_0x7e84('0x2f')](db[_0x7e84('0x30')][_0x7e84('0x31')],function(_0x521b84){return{'name':_0x521b84[_0x7e84('0x32')],'type':_0x521b84['type']['key']};});_0xa5214a[_0x7e84('0x33')]=_[_0x7e84('0x2f')](_0x1421b4,'name');_0xa5214a[_0x7e84('0x34')]=_[_0x7e84('0x35')](_0x4ac88f[_0x7e84('0x34')]);_0xa5214a['filters']=_['intersection'](_0xa5214a[_0x7e84('0x33')],_0xa5214a['query']);_0x5a5ee6['attributes']=_[_0x7e84('0x36')](_0xa5214a[_0x7e84('0x33')],qs[_0x7e84('0x37')](_0x4ac88f[_0x7e84('0x34')][_0x7e84('0x37')]));_0x5a5ee6['attributes']=_0x5a5ee6['attributes'][_0x7e84('0x38')]?_0x5a5ee6['attributes']:_0xa5214a['model'];if(!_0x4ac88f[_0x7e84('0x34')]['hasOwnProperty'](_0x7e84('0x39'))){_0x5a5ee6[_0x7e84('0x21')]=qs[_0x7e84('0x21')](_0x4ac88f[_0x7e84('0x34')][_0x7e84('0x21')]);_0x5a5ee6['offset']=qs[_0x7e84('0x1f')](_0x4ac88f['query'][_0x7e84('0x1f')]);}_0x5a5ee6[_0x7e84('0x3a')]=qs['sort'](_0x4ac88f[_0x7e84('0x34')][_0x7e84('0x3b')]);_0x5a5ee6[_0x7e84('0x3c')]=qs[_0x7e84('0x3d')](_[_0x7e84('0x3e')](_0x4ac88f[_0x7e84('0x34')],_0xa5214a['filters']),_0x1421b4);if(_0x4ac88f[_0x7e84('0x34')]['filter']){_0x5a5ee6[_0x7e84('0x3c')]=_['merge'](_0x5a5ee6[_0x7e84('0x3c')],{'$or':_[_0x7e84('0x2f')](_0x1421b4,function(_0x79a61a){if(_0x79a61a[_0x7e84('0x3f')]!==_0x7e84('0x40')){var _0x854350={};_0x854350[_0x79a61a[_0x7e84('0x2c')]]={'$like':'%'+_0x4ac88f[_0x7e84('0x34')][_0x7e84('0x41')]+'%'};return _0x854350;}})});}_0x5a5ee6=_[_0x7e84('0x42')]({},_0x5a5ee6,_0x4ac88f['options']);var _0x37aa27={'where':_0x5a5ee6[_0x7e84('0x3c')]};return db[_0x7e84('0x30')][_0x7e84('0x22')](_0x37aa27)[_0x7e84('0x28')](function(_0x4fcf1a){_0x19d492['count']=_0x4fcf1a;if(_0x4ac88f[_0x7e84('0x34')][_0x7e84('0x43')]){_0x5a5ee6['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x5a5ee6);})[_0x7e84('0x28')](function(_0x53f8c7){_0x19d492[_0x7e84('0x44')]=_0x53f8c7;return _0x19d492;})[_0x7e84('0x28')](respondWithFilteredResult(_0x1b7908,_0x5a5ee6))[_0x7e84('0x45')](handleError(_0x1b7908,null));};exports[_0x7e84('0x46')]=function(_0x57e96f,_0x1c8097){var _0x5b0587={'raw':!![],'where':{'id':_0x57e96f[_0x7e84('0x47')]['id']}},_0x5c3c3c={};_0x5c3c3c[_0x7e84('0x33')]=_[_0x7e84('0x35')](db['FaxTransferReport'][_0x7e84('0x31')]);_0x5c3c3c[_0x7e84('0x34')]=_['keys'](_0x57e96f[_0x7e84('0x34')]);_0x5c3c3c['filters']=_['intersection'](_0x5c3c3c[_0x7e84('0x33')],_0x5c3c3c[_0x7e84('0x34')]);_0x5b0587[_0x7e84('0x48')]=_[_0x7e84('0x36')](_0x5c3c3c[_0x7e84('0x33')],qs[_0x7e84('0x37')](_0x57e96f['query'][_0x7e84('0x37')]));_0x5b0587[_0x7e84('0x48')]=_0x5b0587[_0x7e84('0x48')][_0x7e84('0x38')]?_0x5b0587['attributes']:_0x5c3c3c['model'];if(_0x57e96f[_0x7e84('0x34')][_0x7e84('0x43')]){_0x5b0587['include']=[{'all':!![]}];}_0x5b0587=_[_0x7e84('0x42')]({},_0x5b0587,_0x57e96f[_0x7e84('0x49')]);return db[_0x7e84('0x30')][_0x7e84('0x4a')](_0x5b0587)['then'](handleEntityNotFound(_0x1c8097,null))[_0x7e84('0x28')](respondWithResult(_0x1c8097,null))['catch'](handleError(_0x1c8097,null));};exports[_0x7e84('0x4b')]=function(_0xb1d3e4,_0x2f2d10){return db[_0x7e84('0x30')][_0x7e84('0x4b')](_0xb1d3e4['body'],{})[_0x7e84('0x28')](respondWithResult(_0x2f2d10,0xc9))['catch'](handleError(_0x2f2d10,null));};exports[_0x7e84('0x27')]=function(_0x1e747c,_0x438b27){if(_0x1e747c[_0x7e84('0x4c')]['id']){delete _0x1e747c['body']['id'];}return db[_0x7e84('0x30')][_0x7e84('0x4a')]({'where':{'id':_0x1e747c[_0x7e84('0x47')]['id']}})['then'](handleEntityNotFound(_0x438b27,null))[_0x7e84('0x28')](saveUpdates(_0x1e747c['body'],null))[_0x7e84('0x28')](respondWithResult(_0x438b27,null))[_0x7e84('0x45')](handleError(_0x438b27,null));};exports[_0x7e84('0x29')]=function(_0x59bf86,_0x52f806){return db['FaxTransferReport'][_0x7e84('0x4a')]({'where':{'id':_0x59bf86[_0x7e84('0x47')]['id']}})[_0x7e84('0x28')](handleEntityNotFound(_0x52f806,null))[_0x7e84('0x28')](removeEntity(_0x52f806,null))['catch'](handleError(_0x52f806,null));};exports[_0x7e84('0x4d')]=function(_0x55702a,_0x25ee44){return db['FaxTransferReport']['describe']()['then'](respondWithResult(_0x25ee44,null))[_0x7e84('0x45')](handleError(_0x25ee44,null));}; \ No newline at end of file +var _0x4831=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x11ef39,_0x3aff15){var _0x4f7b09=function(_0xbaee45){while(--_0xbaee45){_0x11ef39['push'](_0x11ef39['shift']());}};_0x4f7b09(++_0x3aff15);}(_0x4831,0x16f));var _0x1483=function(_0x13fe17,_0x46e7ef){_0x13fe17=_0x13fe17-0x0;var _0x3af18d=_0x4831[_0x13fe17];return _0x3af18d;};'use strict';var emlformat=require(_0x1483('0x0'));var rimraf=require(_0x1483('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1483('0x2'));var rp=require(_0x1483('0x3'));var moment=require('moment');var BPromise=require(_0x1483('0x4'));var Mustache=require('mustache');var util=require(_0x1483('0x5'));var path=require('path');var sox=require(_0x1483('0x6'));var csv=require(_0x1483('0x7'));var ejs=require(_0x1483('0x8'));var fs=require('fs');var fs_extra=require(_0x1483('0x9'));var _=require(_0x1483('0xa'));var squel=require(_0x1483('0xb'));var crypto=require(_0x1483('0xc'));var jsforce=require(_0x1483('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1483('0x7'));var querystring=require(_0x1483('0xe'));var Papa=require('papaparse');var Redis=require(_0x1483('0xf'));var authService=require(_0x1483('0x10'));var qs=require(_0x1483('0x11'));var as=require(_0x1483('0x12'));var hardwareService=require(_0x1483('0x13'));var logger=require(_0x1483('0x14'))(_0x1483('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1483('0x16'));var db=require(_0x1483('0x17'))['db'];function respondWithStatusCode(_0x5a25be,_0x1f9f06){_0x1f9f06=_0x1f9f06||0xcc;return function(_0x87ce2e){if(_0x87ce2e){return _0x5a25be[_0x1483('0x18')](_0x1f9f06);}return _0x5a25be[_0x1483('0x19')](_0x1f9f06)[_0x1483('0x1a')]();};}function respondWithResult(_0x13e520,_0x1dda28){_0x1dda28=_0x1dda28||0xc8;return function(_0x246296){if(_0x246296){return _0x13e520['status'](_0x1dda28)[_0x1483('0x1b')](_0x246296);}};}function respondWithFilteredResult(_0x388c28,_0x35ecc4){return function(_0x480a59){if(_0x480a59){var _0x403c27=typeof _0x35ecc4[_0x1483('0x1c')]===_0x1483('0x1d')&&typeof _0x35ecc4[_0x1483('0x1e')]==='undefined';var _0x36325d=_0x480a59[_0x1483('0x1f')];var _0x3c2079=_0x403c27?0x0:_0x35ecc4['offset'];var _0x55aaec=_0x403c27?_0x480a59[_0x1483('0x1f')]:_0x35ecc4[_0x1483('0x1c')]+_0x35ecc4['limit'];var _0x5d1835;if(_0x55aaec>=_0x36325d){_0x55aaec=_0x36325d;_0x5d1835=0xc8;}else{_0x5d1835=0xce;}_0x388c28[_0x1483('0x19')](_0x5d1835);return _0x388c28[_0x1483('0x20')](_0x1483('0x21'),_0x3c2079+'-'+_0x55aaec+'/'+_0x36325d)[_0x1483('0x1b')](_0x480a59);}return null;};}function patchUpdates(_0x103562){return function(_0x321bce){try{jsonpatch[_0x1483('0x22')](_0x321bce,_0x103562,!![]);}catch(_0x266202){return BPromise['reject'](_0x266202);}return _0x321bce[_0x1483('0x23')]();};}function saveUpdates(_0x347311,_0x1e1306){return function(_0xac495f){if(_0xac495f){return _0xac495f[_0x1483('0x24')](_0x347311)[_0x1483('0x25')](function(_0x213a47){return _0x213a47;});}return null;};}function removeEntity(_0x176aae,_0x1abc19){return function(_0x5efea3){if(_0x5efea3){return _0x5efea3[_0x1483('0x26')]()[_0x1483('0x25')](function(){_0x176aae[_0x1483('0x19')](0xcc)[_0x1483('0x1a')]();});}};}function handleEntityNotFound(_0x421060,_0x5ddf85){return function(_0x6ad161){if(!_0x6ad161){_0x421060[_0x1483('0x18')](0x194);}return _0x6ad161;};}function handleError(_0x27c6ab,_0x4a95b5){_0x4a95b5=_0x4a95b5||0x1f4;return function(_0x19ed87){logger[_0x1483('0x27')](_0x19ed87['stack']);if(_0x19ed87['name']){delete _0x19ed87['name'];}_0x27c6ab[_0x1483('0x19')](_0x4a95b5)[_0x1483('0x28')](_0x19ed87);};}exports[_0x1483('0x29')]=function(_0x3bec2c,_0x41efe8){var _0xe42b27={},_0x4f2fa7={},_0x520b92={'count':0x0,'rows':[]};var _0x134e81=_[_0x1483('0x2a')](db[_0x1483('0x2b')][_0x1483('0x2c')],function(_0x1a03e0){return{'name':_0x1a03e0[_0x1483('0x2d')],'type':_0x1a03e0[_0x1483('0x2e')][_0x1483('0x2f')]};});_0x4f2fa7[_0x1483('0x30')]=_[_0x1483('0x2a')](_0x134e81,_0x1483('0x31'));_0x4f2fa7[_0x1483('0x32')]=_['keys'](_0x3bec2c[_0x1483('0x32')]);_0x4f2fa7[_0x1483('0x33')]=_[_0x1483('0x34')](_0x4f2fa7[_0x1483('0x30')],_0x4f2fa7['query']);_0xe42b27[_0x1483('0x35')]=_[_0x1483('0x34')](_0x4f2fa7[_0x1483('0x30')],qs[_0x1483('0x36')](_0x3bec2c[_0x1483('0x32')][_0x1483('0x36')]));_0xe42b27['attributes']=_0xe42b27[_0x1483('0x35')][_0x1483('0x37')]?_0xe42b27[_0x1483('0x35')]:_0x4f2fa7[_0x1483('0x30')];if(!_0x3bec2c[_0x1483('0x32')][_0x1483('0x38')](_0x1483('0x39'))){_0xe42b27[_0x1483('0x1e')]=qs[_0x1483('0x1e')](_0x3bec2c[_0x1483('0x32')]['limit']);_0xe42b27['offset']=qs[_0x1483('0x1c')](_0x3bec2c[_0x1483('0x32')][_0x1483('0x1c')]);}_0xe42b27[_0x1483('0x3a')]=qs[_0x1483('0x3b')](_0x3bec2c[_0x1483('0x32')][_0x1483('0x3b')]);_0xe42b27[_0x1483('0x3c')]=qs[_0x1483('0x33')](_[_0x1483('0x3d')](_0x3bec2c[_0x1483('0x32')],_0x4f2fa7[_0x1483('0x33')]),_0x134e81);if(_0x3bec2c[_0x1483('0x32')][_0x1483('0x3e')]){_0xe42b27[_0x1483('0x3c')]=_[_0x1483('0x3f')](_0xe42b27[_0x1483('0x3c')],{'$or':_[_0x1483('0x2a')](_0x134e81,function(_0x4ae9f1){if(_0x4ae9f1[_0x1483('0x2e')]!==_0x1483('0x40')){var _0x2a7ad4={};_0x2a7ad4[_0x4ae9f1[_0x1483('0x31')]]={'$like':'%'+_0x3bec2c[_0x1483('0x32')][_0x1483('0x3e')]+'%'};return _0x2a7ad4;}})});}_0xe42b27=_[_0x1483('0x3f')]({},_0xe42b27,_0x3bec2c[_0x1483('0x41')]);var _0x2431e9={'where':_0xe42b27[_0x1483('0x3c')]};return db[_0x1483('0x2b')]['count'](_0x2431e9)['then'](function(_0xa3ab53){_0x520b92[_0x1483('0x1f')]=_0xa3ab53;if(_0x3bec2c[_0x1483('0x32')][_0x1483('0x42')]){_0xe42b27[_0x1483('0x43')]=[{'all':!![]}];}return db[_0x1483('0x2b')]['findAll'](_0xe42b27);})[_0x1483('0x25')](function(_0x61c1d9){_0x520b92[_0x1483('0x44')]=_0x61c1d9;return _0x520b92;})[_0x1483('0x25')](respondWithFilteredResult(_0x41efe8,_0xe42b27))[_0x1483('0x45')](handleError(_0x41efe8,null));};exports[_0x1483('0x46')]=function(_0x1010ec,_0x4769ee){var _0x59026f={'raw':!![],'where':{'id':_0x1010ec[_0x1483('0x47')]['id']}},_0x633bda={};_0x633bda['model']=_[_0x1483('0x48')](db[_0x1483('0x2b')][_0x1483('0x2c')]);_0x633bda[_0x1483('0x32')]=_[_0x1483('0x48')](_0x1010ec[_0x1483('0x32')]);_0x633bda[_0x1483('0x33')]=_[_0x1483('0x34')](_0x633bda[_0x1483('0x30')],_0x633bda[_0x1483('0x32')]);_0x59026f['attributes']=_[_0x1483('0x34')](_0x633bda[_0x1483('0x30')],qs['fields'](_0x1010ec[_0x1483('0x32')][_0x1483('0x36')]));_0x59026f[_0x1483('0x35')]=_0x59026f['attributes'][_0x1483('0x37')]?_0x59026f[_0x1483('0x35')]:_0x633bda[_0x1483('0x30')];if(_0x1010ec[_0x1483('0x32')]['includeAll']){_0x59026f[_0x1483('0x43')]=[{'all':!![]}];}_0x59026f=_[_0x1483('0x3f')]({},_0x59026f,_0x1010ec[_0x1483('0x41')]);return db[_0x1483('0x2b')][_0x1483('0x49')](_0x59026f)[_0x1483('0x25')](handleEntityNotFound(_0x4769ee,null))['then'](respondWithResult(_0x4769ee,null))[_0x1483('0x45')](handleError(_0x4769ee,null));};exports[_0x1483('0x4a')]=function(_0x24cb8d,_0x290961){return db[_0x1483('0x2b')][_0x1483('0x4a')](_0x24cb8d['body'],{})[_0x1483('0x25')](respondWithResult(_0x290961,0xc9))[_0x1483('0x45')](handleError(_0x290961,null));};exports[_0x1483('0x24')]=function(_0x4067e9,_0x248a7a){if(_0x4067e9[_0x1483('0x4b')]['id']){delete _0x4067e9[_0x1483('0x4b')]['id'];}return db[_0x1483('0x2b')][_0x1483('0x49')]({'where':{'id':_0x4067e9[_0x1483('0x47')]['id']}})[_0x1483('0x25')](handleEntityNotFound(_0x248a7a,null))[_0x1483('0x25')](saveUpdates(_0x4067e9[_0x1483('0x4b')],null))['then'](respondWithResult(_0x248a7a,null))[_0x1483('0x45')](handleError(_0x248a7a,null));};exports[_0x1483('0x26')]=function(_0x3f41ac,_0x3c0991){return db[_0x1483('0x2b')][_0x1483('0x49')]({'where':{'id':_0x3f41ac[_0x1483('0x47')]['id']}})[_0x1483('0x25')](handleEntityNotFound(_0x3c0991,null))[_0x1483('0x25')](removeEntity(_0x3c0991,null))[_0x1483('0x45')](handleError(_0x3c0991,null));};exports[_0x1483('0x4c')]=function(_0x43d174,_0x584d9a){return db[_0x1483('0x2b')][_0x1483('0x4c')]()[_0x1483('0x25')](respondWithResult(_0x584d9a,null))[_0x1483('0x45')](handleError(_0x584d9a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1685750..a4b9e73 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 _0x7b22=['./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','lodash','api','moment','request-promise','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b22,0x67));var _0x27b2=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x7b22[_0x130209];return _0x155fb7;};'use strict';var _=require(_0x27b2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x27b2('0x1'));var moment=require(_0x27b2('0x2'));var BPromise=require('bluebird');var rp=require(_0x27b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27b2('0x4'));var attributes=require(_0x27b2('0x5'));module['exports']=function(_0x14e786,_0x1db1bf){return _0x14e786[_0x27b2('0x6')](_0x27b2('0x7'),attributes,{'tableName':_0x27b2('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a4e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a4e,0x1df));var _0xe2a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a4e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe2a4('0x0'));var util=require('util');var logger=require(_0xe2a4('0x1'))(_0xe2a4('0x2'));var moment=require(_0xe2a4('0x3'));var BPromise=require(_0xe2a4('0x4'));var rp=require(_0xe2a4('0x5'));var fs=require('fs');var path=require(_0xe2a4('0x6'));var rimraf=require(_0xe2a4('0x7'));var config=require(_0xe2a4('0x8'));var attributes=require(_0xe2a4('0x9'));module[_0xe2a4('0xa')]=function(_0x20f1d0,_0x345e44){return _0x20f1d0[_0xe2a4('0xb')](_0xe2a4('0xc'),attributes,{'tableName':_0xe2a4('0xd'),'paranoid':![],'indexes':[{'name':_0xe2a4('0xe'),'fields':[_0xe2a4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index dd031bc..8d797f1 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 _0x89ae=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x55ccb7,_0x2f7889){var _0x19e52f=function(_0x3c0893){while(--_0x3c0893){_0x55ccb7['push'](_0x55ccb7['shift']());}};_0x19e52f(++_0x2f7889);}(_0x89ae,0xbd));var _0xe89a=function(_0x2f2377,_0x11cc21){_0x2f2377=_0x2f2377-0x0;var _0x441e6b=_0x89ae[_0x2f2377];return _0x441e6b;};'use strict';var _=require(_0xe89a('0x0'));var util=require('util');var moment=require(_0xe89a('0x1'));var BPromise=require(_0xe89a('0x2'));var rs=require(_0xe89a('0x3'));var fs=require('fs');var Redis=require(_0xe89a('0x4'));var db=require(_0xe89a('0x5'))['db'];var utils=require(_0xe89a('0x6'));var logger=require(_0xe89a('0x7'))(_0xe89a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe89a('0x9'));var client=jayson[_0xe89a('0xa')][_0xe89a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435235,_0x51d05d,_0x1940a6){return new BPromise(function(_0xa2bcc0,_0x560d3b){return client[_0xe89a('0xc')](_0x435235,_0x1940a6)['then'](function(_0x270981){logger['info'](_0xe89a('0xd'),_0x51d05d,'request\x20sent');logger[_0xe89a('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x51d05d,_0xe89a('0xf'),JSON[_0xe89a('0x10')](_0x270981));if(_0x270981['error']){if(_0x270981[_0xe89a('0x11')][_0xe89a('0x12')]===0x1f4){logger[_0xe89a('0x11')](_0xe89a('0xd'),_0x51d05d,_0x270981[_0xe89a('0x11')][_0xe89a('0x13')]);return _0x560d3b(_0x270981['error']['message']);}logger[_0xe89a('0x11')](_0xe89a('0xd'),_0x51d05d,_0x270981[_0xe89a('0x11')]['message']);return _0xa2bcc0(_0x270981[_0xe89a('0x11')][_0xe89a('0x13')]);}else{logger[_0xe89a('0x14')](_0xe89a('0xd'),_0x51d05d,_0xe89a('0xf'));_0xa2bcc0(_0x270981[_0xe89a('0x15')]['message']);}})[_0xe89a('0x16')](function(_0x1e4a4c){logger[_0xe89a('0x11')](_0xe89a('0xd'),_0x51d05d,_0x1e4a4c);_0x560d3b(_0x1e4a4c);});});} \ No newline at end of file +var _0xda24=['../../config/logger','rpc','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3db4df,_0x1e53fe){var _0x4c6ec4=function(_0x4225de){while(--_0x4225de){_0x3db4df['push'](_0x3db4df['shift']());}};_0x4c6ec4(++_0x1e53fe);}(_0xda24,0x10b));var _0x4da2=function(_0x4b1eda,_0x1ca265){_0x4b1eda=_0x4b1eda-0x0;var _0x520e6b=_0xda24[_0x4b1eda];return _0x520e6b;};'use strict';var _=require(_0x4da2('0x0'));var util=require(_0x4da2('0x1'));var moment=require(_0x4da2('0x2'));var BPromise=require(_0x4da2('0x3'));var rs=require(_0x4da2('0x4'));var fs=require('fs');var Redis=require(_0x4da2('0x5'));var db=require(_0x4da2('0x6'))['db'];var utils=require(_0x4da2('0x7'));var logger=require(_0x4da2('0x8'))(_0x4da2('0x9'));var config=require('../../config/environment');var jayson=require(_0x4da2('0xa'));var client=jayson[_0x4da2('0xb')][_0x4da2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24a383,_0x296870,_0x45b726){return new BPromise(function(_0x430a34,_0xf72529){return client['request'](_0x24a383,_0x45b726)[_0x4da2('0xd')](function(_0x343e0c){logger[_0x4da2('0xe')](_0x4da2('0xf'),_0x296870,_0x4da2('0x10'));logger[_0x4da2('0x11')](_0x4da2('0x12'),_0x296870,_0x4da2('0x10'),JSON[_0x4da2('0x13')](_0x343e0c));if(_0x343e0c[_0x4da2('0x14')]){if(_0x343e0c[_0x4da2('0x14')][_0x4da2('0x15')]===0x1f4){logger[_0x4da2('0x14')](_0x4da2('0xf'),_0x296870,_0x343e0c[_0x4da2('0x14')][_0x4da2('0x16')]);return _0xf72529(_0x343e0c[_0x4da2('0x14')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x296870,_0x343e0c[_0x4da2('0x14')][_0x4da2('0x16')]);return _0x430a34(_0x343e0c['error'][_0x4da2('0x16')]);}else{logger[_0x4da2('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x296870,_0x4da2('0x10'));_0x430a34(_0x343e0c[_0x4da2('0x17')][_0x4da2('0x16')]);}})[_0x4da2('0x18')](function(_0x488a66){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x296870,_0x488a66);_0xf72529(_0x488a66);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 7e279e7..1176734 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 _0xb39b=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xb39b,0x1d4));var _0xbb39=function(_0x1a4c27,_0x16e7b1){_0x1a4c27=_0x1a4c27-0x0;var _0x529bbd=_0xb39b[_0x1a4c27];return _0x529bbd;};'use strict';var multer=require(_0xbb39('0x0'));var util=require(_0xbb39('0x1'));var path=require(_0xbb39('0x2'));var timeout=require(_0xbb39('0x3'));var express=require(_0xbb39('0x4'));var router=express['Router']();var fs_extra=require(_0xbb39('0x5'));var auth=require(_0xbb39('0x6'));var interaction=require(_0xbb39('0x7'));var config=require(_0xbb39('0x8'));var controller=require(_0xbb39('0x9'));router[_0xbb39('0xa')]('/',auth['isAuthenticated'](),controller[_0xbb39('0xb')]);router[_0xbb39('0xa')](_0xbb39('0xc'),auth[_0xbb39('0xd')](),controller[_0xbb39('0xe')]);router[_0xbb39('0xa')](_0xbb39('0xf'),auth[_0xbb39('0xd')](),controller[_0xbb39('0x10')]);router[_0xbb39('0x11')]('/',auth[_0xbb39('0xd')](),controller[_0xbb39('0x12')]);router[_0xbb39('0x13')](_0xbb39('0xf'),auth[_0xbb39('0xd')](),controller['update']);router[_0xbb39('0x14')](_0xbb39('0xf'),auth[_0xbb39('0xd')](),controller[_0xbb39('0x15')]);module[_0xbb39('0x16')]=router; \ No newline at end of file +var _0xb466=['./faxTransferReport.controller','isAuthenticated','index','get','/:id','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5ecba8,_0x935c5d){var _0x46615f=function(_0x2fac1f){while(--_0x2fac1f){_0x5ecba8['push'](_0x5ecba8['shift']());}};_0x46615f(++_0x935c5d);}(_0xb466,0xd0));var _0x6b46=function(_0x27d563,_0x374b78){_0x27d563=_0x27d563-0x0;var _0x2fd1af=_0xb466[_0x27d563];return _0x2fd1af;};'use strict';var multer=require(_0x6b46('0x0'));var util=require(_0x6b46('0x1'));var path=require('path');var timeout=require(_0x6b46('0x2'));var express=require(_0x6b46('0x3'));var router=express[_0x6b46('0x4')]();var fs_extra=require(_0x6b46('0x5'));var auth=require(_0x6b46('0x6'));var interaction=require(_0x6b46('0x7'));var config=require('../../config/environment');var controller=require(_0x6b46('0x8'));router['get']('/',auth[_0x6b46('0x9')](),controller[_0x6b46('0xa')]);router[_0x6b46('0xb')]('/describe',auth[_0x6b46('0x9')](),controller['describe']);router[_0x6b46('0xb')](_0x6b46('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6b46('0xd')]);router['put']('/:id',auth[_0x6b46('0x9')](),controller[_0x6b46('0xe')]);router[_0x6b46('0xf')](_0x6b46('0xc'),auth['isAuthenticated'](),controller[_0x6b46('0x10')]);module[_0x6b46('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 21c92a7..61df10c 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 _0xba38=['post','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x28aef4,_0x5e4e2e){var _0x1f0ec7=function(_0x295673){while(--_0x295673){_0x28aef4['push'](_0x28aef4['shift']());}};_0x1f0ec7(++_0x5e4e2e);}(_0xba38,0x119));var _0x8ba3=function(_0x412358,_0x1e3ebd){_0x412358=_0x412358-0x0;var _0xe7daaf=_0xba38[_0x412358];return _0xe7daaf;};'use strict';var multer=require(_0x8ba3('0x0'));var util=require(_0x8ba3('0x1'));var path=require(_0x8ba3('0x2'));var timeout=require(_0x8ba3('0x3'));var express=require(_0x8ba3('0x4'));var router=express[_0x8ba3('0x5')]();var fs_extra=require(_0x8ba3('0x6'));var auth=require(_0x8ba3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ba3('0x8'));var controller=require('./intDeskAccount.controller');router[_0x8ba3('0x9')]('/',auth[_0x8ba3('0xa')](),controller[_0x8ba3('0xb')]);router['get'](_0x8ba3('0xc'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0xd')]);router[_0x8ba3('0x9')](_0x8ba3('0xe'),auth['isAuthenticated'](),controller[_0x8ba3('0xf')]);router[_0x8ba3('0x9')](_0x8ba3('0x10'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x11')]);router[_0x8ba3('0x12')]('/',auth[_0x8ba3('0xa')](),controller['create']);router[_0x8ba3('0x12')](_0x8ba3('0xe'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x13')]);router['put'](_0x8ba3('0xc'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x14')]);router[_0x8ba3('0x15')](_0x8ba3('0xc'),auth[_0x8ba3('0xa')](),controller[_0x8ba3('0x16')]);module['exports']=router; \ No newline at end of file +var _0xca15=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3c61b7,_0x36e756){var _0x399e6f=function(_0x506e95){while(--_0x506e95){_0x3c61b7['push'](_0x3c61b7['shift']());}};_0x399e6f(++_0x36e756);}(_0xca15,0xca));var _0x5ca1=function(_0x58f579,_0x232e82){_0x58f579=_0x58f579-0x0;var _0x5d294c=_0xca15[_0x58f579];return _0x5d294c;};'use strict';var multer=require(_0x5ca1('0x0'));var util=require(_0x5ca1('0x1'));var path=require(_0x5ca1('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ca1('0x3'));var router=express[_0x5ca1('0x4')]();var fs_extra=require(_0x5ca1('0x5'));var auth=require(_0x5ca1('0x6'));var interaction=require(_0x5ca1('0x7'));var config=require(_0x5ca1('0x8'));var controller=require(_0x5ca1('0x9'));router[_0x5ca1('0xa')]('/',auth[_0x5ca1('0xb')](),controller[_0x5ca1('0xc')]);router[_0x5ca1('0xa')]('/:id',auth[_0x5ca1('0xb')](),controller[_0x5ca1('0xd')]);router[_0x5ca1('0xa')](_0x5ca1('0xe'),auth[_0x5ca1('0xb')](),controller[_0x5ca1('0xf')]);router[_0x5ca1('0xa')](_0x5ca1('0x10'),auth[_0x5ca1('0xb')](),controller['getFields']);router[_0x5ca1('0x11')]('/',auth['isAuthenticated'](),controller[_0x5ca1('0x12')]);router[_0x5ca1('0x11')](_0x5ca1('0xe'),auth[_0x5ca1('0xb')](),controller[_0x5ca1('0x13')]);router[_0x5ca1('0x14')](_0x5ca1('0x15'),auth[_0x5ca1('0xb')](),controller[_0x5ca1('0x16')]);router[_0x5ca1('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x5ca1('0x18')]);module[_0x5ca1('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 25843cb..26f0ef3 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 _0x552a=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x5da337,_0x3a55fb){var _0x3dd702=function(_0x1ab70f){while(--_0x1ab70f){_0x5da337['push'](_0x5da337['shift']());}};_0x3dd702(++_0x3a55fb);}(_0x552a,0x9e));var _0xa552=function(_0x55a619,_0x5916d0){_0x55a619=_0x55a619-0x0;var _0x3365c6=_0x552a[_0x55a619];return _0x3365c6;};'use strict';var Sequelize=require(_0xa552('0x0'));module[_0xa552('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa552('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa552('0x2')]},'authType':{'type':Sequelize[_0xa552('0x3')](_0xa552('0x4')),'defaultValue':_0xa552('0x4')},'password':{'type':Sequelize[_0xa552('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa552('0x2')]},'tokenSecret':{'type':Sequelize[_0xa552('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa552('0x5'),_0xa552('0x6')),'defaultValue':_0xa552('0x5')}}; \ No newline at end of file +var _0xaab4=['STRING','basic','integrationTab','newTab','exports'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0xaab4,0xa4));var _0x4aab=function(_0x26bcef,_0x4e2195){_0x26bcef=_0x26bcef-0x0;var _0x3d691b=_0xaab4[_0x26bcef];return _0x3d691b;};'use strict';var Sequelize=require('sequelize');module[_0x4aab('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4aab('0x1')]},'username':{'type':Sequelize[_0x4aab('0x1')]},'remoteUri':{'type':Sequelize[_0x4aab('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x4aab('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x4aab('0x1')]},'token':{'type':Sequelize[_0x4aab('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4aab('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4aab('0x3'),_0x4aab('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8850587..218cbde 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 _0x56be=['body','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','channel','Subjects','priority','remoteUri','consumerKey','token','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','end','error','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x56be,0x161));var _0xe56b=function(_0x4b9c67,_0x634eb2){_0x4b9c67=_0x4b9c67-0x0;var _0x555e63=_0x56be[_0x4b9c67];return _0x555e63;};'use strict';var emlformat=require(_0xe56b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe56b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe56b('0x2'));var moment=require(_0xe56b('0x3'));var BPromise=require(_0xe56b('0x4'));var Mustache=require(_0xe56b('0x5'));var util=require(_0xe56b('0x6'));var path=require(_0xe56b('0x7'));var sox=require('sox');var csv=require(_0xe56b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe56b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe56b('0xa'));var toCsv=require(_0xe56b('0x8'));var querystring=require(_0xe56b('0xb'));var Papa=require(_0xe56b('0xc'));var Redis=require(_0xe56b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe56b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe56b('0xf'))(_0xe56b('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe56b('0x11'));var db=require(_0xe56b('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16e06b,_0x2cda96){_0x2cda96=_0x2cda96||0xcc;return function(_0x5a202c){if(_0x5a202c){return _0x16e06b[_0xe56b('0x13')](_0x2cda96);}return _0x16e06b[_0xe56b('0x14')](_0x2cda96)['end']();};}function respondWithResult(_0x459a1d,_0x25032e){_0x25032e=_0x25032e||0xc8;return function(_0x19ef73){if(_0x19ef73){return _0x459a1d['status'](_0x25032e)['json'](_0x19ef73);}};}function respondWithFilteredResult(_0x3557cd,_0x387062){return function(_0x3a74d5){if(_0x3a74d5){var _0x3ea9fc=typeof _0x387062[_0xe56b('0x15')]===_0xe56b('0x16')&&typeof _0x387062[_0xe56b('0x17')]===_0xe56b('0x16');var _0x173bbd=_0x3a74d5[_0xe56b('0x18')];var _0x347114=_0x3ea9fc?0x0:_0x387062[_0xe56b('0x15')];var _0x30a133=_0x3ea9fc?_0x3a74d5['count']:_0x387062[_0xe56b('0x15')]+_0x387062['limit'];var _0xdf617c;if(_0x30a133>=_0x173bbd){_0x30a133=_0x173bbd;_0xdf617c=0xc8;}else{_0xdf617c=0xce;}_0x3557cd[_0xe56b('0x14')](_0xdf617c);return _0x3557cd['set'](_0xe56b('0x19'),_0x347114+'-'+_0x30a133+'/'+_0x173bbd)['json'](_0x3a74d5);}return null;};}function patchUpdates(_0x5da77c){return function(_0x5afe54){try{jsonpatch[_0xe56b('0x1a')](_0x5afe54,_0x5da77c,!![]);}catch(_0x364f1e){return BPromise[_0xe56b('0x1b')](_0x364f1e);}return _0x5afe54[_0xe56b('0x1c')]();};}function saveUpdates(_0x1d48e6,_0x3c251b){return function(_0xa16c93){if(_0xa16c93){return _0xa16c93[_0xe56b('0x1d')](_0x1d48e6)['then'](function(_0x153da7){return _0x153da7;});}return null;};}function removeEntity(_0xe732ee,_0x3b2120){return function(_0x476a0f){if(_0x476a0f){return _0x476a0f['destroy']()['then'](function(){_0xe732ee[_0xe56b('0x14')](0xcc)[_0xe56b('0x1e')]();});}};}function handleEntityNotFound(_0x3c0739,_0x2719d6){return function(_0x5df09b){if(!_0x5df09b){_0x3c0739[_0xe56b('0x13')](0x194);}return _0x5df09b;};}function handleError(_0x4514ee,_0x55d73c){_0x55d73c=_0x55d73c||0x1f4;return function(_0x1c317a){logger[_0xe56b('0x1f')](_0x1c317a['stack']);if(_0x1c317a[_0xe56b('0x20')]){delete _0x1c317a['name'];}_0x4514ee[_0xe56b('0x14')](_0x55d73c)['send'](_0x1c317a);};}exports[_0xe56b('0x21')]=function(_0x208a25,_0x40cc0f){var _0x21304a={},_0x251efe={},_0xdc60d4={'count':0x0,'rows':[]};var _0x125959=_[_0xe56b('0x22')](db[_0xe56b('0x23')][_0xe56b('0x24')],function(_0x4e7e41){return{'name':_0x4e7e41[_0xe56b('0x25')],'type':_0x4e7e41[_0xe56b('0x26')][_0xe56b('0x27')]};});_0x251efe['model']=_[_0xe56b('0x22')](_0x125959,_0xe56b('0x20'));_0x251efe[_0xe56b('0x28')]=_[_0xe56b('0x29')](_0x208a25['query']);_0x251efe[_0xe56b('0x2a')]=_[_0xe56b('0x2b')](_0x251efe[_0xe56b('0x2c')],_0x251efe[_0xe56b('0x28')]);_0x21304a[_0xe56b('0x2d')]=_['intersection'](_0x251efe[_0xe56b('0x2c')],qs[_0xe56b('0x2e')](_0x208a25[_0xe56b('0x28')]['fields']));_0x21304a[_0xe56b('0x2d')]=_0x21304a[_0xe56b('0x2d')][_0xe56b('0x2f')]?_0x21304a[_0xe56b('0x2d')]:_0x251efe[_0xe56b('0x2c')];if(!_0x208a25['query'][_0xe56b('0x30')](_0xe56b('0x31'))){_0x21304a['limit']=qs[_0xe56b('0x17')](_0x208a25[_0xe56b('0x28')][_0xe56b('0x17')]);_0x21304a[_0xe56b('0x15')]=qs['offset'](_0x208a25['query'][_0xe56b('0x15')]);}_0x21304a[_0xe56b('0x32')]=qs['sort'](_0x208a25[_0xe56b('0x28')][_0xe56b('0x33')]);_0x21304a['where']=qs['filters'](_['pick'](_0x208a25[_0xe56b('0x28')],_0x251efe[_0xe56b('0x2a')]),_0x125959);if(_0x208a25[_0xe56b('0x28')][_0xe56b('0x34')]){_0x21304a['where']=_['merge'](_0x21304a[_0xe56b('0x35')],{'$or':_[_0xe56b('0x22')](_0x125959,function(_0x9c0729){if(_0x9c0729[_0xe56b('0x26')]!==_0xe56b('0x36')){var _0x38f856={};_0x38f856[_0x9c0729[_0xe56b('0x20')]]={'$like':'%'+_0x208a25[_0xe56b('0x28')]['filter']+'%'};return _0x38f856;}})});}_0x21304a=_[_0xe56b('0x37')]({},_0x21304a,_0x208a25[_0xe56b('0x38')]);var _0x3ac80a={'where':_0x21304a['where']};return db[_0xe56b('0x23')][_0xe56b('0x18')](_0x3ac80a)[_0xe56b('0x39')](function(_0x1d7f20){_0xdc60d4[_0xe56b('0x18')]=_0x1d7f20;if(_0x208a25[_0xe56b('0x28')][_0xe56b('0x3a')]){_0x21304a[_0xe56b('0x3b')]=[{'all':!![]}];}return db[_0xe56b('0x23')][_0xe56b('0x3c')](_0x21304a);})[_0xe56b('0x39')](function(_0x8eedd5){_0xdc60d4[_0xe56b('0x3d')]=_0x8eedd5;return _0xdc60d4;})[_0xe56b('0x39')](respondWithFilteredResult(_0x40cc0f,_0x21304a))[_0xe56b('0x3e')](handleError(_0x40cc0f,null));};exports[_0xe56b('0x3f')]=function(_0x5b800d,_0x2588bc){var _0x1ac6b1={'raw':![],'where':{'id':_0x5b800d[_0xe56b('0x40')]['id']}},_0x2bccce={};_0x2bccce['model']=_[_0xe56b('0x29')](db['DeskAccount'][_0xe56b('0x24')]);_0x2bccce[_0xe56b('0x28')]=_[_0xe56b('0x29')](_0x5b800d[_0xe56b('0x28')]);_0x2bccce[_0xe56b('0x2a')]=_[_0xe56b('0x2b')](_0x2bccce['model'],_0x2bccce[_0xe56b('0x28')]);_0x1ac6b1[_0xe56b('0x2d')]=_['intersection'](_0x2bccce[_0xe56b('0x2c')],qs[_0xe56b('0x2e')](_0x5b800d[_0xe56b('0x28')][_0xe56b('0x2e')]));_0x1ac6b1[_0xe56b('0x2d')]=_0x1ac6b1[_0xe56b('0x2d')][_0xe56b('0x2f')]?_0x1ac6b1[_0xe56b('0x2d')]:_0x2bccce[_0xe56b('0x2c')];if(_0x5b800d[_0xe56b('0x28')]['includeAll']){_0x1ac6b1['include']=[{'all':!![]}];}_0x1ac6b1=_[_0xe56b('0x37')]({},_0x1ac6b1,_0x5b800d[_0xe56b('0x38')]);return db[_0xe56b('0x23')][_0xe56b('0x41')](_0x1ac6b1)['then'](handleEntityNotFound(_0x2588bc,null))[_0xe56b('0x39')](respondWithResult(_0x2588bc,null))[_0xe56b('0x3e')](handleError(_0x2588bc,null));};exports[_0xe56b('0x42')]=function(_0x849b0c,_0x33f04f){return db[_0xe56b('0x23')][_0xe56b('0x42')](_0x849b0c[_0xe56b('0x43')],{})['then'](respondWithResult(_0x33f04f,0xc9))['catch'](handleError(_0x33f04f,null));};exports[_0xe56b('0x1d')]=function(_0x83b4f,_0x2d84ef){if(_0x83b4f[_0xe56b('0x43')]['id']){delete _0x83b4f[_0xe56b('0x43')]['id'];}return db['DeskAccount'][_0xe56b('0x41')]({'where':{'id':_0x83b4f[_0xe56b('0x40')]['id']}})[_0xe56b('0x39')](handleEntityNotFound(_0x2d84ef,null))[_0xe56b('0x39')](saveUpdates(_0x83b4f[_0xe56b('0x43')],null))['then'](respondWithResult(_0x2d84ef,null))[_0xe56b('0x3e')](handleError(_0x2d84ef,null));};exports[_0xe56b('0x44')]=function(_0x283c0f,_0x26694a){return db[_0xe56b('0x23')][_0xe56b('0x41')]({'where':{'id':_0x283c0f['params']['id']}})[_0xe56b('0x39')](handleEntityNotFound(_0x26694a,null))[_0xe56b('0x39')](removeEntity(_0x26694a,null))[_0xe56b('0x3e')](handleError(_0x26694a,null));};exports[_0xe56b('0x45')]=function(_0x4e4599,_0x5bf555,_0x2f322b){var _0xe47d78={};var _0x3bbd75={};var _0x55c918;var _0x239003;return db[_0xe56b('0x23')][_0xe56b('0x46')]({'where':{'id':_0x4e4599[_0xe56b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5bf555,null))[_0xe56b('0x39')](function(_0x27f7b1){if(_0x27f7b1){_0x55c918=_0x27f7b1;_0x3bbd75[_0xe56b('0x2c')]=_['keys'](db[_0xe56b('0x47')][_0xe56b('0x24')]);_0x3bbd75[_0xe56b('0x28')]=_['keys'](_0x4e4599['query']);_0x3bbd75[_0xe56b('0x2a')]=_[_0xe56b('0x2b')](_0x3bbd75[_0xe56b('0x2c')],_0x3bbd75[_0xe56b('0x28')]);_0xe47d78[_0xe56b('0x2d')]=_[_0xe56b('0x2b')](_0x3bbd75[_0xe56b('0x2c')],qs[_0xe56b('0x2e')](_0x4e4599[_0xe56b('0x28')][_0xe56b('0x2e')]));_0xe47d78[_0xe56b('0x2d')]=_0xe47d78['attributes'][_0xe56b('0x2f')]?_0xe47d78['attributes']:_0x3bbd75['model'];_0xe47d78[_0xe56b('0x32')]=qs[_0xe56b('0x33')](_0x4e4599[_0xe56b('0x28')]['sort']);_0xe47d78[_0xe56b('0x35')]=qs[_0xe56b('0x2a')](_['pick'](_0x4e4599['query'],_0x3bbd75[_0xe56b('0x2a')]));if(_0x4e4599[_0xe56b('0x28')][_0xe56b('0x34')]){_0xe47d78[_0xe56b('0x35')]=_[_0xe56b('0x37')](_0xe47d78[_0xe56b('0x35')],{'$or':_['map'](_0xe47d78[_0xe56b('0x2d')],function(_0x5d69d9){var _0x10257f={};_0x10257f[_0x5d69d9]={'$like':'%'+_0x4e4599[_0xe56b('0x28')][_0xe56b('0x34')]+'%'};return _0x10257f;})});}_0xe47d78=_[_0xe56b('0x37')]({},_0xe47d78,_0x4e4599[_0xe56b('0x38')]);return _0x55c918['getConfigurations'](_0xe47d78);}})[_0xe56b('0x39')](function(_0x14dc48){if(_0x14dc48){_0x239003=_0x14dc48[_0xe56b('0x2f')];if(!_0x4e4599[_0xe56b('0x28')]['hasOwnProperty'](_0xe56b('0x31'))){_0xe47d78[_0xe56b('0x17')]=qs[_0xe56b('0x17')](_0x4e4599[_0xe56b('0x28')][_0xe56b('0x17')]);_0xe47d78['offset']=qs[_0xe56b('0x15')](_0x4e4599[_0xe56b('0x28')][_0xe56b('0x15')]);}return _0x55c918[_0xe56b('0x45')](_0xe47d78);}})[_0xe56b('0x39')](function(_0x32b053){if(_0x32b053){return _0x32b053?{'count':_0x239003,'rows':_0x32b053}:null;}})[_0xe56b('0x39')](respondWithResult(_0x5bf555,null))['catch'](handleError(_0x5bf555,null));};exports[_0xe56b('0x48')]=function(_0x7d6074,_0x413e7a,_0xc60836){if(_0x7d6074[_0xe56b('0x43')]['id']){delete _0x7d6074['body']['id'];}return db[_0xe56b('0x23')][_0xe56b('0x46')]({'where':{'id':_0x7d6074['params']['id']}})[_0xe56b('0x39')](handleEntityNotFound(_0x413e7a,null))[_0xe56b('0x39')](function(_0x10e8ab){if(_0x10e8ab){_0x7d6074[_0xe56b('0x43')][_0xe56b('0x49')]=_0x10e8ab['id'];_0x7d6074['body']['Subjects']=integrations[_0xe56b('0x4a')](_0x7d6074['body']['channel'],_0x7d6074[_0xe56b('0x43')][_0xe56b('0x26')]);_0x7d6074[_0xe56b('0x43')][_0xe56b('0x4b')]=integrations['getDescriptions'](_0x7d6074[_0xe56b('0x43')][_0xe56b('0x4c')],_0x7d6074[_0xe56b('0x43')][_0xe56b('0x26')]);return db[_0xe56b('0x47')][_0xe56b('0x42')](_0x7d6074[_0xe56b('0x43')],{'include':[{'model':db['DeskField'],'as':_0xe56b('0x4d')},{'model':db['DeskField'],'as':_0xe56b('0x4b')}]});}return null;})[_0xe56b('0x39')](respondWithResult(_0x413e7a,null))['catch'](handleError(_0x413e7a,null));};exports['getFields']=function(_0x5be097,_0x26b3f2,_0x12aa8a){var _0xd823a5=[{'name':_0xe56b('0x4e'),'label':_0xe56b('0x4e'),'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 _0x3915ee='';return db[_0xe56b('0x23')][_0xe56b('0x46')]({'where':{'id':_0x5be097[_0xe56b('0x40')]['id']},'attributes':['id',_0xe56b('0x4f'),'authType','username','password',_0xe56b('0x50'),'consumerSecret',_0xe56b('0x51'),'tokenSecret']})['then'](handleEntityNotFound(_0x26b3f2,null))[_0xe56b('0x39')](function(_0x76757f){if(_0x76757f){_0x3915ee=_0x76757f['remoteUri'];var _0x52dabe=_0x3915ee['slice'](-0x1);if(_0x52dabe==='/'){_0x3915ee=_0x3915ee[_0xe56b('0x52')](0x0,_0x3915ee[_0xe56b('0x53')](_0x52dabe));}var _0x525434={'method':'GET','uri':util[_0xe56b('0x54')](_0xe56b('0x55'),_0x3915ee),'headers':{'Content-Type':_0xe56b('0x56'),'Accept':_0xe56b('0x56')},'json':!![]};if(_0x76757f[_0xe56b('0x57')]===_0xe56b('0x58')){_0x525434['headers'][_0xe56b('0x59')]=util[_0xe56b('0x54')](_0xe56b('0x5a'),new Buffer(util[_0xe56b('0x54')](_0xe56b('0x5b'),_0x76757f['username'],_0x76757f['password']))[_0xe56b('0x5c')](_0xe56b('0x5d')));}return rp(_0x525434)['then'](function(_0x1a7a78){return _0xd823a5[_0xe56b('0x5e')](_[_0xe56b('0x22')](_0x1a7a78[_0xe56b('0x5f')][_0xe56b('0x60')],function(_0x4edbbd){return{'id':_0x4edbbd[_0xe56b('0x20')],'name':_0x4edbbd[_0xe56b('0x20')],'type':_0x4edbbd[_0xe56b('0x26')],'active':_0x4edbbd[_0xe56b('0x61')],'label':_0x4edbbd[_0xe56b('0x62')],'custom':!![]};}));});}})[_0xe56b('0x39')](function(_0x31b2c0){return{'count':_0x31b2c0[_0xe56b('0x2f')],'rows':_0x31b2c0};})[_0xe56b('0x39')](respondWithResult(_0x26b3f2,null))[_0xe56b('0x3e')](function(_0x4aed3f){var _0x52370d=_0x5be097[_0xe56b('0x28')][_0xe56b('0x63')]?0x1f4:_0x4aed3f[_0xe56b('0x64')]||0x1f4;logger[_0xe56b('0x1f')](_0xe56b('0x65'),_0xe56b('0x66'),_0x52370d,JSON[_0xe56b('0x67')](_0x4aed3f));delete _0x4aed3f[_0xe56b('0x20')];if(_0x52370d===0x191){_0x52370d=0x190;}_0x26b3f2[_0xe56b('0x14')](_0x52370d)['send'](_0x5be097[_0xe56b('0x28')][_0xe56b('0x63')]?{'message':_0xe56b('0x68'),'statusCode':_0x4aed3f['statusCode']}:_0x4aed3f);});}; \ No newline at end of file +var _0x6a2a=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','json','offset','undefined','count','Content-Range','apply','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','DeskAccount','findAll','rows','show','options','find','create','body','params','catch','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','channel','getDescriptions','DeskField','Subjects','Descriptions','getFields','priority','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','toString','base64','concat','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1cc3ce,_0x43791e){var _0x4ac6ac=function(_0x15d789){while(--_0x15d789){_0x1cc3ce['push'](_0x1cc3ce['shift']());}};_0x4ac6ac(++_0x43791e);}(_0x6a2a,0x15a));var _0xa6a2=function(_0x120900,_0x1b16c7){_0x120900=_0x120900-0x0;var _0x356528=_0x6a2a[_0x120900];return _0x356528;};'use strict';var emlformat=require(_0xa6a2('0x0'));var rimraf=require(_0xa6a2('0x1'));var zipdir=require(_0xa6a2('0x2'));var jsonpatch=require(_0xa6a2('0x3'));var rp=require(_0xa6a2('0x4'));var moment=require(_0xa6a2('0x5'));var BPromise=require(_0xa6a2('0x6'));var Mustache=require(_0xa6a2('0x7'));var util=require(_0xa6a2('0x8'));var path=require(_0xa6a2('0x9'));var sox=require(_0xa6a2('0xa'));var csv=require(_0xa6a2('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa6a2('0xc'));var squel=require(_0xa6a2('0xd'));var crypto=require(_0xa6a2('0xe'));var jsforce=require(_0xa6a2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa6a2('0xb'));var querystring=require('querystring');var Papa=require(_0xa6a2('0x10'));var Redis=require(_0xa6a2('0x11'));var authService=require(_0xa6a2('0x12'));var qs=require(_0xa6a2('0x13'));var as=require(_0xa6a2('0x14'));var hardwareService=require(_0xa6a2('0x15'));var logger=require(_0xa6a2('0x16'))(_0xa6a2('0x17'));var utils=require(_0xa6a2('0x18'));var config=require(_0xa6a2('0x19'));var licenseUtil=require(_0xa6a2('0x1a'));var db=require(_0xa6a2('0x1b'))['db'];var integrations=require(_0xa6a2('0x1c'));function respondWithStatusCode(_0x17abf2,_0x34069d){_0x34069d=_0x34069d||0xcc;return function(_0x4a24f8){if(_0x4a24f8){return _0x17abf2[_0xa6a2('0x1d')](_0x34069d);}return _0x17abf2['status'](_0x34069d)['end']();};}function respondWithResult(_0x32d6b3,_0x22a87c){_0x22a87c=_0x22a87c||0xc8;return function(_0x1f80f6){if(_0x1f80f6){return _0x32d6b3[_0xa6a2('0x1e')](_0x22a87c)[_0xa6a2('0x1f')](_0x1f80f6);}};}function respondWithFilteredResult(_0x217cdd,_0x5b3f4e){return function(_0x435276){if(_0x435276){var _0x508f0e=typeof _0x5b3f4e[_0xa6a2('0x20')]===_0xa6a2('0x21')&&typeof _0x5b3f4e['limit']===_0xa6a2('0x21');var _0x194ce8=_0x435276[_0xa6a2('0x22')];var _0x3578d9=_0x508f0e?0x0:_0x5b3f4e['offset'];var _0x377655=_0x508f0e?_0x435276[_0xa6a2('0x22')]:_0x5b3f4e['offset']+_0x5b3f4e['limit'];var _0x5b6156;if(_0x377655>=_0x194ce8){_0x377655=_0x194ce8;_0x5b6156=0xc8;}else{_0x5b6156=0xce;}_0x217cdd[_0xa6a2('0x1e')](_0x5b6156);return _0x217cdd['set'](_0xa6a2('0x23'),_0x3578d9+'-'+_0x377655+'/'+_0x194ce8)[_0xa6a2('0x1f')](_0x435276);}return null;};}function patchUpdates(_0x4377a4){return function(_0x5173a2){try{jsonpatch[_0xa6a2('0x24')](_0x5173a2,_0x4377a4,!![]);}catch(_0x475823){return BPromise['reject'](_0x475823);}return _0x5173a2[_0xa6a2('0x25')]();};}function saveUpdates(_0x3bb166,_0x452a32){return function(_0x5e15c4){if(_0x5e15c4){return _0x5e15c4[_0xa6a2('0x26')](_0x3bb166)[_0xa6a2('0x27')](function(_0x59cdff){return _0x59cdff;});}return null;};}function removeEntity(_0x253fde,_0x2401a7){return function(_0x1814d1){if(_0x1814d1){return _0x1814d1['destroy']()['then'](function(){_0x253fde[_0xa6a2('0x1e')](0xcc)[_0xa6a2('0x28')]();});}};}function handleEntityNotFound(_0x289115,_0x26edc4){return function(_0x35a8de){if(!_0x35a8de){_0x289115[_0xa6a2('0x1d')](0x194);}return _0x35a8de;};}function handleError(_0x466184,_0x197995){_0x197995=_0x197995||0x1f4;return function(_0x5b4aff){logger['error'](_0x5b4aff[_0xa6a2('0x29')]);if(_0x5b4aff[_0xa6a2('0x2a')]){delete _0x5b4aff[_0xa6a2('0x2a')];}_0x466184[_0xa6a2('0x1e')](_0x197995)[_0xa6a2('0x2b')](_0x5b4aff);};}exports[_0xa6a2('0x2c')]=function(_0x3f8095,_0x459bb7){var _0x33d381={},_0x141006={},_0x37195a={'count':0x0,'rows':[]};var _0x32aacb=_[_0xa6a2('0x2d')](db['DeskAccount'][_0xa6a2('0x2e')],function(_0x3d2479){return{'name':_0x3d2479[_0xa6a2('0x2f')],'type':_0x3d2479[_0xa6a2('0x30')][_0xa6a2('0x31')]};});_0x141006[_0xa6a2('0x32')]=_['map'](_0x32aacb,_0xa6a2('0x2a'));_0x141006[_0xa6a2('0x33')]=_[_0xa6a2('0x34')](_0x3f8095[_0xa6a2('0x33')]);_0x141006[_0xa6a2('0x35')]=_['intersection'](_0x141006[_0xa6a2('0x32')],_0x141006[_0xa6a2('0x33')]);_0x33d381[_0xa6a2('0x36')]=_[_0xa6a2('0x37')](_0x141006[_0xa6a2('0x32')],qs['fields'](_0x3f8095[_0xa6a2('0x33')][_0xa6a2('0x38')]));_0x33d381[_0xa6a2('0x36')]=_0x33d381['attributes'][_0xa6a2('0x39')]?_0x33d381['attributes']:_0x141006[_0xa6a2('0x32')];if(!_0x3f8095[_0xa6a2('0x33')][_0xa6a2('0x3a')](_0xa6a2('0x3b'))){_0x33d381['limit']=qs[_0xa6a2('0x3c')](_0x3f8095[_0xa6a2('0x33')][_0xa6a2('0x3c')]);_0x33d381[_0xa6a2('0x20')]=qs[_0xa6a2('0x20')](_0x3f8095[_0xa6a2('0x33')]['offset']);}_0x33d381[_0xa6a2('0x3d')]=qs['sort'](_0x3f8095[_0xa6a2('0x33')][_0xa6a2('0x3e')]);_0x33d381[_0xa6a2('0x3f')]=qs[_0xa6a2('0x35')](_[_0xa6a2('0x40')](_0x3f8095[_0xa6a2('0x33')],_0x141006[_0xa6a2('0x35')]),_0x32aacb);if(_0x3f8095[_0xa6a2('0x33')][_0xa6a2('0x41')]){_0x33d381[_0xa6a2('0x3f')]=_[_0xa6a2('0x42')](_0x33d381[_0xa6a2('0x3f')],{'$or':_[_0xa6a2('0x2d')](_0x32aacb,function(_0x4bf7c1){if(_0x4bf7c1[_0xa6a2('0x30')]!==_0xa6a2('0x43')){var _0x1b30b8={};_0x1b30b8[_0x4bf7c1['name']]={'$like':'%'+_0x3f8095[_0xa6a2('0x33')][_0xa6a2('0x41')]+'%'};return _0x1b30b8;}})});}_0x33d381=_[_0xa6a2('0x42')]({},_0x33d381,_0x3f8095['options']);var _0x3b4726={'where':_0x33d381[_0xa6a2('0x3f')]};return db['DeskAccount'][_0xa6a2('0x22')](_0x3b4726)['then'](function(_0x47e9e5){_0x37195a[_0xa6a2('0x22')]=_0x47e9e5;if(_0x3f8095['query']['includeAll']){_0x33d381[_0xa6a2('0x44')]=[{'all':!![]}];}return db[_0xa6a2('0x45')][_0xa6a2('0x46')](_0x33d381);})[_0xa6a2('0x27')](function(_0x3b9f96){_0x37195a[_0xa6a2('0x47')]=_0x3b9f96;return _0x37195a;})[_0xa6a2('0x27')](respondWithFilteredResult(_0x459bb7,_0x33d381))['catch'](handleError(_0x459bb7,null));};exports[_0xa6a2('0x48')]=function(_0x5a5db2,_0x4f40d9){var _0x23bab5={'raw':![],'where':{'id':_0x5a5db2['params']['id']}},_0x4f1338={};_0x4f1338[_0xa6a2('0x32')]=_['keys'](db[_0xa6a2('0x45')][_0xa6a2('0x2e')]);_0x4f1338['query']=_['keys'](_0x5a5db2[_0xa6a2('0x33')]);_0x4f1338[_0xa6a2('0x35')]=_[_0xa6a2('0x37')](_0x4f1338[_0xa6a2('0x32')],_0x4f1338['query']);_0x23bab5[_0xa6a2('0x36')]=_[_0xa6a2('0x37')](_0x4f1338['model'],qs[_0xa6a2('0x38')](_0x5a5db2['query'][_0xa6a2('0x38')]));_0x23bab5[_0xa6a2('0x36')]=_0x23bab5[_0xa6a2('0x36')][_0xa6a2('0x39')]?_0x23bab5[_0xa6a2('0x36')]:_0x4f1338[_0xa6a2('0x32')];if(_0x5a5db2[_0xa6a2('0x33')]['includeAll']){_0x23bab5['include']=[{'all':!![]}];}_0x23bab5=_[_0xa6a2('0x42')]({},_0x23bab5,_0x5a5db2[_0xa6a2('0x49')]);return db['DeskAccount'][_0xa6a2('0x4a')](_0x23bab5)[_0xa6a2('0x27')](handleEntityNotFound(_0x4f40d9,null))['then'](respondWithResult(_0x4f40d9,null))['catch'](handleError(_0x4f40d9,null));};exports[_0xa6a2('0x4b')]=function(_0x3e7a6c,_0x49214c){return db[_0xa6a2('0x45')]['create'](_0x3e7a6c['body'],{})[_0xa6a2('0x27')](respondWithResult(_0x49214c,0xc9))['catch'](handleError(_0x49214c,null));};exports[_0xa6a2('0x26')]=function(_0x8de8c3,_0xaf1641){if(_0x8de8c3[_0xa6a2('0x4c')]['id']){delete _0x8de8c3[_0xa6a2('0x4c')]['id'];}return db[_0xa6a2('0x45')][_0xa6a2('0x4a')]({'where':{'id':_0x8de8c3[_0xa6a2('0x4d')]['id']}})['then'](handleEntityNotFound(_0xaf1641,null))[_0xa6a2('0x27')](saveUpdates(_0x8de8c3['body'],null))[_0xa6a2('0x27')](respondWithResult(_0xaf1641,null))[_0xa6a2('0x4e')](handleError(_0xaf1641,null));};exports['destroy']=function(_0x452a67,_0x165073){return db[_0xa6a2('0x45')][_0xa6a2('0x4a')]({'where':{'id':_0x452a67[_0xa6a2('0x4d')]['id']}})[_0xa6a2('0x27')](handleEntityNotFound(_0x165073,null))[_0xa6a2('0x27')](removeEntity(_0x165073,null))[_0xa6a2('0x4e')](handleError(_0x165073,null));};exports[_0xa6a2('0x4f')]=function(_0x23d348,_0x4e7913,_0x547e91){var _0xc76ee5={};var _0x3bb07f={};var _0x853112;var _0x1a3bcc;return db[_0xa6a2('0x45')][_0xa6a2('0x50')]({'where':{'id':_0x23d348[_0xa6a2('0x4d')]['id']}})[_0xa6a2('0x27')](handleEntityNotFound(_0x4e7913,null))[_0xa6a2('0x27')](function(_0x4366d1){if(_0x4366d1){_0x853112=_0x4366d1;_0x3bb07f[_0xa6a2('0x32')]=_[_0xa6a2('0x34')](db[_0xa6a2('0x51')][_0xa6a2('0x2e')]);_0x3bb07f[_0xa6a2('0x33')]=_[_0xa6a2('0x34')](_0x23d348[_0xa6a2('0x33')]);_0x3bb07f[_0xa6a2('0x35')]=_['intersection'](_0x3bb07f[_0xa6a2('0x32')],_0x3bb07f[_0xa6a2('0x33')]);_0xc76ee5[_0xa6a2('0x36')]=_[_0xa6a2('0x37')](_0x3bb07f[_0xa6a2('0x32')],qs[_0xa6a2('0x38')](_0x23d348[_0xa6a2('0x33')][_0xa6a2('0x38')]));_0xc76ee5[_0xa6a2('0x36')]=_0xc76ee5[_0xa6a2('0x36')]['length']?_0xc76ee5[_0xa6a2('0x36')]:_0x3bb07f[_0xa6a2('0x32')];_0xc76ee5[_0xa6a2('0x3d')]=qs['sort'](_0x23d348['query'][_0xa6a2('0x3e')]);_0xc76ee5[_0xa6a2('0x3f')]=qs[_0xa6a2('0x35')](_['pick'](_0x23d348[_0xa6a2('0x33')],_0x3bb07f[_0xa6a2('0x35')]));if(_0x23d348[_0xa6a2('0x33')][_0xa6a2('0x41')]){_0xc76ee5['where']=_['merge'](_0xc76ee5['where'],{'$or':_[_0xa6a2('0x2d')](_0xc76ee5[_0xa6a2('0x36')],function(_0x37dca3){var _0x3f04b5={};_0x3f04b5[_0x37dca3]={'$like':'%'+_0x23d348[_0xa6a2('0x33')][_0xa6a2('0x41')]+'%'};return _0x3f04b5;})});}_0xc76ee5=_[_0xa6a2('0x42')]({},_0xc76ee5,_0x23d348[_0xa6a2('0x49')]);return _0x853112[_0xa6a2('0x4f')](_0xc76ee5);}})['then'](function(_0x525312){if(_0x525312){_0x1a3bcc=_0x525312[_0xa6a2('0x39')];if(!_0x23d348[_0xa6a2('0x33')]['hasOwnProperty'](_0xa6a2('0x3b'))){_0xc76ee5[_0xa6a2('0x3c')]=qs[_0xa6a2('0x3c')](_0x23d348['query'][_0xa6a2('0x3c')]);_0xc76ee5['offset']=qs[_0xa6a2('0x20')](_0x23d348[_0xa6a2('0x33')]['offset']);}return _0x853112[_0xa6a2('0x4f')](_0xc76ee5);}})[_0xa6a2('0x27')](function(_0x2a3e4c){if(_0x2a3e4c){return _0x2a3e4c?{'count':_0x1a3bcc,'rows':_0x2a3e4c}:null;}})[_0xa6a2('0x27')](respondWithResult(_0x4e7913,null))[_0xa6a2('0x4e')](handleError(_0x4e7913,null));};exports[_0xa6a2('0x52')]=function(_0xcb58fe,_0xae387e,_0x2eadfd){if(_0xcb58fe[_0xa6a2('0x4c')]['id']){delete _0xcb58fe[_0xa6a2('0x4c')]['id'];}return db[_0xa6a2('0x45')][_0xa6a2('0x50')]({'where':{'id':_0xcb58fe[_0xa6a2('0x4d')]['id']}})['then'](handleEntityNotFound(_0xae387e,null))[_0xa6a2('0x27')](function(_0x26bb37){if(_0x26bb37){_0xcb58fe[_0xa6a2('0x4c')][_0xa6a2('0x53')]=_0x26bb37['id'];_0xcb58fe[_0xa6a2('0x4c')]['Subjects']=integrations['getSubjects'](_0xcb58fe[_0xa6a2('0x4c')][_0xa6a2('0x54')],_0xcb58fe['body']['type']);_0xcb58fe[_0xa6a2('0x4c')]['Descriptions']=integrations[_0xa6a2('0x55')](_0xcb58fe[_0xa6a2('0x4c')]['channel'],_0xcb58fe[_0xa6a2('0x4c')]['type']);return db[_0xa6a2('0x51')]['create'](_0xcb58fe['body'],{'include':[{'model':db[_0xa6a2('0x56')],'as':_0xa6a2('0x57')},{'model':db[_0xa6a2('0x56')],'as':_0xa6a2('0x58')}]});}return null;})['then'](respondWithResult(_0xae387e,null))['catch'](handleError(_0xae387e,null));};exports[_0xa6a2('0x59')]=function(_0x471203,_0x6416fe,_0x526c3d){var _0x4c3b0a=[{'name':_0xa6a2('0x5a'),'label':_0xa6a2('0x5a'),'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 _0x1db53c='';return db[_0xa6a2('0x45')][_0xa6a2('0x50')]({'where':{'id':_0x471203[_0xa6a2('0x4d')]['id']},'attributes':['id','remoteUri',_0xa6a2('0x5b'),_0xa6a2('0x5c'),_0xa6a2('0x5d'),_0xa6a2('0x5e'),'consumerSecret',_0xa6a2('0x5f'),_0xa6a2('0x60')]})['then'](handleEntityNotFound(_0x6416fe,null))[_0xa6a2('0x27')](function(_0x384a9a){if(_0x384a9a){_0x1db53c=_0x384a9a['remoteUri'];var _0x4efa91=_0x1db53c[_0xa6a2('0x61')](-0x1);if(_0x4efa91==='/'){_0x1db53c=_0x1db53c[_0xa6a2('0x62')](0x0,_0x1db53c[_0xa6a2('0x63')](_0x4efa91));}var _0x179423={'method':_0xa6a2('0x64'),'uri':util[_0xa6a2('0x65')](_0xa6a2('0x66'),_0x1db53c),'headers':{'Content-Type':_0xa6a2('0x67'),'Accept':_0xa6a2('0x67')},'json':!![]};if(_0x384a9a[_0xa6a2('0x5b')]===_0xa6a2('0x68')){_0x179423['headers'][_0xa6a2('0x69')]=util['format'](_0xa6a2('0x6a'),new Buffer(util['format']('%s:%s',_0x384a9a['username'],_0x384a9a[_0xa6a2('0x5d')]))[_0xa6a2('0x6b')](_0xa6a2('0x6c')));}return rp(_0x179423)['then'](function(_0x4608bf){return _0x4c3b0a[_0xa6a2('0x6d')](_[_0xa6a2('0x2d')](_0x4608bf['_embedded'][_0xa6a2('0x6e')],function(_0x49af2f){return{'id':_0x49af2f[_0xa6a2('0x2a')],'name':_0x49af2f[_0xa6a2('0x2a')],'type':_0x49af2f['type'],'active':_0x49af2f[_0xa6a2('0x6f')],'label':_0x49af2f[_0xa6a2('0x70')],'custom':!![]};}));});}})[_0xa6a2('0x27')](function(_0x2f72b4){return{'count':_0x2f72b4[_0xa6a2('0x39')],'rows':_0x2f72b4};})[_0xa6a2('0x27')](respondWithResult(_0x6416fe,null))[_0xa6a2('0x4e')](function(_0x15e9ca){var _0x5b3204=_0x471203['query']['test']?0x1f4:_0x15e9ca[_0xa6a2('0x71')]||0x1f4;logger['error'](_0xa6a2('0x72'),_0xa6a2('0x59'),_0x5b3204,JSON[_0xa6a2('0x73')](_0x15e9ca));delete _0x15e9ca[_0xa6a2('0x2a')];if(_0x5b3204===0x191){_0x5b3204=0x190;}_0x6416fe['status'](_0x5b3204)[_0xa6a2('0x2b')](_0x471203['query']['test']?{'message':_0xa6a2('0x74'),'statusCode':_0x15e9ca[_0xa6a2('0x71')]}:_0x15e9ca);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 883b8d3..e407ec6 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 _0x0d23=['exports','define','int_desk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0d23,0xe7));var _0x30d2=function(_0x2f1ee9,_0x395737){_0x2f1ee9=_0x2f1ee9-0x0;var _0x3582f3=_0x0d23[_0x2f1ee9];return _0x3582f3;};'use strict';var _=require('lodash');var util=require(_0x30d2('0x0'));var logger=require(_0x30d2('0x1'))(_0x30d2('0x2'));var moment=require(_0x30d2('0x3'));var BPromise=require(_0x30d2('0x4'));var rp=require(_0x30d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30d2('0x6'));var config=require(_0x30d2('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x30d2('0x8'));module[_0x30d2('0x9')]=function(_0x5c1777,_0x51e0a9){return _0x5c1777[_0x30d2('0xa')]('DeskAccount',attributes,{'tableName':_0x30d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1661=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1661,0x73));var _0x1166=function(_0x57560d,_0x215718){_0x57560d=_0x57560d-0x0;var _0x50b44a=_0x1661[_0x57560d];return _0x50b44a;};'use strict';var _=require(_0x1166('0x0'));var util=require('util');var logger=require(_0x1166('0x1'))(_0x1166('0x2'));var moment=require(_0x1166('0x3'));var BPromise=require(_0x1166('0x4'));var rp=require(_0x1166('0x5'));var fs=require('fs');var path=require(_0x1166('0x6'));var rimraf=require(_0x1166('0x7'));var config=require(_0x1166('0x8'));var attributes=require(_0x1166('0x9'));var integrations=require(_0x1166('0xa'));module[_0x1166('0xb')]=function(_0x1760b8,_0x371d31){return _0x1760b8[_0x1166('0xc')](_0x1166('0xd'),attributes,{'tableName':_0x1166('0xe'),'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 55c3a9e..e082641 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 _0xe18d=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowDeskAccount','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe18d,0x188));var _0xde18=function(_0x2309a8,_0x3ac2a8){_0x2309a8=_0x2309a8-0x0;var _0x2b1442=_0xe18d[_0x2309a8];return _0x2b1442;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde18('0x0'));var BPromise=require(_0xde18('0x1'));var rs=require(_0xde18('0x2'));var fs=require('fs');var Redis=require(_0xde18('0x3'));var db=require(_0xde18('0x4'))['db'];var utils=require(_0xde18('0x5'));var logger=require(_0xde18('0x6'))('rpc');var config=require(_0xde18('0x7'));var jayson=require(_0xde18('0x8'));var client=jayson[_0xde18('0x9')][_0xde18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d528a,_0x10d33a,_0x4f41d0){return new BPromise(function(_0x2adacd,_0x167a2d){return client[_0xde18('0xb')](_0x1d528a,_0x4f41d0)[_0xde18('0xc')](function(_0x3fe550){logger[_0xde18('0xd')]('DeskAccount,\x20%s,\x20%s',_0x10d33a,_0xde18('0xe'));logger['debug'](_0xde18('0xf'),_0x10d33a,_0xde18('0xe'),JSON[_0xde18('0x10')](_0x3fe550));if(_0x3fe550[_0xde18('0x11')]){if(_0x3fe550[_0xde18('0x11')][_0xde18('0x12')]===0x1f4){logger[_0xde18('0x11')](_0xde18('0x13'),_0x10d33a,_0x3fe550[_0xde18('0x11')][_0xde18('0x14')]);return _0x167a2d(_0x3fe550[_0xde18('0x11')][_0xde18('0x14')]);}logger[_0xde18('0x11')](_0xde18('0x13'),_0x10d33a,_0x3fe550['error'][_0xde18('0x14')]);return _0x2adacd(_0x3fe550[_0xde18('0x11')][_0xde18('0x14')]);}else{logger[_0xde18('0xd')]('DeskAccount,\x20%s,\x20%s',_0x10d33a,'request\x20sent');_0x2adacd(_0x3fe550[_0xde18('0x15')]['message']);}})[_0xde18('0x16')](function(_0x7324cd){logger[_0xde18('0x11')](_0xde18('0x13'),_0x10d33a,_0x7324cd);_0x167a2d(_0x7324cd);});});}exports[_0xde18('0x17')]=function(_0x323043){var _0x2c0915=this;return new Promise(function(_0x1fb2ac,_0x2ef717){return db[_0xde18('0x18')][_0xde18('0x19')]({'raw':_0x323043['options']?_0x323043[_0xde18('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x323043[_0xde18('0x1a')]?_0x323043[_0xde18('0x1a')][_0xde18('0x1b')]||null:null,'attributes':_0x323043['options']?_0x323043[_0xde18('0x1a')][_0xde18('0x1c')]||null:null,'limit':_0x323043[_0xde18('0x1a')]?_0x323043[_0xde18('0x1a')][_0xde18('0x1d')]||null:null,'include':_0x323043[_0xde18('0x1a')]?_0x323043[_0xde18('0x1a')][_0xde18('0x1e')]?_[_0xde18('0x1f')](_0x323043[_0xde18('0x1a')]['include'],function(_0x7043e9){return{'model':db[_0x7043e9[_0xde18('0x20')]],'as':_0x7043e9['as'],'attributes':_0x7043e9['attributes'],'include':_0x7043e9['include']?_[_0xde18('0x1f')](_0x7043e9[_0xde18('0x1e')],function(_0x5cc336){return{'model':db[_0x5cc336[_0xde18('0x20')]],'as':_0x5cc336['as'],'attributes':_0x5cc336['attributes'],'include':_0x5cc336[_0xde18('0x1e')]?_['map'](_0x5cc336[_0xde18('0x1e')],function(_0x2b7693){return{'model':db[_0x2b7693['model']],'as':_0x2b7693['as'],'attributes':_0x2b7693[_0xde18('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fd72b){logger[_0xde18('0xd')](_0xde18('0x17'),_0x323043);logger[_0xde18('0x21')](_0xde18('0x17'),_0x323043,JSON['stringify'](_0x2fd72b));_0x1fb2ac(_0x2fd72b);})[_0xde18('0x16')](function(_0x3b71d1){logger[_0xde18('0x11')]('GetDeskAccount',_0x3b71d1['message'],_0x323043);_0x2ef717(_0x2c0915[_0xde18('0x11')](0x1f4,_0x3b71d1[_0xde18('0x14')]));});});};exports[_0xde18('0x22')]=function(_0x4a1811){var _0x3677f0=this;return new Promise(function(_0x2c9a31,_0x16b28a){return db[_0xde18('0x18')][_0xde18('0x23')]({'raw':_0x4a1811[_0xde18('0x1a')]?_0x4a1811['options'][_0xde18('0x24')]===undefined?!![]:![]:!![],'where':_0x4a1811[_0xde18('0x1a')]?_0x4a1811['options'][_0xde18('0x1b')]||null:null,'attributes':_0x4a1811[_0xde18('0x1a')]?_0x4a1811[_0xde18('0x1a')][_0xde18('0x1c')]||null:null,'include':_0x4a1811[_0xde18('0x1a')]?_0x4a1811[_0xde18('0x1a')][_0xde18('0x1e')]?_[_0xde18('0x1f')](_0x4a1811[_0xde18('0x1a')][_0xde18('0x1e')],function(_0x47a6de){return{'model':db[_0x47a6de[_0xde18('0x20')]],'as':_0x47a6de['as'],'attributes':_0x47a6de[_0xde18('0x1c')],'include':_0x47a6de['include']?_[_0xde18('0x1f')](_0x47a6de[_0xde18('0x1e')],function(_0xe35781){return{'model':db[_0xe35781['model']],'as':_0xe35781['as'],'attributes':_0xe35781['attributes'],'include':_0xe35781[_0xde18('0x1e')]?_['map'](_0xe35781[_0xde18('0x1e')],function(_0x384569){return{'model':db[_0x384569[_0xde18('0x20')]],'as':_0x384569['as'],'attributes':_0x384569[_0xde18('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xde18('0xc')](function(_0x553862){logger[_0xde18('0xd')]('ShowDeskAccount',_0x4a1811);logger[_0xde18('0x21')]('ShowDeskAccount',_0x4a1811,JSON['stringify'](_0x553862));_0x2c9a31(_0x553862);})['catch'](function(_0x296cc0){logger['error'](_0xde18('0x22'),_0x296cc0['message'],_0x4a1811);_0x16b28a(_0x3677f0[_0xde18('0x11')](0x1f4,_0x296cc0[_0xde18('0x14')]));});});}; \ No newline at end of file +var _0xc262=['request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','where','include','map','model','attributes','debug','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x3f8d0e,_0x294179){var _0x52356e=function(_0x508833){while(--_0x508833){_0x3f8d0e['push'](_0x3f8d0e['shift']());}};_0x52356e(++_0x294179);}(_0xc262,0x1be));var _0x2c26=function(_0x338896,_0x3337bb){_0x338896=_0x338896-0x0;var _0x2516cb=_0xc262[_0x338896];return _0x2516cb;};'use strict';var _=require(_0x2c26('0x0'));var util=require(_0x2c26('0x1'));var moment=require(_0x2c26('0x2'));var BPromise=require(_0x2c26('0x3'));var rs=require(_0x2c26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c26('0x5'))['db'];var utils=require(_0x2c26('0x6'));var logger=require(_0x2c26('0x7'))('rpc');var config=require(_0x2c26('0x8'));var jayson=require(_0x2c26('0x9'));var client=jayson[_0x2c26('0xa')][_0x2c26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d8fb9,_0x616f24,_0x52794e){return new BPromise(function(_0x41a1dc,_0x1b1533){return client[_0x2c26('0xc')](_0x5d8fb9,_0x52794e)[_0x2c26('0xd')](function(_0x502751){logger[_0x2c26('0xe')](_0x2c26('0xf'),_0x616f24,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x616f24,_0x2c26('0x10'),JSON[_0x2c26('0x11')](_0x502751));if(_0x502751[_0x2c26('0x12')]){if(_0x502751[_0x2c26('0x12')][_0x2c26('0x13')]===0x1f4){logger[_0x2c26('0x12')](_0x2c26('0xf'),_0x616f24,_0x502751[_0x2c26('0x12')]['message']);return _0x1b1533(_0x502751[_0x2c26('0x12')]['message']);}logger[_0x2c26('0x12')](_0x2c26('0xf'),_0x616f24,_0x502751['error'][_0x2c26('0x14')]);return _0x41a1dc(_0x502751[_0x2c26('0x12')]['message']);}else{logger[_0x2c26('0xe')]('DeskAccount,\x20%s,\x20%s',_0x616f24,_0x2c26('0x10'));_0x41a1dc(_0x502751[_0x2c26('0x15')][_0x2c26('0x14')]);}})[_0x2c26('0x16')](function(_0x45bc04){logger[_0x2c26('0x12')]('DeskAccount,\x20%s,\x20%s',_0x616f24,_0x45bc04);_0x1b1533(_0x45bc04);});});}exports[_0x2c26('0x17')]=function(_0x50fd8d){var _0x4b20f8=this;return new Promise(function(_0x2c6820,_0x4e5c02){return db[_0x2c26('0x18')]['findAll']({'raw':_0x50fd8d[_0x2c26('0x19')]?_0x50fd8d['options']['raw']===undefined?!![]:![]:!![],'where':_0x50fd8d[_0x2c26('0x19')]?_0x50fd8d[_0x2c26('0x19')][_0x2c26('0x1a')]||null:null,'attributes':_0x50fd8d[_0x2c26('0x19')]?_0x50fd8d[_0x2c26('0x19')]['attributes']||null:null,'limit':_0x50fd8d['options']?_0x50fd8d[_0x2c26('0x19')]['limit']||null:null,'include':_0x50fd8d['options']?_0x50fd8d[_0x2c26('0x19')][_0x2c26('0x1b')]?_[_0x2c26('0x1c')](_0x50fd8d['options']['include'],function(_0x8952aa){return{'model':db[_0x8952aa[_0x2c26('0x1d')]],'as':_0x8952aa['as'],'attributes':_0x8952aa[_0x2c26('0x1e')],'include':_0x8952aa[_0x2c26('0x1b')]?_['map'](_0x8952aa[_0x2c26('0x1b')],function(_0x330ae9){return{'model':db[_0x330ae9[_0x2c26('0x1d')]],'as':_0x330ae9['as'],'attributes':_0x330ae9[_0x2c26('0x1e')],'include':_0x330ae9[_0x2c26('0x1b')]?_[_0x2c26('0x1c')](_0x330ae9[_0x2c26('0x1b')],function(_0x2de4bc){return{'model':db[_0x2de4bc['model']],'as':_0x2de4bc['as'],'attributes':_0x2de4bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c26('0xd')](function(_0x289fe6){logger[_0x2c26('0xe')](_0x2c26('0x17'),_0x50fd8d);logger[_0x2c26('0x1f')](_0x2c26('0x17'),_0x50fd8d,JSON[_0x2c26('0x11')](_0x289fe6));_0x2c6820(_0x289fe6);})['catch'](function(_0x37b89c){logger[_0x2c26('0x12')]('GetDeskAccount',_0x37b89c[_0x2c26('0x14')],_0x50fd8d);_0x4e5c02(_0x4b20f8[_0x2c26('0x12')](0x1f4,_0x37b89c[_0x2c26('0x14')]));});});};exports[_0x2c26('0x20')]=function(_0x412858){var _0x1727ab=this;return new Promise(function(_0x5eba34,_0x5cd901){return db[_0x2c26('0x18')]['find']({'raw':_0x412858[_0x2c26('0x19')]?_0x412858[_0x2c26('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x412858[_0x2c26('0x19')]?_0x412858['options']['where']||null:null,'attributes':_0x412858[_0x2c26('0x19')]?_0x412858[_0x2c26('0x19')][_0x2c26('0x1e')]||null:null,'include':_0x412858[_0x2c26('0x19')]?_0x412858['options'][_0x2c26('0x1b')]?_['map'](_0x412858[_0x2c26('0x19')][_0x2c26('0x1b')],function(_0x1d18b7){return{'model':db[_0x1d18b7[_0x2c26('0x1d')]],'as':_0x1d18b7['as'],'attributes':_0x1d18b7[_0x2c26('0x1e')],'include':_0x1d18b7[_0x2c26('0x1b')]?_[_0x2c26('0x1c')](_0x1d18b7[_0x2c26('0x1b')],function(_0x3b9116){return{'model':db[_0x3b9116[_0x2c26('0x1d')]],'as':_0x3b9116['as'],'attributes':_0x3b9116['attributes'],'include':_0x3b9116[_0x2c26('0x1b')]?_[_0x2c26('0x1c')](_0x3b9116[_0x2c26('0x1b')],function(_0x3e3a6d){return{'model':db[_0x3e3a6d[_0x2c26('0x1d')]],'as':_0x3e3a6d['as'],'attributes':_0x3e3a6d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c26('0xd')](function(_0xb803b9){logger[_0x2c26('0xe')]('ShowDeskAccount',_0x412858);logger['debug']('ShowDeskAccount',_0x412858,JSON[_0x2c26('0x11')](_0xb803b9));_0x5eba34(_0xb803b9);})[_0x2c26('0x16')](function(_0x6e69){logger[_0x2c26('0x12')](_0x2c26('0x20'),_0x6e69[_0x2c26('0x14')],_0x412858);_0x5cd901(_0x1727ab[_0x2c26('0x12')](0x1f4,_0x6e69['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f80ef22..9c1fa6e 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x187b70,_0x53c101){var _0x58dc49=function(_0xc0a8de){while(--_0xc0a8de){_0x187b70['push'](_0x187b70['shift']());}};_0x58dc49(++_0x53c101);}(_0x34e8,0x12c));var _0x834e=function(_0x57f3e1,_0xbb7ead){_0x57f3e1=_0x57f3e1-0x0;var _0x4363aa=_0x34e8[_0x57f3e1];return _0x4363aa;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4f3bdc,_0x1e3d0f){var _0x1fced0=function(_0x266fdb){while(--_0x266fdb){_0x4f3bdc['push'](_0x4f3bdc['shift']());}};_0x1fced0(++_0x1e3d0f);}(_0x7217,0x19e));var _0x7721=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x7217[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3191930..359e743 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 _0x449f=['STRING','sequelize','exports'];(function(_0x300301,_0x11d528){var _0x41589f=function(_0x134877){while(--_0x134877){_0x300301['push'](_0x300301['shift']());}};_0x41589f(++_0x11d528);}(_0x449f,0x1a8));var _0xf449=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x449f[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0xf449('0x0'));module[_0xf449('0x1')]={'name':{'type':Sequelize[_0xf449('0x2')]},'description':{'type':Sequelize[_0xf449('0x2')]}}; \ No newline at end of file +var _0x58bc=['STRING','exports'];(function(_0x3df186,_0x12592c){var _0x5440fc=function(_0x2a7a70){while(--_0x2a7a70){_0x3df186['push'](_0x3df186['shift']());}};_0x5440fc(++_0x12592c);}(_0x58bc,0x1b9));var _0xc58b=function(_0x12fd15,_0x59601a){_0x12fd15=_0x12fd15-0x0;var _0x43d2aa=_0x58bc[_0x12fd15];return _0x43d2aa;};'use strict';var Sequelize=require('sequelize');module[_0xc58b('0x0')]={'name':{'type':Sequelize[_0xc58b('0x1')]},'description':{'type':Sequelize[_0xc58b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 55a4112..789b21c 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 _0x1104=['DeskField','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','end','error','stack','name','send','index','DeskConfiguration','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','create','body','getFields','getSubjects','findOne'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1104,0x197));var _0x4110=function(_0x3047a,_0x39e58e){_0x3047a=_0x3047a-0x0;var _0x258f9b=_0x1104[_0x3047a];return _0x258f9b;};'use strict';var emlformat=require(_0x4110('0x0'));var rimraf=require(_0x4110('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4110('0x2'));var rp=require('request-promise');var moment=require(_0x4110('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4110('0x4'));var util=require('util');var path=require(_0x4110('0x5'));var sox=require(_0x4110('0x6'));var csv=require('to-csv');var ejs=require(_0x4110('0x7'));var fs=require('fs');var fs_extra=require(_0x4110('0x8'));var _=require(_0x4110('0x9'));var squel=require(_0x4110('0xa'));var crypto=require('crypto');var jsforce=require(_0x4110('0xb'));var deskjs=require(_0x4110('0xc'));var toCsv=require(_0x4110('0xd'));var querystring=require(_0x4110('0xe'));var Papa=require(_0x4110('0xf'));var Redis=require(_0x4110('0x10'));var authService=require(_0x4110('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4110('0x12'));var logger=require(_0x4110('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4110('0x14'));var licenseUtil=require(_0x4110('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194794,_0x5285f){_0x5285f=_0x5285f||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x194794[_0x4110('0x16')](_0x5285f);}return _0x194794[_0x4110('0x17')](_0x5285f)['end']();};}function respondWithResult(_0x44721c,_0x12e859){_0x12e859=_0x12e859||0xc8;return function(_0x35a2cd){if(_0x35a2cd){return _0x44721c[_0x4110('0x17')](_0x12e859)[_0x4110('0x18')](_0x35a2cd);}};}function respondWithFilteredResult(_0x27f307,_0x4c1477){return function(_0x3a78fe){if(_0x3a78fe){var _0x113ebe=typeof _0x4c1477['offset']===_0x4110('0x19')&&typeof _0x4c1477[_0x4110('0x1a')]===_0x4110('0x19');var _0x5c8fc9=_0x3a78fe[_0x4110('0x1b')];var _0xb105fc=_0x113ebe?0x0:_0x4c1477[_0x4110('0x1c')];var _0x5dde3c=_0x113ebe?_0x3a78fe['count']:_0x4c1477[_0x4110('0x1c')]+_0x4c1477[_0x4110('0x1a')];var _0x52c9c0;if(_0x5dde3c>=_0x5c8fc9){_0x5dde3c=_0x5c8fc9;_0x52c9c0=0xc8;}else{_0x52c9c0=0xce;}_0x27f307[_0x4110('0x17')](_0x52c9c0);return _0x27f307[_0x4110('0x1d')]('Content-Range',_0xb105fc+'-'+_0x5dde3c+'/'+_0x5c8fc9)['json'](_0x3a78fe);}return null;};}function patchUpdates(_0x4ec862){return function(_0x53c076){try{jsonpatch['apply'](_0x53c076,_0x4ec862,!![]);}catch(_0x319902){return BPromise[_0x4110('0x1e')](_0x319902);}return _0x53c076[_0x4110('0x1f')]();};}function saveUpdates(_0x536f02,_0x103613){return function(_0x1c5a55){if(_0x1c5a55){return _0x1c5a55[_0x4110('0x20')](_0x536f02)[_0x4110('0x21')](function(_0x1076a5){return _0x1076a5;});}return null;};}function removeEntity(_0xfc16dc,_0x5ddd0e){return function(_0x1684cb){if(_0x1684cb){return _0x1684cb['destroy']()[_0x4110('0x21')](function(){_0xfc16dc[_0x4110('0x17')](0xcc)[_0x4110('0x22')]();});}};}function handleEntityNotFound(_0x55f965,_0x4b6573){return function(_0x25ea41){if(!_0x25ea41){_0x55f965[_0x4110('0x16')](0x194);}return _0x25ea41;};}function handleError(_0x2eaccf,_0x3ca254){_0x3ca254=_0x3ca254||0x1f4;return function(_0x5c593e){logger[_0x4110('0x23')](_0x5c593e[_0x4110('0x24')]);if(_0x5c593e['name']){delete _0x5c593e[_0x4110('0x25')];}_0x2eaccf['status'](_0x3ca254)[_0x4110('0x26')](_0x5c593e);};}exports[_0x4110('0x27')]=function(_0x354237,_0x263698){var _0x2566bf={},_0x48ca3a={},_0xbbcf42={'count':0x0,'rows':[]};var _0x32273f=_['map'](db[_0x4110('0x28')]['rawAttributes'],function(_0x286249){return{'name':_0x286249['fieldName'],'type':_0x286249[_0x4110('0x29')][_0x4110('0x2a')]};});_0x48ca3a[_0x4110('0x2b')]=_[_0x4110('0x2c')](_0x32273f,_0x4110('0x25'));_0x48ca3a[_0x4110('0x2d')]=_['keys'](_0x354237[_0x4110('0x2d')]);_0x48ca3a[_0x4110('0x2e')]=_[_0x4110('0x2f')](_0x48ca3a['model'],_0x48ca3a[_0x4110('0x2d')]);_0x2566bf[_0x4110('0x30')]=_['intersection'](_0x48ca3a[_0x4110('0x2b')],qs['fields'](_0x354237['query'][_0x4110('0x31')]));_0x2566bf[_0x4110('0x30')]=_0x2566bf[_0x4110('0x30')][_0x4110('0x32')]?_0x2566bf[_0x4110('0x30')]:_0x48ca3a['model'];if(!_0x354237[_0x4110('0x2d')][_0x4110('0x33')](_0x4110('0x34'))){_0x2566bf['limit']=qs['limit'](_0x354237[_0x4110('0x2d')]['limit']);_0x2566bf['offset']=qs[_0x4110('0x1c')](_0x354237[_0x4110('0x2d')][_0x4110('0x1c')]);}_0x2566bf['order']=qs[_0x4110('0x35')](_0x354237[_0x4110('0x2d')][_0x4110('0x35')]);_0x2566bf[_0x4110('0x36')]=qs[_0x4110('0x2e')](_[_0x4110('0x37')](_0x354237[_0x4110('0x2d')],_0x48ca3a['filters']),_0x32273f);if(_0x354237[_0x4110('0x2d')][_0x4110('0x38')]){_0x2566bf['where']=_[_0x4110('0x39')](_0x2566bf[_0x4110('0x36')],{'$or':_[_0x4110('0x2c')](_0x32273f,function(_0x5b0123){if(_0x5b0123[_0x4110('0x29')]!=='VIRTUAL'){var _0xc844c7={};_0xc844c7[_0x5b0123[_0x4110('0x25')]]={'$like':'%'+_0x354237['query'][_0x4110('0x38')]+'%'};return _0xc844c7;}})});}_0x2566bf=_[_0x4110('0x39')]({},_0x2566bf,_0x354237[_0x4110('0x3a')]);var _0x1e765c={'where':_0x2566bf['where']};return db[_0x4110('0x28')][_0x4110('0x1b')](_0x1e765c)[_0x4110('0x21')](function(_0x230fc5){_0xbbcf42[_0x4110('0x1b')]=_0x230fc5;if(_0x354237[_0x4110('0x2d')][_0x4110('0x3b')]){_0x2566bf[_0x4110('0x3c')]=[{'all':!![]}];}return db[_0x4110('0x28')]['findAll'](_0x2566bf);})[_0x4110('0x21')](function(_0x319ef9){_0xbbcf42[_0x4110('0x3d')]=_0x319ef9;return _0xbbcf42;})[_0x4110('0x21')](respondWithFilteredResult(_0x263698,_0x2566bf))[_0x4110('0x3e')](handleError(_0x263698,null));};exports[_0x4110('0x3f')]=function(_0x9e76c1,_0x9c75ff){var _0x45b0cc={'raw':![],'where':{'id':_0x9e76c1[_0x4110('0x40')]['id']}},_0x543e45={};_0x543e45[_0x4110('0x2b')]=_['keys'](db[_0x4110('0x28')][_0x4110('0x41')]);_0x543e45[_0x4110('0x2d')]=_[_0x4110('0x42')](_0x9e76c1[_0x4110('0x2d')]);_0x543e45[_0x4110('0x2e')]=_[_0x4110('0x2f')](_0x543e45[_0x4110('0x2b')],_0x543e45['query']);_0x45b0cc[_0x4110('0x30')]=_[_0x4110('0x2f')](_0x543e45[_0x4110('0x2b')],qs[_0x4110('0x31')](_0x9e76c1[_0x4110('0x2d')]['fields']));_0x45b0cc[_0x4110('0x30')]=_0x45b0cc[_0x4110('0x30')][_0x4110('0x32')]?_0x45b0cc[_0x4110('0x30')]:_0x543e45[_0x4110('0x2b')];if(_0x9e76c1['query'][_0x4110('0x3b')]){_0x45b0cc[_0x4110('0x3c')]=[{'all':!![]}];}_0x45b0cc=_[_0x4110('0x39')]({},_0x45b0cc,_0x9e76c1[_0x4110('0x3a')]);return db[_0x4110('0x28')][_0x4110('0x43')](_0x45b0cc)[_0x4110('0x21')](handleEntityNotFound(_0x9c75ff,null))[_0x4110('0x21')](respondWithResult(_0x9c75ff,null))['catch'](handleError(_0x9c75ff,null));};exports[_0x4110('0x44')]=function(_0x3bf673,_0x44b0dd){return db[_0x4110('0x28')]['create'](_0x3bf673[_0x4110('0x45')],{})[_0x4110('0x21')](respondWithResult(_0x44b0dd,0xc9))[_0x4110('0x3e')](handleError(_0x44b0dd,null));};exports['update']=function(_0x4873e6,_0x8dc31){if(_0x4873e6[_0x4110('0x45')]['id']){delete _0x4873e6[_0x4110('0x45')]['id'];}return db[_0x4110('0x28')][_0x4110('0x43')]({'where':{'id':_0x4873e6[_0x4110('0x40')]['id']}})['then'](handleEntityNotFound(_0x8dc31,null))[_0x4110('0x21')](saveUpdates(_0x4873e6[_0x4110('0x45')],null))[_0x4110('0x21')](respondWithResult(_0x8dc31,null))[_0x4110('0x3e')](handleError(_0x8dc31,null));};exports['destroy']=function(_0x33d5d3,_0x50ca1d){return db[_0x4110('0x28')][_0x4110('0x43')]({'where':{'id':_0x33d5d3[_0x4110('0x40')]['id']}})[_0x4110('0x21')](handleEntityNotFound(_0x50ca1d,null))[_0x4110('0x21')](removeEntity(_0x50ca1d,null))[_0x4110('0x3e')](handleError(_0x50ca1d,null));};exports['getFields']=function(_0x466689,_0x1e0471,_0x384bce){var _0x3ed04c={};var _0x213e62={};var _0x42143c;var _0x6770bf;return db['DeskConfiguration']['findOne']({'where':{'id':_0x466689[_0x4110('0x40')]['id']}})['then'](handleEntityNotFound(_0x1e0471,null))[_0x4110('0x21')](function(_0x3eca01){if(_0x3eca01){_0x42143c=_0x3eca01;_0x213e62[_0x4110('0x2b')]=_[_0x4110('0x42')](db['DeskField'][_0x4110('0x41')]);_0x213e62[_0x4110('0x2d')]=_[_0x4110('0x42')](_0x466689[_0x4110('0x2d')]);_0x213e62[_0x4110('0x2e')]=_[_0x4110('0x2f')](_0x213e62[_0x4110('0x2b')],_0x213e62[_0x4110('0x2d')]);_0x3ed04c[_0x4110('0x30')]=_[_0x4110('0x2f')](_0x213e62[_0x4110('0x2b')],qs[_0x4110('0x31')](_0x466689[_0x4110('0x2d')][_0x4110('0x31')]));_0x3ed04c[_0x4110('0x30')]=_0x3ed04c[_0x4110('0x30')][_0x4110('0x32')]?_0x3ed04c[_0x4110('0x30')]:_0x213e62['model'];_0x3ed04c['order']=qs['sort'](_0x466689['query'][_0x4110('0x35')]);_0x3ed04c[_0x4110('0x36')]=qs['filters'](_[_0x4110('0x37')](_0x466689[_0x4110('0x2d')],_0x213e62[_0x4110('0x2e')]));if(_0x466689[_0x4110('0x2d')]['filter']){_0x3ed04c[_0x4110('0x36')]=_[_0x4110('0x39')](_0x3ed04c[_0x4110('0x36')],{'$or':_[_0x4110('0x2c')](_0x3ed04c[_0x4110('0x30')],function(_0x2e9253){var _0x271f4a={};_0x271f4a[_0x2e9253]={'$like':'%'+_0x466689[_0x4110('0x2d')][_0x4110('0x38')]+'%'};return _0x271f4a;})});}_0x3ed04c=_[_0x4110('0x39')]({},_0x3ed04c,_0x466689[_0x4110('0x3a')]);return _0x42143c[_0x4110('0x46')](_0x3ed04c);}})[_0x4110('0x21')](function(_0x59a275){if(_0x59a275){_0x6770bf=_0x59a275[_0x4110('0x32')];if(!_0x466689[_0x4110('0x2d')]['hasOwnProperty'](_0x4110('0x34'))){_0x3ed04c['limit']=qs[_0x4110('0x1a')](_0x466689[_0x4110('0x2d')][_0x4110('0x1a')]);_0x3ed04c[_0x4110('0x1c')]=qs[_0x4110('0x1c')](_0x466689[_0x4110('0x2d')]['offset']);}return _0x42143c[_0x4110('0x46')](_0x3ed04c);}})[_0x4110('0x21')](function(_0x3656cf){if(_0x3656cf){return _0x3656cf?{'count':_0x6770bf,'rows':_0x3656cf}:null;}})[_0x4110('0x21')](respondWithResult(_0x1e0471,null))[_0x4110('0x3e')](handleError(_0x1e0471,null));};exports[_0x4110('0x47')]=function(_0x3cb7ec,_0x435c06,_0xe0dc84){var _0x77b9ef={};var _0x22fa4c={};var _0x5ecb84;var _0x169929;return db['DeskConfiguration'][_0x4110('0x48')]({'where':{'id':_0x3cb7ec[_0x4110('0x40')]['id']}})[_0x4110('0x21')](handleEntityNotFound(_0x435c06,null))[_0x4110('0x21')](function(_0x546720){if(_0x546720){_0x5ecb84=_0x546720;_0x22fa4c[_0x4110('0x2b')]=_[_0x4110('0x42')](db[_0x4110('0x49')][_0x4110('0x41')]);_0x22fa4c[_0x4110('0x2d')]=_['keys'](_0x3cb7ec[_0x4110('0x2d')]);_0x22fa4c[_0x4110('0x2e')]=_['intersection'](_0x22fa4c[_0x4110('0x2b')],_0x22fa4c[_0x4110('0x2d')]);_0x77b9ef[_0x4110('0x30')]=_[_0x4110('0x2f')](_0x22fa4c[_0x4110('0x2b')],qs[_0x4110('0x31')](_0x3cb7ec[_0x4110('0x2d')][_0x4110('0x31')]));_0x77b9ef[_0x4110('0x30')]=_0x77b9ef[_0x4110('0x30')]['length']?_0x77b9ef[_0x4110('0x30')]:_0x22fa4c['model'];_0x77b9ef[_0x4110('0x4a')]=qs['sort'](_0x3cb7ec[_0x4110('0x2d')][_0x4110('0x35')]);_0x77b9ef['where']=qs['filters'](_[_0x4110('0x37')](_0x3cb7ec['query'],_0x22fa4c['filters']));if(_0x3cb7ec['query']['filter']){_0x77b9ef[_0x4110('0x36')]=_[_0x4110('0x39')](_0x77b9ef[_0x4110('0x36')],{'$or':_['map'](_0x77b9ef[_0x4110('0x30')],function(_0x593e84){var _0x4d4d4d={};_0x4d4d4d[_0x593e84]={'$like':'%'+_0x3cb7ec[_0x4110('0x2d')][_0x4110('0x38')]+'%'};return _0x4d4d4d;})});}_0x77b9ef=_[_0x4110('0x39')]({},_0x77b9ef,_0x3cb7ec[_0x4110('0x3a')]);return _0x5ecb84[_0x4110('0x47')](_0x77b9ef);}})[_0x4110('0x21')](function(_0x1ade2c){if(_0x1ade2c){_0x169929=_0x1ade2c[_0x4110('0x32')];if(!_0x3cb7ec[_0x4110('0x2d')][_0x4110('0x33')](_0x4110('0x34'))){_0x77b9ef[_0x4110('0x1a')]=qs[_0x4110('0x1a')](_0x3cb7ec['query'][_0x4110('0x1a')]);_0x77b9ef[_0x4110('0x1c')]=qs['offset'](_0x3cb7ec['query'][_0x4110('0x1c')]);}return _0x5ecb84[_0x4110('0x47')](_0x77b9ef);}})['then'](function(_0x14625a){if(_0x14625a){return _0x14625a?{'count':_0x169929,'rows':_0x14625a}:null;}})['then'](respondWithResult(_0x435c06,null))['catch'](handleError(_0x435c06,null));};exports[_0x4110('0x4b')]=function(_0x1f7518,_0x83b474,_0x58d432){var _0x247ae5={};var _0x23f1f7={};var _0x4400bc;var _0x59fc9e;return db[_0x4110('0x28')][_0x4110('0x48')]({'where':{'id':_0x1f7518[_0x4110('0x40')]['id']}})[_0x4110('0x21')](handleEntityNotFound(_0x83b474,null))['then'](function(_0x28e190){if(_0x28e190){_0x4400bc=_0x28e190;_0x23f1f7[_0x4110('0x2b')]=_[_0x4110('0x42')](db[_0x4110('0x49')][_0x4110('0x41')]);_0x23f1f7['query']=_['keys'](_0x1f7518[_0x4110('0x2d')]);_0x23f1f7['filters']=_[_0x4110('0x2f')](_0x23f1f7['model'],_0x23f1f7[_0x4110('0x2d')]);_0x247ae5['attributes']=_[_0x4110('0x2f')](_0x23f1f7['model'],qs[_0x4110('0x31')](_0x1f7518[_0x4110('0x2d')][_0x4110('0x31')]));_0x247ae5['attributes']=_0x247ae5[_0x4110('0x30')]['length']?_0x247ae5['attributes']:_0x23f1f7[_0x4110('0x2b')];_0x247ae5[_0x4110('0x4a')]=qs['sort'](_0x1f7518[_0x4110('0x2d')]['sort']);_0x247ae5[_0x4110('0x36')]=qs[_0x4110('0x2e')](_[_0x4110('0x37')](_0x1f7518[_0x4110('0x2d')],_0x23f1f7[_0x4110('0x2e')]));if(_0x1f7518[_0x4110('0x2d')]['filter']){_0x247ae5[_0x4110('0x36')]=_[_0x4110('0x39')](_0x247ae5['where'],{'$or':_[_0x4110('0x2c')](_0x247ae5['attributes'],function(_0x424aca){var _0x331df1={};_0x331df1[_0x424aca]={'$like':'%'+_0x1f7518[_0x4110('0x2d')][_0x4110('0x38')]+'%'};return _0x331df1;})});}_0x247ae5=_[_0x4110('0x39')]({},_0x247ae5,_0x1f7518[_0x4110('0x3a')]);return _0x4400bc[_0x4110('0x4b')](_0x247ae5);}})['then'](function(_0x46a939){if(_0x46a939){_0x59fc9e=_0x46a939[_0x4110('0x32')];if(!_0x1f7518[_0x4110('0x2d')]['hasOwnProperty'](_0x4110('0x34'))){_0x247ae5[_0x4110('0x1a')]=qs[_0x4110('0x1a')](_0x1f7518['query'][_0x4110('0x1a')]);_0x247ae5[_0x4110('0x1c')]=qs[_0x4110('0x1c')](_0x1f7518[_0x4110('0x2d')]['offset']);}return _0x4400bc[_0x4110('0x4b')](_0x247ae5);}})[_0x4110('0x21')](function(_0x270db2){if(_0x270db2){return _0x270db2?{'count':_0x59fc9e,'rows':_0x270db2}:null;}})[_0x4110('0x21')](respondWithResult(_0x83b474,null))['catch'](handleError(_0x83b474,null));};exports[_0x4110('0x4c')]=function(_0x2fd412,_0x5589a5,_0x17234c){var _0x43be27={};var _0x221bf5={};var _0x3f84ac;var _0x4e9595;return db[_0x4110('0x28')]['findOne']({'where':{'id':_0x2fd412[_0x4110('0x40')]['id']}})['then'](handleEntityNotFound(_0x5589a5,null))[_0x4110('0x21')](function(_0x3c8085){if(_0x3c8085){_0x3f84ac=_0x3c8085;_0x221bf5[_0x4110('0x2b')]=_['keys'](db[_0x4110('0x4d')]['rawAttributes']);_0x221bf5[_0x4110('0x2d')]=_['keys'](_0x2fd412['query']);_0x221bf5[_0x4110('0x2e')]=_[_0x4110('0x2f')](_0x221bf5[_0x4110('0x2b')],_0x221bf5[_0x4110('0x2d')]);_0x43be27['attributes']=_[_0x4110('0x2f')](_0x221bf5['model'],qs[_0x4110('0x31')](_0x2fd412['query'][_0x4110('0x31')]));_0x43be27[_0x4110('0x30')]=_0x43be27[_0x4110('0x30')][_0x4110('0x32')]?_0x43be27[_0x4110('0x30')]:_0x221bf5[_0x4110('0x2b')];_0x43be27[_0x4110('0x4a')]=qs[_0x4110('0x35')](_0x2fd412['query'][_0x4110('0x35')]);_0x43be27['where']=qs[_0x4110('0x2e')](_[_0x4110('0x37')](_0x2fd412['query'],_0x221bf5[_0x4110('0x2e')]));if(_0x2fd412['query']['filter']){_0x43be27[_0x4110('0x36')]=_[_0x4110('0x39')](_0x43be27[_0x4110('0x36')],{'$or':_[_0x4110('0x2c')](_0x43be27['attributes'],function(_0x3cb5c0){var _0x4da820={};_0x4da820[_0x3cb5c0]={'$like':'%'+_0x2fd412['query']['filter']+'%'};return _0x4da820;})});}_0x43be27=_[_0x4110('0x39')]({},_0x43be27,_0x2fd412[_0x4110('0x3a')]);return _0x3f84ac['getTags'](_0x43be27);}})[_0x4110('0x21')](function(_0x1f3059){if(_0x1f3059){_0x4e9595=_0x1f3059[_0x4110('0x32')];if(!_0x2fd412['query']['hasOwnProperty'](_0x4110('0x34'))){_0x43be27[_0x4110('0x1a')]=qs['limit'](_0x2fd412[_0x4110('0x2d')][_0x4110('0x1a')]);_0x43be27[_0x4110('0x1c')]=qs[_0x4110('0x1c')](_0x2fd412[_0x4110('0x2d')][_0x4110('0x1c')]);}return _0x3f84ac[_0x4110('0x4c')](_0x43be27);}})[_0x4110('0x21')](function(_0x538147){if(_0x538147){return _0x538147?{'count':_0x4e9595,'rows':_0x538147}:null;}})[_0x4110('0x21')](respondWithResult(_0x5589a5,null))[_0x4110('0x3e')](handleError(_0x5589a5,null));};exports[_0x4110('0x4e')]=function(_0x25578f,_0x1548b1,_0x2ea3f9){if(_0x25578f[_0x4110('0x45')]['id']){delete _0x25578f[_0x4110('0x45')]['id'];}return db[_0x4110('0x28')][_0x4110('0x48')]({'where':{'id':_0x25578f[_0x4110('0x40')]['id']}})[_0x4110('0x21')](handleEntityNotFound(_0x1548b1,null))[_0x4110('0x21')](function(_0x234d5b){if(_0x234d5b){return _0x234d5b[_0x4110('0x4e')](_0x25578f[_0x4110('0x45')][_0x4110('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x1548b1,null))['catch'](handleError(_0x1548b1,null));}; \ No newline at end of file +var _0x670b=['getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','name','index','map','DeskConfiguration','fieldName','type','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','DeskField','getFields','getSubjects','rawAttributes','getDescriptions'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0x670b,0xf7));var _0xb670=function(_0x824305,_0x5a41aa){_0x824305=_0x824305-0x0;var _0x17c89a=_0x670b[_0x824305];return _0x17c89a;};'use strict';var emlformat=require(_0xb670('0x0'));var rimraf=require(_0xb670('0x1'));var zipdir=require(_0xb670('0x2'));var jsonpatch=require(_0xb670('0x3'));var rp=require('request-promise');var moment=require(_0xb670('0x4'));var BPromise=require(_0xb670('0x5'));var Mustache=require(_0xb670('0x6'));var util=require(_0xb670('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb670('0x8'));var ejs=require(_0xb670('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb670('0xa'));var squel=require(_0xb670('0xb'));var crypto=require('crypto');var jsforce=require(_0xb670('0xc'));var deskjs=require(_0xb670('0xd'));var toCsv=require(_0xb670('0x8'));var querystring=require(_0xb670('0xe'));var Papa=require(_0xb670('0xf'));var Redis=require(_0xb670('0x10'));var authService=require(_0xb670('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb670('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb670('0x13'))(_0xb670('0x14'));var utils=require(_0xb670('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb670('0x16'));var db=require(_0xb670('0x17'))['db'];function respondWithStatusCode(_0xaa7b5b,_0x2821f3){_0x2821f3=_0x2821f3||0xcc;return function(_0x2ecc39){if(_0x2ecc39){return _0xaa7b5b['sendStatus'](_0x2821f3);}return _0xaa7b5b[_0xb670('0x18')](_0x2821f3)[_0xb670('0x19')]();};}function respondWithResult(_0x5b1081,_0x58ef31){_0x58ef31=_0x58ef31||0xc8;return function(_0x7767c2){if(_0x7767c2){return _0x5b1081[_0xb670('0x18')](_0x58ef31)[_0xb670('0x1a')](_0x7767c2);}};}function respondWithFilteredResult(_0x57a8d9,_0x55e586){return function(_0x4fc8db){if(_0x4fc8db){var _0x3ee14d=typeof _0x55e586[_0xb670('0x1b')]==='undefined'&&typeof _0x55e586['limit']===_0xb670('0x1c');var _0x324319=_0x4fc8db[_0xb670('0x1d')];var _0x5ce29f=_0x3ee14d?0x0:_0x55e586['offset'];var _0x4776b6=_0x3ee14d?_0x4fc8db[_0xb670('0x1d')]:_0x55e586['offset']+_0x55e586[_0xb670('0x1e')];var _0xb8a48;if(_0x4776b6>=_0x324319){_0x4776b6=_0x324319;_0xb8a48=0xc8;}else{_0xb8a48=0xce;}_0x57a8d9[_0xb670('0x18')](_0xb8a48);return _0x57a8d9[_0xb670('0x1f')](_0xb670('0x20'),_0x5ce29f+'-'+_0x4776b6+'/'+_0x324319)[_0xb670('0x1a')](_0x4fc8db);}return null;};}function patchUpdates(_0x1820f3){return function(_0x2de969){try{jsonpatch[_0xb670('0x21')](_0x2de969,_0x1820f3,!![]);}catch(_0x33d0d6){return BPromise[_0xb670('0x22')](_0x33d0d6);}return _0x2de969[_0xb670('0x23')]();};}function saveUpdates(_0x4710f4,_0x355329){return function(_0x45cd18){if(_0x45cd18){return _0x45cd18[_0xb670('0x24')](_0x4710f4)[_0xb670('0x25')](function(_0x558344){return _0x558344;});}return null;};}function removeEntity(_0x35af2b,_0x38c3d9){return function(_0x3b9075){if(_0x3b9075){return _0x3b9075['destroy']()[_0xb670('0x25')](function(){_0x35af2b[_0xb670('0x18')](0xcc)[_0xb670('0x19')]();});}};}function handleEntityNotFound(_0xb61473,_0x517713){return function(_0x5841d2){if(!_0x5841d2){_0xb61473['sendStatus'](0x194);}return _0x5841d2;};}function handleError(_0xd72828,_0x35d447){_0x35d447=_0x35d447||0x1f4;return function(_0x4a8132){logger['error'](_0x4a8132['stack']);if(_0x4a8132[_0xb670('0x26')]){delete _0x4a8132[_0xb670('0x26')];}_0xd72828[_0xb670('0x18')](_0x35d447)['send'](_0x4a8132);};}exports[_0xb670('0x27')]=function(_0x1f04f7,_0x2be988){var _0x5430dd={},_0x49e328={},_0x59e76e={'count':0x0,'rows':[]};var _0x108a4b=_[_0xb670('0x28')](db[_0xb670('0x29')]['rawAttributes'],function(_0x304c5b){return{'name':_0x304c5b[_0xb670('0x2a')],'type':_0x304c5b[_0xb670('0x2b')]['key']};});_0x49e328['model']=_[_0xb670('0x28')](_0x108a4b,_0xb670('0x26'));_0x49e328[_0xb670('0x2c')]=_['keys'](_0x1f04f7[_0xb670('0x2c')]);_0x49e328[_0xb670('0x2d')]=_[_0xb670('0x2e')](_0x49e328[_0xb670('0x2f')],_0x49e328['query']);_0x5430dd['attributes']=_[_0xb670('0x2e')](_0x49e328[_0xb670('0x2f')],qs[_0xb670('0x30')](_0x1f04f7[_0xb670('0x2c')][_0xb670('0x30')]));_0x5430dd['attributes']=_0x5430dd['attributes'][_0xb670('0x31')]?_0x5430dd[_0xb670('0x32')]:_0x49e328[_0xb670('0x2f')];if(!_0x1f04f7[_0xb670('0x2c')][_0xb670('0x33')](_0xb670('0x34'))){_0x5430dd[_0xb670('0x1e')]=qs['limit'](_0x1f04f7[_0xb670('0x2c')][_0xb670('0x1e')]);_0x5430dd['offset']=qs[_0xb670('0x1b')](_0x1f04f7['query'][_0xb670('0x1b')]);}_0x5430dd[_0xb670('0x35')]=qs[_0xb670('0x36')](_0x1f04f7[_0xb670('0x2c')][_0xb670('0x36')]);_0x5430dd[_0xb670('0x37')]=qs['filters'](_[_0xb670('0x38')](_0x1f04f7['query'],_0x49e328[_0xb670('0x2d')]),_0x108a4b);if(_0x1f04f7[_0xb670('0x2c')][_0xb670('0x39')]){_0x5430dd['where']=_['merge'](_0x5430dd[_0xb670('0x37')],{'$or':_[_0xb670('0x28')](_0x108a4b,function(_0x284c6c){if(_0x284c6c[_0xb670('0x2b')]!==_0xb670('0x3a')){var _0x596285={};_0x596285[_0x284c6c[_0xb670('0x26')]]={'$like':'%'+_0x1f04f7[_0xb670('0x2c')]['filter']+'%'};return _0x596285;}})});}_0x5430dd=_[_0xb670('0x3b')]({},_0x5430dd,_0x1f04f7[_0xb670('0x3c')]);var _0x1b95d0={'where':_0x5430dd[_0xb670('0x37')]};return db[_0xb670('0x29')][_0xb670('0x1d')](_0x1b95d0)[_0xb670('0x25')](function(_0x33fb42){_0x59e76e[_0xb670('0x1d')]=_0x33fb42;if(_0x1f04f7[_0xb670('0x2c')][_0xb670('0x3d')]){_0x5430dd[_0xb670('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x5430dd);})['then'](function(_0x39a162){_0x59e76e[_0xb670('0x3f')]=_0x39a162;return _0x59e76e;})[_0xb670('0x25')](respondWithFilteredResult(_0x2be988,_0x5430dd))[_0xb670('0x40')](handleError(_0x2be988,null));};exports[_0xb670('0x41')]=function(_0xd0eb1,_0x1ff936){var _0x1bc38d={'raw':![],'where':{'id':_0xd0eb1[_0xb670('0x42')]['id']}},_0x1fdfe7={};_0x1fdfe7[_0xb670('0x2f')]=_[_0xb670('0x43')](db[_0xb670('0x29')]['rawAttributes']);_0x1fdfe7[_0xb670('0x2c')]=_[_0xb670('0x43')](_0xd0eb1[_0xb670('0x2c')]);_0x1fdfe7[_0xb670('0x2d')]=_['intersection'](_0x1fdfe7[_0xb670('0x2f')],_0x1fdfe7[_0xb670('0x2c')]);_0x1bc38d[_0xb670('0x32')]=_['intersection'](_0x1fdfe7[_0xb670('0x2f')],qs[_0xb670('0x30')](_0xd0eb1[_0xb670('0x2c')]['fields']));_0x1bc38d['attributes']=_0x1bc38d[_0xb670('0x32')][_0xb670('0x31')]?_0x1bc38d[_0xb670('0x32')]:_0x1fdfe7[_0xb670('0x2f')];if(_0xd0eb1[_0xb670('0x2c')][_0xb670('0x3d')]){_0x1bc38d[_0xb670('0x3e')]=[{'all':!![]}];}_0x1bc38d=_[_0xb670('0x3b')]({},_0x1bc38d,_0xd0eb1[_0xb670('0x3c')]);return db[_0xb670('0x29')][_0xb670('0x44')](_0x1bc38d)['then'](handleEntityNotFound(_0x1ff936,null))[_0xb670('0x25')](respondWithResult(_0x1ff936,null))['catch'](handleError(_0x1ff936,null));};exports['create']=function(_0x16a821,_0x55f843){return db[_0xb670('0x29')][_0xb670('0x45')](_0x16a821[_0xb670('0x46')],{})[_0xb670('0x25')](respondWithResult(_0x55f843,0xc9))[_0xb670('0x40')](handleError(_0x55f843,null));};exports['update']=function(_0x1f7a4c,_0xe12ad2){if(_0x1f7a4c[_0xb670('0x46')]['id']){delete _0x1f7a4c[_0xb670('0x46')]['id'];}return db['DeskConfiguration'][_0xb670('0x44')]({'where':{'id':_0x1f7a4c[_0xb670('0x42')]['id']}})[_0xb670('0x25')](handleEntityNotFound(_0xe12ad2,null))[_0xb670('0x25')](saveUpdates(_0x1f7a4c[_0xb670('0x46')],null))[_0xb670('0x25')](respondWithResult(_0xe12ad2,null))[_0xb670('0x40')](handleError(_0xe12ad2,null));};exports['destroy']=function(_0x3b5246,_0x6707e4){return db[_0xb670('0x29')][_0xb670('0x44')]({'where':{'id':_0x3b5246[_0xb670('0x42')]['id']}})[_0xb670('0x25')](handleEntityNotFound(_0x6707e4,null))[_0xb670('0x25')](removeEntity(_0x6707e4,null))[_0xb670('0x40')](handleError(_0x6707e4,null));};exports['getFields']=function(_0x4b679d,_0x265a57,_0x159121){var _0x175a04={};var _0x4d4405={};var _0x47c57a;var _0x32077a;return db['DeskConfiguration'][_0xb670('0x47')]({'where':{'id':_0x4b679d[_0xb670('0x42')]['id']}})[_0xb670('0x25')](handleEntityNotFound(_0x265a57,null))[_0xb670('0x25')](function(_0x8ae1ea){if(_0x8ae1ea){_0x47c57a=_0x8ae1ea;_0x4d4405[_0xb670('0x2f')]=_[_0xb670('0x43')](db[_0xb670('0x48')]['rawAttributes']);_0x4d4405[_0xb670('0x2c')]=_[_0xb670('0x43')](_0x4b679d[_0xb670('0x2c')]);_0x4d4405['filters']=_[_0xb670('0x2e')](_0x4d4405['model'],_0x4d4405[_0xb670('0x2c')]);_0x175a04[_0xb670('0x32')]=_[_0xb670('0x2e')](_0x4d4405['model'],qs[_0xb670('0x30')](_0x4b679d['query'][_0xb670('0x30')]));_0x175a04['attributes']=_0x175a04[_0xb670('0x32')][_0xb670('0x31')]?_0x175a04[_0xb670('0x32')]:_0x4d4405['model'];_0x175a04['order']=qs['sort'](_0x4b679d[_0xb670('0x2c')][_0xb670('0x36')]);_0x175a04[_0xb670('0x37')]=qs[_0xb670('0x2d')](_[_0xb670('0x38')](_0x4b679d[_0xb670('0x2c')],_0x4d4405[_0xb670('0x2d')]));if(_0x4b679d[_0xb670('0x2c')][_0xb670('0x39')]){_0x175a04['where']=_['merge'](_0x175a04[_0xb670('0x37')],{'$or':_[_0xb670('0x28')](_0x175a04[_0xb670('0x32')],function(_0x4075d4){var _0x1f6650={};_0x1f6650[_0x4075d4]={'$like':'%'+_0x4b679d[_0xb670('0x2c')][_0xb670('0x39')]+'%'};return _0x1f6650;})});}_0x175a04=_[_0xb670('0x3b')]({},_0x175a04,_0x4b679d[_0xb670('0x3c')]);return _0x47c57a[_0xb670('0x49')](_0x175a04);}})[_0xb670('0x25')](function(_0x13c7a8){if(_0x13c7a8){_0x32077a=_0x13c7a8[_0xb670('0x31')];if(!_0x4b679d[_0xb670('0x2c')][_0xb670('0x33')]('nolimit')){_0x175a04[_0xb670('0x1e')]=qs[_0xb670('0x1e')](_0x4b679d['query'][_0xb670('0x1e')]);_0x175a04[_0xb670('0x1b')]=qs[_0xb670('0x1b')](_0x4b679d[_0xb670('0x2c')][_0xb670('0x1b')]);}return _0x47c57a[_0xb670('0x49')](_0x175a04);}})[_0xb670('0x25')](function(_0x24745e){if(_0x24745e){return _0x24745e?{'count':_0x32077a,'rows':_0x24745e}:null;}})[_0xb670('0x25')](respondWithResult(_0x265a57,null))[_0xb670('0x40')](handleError(_0x265a57,null));};exports[_0xb670('0x4a')]=function(_0x4a3ff4,_0x1ecc11,_0x355c2f){var _0x37a7b0={};var _0x205bc6={};var _0x354e69;var _0x168988;return db[_0xb670('0x29')][_0xb670('0x47')]({'where':{'id':_0x4a3ff4[_0xb670('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ecc11,null))[_0xb670('0x25')](function(_0x4dc2d7){if(_0x4dc2d7){_0x354e69=_0x4dc2d7;_0x205bc6[_0xb670('0x2f')]=_['keys'](db[_0xb670('0x48')]['rawAttributes']);_0x205bc6[_0xb670('0x2c')]=_[_0xb670('0x43')](_0x4a3ff4[_0xb670('0x2c')]);_0x205bc6['filters']=_['intersection'](_0x205bc6[_0xb670('0x2f')],_0x205bc6[_0xb670('0x2c')]);_0x37a7b0[_0xb670('0x32')]=_['intersection'](_0x205bc6['model'],qs[_0xb670('0x30')](_0x4a3ff4[_0xb670('0x2c')][_0xb670('0x30')]));_0x37a7b0['attributes']=_0x37a7b0[_0xb670('0x32')][_0xb670('0x31')]?_0x37a7b0[_0xb670('0x32')]:_0x205bc6[_0xb670('0x2f')];_0x37a7b0[_0xb670('0x35')]=qs[_0xb670('0x36')](_0x4a3ff4['query'][_0xb670('0x36')]);_0x37a7b0['where']=qs[_0xb670('0x2d')](_[_0xb670('0x38')](_0x4a3ff4[_0xb670('0x2c')],_0x205bc6[_0xb670('0x2d')]));if(_0x4a3ff4[_0xb670('0x2c')][_0xb670('0x39')]){_0x37a7b0['where']=_[_0xb670('0x3b')](_0x37a7b0[_0xb670('0x37')],{'$or':_[_0xb670('0x28')](_0x37a7b0[_0xb670('0x32')],function(_0x278b50){var _0x24265c={};_0x24265c[_0x278b50]={'$like':'%'+_0x4a3ff4[_0xb670('0x2c')][_0xb670('0x39')]+'%'};return _0x24265c;})});}_0x37a7b0=_['merge']({},_0x37a7b0,_0x4a3ff4['options']);return _0x354e69[_0xb670('0x4a')](_0x37a7b0);}})[_0xb670('0x25')](function(_0x5c6799){if(_0x5c6799){_0x168988=_0x5c6799[_0xb670('0x31')];if(!_0x4a3ff4[_0xb670('0x2c')][_0xb670('0x33')](_0xb670('0x34'))){_0x37a7b0[_0xb670('0x1e')]=qs[_0xb670('0x1e')](_0x4a3ff4[_0xb670('0x2c')][_0xb670('0x1e')]);_0x37a7b0[_0xb670('0x1b')]=qs[_0xb670('0x1b')](_0x4a3ff4[_0xb670('0x2c')][_0xb670('0x1b')]);}return _0x354e69['getSubjects'](_0x37a7b0);}})[_0xb670('0x25')](function(_0x7a2aff){if(_0x7a2aff){return _0x7a2aff?{'count':_0x168988,'rows':_0x7a2aff}:null;}})[_0xb670('0x25')](respondWithResult(_0x1ecc11,null))[_0xb670('0x40')](handleError(_0x1ecc11,null));};exports['getDescriptions']=function(_0x109717,_0x369ae6,_0xe8ab19){var _0x507bf2={};var _0x544914={};var _0x429ef2;var _0x52fd6b;return db[_0xb670('0x29')][_0xb670('0x47')]({'where':{'id':_0x109717[_0xb670('0x42')]['id']}})[_0xb670('0x25')](handleEntityNotFound(_0x369ae6,null))['then'](function(_0x2b2e89){if(_0x2b2e89){_0x429ef2=_0x2b2e89;_0x544914[_0xb670('0x2f')]=_[_0xb670('0x43')](db[_0xb670('0x48')][_0xb670('0x4b')]);_0x544914[_0xb670('0x2c')]=_[_0xb670('0x43')](_0x109717['query']);_0x544914[_0xb670('0x2d')]=_[_0xb670('0x2e')](_0x544914[_0xb670('0x2f')],_0x544914[_0xb670('0x2c')]);_0x507bf2[_0xb670('0x32')]=_[_0xb670('0x2e')](_0x544914[_0xb670('0x2f')],qs[_0xb670('0x30')](_0x109717[_0xb670('0x2c')][_0xb670('0x30')]));_0x507bf2['attributes']=_0x507bf2['attributes'][_0xb670('0x31')]?_0x507bf2[_0xb670('0x32')]:_0x544914['model'];_0x507bf2[_0xb670('0x35')]=qs['sort'](_0x109717[_0xb670('0x2c')][_0xb670('0x36')]);_0x507bf2[_0xb670('0x37')]=qs['filters'](_[_0xb670('0x38')](_0x109717[_0xb670('0x2c')],_0x544914['filters']));if(_0x109717[_0xb670('0x2c')][_0xb670('0x39')]){_0x507bf2[_0xb670('0x37')]=_[_0xb670('0x3b')](_0x507bf2['where'],{'$or':_[_0xb670('0x28')](_0x507bf2[_0xb670('0x32')],function(_0x2ac1bb){var _0x652517={};_0x652517[_0x2ac1bb]={'$like':'%'+_0x109717[_0xb670('0x2c')][_0xb670('0x39')]+'%'};return _0x652517;})});}_0x507bf2=_[_0xb670('0x3b')]({},_0x507bf2,_0x109717[_0xb670('0x3c')]);return _0x429ef2[_0xb670('0x4c')](_0x507bf2);}})[_0xb670('0x25')](function(_0x934d44){if(_0x934d44){_0x52fd6b=_0x934d44['length'];if(!_0x109717[_0xb670('0x2c')]['hasOwnProperty'](_0xb670('0x34'))){_0x507bf2[_0xb670('0x1e')]=qs[_0xb670('0x1e')](_0x109717[_0xb670('0x2c')][_0xb670('0x1e')]);_0x507bf2['offset']=qs['offset'](_0x109717[_0xb670('0x2c')][_0xb670('0x1b')]);}return _0x429ef2[_0xb670('0x4c')](_0x507bf2);}})['then'](function(_0x46add8){if(_0x46add8){return _0x46add8?{'count':_0x52fd6b,'rows':_0x46add8}:null;}})['then'](respondWithResult(_0x369ae6,null))[_0xb670('0x40')](handleError(_0x369ae6,null));};exports[_0xb670('0x4d')]=function(_0x161bed,_0x5cbc3e,_0x345a33){var _0x3b9468={};var _0x2437a0={};var _0x37bce7;var _0x5545a2;return db[_0xb670('0x29')][_0xb670('0x47')]({'where':{'id':_0x161bed[_0xb670('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cbc3e,null))[_0xb670('0x25')](function(_0x5e4218){if(_0x5e4218){_0x37bce7=_0x5e4218;_0x2437a0[_0xb670('0x2f')]=_[_0xb670('0x43')](db[_0xb670('0x4e')][_0xb670('0x4b')]);_0x2437a0[_0xb670('0x2c')]=_['keys'](_0x161bed['query']);_0x2437a0[_0xb670('0x2d')]=_[_0xb670('0x2e')](_0x2437a0[_0xb670('0x2f')],_0x2437a0[_0xb670('0x2c')]);_0x3b9468[_0xb670('0x32')]=_[_0xb670('0x2e')](_0x2437a0[_0xb670('0x2f')],qs[_0xb670('0x30')](_0x161bed[_0xb670('0x2c')][_0xb670('0x30')]));_0x3b9468['attributes']=_0x3b9468[_0xb670('0x32')][_0xb670('0x31')]?_0x3b9468[_0xb670('0x32')]:_0x2437a0['model'];_0x3b9468[_0xb670('0x35')]=qs[_0xb670('0x36')](_0x161bed[_0xb670('0x2c')][_0xb670('0x36')]);_0x3b9468['where']=qs[_0xb670('0x2d')](_[_0xb670('0x38')](_0x161bed['query'],_0x2437a0['filters']));if(_0x161bed[_0xb670('0x2c')][_0xb670('0x39')]){_0x3b9468[_0xb670('0x37')]=_[_0xb670('0x3b')](_0x3b9468['where'],{'$or':_[_0xb670('0x28')](_0x3b9468['attributes'],function(_0x16c40b){var _0xd3435e={};_0xd3435e[_0x16c40b]={'$like':'%'+_0x161bed[_0xb670('0x2c')][_0xb670('0x39')]+'%'};return _0xd3435e;})});}_0x3b9468=_['merge']({},_0x3b9468,_0x161bed[_0xb670('0x3c')]);return _0x37bce7[_0xb670('0x4d')](_0x3b9468);}})[_0xb670('0x25')](function(_0x1c44db){if(_0x1c44db){_0x5545a2=_0x1c44db[_0xb670('0x31')];if(!_0x161bed[_0xb670('0x2c')][_0xb670('0x33')](_0xb670('0x34'))){_0x3b9468[_0xb670('0x1e')]=qs['limit'](_0x161bed[_0xb670('0x2c')][_0xb670('0x1e')]);_0x3b9468[_0xb670('0x1b')]=qs[_0xb670('0x1b')](_0x161bed['query']['offset']);}return _0x37bce7[_0xb670('0x4d')](_0x3b9468);}})[_0xb670('0x25')](function(_0x19e37b){if(_0x19e37b){return _0x19e37b?{'count':_0x5545a2,'rows':_0x19e37b}:null;}})[_0xb670('0x25')](respondWithResult(_0x5cbc3e,null))['catch'](handleError(_0x5cbc3e,null));};exports[_0xb670('0x4f')]=function(_0x33567b,_0x205bc1,_0x27d436){if(_0x33567b[_0xb670('0x46')]['id']){delete _0x33567b[_0xb670('0x46')]['id'];}return db[_0xb670('0x29')][_0xb670('0x47')]({'where':{'id':_0x33567b['params']['id']}})['then'](handleEntityNotFound(_0x205bc1,null))[_0xb670('0x25')](function(_0x588093){if(_0x588093){return _0x588093[_0xb670('0x4f')](_0x33567b['body'][_0xb670('0x50')]||[]);}return null;})[_0xb670('0x25')](respondWithResult(_0x205bc1,null))[_0xb670('0x40')](handleError(_0x205bc1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bd576a2..4f0879e 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 _0x8383=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b26a9,_0x31e5e0){var _0x4942b8=function(_0x44471f){while(--_0x44471f){_0x2b26a9['push'](_0x2b26a9['shift']());}};_0x4942b8(++_0x31e5e0);}(_0x8383,0x1a9));var _0x3838=function(_0x487861,_0x358f2f){_0x487861=_0x487861-0x0;var _0x56b689=_0x8383[_0x487861];return _0x56b689;};'use strict';var _=require(_0x3838('0x0'));var util=require(_0x3838('0x1'));var logger=require(_0x3838('0x2'))(_0x3838('0x3'));var moment=require(_0x3838('0x4'));var BPromise=require(_0x3838('0x5'));var rp=require(_0x3838('0x6'));var fs=require('fs');var path=require(_0x3838('0x7'));var rimraf=require(_0x3838('0x8'));var config=require(_0x3838('0x9'));var attributes=require(_0x3838('0xa'));module[_0x3838('0xb')]=function(_0x577488,_0x4091b4){return _0x577488[_0x3838('0xc')](_0x3838('0xd'),attributes,{'tableName':_0x3838('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4655=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration'];(function(_0x291eda,_0x1a6630){var _0x305b71=function(_0x2f321c){while(--_0x2f321c){_0x291eda['push'](_0x291eda['shift']());}};_0x305b71(++_0x1a6630);}(_0x4655,0x11e));var _0x5465=function(_0x92bf2c,_0x479730){_0x92bf2c=_0x92bf2c-0x0;var _0x536d74=_0x4655[_0x92bf2c];return _0x536d74;};'use strict';var _=require('lodash');var util=require(_0x5465('0x0'));var logger=require(_0x5465('0x1'))(_0x5465('0x2'));var moment=require(_0x5465('0x3'));var BPromise=require(_0x5465('0x4'));var rp=require(_0x5465('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5465('0x6'));var config=require(_0x5465('0x7'));var attributes=require(_0x5465('0x8'));module['exports']=function(_0x23687e,_0x11d95f){return _0x23687e[_0x5465('0x9')](_0x5465('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 868fbfa..167b418 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 _0xa63a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3e2ffd,_0x46cada){var _0xeee2bd=function(_0x94000e){while(--_0x94000e){_0x3e2ffd['push'](_0x3e2ffd['shift']());}};_0xeee2bd(++_0x46cada);}(_0xa63a,0x154));var _0xaa63=function(_0x5c1b05,_0x213768){_0x5c1b05=_0x5c1b05-0x0;var _0x1a65e7=_0xa63a[_0x5c1b05];return _0x1a65e7;};'use strict';var _=require('lodash');var util=require(_0xaa63('0x0'));var moment=require(_0xaa63('0x1'));var BPromise=require(_0xaa63('0x2'));var rs=require(_0xaa63('0x3'));var fs=require('fs');var Redis=require(_0xaa63('0x4'));var db=require(_0xaa63('0x5'))['db'];var utils=require(_0xaa63('0x6'));var logger=require(_0xaa63('0x7'))(_0xaa63('0x8'));var config=require(_0xaa63('0x9'));var jayson=require(_0xaa63('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ee756,_0x43e4e3,_0x53e524){return new BPromise(function(_0x42f55d,_0x37abe2){return client['request'](_0x5ee756,_0x53e524)[_0xaa63('0xb')](function(_0x146c00){logger[_0xaa63('0xc')](_0xaa63('0xd'),_0x43e4e3,_0xaa63('0xe'));logger[_0xaa63('0xf')](_0xaa63('0x10'),_0x43e4e3,'request\x20sent',JSON[_0xaa63('0x11')](_0x146c00));if(_0x146c00[_0xaa63('0x12')]){if(_0x146c00[_0xaa63('0x12')][_0xaa63('0x13')]===0x1f4){logger[_0xaa63('0x12')](_0xaa63('0xd'),_0x43e4e3,_0x146c00['error']['message']);return _0x37abe2(_0x146c00['error']['message']);}logger[_0xaa63('0x12')](_0xaa63('0xd'),_0x43e4e3,_0x146c00[_0xaa63('0x12')][_0xaa63('0x14')]);return _0x42f55d(_0x146c00[_0xaa63('0x12')][_0xaa63('0x14')]);}else{logger[_0xaa63('0xc')](_0xaa63('0xd'),_0x43e4e3,'request\x20sent');_0x42f55d(_0x146c00[_0xaa63('0x15')][_0xaa63('0x14')]);}})[_0xaa63('0x16')](function(_0x285a23){logger[_0xaa63('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x43e4e3,_0x285a23);_0x37abe2(_0x285a23);});});} \ No newline at end of file +var _0x45c2=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x4704f5,_0xe0fb47){var _0x442fe1=function(_0x2a76de){while(--_0x2a76de){_0x4704f5['push'](_0x4704f5['shift']());}};_0x442fe1(++_0xe0fb47);}(_0x45c2,0x68));var _0x245c=function(_0x5ac791,_0x504d37){_0x5ac791=_0x5ac791-0x0;var _0x9e3a19=_0x45c2[_0x5ac791];return _0x9e3a19;};'use strict';var _=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var moment=require(_0x245c('0x2'));var BPromise=require(_0x245c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x245c('0x4'));var db=require(_0x245c('0x5'))['db'];var utils=require(_0x245c('0x6'));var logger=require('../../config/logger')(_0x245c('0x7'));var config=require(_0x245c('0x8'));var jayson=require(_0x245c('0x9'));var client=jayson[_0x245c('0xa')][_0x245c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1860,_0x20a6d7,_0x10da3e){return new BPromise(function(_0x20c72d,_0x40eab8){return client[_0x245c('0xc')](_0x2e1860,_0x10da3e)[_0x245c('0xd')](function(_0x558ef3){logger[_0x245c('0xe')](_0x245c('0xf'),_0x20a6d7,_0x245c('0x10'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20a6d7,_0x245c('0x10'),JSON[_0x245c('0x11')](_0x558ef3));if(_0x558ef3['error']){if(_0x558ef3[_0x245c('0x12')]['code']===0x1f4){logger[_0x245c('0x12')](_0x245c('0xf'),_0x20a6d7,_0x558ef3[_0x245c('0x12')][_0x245c('0x13')]);return _0x40eab8(_0x558ef3[_0x245c('0x12')]['message']);}logger[_0x245c('0x12')](_0x245c('0xf'),_0x20a6d7,_0x558ef3[_0x245c('0x12')][_0x245c('0x13')]);return _0x20c72d(_0x558ef3['error'][_0x245c('0x13')]);}else{logger['info'](_0x245c('0xf'),_0x20a6d7,_0x245c('0x10'));_0x20c72d(_0x558ef3[_0x245c('0x14')][_0x245c('0x13')]);}})['catch'](function(_0x124e02){logger[_0x245c('0x12')](_0x245c('0xf'),_0x20a6d7,_0x124e02);_0x40eab8(_0x124e02);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0df2e5c..b673790 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 _0x0e4a=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0e4a,0xd8));var _0xa0e4=function(_0x41cb1c,_0x189664){_0x41cb1c=_0x41cb1c-0x0;var _0x150510=_0x0e4a[_0x41cb1c];return _0x150510;};'use strict';var multer=require(_0xa0e4('0x0'));var util=require(_0xa0e4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0e4('0x2')]();var fs_extra=require(_0xa0e4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa0e4('0x4'));var config=require(_0xa0e4('0x5'));var controller=require(_0xa0e4('0x6'));router[_0xa0e4('0x7')]('/',auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x9')]);router['get']('/:id',auth[_0xa0e4('0x8')](),controller[_0xa0e4('0xa')]);router[_0xa0e4('0xb')]('/',auth[_0xa0e4('0x8')](),controller['create']);router[_0xa0e4('0xc')](_0xa0e4('0xd'),auth[_0xa0e4('0x8')](),controller[_0xa0e4('0xe')]);router[_0xa0e4('0xf')](_0xa0e4('0xd'),auth[_0xa0e4('0x8')](),controller[_0xa0e4('0x10')]);module[_0xa0e4('0x11')]=router; \ No newline at end of file +var _0xa3f2=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3f2,0x6c));var _0x2a3f=function(_0x144c83,_0x438f9d){_0x144c83=_0x144c83-0x0;var _0x294fd2=_0xa3f2[_0x144c83];return _0x294fd2;};'use strict';var multer=require(_0x2a3f('0x0'));var util=require(_0x2a3f('0x1'));var path=require(_0x2a3f('0x2'));var timeout=require(_0x2a3f('0x3'));var express=require(_0x2a3f('0x4'));var router=express[_0x2a3f('0x5')]();var fs_extra=require(_0x2a3f('0x6'));var auth=require(_0x2a3f('0x7'));var interaction=require(_0x2a3f('0x8'));var config=require(_0x2a3f('0x9'));var controller=require('./intDeskField.controller');router[_0x2a3f('0xa')]('/',auth[_0x2a3f('0xb')](),controller['index']);router['get'](_0x2a3f('0xc'),auth[_0x2a3f('0xb')](),controller[_0x2a3f('0xd')]);router[_0x2a3f('0xe')]('/',auth[_0x2a3f('0xb')](),controller['create']);router['put'](_0x2a3f('0xc'),auth[_0x2a3f('0xb')](),controller[_0x2a3f('0xf')]);router['delete']('/:id',auth[_0x2a3f('0xb')](),controller[_0x2a3f('0x10')]);module[_0x2a3f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6d0e264..d23e00e 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 _0x2481=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x3c37b2,_0x223707){var _0x372e4b=function(_0x3a4067){while(--_0x3a4067){_0x3c37b2['push'](_0x3c37b2['shift']());}};_0x372e4b(++_0x223707);}(_0x2481,0x186));var _0x1248=function(_0x1b1642,_0x3600f2){_0x1b1642=_0x1b1642-0x0;var _0xa5aea3=_0x2481[_0x1b1642];return _0xa5aea3;};'use strict';var Sequelize=require(_0x1248('0x0'));module['exports']={'type':{'type':Sequelize[_0x1248('0x1')](_0x1248('0x2'),_0x1248('0x3'),_0x1248('0x4'),'keyValue',_0x1248('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1248('0x6')]},'key':{'type':Sequelize[_0x1248('0x6')]},'keyType':{'type':Sequelize[_0x1248('0x1')]('string','variable',_0x1248('0x4'))},'keyContent':{'type':Sequelize[_0x1248('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1248('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1248('0x6')]}}; \ No newline at end of file +var _0xfb22=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xfb22,0x6e));var _0x2fb2=function(_0x4c7410,_0x43bf77){_0x4c7410=_0x4c7410-0x0;var _0x2cf87d=_0xfb22[_0x4c7410];return _0x2cf87d;};'use strict';var Sequelize=require(_0x2fb2('0x0'));module[_0x2fb2('0x1')]={'type':{'type':Sequelize[_0x2fb2('0x2')]('string',_0x2fb2('0x3'),_0x2fb2('0x4'),_0x2fb2('0x5'),_0x2fb2('0x6')),'defaultValue':_0x2fb2('0x7')},'content':{'type':Sequelize[_0x2fb2('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2fb2('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2fb2('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2fb2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2fb2('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b61baf6..fdef1ad 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 _0x8289=['show','params','keys','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll'];(function(_0x214691,_0x4d221b){var _0x16feb0=function(_0x43dbb2){while(--_0x43dbb2){_0x214691['push'](_0x214691['shift']());}};_0x16feb0(++_0x4d221b);}(_0x8289,0xf8));var _0x9828=function(_0x20ed15,_0x5cbc68){_0x20ed15=_0x20ed15-0x0;var _0x5dc256=_0x8289[_0x20ed15];return _0x5dc256;};'use strict';var emlformat=require(_0x9828('0x0'));var rimraf=require(_0x9828('0x1'));var zipdir=require(_0x9828('0x2'));var jsonpatch=require(_0x9828('0x3'));var rp=require(_0x9828('0x4'));var moment=require(_0x9828('0x5'));var BPromise=require(_0x9828('0x6'));var Mustache=require(_0x9828('0x7'));var util=require('util');var path=require(_0x9828('0x8'));var sox=require(_0x9828('0x9'));var csv=require(_0x9828('0xa'));var ejs=require(_0x9828('0xb'));var fs=require('fs');var fs_extra=require(_0x9828('0xc'));var _=require(_0x9828('0xd'));var squel=require(_0x9828('0xe'));var crypto=require(_0x9828('0xf'));var jsforce=require(_0x9828('0x10'));var deskjs=require(_0x9828('0x11'));var toCsv=require(_0x9828('0xa'));var querystring=require(_0x9828('0x12'));var Papa=require(_0x9828('0x13'));var Redis=require(_0x9828('0x14'));var authService=require(_0x9828('0x15'));var qs=require(_0x9828('0x16'));var as=require(_0x9828('0x17'));var hardwareService=require(_0x9828('0x18'));var logger=require(_0x9828('0x19'))('api');var utils=require(_0x9828('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x9828('0x1b'));var db=require(_0x9828('0x1c'))['db'];function respondWithStatusCode(_0x41320f,_0x3af102){_0x3af102=_0x3af102||0xcc;return function(_0x3186ee){if(_0x3186ee){return _0x41320f[_0x9828('0x1d')](_0x3af102);}return _0x41320f[_0x9828('0x1e')](_0x3af102)[_0x9828('0x1f')]();};}function respondWithResult(_0x30e8ee,_0x4132c4){_0x4132c4=_0x4132c4||0xc8;return function(_0x155343){if(_0x155343){return _0x30e8ee[_0x9828('0x1e')](_0x4132c4)[_0x9828('0x20')](_0x155343);}};}function respondWithFilteredResult(_0x43ff2b,_0x563eb1){return function(_0x44bea2){if(_0x44bea2){var _0x29ae36=typeof _0x563eb1[_0x9828('0x21')]===_0x9828('0x22')&&typeof _0x563eb1[_0x9828('0x23')]===_0x9828('0x22');var _0x1d14c8=_0x44bea2['count'];var _0x2fb19e=_0x29ae36?0x0:_0x563eb1['offset'];var _0x259f35=_0x29ae36?_0x44bea2[_0x9828('0x24')]:_0x563eb1[_0x9828('0x21')]+_0x563eb1[_0x9828('0x23')];var _0x3cc718;if(_0x259f35>=_0x1d14c8){_0x259f35=_0x1d14c8;_0x3cc718=0xc8;}else{_0x3cc718=0xce;}_0x43ff2b['status'](_0x3cc718);return _0x43ff2b[_0x9828('0x25')](_0x9828('0x26'),_0x2fb19e+'-'+_0x259f35+'/'+_0x1d14c8)['json'](_0x44bea2);}return null;};}function patchUpdates(_0x2eee4d){return function(_0x10bc8c){try{jsonpatch['apply'](_0x10bc8c,_0x2eee4d,!![]);}catch(_0x1e3caa){return BPromise[_0x9828('0x27')](_0x1e3caa);}return _0x10bc8c[_0x9828('0x28')]();};}function saveUpdates(_0x4836f6,_0x2e6c60){return function(_0x534b5e){if(_0x534b5e){return _0x534b5e[_0x9828('0x29')](_0x4836f6)[_0x9828('0x2a')](function(_0x344a1d){return _0x344a1d;});}return null;};}function removeEntity(_0x4b7484,_0x56c7a7){return function(_0x296037){if(_0x296037){return _0x296037[_0x9828('0x2b')]()[_0x9828('0x2a')](function(){_0x4b7484[_0x9828('0x1e')](0xcc)[_0x9828('0x1f')]();});}};}function handleEntityNotFound(_0x57b06a,_0x9466b0){return function(_0x3cb295){if(!_0x3cb295){_0x57b06a[_0x9828('0x1d')](0x194);}return _0x3cb295;};}function handleError(_0x58a08d,_0x4b9207){_0x4b9207=_0x4b9207||0x1f4;return function(_0x12744c){logger[_0x9828('0x2c')](_0x12744c[_0x9828('0x2d')]);if(_0x12744c[_0x9828('0x2e')]){delete _0x12744c[_0x9828('0x2e')];}_0x58a08d['status'](_0x4b9207)['send'](_0x12744c);};}exports[_0x9828('0x2f')]=function(_0x3f2f2a,_0x137338){var _0x93648={},_0x58acf2={},_0x5ef7a7={'count':0x0,'rows':[]};var _0x451983=_[_0x9828('0x30')](db[_0x9828('0x31')][_0x9828('0x32')],function(_0x37c81d){return{'name':_0x37c81d[_0x9828('0x33')],'type':_0x37c81d[_0x9828('0x34')][_0x9828('0x35')]};});_0x58acf2[_0x9828('0x36')]=_[_0x9828('0x30')](_0x451983,_0x9828('0x2e'));_0x58acf2[_0x9828('0x37')]=_['keys'](_0x3f2f2a[_0x9828('0x37')]);_0x58acf2[_0x9828('0x38')]=_['intersection'](_0x58acf2[_0x9828('0x36')],_0x58acf2[_0x9828('0x37')]);_0x93648[_0x9828('0x39')]=_[_0x9828('0x3a')](_0x58acf2[_0x9828('0x36')],qs[_0x9828('0x3b')](_0x3f2f2a[_0x9828('0x37')]['fields']));_0x93648['attributes']=_0x93648[_0x9828('0x39')][_0x9828('0x3c')]?_0x93648['attributes']:_0x58acf2['model'];if(!_0x3f2f2a['query'][_0x9828('0x3d')](_0x9828('0x3e'))){_0x93648['limit']=qs[_0x9828('0x23')](_0x3f2f2a[_0x9828('0x37')][_0x9828('0x23')]);_0x93648[_0x9828('0x21')]=qs[_0x9828('0x21')](_0x3f2f2a[_0x9828('0x37')][_0x9828('0x21')]);}_0x93648[_0x9828('0x3f')]=qs[_0x9828('0x40')](_0x3f2f2a[_0x9828('0x37')][_0x9828('0x40')]);_0x93648[_0x9828('0x41')]=qs['filters'](_['pick'](_0x3f2f2a[_0x9828('0x37')],_0x58acf2[_0x9828('0x38')]),_0x451983);if(_0x3f2f2a[_0x9828('0x37')][_0x9828('0x42')]){_0x93648[_0x9828('0x41')]=_['merge'](_0x93648['where'],{'$or':_['map'](_0x451983,function(_0x995ed9){if(_0x995ed9[_0x9828('0x34')]!==_0x9828('0x43')){var _0x2377aa={};_0x2377aa[_0x995ed9['name']]={'$like':'%'+_0x3f2f2a[_0x9828('0x37')][_0x9828('0x42')]+'%'};return _0x2377aa;}})});}_0x93648=_['merge']({},_0x93648,_0x3f2f2a[_0x9828('0x44')]);var _0x5962af={'where':_0x93648['where']};return db[_0x9828('0x31')][_0x9828('0x24')](_0x5962af)['then'](function(_0x25170b){_0x5ef7a7['count']=_0x25170b;if(_0x3f2f2a['query'][_0x9828('0x45')]){_0x93648[_0x9828('0x46')]=[{'all':!![]}];}return db['DeskField'][_0x9828('0x47')](_0x93648);})['then'](function(_0x29fb58){_0x5ef7a7['rows']=_0x29fb58;return _0x5ef7a7;})[_0x9828('0x2a')](respondWithFilteredResult(_0x137338,_0x93648))['catch'](handleError(_0x137338,null));};exports[_0x9828('0x48')]=function(_0x4f32fe,_0x2cdc7b){var _0x20162a={'raw':!![],'where':{'id':_0x4f32fe[_0x9828('0x49')]['id']}},_0x33889c={};_0x33889c[_0x9828('0x36')]=_[_0x9828('0x4a')](db[_0x9828('0x31')][_0x9828('0x32')]);_0x33889c[_0x9828('0x37')]=_[_0x9828('0x4a')](_0x4f32fe['query']);_0x33889c['filters']=_[_0x9828('0x3a')](_0x33889c[_0x9828('0x36')],_0x33889c[_0x9828('0x37')]);_0x20162a[_0x9828('0x39')]=_[_0x9828('0x3a')](_0x33889c[_0x9828('0x36')],qs[_0x9828('0x3b')](_0x4f32fe[_0x9828('0x37')]['fields']));_0x20162a[_0x9828('0x39')]=_0x20162a[_0x9828('0x39')]['length']?_0x20162a[_0x9828('0x39')]:_0x33889c[_0x9828('0x36')];if(_0x4f32fe[_0x9828('0x37')][_0x9828('0x45')]){_0x20162a[_0x9828('0x46')]=[{'all':!![]}];}_0x20162a=_[_0x9828('0x4b')]({},_0x20162a,_0x4f32fe[_0x9828('0x44')]);return db[_0x9828('0x31')][_0x9828('0x4c')](_0x20162a)[_0x9828('0x2a')](handleEntityNotFound(_0x2cdc7b,null))[_0x9828('0x2a')](respondWithResult(_0x2cdc7b,null))[_0x9828('0x4d')](handleError(_0x2cdc7b,null));};exports[_0x9828('0x4e')]=function(_0x5d147a,_0x1cb779){return db[_0x9828('0x31')][_0x9828('0x4e')](_0x5d147a[_0x9828('0x4f')],{})[_0x9828('0x2a')](respondWithResult(_0x1cb779,0xc9))[_0x9828('0x4d')](handleError(_0x1cb779,null));};exports['update']=function(_0x4ca19c,_0x1d3abd){if(_0x4ca19c[_0x9828('0x4f')]['id']){delete _0x4ca19c['body']['id'];}return db[_0x9828('0x31')][_0x9828('0x4c')]({'where':{'id':_0x4ca19c[_0x9828('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d3abd,null))[_0x9828('0x2a')](saveUpdates(_0x4ca19c[_0x9828('0x4f')],null))[_0x9828('0x2a')](respondWithResult(_0x1d3abd,null))[_0x9828('0x4d')](handleError(_0x1d3abd,null));};exports[_0x9828('0x2b')]=function(_0x304ed6,_0x98abbb){return db[_0x9828('0x31')][_0x9828('0x4c')]({'where':{'id':_0x304ed6['params']['id']}})['then'](handleEntityNotFound(_0x98abbb,null))['then'](removeEntity(_0x98abbb,null))[_0x9828('0x4d')](handleError(_0x98abbb,null));}; \ No newline at end of file +var _0xe384=['request-promise','mustache','util','to-csv','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskField','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','params','eml-format','zip-dir','fast-json-patch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe384,0x160));var _0x4e38=function(_0xf406c3,_0xfb2e32){_0xf406c3=_0xf406c3-0x0;var _0x261c32=_0xe384[_0xf406c3];return _0x261c32;};'use strict';var emlformat=require(_0x4e38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e38('0x1'));var jsonpatch=require(_0x4e38('0x2'));var rp=require(_0x4e38('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e38('0x4'));var util=require(_0x4e38('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4e38('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e38('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e38('0x8'));var deskjs=require(_0x4e38('0x9'));var toCsv=require(_0x4e38('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e38('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x4e38('0xb'));var as=require(_0x4e38('0xc'));var hardwareService=require(_0x4e38('0xd'));var logger=require(_0x4e38('0xe'))(_0x4e38('0xf'));var utils=require(_0x4e38('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4e38('0x11'));var db=require(_0x4e38('0x12'))['db'];function respondWithStatusCode(_0x16b035,_0x4c02c9){_0x4c02c9=_0x4c02c9||0xcc;return function(_0x631e61){if(_0x631e61){return _0x16b035[_0x4e38('0x13')](_0x4c02c9);}return _0x16b035['status'](_0x4c02c9)[_0x4e38('0x14')]();};}function respondWithResult(_0x59f68a,_0x4d242e){_0x4d242e=_0x4d242e||0xc8;return function(_0x4433cc){if(_0x4433cc){return _0x59f68a[_0x4e38('0x15')](_0x4d242e)['json'](_0x4433cc);}};}function respondWithFilteredResult(_0x5bfc62,_0x216ce0){return function(_0x24d8c8){if(_0x24d8c8){var _0x5daca2=typeof _0x216ce0[_0x4e38('0x16')]===_0x4e38('0x17')&&typeof _0x216ce0[_0x4e38('0x18')]===_0x4e38('0x17');var _0x196470=_0x24d8c8['count'];var _0x37272e=_0x5daca2?0x0:_0x216ce0[_0x4e38('0x16')];var _0xb4e4b6=_0x5daca2?_0x24d8c8[_0x4e38('0x19')]:_0x216ce0[_0x4e38('0x16')]+_0x216ce0[_0x4e38('0x18')];var _0x1aca66;if(_0xb4e4b6>=_0x196470){_0xb4e4b6=_0x196470;_0x1aca66=0xc8;}else{_0x1aca66=0xce;}_0x5bfc62['status'](_0x1aca66);return _0x5bfc62[_0x4e38('0x1a')](_0x4e38('0x1b'),_0x37272e+'-'+_0xb4e4b6+'/'+_0x196470)[_0x4e38('0x1c')](_0x24d8c8);}return null;};}function patchUpdates(_0x8541f9){return function(_0x46e168){try{jsonpatch[_0x4e38('0x1d')](_0x46e168,_0x8541f9,!![]);}catch(_0xb3027a){return BPromise[_0x4e38('0x1e')](_0xb3027a);}return _0x46e168[_0x4e38('0x1f')]();};}function saveUpdates(_0x47ae97,_0x19c189){return function(_0x1db7ef){if(_0x1db7ef){return _0x1db7ef[_0x4e38('0x20')](_0x47ae97)[_0x4e38('0x21')](function(_0x404ad9){return _0x404ad9;});}return null;};}function removeEntity(_0x310ae7,_0x33bc64){return function(_0x1daccd){if(_0x1daccd){return _0x1daccd[_0x4e38('0x22')]()[_0x4e38('0x21')](function(){_0x310ae7['status'](0xcc)[_0x4e38('0x14')]();});}};}function handleEntityNotFound(_0x47b09b,_0x2c1006){return function(_0x33d49e){if(!_0x33d49e){_0x47b09b[_0x4e38('0x13')](0x194);}return _0x33d49e;};}function handleError(_0x2f8eae,_0x3a3a97){_0x3a3a97=_0x3a3a97||0x1f4;return function(_0x3eed38){logger[_0x4e38('0x23')](_0x3eed38['stack']);if(_0x3eed38['name']){delete _0x3eed38[_0x4e38('0x24')];}_0x2f8eae[_0x4e38('0x15')](_0x3a3a97)[_0x4e38('0x25')](_0x3eed38);};}exports[_0x4e38('0x26')]=function(_0xa81bc9,_0x5afd46){var _0xba37ff={},_0xf55f4f={},_0x57b0f9={'count':0x0,'rows':[]};var _0x2a66f1=_[_0x4e38('0x27')](db[_0x4e38('0x28')]['rawAttributes'],function(_0x4a673c){return{'name':_0x4a673c[_0x4e38('0x29')],'type':_0x4a673c['type'][_0x4e38('0x2a')]};});_0xf55f4f[_0x4e38('0x2b')]=_[_0x4e38('0x27')](_0x2a66f1,_0x4e38('0x24'));_0xf55f4f['query']=_[_0x4e38('0x2c')](_0xa81bc9[_0x4e38('0x2d')]);_0xf55f4f[_0x4e38('0x2e')]=_[_0x4e38('0x2f')](_0xf55f4f['model'],_0xf55f4f[_0x4e38('0x2d')]);_0xba37ff[_0x4e38('0x30')]=_[_0x4e38('0x2f')](_0xf55f4f['model'],qs['fields'](_0xa81bc9['query'][_0x4e38('0x31')]));_0xba37ff[_0x4e38('0x30')]=_0xba37ff[_0x4e38('0x30')][_0x4e38('0x32')]?_0xba37ff['attributes']:_0xf55f4f['model'];if(!_0xa81bc9[_0x4e38('0x2d')][_0x4e38('0x33')]('nolimit')){_0xba37ff[_0x4e38('0x18')]=qs['limit'](_0xa81bc9[_0x4e38('0x2d')][_0x4e38('0x18')]);_0xba37ff[_0x4e38('0x16')]=qs[_0x4e38('0x16')](_0xa81bc9[_0x4e38('0x2d')]['offset']);}_0xba37ff[_0x4e38('0x34')]=qs[_0x4e38('0x35')](_0xa81bc9[_0x4e38('0x2d')][_0x4e38('0x35')]);_0xba37ff['where']=qs[_0x4e38('0x2e')](_[_0x4e38('0x36')](_0xa81bc9[_0x4e38('0x2d')],_0xf55f4f[_0x4e38('0x2e')]),_0x2a66f1);if(_0xa81bc9[_0x4e38('0x2d')][_0x4e38('0x37')]){_0xba37ff['where']=_[_0x4e38('0x38')](_0xba37ff[_0x4e38('0x39')],{'$or':_['map'](_0x2a66f1,function(_0x7af284){if(_0x7af284[_0x4e38('0x3a')]!==_0x4e38('0x3b')){var _0x5e91ee={};_0x5e91ee[_0x7af284[_0x4e38('0x24')]]={'$like':'%'+_0xa81bc9[_0x4e38('0x2d')][_0x4e38('0x37')]+'%'};return _0x5e91ee;}})});}_0xba37ff=_[_0x4e38('0x38')]({},_0xba37ff,_0xa81bc9[_0x4e38('0x3c')]);var _0x4bda0d={'where':_0xba37ff[_0x4e38('0x39')]};return db['DeskField'][_0x4e38('0x19')](_0x4bda0d)[_0x4e38('0x21')](function(_0x5a9dfb){_0x57b0f9[_0x4e38('0x19')]=_0x5a9dfb;if(_0xa81bc9[_0x4e38('0x2d')][_0x4e38('0x3d')]){_0xba37ff['include']=[{'all':!![]}];}return db[_0x4e38('0x28')][_0x4e38('0x3e')](_0xba37ff);})['then'](function(_0x499d78){_0x57b0f9[_0x4e38('0x3f')]=_0x499d78;return _0x57b0f9;})['then'](respondWithFilteredResult(_0x5afd46,_0xba37ff))[_0x4e38('0x40')](handleError(_0x5afd46,null));};exports['show']=function(_0x432def,_0x358a26){var _0x3383af={'raw':!![],'where':{'id':_0x432def['params']['id']}},_0x14f940={};_0x14f940[_0x4e38('0x2b')]=_['keys'](db[_0x4e38('0x28')][_0x4e38('0x41')]);_0x14f940[_0x4e38('0x2d')]=_[_0x4e38('0x2c')](_0x432def[_0x4e38('0x2d')]);_0x14f940[_0x4e38('0x2e')]=_[_0x4e38('0x2f')](_0x14f940[_0x4e38('0x2b')],_0x14f940[_0x4e38('0x2d')]);_0x3383af['attributes']=_[_0x4e38('0x2f')](_0x14f940[_0x4e38('0x2b')],qs[_0x4e38('0x31')](_0x432def[_0x4e38('0x2d')][_0x4e38('0x31')]));_0x3383af[_0x4e38('0x30')]=_0x3383af[_0x4e38('0x30')]['length']?_0x3383af['attributes']:_0x14f940[_0x4e38('0x2b')];if(_0x432def['query'][_0x4e38('0x3d')]){_0x3383af[_0x4e38('0x42')]=[{'all':!![]}];}_0x3383af=_[_0x4e38('0x38')]({},_0x3383af,_0x432def[_0x4e38('0x3c')]);return db['DeskField'][_0x4e38('0x43')](_0x3383af)[_0x4e38('0x21')](handleEntityNotFound(_0x358a26,null))['then'](respondWithResult(_0x358a26,null))[_0x4e38('0x40')](handleError(_0x358a26,null));};exports['create']=function(_0xfb38d,_0x1cbc69){return db[_0x4e38('0x28')][_0x4e38('0x44')](_0xfb38d[_0x4e38('0x45')],{})['then'](respondWithResult(_0x1cbc69,0xc9))[_0x4e38('0x40')](handleError(_0x1cbc69,null));};exports[_0x4e38('0x20')]=function(_0x2a357d,_0x3ace84){if(_0x2a357d[_0x4e38('0x45')]['id']){delete _0x2a357d[_0x4e38('0x45')]['id'];}return db['DeskField'][_0x4e38('0x43')]({'where':{'id':_0x2a357d[_0x4e38('0x46')]['id']}})[_0x4e38('0x21')](handleEntityNotFound(_0x3ace84,null))['then'](saveUpdates(_0x2a357d[_0x4e38('0x45')],null))[_0x4e38('0x21')](respondWithResult(_0x3ace84,null))[_0x4e38('0x40')](handleError(_0x3ace84,null));};exports['destroy']=function(_0x4d3000,_0x1663a4){return db['DeskField'][_0x4e38('0x43')]({'where':{'id':_0x4d3000[_0x4e38('0x46')]['id']}})['then'](handleEntityNotFound(_0x1663a4,null))[_0x4e38('0x21')](removeEntity(_0x1663a4,null))[_0x4e38('0x40')](handleError(_0x1663a4,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index dfab665..9707fd3 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 _0xcf75=['util','../../config/logger','bluebird','request-promise','path','rimraf','./intDeskField.attributes','DeskField','int_desk_fields','FieldId','lodash'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xcf75,0x112));var _0x5cf7=function(_0x234214,_0xb4a789){_0x234214=_0x234214-0x0;var _0x231f3e=_0xcf75[_0x234214];return _0x231f3e;};'use strict';var _=require(_0x5cf7('0x0'));var util=require(_0x5cf7('0x1'));var logger=require(_0x5cf7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5cf7('0x3'));var rp=require(_0x5cf7('0x4'));var fs=require('fs');var path=require(_0x5cf7('0x5'));var rimraf=require(_0x5cf7('0x6'));var config=require('../../config/environment');var attributes=require(_0x5cf7('0x7'));module['exports']=function(_0x106b6c,_0xc302e6){return _0x106b6c['define'](_0x5cf7('0x8'),attributes,{'tableName':_0x5cf7('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x5cf7('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeaec=['request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','moment','bluebird'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xeaec,0x6d));var _0xceae=function(_0x48396f,_0x2303c2){_0x48396f=_0x48396f-0x0;var _0x37cb9e=_0xeaec[_0x48396f];return _0x37cb9e;};'use strict';var _=require('lodash');var util=require(_0xceae('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xceae('0x1'));var BPromise=require(_0xceae('0x2'));var rp=require(_0xceae('0x3'));var fs=require('fs');var path=require(_0xceae('0x4'));var rimraf=require(_0xceae('0x5'));var config=require('../../config/environment');var attributes=require(_0xceae('0x6'));module[_0xceae('0x7')]=function(_0x4944f0,_0x275be8){return _0x4944f0[_0xceae('0x8')](_0xceae('0x9'),attributes,{'tableName':_0xceae('0xa'),'paranoid':![],'indexes':[{'name':_0xceae('0xb'),'fields':[_0xceae('0xc'),_0xceae('0xd')],'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 f077610..9df34bd 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 _0x430a=['rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x40af9a,_0x42fc9c){var _0x283f30=function(_0x492413){while(--_0x492413){_0x40af9a['push'](_0x40af9a['shift']());}};_0x283f30(++_0x42fc9c);}(_0x430a,0x1f3));var _0xa430=function(_0x1daa97,_0xbaa3fc){_0x1daa97=_0x1daa97-0x0;var _0x551a31=_0x430a[_0x1daa97];return _0x551a31;};'use strict';var _=require('lodash');var util=require(_0xa430('0x0'));var moment=require(_0xa430('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa430('0x2'));var db=require(_0xa430('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa430('0x4'))(_0xa430('0x5'));var config=require(_0xa430('0x6'));var jayson=require(_0xa430('0x7'));var client=jayson['client'][_0xa430('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fa106,_0x5cde98,_0x1e7cde){return new BPromise(function(_0x484359,_0xf87939){return client[_0xa430('0x9')](_0x1fa106,_0x1e7cde)[_0xa430('0xa')](function(_0x4ccdf8){logger[_0xa430('0xb')](_0xa430('0xc'),_0x5cde98,_0xa430('0xd'));logger[_0xa430('0xe')](_0xa430('0xf'),_0x5cde98,_0xa430('0xd'),JSON[_0xa430('0x10')](_0x4ccdf8));if(_0x4ccdf8[_0xa430('0x11')]){if(_0x4ccdf8[_0xa430('0x11')][_0xa430('0x12')]===0x1f4){logger[_0xa430('0x11')](_0xa430('0xc'),_0x5cde98,_0x4ccdf8['error'][_0xa430('0x13')]);return _0xf87939(_0x4ccdf8['error']['message']);}logger[_0xa430('0x11')](_0xa430('0xc'),_0x5cde98,_0x4ccdf8[_0xa430('0x11')][_0xa430('0x13')]);return _0x484359(_0x4ccdf8['error'][_0xa430('0x13')]);}else{logger[_0xa430('0xb')](_0xa430('0xc'),_0x5cde98,_0xa430('0xd'));_0x484359(_0x4ccdf8[_0xa430('0x14')]['message']);}})['catch'](function(_0x51b2fc){logger[_0xa430('0x11')](_0xa430('0xc'),_0x5cde98,_0x51b2fc);_0xf87939(_0x51b2fc);});});} \ No newline at end of file +var _0xd97b=['http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x55adee,_0x4d9108){var _0x5f0455=function(_0x216c59){while(--_0x216c59){_0x55adee['push'](_0x55adee['shift']());}};_0x5f0455(++_0x4d9108);}(_0xd97b,0x1ea));var _0xbd97=function(_0x48c26e,_0x28625b){_0x48c26e=_0x48c26e-0x0;var _0x281d2b=_0xd97b[_0x48c26e];return _0x281d2b;};'use strict';var _=require('lodash');var util=require(_0xbd97('0x0'));var moment=require('moment');var BPromise=require(_0xbd97('0x1'));var rs=require(_0xbd97('0x2'));var fs=require('fs');var Redis=require(_0xbd97('0x3'));var db=require(_0xbd97('0x4'))['db'];var utils=require(_0xbd97('0x5'));var logger=require(_0xbd97('0x6'))('rpc');var config=require(_0xbd97('0x7'));var jayson=require(_0xbd97('0x8'));var client=jayson[_0xbd97('0x9')][_0xbd97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x228eb7,_0x4b6bd6,_0x4a21ed){return new BPromise(function(_0x317c8c,_0xf38720){return client[_0xbd97('0xb')](_0x228eb7,_0x4a21ed)['then'](function(_0xdbb3e9){logger[_0xbd97('0xc')](_0xbd97('0xd'),_0x4b6bd6,_0xbd97('0xe'));logger[_0xbd97('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4b6bd6,_0xbd97('0xe'),JSON['stringify'](_0xdbb3e9));if(_0xdbb3e9[_0xbd97('0x10')]){if(_0xdbb3e9['error'][_0xbd97('0x11')]===0x1f4){logger[_0xbd97('0x10')]('DeskField,\x20%s,\x20%s',_0x4b6bd6,_0xdbb3e9[_0xbd97('0x10')][_0xbd97('0x12')]);return _0xf38720(_0xdbb3e9[_0xbd97('0x10')][_0xbd97('0x12')]);}logger[_0xbd97('0x10')](_0xbd97('0xd'),_0x4b6bd6,_0xdbb3e9['error']['message']);return _0x317c8c(_0xdbb3e9[_0xbd97('0x10')][_0xbd97('0x12')]);}else{logger[_0xbd97('0xc')]('DeskField,\x20%s,\x20%s',_0x4b6bd6,_0xbd97('0xe'));_0x317c8c(_0xdbb3e9['result']['message']);}})[_0xbd97('0x13')](function(_0x1af1d0){logger[_0xbd97('0x10')](_0xbd97('0xd'),_0x4b6bd6,_0x1af1d0);_0xf38720(_0x1af1d0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1b0eca7..a6212e8 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 _0x02d1=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x2e3f7e,_0x519233){var _0x15834b=function(_0x116989){while(--_0x116989){_0x2e3f7e['push'](_0x2e3f7e['shift']());}};_0x15834b(++_0x519233);}(_0x02d1,0x94));var _0x102d=function(_0x37bf49,_0x45555c){_0x37bf49=_0x37bf49-0x0;var _0x323eee=_0x02d1[_0x37bf49];return _0x323eee;};'use strict';var multer=require('multer');var util=require(_0x102d('0x0'));var path=require(_0x102d('0x1'));var timeout=require('connect-timeout');var express=require(_0x102d('0x2'));var router=express[_0x102d('0x3')]();var fs_extra=require(_0x102d('0x4'));var auth=require(_0x102d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x102d('0x6'));router[_0x102d('0x7')]('/',auth[_0x102d('0x8')](),controller[_0x102d('0x9')]);router[_0x102d('0x7')](_0x102d('0xa'),auth[_0x102d('0x8')](),controller[_0x102d('0xb')]);router[_0x102d('0x7')](_0x102d('0xc'),auth['isAuthenticated'](),controller[_0x102d('0xd')]);router[_0x102d('0x7')](_0x102d('0xe'),auth[_0x102d('0x8')](),controller[_0x102d('0xf')]);router[_0x102d('0x10')]('/',auth[_0x102d('0x8')](),controller[_0x102d('0x11')]);router[_0x102d('0x10')](_0x102d('0xc'),auth[_0x102d('0x8')](),controller[_0x102d('0x12')]);router[_0x102d('0x13')](_0x102d('0xa'),auth[_0x102d('0x8')](),controller[_0x102d('0x14')]);router[_0x102d('0x15')](_0x102d('0xa'),auth['isAuthenticated'](),controller[_0x102d('0x16')]);module[_0x102d('0x17')]=router; \ No newline at end of file +var _0x70ec=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4f41bd,_0x1c2004){var _0x11a075=function(_0x130bf2){while(--_0x130bf2){_0x4f41bd['push'](_0x4f41bd['shift']());}};_0x11a075(++_0x1c2004);}(_0x70ec,0x149));var _0xc70e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x70ec[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xc70e('0x0'));var util=require(_0xc70e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc70e('0x2'));var router=express[_0xc70e('0x3')]();var fs_extra=require(_0xc70e('0x4'));var auth=require(_0xc70e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc70e('0x6'));var controller=require(_0xc70e('0x7'));router[_0xc70e('0x8')]('/',auth[_0xc70e('0x9')](),controller[_0xc70e('0xa')]);router['get'](_0xc70e('0xb'),auth[_0xc70e('0x9')](),controller[_0xc70e('0xc')]);router[_0xc70e('0x8')](_0xc70e('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc70e('0x8')](_0xc70e('0xe'),auth[_0xc70e('0x9')](),controller['getFields']);router[_0xc70e('0xf')]('/',auth[_0xc70e('0x9')](),controller[_0xc70e('0x10')]);router[_0xc70e('0xf')](_0xc70e('0xd'),auth[_0xc70e('0x9')](),controller[_0xc70e('0x11')]);router[_0xc70e('0x12')](_0xc70e('0xb'),auth[_0xc70e('0x9')](),controller['update']);router['delete'](_0xc70e('0xb'),auth[_0xc70e('0x9')](),controller[_0xc70e('0x13')]);module[_0xc70e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 0530699..33d9810 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 _0xbeea=['sequelize','STRING','BOOLEAN'];(function(_0x4824d4,_0x1bfad0){var _0x59026b=function(_0x46ee5d){while(--_0x46ee5d){_0x4824d4['push'](_0x4824d4['shift']());}};_0x59026b(++_0x1bfad0);}(_0xbeea,0xb1));var _0xabee=function(_0x69c9a6,_0x59bf4d){_0x69c9a6=_0x69c9a6-0x0;var _0x3fb1a2=_0xbeea[_0x69c9a6];return _0x3fb1a2;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')]},'username':{'type':Sequelize[_0xabee('0x1')]},'password':{'type':Sequelize[_0xabee('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xabee('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xabee('0x1')]},'serverUrl':{'type':Sequelize[_0xabee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xabee('0x1')]},'modernAuthentication':{'type':Sequelize[_0xabee('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0763=['sequelize','STRING','BOOLEAN'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0763,0x87));var _0x3076=function(_0x5b697a,_0x280202){_0x5b697a=_0x5b697a-0x0;var _0x5de43b=_0x0763[_0x5b697a];return _0x5de43b;};'use strict';var Sequelize=require(_0x3076('0x0'));module['exports']={'name':{'type':Sequelize[_0x3076('0x1')]},'username':{'type':Sequelize[_0x3076('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3076('0x1')]},'tenantId':{'type':Sequelize[_0x3076('0x1')]},'clientId':{'type':Sequelize[_0x3076('0x1')]},'clientSecret':{'type':Sequelize[_0x3076('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3076('0x1')]},'modernAuthentication':{'type':Sequelize[_0x3076('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 7b440a1..5f1ca66 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 _0x792f=['exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','CloudProvider','data7','modernAuthentication','access_token','data5','POST','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','forEach','@odata.type','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','push','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','Dynamics365Account','includeAll','include','findAll','keys','rawAttributes','find','catch','create','body','params','findOne','sort','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','description','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','escalatedon'];(function(_0x3dd89c,_0x67999e){var _0x174796=function(_0x3b6b1e){while(--_0x3b6b1e){_0x3dd89c['push'](_0x3dd89c['shift']());}};_0x174796(++_0x67999e);}(_0x792f,0x10e));var _0xf792=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x792f[_0x4b174a];return _0x3cd7bf;};'use strict';var rp=require('request-promise');var util=require(_0xf792('0x0'));var _=require(_0xf792('0x1'));var qs=require(_0xf792('0x2'));var logger=require(_0xf792('0x3'))(_0xf792('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf792('0x5'));function respondWithResult(_0x3a1312,_0x94202a){_0x94202a=_0x94202a||0xc8;return function(_0x531214){if(_0x531214){return _0x3a1312[_0xf792('0x6')](_0x94202a)[_0xf792('0x7')](_0x531214);}};}function respondWithFilteredResult(_0x357d6e,_0x3f7cdc){return function(_0x35634c){if(_0x35634c){var _0x48f50a=typeof _0x3f7cdc[_0xf792('0x8')]===_0xf792('0x9')&&typeof _0x3f7cdc[_0xf792('0xa')]===_0xf792('0x9');var _0x47603e=_0x35634c[_0xf792('0xb')];var _0x3feefa=_0x48f50a?0x0:_0x3f7cdc[_0xf792('0x8')];var _0x213aac=_0x48f50a?_0x35634c[_0xf792('0xb')]:_0x3f7cdc[_0xf792('0x8')]+_0x3f7cdc['limit'];var _0x47ff16;if(_0x213aac>=_0x47603e){_0x213aac=_0x47603e;_0x47ff16=0xc8;}else{_0x47ff16=0xce;}_0x357d6e[_0xf792('0x6')](_0x47ff16);return _0x357d6e[_0xf792('0xc')](_0xf792('0xd'),_0x3feefa+'-'+_0x213aac+'/'+_0x47603e)['json'](_0x35634c);}return null;};}function saveUpdates(_0x2482e2){return function(_0xe7439c){if(_0xe7439c){return _0xe7439c[_0xf792('0xe')](_0x2482e2)[_0xf792('0xf')](function(_0x5bf1e9){return _0x5bf1e9;});}return null;};}function removeEntity(_0x5bfde8){return function(_0x53a1a0){if(_0x53a1a0){return _0x53a1a0['destroy']()[_0xf792('0xf')](function(){_0x5bfde8[_0xf792('0x6')](0xcc)[_0xf792('0x10')]();});}};}function handleEntityNotFound(_0x5d7498){return function(_0x3c79f9){if(!_0x3c79f9){_0x5d7498[_0xf792('0x11')](0x194);}return _0x3c79f9;};}function handleError(_0x1e01c3,_0x45a663){_0x45a663=_0x45a663||0x1f4;return function(_0x2e8811){logger[_0xf792('0x12')](_0x2e8811[_0xf792('0x13')]);if(_0x2e8811[_0xf792('0x14')]){delete _0x2e8811[_0xf792('0x14')];}_0x1e01c3[_0xf792('0x6')](_0x45a663)['send'](_0x2e8811);};}exports[_0xf792('0x15')]=function(_0x29289c,_0x4c03cb){var _0x52907f={},_0x3acb87={},_0x53e52e={'count':0x0,'rows':[]};var _0x2710fc=_[_0xf792('0x16')](db['Dynamics365Account']['rawAttributes'],function(_0x2145db){return{'name':_0x2145db[_0xf792('0x17')],'type':_0x2145db[_0xf792('0x18')][_0xf792('0x19')]};});_0x3acb87[_0xf792('0x1a')]=_[_0xf792('0x16')](_0x2710fc,_0xf792('0x14'));_0x3acb87[_0xf792('0x1b')]=_['keys'](_0x29289c[_0xf792('0x1b')]);_0x3acb87[_0xf792('0x1c')]=_[_0xf792('0x1d')](_0x3acb87['model'],_0x3acb87[_0xf792('0x1b')]);_0x52907f[_0xf792('0x1e')]=_['intersection'](_0x3acb87[_0xf792('0x1a')],qs[_0xf792('0x1f')](_0x29289c[_0xf792('0x1b')][_0xf792('0x1f')]));_0x52907f['attributes']=_0x52907f[_0xf792('0x1e')][_0xf792('0x20')]?_0x52907f[_0xf792('0x1e')]:_0x3acb87[_0xf792('0x1a')];if(!_0x29289c[_0xf792('0x1b')][_0xf792('0x21')](_0xf792('0x22'))){_0x52907f[_0xf792('0xa')]=qs['limit'](_0x29289c[_0xf792('0x1b')]['limit']);_0x52907f['offset']=qs[_0xf792('0x8')](_0x29289c['query'][_0xf792('0x8')]);}_0x52907f[_0xf792('0x23')]=qs['sort'](_0x29289c[_0xf792('0x1b')]['sort']);_0x52907f[_0xf792('0x24')]=qs[_0xf792('0x1c')](_['pick'](_0x29289c[_0xf792('0x1b')],_0x3acb87['filters']),_0x2710fc);if(_0x29289c[_0xf792('0x1b')][_0xf792('0x25')]){_0x52907f[_0xf792('0x24')]=_['merge'](_0x52907f[_0xf792('0x24')],{'$or':_[_0xf792('0x16')](_0x2710fc,function(_0x5ba34b){if(_0x5ba34b[_0xf792('0x18')]!==_0xf792('0x26')){var _0x9e72c6={};_0x9e72c6[_0x5ba34b[_0xf792('0x14')]]={'$like':'%'+_0x29289c[_0xf792('0x1b')][_0xf792('0x25')]+'%'};return _0x9e72c6;}})});}_0x52907f=_[_0xf792('0x27')]({},_0x52907f,_0x29289c[_0xf792('0x28')]);var _0x244622={'where':_0x52907f['where']};return db[_0xf792('0x29')][_0xf792('0xb')](_0x244622)['then'](function(_0x23706b){_0x53e52e[_0xf792('0xb')]=_0x23706b;if(_0x29289c[_0xf792('0x1b')][_0xf792('0x2a')]){_0x52907f[_0xf792('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xf792('0x2c')](_0x52907f);})[_0xf792('0xf')](function(_0x31f899){_0x53e52e['rows']=_0x31f899;return _0x53e52e;})[_0xf792('0xf')](respondWithFilteredResult(_0x4c03cb,_0x52907f))['catch'](handleError(_0x4c03cb,null));};exports['show']=function(_0x11b1f3,_0x32840f){var _0x532ad2={'raw':![],'where':{'id':_0x11b1f3['params']['id']}},_0x16af97={};_0x16af97[_0xf792('0x1a')]=_[_0xf792('0x2d')](db[_0xf792('0x29')][_0xf792('0x2e')]);_0x16af97[_0xf792('0x1b')]=_[_0xf792('0x2d')](_0x11b1f3['query']);_0x16af97[_0xf792('0x1c')]=_[_0xf792('0x1d')](_0x16af97['model'],_0x16af97[_0xf792('0x1b')]);_0x532ad2[_0xf792('0x1e')]=_[_0xf792('0x1d')](_0x16af97[_0xf792('0x1a')],qs[_0xf792('0x1f')](_0x11b1f3[_0xf792('0x1b')][_0xf792('0x1f')]));_0x532ad2[_0xf792('0x1e')]=_0x532ad2[_0xf792('0x1e')][_0xf792('0x20')]?_0x532ad2[_0xf792('0x1e')]:_0x16af97[_0xf792('0x1a')];if(_0x11b1f3[_0xf792('0x1b')]['includeAll']){_0x532ad2[_0xf792('0x2b')]=[{'all':!![]}];}_0x532ad2=_['merge']({},_0x532ad2,_0x11b1f3['options']);return db['Dynamics365Account'][_0xf792('0x2f')](_0x532ad2)['then'](handleEntityNotFound(_0x32840f,null))[_0xf792('0xf')](respondWithResult(_0x32840f,null))[_0xf792('0x30')](handleError(_0x32840f,null));};exports[_0xf792('0x31')]=function(_0x533528,_0x13ccda){return db[_0xf792('0x29')]['create'](_0x533528[_0xf792('0x32')],{})[_0xf792('0xf')](respondWithResult(_0x13ccda,0xc9))[_0xf792('0x30')](handleError(_0x13ccda,null));};exports[_0xf792('0xe')]=function(_0x5c54db,_0x17ed3a){if(_0x5c54db[_0xf792('0x32')]['id']){delete _0x5c54db[_0xf792('0x32')]['id'];}return db[_0xf792('0x29')][_0xf792('0x2f')]({'where':{'id':_0x5c54db[_0xf792('0x33')]['id']}})[_0xf792('0xf')](handleEntityNotFound(_0x17ed3a,null))[_0xf792('0xf')](saveUpdates(_0x5c54db['body'],null))[_0xf792('0xf')](respondWithResult(_0x17ed3a,null))[_0xf792('0x30')](handleError(_0x17ed3a,null));};exports['destroy']=function(_0x34256c,_0x23bff2){return db[_0xf792('0x29')]['find']({'where':{'id':_0x34256c[_0xf792('0x33')]['id']}})[_0xf792('0xf')](handleEntityNotFound(_0x23bff2,null))[_0xf792('0xf')](removeEntity(_0x23bff2,null))['catch'](handleError(_0x23bff2,null));};exports['getConfigurations']=function(_0x398872,_0x59b683){var _0x7b58e={};var _0x461349={};var _0x23a8dc;var _0x5b645b;return db['Dynamics365Account'][_0xf792('0x34')]({'where':{'id':_0x398872[_0xf792('0x33')]['id']}})[_0xf792('0xf')](handleEntityNotFound(_0x59b683,null))[_0xf792('0xf')](function(_0x5831b3){if(_0x5831b3){_0x23a8dc=_0x5831b3;_0x461349[_0xf792('0x1a')]=_[_0xf792('0x2d')](db['Dynamics365Configuration'][_0xf792('0x2e')]);_0x461349['query']=_['keys'](_0x398872[_0xf792('0x1b')]);_0x461349['filters']=_['intersection'](_0x461349[_0xf792('0x1a')],_0x461349[_0xf792('0x1b')]);_0x7b58e[_0xf792('0x1e')]=_['intersection'](_0x461349['model'],qs['fields'](_0x398872[_0xf792('0x1b')][_0xf792('0x1f')]));_0x7b58e[_0xf792('0x1e')]=_0x7b58e[_0xf792('0x1e')][_0xf792('0x20')]?_0x7b58e[_0xf792('0x1e')]:_0x461349[_0xf792('0x1a')];_0x7b58e[_0xf792('0x23')]=qs[_0xf792('0x35')](_0x398872[_0xf792('0x1b')][_0xf792('0x35')]);_0x7b58e[_0xf792('0x24')]=qs[_0xf792('0x1c')](_[_0xf792('0x36')](_0x398872['query'],_0x461349['filters']));if(_0x398872[_0xf792('0x1b')][_0xf792('0x25')]){_0x7b58e[_0xf792('0x24')]=_['merge'](_0x7b58e[_0xf792('0x24')],{'$or':_[_0xf792('0x16')](_0x7b58e['attributes'],function(_0x27d119){var _0x170b2b={};_0x170b2b[_0x27d119]={'$like':'%'+_0x398872[_0xf792('0x1b')][_0xf792('0x25')]+'%'};return _0x170b2b;})});}_0x7b58e=_[_0xf792('0x27')]({},_0x7b58e,_0x398872['options']);return _0x23a8dc['getConfigurations'](_0x7b58e);}})[_0xf792('0xf')](function(_0x559329){if(_0x559329){_0x5b645b=_0x559329[_0xf792('0x20')];if(!_0x398872[_0xf792('0x1b')][_0xf792('0x21')](_0xf792('0x22'))){_0x7b58e[_0xf792('0xa')]=qs[_0xf792('0xa')](_0x398872[_0xf792('0x1b')][_0xf792('0xa')]);_0x7b58e['offset']=qs[_0xf792('0x8')](_0x398872[_0xf792('0x1b')]['offset']);}return _0x23a8dc[_0xf792('0x37')](_0x7b58e);}})[_0xf792('0xf')](function(_0x9dcbfe){if(_0x9dcbfe){return _0x9dcbfe?{'count':_0x5b645b,'rows':_0x9dcbfe}:null;}})[_0xf792('0xf')](respondWithResult(_0x59b683,null))[_0xf792('0x30')](handleError(_0x59b683,null));};exports['addConfiguration']=function(_0x526212,_0x17d7f0){if(_0x526212[_0xf792('0x32')]['id']){delete _0x526212[_0xf792('0x32')]['id'];}return db['Dynamics365Account'][_0xf792('0x34')]({'where':{'id':_0x526212[_0xf792('0x33')]['id']}})[_0xf792('0xf')](handleEntityNotFound(_0x17d7f0,null))[_0xf792('0xf')](function(_0x3f25cd){if(_0x3f25cd){_0x526212[_0xf792('0x32')][_0xf792('0x38')]=_0x3f25cd['id'];_0x526212['body'][_0xf792('0x39')]=integrations[_0xf792('0x3a')](_0x526212[_0xf792('0x32')][_0xf792('0x3b')],_0x526212['body'][_0xf792('0x18')]);_0x526212[_0xf792('0x32')]['Descriptions']=integrations[_0xf792('0x3c')](_0x526212[_0xf792('0x32')][_0xf792('0x3b')],_0x526212[_0xf792('0x32')][_0xf792('0x18')]);return db[_0xf792('0x3d')][_0xf792('0x31')](_0x526212[_0xf792('0x32')],{'include':[{'model':db[_0xf792('0x3e')],'as':_0xf792('0x39')},{'model':db[_0xf792('0x3e')],'as':_0xf792('0x3f')}]});}return null;})[_0xf792('0xf')](respondWithResult(_0x17d7f0,null))[_0xf792('0x30')](handleError(_0x17d7f0,null));};function sanitizeRemoteUri(_0x3eb4d3){var _0x470207=_0x3eb4d3[_0xf792('0x40')](-0x1);if(_0x470207==='/')return _0x3eb4d3[_0xf792('0x41')](0x0,_0x3eb4d3[_0xf792('0x42')](_0x470207));return _0x3eb4d3;}function getWebApiUrl(_0x25f10b){return util[_0xf792('0x43')](_0xf792('0x44'),_0x25f10b);}exports[_0xf792('0x45')]=function(_0x487d65,_0x8931fb){var _0x4e07e1=_0x487d65[_0xf792('0x1b')][_0xf792('0x46')];var _0x2d80d9=_0x4e07e1==='incident'?_0xf792('0x47'):_0xf792('0x48');var _0x364768='';var _0x595a2a='';var _0x6954c8='';var _0x3b19f1='';var _0x5324e6='';var _0x23f9df='';var _0x4b8b8e='';var _0x1b8c71='';var _0x43bfe3=[_0xf792('0x49'),_0xf792('0x4a'),'customerid','ownerid','caseorigincode',_0xf792('0x4b'),_0xf792('0x4c'),'regardingobjectid',_0xf792('0x4d'),_0xf792('0x4e')];var _0x962c44=[_0xf792('0x4f'),_0xf792('0x50'),'actualserviceunits',_0xf792('0x51'),_0xf792('0x52'),'contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname',_0xf792('0x53'),_0xf792('0x54'),_0xf792('0x55'),_0xf792('0x56'),_0xf792('0x57'),_0xf792('0x58'),_0xf792('0x59'),_0xf792('0x5a'),'customeridyominame',_0xf792('0x5b'),'entitlementidname',_0xf792('0x5c'),'entityimage_url',_0xf792('0x5d'),_0xf792('0x5e'),_0xf792('0x5f'),'followupby',_0xf792('0x60'),_0xf792('0x61'),_0xf792('0x62'),_0xf792('0x63'),'masteridname',_0xf792('0x64'),_0xf792('0x65'),'modifiedbyname',_0xf792('0x66'),_0xf792('0x67'),_0xf792('0x68'),_0xf792('0x69'),'msdyn_incidenttypename','msdyn_iotalertname',_0xf792('0x6a'),_0xf792('0x6b'),_0xf792('0x6c'),'owneridname','owneridtype','owneridyominame',_0xf792('0x6d'),_0xf792('0x6e'),'primarycontactidyominame',_0xf792('0x6f'),_0xf792('0x70'),_0xf792('0x71'),_0xf792('0x72'),'resolvebykpiidname',_0xf792('0x73'),'responsiblecontactidname','responsiblecontactidyominame',_0xf792('0x74'),'slainvokedidname',_0xf792('0x75'),_0xf792('0x76'),_0xf792('0x77'),_0xf792('0x78'),_0xf792('0x79'),_0xf792('0x7a'),_0xf792('0x7b'),_0xf792('0x7c'),_0xf792('0x7d'),_0xf792('0x7e'),_0xf792('0x7f')];var _0x5f5412=_0x43bfe3[_0xf792('0x80')](_0x962c44);return db['Dynamics365Account']['findOne']({'where':{'id':_0x487d65[_0xf792('0x33')]['id']},'attributes':['id',_0xf792('0x81'),_0xf792('0x82'),_0xf792('0x83'),'tenantId',_0xf792('0x84'),_0xf792('0x85'),'modernAuthentication'],'include':[{'model':db[_0xf792('0x86')],'as':'CloudProvider','attributes':['id','data5',_0xf792('0x87')]}]})[_0xf792('0xf')](handleEntityNotFound(_0x8931fb,null))[_0xf792('0xf')](function(_0x41eb42){if(_0x41eb42){if(_0x41eb42[_0xf792('0x88')]){_0x41eb42[_0xf792('0x89')]=_0x41eb42[_0xf792('0x86')][_0xf792('0x8a')];_0x1b8c71=sanitizeRemoteUri(_0x41eb42[_0xf792('0x86')][_0xf792('0x87')]);_0x4b8b8e=getWebApiUrl(_0x1b8c71);return _0x41eb42;}_0x1b8c71=sanitizeRemoteUri(_0x41eb42[_0xf792('0x83')]);_0x4b8b8e=getWebApiUrl(_0x1b8c71);var _0x13fe18={'method':_0xf792('0x8b'),'uri':'https://login.microsoftonline.com/'+_0x41eb42['tenantId']+_0xf792('0x8c'),'form':{'client_id':_0x41eb42[_0xf792('0x84')],'resource':_0x1b8c71,'username':_0x41eb42[_0xf792('0x81')],'password':_0x41eb42[_0xf792('0x82')],'grant_type':_0xf792('0x82'),'client_secret':_0x41eb42[_0xf792('0x85')]},'json':!![]};return rp(_0x13fe18);}})['then'](function(_0x54d5fc){_0x23f9df=_0x54d5fc[_0xf792('0x89')];var _0x162db5={'method':'GET','uri':encodeURI(_0x4b8b8e+_0xf792('0x8d')+_0x2d80d9+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x23f9df,'If-None-Match':null,'OData-Version':_0xf792('0x8e')},'json':!![]};return rp(_0x162db5);})[_0xf792('0xf')](function(_0x40ace2){var _0x3deb98=_0x40ace2[_0xf792('0x8f')][0x0];var _0x2c4011=_0x3deb98[_0xf792('0x90')];var _0x429f7d={'method':_0xf792('0x91'),'uri':_0x4b8b8e+_0xf792('0x92')+_0x2c4011+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf792('0x93')+_0x23f9df,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x429f7d);})[_0xf792('0xf')](function(_0x13af8c){_0x364768=_0x13af8c;_0x595a2a=_0x364768[_0xf792('0x94')];_0x595a2a=_[_0xf792('0x95')](_0x595a2a,function(_0x3be662){return!_0x5f5412[_0xf792('0x96')](_0x3be662['LogicalName']);});var _0x1caaea=[];var _0x47e117=[];_0x595a2a[_0xf792('0x97')](function(_0x29fc57){if(_0x29fc57['@odata.type']){var _0x4f30d9=_0x29fc57[_0xf792('0x98')][_0xf792('0x41')](_0x29fc57['@odata.type'][_0xf792('0x42')]('.')+0x1);if(_0x4f30d9==='PicklistAttributeMetadata'){_0x1caaea['push'](getSelectList(_0x4b8b8e,_0x4e07e1,_0x47e117,_0x364768['MetadataId'],_0x29fc57[_0xf792('0x90')],_0x23f9df));}}});return Promise[_0xf792('0x99')](_0x1caaea);})[_0xf792('0xf')](function(_0x452add){_0x6954c8=_0x452add[0x0];var _0x1857a5=[];var _0x1bcfdb=[];_0x595a2a[_0xf792('0x97')](function(_0x4ff6cd){if(!_[_0xf792('0x9a')](_0x4ff6cd[_0xf792('0x98')])){var _0xceb003=_0x4ff6cd[_0xf792('0x98')][_0xf792('0x41')](_0x4ff6cd[_0xf792('0x98')][_0xf792('0x42')]('.')+0x1);if(_0xceb003==='BooleanAttributeMetadata'){_0x1857a5['push'](getBooleanList(_0x4b8b8e,_0x4e07e1,_0x1bcfdb,_0x364768[_0xf792('0x90')],_0x4ff6cd['MetadataId'],_0x23f9df));}}});return Promise[_0xf792('0x99')](_0x1857a5);})[_0xf792('0xf')](function(_0x167960){_0x3b19f1=_0x167960[0x0];var _0x3abecd=[];var _0x2d103a=[];_0x595a2a['forEach'](function(_0x3eb4ed){if(_0x3eb4ed['@odata.type']){var _0x58dcee=_0x3eb4ed['@odata.type'][_0xf792('0x41')](_0x3eb4ed[_0xf792('0x98')][_0xf792('0x42')]('.')+0x1);if(_0x58dcee===_0xf792('0x9b')||_0x58dcee===_0xf792('0x9c')||_0x58dcee===_0xf792('0x9d')||_0x58dcee==='IntegerAttributeMetadata'||_0x58dcee===_0xf792('0x9e')||_0x58dcee===_0xf792('0x9f')||_0x58dcee===_0xf792('0xa0')||_0x58dcee==='EntityNameAttributeMetadata'||_0x58dcee===_0xf792('0xa1')||_0x58dcee==='DecimalAttributeMetadata'){_0x3abecd[_0xf792('0xa2')](getInputList(_0x4b8b8e,_0x4e07e1,_0x58dcee,_0x2d103a,_0x364768['MetadataId'],_0x3eb4ed[_0xf792('0x90')],_0x23f9df));}}});return Promise[_0xf792('0x99')](_0x3abecd);})[_0xf792('0xf')](function(_0x4b6930){_0x5324e6=_0x4b6930[0x0];var _0x5c9609=_0x6954c8[_0xf792('0x80')](_0x3b19f1)[_0xf792('0x80')](_0x5324e6);var _0xc345a6={'count':_0x5c9609['length'],'rows':_0x5c9609};return _0xc345a6;})[_0xf792('0xf')](respondWithResult(_0x8931fb,null))[_0xf792('0x30')](function(_0x184743){var _0x2ef881=_0x487d65[_0xf792('0x1b')][_0xf792('0xa3')]?0x1f4:_0x184743[_0xf792('0xa4')]||0x1f4;logger[_0xf792('0x12')](_0x184743[_0xf792('0x13')]);delete _0x184743[_0xf792('0x14')];if(_0x2ef881===0x191){_0x2ef881=0x190;}_0x8931fb['status'](_0x2ef881)['send'](_0x487d65[_0xf792('0x1b')][_0xf792('0xa3')]?{'message':_0xf792('0xa5'),'statusCode':_0x184743[_0xf792('0xa4')]}:_0x184743);});};function getSelectList(_0x17a384,_0x461206,_0x4dbf6c,_0xee0eec,_0x56d546,_0x154402){var _0x219e63={'method':_0xf792('0x91'),'uri':_0x17a384+'EntityDefinitions('+_0xee0eec+_0xf792('0xa6')+_0x56d546+_0xf792('0xa7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x154402,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x219e63)[_0xf792('0xf')](function(_0x232712){var _0x8d5028=[];var _0x2bfc10=_0x232712[_0xf792('0xa8')][_0xf792('0xa9')];_0x2bfc10[_0xf792('0x97')](function(_0xb69a6f){_0x8d5028[_0xf792('0xa2')]({'name':_0xb69a6f[_0xf792('0xaa')][_0xf792('0xab')][_0xf792('0xaa')],'value':String(_0xb69a6f[_0xf792('0xac')])});});var _0x3025d1={'id':_0x461206+'_'+_0x232712['LogicalName'],'name':_0x232712[_0xf792('0xad')][_0xf792('0xab')]['Label'],'custom':![],'options':_0x8d5028};_0x4dbf6c['push'](_0x3025d1);return _0x4dbf6c;});}function getBooleanList(_0x2638e9,_0x3babd8,_0x2e36a2,_0x368c01,_0xe6fd50,_0x10d4e6){var _0x33db31={'method':_0xf792('0x91'),'uri':_0x2638e9+_0xf792('0x92')+_0x368c01+_0xf792('0xa6')+_0xe6fd50+_0xf792('0xae'),'headers':{'Authorization':_0xf792('0x93')+_0x10d4e6,'If-None-Match':null,'OData-Version':_0xf792('0x8e')},'json':!![]};return rp(_0x33db31)[_0xf792('0xf')](function(_0x42896c){var _0x35a76c=[];_0x35a76c[_0xf792('0xa2')]({'name':_0x42896c['OptionSet'][_0xf792('0xaf')][_0xf792('0xaa')][_0xf792('0xab')][_0xf792('0xaa')],'value':_0xf792('0xb0')},{'name':_0x42896c[_0xf792('0xa8')][_0xf792('0xb1')][_0xf792('0xaa')][_0xf792('0xab')][_0xf792('0xaa')],'value':_0xf792('0xb2')});var _0x5c8e9e={'id':_0x3babd8+'_'+_0x42896c[_0xf792('0xb3')],'name':_0x42896c[_0xf792('0xad')]['UserLocalizedLabel'][_0xf792('0xaa')],'custom':![],'options':_0x35a76c};_0x2e36a2[_0xf792('0xa2')](_0x5c8e9e);return _0x2e36a2;});}function getInputList(_0x300fd9,_0x57e7fe,_0x5c2740,_0x26b964,_0x51cda6,_0x21530e,_0x51145a){var _0x23e3b0={'method':_0xf792('0x91'),'uri':_0x300fd9+_0xf792('0x92')+_0x51cda6+')/Attributes('+_0x21530e+_0xf792('0xb4')+_0x5c2740+_0xf792('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x51145a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23e3b0)['then'](function(_0x2960a5){var _0xa33c59={'id':_0x57e7fe+'_'+_0x2960a5[_0xf792('0xb3')],'name':_0x2960a5[_0xf792('0xad')][_0xf792('0xab')]?_0x2960a5[_0xf792('0xad')][_0xf792('0xab')]['Label']:_0x2960a5[_0xf792('0xb3')],'custom':![],'options':[]};_0x26b964[_0xf792('0xa2')](_0xa33c59);return _0x26b964;});} \ No newline at end of file +var _0x9802=['description','customerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','sentimentvalue','slainvokedidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','GET','EntityDefinitions(','includes','forEach','PicklistAttributeMetadata','push','MetadataId','all','@odata.type','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','OptionSet','Label','UserLocalizedLabel','DisplayName',')/Attributes(','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','limit','status','set','then','destroy','end','sendStatus','error','stack','name','Dynamics365Account','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','include','create','body','update','find','getConfigurations','findOne','map','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','getFields','Incident','PhoneCall','title'];(function(_0x34efe5,_0x26be46){var _0x3d5783=function(_0x582721){while(--_0x582721){_0x34efe5['push'](_0x34efe5['shift']());}};_0x3d5783(++_0x26be46);}(_0x9802,0x112));var _0x2980=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x9802[_0x4a747d];return _0x3a5b5c;};'use strict';var rp=require(_0x2980('0x0'));var util=require('util');var _=require('lodash');var qs=require(_0x2980('0x1'));var logger=require('../../config/logger')(_0x2980('0x2'));var db=require(_0x2980('0x3'))['db'];var integrations=require(_0x2980('0x4'));function respondWithResult(_0x46b7f9,_0x48880a){_0x48880a=_0x48880a||0xc8;return function(_0x2ca81b){if(_0x2ca81b){return _0x46b7f9['status'](_0x48880a)[_0x2980('0x5')](_0x2ca81b);}};}function respondWithFilteredResult(_0x5ad3e7,_0x4981d9){return function(_0x1c4375){if(_0x1c4375){var _0x5ff778=typeof _0x4981d9[_0x2980('0x6')]===_0x2980('0x7')&&typeof _0x4981d9['limit']===_0x2980('0x7');var _0x151b7b=_0x1c4375['count'];var _0x5baeb9=_0x5ff778?0x0:_0x4981d9[_0x2980('0x6')];var _0xb86a11=_0x5ff778?_0x1c4375[_0x2980('0x8')]:_0x4981d9[_0x2980('0x6')]+_0x4981d9[_0x2980('0x9')];var _0x292730;if(_0xb86a11>=_0x151b7b){_0xb86a11=_0x151b7b;_0x292730=0xc8;}else{_0x292730=0xce;}_0x5ad3e7[_0x2980('0xa')](_0x292730);return _0x5ad3e7[_0x2980('0xb')]('Content-Range',_0x5baeb9+'-'+_0xb86a11+'/'+_0x151b7b)[_0x2980('0x5')](_0x1c4375);}return null;};}function saveUpdates(_0x9345c1){return function(_0x2152a7){if(_0x2152a7){return _0x2152a7['update'](_0x9345c1)[_0x2980('0xc')](function(_0x4a44e6){return _0x4a44e6;});}return null;};}function removeEntity(_0x376952){return function(_0x3e1c51){if(_0x3e1c51){return _0x3e1c51[_0x2980('0xd')]()['then'](function(){_0x376952[_0x2980('0xa')](0xcc)[_0x2980('0xe')]();});}};}function handleEntityNotFound(_0x53593c){return function(_0x10474a){if(!_0x10474a){_0x53593c[_0x2980('0xf')](0x194);}return _0x10474a;};}function handleError(_0x373185,_0x21ff2b){_0x21ff2b=_0x21ff2b||0x1f4;return function(_0x34bf51){logger[_0x2980('0x10')](_0x34bf51[_0x2980('0x11')]);if(_0x34bf51[_0x2980('0x12')]){delete _0x34bf51[_0x2980('0x12')];}_0x373185[_0x2980('0xa')](_0x21ff2b)['send'](_0x34bf51);};}exports['index']=function(_0x53e529,_0x135904){var _0x176743={},_0xb85f82={},_0x29517b={'count':0x0,'rows':[]};var _0x1baea6=_['map'](db[_0x2980('0x13')][_0x2980('0x14')],function(_0x5cd6c3){return{'name':_0x5cd6c3['fieldName'],'type':_0x5cd6c3[_0x2980('0x15')]['key']};});_0xb85f82[_0x2980('0x16')]=_['map'](_0x1baea6,_0x2980('0x12'));_0xb85f82[_0x2980('0x17')]=_['keys'](_0x53e529[_0x2980('0x17')]);_0xb85f82[_0x2980('0x18')]=_[_0x2980('0x19')](_0xb85f82[_0x2980('0x16')],_0xb85f82[_0x2980('0x17')]);_0x176743[_0x2980('0x1a')]=_[_0x2980('0x19')](_0xb85f82[_0x2980('0x16')],qs[_0x2980('0x1b')](_0x53e529[_0x2980('0x17')][_0x2980('0x1b')]));_0x176743[_0x2980('0x1a')]=_0x176743[_0x2980('0x1a')][_0x2980('0x1c')]?_0x176743['attributes']:_0xb85f82[_0x2980('0x16')];if(!_0x53e529[_0x2980('0x17')]['hasOwnProperty'](_0x2980('0x1d'))){_0x176743[_0x2980('0x9')]=qs['limit'](_0x53e529['query'][_0x2980('0x9')]);_0x176743[_0x2980('0x6')]=qs['offset'](_0x53e529[_0x2980('0x17')][_0x2980('0x6')]);}_0x176743[_0x2980('0x1e')]=qs[_0x2980('0x1f')](_0x53e529[_0x2980('0x17')]['sort']);_0x176743[_0x2980('0x20')]=qs[_0x2980('0x18')](_[_0x2980('0x21')](_0x53e529['query'],_0xb85f82['filters']),_0x1baea6);if(_0x53e529[_0x2980('0x17')]['filter']){_0x176743[_0x2980('0x20')]=_[_0x2980('0x22')](_0x176743[_0x2980('0x20')],{'$or':_['map'](_0x1baea6,function(_0x3602c7){if(_0x3602c7[_0x2980('0x15')]!==_0x2980('0x23')){var _0x26178c={};_0x26178c[_0x3602c7[_0x2980('0x12')]]={'$like':'%'+_0x53e529[_0x2980('0x17')][_0x2980('0x24')]+'%'};return _0x26178c;}})});}_0x176743=_['merge']({},_0x176743,_0x53e529[_0x2980('0x25')]);var _0x37bc2c={'where':_0x176743[_0x2980('0x20')]};return db[_0x2980('0x13')][_0x2980('0x8')](_0x37bc2c)['then'](function(_0x2298d7){_0x29517b[_0x2980('0x8')]=_0x2298d7;if(_0x53e529[_0x2980('0x17')][_0x2980('0x26')]){_0x176743['include']=[{'all':!![]}];}return db[_0x2980('0x13')][_0x2980('0x27')](_0x176743);})[_0x2980('0xc')](function(_0x24bc0b){_0x29517b['rows']=_0x24bc0b;return _0x29517b;})['then'](respondWithFilteredResult(_0x135904,_0x176743))[_0x2980('0x28')](handleError(_0x135904,null));};exports[_0x2980('0x29')]=function(_0x38ef58,_0x418d56){var _0x3bae91={'raw':![],'where':{'id':_0x38ef58[_0x2980('0x2a')]['id']}},_0x3ec664={};_0x3ec664[_0x2980('0x16')]=_[_0x2980('0x2b')](db['Dynamics365Account'][_0x2980('0x14')]);_0x3ec664[_0x2980('0x17')]=_['keys'](_0x38ef58[_0x2980('0x17')]);_0x3ec664[_0x2980('0x18')]=_[_0x2980('0x19')](_0x3ec664[_0x2980('0x16')],_0x3ec664[_0x2980('0x17')]);_0x3bae91[_0x2980('0x1a')]=_[_0x2980('0x19')](_0x3ec664['model'],qs[_0x2980('0x1b')](_0x38ef58[_0x2980('0x17')][_0x2980('0x1b')]));_0x3bae91[_0x2980('0x1a')]=_0x3bae91['attributes'][_0x2980('0x1c')]?_0x3bae91[_0x2980('0x1a')]:_0x3ec664[_0x2980('0x16')];if(_0x38ef58[_0x2980('0x17')][_0x2980('0x26')]){_0x3bae91[_0x2980('0x2c')]=[{'all':!![]}];}_0x3bae91=_[_0x2980('0x22')]({},_0x3bae91,_0x38ef58[_0x2980('0x25')]);return db[_0x2980('0x13')]['find'](_0x3bae91)[_0x2980('0xc')](handleEntityNotFound(_0x418d56,null))['then'](respondWithResult(_0x418d56,null))['catch'](handleError(_0x418d56,null));};exports[_0x2980('0x2d')]=function(_0x207c76,_0x5f422b){return db[_0x2980('0x13')][_0x2980('0x2d')](_0x207c76[_0x2980('0x2e')],{})[_0x2980('0xc')](respondWithResult(_0x5f422b,0xc9))['catch'](handleError(_0x5f422b,null));};exports[_0x2980('0x2f')]=function(_0x16525f,_0x45eeb7){if(_0x16525f['body']['id']){delete _0x16525f['body']['id'];}return db['Dynamics365Account'][_0x2980('0x30')]({'where':{'id':_0x16525f[_0x2980('0x2a')]['id']}})[_0x2980('0xc')](handleEntityNotFound(_0x45eeb7,null))[_0x2980('0xc')](saveUpdates(_0x16525f[_0x2980('0x2e')],null))['then'](respondWithResult(_0x45eeb7,null))[_0x2980('0x28')](handleError(_0x45eeb7,null));};exports['destroy']=function(_0x30e4d4,_0x212482){return db[_0x2980('0x13')][_0x2980('0x30')]({'where':{'id':_0x30e4d4[_0x2980('0x2a')]['id']}})[_0x2980('0xc')](handleEntityNotFound(_0x212482,null))[_0x2980('0xc')](removeEntity(_0x212482,null))[_0x2980('0x28')](handleError(_0x212482,null));};exports[_0x2980('0x31')]=function(_0x38bb43,_0x45de0e){var _0x1e6232={};var _0x21b9ac={};var _0xc22fcb;var _0x3d3e96;return db[_0x2980('0x13')][_0x2980('0x32')]({'where':{'id':_0x38bb43[_0x2980('0x2a')]['id']}})[_0x2980('0xc')](handleEntityNotFound(_0x45de0e,null))[_0x2980('0xc')](function(_0x485d2d){if(_0x485d2d){_0xc22fcb=_0x485d2d;_0x21b9ac['model']=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x21b9ac[_0x2980('0x17')]=_[_0x2980('0x2b')](_0x38bb43[_0x2980('0x17')]);_0x21b9ac[_0x2980('0x18')]=_[_0x2980('0x19')](_0x21b9ac[_0x2980('0x16')],_0x21b9ac[_0x2980('0x17')]);_0x1e6232[_0x2980('0x1a')]=_[_0x2980('0x19')](_0x21b9ac[_0x2980('0x16')],qs[_0x2980('0x1b')](_0x38bb43[_0x2980('0x17')][_0x2980('0x1b')]));_0x1e6232[_0x2980('0x1a')]=_0x1e6232[_0x2980('0x1a')][_0x2980('0x1c')]?_0x1e6232['attributes']:_0x21b9ac['model'];_0x1e6232[_0x2980('0x1e')]=qs[_0x2980('0x1f')](_0x38bb43['query'][_0x2980('0x1f')]);_0x1e6232[_0x2980('0x20')]=qs[_0x2980('0x18')](_[_0x2980('0x21')](_0x38bb43[_0x2980('0x17')],_0x21b9ac[_0x2980('0x18')]));if(_0x38bb43['query']['filter']){_0x1e6232['where']=_[_0x2980('0x22')](_0x1e6232[_0x2980('0x20')],{'$or':_[_0x2980('0x33')](_0x1e6232[_0x2980('0x1a')],function(_0x4285f9){var _0x5415c6={};_0x5415c6[_0x4285f9]={'$like':'%'+_0x38bb43[_0x2980('0x17')][_0x2980('0x24')]+'%'};return _0x5415c6;})});}_0x1e6232=_['merge']({},_0x1e6232,_0x38bb43[_0x2980('0x25')]);return _0xc22fcb[_0x2980('0x31')](_0x1e6232);}})[_0x2980('0xc')](function(_0x3b06b9){if(_0x3b06b9){_0x3d3e96=_0x3b06b9[_0x2980('0x1c')];if(!_0x38bb43[_0x2980('0x17')][_0x2980('0x34')](_0x2980('0x1d'))){_0x1e6232['limit']=qs['limit'](_0x38bb43[_0x2980('0x17')][_0x2980('0x9')]);_0x1e6232['offset']=qs[_0x2980('0x6')](_0x38bb43['query']['offset']);}return _0xc22fcb[_0x2980('0x31')](_0x1e6232);}})[_0x2980('0xc')](function(_0x315c08){if(_0x315c08){return _0x315c08?{'count':_0x3d3e96,'rows':_0x315c08}:null;}})[_0x2980('0xc')](respondWithResult(_0x45de0e,null))[_0x2980('0x28')](handleError(_0x45de0e,null));};exports[_0x2980('0x35')]=function(_0x23a93e,_0x908120){if(_0x23a93e[_0x2980('0x2e')]['id']){delete _0x23a93e['body']['id'];}return db[_0x2980('0x13')][_0x2980('0x32')]({'where':{'id':_0x23a93e[_0x2980('0x2a')]['id']}})[_0x2980('0xc')](handleEntityNotFound(_0x908120,null))['then'](function(_0x57eb8b){if(_0x57eb8b){_0x23a93e[_0x2980('0x2e')][_0x2980('0x36')]=_0x57eb8b['id'];_0x23a93e[_0x2980('0x2e')][_0x2980('0x37')]=integrations[_0x2980('0x38')](_0x23a93e[_0x2980('0x2e')][_0x2980('0x39')],_0x23a93e[_0x2980('0x2e')][_0x2980('0x15')]);_0x23a93e['body']['Descriptions']=integrations[_0x2980('0x3a')](_0x23a93e[_0x2980('0x2e')][_0x2980('0x39')],_0x23a93e[_0x2980('0x2e')][_0x2980('0x15')]);return db[_0x2980('0x3b')][_0x2980('0x2d')](_0x23a93e[_0x2980('0x2e')],{'include':[{'model':db[_0x2980('0x3c')],'as':_0x2980('0x37')},{'model':db['Dynamics365Field'],'as':_0x2980('0x3d')}]});}return null;})[_0x2980('0xc')](respondWithResult(_0x908120,null))[_0x2980('0x28')](handleError(_0x908120,null));};function sanitizeRemoteUri(_0x1c6173){var _0x236b3e=_0x1c6173[_0x2980('0x3e')](-0x1);if(_0x236b3e==='/')return _0x1c6173[_0x2980('0x3f')](0x0,_0x1c6173[_0x2980('0x40')](_0x236b3e));return _0x1c6173;}function getWebApiUrl(_0x11cad5){return util[_0x2980('0x41')]('%s/api/data/v9.0/',_0x11cad5);}exports[_0x2980('0x42')]=function(_0x390cb9,_0x34e300){var _0x26cd2a=_0x390cb9[_0x2980('0x17')]['ticketType'];var _0x34272c=_0x26cd2a==='incident'?_0x2980('0x43'):_0x2980('0x44');var _0xdd9483='';var _0x308514='';var _0x5bde34='';var _0x2e0202='';var _0x57d0be='';var _0x142dcd='';var _0x229dab='';var _0x9ec2e0='';var _0x5f1c40=[_0x2980('0x45'),_0x2980('0x46'),_0x2980('0x47'),'ownerid','caseorigincode',_0x2980('0x48'),_0x2980('0x49'),_0x2980('0x4a'),_0x2980('0x4b'),_0x2980('0x4c')];var _0x4cf7c0=['accountidname',_0x2980('0x4d'),_0x2980('0x4e'),_0x2980('0x4f'),_0x2980('0x50'),_0x2980('0x51'),_0x2980('0x52'),'contractidname','createdbyexternalpartyname',_0x2980('0x53'),_0x2980('0x54'),_0x2980('0x55'),_0x2980('0x56'),_0x2980('0x57'),_0x2980('0x58'),_0x2980('0x59'),_0x2980('0x5a'),_0x2980('0x5b'),_0x2980('0x5c'),'entitlementidname',_0x2980('0x5d'),_0x2980('0x5e'),_0x2980('0x5f'),_0x2980('0x60'),_0x2980('0x61'),_0x2980('0x62'),_0x2980('0x63'),_0x2980('0x64'),_0x2980('0x65'),'lastonholdtime',_0x2980('0x66'),_0x2980('0x67'),'modifiedbyexternalpartyyominame',_0x2980('0x68'),_0x2980('0x69'),_0x2980('0x6a'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x2980('0x6b'),_0x2980('0x6c'),_0x2980('0x6d'),_0x2980('0x6e'),_0x2980('0x6f'),_0x2980('0x70'),_0x2980('0x71'),_0x2980('0x72'),_0x2980('0x73'),'primarycontactidname',_0x2980('0x74'),'prioritycodename',_0x2980('0x75'),'productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame',_0x2980('0x76'),_0x2980('0x77'),'slaname','socialprofileidname',_0x2980('0x78'),_0x2980('0x79'),'subjectidname',_0x2980('0x7a'),'timezoneruleversionnumber',_0x2980('0x7b'),_0x2980('0x7c'),_0x2980('0x7d'),_0x2980('0x7e')];var _0x402171=_0x5f1c40[_0x2980('0x7f')](_0x4cf7c0);return db['Dynamics365Account'][_0x2980('0x32')]({'where':{'id':_0x390cb9['params']['id']},'attributes':['id',_0x2980('0x80'),_0x2980('0x81'),_0x2980('0x82'),_0x2980('0x83'),_0x2980('0x84'),_0x2980('0x85'),_0x2980('0x86')],'include':[{'model':db[_0x2980('0x87')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0x2980('0xc')](handleEntityNotFound(_0x34e300,null))[_0x2980('0xc')](function(_0x4b19b3){if(_0x4b19b3){if(_0x4b19b3['modernAuthentication']){_0x4b19b3[_0x2980('0x88')]=_0x4b19b3['CloudProvider']['data5'];_0x9ec2e0=sanitizeRemoteUri(_0x4b19b3[_0x2980('0x87')][_0x2980('0x89')]);_0x229dab=getWebApiUrl(_0x9ec2e0);return _0x4b19b3;}_0x9ec2e0=sanitizeRemoteUri(_0x4b19b3[_0x2980('0x82')]);_0x229dab=getWebApiUrl(_0x9ec2e0);var _0x209f1d={'method':_0x2980('0x8a'),'uri':_0x2980('0x8b')+_0x4b19b3['tenantId']+_0x2980('0x8c'),'form':{'client_id':_0x4b19b3[_0x2980('0x84')],'resource':_0x9ec2e0,'username':_0x4b19b3[_0x2980('0x80')],'password':_0x4b19b3[_0x2980('0x81')],'grant_type':_0x2980('0x81'),'client_secret':_0x4b19b3[_0x2980('0x85')]},'json':!![]};return rp(_0x209f1d);}})[_0x2980('0xc')](function(_0x31e01e){_0x142dcd=_0x31e01e[_0x2980('0x88')];var _0x509ffc={'method':'GET','uri':encodeURI(_0x229dab+_0x2980('0x8d')+_0x34272c+'\x27'),'headers':{'Authorization':_0x2980('0x8e')+_0x142dcd,'If-None-Match':null,'OData-Version':_0x2980('0x8f')},'json':!![]};return rp(_0x509ffc);})[_0x2980('0xc')](function(_0x18c680){var _0x2b1356=_0x18c680[_0x2980('0x90')][0x0];var _0x1c091e=_0x2b1356['MetadataId'];var _0x58627e={'method':_0x2980('0x91'),'uri':_0x229dab+_0x2980('0x92')+_0x1c091e+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x142dcd,'If-None-Match':null,'OData-Version':_0x2980('0x8f')},'json':!![]};return rp(_0x58627e);})[_0x2980('0xc')](function(_0x24226d){_0xdd9483=_0x24226d;_0x308514=_0xdd9483['Attributes'];_0x308514=_['remove'](_0x308514,function(_0x1b7cbf){return!_0x402171[_0x2980('0x93')](_0x1b7cbf['LogicalName']);});var _0x3f4598=[];var _0x43ec22=[];_0x308514[_0x2980('0x94')](function(_0x564b5c){if(_0x564b5c['@odata.type']){var _0x58678d=_0x564b5c['@odata.type'][_0x2980('0x3f')](_0x564b5c['@odata.type']['lastIndexOf']('.')+0x1);if(_0x58678d===_0x2980('0x95')){_0x3f4598[_0x2980('0x96')](getSelectList(_0x229dab,_0x26cd2a,_0x43ec22,_0xdd9483[_0x2980('0x97')],_0x564b5c[_0x2980('0x97')],_0x142dcd));}}});return Promise[_0x2980('0x98')](_0x3f4598);})[_0x2980('0xc')](function(_0xa47bd1){_0x5bde34=_0xa47bd1[0x0];var _0x290fc1=[];var _0x410189=[];_0x308514['forEach'](function(_0x3c9253){if(!_['isNil'](_0x3c9253[_0x2980('0x99')])){var _0x299be2=_0x3c9253[_0x2980('0x99')]['substring'](_0x3c9253[_0x2980('0x99')][_0x2980('0x40')]('.')+0x1);if(_0x299be2===_0x2980('0x9a')){_0x290fc1[_0x2980('0x96')](getBooleanList(_0x229dab,_0x26cd2a,_0x410189,_0xdd9483['MetadataId'],_0x3c9253[_0x2980('0x97')],_0x142dcd));}}});return Promise[_0x2980('0x98')](_0x290fc1);})[_0x2980('0xc')](function(_0x3d1761){_0x2e0202=_0x3d1761[0x0];var _0x554719=[];var _0x302d38=[];_0x308514[_0x2980('0x94')](function(_0x4cd014){if(_0x4cd014[_0x2980('0x99')]){var _0x4460c7=_0x4cd014[_0x2980('0x99')][_0x2980('0x3f')](_0x4cd014['@odata.type'][_0x2980('0x40')]('.')+0x1);if(_0x4460c7==='StringAttributeMetadata'||_0x4460c7===_0x2980('0x9b')||_0x4460c7===_0x2980('0x9c')||_0x4460c7===_0x2980('0x9d')||_0x4460c7==='MemoAttributeMetadata'||_0x4460c7===_0x2980('0x9e')||_0x4460c7===_0x2980('0x9f')||_0x4460c7==='EntityNameAttributeMetadata'||_0x4460c7==='StateAttributeMetadata'||_0x4460c7===_0x2980('0xa0')){_0x554719[_0x2980('0x96')](getInputList(_0x229dab,_0x26cd2a,_0x4460c7,_0x302d38,_0xdd9483[_0x2980('0x97')],_0x4cd014['MetadataId'],_0x142dcd));}}});return Promise[_0x2980('0x98')](_0x554719);})[_0x2980('0xc')](function(_0x3a6175){_0x57d0be=_0x3a6175[0x0];var _0x1dd2a6=_0x5bde34['concat'](_0x2e0202)['concat'](_0x57d0be);var _0x41a920={'count':_0x1dd2a6[_0x2980('0x1c')],'rows':_0x1dd2a6};return _0x41a920;})['then'](respondWithResult(_0x34e300,null))[_0x2980('0x28')](function(_0x3ba09b){var _0x3429be=_0x390cb9[_0x2980('0x17')][_0x2980('0xa1')]?0x1f4:_0x3ba09b[_0x2980('0xa2')]||0x1f4;logger['error'](_0x3ba09b[_0x2980('0x11')]);delete _0x3ba09b[_0x2980('0x12')];if(_0x3429be===0x191){_0x3429be=0x190;}_0x34e300[_0x2980('0xa')](_0x3429be)[_0x2980('0xa3')](_0x390cb9['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3ba09b[_0x2980('0xa2')]}:_0x3ba09b);});};function getSelectList(_0x344de4,_0x291d6c,_0x56ece8,_0x1a3cdb,_0x1d778c,_0x5861b5){var _0x64a384={'method':_0x2980('0x91'),'uri':_0x344de4+_0x2980('0x92')+_0x1a3cdb+')/Attributes('+_0x1d778c+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2980('0x8e')+_0x5861b5,'If-None-Match':null,'OData-Version':_0x2980('0x8f')},'json':!![]};return rp(_0x64a384)[_0x2980('0xc')](function(_0x5e6ddd){var _0x29065d=[];var _0x25126f=_0x5e6ddd[_0x2980('0xa4')]['Options'];_0x25126f[_0x2980('0x94')](function(_0x46e1a9){_0x29065d[_0x2980('0x96')]({'name':_0x46e1a9[_0x2980('0xa5')][_0x2980('0xa6')]['Label'],'value':String(_0x46e1a9['Value'])});});var _0x2f75cd={'id':_0x291d6c+'_'+_0x5e6ddd['LogicalName'],'name':_0x5e6ddd[_0x2980('0xa7')][_0x2980('0xa6')][_0x2980('0xa5')],'custom':![],'options':_0x29065d};_0x56ece8['push'](_0x2f75cd);return _0x56ece8;});}function getBooleanList(_0x2e3a40,_0x50e1d4,_0x48da86,_0x33d095,_0x220bd8,_0x201ac2){var _0x560dbc={'method':_0x2980('0x91'),'uri':_0x2e3a40+_0x2980('0x92')+_0x33d095+_0x2980('0xa8')+_0x220bd8+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x2980('0x8e')+_0x201ac2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x560dbc)[_0x2980('0xc')](function(_0x895ad6){var _0x36e9bd=[];_0x36e9bd[_0x2980('0x96')]({'name':_0x895ad6[_0x2980('0xa4')]['TrueOption'][_0x2980('0xa5')][_0x2980('0xa6')]['Label'],'value':'true'},{'name':_0x895ad6[_0x2980('0xa4')]['FalseOption']['Label'][_0x2980('0xa6')]['Label'],'value':'false'});var _0x275a81={'id':_0x50e1d4+'_'+_0x895ad6[_0x2980('0xa9')],'name':_0x895ad6['DisplayName'][_0x2980('0xa6')][_0x2980('0xa5')],'custom':![],'options':_0x36e9bd};_0x48da86[_0x2980('0x96')](_0x275a81);return _0x48da86;});}function getInputList(_0x4fd8fd,_0x17b2c2,_0x4b842d,_0x3643ae,_0x1bb39d,_0x3e0907,_0x50d87a){var _0x91d9c6={'method':'GET','uri':_0x4fd8fd+_0x2980('0x92')+_0x1bb39d+_0x2980('0xa8')+_0x3e0907+_0x2980('0xaa')+_0x4b842d+_0x2980('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x50d87a,'If-None-Match':null,'OData-Version':_0x2980('0x8f')},'json':!![]};return rp(_0x91d9c6)['then'](function(_0x355335){var _0x1becf4={'id':_0x17b2c2+'_'+_0x355335[_0x2980('0xa9')],'name':_0x355335[_0x2980('0xa7')][_0x2980('0xa6')]?_0x355335[_0x2980('0xa7')][_0x2980('0xa6')][_0x2980('0xa5')]:_0x355335['LogicalName'],'custom':![],'options':[]};_0x3643ae[_0x2980('0x96')](_0x1becf4);return _0x3643ae;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f112b6f..ecae96a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x13203d,_0x433dff){var _0x3bfc43=function(_0x4b6018){while(--_0x4b6018){_0x13203d['push'](_0x13203d['shift']());}};_0x3bfc43(++_0x433dff);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xcb91[_0x872b02];return _0x1a6b24;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f214b3d..0761a11 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 _0x951c=['options','raw','where','attributes','limit','include','model','map','GetDynamics365Account','Dynamics365Account','find','then','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x951c,0x13d));var _0xc951=function(_0x3cea81,_0x230abc){_0x3cea81=_0x3cea81-0x0;var _0x3b1c95=_0x951c[_0x3cea81];return _0x3b1c95;};'use strict';var _=require('lodash');var util=require(_0xc951('0x0'));var moment=require(_0xc951('0x1'));var BPromise=require(_0xc951('0x2'));var rs=require(_0xc951('0x3'));var fs=require('fs');var Redis=require(_0xc951('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc951('0x5'));var logger=require(_0xc951('0x6'))(_0xc951('0x7'));var config=require(_0xc951('0x8'));var jayson=require(_0xc951('0x9'));var client=jayson[_0xc951('0xa')][_0xc951('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f1f06,_0x3687d8,_0x5d2b9c){return new BPromise(function(_0x249e9a,_0x457b2e){return client[_0xc951('0xc')](_0x5f1f06,_0x5d2b9c)['then'](function(_0x212917){logger['info'](_0xc951('0xd'),_0x3687d8,_0xc951('0xe'));logger[_0xc951('0xf')](_0xc951('0x10'),_0x3687d8,_0xc951('0xe'),JSON[_0xc951('0x11')](_0x212917));if(_0x212917[_0xc951('0x12')]){if(_0x212917[_0xc951('0x12')][_0xc951('0x13')]===0x1f4){logger[_0xc951('0x12')](_0xc951('0xd'),_0x3687d8,_0x212917[_0xc951('0x12')][_0xc951('0x14')]);return _0x457b2e(_0x212917[_0xc951('0x12')][_0xc951('0x14')]);}logger[_0xc951('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x3687d8,_0x212917[_0xc951('0x12')][_0xc951('0x14')]);return _0x249e9a(_0x212917[_0xc951('0x12')][_0xc951('0x14')]);}else{logger[_0xc951('0x15')](_0xc951('0xd'),_0x3687d8,'request\x20sent');_0x249e9a(_0x212917[_0xc951('0x16')][_0xc951('0x14')]);}})[_0xc951('0x17')](function(_0x1853b3){logger[_0xc951('0x12')](_0xc951('0xd'),_0x3687d8,_0x1853b3);_0x457b2e(_0x1853b3);});});}exports['GetDynamics365Account']=function(_0x517523){var _0x458772=this;return new Promise(function(_0x443121,_0x33be99){return db['Dynamics365Account'][_0xc951('0x18')]({'raw':_0x517523[_0xc951('0x19')]?_0x517523[_0xc951('0x19')][_0xc951('0x1a')]===undefined?!![]:![]:!![],'where':_0x517523[_0xc951('0x19')]?_0x517523[_0xc951('0x19')][_0xc951('0x1b')]||null:null,'attributes':_0x517523[_0xc951('0x19')]?_0x517523[_0xc951('0x19')][_0xc951('0x1c')]||null:null,'limit':_0x517523[_0xc951('0x19')]?_0x517523[_0xc951('0x19')][_0xc951('0x1d')]||null:null,'include':_0x517523[_0xc951('0x19')]?_0x517523['options'][_0xc951('0x1e')]?_['map'](_0x517523[_0xc951('0x19')][_0xc951('0x1e')],function(_0x488eb5){return{'model':db[_0x488eb5[_0xc951('0x1f')]],'as':_0x488eb5['as'],'attributes':_0x488eb5[_0xc951('0x1c')],'include':_0x488eb5[_0xc951('0x1e')]?_[_0xc951('0x20')](_0x488eb5[_0xc951('0x1e')],function(_0x1bee32){return{'model':db[_0x1bee32[_0xc951('0x1f')]],'as':_0x1bee32['as'],'attributes':_0x1bee32[_0xc951('0x1c')],'include':_0x1bee32['include']?_[_0xc951('0x20')](_0x1bee32[_0xc951('0x1e')],function(_0x35c4a7){return{'model':db[_0x35c4a7['model']],'as':_0x35c4a7['as'],'attributes':_0x35c4a7[_0xc951('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13fc64){logger['info'](_0xc951('0x21'),_0x517523);logger[_0xc951('0xf')]('GetDynamics365Account',_0x517523,JSON[_0xc951('0x11')](_0x13fc64));_0x443121(_0x13fc64);})['catch'](function(_0xc7350b){logger[_0xc951('0x12')](_0xc951('0x21'),_0xc7350b['message'],_0x517523);_0x33be99(_0x458772[_0xc951('0x12')](0x1f4,_0xc7350b[_0xc951('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x9352a4){var _0x8d13b2=this;return new Promise(function(_0x396665,_0x23f9e8){return db[_0xc951('0x22')][_0xc951('0x23')]({'raw':_0x9352a4[_0xc951('0x19')]?_0x9352a4[_0xc951('0x19')][_0xc951('0x1a')]===undefined?!![]:![]:!![],'where':_0x9352a4[_0xc951('0x19')]?_0x9352a4[_0xc951('0x19')]['where']||null:null,'attributes':_0x9352a4[_0xc951('0x19')]?_0x9352a4[_0xc951('0x19')]['attributes']||null:null,'include':_0x9352a4[_0xc951('0x19')]?_0x9352a4[_0xc951('0x19')][_0xc951('0x1e')]?_['map'](_0x9352a4[_0xc951('0x19')][_0xc951('0x1e')],function(_0x1b7d99){return{'model':db[_0x1b7d99[_0xc951('0x1f')]],'as':_0x1b7d99['as'],'attributes':_0x1b7d99[_0xc951('0x1c')],'include':_0x1b7d99['include']?_['map'](_0x1b7d99[_0xc951('0x1e')],function(_0xfaa7a4){return{'model':db[_0xfaa7a4[_0xc951('0x1f')]],'as':_0xfaa7a4['as'],'attributes':_0xfaa7a4[_0xc951('0x1c')],'include':_0xfaa7a4[_0xc951('0x1e')]?_[_0xc951('0x20')](_0xfaa7a4[_0xc951('0x1e')],function(_0x123006){return{'model':db[_0x123006[_0xc951('0x1f')]],'as':_0x123006['as'],'attributes':_0x123006[_0xc951('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc951('0x24')](function(_0x787553){logger[_0xc951('0x15')]('ShowDynamics365Account',_0x9352a4);logger[_0xc951('0xf')](_0xc951('0x25'),_0x9352a4,JSON[_0xc951('0x11')](_0x787553));_0x396665(_0x787553);})['catch'](function(_0x4bcce7){logger[_0xc951('0x12')]('ShowDynamics365Account',_0x4bcce7[_0xc951('0x14')],_0x9352a4);_0x23f9e8(_0x8d13b2[_0xc951('0x12')](0x1f4,_0x4bcce7[_0xc951('0x14')]));});});}; \ No newline at end of file +var _0xf5af=['include','map','model','catch','ShowDynamics365Account','find','where','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','Dynamics365Account,\x20%s,\x20%s','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit'];(function(_0x4c8833,_0x14e755){var _0x30df54=function(_0x197811){while(--_0x197811){_0x4c8833['push'](_0x4c8833['shift']());}};_0x30df54(++_0x14e755);}(_0xf5af,0x143));var _0xff5a=function(_0x20d404,_0x50dd47){_0x20d404=_0x20d404-0x0;var _0x1805e6=_0xf5af[_0x20d404];return _0x1805e6;};'use strict';var _=require(_0xff5a('0x0'));var util=require('util');var moment=require(_0xff5a('0x1'));var BPromise=require(_0xff5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff5a('0x3'));var db=require(_0xff5a('0x4'))['db'];var utils=require(_0xff5a('0x5'));var logger=require('../../config/logger')(_0xff5a('0x6'));var config=require(_0xff5a('0x7'));var jayson=require(_0xff5a('0x8'));var client=jayson[_0xff5a('0x9')][_0xff5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457931,_0x497aa2,_0x197b7a){return new BPromise(function(_0x1f2a67,_0x59ad84){return client[_0xff5a('0xb')](_0x457931,_0x197b7a)[_0xff5a('0xc')](function(_0x5287e8){logger[_0xff5a('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x497aa2,_0xff5a('0xe'));logger[_0xff5a('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x497aa2,_0xff5a('0xe'),JSON['stringify'](_0x5287e8));if(_0x5287e8[_0xff5a('0x10')]){if(_0x5287e8[_0xff5a('0x10')][_0xff5a('0x11')]===0x1f4){logger[_0xff5a('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x497aa2,_0x5287e8[_0xff5a('0x10')][_0xff5a('0x12')]);return _0x59ad84(_0x5287e8[_0xff5a('0x10')]['message']);}logger[_0xff5a('0x10')](_0xff5a('0x13'),_0x497aa2,_0x5287e8[_0xff5a('0x10')][_0xff5a('0x12')]);return _0x1f2a67(_0x5287e8['error'][_0xff5a('0x12')]);}else{logger[_0xff5a('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x497aa2,'request\x20sent');_0x1f2a67(_0x5287e8['result']['message']);}})['catch'](function(_0x45c80a){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x497aa2,_0x45c80a);_0x59ad84(_0x45c80a);});});}exports[_0xff5a('0x14')]=function(_0x42de04){var _0x1017e4=this;return new Promise(function(_0x50b8e4,_0x1a0d4e){return db[_0xff5a('0x15')][_0xff5a('0x16')]({'raw':_0x42de04[_0xff5a('0x17')]?_0x42de04[_0xff5a('0x17')][_0xff5a('0x18')]===undefined?!![]:![]:!![],'where':_0x42de04[_0xff5a('0x17')]?_0x42de04[_0xff5a('0x17')]['where']||null:null,'attributes':_0x42de04[_0xff5a('0x17')]?_0x42de04['options'][_0xff5a('0x19')]||null:null,'limit':_0x42de04[_0xff5a('0x17')]?_0x42de04[_0xff5a('0x17')][_0xff5a('0x1a')]||null:null,'include':_0x42de04[_0xff5a('0x17')]?_0x42de04[_0xff5a('0x17')][_0xff5a('0x1b')]?_[_0xff5a('0x1c')](_0x42de04['options'][_0xff5a('0x1b')],function(_0x2e284a){return{'model':db[_0x2e284a[_0xff5a('0x1d')]],'as':_0x2e284a['as'],'attributes':_0x2e284a[_0xff5a('0x19')],'include':_0x2e284a['include']?_[_0xff5a('0x1c')](_0x2e284a['include'],function(_0x4140bf){return{'model':db[_0x4140bf[_0xff5a('0x1d')]],'as':_0x4140bf['as'],'attributes':_0x4140bf[_0xff5a('0x19')],'include':_0x4140bf[_0xff5a('0x1b')]?_[_0xff5a('0x1c')](_0x4140bf['include'],function(_0x3a4863){return{'model':db[_0x3a4863[_0xff5a('0x1d')]],'as':_0x3a4863['as'],'attributes':_0x3a4863[_0xff5a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b6c18){logger['info'](_0xff5a('0x14'),_0x42de04);logger[_0xff5a('0xf')](_0xff5a('0x14'),_0x42de04,JSON['stringify'](_0x4b6c18));_0x50b8e4(_0x4b6c18);})[_0xff5a('0x1e')](function(_0x99379d){logger[_0xff5a('0x10')]('GetDynamics365Account',_0x99379d[_0xff5a('0x12')],_0x42de04);_0x1a0d4e(_0x1017e4[_0xff5a('0x10')](0x1f4,_0x99379d[_0xff5a('0x12')]));});});};exports[_0xff5a('0x1f')]=function(_0x4283f8){var _0x5a5d99=this;return new Promise(function(_0x5e81cb,_0x464579){return db[_0xff5a('0x15')][_0xff5a('0x20')]({'raw':_0x4283f8[_0xff5a('0x17')]?_0x4283f8[_0xff5a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4283f8[_0xff5a('0x17')]?_0x4283f8[_0xff5a('0x17')][_0xff5a('0x21')]||null:null,'attributes':_0x4283f8['options']?_0x4283f8[_0xff5a('0x17')]['attributes']||null:null,'include':_0x4283f8[_0xff5a('0x17')]?_0x4283f8[_0xff5a('0x17')][_0xff5a('0x1b')]?_[_0xff5a('0x1c')](_0x4283f8[_0xff5a('0x17')][_0xff5a('0x1b')],function(_0x5a2e80){return{'model':db[_0x5a2e80['model']],'as':_0x5a2e80['as'],'attributes':_0x5a2e80[_0xff5a('0x19')],'include':_0x5a2e80[_0xff5a('0x1b')]?_[_0xff5a('0x1c')](_0x5a2e80[_0xff5a('0x1b')],function(_0xed003d){return{'model':db[_0xed003d[_0xff5a('0x1d')]],'as':_0xed003d['as'],'attributes':_0xed003d['attributes'],'include':_0xed003d[_0xff5a('0x1b')]?_[_0xff5a('0x1c')](_0xed003d['include'],function(_0xb6b3e6){return{'model':db[_0xb6b3e6[_0xff5a('0x1d')]],'as':_0xb6b3e6['as'],'attributes':_0xb6b3e6[_0xff5a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xff5a('0xc')](function(_0x33591e){logger[_0xff5a('0xd')]('ShowDynamics365Account',_0x4283f8);logger[_0xff5a('0xf')](_0xff5a('0x1f'),_0x4283f8,JSON[_0xff5a('0x22')](_0x33591e));_0x5e81cb(_0x33591e);})[_0xff5a('0x1e')](function(_0x2e5d05){logger[_0xff5a('0x10')](_0xff5a('0x1f'),_0x2e5d05['message'],_0x4283f8);_0x464579(_0x5a5d99[_0xff5a('0x10')](0x1f4,_0x2e5d05[_0xff5a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f17df70..e9ab172 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 _0x6208=['get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index'];(function(_0x4f319b,_0x249687){var _0x2aa953=function(_0x380243){while(--_0x380243){_0x4f319b['push'](_0x4f319b['shift']());}};_0x2aa953(++_0x249687);}(_0x6208,0x192));var _0x8620=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x6208[_0x5b5eb4];return _0x42af53;};'use strict';var multer=require('multer');var util=require(_0x8620('0x0'));var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require(_0x8620('0x3'));var router=express[_0x8620('0x4')]();var fs_extra=require(_0x8620('0x5'));var auth=require(_0x8620('0x6'));var interaction=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var controller=require(_0x8620('0x9'));router['get']('/',auth[_0x8620('0xa')](),controller[_0x8620('0xb')]);router[_0x8620('0xc')](_0x8620('0xd'),auth[_0x8620('0xa')](),controller['show']);router[_0x8620('0xc')](_0x8620('0xe'),auth['isAuthenticated'](),controller[_0x8620('0xf')]);router[_0x8620('0xc')]('/:id/subjects',auth[_0x8620('0xa')](),controller[_0x8620('0x10')]);router['get'](_0x8620('0x11'),auth[_0x8620('0xa')](),controller[_0x8620('0x12')]);router['post']('/',auth[_0x8620('0xa')](),controller[_0x8620('0x13')]);router[_0x8620('0x14')](_0x8620('0xd'),auth[_0x8620('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8620('0xa')](),controller[_0x8620('0x15')]);module[_0x8620('0x16')]=router; \ No newline at end of file +var _0xe547=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete'];(function(_0x4057de,_0x4d57af){var _0x84d684=function(_0x4bf471){while(--_0x4bf471){_0x4057de['push'](_0x4057de['shift']());}};_0x84d684(++_0x4d57af);}(_0xe547,0x191));var _0x7e54=function(_0x2ac971,_0x2bd8df){_0x2ac971=_0x2ac971-0x0;var _0x26c886=_0xe547[_0x2ac971];return _0x26c886;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e54('0x0'));var timeout=require(_0x7e54('0x1'));var express=require(_0x7e54('0x2'));var router=express[_0x7e54('0x3')]();var fs_extra=require(_0x7e54('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7e54('0x5'));var config=require(_0x7e54('0x6'));var controller=require(_0x7e54('0x7'));router[_0x7e54('0x8')]('/',auth[_0x7e54('0x9')](),controller[_0x7e54('0xa')]);router[_0x7e54('0x8')]('/:id',auth[_0x7e54('0x9')](),controller[_0x7e54('0xb')]);router[_0x7e54('0x8')](_0x7e54('0xc'),auth[_0x7e54('0x9')](),controller[_0x7e54('0xd')]);router[_0x7e54('0x8')](_0x7e54('0xe'),auth[_0x7e54('0x9')](),controller[_0x7e54('0xf')]);router[_0x7e54('0x8')](_0x7e54('0x10'),auth[_0x7e54('0x9')](),controller[_0x7e54('0x11')]);router[_0x7e54('0x12')]('/',auth['isAuthenticated'](),controller[_0x7e54('0x13')]);router[_0x7e54('0x14')](_0x7e54('0x15'),auth['isAuthenticated'](),controller[_0x7e54('0x16')]);router[_0x7e54('0x17')](_0x7e54('0x15'),auth[_0x7e54('0x9')](),controller[_0x7e54('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index a2989e3..547bb34 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 _0x9989=['contact','BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','nothing'];(function(_0x59f5cd,_0x5658d4){var _0x292606=function(_0x552490){while(--_0x552490){_0x59f5cd['push'](_0x59f5cd['shift']());}};_0x292606(++_0x5658d4);}(_0x9989,0xda));var _0x9998=function(_0x3ac218,_0x4e1862){_0x3ac218=_0x3ac218-0x0;var _0x24810e=_0x9989[_0x3ac218];return _0x24810e;};'use strict';var Sequelize=require(_0x9998('0x0'));module[_0x9998('0x1')]={'name':{'type':Sequelize[_0x9998('0x2')]},'description':{'type':Sequelize[_0x9998('0x2')]},'ticketType':{'type':Sequelize[_0x9998('0x3')](_0x9998('0x4'),_0x9998('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x9998('0x3')]('contact',_0x9998('0x6')),'defaultValue':_0x9998('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9998('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9998('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xde91=['incident','phonecall','nothing','sequelize','exports','STRING','ENUM'];(function(_0x2879e5,_0x428e73){var _0x5cc17e=function(_0x168aca){while(--_0x168aca){_0x2879e5['push'](_0x2879e5['shift']());}};_0x5cc17e(++_0x428e73);}(_0xde91,0x14c));var _0x1de9=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0xde91[_0xe719ec];return _0x4842a1;};'use strict';var Sequelize=require(_0x1de9('0x0'));module[_0x1de9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1de9('0x2')]},'ticketType':{'type':Sequelize[_0x1de9('0x3')](_0x1de9('0x4'),_0x1de9('0x5')),'defaultValue':_0x1de9('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x1de9('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1de9('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 05e7163..20e38d8 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 _0x1eb1=['moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','find','getFields','findOne','Dynamics365Field','order','pick','merge','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x34dd48,_0x1d0620){var _0x486efd=function(_0xaa1812){while(--_0xaa1812){_0x34dd48['push'](_0x34dd48['shift']());}};_0x486efd(++_0x1d0620);}(_0x1eb1,0x14b));var _0x11eb=function(_0x2673c8,_0x2a8a28){_0x2673c8=_0x2673c8-0x0;var _0x3a7346=_0x1eb1[_0x2673c8];return _0x3a7346;};'use strict';var emlformat=require(_0x11eb('0x0'));var rimraf=require(_0x11eb('0x1'));var zipdir=require(_0x11eb('0x2'));var jsonpatch=require(_0x11eb('0x3'));var rp=require(_0x11eb('0x4'));var moment=require(_0x11eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x11eb('0x6'));var util=require(_0x11eb('0x7'));var path=require('path');var sox=require(_0x11eb('0x8'));var csv=require(_0x11eb('0x9'));var ejs=require(_0x11eb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11eb('0xb'));var squel=require(_0x11eb('0xc'));var crypto=require(_0x11eb('0xd'));var jsforce=require(_0x11eb('0xe'));var deskjs=require(_0x11eb('0xf'));var toCsv=require(_0x11eb('0x9'));var querystring=require(_0x11eb('0x10'));var Papa=require(_0x11eb('0x11'));var Redis=require(_0x11eb('0x12'));var authService=require(_0x11eb('0x13'));var qs=require(_0x11eb('0x14'));var as=require(_0x11eb('0x15'));var hardwareService=require(_0x11eb('0x16'));var logger=require(_0x11eb('0x17'))(_0x11eb('0x18'));var utils=require(_0x11eb('0x19'));var config=require(_0x11eb('0x1a'));var licenseUtil=require(_0x11eb('0x1b'));var db=require(_0x11eb('0x1c'))['db'];function respondWithStatusCode(_0x4b5006,_0x304f13){_0x304f13=_0x304f13||0xcc;return function(_0x104e4f){if(_0x104e4f){return _0x4b5006[_0x11eb('0x1d')](_0x304f13);}return _0x4b5006[_0x11eb('0x1e')](_0x304f13)[_0x11eb('0x1f')]();};}function respondWithResult(_0x5f1491,_0x7144db){_0x7144db=_0x7144db||0xc8;return function(_0x9be5a0){if(_0x9be5a0){return _0x5f1491['status'](_0x7144db)['json'](_0x9be5a0);}};}function respondWithFilteredResult(_0x42b2e6,_0x1380c9){return function(_0x1cea00){if(_0x1cea00){var _0x511af7=typeof _0x1380c9[_0x11eb('0x20')]===_0x11eb('0x21')&&typeof _0x1380c9['limit']===_0x11eb('0x21');var _0x477a1d=_0x1cea00[_0x11eb('0x22')];var _0x1218c4=_0x511af7?0x0:_0x1380c9[_0x11eb('0x20')];var _0x1c4db9=_0x511af7?_0x1cea00[_0x11eb('0x22')]:_0x1380c9[_0x11eb('0x20')]+_0x1380c9[_0x11eb('0x23')];var _0x57f93b;if(_0x1c4db9>=_0x477a1d){_0x1c4db9=_0x477a1d;_0x57f93b=0xc8;}else{_0x57f93b=0xce;}_0x42b2e6[_0x11eb('0x1e')](_0x57f93b);return _0x42b2e6[_0x11eb('0x24')]('Content-Range',_0x1218c4+'-'+_0x1c4db9+'/'+_0x477a1d)['json'](_0x1cea00);}return null;};}function patchUpdates(_0x26feef){return function(_0x4850af){try{jsonpatch[_0x11eb('0x25')](_0x4850af,_0x26feef,!![]);}catch(_0x38696d){return BPromise[_0x11eb('0x26')](_0x38696d);}return _0x4850af[_0x11eb('0x27')]();};}function saveUpdates(_0x504982,_0x5cf6a6){return function(_0x4e158c){if(_0x4e158c){return _0x4e158c[_0x11eb('0x28')](_0x504982)[_0x11eb('0x29')](function(_0xef0b65){return _0xef0b65;});}return null;};}function removeEntity(_0x48c41b,_0x3710f5){return function(_0x15443e){if(_0x15443e){return _0x15443e[_0x11eb('0x2a')]()[_0x11eb('0x29')](function(){_0x48c41b[_0x11eb('0x1e')](0xcc)[_0x11eb('0x1f')]();});}};}function handleEntityNotFound(_0x483d22,_0x2f6acc){return function(_0x4dd185){if(!_0x4dd185){_0x483d22[_0x11eb('0x1d')](0x194);}return _0x4dd185;};}function handleError(_0x2baa0e,_0x10a2ec){_0x10a2ec=_0x10a2ec||0x1f4;return function(_0x4388e1){logger[_0x11eb('0x2b')](_0x4388e1[_0x11eb('0x2c')]);if(_0x4388e1[_0x11eb('0x2d')]){delete _0x4388e1[_0x11eb('0x2d')];}_0x2baa0e['status'](_0x10a2ec)[_0x11eb('0x2e')](_0x4388e1);};}exports['index']=function(_0x1ad7d2,_0x2e2b56){var _0x2189e0={},_0x3af8f9={},_0x11a851={'count':0x0,'rows':[]};var _0x3e2c25=_['map'](db[_0x11eb('0x2f')][_0x11eb('0x30')],function(_0x365654){return{'name':_0x365654[_0x11eb('0x31')],'type':_0x365654[_0x11eb('0x32')][_0x11eb('0x33')]};});_0x3af8f9[_0x11eb('0x34')]=_[_0x11eb('0x35')](_0x3e2c25,'name');_0x3af8f9[_0x11eb('0x36')]=_[_0x11eb('0x37')](_0x1ad7d2[_0x11eb('0x36')]);_0x3af8f9[_0x11eb('0x38')]=_[_0x11eb('0x39')](_0x3af8f9[_0x11eb('0x34')],_0x3af8f9[_0x11eb('0x36')]);_0x2189e0[_0x11eb('0x3a')]=_[_0x11eb('0x39')](_0x3af8f9[_0x11eb('0x34')],qs[_0x11eb('0x3b')](_0x1ad7d2[_0x11eb('0x36')]['fields']));_0x2189e0[_0x11eb('0x3a')]=_0x2189e0['attributes'][_0x11eb('0x3c')]?_0x2189e0['attributes']:_0x3af8f9[_0x11eb('0x34')];if(!_0x1ad7d2[_0x11eb('0x36')]['hasOwnProperty']('nolimit')){_0x2189e0[_0x11eb('0x23')]=qs[_0x11eb('0x23')](_0x1ad7d2[_0x11eb('0x36')][_0x11eb('0x23')]);_0x2189e0[_0x11eb('0x20')]=qs[_0x11eb('0x20')](_0x1ad7d2[_0x11eb('0x36')][_0x11eb('0x20')]);}_0x2189e0['order']=qs[_0x11eb('0x3d')](_0x1ad7d2[_0x11eb('0x36')][_0x11eb('0x3d')]);_0x2189e0[_0x11eb('0x3e')]=qs['filters'](_['pick'](_0x1ad7d2[_0x11eb('0x36')],_0x3af8f9['filters']),_0x3e2c25);if(_0x1ad7d2[_0x11eb('0x36')][_0x11eb('0x3f')]){_0x2189e0[_0x11eb('0x3e')]=_['merge'](_0x2189e0[_0x11eb('0x3e')],{'$or':_[_0x11eb('0x35')](_0x3e2c25,function(_0x5084f5){if(_0x5084f5['type']!==_0x11eb('0x40')){var _0x13a67c={};_0x13a67c[_0x5084f5[_0x11eb('0x2d')]]={'$like':'%'+_0x1ad7d2[_0x11eb('0x36')][_0x11eb('0x3f')]+'%'};return _0x13a67c;}})});}_0x2189e0=_['merge']({},_0x2189e0,_0x1ad7d2[_0x11eb('0x41')]);var _0x284c3e={'where':_0x2189e0[_0x11eb('0x3e')]};return db[_0x11eb('0x2f')][_0x11eb('0x22')](_0x284c3e)['then'](function(_0x2532a7){_0x11a851['count']=_0x2532a7;if(_0x1ad7d2[_0x11eb('0x36')][_0x11eb('0x42')]){_0x2189e0[_0x11eb('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x11eb('0x44')](_0x2189e0);})[_0x11eb('0x29')](function(_0x17270e){_0x11a851[_0x11eb('0x45')]=_0x17270e;return _0x11a851;})[_0x11eb('0x29')](respondWithFilteredResult(_0x2e2b56,_0x2189e0))[_0x11eb('0x46')](handleError(_0x2e2b56,null));};exports['show']=function(_0x5afcd8,_0x175040){var _0x1f938c={'raw':![],'where':{'id':_0x5afcd8[_0x11eb('0x47')]['id']}},_0x2c14f9={};_0x2c14f9['model']=_[_0x11eb('0x37')](db[_0x11eb('0x2f')][_0x11eb('0x30')]);_0x2c14f9['query']=_['keys'](_0x5afcd8[_0x11eb('0x36')]);_0x2c14f9[_0x11eb('0x38')]=_[_0x11eb('0x39')](_0x2c14f9['model'],_0x2c14f9['query']);_0x1f938c[_0x11eb('0x3a')]=_[_0x11eb('0x39')](_0x2c14f9[_0x11eb('0x34')],qs[_0x11eb('0x3b')](_0x5afcd8[_0x11eb('0x36')][_0x11eb('0x3b')]));_0x1f938c[_0x11eb('0x3a')]=_0x1f938c[_0x11eb('0x3a')][_0x11eb('0x3c')]?_0x1f938c[_0x11eb('0x3a')]:_0x2c14f9[_0x11eb('0x34')];if(_0x5afcd8[_0x11eb('0x36')][_0x11eb('0x42')]){_0x1f938c[_0x11eb('0x43')]=[{'all':!![]}];}_0x1f938c=_['merge']({},_0x1f938c,_0x5afcd8[_0x11eb('0x41')]);return db['Dynamics365Configuration']['find'](_0x1f938c)['then'](handleEntityNotFound(_0x175040,null))[_0x11eb('0x29')](respondWithResult(_0x175040,null))['catch'](handleError(_0x175040,null));};exports[_0x11eb('0x48')]=function(_0xe1005c,_0x58c7d1){return db[_0x11eb('0x2f')][_0x11eb('0x48')](_0xe1005c['body'],{})[_0x11eb('0x29')](respondWithResult(_0x58c7d1,0xc9))[_0x11eb('0x46')](handleError(_0x58c7d1,null));};exports[_0x11eb('0x28')]=function(_0x2069f6,_0x15c022){if(_0x2069f6['body']['id']){delete _0x2069f6['body']['id'];}return db[_0x11eb('0x2f')]['find']({'where':{'id':_0x2069f6[_0x11eb('0x47')]['id']}})[_0x11eb('0x29')](handleEntityNotFound(_0x15c022,null))['then'](saveUpdates(_0x2069f6['body'],null))[_0x11eb('0x29')](respondWithResult(_0x15c022,null))[_0x11eb('0x46')](handleError(_0x15c022,null));};exports[_0x11eb('0x2a')]=function(_0x4dc74d,_0x8d8b24){return db[_0x11eb('0x2f')][_0x11eb('0x49')]({'where':{'id':_0x4dc74d['params']['id']}})['then'](handleEntityNotFound(_0x8d8b24,null))[_0x11eb('0x29')](removeEntity(_0x8d8b24,null))['catch'](handleError(_0x8d8b24,null));};exports[_0x11eb('0x4a')]=function(_0xa38f9a,_0x1bf8f7,_0x102d10){var _0x3d916d={};var _0x4390c3={};var _0x2c4dfc;var _0x4c8239;return db[_0x11eb('0x2f')][_0x11eb('0x4b')]({'where':{'id':_0xa38f9a[_0x11eb('0x47')]['id']}})[_0x11eb('0x29')](handleEntityNotFound(_0x1bf8f7,null))[_0x11eb('0x29')](function(_0x4ee5c1){if(_0x4ee5c1){_0x2c4dfc=_0x4ee5c1;_0x4390c3[_0x11eb('0x34')]=_[_0x11eb('0x37')](db[_0x11eb('0x4c')][_0x11eb('0x30')]);_0x4390c3[_0x11eb('0x36')]=_[_0x11eb('0x37')](_0xa38f9a[_0x11eb('0x36')]);_0x4390c3[_0x11eb('0x38')]=_[_0x11eb('0x39')](_0x4390c3['model'],_0x4390c3[_0x11eb('0x36')]);_0x3d916d[_0x11eb('0x3a')]=_[_0x11eb('0x39')](_0x4390c3[_0x11eb('0x34')],qs[_0x11eb('0x3b')](_0xa38f9a[_0x11eb('0x36')][_0x11eb('0x3b')]));_0x3d916d[_0x11eb('0x3a')]=_0x3d916d[_0x11eb('0x3a')][_0x11eb('0x3c')]?_0x3d916d['attributes']:_0x4390c3[_0x11eb('0x34')];_0x3d916d[_0x11eb('0x4d')]=qs[_0x11eb('0x3d')](_0xa38f9a['query'][_0x11eb('0x3d')]);_0x3d916d[_0x11eb('0x3e')]=qs[_0x11eb('0x38')](_[_0x11eb('0x4e')](_0xa38f9a[_0x11eb('0x36')],_0x4390c3[_0x11eb('0x38')]));if(_0xa38f9a[_0x11eb('0x36')][_0x11eb('0x3f')]){_0x3d916d[_0x11eb('0x3e')]=_[_0x11eb('0x4f')](_0x3d916d[_0x11eb('0x3e')],{'$or':_['map'](_0x3d916d[_0x11eb('0x3a')],function(_0x148b2f){var _0x128f9e={};_0x128f9e[_0x148b2f]={'$like':'%'+_0xa38f9a[_0x11eb('0x36')][_0x11eb('0x3f')]+'%'};return _0x128f9e;})});}_0x3d916d=_[_0x11eb('0x4f')]({},_0x3d916d,_0xa38f9a['options']);return _0x2c4dfc[_0x11eb('0x4a')](_0x3d916d);}})[_0x11eb('0x29')](function(_0xae029e){if(_0xae029e){_0x4c8239=_0xae029e[_0x11eb('0x3c')];if(!_0xa38f9a['query'][_0x11eb('0x50')](_0x11eb('0x51'))){_0x3d916d[_0x11eb('0x23')]=qs[_0x11eb('0x23')](_0xa38f9a[_0x11eb('0x36')]['limit']);_0x3d916d[_0x11eb('0x20')]=qs['offset'](_0xa38f9a[_0x11eb('0x36')][_0x11eb('0x20')]);}return _0x2c4dfc[_0x11eb('0x4a')](_0x3d916d);}})[_0x11eb('0x29')](function(_0x5f58c2){if(_0x5f58c2){return _0x5f58c2?{'count':_0x4c8239,'rows':_0x5f58c2}:null;}})[_0x11eb('0x29')](respondWithResult(_0x1bf8f7,null))['catch'](handleError(_0x1bf8f7,null));};exports['getSubjects']=function(_0x16063c,_0x9548a9,_0x12e8be){var _0x481e0c={};var _0x4e4382={};var _0xe2b30d;var _0x16634d;return db[_0x11eb('0x2f')]['findOne']({'where':{'id':_0x16063c[_0x11eb('0x47')]['id']}})[_0x11eb('0x29')](handleEntityNotFound(_0x9548a9,null))[_0x11eb('0x29')](function(_0x100e31){if(_0x100e31){_0xe2b30d=_0x100e31;_0x4e4382[_0x11eb('0x34')]=_[_0x11eb('0x37')](db[_0x11eb('0x4c')]['rawAttributes']);_0x4e4382[_0x11eb('0x36')]=_[_0x11eb('0x37')](_0x16063c[_0x11eb('0x36')]);_0x4e4382['filters']=_[_0x11eb('0x39')](_0x4e4382[_0x11eb('0x34')],_0x4e4382[_0x11eb('0x36')]);_0x481e0c[_0x11eb('0x3a')]=_[_0x11eb('0x39')](_0x4e4382[_0x11eb('0x34')],qs[_0x11eb('0x3b')](_0x16063c[_0x11eb('0x36')]['fields']));_0x481e0c[_0x11eb('0x3a')]=_0x481e0c[_0x11eb('0x3a')][_0x11eb('0x3c')]?_0x481e0c[_0x11eb('0x3a')]:_0x4e4382[_0x11eb('0x34')];_0x481e0c[_0x11eb('0x4d')]=qs[_0x11eb('0x3d')](_0x16063c[_0x11eb('0x36')][_0x11eb('0x3d')]);_0x481e0c[_0x11eb('0x3e')]=qs[_0x11eb('0x38')](_[_0x11eb('0x4e')](_0x16063c[_0x11eb('0x36')],_0x4e4382[_0x11eb('0x38')]));if(_0x16063c[_0x11eb('0x36')]['filter']){_0x481e0c['where']=_[_0x11eb('0x4f')](_0x481e0c[_0x11eb('0x3e')],{'$or':_[_0x11eb('0x35')](_0x481e0c[_0x11eb('0x3a')],function(_0x1a8dea){var _0x20bba2={};_0x20bba2[_0x1a8dea]={'$like':'%'+_0x16063c['query'][_0x11eb('0x3f')]+'%'};return _0x20bba2;})});}_0x481e0c=_[_0x11eb('0x4f')]({},_0x481e0c,_0x16063c['options']);return _0xe2b30d[_0x11eb('0x52')](_0x481e0c);}})[_0x11eb('0x29')](function(_0x40edf9){if(_0x40edf9){_0x16634d=_0x40edf9[_0x11eb('0x3c')];if(!_0x16063c['query'][_0x11eb('0x50')](_0x11eb('0x51'))){_0x481e0c[_0x11eb('0x23')]=qs['limit'](_0x16063c[_0x11eb('0x36')][_0x11eb('0x23')]);_0x481e0c[_0x11eb('0x20')]=qs[_0x11eb('0x20')](_0x16063c[_0x11eb('0x36')][_0x11eb('0x20')]);}return _0xe2b30d[_0x11eb('0x52')](_0x481e0c);}})['then'](function(_0x1c12a1){if(_0x1c12a1){return _0x1c12a1?{'count':_0x16634d,'rows':_0x1c12a1}:null;}})[_0x11eb('0x29')](respondWithResult(_0x9548a9,null))[_0x11eb('0x46')](handleError(_0x9548a9,null));};exports[_0x11eb('0x53')]=function(_0x212d66,_0x51c258,_0x4dde5b){var _0x39f322={};var _0x2b62da={};var _0x2e177b;var _0x1c5a34;return db[_0x11eb('0x2f')][_0x11eb('0x4b')]({'where':{'id':_0x212d66[_0x11eb('0x47')]['id']}})['then'](handleEntityNotFound(_0x51c258,null))[_0x11eb('0x29')](function(_0x21731e){if(_0x21731e){_0x2e177b=_0x21731e;_0x2b62da['model']=_['keys'](db[_0x11eb('0x4c')][_0x11eb('0x30')]);_0x2b62da['query']=_[_0x11eb('0x37')](_0x212d66['query']);_0x2b62da[_0x11eb('0x38')]=_['intersection'](_0x2b62da[_0x11eb('0x34')],_0x2b62da[_0x11eb('0x36')]);_0x39f322[_0x11eb('0x3a')]=_[_0x11eb('0x39')](_0x2b62da[_0x11eb('0x34')],qs[_0x11eb('0x3b')](_0x212d66[_0x11eb('0x36')][_0x11eb('0x3b')]));_0x39f322['attributes']=_0x39f322[_0x11eb('0x3a')][_0x11eb('0x3c')]?_0x39f322[_0x11eb('0x3a')]:_0x2b62da[_0x11eb('0x34')];_0x39f322['order']=qs['sort'](_0x212d66[_0x11eb('0x36')][_0x11eb('0x3d')]);_0x39f322[_0x11eb('0x3e')]=qs['filters'](_[_0x11eb('0x4e')](_0x212d66[_0x11eb('0x36')],_0x2b62da[_0x11eb('0x38')]));if(_0x212d66['query'][_0x11eb('0x3f')]){_0x39f322[_0x11eb('0x3e')]=_[_0x11eb('0x4f')](_0x39f322[_0x11eb('0x3e')],{'$or':_[_0x11eb('0x35')](_0x39f322[_0x11eb('0x3a')],function(_0x191510){var _0xdffc87={};_0xdffc87[_0x191510]={'$like':'%'+_0x212d66['query']['filter']+'%'};return _0xdffc87;})});}_0x39f322=_['merge']({},_0x39f322,_0x212d66['options']);return _0x2e177b[_0x11eb('0x53')](_0x39f322);}})['then'](function(_0x13d025){if(_0x13d025){_0x1c5a34=_0x13d025[_0x11eb('0x3c')];if(!_0x212d66[_0x11eb('0x36')][_0x11eb('0x50')](_0x11eb('0x51'))){_0x39f322[_0x11eb('0x23')]=qs['limit'](_0x212d66['query'][_0x11eb('0x23')]);_0x39f322[_0x11eb('0x20')]=qs[_0x11eb('0x20')](_0x212d66[_0x11eb('0x36')][_0x11eb('0x20')]);}return _0x2e177b[_0x11eb('0x53')](_0x39f322);}})[_0x11eb('0x29')](function(_0x8a5d9e){if(_0x8a5d9e){return _0x8a5d9e?{'count':_0x1c5a34,'rows':_0x8a5d9e}:null;}})[_0x11eb('0x29')](respondWithResult(_0x51c258,null))[_0x11eb('0x46')](handleError(_0x51c258,null));}; \ No newline at end of file +var _0xd85f=['rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','find','create','body','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','name','map','Dynamics365Configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd85f,0x14e));var _0xfd85=function(_0x22db93,_0x550664){_0x22db93=_0x22db93-0x0;var _0x141424=_0xd85f[_0x22db93];return _0x141424;};'use strict';var emlformat=require(_0xfd85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd85('0x1'));var rp=require(_0xfd85('0x2'));var moment=require(_0xfd85('0x3'));var BPromise=require(_0xfd85('0x4'));var Mustache=require('mustache');var util=require(_0xfd85('0x5'));var path=require(_0xfd85('0x6'));var sox=require(_0xfd85('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd85('0x8'));var squel=require(_0xfd85('0x9'));var crypto=require(_0xfd85('0xa'));var jsforce=require(_0xfd85('0xb'));var deskjs=require(_0xfd85('0xc'));var toCsv=require(_0xfd85('0xd'));var querystring=require(_0xfd85('0xe'));var Papa=require(_0xfd85('0xf'));var Redis=require('ioredis');var authService=require(_0xfd85('0x10'));var qs=require(_0xfd85('0x11'));var as=require(_0xfd85('0x12'));var hardwareService=require(_0xfd85('0x13'));var logger=require(_0xfd85('0x14'))(_0xfd85('0x15'));var utils=require(_0xfd85('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfd85('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x135c3f,_0x356f06){_0x356f06=_0x356f06||0xcc;return function(_0x5baa9e){if(_0x5baa9e){return _0x135c3f[_0xfd85('0x18')](_0x356f06);}return _0x135c3f[_0xfd85('0x19')](_0x356f06)[_0xfd85('0x1a')]();};}function respondWithResult(_0x2614a8,_0x4a4931){_0x4a4931=_0x4a4931||0xc8;return function(_0x556411){if(_0x556411){return _0x2614a8[_0xfd85('0x19')](_0x4a4931)[_0xfd85('0x1b')](_0x556411);}};}function respondWithFilteredResult(_0x405752,_0x59ff4c){return function(_0x462a40){if(_0x462a40){var _0xbb5e9d=typeof _0x59ff4c[_0xfd85('0x1c')]===_0xfd85('0x1d')&&typeof _0x59ff4c[_0xfd85('0x1e')]===_0xfd85('0x1d');var _0x44f809=_0x462a40[_0xfd85('0x1f')];var _0xc7822d=_0xbb5e9d?0x0:_0x59ff4c['offset'];var _0xdbd8f9=_0xbb5e9d?_0x462a40[_0xfd85('0x1f')]:_0x59ff4c[_0xfd85('0x1c')]+_0x59ff4c[_0xfd85('0x1e')];var _0x359aa5;if(_0xdbd8f9>=_0x44f809){_0xdbd8f9=_0x44f809;_0x359aa5=0xc8;}else{_0x359aa5=0xce;}_0x405752[_0xfd85('0x19')](_0x359aa5);return _0x405752['set'](_0xfd85('0x20'),_0xc7822d+'-'+_0xdbd8f9+'/'+_0x44f809)[_0xfd85('0x1b')](_0x462a40);}return null;};}function patchUpdates(_0x4d4d1d){return function(_0x4ca1a9){try{jsonpatch[_0xfd85('0x21')](_0x4ca1a9,_0x4d4d1d,!![]);}catch(_0x3bc829){return BPromise[_0xfd85('0x22')](_0x3bc829);}return _0x4ca1a9['save']();};}function saveUpdates(_0x33983d,_0x1d25ad){return function(_0x181b34){if(_0x181b34){return _0x181b34[_0xfd85('0x23')](_0x33983d)[_0xfd85('0x24')](function(_0x45e314){return _0x45e314;});}return null;};}function removeEntity(_0x176d16,_0x3c68bf){return function(_0x22a5b9){if(_0x22a5b9){return _0x22a5b9[_0xfd85('0x25')]()[_0xfd85('0x24')](function(){_0x176d16[_0xfd85('0x19')](0xcc)[_0xfd85('0x1a')]();});}};}function handleEntityNotFound(_0x77013e,_0x358044){return function(_0x20fd10){if(!_0x20fd10){_0x77013e[_0xfd85('0x18')](0x194);}return _0x20fd10;};}function handleError(_0x5e9f65,_0x1bdca9){_0x1bdca9=_0x1bdca9||0x1f4;return function(_0x2c7603){logger['error'](_0x2c7603['stack']);if(_0x2c7603[_0xfd85('0x26')]){delete _0x2c7603[_0xfd85('0x26')];}_0x5e9f65[_0xfd85('0x19')](_0x1bdca9)['send'](_0x2c7603);};}exports['index']=function(_0x3c70bc,_0x23d26c){var _0x4b53ed={},_0x788947={},_0x5690f8={'count':0x0,'rows':[]};var _0x4dfc60=_[_0xfd85('0x27')](db[_0xfd85('0x28')][_0xfd85('0x29')],function(_0x56b2ff){return{'name':_0x56b2ff[_0xfd85('0x2a')],'type':_0x56b2ff[_0xfd85('0x2b')]['key']};});_0x788947[_0xfd85('0x2c')]=_[_0xfd85('0x27')](_0x4dfc60,_0xfd85('0x26'));_0x788947[_0xfd85('0x2d')]=_[_0xfd85('0x2e')](_0x3c70bc['query']);_0x788947[_0xfd85('0x2f')]=_['intersection'](_0x788947[_0xfd85('0x2c')],_0x788947[_0xfd85('0x2d')]);_0x4b53ed[_0xfd85('0x30')]=_[_0xfd85('0x31')](_0x788947[_0xfd85('0x2c')],qs['fields'](_0x3c70bc['query'][_0xfd85('0x32')]));_0x4b53ed['attributes']=_0x4b53ed[_0xfd85('0x30')][_0xfd85('0x33')]?_0x4b53ed[_0xfd85('0x30')]:_0x788947[_0xfd85('0x2c')];if(!_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x34')](_0xfd85('0x35'))){_0x4b53ed['limit']=qs[_0xfd85('0x1e')](_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x1e')]);_0x4b53ed[_0xfd85('0x1c')]=qs[_0xfd85('0x1c')](_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x1c')]);}_0x4b53ed[_0xfd85('0x36')]=qs[_0xfd85('0x37')](_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x37')]);_0x4b53ed['where']=qs['filters'](_[_0xfd85('0x38')](_0x3c70bc[_0xfd85('0x2d')],_0x788947['filters']),_0x4dfc60);if(_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x39')]){_0x4b53ed['where']=_[_0xfd85('0x3a')](_0x4b53ed[_0xfd85('0x3b')],{'$or':_[_0xfd85('0x27')](_0x4dfc60,function(_0x165ec0){if(_0x165ec0[_0xfd85('0x2b')]!==_0xfd85('0x3c')){var _0x2dba9a={};_0x2dba9a[_0x165ec0[_0xfd85('0x26')]]={'$like':'%'+_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x39')]+'%'};return _0x2dba9a;}})});}_0x4b53ed=_[_0xfd85('0x3a')]({},_0x4b53ed,_0x3c70bc[_0xfd85('0x3d')]);var _0x176efd={'where':_0x4b53ed['where']};return db[_0xfd85('0x28')]['count'](_0x176efd)[_0xfd85('0x24')](function(_0x593e27){_0x5690f8['count']=_0x593e27;if(_0x3c70bc[_0xfd85('0x2d')][_0xfd85('0x3e')]){_0x4b53ed['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xfd85('0x3f')](_0x4b53ed);})[_0xfd85('0x24')](function(_0x56ed7b){_0x5690f8['rows']=_0x56ed7b;return _0x5690f8;})[_0xfd85('0x24')](respondWithFilteredResult(_0x23d26c,_0x4b53ed))[_0xfd85('0x40')](handleError(_0x23d26c,null));};exports[_0xfd85('0x41')]=function(_0x271bfd,_0x19c88e){var _0xa182b2={'raw':![],'where':{'id':_0x271bfd['params']['id']}},_0x421933={};_0x421933[_0xfd85('0x2c')]=_[_0xfd85('0x2e')](db[_0xfd85('0x28')][_0xfd85('0x29')]);_0x421933[_0xfd85('0x2d')]=_[_0xfd85('0x2e')](_0x271bfd[_0xfd85('0x2d')]);_0x421933[_0xfd85('0x2f')]=_[_0xfd85('0x31')](_0x421933[_0xfd85('0x2c')],_0x421933[_0xfd85('0x2d')]);_0xa182b2[_0xfd85('0x30')]=_[_0xfd85('0x31')](_0x421933[_0xfd85('0x2c')],qs['fields'](_0x271bfd['query'][_0xfd85('0x32')]));_0xa182b2[_0xfd85('0x30')]=_0xa182b2['attributes']['length']?_0xa182b2[_0xfd85('0x30')]:_0x421933['model'];if(_0x271bfd[_0xfd85('0x2d')]['includeAll']){_0xa182b2['include']=[{'all':!![]}];}_0xa182b2=_[_0xfd85('0x3a')]({},_0xa182b2,_0x271bfd[_0xfd85('0x3d')]);return db[_0xfd85('0x28')][_0xfd85('0x42')](_0xa182b2)[_0xfd85('0x24')](handleEntityNotFound(_0x19c88e,null))[_0xfd85('0x24')](respondWithResult(_0x19c88e,null))[_0xfd85('0x40')](handleError(_0x19c88e,null));};exports[_0xfd85('0x43')]=function(_0x585fa8,_0x4e345e){return db[_0xfd85('0x28')][_0xfd85('0x43')](_0x585fa8[_0xfd85('0x44')],{})[_0xfd85('0x24')](respondWithResult(_0x4e345e,0xc9))[_0xfd85('0x40')](handleError(_0x4e345e,null));};exports[_0xfd85('0x23')]=function(_0x79c37b,_0x152890){if(_0x79c37b[_0xfd85('0x44')]['id']){delete _0x79c37b[_0xfd85('0x44')]['id'];}return db['Dynamics365Configuration'][_0xfd85('0x42')]({'where':{'id':_0x79c37b[_0xfd85('0x45')]['id']}})[_0xfd85('0x24')](handleEntityNotFound(_0x152890,null))[_0xfd85('0x24')](saveUpdates(_0x79c37b[_0xfd85('0x44')],null))[_0xfd85('0x24')](respondWithResult(_0x152890,null))[_0xfd85('0x40')](handleError(_0x152890,null));};exports[_0xfd85('0x25')]=function(_0x411457,_0x353701){return db[_0xfd85('0x28')][_0xfd85('0x42')]({'where':{'id':_0x411457['params']['id']}})[_0xfd85('0x24')](handleEntityNotFound(_0x353701,null))[_0xfd85('0x24')](removeEntity(_0x353701,null))[_0xfd85('0x40')](handleError(_0x353701,null));};exports[_0xfd85('0x46')]=function(_0x1276fe,_0x4b9aa4,_0x35998e){var _0xa24db8={};var _0x13670a={};var _0x341183;var _0x2f3648;return db[_0xfd85('0x28')][_0xfd85('0x47')]({'where':{'id':_0x1276fe[_0xfd85('0x45')]['id']}})[_0xfd85('0x24')](handleEntityNotFound(_0x4b9aa4,null))[_0xfd85('0x24')](function(_0x55a169){if(_0x55a169){_0x341183=_0x55a169;_0x13670a[_0xfd85('0x2c')]=_[_0xfd85('0x2e')](db[_0xfd85('0x48')]['rawAttributes']);_0x13670a[_0xfd85('0x2d')]=_[_0xfd85('0x2e')](_0x1276fe['query']);_0x13670a[_0xfd85('0x2f')]=_[_0xfd85('0x31')](_0x13670a[_0xfd85('0x2c')],_0x13670a[_0xfd85('0x2d')]);_0xa24db8[_0xfd85('0x30')]=_[_0xfd85('0x31')](_0x13670a[_0xfd85('0x2c')],qs[_0xfd85('0x32')](_0x1276fe[_0xfd85('0x2d')][_0xfd85('0x32')]));_0xa24db8[_0xfd85('0x30')]=_0xa24db8[_0xfd85('0x30')][_0xfd85('0x33')]?_0xa24db8[_0xfd85('0x30')]:_0x13670a[_0xfd85('0x2c')];_0xa24db8['order']=qs[_0xfd85('0x37')](_0x1276fe[_0xfd85('0x2d')][_0xfd85('0x37')]);_0xa24db8[_0xfd85('0x3b')]=qs['filters'](_[_0xfd85('0x38')](_0x1276fe[_0xfd85('0x2d')],_0x13670a[_0xfd85('0x2f')]));if(_0x1276fe[_0xfd85('0x2d')][_0xfd85('0x39')]){_0xa24db8[_0xfd85('0x3b')]=_[_0xfd85('0x3a')](_0xa24db8[_0xfd85('0x3b')],{'$or':_['map'](_0xa24db8[_0xfd85('0x30')],function(_0xb198aa){var _0x248326={};_0x248326[_0xb198aa]={'$like':'%'+_0x1276fe['query']['filter']+'%'};return _0x248326;})});}_0xa24db8=_[_0xfd85('0x3a')]({},_0xa24db8,_0x1276fe[_0xfd85('0x3d')]);return _0x341183['getFields'](_0xa24db8);}})[_0xfd85('0x24')](function(_0x18d290){if(_0x18d290){_0x2f3648=_0x18d290[_0xfd85('0x33')];if(!_0x1276fe['query'][_0xfd85('0x34')](_0xfd85('0x35'))){_0xa24db8[_0xfd85('0x1e')]=qs[_0xfd85('0x1e')](_0x1276fe[_0xfd85('0x2d')][_0xfd85('0x1e')]);_0xa24db8[_0xfd85('0x1c')]=qs[_0xfd85('0x1c')](_0x1276fe['query'][_0xfd85('0x1c')]);}return _0x341183[_0xfd85('0x46')](_0xa24db8);}})[_0xfd85('0x24')](function(_0x252bbe){if(_0x252bbe){return _0x252bbe?{'count':_0x2f3648,'rows':_0x252bbe}:null;}})[_0xfd85('0x24')](respondWithResult(_0x4b9aa4,null))['catch'](handleError(_0x4b9aa4,null));};exports[_0xfd85('0x49')]=function(_0x5d018e,_0x57a04d,_0x1b2238){var _0x3845b4={};var _0x4ecd2c={};var _0x5701bc;var _0x456ed6;return db['Dynamics365Configuration'][_0xfd85('0x47')]({'where':{'id':_0x5d018e[_0xfd85('0x45')]['id']}})['then'](handleEntityNotFound(_0x57a04d,null))[_0xfd85('0x24')](function(_0x523591){if(_0x523591){_0x5701bc=_0x523591;_0x4ecd2c[_0xfd85('0x2c')]=_[_0xfd85('0x2e')](db['Dynamics365Field'][_0xfd85('0x29')]);_0x4ecd2c['query']=_['keys'](_0x5d018e['query']);_0x4ecd2c['filters']=_[_0xfd85('0x31')](_0x4ecd2c['model'],_0x4ecd2c[_0xfd85('0x2d')]);_0x3845b4[_0xfd85('0x30')]=_[_0xfd85('0x31')](_0x4ecd2c[_0xfd85('0x2c')],qs[_0xfd85('0x32')](_0x5d018e[_0xfd85('0x2d')][_0xfd85('0x32')]));_0x3845b4[_0xfd85('0x30')]=_0x3845b4[_0xfd85('0x30')][_0xfd85('0x33')]?_0x3845b4[_0xfd85('0x30')]:_0x4ecd2c[_0xfd85('0x2c')];_0x3845b4[_0xfd85('0x36')]=qs[_0xfd85('0x37')](_0x5d018e[_0xfd85('0x2d')][_0xfd85('0x37')]);_0x3845b4[_0xfd85('0x3b')]=qs[_0xfd85('0x2f')](_['pick'](_0x5d018e[_0xfd85('0x2d')],_0x4ecd2c['filters']));if(_0x5d018e[_0xfd85('0x2d')][_0xfd85('0x39')]){_0x3845b4[_0xfd85('0x3b')]=_[_0xfd85('0x3a')](_0x3845b4[_0xfd85('0x3b')],{'$or':_[_0xfd85('0x27')](_0x3845b4[_0xfd85('0x30')],function(_0x19c6ea){var _0x5ebb70={};_0x5ebb70[_0x19c6ea]={'$like':'%'+_0x5d018e[_0xfd85('0x2d')][_0xfd85('0x39')]+'%'};return _0x5ebb70;})});}_0x3845b4=_[_0xfd85('0x3a')]({},_0x3845b4,_0x5d018e['options']);return _0x5701bc[_0xfd85('0x49')](_0x3845b4);}})['then'](function(_0x5eb353){if(_0x5eb353){_0x456ed6=_0x5eb353[_0xfd85('0x33')];if(!_0x5d018e[_0xfd85('0x2d')][_0xfd85('0x34')](_0xfd85('0x35'))){_0x3845b4[_0xfd85('0x1e')]=qs['limit'](_0x5d018e['query'][_0xfd85('0x1e')]);_0x3845b4[_0xfd85('0x1c')]=qs[_0xfd85('0x1c')](_0x5d018e[_0xfd85('0x2d')][_0xfd85('0x1c')]);}return _0x5701bc[_0xfd85('0x49')](_0x3845b4);}})[_0xfd85('0x24')](function(_0x52955e){if(_0x52955e){return _0x52955e?{'count':_0x456ed6,'rows':_0x52955e}:null;}})['then'](respondWithResult(_0x57a04d,null))[_0xfd85('0x40')](handleError(_0x57a04d,null));};exports['getDescriptions']=function(_0x8a696e,_0x1ab81b,_0x365f1b){var _0x28277d={};var _0x3ca55f={};var _0xd1477f;var _0x1ca6be;return db[_0xfd85('0x28')][_0xfd85('0x47')]({'where':{'id':_0x8a696e['params']['id']}})[_0xfd85('0x24')](handleEntityNotFound(_0x1ab81b,null))['then'](function(_0x105f41){if(_0x105f41){_0xd1477f=_0x105f41;_0x3ca55f[_0xfd85('0x2c')]=_[_0xfd85('0x2e')](db[_0xfd85('0x48')][_0xfd85('0x29')]);_0x3ca55f['query']=_['keys'](_0x8a696e[_0xfd85('0x2d')]);_0x3ca55f['filters']=_['intersection'](_0x3ca55f[_0xfd85('0x2c')],_0x3ca55f[_0xfd85('0x2d')]);_0x28277d[_0xfd85('0x30')]=_[_0xfd85('0x31')](_0x3ca55f[_0xfd85('0x2c')],qs[_0xfd85('0x32')](_0x8a696e[_0xfd85('0x2d')]['fields']));_0x28277d[_0xfd85('0x30')]=_0x28277d['attributes']['length']?_0x28277d[_0xfd85('0x30')]:_0x3ca55f['model'];_0x28277d[_0xfd85('0x36')]=qs[_0xfd85('0x37')](_0x8a696e[_0xfd85('0x2d')][_0xfd85('0x37')]);_0x28277d['where']=qs['filters'](_[_0xfd85('0x38')](_0x8a696e[_0xfd85('0x2d')],_0x3ca55f[_0xfd85('0x2f')]));if(_0x8a696e[_0xfd85('0x2d')]['filter']){_0x28277d[_0xfd85('0x3b')]=_[_0xfd85('0x3a')](_0x28277d[_0xfd85('0x3b')],{'$or':_['map'](_0x28277d[_0xfd85('0x30')],function(_0x449a8a){var _0x19bceb={};_0x19bceb[_0x449a8a]={'$like':'%'+_0x8a696e[_0xfd85('0x2d')][_0xfd85('0x39')]+'%'};return _0x19bceb;})});}_0x28277d=_[_0xfd85('0x3a')]({},_0x28277d,_0x8a696e[_0xfd85('0x3d')]);return _0xd1477f[_0xfd85('0x4a')](_0x28277d);}})[_0xfd85('0x24')](function(_0x3db28e){if(_0x3db28e){_0x1ca6be=_0x3db28e['length'];if(!_0x8a696e[_0xfd85('0x2d')][_0xfd85('0x34')](_0xfd85('0x35'))){_0x28277d[_0xfd85('0x1e')]=qs[_0xfd85('0x1e')](_0x8a696e[_0xfd85('0x2d')][_0xfd85('0x1e')]);_0x28277d[_0xfd85('0x1c')]=qs['offset'](_0x8a696e['query']['offset']);}return _0xd1477f[_0xfd85('0x4a')](_0x28277d);}})[_0xfd85('0x24')](function(_0x2a6686){if(_0x2a6686){return _0x2a6686?{'count':_0x1ca6be,'rows':_0x2a6686}:null;}})['then'](respondWithResult(_0x1ab81b,null))[_0xfd85('0x40')](handleError(_0x1ab81b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index db5d254..f6b3c10 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x5023fd,_0x290c3f){var _0x9c249f=function(_0x263250){while(--_0x263250){_0x5023fd['push'](_0x5023fd['shift']());}};_0x9c249f(++_0x290c3f);}(_0xdace,0xc5));var _0xedac=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdace[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4f0184,_0x40d853){_0x4f0184=_0x4f0184-0x0;var _0x3280d2=_0x6f0d[_0x4f0184];return _0x3280d2;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 2b33789..d6ca113 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 _0x0c60=['../../config/environment','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2f9a03,_0x3b929b){var _0x56825b=function(_0x498cd9){while(--_0x498cd9){_0x2f9a03['push'](_0x2f9a03['shift']());}};_0x56825b(++_0x3b929b);}(_0x0c60,0x171));var _0x00c6=function(_0x3a4ef3,_0x1cc618){_0x3a4ef3=_0x3a4ef3-0x0;var _0x512679=_0x0c60[_0x3a4ef3];return _0x512679;};'use strict';var _=require(_0x00c6('0x0'));var util=require(_0x00c6('0x1'));var moment=require(_0x00c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x00c6('0x3'));var fs=require('fs');var Redis=require(_0x00c6('0x4'));var db=require(_0x00c6('0x5'))['db'];var utils=require(_0x00c6('0x6'));var logger=require(_0x00c6('0x7'))(_0x00c6('0x8'));var config=require(_0x00c6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x00c6('0xa')][_0x00c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205eee,_0x578fb7,_0x3de760){return new BPromise(function(_0x2aa841,_0x295b18){return client[_0x00c6('0xc')](_0x205eee,_0x3de760)['then'](function(_0x10b48c){logger['info'](_0x00c6('0xd'),_0x578fb7,_0x00c6('0xe'));logger[_0x00c6('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x578fb7,'request\x20sent',JSON[_0x00c6('0x10')](_0x10b48c));if(_0x10b48c[_0x00c6('0x11')]){if(_0x10b48c[_0x00c6('0x11')][_0x00c6('0x12')]===0x1f4){logger['error'](_0x00c6('0xd'),_0x578fb7,_0x10b48c[_0x00c6('0x11')][_0x00c6('0x13')]);return _0x295b18(_0x10b48c[_0x00c6('0x11')][_0x00c6('0x13')]);}logger[_0x00c6('0x11')](_0x00c6('0xd'),_0x578fb7,_0x10b48c[_0x00c6('0x11')]['message']);return _0x2aa841(_0x10b48c[_0x00c6('0x11')][_0x00c6('0x13')]);}else{logger['info'](_0x00c6('0xd'),_0x578fb7,_0x00c6('0xe'));_0x2aa841(_0x10b48c[_0x00c6('0x14')][_0x00c6('0x13')]);}})['catch'](function(_0x75afd9){logger[_0x00c6('0x11')](_0x00c6('0xd'),_0x578fb7,_0x75afd9);_0x295b18(_0x75afd9);});});} \ No newline at end of file +var _0xd169=['stringify','error','code','message','result','catch','Dynamics365Configuration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x50aec5,_0x12464c){var _0x3b86c4=function(_0x4d457b){while(--_0x4d457b){_0x50aec5['push'](_0x50aec5['shift']());}};_0x3b86c4(++_0x12464c);}(_0xd169,0x1cf));var _0x9d16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd169[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9d16('0x0'));var util=require(_0x9d16('0x1'));var moment=require(_0x9d16('0x2'));var BPromise=require(_0x9d16('0x3'));var rs=require(_0x9d16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9d16('0x5'));var logger=require(_0x9d16('0x6'))(_0x9d16('0x7'));var config=require(_0x9d16('0x8'));var jayson=require(_0x9d16('0x9'));var client=jayson[_0x9d16('0xa')][_0x9d16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3189a0,_0x2089c2,_0x4bae03){return new BPromise(function(_0x2b74ff,_0x5e796a){return client[_0x9d16('0xc')](_0x3189a0,_0x4bae03)['then'](function(_0x110d40){logger[_0x9d16('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2089c2,'request\x20sent');logger[_0x9d16('0xe')](_0x9d16('0xf'),_0x2089c2,_0x9d16('0x10'),JSON[_0x9d16('0x11')](_0x110d40));if(_0x110d40['error']){if(_0x110d40[_0x9d16('0x12')][_0x9d16('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2089c2,_0x110d40['error'][_0x9d16('0x14')]);return _0x5e796a(_0x110d40[_0x9d16('0x12')][_0x9d16('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2089c2,_0x110d40['error'][_0x9d16('0x14')]);return _0x2b74ff(_0x110d40['error'][_0x9d16('0x14')]);}else{logger[_0x9d16('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2089c2,_0x9d16('0x10'));_0x2b74ff(_0x110d40[_0x9d16('0x15')][_0x9d16('0x14')]);}})[_0x9d16('0x16')](function(_0x11af63){logger[_0x9d16('0x12')](_0x9d16('0x17'),_0x2089c2,_0x11af63);_0x5e796a(_0x11af63);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ad3e8e4..f760c85 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 _0x00f8=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated','index','get','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x00f8,0x183));var _0x800f=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0x00f8[_0x5c049a];return _0x168e70;};'use strict';var multer=require(_0x800f('0x0'));var util=require(_0x800f('0x1'));var path=require(_0x800f('0x2'));var timeout=require(_0x800f('0x3'));var express=require(_0x800f('0x4'));var router=express['Router']();var fs_extra=require(_0x800f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x800f('0x6'));var config=require('../../config/environment');var controller=require(_0x800f('0x7'));router['get']('/',auth[_0x800f('0x8')](),controller[_0x800f('0x9')]);router[_0x800f('0xa')]('/:id',auth[_0x800f('0x8')](),controller[_0x800f('0xb')]);router[_0x800f('0xc')]('/',auth[_0x800f('0x8')](),controller[_0x800f('0xd')]);router[_0x800f('0xe')]('/:id',auth[_0x800f('0x8')](),controller[_0x800f('0xf')]);router[_0x800f('0x10')]('/:id',auth[_0x800f('0x8')](),controller[_0x800f('0x11')]);module[_0x800f('0x12')]=router; \ No newline at end of file +var _0x3ce8=['./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2ee745,_0x156da9){var _0x1940d6=function(_0x57d903){while(--_0x57d903){_0x2ee745['push'](_0x2ee745['shift']());}};_0x1940d6(++_0x156da9);}(_0x3ce8,0x64));var _0x83ce=function(_0x2cbe9a,_0x33fa23){_0x2cbe9a=_0x2cbe9a-0x0;var _0x118b64=_0x3ce8[_0x2cbe9a];return _0x118b64;};'use strict';var multer=require('multer');var util=require(_0x83ce('0x0'));var path=require('path');var timeout=require(_0x83ce('0x1'));var express=require('express');var router=express[_0x83ce('0x2')]();var fs_extra=require(_0x83ce('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x83ce('0x4'));var config=require('../../config/environment');var controller=require(_0x83ce('0x5'));router[_0x83ce('0x6')]('/',auth['isAuthenticated'](),controller[_0x83ce('0x7')]);router[_0x83ce('0x6')](_0x83ce('0x8'),auth[_0x83ce('0x9')](),controller[_0x83ce('0xa')]);router[_0x83ce('0xb')]('/',auth[_0x83ce('0x9')](),controller['create']);router['put'](_0x83ce('0x8'),auth[_0x83ce('0x9')](),controller['update']);router[_0x83ce('0xc')](_0x83ce('0x8'),auth['isAuthenticated'](),controller[_0x83ce('0xd')]);module[_0x83ce('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 72c4fc9..2852d6f 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 _0xcc85=['exports','ENUM','variable','keyValue','string','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x347f41,_0x2cbc52){var _0x2637c2=function(_0x27f641){while(--_0x27f641){_0x347f41['push'](_0x347f41['shift']());}};_0x2637c2(++_0x2cbc52);}(_0xcc85,0x179));var _0x5cc8=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xcc85[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x5cc8('0x0'));module[_0x5cc8('0x1')]={'type':{'type':Sequelize[_0x5cc8('0x2')]('string',_0x5cc8('0x3'),'customVariable',_0x5cc8('0x4'),'picklist'),'defaultValue':_0x5cc8('0x5')},'content':{'type':Sequelize[_0x5cc8('0x6')]},'key':{'type':Sequelize[_0x5cc8('0x6')]},'keyType':{'type':Sequelize[_0x5cc8('0x2')](_0x5cc8('0x5'),_0x5cc8('0x3'),_0x5cc8('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5cc8('0x6')]},'nameField':{'type':Sequelize[_0x5cc8('0x6')]},'customField':{'type':Sequelize[_0x5cc8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x40a1=['keyValue','picklist','string','STRING','ENUM','variable','sequelize','exports','customVariable'];(function(_0x480f3a,_0x2b89a1){var _0x3c84e0=function(_0x1b071b){while(--_0x1b071b){_0x480f3a['push'](_0x480f3a['shift']());}};_0x3c84e0(++_0x2b89a1);}(_0x40a1,0xc3));var _0x140a=function(_0x467c49,_0x854408){_0x467c49=_0x467c49-0x0;var _0x43bea0=_0x40a1[_0x467c49];return _0x43bea0;};'use strict';var Sequelize=require(_0x140a('0x0'));module[_0x140a('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x140a('0x2'),_0x140a('0x3'),_0x140a('0x4')),'defaultValue':_0x140a('0x5')},'content':{'type':Sequelize[_0x140a('0x6')]},'key':{'type':Sequelize[_0x140a('0x6')]},'keyType':{'type':Sequelize[_0x140a('0x7')](_0x140a('0x5'),_0x140a('0x8'),_0x140a('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x140a('0x6')]},'nameField':{'type':Sequelize[_0x140a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2b248e9..3b010b8 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 _0xbabf=['desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','model','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4c4a8b,_0x402020){var _0x20fa14=function(_0xbe8c84){while(--_0xbe8c84){_0x4c4a8b['push'](_0x4c4a8b['shift']());}};_0x20fa14(++_0x402020);}(_0xbabf,0x170));var _0xfbab=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xbabf[_0x17928f];return _0x500b63;};'use strict';var emlformat=require(_0xfbab('0x0'));var rimraf=require(_0xfbab('0x1'));var zipdir=require(_0xfbab('0x2'));var jsonpatch=require(_0xfbab('0x3'));var rp=require(_0xfbab('0x4'));var moment=require(_0xfbab('0x5'));var BPromise=require(_0xfbab('0x6'));var Mustache=require(_0xfbab('0x7'));var util=require('util');var path=require(_0xfbab('0x8'));var sox=require(_0xfbab('0x9'));var csv=require(_0xfbab('0xa'));var ejs=require(_0xfbab('0xb'));var fs=require('fs');var fs_extra=require(_0xfbab('0xc'));var _=require(_0xfbab('0xd'));var squel=require(_0xfbab('0xe'));var crypto=require(_0xfbab('0xf'));var jsforce=require(_0xfbab('0x10'));var deskjs=require(_0xfbab('0x11'));var toCsv=require(_0xfbab('0xa'));var querystring=require('querystring');var Papa=require(_0xfbab('0x12'));var Redis=require(_0xfbab('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfbab('0x14'));var hardwareService=require(_0xfbab('0x15'));var logger=require(_0xfbab('0x16'))(_0xfbab('0x17'));var utils=require(_0xfbab('0x18'));var config=require(_0xfbab('0x19'));var licenseUtil=require(_0xfbab('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42beb4,_0x59ba55){_0x59ba55=_0x59ba55||0xcc;return function(_0x309326){if(_0x309326){return _0x42beb4[_0xfbab('0x1b')](_0x59ba55);}return _0x42beb4['status'](_0x59ba55)[_0xfbab('0x1c')]();};}function respondWithResult(_0x59cbd2,_0x5f38e8){_0x5f38e8=_0x5f38e8||0xc8;return function(_0x4e09a4){if(_0x4e09a4){return _0x59cbd2[_0xfbab('0x1d')](_0x5f38e8)['json'](_0x4e09a4);}};}function respondWithFilteredResult(_0x36af27,_0x5d61b4){return function(_0x2c255a){if(_0x2c255a){var _0x254d06=typeof _0x5d61b4[_0xfbab('0x1e')]===_0xfbab('0x1f')&&typeof _0x5d61b4['limit']==='undefined';var _0x3ae129=_0x2c255a['count'];var _0xb137ff=_0x254d06?0x0:_0x5d61b4[_0xfbab('0x1e')];var _0x56d0ab=_0x254d06?_0x2c255a[_0xfbab('0x20')]:_0x5d61b4[_0xfbab('0x1e')]+_0x5d61b4[_0xfbab('0x21')];var _0xb31221;if(_0x56d0ab>=_0x3ae129){_0x56d0ab=_0x3ae129;_0xb31221=0xc8;}else{_0xb31221=0xce;}_0x36af27[_0xfbab('0x1d')](_0xb31221);return _0x36af27[_0xfbab('0x22')](_0xfbab('0x23'),_0xb137ff+'-'+_0x56d0ab+'/'+_0x3ae129)[_0xfbab('0x24')](_0x2c255a);}return null;};}function patchUpdates(_0x26b81f){return function(_0x31e8d7){try{jsonpatch[_0xfbab('0x25')](_0x31e8d7,_0x26b81f,!![]);}catch(_0x15c740){return BPromise[_0xfbab('0x26')](_0x15c740);}return _0x31e8d7[_0xfbab('0x27')]();};}function saveUpdates(_0x17fe94,_0x1d314c){return function(_0x46da60){if(_0x46da60){return _0x46da60[_0xfbab('0x28')](_0x17fe94)[_0xfbab('0x29')](function(_0x4fd052){return _0x4fd052;});}return null;};}function removeEntity(_0x2ff5a3,_0x3754ea){return function(_0xf011b8){if(_0xf011b8){return _0xf011b8[_0xfbab('0x2a')]()[_0xfbab('0x29')](function(){_0x2ff5a3[_0xfbab('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37034a,_0x1abdda){return function(_0x29c3ae){if(!_0x29c3ae){_0x37034a[_0xfbab('0x1b')](0x194);}return _0x29c3ae;};}function handleError(_0x2384c5,_0x38d357){_0x38d357=_0x38d357||0x1f4;return function(_0x20e712){logger['error'](_0x20e712[_0xfbab('0x2b')]);if(_0x20e712[_0xfbab('0x2c')]){delete _0x20e712['name'];}_0x2384c5[_0xfbab('0x1d')](_0x38d357)['send'](_0x20e712);};}exports[_0xfbab('0x2d')]=function(_0x3ac6fa,_0x254dc7){var _0x133d78={},_0x1a619c={},_0x1a87ee={'count':0x0,'rows':[]};var _0x1f7b91=_[_0xfbab('0x2e')](db['Dynamics365Field']['rawAttributes'],function(_0x459fad){return{'name':_0x459fad[_0xfbab('0x2f')],'type':_0x459fad[_0xfbab('0x30')]['key']};});_0x1a619c[_0xfbab('0x31')]=_[_0xfbab('0x2e')](_0x1f7b91,_0xfbab('0x2c'));_0x1a619c['query']=_['keys'](_0x3ac6fa['query']);_0x1a619c[_0xfbab('0x32')]=_[_0xfbab('0x33')](_0x1a619c['model'],_0x1a619c[_0xfbab('0x34')]);_0x133d78['attributes']=_[_0xfbab('0x33')](_0x1a619c['model'],qs['fields'](_0x3ac6fa[_0xfbab('0x34')][_0xfbab('0x35')]));_0x133d78[_0xfbab('0x36')]=_0x133d78[_0xfbab('0x36')][_0xfbab('0x37')]?_0x133d78[_0xfbab('0x36')]:_0x1a619c[_0xfbab('0x31')];if(!_0x3ac6fa[_0xfbab('0x34')]['hasOwnProperty'](_0xfbab('0x38'))){_0x133d78[_0xfbab('0x21')]=qs[_0xfbab('0x21')](_0x3ac6fa[_0xfbab('0x34')]['limit']);_0x133d78[_0xfbab('0x1e')]=qs['offset'](_0x3ac6fa[_0xfbab('0x34')]['offset']);}_0x133d78[_0xfbab('0x39')]=qs['sort'](_0x3ac6fa[_0xfbab('0x34')][_0xfbab('0x3a')]);_0x133d78[_0xfbab('0x3b')]=qs['filters'](_[_0xfbab('0x3c')](_0x3ac6fa[_0xfbab('0x34')],_0x1a619c['filters']),_0x1f7b91);if(_0x3ac6fa[_0xfbab('0x34')][_0xfbab('0x3d')]){_0x133d78[_0xfbab('0x3b')]=_['merge'](_0x133d78['where'],{'$or':_[_0xfbab('0x2e')](_0x1f7b91,function(_0x3de7f3){if(_0x3de7f3[_0xfbab('0x30')]!==_0xfbab('0x3e')){var _0x2ed4c8={};_0x2ed4c8[_0x3de7f3[_0xfbab('0x2c')]]={'$like':'%'+_0x3ac6fa[_0xfbab('0x34')]['filter']+'%'};return _0x2ed4c8;}})});}_0x133d78=_[_0xfbab('0x3f')]({},_0x133d78,_0x3ac6fa['options']);var _0x568e62={'where':_0x133d78['where']};return db[_0xfbab('0x40')]['count'](_0x568e62)[_0xfbab('0x29')](function(_0x1ffd41){_0x1a87ee[_0xfbab('0x20')]=_0x1ffd41;if(_0x3ac6fa['query'][_0xfbab('0x41')]){_0x133d78[_0xfbab('0x42')]=[{'all':!![]}];}return db[_0xfbab('0x40')][_0xfbab('0x43')](_0x133d78);})[_0xfbab('0x29')](function(_0x142446){_0x1a87ee[_0xfbab('0x44')]=_0x142446;return _0x1a87ee;})['then'](respondWithFilteredResult(_0x254dc7,_0x133d78))[_0xfbab('0x45')](handleError(_0x254dc7,null));};exports[_0xfbab('0x46')]=function(_0x2a8e61,_0x667278){var _0x30ae6a={'raw':!![],'where':{'id':_0x2a8e61[_0xfbab('0x47')]['id']}},_0x1a208a={};_0x1a208a['model']=_[_0xfbab('0x48')](db['Dynamics365Field'][_0xfbab('0x49')]);_0x1a208a[_0xfbab('0x34')]=_[_0xfbab('0x48')](_0x2a8e61[_0xfbab('0x34')]);_0x1a208a[_0xfbab('0x32')]=_[_0xfbab('0x33')](_0x1a208a[_0xfbab('0x31')],_0x1a208a[_0xfbab('0x34')]);_0x30ae6a[_0xfbab('0x36')]=_[_0xfbab('0x33')](_0x1a208a['model'],qs[_0xfbab('0x35')](_0x2a8e61[_0xfbab('0x34')][_0xfbab('0x35')]));_0x30ae6a[_0xfbab('0x36')]=_0x30ae6a[_0xfbab('0x36')]['length']?_0x30ae6a[_0xfbab('0x36')]:_0x1a208a[_0xfbab('0x31')];if(_0x2a8e61[_0xfbab('0x34')][_0xfbab('0x41')]){_0x30ae6a['include']=[{'all':!![]}];}_0x30ae6a=_[_0xfbab('0x3f')]({},_0x30ae6a,_0x2a8e61['options']);return db[_0xfbab('0x40')][_0xfbab('0x4a')](_0x30ae6a)[_0xfbab('0x29')](handleEntityNotFound(_0x667278,null))[_0xfbab('0x29')](respondWithResult(_0x667278,null))[_0xfbab('0x45')](handleError(_0x667278,null));};exports['create']=function(_0x5b78fb,_0x3a1b9a){return db[_0xfbab('0x40')][_0xfbab('0x4b')](_0x5b78fb[_0xfbab('0x4c')],{})[_0xfbab('0x29')](respondWithResult(_0x3a1b9a,0xc9))[_0xfbab('0x45')](handleError(_0x3a1b9a,null));};exports[_0xfbab('0x28')]=function(_0x119a48,_0x4fd647){if(_0x119a48[_0xfbab('0x4c')]['id']){delete _0x119a48['body']['id'];}return db[_0xfbab('0x40')][_0xfbab('0x4a')]({'where':{'id':_0x119a48['params']['id']}})[_0xfbab('0x29')](handleEntityNotFound(_0x4fd647,null))[_0xfbab('0x29')](saveUpdates(_0x119a48[_0xfbab('0x4c')],null))[_0xfbab('0x29')](respondWithResult(_0x4fd647,null))[_0xfbab('0x45')](handleError(_0x4fd647,null));};exports[_0xfbab('0x2a')]=function(_0x55508e,_0x3f2fd5){return db[_0xfbab('0x40')][_0xfbab('0x4a')]({'where':{'id':_0x55508e[_0xfbab('0x47')]['id']}})[_0xfbab('0x29')](handleEntityNotFound(_0x3f2fd5,null))[_0xfbab('0x29')](removeEntity(_0x3f2fd5,null))[_0xfbab('0x45')](handleError(_0x3f2fd5,null));}; \ No newline at end of file +var _0x1701=['rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Dynamics365Field','includeAll','rows','show','params','length','include','catch','body','find'];(function(_0x1d7b04,_0x7109e2){var _0x1d4c6e=function(_0x50508a){while(--_0x50508a){_0x1d7b04['push'](_0x1d7b04['shift']());}};_0x1d4c6e(++_0x7109e2);}(_0x1701,0x16d));var _0x1170=function(_0x2a2fdb,_0x5b5d57){_0x2a2fdb=_0x2a2fdb-0x0;var _0x34fbbf=_0x1701[_0x2a2fdb];return _0x34fbbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1170('0x0'));var zipdir=require(_0x1170('0x1'));var jsonpatch=require(_0x1170('0x2'));var rp=require('request-promise');var moment=require(_0x1170('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1170('0x4'));var path=require('path');var sox=require(_0x1170('0x5'));var csv=require(_0x1170('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1170('0x7'));var _=require(_0x1170('0x8'));var squel=require(_0x1170('0x9'));var crypto=require(_0x1170('0xa'));var jsforce=require(_0x1170('0xb'));var deskjs=require(_0x1170('0xc'));var toCsv=require(_0x1170('0x6'));var querystring=require('querystring');var Papa=require(_0x1170('0xd'));var Redis=require(_0x1170('0xe'));var authService=require(_0x1170('0xf'));var qs=require(_0x1170('0x10'));var as=require(_0x1170('0x11'));var hardwareService=require(_0x1170('0x12'));var logger=require('../../config/logger')(_0x1170('0x13'));var utils=require(_0x1170('0x14'));var config=require(_0x1170('0x15'));var licenseUtil=require(_0x1170('0x16'));var db=require(_0x1170('0x17'))['db'];function respondWithStatusCode(_0xf0e502,_0x58d290){_0x58d290=_0x58d290||0xcc;return function(_0x1203c3){if(_0x1203c3){return _0xf0e502[_0x1170('0x18')](_0x58d290);}return _0xf0e502[_0x1170('0x19')](_0x58d290)[_0x1170('0x1a')]();};}function respondWithResult(_0x222ac5,_0x2317fe){_0x2317fe=_0x2317fe||0xc8;return function(_0x36c105){if(_0x36c105){return _0x222ac5[_0x1170('0x19')](_0x2317fe)[_0x1170('0x1b')](_0x36c105);}};}function respondWithFilteredResult(_0x94c1e2,_0x3ebb64){return function(_0x22e0e3){if(_0x22e0e3){var _0xc9f3f7=typeof _0x3ebb64[_0x1170('0x1c')]===_0x1170('0x1d')&&typeof _0x3ebb64['limit']==='undefined';var _0x22faeb=_0x22e0e3[_0x1170('0x1e')];var _0x11d56a=_0xc9f3f7?0x0:_0x3ebb64[_0x1170('0x1c')];var _0x5d3e00=_0xc9f3f7?_0x22e0e3['count']:_0x3ebb64['offset']+_0x3ebb64[_0x1170('0x1f')];var _0x586191;if(_0x5d3e00>=_0x22faeb){_0x5d3e00=_0x22faeb;_0x586191=0xc8;}else{_0x586191=0xce;}_0x94c1e2['status'](_0x586191);return _0x94c1e2[_0x1170('0x20')]('Content-Range',_0x11d56a+'-'+_0x5d3e00+'/'+_0x22faeb)[_0x1170('0x1b')](_0x22e0e3);}return null;};}function patchUpdates(_0x563906){return function(_0x4961ff){try{jsonpatch[_0x1170('0x21')](_0x4961ff,_0x563906,!![]);}catch(_0x27b5fc){return BPromise['reject'](_0x27b5fc);}return _0x4961ff[_0x1170('0x22')]();};}function saveUpdates(_0x3a3e5d,_0x375a82){return function(_0x3620fe){if(_0x3620fe){return _0x3620fe[_0x1170('0x23')](_0x3a3e5d)[_0x1170('0x24')](function(_0x2565bb){return _0x2565bb;});}return null;};}function removeEntity(_0x3ce6b7,_0x6694b8){return function(_0x3e0e5b){if(_0x3e0e5b){return _0x3e0e5b[_0x1170('0x25')]()[_0x1170('0x24')](function(){_0x3ce6b7[_0x1170('0x19')](0xcc)[_0x1170('0x1a')]();});}};}function handleEntityNotFound(_0x1a3e4a,_0x5d109f){return function(_0x31257f){if(!_0x31257f){_0x1a3e4a[_0x1170('0x18')](0x194);}return _0x31257f;};}function handleError(_0x54aec2,_0x5df892){_0x5df892=_0x5df892||0x1f4;return function(_0x18d290){logger[_0x1170('0x26')](_0x18d290[_0x1170('0x27')]);if(_0x18d290[_0x1170('0x28')]){delete _0x18d290[_0x1170('0x28')];}_0x54aec2[_0x1170('0x19')](_0x5df892)[_0x1170('0x29')](_0x18d290);};}exports['index']=function(_0x471a9e,_0x19563c){var _0x4a90f0={},_0x3a7145={},_0x328207={'count':0x0,'rows':[]};var _0x11fe2a=_['map'](db['Dynamics365Field'][_0x1170('0x2a')],function(_0x34101d){return{'name':_0x34101d[_0x1170('0x2b')],'type':_0x34101d[_0x1170('0x2c')]['key']};});_0x3a7145[_0x1170('0x2d')]=_[_0x1170('0x2e')](_0x11fe2a,_0x1170('0x28'));_0x3a7145[_0x1170('0x2f')]=_[_0x1170('0x30')](_0x471a9e[_0x1170('0x2f')]);_0x3a7145['filters']=_[_0x1170('0x31')](_0x3a7145[_0x1170('0x2d')],_0x3a7145[_0x1170('0x2f')]);_0x4a90f0[_0x1170('0x32')]=_[_0x1170('0x31')](_0x3a7145[_0x1170('0x2d')],qs[_0x1170('0x33')](_0x471a9e[_0x1170('0x2f')][_0x1170('0x33')]));_0x4a90f0[_0x1170('0x32')]=_0x4a90f0[_0x1170('0x32')]['length']?_0x4a90f0[_0x1170('0x32')]:_0x3a7145[_0x1170('0x2d')];if(!_0x471a9e[_0x1170('0x2f')][_0x1170('0x34')](_0x1170('0x35'))){_0x4a90f0['limit']=qs[_0x1170('0x1f')](_0x471a9e[_0x1170('0x2f')][_0x1170('0x1f')]);_0x4a90f0['offset']=qs[_0x1170('0x1c')](_0x471a9e[_0x1170('0x2f')][_0x1170('0x1c')]);}_0x4a90f0[_0x1170('0x36')]=qs[_0x1170('0x37')](_0x471a9e['query'][_0x1170('0x37')]);_0x4a90f0['where']=qs[_0x1170('0x38')](_[_0x1170('0x39')](_0x471a9e[_0x1170('0x2f')],_0x3a7145[_0x1170('0x38')]),_0x11fe2a);if(_0x471a9e[_0x1170('0x2f')][_0x1170('0x3a')]){_0x4a90f0[_0x1170('0x3b')]=_[_0x1170('0x3c')](_0x4a90f0[_0x1170('0x3b')],{'$or':_[_0x1170('0x2e')](_0x11fe2a,function(_0x8cc4e){if(_0x8cc4e[_0x1170('0x2c')]!==_0x1170('0x3d')){var _0x14cfe4={};_0x14cfe4[_0x8cc4e[_0x1170('0x28')]]={'$like':'%'+_0x471a9e[_0x1170('0x2f')]['filter']+'%'};return _0x14cfe4;}})});}_0x4a90f0=_[_0x1170('0x3c')]({},_0x4a90f0,_0x471a9e[_0x1170('0x3e')]);var _0x22e077={'where':_0x4a90f0[_0x1170('0x3b')]};return db[_0x1170('0x3f')][_0x1170('0x1e')](_0x22e077)[_0x1170('0x24')](function(_0x31867b){_0x328207['count']=_0x31867b;if(_0x471a9e['query'][_0x1170('0x40')]){_0x4a90f0['include']=[{'all':!![]}];}return db[_0x1170('0x3f')]['findAll'](_0x4a90f0);})[_0x1170('0x24')](function(_0x3411fa){_0x328207[_0x1170('0x41')]=_0x3411fa;return _0x328207;})[_0x1170('0x24')](respondWithFilteredResult(_0x19563c,_0x4a90f0))['catch'](handleError(_0x19563c,null));};exports[_0x1170('0x42')]=function(_0x1ff452,_0xe1a1d5){var _0x1baa2e={'raw':!![],'where':{'id':_0x1ff452[_0x1170('0x43')]['id']}},_0x1047cb={};_0x1047cb['model']=_[_0x1170('0x30')](db['Dynamics365Field'][_0x1170('0x2a')]);_0x1047cb['query']=_[_0x1170('0x30')](_0x1ff452[_0x1170('0x2f')]);_0x1047cb[_0x1170('0x38')]=_['intersection'](_0x1047cb[_0x1170('0x2d')],_0x1047cb[_0x1170('0x2f')]);_0x1baa2e[_0x1170('0x32')]=_['intersection'](_0x1047cb[_0x1170('0x2d')],qs[_0x1170('0x33')](_0x1ff452['query'][_0x1170('0x33')]));_0x1baa2e[_0x1170('0x32')]=_0x1baa2e[_0x1170('0x32')][_0x1170('0x44')]?_0x1baa2e[_0x1170('0x32')]:_0x1047cb[_0x1170('0x2d')];if(_0x1ff452[_0x1170('0x2f')][_0x1170('0x40')]){_0x1baa2e[_0x1170('0x45')]=[{'all':!![]}];}_0x1baa2e=_[_0x1170('0x3c')]({},_0x1baa2e,_0x1ff452[_0x1170('0x3e')]);return db[_0x1170('0x3f')]['find'](_0x1baa2e)['then'](handleEntityNotFound(_0xe1a1d5,null))[_0x1170('0x24')](respondWithResult(_0xe1a1d5,null))[_0x1170('0x46')](handleError(_0xe1a1d5,null));};exports['create']=function(_0x2f1bca,_0x401c24){return db[_0x1170('0x3f')]['create'](_0x2f1bca[_0x1170('0x47')],{})[_0x1170('0x24')](respondWithResult(_0x401c24,0xc9))[_0x1170('0x46')](handleError(_0x401c24,null));};exports[_0x1170('0x23')]=function(_0x453ab6,_0xab78fe){if(_0x453ab6['body']['id']){delete _0x453ab6[_0x1170('0x47')]['id'];}return db[_0x1170('0x3f')][_0x1170('0x48')]({'where':{'id':_0x453ab6[_0x1170('0x43')]['id']}})[_0x1170('0x24')](handleEntityNotFound(_0xab78fe,null))['then'](saveUpdates(_0x453ab6[_0x1170('0x47')],null))['then'](respondWithResult(_0xab78fe,null))['catch'](handleError(_0xab78fe,null));};exports[_0x1170('0x25')]=function(_0xd0bded,_0x317f33){return db['Dynamics365Field'][_0x1170('0x48')]({'where':{'id':_0xd0bded[_0x1170('0x43')]['id']}})[_0x1170('0x24')](handleEntityNotFound(_0x317f33,null))[_0x1170('0x24')](removeEntity(_0x317f33,null))[_0x1170('0x46')](handleError(_0x317f33,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c43ed51..6396054 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 _0x760b=['define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x270120,_0x1c8bcb){var _0xcf7744=function(_0x4c26c8){while(--_0x4c26c8){_0x270120['push'](_0x270120['shift']());}};_0xcf7744(++_0x1c8bcb);}(_0x760b,0x17c));var _0xb760=function(_0xff3c91,_0x512eac){_0xff3c91=_0xff3c91-0x0;var _0x1b9e5e=_0x760b[_0xff3c91];return _0x1b9e5e;};'use strict';var _=require('lodash');var util=require(_0xb760('0x0'));var logger=require(_0xb760('0x1'))(_0xb760('0x2'));var moment=require(_0xb760('0x3'));var BPromise=require('bluebird');var rp=require(_0xb760('0x4'));var fs=require('fs');var path=require(_0xb760('0x5'));var rimraf=require(_0xb760('0x6'));var config=require(_0xb760('0x7'));var attributes=require(_0xb760('0x8'));module[_0xb760('0x9')]=function(_0x4ac2e8,_0x50c532){return _0x4ac2e8[_0xb760('0xa')]('Dynamics365Field',attributes,{'tableName':_0xb760('0xb'),'paranoid':![],'indexes':[{'name':_0xb760('0xc'),'fields':[_0xb760('0xd'),_0xb760('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f35=['../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','api','moment','bluebird','rimraf'];(function(_0x561049,_0x330926){var _0x52f109=function(_0x1a5d24){while(--_0x1a5d24){_0x561049['push'](_0x561049['shift']());}};_0x52f109(++_0x330926);}(_0x8f35,0x14c));var _0x58f3=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x8f35[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x58f3('0x0'));var util=require(_0x58f3('0x1'));var logger=require('../../config/logger')(_0x58f3('0x2'));var moment=require(_0x58f3('0x3'));var BPromise=require(_0x58f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x58f3('0x5'));var config=require(_0x58f3('0x6'));var attributes=require(_0x58f3('0x7'));module[_0x58f3('0x8')]=function(_0x2b0c5f,_0x319d55){return _0x2b0c5f[_0x58f3('0x9')]('Dynamics365Field',attributes,{'tableName':_0x58f3('0xa'),'paranoid':![],'indexes':[{'name':_0x58f3('0xb'),'fields':[_0x58f3('0xc'),'FieldId'],'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 5f2354e..aa1224f 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 _0xb82a=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x38f015,_0x227f7d){var _0x2889fa=function(_0x3e5fe2){while(--_0x3e5fe2){_0x38f015['push'](_0x38f015['shift']());}};_0x2889fa(++_0x227f7d);}(_0xb82a,0xe1));var _0xab82=function(_0x2d5a53,_0x52e809){_0x2d5a53=_0x2d5a53-0x0;var _0x1b5d56=_0xb82a[_0x2d5a53];return _0x1b5d56;};'use strict';var _=require(_0xab82('0x0'));var util=require(_0xab82('0x1'));var moment=require(_0xab82('0x2'));var BPromise=require('bluebird');var rs=require(_0xab82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab82('0x4'));var logger=require(_0xab82('0x5'))(_0xab82('0x6'));var config=require('../../config/environment');var jayson=require(_0xab82('0x7'));var client=jayson[_0xab82('0x8')][_0xab82('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4babfb,_0x140e85,_0x5b6eb7){return new BPromise(function(_0x241870,_0x39e7c7){return client['request'](_0x4babfb,_0x5b6eb7)['then'](function(_0x5bb30e){logger[_0xab82('0xa')](_0xab82('0xb'),_0x140e85,_0xab82('0xc'));logger['debug'](_0xab82('0xd'),_0x140e85,_0xab82('0xc'),JSON[_0xab82('0xe')](_0x5bb30e));if(_0x5bb30e[_0xab82('0xf')]){if(_0x5bb30e[_0xab82('0xf')]['code']===0x1f4){logger[_0xab82('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x140e85,_0x5bb30e[_0xab82('0xf')][_0xab82('0x10')]);return _0x39e7c7(_0x5bb30e[_0xab82('0xf')][_0xab82('0x10')]);}logger[_0xab82('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x140e85,_0x5bb30e[_0xab82('0xf')][_0xab82('0x10')]);return _0x241870(_0x5bb30e[_0xab82('0xf')][_0xab82('0x10')]);}else{logger[_0xab82('0xa')](_0xab82('0xb'),_0x140e85,_0xab82('0xc'));_0x241870(_0x5bb30e[_0xab82('0x11')][_0xab82('0x10')]);}})[_0xab82('0x12')](function(_0x31377a){logger['error'](_0xab82('0xb'),_0x140e85,_0x31377a);_0x39e7c7(_0x31377a);});});} \ No newline at end of file +var _0x55db=['bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0xb86b17,_0x2e1437){var _0x5e562e=function(_0x39ea82){while(--_0x39ea82){_0xb86b17['push'](_0xb86b17['shift']());}};_0x5e562e(++_0x2e1437);}(_0x55db,0xda));var _0xb55d=function(_0xad30ba,_0x3f7e67){_0xad30ba=_0xad30ba-0x0;var _0x233532=_0x55db[_0xad30ba];return _0x233532;};'use strict';var _=require('lodash');var util=require(_0xb55d('0x0'));var moment=require(_0xb55d('0x1'));var BPromise=require(_0xb55d('0x2'));var rs=require(_0xb55d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb55d('0x4'))['db'];var utils=require(_0xb55d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb55d('0x6'));var client=jayson[_0xb55d('0x7')][_0xb55d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x76fe76,_0x2f653e,_0x47cfea){return new BPromise(function(_0x5b0279,_0x435f1e){return client['request'](_0x76fe76,_0x47cfea)[_0xb55d('0x9')](function(_0x4bee08){logger[_0xb55d('0xa')](_0xb55d('0xb'),_0x2f653e,_0xb55d('0xc'));logger[_0xb55d('0xd')](_0xb55d('0xe'),_0x2f653e,_0xb55d('0xc'),JSON[_0xb55d('0xf')](_0x4bee08));if(_0x4bee08['error']){if(_0x4bee08[_0xb55d('0x10')]['code']===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2f653e,_0x4bee08[_0xb55d('0x10')][_0xb55d('0x11')]);return _0x435f1e(_0x4bee08[_0xb55d('0x10')][_0xb55d('0x11')]);}logger[_0xb55d('0x10')](_0xb55d('0xb'),_0x2f653e,_0x4bee08[_0xb55d('0x10')][_0xb55d('0x11')]);return _0x5b0279(_0x4bee08['error'][_0xb55d('0x11')]);}else{logger[_0xb55d('0xa')](_0xb55d('0xb'),_0x2f653e,_0xb55d('0xc'));_0x5b0279(_0x4bee08[_0xb55d('0x12')][_0xb55d('0x11')]);}})[_0xb55d('0x13')](function(_0x16c64e){logger[_0xb55d('0x10')](_0xb55d('0xb'),_0x2f653e,_0x16c64e);_0x435f1e(_0x16c64e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e1c8a88..3ea1dbf 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 _0xa0d3=['get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0xd4fef9,_0xd847a9){var _0x5314c4=function(_0x2d5155){while(--_0x2d5155){_0xd4fef9['push'](_0xd4fef9['shift']());}};_0x5314c4(++_0xd847a9);}(_0xa0d3,0x16e));var _0x3a0d=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xa0d3[_0x55d8c5];return _0x225ae5;};'use strict';var multer=require(_0x3a0d('0x0'));var util=require(_0x3a0d('0x1'));var path=require(_0x3a0d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a0d('0x3'));var router=express['Router']();var fs_extra=require(_0x3a0d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3a0d('0x5'));var config=require(_0x3a0d('0x6'));var controller=require(_0x3a0d('0x7'));router[_0x3a0d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3a0d('0x8')]('/:id',auth[_0x3a0d('0x9')](),controller[_0x3a0d('0xa')]);router[_0x3a0d('0x8')](_0x3a0d('0xb'),auth[_0x3a0d('0x9')](),controller[_0x3a0d('0xc')]);router[_0x3a0d('0x8')]('/:id/fields',auth[_0x3a0d('0x9')](),controller[_0x3a0d('0xd')]);router[_0x3a0d('0xe')]('/',auth['isAuthenticated'](),controller[_0x3a0d('0xf')]);router[_0x3a0d('0xe')](_0x3a0d('0xb'),auth[_0x3a0d('0x9')](),controller['addConfiguration']);router[_0x3a0d('0x10')](_0x3a0d('0x11'),auth['isAuthenticated'](),controller[_0x3a0d('0x12')]);router[_0x3a0d('0x13')](_0x3a0d('0x11'),auth[_0x3a0d('0x9')](),controller[_0x3a0d('0x14')]);module[_0x3a0d('0x15')]=router; \ No newline at end of file +var _0xf57f=['isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x122da6,_0x1b1737){var _0x233b82=function(_0x445871){while(--_0x445871){_0x122da6['push'](_0x122da6['shift']());}};_0x233b82(++_0x1b1737);}(_0xf57f,0xa3));var _0xff57=function(_0x1b3a09,_0x20c774){_0x1b3a09=_0x1b3a09-0x0;var _0x357bb8=_0xf57f[_0x1b3a09];return _0x357bb8;};'use strict';var multer=require(_0xff57('0x0'));var util=require(_0xff57('0x1'));var path=require(_0xff57('0x2'));var timeout=require(_0xff57('0x3'));var express=require('express');var router=express[_0xff57('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff57('0x5'));var interaction=require(_0xff57('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xff57('0x7')]('/',auth[_0xff57('0x8')](),controller['index']);router[_0xff57('0x7')](_0xff57('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xff57('0x7')](_0xff57('0xa'),auth['isAuthenticated'](),controller[_0xff57('0xb')]);router[_0xff57('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xff57('0xc')]);router[_0xff57('0xd')]('/',auth[_0xff57('0x8')](),controller[_0xff57('0xe')]);router[_0xff57('0xd')]('/:id/configurations',auth[_0xff57('0x8')](),controller['addConfiguration']);router[_0xff57('0xf')](_0xff57('0x9'),auth[_0xff57('0x8')](),controller[_0xff57('0x10')]);router[_0xff57('0x11')](_0xff57('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xff57('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3f62d87..3fc9ed9 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['exports','STRING','username'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4888,0x198));var _0x8488=function(_0x557f77,_0x2ff13f){_0x557f77=_0x557f77-0x0;var _0x166ce5=_0x4888[_0x557f77];return _0x166ce5;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6343=['STRING','remoteUri'];(function(_0xc62c17,_0x4ad1f9){var _0x2d214b=function(_0x1569dc){while(--_0x1569dc){_0xc62c17['push'](_0xc62c17['shift']());}};_0x2d214b(++_0x4ad1f9);}(_0x6343,0x168));var _0x3634=function(_0x54adef,_0xb0b38e){_0x54adef=_0x54adef-0x0;var _0x2a88f4=_0x6343[_0x54adef];return _0x2a88f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3634('0x0')]},'description':{'type':Sequelize[_0x3634('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3634('0x1')},'serverUrl':{'type':Sequelize[_0x3634('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f5a2f6b..9cf3baa 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 _0x2964=['AccountId','channel','Descriptions','getDescriptions','FreshdeskField','findOne','apiKey','substring','format','%s/%s','Basic\x20%s','%s:X','base64','requester','subject','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','FreshdeskAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','FreshdeskConfiguration','order','getConfigurations','hasOwnProperty','nolimit'];(function(_0x135c1b,_0x15f991){var _0x38c5b7=function(_0x26a6d8){while(--_0x26a6d8){_0x135c1b['push'](_0x135c1b['shift']());}};_0x38c5b7(++_0x15f991);}(_0x2964,0x108));var _0x4296=function(_0x591baf,_0x5a9682){_0x591baf=_0x591baf-0x0;var _0xf80633=_0x2964[_0x591baf];return _0xf80633;};'use strict';var emlformat=require(_0x4296('0x0'));var rimraf=require(_0x4296('0x1'));var zipdir=require(_0x4296('0x2'));var jsonpatch=require(_0x4296('0x3'));var rp=require(_0x4296('0x4'));var moment=require(_0x4296('0x5'));var BPromise=require(_0x4296('0x6'));var Mustache=require(_0x4296('0x7'));var util=require(_0x4296('0x8'));var path=require('path');var sox=require(_0x4296('0x9'));var csv=require(_0x4296('0xa'));var ejs=require(_0x4296('0xb'));var fs=require('fs');var fs_extra=require(_0x4296('0xc'));var _=require(_0x4296('0xd'));var squel=require(_0x4296('0xe'));var crypto=require('crypto');var jsforce=require(_0x4296('0xf'));var deskjs=require(_0x4296('0x10'));var toCsv=require(_0x4296('0xa'));var querystring=require(_0x4296('0x11'));var Papa=require(_0x4296('0x12'));var Redis=require(_0x4296('0x13'));var authService=require(_0x4296('0x14'));var qs=require(_0x4296('0x15'));var as=require(_0x4296('0x16'));var hardwareService=require(_0x4296('0x17'));var logger=require(_0x4296('0x18'))(_0x4296('0x19'));var utils=require('../../config/utils');var config=require(_0x4296('0x1a'));var licenseUtil=require(_0x4296('0x1b'));var db=require(_0x4296('0x1c'))['db'];var integrations=require(_0x4296('0x1d'));function respondWithStatusCode(_0x23ba5a,_0x676674){_0x676674=_0x676674||0xcc;return function(_0x3789a2){if(_0x3789a2){return _0x23ba5a['sendStatus'](_0x676674);}return _0x23ba5a[_0x4296('0x1e')](_0x676674)[_0x4296('0x1f')]();};}function respondWithResult(_0x3574da,_0x56b6d7){_0x56b6d7=_0x56b6d7||0xc8;return function(_0x1c192c){if(_0x1c192c){return _0x3574da[_0x4296('0x1e')](_0x56b6d7)[_0x4296('0x20')](_0x1c192c);}};}function respondWithFilteredResult(_0x53af4b,_0x182910){return function(_0x2e63c4){if(_0x2e63c4){var _0x1e7af8=typeof _0x182910['offset']===_0x4296('0x21')&&typeof _0x182910[_0x4296('0x22')]===_0x4296('0x21');var _0x1dcb36=_0x2e63c4[_0x4296('0x23')];var _0x540b0d=_0x1e7af8?0x0:_0x182910[_0x4296('0x24')];var _0x4ac668=_0x1e7af8?_0x2e63c4[_0x4296('0x23')]:_0x182910['offset']+_0x182910[_0x4296('0x22')];var _0x6c50b7;if(_0x4ac668>=_0x1dcb36){_0x4ac668=_0x1dcb36;_0x6c50b7=0xc8;}else{_0x6c50b7=0xce;}_0x53af4b[_0x4296('0x1e')](_0x6c50b7);return _0x53af4b[_0x4296('0x25')](_0x4296('0x26'),_0x540b0d+'-'+_0x4ac668+'/'+_0x1dcb36)[_0x4296('0x20')](_0x2e63c4);}return null;};}function patchUpdates(_0x4ca11f){return function(_0x33839e){try{jsonpatch[_0x4296('0x27')](_0x33839e,_0x4ca11f,!![]);}catch(_0x5456ca){return BPromise[_0x4296('0x28')](_0x5456ca);}return _0x33839e[_0x4296('0x29')]();};}function saveUpdates(_0x257f51,_0x3c899f){return function(_0x5d285d){if(_0x5d285d){return _0x5d285d['update'](_0x257f51)[_0x4296('0x2a')](function(_0x3902b5){return _0x3902b5;});}return null;};}function removeEntity(_0x4ce761,_0x179e5d){return function(_0x4c5aca){if(_0x4c5aca){return _0x4c5aca[_0x4296('0x2b')]()[_0x4296('0x2a')](function(){_0x4ce761[_0x4296('0x1e')](0xcc)[_0x4296('0x1f')]();});}};}function handleEntityNotFound(_0x5098c1,_0x3b8b48){return function(_0x4c56e5){if(!_0x4c56e5){_0x5098c1[_0x4296('0x2c')](0x194);}return _0x4c56e5;};}function handleError(_0x516365,_0x4f2d8e){_0x4f2d8e=_0x4f2d8e||0x1f4;return function(_0x853bf5){logger[_0x4296('0x2d')](_0x853bf5[_0x4296('0x2e')]);if(_0x853bf5['name']){delete _0x853bf5[_0x4296('0x2f')];}_0x516365[_0x4296('0x1e')](_0x4f2d8e)['send'](_0x853bf5);};}exports[_0x4296('0x30')]=function(_0x5cb6b7,_0x4f9a1a){var _0x14c84f={},_0x2f5a2e={},_0x37f4e5={'count':0x0,'rows':[]};var _0x1bf57b=_[_0x4296('0x31')](db[_0x4296('0x32')][_0x4296('0x33')],function(_0x9ac120){return{'name':_0x9ac120['fieldName'],'type':_0x9ac120[_0x4296('0x34')]['key']};});_0x2f5a2e[_0x4296('0x35')]=_['map'](_0x1bf57b,'name');_0x2f5a2e[_0x4296('0x36')]=_['keys'](_0x5cb6b7[_0x4296('0x36')]);_0x2f5a2e[_0x4296('0x37')]=_[_0x4296('0x38')](_0x2f5a2e[_0x4296('0x35')],_0x2f5a2e[_0x4296('0x36')]);_0x14c84f[_0x4296('0x39')]=_[_0x4296('0x38')](_0x2f5a2e[_0x4296('0x35')],qs[_0x4296('0x3a')](_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3a')]));_0x14c84f['attributes']=_0x14c84f['attributes'][_0x4296('0x3b')]?_0x14c84f[_0x4296('0x39')]:_0x2f5a2e[_0x4296('0x35')];if(!_0x5cb6b7[_0x4296('0x36')]['hasOwnProperty']('nolimit')){_0x14c84f[_0x4296('0x22')]=qs[_0x4296('0x22')](_0x5cb6b7[_0x4296('0x36')][_0x4296('0x22')]);_0x14c84f['offset']=qs[_0x4296('0x24')](_0x5cb6b7[_0x4296('0x36')]['offset']);}_0x14c84f['order']=qs['sort'](_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3c')]);_0x14c84f['where']=qs[_0x4296('0x37')](_[_0x4296('0x3d')](_0x5cb6b7[_0x4296('0x36')],_0x2f5a2e[_0x4296('0x37')]),_0x1bf57b);if(_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3e')]){_0x14c84f[_0x4296('0x3f')]=_[_0x4296('0x40')](_0x14c84f[_0x4296('0x3f')],{'$or':_[_0x4296('0x31')](_0x1bf57b,function(_0x1e96ed){if(_0x1e96ed[_0x4296('0x34')]!==_0x4296('0x41')){var _0x542ef9={};_0x542ef9[_0x1e96ed[_0x4296('0x2f')]]={'$like':'%'+_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3e')]+'%'};return _0x542ef9;}})});}_0x14c84f=_[_0x4296('0x40')]({},_0x14c84f,_0x5cb6b7[_0x4296('0x42')]);var _0x2fa9c0={'where':_0x14c84f['where']};return db[_0x4296('0x32')][_0x4296('0x23')](_0x2fa9c0)[_0x4296('0x2a')](function(_0x536531){_0x37f4e5[_0x4296('0x23')]=_0x536531;if(_0x5cb6b7['query'][_0x4296('0x43')]){_0x14c84f[_0x4296('0x44')]=[{'all':!![]}];}return db[_0x4296('0x32')][_0x4296('0x45')](_0x14c84f);})[_0x4296('0x2a')](function(_0x43e3b2){_0x37f4e5['rows']=_0x43e3b2;return _0x37f4e5;})[_0x4296('0x2a')](respondWithFilteredResult(_0x4f9a1a,_0x14c84f))[_0x4296('0x46')](handleError(_0x4f9a1a,null));};exports['show']=function(_0x47bd76,_0xa64359){var _0x3fffd3={'raw':![],'where':{'id':_0x47bd76[_0x4296('0x47')]['id']}},_0x2da579={};_0x2da579[_0x4296('0x35')]=_['keys'](db['FreshdeskAccount'][_0x4296('0x33')]);_0x2da579[_0x4296('0x36')]=_[_0x4296('0x48')](_0x47bd76[_0x4296('0x36')]);_0x2da579[_0x4296('0x37')]=_[_0x4296('0x38')](_0x2da579[_0x4296('0x35')],_0x2da579[_0x4296('0x36')]);_0x3fffd3[_0x4296('0x39')]=_['intersection'](_0x2da579[_0x4296('0x35')],qs[_0x4296('0x3a')](_0x47bd76[_0x4296('0x36')]['fields']));_0x3fffd3[_0x4296('0x39')]=_0x3fffd3[_0x4296('0x39')]['length']?_0x3fffd3['attributes']:_0x2da579[_0x4296('0x35')];if(_0x47bd76[_0x4296('0x36')][_0x4296('0x43')]){_0x3fffd3['include']=[{'all':!![]}];}_0x3fffd3=_['merge']({},_0x3fffd3,_0x47bd76['options']);return db[_0x4296('0x32')][_0x4296('0x49')](_0x3fffd3)[_0x4296('0x2a')](handleEntityNotFound(_0xa64359,null))['then'](respondWithResult(_0xa64359,null))['catch'](handleError(_0xa64359,null));};exports[_0x4296('0x4a')]=function(_0x1ddb06,_0x403e7d){return db[_0x4296('0x32')][_0x4296('0x4a')](_0x1ddb06[_0x4296('0x4b')],{})[_0x4296('0x2a')](respondWithResult(_0x403e7d,0xc9))[_0x4296('0x46')](handleError(_0x403e7d,null));};exports['update']=function(_0x419cab,_0x1f050b){if(_0x419cab[_0x4296('0x4b')]['id']){delete _0x419cab[_0x4296('0x4b')]['id'];}return db[_0x4296('0x32')][_0x4296('0x49')]({'where':{'id':_0x419cab['params']['id']}})['then'](handleEntityNotFound(_0x1f050b,null))['then'](saveUpdates(_0x419cab[_0x4296('0x4b')],null))[_0x4296('0x2a')](respondWithResult(_0x1f050b,null))[_0x4296('0x46')](handleError(_0x1f050b,null));};exports[_0x4296('0x2b')]=function(_0x4baee7,_0x2ac96d){return db[_0x4296('0x32')][_0x4296('0x49')]({'where':{'id':_0x4baee7[_0x4296('0x47')]['id']}})[_0x4296('0x2a')](handleEntityNotFound(_0x2ac96d,null))[_0x4296('0x2a')](removeEntity(_0x2ac96d,null))[_0x4296('0x46')](handleError(_0x2ac96d,null));};exports['getConfigurations']=function(_0x468453,_0x47f668,_0x52c28a){var _0x6379ec={};var _0x18080a={};var _0x4f306a;var _0x17e212;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x468453[_0x4296('0x47')]['id']}})[_0x4296('0x2a')](handleEntityNotFound(_0x47f668,null))['then'](function(_0x4faac4){if(_0x4faac4){_0x4f306a=_0x4faac4;_0x18080a[_0x4296('0x35')]=_[_0x4296('0x48')](db[_0x4296('0x4c')][_0x4296('0x33')]);_0x18080a[_0x4296('0x36')]=_['keys'](_0x468453[_0x4296('0x36')]);_0x18080a[_0x4296('0x37')]=_['intersection'](_0x18080a[_0x4296('0x35')],_0x18080a[_0x4296('0x36')]);_0x6379ec[_0x4296('0x39')]=_[_0x4296('0x38')](_0x18080a[_0x4296('0x35')],qs[_0x4296('0x3a')](_0x468453['query'][_0x4296('0x3a')]));_0x6379ec[_0x4296('0x39')]=_0x6379ec[_0x4296('0x39')][_0x4296('0x3b')]?_0x6379ec['attributes']:_0x18080a['model'];_0x6379ec[_0x4296('0x4d')]=qs[_0x4296('0x3c')](_0x468453['query'][_0x4296('0x3c')]);_0x6379ec[_0x4296('0x3f')]=qs[_0x4296('0x37')](_[_0x4296('0x3d')](_0x468453[_0x4296('0x36')],_0x18080a['filters']));if(_0x468453[_0x4296('0x36')]['filter']){_0x6379ec[_0x4296('0x3f')]=_['merge'](_0x6379ec[_0x4296('0x3f')],{'$or':_[_0x4296('0x31')](_0x6379ec[_0x4296('0x39')],function(_0x26a400){var _0x2e8b42={};_0x2e8b42[_0x26a400]={'$like':'%'+_0x468453[_0x4296('0x36')][_0x4296('0x3e')]+'%'};return _0x2e8b42;})});}_0x6379ec=_[_0x4296('0x40')]({},_0x6379ec,_0x468453['options']);return _0x4f306a[_0x4296('0x4e')](_0x6379ec);}})[_0x4296('0x2a')](function(_0x128f96){if(_0x128f96){_0x17e212=_0x128f96[_0x4296('0x3b')];if(!_0x468453['query'][_0x4296('0x4f')](_0x4296('0x50'))){_0x6379ec[_0x4296('0x22')]=qs[_0x4296('0x22')](_0x468453[_0x4296('0x36')][_0x4296('0x22')]);_0x6379ec[_0x4296('0x24')]=qs[_0x4296('0x24')](_0x468453[_0x4296('0x36')][_0x4296('0x24')]);}return _0x4f306a[_0x4296('0x4e')](_0x6379ec);}})[_0x4296('0x2a')](function(_0x3841c1){if(_0x3841c1){return _0x3841c1?{'count':_0x17e212,'rows':_0x3841c1}:null;}})[_0x4296('0x2a')](respondWithResult(_0x47f668,null))[_0x4296('0x46')](handleError(_0x47f668,null));};exports['addConfiguration']=function(_0x2c2823,_0x6360e7,_0xe4cf57){if(_0x2c2823[_0x4296('0x4b')]['id']){delete _0x2c2823[_0x4296('0x4b')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x2c2823[_0x4296('0x47')]['id']}})[_0x4296('0x2a')](handleEntityNotFound(_0x6360e7,null))[_0x4296('0x2a')](function(_0x24054b){if(_0x24054b){_0x2c2823[_0x4296('0x4b')][_0x4296('0x51')]=_0x24054b['id'];_0x2c2823[_0x4296('0x4b')]['Subjects']=integrations['getSubjects'](_0x2c2823['body'][_0x4296('0x52')],_0x2c2823[_0x4296('0x4b')][_0x4296('0x34')]);_0x2c2823['body'][_0x4296('0x53')]=integrations[_0x4296('0x54')](_0x2c2823[_0x4296('0x4b')][_0x4296('0x52')],_0x2c2823['body'][_0x4296('0x34')]);return db[_0x4296('0x4c')][_0x4296('0x4a')](_0x2c2823['body'],{'include':[{'model':db[_0x4296('0x55')],'as':'Subjects'},{'model':db[_0x4296('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6360e7,null))[_0x4296('0x46')](handleError(_0x6360e7,null));};exports['getFields']=function(_0x171ffb,_0x22ab58,_0x309225){var _0x45c839='';return db[_0x4296('0x32')][_0x4296('0x56')]({'where':{'id':_0x171ffb[_0x4296('0x47')]['id']},'attributes':['id','remoteUri',_0x4296('0x57')]})['then'](handleEntityNotFound(_0x22ab58,null))[_0x4296('0x2a')](function(_0x5aa04d){if(_0x5aa04d){_0x45c839=_0x5aa04d['remoteUri'];var _0xea86ed=_0x45c839['slice'](-0x1);if(_0xea86ed==='/'){_0x45c839=_0x45c839[_0x4296('0x58')](0x0,_0x45c839['lastIndexOf'](_0xea86ed));}return rp({'method':'GET','uri':util[_0x4296('0x59')](_0x4296('0x5a'),_0x45c839,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x4296('0x59')](_0x4296('0x5b'),new Buffer(util['format'](_0x4296('0x5c'),_0x5aa04d[_0x4296('0x57')]))['toString'](_0x4296('0x5d')))},'json':!![]});}})[_0x4296('0x2a')](function(_0x54a6c){if(_0x54a6c){var _0x1ea1de=[_0x4296('0x5e'),_0x4296('0x5f'),'agent',_0x4296('0x60'),_0x4296('0x1e'),_0x4296('0x61'),_0x4296('0x62'),_0x4296('0x63'),_0x4296('0x64'),_0x4296('0x62'),'company'];_[_0x4296('0x65')](_0x54a6c,function(_0x12efc5){return _0x1ea1de[_0x4296('0x66')](_0x12efc5[_0x4296('0x2f')])||!_0x12efc5[_0x4296('0x67')]&&_0x12efc5[_0x4296('0x34')]!==_0x4296('0x68')&&_0x12efc5[_0x4296('0x34')]!==_0x4296('0x69');});return{'count':_0x54a6c[_0x4296('0x3b')],'rows':_[_0x4296('0x31')](_0x54a6c,function(_0x5599b8){return{'id':_0x5599b8[_0x4296('0x2f')],'name':_0x5599b8[_0x4296('0x6a')],'custom':!_0x5599b8[_0x4296('0x67')],'options':_0x5599b8[_0x4296('0x6b')]?_['map'](_0x5599b8[_0x4296('0x6b')],function(_0x5b3dce){return{'name':_[_0x4296('0x6c')](_0x5b3dce),'value':_0x5b3dce};}):[]};})};}})[_0x4296('0x2a')](respondWithResult(_0x22ab58,null))[_0x4296('0x46')](function(_0x57319b){var _0x4eeaa8=_0x171ffb[_0x4296('0x36')]['test']?0x1f4:_0x57319b['statusCode']||0x1f4;logger[_0x4296('0x2d')](_0x4296('0x6d'),_0x4296('0x6e'),_0x4eeaa8,JSON[_0x4296('0x6f')](_0x57319b));delete _0x57319b[_0x4296('0x2f')];if(_0x4eeaa8===0x191){_0x4eeaa8=0x190;}_0x22ab58[_0x4296('0x1e')](_0x4eeaa8)[_0x4296('0x70')](_0x171ffb['query']['test']?{'message':_0x4296('0x71'),'statusCode':_0x57319b[_0x4296('0x72')]}:_0x57319b);});}; \ No newline at end of file +var _0xc577=['merge','VIRTUAL','includeAll','rows','show','params','length','include','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','options','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','remoteUri','apiKey','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','subject','agent','group','source','ticket_type','remove','custom_text','custom_dropdown','default','choices','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','sendStatus','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x24b88f,_0x22ea38){var _0x34a652=function(_0xa0fb48){while(--_0xa0fb48){_0x24b88f['push'](_0x24b88f['shift']());}};_0x34a652(++_0x22ea38);}(_0xc577,0x172));var _0x7c57=function(_0x5ec09a,_0x35b386){_0x5ec09a=_0x5ec09a-0x0;var _0x1f3c39=_0xc577[_0x5ec09a];return _0x1f3c39;};'use strict';var emlformat=require(_0x7c57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c57('0x1'));var rp=require(_0x7c57('0x2'));var moment=require(_0x7c57('0x3'));var BPromise=require(_0x7c57('0x4'));var Mustache=require(_0x7c57('0x5'));var util=require(_0x7c57('0x6'));var path=require(_0x7c57('0x7'));var sox=require('sox');var csv=require(_0x7c57('0x8'));var ejs=require(_0x7c57('0x9'));var fs=require('fs');var fs_extra=require(_0x7c57('0xa'));var _=require(_0x7c57('0xb'));var squel=require(_0x7c57('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c57('0x8'));var querystring=require('querystring');var Papa=require(_0x7c57('0xd'));var Redis=require(_0x7c57('0xe'));var authService=require(_0x7c57('0xf'));var qs=require(_0x7c57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c57('0x11'));var logger=require(_0x7c57('0x12'))('api');var utils=require(_0x7c57('0x13'));var config=require(_0x7c57('0x14'));var licenseUtil=require(_0x7c57('0x15'));var db=require(_0x7c57('0x16'))['db'];var integrations=require(_0x7c57('0x17'));function respondWithStatusCode(_0x10a675,_0x296cef){_0x296cef=_0x296cef||0xcc;return function(_0x4ea220){if(_0x4ea220){return _0x10a675['sendStatus'](_0x296cef);}return _0x10a675['status'](_0x296cef)[_0x7c57('0x18')]();};}function respondWithResult(_0x373a4b,_0x4c5af2){_0x4c5af2=_0x4c5af2||0xc8;return function(_0x43d1fd){if(_0x43d1fd){return _0x373a4b[_0x7c57('0x19')](_0x4c5af2)[_0x7c57('0x1a')](_0x43d1fd);}};}function respondWithFilteredResult(_0x1ba2d0,_0x14ce67){return function(_0x517d8a){if(_0x517d8a){var _0x532e93=typeof _0x14ce67[_0x7c57('0x1b')]===_0x7c57('0x1c')&&typeof _0x14ce67[_0x7c57('0x1d')]===_0x7c57('0x1c');var _0x27577c=_0x517d8a['count'];var _0x20dd80=_0x532e93?0x0:_0x14ce67[_0x7c57('0x1b')];var _0x1f0eaf=_0x532e93?_0x517d8a[_0x7c57('0x1e')]:_0x14ce67[_0x7c57('0x1b')]+_0x14ce67[_0x7c57('0x1d')];var _0x2931c4;if(_0x1f0eaf>=_0x27577c){_0x1f0eaf=_0x27577c;_0x2931c4=0xc8;}else{_0x2931c4=0xce;}_0x1ba2d0[_0x7c57('0x19')](_0x2931c4);return _0x1ba2d0[_0x7c57('0x1f')]('Content-Range',_0x20dd80+'-'+_0x1f0eaf+'/'+_0x27577c)[_0x7c57('0x1a')](_0x517d8a);}return null;};}function patchUpdates(_0x3472b8){return function(_0x21a199){try{jsonpatch[_0x7c57('0x20')](_0x21a199,_0x3472b8,!![]);}catch(_0x5795b6){return BPromise['reject'](_0x5795b6);}return _0x21a199['save']();};}function saveUpdates(_0x140376,_0x368bb6){return function(_0x47970a){if(_0x47970a){return _0x47970a[_0x7c57('0x21')](_0x140376)[_0x7c57('0x22')](function(_0x260d58){return _0x260d58;});}return null;};}function removeEntity(_0xfb0f2e,_0x4734de){return function(_0x1f8776){if(_0x1f8776){return _0x1f8776[_0x7c57('0x23')]()['then'](function(){_0xfb0f2e[_0x7c57('0x19')](0xcc)[_0x7c57('0x18')]();});}};}function handleEntityNotFound(_0x16a517,_0x1641f1){return function(_0x119e5f){if(!_0x119e5f){_0x16a517[_0x7c57('0x24')](0x194);}return _0x119e5f;};}function handleError(_0x41125b,_0x1219f2){_0x1219f2=_0x1219f2||0x1f4;return function(_0x1edf4d){logger['error'](_0x1edf4d['stack']);if(_0x1edf4d[_0x7c57('0x25')]){delete _0x1edf4d[_0x7c57('0x25')];}_0x41125b[_0x7c57('0x19')](_0x1219f2)['send'](_0x1edf4d);};}exports[_0x7c57('0x26')]=function(_0x59ae2f,_0x5acc20){var _0x5ad979={},_0x1d5b54={},_0x50c5fa={'count':0x0,'rows':[]};var _0x4b183a=_[_0x7c57('0x27')](db[_0x7c57('0x28')][_0x7c57('0x29')],function(_0x5e2836){return{'name':_0x5e2836[_0x7c57('0x2a')],'type':_0x5e2836[_0x7c57('0x2b')][_0x7c57('0x2c')]};});_0x1d5b54['model']=_[_0x7c57('0x27')](_0x4b183a,_0x7c57('0x25'));_0x1d5b54[_0x7c57('0x2d')]=_[_0x7c57('0x2e')](_0x59ae2f[_0x7c57('0x2d')]);_0x1d5b54[_0x7c57('0x2f')]=_[_0x7c57('0x30')](_0x1d5b54[_0x7c57('0x31')],_0x1d5b54[_0x7c57('0x2d')]);_0x5ad979[_0x7c57('0x32')]=_['intersection'](_0x1d5b54[_0x7c57('0x31')],qs[_0x7c57('0x33')](_0x59ae2f['query'][_0x7c57('0x33')]));_0x5ad979[_0x7c57('0x32')]=_0x5ad979[_0x7c57('0x32')]['length']?_0x5ad979[_0x7c57('0x32')]:_0x1d5b54[_0x7c57('0x31')];if(!_0x59ae2f['query'][_0x7c57('0x34')](_0x7c57('0x35'))){_0x5ad979['limit']=qs[_0x7c57('0x1d')](_0x59ae2f[_0x7c57('0x2d')][_0x7c57('0x1d')]);_0x5ad979[_0x7c57('0x1b')]=qs['offset'](_0x59ae2f[_0x7c57('0x2d')]['offset']);}_0x5ad979['order']=qs[_0x7c57('0x36')](_0x59ae2f[_0x7c57('0x2d')][_0x7c57('0x36')]);_0x5ad979[_0x7c57('0x37')]=qs['filters'](_[_0x7c57('0x38')](_0x59ae2f[_0x7c57('0x2d')],_0x1d5b54[_0x7c57('0x2f')]),_0x4b183a);if(_0x59ae2f[_0x7c57('0x2d')][_0x7c57('0x39')]){_0x5ad979[_0x7c57('0x37')]=_[_0x7c57('0x3a')](_0x5ad979['where'],{'$or':_[_0x7c57('0x27')](_0x4b183a,function(_0x3ff2f9){if(_0x3ff2f9[_0x7c57('0x2b')]!==_0x7c57('0x3b')){var _0x4f089b={};_0x4f089b[_0x3ff2f9[_0x7c57('0x25')]]={'$like':'%'+_0x59ae2f[_0x7c57('0x2d')][_0x7c57('0x39')]+'%'};return _0x4f089b;}})});}_0x5ad979=_[_0x7c57('0x3a')]({},_0x5ad979,_0x59ae2f['options']);var _0x46beba={'where':_0x5ad979[_0x7c57('0x37')]};return db[_0x7c57('0x28')][_0x7c57('0x1e')](_0x46beba)[_0x7c57('0x22')](function(_0x29e138){_0x50c5fa[_0x7c57('0x1e')]=_0x29e138;if(_0x59ae2f[_0x7c57('0x2d')][_0x7c57('0x3c')]){_0x5ad979['include']=[{'all':!![]}];}return db[_0x7c57('0x28')]['findAll'](_0x5ad979);})[_0x7c57('0x22')](function(_0x19ba23){_0x50c5fa[_0x7c57('0x3d')]=_0x19ba23;return _0x50c5fa;})[_0x7c57('0x22')](respondWithFilteredResult(_0x5acc20,_0x5ad979))['catch'](handleError(_0x5acc20,null));};exports[_0x7c57('0x3e')]=function(_0x54982b,_0x286cd2){var _0x2f59c0={'raw':![],'where':{'id':_0x54982b[_0x7c57('0x3f')]['id']}},_0x77810={};_0x77810[_0x7c57('0x31')]=_[_0x7c57('0x2e')](db[_0x7c57('0x28')]['rawAttributes']);_0x77810[_0x7c57('0x2d')]=_[_0x7c57('0x2e')](_0x54982b['query']);_0x77810[_0x7c57('0x2f')]=_['intersection'](_0x77810[_0x7c57('0x31')],_0x77810[_0x7c57('0x2d')]);_0x2f59c0[_0x7c57('0x32')]=_['intersection'](_0x77810[_0x7c57('0x31')],qs[_0x7c57('0x33')](_0x54982b['query'][_0x7c57('0x33')]));_0x2f59c0['attributes']=_0x2f59c0['attributes'][_0x7c57('0x40')]?_0x2f59c0[_0x7c57('0x32')]:_0x77810[_0x7c57('0x31')];if(_0x54982b['query'][_0x7c57('0x3c')]){_0x2f59c0[_0x7c57('0x41')]=[{'all':!![]}];}_0x2f59c0=_[_0x7c57('0x3a')]({},_0x2f59c0,_0x54982b['options']);return db[_0x7c57('0x28')][_0x7c57('0x42')](_0x2f59c0)[_0x7c57('0x22')](handleEntityNotFound(_0x286cd2,null))['then'](respondWithResult(_0x286cd2,null))[_0x7c57('0x43')](handleError(_0x286cd2,null));};exports[_0x7c57('0x44')]=function(_0x1d2ed4,_0x37e311){return db['FreshdeskAccount'][_0x7c57('0x44')](_0x1d2ed4[_0x7c57('0x45')],{})[_0x7c57('0x22')](respondWithResult(_0x37e311,0xc9))['catch'](handleError(_0x37e311,null));};exports[_0x7c57('0x21')]=function(_0x35b350,_0x403322){if(_0x35b350[_0x7c57('0x45')]['id']){delete _0x35b350['body']['id'];}return db[_0x7c57('0x28')]['find']({'where':{'id':_0x35b350[_0x7c57('0x3f')]['id']}})[_0x7c57('0x22')](handleEntityNotFound(_0x403322,null))[_0x7c57('0x22')](saveUpdates(_0x35b350[_0x7c57('0x45')],null))[_0x7c57('0x22')](respondWithResult(_0x403322,null))['catch'](handleError(_0x403322,null));};exports[_0x7c57('0x23')]=function(_0x4f6d05,_0x5be52f){return db[_0x7c57('0x28')][_0x7c57('0x42')]({'where':{'id':_0x4f6d05['params']['id']}})[_0x7c57('0x22')](handleEntityNotFound(_0x5be52f,null))['then'](removeEntity(_0x5be52f,null))[_0x7c57('0x43')](handleError(_0x5be52f,null));};exports[_0x7c57('0x46')]=function(_0x422bd6,_0x564f9c,_0x2dc67e){var _0x4208db={};var _0x11cafd={};var _0x32d0f6;var _0x1b36dd;return db['FreshdeskAccount'][_0x7c57('0x47')]({'where':{'id':_0x422bd6[_0x7c57('0x3f')]['id']}})[_0x7c57('0x22')](handleEntityNotFound(_0x564f9c,null))[_0x7c57('0x22')](function(_0x3e1048){if(_0x3e1048){_0x32d0f6=_0x3e1048;_0x11cafd[_0x7c57('0x31')]=_[_0x7c57('0x2e')](db[_0x7c57('0x48')]['rawAttributes']);_0x11cafd['query']=_[_0x7c57('0x2e')](_0x422bd6['query']);_0x11cafd['filters']=_[_0x7c57('0x30')](_0x11cafd[_0x7c57('0x31')],_0x11cafd[_0x7c57('0x2d')]);_0x4208db[_0x7c57('0x32')]=_['intersection'](_0x11cafd[_0x7c57('0x31')],qs['fields'](_0x422bd6[_0x7c57('0x2d')]['fields']));_0x4208db[_0x7c57('0x32')]=_0x4208db[_0x7c57('0x32')][_0x7c57('0x40')]?_0x4208db[_0x7c57('0x32')]:_0x11cafd[_0x7c57('0x31')];_0x4208db[_0x7c57('0x49')]=qs[_0x7c57('0x36')](_0x422bd6[_0x7c57('0x2d')]['sort']);_0x4208db[_0x7c57('0x37')]=qs['filters'](_[_0x7c57('0x38')](_0x422bd6['query'],_0x11cafd[_0x7c57('0x2f')]));if(_0x422bd6[_0x7c57('0x2d')][_0x7c57('0x39')]){_0x4208db[_0x7c57('0x37')]=_[_0x7c57('0x3a')](_0x4208db[_0x7c57('0x37')],{'$or':_[_0x7c57('0x27')](_0x4208db['attributes'],function(_0xdbddfa){var _0x4045c9={};_0x4045c9[_0xdbddfa]={'$like':'%'+_0x422bd6[_0x7c57('0x2d')]['filter']+'%'};return _0x4045c9;})});}_0x4208db=_['merge']({},_0x4208db,_0x422bd6[_0x7c57('0x4a')]);return _0x32d0f6[_0x7c57('0x46')](_0x4208db);}})[_0x7c57('0x22')](function(_0x225627){if(_0x225627){_0x1b36dd=_0x225627[_0x7c57('0x40')];if(!_0x422bd6['query']['hasOwnProperty'](_0x7c57('0x35'))){_0x4208db['limit']=qs[_0x7c57('0x1d')](_0x422bd6[_0x7c57('0x2d')][_0x7c57('0x1d')]);_0x4208db[_0x7c57('0x1b')]=qs[_0x7c57('0x1b')](_0x422bd6[_0x7c57('0x2d')][_0x7c57('0x1b')]);}return _0x32d0f6['getConfigurations'](_0x4208db);}})[_0x7c57('0x22')](function(_0x4407ef){if(_0x4407ef){return _0x4407ef?{'count':_0x1b36dd,'rows':_0x4407ef}:null;}})[_0x7c57('0x22')](respondWithResult(_0x564f9c,null))[_0x7c57('0x43')](handleError(_0x564f9c,null));};exports['addConfiguration']=function(_0x209545,_0x4a88a1,_0x15820b){if(_0x209545['body']['id']){delete _0x209545[_0x7c57('0x45')]['id'];}return db[_0x7c57('0x28')][_0x7c57('0x47')]({'where':{'id':_0x209545[_0x7c57('0x3f')]['id']}})[_0x7c57('0x22')](handleEntityNotFound(_0x4a88a1,null))[_0x7c57('0x22')](function(_0xa3b052){if(_0xa3b052){_0x209545[_0x7c57('0x45')][_0x7c57('0x4b')]=_0xa3b052['id'];_0x209545[_0x7c57('0x45')][_0x7c57('0x4c')]=integrations[_0x7c57('0x4d')](_0x209545[_0x7c57('0x45')][_0x7c57('0x4e')],_0x209545[_0x7c57('0x45')]['type']);_0x209545['body'][_0x7c57('0x4f')]=integrations['getDescriptions'](_0x209545['body'][_0x7c57('0x4e')],_0x209545[_0x7c57('0x45')][_0x7c57('0x2b')]);return db[_0x7c57('0x48')][_0x7c57('0x44')](_0x209545[_0x7c57('0x45')],{'include':[{'model':db[_0x7c57('0x50')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x7c57('0x4f')}]});}return null;})['then'](respondWithResult(_0x4a88a1,null))[_0x7c57('0x43')](handleError(_0x4a88a1,null));};exports['getFields']=function(_0x9b0eb4,_0x516be3,_0x48d408){var _0x315854='';return db['FreshdeskAccount'][_0x7c57('0x47')]({'where':{'id':_0x9b0eb4[_0x7c57('0x3f')]['id']},'attributes':['id',_0x7c57('0x51'),_0x7c57('0x52')]})[_0x7c57('0x22')](handleEntityNotFound(_0x516be3,null))['then'](function(_0x193756){if(_0x193756){_0x315854=_0x193756[_0x7c57('0x51')];var _0x529c4a=_0x315854['slice'](-0x1);if(_0x529c4a==='/'){_0x315854=_0x315854['substring'](0x0,_0x315854[_0x7c57('0x53')](_0x529c4a));}return rp({'method':_0x7c57('0x54'),'uri':util[_0x7c57('0x55')](_0x7c57('0x56'),_0x315854,_0x7c57('0x57')),'headers':{'Authorization':util[_0x7c57('0x55')](_0x7c57('0x58'),new Buffer(util[_0x7c57('0x55')](_0x7c57('0x59'),_0x193756['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x7c57('0x22')](function(_0x46ea6d){if(_0x46ea6d){var _0x5d0787=['requester',_0x7c57('0x5a'),_0x7c57('0x5b'),'description',_0x7c57('0x19'),'priority',_0x7c57('0x5c'),_0x7c57('0x5d'),_0x7c57('0x5e'),_0x7c57('0x5c'),'company'];_[_0x7c57('0x5f')](_0x46ea6d,function(_0x852b1c){return _0x5d0787['includes'](_0x852b1c[_0x7c57('0x25')])||!_0x852b1c['default']&&_0x852b1c[_0x7c57('0x2b')]!==_0x7c57('0x60')&&_0x852b1c['type']!==_0x7c57('0x61');});return{'count':_0x46ea6d['length'],'rows':_['map'](_0x46ea6d,function(_0x106c37){return{'id':_0x106c37[_0x7c57('0x25')],'name':_0x106c37['label'],'custom':!_0x106c37[_0x7c57('0x62')],'options':_0x106c37[_0x7c57('0x63')]?_[_0x7c57('0x27')](_0x106c37['choices'],function(_0x5422f2){return{'name':_['capitalize'](_0x5422f2),'value':_0x5422f2};}):[]};})};}})['then'](respondWithResult(_0x516be3,null))[_0x7c57('0x43')](function(_0x251955){var _0x2211f9=_0x9b0eb4[_0x7c57('0x2d')][_0x7c57('0x64')]?0x1f4:_0x251955['statusCode']||0x1f4;logger[_0x7c57('0x65')](_0x7c57('0x66'),_0x7c57('0x67'),_0x2211f9,JSON[_0x7c57('0x68')](_0x251955));delete _0x251955['name'];if(_0x2211f9===0x191){_0x2211f9=0x190;}_0x516be3[_0x7c57('0x19')](_0x2211f9)[_0x7c57('0x69')](_0x9b0eb4[_0x7c57('0x2d')][_0x7c57('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x251955[_0x7c57('0x6a')]}:_0x251955);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 79056a9..e93b911 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 _0x6f9b=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','lodash','util','api','bluebird','request-promise'];(function(_0x414543,_0x300927){var _0x2eecb6=function(_0x13eb3d){while(--_0x13eb3d){_0x414543['push'](_0x414543['shift']());}};_0x2eecb6(++_0x300927);}(_0x6f9b,0xdf));var _0xb6f9=function(_0x3ef13b,_0x2f1002){_0x3ef13b=_0x3ef13b-0x0;var _0x51a8db=_0x6f9b[_0x3ef13b];return _0x51a8db;};'use strict';var _=require(_0xb6f9('0x0'));var util=require(_0xb6f9('0x1'));var logger=require('../../config/logger')(_0xb6f9('0x2'));var moment=require('moment');var BPromise=require(_0xb6f9('0x3'));var rp=require(_0xb6f9('0x4'));var fs=require('fs');var path=require(_0xb6f9('0x5'));var rimraf=require(_0xb6f9('0x6'));var config=require(_0xb6f9('0x7'));var attributes=require(_0xb6f9('0x8'));var integrations=require(_0xb6f9('0x9'));module['exports']=function(_0x23976b,_0x3a842b){return _0x23976b[_0xb6f9('0xa')](_0xb6f9('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5f=['lodash','api','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xfe5f,0x6c));var _0xffe5=function(_0x284330,_0xeba324){_0x284330=_0x284330-0x0;var _0x12b57a=_0xfe5f[_0x284330];return _0x12b57a;};'use strict';var _=require(_0xffe5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xffe5('0x1'));var moment=require(_0xffe5('0x2'));var BPromise=require(_0xffe5('0x3'));var rp=require(_0xffe5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffe5('0x5'));var config=require('../../config/environment');var attributes=require(_0xffe5('0x6'));var integrations=require(_0xffe5('0x7'));module[_0xffe5('0x8')]=function(_0x2fc091,_0x4c2831){return _0x2fc091[_0xffe5('0x9')](_0xffe5('0xa'),attributes,{'tableName':_0xffe5('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 8f4dbc3..627a62c 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 _0x6904=['http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','FreshdeskAccount','findAll','raw','options','where','limit','map','include','model','attributes','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x570df7,_0x169e53){var _0x6bc984=function(_0x5481d2){while(--_0x5481d2){_0x570df7['push'](_0x570df7['shift']());}};_0x6bc984(++_0x169e53);}(_0x6904,0xd9));var _0x4690=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x6904[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x4690('0x0'));var util=require('util');var moment=require(_0x4690('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4690('0x2'))['db'];var utils=require(_0x4690('0x3'));var logger=require(_0x4690('0x4'))('rpc');var config=require(_0x4690('0x5'));var jayson=require(_0x4690('0x6'));var client=jayson['client'][_0x4690('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4071dd,_0x5b4a0d,_0x8980b9){return new BPromise(function(_0x369476,_0x28de59){return client[_0x4690('0x8')](_0x4071dd,_0x8980b9)[_0x4690('0x9')](function(_0x3a6233){logger['info'](_0x4690('0xa'),_0x5b4a0d,_0x4690('0xb'));logger[_0x4690('0xc')](_0x4690('0xd'),_0x5b4a0d,'request\x20sent',JSON[_0x4690('0xe')](_0x3a6233));if(_0x3a6233[_0x4690('0xf')]){if(_0x3a6233[_0x4690('0xf')]['code']===0x1f4){logger[_0x4690('0xf')](_0x4690('0xa'),_0x5b4a0d,_0x3a6233[_0x4690('0xf')][_0x4690('0x10')]);return _0x28de59(_0x3a6233[_0x4690('0xf')][_0x4690('0x10')]);}logger[_0x4690('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x5b4a0d,_0x3a6233[_0x4690('0xf')][_0x4690('0x10')]);return _0x369476(_0x3a6233[_0x4690('0xf')]['message']);}else{logger[_0x4690('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x5b4a0d,'request\x20sent');_0x369476(_0x3a6233['result'][_0x4690('0x10')]);}})[_0x4690('0x12')](function(_0x318626){logger[_0x4690('0xf')](_0x4690('0xa'),_0x5b4a0d,_0x318626);_0x28de59(_0x318626);});});}exports['GetFreshdeskAccount']=function(_0x11f24e){var _0x840e29=this;return new Promise(function(_0x2bcf25,_0x44f09a){return db[_0x4690('0x13')][_0x4690('0x14')]({'raw':_0x11f24e['options']?_0x11f24e['options'][_0x4690('0x15')]===undefined?!![]:![]:!![],'where':_0x11f24e['options']?_0x11f24e[_0x4690('0x16')][_0x4690('0x17')]||null:null,'attributes':_0x11f24e[_0x4690('0x16')]?_0x11f24e[_0x4690('0x16')]['attributes']||null:null,'limit':_0x11f24e[_0x4690('0x16')]?_0x11f24e[_0x4690('0x16')][_0x4690('0x18')]||null:null,'include':_0x11f24e['options']?_0x11f24e[_0x4690('0x16')]['include']?_[_0x4690('0x19')](_0x11f24e[_0x4690('0x16')][_0x4690('0x1a')],function(_0x58bc4d){return{'model':db[_0x58bc4d['model']],'as':_0x58bc4d['as'],'attributes':_0x58bc4d['attributes'],'include':_0x58bc4d['include']?_[_0x4690('0x19')](_0x58bc4d[_0x4690('0x1a')],function(_0x4f4fa0){return{'model':db[_0x4f4fa0[_0x4690('0x1b')]],'as':_0x4f4fa0['as'],'attributes':_0x4f4fa0['attributes'],'include':_0x4f4fa0[_0x4690('0x1a')]?_[_0x4690('0x19')](_0x4f4fa0[_0x4690('0x1a')],function(_0x2d7ea4){return{'model':db[_0x2d7ea4[_0x4690('0x1b')]],'as':_0x2d7ea4['as'],'attributes':_0x2d7ea4[_0x4690('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4690('0x9')](function(_0x3b050a){logger[_0x4690('0x11')](_0x4690('0x1d'),_0x11f24e);logger['debug'](_0x4690('0x1d'),_0x11f24e,JSON[_0x4690('0xe')](_0x3b050a));_0x2bcf25(_0x3b050a);})['catch'](function(_0x353c99){logger['error'](_0x4690('0x1d'),_0x353c99['message'],_0x11f24e);_0x44f09a(_0x840e29['error'](0x1f4,_0x353c99[_0x4690('0x10')]));});});};exports[_0x4690('0x1e')]=function(_0x475bf7){var _0x4db451=this;return new Promise(function(_0x574581,_0x114695){return db[_0x4690('0x13')][_0x4690('0x1f')]({'raw':_0x475bf7[_0x4690('0x16')]?_0x475bf7[_0x4690('0x16')][_0x4690('0x15')]===undefined?!![]:![]:!![],'where':_0x475bf7['options']?_0x475bf7[_0x4690('0x16')]['where']||null:null,'attributes':_0x475bf7[_0x4690('0x16')]?_0x475bf7[_0x4690('0x16')]['attributes']||null:null,'include':_0x475bf7[_0x4690('0x16')]?_0x475bf7[_0x4690('0x16')][_0x4690('0x1a')]?_[_0x4690('0x19')](_0x475bf7[_0x4690('0x16')][_0x4690('0x1a')],function(_0x30fcf7){return{'model':db[_0x30fcf7[_0x4690('0x1b')]],'as':_0x30fcf7['as'],'attributes':_0x30fcf7[_0x4690('0x1c')],'include':_0x30fcf7['include']?_[_0x4690('0x19')](_0x30fcf7['include'],function(_0x20f114){return{'model':db[_0x20f114['model']],'as':_0x20f114['as'],'attributes':_0x20f114[_0x4690('0x1c')],'include':_0x20f114[_0x4690('0x1a')]?_[_0x4690('0x19')](_0x20f114[_0x4690('0x1a')],function(_0x908854){return{'model':db[_0x908854[_0x4690('0x1b')]],'as':_0x908854['as'],'attributes':_0x908854[_0x4690('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40fe8d){logger[_0x4690('0x11')](_0x4690('0x1e'),_0x475bf7);logger[_0x4690('0xc')](_0x4690('0x1e'),_0x475bf7,JSON[_0x4690('0xe')](_0x40fe8d));_0x574581(_0x40fe8d);})['catch'](function(_0x168f1d){logger['error'](_0x4690('0x1e'),_0x168f1d[_0x4690('0x10')],_0x475bf7);_0x114695(_0x4db451[_0x4690('0xf')](0x1f4,_0x168f1d['message']));});});}; \ No newline at end of file +var _0x8ba1=['stringify','ShowFreshdeskAccount','FreshdeskAccount','find','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFreshdeskAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x8ba1,0x19e));var _0x18ba=function(_0x53fef3,_0x248968){_0x53fef3=_0x53fef3-0x0;var _0xc7bb8c=_0x8ba1[_0x53fef3];return _0xc7bb8c;};'use strict';var _=require('lodash');var util=require(_0x18ba('0x0'));var moment=require(_0x18ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x18ba('0x2'));var fs=require('fs');var Redis=require(_0x18ba('0x3'));var db=require(_0x18ba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x18ba('0x5'))(_0x18ba('0x6'));var config=require('../../config/environment');var jayson=require(_0x18ba('0x7'));var client=jayson[_0x18ba('0x8')][_0x18ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b08da,_0x11703b,_0xc61236){return new BPromise(function(_0xc3030a,_0x997350){return client['request'](_0x1b08da,_0xc61236)[_0x18ba('0xa')](function(_0x42d05f){logger[_0x18ba('0xb')](_0x18ba('0xc'),_0x11703b,_0x18ba('0xd'));logger[_0x18ba('0xe')](_0x18ba('0xf'),_0x11703b,_0x18ba('0xd'),JSON['stringify'](_0x42d05f));if(_0x42d05f[_0x18ba('0x10')]){if(_0x42d05f['error']['code']===0x1f4){logger[_0x18ba('0x10')](_0x18ba('0xc'),_0x11703b,_0x42d05f[_0x18ba('0x10')][_0x18ba('0x11')]);return _0x997350(_0x42d05f['error'][_0x18ba('0x11')]);}logger[_0x18ba('0x10')](_0x18ba('0xc'),_0x11703b,_0x42d05f[_0x18ba('0x10')][_0x18ba('0x11')]);return _0xc3030a(_0x42d05f[_0x18ba('0x10')][_0x18ba('0x11')]);}else{logger[_0x18ba('0xb')](_0x18ba('0xc'),_0x11703b,_0x18ba('0xd'));_0xc3030a(_0x42d05f[_0x18ba('0x12')][_0x18ba('0x11')]);}})['catch'](function(_0x531cb7){logger[_0x18ba('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x11703b,_0x531cb7);_0x997350(_0x531cb7);});});}exports[_0x18ba('0x13')]=function(_0xe14379){var _0x417c71=this;return new Promise(function(_0x403826,_0x4c521b){return db['FreshdeskAccount'][_0x18ba('0x14')]({'raw':_0xe14379[_0x18ba('0x15')]?_0xe14379['options']['raw']===undefined?!![]:![]:!![],'where':_0xe14379[_0x18ba('0x15')]?_0xe14379['options'][_0x18ba('0x16')]||null:null,'attributes':_0xe14379[_0x18ba('0x15')]?_0xe14379[_0x18ba('0x15')][_0x18ba('0x17')]||null:null,'limit':_0xe14379[_0x18ba('0x15')]?_0xe14379['options'][_0x18ba('0x18')]||null:null,'include':_0xe14379[_0x18ba('0x15')]?_0xe14379[_0x18ba('0x15')][_0x18ba('0x19')]?_[_0x18ba('0x1a')](_0xe14379[_0x18ba('0x15')][_0x18ba('0x19')],function(_0x3d92b3){return{'model':db[_0x3d92b3[_0x18ba('0x1b')]],'as':_0x3d92b3['as'],'attributes':_0x3d92b3[_0x18ba('0x17')],'include':_0x3d92b3[_0x18ba('0x19')]?_[_0x18ba('0x1a')](_0x3d92b3[_0x18ba('0x19')],function(_0x11e2f7){return{'model':db[_0x11e2f7[_0x18ba('0x1b')]],'as':_0x11e2f7['as'],'attributes':_0x11e2f7[_0x18ba('0x17')],'include':_0x11e2f7[_0x18ba('0x19')]?_[_0x18ba('0x1a')](_0x11e2f7[_0x18ba('0x19')],function(_0x101c4e){return{'model':db[_0x101c4e[_0x18ba('0x1b')]],'as':_0x101c4e['as'],'attributes':_0x101c4e[_0x18ba('0x17')]};}):[]};}):[]};}):[]:[]})[_0x18ba('0xa')](function(_0x2c2a4f){logger[_0x18ba('0xb')](_0x18ba('0x13'),_0xe14379);logger[_0x18ba('0xe')](_0x18ba('0x13'),_0xe14379,JSON[_0x18ba('0x1c')](_0x2c2a4f));_0x403826(_0x2c2a4f);})['catch'](function(_0x3e66c1){logger[_0x18ba('0x10')]('GetFreshdeskAccount',_0x3e66c1[_0x18ba('0x11')],_0xe14379);_0x4c521b(_0x417c71[_0x18ba('0x10')](0x1f4,_0x3e66c1['message']));});});};exports[_0x18ba('0x1d')]=function(_0x10950b){var _0x54c821=this;return new Promise(function(_0x398764,_0x5458b3){return db[_0x18ba('0x1e')][_0x18ba('0x1f')]({'raw':_0x10950b[_0x18ba('0x15')]?_0x10950b[_0x18ba('0x15')][_0x18ba('0x20')]===undefined?!![]:![]:!![],'where':_0x10950b[_0x18ba('0x15')]?_0x10950b['options'][_0x18ba('0x16')]||null:null,'attributes':_0x10950b[_0x18ba('0x15')]?_0x10950b[_0x18ba('0x15')]['attributes']||null:null,'include':_0x10950b[_0x18ba('0x15')]?_0x10950b['options'][_0x18ba('0x19')]?_['map'](_0x10950b[_0x18ba('0x15')][_0x18ba('0x19')],function(_0x2e6b56){return{'model':db[_0x2e6b56[_0x18ba('0x1b')]],'as':_0x2e6b56['as'],'attributes':_0x2e6b56[_0x18ba('0x17')],'include':_0x2e6b56[_0x18ba('0x19')]?_['map'](_0x2e6b56[_0x18ba('0x19')],function(_0x42480d){return{'model':db[_0x42480d['model']],'as':_0x42480d['as'],'attributes':_0x42480d[_0x18ba('0x17')],'include':_0x42480d[_0x18ba('0x19')]?_[_0x18ba('0x1a')](_0x42480d[_0x18ba('0x19')],function(_0x437796){return{'model':db[_0x437796['model']],'as':_0x437796['as'],'attributes':_0x437796[_0x18ba('0x17')]};}):[]};}):[]};}):[]:[]})[_0x18ba('0xa')](function(_0x190148){logger[_0x18ba('0xb')]('ShowFreshdeskAccount',_0x10950b);logger[_0x18ba('0xe')](_0x18ba('0x1d'),_0x10950b,JSON[_0x18ba('0x1c')](_0x190148));_0x398764(_0x190148);})[_0x18ba('0x21')](function(_0x2b10e5){logger[_0x18ba('0x10')](_0x18ba('0x1d'),_0x2b10e5[_0x18ba('0x11')],_0x10950b);_0x5458b3(_0x54c821[_0x18ba('0x10')](0x1f4,_0x2b10e5[_0x18ba('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index bad68d8..afdc6d1 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 _0x682d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getTags','create','post','/:id/tags','setTags','update','delete','exports','util','path','connect-timeout'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x682d,0x177));var _0xd682=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x682d[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xd682('0x0'));var path=require(_0xd682('0x1'));var timeout=require(_0xd682('0x2'));var express=require(_0xd682('0x3'));var router=express[_0xd682('0x4')]();var fs_extra=require(_0xd682('0x5'));var auth=require(_0xd682('0x6'));var interaction=require(_0xd682('0x7'));var config=require(_0xd682('0x8'));var controller=require(_0xd682('0x9'));router[_0xd682('0xa')]('/',auth[_0xd682('0xb')](),controller[_0xd682('0xc')]);router['get'](_0xd682('0xd'),auth[_0xd682('0xb')](),controller[_0xd682('0xe')]);router[_0xd682('0xa')](_0xd682('0xf'),auth[_0xd682('0xb')](),controller['getFields']);router['get'](_0xd682('0x10'),auth[_0xd682('0xb')](),controller[_0xd682('0x11')]);router['get'](_0xd682('0x12'),auth[_0xd682('0xb')](),controller['getDescriptions']);router[_0xd682('0xa')]('/:id/tags',auth[_0xd682('0xb')](),controller[_0xd682('0x13')]);router['post']('/',auth[_0xd682('0xb')](),controller[_0xd682('0x14')]);router[_0xd682('0x15')](_0xd682('0x16'),auth[_0xd682('0xb')](),controller[_0xd682('0x17')]);router['put'](_0xd682('0xd'),auth[_0xd682('0xb')](),controller[_0xd682('0x18')]);router[_0xd682('0x19')](_0xd682('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd682('0x1a')]=router; \ No newline at end of file +var _0x1e4d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','put','update'];(function(_0x29b3a2,_0x319af1){var _0x478ed2=function(_0x32ea1b){while(--_0x32ea1b){_0x29b3a2['push'](_0x29b3a2['shift']());}};_0x478ed2(++_0x319af1);}(_0x1e4d,0xab));var _0xd1e4=function(_0x468bd6,_0x1f06c4){_0x468bd6=_0x468bd6-0x0;var _0x11d7bb=_0x1e4d[_0x468bd6];return _0x11d7bb;};'use strict';var multer=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var path=require(_0xd1e4('0x2'));var timeout=require(_0xd1e4('0x3'));var express=require(_0xd1e4('0x4'));var router=express[_0xd1e4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1e4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e4('0x7'));var controller=require(_0xd1e4('0x8'));router[_0xd1e4('0x9')]('/',auth[_0xd1e4('0xa')](),controller[_0xd1e4('0xb')]);router[_0xd1e4('0x9')](_0xd1e4('0xc'),auth[_0xd1e4('0xa')](),controller[_0xd1e4('0xd')]);router[_0xd1e4('0x9')](_0xd1e4('0xe'),auth[_0xd1e4('0xa')](),controller[_0xd1e4('0xf')]);router[_0xd1e4('0x9')](_0xd1e4('0x10'),auth['isAuthenticated'](),controller[_0xd1e4('0x11')]);router[_0xd1e4('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xd1e4('0x12')]);router[_0xd1e4('0x9')](_0xd1e4('0x13'),auth[_0xd1e4('0xa')](),controller['getTags']);router[_0xd1e4('0x14')]('/',auth[_0xd1e4('0xa')](),controller[_0xd1e4('0x15')]);router[_0xd1e4('0x14')]('/:id/tags',auth[_0xd1e4('0xa')](),controller[_0xd1e4('0x16')]);router[_0xd1e4('0x17')](_0xd1e4('0xc'),auth[_0xd1e4('0xa')](),controller[_0xd1e4('0x18')]);router[_0xd1e4('0x19')](_0xd1e4('0xc'),auth['isAuthenticated'](),controller[_0xd1e4('0x1a')]);module[_0xd1e4('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 d0f389e..8d93e30 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 _0x096b=['STRING','sequelize'];(function(_0x2f3fa1,_0x1a7215){var _0x4265e0=function(_0x4c6701){while(--_0x4c6701){_0x2f3fa1['push'](_0x2f3fa1['shift']());}};_0x4265e0(++_0x1a7215);}(_0x096b,0x109));var _0xb096=function(_0xb5e21e,_0x2cbc71){_0xb5e21e=_0xb5e21e-0x0;var _0x49ffb2=_0x096b[_0xb5e21e];return _0x49ffb2;};'use strict';var Sequelize=require(_0xb096('0x0'));module['exports']={'name':{'type':Sequelize[_0xb096('0x1')]},'description':{'type':Sequelize[_0xb096('0x1')]}}; \ No newline at end of file +var _0x1436=['exports','STRING'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x1436,0x1ba));var _0x6143=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1436[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x6143('0x0')]={'name':{'type':Sequelize[_0x6143('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2eb41dc..11594e1 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 _0x93e0=['merge','options','include','rows','catch','show','keys','includeAll','create','update','body','find','params','destroy','findOne','FreshdeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL'];(function(_0x51b7f7,_0x2b20f0){var _0x332742=function(_0x7fc190){while(--_0x7fc190){_0x51b7f7['push'](_0x51b7f7['shift']());}};_0x332742(++_0x2b20f0);}(_0x93e0,0xbc));var _0x093e=function(_0x37e8ba,_0x2134ea){_0x37e8ba=_0x37e8ba-0x0;var _0xf3f1ea=_0x93e0[_0x37e8ba];return _0xf3f1ea;};'use strict';var emlformat=require(_0x093e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x093e('0x1'));var rp=require(_0x093e('0x2'));var moment=require('moment');var BPromise=require(_0x093e('0x3'));var Mustache=require(_0x093e('0x4'));var util=require(_0x093e('0x5'));var path=require(_0x093e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x093e('0x7'));var fs=require('fs');var fs_extra=require(_0x093e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x093e('0x9'));var deskjs=require(_0x093e('0xa'));var toCsv=require(_0x093e('0xb'));var querystring=require(_0x093e('0xc'));var Papa=require(_0x093e('0xd'));var Redis=require(_0x093e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x093e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x093e('0x10'))(_0x093e('0x11'));var utils=require(_0x093e('0x12'));var config=require(_0x093e('0x13'));var licenseUtil=require(_0x093e('0x14'));var db=require(_0x093e('0x15'))['db'];function respondWithStatusCode(_0xeee2e8,_0x29d7f1){_0x29d7f1=_0x29d7f1||0xcc;return function(_0x1c92c9){if(_0x1c92c9){return _0xeee2e8[_0x093e('0x16')](_0x29d7f1);}return _0xeee2e8['status'](_0x29d7f1)[_0x093e('0x17')]();};}function respondWithResult(_0x2d6624,_0x4ba7da){_0x4ba7da=_0x4ba7da||0xc8;return function(_0x5c150b){if(_0x5c150b){return _0x2d6624[_0x093e('0x18')](_0x4ba7da)[_0x093e('0x19')](_0x5c150b);}};}function respondWithFilteredResult(_0x50c314,_0x9f7b09){return function(_0x3941be){if(_0x3941be){var _0x3d8f31=typeof _0x9f7b09[_0x093e('0x1a')]===_0x093e('0x1b')&&typeof _0x9f7b09[_0x093e('0x1c')]===_0x093e('0x1b');var _0x1675d8=_0x3941be['count'];var _0x103e38=_0x3d8f31?0x0:_0x9f7b09[_0x093e('0x1a')];var _0x586219=_0x3d8f31?_0x3941be[_0x093e('0x1d')]:_0x9f7b09['offset']+_0x9f7b09[_0x093e('0x1c')];var _0x543c65;if(_0x586219>=_0x1675d8){_0x586219=_0x1675d8;_0x543c65=0xc8;}else{_0x543c65=0xce;}_0x50c314[_0x093e('0x18')](_0x543c65);return _0x50c314[_0x093e('0x1e')](_0x093e('0x1f'),_0x103e38+'-'+_0x586219+'/'+_0x1675d8)['json'](_0x3941be);}return null;};}function patchUpdates(_0x501140){return function(_0x1e4445){try{jsonpatch[_0x093e('0x20')](_0x1e4445,_0x501140,!![]);}catch(_0x73bbba){return BPromise[_0x093e('0x21')](_0x73bbba);}return _0x1e4445['save']();};}function saveUpdates(_0x2648f8,_0x4d85ec){return function(_0x29ff10){if(_0x29ff10){return _0x29ff10['update'](_0x2648f8)[_0x093e('0x22')](function(_0x1261ac){return _0x1261ac;});}return null;};}function removeEntity(_0x2f7972,_0x2e75f9){return function(_0x4e8741){if(_0x4e8741){return _0x4e8741['destroy']()[_0x093e('0x22')](function(){_0x2f7972[_0x093e('0x18')](0xcc)[_0x093e('0x17')]();});}};}function handleEntityNotFound(_0x2c75db,_0x3c4c4c){return function(_0x22882a){if(!_0x22882a){_0x2c75db[_0x093e('0x16')](0x194);}return _0x22882a;};}function handleError(_0x21ac5a,_0x496418){_0x496418=_0x496418||0x1f4;return function(_0x3994b3){logger[_0x093e('0x23')](_0x3994b3[_0x093e('0x24')]);if(_0x3994b3['name']){delete _0x3994b3['name'];}_0x21ac5a[_0x093e('0x18')](_0x496418)['send'](_0x3994b3);};}exports[_0x093e('0x25')]=function(_0x6c4603,_0x3d8262){var _0x2ea632={},_0x47ee6a={},_0x23fe20={'count':0x0,'rows':[]};var _0x2c2272=_[_0x093e('0x26')](db[_0x093e('0x27')][_0x093e('0x28')],function(_0x3b0534){return{'name':_0x3b0534['fieldName'],'type':_0x3b0534[_0x093e('0x29')][_0x093e('0x2a')]};});_0x47ee6a[_0x093e('0x2b')]=_[_0x093e('0x26')](_0x2c2272,_0x093e('0x2c'));_0x47ee6a[_0x093e('0x2d')]=_['keys'](_0x6c4603[_0x093e('0x2d')]);_0x47ee6a[_0x093e('0x2e')]=_[_0x093e('0x2f')](_0x47ee6a['model'],_0x47ee6a[_0x093e('0x2d')]);_0x2ea632[_0x093e('0x30')]=_['intersection'](_0x47ee6a[_0x093e('0x2b')],qs[_0x093e('0x31')](_0x6c4603[_0x093e('0x2d')]['fields']));_0x2ea632[_0x093e('0x30')]=_0x2ea632[_0x093e('0x30')][_0x093e('0x32')]?_0x2ea632[_0x093e('0x30')]:_0x47ee6a[_0x093e('0x2b')];if(!_0x6c4603[_0x093e('0x2d')][_0x093e('0x33')](_0x093e('0x34'))){_0x2ea632[_0x093e('0x1c')]=qs[_0x093e('0x1c')](_0x6c4603['query'][_0x093e('0x1c')]);_0x2ea632[_0x093e('0x1a')]=qs['offset'](_0x6c4603[_0x093e('0x2d')][_0x093e('0x1a')]);}_0x2ea632['order']=qs['sort'](_0x6c4603[_0x093e('0x2d')][_0x093e('0x35')]);_0x2ea632[_0x093e('0x36')]=qs[_0x093e('0x2e')](_[_0x093e('0x37')](_0x6c4603[_0x093e('0x2d')],_0x47ee6a[_0x093e('0x2e')]),_0x2c2272);if(_0x6c4603[_0x093e('0x2d')][_0x093e('0x38')]){_0x2ea632[_0x093e('0x36')]=_['merge'](_0x2ea632['where'],{'$or':_['map'](_0x2c2272,function(_0x17c06e){if(_0x17c06e[_0x093e('0x29')]!==_0x093e('0x39')){var _0x874735={};_0x874735[_0x17c06e[_0x093e('0x2c')]]={'$like':'%'+_0x6c4603[_0x093e('0x2d')][_0x093e('0x38')]+'%'};return _0x874735;}})});}_0x2ea632=_[_0x093e('0x3a')]({},_0x2ea632,_0x6c4603[_0x093e('0x3b')]);var _0x59c59d={'where':_0x2ea632[_0x093e('0x36')]};return db[_0x093e('0x27')][_0x093e('0x1d')](_0x59c59d)[_0x093e('0x22')](function(_0x5e17b5){_0x23fe20[_0x093e('0x1d')]=_0x5e17b5;if(_0x6c4603[_0x093e('0x2d')]['includeAll']){_0x2ea632[_0x093e('0x3c')]=[{'all':!![]}];}return db[_0x093e('0x27')]['findAll'](_0x2ea632);})[_0x093e('0x22')](function(_0x2207ff){_0x23fe20[_0x093e('0x3d')]=_0x2207ff;return _0x23fe20;})[_0x093e('0x22')](respondWithFilteredResult(_0x3d8262,_0x2ea632))[_0x093e('0x3e')](handleError(_0x3d8262,null));};exports[_0x093e('0x3f')]=function(_0x2a0d27,_0x41bf4e){var _0x32b7ef={'raw':![],'where':{'id':_0x2a0d27['params']['id']}},_0x25ab54={};_0x25ab54[_0x093e('0x2b')]=_[_0x093e('0x40')](db[_0x093e('0x27')][_0x093e('0x28')]);_0x25ab54[_0x093e('0x2d')]=_['keys'](_0x2a0d27[_0x093e('0x2d')]);_0x25ab54[_0x093e('0x2e')]=_[_0x093e('0x2f')](_0x25ab54['model'],_0x25ab54[_0x093e('0x2d')]);_0x32b7ef[_0x093e('0x30')]=_['intersection'](_0x25ab54['model'],qs[_0x093e('0x31')](_0x2a0d27[_0x093e('0x2d')][_0x093e('0x31')]));_0x32b7ef[_0x093e('0x30')]=_0x32b7ef[_0x093e('0x30')]['length']?_0x32b7ef[_0x093e('0x30')]:_0x25ab54[_0x093e('0x2b')];if(_0x2a0d27['query'][_0x093e('0x41')]){_0x32b7ef['include']=[{'all':!![]}];}_0x32b7ef=_[_0x093e('0x3a')]({},_0x32b7ef,_0x2a0d27[_0x093e('0x3b')]);return db[_0x093e('0x27')]['find'](_0x32b7ef)[_0x093e('0x22')](handleEntityNotFound(_0x41bf4e,null))[_0x093e('0x22')](respondWithResult(_0x41bf4e,null))[_0x093e('0x3e')](handleError(_0x41bf4e,null));};exports[_0x093e('0x42')]=function(_0x2b8354,_0x3342c0){return db['FreshdeskConfiguration']['create'](_0x2b8354['body'],{})[_0x093e('0x22')](respondWithResult(_0x3342c0,0xc9))[_0x093e('0x3e')](handleError(_0x3342c0,null));};exports[_0x093e('0x43')]=function(_0x118f8e,_0x5b615f){if(_0x118f8e[_0x093e('0x44')]['id']){delete _0x118f8e[_0x093e('0x44')]['id'];}return db[_0x093e('0x27')][_0x093e('0x45')]({'where':{'id':_0x118f8e[_0x093e('0x46')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x5b615f,null))[_0x093e('0x22')](saveUpdates(_0x118f8e[_0x093e('0x44')],null))[_0x093e('0x22')](respondWithResult(_0x5b615f,null))[_0x093e('0x3e')](handleError(_0x5b615f,null));};exports[_0x093e('0x47')]=function(_0x25c971,_0x49365a){return db[_0x093e('0x27')][_0x093e('0x45')]({'where':{'id':_0x25c971[_0x093e('0x46')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x49365a,null))[_0x093e('0x22')](removeEntity(_0x49365a,null))[_0x093e('0x3e')](handleError(_0x49365a,null));};exports['getFields']=function(_0x56606e,_0xde1420,_0x50ef72){var _0x26000f={};var _0x5bdf44={};var _0x40f7cc;var _0x49dbdf;return db[_0x093e('0x27')][_0x093e('0x48')]({'where':{'id':_0x56606e[_0x093e('0x46')]['id']}})['then'](handleEntityNotFound(_0xde1420,null))['then'](function(_0x341503){if(_0x341503){_0x40f7cc=_0x341503;_0x5bdf44[_0x093e('0x2b')]=_[_0x093e('0x40')](db[_0x093e('0x49')]['rawAttributes']);_0x5bdf44['query']=_[_0x093e('0x40')](_0x56606e[_0x093e('0x2d')]);_0x5bdf44[_0x093e('0x2e')]=_[_0x093e('0x2f')](_0x5bdf44[_0x093e('0x2b')],_0x5bdf44[_0x093e('0x2d')]);_0x26000f[_0x093e('0x30')]=_[_0x093e('0x2f')](_0x5bdf44['model'],qs[_0x093e('0x31')](_0x56606e[_0x093e('0x2d')][_0x093e('0x31')]));_0x26000f[_0x093e('0x30')]=_0x26000f[_0x093e('0x30')]['length']?_0x26000f[_0x093e('0x30')]:_0x5bdf44[_0x093e('0x2b')];_0x26000f[_0x093e('0x4a')]=qs[_0x093e('0x35')](_0x56606e[_0x093e('0x2d')][_0x093e('0x35')]);_0x26000f[_0x093e('0x36')]=qs[_0x093e('0x2e')](_['pick'](_0x56606e[_0x093e('0x2d')],_0x5bdf44[_0x093e('0x2e')]));if(_0x56606e[_0x093e('0x2d')][_0x093e('0x38')]){_0x26000f[_0x093e('0x36')]=_['merge'](_0x26000f[_0x093e('0x36')],{'$or':_[_0x093e('0x26')](_0x26000f['attributes'],function(_0x59ef4e){var _0x25405c={};_0x25405c[_0x59ef4e]={'$like':'%'+_0x56606e[_0x093e('0x2d')][_0x093e('0x38')]+'%'};return _0x25405c;})});}_0x26000f=_['merge']({},_0x26000f,_0x56606e['options']);return _0x40f7cc[_0x093e('0x4b')](_0x26000f);}})[_0x093e('0x22')](function(_0x1fe2ef){if(_0x1fe2ef){_0x49dbdf=_0x1fe2ef[_0x093e('0x32')];if(!_0x56606e[_0x093e('0x2d')][_0x093e('0x33')](_0x093e('0x34'))){_0x26000f[_0x093e('0x1c')]=qs['limit'](_0x56606e[_0x093e('0x2d')][_0x093e('0x1c')]);_0x26000f[_0x093e('0x1a')]=qs[_0x093e('0x1a')](_0x56606e[_0x093e('0x2d')][_0x093e('0x1a')]);}return _0x40f7cc[_0x093e('0x4b')](_0x26000f);}})['then'](function(_0x3e63fb){if(_0x3e63fb){return _0x3e63fb?{'count':_0x49dbdf,'rows':_0x3e63fb}:null;}})[_0x093e('0x22')](respondWithResult(_0xde1420,null))[_0x093e('0x3e')](handleError(_0xde1420,null));};exports[_0x093e('0x4c')]=function(_0x4019b2,_0x34b141,_0x251ebd){var _0x49264e={};var _0x2a84e4={};var _0x12e28b;var _0x23dfd6;return db[_0x093e('0x27')]['findOne']({'where':{'id':_0x4019b2[_0x093e('0x46')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x34b141,null))[_0x093e('0x22')](function(_0x74561d){if(_0x74561d){_0x12e28b=_0x74561d;_0x2a84e4[_0x093e('0x2b')]=_[_0x093e('0x40')](db[_0x093e('0x49')][_0x093e('0x28')]);_0x2a84e4['query']=_[_0x093e('0x40')](_0x4019b2['query']);_0x2a84e4[_0x093e('0x2e')]=_[_0x093e('0x2f')](_0x2a84e4['model'],_0x2a84e4[_0x093e('0x2d')]);_0x49264e[_0x093e('0x30')]=_[_0x093e('0x2f')](_0x2a84e4[_0x093e('0x2b')],qs[_0x093e('0x31')](_0x4019b2[_0x093e('0x2d')][_0x093e('0x31')]));_0x49264e[_0x093e('0x30')]=_0x49264e[_0x093e('0x30')][_0x093e('0x32')]?_0x49264e[_0x093e('0x30')]:_0x2a84e4[_0x093e('0x2b')];_0x49264e[_0x093e('0x4a')]=qs[_0x093e('0x35')](_0x4019b2[_0x093e('0x2d')]['sort']);_0x49264e['where']=qs['filters'](_[_0x093e('0x37')](_0x4019b2[_0x093e('0x2d')],_0x2a84e4['filters']));if(_0x4019b2['query'][_0x093e('0x38')]){_0x49264e['where']=_['merge'](_0x49264e['where'],{'$or':_['map'](_0x49264e[_0x093e('0x30')],function(_0x29b4b0){var _0x557367={};_0x557367[_0x29b4b0]={'$like':'%'+_0x4019b2[_0x093e('0x2d')][_0x093e('0x38')]+'%'};return _0x557367;})});}_0x49264e=_[_0x093e('0x3a')]({},_0x49264e,_0x4019b2[_0x093e('0x3b')]);return _0x12e28b[_0x093e('0x4c')](_0x49264e);}})[_0x093e('0x22')](function(_0x1823ca){if(_0x1823ca){_0x23dfd6=_0x1823ca[_0x093e('0x32')];if(!_0x4019b2[_0x093e('0x2d')][_0x093e('0x33')](_0x093e('0x34'))){_0x49264e[_0x093e('0x1c')]=qs[_0x093e('0x1c')](_0x4019b2[_0x093e('0x2d')][_0x093e('0x1c')]);_0x49264e['offset']=qs[_0x093e('0x1a')](_0x4019b2[_0x093e('0x2d')][_0x093e('0x1a')]);}return _0x12e28b[_0x093e('0x4c')](_0x49264e);}})['then'](function(_0x13c12a){if(_0x13c12a){return _0x13c12a?{'count':_0x23dfd6,'rows':_0x13c12a}:null;}})[_0x093e('0x22')](respondWithResult(_0x34b141,null))['catch'](handleError(_0x34b141,null));};exports[_0x093e('0x4d')]=function(_0x2fb90c,_0x1bf2a4,_0x38f01f){var _0x4e1361={};var _0x5a4fc6={};var _0x425774;var _0x7d964e;return db[_0x093e('0x27')][_0x093e('0x48')]({'where':{'id':_0x2fb90c[_0x093e('0x46')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x1bf2a4,null))[_0x093e('0x22')](function(_0x1cd701){if(_0x1cd701){_0x425774=_0x1cd701;_0x5a4fc6[_0x093e('0x2b')]=_[_0x093e('0x40')](db['FreshdeskField']['rawAttributes']);_0x5a4fc6[_0x093e('0x2d')]=_[_0x093e('0x40')](_0x2fb90c[_0x093e('0x2d')]);_0x5a4fc6[_0x093e('0x2e')]=_[_0x093e('0x2f')](_0x5a4fc6['model'],_0x5a4fc6[_0x093e('0x2d')]);_0x4e1361['attributes']=_[_0x093e('0x2f')](_0x5a4fc6[_0x093e('0x2b')],qs[_0x093e('0x31')](_0x2fb90c[_0x093e('0x2d')][_0x093e('0x31')]));_0x4e1361['attributes']=_0x4e1361[_0x093e('0x30')][_0x093e('0x32')]?_0x4e1361['attributes']:_0x5a4fc6[_0x093e('0x2b')];_0x4e1361['order']=qs[_0x093e('0x35')](_0x2fb90c[_0x093e('0x2d')][_0x093e('0x35')]);_0x4e1361[_0x093e('0x36')]=qs[_0x093e('0x2e')](_[_0x093e('0x37')](_0x2fb90c[_0x093e('0x2d')],_0x5a4fc6['filters']));if(_0x2fb90c[_0x093e('0x2d')]['filter']){_0x4e1361[_0x093e('0x36')]=_[_0x093e('0x3a')](_0x4e1361[_0x093e('0x36')],{'$or':_[_0x093e('0x26')](_0x4e1361[_0x093e('0x30')],function(_0x4175e1){var _0x516072={};_0x516072[_0x4175e1]={'$like':'%'+_0x2fb90c[_0x093e('0x2d')][_0x093e('0x38')]+'%'};return _0x516072;})});}_0x4e1361=_[_0x093e('0x3a')]({},_0x4e1361,_0x2fb90c[_0x093e('0x3b')]);return _0x425774['getDescriptions'](_0x4e1361);}})[_0x093e('0x22')](function(_0x1ee274){if(_0x1ee274){_0x7d964e=_0x1ee274[_0x093e('0x32')];if(!_0x2fb90c[_0x093e('0x2d')][_0x093e('0x33')](_0x093e('0x34'))){_0x4e1361[_0x093e('0x1c')]=qs['limit'](_0x2fb90c[_0x093e('0x2d')][_0x093e('0x1c')]);_0x4e1361[_0x093e('0x1a')]=qs['offset'](_0x2fb90c[_0x093e('0x2d')][_0x093e('0x1a')]);}return _0x425774[_0x093e('0x4d')](_0x4e1361);}})['then'](function(_0x342629){if(_0x342629){return _0x342629?{'count':_0x7d964e,'rows':_0x342629}:null;}})[_0x093e('0x22')](respondWithResult(_0x1bf2a4,null))[_0x093e('0x3e')](handleError(_0x1bf2a4,null));};exports[_0x093e('0x4e')]=function(_0x1922b2,_0xc6f582,_0x343cad){var _0x83f803={};var _0x24ffdb={};var _0x2414b6;var _0x36d19b;return db['FreshdeskConfiguration'][_0x093e('0x48')]({'where':{'id':_0x1922b2[_0x093e('0x46')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0xc6f582,null))[_0x093e('0x22')](function(_0x57c039){if(_0x57c039){_0x2414b6=_0x57c039;_0x24ffdb[_0x093e('0x2b')]=_[_0x093e('0x40')](db[_0x093e('0x4f')][_0x093e('0x28')]);_0x24ffdb[_0x093e('0x2d')]=_['keys'](_0x1922b2[_0x093e('0x2d')]);_0x24ffdb[_0x093e('0x2e')]=_[_0x093e('0x2f')](_0x24ffdb[_0x093e('0x2b')],_0x24ffdb[_0x093e('0x2d')]);_0x83f803['attributes']=_[_0x093e('0x2f')](_0x24ffdb[_0x093e('0x2b')],qs[_0x093e('0x31')](_0x1922b2[_0x093e('0x2d')][_0x093e('0x31')]));_0x83f803[_0x093e('0x30')]=_0x83f803[_0x093e('0x30')][_0x093e('0x32')]?_0x83f803['attributes']:_0x24ffdb[_0x093e('0x2b')];_0x83f803[_0x093e('0x4a')]=qs[_0x093e('0x35')](_0x1922b2[_0x093e('0x2d')][_0x093e('0x35')]);_0x83f803[_0x093e('0x36')]=qs[_0x093e('0x2e')](_[_0x093e('0x37')](_0x1922b2[_0x093e('0x2d')],_0x24ffdb[_0x093e('0x2e')]));if(_0x1922b2[_0x093e('0x2d')]['filter']){_0x83f803['where']=_['merge'](_0x83f803[_0x093e('0x36')],{'$or':_[_0x093e('0x26')](_0x83f803['attributes'],function(_0x2ed0f9){var _0x4d4697={};_0x4d4697[_0x2ed0f9]={'$like':'%'+_0x1922b2['query'][_0x093e('0x38')]+'%'};return _0x4d4697;})});}_0x83f803=_[_0x093e('0x3a')]({},_0x83f803,_0x1922b2[_0x093e('0x3b')]);return _0x2414b6[_0x093e('0x4e')](_0x83f803);}})['then'](function(_0x23ea4c){if(_0x23ea4c){_0x36d19b=_0x23ea4c['length'];if(!_0x1922b2['query'][_0x093e('0x33')](_0x093e('0x34'))){_0x83f803[_0x093e('0x1c')]=qs[_0x093e('0x1c')](_0x1922b2[_0x093e('0x2d')]['limit']);_0x83f803[_0x093e('0x1a')]=qs[_0x093e('0x1a')](_0x1922b2[_0x093e('0x2d')][_0x093e('0x1a')]);}return _0x2414b6['getTags'](_0x83f803);}})[_0x093e('0x22')](function(_0x19f9c9){if(_0x19f9c9){return _0x19f9c9?{'count':_0x36d19b,'rows':_0x19f9c9}:null;}})[_0x093e('0x22')](respondWithResult(_0xc6f582,null))[_0x093e('0x3e')](handleError(_0xc6f582,null));};exports[_0x093e('0x50')]=function(_0xcc3895,_0x4c8c4a,_0x4a3cd1){if(_0xcc3895[_0x093e('0x44')]['id']){delete _0xcc3895['body']['id'];}return db[_0x093e('0x27')][_0x093e('0x48')]({'where':{'id':_0xcc3895['params']['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x4c8c4a,null))[_0x093e('0x22')](function(_0x1a21a7){if(_0x1a21a7){return _0x1a21a7[_0x093e('0x50')](_0xcc3895[_0x093e('0x44')][_0x093e('0x51')]||[]);}return null;})[_0x093e('0x22')](respondWithResult(_0x4c8c4a,null))[_0x093e('0x3e')](handleError(_0x4c8c4a,null));}; \ No newline at end of file +var _0xf331=['Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','includeAll','find','create','body','destroy','findOne','FreshdeskField','getFields','getSubjects','order','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','count'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0xf331,0x125));var _0x1f33=function(_0x1e84d8,_0x564e9b){_0x1e84d8=_0x1e84d8-0x0;var _0x1fed3f=_0xf331[_0x1e84d8];return _0x1fed3f;};'use strict';var emlformat=require(_0x1f33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f33('0x2'));var moment=require(_0x1f33('0x3'));var BPromise=require(_0x1f33('0x4'));var Mustache=require('mustache');var util=require(_0x1f33('0x5'));var path=require(_0x1f33('0x6'));var sox=require('sox');var csv=require(_0x1f33('0x7'));var ejs=require(_0x1f33('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f33('0x9'));var squel=require(_0x1f33('0xa'));var crypto=require(_0x1f33('0xb'));var jsforce=require(_0x1f33('0xc'));var deskjs=require(_0x1f33('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f33('0xe'));var Papa=require(_0x1f33('0xf'));var Redis=require(_0x1f33('0x10'));var authService=require(_0x1f33('0x11'));var qs=require(_0x1f33('0x12'));var as=require(_0x1f33('0x13'));var hardwareService=require(_0x1f33('0x14'));var logger=require(_0x1f33('0x15'))(_0x1f33('0x16'));var utils=require(_0x1f33('0x17'));var config=require(_0x1f33('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a0d7d,_0x1dda78){_0x1dda78=_0x1dda78||0xcc;return function(_0x156f18){if(_0x156f18){return _0x4a0d7d[_0x1f33('0x19')](_0x1dda78);}return _0x4a0d7d[_0x1f33('0x1a')](_0x1dda78)[_0x1f33('0x1b')]();};}function respondWithResult(_0x498a56,_0xe127f2){_0xe127f2=_0xe127f2||0xc8;return function(_0x4183b4){if(_0x4183b4){return _0x498a56['status'](_0xe127f2)['json'](_0x4183b4);}};}function respondWithFilteredResult(_0x38c45f,_0x53bbab){return function(_0x5193e5){if(_0x5193e5){var _0x524147=typeof _0x53bbab[_0x1f33('0x1c')]==='undefined'&&typeof _0x53bbab[_0x1f33('0x1d')]==='undefined';var _0x4102be=_0x5193e5[_0x1f33('0x1e')];var _0x8a4087=_0x524147?0x0:_0x53bbab[_0x1f33('0x1c')];var _0x2dd3eb=_0x524147?_0x5193e5[_0x1f33('0x1e')]:_0x53bbab['offset']+_0x53bbab[_0x1f33('0x1d')];var _0x21d495;if(_0x2dd3eb>=_0x4102be){_0x2dd3eb=_0x4102be;_0x21d495=0xc8;}else{_0x21d495=0xce;}_0x38c45f['status'](_0x21d495);return _0x38c45f['set'](_0x1f33('0x1f'),_0x8a4087+'-'+_0x2dd3eb+'/'+_0x4102be)[_0x1f33('0x20')](_0x5193e5);}return null;};}function patchUpdates(_0x10bca9){return function(_0x422b1f){try{jsonpatch[_0x1f33('0x21')](_0x422b1f,_0x10bca9,!![]);}catch(_0x284056){return BPromise[_0x1f33('0x22')](_0x284056);}return _0x422b1f[_0x1f33('0x23')]();};}function saveUpdates(_0x1a6894,_0xe124f6){return function(_0xa5effe){if(_0xa5effe){return _0xa5effe[_0x1f33('0x24')](_0x1a6894)[_0x1f33('0x25')](function(_0x3a59a3){return _0x3a59a3;});}return null;};}function removeEntity(_0x1c8824,_0x306c9c){return function(_0x5b3cf0){if(_0x5b3cf0){return _0x5b3cf0['destroy']()[_0x1f33('0x25')](function(){_0x1c8824['status'](0xcc)[_0x1f33('0x1b')]();});}};}function handleEntityNotFound(_0x282f1d,_0x206fea){return function(_0x135a54){if(!_0x135a54){_0x282f1d[_0x1f33('0x19')](0x194);}return _0x135a54;};}function handleError(_0x5da6ce,_0x29967f){_0x29967f=_0x29967f||0x1f4;return function(_0xa1e634){logger[_0x1f33('0x26')](_0xa1e634['stack']);if(_0xa1e634[_0x1f33('0x27')]){delete _0xa1e634['name'];}_0x5da6ce[_0x1f33('0x1a')](_0x29967f)[_0x1f33('0x28')](_0xa1e634);};}exports[_0x1f33('0x29')]=function(_0x3cb973,_0x370a1c){var _0x138e61={},_0x22b1bc={},_0x1ff069={'count':0x0,'rows':[]};var _0x14f957=_[_0x1f33('0x2a')](db[_0x1f33('0x2b')][_0x1f33('0x2c')],function(_0x3f0c60){return{'name':_0x3f0c60['fieldName'],'type':_0x3f0c60[_0x1f33('0x2d')][_0x1f33('0x2e')]};});_0x22b1bc[_0x1f33('0x2f')]=_[_0x1f33('0x2a')](_0x14f957,_0x1f33('0x27'));_0x22b1bc[_0x1f33('0x30')]=_[_0x1f33('0x31')](_0x3cb973['query']);_0x22b1bc[_0x1f33('0x32')]=_[_0x1f33('0x33')](_0x22b1bc[_0x1f33('0x2f')],_0x22b1bc['query']);_0x138e61['attributes']=_[_0x1f33('0x33')](_0x22b1bc['model'],qs['fields'](_0x3cb973[_0x1f33('0x30')][_0x1f33('0x34')]));_0x138e61[_0x1f33('0x35')]=_0x138e61[_0x1f33('0x35')][_0x1f33('0x36')]?_0x138e61[_0x1f33('0x35')]:_0x22b1bc[_0x1f33('0x2f')];if(!_0x3cb973[_0x1f33('0x30')][_0x1f33('0x37')](_0x1f33('0x38'))){_0x138e61[_0x1f33('0x1d')]=qs[_0x1f33('0x1d')](_0x3cb973[_0x1f33('0x30')][_0x1f33('0x1d')]);_0x138e61['offset']=qs['offset'](_0x3cb973[_0x1f33('0x30')][_0x1f33('0x1c')]);}_0x138e61['order']=qs[_0x1f33('0x39')](_0x3cb973[_0x1f33('0x30')]['sort']);_0x138e61[_0x1f33('0x3a')]=qs[_0x1f33('0x32')](_[_0x1f33('0x3b')](_0x3cb973[_0x1f33('0x30')],_0x22b1bc[_0x1f33('0x32')]),_0x14f957);if(_0x3cb973['query'][_0x1f33('0x3c')]){_0x138e61[_0x1f33('0x3a')]=_[_0x1f33('0x3d')](_0x138e61['where'],{'$or':_[_0x1f33('0x2a')](_0x14f957,function(_0x438f36){if(_0x438f36['type']!==_0x1f33('0x3e')){var _0x100a44={};_0x100a44[_0x438f36[_0x1f33('0x27')]]={'$like':'%'+_0x3cb973['query'][_0x1f33('0x3c')]+'%'};return _0x100a44;}})});}_0x138e61=_['merge']({},_0x138e61,_0x3cb973[_0x1f33('0x3f')]);var _0x4ea119={'where':_0x138e61['where']};return db[_0x1f33('0x2b')][_0x1f33('0x1e')](_0x4ea119)['then'](function(_0x46e3e4){_0x1ff069[_0x1f33('0x1e')]=_0x46e3e4;if(_0x3cb973[_0x1f33('0x30')]['includeAll']){_0x138e61['include']=[{'all':!![]}];}return db[_0x1f33('0x2b')]['findAll'](_0x138e61);})[_0x1f33('0x25')](function(_0x114bed){_0x1ff069['rows']=_0x114bed;return _0x1ff069;})[_0x1f33('0x25')](respondWithFilteredResult(_0x370a1c,_0x138e61))[_0x1f33('0x40')](handleError(_0x370a1c,null));};exports[_0x1f33('0x41')]=function(_0x7fc138,_0x168581){var _0x1ec023={'raw':![],'where':{'id':_0x7fc138[_0x1f33('0x42')]['id']}},_0x5a6685={};_0x5a6685[_0x1f33('0x2f')]=_[_0x1f33('0x31')](db[_0x1f33('0x2b')][_0x1f33('0x2c')]);_0x5a6685['query']=_[_0x1f33('0x31')](_0x7fc138['query']);_0x5a6685[_0x1f33('0x32')]=_[_0x1f33('0x33')](_0x5a6685['model'],_0x5a6685[_0x1f33('0x30')]);_0x1ec023[_0x1f33('0x35')]=_[_0x1f33('0x33')](_0x5a6685['model'],qs[_0x1f33('0x34')](_0x7fc138[_0x1f33('0x30')][_0x1f33('0x34')]));_0x1ec023['attributes']=_0x1ec023['attributes'][_0x1f33('0x36')]?_0x1ec023[_0x1f33('0x35')]:_0x5a6685[_0x1f33('0x2f')];if(_0x7fc138['query'][_0x1f33('0x43')]){_0x1ec023['include']=[{'all':!![]}];}_0x1ec023=_[_0x1f33('0x3d')]({},_0x1ec023,_0x7fc138[_0x1f33('0x3f')]);return db[_0x1f33('0x2b')][_0x1f33('0x44')](_0x1ec023)[_0x1f33('0x25')](handleEntityNotFound(_0x168581,null))[_0x1f33('0x25')](respondWithResult(_0x168581,null))[_0x1f33('0x40')](handleError(_0x168581,null));};exports['create']=function(_0x36c1c6,_0x5e7d29){return db['FreshdeskConfiguration'][_0x1f33('0x45')](_0x36c1c6[_0x1f33('0x46')],{})[_0x1f33('0x25')](respondWithResult(_0x5e7d29,0xc9))[_0x1f33('0x40')](handleError(_0x5e7d29,null));};exports[_0x1f33('0x24')]=function(_0x2c094d,_0x15cb44){if(_0x2c094d['body']['id']){delete _0x2c094d[_0x1f33('0x46')]['id'];}return db[_0x1f33('0x2b')][_0x1f33('0x44')]({'where':{'id':_0x2c094d[_0x1f33('0x42')]['id']}})['then'](handleEntityNotFound(_0x15cb44,null))[_0x1f33('0x25')](saveUpdates(_0x2c094d[_0x1f33('0x46')],null))[_0x1f33('0x25')](respondWithResult(_0x15cb44,null))['catch'](handleError(_0x15cb44,null));};exports[_0x1f33('0x47')]=function(_0x23bcc4,_0x100476){return db['FreshdeskConfiguration'][_0x1f33('0x44')]({'where':{'id':_0x23bcc4[_0x1f33('0x42')]['id']}})['then'](handleEntityNotFound(_0x100476,null))['then'](removeEntity(_0x100476,null))['catch'](handleError(_0x100476,null));};exports['getFields']=function(_0x4b3adf,_0x50924c,_0xad1a48){var _0x3682ff={};var _0x5c3c53={};var _0x1c9970;var _0x588550;return db[_0x1f33('0x2b')][_0x1f33('0x48')]({'where':{'id':_0x4b3adf[_0x1f33('0x42')]['id']}})[_0x1f33('0x25')](handleEntityNotFound(_0x50924c,null))[_0x1f33('0x25')](function(_0x5051b9){if(_0x5051b9){_0x1c9970=_0x5051b9;_0x5c3c53['model']=_[_0x1f33('0x31')](db[_0x1f33('0x49')]['rawAttributes']);_0x5c3c53[_0x1f33('0x30')]=_[_0x1f33('0x31')](_0x4b3adf[_0x1f33('0x30')]);_0x5c3c53['filters']=_[_0x1f33('0x33')](_0x5c3c53[_0x1f33('0x2f')],_0x5c3c53['query']);_0x3682ff['attributes']=_[_0x1f33('0x33')](_0x5c3c53[_0x1f33('0x2f')],qs[_0x1f33('0x34')](_0x4b3adf[_0x1f33('0x30')]['fields']));_0x3682ff[_0x1f33('0x35')]=_0x3682ff[_0x1f33('0x35')][_0x1f33('0x36')]?_0x3682ff[_0x1f33('0x35')]:_0x5c3c53['model'];_0x3682ff['order']=qs[_0x1f33('0x39')](_0x4b3adf[_0x1f33('0x30')][_0x1f33('0x39')]);_0x3682ff[_0x1f33('0x3a')]=qs[_0x1f33('0x32')](_[_0x1f33('0x3b')](_0x4b3adf[_0x1f33('0x30')],_0x5c3c53[_0x1f33('0x32')]));if(_0x4b3adf[_0x1f33('0x30')]['filter']){_0x3682ff['where']=_[_0x1f33('0x3d')](_0x3682ff[_0x1f33('0x3a')],{'$or':_['map'](_0x3682ff['attributes'],function(_0x491edf){var _0xa98d2b={};_0xa98d2b[_0x491edf]={'$like':'%'+_0x4b3adf[_0x1f33('0x30')][_0x1f33('0x3c')]+'%'};return _0xa98d2b;})});}_0x3682ff=_['merge']({},_0x3682ff,_0x4b3adf[_0x1f33('0x3f')]);return _0x1c9970[_0x1f33('0x4a')](_0x3682ff);}})['then'](function(_0x3f730b){if(_0x3f730b){_0x588550=_0x3f730b[_0x1f33('0x36')];if(!_0x4b3adf[_0x1f33('0x30')][_0x1f33('0x37')](_0x1f33('0x38'))){_0x3682ff[_0x1f33('0x1d')]=qs[_0x1f33('0x1d')](_0x4b3adf[_0x1f33('0x30')][_0x1f33('0x1d')]);_0x3682ff['offset']=qs[_0x1f33('0x1c')](_0x4b3adf[_0x1f33('0x30')][_0x1f33('0x1c')]);}return _0x1c9970[_0x1f33('0x4a')](_0x3682ff);}})[_0x1f33('0x25')](function(_0x3ce7ff){if(_0x3ce7ff){return _0x3ce7ff?{'count':_0x588550,'rows':_0x3ce7ff}:null;}})['then'](respondWithResult(_0x50924c,null))[_0x1f33('0x40')](handleError(_0x50924c,null));};exports[_0x1f33('0x4b')]=function(_0x4a2172,_0x180a0d,_0x1f4609){var _0x499c85={};var _0x3733c0={};var _0x1d5068;var _0x75f528;return db['FreshdeskConfiguration'][_0x1f33('0x48')]({'where':{'id':_0x4a2172[_0x1f33('0x42')]['id']}})[_0x1f33('0x25')](handleEntityNotFound(_0x180a0d,null))[_0x1f33('0x25')](function(_0x369b0c){if(_0x369b0c){_0x1d5068=_0x369b0c;_0x3733c0[_0x1f33('0x2f')]=_[_0x1f33('0x31')](db[_0x1f33('0x49')][_0x1f33('0x2c')]);_0x3733c0['query']=_[_0x1f33('0x31')](_0x4a2172[_0x1f33('0x30')]);_0x3733c0[_0x1f33('0x32')]=_[_0x1f33('0x33')](_0x3733c0[_0x1f33('0x2f')],_0x3733c0[_0x1f33('0x30')]);_0x499c85[_0x1f33('0x35')]=_[_0x1f33('0x33')](_0x3733c0[_0x1f33('0x2f')],qs[_0x1f33('0x34')](_0x4a2172[_0x1f33('0x30')][_0x1f33('0x34')]));_0x499c85[_0x1f33('0x35')]=_0x499c85[_0x1f33('0x35')]['length']?_0x499c85[_0x1f33('0x35')]:_0x3733c0[_0x1f33('0x2f')];_0x499c85[_0x1f33('0x4c')]=qs[_0x1f33('0x39')](_0x4a2172[_0x1f33('0x30')][_0x1f33('0x39')]);_0x499c85[_0x1f33('0x3a')]=qs[_0x1f33('0x32')](_[_0x1f33('0x3b')](_0x4a2172[_0x1f33('0x30')],_0x3733c0[_0x1f33('0x32')]));if(_0x4a2172[_0x1f33('0x30')][_0x1f33('0x3c')]){_0x499c85['where']=_[_0x1f33('0x3d')](_0x499c85[_0x1f33('0x3a')],{'$or':_[_0x1f33('0x2a')](_0x499c85['attributes'],function(_0x2028d1){var _0x2b2719={};_0x2b2719[_0x2028d1]={'$like':'%'+_0x4a2172[_0x1f33('0x30')][_0x1f33('0x3c')]+'%'};return _0x2b2719;})});}_0x499c85=_[_0x1f33('0x3d')]({},_0x499c85,_0x4a2172[_0x1f33('0x3f')]);return _0x1d5068['getSubjects'](_0x499c85);}})[_0x1f33('0x25')](function(_0x9eb72f){if(_0x9eb72f){_0x75f528=_0x9eb72f['length'];if(!_0x4a2172['query']['hasOwnProperty'](_0x1f33('0x38'))){_0x499c85[_0x1f33('0x1d')]=qs[_0x1f33('0x1d')](_0x4a2172['query'][_0x1f33('0x1d')]);_0x499c85[_0x1f33('0x1c')]=qs[_0x1f33('0x1c')](_0x4a2172['query']['offset']);}return _0x1d5068['getSubjects'](_0x499c85);}})[_0x1f33('0x25')](function(_0x340b2a){if(_0x340b2a){return _0x340b2a?{'count':_0x75f528,'rows':_0x340b2a}:null;}})[_0x1f33('0x25')](respondWithResult(_0x180a0d,null))[_0x1f33('0x40')](handleError(_0x180a0d,null));};exports[_0x1f33('0x4d')]=function(_0x317fab,_0x100cb7,_0x38b7b9){var _0x4b35d5={};var _0x41bee8={};var _0x392d3c;var _0x366873;return db[_0x1f33('0x2b')][_0x1f33('0x48')]({'where':{'id':_0x317fab[_0x1f33('0x42')]['id']}})[_0x1f33('0x25')](handleEntityNotFound(_0x100cb7,null))[_0x1f33('0x25')](function(_0x2fd9ad){if(_0x2fd9ad){_0x392d3c=_0x2fd9ad;_0x41bee8[_0x1f33('0x2f')]=_['keys'](db['FreshdeskField'][_0x1f33('0x2c')]);_0x41bee8['query']=_[_0x1f33('0x31')](_0x317fab[_0x1f33('0x30')]);_0x41bee8[_0x1f33('0x32')]=_[_0x1f33('0x33')](_0x41bee8['model'],_0x41bee8[_0x1f33('0x30')]);_0x4b35d5[_0x1f33('0x35')]=_[_0x1f33('0x33')](_0x41bee8[_0x1f33('0x2f')],qs['fields'](_0x317fab[_0x1f33('0x30')][_0x1f33('0x34')]));_0x4b35d5[_0x1f33('0x35')]=_0x4b35d5['attributes'][_0x1f33('0x36')]?_0x4b35d5[_0x1f33('0x35')]:_0x41bee8['model'];_0x4b35d5[_0x1f33('0x4c')]=qs[_0x1f33('0x39')](_0x317fab['query'][_0x1f33('0x39')]);_0x4b35d5[_0x1f33('0x3a')]=qs['filters'](_[_0x1f33('0x3b')](_0x317fab[_0x1f33('0x30')],_0x41bee8[_0x1f33('0x32')]));if(_0x317fab['query'][_0x1f33('0x3c')]){_0x4b35d5[_0x1f33('0x3a')]=_[_0x1f33('0x3d')](_0x4b35d5[_0x1f33('0x3a')],{'$or':_['map'](_0x4b35d5[_0x1f33('0x35')],function(_0x2ec3d5){var _0x28aff8={};_0x28aff8[_0x2ec3d5]={'$like':'%'+_0x317fab['query'][_0x1f33('0x3c')]+'%'};return _0x28aff8;})});}_0x4b35d5=_[_0x1f33('0x3d')]({},_0x4b35d5,_0x317fab[_0x1f33('0x3f')]);return _0x392d3c['getDescriptions'](_0x4b35d5);}})['then'](function(_0x448a83){if(_0x448a83){_0x366873=_0x448a83[_0x1f33('0x36')];if(!_0x317fab[_0x1f33('0x30')][_0x1f33('0x37')](_0x1f33('0x38'))){_0x4b35d5[_0x1f33('0x1d')]=qs['limit'](_0x317fab[_0x1f33('0x30')]['limit']);_0x4b35d5['offset']=qs['offset'](_0x317fab[_0x1f33('0x30')][_0x1f33('0x1c')]);}return _0x392d3c['getDescriptions'](_0x4b35d5);}})[_0x1f33('0x25')](function(_0x537ebe){if(_0x537ebe){return _0x537ebe?{'count':_0x366873,'rows':_0x537ebe}:null;}})[_0x1f33('0x25')](respondWithResult(_0x100cb7,null))['catch'](handleError(_0x100cb7,null));};exports[_0x1f33('0x4e')]=function(_0x3c50c7,_0x4f439e,_0x1519c7){var _0xc2f4c0={};var _0x83fa10={};var _0x346859;var _0x1ce1d0;return db[_0x1f33('0x2b')][_0x1f33('0x48')]({'where':{'id':_0x3c50c7[_0x1f33('0x42')]['id']}})[_0x1f33('0x25')](handleEntityNotFound(_0x4f439e,null))[_0x1f33('0x25')](function(_0x264ab3){if(_0x264ab3){_0x346859=_0x264ab3;_0x83fa10[_0x1f33('0x2f')]=_[_0x1f33('0x31')](db['Tag']['rawAttributes']);_0x83fa10[_0x1f33('0x30')]=_['keys'](_0x3c50c7[_0x1f33('0x30')]);_0x83fa10[_0x1f33('0x32')]=_[_0x1f33('0x33')](_0x83fa10[_0x1f33('0x2f')],_0x83fa10['query']);_0xc2f4c0['attributes']=_[_0x1f33('0x33')](_0x83fa10['model'],qs[_0x1f33('0x34')](_0x3c50c7['query'][_0x1f33('0x34')]));_0xc2f4c0[_0x1f33('0x35')]=_0xc2f4c0[_0x1f33('0x35')]['length']?_0xc2f4c0[_0x1f33('0x35')]:_0x83fa10[_0x1f33('0x2f')];_0xc2f4c0[_0x1f33('0x4c')]=qs[_0x1f33('0x39')](_0x3c50c7['query'][_0x1f33('0x39')]);_0xc2f4c0[_0x1f33('0x3a')]=qs[_0x1f33('0x32')](_['pick'](_0x3c50c7[_0x1f33('0x30')],_0x83fa10['filters']));if(_0x3c50c7[_0x1f33('0x30')][_0x1f33('0x3c')]){_0xc2f4c0[_0x1f33('0x3a')]=_['merge'](_0xc2f4c0['where'],{'$or':_['map'](_0xc2f4c0['attributes'],function(_0x3861b8){var _0x3d1602={};_0x3d1602[_0x3861b8]={'$like':'%'+_0x3c50c7[_0x1f33('0x30')][_0x1f33('0x3c')]+'%'};return _0x3d1602;})});}_0xc2f4c0=_[_0x1f33('0x3d')]({},_0xc2f4c0,_0x3c50c7['options']);return _0x346859['getTags'](_0xc2f4c0);}})[_0x1f33('0x25')](function(_0x41aefa){if(_0x41aefa){_0x1ce1d0=_0x41aefa['length'];if(!_0x3c50c7[_0x1f33('0x30')][_0x1f33('0x37')](_0x1f33('0x38'))){_0xc2f4c0[_0x1f33('0x1d')]=qs[_0x1f33('0x1d')](_0x3c50c7[_0x1f33('0x30')][_0x1f33('0x1d')]);_0xc2f4c0[_0x1f33('0x1c')]=qs[_0x1f33('0x1c')](_0x3c50c7[_0x1f33('0x30')][_0x1f33('0x1c')]);}return _0x346859[_0x1f33('0x4e')](_0xc2f4c0);}})[_0x1f33('0x25')](function(_0xcadc83){if(_0xcadc83){return _0xcadc83?{'count':_0x1ce1d0,'rows':_0xcadc83}:null;}})[_0x1f33('0x25')](respondWithResult(_0x4f439e,null))[_0x1f33('0x40')](handleError(_0x4f439e,null));};exports[_0x1f33('0x4f')]=function(_0xbbec1c,_0x4907e5,_0xa6a03d){if(_0xbbec1c[_0x1f33('0x46')]['id']){delete _0xbbec1c[_0x1f33('0x46')]['id'];}return db[_0x1f33('0x2b')][_0x1f33('0x48')]({'where':{'id':_0xbbec1c[_0x1f33('0x42')]['id']}})[_0x1f33('0x25')](handleEntityNotFound(_0x4907e5,null))['then'](function(_0x40e008){if(_0x40e008){return _0x40e008[_0x1f33('0x4f')](_0xbbec1c[_0x1f33('0x46')][_0x1f33('0x50')]||[]);}return null;})[_0x1f33('0x25')](respondWithResult(_0x4907e5,null))['catch'](handleError(_0x4907e5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a27ed47..a44a1f8 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 _0xc06e=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x53797c,_0x4538b3){var _0x12c092=function(_0x3bf18b){while(--_0x3bf18b){_0x53797c['push'](_0x53797c['shift']());}};_0x12c092(++_0x4538b3);}(_0xc06e,0xa4));var _0xec06=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0xc06e[_0x4191af];return _0x27bebf;};'use strict';var _=require('lodash');var util=require(_0xec06('0x0'));var logger=require(_0xec06('0x1'))(_0xec06('0x2'));var moment=require(_0xec06('0x3'));var BPromise=require('bluebird');var rp=require(_0xec06('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec06('0x5'));var config=require(_0xec06('0x6'));var attributes=require(_0xec06('0x7'));module['exports']=function(_0x135a42,_0x32e421){return _0x135a42[_0xec06('0x8')](_0xec06('0x9'),attributes,{'tableName':_0xec06('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25c9=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x529a26,_0x4a48c6){var _0x372bdf=function(_0x38d5f8){while(--_0x38d5f8){_0x529a26['push'](_0x529a26['shift']());}};_0x372bdf(++_0x4a48c6);}(_0x25c9,0x1bb));var _0x925c=function(_0x25050c,_0xab0ea9){_0x25050c=_0x25050c-0x0;var _0xd6fdf=_0x25c9[_0x25050c];return _0xd6fdf;};'use strict';var _=require(_0x925c('0x0'));var util=require(_0x925c('0x1'));var logger=require(_0x925c('0x2'))(_0x925c('0x3'));var moment=require(_0x925c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x925c('0x5'));var rimraf=require(_0x925c('0x6'));var config=require(_0x925c('0x7'));var attributes=require(_0x925c('0x8'));module[_0x925c('0x9')]=function(_0xd5d8f0,_0x3d55af){return _0xd5d8f0[_0x925c('0xa')](_0x925c('0xb'),attributes,{'tableName':_0x925c('0xc'),'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 9d75ca7..8a11f4e 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 _0xa20d=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x5beac1,_0x25522c){var _0x712848=function(_0x572825){while(--_0x572825){_0x5beac1['push'](_0x5beac1['shift']());}};_0x712848(++_0x25522c);}(_0xa20d,0x69));var _0xda20=function(_0x571848,_0x46d718){_0x571848=_0x571848-0x0;var _0x2ecd36=_0xa20d[_0x571848];return _0x2ecd36;};'use strict';var _=require(_0xda20('0x0'));var util=require(_0xda20('0x1'));var moment=require(_0xda20('0x2'));var BPromise=require('bluebird');var rs=require(_0xda20('0x3'));var fs=require('fs');var Redis=require(_0xda20('0x4'));var db=require(_0xda20('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda20('0x6'));var config=require(_0xda20('0x7'));var jayson=require(_0xda20('0x8'));var client=jayson[_0xda20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4966f5,_0x48da14,_0x1fd38e){return new BPromise(function(_0x5d09c2,_0x297842){return client[_0xda20('0xa')](_0x4966f5,_0x1fd38e)[_0xda20('0xb')](function(_0x1f2743){logger[_0xda20('0xc')](_0xda20('0xd'),_0x48da14,_0xda20('0xe'));logger[_0xda20('0xf')](_0xda20('0x10'),_0x48da14,'request\x20sent',JSON[_0xda20('0x11')](_0x1f2743));if(_0x1f2743[_0xda20('0x12')]){if(_0x1f2743['error'][_0xda20('0x13')]===0x1f4){logger[_0xda20('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x48da14,_0x1f2743['error']['message']);return _0x297842(_0x1f2743[_0xda20('0x12')]['message']);}logger[_0xda20('0x12')](_0xda20('0xd'),_0x48da14,_0x1f2743[_0xda20('0x12')][_0xda20('0x14')]);return _0x5d09c2(_0x1f2743[_0xda20('0x12')]['message']);}else{logger[_0xda20('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x48da14,_0xda20('0xe'));_0x5d09c2(_0x1f2743['result'][_0xda20('0x14')]);}})[_0xda20('0x15')](function(_0x5c1c56){logger[_0xda20('0x12')](_0xda20('0xd'),_0x48da14,_0x5c1c56);_0x297842(_0x5c1c56);});});} \ No newline at end of file +var _0x7532=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4bf018,_0x332650){var _0x4e4504=function(_0x132753){while(--_0x132753){_0x4bf018['push'](_0x4bf018['shift']());}};_0x4e4504(++_0x332650);}(_0x7532,0x12e));var _0x2753=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0x7532[_0x584308];return _0x45865b;};'use strict';var _=require(_0x2753('0x0'));var util=require(_0x2753('0x1'));var moment=require(_0x2753('0x2'));var BPromise=require(_0x2753('0x3'));var rs=require(_0x2753('0x4'));var fs=require('fs');var Redis=require(_0x2753('0x5'));var db=require(_0x2753('0x6'))['db'];var utils=require(_0x2753('0x7'));var logger=require(_0x2753('0x8'))(_0x2753('0x9'));var config=require(_0x2753('0xa'));var jayson=require(_0x2753('0xb'));var client=jayson[_0x2753('0xc')][_0x2753('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ea0ff,_0x490abe,_0x1be821){return new BPromise(function(_0x2e08c7,_0x437677){return client['request'](_0x3ea0ff,_0x1be821)['then'](function(_0x3cf3b1){logger[_0x2753('0xe')](_0x2753('0xf'),_0x490abe,_0x2753('0x10'));logger[_0x2753('0x11')](_0x2753('0x12'),_0x490abe,_0x2753('0x10'),JSON[_0x2753('0x13')](_0x3cf3b1));if(_0x3cf3b1[_0x2753('0x14')]){if(_0x3cf3b1[_0x2753('0x14')]['code']===0x1f4){logger[_0x2753('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x490abe,_0x3cf3b1['error'][_0x2753('0x15')]);return _0x437677(_0x3cf3b1[_0x2753('0x14')][_0x2753('0x15')]);}logger[_0x2753('0x14')](_0x2753('0xf'),_0x490abe,_0x3cf3b1['error'][_0x2753('0x15')]);return _0x2e08c7(_0x3cf3b1[_0x2753('0x14')][_0x2753('0x15')]);}else{logger[_0x2753('0xe')](_0x2753('0xf'),_0x490abe,'request\x20sent');_0x2e08c7(_0x3cf3b1[_0x2753('0x16')][_0x2753('0x15')]);}})['catch'](function(_0xf1a053){logger[_0x2753('0x14')](_0x2753('0xf'),_0x490abe,_0xf1a053);_0x437677(_0xf1a053);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f94bb7c..27496f8 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 _0xcfa1=['put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','index','/:id','isAuthenticated','show','create'];(function(_0x5aa1e2,_0x2b5adb){var _0x399098=function(_0xb129fb){while(--_0xb129fb){_0x5aa1e2['push'](_0x5aa1e2['shift']());}};_0x399098(++_0x2b5adb);}(_0xcfa1,0x19b));var _0x1cfa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcfa1[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1cfa('0x0'));var util=require(_0x1cfa('0x1'));var path=require(_0x1cfa('0x2'));var timeout=require(_0x1cfa('0x3'));var express=require(_0x1cfa('0x4'));var router=express['Router']();var fs_extra=require(_0x1cfa('0x5'));var auth=require(_0x1cfa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1cfa('0x7'));var controller=require(_0x1cfa('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1cfa('0x9')]);router['get'](_0x1cfa('0xa'),auth[_0x1cfa('0xb')](),controller[_0x1cfa('0xc')]);router['post']('/',auth[_0x1cfa('0xb')](),controller[_0x1cfa('0xd')]);router[_0x1cfa('0xe')](_0x1cfa('0xa'),auth[_0x1cfa('0xb')](),controller['update']);router[_0x1cfa('0xf')](_0x1cfa('0xa'),auth[_0x1cfa('0xb')](),controller['destroy']);module[_0x1cfa('0x10')]=router; \ No newline at end of file +var _0x4733=['get','isAuthenticated','index','show','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x26d2ea,_0x59d2d1){var _0x4084da=function(_0x463ee9){while(--_0x463ee9){_0x26d2ea['push'](_0x26d2ea['shift']());}};_0x4084da(++_0x59d2d1);}(_0x4733,0x1cc));var _0x3473=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x4733[_0x487ab4];return _0x3bef77;};'use strict';var multer=require('multer');var util=require(_0x3473('0x0'));var path=require(_0x3473('0x1'));var timeout=require(_0x3473('0x2'));var express=require(_0x3473('0x3'));var router=express[_0x3473('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3473('0x5'));var config=require(_0x3473('0x6'));var controller=require(_0x3473('0x7'));router[_0x3473('0x8')]('/',auth[_0x3473('0x9')](),controller[_0x3473('0xa')]);router[_0x3473('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3473('0xb')]);router['post']('/',auth[_0x3473('0x9')](),controller[_0x3473('0xc')]);router[_0x3473('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3473('0xe')]);router[_0x3473('0xf')](_0x3473('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3473('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 96a88e7..df05728 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 _0x2624=['keyValue','STRING','ENUM','sequelize','exports','string','variable'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2624,0x153));var _0x4262=function(_0xdfc924,_0x423b92){_0xdfc924=_0xdfc924-0x0;var _0x25ed89=_0x2624[_0xdfc924];return _0x25ed89;};'use strict';var Sequelize=require(_0x4262('0x0'));module[_0x4262('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4262('0x2'),_0x4262('0x3'),'customVariable',_0x4262('0x4'),'picklist'),'defaultValue':_0x4262('0x2')},'content':{'type':Sequelize[_0x4262('0x5')]},'key':{'type':Sequelize[_0x4262('0x5')]},'keyType':{'type':Sequelize[_0x4262('0x6')](_0x4262('0x2'),_0x4262('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4262('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe7e1=['customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x52dd6c,_0x323c5e){var _0x22979a=function(_0x449af2){while(--_0x449af2){_0x52dd6c['push'](_0x52dd6c['shift']());}};_0x22979a(++_0x323c5e);}(_0xe7e1,0x11c));var _0x1e7e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe7e1[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x1e7e('0x0'));module['exports']={'type':{'type':Sequelize[_0x1e7e('0x1')](_0x1e7e('0x2'),_0x1e7e('0x3'),_0x1e7e('0x4'),'keyValue',_0x1e7e('0x5')),'defaultValue':_0x1e7e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1e7e('0x6')]},'keyType':{'type':Sequelize[_0x1e7e('0x1')](_0x1e7e('0x2'),_0x1e7e('0x3'),_0x1e7e('0x4'))},'keyContent':{'type':Sequelize[_0x1e7e('0x6')]},'idField':{'type':Sequelize[_0x1e7e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1e7e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e7e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c51f7f3..4746b3f 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 _0x80df=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x57915d,_0x396b08){var _0x38b1eb=function(_0x3c8261){while(--_0x3c8261){_0x57915d['push'](_0x57915d['shift']());}};_0x38b1eb(++_0x396b08);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x29')]();});}};}function handleEntityNotFound(_0x323540,_0x947bb){return function(_0x4986ad){if(!_0x4986ad){_0x323540[_0xf80d('0x2a')](0x194);}return _0x4986ad;};}function handleError(_0x14399e,_0xf4c3af){_0xf4c3af=_0xf4c3af||0x1f4;return function(_0x2a4597){logger[_0xf80d('0x2b')](_0x2a4597[_0xf80d('0x2c')]);if(_0x2a4597[_0xf80d('0x2d')]){delete _0x2a4597[_0xf80d('0x2d')];}_0x14399e[_0xf80d('0x1c')](_0xf4c3af)['send'](_0x2a4597);};}exports[_0xf80d('0x2e')]=function(_0x1603a4,_0x3e2c8c){var _0x368865={},_0x3ce924={},_0x5eab42={'count':0x0,'rows':[]};var _0x401cfb=_['map'](db[_0xf80d('0x2f')][_0xf80d('0x30')],function(_0x214bff){return{'name':_0x214bff[_0xf80d('0x31')],'type':_0x214bff['type']['key']};});_0x3ce924[_0xf80d('0x32')]=_['map'](_0x401cfb,_0xf80d('0x2d'));_0x3ce924[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x1603a4['query']);_0x3ce924[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x3ce924['model'],_0x3ce924[_0xf80d('0x33')]);_0x368865[_0xf80d('0x37')]=_[_0xf80d('0x36')](_0x3ce924['model'],qs[_0xf80d('0x38')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x38')]));_0x368865[_0xf80d('0x37')]=_0x368865[_0xf80d('0x37')]['length']?_0x368865[_0xf80d('0x37')]:_0x3ce924['model'];if(!_0x1603a4[_0xf80d('0x33')][_0xf80d('0x39')](_0xf80d('0x3a'))){_0x368865[_0xf80d('0x20')]=qs['limit'](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x20')]);_0x368865[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x1603a4['query'][_0xf80d('0x1e')]);}_0x368865[_0xf80d('0x3b')]=qs[_0xf80d('0x3c')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3c')]);_0x368865[_0xf80d('0x3d')]=qs[_0xf80d('0x35')](_[_0xf80d('0x3e')](_0x1603a4['query'],_0x3ce924[_0xf80d('0x35')]),_0x401cfb);if(_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3f')]){_0x368865['where']=_[_0xf80d('0x40')](_0x368865['where'],{'$or':_[_0xf80d('0x41')](_0x401cfb,function(_0x1a4ab7){if(_0x1a4ab7[_0xf80d('0x42')]!==_0xf80d('0x43')){var _0x4a3c5e={};_0x4a3c5e[_0x1a4ab7['name']]={'$like':'%'+_0x1603a4['query'][_0xf80d('0x3f')]+'%'};return _0x4a3c5e;}})});}_0x368865=_[_0xf80d('0x40')]({},_0x368865,_0x1603a4[_0xf80d('0x44')]);var _0x4b9f1d={'where':_0x368865[_0xf80d('0x3d')]};return db[_0xf80d('0x2f')]['count'](_0x4b9f1d)[_0xf80d('0x27')](function(_0x511310){_0x5eab42[_0xf80d('0x21')]=_0x511310;if(_0x1603a4['query'][_0xf80d('0x45')]){_0x368865['include']=[{'all':!![]}];}return db[_0xf80d('0x2f')][_0xf80d('0x46')](_0x368865);})[_0xf80d('0x27')](function(_0x2cd371){_0x5eab42[_0xf80d('0x47')]=_0x2cd371;return _0x5eab42;})[_0xf80d('0x27')](respondWithFilteredResult(_0x3e2c8c,_0x368865))[_0xf80d('0x48')](handleError(_0x3e2c8c,null));};exports[_0xf80d('0x49')]=function(_0x99e531,_0x80f24a){var _0x1fcbad={'raw':!![],'where':{'id':_0x99e531[_0xf80d('0x4a')]['id']}},_0x437e44={};_0x437e44[_0xf80d('0x32')]=_[_0xf80d('0x34')](db[_0xf80d('0x2f')][_0xf80d('0x30')]);_0x437e44[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x99e531[_0xf80d('0x33')]);_0x437e44[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x437e44[_0xf80d('0x32')],_0x437e44[_0xf80d('0x33')]);_0x1fcbad[_0xf80d('0x37')]=_['intersection'](_0x437e44[_0xf80d('0x32')],qs[_0xf80d('0x38')](_0x99e531[_0xf80d('0x33')][_0xf80d('0x38')]));_0x1fcbad[_0xf80d('0x37')]=_0x1fcbad['attributes'][_0xf80d('0x4b')]?_0x1fcbad[_0xf80d('0x37')]:_0x437e44[_0xf80d('0x32')];if(_0x99e531[_0xf80d('0x33')][_0xf80d('0x45')]){_0x1fcbad[_0xf80d('0x4c')]=[{'all':!![]}];}_0x1fcbad=_[_0xf80d('0x40')]({},_0x1fcbad,_0x99e531[_0xf80d('0x44')]);return db[_0xf80d('0x2f')][_0xf80d('0x4d')](_0x1fcbad)[_0xf80d('0x27')](handleEntityNotFound(_0x80f24a,null))[_0xf80d('0x27')](respondWithResult(_0x80f24a,null))[_0xf80d('0x48')](handleError(_0x80f24a,null));};exports[_0xf80d('0x4e')]=function(_0x3a420d,_0x10d5b5){return db[_0xf80d('0x2f')]['create'](_0x3a420d[_0xf80d('0x4f')],{})[_0xf80d('0x27')](respondWithResult(_0x10d5b5,0xc9))[_0xf80d('0x48')](handleError(_0x10d5b5,null));};exports['update']=function(_0x3e5cf6,_0x1088ca){if(_0x3e5cf6['body']['id']){delete _0x3e5cf6['body']['id'];}return db[_0xf80d('0x2f')]['find']({'where':{'id':_0x3e5cf6[_0xf80d('0x4a')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1088ca,null))[_0xf80d('0x27')](saveUpdates(_0x3e5cf6[_0xf80d('0x4f')],null))[_0xf80d('0x27')](respondWithResult(_0x1088ca,null))[_0xf80d('0x48')](handleError(_0x1088ca,null));};exports[_0xf80d('0x28')]=function(_0x114132,_0x115d1f){return db[_0xf80d('0x2f')][_0xf80d('0x4d')]({'where':{'id':_0x114132[_0xf80d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x115d1f,null))[_0xf80d('0x27')](removeEntity(_0x115d1f,null))[_0xf80d('0x48')](handleError(_0x115d1f,null));}; \ No newline at end of file +var _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x44b434,_0x87eeb5){_0x44b434=_0x44b434-0x0;var _0x414d34=_0x9c5e[_0x44b434];return _0x414d34;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2410c26..ce0e64e 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 _0xd9b4=['idField','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','freshdesk_unique_index'];(function(_0x1f47b2,_0x32ea9c){var _0xf37729=function(_0x15ed33){while(--_0x15ed33){_0x1f47b2['push'](_0x1f47b2['shift']());}};_0xf37729(++_0x32ea9c);}(_0xd9b4,0x1f0));var _0x4d9b=function(_0x3d03ba,_0x40eab9){_0x3d03ba=_0x3d03ba-0x0;var _0x26f8f0=_0xd9b4[_0x3d03ba];return _0x26f8f0;};'use strict';var _=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d9b('0x2'));var rp=require(_0x4d9b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d9b('0x4'));var config=require(_0x4d9b('0x5'));var attributes=require(_0x4d9b('0x6'));module['exports']=function(_0x595284,_0x14f7e0){return _0x595284[_0x4d9b('0x7')](_0x4d9b('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x4d9b('0x9'),'fields':[_0x4d9b('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c42=['rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x5bb095,_0x3ec75e){var _0x1779fb=function(_0x59ccf5){while(--_0x59ccf5){_0x5bb095['push'](_0x5bb095['shift']());}};_0x1779fb(++_0x3ec75e);}(_0x5c42,0x182));var _0x25c4=function(_0x583794,_0xb03ff1){_0x583794=_0x583794-0x0;var _0x484672=_0x5c42[_0x583794];return _0x484672;};'use strict';var _=require(_0x25c4('0x0'));var util=require('util');var logger=require(_0x25c4('0x1'))(_0x25c4('0x2'));var moment=require(_0x25c4('0x3'));var BPromise=require(_0x25c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25c4('0x5'));var rimraf=require(_0x25c4('0x6'));var config=require(_0x25c4('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x25c4('0x8')]=function(_0x1b6c22,_0x82d8e6){return _0x1b6c22[_0x25c4('0x9')](_0x25c4('0xa'),attributes,{'tableName':_0x25c4('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x25c4('0xc'),_0x25c4('0xd')],'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 e8db55b..d07c25c 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 _0x4872=['error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2799d3,_0x1d0f54){var _0x5c5701=function(_0x373ac2){while(--_0x373ac2){_0x2799d3['push'](_0x2799d3['shift']());}};_0x5c5701(++_0x1d0f54);}(_0x4872,0x70));var _0x2487=function(_0x50c1b3,_0x3ed97f){_0x50c1b3=_0x50c1b3-0x0;var _0x1f5160=_0x4872[_0x50c1b3];return _0x1f5160;};'use strict';var _=require(_0x2487('0x0'));var util=require(_0x2487('0x1'));var moment=require(_0x2487('0x2'));var BPromise=require(_0x2487('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2487('0x4'));var db=require(_0x2487('0x5'))['db'];var utils=require(_0x2487('0x6'));var logger=require(_0x2487('0x7'))(_0x2487('0x8'));var config=require(_0x2487('0x9'));var jayson=require(_0x2487('0xa'));var client=jayson[_0x2487('0xb')][_0x2487('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10cb62,_0x564156,_0xea7523){return new BPromise(function(_0x134fa5,_0x154443){return client[_0x2487('0xd')](_0x10cb62,_0xea7523)[_0x2487('0xe')](function(_0x5bdb44){logger['info'](_0x2487('0xf'),_0x564156,_0x2487('0x10'));logger[_0x2487('0x11')](_0x2487('0x12'),_0x564156,_0x2487('0x10'),JSON[_0x2487('0x13')](_0x5bdb44));if(_0x5bdb44['error']){if(_0x5bdb44[_0x2487('0x14')]['code']===0x1f4){logger[_0x2487('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x564156,_0x5bdb44[_0x2487('0x14')]['message']);return _0x154443(_0x5bdb44[_0x2487('0x14')]['message']);}logger['error'](_0x2487('0xf'),_0x564156,_0x5bdb44[_0x2487('0x14')][_0x2487('0x15')]);return _0x134fa5(_0x5bdb44[_0x2487('0x14')][_0x2487('0x15')]);}else{logger['info'](_0x2487('0xf'),_0x564156,'request\x20sent');_0x134fa5(_0x5bdb44['result'][_0x2487('0x15')]);}})['catch'](function(_0x5a3c86){logger[_0x2487('0x14')](_0x2487('0xf'),_0x564156,_0x5a3c86);_0x154443(_0x5a3c86);});});} \ No newline at end of file +var _0x9545=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9545,0x141));var _0x5954=function(_0x526046,_0x154040){_0x526046=_0x526046-0x0;var _0x5b92a2=_0x9545[_0x526046];return _0x5b92a2;};'use strict';var _=require('lodash');var util=require(_0x5954('0x0'));var moment=require(_0x5954('0x1'));var BPromise=require(_0x5954('0x2'));var rs=require(_0x5954('0x3'));var fs=require('fs');var Redis=require(_0x5954('0x4'));var db=require(_0x5954('0x5'))['db'];var utils=require(_0x5954('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5954('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5954('0x8')][_0x5954('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dfe95,_0x1488c3,_0x569ae5){return new BPromise(function(_0xb3c10e,_0x418368){return client[_0x5954('0xa')](_0x2dfe95,_0x569ae5)[_0x5954('0xb')](function(_0x36a3d8){logger[_0x5954('0xc')](_0x5954('0xd'),_0x1488c3,_0x5954('0xe'));logger[_0x5954('0xf')](_0x5954('0x10'),_0x1488c3,_0x5954('0xe'),JSON[_0x5954('0x11')](_0x36a3d8));if(_0x36a3d8[_0x5954('0x12')]){if(_0x36a3d8[_0x5954('0x12')][_0x5954('0x13')]===0x1f4){logger[_0x5954('0x12')](_0x5954('0xd'),_0x1488c3,_0x36a3d8['error'][_0x5954('0x14')]);return _0x418368(_0x36a3d8['error'][_0x5954('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1488c3,_0x36a3d8[_0x5954('0x12')][_0x5954('0x14')]);return _0xb3c10e(_0x36a3d8[_0x5954('0x12')][_0x5954('0x14')]);}else{logger[_0x5954('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x1488c3,_0x5954('0xe'));_0xb3c10e(_0x36a3d8['result']['message']);}})[_0x5954('0x15')](function(_0x26f78f){logger[_0x5954('0x12')](_0x5954('0xd'),_0x1488c3,_0x26f78f);_0x418368(_0x26f78f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 25d8cca..afaae17 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 _0x0abf=['destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete'];(function(_0x167f10,_0x20209b){var _0x2ef2f9=function(_0x5532a3){while(--_0x5532a3){_0x167f10['push'](_0x167f10['shift']());}};_0x2ef2f9(++_0x20209b);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xf0ab('0xe')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0xf')]);router[_0xf0ab('0xe')](_0xf0ab('0xb'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')](_0xf0ab('0x12'),auth['isAuthenticated'](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x12'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x15')]);module[_0xf0ab('0x16')]=router; \ No newline at end of file +var _0xac4a=['show','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','get'];(function(_0x397127,_0x31429d){var _0x1d5516=function(_0x5c557f){while(--_0x5c557f){_0x397127['push'](_0x397127['shift']());}};_0x1d5516(++_0x31429d);}(_0xac4a,0x13f));var _0xaac4=function(_0x5514e8,_0x587b66){_0x5514e8=_0x5514e8-0x0;var _0x798aac=_0xac4a[_0x5514e8];return _0x798aac;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/configurations',auth[_0xaac4('0x9')](),controller['getConfigurations']);router[_0xaac4('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xd')]('/',auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router[_0xaac4('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0x14')]);module[_0xaac4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b59d6d6..4b22c36 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 _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0x32f4,0x154));var _0x432f=function(_0x5e19b5,_0x1df79e){_0x5e19b5=_0x5e19b5-0x0;var _0xd7b959=_0x32f4[_0x5e19b5];return _0xd7b959;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb44a=['STRING'];(function(_0x1ce4d1,_0xea0bcb){var _0x1b270e=function(_0x584e49){while(--_0x584e49){_0x1ce4d1['push'](_0x1ce4d1['shift']());}};_0x1b270e(++_0xea0bcb);}(_0xb44a,0x1c2));var _0xab44=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xb44a[_0x5c2e5e];return _0x46a5da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xab44('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xab44('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xab44('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xab44('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 db85b0c..ba62c7d 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 _0xb836=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','name','send','index','FreshsalesAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x3ff5e5,_0x9380c3){var _0xf8437a=function(_0x34b66a){while(--_0x34b66a){_0x3ff5e5['push'](_0x3ff5e5['shift']());}};_0xf8437a(++_0x9380c3);}(_0xb836,0x175));var _0x6b83=function(_0x3985a0,_0x1b0657){_0x3985a0=_0x3985a0-0x0;var _0x49f7a5=_0xb836[_0x3985a0];return _0x49f7a5;};'use strict';var emlformat=require(_0x6b83('0x0'));var rimraf=require(_0x6b83('0x1'));var zipdir=require(_0x6b83('0x2'));var jsonpatch=require(_0x6b83('0x3'));var rp=require(_0x6b83('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b83('0x5'));var util=require(_0x6b83('0x6'));var path=require('path');var sox=require(_0x6b83('0x7'));var csv=require(_0x6b83('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b83('0x9'));var _=require(_0x6b83('0xa'));var squel=require('squel');var crypto=require(_0x6b83('0xb'));var jsforce=require(_0x6b83('0xc'));var deskjs=require(_0x6b83('0xd'));var toCsv=require(_0x6b83('0x8'));var querystring=require('querystring');var Papa=require(_0x6b83('0xe'));var Redis=require('ioredis');var authService=require(_0x6b83('0xf'));var qs=require(_0x6b83('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b83('0x11'));var logger=require(_0x6b83('0x12'))('api');var utils=require(_0x6b83('0x13'));var config=require(_0x6b83('0x14'));var licenseUtil=require(_0x6b83('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6b83('0x16'));function respondWithStatusCode(_0x37f4e4,_0xc40b19){_0xc40b19=_0xc40b19||0xcc;return function(_0x489f07){if(_0x489f07){return _0x37f4e4[_0x6b83('0x17')](_0xc40b19);}return _0x37f4e4[_0x6b83('0x18')](_0xc40b19)[_0x6b83('0x19')]();};}function respondWithResult(_0x11890a,_0x39973f){_0x39973f=_0x39973f||0xc8;return function(_0x299cfd){if(_0x299cfd){return _0x11890a[_0x6b83('0x18')](_0x39973f)[_0x6b83('0x1a')](_0x299cfd);}};}function respondWithFilteredResult(_0x38dfe2,_0x28f579){return function(_0x4ca1b9){if(_0x4ca1b9){var _0x40fa3a=typeof _0x28f579['offset']==='undefined'&&typeof _0x28f579[_0x6b83('0x1b')]===_0x6b83('0x1c');var _0x129764=_0x4ca1b9[_0x6b83('0x1d')];var _0xd969e=_0x40fa3a?0x0:_0x28f579[_0x6b83('0x1e')];var _0x4be614=_0x40fa3a?_0x4ca1b9['count']:_0x28f579['offset']+_0x28f579[_0x6b83('0x1b')];var _0x426c21;if(_0x4be614>=_0x129764){_0x4be614=_0x129764;_0x426c21=0xc8;}else{_0x426c21=0xce;}_0x38dfe2[_0x6b83('0x18')](_0x426c21);return _0x38dfe2[_0x6b83('0x1f')](_0x6b83('0x20'),_0xd969e+'-'+_0x4be614+'/'+_0x129764)[_0x6b83('0x1a')](_0x4ca1b9);}return null;};}function patchUpdates(_0xb4585d){return function(_0x2fb2fa){try{jsonpatch['apply'](_0x2fb2fa,_0xb4585d,!![]);}catch(_0x32cce2){return BPromise['reject'](_0x32cce2);}return _0x2fb2fa[_0x6b83('0x21')]();};}function saveUpdates(_0x5aa20b,_0x46aeb6){return function(_0x2b68cf){if(_0x2b68cf){return _0x2b68cf[_0x6b83('0x22')](_0x5aa20b)[_0x6b83('0x23')](function(_0x3ac214){return _0x3ac214;});}return null;};}function removeEntity(_0x2a687e,_0x5d0172){return function(_0xf34333){if(_0xf34333){return _0xf34333['destroy']()['then'](function(){_0x2a687e[_0x6b83('0x18')](0xcc)[_0x6b83('0x19')]();});}};}function handleEntityNotFound(_0x5b821c,_0x7117eb){return function(_0x2861c1){if(!_0x2861c1){_0x5b821c['sendStatus'](0x194);}return _0x2861c1;};}function handleError(_0x39aef0,_0x4357c1){_0x4357c1=_0x4357c1||0x1f4;return function(_0x44dd26){logger['error'](_0x44dd26['stack']);if(_0x44dd26['name']){delete _0x44dd26[_0x6b83('0x24')];}_0x39aef0[_0x6b83('0x18')](_0x4357c1)[_0x6b83('0x25')](_0x44dd26);};}exports[_0x6b83('0x26')]=function(_0x3857f0,_0x43a6c2){var _0x57ea47={},_0x5b5007={},_0x451a5a={'count':0x0,'rows':[]};var _0x39dbcc=_['map'](db[_0x6b83('0x27')]['rawAttributes'],function(_0x150916){return{'name':_0x150916['fieldName'],'type':_0x150916[_0x6b83('0x28')][_0x6b83('0x29')]};});_0x5b5007[_0x6b83('0x2a')]=_['map'](_0x39dbcc,_0x6b83('0x24'));_0x5b5007[_0x6b83('0x2b')]=_[_0x6b83('0x2c')](_0x3857f0[_0x6b83('0x2b')]);_0x5b5007[_0x6b83('0x2d')]=_[_0x6b83('0x2e')](_0x5b5007[_0x6b83('0x2a')],_0x5b5007[_0x6b83('0x2b')]);_0x57ea47[_0x6b83('0x2f')]=_[_0x6b83('0x2e')](_0x5b5007[_0x6b83('0x2a')],qs[_0x6b83('0x30')](_0x3857f0[_0x6b83('0x2b')][_0x6b83('0x30')]));_0x57ea47[_0x6b83('0x2f')]=_0x57ea47['attributes'][_0x6b83('0x31')]?_0x57ea47[_0x6b83('0x2f')]:_0x5b5007[_0x6b83('0x2a')];if(!_0x3857f0[_0x6b83('0x2b')][_0x6b83('0x32')]('nolimit')){_0x57ea47[_0x6b83('0x1b')]=qs[_0x6b83('0x1b')](_0x3857f0[_0x6b83('0x2b')][_0x6b83('0x1b')]);_0x57ea47[_0x6b83('0x1e')]=qs[_0x6b83('0x1e')](_0x3857f0[_0x6b83('0x2b')][_0x6b83('0x1e')]);}_0x57ea47[_0x6b83('0x33')]=qs[_0x6b83('0x34')](_0x3857f0[_0x6b83('0x2b')]['sort']);_0x57ea47[_0x6b83('0x35')]=qs[_0x6b83('0x2d')](_[_0x6b83('0x36')](_0x3857f0[_0x6b83('0x2b')],_0x5b5007[_0x6b83('0x2d')]),_0x39dbcc);if(_0x3857f0[_0x6b83('0x2b')][_0x6b83('0x37')]){_0x57ea47[_0x6b83('0x35')]=_[_0x6b83('0x38')](_0x57ea47[_0x6b83('0x35')],{'$or':_[_0x6b83('0x39')](_0x39dbcc,function(_0x354f6f){if(_0x354f6f[_0x6b83('0x28')]!=='VIRTUAL'){var _0xebe188={};_0xebe188[_0x354f6f['name']]={'$like':'%'+_0x3857f0[_0x6b83('0x2b')][_0x6b83('0x37')]+'%'};return _0xebe188;}})});}_0x57ea47=_[_0x6b83('0x38')]({},_0x57ea47,_0x3857f0[_0x6b83('0x3a')]);var _0x313114={'where':_0x57ea47[_0x6b83('0x35')]};return db['FreshsalesAccount'][_0x6b83('0x1d')](_0x313114)[_0x6b83('0x23')](function(_0x4661f9){_0x451a5a[_0x6b83('0x1d')]=_0x4661f9;if(_0x3857f0['query'][_0x6b83('0x3b')]){_0x57ea47[_0x6b83('0x3c')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x57ea47);})[_0x6b83('0x23')](function(_0x347b3a){_0x451a5a['rows']=_0x347b3a;return _0x451a5a;})[_0x6b83('0x23')](respondWithFilteredResult(_0x43a6c2,_0x57ea47))[_0x6b83('0x3d')](handleError(_0x43a6c2,null));};exports[_0x6b83('0x3e')]=function(_0x7749f4,_0x387fdd){var _0x591d02={'raw':![],'where':{'id':_0x7749f4[_0x6b83('0x3f')]['id']}},_0x53d479={};_0x53d479['model']=_['keys'](db['FreshsalesAccount'][_0x6b83('0x40')]);_0x53d479['query']=_[_0x6b83('0x2c')](_0x7749f4['query']);_0x53d479[_0x6b83('0x2d')]=_[_0x6b83('0x2e')](_0x53d479['model'],_0x53d479[_0x6b83('0x2b')]);_0x591d02[_0x6b83('0x2f')]=_[_0x6b83('0x2e')](_0x53d479[_0x6b83('0x2a')],qs[_0x6b83('0x30')](_0x7749f4[_0x6b83('0x2b')]['fields']));_0x591d02[_0x6b83('0x2f')]=_0x591d02[_0x6b83('0x2f')][_0x6b83('0x31')]?_0x591d02[_0x6b83('0x2f')]:_0x53d479['model'];if(_0x7749f4[_0x6b83('0x2b')]['includeAll']){_0x591d02['include']=[{'all':!![]}];}_0x591d02=_['merge']({},_0x591d02,_0x7749f4[_0x6b83('0x3a')]);return db[_0x6b83('0x27')][_0x6b83('0x41')](_0x591d02)[_0x6b83('0x23')](handleEntityNotFound(_0x387fdd,null))[_0x6b83('0x23')](respondWithResult(_0x387fdd,null))[_0x6b83('0x3d')](handleError(_0x387fdd,null));};exports['create']=function(_0x3a1f68,_0xe42d7d){return db[_0x6b83('0x27')][_0x6b83('0x42')](_0x3a1f68['body'],{})[_0x6b83('0x23')](respondWithResult(_0xe42d7d,0xc9))[_0x6b83('0x3d')](handleError(_0xe42d7d,null));};exports[_0x6b83('0x22')]=function(_0x162d68,_0x48105f){if(_0x162d68[_0x6b83('0x43')]['id']){delete _0x162d68[_0x6b83('0x43')]['id'];}return db[_0x6b83('0x27')][_0x6b83('0x41')]({'where':{'id':_0x162d68[_0x6b83('0x3f')]['id']}})[_0x6b83('0x23')](handleEntityNotFound(_0x48105f,null))[_0x6b83('0x23')](saveUpdates(_0x162d68[_0x6b83('0x43')],null))[_0x6b83('0x23')](respondWithResult(_0x48105f,null))[_0x6b83('0x3d')](handleError(_0x48105f,null));};exports[_0x6b83('0x44')]=function(_0x18fd44,_0x26cea3){return db['FreshsalesAccount'][_0x6b83('0x41')]({'where':{'id':_0x18fd44[_0x6b83('0x3f')]['id']}})['then'](handleEntityNotFound(_0x26cea3,null))[_0x6b83('0x23')](removeEntity(_0x26cea3,null))[_0x6b83('0x3d')](handleError(_0x26cea3,null));};exports[_0x6b83('0x45')]=function(_0x2ed6fd,_0x1a7c10,_0x4438a7){var _0x13802c={};var _0x5cde88={};var _0x1c1e8c;var _0x16114a;return db[_0x6b83('0x27')][_0x6b83('0x46')]({'where':{'id':_0x2ed6fd[_0x6b83('0x3f')]['id']}})[_0x6b83('0x23')](handleEntityNotFound(_0x1a7c10,null))['then'](function(_0x5cb53d){if(_0x5cb53d){_0x1c1e8c=_0x5cb53d;_0x5cde88[_0x6b83('0x2a')]=_[_0x6b83('0x2c')](db['FreshsalesConfiguration'][_0x6b83('0x40')]);_0x5cde88[_0x6b83('0x2b')]=_[_0x6b83('0x2c')](_0x2ed6fd['query']);_0x5cde88[_0x6b83('0x2d')]=_[_0x6b83('0x2e')](_0x5cde88[_0x6b83('0x2a')],_0x5cde88['query']);_0x13802c[_0x6b83('0x2f')]=_[_0x6b83('0x2e')](_0x5cde88['model'],qs[_0x6b83('0x30')](_0x2ed6fd['query'][_0x6b83('0x30')]));_0x13802c[_0x6b83('0x2f')]=_0x13802c[_0x6b83('0x2f')][_0x6b83('0x31')]?_0x13802c[_0x6b83('0x2f')]:_0x5cde88['model'];_0x13802c[_0x6b83('0x33')]=qs[_0x6b83('0x34')](_0x2ed6fd[_0x6b83('0x2b')][_0x6b83('0x34')]);_0x13802c['where']=qs[_0x6b83('0x2d')](_[_0x6b83('0x36')](_0x2ed6fd[_0x6b83('0x2b')],_0x5cde88[_0x6b83('0x2d')]));if(_0x2ed6fd[_0x6b83('0x2b')]['filter']){_0x13802c[_0x6b83('0x35')]=_[_0x6b83('0x38')](_0x13802c[_0x6b83('0x35')],{'$or':_[_0x6b83('0x39')](_0x13802c[_0x6b83('0x2f')],function(_0xc71f83){var _0x3434ef={};_0x3434ef[_0xc71f83]={'$like':'%'+_0x2ed6fd['query'][_0x6b83('0x37')]+'%'};return _0x3434ef;})});}_0x13802c=_[_0x6b83('0x38')]({},_0x13802c,_0x2ed6fd['options']);return _0x1c1e8c[_0x6b83('0x45')](_0x13802c);}})[_0x6b83('0x23')](function(_0x1ac356){if(_0x1ac356){_0x16114a=_0x1ac356[_0x6b83('0x31')];if(!_0x2ed6fd[_0x6b83('0x2b')][_0x6b83('0x32')](_0x6b83('0x47'))){_0x13802c[_0x6b83('0x1b')]=qs[_0x6b83('0x1b')](_0x2ed6fd[_0x6b83('0x2b')]['limit']);_0x13802c[_0x6b83('0x1e')]=qs['offset'](_0x2ed6fd[_0x6b83('0x2b')]['offset']);}return _0x1c1e8c['getConfigurations'](_0x13802c);}})[_0x6b83('0x23')](function(_0x41622d){if(_0x41622d){return _0x41622d?{'count':_0x16114a,'rows':_0x41622d}:null;}})[_0x6b83('0x23')](respondWithResult(_0x1a7c10,null))[_0x6b83('0x3d')](handleError(_0x1a7c10,null));};exports[_0x6b83('0x48')]=function(_0x34c380,_0x24a813,_0x2405de){if(_0x34c380['body']['id']){delete _0x34c380[_0x6b83('0x43')]['id'];}return db[_0x6b83('0x27')][_0x6b83('0x46')]({'where':{'id':_0x34c380[_0x6b83('0x3f')]['id']}})[_0x6b83('0x23')](handleEntityNotFound(_0x24a813,null))[_0x6b83('0x23')](function(_0x5ef238){if(_0x5ef238){_0x34c380[_0x6b83('0x43')][_0x6b83('0x49')]=_0x5ef238['id'];_0x34c380['body'][_0x6b83('0x4a')]=integrations[_0x6b83('0x4b')](_0x34c380[_0x6b83('0x43')][_0x6b83('0x4c')],_0x34c380[_0x6b83('0x43')][_0x6b83('0x28')]);_0x34c380[_0x6b83('0x43')][_0x6b83('0x4d')]=integrations[_0x6b83('0x4e')](_0x34c380[_0x6b83('0x43')][_0x6b83('0x4c')],_0x34c380['body'][_0x6b83('0x28')]);return db[_0x6b83('0x4f')][_0x6b83('0x42')](_0x34c380[_0x6b83('0x43')],{'include':[{'model':db['FreshsalesField'],'as':_0x6b83('0x4a')},{'model':db['FreshsalesField'],'as':_0x6b83('0x4d')}]});}return null;})[_0x6b83('0x23')](respondWithResult(_0x24a813,null))[_0x6b83('0x3d')](handleError(_0x24a813,null));};exports[_0x6b83('0x50')]=function(_0x4b514c,_0x24aa05,_0x17b919){var _0x219279='';var _0x36baf6='';return db[_0x6b83('0x27')][_0x6b83('0x46')]({'where':{'id':_0x4b514c[_0x6b83('0x3f')]['id']},'attributes':['id',_0x6b83('0x51'),_0x6b83('0x52'),_0x6b83('0x53')]})['then'](handleEntityNotFound(_0x24aa05,null))['then'](function(_0x5d45a9){if(_0x5d45a9){_0x36baf6=_0x5d45a9[_0x6b83('0x51')];_0x219279=_0x5d45a9[_0x6b83('0x52')];var _0x57f15d=_0x5d45a9[_0x6b83('0x52')][_0x6b83('0x54')](-0x1);if(_0x57f15d==='/'){_0x219279=_0x219279[_0x6b83('0x55')](0x0,_0x219279[_0x6b83('0x56')](_0x57f15d));}return rp({'method':'GET','uri':util[_0x6b83('0x57')]('%s%s',_0x219279,'/api/selector/owners'),'headers':{'Authorization':_0x6b83('0x58')+_0x5d45a9[_0x6b83('0x53')]},'json':!![]});}})['then'](function(_0x200d85){if(_0x200d85){var _0x438888=_0x200d85[_0x6b83('0x59')];var _0x3ad3e1=![];var _0x7c5edc=null;for(_0x7c5edc=0x0;_0x7c5edc<_0x438888[_0x6b83('0x31')];_0x7c5edc++){if(_0x438888[_0x7c5edc][_0x6b83('0x5a')]===_0x36baf6){_0x3ad3e1=!![];}}if(_0x3ad3e1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6b83('0x5b')});}}})[_0x6b83('0x23')](respondWithResult(_0x24aa05,null))[_0x6b83('0x3d')](function(_0x318c6b){var _0x2a3572=_0x4b514c[_0x6b83('0x2b')]['test']?0x1f4:_0x318c6b['statusCode']||0x1f4;logger['error'](_0x6b83('0x5c'),'getFields',_0x2a3572,JSON[_0x6b83('0x5d')](_0x318c6b));delete _0x318c6b[_0x6b83('0x24')];if(_0x2a3572===0x191){_0x2a3572=0x190;}_0x24aa05[_0x6b83('0x18')](_0x2a3572)['send'](_0x4b514c[_0x6b83('0x2b')]['test']?{'message':_0x6b83('0x5e'),'statusCode':_0x318c6b[_0x6b83('0x5f')]}:_0x318c6b);});}; \ No newline at end of file +var _0xf4d9=['status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FreshsalesAccount','include','rows','catch','params','keys','intersection','includeAll','find','create','body','findOne','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x23eac7,_0x4e3e16){var _0x101eab=function(_0x3dd808){while(--_0x3dd808){_0x23eac7['push'](_0x23eac7['shift']());}};_0x101eab(++_0x4e3e16);}(_0xf4d9,0xae));var _0x9f4d=function(_0xf25015,_0x1a3392){_0xf25015=_0xf25015-0x0;var _0xdedbc0=_0xf4d9[_0xf25015];return _0xdedbc0;};'use strict';var emlformat=require(_0x9f4d('0x0'));var rimraf=require(_0x9f4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f4d('0x2'));var moment=require(_0x9f4d('0x3'));var BPromise=require(_0x9f4d('0x4'));var Mustache=require(_0x9f4d('0x5'));var util=require('util');var path=require(_0x9f4d('0x6'));var sox=require(_0x9f4d('0x7'));var csv=require(_0x9f4d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f4d('0x9'));var deskjs=require(_0x9f4d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9f4d('0xb'));var Papa=require('papaparse');var Redis=require(_0x9f4d('0xc'));var authService=require(_0x9f4d('0xd'));var qs=require(_0x9f4d('0xe'));var as=require(_0x9f4d('0xf'));var hardwareService=require(_0x9f4d('0x10'));var logger=require(_0x9f4d('0x11'))(_0x9f4d('0x12'));var utils=require(_0x9f4d('0x13'));var config=require(_0x9f4d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f4d('0x15'))['db'];var integrations=require(_0x9f4d('0x16'));function respondWithStatusCode(_0x2bb486,_0x47eca0){_0x47eca0=_0x47eca0||0xcc;return function(_0x213fbc){if(_0x213fbc){return _0x2bb486[_0x9f4d('0x17')](_0x47eca0);}return _0x2bb486[_0x9f4d('0x18')](_0x47eca0)[_0x9f4d('0x19')]();};}function respondWithResult(_0xd90a60,_0x59a524){_0x59a524=_0x59a524||0xc8;return function(_0x443d7b){if(_0x443d7b){return _0xd90a60[_0x9f4d('0x18')](_0x59a524)[_0x9f4d('0x1a')](_0x443d7b);}};}function respondWithFilteredResult(_0x4d20ed,_0x233521){return function(_0x449a50){if(_0x449a50){var _0xca3c0e=typeof _0x233521['offset']===_0x9f4d('0x1b')&&typeof _0x233521[_0x9f4d('0x1c')]===_0x9f4d('0x1b');var _0x205d97=_0x449a50[_0x9f4d('0x1d')];var _0x58767b=_0xca3c0e?0x0:_0x233521[_0x9f4d('0x1e')];var _0x2a247f=_0xca3c0e?_0x449a50[_0x9f4d('0x1d')]:_0x233521['offset']+_0x233521[_0x9f4d('0x1c')];var _0x312cc9;if(_0x2a247f>=_0x205d97){_0x2a247f=_0x205d97;_0x312cc9=0xc8;}else{_0x312cc9=0xce;}_0x4d20ed[_0x9f4d('0x18')](_0x312cc9);return _0x4d20ed[_0x9f4d('0x1f')]('Content-Range',_0x58767b+'-'+_0x2a247f+'/'+_0x205d97)[_0x9f4d('0x1a')](_0x449a50);}return null;};}function patchUpdates(_0x4ddf4a){return function(_0x3a46fb){try{jsonpatch[_0x9f4d('0x20')](_0x3a46fb,_0x4ddf4a,!![]);}catch(_0x1ef70a){return BPromise[_0x9f4d('0x21')](_0x1ef70a);}return _0x3a46fb[_0x9f4d('0x22')]();};}function saveUpdates(_0x4bc276,_0x359e99){return function(_0x56cc0f){if(_0x56cc0f){return _0x56cc0f[_0x9f4d('0x23')](_0x4bc276)[_0x9f4d('0x24')](function(_0x421dee){return _0x421dee;});}return null;};}function removeEntity(_0x1a377a,_0x41a14b){return function(_0x5821f1){if(_0x5821f1){return _0x5821f1[_0x9f4d('0x25')]()['then'](function(){_0x1a377a[_0x9f4d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa045,_0x4478f6){return function(_0x2e7e08){if(!_0x2e7e08){_0x4aa045[_0x9f4d('0x17')](0x194);}return _0x2e7e08;};}function handleError(_0x21d651,_0x2dc20a){_0x2dc20a=_0x2dc20a||0x1f4;return function(_0x2cfcfe){logger[_0x9f4d('0x26')](_0x2cfcfe['stack']);if(_0x2cfcfe[_0x9f4d('0x27')]){delete _0x2cfcfe[_0x9f4d('0x27')];}_0x21d651['status'](_0x2dc20a)[_0x9f4d('0x28')](_0x2cfcfe);};}exports[_0x9f4d('0x29')]=function(_0x49c89b,_0x2970a0){var _0x5297a0={},_0x405568={},_0x3ad84b={'count':0x0,'rows':[]};var _0xfc9842=_[_0x9f4d('0x2a')](db['FreshsalesAccount'][_0x9f4d('0x2b')],function(_0x10b97f){return{'name':_0x10b97f['fieldName'],'type':_0x10b97f[_0x9f4d('0x2c')][_0x9f4d('0x2d')]};});_0x405568[_0x9f4d('0x2e')]=_[_0x9f4d('0x2a')](_0xfc9842,_0x9f4d('0x27'));_0x405568['query']=_['keys'](_0x49c89b[_0x9f4d('0x2f')]);_0x405568[_0x9f4d('0x30')]=_['intersection'](_0x405568[_0x9f4d('0x2e')],_0x405568[_0x9f4d('0x2f')]);_0x5297a0[_0x9f4d('0x31')]=_['intersection'](_0x405568[_0x9f4d('0x2e')],qs['fields'](_0x49c89b[_0x9f4d('0x2f')][_0x9f4d('0x32')]));_0x5297a0[_0x9f4d('0x31')]=_0x5297a0[_0x9f4d('0x31')][_0x9f4d('0x33')]?_0x5297a0['attributes']:_0x405568[_0x9f4d('0x2e')];if(!_0x49c89b['query'][_0x9f4d('0x34')](_0x9f4d('0x35'))){_0x5297a0[_0x9f4d('0x1c')]=qs[_0x9f4d('0x1c')](_0x49c89b[_0x9f4d('0x2f')][_0x9f4d('0x1c')]);_0x5297a0['offset']=qs[_0x9f4d('0x1e')](_0x49c89b[_0x9f4d('0x2f')]['offset']);}_0x5297a0[_0x9f4d('0x36')]=qs['sort'](_0x49c89b[_0x9f4d('0x2f')][_0x9f4d('0x37')]);_0x5297a0['where']=qs[_0x9f4d('0x30')](_[_0x9f4d('0x38')](_0x49c89b[_0x9f4d('0x2f')],_0x405568[_0x9f4d('0x30')]),_0xfc9842);if(_0x49c89b[_0x9f4d('0x2f')][_0x9f4d('0x39')]){_0x5297a0[_0x9f4d('0x3a')]=_[_0x9f4d('0x3b')](_0x5297a0[_0x9f4d('0x3a')],{'$or':_[_0x9f4d('0x2a')](_0xfc9842,function(_0x456c74){if(_0x456c74[_0x9f4d('0x2c')]!==_0x9f4d('0x3c')){var _0x2aa413={};_0x2aa413[_0x456c74[_0x9f4d('0x27')]]={'$like':'%'+_0x49c89b[_0x9f4d('0x2f')][_0x9f4d('0x39')]+'%'};return _0x2aa413;}})});}_0x5297a0=_[_0x9f4d('0x3b')]({},_0x5297a0,_0x49c89b[_0x9f4d('0x3d')]);var _0x171c8f={'where':_0x5297a0['where']};return db[_0x9f4d('0x3e')][_0x9f4d('0x1d')](_0x171c8f)[_0x9f4d('0x24')](function(_0x4f7090){_0x3ad84b[_0x9f4d('0x1d')]=_0x4f7090;if(_0x49c89b[_0x9f4d('0x2f')]['includeAll']){_0x5297a0[_0x9f4d('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x5297a0);})[_0x9f4d('0x24')](function(_0x2da315){_0x3ad84b[_0x9f4d('0x40')]=_0x2da315;return _0x3ad84b;})[_0x9f4d('0x24')](respondWithFilteredResult(_0x2970a0,_0x5297a0))[_0x9f4d('0x41')](handleError(_0x2970a0,null));};exports['show']=function(_0x1e94de,_0x421cc5){var _0x3cba81={'raw':![],'where':{'id':_0x1e94de[_0x9f4d('0x42')]['id']}},_0x47b2ab={};_0x47b2ab['model']=_['keys'](db[_0x9f4d('0x3e')]['rawAttributes']);_0x47b2ab['query']=_[_0x9f4d('0x43')](_0x1e94de[_0x9f4d('0x2f')]);_0x47b2ab['filters']=_['intersection'](_0x47b2ab[_0x9f4d('0x2e')],_0x47b2ab['query']);_0x3cba81[_0x9f4d('0x31')]=_[_0x9f4d('0x44')](_0x47b2ab['model'],qs[_0x9f4d('0x32')](_0x1e94de[_0x9f4d('0x2f')][_0x9f4d('0x32')]));_0x3cba81['attributes']=_0x3cba81[_0x9f4d('0x31')][_0x9f4d('0x33')]?_0x3cba81['attributes']:_0x47b2ab[_0x9f4d('0x2e')];if(_0x1e94de[_0x9f4d('0x2f')][_0x9f4d('0x45')]){_0x3cba81[_0x9f4d('0x3f')]=[{'all':!![]}];}_0x3cba81=_[_0x9f4d('0x3b')]({},_0x3cba81,_0x1e94de[_0x9f4d('0x3d')]);return db['FreshsalesAccount'][_0x9f4d('0x46')](_0x3cba81)['then'](handleEntityNotFound(_0x421cc5,null))[_0x9f4d('0x24')](respondWithResult(_0x421cc5,null))[_0x9f4d('0x41')](handleError(_0x421cc5,null));};exports[_0x9f4d('0x47')]=function(_0x1cc7ad,_0x26b312){return db[_0x9f4d('0x3e')]['create'](_0x1cc7ad[_0x9f4d('0x48')],{})['then'](respondWithResult(_0x26b312,0xc9))[_0x9f4d('0x41')](handleError(_0x26b312,null));};exports[_0x9f4d('0x23')]=function(_0x256850,_0x2c9bd8){if(_0x256850['body']['id']){delete _0x256850[_0x9f4d('0x48')]['id'];}return db[_0x9f4d('0x3e')][_0x9f4d('0x46')]({'where':{'id':_0x256850[_0x9f4d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c9bd8,null))[_0x9f4d('0x24')](saveUpdates(_0x256850['body'],null))[_0x9f4d('0x24')](respondWithResult(_0x2c9bd8,null))[_0x9f4d('0x41')](handleError(_0x2c9bd8,null));};exports[_0x9f4d('0x25')]=function(_0x3752d6,_0x2940a8){return db[_0x9f4d('0x3e')]['find']({'where':{'id':_0x3752d6[_0x9f4d('0x42')]['id']}})[_0x9f4d('0x24')](handleEntityNotFound(_0x2940a8,null))[_0x9f4d('0x24')](removeEntity(_0x2940a8,null))['catch'](handleError(_0x2940a8,null));};exports['getConfigurations']=function(_0x56a671,_0x140619,_0x2050dd){var _0x58cf7d={};var _0x20a89e={};var _0x465c0c;var _0x1de437;return db[_0x9f4d('0x3e')][_0x9f4d('0x49')]({'where':{'id':_0x56a671[_0x9f4d('0x42')]['id']}})[_0x9f4d('0x24')](handleEntityNotFound(_0x140619,null))[_0x9f4d('0x24')](function(_0x555c9f){if(_0x555c9f){_0x465c0c=_0x555c9f;_0x20a89e[_0x9f4d('0x2e')]=_[_0x9f4d('0x43')](db['FreshsalesConfiguration'][_0x9f4d('0x2b')]);_0x20a89e[_0x9f4d('0x2f')]=_[_0x9f4d('0x43')](_0x56a671[_0x9f4d('0x2f')]);_0x20a89e[_0x9f4d('0x30')]=_['intersection'](_0x20a89e[_0x9f4d('0x2e')],_0x20a89e['query']);_0x58cf7d['attributes']=_[_0x9f4d('0x44')](_0x20a89e[_0x9f4d('0x2e')],qs[_0x9f4d('0x32')](_0x56a671[_0x9f4d('0x2f')][_0x9f4d('0x32')]));_0x58cf7d[_0x9f4d('0x31')]=_0x58cf7d[_0x9f4d('0x31')][_0x9f4d('0x33')]?_0x58cf7d[_0x9f4d('0x31')]:_0x20a89e['model'];_0x58cf7d[_0x9f4d('0x36')]=qs['sort'](_0x56a671['query'][_0x9f4d('0x37')]);_0x58cf7d[_0x9f4d('0x3a')]=qs[_0x9f4d('0x30')](_[_0x9f4d('0x38')](_0x56a671['query'],_0x20a89e['filters']));if(_0x56a671[_0x9f4d('0x2f')][_0x9f4d('0x39')]){_0x58cf7d[_0x9f4d('0x3a')]=_['merge'](_0x58cf7d[_0x9f4d('0x3a')],{'$or':_['map'](_0x58cf7d[_0x9f4d('0x31')],function(_0x484d58){var _0x5da7c9={};_0x5da7c9[_0x484d58]={'$like':'%'+_0x56a671[_0x9f4d('0x2f')]['filter']+'%'};return _0x5da7c9;})});}_0x58cf7d=_['merge']({},_0x58cf7d,_0x56a671['options']);return _0x465c0c[_0x9f4d('0x4a')](_0x58cf7d);}})[_0x9f4d('0x24')](function(_0x38ac87){if(_0x38ac87){_0x1de437=_0x38ac87['length'];if(!_0x56a671[_0x9f4d('0x2f')][_0x9f4d('0x34')](_0x9f4d('0x35'))){_0x58cf7d[_0x9f4d('0x1c')]=qs['limit'](_0x56a671[_0x9f4d('0x2f')][_0x9f4d('0x1c')]);_0x58cf7d[_0x9f4d('0x1e')]=qs[_0x9f4d('0x1e')](_0x56a671[_0x9f4d('0x2f')][_0x9f4d('0x1e')]);}return _0x465c0c[_0x9f4d('0x4a')](_0x58cf7d);}})['then'](function(_0x5b7405){if(_0x5b7405){return _0x5b7405?{'count':_0x1de437,'rows':_0x5b7405}:null;}})['then'](respondWithResult(_0x140619,null))[_0x9f4d('0x41')](handleError(_0x140619,null));};exports[_0x9f4d('0x4b')]=function(_0x3718d5,_0x137fb3,_0x52a851){if(_0x3718d5[_0x9f4d('0x48')]['id']){delete _0x3718d5['body']['id'];}return db[_0x9f4d('0x3e')][_0x9f4d('0x49')]({'where':{'id':_0x3718d5[_0x9f4d('0x42')]['id']}})[_0x9f4d('0x24')](handleEntityNotFound(_0x137fb3,null))[_0x9f4d('0x24')](function(_0x372504){if(_0x372504){_0x3718d5['body']['AccountId']=_0x372504['id'];_0x3718d5[_0x9f4d('0x48')][_0x9f4d('0x4c')]=integrations[_0x9f4d('0x4d')](_0x3718d5[_0x9f4d('0x48')][_0x9f4d('0x4e')],_0x3718d5[_0x9f4d('0x48')]['type']);_0x3718d5[_0x9f4d('0x48')]['Descriptions']=integrations[_0x9f4d('0x4f')](_0x3718d5[_0x9f4d('0x48')]['channel'],_0x3718d5[_0x9f4d('0x48')]['type']);return db[_0x9f4d('0x50')][_0x9f4d('0x47')](_0x3718d5[_0x9f4d('0x48')],{'include':[{'model':db[_0x9f4d('0x51')],'as':_0x9f4d('0x4c')},{'model':db[_0x9f4d('0x51')],'as':'Descriptions'}]});}return null;})[_0x9f4d('0x24')](respondWithResult(_0x137fb3,null))['catch'](handleError(_0x137fb3,null));};exports[_0x9f4d('0x52')]=function(_0x4265fb,_0x7cdc92,_0x5e287b){var _0x11a132='';var _0x3ee112='';return db[_0x9f4d('0x3e')][_0x9f4d('0x49')]({'where':{'id':_0x4265fb['params']['id']},'attributes':['id',_0x9f4d('0x53'),'remoteUri',_0x9f4d('0x54')]})['then'](handleEntityNotFound(_0x7cdc92,null))['then'](function(_0x45d93f){if(_0x45d93f){_0x3ee112=_0x45d93f['username'];_0x11a132=_0x45d93f['remoteUri'];var _0x26860=_0x45d93f[_0x9f4d('0x55')]['slice'](-0x1);if(_0x26860==='/'){_0x11a132=_0x11a132[_0x9f4d('0x56')](0x0,_0x11a132['lastIndexOf'](_0x26860));}return rp({'method':_0x9f4d('0x57'),'uri':util[_0x9f4d('0x58')](_0x9f4d('0x59'),_0x11a132,_0x9f4d('0x5a')),'headers':{'Authorization':_0x9f4d('0x5b')+_0x45d93f[_0x9f4d('0x54')]},'json':!![]});}})[_0x9f4d('0x24')](function(_0xd751bd){if(_0xd751bd){var _0x4f08d3=_0xd751bd[_0x9f4d('0x5c')];var _0x4d40f1=![];var _0x815331=null;for(_0x815331=0x0;_0x815331<_0x4f08d3['length'];_0x815331++){if(_0x4f08d3[_0x815331][_0x9f4d('0x5d')]===_0x3ee112){_0x4d40f1=!![];}}if(_0x4d40f1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9f4d('0x5e')});}}})[_0x9f4d('0x24')](respondWithResult(_0x7cdc92,null))['catch'](function(_0x6673bd){var _0x6302cf=_0x4265fb[_0x9f4d('0x2f')][_0x9f4d('0x5f')]?0x1f4:_0x6673bd[_0x9f4d('0x60')]||0x1f4;logger[_0x9f4d('0x26')](_0x9f4d('0x61'),_0x9f4d('0x52'),_0x6302cf,JSON['stringify'](_0x6673bd));delete _0x6673bd['name'];if(_0x6302cf===0x191){_0x6302cf=0x190;}_0x7cdc92['status'](_0x6302cf)[_0x9f4d('0x28')](_0x4265fb[_0x9f4d('0x2f')][_0x9f4d('0x5f')]?{'message':_0x9f4d('0x62'),'statusCode':_0x6673bd[_0x9f4d('0x60')]}:_0x6673bd);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0ca6dbb..233d26d 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 _0x323f=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x48f4ef,_0x5a9a21){var _0x6f762f=function(_0x2341b9){while(--_0x2341b9){_0x48f4ef['push'](_0x48f4ef['shift']());}};_0x6f762f(++_0x5a9a21);}(_0x323f,0x1ee));var _0xf323=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x323f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));var integrations=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x5d7d60,_0xb9a667){return _0x5d7d60[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x279ab1,_0x527374){var _0x8ba87c=function(_0x2c0898){while(--_0x2c0898){_0x279ab1['push'](_0x279ab1['shift']());}};_0x8ba87c(++_0x527374);}(_0x5fab,0x177));var _0xb5fa=function(_0x35c1cf,_0x197400){_0x35c1cf=_0x35c1cf-0x0;var _0x56bc59=_0x5fab[_0x35c1cf];return _0x56bc59;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));var integrations=require(_0xb5fa('0xa'));module[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return _0x4a0249[_0xb5fa('0xc')](_0xb5fa('0xd'),attributes,{'tableName':_0xb5fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index c0a9658..600340d 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 _0x4888=['FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshsalesAccount'];(function(_0x4720b6,_0x13c3bd){var _0x235734=function(_0x493745){while(--_0x493745){_0x4720b6['push'](_0x4720b6['shift']());}};_0x235734(++_0x13c3bd);}(_0x4888,0x198));var _0x8488=function(_0x3f7855,_0x535342){_0x3f7855=_0x3f7855-0x0;var _0x301fb7=_0x4888[_0x3f7855];return _0x301fb7;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')]({'raw':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x60ae2f['options']?_0x60ae2f['options'][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1e')]||null:null,'include':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')]['include']?_[_0x8488('0x1f')](_0x60ae2f[_0x8488('0x1a')][_0x8488('0x20')],function(_0x1361a6){return{'model':db[_0x1361a6[_0x8488('0x21')]],'as':_0x1361a6['as'],'attributes':_0x1361a6['attributes'],'include':_0x1361a6['include']?_['map'](_0x1361a6['include'],function(_0x472624){return{'model':db[_0x472624['model']],'as':_0x472624['as'],'attributes':_0x472624['attributes'],'include':_0x472624[_0x8488('0x20')]?_[_0x8488('0x1f')](_0x472624[_0x8488('0x20')],function(_0x6ebee0){return{'model':db[_0x6ebee0[_0x8488('0x21')]],'as':_0x6ebee0['as'],'attributes':_0x6ebee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x38c137){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x38c137));_0x1aedb1(_0x38c137);})[_0x8488('0x22')](function(_0x368f9c){logger[_0x8488('0x13')](_0x8488('0x17'),_0x368f9c['message'],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x368f9c['message']));});});};exports[_0x8488('0x23')]=function(_0x408c36){var _0x19cf42=this;return new Promise(function(_0x121dcc,_0x117321){return db[_0x8488('0x18')]['find']({'raw':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['where']||null:null,'attributes':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['attributes']||null:null,'include':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x20')]?_[_0x8488('0x1f')](_0x408c36[_0x8488('0x1a')]['include'],function(_0x44c8f3){return{'model':db[_0x44c8f3[_0x8488('0x21')]],'as':_0x44c8f3['as'],'attributes':_0x44c8f3[_0x8488('0x1d')],'include':_0x44c8f3['include']?_[_0x8488('0x1f')](_0x44c8f3['include'],function(_0x205ccc){return{'model':db[_0x205ccc[_0x8488('0x21')]],'as':_0x205ccc['as'],'attributes':_0x205ccc[_0x8488('0x1d')],'include':_0x205ccc[_0x8488('0x20')]?_['map'](_0x205ccc[_0x8488('0x20')],function(_0xe71bd9){return{'model':db[_0xe71bd9[_0x8488('0x21')]],'as':_0xe71bd9['as'],'attributes':_0xe71bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x17bfea){logger[_0x8488('0xe')](_0x8488('0x23'),_0x408c36);logger[_0x8488('0x11')](_0x8488('0x23'),_0x408c36,JSON[_0x8488('0x12')](_0x17bfea));_0x121dcc(_0x17bfea);})[_0x8488('0x22')](function(_0x1a8235){logger[_0x8488('0x13')](_0x8488('0x23'),_0x1a8235['message'],_0x408c36);_0x117321(_0x19cf42['error'](0x1f4,_0x1a8235[_0x8488('0x15')]));});});}; \ No newline at end of file +var _0x524e=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e1a16,_0x4bb327){var _0x59b8cd=function(_0x5f0e97){while(--_0x5f0e97){_0x2e1a16['push'](_0x2e1a16['shift']());}};_0x59b8cd(++_0x4bb327);}(_0x524e,0x15e));var _0xe524=function(_0x667600,_0x106deb){_0x667600=_0x667600-0x0;var _0x28c067=_0x524e[_0x667600];return _0x28c067;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['GetFreshsalesAccount']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')]({'raw':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]===undefined?!![]:![]:!![],'where':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1c')]||null:null,'include':_0x3a4027[_0xe524('0x18')]?_0x3a4027['options'][_0xe524('0x1d')]?_['map'](_0x3a4027['options'][_0xe524('0x1d')],function(_0x23df5e){return{'model':db[_0x23df5e[_0xe524('0x1e')]],'as':_0x23df5e['as'],'attributes':_0x23df5e[_0xe524('0x1b')],'include':_0x23df5e['include']?_[_0xe524('0x1f')](_0x23df5e['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x1e')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1b')],'include':_0x17e245[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x17e245[_0xe524('0x1d')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x45abad){logger[_0xe524('0xd')](_0xe524('0x20'),_0x3a4027);logger[_0xe524('0x10')]('GetFreshsalesAccount',_0x3a4027,JSON['stringify'](_0x45abad));_0x11b2a1(_0x45abad);})[_0xe524('0x21')](function(_0x25e7a7){logger[_0xe524('0x13')](_0xe524('0x20'),_0x25e7a7[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x25e7a7[_0xe524('0x15')]));});});};exports[_0xe524('0x22')]=function(_0x4a4e15){var _0x5b7ded=this;return new Promise(function(_0x20688e,_0x376324){return db['FreshsalesAccount'][_0xe524('0x23')]({'raw':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['attributes']||null:null,'include':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')]?_['map'](_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')],function(_0x49c43e){return{'model':db[_0x49c43e[_0xe524('0x1e')]],'as':_0x49c43e['as'],'attributes':_0x49c43e[_0xe524('0x1b')],'include':_0x49c43e[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x49c43e['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x1e')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1b')],'include':_0x415450[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x415450[_0xe524('0x1d')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x1e')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x56f371){logger[_0xe524('0xd')](_0xe524('0x22'),_0x4a4e15);logger['debug'](_0xe524('0x22'),_0x4a4e15,JSON['stringify'](_0x56f371));_0x20688e(_0x56f371);})[_0xe524('0x21')](function(_0x41af26){logger[_0xe524('0x13')](_0xe524('0x22'),_0x41af26[_0xe524('0x15')],_0x4a4e15);_0x376324(_0x5b7ded[_0xe524('0x13')](0x1f4,_0x41af26[_0xe524('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e8587f5..eb37597 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 _0x46ac=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x101cf5,_0x4bc4ab){var _0xa8d8ec=function(_0x3fb9bc){while(--_0x3fb9bc){_0x101cf5['push'](_0x101cf5['shift']());}};_0xa8d8ec(++_0x4bc4ab);}(_0x46ac,0xd3));var _0xc46a=function(_0x492c40,_0x4d16aa){_0x492c40=_0x492c40-0x0;var _0x373710=_0x46ac[_0x492c40];return _0x373710;};'use strict';var multer=require(_0xc46a('0x0'));var util=require(_0xc46a('0x1'));var path=require(_0xc46a('0x2'));var timeout=require(_0xc46a('0x3'));var express=require(_0xc46a('0x4'));var router=express[_0xc46a('0x5')]();var fs_extra=require(_0xc46a('0x6'));var auth=require(_0xc46a('0x7'));var interaction=require(_0xc46a('0x8'));var config=require(_0xc46a('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xc46a('0xa')](),controller[_0xc46a('0xb')]);router[_0xc46a('0xc')](_0xc46a('0xd'),auth[_0xc46a('0xa')](),controller[_0xc46a('0xe')]);router[_0xc46a('0xc')](_0xc46a('0xf'),auth[_0xc46a('0xa')](),controller[_0xc46a('0x10')]);router['get'](_0xc46a('0x11'),auth[_0xc46a('0xa')](),controller[_0xc46a('0x12')]);router[_0xc46a('0xc')]('/:id/fields',auth[_0xc46a('0xa')](),controller['getFields']);router[_0xc46a('0x13')]('/',auth[_0xc46a('0xa')](),controller[_0xc46a('0x14')]);router[_0xc46a('0x15')](_0xc46a('0xd'),auth['isAuthenticated'](),controller[_0xc46a('0x16')]);router['delete'](_0xc46a('0xd'),auth['isAuthenticated'](),controller[_0xc46a('0x17')]);module[_0xc46a('0x18')]=router; \ No newline at end of file +var _0x7edc=['show','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x24d727,_0x3d60d3){var _0x83a316=function(_0x47f1a1){while(--_0x47f1a1){_0x24d727['push'](_0x24d727['shift']());}};_0x83a316(++_0x3d60d3);}(_0x7edc,0x78));var _0xc7ed=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x7edc[_0x507403];return _0x1327c;};'use strict';var multer=require('multer');var util=require(_0xc7ed('0x0'));var path=require(_0xc7ed('0x1'));var timeout=require(_0xc7ed('0x2'));var express=require(_0xc7ed('0x3'));var router=express[_0xc7ed('0x4')]();var fs_extra=require(_0xc7ed('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc7ed('0x6'));var controller=require(_0xc7ed('0x7'));router[_0xc7ed('0x8')]('/',auth[_0xc7ed('0x9')](),controller[_0xc7ed('0xa')]);router[_0xc7ed('0x8')](_0xc7ed('0xb'),auth[_0xc7ed('0x9')](),controller[_0xc7ed('0xc')]);router[_0xc7ed('0x8')]('/:id/subjects',auth[_0xc7ed('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xc7ed('0x9')](),controller[_0xc7ed('0xd')]);router[_0xc7ed('0x8')](_0xc7ed('0xe'),auth['isAuthenticated'](),controller[_0xc7ed('0xf')]);router[_0xc7ed('0x10')]('/',auth['isAuthenticated'](),controller[_0xc7ed('0x11')]);router[_0xc7ed('0x12')](_0xc7ed('0xb'),auth[_0xc7ed('0x9')](),controller[_0xc7ed('0x13')]);router['delete']('/:id',auth[_0xc7ed('0x9')](),controller[_0xc7ed('0x14')]);module[_0xc7ed('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 1b23b4c..b231102 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 _0xf055=['STRING','sequelize'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0xf055,0x1b7));var _0x5f05=function(_0x2e6c75,_0x1bdbb7){_0x2e6c75=_0x2e6c75-0x0;var _0x13a9ea=_0xf055[_0x2e6c75];return _0x13a9ea;};'use strict';var Sequelize=require(_0x5f05('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5f05('0x1')]}}; \ No newline at end of file +var _0x96fa=['sequelize','exports','STRING'];(function(_0x2f0458,_0x3b9a7a){var _0x2d923d=function(_0x28d118){while(--_0x28d118){_0x2f0458['push'](_0x2f0458['shift']());}};_0x2d923d(++_0x3b9a7a);}(_0x96fa,0x13b));var _0xa96f=function(_0x229d30,_0x3ea3be){_0x229d30=_0x229d30-0x0;var _0x49cf1d=_0x96fa[_0x229d30];return _0x49cf1d;};'use strict';var Sequelize=require(_0xa96f('0x0'));module[_0xa96f('0x1')]={'name':{'type':Sequelize[_0xa96f('0x2')]},'description':{'type':Sequelize[_0xa96f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 12d94c0..cad5488 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 _0x1801=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','send','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','offset','order','sort','where','filter','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','nolimit','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x1801,0x18c));var _0x1180=function(_0x5af4ff,_0x36409d){_0x5af4ff=_0x5af4ff-0x0;var _0x1554f5=_0x1801[_0x5af4ff];return _0x1554f5;};'use strict';var emlformat=require(_0x1180('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1180('0x1'));var rp=require(_0x1180('0x2'));var moment=require('moment');var BPromise=require(_0x1180('0x3'));var Mustache=require(_0x1180('0x4'));var util=require(_0x1180('0x5'));var path=require(_0x1180('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1180('0x7'));var fs=require('fs');var fs_extra=require(_0x1180('0x8'));var _=require(_0x1180('0x9'));var squel=require(_0x1180('0xa'));var crypto=require(_0x1180('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1180('0xc'));var toCsv=require(_0x1180('0xd'));var querystring=require(_0x1180('0xe'));var Papa=require(_0x1180('0xf'));var Redis=require(_0x1180('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1180('0x11'));var as=require(_0x1180('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1180('0x13'))('api');var utils=require(_0x1180('0x14'));var config=require(_0x1180('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1180('0x16'))['db'];function respondWithStatusCode(_0x43d347,_0x1e90d6){_0x1e90d6=_0x1e90d6||0xcc;return function(_0x28e8a0){if(_0x28e8a0){return _0x43d347['sendStatus'](_0x1e90d6);}return _0x43d347[_0x1180('0x17')](_0x1e90d6)[_0x1180('0x18')]();};}function respondWithResult(_0x1aaa6a,_0x2b8cd4){_0x2b8cd4=_0x2b8cd4||0xc8;return function(_0x1a6dde){if(_0x1a6dde){return _0x1aaa6a['status'](_0x2b8cd4)[_0x1180('0x19')](_0x1a6dde);}};}function respondWithFilteredResult(_0x2e3c78,_0x4f76d4){return function(_0x1eff18){if(_0x1eff18){var _0x23b7a5=typeof _0x4f76d4['offset']===_0x1180('0x1a')&&typeof _0x4f76d4[_0x1180('0x1b')]===_0x1180('0x1a');var _0x182139=_0x1eff18[_0x1180('0x1c')];var _0x216892=_0x23b7a5?0x0:_0x4f76d4['offset'];var _0xf02c40=_0x23b7a5?_0x1eff18['count']:_0x4f76d4['offset']+_0x4f76d4[_0x1180('0x1b')];var _0x5509d0;if(_0xf02c40>=_0x182139){_0xf02c40=_0x182139;_0x5509d0=0xc8;}else{_0x5509d0=0xce;}_0x2e3c78[_0x1180('0x17')](_0x5509d0);return _0x2e3c78[_0x1180('0x1d')](_0x1180('0x1e'),_0x216892+'-'+_0xf02c40+'/'+_0x182139)[_0x1180('0x19')](_0x1eff18);}return null;};}function patchUpdates(_0x196b2c){return function(_0x294502){try{jsonpatch[_0x1180('0x1f')](_0x294502,_0x196b2c,!![]);}catch(_0x2ba164){return BPromise[_0x1180('0x20')](_0x2ba164);}return _0x294502[_0x1180('0x21')]();};}function saveUpdates(_0x27fe93,_0x531c75){return function(_0x105ab0){if(_0x105ab0){return _0x105ab0[_0x1180('0x22')](_0x27fe93)[_0x1180('0x23')](function(_0x4eda5e){return _0x4eda5e;});}return null;};}function removeEntity(_0x3cc827,_0x1a5e9b){return function(_0x1259ff){if(_0x1259ff){return _0x1259ff['destroy']()[_0x1180('0x23')](function(){_0x3cc827[_0x1180('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aed2f,_0x58a7dd){return function(_0x1d250c){if(!_0x1d250c){_0x4aed2f['sendStatus'](0x194);}return _0x1d250c;};}function handleError(_0x3b524f,_0x420e33){_0x420e33=_0x420e33||0x1f4;return function(_0x1adc65){logger[_0x1180('0x24')](_0x1adc65['stack']);if(_0x1adc65['name']){delete _0x1adc65['name'];}_0x3b524f[_0x1180('0x17')](_0x420e33)[_0x1180('0x25')](_0x1adc65);};}exports[_0x1180('0x26')]=function(_0x32c396,_0x46ed57){var _0x1f69c8={},_0x17239e={},_0x4fa1c1={'count':0x0,'rows':[]};var _0x311cce=_[_0x1180('0x27')](db['FreshsalesConfiguration'][_0x1180('0x28')],function(_0x30f760){return{'name':_0x30f760[_0x1180('0x29')],'type':_0x30f760[_0x1180('0x2a')][_0x1180('0x2b')]};});_0x17239e['model']=_[_0x1180('0x27')](_0x311cce,_0x1180('0x2c'));_0x17239e['query']=_['keys'](_0x32c396[_0x1180('0x2d')]);_0x17239e[_0x1180('0x2e')]=_[_0x1180('0x2f')](_0x17239e['model'],_0x17239e[_0x1180('0x2d')]);_0x1f69c8[_0x1180('0x30')]=_[_0x1180('0x2f')](_0x17239e[_0x1180('0x31')],qs[_0x1180('0x32')](_0x32c396[_0x1180('0x2d')][_0x1180('0x32')]));_0x1f69c8[_0x1180('0x30')]=_0x1f69c8[_0x1180('0x30')][_0x1180('0x33')]?_0x1f69c8[_0x1180('0x30')]:_0x17239e[_0x1180('0x31')];if(!_0x32c396[_0x1180('0x2d')][_0x1180('0x34')]('nolimit')){_0x1f69c8[_0x1180('0x1b')]=qs[_0x1180('0x1b')](_0x32c396['query'][_0x1180('0x1b')]);_0x1f69c8[_0x1180('0x35')]=qs[_0x1180('0x35')](_0x32c396[_0x1180('0x2d')][_0x1180('0x35')]);}_0x1f69c8[_0x1180('0x36')]=qs['sort'](_0x32c396[_0x1180('0x2d')][_0x1180('0x37')]);_0x1f69c8[_0x1180('0x38')]=qs['filters'](_['pick'](_0x32c396['query'],_0x17239e['filters']),_0x311cce);if(_0x32c396[_0x1180('0x2d')][_0x1180('0x39')]){_0x1f69c8[_0x1180('0x38')]=_['merge'](_0x1f69c8[_0x1180('0x38')],{'$or':_[_0x1180('0x27')](_0x311cce,function(_0x39eb75){if(_0x39eb75['type']!==_0x1180('0x3a')){var _0xe2059={};_0xe2059[_0x39eb75[_0x1180('0x2c')]]={'$like':'%'+_0x32c396[_0x1180('0x2d')][_0x1180('0x39')]+'%'};return _0xe2059;}})});}_0x1f69c8=_[_0x1180('0x3b')]({},_0x1f69c8,_0x32c396[_0x1180('0x3c')]);var _0x3d5395={'where':_0x1f69c8[_0x1180('0x38')]};return db[_0x1180('0x3d')][_0x1180('0x1c')](_0x3d5395)[_0x1180('0x23')](function(_0x48c7b4){_0x4fa1c1[_0x1180('0x1c')]=_0x48c7b4;if(_0x32c396['query'][_0x1180('0x3e')]){_0x1f69c8[_0x1180('0x3f')]=[{'all':!![]}];}return db[_0x1180('0x3d')][_0x1180('0x40')](_0x1f69c8);})[_0x1180('0x23')](function(_0x5af069){_0x4fa1c1[_0x1180('0x41')]=_0x5af069;return _0x4fa1c1;})[_0x1180('0x23')](respondWithFilteredResult(_0x46ed57,_0x1f69c8))[_0x1180('0x42')](handleError(_0x46ed57,null));};exports[_0x1180('0x43')]=function(_0x2b8f67,_0x22bad2){var _0x530cab={'raw':![],'where':{'id':_0x2b8f67[_0x1180('0x44')]['id']}},_0x5009fd={};_0x5009fd['model']=_[_0x1180('0x45')](db['FreshsalesConfiguration'][_0x1180('0x28')]);_0x5009fd[_0x1180('0x2d')]=_[_0x1180('0x45')](_0x2b8f67['query']);_0x5009fd[_0x1180('0x2e')]=_['intersection'](_0x5009fd[_0x1180('0x31')],_0x5009fd['query']);_0x530cab[_0x1180('0x30')]=_['intersection'](_0x5009fd['model'],qs[_0x1180('0x32')](_0x2b8f67[_0x1180('0x2d')][_0x1180('0x32')]));_0x530cab[_0x1180('0x30')]=_0x530cab[_0x1180('0x30')][_0x1180('0x33')]?_0x530cab[_0x1180('0x30')]:_0x5009fd[_0x1180('0x31')];if(_0x2b8f67[_0x1180('0x2d')][_0x1180('0x3e')]){_0x530cab['include']=[{'all':!![]}];}_0x530cab=_[_0x1180('0x3b')]({},_0x530cab,_0x2b8f67[_0x1180('0x3c')]);return db[_0x1180('0x3d')][_0x1180('0x46')](_0x530cab)[_0x1180('0x23')](handleEntityNotFound(_0x22bad2,null))['then'](respondWithResult(_0x22bad2,null))[_0x1180('0x42')](handleError(_0x22bad2,null));};exports[_0x1180('0x47')]=function(_0x277be6,_0x32a667){return db[_0x1180('0x3d')][_0x1180('0x47')](_0x277be6[_0x1180('0x48')],{})[_0x1180('0x23')](respondWithResult(_0x32a667,0xc9))[_0x1180('0x42')](handleError(_0x32a667,null));};exports['update']=function(_0x3b1ec1,_0x412a2d){if(_0x3b1ec1[_0x1180('0x48')]['id']){delete _0x3b1ec1[_0x1180('0x48')]['id'];}return db[_0x1180('0x3d')]['find']({'where':{'id':_0x3b1ec1[_0x1180('0x44')]['id']}})[_0x1180('0x23')](handleEntityNotFound(_0x412a2d,null))[_0x1180('0x23')](saveUpdates(_0x3b1ec1[_0x1180('0x48')],null))[_0x1180('0x23')](respondWithResult(_0x412a2d,null))[_0x1180('0x42')](handleError(_0x412a2d,null));};exports[_0x1180('0x49')]=function(_0x495699,_0x3eb913){return db[_0x1180('0x3d')][_0x1180('0x46')]({'where':{'id':_0x495699[_0x1180('0x44')]['id']}})['then'](handleEntityNotFound(_0x3eb913,null))['then'](removeEntity(_0x3eb913,null))[_0x1180('0x42')](handleError(_0x3eb913,null));};exports[_0x1180('0x4a')]=function(_0x2f1e4c,_0x33110d,_0x22be5f){var _0x50ce05={};var _0x52f9d3={};var _0x214476;var _0x1d9bd4;return db[_0x1180('0x3d')][_0x1180('0x4b')]({'where':{'id':_0x2f1e4c[_0x1180('0x44')]['id']}})[_0x1180('0x23')](handleEntityNotFound(_0x33110d,null))[_0x1180('0x23')](function(_0x299a02){if(_0x299a02){_0x214476=_0x299a02;_0x52f9d3['model']=_[_0x1180('0x45')](db[_0x1180('0x4c')][_0x1180('0x28')]);_0x52f9d3[_0x1180('0x2d')]=_[_0x1180('0x45')](_0x2f1e4c['query']);_0x52f9d3[_0x1180('0x2e')]=_[_0x1180('0x2f')](_0x52f9d3[_0x1180('0x31')],_0x52f9d3[_0x1180('0x2d')]);_0x50ce05['attributes']=_[_0x1180('0x2f')](_0x52f9d3[_0x1180('0x31')],qs[_0x1180('0x32')](_0x2f1e4c['query'][_0x1180('0x32')]));_0x50ce05[_0x1180('0x30')]=_0x50ce05['attributes'][_0x1180('0x33')]?_0x50ce05[_0x1180('0x30')]:_0x52f9d3['model'];_0x50ce05['order']=qs[_0x1180('0x37')](_0x2f1e4c[_0x1180('0x2d')]['sort']);_0x50ce05[_0x1180('0x38')]=qs[_0x1180('0x2e')](_['pick'](_0x2f1e4c[_0x1180('0x2d')],_0x52f9d3[_0x1180('0x2e')]));if(_0x2f1e4c['query'][_0x1180('0x39')]){_0x50ce05[_0x1180('0x38')]=_[_0x1180('0x3b')](_0x50ce05[_0x1180('0x38')],{'$or':_[_0x1180('0x27')](_0x50ce05[_0x1180('0x30')],function(_0x5396cc){var _0x547dcf={};_0x547dcf[_0x5396cc]={'$like':'%'+_0x2f1e4c[_0x1180('0x2d')]['filter']+'%'};return _0x547dcf;})});}_0x50ce05=_['merge']({},_0x50ce05,_0x2f1e4c[_0x1180('0x3c')]);return _0x214476[_0x1180('0x4a')](_0x50ce05);}})[_0x1180('0x23')](function(_0x2b55bf){if(_0x2b55bf){_0x1d9bd4=_0x2b55bf[_0x1180('0x33')];if(!_0x2f1e4c[_0x1180('0x2d')]['hasOwnProperty']('nolimit')){_0x50ce05[_0x1180('0x1b')]=qs[_0x1180('0x1b')](_0x2f1e4c[_0x1180('0x2d')][_0x1180('0x1b')]);_0x50ce05[_0x1180('0x35')]=qs[_0x1180('0x35')](_0x2f1e4c[_0x1180('0x2d')][_0x1180('0x35')]);}return _0x214476[_0x1180('0x4a')](_0x50ce05);}})['then'](function(_0x4324b6){if(_0x4324b6){return _0x4324b6?{'count':_0x1d9bd4,'rows':_0x4324b6}:null;}})[_0x1180('0x23')](respondWithResult(_0x33110d,null))[_0x1180('0x42')](handleError(_0x33110d,null));};exports[_0x1180('0x4d')]=function(_0x480d48,_0x55478a,_0x18b158){var _0x29d3ec={};var _0xad3475={};var _0x7c1043;var _0x53787a;return db[_0x1180('0x3d')][_0x1180('0x4b')]({'where':{'id':_0x480d48[_0x1180('0x44')]['id']}})[_0x1180('0x23')](handleEntityNotFound(_0x55478a,null))['then'](function(_0x137138){if(_0x137138){_0x7c1043=_0x137138;_0xad3475[_0x1180('0x31')]=_[_0x1180('0x45')](db[_0x1180('0x4c')][_0x1180('0x28')]);_0xad3475[_0x1180('0x2d')]=_[_0x1180('0x45')](_0x480d48[_0x1180('0x2d')]);_0xad3475[_0x1180('0x2e')]=_['intersection'](_0xad3475[_0x1180('0x31')],_0xad3475[_0x1180('0x2d')]);_0x29d3ec[_0x1180('0x30')]=_[_0x1180('0x2f')](_0xad3475[_0x1180('0x31')],qs[_0x1180('0x32')](_0x480d48[_0x1180('0x2d')]['fields']));_0x29d3ec[_0x1180('0x30')]=_0x29d3ec[_0x1180('0x30')][_0x1180('0x33')]?_0x29d3ec[_0x1180('0x30')]:_0xad3475[_0x1180('0x31')];_0x29d3ec[_0x1180('0x36')]=qs[_0x1180('0x37')](_0x480d48[_0x1180('0x2d')][_0x1180('0x37')]);_0x29d3ec[_0x1180('0x38')]=qs['filters'](_[_0x1180('0x4e')](_0x480d48[_0x1180('0x2d')],_0xad3475[_0x1180('0x2e')]));if(_0x480d48['query'][_0x1180('0x39')]){_0x29d3ec[_0x1180('0x38')]=_[_0x1180('0x3b')](_0x29d3ec[_0x1180('0x38')],{'$or':_[_0x1180('0x27')](_0x29d3ec[_0x1180('0x30')],function(_0x15a8b7){var _0x28a512={};_0x28a512[_0x15a8b7]={'$like':'%'+_0x480d48[_0x1180('0x2d')][_0x1180('0x39')]+'%'};return _0x28a512;})});}_0x29d3ec=_['merge']({},_0x29d3ec,_0x480d48[_0x1180('0x3c')]);return _0x7c1043[_0x1180('0x4d')](_0x29d3ec);}})[_0x1180('0x23')](function(_0x1f5015){if(_0x1f5015){_0x53787a=_0x1f5015[_0x1180('0x33')];if(!_0x480d48['query'][_0x1180('0x34')]('nolimit')){_0x29d3ec[_0x1180('0x1b')]=qs[_0x1180('0x1b')](_0x480d48[_0x1180('0x2d')][_0x1180('0x1b')]);_0x29d3ec[_0x1180('0x35')]=qs['offset'](_0x480d48[_0x1180('0x2d')][_0x1180('0x35')]);}return _0x7c1043[_0x1180('0x4d')](_0x29d3ec);}})[_0x1180('0x23')](function(_0x1e588d){if(_0x1e588d){return _0x1e588d?{'count':_0x53787a,'rows':_0x1e588d}:null;}})[_0x1180('0x23')](respondWithResult(_0x55478a,null))[_0x1180('0x42')](handleError(_0x55478a,null));};exports[_0x1180('0x4f')]=function(_0x308d5a,_0x2a02c9,_0x43ba98){var _0x58bed7={};var _0x28047a={};var _0x1802eb;var _0x271fa0;return db[_0x1180('0x3d')][_0x1180('0x4b')]({'where':{'id':_0x308d5a['params']['id']}})['then'](handleEntityNotFound(_0x2a02c9,null))['then'](function(_0xdc3672){if(_0xdc3672){_0x1802eb=_0xdc3672;_0x28047a[_0x1180('0x31')]=_[_0x1180('0x45')](db[_0x1180('0x4c')][_0x1180('0x28')]);_0x28047a[_0x1180('0x2d')]=_[_0x1180('0x45')](_0x308d5a[_0x1180('0x2d')]);_0x28047a[_0x1180('0x2e')]=_[_0x1180('0x2f')](_0x28047a['model'],_0x28047a[_0x1180('0x2d')]);_0x58bed7[_0x1180('0x30')]=_[_0x1180('0x2f')](_0x28047a[_0x1180('0x31')],qs[_0x1180('0x32')](_0x308d5a[_0x1180('0x2d')]['fields']));_0x58bed7['attributes']=_0x58bed7[_0x1180('0x30')][_0x1180('0x33')]?_0x58bed7[_0x1180('0x30')]:_0x28047a['model'];_0x58bed7[_0x1180('0x36')]=qs[_0x1180('0x37')](_0x308d5a['query'][_0x1180('0x37')]);_0x58bed7[_0x1180('0x38')]=qs[_0x1180('0x2e')](_[_0x1180('0x4e')](_0x308d5a[_0x1180('0x2d')],_0x28047a[_0x1180('0x2e')]));if(_0x308d5a[_0x1180('0x2d')][_0x1180('0x39')]){_0x58bed7[_0x1180('0x38')]=_[_0x1180('0x3b')](_0x58bed7['where'],{'$or':_['map'](_0x58bed7[_0x1180('0x30')],function(_0x36b681){var _0x2da10e={};_0x2da10e[_0x36b681]={'$like':'%'+_0x308d5a[_0x1180('0x2d')]['filter']+'%'};return _0x2da10e;})});}_0x58bed7=_['merge']({},_0x58bed7,_0x308d5a[_0x1180('0x3c')]);return _0x1802eb[_0x1180('0x4f')](_0x58bed7);}})['then'](function(_0x85db63){if(_0x85db63){_0x271fa0=_0x85db63['length'];if(!_0x308d5a['query'][_0x1180('0x34')](_0x1180('0x50'))){_0x58bed7['limit']=qs[_0x1180('0x1b')](_0x308d5a[_0x1180('0x2d')][_0x1180('0x1b')]);_0x58bed7[_0x1180('0x35')]=qs[_0x1180('0x35')](_0x308d5a['query'][_0x1180('0x35')]);}return _0x1802eb[_0x1180('0x4f')](_0x58bed7);}})[_0x1180('0x23')](function(_0x32a17d){if(_0x32a17d){return _0x32a17d?{'count':_0x271fa0,'rows':_0x32a17d}:null;}})[_0x1180('0x23')](respondWithResult(_0x2a02c9,null))['catch'](handleError(_0x2a02c9,null));}; \ No newline at end of file +var _0x50dc=['key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','show','params','find','create','body','catch','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','FreshsalesConfiguration','rawAttributes','fieldName','type'];(function(_0x4d9bbb,_0x284069){var _0x55080e=function(_0x2c3435){while(--_0x2c3435){_0x4d9bbb['push'](_0x4d9bbb['shift']());}};_0x55080e(++_0x284069);}(_0x50dc,0x1a3));var _0xc50d=function(_0x42f104,_0x21f8a8){_0x42f104=_0x42f104-0x0;var _0x51c407=_0x50dc[_0x42f104];return _0x51c407;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc50d('0x0'));var zipdir=require(_0xc50d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc50d('0x2'));var moment=require(_0xc50d('0x3'));var BPromise=require(_0xc50d('0x4'));var Mustache=require(_0xc50d('0x5'));var util=require(_0xc50d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc50d('0x7'));var ejs=require(_0xc50d('0x8'));var fs=require('fs');var fs_extra=require(_0xc50d('0x9'));var _=require(_0xc50d('0xa'));var squel=require(_0xc50d('0xb'));var crypto=require(_0xc50d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc50d('0xd'));var toCsv=require(_0xc50d('0x7'));var querystring=require(_0xc50d('0xe'));var Papa=require(_0xc50d('0xf'));var Redis=require(_0xc50d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc50d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc50d('0x12'))('api');var utils=require(_0xc50d('0x13'));var config=require(_0xc50d('0x14'));var licenseUtil=require(_0xc50d('0x15'));var db=require(_0xc50d('0x16'))['db'];function respondWithStatusCode(_0x4905e2,_0x54c25f){_0x54c25f=_0x54c25f||0xcc;return function(_0x434036){if(_0x434036){return _0x4905e2[_0xc50d('0x17')](_0x54c25f);}return _0x4905e2[_0xc50d('0x18')](_0x54c25f)[_0xc50d('0x19')]();};}function respondWithResult(_0x19b58b,_0xe532a2){_0xe532a2=_0xe532a2||0xc8;return function(_0x3a7612){if(_0x3a7612){return _0x19b58b[_0xc50d('0x18')](_0xe532a2)['json'](_0x3a7612);}};}function respondWithFilteredResult(_0x1b9ed0,_0x2904e1){return function(_0x57a787){if(_0x57a787){var _0x5e2d81=typeof _0x2904e1[_0xc50d('0x1a')]==='undefined'&&typeof _0x2904e1['limit']===_0xc50d('0x1b');var _0x2f9e91=_0x57a787[_0xc50d('0x1c')];var _0x1b4f4e=_0x5e2d81?0x0:_0x2904e1[_0xc50d('0x1a')];var _0x5e8bee=_0x5e2d81?_0x57a787[_0xc50d('0x1c')]:_0x2904e1[_0xc50d('0x1a')]+_0x2904e1['limit'];var _0x4a5b67;if(_0x5e8bee>=_0x2f9e91){_0x5e8bee=_0x2f9e91;_0x4a5b67=0xc8;}else{_0x4a5b67=0xce;}_0x1b9ed0[_0xc50d('0x18')](_0x4a5b67);return _0x1b9ed0[_0xc50d('0x1d')](_0xc50d('0x1e'),_0x1b4f4e+'-'+_0x5e8bee+'/'+_0x2f9e91)['json'](_0x57a787);}return null;};}function patchUpdates(_0x596142){return function(_0x389bc){try{jsonpatch[_0xc50d('0x1f')](_0x389bc,_0x596142,!![]);}catch(_0x10cfe1){return BPromise['reject'](_0x10cfe1);}return _0x389bc[_0xc50d('0x20')]();};}function saveUpdates(_0x585344,_0x45b3e9){return function(_0x2bd246){if(_0x2bd246){return _0x2bd246[_0xc50d('0x21')](_0x585344)[_0xc50d('0x22')](function(_0x2fc5b3){return _0x2fc5b3;});}return null;};}function removeEntity(_0x288c1f,_0x9e7791){return function(_0x400ad1){if(_0x400ad1){return _0x400ad1[_0xc50d('0x23')]()['then'](function(){_0x288c1f['status'](0xcc)[_0xc50d('0x19')]();});}};}function handleEntityNotFound(_0x273079,_0x438af4){return function(_0x586a28){if(!_0x586a28){_0x273079[_0xc50d('0x17')](0x194);}return _0x586a28;};}function handleError(_0x10958a,_0xa1b11f){_0xa1b11f=_0xa1b11f||0x1f4;return function(_0x404c76){logger[_0xc50d('0x24')](_0x404c76['stack']);if(_0x404c76['name']){delete _0x404c76[_0xc50d('0x25')];}_0x10958a[_0xc50d('0x18')](_0xa1b11f)[_0xc50d('0x26')](_0x404c76);};}exports['index']=function(_0x1b61b5,_0x2c8c8e){var _0x312715={},_0x496cc7={},_0x4b91ca={'count':0x0,'rows':[]};var _0x4f7866=_['map'](db[_0xc50d('0x27')][_0xc50d('0x28')],function(_0x253a71){return{'name':_0x253a71[_0xc50d('0x29')],'type':_0x253a71[_0xc50d('0x2a')][_0xc50d('0x2b')]};});_0x496cc7['model']=_['map'](_0x4f7866,_0xc50d('0x25'));_0x496cc7['query']=_[_0xc50d('0x2c')](_0x1b61b5[_0xc50d('0x2d')]);_0x496cc7['filters']=_[_0xc50d('0x2e')](_0x496cc7[_0xc50d('0x2f')],_0x496cc7[_0xc50d('0x2d')]);_0x312715['attributes']=_[_0xc50d('0x2e')](_0x496cc7[_0xc50d('0x2f')],qs['fields'](_0x1b61b5['query'][_0xc50d('0x30')]));_0x312715[_0xc50d('0x31')]=_0x312715['attributes'][_0xc50d('0x32')]?_0x312715[_0xc50d('0x31')]:_0x496cc7[_0xc50d('0x2f')];if(!_0x1b61b5[_0xc50d('0x2d')][_0xc50d('0x33')](_0xc50d('0x34'))){_0x312715['limit']=qs[_0xc50d('0x35')](_0x1b61b5['query']['limit']);_0x312715[_0xc50d('0x1a')]=qs[_0xc50d('0x1a')](_0x1b61b5[_0xc50d('0x2d')][_0xc50d('0x1a')]);}_0x312715[_0xc50d('0x36')]=qs[_0xc50d('0x37')](_0x1b61b5['query'][_0xc50d('0x37')]);_0x312715[_0xc50d('0x38')]=qs[_0xc50d('0x39')](_[_0xc50d('0x3a')](_0x1b61b5[_0xc50d('0x2d')],_0x496cc7[_0xc50d('0x39')]),_0x4f7866);if(_0x1b61b5[_0xc50d('0x2d')][_0xc50d('0x3b')]){_0x312715[_0xc50d('0x38')]=_[_0xc50d('0x3c')](_0x312715[_0xc50d('0x38')],{'$or':_[_0xc50d('0x3d')](_0x4f7866,function(_0x3ff0f4){if(_0x3ff0f4['type']!=='VIRTUAL'){var _0x4c0e07={};_0x4c0e07[_0x3ff0f4[_0xc50d('0x25')]]={'$like':'%'+_0x1b61b5['query']['filter']+'%'};return _0x4c0e07;}})});}_0x312715=_['merge']({},_0x312715,_0x1b61b5[_0xc50d('0x3e')]);var _0x1b14ba={'where':_0x312715['where']};return db['FreshsalesConfiguration'][_0xc50d('0x1c')](_0x1b14ba)[_0xc50d('0x22')](function(_0x62c7f9){_0x4b91ca[_0xc50d('0x1c')]=_0x62c7f9;if(_0x1b61b5['query'][_0xc50d('0x3f')]){_0x312715[_0xc50d('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xc50d('0x41')](_0x312715);})[_0xc50d('0x22')](function(_0x5521f6){_0x4b91ca['rows']=_0x5521f6;return _0x4b91ca;})[_0xc50d('0x22')](respondWithFilteredResult(_0x2c8c8e,_0x312715))['catch'](handleError(_0x2c8c8e,null));};exports[_0xc50d('0x42')]=function(_0x19b36a,_0x530fa0){var _0x5059a1={'raw':![],'where':{'id':_0x19b36a[_0xc50d('0x43')]['id']}},_0xae32de={};_0xae32de['model']=_[_0xc50d('0x2c')](db['FreshsalesConfiguration']['rawAttributes']);_0xae32de[_0xc50d('0x2d')]=_[_0xc50d('0x2c')](_0x19b36a[_0xc50d('0x2d')]);_0xae32de[_0xc50d('0x39')]=_['intersection'](_0xae32de[_0xc50d('0x2f')],_0xae32de[_0xc50d('0x2d')]);_0x5059a1['attributes']=_[_0xc50d('0x2e')](_0xae32de[_0xc50d('0x2f')],qs[_0xc50d('0x30')](_0x19b36a[_0xc50d('0x2d')][_0xc50d('0x30')]));_0x5059a1[_0xc50d('0x31')]=_0x5059a1[_0xc50d('0x31')]['length']?_0x5059a1[_0xc50d('0x31')]:_0xae32de[_0xc50d('0x2f')];if(_0x19b36a[_0xc50d('0x2d')][_0xc50d('0x3f')]){_0x5059a1['include']=[{'all':!![]}];}_0x5059a1=_[_0xc50d('0x3c')]({},_0x5059a1,_0x19b36a[_0xc50d('0x3e')]);return db['FreshsalesConfiguration'][_0xc50d('0x44')](_0x5059a1)['then'](handleEntityNotFound(_0x530fa0,null))[_0xc50d('0x22')](respondWithResult(_0x530fa0,null))['catch'](handleError(_0x530fa0,null));};exports[_0xc50d('0x45')]=function(_0x113f95,_0x385c6f){return db['FreshsalesConfiguration'][_0xc50d('0x45')](_0x113f95[_0xc50d('0x46')],{})[_0xc50d('0x22')](respondWithResult(_0x385c6f,0xc9))['catch'](handleError(_0x385c6f,null));};exports[_0xc50d('0x21')]=function(_0x5c5514,_0x320a55){if(_0x5c5514[_0xc50d('0x46')]['id']){delete _0x5c5514['body']['id'];}return db[_0xc50d('0x27')][_0xc50d('0x44')]({'where':{'id':_0x5c5514['params']['id']}})[_0xc50d('0x22')](handleEntityNotFound(_0x320a55,null))['then'](saveUpdates(_0x5c5514[_0xc50d('0x46')],null))[_0xc50d('0x22')](respondWithResult(_0x320a55,null))['catch'](handleError(_0x320a55,null));};exports[_0xc50d('0x23')]=function(_0x105902,_0x2484a2){return db[_0xc50d('0x27')][_0xc50d('0x44')]({'where':{'id':_0x105902['params']['id']}})[_0xc50d('0x22')](handleEntityNotFound(_0x2484a2,null))[_0xc50d('0x22')](removeEntity(_0x2484a2,null))[_0xc50d('0x47')](handleError(_0x2484a2,null));};exports['getSubjects']=function(_0x50a8c3,_0x536013,_0x40a7e1){var _0x5af3a2={};var _0x584c5a={};var _0x396df3;var _0x8d1cca;return db[_0xc50d('0x27')][_0xc50d('0x48')]({'where':{'id':_0x50a8c3['params']['id']}})['then'](handleEntityNotFound(_0x536013,null))[_0xc50d('0x22')](function(_0x58b6d7){if(_0x58b6d7){_0x396df3=_0x58b6d7;_0x584c5a['model']=_['keys'](db[_0xc50d('0x49')]['rawAttributes']);_0x584c5a['query']=_['keys'](_0x50a8c3[_0xc50d('0x2d')]);_0x584c5a['filters']=_[_0xc50d('0x2e')](_0x584c5a[_0xc50d('0x2f')],_0x584c5a[_0xc50d('0x2d')]);_0x5af3a2['attributes']=_['intersection'](_0x584c5a[_0xc50d('0x2f')],qs['fields'](_0x50a8c3[_0xc50d('0x2d')]['fields']));_0x5af3a2[_0xc50d('0x31')]=_0x5af3a2[_0xc50d('0x31')][_0xc50d('0x32')]?_0x5af3a2['attributes']:_0x584c5a['model'];_0x5af3a2[_0xc50d('0x36')]=qs[_0xc50d('0x37')](_0x50a8c3['query'][_0xc50d('0x37')]);_0x5af3a2[_0xc50d('0x38')]=qs[_0xc50d('0x39')](_[_0xc50d('0x3a')](_0x50a8c3[_0xc50d('0x2d')],_0x584c5a[_0xc50d('0x39')]));if(_0x50a8c3[_0xc50d('0x2d')]['filter']){_0x5af3a2['where']=_[_0xc50d('0x3c')](_0x5af3a2[_0xc50d('0x38')],{'$or':_['map'](_0x5af3a2['attributes'],function(_0x287fcf){var _0x28313e={};_0x28313e[_0x287fcf]={'$like':'%'+_0x50a8c3['query']['filter']+'%'};return _0x28313e;})});}_0x5af3a2=_['merge']({},_0x5af3a2,_0x50a8c3[_0xc50d('0x3e')]);return _0x396df3[_0xc50d('0x4a')](_0x5af3a2);}})[_0xc50d('0x22')](function(_0x454319){if(_0x454319){_0x8d1cca=_0x454319[_0xc50d('0x32')];if(!_0x50a8c3['query'][_0xc50d('0x33')](_0xc50d('0x34'))){_0x5af3a2['limit']=qs[_0xc50d('0x35')](_0x50a8c3['query'][_0xc50d('0x35')]);_0x5af3a2[_0xc50d('0x1a')]=qs[_0xc50d('0x1a')](_0x50a8c3[_0xc50d('0x2d')][_0xc50d('0x1a')]);}return _0x396df3[_0xc50d('0x4a')](_0x5af3a2);}})[_0xc50d('0x22')](function(_0x49d6dc){if(_0x49d6dc){return _0x49d6dc?{'count':_0x8d1cca,'rows':_0x49d6dc}:null;}})['then'](respondWithResult(_0x536013,null))[_0xc50d('0x47')](handleError(_0x536013,null));};exports[_0xc50d('0x4b')]=function(_0x1374b0,_0xa41f8d,_0x47582f){var _0x186fc7={};var _0x2d2fe0={};var _0x13123c;var _0x41d350;return db[_0xc50d('0x27')][_0xc50d('0x48')]({'where':{'id':_0x1374b0[_0xc50d('0x43')]['id']}})['then'](handleEntityNotFound(_0xa41f8d,null))[_0xc50d('0x22')](function(_0x224b89){if(_0x224b89){_0x13123c=_0x224b89;_0x2d2fe0[_0xc50d('0x2f')]=_[_0xc50d('0x2c')](db[_0xc50d('0x49')]['rawAttributes']);_0x2d2fe0[_0xc50d('0x2d')]=_[_0xc50d('0x2c')](_0x1374b0[_0xc50d('0x2d')]);_0x2d2fe0[_0xc50d('0x39')]=_['intersection'](_0x2d2fe0[_0xc50d('0x2f')],_0x2d2fe0[_0xc50d('0x2d')]);_0x186fc7['attributes']=_[_0xc50d('0x2e')](_0x2d2fe0[_0xc50d('0x2f')],qs['fields'](_0x1374b0['query'][_0xc50d('0x30')]));_0x186fc7[_0xc50d('0x31')]=_0x186fc7[_0xc50d('0x31')][_0xc50d('0x32')]?_0x186fc7[_0xc50d('0x31')]:_0x2d2fe0[_0xc50d('0x2f')];_0x186fc7[_0xc50d('0x36')]=qs[_0xc50d('0x37')](_0x1374b0[_0xc50d('0x2d')][_0xc50d('0x37')]);_0x186fc7[_0xc50d('0x38')]=qs[_0xc50d('0x39')](_[_0xc50d('0x3a')](_0x1374b0[_0xc50d('0x2d')],_0x2d2fe0[_0xc50d('0x39')]));if(_0x1374b0[_0xc50d('0x2d')]['filter']){_0x186fc7['where']=_[_0xc50d('0x3c')](_0x186fc7['where'],{'$or':_[_0xc50d('0x3d')](_0x186fc7[_0xc50d('0x31')],function(_0x376233){var _0x2de615={};_0x2de615[_0x376233]={'$like':'%'+_0x1374b0[_0xc50d('0x2d')]['filter']+'%'};return _0x2de615;})});}_0x186fc7=_[_0xc50d('0x3c')]({},_0x186fc7,_0x1374b0[_0xc50d('0x3e')]);return _0x13123c[_0xc50d('0x4b')](_0x186fc7);}})[_0xc50d('0x22')](function(_0x40d962){if(_0x40d962){_0x41d350=_0x40d962[_0xc50d('0x32')];if(!_0x1374b0[_0xc50d('0x2d')]['hasOwnProperty']('nolimit')){_0x186fc7['limit']=qs[_0xc50d('0x35')](_0x1374b0[_0xc50d('0x2d')][_0xc50d('0x35')]);_0x186fc7[_0xc50d('0x1a')]=qs[_0xc50d('0x1a')](_0x1374b0[_0xc50d('0x2d')][_0xc50d('0x1a')]);}return _0x13123c[_0xc50d('0x4b')](_0x186fc7);}})[_0xc50d('0x22')](function(_0x2211a7){if(_0x2211a7){return _0x2211a7?{'count':_0x41d350,'rows':_0x2211a7}:null;}})[_0xc50d('0x22')](respondWithResult(_0xa41f8d,null))[_0xc50d('0x47')](handleError(_0xa41f8d,null));};exports[_0xc50d('0x4c')]=function(_0x39ae79,_0x52bed5,_0x4b4302){var _0x16417c={};var _0x1ecc5b={};var _0x476b4c;var _0x1dd633;return db[_0xc50d('0x27')][_0xc50d('0x48')]({'where':{'id':_0x39ae79[_0xc50d('0x43')]['id']}})[_0xc50d('0x22')](handleEntityNotFound(_0x52bed5,null))[_0xc50d('0x22')](function(_0x1633a3){if(_0x1633a3){_0x476b4c=_0x1633a3;_0x1ecc5b[_0xc50d('0x2f')]=_[_0xc50d('0x2c')](db['FreshsalesField']['rawAttributes']);_0x1ecc5b[_0xc50d('0x2d')]=_[_0xc50d('0x2c')](_0x39ae79['query']);_0x1ecc5b['filters']=_[_0xc50d('0x2e')](_0x1ecc5b[_0xc50d('0x2f')],_0x1ecc5b[_0xc50d('0x2d')]);_0x16417c[_0xc50d('0x31')]=_[_0xc50d('0x2e')](_0x1ecc5b[_0xc50d('0x2f')],qs['fields'](_0x39ae79['query'][_0xc50d('0x30')]));_0x16417c[_0xc50d('0x31')]=_0x16417c[_0xc50d('0x31')][_0xc50d('0x32')]?_0x16417c[_0xc50d('0x31')]:_0x1ecc5b[_0xc50d('0x2f')];_0x16417c[_0xc50d('0x36')]=qs[_0xc50d('0x37')](_0x39ae79[_0xc50d('0x2d')][_0xc50d('0x37')]);_0x16417c[_0xc50d('0x38')]=qs[_0xc50d('0x39')](_[_0xc50d('0x3a')](_0x39ae79['query'],_0x1ecc5b[_0xc50d('0x39')]));if(_0x39ae79[_0xc50d('0x2d')][_0xc50d('0x3b')]){_0x16417c[_0xc50d('0x38')]=_[_0xc50d('0x3c')](_0x16417c[_0xc50d('0x38')],{'$or':_[_0xc50d('0x3d')](_0x16417c['attributes'],function(_0x491320){var _0x5740f3={};_0x5740f3[_0x491320]={'$like':'%'+_0x39ae79[_0xc50d('0x2d')]['filter']+'%'};return _0x5740f3;})});}_0x16417c=_[_0xc50d('0x3c')]({},_0x16417c,_0x39ae79[_0xc50d('0x3e')]);return _0x476b4c[_0xc50d('0x4c')](_0x16417c);}})[_0xc50d('0x22')](function(_0x1a4447){if(_0x1a4447){_0x1dd633=_0x1a4447[_0xc50d('0x32')];if(!_0x39ae79[_0xc50d('0x2d')][_0xc50d('0x33')]('nolimit')){_0x16417c[_0xc50d('0x35')]=qs[_0xc50d('0x35')](_0x39ae79['query'][_0xc50d('0x35')]);_0x16417c[_0xc50d('0x1a')]=qs[_0xc50d('0x1a')](_0x39ae79[_0xc50d('0x2d')][_0xc50d('0x1a')]);}return _0x476b4c[_0xc50d('0x4c')](_0x16417c);}})['then'](function(_0x1aef26){if(_0x1aef26){return _0x1aef26?{'count':_0x1dd633,'rows':_0x1aef26}:null;}})['then'](respondWithResult(_0x52bed5,null))['catch'](handleError(_0x52bed5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 140bb83..5c5b4ed 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 _0xbef3=['rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','request-promise','path'];(function(_0xc76ffd,_0xd30e6){var _0x443aac=function(_0x7921b6){while(--_0x7921b6){_0xc76ffd['push'](_0xc76ffd['shift']());}};_0x443aac(++_0xd30e6);}(_0xbef3,0x127));var _0x3bef=function(_0x27dc21,_0x52a6f4){_0x27dc21=_0x27dc21-0x0;var _0x146a14=_0xbef3[_0x27dc21];return _0x146a14;};'use strict';var _=require(_0x3bef('0x0'));var util=require(_0x3bef('0x1'));var logger=require(_0x3bef('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3bef('0x3'));var fs=require('fs');var path=require(_0x3bef('0x4'));var rimraf=require(_0x3bef('0x5'));var config=require('../../config/environment');var attributes=require(_0x3bef('0x6'));module[_0x3bef('0x7')]=function(_0xf5d5ff,_0x41ea6d){return _0xf5d5ff[_0x3bef('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x3bef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb346=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x1461e2,_0x3db7f7){var _0x3ab23e=function(_0x4911f6){while(--_0x4911f6){_0x1461e2['push'](_0x1461e2['shift']());}};_0x3ab23e(++_0x3db7f7);}(_0xb346,0x180));var _0x6b34=function(_0x4aa73c,_0x1d3473){_0x4aa73c=_0x4aa73c-0x0;var _0x34ab43=_0xb346[_0x4aa73c];return _0x34ab43;};'use strict';var _=require(_0x6b34('0x0'));var util=require(_0x6b34('0x1'));var logger=require('../../config/logger')(_0x6b34('0x2'));var moment=require(_0x6b34('0x3'));var BPromise=require(_0x6b34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b34('0x5'));var rimraf=require(_0x6b34('0x6'));var config=require(_0x6b34('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x6b34('0x8')]=function(_0x368d23,_0x20e172){return _0x368d23['define'](_0x6b34('0x9'),attributes,{'tableName':_0x6b34('0xa'),'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 fe522f1..7e90bd6 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 _0xfd10=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xfd10,0x155));var _0x0fd1=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xfd10[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x0fd1('0x0'));var util=require('util');var moment=require(_0x0fd1('0x1'));var BPromise=require(_0x0fd1('0x2'));var rs=require(_0x0fd1('0x3'));var fs=require('fs');var Redis=require(_0x0fd1('0x4'));var db=require(_0x0fd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fd1('0x6'))('rpc');var config=require(_0x0fd1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fd1('0x8')][_0x0fd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c6dae,_0x5a6a6f,_0x3c8b11){return new BPromise(function(_0x3364d6,_0x452fa0){return client[_0x0fd1('0xa')](_0x5c6dae,_0x3c8b11)[_0x0fd1('0xb')](function(_0x354fc8){logger[_0x0fd1('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a6a6f,_0x0fd1('0xd'));logger[_0x0fd1('0xe')](_0x0fd1('0xf'),_0x5a6a6f,_0x0fd1('0xd'),JSON[_0x0fd1('0x10')](_0x354fc8));if(_0x354fc8[_0x0fd1('0x11')]){if(_0x354fc8['error'][_0x0fd1('0x12')]===0x1f4){logger[_0x0fd1('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a6a6f,_0x354fc8[_0x0fd1('0x11')]['message']);return _0x452fa0(_0x354fc8[_0x0fd1('0x11')][_0x0fd1('0x13')]);}logger[_0x0fd1('0x11')](_0x0fd1('0x14'),_0x5a6a6f,_0x354fc8[_0x0fd1('0x11')]['message']);return _0x3364d6(_0x354fc8[_0x0fd1('0x11')]['message']);}else{logger[_0x0fd1('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a6a6f,_0x0fd1('0xd'));_0x3364d6(_0x354fc8[_0x0fd1('0x15')]['message']);}})[_0x0fd1('0x16')](function(_0x54972a){logger['error'](_0x0fd1('0x14'),_0x5a6a6f,_0x54972a);_0x452fa0(_0x54972a);});});} \ No newline at end of file +var _0x597c=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3ccdf5,_0x3c3d1a){var _0xa6f7e9=function(_0x4ea164){while(--_0x4ea164){_0x3ccdf5['push'](_0x3ccdf5['shift']());}};_0xa6f7e9(++_0x3c3d1a);}(_0x597c,0x1ce));var _0xc597=function(_0x51a9b7,_0x5ce85a){_0x51a9b7=_0x51a9b7-0x0;var _0x4e8e07=_0x597c[_0x51a9b7];return _0x4e8e07;};'use strict';var _=require(_0xc597('0x0'));var util=require(_0xc597('0x1'));var moment=require(_0xc597('0x2'));var BPromise=require(_0xc597('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc597('0x4'));var logger=require(_0xc597('0x5'))('rpc');var config=require(_0xc597('0x6'));var jayson=require(_0xc597('0x7'));var client=jayson[_0xc597('0x8')][_0xc597('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e3e4,_0x4036ff,_0x348d27){return new BPromise(function(_0x1a763a,_0x57539b){return client[_0xc597('0xa')](_0x33e3e4,_0x348d27)[_0xc597('0xb')](function(_0x260965){logger[_0xc597('0xc')](_0xc597('0xd'),_0x4036ff,_0xc597('0xe'));logger[_0xc597('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4036ff,_0xc597('0xe'),JSON[_0xc597('0x10')](_0x260965));if(_0x260965[_0xc597('0x11')]){if(_0x260965[_0xc597('0x11')][_0xc597('0x12')]===0x1f4){logger['error'](_0xc597('0xd'),_0x4036ff,_0x260965[_0xc597('0x11')]['message']);return _0x57539b(_0x260965['error']['message']);}logger['error'](_0xc597('0xd'),_0x4036ff,_0x260965[_0xc597('0x11')][_0xc597('0x13')]);return _0x1a763a(_0x260965['error']['message']);}else{logger['info'](_0xc597('0xd'),_0x4036ff,_0xc597('0xe'));_0x1a763a(_0x260965[_0xc597('0x14')][_0xc597('0x13')]);}})['catch'](function(_0x3f6a17){logger[_0xc597('0x11')](_0xc597('0xd'),_0x4036ff,_0x3f6a17);_0x57539b(_0x3f6a17);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 1a5f3aa..2f8d81c 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 _0x295f=['path','connect-timeout','Router','fs-extra','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x295f,0x168));var _0xf295=function(_0xd5150,_0x116a5f){_0xd5150=_0xd5150-0x0;var _0xfff381=_0x295f[_0xd5150];return _0xfff381;};'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('0xc')]('/',auth[_0xf295('0x8')](),controller[_0xf295('0xd')]);router[_0xf295('0xe')](_0xf295('0xa'),auth[_0xf295('0x8')](),controller[_0xf295('0xf')]);router[_0xf295('0x10')](_0xf295('0xa'),auth['isAuthenticated'](),controller[_0xf295('0x11')]);module[_0xf295('0x12')]=router; \ No newline at end of file +var _0x35aa=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x5a34ae,_0x5682d8){var _0x2841d7=function(_0x2ef934){while(--_0x2ef934){_0x5a34ae['push'](_0x5a34ae['shift']());}};_0x2841d7(++_0x5682d8);}(_0x35aa,0xbe));var _0xa35a=function(_0x48168a,_0xf9dfe5){_0x48168a=_0x48168a-0x0;var _0x346d98=_0x35aa[_0x48168a];return _0x346d98;};'use strict';var multer=require('multer');var util=require(_0xa35a('0x0'));var path=require(_0xa35a('0x1'));var timeout=require(_0xa35a('0x2'));var express=require(_0xa35a('0x3'));var router=express['Router']();var fs_extra=require(_0xa35a('0x4'));var auth=require(_0xa35a('0x5'));var interaction=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var controller=require(_0xa35a('0x8'));router[_0xa35a('0x9')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xb')]);router['get'](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0xd')]);router[_0xa35a('0xe')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xf')]);router[_0xa35a('0x10')](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0x11')]);router[_0xa35a('0x12')](_0xa35a('0xc'),auth[_0xa35a('0xa')](),controller['destroy']);module[_0xa35a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index aecf624..5ee2c15 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 _0x22b7=['string','customVariable','picklist','STRING','BOOLEAN','ENUM'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x22b7,0x11f));var _0x722b=function(_0x21b57f,_0x9ba5fb){_0x21b57f=_0x21b57f-0x0;var _0x3dac6f=_0x22b7[_0x21b57f];return _0x3dac6f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x722b('0x0')](_0x722b('0x1'),'variable',_0x722b('0x2'),'keyValue',_0x722b('0x3')),'defaultValue':_0x722b('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x722b('0x4')]},'keyType':{'type':Sequelize[_0x722b('0x0')](_0x722b('0x1'),'variable',_0x722b('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x722b('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x722b('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x06af=['exports','ENUM','customVariable','keyValue','STRING','sequelize'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0x06af,0x10d));var _0xf06a=function(_0x5c80eb,_0x46c063){_0x5c80eb=_0x5c80eb-0x0;var _0x89686c=_0x06af[_0x5c80eb];return _0x89686c;};'use strict';var Sequelize=require(_0xf06a('0x0'));module[_0xf06a('0x1')]={'type':{'type':Sequelize[_0xf06a('0x2')]('string','variable',_0xf06a('0x3'),_0xf06a('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xf06a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf06a('0x5')]},'nameField':{'type':Sequelize[_0xf06a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf06a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b8bcfdb..304d567 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 _0x3c1e=['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','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','rimraf','bluebird','mustache','path','sox','ejs'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x3c1e,0x1b0));var _0xe3c1=function(_0x2f41c6,_0x119aa2){_0x2f41c6=_0x2f41c6-0x0;var _0xf4502b=_0x3c1e[_0x2f41c6];return _0xf4502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3c1('0x1'));var Mustache=require(_0xe3c1('0x2'));var util=require('util');var path=require(_0xe3c1('0x3'));var sox=require(_0xe3c1('0x4'));var csv=require('to-csv');var ejs=require(_0xe3c1('0x5'));var fs=require('fs');var fs_extra=require(_0xe3c1('0x6'));var _=require(_0xe3c1('0x7'));var squel=require(_0xe3c1('0x8'));var crypto=require(_0xe3c1('0x9'));var jsforce=require(_0xe3c1('0xa'));var deskjs=require(_0xe3c1('0xb'));var toCsv=require(_0xe3c1('0xc'));var querystring=require(_0xe3c1('0xd'));var Papa=require(_0xe3c1('0xe'));var Redis=require('ioredis');var authService=require(_0xe3c1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe3c1('0x10'));var hardwareService=require(_0xe3c1('0x11'));var logger=require(_0xe3c1('0x12'))(_0xe3c1('0x13'));var utils=require(_0xe3c1('0x14'));var config=require(_0xe3c1('0x15'));var licenseUtil=require(_0xe3c1('0x16'));var db=require(_0xe3c1('0x17'))['db'];function respondWithStatusCode(_0x445ae0,_0x2493b2){_0x2493b2=_0x2493b2||0xcc;return function(_0x4e2f03){if(_0x4e2f03){return _0x445ae0[_0xe3c1('0x18')](_0x2493b2);}return _0x445ae0[_0xe3c1('0x19')](_0x2493b2)[_0xe3c1('0x1a')]();};}function respondWithResult(_0x3ddc5f,_0x407e0c){_0x407e0c=_0x407e0c||0xc8;return function(_0x4dec1b){if(_0x4dec1b){return _0x3ddc5f[_0xe3c1('0x19')](_0x407e0c)['json'](_0x4dec1b);}};}function respondWithFilteredResult(_0x54eccd,_0x28d4cb){return function(_0x1dad16){if(_0x1dad16){var _0x5fcdb8=typeof _0x28d4cb[_0xe3c1('0x1b')]===_0xe3c1('0x1c')&&typeof _0x28d4cb[_0xe3c1('0x1d')]===_0xe3c1('0x1c');var _0x5878a8=_0x1dad16['count'];var _0x5c4823=_0x5fcdb8?0x0:_0x28d4cb[_0xe3c1('0x1b')];var _0x287f93=_0x5fcdb8?_0x1dad16[_0xe3c1('0x1e')]:_0x28d4cb['offset']+_0x28d4cb[_0xe3c1('0x1d')];var _0x394a40;if(_0x287f93>=_0x5878a8){_0x287f93=_0x5878a8;_0x394a40=0xc8;}else{_0x394a40=0xce;}_0x54eccd[_0xe3c1('0x19')](_0x394a40);return _0x54eccd[_0xe3c1('0x1f')]('Content-Range',_0x5c4823+'-'+_0x287f93+'/'+_0x5878a8)['json'](_0x1dad16);}return null;};}function patchUpdates(_0x14ba74){return function(_0x593afa){try{jsonpatch[_0xe3c1('0x20')](_0x593afa,_0x14ba74,!![]);}catch(_0x43edfa){return BPromise['reject'](_0x43edfa);}return _0x593afa[_0xe3c1('0x21')]();};}function saveUpdates(_0xedc82b,_0x424bca){return function(_0x3b6b08){if(_0x3b6b08){return _0x3b6b08['update'](_0xedc82b)[_0xe3c1('0x22')](function(_0x4618a2){return _0x4618a2;});}return null;};}function removeEntity(_0x565f03,_0x314b08){return function(_0xd75789){if(_0xd75789){return _0xd75789[_0xe3c1('0x23')]()[_0xe3c1('0x22')](function(){_0x565f03[_0xe3c1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f06d,_0x4aece2){return function(_0x405721){if(!_0x405721){_0x29f06d[_0xe3c1('0x18')](0x194);}return _0x405721;};}function handleError(_0x4095a3,_0x1b2ffc){_0x1b2ffc=_0x1b2ffc||0x1f4;return function(_0xa6e7ec){logger[_0xe3c1('0x24')](_0xa6e7ec[_0xe3c1('0x25')]);if(_0xa6e7ec[_0xe3c1('0x26')]){delete _0xa6e7ec[_0xe3c1('0x26')];}_0x4095a3['status'](_0x1b2ffc)[_0xe3c1('0x27')](_0xa6e7ec);};}exports[_0xe3c1('0x28')]=function(_0x44af26,_0x38b610){var _0x47339a={},_0x1dcd1e={},_0x140b04={'count':0x0,'rows':[]};var _0x546e79=_[_0xe3c1('0x29')](db[_0xe3c1('0x2a')][_0xe3c1('0x2b')],function(_0x453abb){return{'name':_0x453abb[_0xe3c1('0x2c')],'type':_0x453abb[_0xe3c1('0x2d')][_0xe3c1('0x2e')]};});_0x1dcd1e[_0xe3c1('0x2f')]=_[_0xe3c1('0x29')](_0x546e79,_0xe3c1('0x26'));_0x1dcd1e[_0xe3c1('0x30')]=_[_0xe3c1('0x31')](_0x44af26[_0xe3c1('0x30')]);_0x1dcd1e[_0xe3c1('0x32')]=_[_0xe3c1('0x33')](_0x1dcd1e[_0xe3c1('0x2f')],_0x1dcd1e[_0xe3c1('0x30')]);_0x47339a[_0xe3c1('0x34')]=_[_0xe3c1('0x33')](_0x1dcd1e[_0xe3c1('0x2f')],qs[_0xe3c1('0x35')](_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x35')]));_0x47339a[_0xe3c1('0x34')]=_0x47339a[_0xe3c1('0x34')]['length']?_0x47339a[_0xe3c1('0x34')]:_0x1dcd1e['model'];if(!_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x36')](_0xe3c1('0x37'))){_0x47339a['limit']=qs[_0xe3c1('0x1d')](_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x1d')]);_0x47339a[_0xe3c1('0x1b')]=qs[_0xe3c1('0x1b')](_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x1b')]);}_0x47339a['order']=qs['sort'](_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x38')]);_0x47339a['where']=qs['filters'](_[_0xe3c1('0x39')](_0x44af26[_0xe3c1('0x30')],_0x1dcd1e['filters']),_0x546e79);if(_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x3a')]){_0x47339a['where']=_[_0xe3c1('0x3b')](_0x47339a[_0xe3c1('0x3c')],{'$or':_[_0xe3c1('0x29')](_0x546e79,function(_0x43ec46){if(_0x43ec46[_0xe3c1('0x2d')]!==_0xe3c1('0x3d')){var _0x445772={};_0x445772[_0x43ec46[_0xe3c1('0x26')]]={'$like':'%'+_0x44af26['query']['filter']+'%'};return _0x445772;}})});}_0x47339a=_['merge']({},_0x47339a,_0x44af26[_0xe3c1('0x3e')]);var _0x454343={'where':_0x47339a['where']};return db[_0xe3c1('0x2a')][_0xe3c1('0x1e')](_0x454343)[_0xe3c1('0x22')](function(_0x17b70d){_0x140b04['count']=_0x17b70d;if(_0x44af26[_0xe3c1('0x30')][_0xe3c1('0x3f')]){_0x47339a[_0xe3c1('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0xe3c1('0x41')](_0x47339a);})[_0xe3c1('0x22')](function(_0x2d8632){_0x140b04['rows']=_0x2d8632;return _0x140b04;})[_0xe3c1('0x22')](respondWithFilteredResult(_0x38b610,_0x47339a))[_0xe3c1('0x42')](handleError(_0x38b610,null));};exports[_0xe3c1('0x43')]=function(_0x2d8ec8,_0x40302f){var _0x32f993={'raw':!![],'where':{'id':_0x2d8ec8[_0xe3c1('0x44')]['id']}},_0x48d874={};_0x48d874['model']=_[_0xe3c1('0x31')](db[_0xe3c1('0x2a')][_0xe3c1('0x2b')]);_0x48d874[_0xe3c1('0x30')]=_['keys'](_0x2d8ec8[_0xe3c1('0x30')]);_0x48d874[_0xe3c1('0x32')]=_[_0xe3c1('0x33')](_0x48d874[_0xe3c1('0x2f')],_0x48d874[_0xe3c1('0x30')]);_0x32f993[_0xe3c1('0x34')]=_[_0xe3c1('0x33')](_0x48d874[_0xe3c1('0x2f')],qs[_0xe3c1('0x35')](_0x2d8ec8[_0xe3c1('0x30')][_0xe3c1('0x35')]));_0x32f993['attributes']=_0x32f993['attributes'][_0xe3c1('0x45')]?_0x32f993['attributes']:_0x48d874['model'];if(_0x2d8ec8[_0xe3c1('0x30')][_0xe3c1('0x3f')]){_0x32f993[_0xe3c1('0x40')]=[{'all':!![]}];}_0x32f993=_[_0xe3c1('0x3b')]({},_0x32f993,_0x2d8ec8['options']);return db[_0xe3c1('0x2a')][_0xe3c1('0x46')](_0x32f993)[_0xe3c1('0x22')](handleEntityNotFound(_0x40302f,null))[_0xe3c1('0x22')](respondWithResult(_0x40302f,null))[_0xe3c1('0x42')](handleError(_0x40302f,null));};exports['create']=function(_0x5592bb,_0x258380){return db[_0xe3c1('0x2a')][_0xe3c1('0x47')](_0x5592bb[_0xe3c1('0x48')],{})[_0xe3c1('0x22')](respondWithResult(_0x258380,0xc9))[_0xe3c1('0x42')](handleError(_0x258380,null));};exports['update']=function(_0x5cba18,_0x598d57){if(_0x5cba18[_0xe3c1('0x48')]['id']){delete _0x5cba18[_0xe3c1('0x48')]['id'];}return db['FreshsalesField'][_0xe3c1('0x46')]({'where':{'id':_0x5cba18[_0xe3c1('0x44')]['id']}})[_0xe3c1('0x22')](handleEntityNotFound(_0x598d57,null))[_0xe3c1('0x22')](saveUpdates(_0x5cba18['body'],null))[_0xe3c1('0x22')](respondWithResult(_0x598d57,null))[_0xe3c1('0x42')](handleError(_0x598d57,null));};exports[_0xe3c1('0x23')]=function(_0x29b682,_0x3b1003){return db['FreshsalesField'][_0xe3c1('0x46')]({'where':{'id':_0x29b682[_0xe3c1('0x44')]['id']}})[_0xe3c1('0x22')](handleEntityNotFound(_0x3b1003,null))['then'](removeEntity(_0x3b1003,null))[_0xe3c1('0x42')](handleError(_0x3b1003,null));}; \ No newline at end of file +var _0x44ad=['status','offset','undefined','limit','json','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','filter','merge','options','count','includeAll','include','rows','show','keys','rawAttributes','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0xe1fcfb,_0x24fcee){var _0x21528f=function(_0x1ca0bf){while(--_0x1ca0bf){_0xe1fcfb['push'](_0xe1fcfb['shift']());}};_0x21528f(++_0x24fcee);}(_0x44ad,0x1d8));var _0xd44a=function(_0x287f3c,_0x1b7746){_0x287f3c=_0x287f3c-0x0;var _0x16af7b=_0x44ad[_0x287f3c];return _0x16af7b;};'use strict';var emlformat=require(_0xd44a('0x0'));var rimraf=require(_0xd44a('0x1'));var zipdir=require(_0xd44a('0x2'));var jsonpatch=require(_0xd44a('0x3'));var rp=require('request-promise');var moment=require(_0xd44a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd44a('0x5'));var util=require(_0xd44a('0x6'));var path=require(_0xd44a('0x7'));var sox=require(_0xd44a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd44a('0x9'));var _=require(_0xd44a('0xa'));var squel=require(_0xd44a('0xb'));var crypto=require(_0xd44a('0xc'));var jsforce=require(_0xd44a('0xd'));var deskjs=require(_0xd44a('0xe'));var toCsv=require(_0xd44a('0xf'));var querystring=require(_0xd44a('0x10'));var Papa=require('papaparse');var Redis=require(_0xd44a('0x11'));var authService=require(_0xd44a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd44a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd44a('0x14'))('api');var utils=require(_0xd44a('0x15'));var config=require(_0xd44a('0x16'));var licenseUtil=require(_0xd44a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f10a9,_0x4b55cb){_0x4b55cb=_0x4b55cb||0xcc;return function(_0xf9bc27){if(_0xf9bc27){return _0x5f10a9[_0xd44a('0x18')](_0x4b55cb);}return _0x5f10a9[_0xd44a('0x19')](_0x4b55cb)['end']();};}function respondWithResult(_0x3b915e,_0x1209cd){_0x1209cd=_0x1209cd||0xc8;return function(_0x4fd1ac){if(_0x4fd1ac){return _0x3b915e[_0xd44a('0x19')](_0x1209cd)['json'](_0x4fd1ac);}};}function respondWithFilteredResult(_0x457824,_0x2e2b23){return function(_0x53e54c){if(_0x53e54c){var _0x930795=typeof _0x2e2b23[_0xd44a('0x1a')]===_0xd44a('0x1b')&&typeof _0x2e2b23[_0xd44a('0x1c')]==='undefined';var _0x38d09f=_0x53e54c['count'];var _0x230a5b=_0x930795?0x0:_0x2e2b23[_0xd44a('0x1a')];var _0x524ace=_0x930795?_0x53e54c['count']:_0x2e2b23[_0xd44a('0x1a')]+_0x2e2b23[_0xd44a('0x1c')];var _0xbe0d32;if(_0x524ace>=_0x38d09f){_0x524ace=_0x38d09f;_0xbe0d32=0xc8;}else{_0xbe0d32=0xce;}_0x457824[_0xd44a('0x19')](_0xbe0d32);return _0x457824['set']('Content-Range',_0x230a5b+'-'+_0x524ace+'/'+_0x38d09f)[_0xd44a('0x1d')](_0x53e54c);}return null;};}function patchUpdates(_0x56ce69){return function(_0x3a70c7){try{jsonpatch['apply'](_0x3a70c7,_0x56ce69,!![]);}catch(_0x2a05c){return BPromise[_0xd44a('0x1e')](_0x2a05c);}return _0x3a70c7['save']();};}function saveUpdates(_0x3f0bee,_0x5e883d){return function(_0x29ce5d){if(_0x29ce5d){return _0x29ce5d[_0xd44a('0x1f')](_0x3f0bee)[_0xd44a('0x20')](function(_0x38d7f9){return _0x38d7f9;});}return null;};}function removeEntity(_0x6903ac,_0x532acc){return function(_0x334ae0){if(_0x334ae0){return _0x334ae0[_0xd44a('0x21')]()[_0xd44a('0x20')](function(){_0x6903ac[_0xd44a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39165c,_0x123292){return function(_0x42e18b){if(!_0x42e18b){_0x39165c[_0xd44a('0x18')](0x194);}return _0x42e18b;};}function handleError(_0x4b2db8,_0x4e7be9){_0x4e7be9=_0x4e7be9||0x1f4;return function(_0x5a07b3){logger[_0xd44a('0x22')](_0x5a07b3[_0xd44a('0x23')]);if(_0x5a07b3['name']){delete _0x5a07b3[_0xd44a('0x24')];}_0x4b2db8[_0xd44a('0x19')](_0x4e7be9)[_0xd44a('0x25')](_0x5a07b3);};}exports[_0xd44a('0x26')]=function(_0x3af757,_0x5d78e8){var _0x43b7a2={},_0x3cdbc4={},_0x32d8c3={'count':0x0,'rows':[]};var _0x2be5f1=_[_0xd44a('0x27')](db[_0xd44a('0x28')]['rawAttributes'],function(_0xf223e1){return{'name':_0xf223e1[_0xd44a('0x29')],'type':_0xf223e1[_0xd44a('0x2a')][_0xd44a('0x2b')]};});_0x3cdbc4[_0xd44a('0x2c')]=_['map'](_0x2be5f1,_0xd44a('0x24'));_0x3cdbc4[_0xd44a('0x2d')]=_['keys'](_0x3af757[_0xd44a('0x2d')]);_0x3cdbc4[_0xd44a('0x2e')]=_[_0xd44a('0x2f')](_0x3cdbc4[_0xd44a('0x2c')],_0x3cdbc4[_0xd44a('0x2d')]);_0x43b7a2[_0xd44a('0x30')]=_[_0xd44a('0x2f')](_0x3cdbc4[_0xd44a('0x2c')],qs[_0xd44a('0x31')](_0x3af757['query']['fields']));_0x43b7a2[_0xd44a('0x30')]=_0x43b7a2[_0xd44a('0x30')]['length']?_0x43b7a2[_0xd44a('0x30')]:_0x3cdbc4[_0xd44a('0x2c')];if(!_0x3af757[_0xd44a('0x2d')]['hasOwnProperty'](_0xd44a('0x32'))){_0x43b7a2[_0xd44a('0x1c')]=qs[_0xd44a('0x1c')](_0x3af757[_0xd44a('0x2d')][_0xd44a('0x1c')]);_0x43b7a2[_0xd44a('0x1a')]=qs[_0xd44a('0x1a')](_0x3af757['query'][_0xd44a('0x1a')]);}_0x43b7a2[_0xd44a('0x33')]=qs['sort'](_0x3af757[_0xd44a('0x2d')][_0xd44a('0x34')]);_0x43b7a2['where']=qs[_0xd44a('0x2e')](_[_0xd44a('0x35')](_0x3af757['query'],_0x3cdbc4[_0xd44a('0x2e')]),_0x2be5f1);if(_0x3af757[_0xd44a('0x2d')]['filter']){_0x43b7a2[_0xd44a('0x36')]=_['merge'](_0x43b7a2['where'],{'$or':_['map'](_0x2be5f1,function(_0x1f6831){if(_0x1f6831[_0xd44a('0x2a')]!=='VIRTUAL'){var _0xc21d70={};_0xc21d70[_0x1f6831[_0xd44a('0x24')]]={'$like':'%'+_0x3af757['query'][_0xd44a('0x37')]+'%'};return _0xc21d70;}})});}_0x43b7a2=_[_0xd44a('0x38')]({},_0x43b7a2,_0x3af757[_0xd44a('0x39')]);var _0x555180={'where':_0x43b7a2[_0xd44a('0x36')]};return db[_0xd44a('0x28')][_0xd44a('0x3a')](_0x555180)[_0xd44a('0x20')](function(_0x52abe9){_0x32d8c3['count']=_0x52abe9;if(_0x3af757['query'][_0xd44a('0x3b')]){_0x43b7a2[_0xd44a('0x3c')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x43b7a2);})[_0xd44a('0x20')](function(_0x28067a){_0x32d8c3[_0xd44a('0x3d')]=_0x28067a;return _0x32d8c3;})[_0xd44a('0x20')](respondWithFilteredResult(_0x5d78e8,_0x43b7a2))['catch'](handleError(_0x5d78e8,null));};exports[_0xd44a('0x3e')]=function(_0x25e2a9,_0x19cdc8){var _0x5b9d80={'raw':!![],'where':{'id':_0x25e2a9['params']['id']}},_0x23575e={};_0x23575e[_0xd44a('0x2c')]=_[_0xd44a('0x3f')](db[_0xd44a('0x28')][_0xd44a('0x40')]);_0x23575e[_0xd44a('0x2d')]=_[_0xd44a('0x3f')](_0x25e2a9[_0xd44a('0x2d')]);_0x23575e[_0xd44a('0x2e')]=_[_0xd44a('0x2f')](_0x23575e[_0xd44a('0x2c')],_0x23575e[_0xd44a('0x2d')]);_0x5b9d80['attributes']=_[_0xd44a('0x2f')](_0x23575e[_0xd44a('0x2c')],qs[_0xd44a('0x31')](_0x25e2a9[_0xd44a('0x2d')][_0xd44a('0x31')]));_0x5b9d80[_0xd44a('0x30')]=_0x5b9d80[_0xd44a('0x30')][_0xd44a('0x41')]?_0x5b9d80[_0xd44a('0x30')]:_0x23575e['model'];if(_0x25e2a9[_0xd44a('0x2d')][_0xd44a('0x3b')]){_0x5b9d80[_0xd44a('0x3c')]=[{'all':!![]}];}_0x5b9d80=_[_0xd44a('0x38')]({},_0x5b9d80,_0x25e2a9[_0xd44a('0x39')]);return db[_0xd44a('0x28')][_0xd44a('0x42')](_0x5b9d80)['then'](handleEntityNotFound(_0x19cdc8,null))[_0xd44a('0x20')](respondWithResult(_0x19cdc8,null))[_0xd44a('0x43')](handleError(_0x19cdc8,null));};exports[_0xd44a('0x44')]=function(_0x2b8f36,_0x55b4e5){return db[_0xd44a('0x28')]['create'](_0x2b8f36[_0xd44a('0x45')],{})[_0xd44a('0x20')](respondWithResult(_0x55b4e5,0xc9))[_0xd44a('0x43')](handleError(_0x55b4e5,null));};exports['update']=function(_0x252926,_0x1f7eb1){if(_0x252926[_0xd44a('0x45')]['id']){delete _0x252926[_0xd44a('0x45')]['id'];}return db[_0xd44a('0x28')][_0xd44a('0x42')]({'where':{'id':_0x252926[_0xd44a('0x46')]['id']}})[_0xd44a('0x20')](handleEntityNotFound(_0x1f7eb1,null))[_0xd44a('0x20')](saveUpdates(_0x252926[_0xd44a('0x45')],null))['then'](respondWithResult(_0x1f7eb1,null))[_0xd44a('0x43')](handleError(_0x1f7eb1,null));};exports[_0xd44a('0x21')]=function(_0x1b1490,_0x45c531){return db['FreshsalesField'][_0xd44a('0x42')]({'where':{'id':_0x1b1490[_0xd44a('0x46')]['id']}})[_0xd44a('0x20')](handleEntityNotFound(_0x45c531,null))[_0xd44a('0x20')](removeEntity(_0x45c531,null))[_0xd44a('0x43')](handleError(_0x45c531,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4df4044..edebcd8 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 _0x430c=['api','moment','bluebird','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x52f121,_0x8d0a2e){var _0x7af517=function(_0x229b25){while(--_0x229b25){_0x52f121['push'](_0x52f121['shift']());}};_0x7af517(++_0x8d0a2e);}(_0x430c,0x1a1));var _0xc430=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x430c[_0x2a558d];return _0xa7bc9c;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));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(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x9'),_0xc430('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79e2=['int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x3a15f8,_0x48b474){var _0x6e4f41=function(_0x2e5d32){while(--_0x2e5d32){_0x3a15f8['push'](_0x3a15f8['shift']());}};_0x6e4f41(++_0x48b474);}(_0x79e2,0x1c3));var _0x279e=function(_0x3f8e83,_0x457fd5){_0x3f8e83=_0x3f8e83-0x0;var _0x1a1b44=_0x79e2[_0x3f8e83];return _0x1a1b44;};'use strict';var _=require(_0x279e('0x0'));var util=require('util');var logger=require(_0x279e('0x1'))(_0x279e('0x2'));var moment=require(_0x279e('0x3'));var BPromise=require('bluebird');var rp=require(_0x279e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x279e('0x5'));var config=require(_0x279e('0x6'));var attributes=require(_0x279e('0x7'));module[_0x279e('0x8')]=function(_0x4b7028,_0x5a2f72){return _0x4b7028[_0x279e('0x9')](_0x279e('0xa'),attributes,{'tableName':_0x279e('0xb'),'paranoid':![],'indexes':[{'name':_0x279e('0xc'),'fields':[_0x279e('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index cb32f60..a3d4934 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x259720,_0x4b4e6c){var _0xd8993b=function(_0x3f3a3b){while(--_0x3f3a3b){_0x259720['push'](_0x259720['shift']());}};_0xd8993b(++_0x4b4e6c);}(_0x5496,0x175));var _0x6549=function(_0x5b2c54,_0x24ad96){_0x5b2c54=_0x5b2c54-0x0;var _0x14712e=_0x5496[_0x5b2c54];return _0x14712e;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x138b21,_0x3c08ae){var _0xad1913=function(_0x4efc49){while(--_0x4efc49){_0x138b21['push'](_0x138b21['shift']());}};_0xad1913(++_0x3c08ae);}(_0x2bd8,0x130));var _0x82bd=function(_0x2a49d8,_0x4d8a48){_0x2a49d8=_0x2a49d8-0x0;var _0x4ce342=_0x2bd8[_0x2a49d8];return _0x4ce342;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 754fd28..4353511 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(_0x3bdfed,_0xf5b3e9){var _0x5d0578=function(_0x575896){while(--_0x575896){_0x3bdfed['push'](_0x3bdfed['shift']());}};_0x5d0578(++_0xf5b3e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x173f30,_0x2adb15){var _0x1ab03a=function(_0x3df124){while(--_0x3df124){_0x173f30['push'](_0x173f30['shift']());}};_0x1ab03a(++_0x2adb15);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7841096..ab35fd5 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 _0x1967=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x40d8a3,_0x4f3ac1){var _0x4d9ecd=function(_0x26c87b){while(--_0x26c87b){_0x40d8a3['push'](_0x40d8a3['shift']());}};_0x4d9ecd(++_0x4f3ac1);}(_0x1967,0x173));var _0x7196=function(_0x1b6844,_0xc53c12){_0x1b6844=_0x1b6844-0x0;var _0x57fbd1=_0x1967[_0x1b6844];return _0x57fbd1;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'remoteUri':{'type':Sequelize[_0x7196('0x1')]},'password':{'type':Sequelize[_0x7196('0x1')]},'clientId':{'type':Sequelize[_0x7196('0x1')]},'clientSecret':{'type':Sequelize[_0x7196('0x1')]},'securityToken':{'type':Sequelize[_0x7196('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](_0x7196('0x4'),_0x7196('0x5')),'defaultValue':_0x7196('0x4')}}; \ No newline at end of file +var _0x84c6=['ENUM','integrationTab','newTab','STRING'];(function(_0x5c61b4,_0x483671){var _0x34f806=function(_0x135ebc){while(--_0x135ebc){_0x5c61b4['push'](_0x5c61b4['shift']());}};_0x34f806(++_0x483671);}(_0x84c6,0xe7));var _0x684c=function(_0x31faa3,_0x29c83b){_0x31faa3=_0x31faa3-0x0;var _0x539ac2=_0x84c6[_0x31faa3];return _0x539ac2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x684c('0x0')]},'description':{'type':Sequelize[_0x684c('0x0')]},'username':{'type':Sequelize[_0x684c('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x684c('0x0')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x684c('0x0')]},'clientSecret':{'type':Sequelize[_0x684c('0x0')]},'securityToken':{'type':Sequelize[_0x684c('0x0')]},'serverUrl':{'type':Sequelize[_0x684c('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x684c('0x1')](_0x684c('0x2'),_0x684c('0x3')),'defaultValue':_0x684c('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e601180..af5c1dc 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 _0x7f6f=['error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','keys','length','create','body','find','destroy','findOne','SalesforceConfiguration','pick','addConfiguration','Subjects','channel','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','username','concat','isNil','sobject','describe','IsReminderSet','IsRecurrence','Subject','int','picklist','boolean','email','textarea','remove','includes','picklistValues','label','value','True','False','false','test'];(function(_0x1be493,_0x571dc7){var _0x5ee1e5=function(_0x14cd66){while(--_0x14cd66){_0x1be493['push'](_0x1be493['shift']());}};_0x5ee1e5(++_0x571dc7);}(_0x7f6f,0xf2));var _0xf7f6=function(_0xb40f40,_0x41708a){_0xb40f40=_0xb40f40-0x0;var _0x55c108=_0x7f6f[_0xb40f40];return _0x55c108;};'use strict';var emlformat=require(_0xf7f6('0x0'));var rimraf=require(_0xf7f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7f6('0x2'));var rp=require('request-promise');var moment=require(_0xf7f6('0x3'));var BPromise=require(_0xf7f6('0x4'));var Mustache=require(_0xf7f6('0x5'));var util=require('util');var path=require(_0xf7f6('0x6'));var sox=require(_0xf7f6('0x7'));var csv=require('to-csv');var ejs=require(_0xf7f6('0x8'));var fs=require('fs');var fs_extra=require(_0xf7f6('0x9'));var _=require(_0xf7f6('0xa'));var squel=require('squel');var crypto=require(_0xf7f6('0xb'));var jsforce=require(_0xf7f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf7f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7f6('0xe'));var qs=require(_0xf7f6('0xf'));var as=require(_0xf7f6('0x10'));var hardwareService=require(_0xf7f6('0x11'));var logger=require(_0xf7f6('0x12'))('api');var utils=require(_0xf7f6('0x13'));var config=require(_0xf7f6('0x14'));var licenseUtil=require(_0xf7f6('0x15'));var db=require(_0xf7f6('0x16'))['db'];var integrations=require(_0xf7f6('0x17'));function respondWithStatusCode(_0x220706,_0x2e33fc){_0x2e33fc=_0x2e33fc||0xcc;return function(_0x43bae3){if(_0x43bae3){return _0x220706[_0xf7f6('0x18')](_0x2e33fc);}return _0x220706[_0xf7f6('0x19')](_0x2e33fc)[_0xf7f6('0x1a')]();};}function respondWithResult(_0x350050,_0x23b200){_0x23b200=_0x23b200||0xc8;return function(_0x4153e2){if(_0x4153e2){return _0x350050[_0xf7f6('0x19')](_0x23b200)[_0xf7f6('0x1b')](_0x4153e2);}};}function respondWithFilteredResult(_0x3d861c,_0x26dcdc){return function(_0x34c286){if(_0x34c286){var _0x379e9a=typeof _0x26dcdc[_0xf7f6('0x1c')]==='undefined'&&typeof _0x26dcdc[_0xf7f6('0x1d')]===_0xf7f6('0x1e');var _0x55c739=_0x34c286[_0xf7f6('0x1f')];var _0x17ad77=_0x379e9a?0x0:_0x26dcdc[_0xf7f6('0x1c')];var _0x221c2f=_0x379e9a?_0x34c286['count']:_0x26dcdc['offset']+_0x26dcdc[_0xf7f6('0x1d')];var _0x2a5310;if(_0x221c2f>=_0x55c739){_0x221c2f=_0x55c739;_0x2a5310=0xc8;}else{_0x2a5310=0xce;}_0x3d861c[_0xf7f6('0x19')](_0x2a5310);return _0x3d861c[_0xf7f6('0x20')]('Content-Range',_0x17ad77+'-'+_0x221c2f+'/'+_0x55c739)[_0xf7f6('0x1b')](_0x34c286);}return null;};}function patchUpdates(_0x688d39){return function(_0x2e7922){try{jsonpatch[_0xf7f6('0x21')](_0x2e7922,_0x688d39,!![]);}catch(_0x27ebde){return BPromise[_0xf7f6('0x22')](_0x27ebde);}return _0x2e7922['save']();};}function saveUpdates(_0x5f1022,_0xb4fbd5){return function(_0x5855b5){if(_0x5855b5){return _0x5855b5[_0xf7f6('0x23')](_0x5f1022)['then'](function(_0x1f571e){return _0x1f571e;});}return null;};}function removeEntity(_0x4a5e3c,_0x46f259){return function(_0x7f263f){if(_0x7f263f){return _0x7f263f['destroy']()[_0xf7f6('0x24')](function(){_0x4a5e3c[_0xf7f6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5479b3,_0x204101){return function(_0x30113f){if(!_0x30113f){_0x5479b3[_0xf7f6('0x18')](0x194);}return _0x30113f;};}function handleError(_0x316cd3,_0x2e3abc){_0x2e3abc=_0x2e3abc||0x1f4;return function(_0x18790a){logger['error'](_0x18790a['stack']);if(_0x18790a[_0xf7f6('0x25')]){delete _0x18790a[_0xf7f6('0x25')];}_0x316cd3['status'](_0x2e3abc)[_0xf7f6('0x26')](_0x18790a);};}exports['index']=function(_0x95d8c,_0x25756e){var _0xad3a5={},_0x205b97={},_0x7a9ff7={'count':0x0,'rows':[]};var _0x4b00a7=_[_0xf7f6('0x27')](db[_0xf7f6('0x28')][_0xf7f6('0x29')],function(_0x59c8ff){return{'name':_0x59c8ff[_0xf7f6('0x2a')],'type':_0x59c8ff[_0xf7f6('0x2b')][_0xf7f6('0x2c')]};});_0x205b97[_0xf7f6('0x2d')]=_[_0xf7f6('0x27')](_0x4b00a7,_0xf7f6('0x25'));_0x205b97[_0xf7f6('0x2e')]=_['keys'](_0x95d8c['query']);_0x205b97[_0xf7f6('0x2f')]=_[_0xf7f6('0x30')](_0x205b97[_0xf7f6('0x2d')],_0x205b97[_0xf7f6('0x2e')]);_0xad3a5['attributes']=_['intersection'](_0x205b97[_0xf7f6('0x2d')],qs[_0xf7f6('0x31')](_0x95d8c[_0xf7f6('0x2e')][_0xf7f6('0x31')]));_0xad3a5[_0xf7f6('0x32')]=_0xad3a5['attributes']['length']?_0xad3a5['attributes']:_0x205b97[_0xf7f6('0x2d')];if(!_0x95d8c[_0xf7f6('0x2e')]['hasOwnProperty'](_0xf7f6('0x33'))){_0xad3a5[_0xf7f6('0x1d')]=qs['limit'](_0x95d8c[_0xf7f6('0x2e')]['limit']);_0xad3a5[_0xf7f6('0x1c')]=qs[_0xf7f6('0x1c')](_0x95d8c[_0xf7f6('0x2e')]['offset']);}_0xad3a5[_0xf7f6('0x34')]=qs[_0xf7f6('0x35')](_0x95d8c[_0xf7f6('0x2e')][_0xf7f6('0x35')]);_0xad3a5[_0xf7f6('0x36')]=qs[_0xf7f6('0x2f')](_['pick'](_0x95d8c[_0xf7f6('0x2e')],_0x205b97[_0xf7f6('0x2f')]),_0x4b00a7);if(_0x95d8c['query'][_0xf7f6('0x37')]){_0xad3a5[_0xf7f6('0x36')]=_[_0xf7f6('0x38')](_0xad3a5[_0xf7f6('0x36')],{'$or':_[_0xf7f6('0x27')](_0x4b00a7,function(_0x385a12){if(_0x385a12[_0xf7f6('0x2b')]!=='VIRTUAL'){var _0x54ff7a={};_0x54ff7a[_0x385a12[_0xf7f6('0x25')]]={'$like':'%'+_0x95d8c[_0xf7f6('0x2e')][_0xf7f6('0x37')]+'%'};return _0x54ff7a;}})});}_0xad3a5=_[_0xf7f6('0x38')]({},_0xad3a5,_0x95d8c[_0xf7f6('0x39')]);var _0x2278de={'where':_0xad3a5[_0xf7f6('0x36')]};return db['SalesforceAccount'][_0xf7f6('0x1f')](_0x2278de)[_0xf7f6('0x24')](function(_0x5125ed){_0x7a9ff7[_0xf7f6('0x1f')]=_0x5125ed;if(_0x95d8c[_0xf7f6('0x2e')][_0xf7f6('0x3a')]){_0xad3a5[_0xf7f6('0x3b')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0xad3a5);})[_0xf7f6('0x24')](function(_0x297e5d){_0x7a9ff7[_0xf7f6('0x3c')]=_0x297e5d;return _0x7a9ff7;})[_0xf7f6('0x24')](respondWithFilteredResult(_0x25756e,_0xad3a5))[_0xf7f6('0x3d')](handleError(_0x25756e,null));};exports[_0xf7f6('0x3e')]=function(_0x59b0e7,_0x3240f0){var _0x11aaa4={'raw':![],'where':{'id':_0x59b0e7[_0xf7f6('0x3f')]['id']}},_0x624d0e={};_0x624d0e[_0xf7f6('0x2d')]=_['keys'](db[_0xf7f6('0x28')][_0xf7f6('0x29')]);_0x624d0e[_0xf7f6('0x2e')]=_[_0xf7f6('0x40')](_0x59b0e7[_0xf7f6('0x2e')]);_0x624d0e['filters']=_[_0xf7f6('0x30')](_0x624d0e[_0xf7f6('0x2d')],_0x624d0e[_0xf7f6('0x2e')]);_0x11aaa4['attributes']=_[_0xf7f6('0x30')](_0x624d0e[_0xf7f6('0x2d')],qs[_0xf7f6('0x31')](_0x59b0e7[_0xf7f6('0x2e')][_0xf7f6('0x31')]));_0x11aaa4[_0xf7f6('0x32')]=_0x11aaa4['attributes'][_0xf7f6('0x41')]?_0x11aaa4[_0xf7f6('0x32')]:_0x624d0e['model'];if(_0x59b0e7[_0xf7f6('0x2e')][_0xf7f6('0x3a')]){_0x11aaa4['include']=[{'all':!![]}];}_0x11aaa4=_[_0xf7f6('0x38')]({},_0x11aaa4,_0x59b0e7[_0xf7f6('0x39')]);return db[_0xf7f6('0x28')]['find'](_0x11aaa4)[_0xf7f6('0x24')](handleEntityNotFound(_0x3240f0,null))['then'](respondWithResult(_0x3240f0,null))[_0xf7f6('0x3d')](handleError(_0x3240f0,null));};exports[_0xf7f6('0x42')]=function(_0x24182e,_0x331710){return db[_0xf7f6('0x28')]['create'](_0x24182e[_0xf7f6('0x43')],{})[_0xf7f6('0x24')](respondWithResult(_0x331710,0xc9))['catch'](handleError(_0x331710,null));};exports[_0xf7f6('0x23')]=function(_0x5f47da,_0x1e881c){if(_0x5f47da['body']['id']){delete _0x5f47da[_0xf7f6('0x43')]['id'];}return db['SalesforceAccount'][_0xf7f6('0x44')]({'where':{'id':_0x5f47da[_0xf7f6('0x3f')]['id']}})[_0xf7f6('0x24')](handleEntityNotFound(_0x1e881c,null))[_0xf7f6('0x24')](saveUpdates(_0x5f47da[_0xf7f6('0x43')],null))[_0xf7f6('0x24')](respondWithResult(_0x1e881c,null))[_0xf7f6('0x3d')](handleError(_0x1e881c,null));};exports[_0xf7f6('0x45')]=function(_0x306173,_0x218e1e){return db[_0xf7f6('0x28')]['find']({'where':{'id':_0x306173[_0xf7f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x218e1e,null))[_0xf7f6('0x24')](removeEntity(_0x218e1e,null))['catch'](handleError(_0x218e1e,null));};exports['getConfigurations']=function(_0x5dd072,_0x282817,_0x8a3e98){var _0x6e9899={};var _0x1a5581={};var _0xb5a895;var _0x33ab73;return db['SalesforceAccount'][_0xf7f6('0x46')]({'where':{'id':_0x5dd072[_0xf7f6('0x3f')]['id']}})[_0xf7f6('0x24')](handleEntityNotFound(_0x282817,null))['then'](function(_0x1a447d){if(_0x1a447d){_0xb5a895=_0x1a447d;_0x1a5581['model']=_['keys'](db[_0xf7f6('0x47')][_0xf7f6('0x29')]);_0x1a5581['query']=_['keys'](_0x5dd072['query']);_0x1a5581[_0xf7f6('0x2f')]=_['intersection'](_0x1a5581[_0xf7f6('0x2d')],_0x1a5581[_0xf7f6('0x2e')]);_0x6e9899[_0xf7f6('0x32')]=_['intersection'](_0x1a5581[_0xf7f6('0x2d')],qs['fields'](_0x5dd072[_0xf7f6('0x2e')][_0xf7f6('0x31')]));_0x6e9899['attributes']=_0x6e9899[_0xf7f6('0x32')][_0xf7f6('0x41')]?_0x6e9899[_0xf7f6('0x32')]:_0x1a5581['model'];_0x6e9899['order']=qs[_0xf7f6('0x35')](_0x5dd072[_0xf7f6('0x2e')][_0xf7f6('0x35')]);_0x6e9899['where']=qs[_0xf7f6('0x2f')](_[_0xf7f6('0x48')](_0x5dd072[_0xf7f6('0x2e')],_0x1a5581['filters']));if(_0x5dd072[_0xf7f6('0x2e')]['filter']){_0x6e9899[_0xf7f6('0x36')]=_['merge'](_0x6e9899['where'],{'$or':_[_0xf7f6('0x27')](_0x6e9899[_0xf7f6('0x32')],function(_0x5224a7){var _0x2f0d15={};_0x2f0d15[_0x5224a7]={'$like':'%'+_0x5dd072['query']['filter']+'%'};return _0x2f0d15;})});}_0x6e9899=_[_0xf7f6('0x38')]({},_0x6e9899,_0x5dd072[_0xf7f6('0x39')]);return _0xb5a895['getConfigurations'](_0x6e9899);}})[_0xf7f6('0x24')](function(_0x16d851){if(_0x16d851){_0x33ab73=_0x16d851[_0xf7f6('0x41')];if(!_0x5dd072[_0xf7f6('0x2e')]['hasOwnProperty'](_0xf7f6('0x33'))){_0x6e9899[_0xf7f6('0x1d')]=qs[_0xf7f6('0x1d')](_0x5dd072[_0xf7f6('0x2e')][_0xf7f6('0x1d')]);_0x6e9899[_0xf7f6('0x1c')]=qs[_0xf7f6('0x1c')](_0x5dd072[_0xf7f6('0x2e')][_0xf7f6('0x1c')]);}return _0xb5a895['getConfigurations'](_0x6e9899);}})[_0xf7f6('0x24')](function(_0x1e552d){if(_0x1e552d){return _0x1e552d?{'count':_0x33ab73,'rows':_0x1e552d}:null;}})[_0xf7f6('0x24')](respondWithResult(_0x282817,null))[_0xf7f6('0x3d')](handleError(_0x282817,null));};exports[_0xf7f6('0x49')]=function(_0x153f66,_0x4b872e,_0x2ba8dc){if(_0x153f66[_0xf7f6('0x43')]['id']){delete _0x153f66['body']['id'];}return db['SalesforceAccount'][_0xf7f6('0x46')]({'where':{'id':_0x153f66['params']['id']}})[_0xf7f6('0x24')](handleEntityNotFound(_0x4b872e,null))[_0xf7f6('0x24')](function(_0xd26673){if(_0xd26673){_0x153f66[_0xf7f6('0x43')]['AccountId']=_0xd26673['id'];_0x153f66[_0xf7f6('0x43')][_0xf7f6('0x4a')]=integrations['getSubjects'](_0x153f66[_0xf7f6('0x43')][_0xf7f6('0x4b')],_0x153f66[_0xf7f6('0x43')][_0xf7f6('0x2b')]);_0x153f66[_0xf7f6('0x43')]['Descriptions']=integrations[_0xf7f6('0x4c')](_0x153f66['body'][_0xf7f6('0x4b')],_0x153f66['body']['type']);return db[_0xf7f6('0x47')][_0xf7f6('0x42')](_0x153f66[_0xf7f6('0x43')],{'include':[{'model':db[_0xf7f6('0x4d')],'as':_0xf7f6('0x4a')},{'model':db[_0xf7f6('0x4d')],'as':_0xf7f6('0x4e')}]});}return null;})['then'](respondWithResult(_0x4b872e,null))[_0xf7f6('0x3d')](handleError(_0x4b872e,null));};exports['getFields']=function(_0x45a10b,_0x51dc32,_0x25bc07){var _0x5d2cc5;var _0x1e0261='';var _0x451b3d=_0xf7f6('0x4f');return db[_0xf7f6('0x28')]['findOne']({'where':{'id':_0x45a10b[_0xf7f6('0x3f')]['id']},'attributes':['id',_0xf7f6('0x50'),_0xf7f6('0x51'),_0xf7f6('0x52'),'username',_0xf7f6('0x53'),_0xf7f6('0x54')]})[_0xf7f6('0x24')](handleEntityNotFound(_0x51dc32,null))[_0xf7f6('0x24')](function(_0x2104b5){if(_0x2104b5){_0x1e0261=_0x2104b5[_0xf7f6('0x50')];var _0x4ad854=_0x1e0261[_0xf7f6('0x55')](-0x1);if(_0x4ad854==='/'){_0x1e0261=_0x1e0261[_0xf7f6('0x56')](0x0,_0x1e0261[_0xf7f6('0x57')](_0x4ad854));}_0x5d2cc5=new jsforce[(_0xf7f6('0x58'))]({'oauth2':{'loginUrl':_0x1e0261,'clientId':_0x2104b5[_0xf7f6('0x51')],'clientSecret':_0x2104b5[_0xf7f6('0x52')]}});return _0x5d2cc5[_0xf7f6('0x59')](_0x2104b5[_0xf7f6('0x5a')],_0x2104b5[_0xf7f6('0x53')][_0xf7f6('0x5b')](_0x2104b5[_0xf7f6('0x54')]));}})[_0xf7f6('0x24')](function(_0x49716a){if(_0x49716a){if(!_[_0xf7f6('0x5c')](_0x45a10b['query']['ticketType'])){_0x451b3d=_0x45a10b['query']['ticketType'];}return _0x5d2cc5[_0xf7f6('0x5d')](_0x451b3d)[_0xf7f6('0x5e')]();}})['then'](function(_0x583bd7){var _0x456aac=['OwnerId','ActivityDate',_0xf7f6('0x5f'),_0xf7f6('0x60'),_0xf7f6('0x61'),'Description'];var _0x5d171c=['string',_0xf7f6('0x62'),_0xf7f6('0x63'),_0xf7f6('0x64'),_0xf7f6('0x65'),_0xf7f6('0x66'),'phone'];if(_0x583bd7){_[_0xf7f6('0x67')](_0x583bd7[_0xf7f6('0x31')],function(_0x397664){return _0x456aac[_0xf7f6('0x68')](_0x397664[_0xf7f6('0x25')])||!_0x5d171c[_0xf7f6('0x68')](_0x397664[_0xf7f6('0x2b')]);});return{'count':_0x583bd7['fields'][_0xf7f6('0x41')],'rows':_['map'](_0x583bd7[_0xf7f6('0x31')],function(_0x2dbcf6){return{'id':_0x2dbcf6[_0xf7f6('0x25')],'name':_0x2dbcf6['label'],'custom':_0x2dbcf6['custom'],'options':_0x2dbcf6['picklistValues'][_0xf7f6('0x41')]>0x0?_[_0xf7f6('0x27')](_0x2dbcf6[_0xf7f6('0x69')],function(_0x15ee48){return{'name':_0x15ee48[_0xf7f6('0x6a')],'value':_0x15ee48[_0xf7f6('0x6b')]};}):_0x2dbcf6['type']=='boolean'?[{'name':_0xf7f6('0x6c'),'value':'true'},{'name':_0xf7f6('0x6d'),'value':_0xf7f6('0x6e')}]:[]};})};}})['then'](respondWithResult(_0x51dc32,null))['catch'](function(_0x1f9910){var _0x5a4af1=_0x45a10b[_0xf7f6('0x2e')][_0xf7f6('0x6f')]?0x1f4:_0x1f9910['statusCode']||0x1f4;logger[_0xf7f6('0x70')](_0xf7f6('0x71'),_0xf7f6('0x72'),_0x5a4af1,JSON[_0xf7f6('0x73')](_0x1f9910));delete _0x1f9910['name'];if(_0x5a4af1===0x191){_0x5a4af1=0x190;}_0x51dc32[_0xf7f6('0x19')](_0x5a4af1)[_0xf7f6('0x26')](_0x45a10b['query'][_0xf7f6('0x6f')]?{'message':_0xf7f6('0x74'),'statusCode':_0x1f9910[_0xf7f6('0x75')]}:_0x1f9910);});}; \ No newline at end of file +var _0xe373=['params','rawAttributes','options','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','Subjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','picklist','boolean','textarea','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceAccount','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','catch','show'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xe373,0x129));var _0x3e37=function(_0x58b4d2,_0x376ce5){_0x58b4d2=_0x58b4d2-0x0;var _0x58570f=_0xe373[_0x58b4d2];return _0x58570f;};'use strict';var emlformat=require(_0x3e37('0x0'));var rimraf=require(_0x3e37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e37('0x2'));var rp=require(_0x3e37('0x3'));var moment=require(_0x3e37('0x4'));var BPromise=require(_0x3e37('0x5'));var Mustache=require(_0x3e37('0x6'));var util=require(_0x3e37('0x7'));var path=require(_0x3e37('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e37('0x9'));var fs=require('fs');var fs_extra=require(_0x3e37('0xa'));var _=require(_0x3e37('0xb'));var squel=require(_0x3e37('0xc'));var crypto=require(_0x3e37('0xd'));var jsforce=require(_0x3e37('0xe'));var deskjs=require(_0x3e37('0xf'));var toCsv=require(_0x3e37('0x10'));var querystring=require(_0x3e37('0x11'));var Papa=require(_0x3e37('0x12'));var Redis=require('ioredis');var authService=require(_0x3e37('0x13'));var qs=require(_0x3e37('0x14'));var as=require(_0x3e37('0x15'));var hardwareService=require(_0x3e37('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3e37('0x17'));var config=require(_0x3e37('0x18'));var licenseUtil=require(_0x3e37('0x19'));var db=require(_0x3e37('0x1a'))['db'];var integrations=require(_0x3e37('0x1b'));function respondWithStatusCode(_0x22f1d0,_0x4dbde6){_0x4dbde6=_0x4dbde6||0xcc;return function(_0x56fbf5){if(_0x56fbf5){return _0x22f1d0[_0x3e37('0x1c')](_0x4dbde6);}return _0x22f1d0[_0x3e37('0x1d')](_0x4dbde6)[_0x3e37('0x1e')]();};}function respondWithResult(_0x15bb65,_0x10921e){_0x10921e=_0x10921e||0xc8;return function(_0x595884){if(_0x595884){return _0x15bb65['status'](_0x10921e)[_0x3e37('0x1f')](_0x595884);}};}function respondWithFilteredResult(_0x1f25e2,_0xc913c7){return function(_0x1fc476){if(_0x1fc476){var _0x8fc9ea=typeof _0xc913c7[_0x3e37('0x20')]===_0x3e37('0x21')&&typeof _0xc913c7[_0x3e37('0x22')]===_0x3e37('0x21');var _0x3ec39f=_0x1fc476[_0x3e37('0x23')];var _0x22e27f=_0x8fc9ea?0x0:_0xc913c7[_0x3e37('0x20')];var _0x2b32e7=_0x8fc9ea?_0x1fc476['count']:_0xc913c7[_0x3e37('0x20')]+_0xc913c7[_0x3e37('0x22')];var _0x584ab6;if(_0x2b32e7>=_0x3ec39f){_0x2b32e7=_0x3ec39f;_0x584ab6=0xc8;}else{_0x584ab6=0xce;}_0x1f25e2['status'](_0x584ab6);return _0x1f25e2[_0x3e37('0x24')](_0x3e37('0x25'),_0x22e27f+'-'+_0x2b32e7+'/'+_0x3ec39f)[_0x3e37('0x1f')](_0x1fc476);}return null;};}function patchUpdates(_0x4727b5){return function(_0x50960a){try{jsonpatch[_0x3e37('0x26')](_0x50960a,_0x4727b5,!![]);}catch(_0x52bea1){return BPromise[_0x3e37('0x27')](_0x52bea1);}return _0x50960a[_0x3e37('0x28')]();};}function saveUpdates(_0xf46b43,_0x461a53){return function(_0x509ad4){if(_0x509ad4){return _0x509ad4[_0x3e37('0x29')](_0xf46b43)[_0x3e37('0x2a')](function(_0x177622){return _0x177622;});}return null;};}function removeEntity(_0x2d7dec,_0x313557){return function(_0x57f4d3){if(_0x57f4d3){return _0x57f4d3[_0x3e37('0x2b')]()[_0x3e37('0x2a')](function(){_0x2d7dec[_0x3e37('0x1d')](0xcc)[_0x3e37('0x1e')]();});}};}function handleEntityNotFound(_0x470741,_0xfd9914){return function(_0x3878dc){if(!_0x3878dc){_0x470741[_0x3e37('0x1c')](0x194);}return _0x3878dc;};}function handleError(_0x49f097,_0x34eb97){_0x34eb97=_0x34eb97||0x1f4;return function(_0x460c63){logger[_0x3e37('0x2c')](_0x460c63['stack']);if(_0x460c63[_0x3e37('0x2d')]){delete _0x460c63[_0x3e37('0x2d')];}_0x49f097[_0x3e37('0x1d')](_0x34eb97)[_0x3e37('0x2e')](_0x460c63);};}exports[_0x3e37('0x2f')]=function(_0x6e6313,_0x1e1705){var _0x3252a4={},_0x151255={},_0x58f8ce={'count':0x0,'rows':[]};var _0x4cf7e3=_[_0x3e37('0x30')](db[_0x3e37('0x31')]['rawAttributes'],function(_0x5b751b){return{'name':_0x5b751b['fieldName'],'type':_0x5b751b['type'][_0x3e37('0x32')]};});_0x151255['model']=_[_0x3e37('0x30')](_0x4cf7e3,_0x3e37('0x2d'));_0x151255['query']=_[_0x3e37('0x33')](_0x6e6313[_0x3e37('0x34')]);_0x151255[_0x3e37('0x35')]=_[_0x3e37('0x36')](_0x151255[_0x3e37('0x37')],_0x151255['query']);_0x3252a4[_0x3e37('0x38')]=_[_0x3e37('0x36')](_0x151255[_0x3e37('0x37')],qs[_0x3e37('0x39')](_0x6e6313['query'][_0x3e37('0x39')]));_0x3252a4[_0x3e37('0x38')]=_0x3252a4[_0x3e37('0x38')][_0x3e37('0x3a')]?_0x3252a4[_0x3e37('0x38')]:_0x151255['model'];if(!_0x6e6313[_0x3e37('0x34')][_0x3e37('0x3b')]('nolimit')){_0x3252a4['limit']=qs[_0x3e37('0x22')](_0x6e6313[_0x3e37('0x34')][_0x3e37('0x22')]);_0x3252a4[_0x3e37('0x20')]=qs[_0x3e37('0x20')](_0x6e6313[_0x3e37('0x34')][_0x3e37('0x20')]);}_0x3252a4[_0x3e37('0x3c')]=qs['sort'](_0x6e6313[_0x3e37('0x34')][_0x3e37('0x3d')]);_0x3252a4[_0x3e37('0x3e')]=qs[_0x3e37('0x35')](_[_0x3e37('0x3f')](_0x6e6313[_0x3e37('0x34')],_0x151255[_0x3e37('0x35')]),_0x4cf7e3);if(_0x6e6313[_0x3e37('0x34')][_0x3e37('0x40')]){_0x3252a4[_0x3e37('0x3e')]=_[_0x3e37('0x41')](_0x3252a4['where'],{'$or':_[_0x3e37('0x30')](_0x4cf7e3,function(_0x39ad24){if(_0x39ad24[_0x3e37('0x42')]!==_0x3e37('0x43')){var _0x375a61={};_0x375a61[_0x39ad24[_0x3e37('0x2d')]]={'$like':'%'+_0x6e6313['query']['filter']+'%'};return _0x375a61;}})});}_0x3252a4=_[_0x3e37('0x41')]({},_0x3252a4,_0x6e6313['options']);var _0x47db5e={'where':_0x3252a4[_0x3e37('0x3e')]};return db[_0x3e37('0x31')][_0x3e37('0x23')](_0x47db5e)[_0x3e37('0x2a')](function(_0x3b483b){_0x58f8ce[_0x3e37('0x23')]=_0x3b483b;if(_0x6e6313['query'][_0x3e37('0x44')]){_0x3252a4['include']=[{'all':!![]}];}return db[_0x3e37('0x31')]['findAll'](_0x3252a4);})[_0x3e37('0x2a')](function(_0x423174){_0x58f8ce[_0x3e37('0x45')]=_0x423174;return _0x58f8ce;})[_0x3e37('0x2a')](respondWithFilteredResult(_0x1e1705,_0x3252a4))[_0x3e37('0x46')](handleError(_0x1e1705,null));};exports[_0x3e37('0x47')]=function(_0x52569a,_0xafae4c){var _0x4b6d3e={'raw':![],'where':{'id':_0x52569a[_0x3e37('0x48')]['id']}},_0x2bd756={};_0x2bd756[_0x3e37('0x37')]=_[_0x3e37('0x33')](db[_0x3e37('0x31')][_0x3e37('0x49')]);_0x2bd756[_0x3e37('0x34')]=_[_0x3e37('0x33')](_0x52569a[_0x3e37('0x34')]);_0x2bd756[_0x3e37('0x35')]=_[_0x3e37('0x36')](_0x2bd756[_0x3e37('0x37')],_0x2bd756[_0x3e37('0x34')]);_0x4b6d3e['attributes']=_[_0x3e37('0x36')](_0x2bd756['model'],qs[_0x3e37('0x39')](_0x52569a[_0x3e37('0x34')]['fields']));_0x4b6d3e[_0x3e37('0x38')]=_0x4b6d3e[_0x3e37('0x38')][_0x3e37('0x3a')]?_0x4b6d3e[_0x3e37('0x38')]:_0x2bd756[_0x3e37('0x37')];if(_0x52569a['query']['includeAll']){_0x4b6d3e['include']=[{'all':!![]}];}_0x4b6d3e=_[_0x3e37('0x41')]({},_0x4b6d3e,_0x52569a[_0x3e37('0x4a')]);return db['SalesforceAccount']['find'](_0x4b6d3e)['then'](handleEntityNotFound(_0xafae4c,null))[_0x3e37('0x2a')](respondWithResult(_0xafae4c,null))['catch'](handleError(_0xafae4c,null));};exports['create']=function(_0xed5a4c,_0x103236){return db[_0x3e37('0x31')][_0x3e37('0x4b')](_0xed5a4c[_0x3e37('0x4c')],{})['then'](respondWithResult(_0x103236,0xc9))['catch'](handleError(_0x103236,null));};exports[_0x3e37('0x29')]=function(_0x37351e,_0x14ebd9){if(_0x37351e[_0x3e37('0x4c')]['id']){delete _0x37351e[_0x3e37('0x4c')]['id'];}return db[_0x3e37('0x31')]['find']({'where':{'id':_0x37351e['params']['id']}})[_0x3e37('0x2a')](handleEntityNotFound(_0x14ebd9,null))[_0x3e37('0x2a')](saveUpdates(_0x37351e['body'],null))[_0x3e37('0x2a')](respondWithResult(_0x14ebd9,null))['catch'](handleError(_0x14ebd9,null));};exports[_0x3e37('0x2b')]=function(_0x1a813c,_0x138dd5){return db['SalesforceAccount']['find']({'where':{'id':_0x1a813c['params']['id']}})[_0x3e37('0x2a')](handleEntityNotFound(_0x138dd5,null))[_0x3e37('0x2a')](removeEntity(_0x138dd5,null))[_0x3e37('0x46')](handleError(_0x138dd5,null));};exports[_0x3e37('0x4d')]=function(_0xfaeea9,_0x48a58b,_0x1ad997){var _0x452fe6={};var _0x579cfa={};var _0x24aa72;var _0x493edd;return db[_0x3e37('0x31')][_0x3e37('0x4e')]({'where':{'id':_0xfaeea9[_0x3e37('0x48')]['id']}})['then'](handleEntityNotFound(_0x48a58b,null))[_0x3e37('0x2a')](function(_0x302f1c){if(_0x302f1c){_0x24aa72=_0x302f1c;_0x579cfa[_0x3e37('0x37')]=_[_0x3e37('0x33')](db[_0x3e37('0x4f')]['rawAttributes']);_0x579cfa[_0x3e37('0x34')]=_['keys'](_0xfaeea9['query']);_0x579cfa[_0x3e37('0x35')]=_[_0x3e37('0x36')](_0x579cfa[_0x3e37('0x37')],_0x579cfa[_0x3e37('0x34')]);_0x452fe6[_0x3e37('0x38')]=_[_0x3e37('0x36')](_0x579cfa[_0x3e37('0x37')],qs[_0x3e37('0x39')](_0xfaeea9['query'][_0x3e37('0x39')]));_0x452fe6[_0x3e37('0x38')]=_0x452fe6[_0x3e37('0x38')][_0x3e37('0x3a')]?_0x452fe6['attributes']:_0x579cfa[_0x3e37('0x37')];_0x452fe6['order']=qs[_0x3e37('0x3d')](_0xfaeea9[_0x3e37('0x34')][_0x3e37('0x3d')]);_0x452fe6['where']=qs['filters'](_[_0x3e37('0x3f')](_0xfaeea9['query'],_0x579cfa['filters']));if(_0xfaeea9[_0x3e37('0x34')]['filter']){_0x452fe6[_0x3e37('0x3e')]=_[_0x3e37('0x41')](_0x452fe6['where'],{'$or':_[_0x3e37('0x30')](_0x452fe6['attributes'],function(_0x459831){var _0x5eaa08={};_0x5eaa08[_0x459831]={'$like':'%'+_0xfaeea9[_0x3e37('0x34')][_0x3e37('0x40')]+'%'};return _0x5eaa08;})});}_0x452fe6=_[_0x3e37('0x41')]({},_0x452fe6,_0xfaeea9['options']);return _0x24aa72[_0x3e37('0x4d')](_0x452fe6);}})[_0x3e37('0x2a')](function(_0x504b2b){if(_0x504b2b){_0x493edd=_0x504b2b[_0x3e37('0x3a')];if(!_0xfaeea9[_0x3e37('0x34')][_0x3e37('0x3b')](_0x3e37('0x50'))){_0x452fe6[_0x3e37('0x22')]=qs[_0x3e37('0x22')](_0xfaeea9[_0x3e37('0x34')]['limit']);_0x452fe6[_0x3e37('0x20')]=qs[_0x3e37('0x20')](_0xfaeea9[_0x3e37('0x34')][_0x3e37('0x20')]);}return _0x24aa72[_0x3e37('0x4d')](_0x452fe6);}})[_0x3e37('0x2a')](function(_0x5d6673){if(_0x5d6673){return _0x5d6673?{'count':_0x493edd,'rows':_0x5d6673}:null;}})[_0x3e37('0x2a')](respondWithResult(_0x48a58b,null))['catch'](handleError(_0x48a58b,null));};exports['addConfiguration']=function(_0x3d1c90,_0x4eb3c2,_0x449df4){if(_0x3d1c90['body']['id']){delete _0x3d1c90[_0x3e37('0x4c')]['id'];}return db[_0x3e37('0x31')][_0x3e37('0x4e')]({'where':{'id':_0x3d1c90['params']['id']}})[_0x3e37('0x2a')](handleEntityNotFound(_0x4eb3c2,null))[_0x3e37('0x2a')](function(_0x51c0b5){if(_0x51c0b5){_0x3d1c90['body']['AccountId']=_0x51c0b5['id'];_0x3d1c90[_0x3e37('0x4c')][_0x3e37('0x51')]=integrations['getSubjects'](_0x3d1c90['body'][_0x3e37('0x52')],_0x3d1c90[_0x3e37('0x4c')][_0x3e37('0x42')]);_0x3d1c90[_0x3e37('0x4c')]['Descriptions']=integrations[_0x3e37('0x53')](_0x3d1c90[_0x3e37('0x4c')][_0x3e37('0x52')],_0x3d1c90[_0x3e37('0x4c')]['type']);return db[_0x3e37('0x4f')][_0x3e37('0x4b')](_0x3d1c90[_0x3e37('0x4c')],{'include':[{'model':db[_0x3e37('0x54')],'as':_0x3e37('0x51')},{'model':db['SalesforceField'],'as':_0x3e37('0x55')}]});}return null;})[_0x3e37('0x2a')](respondWithResult(_0x4eb3c2,null))[_0x3e37('0x46')](handleError(_0x4eb3c2,null));};exports[_0x3e37('0x56')]=function(_0x34ce04,_0x45612d,_0x371c65){var _0x4bb93d;var _0x682cc7='';var _0x4b48e9=_0x3e37('0x57');return db['SalesforceAccount'][_0x3e37('0x4e')]({'where':{'id':_0x34ce04['params']['id']},'attributes':['id',_0x3e37('0x58'),_0x3e37('0x59'),_0x3e37('0x5a'),_0x3e37('0x5b'),_0x3e37('0x5c'),_0x3e37('0x5d')]})[_0x3e37('0x2a')](handleEntityNotFound(_0x45612d,null))[_0x3e37('0x2a')](function(_0x1fae1a){if(_0x1fae1a){_0x682cc7=_0x1fae1a[_0x3e37('0x58')];var _0x5e02f9=_0x682cc7['slice'](-0x1);if(_0x5e02f9==='/'){_0x682cc7=_0x682cc7[_0x3e37('0x5e')](0x0,_0x682cc7['lastIndexOf'](_0x5e02f9));}_0x4bb93d=new jsforce[(_0x3e37('0x5f'))]({'oauth2':{'loginUrl':_0x682cc7,'clientId':_0x1fae1a[_0x3e37('0x59')],'clientSecret':_0x1fae1a['clientSecret']}});return _0x4bb93d[_0x3e37('0x60')](_0x1fae1a[_0x3e37('0x5b')],_0x1fae1a[_0x3e37('0x5c')][_0x3e37('0x61')](_0x1fae1a[_0x3e37('0x5d')]));}})[_0x3e37('0x2a')](function(_0x524a4e){if(_0x524a4e){if(!_[_0x3e37('0x62')](_0x34ce04['query'][_0x3e37('0x63')])){_0x4b48e9=_0x34ce04[_0x3e37('0x34')][_0x3e37('0x63')];}return _0x4bb93d[_0x3e37('0x64')](_0x4b48e9)[_0x3e37('0x65')]();}})['then'](function(_0x235a14){var _0x437398=[_0x3e37('0x66'),_0x3e37('0x67'),'IsReminderSet',_0x3e37('0x68'),_0x3e37('0x69'),_0x3e37('0x6a')];var _0x4ebbe6=['string','int',_0x3e37('0x6b'),_0x3e37('0x6c'),'email',_0x3e37('0x6d'),'phone'];if(_0x235a14){_[_0x3e37('0x6e')](_0x235a14[_0x3e37('0x39')],function(_0x524e62){return _0x437398['includes'](_0x524e62['name'])||!_0x4ebbe6[_0x3e37('0x6f')](_0x524e62[_0x3e37('0x42')]);});return{'count':_0x235a14['fields']['length'],'rows':_[_0x3e37('0x30')](_0x235a14[_0x3e37('0x39')],function(_0x402273){return{'id':_0x402273[_0x3e37('0x2d')],'name':_0x402273[_0x3e37('0x70')],'custom':_0x402273['custom'],'options':_0x402273[_0x3e37('0x71')][_0x3e37('0x3a')]>0x0?_[_0x3e37('0x30')](_0x402273['picklistValues'],function(_0xdb3c96){return{'name':_0xdb3c96[_0x3e37('0x70')],'value':_0xdb3c96[_0x3e37('0x72')]};}):_0x402273[_0x3e37('0x42')]==_0x3e37('0x6c')?[{'name':_0x3e37('0x73'),'value':_0x3e37('0x74')},{'name':_0x3e37('0x75'),'value':_0x3e37('0x76')}]:[]};})};}})[_0x3e37('0x2a')](respondWithResult(_0x45612d,null))[_0x3e37('0x46')](function(_0x4aed84){var _0x84c6ce=_0x34ce04[_0x3e37('0x34')][_0x3e37('0x77')]?0x1f4:_0x4aed84[_0x3e37('0x78')]||0x1f4;logger[_0x3e37('0x2c')](_0x3e37('0x79'),'getFields',_0x84c6ce,JSON[_0x3e37('0x7a')](_0x4aed84));delete _0x4aed84[_0x3e37('0x2d')];if(_0x84c6ce===0x191){_0x84c6ce=0x190;}_0x45612d[_0x3e37('0x1d')](_0x84c6ce)[_0x3e37('0x2e')](_0x34ce04[_0x3e37('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4aed84['statusCode']}:_0x4aed84);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c323b89..c3f674e 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 _0x4a39=['rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','lodash','../../config/logger','api','bluebird','path'];(function(_0x292fa8,_0x2ac884){var _0x52d357=function(_0xca4082){while(--_0xca4082){_0x292fa8['push'](_0x292fa8['shift']());}};_0x52d357(++_0x2ac884);}(_0x4a39,0x9b));var _0x94a3=function(_0x68d97e,_0x33e5f9){_0x68d97e=_0x68d97e-0x0;var _0x99cebc=_0x4a39[_0x68d97e];return _0x99cebc;};'use strict';var _=require(_0x94a3('0x0'));var util=require('util');var logger=require(_0x94a3('0x1'))(_0x94a3('0x2'));var moment=require('moment');var BPromise=require(_0x94a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94a3('0x4'));var rimraf=require(_0x94a3('0x5'));var config=require(_0x94a3('0x6'));var attributes=require(_0x94a3('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x94a3('0x8')]=function(_0x192137,_0x48e86a){return _0x192137[_0x94a3('0x9')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x500f=['int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','define','SalesforceAccount'];(function(_0x15704b,_0xb94688){var _0x5c54b3=function(_0x447db4){while(--_0x447db4){_0x15704b['push'](_0x15704b['shift']());}};_0x5c54b3(++_0xb94688);}(_0x500f,0x1d5));var _0xf500=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x500f[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xf500('0x0'));var util=require(_0xf500('0x1'));var logger=require('../../config/logger')(_0xf500('0x2'));var moment=require(_0xf500('0x3'));var BPromise=require(_0xf500('0x4'));var rp=require(_0xf500('0x5'));var fs=require('fs');var path=require(_0xf500('0x6'));var rimraf=require(_0xf500('0x7'));var config=require('../../config/environment');var attributes=require(_0xf500('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4703c4,_0x105652){return _0x4703c4[_0xf500('0x9')](_0xf500('0xa'),attributes,{'tableName':_0xf500('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index bb453a8..c780d6e 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 _0xe66c=['client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','attributes','limit','include','map','model','ShowSalesforceAccount','find','where','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xe66c,0x12b));var _0xce66=function(_0x152018,_0x1876a7){_0x152018=_0x152018-0x0;var _0x22bbfe=_0xe66c[_0x152018];return _0x22bbfe;};'use strict';var _=require('lodash');var util=require(_0xce66('0x0'));var moment=require(_0xce66('0x1'));var BPromise=require(_0xce66('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce66('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce66('0x4'));var logger=require('../../config/logger')(_0xce66('0x5'));var config=require('../../config/environment');var jayson=require(_0xce66('0x6'));var client=jayson[_0xce66('0x7')][_0xce66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2767d7,_0x2a6df9,_0x5a38a4){return new BPromise(function(_0x156d97,_0x155ad3){return client[_0xce66('0x9')](_0x2767d7,_0x5a38a4)[_0xce66('0xa')](function(_0x8f77e1){logger[_0xce66('0xb')](_0xce66('0xc'),_0x2a6df9,_0xce66('0xd'));logger[_0xce66('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2a6df9,_0xce66('0xd'),JSON[_0xce66('0xf')](_0x8f77e1));if(_0x8f77e1[_0xce66('0x10')]){if(_0x8f77e1['error'][_0xce66('0x11')]===0x1f4){logger[_0xce66('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2a6df9,_0x8f77e1[_0xce66('0x10')]['message']);return _0x155ad3(_0x8f77e1[_0xce66('0x10')][_0xce66('0x12')]);}logger[_0xce66('0x10')](_0xce66('0xc'),_0x2a6df9,_0x8f77e1[_0xce66('0x10')][_0xce66('0x12')]);return _0x156d97(_0x8f77e1['error'][_0xce66('0x12')]);}else{logger[_0xce66('0xb')](_0xce66('0xc'),_0x2a6df9,_0xce66('0xd'));_0x156d97(_0x8f77e1[_0xce66('0x13')][_0xce66('0x12')]);}})[_0xce66('0x14')](function(_0x338984){logger[_0xce66('0x10')](_0xce66('0xc'),_0x2a6df9,_0x338984);_0x155ad3(_0x338984);});});}exports[_0xce66('0x15')]=function(_0x54492d){var _0x24de0d=this;return new Promise(function(_0x366257,_0x29e384){return db[_0xce66('0x16')][_0xce66('0x17')]({'raw':_0x54492d['options']?_0x54492d['options'][_0xce66('0x18')]===undefined?!![]:![]:!![],'where':_0x54492d[_0xce66('0x19')]?_0x54492d[_0xce66('0x19')]['where']||null:null,'attributes':_0x54492d[_0xce66('0x19')]?_0x54492d[_0xce66('0x19')][_0xce66('0x1a')]||null:null,'limit':_0x54492d['options']?_0x54492d[_0xce66('0x19')][_0xce66('0x1b')]||null:null,'include':_0x54492d[_0xce66('0x19')]?_0x54492d[_0xce66('0x19')][_0xce66('0x1c')]?_[_0xce66('0x1d')](_0x54492d[_0xce66('0x19')]['include'],function(_0x3ebef3){return{'model':db[_0x3ebef3[_0xce66('0x1e')]],'as':_0x3ebef3['as'],'attributes':_0x3ebef3['attributes'],'include':_0x3ebef3[_0xce66('0x1c')]?_['map'](_0x3ebef3['include'],function(_0x553adb){return{'model':db[_0x553adb['model']],'as':_0x553adb['as'],'attributes':_0x553adb[_0xce66('0x1a')],'include':_0x553adb['include']?_[_0xce66('0x1d')](_0x553adb[_0xce66('0x1c')],function(_0x1b3d6b){return{'model':db[_0x1b3d6b[_0xce66('0x1e')]],'as':_0x1b3d6b['as'],'attributes':_0x1b3d6b[_0xce66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xce66('0xa')](function(_0x47b2d0){logger['info'](_0xce66('0x15'),_0x54492d);logger[_0xce66('0xe')](_0xce66('0x15'),_0x54492d,JSON[_0xce66('0xf')](_0x47b2d0));_0x366257(_0x47b2d0);})[_0xce66('0x14')](function(_0x542c09){logger[_0xce66('0x10')](_0xce66('0x15'),_0x542c09[_0xce66('0x12')],_0x54492d);_0x29e384(_0x24de0d['error'](0x1f4,_0x542c09['message']));});});};exports[_0xce66('0x1f')]=function(_0x1ad10b){var _0x18aa03=this;return new Promise(function(_0x40ea81,_0x29b6f3){return db[_0xce66('0x16')][_0xce66('0x20')]({'raw':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b[_0xce66('0x19')][_0xce66('0x18')]===undefined?!![]:![]:!![],'where':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b['options'][_0xce66('0x21')]||null:null,'attributes':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b[_0xce66('0x19')][_0xce66('0x1a')]||null:null,'include':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b['options'][_0xce66('0x1c')]?_['map'](_0x1ad10b['options'][_0xce66('0x1c')],function(_0x623e68){return{'model':db[_0x623e68[_0xce66('0x1e')]],'as':_0x623e68['as'],'attributes':_0x623e68[_0xce66('0x1a')],'include':_0x623e68[_0xce66('0x1c')]?_[_0xce66('0x1d')](_0x623e68[_0xce66('0x1c')],function(_0x137844){return{'model':db[_0x137844[_0xce66('0x1e')]],'as':_0x137844['as'],'attributes':_0x137844[_0xce66('0x1a')],'include':_0x137844[_0xce66('0x1c')]?_[_0xce66('0x1d')](_0x137844[_0xce66('0x1c')],function(_0x905fac){return{'model':db[_0x905fac[_0xce66('0x1e')]],'as':_0x905fac['as'],'attributes':_0x905fac[_0xce66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xce66('0xa')](function(_0x51733b){logger[_0xce66('0xb')](_0xce66('0x1f'),_0x1ad10b);logger['debug'](_0xce66('0x1f'),_0x1ad10b,JSON[_0xce66('0xf')](_0x51733b));_0x40ea81(_0x51733b);})[_0xce66('0x14')](function(_0x593aea){logger[_0xce66('0x10')](_0xce66('0x1f'),_0x593aea[_0xce66('0x12')],_0x1ad10b);_0x29b6f3(_0x18aa03[_0xce66('0x10')](0x1f4,_0x593aea[_0xce66('0x12')]));});});}; \ No newline at end of file +var _0xfdf9=['../../config/environment','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','map','model','attributes','ShowSalesforceAccount','where','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4525ea,_0x4247d7){var _0x162cdf=function(_0x15ccc3){while(--_0x15ccc3){_0x4525ea['push'](_0x4525ea['shift']());}};_0x162cdf(++_0x4247d7);}(_0xfdf9,0x16e));var _0x9fdf=function(_0x290bd9,_0xad9d87){_0x290bd9=_0x290bd9-0x0;var _0x226fe2=_0xfdf9[_0x290bd9];return _0x226fe2;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var moment=require(_0x9fdf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fdf('0x3'))['db'];var utils=require(_0x9fdf('0x4'));var logger=require(_0x9fdf('0x5'))('rpc');var config=require(_0x9fdf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9fdf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d6c52,_0xef334b,_0x46b377){return new BPromise(function(_0x5c12cc,_0x1e4d43){return client['request'](_0x1d6c52,_0x46b377)[_0x9fdf('0x8')](function(_0xc1ce93){logger[_0x9fdf('0x9')](_0x9fdf('0xa'),_0xef334b,_0x9fdf('0xb'));logger[_0x9fdf('0xc')](_0x9fdf('0xd'),_0xef334b,_0x9fdf('0xb'),JSON[_0x9fdf('0xe')](_0xc1ce93));if(_0xc1ce93['error']){if(_0xc1ce93[_0x9fdf('0xf')][_0x9fdf('0x10')]===0x1f4){logger[_0x9fdf('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0xef334b,_0xc1ce93[_0x9fdf('0xf')]['message']);return _0x1e4d43(_0xc1ce93[_0x9fdf('0xf')][_0x9fdf('0x11')]);}logger[_0x9fdf('0xf')](_0x9fdf('0xa'),_0xef334b,_0xc1ce93[_0x9fdf('0xf')][_0x9fdf('0x11')]);return _0x5c12cc(_0xc1ce93['error']['message']);}else{logger['info'](_0x9fdf('0xa'),_0xef334b,_0x9fdf('0xb'));_0x5c12cc(_0xc1ce93['result'][_0x9fdf('0x11')]);}})[_0x9fdf('0x12')](function(_0x31ece5){logger[_0x9fdf('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0xef334b,_0x31ece5);_0x1e4d43(_0x31ece5);});});}exports[_0x9fdf('0x13')]=function(_0x17a24c){var _0xb0e6ae=this;return new Promise(function(_0x4db528,_0x92187){return db[_0x9fdf('0x14')][_0x9fdf('0x15')]({'raw':_0x17a24c[_0x9fdf('0x16')]?_0x17a24c[_0x9fdf('0x16')][_0x9fdf('0x17')]===undefined?!![]:![]:!![],'where':_0x17a24c[_0x9fdf('0x16')]?_0x17a24c[_0x9fdf('0x16')]['where']||null:null,'attributes':_0x17a24c[_0x9fdf('0x16')]?_0x17a24c[_0x9fdf('0x16')]['attributes']||null:null,'limit':_0x17a24c[_0x9fdf('0x16')]?_0x17a24c[_0x9fdf('0x16')][_0x9fdf('0x18')]||null:null,'include':_0x17a24c[_0x9fdf('0x16')]?_0x17a24c[_0x9fdf('0x16')][_0x9fdf('0x19')]?_[_0x9fdf('0x1a')](_0x17a24c[_0x9fdf('0x16')][_0x9fdf('0x19')],function(_0x77ab31){return{'model':db[_0x77ab31[_0x9fdf('0x1b')]],'as':_0x77ab31['as'],'attributes':_0x77ab31[_0x9fdf('0x1c')],'include':_0x77ab31[_0x9fdf('0x19')]?_['map'](_0x77ab31[_0x9fdf('0x19')],function(_0x5b7e8e){return{'model':db[_0x5b7e8e[_0x9fdf('0x1b')]],'as':_0x5b7e8e['as'],'attributes':_0x5b7e8e['attributes'],'include':_0x5b7e8e['include']?_[_0x9fdf('0x1a')](_0x5b7e8e[_0x9fdf('0x19')],function(_0x290c7f){return{'model':db[_0x290c7f['model']],'as':_0x290c7f['as'],'attributes':_0x290c7f[_0x9fdf('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49b087){logger[_0x9fdf('0x9')](_0x9fdf('0x13'),_0x17a24c);logger[_0x9fdf('0xc')](_0x9fdf('0x13'),_0x17a24c,JSON[_0x9fdf('0xe')](_0x49b087));_0x4db528(_0x49b087);})['catch'](function(_0x3a374d){logger[_0x9fdf('0xf')](_0x9fdf('0x13'),_0x3a374d[_0x9fdf('0x11')],_0x17a24c);_0x92187(_0xb0e6ae['error'](0x1f4,_0x3a374d['message']));});});};exports[_0x9fdf('0x1d')]=function(_0x22e3a5){var _0x2776c8=this;return new Promise(function(_0x406275,_0x4308d0){return db[_0x9fdf('0x14')]['find']({'raw':_0x22e3a5[_0x9fdf('0x16')]?_0x22e3a5[_0x9fdf('0x16')][_0x9fdf('0x17')]===undefined?!![]:![]:!![],'where':_0x22e3a5['options']?_0x22e3a5[_0x9fdf('0x16')][_0x9fdf('0x1e')]||null:null,'attributes':_0x22e3a5['options']?_0x22e3a5[_0x9fdf('0x16')][_0x9fdf('0x1c')]||null:null,'include':_0x22e3a5['options']?_0x22e3a5[_0x9fdf('0x16')]['include']?_['map'](_0x22e3a5[_0x9fdf('0x16')][_0x9fdf('0x19')],function(_0x294594){return{'model':db[_0x294594['model']],'as':_0x294594['as'],'attributes':_0x294594['attributes'],'include':_0x294594[_0x9fdf('0x19')]?_[_0x9fdf('0x1a')](_0x294594['include'],function(_0x118b82){return{'model':db[_0x118b82[_0x9fdf('0x1b')]],'as':_0x118b82['as'],'attributes':_0x118b82[_0x9fdf('0x1c')],'include':_0x118b82[_0x9fdf('0x19')]?_['map'](_0x118b82[_0x9fdf('0x19')],function(_0x1a717f){return{'model':db[_0x1a717f['model']],'as':_0x1a717f['as'],'attributes':_0x1a717f[_0x9fdf('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14684e){logger['info'](_0x9fdf('0x1d'),_0x22e3a5);logger[_0x9fdf('0xc')](_0x9fdf('0x1d'),_0x22e3a5,JSON[_0x9fdf('0xe')](_0x14684e));_0x406275(_0x14684e);})[_0x9fdf('0x12')](function(_0x12cff3){logger['error'](_0x9fdf('0x1d'),_0x12cff3[_0x9fdf('0x11')],_0x22e3a5);_0x4308d0(_0x2776c8[_0x9fdf('0xf')](0x1f4,_0x12cff3[_0x9fdf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f06d588..185a3e5 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xdb28,0x106));var _0x8db2=function(_0x3e9817,_0x469a3e){_0x3e9817=_0x3e9817-0x0;var _0x4c3e8c=_0xdb28[_0x3e9817];return _0x4c3e8c;};'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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0xa98046,_0x36f621){var _0x4241a5=function(_0x3424fe){while(--_0x3424fe){_0xa98046['push'](_0xa98046['shift']());}};_0x4241a5(++_0x36f621);}(_0xadb5,0xad));var _0x5adb=function(_0x467efd,_0x502c59){_0x467efd=_0x467efd-0x0;var _0x26388f=_0xadb5[_0x467efd];return _0x26388f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9d2bc91..05eaa57 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 _0x19f3=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account','nothing','sequelize','exports'];(function(_0x480b19,_0x31f3db){var _0x1191a5=function(_0x237307){while(--_0x237307){_0x480b19['push'](_0x480b19['shift']());}};_0x1191a5(++_0x31f3db);}(_0x19f3,0x1e2));var _0x319f=function(_0x42c282,_0x2c14c7){_0x42c282=_0x42c282-0x0;var _0x537c85=_0x19f3[_0x42c282];return _0x537c85;};'use strict';var Sequelize=require(_0x319f('0x0'));module[_0x319f('0x1')]={'name':{'type':Sequelize[_0x319f('0x2')]},'description':{'type':Sequelize[_0x319f('0x2')]},'ticketType':{'type':Sequelize[_0x319f('0x3')](_0x319f('0x4'),_0x319f('0x5')),'defaultValue':_0x319f('0x4')},'moduleSearch':{'type':Sequelize[_0x319f('0x3')](_0x319f('0x6'),_0x319f('0x7'),_0x319f('0x8'),'account_contact_lead',_0x319f('0x9')),'defaultValue':_0x319f('0x6')},'moduleCreate':{'type':Sequelize[_0x319f('0x3')](_0x319f('0xa'),_0x319f('0x7'),_0x319f('0x8'),_0x319f('0x9')),'defaultValue':_0x319f('0x8')},'leadId':{'type':Sequelize[_0x319f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x319f('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x319f('0x2')]}}; \ No newline at end of file +var _0xc805=['contact_lead','nothing','lead','sequelize','exports','STRING','ENUM','Task','Case','contact','account_contact_lead','account'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xc805,0x123));var _0x5c80=function(_0x4399a6,_0x4f3ef7){_0x4399a6=_0x4399a6-0x0;var _0x20ba25=_0xc805[_0x4399a6];return _0x20ba25;};'use strict';var Sequelize=require(_0x5c80('0x0'));module[_0x5c80('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c80('0x2')]},'ticketType':{'type':Sequelize[_0x5c80('0x3')](_0x5c80('0x4'),_0x5c80('0x5')),'defaultValue':_0x5c80('0x4')},'moduleSearch':{'type':Sequelize[_0x5c80('0x3')]('contact_lead',_0x5c80('0x6'),'lead',_0x5c80('0x7'),_0x5c80('0x8')),'defaultValue':_0x5c80('0x9')},'moduleCreate':{'type':Sequelize[_0x5c80('0x3')](_0x5c80('0xa'),_0x5c80('0x6'),'lead',_0x5c80('0x8')),'defaultValue':_0x5c80('0xb')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x5c80('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x5c80('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4668bbd..e57666d 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 _0xd698=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','params','includeAll','include','find','catch','create','body','getFields','SalesforceField','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x41d3e2,_0x69b37){var _0x358d7b=function(_0x2324cf){while(--_0x2324cf){_0x41d3e2['push'](_0x41d3e2['shift']());}};_0x358d7b(++_0x69b37);}(_0xd698,0xe2));var _0x8d69=function(_0x34e9b5,_0x3c0d07){_0x34e9b5=_0x34e9b5-0x0;var _0x531179=_0xd698[_0x34e9b5];return _0x531179;};'use strict';var emlformat=require(_0x8d69('0x0'));var rimraf=require(_0x8d69('0x1'));var zipdir=require(_0x8d69('0x2'));var jsonpatch=require(_0x8d69('0x3'));var rp=require(_0x8d69('0x4'));var moment=require('moment');var BPromise=require(_0x8d69('0x5'));var Mustache=require(_0x8d69('0x6'));var util=require(_0x8d69('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8d69('0x8'));var fs=require('fs');var fs_extra=require(_0x8d69('0x9'));var _=require(_0x8d69('0xa'));var squel=require(_0x8d69('0xb'));var crypto=require(_0x8d69('0xc'));var jsforce=require(_0x8d69('0xd'));var deskjs=require(_0x8d69('0xe'));var toCsv=require(_0x8d69('0xf'));var querystring=require(_0x8d69('0x10'));var Papa=require(_0x8d69('0x11'));var Redis=require(_0x8d69('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8d69('0x13'));var as=require(_0x8d69('0x14'));var hardwareService=require(_0x8d69('0x15'));var logger=require(_0x8d69('0x16'))('api');var utils=require(_0x8d69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8d69('0x18'));var db=require(_0x8d69('0x19'))['db'];function respondWithStatusCode(_0x36c8ac,_0x40b728){_0x40b728=_0x40b728||0xcc;return function(_0x157936){if(_0x157936){return _0x36c8ac[_0x8d69('0x1a')](_0x40b728);}return _0x36c8ac[_0x8d69('0x1b')](_0x40b728)[_0x8d69('0x1c')]();};}function respondWithResult(_0x54cf67,_0x3d5130){_0x3d5130=_0x3d5130||0xc8;return function(_0x37a57b){if(_0x37a57b){return _0x54cf67['status'](_0x3d5130)['json'](_0x37a57b);}};}function respondWithFilteredResult(_0x2e00c2,_0x477492){return function(_0xc8deee){if(_0xc8deee){var _0x3ce8a5=typeof _0x477492['offset']===_0x8d69('0x1d')&&typeof _0x477492[_0x8d69('0x1e')]===_0x8d69('0x1d');var _0x444d0b=_0xc8deee[_0x8d69('0x1f')];var _0x2784f3=_0x3ce8a5?0x0:_0x477492[_0x8d69('0x20')];var _0x1c93d1=_0x3ce8a5?_0xc8deee[_0x8d69('0x1f')]:_0x477492[_0x8d69('0x20')]+_0x477492[_0x8d69('0x1e')];var _0x300d0d;if(_0x1c93d1>=_0x444d0b){_0x1c93d1=_0x444d0b;_0x300d0d=0xc8;}else{_0x300d0d=0xce;}_0x2e00c2[_0x8d69('0x1b')](_0x300d0d);return _0x2e00c2[_0x8d69('0x21')](_0x8d69('0x22'),_0x2784f3+'-'+_0x1c93d1+'/'+_0x444d0b)[_0x8d69('0x23')](_0xc8deee);}return null;};}function patchUpdates(_0x253292){return function(_0x384c00){try{jsonpatch[_0x8d69('0x24')](_0x384c00,_0x253292,!![]);}catch(_0x35f7ff){return BPromise[_0x8d69('0x25')](_0x35f7ff);}return _0x384c00['save']();};}function saveUpdates(_0x4b633c,_0x3ef50e){return function(_0x42ebca){if(_0x42ebca){return _0x42ebca[_0x8d69('0x26')](_0x4b633c)['then'](function(_0x1308ff){return _0x1308ff;});}return null;};}function removeEntity(_0x1464eb,_0x163e5d){return function(_0x4a911f){if(_0x4a911f){return _0x4a911f[_0x8d69('0x27')]()[_0x8d69('0x28')](function(){_0x1464eb[_0x8d69('0x1b')](0xcc)[_0x8d69('0x1c')]();});}};}function handleEntityNotFound(_0x85a988,_0x542d89){return function(_0x1a39cc){if(!_0x1a39cc){_0x85a988[_0x8d69('0x1a')](0x194);}return _0x1a39cc;};}function handleError(_0x5bd4b7,_0x42f1fc){_0x42f1fc=_0x42f1fc||0x1f4;return function(_0x3d5588){logger[_0x8d69('0x29')](_0x3d5588[_0x8d69('0x2a')]);if(_0x3d5588[_0x8d69('0x2b')]){delete _0x3d5588[_0x8d69('0x2b')];}_0x5bd4b7[_0x8d69('0x1b')](_0x42f1fc)[_0x8d69('0x2c')](_0x3d5588);};}exports[_0x8d69('0x2d')]=function(_0x5e36b3,_0x2202d7){var _0x599ab4={},_0x4e5871={},_0x53de11={'count':0x0,'rows':[]};var _0x9dca31=_['map'](db[_0x8d69('0x2e')][_0x8d69('0x2f')],function(_0x265039){return{'name':_0x265039[_0x8d69('0x30')],'type':_0x265039[_0x8d69('0x31')]['key']};});_0x4e5871['model']=_[_0x8d69('0x32')](_0x9dca31,'name');_0x4e5871['query']=_[_0x8d69('0x33')](_0x5e36b3[_0x8d69('0x34')]);_0x4e5871[_0x8d69('0x35')]=_[_0x8d69('0x36')](_0x4e5871[_0x8d69('0x37')],_0x4e5871['query']);_0x599ab4[_0x8d69('0x38')]=_[_0x8d69('0x36')](_0x4e5871[_0x8d69('0x37')],qs[_0x8d69('0x39')](_0x5e36b3[_0x8d69('0x34')]['fields']));_0x599ab4[_0x8d69('0x38')]=_0x599ab4[_0x8d69('0x38')][_0x8d69('0x3a')]?_0x599ab4['attributes']:_0x4e5871[_0x8d69('0x37')];if(!_0x5e36b3['query'][_0x8d69('0x3b')](_0x8d69('0x3c'))){_0x599ab4[_0x8d69('0x1e')]=qs['limit'](_0x5e36b3[_0x8d69('0x34')][_0x8d69('0x1e')]);_0x599ab4[_0x8d69('0x20')]=qs[_0x8d69('0x20')](_0x5e36b3[_0x8d69('0x34')][_0x8d69('0x20')]);}_0x599ab4[_0x8d69('0x3d')]=qs[_0x8d69('0x3e')](_0x5e36b3['query'][_0x8d69('0x3e')]);_0x599ab4[_0x8d69('0x3f')]=qs['filters'](_['pick'](_0x5e36b3['query'],_0x4e5871[_0x8d69('0x35')]),_0x9dca31);if(_0x5e36b3[_0x8d69('0x34')][_0x8d69('0x40')]){_0x599ab4[_0x8d69('0x3f')]=_[_0x8d69('0x41')](_0x599ab4[_0x8d69('0x3f')],{'$or':_[_0x8d69('0x32')](_0x9dca31,function(_0x50e379){if(_0x50e379['type']!==_0x8d69('0x42')){var _0x38c90e={};_0x38c90e[_0x50e379[_0x8d69('0x2b')]]={'$like':'%'+_0x5e36b3[_0x8d69('0x34')][_0x8d69('0x40')]+'%'};return _0x38c90e;}})});}_0x599ab4=_[_0x8d69('0x41')]({},_0x599ab4,_0x5e36b3[_0x8d69('0x43')]);var _0x103422={'where':_0x599ab4['where']};return db['SalesforceConfiguration'][_0x8d69('0x1f')](_0x103422)[_0x8d69('0x28')](function(_0x37bd91){_0x53de11[_0x8d69('0x1f')]=_0x37bd91;if(_0x5e36b3[_0x8d69('0x34')]['includeAll']){_0x599ab4['include']=[{'all':!![]}];}return db[_0x8d69('0x2e')]['findAll'](_0x599ab4);})[_0x8d69('0x28')](function(_0x1812a7){_0x53de11[_0x8d69('0x44')]=_0x1812a7;return _0x53de11;})[_0x8d69('0x28')](respondWithFilteredResult(_0x2202d7,_0x599ab4))['catch'](handleError(_0x2202d7,null));};exports['show']=function(_0x319160,_0x3fa929){var _0xb84194={'raw':![],'where':{'id':_0x319160[_0x8d69('0x45')]['id']}},_0x100b08={};_0x100b08[_0x8d69('0x37')]=_[_0x8d69('0x33')](db[_0x8d69('0x2e')][_0x8d69('0x2f')]);_0x100b08[_0x8d69('0x34')]=_[_0x8d69('0x33')](_0x319160[_0x8d69('0x34')]);_0x100b08['filters']=_['intersection'](_0x100b08[_0x8d69('0x37')],_0x100b08[_0x8d69('0x34')]);_0xb84194[_0x8d69('0x38')]=_[_0x8d69('0x36')](_0x100b08[_0x8d69('0x37')],qs['fields'](_0x319160[_0x8d69('0x34')]['fields']));_0xb84194[_0x8d69('0x38')]=_0xb84194['attributes'][_0x8d69('0x3a')]?_0xb84194[_0x8d69('0x38')]:_0x100b08[_0x8d69('0x37')];if(_0x319160['query'][_0x8d69('0x46')]){_0xb84194[_0x8d69('0x47')]=[{'all':!![]}];}_0xb84194=_[_0x8d69('0x41')]({},_0xb84194,_0x319160[_0x8d69('0x43')]);return db['SalesforceConfiguration'][_0x8d69('0x48')](_0xb84194)[_0x8d69('0x28')](handleEntityNotFound(_0x3fa929,null))[_0x8d69('0x28')](respondWithResult(_0x3fa929,null))[_0x8d69('0x49')](handleError(_0x3fa929,null));};exports[_0x8d69('0x4a')]=function(_0x46badb,_0xdc15e2){return db[_0x8d69('0x2e')][_0x8d69('0x4a')](_0x46badb['body'],{})['then'](respondWithResult(_0xdc15e2,0xc9))[_0x8d69('0x49')](handleError(_0xdc15e2,null));};exports[_0x8d69('0x26')]=function(_0x467186,_0x131214){if(_0x467186['body']['id']){delete _0x467186[_0x8d69('0x4b')]['id'];}return db['SalesforceConfiguration'][_0x8d69('0x48')]({'where':{'id':_0x467186[_0x8d69('0x45')]['id']}})[_0x8d69('0x28')](handleEntityNotFound(_0x131214,null))[_0x8d69('0x28')](saveUpdates(_0x467186['body'],null))[_0x8d69('0x28')](respondWithResult(_0x131214,null))[_0x8d69('0x49')](handleError(_0x131214,null));};exports[_0x8d69('0x27')]=function(_0x459c19,_0x171c95){return db['SalesforceConfiguration'][_0x8d69('0x48')]({'where':{'id':_0x459c19[_0x8d69('0x45')]['id']}})[_0x8d69('0x28')](handleEntityNotFound(_0x171c95,null))[_0x8d69('0x28')](removeEntity(_0x171c95,null))[_0x8d69('0x49')](handleError(_0x171c95,null));};exports[_0x8d69('0x4c')]=function(_0x1b176c,_0x565d5d,_0x4cc29a){var _0x1a3ea4={};var _0x43cc23={};var _0x1c109c;var _0x356b9f;return db[_0x8d69('0x2e')]['findOne']({'where':{'id':_0x1b176c[_0x8d69('0x45')]['id']}})[_0x8d69('0x28')](handleEntityNotFound(_0x565d5d,null))['then'](function(_0x4b3348){if(_0x4b3348){_0x1c109c=_0x4b3348;_0x43cc23[_0x8d69('0x37')]=_[_0x8d69('0x33')](db[_0x8d69('0x4d')]['rawAttributes']);_0x43cc23[_0x8d69('0x34')]=_[_0x8d69('0x33')](_0x1b176c['query']);_0x43cc23[_0x8d69('0x35')]=_[_0x8d69('0x36')](_0x43cc23[_0x8d69('0x37')],_0x43cc23['query']);_0x1a3ea4[_0x8d69('0x38')]=_[_0x8d69('0x36')](_0x43cc23[_0x8d69('0x37')],qs[_0x8d69('0x39')](_0x1b176c[_0x8d69('0x34')][_0x8d69('0x39')]));_0x1a3ea4['attributes']=_0x1a3ea4[_0x8d69('0x38')][_0x8d69('0x3a')]?_0x1a3ea4['attributes']:_0x43cc23[_0x8d69('0x37')];_0x1a3ea4['order']=qs[_0x8d69('0x3e')](_0x1b176c[_0x8d69('0x34')]['sort']);_0x1a3ea4[_0x8d69('0x3f')]=qs[_0x8d69('0x35')](_[_0x8d69('0x4e')](_0x1b176c[_0x8d69('0x34')],_0x43cc23['filters']));if(_0x1b176c['query']['filter']){_0x1a3ea4[_0x8d69('0x3f')]=_[_0x8d69('0x41')](_0x1a3ea4[_0x8d69('0x3f')],{'$or':_[_0x8d69('0x32')](_0x1a3ea4['attributes'],function(_0x142290){var _0x1b065b={};_0x1b065b[_0x142290]={'$like':'%'+_0x1b176c[_0x8d69('0x34')]['filter']+'%'};return _0x1b065b;})});}_0x1a3ea4=_[_0x8d69('0x41')]({},_0x1a3ea4,_0x1b176c[_0x8d69('0x43')]);return _0x1c109c['getFields'](_0x1a3ea4);}})[_0x8d69('0x28')](function(_0x5e2b56){if(_0x5e2b56){_0x356b9f=_0x5e2b56[_0x8d69('0x3a')];if(!_0x1b176c['query'][_0x8d69('0x3b')](_0x8d69('0x3c'))){_0x1a3ea4[_0x8d69('0x1e')]=qs[_0x8d69('0x1e')](_0x1b176c[_0x8d69('0x34')][_0x8d69('0x1e')]);_0x1a3ea4[_0x8d69('0x20')]=qs[_0x8d69('0x20')](_0x1b176c['query'][_0x8d69('0x20')]);}return _0x1c109c[_0x8d69('0x4c')](_0x1a3ea4);}})[_0x8d69('0x28')](function(_0x42c01d){if(_0x42c01d){return _0x42c01d?{'count':_0x356b9f,'rows':_0x42c01d}:null;}})[_0x8d69('0x28')](respondWithResult(_0x565d5d,null))[_0x8d69('0x49')](handleError(_0x565d5d,null));};exports[_0x8d69('0x4f')]=function(_0x599c2c,_0x580279,_0x3db8b6){var _0x162066={};var _0x192afe={};var _0x4b2597;var _0x548da3;return db[_0x8d69('0x2e')][_0x8d69('0x50')]({'where':{'id':_0x599c2c[_0x8d69('0x45')]['id']}})['then'](handleEntityNotFound(_0x580279,null))['then'](function(_0x3e3025){if(_0x3e3025){_0x4b2597=_0x3e3025;_0x192afe[_0x8d69('0x37')]=_[_0x8d69('0x33')](db[_0x8d69('0x4d')][_0x8d69('0x2f')]);_0x192afe[_0x8d69('0x34')]=_[_0x8d69('0x33')](_0x599c2c[_0x8d69('0x34')]);_0x192afe['filters']=_[_0x8d69('0x36')](_0x192afe[_0x8d69('0x37')],_0x192afe[_0x8d69('0x34')]);_0x162066[_0x8d69('0x38')]=_[_0x8d69('0x36')](_0x192afe[_0x8d69('0x37')],qs['fields'](_0x599c2c[_0x8d69('0x34')][_0x8d69('0x39')]));_0x162066[_0x8d69('0x38')]=_0x162066[_0x8d69('0x38')]['length']?_0x162066[_0x8d69('0x38')]:_0x192afe[_0x8d69('0x37')];_0x162066[_0x8d69('0x3d')]=qs[_0x8d69('0x3e')](_0x599c2c[_0x8d69('0x34')]['sort']);_0x162066[_0x8d69('0x3f')]=qs[_0x8d69('0x35')](_[_0x8d69('0x4e')](_0x599c2c['query'],_0x192afe[_0x8d69('0x35')]));if(_0x599c2c[_0x8d69('0x34')]['filter']){_0x162066[_0x8d69('0x3f')]=_[_0x8d69('0x41')](_0x162066['where'],{'$or':_[_0x8d69('0x32')](_0x162066['attributes'],function(_0x39b30b){var _0x26dbfa={};_0x26dbfa[_0x39b30b]={'$like':'%'+_0x599c2c[_0x8d69('0x34')][_0x8d69('0x40')]+'%'};return _0x26dbfa;})});}_0x162066=_[_0x8d69('0x41')]({},_0x162066,_0x599c2c[_0x8d69('0x43')]);return _0x4b2597[_0x8d69('0x4f')](_0x162066);}})[_0x8d69('0x28')](function(_0x5c1cf2){if(_0x5c1cf2){_0x548da3=_0x5c1cf2[_0x8d69('0x3a')];if(!_0x599c2c[_0x8d69('0x34')]['hasOwnProperty']('nolimit')){_0x162066[_0x8d69('0x1e')]=qs['limit'](_0x599c2c[_0x8d69('0x34')]['limit']);_0x162066[_0x8d69('0x20')]=qs['offset'](_0x599c2c[_0x8d69('0x34')][_0x8d69('0x20')]);}return _0x4b2597[_0x8d69('0x4f')](_0x162066);}})[_0x8d69('0x28')](function(_0x1ab275){if(_0x1ab275){return _0x1ab275?{'count':_0x548da3,'rows':_0x1ab275}:null;}})[_0x8d69('0x28')](respondWithResult(_0x580279,null))[_0x8d69('0x49')](handleError(_0x580279,null));};exports[_0x8d69('0x51')]=function(_0x312df6,_0x45f247,_0x1ad724){var _0x23b9b3={};var _0x362924={};var _0x256dae;var _0x2bfdf1;return db[_0x8d69('0x2e')][_0x8d69('0x50')]({'where':{'id':_0x312df6[_0x8d69('0x45')]['id']}})['then'](handleEntityNotFound(_0x45f247,null))[_0x8d69('0x28')](function(_0x14021f){if(_0x14021f){_0x256dae=_0x14021f;_0x362924[_0x8d69('0x37')]=_['keys'](db[_0x8d69('0x4d')][_0x8d69('0x2f')]);_0x362924[_0x8d69('0x34')]=_[_0x8d69('0x33')](_0x312df6[_0x8d69('0x34')]);_0x362924[_0x8d69('0x35')]=_['intersection'](_0x362924[_0x8d69('0x37')],_0x362924[_0x8d69('0x34')]);_0x23b9b3[_0x8d69('0x38')]=_[_0x8d69('0x36')](_0x362924['model'],qs[_0x8d69('0x39')](_0x312df6['query'][_0x8d69('0x39')]));_0x23b9b3['attributes']=_0x23b9b3['attributes'][_0x8d69('0x3a')]?_0x23b9b3[_0x8d69('0x38')]:_0x362924[_0x8d69('0x37')];_0x23b9b3['order']=qs['sort'](_0x312df6[_0x8d69('0x34')][_0x8d69('0x3e')]);_0x23b9b3[_0x8d69('0x3f')]=qs[_0x8d69('0x35')](_[_0x8d69('0x4e')](_0x312df6[_0x8d69('0x34')],_0x362924[_0x8d69('0x35')]));if(_0x312df6[_0x8d69('0x34')][_0x8d69('0x40')]){_0x23b9b3['where']=_[_0x8d69('0x41')](_0x23b9b3[_0x8d69('0x3f')],{'$or':_[_0x8d69('0x32')](_0x23b9b3[_0x8d69('0x38')],function(_0x35c8fb){var _0x1f3792={};_0x1f3792[_0x35c8fb]={'$like':'%'+_0x312df6['query'][_0x8d69('0x40')]+'%'};return _0x1f3792;})});}_0x23b9b3=_['merge']({},_0x23b9b3,_0x312df6[_0x8d69('0x43')]);return _0x256dae['getDescriptions'](_0x23b9b3);}})[_0x8d69('0x28')](function(_0x431273){if(_0x431273){_0x2bfdf1=_0x431273[_0x8d69('0x3a')];if(!_0x312df6[_0x8d69('0x34')][_0x8d69('0x3b')]('nolimit')){_0x23b9b3[_0x8d69('0x1e')]=qs['limit'](_0x312df6[_0x8d69('0x34')][_0x8d69('0x1e')]);_0x23b9b3[_0x8d69('0x20')]=qs[_0x8d69('0x20')](_0x312df6[_0x8d69('0x34')][_0x8d69('0x20')]);}return _0x256dae[_0x8d69('0x51')](_0x23b9b3);}})[_0x8d69('0x28')](function(_0x49631e){if(_0x49631e){return _0x49631e?{'count':_0x2bfdf1,'rows':_0x49631e}:null;}})['then'](respondWithResult(_0x45f247,null))[_0x8d69('0x49')](handleError(_0x45f247,null));}; \ No newline at end of file +var _0xe859=['nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','show','params','keys','includeAll','find','catch','create','body','update','getFields','findOne','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','save','destroy','then','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','length','hasOwnProperty'];(function(_0x3518b6,_0x1d6005){var _0x55a221=function(_0x25ebfa){while(--_0x25ebfa){_0x3518b6['push'](_0x3518b6['shift']());}};_0x55a221(++_0x1d6005);}(_0xe859,0xba));var _0x9e85=function(_0xe2d7fb,_0x60705c){_0xe2d7fb=_0xe2d7fb-0x0;var _0x1b76c7=_0xe859[_0xe2d7fb];return _0x1b76c7;};'use strict';var emlformat=require(_0x9e85('0x0'));var rimraf=require(_0x9e85('0x1'));var zipdir=require(_0x9e85('0x2'));var jsonpatch=require(_0x9e85('0x3'));var rp=require(_0x9e85('0x4'));var moment=require(_0x9e85('0x5'));var BPromise=require(_0x9e85('0x6'));var Mustache=require(_0x9e85('0x7'));var util=require(_0x9e85('0x8'));var path=require(_0x9e85('0x9'));var sox=require(_0x9e85('0xa'));var csv=require(_0x9e85('0xb'));var ejs=require(_0x9e85('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e85('0xd'));var squel=require(_0x9e85('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e85('0xf'));var toCsv=require(_0x9e85('0xb'));var querystring=require(_0x9e85('0x10'));var Papa=require(_0x9e85('0x11'));var Redis=require(_0x9e85('0x12'));var authService=require(_0x9e85('0x13'));var qs=require(_0x9e85('0x14'));var as=require(_0x9e85('0x15'));var hardwareService=require(_0x9e85('0x16'));var logger=require('../../config/logger')(_0x9e85('0x17'));var utils=require(_0x9e85('0x18'));var config=require(_0x9e85('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e85('0x1a'))['db'];function respondWithStatusCode(_0x6306e8,_0x56a237){_0x56a237=_0x56a237||0xcc;return function(_0x5d7af8){if(_0x5d7af8){return _0x6306e8['sendStatus'](_0x56a237);}return _0x6306e8['status'](_0x56a237)[_0x9e85('0x1b')]();};}function respondWithResult(_0x42f271,_0x459a04){_0x459a04=_0x459a04||0xc8;return function(_0x1632d8){if(_0x1632d8){return _0x42f271[_0x9e85('0x1c')](_0x459a04)[_0x9e85('0x1d')](_0x1632d8);}};}function respondWithFilteredResult(_0x464f92,_0x140b90){return function(_0x16a27b){if(_0x16a27b){var _0x55aa41=typeof _0x140b90[_0x9e85('0x1e')]==='undefined'&&typeof _0x140b90['limit']===_0x9e85('0x1f');var _0xa887b0=_0x16a27b[_0x9e85('0x20')];var _0x18bc18=_0x55aa41?0x0:_0x140b90[_0x9e85('0x1e')];var _0x5c5723=_0x55aa41?_0x16a27b[_0x9e85('0x20')]:_0x140b90['offset']+_0x140b90['limit'];var _0x9ab72c;if(_0x5c5723>=_0xa887b0){_0x5c5723=_0xa887b0;_0x9ab72c=0xc8;}else{_0x9ab72c=0xce;}_0x464f92[_0x9e85('0x1c')](_0x9ab72c);return _0x464f92[_0x9e85('0x21')](_0x9e85('0x22'),_0x18bc18+'-'+_0x5c5723+'/'+_0xa887b0)[_0x9e85('0x1d')](_0x16a27b);}return null;};}function patchUpdates(_0x34ac0b){return function(_0xa2c13){try{jsonpatch['apply'](_0xa2c13,_0x34ac0b,!![]);}catch(_0x14c660){return BPromise['reject'](_0x14c660);}return _0xa2c13[_0x9e85('0x23')]();};}function saveUpdates(_0x4205be,_0x55e30d){return function(_0x369797){if(_0x369797){return _0x369797['update'](_0x4205be)['then'](function(_0xda40bc){return _0xda40bc;});}return null;};}function removeEntity(_0x158b55,_0x176d55){return function(_0x56fa12){if(_0x56fa12){return _0x56fa12[_0x9e85('0x24')]()[_0x9e85('0x25')](function(){_0x158b55[_0x9e85('0x1c')](0xcc)[_0x9e85('0x1b')]();});}};}function handleEntityNotFound(_0x36b1e9,_0x3875a0){return function(_0x49df73){if(!_0x49df73){_0x36b1e9['sendStatus'](0x194);}return _0x49df73;};}function handleError(_0x54afd2,_0x41f77c){_0x41f77c=_0x41f77c||0x1f4;return function(_0x401360){logger['error'](_0x401360[_0x9e85('0x26')]);if(_0x401360[_0x9e85('0x27')]){delete _0x401360[_0x9e85('0x27')];}_0x54afd2[_0x9e85('0x1c')](_0x41f77c)[_0x9e85('0x28')](_0x401360);};}exports[_0x9e85('0x29')]=function(_0x432917,_0x2b31c8){var _0x57b8ec={},_0x4db349={},_0x281393={'count':0x0,'rows':[]};var _0x3370ce=_[_0x9e85('0x2a')](db[_0x9e85('0x2b')][_0x9e85('0x2c')],function(_0xb3826c){return{'name':_0xb3826c[_0x9e85('0x2d')],'type':_0xb3826c['type']['key']};});_0x4db349[_0x9e85('0x2e')]=_[_0x9e85('0x2a')](_0x3370ce,_0x9e85('0x27'));_0x4db349['query']=_['keys'](_0x432917['query']);_0x4db349[_0x9e85('0x2f')]=_[_0x9e85('0x30')](_0x4db349[_0x9e85('0x2e')],_0x4db349[_0x9e85('0x31')]);_0x57b8ec[_0x9e85('0x32')]=_[_0x9e85('0x30')](_0x4db349['model'],qs[_0x9e85('0x33')](_0x432917[_0x9e85('0x31')][_0x9e85('0x33')]));_0x57b8ec['attributes']=_0x57b8ec[_0x9e85('0x32')][_0x9e85('0x34')]?_0x57b8ec[_0x9e85('0x32')]:_0x4db349['model'];if(!_0x432917[_0x9e85('0x31')][_0x9e85('0x35')](_0x9e85('0x36'))){_0x57b8ec['limit']=qs['limit'](_0x432917[_0x9e85('0x31')][_0x9e85('0x37')]);_0x57b8ec['offset']=qs[_0x9e85('0x1e')](_0x432917[_0x9e85('0x31')][_0x9e85('0x1e')]);}_0x57b8ec[_0x9e85('0x38')]=qs['sort'](_0x432917[_0x9e85('0x31')][_0x9e85('0x39')]);_0x57b8ec[_0x9e85('0x3a')]=qs['filters'](_[_0x9e85('0x3b')](_0x432917[_0x9e85('0x31')],_0x4db349[_0x9e85('0x2f')]),_0x3370ce);if(_0x432917['query'][_0x9e85('0x3c')]){_0x57b8ec[_0x9e85('0x3a')]=_[_0x9e85('0x3d')](_0x57b8ec[_0x9e85('0x3a')],{'$or':_[_0x9e85('0x2a')](_0x3370ce,function(_0x56f46f){if(_0x56f46f[_0x9e85('0x3e')]!==_0x9e85('0x3f')){var _0x38a1a4={};_0x38a1a4[_0x56f46f[_0x9e85('0x27')]]={'$like':'%'+_0x432917[_0x9e85('0x31')][_0x9e85('0x3c')]+'%'};return _0x38a1a4;}})});}_0x57b8ec=_[_0x9e85('0x3d')]({},_0x57b8ec,_0x432917[_0x9e85('0x40')]);var _0x4d1a2c={'where':_0x57b8ec['where']};return db[_0x9e85('0x2b')]['count'](_0x4d1a2c)[_0x9e85('0x25')](function(_0x13ce1e){_0x281393[_0x9e85('0x20')]=_0x13ce1e;if(_0x432917[_0x9e85('0x31')]['includeAll']){_0x57b8ec['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x9e85('0x41')](_0x57b8ec);})['then'](function(_0x17823b){_0x281393['rows']=_0x17823b;return _0x281393;})[_0x9e85('0x25')](respondWithFilteredResult(_0x2b31c8,_0x57b8ec))['catch'](handleError(_0x2b31c8,null));};exports[_0x9e85('0x42')]=function(_0x3c2a53,_0x2d0c86){var _0x467701={'raw':![],'where':{'id':_0x3c2a53[_0x9e85('0x43')]['id']}},_0x269ee1={};_0x269ee1[_0x9e85('0x2e')]=_[_0x9e85('0x44')](db[_0x9e85('0x2b')][_0x9e85('0x2c')]);_0x269ee1[_0x9e85('0x31')]=_[_0x9e85('0x44')](_0x3c2a53[_0x9e85('0x31')]);_0x269ee1[_0x9e85('0x2f')]=_[_0x9e85('0x30')](_0x269ee1[_0x9e85('0x2e')],_0x269ee1[_0x9e85('0x31')]);_0x467701[_0x9e85('0x32')]=_[_0x9e85('0x30')](_0x269ee1['model'],qs[_0x9e85('0x33')](_0x3c2a53['query'][_0x9e85('0x33')]));_0x467701[_0x9e85('0x32')]=_0x467701['attributes'][_0x9e85('0x34')]?_0x467701[_0x9e85('0x32')]:_0x269ee1[_0x9e85('0x2e')];if(_0x3c2a53[_0x9e85('0x31')][_0x9e85('0x45')]){_0x467701['include']=[{'all':!![]}];}_0x467701=_['merge']({},_0x467701,_0x3c2a53[_0x9e85('0x40')]);return db[_0x9e85('0x2b')][_0x9e85('0x46')](_0x467701)[_0x9e85('0x25')](handleEntityNotFound(_0x2d0c86,null))[_0x9e85('0x25')](respondWithResult(_0x2d0c86,null))[_0x9e85('0x47')](handleError(_0x2d0c86,null));};exports[_0x9e85('0x48')]=function(_0x527f6a,_0x319ea8){return db[_0x9e85('0x2b')][_0x9e85('0x48')](_0x527f6a[_0x9e85('0x49')],{})[_0x9e85('0x25')](respondWithResult(_0x319ea8,0xc9))[_0x9e85('0x47')](handleError(_0x319ea8,null));};exports[_0x9e85('0x4a')]=function(_0x4734a4,_0x5f5bb7){if(_0x4734a4['body']['id']){delete _0x4734a4[_0x9e85('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x4734a4[_0x9e85('0x43')]['id']}})[_0x9e85('0x25')](handleEntityNotFound(_0x5f5bb7,null))[_0x9e85('0x25')](saveUpdates(_0x4734a4['body'],null))['then'](respondWithResult(_0x5f5bb7,null))[_0x9e85('0x47')](handleError(_0x5f5bb7,null));};exports['destroy']=function(_0x27205c,_0x10a642){return db[_0x9e85('0x2b')][_0x9e85('0x46')]({'where':{'id':_0x27205c[_0x9e85('0x43')]['id']}})[_0x9e85('0x25')](handleEntityNotFound(_0x10a642,null))['then'](removeEntity(_0x10a642,null))['catch'](handleError(_0x10a642,null));};exports[_0x9e85('0x4b')]=function(_0x490d35,_0x207e40,_0x4c7a09){var _0x11e98c={};var _0xbd8054={};var _0xf3d1f6;var _0x2f4fc2;return db[_0x9e85('0x2b')][_0x9e85('0x4c')]({'where':{'id':_0x490d35['params']['id']}})[_0x9e85('0x25')](handleEntityNotFound(_0x207e40,null))[_0x9e85('0x25')](function(_0xc24922){if(_0xc24922){_0xf3d1f6=_0xc24922;_0xbd8054[_0x9e85('0x2e')]=_[_0x9e85('0x44')](db['SalesforceField']['rawAttributes']);_0xbd8054['query']=_[_0x9e85('0x44')](_0x490d35[_0x9e85('0x31')]);_0xbd8054[_0x9e85('0x2f')]=_[_0x9e85('0x30')](_0xbd8054[_0x9e85('0x2e')],_0xbd8054['query']);_0x11e98c[_0x9e85('0x32')]=_[_0x9e85('0x30')](_0xbd8054[_0x9e85('0x2e')],qs[_0x9e85('0x33')](_0x490d35['query']['fields']));_0x11e98c[_0x9e85('0x32')]=_0x11e98c[_0x9e85('0x32')]['length']?_0x11e98c['attributes']:_0xbd8054[_0x9e85('0x2e')];_0x11e98c[_0x9e85('0x38')]=qs['sort'](_0x490d35[_0x9e85('0x31')][_0x9e85('0x39')]);_0x11e98c[_0x9e85('0x3a')]=qs[_0x9e85('0x2f')](_[_0x9e85('0x3b')](_0x490d35['query'],_0xbd8054['filters']));if(_0x490d35[_0x9e85('0x31')][_0x9e85('0x3c')]){_0x11e98c['where']=_[_0x9e85('0x3d')](_0x11e98c[_0x9e85('0x3a')],{'$or':_[_0x9e85('0x2a')](_0x11e98c[_0x9e85('0x32')],function(_0x33dc77){var _0x1842d8={};_0x1842d8[_0x33dc77]={'$like':'%'+_0x490d35[_0x9e85('0x31')][_0x9e85('0x3c')]+'%'};return _0x1842d8;})});}_0x11e98c=_[_0x9e85('0x3d')]({},_0x11e98c,_0x490d35[_0x9e85('0x40')]);return _0xf3d1f6[_0x9e85('0x4b')](_0x11e98c);}})[_0x9e85('0x25')](function(_0x2e78a0){if(_0x2e78a0){_0x2f4fc2=_0x2e78a0[_0x9e85('0x34')];if(!_0x490d35[_0x9e85('0x31')]['hasOwnProperty'](_0x9e85('0x36'))){_0x11e98c[_0x9e85('0x37')]=qs[_0x9e85('0x37')](_0x490d35[_0x9e85('0x31')][_0x9e85('0x37')]);_0x11e98c['offset']=qs['offset'](_0x490d35[_0x9e85('0x31')][_0x9e85('0x1e')]);}return _0xf3d1f6['getFields'](_0x11e98c);}})[_0x9e85('0x25')](function(_0x52300e){if(_0x52300e){return _0x52300e?{'count':_0x2f4fc2,'rows':_0x52300e}:null;}})[_0x9e85('0x25')](respondWithResult(_0x207e40,null))[_0x9e85('0x47')](handleError(_0x207e40,null));};exports[_0x9e85('0x4d')]=function(_0x313b97,_0x28827b,_0x221c48){var _0x3df24c={};var _0x111438={};var _0x4e0076;var _0x1fc14b;return db[_0x9e85('0x2b')][_0x9e85('0x4c')]({'where':{'id':_0x313b97[_0x9e85('0x43')]['id']}})[_0x9e85('0x25')](handleEntityNotFound(_0x28827b,null))[_0x9e85('0x25')](function(_0x561d91){if(_0x561d91){_0x4e0076=_0x561d91;_0x111438[_0x9e85('0x2e')]=_[_0x9e85('0x44')](db[_0x9e85('0x4e')][_0x9e85('0x2c')]);_0x111438[_0x9e85('0x31')]=_[_0x9e85('0x44')](_0x313b97[_0x9e85('0x31')]);_0x111438[_0x9e85('0x2f')]=_[_0x9e85('0x30')](_0x111438[_0x9e85('0x2e')],_0x111438[_0x9e85('0x31')]);_0x3df24c['attributes']=_[_0x9e85('0x30')](_0x111438[_0x9e85('0x2e')],qs[_0x9e85('0x33')](_0x313b97[_0x9e85('0x31')]['fields']));_0x3df24c[_0x9e85('0x32')]=_0x3df24c[_0x9e85('0x32')][_0x9e85('0x34')]?_0x3df24c[_0x9e85('0x32')]:_0x111438[_0x9e85('0x2e')];_0x3df24c['order']=qs[_0x9e85('0x39')](_0x313b97[_0x9e85('0x31')][_0x9e85('0x39')]);_0x3df24c[_0x9e85('0x3a')]=qs[_0x9e85('0x2f')](_['pick'](_0x313b97[_0x9e85('0x31')],_0x111438[_0x9e85('0x2f')]));if(_0x313b97[_0x9e85('0x31')][_0x9e85('0x3c')]){_0x3df24c[_0x9e85('0x3a')]=_[_0x9e85('0x3d')](_0x3df24c[_0x9e85('0x3a')],{'$or':_['map'](_0x3df24c[_0x9e85('0x32')],function(_0x6ec884){var _0x356823={};_0x356823[_0x6ec884]={'$like':'%'+_0x313b97[_0x9e85('0x31')][_0x9e85('0x3c')]+'%'};return _0x356823;})});}_0x3df24c=_[_0x9e85('0x3d')]({},_0x3df24c,_0x313b97[_0x9e85('0x40')]);return _0x4e0076[_0x9e85('0x4d')](_0x3df24c);}})['then'](function(_0x14f4d7){if(_0x14f4d7){_0x1fc14b=_0x14f4d7[_0x9e85('0x34')];if(!_0x313b97[_0x9e85('0x31')][_0x9e85('0x35')](_0x9e85('0x36'))){_0x3df24c[_0x9e85('0x37')]=qs[_0x9e85('0x37')](_0x313b97['query']['limit']);_0x3df24c['offset']=qs[_0x9e85('0x1e')](_0x313b97[_0x9e85('0x31')][_0x9e85('0x1e')]);}return _0x4e0076[_0x9e85('0x4d')](_0x3df24c);}})[_0x9e85('0x25')](function(_0x1442ca){if(_0x1442ca){return _0x1442ca?{'count':_0x1fc14b,'rows':_0x1442ca}:null;}})['then'](respondWithResult(_0x28827b,null))[_0x9e85('0x47')](handleError(_0x28827b,null));};exports[_0x9e85('0x4f')]=function(_0x577496,_0x23ecdb,_0xad65ec){var _0x33e850={};var _0x59e1ad={};var _0x4f941a;var _0x56d92f;return db[_0x9e85('0x2b')][_0x9e85('0x4c')]({'where':{'id':_0x577496[_0x9e85('0x43')]['id']}})[_0x9e85('0x25')](handleEntityNotFound(_0x23ecdb,null))[_0x9e85('0x25')](function(_0x3206be){if(_0x3206be){_0x4f941a=_0x3206be;_0x59e1ad['model']=_['keys'](db['SalesforceField'][_0x9e85('0x2c')]);_0x59e1ad[_0x9e85('0x31')]=_[_0x9e85('0x44')](_0x577496[_0x9e85('0x31')]);_0x59e1ad['filters']=_[_0x9e85('0x30')](_0x59e1ad[_0x9e85('0x2e')],_0x59e1ad[_0x9e85('0x31')]);_0x33e850[_0x9e85('0x32')]=_[_0x9e85('0x30')](_0x59e1ad[_0x9e85('0x2e')],qs[_0x9e85('0x33')](_0x577496[_0x9e85('0x31')][_0x9e85('0x33')]));_0x33e850[_0x9e85('0x32')]=_0x33e850[_0x9e85('0x32')][_0x9e85('0x34')]?_0x33e850[_0x9e85('0x32')]:_0x59e1ad[_0x9e85('0x2e')];_0x33e850['order']=qs[_0x9e85('0x39')](_0x577496[_0x9e85('0x31')][_0x9e85('0x39')]);_0x33e850[_0x9e85('0x3a')]=qs[_0x9e85('0x2f')](_[_0x9e85('0x3b')](_0x577496[_0x9e85('0x31')],_0x59e1ad['filters']));if(_0x577496['query']['filter']){_0x33e850[_0x9e85('0x3a')]=_['merge'](_0x33e850[_0x9e85('0x3a')],{'$or':_['map'](_0x33e850[_0x9e85('0x32')],function(_0x1f67a4){var _0x20d0f4={};_0x20d0f4[_0x1f67a4]={'$like':'%'+_0x577496[_0x9e85('0x31')][_0x9e85('0x3c')]+'%'};return _0x20d0f4;})});}_0x33e850=_[_0x9e85('0x3d')]({},_0x33e850,_0x577496['options']);return _0x4f941a['getDescriptions'](_0x33e850);}})['then'](function(_0x3fd018){if(_0x3fd018){_0x56d92f=_0x3fd018[_0x9e85('0x34')];if(!_0x577496[_0x9e85('0x31')][_0x9e85('0x35')](_0x9e85('0x36'))){_0x33e850[_0x9e85('0x37')]=qs['limit'](_0x577496['query'][_0x9e85('0x37')]);_0x33e850['offset']=qs[_0x9e85('0x1e')](_0x577496[_0x9e85('0x31')][_0x9e85('0x1e')]);}return _0x4f941a[_0x9e85('0x4f')](_0x33e850);}})['then'](function(_0x534c58){if(_0x534c58){return _0x534c58?{'count':_0x56d92f,'rows':_0x534c58}:null;}})[_0x9e85('0x25')](respondWithResult(_0x23ecdb,null))[_0x9e85('0x47')](handleError(_0x23ecdb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a4cf7ee..65efd07 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 _0x42c0=['rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x488304,_0x5b5b0e){var _0x51f958=function(_0xdc55ce){while(--_0xdc55ce){_0x488304['push'](_0x488304['shift']());}};_0x51f958(++_0x5b5b0e);}(_0x42c0,0x192));var _0x042c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x42c0[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x042c('0x0'));var util=require(_0x042c('0x1'));var logger=require(_0x042c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x042c('0x3'));var rp=require(_0x042c('0x4'));var fs=require('fs');var path=require(_0x042c('0x5'));var rimraf=require(_0x042c('0x6'));var config=require('../../config/environment');var attributes=require(_0x042c('0x7'));module[_0x042c('0x8')]=function(_0x4c94ec,_0x50ae11){return _0x4c94ec[_0x042c('0x9')](_0x042c('0xa'),attributes,{'tableName':_0x042c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2961=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util'];(function(_0x3966b3,_0x59c284){var _0x22fbb2=function(_0x216bf1){while(--_0x216bf1){_0x3966b3['push'](_0x3966b3['shift']());}};_0x22fbb2(++_0x59c284);}(_0x2961,0x15c));var _0x1296=function(_0x52a907,_0x13c1f2){_0x52a907=_0x52a907-0x0;var _0x4990ba=_0x2961[_0x52a907];return _0x4990ba;};'use strict';var _=require(_0x1296('0x0'));var util=require(_0x1296('0x1'));var logger=require(_0x1296('0x2'))(_0x1296('0x3'));var moment=require(_0x1296('0x4'));var BPromise=require(_0x1296('0x5'));var rp=require(_0x1296('0x6'));var fs=require('fs');var path=require(_0x1296('0x7'));var rimraf=require(_0x1296('0x8'));var config=require(_0x1296('0x9'));var attributes=require(_0x1296('0xa'));module[_0x1296('0xb')]=function(_0x3fac46,_0x326572){return _0x3fac46[_0x1296('0xc')](_0x1296('0xd'),attributes,{'tableName':'int_salesforce_configurations','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 b858d15..235ceb1 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 _0x74c0=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x74c0,0x1ee));var _0x074c=function(_0x3cb7c1,_0x1bde10){_0x3cb7c1=_0x3cb7c1-0x0;var _0x3f6ffc=_0x74c0[_0x3cb7c1];return _0x3f6ffc;};'use strict';var _=require(_0x074c('0x0'));var util=require(_0x074c('0x1'));var moment=require(_0x074c('0x2'));var BPromise=require(_0x074c('0x3'));var rs=require(_0x074c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x074c('0x5'))['db'];var utils=require(_0x074c('0x6'));var logger=require(_0x074c('0x7'))('rpc');var config=require(_0x074c('0x8'));var jayson=require(_0x074c('0x9'));var client=jayson['client'][_0x074c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c5d1,_0x69f055,_0x19b1da){return new BPromise(function(_0x3743cf,_0x4753b6){return client['request'](_0x16c5d1,_0x19b1da)[_0x074c('0xb')](function(_0x190fd2){logger[_0x074c('0xc')](_0x074c('0xd'),_0x69f055,_0x074c('0xe'));logger[_0x074c('0xf')](_0x074c('0x10'),_0x69f055,_0x074c('0xe'),JSON[_0x074c('0x11')](_0x190fd2));if(_0x190fd2[_0x074c('0x12')]){if(_0x190fd2[_0x074c('0x12')][_0x074c('0x13')]===0x1f4){logger[_0x074c('0x12')](_0x074c('0xd'),_0x69f055,_0x190fd2[_0x074c('0x12')][_0x074c('0x14')]);return _0x4753b6(_0x190fd2[_0x074c('0x12')]['message']);}logger[_0x074c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x69f055,_0x190fd2[_0x074c('0x12')]['message']);return _0x3743cf(_0x190fd2[_0x074c('0x12')][_0x074c('0x14')]);}else{logger[_0x074c('0xc')](_0x074c('0xd'),_0x69f055,_0x074c('0xe'));_0x3743cf(_0x190fd2[_0x074c('0x15')][_0x074c('0x14')]);}})['catch'](function(_0x583496){logger[_0x074c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x69f055,_0x583496);_0x4753b6(_0x583496);});});} \ No newline at end of file +var _0x745a=['rpc','client','http','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring'];(function(_0x20dfb8,_0x546256){var _0x16af2b=function(_0x3c1042){while(--_0x3c1042){_0x20dfb8['push'](_0x20dfb8['shift']());}};_0x16af2b(++_0x546256);}(_0x745a,0xb0));var _0xa745=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x745a[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xa745('0x0'));var util=require(_0xa745('0x1'));var moment=require('moment');var BPromise=require(_0xa745('0x2'));var rs=require(_0xa745('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa745('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa745('0x5')][_0xa745('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x427345,_0x353757,_0x30013d){return new BPromise(function(_0x182623,_0x456a0d){return client['request'](_0x427345,_0x30013d)[_0xa745('0x7')](function(_0x309890){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x353757,_0xa745('0x8'));logger[_0xa745('0x9')](_0xa745('0xa'),_0x353757,_0xa745('0x8'),JSON[_0xa745('0xb')](_0x309890));if(_0x309890[_0xa745('0xc')]){if(_0x309890[_0xa745('0xc')][_0xa745('0xd')]===0x1f4){logger['error'](_0xa745('0xe'),_0x353757,_0x309890[_0xa745('0xc')][_0xa745('0xf')]);return _0x456a0d(_0x309890[_0xa745('0xc')][_0xa745('0xf')]);}logger[_0xa745('0xc')](_0xa745('0xe'),_0x353757,_0x309890[_0xa745('0xc')][_0xa745('0xf')]);return _0x182623(_0x309890[_0xa745('0xc')][_0xa745('0xf')]);}else{logger[_0xa745('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x353757,_0xa745('0x8'));_0x182623(_0x309890['result'][_0xa745('0xf')]);}})[_0xa745('0x11')](function(_0x2acfad){logger[_0xa745('0xc')](_0xa745('0xe'),_0x353757,_0x2acfad);_0x456a0d(_0x2acfad);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9c22271..f1b153c 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 _0xba96=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x3ba093,_0x836b9e){var _0x3643a8=function(_0x1d4c41){while(--_0x1d4c41){_0x3ba093['push'](_0x3ba093['shift']());}};_0x3643a8(++_0x836b9e);}(_0xba96,0x180));var _0x6ba9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xba96[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x6ba9('0x0'));var util=require(_0x6ba9('0x1'));var path=require(_0x6ba9('0x2'));var timeout=require(_0x6ba9('0x3'));var express=require(_0x6ba9('0x4'));var router=express[_0x6ba9('0x5')]();var fs_extra=require(_0x6ba9('0x6'));var auth=require(_0x6ba9('0x7'));var interaction=require(_0x6ba9('0x8'));var config=require(_0x6ba9('0x9'));var controller=require(_0x6ba9('0xa'));router[_0x6ba9('0xb')]('/',auth[_0x6ba9('0xc')](),controller[_0x6ba9('0xd')]);router[_0x6ba9('0xb')](_0x6ba9('0xe'),auth['isAuthenticated'](),controller[_0x6ba9('0xf')]);router['post']('/',auth[_0x6ba9('0xc')](),controller[_0x6ba9('0x10')]);router[_0x6ba9('0x11')](_0x6ba9('0xe'),auth[_0x6ba9('0xc')](),controller[_0x6ba9('0x12')]);router[_0x6ba9('0x13')](_0x6ba9('0xe'),auth['isAuthenticated'](),controller[_0x6ba9('0x14')]);module[_0x6ba9('0x15')]=router; \ No newline at end of file +var _0x629c=['../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x316215,_0x52c23d){var _0x3dd083=function(_0x14b1c4){while(--_0x14b1c4){_0x316215['push'](_0x316215['shift']());}};_0x3dd083(++_0x52c23d);}(_0x629c,0x15c));var _0xc629=function(_0x357607,_0x1363a2){_0x357607=_0x357607-0x0;var _0x49e4e1=_0x629c[_0x357607];return _0x49e4e1;};'use strict';var multer=require('multer');var util=require(_0xc629('0x0'));var path=require(_0xc629('0x1'));var timeout=require(_0xc629('0x2'));var express=require('express');var router=express[_0xc629('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc629('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc629('0x5'));router[_0xc629('0x6')]('/',auth[_0xc629('0x7')](),controller[_0xc629('0x8')]);router[_0xc629('0x6')](_0xc629('0x9'),auth[_0xc629('0x7')](),controller['show']);router[_0xc629('0xa')]('/',auth['isAuthenticated'](),controller[_0xc629('0xb')]);router[_0xc629('0xc')]('/:id',auth[_0xc629('0x7')](),controller['update']);router[_0xc629('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc629('0xe')]);module[_0xc629('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 dc22186..2bfc8dd 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 _0x9ac9=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x4b5f62,_0x4a6c6f){var _0x1e9d3b=function(_0x3436f7){while(--_0x3436f7){_0x4b5f62['push'](_0x4b5f62['shift']());}};_0x1e9d3b(++_0x4a6c6f);}(_0x9ac9,0x115));var _0x99ac=function(_0x26f1a3,_0x53aede){_0x26f1a3=_0x26f1a3-0x0;var _0x387899=_0x9ac9[_0x26f1a3];return _0x387899;};'use strict';var Sequelize=require(_0x99ac('0x0'));module[_0x99ac('0x1')]={'type':{'type':Sequelize[_0x99ac('0x2')](_0x99ac('0x3'),_0x99ac('0x4'),_0x99ac('0x5'),_0x99ac('0x6'),_0x99ac('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x99ac('0x8')]},'key':{'type':Sequelize[_0x99ac('0x8')]},'keyType':{'type':Sequelize[_0x99ac('0x2')](_0x99ac('0x3'),'variable',_0x99ac('0x5'))},'keyContent':{'type':Sequelize[_0x99ac('0x8')]},'idField':{'type':Sequelize[_0x99ac('0x8')]},'variableName':{'type':Sequelize[_0x99ac('0x8')]}}; \ No newline at end of file +var _0x2b92=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x38c202,_0x299906){var _0xb66482=function(_0x55374d){while(--_0x55374d){_0x38c202['push'](_0x38c202['shift']());}};_0xb66482(++_0x299906);}(_0x2b92,0x102));var _0x22b9=function(_0x48f3e4,_0x41a294){_0x48f3e4=_0x48f3e4-0x0;var _0x559b5f=_0x2b92[_0x48f3e4];return _0x559b5f;};'use strict';var Sequelize=require(_0x22b9('0x0'));module[_0x22b9('0x1')]={'type':{'type':Sequelize[_0x22b9('0x2')](_0x22b9('0x3'),_0x22b9('0x4'),_0x22b9('0x5'),_0x22b9('0x6'),_0x22b9('0x7')),'defaultValue':_0x22b9('0x3')},'content':{'type':Sequelize[_0x22b9('0x8')]},'key':{'type':Sequelize[_0x22b9('0x8')]},'keyType':{'type':Sequelize[_0x22b9('0x2')]('string',_0x22b9('0x4'),_0x22b9('0x5'))},'keyContent':{'type':Sequelize[_0x22b9('0x8')]},'idField':{'type':Sequelize[_0x22b9('0x8')]},'variableName':{'type':Sequelize[_0x22b9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b853de9..723bf8f 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 _0x198e=['../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','SalesforceField','includeAll','findAll','rows','options','create','body','catch','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0xd4c47b,_0x596756){var _0x2114f6=function(_0x4f5edf){while(--_0x4f5edf){_0xd4c47b['push'](_0xd4c47b['shift']());}};_0x2114f6(++_0x596756);}(_0x198e,0x79));var _0xe198=function(_0x24b20f,_0x38d0aa){_0x24b20f=_0x24b20f-0x0;var _0x52ce92=_0x198e[_0x24b20f];return _0x52ce92;};'use strict';var emlformat=require(_0xe198('0x0'));var rimraf=require(_0xe198('0x1'));var zipdir=require(_0xe198('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe198('0x3'));var moment=require(_0xe198('0x4'));var BPromise=require(_0xe198('0x5'));var Mustache=require(_0xe198('0x6'));var util=require(_0xe198('0x7'));var path=require(_0xe198('0x8'));var sox=require(_0xe198('0x9'));var csv=require(_0xe198('0xa'));var ejs=require(_0xe198('0xb'));var fs=require('fs');var fs_extra=require(_0xe198('0xc'));var _=require(_0xe198('0xd'));var squel=require('squel');var crypto=require(_0xe198('0xe'));var jsforce=require(_0xe198('0xf'));var deskjs=require(_0xe198('0x10'));var toCsv=require(_0xe198('0xa'));var querystring=require(_0xe198('0x11'));var Papa=require(_0xe198('0x12'));var Redis=require(_0xe198('0x13'));var authService=require(_0xe198('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe198('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe198('0x16'))(_0xe198('0x17'));var utils=require('../../config/utils');var config=require(_0xe198('0x18'));var licenseUtil=require(_0xe198('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x525ab5,_0x53bfc5){_0x53bfc5=_0x53bfc5||0xcc;return function(_0x18b0f5){if(_0x18b0f5){return _0x525ab5[_0xe198('0x1a')](_0x53bfc5);}return _0x525ab5['status'](_0x53bfc5)[_0xe198('0x1b')]();};}function respondWithResult(_0x1df26d,_0x53be82){_0x53be82=_0x53be82||0xc8;return function(_0x5307a9){if(_0x5307a9){return _0x1df26d[_0xe198('0x1c')](_0x53be82)['json'](_0x5307a9);}};}function respondWithFilteredResult(_0x1594ec,_0x3428b8){return function(_0x57fdda){if(_0x57fdda){var _0x37c4e9=typeof _0x3428b8[_0xe198('0x1d')]===_0xe198('0x1e')&&typeof _0x3428b8[_0xe198('0x1f')]===_0xe198('0x1e');var _0xf4f94a=_0x57fdda[_0xe198('0x20')];var _0x55a936=_0x37c4e9?0x0:_0x3428b8[_0xe198('0x1d')];var _0xf8017f=_0x37c4e9?_0x57fdda[_0xe198('0x20')]:_0x3428b8[_0xe198('0x1d')]+_0x3428b8[_0xe198('0x1f')];var _0x10d5ac;if(_0xf8017f>=_0xf4f94a){_0xf8017f=_0xf4f94a;_0x10d5ac=0xc8;}else{_0x10d5ac=0xce;}_0x1594ec[_0xe198('0x1c')](_0x10d5ac);return _0x1594ec['set'](_0xe198('0x21'),_0x55a936+'-'+_0xf8017f+'/'+_0xf4f94a)[_0xe198('0x22')](_0x57fdda);}return null;};}function patchUpdates(_0x164df6){return function(_0x1799c9){try{jsonpatch[_0xe198('0x23')](_0x1799c9,_0x164df6,!![]);}catch(_0x86baab){return BPromise['reject'](_0x86baab);}return _0x1799c9[_0xe198('0x24')]();};}function saveUpdates(_0x1e7373,_0x599729){return function(_0x1f2f34){if(_0x1f2f34){return _0x1f2f34[_0xe198('0x25')](_0x1e7373)[_0xe198('0x26')](function(_0x48f4d8){return _0x48f4d8;});}return null;};}function removeEntity(_0x3d0c61,_0x57425f){return function(_0x3537bb){if(_0x3537bb){return _0x3537bb[_0xe198('0x27')]()[_0xe198('0x26')](function(){_0x3d0c61[_0xe198('0x1c')](0xcc)[_0xe198('0x1b')]();});}};}function handleEntityNotFound(_0x470d59,_0x19f2cb){return function(_0x3f3542){if(!_0x3f3542){_0x470d59[_0xe198('0x1a')](0x194);}return _0x3f3542;};}function handleError(_0x20c08,_0x2ae233){_0x2ae233=_0x2ae233||0x1f4;return function(_0x4a580b){logger[_0xe198('0x28')](_0x4a580b[_0xe198('0x29')]);if(_0x4a580b[_0xe198('0x2a')]){delete _0x4a580b[_0xe198('0x2a')];}_0x20c08[_0xe198('0x1c')](_0x2ae233)[_0xe198('0x2b')](_0x4a580b);};}exports['index']=function(_0x19fd14,_0x3998fc){var _0x206c58={},_0x4e8dcc={},_0x48a147={'count':0x0,'rows':[]};var _0x30d174=_[_0xe198('0x2c')](db['SalesforceField'][_0xe198('0x2d')],function(_0x37ce14){return{'name':_0x37ce14[_0xe198('0x2e')],'type':_0x37ce14[_0xe198('0x2f')][_0xe198('0x30')]};});_0x4e8dcc[_0xe198('0x31')]=_[_0xe198('0x2c')](_0x30d174,_0xe198('0x2a'));_0x4e8dcc[_0xe198('0x32')]=_[_0xe198('0x33')](_0x19fd14[_0xe198('0x32')]);_0x4e8dcc['filters']=_[_0xe198('0x34')](_0x4e8dcc[_0xe198('0x31')],_0x4e8dcc[_0xe198('0x32')]);_0x206c58['attributes']=_['intersection'](_0x4e8dcc[_0xe198('0x31')],qs[_0xe198('0x35')](_0x19fd14[_0xe198('0x32')][_0xe198('0x35')]));_0x206c58[_0xe198('0x36')]=_0x206c58[_0xe198('0x36')]['length']?_0x206c58[_0xe198('0x36')]:_0x4e8dcc['model'];if(!_0x19fd14[_0xe198('0x32')][_0xe198('0x37')](_0xe198('0x38'))){_0x206c58['limit']=qs[_0xe198('0x1f')](_0x19fd14[_0xe198('0x32')][_0xe198('0x1f')]);_0x206c58[_0xe198('0x1d')]=qs[_0xe198('0x1d')](_0x19fd14[_0xe198('0x32')]['offset']);}_0x206c58[_0xe198('0x39')]=qs[_0xe198('0x3a')](_0x19fd14[_0xe198('0x32')][_0xe198('0x3a')]);_0x206c58[_0xe198('0x3b')]=qs[_0xe198('0x3c')](_['pick'](_0x19fd14['query'],_0x4e8dcc[_0xe198('0x3c')]),_0x30d174);if(_0x19fd14[_0xe198('0x32')]['filter']){_0x206c58[_0xe198('0x3b')]=_[_0xe198('0x3d')](_0x206c58['where'],{'$or':_[_0xe198('0x2c')](_0x30d174,function(_0x5cb74d){if(_0x5cb74d[_0xe198('0x2f')]!==_0xe198('0x3e')){var _0xf81df5={};_0xf81df5[_0x5cb74d[_0xe198('0x2a')]]={'$like':'%'+_0x19fd14[_0xe198('0x32')]['filter']+'%'};return _0xf81df5;}})});}_0x206c58=_[_0xe198('0x3d')]({},_0x206c58,_0x19fd14['options']);var _0x2ec9dc={'where':_0x206c58[_0xe198('0x3b')]};return db[_0xe198('0x3f')][_0xe198('0x20')](_0x2ec9dc)['then'](function(_0x232b1c){_0x48a147[_0xe198('0x20')]=_0x232b1c;if(_0x19fd14['query'][_0xe198('0x40')]){_0x206c58['include']=[{'all':!![]}];}return db['SalesforceField'][_0xe198('0x41')](_0x206c58);})['then'](function(_0x287f16){_0x48a147[_0xe198('0x42')]=_0x287f16;return _0x48a147;})['then'](respondWithFilteredResult(_0x3998fc,_0x206c58))['catch'](handleError(_0x3998fc,null));};exports['show']=function(_0x26ef83,_0x17003c){var _0x5f5515={'raw':!![],'where':{'id':_0x26ef83['params']['id']}},_0x3b94bc={};_0x3b94bc[_0xe198('0x31')]=_['keys'](db[_0xe198('0x3f')][_0xe198('0x2d')]);_0x3b94bc[_0xe198('0x32')]=_[_0xe198('0x33')](_0x26ef83[_0xe198('0x32')]);_0x3b94bc[_0xe198('0x3c')]=_['intersection'](_0x3b94bc['model'],_0x3b94bc[_0xe198('0x32')]);_0x5f5515['attributes']=_[_0xe198('0x34')](_0x3b94bc['model'],qs[_0xe198('0x35')](_0x26ef83[_0xe198('0x32')]['fields']));_0x5f5515[_0xe198('0x36')]=_0x5f5515[_0xe198('0x36')]['length']?_0x5f5515['attributes']:_0x3b94bc[_0xe198('0x31')];if(_0x26ef83[_0xe198('0x32')]['includeAll']){_0x5f5515['include']=[{'all':!![]}];}_0x5f5515=_[_0xe198('0x3d')]({},_0x5f5515,_0x26ef83[_0xe198('0x43')]);return db['SalesforceField']['find'](_0x5f5515)[_0xe198('0x26')](handleEntityNotFound(_0x17003c,null))[_0xe198('0x26')](respondWithResult(_0x17003c,null))['catch'](handleError(_0x17003c,null));};exports[_0xe198('0x44')]=function(_0x48fbe7,_0x1d9c71){return db[_0xe198('0x3f')][_0xe198('0x44')](_0x48fbe7[_0xe198('0x45')],{})['then'](respondWithResult(_0x1d9c71,0xc9))[_0xe198('0x46')](handleError(_0x1d9c71,null));};exports['update']=function(_0x31a642,_0x3b6773){if(_0x31a642[_0xe198('0x45')]['id']){delete _0x31a642[_0xe198('0x45')]['id'];}return db['SalesforceField'][_0xe198('0x47')]({'where':{'id':_0x31a642[_0xe198('0x48')]['id']}})[_0xe198('0x26')](handleEntityNotFound(_0x3b6773,null))[_0xe198('0x26')](saveUpdates(_0x31a642['body'],null))['then'](respondWithResult(_0x3b6773,null))[_0xe198('0x46')](handleError(_0x3b6773,null));};exports[_0xe198('0x27')]=function(_0x3fca94,_0x4a81b6){return db[_0xe198('0x3f')][_0xe198('0x47')]({'where':{'id':_0x3fca94['params']['id']}})['then'](handleEntityNotFound(_0x4a81b6,null))['then'](removeEntity(_0x4a81b6,null))[_0xe198('0x46')](handleError(_0x4a81b6,null));}; \ No newline at end of file +var _0x4940=['limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','SalesforceField','findAll','rows','show','params','keys','rawAttributes','catch','create','body','destroy','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4940,0xbd));var _0x0494=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x4940[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x0494('0x0'));var rimraf=require(_0x0494('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0494('0x2'));var rp=require('request-promise');var moment=require(_0x0494('0x3'));var BPromise=require(_0x0494('0x4'));var Mustache=require('mustache');var util=require(_0x0494('0x5'));var path=require(_0x0494('0x6'));var sox=require(_0x0494('0x7'));var csv=require(_0x0494('0x8'));var ejs=require(_0x0494('0x9'));var fs=require('fs');var fs_extra=require(_0x0494('0xa'));var _=require(_0x0494('0xb'));var squel=require(_0x0494('0xc'));var crypto=require('crypto');var jsforce=require(_0x0494('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0494('0xe'));var Redis=require('ioredis');var authService=require(_0x0494('0xf'));var qs=require(_0x0494('0x10'));var as=require(_0x0494('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0494('0x12'))(_0x0494('0x13'));var utils=require(_0x0494('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0494('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5093ca,_0x38ac2a){_0x38ac2a=_0x38ac2a||0xcc;return function(_0x3d0b8f){if(_0x3d0b8f){return _0x5093ca[_0x0494('0x16')](_0x38ac2a);}return _0x5093ca[_0x0494('0x17')](_0x38ac2a)[_0x0494('0x18')]();};}function respondWithResult(_0x5d212c,_0x4b7d42){_0x4b7d42=_0x4b7d42||0xc8;return function(_0x507eb5){if(_0x507eb5){return _0x5d212c[_0x0494('0x17')](_0x4b7d42)[_0x0494('0x19')](_0x507eb5);}};}function respondWithFilteredResult(_0x24b133,_0x2ffbc3){return function(_0x479689){if(_0x479689){var _0x5175be=typeof _0x2ffbc3[_0x0494('0x1a')]==='undefined'&&typeof _0x2ffbc3[_0x0494('0x1b')]==='undefined';var _0x4813f3=_0x479689[_0x0494('0x1c')];var _0x2cf720=_0x5175be?0x0:_0x2ffbc3[_0x0494('0x1a')];var _0x68ddb0=_0x5175be?_0x479689[_0x0494('0x1c')]:_0x2ffbc3[_0x0494('0x1a')]+_0x2ffbc3[_0x0494('0x1b')];var _0x4e43e6;if(_0x68ddb0>=_0x4813f3){_0x68ddb0=_0x4813f3;_0x4e43e6=0xc8;}else{_0x4e43e6=0xce;}_0x24b133[_0x0494('0x17')](_0x4e43e6);return _0x24b133[_0x0494('0x1d')]('Content-Range',_0x2cf720+'-'+_0x68ddb0+'/'+_0x4813f3)['json'](_0x479689);}return null;};}function patchUpdates(_0x2d5d46){return function(_0x423719){try{jsonpatch[_0x0494('0x1e')](_0x423719,_0x2d5d46,!![]);}catch(_0x1d7434){return BPromise[_0x0494('0x1f')](_0x1d7434);}return _0x423719[_0x0494('0x20')]();};}function saveUpdates(_0x5cd138,_0x30fb28){return function(_0x703a1){if(_0x703a1){return _0x703a1[_0x0494('0x21')](_0x5cd138)[_0x0494('0x22')](function(_0xde9117){return _0xde9117;});}return null;};}function removeEntity(_0xeb6cf9,_0x4bda43){return function(_0x10c899){if(_0x10c899){return _0x10c899['destroy']()['then'](function(){_0xeb6cf9['status'](0xcc)[_0x0494('0x18')]();});}};}function handleEntityNotFound(_0x5998a9,_0x3ffda5){return function(_0x3ec2c5){if(!_0x3ec2c5){_0x5998a9['sendStatus'](0x194);}return _0x3ec2c5;};}function handleError(_0x55a73b,_0x401d49){_0x401d49=_0x401d49||0x1f4;return function(_0x1bd347){logger[_0x0494('0x23')](_0x1bd347[_0x0494('0x24')]);if(_0x1bd347[_0x0494('0x25')]){delete _0x1bd347[_0x0494('0x25')];}_0x55a73b[_0x0494('0x17')](_0x401d49)[_0x0494('0x26')](_0x1bd347);};}exports[_0x0494('0x27')]=function(_0x248547,_0x43e522){var _0x225a2f={},_0x36c3a3={},_0x524fa9={'count':0x0,'rows':[]};var _0x201778=_[_0x0494('0x28')](db['SalesforceField']['rawAttributes'],function(_0xabcd38){return{'name':_0xabcd38['fieldName'],'type':_0xabcd38['type'][_0x0494('0x29')]};});_0x36c3a3[_0x0494('0x2a')]=_['map'](_0x201778,'name');_0x36c3a3[_0x0494('0x2b')]=_['keys'](_0x248547['query']);_0x36c3a3[_0x0494('0x2c')]=_['intersection'](_0x36c3a3[_0x0494('0x2a')],_0x36c3a3[_0x0494('0x2b')]);_0x225a2f[_0x0494('0x2d')]=_[_0x0494('0x2e')](_0x36c3a3['model'],qs[_0x0494('0x2f')](_0x248547['query'][_0x0494('0x2f')]));_0x225a2f[_0x0494('0x2d')]=_0x225a2f['attributes'][_0x0494('0x30')]?_0x225a2f[_0x0494('0x2d')]:_0x36c3a3[_0x0494('0x2a')];if(!_0x248547[_0x0494('0x2b')]['hasOwnProperty'](_0x0494('0x31'))){_0x225a2f[_0x0494('0x1b')]=qs[_0x0494('0x1b')](_0x248547[_0x0494('0x2b')][_0x0494('0x1b')]);_0x225a2f[_0x0494('0x1a')]=qs[_0x0494('0x1a')](_0x248547['query']['offset']);}_0x225a2f[_0x0494('0x32')]=qs['sort'](_0x248547[_0x0494('0x2b')]['sort']);_0x225a2f['where']=qs[_0x0494('0x2c')](_[_0x0494('0x33')](_0x248547[_0x0494('0x2b')],_0x36c3a3[_0x0494('0x2c')]),_0x201778);if(_0x248547[_0x0494('0x2b')][_0x0494('0x34')]){_0x225a2f[_0x0494('0x35')]=_[_0x0494('0x36')](_0x225a2f[_0x0494('0x35')],{'$or':_['map'](_0x201778,function(_0x2e4e67){if(_0x2e4e67[_0x0494('0x37')]!==_0x0494('0x38')){var _0x3f5a83={};_0x3f5a83[_0x2e4e67[_0x0494('0x25')]]={'$like':'%'+_0x248547[_0x0494('0x2b')][_0x0494('0x34')]+'%'};return _0x3f5a83;}})});}_0x225a2f=_[_0x0494('0x36')]({},_0x225a2f,_0x248547[_0x0494('0x39')]);var _0x47a435={'where':_0x225a2f[_0x0494('0x35')]};return db['SalesforceField'][_0x0494('0x1c')](_0x47a435)[_0x0494('0x22')](function(_0x40a115){_0x524fa9[_0x0494('0x1c')]=_0x40a115;if(_0x248547[_0x0494('0x2b')][_0x0494('0x3a')]){_0x225a2f[_0x0494('0x3b')]=[{'all':!![]}];}return db[_0x0494('0x3c')][_0x0494('0x3d')](_0x225a2f);})[_0x0494('0x22')](function(_0x577b56){_0x524fa9[_0x0494('0x3e')]=_0x577b56;return _0x524fa9;})[_0x0494('0x22')](respondWithFilteredResult(_0x43e522,_0x225a2f))['catch'](handleError(_0x43e522,null));};exports[_0x0494('0x3f')]=function(_0x1718b3,_0x1be5f4){var _0x47fe0c={'raw':!![],'where':{'id':_0x1718b3[_0x0494('0x40')]['id']}},_0x5437a4={};_0x5437a4[_0x0494('0x2a')]=_[_0x0494('0x41')](db[_0x0494('0x3c')][_0x0494('0x42')]);_0x5437a4[_0x0494('0x2b')]=_[_0x0494('0x41')](_0x1718b3['query']);_0x5437a4[_0x0494('0x2c')]=_[_0x0494('0x2e')](_0x5437a4['model'],_0x5437a4[_0x0494('0x2b')]);_0x47fe0c[_0x0494('0x2d')]=_[_0x0494('0x2e')](_0x5437a4[_0x0494('0x2a')],qs[_0x0494('0x2f')](_0x1718b3['query'][_0x0494('0x2f')]));_0x47fe0c[_0x0494('0x2d')]=_0x47fe0c[_0x0494('0x2d')][_0x0494('0x30')]?_0x47fe0c[_0x0494('0x2d')]:_0x5437a4['model'];if(_0x1718b3['query'][_0x0494('0x3a')]){_0x47fe0c['include']=[{'all':!![]}];}_0x47fe0c=_[_0x0494('0x36')]({},_0x47fe0c,_0x1718b3[_0x0494('0x39')]);return db[_0x0494('0x3c')]['find'](_0x47fe0c)[_0x0494('0x22')](handleEntityNotFound(_0x1be5f4,null))['then'](respondWithResult(_0x1be5f4,null))[_0x0494('0x43')](handleError(_0x1be5f4,null));};exports[_0x0494('0x44')]=function(_0x5b4075,_0x1fdc5b){return db['SalesforceField'][_0x0494('0x44')](_0x5b4075[_0x0494('0x45')],{})['then'](respondWithResult(_0x1fdc5b,0xc9))['catch'](handleError(_0x1fdc5b,null));};exports[_0x0494('0x21')]=function(_0x5c0632,_0x2241d4){if(_0x5c0632[_0x0494('0x45')]['id']){delete _0x5c0632[_0x0494('0x45')]['id'];}return db[_0x0494('0x3c')]['find']({'where':{'id':_0x5c0632[_0x0494('0x40')]['id']}})['then'](handleEntityNotFound(_0x2241d4,null))[_0x0494('0x22')](saveUpdates(_0x5c0632['body'],null))[_0x0494('0x22')](respondWithResult(_0x2241d4,null))[_0x0494('0x43')](handleError(_0x2241d4,null));};exports[_0x0494('0x46')]=function(_0x3434d1,_0x522475){return db[_0x0494('0x3c')][_0x0494('0x47')]({'where':{'id':_0x3434d1[_0x0494('0x40')]['id']}})[_0x0494('0x22')](handleEntityNotFound(_0x522475,null))[_0x0494('0x22')](removeEntity(_0x522475,null))[_0x0494('0x43')](handleError(_0x522475,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 741209c..cce0fc5 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 _0xa829=['../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa829,0x157));var _0x9a82=function(_0x1f169d,_0x1b918e){_0x1f169d=_0x1f169d-0x0;var _0x30fefe=_0xa829[_0x1f169d];return _0x30fefe;};'use strict';var _=require(_0x9a82('0x0'));var util=require('util');var logger=require(_0x9a82('0x1'))(_0x9a82('0x2'));var moment=require(_0x9a82('0x3'));var BPromise=require(_0x9a82('0x4'));var rp=require(_0x9a82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a82('0x6'));var config=require(_0x9a82('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x9a82('0x8')]=function(_0x5467b2,_0x1aaeb2){return _0x5467b2[_0x9a82('0x9')](_0x9a82('0xa'),attributes,{'tableName':_0x9a82('0xb'),'paranoid':![],'indexes':[{'name':_0x9a82('0xc'),'fields':['idField',_0x9a82('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b71=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x29aad2,_0x5437b1){var _0x2b5fd3=function(_0x5960f5){while(--_0x5960f5){_0x29aad2['push'](_0x29aad2['shift']());}};_0x2b5fd3(++_0x5437b1);}(_0x8b71,0x10c));var _0x18b7=function(_0x3a8898,_0x15f7ed){_0x3a8898=_0x3a8898-0x0;var _0x1dd610=_0x8b71[_0x3a8898];return _0x1dd610;};'use strict';var _=require(_0x18b7('0x0'));var util=require(_0x18b7('0x1'));var logger=require(_0x18b7('0x2'))('api');var moment=require(_0x18b7('0x3'));var BPromise=require(_0x18b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x18b7('0x5'));var attributes=require(_0x18b7('0x6'));module[_0x18b7('0x7')]=function(_0x6f6cc,_0x503d91){return _0x6f6cc['define'](_0x18b7('0x8'),attributes,{'tableName':_0x18b7('0x9'),'paranoid':![],'indexes':[{'name':_0x18b7('0xa'),'fields':[_0x18b7('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b6dc026..bceba32 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 _0x716c=['request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client'];(function(_0x7eee32,_0x582ddc){var _0x4b8ef7=function(_0x788b43){while(--_0x788b43){_0x7eee32['push'](_0x7eee32['shift']());}};_0x4b8ef7(++_0x582ddc);}(_0x716c,0xab));var _0xc716=function(_0x3262a8,_0x514236){_0x3262a8=_0x3262a8-0x0;var _0x5f422c=_0x716c[_0x3262a8];return _0x5f422c;};'use strict';var _=require(_0xc716('0x0'));var util=require(_0xc716('0x1'));var moment=require(_0xc716('0x2'));var BPromise=require(_0xc716('0x3'));var rs=require(_0xc716('0x4'));var fs=require('fs');var Redis=require(_0xc716('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc716('0x6'));var logger=require(_0xc716('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc716('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x173ee2,_0xf46d05,_0x545281){return new BPromise(function(_0x337670,_0x1b7451){return client[_0xc716('0x9')](_0x173ee2,_0x545281)[_0xc716('0xa')](function(_0x116637){logger['info'](_0xc716('0xb'),_0xf46d05,_0xc716('0xc'));logger[_0xc716('0xd')](_0xc716('0xe'),_0xf46d05,_0xc716('0xc'),JSON[_0xc716('0xf')](_0x116637));if(_0x116637[_0xc716('0x10')]){if(_0x116637[_0xc716('0x10')]['code']===0x1f4){logger[_0xc716('0x10')](_0xc716('0xb'),_0xf46d05,_0x116637[_0xc716('0x10')][_0xc716('0x11')]);return _0x1b7451(_0x116637[_0xc716('0x10')][_0xc716('0x11')]);}logger[_0xc716('0x10')](_0xc716('0xb'),_0xf46d05,_0x116637[_0xc716('0x10')][_0xc716('0x11')]);return _0x337670(_0x116637['error']['message']);}else{logger[_0xc716('0x12')](_0xc716('0xb'),_0xf46d05,_0xc716('0xc'));_0x337670(_0x116637[_0xc716('0x13')][_0xc716('0x11')]);}})['catch'](function(_0x358af8){logger[_0xc716('0x10')](_0xc716('0xb'),_0xf46d05,_0x358af8);_0x1b7451(_0x358af8);});});} \ No newline at end of file +var _0x46a5=['../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x46a5,0x1be));var _0x546a=function(_0x2fd764,_0x252db0){_0x2fd764=_0x2fd764-0x0;var _0x2c41a0=_0x46a5[_0x2fd764];return _0x2c41a0;};'use strict';var _=require(_0x546a('0x0'));var util=require(_0x546a('0x1'));var moment=require(_0x546a('0x2'));var BPromise=require(_0x546a('0x3'));var rs=require(_0x546a('0x4'));var fs=require('fs');var Redis=require(_0x546a('0x5'));var db=require(_0x546a('0x6'))['db'];var utils=require(_0x546a('0x7'));var logger=require(_0x546a('0x8'))(_0x546a('0x9'));var config=require(_0x546a('0xa'));var jayson=require(_0x546a('0xb'));var client=jayson[_0x546a('0xc')][_0x546a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x12dfd9,_0x57f05e,_0x12e06c){return new BPromise(function(_0x3f7f22,_0x392f0e){return client['request'](_0x12dfd9,_0x12e06c)[_0x546a('0xe')](function(_0x2ca8d8){logger[_0x546a('0xf')](_0x546a('0x10'),_0x57f05e,_0x546a('0x11'));logger[_0x546a('0x12')](_0x546a('0x13'),_0x57f05e,_0x546a('0x11'),JSON['stringify'](_0x2ca8d8));if(_0x2ca8d8[_0x546a('0x14')]){if(_0x2ca8d8[_0x546a('0x14')][_0x546a('0x15')]===0x1f4){logger['error'](_0x546a('0x10'),_0x57f05e,_0x2ca8d8[_0x546a('0x14')]['message']);return _0x392f0e(_0x2ca8d8[_0x546a('0x14')][_0x546a('0x16')]);}logger[_0x546a('0x14')]('SalesforceField,\x20%s,\x20%s',_0x57f05e,_0x2ca8d8[_0x546a('0x14')][_0x546a('0x16')]);return _0x3f7f22(_0x2ca8d8[_0x546a('0x14')][_0x546a('0x16')]);}else{logger[_0x546a('0xf')](_0x546a('0x10'),_0x57f05e,_0x546a('0x11'));_0x3f7f22(_0x2ca8d8['result']['message']);}})[_0x546a('0x17')](function(_0x102924){logger[_0x546a('0x14')](_0x546a('0x10'),_0x57f05e,_0x102924);_0x392f0e(_0x102924);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4df24ae..f6cd214 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 _0xe5cd=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2a99f1,_0x198fd7){var _0x6948e5=function(_0x2ae413){while(--_0x2ae413){_0x2a99f1['push'](_0x2a99f1['shift']());}};_0x6948e5(++_0x198fd7);}(_0xe5cd,0xa5));var _0xde5c=function(_0x52ab89,_0x58a774){_0x52ab89=_0x52ab89-0x0;var _0x5e689d=_0xe5cd[_0x52ab89];return _0x5e689d;};'use strict';var multer=require(_0xde5c('0x0'));var util=require('util');var path=require(_0xde5c('0x1'));var timeout=require(_0xde5c('0x2'));var express=require(_0xde5c('0x3'));var router=express['Router']();var fs_extra=require(_0xde5c('0x4'));var auth=require(_0xde5c('0x5'));var interaction=require(_0xde5c('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xde5c('0x7')]('/',auth[_0xde5c('0x8')](),controller[_0xde5c('0x9')]);router[_0xde5c('0x7')](_0xde5c('0xa'),auth['isAuthenticated'](),controller[_0xde5c('0xb')]);router[_0xde5c('0x7')](_0xde5c('0xc'),auth[_0xde5c('0x8')](),controller[_0xde5c('0xd')]);router['get'](_0xde5c('0xe'),auth[_0xde5c('0x8')](),controller[_0xde5c('0xf')]);router[_0xde5c('0x10')]('/',auth[_0xde5c('0x8')](),controller[_0xde5c('0x11')]);router[_0xde5c('0x10')](_0xde5c('0xc'),auth['isAuthenticated'](),controller[_0xde5c('0x12')]);router[_0xde5c('0x13')](_0xde5c('0xa'),auth['isAuthenticated'](),controller[_0xde5c('0x14')]);router[_0xde5c('0x15')](_0xde5c('0xa'),auth[_0xde5c('0x8')](),controller[_0xde5c('0x16')]);module[_0xde5c('0x17')]=router; \ No newline at end of file +var _0x90b4=['create','put','delete','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0xe29fc6,_0x2f784d){var _0x58e1cc=function(_0x22d0d9){while(--_0x22d0d9){_0xe29fc6['push'](_0xe29fc6['shift']());}};_0x58e1cc(++_0x2f784d);}(_0x90b4,0x192));var _0x490b=function(_0x517ca8,_0x380eaf){_0x517ca8=_0x517ca8-0x0;var _0x2c1a3b=_0x90b4[_0x517ca8];return _0x2c1a3b;};'use strict';var multer=require('multer');var util=require(_0x490b('0x0'));var path=require(_0x490b('0x1'));var timeout=require(_0x490b('0x2'));var express=require(_0x490b('0x3'));var router=express[_0x490b('0x4')]();var fs_extra=require(_0x490b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x490b('0x6'));var controller=require(_0x490b('0x7'));router[_0x490b('0x8')]('/',auth['isAuthenticated'](),controller[_0x490b('0x9')]);router[_0x490b('0x8')](_0x490b('0xa'),auth[_0x490b('0xb')](),controller[_0x490b('0xc')]);router[_0x490b('0x8')](_0x490b('0xd'),auth['isAuthenticated'](),controller[_0x490b('0xe')]);router[_0x490b('0x8')](_0x490b('0xf'),auth[_0x490b('0xb')](),controller[_0x490b('0x10')]);router[_0x490b('0x11')]('/',auth[_0x490b('0xb')](),controller[_0x490b('0x12')]);router[_0x490b('0x11')]('/:id/configurations',auth[_0x490b('0xb')](),controller['addConfiguration']);router[_0x490b('0x13')](_0x490b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x490b('0x14')](_0x490b('0xa'),auth[_0x490b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f03450c..73c06b9 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 _0x8068=['exports','STRING','username','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8068,0x1ab));var _0x8806=function(_0x130719,_0x2a7018){_0x130719=_0x130719-0x0;var _0x159865=_0x8068[_0x130719];return _0x159865;};'use strict';var Sequelize=require(_0x8806('0x0'));module[_0x8806('0x1')]={'name':{'type':Sequelize[_0x8806('0x2')]},'description':{'type':Sequelize[_0x8806('0x2')]},'username':{'type':Sequelize[_0x8806('0x2')],'unique':_0x8806('0x3')},'password':{'type':Sequelize[_0x8806('0x2')]},'email':{'type':Sequelize[_0x8806('0x2')]},'remoteUri':{'type':Sequelize[_0x8806('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8806('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x265c=['sequelize','STRING','username','remoteUri'];(function(_0x575446,_0x1a13fa){var _0x2fb644=function(_0x2770b4){while(--_0x2770b4){_0x575446['push'](_0x575446['shift']());}};_0x2fb644(++_0x1a13fa);}(_0x265c,0x13c));var _0xc265=function(_0x162dcc,_0x551815){_0x162dcc=_0x162dcc-0x0;var _0x3dd658=_0x265c[_0x162dcc];return _0x3dd658;};'use strict';var Sequelize=require(_0xc265('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc265('0x1')]},'username':{'type':Sequelize[_0xc265('0x1')],'unique':_0xc265('0x2')},'password':{'type':Sequelize[_0xc265('0x1')]},'email':{'type':Sequelize[_0xc265('0x1')]},'remoteUri':{'type':Sequelize[_0xc265('0x1')],'unique':_0xc265('0x3')},'serverUrl':{'type':Sequelize[_0xc265('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5bbcc18..eb3606b 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 _0x8bea=['comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','concat','ServiceNow\x20error:\x20','stack','send','test','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','json','reject','save','update','destroy','end','error','name','ServicenowAccount','rawAttributes','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','findOne','ServicenowConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','type','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','severity','category','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','priority','rfc','expected_start','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','work_start','additional_assignee_list','description','calendar_duration','close_notes','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','sla_due'];(function(_0x54270c,_0x50242d){var _0x12b172=function(_0x5488ca){while(--_0x5488ca){_0x54270c['push'](_0x54270c['shift']());}};_0x12b172(++_0x50242d);}(_0x8bea,0xd4));var _0xa8be=function(_0x20c961,_0xe9fbd){_0x20c961=_0x20c961-0x0;var _0x7f04d7=_0x8bea[_0x20c961];return _0x7f04d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa8be('0x0'));var zipdir=require(_0xa8be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8be('0x2'));var moment=require('moment');var BPromise=require(_0xa8be('0x3'));var Mustache=require(_0xa8be('0x4'));var util=require('util');var path=require(_0xa8be('0x5'));var sox=require(_0xa8be('0x6'));var csv=require(_0xa8be('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8be('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa8be('0x9'));var jsforce=require(_0xa8be('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa8be('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa8be('0xb'));var authService=require(_0xa8be('0xc'));var qs=require(_0xa8be('0xd'));var as=require(_0xa8be('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa8be('0xf'));var utils=require(_0xa8be('0x10'));var config=require(_0xa8be('0x11'));var licenseUtil=require(_0xa8be('0x12'));var db=require(_0xa8be('0x13'))['db'];var integrations=require(_0xa8be('0x14'));function respondWithStatusCode(_0x16d13b,_0x198646){_0x198646=_0x198646||0xcc;return function(_0x58e1fe){if(_0x58e1fe){return _0x16d13b[_0xa8be('0x15')](_0x198646);}return _0x16d13b['status'](_0x198646)['end']();};}function respondWithResult(_0x246645,_0x2e5749){_0x2e5749=_0x2e5749||0xc8;return function(_0x3e36d0){if(_0x3e36d0){return _0x246645[_0xa8be('0x16')](_0x2e5749)['json'](_0x3e36d0);}};}function respondWithFilteredResult(_0x33bd44,_0x1bea0f){return function(_0x3d537b){if(_0x3d537b){var _0x34e733=typeof _0x1bea0f[_0xa8be('0x17')]===_0xa8be('0x18')&&typeof _0x1bea0f[_0xa8be('0x19')]===_0xa8be('0x18');var _0x246a63=_0x3d537b[_0xa8be('0x1a')];var _0x13b84b=_0x34e733?0x0:_0x1bea0f[_0xa8be('0x17')];var _0x22f6dd=_0x34e733?_0x3d537b[_0xa8be('0x1a')]:_0x1bea0f[_0xa8be('0x17')]+_0x1bea0f[_0xa8be('0x19')];var _0x30a4ca;if(_0x22f6dd>=_0x246a63){_0x22f6dd=_0x246a63;_0x30a4ca=0xc8;}else{_0x30a4ca=0xce;}_0x33bd44[_0xa8be('0x16')](_0x30a4ca);return _0x33bd44['set']('Content-Range',_0x13b84b+'-'+_0x22f6dd+'/'+_0x246a63)[_0xa8be('0x1b')](_0x3d537b);}return null;};}function patchUpdates(_0x6b7f86){return function(_0x4cc560){try{jsonpatch['apply'](_0x4cc560,_0x6b7f86,!![]);}catch(_0x2597e8){return BPromise[_0xa8be('0x1c')](_0x2597e8);}return _0x4cc560[_0xa8be('0x1d')]();};}function saveUpdates(_0x2fe464,_0x4da4fe){return function(_0x775de8){if(_0x775de8){return _0x775de8[_0xa8be('0x1e')](_0x2fe464)['then'](function(_0x5a76e4){return _0x5a76e4;});}return null;};}function removeEntity(_0x192baa,_0x8ac29){return function(_0x59e338){if(_0x59e338){return _0x59e338[_0xa8be('0x1f')]()['then'](function(){_0x192baa[_0xa8be('0x16')](0xcc)[_0xa8be('0x20')]();});}};}function handleEntityNotFound(_0xb76fd1,_0x507f45){return function(_0x152eeb){if(!_0x152eeb){_0xb76fd1['sendStatus'](0x194);}return _0x152eeb;};}function handleError(_0x27f996,_0x8ceb2a){_0x8ceb2a=_0x8ceb2a||0x1f4;return function(_0x29ca5a){logger[_0xa8be('0x21')](_0x29ca5a['stack']);if(_0x29ca5a[_0xa8be('0x22')]){delete _0x29ca5a[_0xa8be('0x22')];}_0x27f996[_0xa8be('0x16')](_0x8ceb2a)['send'](_0x29ca5a);};}exports['index']=function(_0x58a72e,_0x1b638d){var _0x2d08ff={},_0x2bc5f6={},_0xcc1ff8={'count':0x0,'rows':[]};var _0x13e9eb=_['map'](db[_0xa8be('0x23')][_0xa8be('0x24')],function(_0x3be6db){return{'name':_0x3be6db['fieldName'],'type':_0x3be6db['type'][_0xa8be('0x25')]};});_0x2bc5f6['model']=_[_0xa8be('0x26')](_0x13e9eb,_0xa8be('0x22'));_0x2bc5f6[_0xa8be('0x27')]=_['keys'](_0x58a72e[_0xa8be('0x27')]);_0x2bc5f6['filters']=_[_0xa8be('0x28')](_0x2bc5f6['model'],_0x2bc5f6[_0xa8be('0x27')]);_0x2d08ff[_0xa8be('0x29')]=_[_0xa8be('0x28')](_0x2bc5f6[_0xa8be('0x2a')],qs[_0xa8be('0x2b')](_0x58a72e[_0xa8be('0x27')]['fields']));_0x2d08ff[_0xa8be('0x29')]=_0x2d08ff[_0xa8be('0x29')][_0xa8be('0x2c')]?_0x2d08ff['attributes']:_0x2bc5f6[_0xa8be('0x2a')];if(!_0x58a72e[_0xa8be('0x27')][_0xa8be('0x2d')](_0xa8be('0x2e'))){_0x2d08ff[_0xa8be('0x19')]=qs[_0xa8be('0x19')](_0x58a72e[_0xa8be('0x27')]['limit']);_0x2d08ff[_0xa8be('0x17')]=qs[_0xa8be('0x17')](_0x58a72e[_0xa8be('0x27')][_0xa8be('0x17')]);}_0x2d08ff[_0xa8be('0x2f')]=qs[_0xa8be('0x30')](_0x58a72e[_0xa8be('0x27')][_0xa8be('0x30')]);_0x2d08ff[_0xa8be('0x31')]=qs[_0xa8be('0x32')](_['pick'](_0x58a72e[_0xa8be('0x27')],_0x2bc5f6[_0xa8be('0x32')]),_0x13e9eb);if(_0x58a72e[_0xa8be('0x27')][_0xa8be('0x33')]){_0x2d08ff[_0xa8be('0x31')]=_['merge'](_0x2d08ff[_0xa8be('0x31')],{'$or':_[_0xa8be('0x26')](_0x13e9eb,function(_0x129121){if(_0x129121['type']!==_0xa8be('0x34')){var _0x49d9ed={};_0x49d9ed[_0x129121[_0xa8be('0x22')]]={'$like':'%'+_0x58a72e['query'][_0xa8be('0x33')]+'%'};return _0x49d9ed;}})});}_0x2d08ff=_[_0xa8be('0x35')]({},_0x2d08ff,_0x58a72e[_0xa8be('0x36')]);var _0xee177e={'where':_0x2d08ff[_0xa8be('0x31')]};return db[_0xa8be('0x23')][_0xa8be('0x1a')](_0xee177e)[_0xa8be('0x37')](function(_0x3a231e){_0xcc1ff8[_0xa8be('0x1a')]=_0x3a231e;if(_0x58a72e[_0xa8be('0x27')]['includeAll']){_0x2d08ff[_0xa8be('0x38')]=[{'all':!![]}];}return db[_0xa8be('0x23')][_0xa8be('0x39')](_0x2d08ff);})['then'](function(_0x654829){_0xcc1ff8[_0xa8be('0x3a')]=_0x654829;return _0xcc1ff8;})['then'](respondWithFilteredResult(_0x1b638d,_0x2d08ff))[_0xa8be('0x3b')](handleError(_0x1b638d,null));};exports[_0xa8be('0x3c')]=function(_0x40eb5a,_0x5540c5){var _0x50ffaa={'raw':![],'where':{'id':_0x40eb5a[_0xa8be('0x3d')]['id']}},_0x1364a9={};_0x1364a9[_0xa8be('0x2a')]=_[_0xa8be('0x3e')](db[_0xa8be('0x23')][_0xa8be('0x24')]);_0x1364a9[_0xa8be('0x27')]=_['keys'](_0x40eb5a[_0xa8be('0x27')]);_0x1364a9[_0xa8be('0x32')]=_['intersection'](_0x1364a9[_0xa8be('0x2a')],_0x1364a9[_0xa8be('0x27')]);_0x50ffaa[_0xa8be('0x29')]=_['intersection'](_0x1364a9[_0xa8be('0x2a')],qs['fields'](_0x40eb5a[_0xa8be('0x27')]['fields']));_0x50ffaa[_0xa8be('0x29')]=_0x50ffaa['attributes'][_0xa8be('0x2c')]?_0x50ffaa[_0xa8be('0x29')]:_0x1364a9[_0xa8be('0x2a')];if(_0x40eb5a['query'][_0xa8be('0x3f')]){_0x50ffaa[_0xa8be('0x38')]=[{'all':!![]}];}_0x50ffaa=_[_0xa8be('0x35')]({},_0x50ffaa,_0x40eb5a['options']);return db['ServicenowAccount']['find'](_0x50ffaa)[_0xa8be('0x37')](handleEntityNotFound(_0x5540c5,null))[_0xa8be('0x37')](respondWithResult(_0x5540c5,null))[_0xa8be('0x3b')](handleError(_0x5540c5,null));};exports[_0xa8be('0x40')]=function(_0x564196,_0x218148){return db[_0xa8be('0x23')][_0xa8be('0x40')](_0x564196[_0xa8be('0x41')],{})['then'](respondWithResult(_0x218148,0xc9))[_0xa8be('0x3b')](handleError(_0x218148,null));};exports[_0xa8be('0x1e')]=function(_0x58180f,_0x142659){if(_0x58180f[_0xa8be('0x41')]['id']){delete _0x58180f[_0xa8be('0x41')]['id'];}return db[_0xa8be('0x23')][_0xa8be('0x42')]({'where':{'id':_0x58180f[_0xa8be('0x3d')]['id']}})['then'](handleEntityNotFound(_0x142659,null))[_0xa8be('0x37')](saveUpdates(_0x58180f[_0xa8be('0x41')],null))[_0xa8be('0x37')](respondWithResult(_0x142659,null))[_0xa8be('0x3b')](handleError(_0x142659,null));};exports[_0xa8be('0x1f')]=function(_0x166aab,_0x1ac287){return db[_0xa8be('0x23')]['find']({'where':{'id':_0x166aab['params']['id']}})[_0xa8be('0x37')](handleEntityNotFound(_0x1ac287,null))[_0xa8be('0x37')](removeEntity(_0x1ac287,null))[_0xa8be('0x3b')](handleError(_0x1ac287,null));};exports['getConfigurations']=function(_0x4758af,_0x266847,_0x5453f7){var _0x37af46={};var _0x56066={};var _0x2ef153;var _0x2873f4;return db[_0xa8be('0x23')][_0xa8be('0x43')]({'where':{'id':_0x4758af['params']['id']}})['then'](handleEntityNotFound(_0x266847,null))[_0xa8be('0x37')](function(_0x20c90b){if(_0x20c90b){_0x2ef153=_0x20c90b;_0x56066[_0xa8be('0x2a')]=_[_0xa8be('0x3e')](db[_0xa8be('0x44')][_0xa8be('0x24')]);_0x56066[_0xa8be('0x27')]=_['keys'](_0x4758af['query']);_0x56066[_0xa8be('0x32')]=_['intersection'](_0x56066[_0xa8be('0x2a')],_0x56066[_0xa8be('0x27')]);_0x37af46[_0xa8be('0x29')]=_[_0xa8be('0x28')](_0x56066[_0xa8be('0x2a')],qs['fields'](_0x4758af['query'][_0xa8be('0x2b')]));_0x37af46[_0xa8be('0x29')]=_0x37af46['attributes'][_0xa8be('0x2c')]?_0x37af46[_0xa8be('0x29')]:_0x56066[_0xa8be('0x2a')];_0x37af46[_0xa8be('0x2f')]=qs[_0xa8be('0x30')](_0x4758af[_0xa8be('0x27')][_0xa8be('0x30')]);_0x37af46[_0xa8be('0x31')]=qs[_0xa8be('0x32')](_['pick'](_0x4758af[_0xa8be('0x27')],_0x56066[_0xa8be('0x32')]));if(_0x4758af[_0xa8be('0x27')]['filter']){_0x37af46[_0xa8be('0x31')]=_['merge'](_0x37af46[_0xa8be('0x31')],{'$or':_[_0xa8be('0x26')](_0x37af46['attributes'],function(_0x12ee90){var _0x3a15dd={};_0x3a15dd[_0x12ee90]={'$like':'%'+_0x4758af['query']['filter']+'%'};return _0x3a15dd;})});}_0x37af46=_['merge']({},_0x37af46,_0x4758af[_0xa8be('0x36')]);return _0x2ef153[_0xa8be('0x45')](_0x37af46);}})[_0xa8be('0x37')](function(_0x3f6924){if(_0x3f6924){_0x2873f4=_0x3f6924[_0xa8be('0x2c')];if(!_0x4758af['query'][_0xa8be('0x2d')](_0xa8be('0x2e'))){_0x37af46[_0xa8be('0x19')]=qs['limit'](_0x4758af[_0xa8be('0x27')][_0xa8be('0x19')]);_0x37af46[_0xa8be('0x17')]=qs[_0xa8be('0x17')](_0x4758af[_0xa8be('0x27')][_0xa8be('0x17')]);}return _0x2ef153[_0xa8be('0x45')](_0x37af46);}})[_0xa8be('0x37')](function(_0xa868ee){if(_0xa868ee){return _0xa868ee?{'count':_0x2873f4,'rows':_0xa868ee}:null;}})[_0xa8be('0x37')](respondWithResult(_0x266847,null))[_0xa8be('0x3b')](handleError(_0x266847,null));};exports['addConfiguration']=function(_0x38309e,_0x273cae,_0x3c2720){if(_0x38309e[_0xa8be('0x41')]['id']){delete _0x38309e[_0xa8be('0x41')]['id'];}return db[_0xa8be('0x23')][_0xa8be('0x43')]({'where':{'id':_0x38309e[_0xa8be('0x3d')]['id']}})['then'](handleEntityNotFound(_0x273cae,null))[_0xa8be('0x37')](function(_0x2a4968){if(_0x2a4968){_0x38309e['body'][_0xa8be('0x46')]=_0x2a4968['id'];_0x38309e[_0xa8be('0x41')][_0xa8be('0x47')]=integrations[_0xa8be('0x48')](_0x38309e[_0xa8be('0x41')][_0xa8be('0x49')],_0x38309e[_0xa8be('0x41')][_0xa8be('0x4a')]);_0x38309e['body'][_0xa8be('0x4b')]=integrations['getDescriptions'](_0x38309e[_0xa8be('0x41')][_0xa8be('0x49')],_0x38309e[_0xa8be('0x41')]['type']);return db[_0xa8be('0x44')][_0xa8be('0x40')](_0x38309e[_0xa8be('0x41')],{'include':[{'model':db[_0xa8be('0x4c')],'as':_0xa8be('0x47')},{'model':db['ServicenowField'],'as':_0xa8be('0x4b')}]});}return null;})[_0xa8be('0x37')](respondWithResult(_0x273cae,null))[_0xa8be('0x3b')](handleError(_0x273cae,null));};exports[_0xa8be('0x4d')]=function(_0x20f8e4,_0x462bfd,_0x1fab45){var _0x110418=[_0xa8be('0x4e'),_0xa8be('0x4f'),_0xa8be('0x50'),'subcategory','close_code',_0xa8be('0x51'),_0xa8be('0x52'),_0xa8be('0x53'),_0xa8be('0x54')];var _0x3c04c0=['parent',_0xa8be('0x4e'),'caused_by',_0xa8be('0x55'),_0xa8be('0x56'),'sys_updated_on',_0xa8be('0x57'),_0xa8be('0x4f'),_0xa8be('0x58'),_0xa8be('0x59'),_0xa8be('0x5a'),_0xa8be('0x5b'),'opened_by',_0xa8be('0x5c'),_0xa8be('0x5d'),_0xa8be('0x5e'),_0xa8be('0x5f'),'sys_created_by','knowledge',_0xa8be('0x2f'),_0xa8be('0x60'),_0xa8be('0x61'),_0xa8be('0x62'),'delivery_plan',_0xa8be('0x63'),_0xa8be('0x64'),_0xa8be('0x65'),'business_service',_0xa8be('0x66'),'sys_domain_path',_0xa8be('0x67'),'time_worked',_0xa8be('0x68'),'opened_at',_0xa8be('0x69'),_0xa8be('0x6a'),'work_end',_0xa8be('0x6b'),_0xa8be('0x6c'),_0xa8be('0x6d'),_0xa8be('0x6e'),'subcategory',_0xa8be('0x6f'),'short_description',_0xa8be('0x70'),_0xa8be('0x71'),'delivery_task',_0xa8be('0x72'),'assignment_group','business_stc',_0xa8be('0x73'),_0xa8be('0x74'),_0xa8be('0x75'),'notify','sys_class_name',_0xa8be('0x76'),'closed_by','follow_up',_0xa8be('0x77'),_0xa8be('0x78'),_0xa8be('0x79'),_0xa8be('0x7a'),_0xa8be('0x52'),_0xa8be('0x7b'),_0xa8be('0x7c'),_0xa8be('0x7d'),'reassignment_count',_0xa8be('0x7e'),'assigned_to',_0xa8be('0x53'),'comments',_0xa8be('0x7f'),'approval',_0xa8be('0x80'),'due_date',_0xa8be('0x81'),_0xa8be('0x82'),_0xa8be('0x83'),_0xa8be('0x84'),'upon_approval',_0xa8be('0x85'),_0xa8be('0x86'),_0xa8be('0x54')];var _0xfc40e8='';var _0x2a7336='';var _0x4b3c85=[];var _0x599871='';var _0x214e2c='';var _0x3d453d=[];var _0x23b1df='';var _0x455a15='';var _0x99b34a={};var _0x228a97='';return db[_0xa8be('0x23')][_0xa8be('0x43')]({'where':{'id':_0x20f8e4[_0xa8be('0x3d')]['id']},'attributes':['id',_0xa8be('0x87'),_0xa8be('0x88'),_0xa8be('0x89'),'remoteUri',_0xa8be('0x8a')]})[_0xa8be('0x37')](handleEntityNotFound(_0x462bfd,null))['then'](function(_0x5e3d78){if(_0x5e3d78){_0x228a97=_0x5e3d78[_0xa8be('0x8b')];var _0x37f147=_0x228a97[_0xa8be('0x8c')](-0x1);if(_0x37f147==='/'){_0x228a97=_0x228a97['substring'](0x0,_0x228a97[_0xa8be('0x8d')](_0x37f147));}_0x455a15=util['format'](_0xa8be('0x8e'),_0x228a97);_0x23b1df=util[_0xa8be('0x8f')](_0xa8be('0x90'),_0x228a97);_0x99b34a={'user':_0x5e3d78[_0xa8be('0x87')],'pass':_0x5e3d78['password']};var _0x3a6818={'method':_0xa8be('0x91'),'uri':_0x455a15+'incident?sysparm_display_value=all','auth':_0x99b34a,'json':!![]};return rp(_0x3a6818);}})[_0xa8be('0x37')](function(_0x59d052){if(_0x59d052[_0xa8be('0x92')][_0xa8be('0x2c')]>0x0){_0xfc40e8=_0x59d052[_0xa8be('0x92')];}console[_0xa8be('0x93')](_0xa8be('0x94'),_0xfc40e8);_0x3d453d=[];_0x2a7336=Object['assign']([],_0xfc40e8);_[_0xa8be('0x95')](_0x2a7336,function(_0x4f60e2){return!_0x110418[_0xa8be('0x96')](_0x4f60e2[_0xa8be('0x22')]);});_0x2a7336[_0xa8be('0x97')](function(_0x2bbcac){var _0x568f0b=createFieldObject(_0x23b1df,_0x99b34a,_0x2bbcac[_0xa8be('0x98')],_0x2bbcac[_0xa8be('0x22')],_0x2bbcac[_0xa8be('0x99')],![]);_0x3d453d[_0xa8be('0x9a')](_0x568f0b);});return Promise[_0xa8be('0x9b')](_0x3d453d);})[_0xa8be('0x37')](function(_0xb31320){_0x4b3c85=_0xb31320;_0x599871=Object[_0xa8be('0x9c')]([],_0xfc40e8);console[_0xa8be('0x93')]('TCL:\x20_object',_0xfc40e8);_[_0xa8be('0x95')](_0x599871,function(_0x5cb9c5){return _0x3c04c0[_0xa8be('0x96')](_0x5cb9c5[_0xa8be('0x22')]);});console[_0xa8be('0x93')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x599871);_0x3d453d=[];_0x599871[_0xa8be('0x97')](function(_0x4496e0){var _0x24b814=createFieldObject(_0x23b1df,_0x99b34a,_0x4496e0[_0xa8be('0x98')],_0x4496e0[_0xa8be('0x22')],_0x4496e0[_0xa8be('0x99')],!![]);_0x3d453d[_0xa8be('0x9a')](_0x24b814);});return Promise['all'](_0x3d453d);})[_0xa8be('0x37')](function(_0x5d01cf){_0x214e2c=_0x5d01cf;var _0x435acd=_0x4b3c85[_0xa8be('0x9d')](_0x214e2c);return{'count':_0x435acd[_0xa8be('0x2c')],'rows':_0x435acd};})['then'](respondWithResult(_0x462bfd,null))[_0xa8be('0x3b')](function(_0x42d990){console['log'](_0xa8be('0x9e')+_0x42d990);var _0x397589=_0x20f8e4[_0xa8be('0x27')]['test']?0x1f4:_0x42d990['statusCode']||0x1f4;logger[_0xa8be('0x21')](_0x42d990[_0xa8be('0x9f')]);delete _0x42d990[_0xa8be('0x22')];if(_0x397589===0x191){_0x397589=0x190;}_0x462bfd[_0xa8be('0x16')](_0x397589)[_0xa8be('0xa0')](_0x20f8e4[_0xa8be('0x27')][_0xa8be('0xa1')]?{'message':_0xa8be('0xa2'),'statusCode':_0x42d990['statusCode']}:_0x42d990);});};function createFieldObject(_0x34f90f,_0x51ac7a,_0x1e413b,_0x26dbbd,_0x46e1b4,_0x4bc1b8){return new Promise(function(_0x29f34d,_0xa09877){var _0x1baf55={'id':_0x26dbbd,'name':_0x46e1b4,'custom':_0x4bc1b8};if(_0x1e413b===_0xa8be('0xa3')){_0x1baf55[_0xa8be('0x36')]=[{'name':_0xa8be('0xa4'),'value':'true'},{'name':_0xa8be('0xa5'),'value':_0xa8be('0xa6')}];_0x29f34d(_0x1baf55);}else{var _0x2739d0={'method':_0xa8be('0x91'),'uri':_0x34f90f+_0xa8be('0xa7')+_0x26dbbd,'auth':_0x51ac7a,'json':!![]};return rp(_0x2739d0)[_0xa8be('0x37')](function(_0x3ea1a0){var _0x460c44=[];if(_0x3ea1a0[_0xa8be('0x92')]['length']>0x0){_0x3ea1a0[_0xa8be('0x92')][_0xa8be('0x97')](function(_0x45cc31){if(_0x45cc31[_0xa8be('0xa8')]===_0xa8be('0xa6')){var _0x49d652={'name':_0x45cc31[_0xa8be('0x99')],'value':_0x45cc31[_0xa8be('0xa9')]};_0x460c44[_0xa8be('0x9a')](_0x49d652);}});}_0x1baf55[_0xa8be('0x36')]=_0x460c44;if(_0x1baf55[_0xa8be('0x36')][_0xa8be('0x2c')]>0x0){_0x29f34d(_0x1baf55);}else{if(_0x4bc1b8==![]){_0x29f34d();}else{_0x29f34d(_0x1baf55);}}});}});} \ No newline at end of file +var _0xe3fd=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','stack','send','map','ServicenowAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','update','find','params','getConfigurations','findOne','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','remoteUri','serverUrl','slice','substring','lastIndexOf','format','password','GET','incident?sysparm_display_value=all','result','log','assign','includes','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','eml-format'];(function(_0x229708,_0x6f3786){var _0xf93390=function(_0x3979bd){while(--_0x3979bd){_0x229708['push'](_0x229708['shift']());}};_0xf93390(++_0x6f3786);}(_0xe3fd,0xbb));var _0xde3f=function(_0x509f74,_0x3a8142){_0x509f74=_0x509f74-0x0;var _0x2365e5=_0xe3fd[_0x509f74];return _0x2365e5;};'use strict';var emlformat=require(_0xde3f('0x0'));var rimraf=require(_0xde3f('0x1'));var zipdir=require(_0xde3f('0x2'));var jsonpatch=require(_0xde3f('0x3'));var rp=require(_0xde3f('0x4'));var moment=require(_0xde3f('0x5'));var BPromise=require(_0xde3f('0x6'));var Mustache=require('mustache');var util=require(_0xde3f('0x7'));var path=require('path');var sox=require(_0xde3f('0x8'));var csv=require(_0xde3f('0x9'));var ejs=require(_0xde3f('0xa'));var fs=require('fs');var fs_extra=require(_0xde3f('0xb'));var _=require(_0xde3f('0xc'));var squel=require(_0xde3f('0xd'));var crypto=require(_0xde3f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde3f('0x9'));var querystring=require(_0xde3f('0xf'));var Papa=require(_0xde3f('0x10'));var Redis=require(_0xde3f('0x11'));var authService=require(_0xde3f('0x12'));var qs=require(_0xde3f('0x13'));var as=require(_0xde3f('0x14'));var hardwareService=require(_0xde3f('0x15'));var logger=require('../../config/logger')(_0xde3f('0x16'));var utils=require(_0xde3f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3f('0x18'));var db=require(_0xde3f('0x19'))['db'];var integrations=require(_0xde3f('0x1a'));function respondWithStatusCode(_0x59eb6b,_0x51f8de){_0x51f8de=_0x51f8de||0xcc;return function(_0xfb9ce3){if(_0xfb9ce3){return _0x59eb6b['sendStatus'](_0x51f8de);}return _0x59eb6b[_0xde3f('0x1b')](_0x51f8de)[_0xde3f('0x1c')]();};}function respondWithResult(_0x57b330,_0x194332){_0x194332=_0x194332||0xc8;return function(_0x17d25f){if(_0x17d25f){return _0x57b330[_0xde3f('0x1b')](_0x194332)[_0xde3f('0x1d')](_0x17d25f);}};}function respondWithFilteredResult(_0x5a31cc,_0x534ba1){return function(_0x183045){if(_0x183045){var _0x3cabe1=typeof _0x534ba1[_0xde3f('0x1e')]==='undefined'&&typeof _0x534ba1[_0xde3f('0x1f')]===_0xde3f('0x20');var _0x523739=_0x183045['count'];var _0x25a7d7=_0x3cabe1?0x0:_0x534ba1[_0xde3f('0x1e')];var _0x177bf3=_0x3cabe1?_0x183045[_0xde3f('0x21')]:_0x534ba1[_0xde3f('0x1e')]+_0x534ba1[_0xde3f('0x1f')];var _0x3d18e4;if(_0x177bf3>=_0x523739){_0x177bf3=_0x523739;_0x3d18e4=0xc8;}else{_0x3d18e4=0xce;}_0x5a31cc['status'](_0x3d18e4);return _0x5a31cc[_0xde3f('0x22')]('Content-Range',_0x25a7d7+'-'+_0x177bf3+'/'+_0x523739)['json'](_0x183045);}return null;};}function patchUpdates(_0x41c859){return function(_0x406984){try{jsonpatch[_0xde3f('0x23')](_0x406984,_0x41c859,!![]);}catch(_0x138ddf){return BPromise[_0xde3f('0x24')](_0x138ddf);}return _0x406984[_0xde3f('0x25')]();};}function saveUpdates(_0x277894,_0x14d5cb){return function(_0xe4e221){if(_0xe4e221){return _0xe4e221['update'](_0x277894)[_0xde3f('0x26')](function(_0x4f811e){return _0x4f811e;});}return null;};}function removeEntity(_0x1467d6,_0x24f052){return function(_0x472c04){if(_0x472c04){return _0x472c04['destroy']()[_0xde3f('0x26')](function(){_0x1467d6[_0xde3f('0x1b')](0xcc)[_0xde3f('0x1c')]();});}};}function handleEntityNotFound(_0x3c7da4,_0x36dab0){return function(_0x11f224){if(!_0x11f224){_0x3c7da4[_0xde3f('0x27')](0x194);}return _0x11f224;};}function handleError(_0x40e14d,_0x1388c8){_0x1388c8=_0x1388c8||0x1f4;return function(_0x102455){logger[_0xde3f('0x28')](_0x102455[_0xde3f('0x29')]);if(_0x102455['name']){delete _0x102455['name'];}_0x40e14d[_0xde3f('0x1b')](_0x1388c8)[_0xde3f('0x2a')](_0x102455);};}exports['index']=function(_0x2ffce0,_0x3d3c06){var _0xa7f759={},_0x56320d={},_0x1d37ca={'count':0x0,'rows':[]};var _0x573425=_[_0xde3f('0x2b')](db[_0xde3f('0x2c')][_0xde3f('0x2d')],function(_0x240fe9){return{'name':_0x240fe9['fieldName'],'type':_0x240fe9[_0xde3f('0x2e')][_0xde3f('0x2f')]};});_0x56320d[_0xde3f('0x30')]=_[_0xde3f('0x2b')](_0x573425,_0xde3f('0x31'));_0x56320d[_0xde3f('0x32')]=_['keys'](_0x2ffce0[_0xde3f('0x32')]);_0x56320d[_0xde3f('0x33')]=_[_0xde3f('0x34')](_0x56320d['model'],_0x56320d[_0xde3f('0x32')]);_0xa7f759[_0xde3f('0x35')]=_[_0xde3f('0x34')](_0x56320d[_0xde3f('0x30')],qs[_0xde3f('0x36')](_0x2ffce0[_0xde3f('0x32')][_0xde3f('0x36')]));_0xa7f759['attributes']=_0xa7f759[_0xde3f('0x35')][_0xde3f('0x37')]?_0xa7f759[_0xde3f('0x35')]:_0x56320d[_0xde3f('0x30')];if(!_0x2ffce0[_0xde3f('0x32')][_0xde3f('0x38')](_0xde3f('0x39'))){_0xa7f759[_0xde3f('0x1f')]=qs[_0xde3f('0x1f')](_0x2ffce0[_0xde3f('0x32')][_0xde3f('0x1f')]);_0xa7f759[_0xde3f('0x1e')]=qs[_0xde3f('0x1e')](_0x2ffce0[_0xde3f('0x32')][_0xde3f('0x1e')]);}_0xa7f759[_0xde3f('0x3a')]=qs[_0xde3f('0x3b')](_0x2ffce0['query'][_0xde3f('0x3b')]);_0xa7f759[_0xde3f('0x3c')]=qs[_0xde3f('0x33')](_['pick'](_0x2ffce0['query'],_0x56320d[_0xde3f('0x33')]),_0x573425);if(_0x2ffce0[_0xde3f('0x32')][_0xde3f('0x3d')]){_0xa7f759[_0xde3f('0x3c')]=_[_0xde3f('0x3e')](_0xa7f759[_0xde3f('0x3c')],{'$or':_[_0xde3f('0x2b')](_0x573425,function(_0x24a316){if(_0x24a316[_0xde3f('0x2e')]!==_0xde3f('0x3f')){var _0x1e91d7={};_0x1e91d7[_0x24a316[_0xde3f('0x31')]]={'$like':'%'+_0x2ffce0[_0xde3f('0x32')][_0xde3f('0x3d')]+'%'};return _0x1e91d7;}})});}_0xa7f759=_[_0xde3f('0x3e')]({},_0xa7f759,_0x2ffce0[_0xde3f('0x40')]);var _0x518c28={'where':_0xa7f759[_0xde3f('0x3c')]};return db['ServicenowAccount']['count'](_0x518c28)[_0xde3f('0x26')](function(_0x61b65b){_0x1d37ca['count']=_0x61b65b;if(_0x2ffce0['query'][_0xde3f('0x41')]){_0xa7f759[_0xde3f('0x42')]=[{'all':!![]}];}return db[_0xde3f('0x2c')][_0xde3f('0x43')](_0xa7f759);})[_0xde3f('0x26')](function(_0x1354b7){_0x1d37ca[_0xde3f('0x44')]=_0x1354b7;return _0x1d37ca;})[_0xde3f('0x26')](respondWithFilteredResult(_0x3d3c06,_0xa7f759))['catch'](handleError(_0x3d3c06,null));};exports[_0xde3f('0x45')]=function(_0x191c23,_0x271852){var _0x183b7b={'raw':![],'where':{'id':_0x191c23['params']['id']}},_0x4e239c={};_0x4e239c[_0xde3f('0x30')]=_['keys'](db[_0xde3f('0x2c')][_0xde3f('0x2d')]);_0x4e239c[_0xde3f('0x32')]=_[_0xde3f('0x46')](_0x191c23[_0xde3f('0x32')]);_0x4e239c[_0xde3f('0x33')]=_[_0xde3f('0x34')](_0x4e239c[_0xde3f('0x30')],_0x4e239c[_0xde3f('0x32')]);_0x183b7b[_0xde3f('0x35')]=_[_0xde3f('0x34')](_0x4e239c[_0xde3f('0x30')],qs[_0xde3f('0x36')](_0x191c23[_0xde3f('0x32')][_0xde3f('0x36')]));_0x183b7b['attributes']=_0x183b7b[_0xde3f('0x35')]['length']?_0x183b7b[_0xde3f('0x35')]:_0x4e239c['model'];if(_0x191c23['query'][_0xde3f('0x41')]){_0x183b7b[_0xde3f('0x42')]=[{'all':!![]}];}_0x183b7b=_[_0xde3f('0x3e')]({},_0x183b7b,_0x191c23[_0xde3f('0x40')]);return db[_0xde3f('0x2c')]['find'](_0x183b7b)['then'](handleEntityNotFound(_0x271852,null))['then'](respondWithResult(_0x271852,null))[_0xde3f('0x47')](handleError(_0x271852,null));};exports[_0xde3f('0x48')]=function(_0x303614,_0x35ef66){return db[_0xde3f('0x2c')][_0xde3f('0x48')](_0x303614[_0xde3f('0x49')],{})[_0xde3f('0x26')](respondWithResult(_0x35ef66,0xc9))[_0xde3f('0x47')](handleError(_0x35ef66,null));};exports[_0xde3f('0x4a')]=function(_0x37b5fa,_0x5a3eac){if(_0x37b5fa[_0xde3f('0x49')]['id']){delete _0x37b5fa['body']['id'];}return db[_0xde3f('0x2c')][_0xde3f('0x4b')]({'where':{'id':_0x37b5fa[_0xde3f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a3eac,null))[_0xde3f('0x26')](saveUpdates(_0x37b5fa[_0xde3f('0x49')],null))[_0xde3f('0x26')](respondWithResult(_0x5a3eac,null))['catch'](handleError(_0x5a3eac,null));};exports['destroy']=function(_0xb99a4e,_0x12600c){return db[_0xde3f('0x2c')][_0xde3f('0x4b')]({'where':{'id':_0xb99a4e[_0xde3f('0x4c')]['id']}})[_0xde3f('0x26')](handleEntityNotFound(_0x12600c,null))[_0xde3f('0x26')](removeEntity(_0x12600c,null))[_0xde3f('0x47')](handleError(_0x12600c,null));};exports[_0xde3f('0x4d')]=function(_0x5abed3,_0x4df5b0,_0x438929){var _0x42f662={};var _0x3b0929={};var _0x246e61;var _0x4e4303;return db[_0xde3f('0x2c')][_0xde3f('0x4e')]({'where':{'id':_0x5abed3['params']['id']}})[_0xde3f('0x26')](handleEntityNotFound(_0x4df5b0,null))[_0xde3f('0x26')](function(_0xa2bc4c){if(_0xa2bc4c){_0x246e61=_0xa2bc4c;_0x3b0929[_0xde3f('0x30')]=_[_0xde3f('0x46')](db['ServicenowConfiguration']['rawAttributes']);_0x3b0929[_0xde3f('0x32')]=_[_0xde3f('0x46')](_0x5abed3[_0xde3f('0x32')]);_0x3b0929[_0xde3f('0x33')]=_[_0xde3f('0x34')](_0x3b0929[_0xde3f('0x30')],_0x3b0929[_0xde3f('0x32')]);_0x42f662[_0xde3f('0x35')]=_[_0xde3f('0x34')](_0x3b0929[_0xde3f('0x30')],qs[_0xde3f('0x36')](_0x5abed3[_0xde3f('0x32')]['fields']));_0x42f662[_0xde3f('0x35')]=_0x42f662[_0xde3f('0x35')][_0xde3f('0x37')]?_0x42f662[_0xde3f('0x35')]:_0x3b0929[_0xde3f('0x30')];_0x42f662[_0xde3f('0x3a')]=qs[_0xde3f('0x3b')](_0x5abed3[_0xde3f('0x32')][_0xde3f('0x3b')]);_0x42f662[_0xde3f('0x3c')]=qs[_0xde3f('0x33')](_[_0xde3f('0x4f')](_0x5abed3['query'],_0x3b0929[_0xde3f('0x33')]));if(_0x5abed3[_0xde3f('0x32')]['filter']){_0x42f662[_0xde3f('0x3c')]=_[_0xde3f('0x3e')](_0x42f662[_0xde3f('0x3c')],{'$or':_[_0xde3f('0x2b')](_0x42f662[_0xde3f('0x35')],function(_0x3c92fb){var _0x16ebe9={};_0x16ebe9[_0x3c92fb]={'$like':'%'+_0x5abed3['query'][_0xde3f('0x3d')]+'%'};return _0x16ebe9;})});}_0x42f662=_[_0xde3f('0x3e')]({},_0x42f662,_0x5abed3['options']);return _0x246e61['getConfigurations'](_0x42f662);}})[_0xde3f('0x26')](function(_0xd4b630){if(_0xd4b630){_0x4e4303=_0xd4b630[_0xde3f('0x37')];if(!_0x5abed3['query'][_0xde3f('0x38')](_0xde3f('0x39'))){_0x42f662[_0xde3f('0x1f')]=qs['limit'](_0x5abed3[_0xde3f('0x32')]['limit']);_0x42f662['offset']=qs[_0xde3f('0x1e')](_0x5abed3[_0xde3f('0x32')][_0xde3f('0x1e')]);}return _0x246e61['getConfigurations'](_0x42f662);}})[_0xde3f('0x26')](function(_0x58d745){if(_0x58d745){return _0x58d745?{'count':_0x4e4303,'rows':_0x58d745}:null;}})['then'](respondWithResult(_0x4df5b0,null))[_0xde3f('0x47')](handleError(_0x4df5b0,null));};exports[_0xde3f('0x50')]=function(_0x3c400b,_0x41f8b0,_0x29407b){if(_0x3c400b[_0xde3f('0x49')]['id']){delete _0x3c400b[_0xde3f('0x49')]['id'];}return db[_0xde3f('0x2c')][_0xde3f('0x4e')]({'where':{'id':_0x3c400b[_0xde3f('0x4c')]['id']}})[_0xde3f('0x26')](handleEntityNotFound(_0x41f8b0,null))[_0xde3f('0x26')](function(_0x49a085){if(_0x49a085){_0x3c400b[_0xde3f('0x49')]['AccountId']=_0x49a085['id'];_0x3c400b[_0xde3f('0x49')][_0xde3f('0x51')]=integrations[_0xde3f('0x52')](_0x3c400b[_0xde3f('0x49')][_0xde3f('0x53')],_0x3c400b[_0xde3f('0x49')]['type']);_0x3c400b['body'][_0xde3f('0x54')]=integrations['getDescriptions'](_0x3c400b[_0xde3f('0x49')]['channel'],_0x3c400b['body']['type']);return db[_0xde3f('0x55')][_0xde3f('0x48')](_0x3c400b[_0xde3f('0x49')],{'include':[{'model':db[_0xde3f('0x56')],'as':_0xde3f('0x51')},{'model':db[_0xde3f('0x56')],'as':_0xde3f('0x54')}]});}return null;})[_0xde3f('0x26')](respondWithResult(_0x41f8b0,null))['catch'](handleError(_0x41f8b0,null));};exports[_0xde3f('0x57')]=function(_0x1308ef,_0x640129,_0x2cabab){var _0x36dab1=[_0xde3f('0x58'),_0xde3f('0x59'),_0xde3f('0x5a'),'subcategory',_0xde3f('0x5b'),_0xde3f('0x5c'),_0xde3f('0x5d'),'severity',_0xde3f('0x5e')];var _0x44b87e=[_0xde3f('0x5f'),_0xde3f('0x58'),_0xde3f('0x60'),_0xde3f('0x61'),_0xde3f('0x62'),_0xde3f('0x63'),_0xde3f('0x64'),'hold_reason','approval_history',_0xde3f('0x65'),'resolved_by',_0xde3f('0x66'),_0xde3f('0x67'),_0xde3f('0x68'),_0xde3f('0x69'),_0xde3f('0x6a'),_0xde3f('0x6b'),_0xde3f('0x6c'),'knowledge',_0xde3f('0x3a'),_0xde3f('0x6d'),_0xde3f('0x6e'),_0xde3f('0x6f'),_0xde3f('0x70'),_0xde3f('0x71'),_0xde3f('0x72'),_0xde3f('0x73'),_0xde3f('0x74'),_0xde3f('0x75'),_0xde3f('0x76'),'rfc',_0xde3f('0x77'),_0xde3f('0x78'),'opened_at',_0xde3f('0x79'),_0xde3f('0x7a'),'work_end',_0xde3f('0x7b'),_0xde3f('0x7c'),_0xde3f('0x7d'),_0xde3f('0x7e'),_0xde3f('0x7f'),'work_notes',_0xde3f('0x80'),'close_code',_0xde3f('0x81'),_0xde3f('0x82'),_0xde3f('0x83'),_0xde3f('0x84'),_0xde3f('0x85'),_0xde3f('0x86'),'description',_0xde3f('0x87'),'notify',_0xde3f('0x88'),'close_notes',_0xde3f('0x89'),_0xde3f('0x8a'),_0xde3f('0x8b'),_0xde3f('0x8c'),_0xde3f('0x8d'),_0xde3f('0x8e'),_0xde3f('0x5d'),_0xde3f('0x8f'),_0xde3f('0x90'),_0xde3f('0x91'),_0xde3f('0x92'),_0xde3f('0x93'),_0xde3f('0x94'),'severity',_0xde3f('0x95'),_0xde3f('0x96'),_0xde3f('0x97'),_0xde3f('0x98'),_0xde3f('0x99'),_0xde3f('0x9a'),_0xde3f('0x9b'),_0xde3f('0x9c'),_0xde3f('0x9d'),'upon_approval',_0xde3f('0x9e'),'location',_0xde3f('0x5e')];var _0x2f2949='';var _0x12c707='';var _0x55a314=[];var _0x29e8c5='';var _0x219717='';var _0x2f406a=[];var _0x1f4264='';var _0x586de3='';var _0x5c0ccb={};var _0x5a45b0='';return db[_0xde3f('0x2c')][_0xde3f('0x4e')]({'where':{'id':_0x1308ef['params']['id']},'attributes':['id',_0xde3f('0x9f'),'password','email',_0xde3f('0xa0'),_0xde3f('0xa1')]})[_0xde3f('0x26')](handleEntityNotFound(_0x640129,null))[_0xde3f('0x26')](function(_0x349b01){if(_0x349b01){_0x5a45b0=_0x349b01[_0xde3f('0xa0')];var _0x5b0a19=_0x5a45b0[_0xde3f('0xa2')](-0x1);if(_0x5b0a19==='/'){_0x5a45b0=_0x5a45b0[_0xde3f('0xa3')](0x0,_0x5a45b0[_0xde3f('0xa4')](_0x5b0a19));}_0x586de3=util[_0xde3f('0xa5')]('%s/api/now/doc/table/schema/',_0x5a45b0);_0x1f4264=util[_0xde3f('0xa5')]('%s/api/now/table/',_0x5a45b0);_0x5c0ccb={'user':_0x349b01[_0xde3f('0x9f')],'pass':_0x349b01[_0xde3f('0xa6')]};var _0x117dd3={'method':_0xde3f('0xa7'),'uri':_0x586de3+_0xde3f('0xa8'),'auth':_0x5c0ccb,'json':!![]};return rp(_0x117dd3);}})['then'](function(_0x322134){if(_0x322134['result'][_0xde3f('0x37')]>0x0){_0x2f2949=_0x322134[_0xde3f('0xa9')];}console[_0xde3f('0xaa')]('incident\x20table\x20objects',_0x2f2949);_0x2f406a=[];_0x12c707=Object[_0xde3f('0xab')]([],_0x2f2949);_['remove'](_0x12c707,function(_0x5c6644){return!_0x36dab1[_0xde3f('0xac')](_0x5c6644[_0xde3f('0x31')]);});_0x12c707['forEach'](function(_0x4f1335){var _0xbf5156=createFieldObject(_0x1f4264,_0x5c0ccb,_0x4f1335[_0xde3f('0xad')],_0x4f1335[_0xde3f('0x31')],_0x4f1335[_0xde3f('0xae')],![]);_0x2f406a[_0xde3f('0xaf')](_0xbf5156);});return Promise[_0xde3f('0xb0')](_0x2f406a);})[_0xde3f('0x26')](function(_0x29d387){_0x55a314=_0x29d387;_0x29e8c5=Object[_0xde3f('0xab')]([],_0x2f2949);console[_0xde3f('0xaa')](_0xde3f('0xb1'),_0x2f2949);_['remove'](_0x29e8c5,function(_0x4458f9){return _0x44b87e[_0xde3f('0xac')](_0x4458f9[_0xde3f('0x31')]);});console['log'](_0xde3f('0xb2'),_0x29e8c5);_0x2f406a=[];_0x29e8c5['forEach'](function(_0x22fa32){var _0x4b5197=createFieldObject(_0x1f4264,_0x5c0ccb,_0x22fa32[_0xde3f('0xad')],_0x22fa32[_0xde3f('0x31')],_0x22fa32['label'],!![]);_0x2f406a['push'](_0x4b5197);});return Promise[_0xde3f('0xb0')](_0x2f406a);})[_0xde3f('0x26')](function(_0x156668){_0x219717=_0x156668;var _0x50170a=_0x55a314[_0xde3f('0xb3')](_0x219717);return{'count':_0x50170a[_0xde3f('0x37')],'rows':_0x50170a};})[_0xde3f('0x26')](respondWithResult(_0x640129,null))[_0xde3f('0x47')](function(_0x1b7099){console[_0xde3f('0xaa')](_0xde3f('0xb4')+_0x1b7099);var _0x594630=_0x1308ef['query'][_0xde3f('0xb5')]?0x1f4:_0x1b7099[_0xde3f('0xb6')]||0x1f4;logger[_0xde3f('0x28')](_0x1b7099['stack']);delete _0x1b7099['name'];if(_0x594630===0x191){_0x594630=0x190;}_0x640129['status'](_0x594630)['send'](_0x1308ef[_0xde3f('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1b7099[_0xde3f('0xb6')]}:_0x1b7099);});};function createFieldObject(_0x53be28,_0x2b7788,_0x4a7aaa,_0xf1c679,_0xab0480,_0x1e77bb){return new Promise(function(_0x42b1d2,_0x43d91b){var _0x5e7abf={'id':_0xf1c679,'name':_0xab0480,'custom':_0x1e77bb};if(_0x4a7aaa===_0xde3f('0xb7')){_0x5e7abf[_0xde3f('0x40')]=[{'name':_0xde3f('0xb8'),'value':_0xde3f('0xb9')},{'name':_0xde3f('0xba'),'value':_0xde3f('0xbb')}];_0x42b1d2(_0x5e7abf);}else{var _0x46334a={'method':_0xde3f('0xa7'),'uri':_0x53be28+'sys_choice?sysparm_query=name=incident^element='+_0xf1c679,'auth':_0x2b7788,'json':!![]};return rp(_0x46334a)[_0xde3f('0x26')](function(_0x2d01d1){var _0x2d7c4f=[];if(_0x2d01d1[_0xde3f('0xa9')][_0xde3f('0x37')]>0x0){_0x2d01d1[_0xde3f('0xa9')]['forEach'](function(_0x5ed258){if(_0x5ed258['inactive']===_0xde3f('0xbb')){var _0x1a1b15={'name':_0x5ed258[_0xde3f('0xae')],'value':_0x5ed258['value']};_0x2d7c4f[_0xde3f('0xaf')](_0x1a1b15);}});}_0x5e7abf[_0xde3f('0x40')]=_0x2d7c4f;if(_0x5e7abf[_0xde3f('0x40')][_0xde3f('0x37')]>0x0){_0x42b1d2(_0x5e7abf);}else{if(_0x1e77bb==![]){_0x42b1d2();}else{_0x42b1d2(_0x5e7abf);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 64a3fde..a68fb98 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 _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3a93b7,_0x658183){_0x3a93b7=_0x3a93b7-0x0;var _0x2ed891=_0xf2ca[_0x3a93b7];return _0x2ed891;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x35b558,_0xeb7d5c){_0x35b558=_0x35b558-0x0;var _0x481909=_0x3f8a[_0x35b558];return _0x481909;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 37042cf..45e1d12 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 _0x1f1c=['ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetServicenowAccount','options','raw','where','attributes','include','map','model','stringify','catch','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x50dba9,_0x2fe5f7){var _0x37a156=function(_0x31e2e0){while(--_0x31e2e0){_0x50dba9['push'](_0x50dba9['shift']());}};_0x37a156(++_0x2fe5f7);}(_0x1f1c,0x17d));var _0xc1f1=function(_0x578b37,_0x44ee2a){_0x578b37=_0x578b37-0x0;var _0x1efcf5=_0x1f1c[_0x578b37];return _0x1efcf5;};'use strict';var _=require(_0xc1f1('0x0'));var util=require(_0xc1f1('0x1'));var moment=require(_0xc1f1('0x2'));var BPromise=require(_0xc1f1('0x3'));var rs=require(_0xc1f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1f1('0x5'))['db'];var utils=require(_0xc1f1('0x6'));var logger=require(_0xc1f1('0x7'))(_0xc1f1('0x8'));var config=require(_0xc1f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc1f1('0xa')][_0xc1f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de682,_0x2928c0,_0x3758b5){return new BPromise(function(_0x10f16d,_0x5e1b2e){return client[_0xc1f1('0xc')](_0x2de682,_0x3758b5)[_0xc1f1('0xd')](function(_0x4173ab){logger[_0xc1f1('0xe')](_0xc1f1('0xf'),_0x2928c0,'request\x20sent');logger[_0xc1f1('0x10')](_0xc1f1('0x11'),_0x2928c0,_0xc1f1('0x12'),JSON['stringify'](_0x4173ab));if(_0x4173ab['error']){if(_0x4173ab[_0xc1f1('0x13')][_0xc1f1('0x14')]===0x1f4){logger[_0xc1f1('0x13')](_0xc1f1('0xf'),_0x2928c0,_0x4173ab[_0xc1f1('0x13')][_0xc1f1('0x15')]);return _0x5e1b2e(_0x4173ab[_0xc1f1('0x13')][_0xc1f1('0x15')]);}logger['error'](_0xc1f1('0xf'),_0x2928c0,_0x4173ab['error'][_0xc1f1('0x15')]);return _0x10f16d(_0x4173ab[_0xc1f1('0x13')]['message']);}else{logger[_0xc1f1('0xe')](_0xc1f1('0xf'),_0x2928c0,_0xc1f1('0x12'));_0x10f16d(_0x4173ab[_0xc1f1('0x16')][_0xc1f1('0x15')]);}})['catch'](function(_0x529e54){logger[_0xc1f1('0x13')](_0xc1f1('0xf'),_0x2928c0,_0x529e54);_0x5e1b2e(_0x529e54);});});}exports[_0xc1f1('0x17')]=function(_0x42094c){var _0x53b2de=this;return new Promise(function(_0x1b41a0,_0x9feaea){return db['ServicenowAccount']['findAll']({'raw':_0x42094c[_0xc1f1('0x18')]?_0x42094c['options'][_0xc1f1('0x19')]===undefined?!![]:![]:!![],'where':_0x42094c[_0xc1f1('0x18')]?_0x42094c[_0xc1f1('0x18')][_0xc1f1('0x1a')]||null:null,'attributes':_0x42094c[_0xc1f1('0x18')]?_0x42094c['options'][_0xc1f1('0x1b')]||null:null,'limit':_0x42094c[_0xc1f1('0x18')]?_0x42094c[_0xc1f1('0x18')]['limit']||null:null,'include':_0x42094c[_0xc1f1('0x18')]?_0x42094c['options'][_0xc1f1('0x1c')]?_[_0xc1f1('0x1d')](_0x42094c[_0xc1f1('0x18')][_0xc1f1('0x1c')],function(_0x219df0){return{'model':db[_0x219df0[_0xc1f1('0x1e')]],'as':_0x219df0['as'],'attributes':_0x219df0['attributes'],'include':_0x219df0[_0xc1f1('0x1c')]?_[_0xc1f1('0x1d')](_0x219df0[_0xc1f1('0x1c')],function(_0x189a42){return{'model':db[_0x189a42[_0xc1f1('0x1e')]],'as':_0x189a42['as'],'attributes':_0x189a42[_0xc1f1('0x1b')],'include':_0x189a42[_0xc1f1('0x1c')]?_[_0xc1f1('0x1d')](_0x189a42[_0xc1f1('0x1c')],function(_0x45cc24){return{'model':db[_0x45cc24[_0xc1f1('0x1e')]],'as':_0x45cc24['as'],'attributes':_0x45cc24[_0xc1f1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc1f1('0xd')](function(_0x45e595){logger[_0xc1f1('0xe')](_0xc1f1('0x17'),_0x42094c);logger['debug'](_0xc1f1('0x17'),_0x42094c,JSON[_0xc1f1('0x1f')](_0x45e595));_0x1b41a0(_0x45e595);})[_0xc1f1('0x20')](function(_0x1030c8){logger[_0xc1f1('0x13')]('GetServicenowAccount',_0x1030c8[_0xc1f1('0x15')],_0x42094c);_0x9feaea(_0x53b2de[_0xc1f1('0x13')](0x1f4,_0x1030c8[_0xc1f1('0x15')]));});});};exports[_0xc1f1('0x21')]=function(_0x5dec90){var _0x3d1d41=this;return new Promise(function(_0x12e1fa,_0x5f5963){return db[_0xc1f1('0x22')][_0xc1f1('0x23')]({'raw':_0x5dec90[_0xc1f1('0x18')]?_0x5dec90[_0xc1f1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5dec90[_0xc1f1('0x18')]?_0x5dec90[_0xc1f1('0x18')]['where']||null:null,'attributes':_0x5dec90[_0xc1f1('0x18')]?_0x5dec90[_0xc1f1('0x18')][_0xc1f1('0x1b')]||null:null,'include':_0x5dec90['options']?_0x5dec90['options'][_0xc1f1('0x1c')]?_[_0xc1f1('0x1d')](_0x5dec90[_0xc1f1('0x18')][_0xc1f1('0x1c')],function(_0xf80d52){return{'model':db[_0xf80d52[_0xc1f1('0x1e')]],'as':_0xf80d52['as'],'attributes':_0xf80d52[_0xc1f1('0x1b')],'include':_0xf80d52['include']?_[_0xc1f1('0x1d')](_0xf80d52[_0xc1f1('0x1c')],function(_0x59c4bf){return{'model':db[_0x59c4bf[_0xc1f1('0x1e')]],'as':_0x59c4bf['as'],'attributes':_0x59c4bf[_0xc1f1('0x1b')],'include':_0x59c4bf[_0xc1f1('0x1c')]?_['map'](_0x59c4bf[_0xc1f1('0x1c')],function(_0x22910e){return{'model':db[_0x22910e['model']],'as':_0x22910e['as'],'attributes':_0x22910e[_0xc1f1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fbfca){logger[_0xc1f1('0xe')](_0xc1f1('0x21'),_0x5dec90);logger[_0xc1f1('0x10')]('ShowServicenowAccount',_0x5dec90,JSON[_0xc1f1('0x1f')](_0x4fbfca));_0x12e1fa(_0x4fbfca);})[_0xc1f1('0x20')](function(_0x8cd1bb){logger[_0xc1f1('0x13')](_0xc1f1('0x21'),_0x8cd1bb['message'],_0x5dec90);_0x5f5963(_0x3d1d41[_0xc1f1('0x13')](0x1f4,_0x8cd1bb[_0xc1f1('0x15')]));});});}; \ No newline at end of file +var _0x4316=['limit','map','include','model','debug','ShowServicenowAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes'];(function(_0x37a505,_0x319129){var _0x5d094e=function(_0x5b78ea){while(--_0x5b78ea){_0x37a505['push'](_0x37a505['shift']());}};_0x5d094e(++_0x319129);}(_0x4316,0x194));var _0x6431=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4316[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6431('0x0'));var moment=require(_0x6431('0x1'));var BPromise=require(_0x6431('0x2'));var rs=require(_0x6431('0x3'));var fs=require('fs');var Redis=require(_0x6431('0x4'));var db=require(_0x6431('0x5'))['db'];var utils=require(_0x6431('0x6'));var logger=require(_0x6431('0x7'))(_0x6431('0x8'));var config=require(_0x6431('0x9'));var jayson=require(_0x6431('0xa'));var client=jayson[_0x6431('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29b924,_0x3b2e8d,_0x13b446){return new BPromise(function(_0x300f0d,_0x168a4b){return client[_0x6431('0xc')](_0x29b924,_0x13b446)[_0x6431('0xd')](function(_0x5bd31c){logger[_0x6431('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3b2e8d,_0x6431('0xf'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3b2e8d,'request\x20sent',JSON[_0x6431('0x10')](_0x5bd31c));if(_0x5bd31c[_0x6431('0x11')]){if(_0x5bd31c['error'][_0x6431('0x12')]===0x1f4){logger[_0x6431('0x11')](_0x6431('0x13'),_0x3b2e8d,_0x5bd31c['error'][_0x6431('0x14')]);return _0x168a4b(_0x5bd31c['error']['message']);}logger[_0x6431('0x11')](_0x6431('0x13'),_0x3b2e8d,_0x5bd31c[_0x6431('0x11')][_0x6431('0x14')]);return _0x300f0d(_0x5bd31c[_0x6431('0x11')][_0x6431('0x14')]);}else{logger[_0x6431('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x3b2e8d,'request\x20sent');_0x300f0d(_0x5bd31c[_0x6431('0x15')][_0x6431('0x14')]);}})[_0x6431('0x16')](function(_0x13557a){logger[_0x6431('0x11')](_0x6431('0x13'),_0x3b2e8d,_0x13557a);_0x168a4b(_0x13557a);});});}exports[_0x6431('0x17')]=function(_0x1a25ab){var _0x290753=this;return new Promise(function(_0x386cf7,_0x35baa6){return db[_0x6431('0x18')]['findAll']({'raw':_0x1a25ab[_0x6431('0x19')]?_0x1a25ab[_0x6431('0x19')][_0x6431('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a25ab[_0x6431('0x19')]?_0x1a25ab[_0x6431('0x19')]['where']||null:null,'attributes':_0x1a25ab['options']?_0x1a25ab['options'][_0x6431('0x1b')]||null:null,'limit':_0x1a25ab[_0x6431('0x19')]?_0x1a25ab[_0x6431('0x19')][_0x6431('0x1c')]||null:null,'include':_0x1a25ab[_0x6431('0x19')]?_0x1a25ab[_0x6431('0x19')]['include']?_[_0x6431('0x1d')](_0x1a25ab['options'][_0x6431('0x1e')],function(_0x1e17e3){return{'model':db[_0x1e17e3[_0x6431('0x1f')]],'as':_0x1e17e3['as'],'attributes':_0x1e17e3[_0x6431('0x1b')],'include':_0x1e17e3[_0x6431('0x1e')]?_[_0x6431('0x1d')](_0x1e17e3[_0x6431('0x1e')],function(_0x192b05){return{'model':db[_0x192b05[_0x6431('0x1f')]],'as':_0x192b05['as'],'attributes':_0x192b05[_0x6431('0x1b')],'include':_0x192b05[_0x6431('0x1e')]?_[_0x6431('0x1d')](_0x192b05[_0x6431('0x1e')],function(_0x59261f){return{'model':db[_0x59261f[_0x6431('0x1f')]],'as':_0x59261f['as'],'attributes':_0x59261f[_0x6431('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d80f0){logger[_0x6431('0xe')](_0x6431('0x17'),_0x1a25ab);logger[_0x6431('0x20')](_0x6431('0x17'),_0x1a25ab,JSON[_0x6431('0x10')](_0x4d80f0));_0x386cf7(_0x4d80f0);})[_0x6431('0x16')](function(_0x3da334){logger[_0x6431('0x11')](_0x6431('0x17'),_0x3da334['message'],_0x1a25ab);_0x35baa6(_0x290753[_0x6431('0x11')](0x1f4,_0x3da334[_0x6431('0x14')]));});});};exports[_0x6431('0x21')]=function(_0x270d41){var _0x349aa2=this;return new Promise(function(_0x2e0123,_0x173060){return db[_0x6431('0x18')][_0x6431('0x22')]({'raw':_0x270d41[_0x6431('0x19')]?_0x270d41['options'][_0x6431('0x1a')]===undefined?!![]:![]:!![],'where':_0x270d41[_0x6431('0x19')]?_0x270d41['options'][_0x6431('0x23')]||null:null,'attributes':_0x270d41['options']?_0x270d41[_0x6431('0x19')][_0x6431('0x1b')]||null:null,'include':_0x270d41[_0x6431('0x19')]?_0x270d41[_0x6431('0x19')][_0x6431('0x1e')]?_[_0x6431('0x1d')](_0x270d41[_0x6431('0x19')][_0x6431('0x1e')],function(_0x45d254){return{'model':db[_0x45d254['model']],'as':_0x45d254['as'],'attributes':_0x45d254[_0x6431('0x1b')],'include':_0x45d254[_0x6431('0x1e')]?_[_0x6431('0x1d')](_0x45d254[_0x6431('0x1e')],function(_0x2349f0){return{'model':db[_0x2349f0[_0x6431('0x1f')]],'as':_0x2349f0['as'],'attributes':_0x2349f0[_0x6431('0x1b')],'include':_0x2349f0[_0x6431('0x1e')]?_[_0x6431('0x1d')](_0x2349f0[_0x6431('0x1e')],function(_0x2172ad){return{'model':db[_0x2172ad[_0x6431('0x1f')]],'as':_0x2172ad['as'],'attributes':_0x2172ad[_0x6431('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6431('0xd')](function(_0x57dad1){logger[_0x6431('0xe')]('ShowServicenowAccount',_0x270d41);logger['debug'](_0x6431('0x21'),_0x270d41,JSON[_0x6431('0x10')](_0x57dad1));_0x2e0123(_0x57dad1);})[_0x6431('0x16')](function(_0x588038){logger[_0x6431('0x11')](_0x6431('0x21'),_0x588038[_0x6431('0x14')],_0x270d41);_0x173060(_0x349aa2[_0x6431('0x11')](0x1f4,_0x588038[_0x6431('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index bbc790c..44191ea 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 _0x8cd3=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','update'];(function(_0x152a89,_0x213455){var _0x47f1cb=function(_0x4d554e){while(--_0x4d554e){_0x152a89['push'](_0x152a89['shift']());}};_0x47f1cb(++_0x213455);}(_0x8cd3,0x1cf));var _0x38cd=function(_0x16b266,_0x3699e7){_0x16b266=_0x16b266-0x0;var _0x246e06=_0x8cd3[_0x16b266];return _0x246e06;};'use strict';var multer=require(_0x38cd('0x0'));var util=require(_0x38cd('0x1'));var path=require(_0x38cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x38cd('0x3'));var router=express[_0x38cd('0x4')]();var fs_extra=require(_0x38cd('0x5'));var auth=require(_0x38cd('0x6'));var interaction=require(_0x38cd('0x7'));var config=require(_0x38cd('0x8'));var controller=require(_0x38cd('0x9'));router['get']('/',auth[_0x38cd('0xa')](),controller['index']);router[_0x38cd('0xb')](_0x38cd('0xc'),auth['isAuthenticated'](),controller[_0x38cd('0xd')]);router['get'](_0x38cd('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x38cd('0xb')](_0x38cd('0xf'),auth[_0x38cd('0xa')](),controller[_0x38cd('0x10')]);router[_0x38cd('0xb')](_0x38cd('0x11'),auth[_0x38cd('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x38cd('0xa')](),controller[_0x38cd('0x12')]);router['put'](_0x38cd('0xc'),auth[_0x38cd('0xa')](),controller[_0x38cd('0x13')]);router['delete'](_0x38cd('0xc'),auth['isAuthenticated'](),controller[_0x38cd('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6980=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy','exports','multer'];(function(_0x42f3a5,_0x3a4470){var _0x1a7d74=function(_0x43cc36){while(--_0x43cc36){_0x42f3a5['push'](_0x42f3a5['shift']());}};_0x1a7d74(++_0x3a4470);}(_0x6980,0xc7));var _0x0698=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0x6980[_0x461c18];return _0x35501c;};'use strict';var multer=require(_0x0698('0x0'));var util=require(_0x0698('0x1'));var path=require(_0x0698('0x2'));var timeout=require(_0x0698('0x3'));var express=require(_0x0698('0x4'));var router=express[_0x0698('0x5')]();var fs_extra=require(_0x0698('0x6'));var auth=require(_0x0698('0x7'));var interaction=require(_0x0698('0x8'));var config=require(_0x0698('0x9'));var controller=require(_0x0698('0xa'));router[_0x0698('0xb')]('/',auth[_0x0698('0xc')](),controller[_0x0698('0xd')]);router[_0x0698('0xb')]('/:id',auth[_0x0698('0xc')](),controller['show']);router[_0x0698('0xb')](_0x0698('0xe'),auth[_0x0698('0xc')](),controller['getFields']);router[_0x0698('0xb')](_0x0698('0xf'),auth['isAuthenticated'](),controller[_0x0698('0x10')]);router[_0x0698('0xb')](_0x0698('0x11'),auth[_0x0698('0xc')](),controller[_0x0698('0x12')]);router[_0x0698('0x13')]('/',auth[_0x0698('0xc')](),controller[_0x0698('0x14')]);router[_0x0698('0x15')]('/:id',auth[_0x0698('0xc')](),controller['update']);router['delete'](_0x0698('0x16'),auth[_0x0698('0xc')](),controller[_0x0698('0x17')]);module[_0x0698('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index cc38a4c..3929c2e 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 _0x345d=['STRING'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x345d,0x7a));var _0xd345=function(_0xe8a81,_0x553451){_0xe8a81=_0xe8a81-0x0;var _0x423a8c=_0x345d[_0xe8a81];return _0x423a8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd345('0x0')]},'description':{'type':Sequelize[_0xd345('0x0')]}}; \ No newline at end of file +var _0x8aa9=['sequelize','exports','STRING'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8aa9,0x156));var _0x98aa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8aa9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x98aa('0x0'));module[_0x98aa('0x1')]={'name':{'type':Sequelize[_0x98aa('0x2')]},'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 3263743..8fcbd96 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 _0x219b=['nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','keys','query','model','fields','attributes','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','filters','intersection','length','includeAll','find','create','body','params','getFields','findOne','ServicenowField','order'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x219b,0xff));var _0xb219=function(_0x5c912e,_0x141294){_0x5c912e=_0x5c912e-0x0;var _0x5d74f4=_0x219b[_0x5c912e];return _0x5d74f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb219('0x0'));var zipdir=require(_0xb219('0x1'));var jsonpatch=require(_0xb219('0x2'));var rp=require(_0xb219('0x3'));var moment=require(_0xb219('0x4'));var BPromise=require(_0xb219('0x5'));var Mustache=require(_0xb219('0x6'));var util=require(_0xb219('0x7'));var path=require(_0xb219('0x8'));var sox=require(_0xb219('0x9'));var csv=require(_0xb219('0xa'));var ejs=require(_0xb219('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb219('0xc'));var squel=require(_0xb219('0xd'));var crypto=require(_0xb219('0xe'));var jsforce=require(_0xb219('0xf'));var deskjs=require(_0xb219('0x10'));var toCsv=require(_0xb219('0xa'));var querystring=require('querystring');var Papa=require(_0xb219('0x11'));var Redis=require(_0xb219('0x12'));var authService=require(_0xb219('0x13'));var qs=require(_0xb219('0x14'));var as=require(_0xb219('0x15'));var hardwareService=require(_0xb219('0x16'));var logger=require('../../config/logger')(_0xb219('0x17'));var utils=require('../../config/utils');var config=require(_0xb219('0x18'));var licenseUtil=require(_0xb219('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d07b,_0x102417){_0x102417=_0x102417||0xcc;return function(_0x42de66){if(_0x42de66){return _0x40d07b[_0xb219('0x1a')](_0x102417);}return _0x40d07b[_0xb219('0x1b')](_0x102417)['end']();};}function respondWithResult(_0x49f77b,_0xd131b5){_0xd131b5=_0xd131b5||0xc8;return function(_0x3e1d41){if(_0x3e1d41){return _0x49f77b[_0xb219('0x1b')](_0xd131b5)[_0xb219('0x1c')](_0x3e1d41);}};}function respondWithFilteredResult(_0x2e84b9,_0x46ea1d){return function(_0x5679b0){if(_0x5679b0){var _0x5a9fc0=typeof _0x46ea1d['offset']===_0xb219('0x1d')&&typeof _0x46ea1d[_0xb219('0x1e')]===_0xb219('0x1d');var _0x56b388=_0x5679b0[_0xb219('0x1f')];var _0x839e87=_0x5a9fc0?0x0:_0x46ea1d[_0xb219('0x20')];var _0x392b10=_0x5a9fc0?_0x5679b0['count']:_0x46ea1d[_0xb219('0x20')]+_0x46ea1d[_0xb219('0x1e')];var _0x585d95;if(_0x392b10>=_0x56b388){_0x392b10=_0x56b388;_0x585d95=0xc8;}else{_0x585d95=0xce;}_0x2e84b9['status'](_0x585d95);return _0x2e84b9[_0xb219('0x21')](_0xb219('0x22'),_0x839e87+'-'+_0x392b10+'/'+_0x56b388)[_0xb219('0x1c')](_0x5679b0);}return null;};}function patchUpdates(_0x425346){return function(_0x51efe2){try{jsonpatch[_0xb219('0x23')](_0x51efe2,_0x425346,!![]);}catch(_0x489591){return BPromise[_0xb219('0x24')](_0x489591);}return _0x51efe2['save']();};}function saveUpdates(_0x247a08,_0x6c0e37){return function(_0x2840ee){if(_0x2840ee){return _0x2840ee[_0xb219('0x25')](_0x247a08)[_0xb219('0x26')](function(_0x2192ed){return _0x2192ed;});}return null;};}function removeEntity(_0x124c37,_0x4a6832){return function(_0x24e234){if(_0x24e234){return _0x24e234[_0xb219('0x27')]()[_0xb219('0x26')](function(){_0x124c37[_0xb219('0x1b')](0xcc)[_0xb219('0x28')]();});}};}function handleEntityNotFound(_0x1cbcac,_0x110b80){return function(_0x140e93){if(!_0x140e93){_0x1cbcac['sendStatus'](0x194);}return _0x140e93;};}function handleError(_0x6b2fc8,_0x827a91){_0x827a91=_0x827a91||0x1f4;return function(_0x1b6961){logger['error'](_0x1b6961[_0xb219('0x29')]);if(_0x1b6961['name']){delete _0x1b6961[_0xb219('0x2a')];}_0x6b2fc8['status'](_0x827a91)[_0xb219('0x2b')](_0x1b6961);};}exports[_0xb219('0x2c')]=function(_0x59219c,_0x54c4fc){var _0xe77180={},_0x488ee6={},_0x702b97={'count':0x0,'rows':[]};var _0x235f1e=_[_0xb219('0x2d')](db[_0xb219('0x2e')][_0xb219('0x2f')],function(_0x336409){return{'name':_0x336409[_0xb219('0x30')],'type':_0x336409[_0xb219('0x31')][_0xb219('0x32')]};});_0x488ee6['model']=_['map'](_0x235f1e,_0xb219('0x2a'));_0x488ee6['query']=_[_0xb219('0x33')](_0x59219c[_0xb219('0x34')]);_0x488ee6['filters']=_['intersection'](_0x488ee6['model'],_0x488ee6[_0xb219('0x34')]);_0xe77180['attributes']=_['intersection'](_0x488ee6[_0xb219('0x35')],qs[_0xb219('0x36')](_0x59219c[_0xb219('0x34')][_0xb219('0x36')]));_0xe77180[_0xb219('0x37')]=_0xe77180[_0xb219('0x37')]['length']?_0xe77180[_0xb219('0x37')]:_0x488ee6[_0xb219('0x35')];if(!_0x59219c[_0xb219('0x34')][_0xb219('0x38')]('nolimit')){_0xe77180[_0xb219('0x1e')]=qs[_0xb219('0x1e')](_0x59219c[_0xb219('0x34')][_0xb219('0x1e')]);_0xe77180['offset']=qs[_0xb219('0x20')](_0x59219c[_0xb219('0x34')][_0xb219('0x20')]);}_0xe77180['order']=qs[_0xb219('0x39')](_0x59219c[_0xb219('0x34')]['sort']);_0xe77180['where']=qs['filters'](_[_0xb219('0x3a')](_0x59219c[_0xb219('0x34')],_0x488ee6['filters']),_0x235f1e);if(_0x59219c[_0xb219('0x34')][_0xb219('0x3b')]){_0xe77180[_0xb219('0x3c')]=_[_0xb219('0x3d')](_0xe77180[_0xb219('0x3c')],{'$or':_[_0xb219('0x2d')](_0x235f1e,function(_0x2a628b){if(_0x2a628b['type']!==_0xb219('0x3e')){var _0x5a8a6c={};_0x5a8a6c[_0x2a628b['name']]={'$like':'%'+_0x59219c['query']['filter']+'%'};return _0x5a8a6c;}})});}_0xe77180=_[_0xb219('0x3d')]({},_0xe77180,_0x59219c[_0xb219('0x3f')]);var _0x15f951={'where':_0xe77180[_0xb219('0x3c')]};return db[_0xb219('0x2e')][_0xb219('0x1f')](_0x15f951)[_0xb219('0x26')](function(_0x2a0885){_0x702b97[_0xb219('0x1f')]=_0x2a0885;if(_0x59219c[_0xb219('0x34')]['includeAll']){_0xe77180[_0xb219('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xb219('0x41')](_0xe77180);})[_0xb219('0x26')](function(_0x394233){_0x702b97[_0xb219('0x42')]=_0x394233;return _0x702b97;})['then'](respondWithFilteredResult(_0x54c4fc,_0xe77180))[_0xb219('0x43')](handleError(_0x54c4fc,null));};exports[_0xb219('0x44')]=function(_0x50e7b2,_0x247a49){var _0x1b5268={'raw':![],'where':{'id':_0x50e7b2['params']['id']}},_0x33ba2b={};_0x33ba2b[_0xb219('0x35')]=_[_0xb219('0x33')](db['ServicenowConfiguration']['rawAttributes']);_0x33ba2b['query']=_[_0xb219('0x33')](_0x50e7b2['query']);_0x33ba2b[_0xb219('0x45')]=_[_0xb219('0x46')](_0x33ba2b[_0xb219('0x35')],_0x33ba2b[_0xb219('0x34')]);_0x1b5268[_0xb219('0x37')]=_[_0xb219('0x46')](_0x33ba2b[_0xb219('0x35')],qs['fields'](_0x50e7b2['query'][_0xb219('0x36')]));_0x1b5268[_0xb219('0x37')]=_0x1b5268[_0xb219('0x37')][_0xb219('0x47')]?_0x1b5268[_0xb219('0x37')]:_0x33ba2b['model'];if(_0x50e7b2[_0xb219('0x34')][_0xb219('0x48')]){_0x1b5268[_0xb219('0x40')]=[{'all':!![]}];}_0x1b5268=_[_0xb219('0x3d')]({},_0x1b5268,_0x50e7b2[_0xb219('0x3f')]);return db[_0xb219('0x2e')][_0xb219('0x49')](_0x1b5268)[_0xb219('0x26')](handleEntityNotFound(_0x247a49,null))[_0xb219('0x26')](respondWithResult(_0x247a49,null))[_0xb219('0x43')](handleError(_0x247a49,null));};exports[_0xb219('0x4a')]=function(_0x308d07,_0x47a4ca){return db[_0xb219('0x2e')][_0xb219('0x4a')](_0x308d07[_0xb219('0x4b')],{})['then'](respondWithResult(_0x47a4ca,0xc9))[_0xb219('0x43')](handleError(_0x47a4ca,null));};exports[_0xb219('0x25')]=function(_0x29deb0,_0x20f100){if(_0x29deb0[_0xb219('0x4b')]['id']){delete _0x29deb0[_0xb219('0x4b')]['id'];}return db[_0xb219('0x2e')]['find']({'where':{'id':_0x29deb0[_0xb219('0x4c')]['id']}})[_0xb219('0x26')](handleEntityNotFound(_0x20f100,null))[_0xb219('0x26')](saveUpdates(_0x29deb0[_0xb219('0x4b')],null))['then'](respondWithResult(_0x20f100,null))[_0xb219('0x43')](handleError(_0x20f100,null));};exports['destroy']=function(_0x21e4e1,_0x2e1048){return db[_0xb219('0x2e')]['find']({'where':{'id':_0x21e4e1[_0xb219('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e1048,null))[_0xb219('0x26')](removeEntity(_0x2e1048,null))[_0xb219('0x43')](handleError(_0x2e1048,null));};exports[_0xb219('0x4d')]=function(_0x1abcfb,_0x35eb7f,_0x511676){var _0x2e6d58={};var _0x5b1059={};var _0x5368f4;var _0x2d1fed;return db[_0xb219('0x2e')][_0xb219('0x4e')]({'where':{'id':_0x1abcfb[_0xb219('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35eb7f,null))[_0xb219('0x26')](function(_0x4cff16){if(_0x4cff16){_0x5368f4=_0x4cff16;_0x5b1059['model']=_[_0xb219('0x33')](db[_0xb219('0x4f')][_0xb219('0x2f')]);_0x5b1059[_0xb219('0x34')]=_[_0xb219('0x33')](_0x1abcfb[_0xb219('0x34')]);_0x5b1059[_0xb219('0x45')]=_['intersection'](_0x5b1059['model'],_0x5b1059[_0xb219('0x34')]);_0x2e6d58['attributes']=_['intersection'](_0x5b1059[_0xb219('0x35')],qs[_0xb219('0x36')](_0x1abcfb[_0xb219('0x34')]['fields']));_0x2e6d58[_0xb219('0x37')]=_0x2e6d58[_0xb219('0x37')][_0xb219('0x47')]?_0x2e6d58['attributes']:_0x5b1059['model'];_0x2e6d58[_0xb219('0x50')]=qs[_0xb219('0x39')](_0x1abcfb['query'][_0xb219('0x39')]);_0x2e6d58[_0xb219('0x3c')]=qs[_0xb219('0x45')](_[_0xb219('0x3a')](_0x1abcfb[_0xb219('0x34')],_0x5b1059['filters']));if(_0x1abcfb['query'][_0xb219('0x3b')]){_0x2e6d58['where']=_['merge'](_0x2e6d58[_0xb219('0x3c')],{'$or':_[_0xb219('0x2d')](_0x2e6d58[_0xb219('0x37')],function(_0x2c4d4d){var _0x55d286={};_0x55d286[_0x2c4d4d]={'$like':'%'+_0x1abcfb[_0xb219('0x34')][_0xb219('0x3b')]+'%'};return _0x55d286;})});}_0x2e6d58=_[_0xb219('0x3d')]({},_0x2e6d58,_0x1abcfb[_0xb219('0x3f')]);return _0x5368f4[_0xb219('0x4d')](_0x2e6d58);}})[_0xb219('0x26')](function(_0x4bf431){if(_0x4bf431){_0x2d1fed=_0x4bf431[_0xb219('0x47')];if(!_0x1abcfb['query'][_0xb219('0x38')](_0xb219('0x51'))){_0x2e6d58[_0xb219('0x1e')]=qs[_0xb219('0x1e')](_0x1abcfb[_0xb219('0x34')][_0xb219('0x1e')]);_0x2e6d58['offset']=qs[_0xb219('0x20')](_0x1abcfb['query']['offset']);}return _0x5368f4['getFields'](_0x2e6d58);}})[_0xb219('0x26')](function(_0x8ff681){if(_0x8ff681){return _0x8ff681?{'count':_0x2d1fed,'rows':_0x8ff681}:null;}})['then'](respondWithResult(_0x35eb7f,null))[_0xb219('0x43')](handleError(_0x35eb7f,null));};exports[_0xb219('0x52')]=function(_0x4d4ad8,_0x2f27f9,_0x3623f9){var _0x1d712f={};var _0x4fd901={};var _0x2da8d2;var _0xbca55;return db[_0xb219('0x2e')][_0xb219('0x4e')]({'where':{'id':_0x4d4ad8['params']['id']}})[_0xb219('0x26')](handleEntityNotFound(_0x2f27f9,null))[_0xb219('0x26')](function(_0x56d6aa){if(_0x56d6aa){_0x2da8d2=_0x56d6aa;_0x4fd901[_0xb219('0x35')]=_['keys'](db[_0xb219('0x4f')]['rawAttributes']);_0x4fd901[_0xb219('0x34')]=_['keys'](_0x4d4ad8[_0xb219('0x34')]);_0x4fd901[_0xb219('0x45')]=_[_0xb219('0x46')](_0x4fd901['model'],_0x4fd901[_0xb219('0x34')]);_0x1d712f[_0xb219('0x37')]=_[_0xb219('0x46')](_0x4fd901[_0xb219('0x35')],qs['fields'](_0x4d4ad8[_0xb219('0x34')][_0xb219('0x36')]));_0x1d712f[_0xb219('0x37')]=_0x1d712f[_0xb219('0x37')][_0xb219('0x47')]?_0x1d712f[_0xb219('0x37')]:_0x4fd901[_0xb219('0x35')];_0x1d712f[_0xb219('0x50')]=qs[_0xb219('0x39')](_0x4d4ad8[_0xb219('0x34')][_0xb219('0x39')]);_0x1d712f[_0xb219('0x3c')]=qs[_0xb219('0x45')](_[_0xb219('0x3a')](_0x4d4ad8['query'],_0x4fd901['filters']));if(_0x4d4ad8[_0xb219('0x34')][_0xb219('0x3b')]){_0x1d712f[_0xb219('0x3c')]=_[_0xb219('0x3d')](_0x1d712f[_0xb219('0x3c')],{'$or':_[_0xb219('0x2d')](_0x1d712f[_0xb219('0x37')],function(_0x553f70){var _0xceb757={};_0xceb757[_0x553f70]={'$like':'%'+_0x4d4ad8[_0xb219('0x34')][_0xb219('0x3b')]+'%'};return _0xceb757;})});}_0x1d712f=_[_0xb219('0x3d')]({},_0x1d712f,_0x4d4ad8['options']);return _0x2da8d2[_0xb219('0x52')](_0x1d712f);}})['then'](function(_0x3ee2f4){if(_0x3ee2f4){_0xbca55=_0x3ee2f4[_0xb219('0x47')];if(!_0x4d4ad8[_0xb219('0x34')][_0xb219('0x38')](_0xb219('0x51'))){_0x1d712f[_0xb219('0x1e')]=qs[_0xb219('0x1e')](_0x4d4ad8[_0xb219('0x34')][_0xb219('0x1e')]);_0x1d712f['offset']=qs[_0xb219('0x20')](_0x4d4ad8[_0xb219('0x34')][_0xb219('0x20')]);}return _0x2da8d2[_0xb219('0x52')](_0x1d712f);}})[_0xb219('0x26')](function(_0x59efec){if(_0x59efec){return _0x59efec?{'count':_0xbca55,'rows':_0x59efec}:null;}})['then'](respondWithResult(_0x2f27f9,null))[_0xb219('0x43')](handleError(_0x2f27f9,null));};exports['getDescriptions']=function(_0x1fa4d0,_0x2654fe,_0x584957){var _0x167cc0={};var _0x535062={};var _0x33a33f;var _0x153fa6;return db[_0xb219('0x2e')][_0xb219('0x4e')]({'where':{'id':_0x1fa4d0[_0xb219('0x4c')]['id']}})[_0xb219('0x26')](handleEntityNotFound(_0x2654fe,null))[_0xb219('0x26')](function(_0x35f5b7){if(_0x35f5b7){_0x33a33f=_0x35f5b7;_0x535062[_0xb219('0x35')]=_['keys'](db[_0xb219('0x4f')]['rawAttributes']);_0x535062[_0xb219('0x34')]=_[_0xb219('0x33')](_0x1fa4d0[_0xb219('0x34')]);_0x535062[_0xb219('0x45')]=_[_0xb219('0x46')](_0x535062[_0xb219('0x35')],_0x535062[_0xb219('0x34')]);_0x167cc0[_0xb219('0x37')]=_[_0xb219('0x46')](_0x535062['model'],qs[_0xb219('0x36')](_0x1fa4d0[_0xb219('0x34')][_0xb219('0x36')]));_0x167cc0[_0xb219('0x37')]=_0x167cc0[_0xb219('0x37')][_0xb219('0x47')]?_0x167cc0[_0xb219('0x37')]:_0x535062[_0xb219('0x35')];_0x167cc0[_0xb219('0x50')]=qs[_0xb219('0x39')](_0x1fa4d0[_0xb219('0x34')][_0xb219('0x39')]);_0x167cc0[_0xb219('0x3c')]=qs[_0xb219('0x45')](_['pick'](_0x1fa4d0[_0xb219('0x34')],_0x535062[_0xb219('0x45')]));if(_0x1fa4d0[_0xb219('0x34')]['filter']){_0x167cc0[_0xb219('0x3c')]=_['merge'](_0x167cc0[_0xb219('0x3c')],{'$or':_[_0xb219('0x2d')](_0x167cc0['attributes'],function(_0x2bc922){var _0x1c4fe5={};_0x1c4fe5[_0x2bc922]={'$like':'%'+_0x1fa4d0['query']['filter']+'%'};return _0x1c4fe5;})});}_0x167cc0=_[_0xb219('0x3d')]({},_0x167cc0,_0x1fa4d0[_0xb219('0x3f')]);return _0x33a33f['getDescriptions'](_0x167cc0);}})['then'](function(_0x2702b1){if(_0x2702b1){_0x153fa6=_0x2702b1[_0xb219('0x47')];if(!_0x1fa4d0['query'][_0xb219('0x38')](_0xb219('0x51'))){_0x167cc0[_0xb219('0x1e')]=qs['limit'](_0x1fa4d0['query'][_0xb219('0x1e')]);_0x167cc0['offset']=qs[_0xb219('0x20')](_0x1fa4d0['query']['offset']);}return _0x33a33f[_0xb219('0x53')](_0x167cc0);}})[_0xb219('0x26')](function(_0x4fb63f){if(_0x4fb63f){return _0x4fb63f?{'count':_0x153fa6,'rows':_0x4fb63f}:null;}})['then'](respondWithResult(_0x2654fe,null))[_0xb219('0x43')](handleError(_0x2654fe,null));}; \ No newline at end of file +var _0xed19=['getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','sendStatus','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','keys','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','options','find','catch','create','body','update','findOne','ServicenowField','rawAttributes','pick','getFields','hasOwnProperty'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xed19,0xdd));var _0x9ed1=function(_0x7825f0,_0x565f99){_0x7825f0=_0x7825f0-0x0;var _0xabb65a=_0xed19[_0x7825f0];return _0xabb65a;};'use strict';var emlformat=require(_0x9ed1('0x0'));var rimraf=require(_0x9ed1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ed1('0x2'));var rp=require(_0x9ed1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9ed1('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9ed1('0x5'));var ejs=require(_0x9ed1('0x6'));var fs=require('fs');var fs_extra=require(_0x9ed1('0x7'));var _=require(_0x9ed1('0x8'));var squel=require(_0x9ed1('0x9'));var crypto=require(_0x9ed1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ed1('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9ed1('0xc'));var qs=require(_0x9ed1('0xd'));var as=require(_0x9ed1('0xe'));var hardwareService=require(_0x9ed1('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9ed1('0x10'));var config=require(_0x9ed1('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340670,_0x5f5dc2){_0x5f5dc2=_0x5f5dc2||0xcc;return function(_0x44dde1){if(_0x44dde1){return _0x340670['sendStatus'](_0x5f5dc2);}return _0x340670[_0x9ed1('0x12')](_0x5f5dc2)['end']();};}function respondWithResult(_0x4dc9d3,_0x36963b){_0x36963b=_0x36963b||0xc8;return function(_0xd58c10){if(_0xd58c10){return _0x4dc9d3[_0x9ed1('0x12')](_0x36963b)[_0x9ed1('0x13')](_0xd58c10);}};}function respondWithFilteredResult(_0xa3df0a,_0x42aac4){return function(_0x5faf6f){if(_0x5faf6f){var _0x5b02a6=typeof _0x42aac4[_0x9ed1('0x14')]===_0x9ed1('0x15')&&typeof _0x42aac4[_0x9ed1('0x16')]===_0x9ed1('0x15');var _0x3cd6a8=_0x5faf6f[_0x9ed1('0x17')];var _0x235289=_0x5b02a6?0x0:_0x42aac4[_0x9ed1('0x14')];var _0x1559e8=_0x5b02a6?_0x5faf6f[_0x9ed1('0x17')]:_0x42aac4[_0x9ed1('0x14')]+_0x42aac4[_0x9ed1('0x16')];var _0x47d596;if(_0x1559e8>=_0x3cd6a8){_0x1559e8=_0x3cd6a8;_0x47d596=0xc8;}else{_0x47d596=0xce;}_0xa3df0a[_0x9ed1('0x12')](_0x47d596);return _0xa3df0a[_0x9ed1('0x18')](_0x9ed1('0x19'),_0x235289+'-'+_0x1559e8+'/'+_0x3cd6a8)['json'](_0x5faf6f);}return null;};}function patchUpdates(_0x51f804){return function(_0x1b2371){try{jsonpatch['apply'](_0x1b2371,_0x51f804,!![]);}catch(_0x5425b1){return BPromise[_0x9ed1('0x1a')](_0x5425b1);}return _0x1b2371['save']();};}function saveUpdates(_0x4468f9,_0x36af18){return function(_0x5cbba2){if(_0x5cbba2){return _0x5cbba2['update'](_0x4468f9)[_0x9ed1('0x1b')](function(_0x4d2702){return _0x4d2702;});}return null;};}function removeEntity(_0x1d4726,_0x5dded1){return function(_0x454c8c){if(_0x454c8c){return _0x454c8c[_0x9ed1('0x1c')]()[_0x9ed1('0x1b')](function(){_0x1d4726[_0x9ed1('0x12')](0xcc)[_0x9ed1('0x1d')]();});}};}function handleEntityNotFound(_0x2fca01,_0x58fbb8){return function(_0x56051c){if(!_0x56051c){_0x2fca01[_0x9ed1('0x1e')](0x194);}return _0x56051c;};}function handleError(_0x319ac6,_0x503622){_0x503622=_0x503622||0x1f4;return function(_0x3a5290){logger['error'](_0x3a5290[_0x9ed1('0x1f')]);if(_0x3a5290[_0x9ed1('0x20')]){delete _0x3a5290['name'];}_0x319ac6[_0x9ed1('0x12')](_0x503622)[_0x9ed1('0x21')](_0x3a5290);};}exports[_0x9ed1('0x22')]=function(_0x4dbedb,_0x44acfa){var _0x4c503e={},_0x2de522={},_0x14856a={'count':0x0,'rows':[]};var _0x235c44=_[_0x9ed1('0x23')](db[_0x9ed1('0x24')]['rawAttributes'],function(_0x5615cd){return{'name':_0x5615cd[_0x9ed1('0x25')],'type':_0x5615cd[_0x9ed1('0x26')]['key']};});_0x2de522['model']=_[_0x9ed1('0x23')](_0x235c44,_0x9ed1('0x20'));_0x2de522['query']=_[_0x9ed1('0x27')](_0x4dbedb['query']);_0x2de522[_0x9ed1('0x28')]=_['intersection'](_0x2de522[_0x9ed1('0x29')],_0x2de522[_0x9ed1('0x2a')]);_0x4c503e[_0x9ed1('0x2b')]=_[_0x9ed1('0x2c')](_0x2de522['model'],qs['fields'](_0x4dbedb[_0x9ed1('0x2a')][_0x9ed1('0x2d')]));_0x4c503e[_0x9ed1('0x2b')]=_0x4c503e[_0x9ed1('0x2b')][_0x9ed1('0x2e')]?_0x4c503e['attributes']:_0x2de522['model'];if(!_0x4dbedb[_0x9ed1('0x2a')]['hasOwnProperty'](_0x9ed1('0x2f'))){_0x4c503e['limit']=qs['limit'](_0x4dbedb[_0x9ed1('0x2a')][_0x9ed1('0x16')]);_0x4c503e['offset']=qs[_0x9ed1('0x14')](_0x4dbedb['query'][_0x9ed1('0x14')]);}_0x4c503e[_0x9ed1('0x30')]=qs[_0x9ed1('0x31')](_0x4dbedb[_0x9ed1('0x2a')][_0x9ed1('0x31')]);_0x4c503e[_0x9ed1('0x32')]=qs['filters'](_['pick'](_0x4dbedb[_0x9ed1('0x2a')],_0x2de522[_0x9ed1('0x28')]),_0x235c44);if(_0x4dbedb['query'][_0x9ed1('0x33')]){_0x4c503e[_0x9ed1('0x32')]=_[_0x9ed1('0x34')](_0x4c503e[_0x9ed1('0x32')],{'$or':_['map'](_0x235c44,function(_0x5a49c5){if(_0x5a49c5[_0x9ed1('0x26')]!==_0x9ed1('0x35')){var _0x5b3d2d={};_0x5b3d2d[_0x5a49c5[_0x9ed1('0x20')]]={'$like':'%'+_0x4dbedb[_0x9ed1('0x2a')][_0x9ed1('0x33')]+'%'};return _0x5b3d2d;}})});}_0x4c503e=_['merge']({},_0x4c503e,_0x4dbedb['options']);var _0x58b33e={'where':_0x4c503e[_0x9ed1('0x32')]};return db[_0x9ed1('0x24')][_0x9ed1('0x17')](_0x58b33e)[_0x9ed1('0x1b')](function(_0x1c7e1d){_0x14856a[_0x9ed1('0x17')]=_0x1c7e1d;if(_0x4dbedb[_0x9ed1('0x2a')][_0x9ed1('0x36')]){_0x4c503e['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x9ed1('0x37')](_0x4c503e);})['then'](function(_0x159645){_0x14856a[_0x9ed1('0x38')]=_0x159645;return _0x14856a;})[_0x9ed1('0x1b')](respondWithFilteredResult(_0x44acfa,_0x4c503e))['catch'](handleError(_0x44acfa,null));};exports['show']=function(_0x4252cd,_0x4a5f64){var _0x378671={'raw':![],'where':{'id':_0x4252cd[_0x9ed1('0x39')]['id']}},_0x41942d={};_0x41942d[_0x9ed1('0x29')]=_['keys'](db[_0x9ed1('0x24')]['rawAttributes']);_0x41942d[_0x9ed1('0x2a')]=_[_0x9ed1('0x27')](_0x4252cd[_0x9ed1('0x2a')]);_0x41942d[_0x9ed1('0x28')]=_['intersection'](_0x41942d[_0x9ed1('0x29')],_0x41942d[_0x9ed1('0x2a')]);_0x378671[_0x9ed1('0x2b')]=_[_0x9ed1('0x2c')](_0x41942d['model'],qs[_0x9ed1('0x2d')](_0x4252cd[_0x9ed1('0x2a')][_0x9ed1('0x2d')]));_0x378671[_0x9ed1('0x2b')]=_0x378671[_0x9ed1('0x2b')]['length']?_0x378671['attributes']:_0x41942d[_0x9ed1('0x29')];if(_0x4252cd['query'][_0x9ed1('0x36')]){_0x378671[_0x9ed1('0x3a')]=[{'all':!![]}];}_0x378671=_[_0x9ed1('0x34')]({},_0x378671,_0x4252cd[_0x9ed1('0x3b')]);return db[_0x9ed1('0x24')][_0x9ed1('0x3c')](_0x378671)[_0x9ed1('0x1b')](handleEntityNotFound(_0x4a5f64,null))[_0x9ed1('0x1b')](respondWithResult(_0x4a5f64,null))[_0x9ed1('0x3d')](handleError(_0x4a5f64,null));};exports[_0x9ed1('0x3e')]=function(_0xf1f2ae,_0x30abb9){return db[_0x9ed1('0x24')]['create'](_0xf1f2ae[_0x9ed1('0x3f')],{})[_0x9ed1('0x1b')](respondWithResult(_0x30abb9,0xc9))[_0x9ed1('0x3d')](handleError(_0x30abb9,null));};exports[_0x9ed1('0x40')]=function(_0x3f31f3,_0x276909){if(_0x3f31f3[_0x9ed1('0x3f')]['id']){delete _0x3f31f3[_0x9ed1('0x3f')]['id'];}return db[_0x9ed1('0x24')][_0x9ed1('0x3c')]({'where':{'id':_0x3f31f3[_0x9ed1('0x39')]['id']}})['then'](handleEntityNotFound(_0x276909,null))[_0x9ed1('0x1b')](saveUpdates(_0x3f31f3[_0x9ed1('0x3f')],null))[_0x9ed1('0x1b')](respondWithResult(_0x276909,null))['catch'](handleError(_0x276909,null));};exports['destroy']=function(_0x30031f,_0x27750d){return db[_0x9ed1('0x24')][_0x9ed1('0x3c')]({'where':{'id':_0x30031f[_0x9ed1('0x39')]['id']}})[_0x9ed1('0x1b')](handleEntityNotFound(_0x27750d,null))['then'](removeEntity(_0x27750d,null))[_0x9ed1('0x3d')](handleError(_0x27750d,null));};exports['getFields']=function(_0x3e4666,_0x507947,_0x382277){var _0x4b2b77={};var _0x348791={};var _0x3e4064;var _0x10278c;return db[_0x9ed1('0x24')][_0x9ed1('0x41')]({'where':{'id':_0x3e4666[_0x9ed1('0x39')]['id']}})[_0x9ed1('0x1b')](handleEntityNotFound(_0x507947,null))['then'](function(_0x95a0ca){if(_0x95a0ca){_0x3e4064=_0x95a0ca;_0x348791[_0x9ed1('0x29')]=_[_0x9ed1('0x27')](db[_0x9ed1('0x42')][_0x9ed1('0x43')]);_0x348791[_0x9ed1('0x2a')]=_['keys'](_0x3e4666[_0x9ed1('0x2a')]);_0x348791['filters']=_[_0x9ed1('0x2c')](_0x348791['model'],_0x348791['query']);_0x4b2b77['attributes']=_['intersection'](_0x348791[_0x9ed1('0x29')],qs[_0x9ed1('0x2d')](_0x3e4666[_0x9ed1('0x2a')][_0x9ed1('0x2d')]));_0x4b2b77['attributes']=_0x4b2b77[_0x9ed1('0x2b')]['length']?_0x4b2b77[_0x9ed1('0x2b')]:_0x348791[_0x9ed1('0x29')];_0x4b2b77['order']=qs[_0x9ed1('0x31')](_0x3e4666[_0x9ed1('0x2a')][_0x9ed1('0x31')]);_0x4b2b77['where']=qs[_0x9ed1('0x28')](_[_0x9ed1('0x44')](_0x3e4666['query'],_0x348791[_0x9ed1('0x28')]));if(_0x3e4666[_0x9ed1('0x2a')][_0x9ed1('0x33')]){_0x4b2b77[_0x9ed1('0x32')]=_[_0x9ed1('0x34')](_0x4b2b77['where'],{'$or':_[_0x9ed1('0x23')](_0x4b2b77[_0x9ed1('0x2b')],function(_0x43e164){var _0x1f8df7={};_0x1f8df7[_0x43e164]={'$like':'%'+_0x3e4666[_0x9ed1('0x2a')][_0x9ed1('0x33')]+'%'};return _0x1f8df7;})});}_0x4b2b77=_[_0x9ed1('0x34')]({},_0x4b2b77,_0x3e4666['options']);return _0x3e4064[_0x9ed1('0x45')](_0x4b2b77);}})['then'](function(_0x221b2f){if(_0x221b2f){_0x10278c=_0x221b2f[_0x9ed1('0x2e')];if(!_0x3e4666[_0x9ed1('0x2a')][_0x9ed1('0x46')](_0x9ed1('0x2f'))){_0x4b2b77[_0x9ed1('0x16')]=qs[_0x9ed1('0x16')](_0x3e4666[_0x9ed1('0x2a')][_0x9ed1('0x16')]);_0x4b2b77[_0x9ed1('0x14')]=qs[_0x9ed1('0x14')](_0x3e4666['query'][_0x9ed1('0x14')]);}return _0x3e4064[_0x9ed1('0x45')](_0x4b2b77);}})[_0x9ed1('0x1b')](function(_0x47a6dc){if(_0x47a6dc){return _0x47a6dc?{'count':_0x10278c,'rows':_0x47a6dc}:null;}})['then'](respondWithResult(_0x507947,null))[_0x9ed1('0x3d')](handleError(_0x507947,null));};exports[_0x9ed1('0x47')]=function(_0x565986,_0x531dc3,_0x1dea35){var _0x5aa556={};var _0x3052f9={};var _0x3d5ef3;var _0x99236c;return db[_0x9ed1('0x24')][_0x9ed1('0x41')]({'where':{'id':_0x565986[_0x9ed1('0x39')]['id']}})['then'](handleEntityNotFound(_0x531dc3,null))[_0x9ed1('0x1b')](function(_0x4b8c7f){if(_0x4b8c7f){_0x3d5ef3=_0x4b8c7f;_0x3052f9[_0x9ed1('0x29')]=_[_0x9ed1('0x27')](db[_0x9ed1('0x42')][_0x9ed1('0x43')]);_0x3052f9[_0x9ed1('0x2a')]=_[_0x9ed1('0x27')](_0x565986['query']);_0x3052f9[_0x9ed1('0x28')]=_[_0x9ed1('0x2c')](_0x3052f9[_0x9ed1('0x29')],_0x3052f9[_0x9ed1('0x2a')]);_0x5aa556[_0x9ed1('0x2b')]=_[_0x9ed1('0x2c')](_0x3052f9['model'],qs[_0x9ed1('0x2d')](_0x565986['query'][_0x9ed1('0x2d')]));_0x5aa556[_0x9ed1('0x2b')]=_0x5aa556[_0x9ed1('0x2b')][_0x9ed1('0x2e')]?_0x5aa556['attributes']:_0x3052f9[_0x9ed1('0x29')];_0x5aa556[_0x9ed1('0x30')]=qs['sort'](_0x565986['query']['sort']);_0x5aa556[_0x9ed1('0x32')]=qs[_0x9ed1('0x28')](_[_0x9ed1('0x44')](_0x565986[_0x9ed1('0x2a')],_0x3052f9[_0x9ed1('0x28')]));if(_0x565986[_0x9ed1('0x2a')][_0x9ed1('0x33')]){_0x5aa556['where']=_[_0x9ed1('0x34')](_0x5aa556[_0x9ed1('0x32')],{'$or':_['map'](_0x5aa556[_0x9ed1('0x2b')],function(_0x3338a5){var _0x5e81ce={};_0x5e81ce[_0x3338a5]={'$like':'%'+_0x565986[_0x9ed1('0x2a')][_0x9ed1('0x33')]+'%'};return _0x5e81ce;})});}_0x5aa556=_['merge']({},_0x5aa556,_0x565986[_0x9ed1('0x3b')]);return _0x3d5ef3['getSubjects'](_0x5aa556);}})[_0x9ed1('0x1b')](function(_0x2d6abc){if(_0x2d6abc){_0x99236c=_0x2d6abc['length'];if(!_0x565986['query']['hasOwnProperty'](_0x9ed1('0x2f'))){_0x5aa556[_0x9ed1('0x16')]=qs['limit'](_0x565986['query'][_0x9ed1('0x16')]);_0x5aa556[_0x9ed1('0x14')]=qs[_0x9ed1('0x14')](_0x565986[_0x9ed1('0x2a')][_0x9ed1('0x14')]);}return _0x3d5ef3['getSubjects'](_0x5aa556);}})[_0x9ed1('0x1b')](function(_0xcf19b5){if(_0xcf19b5){return _0xcf19b5?{'count':_0x99236c,'rows':_0xcf19b5}:null;}})[_0x9ed1('0x1b')](respondWithResult(_0x531dc3,null))[_0x9ed1('0x3d')](handleError(_0x531dc3,null));};exports['getDescriptions']=function(_0x1a3520,_0x18604c,_0x30f7c5){var _0x8442c9={};var _0x348486={};var _0x22cb01;var _0x154b2b;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1a3520[_0x9ed1('0x39')]['id']}})['then'](handleEntityNotFound(_0x18604c,null))[_0x9ed1('0x1b')](function(_0x39e7f0){if(_0x39e7f0){_0x22cb01=_0x39e7f0;_0x348486[_0x9ed1('0x29')]=_['keys'](db[_0x9ed1('0x42')][_0x9ed1('0x43')]);_0x348486['query']=_['keys'](_0x1a3520[_0x9ed1('0x2a')]);_0x348486[_0x9ed1('0x28')]=_['intersection'](_0x348486[_0x9ed1('0x29')],_0x348486['query']);_0x8442c9[_0x9ed1('0x2b')]=_[_0x9ed1('0x2c')](_0x348486[_0x9ed1('0x29')],qs[_0x9ed1('0x2d')](_0x1a3520[_0x9ed1('0x2a')]['fields']));_0x8442c9[_0x9ed1('0x2b')]=_0x8442c9[_0x9ed1('0x2b')]['length']?_0x8442c9[_0x9ed1('0x2b')]:_0x348486[_0x9ed1('0x29')];_0x8442c9[_0x9ed1('0x30')]=qs[_0x9ed1('0x31')](_0x1a3520[_0x9ed1('0x2a')][_0x9ed1('0x31')]);_0x8442c9[_0x9ed1('0x32')]=qs[_0x9ed1('0x28')](_['pick'](_0x1a3520[_0x9ed1('0x2a')],_0x348486[_0x9ed1('0x28')]));if(_0x1a3520[_0x9ed1('0x2a')][_0x9ed1('0x33')]){_0x8442c9[_0x9ed1('0x32')]=_[_0x9ed1('0x34')](_0x8442c9[_0x9ed1('0x32')],{'$or':_[_0x9ed1('0x23')](_0x8442c9[_0x9ed1('0x2b')],function(_0x2fa5df){var _0x1f984c={};_0x1f984c[_0x2fa5df]={'$like':'%'+_0x1a3520[_0x9ed1('0x2a')][_0x9ed1('0x33')]+'%'};return _0x1f984c;})});}_0x8442c9=_[_0x9ed1('0x34')]({},_0x8442c9,_0x1a3520['options']);return _0x22cb01[_0x9ed1('0x48')](_0x8442c9);}})[_0x9ed1('0x1b')](function(_0x4802e8){if(_0x4802e8){_0x154b2b=_0x4802e8[_0x9ed1('0x2e')];if(!_0x1a3520[_0x9ed1('0x2a')]['hasOwnProperty'](_0x9ed1('0x2f'))){_0x8442c9[_0x9ed1('0x16')]=qs[_0x9ed1('0x16')](_0x1a3520['query'][_0x9ed1('0x16')]);_0x8442c9[_0x9ed1('0x14')]=qs[_0x9ed1('0x14')](_0x1a3520[_0x9ed1('0x2a')]['offset']);}return _0x22cb01['getDescriptions'](_0x8442c9);}})[_0x9ed1('0x1b')](function(_0x1b2f28){if(_0x1b2f28){return _0x1b2f28?{'count':_0x154b2b,'rows':_0x1b2f28}:null;}})[_0x9ed1('0x1b')](respondWithResult(_0x18604c,null))[_0x9ed1('0x3d')](handleError(_0x18604c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 706d960..3e33234 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 _0x7c59=['moment','request-promise','path','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','api'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7c59,0x147));var _0x97c5=function(_0x4d7155,_0xa0c16d){_0x4d7155=_0x4d7155-0x0;var _0x337ad7=_0x7c59[_0x4d7155];return _0x337ad7;};'use strict';var _=require('lodash');var util=require(_0x97c5('0x0'));var logger=require(_0x97c5('0x1'))(_0x97c5('0x2'));var moment=require(_0x97c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x97c5('0x4'));var fs=require('fs');var path=require(_0x97c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97c5('0x6'));module[_0x97c5('0x7')]=function(_0x29832f,_0xb7c5e1){return _0x29832f[_0x97c5('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x97c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dd3=['rimraf','../../config/environment','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','bluebird','path'];(function(_0x40efb5,_0xb02aad){var _0x1efa21=function(_0x4101e7){while(--_0x4101e7){_0x40efb5['push'](_0x40efb5['shift']());}};_0x1efa21(++_0xb02aad);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x4dd3[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34dd('0x4'));var rimraf=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x34dd('0x7')]=function(_0x704165,_0x37ce1d){return _0x704165[_0x34dd('0x8')](_0x34dd('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 4faae9e..4516a26 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 _0x0ff2=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x0ff2,0xe4));var _0x20ff=function(_0xda8b33,_0x7096f3){_0xda8b33=_0xda8b33-0x0;var _0x41c45f=_0x0ff2[_0xda8b33];return _0x41c45f;};'use strict';var _=require(_0x20ff('0x0'));var util=require(_0x20ff('0x1'));var moment=require(_0x20ff('0x2'));var BPromise=require(_0x20ff('0x3'));var rs=require(_0x20ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20ff('0x6'))('rpc');var config=require(_0x20ff('0x7'));var jayson=require(_0x20ff('0x8'));var client=jayson['client'][_0x20ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21e140,_0x58b14c,_0x356b8e){return new BPromise(function(_0x3fb447,_0x439d6d){return client[_0x20ff('0xa')](_0x21e140,_0x356b8e)[_0x20ff('0xb')](function(_0x406504){logger[_0x20ff('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58b14c,_0x20ff('0xd'));logger[_0x20ff('0xe')](_0x20ff('0xf'),_0x58b14c,_0x20ff('0xd'),JSON[_0x20ff('0x10')](_0x406504));if(_0x406504[_0x20ff('0x11')]){if(_0x406504[_0x20ff('0x11')][_0x20ff('0x12')]===0x1f4){logger['error'](_0x20ff('0x13'),_0x58b14c,_0x406504[_0x20ff('0x11')][_0x20ff('0x14')]);return _0x439d6d(_0x406504[_0x20ff('0x11')][_0x20ff('0x14')]);}logger['error'](_0x20ff('0x13'),_0x58b14c,_0x406504[_0x20ff('0x11')]['message']);return _0x3fb447(_0x406504['error'][_0x20ff('0x14')]);}else{logger[_0x20ff('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58b14c,'request\x20sent');_0x3fb447(_0x406504[_0x20ff('0x15')][_0x20ff('0x14')]);}})['catch'](function(_0x29963b){logger['error'](_0x20ff('0x13'),_0x58b14c,_0x29963b);_0x439d6d(_0x29963b);});});} \ No newline at end of file +var _0x3e1f=['../../config/utils','rpc','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x57641b,_0x52aeb2){var _0x16497f=function(_0x5ee945){while(--_0x5ee945){_0x57641b['push'](_0x57641b['shift']());}};_0x16497f(++_0x52aeb2);}(_0x3e1f,0x127));var _0xf3e1=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x3e1f[_0x43e4b3];return _0x10c655;};'use strict';var _=require(_0xf3e1('0x0'));var util=require(_0xf3e1('0x1'));var moment=require(_0xf3e1('0x2'));var BPromise=require(_0xf3e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3e1('0x4'))['db'];var utils=require(_0xf3e1('0x5'));var logger=require('../../config/logger')(_0xf3e1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf3e1('0x7')][_0xf3e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x384b3e,_0x1d1a41,_0x5e0b42){return new BPromise(function(_0x4c95b7,_0x3662d1){return client[_0xf3e1('0x9')](_0x384b3e,_0x5e0b42)[_0xf3e1('0xa')](function(_0xaeea4c){logger['info'](_0xf3e1('0xb'),_0x1d1a41,_0xf3e1('0xc'));logger[_0xf3e1('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1d1a41,_0xf3e1('0xc'),JSON['stringify'](_0xaeea4c));if(_0xaeea4c[_0xf3e1('0xe')]){if(_0xaeea4c['error'][_0xf3e1('0xf')]===0x1f4){logger[_0xf3e1('0xe')](_0xf3e1('0xb'),_0x1d1a41,_0xaeea4c['error'][_0xf3e1('0x10')]);return _0x3662d1(_0xaeea4c[_0xf3e1('0xe')]['message']);}logger[_0xf3e1('0xe')](_0xf3e1('0xb'),_0x1d1a41,_0xaeea4c[_0xf3e1('0xe')]['message']);return _0x4c95b7(_0xaeea4c[_0xf3e1('0xe')]['message']);}else{logger[_0xf3e1('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1d1a41,_0xf3e1('0xc'));_0x4c95b7(_0xaeea4c[_0xf3e1('0x12')][_0xf3e1('0x10')]);}})[_0xf3e1('0x13')](function(_0x6da250){logger[_0xf3e1('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1d1a41,_0x6da250);_0x3662d1(_0x6da250);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3edbf2f..20e2399 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 _0x2991=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0xcc8102,_0xac3fde){var _0x36e0b6=function(_0xab5749){while(--_0xab5749){_0xcc8102['push'](_0xcc8102['shift']());}};_0x36e0b6(++_0xac3fde);}(_0x2991,0x1a5));var _0x1299=function(_0x2b38bc,_0x5ef8b4){_0x2b38bc=_0x2b38bc-0x0;var _0x25bf3a=_0x2991[_0x2b38bc];return _0x25bf3a;};'use strict';var multer=require(_0x1299('0x0'));var util=require('util');var path=require(_0x1299('0x1'));var timeout=require(_0x1299('0x2'));var express=require(_0x1299('0x3'));var router=express[_0x1299('0x4')]();var fs_extra=require(_0x1299('0x5'));var auth=require(_0x1299('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1299('0x7'));var controller=require(_0x1299('0x8'));router[_0x1299('0x9')]('/',auth['isAuthenticated'](),controller[_0x1299('0xa')]);router[_0x1299('0x9')](_0x1299('0xb'),auth[_0x1299('0xc')](),controller[_0x1299('0xd')]);router[_0x1299('0xe')]('/',auth[_0x1299('0xc')](),controller[_0x1299('0xf')]);router[_0x1299('0x10')](_0x1299('0xb'),auth[_0x1299('0xc')](),controller[_0x1299('0x11')]);router[_0x1299('0x12')](_0x1299('0xb'),auth[_0x1299('0xc')](),controller[_0x1299('0x13')]);module[_0x1299('0x14')]=router; \ No newline at end of file +var _0x0cb7=['Router','fs-extra','../../components/auth/service','./intServicenowField.controller','get','isAuthenticated','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3768ec,_0xcb51b7){var _0x5cf7d6=function(_0x7cb2b4){while(--_0x7cb2b4){_0x3768ec['push'](_0x3768ec['shift']());}};_0x5cf7d6(++_0xcb51b7);}(_0x0cb7,0x109));var _0x70cb=function(_0xf3d379,_0x6ce552){_0xf3d379=_0xf3d379-0x0;var _0x4107a1=_0x0cb7[_0xf3d379];return _0x4107a1;};'use strict';var multer=require(_0x70cb('0x0'));var util=require(_0x70cb('0x1'));var path=require(_0x70cb('0x2'));var timeout=require(_0x70cb('0x3'));var express=require(_0x70cb('0x4'));var router=express[_0x70cb('0x5')]();var fs_extra=require(_0x70cb('0x6'));var auth=require(_0x70cb('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x70cb('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x70cb('0x9')]('/:id',auth[_0x70cb('0xa')](),controller[_0x70cb('0xb')]);router['post']('/',auth[_0x70cb('0xa')](),controller[_0x70cb('0xc')]);router['put'](_0x70cb('0xd'),auth['isAuthenticated'](),controller[_0x70cb('0xe')]);router[_0x70cb('0xf')](_0x70cb('0xd'),auth[_0x70cb('0xa')](),controller[_0x70cb('0x10')]);module[_0x70cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e1ab2b9..6a8db25 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 _0xda35=['keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable'];(function(_0x5be7c6,_0x169bf0){var _0x196125=function(_0x1f75a0){while(--_0x1f75a0){_0x5be7c6['push'](_0x5be7c6['shift']());}};_0x196125(++_0x169bf0);}(_0xda35,0x17f));var _0x5da3=function(_0x332bb4,_0x24246d){_0x332bb4=_0x332bb4-0x0;var _0x136f0b=_0xda35[_0x332bb4];return _0x136f0b;};'use strict';var Sequelize=require(_0x5da3('0x0'));module[_0x5da3('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5da3('0x2'),'variable',_0x5da3('0x3'),_0x5da3('0x4'),'picklist'),'defaultValue':_0x5da3('0x2')},'content':{'type':Sequelize[_0x5da3('0x5')]},'key':{'type':Sequelize[_0x5da3('0x5')]},'keyType':{'type':Sequelize[_0x5da3('0x6')](_0x5da3('0x2'),_0x5da3('0x7'),_0x5da3('0x3'))},'keyContent':{'type':Sequelize[_0x5da3('0x5')]},'idField':{'type':Sequelize[_0x5da3('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5da3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5da3('0x5')]}}; \ No newline at end of file +var _0xdf2d=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0xdf2d,0x1db));var _0xddf2=function(_0x4910cc,_0x4d2b2c){_0x4910cc=_0x4910cc-0x0;var _0xdcffb8=_0xdf2d[_0x4910cc];return _0xdcffb8;};'use strict';var Sequelize=require(_0xddf2('0x0'));module['exports']={'type':{'type':Sequelize[_0xddf2('0x1')](_0xddf2('0x2'),_0xddf2('0x3'),'customVariable',_0xddf2('0x4'),'picklist'),'defaultValue':_0xddf2('0x2')},'content':{'type':Sequelize[_0xddf2('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xddf2('0x1')]('string',_0xddf2('0x3'),_0xddf2('0x6'))},'keyContent':{'type':Sequelize[_0xddf2('0x5')]},'idField':{'type':Sequelize[_0xddf2('0x5')]},'nameField':{'type':Sequelize[_0xddf2('0x5')]},'customField':{'type':Sequelize[_0xddf2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddf2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d3682a4..e34ab47 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 _0x82bd=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf'];(function(_0x1dce00,_0x226d78){var _0x5181c9=function(_0x3bfd19){while(--_0x3bfd19){_0x1dce00['push'](_0x1dce00['shift']());}};_0x5181c9(++_0x226d78);}(_0x82bd,0x1ba));var _0xd82b=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x82bd[_0x160248];return _0x4e589d;};'use strict';var emlformat=require(_0xd82b('0x0'));var rimraf=require(_0xd82b('0x1'));var zipdir=require(_0xd82b('0x2'));var jsonpatch=require(_0xd82b('0x3'));var rp=require(_0xd82b('0x4'));var moment=require(_0xd82b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd82b('0x6'));var util=require(_0xd82b('0x7'));var path=require(_0xd82b('0x8'));var sox=require(_0xd82b('0x9'));var csv=require('to-csv');var ejs=require(_0xd82b('0xa'));var fs=require('fs');var fs_extra=require(_0xd82b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd82b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd82b('0xd'));var querystring=require(_0xd82b('0xe'));var Papa=require('papaparse');var Redis=require(_0xd82b('0xf'));var authService=require(_0xd82b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd82b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd82b('0x12'))(_0xd82b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd82b('0x14'));var db=require(_0xd82b('0x15'))['db'];function respondWithStatusCode(_0x458f17,_0x59bde6){_0x59bde6=_0x59bde6||0xcc;return function(_0x3f9fc9){if(_0x3f9fc9){return _0x458f17[_0xd82b('0x16')](_0x59bde6);}return _0x458f17[_0xd82b('0x17')](_0x59bde6)[_0xd82b('0x18')]();};}function respondWithResult(_0x342fce,_0xb03138){_0xb03138=_0xb03138||0xc8;return function(_0x56fd1a){if(_0x56fd1a){return _0x342fce[_0xd82b('0x17')](_0xb03138)[_0xd82b('0x19')](_0x56fd1a);}};}function respondWithFilteredResult(_0x28e8c0,_0xc4851){return function(_0x346ea8){if(_0x346ea8){var _0x13a8b0=typeof _0xc4851[_0xd82b('0x1a')]==='undefined'&&typeof _0xc4851[_0xd82b('0x1b')]===_0xd82b('0x1c');var _0x246c42=_0x346ea8['count'];var _0x3fe0ff=_0x13a8b0?0x0:_0xc4851[_0xd82b('0x1a')];var _0x144d5c=_0x13a8b0?_0x346ea8[_0xd82b('0x1d')]:_0xc4851[_0xd82b('0x1a')]+_0xc4851[_0xd82b('0x1b')];var _0x38d764;if(_0x144d5c>=_0x246c42){_0x144d5c=_0x246c42;_0x38d764=0xc8;}else{_0x38d764=0xce;}_0x28e8c0[_0xd82b('0x17')](_0x38d764);return _0x28e8c0[_0xd82b('0x1e')](_0xd82b('0x1f'),_0x3fe0ff+'-'+_0x144d5c+'/'+_0x246c42)[_0xd82b('0x19')](_0x346ea8);}return null;};}function patchUpdates(_0x2ecfae){return function(_0x58b5a3){try{jsonpatch[_0xd82b('0x20')](_0x58b5a3,_0x2ecfae,!![]);}catch(_0x308f18){return BPromise[_0xd82b('0x21')](_0x308f18);}return _0x58b5a3['save']();};}function saveUpdates(_0x3d6db7,_0x2252f4){return function(_0x35f407){if(_0x35f407){return _0x35f407[_0xd82b('0x22')](_0x3d6db7)[_0xd82b('0x23')](function(_0x54b035){return _0x54b035;});}return null;};}function removeEntity(_0xb5e845,_0x1526ff){return function(_0x444fe0){if(_0x444fe0){return _0x444fe0[_0xd82b('0x24')]()[_0xd82b('0x23')](function(){_0xb5e845[_0xd82b('0x17')](0xcc)[_0xd82b('0x18')]();});}};}function handleEntityNotFound(_0x3fdbdf,_0x38ccfe){return function(_0x3ee7ad){if(!_0x3ee7ad){_0x3fdbdf[_0xd82b('0x16')](0x194);}return _0x3ee7ad;};}function handleError(_0xb51d1b,_0x448071){_0x448071=_0x448071||0x1f4;return function(_0x53de9e){logger[_0xd82b('0x25')](_0x53de9e['stack']);if(_0x53de9e[_0xd82b('0x26')]){delete _0x53de9e['name'];}_0xb51d1b[_0xd82b('0x17')](_0x448071)[_0xd82b('0x27')](_0x53de9e);};}exports[_0xd82b('0x28')]=function(_0x4ea150,_0x1a556a){var _0x276464={},_0x291394={},_0x15df5b={'count':0x0,'rows':[]};var _0x1fa6a0=_[_0xd82b('0x29')](db[_0xd82b('0x2a')][_0xd82b('0x2b')],function(_0x35d2a9){return{'name':_0x35d2a9['fieldName'],'type':_0x35d2a9['type'][_0xd82b('0x2c')]};});_0x291394[_0xd82b('0x2d')]=_[_0xd82b('0x29')](_0x1fa6a0,_0xd82b('0x26'));_0x291394[_0xd82b('0x2e')]=_[_0xd82b('0x2f')](_0x4ea150[_0xd82b('0x2e')]);_0x291394['filters']=_[_0xd82b('0x30')](_0x291394[_0xd82b('0x2d')],_0x291394[_0xd82b('0x2e')]);_0x276464['attributes']=_[_0xd82b('0x30')](_0x291394['model'],qs['fields'](_0x4ea150['query'][_0xd82b('0x31')]));_0x276464['attributes']=_0x276464[_0xd82b('0x32')][_0xd82b('0x33')]?_0x276464['attributes']:_0x291394[_0xd82b('0x2d')];if(!_0x4ea150[_0xd82b('0x2e')][_0xd82b('0x34')](_0xd82b('0x35'))){_0x276464['limit']=qs[_0xd82b('0x1b')](_0x4ea150[_0xd82b('0x2e')][_0xd82b('0x1b')]);_0x276464[_0xd82b('0x1a')]=qs[_0xd82b('0x1a')](_0x4ea150['query']['offset']);}_0x276464[_0xd82b('0x36')]=qs[_0xd82b('0x37')](_0x4ea150[_0xd82b('0x2e')][_0xd82b('0x37')]);_0x276464[_0xd82b('0x38')]=qs['filters'](_[_0xd82b('0x39')](_0x4ea150['query'],_0x291394[_0xd82b('0x3a')]),_0x1fa6a0);if(_0x4ea150[_0xd82b('0x2e')][_0xd82b('0x3b')]){_0x276464['where']=_['merge'](_0x276464['where'],{'$or':_[_0xd82b('0x29')](_0x1fa6a0,function(_0x2d3f76){if(_0x2d3f76[_0xd82b('0x3c')]!==_0xd82b('0x3d')){var _0x1d5758={};_0x1d5758[_0x2d3f76[_0xd82b('0x26')]]={'$like':'%'+_0x4ea150[_0xd82b('0x2e')][_0xd82b('0x3b')]+'%'};return _0x1d5758;}})});}_0x276464=_[_0xd82b('0x3e')]({},_0x276464,_0x4ea150[_0xd82b('0x3f')]);var _0x52b830={'where':_0x276464['where']};return db[_0xd82b('0x2a')]['count'](_0x52b830)[_0xd82b('0x23')](function(_0x3c43c1){_0x15df5b[_0xd82b('0x1d')]=_0x3c43c1;if(_0x4ea150[_0xd82b('0x2e')][_0xd82b('0x40')]){_0x276464[_0xd82b('0x41')]=[{'all':!![]}];}return db[_0xd82b('0x2a')][_0xd82b('0x42')](_0x276464);})['then'](function(_0xa4700){_0x15df5b[_0xd82b('0x43')]=_0xa4700;return _0x15df5b;})[_0xd82b('0x23')](respondWithFilteredResult(_0x1a556a,_0x276464))[_0xd82b('0x44')](handleError(_0x1a556a,null));};exports[_0xd82b('0x45')]=function(_0x247f85,_0x49bc08){var _0x5eef11={'raw':!![],'where':{'id':_0x247f85[_0xd82b('0x46')]['id']}},_0x146428={};_0x146428[_0xd82b('0x2d')]=_[_0xd82b('0x2f')](db['ServicenowField'][_0xd82b('0x2b')]);_0x146428[_0xd82b('0x2e')]=_[_0xd82b('0x2f')](_0x247f85[_0xd82b('0x2e')]);_0x146428[_0xd82b('0x3a')]=_['intersection'](_0x146428['model'],_0x146428[_0xd82b('0x2e')]);_0x5eef11[_0xd82b('0x32')]=_[_0xd82b('0x30')](_0x146428[_0xd82b('0x2d')],qs['fields'](_0x247f85[_0xd82b('0x2e')]['fields']));_0x5eef11['attributes']=_0x5eef11['attributes'][_0xd82b('0x33')]?_0x5eef11[_0xd82b('0x32')]:_0x146428['model'];if(_0x247f85[_0xd82b('0x2e')][_0xd82b('0x40')]){_0x5eef11[_0xd82b('0x41')]=[{'all':!![]}];}_0x5eef11=_[_0xd82b('0x3e')]({},_0x5eef11,_0x247f85[_0xd82b('0x3f')]);return db[_0xd82b('0x2a')]['find'](_0x5eef11)[_0xd82b('0x23')](handleEntityNotFound(_0x49bc08,null))['then'](respondWithResult(_0x49bc08,null))['catch'](handleError(_0x49bc08,null));};exports[_0xd82b('0x47')]=function(_0x50c030,_0x8a3552){return db[_0xd82b('0x2a')][_0xd82b('0x47')](_0x50c030[_0xd82b('0x48')],{})[_0xd82b('0x23')](respondWithResult(_0x8a3552,0xc9))[_0xd82b('0x44')](handleError(_0x8a3552,null));};exports[_0xd82b('0x22')]=function(_0x194886,_0x593ea3){if(_0x194886[_0xd82b('0x48')]['id']){delete _0x194886[_0xd82b('0x48')]['id'];}return db[_0xd82b('0x2a')][_0xd82b('0x49')]({'where':{'id':_0x194886[_0xd82b('0x46')]['id']}})[_0xd82b('0x23')](handleEntityNotFound(_0x593ea3,null))[_0xd82b('0x23')](saveUpdates(_0x194886[_0xd82b('0x48')],null))[_0xd82b('0x23')](respondWithResult(_0x593ea3,null))[_0xd82b('0x44')](handleError(_0x593ea3,null));};exports[_0xd82b('0x24')]=function(_0x1ac7e2,_0x55a16a){return db[_0xd82b('0x2a')][_0xd82b('0x49')]({'where':{'id':_0x1ac7e2[_0xd82b('0x46')]['id']}})['then'](handleEntityNotFound(_0x55a16a,null))[_0xd82b('0x23')](removeEntity(_0x55a16a,null))['catch'](handleError(_0x55a16a,null));}; \ No newline at end of file +var _0x1c87=['send','index','map','rawAttributes','fieldName','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ServicenowField','includeAll','include','findAll','catch','show','create','body','update','find','params','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','stack','name'];(function(_0x4c9e58,_0x469fea){var _0x413b0a=function(_0x5270d6){while(--_0x5270d6){_0x4c9e58['push'](_0x4c9e58['shift']());}};_0x413b0a(++_0x469fea);}(_0x1c87,0x70));var _0x71c8=function(_0xa2f006,_0x11c4aa){_0xa2f006=_0xa2f006-0x0;var _0x280e02=_0x1c87[_0xa2f006];return _0x280e02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x71c8('0x0'));var zipdir=require(_0x71c8('0x1'));var jsonpatch=require(_0x71c8('0x2'));var rp=require(_0x71c8('0x3'));var moment=require(_0x71c8('0x4'));var BPromise=require(_0x71c8('0x5'));var Mustache=require(_0x71c8('0x6'));var util=require(_0x71c8('0x7'));var path=require(_0x71c8('0x8'));var sox=require(_0x71c8('0x9'));var csv=require(_0x71c8('0xa'));var ejs=require(_0x71c8('0xb'));var fs=require('fs');var fs_extra=require(_0x71c8('0xc'));var _=require(_0x71c8('0xd'));var squel=require(_0x71c8('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71c8('0xf'));var toCsv=require(_0x71c8('0xa'));var querystring=require(_0x71c8('0x10'));var Papa=require(_0x71c8('0x11'));var Redis=require(_0x71c8('0x12'));var authService=require(_0x71c8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x71c8('0x14'));var hardwareService=require(_0x71c8('0x15'));var logger=require(_0x71c8('0x16'))(_0x71c8('0x17'));var utils=require('../../config/utils');var config=require(_0x71c8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x71c8('0x19'))['db'];function respondWithStatusCode(_0x2135dc,_0xe61b9c){_0xe61b9c=_0xe61b9c||0xcc;return function(_0x59548a){if(_0x59548a){return _0x2135dc[_0x71c8('0x1a')](_0xe61b9c);}return _0x2135dc['status'](_0xe61b9c)[_0x71c8('0x1b')]();};}function respondWithResult(_0x4f5697,_0x34eb95){_0x34eb95=_0x34eb95||0xc8;return function(_0xafaee2){if(_0xafaee2){return _0x4f5697[_0x71c8('0x1c')](_0x34eb95)[_0x71c8('0x1d')](_0xafaee2);}};}function respondWithFilteredResult(_0x140b98,_0x4e35f7){return function(_0x38cc0d){if(_0x38cc0d){var _0x343013=typeof _0x4e35f7[_0x71c8('0x1e')]===_0x71c8('0x1f')&&typeof _0x4e35f7[_0x71c8('0x20')]===_0x71c8('0x1f');var _0x4be767=_0x38cc0d[_0x71c8('0x21')];var _0x55eb45=_0x343013?0x0:_0x4e35f7['offset'];var _0x46113e=_0x343013?_0x38cc0d[_0x71c8('0x21')]:_0x4e35f7['offset']+_0x4e35f7['limit'];var _0xec064a;if(_0x46113e>=_0x4be767){_0x46113e=_0x4be767;_0xec064a=0xc8;}else{_0xec064a=0xce;}_0x140b98[_0x71c8('0x1c')](_0xec064a);return _0x140b98[_0x71c8('0x22')](_0x71c8('0x23'),_0x55eb45+'-'+_0x46113e+'/'+_0x4be767)[_0x71c8('0x1d')](_0x38cc0d);}return null;};}function patchUpdates(_0x3e8ac3){return function(_0x2ca474){try{jsonpatch[_0x71c8('0x24')](_0x2ca474,_0x3e8ac3,!![]);}catch(_0x3686e7){return BPromise[_0x71c8('0x25')](_0x3686e7);}return _0x2ca474['save']();};}function saveUpdates(_0x2bf4eb,_0x1f31e1){return function(_0x87d1e3){if(_0x87d1e3){return _0x87d1e3['update'](_0x2bf4eb)['then'](function(_0x11b24b){return _0x11b24b;});}return null;};}function removeEntity(_0x1f2922,_0xfc983a){return function(_0x334658){if(_0x334658){return _0x334658[_0x71c8('0x26')]()[_0x71c8('0x27')](function(){_0x1f2922['status'](0xcc)[_0x71c8('0x1b')]();});}};}function handleEntityNotFound(_0x447a73,_0x11b641){return function(_0x328c30){if(!_0x328c30){_0x447a73[_0x71c8('0x1a')](0x194);}return _0x328c30;};}function handleError(_0xd391a5,_0x567f27){_0x567f27=_0x567f27||0x1f4;return function(_0x19261f){logger['error'](_0x19261f[_0x71c8('0x28')]);if(_0x19261f['name']){delete _0x19261f[_0x71c8('0x29')];}_0xd391a5[_0x71c8('0x1c')](_0x567f27)[_0x71c8('0x2a')](_0x19261f);};}exports[_0x71c8('0x2b')]=function(_0x626355,_0x105be8){var _0x1fb4c3={},_0x51bc7e={},_0x1b7437={'count':0x0,'rows':[]};var _0x19a0ca=_[_0x71c8('0x2c')](db['ServicenowField'][_0x71c8('0x2d')],function(_0xe856fd){return{'name':_0xe856fd[_0x71c8('0x2e')],'type':_0xe856fd['type']['key']};});_0x51bc7e[_0x71c8('0x2f')]=_[_0x71c8('0x2c')](_0x19a0ca,'name');_0x51bc7e['query']=_[_0x71c8('0x30')](_0x626355['query']);_0x51bc7e['filters']=_['intersection'](_0x51bc7e['model'],_0x51bc7e[_0x71c8('0x31')]);_0x1fb4c3['attributes']=_[_0x71c8('0x32')](_0x51bc7e['model'],qs[_0x71c8('0x33')](_0x626355[_0x71c8('0x31')]['fields']));_0x1fb4c3['attributes']=_0x1fb4c3['attributes'][_0x71c8('0x34')]?_0x1fb4c3[_0x71c8('0x35')]:_0x51bc7e['model'];if(!_0x626355[_0x71c8('0x31')][_0x71c8('0x36')](_0x71c8('0x37'))){_0x1fb4c3[_0x71c8('0x20')]=qs[_0x71c8('0x20')](_0x626355[_0x71c8('0x31')][_0x71c8('0x20')]);_0x1fb4c3[_0x71c8('0x1e')]=qs['offset'](_0x626355[_0x71c8('0x31')]['offset']);}_0x1fb4c3[_0x71c8('0x38')]=qs[_0x71c8('0x39')](_0x626355[_0x71c8('0x31')]['sort']);_0x1fb4c3[_0x71c8('0x3a')]=qs[_0x71c8('0x3b')](_[_0x71c8('0x3c')](_0x626355[_0x71c8('0x31')],_0x51bc7e['filters']),_0x19a0ca);if(_0x626355[_0x71c8('0x31')][_0x71c8('0x3d')]){_0x1fb4c3[_0x71c8('0x3a')]=_[_0x71c8('0x3e')](_0x1fb4c3[_0x71c8('0x3a')],{'$or':_[_0x71c8('0x2c')](_0x19a0ca,function(_0x5e81d1){if(_0x5e81d1[_0x71c8('0x3f')]!==_0x71c8('0x40')){var _0x19ff26={};_0x19ff26[_0x5e81d1[_0x71c8('0x29')]]={'$like':'%'+_0x626355[_0x71c8('0x31')][_0x71c8('0x3d')]+'%'};return _0x19ff26;}})});}_0x1fb4c3=_[_0x71c8('0x3e')]({},_0x1fb4c3,_0x626355[_0x71c8('0x41')]);var _0x989f4e={'where':_0x1fb4c3[_0x71c8('0x3a')]};return db[_0x71c8('0x42')][_0x71c8('0x21')](_0x989f4e)[_0x71c8('0x27')](function(_0x16c3b6){_0x1b7437[_0x71c8('0x21')]=_0x16c3b6;if(_0x626355['query'][_0x71c8('0x43')]){_0x1fb4c3[_0x71c8('0x44')]=[{'all':!![]}];}return db[_0x71c8('0x42')][_0x71c8('0x45')](_0x1fb4c3);})[_0x71c8('0x27')](function(_0x5ef4d0){_0x1b7437['rows']=_0x5ef4d0;return _0x1b7437;})[_0x71c8('0x27')](respondWithFilteredResult(_0x105be8,_0x1fb4c3))[_0x71c8('0x46')](handleError(_0x105be8,null));};exports[_0x71c8('0x47')]=function(_0x4b5c95,_0x30013f){var _0x3ab938={'raw':!![],'where':{'id':_0x4b5c95['params']['id']}},_0x46a96d={};_0x46a96d['model']=_['keys'](db[_0x71c8('0x42')]['rawAttributes']);_0x46a96d[_0x71c8('0x31')]=_[_0x71c8('0x30')](_0x4b5c95[_0x71c8('0x31')]);_0x46a96d[_0x71c8('0x3b')]=_[_0x71c8('0x32')](_0x46a96d[_0x71c8('0x2f')],_0x46a96d['query']);_0x3ab938[_0x71c8('0x35')]=_[_0x71c8('0x32')](_0x46a96d[_0x71c8('0x2f')],qs[_0x71c8('0x33')](_0x4b5c95['query'][_0x71c8('0x33')]));_0x3ab938[_0x71c8('0x35')]=_0x3ab938[_0x71c8('0x35')]['length']?_0x3ab938[_0x71c8('0x35')]:_0x46a96d[_0x71c8('0x2f')];if(_0x4b5c95[_0x71c8('0x31')][_0x71c8('0x43')]){_0x3ab938['include']=[{'all':!![]}];}_0x3ab938=_[_0x71c8('0x3e')]({},_0x3ab938,_0x4b5c95[_0x71c8('0x41')]);return db[_0x71c8('0x42')]['find'](_0x3ab938)['then'](handleEntityNotFound(_0x30013f,null))[_0x71c8('0x27')](respondWithResult(_0x30013f,null))['catch'](handleError(_0x30013f,null));};exports['create']=function(_0x46b58c,_0x142f6e){return db['ServicenowField'][_0x71c8('0x48')](_0x46b58c[_0x71c8('0x49')],{})['then'](respondWithResult(_0x142f6e,0xc9))[_0x71c8('0x46')](handleError(_0x142f6e,null));};exports[_0x71c8('0x4a')]=function(_0x5470ed,_0xed62e6){if(_0x5470ed['body']['id']){delete _0x5470ed[_0x71c8('0x49')]['id'];}return db['ServicenowField'][_0x71c8('0x4b')]({'where':{'id':_0x5470ed[_0x71c8('0x4c')]['id']}})['then'](handleEntityNotFound(_0xed62e6,null))[_0x71c8('0x27')](saveUpdates(_0x5470ed[_0x71c8('0x49')],null))[_0x71c8('0x27')](respondWithResult(_0xed62e6,null))[_0x71c8('0x46')](handleError(_0xed62e6,null));};exports[_0x71c8('0x26')]=function(_0x51b36c,_0x323da0){return db[_0x71c8('0x42')][_0x71c8('0x4b')]({'where':{'id':_0x51b36c['params']['id']}})[_0x71c8('0x27')](handleEntityNotFound(_0x323da0,null))[_0x71c8('0x27')](removeEntity(_0x323da0,null))[_0x71c8('0x46')](handleError(_0x323da0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6431879..f1aa5b6 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 _0xec45=['int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField'];(function(_0x32cdd0,_0x55f124){var _0x55c95d=function(_0x1afe69){while(--_0x1afe69){_0x32cdd0['push'](_0x32cdd0['shift']());}};_0x55c95d(++_0x55f124);}(_0xec45,0x6c));var _0x5ec4=function(_0x31ebab,_0x29027a){_0x31ebab=_0x31ebab-0x0;var _0x5e5419=_0xec45[_0x31ebab];return _0x5e5419;};'use strict';var _=require(_0x5ec4('0x0'));var util=require(_0x5ec4('0x1'));var logger=require(_0x5ec4('0x2'))(_0x5ec4('0x3'));var moment=require('moment');var BPromise=require(_0x5ec4('0x4'));var rp=require(_0x5ec4('0x5'));var fs=require('fs');var path=require(_0x5ec4('0x6'));var rimraf=require(_0x5ec4('0x7'));var config=require(_0x5ec4('0x8'));var attributes=require(_0x5ec4('0x9'));module['exports']=function(_0x5e364a,_0x150e5){return _0x5e364a[_0x5ec4('0xa')](_0x5ec4('0xb'),attributes,{'tableName':_0x5ec4('0xc'),'paranoid':![],'indexes':[{'name':_0x5ec4('0xd'),'fields':['idField',_0x5ec4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3876=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3876,0x1a1));var _0x6387=function(_0x433448,_0x24bba5){_0x433448=_0x433448-0x0;var _0x5a0f03=_0x3876[_0x433448];return _0x5a0f03;};'use strict';var _=require('lodash');var util=require(_0x6387('0x0'));var logger=require('../../config/logger')(_0x6387('0x1'));var moment=require(_0x6387('0x2'));var BPromise=require(_0x6387('0x3'));var rp=require(_0x6387('0x4'));var fs=require('fs');var path=require(_0x6387('0x5'));var rimraf=require(_0x6387('0x6'));var config=require(_0x6387('0x7'));var attributes=require(_0x6387('0x8'));module[_0x6387('0x9')]=function(_0x5a5589,_0x55f4e9){return _0x5a5589['define'](_0x6387('0xa'),attributes,{'tableName':_0x6387('0xb'),'paranoid':![],'indexes':[{'name':_0x6387('0xc'),'fields':[_0x6387('0xd'),_0x6387('0xe')],'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 15dd5fa..8f815e5 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x239a74,_0x1490e3){var _0x1b5415=function(_0x106842){while(--_0x106842){_0x239a74['push'](_0x239a74['shift']());}};_0x1b5415(++_0x1490e3);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5b8ef6,_0x5b8a32){_0x5b8ef6=_0x5b8ef6-0x0;var _0x356d5b=_0xf4eb[_0x5b8ef6];return _0x356d5b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x156e99,_0x2bf27e){var _0x18870e=function(_0x3e6c3b){while(--_0x3e6c3b){_0x156e99['push'](_0x156e99['shift']());}};_0x18870e(++_0x2bf27e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ef163fb..d0c9a94 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5bda5d,_0xae1ec9){var _0x59e9e1=function(_0x2ce445){while(--_0x2ce445){_0x5bda5d['push'](_0x5bda5d['shift']());}};_0x59e9e1(++_0xae1ec9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1233ed,_0x1e4366){var _0xffb63d=function(_0x3e4119){while(--_0x3e4119){_0x1233ed['push'](_0x1233ed['shift']());}};_0xffb63d(++_0x1e4366);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 3a4f9fd..90c3228 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(_0x59d6e2,_0x4f9114){var _0x4ba1d4=function(_0xb8cb1b){while(--_0xb8cb1b){_0x59d6e2['push'](_0x59d6e2['shift']());}};_0x4ba1d4(++_0x4f9114);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x54424e,_0x5ac5cd){var _0x3fdb60=function(_0x2fc0e9){while(--_0x2fc0e9){_0x54424e['push'](_0x54424e['shift']());}};_0x3fdb60(++_0x5ac5cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 9c79c0a..2f5816d 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 _0x3af7=['json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','filter','options','includeAll','SugarcrmAccount','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x3af7,0x14f));var _0x73af=function(_0x4c398c,_0x76bbca){_0x4c398c=_0x4c398c-0x0;var _0x45ccd2=_0x3af7[_0x4c398c];return _0x45ccd2;};'use strict';var emlformat=require(_0x73af('0x0'));var rimraf=require(_0x73af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x73af('0x2'));var moment=require('moment');var BPromise=require(_0x73af('0x3'));var Mustache=require(_0x73af('0x4'));var util=require(_0x73af('0x5'));var path=require(_0x73af('0x6'));var sox=require(_0x73af('0x7'));var csv=require(_0x73af('0x8'));var ejs=require(_0x73af('0x9'));var fs=require('fs');var fs_extra=require(_0x73af('0xa'));var _=require(_0x73af('0xb'));var squel=require(_0x73af('0xc'));var crypto=require(_0x73af('0xd'));var jsforce=require(_0x73af('0xe'));var deskjs=require(_0x73af('0xf'));var toCsv=require(_0x73af('0x8'));var querystring=require('querystring');var Papa=require(_0x73af('0x10'));var Redis=require('ioredis');var authService=require(_0x73af('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x73af('0x12'))(_0x73af('0x13'));var utils=require(_0x73af('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x73af('0x15'));function respondWithStatusCode(_0xf9ad74,_0x5d6b53){_0x5d6b53=_0x5d6b53||0xcc;return function(_0x4a420b){if(_0x4a420b){return _0xf9ad74[_0x73af('0x16')](_0x5d6b53);}return _0xf9ad74['status'](_0x5d6b53)[_0x73af('0x17')]();};}function respondWithResult(_0x4aa2f6,_0x38f3b0){_0x38f3b0=_0x38f3b0||0xc8;return function(_0x3e8332){if(_0x3e8332){return _0x4aa2f6[_0x73af('0x18')](_0x38f3b0)[_0x73af('0x19')](_0x3e8332);}};}function respondWithFilteredResult(_0xfa2eec,_0x28de26){return function(_0x440f61){if(_0x440f61){var _0x2fb2af=typeof _0x28de26['offset']===_0x73af('0x1a')&&typeof _0x28de26['limit']==='undefined';var _0x34f4c2=_0x440f61[_0x73af('0x1b')];var _0x2d062b=_0x2fb2af?0x0:_0x28de26[_0x73af('0x1c')];var _0x4a1f24=_0x2fb2af?_0x440f61['count']:_0x28de26[_0x73af('0x1c')]+_0x28de26[_0x73af('0x1d')];var _0x19283c;if(_0x4a1f24>=_0x34f4c2){_0x4a1f24=_0x34f4c2;_0x19283c=0xc8;}else{_0x19283c=0xce;}_0xfa2eec[_0x73af('0x18')](_0x19283c);return _0xfa2eec['set'](_0x73af('0x1e'),_0x2d062b+'-'+_0x4a1f24+'/'+_0x34f4c2)['json'](_0x440f61);}return null;};}function patchUpdates(_0x30c09c){return function(_0x525244){try{jsonpatch[_0x73af('0x1f')](_0x525244,_0x30c09c,!![]);}catch(_0x2859c4){return BPromise[_0x73af('0x20')](_0x2859c4);}return _0x525244[_0x73af('0x21')]();};}function saveUpdates(_0x3dd617,_0x5ebded){return function(_0x2755ab){if(_0x2755ab){return _0x2755ab[_0x73af('0x22')](_0x3dd617)['then'](function(_0x3509ff){return _0x3509ff;});}return null;};}function removeEntity(_0x43bf6d,_0x3c7c3f){return function(_0x422dd1){if(_0x422dd1){return _0x422dd1[_0x73af('0x23')]()[_0x73af('0x24')](function(){_0x43bf6d[_0x73af('0x18')](0xcc)[_0x73af('0x17')]();});}};}function handleEntityNotFound(_0x1346bc,_0x290b8e){return function(_0x352dd1){if(!_0x352dd1){_0x1346bc[_0x73af('0x16')](0x194);}return _0x352dd1;};}function handleError(_0x111b9f,_0x3debad){_0x3debad=_0x3debad||0x1f4;return function(_0x4b8f79){logger[_0x73af('0x25')](_0x4b8f79[_0x73af('0x26')]);if(_0x4b8f79[_0x73af('0x27')]){delete _0x4b8f79[_0x73af('0x27')];}_0x111b9f[_0x73af('0x18')](_0x3debad)[_0x73af('0x28')](_0x4b8f79);};}exports[_0x73af('0x29')]=function(_0x1f9700,_0x308b56){var _0x4cf0fd={},_0x365395={},_0x2dd61e={'count':0x0,'rows':[]};var _0x432d06=_[_0x73af('0x2a')](db['SugarcrmAccount'][_0x73af('0x2b')],function(_0x290ceb){return{'name':_0x290ceb[_0x73af('0x2c')],'type':_0x290ceb[_0x73af('0x2d')][_0x73af('0x2e')]};});_0x365395[_0x73af('0x2f')]=_['map'](_0x432d06,_0x73af('0x27'));_0x365395[_0x73af('0x30')]=_[_0x73af('0x31')](_0x1f9700[_0x73af('0x30')]);_0x365395[_0x73af('0x32')]=_[_0x73af('0x33')](_0x365395[_0x73af('0x2f')],_0x365395[_0x73af('0x30')]);_0x4cf0fd[_0x73af('0x34')]=_['intersection'](_0x365395['model'],qs[_0x73af('0x35')](_0x1f9700[_0x73af('0x30')]['fields']));_0x4cf0fd['attributes']=_0x4cf0fd[_0x73af('0x34')]['length']?_0x4cf0fd[_0x73af('0x34')]:_0x365395[_0x73af('0x2f')];if(!_0x1f9700[_0x73af('0x30')]['hasOwnProperty']('nolimit')){_0x4cf0fd[_0x73af('0x1d')]=qs[_0x73af('0x1d')](_0x1f9700[_0x73af('0x30')][_0x73af('0x1d')]);_0x4cf0fd['offset']=qs[_0x73af('0x1c')](_0x1f9700[_0x73af('0x30')][_0x73af('0x1c')]);}_0x4cf0fd[_0x73af('0x36')]=qs[_0x73af('0x37')](_0x1f9700[_0x73af('0x30')][_0x73af('0x37')]);_0x4cf0fd[_0x73af('0x38')]=qs[_0x73af('0x32')](_[_0x73af('0x39')](_0x1f9700[_0x73af('0x30')],_0x365395[_0x73af('0x32')]),_0x432d06);if(_0x1f9700[_0x73af('0x30')]['filter']){_0x4cf0fd[_0x73af('0x38')]=_[_0x73af('0x3a')](_0x4cf0fd[_0x73af('0x38')],{'$or':_[_0x73af('0x2a')](_0x432d06,function(_0x2d2732){if(_0x2d2732[_0x73af('0x2d')]!=='VIRTUAL'){var _0x538f84={};_0x538f84[_0x2d2732[_0x73af('0x27')]]={'$like':'%'+_0x1f9700[_0x73af('0x30')][_0x73af('0x3b')]+'%'};return _0x538f84;}})});}_0x4cf0fd=_[_0x73af('0x3a')]({},_0x4cf0fd,_0x1f9700[_0x73af('0x3c')]);var _0x2530c1={'where':_0x4cf0fd['where']};return db['SugarcrmAccount'][_0x73af('0x1b')](_0x2530c1)[_0x73af('0x24')](function(_0x3dbb63){_0x2dd61e[_0x73af('0x1b')]=_0x3dbb63;if(_0x1f9700[_0x73af('0x30')][_0x73af('0x3d')]){_0x4cf0fd['include']=[{'all':!![]}];}return db[_0x73af('0x3e')]['findAll'](_0x4cf0fd);})[_0x73af('0x24')](function(_0x395c50){_0x2dd61e[_0x73af('0x3f')]=_0x395c50;return _0x2dd61e;})['then'](respondWithFilteredResult(_0x308b56,_0x4cf0fd))[_0x73af('0x40')](handleError(_0x308b56,null));};exports[_0x73af('0x41')]=function(_0x41fd89,_0x3fb1cb){var _0x50651f={'raw':![],'where':{'id':_0x41fd89[_0x73af('0x42')]['id']}},_0x2127bb={};_0x2127bb[_0x73af('0x2f')]=_[_0x73af('0x31')](db[_0x73af('0x3e')][_0x73af('0x2b')]);_0x2127bb[_0x73af('0x30')]=_[_0x73af('0x31')](_0x41fd89[_0x73af('0x30')]);_0x2127bb[_0x73af('0x32')]=_['intersection'](_0x2127bb[_0x73af('0x2f')],_0x2127bb[_0x73af('0x30')]);_0x50651f[_0x73af('0x34')]=_[_0x73af('0x33')](_0x2127bb[_0x73af('0x2f')],qs[_0x73af('0x35')](_0x41fd89[_0x73af('0x30')][_0x73af('0x35')]));_0x50651f[_0x73af('0x34')]=_0x50651f[_0x73af('0x34')]['length']?_0x50651f['attributes']:_0x2127bb['model'];if(_0x41fd89['query'][_0x73af('0x3d')]){_0x50651f[_0x73af('0x43')]=[{'all':!![]}];}_0x50651f=_[_0x73af('0x3a')]({},_0x50651f,_0x41fd89[_0x73af('0x3c')]);return db[_0x73af('0x3e')][_0x73af('0x44')](_0x50651f)[_0x73af('0x24')](handleEntityNotFound(_0x3fb1cb,null))[_0x73af('0x24')](respondWithResult(_0x3fb1cb,null))[_0x73af('0x40')](handleError(_0x3fb1cb,null));};exports[_0x73af('0x45')]=function(_0x3f2d4f,_0x523e83){return db[_0x73af('0x3e')][_0x73af('0x45')](_0x3f2d4f['body'],{})[_0x73af('0x24')](respondWithResult(_0x523e83,0xc9))[_0x73af('0x40')](handleError(_0x523e83,null));};exports[_0x73af('0x22')]=function(_0x2be247,_0x3d4e92){if(_0x2be247[_0x73af('0x46')]['id']){delete _0x2be247[_0x73af('0x46')]['id'];}return db[_0x73af('0x3e')][_0x73af('0x44')]({'where':{'id':_0x2be247[_0x73af('0x42')]['id']}})[_0x73af('0x24')](handleEntityNotFound(_0x3d4e92,null))[_0x73af('0x24')](saveUpdates(_0x2be247['body'],null))[_0x73af('0x24')](respondWithResult(_0x3d4e92,null))[_0x73af('0x40')](handleError(_0x3d4e92,null));};exports[_0x73af('0x23')]=function(_0x4982dd,_0x4baf6e){return db[_0x73af('0x3e')][_0x73af('0x44')]({'where':{'id':_0x4982dd[_0x73af('0x42')]['id']}})[_0x73af('0x24')](handleEntityNotFound(_0x4baf6e,null))[_0x73af('0x24')](removeEntity(_0x4baf6e,null))[_0x73af('0x40')](handleError(_0x4baf6e,null));};exports[_0x73af('0x47')]=function(_0x3e50d6,_0x27556b,_0x4bb2a4){var _0x412b23={};var _0x2562be={};var _0x24b46f;var _0x29e914;return db[_0x73af('0x3e')][_0x73af('0x48')]({'where':{'id':_0x3e50d6['params']['id']}})['then'](handleEntityNotFound(_0x27556b,null))[_0x73af('0x24')](function(_0x427b43){if(_0x427b43){_0x24b46f=_0x427b43;_0x2562be[_0x73af('0x2f')]=_['keys'](db[_0x73af('0x49')][_0x73af('0x2b')]);_0x2562be[_0x73af('0x30')]=_[_0x73af('0x31')](_0x3e50d6[_0x73af('0x30')]);_0x2562be[_0x73af('0x32')]=_[_0x73af('0x33')](_0x2562be[_0x73af('0x2f')],_0x2562be[_0x73af('0x30')]);_0x412b23[_0x73af('0x34')]=_['intersection'](_0x2562be[_0x73af('0x2f')],qs[_0x73af('0x35')](_0x3e50d6[_0x73af('0x30')]['fields']));_0x412b23[_0x73af('0x34')]=_0x412b23[_0x73af('0x34')][_0x73af('0x4a')]?_0x412b23[_0x73af('0x34')]:_0x2562be[_0x73af('0x2f')];_0x412b23[_0x73af('0x36')]=qs[_0x73af('0x37')](_0x3e50d6[_0x73af('0x30')][_0x73af('0x37')]);_0x412b23[_0x73af('0x38')]=qs[_0x73af('0x32')](_[_0x73af('0x39')](_0x3e50d6[_0x73af('0x30')],_0x2562be['filters']));if(_0x3e50d6[_0x73af('0x30')][_0x73af('0x3b')]){_0x412b23['where']=_[_0x73af('0x3a')](_0x412b23['where'],{'$or':_['map'](_0x412b23[_0x73af('0x34')],function(_0x1169e0){var _0x233d32={};_0x233d32[_0x1169e0]={'$like':'%'+_0x3e50d6['query'][_0x73af('0x3b')]+'%'};return _0x233d32;})});}_0x412b23=_[_0x73af('0x3a')]({},_0x412b23,_0x3e50d6[_0x73af('0x3c')]);return _0x24b46f[_0x73af('0x47')](_0x412b23);}})[_0x73af('0x24')](function(_0x3b2a6d){if(_0x3b2a6d){_0x29e914=_0x3b2a6d['length'];if(!_0x3e50d6[_0x73af('0x30')][_0x73af('0x4b')](_0x73af('0x4c'))){_0x412b23['limit']=qs['limit'](_0x3e50d6[_0x73af('0x30')][_0x73af('0x1d')]);_0x412b23['offset']=qs['offset'](_0x3e50d6[_0x73af('0x30')]['offset']);}return _0x24b46f[_0x73af('0x47')](_0x412b23);}})[_0x73af('0x24')](function(_0x5ee0f3){if(_0x5ee0f3){return _0x5ee0f3?{'count':_0x29e914,'rows':_0x5ee0f3}:null;}})[_0x73af('0x24')](respondWithResult(_0x27556b,null))['catch'](handleError(_0x27556b,null));};exports[_0x73af('0x4d')]=function(_0x1dc797,_0x3ce4fa,_0x2c8945){if(_0x1dc797[_0x73af('0x46')]['id']){delete _0x1dc797[_0x73af('0x46')]['id'];}return db[_0x73af('0x3e')]['findOne']({'where':{'id':_0x1dc797[_0x73af('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ce4fa,null))['then'](function(_0x4f3936){if(_0x4f3936){_0x1dc797['body'][_0x73af('0x4e')]=_0x4f3936['id'];_0x1dc797[_0x73af('0x46')][_0x73af('0x4f')]=integrations[_0x73af('0x50')](_0x1dc797[_0x73af('0x46')]['channel'],_0x1dc797[_0x73af('0x46')][_0x73af('0x2d')]);_0x1dc797[_0x73af('0x46')][_0x73af('0x51')]=integrations[_0x73af('0x52')](_0x1dc797[_0x73af('0x46')]['channel'],_0x1dc797['body'][_0x73af('0x2d')]);return db[_0x73af('0x49')][_0x73af('0x45')](_0x1dc797['body'],{'include':[{'model':db[_0x73af('0x53')],'as':_0x73af('0x4f')},{'model':db[_0x73af('0x53')],'as':_0x73af('0x51')}]});}return null;})[_0x73af('0x24')](respondWithResult(_0x3ce4fa,null))[_0x73af('0x40')](handleError(_0x3ce4fa,null));};exports[_0x73af('0x54')]=function(_0x442d25,_0xc082d,_0x2f8cec){var _0x53a22d='';var _0x40fda7=['id',_0x73af('0x27'),_0x73af('0x55'),_0x73af('0x56'),'description',_0x73af('0x57'),_0x73af('0x58'),_0x73af('0x59'),_0x73af('0x5a'),_0x73af('0x5b'),_0x73af('0x5c'),_0x73af('0x5d')];return db[_0x73af('0x3e')][_0x73af('0x48')]({'where':{'id':_0x442d25[_0x73af('0x42')]['id']},'attributes':['id','username','password',_0x73af('0x5e')]})[_0x73af('0x24')](handleEntityNotFound(_0xc082d,null))[_0x73af('0x24')](function(_0x1a4abb){if(_0x1a4abb){_0x53a22d=_0x1a4abb[_0x73af('0x5e')];var _0x2ea12c=_0x53a22d[_0x73af('0x5f')](-0x1);if(_0x2ea12c==='/'){_0x53a22d=_0x53a22d[_0x73af('0x60')](0x0,_0x53a22d[_0x73af('0x61')](_0x2ea12c));}return rp({'method':_0x73af('0x62'),'uri':util['format'](_0x73af('0x63'),_0x53a22d,_0x73af('0x64')),'json':!![],'form':{'method':_0x73af('0x65'),'input_type':'JSON','response_type':_0x73af('0x66'),'rest_data':JSON[_0x73af('0x67')]({'user_auth':{'user_name':_0x1a4abb['username'],'password':_0x1a4abb[_0x73af('0x68')],'encryption':_0x73af('0x69')},'application':_0x73af('0x6a')})}});}})[_0x73af('0x24')](function(_0x2053aa){if(_0x2053aa&&_0x2053aa[_0x73af('0x27')]!==_0x73af('0x6b')&&_0x2053aa[_0x73af('0x27')]!==_0x73af('0x6c')){return rp({'method':'POST','uri':util[_0x73af('0x6d')]('%s%s',_0x53a22d,_0x73af('0x64')),'json':!![],'form':{'method':_0x73af('0x6e'),'input_type':_0x73af('0x66'),'response_type':_0x73af('0x66'),'rest_data':JSON['stringify']({'session':_0x2053aa['id'],'module_name':_0x73af('0x6f')})}})[_0x73af('0x24')](function(_0x3c99bc){if(_0x3c99bc){var _0x727480=_[_0x73af('0x70')](_0x3c99bc[_0x73af('0x71')]);_[_0x73af('0x72')](_0x727480,function(_0x1f1f91){return _0x40fda7['includes'](_0x1f1f91['name']);});return{'count':_0x727480[_0x73af('0x4a')],'rows':_['map'](_0x727480,function(_0x1dcf61){return{'id':_0x1dcf61['name'],'name':_0x1dcf61[_0x73af('0x73')],'custom':_['endsWith'](_0x1dcf61['name'],'_c')?!![]:![],'options':_0x1dcf61[_0x73af('0x3c')]?_[_0x73af('0x2a')](_['values'](_0x1dcf61[_0x73af('0x3c')]),function(_0x399935){return{'name':_0x399935['value'],'value':_0x399935[_0x73af('0x27')]};}):[]};})};}})[_0x73af('0x24')](respondWithResult(_0xc082d,null))[_0x73af('0x40')](function(_0x482f5d){var _0x2b8550=_0x442d25[_0x73af('0x30')][_0x73af('0x74')]?0x1f4:_0x482f5d[_0x73af('0x75')]||0x1f4;logger[_0x73af('0x25')](_0x73af('0x76'),_0x73af('0x54'),_0x2b8550,JSON[_0x73af('0x67')](_0x482f5d));delete _0x482f5d[_0x73af('0x27')];if(_0x2b8550===0x191){_0x2b8550=0x190;}_0xc082d[_0x73af('0x18')](_0x2b8550)[_0x73af('0x28')](_0x442d25[_0x73af('0x30')][_0x73af('0x74')]?{'message':_0x73af('0x77'),'statusCode':_0x482f5d[_0x73af('0x75')]}:_0x482f5d);});}else{var _0x26d5b9=0x1f4;_0xc082d[_0x73af('0x18')](_0x26d5b9)[_0x73af('0x28')]({'message':_0x73af('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x552a=['Calls','values','module_fields','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','POST','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','%s%s','get_module_fields'];(function(_0x5810f0,_0x52406d){var _0x526565=function(_0x2bdfef){while(--_0x2bdfef){_0x5810f0['push'](_0x5810f0['shift']());}};_0x526565(++_0x52406d);}(_0x552a,0xfd));var _0xa552=function(_0x364106,_0x7c7fff){_0x364106=_0x364106-0x0;var _0x39dc9e=_0x552a[_0x364106];return _0x39dc9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa552('0x0'));var zipdir=require(_0xa552('0x1'));var jsonpatch=require(_0xa552('0x2'));var rp=require(_0xa552('0x3'));var moment=require(_0xa552('0x4'));var BPromise=require(_0xa552('0x5'));var Mustache=require(_0xa552('0x6'));var util=require('util');var path=require(_0xa552('0x7'));var sox=require(_0xa552('0x8'));var csv=require('to-csv');var ejs=require(_0xa552('0x9'));var fs=require('fs');var fs_extra=require(_0xa552('0xa'));var _=require(_0xa552('0xb'));var squel=require('squel');var crypto=require(_0xa552('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa552('0xd'));var toCsv=require(_0xa552('0xe'));var querystring=require(_0xa552('0xf'));var Papa=require(_0xa552('0x10'));var Redis=require(_0xa552('0x11'));var authService=require(_0xa552('0x12'));var qs=require(_0xa552('0x13'));var as=require(_0xa552('0x14'));var hardwareService=require(_0xa552('0x15'));var logger=require(_0xa552('0x16'))(_0xa552('0x17'));var utils=require(_0xa552('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa552('0x19'))['db'];var integrations=require(_0xa552('0x1a'));function respondWithStatusCode(_0x44fe04,_0x393c18){_0x393c18=_0x393c18||0xcc;return function(_0x23bc95){if(_0x23bc95){return _0x44fe04[_0xa552('0x1b')](_0x393c18);}return _0x44fe04['status'](_0x393c18)[_0xa552('0x1c')]();};}function respondWithResult(_0x2ed25c,_0x11a158){_0x11a158=_0x11a158||0xc8;return function(_0x53d6c4){if(_0x53d6c4){return _0x2ed25c[_0xa552('0x1d')](_0x11a158)[_0xa552('0x1e')](_0x53d6c4);}};}function respondWithFilteredResult(_0x599fb5,_0x32e5c5){return function(_0x592622){if(_0x592622){var _0xb35227=typeof _0x32e5c5['offset']==='undefined'&&typeof _0x32e5c5[_0xa552('0x1f')]===_0xa552('0x20');var _0x3dbb55=_0x592622['count'];var _0x41f602=_0xb35227?0x0:_0x32e5c5['offset'];var _0x2fcc9d=_0xb35227?_0x592622[_0xa552('0x21')]:_0x32e5c5[_0xa552('0x22')]+_0x32e5c5[_0xa552('0x1f')];var _0x35a131;if(_0x2fcc9d>=_0x3dbb55){_0x2fcc9d=_0x3dbb55;_0x35a131=0xc8;}else{_0x35a131=0xce;}_0x599fb5[_0xa552('0x1d')](_0x35a131);return _0x599fb5[_0xa552('0x23')](_0xa552('0x24'),_0x41f602+'-'+_0x2fcc9d+'/'+_0x3dbb55)[_0xa552('0x1e')](_0x592622);}return null;};}function patchUpdates(_0x520d9f){return function(_0x204a22){try{jsonpatch[_0xa552('0x25')](_0x204a22,_0x520d9f,!![]);}catch(_0x2afc46){return BPromise['reject'](_0x2afc46);}return _0x204a22['save']();};}function saveUpdates(_0xc91beb,_0x516cd5){return function(_0x2bfc78){if(_0x2bfc78){return _0x2bfc78[_0xa552('0x26')](_0xc91beb)[_0xa552('0x27')](function(_0x5ed5e7){return _0x5ed5e7;});}return null;};}function removeEntity(_0x3f2f55,_0x20ba59){return function(_0x51ff8e){if(_0x51ff8e){return _0x51ff8e['destroy']()[_0xa552('0x27')](function(){_0x3f2f55['status'](0xcc)[_0xa552('0x1c')]();});}};}function handleEntityNotFound(_0x149e10,_0x37117e){return function(_0x11319c){if(!_0x11319c){_0x149e10[_0xa552('0x1b')](0x194);}return _0x11319c;};}function handleError(_0x6795c4,_0x20c52a){_0x20c52a=_0x20c52a||0x1f4;return function(_0x5bd200){logger[_0xa552('0x28')](_0x5bd200['stack']);if(_0x5bd200['name']){delete _0x5bd200[_0xa552('0x29')];}_0x6795c4[_0xa552('0x1d')](_0x20c52a)[_0xa552('0x2a')](_0x5bd200);};}exports[_0xa552('0x2b')]=function(_0x5ae88f,_0x554f79){var _0x20ef76={},_0x1ff53c={},_0x5482ee={'count':0x0,'rows':[]};var _0x55cc9d=_[_0xa552('0x2c')](db[_0xa552('0x2d')][_0xa552('0x2e')],function(_0xb703dd){return{'name':_0xb703dd[_0xa552('0x2f')],'type':_0xb703dd[_0xa552('0x30')][_0xa552('0x31')]};});_0x1ff53c[_0xa552('0x32')]=_['map'](_0x55cc9d,'name');_0x1ff53c[_0xa552('0x33')]=_['keys'](_0x5ae88f[_0xa552('0x33')]);_0x1ff53c[_0xa552('0x34')]=_[_0xa552('0x35')](_0x1ff53c[_0xa552('0x32')],_0x1ff53c['query']);_0x20ef76[_0xa552('0x36')]=_[_0xa552('0x35')](_0x1ff53c[_0xa552('0x32')],qs[_0xa552('0x37')](_0x5ae88f[_0xa552('0x33')]['fields']));_0x20ef76[_0xa552('0x36')]=_0x20ef76[_0xa552('0x36')]['length']?_0x20ef76[_0xa552('0x36')]:_0x1ff53c['model'];if(!_0x5ae88f[_0xa552('0x33')][_0xa552('0x38')]('nolimit')){_0x20ef76['limit']=qs[_0xa552('0x1f')](_0x5ae88f[_0xa552('0x33')][_0xa552('0x1f')]);_0x20ef76['offset']=qs['offset'](_0x5ae88f['query'][_0xa552('0x22')]);}_0x20ef76[_0xa552('0x39')]=qs[_0xa552('0x3a')](_0x5ae88f[_0xa552('0x33')][_0xa552('0x3a')]);_0x20ef76[_0xa552('0x3b')]=qs[_0xa552('0x34')](_[_0xa552('0x3c')](_0x5ae88f[_0xa552('0x33')],_0x1ff53c['filters']),_0x55cc9d);if(_0x5ae88f[_0xa552('0x33')][_0xa552('0x3d')]){_0x20ef76[_0xa552('0x3b')]=_[_0xa552('0x3e')](_0x20ef76[_0xa552('0x3b')],{'$or':_[_0xa552('0x2c')](_0x55cc9d,function(_0x293fd0){if(_0x293fd0[_0xa552('0x30')]!==_0xa552('0x3f')){var _0x3b937d={};_0x3b937d[_0x293fd0[_0xa552('0x29')]]={'$like':'%'+_0x5ae88f['query'][_0xa552('0x3d')]+'%'};return _0x3b937d;}})});}_0x20ef76=_['merge']({},_0x20ef76,_0x5ae88f[_0xa552('0x40')]);var _0x4abe55={'where':_0x20ef76[_0xa552('0x3b')]};return db[_0xa552('0x2d')][_0xa552('0x21')](_0x4abe55)['then'](function(_0x5b3c39){_0x5482ee[_0xa552('0x21')]=_0x5b3c39;if(_0x5ae88f[_0xa552('0x33')][_0xa552('0x41')]){_0x20ef76[_0xa552('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xa552('0x43')](_0x20ef76);})[_0xa552('0x27')](function(_0x5e5e42){_0x5482ee[_0xa552('0x44')]=_0x5e5e42;return _0x5482ee;})[_0xa552('0x27')](respondWithFilteredResult(_0x554f79,_0x20ef76))[_0xa552('0x45')](handleError(_0x554f79,null));};exports[_0xa552('0x46')]=function(_0x129b56,_0x5659e3){var _0x729dc6={'raw':![],'where':{'id':_0x129b56[_0xa552('0x47')]['id']}},_0x51959f={};_0x51959f['model']=_['keys'](db[_0xa552('0x2d')]['rawAttributes']);_0x51959f['query']=_[_0xa552('0x48')](_0x129b56['query']);_0x51959f[_0xa552('0x34')]=_[_0xa552('0x35')](_0x51959f[_0xa552('0x32')],_0x51959f[_0xa552('0x33')]);_0x729dc6[_0xa552('0x36')]=_[_0xa552('0x35')](_0x51959f[_0xa552('0x32')],qs[_0xa552('0x37')](_0x129b56[_0xa552('0x33')][_0xa552('0x37')]));_0x729dc6[_0xa552('0x36')]=_0x729dc6['attributes'][_0xa552('0x49')]?_0x729dc6[_0xa552('0x36')]:_0x51959f['model'];if(_0x129b56[_0xa552('0x33')]['includeAll']){_0x729dc6['include']=[{'all':!![]}];}_0x729dc6=_[_0xa552('0x3e')]({},_0x729dc6,_0x129b56[_0xa552('0x40')]);return db[_0xa552('0x2d')][_0xa552('0x4a')](_0x729dc6)['then'](handleEntityNotFound(_0x5659e3,null))[_0xa552('0x27')](respondWithResult(_0x5659e3,null))['catch'](handleError(_0x5659e3,null));};exports['create']=function(_0x29d5bd,_0x15c470){return db[_0xa552('0x2d')][_0xa552('0x4b')](_0x29d5bd[_0xa552('0x4c')],{})[_0xa552('0x27')](respondWithResult(_0x15c470,0xc9))['catch'](handleError(_0x15c470,null));};exports[_0xa552('0x26')]=function(_0x10253a,_0x56498a){if(_0x10253a['body']['id']){delete _0x10253a[_0xa552('0x4c')]['id'];}return db[_0xa552('0x2d')][_0xa552('0x4a')]({'where':{'id':_0x10253a['params']['id']}})['then'](handleEntityNotFound(_0x56498a,null))[_0xa552('0x27')](saveUpdates(_0x10253a[_0xa552('0x4c')],null))[_0xa552('0x27')](respondWithResult(_0x56498a,null))[_0xa552('0x45')](handleError(_0x56498a,null));};exports[_0xa552('0x4d')]=function(_0x133c19,_0x415e91){return db[_0xa552('0x2d')][_0xa552('0x4a')]({'where':{'id':_0x133c19['params']['id']}})[_0xa552('0x27')](handleEntityNotFound(_0x415e91,null))[_0xa552('0x27')](removeEntity(_0x415e91,null))['catch'](handleError(_0x415e91,null));};exports['getConfigurations']=function(_0x34a865,_0x17a270,_0x5b1f0a){var _0x55d02c={};var _0x43eab5={};var _0x31cd38;var _0x5cddf5;return db[_0xa552('0x2d')][_0xa552('0x4e')]({'where':{'id':_0x34a865[_0xa552('0x47')]['id']}})[_0xa552('0x27')](handleEntityNotFound(_0x17a270,null))['then'](function(_0x5c7b71){if(_0x5c7b71){_0x31cd38=_0x5c7b71;_0x43eab5[_0xa552('0x32')]=_[_0xa552('0x48')](db[_0xa552('0x4f')][_0xa552('0x2e')]);_0x43eab5[_0xa552('0x33')]=_['keys'](_0x34a865[_0xa552('0x33')]);_0x43eab5[_0xa552('0x34')]=_[_0xa552('0x35')](_0x43eab5['model'],_0x43eab5[_0xa552('0x33')]);_0x55d02c[_0xa552('0x36')]=_[_0xa552('0x35')](_0x43eab5[_0xa552('0x32')],qs[_0xa552('0x37')](_0x34a865[_0xa552('0x33')][_0xa552('0x37')]));_0x55d02c['attributes']=_0x55d02c[_0xa552('0x36')][_0xa552('0x49')]?_0x55d02c['attributes']:_0x43eab5[_0xa552('0x32')];_0x55d02c[_0xa552('0x39')]=qs[_0xa552('0x3a')](_0x34a865['query'][_0xa552('0x3a')]);_0x55d02c[_0xa552('0x3b')]=qs[_0xa552('0x34')](_['pick'](_0x34a865[_0xa552('0x33')],_0x43eab5[_0xa552('0x34')]));if(_0x34a865[_0xa552('0x33')][_0xa552('0x3d')]){_0x55d02c[_0xa552('0x3b')]=_['merge'](_0x55d02c[_0xa552('0x3b')],{'$or':_[_0xa552('0x2c')](_0x55d02c['attributes'],function(_0x5de193){var _0x2d5adc={};_0x2d5adc[_0x5de193]={'$like':'%'+_0x34a865[_0xa552('0x33')]['filter']+'%'};return _0x2d5adc;})});}_0x55d02c=_[_0xa552('0x3e')]({},_0x55d02c,_0x34a865[_0xa552('0x40')]);return _0x31cd38['getConfigurations'](_0x55d02c);}})[_0xa552('0x27')](function(_0xbe827d){if(_0xbe827d){_0x5cddf5=_0xbe827d[_0xa552('0x49')];if(!_0x34a865[_0xa552('0x33')][_0xa552('0x38')]('nolimit')){_0x55d02c[_0xa552('0x1f')]=qs[_0xa552('0x1f')](_0x34a865['query'][_0xa552('0x1f')]);_0x55d02c[_0xa552('0x22')]=qs[_0xa552('0x22')](_0x34a865[_0xa552('0x33')]['offset']);}return _0x31cd38[_0xa552('0x50')](_0x55d02c);}})[_0xa552('0x27')](function(_0xacaab8){if(_0xacaab8){return _0xacaab8?{'count':_0x5cddf5,'rows':_0xacaab8}:null;}})[_0xa552('0x27')](respondWithResult(_0x17a270,null))[_0xa552('0x45')](handleError(_0x17a270,null));};exports[_0xa552('0x51')]=function(_0x596d98,_0x24b2f7,_0x2cf58a){if(_0x596d98[_0xa552('0x4c')]['id']){delete _0x596d98['body']['id'];}return db[_0xa552('0x2d')][_0xa552('0x4e')]({'where':{'id':_0x596d98['params']['id']}})[_0xa552('0x27')](handleEntityNotFound(_0x24b2f7,null))[_0xa552('0x27')](function(_0x3c69b5){if(_0x3c69b5){_0x596d98[_0xa552('0x4c')][_0xa552('0x52')]=_0x3c69b5['id'];_0x596d98['body'][_0xa552('0x53')]=integrations[_0xa552('0x54')](_0x596d98[_0xa552('0x4c')]['channel'],_0x596d98[_0xa552('0x4c')][_0xa552('0x30')]);_0x596d98['body'][_0xa552('0x55')]=integrations[_0xa552('0x56')](_0x596d98[_0xa552('0x4c')][_0xa552('0x57')],_0x596d98[_0xa552('0x4c')]['type']);return db[_0xa552('0x4f')][_0xa552('0x4b')](_0x596d98[_0xa552('0x4c')],{'include':[{'model':db[_0xa552('0x58')],'as':_0xa552('0x53')},{'model':db[_0xa552('0x58')],'as':_0xa552('0x55')}]});}return null;})[_0xa552('0x27')](respondWithResult(_0x24b2f7,null))[_0xa552('0x45')](handleError(_0x24b2f7,null));};exports[_0xa552('0x59')]=function(_0x1b823b,_0x36e944,_0x35e79d){var _0x3e9e1b='';var _0x4f4d6f=['id','name',_0xa552('0x5a'),_0xa552('0x5b'),_0xa552('0x5c'),_0xa552('0x5d'),_0xa552('0x5e'),_0xa552('0x5f'),_0xa552('0x60'),_0xa552('0x61'),'parent_name','direction'];return db[_0xa552('0x2d')][_0xa552('0x4e')]({'where':{'id':_0x1b823b[_0xa552('0x47')]['id']},'attributes':['id',_0xa552('0x62'),_0xa552('0x63'),_0xa552('0x64')]})[_0xa552('0x27')](handleEntityNotFound(_0x36e944,null))[_0xa552('0x27')](function(_0x206121){if(_0x206121){_0x3e9e1b=_0x206121[_0xa552('0x64')];var _0x68e867=_0x3e9e1b[_0xa552('0x65')](-0x1);if(_0x68e867==='/'){_0x3e9e1b=_0x3e9e1b['substring'](0x0,_0x3e9e1b['lastIndexOf'](_0x68e867));}return rp({'method':_0xa552('0x66'),'uri':util['format']('%s%s',_0x3e9e1b,_0xa552('0x67')),'json':!![],'form':{'method':_0xa552('0x68'),'input_type':_0xa552('0x69'),'response_type':_0xa552('0x69'),'rest_data':JSON[_0xa552('0x6a')]({'user_auth':{'user_name':_0x206121[_0xa552('0x62')],'password':_0x206121[_0xa552('0x63')],'encryption':_0xa552('0x6b')},'application':_0xa552('0x6c')})}});}})[_0xa552('0x27')](function(_0x269503){if(_0x269503&&_0x269503[_0xa552('0x29')]!=='Invalid\x20Login'&&_0x269503[_0xa552('0x29')]!==_0xa552('0x6d')){return rp({'method':_0xa552('0x66'),'uri':util[_0xa552('0x6e')](_0xa552('0x6f'),_0x3e9e1b,_0xa552('0x67')),'json':!![],'form':{'method':_0xa552('0x70'),'input_type':_0xa552('0x69'),'response_type':_0xa552('0x69'),'rest_data':JSON['stringify']({'session':_0x269503['id'],'module_name':_0xa552('0x71')})}})[_0xa552('0x27')](function(_0x5dc30e){if(_0x5dc30e){var _0x16032a=_[_0xa552('0x72')](_0x5dc30e[_0xa552('0x73')]);_['remove'](_0x16032a,function(_0x29c7e3){return _0x4f4d6f['includes'](_0x29c7e3['name']);});return{'count':_0x16032a['length'],'rows':_[_0xa552('0x2c')](_0x16032a,function(_0xf6a367){return{'id':_0xf6a367['name'],'name':_0xf6a367[_0xa552('0x74')],'custom':_[_0xa552('0x75')](_0xf6a367['name'],'_c')?!![]:![],'options':_0xf6a367[_0xa552('0x40')]?_['map'](_[_0xa552('0x72')](_0xf6a367[_0xa552('0x40')]),function(_0x2689aa){return{'name':_0x2689aa[_0xa552('0x76')],'value':_0x2689aa[_0xa552('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x36e944,null))[_0xa552('0x45')](function(_0x3d0be7){var _0x5ab9b6=_0x1b823b[_0xa552('0x33')][_0xa552('0x77')]?0x1f4:_0x3d0be7[_0xa552('0x78')]||0x1f4;logger[_0xa552('0x28')](_0xa552('0x79'),_0xa552('0x59'),_0x5ab9b6,JSON['stringify'](_0x3d0be7));delete _0x3d0be7[_0xa552('0x29')];if(_0x5ab9b6===0x191){_0x5ab9b6=0x190;}_0x36e944[_0xa552('0x1d')](_0x5ab9b6)[_0xa552('0x2a')](_0x1b823b['query'][_0xa552('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x3d0be7[_0xa552('0x78')]}:_0x3d0be7);});}else{var _0x1e0c3e=0x1f4;_0x36e944[_0xa552('0x1d')](_0x1e0c3e)['send']({'message':'Wrong\x20credentials','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 464a9e7..58ca3d3 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 _0x233e=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','moment'];(function(_0x21a62c,_0x44876){var _0x5f1141=function(_0x5ae9d0){while(--_0x5ae9d0){_0x21a62c['push'](_0x21a62c['shift']());}};_0x5f1141(++_0x44876);}(_0x233e,0x1dd));var _0xe233=function(_0x178b95,_0x5dabf1){_0x178b95=_0x178b95-0x0;var _0xa8d853=_0x233e[_0x178b95];return _0xa8d853;};'use strict';var _=require('lodash');var util=require(_0xe233('0x0'));var logger=require(_0xe233('0x1'))('api');var moment=require(_0xe233('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe233('0x3'));var rimraf=require(_0xe233('0x4'));var config=require(_0xe233('0x5'));var attributes=require(_0xe233('0x6'));var integrations=require(_0xe233('0x7'));module[_0xe233('0x8')]=function(_0x4e0c5b,_0x74df9a){return _0x4e0c5b[_0xe233('0x9')](_0xe233('0xa'),attributes,{'tableName':_0xe233('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6123=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x2dc367,_0x591c8a){var _0x14845a=function(_0xaef88b){while(--_0xaef88b){_0x2dc367['push'](_0x2dc367['shift']());}};_0x14845a(++_0x591c8a);}(_0x6123,0x1e2));var _0x3612=function(_0x56baba,_0x22de9a){_0x56baba=_0x56baba-0x0;var _0x34f9ce=_0x6123[_0x56baba];return _0x34f9ce;};'use strict';var _=require('lodash');var util=require(_0x3612('0x0'));var logger=require(_0x3612('0x1'))('api');var moment=require(_0x3612('0x2'));var BPromise=require(_0x3612('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3612('0x4'));var rimraf=require(_0x3612('0x5'));var config=require(_0x3612('0x6'));var attributes=require(_0x3612('0x7'));var integrations=require(_0x3612('0x8'));module[_0x3612('0x9')]=function(_0x531191,_0x345812){return _0x531191['define']('SugarcrmAccount',attributes,{'tableName':_0x3612('0xa'),'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 54e0993..108d149 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 _0xc2c7=['request\x20sent','stringify','code','SugarcrmAccount,\x20%s,\x20%s','error','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0xc2c7,0x13e));var _0x7c2c=function(_0xa9602c,_0x5052c4){_0xa9602c=_0xa9602c-0x0;var _0x5629e0=_0xc2c7[_0xa9602c];return _0x5629e0;};'use strict';var _=require(_0x7c2c('0x0'));var util=require(_0x7c2c('0x1'));var moment=require(_0x7c2c('0x2'));var BPromise=require(_0x7c2c('0x3'));var rs=require(_0x7c2c('0x4'));var fs=require('fs');var Redis=require(_0x7c2c('0x5'));var db=require(_0x7c2c('0x6'))['db'];var utils=require(_0x7c2c('0x7'));var logger=require(_0x7c2c('0x8'))(_0x7c2c('0x9'));var config=require(_0x7c2c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7c2c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39628a,_0x366c09,_0x33cbde){return new BPromise(function(_0x3f8b51,_0x21bae0){return client['request'](_0x39628a,_0x33cbde)['then'](function(_0x56a55b){logger[_0x7c2c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x366c09,'request\x20sent');logger[_0x7c2c('0xd')](_0x7c2c('0xe'),_0x366c09,_0x7c2c('0xf'),JSON[_0x7c2c('0x10')](_0x56a55b));if(_0x56a55b['error']){if(_0x56a55b['error'][_0x7c2c('0x11')]===0x1f4){logger['error'](_0x7c2c('0x12'),_0x366c09,_0x56a55b[_0x7c2c('0x13')][_0x7c2c('0x14')]);return _0x21bae0(_0x56a55b['error'][_0x7c2c('0x14')]);}logger[_0x7c2c('0x13')](_0x7c2c('0x12'),_0x366c09,_0x56a55b[_0x7c2c('0x13')][_0x7c2c('0x14')]);return _0x3f8b51(_0x56a55b[_0x7c2c('0x13')][_0x7c2c('0x14')]);}else{logger[_0x7c2c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x366c09,_0x7c2c('0xf'));_0x3f8b51(_0x56a55b[_0x7c2c('0x15')][_0x7c2c('0x14')]);}})['catch'](function(_0x444be9){logger[_0x7c2c('0x13')](_0x7c2c('0x12'),_0x366c09,_0x444be9);_0x21bae0(_0x444be9);});});}exports[_0x7c2c('0x16')]=function(_0x1671f7){var _0x506a21=this;return new Promise(function(_0x8f4fa8,_0x123076){return db[_0x7c2c('0x17')][_0x7c2c('0x18')]({'raw':_0x1671f7[_0x7c2c('0x19')]?_0x1671f7[_0x7c2c('0x19')][_0x7c2c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1671f7[_0x7c2c('0x19')]?_0x1671f7[_0x7c2c('0x19')][_0x7c2c('0x1b')]||null:null,'attributes':_0x1671f7['options']?_0x1671f7[_0x7c2c('0x19')][_0x7c2c('0x1c')]||null:null,'limit':_0x1671f7[_0x7c2c('0x19')]?_0x1671f7[_0x7c2c('0x19')][_0x7c2c('0x1d')]||null:null,'include':_0x1671f7['options']?_0x1671f7['options'][_0x7c2c('0x1e')]?_[_0x7c2c('0x1f')](_0x1671f7[_0x7c2c('0x19')]['include'],function(_0x33d90e){return{'model':db[_0x33d90e[_0x7c2c('0x20')]],'as':_0x33d90e['as'],'attributes':_0x33d90e['attributes'],'include':_0x33d90e[_0x7c2c('0x1e')]?_[_0x7c2c('0x1f')](_0x33d90e['include'],function(_0x2ee2b5){return{'model':db[_0x2ee2b5[_0x7c2c('0x20')]],'as':_0x2ee2b5['as'],'attributes':_0x2ee2b5[_0x7c2c('0x1c')],'include':_0x2ee2b5[_0x7c2c('0x1e')]?_['map'](_0x2ee2b5[_0x7c2c('0x1e')],function(_0x2b4f06){return{'model':db[_0x2b4f06[_0x7c2c('0x20')]],'as':_0x2b4f06['as'],'attributes':_0x2b4f06[_0x7c2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0x21')](function(_0x4b14af){logger[_0x7c2c('0xc')]('GetSugarcrmAccount',_0x1671f7);logger[_0x7c2c('0xd')](_0x7c2c('0x16'),_0x1671f7,JSON[_0x7c2c('0x10')](_0x4b14af));_0x8f4fa8(_0x4b14af);})[_0x7c2c('0x22')](function(_0x484927){logger['error'](_0x7c2c('0x16'),_0x484927[_0x7c2c('0x14')],_0x1671f7);_0x123076(_0x506a21[_0x7c2c('0x13')](0x1f4,_0x484927[_0x7c2c('0x14')]));});});};exports[_0x7c2c('0x23')]=function(_0x348d7d){var _0x51cf53=this;return new Promise(function(_0x3274be,_0x3aa96b){return db[_0x7c2c('0x17')][_0x7c2c('0x24')]({'raw':_0x348d7d[_0x7c2c('0x19')]?_0x348d7d[_0x7c2c('0x19')][_0x7c2c('0x1a')]===undefined?!![]:![]:!![],'where':_0x348d7d[_0x7c2c('0x19')]?_0x348d7d['options'][_0x7c2c('0x1b')]||null:null,'attributes':_0x348d7d[_0x7c2c('0x19')]?_0x348d7d[_0x7c2c('0x19')][_0x7c2c('0x1c')]||null:null,'include':_0x348d7d[_0x7c2c('0x19')]?_0x348d7d[_0x7c2c('0x19')]['include']?_['map'](_0x348d7d[_0x7c2c('0x19')]['include'],function(_0x12cabf){return{'model':db[_0x12cabf[_0x7c2c('0x20')]],'as':_0x12cabf['as'],'attributes':_0x12cabf[_0x7c2c('0x1c')],'include':_0x12cabf['include']?_[_0x7c2c('0x1f')](_0x12cabf[_0x7c2c('0x1e')],function(_0x1ee9b5){return{'model':db[_0x1ee9b5[_0x7c2c('0x20')]],'as':_0x1ee9b5['as'],'attributes':_0x1ee9b5[_0x7c2c('0x1c')],'include':_0x1ee9b5[_0x7c2c('0x1e')]?_['map'](_0x1ee9b5[_0x7c2c('0x1e')],function(_0x4f94a0){return{'model':db[_0x4f94a0['model']],'as':_0x4f94a0['as'],'attributes':_0x4f94a0[_0x7c2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0x21')](function(_0x56d8f8){logger[_0x7c2c('0xc')]('ShowSugarcrmAccount',_0x348d7d);logger[_0x7c2c('0xd')](_0x7c2c('0x23'),_0x348d7d,JSON[_0x7c2c('0x10')](_0x56d8f8));_0x3274be(_0x56d8f8);})[_0x7c2c('0x22')](function(_0x2deef1){logger[_0x7c2c('0x13')](_0x7c2c('0x23'),_0x2deef1['message'],_0x348d7d);_0x3aa96b(_0x51cf53[_0x7c2c('0x13')](0x1f4,_0x2deef1[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0x38a0=['attributes','limit','include','model','map','stringify','find','ShowSugarcrmAccount','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where'];(function(_0x1421af,_0x1cd8a6){var _0x518ef2=function(_0x461e72){while(--_0x461e72){_0x1421af['push'](_0x1421af['shift']());}};_0x518ef2(++_0x1cd8a6);}(_0x38a0,0xb3));var _0x038a=function(_0x54750b,_0x19d837){_0x54750b=_0x54750b-0x0;var _0x45f416=_0x38a0[_0x54750b];return _0x45f416;};'use strict';var _=require(_0x038a('0x0'));var util=require('util');var moment=require(_0x038a('0x1'));var BPromise=require(_0x038a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x038a('0x3'))['db'];var utils=require(_0x038a('0x4'));var logger=require('../../config/logger')(_0x038a('0x5'));var config=require(_0x038a('0x6'));var jayson=require(_0x038a('0x7'));var client=jayson[_0x038a('0x8')][_0x038a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b8e64,_0x542d9e,_0x101acc){return new BPromise(function(_0x3b17d8,_0x511848){return client[_0x038a('0xa')](_0x3b8e64,_0x101acc)[_0x038a('0xb')](function(_0x5c5afa){logger[_0x038a('0xc')](_0x038a('0xd'),_0x542d9e,_0x038a('0xe'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x542d9e,_0x038a('0xe'),JSON['stringify'](_0x5c5afa));if(_0x5c5afa[_0x038a('0xf')]){if(_0x5c5afa[_0x038a('0xf')][_0x038a('0x10')]===0x1f4){logger[_0x038a('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x542d9e,_0x5c5afa[_0x038a('0xf')][_0x038a('0x11')]);return _0x511848(_0x5c5afa['error'][_0x038a('0x11')]);}logger[_0x038a('0xf')](_0x038a('0xd'),_0x542d9e,_0x5c5afa['error'][_0x038a('0x11')]);return _0x3b17d8(_0x5c5afa[_0x038a('0xf')][_0x038a('0x11')]);}else{logger[_0x038a('0xc')](_0x038a('0xd'),_0x542d9e,'request\x20sent');_0x3b17d8(_0x5c5afa[_0x038a('0x12')][_0x038a('0x11')]);}})[_0x038a('0x13')](function(_0x4c4932){logger[_0x038a('0xf')](_0x038a('0xd'),_0x542d9e,_0x4c4932);_0x511848(_0x4c4932);});});}exports[_0x038a('0x14')]=function(_0xf98430){var _0x3a25db=this;return new Promise(function(_0x57d621,_0x22fb3b){return db['SugarcrmAccount'][_0x038a('0x15')]({'raw':_0xf98430[_0x038a('0x16')]?_0xf98430[_0x038a('0x16')][_0x038a('0x17')]===undefined?!![]:![]:!![],'where':_0xf98430[_0x038a('0x16')]?_0xf98430[_0x038a('0x16')][_0x038a('0x18')]||null:null,'attributes':_0xf98430['options']?_0xf98430[_0x038a('0x16')][_0x038a('0x19')]||null:null,'limit':_0xf98430[_0x038a('0x16')]?_0xf98430[_0x038a('0x16')][_0x038a('0x1a')]||null:null,'include':_0xf98430[_0x038a('0x16')]?_0xf98430['options'][_0x038a('0x1b')]?_['map'](_0xf98430[_0x038a('0x16')][_0x038a('0x1b')],function(_0x48d7da){return{'model':db[_0x48d7da[_0x038a('0x1c')]],'as':_0x48d7da['as'],'attributes':_0x48d7da[_0x038a('0x19')],'include':_0x48d7da[_0x038a('0x1b')]?_[_0x038a('0x1d')](_0x48d7da['include'],function(_0x29457f){return{'model':db[_0x29457f['model']],'as':_0x29457f['as'],'attributes':_0x29457f['attributes'],'include':_0x29457f[_0x038a('0x1b')]?_[_0x038a('0x1d')](_0x29457f[_0x038a('0x1b')],function(_0x16148c){return{'model':db[_0x16148c[_0x038a('0x1c')]],'as':_0x16148c['as'],'attributes':_0x16148c[_0x038a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x038a('0xb')](function(_0x1b64a9){logger[_0x038a('0xc')](_0x038a('0x14'),_0xf98430);logger['debug'](_0x038a('0x14'),_0xf98430,JSON[_0x038a('0x1e')](_0x1b64a9));_0x57d621(_0x1b64a9);})[_0x038a('0x13')](function(_0x25e228){logger[_0x038a('0xf')](_0x038a('0x14'),_0x25e228[_0x038a('0x11')],_0xf98430);_0x22fb3b(_0x3a25db['error'](0x1f4,_0x25e228[_0x038a('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x99b830){var _0x5d5063=this;return new Promise(function(_0x3dc0fc,_0x2ef447){return db['SugarcrmAccount'][_0x038a('0x1f')]({'raw':_0x99b830[_0x038a('0x16')]?_0x99b830['options']['raw']===undefined?!![]:![]:!![],'where':_0x99b830[_0x038a('0x16')]?_0x99b830[_0x038a('0x16')][_0x038a('0x18')]||null:null,'attributes':_0x99b830['options']?_0x99b830[_0x038a('0x16')][_0x038a('0x19')]||null:null,'include':_0x99b830[_0x038a('0x16')]?_0x99b830['options'][_0x038a('0x1b')]?_['map'](_0x99b830['options'][_0x038a('0x1b')],function(_0x125bf4){return{'model':db[_0x125bf4[_0x038a('0x1c')]],'as':_0x125bf4['as'],'attributes':_0x125bf4[_0x038a('0x19')],'include':_0x125bf4[_0x038a('0x1b')]?_['map'](_0x125bf4[_0x038a('0x1b')],function(_0x59fbaf){return{'model':db[_0x59fbaf[_0x038a('0x1c')]],'as':_0x59fbaf['as'],'attributes':_0x59fbaf[_0x038a('0x19')],'include':_0x59fbaf['include']?_['map'](_0x59fbaf[_0x038a('0x1b')],function(_0x4e37cb){return{'model':db[_0x4e37cb['model']],'as':_0x4e37cb['as'],'attributes':_0x4e37cb[_0x038a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x038a('0xb')](function(_0x475011){logger['info'](_0x038a('0x20'),_0x99b830);logger[_0x038a('0x21')](_0x038a('0x20'),_0x99b830,JSON[_0x038a('0x1e')](_0x475011));_0x3dc0fc(_0x475011);})[_0x038a('0x13')](function(_0x77f5a1){logger[_0x038a('0xf')](_0x038a('0x20'),_0x77f5a1['message'],_0x99b830);_0x2ef447(_0x5d5063[_0x038a('0xf')](0x1f4,_0x77f5a1[_0x038a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 18993ce..682ea97 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 _0xd22e=['/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index'];(function(_0x13cd20,_0x1d9211){var _0x22b6de=function(_0x4b574f){while(--_0x4b574f){_0x13cd20['push'](_0x13cd20['shift']());}};_0x22b6de(++_0x1d9211);}(_0xd22e,0x1ac));var _0xed22=function(_0x896663,_0x4231f6){_0x896663=_0x896663-0x0;var _0x122747=_0xd22e[_0x896663];return _0x122747;};'use strict';var multer=require(_0xed22('0x0'));var util=require(_0xed22('0x1'));var path=require('path');var timeout=require(_0xed22('0x2'));var express=require(_0xed22('0x3'));var router=express[_0xed22('0x4')]();var fs_extra=require(_0xed22('0x5'));var auth=require(_0xed22('0x6'));var interaction=require(_0xed22('0x7'));var config=require(_0xed22('0x8'));var controller=require(_0xed22('0x9'));router[_0xed22('0xa')]('/',auth[_0xed22('0xb')](),controller[_0xed22('0xc')]);router[_0xed22('0xa')](_0xed22('0xd'),auth[_0xed22('0xb')](),controller['show']);router[_0xed22('0xa')](_0xed22('0xe'),auth[_0xed22('0xb')](),controller[_0xed22('0xf')]);router[_0xed22('0xa')](_0xed22('0x10'),auth[_0xed22('0xb')](),controller['getSubjects']);router['get'](_0xed22('0x11'),auth[_0xed22('0xb')](),controller['getDescriptions']);router[_0xed22('0x12')]('/',auth[_0xed22('0xb')](),controller['create']);router[_0xed22('0x13')](_0xed22('0xd'),auth[_0xed22('0xb')](),controller['update']);router[_0xed22('0x14')](_0xed22('0xd'),auth[_0xed22('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3607=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x552a08,_0x2fd13a){var _0x2eae33=function(_0x12a232){while(--_0x12a232){_0x552a08['push'](_0x552a08['shift']());}};_0x2eae33(++_0x2fd13a);}(_0x3607,0xf5));var _0x7360=function(_0x446179,_0x2e227e){_0x446179=_0x446179-0x0;var _0x4a89c3=_0x3607[_0x446179];return _0x4a89c3;};'use strict';var multer=require(_0x7360('0x0'));var util=require(_0x7360('0x1'));var path=require(_0x7360('0x2'));var timeout=require(_0x7360('0x3'));var express=require(_0x7360('0x4'));var router=express[_0x7360('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7360('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x7360('0x7')]('/',auth[_0x7360('0x8')](),controller['index']);router[_0x7360('0x7')]('/:id',auth[_0x7360('0x8')](),controller[_0x7360('0x9')]);router[_0x7360('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7360('0xa')]);router['get'](_0x7360('0xb'),auth[_0x7360('0x8')](),controller[_0x7360('0xc')]);router[_0x7360('0x7')](_0x7360('0xd'),auth['isAuthenticated'](),controller[_0x7360('0xe')]);router[_0x7360('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7360('0x10')]('/:id',auth[_0x7360('0x8')](),controller[_0x7360('0x11')]);router[_0x7360('0x12')](_0x7360('0x13'),auth[_0x7360('0x8')](),controller[_0x7360('0x14')]);module[_0x7360('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 88145c5..dfbb72d 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 _0x1bef=['sequelize','exports','STRING'];(function(_0x122826,_0x4a44ed){var _0xbfc95e=function(_0x42dfa1){while(--_0x42dfa1){_0x122826['push'](_0x122826['shift']());}};_0xbfc95e(++_0x4a44ed);}(_0x1bef,0xb1));var _0xf1be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1bef[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf1be('0x0'));module[_0xf1be('0x1')]={'name':{'type':Sequelize[_0xf1be('0x2')]},'description':{'type':Sequelize[_0xf1be('0x2')]}}; \ No newline at end of file +var _0x6da1=['exports','STRING','sequelize'];(function(_0x4befa3,_0x5462a8){var _0x541966=function(_0x2c3da9){while(--_0x2c3da9){_0x4befa3['push'](_0x4befa3['shift']());}};_0x541966(++_0x5462a8);}(_0x6da1,0x131));var _0x16da=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x6da1[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x16da('0x0'));module[_0x16da('0x1')]={'name':{'type':Sequelize[_0x16da('0x2')]},'description':{'type':Sequelize[_0x16da('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f753ffc..546efca 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 _0x0d87=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','body','find','getFields','findOne','rawAttributes','order','nolimit','getSubjects','SugarcrmField','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse'];(function(_0xe821a7,_0x3bb43f){var _0x82959c=function(_0x586207){while(--_0x586207){_0xe821a7['push'](_0xe821a7['shift']());}};_0x82959c(++_0x3bb43f);}(_0x0d87,0x91));var _0x70d8=function(_0xc3f3e3,_0x43a328){_0xc3f3e3=_0xc3f3e3-0x0;var _0x212cef=_0x0d87[_0xc3f3e3];return _0x212cef;};'use strict';var emlformat=require(_0x70d8('0x0'));var rimraf=require(_0x70d8('0x1'));var zipdir=require(_0x70d8('0x2'));var jsonpatch=require(_0x70d8('0x3'));var rp=require(_0x70d8('0x4'));var moment=require(_0x70d8('0x5'));var BPromise=require(_0x70d8('0x6'));var Mustache=require(_0x70d8('0x7'));var util=require(_0x70d8('0x8'));var path=require(_0x70d8('0x9'));var sox=require('sox');var csv=require(_0x70d8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70d8('0xb'));var _=require(_0x70d8('0xc'));var squel=require('squel');var crypto=require(_0x70d8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x70d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x70d8('0xf'));var Papa=require(_0x70d8('0x10'));var Redis=require(_0x70d8('0x11'));var authService=require(_0x70d8('0x12'));var qs=require(_0x70d8('0x13'));var as=require(_0x70d8('0x14'));var hardwareService=require(_0x70d8('0x15'));var logger=require(_0x70d8('0x16'))(_0x70d8('0x17'));var utils=require('../../config/utils');var config=require(_0x70d8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x70d8('0x19'))['db'];function respondWithStatusCode(_0x86c2e3,_0x4b455d){_0x4b455d=_0x4b455d||0xcc;return function(_0x47e2f0){if(_0x47e2f0){return _0x86c2e3['sendStatus'](_0x4b455d);}return _0x86c2e3['status'](_0x4b455d)[_0x70d8('0x1a')]();};}function respondWithResult(_0x490aa0,_0x4da9ec){_0x4da9ec=_0x4da9ec||0xc8;return function(_0x3aafe0){if(_0x3aafe0){return _0x490aa0[_0x70d8('0x1b')](_0x4da9ec)[_0x70d8('0x1c')](_0x3aafe0);}};}function respondWithFilteredResult(_0x22aaa4,_0x297215){return function(_0x468ccc){if(_0x468ccc){var _0x580772=typeof _0x297215[_0x70d8('0x1d')]===_0x70d8('0x1e')&&typeof _0x297215[_0x70d8('0x1f')]==='undefined';var _0xca8d6e=_0x468ccc['count'];var _0x278670=_0x580772?0x0:_0x297215[_0x70d8('0x1d')];var _0x1d298d=_0x580772?_0x468ccc['count']:_0x297215['offset']+_0x297215[_0x70d8('0x1f')];var _0x4fc339;if(_0x1d298d>=_0xca8d6e){_0x1d298d=_0xca8d6e;_0x4fc339=0xc8;}else{_0x4fc339=0xce;}_0x22aaa4[_0x70d8('0x1b')](_0x4fc339);return _0x22aaa4[_0x70d8('0x20')](_0x70d8('0x21'),_0x278670+'-'+_0x1d298d+'/'+_0xca8d6e)[_0x70d8('0x1c')](_0x468ccc);}return null;};}function patchUpdates(_0x490d9c){return function(_0x376152){try{jsonpatch[_0x70d8('0x22')](_0x376152,_0x490d9c,!![]);}catch(_0x419704){return BPromise[_0x70d8('0x23')](_0x419704);}return _0x376152[_0x70d8('0x24')]();};}function saveUpdates(_0x4e00b0,_0x4c4a06){return function(_0x36d352){if(_0x36d352){return _0x36d352[_0x70d8('0x25')](_0x4e00b0)[_0x70d8('0x26')](function(_0x486f71){return _0x486f71;});}return null;};}function removeEntity(_0x5070f7,_0x399657){return function(_0x52cdc7){if(_0x52cdc7){return _0x52cdc7['destroy']()[_0x70d8('0x26')](function(){_0x5070f7[_0x70d8('0x1b')](0xcc)[_0x70d8('0x1a')]();});}};}function handleEntityNotFound(_0x4b7a77,_0x3b52af){return function(_0x392678){if(!_0x392678){_0x4b7a77[_0x70d8('0x27')](0x194);}return _0x392678;};}function handleError(_0x50aea8,_0x5acfbe){_0x5acfbe=_0x5acfbe||0x1f4;return function(_0x3014bd){logger['error'](_0x3014bd['stack']);if(_0x3014bd[_0x70d8('0x28')]){delete _0x3014bd[_0x70d8('0x28')];}_0x50aea8[_0x70d8('0x1b')](_0x5acfbe)[_0x70d8('0x29')](_0x3014bd);};}exports[_0x70d8('0x2a')]=function(_0x3133f5,_0x42cd48){var _0x4c043a={},_0x388178={},_0x70073e={'count':0x0,'rows':[]};var _0x36a4a6=_[_0x70d8('0x2b')](db[_0x70d8('0x2c')]['rawAttributes'],function(_0x1accdb){return{'name':_0x1accdb[_0x70d8('0x2d')],'type':_0x1accdb[_0x70d8('0x2e')][_0x70d8('0x2f')]};});_0x388178['model']=_[_0x70d8('0x2b')](_0x36a4a6,_0x70d8('0x28'));_0x388178[_0x70d8('0x30')]=_[_0x70d8('0x31')](_0x3133f5[_0x70d8('0x30')]);_0x388178[_0x70d8('0x32')]=_['intersection'](_0x388178[_0x70d8('0x33')],_0x388178[_0x70d8('0x30')]);_0x4c043a[_0x70d8('0x34')]=_[_0x70d8('0x35')](_0x388178[_0x70d8('0x33')],qs['fields'](_0x3133f5[_0x70d8('0x30')][_0x70d8('0x36')]));_0x4c043a[_0x70d8('0x34')]=_0x4c043a[_0x70d8('0x34')][_0x70d8('0x37')]?_0x4c043a['attributes']:_0x388178[_0x70d8('0x33')];if(!_0x3133f5['query']['hasOwnProperty']('nolimit')){_0x4c043a[_0x70d8('0x1f')]=qs[_0x70d8('0x1f')](_0x3133f5[_0x70d8('0x30')][_0x70d8('0x1f')]);_0x4c043a[_0x70d8('0x1d')]=qs[_0x70d8('0x1d')](_0x3133f5[_0x70d8('0x30')][_0x70d8('0x1d')]);}_0x4c043a['order']=qs[_0x70d8('0x38')](_0x3133f5[_0x70d8('0x30')]['sort']);_0x4c043a[_0x70d8('0x39')]=qs['filters'](_[_0x70d8('0x3a')](_0x3133f5[_0x70d8('0x30')],_0x388178[_0x70d8('0x32')]),_0x36a4a6);if(_0x3133f5[_0x70d8('0x30')][_0x70d8('0x3b')]){_0x4c043a[_0x70d8('0x39')]=_[_0x70d8('0x3c')](_0x4c043a[_0x70d8('0x39')],{'$or':_['map'](_0x36a4a6,function(_0x21735c){if(_0x21735c[_0x70d8('0x2e')]!==_0x70d8('0x3d')){var _0x5d2193={};_0x5d2193[_0x21735c['name']]={'$like':'%'+_0x3133f5[_0x70d8('0x30')]['filter']+'%'};return _0x5d2193;}})});}_0x4c043a=_[_0x70d8('0x3c')]({},_0x4c043a,_0x3133f5[_0x70d8('0x3e')]);var _0x350c7a={'where':_0x4c043a[_0x70d8('0x39')]};return db['SugarcrmConfiguration'][_0x70d8('0x3f')](_0x350c7a)['then'](function(_0xd90fff){_0x70073e[_0x70d8('0x3f')]=_0xd90fff;if(_0x3133f5[_0x70d8('0x30')][_0x70d8('0x40')]){_0x4c043a[_0x70d8('0x41')]=[{'all':!![]}];}return db[_0x70d8('0x2c')][_0x70d8('0x42')](_0x4c043a);})[_0x70d8('0x26')](function(_0x2d70f0){_0x70073e['rows']=_0x2d70f0;return _0x70073e;})[_0x70d8('0x26')](respondWithFilteredResult(_0x42cd48,_0x4c043a))[_0x70d8('0x43')](handleError(_0x42cd48,null));};exports[_0x70d8('0x44')]=function(_0x9bc752,_0x5f2264){var _0x4a00fc={'raw':![],'where':{'id':_0x9bc752[_0x70d8('0x45')]['id']}},_0x59cbea={};_0x59cbea[_0x70d8('0x33')]=_[_0x70d8('0x31')](db['SugarcrmConfiguration']['rawAttributes']);_0x59cbea['query']=_[_0x70d8('0x31')](_0x9bc752[_0x70d8('0x30')]);_0x59cbea[_0x70d8('0x32')]=_['intersection'](_0x59cbea[_0x70d8('0x33')],_0x59cbea[_0x70d8('0x30')]);_0x4a00fc['attributes']=_[_0x70d8('0x35')](_0x59cbea[_0x70d8('0x33')],qs[_0x70d8('0x36')](_0x9bc752[_0x70d8('0x30')][_0x70d8('0x36')]));_0x4a00fc['attributes']=_0x4a00fc[_0x70d8('0x34')][_0x70d8('0x37')]?_0x4a00fc[_0x70d8('0x34')]:_0x59cbea[_0x70d8('0x33')];if(_0x9bc752[_0x70d8('0x30')][_0x70d8('0x40')]){_0x4a00fc[_0x70d8('0x41')]=[{'all':!![]}];}_0x4a00fc=_[_0x70d8('0x3c')]({},_0x4a00fc,_0x9bc752[_0x70d8('0x3e')]);return db[_0x70d8('0x2c')]['find'](_0x4a00fc)[_0x70d8('0x26')](handleEntityNotFound(_0x5f2264,null))[_0x70d8('0x26')](respondWithResult(_0x5f2264,null))['catch'](handleError(_0x5f2264,null));};exports['create']=function(_0x1df63e,_0xf0c23c){return db['SugarcrmConfiguration']['create'](_0x1df63e[_0x70d8('0x46')],{})['then'](respondWithResult(_0xf0c23c,0xc9))['catch'](handleError(_0xf0c23c,null));};exports['update']=function(_0x48738b,_0x46a3c0){if(_0x48738b['body']['id']){delete _0x48738b['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x48738b[_0x70d8('0x45')]['id']}})[_0x70d8('0x26')](handleEntityNotFound(_0x46a3c0,null))[_0x70d8('0x26')](saveUpdates(_0x48738b[_0x70d8('0x46')],null))[_0x70d8('0x26')](respondWithResult(_0x46a3c0,null))[_0x70d8('0x43')](handleError(_0x46a3c0,null));};exports['destroy']=function(_0x44c1c9,_0x57dc09){return db[_0x70d8('0x2c')][_0x70d8('0x47')]({'where':{'id':_0x44c1c9[_0x70d8('0x45')]['id']}})[_0x70d8('0x26')](handleEntityNotFound(_0x57dc09,null))[_0x70d8('0x26')](removeEntity(_0x57dc09,null))[_0x70d8('0x43')](handleError(_0x57dc09,null));};exports[_0x70d8('0x48')]=function(_0x129c04,_0x2af286,_0x918431){var _0x22a8c5={};var _0x5ba8cc={};var _0x5e55bb;var _0x156c09;return db[_0x70d8('0x2c')][_0x70d8('0x49')]({'where':{'id':_0x129c04[_0x70d8('0x45')]['id']}})[_0x70d8('0x26')](handleEntityNotFound(_0x2af286,null))['then'](function(_0x1ea570){if(_0x1ea570){_0x5e55bb=_0x1ea570;_0x5ba8cc[_0x70d8('0x33')]=_[_0x70d8('0x31')](db['SugarcrmField'][_0x70d8('0x4a')]);_0x5ba8cc[_0x70d8('0x30')]=_['keys'](_0x129c04[_0x70d8('0x30')]);_0x5ba8cc[_0x70d8('0x32')]=_['intersection'](_0x5ba8cc[_0x70d8('0x33')],_0x5ba8cc[_0x70d8('0x30')]);_0x22a8c5[_0x70d8('0x34')]=_['intersection'](_0x5ba8cc['model'],qs[_0x70d8('0x36')](_0x129c04['query'][_0x70d8('0x36')]));_0x22a8c5[_0x70d8('0x34')]=_0x22a8c5[_0x70d8('0x34')][_0x70d8('0x37')]?_0x22a8c5[_0x70d8('0x34')]:_0x5ba8cc[_0x70d8('0x33')];_0x22a8c5[_0x70d8('0x4b')]=qs[_0x70d8('0x38')](_0x129c04[_0x70d8('0x30')][_0x70d8('0x38')]);_0x22a8c5[_0x70d8('0x39')]=qs[_0x70d8('0x32')](_[_0x70d8('0x3a')](_0x129c04['query'],_0x5ba8cc[_0x70d8('0x32')]));if(_0x129c04['query']['filter']){_0x22a8c5['where']=_['merge'](_0x22a8c5[_0x70d8('0x39')],{'$or':_[_0x70d8('0x2b')](_0x22a8c5[_0x70d8('0x34')],function(_0x55018b){var _0x261ee9={};_0x261ee9[_0x55018b]={'$like':'%'+_0x129c04[_0x70d8('0x30')][_0x70d8('0x3b')]+'%'};return _0x261ee9;})});}_0x22a8c5=_[_0x70d8('0x3c')]({},_0x22a8c5,_0x129c04['options']);return _0x5e55bb[_0x70d8('0x48')](_0x22a8c5);}})['then'](function(_0x10d259){if(_0x10d259){_0x156c09=_0x10d259[_0x70d8('0x37')];if(!_0x129c04[_0x70d8('0x30')]['hasOwnProperty'](_0x70d8('0x4c'))){_0x22a8c5[_0x70d8('0x1f')]=qs[_0x70d8('0x1f')](_0x129c04[_0x70d8('0x30')]['limit']);_0x22a8c5[_0x70d8('0x1d')]=qs[_0x70d8('0x1d')](_0x129c04[_0x70d8('0x30')]['offset']);}return _0x5e55bb['getFields'](_0x22a8c5);}})[_0x70d8('0x26')](function(_0x314239){if(_0x314239){return _0x314239?{'count':_0x156c09,'rows':_0x314239}:null;}})[_0x70d8('0x26')](respondWithResult(_0x2af286,null))[_0x70d8('0x43')](handleError(_0x2af286,null));};exports[_0x70d8('0x4d')]=function(_0x24c082,_0x1f7791,_0x3bd6a5){var _0xd7d2e6={};var _0x1abf97={};var _0x27557b;var _0x212093;return db[_0x70d8('0x2c')][_0x70d8('0x49')]({'where':{'id':_0x24c082[_0x70d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f7791,null))[_0x70d8('0x26')](function(_0x962673){if(_0x962673){_0x27557b=_0x962673;_0x1abf97['model']=_['keys'](db[_0x70d8('0x4e')][_0x70d8('0x4a')]);_0x1abf97['query']=_[_0x70d8('0x31')](_0x24c082[_0x70d8('0x30')]);_0x1abf97['filters']=_[_0x70d8('0x35')](_0x1abf97['model'],_0x1abf97[_0x70d8('0x30')]);_0xd7d2e6[_0x70d8('0x34')]=_[_0x70d8('0x35')](_0x1abf97[_0x70d8('0x33')],qs['fields'](_0x24c082[_0x70d8('0x30')]['fields']));_0xd7d2e6['attributes']=_0xd7d2e6[_0x70d8('0x34')][_0x70d8('0x37')]?_0xd7d2e6[_0x70d8('0x34')]:_0x1abf97[_0x70d8('0x33')];_0xd7d2e6['order']=qs[_0x70d8('0x38')](_0x24c082[_0x70d8('0x30')][_0x70d8('0x38')]);_0xd7d2e6[_0x70d8('0x39')]=qs[_0x70d8('0x32')](_[_0x70d8('0x3a')](_0x24c082['query'],_0x1abf97['filters']));if(_0x24c082['query'][_0x70d8('0x3b')]){_0xd7d2e6[_0x70d8('0x39')]=_[_0x70d8('0x3c')](_0xd7d2e6[_0x70d8('0x39')],{'$or':_[_0x70d8('0x2b')](_0xd7d2e6[_0x70d8('0x34')],function(_0x40e107){var _0x1bcc09={};_0x1bcc09[_0x40e107]={'$like':'%'+_0x24c082[_0x70d8('0x30')][_0x70d8('0x3b')]+'%'};return _0x1bcc09;})});}_0xd7d2e6=_[_0x70d8('0x3c')]({},_0xd7d2e6,_0x24c082[_0x70d8('0x3e')]);return _0x27557b[_0x70d8('0x4d')](_0xd7d2e6);}})['then'](function(_0x3871e9){if(_0x3871e9){_0x212093=_0x3871e9[_0x70d8('0x37')];if(!_0x24c082['query'][_0x70d8('0x4f')](_0x70d8('0x4c'))){_0xd7d2e6[_0x70d8('0x1f')]=qs[_0x70d8('0x1f')](_0x24c082[_0x70d8('0x30')]['limit']);_0xd7d2e6[_0x70d8('0x1d')]=qs[_0x70d8('0x1d')](_0x24c082['query']['offset']);}return _0x27557b['getSubjects'](_0xd7d2e6);}})[_0x70d8('0x26')](function(_0x30bad5){if(_0x30bad5){return _0x30bad5?{'count':_0x212093,'rows':_0x30bad5}:null;}})['then'](respondWithResult(_0x1f7791,null))['catch'](handleError(_0x1f7791,null));};exports[_0x70d8('0x50')]=function(_0x375b2b,_0x36f989,_0x164185){var _0x263fae={};var _0x18b2db={};var _0xffbafb;var _0xc74a01;return db[_0x70d8('0x2c')][_0x70d8('0x49')]({'where':{'id':_0x375b2b[_0x70d8('0x45')]['id']}})[_0x70d8('0x26')](handleEntityNotFound(_0x36f989,null))['then'](function(_0x43c610){if(_0x43c610){_0xffbafb=_0x43c610;_0x18b2db[_0x70d8('0x33')]=_['keys'](db['SugarcrmField'][_0x70d8('0x4a')]);_0x18b2db['query']=_[_0x70d8('0x31')](_0x375b2b[_0x70d8('0x30')]);_0x18b2db[_0x70d8('0x32')]=_[_0x70d8('0x35')](_0x18b2db['model'],_0x18b2db['query']);_0x263fae[_0x70d8('0x34')]=_['intersection'](_0x18b2db[_0x70d8('0x33')],qs[_0x70d8('0x36')](_0x375b2b[_0x70d8('0x30')][_0x70d8('0x36')]));_0x263fae[_0x70d8('0x34')]=_0x263fae[_0x70d8('0x34')]['length']?_0x263fae[_0x70d8('0x34')]:_0x18b2db[_0x70d8('0x33')];_0x263fae[_0x70d8('0x4b')]=qs[_0x70d8('0x38')](_0x375b2b[_0x70d8('0x30')][_0x70d8('0x38')]);_0x263fae[_0x70d8('0x39')]=qs['filters'](_[_0x70d8('0x3a')](_0x375b2b[_0x70d8('0x30')],_0x18b2db[_0x70d8('0x32')]));if(_0x375b2b['query'][_0x70d8('0x3b')]){_0x263fae[_0x70d8('0x39')]=_[_0x70d8('0x3c')](_0x263fae[_0x70d8('0x39')],{'$or':_[_0x70d8('0x2b')](_0x263fae['attributes'],function(_0x171320){var _0x2de4c5={};_0x2de4c5[_0x171320]={'$like':'%'+_0x375b2b[_0x70d8('0x30')][_0x70d8('0x3b')]+'%'};return _0x2de4c5;})});}_0x263fae=_[_0x70d8('0x3c')]({},_0x263fae,_0x375b2b['options']);return _0xffbafb['getDescriptions'](_0x263fae);}})['then'](function(_0x13a74d){if(_0x13a74d){_0xc74a01=_0x13a74d[_0x70d8('0x37')];if(!_0x375b2b[_0x70d8('0x30')]['hasOwnProperty'](_0x70d8('0x4c'))){_0x263fae['limit']=qs[_0x70d8('0x1f')](_0x375b2b[_0x70d8('0x30')]['limit']);_0x263fae['offset']=qs['offset'](_0x375b2b['query'][_0x70d8('0x1d')]);}return _0xffbafb[_0x70d8('0x50')](_0x263fae);}})[_0x70d8('0x26')](function(_0x16a89d){if(_0x16a89d){return _0x16a89d?{'count':_0xc74a01,'rows':_0x16a89d}:null;}})[_0x70d8('0x26')](respondWithResult(_0x36f989,null))[_0x70d8('0x43')](handleError(_0x36f989,null));}; \ No newline at end of file +var _0x96cc=['count','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','include','rows','show','params','keys','includeAll','find','catch','create','body','getFields','SugarcrmField','nolimit','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0xeb07a0,_0x3f8849){var _0x2ba674=function(_0x4364c1){while(--_0x4364c1){_0xeb07a0['push'](_0xeb07a0['shift']());}};_0x2ba674(++_0x3f8849);}(_0x96cc,0x86));var _0xc96c=function(_0x5a12ff,_0x2e18db){_0x5a12ff=_0x5a12ff-0x0;var _0x285f8d=_0x96cc[_0x5a12ff];return _0x285f8d;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require(_0xc96c('0x2'));var rp=require(_0xc96c('0x3'));var moment=require(_0xc96c('0x4'));var BPromise=require(_0xc96c('0x5'));var Mustache=require(_0xc96c('0x6'));var util=require(_0xc96c('0x7'));var path=require(_0xc96c('0x8'));var sox=require(_0xc96c('0x9'));var csv=require(_0xc96c('0xa'));var ejs=require(_0xc96c('0xb'));var fs=require('fs');var fs_extra=require(_0xc96c('0xc'));var _=require(_0xc96c('0xd'));var squel=require(_0xc96c('0xe'));var crypto=require(_0xc96c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc96c('0x10'));var toCsv=require(_0xc96c('0xa'));var querystring=require(_0xc96c('0x11'));var Papa=require(_0xc96c('0x12'));var Redis=require(_0xc96c('0x13'));var authService=require(_0xc96c('0x14'));var qs=require(_0xc96c('0x15'));var as=require(_0xc96c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc96c('0x17'))(_0xc96c('0x18'));var utils=require('../../config/utils');var config=require(_0xc96c('0x19'));var licenseUtil=require(_0xc96c('0x1a'));var db=require(_0xc96c('0x1b'))['db'];function respondWithStatusCode(_0x5048d9,_0x3e7b68){_0x3e7b68=_0x3e7b68||0xcc;return function(_0x2ef27d){if(_0x2ef27d){return _0x5048d9[_0xc96c('0x1c')](_0x3e7b68);}return _0x5048d9[_0xc96c('0x1d')](_0x3e7b68)[_0xc96c('0x1e')]();};}function respondWithResult(_0x30afd8,_0x5882dd){_0x5882dd=_0x5882dd||0xc8;return function(_0x5a7306){if(_0x5a7306){return _0x30afd8[_0xc96c('0x1d')](_0x5882dd)['json'](_0x5a7306);}};}function respondWithFilteredResult(_0x52d3b0,_0x3acc83){return function(_0x47b0e9){if(_0x47b0e9){var _0x49c3ab=typeof _0x3acc83[_0xc96c('0x1f')]===_0xc96c('0x20')&&typeof _0x3acc83[_0xc96c('0x21')]===_0xc96c('0x20');var _0x1bdb3c=_0x47b0e9[_0xc96c('0x22')];var _0x2cb529=_0x49c3ab?0x0:_0x3acc83[_0xc96c('0x1f')];var _0x44f2d7=_0x49c3ab?_0x47b0e9[_0xc96c('0x22')]:_0x3acc83['offset']+_0x3acc83['limit'];var _0x2ed344;if(_0x44f2d7>=_0x1bdb3c){_0x44f2d7=_0x1bdb3c;_0x2ed344=0xc8;}else{_0x2ed344=0xce;}_0x52d3b0[_0xc96c('0x1d')](_0x2ed344);return _0x52d3b0[_0xc96c('0x23')]('Content-Range',_0x2cb529+'-'+_0x44f2d7+'/'+_0x1bdb3c)[_0xc96c('0x24')](_0x47b0e9);}return null;};}function patchUpdates(_0x27aeda){return function(_0x46c4be){try{jsonpatch[_0xc96c('0x25')](_0x46c4be,_0x27aeda,!![]);}catch(_0x1f2cf9){return BPromise[_0xc96c('0x26')](_0x1f2cf9);}return _0x46c4be[_0xc96c('0x27')]();};}function saveUpdates(_0x38e09e,_0x395c6a){return function(_0x5c1c12){if(_0x5c1c12){return _0x5c1c12['update'](_0x38e09e)[_0xc96c('0x28')](function(_0x103470){return _0x103470;});}return null;};}function removeEntity(_0x38811f,_0x45d644){return function(_0x5c5ebb){if(_0x5c5ebb){return _0x5c5ebb[_0xc96c('0x29')]()[_0xc96c('0x28')](function(){_0x38811f[_0xc96c('0x1d')](0xcc)[_0xc96c('0x1e')]();});}};}function handleEntityNotFound(_0x1e571f,_0x2de6b9){return function(_0x5b65b5){if(!_0x5b65b5){_0x1e571f[_0xc96c('0x1c')](0x194);}return _0x5b65b5;};}function handleError(_0x577c62,_0x552473){_0x552473=_0x552473||0x1f4;return function(_0x3146be){logger[_0xc96c('0x2a')](_0x3146be[_0xc96c('0x2b')]);if(_0x3146be[_0xc96c('0x2c')]){delete _0x3146be[_0xc96c('0x2c')];}_0x577c62[_0xc96c('0x1d')](_0x552473)[_0xc96c('0x2d')](_0x3146be);};}exports[_0xc96c('0x2e')]=function(_0x3cd990,_0x44bfbb){var _0x54f5d7={},_0x361291={},_0x57872d={'count':0x0,'rows':[]};var _0x524d15=_['map'](db['SugarcrmConfiguration'][_0xc96c('0x2f')],function(_0x2ad940){return{'name':_0x2ad940[_0xc96c('0x30')],'type':_0x2ad940[_0xc96c('0x31')][_0xc96c('0x32')]};});_0x361291[_0xc96c('0x33')]=_[_0xc96c('0x34')](_0x524d15,_0xc96c('0x2c'));_0x361291[_0xc96c('0x35')]=_['keys'](_0x3cd990[_0xc96c('0x35')]);_0x361291[_0xc96c('0x36')]=_[_0xc96c('0x37')](_0x361291[_0xc96c('0x33')],_0x361291[_0xc96c('0x35')]);_0x54f5d7[_0xc96c('0x38')]=_[_0xc96c('0x37')](_0x361291[_0xc96c('0x33')],qs['fields'](_0x3cd990[_0xc96c('0x35')][_0xc96c('0x39')]));_0x54f5d7[_0xc96c('0x38')]=_0x54f5d7[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x54f5d7['attributes']:_0x361291['model'];if(!_0x3cd990['query'][_0xc96c('0x3b')]('nolimit')){_0x54f5d7['limit']=qs[_0xc96c('0x21')](_0x3cd990[_0xc96c('0x35')][_0xc96c('0x21')]);_0x54f5d7['offset']=qs[_0xc96c('0x1f')](_0x3cd990[_0xc96c('0x35')][_0xc96c('0x1f')]);}_0x54f5d7['order']=qs[_0xc96c('0x3c')](_0x3cd990['query'][_0xc96c('0x3c')]);_0x54f5d7[_0xc96c('0x3d')]=qs[_0xc96c('0x36')](_[_0xc96c('0x3e')](_0x3cd990[_0xc96c('0x35')],_0x361291[_0xc96c('0x36')]),_0x524d15);if(_0x3cd990[_0xc96c('0x35')][_0xc96c('0x3f')]){_0x54f5d7['where']=_[_0xc96c('0x40')](_0x54f5d7[_0xc96c('0x3d')],{'$or':_['map'](_0x524d15,function(_0x6e8176){if(_0x6e8176[_0xc96c('0x31')]!==_0xc96c('0x41')){var _0xc6680b={};_0xc6680b[_0x6e8176[_0xc96c('0x2c')]]={'$like':'%'+_0x3cd990[_0xc96c('0x35')][_0xc96c('0x3f')]+'%'};return _0xc6680b;}})});}_0x54f5d7=_['merge']({},_0x54f5d7,_0x3cd990[_0xc96c('0x42')]);var _0x2d9cd3={'where':_0x54f5d7['where']};return db[_0xc96c('0x43')]['count'](_0x2d9cd3)[_0xc96c('0x28')](function(_0x48838e){_0x57872d[_0xc96c('0x22')]=_0x48838e;if(_0x3cd990[_0xc96c('0x35')]['includeAll']){_0x54f5d7[_0xc96c('0x44')]=[{'all':!![]}];}return db[_0xc96c('0x43')]['findAll'](_0x54f5d7);})[_0xc96c('0x28')](function(_0x469635){_0x57872d[_0xc96c('0x45')]=_0x469635;return _0x57872d;})[_0xc96c('0x28')](respondWithFilteredResult(_0x44bfbb,_0x54f5d7))['catch'](handleError(_0x44bfbb,null));};exports[_0xc96c('0x46')]=function(_0x39d131,_0x126120){var _0x163381={'raw':![],'where':{'id':_0x39d131[_0xc96c('0x47')]['id']}},_0x27c782={};_0x27c782[_0xc96c('0x33')]=_['keys'](db[_0xc96c('0x43')][_0xc96c('0x2f')]);_0x27c782['query']=_[_0xc96c('0x48')](_0x39d131[_0xc96c('0x35')]);_0x27c782['filters']=_['intersection'](_0x27c782['model'],_0x27c782[_0xc96c('0x35')]);_0x163381['attributes']=_[_0xc96c('0x37')](_0x27c782['model'],qs['fields'](_0x39d131[_0xc96c('0x35')][_0xc96c('0x39')]));_0x163381[_0xc96c('0x38')]=_0x163381[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x163381[_0xc96c('0x38')]:_0x27c782['model'];if(_0x39d131[_0xc96c('0x35')][_0xc96c('0x49')]){_0x163381[_0xc96c('0x44')]=[{'all':!![]}];}_0x163381=_[_0xc96c('0x40')]({},_0x163381,_0x39d131[_0xc96c('0x42')]);return db[_0xc96c('0x43')][_0xc96c('0x4a')](_0x163381)['then'](handleEntityNotFound(_0x126120,null))['then'](respondWithResult(_0x126120,null))[_0xc96c('0x4b')](handleError(_0x126120,null));};exports[_0xc96c('0x4c')]=function(_0x287301,_0x54178f){return db[_0xc96c('0x43')][_0xc96c('0x4c')](_0x287301['body'],{})[_0xc96c('0x28')](respondWithResult(_0x54178f,0xc9))['catch'](handleError(_0x54178f,null));};exports['update']=function(_0xdc1054,_0x3ff46d){if(_0xdc1054['body']['id']){delete _0xdc1054[_0xc96c('0x4d')]['id'];}return db[_0xc96c('0x43')][_0xc96c('0x4a')]({'where':{'id':_0xdc1054[_0xc96c('0x47')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x3ff46d,null))[_0xc96c('0x28')](saveUpdates(_0xdc1054[_0xc96c('0x4d')],null))[_0xc96c('0x28')](respondWithResult(_0x3ff46d,null))[_0xc96c('0x4b')](handleError(_0x3ff46d,null));};exports[_0xc96c('0x29')]=function(_0x19f9bb,_0xc9c46c){return db[_0xc96c('0x43')]['find']({'where':{'id':_0x19f9bb[_0xc96c('0x47')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0xc9c46c,null))[_0xc96c('0x28')](removeEntity(_0xc9c46c,null))['catch'](handleError(_0xc9c46c,null));};exports[_0xc96c('0x4e')]=function(_0x10ca6b,_0x3fb73e,_0x97c604){var _0x423829={};var _0x2c0d0e={};var _0x44a5ce;var _0x520e5e;return db[_0xc96c('0x43')]['findOne']({'where':{'id':_0x10ca6b[_0xc96c('0x47')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x3fb73e,null))[_0xc96c('0x28')](function(_0x152a3c){if(_0x152a3c){_0x44a5ce=_0x152a3c;_0x2c0d0e[_0xc96c('0x33')]=_[_0xc96c('0x48')](db[_0xc96c('0x4f')][_0xc96c('0x2f')]);_0x2c0d0e[_0xc96c('0x35')]=_[_0xc96c('0x48')](_0x10ca6b[_0xc96c('0x35')]);_0x2c0d0e[_0xc96c('0x36')]=_[_0xc96c('0x37')](_0x2c0d0e[_0xc96c('0x33')],_0x2c0d0e[_0xc96c('0x35')]);_0x423829['attributes']=_[_0xc96c('0x37')](_0x2c0d0e[_0xc96c('0x33')],qs[_0xc96c('0x39')](_0x10ca6b[_0xc96c('0x35')][_0xc96c('0x39')]));_0x423829[_0xc96c('0x38')]=_0x423829[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x423829['attributes']:_0x2c0d0e[_0xc96c('0x33')];_0x423829['order']=qs['sort'](_0x10ca6b[_0xc96c('0x35')]['sort']);_0x423829[_0xc96c('0x3d')]=qs['filters'](_[_0xc96c('0x3e')](_0x10ca6b[_0xc96c('0x35')],_0x2c0d0e[_0xc96c('0x36')]));if(_0x10ca6b[_0xc96c('0x35')][_0xc96c('0x3f')]){_0x423829[_0xc96c('0x3d')]=_[_0xc96c('0x40')](_0x423829[_0xc96c('0x3d')],{'$or':_['map'](_0x423829[_0xc96c('0x38')],function(_0x425c03){var _0x3f0fe0={};_0x3f0fe0[_0x425c03]={'$like':'%'+_0x10ca6b[_0xc96c('0x35')][_0xc96c('0x3f')]+'%'};return _0x3f0fe0;})});}_0x423829=_[_0xc96c('0x40')]({},_0x423829,_0x10ca6b['options']);return _0x44a5ce[_0xc96c('0x4e')](_0x423829);}})[_0xc96c('0x28')](function(_0x265bba){if(_0x265bba){_0x520e5e=_0x265bba[_0xc96c('0x3a')];if(!_0x10ca6b[_0xc96c('0x35')]['hasOwnProperty'](_0xc96c('0x50'))){_0x423829[_0xc96c('0x21')]=qs['limit'](_0x10ca6b[_0xc96c('0x35')]['limit']);_0x423829[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x10ca6b[_0xc96c('0x35')][_0xc96c('0x1f')]);}return _0x44a5ce['getFields'](_0x423829);}})[_0xc96c('0x28')](function(_0x179b32){if(_0x179b32){return _0x179b32?{'count':_0x520e5e,'rows':_0x179b32}:null;}})[_0xc96c('0x28')](respondWithResult(_0x3fb73e,null))[_0xc96c('0x4b')](handleError(_0x3fb73e,null));};exports[_0xc96c('0x51')]=function(_0x3a06c7,_0x8183db,_0x242138){var _0x99dad8={};var _0x2842e3={};var _0x4db9d6;var _0x1c502a;return db[_0xc96c('0x43')]['findOne']({'where':{'id':_0x3a06c7[_0xc96c('0x47')]['id']}})['then'](handleEntityNotFound(_0x8183db,null))[_0xc96c('0x28')](function(_0x5079dc){if(_0x5079dc){_0x4db9d6=_0x5079dc;_0x2842e3[_0xc96c('0x33')]=_[_0xc96c('0x48')](db['SugarcrmField'][_0xc96c('0x2f')]);_0x2842e3[_0xc96c('0x35')]=_['keys'](_0x3a06c7[_0xc96c('0x35')]);_0x2842e3[_0xc96c('0x36')]=_[_0xc96c('0x37')](_0x2842e3[_0xc96c('0x33')],_0x2842e3[_0xc96c('0x35')]);_0x99dad8[_0xc96c('0x38')]=_['intersection'](_0x2842e3[_0xc96c('0x33')],qs[_0xc96c('0x39')](_0x3a06c7['query'][_0xc96c('0x39')]));_0x99dad8[_0xc96c('0x38')]=_0x99dad8[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x99dad8[_0xc96c('0x38')]:_0x2842e3['model'];_0x99dad8['order']=qs[_0xc96c('0x3c')](_0x3a06c7[_0xc96c('0x35')]['sort']);_0x99dad8[_0xc96c('0x3d')]=qs[_0xc96c('0x36')](_[_0xc96c('0x3e')](_0x3a06c7['query'],_0x2842e3[_0xc96c('0x36')]));if(_0x3a06c7[_0xc96c('0x35')][_0xc96c('0x3f')]){_0x99dad8['where']=_[_0xc96c('0x40')](_0x99dad8['where'],{'$or':_[_0xc96c('0x34')](_0x99dad8[_0xc96c('0x38')],function(_0x506b79){var _0x2396ad={};_0x2396ad[_0x506b79]={'$like':'%'+_0x3a06c7[_0xc96c('0x35')][_0xc96c('0x3f')]+'%'};return _0x2396ad;})});}_0x99dad8=_[_0xc96c('0x40')]({},_0x99dad8,_0x3a06c7[_0xc96c('0x42')]);return _0x4db9d6[_0xc96c('0x51')](_0x99dad8);}})[_0xc96c('0x28')](function(_0x587922){if(_0x587922){_0x1c502a=_0x587922[_0xc96c('0x3a')];if(!_0x3a06c7['query'][_0xc96c('0x3b')](_0xc96c('0x50'))){_0x99dad8['limit']=qs['limit'](_0x3a06c7[_0xc96c('0x35')][_0xc96c('0x21')]);_0x99dad8[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x3a06c7['query'][_0xc96c('0x1f')]);}return _0x4db9d6[_0xc96c('0x51')](_0x99dad8);}})[_0xc96c('0x28')](function(_0x383346){if(_0x383346){return _0x383346?{'count':_0x1c502a,'rows':_0x383346}:null;}})[_0xc96c('0x28')](respondWithResult(_0x8183db,null))[_0xc96c('0x4b')](handleError(_0x8183db,null));};exports[_0xc96c('0x52')]=function(_0x564e93,_0x4477b3,_0x875b58){var _0x4c33a8={};var _0x3fcff2={};var _0xe511c7;var _0x39bd12;return db[_0xc96c('0x43')][_0xc96c('0x53')]({'where':{'id':_0x564e93[_0xc96c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4477b3,null))[_0xc96c('0x28')](function(_0x305181){if(_0x305181){_0xe511c7=_0x305181;_0x3fcff2['model']=_[_0xc96c('0x48')](db[_0xc96c('0x4f')]['rawAttributes']);_0x3fcff2[_0xc96c('0x35')]=_[_0xc96c('0x48')](_0x564e93[_0xc96c('0x35')]);_0x3fcff2[_0xc96c('0x36')]=_[_0xc96c('0x37')](_0x3fcff2[_0xc96c('0x33')],_0x3fcff2[_0xc96c('0x35')]);_0x4c33a8[_0xc96c('0x38')]=_[_0xc96c('0x37')](_0x3fcff2[_0xc96c('0x33')],qs[_0xc96c('0x39')](_0x564e93[_0xc96c('0x35')][_0xc96c('0x39')]));_0x4c33a8[_0xc96c('0x38')]=_0x4c33a8[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x4c33a8[_0xc96c('0x38')]:_0x3fcff2[_0xc96c('0x33')];_0x4c33a8['order']=qs[_0xc96c('0x3c')](_0x564e93[_0xc96c('0x35')][_0xc96c('0x3c')]);_0x4c33a8[_0xc96c('0x3d')]=qs[_0xc96c('0x36')](_[_0xc96c('0x3e')](_0x564e93[_0xc96c('0x35')],_0x3fcff2[_0xc96c('0x36')]));if(_0x564e93[_0xc96c('0x35')][_0xc96c('0x3f')]){_0x4c33a8[_0xc96c('0x3d')]=_['merge'](_0x4c33a8['where'],{'$or':_[_0xc96c('0x34')](_0x4c33a8[_0xc96c('0x38')],function(_0x50760c){var _0x56ae44={};_0x56ae44[_0x50760c]={'$like':'%'+_0x564e93[_0xc96c('0x35')][_0xc96c('0x3f')]+'%'};return _0x56ae44;})});}_0x4c33a8=_['merge']({},_0x4c33a8,_0x564e93[_0xc96c('0x42')]);return _0xe511c7[_0xc96c('0x52')](_0x4c33a8);}})['then'](function(_0x16fd43){if(_0x16fd43){_0x39bd12=_0x16fd43['length'];if(!_0x564e93['query'][_0xc96c('0x3b')](_0xc96c('0x50'))){_0x4c33a8['limit']=qs[_0xc96c('0x21')](_0x564e93[_0xc96c('0x35')][_0xc96c('0x21')]);_0x4c33a8[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x564e93[_0xc96c('0x35')][_0xc96c('0x1f')]);}return _0xe511c7[_0xc96c('0x52')](_0x4c33a8);}})['then'](function(_0x5bd9f7){if(_0x5bd9f7){return _0x5bd9f7?{'count':_0x39bd12,'rows':_0x5bd9f7}:null;}})[_0xc96c('0x28')](respondWithResult(_0x4477b3,null))[_0xc96c('0x4b')](handleError(_0x4477b3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0235344..08e96ac 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 _0x5a61=['api','moment','path','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x4ebe31,_0x3f06f1){var _0x4900eb=function(_0x18a59a){while(--_0x18a59a){_0x4ebe31['push'](_0x4ebe31['shift']());}};_0x4900eb(++_0x3f06f1);}(_0x5a61,0xa2));var _0x15a6=function(_0x251851,_0x240ca6){_0x251851=_0x251851-0x0;var _0x3a051b=_0x5a61[_0x251851];return _0x3a051b;};'use strict';var _=require(_0x15a6('0x0'));var util=require(_0x15a6('0x1'));var logger=require(_0x15a6('0x2'))(_0x15a6('0x3'));var moment=require(_0x15a6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15a6('0x5'));var rimraf=require(_0x15a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x15a6('0x7'));module['exports']=function(_0x1bdaa3,_0x2aef36){return _0x1bdaa3[_0x15a6('0x8')](_0x15a6('0x9'),attributes,{'tableName':_0x15a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23ce=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x23ce,0xc5));var _0xe23c=function(_0x35ac1c,_0x947004){_0x35ac1c=_0x35ac1c-0x0;var _0x3ebfc4=_0x23ce[_0x35ac1c];return _0x3ebfc4;};'use strict';var _=require(_0xe23c('0x0'));var util=require(_0xe23c('0x1'));var logger=require(_0xe23c('0x2'))(_0xe23c('0x3'));var moment=require('moment');var BPromise=require(_0xe23c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe23c('0x5'));var rimraf=require(_0xe23c('0x6'));var config=require('../../config/environment');var attributes=require(_0xe23c('0x7'));module[_0xe23c('0x8')]=function(_0x2dbc09,_0x4dc602){return _0x2dbc09[_0xe23c('0x9')](_0xe23c('0xa'),attributes,{'tableName':_0xe23c('0xb'),'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 aef7c75..fa82825 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 _0xb320=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb320,0x1de));var _0x0b32=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb320[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x0b32('0x0'));var util=require(_0x0b32('0x1'));var moment=require(_0x0b32('0x2'));var BPromise=require(_0x0b32('0x3'));var rs=require(_0x0b32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b32('0x5'))['db'];var utils=require(_0x0b32('0x6'));var logger=require(_0x0b32('0x7'))(_0x0b32('0x8'));var config=require(_0x0b32('0x9'));var jayson=require(_0x0b32('0xa'));var client=jayson[_0x0b32('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b91a,_0x1c258b,_0x971384){return new BPromise(function(_0x4c1a48,_0x48903b){return client[_0x0b32('0xc')](_0x48b91a,_0x971384)[_0x0b32('0xd')](function(_0x4135c2){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1c258b,_0x0b32('0xe'));logger['debug'](_0x0b32('0xf'),_0x1c258b,'request\x20sent',JSON[_0x0b32('0x10')](_0x4135c2));if(_0x4135c2[_0x0b32('0x11')]){if(_0x4135c2[_0x0b32('0x11')][_0x0b32('0x12')]===0x1f4){logger[_0x0b32('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1c258b,_0x4135c2[_0x0b32('0x11')]['message']);return _0x48903b(_0x4135c2[_0x0b32('0x11')][_0x0b32('0x13')]);}logger[_0x0b32('0x11')](_0x0b32('0x14'),_0x1c258b,_0x4135c2[_0x0b32('0x11')]['message']);return _0x4c1a48(_0x4135c2[_0x0b32('0x11')][_0x0b32('0x13')]);}else{logger[_0x0b32('0x15')](_0x0b32('0x14'),_0x1c258b,_0x0b32('0xe'));_0x4c1a48(_0x4135c2['result'][_0x0b32('0x13')]);}})['catch'](function(_0x5ef6a1){logger[_0x0b32('0x11')](_0x0b32('0x14'),_0x1c258b,_0x5ef6a1);_0x48903b(_0x5ef6a1);});});} \ No newline at end of file +var _0xa9b5=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0xa9b5,0x147));var _0x5a9b=function(_0x39c9e8,_0x207d3){_0x39c9e8=_0x39c9e8-0x0;var _0x2d129f=_0xa9b5[_0x39c9e8];return _0x2d129f;};'use strict';var _=require('lodash');var util=require(_0x5a9b('0x0'));var moment=require(_0x5a9b('0x1'));var BPromise=require(_0x5a9b('0x2'));var rs=require(_0x5a9b('0x3'));var fs=require('fs');var Redis=require(_0x5a9b('0x4'));var db=require(_0x5a9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a9b('0x6'))(_0x5a9b('0x7'));var config=require(_0x5a9b('0x8'));var jayson=require(_0x5a9b('0x9'));var client=jayson[_0x5a9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8c91,_0x29f4ca,_0x553e09){return new BPromise(function(_0x19dafa,_0x398cd6){return client[_0x5a9b('0xb')](_0x4e8c91,_0x553e09)['then'](function(_0x43fa54){logger[_0x5a9b('0xc')](_0x5a9b('0xd'),_0x29f4ca,'request\x20sent');logger['debug'](_0x5a9b('0xe'),_0x29f4ca,_0x5a9b('0xf'),JSON[_0x5a9b('0x10')](_0x43fa54));if(_0x43fa54[_0x5a9b('0x11')]){if(_0x43fa54[_0x5a9b('0x11')][_0x5a9b('0x12')]===0x1f4){logger[_0x5a9b('0x11')](_0x5a9b('0xd'),_0x29f4ca,_0x43fa54[_0x5a9b('0x11')][_0x5a9b('0x13')]);return _0x398cd6(_0x43fa54[_0x5a9b('0x11')]['message']);}logger[_0x5a9b('0x11')](_0x5a9b('0xd'),_0x29f4ca,_0x43fa54['error'][_0x5a9b('0x13')]);return _0x19dafa(_0x43fa54['error'][_0x5a9b('0x13')]);}else{logger['info'](_0x5a9b('0xd'),_0x29f4ca,'request\x20sent');_0x19dafa(_0x43fa54[_0x5a9b('0x14')][_0x5a9b('0x13')]);}})[_0x5a9b('0x15')](function(_0x4d3115){logger[_0x5a9b('0x11')](_0x5a9b('0xd'),_0x29f4ca,_0x4d3115);_0x398cd6(_0x4d3115);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f4d4415..78a4b58 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 _0x6d5e=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy'];(function(_0x3d760c,_0x3600e1){var _0x399178=function(_0x4db7eb){while(--_0x4db7eb){_0x3d760c['push'](_0x3d760c['shift']());}};_0x399178(++_0x3600e1);}(_0x6d5e,0x110));var _0xe6d5=function(_0x2b2f58,_0x38cb7a){_0x2b2f58=_0x2b2f58-0x0;var _0x1a02bf=_0x6d5e[_0x2b2f58];return _0x1a02bf;};'use strict';var multer=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var path=require(_0xe6d5('0x2'));var timeout=require(_0xe6d5('0x3'));var express=require('express');var router=express[_0xe6d5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe6d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe6d5('0x6'));var controller=require('./intSugarcrmField.controller');router[_0xe6d5('0x7')]('/',auth[_0xe6d5('0x8')](),controller[_0xe6d5('0x9')]);router[_0xe6d5('0x7')]('/:id',auth[_0xe6d5('0x8')](),controller[_0xe6d5('0xa')]);router[_0xe6d5('0xb')]('/',auth[_0xe6d5('0x8')](),controller[_0xe6d5('0xc')]);router['put'](_0xe6d5('0xd'),auth['isAuthenticated'](),controller[_0xe6d5('0xe')]);router[_0xe6d5('0xf')](_0xe6d5('0xd'),auth['isAuthenticated'](),controller[_0xe6d5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb2cf=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x783f0f,_0x505a0e){var _0x5cf300=function(_0x3a92a0){while(--_0x3a92a0){_0x783f0f['push'](_0x783f0f['shift']());}};_0x5cf300(++_0x505a0e);}(_0xb2cf,0x77));var _0xfb2c=function(_0x1dd9b7,_0x46a489){_0x1dd9b7=_0x1dd9b7-0x0;var _0x109ae7=_0xb2cf[_0x1dd9b7];return _0x109ae7;};'use strict';var multer=require(_0xfb2c('0x0'));var util=require(_0xfb2c('0x1'));var path=require(_0xfb2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb2c('0x3'));var router=express[_0xfb2c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfb2c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2c('0x6'));var controller=require(_0xfb2c('0x7'));router[_0xfb2c('0x8')]('/',auth[_0xfb2c('0x9')](),controller[_0xfb2c('0xa')]);router[_0xfb2c('0x8')](_0xfb2c('0xb'),auth[_0xfb2c('0x9')](),controller[_0xfb2c('0xc')]);router['post']('/',auth[_0xfb2c('0x9')](),controller[_0xfb2c('0xd')]);router[_0xfb2c('0xe')](_0xfb2c('0xb'),auth['isAuthenticated'](),controller[_0xfb2c('0xf')]);router[_0xfb2c('0x10')](_0xfb2c('0xb'),auth['isAuthenticated'](),controller[_0xfb2c('0x11')]);module[_0xfb2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index abcbf2c..d3d2d99 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 _0x88fa=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x88fa,0x1a6));var _0xa88f=function(_0x4e2806,_0x29bddf){_0x4e2806=_0x4e2806-0x0;var _0xd5a5a1=_0x88fa[_0x4e2806];return _0xd5a5a1;};'use strict';var Sequelize=require(_0xa88f('0x0'));module[_0xa88f('0x1')]={'type':{'type':Sequelize[_0xa88f('0x2')]('string',_0xa88f('0x3'),_0xa88f('0x4'),_0xa88f('0x5'),_0xa88f('0x6')),'defaultValue':_0xa88f('0x7')},'content':{'type':Sequelize[_0xa88f('0x8')]},'key':{'type':Sequelize[_0xa88f('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa88f('0x3'),_0xa88f('0x4'))},'keyContent':{'type':Sequelize[_0xa88f('0x8')]},'idField':{'type':Sequelize[_0xa88f('0x8')]},'nameField':{'type':Sequelize[_0xa88f('0x8')]},'customField':{'type':Sequelize[_0xa88f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa88f('0x8')]}}; \ No newline at end of file +var _0x8198=['variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x301032,_0x59b0d6){var _0x31860b=function(_0x6af455){while(--_0x6af455){_0x301032['push'](_0x301032['shift']());}};_0x31860b(++_0x59b0d6);}(_0x8198,0x139));var _0x8819=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x8198[_0x43d701];return _0x2ec4c6;};'use strict';var Sequelize=require(_0x8819('0x0'));module[_0x8819('0x1')]={'type':{'type':Sequelize[_0x8819('0x2')](_0x8819('0x3'),'variable','customVariable',_0x8819('0x4'),_0x8819('0x5')),'defaultValue':_0x8819('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8819('0x6')]},'keyType':{'type':Sequelize[_0x8819('0x2')](_0x8819('0x3'),_0x8819('0x7'),_0x8819('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8819('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8819('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0d56032..51b34dd 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 _0x62fe=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','name','index','map','SugarcrmField','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','findAll','rows','show','params','keys','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x62fe,0x15b));var _0xe62f=function(_0x379dc0,_0x48ca90){_0x379dc0=_0x379dc0-0x0;var _0x56ce84=_0x62fe[_0x379dc0];return _0x56ce84;};'use strict';var emlformat=require(_0xe62f('0x0'));var rimraf=require(_0xe62f('0x1'));var zipdir=require(_0xe62f('0x2'));var jsonpatch=require(_0xe62f('0x3'));var rp=require(_0xe62f('0x4'));var moment=require('moment');var BPromise=require(_0xe62f('0x5'));var Mustache=require(_0xe62f('0x6'));var util=require(_0xe62f('0x7'));var path=require('path');var sox=require(_0xe62f('0x8'));var csv=require(_0xe62f('0x9'));var ejs=require(_0xe62f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe62f('0xb'));var squel=require(_0xe62f('0xc'));var crypto=require(_0xe62f('0xd'));var jsforce=require(_0xe62f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe62f('0x9'));var querystring=require(_0xe62f('0xf'));var Papa=require(_0xe62f('0x10'));var Redis=require(_0xe62f('0x11'));var authService=require(_0xe62f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe62f('0x13'));var hardwareService=require(_0xe62f('0x14'));var logger=require(_0xe62f('0x15'))('api');var utils=require(_0xe62f('0x16'));var config=require(_0xe62f('0x17'));var licenseUtil=require(_0xe62f('0x18'));var db=require(_0xe62f('0x19'))['db'];function respondWithStatusCode(_0x3eab20,_0x342ab5){_0x342ab5=_0x342ab5||0xcc;return function(_0x4cd567){if(_0x4cd567){return _0x3eab20[_0xe62f('0x1a')](_0x342ab5);}return _0x3eab20[_0xe62f('0x1b')](_0x342ab5)['end']();};}function respondWithResult(_0x4b0c95,_0x21e69f){_0x21e69f=_0x21e69f||0xc8;return function(_0xa2721){if(_0xa2721){return _0x4b0c95[_0xe62f('0x1b')](_0x21e69f)[_0xe62f('0x1c')](_0xa2721);}};}function respondWithFilteredResult(_0x369cb5,_0x31a2cf){return function(_0x4ca802){if(_0x4ca802){var _0x4e4a08=typeof _0x31a2cf[_0xe62f('0x1d')]===_0xe62f('0x1e')&&typeof _0x31a2cf[_0xe62f('0x1f')]===_0xe62f('0x1e');var _0xc079cf=_0x4ca802[_0xe62f('0x20')];var _0x31cb5e=_0x4e4a08?0x0:_0x31a2cf['offset'];var _0x38f5b6=_0x4e4a08?_0x4ca802[_0xe62f('0x20')]:_0x31a2cf['offset']+_0x31a2cf[_0xe62f('0x1f')];var _0x556a5d;if(_0x38f5b6>=_0xc079cf){_0x38f5b6=_0xc079cf;_0x556a5d=0xc8;}else{_0x556a5d=0xce;}_0x369cb5[_0xe62f('0x1b')](_0x556a5d);return _0x369cb5[_0xe62f('0x21')](_0xe62f('0x22'),_0x31cb5e+'-'+_0x38f5b6+'/'+_0xc079cf)[_0xe62f('0x1c')](_0x4ca802);}return null;};}function patchUpdates(_0xb659c2){return function(_0x2deac9){try{jsonpatch['apply'](_0x2deac9,_0xb659c2,!![]);}catch(_0x20d88c){return BPromise['reject'](_0x20d88c);}return _0x2deac9[_0xe62f('0x23')]();};}function saveUpdates(_0x112c97,_0x4b04b1){return function(_0x40337e){if(_0x40337e){return _0x40337e[_0xe62f('0x24')](_0x112c97)[_0xe62f('0x25')](function(_0xa3bf1a){return _0xa3bf1a;});}return null;};}function removeEntity(_0x3c7737,_0x589a92){return function(_0x3a950c){if(_0x3a950c){return _0x3a950c[_0xe62f('0x26')]()['then'](function(){_0x3c7737[_0xe62f('0x1b')](0xcc)[_0xe62f('0x27')]();});}};}function handleEntityNotFound(_0x299214,_0x5122de){return function(_0x269359){if(!_0x269359){_0x299214['sendStatus'](0x194);}return _0x269359;};}function handleError(_0x24eb78,_0x11f7f2){_0x11f7f2=_0x11f7f2||0x1f4;return function(_0x33ac5d){logger[_0xe62f('0x28')](_0x33ac5d['stack']);if(_0x33ac5d['name']){delete _0x33ac5d[_0xe62f('0x29')];}_0x24eb78[_0xe62f('0x1b')](_0x11f7f2)['send'](_0x33ac5d);};}exports[_0xe62f('0x2a')]=function(_0x31645e,_0x2e4ca0){var _0x244781={},_0x118517={},_0x5e8ec8={'count':0x0,'rows':[]};var _0x4f65c7=_[_0xe62f('0x2b')](db[_0xe62f('0x2c')]['rawAttributes'],function(_0x1ce3d8){return{'name':_0x1ce3d8[_0xe62f('0x2d')],'type':_0x1ce3d8[_0xe62f('0x2e')][_0xe62f('0x2f')]};});_0x118517['model']=_[_0xe62f('0x2b')](_0x4f65c7,_0xe62f('0x29'));_0x118517[_0xe62f('0x30')]=_['keys'](_0x31645e[_0xe62f('0x30')]);_0x118517[_0xe62f('0x31')]=_[_0xe62f('0x32')](_0x118517[_0xe62f('0x33')],_0x118517[_0xe62f('0x30')]);_0x244781['attributes']=_[_0xe62f('0x32')](_0x118517['model'],qs[_0xe62f('0x34')](_0x31645e[_0xe62f('0x30')][_0xe62f('0x34')]));_0x244781[_0xe62f('0x35')]=_0x244781['attributes'][_0xe62f('0x36')]?_0x244781[_0xe62f('0x35')]:_0x118517[_0xe62f('0x33')];if(!_0x31645e['query'][_0xe62f('0x37')]('nolimit')){_0x244781[_0xe62f('0x1f')]=qs[_0xe62f('0x1f')](_0x31645e[_0xe62f('0x30')][_0xe62f('0x1f')]);_0x244781[_0xe62f('0x1d')]=qs[_0xe62f('0x1d')](_0x31645e[_0xe62f('0x30')][_0xe62f('0x1d')]);}_0x244781[_0xe62f('0x38')]=qs[_0xe62f('0x39')](_0x31645e[_0xe62f('0x30')][_0xe62f('0x39')]);_0x244781['where']=qs[_0xe62f('0x31')](_[_0xe62f('0x3a')](_0x31645e[_0xe62f('0x30')],_0x118517['filters']),_0x4f65c7);if(_0x31645e['query'][_0xe62f('0x3b')]){_0x244781[_0xe62f('0x3c')]=_[_0xe62f('0x3d')](_0x244781[_0xe62f('0x3c')],{'$or':_['map'](_0x4f65c7,function(_0x45c601){if(_0x45c601[_0xe62f('0x2e')]!=='VIRTUAL'){var _0x27adba={};_0x27adba[_0x45c601[_0xe62f('0x29')]]={'$like':'%'+_0x31645e[_0xe62f('0x30')][_0xe62f('0x3b')]+'%'};return _0x27adba;}})});}_0x244781=_['merge']({},_0x244781,_0x31645e[_0xe62f('0x3e')]);var _0x314039={'where':_0x244781['where']};return db[_0xe62f('0x2c')][_0xe62f('0x20')](_0x314039)[_0xe62f('0x25')](function(_0x45d9a0){_0x5e8ec8[_0xe62f('0x20')]=_0x45d9a0;if(_0x31645e[_0xe62f('0x30')]['includeAll']){_0x244781['include']=[{'all':!![]}];}return db[_0xe62f('0x2c')][_0xe62f('0x3f')](_0x244781);})[_0xe62f('0x25')](function(_0x2b4051){_0x5e8ec8[_0xe62f('0x40')]=_0x2b4051;return _0x5e8ec8;})['then'](respondWithFilteredResult(_0x2e4ca0,_0x244781))['catch'](handleError(_0x2e4ca0,null));};exports[_0xe62f('0x41')]=function(_0x3d7059,_0x3b7f3a){var _0x519fbe={'raw':!![],'where':{'id':_0x3d7059[_0xe62f('0x42')]['id']}},_0x3d7acd={};_0x3d7acd['model']=_[_0xe62f('0x43')](db[_0xe62f('0x2c')]['rawAttributes']);_0x3d7acd[_0xe62f('0x30')]=_[_0xe62f('0x43')](_0x3d7059[_0xe62f('0x30')]);_0x3d7acd[_0xe62f('0x31')]=_[_0xe62f('0x32')](_0x3d7acd['model'],_0x3d7acd[_0xe62f('0x30')]);_0x519fbe[_0xe62f('0x35')]=_[_0xe62f('0x32')](_0x3d7acd[_0xe62f('0x33')],qs[_0xe62f('0x34')](_0x3d7059[_0xe62f('0x30')][_0xe62f('0x34')]));_0x519fbe['attributes']=_0x519fbe[_0xe62f('0x35')][_0xe62f('0x36')]?_0x519fbe['attributes']:_0x3d7acd['model'];if(_0x3d7059[_0xe62f('0x30')][_0xe62f('0x44')]){_0x519fbe['include']=[{'all':!![]}];}_0x519fbe=_[_0xe62f('0x3d')]({},_0x519fbe,_0x3d7059[_0xe62f('0x3e')]);return db[_0xe62f('0x2c')]['find'](_0x519fbe)[_0xe62f('0x25')](handleEntityNotFound(_0x3b7f3a,null))['then'](respondWithResult(_0x3b7f3a,null))[_0xe62f('0x45')](handleError(_0x3b7f3a,null));};exports[_0xe62f('0x46')]=function(_0x44afc6,_0x351c58){return db[_0xe62f('0x2c')][_0xe62f('0x46')](_0x44afc6['body'],{})[_0xe62f('0x25')](respondWithResult(_0x351c58,0xc9))[_0xe62f('0x45')](handleError(_0x351c58,null));};exports[_0xe62f('0x24')]=function(_0x52639a,_0x5ae608){if(_0x52639a[_0xe62f('0x47')]['id']){delete _0x52639a[_0xe62f('0x47')]['id'];}return db[_0xe62f('0x2c')]['find']({'where':{'id':_0x52639a[_0xe62f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ae608,null))['then'](saveUpdates(_0x52639a[_0xe62f('0x47')],null))[_0xe62f('0x25')](respondWithResult(_0x5ae608,null))[_0xe62f('0x45')](handleError(_0x5ae608,null));};exports[_0xe62f('0x26')]=function(_0x60674b,_0xbe5e37){return db[_0xe62f('0x2c')][_0xe62f('0x48')]({'where':{'id':_0x60674b['params']['id']}})[_0xe62f('0x25')](handleEntityNotFound(_0xbe5e37,null))[_0xe62f('0x25')](removeEntity(_0xbe5e37,null))[_0xe62f('0x45')](handleError(_0xbe5e37,null));}; \ No newline at end of file +var _0xe10c=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','update','destroy','then','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x3beb42,_0x387a06){var _0x3b5602=function(_0x2d5433){while(--_0x2d5433){_0x3beb42['push'](_0x3beb42['shift']());}};_0x3b5602(++_0x387a06);}(_0xe10c,0x1c8));var _0xce10=function(_0x5eb9cb,_0x3f4b85){_0x5eb9cb=_0x5eb9cb-0x0;var _0x4b54fe=_0xe10c[_0x5eb9cb];return _0x4b54fe;};'use strict';var emlformat=require(_0xce10('0x0'));var rimraf=require(_0xce10('0x1'));var zipdir=require(_0xce10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce10('0x3'));var moment=require(_0xce10('0x4'));var BPromise=require(_0xce10('0x5'));var Mustache=require(_0xce10('0x6'));var util=require(_0xce10('0x7'));var path=require(_0xce10('0x8'));var sox=require('sox');var csv=require(_0xce10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce10('0xa'));var _=require(_0xce10('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce10('0xc'));var toCsv=require(_0xce10('0x9'));var querystring=require('querystring');var Papa=require(_0xce10('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce10('0xe'));var as=require(_0xce10('0xf'));var hardwareService=require(_0xce10('0x10'));var logger=require(_0xce10('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xce10('0x12'));var licenseUtil=require(_0xce10('0x13'));var db=require(_0xce10('0x14'))['db'];function respondWithStatusCode(_0x14f3f4,_0x442fb5){_0x442fb5=_0x442fb5||0xcc;return function(_0x2966a1){if(_0x2966a1){return _0x14f3f4[_0xce10('0x15')](_0x442fb5);}return _0x14f3f4['status'](_0x442fb5)[_0xce10('0x16')]();};}function respondWithResult(_0x575d35,_0x161e8e){_0x161e8e=_0x161e8e||0xc8;return function(_0x768828){if(_0x768828){return _0x575d35['status'](_0x161e8e)[_0xce10('0x17')](_0x768828);}};}function respondWithFilteredResult(_0xc0b52b,_0x4cf571){return function(_0x3ff948){if(_0x3ff948){var _0x582354=typeof _0x4cf571[_0xce10('0x18')]===_0xce10('0x19')&&typeof _0x4cf571[_0xce10('0x1a')]===_0xce10('0x19');var _0x3d6115=_0x3ff948[_0xce10('0x1b')];var _0x278f32=_0x582354?0x0:_0x4cf571[_0xce10('0x18')];var _0x559c6c=_0x582354?_0x3ff948['count']:_0x4cf571[_0xce10('0x18')]+_0x4cf571['limit'];var _0x22ce6d;if(_0x559c6c>=_0x3d6115){_0x559c6c=_0x3d6115;_0x22ce6d=0xc8;}else{_0x22ce6d=0xce;}_0xc0b52b[_0xce10('0x1c')](_0x22ce6d);return _0xc0b52b[_0xce10('0x1d')]('Content-Range',_0x278f32+'-'+_0x559c6c+'/'+_0x3d6115)[_0xce10('0x17')](_0x3ff948);}return null;};}function patchUpdates(_0x7dc530){return function(_0x229e69){try{jsonpatch['apply'](_0x229e69,_0x7dc530,!![]);}catch(_0x4bab81){return BPromise['reject'](_0x4bab81);}return _0x229e69['save']();};}function saveUpdates(_0x3f3a63,_0x47fee4){return function(_0x2e2e86){if(_0x2e2e86){return _0x2e2e86[_0xce10('0x1e')](_0x3f3a63)['then'](function(_0x2a05cd){return _0x2a05cd;});}return null;};}function removeEntity(_0xa5e2f4,_0x256f3f){return function(_0x22cfd9){if(_0x22cfd9){return _0x22cfd9[_0xce10('0x1f')]()[_0xce10('0x20')](function(){_0xa5e2f4['status'](0xcc)[_0xce10('0x16')]();});}};}function handleEntityNotFound(_0x15998d,_0x2aa4b5){return function(_0x38ba40){if(!_0x38ba40){_0x15998d[_0xce10('0x15')](0x194);}return _0x38ba40;};}function handleError(_0x4d4cf7,_0x2a00cc){_0x2a00cc=_0x2a00cc||0x1f4;return function(_0x1e59bd){logger[_0xce10('0x21')](_0x1e59bd[_0xce10('0x22')]);if(_0x1e59bd[_0xce10('0x23')]){delete _0x1e59bd[_0xce10('0x23')];}_0x4d4cf7[_0xce10('0x1c')](_0x2a00cc)['send'](_0x1e59bd);};}exports[_0xce10('0x24')]=function(_0x28f841,_0x4473fe){var _0x32c0cc={},_0x84056d={},_0x189c89={'count':0x0,'rows':[]};var _0x2ff841=_[_0xce10('0x25')](db[_0xce10('0x26')][_0xce10('0x27')],function(_0x13c679){return{'name':_0x13c679[_0xce10('0x28')],'type':_0x13c679[_0xce10('0x29')][_0xce10('0x2a')]};});_0x84056d['model']=_[_0xce10('0x25')](_0x2ff841,_0xce10('0x23'));_0x84056d[_0xce10('0x2b')]=_[_0xce10('0x2c')](_0x28f841['query']);_0x84056d[_0xce10('0x2d')]=_[_0xce10('0x2e')](_0x84056d[_0xce10('0x2f')],_0x84056d[_0xce10('0x2b')]);_0x32c0cc[_0xce10('0x30')]=_['intersection'](_0x84056d['model'],qs[_0xce10('0x31')](_0x28f841['query'][_0xce10('0x31')]));_0x32c0cc[_0xce10('0x30')]=_0x32c0cc[_0xce10('0x30')][_0xce10('0x32')]?_0x32c0cc[_0xce10('0x30')]:_0x84056d['model'];if(!_0x28f841[_0xce10('0x2b')][_0xce10('0x33')](_0xce10('0x34'))){_0x32c0cc[_0xce10('0x1a')]=qs[_0xce10('0x1a')](_0x28f841['query'][_0xce10('0x1a')]);_0x32c0cc[_0xce10('0x18')]=qs[_0xce10('0x18')](_0x28f841[_0xce10('0x2b')][_0xce10('0x18')]);}_0x32c0cc['order']=qs[_0xce10('0x35')](_0x28f841['query'][_0xce10('0x35')]);_0x32c0cc[_0xce10('0x36')]=qs[_0xce10('0x2d')](_['pick'](_0x28f841[_0xce10('0x2b')],_0x84056d[_0xce10('0x2d')]),_0x2ff841);if(_0x28f841[_0xce10('0x2b')][_0xce10('0x37')]){_0x32c0cc['where']=_[_0xce10('0x38')](_0x32c0cc[_0xce10('0x36')],{'$or':_[_0xce10('0x25')](_0x2ff841,function(_0x4de29f){if(_0x4de29f[_0xce10('0x29')]!==_0xce10('0x39')){var _0x5a8541={};_0x5a8541[_0x4de29f['name']]={'$like':'%'+_0x28f841['query'][_0xce10('0x37')]+'%'};return _0x5a8541;}})});}_0x32c0cc=_[_0xce10('0x38')]({},_0x32c0cc,_0x28f841['options']);var _0x5265d4={'where':_0x32c0cc[_0xce10('0x36')]};return db[_0xce10('0x26')]['count'](_0x5265d4)['then'](function(_0x229fb1){_0x189c89[_0xce10('0x1b')]=_0x229fb1;if(_0x28f841['query'][_0xce10('0x3a')]){_0x32c0cc['include']=[{'all':!![]}];}return db[_0xce10('0x26')][_0xce10('0x3b')](_0x32c0cc);})[_0xce10('0x20')](function(_0x17b9b9){_0x189c89[_0xce10('0x3c')]=_0x17b9b9;return _0x189c89;})[_0xce10('0x20')](respondWithFilteredResult(_0x4473fe,_0x32c0cc))[_0xce10('0x3d')](handleError(_0x4473fe,null));};exports['show']=function(_0x183fb3,_0x5a1314){var _0x22b58f={'raw':!![],'where':{'id':_0x183fb3[_0xce10('0x3e')]['id']}},_0x567195={};_0x567195[_0xce10('0x2f')]=_[_0xce10('0x2c')](db['SugarcrmField'][_0xce10('0x27')]);_0x567195[_0xce10('0x2b')]=_[_0xce10('0x2c')](_0x183fb3[_0xce10('0x2b')]);_0x567195[_0xce10('0x2d')]=_['intersection'](_0x567195[_0xce10('0x2f')],_0x567195[_0xce10('0x2b')]);_0x22b58f['attributes']=_[_0xce10('0x2e')](_0x567195[_0xce10('0x2f')],qs[_0xce10('0x31')](_0x183fb3['query'][_0xce10('0x31')]));_0x22b58f['attributes']=_0x22b58f[_0xce10('0x30')][_0xce10('0x32')]?_0x22b58f['attributes']:_0x567195[_0xce10('0x2f')];if(_0x183fb3[_0xce10('0x2b')][_0xce10('0x3a')]){_0x22b58f[_0xce10('0x3f')]=[{'all':!![]}];}_0x22b58f=_[_0xce10('0x38')]({},_0x22b58f,_0x183fb3[_0xce10('0x40')]);return db['SugarcrmField'][_0xce10('0x41')](_0x22b58f)[_0xce10('0x20')](handleEntityNotFound(_0x5a1314,null))[_0xce10('0x20')](respondWithResult(_0x5a1314,null))[_0xce10('0x3d')](handleError(_0x5a1314,null));};exports[_0xce10('0x42')]=function(_0xb537a5,_0x6208c1){return db[_0xce10('0x26')][_0xce10('0x42')](_0xb537a5[_0xce10('0x43')],{})[_0xce10('0x20')](respondWithResult(_0x6208c1,0xc9))['catch'](handleError(_0x6208c1,null));};exports['update']=function(_0xfac972,_0x2e0916){if(_0xfac972[_0xce10('0x43')]['id']){delete _0xfac972[_0xce10('0x43')]['id'];}return db[_0xce10('0x26')][_0xce10('0x41')]({'where':{'id':_0xfac972[_0xce10('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2e0916,null))['then'](saveUpdates(_0xfac972[_0xce10('0x43')],null))[_0xce10('0x20')](respondWithResult(_0x2e0916,null))['catch'](handleError(_0x2e0916,null));};exports[_0xce10('0x1f')]=function(_0x5d53be,_0x1aaf16){return db['SugarcrmField']['find']({'where':{'id':_0x5d53be[_0xce10('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1aaf16,null))[_0xce10('0x20')](removeEntity(_0x1aaf16,null))[_0xce10('0x3d')](handleError(_0x1aaf16,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bab31de..18c2660 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 _0x0aee=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x4ded16,_0x23fcbf){var _0x4a525a=function(_0x2c6b5e){while(--_0x2c6b5e){_0x4ded16['push'](_0x4ded16['shift']());}};_0x4a525a(++_0x23fcbf);}(_0x0aee,0xdb));var _0xe0ae=function(_0x1bbb96,_0x5b689f){_0x1bbb96=_0x1bbb96-0x0;var _0x3c622d=_0x0aee[_0x1bbb96];return _0x3c622d;};'use strict';var _=require(_0xe0ae('0x0'));var util=require(_0xe0ae('0x1'));var logger=require(_0xe0ae('0x2'))(_0xe0ae('0x3'));var moment=require(_0xe0ae('0x4'));var BPromise=require(_0xe0ae('0x5'));var rp=require(_0xe0ae('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe0ae('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x13d50,_0x4bd9dd){return _0x13d50['define'](_0xe0ae('0x8'),attributes,{'tableName':_0xe0ae('0x9'),'paranoid':![],'indexes':[{'name':_0xe0ae('0xa'),'fields':[_0xe0ae('0xb'),_0xe0ae('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x512f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x512f,0xed));var _0xf512=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0x512f[_0x83c716];return _0xab9893;};'use strict';var _=require('lodash');var util=require(_0xf512('0x0'));var logger=require(_0xf512('0x1'))(_0xf512('0x2'));var moment=require(_0xf512('0x3'));var BPromise=require(_0xf512('0x4'));var rp=require(_0xf512('0x5'));var fs=require('fs');var path=require(_0xf512('0x6'));var rimraf=require(_0xf512('0x7'));var config=require(_0xf512('0x8'));var attributes=require(_0xf512('0x9'));module[_0xf512('0xa')]=function(_0x17424d,_0x1b0115){return _0x17424d[_0xf512('0xb')]('SugarcrmField',attributes,{'tableName':_0xf512('0xc'),'paranoid':![],'indexes':[{'name':_0xf512('0xd'),'fields':[_0xf512('0xe'),_0xf512('0xf')],'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 0e83138..bf867d0 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 _0xa7a5=['jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4f84c3,_0x6d094d){var _0x460f9f=function(_0x5af5bd){while(--_0x5af5bd){_0x4f84c3['push'](_0x4f84c3['shift']());}};_0x460f9f(++_0x6d094d);}(_0xa7a5,0x199));var _0x5a7a=function(_0x328020,_0x2ed9ee){_0x328020=_0x328020-0x0;var _0x10873d=_0xa7a5[_0x328020];return _0x10873d;};'use strict';var _=require(_0x5a7a('0x0'));var util=require(_0x5a7a('0x1'));var moment=require(_0x5a7a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a7a('0x3'));var db=require(_0x5a7a('0x4'))['db'];var utils=require(_0x5a7a('0x5'));var logger=require(_0x5a7a('0x6'))(_0x5a7a('0x7'));var config=require(_0x5a7a('0x8'));var jayson=require(_0x5a7a('0x9'));var client=jayson['client'][_0x5a7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59593c,_0x3830aa,_0xe8a9cd){return new BPromise(function(_0x134b19,_0x3c8264){return client['request'](_0x59593c,_0xe8a9cd)['then'](function(_0x1580dd){logger[_0x5a7a('0xb')](_0x5a7a('0xc'),_0x3830aa,'request\x20sent');logger['debug'](_0x5a7a('0xd'),_0x3830aa,'request\x20sent',JSON[_0x5a7a('0xe')](_0x1580dd));if(_0x1580dd[_0x5a7a('0xf')]){if(_0x1580dd['error']['code']===0x1f4){logger[_0x5a7a('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x3830aa,_0x1580dd[_0x5a7a('0xf')][_0x5a7a('0x10')]);return _0x3c8264(_0x1580dd['error'][_0x5a7a('0x10')]);}logger['error'](_0x5a7a('0xc'),_0x3830aa,_0x1580dd[_0x5a7a('0xf')][_0x5a7a('0x10')]);return _0x134b19(_0x1580dd[_0x5a7a('0xf')]['message']);}else{logger[_0x5a7a('0xb')](_0x5a7a('0xc'),_0x3830aa,_0x5a7a('0x11'));_0x134b19(_0x1580dd[_0x5a7a('0x12')]['message']);}})['catch'](function(_0x292b88){logger[_0x5a7a('0xf')](_0x5a7a('0xc'),_0x3830aa,_0x292b88);_0x3c8264(_0x292b88);});});} \ No newline at end of file +var _0xacc6=['request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x5c2bef,_0x16806e){var _0xd60cc1=function(_0x40e74a){while(--_0x40e74a){_0x5c2bef['push'](_0x5c2bef['shift']());}};_0xd60cc1(++_0x16806e);}(_0xacc6,0x169));var _0x6acc=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xacc6[_0xa9eaa0];return _0x30897a;};'use strict';var _=require('lodash');var util=require(_0x6acc('0x0'));var moment=require('moment');var BPromise=require(_0x6acc('0x1'));var rs=require(_0x6acc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6acc('0x3'))['db'];var utils=require(_0x6acc('0x4'));var logger=require(_0x6acc('0x5'))(_0x6acc('0x6'));var config=require(_0x6acc('0x7'));var jayson=require(_0x6acc('0x8'));var client=jayson[_0x6acc('0x9')][_0x6acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53ccdf,_0x4cf45a,_0x4672b6){return new BPromise(function(_0x3c314e,_0x48eaee){return client['request'](_0x53ccdf,_0x4672b6)[_0x6acc('0xb')](function(_0x2590d7){logger[_0x6acc('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x4cf45a,_0x6acc('0xd'));logger[_0x6acc('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4cf45a,_0x6acc('0xd'),JSON[_0x6acc('0xf')](_0x2590d7));if(_0x2590d7[_0x6acc('0x10')]){if(_0x2590d7[_0x6acc('0x10')][_0x6acc('0x11')]===0x1f4){logger[_0x6acc('0x10')](_0x6acc('0x12'),_0x4cf45a,_0x2590d7[_0x6acc('0x10')][_0x6acc('0x13')]);return _0x48eaee(_0x2590d7[_0x6acc('0x10')][_0x6acc('0x13')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4cf45a,_0x2590d7[_0x6acc('0x10')][_0x6acc('0x13')]);return _0x3c314e(_0x2590d7[_0x6acc('0x10')][_0x6acc('0x13')]);}else{logger['info'](_0x6acc('0x12'),_0x4cf45a,_0x6acc('0xd'));_0x3c314e(_0x2590d7[_0x6acc('0x14')][_0x6acc('0x13')]);}})[_0x6acc('0x15')](function(_0x1636e0){logger['error'](_0x6acc('0x12'),_0x4cf45a,_0x1636e0);_0x48eaee(_0x1636e0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7aa27b6..0d4ecb5 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 _0xad68=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x297691,_0x1bcaa8){var _0x475f66=function(_0x788cba){while(--_0x788cba){_0x297691['push'](_0x297691['shift']());}};_0x475f66(++_0x1bcaa8);}(_0xad68,0x102));var _0x8ad6=function(_0x208b7a,_0x2e3baa){_0x208b7a=_0x208b7a-0x0;var _0x37b7ec=_0xad68[_0x208b7a];return _0x37b7ec;};'use strict';var multer=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var path=require(_0x8ad6('0x2'));var timeout=require(_0x8ad6('0x3'));var express=require('express');var router=express[_0x8ad6('0x4')]();var fs_extra=require(_0x8ad6('0x5'));var auth=require(_0x8ad6('0x6'));var interaction=require(_0x8ad6('0x7'));var config=require(_0x8ad6('0x8'));var controller=require(_0x8ad6('0x9'));router[_0x8ad6('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ad6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8ad6('0xc')]);router[_0x8ad6('0xa')](_0x8ad6('0xd'),auth[_0x8ad6('0xe')](),controller[_0x8ad6('0xf')]);router[_0x8ad6('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8ad6('0x10')]);router[_0x8ad6('0x11')]('/',auth['isAuthenticated'](),controller[_0x8ad6('0x12')]);router[_0x8ad6('0x11')](_0x8ad6('0xd'),auth['isAuthenticated'](),controller[_0x8ad6('0x13')]);router[_0x8ad6('0x14')]('/:id',auth[_0x8ad6('0xe')](),controller[_0x8ad6('0x15')]);router[_0x8ad6('0x16')](_0x8ad6('0x17'),auth[_0x8ad6('0xe')](),controller[_0x8ad6('0x18')]);module[_0x8ad6('0x19')]=router; \ No newline at end of file +var _0x3cb3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerAccount.controller','index','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x365307,_0x7c01e){var _0x583503=function(_0x3c13f9){while(--_0x3c13f9){_0x365307['push'](_0x365307['shift']());}};_0x583503(++_0x7c01e);}(_0x3cb3,0x156));var _0x33cb=function(_0x3da87c,_0x1e464d){_0x3da87c=_0x3da87c-0x0;var _0x468ad8=_0x3cb3[_0x3da87c];return _0x468ad8;};'use strict';var multer=require(_0x33cb('0x0'));var util=require(_0x33cb('0x1'));var path=require(_0x33cb('0x2'));var timeout=require(_0x33cb('0x3'));var express=require(_0x33cb('0x4'));var router=express[_0x33cb('0x5')]();var fs_extra=require(_0x33cb('0x6'));var auth=require(_0x33cb('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x33cb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x33cb('0x9')]);router[_0x33cb('0xa')]('/:id',auth[_0x33cb('0xb')](),controller['show']);router[_0x33cb('0xa')](_0x33cb('0xc'),auth[_0x33cb('0xb')](),controller['getConfigurations']);router[_0x33cb('0xa')](_0x33cb('0xd'),auth['isAuthenticated'](),controller[_0x33cb('0xe')]);router[_0x33cb('0xf')]('/',auth[_0x33cb('0xb')](),controller[_0x33cb('0x10')]);router[_0x33cb('0xf')](_0x33cb('0xc'),auth['isAuthenticated'](),controller[_0x33cb('0x11')]);router[_0x33cb('0x12')](_0x33cb('0x13'),auth['isAuthenticated'](),controller[_0x33cb('0x14')]);router[_0x33cb('0x15')](_0x33cb('0x13'),auth['isAuthenticated'](),controller[_0x33cb('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9d494b1..f37c2bd 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 _0x1bde=['exports','STRING','HelpDesk'];(function(_0x1890a8,_0x42a2b2){var _0x420c6d=function(_0x2baa82){while(--_0x2baa82){_0x1890a8['push'](_0x1890a8['shift']());}};_0x420c6d(++_0x42a2b2);}(_0x1bde,0x186));var _0xe1bd=function(_0x23dc29,_0x4127b3){_0x23dc29=_0x23dc29-0x0;var _0x5a79bb=_0x1bde[_0x23dc29];return _0x5a79bb;};'use strict';var Sequelize=require('sequelize');module[_0xe1bd('0x0')]={'name':{'type':Sequelize[_0xe1bd('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe1bd('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe1bd('0x1')],'allowNull':![],'defaultValue':_0xe1bd('0x2')},'remoteUri':{'type':Sequelize[_0xe1bd('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe1bd('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe1bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb96a=['sequelize','STRING'];(function(_0x453536,_0x46622b){var _0x252fb0=function(_0x14e766){while(--_0x14e766){_0x453536['push'](_0x453536['shift']());}};_0x252fb0(++_0x46622b);}(_0xb96a,0x1bc));var _0xab96=function(_0x57384c,_0x4f8748){_0x57384c=_0x57384c-0x0;var _0x3df6a8=_0xb96a[_0x57384c];return _0x3df6a8;};'use strict';var Sequelize=require(_0xab96('0x0'));module['exports']={'name':{'type':Sequelize[_0xab96('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xab96('0x1')]},'username':{'type':Sequelize[_0xab96('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xab96('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xab96('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 5ca2263..268b647 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 _0xe3f6=['catch','show','params','includeAll','find','create','body','update','destroy','pick','hasOwnProperty','getConfigurations','findOne','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','GET','getchallenge','success','login','token','describe','result','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','limit','set','apply','reject','save','then','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0xeb9d93,_0x11a816){var _0xcdfcce=function(_0x3c71fa){while(--_0x3c71fa){_0xeb9d93['push'](_0xeb9d93['shift']());}};_0xcdfcce(++_0x11a816);}(_0xe3f6,0x1aa));var _0x6e3f=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xe3f6[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0x6e3f('0x0'));var rimraf=require(_0x6e3f('0x1'));var zipdir=require(_0x6e3f('0x2'));var jsonpatch=require(_0x6e3f('0x3'));var rp=require(_0x6e3f('0x4'));var moment=require(_0x6e3f('0x5'));var BPromise=require(_0x6e3f('0x6'));var Mustache=require('mustache');var util=require(_0x6e3f('0x7'));var path=require(_0x6e3f('0x8'));var sox=require(_0x6e3f('0x9'));var csv=require(_0x6e3f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e3f('0xb'));var _=require(_0x6e3f('0xc'));var squel=require(_0x6e3f('0xd'));var crypto=require(_0x6e3f('0xe'));var jsforce=require(_0x6e3f('0xf'));var deskjs=require(_0x6e3f('0x10'));var toCsv=require(_0x6e3f('0xa'));var querystring=require(_0x6e3f('0x11'));var Papa=require(_0x6e3f('0x12'));var Redis=require(_0x6e3f('0x13'));var authService=require(_0x6e3f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6e3f('0x15'));var hardwareService=require(_0x6e3f('0x16'));var logger=require('../../config/logger')(_0x6e3f('0x17'));var utils=require(_0x6e3f('0x18'));var config=require(_0x6e3f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6e3f('0x1a'));function respondWithStatusCode(_0x1144c4,_0x3f11bc){_0x3f11bc=_0x3f11bc||0xcc;return function(_0x5f5027){if(_0x5f5027){return _0x1144c4[_0x6e3f('0x1b')](_0x3f11bc);}return _0x1144c4[_0x6e3f('0x1c')](_0x3f11bc)[_0x6e3f('0x1d')]();};}function respondWithResult(_0x360091,_0x1be69f){_0x1be69f=_0x1be69f||0xc8;return function(_0xbb61de){if(_0xbb61de){return _0x360091['status'](_0x1be69f)[_0x6e3f('0x1e')](_0xbb61de);}};}function respondWithFilteredResult(_0x29ea3c,_0x494aba){return function(_0x164636){if(_0x164636){var _0x15f891=typeof _0x494aba['offset']===_0x6e3f('0x1f')&&typeof _0x494aba['limit']===_0x6e3f('0x1f');var _0x11537e=_0x164636[_0x6e3f('0x20')];var _0x51adf5=_0x15f891?0x0:_0x494aba['offset'];var _0x4b5946=_0x15f891?_0x164636[_0x6e3f('0x20')]:_0x494aba['offset']+_0x494aba[_0x6e3f('0x21')];var _0x1c29e0;if(_0x4b5946>=_0x11537e){_0x4b5946=_0x11537e;_0x1c29e0=0xc8;}else{_0x1c29e0=0xce;}_0x29ea3c[_0x6e3f('0x1c')](_0x1c29e0);return _0x29ea3c[_0x6e3f('0x22')]('Content-Range',_0x51adf5+'-'+_0x4b5946+'/'+_0x11537e)[_0x6e3f('0x1e')](_0x164636);}return null;};}function patchUpdates(_0x55f7d0){return function(_0x3a7c67){try{jsonpatch[_0x6e3f('0x23')](_0x3a7c67,_0x55f7d0,!![]);}catch(_0x5ae0fe){return BPromise[_0x6e3f('0x24')](_0x5ae0fe);}return _0x3a7c67[_0x6e3f('0x25')]();};}function saveUpdates(_0x52880c,_0x16bd2a){return function(_0x49e879){if(_0x49e879){return _0x49e879['update'](_0x52880c)[_0x6e3f('0x26')](function(_0x4d69c2){return _0x4d69c2;});}return null;};}function removeEntity(_0x38fc95,_0x549cee){return function(_0x79f657){if(_0x79f657){return _0x79f657['destroy']()['then'](function(){_0x38fc95[_0x6e3f('0x1c')](0xcc)[_0x6e3f('0x1d')]();});}};}function handleEntityNotFound(_0x113f89,_0x29272e){return function(_0x3077b9){if(!_0x3077b9){_0x113f89[_0x6e3f('0x1b')](0x194);}return _0x3077b9;};}function handleError(_0x5be96e,_0x517a23){_0x517a23=_0x517a23||0x1f4;return function(_0x1549c2){logger[_0x6e3f('0x27')](_0x1549c2[_0x6e3f('0x28')]);if(_0x1549c2[_0x6e3f('0x29')]){delete _0x1549c2['name'];}_0x5be96e['status'](_0x517a23)[_0x6e3f('0x2a')](_0x1549c2);};}exports[_0x6e3f('0x2b')]=function(_0x14036e,_0xbaeed5){var _0x34adf4={},_0x27cfbf={},_0x3165ad={'count':0x0,'rows':[]};var _0xac656b=_['map'](db[_0x6e3f('0x2c')][_0x6e3f('0x2d')],function(_0x3357bc){return{'name':_0x3357bc[_0x6e3f('0x2e')],'type':_0x3357bc[_0x6e3f('0x2f')][_0x6e3f('0x30')]};});_0x27cfbf[_0x6e3f('0x31')]=_[_0x6e3f('0x32')](_0xac656b,_0x6e3f('0x29'));_0x27cfbf[_0x6e3f('0x33')]=_[_0x6e3f('0x34')](_0x14036e[_0x6e3f('0x33')]);_0x27cfbf[_0x6e3f('0x35')]=_[_0x6e3f('0x36')](_0x27cfbf[_0x6e3f('0x31')],_0x27cfbf[_0x6e3f('0x33')]);_0x34adf4[_0x6e3f('0x37')]=_[_0x6e3f('0x36')](_0x27cfbf['model'],qs['fields'](_0x14036e[_0x6e3f('0x33')][_0x6e3f('0x38')]));_0x34adf4['attributes']=_0x34adf4[_0x6e3f('0x37')][_0x6e3f('0x39')]?_0x34adf4[_0x6e3f('0x37')]:_0x27cfbf[_0x6e3f('0x31')];if(!_0x14036e[_0x6e3f('0x33')]['hasOwnProperty'](_0x6e3f('0x3a'))){_0x34adf4[_0x6e3f('0x21')]=qs[_0x6e3f('0x21')](_0x14036e[_0x6e3f('0x33')][_0x6e3f('0x21')]);_0x34adf4[_0x6e3f('0x3b')]=qs[_0x6e3f('0x3b')](_0x14036e[_0x6e3f('0x33')][_0x6e3f('0x3b')]);}_0x34adf4[_0x6e3f('0x3c')]=qs[_0x6e3f('0x3d')](_0x14036e['query'][_0x6e3f('0x3d')]);_0x34adf4[_0x6e3f('0x3e')]=qs['filters'](_['pick'](_0x14036e['query'],_0x27cfbf[_0x6e3f('0x35')]),_0xac656b);if(_0x14036e[_0x6e3f('0x33')][_0x6e3f('0x3f')]){_0x34adf4[_0x6e3f('0x3e')]=_[_0x6e3f('0x40')](_0x34adf4[_0x6e3f('0x3e')],{'$or':_[_0x6e3f('0x32')](_0xac656b,function(_0x3797d6){if(_0x3797d6[_0x6e3f('0x2f')]!==_0x6e3f('0x41')){var _0x10984b={};_0x10984b[_0x3797d6['name']]={'$like':'%'+_0x14036e['query'][_0x6e3f('0x3f')]+'%'};return _0x10984b;}})});}_0x34adf4=_[_0x6e3f('0x40')]({},_0x34adf4,_0x14036e[_0x6e3f('0x42')]);var _0x591d03={'where':_0x34adf4['where']};return db[_0x6e3f('0x2c')][_0x6e3f('0x20')](_0x591d03)[_0x6e3f('0x26')](function(_0xafc794){_0x3165ad[_0x6e3f('0x20')]=_0xafc794;if(_0x14036e[_0x6e3f('0x33')]['includeAll']){_0x34adf4[_0x6e3f('0x43')]=[{'all':!![]}];}return db['VtigerAccount'][_0x6e3f('0x44')](_0x34adf4);})[_0x6e3f('0x26')](function(_0x502ecb){_0x3165ad[_0x6e3f('0x45')]=_0x502ecb;return _0x3165ad;})['then'](respondWithFilteredResult(_0xbaeed5,_0x34adf4))[_0x6e3f('0x46')](handleError(_0xbaeed5,null));};exports[_0x6e3f('0x47')]=function(_0x5af479,_0x616e75){var _0x438054={'raw':![],'where':{'id':_0x5af479[_0x6e3f('0x48')]['id']}},_0x17c851={};_0x17c851[_0x6e3f('0x31')]=_['keys'](db[_0x6e3f('0x2c')][_0x6e3f('0x2d')]);_0x17c851[_0x6e3f('0x33')]=_[_0x6e3f('0x34')](_0x5af479[_0x6e3f('0x33')]);_0x17c851[_0x6e3f('0x35')]=_[_0x6e3f('0x36')](_0x17c851[_0x6e3f('0x31')],_0x17c851[_0x6e3f('0x33')]);_0x438054[_0x6e3f('0x37')]=_[_0x6e3f('0x36')](_0x17c851[_0x6e3f('0x31')],qs[_0x6e3f('0x38')](_0x5af479[_0x6e3f('0x33')][_0x6e3f('0x38')]));_0x438054[_0x6e3f('0x37')]=_0x438054[_0x6e3f('0x37')][_0x6e3f('0x39')]?_0x438054[_0x6e3f('0x37')]:_0x17c851['model'];if(_0x5af479['query'][_0x6e3f('0x49')]){_0x438054[_0x6e3f('0x43')]=[{'all':!![]}];}_0x438054=_[_0x6e3f('0x40')]({},_0x438054,_0x5af479[_0x6e3f('0x42')]);return db[_0x6e3f('0x2c')][_0x6e3f('0x4a')](_0x438054)[_0x6e3f('0x26')](handleEntityNotFound(_0x616e75,null))[_0x6e3f('0x26')](respondWithResult(_0x616e75,null))['catch'](handleError(_0x616e75,null));};exports['create']=function(_0x217e04,_0x2e07b7){return db['VtigerAccount'][_0x6e3f('0x4b')](_0x217e04[_0x6e3f('0x4c')],{})[_0x6e3f('0x26')](respondWithResult(_0x2e07b7,0xc9))[_0x6e3f('0x46')](handleError(_0x2e07b7,null));};exports[_0x6e3f('0x4d')]=function(_0x3ae18b,_0x493030){if(_0x3ae18b[_0x6e3f('0x4c')]['id']){delete _0x3ae18b[_0x6e3f('0x4c')]['id'];}return db[_0x6e3f('0x2c')][_0x6e3f('0x4a')]({'where':{'id':_0x3ae18b[_0x6e3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x493030,null))[_0x6e3f('0x26')](saveUpdates(_0x3ae18b[_0x6e3f('0x4c')],null))[_0x6e3f('0x26')](respondWithResult(_0x493030,null))[_0x6e3f('0x46')](handleError(_0x493030,null));};exports[_0x6e3f('0x4e')]=function(_0x5d0faa,_0x58b706){return db[_0x6e3f('0x2c')][_0x6e3f('0x4a')]({'where':{'id':_0x5d0faa[_0x6e3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x58b706,null))[_0x6e3f('0x26')](removeEntity(_0x58b706,null))['catch'](handleError(_0x58b706,null));};exports['getConfigurations']=function(_0x234ead,_0x3326d7,_0x2b6d3d){var _0x1b4951={};var _0x48684b={};var _0x39dd12;var _0x58972a;return db['VtigerAccount']['findOne']({'where':{'id':_0x234ead[_0x6e3f('0x48')]['id']}})[_0x6e3f('0x26')](handleEntityNotFound(_0x3326d7,null))['then'](function(_0xb9c8dc){if(_0xb9c8dc){_0x39dd12=_0xb9c8dc;_0x48684b[_0x6e3f('0x31')]=_['keys'](db['VtigerConfiguration'][_0x6e3f('0x2d')]);_0x48684b['query']=_[_0x6e3f('0x34')](_0x234ead['query']);_0x48684b['filters']=_[_0x6e3f('0x36')](_0x48684b[_0x6e3f('0x31')],_0x48684b['query']);_0x1b4951[_0x6e3f('0x37')]=_[_0x6e3f('0x36')](_0x48684b[_0x6e3f('0x31')],qs[_0x6e3f('0x38')](_0x234ead[_0x6e3f('0x33')][_0x6e3f('0x38')]));_0x1b4951[_0x6e3f('0x37')]=_0x1b4951['attributes']['length']?_0x1b4951[_0x6e3f('0x37')]:_0x48684b[_0x6e3f('0x31')];_0x1b4951[_0x6e3f('0x3c')]=qs[_0x6e3f('0x3d')](_0x234ead[_0x6e3f('0x33')][_0x6e3f('0x3d')]);_0x1b4951['where']=qs[_0x6e3f('0x35')](_[_0x6e3f('0x4f')](_0x234ead['query'],_0x48684b[_0x6e3f('0x35')]));if(_0x234ead[_0x6e3f('0x33')][_0x6e3f('0x3f')]){_0x1b4951[_0x6e3f('0x3e')]=_[_0x6e3f('0x40')](_0x1b4951[_0x6e3f('0x3e')],{'$or':_['map'](_0x1b4951['attributes'],function(_0x2edb3a){var _0x1df873={};_0x1df873[_0x2edb3a]={'$like':'%'+_0x234ead['query'][_0x6e3f('0x3f')]+'%'};return _0x1df873;})});}_0x1b4951=_[_0x6e3f('0x40')]({},_0x1b4951,_0x234ead[_0x6e3f('0x42')]);return _0x39dd12['getConfigurations'](_0x1b4951);}})[_0x6e3f('0x26')](function(_0x1478bb){if(_0x1478bb){_0x58972a=_0x1478bb[_0x6e3f('0x39')];if(!_0x234ead[_0x6e3f('0x33')][_0x6e3f('0x50')]('nolimit')){_0x1b4951[_0x6e3f('0x21')]=qs[_0x6e3f('0x21')](_0x234ead[_0x6e3f('0x33')][_0x6e3f('0x21')]);_0x1b4951['offset']=qs[_0x6e3f('0x3b')](_0x234ead[_0x6e3f('0x33')]['offset']);}return _0x39dd12[_0x6e3f('0x51')](_0x1b4951);}})[_0x6e3f('0x26')](function(_0x392851){if(_0x392851){return _0x392851?{'count':_0x58972a,'rows':_0x392851}:null;}})[_0x6e3f('0x26')](respondWithResult(_0x3326d7,null))[_0x6e3f('0x46')](handleError(_0x3326d7,null));};exports['addConfiguration']=function(_0x1ed9a4,_0x56e50a,_0x1bb877){if(_0x1ed9a4[_0x6e3f('0x4c')]['id']){delete _0x1ed9a4[_0x6e3f('0x4c')]['id'];}return db['VtigerAccount'][_0x6e3f('0x52')]({'where':{'id':_0x1ed9a4[_0x6e3f('0x48')]['id']}})[_0x6e3f('0x26')](handleEntityNotFound(_0x56e50a,null))[_0x6e3f('0x26')](function(_0x46bb25){if(_0x46bb25){_0x1ed9a4[_0x6e3f('0x4c')]['AccountId']=_0x46bb25['id'];_0x1ed9a4[_0x6e3f('0x4c')][_0x6e3f('0x53')]=integrations['getSubjects'](_0x1ed9a4[_0x6e3f('0x4c')][_0x6e3f('0x54')],_0x1ed9a4['body']['type']);_0x1ed9a4[_0x6e3f('0x4c')][_0x6e3f('0x55')]=integrations[_0x6e3f('0x56')](_0x1ed9a4['body'][_0x6e3f('0x54')],_0x1ed9a4[_0x6e3f('0x4c')][_0x6e3f('0x2f')]);return db['VtigerConfiguration']['create'](_0x1ed9a4[_0x6e3f('0x4c')],{'include':[{'model':db[_0x6e3f('0x57')],'as':_0x6e3f('0x53')},{'model':db[_0x6e3f('0x57')],'as':_0x6e3f('0x55')}]});}return null;})['then'](respondWithResult(_0x56e50a,null))[_0x6e3f('0x46')](handleError(_0x56e50a,null));};var md5=require(_0x6e3f('0x58'));exports['getFields']=function(_0x2b6323,_0x40ba89,_0x4b6437){var _0x45d5ac=null;var _0x4e7da3=null;var _0x1cb904=null;var _0x473baa=null;var _0x4629bd='';return db['VtigerAccount']['findOne']({'where':{'id':_0x2b6323[_0x6e3f('0x48')]['id']},'attributes':['id',_0x6e3f('0x29'),_0x6e3f('0x59'),_0x6e3f('0x5a'),_0x6e3f('0x5b'),_0x6e3f('0x5c'),_0x6e3f('0x5d'),_0x6e3f('0x5e')]})[_0x6e3f('0x26')](handleEntityNotFound(_0x40ba89,null))['then'](function(_0x3e63c3){if(_0x3e63c3){_0x45d5ac=_0x3e63c3[_0x6e3f('0x59')];_0x4e7da3=_0x3e63c3[_0x6e3f('0x5e')];_0x1cb904=_0x3e63c3[_0x6e3f('0x5b')];_0x4629bd=_0x3e63c3[_0x6e3f('0x5c')];var _0x4a72d7=_0x4629bd[_0x6e3f('0x5f')](-0x1);if(_0x4a72d7==='/'){_0x4629bd=_0x4629bd[_0x6e3f('0x60')](0x0,_0x4629bd[_0x6e3f('0x61')](_0x4a72d7));}_0x473baa=util['format']('%s/webservice.php',_0x4629bd);var _0x3ecb84={'method':_0x6e3f('0x62'),'uri':_0x473baa,'qs':{'operation':_0x6e3f('0x63'),'username':_0x3e63c3[_0x6e3f('0x59')]},'json':!![]};return rp(_0x3ecb84);}})[_0x6e3f('0x26')](function(_0xadd256){if(_0xadd256[_0x6e3f('0x64')]){var _0x80f9bd={'method':'POST','uri':_0x473baa,'form':{'operation':_0x6e3f('0x65'),'username':_0x45d5ac,'accessKey':md5(_0xadd256['result'][_0x6e3f('0x66')]+_0x4e7da3)},'json':!![]};return rp(_0x80f9bd);}})['then'](function(_0x4a5225){if(_0x4a5225[_0x6e3f('0x64')]){var _0x1cbbce={'method':'GET','uri':_0x473baa,'qs':{'operation':_0x6e3f('0x67'),'username':_0x45d5ac,'sessionName':_0x4a5225[_0x6e3f('0x68')][_0x6e3f('0x69')],'elementType':_0x1cb904},'json':!![]};return rp(_0x1cbbce);}})[_0x6e3f('0x26')](function(_0x23ea61){if(_0x23ea61[_0x6e3f('0x64')]){var _0x482677=['autogenerated',_0x6e3f('0x6a'),_0x6e3f('0x6b')];_[_0x6e3f('0x6c')](_0x23ea61['result']['fields'],function(_0x2a8f9f){return _0x482677[_0x6e3f('0x6d')](_0x2a8f9f[_0x6e3f('0x2f')][_0x6e3f('0x29')]);});_[_0x6e3f('0x6c')](_0x23ea61[_0x6e3f('0x68')]['fields'],function(_0x36bae5){return _0x36bae5[_0x6e3f('0x6e')]===_0x6e3f('0x6f');});return{'count':_0x23ea61[_0x6e3f('0x68')][_0x6e3f('0x38')][_0x6e3f('0x39')],'rows':_[_0x6e3f('0x32')](_0x23ea61[_0x6e3f('0x68')][_0x6e3f('0x38')],function(_0x3133e5){return{'id':_0x3133e5['name'],'name':_0x3133e5[_0x6e3f('0x70')],'custom':_[_0x6e3f('0x71')](_0x3133e5['name'],_0x6e3f('0x72'))?!![]:![],'options':_0x3133e5[_0x6e3f('0x2f')][_0x6e3f('0x29')]===_0x6e3f('0x73')&&_0x3133e5[_0x6e3f('0x2f')]['picklistValues']['length']>0x0?_[_0x6e3f('0x32')](_0x3133e5[_0x6e3f('0x2f')][_0x6e3f('0x74')],function(_0x46b9ce){return{'name':_0x46b9ce[_0x6e3f('0x70')],'value':_0x46b9ce[_0x6e3f('0x75')]};}):[]};})};}})[_0x6e3f('0x26')](respondWithResult(_0x40ba89,null))['catch'](function(_0x2785e9){console[_0x6e3f('0x76')](_0x6e3f('0x77')+_0x2785e9);var _0x4e4a10=_0x2b6323[_0x6e3f('0x33')][_0x6e3f('0x78')]?0x1f4:_0x2785e9[_0x6e3f('0x79')]||0x1f4;logger[_0x6e3f('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x6e3f('0x7a'),_0x4e4a10,JSON[_0x6e3f('0x7b')](_0x2785e9));delete _0x2785e9[_0x6e3f('0x29')];if(_0x4e4a10===0x191){_0x4e4a10=0x190;}_0x40ba89['status'](_0x4e4a10)[_0x6e3f('0x2a')](_0x2b6323['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2785e9['statusCode']}:_0x2785e9);});}; \ No newline at end of file +var _0xd966=['label','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','VtigerAccount','catch','show','params','options','create','body','find','findOne','VtigerConfiguration','filter','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','name','remoteUri','serverUrl','username','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','sessionName','autogenerated','owner','includes','remove','editable','cf_','picklistValues'];(function(_0x5e9c0f,_0x5b5a67){var _0x5aaf16=function(_0x3b7828){while(--_0x3b7828){_0x5e9c0f['push'](_0x5e9c0f['shift']());}};_0x5aaf16(++_0x5b5a67);}(_0xd966,0x1e1));var _0x6d96=function(_0x4702ff,_0x22a958){_0x4702ff=_0x4702ff-0x0;var _0x3a6ff3=_0xd966[_0x4702ff];return _0x3a6ff3;};'use strict';var emlformat=require(_0x6d96('0x0'));var rimraf=require(_0x6d96('0x1'));var zipdir=require(_0x6d96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d96('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d96('0x4'));var util=require('util');var path=require(_0x6d96('0x5'));var sox=require(_0x6d96('0x6'));var csv=require(_0x6d96('0x7'));var ejs=require(_0x6d96('0x8'));var fs=require('fs');var fs_extra=require(_0x6d96('0x9'));var _=require(_0x6d96('0xa'));var squel=require(_0x6d96('0xb'));var crypto=require('crypto');var jsforce=require(_0x6d96('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d96('0xd'));var Redis=require(_0x6d96('0xe'));var authService=require(_0x6d96('0xf'));var qs=require(_0x6d96('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d96('0x11'));var logger=require('../../config/logger')(_0x6d96('0x12'));var utils=require(_0x6d96('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6d96('0x14'));var db=require(_0x6d96('0x15'))['db'];var integrations=require(_0x6d96('0x16'));function respondWithStatusCode(_0x7f9cc5,_0x5431aa){_0x5431aa=_0x5431aa||0xcc;return function(_0x246a13){if(_0x246a13){return _0x7f9cc5['sendStatus'](_0x5431aa);}return _0x7f9cc5[_0x6d96('0x17')](_0x5431aa)[_0x6d96('0x18')]();};}function respondWithResult(_0x58d79e,_0x43fe97){_0x43fe97=_0x43fe97||0xc8;return function(_0x3cd1ed){if(_0x3cd1ed){return _0x58d79e['status'](_0x43fe97)[_0x6d96('0x19')](_0x3cd1ed);}};}function respondWithFilteredResult(_0x2cef50,_0x1d7c6b){return function(_0x3a37d4){if(_0x3a37d4){var _0x5a2813=typeof _0x1d7c6b['offset']===_0x6d96('0x1a')&&typeof _0x1d7c6b[_0x6d96('0x1b')]===_0x6d96('0x1a');var _0x2a6879=_0x3a37d4[_0x6d96('0x1c')];var _0xa60a61=_0x5a2813?0x0:_0x1d7c6b[_0x6d96('0x1d')];var _0x2ae57d=_0x5a2813?_0x3a37d4['count']:_0x1d7c6b[_0x6d96('0x1d')]+_0x1d7c6b[_0x6d96('0x1b')];var _0x2e788a;if(_0x2ae57d>=_0x2a6879){_0x2ae57d=_0x2a6879;_0x2e788a=0xc8;}else{_0x2e788a=0xce;}_0x2cef50['status'](_0x2e788a);return _0x2cef50[_0x6d96('0x1e')]('Content-Range',_0xa60a61+'-'+_0x2ae57d+'/'+_0x2a6879)['json'](_0x3a37d4);}return null;};}function patchUpdates(_0x7c5470){return function(_0x2e2619){try{jsonpatch['apply'](_0x2e2619,_0x7c5470,!![]);}catch(_0x3c21b4){return BPromise[_0x6d96('0x1f')](_0x3c21b4);}return _0x2e2619[_0x6d96('0x20')]();};}function saveUpdates(_0x30ecc4,_0x346738){return function(_0x109fba){if(_0x109fba){return _0x109fba[_0x6d96('0x21')](_0x30ecc4)[_0x6d96('0x22')](function(_0x2eb8f4){return _0x2eb8f4;});}return null;};}function removeEntity(_0x512a8d,_0x36e0f6){return function(_0x418df4){if(_0x418df4){return _0x418df4[_0x6d96('0x23')]()[_0x6d96('0x22')](function(){_0x512a8d['status'](0xcc)[_0x6d96('0x18')]();});}};}function handleEntityNotFound(_0x40660d,_0x3a7cbd){return function(_0x43e0f7){if(!_0x43e0f7){_0x40660d[_0x6d96('0x24')](0x194);}return _0x43e0f7;};}function handleError(_0x5921df,_0x295b97){_0x295b97=_0x295b97||0x1f4;return function(_0xcd32e9){logger['error'](_0xcd32e9[_0x6d96('0x25')]);if(_0xcd32e9['name']){delete _0xcd32e9['name'];}_0x5921df[_0x6d96('0x17')](_0x295b97)[_0x6d96('0x26')](_0xcd32e9);};}exports[_0x6d96('0x27')]=function(_0x3e6a89,_0x97a246){var _0x4e4e03={},_0x14f006={},_0x5daa6e={'count':0x0,'rows':[]};var _0x320728=_[_0x6d96('0x28')](db['VtigerAccount'][_0x6d96('0x29')],function(_0x24984a){return{'name':_0x24984a[_0x6d96('0x2a')],'type':_0x24984a[_0x6d96('0x2b')]['key']};});_0x14f006[_0x6d96('0x2c')]=_[_0x6d96('0x28')](_0x320728,'name');_0x14f006[_0x6d96('0x2d')]=_[_0x6d96('0x2e')](_0x3e6a89[_0x6d96('0x2d')]);_0x14f006[_0x6d96('0x2f')]=_[_0x6d96('0x30')](_0x14f006['model'],_0x14f006[_0x6d96('0x2d')]);_0x4e4e03[_0x6d96('0x31')]=_[_0x6d96('0x30')](_0x14f006[_0x6d96('0x2c')],qs[_0x6d96('0x32')](_0x3e6a89[_0x6d96('0x2d')]['fields']));_0x4e4e03['attributes']=_0x4e4e03[_0x6d96('0x31')][_0x6d96('0x33')]?_0x4e4e03[_0x6d96('0x31')]:_0x14f006['model'];if(!_0x3e6a89[_0x6d96('0x2d')][_0x6d96('0x34')](_0x6d96('0x35'))){_0x4e4e03['limit']=qs[_0x6d96('0x1b')](_0x3e6a89[_0x6d96('0x2d')]['limit']);_0x4e4e03[_0x6d96('0x1d')]=qs['offset'](_0x3e6a89[_0x6d96('0x2d')][_0x6d96('0x1d')]);}_0x4e4e03[_0x6d96('0x36')]=qs[_0x6d96('0x37')](_0x3e6a89['query'][_0x6d96('0x37')]);_0x4e4e03[_0x6d96('0x38')]=qs['filters'](_[_0x6d96('0x39')](_0x3e6a89['query'],_0x14f006[_0x6d96('0x2f')]),_0x320728);if(_0x3e6a89[_0x6d96('0x2d')]['filter']){_0x4e4e03[_0x6d96('0x38')]=_[_0x6d96('0x3a')](_0x4e4e03['where'],{'$or':_[_0x6d96('0x28')](_0x320728,function(_0xc8b11a){if(_0xc8b11a[_0x6d96('0x2b')]!==_0x6d96('0x3b')){var _0x287b45={};_0x287b45[_0xc8b11a['name']]={'$like':'%'+_0x3e6a89[_0x6d96('0x2d')]['filter']+'%'};return _0x287b45;}})});}_0x4e4e03=_[_0x6d96('0x3a')]({},_0x4e4e03,_0x3e6a89['options']);var _0x118056={'where':_0x4e4e03['where']};return db['VtigerAccount']['count'](_0x118056)['then'](function(_0x326bda){_0x5daa6e[_0x6d96('0x1c')]=_0x326bda;if(_0x3e6a89[_0x6d96('0x2d')][_0x6d96('0x3c')]){_0x4e4e03[_0x6d96('0x3d')]=[{'all':!![]}];}return db[_0x6d96('0x3e')]['findAll'](_0x4e4e03);})['then'](function(_0x254858){_0x5daa6e['rows']=_0x254858;return _0x5daa6e;})[_0x6d96('0x22')](respondWithFilteredResult(_0x97a246,_0x4e4e03))[_0x6d96('0x3f')](handleError(_0x97a246,null));};exports[_0x6d96('0x40')]=function(_0x4cac8b,_0x2a56f5){var _0x46eac1={'raw':![],'where':{'id':_0x4cac8b[_0x6d96('0x41')]['id']}},_0x2a7027={};_0x2a7027['model']=_[_0x6d96('0x2e')](db['VtigerAccount'][_0x6d96('0x29')]);_0x2a7027[_0x6d96('0x2d')]=_['keys'](_0x4cac8b[_0x6d96('0x2d')]);_0x2a7027[_0x6d96('0x2f')]=_[_0x6d96('0x30')](_0x2a7027[_0x6d96('0x2c')],_0x2a7027[_0x6d96('0x2d')]);_0x46eac1[_0x6d96('0x31')]=_['intersection'](_0x2a7027[_0x6d96('0x2c')],qs[_0x6d96('0x32')](_0x4cac8b['query'][_0x6d96('0x32')]));_0x46eac1[_0x6d96('0x31')]=_0x46eac1[_0x6d96('0x31')]['length']?_0x46eac1['attributes']:_0x2a7027[_0x6d96('0x2c')];if(_0x4cac8b[_0x6d96('0x2d')]['includeAll']){_0x46eac1[_0x6d96('0x3d')]=[{'all':!![]}];}_0x46eac1=_['merge']({},_0x46eac1,_0x4cac8b[_0x6d96('0x42')]);return db[_0x6d96('0x3e')]['find'](_0x46eac1)[_0x6d96('0x22')](handleEntityNotFound(_0x2a56f5,null))[_0x6d96('0x22')](respondWithResult(_0x2a56f5,null))['catch'](handleError(_0x2a56f5,null));};exports[_0x6d96('0x43')]=function(_0x7f15a7,_0x188d50){return db['VtigerAccount'][_0x6d96('0x43')](_0x7f15a7[_0x6d96('0x44')],{})[_0x6d96('0x22')](respondWithResult(_0x188d50,0xc9))[_0x6d96('0x3f')](handleError(_0x188d50,null));};exports[_0x6d96('0x21')]=function(_0x4fe715,_0x4be8b2){if(_0x4fe715[_0x6d96('0x44')]['id']){delete _0x4fe715[_0x6d96('0x44')]['id'];}return db[_0x6d96('0x3e')][_0x6d96('0x45')]({'where':{'id':_0x4fe715[_0x6d96('0x41')]['id']}})[_0x6d96('0x22')](handleEntityNotFound(_0x4be8b2,null))[_0x6d96('0x22')](saveUpdates(_0x4fe715[_0x6d96('0x44')],null))[_0x6d96('0x22')](respondWithResult(_0x4be8b2,null))[_0x6d96('0x3f')](handleError(_0x4be8b2,null));};exports['destroy']=function(_0x411bfa,_0x3ef829){return db[_0x6d96('0x3e')][_0x6d96('0x45')]({'where':{'id':_0x411bfa['params']['id']}})[_0x6d96('0x22')](handleEntityNotFound(_0x3ef829,null))[_0x6d96('0x22')](removeEntity(_0x3ef829,null))[_0x6d96('0x3f')](handleError(_0x3ef829,null));};exports['getConfigurations']=function(_0x586206,_0x58b7ce,_0x53ba80){var _0x5a8a1a={};var _0x48fa63={};var _0x2d4f48;var _0x37c09f;return db['VtigerAccount'][_0x6d96('0x46')]({'where':{'id':_0x586206[_0x6d96('0x41')]['id']}})[_0x6d96('0x22')](handleEntityNotFound(_0x58b7ce,null))[_0x6d96('0x22')](function(_0x1771de){if(_0x1771de){_0x2d4f48=_0x1771de;_0x48fa63[_0x6d96('0x2c')]=_[_0x6d96('0x2e')](db[_0x6d96('0x47')]['rawAttributes']);_0x48fa63[_0x6d96('0x2d')]=_[_0x6d96('0x2e')](_0x586206[_0x6d96('0x2d')]);_0x48fa63[_0x6d96('0x2f')]=_['intersection'](_0x48fa63['model'],_0x48fa63[_0x6d96('0x2d')]);_0x5a8a1a[_0x6d96('0x31')]=_[_0x6d96('0x30')](_0x48fa63[_0x6d96('0x2c')],qs[_0x6d96('0x32')](_0x586206[_0x6d96('0x2d')][_0x6d96('0x32')]));_0x5a8a1a['attributes']=_0x5a8a1a[_0x6d96('0x31')][_0x6d96('0x33')]?_0x5a8a1a['attributes']:_0x48fa63[_0x6d96('0x2c')];_0x5a8a1a[_0x6d96('0x36')]=qs[_0x6d96('0x37')](_0x586206[_0x6d96('0x2d')][_0x6d96('0x37')]);_0x5a8a1a['where']=qs['filters'](_[_0x6d96('0x39')](_0x586206[_0x6d96('0x2d')],_0x48fa63['filters']));if(_0x586206[_0x6d96('0x2d')][_0x6d96('0x48')]){_0x5a8a1a[_0x6d96('0x38')]=_[_0x6d96('0x3a')](_0x5a8a1a['where'],{'$or':_[_0x6d96('0x28')](_0x5a8a1a[_0x6d96('0x31')],function(_0x632a05){var _0x4d1c86={};_0x4d1c86[_0x632a05]={'$like':'%'+_0x586206[_0x6d96('0x2d')]['filter']+'%'};return _0x4d1c86;})});}_0x5a8a1a=_[_0x6d96('0x3a')]({},_0x5a8a1a,_0x586206['options']);return _0x2d4f48[_0x6d96('0x49')](_0x5a8a1a);}})['then'](function(_0x25b2c5){if(_0x25b2c5){_0x37c09f=_0x25b2c5[_0x6d96('0x33')];if(!_0x586206[_0x6d96('0x2d')]['hasOwnProperty'](_0x6d96('0x35'))){_0x5a8a1a['limit']=qs[_0x6d96('0x1b')](_0x586206['query'][_0x6d96('0x1b')]);_0x5a8a1a[_0x6d96('0x1d')]=qs[_0x6d96('0x1d')](_0x586206['query'][_0x6d96('0x1d')]);}return _0x2d4f48[_0x6d96('0x49')](_0x5a8a1a);}})['then'](function(_0x2b19f5){if(_0x2b19f5){return _0x2b19f5?{'count':_0x37c09f,'rows':_0x2b19f5}:null;}})[_0x6d96('0x22')](respondWithResult(_0x58b7ce,null))[_0x6d96('0x3f')](handleError(_0x58b7ce,null));};exports[_0x6d96('0x4a')]=function(_0x594f1e,_0xaf8df2,_0x1246cd){if(_0x594f1e[_0x6d96('0x44')]['id']){delete _0x594f1e[_0x6d96('0x44')]['id'];}return db[_0x6d96('0x3e')][_0x6d96('0x46')]({'where':{'id':_0x594f1e[_0x6d96('0x41')]['id']}})[_0x6d96('0x22')](handleEntityNotFound(_0xaf8df2,null))[_0x6d96('0x22')](function(_0x3f1933){if(_0x3f1933){_0x594f1e[_0x6d96('0x44')][_0x6d96('0x4b')]=_0x3f1933['id'];_0x594f1e[_0x6d96('0x44')][_0x6d96('0x4c')]=integrations['getSubjects'](_0x594f1e['body'][_0x6d96('0x4d')],_0x594f1e[_0x6d96('0x44')]['type']);_0x594f1e[_0x6d96('0x44')][_0x6d96('0x4e')]=integrations[_0x6d96('0x4f')](_0x594f1e[_0x6d96('0x44')]['channel'],_0x594f1e[_0x6d96('0x44')][_0x6d96('0x2b')]);return db[_0x6d96('0x47')][_0x6d96('0x43')](_0x594f1e[_0x6d96('0x44')],{'include':[{'model':db[_0x6d96('0x50')],'as':_0x6d96('0x4c')},{'model':db['VtigerField'],'as':_0x6d96('0x4e')}]});}return null;})[_0x6d96('0x22')](respondWithResult(_0xaf8df2,null))[_0x6d96('0x3f')](handleError(_0xaf8df2,null));};var md5=require(_0x6d96('0x51'));exports[_0x6d96('0x52')]=function(_0x5e7408,_0x413191,_0x2b70e8){var _0x3b2a1c=null;var _0xfc8bcd=null;var _0x54e350=null;var _0x1f1e2e=null;var _0x589d30='';return db[_0x6d96('0x3e')]['findOne']({'where':{'id':_0x5e7408['params']['id']},'attributes':['id',_0x6d96('0x53'),'username','description','moduleName',_0x6d96('0x54'),_0x6d96('0x55'),'accessKey']})[_0x6d96('0x22')](handleEntityNotFound(_0x413191,null))[_0x6d96('0x22')](function(_0x263e61){if(_0x263e61){_0x3b2a1c=_0x263e61[_0x6d96('0x56')];_0xfc8bcd=_0x263e61[_0x6d96('0x57')];_0x54e350=_0x263e61[_0x6d96('0x58')];_0x589d30=_0x263e61[_0x6d96('0x54')];var _0x159de8=_0x589d30[_0x6d96('0x59')](-0x1);if(_0x159de8==='/'){_0x589d30=_0x589d30[_0x6d96('0x5a')](0x0,_0x589d30[_0x6d96('0x5b')](_0x159de8));}_0x1f1e2e=util[_0x6d96('0x5c')](_0x6d96('0x5d'),_0x589d30);var _0xecce7d={'method':_0x6d96('0x5e'),'uri':_0x1f1e2e,'qs':{'operation':_0x6d96('0x5f'),'username':_0x263e61[_0x6d96('0x56')]},'json':!![]};return rp(_0xecce7d);}})[_0x6d96('0x22')](function(_0x50ab23){if(_0x50ab23['success']){var _0x51b439={'method':_0x6d96('0x60'),'uri':_0x1f1e2e,'form':{'operation':_0x6d96('0x61'),'username':_0x3b2a1c,'accessKey':md5(_0x50ab23[_0x6d96('0x62')][_0x6d96('0x63')]+_0xfc8bcd)},'json':!![]};return rp(_0x51b439);}})[_0x6d96('0x22')](function(_0x2fa13c){if(_0x2fa13c[_0x6d96('0x64')]){var _0xfc4ed1={'method':_0x6d96('0x5e'),'uri':_0x1f1e2e,'qs':{'operation':'describe','username':_0x3b2a1c,'sessionName':_0x2fa13c[_0x6d96('0x62')][_0x6d96('0x65')],'elementType':_0x54e350},'json':!![]};return rp(_0xfc4ed1);}})[_0x6d96('0x22')](function(_0x1c42a2){if(_0x1c42a2[_0x6d96('0x64')]){var _0x30672f=[_0x6d96('0x66'),'reference',_0x6d96('0x67')];_['remove'](_0x1c42a2['result']['fields'],function(_0x2d0931){return _0x30672f[_0x6d96('0x68')](_0x2d0931['type'][_0x6d96('0x53')]);});_[_0x6d96('0x69')](_0x1c42a2[_0x6d96('0x62')][_0x6d96('0x32')],function(_0x3ece72){return _0x3ece72[_0x6d96('0x6a')]==='false';});return{'count':_0x1c42a2[_0x6d96('0x62')][_0x6d96('0x32')][_0x6d96('0x33')],'rows':_['map'](_0x1c42a2[_0x6d96('0x62')][_0x6d96('0x32')],function(_0xce2556){return{'id':_0xce2556['name'],'name':_0xce2556['label'],'custom':_['startsWith'](_0xce2556[_0x6d96('0x53')],_0x6d96('0x6b'))?!![]:![],'options':_0xce2556[_0x6d96('0x2b')][_0x6d96('0x53')]==='picklist'&&_0xce2556[_0x6d96('0x2b')][_0x6d96('0x6c')]['length']>0x0?_[_0x6d96('0x28')](_0xce2556[_0x6d96('0x2b')]['picklistValues'],function(_0x161111){return{'name':_0x161111[_0x6d96('0x6d')],'value':_0x161111['value']};}):[]};})};}})[_0x6d96('0x22')](respondWithResult(_0x413191,null))[_0x6d96('0x3f')](function(_0x1bcce4){console[_0x6d96('0x6e')](_0x6d96('0x6f')+_0x1bcce4);var _0x32f198=_0x5e7408[_0x6d96('0x2d')][_0x6d96('0x70')]?0x1f4:_0x1bcce4[_0x6d96('0x71')]||0x1f4;logger[_0x6d96('0x72')](_0x6d96('0x73'),_0x6d96('0x52'),_0x32f198,JSON[_0x6d96('0x74')](_0x1bcce4));delete _0x1bcce4[_0x6d96('0x53')];if(_0x32f198===0x191){_0x32f198=0x190;}_0x413191[_0x6d96('0x17')](_0x32f198)['send'](_0x5e7408[_0x6d96('0x2d')][_0x6d96('0x70')]?{'message':_0x6d96('0x75'),'statusCode':_0x1bcce4[_0x6d96('0x71')]}:_0x1bcce4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8300996..0865084 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 _0x8875=['../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d1c15,_0x52c88b){var _0x34d98d=function(_0x5a540b){while(--_0x5a540b){_0x1d1c15['push'](_0x1d1c15['shift']());}};_0x34d98d(++_0x52c88b);}(_0x8875,0xf3));var _0x5887=function(_0x514991,_0x319f52){_0x514991=_0x514991-0x0;var _0x158640=_0x8875[_0x514991];return _0x158640;};'use strict';var _=require(_0x5887('0x0'));var util=require(_0x5887('0x1'));var logger=require(_0x5887('0x2'))(_0x5887('0x3'));var moment=require(_0x5887('0x4'));var BPromise=require(_0x5887('0x5'));var rp=require(_0x5887('0x6'));var fs=require('fs');var path=require(_0x5887('0x7'));var rimraf=require(_0x5887('0x8'));var config=require(_0x5887('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x5887('0xa'));module[_0x5887('0xb')]=function(_0x3e4bd5,_0x2935f0){return _0x3e4bd5[_0x5887('0xc')](_0x5887('0xd'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd512=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5eccde,_0x48b6a1){var _0x18283b=function(_0x26a8ef){while(--_0x26a8ef){_0x5eccde['push'](_0x5eccde['shift']());}};_0x18283b(++_0x48b6a1);}(_0xd512,0xc7));var _0x2d51=function(_0x473a3c,_0x29ad51){_0x473a3c=_0x473a3c-0x0;var _0x16bbb3=_0xd512[_0x473a3c];return _0x16bbb3;};'use strict';var _=require(_0x2d51('0x0'));var util=require(_0x2d51('0x1'));var logger=require(_0x2d51('0x2'))(_0x2d51('0x3'));var moment=require(_0x2d51('0x4'));var BPromise=require(_0x2d51('0x5'));var rp=require(_0x2d51('0x6'));var fs=require('fs');var path=require(_0x2d51('0x7'));var rimraf=require(_0x2d51('0x8'));var config=require(_0x2d51('0x9'));var attributes=require(_0x2d51('0xa'));var integrations=require(_0x2d51('0xb'));module[_0x2d51('0xc')]=function(_0x194b24,_0x596fb2){return _0x194b24[_0x2d51('0xd')](_0x2d51('0xe'),attributes,{'tableName':_0x2d51('0xf'),'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 37009d3..6887ade 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 _0x3f8c=['jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowVtigerAccount','moment','bluebird','randomstring','ioredis'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1eff34,_0x415087){_0x1eff34=_0x1eff34-0x0;var _0x5015b9=_0x3f8c[_0x1eff34];return _0x5015b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetVtigerAccount',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file +var _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x3add06,_0x1a1967){var _0x55e19e=function(_0x4e0e05){while(--_0x4e0e05){_0x3add06['push'](_0x3add06['shift']());}};_0x55e19e(++_0x1a1967);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a4ad4ff..0f24a41 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 _0xf63b=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fecfa,_0x5720dc){var _0x58532d=function(_0x41e801){while(--_0x41e801){_0x1fecfa['push'](_0x1fecfa['shift']());}};_0x58532d(++_0x5720dc);}(_0xf63b,0xde));var _0xbf63=function(_0x3fe57c,_0x513473){_0x3fe57c=_0x3fe57c-0x0;var _0x26f96e=_0xf63b[_0x3fe57c];return _0x26f96e;};'use strict';var multer=require(_0xbf63('0x0'));var util=require(_0xbf63('0x1'));var path=require(_0xbf63('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf63('0x3'));var router=express[_0xbf63('0x4')]();var fs_extra=require(_0xbf63('0x5'));var auth=require(_0xbf63('0x6'));var interaction=require(_0xbf63('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xbf63('0x8')]('/',auth[_0xbf63('0x9')](),controller[_0xbf63('0xa')]);router['get'](_0xbf63('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xbf63('0xc'),auth['isAuthenticated'](),controller[_0xbf63('0xd')]);router[_0xbf63('0x8')](_0xbf63('0xe'),auth[_0xbf63('0x9')](),controller[_0xbf63('0xf')]);router[_0xbf63('0x8')](_0xbf63('0x10'),auth[_0xbf63('0x9')](),controller[_0xbf63('0x11')]);router[_0xbf63('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbf63('0x13')]('/:id',auth[_0xbf63('0x9')](),controller[_0xbf63('0x14')]);router[_0xbf63('0x15')](_0xbf63('0xb'),auth[_0xbf63('0x9')](),controller['destroy']);module[_0xbf63('0x16')]=router; \ No newline at end of file +var _0xd7ab=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','post','create','put','destroy','exports','multer','util'];(function(_0x1b03dd,_0x289311){var _0xdacd57=function(_0x186c8d){while(--_0x186c8d){_0x1b03dd['push'](_0x1b03dd['shift']());}};_0xdacd57(++_0x289311);}(_0xd7ab,0x12a));var _0xbd7a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd7ab[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xbd7a('0x0'));var util=require(_0xbd7a('0x1'));var path=require('path');var timeout=require(_0xbd7a('0x2'));var express=require(_0xbd7a('0x3'));var router=express[_0xbd7a('0x4')]();var fs_extra=require(_0xbd7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd7a('0x6'));var config=require(_0xbd7a('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0xbd7a('0x8')]('/',auth[_0xbd7a('0x9')](),controller[_0xbd7a('0xa')]);router[_0xbd7a('0x8')](_0xbd7a('0xb'),auth[_0xbd7a('0x9')](),controller[_0xbd7a('0xc')]);router['get'](_0xbd7a('0xd'),auth[_0xbd7a('0x9')](),controller['getFields']);router[_0xbd7a('0x8')]('/:id/subjects',auth[_0xbd7a('0x9')](),controller[_0xbd7a('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbd7a('0xf')]('/',auth[_0xbd7a('0x9')](),controller[_0xbd7a('0x10')]);router[_0xbd7a('0x11')](_0xbd7a('0xb'),auth[_0xbd7a('0x9')](),controller['update']);router['delete'](_0xbd7a('0xb'),auth['isAuthenticated'](),controller[_0xbd7a('0x12')]);module[_0xbd7a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index d4ff932..9700e79 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 _0xd553=['STRING','sequelize'];(function(_0x107ba7,_0x5c808e){var _0x2fefef=function(_0x39c16){while(--_0x39c16){_0x107ba7['push'](_0x107ba7['shift']());}};_0x2fefef(++_0x5c808e);}(_0xd553,0x1e5));var _0x3d55=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xd553[_0x35c5a8];return _0x34782c;};'use strict';var Sequelize=require(_0x3d55('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d55('0x1')]},'description':{'type':Sequelize[_0x3d55('0x1')]}}; \ No newline at end of file +var _0x2f52=['exports','STRING'];(function(_0x39c7bc,_0x52cbca){var _0x3aaed4=function(_0x5a3478){while(--_0x5a3478){_0x39c7bc['push'](_0x39c7bc['shift']());}};_0x3aaed4(++_0x52cbca);}(_0x2f52,0xd2));var _0x22f5=function(_0x208b29,_0x5be5ed){_0x208b29=_0x208b29-0x0;var _0x29fc91=_0x2f52[_0x208b29];return _0x29fc91;};'use strict';var Sequelize=require('sequelize');module[_0x22f5('0x0')]={'name':{'type':Sequelize[_0x22f5('0x1')]},'description':{'type':Sequelize[_0x22f5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3535022..8bc5247 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 _0x1b58=['end','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','includeAll','include','findAll','catch','params','rawAttributes','length','find','create','body','getFields','findOne','VtigerField','options','getSubjects','getDescriptions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x206904,_0x24ca79){var _0x4adeea=function(_0x21001a){while(--_0x21001a){_0x206904['push'](_0x206904['shift']());}};_0x4adeea(++_0x24ca79);}(_0x1b58,0x184));var _0x81b5=function(_0x5d804e,_0x10d70c){_0x5d804e=_0x5d804e-0x0;var _0x199c00=_0x1b58[_0x5d804e];return _0x199c00;};'use strict';var emlformat=require(_0x81b5('0x0'));var rimraf=require(_0x81b5('0x1'));var zipdir=require(_0x81b5('0x2'));var jsonpatch=require(_0x81b5('0x3'));var rp=require(_0x81b5('0x4'));var moment=require(_0x81b5('0x5'));var BPromise=require(_0x81b5('0x6'));var Mustache=require(_0x81b5('0x7'));var util=require(_0x81b5('0x8'));var path=require(_0x81b5('0x9'));var sox=require(_0x81b5('0xa'));var csv=require(_0x81b5('0xb'));var ejs=require(_0x81b5('0xc'));var fs=require('fs');var fs_extra=require(_0x81b5('0xd'));var _=require(_0x81b5('0xe'));var squel=require(_0x81b5('0xf'));var crypto=require(_0x81b5('0x10'));var jsforce=require(_0x81b5('0x11'));var deskjs=require(_0x81b5('0x12'));var toCsv=require('to-csv');var querystring=require(_0x81b5('0x13'));var Papa=require('papaparse');var Redis=require(_0x81b5('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x81b5('0x15'));var hardwareService=require(_0x81b5('0x16'));var logger=require(_0x81b5('0x17'))(_0x81b5('0x18'));var utils=require(_0x81b5('0x19'));var config=require(_0x81b5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x81b5('0x1b'))['db'];function respondWithStatusCode(_0xc2d09,_0x2733fd){_0x2733fd=_0x2733fd||0xcc;return function(_0x178e4b){if(_0x178e4b){return _0xc2d09['sendStatus'](_0x2733fd);}return _0xc2d09[_0x81b5('0x1c')](_0x2733fd)['end']();};}function respondWithResult(_0x1db2db,_0x74bfba){_0x74bfba=_0x74bfba||0xc8;return function(_0x51f456){if(_0x51f456){return _0x1db2db[_0x81b5('0x1c')](_0x74bfba)[_0x81b5('0x1d')](_0x51f456);}};}function respondWithFilteredResult(_0x211fc3,_0x5c5050){return function(_0x4630d5){if(_0x4630d5){var _0x5040fe=typeof _0x5c5050[_0x81b5('0x1e')]===_0x81b5('0x1f')&&typeof _0x5c5050[_0x81b5('0x20')]==='undefined';var _0x55740a=_0x4630d5['count'];var _0x3749d1=_0x5040fe?0x0:_0x5c5050[_0x81b5('0x1e')];var _0x262f1d=_0x5040fe?_0x4630d5[_0x81b5('0x21')]:_0x5c5050[_0x81b5('0x1e')]+_0x5c5050[_0x81b5('0x20')];var _0x533ab4;if(_0x262f1d>=_0x55740a){_0x262f1d=_0x55740a;_0x533ab4=0xc8;}else{_0x533ab4=0xce;}_0x211fc3[_0x81b5('0x1c')](_0x533ab4);return _0x211fc3[_0x81b5('0x22')](_0x81b5('0x23'),_0x3749d1+'-'+_0x262f1d+'/'+_0x55740a)[_0x81b5('0x1d')](_0x4630d5);}return null;};}function patchUpdates(_0x343404){return function(_0x3abc77){try{jsonpatch[_0x81b5('0x24')](_0x3abc77,_0x343404,!![]);}catch(_0x4080ae){return BPromise[_0x81b5('0x25')](_0x4080ae);}return _0x3abc77[_0x81b5('0x26')]();};}function saveUpdates(_0x21864b,_0x46cdf1){return function(_0x4819d5){if(_0x4819d5){return _0x4819d5[_0x81b5('0x27')](_0x21864b)[_0x81b5('0x28')](function(_0x503fc9){return _0x503fc9;});}return null;};}function removeEntity(_0x49edd1,_0x4aaa53){return function(_0x1aabb4){if(_0x1aabb4){return _0x1aabb4[_0x81b5('0x29')]()['then'](function(){_0x49edd1[_0x81b5('0x1c')](0xcc)[_0x81b5('0x2a')]();});}};}function handleEntityNotFound(_0x2b1300,_0x5464cb){return function(_0x264b18){if(!_0x264b18){_0x2b1300[_0x81b5('0x2b')](0x194);}return _0x264b18;};}function handleError(_0x1b02e7,_0x576e2c){_0x576e2c=_0x576e2c||0x1f4;return function(_0x4fcd89){logger[_0x81b5('0x2c')](_0x4fcd89[_0x81b5('0x2d')]);if(_0x4fcd89[_0x81b5('0x2e')]){delete _0x4fcd89[_0x81b5('0x2e')];}_0x1b02e7[_0x81b5('0x1c')](_0x576e2c)[_0x81b5('0x2f')](_0x4fcd89);};}exports[_0x81b5('0x30')]=function(_0x551dbd,_0x20b723){var _0x18b83c={},_0x25fd58={},_0x5e668b={'count':0x0,'rows':[]};var _0x588d53=_[_0x81b5('0x31')](db[_0x81b5('0x32')]['rawAttributes'],function(_0x253b01){return{'name':_0x253b01[_0x81b5('0x33')],'type':_0x253b01['type'][_0x81b5('0x34')]};});_0x25fd58['model']=_[_0x81b5('0x31')](_0x588d53,_0x81b5('0x2e'));_0x25fd58[_0x81b5('0x35')]=_[_0x81b5('0x36')](_0x551dbd['query']);_0x25fd58[_0x81b5('0x37')]=_[_0x81b5('0x38')](_0x25fd58[_0x81b5('0x39')],_0x25fd58[_0x81b5('0x35')]);_0x18b83c[_0x81b5('0x3a')]=_[_0x81b5('0x38')](_0x25fd58[_0x81b5('0x39')],qs['fields'](_0x551dbd[_0x81b5('0x35')][_0x81b5('0x3b')]));_0x18b83c[_0x81b5('0x3a')]=_0x18b83c[_0x81b5('0x3a')]['length']?_0x18b83c[_0x81b5('0x3a')]:_0x25fd58['model'];if(!_0x551dbd['query'][_0x81b5('0x3c')](_0x81b5('0x3d'))){_0x18b83c[_0x81b5('0x20')]=qs[_0x81b5('0x20')](_0x551dbd['query']['limit']);_0x18b83c[_0x81b5('0x1e')]=qs[_0x81b5('0x1e')](_0x551dbd[_0x81b5('0x35')][_0x81b5('0x1e')]);}_0x18b83c[_0x81b5('0x3e')]=qs['sort'](_0x551dbd[_0x81b5('0x35')][_0x81b5('0x3f')]);_0x18b83c[_0x81b5('0x40')]=qs[_0x81b5('0x37')](_['pick'](_0x551dbd[_0x81b5('0x35')],_0x25fd58[_0x81b5('0x37')]),_0x588d53);if(_0x551dbd[_0x81b5('0x35')]['filter']){_0x18b83c['where']=_['merge'](_0x18b83c[_0x81b5('0x40')],{'$or':_[_0x81b5('0x31')](_0x588d53,function(_0x540555){if(_0x540555[_0x81b5('0x41')]!==_0x81b5('0x42')){var _0x195cf5={};_0x195cf5[_0x540555[_0x81b5('0x2e')]]={'$like':'%'+_0x551dbd['query'][_0x81b5('0x43')]+'%'};return _0x195cf5;}})});}_0x18b83c=_[_0x81b5('0x44')]({},_0x18b83c,_0x551dbd['options']);var _0x3008d4={'where':_0x18b83c['where']};return db[_0x81b5('0x32')][_0x81b5('0x21')](_0x3008d4)['then'](function(_0x116ae9){_0x5e668b[_0x81b5('0x21')]=_0x116ae9;if(_0x551dbd[_0x81b5('0x35')][_0x81b5('0x45')]){_0x18b83c[_0x81b5('0x46')]=[{'all':!![]}];}return db[_0x81b5('0x32')][_0x81b5('0x47')](_0x18b83c);})[_0x81b5('0x28')](function(_0x1727ca){_0x5e668b['rows']=_0x1727ca;return _0x5e668b;})[_0x81b5('0x28')](respondWithFilteredResult(_0x20b723,_0x18b83c))[_0x81b5('0x48')](handleError(_0x20b723,null));};exports['show']=function(_0x214f17,_0x5b1c84){var _0x4bd455={'raw':![],'where':{'id':_0x214f17[_0x81b5('0x49')]['id']}},_0x47663a={};_0x47663a[_0x81b5('0x39')]=_[_0x81b5('0x36')](db[_0x81b5('0x32')][_0x81b5('0x4a')]);_0x47663a['query']=_['keys'](_0x214f17[_0x81b5('0x35')]);_0x47663a[_0x81b5('0x37')]=_[_0x81b5('0x38')](_0x47663a[_0x81b5('0x39')],_0x47663a[_0x81b5('0x35')]);_0x4bd455[_0x81b5('0x3a')]=_[_0x81b5('0x38')](_0x47663a[_0x81b5('0x39')],qs[_0x81b5('0x3b')](_0x214f17['query'][_0x81b5('0x3b')]));_0x4bd455['attributes']=_0x4bd455['attributes'][_0x81b5('0x4b')]?_0x4bd455[_0x81b5('0x3a')]:_0x47663a[_0x81b5('0x39')];if(_0x214f17[_0x81b5('0x35')]['includeAll']){_0x4bd455[_0x81b5('0x46')]=[{'all':!![]}];}_0x4bd455=_[_0x81b5('0x44')]({},_0x4bd455,_0x214f17['options']);return db['VtigerConfiguration'][_0x81b5('0x4c')](_0x4bd455)[_0x81b5('0x28')](handleEntityNotFound(_0x5b1c84,null))[_0x81b5('0x28')](respondWithResult(_0x5b1c84,null))[_0x81b5('0x48')](handleError(_0x5b1c84,null));};exports[_0x81b5('0x4d')]=function(_0x5f261c,_0x8aa214){return db['VtigerConfiguration']['create'](_0x5f261c[_0x81b5('0x4e')],{})[_0x81b5('0x28')](respondWithResult(_0x8aa214,0xc9))[_0x81b5('0x48')](handleError(_0x8aa214,null));};exports[_0x81b5('0x27')]=function(_0x174856,_0x30fc19){if(_0x174856[_0x81b5('0x4e')]['id']){delete _0x174856[_0x81b5('0x4e')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x174856['params']['id']}})[_0x81b5('0x28')](handleEntityNotFound(_0x30fc19,null))['then'](saveUpdates(_0x174856['body'],null))[_0x81b5('0x28')](respondWithResult(_0x30fc19,null))[_0x81b5('0x48')](handleError(_0x30fc19,null));};exports[_0x81b5('0x29')]=function(_0x3cc642,_0x251a10){return db[_0x81b5('0x32')][_0x81b5('0x4c')]({'where':{'id':_0x3cc642[_0x81b5('0x49')]['id']}})[_0x81b5('0x28')](handleEntityNotFound(_0x251a10,null))[_0x81b5('0x28')](removeEntity(_0x251a10,null))[_0x81b5('0x48')](handleError(_0x251a10,null));};exports[_0x81b5('0x4f')]=function(_0x472476,_0xe66784,_0x475754){var _0x1dba9e={};var _0x5be630={};var _0x28f882;var _0x376d5d;return db[_0x81b5('0x32')][_0x81b5('0x50')]({'where':{'id':_0x472476['params']['id']}})[_0x81b5('0x28')](handleEntityNotFound(_0xe66784,null))[_0x81b5('0x28')](function(_0x33658f){if(_0x33658f){_0x28f882=_0x33658f;_0x5be630[_0x81b5('0x39')]=_[_0x81b5('0x36')](db[_0x81b5('0x51')][_0x81b5('0x4a')]);_0x5be630['query']=_[_0x81b5('0x36')](_0x472476['query']);_0x5be630['filters']=_[_0x81b5('0x38')](_0x5be630['model'],_0x5be630['query']);_0x1dba9e[_0x81b5('0x3a')]=_[_0x81b5('0x38')](_0x5be630['model'],qs[_0x81b5('0x3b')](_0x472476[_0x81b5('0x35')][_0x81b5('0x3b')]));_0x1dba9e[_0x81b5('0x3a')]=_0x1dba9e[_0x81b5('0x3a')][_0x81b5('0x4b')]?_0x1dba9e[_0x81b5('0x3a')]:_0x5be630['model'];_0x1dba9e['order']=qs['sort'](_0x472476[_0x81b5('0x35')][_0x81b5('0x3f')]);_0x1dba9e[_0x81b5('0x40')]=qs[_0x81b5('0x37')](_['pick'](_0x472476[_0x81b5('0x35')],_0x5be630['filters']));if(_0x472476[_0x81b5('0x35')][_0x81b5('0x43')]){_0x1dba9e[_0x81b5('0x40')]=_[_0x81b5('0x44')](_0x1dba9e[_0x81b5('0x40')],{'$or':_[_0x81b5('0x31')](_0x1dba9e[_0x81b5('0x3a')],function(_0x29cc55){var _0x4611b8={};_0x4611b8[_0x29cc55]={'$like':'%'+_0x472476['query'][_0x81b5('0x43')]+'%'};return _0x4611b8;})});}_0x1dba9e=_['merge']({},_0x1dba9e,_0x472476[_0x81b5('0x52')]);return _0x28f882[_0x81b5('0x4f')](_0x1dba9e);}})[_0x81b5('0x28')](function(_0x16adb0){if(_0x16adb0){_0x376d5d=_0x16adb0[_0x81b5('0x4b')];if(!_0x472476[_0x81b5('0x35')][_0x81b5('0x3c')](_0x81b5('0x3d'))){_0x1dba9e['limit']=qs[_0x81b5('0x20')](_0x472476[_0x81b5('0x35')][_0x81b5('0x20')]);_0x1dba9e['offset']=qs[_0x81b5('0x1e')](_0x472476[_0x81b5('0x35')][_0x81b5('0x1e')]);}return _0x28f882[_0x81b5('0x4f')](_0x1dba9e);}})[_0x81b5('0x28')](function(_0x3d12fe){if(_0x3d12fe){return _0x3d12fe?{'count':_0x376d5d,'rows':_0x3d12fe}:null;}})[_0x81b5('0x28')](respondWithResult(_0xe66784,null))[_0x81b5('0x48')](handleError(_0xe66784,null));};exports[_0x81b5('0x53')]=function(_0x4e6d88,_0x46451d,_0x171fea){var _0x3394c1={};var _0x1b006d={};var _0x2a824f;var _0x5214e3;return db[_0x81b5('0x32')][_0x81b5('0x50')]({'where':{'id':_0x4e6d88['params']['id']}})[_0x81b5('0x28')](handleEntityNotFound(_0x46451d,null))[_0x81b5('0x28')](function(_0x2c5dce){if(_0x2c5dce){_0x2a824f=_0x2c5dce;_0x1b006d[_0x81b5('0x39')]=_[_0x81b5('0x36')](db[_0x81b5('0x51')][_0x81b5('0x4a')]);_0x1b006d['query']=_[_0x81b5('0x36')](_0x4e6d88[_0x81b5('0x35')]);_0x1b006d[_0x81b5('0x37')]=_[_0x81b5('0x38')](_0x1b006d['model'],_0x1b006d[_0x81b5('0x35')]);_0x3394c1[_0x81b5('0x3a')]=_[_0x81b5('0x38')](_0x1b006d['model'],qs[_0x81b5('0x3b')](_0x4e6d88[_0x81b5('0x35')][_0x81b5('0x3b')]));_0x3394c1['attributes']=_0x3394c1[_0x81b5('0x3a')][_0x81b5('0x4b')]?_0x3394c1[_0x81b5('0x3a')]:_0x1b006d['model'];_0x3394c1[_0x81b5('0x3e')]=qs[_0x81b5('0x3f')](_0x4e6d88[_0x81b5('0x35')][_0x81b5('0x3f')]);_0x3394c1[_0x81b5('0x40')]=qs[_0x81b5('0x37')](_['pick'](_0x4e6d88[_0x81b5('0x35')],_0x1b006d[_0x81b5('0x37')]));if(_0x4e6d88[_0x81b5('0x35')][_0x81b5('0x43')]){_0x3394c1['where']=_['merge'](_0x3394c1['where'],{'$or':_[_0x81b5('0x31')](_0x3394c1['attributes'],function(_0x4427c9){var _0x2b9e53={};_0x2b9e53[_0x4427c9]={'$like':'%'+_0x4e6d88[_0x81b5('0x35')]['filter']+'%'};return _0x2b9e53;})});}_0x3394c1=_[_0x81b5('0x44')]({},_0x3394c1,_0x4e6d88[_0x81b5('0x52')]);return _0x2a824f['getSubjects'](_0x3394c1);}})[_0x81b5('0x28')](function(_0x365701){if(_0x365701){_0x5214e3=_0x365701[_0x81b5('0x4b')];if(!_0x4e6d88[_0x81b5('0x35')][_0x81b5('0x3c')](_0x81b5('0x3d'))){_0x3394c1['limit']=qs[_0x81b5('0x20')](_0x4e6d88['query'][_0x81b5('0x20')]);_0x3394c1[_0x81b5('0x1e')]=qs[_0x81b5('0x1e')](_0x4e6d88[_0x81b5('0x35')]['offset']);}return _0x2a824f[_0x81b5('0x53')](_0x3394c1);}})[_0x81b5('0x28')](function(_0x117f70){if(_0x117f70){return _0x117f70?{'count':_0x5214e3,'rows':_0x117f70}:null;}})[_0x81b5('0x28')](respondWithResult(_0x46451d,null))[_0x81b5('0x48')](handleError(_0x46451d,null));};exports[_0x81b5('0x54')]=function(_0x56a9cd,_0x5a1b7b,_0x4c2d21){var _0x47181a={};var _0x330c1d={};var _0xf3a533;var _0x458832;return db[_0x81b5('0x32')]['findOne']({'where':{'id':_0x56a9cd['params']['id']}})['then'](handleEntityNotFound(_0x5a1b7b,null))[_0x81b5('0x28')](function(_0x757d3a){if(_0x757d3a){_0xf3a533=_0x757d3a;_0x330c1d['model']=_[_0x81b5('0x36')](db[_0x81b5('0x51')][_0x81b5('0x4a')]);_0x330c1d['query']=_[_0x81b5('0x36')](_0x56a9cd[_0x81b5('0x35')]);_0x330c1d[_0x81b5('0x37')]=_[_0x81b5('0x38')](_0x330c1d[_0x81b5('0x39')],_0x330c1d['query']);_0x47181a[_0x81b5('0x3a')]=_[_0x81b5('0x38')](_0x330c1d['model'],qs[_0x81b5('0x3b')](_0x56a9cd[_0x81b5('0x35')]['fields']));_0x47181a[_0x81b5('0x3a')]=_0x47181a[_0x81b5('0x3a')][_0x81b5('0x4b')]?_0x47181a[_0x81b5('0x3a')]:_0x330c1d[_0x81b5('0x39')];_0x47181a[_0x81b5('0x3e')]=qs['sort'](_0x56a9cd['query'][_0x81b5('0x3f')]);_0x47181a['where']=qs[_0x81b5('0x37')](_[_0x81b5('0x55')](_0x56a9cd['query'],_0x330c1d[_0x81b5('0x37')]));if(_0x56a9cd[_0x81b5('0x35')][_0x81b5('0x43')]){_0x47181a[_0x81b5('0x40')]=_['merge'](_0x47181a['where'],{'$or':_[_0x81b5('0x31')](_0x47181a['attributes'],function(_0x2f5491){var _0x337b46={};_0x337b46[_0x2f5491]={'$like':'%'+_0x56a9cd[_0x81b5('0x35')][_0x81b5('0x43')]+'%'};return _0x337b46;})});}_0x47181a=_[_0x81b5('0x44')]({},_0x47181a,_0x56a9cd['options']);return _0xf3a533[_0x81b5('0x54')](_0x47181a);}})[_0x81b5('0x28')](function(_0x505895){if(_0x505895){_0x458832=_0x505895[_0x81b5('0x4b')];if(!_0x56a9cd[_0x81b5('0x35')]['hasOwnProperty']('nolimit')){_0x47181a[_0x81b5('0x20')]=qs['limit'](_0x56a9cd[_0x81b5('0x35')][_0x81b5('0x20')]);_0x47181a[_0x81b5('0x1e')]=qs[_0x81b5('0x1e')](_0x56a9cd[_0x81b5('0x35')][_0x81b5('0x1e')]);}return _0xf3a533['getDescriptions'](_0x47181a);}})['then'](function(_0x3b40a4){if(_0x3b40a4){return _0x3b40a4?{'count':_0x458832,'rows':_0x3b40a4}:null;}})[_0x81b5('0x28')](respondWithResult(_0x5a1b7b,null))['catch'](handleError(_0x5a1b7b,null));}; \ No newline at end of file +var _0xb545=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','reject','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','VtigerConfiguration','include','rows','catch','show','keys','merge','find','create','body','params','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4d1cc6,_0x26bebe){var _0x1a6fee=function(_0x374f30){while(--_0x374f30){_0x4d1cc6['push'](_0x4d1cc6['shift']());}};_0x1a6fee(++_0x26bebe);}(_0xb545,0xcf));var _0x5b54=function(_0x243ced,_0x3f73d3){_0x243ced=_0x243ced-0x0;var _0x4cbd19=_0xb545[_0x243ced];return _0x4cbd19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b54('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b54('0x1'));var rp=require(_0x5b54('0x2'));var moment=require(_0x5b54('0x3'));var BPromise=require(_0x5b54('0x4'));var Mustache=require(_0x5b54('0x5'));var util=require('util');var path=require(_0x5b54('0x6'));var sox=require(_0x5b54('0x7'));var csv=require(_0x5b54('0x8'));var ejs=require(_0x5b54('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5b54('0xa'));var crypto=require(_0x5b54('0xb'));var jsforce=require(_0x5b54('0xc'));var deskjs=require(_0x5b54('0xd'));var toCsv=require(_0x5b54('0x8'));var querystring=require(_0x5b54('0xe'));var Papa=require('papaparse');var Redis=require(_0x5b54('0xf'));var authService=require(_0x5b54('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5b54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b54('0x12'))(_0x5b54('0x13'));var utils=require(_0x5b54('0x14'));var config=require(_0x5b54('0x15'));var licenseUtil=require(_0x5b54('0x16'));var db=require(_0x5b54('0x17'))['db'];function respondWithStatusCode(_0x46f2c2,_0x319108){_0x319108=_0x319108||0xcc;return function(_0x5635fd){if(_0x5635fd){return _0x46f2c2['sendStatus'](_0x319108);}return _0x46f2c2['status'](_0x319108)[_0x5b54('0x18')]();};}function respondWithResult(_0x272b62,_0x1c867b){_0x1c867b=_0x1c867b||0xc8;return function(_0x4e33b3){if(_0x4e33b3){return _0x272b62[_0x5b54('0x19')](_0x1c867b)[_0x5b54('0x1a')](_0x4e33b3);}};}function respondWithFilteredResult(_0x459e2f,_0x42b2ee){return function(_0x124abd){if(_0x124abd){var _0x54f56e=typeof _0x42b2ee[_0x5b54('0x1b')]==='undefined'&&typeof _0x42b2ee[_0x5b54('0x1c')]==='undefined';var _0xba7b44=_0x124abd[_0x5b54('0x1d')];var _0x333aaf=_0x54f56e?0x0:_0x42b2ee[_0x5b54('0x1b')];var _0x138360=_0x54f56e?_0x124abd[_0x5b54('0x1d')]:_0x42b2ee[_0x5b54('0x1b')]+_0x42b2ee[_0x5b54('0x1c')];var _0x15e554;if(_0x138360>=_0xba7b44){_0x138360=_0xba7b44;_0x15e554=0xc8;}else{_0x15e554=0xce;}_0x459e2f['status'](_0x15e554);return _0x459e2f[_0x5b54('0x1e')]('Content-Range',_0x333aaf+'-'+_0x138360+'/'+_0xba7b44)['json'](_0x124abd);}return null;};}function patchUpdates(_0x3f933d){return function(_0x4ee99b){try{jsonpatch['apply'](_0x4ee99b,_0x3f933d,!![]);}catch(_0x2689e5){return BPromise[_0x5b54('0x1f')](_0x2689e5);}return _0x4ee99b['save']();};}function saveUpdates(_0x3667fe,_0x5031f7){return function(_0x5c69fc){if(_0x5c69fc){return _0x5c69fc[_0x5b54('0x20')](_0x3667fe)[_0x5b54('0x21')](function(_0x3f529f){return _0x3f529f;});}return null;};}function removeEntity(_0x24d690,_0xb32fae){return function(_0xe954f5){if(_0xe954f5){return _0xe954f5[_0x5b54('0x22')]()[_0x5b54('0x21')](function(){_0x24d690[_0x5b54('0x19')](0xcc)[_0x5b54('0x18')]();});}};}function handleEntityNotFound(_0x55cf53,_0x5b8d07){return function(_0x65deaf){if(!_0x65deaf){_0x55cf53['sendStatus'](0x194);}return _0x65deaf;};}function handleError(_0x7de20,_0x498bc9){_0x498bc9=_0x498bc9||0x1f4;return function(_0x53d55e){logger[_0x5b54('0x23')](_0x53d55e['stack']);if(_0x53d55e[_0x5b54('0x24')]){delete _0x53d55e['name'];}_0x7de20['status'](_0x498bc9)['send'](_0x53d55e);};}exports[_0x5b54('0x25')]=function(_0x161cd0,_0x2fbc17){var _0x47cf2f={},_0x1ed936={},_0x138372={'count':0x0,'rows':[]};var _0x5b8e1a=_[_0x5b54('0x26')](db['VtigerConfiguration'][_0x5b54('0x27')],function(_0xc29324){return{'name':_0xc29324[_0x5b54('0x28')],'type':_0xc29324[_0x5b54('0x29')][_0x5b54('0x2a')]};});_0x1ed936[_0x5b54('0x2b')]=_[_0x5b54('0x26')](_0x5b8e1a,'name');_0x1ed936[_0x5b54('0x2c')]=_['keys'](_0x161cd0[_0x5b54('0x2c')]);_0x1ed936[_0x5b54('0x2d')]=_[_0x5b54('0x2e')](_0x1ed936[_0x5b54('0x2b')],_0x1ed936[_0x5b54('0x2c')]);_0x47cf2f[_0x5b54('0x2f')]=_[_0x5b54('0x2e')](_0x1ed936[_0x5b54('0x2b')],qs[_0x5b54('0x30')](_0x161cd0['query']['fields']));_0x47cf2f[_0x5b54('0x2f')]=_0x47cf2f[_0x5b54('0x2f')][_0x5b54('0x31')]?_0x47cf2f['attributes']:_0x1ed936[_0x5b54('0x2b')];if(!_0x161cd0[_0x5b54('0x2c')][_0x5b54('0x32')]('nolimit')){_0x47cf2f['limit']=qs[_0x5b54('0x1c')](_0x161cd0[_0x5b54('0x2c')]['limit']);_0x47cf2f[_0x5b54('0x1b')]=qs[_0x5b54('0x1b')](_0x161cd0[_0x5b54('0x2c')][_0x5b54('0x1b')]);}_0x47cf2f[_0x5b54('0x33')]=qs[_0x5b54('0x34')](_0x161cd0[_0x5b54('0x2c')][_0x5b54('0x34')]);_0x47cf2f['where']=qs['filters'](_[_0x5b54('0x35')](_0x161cd0[_0x5b54('0x2c')],_0x1ed936[_0x5b54('0x2d')]),_0x5b8e1a);if(_0x161cd0['query'][_0x5b54('0x36')]){_0x47cf2f[_0x5b54('0x37')]=_['merge'](_0x47cf2f[_0x5b54('0x37')],{'$or':_[_0x5b54('0x26')](_0x5b8e1a,function(_0x3a4cb4){if(_0x3a4cb4[_0x5b54('0x29')]!==_0x5b54('0x38')){var _0x21d25f={};_0x21d25f[_0x3a4cb4['name']]={'$like':'%'+_0x161cd0[_0x5b54('0x2c')][_0x5b54('0x36')]+'%'};return _0x21d25f;}})});}_0x47cf2f=_['merge']({},_0x47cf2f,_0x161cd0[_0x5b54('0x39')]);var _0x5d536f={'where':_0x47cf2f[_0x5b54('0x37')]};return db[_0x5b54('0x3a')][_0x5b54('0x1d')](_0x5d536f)['then'](function(_0x5a9717){_0x138372[_0x5b54('0x1d')]=_0x5a9717;if(_0x161cd0[_0x5b54('0x2c')]['includeAll']){_0x47cf2f[_0x5b54('0x3b')]=[{'all':!![]}];}return db[_0x5b54('0x3a')]['findAll'](_0x47cf2f);})[_0x5b54('0x21')](function(_0x42924d){_0x138372[_0x5b54('0x3c')]=_0x42924d;return _0x138372;})['then'](respondWithFilteredResult(_0x2fbc17,_0x47cf2f))[_0x5b54('0x3d')](handleError(_0x2fbc17,null));};exports[_0x5b54('0x3e')]=function(_0x4d48d9,_0x2d71e8){var _0xab236c={'raw':![],'where':{'id':_0x4d48d9['params']['id']}},_0x17c27f={};_0x17c27f[_0x5b54('0x2b')]=_[_0x5b54('0x3f')](db[_0x5b54('0x3a')][_0x5b54('0x27')]);_0x17c27f[_0x5b54('0x2c')]=_['keys'](_0x4d48d9[_0x5b54('0x2c')]);_0x17c27f[_0x5b54('0x2d')]=_[_0x5b54('0x2e')](_0x17c27f[_0x5b54('0x2b')],_0x17c27f['query']);_0xab236c[_0x5b54('0x2f')]=_[_0x5b54('0x2e')](_0x17c27f[_0x5b54('0x2b')],qs[_0x5b54('0x30')](_0x4d48d9[_0x5b54('0x2c')]['fields']));_0xab236c['attributes']=_0xab236c[_0x5b54('0x2f')]['length']?_0xab236c[_0x5b54('0x2f')]:_0x17c27f[_0x5b54('0x2b')];if(_0x4d48d9[_0x5b54('0x2c')]['includeAll']){_0xab236c[_0x5b54('0x3b')]=[{'all':!![]}];}_0xab236c=_[_0x5b54('0x40')]({},_0xab236c,_0x4d48d9['options']);return db['VtigerConfiguration'][_0x5b54('0x41')](_0xab236c)[_0x5b54('0x21')](handleEntityNotFound(_0x2d71e8,null))[_0x5b54('0x21')](respondWithResult(_0x2d71e8,null))[_0x5b54('0x3d')](handleError(_0x2d71e8,null));};exports[_0x5b54('0x42')]=function(_0x150b76,_0x135cba){return db[_0x5b54('0x3a')][_0x5b54('0x42')](_0x150b76[_0x5b54('0x43')],{})['then'](respondWithResult(_0x135cba,0xc9))['catch'](handleError(_0x135cba,null));};exports[_0x5b54('0x20')]=function(_0x213a10,_0xd366f){if(_0x213a10[_0x5b54('0x43')]['id']){delete _0x213a10[_0x5b54('0x43')]['id'];}return db[_0x5b54('0x3a')][_0x5b54('0x41')]({'where':{'id':_0x213a10[_0x5b54('0x44')]['id']}})['then'](handleEntityNotFound(_0xd366f,null))[_0x5b54('0x21')](saveUpdates(_0x213a10[_0x5b54('0x43')],null))[_0x5b54('0x21')](respondWithResult(_0xd366f,null))[_0x5b54('0x3d')](handleError(_0xd366f,null));};exports['destroy']=function(_0x18e448,_0x389136){return db[_0x5b54('0x3a')][_0x5b54('0x41')]({'where':{'id':_0x18e448[_0x5b54('0x44')]['id']}})[_0x5b54('0x21')](handleEntityNotFound(_0x389136,null))[_0x5b54('0x21')](removeEntity(_0x389136,null))[_0x5b54('0x3d')](handleError(_0x389136,null));};exports[_0x5b54('0x45')]=function(_0x3ad829,_0x58211f,_0x15d22a){var _0x1d2403={};var _0x562167={};var _0x1c5597;var _0x3741c2;return db[_0x5b54('0x3a')][_0x5b54('0x46')]({'where':{'id':_0x3ad829[_0x5b54('0x44')]['id']}})[_0x5b54('0x21')](handleEntityNotFound(_0x58211f,null))['then'](function(_0x3e892c){if(_0x3e892c){_0x1c5597=_0x3e892c;_0x562167[_0x5b54('0x2b')]=_[_0x5b54('0x3f')](db[_0x5b54('0x47')]['rawAttributes']);_0x562167[_0x5b54('0x2c')]=_[_0x5b54('0x3f')](_0x3ad829[_0x5b54('0x2c')]);_0x562167[_0x5b54('0x2d')]=_['intersection'](_0x562167[_0x5b54('0x2b')],_0x562167[_0x5b54('0x2c')]);_0x1d2403[_0x5b54('0x2f')]=_[_0x5b54('0x2e')](_0x562167[_0x5b54('0x2b')],qs[_0x5b54('0x30')](_0x3ad829[_0x5b54('0x2c')][_0x5b54('0x30')]));_0x1d2403[_0x5b54('0x2f')]=_0x1d2403[_0x5b54('0x2f')][_0x5b54('0x31')]?_0x1d2403['attributes']:_0x562167[_0x5b54('0x2b')];_0x1d2403['order']=qs[_0x5b54('0x34')](_0x3ad829[_0x5b54('0x2c')]['sort']);_0x1d2403[_0x5b54('0x37')]=qs['filters'](_[_0x5b54('0x35')](_0x3ad829[_0x5b54('0x2c')],_0x562167[_0x5b54('0x2d')]));if(_0x3ad829['query'][_0x5b54('0x36')]){_0x1d2403[_0x5b54('0x37')]=_[_0x5b54('0x40')](_0x1d2403[_0x5b54('0x37')],{'$or':_['map'](_0x1d2403['attributes'],function(_0xa8a79e){var _0x12c9bf={};_0x12c9bf[_0xa8a79e]={'$like':'%'+_0x3ad829[_0x5b54('0x2c')][_0x5b54('0x36')]+'%'};return _0x12c9bf;})});}_0x1d2403=_[_0x5b54('0x40')]({},_0x1d2403,_0x3ad829['options']);return _0x1c5597['getFields'](_0x1d2403);}})[_0x5b54('0x21')](function(_0x304da3){if(_0x304da3){_0x3741c2=_0x304da3['length'];if(!_0x3ad829[_0x5b54('0x2c')][_0x5b54('0x32')](_0x5b54('0x48'))){_0x1d2403['limit']=qs[_0x5b54('0x1c')](_0x3ad829[_0x5b54('0x2c')][_0x5b54('0x1c')]);_0x1d2403['offset']=qs[_0x5b54('0x1b')](_0x3ad829[_0x5b54('0x2c')][_0x5b54('0x1b')]);}return _0x1c5597[_0x5b54('0x45')](_0x1d2403);}})[_0x5b54('0x21')](function(_0x413a2b){if(_0x413a2b){return _0x413a2b?{'count':_0x3741c2,'rows':_0x413a2b}:null;}})[_0x5b54('0x21')](respondWithResult(_0x58211f,null))[_0x5b54('0x3d')](handleError(_0x58211f,null));};exports[_0x5b54('0x49')]=function(_0x5eb104,_0x2d234c,_0x29ea3c){var _0x3a1d9f={};var _0x37fa98={};var _0xc5e520;var _0x47eaf0;return db[_0x5b54('0x3a')][_0x5b54('0x46')]({'where':{'id':_0x5eb104[_0x5b54('0x44')]['id']}})[_0x5b54('0x21')](handleEntityNotFound(_0x2d234c,null))[_0x5b54('0x21')](function(_0x5e0ebc){if(_0x5e0ebc){_0xc5e520=_0x5e0ebc;_0x37fa98[_0x5b54('0x2b')]=_[_0x5b54('0x3f')](db[_0x5b54('0x47')][_0x5b54('0x27')]);_0x37fa98[_0x5b54('0x2c')]=_[_0x5b54('0x3f')](_0x5eb104[_0x5b54('0x2c')]);_0x37fa98['filters']=_['intersection'](_0x37fa98[_0x5b54('0x2b')],_0x37fa98[_0x5b54('0x2c')]);_0x3a1d9f[_0x5b54('0x2f')]=_[_0x5b54('0x2e')](_0x37fa98[_0x5b54('0x2b')],qs[_0x5b54('0x30')](_0x5eb104['query']['fields']));_0x3a1d9f[_0x5b54('0x2f')]=_0x3a1d9f[_0x5b54('0x2f')]['length']?_0x3a1d9f[_0x5b54('0x2f')]:_0x37fa98[_0x5b54('0x2b')];_0x3a1d9f[_0x5b54('0x33')]=qs['sort'](_0x5eb104['query']['sort']);_0x3a1d9f[_0x5b54('0x37')]=qs[_0x5b54('0x2d')](_['pick'](_0x5eb104[_0x5b54('0x2c')],_0x37fa98[_0x5b54('0x2d')]));if(_0x5eb104[_0x5b54('0x2c')][_0x5b54('0x36')]){_0x3a1d9f[_0x5b54('0x37')]=_[_0x5b54('0x40')](_0x3a1d9f[_0x5b54('0x37')],{'$or':_[_0x5b54('0x26')](_0x3a1d9f['attributes'],function(_0x305b85){var _0x2a2b48={};_0x2a2b48[_0x305b85]={'$like':'%'+_0x5eb104[_0x5b54('0x2c')][_0x5b54('0x36')]+'%'};return _0x2a2b48;})});}_0x3a1d9f=_[_0x5b54('0x40')]({},_0x3a1d9f,_0x5eb104['options']);return _0xc5e520[_0x5b54('0x49')](_0x3a1d9f);}})['then'](function(_0x1432e4){if(_0x1432e4){_0x47eaf0=_0x1432e4[_0x5b54('0x31')];if(!_0x5eb104[_0x5b54('0x2c')]['hasOwnProperty'](_0x5b54('0x48'))){_0x3a1d9f[_0x5b54('0x1c')]=qs[_0x5b54('0x1c')](_0x5eb104[_0x5b54('0x2c')][_0x5b54('0x1c')]);_0x3a1d9f[_0x5b54('0x1b')]=qs[_0x5b54('0x1b')](_0x5eb104[_0x5b54('0x2c')]['offset']);}return _0xc5e520['getSubjects'](_0x3a1d9f);}})['then'](function(_0x2be505){if(_0x2be505){return _0x2be505?{'count':_0x47eaf0,'rows':_0x2be505}:null;}})[_0x5b54('0x21')](respondWithResult(_0x2d234c,null))[_0x5b54('0x3d')](handleError(_0x2d234c,null));};exports[_0x5b54('0x4a')]=function(_0x1da347,_0x5ba2fc,_0x35d52f){var _0x72a76d={};var _0x488d2c={};var _0x58a05e;var _0xbb163d;return db['VtigerConfiguration'][_0x5b54('0x46')]({'where':{'id':_0x1da347[_0x5b54('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ba2fc,null))[_0x5b54('0x21')](function(_0x26f607){if(_0x26f607){_0x58a05e=_0x26f607;_0x488d2c[_0x5b54('0x2b')]=_[_0x5b54('0x3f')](db[_0x5b54('0x47')][_0x5b54('0x27')]);_0x488d2c[_0x5b54('0x2c')]=_['keys'](_0x1da347[_0x5b54('0x2c')]);_0x488d2c['filters']=_['intersection'](_0x488d2c['model'],_0x488d2c[_0x5b54('0x2c')]);_0x72a76d[_0x5b54('0x2f')]=_[_0x5b54('0x2e')](_0x488d2c[_0x5b54('0x2b')],qs[_0x5b54('0x30')](_0x1da347['query'][_0x5b54('0x30')]));_0x72a76d['attributes']=_0x72a76d['attributes'][_0x5b54('0x31')]?_0x72a76d[_0x5b54('0x2f')]:_0x488d2c['model'];_0x72a76d['order']=qs[_0x5b54('0x34')](_0x1da347['query']['sort']);_0x72a76d[_0x5b54('0x37')]=qs['filters'](_[_0x5b54('0x35')](_0x1da347[_0x5b54('0x2c')],_0x488d2c[_0x5b54('0x2d')]));if(_0x1da347['query'][_0x5b54('0x36')]){_0x72a76d[_0x5b54('0x37')]=_[_0x5b54('0x40')](_0x72a76d[_0x5b54('0x37')],{'$or':_[_0x5b54('0x26')](_0x72a76d['attributes'],function(_0x525713){var _0x18613e={};_0x18613e[_0x525713]={'$like':'%'+_0x1da347['query'][_0x5b54('0x36')]+'%'};return _0x18613e;})});}_0x72a76d=_[_0x5b54('0x40')]({},_0x72a76d,_0x1da347[_0x5b54('0x39')]);return _0x58a05e['getDescriptions'](_0x72a76d);}})[_0x5b54('0x21')](function(_0xdd4b68){if(_0xdd4b68){_0xbb163d=_0xdd4b68[_0x5b54('0x31')];if(!_0x1da347[_0x5b54('0x2c')][_0x5b54('0x32')]('nolimit')){_0x72a76d['limit']=qs[_0x5b54('0x1c')](_0x1da347['query'][_0x5b54('0x1c')]);_0x72a76d[_0x5b54('0x1b')]=qs[_0x5b54('0x1b')](_0x1da347[_0x5b54('0x2c')]['offset']);}return _0x58a05e[_0x5b54('0x4a')](_0x72a76d);}})['then'](function(_0x560a5c){if(_0x560a5c){return _0x560a5c?{'count':_0xbb163d,'rows':_0x560a5c}:null;}})[_0x5b54('0x21')](respondWithResult(_0x5ba2fc,null))[_0x5b54('0x3d')](handleError(_0x5ba2fc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 00e8f44..1ab449a 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 _0x1929=['exports','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x109685,_0x444ba7){var _0x4c8b3c=function(_0x479393){while(--_0x479393){_0x109685['push'](_0x109685['shift']());}};_0x4c8b3c(++_0x444ba7);}(_0x1929,0x1d0));var _0x9192=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x1929[_0x695b76];return _0x1dc21f;};'use strict';var _=require(_0x9192('0x0'));var util=require(_0x9192('0x1'));var logger=require(_0x9192('0x2'))(_0x9192('0x3'));var moment=require('moment');var BPromise=require(_0x9192('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9192('0x5'));var rimraf=require(_0x9192('0x6'));var config=require(_0x9192('0x7'));var attributes=require(_0x9192('0x8'));module[_0x9192('0x9')]=function(_0x5f521d,_0x2a21cf){return _0x5f521d['define']('VtigerConfiguration',attributes,{'tableName':_0x9192('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2c6=['define','VtigerConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xa2c6,0x15e));var _0x6a2c=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xa2c6[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x6a2c('0x0'));var util=require(_0x6a2c('0x1'));var logger=require('../../config/logger')(_0x6a2c('0x2'));var moment=require(_0x6a2c('0x3'));var BPromise=require(_0x6a2c('0x4'));var rp=require(_0x6a2c('0x5'));var fs=require('fs');var path=require(_0x6a2c('0x6'));var rimraf=require(_0x6a2c('0x7'));var config=require(_0x6a2c('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x6a2c('0x9')]=function(_0x2b881c,_0x1b1dd4){return _0x2b881c[_0x6a2c('0xa')](_0x6a2c('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index b081eff..f3a97ff 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 _0xb81e=['code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb81e,0x194));var _0xeb81=function(_0x54fff5,_0x308889){_0x54fff5=_0x54fff5-0x0;var _0x7198fb=_0xb81e[_0x54fff5];return _0x7198fb;};'use strict';var _=require(_0xeb81('0x0'));var util=require(_0xeb81('0x1'));var moment=require(_0xeb81('0x2'));var BPromise=require(_0xeb81('0x3'));var rs=require(_0xeb81('0x4'));var fs=require('fs');var Redis=require(_0xeb81('0x5'));var db=require(_0xeb81('0x6'))['db'];var utils=require(_0xeb81('0x7'));var logger=require(_0xeb81('0x8'))(_0xeb81('0x9'));var config=require(_0xeb81('0xa'));var jayson=require(_0xeb81('0xb'));var client=jayson[_0xeb81('0xc')][_0xeb81('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4044f0,_0x27bd7b,_0x5c23c5){return new BPromise(function(_0x4e03ae,_0x9a7527){return client['request'](_0x4044f0,_0x5c23c5)[_0xeb81('0xe')](function(_0x2d1dff){logger['info'](_0xeb81('0xf'),_0x27bd7b,'request\x20sent');logger[_0xeb81('0x10')](_0xeb81('0x11'),_0x27bd7b,_0xeb81('0x12'),JSON[_0xeb81('0x13')](_0x2d1dff));if(_0x2d1dff[_0xeb81('0x14')]){if(_0x2d1dff[_0xeb81('0x14')][_0xeb81('0x15')]===0x1f4){logger[_0xeb81('0x14')](_0xeb81('0xf'),_0x27bd7b,_0x2d1dff[_0xeb81('0x14')][_0xeb81('0x16')]);return _0x9a7527(_0x2d1dff[_0xeb81('0x14')][_0xeb81('0x16')]);}logger['error'](_0xeb81('0xf'),_0x27bd7b,_0x2d1dff['error'][_0xeb81('0x16')]);return _0x4e03ae(_0x2d1dff['error']['message']);}else{logger[_0xeb81('0x17')](_0xeb81('0xf'),_0x27bd7b,_0xeb81('0x12'));_0x4e03ae(_0x2d1dff['result']['message']);}})[_0xeb81('0x18')](function(_0x54f163){logger[_0xeb81('0x14')](_0xeb81('0xf'),_0x27bd7b,_0x54f163);_0x9a7527(_0x54f163);});});} \ No newline at end of file +var _0xf314=['http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xf314,0xa9));var _0x4f31=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xf314[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x4f31('0x0'));var util=require(_0x4f31('0x1'));var moment=require(_0x4f31('0x2'));var BPromise=require(_0x4f31('0x3'));var rs=require(_0x4f31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f31('0x5'))['db'];var utils=require(_0x4f31('0x6'));var logger=require(_0x4f31('0x7'))('rpc');var config=require(_0x4f31('0x8'));var jayson=require(_0x4f31('0x9'));var client=jayson[_0x4f31('0xa')][_0x4f31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2445e9,_0x5d5f6a,_0x1d4b95){return new BPromise(function(_0x24fea9,_0xbfe0ca){return client[_0x4f31('0xc')](_0x2445e9,_0x1d4b95)['then'](function(_0x2d0411){logger[_0x4f31('0xd')](_0x4f31('0xe'),_0x5d5f6a,_0x4f31('0xf'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5d5f6a,_0x4f31('0xf'),JSON[_0x4f31('0x10')](_0x2d0411));if(_0x2d0411[_0x4f31('0x11')]){if(_0x2d0411[_0x4f31('0x11')]['code']===0x1f4){logger['error'](_0x4f31('0xe'),_0x5d5f6a,_0x2d0411[_0x4f31('0x11')][_0x4f31('0x12')]);return _0xbfe0ca(_0x2d0411['error']['message']);}logger[_0x4f31('0x11')](_0x4f31('0xe'),_0x5d5f6a,_0x2d0411['error'][_0x4f31('0x12')]);return _0x24fea9(_0x2d0411[_0x4f31('0x11')][_0x4f31('0x12')]);}else{logger[_0x4f31('0xd')](_0x4f31('0xe'),_0x5d5f6a,_0x4f31('0xf'));_0x24fea9(_0x2d0411['result'][_0x4f31('0x12')]);}})[_0x4f31('0x13')](function(_0x350d32){logger[_0x4f31('0x11')](_0x4f31('0xe'),_0x5d5f6a,_0x350d32);_0xbfe0ca(_0x350d32);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 616bcd7..6c23f8d 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 _0xf35b=['isAuthenticated','index','/:id','show','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x2aba39,_0x3d2062){var _0x1adbe8=function(_0x4469e5){while(--_0x4469e5){_0x2aba39['push'](_0x2aba39['shift']());}};_0x1adbe8(++_0x3d2062);}(_0xf35b,0x1c3));var _0xbf35=function(_0x131932,_0x2312e9){_0x131932=_0x131932-0x0;var _0x2e20e2=_0xf35b[_0x131932];return _0x2e20e2;};'use strict';var multer=require('multer');var util=require(_0xbf35('0x0'));var path=require(_0xbf35('0x1'));var timeout=require(_0xbf35('0x2'));var express=require(_0xbf35('0x3'));var router=express[_0xbf35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf35('0x6'));var controller=require('./intVtigerField.controller');router[_0xbf35('0x7')]('/',auth[_0xbf35('0x8')](),controller[_0xbf35('0x9')]);router[_0xbf35('0x7')](_0xbf35('0xa'),auth[_0xbf35('0x8')](),controller[_0xbf35('0xb')]);router[_0xbf35('0xc')]('/',auth[_0xbf35('0x8')](),controller['create']);router[_0xbf35('0xd')](_0xbf35('0xa'),auth[_0xbf35('0x8')](),controller[_0xbf35('0xe')]);router[_0xbf35('0xf')](_0xbf35('0xa'),auth[_0xbf35('0x8')](),controller['destroy']);module[_0xbf35('0x10')]=router; \ No newline at end of file +var _0x7058=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x30a4d0,_0x42190f){var _0x24e6f3=function(_0x71d633){while(--_0x71d633){_0x30a4d0['push'](_0x30a4d0['shift']());}};_0x24e6f3(++_0x42190f);}(_0x7058,0x156));var _0x8705=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x7058[_0x59d89e];return _0x554e93;};'use strict';var multer=require('multer');var util=require(_0x8705('0x0'));var path=require(_0x8705('0x1'));var timeout=require(_0x8705('0x2'));var express=require(_0x8705('0x3'));var router=express[_0x8705('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8705('0x5'));var config=require(_0x8705('0x6'));var controller=require(_0x8705('0x7'));router[_0x8705('0x8')]('/',auth[_0x8705('0x9')](),controller[_0x8705('0xa')]);router['get'](_0x8705('0xb'),auth[_0x8705('0x9')](),controller['show']);router[_0x8705('0xc')]('/',auth[_0x8705('0x9')](),controller['create']);router[_0x8705('0xd')](_0x8705('0xb'),auth[_0x8705('0x9')](),controller[_0x8705('0xe')]);router[_0x8705('0xf')](_0x8705('0xb'),auth[_0x8705('0x9')](),controller[_0x8705('0x10')]);module[_0x8705('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 e17a7b4..2eceedf 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 _0x4918=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x3692a9,_0xb15338){var _0x1f7696=function(_0xe2907a){while(--_0xe2907a){_0x3692a9['push'](_0x3692a9['shift']());}};_0x1f7696(++_0xb15338);}(_0x4918,0x74));var _0x8491=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x4918[_0x27530d];return _0x59e561;};'use strict';var Sequelize=require(_0x8491('0x0'));module[_0x8491('0x1')]={'type':{'type':Sequelize[_0x8491('0x2')](_0x8491('0x3'),_0x8491('0x4'),_0x8491('0x5'),'keyValue',_0x8491('0x6')),'defaultValue':_0x8491('0x3')},'content':{'type':Sequelize[_0x8491('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8491('0x2')](_0x8491('0x3'),_0x8491('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8491('0x7')]},'idField':{'type':Sequelize[_0x8491('0x7')]},'nameField':{'type':Sequelize[_0x8491('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8491('0x7')]}}; \ No newline at end of file +var _0xa551=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','exports','ENUM','variable'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xa551,0x14a));var _0x1a55=function(_0x386435,_0x265915){_0x386435=_0x386435-0x0;var _0x3df179=_0xa551[_0x386435];return _0x3df179;};'use strict';var Sequelize=require('sequelize');module[_0x1a55('0x0')]={'type':{'type':Sequelize[_0x1a55('0x1')]('string',_0x1a55('0x2'),'customVariable',_0x1a55('0x3'),_0x1a55('0x4')),'defaultValue':_0x1a55('0x5')},'content':{'type':Sequelize[_0x1a55('0x6')]},'key':{'type':Sequelize[_0x1a55('0x6')]},'keyType':{'type':Sequelize[_0x1a55('0x1')](_0x1a55('0x5'),_0x1a55('0x2'),_0x1a55('0x7'))},'keyContent':{'type':Sequelize[_0x1a55('0x6')]},'idField':{'type':Sequelize[_0x1a55('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1a55('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a55('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9fc3abd..3ccb3d2 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 _0x5be4=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','VtigerField','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x3118eb,_0x386259){var _0x3166f3=function(_0x3e99f3){while(--_0x3e99f3){_0x3118eb['push'](_0x3118eb['shift']());}};_0x3166f3(++_0x386259);}(_0x5be4,0x1eb));var _0x45be=function(_0x1dcb51,_0x261645){_0x1dcb51=_0x1dcb51-0x0;var _0x416444=_0x5be4[_0x1dcb51];return _0x416444;};'use strict';var emlformat=require(_0x45be('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x45be('0x1'));var rp=require(_0x45be('0x2'));var moment=require(_0x45be('0x3'));var BPromise=require(_0x45be('0x4'));var Mustache=require(_0x45be('0x5'));var util=require(_0x45be('0x6'));var path=require('path');var sox=require(_0x45be('0x7'));var csv=require(_0x45be('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45be('0x9'));var _=require(_0x45be('0xa'));var squel=require(_0x45be('0xb'));var crypto=require(_0x45be('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x45be('0xd'));var toCsv=require(_0x45be('0x8'));var querystring=require(_0x45be('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45be('0xf'));var qs=require(_0x45be('0x10'));var as=require(_0x45be('0x11'));var hardwareService=require(_0x45be('0x12'));var logger=require(_0x45be('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x45be('0x14'));var licenseUtil=require(_0x45be('0x15'));var db=require(_0x45be('0x16'))['db'];function respondWithStatusCode(_0x3e891d,_0x7e2d1c){_0x7e2d1c=_0x7e2d1c||0xcc;return function(_0x4edecc){if(_0x4edecc){return _0x3e891d[_0x45be('0x17')](_0x7e2d1c);}return _0x3e891d[_0x45be('0x18')](_0x7e2d1c)[_0x45be('0x19')]();};}function respondWithResult(_0x3601a2,_0x35070e){_0x35070e=_0x35070e||0xc8;return function(_0x1f8247){if(_0x1f8247){return _0x3601a2[_0x45be('0x18')](_0x35070e)[_0x45be('0x1a')](_0x1f8247);}};}function respondWithFilteredResult(_0x25724a,_0x98d5ab){return function(_0x30661f){if(_0x30661f){var _0x230260=typeof _0x98d5ab[_0x45be('0x1b')]===_0x45be('0x1c')&&typeof _0x98d5ab[_0x45be('0x1d')]===_0x45be('0x1c');var _0x149cf1=_0x30661f[_0x45be('0x1e')];var _0x3ab5f6=_0x230260?0x0:_0x98d5ab[_0x45be('0x1b')];var _0x33d164=_0x230260?_0x30661f[_0x45be('0x1e')]:_0x98d5ab['offset']+_0x98d5ab[_0x45be('0x1d')];var _0x3b994e;if(_0x33d164>=_0x149cf1){_0x33d164=_0x149cf1;_0x3b994e=0xc8;}else{_0x3b994e=0xce;}_0x25724a[_0x45be('0x18')](_0x3b994e);return _0x25724a[_0x45be('0x1f')](_0x45be('0x20'),_0x3ab5f6+'-'+_0x33d164+'/'+_0x149cf1)[_0x45be('0x1a')](_0x30661f);}return null;};}function patchUpdates(_0x1e2550){return function(_0x4e0cae){try{jsonpatch[_0x45be('0x21')](_0x4e0cae,_0x1e2550,!![]);}catch(_0x28fac4){return BPromise[_0x45be('0x22')](_0x28fac4);}return _0x4e0cae[_0x45be('0x23')]();};}function saveUpdates(_0x5e617,_0x4b6dc7){return function(_0x36abda){if(_0x36abda){return _0x36abda[_0x45be('0x24')](_0x5e617)[_0x45be('0x25')](function(_0xcaa219){return _0xcaa219;});}return null;};}function removeEntity(_0x26ee3b,_0x5bc581){return function(_0x5c2029){if(_0x5c2029){return _0x5c2029[_0x45be('0x26')]()[_0x45be('0x25')](function(){_0x26ee3b['status'](0xcc)[_0x45be('0x19')]();});}};}function handleEntityNotFound(_0x403f1e,_0x5a0287){return function(_0x323686){if(!_0x323686){_0x403f1e[_0x45be('0x17')](0x194);}return _0x323686;};}function handleError(_0x5e0d89,_0xb24eec){_0xb24eec=_0xb24eec||0x1f4;return function(_0x484cb8){logger[_0x45be('0x27')](_0x484cb8['stack']);if(_0x484cb8['name']){delete _0x484cb8[_0x45be('0x28')];}_0x5e0d89[_0x45be('0x18')](_0xb24eec)['send'](_0x484cb8);};}exports[_0x45be('0x29')]=function(_0x452261,_0x11cbf5){var _0x3befe9={},_0x56c598={},_0x23f9f8={'count':0x0,'rows':[]};var _0x1f4264=_['map'](db['VtigerField'][_0x45be('0x2a')],function(_0x1d13cd){return{'name':_0x1d13cd['fieldName'],'type':_0x1d13cd[_0x45be('0x2b')][_0x45be('0x2c')]};});_0x56c598['model']=_['map'](_0x1f4264,'name');_0x56c598[_0x45be('0x2d')]=_['keys'](_0x452261['query']);_0x56c598[_0x45be('0x2e')]=_[_0x45be('0x2f')](_0x56c598['model'],_0x56c598[_0x45be('0x2d')]);_0x3befe9['attributes']=_[_0x45be('0x2f')](_0x56c598[_0x45be('0x30')],qs[_0x45be('0x31')](_0x452261[_0x45be('0x2d')][_0x45be('0x31')]));_0x3befe9['attributes']=_0x3befe9[_0x45be('0x32')]['length']?_0x3befe9[_0x45be('0x32')]:_0x56c598[_0x45be('0x30')];if(!_0x452261[_0x45be('0x2d')][_0x45be('0x33')](_0x45be('0x34'))){_0x3befe9['limit']=qs[_0x45be('0x1d')](_0x452261[_0x45be('0x2d')]['limit']);_0x3befe9[_0x45be('0x1b')]=qs['offset'](_0x452261[_0x45be('0x2d')][_0x45be('0x1b')]);}_0x3befe9[_0x45be('0x35')]=qs[_0x45be('0x36')](_0x452261[_0x45be('0x2d')]['sort']);_0x3befe9[_0x45be('0x37')]=qs[_0x45be('0x2e')](_[_0x45be('0x38')](_0x452261[_0x45be('0x2d')],_0x56c598['filters']),_0x1f4264);if(_0x452261[_0x45be('0x2d')][_0x45be('0x39')]){_0x3befe9['where']=_[_0x45be('0x3a')](_0x3befe9[_0x45be('0x37')],{'$or':_[_0x45be('0x3b')](_0x1f4264,function(_0x1962a1){if(_0x1962a1[_0x45be('0x2b')]!=='VIRTUAL'){var _0x5413d3={};_0x5413d3[_0x1962a1['name']]={'$like':'%'+_0x452261[_0x45be('0x2d')]['filter']+'%'};return _0x5413d3;}})});}_0x3befe9=_[_0x45be('0x3a')]({},_0x3befe9,_0x452261[_0x45be('0x3c')]);var _0x223a90={'where':_0x3befe9['where']};return db[_0x45be('0x3d')]['count'](_0x223a90)[_0x45be('0x25')](function(_0x193188){_0x23f9f8[_0x45be('0x1e')]=_0x193188;if(_0x452261[_0x45be('0x2d')][_0x45be('0x3e')]){_0x3befe9[_0x45be('0x3f')]=[{'all':!![]}];}return db[_0x45be('0x3d')][_0x45be('0x40')](_0x3befe9);})['then'](function(_0x94c88f){_0x23f9f8['rows']=_0x94c88f;return _0x23f9f8;})[_0x45be('0x25')](respondWithFilteredResult(_0x11cbf5,_0x3befe9))[_0x45be('0x41')](handleError(_0x11cbf5,null));};exports[_0x45be('0x42')]=function(_0x362d9a,_0x3cb09a){var _0x5d8001={'raw':!![],'where':{'id':_0x362d9a[_0x45be('0x43')]['id']}},_0x155d17={};_0x155d17[_0x45be('0x30')]=_[_0x45be('0x44')](db[_0x45be('0x3d')][_0x45be('0x2a')]);_0x155d17['query']=_['keys'](_0x362d9a[_0x45be('0x2d')]);_0x155d17[_0x45be('0x2e')]=_[_0x45be('0x2f')](_0x155d17[_0x45be('0x30')],_0x155d17['query']);_0x5d8001['attributes']=_['intersection'](_0x155d17['model'],qs[_0x45be('0x31')](_0x362d9a['query'][_0x45be('0x31')]));_0x5d8001[_0x45be('0x32')]=_0x5d8001[_0x45be('0x32')]['length']?_0x5d8001[_0x45be('0x32')]:_0x155d17['model'];if(_0x362d9a[_0x45be('0x2d')]['includeAll']){_0x5d8001[_0x45be('0x3f')]=[{'all':!![]}];}_0x5d8001=_['merge']({},_0x5d8001,_0x362d9a[_0x45be('0x3c')]);return db['VtigerField'][_0x45be('0x45')](_0x5d8001)['then'](handleEntityNotFound(_0x3cb09a,null))['then'](respondWithResult(_0x3cb09a,null))['catch'](handleError(_0x3cb09a,null));};exports['create']=function(_0x3eb760,_0x325496){return db['VtigerField'][_0x45be('0x46')](_0x3eb760[_0x45be('0x47')],{})[_0x45be('0x25')](respondWithResult(_0x325496,0xc9))[_0x45be('0x41')](handleError(_0x325496,null));};exports[_0x45be('0x24')]=function(_0x50d6e7,_0x181ed6){if(_0x50d6e7[_0x45be('0x47')]['id']){delete _0x50d6e7[_0x45be('0x47')]['id'];}return db[_0x45be('0x3d')]['find']({'where':{'id':_0x50d6e7[_0x45be('0x43')]['id']}})[_0x45be('0x25')](handleEntityNotFound(_0x181ed6,null))[_0x45be('0x25')](saveUpdates(_0x50d6e7[_0x45be('0x47')],null))[_0x45be('0x25')](respondWithResult(_0x181ed6,null))[_0x45be('0x41')](handleError(_0x181ed6,null));};exports[_0x45be('0x26')]=function(_0x293f5e,_0x3d2763){return db[_0x45be('0x3d')][_0x45be('0x45')]({'where':{'id':_0x293f5e['params']['id']}})[_0x45be('0x25')](handleEntityNotFound(_0x3d2763,null))['then'](removeEntity(_0x3d2763,null))[_0x45be('0x41')](handleError(_0x3d2763,null));}; \ No newline at end of file +var _0xb38d=['options','includeAll','VtigerField','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x14c8c2,_0x553b1b){var _0x48b38c=function(_0x1f3393){while(--_0x1f3393){_0x14c8c2['push'](_0x14c8c2['shift']());}};_0x48b38c(++_0x553b1b);}(_0xb38d,0xff));var _0xdb38=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0xb38d[_0x2c93e2];return _0x57264e;};'use strict';var emlformat=require(_0xdb38('0x0'));var rimraf=require(_0xdb38('0x1'));var zipdir=require(_0xdb38('0x2'));var jsonpatch=require(_0xdb38('0x3'));var rp=require(_0xdb38('0x4'));var moment=require(_0xdb38('0x5'));var BPromise=require(_0xdb38('0x6'));var Mustache=require(_0xdb38('0x7'));var util=require(_0xdb38('0x8'));var path=require(_0xdb38('0x9'));var sox=require(_0xdb38('0xa'));var csv=require(_0xdb38('0xb'));var ejs=require(_0xdb38('0xc'));var fs=require('fs');var fs_extra=require(_0xdb38('0xd'));var _=require('lodash');var squel=require(_0xdb38('0xe'));var crypto=require(_0xdb38('0xf'));var jsforce=require(_0xdb38('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb38('0x11'));var Papa=require('papaparse');var Redis=require(_0xdb38('0x12'));var authService=require(_0xdb38('0x13'));var qs=require(_0xdb38('0x14'));var as=require(_0xdb38('0x15'));var hardwareService=require(_0xdb38('0x16'));var logger=require(_0xdb38('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xdb38('0x18'));var licenseUtil=require(_0xdb38('0x19'));var db=require(_0xdb38('0x1a'))['db'];function respondWithStatusCode(_0xb896f5,_0x277ffe){_0x277ffe=_0x277ffe||0xcc;return function(_0x3d1504){if(_0x3d1504){return _0xb896f5['sendStatus'](_0x277ffe);}return _0xb896f5[_0xdb38('0x1b')](_0x277ffe)['end']();};}function respondWithResult(_0x4990de,_0x1a9dc6){_0x1a9dc6=_0x1a9dc6||0xc8;return function(_0x488a99){if(_0x488a99){return _0x4990de[_0xdb38('0x1b')](_0x1a9dc6)[_0xdb38('0x1c')](_0x488a99);}};}function respondWithFilteredResult(_0x3f57d1,_0x34524a){return function(_0x1e8338){if(_0x1e8338){var _0x11d1f7=typeof _0x34524a[_0xdb38('0x1d')]===_0xdb38('0x1e')&&typeof _0x34524a[_0xdb38('0x1f')]==='undefined';var _0x254f30=_0x1e8338[_0xdb38('0x20')];var _0x828c3b=_0x11d1f7?0x0:_0x34524a[_0xdb38('0x1d')];var _0x26c1c7=_0x11d1f7?_0x1e8338['count']:_0x34524a[_0xdb38('0x1d')]+_0x34524a[_0xdb38('0x1f')];var _0x4e7e06;if(_0x26c1c7>=_0x254f30){_0x26c1c7=_0x254f30;_0x4e7e06=0xc8;}else{_0x4e7e06=0xce;}_0x3f57d1[_0xdb38('0x1b')](_0x4e7e06);return _0x3f57d1[_0xdb38('0x21')](_0xdb38('0x22'),_0x828c3b+'-'+_0x26c1c7+'/'+_0x254f30)[_0xdb38('0x1c')](_0x1e8338);}return null;};}function patchUpdates(_0x24c00b){return function(_0x3ec580){try{jsonpatch[_0xdb38('0x23')](_0x3ec580,_0x24c00b,!![]);}catch(_0x42effa){return BPromise[_0xdb38('0x24')](_0x42effa);}return _0x3ec580[_0xdb38('0x25')]();};}function saveUpdates(_0x3ed470,_0x38af8d){return function(_0x3c1b91){if(_0x3c1b91){return _0x3c1b91[_0xdb38('0x26')](_0x3ed470)['then'](function(_0x26a91c){return _0x26a91c;});}return null;};}function removeEntity(_0x27fc24,_0x29c115){return function(_0x321079){if(_0x321079){return _0x321079[_0xdb38('0x27')]()[_0xdb38('0x28')](function(){_0x27fc24[_0xdb38('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fe7d4,_0x3ed2e7){return function(_0xb173dd){if(!_0xb173dd){_0x2fe7d4[_0xdb38('0x29')](0x194);}return _0xb173dd;};}function handleError(_0x1e9a2d,_0x382d5d){_0x382d5d=_0x382d5d||0x1f4;return function(_0x5e8928){logger[_0xdb38('0x2a')](_0x5e8928[_0xdb38('0x2b')]);if(_0x5e8928[_0xdb38('0x2c')]){delete _0x5e8928[_0xdb38('0x2c')];}_0x1e9a2d[_0xdb38('0x1b')](_0x382d5d)[_0xdb38('0x2d')](_0x5e8928);};}exports[_0xdb38('0x2e')]=function(_0x485e0b,_0x2505bc){var _0x16f59d={},_0x3f3b2f={},_0x2f4679={'count':0x0,'rows':[]};var _0x5a1d86=_['map'](db['VtigerField'][_0xdb38('0x2f')],function(_0x2f12d1){return{'name':_0x2f12d1[_0xdb38('0x30')],'type':_0x2f12d1['type'][_0xdb38('0x31')]};});_0x3f3b2f[_0xdb38('0x32')]=_[_0xdb38('0x33')](_0x5a1d86,_0xdb38('0x2c'));_0x3f3b2f['query']=_[_0xdb38('0x34')](_0x485e0b[_0xdb38('0x35')]);_0x3f3b2f[_0xdb38('0x36')]=_['intersection'](_0x3f3b2f[_0xdb38('0x32')],_0x3f3b2f['query']);_0x16f59d[_0xdb38('0x37')]=_[_0xdb38('0x38')](_0x3f3b2f[_0xdb38('0x32')],qs[_0xdb38('0x39')](_0x485e0b[_0xdb38('0x35')][_0xdb38('0x39')]));_0x16f59d['attributes']=_0x16f59d[_0xdb38('0x37')][_0xdb38('0x3a')]?_0x16f59d['attributes']:_0x3f3b2f[_0xdb38('0x32')];if(!_0x485e0b[_0xdb38('0x35')][_0xdb38('0x3b')](_0xdb38('0x3c'))){_0x16f59d[_0xdb38('0x1f')]=qs[_0xdb38('0x1f')](_0x485e0b[_0xdb38('0x35')]['limit']);_0x16f59d[_0xdb38('0x1d')]=qs['offset'](_0x485e0b['query'][_0xdb38('0x1d')]);}_0x16f59d[_0xdb38('0x3d')]=qs[_0xdb38('0x3e')](_0x485e0b[_0xdb38('0x35')][_0xdb38('0x3e')]);_0x16f59d[_0xdb38('0x3f')]=qs[_0xdb38('0x36')](_[_0xdb38('0x40')](_0x485e0b[_0xdb38('0x35')],_0x3f3b2f['filters']),_0x5a1d86);if(_0x485e0b[_0xdb38('0x35')][_0xdb38('0x41')]){_0x16f59d[_0xdb38('0x3f')]=_[_0xdb38('0x42')](_0x16f59d[_0xdb38('0x3f')],{'$or':_[_0xdb38('0x33')](_0x5a1d86,function(_0x3e4260){if(_0x3e4260[_0xdb38('0x43')]!==_0xdb38('0x44')){var _0x144800={};_0x144800[_0x3e4260[_0xdb38('0x2c')]]={'$like':'%'+_0x485e0b[_0xdb38('0x35')][_0xdb38('0x41')]+'%'};return _0x144800;}})});}_0x16f59d=_['merge']({},_0x16f59d,_0x485e0b[_0xdb38('0x45')]);var _0xc4c752={'where':_0x16f59d[_0xdb38('0x3f')]};return db['VtigerField'][_0xdb38('0x20')](_0xc4c752)[_0xdb38('0x28')](function(_0x4aa0bf){_0x2f4679[_0xdb38('0x20')]=_0x4aa0bf;if(_0x485e0b[_0xdb38('0x35')][_0xdb38('0x46')]){_0x16f59d['include']=[{'all':!![]}];}return db[_0xdb38('0x47')][_0xdb38('0x48')](_0x16f59d);})[_0xdb38('0x28')](function(_0x301060){_0x2f4679[_0xdb38('0x49')]=_0x301060;return _0x2f4679;})['then'](respondWithFilteredResult(_0x2505bc,_0x16f59d))['catch'](handleError(_0x2505bc,null));};exports[_0xdb38('0x4a')]=function(_0x26dcfa,_0x1603f3){var _0x18ae71={'raw':!![],'where':{'id':_0x26dcfa[_0xdb38('0x4b')]['id']}},_0x503717={};_0x503717[_0xdb38('0x32')]=_[_0xdb38('0x34')](db[_0xdb38('0x47')][_0xdb38('0x2f')]);_0x503717[_0xdb38('0x35')]=_['keys'](_0x26dcfa[_0xdb38('0x35')]);_0x503717[_0xdb38('0x36')]=_[_0xdb38('0x38')](_0x503717[_0xdb38('0x32')],_0x503717['query']);_0x18ae71[_0xdb38('0x37')]=_[_0xdb38('0x38')](_0x503717['model'],qs[_0xdb38('0x39')](_0x26dcfa[_0xdb38('0x35')][_0xdb38('0x39')]));_0x18ae71['attributes']=_0x18ae71['attributes']['length']?_0x18ae71[_0xdb38('0x37')]:_0x503717[_0xdb38('0x32')];if(_0x26dcfa['query']['includeAll']){_0x18ae71[_0xdb38('0x4c')]=[{'all':!![]}];}_0x18ae71=_[_0xdb38('0x42')]({},_0x18ae71,_0x26dcfa[_0xdb38('0x45')]);return db[_0xdb38('0x47')][_0xdb38('0x4d')](_0x18ae71)[_0xdb38('0x28')](handleEntityNotFound(_0x1603f3,null))['then'](respondWithResult(_0x1603f3,null))[_0xdb38('0x4e')](handleError(_0x1603f3,null));};exports[_0xdb38('0x4f')]=function(_0x3bf9ee,_0x5660a3){return db['VtigerField']['create'](_0x3bf9ee[_0xdb38('0x50')],{})[_0xdb38('0x28')](respondWithResult(_0x5660a3,0xc9))[_0xdb38('0x4e')](handleError(_0x5660a3,null));};exports[_0xdb38('0x26')]=function(_0x72f0d8,_0x3f97f8){if(_0x72f0d8[_0xdb38('0x50')]['id']){delete _0x72f0d8['body']['id'];}return db[_0xdb38('0x47')][_0xdb38('0x4d')]({'where':{'id':_0x72f0d8[_0xdb38('0x4b')]['id']}})[_0xdb38('0x28')](handleEntityNotFound(_0x3f97f8,null))[_0xdb38('0x28')](saveUpdates(_0x72f0d8[_0xdb38('0x50')],null))[_0xdb38('0x28')](respondWithResult(_0x3f97f8,null))[_0xdb38('0x4e')](handleError(_0x3f97f8,null));};exports[_0xdb38('0x27')]=function(_0x32740c,_0x1e5b65){return db['VtigerField'][_0xdb38('0x4d')]({'where':{'id':_0x32740c[_0xdb38('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e5b65,null))[_0xdb38('0x28')](removeEntity(_0x1e5b65,null))[_0xdb38('0x4e')](handleError(_0x1e5b65,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 50527ac..5549c78 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 _0x738c=['lodash','util','api','moment','bluebird','path','../../config/environment','./intVtigerField.attributes','define','vtiger_unique_index','idField','FieldId'];(function(_0x38a729,_0x285de7){var _0x4074fc=function(_0x3b0ee1){while(--_0x3b0ee1){_0x38a729['push'](_0x38a729['shift']());}};_0x4074fc(++_0x285de7);}(_0x738c,0xcc));var _0xc738=function(_0x403c57,_0x280a51){_0x403c57=_0x403c57-0x0;var _0x35fa69=_0x738c[_0x403c57];return _0x35fa69;};'use strict';var _=require(_0xc738('0x0'));var util=require(_0xc738('0x1'));var logger=require('../../config/logger')(_0xc738('0x2'));var moment=require(_0xc738('0x3'));var BPromise=require(_0xc738('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc738('0x5'));var rimraf=require('rimraf');var config=require(_0xc738('0x6'));var attributes=require(_0xc738('0x7'));module['exports']=function(_0x15bc3f,_0x46b0e9){return _0x15bc3f[_0xc738('0x8')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xc738('0x9'),'fields':[_0xc738('0xa'),_0xc738('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc4=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x206205,_0xa9cf06){var _0x537ddf=function(_0x44966f){while(--_0x44966f){_0x206205['push'](_0x206205['shift']());}};_0x537ddf(++_0xa9cf06);}(_0x4fc4,0xbb));var _0x44fc=function(_0x4a64cc,_0x5ebf53){_0x4a64cc=_0x4a64cc-0x0;var _0x3a24b8=_0x4fc4[_0x4a64cc];return _0x3a24b8;};'use strict';var _=require(_0x44fc('0x0'));var util=require('util');var logger=require(_0x44fc('0x1'))(_0x44fc('0x2'));var moment=require(_0x44fc('0x3'));var BPromise=require(_0x44fc('0x4'));var rp=require(_0x44fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fc('0x6'));var config=require(_0x44fc('0x7'));var attributes=require(_0x44fc('0x8'));module[_0x44fc('0x9')]=function(_0x1b232f,_0x3e7077){return _0x1b232f[_0x44fc('0xa')](_0x44fc('0xb'),attributes,{'tableName':_0x44fc('0xc'),'paranoid':![],'indexes':[{'name':_0x44fc('0xd'),'fields':[_0x44fc('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 7f61fcb..e74329c 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 _0x4768=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x29ad8e,_0x3295f8){var _0x1cfa8d=function(_0x482118){while(--_0x482118){_0x29ad8e['push'](_0x29ad8e['shift']());}};_0x1cfa8d(++_0x3295f8);}(_0x4768,0x19f));var _0x8476=function(_0x251d15,_0x9a6392){_0x251d15=_0x251d15-0x0;var _0x3fa86e=_0x4768[_0x251d15];return _0x3fa86e;};'use strict';var _=require(_0x8476('0x0'));var util=require(_0x8476('0x1'));var moment=require('moment');var BPromise=require(_0x8476('0x2'));var rs=require(_0x8476('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8476('0x4'))['db'];var utils=require(_0x8476('0x5'));var logger=require(_0x8476('0x6'))(_0x8476('0x7'));var config=require(_0x8476('0x8'));var jayson=require(_0x8476('0x9'));var client=jayson['client'][_0x8476('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33cfee,_0x30c33a,_0x4f9e07){return new BPromise(function(_0x1f62db,_0xc2a12){return client[_0x8476('0xb')](_0x33cfee,_0x4f9e07)[_0x8476('0xc')](function(_0x1f6c5c){logger[_0x8476('0xd')]('VtigerField,\x20%s,\x20%s',_0x30c33a,_0x8476('0xe'));logger[_0x8476('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x30c33a,_0x8476('0xe'),JSON['stringify'](_0x1f6c5c));if(_0x1f6c5c['error']){if(_0x1f6c5c[_0x8476('0x10')][_0x8476('0x11')]===0x1f4){logger[_0x8476('0x10')](_0x8476('0x12'),_0x30c33a,_0x1f6c5c[_0x8476('0x10')][_0x8476('0x13')]);return _0xc2a12(_0x1f6c5c[_0x8476('0x10')][_0x8476('0x13')]);}logger[_0x8476('0x10')]('VtigerField,\x20%s,\x20%s',_0x30c33a,_0x1f6c5c[_0x8476('0x10')]['message']);return _0x1f62db(_0x1f6c5c[_0x8476('0x10')][_0x8476('0x13')]);}else{logger[_0x8476('0xd')](_0x8476('0x12'),_0x30c33a,_0x8476('0xe'));_0x1f62db(_0x1f6c5c['result'][_0x8476('0x13')]);}})[_0x8476('0x14')](function(_0x2b50d7){logger['error'](_0x8476('0x12'),_0x30c33a,_0x2b50d7);_0xc2a12(_0x2b50d7);});});} \ No newline at end of file +var _0x065b=['VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x065b,0x150));var _0xb065=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0x065b[_0x56085e];return _0x4de130;};'use strict';var _=require(_0xb065('0x0'));var util=require('util');var moment=require(_0xb065('0x1'));var BPromise=require('bluebird');var rs=require(_0xb065('0x2'));var fs=require('fs');var Redis=require(_0xb065('0x3'));var db=require(_0xb065('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb065('0x5'))(_0xb065('0x6'));var config=require(_0xb065('0x7'));var jayson=require(_0xb065('0x8'));var client=jayson[_0xb065('0x9')][_0xb065('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e88e2,_0x4f7070,_0x2de927){return new BPromise(function(_0x57736c,_0xbcfcc2){return client[_0xb065('0xb')](_0x3e88e2,_0x2de927)[_0xb065('0xc')](function(_0x49de3b){logger[_0xb065('0xd')](_0xb065('0xe'),_0x4f7070,'request\x20sent');logger[_0xb065('0xf')](_0xb065('0x10'),_0x4f7070,_0xb065('0x11'),JSON[_0xb065('0x12')](_0x49de3b));if(_0x49de3b[_0xb065('0x13')]){if(_0x49de3b[_0xb065('0x13')]['code']===0x1f4){logger[_0xb065('0x13')]('VtigerField,\x20%s,\x20%s',_0x4f7070,_0x49de3b[_0xb065('0x13')][_0xb065('0x14')]);return _0xbcfcc2(_0x49de3b['error'][_0xb065('0x14')]);}logger[_0xb065('0x13')](_0xb065('0xe'),_0x4f7070,_0x49de3b[_0xb065('0x13')][_0xb065('0x14')]);return _0x57736c(_0x49de3b[_0xb065('0x13')][_0xb065('0x14')]);}else{logger[_0xb065('0xd')](_0xb065('0xe'),_0x4f7070,_0xb065('0x11'));_0x57736c(_0x49de3b['result'][_0xb065('0x14')]);}})[_0xb065('0x15')](function(_0x34cdcd){logger['error'](_0xb065('0xe'),_0x4f7070,_0x34cdcd);_0xbcfcc2(_0x34cdcd);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 7ba93cf..a1f32b2 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 _0xf22d=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','multer','path','connect-timeout','express'];(function(_0x13fa67,_0x5aa1c7){var _0x200f70=function(_0x5baf4d){while(--_0x5baf4d){_0x13fa67['push'](_0x13fa67['shift']());}};_0x200f70(++_0x5aa1c7);}(_0xf22d,0x150));var _0xdf22=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xf22d[_0x5a26f5];return _0x2e9ef7;};'use strict';var multer=require(_0xdf22('0x0'));var util=require('util');var path=require(_0xdf22('0x1'));var timeout=require(_0xdf22('0x2'));var express=require(_0xdf22('0x3'));var router=express['Router']();var fs_extra=require(_0xdf22('0x4'));var auth=require(_0xdf22('0x5'));var interaction=require(_0xdf22('0x6'));var config=require('../../config/environment');var controller=require(_0xdf22('0x7'));router[_0xdf22('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf22('0x9')]);router[_0xdf22('0x8')](_0xdf22('0xa'),auth[_0xdf22('0xb')](),controller[_0xdf22('0xc')]);router[_0xdf22('0x8')](_0xdf22('0xd'),auth['isAuthenticated'](),controller[_0xdf22('0xe')]);router[_0xdf22('0x8')](_0xdf22('0xf'),auth[_0xdf22('0xb')](),controller[_0xdf22('0x10')]);router[_0xdf22('0x11')]('/',auth[_0xdf22('0xb')](),controller[_0xdf22('0x12')]);router[_0xdf22('0x11')](_0xdf22('0xd'),auth[_0xdf22('0xb')](),controller['addConfiguration']);router[_0xdf22('0x13')](_0xdf22('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdf22('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2295=['destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','/:id','get','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2295,0x17c));var _0x5229=function(_0x504857,_0x54191a){_0x504857=_0x504857-0x0;var _0x22e385=_0x2295[_0x504857];return _0x22e385;};'use strict';var multer=require('multer');var util=require(_0x5229('0x0'));var path=require(_0x5229('0x1'));var timeout=require(_0x5229('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5229('0x3'));var auth=require(_0x5229('0x4'));var interaction=require(_0x5229('0x5'));var config=require(_0x5229('0x6'));var controller=require(_0x5229('0x7'));router['get']('/',auth[_0x5229('0x8')](),controller['index']);router['get'](_0x5229('0x9'),auth[_0x5229('0x8')](),controller['show']);router[_0x5229('0xa')]('/:id/configurations',auth[_0x5229('0x8')](),controller[_0x5229('0xb')]);router[_0x5229('0xa')](_0x5229('0xc'),auth[_0x5229('0x8')](),controller[_0x5229('0xd')]);router[_0x5229('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5229('0xe')](_0x5229('0xf'),auth[_0x5229('0x8')](),controller[_0x5229('0x10')]);router[_0x5229('0x11')]('/:id',auth[_0x5229('0x8')](),controller[_0x5229('0x12')]);router['delete'](_0x5229('0x9'),auth['isAuthenticated'](),controller[_0x5229('0x13')]);module[_0x5229('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 a929416..c5f7de4 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 _0x6c45=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x125f8c,_0x424ff2){var _0xaaadba=function(_0x165e62){while(--_0x165e62){_0x125f8c['push'](_0x125f8c['shift']());}};_0xaaadba(++_0x424ff2);}(_0x6c45,0xb1));var _0x56c4=function(_0x1a10af,_0x5738c4){_0x1a10af=_0x1a10af-0x0;var _0x11203b=_0x6c45[_0x1a10af];return _0x11203b;};'use strict';var Sequelize=require(_0x56c4('0x0'));module[_0x56c4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56c4('0x2')]},'username':{'type':Sequelize[_0x56c4('0x2')],'unique':_0x56c4('0x3')},'password':{'type':Sequelize[_0x56c4('0x2')]},'token':{'type':Sequelize[_0x56c4('0x2')]},'remoteUri':{'type':Sequelize[_0x56c4('0x2')],'unique':_0x56c4('0x4')},'authType':{'type':Sequelize[_0x56c4('0x5')](_0x56c4('0x6'),_0x56c4('0x7')),'defaultValue':_0x56c4('0x6')},'serverUrl':{'type':Sequelize[_0x56c4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x56c4('0x5')](_0x56c4('0x8'),_0x56c4('0x9')),'defaultValue':_0x56c4('0x8')}}; \ No newline at end of file +var _0xafb9=['exports','STRING','username','password','integrationTab','newTab','sequelize'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xafb9,0x68));var _0x9afb=function(_0x7bbb6d,_0x5c47e6){_0x7bbb6d=_0x7bbb6d-0x0;var _0x2135ad=_0xafb9[_0x7bbb6d];return _0x2135ad;};'use strict';var Sequelize=require(_0x9afb('0x0'));module[_0x9afb('0x1')]={'name':{'type':Sequelize[_0x9afb('0x2')]},'description':{'type':Sequelize[_0x9afb('0x2')]},'username':{'type':Sequelize[_0x9afb('0x2')],'unique':_0x9afb('0x3')},'password':{'type':Sequelize[_0x9afb('0x2')]},'token':{'type':Sequelize[_0x9afb('0x2')]},'remoteUri':{'type':Sequelize[_0x9afb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x9afb('0x4'),'token'),'defaultValue':_0x9afb('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9afb('0x5'),_0x9afb('0x6')),'defaultValue':_0x9afb('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9bf0824..92c4580 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 _0xeb74=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','filter','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xeb74,0xe3));var _0x4eb7=function(_0x49f34c,_0xd56b37){_0x49f34c=_0x49f34c-0x0;var _0x10253d=_0xeb74[_0x49f34c];return _0x10253d;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];var integrations=require(_0x4eb7('0x19'));function respondWithStatusCode(_0x4194e1,_0x3c9f45){_0x3c9f45=_0x3c9f45||0xcc;return function(_0x4c27a4){if(_0x4c27a4){return _0x4194e1['sendStatus'](_0x3c9f45);}return _0x4194e1['status'](_0x3c9f45)[_0x4eb7('0x1a')]();};}function respondWithResult(_0x51f09d,_0x84c68b){_0x84c68b=_0x84c68b||0xc8;return function(_0x119afa){if(_0x119afa){return _0x51f09d[_0x4eb7('0x1b')](_0x84c68b)[_0x4eb7('0x1c')](_0x119afa);}};}function respondWithFilteredResult(_0x5d6d5,_0x21433d){return function(_0x11674f){if(_0x11674f){var _0x76988=typeof _0x21433d[_0x4eb7('0x1d')]===_0x4eb7('0x1e')&&typeof _0x21433d['limit']===_0x4eb7('0x1e');var _0x11ac9f=_0x11674f[_0x4eb7('0x1f')];var _0xf14478=_0x76988?0x0:_0x21433d[_0x4eb7('0x1d')];var _0x44f1b9=_0x76988?_0x11674f[_0x4eb7('0x1f')]:_0x21433d[_0x4eb7('0x1d')]+_0x21433d['limit'];var _0x3cf53a;if(_0x44f1b9>=_0x11ac9f){_0x44f1b9=_0x11ac9f;_0x3cf53a=0xc8;}else{_0x3cf53a=0xce;}_0x5d6d5[_0x4eb7('0x1b')](_0x3cf53a);return _0x5d6d5[_0x4eb7('0x20')](_0x4eb7('0x21'),_0xf14478+'-'+_0x44f1b9+'/'+_0x11ac9f)[_0x4eb7('0x1c')](_0x11674f);}return null;};}function patchUpdates(_0x2efd67){return function(_0x11fb0a){try{jsonpatch['apply'](_0x11fb0a,_0x2efd67,!![]);}catch(_0x214a28){return BPromise[_0x4eb7('0x22')](_0x214a28);}return _0x11fb0a[_0x4eb7('0x23')]();};}function saveUpdates(_0x164515,_0x14a7be){return function(_0x1b4640){if(_0x1b4640){return _0x1b4640[_0x4eb7('0x24')](_0x164515)[_0x4eb7('0x25')](function(_0x1a2b8b){return _0x1a2b8b;});}return null;};}function removeEntity(_0x13e871,_0x4de2d9){return function(_0x3e72cd){if(_0x3e72cd){return _0x3e72cd[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x13e871[_0x4eb7('0x1b')](0xcc)[_0x4eb7('0x1a')]();});}};}function handleEntityNotFound(_0x25eb74,_0x365060){return function(_0xe9db8){if(!_0xe9db8){_0x25eb74[_0x4eb7('0x27')](0x194);}return _0xe9db8;};}function handleError(_0x248759,_0xf83c11){_0xf83c11=_0xf83c11||0x1f4;return function(_0x2984b2){logger[_0x4eb7('0x28')](_0x2984b2[_0x4eb7('0x29')]);if(_0x2984b2[_0x4eb7('0x2a')]){delete _0x2984b2[_0x4eb7('0x2a')];}_0x248759[_0x4eb7('0x1b')](_0xf83c11)[_0x4eb7('0x2b')](_0x2984b2);};}exports[_0x4eb7('0x2c')]=function(_0x28fda8,_0x114c68){var _0x17030a={},_0x3ed224={},_0x50209d={'count':0x0,'rows':[]};var _0x34515c=_['map'](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')],function(_0xc5aa21){return{'name':_0xc5aa21[_0x4eb7('0x2f')],'type':_0xc5aa21[_0x4eb7('0x30')][_0x4eb7('0x31')]};});_0x3ed224[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x34515c,_0x4eb7('0x2a'));_0x3ed224['query']=_[_0x4eb7('0x34')](_0x28fda8['query']);_0x3ed224[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x3ed224['model'],_0x3ed224['query']);_0x17030a[_0x4eb7('0x37')]=_[_0x4eb7('0x36')](_0x3ed224[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x28fda8['query'][_0x4eb7('0x38')]));_0x17030a[_0x4eb7('0x37')]=_0x17030a[_0x4eb7('0x37')][_0x4eb7('0x39')]?_0x17030a[_0x4eb7('0x37')]:_0x3ed224['model'];if(!_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3b')](_0x4eb7('0x3c'))){_0x17030a['limit']=qs[_0x4eb7('0x3d')](_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3d')]);_0x17030a['offset']=qs[_0x4eb7('0x1d')](_0x28fda8['query'][_0x4eb7('0x1d')]);}_0x17030a[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x28fda8[_0x4eb7('0x3a')]['sort']);_0x17030a[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_[_0x4eb7('0x41')](_0x28fda8[_0x4eb7('0x3a')],_0x3ed224['filters']),_0x34515c);if(_0x28fda8['query']['filter']){_0x17030a[_0x4eb7('0x40')]=_[_0x4eb7('0x42')](_0x17030a[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x34515c,function(_0x210c20){if(_0x210c20[_0x4eb7('0x30')]!==_0x4eb7('0x43')){var _0x20d2bc={};_0x20d2bc[_0x210c20[_0x4eb7('0x2a')]]={'$like':'%'+_0x28fda8[_0x4eb7('0x3a')]['filter']+'%'};return _0x20d2bc;}})});}_0x17030a=_[_0x4eb7('0x42')]({},_0x17030a,_0x28fda8[_0x4eb7('0x44')]);var _0xe04d76={'where':_0x17030a[_0x4eb7('0x40')]};return db[_0x4eb7('0x2d')][_0x4eb7('0x1f')](_0xe04d76)[_0x4eb7('0x25')](function(_0xef998f){_0x50209d[_0x4eb7('0x1f')]=_0xef998f;if(_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x17030a[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x2d')][_0x4eb7('0x47')](_0x17030a);})[_0x4eb7('0x25')](function(_0x5b819f){_0x50209d[_0x4eb7('0x48')]=_0x5b819f;return _0x50209d;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x114c68,_0x17030a))[_0x4eb7('0x49')](handleError(_0x114c68,null));};exports[_0x4eb7('0x4a')]=function(_0x5eff9e,_0x2fd5c2){var _0x2df542={'raw':![],'where':{'id':_0x5eff9e[_0x4eb7('0x4b')]['id']}},_0x482357={};_0x482357[_0x4eb7('0x32')]=_[_0x4eb7('0x34')](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')]);_0x482357[_0x4eb7('0x3a')]=_['keys'](_0x5eff9e[_0x4eb7('0x3a')]);_0x482357['filters']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],_0x482357[_0x4eb7('0x3a')]);_0x2df542['attributes']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x5eff9e[_0x4eb7('0x3a')]['fields']));_0x2df542[_0x4eb7('0x37')]=_0x2df542['attributes'][_0x4eb7('0x39')]?_0x2df542[_0x4eb7('0x37')]:_0x482357[_0x4eb7('0x32')];if(_0x5eff9e[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x2df542['include']=[{'all':!![]}];}_0x2df542=_['merge']({},_0x2df542,_0x5eff9e[_0x4eb7('0x44')]);return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')](_0x2df542)[_0x4eb7('0x25')](handleEntityNotFound(_0x2fd5c2,null))[_0x4eb7('0x25')](respondWithResult(_0x2fd5c2,null))['catch'](handleError(_0x2fd5c2,null));};exports[_0x4eb7('0x4d')]=function(_0x104284,_0x56609e){return db[_0x4eb7('0x2d')][_0x4eb7('0x4d')](_0x104284['body'],{})[_0x4eb7('0x25')](respondWithResult(_0x56609e,0xc9))[_0x4eb7('0x49')](handleError(_0x56609e,null));};exports[_0x4eb7('0x24')]=function(_0x5774d5,_0x130113){if(_0x5774d5['body']['id']){delete _0x5774d5['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x5774d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x130113,null))[_0x4eb7('0x25')](saveUpdates(_0x5774d5[_0x4eb7('0x4e')],null))[_0x4eb7('0x25')](respondWithResult(_0x130113,null))[_0x4eb7('0x49')](handleError(_0x130113,null));};exports[_0x4eb7('0x26')]=function(_0x23c0d5,_0x42a1d9){return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x23c0d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x42a1d9,null))[_0x4eb7('0x25')](removeEntity(_0x42a1d9,null))[_0x4eb7('0x49')](handleError(_0x42a1d9,null));};exports[_0x4eb7('0x4f')]=function(_0x1411c9,_0x11cc3d,_0x4cfba8){var _0x3f3d41={};var _0x550888={};var _0x4db5f7;var _0x3f3a5f;return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x1411c9[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x11cc3d,null))['then'](function(_0x4e3163){if(_0x4e3163){_0x4db5f7=_0x4e3163;_0x550888[_0x4eb7('0x32')]=_['keys'](db[_0x4eb7('0x51')][_0x4eb7('0x2e')]);_0x550888[_0x4eb7('0x3a')]=_[_0x4eb7('0x34')](_0x1411c9['query']);_0x550888[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],_0x550888[_0x4eb7('0x3a')]);_0x3f3d41['attributes']=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],qs['fields'](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x38')]));_0x3f3d41['attributes']=_0x3f3d41[_0x4eb7('0x37')]['length']?_0x3f3d41[_0x4eb7('0x37')]:_0x550888['model'];_0x3f3d41[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x3f')]);_0x3f3d41[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_['pick'](_0x1411c9['query'],_0x550888[_0x4eb7('0x35')]));if(_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]){_0x3f3d41[_0x4eb7('0x40')]=_['merge'](_0x3f3d41[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x3f3d41['attributes'],function(_0x452f21){var _0xba9272={};_0xba9272[_0x452f21]={'$like':'%'+_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]+'%'};return _0xba9272;})});}_0x3f3d41=_[_0x4eb7('0x42')]({},_0x3f3d41,_0x1411c9[_0x4eb7('0x44')]);return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})['then'](function(_0x5839f1){if(_0x5839f1){_0x3f3a5f=_0x5839f1[_0x4eb7('0x39')];if(!_0x1411c9['query'][_0x4eb7('0x3b')]('nolimit')){_0x3f3d41[_0x4eb7('0x3d')]=qs['limit'](_0x1411c9['query'][_0x4eb7('0x3d')]);_0x3f3d41[_0x4eb7('0x1d')]=qs['offset'](_0x1411c9[_0x4eb7('0x3a')]['offset']);}return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})[_0x4eb7('0x25')](function(_0x4ab8e8){if(_0x4ab8e8){return _0x4ab8e8?{'count':_0x3f3a5f,'rows':_0x4ab8e8}:null;}})[_0x4eb7('0x25')](respondWithResult(_0x11cc3d,null))[_0x4eb7('0x49')](handleError(_0x11cc3d,null));};exports['addConfiguration']=function(_0x4b492a,_0x5c8d45,_0x59e2f2){if(_0x4b492a[_0x4eb7('0x4e')]['id']){delete _0x4b492a['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x4b492a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5c8d45,null))[_0x4eb7('0x25')](function(_0x463ab6){if(_0x463ab6){_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x53')]=_0x463ab6['id'];_0x4b492a[_0x4eb7('0x4e')]['Subjects']=integrations['getSubjects'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x55')]=integrations['getDescriptions'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);return db[_0x4eb7('0x51')][_0x4eb7('0x4d')](_0x4b492a['body'],{'include':[{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x57')},{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x55')}]});}return null;})['then'](respondWithResult(_0x5c8d45,null))['catch'](handleError(_0x5c8d45,null));};exports[_0x4eb7('0x58')]=function(_0x3883f3,_0x4e8125,_0x1911ad){var _0x4b698b='';return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x3883f3[_0x4eb7('0x4b')]['id']},'attributes':['id',_0x4eb7('0x59'),'password',_0x4eb7('0x5a'),_0x4eb7('0x5b'),_0x4eb7('0x5c')]})[_0x4eb7('0x25')](handleEntityNotFound(_0x4e8125,null))[_0x4eb7('0x25')](function(_0x3271d0){if(_0x3271d0){_0x4b698b=_0x3271d0[_0x4eb7('0x5c')];var _0x232242=_0x4b698b[_0x4eb7('0x5d')](-0x1);if(_0x232242==='/'){_0x4b698b=_0x4b698b[_0x4eb7('0x5e')](0x0,_0x4b698b[_0x4eb7('0x5f')](_0x232242));}var _0x713b0a={'method':_0x4eb7('0x60'),'uri':util[_0x4eb7('0x61')](_0x4eb7('0x62'),_0x4b698b,_0x4eb7('0x63')),'json':!![]};switch(_0x3271d0[_0x4eb7('0x5b')]){case _0x4eb7('0x64'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x66'),_0x3271d0[_0x4eb7('0x59')],_0x3271d0[_0x4eb7('0x64')]))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;case _0x4eb7('0x5a'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format'](_0x4eb7('0x69'),new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x6a'),_0x3271d0['username'],_0x3271d0['token']))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;default:throw new db[(_0x4eb7('0x6b'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x713b0a);}})[_0x4eb7('0x25')](function(_0x1a1525){if(_0x1a1525){var _0x4778f9=[_0x4eb7('0x6c'),_0x4eb7('0x6d'),_0x4eb7('0x6e'),_0x4eb7('0x6f')];_[_0x4eb7('0x70')](_0x1a1525[_0x4eb7('0x63')],function(_0x2e531e){return _0x4778f9[_0x4eb7('0x71')](_0x2e531e[_0x4eb7('0x30')]);});return{'count':_0x1a1525['ticket_fields']['length'],'rows':_[_0x4eb7('0x33')](_0x1a1525[_0x4eb7('0x63')],function(_0x14648d){return{'id':_0x14648d['id'],'name':_0x14648d[_0x4eb7('0x72')]>0x7?_0x14648d[_0x4eb7('0x73')]:_0x14648d[_0x4eb7('0x30')],'custom':_0x14648d['position']>0x7?!![]:![],'options':_0x14648d['system_field_options']?_0x14648d[_0x4eb7('0x74')]:_0x14648d[_0x4eb7('0x75')]?_0x14648d[_0x4eb7('0x75')]:[]};})};}})[_0x4eb7('0x25')](respondWithResult(_0x4e8125,null))[_0x4eb7('0x49')](function(_0x2480ed){var _0x13f574=_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?0x1f4:_0x2480ed[_0x4eb7('0x77')]||0x1f4;logger[_0x4eb7('0x28')](_0x4eb7('0x78'),_0x4eb7('0x58'),_0x13f574,JSON[_0x4eb7('0x79')](_0x2480ed));delete _0x2480ed['name'];if(_0x13f574===0x191){_0x13f574=0x190;}_0x4e8125[_0x4eb7('0x1b')](_0x13f574)[_0x4eb7('0x2b')](_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x2480ed[_0x4eb7('0x77')]}:_0x2480ed);});}; \ No newline at end of file +var _0xefda=['getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','channel','type','Descriptions'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xefda,0x96));var _0xaefd=function(_0x24bd96,_0x18072e){_0x24bd96=_0x24bd96-0x0;var _0x21828a=_0xefda[_0x24bd96];return _0x21828a;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var integrations=require(_0xaefd('0x18'));function respondWithStatusCode(_0x2a310c,_0x4b2b5c){_0x4b2b5c=_0x4b2b5c||0xcc;return function(_0x3172d3){if(_0x3172d3){return _0x2a310c['sendStatus'](_0x4b2b5c);}return _0x2a310c[_0xaefd('0x19')](_0x4b2b5c)[_0xaefd('0x1a')]();};}function respondWithResult(_0x9dfdf6,_0x43b82a){_0x43b82a=_0x43b82a||0xc8;return function(_0x4ec92a){if(_0x4ec92a){return _0x9dfdf6[_0xaefd('0x19')](_0x43b82a)[_0xaefd('0x1b')](_0x4ec92a);}};}function respondWithFilteredResult(_0x41f345,_0x411701){return function(_0x10ee28){if(_0x10ee28){var _0x32f75e=typeof _0x411701[_0xaefd('0x1c')]===_0xaefd('0x1d')&&typeof _0x411701['limit']===_0xaefd('0x1d');var _0x109604=_0x10ee28[_0xaefd('0x1e')];var _0x1737a1=_0x32f75e?0x0:_0x411701[_0xaefd('0x1c')];var _0x244956=_0x32f75e?_0x10ee28['count']:_0x411701[_0xaefd('0x1c')]+_0x411701[_0xaefd('0x1f')];var _0x24f131;if(_0x244956>=_0x109604){_0x244956=_0x109604;_0x24f131=0xc8;}else{_0x24f131=0xce;}_0x41f345[_0xaefd('0x19')](_0x24f131);return _0x41f345[_0xaefd('0x20')](_0xaefd('0x21'),_0x1737a1+'-'+_0x244956+'/'+_0x109604)['json'](_0x10ee28);}return null;};}function patchUpdates(_0x463d48){return function(_0x18e71c){try{jsonpatch[_0xaefd('0x22')](_0x18e71c,_0x463d48,!![]);}catch(_0x3d9823){return BPromise[_0xaefd('0x23')](_0x3d9823);}return _0x18e71c['save']();};}function saveUpdates(_0x479486,_0x5b9967){return function(_0x21680a){if(_0x21680a){return _0x21680a[_0xaefd('0x24')](_0x479486)[_0xaefd('0x25')](function(_0x5a44ed){return _0x5a44ed;});}return null;};}function removeEntity(_0x23060f,_0x4cd9b2){return function(_0x3deec8){if(_0x3deec8){return _0x3deec8[_0xaefd('0x26')]()[_0xaefd('0x25')](function(){_0x23060f['status'](0xcc)[_0xaefd('0x1a')]();});}};}function handleEntityNotFound(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(!_0x14cc9d){_0x3ffc9c[_0xaefd('0x27')](0x194);}return _0x14cc9d;};}function handleError(_0x5a170c,_0x2fe27e){_0x2fe27e=_0x2fe27e||0x1f4;return function(_0x58c008){logger[_0xaefd('0x28')](_0x58c008[_0xaefd('0x29')]);if(_0x58c008['name']){delete _0x58c008[_0xaefd('0x2a')];}_0x5a170c[_0xaefd('0x19')](_0x2fe27e)['send'](_0x58c008);};}exports[_0xaefd('0x2b')]=function(_0x114ec0,_0x36b6b7){var _0x4c0898={},_0x45f0e8={},_0x5c573b={'count':0x0,'rows':[]};var _0x109e19=_['map'](db['ZendeskAccount'][_0xaefd('0x2c')],function(_0x1b470c){return{'name':_0x1b470c['fieldName'],'type':_0x1b470c['type']['key']};});_0x45f0e8[_0xaefd('0x2d')]=_[_0xaefd('0x2e')](_0x109e19,'name');_0x45f0e8['query']=_[_0xaefd('0x2f')](_0x114ec0[_0xaefd('0x30')]);_0x45f0e8[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x45f0e8['model'],_0x45f0e8[_0xaefd('0x30')]);_0x4c0898[_0xaefd('0x33')]=_[_0xaefd('0x32')](_0x45f0e8[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x34')]));_0x4c0898[_0xaefd('0x33')]=_0x4c0898[_0xaefd('0x33')][_0xaefd('0x35')]?_0x4c0898[_0xaefd('0x33')]:_0x45f0e8[_0xaefd('0x2d')];if(!_0x114ec0[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4c0898[_0xaefd('0x1f')]=qs['limit'](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4c0898[_0xaefd('0x1c')]=qs['offset'](_0x114ec0[_0xaefd('0x30')]['offset']);}_0x4c0898[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x39')]);_0x4c0898[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x114ec0[_0xaefd('0x30')],_0x45f0e8[_0xaefd('0x31')]),_0x109e19);if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4c0898[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4c0898[_0xaefd('0x3a')],{'$or':_['map'](_0x109e19,function(_0x1cfd6d){if(_0x1cfd6d['type']!==_0xaefd('0x3e')){var _0x6562={};_0x6562[_0x1cfd6d[_0xaefd('0x2a')]]={'$like':'%'+_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x6562;}})});}_0x4c0898=_[_0xaefd('0x3d')]({},_0x4c0898,_0x114ec0[_0xaefd('0x3f')]);var _0x145e9e={'where':_0x4c0898[_0xaefd('0x3a')]};return db[_0xaefd('0x40')]['count'](_0x145e9e)[_0xaefd('0x25')](function(_0x3296ac){_0x5c573b['count']=_0x3296ac;if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x41')]){_0x4c0898[_0xaefd('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4c0898);})[_0xaefd('0x25')](function(_0x3d0abf){_0x5c573b[_0xaefd('0x43')]=_0x3d0abf;return _0x5c573b;})[_0xaefd('0x25')](respondWithFilteredResult(_0x36b6b7,_0x4c0898))[_0xaefd('0x44')](handleError(_0x36b6b7,null));};exports[_0xaefd('0x45')]=function(_0x2e17b5,_0x2e98aa){var _0x48a7af={'raw':![],'where':{'id':_0x2e17b5[_0xaefd('0x46')]['id']}},_0x26587e={};_0x26587e[_0xaefd('0x2d')]=_[_0xaefd('0x2f')](db[_0xaefd('0x40')][_0xaefd('0x2c')]);_0x26587e[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x2e17b5['query']);_0x26587e['filters']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],_0x26587e['query']);_0x48a7af['attributes']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x34')]));_0x48a7af[_0xaefd('0x33')]=_0x48a7af[_0xaefd('0x33')][_0xaefd('0x35')]?_0x48a7af[_0xaefd('0x33')]:_0x26587e['model'];if(_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x41')]){_0x48a7af[_0xaefd('0x42')]=[{'all':!![]}];}_0x48a7af=_[_0xaefd('0x3d')]({},_0x48a7af,_0x2e17b5[_0xaefd('0x3f')]);return db[_0xaefd('0x40')][_0xaefd('0x47')](_0x48a7af)['then'](handleEntityNotFound(_0x2e98aa,null))[_0xaefd('0x25')](respondWithResult(_0x2e98aa,null))['catch'](handleError(_0x2e98aa,null));};exports[_0xaefd('0x48')]=function(_0x374845,_0x16c664){return db[_0xaefd('0x40')]['create'](_0x374845['body'],{})[_0xaefd('0x25')](respondWithResult(_0x16c664,0xc9))[_0xaefd('0x44')](handleError(_0x16c664,null));};exports[_0xaefd('0x24')]=function(_0x4eeb56,_0x2a836a){if(_0x4eeb56[_0xaefd('0x49')]['id']){delete _0x4eeb56['body']['id'];}return db[_0xaefd('0x40')][_0xaefd('0x47')]({'where':{'id':_0x4eeb56[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x2a836a,null))[_0xaefd('0x25')](saveUpdates(_0x4eeb56[_0xaefd('0x49')],null))[_0xaefd('0x25')](respondWithResult(_0x2a836a,null))[_0xaefd('0x44')](handleError(_0x2a836a,null));};exports['destroy']=function(_0x567ceb,_0x1406b8){return db[_0xaefd('0x40')]['find']({'where':{'id':_0x567ceb[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1406b8,null))[_0xaefd('0x25')](removeEntity(_0x1406b8,null))[_0xaefd('0x44')](handleError(_0x1406b8,null));};exports[_0xaefd('0x4a')]=function(_0x69185e,_0x27fd3f,_0xf727cd){var _0x4b709a={};var _0x56e180={};var _0x1fd0b0;var _0x338823;return db['ZendeskAccount'][_0xaefd('0x4b')]({'where':{'id':_0x69185e[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x27fd3f,null))[_0xaefd('0x25')](function(_0x4a883b){if(_0x4a883b){_0x1fd0b0=_0x4a883b;_0x56e180['model']=_[_0xaefd('0x2f')](db[_0xaefd('0x4c')][_0xaefd('0x2c')]);_0x56e180[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x69185e['query']);_0x56e180[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x56e180['model'],_0x56e180[_0xaefd('0x30')]);_0x4b709a[_0xaefd('0x33')]=_['intersection'](_0x56e180[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x69185e[_0xaefd('0x30')]['fields']));_0x4b709a[_0xaefd('0x33')]=_0x4b709a[_0xaefd('0x33')]['length']?_0x4b709a[_0xaefd('0x33')]:_0x56e180[_0xaefd('0x2d')];_0x4b709a[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x69185e['query']['sort']);_0x4b709a[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x69185e[_0xaefd('0x30')],_0x56e180[_0xaefd('0x31')]));if(_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4b709a[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4b709a[_0xaefd('0x3a')],{'$or':_['map'](_0x4b709a['attributes'],function(_0x324eb4){var _0x431c1a={};_0x431c1a[_0x324eb4]={'$like':'%'+_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x431c1a;})});}_0x4b709a=_['merge']({},_0x4b709a,_0x69185e[_0xaefd('0x3f')]);return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x1ad04e){if(_0x1ad04e){_0x338823=_0x1ad04e[_0xaefd('0x35')];if(!_0x69185e[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4b709a['limit']=qs[_0xaefd('0x1f')](_0x69185e[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4b709a[_0xaefd('0x1c')]=qs['offset'](_0x69185e[_0xaefd('0x30')]['offset']);}return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x516913){if(_0x516913){return _0x516913?{'count':_0x338823,'rows':_0x516913}:null;}})['then'](respondWithResult(_0x27fd3f,null))[_0xaefd('0x44')](handleError(_0x27fd3f,null));};exports['addConfiguration']=function(_0x5e0068,_0x4e75bc,_0xe2397c){if(_0x5e0068[_0xaefd('0x49')]['id']){delete _0x5e0068[_0xaefd('0x49')]['id'];}return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x5e0068[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e75bc,null))['then'](function(_0x4f8e16){if(_0x4f8e16){_0x5e0068['body'][_0xaefd('0x4d')]=_0x4f8e16['id'];_0x5e0068['body'][_0xaefd('0x4e')]=integrations['getSubjects'](_0x5e0068[_0xaefd('0x49')][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);_0x5e0068[_0xaefd('0x49')][_0xaefd('0x51')]=integrations[_0xaefd('0x52')](_0x5e0068['body'][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);return db[_0xaefd('0x4c')]['create'](_0x5e0068[_0xaefd('0x49')],{'include':[{'model':db['ZendeskField'],'as':_0xaefd('0x4e')},{'model':db[_0xaefd('0x53')],'as':_0xaefd('0x51')}]});}return null;})[_0xaefd('0x25')](respondWithResult(_0x4e75bc,null))[_0xaefd('0x44')](handleError(_0x4e75bc,null));};exports[_0xaefd('0x54')]=function(_0x57776e,_0x1a6195,_0x3b39db){var _0x4a9fa5='';return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x57776e['params']['id']},'attributes':['id',_0xaefd('0x55'),_0xaefd('0x56'),_0xaefd('0x57'),_0xaefd('0x58'),_0xaefd('0x59')]})[_0xaefd('0x25')](handleEntityNotFound(_0x1a6195,null))[_0xaefd('0x25')](function(_0x6f99b0){if(_0x6f99b0){_0x4a9fa5=_0x6f99b0[_0xaefd('0x59')];var _0x1ec9be=_0x4a9fa5[_0xaefd('0x5a')](-0x1);if(_0x1ec9be==='/'){_0x4a9fa5=_0x4a9fa5[_0xaefd('0x5b')](0x0,_0x4a9fa5[_0xaefd('0x5c')](_0x1ec9be));}var _0x43338b={'method':_0xaefd('0x5d'),'uri':util[_0xaefd('0x5e')](_0xaefd('0x5f'),_0x4a9fa5,'ticket_fields'),'json':!![]};switch(_0x6f99b0[_0xaefd('0x58')]){case _0xaefd('0x56'):_0x43338b[_0xaefd('0x60')]={'Authorization':util['format'](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')](_0xaefd('0x62'),_0x6f99b0[_0xaefd('0x55')],_0x6f99b0['password']))[_0xaefd('0x63')]('base64'))};break;case _0xaefd('0x57'):_0x43338b['headers']={'Authorization':util[_0xaefd('0x5e')](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')]('%s/token:%s',_0x6f99b0['username'],_0x6f99b0[_0xaefd('0x57')]))[_0xaefd('0x63')](_0xaefd('0x64')))};break;default:throw new db[(_0xaefd('0x65'))][(_0xaefd('0x66'))](_0xaefd('0x67'));}return rp(_0x43338b);}})['then'](function(_0x499d7d){if(_0x499d7d){var _0x58c97c=['subject','description',_0xaefd('0x68'),_0xaefd('0x69')];_[_0xaefd('0x6a')](_0x499d7d[_0xaefd('0x6b')],function(_0x5ae635){return _0x58c97c[_0xaefd('0x6c')](_0x5ae635[_0xaefd('0x50')]);});return{'count':_0x499d7d['ticket_fields'][_0xaefd('0x35')],'rows':_['map'](_0x499d7d[_0xaefd('0x6b')],function(_0x51b6f1){return{'id':_0x51b6f1['id'],'name':_0x51b6f1[_0xaefd('0x6d')]>0x7?_0x51b6f1['title']:_0x51b6f1[_0xaefd('0x50')],'custom':_0x51b6f1['position']>0x7?!![]:![],'options':_0x51b6f1[_0xaefd('0x6e')]?_0x51b6f1[_0xaefd('0x6e')]:_0x51b6f1['custom_field_options']?_0x51b6f1[_0xaefd('0x6f')]:[]};})};}})[_0xaefd('0x25')](respondWithResult(_0x1a6195,null))[_0xaefd('0x44')](function(_0x564c89){var _0x42c55c=_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?0x1f4:_0x564c89[_0xaefd('0x71')]||0x1f4;logger[_0xaefd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xaefd('0x54'),_0x42c55c,JSON[_0xaefd('0x72')](_0x564c89));delete _0x564c89['name'];if(_0x42c55c===0x191){_0x42c55c=0x190;}_0x1a6195[_0xaefd('0x19')](_0x42c55c)[_0xaefd('0x73')](_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x564c89[_0xaefd('0x71')]}:_0x564c89);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 151ec90..221b2fe 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 _0x9731=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9731,0xeb));var _0x1973=function(_0x3d5e27,_0x23565f){_0x3d5e27=_0x3d5e27-0x0;var _0x21cc29=_0x9731[_0x3d5e27];return _0x21cc29;};'use strict';var _=require(_0x1973('0x0'));var util=require(_0x1973('0x1'));var logger=require(_0x1973('0x2'))(_0x1973('0x3'));var moment=require(_0x1973('0x4'));var BPromise=require(_0x1973('0x5'));var rp=require(_0x1973('0x6'));var fs=require('fs');var path=require(_0x1973('0x7'));var rimraf=require(_0x1973('0x8'));var config=require(_0x1973('0x9'));var attributes=require(_0x1973('0xa'));var integrations=require(_0x1973('0xb'));module[_0x1973('0xc')]=function(_0x572618,_0x2eace9){return _0x572618[_0x1973('0xd')](_0x1973('0xe'),attributes,{'tableName':_0x1973('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe46e=['../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','util'];(function(_0x556dbd,_0x43573f){var _0xb25eb9=function(_0x5d8d5f){while(--_0x5d8d5f){_0x556dbd['push'](_0x556dbd['shift']());}};_0xb25eb9(++_0x43573f);}(_0xe46e,0x8e));var _0xee46=function(_0x2ef8e8,_0x2d34e2){_0x2ef8e8=_0x2ef8e8-0x0;var _0x22b7ce=_0xe46e[_0x2ef8e8];return _0x22b7ce;};'use strict';var _=require('lodash');var util=require(_0xee46('0x0'));var logger=require(_0xee46('0x1'))(_0xee46('0x2'));var moment=require(_0xee46('0x3'));var BPromise=require('bluebird');var rp=require(_0xee46('0x4'));var fs=require('fs');var path=require(_0xee46('0x5'));var rimraf=require('rimraf');var config=require(_0xee46('0x6'));var attributes=require(_0xee46('0x7'));var integrations=require(_0xee46('0x8'));module['exports']=function(_0x2684ae,_0x23d0fa){return _0x2684ae[_0xee46('0x9')](_0xee46('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 468e4cf..abefbd8 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 _0x0737=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','map','model','attributes','ShowZendeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x449371,_0x30f9e7){var _0x2f5c1d=function(_0x4cfca2){while(--_0x4cfca2){_0x449371['push'](_0x449371['shift']());}};_0x2f5c1d(++_0x30f9e7);}(_0x0737,0xfc));var _0x7073=function(_0x415ade,_0x55e64f){_0x415ade=_0x415ade-0x0;var _0x3e6ad8=_0x0737[_0x415ade];return _0x3e6ad8;};'use strict';var _=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var moment=require(_0x7073('0x2'));var BPromise=require(_0x7073('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7073('0x4'));var db=require(_0x7073('0x5'))['db'];var utils=require(_0x7073('0x6'));var logger=require(_0x7073('0x7'))('rpc');var config=require(_0x7073('0x8'));var jayson=require(_0x7073('0x9'));var client=jayson[_0x7073('0xa')][_0x7073('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27f3b0,_0x3e87a0,_0x26c6e3){return new BPromise(function(_0x2f2d15,_0x2555de){return client['request'](_0x27f3b0,_0x26c6e3)[_0x7073('0xc')](function(_0x18ef2a){logger[_0x7073('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x3e87a0,_0x7073('0xe'));logger[_0x7073('0xf')](_0x7073('0x10'),_0x3e87a0,_0x7073('0xe'),JSON[_0x7073('0x11')](_0x18ef2a));if(_0x18ef2a[_0x7073('0x12')]){if(_0x18ef2a[_0x7073('0x12')][_0x7073('0x13')]===0x1f4){logger[_0x7073('0x12')](_0x7073('0x14'),_0x3e87a0,_0x18ef2a[_0x7073('0x12')][_0x7073('0x15')]);return _0x2555de(_0x18ef2a[_0x7073('0x12')][_0x7073('0x15')]);}logger[_0x7073('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x3e87a0,_0x18ef2a[_0x7073('0x12')]['message']);return _0x2f2d15(_0x18ef2a['error']['message']);}else{logger[_0x7073('0xd')](_0x7073('0x14'),_0x3e87a0,_0x7073('0xe'));_0x2f2d15(_0x18ef2a[_0x7073('0x16')]['message']);}})[_0x7073('0x17')](function(_0x24a219){logger[_0x7073('0x12')](_0x7073('0x14'),_0x3e87a0,_0x24a219);_0x2555de(_0x24a219);});});}exports[_0x7073('0x18')]=function(_0x372554){var _0x50ff69=this;return new Promise(function(_0x54f03d,_0x2aa742){return db[_0x7073('0x19')][_0x7073('0x1a')]({'raw':_0x372554[_0x7073('0x1b')]?_0x372554[_0x7073('0x1b')][_0x7073('0x1c')]===undefined?!![]:![]:!![],'where':_0x372554['options']?_0x372554[_0x7073('0x1b')]['where']||null:null,'attributes':_0x372554[_0x7073('0x1b')]?_0x372554[_0x7073('0x1b')]['attributes']||null:null,'limit':_0x372554[_0x7073('0x1b')]?_0x372554[_0x7073('0x1b')][_0x7073('0x1d')]||null:null,'include':_0x372554['options']?_0x372554[_0x7073('0x1b')][_0x7073('0x1e')]?_[_0x7073('0x1f')](_0x372554['options'][_0x7073('0x1e')],function(_0x54d3a8){return{'model':db[_0x54d3a8[_0x7073('0x20')]],'as':_0x54d3a8['as'],'attributes':_0x54d3a8[_0x7073('0x21')],'include':_0x54d3a8[_0x7073('0x1e')]?_[_0x7073('0x1f')](_0x54d3a8[_0x7073('0x1e')],function(_0x54b9dc){return{'model':db[_0x54b9dc[_0x7073('0x20')]],'as':_0x54b9dc['as'],'attributes':_0x54b9dc[_0x7073('0x21')],'include':_0x54b9dc[_0x7073('0x1e')]?_[_0x7073('0x1f')](_0x54b9dc[_0x7073('0x1e')],function(_0x585b10){return{'model':db[_0x585b10[_0x7073('0x20')]],'as':_0x585b10['as'],'attributes':_0x585b10[_0x7073('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7073('0xc')](function(_0x2903e3){logger[_0x7073('0xd')]('GetZendeskAccount',_0x372554);logger[_0x7073('0xf')](_0x7073('0x18'),_0x372554,JSON['stringify'](_0x2903e3));_0x54f03d(_0x2903e3);})[_0x7073('0x17')](function(_0x154123){logger['error']('GetZendeskAccount',_0x154123[_0x7073('0x15')],_0x372554);_0x2aa742(_0x50ff69['error'](0x1f4,_0x154123[_0x7073('0x15')]));});});};exports[_0x7073('0x22')]=function(_0x204614){var _0x51a7a7=this;return new Promise(function(_0x4861ab,_0x55ba94){return db[_0x7073('0x19')][_0x7073('0x23')]({'raw':_0x204614[_0x7073('0x1b')]?_0x204614['options'][_0x7073('0x1c')]===undefined?!![]:![]:!![],'where':_0x204614[_0x7073('0x1b')]?_0x204614[_0x7073('0x1b')][_0x7073('0x24')]||null:null,'attributes':_0x204614['options']?_0x204614[_0x7073('0x1b')]['attributes']||null:null,'include':_0x204614[_0x7073('0x1b')]?_0x204614['options'][_0x7073('0x1e')]?_['map'](_0x204614[_0x7073('0x1b')][_0x7073('0x1e')],function(_0xdf5e06){return{'model':db[_0xdf5e06[_0x7073('0x20')]],'as':_0xdf5e06['as'],'attributes':_0xdf5e06[_0x7073('0x21')],'include':_0xdf5e06[_0x7073('0x1e')]?_['map'](_0xdf5e06[_0x7073('0x1e')],function(_0x3e3cd4){return{'model':db[_0x3e3cd4[_0x7073('0x20')]],'as':_0x3e3cd4['as'],'attributes':_0x3e3cd4['attributes'],'include':_0x3e3cd4[_0x7073('0x1e')]?_[_0x7073('0x1f')](_0x3e3cd4[_0x7073('0x1e')],function(_0x4ac678){return{'model':db[_0x4ac678[_0x7073('0x20')]],'as':_0x4ac678['as'],'attributes':_0x4ac678[_0x7073('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f4a02){logger['info']('ShowZendeskAccount',_0x204614);logger[_0x7073('0xf')](_0x7073('0x22'),_0x204614,JSON[_0x7073('0x11')](_0x4f4a02));_0x4861ab(_0x4f4a02);})[_0x7073('0x17')](function(_0x98773e){logger[_0x7073('0x12')]('ShowZendeskAccount',_0x98773e[_0x7073('0x15')],_0x204614);_0x55ba94(_0x51a7a7[_0x7073('0x12')](0x1f4,_0x98773e[_0x7073('0x15')]));});});}; \ No newline at end of file +var _0xf321=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','stringify','ShowZendeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x38115f,_0x55aaa0){var _0x5920e4=function(_0x1edab7){while(--_0x1edab7){_0x38115f['push'](_0x38115f['shift']());}};_0x5920e4(++_0x55aaa0);}(_0xf321,0x1dd));var _0x1f32=function(_0x398501,_0x13a48d){_0x398501=_0x398501-0x0;var _0x537129=_0xf321[_0x398501];return _0x537129;};'use strict';var _=require('lodash');var util=require(_0x1f32('0x0'));var moment=require(_0x1f32('0x1'));var BPromise=require(_0x1f32('0x2'));var rs=require(_0x1f32('0x3'));var fs=require('fs');var Redis=require(_0x1f32('0x4'));var db=require(_0x1f32('0x5'))['db'];var utils=require(_0x1f32('0x6'));var logger=require('../../config/logger')(_0x1f32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f32('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cc7a8,_0x9577e8,_0x5dc552){return new BPromise(function(_0x2175ef,_0x3d8f67){return client[_0x1f32('0x9')](_0x4cc7a8,_0x5dc552)[_0x1f32('0xa')](function(_0x4979b5){logger[_0x1f32('0xb')](_0x1f32('0xc'),_0x9577e8,_0x1f32('0xd'));logger[_0x1f32('0xe')](_0x1f32('0xf'),_0x9577e8,_0x1f32('0xd'),JSON['stringify'](_0x4979b5));if(_0x4979b5[_0x1f32('0x10')]){if(_0x4979b5[_0x1f32('0x10')][_0x1f32('0x11')]===0x1f4){logger[_0x1f32('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x9577e8,_0x4979b5[_0x1f32('0x10')][_0x1f32('0x12')]);return _0x3d8f67(_0x4979b5[_0x1f32('0x10')][_0x1f32('0x12')]);}logger[_0x1f32('0x10')](_0x1f32('0xc'),_0x9577e8,_0x4979b5[_0x1f32('0x10')][_0x1f32('0x12')]);return _0x2175ef(_0x4979b5[_0x1f32('0x10')]['message']);}else{logger['info'](_0x1f32('0xc'),_0x9577e8,_0x1f32('0xd'));_0x2175ef(_0x4979b5[_0x1f32('0x13')][_0x1f32('0x12')]);}})[_0x1f32('0x14')](function(_0x3d8641){logger[_0x1f32('0x10')](_0x1f32('0xc'),_0x9577e8,_0x3d8641);_0x3d8f67(_0x3d8641);});});}exports[_0x1f32('0x15')]=function(_0x3e6af0){var _0x2b90a2=this;return new Promise(function(_0xc3cf5b,_0x3acceb){return db[_0x1f32('0x16')][_0x1f32('0x17')]({'raw':_0x3e6af0[_0x1f32('0x18')]?_0x3e6af0['options'][_0x1f32('0x19')]===undefined?!![]:![]:!![],'where':_0x3e6af0['options']?_0x3e6af0[_0x1f32('0x18')][_0x1f32('0x1a')]||null:null,'attributes':_0x3e6af0[_0x1f32('0x18')]?_0x3e6af0[_0x1f32('0x18')][_0x1f32('0x1b')]||null:null,'limit':_0x3e6af0['options']?_0x3e6af0[_0x1f32('0x18')][_0x1f32('0x1c')]||null:null,'include':_0x3e6af0[_0x1f32('0x18')]?_0x3e6af0[_0x1f32('0x18')]['include']?_[_0x1f32('0x1d')](_0x3e6af0['options']['include'],function(_0x186e2c){return{'model':db[_0x186e2c[_0x1f32('0x1e')]],'as':_0x186e2c['as'],'attributes':_0x186e2c[_0x1f32('0x1b')],'include':_0x186e2c['include']?_[_0x1f32('0x1d')](_0x186e2c[_0x1f32('0x1f')],function(_0x1e0308){return{'model':db[_0x1e0308[_0x1f32('0x1e')]],'as':_0x1e0308['as'],'attributes':_0x1e0308['attributes'],'include':_0x1e0308['include']?_[_0x1f32('0x1d')](_0x1e0308[_0x1f32('0x1f')],function(_0x4cc6a3){return{'model':db[_0x4cc6a3[_0x1f32('0x1e')]],'as':_0x4cc6a3['as'],'attributes':_0x4cc6a3[_0x1f32('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1f32('0xa')](function(_0xf987ce){logger[_0x1f32('0xb')]('GetZendeskAccount',_0x3e6af0);logger[_0x1f32('0xe')](_0x1f32('0x15'),_0x3e6af0,JSON[_0x1f32('0x20')](_0xf987ce));_0xc3cf5b(_0xf987ce);})[_0x1f32('0x14')](function(_0x4519a3){logger[_0x1f32('0x10')](_0x1f32('0x15'),_0x4519a3['message'],_0x3e6af0);_0x3acceb(_0x2b90a2['error'](0x1f4,_0x4519a3[_0x1f32('0x12')]));});});};exports[_0x1f32('0x21')]=function(_0x5ed3a9){var _0x20e2e6=this;return new Promise(function(_0x26f90,_0x383391){return db['ZendeskAccount'][_0x1f32('0x22')]({'raw':_0x5ed3a9[_0x1f32('0x18')]?_0x5ed3a9[_0x1f32('0x18')][_0x1f32('0x19')]===undefined?!![]:![]:!![],'where':_0x5ed3a9['options']?_0x5ed3a9['options']['where']||null:null,'attributes':_0x5ed3a9[_0x1f32('0x18')]?_0x5ed3a9['options'][_0x1f32('0x1b')]||null:null,'include':_0x5ed3a9[_0x1f32('0x18')]?_0x5ed3a9[_0x1f32('0x18')][_0x1f32('0x1f')]?_[_0x1f32('0x1d')](_0x5ed3a9[_0x1f32('0x18')][_0x1f32('0x1f')],function(_0x494604){return{'model':db[_0x494604[_0x1f32('0x1e')]],'as':_0x494604['as'],'attributes':_0x494604['attributes'],'include':_0x494604[_0x1f32('0x1f')]?_[_0x1f32('0x1d')](_0x494604[_0x1f32('0x1f')],function(_0xd14038){return{'model':db[_0xd14038['model']],'as':_0xd14038['as'],'attributes':_0xd14038['attributes'],'include':_0xd14038['include']?_[_0x1f32('0x1d')](_0xd14038['include'],function(_0xe870c0){return{'model':db[_0xe870c0['model']],'as':_0xe870c0['as'],'attributes':_0xe870c0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31ae44){logger[_0x1f32('0xb')](_0x1f32('0x21'),_0x5ed3a9);logger[_0x1f32('0xe')](_0x1f32('0x21'),_0x5ed3a9,JSON['stringify'](_0x31ae44));_0x26f90(_0x31ae44);})[_0x1f32('0x14')](function(_0x433dc5){logger['error'](_0x1f32('0x21'),_0x433dc5[_0x1f32('0x12')],_0x5ed3a9);_0x383391(_0x20e2e6[_0x1f32('0x10')](0x1f4,_0x433dc5[_0x1f32('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8e61ce0..8af3e6a 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 _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xbef038,_0x4ad60f){var _0x477555=function(_0x1d93ea){while(--_0x1d93ea){_0xbef038['push'](_0xbef038['shift']());}};_0x477555(++_0x4ad60f);}(_0xac4a,0x13f));var _0xaac4=function(_0x78c2a5,_0x5a2b77){_0x78c2a5=_0x78c2a5-0x0;var _0x47bd8f=_0xac4a[_0x78c2a5];return _0x47bd8f;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 65085c5..c72dbf1 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 _0x6f0e=['STRING','sequelize','exports'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x6f0e,0xaf));var _0xe6f0=function(_0x3d720a,_0x5dbc23){_0x3d720a=_0x3d720a-0x0;var _0x4eaac6=_0x6f0e[_0x3d720a];return _0x4eaac6;};'use strict';var Sequelize=require(_0xe6f0('0x0'));module[_0xe6f0('0x1')]={'name':{'type':Sequelize[_0xe6f0('0x2')]},'description':{'type':Sequelize[_0xe6f0('0x2')]}}; \ No newline at end of file +var _0x54f8=['exports','STRING','sequelize'];(function(_0x362d21,_0x279bd1){var _0x19a1a0=function(_0x33d736){while(--_0x33d736){_0x362d21['push'](_0x362d21['shift']());}};_0x19a1a0(++_0x279bd1);}(_0x54f8,0x110));var _0x854f=function(_0x2f20de,_0x1cf382){_0x2f20de=_0x2f20de-0x0;var _0x67a12f=_0x54f8[_0x2f20de];return _0x67a12f;};'use strict';var Sequelize=require(_0x854f('0x0'));module[_0x854f('0x1')]={'name':{'type':Sequelize[_0x854f('0x2')]},'description':{'type':Sequelize[_0x854f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f66b1fa..b261061 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 _0xec23=['attributes','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','find','body','update','getFields','ZendeskField','pick','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','intersection','fields'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xec23,0x72));var _0x3ec2=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xec23[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require(_0x3ec2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ec2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ec2('0x2'));var moment=require('moment');var BPromise=require(_0x3ec2('0x3'));var Mustache=require(_0x3ec2('0x4'));var util=require('util');var path=require(_0x3ec2('0x5'));var sox=require(_0x3ec2('0x6'));var csv=require(_0x3ec2('0x7'));var ejs=require(_0x3ec2('0x8'));var fs=require('fs');var fs_extra=require(_0x3ec2('0x9'));var _=require('lodash');var squel=require(_0x3ec2('0xa'));var crypto=require(_0x3ec2('0xb'));var jsforce=require(_0x3ec2('0xc'));var deskjs=require(_0x3ec2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ec2('0xe'));var Papa=require(_0x3ec2('0xf'));var Redis=require(_0x3ec2('0x10'));var authService=require(_0x3ec2('0x11'));var qs=require(_0x3ec2('0x12'));var as=require(_0x3ec2('0x13'));var hardwareService=require(_0x3ec2('0x14'));var logger=require(_0x3ec2('0x15'))(_0x3ec2('0x16'));var utils=require(_0x3ec2('0x17'));var config=require(_0x3ec2('0x18'));var licenseUtil=require(_0x3ec2('0x19'));var db=require(_0x3ec2('0x1a'))['db'];function respondWithStatusCode(_0x145f28,_0x58a033){_0x58a033=_0x58a033||0xcc;return function(_0x317544){if(_0x317544){return _0x145f28[_0x3ec2('0x1b')](_0x58a033);}return _0x145f28[_0x3ec2('0x1c')](_0x58a033)[_0x3ec2('0x1d')]();};}function respondWithResult(_0x4ac422,_0x48ea87){_0x48ea87=_0x48ea87||0xc8;return function(_0x5f2b93){if(_0x5f2b93){return _0x4ac422['status'](_0x48ea87)[_0x3ec2('0x1e')](_0x5f2b93);}};}function respondWithFilteredResult(_0x243dad,_0x47fa48){return function(_0x131cad){if(_0x131cad){var _0x377a8b=typeof _0x47fa48['offset']===_0x3ec2('0x1f')&&typeof _0x47fa48[_0x3ec2('0x20')]===_0x3ec2('0x1f');var _0x526140=_0x131cad[_0x3ec2('0x21')];var _0x59e1bc=_0x377a8b?0x0:_0x47fa48[_0x3ec2('0x22')];var _0x165600=_0x377a8b?_0x131cad[_0x3ec2('0x21')]:_0x47fa48[_0x3ec2('0x22')]+_0x47fa48[_0x3ec2('0x20')];var _0x3ad370;if(_0x165600>=_0x526140){_0x165600=_0x526140;_0x3ad370=0xc8;}else{_0x3ad370=0xce;}_0x243dad['status'](_0x3ad370);return _0x243dad['set'](_0x3ec2('0x23'),_0x59e1bc+'-'+_0x165600+'/'+_0x526140)[_0x3ec2('0x1e')](_0x131cad);}return null;};}function patchUpdates(_0x3ccad4){return function(_0x31c828){try{jsonpatch['apply'](_0x31c828,_0x3ccad4,!![]);}catch(_0x20bad8){return BPromise[_0x3ec2('0x24')](_0x20bad8);}return _0x31c828[_0x3ec2('0x25')]();};}function saveUpdates(_0x4cf099,_0x7dff31){return function(_0x4c6a66){if(_0x4c6a66){return _0x4c6a66['update'](_0x4cf099)[_0x3ec2('0x26')](function(_0x4bdead){return _0x4bdead;});}return null;};}function removeEntity(_0x1c962b,_0x5546c0){return function(_0x468c85){if(_0x468c85){return _0x468c85[_0x3ec2('0x27')]()['then'](function(){_0x1c962b['status'](0xcc)[_0x3ec2('0x1d')]();});}};}function handleEntityNotFound(_0x1b17a5,_0x2a220a){return function(_0x2fcbbd){if(!_0x2fcbbd){_0x1b17a5['sendStatus'](0x194);}return _0x2fcbbd;};}function handleError(_0x24f790,_0x622284){_0x622284=_0x622284||0x1f4;return function(_0x32beb1){logger['error'](_0x32beb1['stack']);if(_0x32beb1[_0x3ec2('0x28')]){delete _0x32beb1[_0x3ec2('0x28')];}_0x24f790['status'](_0x622284)[_0x3ec2('0x29')](_0x32beb1);};}exports[_0x3ec2('0x2a')]=function(_0x2d8c3b,_0x2bdf07){var _0x4ee02f={},_0x12b3ae={},_0x1655fe={'count':0x0,'rows':[]};var _0x5bb33f=_[_0x3ec2('0x2b')](db[_0x3ec2('0x2c')][_0x3ec2('0x2d')],function(_0x418795){return{'name':_0x418795['fieldName'],'type':_0x418795[_0x3ec2('0x2e')][_0x3ec2('0x2f')]};});_0x12b3ae[_0x3ec2('0x30')]=_[_0x3ec2('0x2b')](_0x5bb33f,_0x3ec2('0x28'));_0x12b3ae[_0x3ec2('0x31')]=_['keys'](_0x2d8c3b[_0x3ec2('0x31')]);_0x12b3ae['filters']=_[_0x3ec2('0x32')](_0x12b3ae[_0x3ec2('0x30')],_0x12b3ae[_0x3ec2('0x31')]);_0x4ee02f['attributes']=_['intersection'](_0x12b3ae[_0x3ec2('0x30')],qs[_0x3ec2('0x33')](_0x2d8c3b['query'][_0x3ec2('0x33')]));_0x4ee02f[_0x3ec2('0x34')]=_0x4ee02f[_0x3ec2('0x34')]['length']?_0x4ee02f[_0x3ec2('0x34')]:_0x12b3ae[_0x3ec2('0x30')];if(!_0x2d8c3b[_0x3ec2('0x31')][_0x3ec2('0x35')](_0x3ec2('0x36'))){_0x4ee02f['limit']=qs['limit'](_0x2d8c3b[_0x3ec2('0x31')][_0x3ec2('0x20')]);_0x4ee02f[_0x3ec2('0x22')]=qs['offset'](_0x2d8c3b[_0x3ec2('0x31')][_0x3ec2('0x22')]);}_0x4ee02f[_0x3ec2('0x37')]=qs[_0x3ec2('0x38')](_0x2d8c3b[_0x3ec2('0x31')][_0x3ec2('0x38')]);_0x4ee02f['where']=qs[_0x3ec2('0x39')](_['pick'](_0x2d8c3b[_0x3ec2('0x31')],_0x12b3ae[_0x3ec2('0x39')]),_0x5bb33f);if(_0x2d8c3b[_0x3ec2('0x31')][_0x3ec2('0x3a')]){_0x4ee02f['where']=_[_0x3ec2('0x3b')](_0x4ee02f[_0x3ec2('0x3c')],{'$or':_['map'](_0x5bb33f,function(_0x2638a3){if(_0x2638a3[_0x3ec2('0x2e')]!==_0x3ec2('0x3d')){var _0x35e30c={};_0x35e30c[_0x2638a3[_0x3ec2('0x28')]]={'$like':'%'+_0x2d8c3b['query'][_0x3ec2('0x3a')]+'%'};return _0x35e30c;}})});}_0x4ee02f=_['merge']({},_0x4ee02f,_0x2d8c3b[_0x3ec2('0x3e')]);var _0x326fa5={'where':_0x4ee02f[_0x3ec2('0x3c')]};return db[_0x3ec2('0x2c')]['count'](_0x326fa5)[_0x3ec2('0x26')](function(_0x545aa5){_0x1655fe[_0x3ec2('0x21')]=_0x545aa5;if(_0x2d8c3b[_0x3ec2('0x31')]['includeAll']){_0x4ee02f[_0x3ec2('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x3ec2('0x40')](_0x4ee02f);})[_0x3ec2('0x26')](function(_0x55475a){_0x1655fe['rows']=_0x55475a;return _0x1655fe;})[_0x3ec2('0x26')](respondWithFilteredResult(_0x2bdf07,_0x4ee02f))[_0x3ec2('0x41')](handleError(_0x2bdf07,null));};exports[_0x3ec2('0x42')]=function(_0xee2ff6,_0x2f5dac){var _0x30eb78={'raw':![],'where':{'id':_0xee2ff6[_0x3ec2('0x43')]['id']}},_0x49caa8={};_0x49caa8[_0x3ec2('0x30')]=_[_0x3ec2('0x44')](db[_0x3ec2('0x2c')][_0x3ec2('0x2d')]);_0x49caa8[_0x3ec2('0x31')]=_[_0x3ec2('0x44')](_0xee2ff6[_0x3ec2('0x31')]);_0x49caa8[_0x3ec2('0x39')]=_[_0x3ec2('0x32')](_0x49caa8[_0x3ec2('0x30')],_0x49caa8[_0x3ec2('0x31')]);_0x30eb78[_0x3ec2('0x34')]=_[_0x3ec2('0x32')](_0x49caa8[_0x3ec2('0x30')],qs[_0x3ec2('0x33')](_0xee2ff6['query'][_0x3ec2('0x33')]));_0x30eb78[_0x3ec2('0x34')]=_0x30eb78[_0x3ec2('0x34')][_0x3ec2('0x45')]?_0x30eb78['attributes']:_0x49caa8[_0x3ec2('0x30')];if(_0xee2ff6[_0x3ec2('0x31')][_0x3ec2('0x46')]){_0x30eb78[_0x3ec2('0x3f')]=[{'all':!![]}];}_0x30eb78=_[_0x3ec2('0x3b')]({},_0x30eb78,_0xee2ff6[_0x3ec2('0x3e')]);return db[_0x3ec2('0x2c')][_0x3ec2('0x47')](_0x30eb78)[_0x3ec2('0x26')](handleEntityNotFound(_0x2f5dac,null))['then'](respondWithResult(_0x2f5dac,null))[_0x3ec2('0x41')](handleError(_0x2f5dac,null));};exports['create']=function(_0x55f406,_0x40c646){return db[_0x3ec2('0x2c')]['create'](_0x55f406[_0x3ec2('0x48')],{})[_0x3ec2('0x26')](respondWithResult(_0x40c646,0xc9))[_0x3ec2('0x41')](handleError(_0x40c646,null));};exports[_0x3ec2('0x49')]=function(_0x255df4,_0x282d78){if(_0x255df4[_0x3ec2('0x48')]['id']){delete _0x255df4[_0x3ec2('0x48')]['id'];}return db[_0x3ec2('0x2c')][_0x3ec2('0x47')]({'where':{'id':_0x255df4[_0x3ec2('0x43')]['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0x282d78,null))['then'](saveUpdates(_0x255df4[_0x3ec2('0x48')],null))[_0x3ec2('0x26')](respondWithResult(_0x282d78,null))[_0x3ec2('0x41')](handleError(_0x282d78,null));};exports[_0x3ec2('0x27')]=function(_0x28a048,_0x15afca){return db[_0x3ec2('0x2c')][_0x3ec2('0x47')]({'where':{'id':_0x28a048[_0x3ec2('0x43')]['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0x15afca,null))[_0x3ec2('0x26')](removeEntity(_0x15afca,null))[_0x3ec2('0x41')](handleError(_0x15afca,null));};exports[_0x3ec2('0x4a')]=function(_0x47fef6,_0x58e2c2,_0x35557a){var _0x3aecb6={};var _0x2a2976={};var _0x3fbbf3;var _0x26c4cf;return db[_0x3ec2('0x2c')]['findOne']({'where':{'id':_0x47fef6[_0x3ec2('0x43')]['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0x58e2c2,null))[_0x3ec2('0x26')](function(_0x1a4006){if(_0x1a4006){_0x3fbbf3=_0x1a4006;_0x2a2976[_0x3ec2('0x30')]=_[_0x3ec2('0x44')](db[_0x3ec2('0x4b')][_0x3ec2('0x2d')]);_0x2a2976['query']=_[_0x3ec2('0x44')](_0x47fef6[_0x3ec2('0x31')]);_0x2a2976['filters']=_[_0x3ec2('0x32')](_0x2a2976[_0x3ec2('0x30')],_0x2a2976['query']);_0x3aecb6[_0x3ec2('0x34')]=_[_0x3ec2('0x32')](_0x2a2976['model'],qs[_0x3ec2('0x33')](_0x47fef6[_0x3ec2('0x31')][_0x3ec2('0x33')]));_0x3aecb6['attributes']=_0x3aecb6['attributes'][_0x3ec2('0x45')]?_0x3aecb6[_0x3ec2('0x34')]:_0x2a2976[_0x3ec2('0x30')];_0x3aecb6['order']=qs[_0x3ec2('0x38')](_0x47fef6['query'][_0x3ec2('0x38')]);_0x3aecb6['where']=qs[_0x3ec2('0x39')](_[_0x3ec2('0x4c')](_0x47fef6[_0x3ec2('0x31')],_0x2a2976[_0x3ec2('0x39')]));if(_0x47fef6[_0x3ec2('0x31')][_0x3ec2('0x3a')]){_0x3aecb6[_0x3ec2('0x3c')]=_[_0x3ec2('0x3b')](_0x3aecb6[_0x3ec2('0x3c')],{'$or':_[_0x3ec2('0x2b')](_0x3aecb6[_0x3ec2('0x34')],function(_0x5d00aa){var _0x28f773={};_0x28f773[_0x5d00aa]={'$like':'%'+_0x47fef6['query'][_0x3ec2('0x3a')]+'%'};return _0x28f773;})});}_0x3aecb6=_[_0x3ec2('0x3b')]({},_0x3aecb6,_0x47fef6[_0x3ec2('0x3e')]);return _0x3fbbf3[_0x3ec2('0x4a')](_0x3aecb6);}})[_0x3ec2('0x26')](function(_0x7d2e1d){if(_0x7d2e1d){_0x26c4cf=_0x7d2e1d[_0x3ec2('0x45')];if(!_0x47fef6[_0x3ec2('0x31')][_0x3ec2('0x35')](_0x3ec2('0x36'))){_0x3aecb6[_0x3ec2('0x20')]=qs[_0x3ec2('0x20')](_0x47fef6[_0x3ec2('0x31')]['limit']);_0x3aecb6['offset']=qs['offset'](_0x47fef6[_0x3ec2('0x31')][_0x3ec2('0x22')]);}return _0x3fbbf3[_0x3ec2('0x4a')](_0x3aecb6);}})[_0x3ec2('0x26')](function(_0x3aed20){if(_0x3aed20){return _0x3aed20?{'count':_0x26c4cf,'rows':_0x3aed20}:null;}})['then'](respondWithResult(_0x58e2c2,null))[_0x3ec2('0x41')](handleError(_0x58e2c2,null));};exports[_0x3ec2('0x4d')]=function(_0x2cf33b,_0x47f7d2,_0x57f1af){var _0x7332e1={};var _0x5a5c2f={};var _0x80cef;var _0x176688;return db[_0x3ec2('0x2c')][_0x3ec2('0x4e')]({'where':{'id':_0x2cf33b['params']['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0x47f7d2,null))[_0x3ec2('0x26')](function(_0x248979){if(_0x248979){_0x80cef=_0x248979;_0x5a5c2f[_0x3ec2('0x30')]=_[_0x3ec2('0x44')](db['ZendeskField'][_0x3ec2('0x2d')]);_0x5a5c2f[_0x3ec2('0x31')]=_[_0x3ec2('0x44')](_0x2cf33b[_0x3ec2('0x31')]);_0x5a5c2f[_0x3ec2('0x39')]=_[_0x3ec2('0x32')](_0x5a5c2f[_0x3ec2('0x30')],_0x5a5c2f[_0x3ec2('0x31')]);_0x7332e1[_0x3ec2('0x34')]=_[_0x3ec2('0x32')](_0x5a5c2f['model'],qs[_0x3ec2('0x33')](_0x2cf33b['query'][_0x3ec2('0x33')]));_0x7332e1[_0x3ec2('0x34')]=_0x7332e1[_0x3ec2('0x34')]['length']?_0x7332e1[_0x3ec2('0x34')]:_0x5a5c2f[_0x3ec2('0x30')];_0x7332e1[_0x3ec2('0x37')]=qs[_0x3ec2('0x38')](_0x2cf33b[_0x3ec2('0x31')][_0x3ec2('0x38')]);_0x7332e1[_0x3ec2('0x3c')]=qs[_0x3ec2('0x39')](_[_0x3ec2('0x4c')](_0x2cf33b[_0x3ec2('0x31')],_0x5a5c2f[_0x3ec2('0x39')]));if(_0x2cf33b[_0x3ec2('0x31')][_0x3ec2('0x3a')]){_0x7332e1['where']=_[_0x3ec2('0x3b')](_0x7332e1[_0x3ec2('0x3c')],{'$or':_[_0x3ec2('0x2b')](_0x7332e1[_0x3ec2('0x34')],function(_0x1b4f5c){var _0x274725={};_0x274725[_0x1b4f5c]={'$like':'%'+_0x2cf33b['query'][_0x3ec2('0x3a')]+'%'};return _0x274725;})});}_0x7332e1=_[_0x3ec2('0x3b')]({},_0x7332e1,_0x2cf33b[_0x3ec2('0x3e')]);return _0x80cef[_0x3ec2('0x4d')](_0x7332e1);}})['then'](function(_0x5e8aa6){if(_0x5e8aa6){_0x176688=_0x5e8aa6[_0x3ec2('0x45')];if(!_0x2cf33b[_0x3ec2('0x31')][_0x3ec2('0x35')](_0x3ec2('0x36'))){_0x7332e1[_0x3ec2('0x20')]=qs[_0x3ec2('0x20')](_0x2cf33b['query'][_0x3ec2('0x20')]);_0x7332e1[_0x3ec2('0x22')]=qs[_0x3ec2('0x22')](_0x2cf33b[_0x3ec2('0x31')][_0x3ec2('0x22')]);}return _0x80cef[_0x3ec2('0x4d')](_0x7332e1);}})[_0x3ec2('0x26')](function(_0xbbbbd0){if(_0xbbbbd0){return _0xbbbbd0?{'count':_0x176688,'rows':_0xbbbbd0}:null;}})['then'](respondWithResult(_0x47f7d2,null))['catch'](handleError(_0x47f7d2,null));};exports[_0x3ec2('0x4f')]=function(_0x1bf400,_0xd26e30,_0x116fbf){var _0xee81cb={};var _0x2590df={};var _0x345e70;var _0x2a9f4c;return db['ZendeskConfiguration'][_0x3ec2('0x4e')]({'where':{'id':_0x1bf400[_0x3ec2('0x43')]['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0xd26e30,null))[_0x3ec2('0x26')](function(_0x59fa52){if(_0x59fa52){_0x345e70=_0x59fa52;_0x2590df[_0x3ec2('0x30')]=_['keys'](db[_0x3ec2('0x4b')]['rawAttributes']);_0x2590df['query']=_[_0x3ec2('0x44')](_0x1bf400[_0x3ec2('0x31')]);_0x2590df[_0x3ec2('0x39')]=_['intersection'](_0x2590df['model'],_0x2590df[_0x3ec2('0x31')]);_0xee81cb[_0x3ec2('0x34')]=_[_0x3ec2('0x32')](_0x2590df[_0x3ec2('0x30')],qs[_0x3ec2('0x33')](_0x1bf400[_0x3ec2('0x31')][_0x3ec2('0x33')]));_0xee81cb[_0x3ec2('0x34')]=_0xee81cb[_0x3ec2('0x34')]['length']?_0xee81cb[_0x3ec2('0x34')]:_0x2590df['model'];_0xee81cb['order']=qs[_0x3ec2('0x38')](_0x1bf400[_0x3ec2('0x31')][_0x3ec2('0x38')]);_0xee81cb[_0x3ec2('0x3c')]=qs[_0x3ec2('0x39')](_[_0x3ec2('0x4c')](_0x1bf400[_0x3ec2('0x31')],_0x2590df[_0x3ec2('0x39')]));if(_0x1bf400[_0x3ec2('0x31')][_0x3ec2('0x3a')]){_0xee81cb['where']=_['merge'](_0xee81cb[_0x3ec2('0x3c')],{'$or':_[_0x3ec2('0x2b')](_0xee81cb[_0x3ec2('0x34')],function(_0x17179e){var _0x25eb02={};_0x25eb02[_0x17179e]={'$like':'%'+_0x1bf400[_0x3ec2('0x31')]['filter']+'%'};return _0x25eb02;})});}_0xee81cb=_[_0x3ec2('0x3b')]({},_0xee81cb,_0x1bf400[_0x3ec2('0x3e')]);return _0x345e70[_0x3ec2('0x4f')](_0xee81cb);}})[_0x3ec2('0x26')](function(_0x3ab89b){if(_0x3ab89b){_0x2a9f4c=_0x3ab89b[_0x3ec2('0x45')];if(!_0x1bf400['query']['hasOwnProperty'](_0x3ec2('0x36'))){_0xee81cb[_0x3ec2('0x20')]=qs[_0x3ec2('0x20')](_0x1bf400[_0x3ec2('0x31')][_0x3ec2('0x20')]);_0xee81cb['offset']=qs[_0x3ec2('0x22')](_0x1bf400[_0x3ec2('0x31')][_0x3ec2('0x22')]);}return _0x345e70[_0x3ec2('0x4f')](_0xee81cb);}})[_0x3ec2('0x26')](function(_0x2eb4a7){if(_0x2eb4a7){return _0x2eb4a7?{'count':_0x2a9f4c,'rows':_0x2eb4a7}:null;}})['then'](respondWithResult(_0xd26e30,null))[_0x3ec2('0x41')](handleError(_0xd26e30,null));};exports['getTags']=function(_0x51cd83,_0x1bf9ff,_0x5f4e01){var _0x61eadb={};var _0x2eed4c={};var _0x686782;var _0xd250f9;return db[_0x3ec2('0x2c')]['findOne']({'where':{'id':_0x51cd83[_0x3ec2('0x43')]['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0x1bf9ff,null))[_0x3ec2('0x26')](function(_0x4e9137){if(_0x4e9137){_0x686782=_0x4e9137;_0x2eed4c[_0x3ec2('0x30')]=_['keys'](db['Tag'][_0x3ec2('0x2d')]);_0x2eed4c['query']=_['keys'](_0x51cd83[_0x3ec2('0x31')]);_0x2eed4c['filters']=_[_0x3ec2('0x32')](_0x2eed4c[_0x3ec2('0x30')],_0x2eed4c[_0x3ec2('0x31')]);_0x61eadb[_0x3ec2('0x34')]=_[_0x3ec2('0x32')](_0x2eed4c['model'],qs[_0x3ec2('0x33')](_0x51cd83[_0x3ec2('0x31')][_0x3ec2('0x33')]));_0x61eadb['attributes']=_0x61eadb[_0x3ec2('0x34')]['length']?_0x61eadb[_0x3ec2('0x34')]:_0x2eed4c['model'];_0x61eadb[_0x3ec2('0x37')]=qs['sort'](_0x51cd83['query'][_0x3ec2('0x38')]);_0x61eadb[_0x3ec2('0x3c')]=qs[_0x3ec2('0x39')](_[_0x3ec2('0x4c')](_0x51cd83[_0x3ec2('0x31')],_0x2eed4c['filters']));if(_0x51cd83[_0x3ec2('0x31')]['filter']){_0x61eadb[_0x3ec2('0x3c')]=_[_0x3ec2('0x3b')](_0x61eadb['where'],{'$or':_['map'](_0x61eadb[_0x3ec2('0x34')],function(_0x29c39f){var _0x3b975f={};_0x3b975f[_0x29c39f]={'$like':'%'+_0x51cd83[_0x3ec2('0x31')][_0x3ec2('0x3a')]+'%'};return _0x3b975f;})});}_0x61eadb=_[_0x3ec2('0x3b')]({},_0x61eadb,_0x51cd83[_0x3ec2('0x3e')]);return _0x686782[_0x3ec2('0x50')](_0x61eadb);}})[_0x3ec2('0x26')](function(_0x58de1e){if(_0x58de1e){_0xd250f9=_0x58de1e[_0x3ec2('0x45')];if(!_0x51cd83[_0x3ec2('0x31')][_0x3ec2('0x35')](_0x3ec2('0x36'))){_0x61eadb[_0x3ec2('0x20')]=qs['limit'](_0x51cd83[_0x3ec2('0x31')]['limit']);_0x61eadb[_0x3ec2('0x22')]=qs['offset'](_0x51cd83[_0x3ec2('0x31')][_0x3ec2('0x22')]);}return _0x686782[_0x3ec2('0x50')](_0x61eadb);}})['then'](function(_0x2e9496){if(_0x2e9496){return _0x2e9496?{'count':_0xd250f9,'rows':_0x2e9496}:null;}})[_0x3ec2('0x26')](respondWithResult(_0x1bf9ff,null))[_0x3ec2('0x41')](handleError(_0x1bf9ff,null));};exports['setTags']=function(_0x573998,_0x4be6aa,_0x597368){if(_0x573998[_0x3ec2('0x48')]['id']){delete _0x573998['body']['id'];}return db[_0x3ec2('0x2c')][_0x3ec2('0x4e')]({'where':{'id':_0x573998['params']['id']}})[_0x3ec2('0x26')](handleEntityNotFound(_0x4be6aa,null))[_0x3ec2('0x26')](function(_0x374b63){if(_0x374b63){return _0x374b63[_0x3ec2('0x51')](_0x573998[_0x3ec2('0x48')][_0x3ec2('0x52')]||[]);}return null;})[_0x3ec2('0x26')](respondWithResult(_0x4be6aa,null))[_0x3ec2('0x41')](handleError(_0x4be6aa,null));}; \ No newline at end of file +var _0xd7ca=['where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','catch','create','body','find','getFields','findOne','options','getSubjects','getDescriptions','ZendeskField','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','ZendeskConfiguration','rawAttributes','fieldName','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x14cc1,_0x2391fc){var _0x3d92a7=function(_0x359a9a){while(--_0x359a9a){_0x14cc1['push'](_0x14cc1['shift']());}};_0x3d92a7(++_0x2391fc);}(_0xd7ca,0x70));var _0xad7c=function(_0x3fa5a9,_0x541163){_0x3fa5a9=_0x3fa5a9-0x0;var _0x173c5b=_0xd7ca[_0x3fa5a9];return _0x173c5b;};'use strict';var emlformat=require(_0xad7c('0x0'));var rimraf=require(_0xad7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad7c('0x2'));var rp=require(_0xad7c('0x3'));var moment=require(_0xad7c('0x4'));var BPromise=require(_0xad7c('0x5'));var Mustache=require(_0xad7c('0x6'));var util=require('util');var path=require(_0xad7c('0x7'));var sox=require(_0xad7c('0x8'));var csv=require(_0xad7c('0x9'));var ejs=require(_0xad7c('0xa'));var fs=require('fs');var fs_extra=require(_0xad7c('0xb'));var _=require(_0xad7c('0xc'));var squel=require(_0xad7c('0xd'));var crypto=require(_0xad7c('0xe'));var jsforce=require(_0xad7c('0xf'));var deskjs=require(_0xad7c('0x10'));var toCsv=require(_0xad7c('0x9'));var querystring=require(_0xad7c('0x11'));var Papa=require(_0xad7c('0x12'));var Redis=require(_0xad7c('0x13'));var authService=require(_0xad7c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xad7c('0x15'));var hardwareService=require(_0xad7c('0x16'));var logger=require(_0xad7c('0x17'))(_0xad7c('0x18'));var utils=require(_0xad7c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xad7c('0x1a'));var db=require(_0xad7c('0x1b'))['db'];function respondWithStatusCode(_0x64c855,_0x3cb4ab){_0x3cb4ab=_0x3cb4ab||0xcc;return function(_0xad4770){if(_0xad4770){return _0x64c855['sendStatus'](_0x3cb4ab);}return _0x64c855[_0xad7c('0x1c')](_0x3cb4ab)[_0xad7c('0x1d')]();};}function respondWithResult(_0x487fe4,_0x10752d){_0x10752d=_0x10752d||0xc8;return function(_0x5649cb){if(_0x5649cb){return _0x487fe4[_0xad7c('0x1c')](_0x10752d)[_0xad7c('0x1e')](_0x5649cb);}};}function respondWithFilteredResult(_0x332ef9,_0x48dca7){return function(_0x228e91){if(_0x228e91){var _0x5943bf=typeof _0x48dca7['offset']===_0xad7c('0x1f')&&typeof _0x48dca7['limit']===_0xad7c('0x1f');var _0x2ae98c=_0x228e91[_0xad7c('0x20')];var _0x2df3da=_0x5943bf?0x0:_0x48dca7[_0xad7c('0x21')];var _0x317932=_0x5943bf?_0x228e91[_0xad7c('0x20')]:_0x48dca7[_0xad7c('0x21')]+_0x48dca7[_0xad7c('0x22')];var _0x4dcb49;if(_0x317932>=_0x2ae98c){_0x317932=_0x2ae98c;_0x4dcb49=0xc8;}else{_0x4dcb49=0xce;}_0x332ef9[_0xad7c('0x1c')](_0x4dcb49);return _0x332ef9['set'](_0xad7c('0x23'),_0x2df3da+'-'+_0x317932+'/'+_0x2ae98c)[_0xad7c('0x1e')](_0x228e91);}return null;};}function patchUpdates(_0x4760d5){return function(_0x1c40d0){try{jsonpatch[_0xad7c('0x24')](_0x1c40d0,_0x4760d5,!![]);}catch(_0x21f4c5){return BPromise[_0xad7c('0x25')](_0x21f4c5);}return _0x1c40d0[_0xad7c('0x26')]();};}function saveUpdates(_0x11a268,_0x16af53){return function(_0x67399c){if(_0x67399c){return _0x67399c[_0xad7c('0x27')](_0x11a268)[_0xad7c('0x28')](function(_0x385016){return _0x385016;});}return null;};}function removeEntity(_0x517cf6,_0x3f119f){return function(_0xf42563){if(_0xf42563){return _0xf42563[_0xad7c('0x29')]()['then'](function(){_0x517cf6[_0xad7c('0x1c')](0xcc)[_0xad7c('0x1d')]();});}};}function handleEntityNotFound(_0x342ef6,_0x19970f){return function(_0x1b80d2){if(!_0x1b80d2){_0x342ef6[_0xad7c('0x2a')](0x194);}return _0x1b80d2;};}function handleError(_0x38be9f,_0x10a6f6){_0x10a6f6=_0x10a6f6||0x1f4;return function(_0xb594b1){logger[_0xad7c('0x2b')](_0xb594b1[_0xad7c('0x2c')]);if(_0xb594b1['name']){delete _0xb594b1['name'];}_0x38be9f['status'](_0x10a6f6)[_0xad7c('0x2d')](_0xb594b1);};}exports[_0xad7c('0x2e')]=function(_0x3ad2bc,_0x16c83e){var _0x3967bf={},_0x3e42e1={},_0x975443={'count':0x0,'rows':[]};var _0x4a5db0=_['map'](db[_0xad7c('0x2f')][_0xad7c('0x30')],function(_0xbdb6b0){return{'name':_0xbdb6b0[_0xad7c('0x31')],'type':_0xbdb6b0['type']['key']};});_0x3e42e1[_0xad7c('0x32')]=_[_0xad7c('0x33')](_0x4a5db0,_0xad7c('0x34'));_0x3e42e1[_0xad7c('0x35')]=_[_0xad7c('0x36')](_0x3ad2bc['query']);_0x3e42e1[_0xad7c('0x37')]=_['intersection'](_0x3e42e1[_0xad7c('0x32')],_0x3e42e1['query']);_0x3967bf[_0xad7c('0x38')]=_[_0xad7c('0x39')](_0x3e42e1[_0xad7c('0x32')],qs[_0xad7c('0x3a')](_0x3ad2bc[_0xad7c('0x35')]['fields']));_0x3967bf[_0xad7c('0x38')]=_0x3967bf[_0xad7c('0x38')][_0xad7c('0x3b')]?_0x3967bf[_0xad7c('0x38')]:_0x3e42e1[_0xad7c('0x32')];if(!_0x3ad2bc['query'][_0xad7c('0x3c')](_0xad7c('0x3d'))){_0x3967bf[_0xad7c('0x22')]=qs[_0xad7c('0x22')](_0x3ad2bc[_0xad7c('0x35')][_0xad7c('0x22')]);_0x3967bf[_0xad7c('0x21')]=qs[_0xad7c('0x21')](_0x3ad2bc[_0xad7c('0x35')][_0xad7c('0x21')]);}_0x3967bf[_0xad7c('0x3e')]=qs['sort'](_0x3ad2bc['query'][_0xad7c('0x3f')]);_0x3967bf[_0xad7c('0x40')]=qs['filters'](_[_0xad7c('0x41')](_0x3ad2bc['query'],_0x3e42e1[_0xad7c('0x37')]),_0x4a5db0);if(_0x3ad2bc[_0xad7c('0x35')][_0xad7c('0x42')]){_0x3967bf['where']=_[_0xad7c('0x43')](_0x3967bf['where'],{'$or':_[_0xad7c('0x33')](_0x4a5db0,function(_0x218f3c){if(_0x218f3c['type']!==_0xad7c('0x44')){var _0x4016ed={};_0x4016ed[_0x218f3c[_0xad7c('0x34')]]={'$like':'%'+_0x3ad2bc[_0xad7c('0x35')][_0xad7c('0x42')]+'%'};return _0x4016ed;}})});}_0x3967bf=_[_0xad7c('0x43')]({},_0x3967bf,_0x3ad2bc['options']);var _0x2f6776={'where':_0x3967bf[_0xad7c('0x40')]};return db[_0xad7c('0x2f')][_0xad7c('0x20')](_0x2f6776)[_0xad7c('0x28')](function(_0x3d96f2){_0x975443['count']=_0x3d96f2;if(_0x3ad2bc[_0xad7c('0x35')][_0xad7c('0x45')]){_0x3967bf['include']=[{'all':!![]}];}return db[_0xad7c('0x2f')][_0xad7c('0x46')](_0x3967bf);})['then'](function(_0x1fcb17){_0x975443[_0xad7c('0x47')]=_0x1fcb17;return _0x975443;})[_0xad7c('0x28')](respondWithFilteredResult(_0x16c83e,_0x3967bf))['catch'](handleError(_0x16c83e,null));};exports['show']=function(_0x56030f,_0xc1287d){var _0x413885={'raw':![],'where':{'id':_0x56030f[_0xad7c('0x48')]['id']}},_0x5d1bfe={};_0x5d1bfe[_0xad7c('0x32')]=_[_0xad7c('0x36')](db[_0xad7c('0x2f')]['rawAttributes']);_0x5d1bfe[_0xad7c('0x35')]=_[_0xad7c('0x36')](_0x56030f['query']);_0x5d1bfe[_0xad7c('0x37')]=_[_0xad7c('0x39')](_0x5d1bfe[_0xad7c('0x32')],_0x5d1bfe[_0xad7c('0x35')]);_0x413885[_0xad7c('0x38')]=_[_0xad7c('0x39')](_0x5d1bfe[_0xad7c('0x32')],qs['fields'](_0x56030f[_0xad7c('0x35')][_0xad7c('0x3a')]));_0x413885[_0xad7c('0x38')]=_0x413885['attributes'][_0xad7c('0x3b')]?_0x413885[_0xad7c('0x38')]:_0x5d1bfe[_0xad7c('0x32')];if(_0x56030f[_0xad7c('0x35')][_0xad7c('0x45')]){_0x413885[_0xad7c('0x49')]=[{'all':!![]}];}_0x413885=_[_0xad7c('0x43')]({},_0x413885,_0x56030f['options']);return db[_0xad7c('0x2f')]['find'](_0x413885)[_0xad7c('0x28')](handleEntityNotFound(_0xc1287d,null))[_0xad7c('0x28')](respondWithResult(_0xc1287d,null))[_0xad7c('0x4a')](handleError(_0xc1287d,null));};exports[_0xad7c('0x4b')]=function(_0x5962e0,_0x3d5a6c){return db[_0xad7c('0x2f')][_0xad7c('0x4b')](_0x5962e0[_0xad7c('0x4c')],{})[_0xad7c('0x28')](respondWithResult(_0x3d5a6c,0xc9))[_0xad7c('0x4a')](handleError(_0x3d5a6c,null));};exports['update']=function(_0x1f9308,_0x52a3fe){if(_0x1f9308[_0xad7c('0x4c')]['id']){delete _0x1f9308[_0xad7c('0x4c')]['id'];}return db[_0xad7c('0x2f')]['find']({'where':{'id':_0x1f9308[_0xad7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x52a3fe,null))[_0xad7c('0x28')](saveUpdates(_0x1f9308[_0xad7c('0x4c')],null))[_0xad7c('0x28')](respondWithResult(_0x52a3fe,null))['catch'](handleError(_0x52a3fe,null));};exports[_0xad7c('0x29')]=function(_0x544ad4,_0x222378){return db['ZendeskConfiguration'][_0xad7c('0x4d')]({'where':{'id':_0x544ad4[_0xad7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x222378,null))['then'](removeEntity(_0x222378,null))[_0xad7c('0x4a')](handleError(_0x222378,null));};exports[_0xad7c('0x4e')]=function(_0x299397,_0x33aa5c,_0x476ece){var _0x4b49f3={};var _0x162acd={};var _0x343f7e;var _0x471a2a;return db[_0xad7c('0x2f')][_0xad7c('0x4f')]({'where':{'id':_0x299397[_0xad7c('0x48')]['id']}})[_0xad7c('0x28')](handleEntityNotFound(_0x33aa5c,null))[_0xad7c('0x28')](function(_0x53538c){if(_0x53538c){_0x343f7e=_0x53538c;_0x162acd[_0xad7c('0x32')]=_[_0xad7c('0x36')](db['ZendeskField'][_0xad7c('0x30')]);_0x162acd[_0xad7c('0x35')]=_[_0xad7c('0x36')](_0x299397[_0xad7c('0x35')]);_0x162acd[_0xad7c('0x37')]=_[_0xad7c('0x39')](_0x162acd[_0xad7c('0x32')],_0x162acd[_0xad7c('0x35')]);_0x4b49f3['attributes']=_[_0xad7c('0x39')](_0x162acd['model'],qs['fields'](_0x299397[_0xad7c('0x35')][_0xad7c('0x3a')]));_0x4b49f3['attributes']=_0x4b49f3[_0xad7c('0x38')][_0xad7c('0x3b')]?_0x4b49f3[_0xad7c('0x38')]:_0x162acd['model'];_0x4b49f3['order']=qs[_0xad7c('0x3f')](_0x299397['query'][_0xad7c('0x3f')]);_0x4b49f3[_0xad7c('0x40')]=qs[_0xad7c('0x37')](_[_0xad7c('0x41')](_0x299397[_0xad7c('0x35')],_0x162acd['filters']));if(_0x299397[_0xad7c('0x35')][_0xad7c('0x42')]){_0x4b49f3['where']=_[_0xad7c('0x43')](_0x4b49f3[_0xad7c('0x40')],{'$or':_[_0xad7c('0x33')](_0x4b49f3[_0xad7c('0x38')],function(_0x357857){var _0x20dcf4={};_0x20dcf4[_0x357857]={'$like':'%'+_0x299397['query']['filter']+'%'};return _0x20dcf4;})});}_0x4b49f3=_[_0xad7c('0x43')]({},_0x4b49f3,_0x299397[_0xad7c('0x50')]);return _0x343f7e[_0xad7c('0x4e')](_0x4b49f3);}})[_0xad7c('0x28')](function(_0x1275ce){if(_0x1275ce){_0x471a2a=_0x1275ce[_0xad7c('0x3b')];if(!_0x299397[_0xad7c('0x35')]['hasOwnProperty'](_0xad7c('0x3d'))){_0x4b49f3[_0xad7c('0x22')]=qs[_0xad7c('0x22')](_0x299397['query'][_0xad7c('0x22')]);_0x4b49f3['offset']=qs[_0xad7c('0x21')](_0x299397[_0xad7c('0x35')][_0xad7c('0x21')]);}return _0x343f7e[_0xad7c('0x4e')](_0x4b49f3);}})[_0xad7c('0x28')](function(_0x5afbd0){if(_0x5afbd0){return _0x5afbd0?{'count':_0x471a2a,'rows':_0x5afbd0}:null;}})[_0xad7c('0x28')](respondWithResult(_0x33aa5c,null))[_0xad7c('0x4a')](handleError(_0x33aa5c,null));};exports['getSubjects']=function(_0x54b6fa,_0xc12d6e,_0x11b5d5){var _0x275ea1={};var _0x3affc1={};var _0x5caf57;var _0xd555d3;return db['ZendeskConfiguration'][_0xad7c('0x4f')]({'where':{'id':_0x54b6fa[_0xad7c('0x48')]['id']}})['then'](handleEntityNotFound(_0xc12d6e,null))[_0xad7c('0x28')](function(_0x162289){if(_0x162289){_0x5caf57=_0x162289;_0x3affc1['model']=_[_0xad7c('0x36')](db['ZendeskField']['rawAttributes']);_0x3affc1[_0xad7c('0x35')]=_[_0xad7c('0x36')](_0x54b6fa[_0xad7c('0x35')]);_0x3affc1[_0xad7c('0x37')]=_[_0xad7c('0x39')](_0x3affc1[_0xad7c('0x32')],_0x3affc1[_0xad7c('0x35')]);_0x275ea1[_0xad7c('0x38')]=_[_0xad7c('0x39')](_0x3affc1[_0xad7c('0x32')],qs[_0xad7c('0x3a')](_0x54b6fa[_0xad7c('0x35')][_0xad7c('0x3a')]));_0x275ea1[_0xad7c('0x38')]=_0x275ea1[_0xad7c('0x38')][_0xad7c('0x3b')]?_0x275ea1[_0xad7c('0x38')]:_0x3affc1[_0xad7c('0x32')];_0x275ea1[_0xad7c('0x3e')]=qs[_0xad7c('0x3f')](_0x54b6fa[_0xad7c('0x35')][_0xad7c('0x3f')]);_0x275ea1[_0xad7c('0x40')]=qs[_0xad7c('0x37')](_[_0xad7c('0x41')](_0x54b6fa['query'],_0x3affc1[_0xad7c('0x37')]));if(_0x54b6fa[_0xad7c('0x35')][_0xad7c('0x42')]){_0x275ea1[_0xad7c('0x40')]=_[_0xad7c('0x43')](_0x275ea1['where'],{'$or':_['map'](_0x275ea1[_0xad7c('0x38')],function(_0x35f0a1){var _0x51ebc1={};_0x51ebc1[_0x35f0a1]={'$like':'%'+_0x54b6fa[_0xad7c('0x35')][_0xad7c('0x42')]+'%'};return _0x51ebc1;})});}_0x275ea1=_[_0xad7c('0x43')]({},_0x275ea1,_0x54b6fa['options']);return _0x5caf57[_0xad7c('0x51')](_0x275ea1);}})[_0xad7c('0x28')](function(_0x1c1ef3){if(_0x1c1ef3){_0xd555d3=_0x1c1ef3[_0xad7c('0x3b')];if(!_0x54b6fa[_0xad7c('0x35')][_0xad7c('0x3c')]('nolimit')){_0x275ea1['limit']=qs[_0xad7c('0x22')](_0x54b6fa[_0xad7c('0x35')]['limit']);_0x275ea1[_0xad7c('0x21')]=qs[_0xad7c('0x21')](_0x54b6fa[_0xad7c('0x35')][_0xad7c('0x21')]);}return _0x5caf57['getSubjects'](_0x275ea1);}})[_0xad7c('0x28')](function(_0x413012){if(_0x413012){return _0x413012?{'count':_0xd555d3,'rows':_0x413012}:null;}})[_0xad7c('0x28')](respondWithResult(_0xc12d6e,null))['catch'](handleError(_0xc12d6e,null));};exports[_0xad7c('0x52')]=function(_0x2b038b,_0xabacaf,_0x565be1){var _0x5ba9e2={};var _0x113734={};var _0x489c5f;var _0xcbc80b;return db[_0xad7c('0x2f')][_0xad7c('0x4f')]({'where':{'id':_0x2b038b[_0xad7c('0x48')]['id']}})[_0xad7c('0x28')](handleEntityNotFound(_0xabacaf,null))[_0xad7c('0x28')](function(_0x2256dd){if(_0x2256dd){_0x489c5f=_0x2256dd;_0x113734[_0xad7c('0x32')]=_[_0xad7c('0x36')](db[_0xad7c('0x53')][_0xad7c('0x30')]);_0x113734['query']=_['keys'](_0x2b038b['query']);_0x113734[_0xad7c('0x37')]=_[_0xad7c('0x39')](_0x113734[_0xad7c('0x32')],_0x113734[_0xad7c('0x35')]);_0x5ba9e2['attributes']=_[_0xad7c('0x39')](_0x113734['model'],qs[_0xad7c('0x3a')](_0x2b038b[_0xad7c('0x35')][_0xad7c('0x3a')]));_0x5ba9e2[_0xad7c('0x38')]=_0x5ba9e2[_0xad7c('0x38')][_0xad7c('0x3b')]?_0x5ba9e2[_0xad7c('0x38')]:_0x113734[_0xad7c('0x32')];_0x5ba9e2[_0xad7c('0x3e')]=qs[_0xad7c('0x3f')](_0x2b038b[_0xad7c('0x35')][_0xad7c('0x3f')]);_0x5ba9e2[_0xad7c('0x40')]=qs[_0xad7c('0x37')](_['pick'](_0x2b038b[_0xad7c('0x35')],_0x113734[_0xad7c('0x37')]));if(_0x2b038b['query'][_0xad7c('0x42')]){_0x5ba9e2[_0xad7c('0x40')]=_[_0xad7c('0x43')](_0x5ba9e2[_0xad7c('0x40')],{'$or':_[_0xad7c('0x33')](_0x5ba9e2[_0xad7c('0x38')],function(_0x1e9a35){var _0x595cc2={};_0x595cc2[_0x1e9a35]={'$like':'%'+_0x2b038b[_0xad7c('0x35')]['filter']+'%'};return _0x595cc2;})});}_0x5ba9e2=_[_0xad7c('0x43')]({},_0x5ba9e2,_0x2b038b['options']);return _0x489c5f[_0xad7c('0x52')](_0x5ba9e2);}})[_0xad7c('0x28')](function(_0x31e447){if(_0x31e447){_0xcbc80b=_0x31e447[_0xad7c('0x3b')];if(!_0x2b038b['query'][_0xad7c('0x3c')](_0xad7c('0x3d'))){_0x5ba9e2[_0xad7c('0x22')]=qs[_0xad7c('0x22')](_0x2b038b['query'][_0xad7c('0x22')]);_0x5ba9e2[_0xad7c('0x21')]=qs[_0xad7c('0x21')](_0x2b038b['query'][_0xad7c('0x21')]);}return _0x489c5f[_0xad7c('0x52')](_0x5ba9e2);}})[_0xad7c('0x28')](function(_0x500f7a){if(_0x500f7a){return _0x500f7a?{'count':_0xcbc80b,'rows':_0x500f7a}:null;}})[_0xad7c('0x28')](respondWithResult(_0xabacaf,null))[_0xad7c('0x4a')](handleError(_0xabacaf,null));};exports['getTags']=function(_0x243364,_0x3facc2,_0x54b0e3){var _0x30572c={};var _0x339468={};var _0x169ab3;var _0x3ad77f;return db[_0xad7c('0x2f')][_0xad7c('0x4f')]({'where':{'id':_0x243364[_0xad7c('0x48')]['id']}})[_0xad7c('0x28')](handleEntityNotFound(_0x3facc2,null))['then'](function(_0x4d4248){if(_0x4d4248){_0x169ab3=_0x4d4248;_0x339468[_0xad7c('0x32')]=_[_0xad7c('0x36')](db[_0xad7c('0x54')]['rawAttributes']);_0x339468[_0xad7c('0x35')]=_[_0xad7c('0x36')](_0x243364[_0xad7c('0x35')]);_0x339468['filters']=_['intersection'](_0x339468[_0xad7c('0x32')],_0x339468[_0xad7c('0x35')]);_0x30572c[_0xad7c('0x38')]=_['intersection'](_0x339468[_0xad7c('0x32')],qs['fields'](_0x243364['query'][_0xad7c('0x3a')]));_0x30572c[_0xad7c('0x38')]=_0x30572c[_0xad7c('0x38')]['length']?_0x30572c['attributes']:_0x339468[_0xad7c('0x32')];_0x30572c[_0xad7c('0x3e')]=qs['sort'](_0x243364[_0xad7c('0x35')][_0xad7c('0x3f')]);_0x30572c[_0xad7c('0x40')]=qs[_0xad7c('0x37')](_[_0xad7c('0x41')](_0x243364[_0xad7c('0x35')],_0x339468[_0xad7c('0x37')]));if(_0x243364[_0xad7c('0x35')]['filter']){_0x30572c['where']=_[_0xad7c('0x43')](_0x30572c[_0xad7c('0x40')],{'$or':_['map'](_0x30572c[_0xad7c('0x38')],function(_0x44851e){var _0x558d15={};_0x558d15[_0x44851e]={'$like':'%'+_0x243364[_0xad7c('0x35')][_0xad7c('0x42')]+'%'};return _0x558d15;})});}_0x30572c=_['merge']({},_0x30572c,_0x243364[_0xad7c('0x50')]);return _0x169ab3[_0xad7c('0x55')](_0x30572c);}})[_0xad7c('0x28')](function(_0x11a237){if(_0x11a237){_0x3ad77f=_0x11a237['length'];if(!_0x243364[_0xad7c('0x35')][_0xad7c('0x3c')](_0xad7c('0x3d'))){_0x30572c[_0xad7c('0x22')]=qs[_0xad7c('0x22')](_0x243364[_0xad7c('0x35')][_0xad7c('0x22')]);_0x30572c[_0xad7c('0x21')]=qs['offset'](_0x243364[_0xad7c('0x35')][_0xad7c('0x21')]);}return _0x169ab3[_0xad7c('0x55')](_0x30572c);}})['then'](function(_0x42bc1a){if(_0x42bc1a){return _0x42bc1a?{'count':_0x3ad77f,'rows':_0x42bc1a}:null;}})['then'](respondWithResult(_0x3facc2,null))[_0xad7c('0x4a')](handleError(_0x3facc2,null));};exports[_0xad7c('0x56')]=function(_0x5ad6c3,_0x4835af,_0x32a52d){if(_0x5ad6c3[_0xad7c('0x4c')]['id']){delete _0x5ad6c3[_0xad7c('0x4c')]['id'];}return db[_0xad7c('0x2f')][_0xad7c('0x4f')]({'where':{'id':_0x5ad6c3[_0xad7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x4835af,null))[_0xad7c('0x28')](function(_0x3d54ca){if(_0x3d54ca){return _0x3d54ca[_0xad7c('0x56')](_0x5ad6c3[_0xad7c('0x4c')][_0xad7c('0x57')]||[]);}return null;})[_0xad7c('0x28')](respondWithResult(_0x4835af,null))['catch'](handleError(_0x4835af,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0acdd39..33df0bf 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 _0x4e2e=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x5e6e76,_0x2cb0f5){_0x5e6e76=_0x5e6e76-0x0;var _0x11c993=_0x4e2e[_0x5e6e76];return _0x11c993;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var logger=require(_0xe4e2('0x1'))(_0xe4e2('0x2'));var moment=require(_0xe4e2('0x3'));var BPromise=require(_0xe4e2('0x4'));var rp=require(_0xe4e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e2('0x6'));var config=require(_0xe4e2('0x7'));var attributes=require(_0xe4e2('0x8'));module[_0xe4e2('0x9')]=function(_0x48e83d,_0x322295){return _0x48e83d[_0xe4e2('0xa')](_0xe4e2('0xb'),attributes,{'tableName':_0xe4e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf66=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x10af7c,_0x3b6945){var _0x1d5ab1=function(_0x366a1d){while(--_0x366a1d){_0x10af7c['push'](_0x10af7c['shift']());}};_0x1d5ab1(++_0x3b6945);}(_0xcf66,0x71));var _0x6cf6=function(_0x16d889,_0x34ffc2){_0x16d889=_0x16d889-0x0;var _0x5b49ab=_0xcf66[_0x16d889];return _0x5b49ab;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 8835ac0..68c8520 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 _0x9938=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x350b4a,_0x6bc983){var _0x5d0cd2=function(_0x45cf8e){while(--_0x45cf8e){_0x350b4a['push'](_0x350b4a['shift']());}};_0x5d0cd2(++_0x6bc983);}(_0x9938,0x141));var _0x8993=function(_0x22f817,_0x1e1c9d){_0x22f817=_0x22f817-0x0;var _0x25a2a9=_0x9938[_0x22f817];return _0x25a2a9;};'use strict';var _=require(_0x8993('0x0'));var util=require(_0x8993('0x1'));var moment=require(_0x8993('0x2'));var BPromise=require(_0x8993('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8993('0x4'));var db=require(_0x8993('0x5'))['db'];var utils=require(_0x8993('0x6'));var logger=require(_0x8993('0x7'))(_0x8993('0x8'));var config=require(_0x8993('0x9'));var jayson=require(_0x8993('0xa'));var client=jayson[_0x8993('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516f54,_0x5c6595,_0x26228d){return new BPromise(function(_0x515180,_0x4838fe){return client[_0x8993('0xc')](_0x516f54,_0x26228d)[_0x8993('0xd')](function(_0x2ab7e3){logger[_0x8993('0xe')](_0x8993('0xf'),_0x5c6595,_0x8993('0x10'));logger[_0x8993('0x11')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c6595,_0x8993('0x10'),JSON[_0x8993('0x12')](_0x2ab7e3));if(_0x2ab7e3[_0x8993('0x13')]){if(_0x2ab7e3[_0x8993('0x13')][_0x8993('0x14')]===0x1f4){logger[_0x8993('0x13')](_0x8993('0xf'),_0x5c6595,_0x2ab7e3[_0x8993('0x13')][_0x8993('0x15')]);return _0x4838fe(_0x2ab7e3[_0x8993('0x13')][_0x8993('0x15')]);}logger[_0x8993('0x13')](_0x8993('0xf'),_0x5c6595,_0x2ab7e3['error']['message']);return _0x515180(_0x2ab7e3[_0x8993('0x13')]['message']);}else{logger[_0x8993('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5c6595,_0x8993('0x10'));_0x515180(_0x2ab7e3[_0x8993('0x16')]['message']);}})['catch'](function(_0x265e2a){logger[_0x8993('0x13')](_0x8993('0xf'),_0x5c6595,_0x265e2a);_0x4838fe(_0x265e2a);});});} \ No newline at end of file +var _0x1807=['code','message','result','catch','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0x1807,0x15a));var _0x7180=function(_0x440ba5,_0x573515){_0x440ba5=_0x440ba5-0x0;var _0x218106=_0x1807[_0x440ba5];return _0x218106;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7180('0x0'));var BPromise=require(_0x7180('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7180('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7180('0x3'));var jayson=require(_0x7180('0x4'));var client=jayson[_0x7180('0x5')][_0x7180('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5cca64,_0x380567,_0x4d9651){return new BPromise(function(_0x3d8e28,_0x43576d){return client[_0x7180('0x7')](_0x5cca64,_0x4d9651)[_0x7180('0x8')](function(_0x521678){logger[_0x7180('0x9')](_0x7180('0xa'),_0x380567,_0x7180('0xb'));logger['debug'](_0x7180('0xc'),_0x380567,_0x7180('0xb'),JSON[_0x7180('0xd')](_0x521678));if(_0x521678[_0x7180('0xe')]){if(_0x521678[_0x7180('0xe')][_0x7180('0xf')]===0x1f4){logger[_0x7180('0xe')](_0x7180('0xa'),_0x380567,_0x521678[_0x7180('0xe')][_0x7180('0x10')]);return _0x43576d(_0x521678[_0x7180('0xe')]['message']);}logger[_0x7180('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x380567,_0x521678[_0x7180('0xe')][_0x7180('0x10')]);return _0x3d8e28(_0x521678[_0x7180('0xe')][_0x7180('0x10')]);}else{logger[_0x7180('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x380567,_0x7180('0xb'));_0x3d8e28(_0x521678[_0x7180('0x11')][_0x7180('0x10')]);}})[_0x7180('0x12')](function(_0x19840e){logger[_0x7180('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x380567,_0x19840e);_0x43576d(_0x19840e);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c2aa5fd..23f5252 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 _0x328b=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x17a05c,_0xff092f){var _0x297ef9=function(_0x167741){while(--_0x167741){_0x17a05c['push'](_0x17a05c['shift']());}};_0x297ef9(++_0xff092f);}(_0x328b,0x8b));var _0xb328=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x328b[_0x38aeea];return _0x5e8d2c;};'use strict';var multer=require('multer');var util=require(_0xb328('0x0'));var path=require(_0xb328('0x1'));var timeout=require(_0xb328('0x2'));var express=require(_0xb328('0x3'));var router=express['Router']();var fs_extra=require(_0xb328('0x4'));var auth=require(_0xb328('0x5'));var interaction=require(_0xb328('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xb328('0x7')]('/',auth[_0xb328('0x8')](),controller[_0xb328('0x9')]);router[_0xb328('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb328('0xa')]('/',auth[_0xb328('0x8')](),controller[_0xb328('0xb')]);router[_0xb328('0xc')](_0xb328('0xd'),auth['isAuthenticated'](),controller[_0xb328('0xe')]);router[_0xb328('0xf')](_0xb328('0xd'),auth[_0xb328('0x8')](),controller[_0xb328('0x10')]);module[_0xb328('0x11')]=router; \ No newline at end of file +var _0x74e0=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','update','exports','path'];(function(_0x56c4b3,_0x519a33){var _0x2162ed=function(_0x6a6c6b){while(--_0x6a6c6b){_0x56c4b3['push'](_0x56c4b3['shift']());}};_0x2162ed(++_0x519a33);}(_0x74e0,0x16b));var _0x074e=function(_0x311d45,_0xad8766){_0x311d45=_0x311d45-0x0;var _0x55ba6e=_0x74e0[_0x311d45];return _0x55ba6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x074e('0x0'));var timeout=require(_0x074e('0x1'));var express=require('express');var router=express[_0x074e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x074e('0x3'));var interaction=require(_0x074e('0x4'));var config=require('../../config/environment');var controller=require(_0x074e('0x5'));router[_0x074e('0x6')]('/',auth[_0x074e('0x7')](),controller['index']);router[_0x074e('0x6')](_0x074e('0x8'),auth[_0x074e('0x7')](),controller[_0x074e('0x9')]);router[_0x074e('0xa')]('/',auth['isAuthenticated'](),controller[_0x074e('0xb')]);router['put'](_0x074e('0x8'),auth[_0x074e('0x7')](),controller[_0x074e('0xc')]);router['delete'](_0x074e('0x8'),auth[_0x074e('0x7')](),controller['destroy']);module[_0x074e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2b90aec..8482d4c 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 _0x1de4=['string','variable','customVariable','picklist','STRING','BOOLEAN','ENUM'];(function(_0x3efe8e,_0x37544a){var _0xdfe2e4=function(_0x1c2f94){while(--_0x1c2f94){_0x3efe8e['push'](_0x3efe8e['shift']());}};_0xdfe2e4(++_0x37544a);}(_0x1de4,0x1c6));var _0x41de=function(_0x1eb24f,_0x5229b6){_0x1eb24f=_0x1eb24f-0x0;var _0x23594a=_0x1de4[_0x1eb24f];return _0x23594a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x41de('0x0')](_0x41de('0x1'),_0x41de('0x2'),_0x41de('0x3'),'keyValue',_0x41de('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x41de('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x41de('0x0')](_0x41de('0x1'),_0x41de('0x2'),_0x41de('0x3'))},'keyContent':{'type':Sequelize[_0x41de('0x5')]},'idField':{'type':Sequelize[_0x41de('0x5')]},'nameField':{'type':Sequelize[_0x41de('0x5')]},'customField':{'type':Sequelize[_0x41de('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x41de('0x5')]}}; \ No newline at end of file +var _0x221c=['customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4b3086,_0x3615ee){var _0x27d411=function(_0x329b36){while(--_0x329b36){_0x4b3086['push'](_0x4b3086['shift']());}};_0x27d411(++_0x3615ee);}(_0x221c,0x101));var _0xc221=function(_0x4fe1e4,_0x3e3bf2){_0x4fe1e4=_0x4fe1e4-0x0;var _0x2edec8=_0x221c[_0x4fe1e4];return _0x2edec8;};'use strict';var Sequelize=require(_0xc221('0x0'));module[_0xc221('0x1')]={'type':{'type':Sequelize[_0xc221('0x2')]('string','variable',_0xc221('0x3'),_0xc221('0x4'),_0xc221('0x5')),'defaultValue':_0xc221('0x6')},'content':{'type':Sequelize[_0xc221('0x7')]},'key':{'type':Sequelize[_0xc221('0x7')]},'keyType':{'type':Sequelize[_0xc221('0x2')](_0xc221('0x6'),_0xc221('0x8'),_0xc221('0x3'))},'keyContent':{'type':Sequelize[_0xc221('0x7')]},'idField':{'type':Sequelize[_0xc221('0x7')]},'nameField':{'type':Sequelize[_0xc221('0x7')]},'customField':{'type':Sequelize[_0xc221('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc221('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0e4c7b0..b8ed366 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 _0x21ce=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','name','send','index','ZendeskField','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','sort','pick','where','merge','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x37004b,_0x1f0b3f){var _0x9df09a=function(_0x237ab7){while(--_0x237ab7){_0x37004b['push'](_0x37004b['shift']());}};_0x9df09a(++_0x1f0b3f);}(_0x21ce,0x196));var _0xe21c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x21ce[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe21c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe21c('0x1'));var moment=require(_0xe21c('0x2'));var BPromise=require(_0xe21c('0x3'));var Mustache=require(_0xe21c('0x4'));var util=require(_0xe21c('0x5'));var path=require(_0xe21c('0x6'));var sox=require('sox');var csv=require(_0xe21c('0x7'));var ejs=require(_0xe21c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe21c('0x9'));var squel=require(_0xe21c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe21c('0xb'));var deskjs=require(_0xe21c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe21c('0xd'));var Papa=require(_0xe21c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe21c('0xf'));var as=require(_0xe21c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21c('0x11'))(_0xe21c('0x12'));var utils=require(_0xe21c('0x13'));var config=require(_0xe21c('0x14'));var licenseUtil=require(_0xe21c('0x15'));var db=require(_0xe21c('0x16'))['db'];function respondWithStatusCode(_0x199c5f,_0x36aca7){_0x36aca7=_0x36aca7||0xcc;return function(_0x32e169){if(_0x32e169){return _0x199c5f['sendStatus'](_0x36aca7);}return _0x199c5f[_0xe21c('0x17')](_0x36aca7)['end']();};}function respondWithResult(_0x2576ff,_0x33b379){_0x33b379=_0x33b379||0xc8;return function(_0x35b80f){if(_0x35b80f){return _0x2576ff[_0xe21c('0x17')](_0x33b379)['json'](_0x35b80f);}};}function respondWithFilteredResult(_0x108afb,_0x453146){return function(_0xc5108b){if(_0xc5108b){var _0x450df8=typeof _0x453146[_0xe21c('0x18')]==='undefined'&&typeof _0x453146[_0xe21c('0x19')]===_0xe21c('0x1a');var _0xa44f11=_0xc5108b[_0xe21c('0x1b')];var _0xd02d02=_0x450df8?0x0:_0x453146[_0xe21c('0x18')];var _0x4e7fe3=_0x450df8?_0xc5108b[_0xe21c('0x1b')]:_0x453146[_0xe21c('0x18')]+_0x453146[_0xe21c('0x19')];var _0x32041c;if(_0x4e7fe3>=_0xa44f11){_0x4e7fe3=_0xa44f11;_0x32041c=0xc8;}else{_0x32041c=0xce;}_0x108afb['status'](_0x32041c);return _0x108afb[_0xe21c('0x1c')](_0xe21c('0x1d'),_0xd02d02+'-'+_0x4e7fe3+'/'+_0xa44f11)[_0xe21c('0x1e')](_0xc5108b);}return null;};}function patchUpdates(_0x5365ec){return function(_0x27cbdd){try{jsonpatch[_0xe21c('0x1f')](_0x27cbdd,_0x5365ec,!![]);}catch(_0x56cb4c){return BPromise[_0xe21c('0x20')](_0x56cb4c);}return _0x27cbdd[_0xe21c('0x21')]();};}function saveUpdates(_0x5b1a03,_0x1559d6){return function(_0x35d44f){if(_0x35d44f){return _0x35d44f[_0xe21c('0x22')](_0x5b1a03)['then'](function(_0x19467f){return _0x19467f;});}return null;};}function removeEntity(_0x3f4303,_0x2132e7){return function(_0x5263e5){if(_0x5263e5){return _0x5263e5[_0xe21c('0x23')]()[_0xe21c('0x24')](function(){_0x3f4303[_0xe21c('0x17')](0xcc)[_0xe21c('0x25')]();});}};}function handleEntityNotFound(_0x5a3d2f,_0xff5750){return function(_0x4e633c){if(!_0x4e633c){_0x5a3d2f[_0xe21c('0x26')](0x194);}return _0x4e633c;};}function handleError(_0x46745d,_0x7409ef){_0x7409ef=_0x7409ef||0x1f4;return function(_0x2d61dd){logger['error'](_0x2d61dd['stack']);if(_0x2d61dd[_0xe21c('0x27')]){delete _0x2d61dd[_0xe21c('0x27')];}_0x46745d['status'](_0x7409ef)[_0xe21c('0x28')](_0x2d61dd);};}exports[_0xe21c('0x29')]=function(_0x38e1d0,_0x42dd3f){var _0x1458c0={},_0x270c92={},_0x43744b={'count':0x0,'rows':[]};var _0x472340=_['map'](db[_0xe21c('0x2a')]['rawAttributes'],function(_0x115e10){return{'name':_0x115e10[_0xe21c('0x2b')],'type':_0x115e10['type'][_0xe21c('0x2c')]};});_0x270c92[_0xe21c('0x2d')]=_[_0xe21c('0x2e')](_0x472340,_0xe21c('0x27'));_0x270c92['query']=_[_0xe21c('0x2f')](_0x38e1d0[_0xe21c('0x30')]);_0x270c92[_0xe21c('0x31')]=_['intersection'](_0x270c92[_0xe21c('0x2d')],_0x270c92[_0xe21c('0x30')]);_0x1458c0['attributes']=_[_0xe21c('0x32')](_0x270c92[_0xe21c('0x2d')],qs[_0xe21c('0x33')](_0x38e1d0[_0xe21c('0x30')][_0xe21c('0x33')]));_0x1458c0[_0xe21c('0x34')]=_0x1458c0[_0xe21c('0x34')]['length']?_0x1458c0[_0xe21c('0x34')]:_0x270c92[_0xe21c('0x2d')];if(!_0x38e1d0['query']['hasOwnProperty'](_0xe21c('0x35'))){_0x1458c0[_0xe21c('0x19')]=qs[_0xe21c('0x19')](_0x38e1d0[_0xe21c('0x30')][_0xe21c('0x19')]);_0x1458c0[_0xe21c('0x18')]=qs[_0xe21c('0x18')](_0x38e1d0[_0xe21c('0x30')][_0xe21c('0x18')]);}_0x1458c0['order']=qs[_0xe21c('0x36')](_0x38e1d0[_0xe21c('0x30')]['sort']);_0x1458c0['where']=qs[_0xe21c('0x31')](_[_0xe21c('0x37')](_0x38e1d0[_0xe21c('0x30')],_0x270c92[_0xe21c('0x31')]),_0x472340);if(_0x38e1d0[_0xe21c('0x30')]['filter']){_0x1458c0[_0xe21c('0x38')]=_['merge'](_0x1458c0[_0xe21c('0x38')],{'$or':_[_0xe21c('0x2e')](_0x472340,function(_0x42f951){if(_0x42f951['type']!=='VIRTUAL'){var _0x3242dd={};_0x3242dd[_0x42f951['name']]={'$like':'%'+_0x38e1d0[_0xe21c('0x30')]['filter']+'%'};return _0x3242dd;}})});}_0x1458c0=_[_0xe21c('0x39')]({},_0x1458c0,_0x38e1d0['options']);var _0x1085dd={'where':_0x1458c0['where']};return db[_0xe21c('0x2a')]['count'](_0x1085dd)[_0xe21c('0x24')](function(_0x5d74af){_0x43744b[_0xe21c('0x1b')]=_0x5d74af;if(_0x38e1d0['query']['includeAll']){_0x1458c0[_0xe21c('0x3a')]=[{'all':!![]}];}return db[_0xe21c('0x2a')][_0xe21c('0x3b')](_0x1458c0);})[_0xe21c('0x24')](function(_0x1be300){_0x43744b[_0xe21c('0x3c')]=_0x1be300;return _0x43744b;})[_0xe21c('0x24')](respondWithFilteredResult(_0x42dd3f,_0x1458c0))[_0xe21c('0x3d')](handleError(_0x42dd3f,null));};exports[_0xe21c('0x3e')]=function(_0x57442d,_0x23e193){var _0x2ae3d0={'raw':!![],'where':{'id':_0x57442d[_0xe21c('0x3f')]['id']}},_0x1835ff={};_0x1835ff['model']=_[_0xe21c('0x2f')](db[_0xe21c('0x2a')]['rawAttributes']);_0x1835ff[_0xe21c('0x30')]=_[_0xe21c('0x2f')](_0x57442d[_0xe21c('0x30')]);_0x1835ff[_0xe21c('0x31')]=_[_0xe21c('0x32')](_0x1835ff[_0xe21c('0x2d')],_0x1835ff[_0xe21c('0x30')]);_0x2ae3d0[_0xe21c('0x34')]=_[_0xe21c('0x32')](_0x1835ff[_0xe21c('0x2d')],qs['fields'](_0x57442d[_0xe21c('0x30')]['fields']));_0x2ae3d0[_0xe21c('0x34')]=_0x2ae3d0[_0xe21c('0x34')][_0xe21c('0x40')]?_0x2ae3d0[_0xe21c('0x34')]:_0x1835ff[_0xe21c('0x2d')];if(_0x57442d[_0xe21c('0x30')][_0xe21c('0x41')]){_0x2ae3d0[_0xe21c('0x3a')]=[{'all':!![]}];}_0x2ae3d0=_[_0xe21c('0x39')]({},_0x2ae3d0,_0x57442d[_0xe21c('0x42')]);return db['ZendeskField'][_0xe21c('0x43')](_0x2ae3d0)[_0xe21c('0x24')](handleEntityNotFound(_0x23e193,null))[_0xe21c('0x24')](respondWithResult(_0x23e193,null))[_0xe21c('0x3d')](handleError(_0x23e193,null));};exports[_0xe21c('0x44')]=function(_0x29a533,_0x59bda0){return db[_0xe21c('0x2a')][_0xe21c('0x44')](_0x29a533['body'],{})['then'](respondWithResult(_0x59bda0,0xc9))[_0xe21c('0x3d')](handleError(_0x59bda0,null));};exports[_0xe21c('0x22')]=function(_0x565906,_0x238703){if(_0x565906[_0xe21c('0x45')]['id']){delete _0x565906['body']['id'];}return db['ZendeskField'][_0xe21c('0x43')]({'where':{'id':_0x565906['params']['id']}})[_0xe21c('0x24')](handleEntityNotFound(_0x238703,null))[_0xe21c('0x24')](saveUpdates(_0x565906[_0xe21c('0x45')],null))[_0xe21c('0x24')](respondWithResult(_0x238703,null))[_0xe21c('0x3d')](handleError(_0x238703,null));};exports['destroy']=function(_0x390d14,_0x188697){return db[_0xe21c('0x2a')][_0xe21c('0x43')]({'where':{'id':_0x390d14['params']['id']}})[_0xe21c('0x24')](handleEntityNotFound(_0x188697,null))[_0xe21c('0x24')](removeEntity(_0x188697,null))[_0xe21c('0x3d')](handleError(_0x188697,null));}; \ No newline at end of file +var _0xb4cd=['../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','name','index','map','ZendeskField','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','keys','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x43b009,_0x11d4df){var _0x497ae1=function(_0x35da61){while(--_0x35da61){_0x43b009['push'](_0x43b009['shift']());}};_0x497ae1(++_0x11d4df);}(_0xb4cd,0x11b));var _0xdb4c=function(_0x3aa4f1,_0x4a4ee2){_0x3aa4f1=_0x3aa4f1-0x0;var _0x3b21ad=_0xb4cd[_0x3aa4f1];return _0x3b21ad;};'use strict';var emlformat=require(_0xdb4c('0x0'));var rimraf=require(_0xdb4c('0x1'));var zipdir=require(_0xdb4c('0x2'));var jsonpatch=require(_0xdb4c('0x3'));var rp=require(_0xdb4c('0x4'));var moment=require(_0xdb4c('0x5'));var BPromise=require(_0xdb4c('0x6'));var Mustache=require(_0xdb4c('0x7'));var util=require(_0xdb4c('0x8'));var path=require('path');var sox=require(_0xdb4c('0x9'));var csv=require('to-csv');var ejs=require(_0xdb4c('0xa'));var fs=require('fs');var fs_extra=require(_0xdb4c('0xb'));var _=require(_0xdb4c('0xc'));var squel=require(_0xdb4c('0xd'));var crypto=require(_0xdb4c('0xe'));var jsforce=require(_0xdb4c('0xf'));var deskjs=require(_0xdb4c('0x10'));var toCsv=require(_0xdb4c('0x11'));var querystring=require(_0xdb4c('0x12'));var Papa=require(_0xdb4c('0x13'));var Redis=require(_0xdb4c('0x14'));var authService=require(_0xdb4c('0x15'));var qs=require(_0xdb4c('0x16'));var as=require(_0xdb4c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb4c('0x18'))(_0xdb4c('0x19'));var utils=require(_0xdb4c('0x1a'));var config=require(_0xdb4c('0x1b'));var licenseUtil=require(_0xdb4c('0x1c'));var db=require(_0xdb4c('0x1d'))['db'];function respondWithStatusCode(_0xb078cb,_0x283479){_0x283479=_0x283479||0xcc;return function(_0x23aca6){if(_0x23aca6){return _0xb078cb['sendStatus'](_0x283479);}return _0xb078cb[_0xdb4c('0x1e')](_0x283479)[_0xdb4c('0x1f')]();};}function respondWithResult(_0x4e804a,_0xff378f){_0xff378f=_0xff378f||0xc8;return function(_0x1118ae){if(_0x1118ae){return _0x4e804a[_0xdb4c('0x1e')](_0xff378f)[_0xdb4c('0x20')](_0x1118ae);}};}function respondWithFilteredResult(_0x255929,_0x11ec36){return function(_0x4cd070){if(_0x4cd070){var _0x859db9=typeof _0x11ec36['offset']==='undefined'&&typeof _0x11ec36[_0xdb4c('0x21')]===_0xdb4c('0x22');var _0x52c55a=_0x4cd070['count'];var _0x4b8ca8=_0x859db9?0x0:_0x11ec36['offset'];var _0x1e9642=_0x859db9?_0x4cd070[_0xdb4c('0x23')]:_0x11ec36[_0xdb4c('0x24')]+_0x11ec36['limit'];var _0x55c83f;if(_0x1e9642>=_0x52c55a){_0x1e9642=_0x52c55a;_0x55c83f=0xc8;}else{_0x55c83f=0xce;}_0x255929['status'](_0x55c83f);return _0x255929[_0xdb4c('0x25')](_0xdb4c('0x26'),_0x4b8ca8+'-'+_0x1e9642+'/'+_0x52c55a)[_0xdb4c('0x20')](_0x4cd070);}return null;};}function patchUpdates(_0x48e215){return function(_0x118307){try{jsonpatch[_0xdb4c('0x27')](_0x118307,_0x48e215,!![]);}catch(_0x19edf1){return BPromise[_0xdb4c('0x28')](_0x19edf1);}return _0x118307[_0xdb4c('0x29')]();};}function saveUpdates(_0x1c15ff,_0x1d892c){return function(_0x3e43a7){if(_0x3e43a7){return _0x3e43a7['update'](_0x1c15ff)[_0xdb4c('0x2a')](function(_0x2c550d){return _0x2c550d;});}return null;};}function removeEntity(_0x285725,_0x269c08){return function(_0x4faa00){if(_0x4faa00){return _0x4faa00['destroy']()[_0xdb4c('0x2a')](function(){_0x285725[_0xdb4c('0x1e')](0xcc)[_0xdb4c('0x1f')]();});}};}function handleEntityNotFound(_0x2a89e9,_0x4d4aec){return function(_0x1ccf21){if(!_0x1ccf21){_0x2a89e9['sendStatus'](0x194);}return _0x1ccf21;};}function handleError(_0x122392,_0x52d93b){_0x52d93b=_0x52d93b||0x1f4;return function(_0x8ea346){logger[_0xdb4c('0x2b')](_0x8ea346['stack']);if(_0x8ea346[_0xdb4c('0x2c')]){delete _0x8ea346[_0xdb4c('0x2c')];}_0x122392[_0xdb4c('0x1e')](_0x52d93b)['send'](_0x8ea346);};}exports[_0xdb4c('0x2d')]=function(_0x12b432,_0x53cea5){var _0x3fed44={},_0x93c61b={},_0xe9ff8c={'count':0x0,'rows':[]};var _0x2195b2=_[_0xdb4c('0x2e')](db[_0xdb4c('0x2f')]['rawAttributes'],function(_0x253679){return{'name':_0x253679[_0xdb4c('0x30')],'type':_0x253679[_0xdb4c('0x31')][_0xdb4c('0x32')]};});_0x93c61b[_0xdb4c('0x33')]=_[_0xdb4c('0x2e')](_0x2195b2,'name');_0x93c61b[_0xdb4c('0x34')]=_['keys'](_0x12b432['query']);_0x93c61b[_0xdb4c('0x35')]=_['intersection'](_0x93c61b['model'],_0x93c61b['query']);_0x3fed44[_0xdb4c('0x36')]=_[_0xdb4c('0x37')](_0x93c61b[_0xdb4c('0x33')],qs[_0xdb4c('0x38')](_0x12b432[_0xdb4c('0x34')][_0xdb4c('0x38')]));_0x3fed44[_0xdb4c('0x36')]=_0x3fed44[_0xdb4c('0x36')][_0xdb4c('0x39')]?_0x3fed44[_0xdb4c('0x36')]:_0x93c61b[_0xdb4c('0x33')];if(!_0x12b432['query'][_0xdb4c('0x3a')](_0xdb4c('0x3b'))){_0x3fed44[_0xdb4c('0x21')]=qs[_0xdb4c('0x21')](_0x12b432[_0xdb4c('0x34')][_0xdb4c('0x21')]);_0x3fed44['offset']=qs['offset'](_0x12b432[_0xdb4c('0x34')]['offset']);}_0x3fed44[_0xdb4c('0x3c')]=qs[_0xdb4c('0x3d')](_0x12b432[_0xdb4c('0x34')][_0xdb4c('0x3d')]);_0x3fed44[_0xdb4c('0x3e')]=qs[_0xdb4c('0x35')](_['pick'](_0x12b432[_0xdb4c('0x34')],_0x93c61b[_0xdb4c('0x35')]),_0x2195b2);if(_0x12b432[_0xdb4c('0x34')][_0xdb4c('0x3f')]){_0x3fed44[_0xdb4c('0x3e')]=_[_0xdb4c('0x40')](_0x3fed44[_0xdb4c('0x3e')],{'$or':_[_0xdb4c('0x2e')](_0x2195b2,function(_0x4d57c0){if(_0x4d57c0[_0xdb4c('0x31')]!==_0xdb4c('0x41')){var _0x45135f={};_0x45135f[_0x4d57c0[_0xdb4c('0x2c')]]={'$like':'%'+_0x12b432['query'][_0xdb4c('0x3f')]+'%'};return _0x45135f;}})});}_0x3fed44=_['merge']({},_0x3fed44,_0x12b432[_0xdb4c('0x42')]);var _0x3af1bb={'where':_0x3fed44[_0xdb4c('0x3e')]};return db[_0xdb4c('0x2f')]['count'](_0x3af1bb)[_0xdb4c('0x2a')](function(_0x3ee6f8){_0xe9ff8c['count']=_0x3ee6f8;if(_0x12b432[_0xdb4c('0x34')]['includeAll']){_0x3fed44[_0xdb4c('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0xdb4c('0x44')](_0x3fed44);})[_0xdb4c('0x2a')](function(_0x361511){_0xe9ff8c[_0xdb4c('0x45')]=_0x361511;return _0xe9ff8c;})['then'](respondWithFilteredResult(_0x53cea5,_0x3fed44))[_0xdb4c('0x46')](handleError(_0x53cea5,null));};exports['show']=function(_0x4ae0cf,_0x178f7b){var _0x2f7cb3={'raw':!![],'where':{'id':_0x4ae0cf['params']['id']}},_0x454d9b={};_0x454d9b['model']=_[_0xdb4c('0x47')](db[_0xdb4c('0x2f')]['rawAttributes']);_0x454d9b[_0xdb4c('0x34')]=_['keys'](_0x4ae0cf[_0xdb4c('0x34')]);_0x454d9b[_0xdb4c('0x35')]=_[_0xdb4c('0x37')](_0x454d9b[_0xdb4c('0x33')],_0x454d9b[_0xdb4c('0x34')]);_0x2f7cb3[_0xdb4c('0x36')]=_[_0xdb4c('0x37')](_0x454d9b['model'],qs['fields'](_0x4ae0cf[_0xdb4c('0x34')]['fields']));_0x2f7cb3[_0xdb4c('0x36')]=_0x2f7cb3[_0xdb4c('0x36')][_0xdb4c('0x39')]?_0x2f7cb3[_0xdb4c('0x36')]:_0x454d9b[_0xdb4c('0x33')];if(_0x4ae0cf[_0xdb4c('0x34')][_0xdb4c('0x48')]){_0x2f7cb3[_0xdb4c('0x43')]=[{'all':!![]}];}_0x2f7cb3=_[_0xdb4c('0x40')]({},_0x2f7cb3,_0x4ae0cf['options']);return db[_0xdb4c('0x2f')][_0xdb4c('0x49')](_0x2f7cb3)[_0xdb4c('0x2a')](handleEntityNotFound(_0x178f7b,null))[_0xdb4c('0x2a')](respondWithResult(_0x178f7b,null))['catch'](handleError(_0x178f7b,null));};exports[_0xdb4c('0x4a')]=function(_0x4a81b8,_0x460332){return db[_0xdb4c('0x2f')][_0xdb4c('0x4a')](_0x4a81b8['body'],{})['then'](respondWithResult(_0x460332,0xc9))[_0xdb4c('0x46')](handleError(_0x460332,null));};exports[_0xdb4c('0x4b')]=function(_0x1500a2,_0x38fdaf){if(_0x1500a2[_0xdb4c('0x4c')]['id']){delete _0x1500a2[_0xdb4c('0x4c')]['id'];}return db[_0xdb4c('0x2f')][_0xdb4c('0x49')]({'where':{'id':_0x1500a2[_0xdb4c('0x4d')]['id']}})[_0xdb4c('0x2a')](handleEntityNotFound(_0x38fdaf,null))[_0xdb4c('0x2a')](saveUpdates(_0x1500a2['body'],null))[_0xdb4c('0x2a')](respondWithResult(_0x38fdaf,null))[_0xdb4c('0x46')](handleError(_0x38fdaf,null));};exports['destroy']=function(_0x4bb23a,_0x4fbadb){return db[_0xdb4c('0x2f')]['find']({'where':{'id':_0x4bb23a[_0xdb4c('0x4d')]['id']}})[_0xdb4c('0x2a')](handleEntityNotFound(_0x4fbadb,null))[_0xdb4c('0x2a')](removeEntity(_0x4fbadb,null))['catch'](handleError(_0x4fbadb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2236e02..8951d0e 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 _0x66ec=['exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes'];(function(_0x39c084,_0xbc0456){var _0x5e6575=function(_0x39c5e7){while(--_0x39c5e7){_0x39c084['push'](_0x39c084['shift']());}};_0x5e6575(++_0xbc0456);}(_0x66ec,0x166));var _0xc66e=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x66ec[_0x468a77];return _0x2d1c33;};'use strict';var _=require(_0xc66e('0x0'));var util=require(_0xc66e('0x1'));var logger=require(_0xc66e('0x2'))(_0xc66e('0x3'));var moment=require(_0xc66e('0x4'));var BPromise=require(_0xc66e('0x5'));var rp=require(_0xc66e('0x6'));var fs=require('fs');var path=require(_0xc66e('0x7'));var rimraf=require(_0xc66e('0x8'));var config=require('../../config/environment');var attributes=require(_0xc66e('0x9'));module[_0xc66e('0xa')]=function(_0x4852a0,_0x421ed7){return _0x4852a0[_0xc66e('0xb')](_0xc66e('0xc'),attributes,{'tableName':_0xc66e('0xd'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xc66e('0xe'),_0xc66e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43ac=['zendesk_unique_index','idField','FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x43ac,0x148));var _0xc43a=function(_0x39edb2,_0x6b06b7){_0x39edb2=_0x39edb2-0x0;var _0x461cbd=_0x43ac[_0x39edb2];return _0x461cbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc43a('0x0'));var moment=require(_0xc43a('0x1'));var BPromise=require(_0xc43a('0x2'));var rp=require(_0xc43a('0x3'));var fs=require('fs');var path=require(_0xc43a('0x4'));var rimraf=require(_0xc43a('0x5'));var config=require(_0xc43a('0x6'));var attributes=require(_0xc43a('0x7'));module[_0xc43a('0x8')]=function(_0x349c81,_0x101573){return _0x349c81['define'](_0xc43a('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xc43a('0xa'),'fields':[_0xc43a('0xb'),_0xc43a('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 8d19954..ac97900 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 _0x6639=['error','code','ZendeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','stringify'];(function(_0x1d95e1,_0x2dac2f){var _0x542fa0=function(_0x2ad2d0){while(--_0x2ad2d0){_0x1d95e1['push'](_0x1d95e1['shift']());}};_0x542fa0(++_0x2dac2f);}(_0x6639,0x16f));var _0x9663=function(_0x4b0907,_0x110b7c){_0x4b0907=_0x4b0907-0x0;var _0x212c12=_0x6639[_0x4b0907];return _0x212c12;};'use strict';var _=require(_0x9663('0x0'));var util=require('util');var moment=require(_0x9663('0x1'));var BPromise=require(_0x9663('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9663('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9663('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9663('0x5'));var jayson=require(_0x9663('0x6'));var client=jayson[_0x9663('0x7')][_0x9663('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x337663,_0x44d396,_0x3d8188){return new BPromise(function(_0x132d2b,_0x32b81c){return client[_0x9663('0x9')](_0x337663,_0x3d8188)[_0x9663('0xa')](function(_0x62ab7b){logger[_0x9663('0xb')]('ZendeskField,\x20%s,\x20%s',_0x44d396,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x44d396,'request\x20sent',JSON[_0x9663('0xc')](_0x62ab7b));if(_0x62ab7b[_0x9663('0xd')]){if(_0x62ab7b[_0x9663('0xd')][_0x9663('0xe')]===0x1f4){logger[_0x9663('0xd')](_0x9663('0xf'),_0x44d396,_0x62ab7b[_0x9663('0xd')][_0x9663('0x10')]);return _0x32b81c(_0x62ab7b['error'][_0x9663('0x10')]);}logger[_0x9663('0xd')](_0x9663('0xf'),_0x44d396,_0x62ab7b[_0x9663('0xd')][_0x9663('0x10')]);return _0x132d2b(_0x62ab7b['error'][_0x9663('0x10')]);}else{logger['info'](_0x9663('0xf'),_0x44d396,_0x9663('0x11'));_0x132d2b(_0x62ab7b[_0x9663('0x12')]['message']);}})[_0x9663('0x13')](function(_0x2e406a){logger['error'](_0x9663('0xf'),_0x44d396,_0x2e406a);_0x32b81c(_0x2e406a);});});} \ No newline at end of file +var _0xdf6e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0xdf6e,0x70));var _0xedf6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdf6e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xedf6('0x0'));var util=require(_0xedf6('0x1'));var moment=require(_0xedf6('0x2'));var BPromise=require(_0xedf6('0x3'));var rs=require(_0xedf6('0x4'));var fs=require('fs');var Redis=require(_0xedf6('0x5'));var db=require(_0xedf6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xedf6('0x7'))(_0xedf6('0x8'));var config=require(_0xedf6('0x9'));var jayson=require(_0xedf6('0xa'));var client=jayson[_0xedf6('0xb')][_0xedf6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ff347,_0x14c532,_0x24e70f){return new BPromise(function(_0x591d78,_0x4d48a3){return client['request'](_0x1ff347,_0x24e70f)[_0xedf6('0xd')](function(_0xdc310b){logger[_0xedf6('0xe')](_0xedf6('0xf'),_0x14c532,_0xedf6('0x10'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x14c532,_0xedf6('0x10'),JSON[_0xedf6('0x11')](_0xdc310b));if(_0xdc310b['error']){if(_0xdc310b['error'][_0xedf6('0x12')]===0x1f4){logger[_0xedf6('0x13')](_0xedf6('0xf'),_0x14c532,_0xdc310b[_0xedf6('0x13')][_0xedf6('0x14')]);return _0x4d48a3(_0xdc310b[_0xedf6('0x13')][_0xedf6('0x14')]);}logger[_0xedf6('0x13')](_0xedf6('0xf'),_0x14c532,_0xdc310b['error'][_0xedf6('0x14')]);return _0x591d78(_0xdc310b[_0xedf6('0x13')][_0xedf6('0x14')]);}else{logger[_0xedf6('0xe')]('ZendeskField,\x20%s,\x20%s',_0x14c532,'request\x20sent');_0x591d78(_0xdc310b[_0xedf6('0x15')][_0xedf6('0x14')]);}})[_0xedf6('0x16')](function(_0x22c900){logger['error'](_0xedf6('0xf'),_0x14c532,_0x22c900);_0x4d48a3(_0x22c900);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 731f6a9..1b6ad4b 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 _0xf105=['getFields','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations'];(function(_0x58a515,_0x5a3e59){var _0x316384=function(_0x519362){while(--_0x519362){_0x58a515['push'](_0x58a515['shift']());}};_0x316384(++_0x5a3e59);}(_0xf105,0x76));var _0x5f10=function(_0x5323cd,_0x130c8d){_0x5323cd=_0x5323cd-0x0;var _0x5ac7fc=_0xf105[_0x5323cd];return _0x5ac7fc;};'use strict';var multer=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var path=require(_0x5f10('0x2'));var timeout=require(_0x5f10('0x3'));var express=require(_0x5f10('0x4'));var router=express[_0x5f10('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5f10('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f10('0x7'));var controller=require(_0x5f10('0x8'));router[_0x5f10('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f10('0xa')]);router[_0x5f10('0x9')]('/:id',auth[_0x5f10('0xb')](),controller[_0x5f10('0xc')]);router['get'](_0x5f10('0xd'),auth[_0x5f10('0xb')](),controller['getConfigurations']);router[_0x5f10('0x9')]('/:id/fields',auth[_0x5f10('0xb')](),controller[_0x5f10('0xe')]);router[_0x5f10('0xf')]('/',auth[_0x5f10('0xb')](),controller[_0x5f10('0x10')]);router[_0x5f10('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5f10('0x11')](_0x5f10('0x12'),auth['isAuthenticated'](),controller[_0x5f10('0x13')]);router['delete'](_0x5f10('0x12'),auth[_0x5f10('0xb')](),controller[_0x5f10('0x14')]);module[_0x5f10('0x15')]=router; \ No newline at end of file +var _0x9da7=['./intZohoAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2459d3,_0x13a3e1){var _0x5c7785=function(_0x4634bb){while(--_0x4634bb){_0x2459d3['push'](_0x2459d3['shift']());}};_0x5c7785(++_0x13a3e1);}(_0x9da7,0x1db));var _0x79da=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x9da7[_0x20b29c];return _0x20d81b;};'use strict';var multer=require('multer');var util=require(_0x79da('0x0'));var path=require(_0x79da('0x1'));var timeout=require(_0x79da('0x2'));var express=require(_0x79da('0x3'));var router=express[_0x79da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x79da('0x5'));var interaction=require(_0x79da('0x6'));var config=require(_0x79da('0x7'));var controller=require(_0x79da('0x8'));router['get']('/',auth[_0x79da('0x9')](),controller[_0x79da('0xa')]);router[_0x79da('0xb')](_0x79da('0xc'),auth[_0x79da('0x9')](),controller[_0x79da('0xd')]);router[_0x79da('0xb')]('/:id/configurations',auth[_0x79da('0x9')](),controller[_0x79da('0xe')]);router[_0x79da('0xb')](_0x79da('0xf'),auth[_0x79da('0x9')](),controller['getFields']);router[_0x79da('0x10')]('/',auth['isAuthenticated'](),controller[_0x79da('0x11')]);router[_0x79da('0x10')]('/:id/configurations',auth[_0x79da('0x9')](),controller[_0x79da('0x12')]);router[_0x79da('0x13')](_0x79da('0xc'),auth[_0x79da('0x9')](),controller[_0x79da('0x14')]);router[_0x79da('0x15')]('/:id',auth[_0x79da('0x9')](),controller[_0x79da('0x16')]);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 932a9ae..0698c1a 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f62=['exports','STRING'];(function(_0x13904c,_0x24b5c3){var _0xc3f36a=function(_0xbd6640){while(--_0xbd6640){_0x13904c['push'](_0x13904c['shift']());}};_0xc3f36a(++_0x24b5c3);}(_0x9f62,0x154));var _0x29f6=function(_0xb7115e,_0x413dd4){_0xb7115e=_0xb7115e-0x0;var _0xb3fa18=_0x9f62[_0xb7115e];return _0xb3fa18;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file +var _0x5b02=['exports','STRING','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5b02,0xe9));var _0x25b0=function(_0x3ac7b6,_0x57cab2){_0x3ac7b6=_0x3ac7b6-0x0;var _0x2dda68=_0x5b02[_0x3ac7b6];return _0x2dda68;};'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 diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 03cb900..5998fb5 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 _0xeadb=['api_name','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZohoAccount','rawAttributes','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where','filter','options','count','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','order','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes'];(function(_0x4a452a,_0x2cdc4d){var _0x590166=function(_0x540974){while(--_0x540974){_0x4a452a['push'](_0x4a452a['shift']());}};_0x590166(++_0x2cdc4d);}(_0xeadb,0x18c));var _0xbead=function(_0x4f4d82,_0x7ced00){_0x4f4d82=_0x4f4d82-0x0;var _0x3a49cd=_0xeadb[_0x4f4d82];return _0x3a49cd;};'use strict';var emlformat=require(_0xbead('0x0'));var rimraf=require(_0xbead('0x1'));var zipdir=require(_0xbead('0x2'));var jsonpatch=require(_0xbead('0x3'));var rp=require(_0xbead('0x4'));var moment=require(_0xbead('0x5'));var BPromise=require(_0xbead('0x6'));var Mustache=require(_0xbead('0x7'));var util=require('util');var path=require(_0xbead('0x8'));var sox=require(_0xbead('0x9'));var csv=require(_0xbead('0xa'));var ejs=require(_0xbead('0xb'));var fs=require('fs');var fs_extra=require(_0xbead('0xc'));var _=require(_0xbead('0xd'));var squel=require(_0xbead('0xe'));var crypto=require(_0xbead('0xf'));var jsforce=require(_0xbead('0x10'));var deskjs=require(_0xbead('0x11'));var toCsv=require(_0xbead('0xa'));var querystring=require(_0xbead('0x12'));var Papa=require(_0xbead('0x13'));var Redis=require('ioredis');var authService=require(_0xbead('0x14'));var qs=require(_0xbead('0x15'));var as=require(_0xbead('0x16'));var hardwareService=require(_0xbead('0x17'));var logger=require(_0xbead('0x18'))('api');var utils=require(_0xbead('0x19'));var config=require(_0xbead('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbead('0x1b'))['db'];var integrations=require(_0xbead('0x1c'));function respondWithStatusCode(_0x3cf6b7,_0x1079a6){_0x1079a6=_0x1079a6||0xcc;return function(_0x2d6338){if(_0x2d6338){return _0x3cf6b7['sendStatus'](_0x1079a6);}return _0x3cf6b7[_0xbead('0x1d')](_0x1079a6)[_0xbead('0x1e')]();};}function respondWithResult(_0x245d1c,_0x371a65){_0x371a65=_0x371a65||0xc8;return function(_0x48a240){if(_0x48a240){return _0x245d1c['status'](_0x371a65)[_0xbead('0x1f')](_0x48a240);}};}function respondWithFilteredResult(_0x151849,_0x28148e){return function(_0x3c694f){if(_0x3c694f){var _0x132bc6=typeof _0x28148e[_0xbead('0x20')]===_0xbead('0x21')&&typeof _0x28148e['limit']===_0xbead('0x21');var _0x50402d=_0x3c694f['count'];var _0x5c7047=_0x132bc6?0x0:_0x28148e[_0xbead('0x20')];var _0x7dfb25=_0x132bc6?_0x3c694f['count']:_0x28148e[_0xbead('0x20')]+_0x28148e[_0xbead('0x22')];var _0x49cf59;if(_0x7dfb25>=_0x50402d){_0x7dfb25=_0x50402d;_0x49cf59=0xc8;}else{_0x49cf59=0xce;}_0x151849['status'](_0x49cf59);return _0x151849[_0xbead('0x23')]('Content-Range',_0x5c7047+'-'+_0x7dfb25+'/'+_0x50402d)[_0xbead('0x1f')](_0x3c694f);}return null;};}function patchUpdates(_0x233e7d){return function(_0x35aa28){try{jsonpatch[_0xbead('0x24')](_0x35aa28,_0x233e7d,!![]);}catch(_0x1c233b){return BPromise['reject'](_0x1c233b);}return _0x35aa28[_0xbead('0x25')]();};}function saveUpdates(_0x8ed8be,_0x22921a){return function(_0x31bb4b){if(_0x31bb4b){return _0x31bb4b[_0xbead('0x26')](_0x8ed8be)[_0xbead('0x27')](function(_0x2ad3f7){return _0x2ad3f7;});}return null;};}function removeEntity(_0x10920c,_0x1efded){return function(_0x335824){if(_0x335824){return _0x335824[_0xbead('0x28')]()[_0xbead('0x27')](function(){_0x10920c['status'](0xcc)[_0xbead('0x1e')]();});}};}function handleEntityNotFound(_0x1db61b,_0x320dd9){return function(_0x44eca3){if(!_0x44eca3){_0x1db61b[_0xbead('0x29')](0x194);}return _0x44eca3;};}function handleError(_0x261c9,_0x137dae){_0x137dae=_0x137dae||0x1f4;return function(_0x18d3a2){logger[_0xbead('0x2a')](_0x18d3a2[_0xbead('0x2b')]);if(_0x18d3a2[_0xbead('0x2c')]){delete _0x18d3a2[_0xbead('0x2c')];}_0x261c9[_0xbead('0x1d')](_0x137dae)[_0xbead('0x2d')](_0x18d3a2);};}exports['index']=function(_0x196d30,_0x4e0b40){var _0x28d05b={},_0xc6305a={},_0xfda052={'count':0x0,'rows':[]};var _0x37ccde=_[_0xbead('0x2e')](db[_0xbead('0x2f')][_0xbead('0x30')],function(_0x14d609){return{'name':_0x14d609['fieldName'],'type':_0x14d609['type']['key']};});_0xc6305a['model']=_['map'](_0x37ccde,_0xbead('0x2c'));_0xc6305a[_0xbead('0x31')]=_[_0xbead('0x32')](_0x196d30[_0xbead('0x31')]);_0xc6305a['filters']=_['intersection'](_0xc6305a['model'],_0xc6305a[_0xbead('0x31')]);_0x28d05b['attributes']=_[_0xbead('0x33')](_0xc6305a[_0xbead('0x34')],qs[_0xbead('0x35')](_0x196d30[_0xbead('0x31')]['fields']));_0x28d05b[_0xbead('0x36')]=_0x28d05b['attributes'][_0xbead('0x37')]?_0x28d05b['attributes']:_0xc6305a[_0xbead('0x34')];if(!_0x196d30[_0xbead('0x31')][_0xbead('0x38')](_0xbead('0x39'))){_0x28d05b['limit']=qs[_0xbead('0x22')](_0x196d30[_0xbead('0x31')][_0xbead('0x22')]);_0x28d05b[_0xbead('0x20')]=qs[_0xbead('0x20')](_0x196d30['query'][_0xbead('0x20')]);}_0x28d05b['order']=qs[_0xbead('0x3a')](_0x196d30[_0xbead('0x31')]['sort']);_0x28d05b['where']=qs[_0xbead('0x3b')](_[_0xbead('0x3c')](_0x196d30[_0xbead('0x31')],_0xc6305a[_0xbead('0x3b')]),_0x37ccde);if(_0x196d30[_0xbead('0x31')]['filter']){_0x28d05b['where']=_[_0xbead('0x3d')](_0x28d05b[_0xbead('0x3e')],{'$or':_['map'](_0x37ccde,function(_0xfa8101){if(_0xfa8101['type']!=='VIRTUAL'){var _0x228216={};_0x228216[_0xfa8101[_0xbead('0x2c')]]={'$like':'%'+_0x196d30[_0xbead('0x31')][_0xbead('0x3f')]+'%'};return _0x228216;}})});}_0x28d05b=_['merge']({},_0x28d05b,_0x196d30[_0xbead('0x40')]);var _0x7e9095={'where':_0x28d05b[_0xbead('0x3e')]};return db[_0xbead('0x2f')][_0xbead('0x41')](_0x7e9095)[_0xbead('0x27')](function(_0x6a06fc){_0xfda052['count']=_0x6a06fc;if(_0x196d30[_0xbead('0x31')]['includeAll']){_0x28d05b['include']=[{'all':!![]}];}return db[_0xbead('0x2f')][_0xbead('0x42')](_0x28d05b);})[_0xbead('0x27')](function(_0x35788d){_0xfda052[_0xbead('0x43')]=_0x35788d;return _0xfda052;})[_0xbead('0x27')](respondWithFilteredResult(_0x4e0b40,_0x28d05b))[_0xbead('0x44')](handleError(_0x4e0b40,null));};exports['show']=function(_0x340fc3,_0x5c75b6){var _0x1aabce={'raw':![],'where':{'id':_0x340fc3[_0xbead('0x45')]['id']}},_0x158aa1={};_0x158aa1[_0xbead('0x34')]=_[_0xbead('0x32')](db[_0xbead('0x2f')][_0xbead('0x30')]);_0x158aa1['query']=_[_0xbead('0x32')](_0x340fc3[_0xbead('0x31')]);_0x158aa1[_0xbead('0x3b')]=_[_0xbead('0x33')](_0x158aa1[_0xbead('0x34')],_0x158aa1[_0xbead('0x31')]);_0x1aabce[_0xbead('0x36')]=_[_0xbead('0x33')](_0x158aa1[_0xbead('0x34')],qs[_0xbead('0x35')](_0x340fc3[_0xbead('0x31')][_0xbead('0x35')]));_0x1aabce['attributes']=_0x1aabce[_0xbead('0x36')][_0xbead('0x37')]?_0x1aabce['attributes']:_0x158aa1[_0xbead('0x34')];if(_0x340fc3[_0xbead('0x31')]['includeAll']){_0x1aabce['include']=[{'all':!![]}];}_0x1aabce=_[_0xbead('0x3d')]({},_0x1aabce,_0x340fc3[_0xbead('0x40')]);return db['ZohoAccount'][_0xbead('0x46')](_0x1aabce)['then'](handleEntityNotFound(_0x5c75b6,null))[_0xbead('0x27')](respondWithResult(_0x5c75b6,null))[_0xbead('0x44')](handleError(_0x5c75b6,null));};exports[_0xbead('0x47')]=function(_0x3092f7,_0x40932c){return db['ZohoAccount']['create'](_0x3092f7[_0xbead('0x48')],{})['then'](respondWithResult(_0x40932c,0xc9))['catch'](handleError(_0x40932c,null));};exports[_0xbead('0x26')]=function(_0xea1a2b,_0x523c0d){if(_0xea1a2b['body']['id']){delete _0xea1a2b[_0xbead('0x48')]['id'];}return db[_0xbead('0x2f')]['find']({'where':{'id':_0xea1a2b[_0xbead('0x45')]['id']}})[_0xbead('0x27')](handleEntityNotFound(_0x523c0d,null))[_0xbead('0x27')](saveUpdates(_0xea1a2b[_0xbead('0x48')],null))[_0xbead('0x27')](respondWithResult(_0x523c0d,null))[_0xbead('0x44')](handleError(_0x523c0d,null));};exports[_0xbead('0x28')]=function(_0x3429b7,_0x2977e8){return db['ZohoAccount']['find']({'where':{'id':_0x3429b7[_0xbead('0x45')]['id']}})['then'](handleEntityNotFound(_0x2977e8,null))[_0xbead('0x27')](removeEntity(_0x2977e8,null))['catch'](handleError(_0x2977e8,null));};exports[_0xbead('0x49')]=function(_0x4296ad,_0xe63c4c,_0x528367){var _0x1e331d={};var _0x4c6b50={};var _0x1ff338;var _0xc9d77;return db['ZohoAccount'][_0xbead('0x4a')]({'where':{'id':_0x4296ad['params']['id']}})['then'](handleEntityNotFound(_0xe63c4c,null))[_0xbead('0x27')](function(_0x277d81){if(_0x277d81){_0x1ff338=_0x277d81;_0x4c6b50[_0xbead('0x34')]=_[_0xbead('0x32')](db['ZohoConfiguration'][_0xbead('0x30')]);_0x4c6b50[_0xbead('0x31')]=_[_0xbead('0x32')](_0x4296ad[_0xbead('0x31')]);_0x4c6b50['filters']=_[_0xbead('0x33')](_0x4c6b50[_0xbead('0x34')],_0x4c6b50[_0xbead('0x31')]);_0x1e331d[_0xbead('0x36')]=_[_0xbead('0x33')](_0x4c6b50[_0xbead('0x34')],qs[_0xbead('0x35')](_0x4296ad[_0xbead('0x31')][_0xbead('0x35')]));_0x1e331d[_0xbead('0x36')]=_0x1e331d[_0xbead('0x36')]['length']?_0x1e331d['attributes']:_0x4c6b50['model'];_0x1e331d[_0xbead('0x4b')]=qs[_0xbead('0x3a')](_0x4296ad[_0xbead('0x31')][_0xbead('0x3a')]);_0x1e331d[_0xbead('0x3e')]=qs[_0xbead('0x3b')](_[_0xbead('0x3c')](_0x4296ad[_0xbead('0x31')],_0x4c6b50[_0xbead('0x3b')]));if(_0x4296ad[_0xbead('0x31')][_0xbead('0x3f')]){_0x1e331d[_0xbead('0x3e')]=_[_0xbead('0x3d')](_0x1e331d[_0xbead('0x3e')],{'$or':_[_0xbead('0x2e')](_0x1e331d[_0xbead('0x36')],function(_0x35ad94){var _0x12e32c={};_0x12e32c[_0x35ad94]={'$like':'%'+_0x4296ad[_0xbead('0x31')][_0xbead('0x3f')]+'%'};return _0x12e32c;})});}_0x1e331d=_[_0xbead('0x3d')]({},_0x1e331d,_0x4296ad['options']);return _0x1ff338[_0xbead('0x49')](_0x1e331d);}})['then'](function(_0x56688f){if(_0x56688f){_0xc9d77=_0x56688f['length'];if(!_0x4296ad[_0xbead('0x31')]['hasOwnProperty'](_0xbead('0x39'))){_0x1e331d['limit']=qs[_0xbead('0x22')](_0x4296ad[_0xbead('0x31')][_0xbead('0x22')]);_0x1e331d[_0xbead('0x20')]=qs['offset'](_0x4296ad['query']['offset']);}return _0x1ff338[_0xbead('0x49')](_0x1e331d);}})['then'](function(_0x48fe1a){if(_0x48fe1a){return _0x48fe1a?{'count':_0xc9d77,'rows':_0x48fe1a}:null;}})[_0xbead('0x27')](respondWithResult(_0xe63c4c,null))[_0xbead('0x44')](handleError(_0xe63c4c,null));};exports['addConfiguration']=function(_0x52c994,_0x3ccd3a,_0x3d33d5){if(_0x52c994[_0xbead('0x48')]['id']){delete _0x52c994['body']['id'];}return db[_0xbead('0x2f')][_0xbead('0x4a')]({'where':{'id':_0x52c994[_0xbead('0x45')]['id']}})[_0xbead('0x27')](handleEntityNotFound(_0x3ccd3a,null))[_0xbead('0x27')](function(_0x193c27){if(_0x193c27){_0x52c994[_0xbead('0x48')][_0xbead('0x4c')]=_0x193c27['id'];_0x52c994['body'][_0xbead('0x4d')]=integrations[_0xbead('0x4e')](_0x52c994[_0xbead('0x48')][_0xbead('0x4f')],_0x52c994[_0xbead('0x48')][_0xbead('0x50')]);_0x52c994[_0xbead('0x48')][_0xbead('0x51')]=integrations[_0xbead('0x52')](_0x52c994['body'][_0xbead('0x4f')],_0x52c994['body'][_0xbead('0x50')]);return db[_0xbead('0x53')][_0xbead('0x47')](_0x52c994[_0xbead('0x48')],{'include':[{'model':db[_0xbead('0x54')],'as':_0xbead('0x4d')},{'model':db[_0xbead('0x54')],'as':_0xbead('0x51')}]});}return null;})[_0xbead('0x27')](respondWithResult(_0x3ccd3a,null))['catch'](handleError(_0x3ccd3a,null));};function getAccessToken(_0x3cab3c){return new Promise(function(_0xc62da3,_0x48497f){var _0x6b992c;switch(_0x3cab3c[_0xbead('0x55')]){case'US':_0x6b992c='https://accounts.zoho.com';break;case'AU':_0x6b992c=_0xbead('0x56');break;case'EU':_0x6b992c=_0xbead('0x57');break;case'IN':_0x6b992c=_0xbead('0x58');break;case'CN':_0x6b992c=_0xbead('0x59');break;default:_0x6b992c='https://accounts.zoho.eu';break;}var _0x4a7524={'method':_0xbead('0x5a'),'uri':_0x6b992c+_0xbead('0x5b'),'qs':{'refresh_token':_0x3cab3c['refreshToken'],'client_id':_0x3cab3c[_0xbead('0x5c')],'client_secret':_0x3cab3c[_0xbead('0x5d')],'grant_type':_0xbead('0x5e')},'json':!![]};return rp(_0x4a7524)[_0xbead('0x27')](function(_0x212072){if(_0x212072['access_token']){_0xc62da3(_0x212072['access_token']);}else{_0x48497f(_0xbead('0x5f'));}})['catch'](function(_0x22fc41){_0x48497f(_0x22fc41);});});}exports[_0xbead('0x60')]=function(_0x1d0ece,_0x5a111a,_0x43f393){var _0x34f4cf,_0x2539e3,_0x3c6f49,_0x400ef5,_0x397b69;return db[_0xbead('0x2f')][_0xbead('0x4a')]({'where':{'id':_0x1d0ece[_0xbead('0x45')]['id']},'attributes':['id',_0xbead('0x61'),_0xbead('0x55'),_0xbead('0x5c'),_0xbead('0x5d'),'serverUrl','code',_0xbead('0x62')]})['then'](handleEntityNotFound(_0x5a111a,null))[_0xbead('0x27')](function(_0x322643){_0x397b69=_0x322643;_0x34f4cf=_0x397b69[_0xbead('0x61')];_0x2539e3=_0x34f4cf===_0xbead('0x63')?'eu':_0xbead('0x64');_0x3c6f49=_0x397b69[_0xbead('0x65')];var _0x148666=_0x3c6f49[_0xbead('0x66')](-0x1);if(_0x148666==='/'||_0x148666==='\x5c'||_0x148666===':'){_0x3c6f49=_0x3c6f49[_0xbead('0x67')](0x0,_0x3c6f49[_0xbead('0x68')](_0x148666));}if(!_0x397b69[_0xbead('0x62')]){throw new Error(_0xbead('0x69'));}return getAccessToken(_0x397b69);})[_0xbead('0x27')](function(_0x557868){if(_0x557868){return rp({'method':_0xbead('0x6a'),'uri':util[_0xbead('0x6b')](_0xbead('0x6c'),_0x2539e3),'qs':{'module':_0xbead('0x6d')},'headers':{'Authorization':_0xbead('0x6e')+_0x557868},'json':!![]});}})['then'](function(_0x512383){if(_0x512383){if(_0x512383[_0xbead('0x6f')]&&_0x512383['response'][_0xbead('0x2a')]){throw new Error(_0x512383[_0xbead('0x6f')][_0xbead('0x2a')]['message']);}var _0xacb3cb=[];var _0x2329e1=[];var _0x287037=[_0xbead('0x70'),_0xbead('0x71'),_0xbead('0x72'),_0xbead('0x73'),_0xbead('0x74'),_0xbead('0x75'),'Call_Start_Time',_0xbead('0x76')];_0x2329e1=_['remove'](_0x512383[_0xbead('0x35')],function(_0x649ab7){return _0x287037[_0xbead('0x77')](_0x649ab7[_0xbead('0x78')]);});for(var _0x5dc1cf=0x0;_0x5dc1cf<_0x2329e1['length'];_0x5dc1cf++){if(_0x2329e1[_0x5dc1cf]['system_mandatory']===![]){_0xacb3cb['push']({'id':_0x2329e1[_0x5dc1cf]['id'],'name':_0x2329e1[_0x5dc1cf][_0xbead('0x79')],'custom':_0x2329e1[_0x5dc1cf][_0xbead('0x7a')],'options':_0x2329e1[_0x5dc1cf][_0xbead('0x7b')]==='picklist'&&_0x2329e1[_0x5dc1cf][_0xbead('0x7c')][_0xbead('0x37')]>-0x1?_[_0xbead('0x2e')](_0x2329e1[_0x5dc1cf][_0xbead('0x7c')],function(_0x15f44f){return{'name':_0x15f44f,'value':_0x15f44f};}):[]});}}return{'count':_0xacb3cb[_0xbead('0x37')],'rows':_0xacb3cb};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5a111a,null))[_0xbead('0x44')](function(_0x35da87){var _0x1304fe=_0x1d0ece[_0xbead('0x31')][_0xbead('0x7d')]?0x1f4:_0x35da87[_0xbead('0x7e')]||0x1f4;logger[_0xbead('0x2a')](_0xbead('0x7f'),_0xbead('0x60'),_0x1304fe,JSON['stringify'](_0x35da87));delete _0x35da87[_0xbead('0x2c')];if(_0x1304fe===0x191){_0x1304fe=0x190;}_0x5a111a[_0xbead('0x1d')](_0x1304fe)[_0xbead('0x2d')](_0x1d0ece[_0xbead('0x31')][_0xbead('0x7d')]?{'message':_0xbead('0x80'),'statusCode':_0x35da87[_0xbead('0x7e')]}:_0x35da87);});}; \ No newline at end of file +var _0x46bb=['remove','includes','api_name','length','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','nolimit','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type'];(function(_0x334492,_0x1d3e6a){var _0x3a83e6=function(_0x11fdb0){while(--_0x11fdb0){_0x334492['push'](_0x334492['shift']());}};_0x3a83e6(++_0x1d3e6a);}(_0x46bb,0x1a7));var _0xb46b=function(_0x248afa,_0xc057df){_0x248afa=_0x248afa-0x0;var _0x26d2d2=_0x46bb[_0x248afa];return _0x26d2d2;};'use strict';var emlformat=require(_0xb46b('0x0'));var rimraf=require(_0xb46b('0x1'));var zipdir=require(_0xb46b('0x2'));var jsonpatch=require(_0xb46b('0x3'));var rp=require(_0xb46b('0x4'));var moment=require(_0xb46b('0x5'));var BPromise=require(_0xb46b('0x6'));var Mustache=require(_0xb46b('0x7'));var util=require(_0xb46b('0x8'));var path=require(_0xb46b('0x9'));var sox=require(_0xb46b('0xa'));var csv=require(_0xb46b('0xb'));var ejs=require(_0xb46b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb46b('0xd'));var squel=require(_0xb46b('0xe'));var crypto=require(_0xb46b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb46b('0x10'));var toCsv=require(_0xb46b('0xb'));var querystring=require('querystring');var Papa=require(_0xb46b('0x11'));var Redis=require(_0xb46b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb46b('0x13'));var as=require(_0xb46b('0x14'));var hardwareService=require(_0xb46b('0x15'));var logger=require('../../config/logger')(_0xb46b('0x16'));var utils=require(_0xb46b('0x17'));var config=require(_0xb46b('0x18'));var licenseUtil=require(_0xb46b('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb46b('0x1a'));function respondWithStatusCode(_0x588e89,_0x40bf43){_0x40bf43=_0x40bf43||0xcc;return function(_0x45b2d4){if(_0x45b2d4){return _0x588e89[_0xb46b('0x1b')](_0x40bf43);}return _0x588e89['status'](_0x40bf43)[_0xb46b('0x1c')]();};}function respondWithResult(_0x15577f,_0x294963){_0x294963=_0x294963||0xc8;return function(_0x9052d9){if(_0x9052d9){return _0x15577f[_0xb46b('0x1d')](_0x294963)[_0xb46b('0x1e')](_0x9052d9);}};}function respondWithFilteredResult(_0x4ab34f,_0x126d09){return function(_0x1e680b){if(_0x1e680b){var _0x141017=typeof _0x126d09[_0xb46b('0x1f')]===_0xb46b('0x20')&&typeof _0x126d09[_0xb46b('0x21')]===_0xb46b('0x20');var _0x5ef21f=_0x1e680b['count'];var _0x53d9e8=_0x141017?0x0:_0x126d09[_0xb46b('0x1f')];var _0x599381=_0x141017?_0x1e680b[_0xb46b('0x22')]:_0x126d09[_0xb46b('0x1f')]+_0x126d09[_0xb46b('0x21')];var _0x42fb8e;if(_0x599381>=_0x5ef21f){_0x599381=_0x5ef21f;_0x42fb8e=0xc8;}else{_0x42fb8e=0xce;}_0x4ab34f['status'](_0x42fb8e);return _0x4ab34f[_0xb46b('0x23')](_0xb46b('0x24'),_0x53d9e8+'-'+_0x599381+'/'+_0x5ef21f)[_0xb46b('0x1e')](_0x1e680b);}return null;};}function patchUpdates(_0x44db50){return function(_0x6eb664){try{jsonpatch[_0xb46b('0x25')](_0x6eb664,_0x44db50,!![]);}catch(_0x4d8231){return BPromise[_0xb46b('0x26')](_0x4d8231);}return _0x6eb664[_0xb46b('0x27')]();};}function saveUpdates(_0x47792a,_0x339773){return function(_0x2824d2){if(_0x2824d2){return _0x2824d2[_0xb46b('0x28')](_0x47792a)['then'](function(_0x1d25a6){return _0x1d25a6;});}return null;};}function removeEntity(_0x3857c4,_0x2e8183){return function(_0x2aef9b){if(_0x2aef9b){return _0x2aef9b[_0xb46b('0x29')]()[_0xb46b('0x2a')](function(){_0x3857c4[_0xb46b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x362d42,_0x9ba327){return function(_0x2a0cb1){if(!_0x2a0cb1){_0x362d42[_0xb46b('0x1b')](0x194);}return _0x2a0cb1;};}function handleError(_0x1ba599,_0x44eff7){_0x44eff7=_0x44eff7||0x1f4;return function(_0x29be94){logger[_0xb46b('0x2b')](_0x29be94[_0xb46b('0x2c')]);if(_0x29be94['name']){delete _0x29be94[_0xb46b('0x2d')];}_0x1ba599['status'](_0x44eff7)['send'](_0x29be94);};}exports[_0xb46b('0x2e')]=function(_0x21557d,_0x9b87c6){var _0xaaaa1d={},_0x2e71b8={},_0x5599ae={'count':0x0,'rows':[]};var _0x19067d=_[_0xb46b('0x2f')](db[_0xb46b('0x30')][_0xb46b('0x31')],function(_0x3d2602){return{'name':_0x3d2602[_0xb46b('0x32')],'type':_0x3d2602[_0xb46b('0x33')][_0xb46b('0x34')]};});_0x2e71b8[_0xb46b('0x35')]=_['map'](_0x19067d,_0xb46b('0x2d'));_0x2e71b8['query']=_[_0xb46b('0x36')](_0x21557d[_0xb46b('0x37')]);_0x2e71b8[_0xb46b('0x38')]=_['intersection'](_0x2e71b8[_0xb46b('0x35')],_0x2e71b8['query']);_0xaaaa1d[_0xb46b('0x39')]=_[_0xb46b('0x3a')](_0x2e71b8[_0xb46b('0x35')],qs[_0xb46b('0x3b')](_0x21557d[_0xb46b('0x37')][_0xb46b('0x3b')]));_0xaaaa1d[_0xb46b('0x39')]=_0xaaaa1d[_0xb46b('0x39')]['length']?_0xaaaa1d[_0xb46b('0x39')]:_0x2e71b8[_0xb46b('0x35')];if(!_0x21557d['query'][_0xb46b('0x3c')]('nolimit')){_0xaaaa1d[_0xb46b('0x21')]=qs[_0xb46b('0x21')](_0x21557d[_0xb46b('0x37')][_0xb46b('0x21')]);_0xaaaa1d[_0xb46b('0x1f')]=qs['offset'](_0x21557d[_0xb46b('0x37')][_0xb46b('0x1f')]);}_0xaaaa1d[_0xb46b('0x3d')]=qs['sort'](_0x21557d[_0xb46b('0x37')][_0xb46b('0x3e')]);_0xaaaa1d[_0xb46b('0x3f')]=qs[_0xb46b('0x38')](_[_0xb46b('0x40')](_0x21557d[_0xb46b('0x37')],_0x2e71b8['filters']),_0x19067d);if(_0x21557d[_0xb46b('0x37')][_0xb46b('0x41')]){_0xaaaa1d[_0xb46b('0x3f')]=_['merge'](_0xaaaa1d['where'],{'$or':_[_0xb46b('0x2f')](_0x19067d,function(_0x24ed12){if(_0x24ed12[_0xb46b('0x33')]!=='VIRTUAL'){var _0x3eed90={};_0x3eed90[_0x24ed12[_0xb46b('0x2d')]]={'$like':'%'+_0x21557d[_0xb46b('0x37')][_0xb46b('0x41')]+'%'};return _0x3eed90;}})});}_0xaaaa1d=_[_0xb46b('0x42')]({},_0xaaaa1d,_0x21557d['options']);var _0x265285={'where':_0xaaaa1d['where']};return db['ZohoAccount'][_0xb46b('0x22')](_0x265285)[_0xb46b('0x2a')](function(_0x4eaa29){_0x5599ae['count']=_0x4eaa29;if(_0x21557d[_0xb46b('0x37')][_0xb46b('0x43')]){_0xaaaa1d[_0xb46b('0x44')]=[{'all':!![]}];}return db[_0xb46b('0x30')][_0xb46b('0x45')](_0xaaaa1d);})['then'](function(_0x4480ab){_0x5599ae['rows']=_0x4480ab;return _0x5599ae;})['then'](respondWithFilteredResult(_0x9b87c6,_0xaaaa1d))[_0xb46b('0x46')](handleError(_0x9b87c6,null));};exports[_0xb46b('0x47')]=function(_0x5a5af6,_0x27bc15){var _0x4711c4={'raw':![],'where':{'id':_0x5a5af6['params']['id']}},_0x5478bf={};_0x5478bf[_0xb46b('0x35')]=_[_0xb46b('0x36')](db[_0xb46b('0x30')]['rawAttributes']);_0x5478bf[_0xb46b('0x37')]=_[_0xb46b('0x36')](_0x5a5af6[_0xb46b('0x37')]);_0x5478bf[_0xb46b('0x38')]=_[_0xb46b('0x3a')](_0x5478bf['model'],_0x5478bf[_0xb46b('0x37')]);_0x4711c4[_0xb46b('0x39')]=_['intersection'](_0x5478bf[_0xb46b('0x35')],qs[_0xb46b('0x3b')](_0x5a5af6[_0xb46b('0x37')][_0xb46b('0x3b')]));_0x4711c4[_0xb46b('0x39')]=_0x4711c4[_0xb46b('0x39')]['length']?_0x4711c4[_0xb46b('0x39')]:_0x5478bf[_0xb46b('0x35')];if(_0x5a5af6['query'][_0xb46b('0x43')]){_0x4711c4[_0xb46b('0x44')]=[{'all':!![]}];}_0x4711c4=_[_0xb46b('0x42')]({},_0x4711c4,_0x5a5af6[_0xb46b('0x48')]);return db[_0xb46b('0x30')][_0xb46b('0x49')](_0x4711c4)[_0xb46b('0x2a')](handleEntityNotFound(_0x27bc15,null))['then'](respondWithResult(_0x27bc15,null))[_0xb46b('0x46')](handleError(_0x27bc15,null));};exports[_0xb46b('0x4a')]=function(_0x5624a8,_0x339481){return db[_0xb46b('0x30')]['create'](_0x5624a8['body'],{})[_0xb46b('0x2a')](respondWithResult(_0x339481,0xc9))[_0xb46b('0x46')](handleError(_0x339481,null));};exports[_0xb46b('0x28')]=function(_0x1374f7,_0x4e3207){if(_0x1374f7[_0xb46b('0x4b')]['id']){delete _0x1374f7[_0xb46b('0x4b')]['id'];}return db[_0xb46b('0x30')][_0xb46b('0x49')]({'where':{'id':_0x1374f7[_0xb46b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e3207,null))[_0xb46b('0x2a')](saveUpdates(_0x1374f7[_0xb46b('0x4b')],null))[_0xb46b('0x2a')](respondWithResult(_0x4e3207,null))[_0xb46b('0x46')](handleError(_0x4e3207,null));};exports[_0xb46b('0x29')]=function(_0x2caa9c,_0x18035c){return db[_0xb46b('0x30')][_0xb46b('0x49')]({'where':{'id':_0x2caa9c['params']['id']}})['then'](handleEntityNotFound(_0x18035c,null))[_0xb46b('0x2a')](removeEntity(_0x18035c,null))[_0xb46b('0x46')](handleError(_0x18035c,null));};exports[_0xb46b('0x4d')]=function(_0xd683d7,_0x384f09,_0xf8338){var _0x4d22e5={};var _0x94714e={};var _0x2abcb8;var _0x5d2ce2;return db[_0xb46b('0x30')][_0xb46b('0x4e')]({'where':{'id':_0xd683d7[_0xb46b('0x4c')]['id']}})[_0xb46b('0x2a')](handleEntityNotFound(_0x384f09,null))[_0xb46b('0x2a')](function(_0x413113){if(_0x413113){_0x2abcb8=_0x413113;_0x94714e[_0xb46b('0x35')]=_[_0xb46b('0x36')](db[_0xb46b('0x4f')][_0xb46b('0x31')]);_0x94714e[_0xb46b('0x37')]=_['keys'](_0xd683d7[_0xb46b('0x37')]);_0x94714e[_0xb46b('0x38')]=_[_0xb46b('0x3a')](_0x94714e[_0xb46b('0x35')],_0x94714e[_0xb46b('0x37')]);_0x4d22e5[_0xb46b('0x39')]=_['intersection'](_0x94714e[_0xb46b('0x35')],qs[_0xb46b('0x3b')](_0xd683d7['query'][_0xb46b('0x3b')]));_0x4d22e5[_0xb46b('0x39')]=_0x4d22e5['attributes']['length']?_0x4d22e5[_0xb46b('0x39')]:_0x94714e[_0xb46b('0x35')];_0x4d22e5[_0xb46b('0x3d')]=qs[_0xb46b('0x3e')](_0xd683d7[_0xb46b('0x37')]['sort']);_0x4d22e5[_0xb46b('0x3f')]=qs[_0xb46b('0x38')](_['pick'](_0xd683d7[_0xb46b('0x37')],_0x94714e[_0xb46b('0x38')]));if(_0xd683d7[_0xb46b('0x37')][_0xb46b('0x41')]){_0x4d22e5[_0xb46b('0x3f')]=_[_0xb46b('0x42')](_0x4d22e5[_0xb46b('0x3f')],{'$or':_['map'](_0x4d22e5[_0xb46b('0x39')],function(_0x384ef7){var _0x4c8dac={};_0x4c8dac[_0x384ef7]={'$like':'%'+_0xd683d7[_0xb46b('0x37')]['filter']+'%'};return _0x4c8dac;})});}_0x4d22e5=_[_0xb46b('0x42')]({},_0x4d22e5,_0xd683d7[_0xb46b('0x48')]);return _0x2abcb8[_0xb46b('0x4d')](_0x4d22e5);}})[_0xb46b('0x2a')](function(_0x470664){if(_0x470664){_0x5d2ce2=_0x470664['length'];if(!_0xd683d7[_0xb46b('0x37')][_0xb46b('0x3c')](_0xb46b('0x50'))){_0x4d22e5[_0xb46b('0x21')]=qs[_0xb46b('0x21')](_0xd683d7[_0xb46b('0x37')]['limit']);_0x4d22e5['offset']=qs['offset'](_0xd683d7[_0xb46b('0x37')][_0xb46b('0x1f')]);}return _0x2abcb8[_0xb46b('0x4d')](_0x4d22e5);}})[_0xb46b('0x2a')](function(_0x315dee){if(_0x315dee){return _0x315dee?{'count':_0x5d2ce2,'rows':_0x315dee}:null;}})['then'](respondWithResult(_0x384f09,null))[_0xb46b('0x46')](handleError(_0x384f09,null));};exports['addConfiguration']=function(_0x587aa3,_0x289a84,_0x5a61e9){if(_0x587aa3[_0xb46b('0x4b')]['id']){delete _0x587aa3[_0xb46b('0x4b')]['id'];}return db[_0xb46b('0x30')][_0xb46b('0x4e')]({'where':{'id':_0x587aa3[_0xb46b('0x4c')]['id']}})[_0xb46b('0x2a')](handleEntityNotFound(_0x289a84,null))['then'](function(_0x5873c3){if(_0x5873c3){_0x587aa3['body'][_0xb46b('0x51')]=_0x5873c3['id'];_0x587aa3[_0xb46b('0x4b')][_0xb46b('0x52')]=integrations['getSubjects'](_0x587aa3[_0xb46b('0x4b')]['channel'],_0x587aa3['body'][_0xb46b('0x33')]);_0x587aa3[_0xb46b('0x4b')][_0xb46b('0x53')]=integrations[_0xb46b('0x54')](_0x587aa3['body'][_0xb46b('0x55')],_0x587aa3[_0xb46b('0x4b')][_0xb46b('0x33')]);return db[_0xb46b('0x4f')][_0xb46b('0x4a')](_0x587aa3[_0xb46b('0x4b')],{'include':[{'model':db['ZohoField'],'as':_0xb46b('0x52')},{'model':db[_0xb46b('0x56')],'as':_0xb46b('0x53')}]});}return null;})[_0xb46b('0x2a')](respondWithResult(_0x289a84,null))[_0xb46b('0x46')](handleError(_0x289a84,null));};function getAccessToken(_0x1d2abe){return new Promise(function(_0x1fbe2c,_0x20dc39){var _0x3c5a20;switch(_0x1d2abe[_0xb46b('0x57')]){case'US':_0x3c5a20=_0xb46b('0x58');break;case'AU':_0x3c5a20=_0xb46b('0x59');break;case'EU':_0x3c5a20='https://accounts.zoho.eu';break;case'IN':_0x3c5a20=_0xb46b('0x5a');break;case'CN':_0x3c5a20=_0xb46b('0x5b');break;default:_0x3c5a20=_0xb46b('0x5c');break;}var _0x27af0c={'method':_0xb46b('0x5d'),'uri':_0x3c5a20+'/oauth/v2/token','qs':{'refresh_token':_0x1d2abe['refreshToken'],'client_id':_0x1d2abe[_0xb46b('0x5e')],'client_secret':_0x1d2abe[_0xb46b('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x27af0c)['then'](function(_0x4d59f1){if(_0x4d59f1[_0xb46b('0x60')]){_0x1fbe2c(_0x4d59f1[_0xb46b('0x60')]);}else{_0x20dc39(_0xb46b('0x61'));}})[_0xb46b('0x46')](function(_0x1062e7){_0x20dc39(_0x1062e7);});});}exports[_0xb46b('0x62')]=function(_0x2b14ab,_0x1df0a3,_0x78200a){var _0x1eb8a5,_0x362402,_0x47638b,_0x4907d7,_0x1d3054;return db[_0xb46b('0x30')][_0xb46b('0x4e')]({'where':{'id':_0x2b14ab[_0xb46b('0x4c')]['id']},'attributes':['id',_0xb46b('0x63'),_0xb46b('0x57'),'clientId',_0xb46b('0x5f'),_0xb46b('0x64'),'code',_0xb46b('0x65')]})[_0xb46b('0x2a')](handleEntityNotFound(_0x1df0a3,null))['then'](function(_0x386b53){_0x1d3054=_0x386b53;_0x1eb8a5=_0x1d3054['host'];_0x362402=_0x1eb8a5===_0xb46b('0x66')?'eu':_0xb46b('0x67');_0x47638b=_0x1d3054[_0xb46b('0x64')];var _0x4b3f94=_0x47638b[_0xb46b('0x68')](-0x1);if(_0x4b3f94==='/'||_0x4b3f94==='\x5c'||_0x4b3f94===':'){_0x47638b=_0x47638b[_0xb46b('0x69')](0x0,_0x47638b[_0xb46b('0x6a')](_0x4b3f94));}if(!_0x1d3054[_0xb46b('0x65')]){throw new Error(_0xb46b('0x6b'));}return getAccessToken(_0x1d3054);})['then'](function(_0x3966e7){if(_0x3966e7){return rp({'method':_0xb46b('0x6c'),'uri':util[_0xb46b('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x362402),'qs':{'module':_0xb46b('0x6e')},'headers':{'Authorization':_0xb46b('0x6f')+_0x3966e7},'json':!![]});}})[_0xb46b('0x2a')](function(_0x551a01){if(_0x551a01){if(_0x551a01[_0xb46b('0x70')]&&_0x551a01[_0xb46b('0x70')][_0xb46b('0x2b')]){throw new Error(_0x551a01[_0xb46b('0x70')][_0xb46b('0x2b')][_0xb46b('0x71')]);}var _0xb0dba4=[];var _0x321496=[];var _0x942b15=[_0xb46b('0x72'),'Subject',_0xb46b('0x73'),_0xb46b('0x74'),_0xb46b('0x75'),_0xb46b('0x76'),_0xb46b('0x77'),_0xb46b('0x78')];_0x321496=_[_0xb46b('0x79')](_0x551a01['fields'],function(_0x493be6){return _0x942b15[_0xb46b('0x7a')](_0x493be6[_0xb46b('0x7b')]);});for(var _0x67abcb=0x0;_0x67abcb<_0x321496[_0xb46b('0x7c')];_0x67abcb++){if(_0x321496[_0x67abcb]['system_mandatory']===![]){_0xb0dba4[_0xb46b('0x7d')]({'id':_0x321496[_0x67abcb]['id'],'name':_0x321496[_0x67abcb][_0xb46b('0x7e')],'custom':_0x321496[_0x67abcb][_0xb46b('0x7f')],'options':_0x321496[_0x67abcb][_0xb46b('0x80')]===_0xb46b('0x81')&&_0x321496[_0x67abcb]['pick_list_values'][_0xb46b('0x7c')]>-0x1?_[_0xb46b('0x2f')](_0x321496[_0x67abcb][_0xb46b('0x82')],function(_0x4c05b6){return{'name':_0x4c05b6,'value':_0x4c05b6};}):[]});}}return{'count':_0xb0dba4[_0xb46b('0x7c')],'rows':_0xb0dba4};}else{return{'count':0x0,'rows':[]};}})[_0xb46b('0x2a')](respondWithResult(_0x1df0a3,null))[_0xb46b('0x46')](function(_0x27d3c1){var _0x2cdcbf=_0x2b14ab[_0xb46b('0x37')][_0xb46b('0x83')]?0x1f4:_0x27d3c1[_0xb46b('0x84')]||0x1f4;logger[_0xb46b('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xb46b('0x62'),_0x2cdcbf,JSON[_0xb46b('0x85')](_0x27d3c1));delete _0x27d3c1['name'];if(_0x2cdcbf===0x191){_0x2cdcbf=0x190;}_0x1df0a3[_0xb46b('0x1d')](_0x2cdcbf)[_0xb46b('0x86')](_0x2b14ab[_0xb46b('0x37')][_0xb46b('0x83')]?{'message':_0xb46b('0x87'),'statusCode':_0x27d3c1[_0xb46b('0x84')]}:_0x27d3c1);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 67f1db1..952fed1 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 _0xa26f=['substring','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa26f,0x131));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfa26('0x0'));var logger=require('../../config/logger')(_0xfa26('0x1'));var moment=require(_0xfa26('0x2'));var BPromise=require(_0xfa26('0x3'));var rp=require(_0xfa26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa26('0x5'));var config=require(_0xfa26('0x6'));var attributes=require(_0xfa26('0x7'));var integrations=require(_0xfa26('0x8'));module['exports']=function(_0x67b820,_0x166206){return _0x67b820[_0xfa26('0x9')](_0xfa26('0xa'),attributes,{'tableName':_0xfa26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4709d2,_0x16227a,_0x20862a){if(_0x4709d2[_0xfa26('0xc')]('zone')||_0x4709d2[_0xfa26('0xc')](_0xfa26('0xd'))||_0x4709d2[_0xfa26('0xc')](_0xfa26('0xe'))||_0x4709d2[_0xfa26('0xc')](_0xfa26('0xf'))||_0x4709d2[_0xfa26('0xc')]('code')||_0x4709d2[_0xfa26('0xc')](_0xfa26('0x10'))){var _0x7e1809,_0x6f9a12;_0x7e1809=_0x4709d2[_0xfa26('0xd')];var _0x26f3e3=_0x7e1809[_0xfa26('0x11')](-0x1);if(_0x26f3e3==='/'||_0x26f3e3==='\x5c'||_0x26f3e3===':'){_0x7e1809=_0x7e1809['substring'](0x0,_0x7e1809[_0xfa26('0x12')](_0x26f3e3));}switch(_0x4709d2[_0xfa26('0x13')]){case'US':_0x6f9a12=_0xfa26('0x14');break;case'AU':_0x6f9a12=_0xfa26('0x15');break;case'IN':_0x6f9a12=_0xfa26('0x16');break;case'CN':_0x6f9a12=_0xfa26('0x17');break;default:_0x6f9a12=_0xfa26('0x18');break;}var _0x594342={'method':_0xfa26('0x19'),'uri':_0x6f9a12+_0xfa26('0x1a'),'form':{'grant_type':_0xfa26('0x1b'),'client_id':_0x4709d2[_0xfa26('0xe')],'client_secret':_0x4709d2[_0xfa26('0xf')],'redirect_uri':_0x4709d2[_0xfa26('0xd')],'code':_0x4709d2[_0xfa26('0x1c')]},'headers':{'Content-Type':_0xfa26('0x1d')}};return rp(_0x594342)[_0xfa26('0x1e')](function(_0x180e35){var _0x3420bc=JSON[_0xfa26('0x1f')](_0x180e35);if(_0x3420bc[_0xfa26('0x20')]){_0x4709d2[_0xfa26('0x21')]=_0x3420bc[_0xfa26('0x20')];logger['info'](util[_0xfa26('0x22')](_0xfa26('0x23'),_0x4709d2[_0xfa26('0x24')],_0x4709d2['id']));}else{logger['error'](util[_0xfa26('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4709d2['name'],_0x4709d2['id']),util[_0xfa26('0x25')](_0x3420bc,{'showHidden':![],'depth':null}));}return _0x20862a(null,_0x16227a);})['catch'](function(_0x1b2859){logger[_0xfa26('0x26')](util[_0xfa26('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4709d2[_0xfa26('0x24')],_0x4709d2['id']),util[_0xfa26('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x20862a(_0x1b2859);});}else{return _0x20862a(null,_0x16227a);}},'beforeUpdate':function(_0x3a70e8,_0x5958c3,_0x38c662){if(_0x3a70e8[_0xfa26('0xc')](_0xfa26('0x13'))||_0x3a70e8['changed'](_0xfa26('0xd'))||_0x3a70e8[_0xfa26('0xc')]('clientId')||_0x3a70e8[_0xfa26('0xc')](_0xfa26('0xf'))||_0x3a70e8[_0xfa26('0xc')](_0xfa26('0x1c'))||_0x3a70e8['changed'](_0xfa26('0x10'))){var _0x569868,_0x16baee;_0x569868=_0x3a70e8[_0xfa26('0xd')];var _0x10cef4=_0x569868[_0xfa26('0x11')](-0x1);if(_0x10cef4==='/'||_0x10cef4==='\x5c'||_0x10cef4===':'){_0x569868=_0x569868[_0xfa26('0x27')](0x0,_0x569868[_0xfa26('0x12')](_0x10cef4));}switch(_0x3a70e8[_0xfa26('0x13')]){case'US':_0x16baee=_0xfa26('0x14');break;case'AU':_0x16baee=_0xfa26('0x15');break;case'IN':_0x16baee=_0xfa26('0x16');break;case'CN':_0x16baee='https://accounts.zoho.com.cn';break;default:_0x16baee=_0xfa26('0x18');break;}var _0x3fcd4a={'method':'POST','uri':_0x16baee+'/oauth/v2/token','form':{'grant_type':_0xfa26('0x1b'),'client_id':_0x3a70e8[_0xfa26('0xe')],'client_secret':_0x3a70e8[_0xfa26('0xf')],'redirect_uri':_0x3a70e8[_0xfa26('0xd')],'code':_0x3a70e8['code']},'headers':{'Content-Type':_0xfa26('0x1d')}};return rp(_0x3fcd4a)[_0xfa26('0x1e')](function(_0x16a27e){var _0x3cc481=JSON[_0xfa26('0x1f')](_0x16a27e);if(_0x3cc481[_0xfa26('0x20')]){_0x3a70e8[_0xfa26('0x21')]=_0x3cc481[_0xfa26('0x20')];logger[_0xfa26('0x28')](util[_0xfa26('0x22')](_0xfa26('0x23'),_0x3a70e8['name'],_0x3a70e8['id']));}else{logger[_0xfa26('0x26')](util[_0xfa26('0x22')](_0xfa26('0x29'),_0x3a70e8[_0xfa26('0x24')],_0x3a70e8['id']),util[_0xfa26('0x25')](_0x3cc481,{'showHidden':![],'depth':null}));}return _0x38c662(null,_0x5958c3);})[_0xfa26('0x2a')](function(_0x40b591){logger[_0xfa26('0x26')](util[_0xfa26('0x22')](_0xfa26('0x29'),_0x3a70e8[_0xfa26('0x24')],_0x3a70e8['id']),util[_0xfa26('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x38c662(_0x40b591);});}else{return _0x38c662(null,_0x5958c3);}}}});}; \ No newline at end of file +var _0x1c59=['refreshToken','info','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','format','inspect','code','lastIndexOf','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token'];(function(_0x3b1630,_0x1043ad){var _0x1bffbf=function(_0x2decad){while(--_0x2decad){_0x3b1630['push'](_0x3b1630['shift']());}};_0x1bffbf(++_0x1043ad);}(_0x1c59,0x17b));var _0x91c5=function(_0x16f99e,_0x58867e){_0x16f99e=_0x16f99e-0x0;var _0x4a9e5f=_0x1c59[_0x16f99e];return _0x4a9e5f;};'use strict';var _=require('lodash');var util=require(_0x91c5('0x0'));var logger=require(_0x91c5('0x1'))(_0x91c5('0x2'));var moment=require(_0x91c5('0x3'));var BPromise=require(_0x91c5('0x4'));var rp=require(_0x91c5('0x5'));var fs=require('fs');var path=require(_0x91c5('0x6'));var rimraf=require(_0x91c5('0x7'));var config=require(_0x91c5('0x8'));var attributes=require(_0x91c5('0x9'));var integrations=require(_0x91c5('0xa'));module[_0x91c5('0xb')]=function(_0x260222,_0x5af57b){return _0x260222[_0x91c5('0xc')](_0x91c5('0xd'),attributes,{'tableName':_0x91c5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d6eb6,_0xb1c867,_0x25cf43){if(_0x4d6eb6['changed'](_0x91c5('0xf'))||_0x4d6eb6[_0x91c5('0x10')](_0x91c5('0x11'))||_0x4d6eb6[_0x91c5('0x10')](_0x91c5('0x12'))||_0x4d6eb6[_0x91c5('0x10')]('clientSecret')||_0x4d6eb6[_0x91c5('0x10')]('code')||_0x4d6eb6[_0x91c5('0x10')](_0x91c5('0x13'))){var _0x28d9b7,_0x49b33e;_0x28d9b7=_0x4d6eb6[_0x91c5('0x11')];var _0x360692=_0x28d9b7[_0x91c5('0x14')](-0x1);if(_0x360692==='/'||_0x360692==='\x5c'||_0x360692===':'){_0x28d9b7=_0x28d9b7[_0x91c5('0x15')](0x0,_0x28d9b7['lastIndexOf'](_0x360692));}switch(_0x4d6eb6['zone']){case'US':_0x49b33e=_0x91c5('0x16');break;case'AU':_0x49b33e=_0x91c5('0x17');break;case'IN':_0x49b33e=_0x91c5('0x18');break;case'CN':_0x49b33e=_0x91c5('0x19');break;default:_0x49b33e=_0x91c5('0x1a');break;}var _0x2f0460={'method':_0x91c5('0x1b'),'uri':_0x49b33e+_0x91c5('0x1c'),'form':{'grant_type':_0x91c5('0x1d'),'client_id':_0x4d6eb6[_0x91c5('0x12')],'client_secret':_0x4d6eb6[_0x91c5('0x1e')],'redirect_uri':_0x4d6eb6[_0x91c5('0x11')],'code':_0x4d6eb6['code']},'headers':{'Content-Type':_0x91c5('0x1f')}};return rp(_0x2f0460)[_0x91c5('0x20')](function(_0x53953f){var _0x52e229=JSON[_0x91c5('0x21')](_0x53953f);if(_0x52e229[_0x91c5('0x22')]){_0x4d6eb6[_0x91c5('0x23')]=_0x52e229[_0x91c5('0x22')];logger[_0x91c5('0x24')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4d6eb6[_0x91c5('0x25')],_0x4d6eb6['id']));}else{logger[_0x91c5('0x26')](util['format'](_0x91c5('0x27'),_0x4d6eb6[_0x91c5('0x25')],_0x4d6eb6['id']),util['inspect'](_0x52e229,{'showHidden':![],'depth':null}));}return _0x25cf43(null,_0xb1c867);})[_0x91c5('0x28')](function(_0x37f532){logger[_0x91c5('0x26')](util[_0x91c5('0x29')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4d6eb6[_0x91c5('0x25')],_0x4d6eb6['id']),util[_0x91c5('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x25cf43(_0x37f532);});}else{return _0x25cf43(null,_0xb1c867);}},'beforeUpdate':function(_0xa268ae,_0x1a1997,_0x56d202){if(_0xa268ae[_0x91c5('0x10')](_0x91c5('0xf'))||_0xa268ae[_0x91c5('0x10')](_0x91c5('0x11'))||_0xa268ae[_0x91c5('0x10')](_0x91c5('0x12'))||_0xa268ae[_0x91c5('0x10')](_0x91c5('0x1e'))||_0xa268ae[_0x91c5('0x10')](_0x91c5('0x2b'))||_0xa268ae[_0x91c5('0x10')](_0x91c5('0x13'))){var _0x55b7ac,_0x36b4b1;_0x55b7ac=_0xa268ae[_0x91c5('0x11')];var _0x9863ce=_0x55b7ac[_0x91c5('0x14')](-0x1);if(_0x9863ce==='/'||_0x9863ce==='\x5c'||_0x9863ce===':'){_0x55b7ac=_0x55b7ac[_0x91c5('0x15')](0x0,_0x55b7ac[_0x91c5('0x2c')](_0x9863ce));}switch(_0xa268ae[_0x91c5('0xf')]){case'US':_0x36b4b1='https://accounts.zoho.com';break;case'AU':_0x36b4b1='https://accounts.zoho.com.au';break;case'IN':_0x36b4b1=_0x91c5('0x18');break;case'CN':_0x36b4b1=_0x91c5('0x19');break;default:_0x36b4b1=_0x91c5('0x1a');break;}var _0x5b4be3={'method':_0x91c5('0x1b'),'uri':_0x36b4b1+_0x91c5('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0xa268ae[_0x91c5('0x12')],'client_secret':_0xa268ae['clientSecret'],'redirect_uri':_0xa268ae[_0x91c5('0x11')],'code':_0xa268ae['code']},'headers':{'Content-Type':_0x91c5('0x1f')}};return rp(_0x5b4be3)[_0x91c5('0x20')](function(_0x22d1e0){var _0x142e57=JSON[_0x91c5('0x21')](_0x22d1e0);if(_0x142e57[_0x91c5('0x22')]){_0xa268ae[_0x91c5('0x23')]=_0x142e57[_0x91c5('0x22')];logger[_0x91c5('0x24')](util[_0x91c5('0x29')](_0x91c5('0x2d'),_0xa268ae[_0x91c5('0x25')],_0xa268ae['id']));}else{logger['error'](util[_0x91c5('0x29')](_0x91c5('0x27'),_0xa268ae[_0x91c5('0x25')],_0xa268ae['id']),util[_0x91c5('0x2a')](_0x142e57,{'showHidden':![],'depth':null}));}return _0x56d202(null,_0x1a1997);})[_0x91c5('0x28')](function(_0x6c2d38){logger['error'](util[_0x91c5('0x29')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xa268ae[_0x91c5('0x25')],_0xa268ae['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x56d202(_0x6c2d38);});}else{return _0x56d202(null,_0x1a1997);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bd843fd..96d95f8 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 _0x3014=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','ShowZohoAccount','raw','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x5ad83e,_0xb3a929){var _0x1850a9=function(_0x3cb205){while(--_0x3cb205){_0x5ad83e['push'](_0x5ad83e['shift']());}};_0x1850a9(++_0xb3a929);}(_0x3014,0x1d7));var _0x4301=function(_0x3a7395,_0x1d8f1e){_0x3a7395=_0x3a7395-0x0;var _0x12453d=_0x3014[_0x3a7395];return _0x12453d;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var moment=require('moment');var BPromise=require(_0x4301('0x2'));var rs=require(_0x4301('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4301('0x4'));var logger=require(_0x4301('0x5'))(_0x4301('0x6'));var config=require(_0x4301('0x7'));var jayson=require(_0x4301('0x8'));var client=jayson[_0x4301('0x9')][_0x4301('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6e61,_0x5013c,_0x1dc855){return new BPromise(function(_0x337800,_0x4d5020){return client['request'](_0x3a6e61,_0x1dc855)[_0x4301('0xb')](function(_0x2d6581){logger['info'](_0x4301('0xc'),_0x5013c,_0x4301('0xd'));logger[_0x4301('0xe')](_0x4301('0xf'),_0x5013c,'request\x20sent',JSON[_0x4301('0x10')](_0x2d6581));if(_0x2d6581['error']){if(_0x2d6581[_0x4301('0x11')][_0x4301('0x12')]===0x1f4){logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x4d5020(_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);}logger[_0x4301('0x11')](_0x4301('0xc'),_0x5013c,_0x2d6581[_0x4301('0x11')][_0x4301('0x13')]);return _0x337800(_0x2d6581[_0x4301('0x11')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x5013c,_0x4301('0xd'));_0x337800(_0x2d6581[_0x4301('0x14')][_0x4301('0x13')]);}})[_0x4301('0x15')](function(_0x4da25c){logger['error'](_0x4301('0xc'),_0x5013c,_0x4da25c);_0x4d5020(_0x4da25c);});});}exports[_0x4301('0x16')]=function(_0x13b229){var _0x5cfa58=this;return new Promise(function(_0xa1cbea,_0x351815){return db[_0x4301('0x17')][_0x4301('0x18')]({'raw':_0x13b229[_0x4301('0x19')]?_0x13b229[_0x4301('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x13b229[_0x4301('0x19')]?_0x13b229[_0x4301('0x19')][_0x4301('0x1a')]||null:null,'attributes':_0x13b229['options']?_0x13b229[_0x4301('0x19')]['attributes']||null:null,'limit':_0x13b229[_0x4301('0x19')]?_0x13b229[_0x4301('0x19')][_0x4301('0x1b')]||null:null,'include':_0x13b229[_0x4301('0x19')]?_0x13b229['options'][_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x13b229['options'][_0x4301('0x1c')],function(_0x5d47d1){return{'model':db[_0x5d47d1[_0x4301('0x1e')]],'as':_0x5d47d1['as'],'attributes':_0x5d47d1[_0x4301('0x1f')],'include':_0x5d47d1[_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x5d47d1[_0x4301('0x1c')],function(_0x11fe82){return{'model':db[_0x11fe82[_0x4301('0x1e')]],'as':_0x11fe82['as'],'attributes':_0x11fe82[_0x4301('0x1f')],'include':_0x11fe82[_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x11fe82[_0x4301('0x1c')],function(_0x4a60d7){return{'model':db[_0x4a60d7[_0x4301('0x1e')]],'as':_0x4a60d7['as'],'attributes':_0x4a60d7[_0x4301('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4301('0xb')](function(_0xe752f0){logger['info'](_0x4301('0x16'),_0x13b229);logger[_0x4301('0xe')](_0x4301('0x16'),_0x13b229,JSON['stringify'](_0xe752f0));_0xa1cbea(_0xe752f0);})[_0x4301('0x15')](function(_0x10a967){logger['error'](_0x4301('0x16'),_0x10a967['message'],_0x13b229);_0x351815(_0x5cfa58[_0x4301('0x11')](0x1f4,_0x10a967[_0x4301('0x13')]));});});};exports[_0x4301('0x20')]=function(_0xebb79b){var _0x4a6a55=this;return new Promise(function(_0x2b4abd,_0x4ee156){return db[_0x4301('0x17')]['find']({'raw':_0xebb79b['options']?_0xebb79b[_0x4301('0x19')][_0x4301('0x21')]===undefined?!![]:![]:!![],'where':_0xebb79b[_0x4301('0x19')]?_0xebb79b[_0x4301('0x19')][_0x4301('0x1a')]||null:null,'attributes':_0xebb79b[_0x4301('0x19')]?_0xebb79b[_0x4301('0x19')]['attributes']||null:null,'include':_0xebb79b[_0x4301('0x19')]?_0xebb79b[_0x4301('0x19')][_0x4301('0x1c')]?_['map'](_0xebb79b['options']['include'],function(_0x861809){return{'model':db[_0x861809[_0x4301('0x1e')]],'as':_0x861809['as'],'attributes':_0x861809[_0x4301('0x1f')],'include':_0x861809['include']?_['map'](_0x861809['include'],function(_0x3d35b6){return{'model':db[_0x3d35b6[_0x4301('0x1e')]],'as':_0x3d35b6['as'],'attributes':_0x3d35b6[_0x4301('0x1f')],'include':_0x3d35b6[_0x4301('0x1c')]?_[_0x4301('0x1d')](_0x3d35b6[_0x4301('0x1c')],function(_0x1c3aef){return{'model':db[_0x1c3aef[_0x4301('0x1e')]],'as':_0x1c3aef['as'],'attributes':_0x1c3aef[_0x4301('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4301('0xb')](function(_0x380e73){logger['info'](_0x4301('0x20'),_0xebb79b);logger[_0x4301('0xe')]('ShowZohoAccount',_0xebb79b,JSON[_0x4301('0x10')](_0x380e73));_0x2b4abd(_0x380e73);})[_0x4301('0x15')](function(_0x5890e3){logger[_0x4301('0x11')](_0x4301('0x20'),_0x5890e3[_0x4301('0x13')],_0xebb79b);_0x4ee156(_0x4a6a55[_0x4301('0x11')](0x1f4,_0x5890e3[_0x4301('0x13')]));});});}; \ No newline at end of file +var _0xef4d=['request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xef4d,0x165));var _0xdef4=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xef4d[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var moment=require(_0xdef4('0x2'));var BPromise=require(_0xdef4('0x3'));var rs=require(_0xdef4('0x4'));var fs=require('fs');var Redis=require(_0xdef4('0x5'));var db=require(_0xdef4('0x6'))['db'];var utils=require(_0xdef4('0x7'));var logger=require(_0xdef4('0x8'))(_0xdef4('0x9'));var config=require(_0xdef4('0xa'));var jayson=require(_0xdef4('0xb'));var client=jayson[_0xdef4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468dcd,_0x3b875f,_0x2cebfd){return new BPromise(function(_0x1dc5c9,_0x525707){return client[_0xdef4('0xd')](_0x468dcd,_0x2cebfd)[_0xdef4('0xe')](function(_0x87d8a3){logger[_0xdef4('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));logger[_0xdef4('0x11')](_0xdef4('0x12'),_0x3b875f,_0xdef4('0x10'),JSON[_0xdef4('0x13')](_0x87d8a3));if(_0x87d8a3[_0xdef4('0x14')]){if(_0x87d8a3[_0xdef4('0x14')]['code']===0x1f4){logger[_0xdef4('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0x87d8a3['error'][_0xdef4('0x15')]);return _0x525707(_0x87d8a3['error'][_0xdef4('0x15')]);}logger['error'](_0xdef4('0x16'),_0x3b875f,_0x87d8a3[_0xdef4('0x14')][_0xdef4('0x15')]);return _0x1dc5c9(_0x87d8a3[_0xdef4('0x14')]['message']);}else{logger[_0xdef4('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));_0x1dc5c9(_0x87d8a3[_0xdef4('0x17')]['message']);}})[_0xdef4('0x18')](function(_0x27463d){logger[_0xdef4('0x14')](_0xdef4('0x16'),_0x3b875f,_0x27463d);_0x525707(_0x27463d);});});}exports['GetZohoAccount']=function(_0x377beb){var _0x3b3a4=this;return new Promise(function(_0x469178,_0x18d3a0){return db[_0xdef4('0x19')]['findAll']({'raw':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1b')]===undefined?!![]:![]:!![],'where':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1c')]||null:null,'attributes':_0x377beb['options']?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1d')]||null:null,'limit':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1e')]||null:null,'include':_0x377beb[_0xdef4('0x1a')]?_0x377beb['options'][_0xdef4('0x1f')]?_['map'](_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1f')],function(_0x35c401){return{'model':db[_0x35c401[_0xdef4('0x20')]],'as':_0x35c401['as'],'attributes':_0x35c401['attributes'],'include':_0x35c401[_0xdef4('0x1f')]?_[_0xdef4('0x21')](_0x35c401[_0xdef4('0x1f')],function(_0xf43627){return{'model':db[_0xf43627[_0xdef4('0x20')]],'as':_0xf43627['as'],'attributes':_0xf43627[_0xdef4('0x1d')],'include':_0xf43627[_0xdef4('0x1f')]?_[_0xdef4('0x21')](_0xf43627['include'],function(_0x3e770f){return{'model':db[_0x3e770f[_0xdef4('0x20')]],'as':_0x3e770f['as'],'attributes':_0x3e770f['attributes']};}):[]};}):[]};}):[]:[]})[_0xdef4('0xe')](function(_0x26718b){logger[_0xdef4('0xf')](_0xdef4('0x22'),_0x377beb);logger[_0xdef4('0x11')](_0xdef4('0x22'),_0x377beb,JSON['stringify'](_0x26718b));_0x469178(_0x26718b);})[_0xdef4('0x18')](function(_0x256165){logger['error'](_0xdef4('0x22'),_0x256165[_0xdef4('0x15')],_0x377beb);_0x18d3a0(_0x3b3a4[_0xdef4('0x14')](0x1f4,_0x256165[_0xdef4('0x15')]));});});};exports[_0xdef4('0x23')]=function(_0x2cadc4){var _0x2f0f33=this;return new Promise(function(_0x25fc2c,_0xe92978){return db[_0xdef4('0x19')][_0xdef4('0x24')]({'raw':_0x2cadc4['options']?_0x2cadc4['options'][_0xdef4('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4[_0xdef4('0x1a')]['where']||null:null,'attributes':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4[_0xdef4('0x1a')][_0xdef4('0x1d')]||null:null,'include':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4['options']['include']?_['map'](_0x2cadc4[_0xdef4('0x1a')][_0xdef4('0x1f')],function(_0x46d84a){return{'model':db[_0x46d84a[_0xdef4('0x20')]],'as':_0x46d84a['as'],'attributes':_0x46d84a[_0xdef4('0x1d')],'include':_0x46d84a['include']?_[_0xdef4('0x21')](_0x46d84a[_0xdef4('0x1f')],function(_0x46f3b2){return{'model':db[_0x46f3b2[_0xdef4('0x20')]],'as':_0x46f3b2['as'],'attributes':_0x46f3b2[_0xdef4('0x1d')],'include':_0x46f3b2['include']?_[_0xdef4('0x21')](_0x46f3b2[_0xdef4('0x1f')],function(_0x3c2028){return{'model':db[_0x3c2028['model']],'as':_0x3c2028['as'],'attributes':_0x3c2028[_0xdef4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5822fe){logger[_0xdef4('0xf')]('ShowZohoAccount',_0x2cadc4);logger[_0xdef4('0x11')](_0xdef4('0x23'),_0x2cadc4,JSON[_0xdef4('0x13')](_0x5822fe));_0x25fc2c(_0x5822fe);})[_0xdef4('0x18')](function(_0x133e0d){logger[_0xdef4('0x14')](_0xdef4('0x23'),_0x133e0d[_0xdef4('0x15')],_0x2cadc4);_0xe92978(_0x2f0f33['error'](0x1f4,_0x133e0d['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ffd9ba2..fd0bae7 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 _0xa76f=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa76f,0xfd));var _0xfa76=function(_0x333554,_0x3903a4){_0x333554=_0x333554-0x0;var _0x5d1ff1=_0xa76f[_0x333554];return _0x5d1ff1;};'use strict';var multer=require(_0xfa76('0x0'));var util=require('util');var path=require(_0xfa76('0x1'));var timeout=require(_0xfa76('0x2'));var express=require(_0xfa76('0x3'));var router=express[_0xfa76('0x4')]();var fs_extra=require(_0xfa76('0x5'));var auth=require(_0xfa76('0x6'));var interaction=require(_0xfa76('0x7'));var config=require(_0xfa76('0x8'));var controller=require(_0xfa76('0x9'));router[_0xfa76('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa76('0xb')]);router['get']('/:id',auth[_0xfa76('0xc')](),controller[_0xfa76('0xd')]);router[_0xfa76('0xa')](_0xfa76('0xe'),auth[_0xfa76('0xc')](),controller[_0xfa76('0xf')]);router[_0xfa76('0xa')](_0xfa76('0x10'),auth[_0xfa76('0xc')](),controller[_0xfa76('0x11')]);router[_0xfa76('0xa')](_0xfa76('0x12'),auth[_0xfa76('0xc')](),controller[_0xfa76('0x13')]);router[_0xfa76('0x14')]('/',auth[_0xfa76('0xc')](),controller['create']);router[_0xfa76('0x15')]('/:id',auth[_0xfa76('0xc')](),controller['update']);router['delete'](_0xfa76('0x16'),auth[_0xfa76('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe7e5=['/:id','show','/:id/fields','isAuthenticated','getFields','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index'];(function(_0x550b93,_0x30b98d){var _0x264b8f=function(_0x7381ad){while(--_0x7381ad){_0x550b93['push'](_0x550b93['shift']());}};_0x264b8f(++_0x30b98d);}(_0xe7e5,0x185));var _0x5e7e=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0xe7e5[_0x1e393b];return _0x3d0bfe;};'use strict';var multer=require(_0x5e7e('0x0'));var util=require(_0x5e7e('0x1'));var path=require('path');var timeout=require(_0x5e7e('0x2'));var express=require(_0x5e7e('0x3'));var router=express['Router']();var fs_extra=require(_0x5e7e('0x4'));var auth=require(_0x5e7e('0x5'));var interaction=require(_0x5e7e('0x6'));var config=require('../../config/environment');var controller=require(_0x5e7e('0x7'));router[_0x5e7e('0x8')]('/',auth['isAuthenticated'](),controller[_0x5e7e('0x9')]);router['get'](_0x5e7e('0xa'),auth['isAuthenticated'](),controller[_0x5e7e('0xb')]);router[_0x5e7e('0x8')](_0x5e7e('0xc'),auth[_0x5e7e('0xd')](),controller[_0x5e7e('0xe')]);router['get']('/:id/subjects',auth[_0x5e7e('0xd')](),controller['getSubjects']);router[_0x5e7e('0x8')]('/:id/descriptions',auth[_0x5e7e('0xd')](),controller['getDescriptions']);router[_0x5e7e('0xf')]('/',auth[_0x5e7e('0xd')](),controller[_0x5e7e('0x10')]);router[_0x5e7e('0x11')]('/:id',auth[_0x5e7e('0xd')](),controller[_0x5e7e('0x12')]);router[_0x5e7e('0x13')](_0x5e7e('0xa'),auth[_0x5e7e('0xd')](),controller[_0x5e7e('0x14')]);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 f720c67..e76bb46 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 _0x9d9d=['lead','contact','contact_lead','exports','STRING','ENUM'];(function(_0x58329b,_0x4436a6){var _0x51b75c=function(_0xba2e04){while(--_0xba2e04){_0x58329b['push'](_0x58329b['shift']());}};_0x51b75c(++_0x4436a6);}(_0x9d9d,0x129));var _0xd9d9=function(_0x15358d,_0x178994){_0x15358d=_0x15358d-0x0;var _0x17e893=_0x9d9d[_0x15358d];return _0x17e893;};'use strict';var Sequelize=require('sequelize');module[_0xd9d9('0x0')]={'name':{'type':Sequelize[_0xd9d9('0x1')]},'moduleCreate':{'type':Sequelize[_0xd9d9('0x2')](_0xd9d9('0x3'),_0xd9d9('0x4'),'nothing'),'defaultValue':_0xd9d9('0x3')},'moduleSearch':{'type':Sequelize[_0xd9d9('0x2')](_0xd9d9('0x5'),_0xd9d9('0x4'),_0xd9d9('0x3')),'defaultValue':_0xd9d9('0x5')},'description':{'type':Sequelize[_0xd9d9('0x1')]}}; \ No newline at end of file +var _0x778f=['contact','nothing','sequelize','STRING','ENUM','lead'];(function(_0xe3b7bb,_0x263836){var _0x2df486=function(_0x527828){while(--_0x527828){_0xe3b7bb['push'](_0xe3b7bb['shift']());}};_0x2df486(++_0x263836);}(_0x778f,0x134));var _0xf778=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x778f[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0xf778('0x0'));module['exports']={'name':{'type':Sequelize[_0xf778('0x1')]},'moduleCreate':{'type':Sequelize[_0xf778('0x2')](_0xf778('0x3'),_0xf778('0x4'),_0xf778('0x5')),'defaultValue':_0xf778('0x3')},'moduleSearch':{'type':Sequelize[_0xf778('0x2')]('contact_lead','contact',_0xf778('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xf778('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 98f5398..948182c 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 _0x03a4=['create','body','update','destroy','getFields','findOne','nolimit','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','end','error','stack','name','send','index','map','ZohoConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x12c26a,_0x162966){var _0xe98aec=function(_0x2e9f10){while(--_0x2e9f10){_0x12c26a['push'](_0x12c26a['shift']());}};_0xe98aec(++_0x162966);}(_0x03a4,0xb6));var _0x403a=function(_0xb045d2,_0x258206){_0xb045d2=_0xb045d2-0x0;var _0x577872=_0x03a4[_0xb045d2];return _0x577872;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x403a('0x0'));var zipdir=require(_0x403a('0x1'));var jsonpatch=require(_0x403a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x403a('0x3'));var Mustache=require(_0x403a('0x4'));var util=require('util');var path=require(_0x403a('0x5'));var sox=require(_0x403a('0x6'));var csv=require('to-csv');var ejs=require(_0x403a('0x7'));var fs=require('fs');var fs_extra=require(_0x403a('0x8'));var _=require(_0x403a('0x9'));var squel=require(_0x403a('0xa'));var crypto=require(_0x403a('0xb'));var jsforce=require(_0x403a('0xc'));var deskjs=require(_0x403a('0xd'));var toCsv=require(_0x403a('0xe'));var querystring=require(_0x403a('0xf'));var Papa=require(_0x403a('0x10'));var Redis=require(_0x403a('0x11'));var authService=require(_0x403a('0x12'));var qs=require(_0x403a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x403a('0x14'));var logger=require(_0x403a('0x15'))(_0x403a('0x16'));var utils=require(_0x403a('0x17'));var config=require(_0x403a('0x18'));var licenseUtil=require(_0x403a('0x19'));var db=require(_0x403a('0x1a'))['db'];function respondWithStatusCode(_0x652a2,_0x47e2f1){_0x47e2f1=_0x47e2f1||0xcc;return function(_0x477a7c){if(_0x477a7c){return _0x652a2[_0x403a('0x1b')](_0x47e2f1);}return _0x652a2[_0x403a('0x1c')](_0x47e2f1)['end']();};}function respondWithResult(_0x33244d,_0x3970f1){_0x3970f1=_0x3970f1||0xc8;return function(_0x5961bf){if(_0x5961bf){return _0x33244d[_0x403a('0x1c')](_0x3970f1)[_0x403a('0x1d')](_0x5961bf);}};}function respondWithFilteredResult(_0x387fc8,_0x3845a0){return function(_0x3457c7){if(_0x3457c7){var _0x1cfb9c=typeof _0x3845a0[_0x403a('0x1e')]==='undefined'&&typeof _0x3845a0[_0x403a('0x1f')]===_0x403a('0x20');var _0x304908=_0x3457c7[_0x403a('0x21')];var _0x213762=_0x1cfb9c?0x0:_0x3845a0[_0x403a('0x1e')];var _0x2d9b8a=_0x1cfb9c?_0x3457c7[_0x403a('0x21')]:_0x3845a0[_0x403a('0x1e')]+_0x3845a0[_0x403a('0x1f')];var _0x35e65f;if(_0x2d9b8a>=_0x304908){_0x2d9b8a=_0x304908;_0x35e65f=0xc8;}else{_0x35e65f=0xce;}_0x387fc8[_0x403a('0x1c')](_0x35e65f);return _0x387fc8[_0x403a('0x22')](_0x403a('0x23'),_0x213762+'-'+_0x2d9b8a+'/'+_0x304908)[_0x403a('0x1d')](_0x3457c7);}return null;};}function patchUpdates(_0x1b55ff){return function(_0x1625f3){try{jsonpatch[_0x403a('0x24')](_0x1625f3,_0x1b55ff,!![]);}catch(_0x7530d3){return BPromise['reject'](_0x7530d3);}return _0x1625f3[_0x403a('0x25')]();};}function saveUpdates(_0x5e2b0b,_0x4a829d){return function(_0x4bf7e9){if(_0x4bf7e9){return _0x4bf7e9['update'](_0x5e2b0b)[_0x403a('0x26')](function(_0x1bbcab){return _0x1bbcab;});}return null;};}function removeEntity(_0x115331,_0x3e86cb){return function(_0x1cd811){if(_0x1cd811){return _0x1cd811['destroy']()[_0x403a('0x26')](function(){_0x115331['status'](0xcc)[_0x403a('0x27')]();});}};}function handleEntityNotFound(_0x130dd8,_0x23e435){return function(_0x5dbcc6){if(!_0x5dbcc6){_0x130dd8[_0x403a('0x1b')](0x194);}return _0x5dbcc6;};}function handleError(_0x569e37,_0x4bfdbb){_0x4bfdbb=_0x4bfdbb||0x1f4;return function(_0x5c69e0){logger[_0x403a('0x28')](_0x5c69e0[_0x403a('0x29')]);if(_0x5c69e0[_0x403a('0x2a')]){delete _0x5c69e0[_0x403a('0x2a')];}_0x569e37[_0x403a('0x1c')](_0x4bfdbb)[_0x403a('0x2b')](_0x5c69e0);};}exports[_0x403a('0x2c')]=function(_0x403c2f,_0x13bd28){var _0x1fc543={},_0x447c3f={},_0x279d27={'count':0x0,'rows':[]};var _0xff78e7=_[_0x403a('0x2d')](db[_0x403a('0x2e')]['rawAttributes'],function(_0x788047){return{'name':_0x788047[_0x403a('0x2f')],'type':_0x788047[_0x403a('0x30')][_0x403a('0x31')]};});_0x447c3f[_0x403a('0x32')]=_['map'](_0xff78e7,_0x403a('0x2a'));_0x447c3f[_0x403a('0x33')]=_[_0x403a('0x34')](_0x403c2f[_0x403a('0x33')]);_0x447c3f[_0x403a('0x35')]=_[_0x403a('0x36')](_0x447c3f['model'],_0x447c3f['query']);_0x1fc543[_0x403a('0x37')]=_[_0x403a('0x36')](_0x447c3f[_0x403a('0x32')],qs[_0x403a('0x38')](_0x403c2f[_0x403a('0x33')]['fields']));_0x1fc543['attributes']=_0x1fc543[_0x403a('0x37')][_0x403a('0x39')]?_0x1fc543[_0x403a('0x37')]:_0x447c3f[_0x403a('0x32')];if(!_0x403c2f[_0x403a('0x33')][_0x403a('0x3a')]('nolimit')){_0x1fc543[_0x403a('0x1f')]=qs[_0x403a('0x1f')](_0x403c2f[_0x403a('0x33')][_0x403a('0x1f')]);_0x1fc543[_0x403a('0x1e')]=qs[_0x403a('0x1e')](_0x403c2f['query'][_0x403a('0x1e')]);}_0x1fc543[_0x403a('0x3b')]=qs[_0x403a('0x3c')](_0x403c2f[_0x403a('0x33')][_0x403a('0x3c')]);_0x1fc543['where']=qs[_0x403a('0x35')](_[_0x403a('0x3d')](_0x403c2f['query'],_0x447c3f[_0x403a('0x35')]),_0xff78e7);if(_0x403c2f[_0x403a('0x33')][_0x403a('0x3e')]){_0x1fc543[_0x403a('0x3f')]=_[_0x403a('0x40')](_0x1fc543['where'],{'$or':_['map'](_0xff78e7,function(_0xf70bf2){if(_0xf70bf2[_0x403a('0x30')]!==_0x403a('0x41')){var _0x10c487={};_0x10c487[_0xf70bf2[_0x403a('0x2a')]]={'$like':'%'+_0x403c2f['query'][_0x403a('0x3e')]+'%'};return _0x10c487;}})});}_0x1fc543=_[_0x403a('0x40')]({},_0x1fc543,_0x403c2f[_0x403a('0x42')]);var _0x49ad8c={'where':_0x1fc543[_0x403a('0x3f')]};return db[_0x403a('0x2e')][_0x403a('0x21')](_0x49ad8c)['then'](function(_0x452e00){_0x279d27['count']=_0x452e00;if(_0x403c2f[_0x403a('0x33')][_0x403a('0x43')]){_0x1fc543[_0x403a('0x44')]=[{'all':!![]}];}return db[_0x403a('0x2e')][_0x403a('0x45')](_0x1fc543);})[_0x403a('0x26')](function(_0x302471){_0x279d27[_0x403a('0x46')]=_0x302471;return _0x279d27;})[_0x403a('0x26')](respondWithFilteredResult(_0x13bd28,_0x1fc543))[_0x403a('0x47')](handleError(_0x13bd28,null));};exports[_0x403a('0x48')]=function(_0x4b06e6,_0x50da1a){var _0x599074={'raw':![],'where':{'id':_0x4b06e6[_0x403a('0x49')]['id']}},_0x1c9afe={};_0x1c9afe[_0x403a('0x32')]=_[_0x403a('0x34')](db[_0x403a('0x2e')][_0x403a('0x4a')]);_0x1c9afe[_0x403a('0x33')]=_[_0x403a('0x34')](_0x4b06e6[_0x403a('0x33')]);_0x1c9afe[_0x403a('0x35')]=_[_0x403a('0x36')](_0x1c9afe[_0x403a('0x32')],_0x1c9afe[_0x403a('0x33')]);_0x599074[_0x403a('0x37')]=_[_0x403a('0x36')](_0x1c9afe['model'],qs['fields'](_0x4b06e6[_0x403a('0x33')][_0x403a('0x38')]));_0x599074[_0x403a('0x37')]=_0x599074['attributes'][_0x403a('0x39')]?_0x599074['attributes']:_0x1c9afe[_0x403a('0x32')];if(_0x4b06e6[_0x403a('0x33')][_0x403a('0x43')]){_0x599074['include']=[{'all':!![]}];}_0x599074=_[_0x403a('0x40')]({},_0x599074,_0x4b06e6[_0x403a('0x42')]);return db[_0x403a('0x2e')][_0x403a('0x4b')](_0x599074)[_0x403a('0x26')](handleEntityNotFound(_0x50da1a,null))[_0x403a('0x26')](respondWithResult(_0x50da1a,null))[_0x403a('0x47')](handleError(_0x50da1a,null));};exports['create']=function(_0x485610,_0x50c784){return db[_0x403a('0x2e')][_0x403a('0x4c')](_0x485610[_0x403a('0x4d')],{})[_0x403a('0x26')](respondWithResult(_0x50c784,0xc9))[_0x403a('0x47')](handleError(_0x50c784,null));};exports[_0x403a('0x4e')]=function(_0x3e34d0,_0x49ea19){if(_0x3e34d0[_0x403a('0x4d')]['id']){delete _0x3e34d0[_0x403a('0x4d')]['id'];}return db['ZohoConfiguration'][_0x403a('0x4b')]({'where':{'id':_0x3e34d0['params']['id']}})[_0x403a('0x26')](handleEntityNotFound(_0x49ea19,null))['then'](saveUpdates(_0x3e34d0[_0x403a('0x4d')],null))[_0x403a('0x26')](respondWithResult(_0x49ea19,null))[_0x403a('0x47')](handleError(_0x49ea19,null));};exports[_0x403a('0x4f')]=function(_0x34897e,_0x4a3f5d){return db['ZohoConfiguration'][_0x403a('0x4b')]({'where':{'id':_0x34897e[_0x403a('0x49')]['id']}})[_0x403a('0x26')](handleEntityNotFound(_0x4a3f5d,null))['then'](removeEntity(_0x4a3f5d,null))[_0x403a('0x47')](handleError(_0x4a3f5d,null));};exports[_0x403a('0x50')]=function(_0x52e89e,_0x44b49a,_0x1d11cc){var _0x19227d={};var _0x2b8d83={};var _0x16b979;var _0x37996c;return db['ZohoConfiguration'][_0x403a('0x51')]({'where':{'id':_0x52e89e[_0x403a('0x49')]['id']}})[_0x403a('0x26')](handleEntityNotFound(_0x44b49a,null))[_0x403a('0x26')](function(_0x24a24f){if(_0x24a24f){_0x16b979=_0x24a24f;_0x2b8d83[_0x403a('0x32')]=_['keys'](db['ZohoField'][_0x403a('0x4a')]);_0x2b8d83['query']=_[_0x403a('0x34')](_0x52e89e[_0x403a('0x33')]);_0x2b8d83[_0x403a('0x35')]=_[_0x403a('0x36')](_0x2b8d83[_0x403a('0x32')],_0x2b8d83[_0x403a('0x33')]);_0x19227d[_0x403a('0x37')]=_['intersection'](_0x2b8d83['model'],qs['fields'](_0x52e89e[_0x403a('0x33')][_0x403a('0x38')]));_0x19227d[_0x403a('0x37')]=_0x19227d[_0x403a('0x37')][_0x403a('0x39')]?_0x19227d[_0x403a('0x37')]:_0x2b8d83[_0x403a('0x32')];_0x19227d[_0x403a('0x3b')]=qs[_0x403a('0x3c')](_0x52e89e[_0x403a('0x33')][_0x403a('0x3c')]);_0x19227d['where']=qs[_0x403a('0x35')](_[_0x403a('0x3d')](_0x52e89e['query'],_0x2b8d83[_0x403a('0x35')]));if(_0x52e89e['query'][_0x403a('0x3e')]){_0x19227d[_0x403a('0x3f')]=_[_0x403a('0x40')](_0x19227d[_0x403a('0x3f')],{'$or':_['map'](_0x19227d[_0x403a('0x37')],function(_0x382dbe){var _0x177604={};_0x177604[_0x382dbe]={'$like':'%'+_0x52e89e[_0x403a('0x33')][_0x403a('0x3e')]+'%'};return _0x177604;})});}_0x19227d=_[_0x403a('0x40')]({},_0x19227d,_0x52e89e[_0x403a('0x42')]);return _0x16b979[_0x403a('0x50')](_0x19227d);}})[_0x403a('0x26')](function(_0x1157cf){if(_0x1157cf){_0x37996c=_0x1157cf['length'];if(!_0x52e89e[_0x403a('0x33')][_0x403a('0x3a')](_0x403a('0x52'))){_0x19227d['limit']=qs['limit'](_0x52e89e[_0x403a('0x33')]['limit']);_0x19227d['offset']=qs['offset'](_0x52e89e[_0x403a('0x33')][_0x403a('0x1e')]);}return _0x16b979['getFields'](_0x19227d);}})[_0x403a('0x26')](function(_0xedf809){if(_0xedf809){return _0xedf809?{'count':_0x37996c,'rows':_0xedf809}:null;}})[_0x403a('0x26')](respondWithResult(_0x44b49a,null))['catch'](handleError(_0x44b49a,null));};exports[_0x403a('0x53')]=function(_0x4767ba,_0xc7aae9,_0x5a24a9){var _0x64483f={};var _0x335557={};var _0x312635;var _0x57df82;return db[_0x403a('0x2e')]['findOne']({'where':{'id':_0x4767ba[_0x403a('0x49')]['id']}})[_0x403a('0x26')](handleEntityNotFound(_0xc7aae9,null))[_0x403a('0x26')](function(_0x3d8346){if(_0x3d8346){_0x312635=_0x3d8346;_0x335557[_0x403a('0x32')]=_[_0x403a('0x34')](db[_0x403a('0x54')]['rawAttributes']);_0x335557[_0x403a('0x33')]=_['keys'](_0x4767ba[_0x403a('0x33')]);_0x335557[_0x403a('0x35')]=_['intersection'](_0x335557[_0x403a('0x32')],_0x335557[_0x403a('0x33')]);_0x64483f[_0x403a('0x37')]=_[_0x403a('0x36')](_0x335557['model'],qs[_0x403a('0x38')](_0x4767ba[_0x403a('0x33')][_0x403a('0x38')]));_0x64483f['attributes']=_0x64483f['attributes'][_0x403a('0x39')]?_0x64483f['attributes']:_0x335557[_0x403a('0x32')];_0x64483f[_0x403a('0x3b')]=qs[_0x403a('0x3c')](_0x4767ba[_0x403a('0x33')][_0x403a('0x3c')]);_0x64483f[_0x403a('0x3f')]=qs['filters'](_['pick'](_0x4767ba['query'],_0x335557[_0x403a('0x35')]));if(_0x4767ba[_0x403a('0x33')][_0x403a('0x3e')]){_0x64483f['where']=_[_0x403a('0x40')](_0x64483f[_0x403a('0x3f')],{'$or':_['map'](_0x64483f[_0x403a('0x37')],function(_0x4949db){var _0x45fd57={};_0x45fd57[_0x4949db]={'$like':'%'+_0x4767ba[_0x403a('0x33')]['filter']+'%'};return _0x45fd57;})});}_0x64483f=_[_0x403a('0x40')]({},_0x64483f,_0x4767ba[_0x403a('0x42')]);return _0x312635[_0x403a('0x53')](_0x64483f);}})['then'](function(_0x24aa7b){if(_0x24aa7b){_0x57df82=_0x24aa7b[_0x403a('0x39')];if(!_0x4767ba['query'][_0x403a('0x3a')](_0x403a('0x52'))){_0x64483f[_0x403a('0x1f')]=qs[_0x403a('0x1f')](_0x4767ba[_0x403a('0x33')]['limit']);_0x64483f['offset']=qs['offset'](_0x4767ba[_0x403a('0x33')][_0x403a('0x1e')]);}return _0x312635[_0x403a('0x53')](_0x64483f);}})['then'](function(_0x111a93){if(_0x111a93){return _0x111a93?{'count':_0x57df82,'rows':_0x111a93}:null;}})['then'](respondWithResult(_0xc7aae9,null))['catch'](handleError(_0xc7aae9,null));};exports[_0x403a('0x55')]=function(_0x9b2b8e,_0xd189e1,_0x38b1ee){var _0x501488={};var _0x4af762={};var _0x170be3;var _0x2031d3;return db['ZohoConfiguration'][_0x403a('0x51')]({'where':{'id':_0x9b2b8e[_0x403a('0x49')]['id']}})[_0x403a('0x26')](handleEntityNotFound(_0xd189e1,null))[_0x403a('0x26')](function(_0x43f585){if(_0x43f585){_0x170be3=_0x43f585;_0x4af762[_0x403a('0x32')]=_[_0x403a('0x34')](db[_0x403a('0x54')][_0x403a('0x4a')]);_0x4af762[_0x403a('0x33')]=_['keys'](_0x9b2b8e['query']);_0x4af762[_0x403a('0x35')]=_['intersection'](_0x4af762[_0x403a('0x32')],_0x4af762['query']);_0x501488[_0x403a('0x37')]=_['intersection'](_0x4af762[_0x403a('0x32')],qs['fields'](_0x9b2b8e[_0x403a('0x33')][_0x403a('0x38')]));_0x501488[_0x403a('0x37')]=_0x501488[_0x403a('0x37')][_0x403a('0x39')]?_0x501488[_0x403a('0x37')]:_0x4af762[_0x403a('0x32')];_0x501488['order']=qs[_0x403a('0x3c')](_0x9b2b8e[_0x403a('0x33')][_0x403a('0x3c')]);_0x501488[_0x403a('0x3f')]=qs[_0x403a('0x35')](_[_0x403a('0x3d')](_0x9b2b8e['query'],_0x4af762[_0x403a('0x35')]));if(_0x9b2b8e[_0x403a('0x33')][_0x403a('0x3e')]){_0x501488[_0x403a('0x3f')]=_['merge'](_0x501488['where'],{'$or':_[_0x403a('0x2d')](_0x501488['attributes'],function(_0xd5e485){var _0x4f7544={};_0x4f7544[_0xd5e485]={'$like':'%'+_0x9b2b8e[_0x403a('0x33')][_0x403a('0x3e')]+'%'};return _0x4f7544;})});}_0x501488=_[_0x403a('0x40')]({},_0x501488,_0x9b2b8e[_0x403a('0x42')]);return _0x170be3[_0x403a('0x55')](_0x501488);}})[_0x403a('0x26')](function(_0x21b53c){if(_0x21b53c){_0x2031d3=_0x21b53c[_0x403a('0x39')];if(!_0x9b2b8e[_0x403a('0x33')]['hasOwnProperty'](_0x403a('0x52'))){_0x501488['limit']=qs[_0x403a('0x1f')](_0x9b2b8e[_0x403a('0x33')]['limit']);_0x501488[_0x403a('0x1e')]=qs['offset'](_0x9b2b8e[_0x403a('0x33')][_0x403a('0x1e')]);}return _0x170be3[_0x403a('0x55')](_0x501488);}})['then'](function(_0x45e746){if(_0x45e746){return _0x45e746?{'count':_0x2031d3,'rows':_0x45e746}:null;}})[_0x403a('0x26')](respondWithResult(_0xd189e1,null))[_0x403a('0x47')](handleError(_0xd189e1,null));}; \ No newline at end of file +var _0xe00b=['show','length','options','find','catch','create','body','params','getFields','ZohoField','sort','pick','findOne','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x53c9a8,_0x5f3e3f){var _0x54b73a=function(_0x280408){while(--_0x280408){_0x53c9a8['push'](_0x53c9a8['shift']());}};_0x54b73a(++_0x5f3e3f);}(_0xe00b,0x103));var _0xbe00=function(_0x2d2ccc,_0x30f2fe){_0x2d2ccc=_0x2d2ccc-0x0;var _0x54dc55=_0xe00b[_0x2d2ccc];return _0x54dc55;};'use strict';var emlformat=require(_0xbe00('0x0'));var rimraf=require(_0xbe00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe00('0x2'));var rp=require('request-promise');var moment=require(_0xbe00('0x3'));var BPromise=require(_0xbe00('0x4'));var Mustache=require(_0xbe00('0x5'));var util=require(_0xbe00('0x6'));var path=require('path');var sox=require(_0xbe00('0x7'));var csv=require(_0xbe00('0x8'));var ejs=require(_0xbe00('0x9'));var fs=require('fs');var fs_extra=require(_0xbe00('0xa'));var _=require(_0xbe00('0xb'));var squel=require('squel');var crypto=require(_0xbe00('0xc'));var jsforce=require(_0xbe00('0xd'));var deskjs=require(_0xbe00('0xe'));var toCsv=require(_0xbe00('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbe00('0xf'));var authService=require(_0xbe00('0x10'));var qs=require(_0xbe00('0x11'));var as=require(_0xbe00('0x12'));var hardwareService=require(_0xbe00('0x13'));var logger=require(_0xbe00('0x14'))(_0xbe00('0x15'));var utils=require(_0xbe00('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbe00('0x17'))['db'];function respondWithStatusCode(_0x3e5d6f,_0x428211){_0x428211=_0x428211||0xcc;return function(_0x1a9769){if(_0x1a9769){return _0x3e5d6f[_0xbe00('0x18')](_0x428211);}return _0x3e5d6f[_0xbe00('0x19')](_0x428211)[_0xbe00('0x1a')]();};}function respondWithResult(_0x3bf3fc,_0x54a242){_0x54a242=_0x54a242||0xc8;return function(_0x47ea33){if(_0x47ea33){return _0x3bf3fc[_0xbe00('0x19')](_0x54a242)[_0xbe00('0x1b')](_0x47ea33);}};}function respondWithFilteredResult(_0x3cbce3,_0x3e1fec){return function(_0x2db50b){if(_0x2db50b){var _0x35ba38=typeof _0x3e1fec[_0xbe00('0x1c')]==='undefined'&&typeof _0x3e1fec[_0xbe00('0x1d')]===_0xbe00('0x1e');var _0x556cce=_0x2db50b[_0xbe00('0x1f')];var _0x54129a=_0x35ba38?0x0:_0x3e1fec[_0xbe00('0x1c')];var _0x1bb5ee=_0x35ba38?_0x2db50b['count']:_0x3e1fec[_0xbe00('0x1c')]+_0x3e1fec[_0xbe00('0x1d')];var _0x4f1c29;if(_0x1bb5ee>=_0x556cce){_0x1bb5ee=_0x556cce;_0x4f1c29=0xc8;}else{_0x4f1c29=0xce;}_0x3cbce3[_0xbe00('0x19')](_0x4f1c29);return _0x3cbce3['set'](_0xbe00('0x20'),_0x54129a+'-'+_0x1bb5ee+'/'+_0x556cce)[_0xbe00('0x1b')](_0x2db50b);}return null;};}function patchUpdates(_0x437e05){return function(_0x2f6835){try{jsonpatch[_0xbe00('0x21')](_0x2f6835,_0x437e05,!![]);}catch(_0x27202b){return BPromise[_0xbe00('0x22')](_0x27202b);}return _0x2f6835['save']();};}function saveUpdates(_0x2f682f,_0x8866d4){return function(_0x399b1e){if(_0x399b1e){return _0x399b1e[_0xbe00('0x23')](_0x2f682f)[_0xbe00('0x24')](function(_0x506c40){return _0x506c40;});}return null;};}function removeEntity(_0x4277e6,_0x21149f){return function(_0x17d2d7){if(_0x17d2d7){return _0x17d2d7[_0xbe00('0x25')]()['then'](function(){_0x4277e6[_0xbe00('0x19')](0xcc)[_0xbe00('0x1a')]();});}};}function handleEntityNotFound(_0x984f5a,_0x8aad3c){return function(_0x2c0e01){if(!_0x2c0e01){_0x984f5a['sendStatus'](0x194);}return _0x2c0e01;};}function handleError(_0x1c2134,_0x45f3ab){_0x45f3ab=_0x45f3ab||0x1f4;return function(_0x3b0243){logger[_0xbe00('0x26')](_0x3b0243['stack']);if(_0x3b0243[_0xbe00('0x27')]){delete _0x3b0243[_0xbe00('0x27')];}_0x1c2134[_0xbe00('0x19')](_0x45f3ab)[_0xbe00('0x28')](_0x3b0243);};}exports[_0xbe00('0x29')]=function(_0x46d0ef,_0x4b31c4){var _0x5dfd52={},_0x2a9106={},_0x140315={'count':0x0,'rows':[]};var _0x571860=_[_0xbe00('0x2a')](db[_0xbe00('0x2b')][_0xbe00('0x2c')],function(_0x18de66){return{'name':_0x18de66[_0xbe00('0x2d')],'type':_0x18de66[_0xbe00('0x2e')][_0xbe00('0x2f')]};});_0x2a9106[_0xbe00('0x30')]=_[_0xbe00('0x2a')](_0x571860,_0xbe00('0x27'));_0x2a9106[_0xbe00('0x31')]=_[_0xbe00('0x32')](_0x46d0ef[_0xbe00('0x31')]);_0x2a9106[_0xbe00('0x33')]=_[_0xbe00('0x34')](_0x2a9106[_0xbe00('0x30')],_0x2a9106[_0xbe00('0x31')]);_0x5dfd52[_0xbe00('0x35')]=_[_0xbe00('0x34')](_0x2a9106[_0xbe00('0x30')],qs[_0xbe00('0x36')](_0x46d0ef['query']['fields']));_0x5dfd52['attributes']=_0x5dfd52[_0xbe00('0x35')]['length']?_0x5dfd52[_0xbe00('0x35')]:_0x2a9106[_0xbe00('0x30')];if(!_0x46d0ef['query']['hasOwnProperty'](_0xbe00('0x37'))){_0x5dfd52['limit']=qs[_0xbe00('0x1d')](_0x46d0ef[_0xbe00('0x31')][_0xbe00('0x1d')]);_0x5dfd52[_0xbe00('0x1c')]=qs[_0xbe00('0x1c')](_0x46d0ef['query'][_0xbe00('0x1c')]);}_0x5dfd52[_0xbe00('0x38')]=qs['sort'](_0x46d0ef['query']['sort']);_0x5dfd52[_0xbe00('0x39')]=qs[_0xbe00('0x33')](_['pick'](_0x46d0ef[_0xbe00('0x31')],_0x2a9106[_0xbe00('0x33')]),_0x571860);if(_0x46d0ef[_0xbe00('0x31')][_0xbe00('0x3a')]){_0x5dfd52[_0xbe00('0x39')]=_[_0xbe00('0x3b')](_0x5dfd52[_0xbe00('0x39')],{'$or':_[_0xbe00('0x2a')](_0x571860,function(_0x573436){if(_0x573436[_0xbe00('0x2e')]!==_0xbe00('0x3c')){var _0x33706d={};_0x33706d[_0x573436['name']]={'$like':'%'+_0x46d0ef['query'][_0xbe00('0x3a')]+'%'};return _0x33706d;}})});}_0x5dfd52=_[_0xbe00('0x3b')]({},_0x5dfd52,_0x46d0ef['options']);var _0x4bf2c1={'where':_0x5dfd52[_0xbe00('0x39')]};return db[_0xbe00('0x2b')][_0xbe00('0x1f')](_0x4bf2c1)[_0xbe00('0x24')](function(_0x592285){_0x140315['count']=_0x592285;if(_0x46d0ef['query'][_0xbe00('0x3d')]){_0x5dfd52[_0xbe00('0x3e')]=[{'all':!![]}];}return db[_0xbe00('0x2b')][_0xbe00('0x3f')](_0x5dfd52);})[_0xbe00('0x24')](function(_0x16258f){_0x140315[_0xbe00('0x40')]=_0x16258f;return _0x140315;})['then'](respondWithFilteredResult(_0x4b31c4,_0x5dfd52))['catch'](handleError(_0x4b31c4,null));};exports[_0xbe00('0x41')]=function(_0x5326a6,_0x2a9ccd){var _0x213534={'raw':![],'where':{'id':_0x5326a6['params']['id']}},_0x5b20ab={};_0x5b20ab[_0xbe00('0x30')]=_['keys'](db[_0xbe00('0x2b')][_0xbe00('0x2c')]);_0x5b20ab['query']=_[_0xbe00('0x32')](_0x5326a6['query']);_0x5b20ab[_0xbe00('0x33')]=_[_0xbe00('0x34')](_0x5b20ab[_0xbe00('0x30')],_0x5b20ab[_0xbe00('0x31')]);_0x213534[_0xbe00('0x35')]=_[_0xbe00('0x34')](_0x5b20ab[_0xbe00('0x30')],qs[_0xbe00('0x36')](_0x5326a6[_0xbe00('0x31')][_0xbe00('0x36')]));_0x213534['attributes']=_0x213534[_0xbe00('0x35')][_0xbe00('0x42')]?_0x213534['attributes']:_0x5b20ab[_0xbe00('0x30')];if(_0x5326a6[_0xbe00('0x31')][_0xbe00('0x3d')]){_0x213534[_0xbe00('0x3e')]=[{'all':!![]}];}_0x213534=_[_0xbe00('0x3b')]({},_0x213534,_0x5326a6[_0xbe00('0x43')]);return db[_0xbe00('0x2b')][_0xbe00('0x44')](_0x213534)[_0xbe00('0x24')](handleEntityNotFound(_0x2a9ccd,null))['then'](respondWithResult(_0x2a9ccd,null))[_0xbe00('0x45')](handleError(_0x2a9ccd,null));};exports['create']=function(_0x5cb757,_0x444598){return db['ZohoConfiguration'][_0xbe00('0x46')](_0x5cb757[_0xbe00('0x47')],{})[_0xbe00('0x24')](respondWithResult(_0x444598,0xc9))[_0xbe00('0x45')](handleError(_0x444598,null));};exports[_0xbe00('0x23')]=function(_0x2f3aa0,_0x4df01a){if(_0x2f3aa0[_0xbe00('0x47')]['id']){delete _0x2f3aa0[_0xbe00('0x47')]['id'];}return db[_0xbe00('0x2b')][_0xbe00('0x44')]({'where':{'id':_0x2f3aa0['params']['id']}})['then'](handleEntityNotFound(_0x4df01a,null))[_0xbe00('0x24')](saveUpdates(_0x2f3aa0[_0xbe00('0x47')],null))[_0xbe00('0x24')](respondWithResult(_0x4df01a,null))[_0xbe00('0x45')](handleError(_0x4df01a,null));};exports['destroy']=function(_0x325354,_0x496863){return db['ZohoConfiguration'][_0xbe00('0x44')]({'where':{'id':_0x325354[_0xbe00('0x48')]['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x496863,null))['then'](removeEntity(_0x496863,null))['catch'](handleError(_0x496863,null));};exports[_0xbe00('0x49')]=function(_0x363361,_0x5dbb20,_0x2ba9ae){var _0x3c98ee={};var _0x112c24={};var _0x50dbb4;var _0x10d72c;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x363361['params']['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x5dbb20,null))[_0xbe00('0x24')](function(_0x80662c){if(_0x80662c){_0x50dbb4=_0x80662c;_0x112c24[_0xbe00('0x30')]=_[_0xbe00('0x32')](db[_0xbe00('0x4a')][_0xbe00('0x2c')]);_0x112c24[_0xbe00('0x31')]=_[_0xbe00('0x32')](_0x363361[_0xbe00('0x31')]);_0x112c24[_0xbe00('0x33')]=_[_0xbe00('0x34')](_0x112c24[_0xbe00('0x30')],_0x112c24[_0xbe00('0x31')]);_0x3c98ee[_0xbe00('0x35')]=_[_0xbe00('0x34')](_0x112c24['model'],qs[_0xbe00('0x36')](_0x363361[_0xbe00('0x31')][_0xbe00('0x36')]));_0x3c98ee[_0xbe00('0x35')]=_0x3c98ee[_0xbe00('0x35')]['length']?_0x3c98ee[_0xbe00('0x35')]:_0x112c24[_0xbe00('0x30')];_0x3c98ee[_0xbe00('0x38')]=qs[_0xbe00('0x4b')](_0x363361[_0xbe00('0x31')]['sort']);_0x3c98ee['where']=qs[_0xbe00('0x33')](_[_0xbe00('0x4c')](_0x363361[_0xbe00('0x31')],_0x112c24[_0xbe00('0x33')]));if(_0x363361[_0xbe00('0x31')][_0xbe00('0x3a')]){_0x3c98ee['where']=_['merge'](_0x3c98ee[_0xbe00('0x39')],{'$or':_[_0xbe00('0x2a')](_0x3c98ee['attributes'],function(_0x58d614){var _0x20eff7={};_0x20eff7[_0x58d614]={'$like':'%'+_0x363361[_0xbe00('0x31')][_0xbe00('0x3a')]+'%'};return _0x20eff7;})});}_0x3c98ee=_[_0xbe00('0x3b')]({},_0x3c98ee,_0x363361[_0xbe00('0x43')]);return _0x50dbb4[_0xbe00('0x49')](_0x3c98ee);}})[_0xbe00('0x24')](function(_0x1bb899){if(_0x1bb899){_0x10d72c=_0x1bb899['length'];if(!_0x363361[_0xbe00('0x31')]['hasOwnProperty']('nolimit')){_0x3c98ee[_0xbe00('0x1d')]=qs[_0xbe00('0x1d')](_0x363361[_0xbe00('0x31')][_0xbe00('0x1d')]);_0x3c98ee[_0xbe00('0x1c')]=qs[_0xbe00('0x1c')](_0x363361[_0xbe00('0x31')]['offset']);}return _0x50dbb4[_0xbe00('0x49')](_0x3c98ee);}})[_0xbe00('0x24')](function(_0x43da96){if(_0x43da96){return _0x43da96?{'count':_0x10d72c,'rows':_0x43da96}:null;}})[_0xbe00('0x24')](respondWithResult(_0x5dbb20,null))[_0xbe00('0x45')](handleError(_0x5dbb20,null));};exports['getSubjects']=function(_0x2e54f2,_0x2d8331,_0x155be5){var _0x888a52={};var _0x2dedc7={};var _0x7c479f;var _0x425f3d;return db[_0xbe00('0x2b')][_0xbe00('0x4d')]({'where':{'id':_0x2e54f2[_0xbe00('0x48')]['id']}})[_0xbe00('0x24')](handleEntityNotFound(_0x2d8331,null))[_0xbe00('0x24')](function(_0x58f784){if(_0x58f784){_0x7c479f=_0x58f784;_0x2dedc7[_0xbe00('0x30')]=_[_0xbe00('0x32')](db[_0xbe00('0x4a')][_0xbe00('0x2c')]);_0x2dedc7['query']=_['keys'](_0x2e54f2[_0xbe00('0x31')]);_0x2dedc7[_0xbe00('0x33')]=_[_0xbe00('0x34')](_0x2dedc7['model'],_0x2dedc7[_0xbe00('0x31')]);_0x888a52['attributes']=_['intersection'](_0x2dedc7[_0xbe00('0x30')],qs[_0xbe00('0x36')](_0x2e54f2[_0xbe00('0x31')][_0xbe00('0x36')]));_0x888a52[_0xbe00('0x35')]=_0x888a52['attributes'][_0xbe00('0x42')]?_0x888a52[_0xbe00('0x35')]:_0x2dedc7[_0xbe00('0x30')];_0x888a52[_0xbe00('0x38')]=qs['sort'](_0x2e54f2[_0xbe00('0x31')][_0xbe00('0x4b')]);_0x888a52[_0xbe00('0x39')]=qs[_0xbe00('0x33')](_['pick'](_0x2e54f2[_0xbe00('0x31')],_0x2dedc7['filters']));if(_0x2e54f2['query'][_0xbe00('0x3a')]){_0x888a52[_0xbe00('0x39')]=_[_0xbe00('0x3b')](_0x888a52[_0xbe00('0x39')],{'$or':_[_0xbe00('0x2a')](_0x888a52['attributes'],function(_0xd5633e){var _0x2650e3={};_0x2650e3[_0xd5633e]={'$like':'%'+_0x2e54f2[_0xbe00('0x31')][_0xbe00('0x3a')]+'%'};return _0x2650e3;})});}_0x888a52=_[_0xbe00('0x3b')]({},_0x888a52,_0x2e54f2[_0xbe00('0x43')]);return _0x7c479f[_0xbe00('0x4e')](_0x888a52);}})[_0xbe00('0x24')](function(_0x5f47be){if(_0x5f47be){_0x425f3d=_0x5f47be[_0xbe00('0x42')];if(!_0x2e54f2['query'][_0xbe00('0x4f')]('nolimit')){_0x888a52[_0xbe00('0x1d')]=qs[_0xbe00('0x1d')](_0x2e54f2[_0xbe00('0x31')][_0xbe00('0x1d')]);_0x888a52['offset']=qs['offset'](_0x2e54f2['query'][_0xbe00('0x1c')]);}return _0x7c479f[_0xbe00('0x4e')](_0x888a52);}})[_0xbe00('0x24')](function(_0x19965a){if(_0x19965a){return _0x19965a?{'count':_0x425f3d,'rows':_0x19965a}:null;}})['then'](respondWithResult(_0x2d8331,null))[_0xbe00('0x45')](handleError(_0x2d8331,null));};exports[_0xbe00('0x50')]=function(_0x3313b5,_0x43e597,_0x1d3cfc){var _0x42b7ec={};var _0xc83c4e={};var _0x2007bd;var _0x585dbd;return db[_0xbe00('0x2b')]['findOne']({'where':{'id':_0x3313b5[_0xbe00('0x48')]['id']}})['then'](handleEntityNotFound(_0x43e597,null))[_0xbe00('0x24')](function(_0x5b1cd6){if(_0x5b1cd6){_0x2007bd=_0x5b1cd6;_0xc83c4e['model']=_['keys'](db[_0xbe00('0x4a')][_0xbe00('0x2c')]);_0xc83c4e[_0xbe00('0x31')]=_[_0xbe00('0x32')](_0x3313b5[_0xbe00('0x31')]);_0xc83c4e[_0xbe00('0x33')]=_[_0xbe00('0x34')](_0xc83c4e[_0xbe00('0x30')],_0xc83c4e[_0xbe00('0x31')]);_0x42b7ec[_0xbe00('0x35')]=_[_0xbe00('0x34')](_0xc83c4e[_0xbe00('0x30')],qs['fields'](_0x3313b5[_0xbe00('0x31')][_0xbe00('0x36')]));_0x42b7ec[_0xbe00('0x35')]=_0x42b7ec[_0xbe00('0x35')][_0xbe00('0x42')]?_0x42b7ec[_0xbe00('0x35')]:_0xc83c4e[_0xbe00('0x30')];_0x42b7ec[_0xbe00('0x38')]=qs['sort'](_0x3313b5['query'][_0xbe00('0x4b')]);_0x42b7ec[_0xbe00('0x39')]=qs[_0xbe00('0x33')](_[_0xbe00('0x4c')](_0x3313b5['query'],_0xc83c4e[_0xbe00('0x33')]));if(_0x3313b5[_0xbe00('0x31')][_0xbe00('0x3a')]){_0x42b7ec[_0xbe00('0x39')]=_['merge'](_0x42b7ec[_0xbe00('0x39')],{'$or':_[_0xbe00('0x2a')](_0x42b7ec['attributes'],function(_0x33641b){var _0x228695={};_0x228695[_0x33641b]={'$like':'%'+_0x3313b5[_0xbe00('0x31')][_0xbe00('0x3a')]+'%'};return _0x228695;})});}_0x42b7ec=_['merge']({},_0x42b7ec,_0x3313b5[_0xbe00('0x43')]);return _0x2007bd[_0xbe00('0x50')](_0x42b7ec);}})[_0xbe00('0x24')](function(_0x364fd4){if(_0x364fd4){_0x585dbd=_0x364fd4[_0xbe00('0x42')];if(!_0x3313b5[_0xbe00('0x31')][_0xbe00('0x4f')](_0xbe00('0x37'))){_0x42b7ec[_0xbe00('0x1d')]=qs[_0xbe00('0x1d')](_0x3313b5[_0xbe00('0x31')][_0xbe00('0x1d')]);_0x42b7ec[_0xbe00('0x1c')]=qs['offset'](_0x3313b5[_0xbe00('0x31')][_0xbe00('0x1c')]);}return _0x2007bd[_0xbe00('0x50')](_0x42b7ec);}})[_0xbe00('0x24')](function(_0x8216e8){if(_0x8216e8){return _0x8216e8?{'count':_0x585dbd,'rows':_0x8216e8}:null;}})[_0xbe00('0x24')](respondWithResult(_0x43e597,null))[_0xbe00('0x45')](handleError(_0x43e597,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7070ebf..3e8cbf8 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 _0x19e7=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x19e7,0xbd));var _0x719e=function(_0x1c3e07,_0x4d31a5){_0x1c3e07=_0x1c3e07-0x0;var _0x1defcb=_0x19e7[_0x1c3e07];return _0x1defcb;};'use strict';var _=require(_0x719e('0x0'));var util=require(_0x719e('0x1'));var logger=require(_0x719e('0x2'))(_0x719e('0x3'));var moment=require(_0x719e('0x4'));var BPromise=require(_0x719e('0x5'));var rp=require(_0x719e('0x6'));var fs=require('fs');var path=require(_0x719e('0x7'));var rimraf=require(_0x719e('0x8'));var config=require(_0x719e('0x9'));var attributes=require(_0x719e('0xa'));module[_0x719e('0xb')]=function(_0x29eb97,_0x2c1fff){return _0x29eb97[_0x719e('0xc')](_0x719e('0xd'),attributes,{'tableName':_0x719e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3e4=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','moment','bluebird','path','./intZohoConfiguration.attributes'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xd3e4,0x100));var _0x4d3e=function(_0x3efd41,_0x21aac6){_0x3efd41=_0x3efd41-0x0;var _0x4ca5ba=_0xd3e4[_0x3efd41];return _0x4ca5ba;};'use strict';var _=require(_0x4d3e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4d3e('0x1'));var BPromise=require(_0x4d3e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d3e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4d3e('0x4'));module[_0x4d3e('0x5')]=function(_0x10a974,_0x501612){return _0x10a974[_0x4d3e('0x6')](_0x4d3e('0x7'),attributes,{'tableName':_0x4d3e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 1e6a376..4f6f24c 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 _0xf476=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x13ef4f,_0x268dae){var _0x568fa4=function(_0x166586){while(--_0x166586){_0x13ef4f['push'](_0x13ef4f['shift']());}};_0x568fa4(++_0x268dae);}(_0xf476,0x11f));var _0x6f47=function(_0x34ca02,_0x3b716e){_0x34ca02=_0x34ca02-0x0;var _0x59b4e7=_0xf476[_0x34ca02];return _0x59b4e7;};'use strict';var _=require(_0x6f47('0x0'));var util=require(_0x6f47('0x1'));var moment=require(_0x6f47('0x2'));var BPromise=require(_0x6f47('0x3'));var rs=require(_0x6f47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f47('0x5'))['db'];var utils=require(_0x6f47('0x6'));var logger=require(_0x6f47('0x7'))(_0x6f47('0x8'));var config=require(_0x6f47('0x9'));var jayson=require(_0x6f47('0xa'));var client=jayson[_0x6f47('0xb')][_0x6f47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cc55c,_0x1ee27b,_0x375e42){return new BPromise(function(_0x416fad,_0x52c99e){return client[_0x6f47('0xd')](_0x3cc55c,_0x375e42)[_0x6f47('0xe')](function(_0x12d80b){logger[_0x6f47('0xf')](_0x6f47('0x10'),_0x1ee27b,_0x6f47('0x11'));logger[_0x6f47('0x12')](_0x6f47('0x13'),_0x1ee27b,_0x6f47('0x11'),JSON['stringify'](_0x12d80b));if(_0x12d80b[_0x6f47('0x14')]){if(_0x12d80b[_0x6f47('0x14')]['code']===0x1f4){logger[_0x6f47('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ee27b,_0x12d80b[_0x6f47('0x14')][_0x6f47('0x15')]);return _0x52c99e(_0x12d80b[_0x6f47('0x14')][_0x6f47('0x15')]);}logger[_0x6f47('0x14')](_0x6f47('0x10'),_0x1ee27b,_0x12d80b[_0x6f47('0x14')]['message']);return _0x416fad(_0x12d80b[_0x6f47('0x14')][_0x6f47('0x15')]);}else{logger[_0x6f47('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ee27b,_0x6f47('0x11'));_0x416fad(_0x12d80b['result'][_0x6f47('0x15')]);}})[_0x6f47('0x16')](function(_0x53b037){logger[_0x6f47('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x1ee27b,_0x53b037);_0x52c99e(_0x53b037);});});} \ No newline at end of file +var _0x1ee0=['then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x1ee0,0x1a7));var _0x01ee=function(_0x4e0f40,_0x21b348){_0x4e0f40=_0x4e0f40-0x0;var _0x3abdbf=_0x1ee0[_0x4e0f40];return _0x3abdbf;};'use strict';var _=require(_0x01ee('0x0'));var util=require(_0x01ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x01ee('0x2'));var fs=require('fs');var Redis=require(_0x01ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x01ee('0x4'));var logger=require('../../config/logger')(_0x01ee('0x5'));var config=require(_0x01ee('0x6'));var jayson=require(_0x01ee('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a281c,_0x1f03b4,_0x4829c6){return new BPromise(function(_0x2ca700,_0x4f8986){return client[_0x01ee('0x8')](_0x2a281c,_0x4829c6)[_0x01ee('0x9')](function(_0xe3d43e){logger['info'](_0x01ee('0xa'),_0x1f03b4,_0x01ee('0xb'));logger['debug'](_0x01ee('0xc'),_0x1f03b4,'request\x20sent',JSON['stringify'](_0xe3d43e));if(_0xe3d43e[_0x01ee('0xd')]){if(_0xe3d43e[_0x01ee('0xd')][_0x01ee('0xe')]===0x1f4){logger[_0x01ee('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f03b4,_0xe3d43e['error']['message']);return _0x4f8986(_0xe3d43e['error'][_0x01ee('0xf')]);}logger[_0x01ee('0xd')](_0x01ee('0xa'),_0x1f03b4,_0xe3d43e['error']['message']);return _0x2ca700(_0xe3d43e[_0x01ee('0xd')][_0x01ee('0xf')]);}else{logger[_0x01ee('0x10')](_0x01ee('0xa'),_0x1f03b4,_0x01ee('0xb'));_0x2ca700(_0xe3d43e['result'][_0x01ee('0xf')]);}})[_0x01ee('0x11')](function(_0x5a5e48){logger[_0x01ee('0xd')](_0x01ee('0xa'),_0x1f03b4,_0x5a5e48);_0x4f8986(_0x5a5e48);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9a95243..1a11b6b 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 _0x21d7=['../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4167e0,_0x955464){var _0x55a313=function(_0x48a6c7){while(--_0x48a6c7){_0x4167e0['push'](_0x4167e0['shift']());}};_0x55a313(++_0x955464);}(_0x21d7,0xf7));var _0x721d=function(_0x4ca6eb,_0x4495c0){_0x4ca6eb=_0x4ca6eb-0x0;var _0x19301c=_0x21d7[_0x4ca6eb];return _0x19301c;};'use strict';var multer=require(_0x721d('0x0'));var util=require(_0x721d('0x1'));var path=require(_0x721d('0x2'));var timeout=require('connect-timeout');var express=require(_0x721d('0x3'));var router=express[_0x721d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x721d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x721d('0x6'));var controller=require(_0x721d('0x7'));router[_0x721d('0x8')]('/',auth[_0x721d('0x9')](),controller[_0x721d('0xa')]);router['get'](_0x721d('0xb'),auth[_0x721d('0x9')](),controller['show']);router['post']('/',auth[_0x721d('0x9')](),controller[_0x721d('0xc')]);router[_0x721d('0xd')]('/:id',auth[_0x721d('0x9')](),controller[_0x721d('0xe')]);router[_0x721d('0xf')](_0x721d('0xb'),auth[_0x721d('0x9')](),controller[_0x721d('0x10')]);module[_0x721d('0x11')]=router; \ No newline at end of file +var _0xb440=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','path','express','Router'];(function(_0x2b08e4,_0x25d3c8){var _0x5f0526=function(_0x14232f){while(--_0x14232f){_0x2b08e4['push'](_0x2b08e4['shift']());}};_0x5f0526(++_0x25d3c8);}(_0xb440,0x7b));var _0x0b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb440[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b44('0x0'));var timeout=require('connect-timeout');var express=require(_0x0b44('0x1'));var router=express[_0x0b44('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0b44('0x3'));var interaction=require(_0x0b44('0x4'));var config=require(_0x0b44('0x5'));var controller=require(_0x0b44('0x6'));router[_0x0b44('0x7')]('/',auth[_0x0b44('0x8')](),controller[_0x0b44('0x9')]);router[_0x0b44('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0b44('0xa')]);router[_0x0b44('0xb')]('/',auth[_0x0b44('0x8')](),controller[_0x0b44('0xc')]);router[_0x0b44('0xd')](_0x0b44('0xe'),auth[_0x0b44('0x8')](),controller[_0x0b44('0xf')]);router[_0x0b44('0x10')]('/:id',auth[_0x0b44('0x8')](),controller[_0x0b44('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index fa35fa5..3011b29 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 _0x5443=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x1b1aee,_0x5994f5){var _0x2e62a3=function(_0x10e13e){while(--_0x10e13e){_0x1b1aee['push'](_0x1b1aee['shift']());}};_0x2e62a3(++_0x5994f5);}(_0x5443,0xdb));var _0x3544=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5443[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x3544('0x0'));module[_0x3544('0x1')]={'type':{'type':Sequelize[_0x3544('0x2')]('string',_0x3544('0x3'),_0x3544('0x4'),_0x3544('0x5'),_0x3544('0x6')),'defaultValue':_0x3544('0x7')},'content':{'type':Sequelize[_0x3544('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3544('0x2')]('string',_0x3544('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3544('0x8')]},'nameField':{'type':Sequelize[_0x3544('0x8')]},'customField':{'type':Sequelize[_0x3544('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3544('0x8')]}}; \ No newline at end of file +var _0xa5a3=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa5a3,0x12f));var _0x3a5a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa5a3[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x3a5a('0x0'));module[_0x3a5a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3a5a('0x2'),_0x3a5a('0x3'),_0x3a5a('0x4'),'keyValue','picklist'),'defaultValue':_0x3a5a('0x2')},'content':{'type':Sequelize[_0x3a5a('0x5')]},'key':{'type':Sequelize[_0x3a5a('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x3a5a('0x2'),_0x3a5a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3a5a('0x5')]},'idField':{'type':Sequelize[_0x3a5a('0x5')]},'nameField':{'type':Sequelize[_0x3a5a('0x5')]},'customField':{'type':Sequelize[_0x3a5a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a5a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ca13e44..ed38c36 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 _0xa7cb=['send','index','map','ZohoField','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','VIRTUAL','merge','options','where','count','then','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','apply','reject','save','update','destroy','end','stack','name'];(function(_0x216734,_0x6b8be7){var _0x314217=function(_0x2e9a88){while(--_0x2e9a88){_0x216734['push'](_0x216734['shift']());}};_0x314217(++_0x6b8be7);}(_0xa7cb,0x1a7));var _0xba7c=function(_0x34986b,_0x56fb4a){_0x34986b=_0x34986b-0x0;var _0x28a0d1=_0xa7cb[_0x34986b];return _0x28a0d1;};'use strict';var emlformat=require(_0xba7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba7c('0x1'));var jsonpatch=require(_0xba7c('0x2'));var rp=require(_0xba7c('0x3'));var moment=require(_0xba7c('0x4'));var BPromise=require(_0xba7c('0x5'));var Mustache=require(_0xba7c('0x6'));var util=require(_0xba7c('0x7'));var path=require(_0xba7c('0x8'));var sox=require(_0xba7c('0x9'));var csv=require('to-csv');var ejs=require(_0xba7c('0xa'));var fs=require('fs');var fs_extra=require(_0xba7c('0xb'));var _=require(_0xba7c('0xc'));var squel=require(_0xba7c('0xd'));var crypto=require(_0xba7c('0xe'));var jsforce=require(_0xba7c('0xf'));var deskjs=require(_0xba7c('0x10'));var toCsv=require(_0xba7c('0x11'));var querystring=require(_0xba7c('0x12'));var Papa=require(_0xba7c('0x13'));var Redis=require('ioredis');var authService=require(_0xba7c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xba7c('0x15'));var hardwareService=require(_0xba7c('0x16'));var logger=require(_0xba7c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xba7c('0x18'));var licenseUtil=require(_0xba7c('0x19'));var db=require(_0xba7c('0x1a'))['db'];function respondWithStatusCode(_0x2ff422,_0x41be4d){_0x41be4d=_0x41be4d||0xcc;return function(_0x246a76){if(_0x246a76){return _0x2ff422[_0xba7c('0x1b')](_0x41be4d);}return _0x2ff422[_0xba7c('0x1c')](_0x41be4d)['end']();};}function respondWithResult(_0x57f712,_0x20c28e){_0x20c28e=_0x20c28e||0xc8;return function(_0x3b8c69){if(_0x3b8c69){return _0x57f712['status'](_0x20c28e)[_0xba7c('0x1d')](_0x3b8c69);}};}function respondWithFilteredResult(_0x432b43,_0x5c801c){return function(_0x5d0b6e){if(_0x5d0b6e){var _0x3f32f7=typeof _0x5c801c['offset']==='undefined'&&typeof _0x5c801c['limit']==='undefined';var _0x50f16b=_0x5d0b6e['count'];var _0x16fe3d=_0x3f32f7?0x0:_0x5c801c['offset'];var _0x1e86a3=_0x3f32f7?_0x5d0b6e['count']:_0x5c801c['offset']+_0x5c801c[_0xba7c('0x1e')];var _0xa8da69;if(_0x1e86a3>=_0x50f16b){_0x1e86a3=_0x50f16b;_0xa8da69=0xc8;}else{_0xa8da69=0xce;}_0x432b43[_0xba7c('0x1c')](_0xa8da69);return _0x432b43['set']('Content-Range',_0x16fe3d+'-'+_0x1e86a3+'/'+_0x50f16b)['json'](_0x5d0b6e);}return null;};}function patchUpdates(_0x4616df){return function(_0x4b70f6){try{jsonpatch[_0xba7c('0x1f')](_0x4b70f6,_0x4616df,!![]);}catch(_0x3fe292){return BPromise[_0xba7c('0x20')](_0x3fe292);}return _0x4b70f6[_0xba7c('0x21')]();};}function saveUpdates(_0x533d1e,_0x55933d){return function(_0x2d888a){if(_0x2d888a){return _0x2d888a[_0xba7c('0x22')](_0x533d1e)['then'](function(_0x318bf0){return _0x318bf0;});}return null;};}function removeEntity(_0x55a6b2,_0x48cc12){return function(_0x422322){if(_0x422322){return _0x422322[_0xba7c('0x23')]()['then'](function(){_0x55a6b2[_0xba7c('0x1c')](0xcc)[_0xba7c('0x24')]();});}};}function handleEntityNotFound(_0x53e811,_0x3b9fcc){return function(_0x130836){if(!_0x130836){_0x53e811[_0xba7c('0x1b')](0x194);}return _0x130836;};}function handleError(_0x8dfd50,_0x1d5222){_0x1d5222=_0x1d5222||0x1f4;return function(_0x6aa6f8){logger['error'](_0x6aa6f8[_0xba7c('0x25')]);if(_0x6aa6f8[_0xba7c('0x26')]){delete _0x6aa6f8[_0xba7c('0x26')];}_0x8dfd50[_0xba7c('0x1c')](_0x1d5222)[_0xba7c('0x27')](_0x6aa6f8);};}exports[_0xba7c('0x28')]=function(_0x207aed,_0x1eb009){var _0xbdd54e={},_0x4e375e={},_0x493dbe={'count':0x0,'rows':[]};var _0x5bba84=_[_0xba7c('0x29')](db[_0xba7c('0x2a')][_0xba7c('0x2b')],function(_0x75be10){return{'name':_0x75be10['fieldName'],'type':_0x75be10[_0xba7c('0x2c')][_0xba7c('0x2d')]};});_0x4e375e[_0xba7c('0x2e')]=_[_0xba7c('0x29')](_0x5bba84,_0xba7c('0x26'));_0x4e375e['query']=_[_0xba7c('0x2f')](_0x207aed['query']);_0x4e375e[_0xba7c('0x30')]=_[_0xba7c('0x31')](_0x4e375e[_0xba7c('0x2e')],_0x4e375e[_0xba7c('0x32')]);_0xbdd54e['attributes']=_['intersection'](_0x4e375e[_0xba7c('0x2e')],qs[_0xba7c('0x33')](_0x207aed[_0xba7c('0x32')]['fields']));_0xbdd54e['attributes']=_0xbdd54e[_0xba7c('0x34')][_0xba7c('0x35')]?_0xbdd54e[_0xba7c('0x34')]:_0x4e375e[_0xba7c('0x2e')];if(!_0x207aed[_0xba7c('0x32')][_0xba7c('0x36')](_0xba7c('0x37'))){_0xbdd54e['limit']=qs[_0xba7c('0x1e')](_0x207aed['query'][_0xba7c('0x1e')]);_0xbdd54e[_0xba7c('0x38')]=qs['offset'](_0x207aed[_0xba7c('0x32')][_0xba7c('0x38')]);}_0xbdd54e[_0xba7c('0x39')]=qs[_0xba7c('0x3a')](_0x207aed['query'][_0xba7c('0x3a')]);_0xbdd54e['where']=qs['filters'](_[_0xba7c('0x3b')](_0x207aed[_0xba7c('0x32')],_0x4e375e[_0xba7c('0x30')]),_0x5bba84);if(_0x207aed['query'][_0xba7c('0x3c')]){_0xbdd54e['where']=_['merge'](_0xbdd54e['where'],{'$or':_[_0xba7c('0x29')](_0x5bba84,function(_0x186d55){if(_0x186d55['type']!==_0xba7c('0x3d')){var _0x2a6e22={};_0x2a6e22[_0x186d55[_0xba7c('0x26')]]={'$like':'%'+_0x207aed[_0xba7c('0x32')][_0xba7c('0x3c')]+'%'};return _0x2a6e22;}})});}_0xbdd54e=_[_0xba7c('0x3e')]({},_0xbdd54e,_0x207aed[_0xba7c('0x3f')]);var _0x8e07a8={'where':_0xbdd54e[_0xba7c('0x40')]};return db[_0xba7c('0x2a')][_0xba7c('0x41')](_0x8e07a8)[_0xba7c('0x42')](function(_0x3e472d){_0x493dbe[_0xba7c('0x41')]=_0x3e472d;if(_0x207aed[_0xba7c('0x32')][_0xba7c('0x43')]){_0xbdd54e[_0xba7c('0x44')]=[{'all':!![]}];}return db[_0xba7c('0x2a')][_0xba7c('0x45')](_0xbdd54e);})[_0xba7c('0x42')](function(_0x334fd7){_0x493dbe[_0xba7c('0x46')]=_0x334fd7;return _0x493dbe;})[_0xba7c('0x42')](respondWithFilteredResult(_0x1eb009,_0xbdd54e))['catch'](handleError(_0x1eb009,null));};exports[_0xba7c('0x47')]=function(_0x482e90,_0x2e9b3c){var _0x19e02b={'raw':!![],'where':{'id':_0x482e90[_0xba7c('0x48')]['id']}},_0x536e39={};_0x536e39[_0xba7c('0x2e')]=_[_0xba7c('0x2f')](db[_0xba7c('0x2a')]['rawAttributes']);_0x536e39[_0xba7c('0x32')]=_[_0xba7c('0x2f')](_0x482e90['query']);_0x536e39[_0xba7c('0x30')]=_[_0xba7c('0x31')](_0x536e39[_0xba7c('0x2e')],_0x536e39['query']);_0x19e02b[_0xba7c('0x34')]=_[_0xba7c('0x31')](_0x536e39[_0xba7c('0x2e')],qs['fields'](_0x482e90[_0xba7c('0x32')][_0xba7c('0x33')]));_0x19e02b[_0xba7c('0x34')]=_0x19e02b[_0xba7c('0x34')][_0xba7c('0x35')]?_0x19e02b[_0xba7c('0x34')]:_0x536e39['model'];if(_0x482e90['query'][_0xba7c('0x43')]){_0x19e02b[_0xba7c('0x44')]=[{'all':!![]}];}_0x19e02b=_[_0xba7c('0x3e')]({},_0x19e02b,_0x482e90[_0xba7c('0x3f')]);return db['ZohoField']['find'](_0x19e02b)['then'](handleEntityNotFound(_0x2e9b3c,null))[_0xba7c('0x42')](respondWithResult(_0x2e9b3c,null))[_0xba7c('0x49')](handleError(_0x2e9b3c,null));};exports[_0xba7c('0x4a')]=function(_0x4c0d7a,_0x3007c8){return db[_0xba7c('0x2a')]['create'](_0x4c0d7a[_0xba7c('0x4b')],{})[_0xba7c('0x42')](respondWithResult(_0x3007c8,0xc9))[_0xba7c('0x49')](handleError(_0x3007c8,null));};exports['update']=function(_0xb45124,_0x1f5079){if(_0xb45124[_0xba7c('0x4b')]['id']){delete _0xb45124[_0xba7c('0x4b')]['id'];}return db[_0xba7c('0x2a')][_0xba7c('0x4c')]({'where':{'id':_0xb45124[_0xba7c('0x48')]['id']}})[_0xba7c('0x42')](handleEntityNotFound(_0x1f5079,null))['then'](saveUpdates(_0xb45124[_0xba7c('0x4b')],null))[_0xba7c('0x42')](respondWithResult(_0x1f5079,null))[_0xba7c('0x49')](handleError(_0x1f5079,null));};exports['destroy']=function(_0x26d1e9,_0x3ddbbf){return db[_0xba7c('0x2a')][_0xba7c('0x4c')]({'where':{'id':_0x26d1e9['params']['id']}})[_0xba7c('0x42')](handleEntityNotFound(_0x3ddbbf,null))[_0xba7c('0x42')](removeEntity(_0x3ddbbf,null))[_0xba7c('0x49')](handleError(_0x3ddbbf,null));}; \ No newline at end of file +var _0x887b=['offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x887b,0x185));var _0xb887=function(_0x3c25ad,_0x3b7eee){_0x3c25ad=_0x3c25ad-0x0;var _0x467be9=_0x887b[_0x3c25ad];return _0x467be9;};'use strict';var emlformat=require(_0xb887('0x0'));var rimraf=require(_0xb887('0x1'));var zipdir=require(_0xb887('0x2'));var jsonpatch=require(_0xb887('0x3'));var rp=require(_0xb887('0x4'));var moment=require(_0xb887('0x5'));var BPromise=require(_0xb887('0x6'));var Mustache=require(_0xb887('0x7'));var util=require(_0xb887('0x8'));var path=require('path');var sox=require(_0xb887('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb887('0xa'));var squel=require(_0xb887('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb887('0xc'));var toCsv=require(_0xb887('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb887('0xe'));var qs=require(_0xb887('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb887('0x10'));var logger=require('../../config/logger')(_0xb887('0x11'));var utils=require(_0xb887('0x12'));var config=require(_0xb887('0x13'));var licenseUtil=require(_0xb887('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x582f11,_0x2380d2){_0x2380d2=_0x2380d2||0xcc;return function(_0xa6d17b){if(_0xa6d17b){return _0x582f11[_0xb887('0x15')](_0x2380d2);}return _0x582f11[_0xb887('0x16')](_0x2380d2)[_0xb887('0x17')]();};}function respondWithResult(_0x5899bb,_0x387367){_0x387367=_0x387367||0xc8;return function(_0xae7291){if(_0xae7291){return _0x5899bb[_0xb887('0x16')](_0x387367)[_0xb887('0x18')](_0xae7291);}};}function respondWithFilteredResult(_0x7bac36,_0x1b193c){return function(_0x2008e4){if(_0x2008e4){var _0x2b0f05=typeof _0x1b193c[_0xb887('0x19')]===_0xb887('0x1a')&&typeof _0x1b193c[_0xb887('0x1b')]===_0xb887('0x1a');var _0x54df24=_0x2008e4['count'];var _0x279ab0=_0x2b0f05?0x0:_0x1b193c[_0xb887('0x19')];var _0x4aa052=_0x2b0f05?_0x2008e4[_0xb887('0x1c')]:_0x1b193c[_0xb887('0x19')]+_0x1b193c[_0xb887('0x1b')];var _0x115084;if(_0x4aa052>=_0x54df24){_0x4aa052=_0x54df24;_0x115084=0xc8;}else{_0x115084=0xce;}_0x7bac36[_0xb887('0x16')](_0x115084);return _0x7bac36['set'](_0xb887('0x1d'),_0x279ab0+'-'+_0x4aa052+'/'+_0x54df24)['json'](_0x2008e4);}return null;};}function patchUpdates(_0x5a9e68){return function(_0x68ef0a){try{jsonpatch[_0xb887('0x1e')](_0x68ef0a,_0x5a9e68,!![]);}catch(_0x42b1e4){return BPromise['reject'](_0x42b1e4);}return _0x68ef0a['save']();};}function saveUpdates(_0x101f64,_0x4af881){return function(_0x321cb6){if(_0x321cb6){return _0x321cb6[_0xb887('0x1f')](_0x101f64)[_0xb887('0x20')](function(_0x246669){return _0x246669;});}return null;};}function removeEntity(_0x49a401,_0x17dd2f){return function(_0x4653c7){if(_0x4653c7){return _0x4653c7[_0xb887('0x21')]()['then'](function(){_0x49a401[_0xb887('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x198351,_0x2b7b91){return function(_0x235c62){if(!_0x235c62){_0x198351['sendStatus'](0x194);}return _0x235c62;};}function handleError(_0x568e6f,_0x2fb6b7){_0x2fb6b7=_0x2fb6b7||0x1f4;return function(_0x1496cd){logger[_0xb887('0x22')](_0x1496cd[_0xb887('0x23')]);if(_0x1496cd[_0xb887('0x24')]){delete _0x1496cd[_0xb887('0x24')];}_0x568e6f['status'](_0x2fb6b7)[_0xb887('0x25')](_0x1496cd);};}exports[_0xb887('0x26')]=function(_0x113930,_0x33891e){var _0x52585e={},_0x25002c={},_0x482451={'count':0x0,'rows':[]};var _0x3530a1=_[_0xb887('0x27')](db[_0xb887('0x28')][_0xb887('0x29')],function(_0x53f211){return{'name':_0x53f211[_0xb887('0x2a')],'type':_0x53f211[_0xb887('0x2b')]['key']};});_0x25002c[_0xb887('0x2c')]=_[_0xb887('0x27')](_0x3530a1,_0xb887('0x24'));_0x25002c['query']=_[_0xb887('0x2d')](_0x113930['query']);_0x25002c[_0xb887('0x2e')]=_['intersection'](_0x25002c[_0xb887('0x2c')],_0x25002c[_0xb887('0x2f')]);_0x52585e[_0xb887('0x30')]=_[_0xb887('0x31')](_0x25002c['model'],qs[_0xb887('0x32')](_0x113930[_0xb887('0x2f')][_0xb887('0x32')]));_0x52585e[_0xb887('0x30')]=_0x52585e['attributes'][_0xb887('0x33')]?_0x52585e[_0xb887('0x30')]:_0x25002c[_0xb887('0x2c')];if(!_0x113930[_0xb887('0x2f')][_0xb887('0x34')](_0xb887('0x35'))){_0x52585e[_0xb887('0x1b')]=qs['limit'](_0x113930[_0xb887('0x2f')][_0xb887('0x1b')]);_0x52585e['offset']=qs[_0xb887('0x19')](_0x113930[_0xb887('0x2f')]['offset']);}_0x52585e[_0xb887('0x36')]=qs[_0xb887('0x37')](_0x113930[_0xb887('0x2f')]['sort']);_0x52585e['where']=qs['filters'](_['pick'](_0x113930[_0xb887('0x2f')],_0x25002c[_0xb887('0x2e')]),_0x3530a1);if(_0x113930['query'][_0xb887('0x38')]){_0x52585e[_0xb887('0x39')]=_[_0xb887('0x3a')](_0x52585e['where'],{'$or':_[_0xb887('0x27')](_0x3530a1,function(_0x1d01c4){if(_0x1d01c4[_0xb887('0x2b')]!==_0xb887('0x3b')){var _0x24a89c={};_0x24a89c[_0x1d01c4[_0xb887('0x24')]]={'$like':'%'+_0x113930[_0xb887('0x2f')][_0xb887('0x38')]+'%'};return _0x24a89c;}})});}_0x52585e=_[_0xb887('0x3a')]({},_0x52585e,_0x113930[_0xb887('0x3c')]);var _0x473bf9={'where':_0x52585e[_0xb887('0x39')]};return db['ZohoField']['count'](_0x473bf9)[_0xb887('0x20')](function(_0x252a19){_0x482451[_0xb887('0x1c')]=_0x252a19;if(_0x113930[_0xb887('0x2f')][_0xb887('0x3d')]){_0x52585e[_0xb887('0x3e')]=[{'all':!![]}];}return db[_0xb887('0x28')]['findAll'](_0x52585e);})['then'](function(_0x3d2014){_0x482451[_0xb887('0x3f')]=_0x3d2014;return _0x482451;})[_0xb887('0x20')](respondWithFilteredResult(_0x33891e,_0x52585e))[_0xb887('0x40')](handleError(_0x33891e,null));};exports['show']=function(_0x481b11,_0x2ca6dc){var _0x3ce41b={'raw':!![],'where':{'id':_0x481b11[_0xb887('0x41')]['id']}},_0x16446f={};_0x16446f[_0xb887('0x2c')]=_[_0xb887('0x2d')](db[_0xb887('0x28')][_0xb887('0x29')]);_0x16446f['query']=_[_0xb887('0x2d')](_0x481b11['query']);_0x16446f[_0xb887('0x2e')]=_[_0xb887('0x31')](_0x16446f['model'],_0x16446f['query']);_0x3ce41b[_0xb887('0x30')]=_[_0xb887('0x31')](_0x16446f[_0xb887('0x2c')],qs[_0xb887('0x32')](_0x481b11[_0xb887('0x2f')][_0xb887('0x32')]));_0x3ce41b[_0xb887('0x30')]=_0x3ce41b[_0xb887('0x30')][_0xb887('0x33')]?_0x3ce41b[_0xb887('0x30')]:_0x16446f[_0xb887('0x2c')];if(_0x481b11['query'][_0xb887('0x3d')]){_0x3ce41b['include']=[{'all':!![]}];}_0x3ce41b=_['merge']({},_0x3ce41b,_0x481b11[_0xb887('0x3c')]);return db[_0xb887('0x28')][_0xb887('0x42')](_0x3ce41b)[_0xb887('0x20')](handleEntityNotFound(_0x2ca6dc,null))[_0xb887('0x20')](respondWithResult(_0x2ca6dc,null))[_0xb887('0x40')](handleError(_0x2ca6dc,null));};exports['create']=function(_0x5438fb,_0x5a1457){return db[_0xb887('0x28')][_0xb887('0x43')](_0x5438fb[_0xb887('0x44')],{})[_0xb887('0x20')](respondWithResult(_0x5a1457,0xc9))['catch'](handleError(_0x5a1457,null));};exports['update']=function(_0x3949fc,_0x22867d){if(_0x3949fc[_0xb887('0x44')]['id']){delete _0x3949fc[_0xb887('0x44')]['id'];}return db[_0xb887('0x28')]['find']({'where':{'id':_0x3949fc[_0xb887('0x41')]['id']}})[_0xb887('0x20')](handleEntityNotFound(_0x22867d,null))[_0xb887('0x20')](saveUpdates(_0x3949fc[_0xb887('0x44')],null))[_0xb887('0x20')](respondWithResult(_0x22867d,null))[_0xb887('0x40')](handleError(_0x22867d,null));};exports[_0xb887('0x21')]=function(_0x592b12,_0x31cc47){return db['ZohoField'][_0xb887('0x42')]({'where':{'id':_0x592b12['params']['id']}})[_0xb887('0x20')](handleEntityNotFound(_0x31cc47,null))[_0xb887('0x20')](removeEntity(_0x31cc47,null))['catch'](handleError(_0x31cc47,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d80a032..8863454 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 _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0xdb494d,_0x28b7b4){var _0xa9c1bd=function(_0xaeca9c){while(--_0xaeca9c){_0xdb494d['push'](_0xdb494d['shift']());}};_0xa9c1bd(++_0x28b7b4);}(_0x82c4,0x1ca));var _0x482c=function(_0x183e5e,_0x5d178e){_0x183e5e=_0x183e5e-0x0;var _0x25d3a4=_0x82c4[_0x183e5e];return _0x25d3a4;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x2b0ddd,_0xc2ca0a){var _0x5d1015=function(_0x51c9f1){while(--_0x51c9f1){_0x2b0ddd['push'](_0x2b0ddd['shift']());}};_0x5d1015(++_0xc2ca0a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./intZohoField.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'name':_0x65f6('0xa'),'fields':[_0x65f6('0xb'),_0x65f6('0xc')],'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 445a59e..35aa5fc 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 _0x2568=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x50ed28,_0x2d80f8){var _0x3849f6=function(_0x30026a){while(--_0x30026a){_0x50ed28['push'](_0x50ed28['shift']());}};_0x3849f6(++_0x2d80f8);}(_0x2568,0x71));var _0x8256=function(_0x53a56e,_0x1197dd){_0x53a56e=_0x53a56e-0x0;var _0x4c8ad8=_0x2568[_0x53a56e];return _0x4c8ad8;};'use strict';var _=require('lodash');var util=require(_0x8256('0x0'));var moment=require(_0x8256('0x1'));var BPromise=require(_0x8256('0x2'));var rs=require(_0x8256('0x3'));var fs=require('fs');var Redis=require(_0x8256('0x4'));var db=require(_0x8256('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8256('0x6'))('rpc');var config=require(_0x8256('0x7'));var jayson=require(_0x8256('0x8'));var client=jayson[_0x8256('0x9')][_0x8256('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eb97d,_0x267fe7,_0x3eb462){return new BPromise(function(_0x3d1866,_0x68c8de){return client[_0x8256('0xb')](_0x4eb97d,_0x3eb462)[_0x8256('0xc')](function(_0x35df7d){logger[_0x8256('0xd')](_0x8256('0xe'),_0x267fe7,'request\x20sent');logger[_0x8256('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x267fe7,_0x8256('0x10'),JSON[_0x8256('0x11')](_0x35df7d));if(_0x35df7d[_0x8256('0x12')]){if(_0x35df7d[_0x8256('0x12')][_0x8256('0x13')]===0x1f4){logger[_0x8256('0x12')](_0x8256('0xe'),_0x267fe7,_0x35df7d[_0x8256('0x12')]['message']);return _0x68c8de(_0x35df7d[_0x8256('0x12')][_0x8256('0x14')]);}logger[_0x8256('0x12')](_0x8256('0xe'),_0x267fe7,_0x35df7d[_0x8256('0x12')][_0x8256('0x14')]);return _0x3d1866(_0x35df7d['error'][_0x8256('0x14')]);}else{logger['info'](_0x8256('0xe'),_0x267fe7,_0x8256('0x10'));_0x3d1866(_0x35df7d[_0x8256('0x15')][_0x8256('0x14')]);}})[_0x8256('0x16')](function(_0x14a7ed){logger[_0x8256('0x12')](_0x8256('0xe'),_0x267fe7,_0x14a7ed);_0x68c8de(_0x14a7ed);});});} \ No newline at end of file +var _0xca1e=['client','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xca1e,0x133));var _0xeca1=function(_0x4aa1ae,_0x1ee884){_0x4aa1ae=_0x4aa1ae-0x0;var _0x31c1bb=_0xca1e[_0x4aa1ae];return _0x31c1bb;};'use strict';var _=require(_0xeca1('0x0'));var util=require('util');var moment=require(_0xeca1('0x1'));var BPromise=require(_0xeca1('0x2'));var rs=require(_0xeca1('0x3'));var fs=require('fs');var Redis=require(_0xeca1('0x4'));var db=require(_0xeca1('0x5'))['db'];var utils=require(_0xeca1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xeca1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeca1('0x8')][_0xeca1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fc0e1,_0x1fffe0,_0x2f90e5){return new BPromise(function(_0x4e9a0e,_0x378309){return client['request'](_0x4fc0e1,_0x2f90e5)[_0xeca1('0xa')](function(_0x271438){logger[_0xeca1('0xb')]('ZohoField,\x20%s,\x20%s',_0x1fffe0,_0xeca1('0xc'));logger[_0xeca1('0xd')](_0xeca1('0xe'),_0x1fffe0,_0xeca1('0xc'),JSON[_0xeca1('0xf')](_0x271438));if(_0x271438[_0xeca1('0x10')]){if(_0x271438[_0xeca1('0x10')][_0xeca1('0x11')]===0x1f4){logger[_0xeca1('0x10')](_0xeca1('0x12'),_0x1fffe0,_0x271438['error']['message']);return _0x378309(_0x271438[_0xeca1('0x10')]['message']);}logger['error'](_0xeca1('0x12'),_0x1fffe0,_0x271438[_0xeca1('0x10')]['message']);return _0x4e9a0e(_0x271438[_0xeca1('0x10')]['message']);}else{logger[_0xeca1('0xb')]('ZohoField,\x20%s,\x20%s',_0x1fffe0,_0xeca1('0xc'));_0x4e9a0e(_0x271438['result'][_0xeca1('0x13')]);}})[_0xeca1('0x14')](function(_0xcd4842){logger[_0xeca1('0x10')](_0xeca1('0x12'),_0x1fffe0,_0xcd4842);_0x378309(_0xcd4842);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f9ef805..b55835e 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x28ef47,_0x16cfbc){var _0x16de93=function(_0x33fe2a){while(--_0x33fe2a){_0x28ef47['push'](_0x28ef47['shift']());}};_0x16de93(++_0x16cfbc);}(_0xe706,0xa3));var _0x6e70=function(_0x11fcba,_0x46ac13){_0x11fcba=_0x11fcba-0x0;var _0x2c792a=_0xe706[_0x11fcba];return _0x2c792a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x58cc40,_0x183602){var _0x19f72b=function(_0x26cc96){while(--_0x26cc96){_0x58cc40['push'](_0x58cc40['shift']());}};_0x19f72b(++_0x183602);}(_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'));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 ca2979b..b6a4bab 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 _0xdb3e=['INTEGER','BOOLEAN','exports','unique_name_and_version','STRING','app.js'];(function(_0x290fc9,_0x3069fe){var _0x31c8bd=function(_0x4bec21){while(--_0x4bec21){_0x290fc9['push'](_0x290fc9['shift']());}};_0x31c8bd(++_0x3069fe);}(_0xdb3e,0x1e2));var _0xedb3=function(_0x54772c,_0x4b90c7){_0x54772c=_0x54772c-0x0;var _0x8f15da=_0xdb3e[_0x54772c];return _0x8f15da;};'use strict';var Sequelize=require('sequelize');module[_0xedb3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xedb3('0x1')},'version':{'type':Sequelize[_0xedb3('0x2')],'allowNull':![],'unique':_0xedb3('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xedb3('0x3')},'filename':{'type':Sequelize[_0xedb3('0x2')]},'path':{'type':Sequelize[_0xedb3('0x2')]},'type':{'type':Sequelize[_0xedb3('0x2')]},'size':{'type':Sequelize[_0xedb3('0x4')]},'active':{'type':Sequelize[_0xedb3('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xedb3('0x2')]},'logo':{'type':Sequelize[_0xedb3('0x2')]},'state':{'type':Sequelize[_0xedb3('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xedb3('0x2')]},'remoteUri':{'type':Sequelize[_0xedb3('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xe76d=['app.js','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xe76d,0x1bc));var _0xde76=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe76d[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0xde76('0x0'));module[_0xde76('0x1')]={'name':{'type':Sequelize[_0xde76('0x2')],'allowNull':![],'unique':_0xde76('0x3')},'version':{'type':Sequelize[_0xde76('0x2')],'allowNull':![],'unique':_0xde76('0x3')},'main':{'type':Sequelize[_0xde76('0x2')],'defaultValue':_0xde76('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xde76('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xde76('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xde76('0x2')]},'state':{'type':Sequelize[_0xde76('0x2')],'unique':_0xde76('0x6')},'description':{'type':Sequelize[_0xde76('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xde76('0x2')]},'link':{'type':Sequelize[_0xde76('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 05130d3..ca4a90b 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 _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x168180,_0x5ad47b){var _0x1856c6=function(_0x492cda){while(--_0x492cda){_0x168180['push'](_0x168180['shift']());}};_0x1856c6(++_0x5ad47b);}(_0x4991,0xf7));var _0x1499=function(_0x5ce455,_0xa62c6c){_0x5ce455=_0x5ce455-0x0;var _0x506ed4=_0x4991[_0x5ce455];return _0x506ed4;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0x9536=['includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','Integration','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9536,0x179));var _0x6953=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x9536[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c810358..abfa78f 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 _0x06cf=['path','rimraf','./integration.attributes','define','Integration','integrations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06cf,0x1be));var _0xf06c=function(_0x3f2155,_0x30d455){_0x3f2155=_0x3f2155-0x0;var _0x3cd605=_0x06cf[_0x3f2155];return _0x3cd605;};'use strict';var _=require(_0xf06c('0x0'));var util=require('util');var logger=require(_0xf06c('0x1'))(_0xf06c('0x2'));var moment=require('moment');var BPromise=require(_0xf06c('0x3'));var rp=require(_0xf06c('0x4'));var fs=require('fs');var path=require(_0xf06c('0x5'));var rimraf=require(_0xf06c('0x6'));var config=require('../../config/environment');var attributes=require(_0xf06c('0x7'));module['exports']=function(_0x3eda15,_0xa21b58){return _0x3eda15[_0xf06c('0x8')](_0xf06c('0x9'),attributes,{'tableName':_0xf06c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x594b=['../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x27861e,_0x206498){var _0x49cb35=function(_0x5e1c69){while(--_0x5e1c69){_0x27861e['push'](_0x27861e['shift']());}};_0x49cb35(++_0x206498);}(_0x594b,0x1d3));var _0xb594=function(_0x147244,_0x471347){_0x147244=_0x147244-0x0;var _0x5bc82a=_0x594b[_0x147244];return _0x5bc82a;};'use strict';var _=require(_0xb594('0x0'));var util=require(_0xb594('0x1'));var logger=require(_0xb594('0x2'))(_0xb594('0x3'));var moment=require(_0xb594('0x4'));var BPromise=require(_0xb594('0x5'));var rp=require(_0xb594('0x6'));var fs=require('fs');var path=require(_0xb594('0x7'));var rimraf=require(_0xb594('0x8'));var config=require(_0xb594('0x9'));var attributes=require('./integration.attributes');module[_0xb594('0xa')]=function(_0x51969e,_0x2a9fe9){return _0x51969e[_0xb594('0xb')](_0xb594('0xc'),attributes,{'tableName':_0xb594('0xd'),'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 6f99b26..73fd214 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x442ccd,_0x415d61){var _0x1a2c10=function(_0x4ddd45){while(--_0x4ddd45){_0x442ccd['push'](_0x442ccd['shift']());}};_0x1a2c10(++_0x415d61);}(_0x2ef3,0xba));var _0x32ef=function(_0x52ddca,_0xbb1e80){_0x52ddca=_0x52ddca-0x0;var _0x2a1179=_0x2ef3[_0x52ddca];return _0x2a1179;};'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')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x50f929,_0x49bae9){var _0x2416c5=function(_0x55c7eb){while(--_0x55c7eb){_0x50f929['push'](_0x50f929['shift']());}};_0x2416c5(++_0x49bae9);}(_0xd943,0x15d));var _0x3d94=function(_0x1feb25,_0x3988fc){_0x1feb25=_0x1feb25-0x0;var _0x94a9f5=_0xd943[_0x1feb25];return _0x94a9f5;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a588691..26a2482 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xdb28,0x106));var _0x8db2=function(_0x352f3b,_0x36719b){_0x352f3b=_0x352f3b-0x0;var _0x420774=_0xdb28[_0x352f3b];return _0x420774;};'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('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x58068d,_0x8699ff){var _0x56b5c0=function(_0x4da341){while(--_0x4da341){_0x58068d['push'](_0x58068d['shift']());}};_0x56b5c0(++_0x8699ff);}(_0xba34,0x119));var _0x4ba3=function(_0x24c45f,_0x2136c7){_0x24c45f=_0x24c45f-0x0;var _0x4b7ae7=_0xba34[_0x24c45f];return _0x4b7ae7;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index bbd4886..d09dd0e 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 _0x9426=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9426,0x1b6));var _0x6942=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9426[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6942('0x0'));module[_0x6942('0x1')]={'integration':{'type':Sequelize[_0x6942('0x2')]},'eventChannel':{'type':Sequelize[_0x6942('0x2')]},'exitStatus':{'type':Sequelize[_0x6942('0x2')]},'ticketId':{'type':Sequelize[_0x6942('0x2')]},'integrationId':{'type':Sequelize[_0x6942('0x3')]},'contacts':{'type':Sequelize[_0x6942('0x2')]},'uniqueid':{'type':Sequelize[_0x6942('0x2')]},'calleridnum':{'type':Sequelize[_0x6942('0x2')]},'calleridname':{'type':Sequelize[_0x6942('0x2')]},'queue':{'type':Sequelize[_0x6942('0x2')]},'interface':{'type':Sequelize[_0x6942('0x2')]},'membername':{'type':Sequelize[_0x6942('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6942('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6942('0x4')]},'holdtime':{'type':Sequelize[_0x6942('0x3')]},'agentcomplete':{'type':Sequelize[_0x6942('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6942('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6942('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x6942('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6942('0x4')]},'agentdump':{'type':Sequelize[_0x6942('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6942('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6942('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6942('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6942('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6942('0x2')]},'context':{'type':Sequelize[_0x6942('0x2')]},'exten':{'type':Sequelize[_0x6942('0x2')]},'priority':{'type':Sequelize[_0x6942('0x2')]},'destchannel':{'type':Sequelize[_0x6942('0x2')]},'destchannelstate':{'type':Sequelize[_0x6942('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6942('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6942('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6942('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6942('0x2')]},'destaccountcode':{'type':Sequelize[_0x6942('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6942('0x2')]},'destpriority':{'type':Sequelize[_0x6942('0x2')]},'destuniqueid':{'type':Sequelize[_0x6942('0x2')]},'messageId':{'type':Sequelize[_0x6942('0x2')]},'inReplyTo':{'type':Sequelize[_0x6942('0x2')]},'subject':{'type':Sequelize[_0x6942('0x2')]},'from':{'type':Sequelize[_0x6942('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x6942('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6942('0x6')]},'status':{'type':Sequelize[_0x6942('0x7')]('SENT',_0x6942('0x8'),_0x6942('0x9'),_0x6942('0xa'))},'url':{'type':Sequelize[_0x6942('0x2')]},'app':{'type':Sequelize[_0x6942('0x2')]},'appdata':{'type':Sequelize[_0x6942('0x2')]},'projectId':{'type':Sequelize[_0x6942('0x3')]}}; \ No newline at end of file +var _0xbc51=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','STRING','INTEGER'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xbc51,0x1ca));var _0x1bc5=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0xbc51[_0x15d18f];return _0xd12bf7;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x1bc5('0x0')]},'eventChannel':{'type':Sequelize[_0x1bc5('0x0')]},'exitStatus':{'type':Sequelize[_0x1bc5('0x0')]},'ticketId':{'type':Sequelize[_0x1bc5('0x0')]},'integrationId':{'type':Sequelize[_0x1bc5('0x1')]},'contacts':{'type':Sequelize[_0x1bc5('0x0')]},'uniqueid':{'type':Sequelize[_0x1bc5('0x0')]},'calleridnum':{'type':Sequelize[_0x1bc5('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1bc5('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1bc5('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1bc5('0x2')]},'talktime':{'type':Sequelize[_0x1bc5('0x1')]},'agentacw':{'type':Sequelize[_0x1bc5('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1bc5('0x1')]},'reason':{'type':Sequelize[_0x1bc5('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1bc5('0x2')]},'agentdump':{'type':Sequelize[_0x1bc5('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1bc5('0x2')]},'lastevent':{'type':Sequelize[_0x1bc5('0x0')]},'channel':{'type':Sequelize[_0x1bc5('0x0')]},'channelstate':{'type':Sequelize[_0x1bc5('0x1')]},'channelstatedesc':{'type':Sequelize[_0x1bc5('0x0')]},'connectedlinenum':{'type':Sequelize[_0x1bc5('0x0')]},'connectedlinename':{'type':Sequelize[_0x1bc5('0x0')]},'language':{'type':Sequelize[_0x1bc5('0x0')]},'accountcode':{'type':Sequelize[_0x1bc5('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1bc5('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x1bc5('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x1bc5('0x0')]},'destcalleridnum':{'type':Sequelize[_0x1bc5('0x0')]},'destcalleridname':{'type':Sequelize[_0x1bc5('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x1bc5('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x1bc5('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1bc5('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1bc5('0x0')]},'destpriority':{'type':Sequelize[_0x1bc5('0x0')]},'destuniqueid':{'type':Sequelize[_0x1bc5('0x0')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1bc5('0x0')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x1bc5('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1bc5('0x0')]},'attachment':{'type':Sequelize[_0x1bc5('0x4')]},'html':{'type':Sequelize[_0x1bc5('0x4')]},'text':{'type':Sequelize[_0x1bc5('0x4')]},'status':{'type':Sequelize[_0x1bc5('0x5')](_0x1bc5('0x6'),_0x1bc5('0x7'),_0x1bc5('0x8'),_0x1bc5('0x9'))},'url':{'type':Sequelize[_0x1bc5('0x0')]},'app':{'type':Sequelize[_0x1bc5('0x0')]},'appdata':{'type':Sequelize[_0x1bc5('0x0')]},'projectId':{'type':Sequelize[_0x1bc5('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index da300a2..95eb297 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 _0x14d5=['rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../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','update','destroy','then','error','name','send','index','map','IntegrationReport'];(function(_0x3747a3,_0x3f47a0){var _0xe4b645=function(_0x315b12){while(--_0x315b12){_0x3747a3['push'](_0x3747a3['shift']());}};_0xe4b645(++_0x3f47a0);}(_0x14d5,0xb7));var _0x514d=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x14d5[_0x5951e8];return _0x20a1f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x514d('0x0'));var jsonpatch=require(_0x514d('0x1'));var rp=require(_0x514d('0x2'));var moment=require('moment');var BPromise=require(_0x514d('0x3'));var Mustache=require(_0x514d('0x4'));var util=require(_0x514d('0x5'));var path=require(_0x514d('0x6'));var sox=require(_0x514d('0x7'));var csv=require(_0x514d('0x8'));var ejs=require(_0x514d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x514d('0xa'));var squel=require(_0x514d('0xb'));var crypto=require('crypto');var jsforce=require(_0x514d('0xc'));var deskjs=require(_0x514d('0xd'));var toCsv=require(_0x514d('0x8'));var querystring=require(_0x514d('0xe'));var Papa=require(_0x514d('0xf'));var Redis=require('ioredis');var authService=require(_0x514d('0x10'));var qs=require(_0x514d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x514d('0x12'));var logger=require(_0x514d('0x13'))(_0x514d('0x14'));var utils=require(_0x514d('0x15'));var config=require(_0x514d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x514d('0x17'))['db'];function respondWithStatusCode(_0xf03a30,_0x118908){_0x118908=_0x118908||0xcc;return function(_0xa2cde4){if(_0xa2cde4){return _0xf03a30[_0x514d('0x18')](_0x118908);}return _0xf03a30[_0x514d('0x19')](_0x118908)[_0x514d('0x1a')]();};}function respondWithResult(_0x194780,_0x1a1d09){_0x1a1d09=_0x1a1d09||0xc8;return function(_0x2e4460){if(_0x2e4460){return _0x194780[_0x514d('0x19')](_0x1a1d09)[_0x514d('0x1b')](_0x2e4460);}};}function respondWithFilteredResult(_0xd7a3e1,_0x4f5e72){return function(_0x4ff048){if(_0x4ff048){var _0x286384=typeof _0x4f5e72['offset']==='undefined'&&typeof _0x4f5e72['limit']===_0x514d('0x1c');var _0x35d726=_0x4ff048[_0x514d('0x1d')];var _0x28e4ff=_0x286384?0x0:_0x4f5e72['offset'];var _0x38f901=_0x286384?_0x4ff048[_0x514d('0x1d')]:_0x4f5e72[_0x514d('0x1e')]+_0x4f5e72[_0x514d('0x1f')];var _0x8b37e5;if(_0x38f901>=_0x35d726){_0x38f901=_0x35d726;_0x8b37e5=0xc8;}else{_0x8b37e5=0xce;}_0xd7a3e1[_0x514d('0x19')](_0x8b37e5);return _0xd7a3e1[_0x514d('0x20')](_0x514d('0x21'),_0x28e4ff+'-'+_0x38f901+'/'+_0x35d726)[_0x514d('0x1b')](_0x4ff048);}return null;};}function patchUpdates(_0x4a54ed){return function(_0x259388){try{jsonpatch[_0x514d('0x22')](_0x259388,_0x4a54ed,!![]);}catch(_0x57221a){return BPromise[_0x514d('0x23')](_0x57221a);}return _0x259388['save']();};}function saveUpdates(_0xa2f940,_0x3b7f10){return function(_0xe8fd4e){if(_0xe8fd4e){return _0xe8fd4e[_0x514d('0x24')](_0xa2f940)['then'](function(_0x484301){return _0x484301;});}return null;};}function removeEntity(_0x12b703,_0x309812){return function(_0x513cb0){if(_0x513cb0){return _0x513cb0[_0x514d('0x25')]()[_0x514d('0x26')](function(){_0x12b703['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45bea4,_0x29f9f5){return function(_0x26f501){if(!_0x26f501){_0x45bea4['sendStatus'](0x194);}return _0x26f501;};}function handleError(_0x4b1f73,_0x4bfedf){_0x4bfedf=_0x4bfedf||0x1f4;return function(_0x311a3c){logger[_0x514d('0x27')](_0x311a3c['stack']);if(_0x311a3c[_0x514d('0x28')]){delete _0x311a3c[_0x514d('0x28')];}_0x4b1f73[_0x514d('0x19')](_0x4bfedf)[_0x514d('0x29')](_0x311a3c);};}exports[_0x514d('0x2a')]=function(_0x90aa33,_0x4a0071){var _0x98e1ce={},_0x3a3ea9={},_0x4be596={'count':0x0,'rows':[]};var _0x4597cb=_[_0x514d('0x2b')](db[_0x514d('0x2c')][_0x514d('0x2d')],function(_0x2fedfa){return{'name':_0x2fedfa[_0x514d('0x2e')],'type':_0x2fedfa[_0x514d('0x2f')]['key']};});_0x3a3ea9['model']=_[_0x514d('0x2b')](_0x4597cb,_0x514d('0x28'));_0x3a3ea9['query']=_[_0x514d('0x30')](_0x90aa33[_0x514d('0x31')]);_0x3a3ea9[_0x514d('0x32')]=_[_0x514d('0x33')](_0x3a3ea9['model'],_0x3a3ea9[_0x514d('0x31')]);_0x98e1ce[_0x514d('0x34')]=_[_0x514d('0x33')](_0x3a3ea9[_0x514d('0x35')],qs['fields'](_0x90aa33[_0x514d('0x31')][_0x514d('0x36')]));_0x98e1ce['attributes']=_0x98e1ce[_0x514d('0x34')][_0x514d('0x37')]?_0x98e1ce[_0x514d('0x34')]:_0x3a3ea9[_0x514d('0x35')];if(!_0x90aa33[_0x514d('0x31')][_0x514d('0x38')](_0x514d('0x39'))){_0x98e1ce[_0x514d('0x1f')]=qs[_0x514d('0x1f')](_0x90aa33['query']['limit']);_0x98e1ce['offset']=qs['offset'](_0x90aa33[_0x514d('0x31')][_0x514d('0x1e')]);}_0x98e1ce[_0x514d('0x3a')]=qs['sort'](_0x90aa33[_0x514d('0x31')][_0x514d('0x3b')]);_0x98e1ce[_0x514d('0x3c')]=qs[_0x514d('0x32')](_[_0x514d('0x3d')](_0x90aa33['query'],_0x3a3ea9[_0x514d('0x32')]),_0x4597cb);if(_0x90aa33[_0x514d('0x31')][_0x514d('0x3e')]){_0x98e1ce[_0x514d('0x3c')]=_[_0x514d('0x3f')](_0x98e1ce[_0x514d('0x3c')],{'$or':_[_0x514d('0x2b')](_0x4597cb,function(_0x496797){if(_0x496797[_0x514d('0x2f')]!==_0x514d('0x40')){var _0xdacb14={};_0xdacb14[_0x496797['name']]={'$like':'%'+_0x90aa33['query'][_0x514d('0x3e')]+'%'};return _0xdacb14;}})});}_0x98e1ce=_[_0x514d('0x3f')]({},_0x98e1ce,_0x90aa33['options']);var _0x31602b={'where':_0x98e1ce[_0x514d('0x3c')]};return db[_0x514d('0x2c')][_0x514d('0x1d')](_0x31602b)['then'](function(_0x26cd1c){_0x4be596[_0x514d('0x1d')]=_0x26cd1c;if(_0x90aa33[_0x514d('0x31')]['includeAll']){_0x98e1ce[_0x514d('0x41')]=[{'all':!![]}];}return db[_0x514d('0x2c')][_0x514d('0x42')](_0x98e1ce);})[_0x514d('0x26')](function(_0x5636c2){_0x4be596['rows']=_0x5636c2;return _0x4be596;})[_0x514d('0x26')](respondWithFilteredResult(_0x4a0071,_0x98e1ce))[_0x514d('0x43')](handleError(_0x4a0071,null));};exports[_0x514d('0x44')]=function(_0x925ea1,_0x100416){var _0x477220={'raw':![],'where':{'id':_0x925ea1[_0x514d('0x45')]['id']}},_0x1dfadf={};_0x1dfadf['model']=_[_0x514d('0x30')](db['IntegrationReport'][_0x514d('0x2d')]);_0x1dfadf[_0x514d('0x31')]=_[_0x514d('0x30')](_0x925ea1[_0x514d('0x31')]);_0x1dfadf[_0x514d('0x32')]=_['intersection'](_0x1dfadf[_0x514d('0x35')],_0x1dfadf[_0x514d('0x31')]);_0x477220[_0x514d('0x34')]=_[_0x514d('0x33')](_0x1dfadf[_0x514d('0x35')],qs[_0x514d('0x36')](_0x925ea1[_0x514d('0x31')][_0x514d('0x36')]));_0x477220[_0x514d('0x34')]=_0x477220[_0x514d('0x34')][_0x514d('0x37')]?_0x477220[_0x514d('0x34')]:_0x1dfadf[_0x514d('0x35')];if(_0x925ea1[_0x514d('0x31')][_0x514d('0x46')]){_0x477220[_0x514d('0x41')]=[{'all':!![]}];}_0x477220=_[_0x514d('0x3f')]({},_0x477220,_0x925ea1[_0x514d('0x47')]);return db['IntegrationReport'][_0x514d('0x48')](_0x477220)[_0x514d('0x26')](handleEntityNotFound(_0x100416,null))[_0x514d('0x26')](respondWithResult(_0x100416,null))['catch'](handleError(_0x100416,null));};exports[_0x514d('0x49')]=function(_0xd82f20,_0x3b2e6e){return db['IntegrationReport']['create'](_0xd82f20[_0x514d('0x4a')],{})[_0x514d('0x26')](respondWithResult(_0x3b2e6e,0xc9))[_0x514d('0x43')](handleError(_0x3b2e6e,null));};exports[_0x514d('0x24')]=function(_0xf66e04,_0x185f04){if(_0xf66e04['body']['id']){delete _0xf66e04[_0x514d('0x4a')]['id'];}return db['IntegrationReport'][_0x514d('0x48')]({'where':{'id':_0xf66e04[_0x514d('0x45')]['id']}})['then'](handleEntityNotFound(_0x185f04,null))[_0x514d('0x26')](saveUpdates(_0xf66e04[_0x514d('0x4a')],null))['then'](respondWithResult(_0x185f04,null))[_0x514d('0x43')](handleError(_0x185f04,null));};exports['destroy']=function(_0x560dc9,_0x119ab5){return db[_0x514d('0x2c')][_0x514d('0x48')]({'where':{'id':_0x560dc9[_0x514d('0x45')]['id']}})[_0x514d('0x26')](handleEntityNotFound(_0x119ab5,null))[_0x514d('0x26')](removeEntity(_0x119ab5,null))['catch'](handleError(_0x119ab5,null));};exports['describe']=function(_0x4db045,_0x197bf1){return db[_0x514d('0x2c')][_0x514d('0x4b')]()[_0x514d('0x26')](respondWithResult(_0x197bf1,null))[_0x514d('0x43')](handleError(_0x197bf1,null));}; \ No newline at end of file +var _0x5a56=['squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','destroy','then','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x41934a,_0x3caf8d){var _0x3331d3=function(_0xf82cd8){while(--_0xf82cd8){_0x41934a['push'](_0x41934a['shift']());}};_0x3331d3(++_0x3caf8d);}(_0x5a56,0x1b0));var _0x65a5=function(_0x40c9e9,_0x482019){_0x40c9e9=_0x40c9e9-0x0;var _0x365446=_0x5a56[_0x40c9e9];return _0x365446;};'use strict';var emlformat=require(_0x65a5('0x0'));var rimraf=require(_0x65a5('0x1'));var zipdir=require(_0x65a5('0x2'));var jsonpatch=require(_0x65a5('0x3'));var rp=require('request-promise');var moment=require(_0x65a5('0x4'));var BPromise=require(_0x65a5('0x5'));var Mustache=require(_0x65a5('0x6'));var util=require(_0x65a5('0x7'));var path=require(_0x65a5('0x8'));var sox=require(_0x65a5('0x9'));var csv=require(_0x65a5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65a5('0xb'));var _=require('lodash');var squel=require(_0x65a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x65a5('0xd'));var deskjs=require(_0x65a5('0xe'));var toCsv=require(_0x65a5('0xa'));var querystring=require('querystring');var Papa=require(_0x65a5('0xf'));var Redis=require(_0x65a5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65a5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65a5('0x12'))(_0x65a5('0x13'));var utils=require(_0x65a5('0x14'));var config=require(_0x65a5('0x15'));var licenseUtil=require(_0x65a5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7c6e,_0x4da28c){_0x4da28c=_0x4da28c||0xcc;return function(_0x24f152){if(_0x24f152){return _0x1b7c6e[_0x65a5('0x17')](_0x4da28c);}return _0x1b7c6e[_0x65a5('0x18')](_0x4da28c)[_0x65a5('0x19')]();};}function respondWithResult(_0x4530b4,_0x501b93){_0x501b93=_0x501b93||0xc8;return function(_0x128606){if(_0x128606){return _0x4530b4['status'](_0x501b93)['json'](_0x128606);}};}function respondWithFilteredResult(_0x231e2e,_0x33d4df){return function(_0x59833b){if(_0x59833b){var _0x4c8583=typeof _0x33d4df[_0x65a5('0x1a')]===_0x65a5('0x1b')&&typeof _0x33d4df[_0x65a5('0x1c')]==='undefined';var _0x3f6457=_0x59833b[_0x65a5('0x1d')];var _0x43c01e=_0x4c8583?0x0:_0x33d4df[_0x65a5('0x1a')];var _0xbdb3d9=_0x4c8583?_0x59833b[_0x65a5('0x1d')]:_0x33d4df['offset']+_0x33d4df[_0x65a5('0x1c')];var _0x256bbe;if(_0xbdb3d9>=_0x3f6457){_0xbdb3d9=_0x3f6457;_0x256bbe=0xc8;}else{_0x256bbe=0xce;}_0x231e2e['status'](_0x256bbe);return _0x231e2e['set'](_0x65a5('0x1e'),_0x43c01e+'-'+_0xbdb3d9+'/'+_0x3f6457)[_0x65a5('0x1f')](_0x59833b);}return null;};}function patchUpdates(_0x19ab3e){return function(_0x459943){try{jsonpatch[_0x65a5('0x20')](_0x459943,_0x19ab3e,!![]);}catch(_0x40e58a){return BPromise['reject'](_0x40e58a);}return _0x459943['save']();};}function saveUpdates(_0x3bd5a3,_0x5de21c){return function(_0x443b8e){if(_0x443b8e){return _0x443b8e[_0x65a5('0x21')](_0x3bd5a3)['then'](function(_0x404459){return _0x404459;});}return null;};}function removeEntity(_0x44069b,_0x52ee9d){return function(_0xfc6359){if(_0xfc6359){return _0xfc6359[_0x65a5('0x22')]()[_0x65a5('0x23')](function(){_0x44069b[_0x65a5('0x18')](0xcc)[_0x65a5('0x19')]();});}};}function handleEntityNotFound(_0x3abe8d,_0xff5097){return function(_0x5cb5ee){if(!_0x5cb5ee){_0x3abe8d[_0x65a5('0x17')](0x194);}return _0x5cb5ee;};}function handleError(_0xabf42b,_0x17a372){_0x17a372=_0x17a372||0x1f4;return function(_0x57e351){logger['error'](_0x57e351[_0x65a5('0x24')]);if(_0x57e351[_0x65a5('0x25')]){delete _0x57e351[_0x65a5('0x25')];}_0xabf42b[_0x65a5('0x18')](_0x17a372)[_0x65a5('0x26')](_0x57e351);};}exports[_0x65a5('0x27')]=function(_0x1773b5,_0x2ca93b){var _0x58940f={},_0x1a06db={},_0xf819b1={'count':0x0,'rows':[]};var _0x2d579f=_[_0x65a5('0x28')](db[_0x65a5('0x29')][_0x65a5('0x2a')],function(_0x4c84bb){return{'name':_0x4c84bb[_0x65a5('0x2b')],'type':_0x4c84bb['type'][_0x65a5('0x2c')]};});_0x1a06db['model']=_[_0x65a5('0x28')](_0x2d579f,_0x65a5('0x25'));_0x1a06db[_0x65a5('0x2d')]=_[_0x65a5('0x2e')](_0x1773b5[_0x65a5('0x2d')]);_0x1a06db['filters']=_[_0x65a5('0x2f')](_0x1a06db[_0x65a5('0x30')],_0x1a06db['query']);_0x58940f[_0x65a5('0x31')]=_[_0x65a5('0x2f')](_0x1a06db[_0x65a5('0x30')],qs[_0x65a5('0x32')](_0x1773b5[_0x65a5('0x2d')][_0x65a5('0x32')]));_0x58940f[_0x65a5('0x31')]=_0x58940f['attributes'][_0x65a5('0x33')]?_0x58940f[_0x65a5('0x31')]:_0x1a06db['model'];if(!_0x1773b5['query'][_0x65a5('0x34')](_0x65a5('0x35'))){_0x58940f[_0x65a5('0x1c')]=qs[_0x65a5('0x1c')](_0x1773b5[_0x65a5('0x2d')][_0x65a5('0x1c')]);_0x58940f[_0x65a5('0x1a')]=qs[_0x65a5('0x1a')](_0x1773b5[_0x65a5('0x2d')][_0x65a5('0x1a')]);}_0x58940f[_0x65a5('0x36')]=qs[_0x65a5('0x37')](_0x1773b5['query']['sort']);_0x58940f[_0x65a5('0x38')]=qs[_0x65a5('0x39')](_[_0x65a5('0x3a')](_0x1773b5[_0x65a5('0x2d')],_0x1a06db['filters']),_0x2d579f);if(_0x1773b5[_0x65a5('0x2d')][_0x65a5('0x3b')]){_0x58940f[_0x65a5('0x38')]=_['merge'](_0x58940f[_0x65a5('0x38')],{'$or':_[_0x65a5('0x28')](_0x2d579f,function(_0x17215a){if(_0x17215a[_0x65a5('0x3c')]!==_0x65a5('0x3d')){var _0x2b8f7d={};_0x2b8f7d[_0x17215a[_0x65a5('0x25')]]={'$like':'%'+_0x1773b5[_0x65a5('0x2d')][_0x65a5('0x3b')]+'%'};return _0x2b8f7d;}})});}_0x58940f=_[_0x65a5('0x3e')]({},_0x58940f,_0x1773b5[_0x65a5('0x3f')]);var _0x429de8={'where':_0x58940f[_0x65a5('0x38')]};return db[_0x65a5('0x29')][_0x65a5('0x1d')](_0x429de8)[_0x65a5('0x23')](function(_0x374de3){_0xf819b1[_0x65a5('0x1d')]=_0x374de3;if(_0x1773b5[_0x65a5('0x2d')][_0x65a5('0x40')]){_0x58940f[_0x65a5('0x41')]=[{'all':!![]}];}return db[_0x65a5('0x29')]['findAll'](_0x58940f);})[_0x65a5('0x23')](function(_0x5d9b42){_0xf819b1[_0x65a5('0x42')]=_0x5d9b42;return _0xf819b1;})[_0x65a5('0x23')](respondWithFilteredResult(_0x2ca93b,_0x58940f))['catch'](handleError(_0x2ca93b,null));};exports[_0x65a5('0x43')]=function(_0x111959,_0x14ca72){var _0x2d8d14={'raw':![],'where':{'id':_0x111959[_0x65a5('0x44')]['id']}},_0x17c897={};_0x17c897[_0x65a5('0x30')]=_['keys'](db[_0x65a5('0x29')][_0x65a5('0x2a')]);_0x17c897['query']=_[_0x65a5('0x2e')](_0x111959[_0x65a5('0x2d')]);_0x17c897[_0x65a5('0x39')]=_['intersection'](_0x17c897[_0x65a5('0x30')],_0x17c897['query']);_0x2d8d14[_0x65a5('0x31')]=_[_0x65a5('0x2f')](_0x17c897[_0x65a5('0x30')],qs[_0x65a5('0x32')](_0x111959[_0x65a5('0x2d')][_0x65a5('0x32')]));_0x2d8d14[_0x65a5('0x31')]=_0x2d8d14[_0x65a5('0x31')][_0x65a5('0x33')]?_0x2d8d14[_0x65a5('0x31')]:_0x17c897[_0x65a5('0x30')];if(_0x111959[_0x65a5('0x2d')][_0x65a5('0x40')]){_0x2d8d14[_0x65a5('0x41')]=[{'all':!![]}];}_0x2d8d14=_[_0x65a5('0x3e')]({},_0x2d8d14,_0x111959[_0x65a5('0x3f')]);return db[_0x65a5('0x29')][_0x65a5('0x45')](_0x2d8d14)[_0x65a5('0x23')](handleEntityNotFound(_0x14ca72,null))[_0x65a5('0x23')](respondWithResult(_0x14ca72,null))[_0x65a5('0x46')](handleError(_0x14ca72,null));};exports[_0x65a5('0x47')]=function(_0x5dbab3,_0x5bdf06){return db['IntegrationReport'][_0x65a5('0x47')](_0x5dbab3[_0x65a5('0x48')],{})[_0x65a5('0x23')](respondWithResult(_0x5bdf06,0xc9))[_0x65a5('0x46')](handleError(_0x5bdf06,null));};exports[_0x65a5('0x21')]=function(_0x42b444,_0x5a9a45){if(_0x42b444[_0x65a5('0x48')]['id']){delete _0x42b444['body']['id'];}return db['IntegrationReport'][_0x65a5('0x45')]({'where':{'id':_0x42b444[_0x65a5('0x44')]['id']}})[_0x65a5('0x23')](handleEntityNotFound(_0x5a9a45,null))[_0x65a5('0x23')](saveUpdates(_0x42b444[_0x65a5('0x48')],null))['then'](respondWithResult(_0x5a9a45,null))[_0x65a5('0x46')](handleError(_0x5a9a45,null));};exports[_0x65a5('0x22')]=function(_0x543373,_0x43581c){return db['IntegrationReport'][_0x65a5('0x45')]({'where':{'id':_0x543373['params']['id']}})['then'](handleEntityNotFound(_0x43581c,null))['then'](removeEntity(_0x43581c,null))[_0x65a5('0x46')](handleError(_0x43581c,null));};exports[_0x65a5('0x49')]=function(_0x1ed3dd,_0x2b4a3b){return db['IntegrationReport']['describe']()[_0x65a5('0x23')](respondWithResult(_0x2b4a3b,null))[_0x65a5('0x46')](handleError(_0x2b4a3b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ed85dbf..c26ab87 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 _0x5db7=['./integrationReport.attributes','exports','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14a623,_0x3ba271){var _0x5a6b5a=function(_0x5cca40){while(--_0x5cca40){_0x14a623['push'](_0x14a623['shift']());}};_0x5a6b5a(++_0x3ba271);}(_0x5db7,0x12e));var _0x75db=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x5db7[_0x3cba93];return _0x4a2991;};'use strict';var _=require(_0x75db('0x0'));var util=require(_0x75db('0x1'));var logger=require(_0x75db('0x2'))(_0x75db('0x3'));var moment=require(_0x75db('0x4'));var BPromise=require(_0x75db('0x5'));var rp=require(_0x75db('0x6'));var fs=require('fs');var path=require(_0x75db('0x7'));var rimraf=require(_0x75db('0x8'));var config=require(_0x75db('0x9'));var attributes=require(_0x75db('0xa'));module[_0x75db('0xb')]=function(_0x5e55ef,_0x3e2101){return _0x5e55ef['define']('IntegrationReport',attributes,{'tableName':_0x75db('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b55=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','report_integration','lodash'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0x5b55,0x128));var _0x55b5=function(_0x1d1a9c,_0x2274db){_0x1d1a9c=_0x1d1a9c-0x0;var _0x3e0c65=_0x5b55[_0x1d1a9c];return _0x3e0c65;};'use strict';var _=require(_0x55b5('0x0'));var util=require(_0x55b5('0x1'));var logger=require(_0x55b5('0x2'))(_0x55b5('0x3'));var moment=require(_0x55b5('0x4'));var BPromise=require(_0x55b5('0x5'));var rp=require(_0x55b5('0x6'));var fs=require('fs');var path=require(_0x55b5('0x7'));var rimraf=require(_0x55b5('0x8'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x55b5('0x9')]=function(_0x12464a,_0x348f52){return _0x12464a['define']('IntegrationReport',attributes,{'tableName':_0x55b5('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 e064aaa..e4d7325 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x687b,0x14a));var _0xb687=function(_0x15a2cb,_0x571a10){_0x15a2cb=_0x15a2cb-0x0;var _0x26d3f6=_0x687b[_0x15a2cb];return _0x26d3f6;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x4c8c4d,_0x170fc3){var _0x7c72d2=function(_0x249fd1){while(--_0x249fd1){_0x4c8c4d['push'](_0x4c8c4d['shift']());}};_0x7c72d2(++_0x170fc3);}(_0x524e,0x15e));var _0xe524=function(_0x47322a,_0x340ac0){_0x47322a=_0x47322a-0x0;var _0x269e63=_0x524e[_0x47322a];return _0x269e63;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 0a27735..5fb1679 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 _0x115f=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','/:id','show','/:id/sub_intervals','create','post','addInterval','addIntervals','put','update'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x115f,0x76));var _0xf115=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x115f[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xf115('0x0'));var util=require(_0xf115('0x1'));var path=require(_0xf115('0x2'));var timeout=require(_0xf115('0x3'));var express=require(_0xf115('0x4'));var router=express[_0xf115('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf115('0x6'));var config=require(_0xf115('0x7'));var controller=require(_0xf115('0x8'));router['get']('/',auth[_0xf115('0x9')](),controller[_0xf115('0xa')]);router['get'](_0xf115('0xb'),auth['isAuthenticated'](),controller[_0xf115('0xc')]);router['get'](_0xf115('0xd'),auth[_0xf115('0x9')](),controller['getIntervals']);router['post']('/',auth[_0xf115('0x9')](),controller[_0xf115('0xe')]);router[_0xf115('0xf')](_0xf115('0xd'),auth['isAuthenticated'](),controller[_0xf115('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0xf115('0x9')](),controller[_0xf115('0x11')]);router[_0xf115('0x12')](_0xf115('0xb'),auth[_0xf115('0x9')](),controller[_0xf115('0x13')]);router[_0xf115('0x14')](_0xf115('0xb'),auth['isAuthenticated'](),controller[_0xf115('0x15')]);module[_0xf115('0x16')]=router; \ No newline at end of file +var _0x195f=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','/:id','delete'];(function(_0x3ce53b,_0x30bbcc){var _0x7fa584=function(_0x2250d7){while(--_0x2250d7){_0x3ce53b['push'](_0x3ce53b['shift']());}};_0x7fa584(++_0x30bbcc);}(_0x195f,0x113));var _0xf195=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x195f[_0x34c4e1];return _0x5a11ef;};'use strict';var multer=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var path=require('path');var timeout=require(_0xf195('0x2'));var express=require(_0xf195('0x3'));var router=express['Router']();var fs_extra=require(_0xf195('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf195('0x5'));var config=require(_0xf195('0x6'));var controller=require(_0xf195('0x7'));router[_0xf195('0x8')]('/',auth[_0xf195('0x9')](),controller[_0xf195('0xa')]);router[_0xf195('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf195('0xb')]);router[_0xf195('0x8')](_0xf195('0xc'),auth[_0xf195('0x9')](),controller[_0xf195('0xd')]);router[_0xf195('0xe')]('/',auth[_0xf195('0x9')](),controller['create']);router[_0xf195('0xe')](_0xf195('0xc'),auth[_0xf195('0x9')](),controller['addInterval']);router[_0xf195('0xe')](_0xf195('0xf'),auth[_0xf195('0x9')](),controller[_0xf195('0x10')]);router['put'](_0xf195('0x11'),auth[_0xf195('0x9')](),controller['update']);router[_0xf195('0x12')]('/:id',auth[_0xf195('0x9')](),controller[_0xf195('0x13')]);module[_0xf195('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 19621c1..063d648 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 _0x0817=['STRING','sequelize'];(function(_0x4da6ba,_0x554ea7){var _0x4b8317=function(_0x573de2){while(--_0x573de2){_0x4da6ba['push'](_0x4da6ba['shift']());}};_0x4b8317(++_0x554ea7);}(_0x0817,0x1e9));var _0x7081=function(_0x1d6c49,_0x1d95e8){_0x1d6c49=_0x1d6c49-0x0;var _0x56010e=_0x0817[_0x1d6c49];return _0x56010e;};'use strict';var Sequelize=require(_0x7081('0x0'));module['exports']={'name':{'type':Sequelize[_0x7081('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7081('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8feb=['sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8feb,0x153));var _0xb8fe=function(_0x4e2766,_0x515f98){_0x4e2766=_0x4e2766-0x0;var _0x53d3e1=_0x8feb[_0x4e2766];return _0x53d3e1;};'use strict';var Sequelize=require(_0xb8fe('0x0'));module[_0xb8fe('0x1')]={'name':{'type':Sequelize[_0xb8fe('0x2')]},'description':{'type':Sequelize[_0xb8fe('0x2')]},'interval':{'type':Sequelize[_0xb8fe('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 66663b3..9e30273 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 _0x4446=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','then','Intervals','destroy','end','error','stack','name','send','Interval','rawAttributes','map','query','keys','model','attributes','intersection','fields','length','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','order','hasOwnProperty','nolimit','addIntervals','sequelize','transaction','bulkCreate'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x4446,0xb2));var _0x6444=function(_0x4dff8f,_0x25f6c5){_0x4dff8f=_0x4dff8f-0x0;var _0x51647b=_0x4446[_0x4dff8f];return _0x51647b;};'use strict';var emlformat=require(_0x6444('0x0'));var rimraf=require(_0x6444('0x1'));var zipdir=require(_0x6444('0x2'));var jsonpatch=require(_0x6444('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6444('0x4'));var Mustache=require(_0x6444('0x5'));var util=require(_0x6444('0x6'));var path=require(_0x6444('0x7'));var sox=require(_0x6444('0x8'));var csv=require(_0x6444('0x9'));var ejs=require(_0x6444('0xa'));var fs=require('fs');var fs_extra=require(_0x6444('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6444('0xc'));var jsforce=require(_0x6444('0xd'));var deskjs=require(_0x6444('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6444('0xf'));var Papa=require(_0x6444('0x10'));var Redis=require(_0x6444('0x11'));var authService=require(_0x6444('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6444('0x13'));var logger=require(_0x6444('0x14'))(_0x6444('0x15'));var utils=require(_0x6444('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6444('0x17'))['db'];var extensions=require(_0x6444('0x18'));function respondWithStatusCode(_0x255701,_0x248a68){_0x248a68=_0x248a68||0xcc;return function(_0x266189){if(_0x266189){return _0x255701[_0x6444('0x19')](_0x248a68);}return _0x255701['status'](_0x248a68)['end']();};}function respondWithResult(_0x1ffabf,_0x5ce7cd){_0x5ce7cd=_0x5ce7cd||0xc8;return function(_0x2ebd61){if(_0x2ebd61){return _0x1ffabf[_0x6444('0x1a')](_0x5ce7cd)[_0x6444('0x1b')](_0x2ebd61);}};}function respondWithFilteredResult(_0x389397,_0x4aca8d){return function(_0x206075){if(_0x206075){var _0x264ed6=typeof _0x4aca8d[_0x6444('0x1c')]===_0x6444('0x1d')&&typeof _0x4aca8d['limit']===_0x6444('0x1d');var _0x3f34d4=_0x206075['count'];var _0x1999f5=_0x264ed6?0x0:_0x4aca8d[_0x6444('0x1c')];var _0x123f81=_0x264ed6?_0x206075[_0x6444('0x1e')]:_0x4aca8d['offset']+_0x4aca8d[_0x6444('0x1f')];var _0xedd118;if(_0x123f81>=_0x3f34d4){_0x123f81=_0x3f34d4;_0xedd118=0xc8;}else{_0xedd118=0xce;}_0x389397[_0x6444('0x1a')](_0xedd118);return _0x389397['set'](_0x6444('0x20'),_0x1999f5+'-'+_0x123f81+'/'+_0x3f34d4)[_0x6444('0x1b')](_0x206075);}return null;};}function patchUpdates(_0x94491b){return function(_0x3060ac){try{jsonpatch[_0x6444('0x21')](_0x3060ac,_0x94491b,!![]);}catch(_0x583b1c){return BPromise['reject'](_0x583b1c);}return _0x3060ac[_0x6444('0x22')]();};}function saveUpdates(_0x14dd75,_0x45a098){return function(_0x58b5c7){if(_0x58b5c7){return _0x58b5c7['update'](_0x14dd75)[_0x6444('0x23')](function(_0x4e87de){return _0x4e87de;});}return null;};}function removeEntity(_0x24ddbd,_0x28aca9){return function(_0x155d63){if(_0x155d63){return _0x155d63['destroy']()[_0x6444('0x23')](function(){var _0x18d089=_0x155d63['get']({'plain':!![]});var _0x206671=_0x6444('0x24');return db['UserProfileResource'][_0x6444('0x25')]({'where':{'type':_0x206671,'resourceId':_0x18d089['id']}})['then'](function(){return _0x155d63;});})['then'](function(){_0x24ddbd[_0x6444('0x1a')](0xcc)[_0x6444('0x26')]();});}};}function handleEntityNotFound(_0x30b064,_0x203f85){return function(_0x1f32a7){if(!_0x1f32a7){_0x30b064['sendStatus'](0x194);}return _0x1f32a7;};}function handleError(_0x5a24c5,_0x5f1936){_0x5f1936=_0x5f1936||0x1f4;return function(_0x553870){logger[_0x6444('0x27')](_0x553870[_0x6444('0x28')]);if(_0x553870[_0x6444('0x29')]){delete _0x553870['name'];}_0x5a24c5[_0x6444('0x1a')](_0x5f1936)[_0x6444('0x2a')](_0x553870);};}exports['index']=function(_0xb16ab,_0x358e90){var _0x41404e={},_0x1f4e68={},_0xabf38c={'count':0x0,'rows':[]};var _0x28ab33=_['map'](db[_0x6444('0x2b')][_0x6444('0x2c')],function(_0x513c88){return{'name':_0x513c88['fieldName'],'type':_0x513c88['type']['key']};});_0x1f4e68['model']=_[_0x6444('0x2d')](_0x28ab33,_0x6444('0x29'));_0x1f4e68[_0x6444('0x2e')]=_[_0x6444('0x2f')](_0xb16ab[_0x6444('0x2e')]);_0x1f4e68['filters']=_['intersection'](_0x1f4e68[_0x6444('0x30')],_0x1f4e68[_0x6444('0x2e')]);_0x41404e[_0x6444('0x31')]=_[_0x6444('0x32')](_0x1f4e68['model'],qs[_0x6444('0x33')](_0xb16ab['query'][_0x6444('0x33')]));_0x41404e[_0x6444('0x31')]=_0x41404e['attributes'][_0x6444('0x34')]?_0x41404e[_0x6444('0x31')]:_0x1f4e68[_0x6444('0x30')];if(!_0xb16ab[_0x6444('0x2e')]['hasOwnProperty']('nolimit')){_0x41404e[_0x6444('0x1f')]=qs[_0x6444('0x1f')](_0xb16ab[_0x6444('0x2e')][_0x6444('0x1f')]);_0x41404e['offset']=qs[_0x6444('0x1c')](_0xb16ab[_0x6444('0x2e')]['offset']);}_0x41404e['order']=qs['sort'](_0xb16ab[_0x6444('0x2e')][_0x6444('0x35')]);_0x41404e['where']=qs[_0x6444('0x36')](_[_0x6444('0x37')](_0xb16ab['query'],_0x1f4e68[_0x6444('0x36')]),_0x28ab33);if(_0xb16ab[_0x6444('0x2e')][_0x6444('0x38')]){_0x41404e[_0x6444('0x39')]=_['merge'](_0x41404e[_0x6444('0x39')],{'$or':_[_0x6444('0x2d')](_0x28ab33,function(_0x1fb80e){if(_0x1fb80e[_0x6444('0x3a')]!==_0x6444('0x3b')){var _0x41866d={};_0x41866d[_0x1fb80e['name']]={'$like':'%'+_0xb16ab[_0x6444('0x2e')][_0x6444('0x38')]+'%'};return _0x41866d;}})});}_0x41404e=_[_0x6444('0x3c')]({},_0x41404e,_0xb16ab[_0x6444('0x3d')]);var _0x19ed9e={'where':_0x41404e[_0x6444('0x39')]};return db[_0x6444('0x2b')]['count'](_0x19ed9e)[_0x6444('0x23')](function(_0x3e8374){_0xabf38c[_0x6444('0x1e')]=_0x3e8374;if(_0xb16ab['query'][_0x6444('0x3e')]){_0x41404e[_0x6444('0x3f')]=[{'all':!![]}];}return db[_0x6444('0x2b')]['findAll'](_0x41404e);})[_0x6444('0x23')](function(_0x3e00bd){_0xabf38c[_0x6444('0x40')]=_0x3e00bd;return _0xabf38c;})[_0x6444('0x23')](respondWithFilteredResult(_0x358e90,_0x41404e))[_0x6444('0x41')](handleError(_0x358e90,null));};exports[_0x6444('0x42')]=function(_0x4f087d,_0x474d6f){var _0x43662e={'raw':!![],'where':{'id':_0x4f087d[_0x6444('0x43')]['id']}},_0x1b6f2f={};_0x1b6f2f[_0x6444('0x30')]=_[_0x6444('0x2f')](db['Interval']['rawAttributes']);_0x1b6f2f[_0x6444('0x2e')]=_['keys'](_0x4f087d[_0x6444('0x2e')]);_0x1b6f2f['filters']=_[_0x6444('0x32')](_0x1b6f2f[_0x6444('0x30')],_0x1b6f2f[_0x6444('0x2e')]);_0x43662e[_0x6444('0x31')]=_[_0x6444('0x32')](_0x1b6f2f[_0x6444('0x30')],qs[_0x6444('0x33')](_0x4f087d[_0x6444('0x2e')][_0x6444('0x33')]));_0x43662e['attributes']=_0x43662e[_0x6444('0x31')][_0x6444('0x34')]?_0x43662e[_0x6444('0x31')]:_0x1b6f2f[_0x6444('0x30')];if(_0x4f087d['query'][_0x6444('0x3e')]){_0x43662e[_0x6444('0x3f')]=[{'all':!![]}];}_0x43662e=_[_0x6444('0x3c')]({},_0x43662e,_0x4f087d[_0x6444('0x3d')]);return db[_0x6444('0x2b')][_0x6444('0x44')](_0x43662e)['then'](handleEntityNotFound(_0x474d6f,null))[_0x6444('0x23')](respondWithResult(_0x474d6f,null))['catch'](handleError(_0x474d6f,null));};exports[_0x6444('0x45')]=function(_0xb83236,_0xf255ae){return db[_0x6444('0x2b')]['create'](_0xb83236[_0x6444('0x46')],{})[_0x6444('0x23')](function(_0x399c77){var _0x45aa04=_0xb83236[_0x6444('0x47')][_0x6444('0x48')]({'plain':!![]});if(!_0x45aa04)throw new Error(_0x6444('0x49'));if(_0x45aa04[_0x6444('0x4a')]==='user'){var _0x51ec86=_0x399c77[_0x6444('0x48')]({'plain':!![]});var _0x47cc71=_0x6444('0x24');return db[_0x6444('0x4b')][_0x6444('0x44')]({'where':{'name':_0x47cc71,'userProfileId':_0x45aa04['userProfileId']},'raw':!![]})[_0x6444('0x23')](function(_0x963fb2){if(_0x963fb2&&_0x963fb2['autoAssociation']===0x0){return db['UserProfileResource'][_0x6444('0x45')]({'name':_0x51ec86[_0x6444('0x29')],'resourceId':_0x51ec86['id'],'type':_0x963fb2[_0x6444('0x29')],'sectionId':_0x963fb2['id']},{})[_0x6444('0x23')](function(){return _0x399c77;});}else{return _0x399c77;}})[_0x6444('0x41')](function(_0x229fd7){logger['error'](_0x6444('0x4c'),_0x229fd7);throw _0x229fd7;});}return _0x399c77;})[_0x6444('0x23')](respondWithResult(_0xf255ae,0xc9))[_0x6444('0x41')](handleError(_0xf255ae,null));};exports[_0x6444('0x4d')]=function(_0x24ca4d,_0x2ecd1d){if(_0x24ca4d[_0x6444('0x46')]['id']){delete _0x24ca4d['body']['id'];}return db[_0x6444('0x2b')][_0x6444('0x44')]({'where':{'id':_0x24ca4d['params']['id']}})[_0x6444('0x23')](handleEntityNotFound(_0x2ecd1d,null))['then'](saveUpdates(_0x24ca4d[_0x6444('0x46')],null))[_0x6444('0x23')](respondWithResult(_0x2ecd1d,null))[_0x6444('0x41')](handleError(_0x2ecd1d,null));};exports[_0x6444('0x25')]=function(_0xb08353,_0x2f93b9){return db['Interval'][_0x6444('0x44')]({'where':{'id':_0xb08353[_0x6444('0x43')]['id']}})[_0x6444('0x23')](handleEntityNotFound(_0x2f93b9,null))[_0x6444('0x23')](removeEntity(_0x2f93b9,null))['catch'](handleError(_0x2f93b9,null));};exports[_0x6444('0x4e')]=function(_0x21e55d,_0x18ee1d,_0x69042c){if(_0x21e55d['body']['id']){delete _0x21e55d[_0x6444('0x46')]['id'];}return db[_0x6444('0x2b')][_0x6444('0x44')]({'where':{'id':_0x21e55d[_0x6444('0x43')]['id']}})[_0x6444('0x23')](handleEntityNotFound(_0x18ee1d,null))[_0x6444('0x23')](function(_0x429238){if(_0x429238){_0x21e55d[_0x6444('0x46')][_0x6444('0x4f')]=_0x429238['id'];return db['Interval'][_0x6444('0x45')](_0x21e55d[_0x6444('0x46')]);}})[_0x6444('0x23')](respondWithResult(_0x18ee1d,null))[_0x6444('0x41')](handleError(_0x18ee1d,null));};exports[_0x6444('0x50')]=function(_0xfe0f65,_0x3ebc4b,_0x1dbd86){var _0x45e796={};var _0x310fc1={};var _0x436b7c;var _0x5baa79;return db['Interval'][_0x6444('0x51')]({'where':{'id':_0xfe0f65[_0x6444('0x43')]['id']}})[_0x6444('0x23')](handleEntityNotFound(_0x3ebc4b,null))[_0x6444('0x23')](function(_0x22620c){if(_0x22620c){_0x436b7c=_0x22620c;_0x310fc1[_0x6444('0x30')]=_[_0x6444('0x2f')](db[_0x6444('0x2b')][_0x6444('0x2c')]);_0x310fc1[_0x6444('0x2e')]=_[_0x6444('0x2f')](_0xfe0f65['query']);_0x310fc1[_0x6444('0x36')]=_['intersection'](_0x310fc1[_0x6444('0x30')],_0x310fc1[_0x6444('0x2e')]);_0x45e796['attributes']=_[_0x6444('0x32')](_0x310fc1[_0x6444('0x30')],qs[_0x6444('0x33')](_0xfe0f65[_0x6444('0x2e')][_0x6444('0x33')]));_0x45e796[_0x6444('0x31')]=_0x45e796[_0x6444('0x31')][_0x6444('0x34')]?_0x45e796[_0x6444('0x31')]:_0x310fc1[_0x6444('0x30')];_0x45e796[_0x6444('0x52')]=qs[_0x6444('0x35')](_0xfe0f65[_0x6444('0x2e')][_0x6444('0x35')]);_0x45e796['where']=qs['filters'](_[_0x6444('0x37')](_0xfe0f65[_0x6444('0x2e')],_0x310fc1[_0x6444('0x36')]));if(_0xfe0f65['query']['filter']){_0x45e796[_0x6444('0x39')]=_[_0x6444('0x3c')](_0x45e796['where'],{'$or':_[_0x6444('0x2d')](_0x45e796[_0x6444('0x31')],function(_0x1b5251){var _0x558bdb={};_0x558bdb[_0x1b5251]={'$like':'%'+_0xfe0f65[_0x6444('0x2e')]['filter']+'%'};return _0x558bdb;})});}_0x45e796=_[_0x6444('0x3c')]({},_0x45e796,_0xfe0f65[_0x6444('0x3d')]);return _0x436b7c[_0x6444('0x50')](_0x45e796);}})[_0x6444('0x23')](function(_0x5dccfa){if(_0x5dccfa){_0x5baa79=_0x5dccfa[_0x6444('0x34')];if(!_0xfe0f65[_0x6444('0x2e')][_0x6444('0x53')](_0x6444('0x54'))){_0x45e796[_0x6444('0x1f')]=qs[_0x6444('0x1f')](_0xfe0f65['query'][_0x6444('0x1f')]);_0x45e796[_0x6444('0x1c')]=qs[_0x6444('0x1c')](_0xfe0f65[_0x6444('0x2e')][_0x6444('0x1c')]);}return _0x436b7c[_0x6444('0x50')](_0x45e796);}})[_0x6444('0x23')](function(_0x17f6a7){if(_0x17f6a7){return _0x17f6a7?{'count':_0x5baa79,'rows':_0x17f6a7}:null;}})['then'](respondWithResult(_0x3ebc4b,null))['catch'](handleError(_0x3ebc4b,null));};exports[_0x6444('0x55')]=function(_0x14c31c,_0x23eff8,_0x2a785b){return db[_0x6444('0x2b')][_0x6444('0x51')]({'where':{'id':_0x14c31c[_0x6444('0x43')]['id']}})[_0x6444('0x23')](handleEntityNotFound(_0x23eff8,null))[_0x6444('0x23')](function(_0x1e1901){if(_0x1e1901){return db[_0x6444('0x56')][_0x6444('0x57')](function(_0x559b41){return db[_0x6444('0x2b')]['destroy']({'where':{'IntervalId':_0x14c31c['params']['id']},'transaction':_0x559b41})['then'](function(_0x3f65a2){var _0x217d0b=_[_0x6444('0x2d')](_0x14c31c[_0x6444('0x46')],function(_0x37df52){delete _0x37df52['id'];_0x37df52[_0x6444('0x4f')]=_0x14c31c[_0x6444('0x43')]['id'];return _0x37df52;});return db[_0x6444('0x2b')][_0x6444('0x58')](_0x217d0b,{'transaction':_0x559b41});});})[_0x6444('0x23')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x14c31c[_0x6444('0x43')]['id']}});});}})[_0x6444('0x23')](respondWithResult(_0x23eff8,null))['catch'](handleError(_0x23eff8,null));}; \ No newline at end of file +var _0x78af=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','send','index','map','Interval','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','addInterval','IntervalId','keys','getIntervals','addIntervals','findOne','transaction','bulkCreate','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x233d84,_0x215212){var _0x36b467=function(_0x2fa4d9){while(--_0x2fa4d9){_0x233d84['push'](_0x233d84['shift']());}};_0x36b467(++_0x215212);}(_0x78af,0x9a));var _0xf78a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x78af[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf78a('0x0'));var rp=require(_0xf78a('0x1'));var moment=require(_0xf78a('0x2'));var BPromise=require(_0xf78a('0x3'));var Mustache=require('mustache');var util=require(_0xf78a('0x4'));var path=require(_0xf78a('0x5'));var sox=require(_0xf78a('0x6'));var csv=require(_0xf78a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf78a('0x8'));var _=require(_0xf78a('0x9'));var squel=require(_0xf78a('0xa'));var crypto=require(_0xf78a('0xb'));var jsforce=require(_0xf78a('0xc'));var deskjs=require(_0xf78a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf78a('0xe'));var Papa=require(_0xf78a('0xf'));var Redis=require(_0xf78a('0x10'));var authService=require(_0xf78a('0x11'));var qs=require(_0xf78a('0x12'));var as=require(_0xf78a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf78a('0x14'))(_0xf78a('0x15'));var utils=require(_0xf78a('0x16'));var config=require(_0xf78a('0x17'));var licenseUtil=require(_0xf78a('0x18'));var db=require(_0xf78a('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x38df31,_0x679c9b){_0x679c9b=_0x679c9b||0xcc;return function(_0x5daaa6){if(_0x5daaa6){return _0x38df31[_0xf78a('0x1a')](_0x679c9b);}return _0x38df31[_0xf78a('0x1b')](_0x679c9b)[_0xf78a('0x1c')]();};}function respondWithResult(_0x14cec8,_0xbd6ef7){_0xbd6ef7=_0xbd6ef7||0xc8;return function(_0x12981f){if(_0x12981f){return _0x14cec8[_0xf78a('0x1b')](_0xbd6ef7)[_0xf78a('0x1d')](_0x12981f);}};}function respondWithFilteredResult(_0xf78e77,_0xa93c6){return function(_0x5bec7){if(_0x5bec7){var _0xf5fb71=typeof _0xa93c6[_0xf78a('0x1e')]===_0xf78a('0x1f')&&typeof _0xa93c6[_0xf78a('0x20')]===_0xf78a('0x1f');var _0x1904bb=_0x5bec7['count'];var _0x3b33a9=_0xf5fb71?0x0:_0xa93c6[_0xf78a('0x1e')];var _0x495c01=_0xf5fb71?_0x5bec7[_0xf78a('0x21')]:_0xa93c6[_0xf78a('0x1e')]+_0xa93c6[_0xf78a('0x20')];var _0x17094d;if(_0x495c01>=_0x1904bb){_0x495c01=_0x1904bb;_0x17094d=0xc8;}else{_0x17094d=0xce;}_0xf78e77['status'](_0x17094d);return _0xf78e77[_0xf78a('0x22')](_0xf78a('0x23'),_0x3b33a9+'-'+_0x495c01+'/'+_0x1904bb)[_0xf78a('0x1d')](_0x5bec7);}return null;};}function patchUpdates(_0x4747a9){return function(_0x5d1d69){try{jsonpatch[_0xf78a('0x24')](_0x5d1d69,_0x4747a9,!![]);}catch(_0x2a249a){return BPromise[_0xf78a('0x25')](_0x2a249a);}return _0x5d1d69[_0xf78a('0x26')]();};}function saveUpdates(_0x769722,_0x3fb377){return function(_0x229dad){if(_0x229dad){return _0x229dad[_0xf78a('0x27')](_0x769722)[_0xf78a('0x28')](function(_0x26e1dd){return _0x26e1dd;});}return null;};}function removeEntity(_0x2aed2c,_0x1de127){return function(_0x46c5e6){if(_0x46c5e6){return _0x46c5e6[_0xf78a('0x29')]()[_0xf78a('0x28')](function(){var _0x43e91b=_0x46c5e6[_0xf78a('0x2a')]({'plain':!![]});var _0x2c90f1=_0xf78a('0x2b');return db[_0xf78a('0x2c')][_0xf78a('0x29')]({'where':{'type':_0x2c90f1,'resourceId':_0x43e91b['id']}})[_0xf78a('0x28')](function(){return _0x46c5e6;});})[_0xf78a('0x28')](function(){_0x2aed2c[_0xf78a('0x1b')](0xcc)[_0xf78a('0x1c')]();});}};}function handleEntityNotFound(_0x2512ee,_0x108f52){return function(_0x4c05e7){if(!_0x4c05e7){_0x2512ee[_0xf78a('0x1a')](0x194);}return _0x4c05e7;};}function handleError(_0x271163,_0x213543){_0x213543=_0x213543||0x1f4;return function(_0xe9d510){logger[_0xf78a('0x2d')](_0xe9d510['stack']);if(_0xe9d510['name']){delete _0xe9d510['name'];}_0x271163[_0xf78a('0x1b')](_0x213543)[_0xf78a('0x2e')](_0xe9d510);};}exports[_0xf78a('0x2f')]=function(_0x231149,_0x15f220){var _0x513da3={},_0x2f1576={},_0x429126={'count':0x0,'rows':[]};var _0x4bc2cc=_[_0xf78a('0x30')](db[_0xf78a('0x31')][_0xf78a('0x32')],function(_0x18ee48){return{'name':_0x18ee48[_0xf78a('0x33')],'type':_0x18ee48['type'][_0xf78a('0x34')]};});_0x2f1576[_0xf78a('0x35')]=_[_0xf78a('0x30')](_0x4bc2cc,_0xf78a('0x36'));_0x2f1576['query']=_['keys'](_0x231149[_0xf78a('0x37')]);_0x2f1576[_0xf78a('0x38')]=_[_0xf78a('0x39')](_0x2f1576['model'],_0x2f1576[_0xf78a('0x37')]);_0x513da3[_0xf78a('0x3a')]=_[_0xf78a('0x39')](_0x2f1576[_0xf78a('0x35')],qs['fields'](_0x231149['query'][_0xf78a('0x3b')]));_0x513da3[_0xf78a('0x3a')]=_0x513da3[_0xf78a('0x3a')][_0xf78a('0x3c')]?_0x513da3[_0xf78a('0x3a')]:_0x2f1576[_0xf78a('0x35')];if(!_0x231149['query'][_0xf78a('0x3d')](_0xf78a('0x3e'))){_0x513da3[_0xf78a('0x20')]=qs['limit'](_0x231149['query'][_0xf78a('0x20')]);_0x513da3['offset']=qs[_0xf78a('0x1e')](_0x231149['query'][_0xf78a('0x1e')]);}_0x513da3[_0xf78a('0x3f')]=qs[_0xf78a('0x40')](_0x231149['query']['sort']);_0x513da3[_0xf78a('0x41')]=qs[_0xf78a('0x38')](_[_0xf78a('0x42')](_0x231149['query'],_0x2f1576[_0xf78a('0x38')]),_0x4bc2cc);if(_0x231149[_0xf78a('0x37')][_0xf78a('0x43')]){_0x513da3[_0xf78a('0x41')]=_['merge'](_0x513da3[_0xf78a('0x41')],{'$or':_[_0xf78a('0x30')](_0x4bc2cc,function(_0xb8f4a8){if(_0xb8f4a8[_0xf78a('0x44')]!==_0xf78a('0x45')){var _0x3f0a87={};_0x3f0a87[_0xb8f4a8[_0xf78a('0x36')]]={'$like':'%'+_0x231149['query'][_0xf78a('0x43')]+'%'};return _0x3f0a87;}})});}_0x513da3=_[_0xf78a('0x46')]({},_0x513da3,_0x231149[_0xf78a('0x47')]);var _0x5cb4e5={'where':_0x513da3['where']};return db['Interval'][_0xf78a('0x21')](_0x5cb4e5)[_0xf78a('0x28')](function(_0x2240cb){_0x429126[_0xf78a('0x21')]=_0x2240cb;if(_0x231149['query'][_0xf78a('0x48')]){_0x513da3[_0xf78a('0x49')]=[{'all':!![]}];}return db['Interval'][_0xf78a('0x4a')](_0x513da3);})['then'](function(_0x1c6a46){_0x429126['rows']=_0x1c6a46;return _0x429126;})[_0xf78a('0x28')](respondWithFilteredResult(_0x15f220,_0x513da3))['catch'](handleError(_0x15f220,null));};exports['show']=function(_0x6ebb41,_0x1b4c04){var _0x19a1e8={'raw':!![],'where':{'id':_0x6ebb41['params']['id']}},_0x4de6d5={};_0x4de6d5[_0xf78a('0x35')]=_['keys'](db['Interval'][_0xf78a('0x32')]);_0x4de6d5['query']=_['keys'](_0x6ebb41['query']);_0x4de6d5['filters']=_[_0xf78a('0x39')](_0x4de6d5[_0xf78a('0x35')],_0x4de6d5[_0xf78a('0x37')]);_0x19a1e8['attributes']=_[_0xf78a('0x39')](_0x4de6d5[_0xf78a('0x35')],qs[_0xf78a('0x3b')](_0x6ebb41[_0xf78a('0x37')]['fields']));_0x19a1e8[_0xf78a('0x3a')]=_0x19a1e8[_0xf78a('0x3a')][_0xf78a('0x3c')]?_0x19a1e8[_0xf78a('0x3a')]:_0x4de6d5[_0xf78a('0x35')];if(_0x6ebb41[_0xf78a('0x37')][_0xf78a('0x48')]){_0x19a1e8[_0xf78a('0x49')]=[{'all':!![]}];}_0x19a1e8=_[_0xf78a('0x46')]({},_0x19a1e8,_0x6ebb41[_0xf78a('0x47')]);return db[_0xf78a('0x31')][_0xf78a('0x4b')](_0x19a1e8)[_0xf78a('0x28')](handleEntityNotFound(_0x1b4c04,null))[_0xf78a('0x28')](respondWithResult(_0x1b4c04,null))[_0xf78a('0x4c')](handleError(_0x1b4c04,null));};exports[_0xf78a('0x4d')]=function(_0x379470,_0x2a6498){return db[_0xf78a('0x31')]['create'](_0x379470[_0xf78a('0x4e')],{})['then'](function(_0x5e8c4b){var _0x5205b1=_0x379470[_0xf78a('0x4f')]['get']({'plain':!![]});if(!_0x5205b1)throw new Error(_0xf78a('0x50'));if(_0x5205b1[_0xf78a('0x51')]===_0xf78a('0x4f')){var _0x41535e=_0x5e8c4b['get']({'plain':!![]});var _0xc0093a=_0xf78a('0x2b');return db[_0xf78a('0x52')][_0xf78a('0x4b')]({'where':{'name':_0xc0093a,'userProfileId':_0x5205b1['userProfileId']},'raw':!![]})[_0xf78a('0x28')](function(_0x22d939){if(_0x22d939&&_0x22d939['autoAssociation']===0x0){return db[_0xf78a('0x2c')][_0xf78a('0x4d')]({'name':_0x41535e[_0xf78a('0x36')],'resourceId':_0x41535e['id'],'type':_0x22d939['name'],'sectionId':_0x22d939['id']},{})['then'](function(){return _0x5e8c4b;});}else{return _0x5e8c4b;}})[_0xf78a('0x4c')](function(_0x37e2c3){logger[_0xf78a('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e2c3);throw _0x37e2c3;});}return _0x5e8c4b;})[_0xf78a('0x28')](respondWithResult(_0x2a6498,0xc9))[_0xf78a('0x4c')](handleError(_0x2a6498,null));};exports['update']=function(_0xd4e11d,_0x49a7dc){if(_0xd4e11d[_0xf78a('0x4e')]['id']){delete _0xd4e11d[_0xf78a('0x4e')]['id'];}return db[_0xf78a('0x31')][_0xf78a('0x4b')]({'where':{'id':_0xd4e11d[_0xf78a('0x53')]['id']}})['then'](handleEntityNotFound(_0x49a7dc,null))[_0xf78a('0x28')](saveUpdates(_0xd4e11d[_0xf78a('0x4e')],null))[_0xf78a('0x28')](respondWithResult(_0x49a7dc,null))[_0xf78a('0x4c')](handleError(_0x49a7dc,null));};exports[_0xf78a('0x29')]=function(_0x5a37d,_0xc8a8f3){return db['Interval']['find']({'where':{'id':_0x5a37d[_0xf78a('0x53')]['id']}})['then'](handleEntityNotFound(_0xc8a8f3,null))[_0xf78a('0x28')](removeEntity(_0xc8a8f3,null))[_0xf78a('0x4c')](handleError(_0xc8a8f3,null));};exports[_0xf78a('0x54')]=function(_0x4302d6,_0x5a30ba,_0x5a294e){if(_0x4302d6[_0xf78a('0x4e')]['id']){delete _0x4302d6['body']['id'];}return db[_0xf78a('0x31')][_0xf78a('0x4b')]({'where':{'id':_0x4302d6[_0xf78a('0x53')]['id']}})[_0xf78a('0x28')](handleEntityNotFound(_0x5a30ba,null))[_0xf78a('0x28')](function(_0x33ff0b){if(_0x33ff0b){_0x4302d6['body'][_0xf78a('0x55')]=_0x33ff0b['id'];return db['Interval'][_0xf78a('0x4d')](_0x4302d6[_0xf78a('0x4e')]);}})[_0xf78a('0x28')](respondWithResult(_0x5a30ba,null))['catch'](handleError(_0x5a30ba,null));};exports['getIntervals']=function(_0x23f374,_0x49e84c,_0x5482b0){var _0x195164={};var _0x471014={};var _0x4e044e;var _0x6493d4;return db[_0xf78a('0x31')]['findOne']({'where':{'id':_0x23f374[_0xf78a('0x53')]['id']}})[_0xf78a('0x28')](handleEntityNotFound(_0x49e84c,null))[_0xf78a('0x28')](function(_0x473d37){if(_0x473d37){_0x4e044e=_0x473d37;_0x471014[_0xf78a('0x35')]=_[_0xf78a('0x56')](db[_0xf78a('0x31')][_0xf78a('0x32')]);_0x471014[_0xf78a('0x37')]=_[_0xf78a('0x56')](_0x23f374[_0xf78a('0x37')]);_0x471014[_0xf78a('0x38')]=_[_0xf78a('0x39')](_0x471014[_0xf78a('0x35')],_0x471014['query']);_0x195164[_0xf78a('0x3a')]=_[_0xf78a('0x39')](_0x471014['model'],qs[_0xf78a('0x3b')](_0x23f374[_0xf78a('0x37')]['fields']));_0x195164[_0xf78a('0x3a')]=_0x195164['attributes'][_0xf78a('0x3c')]?_0x195164[_0xf78a('0x3a')]:_0x471014['model'];_0x195164[_0xf78a('0x3f')]=qs[_0xf78a('0x40')](_0x23f374[_0xf78a('0x37')][_0xf78a('0x40')]);_0x195164['where']=qs['filters'](_[_0xf78a('0x42')](_0x23f374[_0xf78a('0x37')],_0x471014[_0xf78a('0x38')]));if(_0x23f374[_0xf78a('0x37')]['filter']){_0x195164['where']=_[_0xf78a('0x46')](_0x195164['where'],{'$or':_['map'](_0x195164[_0xf78a('0x3a')],function(_0xcdf6d){var _0x3274f2={};_0x3274f2[_0xcdf6d]={'$like':'%'+_0x23f374[_0xf78a('0x37')]['filter']+'%'};return _0x3274f2;})});}_0x195164=_[_0xf78a('0x46')]({},_0x195164,_0x23f374[_0xf78a('0x47')]);return _0x4e044e[_0xf78a('0x57')](_0x195164);}})['then'](function(_0x5d018d){if(_0x5d018d){_0x6493d4=_0x5d018d[_0xf78a('0x3c')];if(!_0x23f374[_0xf78a('0x37')][_0xf78a('0x3d')](_0xf78a('0x3e'))){_0x195164[_0xf78a('0x20')]=qs['limit'](_0x23f374[_0xf78a('0x37')][_0xf78a('0x20')]);_0x195164['offset']=qs[_0xf78a('0x1e')](_0x23f374['query']['offset']);}return _0x4e044e[_0xf78a('0x57')](_0x195164);}})[_0xf78a('0x28')](function(_0x5e96ee){if(_0x5e96ee){return _0x5e96ee?{'count':_0x6493d4,'rows':_0x5e96ee}:null;}})['then'](respondWithResult(_0x49e84c,null))[_0xf78a('0x4c')](handleError(_0x49e84c,null));};exports[_0xf78a('0x58')]=function(_0x5d342b,_0x248fd4,_0x2b8645){return db[_0xf78a('0x31')][_0xf78a('0x59')]({'where':{'id':_0x5d342b[_0xf78a('0x53')]['id']}})['then'](handleEntityNotFound(_0x248fd4,null))[_0xf78a('0x28')](function(_0x3ddc2f){if(_0x3ddc2f){return db['sequelize'][_0xf78a('0x5a')](function(_0x593fe3){return db['Interval']['destroy']({'where':{'IntervalId':_0x5d342b[_0xf78a('0x53')]['id']},'transaction':_0x593fe3})['then'](function(_0x2f6744){var _0x392984=_[_0xf78a('0x30')](_0x5d342b[_0xf78a('0x4e')],function(_0x17e707){delete _0x17e707['id'];_0x17e707['IntervalId']=_0x5d342b['params']['id'];return _0x17e707;});return db['Interval'][_0xf78a('0x5b')](_0x392984,{'transaction':_0x593fe3});});})[_0xf78a('0x28')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x5d342b['params']['id']}});});}})[_0xf78a('0x28')](respondWithResult(_0x248fd4,null))[_0xf78a('0x4c')](handleError(_0x248fd4,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 480d279..d61c9d8 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 _0x040d=['then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','interval','string','getIntervals'];(function(_0x2aedf9,_0x599351){var _0x2b7d76=function(_0x142d2c){while(--_0x142d2c){_0x2aedf9['push'](_0x2aedf9['shift']());}};_0x2b7d76(++_0x599351);}(_0x040d,0xe5));var _0xd040=function(_0x5afbd5,_0x48a693){_0x5afbd5=_0x5afbd5-0x0;var _0x298511=_0x040d[_0x5afbd5];return _0x298511;};'use strict';var attributes=require(_0xd040('0x0'));var extensions=require(_0xd040('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0xd040('0x2')]=function(_0x123bf2){return _0x123bf2[_0xd040('0x3')](_0xd040('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd6b260){extensions[_0xd040('0x5')](_0x123bf2,_0xd6b260);},'afterBulkCreate':function(_0x5385d8,_0x136c58,_0x19c335){_0x19c335();extensions[_0xd040('0x5')](_0x123bf2,_0x5385d8[0x0]);},'afterUpdate':function(_0xf48fca){extensions[_0xd040('0x5')](_0x123bf2,_0xf48fca);},'afterDestroy':function(_0x866287){extensions['rewrite'](_0x123bf2,_0x866287);}},'instanceMethods':{'ifTime':function(_0x5d9948=undefined,_0x3c4d3e=new Date()){if(typeof this[_0xd040('0x6')]===_0xd040('0x7')){return iftime(this[_0xd040('0x6')],_0x5d9948,_0x3c4d3e);}else{return this[_0xd040('0x8')]()[_0xd040('0x9')](function(_0x18d3f8){return Promise[_0xd040('0xa')](_0x18d3f8[_0xd040('0xb')](function(_0x97386b){return _0x97386b[_0xd040('0xc')](_0x5d9948,_0x3c4d3e);}));})['then'](function(_0x4460f1){return _0x4460f1[_0xd040('0xd')](function(_0x42ed0c,_0x546b3e){return _0x42ed0c||_0x546b3e;},![]);});}}}});}; \ No newline at end of file +var _0xcdba=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcdba,0x10a));var _0xacdb=function(_0x2f4c6c,_0x50fe00){_0x2f4c6c=_0x2f4c6c-0x0;var _0x5eeb22=_0xcdba[_0x2f4c6c];return _0x5eeb22;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xacdb('0x0'));var iftime=require(_0xacdb('0x1'))[_0xacdb('0x2')];module[_0xacdb('0x3')]=function(_0x3529ad){return _0x3529ad[_0xacdb('0x4')]('Interval',attributes,{'tableName':_0xacdb('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4415fd){extensions[_0xacdb('0x6')](_0x3529ad,_0x4415fd);},'afterBulkCreate':function(_0xc17e12,_0x3fcccb,_0x316997){_0x316997();extensions[_0xacdb('0x6')](_0x3529ad,_0xc17e12[0x0]);},'afterUpdate':function(_0x278cc9){extensions[_0xacdb('0x6')](_0x3529ad,_0x278cc9);},'afterDestroy':function(_0x4acf8c){extensions[_0xacdb('0x6')](_0x3529ad,_0x4acf8c);}},'instanceMethods':{'ifTime':function(_0x1198ed=undefined,_0x5c7873=new Date()){if(typeof this[_0xacdb('0x7')]===_0xacdb('0x8')){return iftime(this[_0xacdb('0x7')],_0x1198ed,_0x5c7873);}else{return this[_0xacdb('0x9')]()[_0xacdb('0xa')](function(_0x5b9de5){return Promise[_0xacdb('0xb')](_0x5b9de5[_0xacdb('0xc')](function(_0x1d07ed){return _0x1d07ed[_0xacdb('0xd')](_0x1198ed,_0x5c7873);}));})[_0xacdb('0xa')](function(_0x5b1a76){return _0x5b1a76['reduce'](function(_0x21921e,_0x24e0f0){return _0x21921e||_0x24e0f0;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a991c60..6a53438 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 _0x1a35=['catch','message','error','ShowInterval','Interval','where','stringify','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','then','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','findAll','options','raw','limit','map','include','model','attributes','info','debug'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0x1a35,0x131));var _0x51a3=function(_0x138799,_0x454c04){_0x138799=_0x138799-0x0;var _0x4359c7=_0x1a35[_0x138799];return _0x4359c7;};'use strict';var _=require(_0x51a3('0x0'));var util=require(_0x51a3('0x1'));var db=require(_0x51a3('0x2'))['db'];var iftime=require(_0x51a3('0x3'))[_0x51a3('0x4')];var logger=require('../../config/logger')(_0x51a3('0x5'));exports[_0x51a3('0x6')]=function(_0x3b927c){var _0x11a659=this;return new Promise(function(_0x58dfae,_0x5bb0da){return db['Interval'][_0x51a3('0x7')]({'raw':_0x3b927c[_0x51a3('0x8')]?_0x3b927c['options'][_0x51a3('0x9')]===undefined?!![]:![]:!![],'where':_0x3b927c['options']?_0x3b927c[_0x51a3('0x8')]['where']||null:null,'attributes':_0x3b927c[_0x51a3('0x8')]?_0x3b927c[_0x51a3('0x8')]['attributes']||null:null,'limit':_0x3b927c[_0x51a3('0x8')]?_0x3b927c[_0x51a3('0x8')][_0x51a3('0xa')]||null:null,'include':_0x3b927c[_0x51a3('0x8')]?_0x3b927c['options']['include']?_[_0x51a3('0xb')](_0x3b927c[_0x51a3('0x8')][_0x51a3('0xc')],function(_0x108404){return{'model':db[_0x108404[_0x51a3('0xd')]],'as':_0x108404['as'],'attributes':_0x108404[_0x51a3('0xe')],'include':_0x108404[_0x51a3('0xc')]?_['map'](_0x108404[_0x51a3('0xc')],function(_0x461f64){return{'model':db[_0x461f64[_0x51a3('0xd')]],'as':_0x461f64['as'],'attributes':_0x461f64['attributes'],'include':_0x461f64[_0x51a3('0xc')]?_['map'](_0x461f64['include'],function(_0x7fe4ef){return{'model':db[_0x7fe4ef[_0x51a3('0xd')]],'as':_0x7fe4ef['as'],'attributes':_0x7fe4ef[_0x51a3('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xefe246){logger[_0x51a3('0xf')](_0x51a3('0x6'),_0x3b927c);logger[_0x51a3('0x10')](_0x51a3('0x6'),_0x3b927c,JSON['stringify'](_0xefe246));_0x58dfae(_0xefe246);})[_0x51a3('0x11')](function(_0x2969c4){logger['error']('GetInterval',_0x2969c4[_0x51a3('0x12')],_0x3b927c);_0x5bb0da(_0x11a659[_0x51a3('0x13')](0x1f4,_0x2969c4[_0x51a3('0x12')]));});});};exports[_0x51a3('0x14')]=function(_0x59474d){var _0x81e686=this;return new Promise(function(_0x373dce,_0x13ebfe){return db[_0x51a3('0x15')]['find']({'raw':_0x59474d['options']?_0x59474d[_0x51a3('0x8')][_0x51a3('0x9')]===undefined?!![]:![]:!![],'where':_0x59474d[_0x51a3('0x8')]?_0x59474d[_0x51a3('0x8')][_0x51a3('0x16')]||null:null,'attributes':_0x59474d[_0x51a3('0x8')]?_0x59474d[_0x51a3('0x8')][_0x51a3('0xe')]||null:null,'include':_0x59474d[_0x51a3('0x8')]?_0x59474d[_0x51a3('0x8')]['include']?_[_0x51a3('0xb')](_0x59474d[_0x51a3('0x8')][_0x51a3('0xc')],function(_0x482397){return{'model':db[_0x482397[_0x51a3('0xd')]],'as':_0x482397['as'],'attributes':_0x482397[_0x51a3('0xe')],'include':_0x482397['include']?_[_0x51a3('0xb')](_0x482397[_0x51a3('0xc')],function(_0x216f9d){return{'model':db[_0x216f9d['model']],'as':_0x216f9d['as'],'attributes':_0x216f9d[_0x51a3('0xe')],'include':_0x216f9d[_0x51a3('0xc')]?_[_0x51a3('0xb')](_0x216f9d[_0x51a3('0xc')],function(_0x522fc9){return{'model':db[_0x522fc9[_0x51a3('0xd')]],'as':_0x522fc9['as'],'attributes':_0x522fc9[_0x51a3('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18305f){logger['info'](_0x51a3('0x14'),_0x59474d);logger[_0x51a3('0x10')](_0x51a3('0x14'),_0x59474d,JSON[_0x51a3('0x17')](_0x18305f));_0x373dce(_0x18305f);})[_0x51a3('0x11')](function(_0xb7f95d){logger[_0x51a3('0x13')](_0x51a3('0x14'),_0xb7f95d['message'],_0x59474d);_0x13ebfe(_0x81e686[_0x51a3('0x13')](0x1f4,_0xb7f95d[_0x51a3('0x12')]));});});};function checkArrayOfIntervals(_0x37bbfc,_0x68721b){var _0x577db7=[];return db[_0x51a3('0x15')]['findAll']({'where':{'id':_0x37bbfc}})['then'](function(_0x3adf52){_0x577db7=_0x3adf52;return Promise[_0x51a3('0x18')](_0x577db7[_0x51a3('0xb')](function(_0x291c0c){return _0x291c0c[_0x51a3('0x19')](_0x68721b);}));})['then'](function(_0x113aa5){var _0x1a94a9=_0x113aa5[_0x51a3('0x1a')](function(_0x4fa682,_0x2fa707){return _0x4fa682||_0x2fa707;},![]);logger[_0x51a3('0xf')](util['format'](_0x51a3('0x1b'),_0x577db7[_0x51a3('0xb')](function(_0x224630){return _0x224630[_0x51a3('0x1c')];})[_0x51a3('0x1d')](',\x20'),_0x577db7[_0x51a3('0xb')](function(_0x4c7f64){return _0x4c7f64['id'];})[_0x51a3('0x1d')](',\x20')));return _0x1a94a9;});}function checkSingleInterval(_0x21ccd5,_0x1d31b5){return db[_0x51a3('0x15')][_0x51a3('0x1e')](_0x21ccd5)[_0x51a3('0x1f')](function(_0x127e20){if(_0x127e20){logger['info'](util[_0x51a3('0x20')](_0x51a3('0x21'),_0x127e20[_0x51a3('0x1c')],_0x127e20['id']));return _0x127e20[_0x51a3('0x19')](_0x1d31b5);}});}exports[_0x51a3('0x22')]=function(_0x1ab634){var _0x382870=_0x1ab634[_0x51a3('0x23')];var _0x191f43=Array['isArray'](_0x1ab634[_0x51a3('0x24')])?_0x1ab634['intervals']:typeof _0x1ab634[_0x51a3('0x24')]===_0x51a3('0x25')?[_0x1ab634[_0x51a3('0x24')]]:[];var _0x455131=_0x1ab634[_0x51a3('0x26')]||undefined;var _0x2d5972=![];if(_0x191f43[_0x51a3('0x27')]){logger[_0x51a3('0xf')](util[_0x51a3('0x20')](_0x51a3('0x28'),_0x191f43[_0x51a3('0x1d')](';\x20')));}if(_0x455131){logger[_0x51a3('0xf')](util['format'](_0x51a3('0x29'),_0x455131));}logger[_0x51a3('0x10')](_0x51a3('0x2a'),_0x2d5972);logger[_0x51a3('0x2b')](_0x51a3('0x22'),_0x1ab634);return Promise[_0x51a3('0x2c')]()[_0x51a3('0x1f')](function(){if(Array[_0x51a3('0x2d')](_0x382870)){return checkArrayOfIntervals(_0x382870,_0x455131);}else if(_0x382870){return checkSingleInterval(_0x382870,_0x455131);}})['then'](function(_0x348605){var _0x457103=_0x191f43[_0x51a3('0x1a')](function(_0x52bdd9,_0x59f5b8){return _0x52bdd9||iftime(_0x59f5b8,_0x455131);},![]);_0x2d5972=_0x348605||_0x457103;return _0x2d5972;})[_0x51a3('0x11')](function(_0x18b4ed){logger[_0x51a3('0x13')]('IntervalIftime',_0x1ab634,_0x18b4ed);throw this[_0x51a3('0x13')](0x1f4,_0x18b4ed[_0x51a3('0x12')]);});}; \ No newline at end of file +var _0xf4cb=['../../utils/iftime','iftime','../../config/logger','GetInterval','findAll','options','raw','attributes','limit','include','map','model','then','debug','catch','error','message','ShowInterval','Interval','where','info','stringify','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb'];(function(_0x4839d0,_0x1f5c36){var _0xefa7c4=function(_0x37c902){while(--_0x37c902){_0x4839d0['push'](_0x4839d0['shift']());}};_0xefa7c4(++_0x1f5c36);}(_0xf4cb,0xa1));var _0xbf4c=function(_0x5b924f,_0x5202f3){_0x5b924f=_0x5b924f-0x0;var _0x15d639=_0xf4cb[_0x5b924f];return _0x15d639;};'use strict';var _=require(_0xbf4c('0x0'));var util=require(_0xbf4c('0x1'));var db=require(_0xbf4c('0x2'))['db'];var iftime=require(_0xbf4c('0x3'))[_0xbf4c('0x4')];var logger=require(_0xbf4c('0x5'))('rpc');exports[_0xbf4c('0x6')]=function(_0x2d34a9){var _0x3cbdfe=this;return new Promise(function(_0x4fa298,_0x16f783){return db['Interval'][_0xbf4c('0x7')]({'raw':_0x2d34a9['options']?_0x2d34a9[_0xbf4c('0x8')][_0xbf4c('0x9')]===undefined?!![]:![]:!![],'where':_0x2d34a9['options']?_0x2d34a9[_0xbf4c('0x8')]['where']||null:null,'attributes':_0x2d34a9['options']?_0x2d34a9[_0xbf4c('0x8')][_0xbf4c('0xa')]||null:null,'limit':_0x2d34a9['options']?_0x2d34a9[_0xbf4c('0x8')][_0xbf4c('0xb')]||null:null,'include':_0x2d34a9[_0xbf4c('0x8')]?_0x2d34a9['options'][_0xbf4c('0xc')]?_[_0xbf4c('0xd')](_0x2d34a9[_0xbf4c('0x8')][_0xbf4c('0xc')],function(_0x2ff332){return{'model':db[_0x2ff332[_0xbf4c('0xe')]],'as':_0x2ff332['as'],'attributes':_0x2ff332[_0xbf4c('0xa')],'include':_0x2ff332['include']?_['map'](_0x2ff332[_0xbf4c('0xc')],function(_0x1473be){return{'model':db[_0x1473be[_0xbf4c('0xe')]],'as':_0x1473be['as'],'attributes':_0x1473be[_0xbf4c('0xa')],'include':_0x1473be['include']?_[_0xbf4c('0xd')](_0x1473be[_0xbf4c('0xc')],function(_0x4aff23){return{'model':db[_0x4aff23[_0xbf4c('0xe')]],'as':_0x4aff23['as'],'attributes':_0x4aff23[_0xbf4c('0xa')]};}):[]};}):[]};}):[]:[]})[_0xbf4c('0xf')](function(_0x59f46a){logger['info'](_0xbf4c('0x6'),_0x2d34a9);logger[_0xbf4c('0x10')](_0xbf4c('0x6'),_0x2d34a9,JSON['stringify'](_0x59f46a));_0x4fa298(_0x59f46a);})[_0xbf4c('0x11')](function(_0x403b72){logger[_0xbf4c('0x12')](_0xbf4c('0x6'),_0x403b72[_0xbf4c('0x13')],_0x2d34a9);_0x16f783(_0x3cbdfe[_0xbf4c('0x12')](0x1f4,_0x403b72[_0xbf4c('0x13')]));});});};exports[_0xbf4c('0x14')]=function(_0x2a75bc){var _0x25b231=this;return new Promise(function(_0x3f3a60,_0x4cabd5){return db[_0xbf4c('0x15')]['find']({'raw':_0x2a75bc[_0xbf4c('0x8')]?_0x2a75bc[_0xbf4c('0x8')][_0xbf4c('0x9')]===undefined?!![]:![]:!![],'where':_0x2a75bc[_0xbf4c('0x8')]?_0x2a75bc['options'][_0xbf4c('0x16')]||null:null,'attributes':_0x2a75bc[_0xbf4c('0x8')]?_0x2a75bc[_0xbf4c('0x8')][_0xbf4c('0xa')]||null:null,'include':_0x2a75bc['options']?_0x2a75bc[_0xbf4c('0x8')][_0xbf4c('0xc')]?_[_0xbf4c('0xd')](_0x2a75bc[_0xbf4c('0x8')]['include'],function(_0x1e17c4){return{'model':db[_0x1e17c4[_0xbf4c('0xe')]],'as':_0x1e17c4['as'],'attributes':_0x1e17c4['attributes'],'include':_0x1e17c4[_0xbf4c('0xc')]?_[_0xbf4c('0xd')](_0x1e17c4[_0xbf4c('0xc')],function(_0x535fab){return{'model':db[_0x535fab[_0xbf4c('0xe')]],'as':_0x535fab['as'],'attributes':_0x535fab[_0xbf4c('0xa')],'include':_0x535fab[_0xbf4c('0xc')]?_[_0xbf4c('0xd')](_0x535fab['include'],function(_0xd096c8){return{'model':db[_0xd096c8[_0xbf4c('0xe')]],'as':_0xd096c8['as'],'attributes':_0xd096c8[_0xbf4c('0xa')]};}):[]};}):[]};}):[]:[]})[_0xbf4c('0xf')](function(_0x3dc6ee){logger[_0xbf4c('0x17')]('ShowInterval',_0x2a75bc);logger[_0xbf4c('0x10')](_0xbf4c('0x14'),_0x2a75bc,JSON[_0xbf4c('0x18')](_0x3dc6ee));_0x3f3a60(_0x3dc6ee);})['catch'](function(_0x4941a4){logger[_0xbf4c('0x12')](_0xbf4c('0x14'),_0x4941a4[_0xbf4c('0x13')],_0x2a75bc);_0x4cabd5(_0x25b231[_0xbf4c('0x12')](0x1f4,_0x4941a4[_0xbf4c('0x13')]));});});};function checkArrayOfIntervals(_0x13784c,_0x3b47c9){var _0x4de03c=[];return db[_0xbf4c('0x15')][_0xbf4c('0x7')]({'where':{'id':_0x13784c}})['then'](function(_0x130dcb){_0x4de03c=_0x130dcb;return Promise[_0xbf4c('0x19')](_0x4de03c[_0xbf4c('0xd')](function(_0x31ac6a){return _0x31ac6a['ifTime'](_0x3b47c9);}));})[_0xbf4c('0xf')](function(_0x1e154d){var _0x2cbb52=_0x1e154d[_0xbf4c('0x1a')](function(_0x4edf80,_0x28d8f8){return _0x4edf80||_0x28d8f8;},![]);logger[_0xbf4c('0x17')](util[_0xbf4c('0x1b')](_0xbf4c('0x1c'),_0x4de03c[_0xbf4c('0xd')](function(_0x1b2870){return _0x1b2870[_0xbf4c('0x1d')];})[_0xbf4c('0x1e')](',\x20'),_0x4de03c[_0xbf4c('0xd')](function(_0x4c8b5f){return _0x4c8b5f['id'];})[_0xbf4c('0x1e')](',\x20')));return _0x2cbb52;});}function checkSingleInterval(_0xea8e2c,_0x28d6a3){return db['Interval'][_0xbf4c('0x1f')](_0xea8e2c)[_0xbf4c('0xf')](function(_0x1b0dec){if(_0x1b0dec){logger[_0xbf4c('0x17')](util[_0xbf4c('0x1b')](_0xbf4c('0x20'),_0x1b0dec[_0xbf4c('0x1d')],_0x1b0dec['id']));return _0x1b0dec['ifTime'](_0x28d6a3);}});}exports[_0xbf4c('0x21')]=function(_0x11310b){var _0x4b03ae=_0x11310b['intervalIds'];var _0x15c2e2=Array[_0xbf4c('0x22')](_0x11310b[_0xbf4c('0x23')])?_0x11310b[_0xbf4c('0x23')]:typeof _0x11310b[_0xbf4c('0x23')]==='string'?[_0x11310b[_0xbf4c('0x23')]]:[];var _0x3c1011=_0x11310b[_0xbf4c('0x24')]||undefined;var _0x1e60a2=![];if(_0x15c2e2['length']){logger[_0xbf4c('0x17')](util['format'](_0xbf4c('0x25'),_0x15c2e2[_0xbf4c('0x1e')](';\x20')));}if(_0x3c1011){logger[_0xbf4c('0x17')](util[_0xbf4c('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x3c1011));}logger[_0xbf4c('0x10')](_0xbf4c('0x26'),_0x1e60a2);logger[_0xbf4c('0x27')](_0xbf4c('0x21'),_0x11310b);return Promise[_0xbf4c('0x28')]()[_0xbf4c('0xf')](function(){if(Array[_0xbf4c('0x22')](_0x4b03ae)){return checkArrayOfIntervals(_0x4b03ae,_0x3c1011);}else if(_0x4b03ae){return checkSingleInterval(_0x4b03ae,_0x3c1011);}})[_0xbf4c('0xf')](function(_0x23c819){var _0x3249a9=_0x15c2e2[_0xbf4c('0x1a')](function(_0x2be256,_0x4f27c3){return _0x2be256||iftime(_0x4f27c3,_0x3c1011);},![]);_0x1e60a2=_0x23c819||_0x3249a9;return _0x1e60a2;})[_0xbf4c('0x11')](function(_0x127716){logger[_0xbf4c('0x12')](_0xbf4c('0x21'),_0x11310b,_0x127716);throw this[_0xbf4c('0x12')](0x1f4,_0x127716['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4e0a141..ff9127c 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2c684e,_0xd7f2a2){var _0x3a35a6=function(_0x41cb9d){while(--_0x41cb9d){_0x2c684e['push'](_0x2c684e['shift']());}};_0x3a35a6(++_0xd7f2a2);}(_0x2ef3,0xba));var _0x32ef=function(_0x569a18,_0x393e62){_0x569a18=_0x569a18-0x0;var _0x2405d3=_0x2ef3[_0x569a18];return _0x2405d3;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x392dc2,_0x47c3f3){_0x392dc2=_0x392dc2-0x0;var _0x14150f=_0x0b0e[_0x392dc2];return _0x14150f;};'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 faaa3d4..aa27b4d 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 _0xf7bb=['json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','summary','Report','description','stringify','issuetype','Bug','fields','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','end','status'];(function(_0x103939,_0x1ddda0){var _0x35ac3a=function(_0x554b15){while(--_0x554b15){_0x103939['push'](_0x103939['shift']());}};_0x35ac3a(++_0x1ddda0);}(_0xf7bb,0x1a4));var _0xbf7b=function(_0x1f7f83,_0x7e44ba){_0x1f7f83=_0x1f7f83-0x0;var _0x3a487f=_0xf7bb[_0x1f7f83];return _0x3a487f;};'use strict';var BPromise=require(_0xbf7b('0x0'));var https=require(_0xbf7b('0x1'));var logger=require(_0xbf7b('0x2'))('api');var USERNAME=_0xbf7b('0x3');var PASSWORD=_0xbf7b('0x4');function openIssue(_0x2af77a,_0x1ba10d){var _0x3bc151={'fields':{'project':{'key':_0x2af77a[_0xbf7b('0x5')]||'MOTGUI'},'summary':(_0x2af77a[_0xbf7b('0x6')]||_0xbf7b('0x7'))+'\x20from\x20'+_0x2af77a['ip'],'description':_0x2af77a[_0xbf7b('0x8')]||JSON[_0xbf7b('0x9')](_0x2af77a),'issuetype':{'name':_0x2af77a[_0xbf7b('0xa')]||_0xbf7b('0xb')}}};_0x3bc151[_0xbf7b('0xc')]['customfield_11500']=_0x2af77a[_0xbf7b('0xd')];_0x3bc151[_0xbf7b('0xc')][_0xbf7b('0xe')]=_0x2af77a['oldToken'];_0x3bc151[_0xbf7b('0xc')][_0xbf7b('0xf')]=_0x2af77a[_0xbf7b('0x10')];_0x3bc151['fields'][_0xbf7b('0x11')]=_0x2af77a[_0xbf7b('0x12')];_0x3bc151[_0xbf7b('0xc')]['customfield_11504']=_0x2af77a[_0xbf7b('0x13')];_0x3bc151['fields'][_0xbf7b('0x14')]=_0x2af77a['ip'];var _0x4685d1={'host':_0xbf7b('0x15'),'port':0x1bb,'path':_0xbf7b('0x16'),'method':_0xbf7b('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xbf7b('0x18'),'Authorization':_0xbf7b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xbf7b('0x1a')](_0xbf7b('0x1b'))}};var _0x2ce961=JSON[_0xbf7b('0x9')](_0x3bc151);var _0x5032d8=https[_0xbf7b('0x1c')](_0x4685d1,function(_0x47c27a){_0x47c27a['setEncoding']('utf8');var _0x3c008e='';_0x47c27a['on']('data',function(_0x38ed8a){_0x3c008e+=_0x38ed8a;});_0x47c27a['on'](_0xbf7b('0x1d'),function(){if(_0x1ba10d){return _0x1ba10d[_0xbf7b('0x1e')](_0x47c27a['statusCode'])['json'](JSON['parse'](_0x3c008e));}});});_0x5032d8['on']('error',function(_0x1003b5){if(_0x1ba10d){return _0x1ba10d[_0xbf7b('0x1e')](0x1f4)[_0xbf7b('0x1f')]({'errors':[{'message':_0xbf7b('0x20'),'type':_0xbf7b('0x21')}]});}});_0x5032d8[_0xbf7b('0x22')](_0x2ce961);_0x5032d8[_0xbf7b('0x1d')]();}exports[_0xbf7b('0x23')]=openIssue;exports['send']=function(_0x46a7db,_0x2a3769){_0x46a7db[_0xbf7b('0x24')]['ip']=_0x46a7db['headers'][_0xbf7b('0x25')]||_0x46a7db[_0xbf7b('0x26')]['remoteAddress']||_0x46a7db[_0xbf7b('0x27')][_0xbf7b('0x28')]||_0x46a7db['connection'][_0xbf7b('0x27')][_0xbf7b('0x28')];return openIssue(_0x46a7db['body'],_0x2a3769);}; \ No newline at end of file +var _0x9ceb=['remoteAddress','socket','connection','bluebird','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','stringify','request','utf8','data','end','status','statusCode','parse','json','api.jira','write','openIssue','send','body','x-forwarded-for'];(function(_0x550a9f,_0x4784c6){var _0x2a8aa4=function(_0x31bb3b){while(--_0x31bb3b){_0x550a9f['push'](_0x550a9f['shift']());}};_0x2a8aa4(++_0x4784c6);}(_0x9ceb,0xda));var _0xb9ce=function(_0x4ef417,_0x467f3c){_0x4ef417=_0x4ef417-0x0;var _0x2ec0b7=_0x9ceb[_0x4ef417];return _0x2ec0b7;};'use strict';var BPromise=require(_0xb9ce('0x0'));var https=require('https');var logger=require('../../config/logger')(_0xb9ce('0x1'));var USERNAME=_0xb9ce('0x2');var PASSWORD=_0xb9ce('0x3');function openIssue(_0x4027b9,_0x4c4b23){var _0x3b0702={'fields':{'project':{'key':_0x4027b9[_0xb9ce('0x4')]||_0xb9ce('0x5')},'summary':(_0x4027b9[_0xb9ce('0x6')]||_0xb9ce('0x7'))+_0xb9ce('0x8')+_0x4027b9['ip'],'description':_0x4027b9[_0xb9ce('0x9')]||JSON['stringify'](_0x4027b9),'issuetype':{'name':_0x4027b9[_0xb9ce('0xa')]||'Bug'}}};_0x3b0702[_0xb9ce('0xb')][_0xb9ce('0xc')]=_0x4027b9['email'];_0x3b0702['fields'][_0xb9ce('0xd')]=_0x4027b9[_0xb9ce('0xe')];_0x3b0702['fields'][_0xb9ce('0xf')]=_0x4027b9['newToken'];_0x3b0702[_0xb9ce('0xb')]['customfield_11503']=_0x4027b9[_0xb9ce('0x10')];_0x3b0702[_0xb9ce('0xb')][_0xb9ce('0x11')]=_0x4027b9[_0xb9ce('0x12')];_0x3b0702[_0xb9ce('0xb')][_0xb9ce('0x13')]=_0x4027b9['ip'];var _0x200f7b={'host':_0xb9ce('0x14'),'port':0x1bb,'path':_0xb9ce('0x15'),'method':_0xb9ce('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xb9ce('0x17'),'Authorization':_0xb9ce('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x3edf92=JSON[_0xb9ce('0x19')](_0x3b0702);var _0x5ee656=https[_0xb9ce('0x1a')](_0x200f7b,function(_0x32fe94){_0x32fe94['setEncoding'](_0xb9ce('0x1b'));var _0x2fd2f4='';_0x32fe94['on'](_0xb9ce('0x1c'),function(_0x3ba286){_0x2fd2f4+=_0x3ba286;});_0x32fe94['on'](_0xb9ce('0x1d'),function(){if(_0x4c4b23){return _0x4c4b23[_0xb9ce('0x1e')](_0x32fe94[_0xb9ce('0x1f')])['json'](JSON[_0xb9ce('0x20')](_0x2fd2f4));}});});_0x5ee656['on']('error',function(_0x350d89){if(_0x4c4b23){return _0x4c4b23[_0xb9ce('0x1e')](0x1f4)[_0xb9ce('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xb9ce('0x22')}]});}});_0x5ee656[_0xb9ce('0x23')](_0x3edf92);_0x5ee656[_0xb9ce('0x1d')]();}exports[_0xb9ce('0x24')]=openIssue;exports[_0xb9ce('0x25')]=function(_0x468ee0,_0x163dfa){_0x468ee0[_0xb9ce('0x26')]['ip']=_0x468ee0['headers'][_0xb9ce('0x27')]||_0x468ee0['connection'][_0xb9ce('0x28')]||_0x468ee0[_0xb9ce('0x29')][_0xb9ce('0x28')]||_0x468ee0[_0xb9ce('0x2a')][_0xb9ce('0x29')][_0xb9ce('0x28')];return openIssue(_0x468ee0['body'],_0x163dfa);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 21bd9ee..49eb914 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 _0xf4eb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x1ab681,_0x204fb8){var _0x32bf08=function(_0x2de4ad){while(--_0x2de4ad){_0x1ab681['push'](_0x1ab681['shift']());}};_0x32bf08(++_0x204fb8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4085b4,_0x27c904){_0x4085b4=_0x4085b4-0x0;var _0x2afa41=_0xf4eb[_0x4085b4];return _0x2afa41;};'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')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['delete'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0xe')]=router; \ No newline at end of file +var _0x6f7a=['isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x251042,_0x21016d){var _0x4eedc0=function(_0x224813){while(--_0x224813){_0x251042['push'](_0x251042['shift']());}};_0x4eedc0(++_0x21016d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1c9395,_0x23ae63){_0x1c9395=_0x1c9395-0x0;var _0xa52553=_0x6f7a[_0x1c9395];return _0xa52553;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b147576..fcad58f 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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x2e7373,_0x4546f2){_0x2e7373=_0x2e7373-0x0;var _0x22b955=_0x7a54[_0x2e7373];return _0x22b955;};'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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x1fcf22,_0x44fa26){_0x1fcf22=_0x1fcf22-0x0;var _0x3bc187=_0x7a54[_0x1fcf22];return _0x3bc187;};'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 275c32d..db28b6b 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 _0x3837=['find','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length'];(function(_0x1260eb,_0x3e0895){var _0x4f7682=function(_0x2c77fb){while(--_0x2c77fb){_0x1260eb['push'](_0x1260eb['shift']());}};_0x4f7682(++_0x3e0895);}(_0x3837,0x1d1));var _0x7383=function(_0x1fd17e,_0x2c2722){_0x1fd17e=_0x1fd17e-0x0;var _0x2e11f9=_0x3837[_0x1fd17e];return _0x2e11f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7383('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7383('0x1'));var rp=require('request-promise');var moment=require(_0x7383('0x2'));var BPromise=require(_0x7383('0x3'));var Mustache=require(_0x7383('0x4'));var util=require(_0x7383('0x5'));var path=require(_0x7383('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7383('0x7'));var fs=require('fs');var fs_extra=require(_0x7383('0x8'));var _=require(_0x7383('0x9'));var squel=require(_0x7383('0xa'));var crypto=require(_0x7383('0xb'));var jsforce=require(_0x7383('0xc'));var deskjs=require(_0x7383('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7383('0xe'));var Papa=require(_0x7383('0xf'));var Redis=require(_0x7383('0x10'));var authService=require(_0x7383('0x11'));var qs=require(_0x7383('0x12'));var as=require(_0x7383('0x13'));var hardwareService=require(_0x7383('0x14'));var logger=require('../../config/logger')(_0x7383('0x15'));var utils=require(_0x7383('0x16'));var config=require(_0x7383('0x17'));var licenseUtil=require(_0x7383('0x18'));var db=require(_0x7383('0x19'))['db'];function respondWithStatusCode(_0x35e5f4,_0xe359e8){_0xe359e8=_0xe359e8||0xcc;return function(_0x70b32){if(_0x70b32){return _0x35e5f4[_0x7383('0x1a')](_0xe359e8);}return _0x35e5f4[_0x7383('0x1b')](_0xe359e8)[_0x7383('0x1c')]();};}function respondWithResult(_0x5b018f,_0x43c1d6){_0x43c1d6=_0x43c1d6||0xc8;return function(_0x3a2c78){if(_0x3a2c78){return _0x5b018f[_0x7383('0x1b')](_0x43c1d6)[_0x7383('0x1d')](_0x3a2c78);}};}function respondWithFilteredResult(_0x4aa59d,_0x566949){return function(_0x47b4c4){if(_0x47b4c4){var _0x5cf093=typeof _0x566949[_0x7383('0x1e')]===_0x7383('0x1f')&&typeof _0x566949[_0x7383('0x20')]===_0x7383('0x1f');var _0x1f733d=_0x47b4c4['count'];var _0x1cf7bb=_0x5cf093?0x0:_0x566949[_0x7383('0x1e')];var _0x1c7645=_0x5cf093?_0x47b4c4[_0x7383('0x21')]:_0x566949[_0x7383('0x1e')]+_0x566949[_0x7383('0x20')];var _0x115ff6;if(_0x1c7645>=_0x1f733d){_0x1c7645=_0x1f733d;_0x115ff6=0xc8;}else{_0x115ff6=0xce;}_0x4aa59d[_0x7383('0x1b')](_0x115ff6);return _0x4aa59d[_0x7383('0x22')](_0x7383('0x23'),_0x1cf7bb+'-'+_0x1c7645+'/'+_0x1f733d)['json'](_0x47b4c4);}return null;};}function patchUpdates(_0x42d970){return function(_0x2aebe0){try{jsonpatch[_0x7383('0x24')](_0x2aebe0,_0x42d970,!![]);}catch(_0x4a65e9){return BPromise[_0x7383('0x25')](_0x4a65e9);}return _0x2aebe0[_0x7383('0x26')]();};}function saveUpdates(_0x47e145,_0x316204){return function(_0x57420d){if(_0x57420d){return _0x57420d[_0x7383('0x27')](_0x47e145)[_0x7383('0x28')](function(_0x5c617a){return _0x5c617a;});}return null;};}function removeEntity(_0x1afeab,_0x3c5467){return function(_0x1edf1d){if(_0x1edf1d){return _0x1edf1d[_0x7383('0x29')]()[_0x7383('0x28')](function(){_0x1afeab['status'](0xcc)[_0x7383('0x1c')]();});}};}function handleEntityNotFound(_0x5eaf6a,_0x4c3e40){return function(_0x388964){if(!_0x388964){_0x5eaf6a[_0x7383('0x1a')](0x194);}return _0x388964;};}function handleError(_0x82bd92,_0x208ef9){_0x208ef9=_0x208ef9||0x1f4;return function(_0x4a1840){logger[_0x7383('0x2a')](_0x4a1840['stack']);if(_0x4a1840[_0x7383('0x2b')]){delete _0x4a1840[_0x7383('0x2b')];}_0x82bd92[_0x7383('0x1b')](_0x208ef9)[_0x7383('0x2c')](_0x4a1840);};}exports[_0x7383('0x2d')]=function(_0x439d09,_0x272d78){var _0x43f7a5={},_0x2b550d={},_0x15b14c={'count':0x0,'rows':[]};var _0x512a98=_[_0x7383('0x2e')](db[_0x7383('0x2f')]['rawAttributes'],function(_0x5e52ce){return{'name':_0x5e52ce['fieldName'],'type':_0x5e52ce[_0x7383('0x30')][_0x7383('0x31')]};});_0x2b550d[_0x7383('0x32')]=_[_0x7383('0x2e')](_0x512a98,_0x7383('0x2b'));_0x2b550d[_0x7383('0x33')]=_[_0x7383('0x34')](_0x439d09[_0x7383('0x33')]);_0x2b550d[_0x7383('0x35')]=_[_0x7383('0x36')](_0x2b550d[_0x7383('0x32')],_0x2b550d[_0x7383('0x33')]);_0x43f7a5[_0x7383('0x37')]=_[_0x7383('0x36')](_0x2b550d[_0x7383('0x32')],qs[_0x7383('0x38')](_0x439d09[_0x7383('0x33')][_0x7383('0x38')]));_0x43f7a5[_0x7383('0x37')]=_0x43f7a5[_0x7383('0x37')]['length']?_0x43f7a5[_0x7383('0x37')]:_0x2b550d[_0x7383('0x32')];if(!_0x439d09['query'][_0x7383('0x39')](_0x7383('0x3a'))){_0x43f7a5[_0x7383('0x20')]=qs[_0x7383('0x20')](_0x439d09[_0x7383('0x33')]['limit']);_0x43f7a5[_0x7383('0x1e')]=qs[_0x7383('0x1e')](_0x439d09[_0x7383('0x33')][_0x7383('0x1e')]);}_0x43f7a5[_0x7383('0x3b')]=qs[_0x7383('0x3c')](_0x439d09[_0x7383('0x33')]['sort']);_0x43f7a5['where']=qs['filters'](_[_0x7383('0x3d')](_0x439d09[_0x7383('0x33')],_0x2b550d[_0x7383('0x35')]),_0x512a98);if(_0x439d09[_0x7383('0x33')][_0x7383('0x3e')]){_0x43f7a5[_0x7383('0x3f')]=_[_0x7383('0x40')](_0x43f7a5[_0x7383('0x3f')],{'$or':_[_0x7383('0x2e')](_0x512a98,function(_0x4f307a){if(_0x4f307a[_0x7383('0x30')]!==_0x7383('0x41')){var _0x3c2795={};_0x3c2795[_0x4f307a[_0x7383('0x2b')]]={'$like':'%'+_0x439d09[_0x7383('0x33')][_0x7383('0x3e')]+'%'};return _0x3c2795;}})});}_0x43f7a5=_['merge']({},_0x43f7a5,_0x439d09[_0x7383('0x42')]);var _0x5329a6={'where':_0x43f7a5['where']};return db[_0x7383('0x2f')][_0x7383('0x21')](_0x5329a6)[_0x7383('0x28')](function(_0x3f14a6){_0x15b14c[_0x7383('0x21')]=_0x3f14a6;if(_0x439d09['query']['includeAll']){_0x43f7a5[_0x7383('0x43')]=[{'all':!![]}];}return db[_0x7383('0x2f')]['findAll'](_0x43f7a5);})['then'](function(_0x271cd5){_0x15b14c[_0x7383('0x44')]=_0x271cd5;return _0x15b14c;})[_0x7383('0x28')](respondWithFilteredResult(_0x272d78,_0x43f7a5))[_0x7383('0x45')](handleError(_0x272d78,null));};exports[_0x7383('0x46')]=function(_0x53c999,_0x141728){var _0x5d9085={'raw':!![],'where':{'id':_0x53c999[_0x7383('0x47')]['id']}},_0x3951d1={};_0x3951d1[_0x7383('0x32')]=_[_0x7383('0x34')](db['JscriptyAnswerReport'][_0x7383('0x48')]);_0x3951d1[_0x7383('0x33')]=_[_0x7383('0x34')](_0x53c999[_0x7383('0x33')]);_0x3951d1['filters']=_[_0x7383('0x36')](_0x3951d1[_0x7383('0x32')],_0x3951d1[_0x7383('0x33')]);_0x5d9085[_0x7383('0x37')]=_[_0x7383('0x36')](_0x3951d1[_0x7383('0x32')],qs[_0x7383('0x38')](_0x53c999[_0x7383('0x33')][_0x7383('0x38')]));_0x5d9085[_0x7383('0x37')]=_0x5d9085[_0x7383('0x37')][_0x7383('0x49')]?_0x5d9085[_0x7383('0x37')]:_0x3951d1['model'];if(_0x53c999[_0x7383('0x33')]['includeAll']){_0x5d9085[_0x7383('0x43')]=[{'all':!![]}];}_0x5d9085=_[_0x7383('0x40')]({},_0x5d9085,_0x53c999[_0x7383('0x42')]);return db['JscriptyAnswerReport'][_0x7383('0x4a')](_0x5d9085)[_0x7383('0x28')](handleEntityNotFound(_0x141728,null))['then'](respondWithResult(_0x141728,null))[_0x7383('0x45')](handleError(_0x141728,null));};exports['create']=function(_0x10ac80,_0x49e4f1){return db[_0x7383('0x2f')]['create'](_0x10ac80[_0x7383('0x4b')],{})[_0x7383('0x28')](respondWithResult(_0x49e4f1,0xc9))[_0x7383('0x45')](handleError(_0x49e4f1,null));};exports['update']=function(_0xd6ea61,_0x15ed37){if(_0xd6ea61[_0x7383('0x4b')]['id']){delete _0xd6ea61['body']['id'];}return db['JscriptyAnswerReport'][_0x7383('0x4a')]({'where':{'id':_0xd6ea61[_0x7383('0x47')]['id']}})[_0x7383('0x28')](handleEntityNotFound(_0x15ed37,null))[_0x7383('0x28')](saveUpdates(_0xd6ea61[_0x7383('0x4b')],null))[_0x7383('0x28')](respondWithResult(_0x15ed37,null))[_0x7383('0x45')](handleError(_0x15ed37,null));};exports[_0x7383('0x29')]=function(_0x380316,_0x65a7d2){return db['JscriptyAnswerReport'][_0x7383('0x4a')]({'where':{'id':_0x380316[_0x7383('0x47')]['id']}})[_0x7383('0x28')](handleEntityNotFound(_0x65a7d2,null))[_0x7383('0x28')](removeEntity(_0x65a7d2,null))[_0x7383('0x45')](handleError(_0x65a7d2,null));};exports['describe']=function(_0x210351,_0xa7233a){return db['JscriptyAnswerReport'][_0x7383('0x4c')]()[_0x7383('0x28')](respondWithResult(_0xa7233a,null))[_0x7383('0x45')](handleError(_0xa7233a,null));}; \ No newline at end of file +var _0x8098=['set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','rawAttributes','type','model','query','keys','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','fields','length','find','create','body','update','params','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','sendStatus','status','json','offset','undefined','count'];(function(_0x3091b4,_0x3068b9){var _0xb545f6=function(_0xcf417b){while(--_0xcf417b){_0x3091b4['push'](_0x3091b4['shift']());}};_0xb545f6(++_0x3068b9);}(_0x8098,0x1ba));var _0x8809=function(_0x123c03,_0x342a80){_0x123c03=_0x123c03-0x0;var _0x761f80=_0x8098[_0x123c03];return _0x761f80;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8809('0x0'));var jsonpatch=require(_0x8809('0x1'));var rp=require(_0x8809('0x2'));var moment=require(_0x8809('0x3'));var BPromise=require(_0x8809('0x4'));var Mustache=require('mustache');var util=require(_0x8809('0x5'));var path=require(_0x8809('0x6'));var sox=require(_0x8809('0x7'));var csv=require(_0x8809('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8809('0x9'));var _=require(_0x8809('0xa'));var squel=require('squel');var crypto=require(_0x8809('0xb'));var jsforce=require(_0x8809('0xc'));var deskjs=require(_0x8809('0xd'));var toCsv=require(_0x8809('0x8'));var querystring=require(_0x8809('0xe'));var Papa=require(_0x8809('0xf'));var Redis=require(_0x8809('0x10'));var authService=require(_0x8809('0x11'));var qs=require(_0x8809('0x12'));var as=require(_0x8809('0x13'));var hardwareService=require(_0x8809('0x14'));var logger=require(_0x8809('0x15'))(_0x8809('0x16'));var utils=require(_0x8809('0x17'));var config=require(_0x8809('0x18'));var licenseUtil=require(_0x8809('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388b99,_0x455989){_0x455989=_0x455989||0xcc;return function(_0x4d3b4c){if(_0x4d3b4c){return _0x388b99[_0x8809('0x1a')](_0x455989);}return _0x388b99[_0x8809('0x1b')](_0x455989)['end']();};}function respondWithResult(_0x5d87df,_0x316f2c){_0x316f2c=_0x316f2c||0xc8;return function(_0x2e4279){if(_0x2e4279){return _0x5d87df[_0x8809('0x1b')](_0x316f2c)[_0x8809('0x1c')](_0x2e4279);}};}function respondWithFilteredResult(_0x131716,_0x3d4d7e){return function(_0x105bec){if(_0x105bec){var _0x5624b5=typeof _0x3d4d7e[_0x8809('0x1d')]===_0x8809('0x1e')&&typeof _0x3d4d7e['limit']===_0x8809('0x1e');var _0x369d58=_0x105bec['count'];var _0x3b0562=_0x5624b5?0x0:_0x3d4d7e[_0x8809('0x1d')];var _0x7ec1a6=_0x5624b5?_0x105bec[_0x8809('0x1f')]:_0x3d4d7e[_0x8809('0x1d')]+_0x3d4d7e['limit'];var _0x4826e2;if(_0x7ec1a6>=_0x369d58){_0x7ec1a6=_0x369d58;_0x4826e2=0xc8;}else{_0x4826e2=0xce;}_0x131716[_0x8809('0x1b')](_0x4826e2);return _0x131716[_0x8809('0x20')](_0x8809('0x21'),_0x3b0562+'-'+_0x7ec1a6+'/'+_0x369d58)[_0x8809('0x1c')](_0x105bec);}return null;};}function patchUpdates(_0x2ff4a1){return function(_0x91de1e){try{jsonpatch[_0x8809('0x22')](_0x91de1e,_0x2ff4a1,!![]);}catch(_0x404be9){return BPromise[_0x8809('0x23')](_0x404be9);}return _0x91de1e[_0x8809('0x24')]();};}function saveUpdates(_0x16893a,_0x1440aa){return function(_0x26b43e){if(_0x26b43e){return _0x26b43e['update'](_0x16893a)['then'](function(_0x34d2df){return _0x34d2df;});}return null;};}function removeEntity(_0x5984c6,_0x521840){return function(_0x54ddd8){if(_0x54ddd8){return _0x54ddd8['destroy']()[_0x8809('0x25')](function(){_0x5984c6[_0x8809('0x1b')](0xcc)[_0x8809('0x26')]();});}};}function handleEntityNotFound(_0x2bbf26,_0x2947f7){return function(_0x3d21fd){if(!_0x3d21fd){_0x2bbf26[_0x8809('0x1a')](0x194);}return _0x3d21fd;};}function handleError(_0x14f545,_0x125776){_0x125776=_0x125776||0x1f4;return function(_0x6e5dc8){logger[_0x8809('0x27')](_0x6e5dc8[_0x8809('0x28')]);if(_0x6e5dc8['name']){delete _0x6e5dc8[_0x8809('0x29')];}_0x14f545[_0x8809('0x1b')](_0x125776)[_0x8809('0x2a')](_0x6e5dc8);};}exports['index']=function(_0x13d74b,_0x443741){var _0xbba52b={},_0x296187={},_0xb9388f={'count':0x0,'rows':[]};var _0x539f32=_[_0x8809('0x2b')](db['JscriptyAnswerReport'][_0x8809('0x2c')],function(_0x197719){return{'name':_0x197719['fieldName'],'type':_0x197719[_0x8809('0x2d')]['key']};});_0x296187[_0x8809('0x2e')]=_[_0x8809('0x2b')](_0x539f32,_0x8809('0x29'));_0x296187[_0x8809('0x2f')]=_[_0x8809('0x30')](_0x13d74b[_0x8809('0x2f')]);_0x296187['filters']=_['intersection'](_0x296187[_0x8809('0x2e')],_0x296187[_0x8809('0x2f')]);_0xbba52b[_0x8809('0x31')]=_[_0x8809('0x32')](_0x296187[_0x8809('0x2e')],qs['fields'](_0x13d74b[_0x8809('0x2f')]['fields']));_0xbba52b['attributes']=_0xbba52b[_0x8809('0x31')]['length']?_0xbba52b[_0x8809('0x31')]:_0x296187['model'];if(!_0x13d74b[_0x8809('0x2f')][_0x8809('0x33')](_0x8809('0x34'))){_0xbba52b[_0x8809('0x35')]=qs[_0x8809('0x35')](_0x13d74b[_0x8809('0x2f')]['limit']);_0xbba52b[_0x8809('0x1d')]=qs[_0x8809('0x1d')](_0x13d74b['query'][_0x8809('0x1d')]);}_0xbba52b[_0x8809('0x36')]=qs[_0x8809('0x37')](_0x13d74b[_0x8809('0x2f')][_0x8809('0x37')]);_0xbba52b[_0x8809('0x38')]=qs['filters'](_[_0x8809('0x39')](_0x13d74b[_0x8809('0x2f')],_0x296187[_0x8809('0x3a')]),_0x539f32);if(_0x13d74b[_0x8809('0x2f')][_0x8809('0x3b')]){_0xbba52b[_0x8809('0x38')]=_[_0x8809('0x3c')](_0xbba52b[_0x8809('0x38')],{'$or':_['map'](_0x539f32,function(_0x13b530){if(_0x13b530[_0x8809('0x2d')]!==_0x8809('0x3d')){var _0x2b6380={};_0x2b6380[_0x13b530['name']]={'$like':'%'+_0x13d74b[_0x8809('0x2f')][_0x8809('0x3b')]+'%'};return _0x2b6380;}})});}_0xbba52b=_[_0x8809('0x3c')]({},_0xbba52b,_0x13d74b[_0x8809('0x3e')]);var _0x8e60e2={'where':_0xbba52b[_0x8809('0x38')]};return db[_0x8809('0x3f')][_0x8809('0x1f')](_0x8e60e2)[_0x8809('0x25')](function(_0x2319bb){_0xb9388f[_0x8809('0x1f')]=_0x2319bb;if(_0x13d74b[_0x8809('0x2f')][_0x8809('0x40')]){_0xbba52b[_0x8809('0x41')]=[{'all':!![]}];}return db[_0x8809('0x3f')][_0x8809('0x42')](_0xbba52b);})[_0x8809('0x25')](function(_0x16a0d1){_0xb9388f[_0x8809('0x43')]=_0x16a0d1;return _0xb9388f;})[_0x8809('0x25')](respondWithFilteredResult(_0x443741,_0xbba52b))[_0x8809('0x44')](handleError(_0x443741,null));};exports[_0x8809('0x45')]=function(_0x39a2d3,_0x5a346c){var _0x3aa95d={'raw':!![],'where':{'id':_0x39a2d3['params']['id']}},_0x2f1316={};_0x2f1316[_0x8809('0x2e')]=_[_0x8809('0x30')](db[_0x8809('0x3f')][_0x8809('0x2c')]);_0x2f1316[_0x8809('0x2f')]=_['keys'](_0x39a2d3['query']);_0x2f1316[_0x8809('0x3a')]=_[_0x8809('0x32')](_0x2f1316[_0x8809('0x2e')],_0x2f1316[_0x8809('0x2f')]);_0x3aa95d['attributes']=_['intersection'](_0x2f1316[_0x8809('0x2e')],qs[_0x8809('0x46')](_0x39a2d3['query'][_0x8809('0x46')]));_0x3aa95d[_0x8809('0x31')]=_0x3aa95d['attributes'][_0x8809('0x47')]?_0x3aa95d[_0x8809('0x31')]:_0x2f1316[_0x8809('0x2e')];if(_0x39a2d3[_0x8809('0x2f')]['includeAll']){_0x3aa95d[_0x8809('0x41')]=[{'all':!![]}];}_0x3aa95d=_['merge']({},_0x3aa95d,_0x39a2d3['options']);return db[_0x8809('0x3f')][_0x8809('0x48')](_0x3aa95d)[_0x8809('0x25')](handleEntityNotFound(_0x5a346c,null))[_0x8809('0x25')](respondWithResult(_0x5a346c,null))[_0x8809('0x44')](handleError(_0x5a346c,null));};exports[_0x8809('0x49')]=function(_0x47f7a2,_0x2bd916){return db[_0x8809('0x3f')][_0x8809('0x49')](_0x47f7a2[_0x8809('0x4a')],{})[_0x8809('0x25')](respondWithResult(_0x2bd916,0xc9))[_0x8809('0x44')](handleError(_0x2bd916,null));};exports[_0x8809('0x4b')]=function(_0x373bf4,_0x23f6f6){if(_0x373bf4[_0x8809('0x4a')]['id']){delete _0x373bf4['body']['id'];}return db[_0x8809('0x3f')][_0x8809('0x48')]({'where':{'id':_0x373bf4[_0x8809('0x4c')]['id']}})[_0x8809('0x25')](handleEntityNotFound(_0x23f6f6,null))[_0x8809('0x25')](saveUpdates(_0x373bf4[_0x8809('0x4a')],null))[_0x8809('0x25')](respondWithResult(_0x23f6f6,null))['catch'](handleError(_0x23f6f6,null));};exports[_0x8809('0x4d')]=function(_0x5496a3,_0x3ce100){return db[_0x8809('0x3f')][_0x8809('0x48')]({'where':{'id':_0x5496a3[_0x8809('0x4c')]['id']}})[_0x8809('0x25')](handleEntityNotFound(_0x3ce100,null))[_0x8809('0x25')](removeEntity(_0x3ce100,null))[_0x8809('0x44')](handleError(_0x3ce100,null));};exports[_0x8809('0x4e')]=function(_0x4dfa63,_0x46382e){return db[_0x8809('0x3f')]['describe']()['then'](respondWithResult(_0x46382e,null))[_0x8809('0x44')](handleError(_0x46382e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5c75101..befdc93 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 _0xdd33=['JscriptyAnswerReport','report_jscripty_answers','lodash','moment','bluebird','request-promise','path','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x550859,_0x5efee8){var _0x3d70b5=function(_0x247b08){while(--_0x247b08){_0x550859['push'](_0x550859['shift']());}};_0x3d70b5(++_0x5efee8);}(_0xdd33,0x14c));var _0x3dd3=function(_0x128a75,_0x1173c5){_0x128a75=_0x128a75-0x0;var _0x3be03b=_0xdd33[_0x128a75];return _0x3be03b;};'use strict';var _=require(_0x3dd3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3dd3('0x1'));var BPromise=require(_0x3dd3('0x2'));var rp=require(_0x3dd3('0x3'));var fs=require('fs');var path=require(_0x3dd3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3dd3('0x5'));module[_0x3dd3('0x6')]=function(_0x47c67f,_0x2c3c60){return _0x47c67f[_0x3dd3('0x7')](_0x3dd3('0x8'),attributes,{'tableName':_0x3dd3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80e4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x2594e0,_0x1ee198){var _0x1eadb9=function(_0x52a325){while(--_0x52a325){_0x2594e0['push'](_0x2594e0['shift']());}};_0x1eadb9(++_0x1ee198);}(_0x80e4,0x103));var _0x480e=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x80e4[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var logger=require(_0x480e('0x2'))('api');var moment=require(_0x480e('0x3'));var BPromise=require(_0x480e('0x4'));var rp=require(_0x480e('0x5'));var fs=require('fs');var path=require(_0x480e('0x6'));var rimraf=require(_0x480e('0x7'));var config=require('../../config/environment');var attributes=require(_0x480e('0x8'));module[_0x480e('0x9')]=function(_0x14c268,_0x135a83){return _0x14c268[_0x480e('0xa')](_0x480e('0xb'),attributes,{'tableName':_0x480e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 2606c64..0239d5e 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 _0xe850=['info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe850,0x1f0));var _0x0e85=function(_0x4d5f29,_0x425e26){_0x4d5f29=_0x4d5f29-0x0;var _0x2c1240=_0xe850[_0x4d5f29];return _0x2c1240;};'use strict';var _=require(_0x0e85('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e85('0x1'));var rs=require(_0x0e85('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e85('0x3'))['db'];var utils=require(_0x0e85('0x4'));var logger=require('../../config/logger')(_0x0e85('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e85('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2adadf,_0x45b5fb,_0xca8e29){return new BPromise(function(_0x412164,_0x370452){return client[_0x0e85('0x7')](_0x2adadf,_0xca8e29)['then'](function(_0x50793c){logger[_0x0e85('0x8')](_0x0e85('0x9'),_0x45b5fb,'request\x20sent');logger[_0x0e85('0xa')](_0x0e85('0xb'),_0x45b5fb,_0x0e85('0xc'),JSON[_0x0e85('0xd')](_0x50793c));if(_0x50793c[_0x0e85('0xe')]){if(_0x50793c[_0x0e85('0xe')]['code']===0x1f4){logger[_0x0e85('0xe')](_0x0e85('0x9'),_0x45b5fb,_0x50793c[_0x0e85('0xe')]['message']);return _0x370452(_0x50793c[_0x0e85('0xe')]['message']);}logger[_0x0e85('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x45b5fb,_0x50793c[_0x0e85('0xe')][_0x0e85('0xf')]);return _0x412164(_0x50793c[_0x0e85('0xe')][_0x0e85('0xf')]);}else{logger[_0x0e85('0x8')](_0x0e85('0x9'),_0x45b5fb,_0x0e85('0xc'));_0x412164(_0x50793c[_0x0e85('0x10')]['message']);}})[_0x0e85('0x11')](function(_0x2bb2cc){logger[_0x0e85('0xe')](_0x0e85('0x9'),_0x45b5fb,_0x2bb2cc);_0x370452(_0x2bb2cc);});});} \ No newline at end of file +var _0x56d9=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x56d9,0x79));var _0x956d=function(_0x73ba1f,_0x588ccb){_0x73ba1f=_0x73ba1f-0x0;var _0x2e2725=_0x56d9[_0x73ba1f];return _0x2e2725;};'use strict';var _=require(_0x956d('0x0'));var util=require(_0x956d('0x1'));var moment=require('moment');var BPromise=require(_0x956d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x956d('0x3'));var db=require(_0x956d('0x4'))['db'];var utils=require(_0x956d('0x5'));var logger=require(_0x956d('0x6'))(_0x956d('0x7'));var config=require(_0x956d('0x8'));var jayson=require(_0x956d('0x9'));var client=jayson[_0x956d('0xa')][_0x956d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47119d,_0xdf35a3,_0x47fee9){return new BPromise(function(_0xe170cd,_0x54f59f){return client[_0x956d('0xc')](_0x47119d,_0x47fee9)[_0x956d('0xd')](function(_0x4c9ad1){logger[_0x956d('0xe')](_0x956d('0xf'),_0xdf35a3,_0x956d('0x10'));logger['debug'](_0x956d('0x11'),_0xdf35a3,_0x956d('0x10'),JSON[_0x956d('0x12')](_0x4c9ad1));if(_0x4c9ad1[_0x956d('0x13')]){if(_0x4c9ad1[_0x956d('0x13')][_0x956d('0x14')]===0x1f4){logger[_0x956d('0x13')](_0x956d('0xf'),_0xdf35a3,_0x4c9ad1[_0x956d('0x13')][_0x956d('0x15')]);return _0x54f59f(_0x4c9ad1['error'][_0x956d('0x15')]);}logger[_0x956d('0x13')](_0x956d('0xf'),_0xdf35a3,_0x4c9ad1['error'][_0x956d('0x15')]);return _0xe170cd(_0x4c9ad1[_0x956d('0x13')][_0x956d('0x15')]);}else{logger[_0x956d('0xe')](_0x956d('0xf'),_0xdf35a3,_0x956d('0x10'));_0xe170cd(_0x4c9ad1['result'][_0x956d('0x15')]);}})['catch'](function(_0x1f692c){logger[_0x956d('0x13')](_0x956d('0xf'),_0xdf35a3,_0x1f692c);_0x54f59f(_0x1f692c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7c11ef8..df25cc9 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 _0xf026=['index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated'];(function(_0x34e2ec,_0x5dab65){var _0x44e169=function(_0x3ead94){while(--_0x3ead94){_0x34e2ec['push'](_0x34e2ec['shift']());}};_0x44e169(++_0x5dab65);}(_0xf026,0x113));var _0x6f02=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf026[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0x6f02('0x0'));var util=require(_0x6f02('0x1'));var path=require('path');var timeout=require(_0x6f02('0x2'));var express=require(_0x6f02('0x3'));var router=express[_0x6f02('0x4')]();var fs_extra=require(_0x6f02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6f02('0x6'));var config=require(_0x6f02('0x7'));var controller=require(_0x6f02('0x8'));router[_0x6f02('0x9')]('/',auth[_0x6f02('0xa')](),controller[_0x6f02('0xb')]);router[_0x6f02('0x9')](_0x6f02('0xc'),auth[_0x6f02('0xa')](),controller['show']);router[_0x6f02('0x9')](_0x6f02('0xd'),auth['isAuthenticated'](),controller[_0x6f02('0xe')]);router[_0x6f02('0x9')](_0x6f02('0xf'),auth[_0x6f02('0xa')](),controller[_0x6f02('0x10')]);router[_0x6f02('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x6f02('0x11')),controller[_0x6f02('0x12')]);router[_0x6f02('0x13')]('/',auth[_0x6f02('0xa')](),controller[_0x6f02('0x14')]);router[_0x6f02('0x13')](_0x6f02('0x15'),auth['isAuthenticated'](),controller[_0x6f02('0x16')]);router['put'](_0x6f02('0xc'),auth[_0x6f02('0xa')](),controller['update']);router[_0x6f02('0x17')](_0x6f02('0xc'),auth['isAuthenticated'](),controller[_0x6f02('0x18')]);module[_0x6f02('0x19')]=router; \ No newline at end of file +var _0x8feb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','create','post','/:id/clone','clone','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x3fe6bc,_0x3d0783){var _0x5aeea9=function(_0x48384c){while(--_0x48384c){_0x3fe6bc['push'](_0x3fe6bc['shift']());}};_0x5aeea9(++_0x3d0783);}(_0x8feb,0x1ef));var _0xb8fe=function(_0x4486af,_0x40460e){_0x4486af=_0x4486af-0x0;var _0x38dab3=_0x8feb[_0x4486af];return _0x38dab3;};'use strict';var multer=require(_0xb8fe('0x0'));var util=require(_0xb8fe('0x1'));var path=require(_0xb8fe('0x2'));var timeout=require(_0xb8fe('0x3'));var express=require(_0xb8fe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8fe('0x5'));var interaction=require(_0xb8fe('0x6'));var config=require(_0xb8fe('0x7'));var controller=require(_0xb8fe('0x8'));router[_0xb8fe('0x9')]('/',auth[_0xb8fe('0xa')](),controller['index']);router[_0xb8fe('0x9')](_0xb8fe('0xb'),auth[_0xb8fe('0xa')](),controller[_0xb8fe('0xc')]);router[_0xb8fe('0x9')](_0xb8fe('0xd'),auth[_0xb8fe('0xa')](),controller[_0xb8fe('0xe')]);router[_0xb8fe('0x9')](_0xb8fe('0xf'),auth['isAuthenticated'](),controller[_0xb8fe('0x10')]);router[_0xb8fe('0x9')]('/:id/summary',auth[_0xb8fe('0xa')](),timeout(_0xb8fe('0x11')),controller['getSummary']);router['post']('/',auth[_0xb8fe('0xa')](),controller[_0xb8fe('0x12')]);router[_0xb8fe('0x13')](_0xb8fe('0x14'),auth[_0xb8fe('0xa')](),controller[_0xb8fe('0x15')]);router['put'](_0xb8fe('0xb'),auth[_0xb8fe('0xa')](),controller[_0xb8fe('0x16')]);router[_0xb8fe('0x17')](_0xb8fe('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb8fe('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f396678..78e4788 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 _0xab4a=['name','description','BOOLEAN','sequelize','STRING','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x595d29,_0x3cab2a){var _0x254cdf=function(_0x2f3b9c){while(--_0x2f3b9c){_0x595d29['push'](_0x595d29['shift']());}};_0x254cdf(++_0x3cab2a);}(_0xab4a,0xed));var _0xaab4=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0xab4a[_0x3a4f18];return _0x4c20fc;};'use strict';var Sequelize=require(_0xaab4('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xaab4('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xaab4('0x1')]},'formData':{'type':Sequelize['TEXT'](_0xaab4('0x2')),'set':function(_0x37b938){if(_['isObjectLike'](_0x37b938)){this[_0xaab4('0x3')](_0xaab4('0x4'),JSON[_0xaab4('0x5')](_0x37b938));}else if(_[_0xaab4('0x6')](_0x37b938)){this['setDataValue'](_0xaab4('0x4'),_0x37b938);}else{this['setDataValue'](_0xaab4('0x4'),util[_0xaab4('0x7')](_0xaab4('0x8'),this[_0xaab4('0x9')](_0xaab4('0xa'))||'',this['getDataValue'](_0xaab4('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xaab4('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xaab4('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x015f=['util','exports','STRING','name','TEXT','long','setDataValue','isString','formData','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x23439c,_0x5baf43){var _0x5f0922=function(_0x34406f){while(--_0x34406f){_0x23439c['push'](_0x23439c['shift']());}};_0x5f0922(++_0x5baf43);}(_0x015f,0x1da));var _0xf015=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x015f[_0x4defd6];return _0x4c9276;};'use strict';var Sequelize=require(_0xf015('0x0'));var _=require(_0xf015('0x1'));var util=require(_0xf015('0x2'));module[_0xf015('0x3')]={'name':{'type':Sequelize[_0xf015('0x4')],'unique':_0xf015('0x5')},'description':{'type':Sequelize[_0xf015('0x4')]},'formData':{'type':Sequelize[_0xf015('0x6')](_0xf015('0x7')),'set':function(_0x59a520){if(_['isObjectLike'](_0x59a520)){this[_0xf015('0x8')]('formData',JSON['stringify'](_0x59a520));}else if(_[_0xf015('0x9')](_0x59a520)){this['setDataValue'](_0xf015('0xa'),_0x59a520);}else{this[_0xf015('0x8')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf015('0xb')]('name')||'',this[_0xf015('0xb')](_0xf015('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf015('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a1af704..4c285ef 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 _0x21c9=['error','name','map','JscriptyProject','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','Projects','UserProfileResource','end'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x21c9,0x19e));var _0x921c=function(_0x2c20e7,_0x218066){_0x2c20e7=_0x2c20e7-0x0;var _0x38f9c2=_0x21c9[_0x2c20e7];return _0x38f9c2;};'use strict';var emlformat=require(_0x921c('0x0'));var rimraf=require(_0x921c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x921c('0x2'));var Mustache=require(_0x921c('0x3'));var util=require('util');var path=require(_0x921c('0x4'));var sox=require(_0x921c('0x5'));var csv=require(_0x921c('0x6'));var ejs=require(_0x921c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x921c('0x8'));var squel=require(_0x921c('0x9'));var crypto=require('crypto');var jsforce=require(_0x921c('0xa'));var deskjs=require(_0x921c('0xb'));var toCsv=require(_0x921c('0x6'));var querystring=require('querystring');var Papa=require(_0x921c('0xc'));var Redis=require('ioredis');var authService=require(_0x921c('0xd'));var qs=require(_0x921c('0xe'));var as=require(_0x921c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x921c('0x10'));var utils=require(_0x921c('0x11'));var config=require(_0x921c('0x12'));var licenseUtil=require(_0x921c('0x13'));var db=require(_0x921c('0x14'))['db'];function respondWithStatusCode(_0x2d2900,_0x35e2a5){_0x35e2a5=_0x35e2a5||0xcc;return function(_0x27c911){if(_0x27c911){return _0x2d2900[_0x921c('0x15')](_0x35e2a5);}return _0x2d2900['status'](_0x35e2a5)['end']();};}function respondWithResult(_0x30f963,_0x23078c){_0x23078c=_0x23078c||0xc8;return function(_0x3844f4){if(_0x3844f4){return _0x30f963[_0x921c('0x16')](_0x23078c)[_0x921c('0x17')](_0x3844f4);}};}function respondWithFilteredResult(_0x5ceefa,_0x4625af){return function(_0xe10db5){if(_0xe10db5){var _0x4d9138=typeof _0x4625af[_0x921c('0x18')]==='undefined'&&typeof _0x4625af[_0x921c('0x19')]===_0x921c('0x1a');var _0x37741c=_0xe10db5[_0x921c('0x1b')];var _0x48b227=_0x4d9138?0x0:_0x4625af['offset'];var _0x2bf896=_0x4d9138?_0xe10db5[_0x921c('0x1b')]:_0x4625af[_0x921c('0x18')]+_0x4625af['limit'];var _0x6dda6;if(_0x2bf896>=_0x37741c){_0x2bf896=_0x37741c;_0x6dda6=0xc8;}else{_0x6dda6=0xce;}_0x5ceefa['status'](_0x6dda6);return _0x5ceefa[_0x921c('0x1c')]('Content-Range',_0x48b227+'-'+_0x2bf896+'/'+_0x37741c)[_0x921c('0x17')](_0xe10db5);}return null;};}function patchUpdates(_0x5e629f){return function(_0x269383){try{jsonpatch[_0x921c('0x1d')](_0x269383,_0x5e629f,!![]);}catch(_0x270e2c){return BPromise[_0x921c('0x1e')](_0x270e2c);}return _0x269383[_0x921c('0x1f')]();};}function saveUpdates(_0x554eda,_0x203cda){return function(_0x218710){if(_0x218710){return _0x218710['update'](_0x554eda)[_0x921c('0x20')](function(_0x17178e){return _0x17178e;});}return null;};}function removeEntity(_0xc82ef4,_0x6f912c){return function(_0x5d3a8f){if(_0x5d3a8f){return _0x5d3a8f[_0x921c('0x21')]()['then'](function(){var _0x119466=_0x5d3a8f[_0x921c('0x22')]({'plain':!![]});var _0x1cf7f8=_0x921c('0x23');return db[_0x921c('0x24')][_0x921c('0x21')]({'where':{'type':_0x1cf7f8,'resourceId':_0x119466['id']}})['then'](function(){return _0x5d3a8f;});})[_0x921c('0x20')](function(){_0xc82ef4[_0x921c('0x16')](0xcc)[_0x921c('0x25')]();});}};}function handleEntityNotFound(_0x3599b5,_0x3649dc){return function(_0x4a8ebc){if(!_0x4a8ebc){_0x3599b5['sendStatus'](0x194);}return _0x4a8ebc;};}function handleError(_0x239f2d,_0x1d356b){_0x1d356b=_0x1d356b||0x1f4;return function(_0x36cf2e){logger[_0x921c('0x26')](_0x36cf2e['stack']);if(_0x36cf2e[_0x921c('0x27')]){delete _0x36cf2e[_0x921c('0x27')];}_0x239f2d[_0x921c('0x16')](_0x1d356b)['send'](_0x36cf2e);};}exports['index']=function(_0x204600,_0xbbda5f){var _0x50238f={},_0x30e483={},_0x2e205f={'count':0x0,'rows':[]};var _0x3a4eb6=_[_0x921c('0x28')](db[_0x921c('0x29')]['rawAttributes'],function(_0x5da36f){return{'name':_0x5da36f['fieldName'],'type':_0x5da36f[_0x921c('0x2a')][_0x921c('0x2b')]};});_0x30e483['model']=_['map'](_0x3a4eb6,'name');_0x30e483['query']=_[_0x921c('0x2c')](_0x204600[_0x921c('0x2d')]);_0x30e483[_0x921c('0x2e')]=_[_0x921c('0x2f')](_0x30e483[_0x921c('0x30')],_0x30e483[_0x921c('0x2d')]);_0x50238f[_0x921c('0x31')]=_['intersection'](_0x30e483[_0x921c('0x30')],qs[_0x921c('0x32')](_0x204600['query'][_0x921c('0x32')]));_0x50238f['attributes']=_0x50238f['attributes'][_0x921c('0x33')]?_0x50238f[_0x921c('0x31')]:_0x30e483[_0x921c('0x30')];if(!_0x204600[_0x921c('0x2d')][_0x921c('0x34')](_0x921c('0x35'))){_0x50238f[_0x921c('0x19')]=qs[_0x921c('0x19')](_0x204600[_0x921c('0x2d')][_0x921c('0x19')]);_0x50238f[_0x921c('0x18')]=qs[_0x921c('0x18')](_0x204600['query']['offset']);}_0x50238f[_0x921c('0x36')]=qs[_0x921c('0x37')](_0x204600[_0x921c('0x2d')][_0x921c('0x37')]);_0x50238f[_0x921c('0x38')]=qs[_0x921c('0x2e')](_[_0x921c('0x39')](_0x204600[_0x921c('0x2d')],_0x30e483[_0x921c('0x2e')]),_0x3a4eb6);if(_0x204600['query'][_0x921c('0x3a')]){_0x50238f[_0x921c('0x38')]=_[_0x921c('0x3b')](_0x50238f[_0x921c('0x38')],{'$or':_[_0x921c('0x28')](_0x3a4eb6,function(_0x1efb9b){if(_0x1efb9b[_0x921c('0x2a')]!==_0x921c('0x3c')){var _0x84337f={};_0x84337f[_0x1efb9b['name']]={'$like':'%'+_0x204600['query'][_0x921c('0x3a')]+'%'};return _0x84337f;}})});}_0x50238f=_[_0x921c('0x3b')]({},_0x50238f,_0x204600['options']);var _0x2185f5={'where':_0x50238f[_0x921c('0x38')]};return db[_0x921c('0x29')][_0x921c('0x1b')](_0x2185f5)[_0x921c('0x20')](function(_0x4fe96d){_0x2e205f[_0x921c('0x1b')]=_0x4fe96d;if(_0x204600[_0x921c('0x2d')][_0x921c('0x3d')]){_0x50238f[_0x921c('0x3e')]=[{'all':!![]}];}return db[_0x921c('0x29')]['findAll'](_0x50238f);})[_0x921c('0x20')](function(_0x39de6e){_0x2e205f[_0x921c('0x3f')]=_0x39de6e;return _0x2e205f;})['then'](respondWithFilteredResult(_0xbbda5f,_0x50238f))['catch'](handleError(_0xbbda5f,null));};exports[_0x921c('0x40')]=function(_0x3387b9,_0x28efc2){var _0x16c51e={'raw':![],'where':{'id':_0x3387b9[_0x921c('0x41')]['id']}},_0x163e3b={};_0x163e3b[_0x921c('0x30')]=_[_0x921c('0x2c')](db[_0x921c('0x29')][_0x921c('0x42')]);_0x163e3b[_0x921c('0x2d')]=_['keys'](_0x3387b9[_0x921c('0x2d')]);_0x163e3b[_0x921c('0x2e')]=_[_0x921c('0x2f')](_0x163e3b[_0x921c('0x30')],_0x163e3b[_0x921c('0x2d')]);_0x16c51e['attributes']=_[_0x921c('0x2f')](_0x163e3b[_0x921c('0x30')],qs['fields'](_0x3387b9['query']['fields']));_0x16c51e[_0x921c('0x31')]=_0x16c51e[_0x921c('0x31')][_0x921c('0x33')]?_0x16c51e[_0x921c('0x31')]:_0x163e3b[_0x921c('0x30')];if(_0x3387b9['query'][_0x921c('0x3d')]){_0x16c51e[_0x921c('0x3e')]=[{'all':!![]}];}_0x16c51e=_[_0x921c('0x3b')]({},_0x16c51e,_0x3387b9[_0x921c('0x43')]);return db[_0x921c('0x29')][_0x921c('0x44')](_0x16c51e)[_0x921c('0x20')](handleEntityNotFound(_0x28efc2,null))['then'](respondWithResult(_0x28efc2,null))[_0x921c('0x45')](handleError(_0x28efc2,null));};exports['create']=function(_0x1a2947,_0x4d5ef4){return db[_0x921c('0x29')][_0x921c('0x46')](_0x1a2947[_0x921c('0x47')],{})['then'](function(_0x5d238f){var _0x1509fe=_0x1a2947[_0x921c('0x48')][_0x921c('0x22')]({'plain':!![]});if(!_0x1509fe)throw new Error(_0x921c('0x49'));if(_0x1509fe[_0x921c('0x4a')]===_0x921c('0x48')){var _0x52c9cb=_0x5d238f[_0x921c('0x22')]({'plain':!![]});var _0x35d0bd=_0x921c('0x23');return db[_0x921c('0x4b')][_0x921c('0x44')]({'where':{'name':_0x35d0bd,'userProfileId':_0x1509fe[_0x921c('0x4c')]},'raw':!![]})[_0x921c('0x20')](function(_0x370c2a){if(_0x370c2a&&_0x370c2a[_0x921c('0x4d')]===0x0){return db[_0x921c('0x24')][_0x921c('0x46')]({'name':_0x52c9cb[_0x921c('0x27')],'resourceId':_0x52c9cb['id'],'type':_0x370c2a['name'],'sectionId':_0x370c2a['id']},{})['then'](function(){return _0x5d238f;});}else{return _0x5d238f;}})[_0x921c('0x45')](function(_0x190a6a){logger[_0x921c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x190a6a);throw _0x190a6a;});}return _0x5d238f;})[_0x921c('0x20')](respondWithResult(_0x4d5ef4,0xc9))[_0x921c('0x45')](handleError(_0x4d5ef4,null));};exports[_0x921c('0x4e')]=function(_0x499d1c,_0x3c4ac1){var _0x19036a={'where':{'id':_0x499d1c[_0x921c('0x41')]['id']}},_0x52db1e={};_0x52db1e[_0x921c('0x30')]=_[_0x921c('0x2c')](db[_0x921c('0x29')][_0x921c('0x42')]);_0x19036a['attributes']=_['intersection'](_0x52db1e[_0x921c('0x30')],qs[_0x921c('0x32')](_0x499d1c[_0x921c('0x2d')]['fields']));_0x19036a[_0x921c('0x31')]=_0x19036a[_0x921c('0x31')][_0x921c('0x33')]?_0x19036a[_0x921c('0x31')]:_0x52db1e['model'];if(_0x499d1c['query'][_0x921c('0x3d')]){_0x19036a['include']=[{'all':!![]}];}_0x19036a=_[_0x921c('0x3b')]({},_0x19036a,_0x499d1c[_0x921c('0x43')]);return db[_0x921c('0x29')][_0x921c('0x44')](_0x19036a)[_0x921c('0x20')](handleEntityNotFound(_0x3c4ac1,null))[_0x921c('0x20')](function(_0x37e28f){if(_0x37e28f){var _0x4b68b0=_0x37e28f[_0x921c('0x22')]({'plain':!![]});_0x4b68b0=qs[_0x921c('0x4f')](_0x4b68b0,['id',_0x921c('0x50'),_0x921c('0x51')]);_0x499d1c['body']=_[_0x921c('0x4f')](_0x499d1c[_0x921c('0x47')],['id',_0x921c('0x50'),_0x921c('0x51')]);return db[_0x921c('0x29')][_0x921c('0x46')](_[_0x921c('0x3b')](_0x4b68b0,_0x499d1c[_0x921c('0x47')]),{'include':_0x499d1c[_0x921c('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0x921c('0x20')](function(_0x2fac83){var _0x35a445=_0x499d1c[_0x921c('0x48')][_0x921c('0x22')]({'plain':!![]});if(!_0x35a445)throw new Error(_0x921c('0x49'));if(_0x35a445[_0x921c('0x4a')]===_0x921c('0x48')){var _0x2d7b1c=_0x2fac83[_0x921c('0x22')]({'plain':!![]});var _0x32274f=_0x921c('0x23');return db['UserProfileSection'][_0x921c('0x44')]({'where':{'name':_0x32274f,'userProfileId':_0x35a445[_0x921c('0x4c')]},'raw':!![]})[_0x921c('0x20')](function(_0xfba0d4){if(_0xfba0d4&&_0xfba0d4[_0x921c('0x4d')]===0x0){return db[_0x921c('0x24')][_0x921c('0x46')]({'name':_0x2d7b1c[_0x921c('0x27')],'resourceId':_0x2d7b1c['id'],'type':_0xfba0d4['name'],'sectionId':_0xfba0d4['id']},{})[_0x921c('0x20')](function(){return _0x2fac83;});}else{return _0x2fac83;}})[_0x921c('0x45')](function(_0x6e4ddc){logger[_0x921c('0x26')](_0x921c('0x52'),_0x6e4ddc);throw _0x6e4ddc;});}return _0x2fac83;});}})[_0x921c('0x20')](respondWithResult(_0x3c4ac1,0xc9))[_0x921c('0x45')](handleError(_0x3c4ac1,null));};exports['update']=function(_0x21de57,_0x449590){if(_0x21de57[_0x921c('0x47')]['id']){delete _0x21de57[_0x921c('0x47')]['id'];}return db[_0x921c('0x29')][_0x921c('0x44')]({'where':{'id':_0x21de57[_0x921c('0x41')]['id']}})['then'](handleEntityNotFound(_0x449590,null))[_0x921c('0x20')](saveUpdates(_0x21de57['body'],null))[_0x921c('0x20')](respondWithResult(_0x449590,null))[_0x921c('0x45')](handleError(_0x449590,null));};exports[_0x921c('0x21')]=function(_0x5b4f64,_0x2d4f3b){return db['JscriptyProject'][_0x921c('0x44')]({'where':{'id':_0x5b4f64['params']['id']}})[_0x921c('0x20')](handleEntityNotFound(_0x2d4f3b,null))['then'](removeEntity(_0x2d4f3b,null))[_0x921c('0x45')](handleError(_0x2d4f3b,null));};exports['getSessions']=function(_0x23e5c1,_0x1ef768,_0x32c509){var _0x5f19ac={'raw':!![],'where':{}};var _0x35de00={};var _0x33c1d5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x921c('0x53')]({'where':{'id':_0x23e5c1[_0x921c('0x41')]['id']}})[_0x921c('0x20')](handleEntityNotFound(_0x1ef768,null))[_0x921c('0x20')](function(_0x360a9a){if(_0x360a9a){_0x35de00[_0x921c('0x30')]=_['keys'](db[_0x921c('0x54')][_0x921c('0x42')]);_0x35de00[_0x921c('0x2d')]=_['keys'](_0x23e5c1[_0x921c('0x2d')]);_0x35de00[_0x921c('0x2e')]=_['intersection'](_0x35de00[_0x921c('0x30')],_0x35de00['query']);_0x5f19ac[_0x921c('0x31')]=_[_0x921c('0x2f')](_0x35de00['model'],qs[_0x921c('0x32')](_0x23e5c1[_0x921c('0x2d')][_0x921c('0x32')]));_0x5f19ac[_0x921c('0x31')]=_0x5f19ac['attributes'][_0x921c('0x33')]?_0x5f19ac[_0x921c('0x31')]:_0x35de00['model'];if(!_0x23e5c1[_0x921c('0x2d')]['hasOwnProperty']('nolimit')){_0x5f19ac[_0x921c('0x19')]=qs[_0x921c('0x19')](_0x23e5c1[_0x921c('0x2d')]['limit']);_0x5f19ac[_0x921c('0x18')]=qs['offset'](_0x23e5c1['query'][_0x921c('0x18')]);}_0x5f19ac['order']=qs[_0x921c('0x37')](_0x23e5c1[_0x921c('0x2d')][_0x921c('0x37')]);_0x5f19ac[_0x921c('0x38')]=qs[_0x921c('0x2e')](_['pick'](_0x23e5c1[_0x921c('0x2d')],_0x35de00[_0x921c('0x2e')]));_0x5f19ac['where'][_0x921c('0x55')]=_0x360a9a['id'];if(_0x23e5c1['query'][_0x921c('0x3a')]){_0x5f19ac['where']=_['merge'](_0x5f19ac[_0x921c('0x38')],{'$or':_[_0x921c('0x28')](_0x5f19ac[_0x921c('0x31')],function(_0xdfeebd){var _0xf2d8d={};_0xf2d8d[_0xdfeebd]={'$like':'%'+_0x23e5c1[_0x921c('0x2d')]['filter']+'%'};return _0xf2d8d;})});}_0x5f19ac=_['merge']({},_0x5f19ac,_0x23e5c1[_0x921c('0x43')]);return db[_0x921c('0x54')][_0x921c('0x1b')]({'where':_0x5f19ac[_0x921c('0x38')]})[_0x921c('0x20')](function(_0x38a6c8){_0x33c1d5[_0x921c('0x1b')]=_0x38a6c8;if(_0x23e5c1['query']['includeAll']){_0x5f19ac['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x921c('0x56')](_0x5f19ac);})['then'](function(_0x58e547){_0x33c1d5[_0x921c('0x3f')]=_0x58e547;return _0x33c1d5;});}})[_0x921c('0x20')](respondWithFilteredResult(_0x1ef768,_0x5f19ac))['catch'](handleError(_0x1ef768,null));};exports[_0x921c('0x57')]=function(_0x217abd,_0x2c0d11,_0x16a553){var _0x33b76d={'raw':!![],'where':{}};var _0x9c8255={};var _0x4aa0ba={'count':0x0,'rows':[]};return db[_0x921c('0x29')][_0x921c('0x53')]({'where':{'id':_0x217abd[_0x921c('0x41')]['id']}})[_0x921c('0x20')](handleEntityNotFound(_0x2c0d11,null))[_0x921c('0x20')](function(_0x1bdcd7){if(_0x1bdcd7){_0x9c8255[_0x921c('0x30')]=_[_0x921c('0x2c')](db[_0x921c('0x58')][_0x921c('0x42')]);_0x9c8255['query']=_[_0x921c('0x2c')](_0x217abd[_0x921c('0x2d')]);_0x9c8255['filters']=_['intersection'](_0x9c8255[_0x921c('0x30')],_0x9c8255[_0x921c('0x2d')]);_0x33b76d[_0x921c('0x31')]=_[_0x921c('0x2f')](_0x9c8255['model'],qs[_0x921c('0x32')](_0x217abd[_0x921c('0x2d')][_0x921c('0x32')]));_0x33b76d[_0x921c('0x31')]=_0x33b76d[_0x921c('0x31')][_0x921c('0x33')]?_0x33b76d['attributes']:_0x9c8255['model'];if(!_0x217abd[_0x921c('0x2d')][_0x921c('0x34')](_0x921c('0x35'))){_0x33b76d[_0x921c('0x19')]=qs['limit'](_0x217abd[_0x921c('0x2d')][_0x921c('0x19')]);_0x33b76d[_0x921c('0x18')]=qs[_0x921c('0x18')](_0x217abd[_0x921c('0x2d')]['offset']);}_0x33b76d[_0x921c('0x36')]=qs[_0x921c('0x37')](_0x217abd['query']['sort']);_0x33b76d[_0x921c('0x38')]=qs[_0x921c('0x2e')](_[_0x921c('0x39')](_0x217abd['query'],_0x9c8255[_0x921c('0x2e')]));_0x33b76d[_0x921c('0x38')]['ProjectId']=_0x1bdcd7['id'];if(_0x217abd[_0x921c('0x2d')][_0x921c('0x3a')]){_0x33b76d[_0x921c('0x38')]=_[_0x921c('0x3b')](_0x33b76d['where'],{'$or':_[_0x921c('0x28')](_0x33b76d['attributes'],function(_0x31c8e2){var _0x489071={};_0x489071[_0x31c8e2]={'$like':'%'+_0x217abd[_0x921c('0x2d')][_0x921c('0x3a')]+'%'};return _0x489071;})});}_0x33b76d=_[_0x921c('0x3b')]({},_0x33b76d,_0x217abd[_0x921c('0x43')]);return db['JscriptyAnswerReport'][_0x921c('0x1b')]({'where':_0x33b76d['where']})[_0x921c('0x20')](function(_0x24972d){_0x4aa0ba[_0x921c('0x1b')]=_0x24972d;if(_0x217abd[_0x921c('0x2d')][_0x921c('0x3d')]){_0x33b76d['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x921c('0x56')](_0x33b76d);})[_0x921c('0x20')](function(_0x4deddc){_0x4aa0ba[_0x921c('0x3f')]=_0x4deddc;return _0x4aa0ba;});}})[_0x921c('0x20')](respondWithFilteredResult(_0x2c0d11,_0x33b76d))['catch'](handleError(_0x2c0d11,null));};function char(_0x548f5b){return'number'===typeof _0x548f5b?String[_0x921c('0x59')][_0x921c('0x1d')](null,arguments):_0x548f5b;}function needsEncapsulation(_0x239a73){return!!_0x239a73&&(_0x239a73[_0x921c('0x5a')]()['indexOf'](char(0xd))>=0x0||_0x239a73[_0x921c('0x5a')]()[_0x921c('0x5b')](char(0xa))>=0x0||_0x239a73[_0x921c('0x5a')]()['indexOf'](char(0x2c))>=0x0||_0x239a73[_0x921c('0x5a')]()[_0x921c('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x4682ca){var _0x51e4e1=char(0x22),_0x3fb3c4='\x5c'+char(0x22),_0x37325b=_0x4682ca[_0x921c('0x5a')]()[_0x921c('0x5c')](new RegExp(_0x51e4e1,'g'),_0x3fb3c4);return _0x51e4e1+_0x37325b+_0x51e4e1;}exports[_0x921c('0x5d')]=function(_0x638017,_0x1e403e,_0x44aafb){var _0x3d77bd,_0x3ef0c4;var _0x131e2d={'where':{'ProjectId':_0x638017[_0x921c('0x41')]['id']}};if(_0x638017[_0x921c('0x2d')][_0x921c('0x5e')]){_0x131e2d[_0x921c('0x38')]['starttime']=JSON['parse'](_0x638017[_0x921c('0x2d')][_0x921c('0x5e')]);}return db[_0x921c('0x54')][_0x921c('0x56')](_0x131e2d)[_0x921c('0x20')](handleEntityNotFound(_0x1e403e,null))['then'](function(_0x2e26b1){if(_0x2e26b1){_0x3d77bd=_0x2e26b1;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0x3d77bd,'id')},'ProjectId':_0x638017[_0x921c('0x41')]['id']},'order':_0x921c('0x5f')});}})[_0x921c('0x20')](handleEntityNotFound(_0x1e403e,null))[_0x921c('0x20')](function(_0x121ffb){if(_0x121ffb){_0x3ef0c4=_0x121ffb;var _0x216fa1={};for(var _0x688914=0x0,_0x5af810=_0x3ef0c4['length'];_0x688914<_0x5af810;_0x688914++){if(!_0x216fa1[_0x921c('0x34')](_0x3ef0c4[_0x688914][_0x921c('0x60')])){_0x216fa1[_0x3ef0c4[_0x688914][_0x921c('0x60')]]=needsEncapsulation(_0x3ef0c4[_0x688914][_0x921c('0x61')])?encapsulate(_0x3ef0c4[_0x688914]['question']):_0x3ef0c4[_0x688914]['question'];}}var _0x156ca7=[],_0x96fa82={};for(var _0x22bbb4=0x0,_0x265409=_0x3d77bd[_0x921c('0x33')];_0x22bbb4<_0x265409;_0x22bbb4++){_0x96fa82={'ProjectId':_0x638017[_0x921c('0x41')]['id'],'SessionId':_0x3d77bd[_0x22bbb4]['id'],'StartTime':moment(_0x3d77bd[_0x22bbb4][_0x921c('0x62')])[_0x921c('0x63')](_0x921c('0x64'))};for(var _0x1d2e4f=0x0,_0x1606fb=_0x3ef0c4[_0x921c('0x33')];_0x1d2e4f<_0x1606fb;_0x1d2e4f++){if(_0x3ef0c4[_0x1d2e4f][_0x921c('0x65')]==_0x3d77bd[_0x22bbb4]['id']&&_0x216fa1[_0x921c('0x34')](_0x3ef0c4[_0x1d2e4f]['questionId'])){_0x96fa82[_0x216fa1[_0x3ef0c4[_0x1d2e4f][_0x921c('0x60')]]]=_0x3ef0c4[_0x1d2e4f][_0x921c('0x66')];}}for(var _0x7f373b in _0x216fa1){if(!_0x96fa82[_0x921c('0x34')](_0x216fa1[_0x7f373b])){_0x96fa82[_0x216fa1[_0x7f373b]]=null;}}_0x156ca7[_0x921c('0x67')](_0x96fa82);}return _0x156ca7;}})[_0x921c('0x20')](function(_0x1e5390){if(!_[_0x921c('0x68')](_0x1e5390)){var _0x48a87a=toCsv(_0x1e5390);var _0x2d188b=Date['now']();fs[_0x921c('0x69')](util[_0x921c('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x638017[_0x921c('0x41')]['id'],_0x2d188b),_0x48a87a);_0x1e403e['setHeader'](_0x921c('0x6a'),_0x921c('0x6b')+util['format'](_0x921c('0x6c'),_0x638017[_0x921c('0x41')]['id'],_0x2d188b));_0x1e403e[_0x921c('0x6d')](_0x921c('0x6e'),_0x921c('0x6f'));return _0x1e403e[_0x921c('0x70')](util[_0x921c('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x638017['params']['id'],_0x2d188b));}else{return _0x1e403e['sendStatus'](0xcc);}})[_0x921c('0x45')](handleError(_0x1e403e,null));}; \ No newline at end of file +var _0x7a40=['findAll','rows','params','keys','fields','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','catch','clone','omit','createdAt','updatedAt','role','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','number','indexOf','toString','replace','getSummary','startTime','starttime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Projects','error','stack','name','index','JscriptyProject','rawAttributes','key','model','map','query','intersection','attributes','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x1c6bcd,_0x107272){var _0x16f7de=function(_0x52bf30){while(--_0x52bf30){_0x1c6bcd['push'](_0x1c6bcd['shift']());}};_0x16f7de(++_0x107272);}(_0x7a40,0x197));var _0x07a4=function(_0x4273d2,_0xf5cc7d){_0x4273d2=_0x4273d2-0x0;var _0x4309cf=_0x7a40[_0x4273d2];return _0x4309cf;};'use strict';var emlformat=require(_0x07a4('0x0'));var rimraf=require(_0x07a4('0x1'));var zipdir=require(_0x07a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07a4('0x3'));var moment=require(_0x07a4('0x4'));var BPromise=require(_0x07a4('0x5'));var Mustache=require(_0x07a4('0x6'));var util=require(_0x07a4('0x7'));var path=require('path');var sox=require(_0x07a4('0x8'));var csv=require(_0x07a4('0x9'));var ejs=require(_0x07a4('0xa'));var fs=require('fs');var fs_extra=require(_0x07a4('0xb'));var _=require(_0x07a4('0xc'));var squel=require('squel');var crypto=require(_0x07a4('0xd'));var jsforce=require(_0x07a4('0xe'));var deskjs=require(_0x07a4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07a4('0x10'));var Redis=require(_0x07a4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x07a4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07a4('0x13'))('api');var utils=require(_0x07a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x07a4('0x15'));var db=require(_0x07a4('0x16'))['db'];function respondWithStatusCode(_0x30cfee,_0x20d755){_0x20d755=_0x20d755||0xcc;return function(_0x5210ff){if(_0x5210ff){return _0x30cfee[_0x07a4('0x17')](_0x20d755);}return _0x30cfee[_0x07a4('0x18')](_0x20d755)[_0x07a4('0x19')]();};}function respondWithResult(_0x5a5b1d,_0x1de6b2){_0x1de6b2=_0x1de6b2||0xc8;return function(_0x4c1893){if(_0x4c1893){return _0x5a5b1d[_0x07a4('0x18')](_0x1de6b2)[_0x07a4('0x1a')](_0x4c1893);}};}function respondWithFilteredResult(_0x108eb7,_0x2d61cd){return function(_0x3a2b26){if(_0x3a2b26){var _0x97372b=typeof _0x2d61cd[_0x07a4('0x1b')]===_0x07a4('0x1c')&&typeof _0x2d61cd['limit']===_0x07a4('0x1c');var _0x1fbf2f=_0x3a2b26[_0x07a4('0x1d')];var _0xe8294b=_0x97372b?0x0:_0x2d61cd[_0x07a4('0x1b')];var _0x568b0a=_0x97372b?_0x3a2b26[_0x07a4('0x1d')]:_0x2d61cd['offset']+_0x2d61cd['limit'];var _0x47e86f;if(_0x568b0a>=_0x1fbf2f){_0x568b0a=_0x1fbf2f;_0x47e86f=0xc8;}else{_0x47e86f=0xce;}_0x108eb7[_0x07a4('0x18')](_0x47e86f);return _0x108eb7[_0x07a4('0x1e')](_0x07a4('0x1f'),_0xe8294b+'-'+_0x568b0a+'/'+_0x1fbf2f)['json'](_0x3a2b26);}return null;};}function patchUpdates(_0x2dcb30){return function(_0x464a98){try{jsonpatch[_0x07a4('0x20')](_0x464a98,_0x2dcb30,!![]);}catch(_0x26fa10){return BPromise[_0x07a4('0x21')](_0x26fa10);}return _0x464a98[_0x07a4('0x22')]();};}function saveUpdates(_0x110356,_0x38a411){return function(_0xdea92f){if(_0xdea92f){return _0xdea92f['update'](_0x110356)[_0x07a4('0x23')](function(_0x4e8094){return _0x4e8094;});}return null;};}function removeEntity(_0x5363ff,_0x13d1ee){return function(_0x36760b){if(_0x36760b){return _0x36760b[_0x07a4('0x24')]()['then'](function(){var _0x223dd2=_0x36760b[_0x07a4('0x25')]({'plain':!![]});var _0x2232d4=_0x07a4('0x26');return db['UserProfileResource'][_0x07a4('0x24')]({'where':{'type':_0x2232d4,'resourceId':_0x223dd2['id']}})['then'](function(){return _0x36760b;});})[_0x07a4('0x23')](function(){_0x5363ff[_0x07a4('0x18')](0xcc)[_0x07a4('0x19')]();});}};}function handleEntityNotFound(_0x4a0b36,_0x2e47b9){return function(_0x5db079){if(!_0x5db079){_0x4a0b36[_0x07a4('0x17')](0x194);}return _0x5db079;};}function handleError(_0x52e6e2,_0x570232){_0x570232=_0x570232||0x1f4;return function(_0x5593b9){logger[_0x07a4('0x27')](_0x5593b9[_0x07a4('0x28')]);if(_0x5593b9[_0x07a4('0x29')]){delete _0x5593b9['name'];}_0x52e6e2[_0x07a4('0x18')](_0x570232)['send'](_0x5593b9);};}exports[_0x07a4('0x2a')]=function(_0x1dcdf7,_0x32452a){var _0x4cca1d={},_0x173851={},_0x4d9308={'count':0x0,'rows':[]};var _0x506e45=_['map'](db[_0x07a4('0x2b')][_0x07a4('0x2c')],function(_0x35849c){return{'name':_0x35849c['fieldName'],'type':_0x35849c['type'][_0x07a4('0x2d')]};});_0x173851[_0x07a4('0x2e')]=_[_0x07a4('0x2f')](_0x506e45,_0x07a4('0x29'));_0x173851[_0x07a4('0x30')]=_['keys'](_0x1dcdf7[_0x07a4('0x30')]);_0x173851['filters']=_[_0x07a4('0x31')](_0x173851[_0x07a4('0x2e')],_0x173851[_0x07a4('0x30')]);_0x4cca1d[_0x07a4('0x32')]=_[_0x07a4('0x31')](_0x173851[_0x07a4('0x2e')],qs['fields'](_0x1dcdf7['query']['fields']));_0x4cca1d[_0x07a4('0x32')]=_0x4cca1d[_0x07a4('0x32')]['length']?_0x4cca1d[_0x07a4('0x32')]:_0x173851[_0x07a4('0x2e')];if(!_0x1dcdf7[_0x07a4('0x30')]['hasOwnProperty'](_0x07a4('0x33'))){_0x4cca1d[_0x07a4('0x34')]=qs[_0x07a4('0x34')](_0x1dcdf7['query'][_0x07a4('0x34')]);_0x4cca1d['offset']=qs[_0x07a4('0x1b')](_0x1dcdf7[_0x07a4('0x30')][_0x07a4('0x1b')]);}_0x4cca1d[_0x07a4('0x35')]=qs[_0x07a4('0x36')](_0x1dcdf7[_0x07a4('0x30')][_0x07a4('0x36')]);_0x4cca1d[_0x07a4('0x37')]=qs['filters'](_[_0x07a4('0x38')](_0x1dcdf7['query'],_0x173851[_0x07a4('0x39')]),_0x506e45);if(_0x1dcdf7[_0x07a4('0x30')][_0x07a4('0x3a')]){_0x4cca1d[_0x07a4('0x37')]=_[_0x07a4('0x3b')](_0x4cca1d[_0x07a4('0x37')],{'$or':_['map'](_0x506e45,function(_0x533392){if(_0x533392[_0x07a4('0x3c')]!==_0x07a4('0x3d')){var _0x4f286e={};_0x4f286e[_0x533392[_0x07a4('0x29')]]={'$like':'%'+_0x1dcdf7[_0x07a4('0x30')][_0x07a4('0x3a')]+'%'};return _0x4f286e;}})});}_0x4cca1d=_['merge']({},_0x4cca1d,_0x1dcdf7[_0x07a4('0x3e')]);var _0x39a3f0={'where':_0x4cca1d[_0x07a4('0x37')]};return db[_0x07a4('0x2b')][_0x07a4('0x1d')](_0x39a3f0)[_0x07a4('0x23')](function(_0x127fc5){_0x4d9308[_0x07a4('0x1d')]=_0x127fc5;if(_0x1dcdf7[_0x07a4('0x30')][_0x07a4('0x3f')]){_0x4cca1d[_0x07a4('0x40')]=[{'all':!![]}];}return db[_0x07a4('0x2b')][_0x07a4('0x41')](_0x4cca1d);})['then'](function(_0x109450){_0x4d9308[_0x07a4('0x42')]=_0x109450;return _0x4d9308;})[_0x07a4('0x23')](respondWithFilteredResult(_0x32452a,_0x4cca1d))['catch'](handleError(_0x32452a,null));};exports['show']=function(_0x25f153,_0x11c304){var _0x106f6d={'raw':![],'where':{'id':_0x25f153[_0x07a4('0x43')]['id']}},_0x297c1e={};_0x297c1e[_0x07a4('0x2e')]=_['keys'](db[_0x07a4('0x2b')][_0x07a4('0x2c')]);_0x297c1e['query']=_[_0x07a4('0x44')](_0x25f153['query']);_0x297c1e[_0x07a4('0x39')]=_[_0x07a4('0x31')](_0x297c1e[_0x07a4('0x2e')],_0x297c1e[_0x07a4('0x30')]);_0x106f6d[_0x07a4('0x32')]=_[_0x07a4('0x31')](_0x297c1e['model'],qs[_0x07a4('0x45')](_0x25f153[_0x07a4('0x30')]['fields']));_0x106f6d[_0x07a4('0x32')]=_0x106f6d[_0x07a4('0x32')][_0x07a4('0x46')]?_0x106f6d[_0x07a4('0x32')]:_0x297c1e['model'];if(_0x25f153[_0x07a4('0x30')][_0x07a4('0x3f')]){_0x106f6d[_0x07a4('0x40')]=[{'all':!![]}];}_0x106f6d=_[_0x07a4('0x3b')]({},_0x106f6d,_0x25f153[_0x07a4('0x3e')]);return db[_0x07a4('0x2b')][_0x07a4('0x47')](_0x106f6d)['then'](handleEntityNotFound(_0x11c304,null))['then'](respondWithResult(_0x11c304,null))['catch'](handleError(_0x11c304,null));};exports['create']=function(_0x26c936,_0x4d264e){return db[_0x07a4('0x2b')]['create'](_0x26c936[_0x07a4('0x48')],{})[_0x07a4('0x23')](function(_0x2d5b42){var _0x3299e7=_0x26c936[_0x07a4('0x49')][_0x07a4('0x25')]({'plain':!![]});if(!_0x3299e7)throw new Error(_0x07a4('0x4a'));if(_0x3299e7['role']===_0x07a4('0x49')){var _0x3ee1da=_0x2d5b42['get']({'plain':!![]});var _0x391185=_0x07a4('0x26');return db[_0x07a4('0x4b')][_0x07a4('0x47')]({'where':{'name':_0x391185,'userProfileId':_0x3299e7[_0x07a4('0x4c')]},'raw':!![]})[_0x07a4('0x23')](function(_0x328584){if(_0x328584&&_0x328584['autoAssociation']===0x0){return db[_0x07a4('0x4d')]['create']({'name':_0x3ee1da[_0x07a4('0x29')],'resourceId':_0x3ee1da['id'],'type':_0x328584[_0x07a4('0x29')],'sectionId':_0x328584['id']},{})[_0x07a4('0x23')](function(){return _0x2d5b42;});}else{return _0x2d5b42;}})['catch'](function(_0x20e06f){logger[_0x07a4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20e06f);throw _0x20e06f;});}return _0x2d5b42;})[_0x07a4('0x23')](respondWithResult(_0x4d264e,0xc9))[_0x07a4('0x4e')](handleError(_0x4d264e,null));};exports[_0x07a4('0x4f')]=function(_0xb66dcf,_0x512f9a){var _0x4d392f={'where':{'id':_0xb66dcf[_0x07a4('0x43')]['id']}},_0x33d33b={};_0x33d33b[_0x07a4('0x2e')]=_[_0x07a4('0x44')](db['JscriptyProject'][_0x07a4('0x2c')]);_0x4d392f[_0x07a4('0x32')]=_[_0x07a4('0x31')](_0x33d33b[_0x07a4('0x2e')],qs[_0x07a4('0x45')](_0xb66dcf[_0x07a4('0x30')][_0x07a4('0x45')]));_0x4d392f['attributes']=_0x4d392f[_0x07a4('0x32')][_0x07a4('0x46')]?_0x4d392f[_0x07a4('0x32')]:_0x33d33b['model'];if(_0xb66dcf[_0x07a4('0x30')][_0x07a4('0x3f')]){_0x4d392f['include']=[{'all':!![]}];}_0x4d392f=_[_0x07a4('0x3b')]({},_0x4d392f,_0xb66dcf['options']);return db[_0x07a4('0x2b')]['find'](_0x4d392f)[_0x07a4('0x23')](handleEntityNotFound(_0x512f9a,null))[_0x07a4('0x23')](function(_0x2c5efb){if(_0x2c5efb){var _0x3211d8=_0x2c5efb[_0x07a4('0x25')]({'plain':!![]});_0x3211d8=qs[_0x07a4('0x50')](_0x3211d8,['id',_0x07a4('0x51'),_0x07a4('0x52')]);_0xb66dcf[_0x07a4('0x48')]=_[_0x07a4('0x50')](_0xb66dcf[_0x07a4('0x48')],['id','createdAt',_0x07a4('0x52')]);return db[_0x07a4('0x2b')]['create'](_['merge'](_0x3211d8,_0xb66dcf[_0x07a4('0x48')]),{'include':_0xb66dcf['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4dd550){var _0x800cb7=_0xb66dcf[_0x07a4('0x49')][_0x07a4('0x25')]({'plain':!![]});if(!_0x800cb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x800cb7[_0x07a4('0x53')]===_0x07a4('0x49')){var _0x55f3f6=_0x4dd550[_0x07a4('0x25')]({'plain':!![]});var _0x264836=_0x07a4('0x26');return db[_0x07a4('0x4b')]['find']({'where':{'name':_0x264836,'userProfileId':_0x800cb7[_0x07a4('0x4c')]},'raw':!![]})[_0x07a4('0x23')](function(_0x4bfe0b){if(_0x4bfe0b&&_0x4bfe0b['autoAssociation']===0x0){return db[_0x07a4('0x4d')][_0x07a4('0x54')]({'name':_0x55f3f6[_0x07a4('0x29')],'resourceId':_0x55f3f6['id'],'type':_0x4bfe0b[_0x07a4('0x29')],'sectionId':_0x4bfe0b['id']},{})[_0x07a4('0x23')](function(){return _0x4dd550;});}else{return _0x4dd550;}})[_0x07a4('0x4e')](function(_0x136d8b){logger[_0x07a4('0x27')](_0x07a4('0x55'),_0x136d8b);throw _0x136d8b;});}return _0x4dd550;});}})[_0x07a4('0x23')](respondWithResult(_0x512f9a,0xc9))[_0x07a4('0x4e')](handleError(_0x512f9a,null));};exports[_0x07a4('0x56')]=function(_0x549281,_0xe58db5){if(_0x549281[_0x07a4('0x48')]['id']){delete _0x549281['body']['id'];}return db['JscriptyProject'][_0x07a4('0x47')]({'where':{'id':_0x549281['params']['id']}})['then'](handleEntityNotFound(_0xe58db5,null))['then'](saveUpdates(_0x549281[_0x07a4('0x48')],null))[_0x07a4('0x23')](respondWithResult(_0xe58db5,null))[_0x07a4('0x4e')](handleError(_0xe58db5,null));};exports[_0x07a4('0x24')]=function(_0x45860e,_0x39857b){return db[_0x07a4('0x2b')][_0x07a4('0x47')]({'where':{'id':_0x45860e[_0x07a4('0x43')]['id']}})[_0x07a4('0x23')](handleEntityNotFound(_0x39857b,null))[_0x07a4('0x23')](removeEntity(_0x39857b,null))[_0x07a4('0x4e')](handleError(_0x39857b,null));};exports[_0x07a4('0x57')]=function(_0x559a52,_0x120662,_0x2003ec){var _0x4880fc={'raw':!![],'where':{}};var _0x4963e1={};var _0x2db9a9={'count':0x0,'rows':[]};return db[_0x07a4('0x2b')][_0x07a4('0x58')]({'where':{'id':_0x559a52[_0x07a4('0x43')]['id']}})[_0x07a4('0x23')](handleEntityNotFound(_0x120662,null))[_0x07a4('0x23')](function(_0x2f4e8c){if(_0x2f4e8c){_0x4963e1[_0x07a4('0x2e')]=_[_0x07a4('0x44')](db[_0x07a4('0x59')]['rawAttributes']);_0x4963e1[_0x07a4('0x30')]=_[_0x07a4('0x44')](_0x559a52[_0x07a4('0x30')]);_0x4963e1[_0x07a4('0x39')]=_[_0x07a4('0x31')](_0x4963e1[_0x07a4('0x2e')],_0x4963e1[_0x07a4('0x30')]);_0x4880fc['attributes']=_['intersection'](_0x4963e1[_0x07a4('0x2e')],qs[_0x07a4('0x45')](_0x559a52[_0x07a4('0x30')][_0x07a4('0x45')]));_0x4880fc['attributes']=_0x4880fc[_0x07a4('0x32')][_0x07a4('0x46')]?_0x4880fc['attributes']:_0x4963e1['model'];if(!_0x559a52['query'][_0x07a4('0x5a')](_0x07a4('0x33'))){_0x4880fc[_0x07a4('0x34')]=qs['limit'](_0x559a52[_0x07a4('0x30')][_0x07a4('0x34')]);_0x4880fc[_0x07a4('0x1b')]=qs[_0x07a4('0x1b')](_0x559a52[_0x07a4('0x30')][_0x07a4('0x1b')]);}_0x4880fc[_0x07a4('0x35')]=qs[_0x07a4('0x36')](_0x559a52['query'][_0x07a4('0x36')]);_0x4880fc['where']=qs[_0x07a4('0x39')](_[_0x07a4('0x38')](_0x559a52[_0x07a4('0x30')],_0x4963e1[_0x07a4('0x39')]));_0x4880fc[_0x07a4('0x37')][_0x07a4('0x5b')]=_0x2f4e8c['id'];if(_0x559a52['query'][_0x07a4('0x3a')]){_0x4880fc['where']=_[_0x07a4('0x3b')](_0x4880fc[_0x07a4('0x37')],{'$or':_[_0x07a4('0x2f')](_0x4880fc[_0x07a4('0x32')],function(_0x1e79e5){var _0x48ffa2={};_0x48ffa2[_0x1e79e5]={'$like':'%'+_0x559a52[_0x07a4('0x30')][_0x07a4('0x3a')]+'%'};return _0x48ffa2;})});}_0x4880fc=_[_0x07a4('0x3b')]({},_0x4880fc,_0x559a52['options']);return db[_0x07a4('0x59')][_0x07a4('0x1d')]({'where':_0x4880fc[_0x07a4('0x37')]})[_0x07a4('0x23')](function(_0x479166){_0x2db9a9[_0x07a4('0x1d')]=_0x479166;if(_0x559a52[_0x07a4('0x30')][_0x07a4('0x3f')]){_0x4880fc[_0x07a4('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x07a4('0x41')](_0x4880fc);})[_0x07a4('0x23')](function(_0x53fce3){_0x2db9a9[_0x07a4('0x42')]=_0x53fce3;return _0x2db9a9;});}})[_0x07a4('0x23')](respondWithFilteredResult(_0x120662,_0x4880fc))[_0x07a4('0x4e')](handleError(_0x120662,null));};exports[_0x07a4('0x5c')]=function(_0x4c9894,_0x5abea8,_0x48b741){var _0x29e918={'raw':!![],'where':{}};var _0xa32042={};var _0x35b811={'count':0x0,'rows':[]};return db[_0x07a4('0x2b')][_0x07a4('0x58')]({'where':{'id':_0x4c9894['params']['id']}})[_0x07a4('0x23')](handleEntityNotFound(_0x5abea8,null))[_0x07a4('0x23')](function(_0x422183){if(_0x422183){_0xa32042['model']=_[_0x07a4('0x44')](db[_0x07a4('0x5d')][_0x07a4('0x2c')]);_0xa32042[_0x07a4('0x30')]=_['keys'](_0x4c9894['query']);_0xa32042[_0x07a4('0x39')]=_[_0x07a4('0x31')](_0xa32042[_0x07a4('0x2e')],_0xa32042[_0x07a4('0x30')]);_0x29e918[_0x07a4('0x32')]=_[_0x07a4('0x31')](_0xa32042['model'],qs[_0x07a4('0x45')](_0x4c9894['query']['fields']));_0x29e918[_0x07a4('0x32')]=_0x29e918[_0x07a4('0x32')]['length']?_0x29e918[_0x07a4('0x32')]:_0xa32042[_0x07a4('0x2e')];if(!_0x4c9894[_0x07a4('0x30')][_0x07a4('0x5a')](_0x07a4('0x33'))){_0x29e918['limit']=qs[_0x07a4('0x34')](_0x4c9894[_0x07a4('0x30')][_0x07a4('0x34')]);_0x29e918[_0x07a4('0x1b')]=qs[_0x07a4('0x1b')](_0x4c9894['query']['offset']);}_0x29e918['order']=qs[_0x07a4('0x36')](_0x4c9894[_0x07a4('0x30')][_0x07a4('0x36')]);_0x29e918['where']=qs[_0x07a4('0x39')](_[_0x07a4('0x38')](_0x4c9894['query'],_0xa32042['filters']));_0x29e918[_0x07a4('0x37')][_0x07a4('0x5b')]=_0x422183['id'];if(_0x4c9894['query'][_0x07a4('0x3a')]){_0x29e918[_0x07a4('0x37')]=_[_0x07a4('0x3b')](_0x29e918['where'],{'$or':_[_0x07a4('0x2f')](_0x29e918[_0x07a4('0x32')],function(_0x2c57c9){var _0x48a8de={};_0x48a8de[_0x2c57c9]={'$like':'%'+_0x4c9894[_0x07a4('0x30')][_0x07a4('0x3a')]+'%'};return _0x48a8de;})});}_0x29e918=_[_0x07a4('0x3b')]({},_0x29e918,_0x4c9894[_0x07a4('0x3e')]);return db[_0x07a4('0x5d')]['count']({'where':_0x29e918[_0x07a4('0x37')]})[_0x07a4('0x23')](function(_0x5ea80b){_0x35b811[_0x07a4('0x1d')]=_0x5ea80b;if(_0x4c9894[_0x07a4('0x30')]['includeAll']){_0x29e918[_0x07a4('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x07a4('0x41')](_0x29e918);})[_0x07a4('0x23')](function(_0x5a475e){_0x35b811[_0x07a4('0x42')]=_0x5a475e;return _0x35b811;});}})[_0x07a4('0x23')](respondWithFilteredResult(_0x5abea8,_0x29e918))[_0x07a4('0x4e')](handleError(_0x5abea8,null));};function char(_0x427290){return _0x07a4('0x5e')===typeof _0x427290?String['fromCharCode'][_0x07a4('0x20')](null,arguments):_0x427290;}function needsEncapsulation(_0x756f7f){return!!_0x756f7f&&(_0x756f7f['toString']()[_0x07a4('0x5f')](char(0xd))>=0x0||_0x756f7f['toString']()[_0x07a4('0x5f')](char(0xa))>=0x0||_0x756f7f[_0x07a4('0x60')]()[_0x07a4('0x5f')](char(0x2c))>=0x0||_0x756f7f[_0x07a4('0x60')]()[_0x07a4('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x109b11){var _0x595a53=char(0x22),_0x5e3b72='\x5c'+char(0x22),_0x5edfa6=_0x109b11[_0x07a4('0x60')]()[_0x07a4('0x61')](new RegExp(_0x595a53,'g'),_0x5e3b72);return _0x595a53+_0x5edfa6+_0x595a53;}exports[_0x07a4('0x62')]=function(_0x1720d5,_0x429e27,_0x18e7cf){var _0x45a408,_0x292c2a;var _0x337461={'where':{'ProjectId':_0x1720d5[_0x07a4('0x43')]['id']}};if(_0x1720d5[_0x07a4('0x30')][_0x07a4('0x63')]){_0x337461[_0x07a4('0x37')][_0x07a4('0x64')]=JSON['parse'](_0x1720d5[_0x07a4('0x30')]['startTime']);}return db[_0x07a4('0x59')][_0x07a4('0x41')](_0x337461)[_0x07a4('0x23')](handleEntityNotFound(_0x429e27,null))[_0x07a4('0x23')](function(_0x126d1b){if(_0x126d1b){_0x45a408=_0x126d1b;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x07a4('0x2f')](_0x45a408,'id')},'ProjectId':_0x1720d5[_0x07a4('0x43')]['id']},'order':_0x07a4('0x65')});}})['then'](handleEntityNotFound(_0x429e27,null))[_0x07a4('0x23')](function(_0x28606f){if(_0x28606f){_0x292c2a=_0x28606f;var _0x58bf03={};for(var _0x121a41=0x0,_0x2f2890=_0x292c2a[_0x07a4('0x46')];_0x121a41<_0x2f2890;_0x121a41++){if(!_0x58bf03['hasOwnProperty'](_0x292c2a[_0x121a41][_0x07a4('0x66')])){_0x58bf03[_0x292c2a[_0x121a41][_0x07a4('0x66')]]=needsEncapsulation(_0x292c2a[_0x121a41]['question'])?encapsulate(_0x292c2a[_0x121a41][_0x07a4('0x67')]):_0x292c2a[_0x121a41][_0x07a4('0x67')];}}var _0x112090=[],_0x1a2f50={};for(var _0x4e67e4=0x0,_0x20ada=_0x45a408['length'];_0x4e67e4<_0x20ada;_0x4e67e4++){_0x1a2f50={'ProjectId':_0x1720d5[_0x07a4('0x43')]['id'],'SessionId':_0x45a408[_0x4e67e4]['id'],'StartTime':moment(_0x45a408[_0x4e67e4][_0x07a4('0x64')])['format'](_0x07a4('0x68'))};for(var _0x78efb9=0x0,_0x4c2495=_0x292c2a[_0x07a4('0x46')];_0x78efb9<_0x4c2495;_0x78efb9++){if(_0x292c2a[_0x78efb9][_0x07a4('0x69')]==_0x45a408[_0x4e67e4]['id']&&_0x58bf03['hasOwnProperty'](_0x292c2a[_0x78efb9]['questionId'])){_0x1a2f50[_0x58bf03[_0x292c2a[_0x78efb9][_0x07a4('0x66')]]]=_0x292c2a[_0x78efb9][_0x07a4('0x6a')];}}for(var _0x9431ad in _0x58bf03){if(!_0x1a2f50['hasOwnProperty'](_0x58bf03[_0x9431ad])){_0x1a2f50[_0x58bf03[_0x9431ad]]=null;}}_0x112090[_0x07a4('0x6b')](_0x1a2f50);}return _0x112090;}})[_0x07a4('0x23')](function(_0x6ef497){if(!_[_0x07a4('0x6c')](_0x6ef497)){var _0x4a388e=toCsv(_0x6ef497);var _0x972a52=Date[_0x07a4('0x6d')]();fs['writeFileSync'](util[_0x07a4('0x6e')](_0x07a4('0x6f'),_0x1720d5[_0x07a4('0x43')]['id'],_0x972a52),_0x4a388e);_0x429e27['setHeader'](_0x07a4('0x70'),'attachment;\x20filename='+util[_0x07a4('0x6e')](_0x07a4('0x71'),_0x1720d5[_0x07a4('0x43')]['id'],_0x972a52));_0x429e27[_0x07a4('0x72')](_0x07a4('0x73'),_0x07a4('0x74'));return _0x429e27[_0x07a4('0x75')](util[_0x07a4('0x6e')](_0x07a4('0x6f'),_0x1720d5[_0x07a4('0x43')]['id'],_0x972a52));}else{return _0x429e27[_0x07a4('0x17')](0xcc);}})['catch'](handleError(_0x429e27,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bf99eb8..5a7d3d5 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 _0xd7ce=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','request-promise','./jscriptyProject.attributes','exports'];(function(_0x5a54cf,_0x5b7f0c){var _0x25c04d=function(_0x2c66ea){while(--_0x2c66ea){_0x5a54cf['push'](_0x5a54cf['shift']());}};_0x25c04d(++_0x5b7f0c);}(_0xd7ce,0x16b));var _0xed7c=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0xd7ce[_0x36940e];return _0x3283f2;};'use strict';var _=require(_0xed7c('0x0'));var util=require(_0xed7c('0x1'));var logger=require(_0xed7c('0x2'))(_0xed7c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xed7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed7c('0x5'));module[_0xed7c('0x6')]=function(_0x194d4b,_0x1aa7a0){return _0x194d4b[_0xed7c('0x7')](_0xed7c('0x8'),attributes,{'tableName':_0xed7c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa990=['path','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x535c9e,_0x1344b0){var _0x2f426e=function(_0x42b816){while(--_0x42b816){_0x535c9e['push'](_0x535c9e['shift']());}};_0x2f426e(++_0x1344b0);}(_0xa990,0xc9));var _0x0a99=function(_0x2729b8,_0x490775){_0x2729b8=_0x2729b8-0x0;var _0x485a8e=_0xa990[_0x2729b8];return _0x485a8e;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var logger=require(_0x0a99('0x2'))(_0x0a99('0x3'));var moment=require(_0x0a99('0x4'));var BPromise=require(_0x0a99('0x5'));var rp=require(_0x0a99('0x6'));var fs=require('fs');var path=require(_0x0a99('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a99('0x8'));module[_0x0a99('0x9')]=function(_0xfdb594,_0x320560){return _0xfdb594[_0x0a99('0xa')](_0x0a99('0xb'),attributes,{'tableName':_0x0a99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 69e1f1d..b839c47 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x7d36ab,_0x1cd7d3){var _0x459ed6=function(_0x4a36ed){while(--_0x4a36ed){_0x7d36ab['push'](_0x7d36ab['shift']());}};_0x459ed6(++_0x1cd7d3);}(_0x54ef,0x112));var _0xf54e=function(_0x63a25d,_0x51817b){_0x63a25d=_0x63a25d-0x0;var _0x58ab82=_0x54ef[_0x63a25d];return _0x58ab82;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3a04c6,_0x12a482){var _0xf4131a=function(_0x413ea2){while(--_0x413ea2){_0x3a04c6['push'](_0x3a04c6['shift']());}};_0xf4131a(++_0x12a482);}(_0xaa88,0x137));var _0x8aa8=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0xaa88[_0x5d6e35];return _0x5d7ada;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1c596a7..0ed2b45 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 _0x0e2d=['post','/:id','update','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x51244e,_0x24c7e6){var _0x58d71c=function(_0x3a8ea5){while(--_0x3a8ea5){_0x51244e['push'](_0x51244e['shift']());}};_0x58d71c(++_0x24c7e6);}(_0x0e2d,0x137));var _0xd0e2=function(_0x5f2792,_0x46699d){_0x5f2792=_0x5f2792-0x0;var _0xb1c2ba=_0x0e2d[_0x5f2792];return _0xb1c2ba;};'use strict';var multer=require(_0xd0e2('0x0'));var util=require(_0xd0e2('0x1'));var path=require(_0xd0e2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd0e2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd0e2('0x4'));var controller=require(_0xd0e2('0x5'));router[_0xd0e2('0x6')]('/',auth[_0xd0e2('0x7')](),controller[_0xd0e2('0x8')]);router[_0xd0e2('0x6')](_0xd0e2('0x9'),auth[_0xd0e2('0x7')](),controller[_0xd0e2('0xa')]);router[_0xd0e2('0x6')]('/:id',auth[_0xd0e2('0x7')](),controller[_0xd0e2('0xb')]);router[_0xd0e2('0xc')]('/',auth[_0xd0e2('0x7')](),controller['create']);router['put'](_0xd0e2('0xd'),auth[_0xd0e2('0x7')](),controller[_0xd0e2('0xe')]);router['delete'](_0xd0e2('0xd'),auth[_0xd0e2('0x7')](),controller[_0xd0e2('0xf')]);module[_0xd0e2('0x10')]=router; \ No newline at end of file +var _0xfbd3=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','delete'];(function(_0x1db306,_0x19256a){var _0x15b19b=function(_0x4fa13d){while(--_0x4fa13d){_0x1db306['push'](_0x1db306['shift']());}};_0x15b19b(++_0x19256a);}(_0xfbd3,0x14c));var _0x3fbd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfbd3[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x3fbd('0x0'));var util=require('util');var path=require(_0x3fbd('0x1'));var timeout=require(_0x3fbd('0x2'));var express=require(_0x3fbd('0x3'));var router=express[_0x3fbd('0x4')]();var fs_extra=require(_0x3fbd('0x5'));var auth=require(_0x3fbd('0x6'));var interaction=require(_0x3fbd('0x7'));var config=require(_0x3fbd('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x3fbd('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fbd('0xa')]);router[_0x3fbd('0x9')](_0x3fbd('0xb'),auth['isAuthenticated'](),controller[_0x3fbd('0xc')]);router['get']('/:id',auth[_0x3fbd('0xd')](),controller[_0x3fbd('0xe')]);router[_0x3fbd('0xf')]('/',auth[_0x3fbd('0xd')](),controller[_0x3fbd('0x10')]);router[_0x3fbd('0x11')](_0x3fbd('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x3fbd('0x13')](_0x3fbd('0x12'),auth[_0x3fbd('0xd')](),controller[_0x3fbd('0x14')]);module[_0x3fbd('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index df103d2..e23034e 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x39e9ce,_0x78df21){_0x39e9ce=_0x39e9ce-0x0;var _0x170b9c=_0x7a54[_0x39e9ce];return _0x170b9c;};'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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x3bce6f,_0x14dd5e){_0x3bce6f=_0x3bce6f-0x0;var _0x1327cc=_0x7a54[_0x3bce6f];return _0x1327cc;};'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 c6a5125..ab0e31c 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 _0x7382=['intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','fieldName','key','model','query','keys'];(function(_0x5e70e8,_0x4b10c6){var _0x439fc9=function(_0x2cebdb){while(--_0x2cebdb){_0x5e70e8['push'](_0x5e70e8['shift']());}};_0x439fc9(++_0x4b10c6);}(_0x7382,0xf3));var _0x2738=function(_0x25cd74,_0x5b4364){_0x25cd74=_0x25cd74-0x0;var _0x1bfbab=_0x7382[_0x25cd74];return _0x1bfbab;};'use strict';var emlformat=require(_0x2738('0x0'));var rimraf=require(_0x2738('0x1'));var zipdir=require(_0x2738('0x2'));var jsonpatch=require(_0x2738('0x3'));var rp=require(_0x2738('0x4'));var moment=require(_0x2738('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2738('0x6'));var path=require(_0x2738('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2738('0x8'));var fs=require('fs');var fs_extra=require(_0x2738('0x9'));var _=require('lodash');var squel=require(_0x2738('0xa'));var crypto=require(_0x2738('0xb'));var jsforce=require(_0x2738('0xc'));var deskjs=require(_0x2738('0xd'));var toCsv=require(_0x2738('0xe'));var querystring=require(_0x2738('0xf'));var Papa=require(_0x2738('0x10'));var Redis=require(_0x2738('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2738('0x12'));var as=require(_0x2738('0x13'));var hardwareService=require(_0x2738('0x14'));var logger=require(_0x2738('0x15'))(_0x2738('0x16'));var utils=require(_0x2738('0x17'));var config=require(_0x2738('0x18'));var licenseUtil=require(_0x2738('0x19'));var db=require(_0x2738('0x1a'))['db'];function respondWithStatusCode(_0x3586a3,_0x3af016){_0x3af016=_0x3af016||0xcc;return function(_0x393973){if(_0x393973){return _0x3586a3['sendStatus'](_0x3af016);}return _0x3586a3[_0x2738('0x1b')](_0x3af016)[_0x2738('0x1c')]();};}function respondWithResult(_0x115522,_0x59df7f){_0x59df7f=_0x59df7f||0xc8;return function(_0x3a3af9){if(_0x3a3af9){return _0x115522[_0x2738('0x1b')](_0x59df7f)['json'](_0x3a3af9);}};}function respondWithFilteredResult(_0x1a9d14,_0xcb3c53){return function(_0x34ce79){if(_0x34ce79){var _0x136da3=typeof _0xcb3c53[_0x2738('0x1d')]===_0x2738('0x1e')&&typeof _0xcb3c53[_0x2738('0x1f')]===_0x2738('0x1e');var _0x209d4c=_0x34ce79[_0x2738('0x20')];var _0x19f016=_0x136da3?0x0:_0xcb3c53[_0x2738('0x1d')];var _0x2ee20a=_0x136da3?_0x34ce79[_0x2738('0x20')]:_0xcb3c53[_0x2738('0x1d')]+_0xcb3c53['limit'];var _0x4d4708;if(_0x2ee20a>=_0x209d4c){_0x2ee20a=_0x209d4c;_0x4d4708=0xc8;}else{_0x4d4708=0xce;}_0x1a9d14[_0x2738('0x1b')](_0x4d4708);return _0x1a9d14[_0x2738('0x21')]('Content-Range',_0x19f016+'-'+_0x2ee20a+'/'+_0x209d4c)[_0x2738('0x22')](_0x34ce79);}return null;};}function patchUpdates(_0x173495){return function(_0x257c10){try{jsonpatch['apply'](_0x257c10,_0x173495,!![]);}catch(_0x2fe505){return BPromise['reject'](_0x2fe505);}return _0x257c10['save']();};}function saveUpdates(_0xa57763,_0x46cc15){return function(_0xc454cd){if(_0xc454cd){return _0xc454cd[_0x2738('0x23')](_0xa57763)[_0x2738('0x24')](function(_0x109fa5){return _0x109fa5;});}return null;};}function removeEntity(_0x4e1045,_0x128248){return function(_0x3bce9a){if(_0x3bce9a){return _0x3bce9a[_0x2738('0x25')]()[_0x2738('0x24')](function(){_0x4e1045[_0x2738('0x1b')](0xcc)[_0x2738('0x1c')]();});}};}function handleEntityNotFound(_0x5d1642,_0x3afe53){return function(_0x561a9f){if(!_0x561a9f){_0x5d1642['sendStatus'](0x194);}return _0x561a9f;};}function handleError(_0xcaa4c4,_0x2280a8){_0x2280a8=_0x2280a8||0x1f4;return function(_0x17b42e){logger['error'](_0x17b42e[_0x2738('0x26')]);if(_0x17b42e[_0x2738('0x27')]){delete _0x17b42e[_0x2738('0x27')];}_0xcaa4c4[_0x2738('0x1b')](_0x2280a8)[_0x2738('0x28')](_0x17b42e);};}exports[_0x2738('0x29')]=function(_0x182299,_0x11e439){var _0x4b434={},_0x20905b={},_0x30df64={'count':0x0,'rows':[]};var _0x54a892=_[_0x2738('0x2a')](db[_0x2738('0x2b')]['rawAttributes'],function(_0x386ab4){return{'name':_0x386ab4[_0x2738('0x2c')],'type':_0x386ab4['type'][_0x2738('0x2d')]};});_0x20905b[_0x2738('0x2e')]=_[_0x2738('0x2a')](_0x54a892,_0x2738('0x27'));_0x20905b[_0x2738('0x2f')]=_[_0x2738('0x30')](_0x182299[_0x2738('0x2f')]);_0x20905b['filters']=_[_0x2738('0x31')](_0x20905b[_0x2738('0x2e')],_0x20905b[_0x2738('0x2f')]);_0x4b434[_0x2738('0x32')]=_[_0x2738('0x31')](_0x20905b['model'],qs['fields'](_0x182299['query'][_0x2738('0x33')]));_0x4b434['attributes']=_0x4b434[_0x2738('0x32')]['length']?_0x4b434[_0x2738('0x32')]:_0x20905b[_0x2738('0x2e')];if(!_0x182299[_0x2738('0x2f')]['hasOwnProperty'](_0x2738('0x34'))){_0x4b434['limit']=qs[_0x2738('0x1f')](_0x182299['query'][_0x2738('0x1f')]);_0x4b434[_0x2738('0x1d')]=qs['offset'](_0x182299[_0x2738('0x2f')]['offset']);}_0x4b434['order']=qs[_0x2738('0x35')](_0x182299['query'][_0x2738('0x35')]);_0x4b434[_0x2738('0x36')]=qs[_0x2738('0x37')](_[_0x2738('0x38')](_0x182299[_0x2738('0x2f')],_0x20905b['filters']),_0x54a892);if(_0x182299['query'][_0x2738('0x39')]){_0x4b434[_0x2738('0x36')]=_[_0x2738('0x3a')](_0x4b434['where'],{'$or':_['map'](_0x54a892,function(_0x4ee416){if(_0x4ee416['type']!=='VIRTUAL'){var _0x39c372={};_0x39c372[_0x4ee416[_0x2738('0x27')]]={'$like':'%'+_0x182299[_0x2738('0x2f')][_0x2738('0x39')]+'%'};return _0x39c372;}})});}_0x4b434=_[_0x2738('0x3a')]({},_0x4b434,_0x182299['options']);var _0x1bdbd0={'where':_0x4b434[_0x2738('0x36')]};return db[_0x2738('0x2b')][_0x2738('0x20')](_0x1bdbd0)[_0x2738('0x24')](function(_0x2f223d){_0x30df64[_0x2738('0x20')]=_0x2f223d;if(_0x182299[_0x2738('0x2f')][_0x2738('0x3b')]){_0x4b434[_0x2738('0x3c')]=[{'all':!![]}];}return db[_0x2738('0x2b')][_0x2738('0x3d')](_0x4b434);})[_0x2738('0x24')](function(_0x3e83b9){_0x30df64[_0x2738('0x3e')]=_0x3e83b9;return _0x30df64;})[_0x2738('0x24')](respondWithFilteredResult(_0x11e439,_0x4b434))[_0x2738('0x3f')](handleError(_0x11e439,null));};exports[_0x2738('0x40')]=function(_0x11f589,_0x1df835){var _0xac1399={'raw':!![],'where':{'id':_0x11f589['params']['id']}},_0x30c6f4={};_0x30c6f4[_0x2738('0x2e')]=_['keys'](db[_0x2738('0x2b')][_0x2738('0x41')]);_0x30c6f4['query']=_[_0x2738('0x30')](_0x11f589[_0x2738('0x2f')]);_0x30c6f4['filters']=_[_0x2738('0x31')](_0x30c6f4['model'],_0x30c6f4[_0x2738('0x2f')]);_0xac1399[_0x2738('0x32')]=_['intersection'](_0x30c6f4[_0x2738('0x2e')],qs[_0x2738('0x33')](_0x11f589[_0x2738('0x2f')][_0x2738('0x33')]));_0xac1399[_0x2738('0x32')]=_0xac1399[_0x2738('0x32')][_0x2738('0x42')]?_0xac1399['attributes']:_0x30c6f4['model'];if(_0x11f589[_0x2738('0x2f')][_0x2738('0x3b')]){_0xac1399['include']=[{'all':!![]}];}_0xac1399=_[_0x2738('0x3a')]({},_0xac1399,_0x11f589[_0x2738('0x43')]);return db[_0x2738('0x2b')][_0x2738('0x44')](_0xac1399)[_0x2738('0x24')](handleEntityNotFound(_0x1df835,null))[_0x2738('0x24')](respondWithResult(_0x1df835,null))[_0x2738('0x3f')](handleError(_0x1df835,null));};exports[_0x2738('0x45')]=function(_0x4d81d3,_0x39f5e8){return db[_0x2738('0x2b')][_0x2738('0x45')](_0x4d81d3[_0x2738('0x46')],{})[_0x2738('0x24')](respondWithResult(_0x39f5e8,0xc9))[_0x2738('0x3f')](handleError(_0x39f5e8,null));};exports[_0x2738('0x23')]=function(_0x2b0eac,_0x3f3119){if(_0x2b0eac[_0x2738('0x46')]['id']){delete _0x2b0eac[_0x2738('0x46')]['id'];}return db['JscriptyQuestionReport'][_0x2738('0x44')]({'where':{'id':_0x2b0eac[_0x2738('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f3119,null))['then'](saveUpdates(_0x2b0eac[_0x2738('0x46')],null))[_0x2738('0x24')](respondWithResult(_0x3f3119,null))['catch'](handleError(_0x3f3119,null));};exports['destroy']=function(_0x38b43b,_0xec5660){return db[_0x2738('0x2b')][_0x2738('0x44')]({'where':{'id':_0x38b43b['params']['id']}})[_0x2738('0x24')](handleEntityNotFound(_0xec5660,null))[_0x2738('0x24')](removeEntity(_0xec5660,null))[_0x2738('0x3f')](handleError(_0xec5660,null));};exports[_0x2738('0x48')]=function(_0x2685d0,_0xa6722b){return db[_0x2738('0x2b')][_0x2738('0x48')]()[_0x2738('0x24')](respondWithResult(_0xa6722b,null))[_0x2738('0x3f')](handleError(_0xa6722b,null));}; \ No newline at end of file +var _0xb997=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','includeAll','include','JscriptyQuestionReport','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map'];(function(_0x338990,_0x4755d9){var _0x14f156=function(_0xfb48d5){while(--_0xfb48d5){_0x338990['push'](_0x338990['shift']());}};_0x14f156(++_0x4755d9);}(_0xb997,0xb8));var _0x7b99=function(_0x1e0144,_0x1528e3){_0x1e0144=_0x1e0144-0x0;var _0x172a14=_0xb997[_0x1e0144];return _0x172a14;};'use strict';var emlformat=require(_0x7b99('0x0'));var rimraf=require(_0x7b99('0x1'));var zipdir=require(_0x7b99('0x2'));var jsonpatch=require(_0x7b99('0x3'));var rp=require(_0x7b99('0x4'));var moment=require(_0x7b99('0x5'));var BPromise=require(_0x7b99('0x6'));var Mustache=require(_0x7b99('0x7'));var util=require(_0x7b99('0x8'));var path=require(_0x7b99('0x9'));var sox=require(_0x7b99('0xa'));var csv=require(_0x7b99('0xb'));var ejs=require(_0x7b99('0xc'));var fs=require('fs');var fs_extra=require(_0x7b99('0xd'));var _=require(_0x7b99('0xe'));var squel=require('squel');var crypto=require(_0x7b99('0xf'));var jsforce=require(_0x7b99('0x10'));var deskjs=require(_0x7b99('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b99('0x12'));var Redis=require('ioredis');var authService=require(_0x7b99('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7b99('0x14'));var hardwareService=require(_0x7b99('0x15'));var logger=require(_0x7b99('0x16'))(_0x7b99('0x17'));var utils=require('../../config/utils');var config=require(_0x7b99('0x18'));var licenseUtil=require(_0x7b99('0x19'));var db=require(_0x7b99('0x1a'))['db'];function respondWithStatusCode(_0x243a0a,_0x4699f9){_0x4699f9=_0x4699f9||0xcc;return function(_0x4034ac){if(_0x4034ac){return _0x243a0a[_0x7b99('0x1b')](_0x4699f9);}return _0x243a0a[_0x7b99('0x1c')](_0x4699f9)[_0x7b99('0x1d')]();};}function respondWithResult(_0x4a5e86,_0x564e36){_0x564e36=_0x564e36||0xc8;return function(_0x46b252){if(_0x46b252){return _0x4a5e86[_0x7b99('0x1c')](_0x564e36)[_0x7b99('0x1e')](_0x46b252);}};}function respondWithFilteredResult(_0x77688f,_0x121934){return function(_0x3feae4){if(_0x3feae4){var _0x2366a1=typeof _0x121934[_0x7b99('0x1f')]===_0x7b99('0x20')&&typeof _0x121934['limit']==='undefined';var _0x482fc1=_0x3feae4[_0x7b99('0x21')];var _0x16fd9f=_0x2366a1?0x0:_0x121934['offset'];var _0x2bcce5=_0x2366a1?_0x3feae4[_0x7b99('0x21')]:_0x121934[_0x7b99('0x1f')]+_0x121934[_0x7b99('0x22')];var _0x3fae28;if(_0x2bcce5>=_0x482fc1){_0x2bcce5=_0x482fc1;_0x3fae28=0xc8;}else{_0x3fae28=0xce;}_0x77688f[_0x7b99('0x1c')](_0x3fae28);return _0x77688f[_0x7b99('0x23')](_0x7b99('0x24'),_0x16fd9f+'-'+_0x2bcce5+'/'+_0x482fc1)[_0x7b99('0x1e')](_0x3feae4);}return null;};}function patchUpdates(_0x7191a0){return function(_0x703734){try{jsonpatch[_0x7b99('0x25')](_0x703734,_0x7191a0,!![]);}catch(_0x2a78e2){return BPromise[_0x7b99('0x26')](_0x2a78e2);}return _0x703734['save']();};}function saveUpdates(_0x7f5ee8,_0x22a027){return function(_0x25bdc2){if(_0x25bdc2){return _0x25bdc2[_0x7b99('0x27')](_0x7f5ee8)[_0x7b99('0x28')](function(_0x4391c2){return _0x4391c2;});}return null;};}function removeEntity(_0x4b94b2,_0x3e90d2){return function(_0x187946){if(_0x187946){return _0x187946[_0x7b99('0x29')]()['then'](function(){_0x4b94b2[_0x7b99('0x1c')](0xcc)[_0x7b99('0x1d')]();});}};}function handleEntityNotFound(_0xab279c,_0x3d735a){return function(_0x2dc51c){if(!_0x2dc51c){_0xab279c[_0x7b99('0x1b')](0x194);}return _0x2dc51c;};}function handleError(_0x33aa12,_0x3ce087){_0x3ce087=_0x3ce087||0x1f4;return function(_0x5cdc8b){logger[_0x7b99('0x2a')](_0x5cdc8b[_0x7b99('0x2b')]);if(_0x5cdc8b['name']){delete _0x5cdc8b[_0x7b99('0x2c')];}_0x33aa12[_0x7b99('0x1c')](_0x3ce087)[_0x7b99('0x2d')](_0x5cdc8b);};}exports['index']=function(_0x373a42,_0x3839c4){var _0x135a97={},_0x569676={},_0x82abd1={'count':0x0,'rows':[]};var _0x368eda=_[_0x7b99('0x2e')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x432e87){return{'name':_0x432e87[_0x7b99('0x2f')],'type':_0x432e87[_0x7b99('0x30')][_0x7b99('0x31')]};});_0x569676[_0x7b99('0x32')]=_[_0x7b99('0x2e')](_0x368eda,_0x7b99('0x2c'));_0x569676[_0x7b99('0x33')]=_[_0x7b99('0x34')](_0x373a42[_0x7b99('0x33')]);_0x569676[_0x7b99('0x35')]=_[_0x7b99('0x36')](_0x569676[_0x7b99('0x32')],_0x569676[_0x7b99('0x33')]);_0x135a97['attributes']=_[_0x7b99('0x36')](_0x569676['model'],qs[_0x7b99('0x37')](_0x373a42[_0x7b99('0x33')][_0x7b99('0x37')]));_0x135a97[_0x7b99('0x38')]=_0x135a97[_0x7b99('0x38')][_0x7b99('0x39')]?_0x135a97[_0x7b99('0x38')]:_0x569676[_0x7b99('0x32')];if(!_0x373a42['query']['hasOwnProperty']('nolimit')){_0x135a97[_0x7b99('0x22')]=qs['limit'](_0x373a42[_0x7b99('0x33')][_0x7b99('0x22')]);_0x135a97[_0x7b99('0x1f')]=qs[_0x7b99('0x1f')](_0x373a42['query'][_0x7b99('0x1f')]);}_0x135a97[_0x7b99('0x3a')]=qs[_0x7b99('0x3b')](_0x373a42[_0x7b99('0x33')]['sort']);_0x135a97['where']=qs[_0x7b99('0x35')](_['pick'](_0x373a42[_0x7b99('0x33')],_0x569676[_0x7b99('0x35')]),_0x368eda);if(_0x373a42[_0x7b99('0x33')]['filter']){_0x135a97[_0x7b99('0x3c')]=_[_0x7b99('0x3d')](_0x135a97[_0x7b99('0x3c')],{'$or':_[_0x7b99('0x2e')](_0x368eda,function(_0x31b7ed){if(_0x31b7ed['type']!==_0x7b99('0x3e')){var _0x36429c={};_0x36429c[_0x31b7ed[_0x7b99('0x2c')]]={'$like':'%'+_0x373a42[_0x7b99('0x33')]['filter']+'%'};return _0x36429c;}})});}_0x135a97=_['merge']({},_0x135a97,_0x373a42['options']);var _0xd68892={'where':_0x135a97['where']};return db['JscriptyQuestionReport'][_0x7b99('0x21')](_0xd68892)['then'](function(_0x3bec79){_0x82abd1[_0x7b99('0x21')]=_0x3bec79;if(_0x373a42['query'][_0x7b99('0x3f')]){_0x135a97[_0x7b99('0x40')]=[{'all':!![]}];}return db[_0x7b99('0x41')][_0x7b99('0x42')](_0x135a97);})[_0x7b99('0x28')](function(_0xd925b5){_0x82abd1[_0x7b99('0x43')]=_0xd925b5;return _0x82abd1;})[_0x7b99('0x28')](respondWithFilteredResult(_0x3839c4,_0x135a97))[_0x7b99('0x44')](handleError(_0x3839c4,null));};exports[_0x7b99('0x45')]=function(_0x15fccc,_0x1f1100){var _0x32c522={'raw':!![],'where':{'id':_0x15fccc[_0x7b99('0x46')]['id']}},_0x101c6f={};_0x101c6f[_0x7b99('0x32')]=_[_0x7b99('0x34')](db['JscriptyQuestionReport'][_0x7b99('0x47')]);_0x101c6f[_0x7b99('0x33')]=_['keys'](_0x15fccc[_0x7b99('0x33')]);_0x101c6f[_0x7b99('0x35')]=_[_0x7b99('0x36')](_0x101c6f[_0x7b99('0x32')],_0x101c6f[_0x7b99('0x33')]);_0x32c522['attributes']=_[_0x7b99('0x36')](_0x101c6f[_0x7b99('0x32')],qs['fields'](_0x15fccc[_0x7b99('0x33')][_0x7b99('0x37')]));_0x32c522['attributes']=_0x32c522['attributes']['length']?_0x32c522[_0x7b99('0x38')]:_0x101c6f[_0x7b99('0x32')];if(_0x15fccc[_0x7b99('0x33')]['includeAll']){_0x32c522[_0x7b99('0x40')]=[{'all':!![]}];}_0x32c522=_[_0x7b99('0x3d')]({},_0x32c522,_0x15fccc[_0x7b99('0x48')]);return db[_0x7b99('0x41')][_0x7b99('0x49')](_0x32c522)['then'](handleEntityNotFound(_0x1f1100,null))[_0x7b99('0x28')](respondWithResult(_0x1f1100,null))[_0x7b99('0x44')](handleError(_0x1f1100,null));};exports['create']=function(_0x410de8,_0x272b2f){return db[_0x7b99('0x41')][_0x7b99('0x4a')](_0x410de8[_0x7b99('0x4b')],{})['then'](respondWithResult(_0x272b2f,0xc9))[_0x7b99('0x44')](handleError(_0x272b2f,null));};exports['update']=function(_0xd6add5,_0x207ad1){if(_0xd6add5[_0x7b99('0x4b')]['id']){delete _0xd6add5[_0x7b99('0x4b')]['id'];}return db[_0x7b99('0x41')][_0x7b99('0x49')]({'where':{'id':_0xd6add5[_0x7b99('0x46')]['id']}})[_0x7b99('0x28')](handleEntityNotFound(_0x207ad1,null))[_0x7b99('0x28')](saveUpdates(_0xd6add5['body'],null))[_0x7b99('0x28')](respondWithResult(_0x207ad1,null))[_0x7b99('0x44')](handleError(_0x207ad1,null));};exports[_0x7b99('0x29')]=function(_0x1c454b,_0x384ec1){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x1c454b[_0x7b99('0x46')]['id']}})['then'](handleEntityNotFound(_0x384ec1,null))['then'](removeEntity(_0x384ec1,null))['catch'](handleError(_0x384ec1,null));};exports['describe']=function(_0x4e252a,_0xee9ab1){return db['JscriptyQuestionReport'][_0x7b99('0x4c')]()[_0x7b99('0x28')](respondWithResult(_0xee9ab1,null))[_0x7b99('0x44')](handleError(_0xee9ab1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 537a0da..547d0a1 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 _0x3d79=['report_jscripty_questions','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x2397be,_0x4046c2){var _0x4b5e37=function(_0xb0e0dc){while(--_0xb0e0dc){_0x2397be['push'](_0x2397be['shift']());}};_0x4b5e37(++_0x4046c2);}(_0x3d79,0xeb));var _0x93d7=function(_0x58a3e1,_0x304e17){_0x58a3e1=_0x58a3e1-0x0;var _0x4af78d=_0x3d79[_0x58a3e1];return _0x4af78d;};'use strict';var _=require(_0x93d7('0x0'));var util=require(_0x93d7('0x1'));var logger=require('../../config/logger')(_0x93d7('0x2'));var moment=require(_0x93d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x93d7('0x4'));var fs=require('fs');var path=require(_0x93d7('0x5'));var rimraf=require(_0x93d7('0x6'));var config=require(_0x93d7('0x7'));var attributes=require(_0x93d7('0x8'));module[_0x93d7('0x9')]=function(_0x20797a,_0x4a515c){return _0x20797a[_0x93d7('0xa')](_0x93d7('0xb'),attributes,{'tableName':_0x93d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a54=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x4efddb,_0x536476){var _0x3142e4=function(_0xd1eed9){while(--_0xd1eed9){_0x4efddb['push'](_0x4efddb['shift']());}};_0x3142e4(++_0x536476);}(_0x4a54,0x19a));var _0x44a5=function(_0x1a9e9e,_0x4e02c0){_0x1a9e9e=_0x1a9e9e-0x0;var _0x461061=_0x4a54[_0x1a9e9e];return _0x461061;};'use strict';var _=require('lodash');var util=require(_0x44a5('0x0'));var logger=require(_0x44a5('0x1'))(_0x44a5('0x2'));var moment=require(_0x44a5('0x3'));var BPromise=require(_0x44a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x44a5('0x5'));var config=require(_0x44a5('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x44a5('0x7')]=function(_0x12ed39,_0x368be6){return _0x12ed39['define'](_0x44a5('0x8'),attributes,{'tableName':_0x44a5('0x9'),'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 717296c..f3dd881 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 _0xb243=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x43dee1,_0x2e6469){var _0x7f761=function(_0x26abfe){while(--_0x26abfe){_0x43dee1['push'](_0x43dee1['shift']());}};_0x7f761(++_0x2e6469);}(_0xb243,0x111));var _0x3b24=function(_0x2d51b4,_0x47ae04){_0x2d51b4=_0x2d51b4-0x0;var _0x47b218=_0xb243[_0x2d51b4];return _0x47b218;};'use strict';var _=require(_0x3b24('0x0'));var util=require(_0x3b24('0x1'));var moment=require('moment');var BPromise=require(_0x3b24('0x2'));var rs=require(_0x3b24('0x3'));var fs=require('fs');var Redis=require(_0x3b24('0x4'));var db=require(_0x3b24('0x5'))['db'];var utils=require(_0x3b24('0x6'));var logger=require(_0x3b24('0x7'))(_0x3b24('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b24('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d633a,_0x2ffc3c,_0x58d8cd){return new BPromise(function(_0x226aae,_0x55f633){return client[_0x3b24('0xa')](_0x3d633a,_0x58d8cd)[_0x3b24('0xb')](function(_0x80d961){logger['info'](_0x3b24('0xc'),_0x2ffc3c,_0x3b24('0xd'));logger[_0x3b24('0xe')](_0x3b24('0xf'),_0x2ffc3c,_0x3b24('0xd'),JSON['stringify'](_0x80d961));if(_0x80d961[_0x3b24('0x10')]){if(_0x80d961['error'][_0x3b24('0x11')]===0x1f4){logger[_0x3b24('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2ffc3c,_0x80d961[_0x3b24('0x10')]['message']);return _0x55f633(_0x80d961[_0x3b24('0x10')][_0x3b24('0x12')]);}logger['error'](_0x3b24('0xc'),_0x2ffc3c,_0x80d961[_0x3b24('0x10')][_0x3b24('0x12')]);return _0x226aae(_0x80d961[_0x3b24('0x10')][_0x3b24('0x12')]);}else{logger[_0x3b24('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2ffc3c,'request\x20sent');_0x226aae(_0x80d961[_0x3b24('0x14')]['message']);}})[_0x3b24('0x15')](function(_0x20ef17){logger[_0x3b24('0x10')](_0x3b24('0xc'),_0x2ffc3c,_0x20ef17);_0x55f633(_0x20ef17);});});} \ No newline at end of file +var _0xf384=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0xf384,0xc4));var _0x4f38=function(_0x1670d5,_0x557233){_0x1670d5=_0x1670d5-0x0;var _0x1ce4a6=_0xf384[_0x1670d5];return _0x1ce4a6;};'use strict';var _=require('lodash');var util=require(_0x4f38('0x0'));var moment=require(_0x4f38('0x1'));var BPromise=require(_0x4f38('0x2'));var rs=require(_0x4f38('0x3'));var fs=require('fs');var Redis=require(_0x4f38('0x4'));var db=require(_0x4f38('0x5'))['db'];var utils=require(_0x4f38('0x6'));var logger=require('../../config/logger')(_0x4f38('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f38('0x8'));var client=jayson[_0x4f38('0x9')][_0x4f38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eff0e,_0x465f79,_0x55b481){return new BPromise(function(_0x4b0f33,_0x4ec4be){return client['request'](_0x2eff0e,_0x55b481)[_0x4f38('0xb')](function(_0x20634c){logger['info'](_0x4f38('0xc'),_0x465f79,_0x4f38('0xd'));logger[_0x4f38('0xe')](_0x4f38('0xf'),_0x465f79,_0x4f38('0xd'),JSON['stringify'](_0x20634c));if(_0x20634c[_0x4f38('0x10')]){if(_0x20634c[_0x4f38('0x10')][_0x4f38('0x11')]===0x1f4){logger[_0x4f38('0x10')](_0x4f38('0xc'),_0x465f79,_0x20634c[_0x4f38('0x10')][_0x4f38('0x12')]);return _0x4ec4be(_0x20634c['error'][_0x4f38('0x12')]);}logger[_0x4f38('0x10')](_0x4f38('0xc'),_0x465f79,_0x20634c['error'][_0x4f38('0x12')]);return _0x4b0f33(_0x20634c[_0x4f38('0x10')][_0x4f38('0x12')]);}else{logger[_0x4f38('0x13')](_0x4f38('0xc'),_0x465f79,'request\x20sent');_0x4b0f33(_0x20634c[_0x4f38('0x14')]['message']);}})['catch'](function(_0x218a3e){logger[_0x4f38('0x10')](_0x4f38('0xc'),_0x465f79,_0x218a3e);_0x4ec4be(_0x218a3e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 38d31fc..12440b7 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 _0x5565=['../../config/environment','./jscriptySessionReport.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/questions','getQuestions','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x5565,0x12c));var _0x5556=function(_0x1679c9,_0x5300f8){_0x1679c9=_0x1679c9-0x0;var _0x4164a7=_0x5565[_0x1679c9];return _0x4164a7;};'use strict';var multer=require(_0x5556('0x0'));var util=require(_0x5556('0x1'));var path=require(_0x5556('0x2'));var timeout=require(_0x5556('0x3'));var express=require(_0x5556('0x4'));var router=express['Router']();var fs_extra=require(_0x5556('0x5'));var auth=require(_0x5556('0x6'));var interaction=require(_0x5556('0x7'));var config=require(_0x5556('0x8'));var controller=require(_0x5556('0x9'));router['get']('/',auth[_0x5556('0xa')](),controller['index']);router[_0x5556('0xb')](_0x5556('0xc'),auth['isAuthenticated'](),controller[_0x5556('0xd')]);router[_0x5556('0xb')](_0x5556('0xe'),auth['isAuthenticated'](),controller[_0x5556('0xf')]);router[_0x5556('0xb')](_0x5556('0x10'),auth[_0x5556('0xa')](),controller[_0x5556('0x11')]);router['post']('/',auth[_0x5556('0xa')](),controller[_0x5556('0x12')]);router['put'](_0x5556('0xe'),auth['isAuthenticated'](),controller[_0x5556('0x13')]);router['delete'](_0x5556('0xe'),auth[_0x5556('0xa')](),controller[_0x5556('0x14')]);module[_0x5556('0x15')]=router; \ No newline at end of file +var _0x3812=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/questions','post','create','put','update','delete'];(function(_0x24104f,_0x2fbb92){var _0x524d2b=function(_0x165d6a){while(--_0x165d6a){_0x24104f['push'](_0x24104f['shift']());}};_0x524d2b(++_0x2fbb92);}(_0x3812,0x8b));var _0x2381=function(_0x3f10a7,_0x300319){_0x3f10a7=_0x3f10a7-0x0;var _0xbf99b3=_0x3812[_0x3f10a7];return _0xbf99b3;};'use strict';var multer=require(_0x2381('0x0'));var util=require(_0x2381('0x1'));var path=require(_0x2381('0x2'));var timeout=require(_0x2381('0x3'));var express=require(_0x2381('0x4'));var router=express[_0x2381('0x5')]();var fs_extra=require(_0x2381('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2381('0x7'));var config=require(_0x2381('0x8'));var controller=require(_0x2381('0x9'));router[_0x2381('0xa')]('/',auth[_0x2381('0xb')](),controller['index']);router[_0x2381('0xa')](_0x2381('0xc'),auth[_0x2381('0xb')](),controller[_0x2381('0xd')]);router['get'](_0x2381('0xe'),auth['isAuthenticated'](),controller[_0x2381('0xf')]);router[_0x2381('0xa')](_0x2381('0x10'),auth[_0x2381('0xb')](),controller['getQuestions']);router[_0x2381('0x11')]('/',auth[_0x2381('0xb')](),controller[_0x2381('0x12')]);router[_0x2381('0x13')](_0x2381('0xe'),auth[_0x2381('0xb')](),controller[_0x2381('0x14')]);router[_0x2381('0x15')](_0x2381('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x2381('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d1d5bee..b0638b2 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 _0xbaf0=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','endtime','format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbaf0,0xff));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var moment=require('moment');var Sequelize=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'starttime':{'type':Sequelize[_0x0baf('0x2')],'set':function(_0x2ecb40){this[_0x0baf('0x3')]('starttime',_0x2ecb40);this['setDataValue'](_0x0baf('0x4'),moment()[_0x0baf('0x5')](_0x0baf('0x6')));}},'endtime':{'type':Sequelize[_0x0baf('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0baf('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x0baf('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6113=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x6113,0x13e));var _0x3611=function(_0x6a9287,_0x4e8bed){_0x6a9287=_0x6a9287-0x0;var _0x15c92a=_0x6113[_0x6a9287];return _0x15c92a;};'use strict';var moment=require(_0x3611('0x0'));var Sequelize=require(_0x3611('0x1'));module[_0x3611('0x2')]={'starttime':{'type':Sequelize[_0x3611('0x3')],'set':function(_0x3c6e31){this[_0x3611('0x4')](_0x3611('0x5'),_0x3c6e31);this['setDataValue']('endtime',moment()[_0x3611('0x6')](_0x3611('0x7')));}},'endtime':{'type':Sequelize[_0x3611('0x3')]},'membername':{'type':Sequelize[_0x3611('0x8')]},'projectname':{'type':Sequelize[_0x3611('0x8')]},'queue':{'type':Sequelize[_0x3611('0x8')]},'uniqueid':{'type':Sequelize[_0x3611('0x8')]},'calleridname':{'type':Sequelize[_0x3611('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'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 2f2bf53..d14c0d4 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 _0xf941=['options','JscriptySessionReport','include','findAll','rows','show','params','keys','length','includeAll','catch','create','body','find','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter'];(function(_0x531071,_0xfd8c){var _0x3c78bf=function(_0x953f6f){while(--_0x953f6f){_0x531071['push'](_0x531071['shift']());}};_0x3c78bf(++_0xfd8c);}(_0xf941,0x14c));var _0x1f94=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf941[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require(_0x1f94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f94('0x1'));var jsonpatch=require(_0x1f94('0x2'));var rp=require(_0x1f94('0x3'));var moment=require(_0x1f94('0x4'));var BPromise=require(_0x1f94('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f94('0x6'));var sox=require(_0x1f94('0x7'));var csv=require('to-csv');var ejs=require(_0x1f94('0x8'));var fs=require('fs');var fs_extra=require(_0x1f94('0x9'));var _=require(_0x1f94('0xa'));var squel=require(_0x1f94('0xb'));var crypto=require(_0x1f94('0xc'));var jsforce=require(_0x1f94('0xd'));var deskjs=require(_0x1f94('0xe'));var toCsv=require(_0x1f94('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f94('0x10'));var qs=require(_0x1f94('0x11'));var as=require(_0x1f94('0x12'));var hardwareService=require(_0x1f94('0x13'));var logger=require('../../config/logger')(_0x1f94('0x14'));var utils=require('../../config/utils');var config=require(_0x1f94('0x15'));var licenseUtil=require(_0x1f94('0x16'));var db=require(_0x1f94('0x17'))['db'];function respondWithStatusCode(_0x2b732d,_0x1a156e){_0x1a156e=_0x1a156e||0xcc;return function(_0xbac00){if(_0xbac00){return _0x2b732d['sendStatus'](_0x1a156e);}return _0x2b732d[_0x1f94('0x18')](_0x1a156e)[_0x1f94('0x19')]();};}function respondWithResult(_0x48e9ba,_0x295db7){_0x295db7=_0x295db7||0xc8;return function(_0x1aeb30){if(_0x1aeb30){return _0x48e9ba['status'](_0x295db7)[_0x1f94('0x1a')](_0x1aeb30);}};}function respondWithFilteredResult(_0x2b6805,_0x243e06){return function(_0x525201){if(_0x525201){var _0x2e3e0b=typeof _0x243e06['offset']===_0x1f94('0x1b')&&typeof _0x243e06[_0x1f94('0x1c')]===_0x1f94('0x1b');var _0x5bfb57=_0x525201[_0x1f94('0x1d')];var _0x1c385f=_0x2e3e0b?0x0:_0x243e06[_0x1f94('0x1e')];var _0x5d9b71=_0x2e3e0b?_0x525201[_0x1f94('0x1d')]:_0x243e06['offset']+_0x243e06['limit'];var _0x28d40d;if(_0x5d9b71>=_0x5bfb57){_0x5d9b71=_0x5bfb57;_0x28d40d=0xc8;}else{_0x28d40d=0xce;}_0x2b6805[_0x1f94('0x18')](_0x28d40d);return _0x2b6805[_0x1f94('0x1f')]('Content-Range',_0x1c385f+'-'+_0x5d9b71+'/'+_0x5bfb57)[_0x1f94('0x1a')](_0x525201);}return null;};}function patchUpdates(_0x32134e){return function(_0x3252fe){try{jsonpatch['apply'](_0x3252fe,_0x32134e,!![]);}catch(_0xda21ad){return BPromise['reject'](_0xda21ad);}return _0x3252fe['save']();};}function saveUpdates(_0x5c3d89,_0x4dd6b0){return function(_0x433d09){if(_0x433d09){return _0x433d09[_0x1f94('0x20')](_0x5c3d89)[_0x1f94('0x21')](function(_0x310caf){return _0x310caf;});}return null;};}function removeEntity(_0x57d198,_0x5b00eb){return function(_0x15cbec){if(_0x15cbec){return _0x15cbec['destroy']()[_0x1f94('0x21')](function(){_0x57d198[_0x1f94('0x18')](0xcc)[_0x1f94('0x19')]();});}};}function handleEntityNotFound(_0x5d6a6d,_0x43b5e7){return function(_0x589a96){if(!_0x589a96){_0x5d6a6d[_0x1f94('0x22')](0x194);}return _0x589a96;};}function handleError(_0x162d69,_0x5b74eb){_0x5b74eb=_0x5b74eb||0x1f4;return function(_0x5055b5){logger[_0x1f94('0x23')](_0x5055b5[_0x1f94('0x24')]);if(_0x5055b5[_0x1f94('0x25')]){delete _0x5055b5[_0x1f94('0x25')];}_0x162d69[_0x1f94('0x18')](_0x5b74eb)[_0x1f94('0x26')](_0x5055b5);};}exports[_0x1f94('0x27')]=function(_0xded0be,_0xde160e){var _0x35f1ec={},_0x52c126={},_0x199075={'count':0x0,'rows':[]};var _0x31ba1f=_[_0x1f94('0x28')](db['JscriptySessionReport'][_0x1f94('0x29')],function(_0xe34847){return{'name':_0xe34847[_0x1f94('0x2a')],'type':_0xe34847[_0x1f94('0x2b')][_0x1f94('0x2c')]};});_0x52c126[_0x1f94('0x2d')]=_[_0x1f94('0x28')](_0x31ba1f,_0x1f94('0x25'));_0x52c126[_0x1f94('0x2e')]=_['keys'](_0xded0be[_0x1f94('0x2e')]);_0x52c126[_0x1f94('0x2f')]=_[_0x1f94('0x30')](_0x52c126[_0x1f94('0x2d')],_0x52c126[_0x1f94('0x2e')]);_0x35f1ec[_0x1f94('0x31')]=_[_0x1f94('0x30')](_0x52c126[_0x1f94('0x2d')],qs[_0x1f94('0x32')](_0xded0be[_0x1f94('0x2e')][_0x1f94('0x32')]));_0x35f1ec[_0x1f94('0x31')]=_0x35f1ec[_0x1f94('0x31')]['length']?_0x35f1ec[_0x1f94('0x31')]:_0x52c126[_0x1f94('0x2d')];if(!_0xded0be['query'][_0x1f94('0x33')](_0x1f94('0x34'))){_0x35f1ec[_0x1f94('0x1c')]=qs['limit'](_0xded0be[_0x1f94('0x2e')][_0x1f94('0x1c')]);_0x35f1ec['offset']=qs[_0x1f94('0x1e')](_0xded0be['query'][_0x1f94('0x1e')]);}_0x35f1ec['order']=qs[_0x1f94('0x35')](_0xded0be[_0x1f94('0x2e')]['sort']);_0x35f1ec[_0x1f94('0x36')]=qs[_0x1f94('0x2f')](_[_0x1f94('0x37')](_0xded0be[_0x1f94('0x2e')],_0x52c126[_0x1f94('0x2f')]),_0x31ba1f);if(_0xded0be[_0x1f94('0x2e')]['filter']){_0x35f1ec[_0x1f94('0x36')]=_[_0x1f94('0x38')](_0x35f1ec[_0x1f94('0x36')],{'$or':_[_0x1f94('0x28')](_0x31ba1f,function(_0x760192){if(_0x760192[_0x1f94('0x2b')]!=='VIRTUAL'){var _0x47fe32={};_0x47fe32[_0x760192['name']]={'$like':'%'+_0xded0be[_0x1f94('0x2e')][_0x1f94('0x39')]+'%'};return _0x47fe32;}})});}_0x35f1ec=_['merge']({},_0x35f1ec,_0xded0be[_0x1f94('0x3a')]);var _0x41b5a3={'where':_0x35f1ec['where']};return db[_0x1f94('0x3b')][_0x1f94('0x1d')](_0x41b5a3)[_0x1f94('0x21')](function(_0xe6ce87){_0x199075['count']=_0xe6ce87;if(_0xded0be[_0x1f94('0x2e')]['includeAll']){_0x35f1ec[_0x1f94('0x3c')]=[{'all':!![]}];}return db[_0x1f94('0x3b')][_0x1f94('0x3d')](_0x35f1ec);})[_0x1f94('0x21')](function(_0xc2b836){_0x199075[_0x1f94('0x3e')]=_0xc2b836;return _0x199075;})[_0x1f94('0x21')](respondWithFilteredResult(_0xde160e,_0x35f1ec))['catch'](handleError(_0xde160e,null));};exports[_0x1f94('0x3f')]=function(_0x329d76,_0x1267eb){var _0x271df4={'raw':!![],'where':{'id':_0x329d76[_0x1f94('0x40')]['id']}},_0x5cb5fd={};_0x5cb5fd[_0x1f94('0x2d')]=_['keys'](db['JscriptySessionReport'][_0x1f94('0x29')]);_0x5cb5fd[_0x1f94('0x2e')]=_[_0x1f94('0x41')](_0x329d76[_0x1f94('0x2e')]);_0x5cb5fd['filters']=_[_0x1f94('0x30')](_0x5cb5fd[_0x1f94('0x2d')],_0x5cb5fd['query']);_0x271df4['attributes']=_[_0x1f94('0x30')](_0x5cb5fd['model'],qs[_0x1f94('0x32')](_0x329d76['query'][_0x1f94('0x32')]));_0x271df4[_0x1f94('0x31')]=_0x271df4[_0x1f94('0x31')][_0x1f94('0x42')]?_0x271df4[_0x1f94('0x31')]:_0x5cb5fd[_0x1f94('0x2d')];if(_0x329d76['query'][_0x1f94('0x43')]){_0x271df4[_0x1f94('0x3c')]=[{'all':!![]}];}_0x271df4=_[_0x1f94('0x38')]({},_0x271df4,_0x329d76[_0x1f94('0x3a')]);return db[_0x1f94('0x3b')]['find'](_0x271df4)[_0x1f94('0x21')](handleEntityNotFound(_0x1267eb,null))['then'](respondWithResult(_0x1267eb,null))[_0x1f94('0x44')](handleError(_0x1267eb,null));};exports['create']=function(_0x2d127f,_0x4d9ded){return db['JscriptySessionReport'][_0x1f94('0x45')](_0x2d127f['body'],{})[_0x1f94('0x21')](respondWithResult(_0x4d9ded,0xc9))['catch'](handleError(_0x4d9ded,null));};exports['update']=function(_0x2847c2,_0x192669){if(_0x2847c2[_0x1f94('0x46')]['id']){delete _0x2847c2[_0x1f94('0x46')]['id'];}return db[_0x1f94('0x3b')][_0x1f94('0x47')]({'where':{'id':_0x2847c2[_0x1f94('0x40')]['id']}})[_0x1f94('0x21')](handleEntityNotFound(_0x192669,null))[_0x1f94('0x21')](saveUpdates(_0x2847c2[_0x1f94('0x46')],null))[_0x1f94('0x21')](respondWithResult(_0x192669,null))['catch'](handleError(_0x192669,null));};exports[_0x1f94('0x48')]=function(_0x22af82,_0x544f25){return db[_0x1f94('0x3b')][_0x1f94('0x47')]({'where':{'id':_0x22af82[_0x1f94('0x40')]['id']}})[_0x1f94('0x21')](handleEntityNotFound(_0x544f25,null))[_0x1f94('0x21')](removeEntity(_0x544f25,null))[_0x1f94('0x44')](handleError(_0x544f25,null));};exports[_0x1f94('0x49')]=function(_0x93ee1b,_0x365970){return db[_0x1f94('0x3b')]['describe']()[_0x1f94('0x21')](respondWithResult(_0x365970,null))[_0x1f94('0x44')](handleError(_0x365970,null));};exports[_0x1f94('0x4a')]=function(_0x3410d1,_0x2a3cc7,_0x4a691d){var _0x32dbbe={'raw':!![],'where':{}};var _0x4b46d2={};var _0x45acdc={'count':0x0,'rows':[]};return db[_0x1f94('0x3b')][_0x1f94('0x4b')]({'where':{'id':_0x3410d1[_0x1f94('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a3cc7,null))[_0x1f94('0x21')](function(_0x4c6a6b){if(_0x4c6a6b){_0x4b46d2['model']=_[_0x1f94('0x41')](db[_0x1f94('0x4c')][_0x1f94('0x29')]);_0x4b46d2[_0x1f94('0x2e')]=_[_0x1f94('0x41')](_0x3410d1[_0x1f94('0x2e')]);_0x4b46d2[_0x1f94('0x2f')]=_[_0x1f94('0x30')](_0x4b46d2[_0x1f94('0x2d')],_0x4b46d2['query']);_0x32dbbe[_0x1f94('0x31')]=_[_0x1f94('0x30')](_0x4b46d2['model'],qs['fields'](_0x3410d1[_0x1f94('0x2e')]['fields']));_0x32dbbe['attributes']=_0x32dbbe[_0x1f94('0x31')][_0x1f94('0x42')]?_0x32dbbe['attributes']:_0x4b46d2[_0x1f94('0x2d')];if(!_0x3410d1[_0x1f94('0x2e')][_0x1f94('0x33')](_0x1f94('0x34'))){_0x32dbbe[_0x1f94('0x1c')]=qs[_0x1f94('0x1c')](_0x3410d1[_0x1f94('0x2e')][_0x1f94('0x1c')]);_0x32dbbe[_0x1f94('0x1e')]=qs[_0x1f94('0x1e')](_0x3410d1[_0x1f94('0x2e')]['offset']);}_0x32dbbe[_0x1f94('0x4d')]=qs['sort'](_0x3410d1['query'][_0x1f94('0x35')]);_0x32dbbe['where']=qs[_0x1f94('0x2f')](_['pick'](_0x3410d1[_0x1f94('0x2e')],_0x4b46d2[_0x1f94('0x2f')]));_0x32dbbe[_0x1f94('0x36')]['SessionId']=_0x4c6a6b['id'];if(_0x3410d1[_0x1f94('0x2e')][_0x1f94('0x39')]){_0x32dbbe[_0x1f94('0x36')]=_['merge'](_0x32dbbe[_0x1f94('0x36')],{'$or':_['map'](_0x32dbbe[_0x1f94('0x31')],function(_0x11754c){var _0x4067f8={};_0x4067f8[_0x11754c]={'$like':'%'+_0x3410d1[_0x1f94('0x2e')][_0x1f94('0x39')]+'%'};return _0x4067f8;})});}_0x32dbbe=_[_0x1f94('0x38')]({},_0x32dbbe,_0x3410d1['options']);return db[_0x1f94('0x4c')]['count']({'where':_0x32dbbe['where']})['then'](function(_0x248bc6){_0x45acdc[_0x1f94('0x1d')]=_0x248bc6;if(_0x3410d1[_0x1f94('0x2e')][_0x1f94('0x43')]){_0x32dbbe[_0x1f94('0x3c')]=[{'all':!![]}];}return db[_0x1f94('0x4c')][_0x1f94('0x3d')](_0x32dbbe);})[_0x1f94('0x21')](function(_0x23e9fe){_0x45acdc['rows']=_0x23e9fe;return _0x45acdc;});}})[_0x1f94('0x21')](respondWithFilteredResult(_0x2a3cc7,_0x32dbbe))[_0x1f94('0x44')](handleError(_0x2a3cc7,null));}; \ No newline at end of file +var _0x22f0=['../../config/license/util','sendStatus','end','status','json','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptySessionReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x22f0,0x11a));var _0x022f=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x22f0[_0x1e7701];return _0x3ab707;};'use strict';var emlformat=require(_0x022f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x022f('0x1'));var jsonpatch=require(_0x022f('0x2'));var rp=require('request-promise');var moment=require(_0x022f('0x3'));var BPromise=require(_0x022f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x022f('0x5'));var ejs=require(_0x022f('0x6'));var fs=require('fs');var fs_extra=require(_0x022f('0x7'));var _=require(_0x022f('0x8'));var squel=require(_0x022f('0x9'));var crypto=require(_0x022f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x022f('0x5'));var querystring=require('querystring');var Papa=require(_0x022f('0xb'));var Redis=require(_0x022f('0xc'));var authService=require(_0x022f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x022f('0xe'));var hardwareService=require(_0x022f('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x022f('0x10'));var config=require(_0x022f('0x11'));var licenseUtil=require(_0x022f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3346f3,_0x24f46d){_0x24f46d=_0x24f46d||0xcc;return function(_0x3cb8d7){if(_0x3cb8d7){return _0x3346f3[_0x022f('0x13')](_0x24f46d);}return _0x3346f3['status'](_0x24f46d)[_0x022f('0x14')]();};}function respondWithResult(_0xe5fa7e,_0x2ebbcc){_0x2ebbcc=_0x2ebbcc||0xc8;return function(_0x5a2df2){if(_0x5a2df2){return _0xe5fa7e[_0x022f('0x15')](_0x2ebbcc)[_0x022f('0x16')](_0x5a2df2);}};}function respondWithFilteredResult(_0x29b52a,_0x3b4f5d){return function(_0x391f48){if(_0x391f48){var _0x31de7e=typeof _0x3b4f5d['offset']==='undefined'&&typeof _0x3b4f5d[_0x022f('0x17')]===_0x022f('0x18');var _0x583cc8=_0x391f48[_0x022f('0x19')];var _0x1d086d=_0x31de7e?0x0:_0x3b4f5d['offset'];var _0x4821aa=_0x31de7e?_0x391f48[_0x022f('0x19')]:_0x3b4f5d['offset']+_0x3b4f5d['limit'];var _0xf1a2f1;if(_0x4821aa>=_0x583cc8){_0x4821aa=_0x583cc8;_0xf1a2f1=0xc8;}else{_0xf1a2f1=0xce;}_0x29b52a[_0x022f('0x15')](_0xf1a2f1);return _0x29b52a['set'](_0x022f('0x1a'),_0x1d086d+'-'+_0x4821aa+'/'+_0x583cc8)['json'](_0x391f48);}return null;};}function patchUpdates(_0x18f707){return function(_0x4bafb8){try{jsonpatch[_0x022f('0x1b')](_0x4bafb8,_0x18f707,!![]);}catch(_0x126f79){return BPromise[_0x022f('0x1c')](_0x126f79);}return _0x4bafb8[_0x022f('0x1d')]();};}function saveUpdates(_0xe0d86a,_0xf3bd5f){return function(_0x4fb792){if(_0x4fb792){return _0x4fb792[_0x022f('0x1e')](_0xe0d86a)[_0x022f('0x1f')](function(_0x2533fd){return _0x2533fd;});}return null;};}function removeEntity(_0x3c591e,_0x521f01){return function(_0x2c1243){if(_0x2c1243){return _0x2c1243[_0x022f('0x20')]()[_0x022f('0x1f')](function(){_0x3c591e[_0x022f('0x15')](0xcc)[_0x022f('0x14')]();});}};}function handleEntityNotFound(_0x418658,_0x5da01b){return function(_0x4fbe53){if(!_0x4fbe53){_0x418658[_0x022f('0x13')](0x194);}return _0x4fbe53;};}function handleError(_0x37c3ec,_0x304fa3){_0x304fa3=_0x304fa3||0x1f4;return function(_0x5ef025){logger['error'](_0x5ef025[_0x022f('0x21')]);if(_0x5ef025['name']){delete _0x5ef025[_0x022f('0x22')];}_0x37c3ec['status'](_0x304fa3)[_0x022f('0x23')](_0x5ef025);};}exports[_0x022f('0x24')]=function(_0x30738b,_0x597acf){var _0x5ccade={},_0x2b07b7={},_0x2b524b={'count':0x0,'rows':[]};var _0x5e6843=_['map'](db[_0x022f('0x25')][_0x022f('0x26')],function(_0x4383b5){return{'name':_0x4383b5['fieldName'],'type':_0x4383b5[_0x022f('0x27')][_0x022f('0x28')]};});_0x2b07b7[_0x022f('0x29')]=_[_0x022f('0x2a')](_0x5e6843,'name');_0x2b07b7[_0x022f('0x2b')]=_[_0x022f('0x2c')](_0x30738b[_0x022f('0x2b')]);_0x2b07b7[_0x022f('0x2d')]=_['intersection'](_0x2b07b7[_0x022f('0x29')],_0x2b07b7[_0x022f('0x2b')]);_0x5ccade[_0x022f('0x2e')]=_[_0x022f('0x2f')](_0x2b07b7[_0x022f('0x29')],qs['fields'](_0x30738b[_0x022f('0x2b')][_0x022f('0x30')]));_0x5ccade[_0x022f('0x2e')]=_0x5ccade[_0x022f('0x2e')][_0x022f('0x31')]?_0x5ccade[_0x022f('0x2e')]:_0x2b07b7[_0x022f('0x29')];if(!_0x30738b[_0x022f('0x2b')][_0x022f('0x32')](_0x022f('0x33'))){_0x5ccade[_0x022f('0x17')]=qs[_0x022f('0x17')](_0x30738b['query']['limit']);_0x5ccade[_0x022f('0x34')]=qs[_0x022f('0x34')](_0x30738b[_0x022f('0x2b')][_0x022f('0x34')]);}_0x5ccade[_0x022f('0x35')]=qs[_0x022f('0x36')](_0x30738b[_0x022f('0x2b')][_0x022f('0x36')]);_0x5ccade[_0x022f('0x37')]=qs['filters'](_[_0x022f('0x38')](_0x30738b[_0x022f('0x2b')],_0x2b07b7[_0x022f('0x2d')]),_0x5e6843);if(_0x30738b[_0x022f('0x2b')][_0x022f('0x39')]){_0x5ccade[_0x022f('0x37')]=_[_0x022f('0x3a')](_0x5ccade['where'],{'$or':_[_0x022f('0x2a')](_0x5e6843,function(_0x1b7268){if(_0x1b7268[_0x022f('0x27')]!=='VIRTUAL'){var _0xb27e36={};_0xb27e36[_0x1b7268[_0x022f('0x22')]]={'$like':'%'+_0x30738b[_0x022f('0x2b')][_0x022f('0x39')]+'%'};return _0xb27e36;}})});}_0x5ccade=_[_0x022f('0x3a')]({},_0x5ccade,_0x30738b[_0x022f('0x3b')]);var _0x15475e={'where':_0x5ccade['where']};return db[_0x022f('0x25')][_0x022f('0x19')](_0x15475e)['then'](function(_0x4f5917){_0x2b524b[_0x022f('0x19')]=_0x4f5917;if(_0x30738b['query'][_0x022f('0x3c')]){_0x5ccade[_0x022f('0x3d')]=[{'all':!![]}];}return db[_0x022f('0x25')][_0x022f('0x3e')](_0x5ccade);})[_0x022f('0x1f')](function(_0x28ddd6){_0x2b524b[_0x022f('0x3f')]=_0x28ddd6;return _0x2b524b;})[_0x022f('0x1f')](respondWithFilteredResult(_0x597acf,_0x5ccade))[_0x022f('0x40')](handleError(_0x597acf,null));};exports[_0x022f('0x41')]=function(_0x39db74,_0xf5ca0f){var _0x3cb7f6={'raw':!![],'where':{'id':_0x39db74[_0x022f('0x42')]['id']}},_0x114426={};_0x114426['model']=_['keys'](db[_0x022f('0x25')][_0x022f('0x26')]);_0x114426[_0x022f('0x2b')]=_[_0x022f('0x2c')](_0x39db74[_0x022f('0x2b')]);_0x114426[_0x022f('0x2d')]=_[_0x022f('0x2f')](_0x114426['model'],_0x114426[_0x022f('0x2b')]);_0x3cb7f6[_0x022f('0x2e')]=_['intersection'](_0x114426[_0x022f('0x29')],qs[_0x022f('0x30')](_0x39db74['query']['fields']));_0x3cb7f6[_0x022f('0x2e')]=_0x3cb7f6[_0x022f('0x2e')][_0x022f('0x31')]?_0x3cb7f6[_0x022f('0x2e')]:_0x114426['model'];if(_0x39db74[_0x022f('0x2b')][_0x022f('0x3c')]){_0x3cb7f6[_0x022f('0x3d')]=[{'all':!![]}];}_0x3cb7f6=_[_0x022f('0x3a')]({},_0x3cb7f6,_0x39db74[_0x022f('0x3b')]);return db[_0x022f('0x25')][_0x022f('0x43')](_0x3cb7f6)['then'](handleEntityNotFound(_0xf5ca0f,null))['then'](respondWithResult(_0xf5ca0f,null))[_0x022f('0x40')](handleError(_0xf5ca0f,null));};exports[_0x022f('0x44')]=function(_0x1ad23f,_0x5897d3){return db[_0x022f('0x25')]['create'](_0x1ad23f[_0x022f('0x45')],{})['then'](respondWithResult(_0x5897d3,0xc9))[_0x022f('0x40')](handleError(_0x5897d3,null));};exports[_0x022f('0x1e')]=function(_0x28d413,_0x4c959d){if(_0x28d413['body']['id']){delete _0x28d413['body']['id'];}return db['JscriptySessionReport'][_0x022f('0x43')]({'where':{'id':_0x28d413[_0x022f('0x42')]['id']}})[_0x022f('0x1f')](handleEntityNotFound(_0x4c959d,null))[_0x022f('0x1f')](saveUpdates(_0x28d413[_0x022f('0x45')],null))[_0x022f('0x1f')](respondWithResult(_0x4c959d,null))[_0x022f('0x40')](handleError(_0x4c959d,null));};exports[_0x022f('0x20')]=function(_0x1866cf,_0xb75978){return db[_0x022f('0x25')][_0x022f('0x43')]({'where':{'id':_0x1866cf[_0x022f('0x42')]['id']}})[_0x022f('0x1f')](handleEntityNotFound(_0xb75978,null))[_0x022f('0x1f')](removeEntity(_0xb75978,null))[_0x022f('0x40')](handleError(_0xb75978,null));};exports[_0x022f('0x46')]=function(_0x49c96e,_0x3e0bfc){return db[_0x022f('0x25')][_0x022f('0x46')]()[_0x022f('0x1f')](respondWithResult(_0x3e0bfc,null))[_0x022f('0x40')](handleError(_0x3e0bfc,null));};exports[_0x022f('0x47')]=function(_0x191ca9,_0x24f336,_0x5c6b01){var _0x3a612f={'raw':!![],'where':{}};var _0x12ee8f={};var _0x1d036e={'count':0x0,'rows':[]};return db[_0x022f('0x25')][_0x022f('0x48')]({'where':{'id':_0x191ca9['params']['id']}})[_0x022f('0x1f')](handleEntityNotFound(_0x24f336,null))[_0x022f('0x1f')](function(_0x2f828d){if(_0x2f828d){_0x12ee8f['model']=_[_0x022f('0x2c')](db[_0x022f('0x49')][_0x022f('0x26')]);_0x12ee8f[_0x022f('0x2b')]=_[_0x022f('0x2c')](_0x191ca9[_0x022f('0x2b')]);_0x12ee8f[_0x022f('0x2d')]=_['intersection'](_0x12ee8f[_0x022f('0x29')],_0x12ee8f['query']);_0x3a612f['attributes']=_[_0x022f('0x2f')](_0x12ee8f[_0x022f('0x29')],qs['fields'](_0x191ca9[_0x022f('0x2b')]['fields']));_0x3a612f['attributes']=_0x3a612f[_0x022f('0x2e')]['length']?_0x3a612f[_0x022f('0x2e')]:_0x12ee8f[_0x022f('0x29')];if(!_0x191ca9['query'][_0x022f('0x32')](_0x022f('0x33'))){_0x3a612f[_0x022f('0x17')]=qs['limit'](_0x191ca9[_0x022f('0x2b')][_0x022f('0x17')]);_0x3a612f[_0x022f('0x34')]=qs[_0x022f('0x34')](_0x191ca9['query'][_0x022f('0x34')]);}_0x3a612f[_0x022f('0x35')]=qs[_0x022f('0x36')](_0x191ca9[_0x022f('0x2b')][_0x022f('0x36')]);_0x3a612f['where']=qs[_0x022f('0x2d')](_[_0x022f('0x38')](_0x191ca9[_0x022f('0x2b')],_0x12ee8f[_0x022f('0x2d')]));_0x3a612f['where'][_0x022f('0x4a')]=_0x2f828d['id'];if(_0x191ca9[_0x022f('0x2b')]['filter']){_0x3a612f[_0x022f('0x37')]=_[_0x022f('0x3a')](_0x3a612f[_0x022f('0x37')],{'$or':_[_0x022f('0x2a')](_0x3a612f['attributes'],function(_0x340672){var _0x358859={};_0x358859[_0x340672]={'$like':'%'+_0x191ca9[_0x022f('0x2b')]['filter']+'%'};return _0x358859;})});}_0x3a612f=_['merge']({},_0x3a612f,_0x191ca9['options']);return db[_0x022f('0x49')][_0x022f('0x19')]({'where':_0x3a612f[_0x022f('0x37')]})[_0x022f('0x1f')](function(_0x57cbd5){_0x1d036e['count']=_0x57cbd5;if(_0x191ca9['query'][_0x022f('0x3c')]){_0x3a612f['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x022f('0x3e')](_0x3a612f);})[_0x022f('0x1f')](function(_0x3a0cde){_0x1d036e['rows']=_0x3a0cde;return _0x1d036e;});}})[_0x022f('0x1f')](respondWithFilteredResult(_0x24f336,_0x3a612f))[_0x022f('0x40')](handleError(_0x24f336,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 95a8c82..7f552bf 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x885a,0x180));var _0xa885=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x885a[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0x187d,0x93));var _0xd187=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x187d[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('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 6b23198..dc0a1b6 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 _0x430c=['then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x430c,0x1a1));var _0xc430=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x430c[_0x2272b5];return _0x110156;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x48a2ba,_0xe3a804){var _0x52b1a3=function(_0x320232){while(--_0x320232){_0x48a2ba['push'](_0x48a2ba['shift']());}};_0x52b1a3(++_0xe3a804);}(_0x0295,0x1f0));var _0x5029=function(_0x3d823b,_0x245c0d){_0x3d823b=_0x3d823b-0x0;var _0x1c23cd=_0x0295[_0x3d823b];return _0x1c23cd;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 072c6ac..5c28337 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 _0x8baf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','exports','util','path','connect-timeout','express','Router'];(function(_0x57f59e,_0x3cdc0d){var _0x58f9af=function(_0x3a6584){while(--_0x3a6584){_0x57f59e['push'](_0x57f59e['shift']());}};_0x58f9af(++_0x3cdc0d);}(_0x8baf,0x14f));var _0xf8ba=function(_0x4325ac,_0x27c984){_0x4325ac=_0x4325ac-0x0;var _0x37323b=_0x8baf[_0x4325ac];return _0x37323b;};'use strict';var multer=require('multer');var util=require(_0xf8ba('0x0'));var path=require(_0xf8ba('0x1'));var timeout=require(_0xf8ba('0x2'));var express=require(_0xf8ba('0x3'));var router=express[_0xf8ba('0x4')]();var fs_extra=require(_0xf8ba('0x5'));var auth=require(_0xf8ba('0x6'));var interaction=require(_0xf8ba('0x7'));var config=require(_0xf8ba('0x8'));var controller=require(_0xf8ba('0x9'));router[_0xf8ba('0xa')]('/',controller['index']);router[_0xf8ba('0xb')](_0xf8ba('0xc'),auth[_0xf8ba('0xd')](),controller[_0xf8ba('0xe')]);router[_0xf8ba('0xa')](_0xf8ba('0xf'),auth[_0xf8ba('0xd')](),controller['downloadLogFile']);module[_0xf8ba('0x10')]=router; \ No newline at end of file +var _0x40fb=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0x393592,_0x29fecb){var _0x5eeb35=function(_0x55dde5){while(--_0x55dde5){_0x393592['push'](_0x393592['shift']());}};_0x5eeb35(++_0x29fecb);}(_0x40fb,0x16a));var _0xb40f=function(_0x4eee80,_0x4a0b9a){_0x4eee80=_0x4eee80-0x0;var _0x10d6f0=_0x40fb[_0x4eee80];return _0x10d6f0;};'use strict';var multer=require(_0xb40f('0x0'));var util=require(_0xb40f('0x1'));var path=require(_0xb40f('0x2'));var timeout=require(_0xb40f('0x3'));var express=require('express');var router=express[_0xb40f('0x4')]();var fs_extra=require(_0xb40f('0x5'));var auth=require(_0xb40f('0x6'));var interaction=require(_0xb40f('0x7'));var config=require(_0xb40f('0x8'));var controller=require(_0xb40f('0x9'));router[_0xb40f('0xa')]('/',controller[_0xb40f('0xb')]);router[_0xb40f('0xc')](_0xb40f('0xd'),auth[_0xb40f('0xe')](),controller[_0xb40f('0xf')]);router[_0xb40f('0xa')](_0xb40f('0x10'),auth['isAuthenticated'](),controller[_0xb40f('0x11')]);module[_0xb40f('0x12')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4e1e3f1..b4067c1 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 _0x9d62=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x5a10b2,_0x1b83ee){var _0x177550=function(_0x3bce24){while(--_0x3bce24){_0x5a10b2['push'](_0x5a10b2['shift']());}};_0x177550(++_0x1b83ee);}(_0x9d62,0x86));var _0x29d6=function(_0x20a176,_0x3d000c){_0x20a176=_0x20a176-0x0;var _0x3abfa1=_0x9d62[_0x20a176];return _0x3abfa1;};'use strict';var Sequelize=require(_0x29d6('0x0'));module[_0x29d6('0x1')]={'license':{'type':Sequelize[_0x29d6('0x2')]},'data1':{'type':Sequelize[_0x29d6('0x3')]},'data2':{'type':Sequelize[_0x29d6('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x29d6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b36=['TEXT','STRING'];(function(_0x1573b1,_0x403e1a){var _0x2d1a3f=function(_0x4e6974){while(--_0x4e6974){_0x1573b1['push'](_0x1573b1['shift']());}};_0x2d1a3f(++_0x403e1a);}(_0x5b36,0x6c));var _0x65b3=function(_0x4a8099,_0x178a95){_0x4a8099=_0x4a8099-0x0;var _0x2e804e=_0x5b36[_0x4a8099];return _0x2e804e;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x65b3('0x0')]},'data1':{'type':Sequelize[_0x65b3('0x1')]},'data2':{'type':Sequelize[_0x65b3('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 28eac0d..93f5f25 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 _0x3b29=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','body','find','params','get','checkLicense','key','demo','catch','join','/var','log','xcally','setHeader','attachment;\x20filename=','text/plain','download'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0x3b29,0xd5));var _0x93b2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3b29[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x93b2('0x0'));var rimraf=require(_0x93b2('0x1'));var zipdir=require(_0x93b2('0x2'));var jsonpatch=require(_0x93b2('0x3'));var rp=require('request-promise');var moment=require(_0x93b2('0x4'));var BPromise=require(_0x93b2('0x5'));var Mustache=require('mustache');var util=require(_0x93b2('0x6'));var path=require(_0x93b2('0x7'));var sox=require('sox');var csv=require(_0x93b2('0x8'));var ejs=require(_0x93b2('0x9'));var fs=require('fs');var fs_extra=require(_0x93b2('0xa'));var _=require(_0x93b2('0xb'));var squel=require(_0x93b2('0xc'));var crypto=require(_0x93b2('0xd'));var jsforce=require(_0x93b2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x93b2('0x8'));var querystring=require('querystring');var Papa=require(_0x93b2('0xf'));var Redis=require(_0x93b2('0x10'));var authService=require(_0x93b2('0x11'));var qs=require(_0x93b2('0x12'));var as=require(_0x93b2('0x13'));var hardwareService=require(_0x93b2('0x14'));var logger=require('../../config/logger')(_0x93b2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93b2('0x16'));var db=require(_0x93b2('0x17'))['db'];function respondWithStatusCode(_0x362988,_0x2da366){_0x2da366=_0x2da366||0xcc;return function(_0x2e5e0b){if(_0x2e5e0b){return _0x362988['sendStatus'](_0x2da366);}return _0x362988['status'](_0x2da366)[_0x93b2('0x18')]();};}function respondWithResult(_0x4f5b34,_0x3e403e){_0x3e403e=_0x3e403e||0xc8;return function(_0x3929a3){if(_0x3929a3){return _0x4f5b34['status'](_0x3e403e)[_0x93b2('0x19')](_0x3929a3);}};}function respondWithFilteredResult(_0x2150b9,_0x2e524e){return function(_0x427646){if(_0x427646){var _0x4ac426=typeof _0x2e524e[_0x93b2('0x1a')]===_0x93b2('0x1b')&&typeof _0x2e524e[_0x93b2('0x1c')]==='undefined';var _0x4f1180=_0x427646[_0x93b2('0x1d')];var _0x50c763=_0x4ac426?0x0:_0x2e524e[_0x93b2('0x1a')];var _0x40d93a=_0x4ac426?_0x427646[_0x93b2('0x1d')]:_0x2e524e[_0x93b2('0x1a')]+_0x2e524e[_0x93b2('0x1c')];var _0x3dff94;if(_0x40d93a>=_0x4f1180){_0x40d93a=_0x4f1180;_0x3dff94=0xc8;}else{_0x3dff94=0xce;}_0x2150b9[_0x93b2('0x1e')](_0x3dff94);return _0x2150b9[_0x93b2('0x1f')]('Content-Range',_0x50c763+'-'+_0x40d93a+'/'+_0x4f1180)['json'](_0x427646);}return null;};}function patchUpdates(_0x2de6b4){return function(_0x7b2de7){try{jsonpatch[_0x93b2('0x20')](_0x7b2de7,_0x2de6b4,!![]);}catch(_0x528f2f){return BPromise[_0x93b2('0x21')](_0x528f2f);}return _0x7b2de7[_0x93b2('0x22')]();};}function saveUpdates(_0x5864e9,_0x577067){return function(_0x4db3f6){if(_0x4db3f6){return _0x4db3f6[_0x93b2('0x23')](_0x5864e9)[_0x93b2('0x24')](function(_0xdb292b){return _0xdb292b;});}return null;};}function removeEntity(_0x203043,_0x1a276d){return function(_0x4fe9b4){if(_0x4fe9b4){return _0x4fe9b4[_0x93b2('0x25')]()[_0x93b2('0x24')](function(){_0x203043['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aebf2,_0x12fc10){return function(_0x5a65ae){if(!_0x5a65ae){_0x2aebf2[_0x93b2('0x26')](0x194);}return _0x5a65ae;};}function handleError(_0x34cc5c,_0x2fb653){_0x2fb653=_0x2fb653||0x1f4;return function(_0x39bb2f){logger[_0x93b2('0x27')](_0x39bb2f[_0x93b2('0x28')]);if(_0x39bb2f[_0x93b2('0x29')]){delete _0x39bb2f[_0x93b2('0x29')];}_0x34cc5c[_0x93b2('0x1e')](_0x2fb653)['send'](_0x39bb2f);};}var utilLicense=require(_0x93b2('0x16'));exports[_0x93b2('0x2a')]=function(_0x4f3403,_0x1ee171){var _0x128e03={'raw':!![],'where':{'id':0x1}},_0x3cc0a1={};_0x3cc0a1[_0x93b2('0x2b')]=_[_0x93b2('0x2c')](db[_0x93b2('0x2d')][_0x93b2('0x2e')]);_0x3cc0a1[_0x93b2('0x2f')]=_['keys'](_0x4f3403[_0x93b2('0x2f')]);_0x3cc0a1['filters']=_[_0x93b2('0x30')](_0x3cc0a1[_0x93b2('0x2b')],_0x3cc0a1[_0x93b2('0x2f')]);_0x128e03[_0x93b2('0x31')]=_[_0x93b2('0x30')](_0x3cc0a1[_0x93b2('0x2b')],qs[_0x93b2('0x32')](_0x4f3403['query'][_0x93b2('0x32')]));_0x128e03[_0x93b2('0x31')]=_0x128e03[_0x93b2('0x31')][_0x93b2('0x33')]?_0x128e03['attributes']:_0x3cc0a1[_0x93b2('0x2b')];_0x128e03=_[_0x93b2('0x34')]({},_0x128e03,_0x4f3403[_0x93b2('0x35')]);return utilLicense[_0x93b2('0x36')](_0x128e03)[_0x93b2('0x24')](respondWithResult(_0x1ee171,null))['catch'](handleError(_0x1ee171,null));};exports['update']=function(_0x5e1c05,_0x3e1eac){if(_0x5e1c05['body']['id']){delete _0x5e1c05[_0x93b2('0x37')]['id'];}return db[_0x93b2('0x2d')][_0x93b2('0x38')]({'where':{'id':_0x5e1c05[_0x93b2('0x39')]['id']}})[_0x93b2('0x24')](handleEntityNotFound(_0x3e1eac,null))[_0x93b2('0x24')](function(_0x37669a){var _0x524547=_0x37669a[_0x93b2('0x3a')]({'plain':!![]});return utilLicense[_0x93b2('0x3b')](_0x524547,_0x5e1c05['body'][_0x93b2('0x3c')]);})[_0x93b2('0x24')](function(_0x33bd5d){if(!_0x33bd5d[_0x93b2('0x3d')]){return saveUpdates(_0x5e1c05['body'],null);}return _0x33bd5d;})[_0x93b2('0x24')](respondWithResult(_0x3e1eac,null))[_0x93b2('0x3e')](handleError(_0x3e1eac,null));};exports['downloadLogFile']=function(_0x5e1048,_0x3a066d){var _0x5526cd='license-info.log';var _0xd4521d=path[_0x93b2('0x3f')](_0x93b2('0x40'),_0x93b2('0x41'),_0x93b2('0x42'),_0x5526cd);_0x3a066d[_0x93b2('0x43')]('Content-disposition',_0x93b2('0x44')+_0x5526cd);_0x3a066d[_0x93b2('0x1f')]('Content-Type',_0x93b2('0x45'));_0x3a066d[_0x93b2('0x46')](_0xd4521d);}; \ No newline at end of file +var _0x7588=['body','find','params','downloadLogFile','join','/var','setHeader','Content-disposition','set','text/plain','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','options','getLicense','catch'];(function(_0x2a7ed7,_0x150264){var _0x7c9aed=function(_0x538425){while(--_0x538425){_0x2a7ed7['push'](_0x2a7ed7['shift']());}};_0x7c9aed(++_0x150264);}(_0x7588,0x88));var _0x8758=function(_0x37070f,_0x5390d1){_0x37070f=_0x37070f-0x0;var _0x1d3506=_0x7588[_0x37070f];return _0x1d3506;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8758('0x0'));var zipdir=require(_0x8758('0x1'));var jsonpatch=require(_0x8758('0x2'));var rp=require(_0x8758('0x3'));var moment=require('moment');var BPromise=require(_0x8758('0x4'));var Mustache=require('mustache');var util=require(_0x8758('0x5'));var path=require(_0x8758('0x6'));var sox=require('sox');var csv=require(_0x8758('0x7'));var ejs=require(_0x8758('0x8'));var fs=require('fs');var fs_extra=require(_0x8758('0x9'));var _=require(_0x8758('0xa'));var squel=require(_0x8758('0xb'));var crypto=require('crypto');var jsforce=require(_0x8758('0xc'));var deskjs=require(_0x8758('0xd'));var toCsv=require(_0x8758('0x7'));var querystring=require(_0x8758('0xe'));var Papa=require(_0x8758('0xf'));var Redis=require(_0x8758('0x10'));var authService=require(_0x8758('0x11'));var qs=require(_0x8758('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8758('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8758('0x14'));var licenseUtil=require(_0x8758('0x15'));var db=require(_0x8758('0x16'))['db'];function respondWithStatusCode(_0x481bc6,_0x350b31){_0x350b31=_0x350b31||0xcc;return function(_0x4c7435){if(_0x4c7435){return _0x481bc6['sendStatus'](_0x350b31);}return _0x481bc6[_0x8758('0x17')](_0x350b31)[_0x8758('0x18')]();};}function respondWithResult(_0x46a3fb,_0x43942c){_0x43942c=_0x43942c||0xc8;return function(_0xd02725){if(_0xd02725){return _0x46a3fb[_0x8758('0x17')](_0x43942c)['json'](_0xd02725);}};}function respondWithFilteredResult(_0x179da1,_0x336550){return function(_0xd3afe5){if(_0xd3afe5){var _0x3b01b5=typeof _0x336550[_0x8758('0x19')]===_0x8758('0x1a')&&typeof _0x336550[_0x8758('0x1b')]===_0x8758('0x1a');var _0x59c579=_0xd3afe5[_0x8758('0x1c')];var _0x277274=_0x3b01b5?0x0:_0x336550['offset'];var _0xb9150e=_0x3b01b5?_0xd3afe5[_0x8758('0x1c')]:_0x336550[_0x8758('0x19')]+_0x336550[_0x8758('0x1b')];var _0x4d8f8c;if(_0xb9150e>=_0x59c579){_0xb9150e=_0x59c579;_0x4d8f8c=0xc8;}else{_0x4d8f8c=0xce;}_0x179da1[_0x8758('0x17')](_0x4d8f8c);return _0x179da1['set'](_0x8758('0x1d'),_0x277274+'-'+_0xb9150e+'/'+_0x59c579)['json'](_0xd3afe5);}return null;};}function patchUpdates(_0x4a8b1a){return function(_0x4ceb59){try{jsonpatch[_0x8758('0x1e')](_0x4ceb59,_0x4a8b1a,!![]);}catch(_0x1972b3){return BPromise['reject'](_0x1972b3);}return _0x4ceb59[_0x8758('0x1f')]();};}function saveUpdates(_0x57a97c,_0x20634f){return function(_0x157ae3){if(_0x157ae3){return _0x157ae3[_0x8758('0x20')](_0x57a97c)[_0x8758('0x21')](function(_0x4ae1aa){return _0x4ae1aa;});}return null;};}function removeEntity(_0x4942a0,_0x1f4e75){return function(_0x2e80b5){if(_0x2e80b5){return _0x2e80b5[_0x8758('0x22')]()[_0x8758('0x21')](function(){_0x4942a0[_0x8758('0x17')](0xcc)[_0x8758('0x18')]();});}};}function handleEntityNotFound(_0x307357,_0x10a622){return function(_0x5cacf6){if(!_0x5cacf6){_0x307357[_0x8758('0x23')](0x194);}return _0x5cacf6;};}function handleError(_0x15dd42,_0x1a1746){_0x1a1746=_0x1a1746||0x1f4;return function(_0xb8eff8){logger[_0x8758('0x24')](_0xb8eff8[_0x8758('0x25')]);if(_0xb8eff8[_0x8758('0x26')]){delete _0xb8eff8[_0x8758('0x26')];}_0x15dd42[_0x8758('0x17')](_0x1a1746)[_0x8758('0x27')](_0xb8eff8);};}var utilLicense=require(_0x8758('0x15'));exports['index']=function(_0x518ae4,_0x4590ee){var _0x21ecf0={'raw':!![],'where':{'id':0x1}},_0x7bfee1={};_0x7bfee1[_0x8758('0x28')]=_['keys'](db[_0x8758('0x29')][_0x8758('0x2a')]);_0x7bfee1[_0x8758('0x2b')]=_[_0x8758('0x2c')](_0x518ae4[_0x8758('0x2b')]);_0x7bfee1[_0x8758('0x2d')]=_[_0x8758('0x2e')](_0x7bfee1[_0x8758('0x28')],_0x7bfee1['query']);_0x21ecf0[_0x8758('0x2f')]=_[_0x8758('0x2e')](_0x7bfee1['model'],qs[_0x8758('0x30')](_0x518ae4[_0x8758('0x2b')]['fields']));_0x21ecf0[_0x8758('0x2f')]=_0x21ecf0[_0x8758('0x2f')][_0x8758('0x31')]?_0x21ecf0[_0x8758('0x2f')]:_0x7bfee1[_0x8758('0x28')];_0x21ecf0=_['merge']({},_0x21ecf0,_0x518ae4[_0x8758('0x32')]);return utilLicense[_0x8758('0x33')](_0x21ecf0)[_0x8758('0x21')](respondWithResult(_0x4590ee,null))[_0x8758('0x34')](handleError(_0x4590ee,null));};exports[_0x8758('0x20')]=function(_0x1c2418,_0x1c1058){if(_0x1c2418['body']['id']){delete _0x1c2418[_0x8758('0x35')]['id'];}return db[_0x8758('0x29')][_0x8758('0x36')]({'where':{'id':_0x1c2418[_0x8758('0x37')]['id']}})['then'](handleEntityNotFound(_0x1c1058,null))[_0x8758('0x21')](function(_0x47da5e){var _0x12c74a=_0x47da5e['get']({'plain':!![]});return utilLicense['checkLicense'](_0x12c74a,_0x1c2418['body']['key']);})[_0x8758('0x21')](function(_0xe85190){if(!_0xe85190['demo']){return saveUpdates(_0x1c2418[_0x8758('0x35')],null);}return _0xe85190;})[_0x8758('0x21')](respondWithResult(_0x1c1058,null))['catch'](handleError(_0x1c1058,null));};exports[_0x8758('0x38')]=function(_0x5099db,_0x22db43){var _0x2cefa8='license-info.log';var _0x5e9b9c=path[_0x8758('0x39')](_0x8758('0x3a'),'log','xcally',_0x2cefa8);_0x22db43[_0x8758('0x3b')](_0x8758('0x3c'),'attachment;\x20filename='+_0x2cefa8);_0x22db43[_0x8758('0x3d')]('Content-Type',_0x8758('0x3e'));_0x22db43['download'](_0x5e9b9c);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8068d51..4b6d87b 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 _0x8dae=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x2b1d6e,_0x3b6ab6){var _0x7fe6cd=function(_0x5df195){while(--_0x5df195){_0x2b1d6e['push'](_0x2b1d6e['shift']());}};_0x7fe6cd(++_0x3b6ab6);}(_0x8dae,0x10e));var _0xe8da=function(_0x7335e9,_0x4b20a6){_0x7335e9=_0x7335e9-0x0;var _0xa2c218=_0x8dae[_0x7335e9];return _0xa2c218;};'use strict';var _=require(_0xe8da('0x0'));var util=require(_0xe8da('0x1'));var logger=require(_0xe8da('0x2'))(_0xe8da('0x3'));var moment=require(_0xe8da('0x4'));var BPromise=require(_0xe8da('0x5'));var rp=require(_0xe8da('0x6'));var fs=require('fs');var path=require(_0xe8da('0x7'));var rimraf=require(_0xe8da('0x8'));var config=require(_0xe8da('0x9'));var attributes=require(_0xe8da('0xa'));module[_0xe8da('0xb')]=function(_0x5d5d07,_0x46f5ae){return _0x5d5d07[_0xe8da('0xc')](_0xe8da('0xd'),attributes,{'tableName':_0xe8da('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7e0=['License','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define'];(function(_0x1131b2,_0x1cd5b8){var _0x487778=function(_0x39c3d6){while(--_0x39c3d6){_0x1131b2['push'](_0x1131b2['shift']());}};_0x487778(++_0x1cd5b8);}(_0xc7e0,0x84));var _0x0c7e=function(_0x522b07,_0x11882c){_0x522b07=_0x522b07-0x0;var _0x1ef761=_0xc7e0[_0x522b07];return _0x1ef761;};'use strict';var _=require(_0x0c7e('0x0'));var util=require('util');var logger=require(_0x0c7e('0x1'))(_0x0c7e('0x2'));var moment=require(_0x0c7e('0x3'));var BPromise=require(_0x0c7e('0x4'));var rp=require(_0x0c7e('0x5'));var fs=require('fs');var path=require(_0x0c7e('0x6'));var rimraf=require('rimraf');var config=require(_0x0c7e('0x7'));var attributes=require(_0x0c7e('0x8'));module[_0x0c7e('0x9')]=function(_0x5173fa,_0x59e219){return _0x5173fa[_0x0c7e('0xa')](_0x0c7e('0xb'),attributes,{'tableName':_0x0c7e('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 06404da..5e52b75 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 _0x2929=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x41e96,_0x4c9b00){var _0x2f16cf=function(_0x3c6cb4){while(--_0x3c6cb4){_0x41e96['push'](_0x41e96['shift']());}};_0x2f16cf(++_0x4c9b00);}(_0x2929,0x164));var _0x9292=function(_0x4c557e,_0x32ac29){_0x4c557e=_0x4c557e-0x0;var _0x113015=_0x2929[_0x4c557e];return _0x113015;};'use strict';var _=require(_0x9292('0x0'));var util=require(_0x9292('0x1'));var moment=require(_0x9292('0x2'));var BPromise=require(_0x9292('0x3'));var rs=require(_0x9292('0x4'));var fs=require('fs');var Redis=require(_0x9292('0x5'));var db=require(_0x9292('0x6'))['db'];var utils=require(_0x9292('0x7'));var logger=require(_0x9292('0x8'))(_0x9292('0x9'));var config=require(_0x9292('0xa'));var jayson=require(_0x9292('0xb'));var client=jayson[_0x9292('0xc')][_0x9292('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42fc08,_0x1f2af4,_0x536c87){return new BPromise(function(_0x3c34a8,_0x3e5917){return client[_0x9292('0xe')](_0x42fc08,_0x536c87)['then'](function(_0x1fe33a){logger['info'](_0x9292('0xf'),_0x1f2af4,_0x9292('0x10'));logger[_0x9292('0x11')](_0x9292('0x12'),_0x1f2af4,_0x9292('0x10'),JSON[_0x9292('0x13')](_0x1fe33a));if(_0x1fe33a['error']){if(_0x1fe33a[_0x9292('0x14')]['code']===0x1f4){logger['error'](_0x9292('0xf'),_0x1f2af4,_0x1fe33a[_0x9292('0x14')]['message']);return _0x3e5917(_0x1fe33a[_0x9292('0x14')][_0x9292('0x15')]);}logger[_0x9292('0x14')]('License,\x20%s,\x20%s',_0x1f2af4,_0x1fe33a[_0x9292('0x14')][_0x9292('0x15')]);return _0x3c34a8(_0x1fe33a[_0x9292('0x14')][_0x9292('0x15')]);}else{logger[_0x9292('0x16')](_0x9292('0xf'),_0x1f2af4,_0x9292('0x10'));_0x3c34a8(_0x1fe33a['result'][_0x9292('0x15')]);}})[_0x9292('0x17')](function(_0x2aa9ed){logger['error'](_0x9292('0xf'),_0x1f2af4,_0x2aa9ed);_0x3e5917(_0x2aa9ed);});});} \ No newline at end of file +var _0x90af=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x90af,0x191));var _0xf90a=function(_0x529c0c,_0x30fa10){_0x529c0c=_0x529c0c-0x0;var _0x3263c6=_0x90af[_0x529c0c];return _0x3263c6;};'use strict';var _=require(_0xf90a('0x0'));var util=require(_0xf90a('0x1'));var moment=require(_0xf90a('0x2'));var BPromise=require(_0xf90a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf90a('0x4'));var db=require(_0xf90a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf90a('0x6'))('rpc');var config=require(_0xf90a('0x7'));var jayson=require(_0xf90a('0x8'));var client=jayson[_0xf90a('0x9')][_0xf90a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cb5c4,_0x1256ea,_0x20cd05){return new BPromise(function(_0x3fdcc8,_0x1b5dcd){return client[_0xf90a('0xb')](_0x5cb5c4,_0x20cd05)[_0xf90a('0xc')](function(_0x210964){logger[_0xf90a('0xd')](_0xf90a('0xe'),_0x1256ea,_0xf90a('0xf'));logger[_0xf90a('0x10')](_0xf90a('0x11'),_0x1256ea,'request\x20sent',JSON[_0xf90a('0x12')](_0x210964));if(_0x210964['error']){if(_0x210964[_0xf90a('0x13')][_0xf90a('0x14')]===0x1f4){logger[_0xf90a('0x13')]('License,\x20%s,\x20%s',_0x1256ea,_0x210964[_0xf90a('0x13')]['message']);return _0x1b5dcd(_0x210964[_0xf90a('0x13')][_0xf90a('0x15')]);}logger[_0xf90a('0x13')]('License,\x20%s,\x20%s',_0x1256ea,_0x210964[_0xf90a('0x13')][_0xf90a('0x15')]);return _0x3fdcc8(_0x210964[_0xf90a('0x13')]['message']);}else{logger[_0xf90a('0xd')]('License,\x20%s,\x20%s',_0x1256ea,_0xf90a('0xf'));_0x3fdcc8(_0x210964['result'][_0xf90a('0x15')]);}})[_0xf90a('0x16')](function(_0x2b10e1){logger[_0xf90a('0x13')](_0xf90a('0xe'),_0x1256ea,_0x2b10e1);_0x1b5dcd(_0x2b10e1);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4e8c39a..b7333a8 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 _0x71b3=['/:id/applications','addApplications','/:id/send','send','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','removeAgents','multer','connect-timeout','Router','fs-extra','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x71b3,0x8f));var _0x371b=function(_0x5bc300,_0x4fd234){_0x5bc300=_0x5bc300-0x0;var _0x350259=_0x71b3[_0x5bc300];return _0x350259;};'use strict';var multer=require(_0x371b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x371b('0x1'));var express=require('express');var router=express[_0x371b('0x2')]();var fs_extra=require(_0x371b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x371b('0x4'));var controller=require(_0x371b('0x5'));router[_0x371b('0x6')]('/',auth[_0x371b('0x7')](),controller[_0x371b('0x8')]);router[_0x371b('0x6')](_0x371b('0x9'),auth[_0x371b('0x7')](),controller[_0x371b('0xa')]);router[_0x371b('0x6')](_0x371b('0xb'),auth['isAuthenticated'](),controller[_0x371b('0xc')]);router[_0x371b('0x6')](_0x371b('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x371b('0x6')]('/:id/canned_answers',auth[_0x371b('0x7')](),controller[_0x371b('0xe')]);router[_0x371b('0x6')](_0x371b('0xf'),auth[_0x371b('0x7')](),controller[_0x371b('0x10')]);router[_0x371b('0x6')](_0x371b('0x11'),auth['isAuthenticated'](),controller[_0x371b('0x12')]);router[_0x371b('0x6')](_0x371b('0x13'),auth[_0x371b('0x7')](),controller[_0x371b('0x14')]);router[_0x371b('0x6')]('/:id/applications',auth[_0x371b('0x7')](),controller[_0x371b('0x15')]);router['get']('/:id/messages',auth[_0x371b('0x7')](),controller[_0x371b('0x16')]);router[_0x371b('0x6')](_0x371b('0x17'),auth[_0x371b('0x7')](),controller['verifySmtp']);router[_0x371b('0x6')](_0x371b('0x18'),auth[_0x371b('0x7')](),controller[_0x371b('0x19')]);router[_0x371b('0x1a')](_0x371b('0xd'),auth['isAuthenticated'](),controller[_0x371b('0x1b')]);router[_0x371b('0x1a')]('/:id/canned_answers',auth[_0x371b('0x7')](),controller[_0x371b('0x1c')]);router[_0x371b('0x1a')]('/',auth[_0x371b('0x7')](),controller[_0x371b('0x1d')]);router[_0x371b('0x1a')](_0x371b('0xf'),auth[_0x371b('0x7')](),controller[_0x371b('0x1e')]);router[_0x371b('0x1a')](_0x371b('0x11'),auth[_0x371b('0x7')](),controller[_0x371b('0x1f')]);router[_0x371b('0x1a')]('/:id/interactions',auth[_0x371b('0x7')](),controller[_0x371b('0x20')]);router[_0x371b('0x1a')](_0x371b('0x21'),auth['isAuthenticated'](),controller[_0x371b('0x22')]);router['post'](_0x371b('0x23'),auth[_0x371b('0x7')](),controller[_0x371b('0x24')]);router[_0x371b('0x1a')]('/:id/users',auth[_0x371b('0x7')](),controller['addAgents']);router['put'](_0x371b('0xb'),auth[_0x371b('0x7')](),controller[_0x371b('0x25')]);router[_0x371b('0x26')](_0x371b('0xd'),auth[_0x371b('0x7')](),controller[_0x371b('0x27')]);router[_0x371b('0x26')](_0x371b('0x28'),auth[_0x371b('0x7')](),controller[_0x371b('0x29')]);router['delete'](_0x371b('0xf'),auth[_0x371b('0x7')](),controller[_0x371b('0x2a')]);router[_0x371b('0x26')]('/:id/out_servers',auth[_0x371b('0x7')](),controller['removeSmtp']);router[_0x371b('0x26')](_0x371b('0xb'),auth[_0x371b('0x7')](),controller['destroy']);router['delete'](_0x371b('0x18'),auth[_0x371b('0x7')](),controller[_0x371b('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xef5d=['/:id/verify','/:id/users','getAgents','addAnswer','post','create','/:id/in_servers','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages'];(function(_0x96a519,_0x1de251){var _0xf31872=function(_0x20b4a3){while(--_0x20b4a3){_0x96a519['push'](_0x96a519['shift']());}};_0xf31872(++_0x1de251);}(_0xef5d,0x122));var _0xdef5=function(_0x15f50f,_0xbe3d11){_0x15f50f=_0x15f50f-0x0;var _0x156224=_0xef5d[_0x15f50f];return _0x156224;};'use strict';var multer=require(_0xdef5('0x0'));var util=require('util');var path=require(_0xdef5('0x1'));var timeout=require('connect-timeout');var express=require(_0xdef5('0x2'));var router=express[_0xdef5('0x3')]();var fs_extra=require(_0xdef5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdef5('0x5'));var config=require('../../config/environment');var controller=require(_0xdef5('0x6'));router[_0xdef5('0x7')]('/',auth['isAuthenticated'](),controller[_0xdef5('0x8')]);router[_0xdef5('0x7')](_0xdef5('0x9'),auth[_0xdef5('0xa')](),controller['describe']);router[_0xdef5('0x7')](_0xdef5('0xb'),auth[_0xdef5('0xa')](),controller[_0xdef5('0xc')]);router[_0xdef5('0x7')](_0xdef5('0xd'),auth[_0xdef5('0xa')](),controller[_0xdef5('0xe')]);router[_0xdef5('0x7')](_0xdef5('0xf'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x10')]);router[_0xdef5('0x7')]('/:id/in_servers',auth[_0xdef5('0xa')](),controller[_0xdef5('0x11')]);router['get'](_0xdef5('0x12'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x13')]);router[_0xdef5('0x7')](_0xdef5('0x14'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x15')]);router[_0xdef5('0x7')](_0xdef5('0x16'),auth[_0xdef5('0xa')](),controller['getApplications']);router['get'](_0xdef5('0x17'),auth['isAuthenticated'](),controller[_0xdef5('0x18')]);router[_0xdef5('0x7')](_0xdef5('0x19'),auth[_0xdef5('0xa')](),controller['verifySmtp']);router[_0xdef5('0x7')](_0xdef5('0x1a'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x1b')]);router['post']('/:id/dispositions',auth[_0xdef5('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdef5('0x1c')]);router[_0xdef5('0x1d')]('/',auth['isAuthenticated'](),controller[_0xdef5('0x1e')]);router[_0xdef5('0x1d')](_0xdef5('0x1f'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x20')]);router[_0xdef5('0x1d')](_0xdef5('0x12'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x21')]);router[_0xdef5('0x1d')](_0xdef5('0x14'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x22')]);router[_0xdef5('0x1d')](_0xdef5('0x16'),auth[_0xdef5('0xa')](),controller['addApplications']);router['post'](_0xdef5('0x23'),auth['isAuthenticated'](),controller[_0xdef5('0x24')]);router[_0xdef5('0x1d')](_0xdef5('0x1a'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x25')]);router[_0xdef5('0x26')]('/:id',auth[_0xdef5('0xa')](),controller[_0xdef5('0x27')]);router[_0xdef5('0x28')]('/:id/dispositions',auth[_0xdef5('0xa')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xdef5('0xa')](),controller[_0xdef5('0x29')]);router['delete'](_0xdef5('0x1f'),auth['isAuthenticated'](),controller[_0xdef5('0x2a')]);router[_0xdef5('0x28')](_0xdef5('0x12'),auth[_0xdef5('0xa')](),controller['removeSmtp']);router[_0xdef5('0x28')](_0xdef5('0xb'),auth[_0xdef5('0xa')](),controller[_0xdef5('0x2b')]);router[_0xdef5('0x28')]('/:id/users',auth[_0xdef5('0xa')](),controller['removeAgents']);module[_0xdef5('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 175279a..7d4bc15 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 _0xf292=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x44d85d,_0x477ae2){var _0x55f365=function(_0x84b597){while(--_0x84b597){_0x44d85d['push'](_0x44d85d['shift']());}};_0x55f365(++_0x477ae2);}(_0xf292,0x1ea));var _0x2f29=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xf292[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0x2f29('0x0'));module['exports']={'description':{'type':Sequelize[_0x2f29('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2f29('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2f29('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x2f29('0x3')]},'markAsUnread':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2f29('0x1')],'allowNull':![],'defaultValue':_0x2f29('0x4')},'fontSize':{'type':Sequelize[_0x2f29('0x5')](0x2)[_0x2f29('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2f29('0x3')],'defaultValue':function(){return _0x2f29('0x7');}},'notificationSound':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2f29('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2f29('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2f29('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2f29('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2f29('0x2')],'defaultValue':![],'comment':_0x2f29('0x9'),'set':function(_0x367e14){if(!_0x367e14)this[_0x2f29('0xa')](_0x2f29('0xb'),null);this[_0x2f29('0xa')](_0x2f29('0xc'),_0x367e14);}},'provider':{'type':Sequelize[_0x2f29('0xd')]('gmail',_0x2f29('0xe'),_0x2f29('0xf'),_0x2f29('0x10')),'defaultValue':null,'get':function(){if(!this[_0x2f29('0x11')]('provider'))return'custom';return this[_0x2f29('0x11')](_0x2f29('0x12'));},'set':function(_0x5bc512){if(_0x5bc512===_0x2f29('0x13'))_0x5bc512=null;return this['setDataValue']('provider',_0x5bc512);}}}; \ No newline at end of file +var _0x4850=['custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','provider','getDataValue'];(function(_0x1c20de,_0x1be127){var _0x47ab0b=function(_0x537d6e){while(--_0x537d6e){_0x1c20de['push'](_0x1c20de['shift']());}};_0x47ab0b(++_0x1be127);}(_0x4850,0x1b6));var _0x0485=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4850[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x0485('0x0'));module[_0x0485('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0485('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0485('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0485('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0485('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x0485('0x4')]},'markAsUnread':{'type':Sequelize[_0x0485('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0485('0x2')],'allowNull':![],'defaultValue':_0x0485('0x5')},'fontSize':{'type':Sequelize[_0x0485('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0485('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x0485('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0485('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0485('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0485('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0485('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0485('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0485('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0485('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0485('0x8'),'set':function(_0x5215d9){if(!_0x5215d9)this[_0x0485('0x9')](_0x0485('0xa'),null);this[_0x0485('0x9')](_0x0485('0xb'),_0x5215d9);}},'provider':{'type':Sequelize[_0x0485('0xc')](_0x0485('0xd'),'hotmail',_0x0485('0xe'),_0x0485('0xf')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x0485('0x10')))return'custom';return this[_0x0485('0x11')](_0x0485('0x10'));},'set':function(_0x137176){if(_0x137176===_0x0485('0x12'))_0x137176=null;return this[_0x0485('0x9')](_0x0485('0x10'),_0x137176);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5270e40..31eed29 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 _0xedc7=['color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','CmContact','Contacts','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','join','root','getSmtpOptions','SendMail','sendMail','messageId','subject','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','destroy','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Smtp','index','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','body','provider','MailServerIn','describe','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','length','removeAnswers','custom','email','ListId','isNil','description','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','MailInteraction','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags'];(function(_0x40ce42,_0x25d8fd){var _0x3ebb52=function(_0x5cd35a){while(--_0x5cd35a){_0x40ce42['push'](_0x40ce42['shift']());}};_0x3ebb52(++_0x25d8fd);}(_0xedc7,0x1b2));var _0x7edc=function(_0x23b130,_0x52e735){_0x23b130=_0x23b130-0x0;var _0xabf8de=_0xedc7[_0x23b130];return _0xabf8de;};'use strict';var moment=require(_0x7edc('0x0'));var BPromise=require(_0x7edc('0x1'));var util=require(_0x7edc('0x2'));var path=require(_0x7edc('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x7edc('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7edc('0x5'))(_0x7edc('0x6'));var config=require(_0x7edc('0x7'));var db=require(_0x7edc('0x8'))['db'];config[_0x7edc('0x9')]=_[_0x7edc('0xa')](config[_0x7edc('0x9')],{'host':_0x7edc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7edc('0x9')]));require('./mailAccount.socket')[_0x7edc('0xc')](socket);var jayson=require(_0x7edc('0xd'));var client=jayson[_0x7edc('0xe')][_0x7edc('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x53e722,_0x3b758d,_0x1d8faa,_0x5db818){return new BPromise(function(_0x5e80b7,_0x18e758){var _0x1ef630=_0x5db818||client;return _0x1ef630[_0x7edc('0x10')](_0x53e722,_0x1d8faa)[_0x7edc('0x11')](function(_0x3704af){logger[_0x7edc('0x12')](_0x7edc('0x13'),_0x3b758d,_0x7edc('0x14'));logger[_0x7edc('0x15')](_0x7edc('0x16'),_0x3b758d,_0x7edc('0x14'),JSON['stringify'](_0x3704af));if(_0x3704af[_0x7edc('0x17')]){if(_0x3704af['error'][_0x7edc('0x18')]===0x1f4){logger[_0x7edc('0x17')](_0x7edc('0x13'),_0x3b758d,_0x3704af[_0x7edc('0x17')][_0x7edc('0x19')]);return _0x18e758(_0x3704af['error'][_0x7edc('0x19')]);}logger['error'](_0x7edc('0x13'),_0x3b758d,_0x3704af[_0x7edc('0x17')][_0x7edc('0x19')]);return _0x5e80b7(_0x3704af['error'][_0x7edc('0x19')]);}else{logger[_0x7edc('0x12')](_0x7edc('0x13'),_0x3b758d,_0x7edc('0x14'));_0x5e80b7(_0x3704af[_0x7edc('0x1a')][_0x7edc('0x19')]);}})[_0x7edc('0x1b')](function(_0x5dacc8){logger[_0x7edc('0x17')](_0x7edc('0x13'),_0x3b758d,_0x5dacc8);_0x18e758(_0x5dacc8);});});}function respondWithStatusCode(_0x25c76f,_0x15f6a7){_0x15f6a7=_0x15f6a7||0xcc;return function(_0x38a20a){if(_0x38a20a){return _0x25c76f[_0x7edc('0x1c')](_0x15f6a7);}return _0x25c76f[_0x7edc('0x1d')](_0x15f6a7)[_0x7edc('0x1e')]();};}function respondWithResult(_0x54012e,_0x500d2a){_0x500d2a=_0x500d2a||0xc8;return function(_0x42392e){if(_0x42392e){return _0x54012e[_0x7edc('0x1d')](_0x500d2a)['json'](_0x42392e);}};}function respondWithFilteredResult(_0x4bcd90,_0x539780){return function(_0x38c4fc){if(_0x38c4fc){var _0x233e68=typeof _0x539780[_0x7edc('0x1f')]==='undefined'&&typeof _0x539780[_0x7edc('0x20')]===_0x7edc('0x21');var _0x13d446=_0x38c4fc[_0x7edc('0x22')];var _0x2a18d7=_0x233e68?0x0:_0x539780[_0x7edc('0x1f')];var _0x30b666=_0x233e68?_0x38c4fc['count']:_0x539780[_0x7edc('0x1f')]+_0x539780[_0x7edc('0x20')];var _0x2251c8;if(_0x30b666>=_0x13d446){_0x30b666=_0x13d446;_0x2251c8=0xc8;}else{_0x2251c8=0xce;}_0x4bcd90[_0x7edc('0x1d')](_0x2251c8);return _0x4bcd90[_0x7edc('0x23')](_0x7edc('0x24'),_0x2a18d7+'-'+_0x30b666+'/'+_0x13d446)[_0x7edc('0x25')](_0x38c4fc);}return null;};}function saveUpdates(_0x33fd49){return function(_0x2c34f8){if(_0x2c34f8){return _0x2c34f8[_0x7edc('0x26')](_0x33fd49)['then'](function(_0x37ded4){return _0x37ded4;});}return null;};}function removeEntity(_0x5cb82c){return function(_0x1bb862){if(_0x1bb862){return _0x1bb862[_0x7edc('0x27')]()['then'](function(){var _0x2c6611=_0x1bb862['get']({'plain':!![]});var _0xcc91b=_0x7edc('0x28');return db[_0x7edc('0x29')][_0x7edc('0x27')]({'where':{'type':_0xcc91b,'resourceId':_0x2c6611['id']}})['then'](function(){return _0x1bb862;});})['then'](function(){_0x5cb82c[_0x7edc('0x1d')](0xcc)[_0x7edc('0x1e')]();});}};}function handleEntityNotFound(_0xc7712c){return function(_0x968c2c){if(!_0x968c2c){_0xc7712c[_0x7edc('0x1c')](0x194);}return _0x968c2c;};}function handleError(_0x2384cb,_0x5b383){_0x5b383=_0x5b383||0x1f4;return function(_0x366d78){logger['error'](_0x366d78[_0x7edc('0x2a')]);if(_0x366d78[_0x7edc('0x2b')]){delete _0x366d78[_0x7edc('0x2b')];}_0x2384cb[_0x7edc('0x1d')](_0x5b383)[_0x7edc('0x2c')](_0x366d78);};}function getImapHost(_0x27bfde){switch(_0x27bfde){case _0x7edc('0x2d'):return _0x7edc('0x2e');case _0x7edc('0x2f'):return _0x7edc('0x30');case _0x7edc('0x31'):return _0x7edc('0x32');case _0x7edc('0x33'):return'outlook.office365.com';}throw new Error(_0x7edc('0x34'),_0x27bfde);}function getSmtpHost(_0x30cf13){switch(_0x30cf13){case _0x7edc('0x2d'):return _0x7edc('0x35');case _0x7edc('0x2f'):return _0x7edc('0x36');case _0x7edc('0x31'):return'smtp-mail.outlook.com';case _0x7edc('0x33'):return _0x7edc('0x37');}throw new Error(_0x7edc('0x34'),_0x30cf13);}function getAuthenticationOptions(_0x5e1689,_0x348b3b){var _0x17da3a={};var _0xe94800={};if(_0x5e1689){_0x17da3a[_0x7edc('0x38')]=_0xe94800[_0x7edc('0x38')]=_0x348b3b[_0x7edc('0x39')];_0x17da3a[_0x7edc('0x3a')]=_0xe94800[_0x7edc('0x3b')]=_0x348b3b[_0x7edc('0x3a')];if(_0x348b3b[_0x7edc('0x3c')]){_0x17da3a[_0x7edc('0x3c')]=_0xe94800[_0x7edc('0x3c')]=!![];_0x17da3a[_0x7edc('0x3d')]=_0xe94800[_0x7edc('0x3d')]=_0x348b3b['CloudProviderId'];_0x17da3a[_0x7edc('0x3a')]=_0xe94800['pass']=null;}else{_0x17da3a[_0x7edc('0x3d')]=_0xe94800[_0x7edc('0x3d')]=null;}_0x17da3a[_0x7edc('0x3e')]=getImapHost(_0x5e1689);_0x17da3a[_0x7edc('0x3f')]=0x3e1;_0xe94800[_0x7edc('0x3e')]=getSmtpHost(_0x5e1689);_0xe94800['port']=0x24b;_0xe94800[_0x7edc('0x40')]=![];_0x17da3a[_0x7edc('0x41')]=_0xe94800[_0x7edc('0x41')]=null;}else{if(_0x348b3b[_0x7edc('0x42')]){_0x17da3a['user']=_0xe94800['user']=_0x348b3b[_0x7edc('0x39')];_0x17da3a[_0x7edc('0x3a')]=_0xe94800[_0x7edc('0x3b')]=_0x348b3b[_0x7edc('0x3a')];}else{_0x17da3a[_0x7edc('0x42')]=_0xe94800[_0x7edc('0x42')]=![];_0x17da3a[_0x7edc('0x38')]=_0xe94800['user']=null;_0x17da3a[_0x7edc('0x3a')]=_0xe94800['pass']=null;}_0x17da3a[_0x7edc('0x3e')]=_0x348b3b['Imap'][_0x7edc('0x3e')];_0x17da3a['port']=_0x348b3b['Imap'][_0x7edc('0x3f')];_0xe94800[_0x7edc('0x3e')]=_0x348b3b['Smtp'][_0x7edc('0x3e')];_0xe94800[_0x7edc('0x3f')]=_0x348b3b[_0x7edc('0x43')]['port'];}return{'Imap':_0x17da3a,'Smtp':_0xe94800};}exports[_0x7edc('0x44')]=function(_0x35dfc6,_0x3fc534){var _0x188164={'include':[{'model':db['MailServerIn'],'as':_0x7edc('0x45')},{'model':db[_0x7edc('0x46')],'as':_0x7edc('0x43')},{'model':db[_0x7edc('0x47')],'as':_0x7edc('0x48')}]},_0xdb9ff6={},_0x36d188={'count':0x0,'rows':[]};var _0x11973c=_[_0x7edc('0x49')](db[_0x7edc('0x4a')][_0x7edc('0x4b')],function(_0x565115){return{'name':_0x565115[_0x7edc('0x4c')],'type':_0x565115[_0x7edc('0x4d')][_0x7edc('0x4e')]};});_0xdb9ff6['model']=_[_0x7edc('0x49')](_0x11973c,_0x7edc('0x2b'));_0xdb9ff6[_0x7edc('0x4f')]=_[_0x7edc('0x50')](_0x35dfc6[_0x7edc('0x4f')]);_0xdb9ff6['filters']=_[_0x7edc('0x51')](_0xdb9ff6['model'],_0xdb9ff6[_0x7edc('0x4f')]);_0x188164[_0x7edc('0x52')]=_[_0x7edc('0x51')](_0xdb9ff6[_0x7edc('0x53')],qs[_0x7edc('0x54')](_0x35dfc6[_0x7edc('0x4f')][_0x7edc('0x54')]));_0x188164[_0x7edc('0x52')]=_0x188164[_0x7edc('0x52')]['length']?_0x188164[_0x7edc('0x52')]:_0xdb9ff6[_0x7edc('0x53')];if(!_0x35dfc6[_0x7edc('0x4f')][_0x7edc('0x55')](_0x7edc('0x56'))){_0x188164[_0x7edc('0x20')]=qs[_0x7edc('0x20')](_0x35dfc6['query'][_0x7edc('0x20')]);_0x188164[_0x7edc('0x1f')]=qs['offset'](_0x35dfc6[_0x7edc('0x4f')]['offset']);}_0x188164[_0x7edc('0x57')]=qs[_0x7edc('0x58')](_0x35dfc6[_0x7edc('0x4f')][_0x7edc('0x58')]);_0x188164[_0x7edc('0x59')]=qs[_0x7edc('0x5a')](_[_0x7edc('0x5b')](_0x35dfc6['query'],_0xdb9ff6[_0x7edc('0x5a')]),_0x11973c);if(_0x35dfc6['query'][_0x7edc('0x5c')]){_0x188164[_0x7edc('0x59')]=_['merge'](_0x188164[_0x7edc('0x59')],{'$or':_['map'](_0x11973c,function(_0x67107){if(_0x67107[_0x7edc('0x4d')]!=='VIRTUAL'){var _0x28c686={};_0x28c686[_0x67107['name']]={'$like':'%'+_0x35dfc6[_0x7edc('0x4f')][_0x7edc('0x5c')]+'%'};return _0x28c686;}})});}_0x188164=_[_0x7edc('0x5d')]({},_0x188164,_0x35dfc6[_0x7edc('0x5e')]);var _0x10b725={'where':_0x188164[_0x7edc('0x59')]};return db[_0x7edc('0x4a')][_0x7edc('0x22')](_0x10b725)['then'](function(_0xcc30da){_0x36d188['count']=_0xcc30da;if(_0x35dfc6[_0x7edc('0x4f')][_0x7edc('0x5f')]){_0x188164['include']=[{'all':!![]}];}return db[_0x7edc('0x4a')][_0x7edc('0x60')](_0x188164);})[_0x7edc('0x11')](function(_0x5eeec7){_0x36d188[_0x7edc('0x61')]=_0x5eeec7;return _0x36d188;})[_0x7edc('0x11')](respondWithFilteredResult(_0x3fc534,_0x188164))[_0x7edc('0x1b')](handleError(_0x3fc534,null));};exports[_0x7edc('0x62')]=function(_0x143f6,_0x161ee4){var _0x5c8346={'raw':![],'where':{'id':_0x143f6[_0x7edc('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x7edc('0x45')},{'model':db[_0x7edc('0x46')],'as':'Smtp'},{'model':db[_0x7edc('0x47')],'as':_0x7edc('0x48')}]},_0x3b92b4={};_0x3b92b4['model']=_[_0x7edc('0x50')](db[_0x7edc('0x4a')][_0x7edc('0x4b')]);_0x3b92b4['query']=_[_0x7edc('0x50')](_0x143f6[_0x7edc('0x4f')]);_0x3b92b4[_0x7edc('0x5a')]=_[_0x7edc('0x51')](_0x3b92b4[_0x7edc('0x53')],_0x3b92b4[_0x7edc('0x4f')]);_0x5c8346[_0x7edc('0x52')]=_['intersection'](_0x3b92b4[_0x7edc('0x53')],qs[_0x7edc('0x54')](_0x143f6['query'][_0x7edc('0x54')]));_0x5c8346[_0x7edc('0x52')]=_0x5c8346[_0x7edc('0x52')]['length']?_0x5c8346['attributes']:_0x3b92b4[_0x7edc('0x53')];if(_0x143f6[_0x7edc('0x4f')][_0x7edc('0x5f')]){_0x5c8346[_0x7edc('0x64')]=[{'all':!![]}];}_0x5c8346=_[_0x7edc('0x5d')]({},_0x5c8346,_0x143f6[_0x7edc('0x5e')]);return db[_0x7edc('0x4a')][_0x7edc('0x65')](_0x5c8346)['then'](handleEntityNotFound(_0x161ee4,null))['then'](respondWithResult(_0x161ee4,null))[_0x7edc('0x1b')](handleError(_0x161ee4,null));};exports['update']=function(_0x596685,_0x5e391a){if(_0x596685[_0x7edc('0x66')]['id']){delete _0x596685[_0x7edc('0x66')]['id'];}var _0x28f6bb=_0x596685[_0x7edc('0x66')][_0x7edc('0x67')]==='custom'?null:_0x596685[_0x7edc('0x66')][_0x7edc('0x67')];var _0x3c8fa5=_0x596685[_0x7edc('0x66')][_0x7edc('0x45')]||{};var _0x14efce=_0x596685[_0x7edc('0x66')][_0x7edc('0x43')]||{};if(_0x28f6bb){_0x3c8fa5[_0x7edc('0x3e')]=getImapHost(_0x28f6bb);_0x3c8fa5[_0x7edc('0x3f')]=0x3e1;_0x14efce['host']=getSmtpHost(_0x28f6bb);_0x14efce['port']=0x24b;_0x14efce[_0x7edc('0x40')]=![];}if(_0x14efce[_0x7edc('0x3c')]){_0x14efce[_0x7edc('0x40')]=![];}else{_0x14efce['CloudProviderId']=null;}if(!_0x3c8fa5[_0x7edc('0x3c')])_0x3c8fa5['CloudProviderId']=null;_0x596685[_0x7edc('0x66')]['Imap']=_0x3c8fa5;_0x596685[_0x7edc('0x66')][_0x7edc('0x43')]=_0x14efce;return db[_0x7edc('0x4a')][_0x7edc('0x65')]({'where':{'id':_0x596685['params']['id']},'include':[{'model':db[_0x7edc('0x68')],'as':_0x7edc('0x45')},{'model':db['MailServerOut'],'as':_0x7edc('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x7edc('0x11')](handleEntityNotFound(_0x5e391a,null))[_0x7edc('0x11')](function(_0xce1233){if(!_0xce1233)throw new Error('Mail\x20Account\x20not\x20found');if(_0xce1233['service'])delete _0x596685[_0x7edc('0x66')][_0x7edc('0x45')];return _0xce1233;})['then'](saveUpdates(_0x596685[_0x7edc('0x66')],null))[_0x7edc('0x11')](function(_0x36ae6b){if(!_0x596685[_0x7edc('0x66')][_0x7edc('0x45')])return _0x36ae6b;return db[_0x7edc('0x68')][_0x7edc('0x26')](_0x596685[_0x7edc('0x66')][_0x7edc('0x45')],{'where':{'MailAccountId':_0x36ae6b['id']}})[_0x7edc('0x11')](function(){return _0x36ae6b;});})['then'](function(_0xf47b79){if(!_0x596685[_0x7edc('0x66')][_0x7edc('0x43')])return _0xf47b79;return db[_0x7edc('0x46')]['update'](_0x596685[_0x7edc('0x66')][_0x7edc('0x43')],{'where':{'MailAccountId':_0xf47b79['id']}})[_0x7edc('0x11')](function(){return _0xf47b79;});})[_0x7edc('0x11')](respondWithResult(_0x5e391a,null))[_0x7edc('0x1b')](handleError(_0x5e391a,null));};exports[_0x7edc('0x69')]=function(_0x238b09,_0x573914){return db[_0x7edc('0x4a')][_0x7edc('0x69')]()[_0x7edc('0x11')](respondWithResult(_0x573914,null))['catch'](handleError(_0x573914,null));};exports['addDisposition']=function(_0x807c6e,_0x1fbdc9){if(_0x807c6e[_0x7edc('0x66')]['id']){delete _0x807c6e['body']['id'];}return db[_0x7edc('0x4a')]['find']({'where':{'id':_0x807c6e[_0x7edc('0x63')]['id']}})['then'](handleEntityNotFound(_0x1fbdc9,null))[_0x7edc('0x11')](function(_0x562f08){if(_0x562f08){_0x807c6e[_0x7edc('0x66')][_0x7edc('0x6a')]=_0x562f08['id'];return db[_0x7edc('0x6b')][_0x7edc('0x6c')](_0x807c6e[_0x7edc('0x66')]);}})[_0x7edc('0x11')](respondWithResult(_0x1fbdc9,null))[_0x7edc('0x1b')](handleError(_0x1fbdc9,null));};exports[_0x7edc('0x6d')]=function(_0x30a45a,_0xcac4cd){var _0xbabff0={'raw':![],'where':{}};var _0xf94059={};var _0x412c64={'count':0x0,'rows':[]};return db['MailAccount'][_0x7edc('0x6e')]({'where':{'id':_0x30a45a['params']['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0xcac4cd,null))[_0x7edc('0x11')](function(_0x40ccfc){if(_0x40ccfc){_0xf94059[_0x7edc('0x53')]=_[_0x7edc('0x50')](db[_0x7edc('0x6b')][_0x7edc('0x4b')]);_0xf94059[_0x7edc('0x4f')]=_['keys'](_0x30a45a[_0x7edc('0x4f')]);_0xf94059['filters']=_[_0x7edc('0x51')](_0xf94059[_0x7edc('0x53')],_0xf94059[_0x7edc('0x4f')]);_0xbabff0['attributes']=_['intersection'](_0xf94059[_0x7edc('0x53')],qs['fields'](_0x30a45a['query']['fields']));_0xbabff0[_0x7edc('0x52')]=_0xbabff0[_0x7edc('0x52')]['length']?_0xbabff0[_0x7edc('0x52')]:_0xf94059[_0x7edc('0x53')];if(!_0x30a45a['query']['hasOwnProperty'](_0x7edc('0x56'))){_0xbabff0[_0x7edc('0x20')]=qs['limit'](_0x30a45a[_0x7edc('0x4f')][_0x7edc('0x20')]);_0xbabff0[_0x7edc('0x1f')]=qs['offset'](_0x30a45a[_0x7edc('0x4f')][_0x7edc('0x1f')]);}_0xbabff0[_0x7edc('0x57')]=qs[_0x7edc('0x58')](_0x30a45a[_0x7edc('0x4f')][_0x7edc('0x58')]);_0xbabff0[_0x7edc('0x59')]=qs['filters'](_[_0x7edc('0x5b')](_0x30a45a[_0x7edc('0x4f')],_0xf94059[_0x7edc('0x5a')]));_0xbabff0[_0x7edc('0x59')][_0x7edc('0x6a')]=_0x40ccfc['id'];if(_0x30a45a['query']['filter']){_0xbabff0[_0x7edc('0x59')]=_['merge'](_0xbabff0['where'],{'$or':_['map'](_0xbabff0[_0x7edc('0x52')],function(_0x50bdbb){var _0x5d58c4={};_0x5d58c4[_0x50bdbb]={'$like':'%'+_0x30a45a[_0x7edc('0x4f')]['filter']+'%'};return _0x5d58c4;})});}_0xbabff0=_[_0x7edc('0x5d')]({},_0xbabff0,_0x30a45a[_0x7edc('0x5e')]);return db['Disposition'][_0x7edc('0x22')]({'where':_0xbabff0[_0x7edc('0x59')]})[_0x7edc('0x11')](function(_0x55d017){_0x412c64[_0x7edc('0x22')]=_0x55d017;if(_0x30a45a[_0x7edc('0x4f')][_0x7edc('0x5f')]){_0xbabff0[_0x7edc('0x64')]=[{'all':!![]}];}return db[_0x7edc('0x6b')]['findAll'](_0xbabff0);})['then'](function(_0x5c38ee){_0x412c64[_0x7edc('0x61')]=_0x5c38ee;return _0x412c64;});}})['then'](respondWithFilteredResult(_0xcac4cd,_0xbabff0))['catch'](handleError(_0xcac4cd,null));};exports[_0x7edc('0x6f')]=function(_0x3d6663,_0x2fce28){return db['MailAccount'][_0x7edc('0x65')]({'where':{'id':_0x3d6663[_0x7edc('0x63')]['id']}})['then'](handleEntityNotFound(_0x2fce28,null))['then'](function(_0x3f3c85){if(_0x3f3c85){return _0x3f3c85['removeDispositions'](_0x3d6663[_0x7edc('0x4f')][_0x7edc('0x70')]);}})[_0x7edc('0x11')](respondWithStatusCode(_0x2fce28,null))[_0x7edc('0x1b')](handleError(_0x2fce28,null));};exports[_0x7edc('0x71')]=function(_0x29c28f,_0x4d9ab3){if(_0x29c28f[_0x7edc('0x66')]['id']){delete _0x29c28f[_0x7edc('0x66')]['id'];}return db[_0x7edc('0x4a')]['find']({'where':{'id':_0x29c28f[_0x7edc('0x63')]['id']}})['then'](handleEntityNotFound(_0x4d9ab3,null))[_0x7edc('0x11')](function(_0x2ef22a){if(_0x2ef22a){_0x29c28f[_0x7edc('0x66')][_0x7edc('0x6a')]=_0x2ef22a['id'];return db[_0x7edc('0x72')][_0x7edc('0x6c')](_0x29c28f[_0x7edc('0x66')]);}})['then'](respondWithResult(_0x4d9ab3,null))['catch'](handleError(_0x4d9ab3,null));};exports['getAnswers']=function(_0x3c7ab7,_0xc04747){var _0x4234e2={'raw':![],'where':{}};var _0xf206ef={};var _0x95b54e={'count':0x0,'rows':[]};return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x3c7ab7[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0xc04747,null))[_0x7edc('0x11')](function(_0x294a68){if(_0x294a68){_0xf206ef[_0x7edc('0x53')]=_[_0x7edc('0x50')](db[_0x7edc('0x72')][_0x7edc('0x4b')]);_0xf206ef[_0x7edc('0x4f')]=_['keys'](_0x3c7ab7[_0x7edc('0x4f')]);_0xf206ef[_0x7edc('0x5a')]=_[_0x7edc('0x51')](_0xf206ef['model'],_0xf206ef[_0x7edc('0x4f')]);_0x4234e2[_0x7edc('0x52')]=_[_0x7edc('0x51')](_0xf206ef['model'],qs['fields'](_0x3c7ab7[_0x7edc('0x4f')][_0x7edc('0x54')]));_0x4234e2[_0x7edc('0x52')]=_0x4234e2['attributes'][_0x7edc('0x73')]?_0x4234e2[_0x7edc('0x52')]:_0xf206ef[_0x7edc('0x53')];if(!_0x3c7ab7[_0x7edc('0x4f')][_0x7edc('0x55')](_0x7edc('0x56'))){_0x4234e2[_0x7edc('0x20')]=qs[_0x7edc('0x20')](_0x3c7ab7[_0x7edc('0x4f')][_0x7edc('0x20')]);_0x4234e2[_0x7edc('0x1f')]=qs[_0x7edc('0x1f')](_0x3c7ab7[_0x7edc('0x4f')]['offset']);}_0x4234e2[_0x7edc('0x57')]=qs[_0x7edc('0x58')](_0x3c7ab7[_0x7edc('0x4f')]['sort']);_0x4234e2['where']=qs[_0x7edc('0x5a')](_[_0x7edc('0x5b')](_0x3c7ab7[_0x7edc('0x4f')],_0xf206ef[_0x7edc('0x5a')]));_0x4234e2['where']['MailAccountId']=_0x294a68['id'];if(_0x3c7ab7[_0x7edc('0x4f')]['filter']){_0x4234e2[_0x7edc('0x59')]=_[_0x7edc('0x5d')](_0x4234e2[_0x7edc('0x59')],{'$or':_[_0x7edc('0x49')](_0x4234e2['attributes'],function(_0x18defa){var _0x728d1d={};_0x728d1d[_0x18defa]={'$like':'%'+_0x3c7ab7['query'][_0x7edc('0x5c')]+'%'};return _0x728d1d;})});}_0x4234e2=_[_0x7edc('0x5d')]({},_0x4234e2,_0x3c7ab7['options']);return db[_0x7edc('0x72')][_0x7edc('0x22')]({'where':_0x4234e2['where']})[_0x7edc('0x11')](function(_0x50c0d7){_0x95b54e[_0x7edc('0x22')]=_0x50c0d7;if(_0x3c7ab7[_0x7edc('0x4f')][_0x7edc('0x5f')]){_0x4234e2[_0x7edc('0x64')]=[{'all':!![]}];}return db[_0x7edc('0x72')][_0x7edc('0x60')](_0x4234e2);})[_0x7edc('0x11')](function(_0xbd1980){_0x95b54e['rows']=_0xbd1980;return _0x95b54e;});}})[_0x7edc('0x11')](respondWithFilteredResult(_0xc04747,_0x4234e2))[_0x7edc('0x1b')](handleError(_0xc04747,null));};exports['removeAnswers']=function(_0x31355d,_0x166c57){return db[_0x7edc('0x4a')][_0x7edc('0x65')]({'where':{'id':_0x31355d['params']['id']}})['then'](handleEntityNotFound(_0x166c57,null))[_0x7edc('0x11')](function(_0x284484){if(_0x284484){return _0x284484[_0x7edc('0x74')](_0x31355d['query']['ids']);}})[_0x7edc('0x11')](respondWithStatusCode(_0x166c57,null))['catch'](handleError(_0x166c57,null));};exports[_0x7edc('0x6c')]=function(_0x1fbc18,_0x118a1d){var _0x29ac69={'name':_0x1fbc18[_0x7edc('0x66')]['name'],'key':_0x1fbc18[_0x7edc('0x66')][_0x7edc('0x4e')],'provider':_0x1fbc18[_0x7edc('0x66')][_0x7edc('0x67')]===_0x7edc('0x75')?null:_0x1fbc18[_0x7edc('0x66')]['provider'],'email':_0x1fbc18[_0x7edc('0x66')][_0x7edc('0x76')],'ListId':_0x1fbc18[_0x7edc('0x66')][_0x7edc('0x77')],'active':!_[_0x7edc('0x78')](_0x1fbc18[_0x7edc('0x66')]['active'])?_0x1fbc18[_0x7edc('0x66')]['active']:!![],'description':_0x1fbc18['body'][_0x7edc('0x79')]||null};var _0x291d68=getAuthenticationOptions(_0x29ac69[_0x7edc('0x67')],_0x1fbc18['body']);_0x29ac69[_0x7edc('0x45')]=_0x291d68[_0x7edc('0x45')];_0x29ac69[_0x7edc('0x43')]=_0x291d68['Smtp'];return db[_0x7edc('0x4a')][_0x7edc('0x6c')](_0x29ac69,{'include':[{'model':db[_0x7edc('0x46')],'as':_0x7edc('0x43')},{'model':db[_0x7edc('0x68')],'as':_0x7edc('0x45')}]})[_0x7edc('0x11')](function(_0x52e09d){var _0x130dec=_0x1fbc18[_0x7edc('0x38')]['get']({'plain':!![]});if(!_0x130dec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x130dec[_0x7edc('0x7a')]==='user'){var _0x5d410b=_0x52e09d[_0x7edc('0x7b')]({'plain':!![]});return db[_0x7edc('0x7c')]['find']({'where':{'name':_0x7edc('0x28'),'userProfileId':_0x130dec['userProfileId']},'raw':!![]})['then'](function(_0x24c2c6){if(_0x24c2c6&&_0x24c2c6['autoAssociation']===0x0){return db[_0x7edc('0x29')][_0x7edc('0x6c')]({'name':_0x5d410b['name'],'resourceId':_0x5d410b['id'],'type':_0x24c2c6[_0x7edc('0x2b')],'sectionId':_0x24c2c6['id']},{})[_0x7edc('0x11')](function(){return _0x52e09d;});}else{return _0x52e09d;}})[_0x7edc('0x1b')](function(_0x9bd94c){logger[_0x7edc('0x17')](_0x7edc('0x7d'),_0x9bd94c);throw _0x9bd94c;});}return _0x52e09d;})[_0x7edc('0x11')](respondWithResult(_0x118a1d,0xc9))['catch'](handleError(_0x118a1d,null));};exports[_0x7edc('0x7e')]=function(_0x4b5523,_0x8d6aff){return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x4b5523[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x8d6aff,null))[_0x7edc('0x11')](function(_0x4b0cf8){if(_0x4b0cf8){return _0x4b0cf8[_0x7edc('0x7e')]();}return null;})[_0x7edc('0x11')](respondWithResult(_0x8d6aff,null))[_0x7edc('0x1b')](handleError(_0x8d6aff,null));};exports[_0x7edc('0x7f')]=function(_0x35389f,_0x1e4ca8){if(_0x35389f[_0x7edc('0x66')]['id']){delete _0x35389f[_0x7edc('0x66')]['id'];}return db[_0x7edc('0x4a')][_0x7edc('0x65')]({'where':{'id':_0x35389f[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x1e4ca8,null))[_0x7edc('0x11')](function(_0x340af1){if(_0x340af1){_0x35389f[_0x7edc('0x66')][_0x7edc('0x6a')]=_0x340af1['id'];return db[_0x7edc('0x68')][_0x7edc('0x6c')](_0x35389f[_0x7edc('0x66')]);}})['then'](respondWithResult(_0x1e4ca8,null))[_0x7edc('0x1b')](handleError(_0x1e4ca8,null));};exports[_0x7edc('0x80')]=function(_0x13c2af,_0x403ea9){return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x13c2af['params']['id']}})['then'](handleEntityNotFound(_0x403ea9,null))[_0x7edc('0x11')](function(_0x4c7aaf){if(_0x4c7aaf){return _0x4c7aaf[_0x7edc('0x81')](null);}return null;})['then'](respondWithStatusCode(_0x403ea9,null))[_0x7edc('0x1b')](handleError(_0x403ea9,null));};exports['getSmtp']=function(_0x401135,_0x5742c8){return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x401135[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x5742c8,null))['then'](function(_0x3932fa){if(_0x3932fa){return _0x3932fa[_0x7edc('0x82')]();}return null;})[_0x7edc('0x11')](respondWithResult(_0x5742c8,null))['catch'](handleError(_0x5742c8,null));};exports['addSmtp']=function(_0x3b4fa4,_0x4b81e8){if(_0x3b4fa4[_0x7edc('0x66')]['id']){delete _0x3b4fa4[_0x7edc('0x66')]['id'];}return db[_0x7edc('0x4a')][_0x7edc('0x65')]({'where':{'id':_0x3b4fa4['params']['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x4b81e8,null))[_0x7edc('0x11')](function(_0x3efa8d){if(_0x3efa8d){_0x3b4fa4['body'][_0x7edc('0x6a')]=_0x3efa8d['id'];return db[_0x7edc('0x46')][_0x7edc('0x6c')](_0x3b4fa4['body']);}})['then'](respondWithResult(_0x4b81e8,null))[_0x7edc('0x1b')](handleError(_0x4b81e8,null));};exports[_0x7edc('0x83')]=function(_0x59ccbe,_0x4408b2){return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x59ccbe['params']['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x4408b2,null))[_0x7edc('0x11')](function(_0x18855e){if(_0x18855e){return _0x18855e['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x4408b2,null))[_0x7edc('0x1b')](handleError(_0x4408b2,null));};exports['addInteraction']=function(_0x2668b3,_0x5a80f5){return db[_0x7edc('0x84')]['find']({'where':{'id':_0x2668b3[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x5a80f5,null))['then'](function(_0x56a025){if(_0x56a025){return _0x56a025[_0x7edc('0x85')](_0x2668b3[_0x7edc('0x66')][_0x7edc('0x70')],_[_0x7edc('0x86')](_0x2668b3[_0x7edc('0x66')],['ids','id'])||{});}})[_0x7edc('0x11')](respondWithResult(_0x5a80f5,null))['catch'](handleError(_0x5a80f5,null));};exports['getInteractions']=function(_0x59f31c,_0x56d856){var _0x345350={'raw':![],'where':{}};var _0x34280c={};var _0x27154c={'count':0x0,'rows':[]};return db['MailAccount'][_0x7edc('0x6e')]({'where':{'id':_0x59f31c[_0x7edc('0x63')]['id']}})['then'](handleEntityNotFound(_0x56d856,null))[_0x7edc('0x11')](function(_0x5d40af){if(_0x5d40af){_0x34280c['model']=_[_0x7edc('0x50')](db[_0x7edc('0x84')][_0x7edc('0x4b')]);_0x34280c[_0x7edc('0x4f')]=_[_0x7edc('0x50')](_0x59f31c[_0x7edc('0x4f')]);_0x34280c[_0x7edc('0x5a')]=_[_0x7edc('0x51')](_0x34280c[_0x7edc('0x53')],_0x34280c[_0x7edc('0x4f')]);_0x345350[_0x7edc('0x52')]=_['intersection'](_0x34280c[_0x7edc('0x53')],qs[_0x7edc('0x54')](_0x59f31c['query'][_0x7edc('0x54')]));_0x345350[_0x7edc('0x52')]=_0x345350[_0x7edc('0x52')][_0x7edc('0x73')]?_0x345350[_0x7edc('0x52')]:_0x34280c[_0x7edc('0x53')];if(!_0x59f31c[_0x7edc('0x4f')][_0x7edc('0x55')](_0x7edc('0x56'))){_0x345350[_0x7edc('0x20')]=qs[_0x7edc('0x20')](_0x59f31c['query']['limit']);_0x345350[_0x7edc('0x1f')]=qs[_0x7edc('0x1f')](_0x59f31c[_0x7edc('0x4f')][_0x7edc('0x1f')]);}_0x345350[_0x7edc('0x57')]=qs['sort'](_0x59f31c['query']['sort']);_0x345350[_0x7edc('0x59')]=qs[_0x7edc('0x5a')](_['pick'](_0x59f31c[_0x7edc('0x4f')],_0x34280c[_0x7edc('0x5a')]));_0x345350[_0x7edc('0x59')][_0x7edc('0x6a')]=_0x5d40af['id'];if(_0x59f31c['query'][_0x7edc('0x5c')]){_0x345350[_0x7edc('0x59')]=_[_0x7edc('0x5d')](_0x345350[_0x7edc('0x59')],{'$or':_[_0x7edc('0x49')](_0x345350[_0x7edc('0x52')],function(_0x303b57){var _0x2553f1={};_0x2553f1[_0x303b57]={'$like':'%'+_0x59f31c[_0x7edc('0x4f')][_0x7edc('0x5c')]+'%'};return _0x2553f1;})});}_0x345350=_[_0x7edc('0x5d')]({},_0x345350,_0x59f31c[_0x7edc('0x5e')]);return db[_0x7edc('0x84')][_0x7edc('0x22')]({'where':_0x345350[_0x7edc('0x59')]})[_0x7edc('0x11')](function(_0x1ea9bf){_0x27154c['count']=_0x1ea9bf;if(_0x59f31c[_0x7edc('0x4f')][_0x7edc('0x5f')]){_0x345350[_0x7edc('0x64')]=[{'model':db['CmContact'],'as':_0x7edc('0x87'),'required':![]},{'model':db[_0x7edc('0x88')],'as':_0x7edc('0x89'),'attributes':['name',_0x7edc('0x8a'),_0x7edc('0x8b')],'required':![]},{'model':db[_0x7edc('0x8c')],'as':_0x7edc('0x8d'),'attributes':['id','name',_0x7edc('0x8e')],'where':_0x59f31c[_0x7edc('0x4f')][_0x7edc('0x8f')]?{'id':_0x59f31c[_0x7edc('0x4f')]['tag']}:undefined,'required':_0x59f31c[_0x7edc('0x4f')][_0x7edc('0x8f')]?!![]:![]}];}return db[_0x7edc('0x84')]['findAll'](_0x345350);})[_0x7edc('0x11')](function(_0x2759f2){_0x27154c[_0x7edc('0x61')]=_0x2759f2;return _0x27154c;});}})['then'](respondWithFilteredResult(_0x56d856,_0x345350))[_0x7edc('0x1b')](handleError(_0x56d856,null));};exports[_0x7edc('0x90')]=function addApplications(_0x3f6e15,_0x2416c6){var _0x358225=_0x3f6e15['params']['id'];var _0x3dbc68=_0x3f6e15[_0x7edc('0x66')];var _0x42ad9d=0xc8;var _0x20c4e8=null;return db['sequelize'][_0x7edc('0x91')]({'isolationLevel':db[_0x7edc('0x92')][_0x7edc('0x93')][_0x7edc('0x94')][_0x7edc('0x95')]},function(_0xa7f1f4){return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x358225},'transaction':_0xa7f1f4})[_0x7edc('0x11')](function(_0x13de46){if(_0x13de46){return db['MailApplication'][_0x7edc('0x27')]({'where':{'MailAccountId':_0x358225},'transaction':_0xa7f1f4})['then'](function(){var _0x51bb4b=_[_0x7edc('0x49')](_0x3dbc68,function(_0x2dfd45){_0x2dfd45[_0x7edc('0x6a')]=_0x358225;return _0x2dfd45;});return db[_0x7edc('0x96')]['bulkCreate'](_0x51bb4b,{'transaction':_0xa7f1f4});});}else{_0x42ad9d=0x194;_0x20c4e8=[];}});})[_0x7edc('0x11')](function(){if(_0x42ad9d!==0x194){return db['MailApplication'][_0x7edc('0x97')]({'where':{'MailAccountId':_0x358225},'order':_0x7edc('0x98')})[_0x7edc('0x11')](function(_0x2c6dd7){_0x20c4e8=_0x2c6dd7;});}})[_0x7edc('0x1b')](function(_0x2cd2d9){_0x42ad9d=0x1f4;logger[_0x7edc('0x17')](_0x2cd2d9[_0x7edc('0x2a')]);if(_0x2cd2d9[_0x7edc('0x2b')]){delete _0x2cd2d9['name'];}_0x20c4e8=_0x2cd2d9;})[_0x7edc('0x99')](function(){if(_0x20c4e8===null){_0x2416c6['sendStatus'](_0x42ad9d);}else{if(_0x42ad9d===0x1f4){_0x2416c6[_0x7edc('0x1d')](_0x42ad9d)[_0x7edc('0x2c')](_0x20c4e8);}else{_0x2416c6[_0x7edc('0x1d')](_0x42ad9d)[_0x7edc('0x25')](_0x20c4e8);}}});};exports[_0x7edc('0x9a')]=function(_0x4f70c9,_0x3943ee){var _0x293779={};var _0x514598={};var _0x53dd76;var _0x33753e;return db[_0x7edc('0x4a')]['findOne']({'where':{'id':_0x4f70c9[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x3943ee,null))['then'](function(_0x357639){if(_0x357639){_0x53dd76=_0x357639;_0x514598[_0x7edc('0x53')]=_[_0x7edc('0x50')](db[_0x7edc('0x96')][_0x7edc('0x4b')]);_0x514598[_0x7edc('0x4f')]=_[_0x7edc('0x50')](_0x4f70c9[_0x7edc('0x4f')]);_0x514598[_0x7edc('0x5a')]=_[_0x7edc('0x51')](_0x514598[_0x7edc('0x53')],_0x514598[_0x7edc('0x4f')]);_0x293779[_0x7edc('0x52')]=_['intersection'](_0x514598[_0x7edc('0x53')],qs['fields'](_0x4f70c9[_0x7edc('0x4f')][_0x7edc('0x54')]));_0x293779[_0x7edc('0x52')]=_0x293779[_0x7edc('0x52')][_0x7edc('0x73')]?_0x293779[_0x7edc('0x52')]:_0x514598[_0x7edc('0x53')];_0x293779[_0x7edc('0x57')]=qs[_0x7edc('0x58')](_0x4f70c9[_0x7edc('0x4f')]['sort']);_0x293779[_0x7edc('0x59')]=qs[_0x7edc('0x5a')](_[_0x7edc('0x5b')](_0x4f70c9[_0x7edc('0x4f')],_0x514598[_0x7edc('0x5a')]));if(_0x4f70c9['query'][_0x7edc('0x5c')]){_0x293779[_0x7edc('0x59')]=_['merge'](_0x293779['where'],{'$or':_[_0x7edc('0x49')](_0x293779[_0x7edc('0x52')],function(_0x68c00c){var _0x4af2fe={};_0x4af2fe[_0x68c00c]={'$like':'%'+_0x4f70c9[_0x7edc('0x4f')]['filter']+'%'};return _0x4af2fe;})});}_0x293779=_[_0x7edc('0x5d')]({},_0x293779,_0x4f70c9['options']);return _0x53dd76[_0x7edc('0x9a')](_0x293779);}})[_0x7edc('0x11')](function(_0x2869ac){if(_0x2869ac){_0x33753e=_0x2869ac[_0x7edc('0x73')];if(!_0x4f70c9[_0x7edc('0x4f')][_0x7edc('0x55')](_0x7edc('0x56'))){_0x293779['limit']=qs[_0x7edc('0x20')](_0x4f70c9[_0x7edc('0x4f')][_0x7edc('0x20')]);_0x293779['offset']=qs[_0x7edc('0x1f')](_0x4f70c9['query'][_0x7edc('0x1f')]);}return _0x53dd76[_0x7edc('0x9a')](_0x293779);}})[_0x7edc('0x11')](function(_0x1d68a4){if(_0x1d68a4){return _0x1d68a4?{'count':_0x33753e,'rows':_0x1d68a4}:null;}})[_0x7edc('0x11')](respondWithResult(_0x3943ee,null))[_0x7edc('0x1b')](handleError(_0x3943ee,null));};exports['getMessages']=function(_0x24a093,_0x3bb1db){var _0x251b9f={'raw':!![],'where':{}};var _0x5f5c41={};var _0x5229ba={'count':0x0,'rows':[]};return db[_0x7edc('0x4a')][_0x7edc('0x6e')]({'where':{'id':_0x24a093[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x3bb1db,null))[_0x7edc('0x11')](function(_0x5d9083){if(_0x5d9083){_0x5f5c41[_0x7edc('0x53')]=_[_0x7edc('0x50')](db[_0x7edc('0x9b')][_0x7edc('0x4b')]);_0x5f5c41['query']=_[_0x7edc('0x50')](_0x24a093[_0x7edc('0x4f')]);_0x5f5c41[_0x7edc('0x5a')]=_[_0x7edc('0x51')](_0x5f5c41[_0x7edc('0x53')],_0x5f5c41[_0x7edc('0x4f')]);_0x251b9f['attributes']=_[_0x7edc('0x51')](_0x5f5c41['model'],qs[_0x7edc('0x54')](_0x24a093['query'][_0x7edc('0x54')]));_0x251b9f[_0x7edc('0x52')]=_0x251b9f['attributes'][_0x7edc('0x73')]?_0x251b9f[_0x7edc('0x52')]:_0x5f5c41['model'];if(!_0x24a093[_0x7edc('0x4f')][_0x7edc('0x55')]('nolimit')){_0x251b9f[_0x7edc('0x20')]=qs['limit'](_0x24a093[_0x7edc('0x4f')][_0x7edc('0x20')]);_0x251b9f[_0x7edc('0x1f')]=qs[_0x7edc('0x1f')](_0x24a093[_0x7edc('0x4f')][_0x7edc('0x1f')]);}_0x251b9f[_0x7edc('0x57')]=qs[_0x7edc('0x58')](_0x24a093[_0x7edc('0x4f')][_0x7edc('0x58')]);_0x251b9f['where']=qs[_0x7edc('0x5a')](_[_0x7edc('0x5b')](_0x24a093[_0x7edc('0x4f')],_0x5f5c41[_0x7edc('0x5a')]));_0x251b9f['where'][_0x7edc('0x6a')]=_0x5d9083['id'];if(_0x24a093[_0x7edc('0x4f')]['filter']){_0x251b9f['where']=_['merge'](_0x251b9f[_0x7edc('0x59')],{'$or':_['map'](_0x251b9f['attributes'],function(_0x414528){var _0x3b1ec8={};_0x3b1ec8[_0x414528]={'$like':'%'+_0x24a093[_0x7edc('0x4f')][_0x7edc('0x5c')]+'%'};return _0x3b1ec8;})});}if(_0x24a093['query'][_0x7edc('0x9c')]){var _0xbb1906=_0x24a093[_0x7edc('0x4f')]['$gte']['split'](',');var _0x5941c3={};_0x5941c3[_0xbb1906[0x0]]={'$gte':moment(_0xbb1906[0x1])[_0x7edc('0x9d')](_0x7edc('0x9e'))};_0x251b9f[_0x7edc('0x59')]=_[_0x7edc('0x5d')](_0x251b9f[_0x7edc('0x59')],_0x5941c3);}_0x251b9f=_[_0x7edc('0x5d')]({},_0x251b9f,_0x24a093[_0x7edc('0x5e')]);return db[_0x7edc('0x9b')][_0x7edc('0x22')]({'where':_0x251b9f[_0x7edc('0x59')]})[_0x7edc('0x11')](function(_0xf39522){_0x5229ba[_0x7edc('0x22')]=_0xf39522;if(_0x24a093[_0x7edc('0x4f')][_0x7edc('0x5f')]){_0x251b9f[_0x7edc('0x64')]=[{'all':!![]}];}return db['MailMessage'][_0x7edc('0x60')](_0x251b9f);})[_0x7edc('0x11')](function(_0x4d0e7f){if(_0x24a093[_0x7edc('0x4f')][_0x7edc('0x9f')]===_0x7edc('0xa0')){for(var _0x55c2ec=0x0;_0x55c2ec<_0x4d0e7f[_0x7edc('0x73')];_0x55c2ec++){_0x4d0e7f[_0x55c2ec][_0x7edc('0x66')]=juice(_0x4d0e7f[_0x55c2ec][_0x7edc('0x66')]);}}_0x5229ba[_0x7edc('0x61')]=_0x4d0e7f;return _0x5229ba;});}})[_0x7edc('0x11')](respondWithFilteredResult(_0x3bb1db,_0x251b9f))[_0x7edc('0x1b')](handleError(_0x3bb1db,null));};exports[_0x7edc('0x2c')]=function(_0x9e746,_0x9f34b5){var _0x3c059d,_0x190a57={},_0x16bb11;if(_0x9e746[_0x7edc('0x66')]['to']){_0x16bb11=_0x9e746[_0x7edc('0x66')]['to'][_0x7edc('0xa1')](',')[0x0];}return db['MailAccount'][_0x7edc('0x65')]({'where':{'id':_0x9e746[_0x7edc('0x63')]['id']},'include':[{'model':db[_0x7edc('0xa2')],'as':_0x7edc('0xa3'),'include':[{'model':db[_0x7edc('0xa4')],'as':_0x7edc('0xa5'),'where':{'email':_0x16bb11},'limit':0x1,'order':[[_0x7edc('0xa6'),'DESC']]}]},{'model':db[_0x7edc('0x46')],'as':_0x7edc('0x43'),'raw':!![],'include':[{'model':db[_0x7edc('0xa7')],'as':_0x7edc('0xa7'),'raw':!![]}]}]})[_0x7edc('0x11')](handleEntityNotFound(_0x9f34b5,null))[_0x7edc('0x11')](function(_0x4e383c){if(!_0x4e383c)return;_0x3c059d=_0x4e383c;if(!_0x4e383c[_0x7edc('0x43')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x7edc('0x78')](_0x9e746[_0x7edc('0x66')][_0x7edc('0xa8')])){_0x9e746[_0x7edc('0x66')][_0x7edc('0xa8')]=util[_0x7edc('0x9d')](_0x7edc('0xa9'),_0x4e383c[_0x7edc('0x2b')],_0x4e383c['email']||_0x4e383c[_0x7edc('0x43')][_0x7edc('0x38')]);}if(_0x9e746[_0x7edc('0x66')][_0x7edc('0xaa')]&&_0x9e746[_0x7edc('0x66')]['attachments'][_0x7edc('0x73')]){for(var _0xc180a8=0x0;_0xc180a8<_0x9e746['body'][_0x7edc('0xaa')]['length'];_0xc180a8+=0x1){_0x9e746[_0x7edc('0x66')][_0x7edc('0xaa')][_0xc180a8]={'filename':_0x9e746[_0x7edc('0x66')][_0x7edc('0xaa')][_0xc180a8][_0x7edc('0x2b')],'path':path[_0x7edc('0xab')](config[_0x7edc('0xac')],'server/files/attachments',_0x9e746[_0x7edc('0x66')][_0x7edc('0xaa')][_0xc180a8]['basename'])};}}var _0x1e0c69=_0x4e383c[_0x7edc('0xad')]();return respondWithRpcPromise(_0x7edc('0xae'),_0x7edc('0xaf'),{'account':_0x1e0c69,'message':_0x9e746['body']});})[_0x7edc('0x11')](function(_0x2bc6bf){if(!_0x2bc6bf)return;_0x190a57=_0x2bc6bf;if(!_0x3c059d['List'])throw new Error('List\x20not\x20found');if(_0x3c059d[_0x7edc('0xa3')][_0x7edc('0xa5')][_0x7edc('0x73')])return _0x3c059d['List'][_0x7edc('0xa5')][0x0];return db[_0x7edc('0xa4')][_0x7edc('0x6c')](_[_0x7edc('0xa')](_0x9e746['body'],{'firstName':_0x9e746['body']['to'],'email':_0x9e746[_0x7edc('0x66')]['to'],'phone':_0x9e746[_0x7edc('0x66')]['to'],'ListId':_0x3c059d[_0x7edc('0x77')]}));})[_0x7edc('0x11')](function(_0x22af9a){if(!_0x22af9a)return;var _0x4002b3={'UserId':_0x9e746[_0x7edc('0x38')]['id'],'ContactId':_0x22af9a['id'],'MailAccountId':_0x3c059d['id'],'inReplyTo':_0x190a57[_0x7edc('0xb0')],'to':_0x9e746['body'][_0x7edc('0xa8')],'cc':_0x9e746['body']['cc'],'subject':_0x9e746[_0x7edc('0x66')][_0x7edc('0xb1')],'attach':_0x9e746['body']['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x7edc('0xb2'),'Messages':[_[_0x7edc('0x5d')](_0x9e746[_0x7edc('0x66')],{'messageId':_0x190a57['messageId'],'sentAt':moment()[_0x7edc('0x9d')](_0x7edc('0x9e')),'read':!![],'MailAccountId':_0x3c059d['id'],'UserId':_0x9e746[_0x7edc('0x38')]['id'],'ContactId':_0x22af9a['id']})]};if(_0x9e746[_0x7edc('0x66')][_0x7edc('0xb3')]){_0x4002b3=_[_0x7edc('0x5d')](_0x4002b3,_0x9e746[_0x7edc('0x66')]['Interaction']);}return db['MailInteraction']['create'](_0x4002b3,{'include':[{'model':db[_0x7edc('0x9b')],'as':_0x7edc('0xb4')}]});})[_0x7edc('0x11')](respondWithResult(_0x9f34b5,null))[_0x7edc('0x1b')](handleError(_0x9f34b5,null));};exports[_0x7edc('0xb5')]=function(_0x1ffbd9,_0x165e97){return db['MailAccount'][_0x7edc('0x65')]({'where':{'id':_0x1ffbd9[_0x7edc('0x63')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x7edc('0xa7'),'raw':!![]}]}]})[_0x7edc('0x11')](handleEntityNotFound(_0x165e97,null))['then'](function(_0x49a9a8){if(!_0x49a9a8[_0x7edc('0x43')])return;var _0x26379f=_0x49a9a8['getSmtpOptions']();return respondWithRpcPromise(_0x7edc('0xb6'),_0x7edc('0xb5'),{'account':_0x26379f});})[_0x7edc('0x11')](respondWithResult(_0x165e97,null))[_0x7edc('0x1b')](handleError(_0x165e97,null));};exports[_0x7edc('0x27')]=function(_0x5cc3cb,_0x19f73f){return db[_0x7edc('0x4a')][_0x7edc('0x65')]({'where':{'id':_0x5cc3cb[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x19f73f,null))[_0x7edc('0x11')](function(_0x347145){if(_0x347145&&_0x347145[_0x7edc('0x41')]){throw new db[(_0x7edc('0xb7'))]['ValidationError'](_0x7edc('0xb8'));}return _0x347145;})[_0x7edc('0x11')](removeEntity(_0x19f73f,null))[_0x7edc('0x1b')](handleError(_0x19f73f,null));};exports['addAgents']=function(_0x476f17,_0x4d70f6){return db['MailAccount']['find']({'where':{'id':_0x476f17[_0x7edc('0x63')]['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x4d70f6,null))[_0x7edc('0x11')](function(_0x3b116e){if(_0x3b116e){return _0x3b116e['addAgents'](_0x476f17['body']['ids'],_[_0x7edc('0x86')](_0x476f17[_0x7edc('0x66')],['ids','id'])||{})[_0x7edc('0xb9')](function(_0xf57728){for(var _0x493cd7=0x0;_0x493cd7<_0x476f17[_0x7edc('0x66')][_0x7edc('0x70')][_0x7edc('0x73')];_0x493cd7+=0x1){socket['emit'](_0x7edc('0xba'),{'UserId':Number(_0x476f17[_0x7edc('0x66')][_0x7edc('0x70')][_0x493cd7]),'MailAccountId':Number(_0x476f17[_0x7edc('0x63')]['id'])});}return _0xf57728;});}})[_0x7edc('0x11')](respondWithResult(_0x4d70f6,null))[_0x7edc('0x1b')](handleError(_0x4d70f6,null));};exports['removeAgents']=function(_0x455a73,_0x27923b){return db[_0x7edc('0x4a')]['find']({'where':{'id':_0x455a73['params']['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0x27923b,null))['then'](function(_0x191624){if(_0x191624){return _0x191624[_0x7edc('0xbb')](_0x455a73[_0x7edc('0x4f')][_0x7edc('0x70')])[_0x7edc('0x11')](function(){if(_[_0x7edc('0xbc')](_0x455a73['query'][_0x7edc('0x70')])){for(var _0x5084ee=0x0;_0x5084ee<_0x455a73[_0x7edc('0x4f')][_0x7edc('0x70')][_0x7edc('0x73')];_0x5084ee+=0x1){socket[_0x7edc('0xbd')](_0x7edc('0xbe'),{'UserId':Number(_0x455a73['query'][_0x7edc('0x70')][_0x5084ee]),'MailAccountId':Number(_0x455a73[_0x7edc('0x63')]['id'])});}}else{socket[_0x7edc('0xbd')](_0x7edc('0xbe'),{'UserId':Number(_0x455a73['query']['ids']),'MailAccountId':Number(_0x455a73['params']['id'])});}});}})[_0x7edc('0x11')](respondWithStatusCode(_0x27923b,null))[_0x7edc('0x1b')](handleError(_0x27923b,null));};exports[_0x7edc('0xbf')]=function(_0x2d358b,_0xba985d){var _0x5122f9={};var _0x39a5dc={};var _0x325baf;var _0x24d50a;return db[_0x7edc('0x4a')]['findOne']({'where':{'id':_0x2d358b['params']['id']}})[_0x7edc('0x11')](handleEntityNotFound(_0xba985d,null))[_0x7edc('0x11')](function(_0x784aea){if(_0x784aea){_0x325baf=_0x784aea;_0x39a5dc['model']=_['keys'](db['User'][_0x7edc('0x4b')]);_0x39a5dc['query']=_[_0x7edc('0x50')](_0x2d358b[_0x7edc('0x4f')]);_0x39a5dc[_0x7edc('0x5a')]=_[_0x7edc('0x51')](_0x39a5dc[_0x7edc('0x53')],_0x39a5dc[_0x7edc('0x4f')]);_0x5122f9['attributes']=_[_0x7edc('0x51')](_0x39a5dc['model'],qs[_0x7edc('0x54')](_0x2d358b[_0x7edc('0x4f')][_0x7edc('0x54')]));_0x5122f9[_0x7edc('0x52')]=_0x5122f9[_0x7edc('0x52')][_0x7edc('0x73')]?_0x5122f9[_0x7edc('0x52')]:_0x39a5dc[_0x7edc('0x53')];_0x5122f9['order']=qs[_0x7edc('0x58')](_0x2d358b[_0x7edc('0x4f')][_0x7edc('0x58')]);_0x5122f9[_0x7edc('0x59')]=qs[_0x7edc('0x5a')](_[_0x7edc('0x5b')](_0x2d358b[_0x7edc('0x4f')],_0x39a5dc[_0x7edc('0x5a')]));if(_0x2d358b[_0x7edc('0x4f')][_0x7edc('0x5c')]){_0x5122f9[_0x7edc('0x59')]=_[_0x7edc('0x5d')](_0x5122f9[_0x7edc('0x59')],{'$or':_[_0x7edc('0x49')](_0x5122f9[_0x7edc('0x52')],function(_0x13dde6){var _0x44131d={};_0x44131d[_0x13dde6]={'$like':'%'+_0x2d358b['query']['filter']+'%'};return _0x44131d;})});}_0x5122f9=_['merge']({},_0x5122f9,_0x2d358b[_0x7edc('0x5e')]);return _0x325baf[_0x7edc('0xbf')](_0x5122f9);}})['then'](function(_0x5a3ddb){if(_0x5a3ddb){_0x24d50a=_0x5a3ddb[_0x7edc('0x73')];if(!_0x2d358b[_0x7edc('0x4f')][_0x7edc('0x55')](_0x7edc('0x56'))){_0x5122f9[_0x7edc('0x20')]=qs[_0x7edc('0x20')](_0x2d358b[_0x7edc('0x4f')][_0x7edc('0x20')]);_0x5122f9['offset']=qs[_0x7edc('0x1f')](_0x2d358b[_0x7edc('0x4f')][_0x7edc('0x1f')]);}return _0x325baf[_0x7edc('0xbf')](_0x5122f9);}})[_0x7edc('0x11')](function(_0x31a38d){if(_0x31a38d){return _0x31a38d?{'count':_0x24d50a,'rows':_0x31a38d}:null;}})['then'](respondWithResult(_0xba985d,null))[_0x7edc('0x1b')](handleError(_0xba985d,null));}; \ No newline at end of file +var _0xd084=['ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','sendStatus','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmContact','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','Contacts','ListId','subject','attach','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','gmail','yahoo','hotmail','outlook365','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','body','provider','secure','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','length','merge','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','key','email','isNil','active','description','get','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction'];(function(_0x375532,_0x2556ae){var _0x2b520=function(_0x3f57cc){while(--_0x3f57cc){_0x375532['push'](_0x375532['shift']());}};_0x2b520(++_0x2556ae);}(_0xd084,0xea));var _0x4d08=function(_0x161875,_0x4a9adc){_0x161875=_0x161875-0x0;var _0x919175=_0xd084[_0x161875];return _0x919175;};'use strict';var moment=require(_0x4d08('0x0'));var BPromise=require(_0x4d08('0x1'));var util=require(_0x4d08('0x2'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x4d08('0x3'));var logger=require(_0x4d08('0x4'))(_0x4d08('0x5'));var config=require(_0x4d08('0x6'));var db=require(_0x4d08('0x7'))['db'];config[_0x4d08('0x8')]=_[_0x4d08('0x9')](config[_0x4d08('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d08('0x8')]));require(_0x4d08('0xa'))[_0x4d08('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4d08('0xc')][_0x4d08('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x369f71,_0x20e512,_0x26df69,_0x1c6682){return new BPromise(function(_0x31a5fb,_0x5c4694){var _0x562509=_0x1c6682||client;return _0x562509[_0x4d08('0xe')](_0x369f71,_0x26df69)[_0x4d08('0xf')](function(_0x475449){logger[_0x4d08('0x10')](_0x4d08('0x11'),_0x20e512,_0x4d08('0x12'));logger['debug'](_0x4d08('0x13'),_0x20e512,'request\x20sent',JSON[_0x4d08('0x14')](_0x475449));if(_0x475449['error']){if(_0x475449[_0x4d08('0x15')][_0x4d08('0x16')]===0x1f4){logger[_0x4d08('0x15')]('MailAccount,\x20%s,\x20%s',_0x20e512,_0x475449[_0x4d08('0x15')]['message']);return _0x5c4694(_0x475449[_0x4d08('0x15')][_0x4d08('0x17')]);}logger['error'](_0x4d08('0x11'),_0x20e512,_0x475449[_0x4d08('0x15')][_0x4d08('0x17')]);return _0x31a5fb(_0x475449[_0x4d08('0x15')][_0x4d08('0x17')]);}else{logger[_0x4d08('0x10')]('MailAccount,\x20%s,\x20%s',_0x20e512,_0x4d08('0x12'));_0x31a5fb(_0x475449['result'][_0x4d08('0x17')]);}})[_0x4d08('0x18')](function(_0x569767){logger['error'](_0x4d08('0x11'),_0x20e512,_0x569767);_0x5c4694(_0x569767);});});}function respondWithStatusCode(_0x401b4d,_0x366444){_0x366444=_0x366444||0xcc;return function(_0xf58542){if(_0xf58542){return _0x401b4d['sendStatus'](_0x366444);}return _0x401b4d[_0x4d08('0x19')](_0x366444)[_0x4d08('0x1a')]();};}function respondWithResult(_0x23f53e,_0x4eedc6){_0x4eedc6=_0x4eedc6||0xc8;return function(_0x178f4e){if(_0x178f4e){return _0x23f53e[_0x4d08('0x19')](_0x4eedc6)[_0x4d08('0x1b')](_0x178f4e);}};}function respondWithFilteredResult(_0x3bb3f9,_0x260f14){return function(_0x43931c){if(_0x43931c){var _0x1838e6=typeof _0x260f14[_0x4d08('0x1c')]===_0x4d08('0x1d')&&typeof _0x260f14['limit']===_0x4d08('0x1d');var _0x2c8fcb=_0x43931c[_0x4d08('0x1e')];var _0x18f703=_0x1838e6?0x0:_0x260f14[_0x4d08('0x1c')];var _0x5cccb5=_0x1838e6?_0x43931c['count']:_0x260f14[_0x4d08('0x1c')]+_0x260f14[_0x4d08('0x1f')];var _0x49df61;if(_0x5cccb5>=_0x2c8fcb){_0x5cccb5=_0x2c8fcb;_0x49df61=0xc8;}else{_0x49df61=0xce;}_0x3bb3f9[_0x4d08('0x19')](_0x49df61);return _0x3bb3f9[_0x4d08('0x20')](_0x4d08('0x21'),_0x18f703+'-'+_0x5cccb5+'/'+_0x2c8fcb)[_0x4d08('0x1b')](_0x43931c);}return null;};}function saveUpdates(_0x4377b7){return function(_0x1deaa2){if(_0x1deaa2){return _0x1deaa2[_0x4d08('0x22')](_0x4377b7)['then'](function(_0x1fa3eb){return _0x1fa3eb;});}return null;};}function removeEntity(_0x3d8655){return function(_0x1b3df0){if(_0x1b3df0){return _0x1b3df0['destroy']()[_0x4d08('0xf')](function(){var _0x500801=_0x1b3df0['get']({'plain':!![]});var _0x5bc40f='MailAccounts';return db['UserProfileResource'][_0x4d08('0x23')]({'where':{'type':_0x5bc40f,'resourceId':_0x500801['id']}})['then'](function(){return _0x1b3df0;});})['then'](function(){_0x3d8655[_0x4d08('0x19')](0xcc)[_0x4d08('0x1a')]();});}};}function handleEntityNotFound(_0xcddaff){return function(_0x4fc203){if(!_0x4fc203){_0xcddaff['sendStatus'](0x194);}return _0x4fc203;};}function handleError(_0x4e8822,_0x36c4b2){_0x36c4b2=_0x36c4b2||0x1f4;return function(_0x645e40){logger[_0x4d08('0x15')](_0x645e40[_0x4d08('0x24')]);if(_0x645e40['name']){delete _0x645e40[_0x4d08('0x25')];}_0x4e8822[_0x4d08('0x19')](_0x36c4b2)[_0x4d08('0x26')](_0x645e40);};}function getImapHost(_0x29bb2b){switch(_0x29bb2b){case _0x4d08('0x27'):return'imap.gmail.com';case _0x4d08('0x28'):return'imap.mail.yahoo.com';case _0x4d08('0x29'):return'imap-mail.outlook.com';case _0x4d08('0x2a'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x29bb2b);}function getSmtpHost(_0x2183b3){switch(_0x2183b3){case _0x4d08('0x27'):return _0x4d08('0x2b');case'yahoo':return _0x4d08('0x2c');case _0x4d08('0x29'):return'smtp-mail.outlook.com';case'outlook365':return _0x4d08('0x2d');}throw new Error(_0x4d08('0x2e'),_0x2183b3);}function getAuthenticationOptions(_0x1ea771,_0x5caac6){var _0x451618={};var _0x126f6f={};if(_0x1ea771){_0x451618[_0x4d08('0x2f')]=_0x126f6f[_0x4d08('0x2f')]=_0x5caac6[_0x4d08('0x30')];_0x451618['password']=_0x126f6f[_0x4d08('0x31')]=_0x5caac6[_0x4d08('0x32')];if(_0x5caac6[_0x4d08('0x33')]){_0x451618[_0x4d08('0x33')]=_0x126f6f[_0x4d08('0x33')]=!![];_0x451618['CloudProviderId']=_0x126f6f[_0x4d08('0x34')]=_0x5caac6[_0x4d08('0x34')];_0x451618['password']=_0x126f6f[_0x4d08('0x31')]=null;}else{_0x451618[_0x4d08('0x34')]=_0x126f6f[_0x4d08('0x34')]=null;}_0x451618['host']=getImapHost(_0x1ea771);_0x451618[_0x4d08('0x35')]=0x3e1;_0x126f6f[_0x4d08('0x36')]=getSmtpHost(_0x1ea771);_0x126f6f['port']=0x24b;_0x126f6f['secure']=![];_0x451618[_0x4d08('0x37')]=_0x126f6f[_0x4d08('0x37')]=null;}else{if(_0x5caac6[_0x4d08('0x38')]){_0x451618['user']=_0x126f6f[_0x4d08('0x2f')]=_0x5caac6[_0x4d08('0x30')];_0x451618[_0x4d08('0x32')]=_0x126f6f[_0x4d08('0x31')]=_0x5caac6[_0x4d08('0x32')];}else{_0x451618[_0x4d08('0x38')]=_0x126f6f[_0x4d08('0x38')]=![];_0x451618[_0x4d08('0x2f')]=_0x126f6f[_0x4d08('0x2f')]=null;_0x451618[_0x4d08('0x32')]=_0x126f6f[_0x4d08('0x31')]=null;}_0x451618['host']=_0x5caac6[_0x4d08('0x39')][_0x4d08('0x36')];_0x451618[_0x4d08('0x35')]=_0x5caac6[_0x4d08('0x39')][_0x4d08('0x35')];_0x126f6f[_0x4d08('0x36')]=_0x5caac6[_0x4d08('0x3a')][_0x4d08('0x36')];_0x126f6f[_0x4d08('0x35')]=_0x5caac6['Smtp'][_0x4d08('0x35')];}return{'Imap':_0x451618,'Smtp':_0x126f6f};}exports[_0x4d08('0x3b')]=function(_0x236048,_0x5bcb89){var _0x9641c1={'include':[{'model':db[_0x4d08('0x3c')],'as':_0x4d08('0x39')},{'model':db[_0x4d08('0x3d')],'as':_0x4d08('0x3a')},{'model':db[_0x4d08('0x3e')],'as':_0x4d08('0x3f')}]},_0x5bb4a5={},_0x23bae5={'count':0x0,'rows':[]};var _0x35098e=_['map'](db[_0x4d08('0x40')][_0x4d08('0x41')],function(_0x59c335){return{'name':_0x59c335[_0x4d08('0x42')],'type':_0x59c335[_0x4d08('0x43')]['key']};});_0x5bb4a5[_0x4d08('0x44')]=_[_0x4d08('0x45')](_0x35098e,_0x4d08('0x25'));_0x5bb4a5['query']=_['keys'](_0x236048[_0x4d08('0x46')]);_0x5bb4a5[_0x4d08('0x47')]=_[_0x4d08('0x48')](_0x5bb4a5[_0x4d08('0x44')],_0x5bb4a5[_0x4d08('0x46')]);_0x9641c1[_0x4d08('0x49')]=_['intersection'](_0x5bb4a5[_0x4d08('0x44')],qs[_0x4d08('0x4a')](_0x236048[_0x4d08('0x46')][_0x4d08('0x4a')]));_0x9641c1[_0x4d08('0x49')]=_0x9641c1[_0x4d08('0x49')]['length']?_0x9641c1['attributes']:_0x5bb4a5[_0x4d08('0x44')];if(!_0x236048['query'][_0x4d08('0x4b')](_0x4d08('0x4c'))){_0x9641c1[_0x4d08('0x1f')]=qs[_0x4d08('0x1f')](_0x236048[_0x4d08('0x46')][_0x4d08('0x1f')]);_0x9641c1['offset']=qs[_0x4d08('0x1c')](_0x236048[_0x4d08('0x46')][_0x4d08('0x1c')]);}_0x9641c1[_0x4d08('0x4d')]=qs[_0x4d08('0x4e')](_0x236048[_0x4d08('0x46')][_0x4d08('0x4e')]);_0x9641c1[_0x4d08('0x4f')]=qs[_0x4d08('0x47')](_[_0x4d08('0x50')](_0x236048[_0x4d08('0x46')],_0x5bb4a5[_0x4d08('0x47')]),_0x35098e);if(_0x236048[_0x4d08('0x46')][_0x4d08('0x51')]){_0x9641c1['where']=_['merge'](_0x9641c1[_0x4d08('0x4f')],{'$or':_[_0x4d08('0x45')](_0x35098e,function(_0x561b2f){if(_0x561b2f[_0x4d08('0x43')]!==_0x4d08('0x52')){var _0x7e525a={};_0x7e525a[_0x561b2f['name']]={'$like':'%'+_0x236048[_0x4d08('0x46')][_0x4d08('0x51')]+'%'};return _0x7e525a;}})});}_0x9641c1=_['merge']({},_0x9641c1,_0x236048[_0x4d08('0x53')]);var _0x46b21c={'where':_0x9641c1['where']};return db[_0x4d08('0x40')][_0x4d08('0x1e')](_0x46b21c)[_0x4d08('0xf')](function(_0x3be71a){_0x23bae5[_0x4d08('0x1e')]=_0x3be71a;if(_0x236048[_0x4d08('0x46')][_0x4d08('0x54')]){_0x9641c1[_0x4d08('0x55')]=[{'all':!![]}];}return db['MailAccount'][_0x4d08('0x56')](_0x9641c1);})[_0x4d08('0xf')](function(_0x1ca6a1){_0x23bae5[_0x4d08('0x57')]=_0x1ca6a1;return _0x23bae5;})[_0x4d08('0xf')](respondWithFilteredResult(_0x5bcb89,_0x9641c1))[_0x4d08('0x18')](handleError(_0x5bcb89,null));};exports[_0x4d08('0x58')]=function(_0x198b8a,_0x5e278b){var _0x1cdfcd={'raw':![],'where':{'id':_0x198b8a['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x4d08('0x39')},{'model':db[_0x4d08('0x3d')],'as':_0x4d08('0x3a')},{'model':db['Pause'],'as':_0x4d08('0x3f')}]},_0x347754={};_0x347754[_0x4d08('0x44')]=_[_0x4d08('0x59')](db['MailAccount'][_0x4d08('0x41')]);_0x347754[_0x4d08('0x46')]=_['keys'](_0x198b8a[_0x4d08('0x46')]);_0x347754[_0x4d08('0x47')]=_[_0x4d08('0x48')](_0x347754[_0x4d08('0x44')],_0x347754['query']);_0x1cdfcd[_0x4d08('0x49')]=_['intersection'](_0x347754[_0x4d08('0x44')],qs[_0x4d08('0x4a')](_0x198b8a[_0x4d08('0x46')][_0x4d08('0x4a')]));_0x1cdfcd[_0x4d08('0x49')]=_0x1cdfcd['attributes']['length']?_0x1cdfcd['attributes']:_0x347754['model'];if(_0x198b8a[_0x4d08('0x46')][_0x4d08('0x54')]){_0x1cdfcd[_0x4d08('0x55')]=[{'all':!![]}];}_0x1cdfcd=_['merge']({},_0x1cdfcd,_0x198b8a['options']);return db[_0x4d08('0x40')][_0x4d08('0x5a')](_0x1cdfcd)[_0x4d08('0xf')](handleEntityNotFound(_0x5e278b,null))['then'](respondWithResult(_0x5e278b,null))[_0x4d08('0x18')](handleError(_0x5e278b,null));};exports[_0x4d08('0x22')]=function(_0x23c219,_0x44c3ee){if(_0x23c219[_0x4d08('0x5b')]['id']){delete _0x23c219['body']['id'];}var _0x3a23f6=_0x23c219['body'][_0x4d08('0x5c')]==='custom'?null:_0x23c219[_0x4d08('0x5b')][_0x4d08('0x5c')];var _0x41b786=_0x23c219[_0x4d08('0x5b')][_0x4d08('0x39')]||{};var _0x5c3a61=_0x23c219[_0x4d08('0x5b')]['Smtp']||{};if(_0x3a23f6){_0x41b786['host']=getImapHost(_0x3a23f6);_0x41b786[_0x4d08('0x35')]=0x3e1;_0x5c3a61[_0x4d08('0x36')]=getSmtpHost(_0x3a23f6);_0x5c3a61[_0x4d08('0x35')]=0x24b;_0x5c3a61['secure']=![];}if(_0x5c3a61['modernAuthentication']){_0x5c3a61[_0x4d08('0x5d')]=![];}else{_0x5c3a61[_0x4d08('0x34')]=null;}if(!_0x41b786['modernAuthentication'])_0x41b786[_0x4d08('0x34')]=null;_0x23c219[_0x4d08('0x5b')][_0x4d08('0x39')]=_0x41b786;_0x23c219['body'][_0x4d08('0x3a')]=_0x5c3a61;return db['MailAccount'][_0x4d08('0x5a')]({'where':{'id':_0x23c219[_0x4d08('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x4d08('0x3d')],'as':_0x4d08('0x3a')},{'model':db[_0x4d08('0x3e')],'as':_0x4d08('0x3f')}]})['then'](handleEntityNotFound(_0x44c3ee,null))[_0x4d08('0xf')](function(_0x33f265){if(!_0x33f265)throw new Error(_0x4d08('0x5f'));if(_0x33f265[_0x4d08('0x37')])delete _0x23c219[_0x4d08('0x5b')]['Imap'];return _0x33f265;})[_0x4d08('0xf')](saveUpdates(_0x23c219[_0x4d08('0x5b')],null))[_0x4d08('0xf')](function(_0x27f92d){if(!_0x23c219[_0x4d08('0x5b')][_0x4d08('0x39')])return _0x27f92d;return db[_0x4d08('0x3c')][_0x4d08('0x22')](_0x23c219['body'][_0x4d08('0x39')],{'where':{'MailAccountId':_0x27f92d['id']}})['then'](function(){return _0x27f92d;});})[_0x4d08('0xf')](function(_0x1192b8){if(!_0x23c219['body'][_0x4d08('0x3a')])return _0x1192b8;return db[_0x4d08('0x3d')][_0x4d08('0x22')](_0x23c219[_0x4d08('0x5b')][_0x4d08('0x3a')],{'where':{'MailAccountId':_0x1192b8['id']}})[_0x4d08('0xf')](function(){return _0x1192b8;});})[_0x4d08('0xf')](respondWithResult(_0x44c3ee,null))[_0x4d08('0x18')](handleError(_0x44c3ee,null));};exports[_0x4d08('0x60')]=function(_0x1323f5,_0x2ca1b8){return db[_0x4d08('0x40')][_0x4d08('0x60')]()['then'](respondWithResult(_0x2ca1b8,null))['catch'](handleError(_0x2ca1b8,null));};exports[_0x4d08('0x61')]=function(_0xe14986,_0x3e5e65){if(_0xe14986[_0x4d08('0x5b')]['id']){delete _0xe14986['body']['id'];}return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0xe14986[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x3e5e65,null))[_0x4d08('0xf')](function(_0x3ae91a){if(_0x3ae91a){_0xe14986[_0x4d08('0x5b')][_0x4d08('0x62')]=_0x3ae91a['id'];return db[_0x4d08('0x63')]['create'](_0xe14986[_0x4d08('0x5b')]);}})[_0x4d08('0xf')](respondWithResult(_0x3e5e65,null))['catch'](handleError(_0x3e5e65,null));};exports[_0x4d08('0x64')]=function(_0x4f6cf8,_0x2168d4){var _0x5015ed={'raw':![],'where':{}};var _0x4c381f={};var _0x2a91b4={'count':0x0,'rows':[]};return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x4f6cf8[_0x4d08('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2168d4,null))[_0x4d08('0xf')](function(_0x4c56c6){if(_0x4c56c6){_0x4c381f['model']=_[_0x4d08('0x59')](db[_0x4d08('0x63')]['rawAttributes']);_0x4c381f[_0x4d08('0x46')]=_[_0x4d08('0x59')](_0x4f6cf8['query']);_0x4c381f[_0x4d08('0x47')]=_[_0x4d08('0x48')](_0x4c381f['model'],_0x4c381f[_0x4d08('0x46')]);_0x5015ed[_0x4d08('0x49')]=_[_0x4d08('0x48')](_0x4c381f['model'],qs['fields'](_0x4f6cf8[_0x4d08('0x46')][_0x4d08('0x4a')]));_0x5015ed[_0x4d08('0x49')]=_0x5015ed[_0x4d08('0x49')][_0x4d08('0x66')]?_0x5015ed[_0x4d08('0x49')]:_0x4c381f[_0x4d08('0x44')];if(!_0x4f6cf8[_0x4d08('0x46')][_0x4d08('0x4b')](_0x4d08('0x4c'))){_0x5015ed['limit']=qs[_0x4d08('0x1f')](_0x4f6cf8['query'][_0x4d08('0x1f')]);_0x5015ed[_0x4d08('0x1c')]=qs[_0x4d08('0x1c')](_0x4f6cf8[_0x4d08('0x46')][_0x4d08('0x1c')]);}_0x5015ed[_0x4d08('0x4d')]=qs['sort'](_0x4f6cf8[_0x4d08('0x46')][_0x4d08('0x4e')]);_0x5015ed[_0x4d08('0x4f')]=qs['filters'](_[_0x4d08('0x50')](_0x4f6cf8[_0x4d08('0x46')],_0x4c381f[_0x4d08('0x47')]));_0x5015ed[_0x4d08('0x4f')][_0x4d08('0x62')]=_0x4c56c6['id'];if(_0x4f6cf8[_0x4d08('0x46')]['filter']){_0x5015ed[_0x4d08('0x4f')]=_[_0x4d08('0x67')](_0x5015ed[_0x4d08('0x4f')],{'$or':_[_0x4d08('0x45')](_0x5015ed[_0x4d08('0x49')],function(_0x4c671c){var _0x5ccba4={};_0x5ccba4[_0x4c671c]={'$like':'%'+_0x4f6cf8[_0x4d08('0x46')][_0x4d08('0x51')]+'%'};return _0x5ccba4;})});}_0x5015ed=_[_0x4d08('0x67')]({},_0x5015ed,_0x4f6cf8[_0x4d08('0x53')]);return db['Disposition']['count']({'where':_0x5015ed[_0x4d08('0x4f')]})[_0x4d08('0xf')](function(_0x5ea784){_0x2a91b4[_0x4d08('0x1e')]=_0x5ea784;if(_0x4f6cf8['query'][_0x4d08('0x54')]){_0x5015ed[_0x4d08('0x55')]=[{'all':!![]}];}return db[_0x4d08('0x63')]['findAll'](_0x5015ed);})[_0x4d08('0xf')](function(_0x377c53){_0x2a91b4[_0x4d08('0x57')]=_0x377c53;return _0x2a91b4;});}})[_0x4d08('0xf')](respondWithFilteredResult(_0x2168d4,_0x5015ed))[_0x4d08('0x18')](handleError(_0x2168d4,null));};exports[_0x4d08('0x68')]=function(_0x1cf903,_0x4fee4f){return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0x1cf903['params']['id']}})['then'](handleEntityNotFound(_0x4fee4f,null))[_0x4d08('0xf')](function(_0x5284e8){if(_0x5284e8){return _0x5284e8[_0x4d08('0x68')](_0x1cf903[_0x4d08('0x46')][_0x4d08('0x69')]);}})[_0x4d08('0xf')](respondWithStatusCode(_0x4fee4f,null))[_0x4d08('0x18')](handleError(_0x4fee4f,null));};exports[_0x4d08('0x6a')]=function(_0x214e55,_0x23bdd2){if(_0x214e55['body']['id']){delete _0x214e55[_0x4d08('0x5b')]['id'];}return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0x214e55[_0x4d08('0x5e')]['id']}})['then'](handleEntityNotFound(_0x23bdd2,null))[_0x4d08('0xf')](function(_0x7c589c){if(_0x7c589c){_0x214e55['body'][_0x4d08('0x62')]=_0x7c589c['id'];return db[_0x4d08('0x6b')][_0x4d08('0x6c')](_0x214e55[_0x4d08('0x5b')]);}})[_0x4d08('0xf')](respondWithResult(_0x23bdd2,null))[_0x4d08('0x18')](handleError(_0x23bdd2,null));};exports[_0x4d08('0x6d')]=function(_0x3b507c,_0x347b88){var _0x26c931={'raw':![],'where':{}};var _0x395e32={};var _0xf2639={'count':0x0,'rows':[]};return db[_0x4d08('0x40')]['findOne']({'where':{'id':_0x3b507c['params']['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x347b88,null))['then'](function(_0xf27f97){if(_0xf27f97){_0x395e32[_0x4d08('0x44')]=_[_0x4d08('0x59')](db[_0x4d08('0x6b')]['rawAttributes']);_0x395e32[_0x4d08('0x46')]=_[_0x4d08('0x59')](_0x3b507c[_0x4d08('0x46')]);_0x395e32[_0x4d08('0x47')]=_[_0x4d08('0x48')](_0x395e32['model'],_0x395e32[_0x4d08('0x46')]);_0x26c931['attributes']=_[_0x4d08('0x48')](_0x395e32[_0x4d08('0x44')],qs['fields'](_0x3b507c[_0x4d08('0x46')][_0x4d08('0x4a')]));_0x26c931[_0x4d08('0x49')]=_0x26c931['attributes'][_0x4d08('0x66')]?_0x26c931['attributes']:_0x395e32['model'];if(!_0x3b507c[_0x4d08('0x46')][_0x4d08('0x4b')](_0x4d08('0x4c'))){_0x26c931[_0x4d08('0x1f')]=qs[_0x4d08('0x1f')](_0x3b507c[_0x4d08('0x46')][_0x4d08('0x1f')]);_0x26c931[_0x4d08('0x1c')]=qs['offset'](_0x3b507c['query'][_0x4d08('0x1c')]);}_0x26c931[_0x4d08('0x4d')]=qs[_0x4d08('0x4e')](_0x3b507c[_0x4d08('0x46')][_0x4d08('0x4e')]);_0x26c931[_0x4d08('0x4f')]=qs[_0x4d08('0x47')](_[_0x4d08('0x50')](_0x3b507c[_0x4d08('0x46')],_0x395e32[_0x4d08('0x47')]));_0x26c931[_0x4d08('0x4f')][_0x4d08('0x62')]=_0xf27f97['id'];if(_0x3b507c['query'][_0x4d08('0x51')]){_0x26c931[_0x4d08('0x4f')]=_['merge'](_0x26c931['where'],{'$or':_['map'](_0x26c931[_0x4d08('0x49')],function(_0x4f1076){var _0x206f0e={};_0x206f0e[_0x4f1076]={'$like':'%'+_0x3b507c[_0x4d08('0x46')]['filter']+'%'};return _0x206f0e;})});}_0x26c931=_[_0x4d08('0x67')]({},_0x26c931,_0x3b507c[_0x4d08('0x53')]);return db['CannedAnswer'][_0x4d08('0x1e')]({'where':_0x26c931[_0x4d08('0x4f')]})['then'](function(_0x3d9797){_0xf2639[_0x4d08('0x1e')]=_0x3d9797;if(_0x3b507c[_0x4d08('0x46')][_0x4d08('0x54')]){_0x26c931[_0x4d08('0x55')]=[{'all':!![]}];}return db[_0x4d08('0x6b')]['findAll'](_0x26c931);})[_0x4d08('0xf')](function(_0xac867){_0xf2639[_0x4d08('0x57')]=_0xac867;return _0xf2639;});}})[_0x4d08('0xf')](respondWithFilteredResult(_0x347b88,_0x26c931))[_0x4d08('0x18')](handleError(_0x347b88,null));};exports[_0x4d08('0x6e')]=function(_0x1aa57a,_0x4023ce){return db[_0x4d08('0x40')]['find']({'where':{'id':_0x1aa57a['params']['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x4023ce,null))[_0x4d08('0xf')](function(_0x22b979){if(_0x22b979){return _0x22b979[_0x4d08('0x6e')](_0x1aa57a['query'][_0x4d08('0x69')]);}})[_0x4d08('0xf')](respondWithStatusCode(_0x4023ce,null))['catch'](handleError(_0x4023ce,null));};exports[_0x4d08('0x6c')]=function(_0x315385,_0x58bb73){var _0x278795={'name':_0x315385[_0x4d08('0x5b')]['name'],'key':_0x315385[_0x4d08('0x5b')][_0x4d08('0x6f')],'provider':_0x315385[_0x4d08('0x5b')]['provider']==='custom'?null:_0x315385['body'][_0x4d08('0x5c')],'email':_0x315385[_0x4d08('0x5b')][_0x4d08('0x70')],'ListId':_0x315385['body']['ListId'],'active':!_[_0x4d08('0x71')](_0x315385[_0x4d08('0x5b')][_0x4d08('0x72')])?_0x315385[_0x4d08('0x5b')][_0x4d08('0x72')]:!![],'description':_0x315385[_0x4d08('0x5b')][_0x4d08('0x73')]||null};var _0x48b14a=getAuthenticationOptions(_0x278795[_0x4d08('0x5c')],_0x315385[_0x4d08('0x5b')]);_0x278795[_0x4d08('0x39')]=_0x48b14a['Imap'];_0x278795[_0x4d08('0x3a')]=_0x48b14a[_0x4d08('0x3a')];return db[_0x4d08('0x40')][_0x4d08('0x6c')](_0x278795,{'include':[{'model':db[_0x4d08('0x3d')],'as':_0x4d08('0x3a')},{'model':db[_0x4d08('0x3c')],'as':_0x4d08('0x39')}]})['then'](function(_0x5f69ee){var _0x4ca8ed=_0x315385['user'][_0x4d08('0x74')]({'plain':!![]});if(!_0x4ca8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ca8ed[_0x4d08('0x75')]===_0x4d08('0x2f')){var _0x1ee4ef=_0x5f69ee[_0x4d08('0x74')]({'plain':!![]});return db[_0x4d08('0x76')][_0x4d08('0x5a')]({'where':{'name':_0x4d08('0x77'),'userProfileId':_0x4ca8ed[_0x4d08('0x78')]},'raw':!![]})[_0x4d08('0xf')](function(_0x14b24f){if(_0x14b24f&&_0x14b24f[_0x4d08('0x79')]===0x0){return db['UserProfileResource'][_0x4d08('0x6c')]({'name':_0x1ee4ef['name'],'resourceId':_0x1ee4ef['id'],'type':_0x14b24f[_0x4d08('0x25')],'sectionId':_0x14b24f['id']},{})[_0x4d08('0xf')](function(){return _0x5f69ee;});}else{return _0x5f69ee;}})[_0x4d08('0x18')](function(_0x465d10){logger[_0x4d08('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x465d10);throw _0x465d10;});}return _0x5f69ee;})[_0x4d08('0xf')](respondWithResult(_0x58bb73,0xc9))['catch'](handleError(_0x58bb73,null));};exports[_0x4d08('0x7a')]=function(_0x3af3ba,_0x1d03a5){return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x3af3ba[_0x4d08('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1d03a5,null))[_0x4d08('0xf')](function(_0x441478){if(_0x441478){return _0x441478[_0x4d08('0x7a')]();}return null;})['then'](respondWithResult(_0x1d03a5,null))[_0x4d08('0x18')](handleError(_0x1d03a5,null));};exports['addImap']=function(_0x3627f2,_0x2b36e9){if(_0x3627f2['body']['id']){delete _0x3627f2['body']['id'];}return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0x3627f2[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x2b36e9,null))['then'](function(_0x8f99f1){if(_0x8f99f1){_0x3627f2['body'][_0x4d08('0x62')]=_0x8f99f1['id'];return db['MailServerIn']['create'](_0x3627f2[_0x4d08('0x5b')]);}})[_0x4d08('0xf')](respondWithResult(_0x2b36e9,null))[_0x4d08('0x18')](handleError(_0x2b36e9,null));};exports[_0x4d08('0x7b')]=function(_0x4198b2,_0xb78f62){return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x4198b2[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0xb78f62,null))[_0x4d08('0xf')](function(_0x150325){if(_0x150325){return _0x150325[_0x4d08('0x7c')](null);}return null;})[_0x4d08('0xf')](respondWithStatusCode(_0xb78f62,null))[_0x4d08('0x18')](handleError(_0xb78f62,null));};exports[_0x4d08('0x7d')]=function(_0x296ca5,_0x1fe294){return db[_0x4d08('0x40')]['findOne']({'where':{'id':_0x296ca5[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x1fe294,null))[_0x4d08('0xf')](function(_0x43b691){if(_0x43b691){return _0x43b691[_0x4d08('0x7d')]();}return null;})[_0x4d08('0xf')](respondWithResult(_0x1fe294,null))[_0x4d08('0x18')](handleError(_0x1fe294,null));};exports[_0x4d08('0x7e')]=function(_0x8df1ae,_0x3a0e6){if(_0x8df1ae[_0x4d08('0x5b')]['id']){delete _0x8df1ae['body']['id'];}return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0x8df1ae[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x3a0e6,null))[_0x4d08('0xf')](function(_0x24916a){if(_0x24916a){_0x8df1ae[_0x4d08('0x5b')][_0x4d08('0x62')]=_0x24916a['id'];return db[_0x4d08('0x3d')]['create'](_0x8df1ae[_0x4d08('0x5b')]);}})[_0x4d08('0xf')](respondWithResult(_0x3a0e6,null))[_0x4d08('0x18')](handleError(_0x3a0e6,null));};exports['removeSmtp']=function(_0x3158ab,_0x152e18){return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x3158ab[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x152e18,null))['then'](function(_0x3e1d10){if(_0x3e1d10){return _0x3e1d10[_0x4d08('0x7f')](null);}return null;})[_0x4d08('0xf')](respondWithStatusCode(_0x152e18,null))[_0x4d08('0x18')](handleError(_0x152e18,null));};exports[_0x4d08('0x80')]=function(_0x4c47c6,_0x2ff058){return db['MailInteraction'][_0x4d08('0x5a')]({'where':{'id':_0x4c47c6[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x2ff058,null))['then'](function(_0x45ad32){if(_0x45ad32){return _0x45ad32[_0x4d08('0x80')](_0x4c47c6['body'][_0x4d08('0x69')],_[_0x4d08('0x81')](_0x4c47c6[_0x4d08('0x5b')],[_0x4d08('0x69'),'id'])||{});}})[_0x4d08('0xf')](respondWithResult(_0x2ff058,null))['catch'](handleError(_0x2ff058,null));};exports[_0x4d08('0x82')]=function(_0x3d0e93,_0x379aa2){var _0x5a9eb1={'raw':![],'where':{}};var _0x246fb7={};var _0x179e6d={'count':0x0,'rows':[]};return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x3d0e93['params']['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x379aa2,null))[_0x4d08('0xf')](function(_0x39d9cc){if(_0x39d9cc){_0x246fb7[_0x4d08('0x44')]=_[_0x4d08('0x59')](db[_0x4d08('0x83')][_0x4d08('0x41')]);_0x246fb7[_0x4d08('0x46')]=_['keys'](_0x3d0e93[_0x4d08('0x46')]);_0x246fb7[_0x4d08('0x47')]=_[_0x4d08('0x48')](_0x246fb7[_0x4d08('0x44')],_0x246fb7[_0x4d08('0x46')]);_0x5a9eb1[_0x4d08('0x49')]=_['intersection'](_0x246fb7[_0x4d08('0x44')],qs[_0x4d08('0x4a')](_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x4a')]));_0x5a9eb1[_0x4d08('0x49')]=_0x5a9eb1['attributes'][_0x4d08('0x66')]?_0x5a9eb1[_0x4d08('0x49')]:_0x246fb7[_0x4d08('0x44')];if(!_0x3d0e93['query'][_0x4d08('0x4b')](_0x4d08('0x4c'))){_0x5a9eb1[_0x4d08('0x1f')]=qs[_0x4d08('0x1f')](_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x1f')]);_0x5a9eb1[_0x4d08('0x1c')]=qs[_0x4d08('0x1c')](_0x3d0e93['query'][_0x4d08('0x1c')]);}_0x5a9eb1['order']=qs[_0x4d08('0x4e')](_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x4e')]);_0x5a9eb1[_0x4d08('0x4f')]=qs[_0x4d08('0x47')](_['pick'](_0x3d0e93[_0x4d08('0x46')],_0x246fb7[_0x4d08('0x47')]));_0x5a9eb1['where'][_0x4d08('0x62')]=_0x39d9cc['id'];if(_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x51')]){_0x5a9eb1[_0x4d08('0x4f')]=_[_0x4d08('0x67')](_0x5a9eb1[_0x4d08('0x4f')],{'$or':_[_0x4d08('0x45')](_0x5a9eb1[_0x4d08('0x49')],function(_0x3c5117){var _0x4f6717={};_0x4f6717[_0x3c5117]={'$like':'%'+_0x3d0e93[_0x4d08('0x46')]['filter']+'%'};return _0x4f6717;})});}_0x5a9eb1=_[_0x4d08('0x67')]({},_0x5a9eb1,_0x3d0e93[_0x4d08('0x53')]);return db['MailInteraction'][_0x4d08('0x1e')]({'where':_0x5a9eb1['where']})[_0x4d08('0xf')](function(_0x29e243){_0x179e6d[_0x4d08('0x1e')]=_0x29e243;if(_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x54')]){_0x5a9eb1[_0x4d08('0x55')]=[{'model':db['CmContact'],'as':_0x4d08('0x84'),'required':![]},{'model':db[_0x4d08('0x85')],'as':_0x4d08('0x86'),'attributes':[_0x4d08('0x25'),_0x4d08('0x87'),_0x4d08('0x88')],'required':![]},{'model':db[_0x4d08('0x89')],'as':_0x4d08('0x8a'),'attributes':['id',_0x4d08('0x25'),'color'],'where':_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x8b')]?{'id':_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x8b')]}:undefined,'required':_0x3d0e93[_0x4d08('0x46')][_0x4d08('0x8b')]?!![]:![]}];}return db[_0x4d08('0x83')][_0x4d08('0x56')](_0x5a9eb1);})['then'](function(_0x7c0ff8){_0x179e6d[_0x4d08('0x57')]=_0x7c0ff8;return _0x179e6d;});}})[_0x4d08('0xf')](respondWithFilteredResult(_0x379aa2,_0x5a9eb1))['catch'](handleError(_0x379aa2,null));};exports[_0x4d08('0x8c')]=function addApplications(_0x10fcd0,_0x21259d){var _0x57c18a=_0x10fcd0[_0x4d08('0x5e')]['id'];var _0x599be9=_0x10fcd0['body'];var _0x1c06d7=0xc8;var _0x20c4eb=null;return db[_0x4d08('0x8d')][_0x4d08('0x8e')]({'isolationLevel':db[_0x4d08('0x8d')][_0x4d08('0x8f')][_0x4d08('0x90')][_0x4d08('0x91')]},function(_0x1bec43){return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x57c18a},'transaction':_0x1bec43})[_0x4d08('0xf')](function(_0x44ef43){if(_0x44ef43){return db[_0x4d08('0x92')][_0x4d08('0x23')]({'where':{'MailAccountId':_0x57c18a},'transaction':_0x1bec43})[_0x4d08('0xf')](function(){var _0x2b63da=_[_0x4d08('0x45')](_0x599be9,function(_0x31c526){_0x31c526['MailAccountId']=_0x57c18a;return _0x31c526;});return db['MailApplication'][_0x4d08('0x93')](_0x2b63da,{'transaction':_0x1bec43});});}else{_0x1c06d7=0x194;_0x20c4eb=[];}});})['then'](function(){if(_0x1c06d7!==0x194){return db['MailApplication'][_0x4d08('0x94')]({'where':{'MailAccountId':_0x57c18a},'order':'priority'})[_0x4d08('0xf')](function(_0xc51c0a){_0x20c4eb=_0xc51c0a;});}})[_0x4d08('0x18')](function(_0x3a795b){_0x1c06d7=0x1f4;logger['error'](_0x3a795b[_0x4d08('0x24')]);if(_0x3a795b[_0x4d08('0x25')]){delete _0x3a795b[_0x4d08('0x25')];}_0x20c4eb=_0x3a795b;})['finally'](function(){if(_0x20c4eb===null){_0x21259d[_0x4d08('0x95')](_0x1c06d7);}else{if(_0x1c06d7===0x1f4){_0x21259d[_0x4d08('0x19')](_0x1c06d7)[_0x4d08('0x26')](_0x20c4eb);}else{_0x21259d[_0x4d08('0x19')](_0x1c06d7)[_0x4d08('0x1b')](_0x20c4eb);}}});};exports[_0x4d08('0x96')]=function(_0xfa38d0,_0x3a51ff){var _0x18866b={};var _0x41a4cc={};var _0x1eac57;var _0x21561b;return db[_0x4d08('0x40')]['findOne']({'where':{'id':_0xfa38d0[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x3a51ff,null))[_0x4d08('0xf')](function(_0x414bd1){if(_0x414bd1){_0x1eac57=_0x414bd1;_0x41a4cc[_0x4d08('0x44')]=_[_0x4d08('0x59')](db['MailApplication'][_0x4d08('0x41')]);_0x41a4cc['query']=_['keys'](_0xfa38d0[_0x4d08('0x46')]);_0x41a4cc[_0x4d08('0x47')]=_[_0x4d08('0x48')](_0x41a4cc[_0x4d08('0x44')],_0x41a4cc[_0x4d08('0x46')]);_0x18866b['attributes']=_[_0x4d08('0x48')](_0x41a4cc[_0x4d08('0x44')],qs['fields'](_0xfa38d0[_0x4d08('0x46')][_0x4d08('0x4a')]));_0x18866b['attributes']=_0x18866b['attributes']['length']?_0x18866b[_0x4d08('0x49')]:_0x41a4cc[_0x4d08('0x44')];_0x18866b['order']=qs[_0x4d08('0x4e')](_0xfa38d0[_0x4d08('0x46')][_0x4d08('0x4e')]);_0x18866b[_0x4d08('0x4f')]=qs[_0x4d08('0x47')](_[_0x4d08('0x50')](_0xfa38d0[_0x4d08('0x46')],_0x41a4cc['filters']));if(_0xfa38d0[_0x4d08('0x46')][_0x4d08('0x51')]){_0x18866b[_0x4d08('0x4f')]=_['merge'](_0x18866b[_0x4d08('0x4f')],{'$or':_['map'](_0x18866b[_0x4d08('0x49')],function(_0x320c08){var _0x30895e={};_0x30895e[_0x320c08]={'$like':'%'+_0xfa38d0[_0x4d08('0x46')][_0x4d08('0x51')]+'%'};return _0x30895e;})});}_0x18866b=_[_0x4d08('0x67')]({},_0x18866b,_0xfa38d0[_0x4d08('0x53')]);return _0x1eac57[_0x4d08('0x96')](_0x18866b);}})['then'](function(_0x367d1f){if(_0x367d1f){_0x21561b=_0x367d1f[_0x4d08('0x66')];if(!_0xfa38d0[_0x4d08('0x46')]['hasOwnProperty'](_0x4d08('0x4c'))){_0x18866b[_0x4d08('0x1f')]=qs[_0x4d08('0x1f')](_0xfa38d0[_0x4d08('0x46')][_0x4d08('0x1f')]);_0x18866b[_0x4d08('0x1c')]=qs[_0x4d08('0x1c')](_0xfa38d0[_0x4d08('0x46')][_0x4d08('0x1c')]);}return _0x1eac57[_0x4d08('0x96')](_0x18866b);}})[_0x4d08('0xf')](function(_0x177e48){if(_0x177e48){return _0x177e48?{'count':_0x21561b,'rows':_0x177e48}:null;}})[_0x4d08('0xf')](respondWithResult(_0x3a51ff,null))['catch'](handleError(_0x3a51ff,null));};exports['getMessages']=function(_0x1aff43,_0x4c8b4b){var _0x5d2552={'raw':!![],'where':{}};var _0x46de7a={};var _0x360e6d={'count':0x0,'rows':[]};return db[_0x4d08('0x40')][_0x4d08('0x65')]({'where':{'id':_0x1aff43['params']['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x4c8b4b,null))[_0x4d08('0xf')](function(_0xa9de5c){if(_0xa9de5c){_0x46de7a['model']=_[_0x4d08('0x59')](db[_0x4d08('0x97')]['rawAttributes']);_0x46de7a['query']=_[_0x4d08('0x59')](_0x1aff43['query']);_0x46de7a['filters']=_[_0x4d08('0x48')](_0x46de7a[_0x4d08('0x44')],_0x46de7a[_0x4d08('0x46')]);_0x5d2552[_0x4d08('0x49')]=_[_0x4d08('0x48')](_0x46de7a[_0x4d08('0x44')],qs[_0x4d08('0x4a')](_0x1aff43['query'][_0x4d08('0x4a')]));_0x5d2552[_0x4d08('0x49')]=_0x5d2552[_0x4d08('0x49')][_0x4d08('0x66')]?_0x5d2552[_0x4d08('0x49')]:_0x46de7a[_0x4d08('0x44')];if(!_0x1aff43[_0x4d08('0x46')][_0x4d08('0x4b')](_0x4d08('0x4c'))){_0x5d2552[_0x4d08('0x1f')]=qs[_0x4d08('0x1f')](_0x1aff43[_0x4d08('0x46')]['limit']);_0x5d2552['offset']=qs[_0x4d08('0x1c')](_0x1aff43[_0x4d08('0x46')]['offset']);}_0x5d2552['order']=qs[_0x4d08('0x4e')](_0x1aff43[_0x4d08('0x46')][_0x4d08('0x4e')]);_0x5d2552[_0x4d08('0x4f')]=qs[_0x4d08('0x47')](_[_0x4d08('0x50')](_0x1aff43[_0x4d08('0x46')],_0x46de7a[_0x4d08('0x47')]));_0x5d2552[_0x4d08('0x4f')]['MailAccountId']=_0xa9de5c['id'];if(_0x1aff43[_0x4d08('0x46')][_0x4d08('0x51')]){_0x5d2552['where']=_['merge'](_0x5d2552[_0x4d08('0x4f')],{'$or':_['map'](_0x5d2552['attributes'],function(_0x2ee1ea){var _0x293a4f={};_0x293a4f[_0x2ee1ea]={'$like':'%'+_0x1aff43[_0x4d08('0x46')]['filter']+'%'};return _0x293a4f;})});}if(_0x1aff43[_0x4d08('0x46')][_0x4d08('0x98')]){var _0x1c3f13=_0x1aff43[_0x4d08('0x46')][_0x4d08('0x98')][_0x4d08('0x99')](',');var _0x1d314e={};_0x1d314e[_0x1c3f13[0x0]]={'$gte':moment(_0x1c3f13[0x1])[_0x4d08('0x9a')](_0x4d08('0x9b'))};_0x5d2552[_0x4d08('0x4f')]=_[_0x4d08('0x67')](_0x5d2552[_0x4d08('0x4f')],_0x1d314e);}_0x5d2552=_[_0x4d08('0x67')]({},_0x5d2552,_0x1aff43[_0x4d08('0x53')]);return db[_0x4d08('0x97')][_0x4d08('0x1e')]({'where':_0x5d2552[_0x4d08('0x4f')]})[_0x4d08('0xf')](function(_0x518c8e){_0x360e6d[_0x4d08('0x1e')]=_0x518c8e;if(_0x1aff43['query']['includeAll']){_0x5d2552[_0x4d08('0x55')]=[{'all':!![]}];}return db[_0x4d08('0x97')]['findAll'](_0x5d2552);})[_0x4d08('0xf')](function(_0x4b767a){if(_0x1aff43[_0x4d08('0x46')][_0x4d08('0x9c')]===_0x4d08('0x9d')){for(var _0x5675c3=0x0;_0x5675c3<_0x4b767a[_0x4d08('0x66')];_0x5675c3++){_0x4b767a[_0x5675c3][_0x4d08('0x5b')]=juice(_0x4b767a[_0x5675c3][_0x4d08('0x5b')]);}}_0x360e6d['rows']=_0x4b767a;return _0x360e6d;});}})[_0x4d08('0xf')](respondWithFilteredResult(_0x4c8b4b,_0x5d2552))[_0x4d08('0x18')](handleError(_0x4c8b4b,null));};exports[_0x4d08('0x26')]=function(_0x2ec4b3,_0x1f7bd8){var _0x5c87a4,_0x5a1f56={},_0x111a2c;if(_0x2ec4b3[_0x4d08('0x5b')]['to']){_0x111a2c=_0x2ec4b3[_0x4d08('0x5b')]['to'][_0x4d08('0x99')](',')[0x0];}return db['MailAccount'][_0x4d08('0x5a')]({'where':{'id':_0x2ec4b3[_0x4d08('0x5e')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4d08('0x9e')],'as':'Contacts','where':{'email':_0x111a2c},'limit':0x1,'order':[[_0x4d08('0x9f'),_0x4d08('0xa0')]]}]},{'model':db[_0x4d08('0x3d')],'as':_0x4d08('0x3a'),'raw':!![],'include':[{'model':db[_0x4d08('0xa1')],'as':_0x4d08('0xa1'),'raw':!![]}]}]})[_0x4d08('0xf')](handleEntityNotFound(_0x1f7bd8,null))[_0x4d08('0xf')](function(_0x5bf33f){if(!_0x5bf33f)return;_0x5c87a4=_0x5bf33f;if(!_0x5bf33f[_0x4d08('0x3a')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x4d08('0x71')](_0x2ec4b3['body'][_0x4d08('0xa2')])){_0x2ec4b3['body'][_0x4d08('0xa2')]=util[_0x4d08('0x9a')](_0x4d08('0xa3'),_0x5bf33f[_0x4d08('0x25')],_0x5bf33f[_0x4d08('0x70')]||_0x5bf33f[_0x4d08('0x3a')][_0x4d08('0x2f')]);}if(_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xa4')]&&_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xa4')][_0x4d08('0x66')]){for(var _0x4bff8b=0x0;_0x4bff8b<_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xa4')]['length'];_0x4bff8b+=0x1){_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xa4')][_0x4bff8b]={'filename':_0x2ec4b3['body'][_0x4d08('0xa4')][_0x4bff8b][_0x4d08('0x25')],'path':path[_0x4d08('0xa5')](config['root'],'server/files/attachments',_0x2ec4b3[_0x4d08('0x5b')]['attachments'][_0x4bff8b]['basename'])};}}var _0x4a3895=_0x5bf33f[_0x4d08('0xa6')]();return respondWithRpcPromise(_0x4d08('0xa7'),_0x4d08('0xa8'),{'account':_0x4a3895,'message':_0x2ec4b3[_0x4d08('0x5b')]});})[_0x4d08('0xf')](function(_0x159b01){if(!_0x159b01)return;_0x5a1f56=_0x159b01;if(!_0x5c87a4[_0x4d08('0xa9')])throw new Error(_0x4d08('0xaa'));if(_0x5c87a4['List'][_0x4d08('0xab')][_0x4d08('0x66')])return _0x5c87a4[_0x4d08('0xa9')][_0x4d08('0xab')][0x0];return db[_0x4d08('0x9e')][_0x4d08('0x6c')](_[_0x4d08('0x9')](_0x2ec4b3[_0x4d08('0x5b')],{'firstName':_0x2ec4b3['body']['to'],'email':_0x2ec4b3[_0x4d08('0x5b')]['to'],'phone':_0x2ec4b3[_0x4d08('0x5b')]['to'],'ListId':_0x5c87a4[_0x4d08('0xac')]}));})[_0x4d08('0xf')](function(_0x3f5cbf){if(!_0x3f5cbf)return;var _0x46dcb9={'UserId':_0x2ec4b3['user']['id'],'ContactId':_0x3f5cbf['id'],'MailAccountId':_0x5c87a4['id'],'inReplyTo':_0x5a1f56['messageId'],'to':_0x2ec4b3['body']['from'],'cc':_0x2ec4b3['body']['cc'],'subject':_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xad')],'attach':_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x4d08('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x4d08('0x67')](_0x2ec4b3[_0x4d08('0x5b')],{'messageId':_0x5a1f56['messageId'],'sentAt':moment()['format'](_0x4d08('0x9b')),'read':!![],'MailAccountId':_0x5c87a4['id'],'UserId':_0x2ec4b3[_0x4d08('0x2f')]['id'],'ContactId':_0x3f5cbf['id']})]};if(_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xaf')]){_0x46dcb9=_[_0x4d08('0x67')](_0x46dcb9,_0x2ec4b3[_0x4d08('0x5b')][_0x4d08('0xaf')]);}return db[_0x4d08('0x83')][_0x4d08('0x6c')](_0x46dcb9,{'include':[{'model':db[_0x4d08('0x97')],'as':_0x4d08('0xb0')}]});})['then'](respondWithResult(_0x1f7bd8,null))[_0x4d08('0x18')](handleError(_0x1f7bd8,null));};exports[_0x4d08('0xb1')]=function(_0xadbffa,_0x1c456c){return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0xadbffa[_0x4d08('0x5e')]['id']},'include':[{'model':db[_0x4d08('0x3d')],'as':_0x4d08('0x3a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4d08('0xa1'),'raw':!![]}]}]})[_0x4d08('0xf')](handleEntityNotFound(_0x1c456c,null))[_0x4d08('0xf')](function(_0x5e9873){if(!_0x5e9873[_0x4d08('0x3a')])return;var _0x51d7b4=_0x5e9873[_0x4d08('0xa6')]();return respondWithRpcPromise(_0x4d08('0xb2'),_0x4d08('0xb1'),{'account':_0x51d7b4});})[_0x4d08('0xf')](respondWithResult(_0x1c456c,null))[_0x4d08('0x18')](handleError(_0x1c456c,null));};exports[_0x4d08('0x23')]=function(_0x35a359,_0x3a1ed8){return db[_0x4d08('0x40')]['find']({'where':{'id':_0x35a359['params']['id']}})['then'](handleEntityNotFound(_0x3a1ed8,null))['then'](function(_0x23727a){if(_0x23727a&&_0x23727a[_0x4d08('0x37')]){throw new db[(_0x4d08('0xb3'))]['ValidationError'](_0x4d08('0xb4'));}return _0x23727a;})[_0x4d08('0xf')](removeEntity(_0x3a1ed8,null))[_0x4d08('0x18')](handleError(_0x3a1ed8,null));};exports[_0x4d08('0xb5')]=function(_0x1ab68b,_0x22355b){return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0x1ab68b[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x22355b,null))[_0x4d08('0xf')](function(_0x1efa9c){if(_0x1efa9c){return _0x1efa9c[_0x4d08('0xb5')](_0x1ab68b['body'][_0x4d08('0x69')],_['omit'](_0x1ab68b[_0x4d08('0x5b')],[_0x4d08('0x69'),'id'])||{})[_0x4d08('0xb6')](function(_0x186508){for(var _0x122413=0x0;_0x122413<_0x1ab68b[_0x4d08('0x5b')][_0x4d08('0x69')][_0x4d08('0x66')];_0x122413+=0x1){socket['emit'](_0x4d08('0xb7'),{'UserId':Number(_0x1ab68b[_0x4d08('0x5b')][_0x4d08('0x69')][_0x122413]),'MailAccountId':Number(_0x1ab68b[_0x4d08('0x5e')]['id'])});}return _0x186508;});}})[_0x4d08('0xf')](respondWithResult(_0x22355b,null))['catch'](handleError(_0x22355b,null));};exports[_0x4d08('0xb8')]=function(_0x59bcaf,_0x191323){return db[_0x4d08('0x40')][_0x4d08('0x5a')]({'where':{'id':_0x59bcaf[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x191323,null))['then'](function(_0x31780f){if(_0x31780f){return _0x31780f[_0x4d08('0xb8')](_0x59bcaf[_0x4d08('0x46')][_0x4d08('0x69')])[_0x4d08('0xf')](function(){if(_[_0x4d08('0xb9')](_0x59bcaf[_0x4d08('0x46')][_0x4d08('0x69')])){for(var _0x14269b=0x0;_0x14269b<_0x59bcaf['query'][_0x4d08('0x69')][_0x4d08('0x66')];_0x14269b+=0x1){socket[_0x4d08('0xba')](_0x4d08('0xbb'),{'UserId':Number(_0x59bcaf[_0x4d08('0x46')]['ids'][_0x14269b]),'MailAccountId':Number(_0x59bcaf[_0x4d08('0x5e')]['id'])});}}else{socket['emit'](_0x4d08('0xbb'),{'UserId':Number(_0x59bcaf[_0x4d08('0x46')][_0x4d08('0x69')]),'MailAccountId':Number(_0x59bcaf['params']['id'])});}});}})[_0x4d08('0xf')](respondWithStatusCode(_0x191323,null))[_0x4d08('0x18')](handleError(_0x191323,null));};exports[_0x4d08('0xbc')]=function(_0x597f29,_0x3bda84){var _0x4dd2fd={};var _0x2543a9={};var _0x5ac8bb;var _0x2f29d3;return db['MailAccount'][_0x4d08('0x65')]({'where':{'id':_0x597f29[_0x4d08('0x5e')]['id']}})[_0x4d08('0xf')](handleEntityNotFound(_0x3bda84,null))[_0x4d08('0xf')](function(_0x4e9c10){if(_0x4e9c10){_0x5ac8bb=_0x4e9c10;_0x2543a9['model']=_[_0x4d08('0x59')](db['User'][_0x4d08('0x41')]);_0x2543a9[_0x4d08('0x46')]=_[_0x4d08('0x59')](_0x597f29['query']);_0x2543a9[_0x4d08('0x47')]=_['intersection'](_0x2543a9[_0x4d08('0x44')],_0x2543a9[_0x4d08('0x46')]);_0x4dd2fd[_0x4d08('0x49')]=_[_0x4d08('0x48')](_0x2543a9['model'],qs[_0x4d08('0x4a')](_0x597f29[_0x4d08('0x46')]['fields']));_0x4dd2fd[_0x4d08('0x49')]=_0x4dd2fd[_0x4d08('0x49')][_0x4d08('0x66')]?_0x4dd2fd[_0x4d08('0x49')]:_0x2543a9[_0x4d08('0x44')];_0x4dd2fd[_0x4d08('0x4d')]=qs[_0x4d08('0x4e')](_0x597f29['query']['sort']);_0x4dd2fd[_0x4d08('0x4f')]=qs[_0x4d08('0x47')](_['pick'](_0x597f29['query'],_0x2543a9['filters']));if(_0x597f29[_0x4d08('0x46')][_0x4d08('0x51')]){_0x4dd2fd[_0x4d08('0x4f')]=_['merge'](_0x4dd2fd['where'],{'$or':_['map'](_0x4dd2fd[_0x4d08('0x49')],function(_0x264bcb){var _0xfdf782={};_0xfdf782[_0x264bcb]={'$like':'%'+_0x597f29[_0x4d08('0x46')][_0x4d08('0x51')]+'%'};return _0xfdf782;})});}_0x4dd2fd=_[_0x4d08('0x67')]({},_0x4dd2fd,_0x597f29[_0x4d08('0x53')]);return _0x5ac8bb[_0x4d08('0xbc')](_0x4dd2fd);}})['then'](function(_0x3e566c){if(_0x3e566c){_0x2f29d3=_0x3e566c[_0x4d08('0x66')];if(!_0x597f29[_0x4d08('0x46')][_0x4d08('0x4b')]('nolimit')){_0x4dd2fd[_0x4d08('0x1f')]=qs[_0x4d08('0x1f')](_0x597f29[_0x4d08('0x46')][_0x4d08('0x1f')]);_0x4dd2fd[_0x4d08('0x1c')]=qs[_0x4d08('0x1c')](_0x597f29[_0x4d08('0x46')][_0x4d08('0x1c')]);}return _0x5ac8bb[_0x4d08('0xbc')](_0x4dd2fd);}})['then'](function(_0x1485db){if(_0x1485db){return _0x1485db?{'count':_0x2f29d3,'rows':_0x1485db}:null;}})[_0x4d08('0xf')](respondWithResult(_0x3bda84,null))['catch'](handleError(_0x3bda84,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 963fb91..924fb7e 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 _0x6515=['../../mysqldb','MailAccount','save','update','remove','emit','hook','exports','events'];(function(_0x12fcaa,_0x54a756){var _0x1e4346=function(_0x31a502){while(--_0x31a502){_0x12fcaa['push'](_0x12fcaa['shift']());}};_0x1e4346(++_0x54a756);}(_0x6515,0x1e5));var _0x5651=function(_0x31d59d,_0x2ce0a2){_0x31d59d=_0x31d59d-0x0;var _0x4953fb=_0x6515[_0x31d59d];return _0x4953fb;};'use strict';var EventEmitter=require(_0x5651('0x0'));var MailAccount=require(_0x5651('0x1'))['db'][_0x5651('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5651('0x3'),'afterUpdate':_0x5651('0x4'),'afterDestroy':_0x5651('0x5')};function emitEvent(_0x299ab0){return function(_0x1f4316,_0x188390,_0x27f505){MailAccountEvents[_0x5651('0x6')](_0x299ab0+':'+_0x1f4316['id'],_0x1f4316);MailAccountEvents[_0x5651('0x6')](_0x299ab0,_0x1f4316);_0x27f505(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x5651('0x7')](e,emitEvent(event));}}module[_0x5651('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xc15b=['remove','emit','hook','events','save','update'];(function(_0x29ebe1,_0x1d717f){var _0x57ebce=function(_0x3acea4){while(--_0x3acea4){_0x29ebe1['push'](_0x29ebe1['shift']());}};_0x57ebce(++_0x1d717f);}(_0xc15b,0x159));var _0xbc15=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc15b[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0xbc15('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc15('0x1'),'afterUpdate':_0xbc15('0x2'),'afterDestroy':_0xbc15('0x3')};function emitEvent(_0x2819fd){return function(_0x2c3f99,_0x7d9dc7,_0x3c1cf4){MailAccountEvents[_0xbc15('0x4')](_0x2819fd+':'+_0x2c3f99['id'],_0x2c3f99);MailAccountEvents[_0xbc15('0x4')](_0x2819fd,_0x2c3f99);_0x3c1cf4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xbc15('0x5')](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 9d9cd10..80ae2d2 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 _0x1972=['./mailAccount.attributes','mail_accounts','provider','custom','service','host','port','Smtp','secure','CloudProvider','auth','user','data5','pass'];(function(_0x15eb0e,_0x5e21ac){var _0x4e98e7=function(_0x487f4d){while(--_0x487f4d){_0x15eb0e['push'](_0x15eb0e['shift']());}};_0x4e98e7(++_0x5e21ac);}(_0x1972,0xb6));var _0x2197=function(_0x27aaf3,_0x4de544){_0x27aaf3=_0x27aaf3-0x0;var _0x5a2e47=_0x1972[_0x27aaf3];return _0x5a2e47;};'use strict';var attributes=require(_0x2197('0x0'));module['exports']=function(_0x2dd8e6){return _0x2dd8e6['define']('MailAccount',attributes,{'tableName':_0x2197('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x15ebf7=this;var _0x23fe1a={'id':_0x15ebf7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x15ebf7[_0x2197('0x2')]!==_0x2197('0x3')){_0x23fe1a[_0x2197('0x4')]=_0x15ebf7[_0x2197('0x2')];}else{_0x23fe1a[_0x2197('0x5')]=_0x15ebf7['Smtp'][_0x2197('0x5')];_0x23fe1a[_0x2197('0x6')]=_0x15ebf7[_0x2197('0x7')]['port'];_0x23fe1a['secure']=_0x15ebf7['Smtp'][_0x2197('0x8')];}if(_0x15ebf7[_0x2197('0x7')]['authentication']){if(_0x15ebf7[_0x2197('0x7')]['modernAuthentication']){if(!_0x15ebf7[_0x2197('0x7')][_0x2197('0x9')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x23fe1a[_0x2197('0xa')]={'type':'OAuth2','user':_0x15ebf7[_0x2197('0x7')][_0x2197('0xb')],'accessToken':_0x15ebf7[_0x2197('0x7')][_0x2197('0x9')][_0x2197('0xc')]};}else{_0x23fe1a[_0x2197('0xa')]={'user':_0x15ebf7['Smtp'][_0x2197('0xb')],'pass':_0x15ebf7[_0x2197('0x7')][_0x2197('0xd')]};}}return _0x23fe1a;}}});}; \ No newline at end of file +var _0x6875=['port','secure','Smtp','authentication','modernAuthentication','auth','OAuth2','user','CloudProvider','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','host'];(function(_0x17f716,_0x4a06c7){var _0x31f0de=function(_0x5476e4){while(--_0x5476e4){_0x17f716['push'](_0x17f716['shift']());}};_0x31f0de(++_0x4a06c7);}(_0x6875,0x75));var _0x5687=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6875[_0x3947c9];return _0x2e7871;};'use strict';var attributes=require(_0x5687('0x0'));module[_0x5687('0x1')]=function(_0x2efb94){return _0x2efb94[_0x5687('0x2')](_0x5687('0x3'),attributes,{'tableName':_0x5687('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x33781c=this;var _0x5bf165={'id':_0x33781c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x33781c['provider']!==_0x5687('0x5')){_0x5bf165[_0x5687('0x6')]=_0x33781c[_0x5687('0x7')];}else{_0x5bf165[_0x5687('0x8')]=_0x33781c['Smtp'][_0x5687('0x8')];_0x5bf165['port']=_0x33781c['Smtp'][_0x5687('0x9')];_0x5bf165[_0x5687('0xa')]=_0x33781c[_0x5687('0xb')][_0x5687('0xa')];}if(_0x33781c[_0x5687('0xb')][_0x5687('0xc')]){if(_0x33781c[_0x5687('0xb')][_0x5687('0xd')]){if(!_0x33781c[_0x5687('0xb')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x5bf165[_0x5687('0xe')]={'type':_0x5687('0xf'),'user':_0x33781c[_0x5687('0xb')][_0x5687('0x10')],'accessToken':_0x33781c['Smtp'][_0x5687('0x11')]['data5']};}else{_0x5bf165[_0x5687('0xe')]={'user':_0x33781c[_0x5687('0xb')][_0x5687('0x10')],'pass':_0x33781c[_0x5687('0xb')]['pass']};}}return _0x5bf165;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e72ee45..4dad2ed 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 _0xbd10=['get','interaction','created','attachments','originTo','bcc','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','Start','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','List','omit','applications','Applications','orderBy','asc','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','attach'];(function(_0x4c25ba,_0x50e591){var _0x225109=function(_0x40cb60){while(--_0x40cb60){_0x4c25ba['push'](_0x4c25ba['shift']());}};_0x225109(++_0x50e591);}(_0xbd10,0x85));var _0x0bd1=function(_0x2ac35a,_0x1f68f7){_0x2ac35a=_0x2ac35a-0x0;var _0x40ba19=_0xbd10[_0x2ac35a];return _0x40ba19;};'use strict';var _=require(_0x0bd1('0x0'));var moment=require(_0x0bd1('0x1'));var BPromise=require(_0x0bd1('0x2'));var rs=require('randomstring');var Redis=require(_0x0bd1('0x3'));var db=require(_0x0bd1('0x4'))['db'];var logger=require(_0x0bd1('0x5'))('rpc');var config=require(_0x0bd1('0x6'));var jayson=require(_0x0bd1('0x7'));var client=jayson[_0x0bd1('0x8')][_0x0bd1('0x9')]({'port':0x232c});config[_0x0bd1('0xa')]=_[_0x0bd1('0xb')](config['redis'],{'host':_0x0bd1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd1('0xa')]));require(_0x0bd1('0xd'))[_0x0bd1('0xe')](socket);function respondWithRpcPromise(_0x468e7c,_0x540a32,_0x22b38f){return new BPromise(function(_0x631d20,_0x6e9f80){return client[_0x0bd1('0xf')](_0x468e7c,_0x22b38f)[_0x0bd1('0x10')](function(_0x216523){logger['info'](_0x0bd1('0x11'),_0x540a32,_0x0bd1('0x12'));logger[_0x0bd1('0x13')](_0x0bd1('0x14'),_0x540a32,_0x0bd1('0x12'),JSON[_0x0bd1('0x15')](_0x216523));if(_0x216523['error']){if(_0x216523[_0x0bd1('0x16')][_0x0bd1('0x17')]===0x1f4){logger[_0x0bd1('0x16')]('MailAccount,\x20%s,\x20%s',_0x540a32,_0x216523['error'][_0x0bd1('0x18')]);return _0x6e9f80(_0x216523[_0x0bd1('0x16')][_0x0bd1('0x18')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x540a32,_0x216523[_0x0bd1('0x16')][_0x0bd1('0x18')]);return _0x631d20(_0x216523[_0x0bd1('0x16')]['message']);}else{logger[_0x0bd1('0x19')](_0x0bd1('0x11'),_0x540a32,_0x0bd1('0x12'));_0x631d20(_0x216523[_0x0bd1('0x1a')]['message']);}})[_0x0bd1('0x1b')](function(_0x3d1170){logger['error'](_0x0bd1('0x11'),_0x540a32,_0x3d1170);_0x6e9f80(_0x3d1170);});});}exports[_0x0bd1('0x1c')]=function(_0x59d106){var _0x503b57=this;return new Promise(function(_0x5ab684,_0x134431){return db[_0x0bd1('0x1d')][_0x0bd1('0x1e')]({'raw':_0x59d106[_0x0bd1('0x1f')]?_0x59d106[_0x0bd1('0x1f')][_0x0bd1('0x20')]===undefined?!![]:![]:!![],'where':_0x59d106[_0x0bd1('0x1f')]?_0x59d106['options'][_0x0bd1('0x21')]||null:null,'attributes':_0x59d106[_0x0bd1('0x1f')]?_0x59d106[_0x0bd1('0x1f')][_0x0bd1('0x22')]||null:null,'limit':_0x59d106[_0x0bd1('0x1f')]?_0x59d106['options'][_0x0bd1('0x23')]||null:null,'include':_0x59d106['options']?_0x59d106['options'][_0x0bd1('0x24')]?_[_0x0bd1('0x25')](_0x59d106[_0x0bd1('0x1f')][_0x0bd1('0x24')],function(_0x237f4a){return{'model':db[_0x237f4a[_0x0bd1('0x26')]],'as':_0x237f4a['as'],'attributes':_0x237f4a[_0x0bd1('0x22')],'include':_0x237f4a[_0x0bd1('0x24')]?_[_0x0bd1('0x25')](_0x237f4a['include'],function(_0x5cb236){return{'model':db[_0x5cb236[_0x0bd1('0x26')]],'as':_0x5cb236['as'],'attributes':_0x5cb236['attributes'],'include':_0x5cb236[_0x0bd1('0x24')]?_[_0x0bd1('0x25')](_0x5cb236['include'],function(_0x5423a7){return{'model':db[_0x5423a7['model']],'as':_0x5423a7['as'],'attributes':_0x5423a7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4616b9){logger[_0x0bd1('0x19')](_0x0bd1('0x1c'),_0x59d106);logger['debug'](_0x0bd1('0x1c'),_0x59d106,JSON[_0x0bd1('0x15')](_0x4616b9));_0x5ab684(_0x4616b9);})['catch'](function(_0x49debf){logger[_0x0bd1('0x16')]('GetMailAccount',_0x49debf['message'],_0x59d106);_0x134431(_0x503b57['error'](0x1f4,_0x49debf[_0x0bd1('0x18')]));});});};exports[_0x0bd1('0x27')]=function(_0x12e9bb){var _0x534abf=this;return new Promise(function(_0x62b713,_0x2cd5c0){return db['MailAccount']['find']({'raw':_0x12e9bb[_0x0bd1('0x1f')]?_0x12e9bb['options'][_0x0bd1('0x20')]===undefined?!![]:![]:!![],'where':_0x12e9bb[_0x0bd1('0x1f')]?_0x12e9bb['options'][_0x0bd1('0x21')]||null:null,'attributes':_0x12e9bb[_0x0bd1('0x1f')]?_0x12e9bb[_0x0bd1('0x1f')]['attributes']||null:null,'include':_0x12e9bb[_0x0bd1('0x1f')]?_0x12e9bb['options'][_0x0bd1('0x24')]?_[_0x0bd1('0x25')](_0x12e9bb[_0x0bd1('0x1f')][_0x0bd1('0x24')],function(_0x484195){return{'model':db[_0x484195[_0x0bd1('0x26')]],'as':_0x484195['as'],'attributes':_0x484195[_0x0bd1('0x22')],'include':_0x484195[_0x0bd1('0x24')]?_[_0x0bd1('0x25')](_0x484195[_0x0bd1('0x24')],function(_0x24943a){return{'model':db[_0x24943a[_0x0bd1('0x26')]],'as':_0x24943a['as'],'attributes':_0x24943a['attributes'],'include':_0x24943a[_0x0bd1('0x24')]?_[_0x0bd1('0x25')](_0x24943a['include'],function(_0x224159){return{'model':db[_0x224159[_0x0bd1('0x26')]],'as':_0x224159['as'],'attributes':_0x224159[_0x0bd1('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0bd1('0x10')](function(_0x1008e3){if(_0x12e9bb[_0x0bd1('0x1f')][_0x0bd1('0x28')]===!![])_0x1008e3[_0x0bd1('0x29')](_0x0bd1('0x2a'),_0x1008e3[_0x0bd1('0x2b')]());logger[_0x0bd1('0x19')](_0x0bd1('0x27'),_0x12e9bb);logger[_0x0bd1('0x13')](_0x0bd1('0x27'),_0x12e9bb,JSON[_0x0bd1('0x15')](_0x1008e3));_0x62b713(_0x1008e3);})[_0x0bd1('0x1b')](function(_0x3d858e){logger[_0x0bd1('0x16')]('ShowMailAccount',_0x3d858e['message'],_0x12e9bb);_0x2cd5c0(_0x534abf[_0x0bd1('0x16')](0x1f4,_0x3d858e[_0x0bd1('0x18')]));});});};exports[_0x0bd1('0x2c')]=function(_0x2446d3){var _0x316c37=this;return new Promise(function(_0x5fcd17,_0x4f00e7){var _0x55415c={'body':_0x2446d3[_0x0bd1('0x2d')],'channel':_0x0bd1('0x2e')};var _0x22c0b2=_[_0x0bd1('0x2f')](_['keys'](db[_0x0bd1('0x30')]['rawAttributes']),[_0x0bd1('0x31'),'updatedAt',_0x0bd1('0x32'),_0x0bd1('0x33')]);var _0x32cff5=![];if(_0x2446d3[_0x0bd1('0x2d')]['id']){delete _0x2446d3['body']['id'];}if(_[_0x0bd1('0x34')](_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x35')])){return _0x4f00e7(_0x316c37['error'](0x1f4,_0x0bd1('0x36')));}if(_[_0x0bd1('0x34')](_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x2d')])||_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x2d')]===''){return _0x4f00e7(_0x316c37[_0x0bd1('0x16')](0x1f4,_0x0bd1('0x37')));}if(_[_0x0bd1('0x34')](_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x38')])){return _0x4f00e7(_0x316c37['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22c0b2));}if(!_[_0x0bd1('0x39')](_0x22c0b2,_0x2446d3['body'][_0x0bd1('0x38')])){return _0x4f00e7(_0x316c37['error'](0x1f4,_0x0bd1('0x3a')+_0x22c0b2));}var _0x1b6f2b={};_0x1b6f2b[_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x38')]]=_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x35')];return db[_0x0bd1('0x1d')][_0x0bd1('0x3b')]({'where':{'id':_0x2446d3[_0x0bd1('0x3c')]['id']},'include':[{'model':db[_0x0bd1('0x3d')],'as':'List','include':[{'model':db[_0x0bd1('0x30')],'as':_0x0bd1('0x3e'),'where':_0x1b6f2b,'limit':0x1,'order':[[_0x0bd1('0x3f'),_0x0bd1('0x40')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x0bd1('0x41')],'as':_0x0bd1('0x42'),'include':[{'model':db[_0x0bd1('0x43')],'as':'CloudProvider'}]}]})[_0x0bd1('0x10')](function(_0x2cf6cb){if(_0x2cf6cb&&_0x2cf6cb[_0x0bd1('0x44')]){var _0x1c5299=_0x2cf6cb['get']({'plain':!![]});_0x55415c['account']=_[_0x0bd1('0x45')](_0x1c5299,['Applications',_0x0bd1('0x44')]);_0x55415c['account'][_0x0bd1('0x2a')]=_0x2cf6cb['getSmtpOptions']();_0x55415c[_0x0bd1('0x46')]=_0x1c5299[_0x0bd1('0x47')];_0x55415c['list']=_0x1c5299['List'];_0x55415c[_0x0bd1('0x46')]=_[_0x0bd1('0x48')](_0x55415c['applications'],['priority'],[_0x0bd1('0x49')]);if(_0x55415c[_0x0bd1('0x3c')]&&_0x55415c[_0x0bd1('0x3c')]['autoclose']){_0x55415c['applications'][_0x0bd1('0x4a')]({'id':0x0,'priority':_0x55415c[_0x0bd1('0x46')][_0x0bd1('0x4b')]+0x1,'app':_0x0bd1('0x4c'),'appdata':'autoclose','interval':_0x0bd1('0x4d')});}if(_0x55415c['account']['Applications']){delete _0x55415c[_0x0bd1('0x3c')]['Applications'];}if(_0x55415c[_0x0bd1('0x3c')]['List']){delete _0x55415c['account'][_0x0bd1('0x44')];}if(_0x1c5299[_0x0bd1('0x44')][_0x0bd1('0x3e')]['length']){return _0x1c5299[_0x0bd1('0x44')]['Contacts'][0x0];}var _0x2a6d46=_['defaults'](_0x2446d3['body'],{'firstName':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x35')],'ListId':_0x1c5299['ListId']});_0x2a6d46[_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x38')]]=_0x2446d3['body'][_0x0bd1('0x35')];return db[_0x0bd1('0x30')][_0x0bd1('0x4e')](_0x2a6d46);}else{throw new Error(_0x0bd1('0x4f'));}})[_0x0bd1('0x10')](function(_0x254f5b){_0x55415c[_0x0bd1('0x50')]=_0x254f5b;if(_0x254f5b){if(!_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x51')]){_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x51')]=rs[_0x0bd1('0x52')]()+'\x20'+_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')]['from'];}var _0x5b2845={'ContactId':_0x254f5b['id'],'MailAccountId':_0x2446d3[_0x0bd1('0x3c')]['id'],'inReplyTo':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x51')],'to':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x35')],'cc':_0x2446d3['body']['message']['cc'],'subject':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x53')],'attach':_0x2446d3[_0x0bd1('0x2d')]['message']['attach'],'lastMsgAt':moment()[_0x0bd1('0x54')](_0x0bd1('0x55')),'lastMsgDirection':'in'};return db[_0x0bd1('0x56')][_0x0bd1('0x3b')]({'where':{'closed':![],'MailAccountId':_0x2446d3[_0x0bd1('0x3c')]['id']},'include':[{'model':db[_0x0bd1('0x57')],'as':'Messages','attributes':[_0x0bd1('0x51')],'where':{'messageId':_0x2446d3['body'][_0x0bd1('0x18')][_0x0bd1('0x58')]}}]})[_0x0bd1('0x10')](function(_0x249cde){if(_0x249cde){return[_0x249cde,![]];}return db[_0x0bd1('0x56')][_0x0bd1('0x4e')](_0x5b2845)[_0x0bd1('0x10')](function(_0x4e3067){return[_0x4e3067,!![]];});});}else{throw new Error(_0x0bd1('0x59'));}})[_0x0bd1('0x5a')](function(_0x17b3ba,_0x4c05e7){if(_0x17b3ba){_0x32cff5=_0x4c05e7;if(!_0x4c05e7){return _0x17b3ba[_0x0bd1('0x5b')]({'inReplyTo':_0x2446d3[_0x0bd1('0x2d')]['message']['messageId'],'to':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')]['from'],'cc':_0x2446d3[_0x0bd1('0x2d')]['message']['cc'],'subject':_0x2446d3[_0x0bd1('0x2d')]['message'][_0x0bd1('0x53')],'attach':_0x17b3ba[_0x0bd1('0x5c')]?_0x17b3ba[_0x0bd1('0x5c')]:_0x2446d3[_0x0bd1('0x2d')]['message'][_0x0bd1('0x5c')],'substatus':null,'substatusAt':moment()[_0x0bd1('0x54')](_0x0bd1('0x55')),'lastMsgAt':moment()['format'](_0x0bd1('0x55')),'lastMsgDirection':'in'});}else{return _0x17b3ba;}}})[_0x0bd1('0x10')](function(_0x53d77c){_0x55415c['interaction']=_0x53d77c[_0x0bd1('0x5d')]({'plain':!![]});_0x55415c[_0x0bd1('0x5e')][_0x0bd1('0x5f')]=_0x32cff5;return db[_0x0bd1('0x57')]['create']({'body':_0x2446d3['body'][_0x0bd1('0x2d')],'MailAccountId':_0x2446d3[_0x0bd1('0x3c')]['id'],'MailInteractionId':_0x53d77c['id'],'direction':'in','ContactId':_0x55415c['contact']['id'],'messageId':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x51')],'from':_0x2446d3[_0x0bd1('0x2d')]['message']['from'],'to':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')]['to'],'cc':_0x2446d3[_0x0bd1('0x2d')]['message']['cc'],'subject':_0x2446d3['body']['message'][_0x0bd1('0x53')],'attach':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x5c')],'Attachments':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x60')],'originTo':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')][_0x0bd1('0x61')],'originCc':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')]['originCc'],'bcc':_0x2446d3[_0x0bd1('0x2d')]['message'][_0x0bd1('0x62')],'ChatWebsiteId':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')]['ChatWebsiteId']||null,'originChannel':_0x2446d3[_0x0bd1('0x2d')]['message'][_0x0bd1('0x63')]||_0x0bd1('0x64'),'ChatOfflineMessageId':_0x2446d3[_0x0bd1('0x2d')][_0x0bd1('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0bd1('0x65')],'as':_0x0bd1('0x66')}]});})[_0x0bd1('0x10')](function(_0x459408){_0x55415c[_0x0bd1('0x18')]=_0x459408;if(!_0x55415c[_0x0bd1('0x5e')][_0x0bd1('0x67')]){return;}return db[_0x0bd1('0x68')][_0x0bd1('0x3b')]({'attributes':['id',_0x0bd1('0x69')],'where':{'id':_0x55415c[_0x0bd1('0x5e')][_0x0bd1('0x67')]}});})[_0x0bd1('0x10')](function(_0x115fdb){if(_0x115fdb){_0x55415c[_0x0bd1('0x46')][_0x0bd1('0x6a')]({'id':0x0,'priority':0x0,'app':_0x0bd1('0x6b'),'appdata':_0x115fdb['name']+','+(_0x55415c[_0x0bd1('0x3c')][_0x0bd1('0x6c')]||0xa),'interval':_0x0bd1('0x4d')});}if(!_0x55415c[_0x0bd1('0x5e')][_0x0bd1('0x6d')]){return;}return db[_0x0bd1('0x6e')][_0x0bd1('0x3b')]({'attributes':['id','name'],'where':{'id':_0x55415c['interaction'][_0x0bd1('0x6d')]}});})[_0x0bd1('0x10')](function(_0x1f8c2a){if(_0x1f8c2a){_0x55415c[_0x0bd1('0x46')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0bd1('0x6f'),'appdata':_0x1f8c2a[_0x0bd1('0x69')]+','+(_0x55415c[_0x0bd1('0x3c')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0bd1('0x70'),'startRouting',_0x55415c);})[_0x0bd1('0x10')](function(_0x18cc47){_0x5fcd17(_0x18cc47);})[_0x0bd1('0x1b')](function(_0xb1361c){_0x4f00e7(_0x316c37[_0x0bd1('0x16')](0x1f4,_0xb1361c[_0x0bd1('0x18')]));});});}; \ No newline at end of file +var _0x4873=['format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','contact','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailAccount','findAll','options','where','attributes','limit','map','include','model','then','GetMailAccount','ShowMailAccount','raw','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','CmContact','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','get','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','ListId','create','List\x20not\x20found','messageId','subject','attach'];(function(_0xefcea5,_0xfa12b5){var _0x36764c=function(_0x5c93bc){while(--_0x5c93bc){_0xefcea5['push'](_0xefcea5['shift']());}};_0x36764c(++_0xfa12b5);}(_0x4873,0x1df));var _0x3487=function(_0x526713,_0x16b178){_0x526713=_0x526713-0x0;var _0x47a20f=_0x4873[_0x526713];return _0x47a20f;};'use strict';var _=require(_0x3487('0x0'));var moment=require(_0x3487('0x1'));var BPromise=require(_0x3487('0x2'));var rs=require('randomstring');var Redis=require(_0x3487('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x3487('0x4'));var config=require(_0x3487('0x5'));var jayson=require(_0x3487('0x6'));var client=jayson[_0x3487('0x7')][_0x3487('0x8')]({'port':0x232c});config[_0x3487('0x9')]=_[_0x3487('0xa')](config[_0x3487('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3487('0xb'))(new Redis(config[_0x3487('0x9')]));require(_0x3487('0xc'))[_0x3487('0xd')](socket);function respondWithRpcPromise(_0x17b90c,_0x5a50e8,_0x365727){return new BPromise(function(_0x5e2cca,_0x1a5a7a){return client[_0x3487('0xe')](_0x17b90c,_0x365727)['then'](function(_0x56b795){logger[_0x3487('0xf')](_0x3487('0x10'),_0x5a50e8,'request\x20sent');logger[_0x3487('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5a50e8,'request\x20sent',JSON[_0x3487('0x12')](_0x56b795));if(_0x56b795[_0x3487('0x13')]){if(_0x56b795[_0x3487('0x13')][_0x3487('0x14')]===0x1f4){logger[_0x3487('0x13')](_0x3487('0x10'),_0x5a50e8,_0x56b795['error'][_0x3487('0x15')]);return _0x1a5a7a(_0x56b795[_0x3487('0x13')][_0x3487('0x15')]);}logger['error'](_0x3487('0x10'),_0x5a50e8,_0x56b795[_0x3487('0x13')][_0x3487('0x15')]);return _0x5e2cca(_0x56b795[_0x3487('0x13')][_0x3487('0x15')]);}else{logger[_0x3487('0xf')](_0x3487('0x10'),_0x5a50e8,_0x3487('0x16'));_0x5e2cca(_0x56b795[_0x3487('0x17')][_0x3487('0x15')]);}})[_0x3487('0x18')](function(_0x41795b){logger[_0x3487('0x13')](_0x3487('0x10'),_0x5a50e8,_0x41795b);_0x1a5a7a(_0x41795b);});});}exports['GetMailAccount']=function(_0x320349){var _0x594ff6=this;return new Promise(function(_0x2fd2e8,_0x20eae9){return db[_0x3487('0x19')][_0x3487('0x1a')]({'raw':_0x320349[_0x3487('0x1b')]?_0x320349[_0x3487('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x320349[_0x3487('0x1b')]?_0x320349[_0x3487('0x1b')][_0x3487('0x1c')]||null:null,'attributes':_0x320349[_0x3487('0x1b')]?_0x320349[_0x3487('0x1b')][_0x3487('0x1d')]||null:null,'limit':_0x320349['options']?_0x320349[_0x3487('0x1b')][_0x3487('0x1e')]||null:null,'include':_0x320349[_0x3487('0x1b')]?_0x320349['options']['include']?_[_0x3487('0x1f')](_0x320349[_0x3487('0x1b')][_0x3487('0x20')],function(_0x3a9d76){return{'model':db[_0x3a9d76['model']],'as':_0x3a9d76['as'],'attributes':_0x3a9d76[_0x3487('0x1d')],'include':_0x3a9d76[_0x3487('0x20')]?_['map'](_0x3a9d76[_0x3487('0x20')],function(_0x3fb245){return{'model':db[_0x3fb245['model']],'as':_0x3fb245['as'],'attributes':_0x3fb245['attributes'],'include':_0x3fb245[_0x3487('0x20')]?_[_0x3487('0x1f')](_0x3fb245[_0x3487('0x20')],function(_0x23a76e){return{'model':db[_0x23a76e[_0x3487('0x21')]],'as':_0x23a76e['as'],'attributes':_0x23a76e[_0x3487('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3487('0x22')](function(_0x38af4a){logger[_0x3487('0xf')](_0x3487('0x23'),_0x320349);logger[_0x3487('0x11')]('GetMailAccount',_0x320349,JSON['stringify'](_0x38af4a));_0x2fd2e8(_0x38af4a);})[_0x3487('0x18')](function(_0x56ee54){logger['error'](_0x3487('0x23'),_0x56ee54[_0x3487('0x15')],_0x320349);_0x20eae9(_0x594ff6['error'](0x1f4,_0x56ee54['message']));});});};exports[_0x3487('0x24')]=function(_0x3a89ba){var _0x46df42=this;return new Promise(function(_0x531dd3,_0x3bb44f){return db['MailAccount']['find']({'raw':_0x3a89ba['options']?_0x3a89ba[_0x3487('0x1b')][_0x3487('0x25')]===undefined?!![]:![]:!![],'where':_0x3a89ba['options']?_0x3a89ba['options'][_0x3487('0x1c')]||null:null,'attributes':_0x3a89ba['options']?_0x3a89ba['options'][_0x3487('0x1d')]||null:null,'include':_0x3a89ba[_0x3487('0x1b')]?_0x3a89ba[_0x3487('0x1b')]['include']?_[_0x3487('0x1f')](_0x3a89ba[_0x3487('0x1b')][_0x3487('0x20')],function(_0x27c28f){return{'model':db[_0x27c28f['model']],'as':_0x27c28f['as'],'attributes':_0x27c28f[_0x3487('0x1d')],'include':_0x27c28f[_0x3487('0x20')]?_['map'](_0x27c28f[_0x3487('0x20')],function(_0x325a3a){return{'model':db[_0x325a3a[_0x3487('0x21')]],'as':_0x325a3a['as'],'attributes':_0x325a3a[_0x3487('0x1d')],'include':_0x325a3a[_0x3487('0x20')]?_[_0x3487('0x1f')](_0x325a3a[_0x3487('0x20')],function(_0x299172){return{'model':db[_0x299172[_0x3487('0x21')]],'as':_0x299172['as'],'attributes':_0x299172['attributes']};}):[]};}):[]};}):[]:[]})[_0x3487('0x22')](function(_0x3c9fa6){if(_0x3a89ba['options']['smtp']===!![])_0x3c9fa6[_0x3487('0x26')](_0x3487('0x27'),_0x3c9fa6[_0x3487('0x28')]());logger['info']('ShowMailAccount',_0x3a89ba);logger['debug'](_0x3487('0x24'),_0x3a89ba,JSON[_0x3487('0x12')](_0x3c9fa6));_0x531dd3(_0x3c9fa6);})['catch'](function(_0xbd0668){logger[_0x3487('0x13')](_0x3487('0x24'),_0xbd0668[_0x3487('0x15')],_0x3a89ba);_0x3bb44f(_0x46df42[_0x3487('0x13')](0x1f4,_0xbd0668[_0x3487('0x15')]));});});};exports[_0x3487('0x29')]=function(_0xc2e2ab){var _0x3cb013=this;return new Promise(function(_0x565cb2,_0x5c4f06){var _0x24a4ec={'body':_0xc2e2ab['body'],'channel':'mail'};var _0x8bb8c2=_['difference'](_['keys'](db[_0x3487('0x2a')]['rawAttributes']),['createdAt',_0x3487('0x2b'),_0x3487('0x2c'),'ListId']);var _0x51b69c=![];if(_0xc2e2ab[_0x3487('0x2d')]['id']){delete _0xc2e2ab[_0x3487('0x2d')]['id'];}if(_['isNil'](_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2e')])){return _0x5c4f06(_0x3cb013['error'](0x1f4,_0x3487('0x2f')));}if(_[_0x3487('0x30')](_0xc2e2ab[_0x3487('0x2d')]['body'])||_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2d')]===''){return _0x5c4f06(_0x3cb013[_0x3487('0x13')](0x1f4,_0x3487('0x31')));}if(_[_0x3487('0x30')](_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x32')])){return _0x5c4f06(_0x3cb013[_0x3487('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x8bb8c2));}if(!_[_0x3487('0x33')](_0x8bb8c2,_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x32')])){return _0x5c4f06(_0x3cb013[_0x3487('0x13')](0x1f4,_0x3487('0x34')+_0x8bb8c2));}var _0x31e766={};_0x31e766[_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x32')]]=_0xc2e2ab['body']['from'];return db[_0x3487('0x19')][_0x3487('0x35')]({'where':{'id':_0xc2e2ab[_0x3487('0x36')]['id']},'include':[{'model':db[_0x3487('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3487('0x38'),'where':_0x31e766,'limit':0x1,'order':[[_0x3487('0x2b'),_0x3487('0x39')]]}]},{'model':db[_0x3487('0x3a')],'as':_0x3487('0x3b')},{'model':db[_0x3487('0x3c')],'as':_0x3487('0x3d'),'include':[{'model':db[_0x3487('0x3e')],'as':'CloudProvider'}]}]})['then'](function(_0x320351){if(_0x320351&&_0x320351[_0x3487('0x3f')]){var _0x58e50c=_0x320351[_0x3487('0x40')]({'plain':!![]});_0x24a4ec['account']=_['omit'](_0x58e50c,[_0x3487('0x3b'),_0x3487('0x3f')]);_0x24a4ec['account'][_0x3487('0x27')]=_0x320351[_0x3487('0x28')]();_0x24a4ec[_0x3487('0x41')]=_0x58e50c['Applications'];_0x24a4ec[_0x3487('0x42')]=_0x58e50c[_0x3487('0x3f')];_0x24a4ec[_0x3487('0x41')]=_[_0x3487('0x43')](_0x24a4ec['applications'],[_0x3487('0x44')],[_0x3487('0x45')]);if(_0x24a4ec[_0x3487('0x36')]&&_0x24a4ec[_0x3487('0x36')][_0x3487('0x46')]){_0x24a4ec[_0x3487('0x41')][_0x3487('0x47')]({'id':0x0,'priority':_0x24a4ec['applications'][_0x3487('0x48')]+0x1,'app':_0x3487('0x49'),'appdata':'autoclose','interval':_0x3487('0x4a')});}if(_0x24a4ec[_0x3487('0x36')][_0x3487('0x3b')]){delete _0x24a4ec[_0x3487('0x36')][_0x3487('0x3b')];}if(_0x24a4ec[_0x3487('0x36')][_0x3487('0x3f')]){delete _0x24a4ec[_0x3487('0x36')][_0x3487('0x3f')];}if(_0x58e50c[_0x3487('0x3f')]['Contacts'][_0x3487('0x48')]){return _0x58e50c[_0x3487('0x3f')][_0x3487('0x38')][0x0];}var _0x478b67=_[_0x3487('0xa')](_0xc2e2ab[_0x3487('0x2d')],{'firstName':_0xc2e2ab['body'][_0x3487('0x2e')],'ListId':_0x58e50c[_0x3487('0x4b')]});_0x478b67[_0xc2e2ab['body']['mapKey']]=_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2e')];return db[_0x3487('0x2a')][_0x3487('0x4c')](_0x478b67);}else{throw new Error(_0x3487('0x4d'));}})[_0x3487('0x22')](function(_0x4fac20){_0x24a4ec['contact']=_0x4fac20;if(_0x4fac20){if(!_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['messageId']){_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4e')]=rs['generate']()+'\x20'+_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['from'];}var _0x504fac={'ContactId':_0x4fac20['id'],'MailAccountId':_0xc2e2ab[_0x3487('0x36')]['id'],'inReplyTo':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4e')],'to':_0xc2e2ab['body'][_0x3487('0x15')][_0x3487('0x2e')],'cc':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['cc'],'subject':_0xc2e2ab['body']['message'][_0x3487('0x4f')],'attach':_0xc2e2ab['body'][_0x3487('0x15')][_0x3487('0x50')],'lastMsgAt':moment()[_0x3487('0x51')](_0x3487('0x52')),'lastMsgDirection':'in'};return db[_0x3487('0x53')][_0x3487('0x35')]({'where':{'closed':![],'MailAccountId':_0xc2e2ab[_0x3487('0x36')]['id']},'include':[{'model':db[_0x3487('0x54')],'as':_0x3487('0x55'),'attributes':[_0x3487('0x4e')],'where':{'messageId':_0xc2e2ab[_0x3487('0x2d')]['message'][_0x3487('0x56')]}}]})[_0x3487('0x22')](function(_0x57b0e4){if(_0x57b0e4){return[_0x57b0e4,![]];}return db[_0x3487('0x53')]['create'](_0x504fac)['then'](function(_0x2e724d){return[_0x2e724d,!![]];});});}else{throw new Error(_0x3487('0x57'));}})[_0x3487('0x58')](function(_0x177fc0,_0x3d47c3){if(_0x177fc0){_0x51b69c=_0x3d47c3;if(!_0x3d47c3){return _0x177fc0[_0x3487('0x59')]({'inReplyTo':_0xc2e2ab[_0x3487('0x2d')]['message'][_0x3487('0x4e')],'to':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x2e')],'cc':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['cc'],'subject':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4f')],'attach':_0x177fc0[_0x3487('0x50')]?_0x177fc0['attach']:_0xc2e2ab['body'][_0x3487('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x3487('0x51')](_0x3487('0x52')),'lastMsgAt':moment()[_0x3487('0x51')](_0x3487('0x52')),'lastMsgDirection':'in'});}else{return _0x177fc0;}}})['then'](function(_0x17ac4a){_0x24a4ec[_0x3487('0x5a')]=_0x17ac4a[_0x3487('0x40')]({'plain':!![]});_0x24a4ec[_0x3487('0x5a')][_0x3487('0x5b')]=_0x51b69c;return db[_0x3487('0x54')]['create']({'body':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2d')],'MailAccountId':_0xc2e2ab['account']['id'],'MailInteractionId':_0x17ac4a['id'],'direction':'in','ContactId':_0x24a4ec[_0x3487('0x5c')]['id'],'messageId':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4e')],'from':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x2e')],'to':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['to'],'cc':_0xc2e2ab[_0x3487('0x2d')]['message']['cc'],'subject':_0xc2e2ab[_0x3487('0x2d')]['message']['subject'],'attach':_0xc2e2ab[_0x3487('0x2d')]['message'][_0x3487('0x50')],'Attachments':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['attachments'],'originTo':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x5d')],'originCc':_0xc2e2ab['body'][_0x3487('0x15')][_0x3487('0x5e')],'bcc':_0xc2e2ab[_0x3487('0x2d')]['message']['bcc'],'ChatWebsiteId':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x5f')]||null,'originChannel':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x60')]||_0x3487('0x61'),'ChatOfflineMessageId':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x62')]||null},{'include':[{'model':db[_0x3487('0x63')],'as':_0x3487('0x64')}]});})[_0x3487('0x22')](function(_0x3d26eb){_0x24a4ec[_0x3487('0x15')]=_0x3d26eb;if(!_0x24a4ec[_0x3487('0x5a')][_0x3487('0x65')]){return;}return db[_0x3487('0x66')][_0x3487('0x35')]({'attributes':['id','name'],'where':{'id':_0x24a4ec[_0x3487('0x5a')][_0x3487('0x65')]}});})[_0x3487('0x22')](function(_0x9bbb2e){if(_0x9bbb2e){_0x24a4ec[_0x3487('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9bbb2e[_0x3487('0x67')]+','+(_0x24a4ec[_0x3487('0x36')][_0x3487('0x68')]||0xa),'interval':_0x3487('0x4a')});}if(!_0x24a4ec[_0x3487('0x5a')][_0x3487('0x69')]){return;}return db[_0x3487('0x6a')]['find']({'attributes':['id',_0x3487('0x67')],'where':{'id':_0x24a4ec['interaction']['queueId']}});})[_0x3487('0x22')](function(_0x20ba2b){if(_0x20ba2b){_0x24a4ec[_0x3487('0x41')][_0x3487('0x6b')]({'id':0x0,'priority':0x1,'app':_0x3487('0x6c'),'appdata':_0x20ba2b[_0x3487('0x67')]+','+(_0x24a4ec[_0x3487('0x36')][_0x3487('0x6d')]||0x12c),'interval':_0x3487('0x4a')});}return respondWithRpcPromise(_0x3487('0x6e'),_0x3487('0x6f'),_0x24a4ec);})[_0x3487('0x22')](function(_0xd45305){_0x565cb2(_0xd45305);})[_0x3487('0x18')](function(_0x178b4f){_0x5c4f06(_0x3cb013['error'](0x1f4,_0x178b4f[_0x3487('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 312c631..afd1e67 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 _0x9464=['update','emit','removeListener','register','length','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9464,0xd7));var _0x4946=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x9464[_0x252328];return _0xaa85b7;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x4946('0x0'),'remove',_0x4946('0x1')];function createListener(_0x310d55,_0x3758a7){return function(_0x28f641){_0x3758a7[_0x4946('0x2')](_0x310d55,_0x28f641);};}function removeListener(_0x421600,_0x474838){return function(){MailAccountEvents[_0x4946('0x3')](_0x421600,_0x474838);};}exports[_0x4946('0x4')]=function(_0x182e5b){for(var _0x39c0f6=0x0,_0x34015d=events[_0x4946('0x5')];_0x39c0f6<_0x34015d;_0x39c0f6++){var _0x55e3bd=events[_0x39c0f6];var _0x45f06b=createListener('mailAccount:'+_0x55e3bd,_0x182e5b);MailAccountEvents['on'](_0x55e3bd,_0x45f06b);}}; \ No newline at end of file +var _0xfe13=['./mailAccount.events','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x3489cf,_0x4b7a68){var _0x3fef23=function(_0x3fb320){while(--_0x3fb320){_0x3489cf['push'](_0x3489cf['shift']());}};_0x3fef23(++_0x4b7a68);}(_0xfe13,0x178));var _0x3fe1=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xfe13[_0x18ab2a];return _0x16dcee;};'use strict';var MailAccountEvents=require(_0x3fe1('0x0'));var events=['save',_0x3fe1('0x1'),_0x3fe1('0x2')];function createListener(_0x1d6495,_0x45ea4f){return function(_0x314639){_0x45ea4f[_0x3fe1('0x3')](_0x1d6495,_0x314639);};}function removeListener(_0x4b3537,_0x5074c4){return function(){MailAccountEvents[_0x3fe1('0x4')](_0x4b3537,_0x5074c4);};}exports[_0x3fe1('0x5')]=function(_0x2c5ed2){for(var _0x5caa2e=0x0,_0xe33444=events[_0x3fe1('0x6')];_0x5caa2e<_0xe33444;_0x5caa2e++){var _0x1c3fac=events[_0x5caa2e];var _0x22fe4b=createListener(_0x3fe1('0x7')+_0x1c3fac,_0x2c5ed2);MailAccountEvents['on'](_0x1c3fac,_0x22fe4b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f0ce85b..1e35b67 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 _0xc3ba=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4c00f3,_0x343f94){var _0x5a7b6f=function(_0x2f9d8a){while(--_0x2f9d8a){_0x4c00f3['push'](_0x4c00f3['shift']());}};_0x5a7b6f(++_0x343f94);}(_0xc3ba,0x11d));var _0xac3b=function(_0x5cf534,_0x3eb673){_0x5cf534=_0x5cf534-0x0;var _0x4cc5f6=_0xc3ba[_0x5cf534];return _0x4cc5f6;};'use strict';var multer=require(_0xac3b('0x0'));var util=require('util');var path=require(_0xac3b('0x1'));var timeout=require(_0xac3b('0x2'));var express=require('express');var router=express[_0xac3b('0x3')]();var fs_extra=require(_0xac3b('0x4'));var auth=require(_0xac3b('0x5'));var interaction=require(_0xac3b('0x6'));var config=require(_0xac3b('0x7'));var controller=require(_0xac3b('0x8'));router[_0xac3b('0x9')](_0xac3b('0xa'),auth[_0xac3b('0xb')](),controller['show']);router['put'](_0xac3b('0xa'),auth['isAuthenticated'](),controller[_0xac3b('0xc')]);router[_0xac3b('0xd')]('/:id',auth[_0xac3b('0xb')](),controller[_0xac3b('0xe')]);module[_0xac3b('0xf')]=router; \ No newline at end of file +var _0x9c5d=['./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2e89cf,_0x2e3121){var _0x154a0e=function(_0x3f12b3){while(--_0x3f12b3){_0x2e89cf['push'](_0x2e89cf['shift']());}};_0x154a0e(++_0x2e3121);}(_0x9c5d,0x118));var _0xd9c5=function(_0x50d249,_0x564d13){_0x50d249=_0x50d249-0x0;var _0x267287=_0x9c5d[_0x50d249];return _0x267287;};'use strict';var multer=require(_0xd9c5('0x0'));var util=require(_0xd9c5('0x1'));var path=require(_0xd9c5('0x2'));var timeout=require(_0xd9c5('0x3'));var express=require(_0xd9c5('0x4'));var router=express['Router']();var fs_extra=require(_0xd9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd9c5('0x6'));var config=require(_0xd9c5('0x7'));var controller=require(_0xd9c5('0x8'));router[_0xd9c5('0x9')](_0xd9c5('0xa'),auth['isAuthenticated'](),controller[_0xd9c5('0xb')]);router[_0xd9c5('0xc')](_0xd9c5('0xa'),auth[_0xd9c5('0xd')](),controller[_0xd9c5('0xe')]);router[_0xd9c5('0xf')](_0xd9c5('0xa'),auth[_0xd9c5('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cd94ae9..4edbc1d 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 _0xcdcb=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x28d973,_0x38981f){var _0x110740=function(_0x3dddb3){while(--_0x3dddb3){_0x28d973['push'](_0x28d973['shift']());}};_0x110740(++_0x38981f);}(_0xcdcb,0x1ed));var _0xbcdc=function(_0x55cd22,_0x50a96f){_0x55cd22=_0x55cd22-0x0;var _0x3c5ec8=_0xcdcb[_0x55cd22];return _0x3c5ec8;};'use strict';var Sequelize=require(_0xbcdc('0x0'));module[_0xbcdc('0x1')]={'priority':{'type':Sequelize[_0xbcdc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbcdc('0x3')},'appdata':{'type':Sequelize[_0xbcdc('0x4')]()},'description':{'type':Sequelize[_0xbcdc('0x5')]},'interval':{'type':Sequelize[_0xbcdc('0x5')],'defaultValue':_0xbcdc('0x6')}}; \ No newline at end of file +var _0x09bf=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x3d91bc,_0x2e7f6e){var _0x90b4fe=function(_0x15c209){while(--_0x15c209){_0x3d91bc['push'](_0x3d91bc['shift']());}};_0x90b4fe(++_0x2e7f6e);}(_0x09bf,0xb4));var _0xf09b=function(_0x4a25d8,_0x1b623f){_0x4a25d8=_0x4a25d8-0x0;var _0x1a3024=_0x09bf[_0x4a25d8];return _0x1a3024;};'use strict';var Sequelize=require(_0xf09b('0x0'));module[_0xf09b('0x1')]={'priority':{'type':Sequelize[_0xf09b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf09b('0x3')},'appdata':{'type':Sequelize[_0xf09b('0x4')]()},'description':{'type':Sequelize[_0xf09b('0x5')]},'interval':{'type':Sequelize[_0xf09b('0x5')],'defaultValue':_0xf09b('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ff0fd8d..5fbd4b5 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xaa88[_0x1cb18a];return _0x22442e;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x294b71,_0x4c47d4){var _0x1b5689=function(_0x1755e5){while(--_0x1755e5){_0x294b71['push'](_0x294b71['shift']());}};_0x1b5689(++_0x4c47d4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 073975a..c2f20ad 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 _0xc184=['MailApplication','utf8mb4','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc184,0xff));var _0x4c18=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0xc184[_0x1fb1c1];return _0x1622df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c18('0x0'))(_0x4c18('0x1'));var moment=require('moment');var BPromise=require(_0x4c18('0x2'));var rp=require(_0x4c18('0x3'));var fs=require('fs');var path=require(_0x4c18('0x4'));var rimraf=require('rimraf');var config=require(_0x4c18('0x5'));var attributes=require(_0x4c18('0x6'));module[_0x4c18('0x7')]=function(_0x4c9a32,_0x32f6b3){return _0x4c9a32[_0x4c18('0x8')](_0x4c18('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c18('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x46d1=['mail_applications','utf8mb4','utf8mb4_unicode_ci','api','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x4d7c86,_0x9b62a6){var _0x59443d=function(_0x5af971){while(--_0x5af971){_0x4d7c86['push'](_0x4d7c86['shift']());}};_0x59443d(++_0x9b62a6);}(_0x46d1,0x1a7));var _0x146d=function(_0x25b0be,_0x5dfbc8){_0x25b0be=_0x25b0be-0x0;var _0x578357=_0x46d1[_0x25b0be];return _0x578357;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x146d('0x0'));var moment=require('moment');var BPromise=require(_0x146d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x146d('0x2'));var rimraf=require(_0x146d('0x3'));var config=require(_0x146d('0x4'));var attributes=require(_0x146d('0x5'));module[_0x146d('0x6')]=function(_0x508ecf,_0x2137dd){return _0x508ecf[_0x146d('0x7')](_0x146d('0x8'),attributes,{'tableName':_0x146d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x146d('0xa'),'collate':_0x146d('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 1dc816e..bb6b190 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 _0x06fb=['../../config/environment','jayson/promise','client','request','then','debug','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','catch','MailApplication','update','options','raw','where','attributes','limit','UpdateMailApplication','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x06fb,0x190));var _0xb06f=function(_0x4aeb02,_0x34a282){_0x4aeb02=_0x4aeb02-0x0;var _0x39410d=_0x06fb[_0x4aeb02];return _0x39410d;};'use strict';var _=require('lodash');var util=require(_0xb06f('0x0'));var moment=require('moment');var BPromise=require(_0xb06f('0x1'));var rs=require(_0xb06f('0x2'));var fs=require('fs');var Redis=require(_0xb06f('0x3'));var db=require(_0xb06f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb06f('0x5'));var jayson=require(_0xb06f('0x6'));var client=jayson[_0xb06f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370010,_0x12c261,_0x1971ec){return new BPromise(function(_0x486e74,_0x41f626){return client[_0xb06f('0x8')](_0x370010,_0x1971ec)[_0xb06f('0x9')](function(_0x1d20b8){logger['info']('MailApplication,\x20%s,\x20%s',_0x12c261,'request\x20sent');logger[_0xb06f('0xa')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x12c261,_0xb06f('0xb'),JSON[_0xb06f('0xc')](_0x1d20b8));if(_0x1d20b8[_0xb06f('0xd')]){if(_0x1d20b8['error'][_0xb06f('0xe')]===0x1f4){logger[_0xb06f('0xd')](_0xb06f('0xf'),_0x12c261,_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);return _0x41f626(_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);}logger[_0xb06f('0xd')](_0xb06f('0xf'),_0x12c261,_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);return _0x486e74(_0x1d20b8[_0xb06f('0xd')][_0xb06f('0x10')]);}else{logger[_0xb06f('0x11')]('MailApplication,\x20%s,\x20%s',_0x12c261,'request\x20sent');_0x486e74(_0x1d20b8['result'][_0xb06f('0x10')]);}})[_0xb06f('0x12')](function(_0x5b3a06){logger[_0xb06f('0xd')](_0xb06f('0xf'),_0x12c261,_0x5b3a06);_0x41f626(_0x5b3a06);});});}exports['UpdateMailApplication']=function(_0x2bac5e){var _0x4e5af5=this;return new Promise(function(_0x34214b,_0x41933f){return db[_0xb06f('0x13')][_0xb06f('0x14')](_0x2bac5e['body'],{'raw':_0x2bac5e[_0xb06f('0x15')]?_0x2bac5e[_0xb06f('0x15')][_0xb06f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bac5e[_0xb06f('0x15')]?_0x2bac5e[_0xb06f('0x15')][_0xb06f('0x17')]||null:null,'attributes':_0x2bac5e[_0xb06f('0x15')]?_0x2bac5e[_0xb06f('0x15')][_0xb06f('0x18')]||null:null,'limit':_0x2bac5e[_0xb06f('0x15')]?_0x2bac5e[_0xb06f('0x15')][_0xb06f('0x19')]||null:null})['then'](function(_0xf83f76){logger['info'](_0xb06f('0x1a'),_0x2bac5e);logger[_0xb06f('0xa')](_0xb06f('0x1a'),_0x2bac5e,JSON[_0xb06f('0xc')](_0xf83f76));_0x34214b(_0xf83f76);})[_0xb06f('0x12')](function(_0x138c62){logger[_0xb06f('0xd')](_0xb06f('0x1a'),_0x138c62[_0xb06f('0x10')],_0x2bac5e);_0x41933f(_0x4e5af5['error'](0x1f4,_0x138c62[_0xb06f('0x10')]));});});}; \ No newline at end of file +var _0x044f=['debug','request\x20sent','stringify','code','error','message','info','catch','UpdateMailApplication','MailApplication','update','options','where','attributes','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','MailApplication,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x044f,0x108));var _0xf044=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0x044f[_0x458ed6];return _0xa5dfd9;};'use strict';var _=require(_0xf044('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf044('0x1'));var db=require(_0xf044('0x2'))['db'];var utils=require(_0xf044('0x3'));var logger=require(_0xf044('0x4'))(_0xf044('0x5'));var config=require(_0xf044('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf044('0x7')][_0xf044('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa5b671,_0x1525b0,_0x6a4b1f){return new BPromise(function(_0x1cfa91,_0x43e764){return client['request'](_0xa5b671,_0x6a4b1f)[_0xf044('0x9')](function(_0x5bd21e){logger['info'](_0xf044('0xa'),_0x1525b0,'request\x20sent');logger[_0xf044('0xb')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1525b0,_0xf044('0xc'),JSON[_0xf044('0xd')](_0x5bd21e));if(_0x5bd21e['error']){if(_0x5bd21e['error'][_0xf044('0xe')]===0x1f4){logger[_0xf044('0xf')]('MailApplication,\x20%s,\x20%s',_0x1525b0,_0x5bd21e['error'][_0xf044('0x10')]);return _0x43e764(_0x5bd21e[_0xf044('0xf')]['message']);}logger['error'](_0xf044('0xa'),_0x1525b0,_0x5bd21e[_0xf044('0xf')][_0xf044('0x10')]);return _0x1cfa91(_0x5bd21e['error'][_0xf044('0x10')]);}else{logger[_0xf044('0x11')](_0xf044('0xa'),_0x1525b0,_0xf044('0xc'));_0x1cfa91(_0x5bd21e['result'][_0xf044('0x10')]);}})[_0xf044('0x12')](function(_0x5c9a81){logger[_0xf044('0xf')](_0xf044('0xa'),_0x1525b0,_0x5c9a81);_0x43e764(_0x5c9a81);});});}exports[_0xf044('0x13')]=function(_0x14f9d9){var _0x5cff28=this;return new Promise(function(_0x5910a1,_0x30a579){return db[_0xf044('0x14')][_0xf044('0x15')](_0x14f9d9['body'],{'raw':_0x14f9d9[_0xf044('0x16')]?_0x14f9d9[_0xf044('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f9d9['options']?_0x14f9d9[_0xf044('0x16')][_0xf044('0x17')]||null:null,'attributes':_0x14f9d9[_0xf044('0x16')]?_0x14f9d9['options'][_0xf044('0x18')]||null:null,'limit':_0x14f9d9[_0xf044('0x16')]?_0x14f9d9[_0xf044('0x16')]['limit']||null:null})['then'](function(_0xd644b7){logger['info'](_0xf044('0x13'),_0x14f9d9);logger[_0xf044('0xb')]('UpdateMailApplication',_0x14f9d9,JSON[_0xf044('0xd')](_0xd644b7));_0x5910a1(_0xd644b7);})[_0xf044('0x12')](function(_0x1ef8b3){logger[_0xf044('0xf')](_0xf044('0x13'),_0x1ef8b3[_0xf044('0x10')],_0x14f9d9);_0x30a579(_0x5cff28[_0xf044('0xf')](0x1f4,_0x1ef8b3[_0xf044('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c463640..ba364cd 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 _0xd6d0=['Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','post','create','/:id/tags','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','express'];(function(_0x35b982,_0x3b0c0e){var _0x12fdb5=function(_0x5de377){while(--_0x5de377){_0x35b982['push'](_0x35b982['shift']());}};_0x12fdb5(++_0x3b0c0e);}(_0xd6d0,0x167));var _0x0d6d=function(_0xf3a1,_0xe34e0d){_0xf3a1=_0xf3a1-0x0;var _0x5b60c3=_0xd6d0[_0xf3a1];return _0x5b60c3;};'use strict';var express=require(_0x0d6d('0x0'));var router=express[_0x0d6d('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d6d('0x2'));var controller=require(_0x0d6d('0x3'));router[_0x0d6d('0x4')]('/',auth[_0x0d6d('0x5')](),controller[_0x0d6d('0x6')]);router[_0x0d6d('0x4')](_0x0d6d('0x7'),auth['isAuthenticated'](),controller[_0x0d6d('0x8')]);router[_0x0d6d('0x4')](_0x0d6d('0x9'),auth[_0x0d6d('0x5')](),controller['show']);router[_0x0d6d('0x4')](_0x0d6d('0xa'),auth[_0x0d6d('0x5')](),controller[_0x0d6d('0xb')]);router[_0x0d6d('0x4')]('/:id/download',auth[_0x0d6d('0x5')](),controller['download']);router[_0x0d6d('0xc')]('/',auth[_0x0d6d('0x5')](),controller[_0x0d6d('0xd')]);router[_0x0d6d('0xc')](_0x0d6d('0xa'),auth[_0x0d6d('0x5')](),controller['addMessage']);router[_0x0d6d('0xc')](_0x0d6d('0xe'),auth[_0x0d6d('0x5')](),interaction[_0x0d6d('0xf')]('mail',_0x0d6d('0x10')),controller['addTags']);router[_0x0d6d('0x11')]('/:id',auth[_0x0d6d('0x5')](),interaction[_0x0d6d('0xf')](_0x0d6d('0x12'),_0x0d6d('0x13')),controller[_0x0d6d('0x14')]);router[_0x0d6d('0x15')](_0x0d6d('0x9'),auth[_0x0d6d('0x5')](),interaction[_0x0d6d('0xf')]('mail',_0x0d6d('0x16')),controller[_0x0d6d('0x17')]);router[_0x0d6d('0x15')](_0x0d6d('0xe'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x64f0=['mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete'];(function(_0x12b7b4,_0x155cfc){var _0x3b2a3e=function(_0x5b2c9e){while(--_0x5b2c9e){_0x12b7b4['push'](_0x12b7b4['shift']());}};_0x3b2a3e(++_0x155cfc);}(_0x64f0,0x1b4));var _0x064f=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0x64f0[_0x512c83];return _0x1f7f25;};'use strict';var express=require(_0x064f('0x0'));var router=express[_0x064f('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x064f('0x2'));var controller=require(_0x064f('0x3'));router[_0x064f('0x4')]('/',auth[_0x064f('0x5')](),controller['index']);router[_0x064f('0x4')](_0x064f('0x6'),auth[_0x064f('0x5')](),controller['describe']);router[_0x064f('0x4')]('/:id',auth[_0x064f('0x5')](),controller[_0x064f('0x7')]);router[_0x064f('0x4')](_0x064f('0x8'),auth[_0x064f('0x5')](),controller[_0x064f('0x9')]);router[_0x064f('0x4')](_0x064f('0xa'),auth[_0x064f('0x5')](),controller['download']);router[_0x064f('0xb')]('/',auth['isAuthenticated'](),controller[_0x064f('0xc')]);router[_0x064f('0xb')](_0x064f('0x8'),auth[_0x064f('0x5')](),controller[_0x064f('0xd')]);router[_0x064f('0xb')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x064f('0xe')](_0x064f('0xf'),_0x064f('0x10')),controller[_0x064f('0x11')]);router[_0x064f('0x12')](_0x064f('0x13'),auth[_0x064f('0x5')](),interaction[_0x064f('0xe')](_0x064f('0xf'),_0x064f('0x14')),controller[_0x064f('0x15')]);router[_0x064f('0x16')](_0x064f('0x13'),auth[_0x064f('0x5')](),interaction[_0x064f('0xe')](_0x064f('0xf'),_0x064f('0x17')),controller[_0x064f('0x18')]);router[_0x064f('0x16')](_0x064f('0x19'),auth[_0x064f('0x5')](),controller['removeTags']);module[_0x064f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 77b186d..e594391 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 _0x6ee9=['exports','DATE','STRING','long','BOOLEAN','ENUM','out','INTEGER','sequelize','iconv'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x6ee9,0x1ca));var _0x96ee=function(_0x2cde3d,_0x37644){_0x2cde3d=_0x2cde3d-0x0;var _0x2a7e9c=_0x6ee9[_0x2cde3d];return _0x2a7e9c;};'use strict';var Sequelize=require(_0x96ee('0x0'));var iconv=require(_0x96ee('0x1'));module[_0x96ee('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x96ee('0x3')]},'disposition':{'type':Sequelize[_0x96ee('0x4')]},'secondDisposition':{'type':Sequelize[_0x96ee('0x4')]},'thirdDisposition':{'type':Sequelize[_0x96ee('0x4')]},'note':{'type':Sequelize[_0x96ee('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x96ee('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x96ee('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x96ee('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x96ee('0x3')]},'substatus':{'type':Sequelize[_0x96ee('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x96ee('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x96ee('0x7')]('in',_0x96ee('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x96ee('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x96ee('0x7')]('in',_0x96ee('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x96ee('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96ee('0x9')]}}; \ No newline at end of file +var _0xf723=['out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf723,0xa7));var _0x3f72=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xf723[_0x3861f7];return _0x50879f;};'use strict';var Sequelize=require(_0x3f72('0x0'));var iconv=require(_0x3f72('0x1'));module[_0x3f72('0x2')]={'closed':{'type':Sequelize[_0x3f72('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3f72('0x4')]},'disposition':{'type':Sequelize[_0x3f72('0x5')]},'secondDisposition':{'type':Sequelize[_0x3f72('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3f72('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3f72('0x5')]},'cc':{'type':Sequelize[_0x3f72('0x6')](_0x3f72('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3f72('0x4')]},'substatus':{'type':Sequelize[_0x3f72('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x3f72('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3f72('0x8')]('in',_0x3f72('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3f72('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3f72('0x8')]('in',_0x3f72('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3f72('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d9cc6ee..dbbce4d 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 _0x3d1e=['api','../../config/environment','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','set','update','destroy','then','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','mail','catch','show','params','model','keys','intersection','query','attributes','fields','length','includeAll','merge','options','create','body','find','describe','addMessage','MailMessage','ids','omit','findOne','filters','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','include','inlineCss','true','rows','addTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Messages','subject','createdAt','get','mkdirSync','each','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3d1e,0x65));var _0xe3d1=function(_0x450366,_0x2f02b0){_0x450366=_0x450366-0x0;var _0x1b6a3b=_0x3d1e[_0x450366];return _0x1b6a3b;};'use strict';var emlformat=require(_0xe3d1('0x0'));var rimraf=require(_0xe3d1('0x1'));var zipdir=require('zip-dir');var moment=require(_0xe3d1('0x2'));var BPromise=require(_0xe3d1('0x3'));var util=require(_0xe3d1('0x4'));var path=require(_0xe3d1('0x5'));var fs=require('fs');var _=require(_0xe3d1('0x6'));var juice=require(_0xe3d1('0x7'));var Redis=require('ioredis');var interaction=require(_0xe3d1('0x8'));var qs=require(_0xe3d1('0x9'));var logger=require(_0xe3d1('0xa'))(_0xe3d1('0xb'));var config=require(_0xe3d1('0xc'));var db=require(_0xe3d1('0xd'))['db'];var htmlEntities=require(_0xe3d1('0xe'));config[_0xe3d1('0xf')]=_['defaults'](config[_0xe3d1('0xf')],{'host':_0xe3d1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3d1('0xf')]));require(_0xe3d1('0x11'))['register'](socket);function respondWithStatusCode(_0x189bce,_0x55058d){_0x55058d=_0x55058d||0xcc;return function(_0x3897b8){if(_0x3897b8){return _0x189bce[_0xe3d1('0x12')](_0x55058d);}return _0x189bce[_0xe3d1('0x13')](_0x55058d)[_0xe3d1('0x14')]();};}function respondWithResult(_0xc64c56,_0x5082f7){_0x5082f7=_0x5082f7||0xc8;return function(_0x14f0e2){if(_0x14f0e2){return _0xc64c56['status'](_0x5082f7)[_0xe3d1('0x15')](_0x14f0e2);}};}function respondWithFilteredResult(_0x38dee5,_0xc28a4f){return function(_0x34ee2c){if(_0x34ee2c){var _0x53d6e3=typeof _0xc28a4f[_0xe3d1('0x16')]===_0xe3d1('0x17')&&typeof _0xc28a4f[_0xe3d1('0x18')]===_0xe3d1('0x17');var _0x3ca3fe=_0x34ee2c['count'];var _0x5359ad=_0x53d6e3?0x0:_0xc28a4f['offset'];var _0x2b9e35=_0x53d6e3?_0x34ee2c['count']:_0xc28a4f[_0xe3d1('0x16')]+_0xc28a4f[_0xe3d1('0x18')];var _0x403877;if(_0x2b9e35>=_0x3ca3fe){_0x2b9e35=_0x3ca3fe;_0x403877=0xc8;}else{_0x403877=0xce;}_0x38dee5[_0xe3d1('0x13')](_0x403877);return _0x38dee5[_0xe3d1('0x19')]('Content-Range',_0x5359ad+'-'+_0x2b9e35+'/'+_0x3ca3fe)['json'](_0x34ee2c);}return null;};}function saveUpdates(_0x2a78d5){return function(_0x395a97){if(_0x395a97){return _0x395a97[_0xe3d1('0x1a')](_0x2a78d5)['then'](function(_0x35173b){return _0x35173b;});}return null;};}function removeEntity(_0x34f0b3){return function(_0x12438b){if(_0x12438b){return _0x12438b[_0xe3d1('0x1b')]()[_0xe3d1('0x1c')](function(){_0x34f0b3[_0xe3d1('0x13')](0xcc)[_0xe3d1('0x14')]();});}};}function handleEntityNotFound(_0x43c8f3){return function(_0xd193f7){if(!_0xd193f7){_0x43c8f3[_0xe3d1('0x12')](0x194);}return _0xd193f7;};}function handleError(_0xc80f2b,_0x5853ae){_0x5853ae=_0x5853ae||0x1f4;return function(_0x71d01d){logger[_0xe3d1('0x1d')](_0x71d01d[_0xe3d1('0x1e')]);if(_0x71d01d[_0xe3d1('0x1f')]){delete _0x71d01d[_0xe3d1('0x1f')];}_0xc80f2b[_0xe3d1('0x13')](_0x5853ae)['send'](_0x71d01d);};}exports[_0xe3d1('0x20')]=function(_0x5ebc11,_0x9010c3){var _0x8ec1d5={};var _0x334d6a=_[_0xe3d1('0x21')](db[_0xe3d1('0x22')][_0xe3d1('0x23')],function(_0x26c4a0){return{'name':_0x26c4a0[_0xe3d1('0x24')],'type':_0x26c4a0[_0xe3d1('0x25')]['key']};});_0x8ec1d5=qs[_0xe3d1('0x26')](_0x334d6a,_0x5ebc11);return interaction[_0xe3d1('0x27')](_0xe3d1('0x28'),_0x5ebc11['query'],_0x5ebc11['user'],_0x8ec1d5,_0x334d6a)[_0xe3d1('0x1c')](respondWithFilteredResult(_0x9010c3,_0x8ec1d5))[_0xe3d1('0x29')](handleError(_0x9010c3,null));};exports[_0xe3d1('0x2a')]=function(_0x240c5d,_0x34d172){var _0x22736d={'raw':![],'where':{'id':_0x240c5d[_0xe3d1('0x2b')]['id']}},_0x19f7a8={};_0x19f7a8[_0xe3d1('0x2c')]=_[_0xe3d1('0x2d')](db[_0xe3d1('0x22')][_0xe3d1('0x23')]);_0x19f7a8['query']=_[_0xe3d1('0x2d')](_0x240c5d['query']);_0x19f7a8['filters']=_[_0xe3d1('0x2e')](_0x19f7a8[_0xe3d1('0x2c')],_0x19f7a8[_0xe3d1('0x2f')]);_0x22736d[_0xe3d1('0x30')]=_[_0xe3d1('0x2e')](_0x19f7a8['model'],qs['fields'](_0x240c5d[_0xe3d1('0x2f')][_0xe3d1('0x31')]));_0x22736d[_0xe3d1('0x30')]=_0x22736d[_0xe3d1('0x30')][_0xe3d1('0x32')]?_0x22736d['attributes']:_0x19f7a8[_0xe3d1('0x2c')];if(_0x240c5d['query'][_0xe3d1('0x33')]){_0x22736d['include']=[{'all':!![]}];}_0x22736d=_[_0xe3d1('0x34')]({},_0x22736d,_0x240c5d[_0xe3d1('0x35')]);return db[_0xe3d1('0x22')]['find'](_0x22736d)['then'](handleEntityNotFound(_0x34d172,null))[_0xe3d1('0x1c')](respondWithResult(_0x34d172,null))[_0xe3d1('0x29')](handleError(_0x34d172,null));};exports['create']=function(_0x19cd5e,_0x4afbe3){return db[_0xe3d1('0x22')][_0xe3d1('0x36')](_0x19cd5e[_0xe3d1('0x37')],{})[_0xe3d1('0x1c')](respondWithResult(_0x4afbe3,0xc9))[_0xe3d1('0x29')](handleError(_0x4afbe3,null));};exports[_0xe3d1('0x1a')]=function(_0x5d72f4,_0x3bdb03){if(_0x5d72f4['body']['id']){delete _0x5d72f4[_0xe3d1('0x37')]['id'];}return db[_0xe3d1('0x22')][_0xe3d1('0x38')]({'where':{'id':_0x5d72f4[_0xe3d1('0x2b')]['id']}})[_0xe3d1('0x1c')](handleEntityNotFound(_0x3bdb03,null))[_0xe3d1('0x1c')](saveUpdates(_0x5d72f4[_0xe3d1('0x37')],null))[_0xe3d1('0x1c')](respondWithResult(_0x3bdb03,null))[_0xe3d1('0x29')](handleError(_0x3bdb03,null));};exports['destroy']=function(_0x12ed86,_0x2eb4fb){return db[_0xe3d1('0x22')][_0xe3d1('0x38')]({'where':{'id':_0x12ed86[_0xe3d1('0x2b')]['id']}})[_0xe3d1('0x1c')](handleEntityNotFound(_0x2eb4fb,null))[_0xe3d1('0x1c')](removeEntity(_0x2eb4fb,null))['catch'](handleError(_0x2eb4fb,null));};exports[_0xe3d1('0x39')]=function(_0x51e22a,_0x4f551b){return db['MailInteraction'][_0xe3d1('0x39')]()['then'](respondWithResult(_0x4f551b,null))['catch'](handleError(_0x4f551b,null));};exports[_0xe3d1('0x3a')]=function(_0x513159,_0x144af0){return db[_0xe3d1('0x3b')][_0xe3d1('0x38')]({'where':{'id':_0x513159[_0xe3d1('0x2b')]['id']}})[_0xe3d1('0x1c')](handleEntityNotFound(_0x144af0,null))[_0xe3d1('0x1c')](function(_0x5cb25f){if(_0x5cb25f){return _0x5cb25f[_0xe3d1('0x3a')](_0x513159['body'][_0xe3d1('0x3c')],_[_0xe3d1('0x3d')](_0x513159[_0xe3d1('0x37')],[_0xe3d1('0x3c'),'id'])||{});}})[_0xe3d1('0x1c')](respondWithResult(_0x144af0,null))[_0xe3d1('0x29')](handleError(_0x144af0,null));};exports['getMessages']=function(_0x5da46a,_0x5a9fac){var _0x1fd1ef={'raw':![],'where':{}};var _0x2f3780={};var _0x1ef1c7={'count':0x0,'rows':[]};return db[_0xe3d1('0x22')][_0xe3d1('0x3e')]({'where':{'id':_0x5da46a[_0xe3d1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5a9fac,null))[_0xe3d1('0x1c')](function(_0x530746){if(_0x530746){_0x2f3780[_0xe3d1('0x2c')]=_[_0xe3d1('0x2d')](db[_0xe3d1('0x3b')][_0xe3d1('0x23')]);_0x2f3780[_0xe3d1('0x2f')]=_['keys'](_0x5da46a[_0xe3d1('0x2f')]);_0x2f3780[_0xe3d1('0x3f')]=_['intersection'](_0x2f3780[_0xe3d1('0x2c')],_0x2f3780[_0xe3d1('0x2f')]);_0x1fd1ef['attributes']=_[_0xe3d1('0x2e')](_0x2f3780[_0xe3d1('0x2c')],qs['fields'](_0x5da46a[_0xe3d1('0x2f')]['fields']));_0x1fd1ef[_0xe3d1('0x30')]=_0x1fd1ef[_0xe3d1('0x30')][_0xe3d1('0x32')]?_0x1fd1ef['attributes']:_0x2f3780[_0xe3d1('0x2c')];if(!_0x5da46a[_0xe3d1('0x2f')]['hasOwnProperty'](_0xe3d1('0x40'))){_0x1fd1ef[_0xe3d1('0x18')]=qs['limit'](_0x5da46a['query'][_0xe3d1('0x18')]);_0x1fd1ef[_0xe3d1('0x16')]=qs[_0xe3d1('0x16')](_0x5da46a[_0xe3d1('0x2f')][_0xe3d1('0x16')]);}_0x1fd1ef['order']=qs[_0xe3d1('0x41')](_0x5da46a[_0xe3d1('0x2f')]['sort']);_0x1fd1ef[_0xe3d1('0x42')]=qs['filters'](_[_0xe3d1('0x43')](_0x5da46a[_0xe3d1('0x2f')],_0x2f3780[_0xe3d1('0x3f')]));_0x1fd1ef[_0xe3d1('0x42')]['MailInteractionId']=_0x530746['id'];if(_0x5da46a['query'][_0xe3d1('0x44')]){_0x1fd1ef[_0xe3d1('0x42')]=_['merge'](_0x1fd1ef[_0xe3d1('0x42')],{'$or':_[_0xe3d1('0x21')](_0x1fd1ef[_0xe3d1('0x30')],function(_0x19e8d1){var _0x33960e={};_0x33960e[_0x19e8d1]={'$like':'%'+_0x5da46a[_0xe3d1('0x2f')]['filter']+'%'};return _0x33960e;})});}if(_0x5da46a['query'][_0xe3d1('0x45')]){var _0x5b8079=_0x5da46a[_0xe3d1('0x2f')]['$gte'][_0xe3d1('0x46')](',');var _0x398867={};_0x398867[_0x5b8079[0x0]]={'$gte':moment(_0x5b8079[0x1])[_0xe3d1('0x47')](_0xe3d1('0x48'))};_0x1fd1ef['where']=_[_0xe3d1('0x34')](_0x1fd1ef[_0xe3d1('0x42')],_0x398867);}_0x1fd1ef=_[_0xe3d1('0x34')]({},_0x1fd1ef,_0x5da46a['options']);return db['MailMessage'][_0xe3d1('0x49')]({'where':_0x1fd1ef['where']})['then'](function(_0x34475a){_0x1ef1c7[_0xe3d1('0x49')]=_0x34475a;if(_0x5da46a[_0xe3d1('0x2f')][_0xe3d1('0x33')]){_0x1fd1ef[_0xe3d1('0x4a')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1fd1ef);})['then'](function(_0x2bb7a6){if(_0x5da46a[_0xe3d1('0x2f')][_0xe3d1('0x4b')]===_0xe3d1('0x4c')){for(var _0x57fa2a=0x0;_0x57fa2a<_0x2bb7a6[_0xe3d1('0x32')];_0x57fa2a++){_0x2bb7a6[_0x57fa2a][_0xe3d1('0x37')]=juice(_0x2bb7a6[_0x57fa2a][_0xe3d1('0x37')]);}}_0x1ef1c7[_0xe3d1('0x4d')]=_0x2bb7a6;return _0x1ef1c7;});}})[_0xe3d1('0x1c')](respondWithFilteredResult(_0x5a9fac,_0x1fd1ef))[_0xe3d1('0x29')](handleError(_0x5a9fac,null));};exports[_0xe3d1('0x4e')]=function(_0x512a8a,_0x27630c){return db[_0xe3d1('0x22')][_0xe3d1('0x38')]({'where':{'id':_0x512a8a[_0xe3d1('0x2b')]['id']}})[_0xe3d1('0x1c')](handleEntityNotFound(_0x27630c,null))['then'](function(_0x1c49e2){if(_0x1c49e2){return _0x1c49e2['setTags'](_0x512a8a[_0xe3d1('0x37')][_0xe3d1('0x3c')],_[_0xe3d1('0x3d')](_0x512a8a[_0xe3d1('0x37')],['ids','id'])||{})[_0xe3d1('0x4f')](function(){return db[_0xe3d1('0x50')][_0xe3d1('0x27')]({'attributes':['id',_0xe3d1('0x1f'),_0xe3d1('0x51')],'where':{'id':_0x512a8a[_0xe3d1('0x37')]['ids']}});})['then'](function(_0x262d3b){socket['emit'](_0xe3d1('0x52'),{'id':Number(_0x512a8a[_0xe3d1('0x2b')]['id']),'tags':_0x262d3b||[]});return{'id':Number(_0x512a8a[_0xe3d1('0x2b')]['id']),'tags':_0x262d3b||[]};});}})['then'](respondWithResult(_0x27630c,null))[_0xe3d1('0x29')](handleError(_0x27630c,null));};exports[_0xe3d1('0x53')]=function(_0x5dc2f2,_0x3bcbf8){return db[_0xe3d1('0x22')][_0xe3d1('0x38')]({'where':{'id':_0x5dc2f2[_0xe3d1('0x2b')]['id']}})[_0xe3d1('0x1c')](handleEntityNotFound(_0x3bcbf8,null))[_0xe3d1('0x1c')](function(_0x36b4ac){if(_0x36b4ac){return _0x36b4ac[_0xe3d1('0x53')](_0x5dc2f2[_0xe3d1('0x2f')][_0xe3d1('0x3c')]);}})[_0xe3d1('0x1c')](respondWithStatusCode(_0x3bcbf8,null))[_0xe3d1('0x29')](handleError(_0x3bcbf8,null));};exports[_0xe3d1('0x54')]=function(_0x3ec002,_0x479ffd){var _0x390d81=moment()[_0xe3d1('0x55')]()[_0xe3d1('0x56')]();var _0x1f3f2e=path[_0xe3d1('0x57')](config[_0xe3d1('0x58')],_0xe3d1('0x59'),_0xe3d1('0x5a'),_0xe3d1('0x5b'));var _0xb9f289=path[_0xe3d1('0x57')](config[_0xe3d1('0x58')],_0xe3d1('0x59'),_0xe3d1('0x5a'),_0xe3d1('0x5c'));var _0x27e4a3=path['join'](_0x1f3f2e,_0x390d81);var _0x47b915=util[_0xe3d1('0x47')](_0xe3d1('0x5d'),_0x3ec002[_0xe3d1('0x2b')]['id'],_0x390d81);var _0x4f262e=path[_0xe3d1('0x57')](_0x1f3f2e,_0x47b915);var _0x5f3799=[];if(_0x3ec002['query'][_0xe3d1('0x5c')]){_0x5f3799[_0xe3d1('0x5e')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x3b2a47=[{'model':db['MailMessage'],'as':_0xe3d1('0x5f'),'attributes':['id',_0xe3d1('0x37'),'from','to','cc','bcc',_0xe3d1('0x60'),_0xe3d1('0x61')],'where':{'secret':![]},'order':qs[_0xe3d1('0x41')]('id'),'include':_0x5f3799}];return db['MailInteraction'][_0xe3d1('0x38')]({'where':{'id':_0x3ec002['params']['id']},'include':_0x3b2a47})[_0xe3d1('0x1c')](handleEntityNotFound(_0x479ffd,null))['then'](function(_0x457789){if(_0x457789&&_0x457789['Messages']){var _0x51f618=_0x457789[_0xe3d1('0x62')]({'plain':!![]});fs[_0xe3d1('0x63')](_0x27e4a3);return BPromise[_0xe3d1('0x64')](_0x51f618[_0xe3d1('0x5f')],function(_0x3f985a,_0x2f960c){var _0x4c4ee2={'from':_0x3f985a[_0xe3d1('0x65')],'to':_0x3f985a['to']||'missing.recipient@your.company.com','subject':_0x3f985a[_0xe3d1('0x60')],'html':htmlEntities[_0xe3d1('0x66')](_0x3f985a[_0xe3d1('0x37')]),'headers':{'Date':moment(_0x3f985a[_0xe3d1('0x61')])['format'](_0xe3d1('0x67'))},'attachments':[]};if(_0x3f985a['cc']){_0x4c4ee2['headers']['Cc']=_0x3f985a['cc'];}if(_0x3f985a[_0xe3d1('0x68')]){_0x4c4ee2[_0xe3d1('0x69')][_0xe3d1('0x6a')]=_0x3f985a[_0xe3d1('0x68')];}return new BPromise(function(_0x43bee2,_0x1bfa7a){if(_0x3f985a[_0xe3d1('0x6b')]){for(var _0x1284bb=0x0;_0x1284bb<_0x3f985a[_0xe3d1('0x6b')][_0xe3d1('0x32')];_0x1284bb++){var _0x420c04=_0x3f985a['Attachments'][_0x1284bb];var _0x112dfd=path[_0xe3d1('0x57')](_0xb9f289,_0x420c04[_0xe3d1('0x6c')]);if(fs[_0xe3d1('0x6d')](_0x112dfd)){_0x4c4ee2['attachments'][_0xe3d1('0x5e')]({'name':_0x420c04[_0xe3d1('0x1f')],'contentType':_0x420c04[_0xe3d1('0x25')],'data':fs[_0xe3d1('0x6e')](_0x112dfd)});}}}emlformat['build'](_0x4c4ee2,function(_0x23f047,_0x172881){if(_0x23f047)return _0x1bfa7a(_0x23f047);fs[_0xe3d1('0x6f')](path['join'](_0x27e4a3,util['format']('message%d.eml',_0x2f960c)),_0x172881);return _0x43bee2(_0x172881);});});})[_0xe3d1('0x1c')](function(){return new BPromise(function(_0x32b906,_0x5ce2d7){zipdir(_0x27e4a3,{'saveTo':_0x4f262e},function(_0x366377,_0x328211){if(_0x366377)return _0x5ce2d7(_0x366377);return _0x32b906(_0x328211);});})[_0xe3d1('0x1c')](function(){return new BPromise(function(_0x1f864e,_0x1d2641){rimraf(_0x27e4a3,function(_0xaf262c){if(_0xaf262c)_0x1d2641(_0xaf262c);return _0x1f864e();});});})[_0xe3d1('0x1c')](function(){return _0x479ffd[_0xe3d1('0x54')](_0x4f262e,_0x47b915,function(_0x3bfe42){if(!_0x3bfe42)fs['unlinkSync'](_0x4f262e);});});});}else{return _0x479ffd[_0xe3d1('0x12')](0xc8);}})['catch'](handleError(_0x479ffd,null));}; \ No newline at end of file +var _0x4e11=['intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','rows','setTags','spread','Tag','mailInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','Attachment','Attachments','Messages','from','bcc','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','juice','ioredis','../../components/parsers/qs','../../config/logger','api','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','json','then','destroy','name','index','MailInteraction','rawAttributes','fieldName','key','mail','user','catch','params','model','keys','filters','query','attributes'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4e11,0xa6));var _0x14e1=function(_0x4a3d08,_0x30f5cf){_0x4a3d08=_0x4a3d08-0x0;var _0x2b9519=_0x4e11[_0x4a3d08];return _0x2b9519;};'use strict';var emlformat=require(_0x14e1('0x0'));var rimraf=require(_0x14e1('0x1'));var zipdir=require('zip-dir');var moment=require(_0x14e1('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0x14e1('0x3'));var Redis=require(_0x14e1('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x14e1('0x5'));var logger=require(_0x14e1('0x6'))(_0x14e1('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x14e1('0x8'));config[_0x14e1('0x9')]=_[_0x14e1('0xa')](config[_0x14e1('0x9')],{'host':_0x14e1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14e1('0x9')]));require(_0x14e1('0xc'))[_0x14e1('0xd')](socket);function respondWithStatusCode(_0x51fad9,_0x3d32c4){_0x3d32c4=_0x3d32c4||0xcc;return function(_0x37c5b9){if(_0x37c5b9){return _0x51fad9[_0x14e1('0xe')](_0x3d32c4);}return _0x51fad9[_0x14e1('0xf')](_0x3d32c4)[_0x14e1('0x10')]();};}function respondWithResult(_0x501601,_0x3d5b4b){_0x3d5b4b=_0x3d5b4b||0xc8;return function(_0x42b1a4){if(_0x42b1a4){return _0x501601[_0x14e1('0xf')](_0x3d5b4b)['json'](_0x42b1a4);}};}function respondWithFilteredResult(_0x10b38d,_0x172758){return function(_0x2efbf9){if(_0x2efbf9){var _0x30bea8=typeof _0x172758[_0x14e1('0x11')]==='undefined'&&typeof _0x172758['limit']===_0x14e1('0x12');var _0xbd716e=_0x2efbf9['count'];var _0x3f5155=_0x30bea8?0x0:_0x172758[_0x14e1('0x11')];var _0x1fcd87=_0x30bea8?_0x2efbf9['count']:_0x172758[_0x14e1('0x11')]+_0x172758[_0x14e1('0x13')];var _0x8423a4;if(_0x1fcd87>=_0xbd716e){_0x1fcd87=_0xbd716e;_0x8423a4=0xc8;}else{_0x8423a4=0xce;}_0x10b38d[_0x14e1('0xf')](_0x8423a4);return _0x10b38d['set']('Content-Range',_0x3f5155+'-'+_0x1fcd87+'/'+_0xbd716e)[_0x14e1('0x14')](_0x2efbf9);}return null;};}function saveUpdates(_0x40e5fa){return function(_0xde089c){if(_0xde089c){return _0xde089c['update'](_0x40e5fa)[_0x14e1('0x15')](function(_0x58904d){return _0x58904d;});}return null;};}function removeEntity(_0x5ce825){return function(_0x1ffa9e){if(_0x1ffa9e){return _0x1ffa9e[_0x14e1('0x16')]()[_0x14e1('0x15')](function(){_0x5ce825[_0x14e1('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5639){return function(_0x446157){if(!_0x446157){_0x2a5639[_0x14e1('0xe')](0x194);}return _0x446157;};}function handleError(_0x196412,_0x36d25d){_0x36d25d=_0x36d25d||0x1f4;return function(_0x994562){logger['error'](_0x994562['stack']);if(_0x994562[_0x14e1('0x17')]){delete _0x994562['name'];}_0x196412[_0x14e1('0xf')](_0x36d25d)['send'](_0x994562);};}exports[_0x14e1('0x18')]=function(_0x449f66,_0x489385){var _0x280b68={};var _0x1e51b2=_['map'](db[_0x14e1('0x19')][_0x14e1('0x1a')],function(_0x34de2b){return{'name':_0x34de2b[_0x14e1('0x1b')],'type':_0x34de2b['type'][_0x14e1('0x1c')]};});_0x280b68=qs['getOptions'](_0x1e51b2,_0x449f66);return interaction['findAll'](_0x14e1('0x1d'),_0x449f66['query'],_0x449f66[_0x14e1('0x1e')],_0x280b68,_0x1e51b2)['then'](respondWithFilteredResult(_0x489385,_0x280b68))[_0x14e1('0x1f')](handleError(_0x489385,null));};exports['show']=function(_0x2a5821,_0xcc334f){var _0x288201={'raw':![],'where':{'id':_0x2a5821[_0x14e1('0x20')]['id']}},_0x5e5fcb={};_0x5e5fcb[_0x14e1('0x21')]=_[_0x14e1('0x22')](db[_0x14e1('0x19')][_0x14e1('0x1a')]);_0x5e5fcb['query']=_[_0x14e1('0x22')](_0x2a5821['query']);_0x5e5fcb[_0x14e1('0x23')]=_['intersection'](_0x5e5fcb['model'],_0x5e5fcb[_0x14e1('0x24')]);_0x288201[_0x14e1('0x25')]=_[_0x14e1('0x26')](_0x5e5fcb['model'],qs[_0x14e1('0x27')](_0x2a5821['query']['fields']));_0x288201['attributes']=_0x288201['attributes'][_0x14e1('0x28')]?_0x288201[_0x14e1('0x25')]:_0x5e5fcb[_0x14e1('0x21')];if(_0x2a5821[_0x14e1('0x24')][_0x14e1('0x29')]){_0x288201[_0x14e1('0x2a')]=[{'all':!![]}];}_0x288201=_[_0x14e1('0x2b')]({},_0x288201,_0x2a5821[_0x14e1('0x2c')]);return db[_0x14e1('0x19')][_0x14e1('0x2d')](_0x288201)[_0x14e1('0x15')](handleEntityNotFound(_0xcc334f,null))[_0x14e1('0x15')](respondWithResult(_0xcc334f,null))[_0x14e1('0x1f')](handleError(_0xcc334f,null));};exports[_0x14e1('0x2e')]=function(_0x54fa83,_0x58ef18){return db[_0x14e1('0x19')][_0x14e1('0x2e')](_0x54fa83[_0x14e1('0x2f')],{})[_0x14e1('0x15')](respondWithResult(_0x58ef18,0xc9))[_0x14e1('0x1f')](handleError(_0x58ef18,null));};exports['update']=function(_0x2667f4,_0x1b4be2){if(_0x2667f4['body']['id']){delete _0x2667f4[_0x14e1('0x2f')]['id'];}return db[_0x14e1('0x19')][_0x14e1('0x2d')]({'where':{'id':_0x2667f4[_0x14e1('0x20')]['id']}})['then'](handleEntityNotFound(_0x1b4be2,null))[_0x14e1('0x15')](saveUpdates(_0x2667f4[_0x14e1('0x2f')],null))[_0x14e1('0x15')](respondWithResult(_0x1b4be2,null))[_0x14e1('0x1f')](handleError(_0x1b4be2,null));};exports[_0x14e1('0x16')]=function(_0x447bfe,_0x27e993){return db[_0x14e1('0x19')][_0x14e1('0x2d')]({'where':{'id':_0x447bfe['params']['id']}})[_0x14e1('0x15')](handleEntityNotFound(_0x27e993,null))[_0x14e1('0x15')](removeEntity(_0x27e993,null))[_0x14e1('0x1f')](handleError(_0x27e993,null));};exports[_0x14e1('0x30')]=function(_0x2cf0d9,_0x4def3f){return db[_0x14e1('0x19')][_0x14e1('0x30')]()['then'](respondWithResult(_0x4def3f,null))[_0x14e1('0x1f')](handleError(_0x4def3f,null));};exports[_0x14e1('0x31')]=function(_0x48acc6,_0x5b4346){return db['MailMessage']['find']({'where':{'id':_0x48acc6['params']['id']}})[_0x14e1('0x15')](handleEntityNotFound(_0x5b4346,null))[_0x14e1('0x15')](function(_0x591d20){if(_0x591d20){return _0x591d20['addMessage'](_0x48acc6['body'][_0x14e1('0x32')],_[_0x14e1('0x33')](_0x48acc6[_0x14e1('0x2f')],[_0x14e1('0x32'),'id'])||{});}})[_0x14e1('0x15')](respondWithResult(_0x5b4346,null))['catch'](handleError(_0x5b4346,null));};exports[_0x14e1('0x34')]=function(_0x52a05d,_0x30ae78){var _0x127fcf={'raw':![],'where':{}};var _0x3de14d={};var _0x151e41={'count':0x0,'rows':[]};return db['MailInteraction'][_0x14e1('0x35')]({'where':{'id':_0x52a05d[_0x14e1('0x20')]['id']}})[_0x14e1('0x15')](handleEntityNotFound(_0x30ae78,null))[_0x14e1('0x15')](function(_0x20dc99){if(_0x20dc99){_0x3de14d[_0x14e1('0x21')]=_[_0x14e1('0x22')](db[_0x14e1('0x36')][_0x14e1('0x1a')]);_0x3de14d['query']=_['keys'](_0x52a05d[_0x14e1('0x24')]);_0x3de14d[_0x14e1('0x23')]=_['intersection'](_0x3de14d[_0x14e1('0x21')],_0x3de14d[_0x14e1('0x24')]);_0x127fcf['attributes']=_['intersection'](_0x3de14d['model'],qs[_0x14e1('0x27')](_0x52a05d['query']['fields']));_0x127fcf[_0x14e1('0x25')]=_0x127fcf[_0x14e1('0x25')][_0x14e1('0x28')]?_0x127fcf['attributes']:_0x3de14d[_0x14e1('0x21')];if(!_0x52a05d[_0x14e1('0x24')][_0x14e1('0x37')](_0x14e1('0x38'))){_0x127fcf[_0x14e1('0x13')]=qs[_0x14e1('0x13')](_0x52a05d['query'][_0x14e1('0x13')]);_0x127fcf[_0x14e1('0x11')]=qs['offset'](_0x52a05d[_0x14e1('0x24')][_0x14e1('0x11')]);}_0x127fcf['order']=qs[_0x14e1('0x39')](_0x52a05d[_0x14e1('0x24')][_0x14e1('0x39')]);_0x127fcf[_0x14e1('0x3a')]=qs[_0x14e1('0x23')](_[_0x14e1('0x3b')](_0x52a05d['query'],_0x3de14d['filters']));_0x127fcf[_0x14e1('0x3a')][_0x14e1('0x3c')]=_0x20dc99['id'];if(_0x52a05d[_0x14e1('0x24')][_0x14e1('0x3d')]){_0x127fcf[_0x14e1('0x3a')]=_[_0x14e1('0x2b')](_0x127fcf['where'],{'$or':_[_0x14e1('0x3e')](_0x127fcf[_0x14e1('0x25')],function(_0x8a6fc5){var _0x252900={};_0x252900[_0x8a6fc5]={'$like':'%'+_0x52a05d[_0x14e1('0x24')][_0x14e1('0x3d')]+'%'};return _0x252900;})});}if(_0x52a05d[_0x14e1('0x24')][_0x14e1('0x3f')]){var _0x3b00f2=_0x52a05d['query'][_0x14e1('0x3f')]['split'](',');var _0x4d5b05={};_0x4d5b05[_0x3b00f2[0x0]]={'$gte':moment(_0x3b00f2[0x1])[_0x14e1('0x40')](_0x14e1('0x41'))};_0x127fcf[_0x14e1('0x3a')]=_[_0x14e1('0x2b')](_0x127fcf[_0x14e1('0x3a')],_0x4d5b05);}_0x127fcf=_[_0x14e1('0x2b')]({},_0x127fcf,_0x52a05d[_0x14e1('0x2c')]);return db[_0x14e1('0x36')]['count']({'where':_0x127fcf[_0x14e1('0x3a')]})[_0x14e1('0x15')](function(_0x243223){_0x151e41[_0x14e1('0x42')]=_0x243223;if(_0x52a05d['query'][_0x14e1('0x29')]){_0x127fcf[_0x14e1('0x2a')]=[{'all':!![]}];}return db[_0x14e1('0x36')]['findAll'](_0x127fcf);})[_0x14e1('0x15')](function(_0x1ee8c7){if(_0x52a05d[_0x14e1('0x24')][_0x14e1('0x43')]===_0x14e1('0x44')){for(var _0x322562=0x0;_0x322562<_0x1ee8c7[_0x14e1('0x28')];_0x322562++){_0x1ee8c7[_0x322562][_0x14e1('0x2f')]=juice(_0x1ee8c7[_0x322562][_0x14e1('0x2f')]);}}_0x151e41[_0x14e1('0x45')]=_0x1ee8c7;return _0x151e41;});}})[_0x14e1('0x15')](respondWithFilteredResult(_0x30ae78,_0x127fcf))[_0x14e1('0x1f')](handleError(_0x30ae78,null));};exports['addTags']=function(_0x4a6aa7,_0x28b536){return db['MailInteraction'][_0x14e1('0x2d')]({'where':{'id':_0x4a6aa7[_0x14e1('0x20')]['id']}})[_0x14e1('0x15')](handleEntityNotFound(_0x28b536,null))[_0x14e1('0x15')](function(_0x4a0fbb){if(_0x4a0fbb){return _0x4a0fbb[_0x14e1('0x46')](_0x4a6aa7['body'][_0x14e1('0x32')],_[_0x14e1('0x33')](_0x4a6aa7[_0x14e1('0x2f')],[_0x14e1('0x32'),'id'])||{})[_0x14e1('0x47')](function(){return db[_0x14e1('0x48')]['findAll']({'attributes':['id',_0x14e1('0x17'),'color'],'where':{'id':_0x4a6aa7[_0x14e1('0x2f')][_0x14e1('0x32')]}});})[_0x14e1('0x15')](function(_0x488999){socket['emit'](_0x14e1('0x49'),{'id':Number(_0x4a6aa7[_0x14e1('0x20')]['id']),'tags':_0x488999||[]});return{'id':Number(_0x4a6aa7['params']['id']),'tags':_0x488999||[]};});}})['then'](respondWithResult(_0x28b536,null))[_0x14e1('0x1f')](handleError(_0x28b536,null));};exports[_0x14e1('0x4a')]=function(_0x3010a8,_0x28a61e){return db['MailInteraction'][_0x14e1('0x2d')]({'where':{'id':_0x3010a8[_0x14e1('0x20')]['id']}})[_0x14e1('0x15')](handleEntityNotFound(_0x28a61e,null))['then'](function(_0x18893e){if(_0x18893e){return _0x18893e[_0x14e1('0x4a')](_0x3010a8[_0x14e1('0x24')][_0x14e1('0x32')]);}})[_0x14e1('0x15')](respondWithStatusCode(_0x28a61e,null))['catch'](handleError(_0x28a61e,null));};exports['download']=function(_0x18da1a,_0x53e5d4){var _0x5afea5=moment()[_0x14e1('0x4b')]()['toString']();var _0x2fa49f=path[_0x14e1('0x4c')](config[_0x14e1('0x4d')],_0x14e1('0x4e'),'files',_0x14e1('0x4f'));var _0x50aa6d=path[_0x14e1('0x4c')](config['root'],'server',_0x14e1('0x50'),_0x14e1('0x51'));var _0x3ebc85=path[_0x14e1('0x4c')](_0x2fa49f,_0x5afea5);var _0x2face3=util[_0x14e1('0x40')]('transcript-%d-%s.zip',_0x18da1a[_0x14e1('0x20')]['id'],_0x5afea5);var _0x371f6f=path[_0x14e1('0x4c')](_0x2fa49f,_0x2face3);var _0x2f5ecb=[];if(_0x18da1a[_0x14e1('0x24')][_0x14e1('0x51')]){_0x2f5ecb['push']({'model':db[_0x14e1('0x52')],'as':_0x14e1('0x53'),'raw':!![]});}var _0x3cc4f5=[{'model':db[_0x14e1('0x36')],'as':_0x14e1('0x54'),'attributes':['id','body',_0x14e1('0x55'),'to','cc',_0x14e1('0x56'),_0x14e1('0x57'),_0x14e1('0x58')],'where':{'secret':![]},'order':qs[_0x14e1('0x39')]('id'),'include':_0x2f5ecb}];return db[_0x14e1('0x19')][_0x14e1('0x2d')]({'where':{'id':_0x18da1a[_0x14e1('0x20')]['id']},'include':_0x3cc4f5})['then'](handleEntityNotFound(_0x53e5d4,null))['then'](function(_0x1dee82){if(_0x1dee82&&_0x1dee82['Messages']){var _0xcf0def=_0x1dee82['get']({'plain':!![]});fs[_0x14e1('0x59')](_0x3ebc85);return BPromise[_0x14e1('0x5a')](_0xcf0def['Messages'],function(_0x5a87c4,_0x37a5c6){var _0x17ccdb={'from':_0x5a87c4[_0x14e1('0x55')],'to':_0x5a87c4['to']||_0x14e1('0x5b'),'subject':_0x5a87c4['subject'],'html':htmlEntities['decode'](_0x5a87c4['body']),'headers':{'Date':moment(_0x5a87c4[_0x14e1('0x58')])[_0x14e1('0x40')](_0x14e1('0x5c'))},'attachments':[]};if(_0x5a87c4['cc']){_0x17ccdb[_0x14e1('0x5d')]['Cc']=_0x5a87c4['cc'];}if(_0x5a87c4[_0x14e1('0x56')]){_0x17ccdb[_0x14e1('0x5d')][_0x14e1('0x5e')]=_0x5a87c4[_0x14e1('0x56')];}return new BPromise(function(_0x59d712,_0x18374b){if(_0x5a87c4[_0x14e1('0x53')]){for(var _0x211bd1=0x0;_0x211bd1<_0x5a87c4[_0x14e1('0x53')][_0x14e1('0x28')];_0x211bd1++){var _0x2df1d9=_0x5a87c4[_0x14e1('0x53')][_0x211bd1];var _0x466871=path[_0x14e1('0x4c')](_0x50aa6d,_0x2df1d9[_0x14e1('0x5f')]);if(fs['existsSync'](_0x466871)){_0x17ccdb[_0x14e1('0x51')][_0x14e1('0x60')]({'name':_0x2df1d9[_0x14e1('0x17')],'contentType':_0x2df1d9['type'],'data':fs[_0x14e1('0x61')](_0x466871)});}}}emlformat[_0x14e1('0x62')](_0x17ccdb,function(_0x3c66ad,_0x493c54){if(_0x3c66ad)return _0x18374b(_0x3c66ad);fs['writeFileSync'](path[_0x14e1('0x4c')](_0x3ebc85,util[_0x14e1('0x40')](_0x14e1('0x63'),_0x37a5c6)),_0x493c54);return _0x59d712(_0x493c54);});});})[_0x14e1('0x15')](function(){return new BPromise(function(_0x3f8903,_0x5f3119){zipdir(_0x3ebc85,{'saveTo':_0x371f6f},function(_0x1dcf86,_0x4e288a){if(_0x1dcf86)return _0x5f3119(_0x1dcf86);return _0x3f8903(_0x4e288a);});})[_0x14e1('0x15')](function(){return new BPromise(function(_0x5aea13,_0x45fb5f){rimraf(_0x3ebc85,function(_0x3218c1){if(_0x3218c1)_0x45fb5f(_0x3218c1);return _0x5aea13();});});})[_0x14e1('0x15')](function(){return _0x53e5d4[_0x14e1('0x64')](_0x371f6f,_0x2face3,function(_0x59c724){if(!_0x59c724)fs[_0x14e1('0x65')](_0x371f6f);});});});}else{return _0x53e5d4[_0x14e1('0xe')](0xc8);}})[_0x14e1('0x1f')](handleError(_0x53e5d4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 499b768..d1a202c 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 _0xc756=['map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','getUsers','Users'];(function(_0x4de727,_0xddd42e){var _0x353383=function(_0x115446){while(--_0x115446){_0x4de727['push'](_0x4de727['shift']());}};_0x353383(++_0xddd42e);}(_0xc756,0x14f));var _0x6c75=function(_0x1fbe66,_0x601c47){_0x1fbe66=_0x1fbe66-0x0;var _0x444544=_0xc756[_0x1fbe66];return _0x444544;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x6c75('0x0')];var MailMessage=require(_0x6c75('0x1'))['db'][_0x6c75('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6c75('0x3')](0x0);var events={'afterCreate':_0x6c75('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1930e6){return function(_0x44333e,_0x2c6602,_0x26052b){_0x44333e[_0x6c75('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2e2295){_0x44333e['setDataValue'](_0x6c75('0x6'),_0x2e2295[_0x6c75('0x7')](function(_0x53ddae){return{'id':_0x53ddae['id']};}));return MailMessage[_0x6c75('0x8')]({'where':{'MailInteractionId':_0x44333e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c75('0x9')](function(_0x2fc7fc){_0x44333e[_0x6c75('0xa')](_0x6c75('0xb'),_0x2fc7fc[_0x6c75('0xc')]);MailInteractionEvents[_0x6c75('0xd')](_0x1930e6+':'+_0x44333e['id'],_0x44333e);MailInteractionEvents[_0x6c75('0xd')](_0x1930e6,_0x44333e);_0x26052b(null);})[_0x6c75('0xe')](_0x26052b(null));};}for(var e in events){if(events[_0x6c75('0xf')](e)){var event=events[e];MailInteraction[_0x6c75('0x10')](e,emitEvent(event));}}module[_0x6c75('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xd44e=['Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd44e,0x68));var _0xed44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd44e[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xed44('0x0'))['db'][_0xed44('0x1')];var MailMessage=require(_0xed44('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xed44('0x2')](0x0);var events={'afterCreate':_0xed44('0x3'),'afterUpdate':_0xed44('0x4'),'afterDestroy':_0xed44('0x5')};function emitEvent(_0x3eed45){return function(_0x5da30a,_0x549658,_0xc41d6a){_0x5da30a['getUsers']({'attributes':['id'],'raw':!![]})[_0xed44('0x6')](function(_0x2d22d1){_0x5da30a[_0xed44('0x7')](_0xed44('0x8'),_0x2d22d1[_0xed44('0x9')](function(_0x219943){return{'id':_0x219943['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5da30a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xed44('0x6')](function(_0x5b801a){_0x5da30a['setDataValue'](_0xed44('0xa'),_0x5b801a['length']);MailInteractionEvents[_0xed44('0xb')](_0x3eed45+':'+_0x5da30a['id'],_0x5da30a);MailInteractionEvents['emit'](_0x3eed45,_0x5da30a);_0xc41d6a(null);})[_0xed44('0xc')](_0xc41d6a(null));};}for(var e in events){if(events[_0xed44('0xd')](e)){var event=events[e];MailInteraction[_0xed44('0xe')](e,emitEvent(event));}}module[_0xed44('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b18fdda..792bc44 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 _0x7a25=['substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT'];(function(_0x34e3e0,_0x45f438){var _0x4a3584=function(_0x1345d9){while(--_0x1345d9){_0x34e3e0['push'](_0x34e3e0['shift']());}};_0x4a3584(++_0x45f438);}(_0x7a25,0xbb));var _0x57a2=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x7a25[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x57a2('0x0'));var util=require(_0x57a2('0x1'));var logger=require(_0x57a2('0x2'))(_0x57a2('0x3'));var moment=require('moment');var BPromise=require(_0x57a2('0x4'));var rp=require(_0x57a2('0x5'));var fs=require('fs');var path=require(_0x57a2('0x6'));var rimraf=require(_0x57a2('0x7'));var config=require(_0x57a2('0x8'));var attributes=require(_0x57a2('0x9'));module[_0x57a2('0xa')]=function(_0x38a7b5,_0x73c676){return _0x38a7b5[_0x57a2('0xb')](_0x57a2('0xc'),attributes,{'tableName':_0x57a2('0xd'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x57a2('0xe'),'to'],'type':_0x57a2('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x316281,_0x403057,_0x5c8333){if(_0x316281['substatus']){_0x316281[_0x57a2('0x10')]=moment()[_0x57a2('0x11')](_0x57a2('0x12'));}if(_0x316281[_0x57a2('0x13')]){_0x316281[_0x57a2('0x14')]=moment()[_0x57a2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c8333(null,_0x403057);},'beforeUpdate':function(_0x541211,_0x3da353,_0x1fe0c7){if(_0x541211[_0x57a2('0x15')](_0x57a2('0x16'))){_0x541211['substatusAt']=_0x541211[_0x57a2('0x16')]?moment()[_0x57a2('0x11')](_0x57a2('0x12')):null;}if(_0x541211['changed'](_0x57a2('0x13'))){_0x541211[_0x57a2('0x14')]=moment()[_0x57a2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x541211[_0x57a2('0x16')]=null;_0x541211[_0x57a2('0x10')]=null;}_0x1fe0c7(null,_0x541211);},'afterUpdate':function(_0x19c54a,_0x56c3d2,_0x556e6d){var _0x35fbbd=_0x38a7b5['models'];var _0x3e92ef=_0x19c54a[_0x57a2('0x17')]({'plain':!![]});if(_0x3e92ef[_0x57a2('0x13')]){return _0x35fbbd[_0x57a2('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3e92ef['id']}})[_0x57a2('0x19')](function(){_0x556e6d();})[_0x57a2('0x1a')](function(_0xa7eded){_0x556e6d(_0xa7eded);});}else{_0x556e6d();}}},'charset':_0x57a2('0x1b'),'collate':_0x57a2('0x1c')});}; \ No newline at end of file +var _0xddb4=['update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','./mailInteraction.attributes','exports','define','fti_mail_interactions','subject','FULLTEXT','substatus','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','substatusAt','changed','models'];(function(_0x272d1d,_0x3ec10e){var _0x35f59b=function(_0x4ffd51){while(--_0x4ffd51){_0x272d1d['push'](_0x272d1d['shift']());}};_0x35f59b(++_0x3ec10e);}(_0xddb4,0x123));var _0x4ddb=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xddb4[_0x2f62aa];return _0x1a341f;};'use strict';var _=require(_0x4ddb('0x0'));var util=require(_0x4ddb('0x1'));var logger=require(_0x4ddb('0x2'))(_0x4ddb('0x3'));var moment=require('moment');var BPromise=require(_0x4ddb('0x4'));var rp=require(_0x4ddb('0x5'));var fs=require('fs');var path=require(_0x4ddb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ddb('0x7'));module[_0x4ddb('0x8')]=function(_0x4d94dd,_0x237b1a){return _0x4d94dd[_0x4ddb('0x9')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x4ddb('0xa'),'fields':[_0x4ddb('0xb'),'to'],'type':_0x4ddb('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x970f7c,_0x224405,_0x441675){if(_0x970f7c[_0x4ddb('0xd')]){_0x970f7c['substatusAt']=moment()[_0x4ddb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x970f7c[_0x4ddb('0xf')]){_0x970f7c[_0x4ddb('0x10')]=moment()[_0x4ddb('0xe')](_0x4ddb('0x11'));}_0x441675(null,_0x224405);},'beforeUpdate':function(_0x40cfde,_0x713d80,_0x2ade45){if(_0x40cfde['changed']('substatus')){_0x40cfde[_0x4ddb('0x12')]=_0x40cfde[_0x4ddb('0xd')]?moment()[_0x4ddb('0xe')](_0x4ddb('0x11')):null;}if(_0x40cfde[_0x4ddb('0x13')](_0x4ddb('0xf'))){_0x40cfde[_0x4ddb('0x10')]=moment()[_0x4ddb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x40cfde[_0x4ddb('0xd')]=null;_0x40cfde[_0x4ddb('0x12')]=null;}_0x2ade45(null,_0x40cfde);},'afterUpdate':function(_0x8f83d2,_0x5c0e09,_0x15939f){var _0x29e3de=_0x4d94dd[_0x4ddb('0x14')];var _0x107858=_0x8f83d2['get']({'plain':!![]});if(_0x107858[_0x4ddb('0xf')]){return _0x29e3de['MailMessage'][_0x4ddb('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x107858['id']}})['then'](function(){_0x15939f();})['catch'](function(_0x3c5cbc){_0x15939f(_0x3c5cbc);});}else{_0x15939f();}}},'charset':_0x4ddb('0x16'),'collate':_0x4ddb('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0756ae7..ed455ff 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 _0xc23e=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','attributes','then','catch','AddTagsToMailInteraction','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xc23e,0x68));var _0xec23=function(_0xc01cc,_0x1d8e2d){_0xc01cc=_0xc01cc-0x0;var _0x6ea309=_0xc23e[_0xc01cc];return _0x6ea309;};'use strict';var _=require('lodash');var util=require(_0xec23('0x0'));var moment=require(_0xec23('0x1'));var BPromise=require(_0xec23('0x2'));var rs=require(_0xec23('0x3'));var fs=require('fs');var Redis=require(_0xec23('0x4'));var db=require(_0xec23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec23('0x6'))(_0xec23('0x7'));var config=require('../../config/environment');var jayson=require(_0xec23('0x8'));var client=jayson['client'][_0xec23('0x9')]({'port':0x232a});config[_0xec23('0xa')]=_['defaults'](config['redis'],{'host':_0xec23('0xb'),'port':0x18eb});var socket=require(_0xec23('0xc'))(new Redis(config[_0xec23('0xa')]));require(_0xec23('0xd'))[_0xec23('0xe')](socket);function respondWithRpcPromise(_0x5abb58,_0x2c820c,_0x127f06){return new BPromise(function(_0x11d1d9,_0x141329){return client[_0xec23('0xf')](_0x5abb58,_0x127f06)['then'](function(_0x1a5d7e){logger[_0xec23('0x10')](_0xec23('0x11'),_0x2c820c,_0xec23('0x12'));logger[_0xec23('0x13')](_0xec23('0x14'),_0x2c820c,'request\x20sent',JSON[_0xec23('0x15')](_0x1a5d7e));if(_0x1a5d7e['error']){if(_0x1a5d7e[_0xec23('0x16')][_0xec23('0x17')]===0x1f4){logger['error'](_0xec23('0x11'),_0x2c820c,_0x1a5d7e[_0xec23('0x16')][_0xec23('0x18')]);return _0x141329(_0x1a5d7e[_0xec23('0x16')][_0xec23('0x18')]);}logger[_0xec23('0x16')](_0xec23('0x11'),_0x2c820c,_0x1a5d7e[_0xec23('0x16')][_0xec23('0x18')]);return _0x11d1d9(_0x1a5d7e['error'][_0xec23('0x18')]);}else{logger[_0xec23('0x10')](_0xec23('0x11'),_0x2c820c,'request\x20sent');_0x11d1d9(_0x1a5d7e[_0xec23('0x19')]['message']);}})['catch'](function(_0x38b7e0){logger[_0xec23('0x16')](_0xec23('0x11'),_0x2c820c,_0x38b7e0);_0x141329(_0x38b7e0);});});}exports[_0xec23('0x1a')]=function(_0x456658){var _0x2ea9e2=this;return new Promise(function(_0x40a77c,_0x1f7727){return db[_0xec23('0x1b')][_0xec23('0x1c')](_0x456658[_0xec23('0x1d')],{'raw':_0x456658[_0xec23('0x1e')]?_0x456658['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456658[_0xec23('0x1e')]?_0x456658[_0xec23('0x1e')]['where']||null:null,'attributes':_0x456658['options']?_0x456658[_0xec23('0x1e')][_0xec23('0x1f')]||null:null,'limit':_0x456658[_0xec23('0x1e')]?_0x456658[_0xec23('0x1e')]['limit']||null:null})[_0xec23('0x20')](function(_0x525524){logger['info'](_0xec23('0x1a'),_0x456658);logger[_0xec23('0x13')](_0xec23('0x1a'),_0x456658,JSON[_0xec23('0x15')](_0x525524));_0x40a77c(_0x525524);})[_0xec23('0x21')](function(_0x3f7c99){logger[_0xec23('0x16')](_0xec23('0x1a'),_0x3f7c99[_0xec23('0x18')],_0x456658);_0x1f7727(_0x2ea9e2[_0xec23('0x16')](0x1f4,_0x3f7c99[_0xec23('0x18')]));});});};exports[_0xec23('0x22')]=function(_0x3126c1){return new Promise(function(_0x2884e2,_0x2a7fdc){return db[_0xec23('0x1b')]['find']({'where':_0x3126c1[_0xec23('0x1e')]?_0x3126c1[_0xec23('0x1e')][_0xec23('0x23')]||null:null})[_0xec23('0x20')](function(_0x50811b){if(_0x50811b){return _0x50811b[_0xec23('0x24')](_0x3126c1[_0xec23('0x1d')][_0xec23('0x25')],_[_0xec23('0x26')](_0x3126c1[_0xec23('0x1d')],[_0xec23('0x25'),'id'])||{});}})[_0xec23('0x27')](function(_0x5f061f){logger['info'](_0xec23('0x28'),_0x3126c1);logger[_0xec23('0x13')]('AddTags',_0x3126c1,JSON[_0xec23('0x15')](_0x5f061f));_0x2884e2(_0x5f061f);})[_0xec23('0x21')](function(_0x42b4e8){logger['error'](_0xec23('0x28'),_0x42b4e8['message'],_0x3126c1);_0x2a7fdc(_this['error'](0x1f4,_0x42b4e8[_0xec23('0x18')]));});});}; \ No newline at end of file +var _0xf446=['find','ids','omit','spread','AddTags','debug','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','redis','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailInteraction','body','options','raw','where','limit','UpdateMailInteraction','AddTagsToMailInteraction'];(function(_0x39e6fb,_0xb28aaa){var _0x15fd8f=function(_0x1790ed){while(--_0x1790ed){_0x39e6fb['push'](_0x39e6fb['shift']());}};_0x15fd8f(++_0xb28aaa);}(_0xf446,0x1c0));var _0x6f44=function(_0x244e02,_0xca80c3){_0x244e02=_0x244e02-0x0;var _0x35ea64=_0xf446[_0x244e02];return _0x35ea64;};'use strict';var _=require(_0x6f44('0x0'));var util=require('util');var moment=require(_0x6f44('0x1'));var BPromise=require(_0x6f44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f44('0x4'));var logger=require(_0x6f44('0x5'))('rpc');var config=require(_0x6f44('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6f44('0x7')]=_['defaults'](config[_0x6f44('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f44('0x7')]));require('./mailInteraction.socket')[_0x6f44('0x8')](socket);function respondWithRpcPromise(_0x290e60,_0x3879cb,_0x2dfe9d){return new BPromise(function(_0xf9405a,_0x35ec9b){return client[_0x6f44('0x9')](_0x290e60,_0x2dfe9d)[_0x6f44('0xa')](function(_0x4b5907){logger[_0x6f44('0xb')](_0x6f44('0xc'),_0x3879cb,_0x6f44('0xd'));logger['debug'](_0x6f44('0xe'),_0x3879cb,_0x6f44('0xd'),JSON[_0x6f44('0xf')](_0x4b5907));if(_0x4b5907[_0x6f44('0x10')]){if(_0x4b5907['error'][_0x6f44('0x11')]===0x1f4){logger['error'](_0x6f44('0xc'),_0x3879cb,_0x4b5907['error']['message']);return _0x35ec9b(_0x4b5907[_0x6f44('0x10')][_0x6f44('0x12')]);}logger[_0x6f44('0x10')](_0x6f44('0xc'),_0x3879cb,_0x4b5907[_0x6f44('0x10')][_0x6f44('0x12')]);return _0xf9405a(_0x4b5907[_0x6f44('0x10')][_0x6f44('0x12')]);}else{logger[_0x6f44('0xb')](_0x6f44('0xc'),_0x3879cb,_0x6f44('0xd'));_0xf9405a(_0x4b5907['result'][_0x6f44('0x12')]);}})[_0x6f44('0x13')](function(_0x40f74c){logger[_0x6f44('0x10')](_0x6f44('0xc'),_0x3879cb,_0x40f74c);_0x35ec9b(_0x40f74c);});});}exports['UpdateMailInteraction']=function(_0x1f4411){var _0x596924=this;return new Promise(function(_0x43ca38,_0x57d6a2){return db[_0x6f44('0x14')]['update'](_0x1f4411[_0x6f44('0x15')],{'raw':_0x1f4411[_0x6f44('0x16')]?_0x1f4411[_0x6f44('0x16')][_0x6f44('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4411[_0x6f44('0x16')]?_0x1f4411[_0x6f44('0x16')][_0x6f44('0x18')]||null:null,'attributes':_0x1f4411[_0x6f44('0x16')]?_0x1f4411[_0x6f44('0x16')]['attributes']||null:null,'limit':_0x1f4411['options']?_0x1f4411[_0x6f44('0x16')][_0x6f44('0x19')]||null:null})[_0x6f44('0xa')](function(_0x3cdc68){logger[_0x6f44('0xb')](_0x6f44('0x1a'),_0x1f4411);logger['debug'](_0x6f44('0x1a'),_0x1f4411,JSON[_0x6f44('0xf')](_0x3cdc68));_0x43ca38(_0x3cdc68);})['catch'](function(_0x568f8b){logger[_0x6f44('0x10')](_0x6f44('0x1a'),_0x568f8b[_0x6f44('0x12')],_0x1f4411);_0x57d6a2(_0x596924[_0x6f44('0x10')](0x1f4,_0x568f8b[_0x6f44('0x12')]));});});};exports[_0x6f44('0x1b')]=function(_0x4c994b){return new Promise(function(_0x2de691,_0x47feea){return db[_0x6f44('0x14')][_0x6f44('0x1c')]({'where':_0x4c994b[_0x6f44('0x16')]?_0x4c994b['options'][_0x6f44('0x18')]||null:null})[_0x6f44('0xa')](function(_0x4351ff){if(_0x4351ff){return _0x4351ff['addTags'](_0x4c994b['body'][_0x6f44('0x1d')],_[_0x6f44('0x1e')](_0x4c994b[_0x6f44('0x15')],['ids','id'])||{});}})[_0x6f44('0x1f')](function(_0x2a7c8b){logger[_0x6f44('0xb')](_0x6f44('0x20'),_0x4c994b);logger[_0x6f44('0x21')](_0x6f44('0x20'),_0x4c994b,JSON[_0x6f44('0xf')](_0x2a7c8b));_0x2de691(_0x2a7c8b);})[_0x6f44('0x13')](function(_0x222297){logger[_0x6f44('0x10')](_0x6f44('0x20'),_0x222297[_0x6f44('0x12')],_0x4c994b);_0x47feea(_this['error'](0x1f4,_0x222297['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f1c3c22..7471342 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 _0xd74a=['register','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x4d650f,_0x50314f){var _0x16ebc4=function(_0x49e084){while(--_0x49e084){_0x4d650f['push'](_0x4d650f['shift']());}};_0x16ebc4(++_0x50314f);}(_0xd74a,0x11a));var _0xad74=function(_0x5c5d7b,_0x1c8419){_0x5c5d7b=_0x5c5d7b-0x0;var _0xeb383=_0xd74a[_0x5c5d7b];return _0xeb383;};'use strict';var MailInteractionEvents=require(_0xad74('0x0'));var events=[_0xad74('0x1'),_0xad74('0x2'),_0xad74('0x3')];function createListener(_0x416f33,_0x4231b7){return function(_0x39c2af){_0x4231b7[_0xad74('0x4')](_0x416f33,_0x39c2af);};}function removeListener(_0x5f4d05,_0x2ebe98){return function(){MailInteractionEvents[_0xad74('0x5')](_0x5f4d05,_0x2ebe98);};}exports[_0xad74('0x6')]=function(_0x1e2681){for(var _0x5d1513=0x0,_0x2b4202=events['length'];_0x5d1513<_0x2b4202;_0x5d1513++){var _0x4df7ff=events[_0x5d1513];var _0x45b392=createListener(_0xad74('0x7')+_0x4df7ff,_0x1e2681);MailInteractionEvents['on'](_0x4df7ff,_0x45b392);}}; \ No newline at end of file +var _0xb283=['emit','removeListener','register','length','./mailInteraction.events','save','remove','update'];(function(_0x6e66d7,_0x2ea0f3){var _0x94ff03=function(_0x5bbb04){while(--_0x5bbb04){_0x6e66d7['push'](_0x6e66d7['shift']());}};_0x94ff03(++_0x2ea0f3);}(_0xb283,0x164));var _0x3b28=function(_0x4d7293,_0x185712){_0x4d7293=_0x4d7293-0x0;var _0x55a59d=_0xb283[_0x4d7293];return _0x55a59d;};'use strict';var MailInteractionEvents=require(_0x3b28('0x0'));var events=[_0x3b28('0x1'),_0x3b28('0x2'),_0x3b28('0x3')];function createListener(_0x815932,_0x29ab23){return function(_0x19e1da){_0x29ab23[_0x3b28('0x4')](_0x815932,_0x19e1da);};}function removeListener(_0x5ab7f4,_0x34d1d7){return function(){MailInteractionEvents[_0x3b28('0x5')](_0x5ab7f4,_0x34d1d7);};}exports[_0x3b28('0x6')]=function(_0x5f5395){for(var _0x226343=0x0,_0x1d4be5=events[_0x3b28('0x7')];_0x226343<_0x1d4be5;_0x226343++){var _0x525404=events[_0x226343];var _0x3bce57=createListener('mailInteraction:'+_0x525404,_0x5f5395);MailInteractionEvents['on'](_0x525404,_0x3bce57);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 09717ed..72c1735 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 _0x85cf=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','download','tracked','mail','create','put','/:id/accept','accept','/:id/reject','reject','destroy','util','path'];(function(_0x4c4363,_0x45e80e){var _0xc82c91=function(_0x5dc20c){while(--_0x5dc20c){_0x4c4363['push'](_0x4c4363['shift']());}};_0xc82c91(++_0x45e80e);}(_0x85cf,0x76));var _0xf85c=function(_0x24659c,_0x4d65a0){_0x24659c=_0x24659c-0x0;var _0x48c11c=_0x85cf[_0x24659c];return _0x48c11c;};'use strict';var multer=require('multer');var util=require(_0xf85c('0x0'));var path=require(_0xf85c('0x1'));var timeout=require(_0xf85c('0x2'));var express=require(_0xf85c('0x3'));var router=express[_0xf85c('0x4')]();var fs_extra=require(_0xf85c('0x5'));var auth=require(_0xf85c('0x6'));var interaction=require(_0xf85c('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xf85c('0x8')]('/',auth[_0xf85c('0x9')](),controller['index']);router[_0xf85c('0x8')](_0xf85c('0xa'),auth[_0xf85c('0x9')](),controller[_0xf85c('0xb')]);router[_0xf85c('0x8')](_0xf85c('0xc'),auth['isAuthenticated'](),controller[_0xf85c('0xd')]);router[_0xf85c('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xf85c('0xe')]);router['post']('/',auth[_0xf85c('0x9')](),interaction[_0xf85c('0xf')](_0xf85c('0x10'),'mailmessage:create'),controller[_0xf85c('0x11')]);router[_0xf85c('0x12')](_0xf85c('0xc'),auth[_0xf85c('0x9')](),controller['update']);router[_0xf85c('0x12')](_0xf85c('0x13'),auth[_0xf85c('0x9')](),controller[_0xf85c('0x14')]);router['put'](_0xf85c('0x15'),auth['isAuthenticated'](),controller[_0xf85c('0x16')]);router['delete'](_0xf85c('0xc'),auth['isAuthenticated'](),controller[_0xf85c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x423c=['fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','show','/:id/download','post','tracked','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2a7849,_0x4adc0e){var _0x39f133=function(_0x1f8aef){while(--_0x1f8aef){_0x2a7849['push'](_0x2a7849['shift']());}};_0x39f133(++_0x4adc0e);}(_0x423c,0x91));var _0xc423=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x423c[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xc423('0x0'));var util=require('util');var path=require(_0xc423('0x1'));var timeout=require(_0xc423('0x2'));var express=require(_0xc423('0x3'));var router=express[_0xc423('0x4')]();var fs_extra=require(_0xc423('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc423('0x6'));var controller=require(_0xc423('0x7'));router[_0xc423('0x8')]('/',auth[_0xc423('0x9')](),controller['index']);router[_0xc423('0x8')](_0xc423('0xa'),auth[_0xc423('0x9')](),controller['describe']);router['get']('/:id',auth[_0xc423('0x9')](),controller[_0xc423('0xb')]);router['get'](_0xc423('0xc'),auth[_0xc423('0x9')](),controller['download']);router[_0xc423('0xd')]('/',auth['isAuthenticated'](),interaction[_0xc423('0xe')]('mail',_0xc423('0xf')),controller['create']);router[_0xc423('0x10')]('/:id',auth[_0xc423('0x9')](),controller[_0xc423('0x11')]);router[_0xc423('0x10')](_0xc423('0x12'),auth[_0xc423('0x9')](),controller[_0xc423('0x13')]);router[_0xc423('0x10')](_0xc423('0x14'),auth[_0xc423('0x9')](),controller[_0xc423('0x15')]);router[_0xc423('0x16')]('/:id',auth[_0xc423('0x9')](),controller[_0xc423('0x17')]);module[_0xc423('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index bd42e60..fcc553c 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 _0x2912=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','lodash'];(function(_0xcb8bb4,_0x2238ec){var _0x54113d=function(_0x619ea){while(--_0x619ea){_0xcb8bb4['push'](_0xcb8bb4['shift']());}};_0x54113d(++_0x2238ec);}(_0x2912,0x15b));var _0x2291=function(_0x9d3c77,_0x1dc75d){_0x9d3c77=_0x9d3c77-0x0;var _0x1043b2=_0x2912[_0x9d3c77];return _0x1043b2;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2291('0x0'));module[_0x2291('0x1')]={'body':{'type':Sequelize[_0x2291('0x2')](_0x2291('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2291('0x2')](_0x2291('0x4'))},'read':{'type':Sequelize[_0x2291('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2291('0x6')]('in',_0x2291('0x7')),'defaultValue':_0x2291('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2291('0x8')](0x1fe)},'from':{'type':Sequelize[_0x2291('0x8')]},'to':{'type':Sequelize[_0x2291('0x2')](_0x2291('0x3'))},'cc':{'type':Sequelize[_0x2291('0x2')](_0x2291('0x3'))},'bcc':{'type':Sequelize[_0x2291('0x2')](_0x2291('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x2291('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2291('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2291('0xa')]},'originTo':{'type':Sequelize[_0x2291('0x2')](_0x2291('0x3'))},'originCc':{'type':Sequelize[_0x2291('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x2291('0xb'),'Chat'),'defaultValue':_0x2291('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x4b17=['out','STRING','DATE','INTEGER','ENUM','Email','Chat','sequelize','exports','long','TEXT','BOOLEAN'];(function(_0x26926b,_0x9c46d5){var _0x10f236=function(_0x36a610){while(--_0x36a610){_0x26926b['push'](_0x26926b['shift']());}};_0x10f236(++_0x9c46d5);}(_0x4b17,0x10f));var _0x74b1=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x4b17[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require(_0x74b1('0x0'));var _=require('lodash');module[_0x74b1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x74b1('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x74b1('0x3')]('medium')},'read':{'type':Sequelize[_0x74b1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x74b1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x74b1('0x6')](0x1fe)},'from':{'type':Sequelize[_0x74b1('0x6')]},'to':{'type':Sequelize[_0x74b1('0x3')](_0x74b1('0x2'))},'cc':{'type':Sequelize[_0x74b1('0x3')](_0x74b1('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x74b1('0x2'))},'subject':{'type':Sequelize[_0x74b1('0x3')]},'sentAt':{'type':Sequelize[_0x74b1('0x7')]},'attach':{'type':Sequelize[_0x74b1('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x74b1('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x74b1('0x3')](_0x74b1('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0x74b1('0x2'))},'originChannel':{'type':Sequelize[_0x74b1('0x9')](_0x74b1('0xa'),_0x74b1('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e65daff..2bbac65 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 _0xdb71=['lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','offset','undefined','limit','count','set','json','then','destroy','end','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','update','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','attachments','join','server/files/attachments','defaults','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','UserId','user','agent','get','MailInteractionId','isNil','[MAILMESSAGE: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','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','mail','MailInteraction','rejectMessage','internal','reject','rejectmessage','download','unix','toString','root','server','files','tmp','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment'];(function(_0x1c3b1b,_0xbacb42){var _0x4ec334=function(_0x545b38){while(--_0x545b38){_0x1c3b1b['push'](_0x1c3b1b['shift']());}};_0x4ec334(++_0xbacb42);}(_0xdb71,0x1c9));var _0x1db7=function(_0x2aee0a,_0x3e5333){_0x2aee0a=_0x2aee0a-0x0;var _0x2362f5=_0xdb71[_0x2aee0a];return _0x2362f5;};'use strict';var emlformat=require(_0x1db7('0x0'));var moment=require(_0x1db7('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x1db7('0x2'));var Redis=require(_0x1db7('0x3'));var htmlToText=require(_0x1db7('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var interaction_log=require(_0x1db7('0x5'))(_0x1db7('0x6'));var config=require(_0x1db7('0x7'));var db=require(_0x1db7('0x8'))['db'];config['redis']=_['defaults'](config[_0x1db7('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x1db7('0xa')](socket);var jayson=require(_0x1db7('0xb'));var client=jayson['client'][_0x1db7('0xc')]({'port':0x232c});var client9003=jayson[_0x1db7('0xd')][_0x1db7('0xc')]({'port':0x232b});var client9002=jayson[_0x1db7('0xd')][_0x1db7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e0789,_0x1d1520,_0x40a480,_0x2d5dc5){return new BPromise(function(_0x4e3cfa,_0x5d7a1b){var _0x497a6d=_0x2d5dc5||client;return _0x497a6d[_0x1db7('0xe')](_0x4e0789,_0x40a480)['then'](function(_0x2fc59e){logger[_0x1db7('0xf')](_0x1db7('0x10'),_0x1d1520,_0x1db7('0x11'));logger[_0x1db7('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1d1520,'request\x20sent',JSON[_0x1db7('0x13')](_0x2fc59e));if(_0x2fc59e[_0x1db7('0x14')]){if(_0x2fc59e['error'][_0x1db7('0x15')]===0x1f4){logger[_0x1db7('0x14')](_0x1db7('0x10'),_0x1d1520,_0x2fc59e[_0x1db7('0x14')][_0x1db7('0x16')]);return _0x5d7a1b(_0x2fc59e['error'][_0x1db7('0x16')]);}logger['error'](_0x1db7('0x10'),_0x1d1520,_0x2fc59e['error'][_0x1db7('0x16')]);return _0x4e3cfa(_0x2fc59e[_0x1db7('0x14')][_0x1db7('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x1d1520,_0x1db7('0x11'));_0x4e3cfa(_0x2fc59e['result'][_0x1db7('0x16')]);}})[_0x1db7('0x17')](function(_0x22d8ba){logger[_0x1db7('0x14')]('MailMessage,\x20%s,\x20%s',_0x1d1520,_0x22d8ba);_0x5d7a1b(_0x22d8ba);});});}function respondWithResult(_0x3db2d5,_0xd36b50){_0xd36b50=_0xd36b50||0xc8;return function(_0x5d4b6d){if(_0x5d4b6d){return _0x3db2d5[_0x1db7('0x18')](_0xd36b50)['json'](_0x5d4b6d);}};}function respondWithFilteredResult(_0x15a3f0,_0x4997ab){return function(_0x2f5f57){if(_0x2f5f57){var _0x15facb=typeof _0x4997ab[_0x1db7('0x19')]===_0x1db7('0x1a')&&typeof _0x4997ab[_0x1db7('0x1b')]==='undefined';var _0x22f864=_0x2f5f57[_0x1db7('0x1c')];var _0x53bc23=_0x15facb?0x0:_0x4997ab[_0x1db7('0x19')];var _0x2bd1c2=_0x15facb?_0x2f5f57[_0x1db7('0x1c')]:_0x4997ab[_0x1db7('0x19')]+_0x4997ab[_0x1db7('0x1b')];var _0x277e0a;if(_0x2bd1c2>=_0x22f864){_0x2bd1c2=_0x22f864;_0x277e0a=0xc8;}else{_0x277e0a=0xce;}_0x15a3f0['status'](_0x277e0a);return _0x15a3f0[_0x1db7('0x1d')]('Content-Range',_0x53bc23+'-'+_0x2bd1c2+'/'+_0x22f864)[_0x1db7('0x1e')](_0x2f5f57);}return null;};}function saveUpdates(_0x1f526b){return function(_0xb1be79){if(_0xb1be79){return _0xb1be79['update'](_0x1f526b)[_0x1db7('0x1f')](function(_0x12ba6b){return _0x12ba6b;});}return null;};}function removeEntity(_0x5d840b){return function(_0x451312){if(_0x451312){return _0x451312[_0x1db7('0x20')]()[_0x1db7('0x1f')](function(){_0x5d840b[_0x1db7('0x18')](0xcc)[_0x1db7('0x21')]();});}};}function handleEntityNotFound(_0x6bf42b){return function(_0x39a03a){if(!_0x39a03a){_0x6bf42b['sendStatus'](0x194);}return _0x39a03a;};}function handleError(_0x384a22,_0x2b2302){_0x2b2302=_0x2b2302||0x1f4;return function(_0x5f280f){logger['error'](_0x5f280f[_0x1db7('0x22')]);if(_0x5f280f[_0x1db7('0x23')]){delete _0x5f280f[_0x1db7('0x23')];}_0x384a22[_0x1db7('0x18')](_0x2b2302)[_0x1db7('0x24')](_0x5f280f);};}exports[_0x1db7('0x25')]=function(_0x753832,_0x512739){var _0x26a2fc={},_0x2102c9={},_0x4384f0={'count':0x0,'rows':[]};var _0x1b2a4d=_['map'](db[_0x1db7('0x26')][_0x1db7('0x27')],function(_0x33385f){return{'name':_0x33385f[_0x1db7('0x28')],'type':_0x33385f['type'][_0x1db7('0x29')]};});_0x2102c9[_0x1db7('0x2a')]=_[_0x1db7('0x2b')](_0x1b2a4d,_0x1db7('0x23'));_0x2102c9[_0x1db7('0x2c')]=_[_0x1db7('0x2d')](_0x753832[_0x1db7('0x2c')]);_0x2102c9['filters']=_[_0x1db7('0x2e')](_0x2102c9[_0x1db7('0x2a')],_0x2102c9[_0x1db7('0x2c')]);_0x26a2fc[_0x1db7('0x2f')]=_[_0x1db7('0x2e')](_0x2102c9[_0x1db7('0x2a')],qs[_0x1db7('0x30')](_0x753832[_0x1db7('0x2c')][_0x1db7('0x30')]));_0x26a2fc[_0x1db7('0x2f')]=_0x26a2fc['attributes'][_0x1db7('0x31')]?_0x26a2fc[_0x1db7('0x2f')]:_0x2102c9[_0x1db7('0x2a')];if(!_0x753832[_0x1db7('0x2c')][_0x1db7('0x32')](_0x1db7('0x33'))){_0x26a2fc[_0x1db7('0x1b')]=qs[_0x1db7('0x1b')](_0x753832['query']['limit']);_0x26a2fc[_0x1db7('0x19')]=qs['offset'](_0x753832['query'][_0x1db7('0x19')]);}_0x26a2fc[_0x1db7('0x34')]=qs[_0x1db7('0x35')](_0x753832['query'][_0x1db7('0x35')]);_0x26a2fc[_0x1db7('0x36')]=qs[_0x1db7('0x37')](_[_0x1db7('0x38')](_0x753832[_0x1db7('0x2c')],_0x2102c9[_0x1db7('0x37')]),_0x1b2a4d);if(_0x753832[_0x1db7('0x2c')][_0x1db7('0x39')]){_0x26a2fc[_0x1db7('0x36')]=_[_0x1db7('0x3a')](_0x26a2fc[_0x1db7('0x36')],{'$or':_[_0x1db7('0x2b')](_0x1b2a4d,function(_0x535488){if(_0x535488[_0x1db7('0x3b')]!==_0x1db7('0x3c')){var _0x1bc84f={};_0x1bc84f[_0x535488[_0x1db7('0x23')]]={'$like':'%'+_0x753832['query']['filter']+'%'};return _0x1bc84f;}})});}_0x26a2fc=_[_0x1db7('0x3a')]({},_0x26a2fc,_0x753832[_0x1db7('0x3d')]);var _0x53c472={'where':_0x26a2fc[_0x1db7('0x36')]};return db[_0x1db7('0x26')][_0x1db7('0x1c')](_0x53c472)[_0x1db7('0x1f')](function(_0x271a7a){_0x4384f0[_0x1db7('0x1c')]=_0x271a7a;if(_0x753832['query'][_0x1db7('0x3e')]){_0x26a2fc[_0x1db7('0x3f')]=[{'all':!![]}];}return db[_0x1db7('0x26')]['findAll'](_0x26a2fc);})[_0x1db7('0x1f')](function(_0xb0e5f0){_0x4384f0[_0x1db7('0x40')]=_0xb0e5f0;return _0x4384f0;})[_0x1db7('0x1f')](respondWithFilteredResult(_0x512739,_0x26a2fc))[_0x1db7('0x17')](handleError(_0x512739,null));};exports[_0x1db7('0x41')]=function(_0xb6b737,_0x30af9f){var _0x2351cc={'raw':!![],'where':{'id':_0xb6b737[_0x1db7('0x42')]['id']}},_0x38cfb3={};_0x38cfb3[_0x1db7('0x2a')]=_[_0x1db7('0x2d')](db[_0x1db7('0x26')][_0x1db7('0x27')]);_0x38cfb3['query']=_[_0x1db7('0x2d')](_0xb6b737['query']);_0x38cfb3[_0x1db7('0x37')]=_[_0x1db7('0x2e')](_0x38cfb3['model'],_0x38cfb3[_0x1db7('0x2c')]);_0x2351cc[_0x1db7('0x2f')]=_[_0x1db7('0x2e')](_0x38cfb3['model'],qs['fields'](_0xb6b737['query'][_0x1db7('0x30')]));_0x2351cc[_0x1db7('0x2f')]=_0x2351cc[_0x1db7('0x2f')][_0x1db7('0x31')]?_0x2351cc[_0x1db7('0x2f')]:_0x38cfb3[_0x1db7('0x2a')];if(_0xb6b737['query'][_0x1db7('0x3e')]){_0x2351cc[_0x1db7('0x3f')]=[{'all':!![]}];}_0x2351cc=_[_0x1db7('0x3a')]({},_0x2351cc,_0xb6b737[_0x1db7('0x3d')]);return db[_0x1db7('0x26')][_0x1db7('0x43')](_0x2351cc)[_0x1db7('0x1f')](handleEntityNotFound(_0x30af9f,null))['then'](respondWithResult(_0x30af9f,null))[_0x1db7('0x17')](handleError(_0x30af9f,null));};exports[_0x1db7('0x44')]=function(_0x3a41cd,_0x3a87da){if(_0x3a41cd[_0x1db7('0x45')]['id']){delete _0x3a41cd[_0x1db7('0x45')]['id'];}return db[_0x1db7('0x26')]['find']({'where':{'id':_0x3a41cd[_0x1db7('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a87da,null))['then'](saveUpdates(_0x3a41cd['body'],null))[_0x1db7('0x1f')](respondWithResult(_0x3a87da,null))[_0x1db7('0x17')](handleError(_0x3a87da,null));};exports[_0x1db7('0x20')]=function(_0xa68037,_0x5d3d1d){return db['MailMessage'][_0x1db7('0x43')]({'where':{'id':_0xa68037[_0x1db7('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d3d1d,null))[_0x1db7('0x1f')](removeEntity(_0x5d3d1d,null))[_0x1db7('0x17')](handleError(_0x5d3d1d,null));};exports[_0x1db7('0x46')]=function(_0x177fc8,_0x17c678){return db[_0x1db7('0x26')]['describe']()[_0x1db7('0x1f')](respondWithResult(_0x17c678,null))[_0x1db7('0x17')](handleError(_0x17c678,null));};exports[_0x1db7('0x47')]=function(_0x5db859,_0x40ce97){return db['MailMessage'][_0x1db7('0x47')](_0x5db859['body'])[_0x1db7('0x1f')](function(_0x105e2a){if(_0x105e2a){if(_0x105e2a[_0x1db7('0x48')]===_0x1db7('0x49')&&!_0x105e2a[_0x1db7('0x4a')]){var _0x48563a,_0x5aafa7,_0x142525;if(_0x5db859[_0x1db7('0x45')]['to']){_0x5aafa7=_0x5db859[_0x1db7('0x45')]['to'][_0x1db7('0x4b')](',')[0x0];}return db['MailAccount'][_0x1db7('0x4c')]({'where':{'id':_0x105e2a[_0x1db7('0x4d')]},'include':[{'model':db[_0x1db7('0x4e')],'as':_0x1db7('0x4f'),'include':[{'model':db[_0x1db7('0x50')],'as':_0x1db7('0x51'),'where':{'email':_0x5aafa7},'limit':0x1,'order':[[_0x1db7('0x52'),'DESC']]}]},{'model':db[_0x1db7('0x53')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1db7('0x54')],'as':_0x1db7('0x54'),'raw':!![]}]}]})[_0x1db7('0x1f')](function(_0x54cb60){_0x48563a=_0x54cb60;if(!_0x48563a||!_0x48563a['Smtp'])return;var _0x2b3f75=_0x48563a['getSmtpOptions']();if(_0x5db859[_0x1db7('0x45')]['attachments']&&_0x5db859[_0x1db7('0x45')][_0x1db7('0x55')][_0x1db7('0x31')]){for(var _0x1566a7=0x0;_0x1566a7<_0x5db859[_0x1db7('0x45')][_0x1db7('0x55')][_0x1db7('0x31')];_0x1566a7+=0x1){_0x5db859[_0x1db7('0x45')][_0x1db7('0x55')][_0x1566a7]={'filename':_0x5db859[_0x1db7('0x45')][_0x1db7('0x55')][_0x1566a7][_0x1db7('0x23')],'path':path[_0x1db7('0x56')](config['root'],_0x1db7('0x57'),_0x5db859[_0x1db7('0x45')]['attachments'][_0x1566a7]['basename'])};}}_0x142525={'account':_0x2b3f75,'message':_0x5db859['body']};return;})[_0x1db7('0x1f')](function(){if(_0x48563a[_0x1db7('0x4f')]){if(_0x48563a[_0x1db7('0x4f')][_0x1db7('0x51')]['length']){return _0x48563a['List'][_0x1db7('0x51')][0x0];}else{return db['CmContact'][_0x1db7('0x47')](_[_0x1db7('0x58')](_0x5db859[_0x1db7('0x45')],{'firstName':_0x5db859['body']['to'],'email':_0x5db859[_0x1db7('0x45')]['to'],'phone':_0x5db859[_0x1db7('0x45')]['to'],'ListId':_0x48563a['ListId']}));}}else{throw new Error(_0x1db7('0x59'));}})['then'](function(){if(_0x142525){return respondWithRpcPromise(_0x1db7('0x5a'),_0x1db7('0x5b'),_0x142525,client9003)[_0x1db7('0x1f')](function(_0x199432){return _0x105e2a[_0x1db7('0x44')]({'read':!![],'messageId':_0x199432['messageId'],'sentAt':moment()[_0x1db7('0x5c')](_0x1db7('0x5d'))});})[_0x1db7('0x17')](function(_0x116c08){logger[_0x1db7('0x14')]('%s',JSON['stringify'](_0x116c08));return _0x105e2a;});}return _0x105e2a;});}return _0x105e2a;}})['then'](respondWithResult(_0x40ce97,0xc9))[_0x1db7('0x17')](handleError(_0x40ce97,null));};exports[_0x1db7('0x5e')]=function(_0x44590d,_0x1832a5){var _0x2af496={'agent':{},'channel':'mail'};if(_0x44590d[_0x1db7('0x45')]['id']){delete _0x44590d[_0x1db7('0x45')]['id'];}_0x44590d[_0x1db7('0x45')][_0x1db7('0x5f')]=!![];_0x44590d[_0x1db7('0x45')]['readAt']=moment()['format'](_0x1db7('0x5d'));_0x44590d[_0x1db7('0x45')][_0x1db7('0x60')]=_0x44590d['body'][_0x1db7('0x60')]||_0x44590d[_0x1db7('0x61')]['id'];_0x2af496[_0x1db7('0x62')]['id']=_0x44590d['body'][_0x1db7('0x60')];return db[_0x1db7('0x26')][_0x1db7('0x43')]({'where':{'id':_0x44590d[_0x1db7('0x42')]['id'],'UserId':null}})[_0x1db7('0x1f')](handleEntityNotFound(_0x1832a5,null))[_0x1db7('0x1f')](saveUpdates(_0x44590d[_0x1db7('0x45')],null))[_0x1db7('0x1f')](function(_0x424879){if(_0x424879){_0x2af496[_0x1db7('0x16')]=_0x424879[_0x1db7('0x63')]({'plain':!![]});return db['MailInteraction'][_0x1db7('0x43')]({'where':{'id':_0x424879[_0x1db7('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1832a5,null))['then'](function(_0x38ff68){if(_0x38ff68){return _0x38ff68[_0x1db7('0x44')]({'UserId':_0x44590d['body'][_0x1db7('0x60')],'read1stAt':_[_0x1db7('0x65')](_0x38ff68['read1stAt'])?moment()[_0x1db7('0x5c')](_0x1db7('0x5d')):undefined});}return null;})[_0x1db7('0x1f')](function(_0x1359d8){if(_0x1359d8){_0x2af496['interaction']=_0x1359d8['get']({'plain':!![]});interaction_log[_0x1db7('0xf')](_0x1db7('0x66'),_0x44590d[_0x1db7('0x61')]['id'],_0x44590d[_0x1db7('0x61')][_0x1db7('0x23')],_0x44590d[_0x1db7('0x61')][_0x1db7('0x67')],_0x2af496[_0x1db7('0x68')]['id'],_0x44590d['body']?JSON[_0x1db7('0x13')](_0x44590d[_0x1db7('0x45')]):_0x1db7('0x69'));return respondWithRpcPromise(_0x1db7('0x6a'),_0x1db7('0x6b'),_0x2af496);}return null;})['then'](function(_0x21d01c){var _0x2fdffa=_0x1db7('0x6c')+_0x21d01c[_0x1db7('0x16')][_0x1db7('0x6d')];return db[_0x1db7('0x6e')][_0x1db7('0x2c')](_0x2fdffa,{'type':db['Sequelize'][_0x1db7('0x6f')][_0x1db7('0x70')],'raw':!![]})[_0x1db7('0x1f')](function(_0x367ed1){return _0x367ed1;});})['then'](function(_0x3578e3){if(_0x3578e3){_0x2af496[_0x1db7('0x16')][_0x1db7('0x71')]=_0x3578e3[0x0];if(!_0x44590d['body'][_0x1db7('0x60')])return;return db[_0x1db7('0x72')]['find']({'where':{'id':_0x44590d[_0x1db7('0x45')][_0x1db7('0x60')],'role':'agent'},'attributes':['id',_0x1db7('0x23'),_0x1db7('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x1db7('0x1f')](function(_0x4ea679){if(!_0x4ea679)return null;_0x2af496[_0x1db7('0x16')][_0x1db7('0x62')]=_0x4ea679;return _0x2af496;})[_0x1db7('0x1f')](function(_0x80d96a){if(_0x80d96a){if(_0x44590d['body'][_0x1db7('0x74')]){_0x2af496[_0x1db7('0x16')][_0x1db7('0x75')]=util[_0x1db7('0x5c')](_0x1db7('0x76'),_0x44590d['user']['name']);_0x2af496[_0x1db7('0x16')][_0x1db7('0x77')]=_0x2af496[_0x1db7('0x77')];_0x2af496['message'][_0x1db7('0x78')]=_0x2af496['channel'];_0x2af496[_0x1db7('0x16')][_0x1db7('0x79')]=_0x1db7('0x5e');_0x2af496[_0x1db7('0x16')][_0x1db7('0x45')]=htmlToText[_0x1db7('0x7a')](_0x2af496['message'][_0x1db7('0x45')]);return respondWithRpcPromise('EventManager',_0x1db7('0x7b'),{'event':_0x1db7('0x7c'),'message':_0x2af496[_0x1db7('0x16')]},client9002)[_0x1db7('0x1f')](function(){return _0x2af496;});}return _0x2af496;}return null;})['then'](respondWithResult(_0x1832a5,null))[_0x1db7('0x17')](handleError(_0x1832a5,null));};exports['reject']=function(_0x5f92be,_0x35e8ce){var _0x5b7823={'agent':{},'channel':_0x1db7('0x7d')};if(_0x5f92be[_0x1db7('0x45')]['id']){delete _0x5f92be[_0x1db7('0x45')]['id'];}_0x5f92be[_0x1db7('0x45')]['UserId']=_0x5f92be['body'][_0x1db7('0x60')]||_0x5f92be[_0x1db7('0x61')]['id'];_0x5b7823[_0x1db7('0x62')]['id']=_0x5f92be[_0x1db7('0x45')][_0x1db7('0x60')];return db[_0x1db7('0x26')][_0x1db7('0x43')]({'where':{'id':_0x5f92be[_0x1db7('0x42')]['id'],'UserId':null}})[_0x1db7('0x1f')](handleEntityNotFound(_0x35e8ce,null))[_0x1db7('0x1f')](function(_0x1031c4){if(_0x1031c4){_0x5b7823[_0x1db7('0x16')]=_0x1031c4['get']({'plain':!![]});return db[_0x1db7('0x7e')][_0x1db7('0x43')]({'where':{'id':_0x1031c4['MailInteractionId']}});}return null;})[_0x1db7('0x1f')](handleEntityNotFound(_0x35e8ce,null))[_0x1db7('0x1f')](function(_0x4d99fe){if(_0x4d99fe){_0x5b7823[_0x1db7('0x68')]=_0x4d99fe[_0x1db7('0x63')]({'plain':!![]});interaction_log[_0x1db7('0xf')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5f92be[_0x1db7('0x61')]['id'],_0x5f92be[_0x1db7('0x61')][_0x1db7('0x23')],_0x5f92be[_0x1db7('0x61')]['role'],_0x5b7823[_0x1db7('0x68')]['id'],_0x5f92be[_0x1db7('0x45')]?JSON[_0x1db7('0x13')](_0x5f92be[_0x1db7('0x45')]):'null');return respondWithRpcPromise('RejectMessage',_0x1db7('0x7f'),_0x5b7823);}return null;})['then'](function(_0x16a0d6){var _0x51a6ef=_0x1db7('0x6c')+_0x16a0d6[_0x1db7('0x16')][_0x1db7('0x6d')];return db[_0x1db7('0x6e')][_0x1db7('0x2c')](_0x51a6ef,{'type':db['Sequelize'][_0x1db7('0x6f')][_0x1db7('0x70')],'raw':!![]})[_0x1db7('0x1f')](function(_0x598bad){return _0x598bad;});})[_0x1db7('0x1f')](function(_0xa44d77){if(_0xa44d77){_0x5b7823[_0x1db7('0x16')]['contact']=_0xa44d77[0x0];if(!_0x5f92be[_0x1db7('0x45')][_0x1db7('0x60')])return;return db['User'][_0x1db7('0x43')]({'where':{'id':_0x5f92be[_0x1db7('0x45')][_0x1db7('0x60')],'role':_0x1db7('0x62')},'attributes':['id',_0x1db7('0x23'),_0x1db7('0x73'),'email',_0x1db7('0x80')],'raw':!![]});}return null;})[_0x1db7('0x1f')](function(_0x4beb4a){if(!_0x4beb4a)return null;_0x5b7823[_0x1db7('0x16')][_0x1db7('0x62')]=_0x4beb4a;return _0x5b7823;})[_0x1db7('0x1f')](function(_0x4552d3){if(_0x4552d3){_0x4552d3[_0x1db7('0x16')][_0x1db7('0x75')]=util[_0x1db7('0x5c')](_0x1db7('0x76'),_0x5f92be[_0x1db7('0x61')][_0x1db7('0x23')]);_0x4552d3[_0x1db7('0x16')][_0x1db7('0x77')]=_0x5b7823[_0x1db7('0x77')];_0x4552d3[_0x1db7('0x16')][_0x1db7('0x78')]=_0x5b7823['channel'];_0x4552d3[_0x1db7('0x16')][_0x1db7('0x79')]=_0x1db7('0x81');_0x4552d3[_0x1db7('0x16')][_0x1db7('0x45')]=htmlToText[_0x1db7('0x7a')](_0x5b7823[_0x1db7('0x16')]['body']);respondWithRpcPromise('EventManager',_0x1db7('0x7b'),{'event':_0x1db7('0x82'),'message':_0x4552d3[_0x1db7('0x16')]},client9002);return _0x5b7823;}return null;})[_0x1db7('0x1f')](respondWithResult(_0x35e8ce,null))[_0x1db7('0x17')](handleError(_0x35e8ce,null));};exports[_0x1db7('0x83')]=function(_0x30ce57,_0x58988e){var _0x1ab32b=moment()[_0x1db7('0x84')]()[_0x1db7('0x85')]();var _0x26c3a0=path[_0x1db7('0x56')](config[_0x1db7('0x86')],_0x1db7('0x87'),_0x1db7('0x88'),_0x1db7('0x89'));var _0x433ce2=path[_0x1db7('0x56')](config['root'],_0x1db7('0x87'),_0x1db7('0x88'),_0x1db7('0x55'));var _0x5338a4=util[_0x1db7('0x5c')]('message-%s.eml',_0x1ab32b);return db[_0x1db7('0x26')][_0x1db7('0x43')]({'where':{'id':_0x30ce57[_0x1db7('0x42')]['id']},'attributes':['id','body','from','to','cc',_0x1db7('0x8a'),_0x1db7('0x8b'),_0x1db7('0x8c')],'include':_0x30ce57[_0x1db7('0x2c')][_0x1db7('0x55')]?[{'model':db[_0x1db7('0x8d')],'as':_0x1db7('0x8e')}]:undefined})[_0x1db7('0x1f')](handleEntityNotFound(_0x58988e,null))[_0x1db7('0x1f')](function(_0x241abe){if(_0x241abe){var _0x39acd7=_0x241abe;var _0x1ea1da={'from':_0x39acd7[_0x1db7('0x8f')],'to':_0x39acd7['to'],'subject':_0x39acd7[_0x1db7('0x8b')],'html':htmlEntities['decode'](_0x39acd7['body']),'headers':{'Date':moment(_0x39acd7['createdAt'])['format'](_0x1db7('0x90'))},'attachments':[]};if(_0x241abe['cc']){_0x1ea1da['headers']['Cc']=_0x241abe['cc'];}if(_0x241abe[_0x1db7('0x8a')]){_0x1ea1da[_0x1db7('0x91')]['Bcc']=_0x241abe[_0x1db7('0x8a')];}return new BPromise(function(_0x2ef551,_0xa54bff){if(_0x241abe[_0x1db7('0x8e')]){for(var _0x2fadf0=0x0;_0x2fadf0<_0x241abe[_0x1db7('0x8e')]['length'];_0x2fadf0++){var _0x528c68=_0x241abe[_0x1db7('0x8e')][_0x2fadf0];var _0x47d24d=path[_0x1db7('0x56')](_0x433ce2,_0x528c68[_0x1db7('0x92')]);if(fs[_0x1db7('0x93')](_0x47d24d)){_0x1ea1da['attachments'][_0x1db7('0x94')]({'name':_0x528c68['name'],'contentType':_0x528c68[_0x1db7('0x3b')],'data':fs[_0x1db7('0x95')](_0x47d24d)});}}}emlformat[_0x1db7('0x96')](_0x1ea1da,function(_0x515ad1,_0xeb33c){if(_0x515ad1)return _0xa54bff(_0x515ad1);fs[_0x1db7('0x97')](path[_0x1db7('0x56')](_0x26c3a0,_0x5338a4),_0xeb33c);return _0x2ef551(_0xeb33c);});});}})[_0x1db7('0x1f')](function(_0x145d09){if(_0x145d09){return _0x58988e['download'](path['join'](_0x26c3a0,_0x5338a4),_0x5338a4,function(_0x2afb61){if(!_0x2afb61)fs[_0x1db7('0x98')](path['join'](_0x26c3a0,_0x5338a4));});}})['catch'](handleError(_0x58988e,null));}; \ No newline at end of file +var _0x0104=['where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','fields','body','find','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','mail','RejectMessage','Sequelize','motionChannel','rejectmessage','download','unix','tmp','server','files','message-%s.eml','subject','createdAt','Attachment','from','headers','Bcc','bcc','Attachments','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','type','key','keys','filters','query','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort'];(function(_0x188edb,_0x19fed6){var _0x669a3d=function(_0x40b5d9){while(--_0x40b5d9){_0x188edb['push'](_0x188edb['shift']());}};_0x669a3d(++_0x19fed6);}(_0x0104,0x64));var _0x4010=function(_0x5d2ee6,_0x172461){_0x5d2ee6=_0x5d2ee6-0x0;var _0x148dc1=_0x0104[_0x5d2ee6];return _0x148dc1;};'use strict';var emlformat=require(_0x4010('0x0'));var moment=require('moment');var BPromise=require(_0x4010('0x1'));var util=require(_0x4010('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x4010('0x3'));var Redis=require(_0x4010('0x4'));var htmlToText=require(_0x4010('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x4010('0x6'))(_0x4010('0x7'));var interaction_log=require(_0x4010('0x6'))(_0x4010('0x8'));var config=require(_0x4010('0x9'));var db=require(_0x4010('0xa'))['db'];config[_0x4010('0xb')]=_['defaults'](config[_0x4010('0xb')],{'host':_0x4010('0xc'),'port':0x18eb});var socket=require(_0x4010('0xd'))(new Redis(config[_0x4010('0xb')]));var htmlEntities=require(_0x4010('0xe'));require('./mailMessage.socket')[_0x4010('0xf')](socket);var jayson=require(_0x4010('0x10'));var client=jayson[_0x4010('0x11')][_0x4010('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x4010('0x12')]({'port':0x232b});var client9002=jayson[_0x4010('0x11')][_0x4010('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x27ab70,_0xce310b,_0x590ae7,_0x48c7a8){return new BPromise(function(_0x1b4ce6,_0x4c85f8){var _0x28d33d=_0x48c7a8||client;return _0x28d33d['request'](_0x27ab70,_0x590ae7)[_0x4010('0x13')](function(_0x484e13){logger['info'](_0x4010('0x14'),_0xce310b,'request\x20sent');logger[_0x4010('0x15')](_0x4010('0x16'),_0xce310b,_0x4010('0x17'),JSON['stringify'](_0x484e13));if(_0x484e13[_0x4010('0x18')]){if(_0x484e13[_0x4010('0x18')]['code']===0x1f4){logger[_0x4010('0x18')](_0x4010('0x14'),_0xce310b,_0x484e13[_0x4010('0x18')]['message']);return _0x4c85f8(_0x484e13[_0x4010('0x18')][_0x4010('0x19')]);}logger['error'](_0x4010('0x14'),_0xce310b,_0x484e13['error'][_0x4010('0x19')]);return _0x1b4ce6(_0x484e13['error']['message']);}else{logger[_0x4010('0x1a')]('MailMessage,\x20%s,\x20%s',_0xce310b,_0x4010('0x17'));_0x1b4ce6(_0x484e13[_0x4010('0x1b')][_0x4010('0x19')]);}})[_0x4010('0x1c')](function(_0x11df67){logger[_0x4010('0x18')](_0x4010('0x14'),_0xce310b,_0x11df67);_0x4c85f8(_0x11df67);});});}function respondWithResult(_0x1abd75,_0x25fceb){_0x25fceb=_0x25fceb||0xc8;return function(_0x25b0ee){if(_0x25b0ee){return _0x1abd75[_0x4010('0x1d')](_0x25fceb)['json'](_0x25b0ee);}};}function respondWithFilteredResult(_0x11be5c,_0x4d3d95){return function(_0x3baef8){if(_0x3baef8){var _0x3d8e92=typeof _0x4d3d95[_0x4010('0x1e')]==='undefined'&&typeof _0x4d3d95[_0x4010('0x1f')]===_0x4010('0x20');var _0x522cc2=_0x3baef8[_0x4010('0x21')];var _0x2280a4=_0x3d8e92?0x0:_0x4d3d95[_0x4010('0x1e')];var _0x310837=_0x3d8e92?_0x3baef8['count']:_0x4d3d95[_0x4010('0x1e')]+_0x4d3d95[_0x4010('0x1f')];var _0x5368b3;if(_0x310837>=_0x522cc2){_0x310837=_0x522cc2;_0x5368b3=0xc8;}else{_0x5368b3=0xce;}_0x11be5c['status'](_0x5368b3);return _0x11be5c[_0x4010('0x22')](_0x4010('0x23'),_0x2280a4+'-'+_0x310837+'/'+_0x522cc2)[_0x4010('0x24')](_0x3baef8);}return null;};}function saveUpdates(_0x2feadd){return function(_0x59f004){if(_0x59f004){return _0x59f004[_0x4010('0x25')](_0x2feadd)[_0x4010('0x13')](function(_0x4717be){return _0x4717be;});}return null;};}function removeEntity(_0x4ab654){return function(_0x2f4719){if(_0x2f4719){return _0x2f4719[_0x4010('0x26')]()['then'](function(){_0x4ab654[_0x4010('0x1d')](0xcc)[_0x4010('0x27')]();});}};}function handleEntityNotFound(_0x41e3e6){return function(_0x2d87e1){if(!_0x2d87e1){_0x41e3e6[_0x4010('0x28')](0x194);}return _0x2d87e1;};}function handleError(_0xd46ad0,_0x374321){_0x374321=_0x374321||0x1f4;return function(_0x3f3101){logger[_0x4010('0x18')](_0x3f3101[_0x4010('0x29')]);if(_0x3f3101[_0x4010('0x2a')]){delete _0x3f3101[_0x4010('0x2a')];}_0xd46ad0['status'](_0x374321)[_0x4010('0x2b')](_0x3f3101);};}exports[_0x4010('0x2c')]=function(_0x362f23,_0x437a43){var _0x261e70={},_0x452d47={},_0x220a1e={'count':0x0,'rows':[]};var _0x5c9b15=_[_0x4010('0x2d')](db[_0x4010('0x2e')]['rawAttributes'],function(_0x567a70){return{'name':_0x567a70['fieldName'],'type':_0x567a70[_0x4010('0x2f')][_0x4010('0x30')]};});_0x452d47['model']=_[_0x4010('0x2d')](_0x5c9b15,_0x4010('0x2a'));_0x452d47['query']=_[_0x4010('0x31')](_0x362f23['query']);_0x452d47[_0x4010('0x32')]=_['intersection'](_0x452d47['model'],_0x452d47[_0x4010('0x33')]);_0x261e70[_0x4010('0x34')]=_[_0x4010('0x35')](_0x452d47[_0x4010('0x36')],qs['fields'](_0x362f23[_0x4010('0x33')]['fields']));_0x261e70[_0x4010('0x34')]=_0x261e70['attributes'][_0x4010('0x37')]?_0x261e70[_0x4010('0x34')]:_0x452d47[_0x4010('0x36')];if(!_0x362f23[_0x4010('0x33')][_0x4010('0x38')](_0x4010('0x39'))){_0x261e70[_0x4010('0x1f')]=qs['limit'](_0x362f23[_0x4010('0x33')]['limit']);_0x261e70[_0x4010('0x1e')]=qs[_0x4010('0x1e')](_0x362f23[_0x4010('0x33')][_0x4010('0x1e')]);}_0x261e70[_0x4010('0x3a')]=qs['sort'](_0x362f23[_0x4010('0x33')][_0x4010('0x3b')]);_0x261e70[_0x4010('0x3c')]=qs[_0x4010('0x32')](_[_0x4010('0x3d')](_0x362f23[_0x4010('0x33')],_0x452d47['filters']),_0x5c9b15);if(_0x362f23[_0x4010('0x33')][_0x4010('0x3e')]){_0x261e70[_0x4010('0x3c')]=_[_0x4010('0x3f')](_0x261e70['where'],{'$or':_[_0x4010('0x2d')](_0x5c9b15,function(_0xc1ddf2){if(_0xc1ddf2[_0x4010('0x2f')]!==_0x4010('0x40')){var _0x2ee09e={};_0x2ee09e[_0xc1ddf2['name']]={'$like':'%'+_0x362f23[_0x4010('0x33')][_0x4010('0x3e')]+'%'};return _0x2ee09e;}})});}_0x261e70=_[_0x4010('0x3f')]({},_0x261e70,_0x362f23['options']);var _0x1d98ba={'where':_0x261e70[_0x4010('0x3c')]};return db['MailMessage'][_0x4010('0x21')](_0x1d98ba)[_0x4010('0x13')](function(_0x1f5f67){_0x220a1e[_0x4010('0x21')]=_0x1f5f67;if(_0x362f23[_0x4010('0x33')][_0x4010('0x41')]){_0x261e70[_0x4010('0x42')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x261e70);})[_0x4010('0x13')](function(_0x1323e2){_0x220a1e[_0x4010('0x43')]=_0x1323e2;return _0x220a1e;})[_0x4010('0x13')](respondWithFilteredResult(_0x437a43,_0x261e70))['catch'](handleError(_0x437a43,null));};exports[_0x4010('0x44')]=function(_0x1c3023,_0x3ffa47){var _0x2b9534={'raw':!![],'where':{'id':_0x1c3023[_0x4010('0x45')]['id']}},_0x38787c={};_0x38787c[_0x4010('0x36')]=_['keys'](db[_0x4010('0x2e')][_0x4010('0x46')]);_0x38787c[_0x4010('0x33')]=_[_0x4010('0x31')](_0x1c3023[_0x4010('0x33')]);_0x38787c[_0x4010('0x32')]=_[_0x4010('0x35')](_0x38787c[_0x4010('0x36')],_0x38787c[_0x4010('0x33')]);_0x2b9534[_0x4010('0x34')]=_[_0x4010('0x35')](_0x38787c[_0x4010('0x36')],qs[_0x4010('0x47')](_0x1c3023['query']['fields']));_0x2b9534[_0x4010('0x34')]=_0x2b9534['attributes']['length']?_0x2b9534[_0x4010('0x34')]:_0x38787c['model'];if(_0x1c3023[_0x4010('0x33')]['includeAll']){_0x2b9534[_0x4010('0x42')]=[{'all':!![]}];}_0x2b9534=_[_0x4010('0x3f')]({},_0x2b9534,_0x1c3023['options']);return db[_0x4010('0x2e')]['find'](_0x2b9534)[_0x4010('0x13')](handleEntityNotFound(_0x3ffa47,null))[_0x4010('0x13')](respondWithResult(_0x3ffa47,null))['catch'](handleError(_0x3ffa47,null));};exports[_0x4010('0x25')]=function(_0x13b91b,_0x4d2c09){if(_0x13b91b[_0x4010('0x48')]['id']){delete _0x13b91b[_0x4010('0x48')]['id'];}return db[_0x4010('0x2e')][_0x4010('0x49')]({'where':{'id':_0x13b91b[_0x4010('0x45')]['id']}})[_0x4010('0x13')](handleEntityNotFound(_0x4d2c09,null))[_0x4010('0x13')](saveUpdates(_0x13b91b[_0x4010('0x48')],null))[_0x4010('0x13')](respondWithResult(_0x4d2c09,null))[_0x4010('0x1c')](handleError(_0x4d2c09,null));};exports[_0x4010('0x26')]=function(_0x567aca,_0x42870b){return db[_0x4010('0x2e')][_0x4010('0x49')]({'where':{'id':_0x567aca['params']['id']}})[_0x4010('0x13')](handleEntityNotFound(_0x42870b,null))[_0x4010('0x13')](removeEntity(_0x42870b,null))[_0x4010('0x1c')](handleError(_0x42870b,null));};exports[_0x4010('0x4a')]=function(_0x216a3e,_0x3f47a1){return db[_0x4010('0x2e')][_0x4010('0x4a')]()[_0x4010('0x13')](respondWithResult(_0x3f47a1,null))['catch'](handleError(_0x3f47a1,null));};exports[_0x4010('0x4b')]=function(_0x2777d8,_0x4a2d64){return db['MailMessage'][_0x4010('0x4b')](_0x2777d8['body'])[_0x4010('0x13')](function(_0x183102){if(_0x183102){if(_0x183102['direction']===_0x4010('0x4c')&&!_0x183102[_0x4010('0x4d')]){var _0x4947e3,_0x55236e,_0x2a629f;if(_0x2777d8[_0x4010('0x48')]['to']){_0x55236e=_0x2777d8[_0x4010('0x48')]['to'][_0x4010('0x4e')](',')[0x0];}return db[_0x4010('0x4f')][_0x4010('0x50')]({'where':{'id':_0x183102[_0x4010('0x51')]},'include':[{'model':db[_0x4010('0x52')],'as':_0x4010('0x53'),'include':[{'model':db[_0x4010('0x54')],'as':_0x4010('0x55'),'where':{'email':_0x55236e},'limit':0x1,'order':[[_0x4010('0x56'),'DESC']]}]},{'model':db[_0x4010('0x57')],'as':_0x4010('0x58'),'raw':!![],'include':[{'model':db[_0x4010('0x59')],'as':_0x4010('0x59'),'raw':!![]}]}]})['then'](function(_0x421783){_0x4947e3=_0x421783;if(!_0x4947e3||!_0x4947e3[_0x4010('0x58')])return;var _0x542b74=_0x4947e3['getSmtpOptions']();if(_0x2777d8[_0x4010('0x48')][_0x4010('0x5a')]&&_0x2777d8['body'][_0x4010('0x5a')][_0x4010('0x37')]){for(var _0x658d5b=0x0;_0x658d5b<_0x2777d8[_0x4010('0x48')][_0x4010('0x5a')][_0x4010('0x37')];_0x658d5b+=0x1){_0x2777d8[_0x4010('0x48')][_0x4010('0x5a')][_0x658d5b]={'filename':_0x2777d8[_0x4010('0x48')][_0x4010('0x5a')][_0x658d5b][_0x4010('0x2a')],'path':path[_0x4010('0x5b')](config[_0x4010('0x5c')],_0x4010('0x5d'),_0x2777d8['body']['attachments'][_0x658d5b]['basename'])};}}_0x2a629f={'account':_0x542b74,'message':_0x2777d8['body']};return;})['then'](function(){if(_0x4947e3[_0x4010('0x53')]){if(_0x4947e3['List'][_0x4010('0x55')][_0x4010('0x37')]){return _0x4947e3[_0x4010('0x53')]['Contacts'][0x0];}else{return db[_0x4010('0x54')]['create'](_[_0x4010('0x5e')](_0x2777d8['body'],{'firstName':_0x2777d8['body']['to'],'email':_0x2777d8[_0x4010('0x48')]['to'],'phone':_0x2777d8[_0x4010('0x48')]['to'],'ListId':_0x4947e3[_0x4010('0x5f')]}));}}else{throw new Error(_0x4010('0x60'));}})[_0x4010('0x13')](function(){if(_0x2a629f){return respondWithRpcPromise(_0x4010('0x61'),_0x4010('0x62'),_0x2a629f,client9003)[_0x4010('0x13')](function(_0x5d46a6){return _0x183102[_0x4010('0x25')]({'read':!![],'messageId':_0x5d46a6[_0x4010('0x63')],'sentAt':moment()['format'](_0x4010('0x64'))});})[_0x4010('0x1c')](function(_0x5851a7){logger[_0x4010('0x18')]('%s',JSON[_0x4010('0x65')](_0x5851a7));return _0x183102;});}return _0x183102;});}return _0x183102;}})[_0x4010('0x13')](respondWithResult(_0x4a2d64,0xc9))[_0x4010('0x1c')](handleError(_0x4a2d64,null));};exports[_0x4010('0x66')]=function(_0x15e30d,_0x5a9a97){var _0x1ced9b={'agent':{},'channel':'mail'};if(_0x15e30d[_0x4010('0x48')]['id']){delete _0x15e30d['body']['id'];}_0x15e30d[_0x4010('0x48')]['read']=!![];_0x15e30d[_0x4010('0x48')][_0x4010('0x67')]=moment()[_0x4010('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x15e30d[_0x4010('0x48')][_0x4010('0x69')]=_0x15e30d[_0x4010('0x48')][_0x4010('0x69')]||_0x15e30d[_0x4010('0x6a')]['id'];_0x1ced9b[_0x4010('0x6b')]['id']=_0x15e30d['body'][_0x4010('0x69')];return db[_0x4010('0x2e')][_0x4010('0x49')]({'where':{'id':_0x15e30d[_0x4010('0x45')]['id'],'UserId':null}})[_0x4010('0x13')](handleEntityNotFound(_0x5a9a97,null))[_0x4010('0x13')](saveUpdates(_0x15e30d[_0x4010('0x48')],null))[_0x4010('0x13')](function(_0x5c1760){if(_0x5c1760){_0x1ced9b['message']=_0x5c1760[_0x4010('0x6c')]({'plain':!![]});return db[_0x4010('0x6d')][_0x4010('0x49')]({'where':{'id':_0x5c1760[_0x4010('0x6e')]}});}return null;})[_0x4010('0x13')](handleEntityNotFound(_0x5a9a97,null))['then'](function(_0x332a18){if(_0x332a18){return _0x332a18[_0x4010('0x25')]({'UserId':_0x15e30d[_0x4010('0x48')][_0x4010('0x69')],'read1stAt':_[_0x4010('0x6f')](_0x332a18[_0x4010('0x70')])?moment()[_0x4010('0x68')](_0x4010('0x64')):undefined});}return null;})[_0x4010('0x13')](function(_0x32d683){if(_0x32d683){_0x1ced9b[_0x4010('0x71')]=_0x32d683['get']({'plain':!![]});interaction_log[_0x4010('0x1a')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15e30d[_0x4010('0x6a')]['id'],_0x15e30d[_0x4010('0x6a')][_0x4010('0x2a')],_0x15e30d[_0x4010('0x6a')]['role'],_0x1ced9b[_0x4010('0x71')]['id'],_0x15e30d[_0x4010('0x48')]?JSON['stringify'](_0x15e30d[_0x4010('0x48')]):_0x4010('0x72'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1ced9b);}return null;})[_0x4010('0x13')](function(_0x4b5482){var _0x19d260=_0x4010('0x73')+_0x4b5482[_0x4010('0x19')][_0x4010('0x74')];return db[_0x4010('0x75')]['query'](_0x19d260,{'type':db['Sequelize'][_0x4010('0x76')][_0x4010('0x77')],'raw':!![]})[_0x4010('0x13')](function(_0x33306c){return _0x33306c;});})['then'](function(_0x1a4159){if(_0x1a4159){_0x1ced9b[_0x4010('0x19')][_0x4010('0x78')]=_0x1a4159[0x0];if(!_0x15e30d[_0x4010('0x48')][_0x4010('0x69')])return;return db[_0x4010('0x79')][_0x4010('0x49')]({'where':{'id':_0x15e30d[_0x4010('0x48')][_0x4010('0x69')],'role':_0x4010('0x6b')},'attributes':['id','name',_0x4010('0x7a'),_0x4010('0x7b'),_0x4010('0x7c')],'raw':!![]});}return null;})[_0x4010('0x13')](function(_0xffde30){if(!_0xffde30)return null;_0x1ced9b[_0x4010('0x19')][_0x4010('0x6b')]=_0xffde30;return _0x1ced9b;})[_0x4010('0x13')](function(_0x21c4d1){if(_0x21c4d1){if(_0x15e30d[_0x4010('0x48')][_0x4010('0x7d')]){_0x1ced9b[_0x4010('0x19')][_0x4010('0x7e')]=util[_0x4010('0x68')](_0x4010('0x7f'),_0x15e30d[_0x4010('0x6a')][_0x4010('0x2a')]);_0x1ced9b[_0x4010('0x19')][_0x4010('0x80')]=_0x1ced9b[_0x4010('0x80')];_0x1ced9b[_0x4010('0x19')]['motionChannel']=_0x1ced9b[_0x4010('0x80')];_0x1ced9b[_0x4010('0x19')][_0x4010('0x81')]='accept';_0x1ced9b['message'][_0x4010('0x48')]=htmlToText[_0x4010('0x82')](_0x1ced9b['message'][_0x4010('0x48')]);return respondWithRpcPromise(_0x4010('0x83'),'EventManager',{'event':_0x4010('0x84'),'message':_0x1ced9b['message']},client9002)[_0x4010('0x13')](function(){return _0x1ced9b;});}return _0x1ced9b;}return null;})[_0x4010('0x13')](respondWithResult(_0x5a9a97,null))[_0x4010('0x1c')](handleError(_0x5a9a97,null));};exports[_0x4010('0x85')]=function(_0x5a63c9,_0x222672){var _0xb095fc={'agent':{},'channel':_0x4010('0x86')};if(_0x5a63c9[_0x4010('0x48')]['id']){delete _0x5a63c9[_0x4010('0x48')]['id'];}_0x5a63c9['body'][_0x4010('0x69')]=_0x5a63c9[_0x4010('0x48')][_0x4010('0x69')]||_0x5a63c9[_0x4010('0x6a')]['id'];_0xb095fc[_0x4010('0x6b')]['id']=_0x5a63c9[_0x4010('0x48')][_0x4010('0x69')];return db['MailMessage']['find']({'where':{'id':_0x5a63c9['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x222672,null))[_0x4010('0x13')](function(_0x5cb28e){if(_0x5cb28e){_0xb095fc['message']=_0x5cb28e[_0x4010('0x6c')]({'plain':!![]});return db[_0x4010('0x6d')][_0x4010('0x49')]({'where':{'id':_0x5cb28e[_0x4010('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x222672,null))[_0x4010('0x13')](function(_0x231aee){if(_0x231aee){_0xb095fc['interaction']=_0x231aee[_0x4010('0x6c')]({'plain':!![]});interaction_log[_0x4010('0x1a')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a63c9[_0x4010('0x6a')]['id'],_0x5a63c9[_0x4010('0x6a')][_0x4010('0x2a')],_0x5a63c9[_0x4010('0x6a')]['role'],_0xb095fc[_0x4010('0x71')]['id'],_0x5a63c9[_0x4010('0x48')]?JSON['stringify'](_0x5a63c9[_0x4010('0x48')]):_0x4010('0x72'));return respondWithRpcPromise(_0x4010('0x87'),'rejectMessage',_0xb095fc);}return null;})[_0x4010('0x13')](function(_0x5e2fb1){var _0x3b128c=_0x4010('0x73')+_0x5e2fb1[_0x4010('0x19')][_0x4010('0x74')];return db['sequelize'][_0x4010('0x33')](_0x3b128c,{'type':db[_0x4010('0x88')][_0x4010('0x76')]['SELECT'],'raw':!![]})[_0x4010('0x13')](function(_0x2e9d0b){return _0x2e9d0b;});})['then'](function(_0x2c07e8){if(_0x2c07e8){_0xb095fc['message'][_0x4010('0x78')]=_0x2c07e8[0x0];if(!_0x5a63c9[_0x4010('0x48')]['UserId'])return;return db[_0x4010('0x79')][_0x4010('0x49')]({'where':{'id':_0x5a63c9[_0x4010('0x48')][_0x4010('0x69')],'role':_0x4010('0x6b')},'attributes':['id',_0x4010('0x2a'),_0x4010('0x7a'),_0x4010('0x7b'),'internal'],'raw':!![]});}return null;})['then'](function(_0xf00b09){if(!_0xf00b09)return null;_0xb095fc['message'][_0x4010('0x6b')]=_0xf00b09;return _0xb095fc;})[_0x4010('0x13')](function(_0x33d43b){if(_0x33d43b){_0x33d43b['message'][_0x4010('0x7e')]=util[_0x4010('0x68')](_0x4010('0x7f'),_0x5a63c9[_0x4010('0x6a')][_0x4010('0x2a')]);_0x33d43b[_0x4010('0x19')][_0x4010('0x80')]=_0xb095fc[_0x4010('0x80')];_0x33d43b['message'][_0x4010('0x89')]=_0xb095fc[_0x4010('0x80')];_0x33d43b['message'][_0x4010('0x81')]=_0x4010('0x85');_0x33d43b['message']['body']=htmlToText['fromString'](_0xb095fc['message'][_0x4010('0x48')]);respondWithRpcPromise(_0x4010('0x83'),'EventManager',{'event':_0x4010('0x8a'),'message':_0x33d43b[_0x4010('0x19')]},client9002);return _0xb095fc;}return null;})[_0x4010('0x13')](respondWithResult(_0x222672,null))[_0x4010('0x1c')](handleError(_0x222672,null));};exports[_0x4010('0x8b')]=function(_0x10858a,_0x3380bd){var _0x18f42b=moment()[_0x4010('0x8c')]()['toString']();var _0x436060=path[_0x4010('0x5b')](config['root'],'server','files',_0x4010('0x8d'));var _0x1816c5=path[_0x4010('0x5b')](config[_0x4010('0x5c')],_0x4010('0x8e'),_0x4010('0x8f'),_0x4010('0x5a'));var _0x36977a=util[_0x4010('0x68')](_0x4010('0x90'),_0x18f42b);return db['MailMessage']['find']({'where':{'id':_0x10858a[_0x4010('0x45')]['id']},'attributes':['id',_0x4010('0x48'),'from','to','cc','bcc',_0x4010('0x91'),_0x4010('0x92')],'include':_0x10858a[_0x4010('0x33')]['attachments']?[{'model':db[_0x4010('0x93')],'as':'Attachments'}]:undefined})[_0x4010('0x13')](handleEntityNotFound(_0x3380bd,null))[_0x4010('0x13')](function(_0x55b525){if(_0x55b525){var _0x37f47c=_0x55b525;var _0x1abcac={'from':_0x37f47c[_0x4010('0x94')],'to':_0x37f47c['to'],'subject':_0x37f47c[_0x4010('0x91')],'html':htmlEntities['decode'](_0x37f47c[_0x4010('0x48')]),'headers':{'Date':moment(_0x37f47c[_0x4010('0x92')])[_0x4010('0x68')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x55b525['cc']){_0x1abcac[_0x4010('0x95')]['Cc']=_0x55b525['cc'];}if(_0x55b525['bcc']){_0x1abcac[_0x4010('0x95')][_0x4010('0x96')]=_0x55b525[_0x4010('0x97')];}return new BPromise(function(_0x37a2f3,_0x3f17cb){if(_0x55b525[_0x4010('0x98')]){for(var _0x27a04d=0x0;_0x27a04d<_0x55b525[_0x4010('0x98')][_0x4010('0x37')];_0x27a04d++){var _0x37b771=_0x55b525[_0x4010('0x98')][_0x27a04d];var _0x486c6c=path[_0x4010('0x5b')](_0x1816c5,_0x37b771[_0x4010('0x99')]);if(fs[_0x4010('0x9a')](_0x486c6c)){_0x1abcac[_0x4010('0x5a')][_0x4010('0x9b')]({'name':_0x37b771['name'],'contentType':_0x37b771['type'],'data':fs[_0x4010('0x9c')](_0x486c6c)});}}}emlformat[_0x4010('0x9d')](_0x1abcac,function(_0x49dcac,_0x280079){if(_0x49dcac)return _0x3f17cb(_0x49dcac);fs[_0x4010('0x9e')](path[_0x4010('0x5b')](_0x436060,_0x36977a),_0x280079);return _0x37a2f3(_0x280079);});});}})[_0x4010('0x13')](function(_0x44ed2c){if(_0x44ed2c){return _0x3380bd[_0x4010('0x8b')](path['join'](_0x436060,_0x36977a),_0x36977a,function(_0x355486){if(!_0x355486)fs[_0x4010('0x9f')](path[_0x4010('0x5b')](_0x436060,_0x36977a));});}})[_0x4010('0x1c')](handleError(_0x3380bd,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 51eedd6..3536268 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 _0xf432=['hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf432,0x1bb));var _0x2f43=function(_0x2f23c6,_0x8eacbc){_0x2f23c6=_0x2f23c6-0x0;var _0x12e26a=_0xf432[_0x2f23c6];return _0x12e26a;};'use strict';var EventEmitter=require(_0x2f43('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x2f43('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2f43('0x2')](0x0);var events={'afterCreate':_0x2f43('0x3'),'afterUpdate':_0x2f43('0x4'),'afterDestroy':_0x2f43('0x5')};function emitEvent(_0x2d3c17){return function(_0x4c1da7,_0xadf316,_0x5f4bd8){MailMessageEvents['emit'](_0x2d3c17+':'+_0x4c1da7['id'],_0x4c1da7);MailMessageEvents[_0x2f43('0x6')](_0x2d3c17,_0x4c1da7);_0x5f4bd8(null);};}for(var e in events){if(events[_0x2f43('0x7')](e)){var event=events[e];MailMessage[_0x2f43('0x8')](e,emitEvent(event));}}module[_0x2f43('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x7690=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x3e0667,_0xafa54c){var _0x13ef0a=function(_0x192707){while(--_0x192707){_0x3e0667['push'](_0x3e0667['shift']());}};_0x13ef0a(++_0xafa54c);}(_0x7690,0x14a));var _0x0769=function(_0x39a5f3,_0x2d783a){_0x39a5f3=_0x39a5f3-0x0;var _0x2c42c2=_0x7690[_0x39a5f3];return _0x2c42c2;};'use strict';var EventEmitter=require(_0x0769('0x0'));var MailMessage=require(_0x0769('0x1'))['db'][_0x0769('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0769('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0769('0x4')};function emitEvent(_0x28712c){return function(_0x7ec218,_0x116818,_0x14b37a){MailMessageEvents['emit'](_0x28712c+':'+_0x7ec218['id'],_0x7ec218);MailMessageEvents[_0x0769('0x5')](_0x28712c,_0x7ec218);_0x14b37a(null);};}for(var e in events){if(events[_0x0769('0x6')](e)){var event=events[e];MailMessage[_0x0769('0x7')](e,emitEvent(event));}}module[_0x0769('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 30a29db..51ce30c 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 _0x296d=['request-promise','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','toLowerCase','direction','out','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x44d28c,_0x3a197b){var _0x754673=function(_0x5a5773){while(--_0x5a5773){_0x44d28c['push'](_0x44d28c['shift']());}};_0x754673(++_0x3a197b);}(_0x296d,0x1e8));var _0xd296=function(_0xb98825,_0x554182){_0xb98825=_0xb98825-0x0;var _0x451d90=_0x296d[_0xb98825];return _0x451d90;};'use strict';var _=require(_0xd296('0x0'));var util=require(_0xd296('0x1'));var logger=require('../../config/logger')(_0xd296('0x2'));var moment=require(_0xd296('0x3'));var BPromise=require(_0xd296('0x4'));var rp=require(_0xd296('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module['exports']=function(_0xa471c6,_0x27aada){return _0xa471c6[_0xd296('0x6')](_0xd296('0x7'),attributes,{'tableName':_0xd296('0x8'),'paranoid':![],'indexes':[{'name':_0xd296('0x9'),'fields':[_0xd296('0x9')]},{'name':_0xd296('0xa'),'fields':[_0xd296('0xb'),_0xd296('0xc')],'type':_0xd296('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x272163,_0x33640c,_0x4875c5){if(_0x272163[_0xd296('0xe')]){_0x272163[_0xd296('0xb')]=htmlToText['fromString'](_0x272163[_0xd296('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4875c5(null,_0x33640c);},'afterCreate':function(_0x1f7d5c,_0x4a668e,_0x4b939d){var _0x3f4b6b=_0xa471c6['models'];var _0x335c79=_0x1f7d5c[_0xd296('0xf')]({'plain':!![]});if(_0x335c79['direction'][_0xd296('0x10')]()==='in'||_0x335c79[_0xd296('0x11')][_0xd296('0x10')]()===_0xd296('0x12')&&!_0x335c79[_0xd296('0x13')]&&!_['isNil'](_0x335c79[_0xd296('0x14')])){_0x3f4b6b[_0xd296('0x15')][_0xd296('0x16')]({'where':{'id':_0x335c79['MailInteractionId']}})[_0xd296('0x17')](function(_0x2bea6b){if(_0x2bea6b){_0x2bea6b[_0xd296('0x18')]({'lastMsgAt':_0x335c79[_0xd296('0x19')],'lastMsgDirection':_0x335c79['direction'][_0xd296('0x10')]()});}})[_0xd296('0x1a')](function(_0x37f066){console['error'](_0x37f066);});}_0x4b939d();}},'charset':_0xd296('0x1b'),'collate':_0xd296('0x1c')});}; \ No newline at end of file +var _0xf19f=['secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase','out'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf19f,0x140));var _0xff19=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xf19f[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0xff19('0x0'));var util=require('util');var logger=require(_0xff19('0x1'))(_0xff19('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xff19('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xff19('0x4'));var rimraf=require('rimraf');var config=require(_0xff19('0x5'));var attributes=require(_0xff19('0x6'));module[_0xff19('0x7')]=function(_0xe75fd6,_0x28cc59){return _0xe75fd6[_0xff19('0x8')]('MailMessage',attributes,{'tableName':_0xff19('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xff19('0xa')]},{'name':_0xff19('0xb'),'fields':['plainBody',_0xff19('0xc')],'type':_0xff19('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50fc48,_0x52e915,_0x3cffba){if(_0x50fc48[_0xff19('0xe')]){_0x50fc48[_0xff19('0xf')]=htmlToText[_0xff19('0x10')](_0x50fc48[_0xff19('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3cffba(null,_0x52e915);},'afterCreate':function(_0x527516,_0x2860c3,_0x5c2270){var _0x5baa47=_0xe75fd6['models'];var _0x1a5af0=_0x527516[_0xff19('0x11')]({'plain':!![]});if(_0x1a5af0[_0xff19('0x12')][_0xff19('0x13')]()==='in'||_0x1a5af0[_0xff19('0x12')][_0xff19('0x13')]()===_0xff19('0x14')&&!_0x1a5af0[_0xff19('0x15')]&&!_['isNil'](_0x1a5af0[_0xff19('0x16')])){_0x5baa47[_0xff19('0x17')][_0xff19('0x18')]({'where':{'id':_0x1a5af0[_0xff19('0x19')]}})[_0xff19('0x1a')](function(_0xea122b){if(_0xea122b){_0xea122b[_0xff19('0x1b')]({'lastMsgAt':_0x1a5af0['createdAt'],'lastMsgDirection':_0x1a5af0[_0xff19('0x12')][_0xff19('0x13')]()});}})[_0xff19('0x1c')](function(_0x4733e7){console['error'](_0x4733e7);});}_0x5c2270();}},'charset':_0xff19('0x1d'),'collate':_0xff19('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index df27d8d..e12b08b 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 _0x9582=['client','http','redis','defaults','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x18d45c,_0x114e31){var _0x5bdb10=function(_0x1d0bdd){while(--_0x1d0bdd){_0x18d45c['push'](_0x18d45c['shift']());}};_0x5bdb10(++_0x114e31);}(_0x9582,0x95));var _0x2958=function(_0x965cd2,_0x2959ba){_0x965cd2=_0x965cd2-0x0;var _0x771a05=_0x9582[_0x965cd2];return _0x771a05;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});config[_0x2958('0xd')]=_[_0x2958('0xe')](config[_0x2958('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2958('0xd')]));require('./mailMessage.socket')[_0x2958('0xf')](socket);function respondWithRpcPromise(_0x51e460,_0x44cccc,_0x5ef23c){return new BPromise(function(_0x3aacfa,_0x29776c){return client[_0x2958('0x10')](_0x51e460,_0x5ef23c)[_0x2958('0x11')](function(_0x11ec8d){logger['info'](_0x2958('0x12'),_0x44cccc,_0x2958('0x13'));logger[_0x2958('0x14')](_0x2958('0x15'),_0x44cccc,_0x2958('0x13'),JSON[_0x2958('0x16')](_0x11ec8d));if(_0x11ec8d[_0x2958('0x17')]){if(_0x11ec8d[_0x2958('0x17')]['code']===0x1f4){logger[_0x2958('0x17')](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x29776c(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}logger['error'](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x3aacfa(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x44cccc,_0x2958('0x13'));_0x3aacfa(_0x11ec8d[_0x2958('0x19')][_0x2958('0x18')]);}})[_0x2958('0x1a')](function(_0x27599c){logger['error'](_0x2958('0x12'),_0x44cccc,_0x27599c);_0x29776c(_0x27599c);});});}exports[_0x2958('0x1b')]=function(_0x1a12fa){var _0x57b6c5=this;return new Promise(function(_0x1e77eb,_0x53b100){return db[_0x2958('0x1c')]['create'](_0x1a12fa['body'],{'raw':_0x1a12fa[_0x2958('0x1d')]?_0x1a12fa[_0x2958('0x1d')][_0x2958('0x1e')]===undefined?!![]:![]:!![]})[_0x2958('0x11')](function(_0x2202f8){logger[_0x2958('0x1f')](_0x2958('0x1b'),_0x1a12fa);logger[_0x2958('0x14')](_0x2958('0x1b'),_0x1a12fa,JSON[_0x2958('0x16')](_0x2202f8));_0x1e77eb(_0x2202f8);})[_0x2958('0x1a')](function(_0xd58ae1){logger[_0x2958('0x17')](_0x2958('0x1b'),_0xd58ae1[_0x2958('0x18')],_0x1a12fa);_0x53b100(_0x57b6c5['error'](0x1f4,_0xd58ae1['message']));});});}; \ No newline at end of file +var _0xefda=['redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0xefda,0x96));var _0xaefd=function(_0x3e9c1b,_0x29f936){_0x3e9c1b=_0x3e9c1b-0x0;var _0x1a3e1f=_0xefda[_0x3e9c1b];return _0x1a3e1f;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});config[_0xaefd('0xa')]=_[_0xaefd('0xb')](config[_0xaefd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaefd('0xc'))(new Redis(config[_0xaefd('0xa')]));require(_0xaefd('0xd'))['register'](socket);function respondWithRpcPromise(_0x48a255,_0x54a3b1,_0xa6239d){return new BPromise(function(_0x16b36e,_0x20135c){return client[_0xaefd('0xe')](_0x48a255,_0xa6239d)[_0xaefd('0xf')](function(_0x1e00fb){logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));logger[_0xaefd('0x13')](_0xaefd('0x14'),_0x54a3b1,'request\x20sent',JSON[_0xaefd('0x15')](_0x1e00fb));if(_0x1e00fb['error']){if(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x17')]===0x1f4){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb['error'][_0xaefd('0x18')]);return _0x20135c(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);}logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);return _0x16b36e(_0x1e00fb[_0xaefd('0x16')]['message']);}else{logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));_0x16b36e(_0x1e00fb[_0xaefd('0x19')][_0xaefd('0x18')]);}})[_0xaefd('0x1a')](function(_0x516e84){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x516e84);_0x20135c(_0x516e84);});});}exports[_0xaefd('0x1b')]=function(_0x1260dd){var _0x45ebf2=this;return new Promise(function(_0x1f302c,_0x5282ed){return db[_0xaefd('0x1c')][_0xaefd('0x1d')](_0x1260dd[_0xaefd('0x1e')],{'raw':_0x1260dd[_0xaefd('0x1f')]?_0x1260dd[_0xaefd('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5b9967){logger[_0xaefd('0x10')](_0xaefd('0x1b'),_0x1260dd);logger[_0xaefd('0x13')]('CreateMailMessage',_0x1260dd,JSON[_0xaefd('0x15')](_0x5b9967));_0x1f302c(_0x5b9967);})['catch'](function(_0x3deec8){logger[_0xaefd('0x16')](_0xaefd('0x1b'),_0x3deec8['message'],_0x1260dd);_0x5282ed(_0x45ebf2[_0xaefd('0x16')](0x1f4,_0x3deec8[_0xaefd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 6ac2124..986139f 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 _0x18a5=['length','mailMessage:','./mailMessage.events','save','emit','removeListener'];(function(_0xf670c7,_0x185949){var _0x58cfa0=function(_0x189a5f){while(--_0x189a5f){_0xf670c7['push'](_0xf670c7['shift']());}};_0x58cfa0(++_0x185949);}(_0x18a5,0x164));var _0x518a=function(_0x2f3454,_0x4617c1){_0x2f3454=_0x2f3454-0x0;var _0x2bee75=_0x18a5[_0x2f3454];return _0x2bee75;};'use strict';var MailMessageEvents=require(_0x518a('0x0'));var events=[_0x518a('0x1'),'remove','update'];function createListener(_0x14cd9c,_0x47e255){return function(_0x2f5840){_0x47e255[_0x518a('0x2')](_0x14cd9c,_0x2f5840);};}function removeListener(_0x44c5f0,_0x1937bd){return function(){MailMessageEvents[_0x518a('0x3')](_0x44c5f0,_0x1937bd);};}exports['register']=function(_0x5dcff1){for(var _0x4b150f=0x0,_0x2ea311=events[_0x518a('0x4')];_0x4b150f<_0x2ea311;_0x4b150f++){var _0x19a2df=events[_0x4b150f];var _0x2a5fa6=createListener(_0x518a('0x5')+_0x19a2df,_0x5dcff1);MailMessageEvents['on'](_0x19a2df,_0x2a5fa6);}}; \ No newline at end of file +var _0x9828=['update','removeListener','register','length','mailMessage:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9828,0x1af));var _0x8982=function(_0x39ed63,_0x1050f){_0x39ed63=_0x39ed63-0x0;var _0x5023a8=_0x9828[_0x39ed63];return _0x5023a8;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x8982('0x0'),'remove',_0x8982('0x1')];function createListener(_0x449cdb,_0x22f5d8){return function(_0x5b7658){_0x22f5d8['emit'](_0x449cdb,_0x5b7658);};}function removeListener(_0x4e7bf2,_0x3a089e){return function(){MailMessageEvents[_0x8982('0x2')](_0x4e7bf2,_0x3a089e);};}exports[_0x8982('0x3')]=function(_0x130c94){for(var _0x49dc34=0x0,_0x17d45c=events[_0x8982('0x4')];_0x49dc34<_0x17d45c;_0x49dc34++){var _0x2d3901=events[_0x49dc34];var _0x3ff2d6=createListener(_0x8982('0x5')+_0x2d3901,_0x130c94);MailMessageEvents['on'](_0x2d3901,_0x3ff2d6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e703a41..48a8092 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 _0x7240=['removeAgents','exports','util','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','destroy','delete','removeTeams'];(function(_0x35ca0d,_0x6fccae){var _0xd9ea4=function(_0x471a03){while(--_0x471a03){_0x35ca0d['push'](_0x35ca0d['shift']());}};_0xd9ea4(++_0x6fccae);}(_0x7240,0xfc));var _0x0724=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7240[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x0724('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0724('0x1'));var auth=require(_0x0724('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0724('0x3'));router[_0x0724('0x4')]('/',auth[_0x0724('0x5')](),controller[_0x0724('0x6')]);router[_0x0724('0x4')]('/describe',auth[_0x0724('0x5')](),controller[_0x0724('0x7')]);router['get'](_0x0724('0x8'),auth[_0x0724('0x5')](),controller[_0x0724('0x9')]);router['get'](_0x0724('0xa'),auth[_0x0724('0x5')](),controller[_0x0724('0xb')]);router[_0x0724('0x4')](_0x0724('0xc'),auth[_0x0724('0x5')](),controller[_0x0724('0xd')]);router['get'](_0x0724('0xe'),auth[_0x0724('0x5')](),controller[_0x0724('0xf')]);router['post']('/',auth[_0x0724('0x5')](),controller['create']);router[_0x0724('0x10')](_0x0724('0xc'),auth[_0x0724('0x5')](),controller[_0x0724('0x11')]);router[_0x0724('0x10')]('/:id/users',auth[_0x0724('0x5')](),controller['addAgents']);router[_0x0724('0x12')](_0x0724('0x8'),auth['isAuthenticated'](),controller[_0x0724('0x13')]);router['delete'](_0x0724('0x8'),auth['isAuthenticated'](),controller[_0x0724('0x14')]);router[_0x0724('0x15')](_0x0724('0xc'),auth[_0x0724('0x5')](),controller[_0x0724('0x16')]);router[_0x0724('0x15')](_0x0724('0xe'),auth[_0x0724('0x5')](),controller[_0x0724('0x17')]);module[_0x0724('0x18')]=router; \ No newline at end of file +var _0x2387=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout'];(function(_0x58e2d2,_0x4ff59b){var _0x249768=function(_0x1c9e31){while(--_0x1c9e31){_0x58e2d2['push'](_0x58e2d2['shift']());}};_0x249768(++_0x4ff59b);}(_0x2387,0x184));var _0x7238=function(_0x5997e9,_0x3f1e0c){_0x5997e9=_0x5997e9-0x0;var _0x111fe2=_0x2387[_0x5997e9];return _0x111fe2;};'use strict';var multer=require('multer');var util=require(_0x7238('0x0'));var path=require('path');var timeout=require(_0x7238('0x1'));var express=require(_0x7238('0x2'));var router=express[_0x7238('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7238('0x4'));var interaction=require(_0x7238('0x5'));var config=require(_0x7238('0x6'));var controller=require(_0x7238('0x7'));router[_0x7238('0x8')]('/',auth[_0x7238('0x9')](),controller[_0x7238('0xa')]);router[_0x7238('0x8')](_0x7238('0xb'),auth[_0x7238('0x9')](),controller[_0x7238('0xc')]);router['get'](_0x7238('0xd'),auth[_0x7238('0x9')](),controller[_0x7238('0xe')]);router[_0x7238('0x8')](_0x7238('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0x7238('0x8')](_0x7238('0x10'),auth[_0x7238('0x9')](),controller[_0x7238('0x11')]);router[_0x7238('0x8')]('/:id/users',auth[_0x7238('0x9')](),controller[_0x7238('0x12')]);router[_0x7238('0x13')]('/',auth['isAuthenticated'](),controller[_0x7238('0x14')]);router[_0x7238('0x13')](_0x7238('0x10'),auth[_0x7238('0x9')](),controller[_0x7238('0x15')]);router[_0x7238('0x13')](_0x7238('0x16'),auth[_0x7238('0x9')](),controller[_0x7238('0x17')]);router[_0x7238('0x18')](_0x7238('0xd'),auth[_0x7238('0x9')](),controller[_0x7238('0x19')]);router[_0x7238('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x7238('0x1b')]);router[_0x7238('0x1a')]('/:id/teams',auth[_0x7238('0x9')](),controller[_0x7238('0x1c')]);router['delete'](_0x7238('0x16'),auth[_0x7238('0x9')](),controller[_0x7238('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index af77367..ec435cb 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 _0xf32c=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0xa1d334,_0x42413f){var _0x477792=function(_0x3ca31d){while(--_0x3ca31d){_0xa1d334['push'](_0xa1d334['shift']());}};_0x477792(++_0x42413f);}(_0xf32c,0x80));var _0xcf32=function(_0x534e63,_0x11a9c9){_0x534e63=_0x534e63-0x0;var _0x253cae=_0xf32c[_0x534e63];return _0x253cae;};'use strict';var Sequelize=require(_0xcf32('0x0'));module[_0xcf32('0x1')]={'name':{'type':Sequelize[_0xcf32('0x2')],'unique':_0xcf32('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcf32('0x2')]},'timeout':{'type':Sequelize[_0xcf32('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcf32('0x5')](_0xcf32('0x6'),_0xcf32('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x38e9=['name','INTEGER','ENUM','beepall','exports'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x38e9,0x19e));var _0x938e=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x38e9[_0x44a3b0];return _0x39e6f6;};'use strict';var Sequelize=require('sequelize');module[_0x938e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x938e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x938e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x938e('0x3')]('rrmemory',_0x938e('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a887bea..fb8de11 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 _0xbb39=['includeAll','merge','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','describe','getMembers','findOne','UserMailQueue','nolimit','order','sort','pick','where','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','end','status','limit','undefined','count','offset','set','Content-Range','json','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','getOptions','MailQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','fields','attributes','length'];(function(_0x5904b2,_0x2af109){var _0xf5afba=function(_0x5601bd){while(--_0x5601bd){_0x5904b2['push'](_0x5904b2['shift']());}};_0xf5afba(++_0x2af109);}(_0xbb39,0x1cb));var _0x9bb3=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xbb39[_0x476bf4];return _0x788ffe;};'use strict';var BPromise=require(_0x9bb3('0x0'));var util=require(_0x9bb3('0x1'));var _=require(_0x9bb3('0x2'));var squel=require(_0x9bb3('0x3'));var Redis=require(_0x9bb3('0x4'));var qs=require(_0x9bb3('0x5'));var logger=require(_0x9bb3('0x6'))('api');var config=require(_0x9bb3('0x7'));var db=require(_0x9bb3('0x8'))['db'];config[_0x9bb3('0x9')]=_[_0x9bb3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9bb3('0xb'))(new Redis(config[_0x9bb3('0x9')]));require(_0x9bb3('0xc'))[_0x9bb3('0xd')](socket);function respondWithStatusCode(_0x488359,_0x3fbaa6){_0x3fbaa6=_0x3fbaa6||0xcc;return function(_0x37a052){if(_0x37a052){return _0x488359['sendStatus'](_0x3fbaa6);}return _0x488359['status'](_0x3fbaa6)[_0x9bb3('0xe')]();};}function respondWithResult(_0x15677b,_0x453638){_0x453638=_0x453638||0xc8;return function(_0x506ac0){if(_0x506ac0){return _0x15677b[_0x9bb3('0xf')](_0x453638)['json'](_0x506ac0);}};}function respondWithFilteredResult(_0x2f1250,_0x1dff97){return function(_0x4ebec3){if(_0x4ebec3){var _0x3b8ec2=typeof _0x1dff97['offset']==='undefined'&&typeof _0x1dff97[_0x9bb3('0x10')]===_0x9bb3('0x11');var _0x3d3868=_0x4ebec3[_0x9bb3('0x12')];var _0x19e3ab=_0x3b8ec2?0x0:_0x1dff97['offset'];var _0x4c8573=_0x3b8ec2?_0x4ebec3[_0x9bb3('0x12')]:_0x1dff97[_0x9bb3('0x13')]+_0x1dff97[_0x9bb3('0x10')];var _0x69fb31;if(_0x4c8573>=_0x3d3868){_0x4c8573=_0x3d3868;_0x69fb31=0xc8;}else{_0x69fb31=0xce;}_0x2f1250[_0x9bb3('0xf')](_0x69fb31);return _0x2f1250[_0x9bb3('0x14')](_0x9bb3('0x15'),_0x19e3ab+'-'+_0x4c8573+'/'+_0x3d3868)[_0x9bb3('0x16')](_0x4ebec3);}return null;};}function saveUpdates(_0x53ce08){return function(_0x25fa8c){if(_0x25fa8c){return _0x25fa8c[_0x9bb3('0x17')](_0x53ce08)[_0x9bb3('0x18')](function(_0x1b7dfa){return _0x1b7dfa;});}return null;};}function removeEntity(_0x137d72){return function(_0x3a6f3c){if(_0x3a6f3c){return _0x3a6f3c[_0x9bb3('0x19')]()[_0x9bb3('0x18')](function(){var _0x1d4712=_0x3a6f3c[_0x9bb3('0x1a')]({'plain':!![]});var _0x447544=_0x9bb3('0x1b');return db[_0x9bb3('0x1c')][_0x9bb3('0x19')]({'where':{'type':_0x447544,'resourceId':_0x1d4712['id']}})[_0x9bb3('0x18')](function(){return _0x3a6f3c;});})['then'](function(){_0x137d72['status'](0xcc)[_0x9bb3('0xe')]();});}};}function handleEntityNotFound(_0x5b9be2){return function(_0x524e60){if(!_0x524e60){_0x5b9be2['sendStatus'](0x194);}return _0x524e60;};}function handleError(_0x104af9,_0x59ca16){_0x59ca16=_0x59ca16||0x1f4;return function(_0x3704a6){logger[_0x9bb3('0x1d')](_0x3704a6['stack']);if(_0x3704a6[_0x9bb3('0x1e')]){delete _0x3704a6[_0x9bb3('0x1e')];}_0x104af9[_0x9bb3('0xf')](_0x59ca16)[_0x9bb3('0x1f')](_0x3704a6);};}exports[_0x9bb3('0x20')]=function(_0x306c77,_0x5a3ac5){var _0x165697={};var _0x2f1e6d={'count':0x0,'rows':[]};var _0x25a45b=_[_0x9bb3('0x21')](db['MailQueue'][_0x9bb3('0x22')],function(_0x1a3bcd){return{'name':_0x1a3bcd[_0x9bb3('0x23')],'type':_0x1a3bcd[_0x9bb3('0x24')]['key']};});_0x165697=qs[_0x9bb3('0x25')](_0x25a45b,_0x306c77);var _0xb45687={'where':_0x165697['where']};return db[_0x9bb3('0x26')][_0x9bb3('0x12')](_0xb45687)[_0x9bb3('0x18')](function(_0x586210){_0x2f1e6d[_0x9bb3('0x12')]=_0x586210;_0x165697[_0x9bb3('0x27')]=qs[_0x9bb3('0x27')](_0x306c77['query']);return db['MailQueue'][_0x9bb3('0x28')](_0x165697);})[_0x9bb3('0x18')](function(_0x870a8f){_0x2f1e6d[_0x9bb3('0x29')]=_0x870a8f;return _0x2f1e6d;})[_0x9bb3('0x18')](respondWithFilteredResult(_0x5a3ac5,_0x165697))[_0x9bb3('0x2a')](handleError(_0x5a3ac5,null));};exports[_0x9bb3('0x2b')]=function(_0x331543,_0x2dd664){var _0x3780f9={'raw':!![],'where':{'id':_0x331543[_0x9bb3('0x2c')]['id']}},_0x1a4a9e={};_0x1a4a9e[_0x9bb3('0x2d')]=_[_0x9bb3('0x2e')](db['MailQueue'][_0x9bb3('0x22')]);_0x1a4a9e[_0x9bb3('0x2f')]=_['keys'](_0x331543[_0x9bb3('0x2f')]);_0x1a4a9e[_0x9bb3('0x30')]=_[_0x9bb3('0x31')](_0x1a4a9e[_0x9bb3('0x2d')],_0x1a4a9e[_0x9bb3('0x2f')]);_0x3780f9['attributes']=_[_0x9bb3('0x31')](_0x1a4a9e[_0x9bb3('0x2d')],qs[_0x9bb3('0x32')](_0x331543[_0x9bb3('0x2f')][_0x9bb3('0x32')]));_0x3780f9[_0x9bb3('0x33')]=_0x3780f9[_0x9bb3('0x33')][_0x9bb3('0x34')]?_0x3780f9[_0x9bb3('0x33')]:_0x1a4a9e[_0x9bb3('0x2d')];if(_0x331543[_0x9bb3('0x2f')][_0x9bb3('0x35')]){_0x3780f9['include']=[{'all':!![]}];}_0x3780f9=_[_0x9bb3('0x36')]({},_0x3780f9,_0x331543[_0x9bb3('0x37')]);return db[_0x9bb3('0x26')][_0x9bb3('0x38')](_0x3780f9)[_0x9bb3('0x18')](handleEntityNotFound(_0x2dd664,null))[_0x9bb3('0x18')](respondWithResult(_0x2dd664,null))[_0x9bb3('0x2a')](handleError(_0x2dd664,null));};exports[_0x9bb3('0x39')]=function(_0x1ebfa8,_0x202d3d){return db[_0x9bb3('0x26')][_0x9bb3('0x39')](_0x1ebfa8[_0x9bb3('0x3a')],{})[_0x9bb3('0x18')](function(_0x4d57d9){var _0x1b1421=_0x1ebfa8[_0x9bb3('0x3b')][_0x9bb3('0x1a')]({'plain':!![]});if(!_0x1b1421)throw new Error(_0x9bb3('0x3c'));if(_0x1b1421['role']===_0x9bb3('0x3b')){var _0x5788c0=_0x4d57d9[_0x9bb3('0x1a')]({'plain':!![]});var _0x49d042=_0x9bb3('0x1b');return db[_0x9bb3('0x3d')][_0x9bb3('0x38')]({'where':{'name':_0x49d042,'userProfileId':_0x1b1421[_0x9bb3('0x3e')]},'raw':!![]})[_0x9bb3('0x18')](function(_0x288f24){if(_0x288f24&&_0x288f24[_0x9bb3('0x3f')]===0x0){return db['UserProfileResource'][_0x9bb3('0x39')]({'name':_0x5788c0[_0x9bb3('0x1e')],'resourceId':_0x5788c0['id'],'type':_0x288f24[_0x9bb3('0x1e')],'sectionId':_0x288f24['id']},{})[_0x9bb3('0x18')](function(){return _0x4d57d9;});}else{return _0x4d57d9;}})['catch'](function(_0x37e826){logger[_0x9bb3('0x1d')](_0x9bb3('0x40'),_0x37e826);throw _0x37e826;});}return _0x4d57d9;})[_0x9bb3('0x18')](respondWithResult(_0x202d3d,0xc9))[_0x9bb3('0x2a')](handleError(_0x202d3d,null));};exports['update']=function(_0x5786f4,_0x4a5107){if(_0x5786f4[_0x9bb3('0x3a')]['id']){delete _0x5786f4[_0x9bb3('0x3a')]['id'];}return db[_0x9bb3('0x26')][_0x9bb3('0x38')]({'where':{'id':_0x5786f4[_0x9bb3('0x2c')]['id']}})[_0x9bb3('0x18')](handleEntityNotFound(_0x4a5107,null))['then'](saveUpdates(_0x5786f4[_0x9bb3('0x3a')],null))['then'](respondWithResult(_0x4a5107,null))['catch'](handleError(_0x4a5107,null));};exports['destroy']=function(_0xd241ea,_0x208dd0){return db[_0x9bb3('0x26')]['find']({'where':{'id':_0xd241ea[_0x9bb3('0x2c')]['id']}})[_0x9bb3('0x18')](handleEntityNotFound(_0x208dd0,null))['then'](removeEntity(_0x208dd0,null))[_0x9bb3('0x2a')](handleError(_0x208dd0,null));};exports[_0x9bb3('0x41')]=function(_0x2d4e30,_0x2eba23){return db[_0x9bb3('0x26')][_0x9bb3('0x41')]()[_0x9bb3('0x18')](respondWithResult(_0x2eba23,null))[_0x9bb3('0x2a')](handleError(_0x2eba23,null));};exports[_0x9bb3('0x42')]=function(_0x208250,_0x2f3d2e){var _0x4ce5f0={'raw':!![],'where':{}},_0xcf0b54={},_0x4a9fab;return db[_0x9bb3('0x26')][_0x9bb3('0x43')]({'where':{'id':_0x208250['params']['id']}})[_0x9bb3('0x18')](handleEntityNotFound(_0x2f3d2e,null))[_0x9bb3('0x18')](function(_0xca716c){if(_0xca716c){_0x4a9fab=_0xca716c[_0x9bb3('0x1a')]({'plain':!![]});_0xcf0b54[_0x9bb3('0x2d')]=_[_0x9bb3('0x2e')](db[_0x9bb3('0x44')][_0x9bb3('0x22')]);_0xcf0b54[_0x9bb3('0x2f')]=_[_0x9bb3('0x2e')](_0x208250['query']);_0xcf0b54[_0x9bb3('0x30')]=_[_0x9bb3('0x31')](_0xcf0b54[_0x9bb3('0x2d')],_0xcf0b54['query']);_0x4ce5f0['attributes']=_[_0x9bb3('0x31')](_0xcf0b54[_0x9bb3('0x2d')],qs[_0x9bb3('0x32')](_0x208250[_0x9bb3('0x2f')][_0x9bb3('0x32')]));_0x4ce5f0['attributes']=_0x4ce5f0[_0x9bb3('0x33')][_0x9bb3('0x34')]?_0x4ce5f0[_0x9bb3('0x33')]:_0xcf0b54[_0x9bb3('0x2d')];if(!_0x208250[_0x9bb3('0x2f')]['hasOwnProperty'](_0x9bb3('0x45'))){_0x4ce5f0[_0x9bb3('0x10')]=qs[_0x9bb3('0x10')](_0x208250[_0x9bb3('0x2f')]['limit']);_0x4ce5f0[_0x9bb3('0x13')]=qs['offset'](_0x208250[_0x9bb3('0x2f')][_0x9bb3('0x13')]);}_0x4ce5f0[_0x9bb3('0x46')]=qs[_0x9bb3('0x47')](_0x208250[_0x9bb3('0x2f')][_0x9bb3('0x47')]);_0x4ce5f0['where']=qs['filters'](_[_0x9bb3('0x48')](_0x208250['query'],_0xcf0b54[_0x9bb3('0x30')]));_0x4ce5f0[_0x9bb3('0x49')][_0x9bb3('0x4a')]=_0xca716c['id'];if(_0x208250['query'][_0x9bb3('0x4b')]){_0x4ce5f0[_0x9bb3('0x49')]=_[_0x9bb3('0x36')](_0x4ce5f0[_0x9bb3('0x49')],{'$or':_['map'](_0x4ce5f0[_0x9bb3('0x33')],function(_0x28205d){var _0x291160={};_0x291160[_0x28205d]={'$like':'%'+_0x208250[_0x9bb3('0x2f')][_0x9bb3('0x4b')]+'%'};return _0x291160;})});}_0x4ce5f0=_[_0x9bb3('0x36')]({},_0x4ce5f0,_0x208250[_0x9bb3('0x37')]);return db[_0x9bb3('0x44')][_0x9bb3('0x28')](_0x4ce5f0);}})['then'](function(_0x488aef){if(_0x488aef){return db[_0x9bb3('0x4c')][_0x9bb3('0x4d')]({'where':{'id':_['map'](_0x488aef,_0x9bb3('0x4e')),'role':_0x9bb3('0x4f')},'attributes':['id',_0x9bb3('0x1e'),_0x9bb3('0x50'),'updatedAt','createdAt']});}})[_0x9bb3('0x18')](function(_0xf00390){if(_0xf00390){return{'count':_0xf00390[_0x9bb3('0x12')],'rows':_[_0x9bb3('0x21')](_0xf00390['rows'],function(_0x86e3e5){return{'membername':_0x86e3e5[_0x9bb3('0x1e')],'UserId':_0x86e3e5['id'],'queue_name':_0x4a9fab[_0x9bb3('0x1e')],'MailQueueId':_0x4a9fab['id'],'interface':util[_0x9bb3('0x51')](_0x9bb3('0x52'),_0x9bb3('0x53'),_0x86e3e5[_0x9bb3('0x1e')]),'penalty':0x0,'paused':_0x86e3e5[_0x9bb3('0x50')],'createdAt':_0x86e3e5[_0x9bb3('0x54')],'updatedAt':_0x86e3e5[_0x9bb3('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f3d2e,_0x4ce5f0))[_0x9bb3('0x2a')](handleError(_0x2f3d2e,null));};exports[_0x9bb3('0x56')]=function(_0x9840fb,_0x530678){var _0x579113={};var _0x22218a={};var _0x113812;var _0x557a26;return db['MailQueue'][_0x9bb3('0x43')]({'where':{'id':_0x9840fb['params']['id']}})[_0x9bb3('0x18')](handleEntityNotFound(_0x530678,null))[_0x9bb3('0x18')](function(_0xe6f7f9){if(_0xe6f7f9){_0x113812=_0xe6f7f9;_0x22218a[_0x9bb3('0x2d')]=_[_0x9bb3('0x2e')](db[_0x9bb3('0x57')][_0x9bb3('0x22')]);_0x22218a['query']=_['keys'](_0x9840fb['query']);_0x22218a['filters']=_[_0x9bb3('0x31')](_0x22218a['model'],_0x22218a[_0x9bb3('0x2f')]);_0x579113[_0x9bb3('0x33')]=_[_0x9bb3('0x31')](_0x22218a[_0x9bb3('0x2d')],qs[_0x9bb3('0x32')](_0x9840fb['query']['fields']));_0x579113[_0x9bb3('0x33')]=_0x579113[_0x9bb3('0x33')][_0x9bb3('0x34')]?_0x579113[_0x9bb3('0x33')]:_0x22218a[_0x9bb3('0x2d')];_0x579113['order']=qs[_0x9bb3('0x47')](_0x9840fb[_0x9bb3('0x2f')]['sort']);_0x579113[_0x9bb3('0x49')]=qs[_0x9bb3('0x30')](_['pick'](_0x9840fb[_0x9bb3('0x2f')],_0x22218a[_0x9bb3('0x30')]));if(_0x9840fb[_0x9bb3('0x2f')]['filter']){_0x579113[_0x9bb3('0x49')]=_['merge'](_0x579113[_0x9bb3('0x49')],{'$or':_[_0x9bb3('0x21')](_0x579113[_0x9bb3('0x33')],function(_0x158c3c){var _0x6f37cc={};_0x6f37cc[_0x158c3c]={'$like':'%'+_0x9840fb[_0x9bb3('0x2f')][_0x9bb3('0x4b')]+'%'};return _0x6f37cc;})});}_0x579113=_[_0x9bb3('0x36')]({},_0x579113,_0x9840fb[_0x9bb3('0x37')]);return _0x113812['getTeams'](_0x579113);}})[_0x9bb3('0x18')](function(_0x4703ee){if(_0x4703ee){_0x557a26=_0x4703ee[_0x9bb3('0x34')];if(!_0x9840fb['query'][_0x9bb3('0x58')](_0x9bb3('0x45'))){_0x579113['limit']=qs[_0x9bb3('0x10')](_0x9840fb[_0x9bb3('0x2f')][_0x9bb3('0x10')]);_0x579113['offset']=qs[_0x9bb3('0x13')](_0x9840fb[_0x9bb3('0x2f')]['offset']);}return _0x113812[_0x9bb3('0x56')](_0x579113);}})[_0x9bb3('0x18')](function(_0x47f1a0){if(_0x47f1a0){return _0x47f1a0?{'count':_0x557a26,'rows':_0x47f1a0}:null;}})['then'](respondWithResult(_0x530678,null))[_0x9bb3('0x2a')](handleError(_0x530678,null));};exports[_0x9bb3('0x59')]=function(_0x5cc489,_0x15bde9){var _0x56b309=_0x5cc489[_0x9bb3('0x3a')][_0x9bb3('0x5a')];return db[_0x9bb3('0x57')][_0x9bb3('0x28')]({'where':{'id':_0x56b309},'attributes':['id'],'include':[{'model':db[_0x9bb3('0x4c')],'as':_0x9bb3('0x5b'),'attributes':['id',_0x9bb3('0x1e'),'online',_0x9bb3('0x5c'),_0x9bb3('0x5d')],'raw':!![]}]})[_0x9bb3('0x18')](function(_0x1139bb){if(_0x1139bb){var _0x4baee1=_[_0x9bb3('0x5e')](_0x1139bb,function(_0x4a52a3){var _0x34d3dc=_0x4a52a3[_0x9bb3('0x1a')]({'plain':!![]});return _0x34d3dc[_0x9bb3('0x5b')];});return db[_0x9bb3('0x26')][_0x9bb3('0x38')]({'where':{'id':_0x5cc489[_0x9bb3('0x2c')]['id']}})[_0x9bb3('0x18')](function(_0x1706aa){return db['sequelize'][_0x9bb3('0x5f')](function(_0xf6f922){return _0x1706aa[_0x9bb3('0x59')](_0x56b309,{'transaction':_0xf6f922})[_0x9bb3('0x18')](function(){return BPromise['each'](_0x4baee1,function(_0x36e32d){return db[_0x9bb3('0x44')][_0x9bb3('0x60')]({'where':{'UserId':_0x36e32d['id'],'MailQueueId':_0x5cc489[_0x9bb3('0x2c')]['id']},'transaction':_0xf6f922});});})[_0x9bb3('0x18')](function(){_0x4baee1[_0x9bb3('0x61')](function(_0xdb7709){socket[_0x9bb3('0x62')]('userMailQueue:save',{'UserId':_0xdb7709['id'],'MailQueueId':_0x1706aa['id']});});});});});}})[_0x9bb3('0x18')](respondWithStatusCode(_0x15bde9,null))[_0x9bb3('0x2a')](handleError(_0x15bde9,null));};exports['removeTeams']=function(_0x341f3e,_0x413648){return db['Team'][_0x9bb3('0x28')]({'where':{'id':_0x341f3e[_0x9bb3('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9bb3('0x4c')],'as':_0x9bb3('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x9bb3('0x18')](handleEntityNotFound(_0x413648,null))[_0x9bb3('0x18')](function(_0x2fad36){var _0x480752=_['map'](_0x2fad36,'id');var _0x1e05da=[];var _0x1466e2=[];var _0x568273=squel[_0x9bb3('0x63')]();_0x568273[_0x9bb3('0x64')](_0x9bb3('0x65'))[_0x9bb3('0x66')](_0x9bb3('0x67'),'tq')[_0x9bb3('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9bb3('0x49')](_0x9bb3('0x69'),_0x341f3e[_0x9bb3('0x2c')]['id']);for(var _0x423425=0x0;_0x423425<_0x2fad36[_0x9bb3('0x34')];_0x423425+=0x1){let _0x216f9c=_0x2fad36[_0x423425];for(var _0xf4e436=0x0;_0xf4e436<_0x216f9c[_0x9bb3('0x5b')]['length'];_0xf4e436+=0x1){let _0xc39cc4=_0x216f9c[_0x9bb3('0x5b')][_0xf4e436];var _0x1c06ea=_0x568273[_0x9bb3('0x6a')]();_0x1c06ea[_0x9bb3('0x49')]('ut.UserId\x20=\x20?',_0xc39cc4['id']);_0x1466e2[_0x9bb3('0x6b')](db[_0x9bb3('0x6c')][_0x9bb3('0x2f')](_0x1c06ea[_0x9bb3('0x6d')](),{'type':db[_0x9bb3('0x6c')][_0x9bb3('0x6e')][_0x9bb3('0x6f')]})[_0x9bb3('0x18')](function(_0x35c413){if(_0x35c413['length']===0x1){return _0xc39cc4['id'];}else{var _0x5387f4=_[_0x9bb3('0x70')](_[_0x9bb3('0x21')](_0x35c413,_0x9bb3('0x71')),function(_0x42feb7){return _[_0x9bb3('0x72')](_0x480752,_0x42feb7);});if(_0x5387f4){return _0xc39cc4['id'];}}}));}}return BPromise[_0x9bb3('0x73')](_0x1466e2)['then'](function(_0x4d2dc0){_0x1e05da=_(_0x1e05da)[_0x9bb3('0x74')](_0x4d2dc0)[_0x9bb3('0x75')]()[_0x9bb3('0x76')]();return db[_0x9bb3('0x26')][_0x9bb3('0x38')]({'where':{'id':_0x341f3e[_0x9bb3('0x2c')]['id']}})[_0x9bb3('0x18')](function(_0x19dbd0){return db['sequelize'][_0x9bb3('0x5f')](function(_0x3b5afa){return _0x19dbd0[_0x9bb3('0x77')](_0x341f3e[_0x9bb3('0x2f')][_0x9bb3('0x5a')],{'transaction':_0x3b5afa})['then'](function(){if(!_[_0x9bb3('0x78')](_0x1e05da)){return _0x19dbd0[_0x9bb3('0x79')](_0x1e05da,{'transaction':_0x3b5afa});}})[_0x9bb3('0x18')](function(){_0x1e05da['forEach'](function(_0x57d926){socket['emit'](_0x9bb3('0x7a'),{'UserId':_0x57d926,'MailQueueId':_0x19dbd0['id']});});});});});});})['then'](respondWithStatusCode(_0x413648,null))['catch'](handleError(_0x413648,null));};exports[_0x9bb3('0x7b')]=function(_0x4cc125,_0x56c7cf){return db[_0x9bb3('0x26')][_0x9bb3('0x38')]({'where':{'id':_0x4cc125['params']['id']}})[_0x9bb3('0x18')](handleEntityNotFound(_0x56c7cf,null))[_0x9bb3('0x18')](function(_0x312a33){if(_0x312a33){return _0x312a33['addAgents'](_0x4cc125[_0x9bb3('0x3a')]['ids'],_[_0x9bb3('0x7c')](_0x4cc125[_0x9bb3('0x3a')],[_0x9bb3('0x5a'),'id'])||{})[_0x9bb3('0x7d')](function(_0x137122){for(var _0x7fbeea=0x0;_0x7fbeea<_0x4cc125[_0x9bb3('0x3a')][_0x9bb3('0x5a')][_0x9bb3('0x34')];_0x7fbeea+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x4cc125[_0x9bb3('0x3a')][_0x9bb3('0x5a')][_0x7fbeea]),'MailQueueId':Number(_0x4cc125['params']['id'])});}return _0x137122;});}})[_0x9bb3('0x18')](respondWithResult(_0x56c7cf,null))['catch'](handleError(_0x56c7cf,null));};exports[_0x9bb3('0x79')]=function(_0x51de0a,_0x247993){return db[_0x9bb3('0x26')][_0x9bb3('0x38')]({'where':{'id':_0x51de0a[_0x9bb3('0x2c')]['id']}})[_0x9bb3('0x18')](handleEntityNotFound(_0x247993,null))[_0x9bb3('0x18')](function(_0x417586){if(_0x417586){return _0x417586[_0x9bb3('0x79')](_0x51de0a['query'][_0x9bb3('0x5a')])[_0x9bb3('0x18')](function(){if(_[_0x9bb3('0x7e')](_0x51de0a[_0x9bb3('0x2f')]['ids'])){for(var _0x565ceb=0x0;_0x565ceb<_0x51de0a[_0x9bb3('0x2f')][_0x9bb3('0x5a')]['length'];_0x565ceb+=0x1){socket['emit'](_0x9bb3('0x7a'),{'UserId':Number(_0x51de0a['query']['ids'][_0x565ceb]),'MailQueueId':Number(_0x51de0a[_0x9bb3('0x2c')]['id'])});}}else{socket[_0x9bb3('0x62')]('userMailQueue:remove',{'UserId':Number(_0x51de0a[_0x9bb3('0x2f')][_0x9bb3('0x5a')]),'MailQueueId':Number(_0x51de0a[_0x9bb3('0x2c')]['id'])});}});}})[_0x9bb3('0x18')](respondWithStatusCode(_0x247993,null))[_0x9bb3('0x2a')](handleError(_0x247993,null));};exports[_0x9bb3('0x7f')]=function(_0x3256fe,_0x1565cc){var _0xc64844={};var _0xa37cd5={};var _0x40672b;var _0x1b529b;return db['MailQueue'][_0x9bb3('0x43')]({'where':{'id':_0x3256fe[_0x9bb3('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1565cc,null))[_0x9bb3('0x18')](function(_0x5f72c4){if(_0x5f72c4){_0x40672b=_0x5f72c4;_0xa37cd5['model']=_[_0x9bb3('0x2e')](db[_0x9bb3('0x4c')]['rawAttributes']);_0xa37cd5[_0x9bb3('0x2f')]=_['keys'](_0x3256fe[_0x9bb3('0x2f')]);_0xa37cd5[_0x9bb3('0x30')]=_[_0x9bb3('0x31')](_0xa37cd5[_0x9bb3('0x2d')],_0xa37cd5[_0x9bb3('0x2f')]);_0xc64844[_0x9bb3('0x33')]=_[_0x9bb3('0x31')](_0xa37cd5[_0x9bb3('0x2d')],qs[_0x9bb3('0x32')](_0x3256fe[_0x9bb3('0x2f')][_0x9bb3('0x32')]));_0xc64844[_0x9bb3('0x33')]=_0xc64844[_0x9bb3('0x33')][_0x9bb3('0x34')]?_0xc64844[_0x9bb3('0x33')]:_0xa37cd5[_0x9bb3('0x2d')];_0xc64844[_0x9bb3('0x46')]=qs[_0x9bb3('0x47')](_0x3256fe[_0x9bb3('0x2f')][_0x9bb3('0x47')]);_0xc64844[_0x9bb3('0x49')]=qs[_0x9bb3('0x30')](_['pick'](_0x3256fe[_0x9bb3('0x2f')],_0xa37cd5[_0x9bb3('0x30')]));if(_0x3256fe[_0x9bb3('0x2f')][_0x9bb3('0x4b')]){_0xc64844[_0x9bb3('0x49')]=_[_0x9bb3('0x36')](_0xc64844[_0x9bb3('0x49')],{'$or':_['map'](_0xc64844[_0x9bb3('0x33')],function(_0x26ec17){var _0x489bc3={};_0x489bc3[_0x26ec17]={'$like':'%'+_0x3256fe[_0x9bb3('0x2f')][_0x9bb3('0x4b')]+'%'};return _0x489bc3;})});}_0xc64844=_[_0x9bb3('0x36')]({},_0xc64844,_0x3256fe[_0x9bb3('0x37')]);return _0x40672b[_0x9bb3('0x7f')](_0xc64844);}})[_0x9bb3('0x18')](function(_0x539f22){if(_0x539f22){_0x1b529b=_0x539f22['length'];if(!_0x3256fe[_0x9bb3('0x2f')]['hasOwnProperty'](_0x9bb3('0x45'))){_0xc64844['limit']=qs[_0x9bb3('0x10')](_0x3256fe[_0x9bb3('0x2f')]['limit']);_0xc64844[_0x9bb3('0x13')]=qs[_0x9bb3('0x13')](_0x3256fe['query']['offset']);}return _0x40672b['getAgents'](_0xc64844);}})[_0x9bb3('0x18')](function(_0xdd1392){if(_0xdd1392){return _0xdd1392?{'count':_0x1b529b,'rows':_0xdd1392}:null;}})[_0x9bb3('0x18')](respondWithResult(_0x1565cc,null))[_0x9bb3('0x2a')](handleError(_0x1565cc,null));}; \ No newline at end of file +var _0x4306=['length','hasOwnProperty','nolimit','limit','order','sort','pick','MailQueueId','filter','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','union','compact','value','transaction','isEmpty','addAgents','omit','removeAgents','isArray','userMailQueue:remove','getAgents','options','bluebird','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','set','Content-Range','then','get','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','query','MailQueue','rows','catch','show','params','keys','filters','intersection','model','fields','attributes','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','describe','UserMailQueue'];(function(_0x2470fb,_0x4ccd34){var _0x2d781d=function(_0x34c310){while(--_0x34c310){_0x2470fb['push'](_0x2470fb['shift']());}};_0x2d781d(++_0x4ccd34);}(_0x4306,0xaf));var _0x6430=function(_0x37e900,_0x32919c){_0x37e900=_0x37e900-0x0;var _0x2a7a7c=_0x4306[_0x37e900];return _0x2a7a7c;};'use strict';var BPromise=require(_0x6430('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x6430('0x1'));var logger=require(_0x6430('0x2'))('api');var config=require(_0x6430('0x3'));var db=require(_0x6430('0x4'))['db'];config[_0x6430('0x5')]=_['defaults'](config[_0x6430('0x5')],{'host':_0x6430('0x6'),'port':0x18eb});var socket=require(_0x6430('0x7'))(new Redis(config[_0x6430('0x5')]));require('./mailQueue.socket')[_0x6430('0x8')](socket);function respondWithStatusCode(_0x3f94b2,_0x552283){_0x552283=_0x552283||0xcc;return function(_0x5c65f8){if(_0x5c65f8){return _0x3f94b2[_0x6430('0x9')](_0x552283);}return _0x3f94b2['status'](_0x552283)['end']();};}function respondWithResult(_0x5955ae,_0x2a50f1){_0x2a50f1=_0x2a50f1||0xc8;return function(_0x73687c){if(_0x73687c){return _0x5955ae[_0x6430('0xa')](_0x2a50f1)[_0x6430('0xb')](_0x73687c);}};}function respondWithFilteredResult(_0x4097d7,_0x42c7ee){return function(_0x5bad3c){if(_0x5bad3c){var _0x11eb91=typeof _0x42c7ee['offset']===_0x6430('0xc')&&typeof _0x42c7ee['limit']==='undefined';var _0x3fb29e=_0x5bad3c[_0x6430('0xd')];var _0xf1b53=_0x11eb91?0x0:_0x42c7ee[_0x6430('0xe')];var _0x311917=_0x11eb91?_0x5bad3c[_0x6430('0xd')]:_0x42c7ee['offset']+_0x42c7ee['limit'];var _0x37cb1d;if(_0x311917>=_0x3fb29e){_0x311917=_0x3fb29e;_0x37cb1d=0xc8;}else{_0x37cb1d=0xce;}_0x4097d7[_0x6430('0xa')](_0x37cb1d);return _0x4097d7[_0x6430('0xf')](_0x6430('0x10'),_0xf1b53+'-'+_0x311917+'/'+_0x3fb29e)[_0x6430('0xb')](_0x5bad3c);}return null;};}function saveUpdates(_0x1baa04){return function(_0x2092c7){if(_0x2092c7){return _0x2092c7['update'](_0x1baa04)[_0x6430('0x11')](function(_0x2c2ee8){return _0x2c2ee8;});}return null;};}function removeEntity(_0x59ac8e){return function(_0x42ebc7){if(_0x42ebc7){return _0x42ebc7['destroy']()[_0x6430('0x11')](function(){var _0x5ee2af=_0x42ebc7[_0x6430('0x12')]({'plain':!![]});var _0x2ea1a2='MailQueues';return db['UserProfileResource'][_0x6430('0x13')]({'where':{'type':_0x2ea1a2,'resourceId':_0x5ee2af['id']}})[_0x6430('0x11')](function(){return _0x42ebc7;});})[_0x6430('0x11')](function(){_0x59ac8e[_0x6430('0xa')](0xcc)[_0x6430('0x14')]();});}};}function handleEntityNotFound(_0x46e1a8){return function(_0x274305){if(!_0x274305){_0x46e1a8['sendStatus'](0x194);}return _0x274305;};}function handleError(_0x1f6364,_0x369310){_0x369310=_0x369310||0x1f4;return function(_0x3c53a4){logger[_0x6430('0x15')](_0x3c53a4[_0x6430('0x16')]);if(_0x3c53a4[_0x6430('0x17')]){delete _0x3c53a4[_0x6430('0x17')];}_0x1f6364[_0x6430('0xa')](_0x369310)[_0x6430('0x18')](_0x3c53a4);};}exports[_0x6430('0x19')]=function(_0x3c53ff,_0x64967b){var _0x32c4be={};var _0x3fc4a0={'count':0x0,'rows':[]};var _0x4f5d95=_[_0x6430('0x1a')](db['MailQueue'][_0x6430('0x1b')],function(_0x20f77f){return{'name':_0x20f77f[_0x6430('0x1c')],'type':_0x20f77f[_0x6430('0x1d')][_0x6430('0x1e')]};});_0x32c4be=qs[_0x6430('0x1f')](_0x4f5d95,_0x3c53ff);var _0x3c0edd={'where':_0x32c4be[_0x6430('0x20')]};return db['MailQueue'][_0x6430('0xd')](_0x3c0edd)[_0x6430('0x11')](function(_0x1d18da){_0x3fc4a0[_0x6430('0xd')]=_0x1d18da;_0x32c4be[_0x6430('0x21')]=qs['include'](_0x3c53ff[_0x6430('0x22')]);return db[_0x6430('0x23')]['findAll'](_0x32c4be);})[_0x6430('0x11')](function(_0x12cce4){_0x3fc4a0[_0x6430('0x24')]=_0x12cce4;return _0x3fc4a0;})[_0x6430('0x11')](respondWithFilteredResult(_0x64967b,_0x32c4be))[_0x6430('0x25')](handleError(_0x64967b,null));};exports[_0x6430('0x26')]=function(_0x1ffcd6,_0x8de278){var _0xd94d85={'raw':!![],'where':{'id':_0x1ffcd6[_0x6430('0x27')]['id']}},_0x4d26ce={};_0x4d26ce['model']=_[_0x6430('0x28')](db[_0x6430('0x23')][_0x6430('0x1b')]);_0x4d26ce[_0x6430('0x22')]=_[_0x6430('0x28')](_0x1ffcd6[_0x6430('0x22')]);_0x4d26ce[_0x6430('0x29')]=_[_0x6430('0x2a')](_0x4d26ce['model'],_0x4d26ce[_0x6430('0x22')]);_0xd94d85['attributes']=_[_0x6430('0x2a')](_0x4d26ce[_0x6430('0x2b')],qs[_0x6430('0x2c')](_0x1ffcd6[_0x6430('0x22')][_0x6430('0x2c')]));_0xd94d85[_0x6430('0x2d')]=_0xd94d85['attributes']['length']?_0xd94d85[_0x6430('0x2d')]:_0x4d26ce[_0x6430('0x2b')];if(_0x1ffcd6[_0x6430('0x22')][_0x6430('0x2e')]){_0xd94d85[_0x6430('0x21')]=[{'all':!![]}];}_0xd94d85=_[_0x6430('0x2f')]({},_0xd94d85,_0x1ffcd6['options']);return db[_0x6430('0x23')][_0x6430('0x30')](_0xd94d85)[_0x6430('0x11')](handleEntityNotFound(_0x8de278,null))[_0x6430('0x11')](respondWithResult(_0x8de278,null))['catch'](handleError(_0x8de278,null));};exports['create']=function(_0x13b16b,_0x4998bc){return db[_0x6430('0x23')][_0x6430('0x31')](_0x13b16b['body'],{})['then'](function(_0x160368){var _0x2f2ebc=_0x13b16b[_0x6430('0x32')]['get']({'plain':!![]});if(!_0x2f2ebc)throw new Error(_0x6430('0x33'));if(_0x2f2ebc['role']==='user'){var _0x336ab2=_0x160368[_0x6430('0x12')]({'plain':!![]});var _0xfec9e0=_0x6430('0x34');return db[_0x6430('0x35')][_0x6430('0x30')]({'where':{'name':_0xfec9e0,'userProfileId':_0x2f2ebc[_0x6430('0x36')]},'raw':!![]})[_0x6430('0x11')](function(_0x126bd3){if(_0x126bd3&&_0x126bd3[_0x6430('0x37')]===0x0){return db[_0x6430('0x38')][_0x6430('0x31')]({'name':_0x336ab2['name'],'resourceId':_0x336ab2['id'],'type':_0x126bd3[_0x6430('0x17')],'sectionId':_0x126bd3['id']},{})[_0x6430('0x11')](function(){return _0x160368;});}else{return _0x160368;}})[_0x6430('0x25')](function(_0x33d4ea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33d4ea);throw _0x33d4ea;});}return _0x160368;})[_0x6430('0x11')](respondWithResult(_0x4998bc,0xc9))[_0x6430('0x25')](handleError(_0x4998bc,null));};exports[_0x6430('0x39')]=function(_0xea83d8,_0x43fca9){if(_0xea83d8[_0x6430('0x3a')]['id']){delete _0xea83d8[_0x6430('0x3a')]['id'];}return db[_0x6430('0x23')]['find']({'where':{'id':_0xea83d8[_0x6430('0x27')]['id']}})['then'](handleEntityNotFound(_0x43fca9,null))['then'](saveUpdates(_0xea83d8[_0x6430('0x3a')],null))['then'](respondWithResult(_0x43fca9,null))[_0x6430('0x25')](handleError(_0x43fca9,null));};exports[_0x6430('0x13')]=function(_0x220534,_0x5533a8){return db[_0x6430('0x23')][_0x6430('0x30')]({'where':{'id':_0x220534[_0x6430('0x27')]['id']}})['then'](handleEntityNotFound(_0x5533a8,null))[_0x6430('0x11')](removeEntity(_0x5533a8,null))[_0x6430('0x25')](handleError(_0x5533a8,null));};exports[_0x6430('0x3b')]=function(_0x668a47,_0x41c166){return db[_0x6430('0x23')][_0x6430('0x3b')]()[_0x6430('0x11')](respondWithResult(_0x41c166,null))['catch'](handleError(_0x41c166,null));};exports['getMembers']=function(_0x266038,_0x181efe){var _0x1866a4={'raw':!![],'where':{}},_0x84c0d2={},_0x2e9ce3;return db[_0x6430('0x23')]['findOne']({'where':{'id':_0x266038['params']['id']}})[_0x6430('0x11')](handleEntityNotFound(_0x181efe,null))[_0x6430('0x11')](function(_0x4a771d){if(_0x4a771d){_0x2e9ce3=_0x4a771d[_0x6430('0x12')]({'plain':!![]});_0x84c0d2[_0x6430('0x2b')]=_[_0x6430('0x28')](db[_0x6430('0x3c')][_0x6430('0x1b')]);_0x84c0d2[_0x6430('0x22')]=_[_0x6430('0x28')](_0x266038['query']);_0x84c0d2[_0x6430('0x29')]=_[_0x6430('0x2a')](_0x84c0d2[_0x6430('0x2b')],_0x84c0d2['query']);_0x1866a4[_0x6430('0x2d')]=_[_0x6430('0x2a')](_0x84c0d2[_0x6430('0x2b')],qs[_0x6430('0x2c')](_0x266038[_0x6430('0x22')][_0x6430('0x2c')]));_0x1866a4[_0x6430('0x2d')]=_0x1866a4[_0x6430('0x2d')][_0x6430('0x3d')]?_0x1866a4[_0x6430('0x2d')]:_0x84c0d2[_0x6430('0x2b')];if(!_0x266038[_0x6430('0x22')][_0x6430('0x3e')](_0x6430('0x3f'))){_0x1866a4[_0x6430('0x40')]=qs[_0x6430('0x40')](_0x266038[_0x6430('0x22')][_0x6430('0x40')]);_0x1866a4[_0x6430('0xe')]=qs[_0x6430('0xe')](_0x266038['query'][_0x6430('0xe')]);}_0x1866a4[_0x6430('0x41')]=qs[_0x6430('0x42')](_0x266038[_0x6430('0x22')]['sort']);_0x1866a4[_0x6430('0x20')]=qs[_0x6430('0x29')](_[_0x6430('0x43')](_0x266038[_0x6430('0x22')],_0x84c0d2['filters']));_0x1866a4[_0x6430('0x20')][_0x6430('0x44')]=_0x4a771d['id'];if(_0x266038[_0x6430('0x22')][_0x6430('0x45')]){_0x1866a4['where']=_[_0x6430('0x2f')](_0x1866a4[_0x6430('0x20')],{'$or':_[_0x6430('0x1a')](_0x1866a4['attributes'],function(_0x99a605){var _0x58cf0a={};_0x58cf0a[_0x99a605]={'$like':'%'+_0x266038[_0x6430('0x22')][_0x6430('0x45')]+'%'};return _0x58cf0a;})});}_0x1866a4=_[_0x6430('0x2f')]({},_0x1866a4,_0x266038['options']);return db[_0x6430('0x3c')][_0x6430('0x46')](_0x1866a4);}})[_0x6430('0x11')](function(_0xf29eaf){if(_0xf29eaf){return db[_0x6430('0x47')][_0x6430('0x48')]({'where':{'id':_[_0x6430('0x1a')](_0xf29eaf,_0x6430('0x49')),'role':'agent'},'attributes':['id',_0x6430('0x17'),_0x6430('0x4a'),_0x6430('0x4b'),'createdAt']});}})[_0x6430('0x11')](function(_0x47a185){if(_0x47a185){return{'count':_0x47a185[_0x6430('0xd')],'rows':_[_0x6430('0x1a')](_0x47a185[_0x6430('0x24')],function(_0x276a52){return{'membername':_0x276a52['name'],'UserId':_0x276a52['id'],'queue_name':_0x2e9ce3[_0x6430('0x17')],'MailQueueId':_0x2e9ce3['id'],'interface':util['format'](_0x6430('0x4c'),_0x6430('0x4d'),_0x276a52[_0x6430('0x17')]),'penalty':0x0,'paused':_0x276a52[_0x6430('0x4a')],'createdAt':_0x276a52['createdAt'],'updatedAt':_0x276a52[_0x6430('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6430('0x11')](respondWithFilteredResult(_0x181efe,_0x1866a4))[_0x6430('0x25')](handleError(_0x181efe,null));};exports[_0x6430('0x4e')]=function(_0x4e6652,_0x1b5483){var _0x4fb524={};var _0x55fd48={};var _0xdc9e3a;var _0x570281;return db[_0x6430('0x23')][_0x6430('0x4f')]({'where':{'id':_0x4e6652['params']['id']}})['then'](handleEntityNotFound(_0x1b5483,null))[_0x6430('0x11')](function(_0x2add3){if(_0x2add3){_0xdc9e3a=_0x2add3;_0x55fd48['model']=_[_0x6430('0x28')](db[_0x6430('0x50')]['rawAttributes']);_0x55fd48[_0x6430('0x22')]=_['keys'](_0x4e6652[_0x6430('0x22')]);_0x55fd48[_0x6430('0x29')]=_[_0x6430('0x2a')](_0x55fd48[_0x6430('0x2b')],_0x55fd48[_0x6430('0x22')]);_0x4fb524[_0x6430('0x2d')]=_[_0x6430('0x2a')](_0x55fd48[_0x6430('0x2b')],qs[_0x6430('0x2c')](_0x4e6652[_0x6430('0x22')]['fields']));_0x4fb524[_0x6430('0x2d')]=_0x4fb524[_0x6430('0x2d')][_0x6430('0x3d')]?_0x4fb524[_0x6430('0x2d')]:_0x55fd48[_0x6430('0x2b')];_0x4fb524['order']=qs['sort'](_0x4e6652[_0x6430('0x22')][_0x6430('0x42')]);_0x4fb524[_0x6430('0x20')]=qs[_0x6430('0x29')](_[_0x6430('0x43')](_0x4e6652['query'],_0x55fd48['filters']));if(_0x4e6652[_0x6430('0x22')][_0x6430('0x45')]){_0x4fb524['where']=_[_0x6430('0x2f')](_0x4fb524[_0x6430('0x20')],{'$or':_[_0x6430('0x1a')](_0x4fb524[_0x6430('0x2d')],function(_0x47b230){var _0x32d77b={};_0x32d77b[_0x47b230]={'$like':'%'+_0x4e6652['query']['filter']+'%'};return _0x32d77b;})});}_0x4fb524=_[_0x6430('0x2f')]({},_0x4fb524,_0x4e6652['options']);return _0xdc9e3a[_0x6430('0x4e')](_0x4fb524);}})['then'](function(_0x3fbe7f){if(_0x3fbe7f){_0x570281=_0x3fbe7f['length'];if(!_0x4e6652[_0x6430('0x22')][_0x6430('0x3e')]('nolimit')){_0x4fb524[_0x6430('0x40')]=qs[_0x6430('0x40')](_0x4e6652[_0x6430('0x22')][_0x6430('0x40')]);_0x4fb524[_0x6430('0xe')]=qs[_0x6430('0xe')](_0x4e6652[_0x6430('0x22')]['offset']);}return _0xdc9e3a['getTeams'](_0x4fb524);}})[_0x6430('0x11')](function(_0x774e8c){if(_0x774e8c){return _0x774e8c?{'count':_0x570281,'rows':_0x774e8c}:null;}})[_0x6430('0x11')](respondWithResult(_0x1b5483,null))[_0x6430('0x25')](handleError(_0x1b5483,null));};exports[_0x6430('0x51')]=function(_0x13038a,_0x1a96ba){var _0x1d7f23=_0x13038a['body'][_0x6430('0x52')];return db[_0x6430('0x50')][_0x6430('0x46')]({'where':{'id':_0x1d7f23},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6430('0x53'),'attributes':['id',_0x6430('0x17'),_0x6430('0x54'),_0x6430('0x55'),_0x6430('0x56')],'raw':!![]}]})['then'](function(_0x5e6e91){if(_0x5e6e91){var _0x6e819b=_[_0x6430('0x57')](_0x5e6e91,function(_0xd0065e){var _0x37c5fc=_0xd0065e['get']({'plain':!![]});return _0x37c5fc[_0x6430('0x53')];});return db['MailQueue'][_0x6430('0x30')]({'where':{'id':_0x13038a[_0x6430('0x27')]['id']}})[_0x6430('0x11')](function(_0x1290e6){return db[_0x6430('0x58')]['transaction'](function(_0x3f29e6){return _0x1290e6[_0x6430('0x51')](_0x1d7f23,{'transaction':_0x3f29e6})[_0x6430('0x11')](function(){return BPromise[_0x6430('0x59')](_0x6e819b,function(_0x4f44a8){return db[_0x6430('0x3c')][_0x6430('0x5a')]({'where':{'UserId':_0x4f44a8['id'],'MailQueueId':_0x13038a[_0x6430('0x27')]['id']},'transaction':_0x3f29e6});});})[_0x6430('0x11')](function(){_0x6e819b[_0x6430('0x5b')](function(_0x15ed94){socket[_0x6430('0x5c')](_0x6430('0x5d'),{'UserId':_0x15ed94['id'],'MailQueueId':_0x1290e6['id']});});});});});}})[_0x6430('0x11')](respondWithStatusCode(_0x1a96ba,null))[_0x6430('0x25')](handleError(_0x1a96ba,null));};exports[_0x6430('0x5e')]=function(_0x5072bb,_0x47b909){return db[_0x6430('0x50')][_0x6430('0x46')]({'where':{'id':_0x5072bb['query'][_0x6430('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6430('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x47b909,null))[_0x6430('0x11')](function(_0xbfd20f){var _0xc17ad3=_[_0x6430('0x1a')](_0xbfd20f,'id');var _0x1d80ed=[];var _0x35c3ac=[];var _0x312598=squel[_0x6430('0x5f')]();_0x312598['field'](_0x6430('0x60'))[_0x6430('0x61')](_0x6430('0x62'),'tq')['join'](_0x6430('0x63'),'ut',_0x6430('0x64'))[_0x6430('0x20')](_0x6430('0x65'),_0x5072bb[_0x6430('0x27')]['id']);for(var _0x214684=0x0;_0x214684<_0xbfd20f[_0x6430('0x3d')];_0x214684+=0x1){let _0x4fa763=_0xbfd20f[_0x214684];for(var _0x42e336=0x0;_0x42e336<_0x4fa763[_0x6430('0x53')]['length'];_0x42e336+=0x1){let _0x5c1a67=_0x4fa763[_0x6430('0x53')][_0x42e336];var _0xc46f8a=_0x312598[_0x6430('0x66')]();_0xc46f8a[_0x6430('0x20')](_0x6430('0x67'),_0x5c1a67['id']);_0x35c3ac['push'](db[_0x6430('0x58')][_0x6430('0x22')](_0xc46f8a[_0x6430('0x68')](),{'type':db[_0x6430('0x58')]['QueryTypes'][_0x6430('0x69')]})[_0x6430('0x11')](function(_0x45242b){if(_0x45242b[_0x6430('0x3d')]===0x1){return _0x5c1a67['id'];}else{var _0x73d99=_['every'](_[_0x6430('0x1a')](_0x45242b,'TeamId'),function(_0x40073e){return _['includes'](_0xc17ad3,_0x40073e);});if(_0x73d99){return _0x5c1a67['id'];}}}));}}return BPromise['all'](_0x35c3ac)[_0x6430('0x11')](function(_0x5952cb){_0x1d80ed=_(_0x1d80ed)[_0x6430('0x6a')](_0x5952cb)[_0x6430('0x6b')]()[_0x6430('0x6c')]();return db['MailQueue'][_0x6430('0x30')]({'where':{'id':_0x5072bb[_0x6430('0x27')]['id']}})[_0x6430('0x11')](function(_0x538574){return db['sequelize'][_0x6430('0x6d')](function(_0x190778){return _0x538574[_0x6430('0x5e')](_0x5072bb['query'][_0x6430('0x52')],{'transaction':_0x190778})[_0x6430('0x11')](function(){if(!_[_0x6430('0x6e')](_0x1d80ed)){return _0x538574['removeAgents'](_0x1d80ed,{'transaction':_0x190778});}})[_0x6430('0x11')](function(){_0x1d80ed[_0x6430('0x5b')](function(_0x19bf6c){socket['emit']('userMailQueue:remove',{'UserId':_0x19bf6c,'MailQueueId':_0x538574['id']});});});});});});})[_0x6430('0x11')](respondWithStatusCode(_0x47b909,null))[_0x6430('0x25')](handleError(_0x47b909,null));};exports[_0x6430('0x6f')]=function(_0x402855,_0xe3993b){return db[_0x6430('0x23')][_0x6430('0x30')]({'where':{'id':_0x402855[_0x6430('0x27')]['id']}})[_0x6430('0x11')](handleEntityNotFound(_0xe3993b,null))[_0x6430('0x11')](function(_0x3a06b6){if(_0x3a06b6){return _0x3a06b6[_0x6430('0x6f')](_0x402855['body'][_0x6430('0x52')],_[_0x6430('0x70')](_0x402855[_0x6430('0x3a')],['ids','id'])||{})['spread'](function(_0x3f6969){for(var _0x23675c=0x0;_0x23675c<_0x402855[_0x6430('0x3a')][_0x6430('0x52')][_0x6430('0x3d')];_0x23675c+=0x1){socket[_0x6430('0x5c')](_0x6430('0x5d'),{'UserId':Number(_0x402855['body']['ids'][_0x23675c]),'MailQueueId':Number(_0x402855[_0x6430('0x27')]['id'])});}return _0x3f6969;});}})[_0x6430('0x11')](respondWithResult(_0xe3993b,null))[_0x6430('0x25')](handleError(_0xe3993b,null));};exports[_0x6430('0x71')]=function(_0x5b0276,_0x6d712b){return db[_0x6430('0x23')][_0x6430('0x30')]({'where':{'id':_0x5b0276[_0x6430('0x27')]['id']}})[_0x6430('0x11')](handleEntityNotFound(_0x6d712b,null))[_0x6430('0x11')](function(_0x470e92){if(_0x470e92){return _0x470e92[_0x6430('0x71')](_0x5b0276[_0x6430('0x22')][_0x6430('0x52')])['then'](function(){if(_[_0x6430('0x72')](_0x5b0276[_0x6430('0x22')][_0x6430('0x52')])){for(var _0xc54d0f=0x0;_0xc54d0f<_0x5b0276['query']['ids'][_0x6430('0x3d')];_0xc54d0f+=0x1){socket[_0x6430('0x5c')](_0x6430('0x73'),{'UserId':Number(_0x5b0276['query']['ids'][_0xc54d0f]),'MailQueueId':Number(_0x5b0276['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x5b0276[_0x6430('0x22')][_0x6430('0x52')]),'MailQueueId':Number(_0x5b0276[_0x6430('0x27')]['id'])});}});}})[_0x6430('0x11')](respondWithStatusCode(_0x6d712b,null))[_0x6430('0x25')](handleError(_0x6d712b,null));};exports[_0x6430('0x74')]=function(_0x1302c7,_0x14d51f){var _0x276378={};var _0x48dc9f={};var _0x4556ac;var _0xd279e0;return db[_0x6430('0x23')][_0x6430('0x4f')]({'where':{'id':_0x1302c7[_0x6430('0x27')]['id']}})[_0x6430('0x11')](handleEntityNotFound(_0x14d51f,null))[_0x6430('0x11')](function(_0x5ec162){if(_0x5ec162){_0x4556ac=_0x5ec162;_0x48dc9f[_0x6430('0x2b')]=_['keys'](db[_0x6430('0x47')][_0x6430('0x1b')]);_0x48dc9f[_0x6430('0x22')]=_[_0x6430('0x28')](_0x1302c7[_0x6430('0x22')]);_0x48dc9f[_0x6430('0x29')]=_[_0x6430('0x2a')](_0x48dc9f[_0x6430('0x2b')],_0x48dc9f[_0x6430('0x22')]);_0x276378[_0x6430('0x2d')]=_[_0x6430('0x2a')](_0x48dc9f[_0x6430('0x2b')],qs[_0x6430('0x2c')](_0x1302c7['query'][_0x6430('0x2c')]));_0x276378[_0x6430('0x2d')]=_0x276378[_0x6430('0x2d')][_0x6430('0x3d')]?_0x276378[_0x6430('0x2d')]:_0x48dc9f[_0x6430('0x2b')];_0x276378['order']=qs[_0x6430('0x42')](_0x1302c7[_0x6430('0x22')][_0x6430('0x42')]);_0x276378[_0x6430('0x20')]=qs['filters'](_['pick'](_0x1302c7[_0x6430('0x22')],_0x48dc9f[_0x6430('0x29')]));if(_0x1302c7[_0x6430('0x22')][_0x6430('0x45')]){_0x276378[_0x6430('0x20')]=_[_0x6430('0x2f')](_0x276378[_0x6430('0x20')],{'$or':_[_0x6430('0x1a')](_0x276378[_0x6430('0x2d')],function(_0x92b61){var _0x3996c8={};_0x3996c8[_0x92b61]={'$like':'%'+_0x1302c7['query']['filter']+'%'};return _0x3996c8;})});}_0x276378=_[_0x6430('0x2f')]({},_0x276378,_0x1302c7[_0x6430('0x75')]);return _0x4556ac[_0x6430('0x74')](_0x276378);}})[_0x6430('0x11')](function(_0x49fd63){if(_0x49fd63){_0xd279e0=_0x49fd63[_0x6430('0x3d')];if(!_0x1302c7['query']['hasOwnProperty'](_0x6430('0x3f'))){_0x276378['limit']=qs[_0x6430('0x40')](_0x1302c7['query'][_0x6430('0x40')]);_0x276378[_0x6430('0xe')]=qs[_0x6430('0xe')](_0x1302c7[_0x6430('0x22')][_0x6430('0xe')]);}return _0x4556ac[_0x6430('0x74')](_0x276378);}})[_0x6430('0x11')](function(_0x57a60b){if(_0x57a60b){return _0x57a60b?{'count':_0xd279e0,'rows':_0x57a60b}:null;}})['then'](respondWithResult(_0x14d51f,null))[_0x6430('0x25')](handleError(_0x14d51f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 21e6e5b..442c9b2 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 _0xb7b9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x5a8e4c,_0x138b0f){var _0x38ca27=function(_0x1dbcfe){while(--_0x1dbcfe){_0x5a8e4c['push'](_0x5a8e4c['shift']());}};_0x38ca27(++_0x138b0f);}(_0xb7b9,0x6b));var _0x9b7b=function(_0x4a9677,_0x4c2c76){_0x4a9677=_0x4a9677-0x0;var _0x224629=_0xb7b9[_0x4a9677];return _0x224629;};'use strict';var EventEmitter=require(_0x9b7b('0x0'));var MailQueue=require(_0x9b7b('0x1'))['db'][_0x9b7b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9b7b('0x3')](0x0);var events={'afterCreate':_0x9b7b('0x4'),'afterUpdate':_0x9b7b('0x5'),'afterDestroy':_0x9b7b('0x6')};function emitEvent(_0x53166f){return function(_0x1c811b,_0x53a78a,_0x410e9e){MailQueueEvents['emit'](_0x53166f+':'+_0x1c811b['id'],_0x1c811b);MailQueueEvents[_0x9b7b('0x7')](_0x53166f,_0x1c811b);_0x410e9e(null);};}for(var e in events){if(events[_0x9b7b('0x8')](e)){var event=events[e];MailQueue[_0x9b7b('0x9')](e,emitEvent(event));}}module[_0x9b7b('0xa')]=MailQueueEvents; \ No newline at end of file +var _0x736e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','save','update'];(function(_0x557f74,_0x3443fd){var _0x597f0b=function(_0x4ec6ff){while(--_0x4ec6ff){_0x557f74['push'](_0x557f74['shift']());}};_0x597f0b(++_0x3443fd);}(_0x736e,0xf7));var _0xe736=function(_0x434ee5,_0x1842dc){_0x434ee5=_0x434ee5-0x0;var _0x472e16=_0x736e[_0x434ee5];return _0x472e16;};'use strict';var EventEmitter=require(_0xe736('0x0'));var MailQueue=require(_0xe736('0x1'))['db'][_0xe736('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe736('0x3'),'afterUpdate':_0xe736('0x4'),'afterDestroy':_0xe736('0x5')};function emitEvent(_0x509008){return function(_0x21518a,_0x27c7b2,_0x29b101){MailQueueEvents['emit'](_0x509008+':'+_0x21518a['id'],_0x21518a);MailQueueEvents[_0xe736('0x6')](_0x509008,_0x21518a);_0x29b101(null);};}for(var e in events){if(events[_0xe736('0x7')](e)){var event=events[e];MailQueue[_0xe736('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8ca6947..d0c3c8e 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 _0x5ff0=['moment','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','lodash','util','../../config/logger','api'];(function(_0x519527,_0x47486e){var _0x5c9599=function(_0x265f1d){while(--_0x265f1d){_0x519527['push'](_0x519527['shift']());}};_0x5c9599(++_0x47486e);}(_0x5ff0,0x1f4));var _0x05ff=function(_0x34b84c,_0x30cb90){_0x34b84c=_0x34b84c-0x0;var _0x38f2b4=_0x5ff0[_0x34b84c];return _0x38f2b4;};'use strict';var _=require(_0x05ff('0x0'));var util=require(_0x05ff('0x1'));var logger=require(_0x05ff('0x2'))(_0x05ff('0x3'));var moment=require(_0x05ff('0x4'));var BPromise=require('bluebird');var rp=require(_0x05ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05ff('0x6'));var config=require(_0x05ff('0x7'));var attributes=require(_0x05ff('0x8'));module[_0x05ff('0x9')]=function(_0x4a57d8,_0x1527f8){return _0x4a57d8[_0x05ff('0xa')](_0x05ff('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09d5=['./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5e1c66,_0x4c7aad){var _0x29b22c=function(_0x1702df){while(--_0x1702df){_0x5e1c66['push'](_0x5e1c66['shift']());}};_0x29b22c(++_0x4c7aad);}(_0x09d5,0x198));var _0x509d=function(_0x380b6b,_0x2d7838){_0x380b6b=_0x380b6b-0x0;var _0x52aee8=_0x09d5[_0x380b6b];return _0x52aee8;};'use strict';var _=require('lodash');var util=require(_0x509d('0x0'));var logger=require(_0x509d('0x1'))(_0x509d('0x2'));var moment=require(_0x509d('0x3'));var BPromise=require(_0x509d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x509d('0x5'));var rimraf=require(_0x509d('0x6'));var config=require(_0x509d('0x7'));var attributes=require(_0x509d('0x8'));module[_0x509d('0x9')]=function(_0x38f115,_0x4c8aee){return _0x38f115[_0x509d('0xa')](_0x509d('0xb'),attributes,{'tableName':_0x509d('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 ecd88c3..9312c12 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 _0xf9f7=['ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','debug','request\x20sent','stringify','error','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','options','where','include','map','model','attributes','catch','then'];(function(_0x551fbe,_0x3a78b3){var _0x5b02ac=function(_0x1948ec){while(--_0x1948ec){_0x551fbe['push'](_0x551fbe['shift']());}};_0x5b02ac(++_0x3a78b3);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x42ecb5,_0x20b4d2){_0x42ecb5=_0x42ecb5-0x0;var _0x487442=_0xf9f7[_0x42ecb5];return _0x487442;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});config['redis']=_[_0x7f9f('0xc')](config[_0x7f9f('0xd')],{'host':_0x7f9f('0xe'),'port':0x18eb});var socket=require(_0x7f9f('0xf'))(new Redis(config[_0x7f9f('0xd')]));require('./mailQueue.socket')[_0x7f9f('0x10')](socket);function respondWithRpcPromise(_0x229d32,_0x39d8a2,_0x25bbfb){return new BPromise(function(_0x12fefe,_0x3ff15a){return client[_0x7f9f('0x11')](_0x229d32,_0x25bbfb)['then'](function(_0x45bf92){logger[_0x7f9f('0x12')]('MailQueue,\x20%s,\x20%s',_0x39d8a2,'request\x20sent');logger[_0x7f9f('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x39d8a2,_0x7f9f('0x14'),JSON[_0x7f9f('0x15')](_0x45bf92));if(_0x45bf92['error']){if(_0x45bf92[_0x7f9f('0x16')]['code']===0x1f4){logger[_0x7f9f('0x16')](_0x7f9f('0x17'),_0x39d8a2,_0x45bf92[_0x7f9f('0x16')][_0x7f9f('0x18')]);return _0x3ff15a(_0x45bf92[_0x7f9f('0x16')]['message']);}logger[_0x7f9f('0x16')](_0x7f9f('0x17'),_0x39d8a2,_0x45bf92['error'][_0x7f9f('0x18')]);return _0x12fefe(_0x45bf92['error'][_0x7f9f('0x18')]);}else{logger[_0x7f9f('0x12')](_0x7f9f('0x17'),_0x39d8a2,_0x7f9f('0x14'));_0x12fefe(_0x45bf92[_0x7f9f('0x19')][_0x7f9f('0x18')]);}})['catch'](function(_0xb277b3){logger[_0x7f9f('0x16')]('MailQueue,\x20%s,\x20%s',_0x39d8a2,_0xb277b3);_0x3ff15a(_0xb277b3);});});}exports[_0x7f9f('0x1a')]=function(_0x52af88){var _0x2659c9=this;return new Promise(function(_0x15c06a,_0x8ad1b2){return db[_0x7f9f('0x1b')]['findAll']({'raw':_0x52af88[_0x7f9f('0x1c')]?_0x52af88['options']['raw']===undefined?!![]:![]:!![],'where':_0x52af88[_0x7f9f('0x1c')]?_0x52af88[_0x7f9f('0x1c')][_0x7f9f('0x1d')]||null:null,'attributes':_0x52af88[_0x7f9f('0x1c')]?_0x52af88[_0x7f9f('0x1c')]['attributes']||null:null,'limit':_0x52af88['options']?_0x52af88[_0x7f9f('0x1c')]['limit']||null:null,'include':_0x52af88[_0x7f9f('0x1c')]?_0x52af88[_0x7f9f('0x1c')][_0x7f9f('0x1e')]?_[_0x7f9f('0x1f')](_0x52af88[_0x7f9f('0x1c')][_0x7f9f('0x1e')],function(_0x56af13){return{'model':db[_0x56af13[_0x7f9f('0x20')]],'as':_0x56af13['as'],'attributes':_0x56af13['attributes'],'include':_0x56af13[_0x7f9f('0x1e')]?_[_0x7f9f('0x1f')](_0x56af13[_0x7f9f('0x1e')],function(_0x59eba2){return{'model':db[_0x59eba2[_0x7f9f('0x20')]],'as':_0x59eba2['as'],'attributes':_0x59eba2[_0x7f9f('0x21')],'include':_0x59eba2[_0x7f9f('0x1e')]?_['map'](_0x59eba2[_0x7f9f('0x1e')],function(_0x3b6e4c){return{'model':db[_0x3b6e4c['model']],'as':_0x3b6e4c['as'],'attributes':_0x3b6e4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d7600){logger['info'](_0x7f9f('0x1a'),_0x52af88);logger[_0x7f9f('0x13')]('GetMailQueue',_0x52af88,JSON['stringify'](_0x3d7600));_0x15c06a(_0x3d7600);})[_0x7f9f('0x22')](function(_0x4d7945){logger[_0x7f9f('0x16')]('GetMailQueue',_0x4d7945['message'],_0x52af88);_0x8ad1b2(_0x2659c9['error'](0x1f4,_0x4d7945[_0x7f9f('0x18')]));});});};exports['ShowMailQueue']=function(_0x348e0f){var _0x298193=this;return new Promise(function(_0x1f8ac0,_0xa890c3){return db[_0x7f9f('0x1b')]['find']({'raw':_0x348e0f['options']?_0x348e0f[_0x7f9f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x348e0f['options']?_0x348e0f[_0x7f9f('0x1c')][_0x7f9f('0x1d')]||null:null,'attributes':_0x348e0f[_0x7f9f('0x1c')]?_0x348e0f[_0x7f9f('0x1c')][_0x7f9f('0x21')]||null:null,'include':_0x348e0f[_0x7f9f('0x1c')]?_0x348e0f[_0x7f9f('0x1c')][_0x7f9f('0x1e')]?_[_0x7f9f('0x1f')](_0x348e0f[_0x7f9f('0x1c')][_0x7f9f('0x1e')],function(_0x583165){return{'model':db[_0x583165[_0x7f9f('0x20')]],'as':_0x583165['as'],'attributes':_0x583165[_0x7f9f('0x21')],'include':_0x583165['include']?_[_0x7f9f('0x1f')](_0x583165['include'],function(_0x42673c){return{'model':db[_0x42673c[_0x7f9f('0x20')]],'as':_0x42673c['as'],'attributes':_0x42673c[_0x7f9f('0x21')],'include':_0x42673c[_0x7f9f('0x1e')]?_[_0x7f9f('0x1f')](_0x42673c['include'],function(_0x760419){return{'model':db[_0x760419[_0x7f9f('0x20')]],'as':_0x760419['as'],'attributes':_0x760419['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f9f('0x23')](function(_0x1bf58a){logger[_0x7f9f('0x12')](_0x7f9f('0x24'),_0x348e0f);logger[_0x7f9f('0x13')](_0x7f9f('0x24'),_0x348e0f,JSON[_0x7f9f('0x15')](_0x1bf58a));_0x1f8ac0(_0x1bf58a);})[_0x7f9f('0x22')](function(_0x3b1cad){logger[_0x7f9f('0x16')](_0x7f9f('0x24'),_0x3b1cad['message'],_0x348e0f);_0xa890c3(_0x298193[_0x7f9f('0x16')](0x1f4,_0x3b1cad[_0x7f9f('0x18')]));});});}; \ No newline at end of file +var _0x149e=['code','message','info','result','GetMailQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowMailQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x149e,0x83));var _0xe149=function(_0x4f57db,_0x3f2217){_0x4f57db=_0x4f57db-0x0;var _0x3cddb7=_0x149e[_0x4f57db];return _0x3cddb7;};'use strict';var _=require('lodash');var util=require(_0xe149('0x0'));var moment=require(_0xe149('0x1'));var BPromise=require(_0xe149('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe149('0x3'));var db=require(_0xe149('0x4'))['db'];var utils=require(_0xe149('0x5'));var logger=require(_0xe149('0x6'))(_0xe149('0x7'));var config=require('../../config/environment');var jayson=require(_0xe149('0x8'));var client=jayson[_0xe149('0x9')]['http']({'port':0x232a});config[_0xe149('0xa')]=_['defaults'](config[_0xe149('0xa')],{'host':_0xe149('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe149('0xa')]));require(_0xe149('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c020d,_0xbce99d,_0x479145){return new BPromise(function(_0x58f8ea,_0xecbdea){return client[_0xe149('0xd')](_0x5c020d,_0x479145)[_0xe149('0xe')](function(_0x5c9a8b){logger['info'](_0xe149('0xf'),_0xbce99d,'request\x20sent');logger[_0xe149('0x10')](_0xe149('0x11'),_0xbce99d,_0xe149('0x12'),JSON[_0xe149('0x13')](_0x5c9a8b));if(_0x5c9a8b[_0xe149('0x14')]){if(_0x5c9a8b[_0xe149('0x14')][_0xe149('0x15')]===0x1f4){logger[_0xe149('0x14')](_0xe149('0xf'),_0xbce99d,_0x5c9a8b[_0xe149('0x14')][_0xe149('0x16')]);return _0xecbdea(_0x5c9a8b[_0xe149('0x14')][_0xe149('0x16')]);}logger[_0xe149('0x14')]('MailQueue,\x20%s,\x20%s',_0xbce99d,_0x5c9a8b[_0xe149('0x14')][_0xe149('0x16')]);return _0x58f8ea(_0x5c9a8b[_0xe149('0x14')][_0xe149('0x16')]);}else{logger[_0xe149('0x17')](_0xe149('0xf'),_0xbce99d,'request\x20sent');_0x58f8ea(_0x5c9a8b[_0xe149('0x18')]['message']);}})['catch'](function(_0x39ae95){logger[_0xe149('0x14')](_0xe149('0xf'),_0xbce99d,_0x39ae95);_0xecbdea(_0x39ae95);});});}exports[_0xe149('0x19')]=function(_0x148911){var _0x316ca3=this;return new Promise(function(_0xe81bad,_0x2f448a){return db['MailQueue'][_0xe149('0x1a')]({'raw':_0x148911['options']?_0x148911['options'][_0xe149('0x1b')]===undefined?!![]:![]:!![],'where':_0x148911['options']?_0x148911[_0xe149('0x1c')][_0xe149('0x1d')]||null:null,'attributes':_0x148911[_0xe149('0x1c')]?_0x148911[_0xe149('0x1c')][_0xe149('0x1e')]||null:null,'limit':_0x148911[_0xe149('0x1c')]?_0x148911[_0xe149('0x1c')][_0xe149('0x1f')]||null:null,'include':_0x148911['options']?_0x148911[_0xe149('0x1c')][_0xe149('0x20')]?_[_0xe149('0x21')](_0x148911[_0xe149('0x1c')][_0xe149('0x20')],function(_0x31d7d5){return{'model':db[_0x31d7d5[_0xe149('0x22')]],'as':_0x31d7d5['as'],'attributes':_0x31d7d5[_0xe149('0x1e')],'include':_0x31d7d5[_0xe149('0x20')]?_[_0xe149('0x21')](_0x31d7d5[_0xe149('0x20')],function(_0x1d6ec0){return{'model':db[_0x1d6ec0[_0xe149('0x22')]],'as':_0x1d6ec0['as'],'attributes':_0x1d6ec0[_0xe149('0x1e')],'include':_0x1d6ec0[_0xe149('0x20')]?_['map'](_0x1d6ec0[_0xe149('0x20')],function(_0x596d60){return{'model':db[_0x596d60[_0xe149('0x22')]],'as':_0x596d60['as'],'attributes':_0x596d60['attributes']};}):[]};}):[]};}):[]:[]})[_0xe149('0xe')](function(_0x314025){logger[_0xe149('0x17')](_0xe149('0x19'),_0x148911);logger[_0xe149('0x10')]('GetMailQueue',_0x148911,JSON[_0xe149('0x13')](_0x314025));_0xe81bad(_0x314025);})[_0xe149('0x23')](function(_0x2eab07){logger[_0xe149('0x14')](_0xe149('0x19'),_0x2eab07[_0xe149('0x16')],_0x148911);_0x2f448a(_0x316ca3[_0xe149('0x14')](0x1f4,_0x2eab07['message']));});});};exports[_0xe149('0x24')]=function(_0x11f824){var _0x196916=this;return new Promise(function(_0x45473b,_0x215890){return db['MailQueue'][_0xe149('0x25')]({'raw':_0x11f824['options']?_0x11f824[_0xe149('0x1c')][_0xe149('0x1b')]===undefined?!![]:![]:!![],'where':_0x11f824[_0xe149('0x1c')]?_0x11f824['options'][_0xe149('0x1d')]||null:null,'attributes':_0x11f824[_0xe149('0x1c')]?_0x11f824[_0xe149('0x1c')][_0xe149('0x1e')]||null:null,'include':_0x11f824[_0xe149('0x1c')]?_0x11f824[_0xe149('0x1c')]['include']?_[_0xe149('0x21')](_0x11f824['options'][_0xe149('0x20')],function(_0x16297f){return{'model':db[_0x16297f['model']],'as':_0x16297f['as'],'attributes':_0x16297f[_0xe149('0x1e')],'include':_0x16297f[_0xe149('0x20')]?_[_0xe149('0x21')](_0x16297f[_0xe149('0x20')],function(_0x3f8ad8){return{'model':db[_0x3f8ad8[_0xe149('0x22')]],'as':_0x3f8ad8['as'],'attributes':_0x3f8ad8['attributes'],'include':_0x3f8ad8[_0xe149('0x20')]?_['map'](_0x3f8ad8['include'],function(_0x1a21ca){return{'model':db[_0x1a21ca[_0xe149('0x22')]],'as':_0x1a21ca['as'],'attributes':_0x1a21ca[_0xe149('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe149('0xe')](function(_0x4954f0){logger[_0xe149('0x17')]('ShowMailQueue',_0x11f824);logger['debug'](_0xe149('0x24'),_0x11f824,JSON['stringify'](_0x4954f0));_0x45473b(_0x4954f0);})[_0xe149('0x23')](function(_0x226461){logger[_0xe149('0x14')](_0xe149('0x24'),_0x226461[_0xe149('0x16')],_0x11f824);_0x215890(_0x196916[_0xe149('0x14')](0x1f4,_0x226461[_0xe149('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index facdf27..c0f708b 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 _0xdd8c=['update','removeListener','register','length','mailQueue:','save'];(function(_0x15d700,_0x56b0f9){var _0x1630fc=function(_0x417825){while(--_0x417825){_0x15d700['push'](_0x15d700['shift']());}};_0x1630fc(++_0x56b0f9);}(_0xdd8c,0xcb));var _0xcdd8=function(_0x21f79c,_0x5d3a38){_0x21f79c=_0x21f79c-0x0;var _0x5ecf74=_0xdd8c[_0x21f79c];return _0x5ecf74;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xcdd8('0x0'),'remove',_0xcdd8('0x1')];function createListener(_0x9d1b00,_0x36674b){return function(_0x1b3987){_0x36674b['emit'](_0x9d1b00,_0x1b3987);};}function removeListener(_0x2a710b,_0x5bc84c){return function(){MailQueueEvents[_0xcdd8('0x2')](_0x2a710b,_0x5bc84c);};}exports[_0xcdd8('0x3')]=function(_0x2b8bc5){for(var _0x334327=0x0,_0x5cc13a=events[_0xcdd8('0x4')];_0x334327<_0x5cc13a;_0x334327++){var _0x40e2c3=events[_0x334327];var _0x508cf5=createListener(_0xcdd8('0x5')+_0x40e2c3,_0x2b8bc5);MailQueueEvents['on'](_0x40e2c3,_0x508cf5);}}; \ No newline at end of file +var _0x9e2a=['./mailQueue.events','emit','length'];(function(_0x993f24,_0x227b78){var _0x3064db=function(_0x5c0d9e){while(--_0x5c0d9e){_0x993f24['push'](_0x993f24['shift']());}};_0x3064db(++_0x227b78);}(_0x9e2a,0xe1));var _0xa9e2=function(_0x36132c,_0x452c4c){_0x36132c=_0x36132c-0x0;var _0x405204=_0x9e2a[_0x36132c];return _0x405204;};'use strict';var MailQueueEvents=require(_0xa9e2('0x0'));var events=['save','remove','update'];function createListener(_0x541e1d,_0x26fb7e){return function(_0xc1c3c6){_0x26fb7e[_0xa9e2('0x1')](_0x541e1d,_0xc1c3c6);};}function removeListener(_0x14632d,_0x574b52){return function(){MailQueueEvents['removeListener'](_0x14632d,_0x574b52);};}exports['register']=function(_0x2d2d03){for(var _0x2a1c84=0x0,_0xde042e=events[_0xa9e2('0x2')];_0x2a1c84<_0xde042e;_0x2a1c84++){var _0x2d2bd1=events[_0x2a1c84];var _0x30b222=createListener('mailQueue:'+_0x2d2bd1,_0x2d2d03);MailQueueEvents['on'](_0x2d2bd1,_0x30b222);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index fba8cb0..7c3a37f 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 _0x0be5=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x564e9f,_0x225a15){var _0x3a9f3e=function(_0x1bbe48){while(--_0x1bbe48){_0x564e9f['push'](_0x564e9f['shift']());}};_0x3a9f3e(++_0x225a15);}(_0x0be5,0xf6));var _0x50be=function(_0x229971,_0x3961f7){_0x229971=_0x229971-0x0;var _0x1d5266=_0x0be5[_0x229971];return _0x1d5266;};'use strict';var multer=require(_0x50be('0x0'));var util=require(_0x50be('0x1'));var path=require('path');var timeout=require(_0x50be('0x2'));var express=require(_0x50be('0x3'));var router=express[_0x50be('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50be('0x5'));var config=require(_0x50be('0x6'));var controller=require(_0x50be('0x7'));router[_0x50be('0x8')]('/',auth[_0x50be('0x9')](),controller[_0x50be('0xa')]);router[_0x50be('0x8')]('/describe',auth[_0x50be('0x9')](),controller[_0x50be('0xb')]);router[_0x50be('0x8')]('/:id',auth[_0x50be('0x9')](),controller[_0x50be('0xc')]);router[_0x50be('0xd')]('/',auth[_0x50be('0x9')](),controller[_0x50be('0xe')]);router['put'](_0x50be('0xf'),auth[_0x50be('0x9')](),controller[_0x50be('0x10')]);router['delete'](_0x50be('0xf'),auth[_0x50be('0x9')](),controller[_0x50be('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe070=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','exports','multer'];(function(_0x14f168,_0xb2a8f3){var _0x2fbd50=function(_0xef651){while(--_0xef651){_0x14f168['push'](_0x14f168['shift']());}};_0x2fbd50(++_0xb2a8f3);}(_0xe070,0x1a1));var _0x0e07=function(_0x347541,_0x137cf){_0x347541=_0x347541-0x0;var _0x5c0e38=_0xe070[_0x347541];return _0x5c0e38;};'use strict';var multer=require(_0x0e07('0x0'));var util=require(_0x0e07('0x1'));var path=require('path');var timeout=require(_0x0e07('0x2'));var express=require('express');var router=express[_0x0e07('0x3')]();var fs_extra=require(_0x0e07('0x4'));var auth=require(_0x0e07('0x5'));var interaction=require(_0x0e07('0x6'));var config=require(_0x0e07('0x7'));var controller=require(_0x0e07('0x8'));router['get']('/',auth[_0x0e07('0x9')](),controller[_0x0e07('0xa')]);router[_0x0e07('0xb')](_0x0e07('0xc'),auth[_0x0e07('0x9')](),controller['describe']);router['get'](_0x0e07('0xd'),auth[_0x0e07('0x9')](),controller[_0x0e07('0xe')]);router['post']('/',auth[_0x0e07('0x9')](),controller[_0x0e07('0xf')]);router[_0x0e07('0x10')](_0x0e07('0xd'),auth[_0x0e07('0x9')](),controller[_0x0e07('0x11')]);router['delete'](_0x0e07('0xd'),auth[_0x0e07('0x9')](),controller['destroy']);module[_0x0e07('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 7879af5..59bbb2f 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 _0xe9b9=['STRING','DATE','moment','sequelize','exports'];(function(_0x20a25e,_0x1a932a){var _0x38a8cf=function(_0x1add0f){while(--_0x1add0f){_0x20a25e['push'](_0x20a25e['shift']());}};_0x38a8cf(++_0x1a932a);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x23e2a3,_0x13e18e){_0x23e2a3=_0x23e2a3-0x0;var _0x27901b=_0xe9b9[_0x23e2a3];return _0x27901b;};'use strict';var moment=require(_0x9e9b('0x0'));var Sequelize=require(_0x9e9b('0x1'));module[_0x9e9b('0x2')]={'uniqueid':{'type':Sequelize[_0x9e9b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9e9b('0x3')]},'joinAt':{'type':Sequelize[_0x9e9b('0x4')]},'leaveAt':{'type':Sequelize[_0x9e9b('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9e9b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc534=['STRING','DATE','moment','sequelize','exports'];(function(_0x19ce02,_0x17ed5e){var _0x334b81=function(_0x5335b8){while(--_0x5335b8){_0x19ce02['push'](_0x19ce02['shift']());}};_0x334b81(++_0x17ed5e);}(_0xc534,0x11f));var _0x4c53=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0xc534[_0x491faa];return _0x414440;};'use strict';var moment=require(_0x4c53('0x0'));var Sequelize=require(_0x4c53('0x1'));module[_0x4c53('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4c53('0x3')]},'joinAt':{'type':Sequelize[_0x4c53('0x4')]},'leaveAt':{'type':Sequelize[_0x4c53('0x4')]},'acceptAt':{'type':Sequelize[_0x4c53('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6fd40ec..71a0181 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 _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5d0500,_0x275669){var _0x2c4f52=function(_0x477561){while(--_0x477561){_0x5d0500['push'](_0x5d0500['shift']());}};_0x2c4f52(++_0x275669);}(_0x5b12,0xa3));var _0x25b1=function(_0x5e7ce1,_0xc99dea){_0x5e7ce1=_0x5e7ce1-0x0;var _0x5987ea=_0x5b12[_0x5e7ce1];return _0x5987ea;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['MailQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file +var _0x0b0e=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x1eda99,_0x26972e){var _0x301c32=function(_0x59e666){while(--_0x59e666){_0x1eda99['push'](_0x1eda99['shift']());}};_0x301c32(++_0x26972e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x0b0e[_0x533e4e];return _0x1f14bb;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['MailQueueReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['MailQueueReport'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['MailQueueReport']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));};exports[_0xe0b0('0x4a')]=function(_0x54cf7b,_0x4b65d1){return db[_0xe0b0('0x2a')][_0xe0b0('0x4a')]()[_0xe0b0('0x23')](respondWithResult(_0x4b65d1,null))[_0xe0b0('0x43')](handleError(_0x4b65d1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index af5af41..1a7d7df 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 _0x152d=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x274302,_0x4a60d4){var _0x16137b=function(_0x3d25e8){while(--_0x3d25e8){_0x274302['push'](_0x274302['shift']());}};_0x16137b(++_0x4a60d4);}(_0x152d,0xaf));var _0xd152=function(_0x2a8e10,_0x5e2c96){_0x2a8e10=_0x2a8e10-0x0;var _0x1097ba=_0x152d[_0x2a8e10];return _0x1097ba;};'use strict';var _=require(_0xd152('0x0'));var util=require(_0xd152('0x1'));var logger=require(_0xd152('0x2'))(_0xd152('0x3'));var moment=require(_0xd152('0x4'));var BPromise=require(_0xd152('0x5'));var rp=require(_0xd152('0x6'));var fs=require('fs');var path=require(_0xd152('0x7'));var rimraf=require(_0xd152('0x8'));var config=require(_0xd152('0x9'));var attributes=require(_0xd152('0xa'));module[_0xd152('0xb')]=function(_0x52318b,_0x4c9db1){return _0x52318b['define'](_0xd152('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd152('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5295=['./mailQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x41c31b,_0xdda69e){var _0x356ace=function(_0x7f680d){while(--_0x7f680d){_0x41c31b['push'](_0x41c31b['shift']());}};_0x356ace(++_0xdda69e);}(_0x5295,0x6c));var _0x5529=function(_0x246ef8,_0xc7d0ba){_0x246ef8=_0x246ef8-0x0;var _0x3d6707=_0x5295[_0x246ef8];return _0x3d6707;};'use strict';var _=require(_0x5529('0x0'));var util=require(_0x5529('0x1'));var logger=require(_0x5529('0x2'))(_0x5529('0x3'));var moment=require(_0x5529('0x4'));var BPromise=require(_0x5529('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5529('0x6'));var rimraf=require(_0x5529('0x7'));var config=require(_0x5529('0x8'));var attributes=require(_0x5529('0x9'));module[_0x5529('0xa')]=function(_0x30390c,_0x597f8f){return _0x30390c[_0x5529('0xb')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5529('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f94e415..e01d1b9 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(_0x5d988b,_0x14f1c0){var _0x17d258=function(_0xeb1f73){while(--_0xeb1f73){_0x5d988b['push'](_0x5d988b['shift']());}};_0x17d258(++_0x14f1c0);}(_0x7a54,0x106));var _0x47a5=function(_0x341910,_0x33a75d){_0x341910=_0x341910-0x0;var _0x2a32e1=_0x7a54[_0x341910];return _0x2a32e1;};'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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0x2ef3,0xba));var _0x32ef=function(_0x3fe9f8,_0x4d9014){_0x3fe9f8=_0x3fe9f8-0x0;var _0x286e78=_0x2ef3[_0x3fe9f8];return _0x286e78;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 30162d8..acb705b 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x11fa7d,_0x2afab9){var _0x1100e9=function(_0x1b1c77){while(--_0x1b1c77){_0x11fa7d['push'](_0x11fa7d['shift']());}};_0x1100e9(++_0x2afab9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xcb91[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4536fc,_0x579536){var _0x1af01e=function(_0xfa4adf){while(--_0xfa4adf){_0x4536fc['push'](_0x4536fc['shift']());}};_0x1af01e(++_0x579536);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0xcb91[_0x4da356];return _0x321b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 620dd5b..0844f7d 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 _0x9d14=['BOOLEAN','INBOX','INTEGER','exports','STRING'];(function(_0x502949,_0x55d430){var _0x22dbe2=function(_0x1a594f){while(--_0x1a594f){_0x502949['push'](_0x502949['shift']());}};_0x22dbe2(++_0x55d430);}(_0x9d14,0x111));var _0x49d1=function(_0x1380ed,_0x2a3bf4){_0x1380ed=_0x1380ed-0x0;var _0x44dcb1=_0x9d14[_0x1380ed];return _0x44dcb1;};'use strict';var Sequelize=require('sequelize');module[_0x49d1('0x0')]={'description':{'type':Sequelize[_0x49d1('0x1')]},'host':{'type':Sequelize[_0x49d1('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x49d1('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x49d1('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x49d1('0x1')],'defaultValue':_0x49d1('0x3')},'connTimeout':{'type':Sequelize[_0x49d1('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x49d1('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x49d1('0x1')]},'modernAuthentication':{'type':Sequelize[_0x49d1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf59=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x1a2bb6,_0x2c8451){var _0x41abbb=function(_0x2af33c){while(--_0x2af33c){_0x1a2bb6['push'](_0x1a2bb6['shift']());}};_0x41abbb(++_0x2c8451);}(_0xcf59,0x1ea));var _0x9cf5=function(_0x3b6a6d,_0x3ba7df){_0x3b6a6d=_0x3b6a6d-0x0;var _0x13268d=_0xcf59[_0x3b6a6d];return _0x13268d;};'use strict';var Sequelize=require(_0x9cf5('0x0'));module['exports']={'description':{'type':Sequelize[_0x9cf5('0x1')]},'host':{'type':Sequelize[_0x9cf5('0x1')]},'authentication':{'type':Sequelize[_0x9cf5('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9cf5('0x1')]},'password':{'type':Sequelize[_0x9cf5('0x1')]},'port':{'type':Sequelize[_0x9cf5('0x3')]},'tls':{'type':Sequelize[_0x9cf5('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9cf5('0x1')],'defaultValue':_0x9cf5('0x4')},'connTimeout':{'type':Sequelize[_0x9cf5('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9cf5('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e27c179..2f05946 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 _0x9e95=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x43a10b,_0x466572){var _0x595e3c=function(_0x1c51bd){while(--_0x1c51bd){_0x43a10b['push'](_0x43a10b['shift']());}};_0x595e3c(++_0x466572);}(_0x9e95,0x195));var _0x59e9=function(_0x400513,_0x1ae982){_0x400513=_0x400513-0x0;var _0x24bf8a=_0x9e95[_0x400513];return _0x24bf8a;};'use strict';var _=require(_0x59e9('0x0'));var util=require(_0x59e9('0x1'));var logger=require(_0x59e9('0x2'))('api');var moment=require(_0x59e9('0x3'));var BPromise=require(_0x59e9('0x4'));var rp=require(_0x59e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59e9('0x6'));var config=require(_0x59e9('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x97d193,_0x2551f3){return _0x97d193[_0x59e9('0x8')](_0x59e9('0x9'),attributes,{'tableName':_0x59e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62f0=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1fa56c,_0x42d719){var _0x1553b8=function(_0x2f6447){while(--_0x2f6447){_0x1fa56c['push'](_0x1fa56c['shift']());}};_0x1553b8(++_0x42d719);}(_0x62f0,0x138));var _0x062f=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x62f0[_0x2f1114];return _0x2fe856;};'use strict';var _=require(_0x062f('0x0'));var util=require(_0x062f('0x1'));var logger=require(_0x062f('0x2'))('api');var moment=require(_0x062f('0x3'));var BPromise=require(_0x062f('0x4'));var rp=require(_0x062f('0x5'));var fs=require('fs');var path=require(_0x062f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x062f('0x7'));module[_0x062f('0x8')]=function(_0x4c6644,_0x16f0e4){return _0x4c6644[_0x062f('0x9')]('MailServerIn',attributes,{'tableName':_0x062f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 2e4a9b6..2d7e710 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 _0x4724=['catch','GetMailServerIn','MailServerIn','options','where','attributes','include','map','model','then','info','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x5bd60b,_0x13465a){var _0x2dcff0=function(_0x31079c){while(--_0x31079c){_0x5bd60b['push'](_0x5bd60b['shift']());}};_0x2dcff0(++_0x13465a);}(_0x4724,0xcf));var _0x4472=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0x4724[_0x528342];return _0x27dd91;};'use strict';var _=require(_0x4472('0x0'));var util=require(_0x4472('0x1'));var moment=require(_0x4472('0x2'));var BPromise=require(_0x4472('0x3'));var rs=require(_0x4472('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4472('0x5'));var config=require('../../config/environment');var jayson=require(_0x4472('0x6'));var client=jayson[_0x4472('0x7')][_0x4472('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a2fdf,_0x444800,_0x1a8af3){return new BPromise(function(_0x330383,_0x2c079b){return client[_0x4472('0x9')](_0x4a2fdf,_0x1a8af3)['then'](function(_0x5650b6){logger['info'](_0x4472('0xa'),_0x444800,_0x4472('0xb'));logger[_0x4472('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x444800,_0x4472('0xb'),JSON['stringify'](_0x5650b6));if(_0x5650b6[_0x4472('0xd')]){if(_0x5650b6[_0x4472('0xd')][_0x4472('0xe')]===0x1f4){logger[_0x4472('0xd')](_0x4472('0xa'),_0x444800,_0x5650b6[_0x4472('0xd')][_0x4472('0xf')]);return _0x2c079b(_0x5650b6[_0x4472('0xd')][_0x4472('0xf')]);}logger[_0x4472('0xd')](_0x4472('0xa'),_0x444800,_0x5650b6[_0x4472('0xd')][_0x4472('0xf')]);return _0x330383(_0x5650b6[_0x4472('0xd')][_0x4472('0xf')]);}else{logger['info'](_0x4472('0xa'),_0x444800,_0x4472('0xb'));_0x330383(_0x5650b6[_0x4472('0x10')]['message']);}})[_0x4472('0x11')](function(_0x375b8e){logger[_0x4472('0xd')]('MailServerIn,\x20%s,\x20%s',_0x444800,_0x375b8e);_0x2c079b(_0x375b8e);});});}exports[_0x4472('0x12')]=function(_0x2fc3c5){var _0x143b9c=this;return new Promise(function(_0x2fac2e,_0x52ef17){return db[_0x4472('0x13')]['findAll']({'raw':_0x2fc3c5[_0x4472('0x14')]?_0x2fc3c5[_0x4472('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2fc3c5['options']?_0x2fc3c5[_0x4472('0x14')][_0x4472('0x15')]||null:null,'attributes':_0x2fc3c5[_0x4472('0x14')]?_0x2fc3c5[_0x4472('0x14')][_0x4472('0x16')]||null:null,'limit':_0x2fc3c5['options']?_0x2fc3c5[_0x4472('0x14')]['limit']||null:null,'include':_0x2fc3c5['options']?_0x2fc3c5['options'][_0x4472('0x17')]?_[_0x4472('0x18')](_0x2fc3c5['options'][_0x4472('0x17')],function(_0x531efe){return{'model':db[_0x531efe[_0x4472('0x19')]],'as':_0x531efe['as'],'attributes':_0x531efe[_0x4472('0x16')],'include':_0x531efe[_0x4472('0x17')]?_['map'](_0x531efe[_0x4472('0x17')],function(_0x2f23d9){return{'model':db[_0x2f23d9['model']],'as':_0x2f23d9['as'],'attributes':_0x2f23d9[_0x4472('0x16')],'include':_0x2f23d9[_0x4472('0x17')]?_[_0x4472('0x18')](_0x2f23d9[_0x4472('0x17')],function(_0x373ed2){return{'model':db[_0x373ed2['model']],'as':_0x373ed2['as'],'attributes':_0x373ed2[_0x4472('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4472('0x1a')](function(_0x101a61){logger[_0x4472('0x1b')]('GetMailServerIn',_0x2fc3c5);logger['debug']('GetMailServerIn',_0x2fc3c5,JSON['stringify'](_0x101a61));_0x2fac2e(_0x101a61);})[_0x4472('0x11')](function(_0x1b1b10){logger[_0x4472('0xd')](_0x4472('0x12'),_0x1b1b10[_0x4472('0xf')],_0x2fc3c5);_0x52ef17(_0x143b9c[_0x4472('0xd')](0x1f4,_0x1b1b10[_0x4472('0xf')]));});});}; \ No newline at end of file +var _0x7a57=['limit','include','model','map','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes'];(function(_0x5385e9,_0x9398){var _0x29334e=function(_0x511caf){while(--_0x511caf){_0x5385e9['push'](_0x5385e9['shift']());}};_0x29334e(++_0x9398);}(_0x7a57,0x89));var _0x77a5=function(_0x11faa7,_0x35f3d9){_0x11faa7=_0x11faa7-0x0;var _0x48f18b=_0x7a57[_0x11faa7];return _0x48f18b;};'use strict';var _=require(_0x77a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x77a5('0x1'));var rs=require(_0x77a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x77a5('0x3'));var logger=require(_0x77a5('0x4'))(_0x77a5('0x5'));var config=require(_0x77a5('0x6'));var jayson=require(_0x77a5('0x7'));var client=jayson[_0x77a5('0x8')][_0x77a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a1c80,_0x146d1d,_0x103a2f){return new BPromise(function(_0x15215e,_0x1e9e81){return client[_0x77a5('0xa')](_0x5a1c80,_0x103a2f)[_0x77a5('0xb')](function(_0x33b32a){logger[_0x77a5('0xc')](_0x77a5('0xd'),_0x146d1d,_0x77a5('0xe'));logger[_0x77a5('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x146d1d,'request\x20sent',JSON[_0x77a5('0x10')](_0x33b32a));if(_0x33b32a[_0x77a5('0x11')]){if(_0x33b32a['error'][_0x77a5('0x12')]===0x1f4){logger[_0x77a5('0x11')](_0x77a5('0xd'),_0x146d1d,_0x33b32a['error'][_0x77a5('0x13')]);return _0x1e9e81(_0x33b32a['error'][_0x77a5('0x13')]);}logger[_0x77a5('0x11')](_0x77a5('0xd'),_0x146d1d,_0x33b32a[_0x77a5('0x11')]['message']);return _0x15215e(_0x33b32a[_0x77a5('0x11')][_0x77a5('0x13')]);}else{logger[_0x77a5('0xc')](_0x77a5('0xd'),_0x146d1d,_0x77a5('0xe'));_0x15215e(_0x33b32a[_0x77a5('0x14')][_0x77a5('0x13')]);}})['catch'](function(_0x485cf5){logger[_0x77a5('0x11')](_0x77a5('0xd'),_0x146d1d,_0x485cf5);_0x1e9e81(_0x485cf5);});});}exports[_0x77a5('0x15')]=function(_0x41e8de){var _0x1018a4=this;return new Promise(function(_0x4b2e56,_0x1893c6){return db[_0x77a5('0x16')][_0x77a5('0x17')]({'raw':_0x41e8de[_0x77a5('0x18')]?_0x41e8de[_0x77a5('0x18')][_0x77a5('0x19')]===undefined?!![]:![]:!![],'where':_0x41e8de[_0x77a5('0x18')]?_0x41e8de[_0x77a5('0x18')][_0x77a5('0x1a')]||null:null,'attributes':_0x41e8de['options']?_0x41e8de[_0x77a5('0x18')][_0x77a5('0x1b')]||null:null,'limit':_0x41e8de[_0x77a5('0x18')]?_0x41e8de[_0x77a5('0x18')][_0x77a5('0x1c')]||null:null,'include':_0x41e8de[_0x77a5('0x18')]?_0x41e8de['options'][_0x77a5('0x1d')]?_['map'](_0x41e8de[_0x77a5('0x18')][_0x77a5('0x1d')],function(_0x39d875){return{'model':db[_0x39d875[_0x77a5('0x1e')]],'as':_0x39d875['as'],'attributes':_0x39d875[_0x77a5('0x1b')],'include':_0x39d875[_0x77a5('0x1d')]?_[_0x77a5('0x1f')](_0x39d875[_0x77a5('0x1d')],function(_0x43620e){return{'model':db[_0x43620e[_0x77a5('0x1e')]],'as':_0x43620e['as'],'attributes':_0x43620e[_0x77a5('0x1b')],'include':_0x43620e[_0x77a5('0x1d')]?_[_0x77a5('0x1f')](_0x43620e[_0x77a5('0x1d')],function(_0x51453f){return{'model':db[_0x51453f[_0x77a5('0x1e')]],'as':_0x51453f['as'],'attributes':_0x51453f[_0x77a5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x77a5('0xb')](function(_0x4dfb26){logger[_0x77a5('0xc')]('GetMailServerIn',_0x41e8de);logger['debug'](_0x77a5('0x15'),_0x41e8de,JSON['stringify'](_0x4dfb26));_0x4b2e56(_0x4dfb26);})[_0x77a5('0x20')](function(_0xd90a34){logger[_0x77a5('0x11')](_0x77a5('0x15'),_0xd90a34[_0x77a5('0x13')],_0x41e8de);_0x1893c6(_0x1018a4[_0x77a5('0x11')](0x1f4,_0xd90a34[_0x77a5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 6c19e31..024399f 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(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7a54,0x106));var _0x47a5=function(_0xd827b6,_0x29b99a){_0xd827b6=_0xd827b6-0x0;var _0x4f8a71=_0x7a54[_0xd827b6];return _0x4f8a71;};'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(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x112d73,_0x1e6644){_0x112d73=_0x112d73-0x0;var _0x2c869e=_0x7a54[_0x112d73];return _0x2c869e;};'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 b258354..2559d1f 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 _0x69d3=['exports','STRING','sequelize'];(function(_0x1e87c2,_0x1a41c1){var _0x4ec05e=function(_0x432c7c){while(--_0x432c7c){_0x1e87c2['push'](_0x1e87c2['shift']());}};_0x4ec05e(++_0x1a41c1);}(_0x69d3,0xda));var _0x369d=function(_0x2d5c04,_0x2b4c78){_0x2d5c04=_0x2d5c04-0x0;var _0x3dba68=_0x69d3[_0x2d5c04];return _0x3dba68;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'description':{'type':Sequelize[_0x369d('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x369d('0x2')]},'pass':{'type':Sequelize[_0x369d('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x369d('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbaf0=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x40edbb,_0x4b8e85){var _0x1c34e1=function(_0x4cb6dc){while(--_0x4cb6dc){_0x40edbb['push'](_0x40edbb['shift']());}};_0x1c34e1(++_0x4b8e85);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'description':{'type':Sequelize[_0x0baf('0x1')]},'host':{'type':Sequelize[_0x0baf('0x1')]},'user':{'type':Sequelize[_0x0baf('0x1')]},'pass':{'type':Sequelize[_0x0baf('0x1')]},'port':{'type':Sequelize[_0x0baf('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0baf('0x1')]},'authentication':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1f12a5d..54ca536 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 _0x24f7=['filter','merge','VIRTUAL','name','options','MailServerOut','includeAll','findAll','catch','show','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x5ed928,_0x2dbbdc){var _0x2effcc=function(_0x19ba45){while(--_0x19ba45){_0x5ed928['push'](_0x5ed928['shift']());}};_0x2effcc(++_0x2dbbdc);}(_0x24f7,0x18b));var _0x724f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x24f7[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x724f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x724f('0x1'));var jsonpatch=require(_0x724f('0x2'));var rp=require('request-promise');var moment=require(_0x724f('0x3'));var BPromise=require(_0x724f('0x4'));var Mustache=require(_0x724f('0x5'));var util=require(_0x724f('0x6'));var path=require('path');var sox=require(_0x724f('0x7'));var csv=require(_0x724f('0x8'));var ejs=require(_0x724f('0x9'));var fs=require('fs');var fs_extra=require(_0x724f('0xa'));var _=require('lodash');var squel=require(_0x724f('0xb'));var crypto=require(_0x724f('0xc'));var jsforce=require(_0x724f('0xd'));var deskjs=require(_0x724f('0xe'));var toCsv=require(_0x724f('0x8'));var querystring=require('querystring');var Papa=require(_0x724f('0xf'));var Redis=require(_0x724f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x724f('0x11'));var as=require(_0x724f('0x12'));var hardwareService=require(_0x724f('0x13'));var logger=require(_0x724f('0x14'))(_0x724f('0x15'));var utils=require(_0x724f('0x16'));var config=require(_0x724f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x724f('0x18'))['db'];function respondWithStatusCode(_0x3b1cab,_0x5f363e){_0x5f363e=_0x5f363e||0xcc;return function(_0x3c876f){if(_0x3c876f){return _0x3b1cab[_0x724f('0x19')](_0x5f363e);}return _0x3b1cab[_0x724f('0x1a')](_0x5f363e)[_0x724f('0x1b')]();};}function respondWithResult(_0x2a8858,_0xd40441){_0xd40441=_0xd40441||0xc8;return function(_0x3761fd){if(_0x3761fd){return _0x2a8858['status'](_0xd40441)[_0x724f('0x1c')](_0x3761fd);}};}function respondWithFilteredResult(_0xd4bd2,_0x355aac){return function(_0x5d1d06){if(_0x5d1d06){var _0x1404d4=typeof _0x355aac[_0x724f('0x1d')]==='undefined'&&typeof _0x355aac[_0x724f('0x1e')]===_0x724f('0x1f');var _0x36e7ff=_0x5d1d06[_0x724f('0x20')];var _0x2699e5=_0x1404d4?0x0:_0x355aac[_0x724f('0x1d')];var _0x3a6c7d=_0x1404d4?_0x5d1d06[_0x724f('0x20')]:_0x355aac[_0x724f('0x1d')]+_0x355aac[_0x724f('0x1e')];var _0x15aad7;if(_0x3a6c7d>=_0x36e7ff){_0x3a6c7d=_0x36e7ff;_0x15aad7=0xc8;}else{_0x15aad7=0xce;}_0xd4bd2[_0x724f('0x1a')](_0x15aad7);return _0xd4bd2[_0x724f('0x21')](_0x724f('0x22'),_0x2699e5+'-'+_0x3a6c7d+'/'+_0x36e7ff)['json'](_0x5d1d06);}return null;};}function patchUpdates(_0x15ea62){return function(_0x29392e){try{jsonpatch[_0x724f('0x23')](_0x29392e,_0x15ea62,!![]);}catch(_0x5291ca){return BPromise[_0x724f('0x24')](_0x5291ca);}return _0x29392e[_0x724f('0x25')]();};}function saveUpdates(_0x4060d4,_0xc3b17a){return function(_0x1093b3){if(_0x1093b3){return _0x1093b3[_0x724f('0x26')](_0x4060d4)[_0x724f('0x27')](function(_0x1a3852){return _0x1a3852;});}return null;};}function removeEntity(_0x516194,_0x51fc95){return function(_0x5930bb){if(_0x5930bb){return _0x5930bb[_0x724f('0x28')]()['then'](function(){_0x516194['status'](0xcc)[_0x724f('0x1b')]();});}};}function handleEntityNotFound(_0x21d31b,_0x3db040){return function(_0x1bf862){if(!_0x1bf862){_0x21d31b[_0x724f('0x19')](0x194);}return _0x1bf862;};}function handleError(_0x3e8fd8,_0x3bc270){_0x3bc270=_0x3bc270||0x1f4;return function(_0x4a2591){logger['error'](_0x4a2591['stack']);if(_0x4a2591['name']){delete _0x4a2591['name'];}_0x3e8fd8[_0x724f('0x1a')](_0x3bc270)[_0x724f('0x29')](_0x4a2591);};}exports[_0x724f('0x2a')]=function(_0x1aba02,_0x3d2d6f){var _0x1ccae2={},_0x252a22={},_0x61f8cf={'count':0x0,'rows':[]};var _0x4ec528=_[_0x724f('0x2b')](db['MailServerOut'][_0x724f('0x2c')],function(_0x594017){return{'name':_0x594017[_0x724f('0x2d')],'type':_0x594017[_0x724f('0x2e')][_0x724f('0x2f')]};});_0x252a22[_0x724f('0x30')]=_[_0x724f('0x2b')](_0x4ec528,'name');_0x252a22[_0x724f('0x31')]=_[_0x724f('0x32')](_0x1aba02['query']);_0x252a22['filters']=_[_0x724f('0x33')](_0x252a22[_0x724f('0x30')],_0x252a22[_0x724f('0x31')]);_0x1ccae2[_0x724f('0x34')]=_[_0x724f('0x33')](_0x252a22[_0x724f('0x30')],qs[_0x724f('0x35')](_0x1aba02[_0x724f('0x31')][_0x724f('0x35')]));_0x1ccae2[_0x724f('0x34')]=_0x1ccae2['attributes'][_0x724f('0x36')]?_0x1ccae2[_0x724f('0x34')]:_0x252a22[_0x724f('0x30')];if(!_0x1aba02[_0x724f('0x31')][_0x724f('0x37')]('nolimit')){_0x1ccae2[_0x724f('0x1e')]=qs['limit'](_0x1aba02[_0x724f('0x31')][_0x724f('0x1e')]);_0x1ccae2[_0x724f('0x1d')]=qs['offset'](_0x1aba02[_0x724f('0x31')][_0x724f('0x1d')]);}_0x1ccae2[_0x724f('0x38')]=qs[_0x724f('0x39')](_0x1aba02[_0x724f('0x31')][_0x724f('0x39')]);_0x1ccae2[_0x724f('0x3a')]=qs[_0x724f('0x3b')](_[_0x724f('0x3c')](_0x1aba02[_0x724f('0x31')],_0x252a22['filters']),_0x4ec528);if(_0x1aba02[_0x724f('0x31')][_0x724f('0x3d')]){_0x1ccae2['where']=_[_0x724f('0x3e')](_0x1ccae2['where'],{'$or':_[_0x724f('0x2b')](_0x4ec528,function(_0xc4f14e){if(_0xc4f14e['type']!==_0x724f('0x3f')){var _0x1f29ef={};_0x1f29ef[_0xc4f14e[_0x724f('0x40')]]={'$like':'%'+_0x1aba02[_0x724f('0x31')][_0x724f('0x3d')]+'%'};return _0x1f29ef;}})});}_0x1ccae2=_[_0x724f('0x3e')]({},_0x1ccae2,_0x1aba02[_0x724f('0x41')]);var _0x3f66af={'where':_0x1ccae2[_0x724f('0x3a')]};return db[_0x724f('0x42')]['count'](_0x3f66af)[_0x724f('0x27')](function(_0x59d6f6){_0x61f8cf[_0x724f('0x20')]=_0x59d6f6;if(_0x1aba02[_0x724f('0x31')][_0x724f('0x43')]){_0x1ccae2['include']=[{'all':!![]}];}return db['MailServerOut'][_0x724f('0x44')](_0x1ccae2);})[_0x724f('0x27')](function(_0x4f63e5){_0x61f8cf['rows']=_0x4f63e5;return _0x61f8cf;})[_0x724f('0x27')](respondWithFilteredResult(_0x3d2d6f,_0x1ccae2))[_0x724f('0x45')](handleError(_0x3d2d6f,null));};exports[_0x724f('0x46')]=function(_0x1dfd9b,_0x18c33c){var _0x50eb4f={'raw':!![],'where':{'id':_0x1dfd9b['params']['id']}},_0x591d8c={};_0x591d8c[_0x724f('0x30')]=_[_0x724f('0x32')](db[_0x724f('0x42')][_0x724f('0x2c')]);_0x591d8c[_0x724f('0x31')]=_[_0x724f('0x32')](_0x1dfd9b[_0x724f('0x31')]);_0x591d8c['filters']=_[_0x724f('0x33')](_0x591d8c[_0x724f('0x30')],_0x591d8c[_0x724f('0x31')]);_0x50eb4f[_0x724f('0x34')]=_[_0x724f('0x33')](_0x591d8c[_0x724f('0x30')],qs[_0x724f('0x35')](_0x1dfd9b[_0x724f('0x31')][_0x724f('0x35')]));_0x50eb4f['attributes']=_0x50eb4f[_0x724f('0x34')][_0x724f('0x36')]?_0x50eb4f['attributes']:_0x591d8c['model'];if(_0x1dfd9b[_0x724f('0x31')][_0x724f('0x43')]){_0x50eb4f[_0x724f('0x47')]=[{'all':!![]}];}_0x50eb4f=_['merge']({},_0x50eb4f,_0x1dfd9b[_0x724f('0x41')]);return db[_0x724f('0x42')][_0x724f('0x48')](_0x50eb4f)['then'](handleEntityNotFound(_0x18c33c,null))[_0x724f('0x27')](respondWithResult(_0x18c33c,null))[_0x724f('0x45')](handleError(_0x18c33c,null));};exports[_0x724f('0x49')]=function(_0xa394df,_0x23c352){return db[_0x724f('0x42')][_0x724f('0x49')](_0xa394df[_0x724f('0x4a')],{})[_0x724f('0x27')](respondWithResult(_0x23c352,0xc9))[_0x724f('0x45')](handleError(_0x23c352,null));};exports[_0x724f('0x26')]=function(_0x22bb6c,_0x37de7e){if(_0x22bb6c[_0x724f('0x4a')]['id']){delete _0x22bb6c[_0x724f('0x4a')]['id'];}return db[_0x724f('0x42')][_0x724f('0x48')]({'where':{'id':_0x22bb6c[_0x724f('0x4b')]['id']}})[_0x724f('0x27')](handleEntityNotFound(_0x37de7e,null))[_0x724f('0x27')](saveUpdates(_0x22bb6c[_0x724f('0x4a')],null))[_0x724f('0x27')](respondWithResult(_0x37de7e,null))['catch'](handleError(_0x37de7e,null));};exports['destroy']=function(_0x5dc0c8,_0x59b188){return db[_0x724f('0x42')][_0x724f('0x48')]({'where':{'id':_0x5dc0c8[_0x724f('0x4b')]['id']}})[_0x724f('0x27')](handleEntityNotFound(_0x59b188,null))[_0x724f('0x27')](removeEntity(_0x59b188,null))[_0x724f('0x45')](handleError(_0x59b188,null));}; \ No newline at end of file +var _0x95c6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','end','name','send','map','MailServerOut','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x95c6,0x1e8));var _0x695c=function(_0x3b7f67,_0x369790){_0x3b7f67=_0x3b7f67-0x0;var _0x10aed7=_0x95c6[_0x3b7f67];return _0x10aed7;};'use strict';var emlformat=require(_0x695c('0x0'));var rimraf=require(_0x695c('0x1'));var zipdir=require(_0x695c('0x2'));var jsonpatch=require(_0x695c('0x3'));var rp=require(_0x695c('0x4'));var moment=require(_0x695c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x695c('0x6'));var util=require('util');var path=require(_0x695c('0x7'));var sox=require(_0x695c('0x8'));var csv=require(_0x695c('0x9'));var ejs=require(_0x695c('0xa'));var fs=require('fs');var fs_extra=require(_0x695c('0xb'));var _=require(_0x695c('0xc'));var squel=require(_0x695c('0xd'));var crypto=require(_0x695c('0xe'));var jsforce=require(_0x695c('0xf'));var deskjs=require(_0x695c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x695c('0x11'));var Papa=require(_0x695c('0x12'));var Redis=require('ioredis');var authService=require(_0x695c('0x13'));var qs=require(_0x695c('0x14'));var as=require(_0x695c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x695c('0x16'))(_0x695c('0x17'));var utils=require(_0x695c('0x18'));var config=require(_0x695c('0x19'));var licenseUtil=require(_0x695c('0x1a'));var db=require(_0x695c('0x1b'))['db'];function respondWithStatusCode(_0x4420ef,_0x4be071){_0x4be071=_0x4be071||0xcc;return function(_0x2068e1){if(_0x2068e1){return _0x4420ef[_0x695c('0x1c')](_0x4be071);}return _0x4420ef[_0x695c('0x1d')](_0x4be071)['end']();};}function respondWithResult(_0x30fa17,_0x5cab44){_0x5cab44=_0x5cab44||0xc8;return function(_0x1b939f){if(_0x1b939f){return _0x30fa17[_0x695c('0x1d')](_0x5cab44)[_0x695c('0x1e')](_0x1b939f);}};}function respondWithFilteredResult(_0x587252,_0x44d131){return function(_0x192e43){if(_0x192e43){var _0x49d8a7=typeof _0x44d131[_0x695c('0x1f')]===_0x695c('0x20')&&typeof _0x44d131['limit']===_0x695c('0x20');var _0x4fcea5=_0x192e43['count'];var _0x26a5ab=_0x49d8a7?0x0:_0x44d131[_0x695c('0x1f')];var _0xdd10f7=_0x49d8a7?_0x192e43['count']:_0x44d131[_0x695c('0x1f')]+_0x44d131[_0x695c('0x21')];var _0x13ea9b;if(_0xdd10f7>=_0x4fcea5){_0xdd10f7=_0x4fcea5;_0x13ea9b=0xc8;}else{_0x13ea9b=0xce;}_0x587252[_0x695c('0x1d')](_0x13ea9b);return _0x587252[_0x695c('0x22')](_0x695c('0x23'),_0x26a5ab+'-'+_0xdd10f7+'/'+_0x4fcea5)[_0x695c('0x1e')](_0x192e43);}return null;};}function patchUpdates(_0xbc1c9c){return function(_0x1b71c0){try{jsonpatch['apply'](_0x1b71c0,_0xbc1c9c,!![]);}catch(_0x5638f9){return BPromise[_0x695c('0x24')](_0x5638f9);}return _0x1b71c0[_0x695c('0x25')]();};}function saveUpdates(_0x47646b,_0x1ddd63){return function(_0x2ea27d){if(_0x2ea27d){return _0x2ea27d[_0x695c('0x26')](_0x47646b)['then'](function(_0x501448){return _0x501448;});}return null;};}function removeEntity(_0x5c9473,_0x3e762e){return function(_0x44ca06){if(_0x44ca06){return _0x44ca06['destroy']()[_0x695c('0x27')](function(){_0x5c9473[_0x695c('0x1d')](0xcc)[_0x695c('0x28')]();});}};}function handleEntityNotFound(_0x4d77c9,_0x4875b6){return function(_0x5709ce){if(!_0x5709ce){_0x4d77c9['sendStatus'](0x194);}return _0x5709ce;};}function handleError(_0x251f54,_0x24f909){_0x24f909=_0x24f909||0x1f4;return function(_0x50985d){logger['error'](_0x50985d['stack']);if(_0x50985d[_0x695c('0x29')]){delete _0x50985d[_0x695c('0x29')];}_0x251f54[_0x695c('0x1d')](_0x24f909)[_0x695c('0x2a')](_0x50985d);};}exports['index']=function(_0x355470,_0x117441){var _0x49b680={},_0x1b30cc={},_0x1e931b={'count':0x0,'rows':[]};var _0x3aeb05=_[_0x695c('0x2b')](db[_0x695c('0x2c')][_0x695c('0x2d')],function(_0x3d2046){return{'name':_0x3d2046['fieldName'],'type':_0x3d2046[_0x695c('0x2e')]['key']};});_0x1b30cc[_0x695c('0x2f')]=_[_0x695c('0x2b')](_0x3aeb05,'name');_0x1b30cc[_0x695c('0x30')]=_[_0x695c('0x31')](_0x355470[_0x695c('0x30')]);_0x1b30cc[_0x695c('0x32')]=_[_0x695c('0x33')](_0x1b30cc[_0x695c('0x2f')],_0x1b30cc['query']);_0x49b680[_0x695c('0x34')]=_[_0x695c('0x33')](_0x1b30cc[_0x695c('0x2f')],qs['fields'](_0x355470[_0x695c('0x30')][_0x695c('0x35')]));_0x49b680[_0x695c('0x34')]=_0x49b680[_0x695c('0x34')][_0x695c('0x36')]?_0x49b680[_0x695c('0x34')]:_0x1b30cc[_0x695c('0x2f')];if(!_0x355470[_0x695c('0x30')]['hasOwnProperty']('nolimit')){_0x49b680[_0x695c('0x21')]=qs[_0x695c('0x21')](_0x355470[_0x695c('0x30')][_0x695c('0x21')]);_0x49b680['offset']=qs[_0x695c('0x1f')](_0x355470['query'][_0x695c('0x1f')]);}_0x49b680[_0x695c('0x37')]=qs[_0x695c('0x38')](_0x355470['query'][_0x695c('0x38')]);_0x49b680[_0x695c('0x39')]=qs[_0x695c('0x32')](_[_0x695c('0x3a')](_0x355470[_0x695c('0x30')],_0x1b30cc[_0x695c('0x32')]),_0x3aeb05);if(_0x355470['query'][_0x695c('0x3b')]){_0x49b680['where']=_[_0x695c('0x3c')](_0x49b680[_0x695c('0x39')],{'$or':_[_0x695c('0x2b')](_0x3aeb05,function(_0x35d9c3){if(_0x35d9c3[_0x695c('0x2e')]!==_0x695c('0x3d')){var _0x49abe3={};_0x49abe3[_0x35d9c3['name']]={'$like':'%'+_0x355470[_0x695c('0x30')]['filter']+'%'};return _0x49abe3;}})});}_0x49b680=_[_0x695c('0x3c')]({},_0x49b680,_0x355470[_0x695c('0x3e')]);var _0x48cfbf={'where':_0x49b680[_0x695c('0x39')]};return db[_0x695c('0x2c')][_0x695c('0x3f')](_0x48cfbf)[_0x695c('0x27')](function(_0x325f85){_0x1e931b[_0x695c('0x3f')]=_0x325f85;if(_0x355470[_0x695c('0x30')][_0x695c('0x40')]){_0x49b680['include']=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x49b680);})[_0x695c('0x27')](function(_0x2692e5){_0x1e931b[_0x695c('0x41')]=_0x2692e5;return _0x1e931b;})[_0x695c('0x27')](respondWithFilteredResult(_0x117441,_0x49b680))[_0x695c('0x42')](handleError(_0x117441,null));};exports[_0x695c('0x43')]=function(_0x36fb8d,_0x150f59){var _0x304a1f={'raw':!![],'where':{'id':_0x36fb8d[_0x695c('0x44')]['id']}},_0x2d6148={};_0x2d6148[_0x695c('0x2f')]=_[_0x695c('0x31')](db[_0x695c('0x2c')][_0x695c('0x2d')]);_0x2d6148[_0x695c('0x30')]=_[_0x695c('0x31')](_0x36fb8d[_0x695c('0x30')]);_0x2d6148[_0x695c('0x32')]=_[_0x695c('0x33')](_0x2d6148[_0x695c('0x2f')],_0x2d6148[_0x695c('0x30')]);_0x304a1f[_0x695c('0x34')]=_[_0x695c('0x33')](_0x2d6148[_0x695c('0x2f')],qs[_0x695c('0x35')](_0x36fb8d[_0x695c('0x30')][_0x695c('0x35')]));_0x304a1f[_0x695c('0x34')]=_0x304a1f[_0x695c('0x34')][_0x695c('0x36')]?_0x304a1f['attributes']:_0x2d6148['model'];if(_0x36fb8d[_0x695c('0x30')][_0x695c('0x40')]){_0x304a1f['include']=[{'all':!![]}];}_0x304a1f=_[_0x695c('0x3c')]({},_0x304a1f,_0x36fb8d['options']);return db[_0x695c('0x2c')][_0x695c('0x45')](_0x304a1f)[_0x695c('0x27')](handleEntityNotFound(_0x150f59,null))[_0x695c('0x27')](respondWithResult(_0x150f59,null))['catch'](handleError(_0x150f59,null));};exports[_0x695c('0x46')]=function(_0xd7739b,_0x278845){return db[_0x695c('0x2c')][_0x695c('0x46')](_0xd7739b[_0x695c('0x47')],{})[_0x695c('0x27')](respondWithResult(_0x278845,0xc9))[_0x695c('0x42')](handleError(_0x278845,null));};exports[_0x695c('0x26')]=function(_0x24efaa,_0xbebb10){if(_0x24efaa[_0x695c('0x47')]['id']){delete _0x24efaa[_0x695c('0x47')]['id'];}return db[_0x695c('0x2c')]['find']({'where':{'id':_0x24efaa['params']['id']}})[_0x695c('0x27')](handleEntityNotFound(_0xbebb10,null))[_0x695c('0x27')](saveUpdates(_0x24efaa[_0x695c('0x47')],null))[_0x695c('0x27')](respondWithResult(_0xbebb10,null))[_0x695c('0x42')](handleError(_0xbebb10,null));};exports[_0x695c('0x48')]=function(_0x407a07,_0xd4b5a4){return db[_0x695c('0x2c')]['find']({'where':{'id':_0x407a07[_0x695c('0x44')]['id']}})[_0x695c('0x27')](handleEntityNotFound(_0xd4b5a4,null))[_0x695c('0x27')](removeEntity(_0xd4b5a4,null))[_0x695c('0x42')](handleError(_0xd4b5a4,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9258b82..c908ba7 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 _0x08ea=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','MailServerOut','lodash'];(function(_0xa38152,_0x33fb6c){var _0x271fe3=function(_0x4eb06f){while(--_0x4eb06f){_0xa38152['push'](_0xa38152['shift']());}};_0x271fe3(++_0x33fb6c);}(_0x08ea,0x6d));var _0xa08e=function(_0x38873d,_0x56d75c){_0x38873d=_0x38873d-0x0;var _0x520f9b=_0x08ea[_0x38873d];return _0x520f9b;};'use strict';var _=require(_0xa08e('0x0'));var util=require(_0xa08e('0x1'));var logger=require(_0xa08e('0x2'))(_0xa08e('0x3'));var moment=require(_0xa08e('0x4'));var BPromise=require(_0xa08e('0x5'));var rp=require(_0xa08e('0x6'));var fs=require('fs');var path=require(_0xa08e('0x7'));var rimraf=require('rimraf');var config=require(_0xa08e('0x8'));var attributes=require('./mailServerOut.attributes');module[_0xa08e('0x9')]=function(_0x10de8a,_0x3a163b){return _0x10de8a['define'](_0xa08e('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5367=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash'];(function(_0x51557b,_0x521c80){var _0x83171=function(_0x17bd85){while(--_0x17bd85){_0x51557b['push'](_0x51557b['shift']());}};_0x83171(++_0x521c80);}(_0x5367,0xe6));var _0x7536=function(_0x3b6b33,_0x2dfb02){_0x3b6b33=_0x3b6b33-0x0;var _0x3e19f6=_0x5367[_0x3b6b33];return _0x3e19f6;};'use strict';var _=require(_0x7536('0x0'));var util=require(_0x7536('0x1'));var logger=require(_0x7536('0x2'))(_0x7536('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7536('0x4'));var fs=require('fs');var path=require(_0x7536('0x5'));var rimraf=require(_0x7536('0x6'));var config=require(_0x7536('0x7'));var attributes=require(_0x7536('0x8'));module['exports']=function(_0x5148e8,_0x3984f2){return _0x5148e8[_0x7536('0x9')](_0x7536('0xa'),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 04545d4..a6bc1f7 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x3c0eba,_0x2309df){_0x3c0eba=_0x3c0eba-0x0;var _0x5d242b=_0x7a54[_0x3c0eba];return _0x5d242b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x733c8c,_0x1562e3){var _0x3bc24d=function(_0x25a97a){while(--_0x25a97a){_0x733c8c['push'](_0x733c8c['shift']());}};_0x3bc24d(++_0x1562e3);}(_0x1261,0x144));var _0x1126=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x1261[_0x75f869];return _0x10af8b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 6b2ff8f..3632d14 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 _0x96f2=['show','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x5a4968,_0x3bf248){var _0x46302c=function(_0x4b5225){while(--_0x4b5225){_0x5a4968['push'](_0x5a4968['shift']());}};_0x46302c(++_0x3bf248);}(_0x96f2,0x73));var _0x296f=function(_0x5496e5,_0x5afbb8){_0x5496e5=_0x5496e5-0x0;var _0x320607=_0x96f2[_0x5496e5];return _0x320607;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require('connect-timeout');var express=require(_0x296f('0x2'));var router=express[_0x296f('0x3')]();var fs_extra=require(_0x296f('0x4'));var auth=require(_0x296f('0x5'));var interaction=require(_0x296f('0x6'));var config=require(_0x296f('0x7'));var controller=require('./mailSubstatus.controller');router[_0x296f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x296f('0x8')]('/describe',auth[_0x296f('0x9')](),controller['describe']);router[_0x296f('0x8')](_0x296f('0xa'),auth[_0x296f('0x9')](),controller[_0x296f('0xb')]);router[_0x296f('0xc')]('/',auth['isAuthenticated'](),controller[_0x296f('0xd')]);router[_0x296f('0xe')](_0x296f('0xa'),auth[_0x296f('0x9')](),controller['update']);router[_0x296f('0xf')](_0x296f('0xa'),auth[_0x296f('0x9')](),controller[_0x296f('0x10')]);module[_0x296f('0x11')]=router; \ No newline at end of file +var _0xcf20=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xcf20,0x144));var _0x0cf2=function(_0x14dc6e,_0x3c0135){_0x14dc6e=_0x14dc6e-0x0;var _0x4e7989=_0xcf20[_0x14dc6e];return _0x4e7989;};'use strict';var multer=require(_0x0cf2('0x0'));var util=require(_0x0cf2('0x1'));var path=require(_0x0cf2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0cf2('0x3')]();var fs_extra=require(_0x0cf2('0x4'));var auth=require(_0x0cf2('0x5'));var interaction=require(_0x0cf2('0x6'));var config=require(_0x0cf2('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x0cf2('0x8')](),controller['index']);router['get'](_0x0cf2('0x9'),auth[_0x0cf2('0x8')](),controller['describe']);router['get'](_0x0cf2('0xa'),auth[_0x0cf2('0x8')](),controller[_0x0cf2('0xb')]);router[_0x0cf2('0xc')]('/',auth[_0x0cf2('0x8')](),controller[_0x0cf2('0xd')]);router[_0x0cf2('0xe')](_0x0cf2('0xa'),auth[_0x0cf2('0x8')](),controller[_0x0cf2('0xf')]);router[_0x0cf2('0x10')](_0x0cf2('0xa'),auth[_0x0cf2('0x8')](),controller[_0x0cf2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b0d4dca..9f38e49 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 _0x6455=['name','sequelize','STRING'];(function(_0x5fd31c,_0x5d3c8a){var _0xc2787c=function(_0x4f8c23){while(--_0x4f8c23){_0x5fd31c['push'](_0x5fd31c['shift']());}};_0xc2787c(++_0x5d3c8a);}(_0x6455,0x97));var _0x5645=function(_0x1d1496,_0x320b41){_0x1d1496=_0x1d1496-0x0;var _0x44cff5=_0x6455[_0x1d1496];return _0x44cff5;};'use strict';var Sequelize=require(_0x5645('0x0'));module['exports']={'name':{'type':Sequelize[_0x5645('0x1')],'unique':_0x5645('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5645('0x1')]}}; \ No newline at end of file +var _0xc21e=['STRING','name','exports'];(function(_0x2af0bd,_0x30c3ac){var _0x1f52cd=function(_0x3101ee){while(--_0x3101ee){_0x2af0bd['push'](_0x2af0bd['shift']());}};_0x1f52cd(++_0x30c3ac);}(_0xc21e,0x1ca));var _0xec21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc21e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xec21('0x0')]={'name':{'type':Sequelize[_0xec21('0x1')],'unique':_0xec21('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xec21('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 77d9583..8d36064 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 _0x0230=['count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','MailSubstatus','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','limit','undefined'];(function(_0x3b97f0,_0x45ea2c){var _0x2abbd8=function(_0x256a0f){while(--_0x256a0f){_0x3b97f0['push'](_0x3b97f0['shift']());}};_0x2abbd8(++_0x45ea2c);}(_0x0230,0x163));var _0x0023=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x0230[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x0023('0x0'));var rimraf=require(_0x0023('0x1'));var zipdir=require(_0x0023('0x2'));var jsonpatch=require(_0x0023('0x3'));var rp=require('request-promise');var moment=require(_0x0023('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0023('0x5'));var util=require(_0x0023('0x6'));var path=require(_0x0023('0x7'));var sox=require(_0x0023('0x8'));var csv=require(_0x0023('0x9'));var ejs=require(_0x0023('0xa'));var fs=require('fs');var fs_extra=require(_0x0023('0xb'));var _=require(_0x0023('0xc'));var squel=require(_0x0023('0xd'));var crypto=require(_0x0023('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0023('0xf'));var toCsv=require(_0x0023('0x9'));var querystring=require(_0x0023('0x10'));var Papa=require(_0x0023('0x11'));var Redis=require(_0x0023('0x12'));var authService=require(_0x0023('0x13'));var qs=require(_0x0023('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0023('0x15'));var logger=require(_0x0023('0x16'))(_0x0023('0x17'));var utils=require(_0x0023('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0023('0x19'));var db=require(_0x0023('0x1a'))['db'];function respondWithStatusCode(_0x39ab74,_0x11563b){_0x11563b=_0x11563b||0xcc;return function(_0x58c264){if(_0x58c264){return _0x39ab74['sendStatus'](_0x11563b);}return _0x39ab74[_0x0023('0x1b')](_0x11563b)['end']();};}function respondWithResult(_0x384208,_0x50a459){_0x50a459=_0x50a459||0xc8;return function(_0x4b4da6){if(_0x4b4da6){return _0x384208[_0x0023('0x1b')](_0x50a459)['json'](_0x4b4da6);}};}function respondWithFilteredResult(_0x150576,_0x4824fb){return function(_0x111f9c){if(_0x111f9c){var _0x27e582=typeof _0x4824fb['offset']==='undefined'&&typeof _0x4824fb[_0x0023('0x1c')]===_0x0023('0x1d');var _0xe157fd=_0x111f9c[_0x0023('0x1e')];var _0xb40602=_0x27e582?0x0:_0x4824fb[_0x0023('0x1f')];var _0x509cf6=_0x27e582?_0x111f9c[_0x0023('0x1e')]:_0x4824fb[_0x0023('0x1f')]+_0x4824fb[_0x0023('0x1c')];var _0x55ddd3;if(_0x509cf6>=_0xe157fd){_0x509cf6=_0xe157fd;_0x55ddd3=0xc8;}else{_0x55ddd3=0xce;}_0x150576['status'](_0x55ddd3);return _0x150576[_0x0023('0x20')](_0x0023('0x21'),_0xb40602+'-'+_0x509cf6+'/'+_0xe157fd)['json'](_0x111f9c);}return null;};}function patchUpdates(_0x106554){return function(_0x2a3326){try{jsonpatch[_0x0023('0x22')](_0x2a3326,_0x106554,!![]);}catch(_0x5a3570){return BPromise[_0x0023('0x23')](_0x5a3570);}return _0x2a3326[_0x0023('0x24')]();};}function saveUpdates(_0xe1dfc6,_0x39627d){return function(_0x546fd4){if(_0x546fd4){return _0x546fd4[_0x0023('0x25')](_0xe1dfc6)['then'](function(_0x364962){return _0x364962;});}return null;};}function removeEntity(_0x84b6f8,_0x50e7ff){return function(_0x2205a5){if(_0x2205a5){return _0x2205a5[_0x0023('0x26')]()[_0x0023('0x27')](function(){_0x84b6f8[_0x0023('0x1b')](0xcc)[_0x0023('0x28')]();});}};}function handleEntityNotFound(_0x1a66e7,_0x1f9111){return function(_0x50e5e7){if(!_0x50e5e7){_0x1a66e7['sendStatus'](0x194);}return _0x50e5e7;};}function handleError(_0x50a7ec,_0x4df897){_0x4df897=_0x4df897||0x1f4;return function(_0x461cf2){logger[_0x0023('0x29')](_0x461cf2[_0x0023('0x2a')]);if(_0x461cf2[_0x0023('0x2b')]){delete _0x461cf2['name'];}_0x50a7ec[_0x0023('0x1b')](_0x4df897)[_0x0023('0x2c')](_0x461cf2);};}exports['index']=function(_0x145151,_0x359d43){var _0x227046={},_0x193c30={},_0x19c527={'count':0x0,'rows':[]};var _0xd68b87=_[_0x0023('0x2d')](db[_0x0023('0x2e')]['rawAttributes'],function(_0x48a26c){return{'name':_0x48a26c[_0x0023('0x2f')],'type':_0x48a26c[_0x0023('0x30')][_0x0023('0x31')]};});_0x193c30[_0x0023('0x32')]=_[_0x0023('0x2d')](_0xd68b87,_0x0023('0x2b'));_0x193c30[_0x0023('0x33')]=_[_0x0023('0x34')](_0x145151[_0x0023('0x33')]);_0x193c30['filters']=_[_0x0023('0x35')](_0x193c30[_0x0023('0x32')],_0x193c30[_0x0023('0x33')]);_0x227046[_0x0023('0x36')]=_[_0x0023('0x35')](_0x193c30[_0x0023('0x32')],qs['fields'](_0x145151[_0x0023('0x33')][_0x0023('0x37')]));_0x227046[_0x0023('0x36')]=_0x227046[_0x0023('0x36')]['length']?_0x227046[_0x0023('0x36')]:_0x193c30['model'];if(!_0x145151[_0x0023('0x33')][_0x0023('0x38')]('nolimit')){_0x227046[_0x0023('0x1c')]=qs[_0x0023('0x1c')](_0x145151[_0x0023('0x33')]['limit']);_0x227046[_0x0023('0x1f')]=qs['offset'](_0x145151[_0x0023('0x33')][_0x0023('0x1f')]);}_0x227046[_0x0023('0x39')]=qs[_0x0023('0x3a')](_0x145151[_0x0023('0x33')][_0x0023('0x3a')]);_0x227046[_0x0023('0x3b')]=qs[_0x0023('0x3c')](_['pick'](_0x145151[_0x0023('0x33')],_0x193c30['filters']),_0xd68b87);if(_0x145151[_0x0023('0x33')]['filter']){_0x227046['where']=_['merge'](_0x227046[_0x0023('0x3b')],{'$or':_[_0x0023('0x2d')](_0xd68b87,function(_0x17647f){if(_0x17647f['type']!==_0x0023('0x3d')){var _0x525059={};_0x525059[_0x17647f[_0x0023('0x2b')]]={'$like':'%'+_0x145151[_0x0023('0x33')][_0x0023('0x3e')]+'%'};return _0x525059;}})});}_0x227046=_['merge']({},_0x227046,_0x145151['options']);var _0x3efe97={'where':_0x227046[_0x0023('0x3b')]};return db[_0x0023('0x2e')][_0x0023('0x1e')](_0x3efe97)['then'](function(_0x243e85){_0x19c527['count']=_0x243e85;if(_0x145151[_0x0023('0x33')][_0x0023('0x3f')]){_0x227046[_0x0023('0x40')]=[{'all':!![]}];}return db[_0x0023('0x2e')][_0x0023('0x41')](_0x227046);})[_0x0023('0x27')](function(_0x1d1d7e){_0x19c527[_0x0023('0x42')]=_0x1d1d7e;return _0x19c527;})['then'](respondWithFilteredResult(_0x359d43,_0x227046))[_0x0023('0x43')](handleError(_0x359d43,null));};exports[_0x0023('0x44')]=function(_0x4cb95f,_0x2ce046){var _0x455fd9={'raw':!![],'where':{'id':_0x4cb95f[_0x0023('0x45')]['id']}},_0x23b73a={};_0x23b73a[_0x0023('0x32')]=_[_0x0023('0x34')](db[_0x0023('0x2e')][_0x0023('0x46')]);_0x23b73a[_0x0023('0x33')]=_['keys'](_0x4cb95f[_0x0023('0x33')]);_0x23b73a[_0x0023('0x3c')]=_[_0x0023('0x35')](_0x23b73a[_0x0023('0x32')],_0x23b73a[_0x0023('0x33')]);_0x455fd9[_0x0023('0x36')]=_[_0x0023('0x35')](_0x23b73a[_0x0023('0x32')],qs[_0x0023('0x37')](_0x4cb95f[_0x0023('0x33')][_0x0023('0x37')]));_0x455fd9['attributes']=_0x455fd9[_0x0023('0x36')]['length']?_0x455fd9[_0x0023('0x36')]:_0x23b73a['model'];if(_0x4cb95f[_0x0023('0x33')][_0x0023('0x3f')]){_0x455fd9[_0x0023('0x40')]=[{'all':!![]}];}_0x455fd9=_[_0x0023('0x47')]({},_0x455fd9,_0x4cb95f[_0x0023('0x48')]);return db[_0x0023('0x2e')][_0x0023('0x49')](_0x455fd9)[_0x0023('0x27')](handleEntityNotFound(_0x2ce046,null))[_0x0023('0x27')](respondWithResult(_0x2ce046,null))[_0x0023('0x43')](handleError(_0x2ce046,null));};exports[_0x0023('0x4a')]=function(_0x944487,_0x403edb){return db[_0x0023('0x2e')][_0x0023('0x4a')](_0x944487['body'],{})[_0x0023('0x27')](respondWithResult(_0x403edb,0xc9))[_0x0023('0x43')](handleError(_0x403edb,null));};exports[_0x0023('0x25')]=function(_0x4aeb6e,_0x143f37){if(_0x4aeb6e[_0x0023('0x4b')]['id']){delete _0x4aeb6e[_0x0023('0x4b')]['id'];}return db['MailSubstatus'][_0x0023('0x49')]({'where':{'id':_0x4aeb6e[_0x0023('0x45')]['id']}})[_0x0023('0x27')](handleEntityNotFound(_0x143f37,null))['then'](saveUpdates(_0x4aeb6e[_0x0023('0x4b')],null))[_0x0023('0x27')](respondWithResult(_0x143f37,null))[_0x0023('0x43')](handleError(_0x143f37,null));};exports[_0x0023('0x26')]=function(_0x3a51ec,_0x3096b8){return db[_0x0023('0x2e')][_0x0023('0x49')]({'where':{'id':_0x3a51ec[_0x0023('0x45')]['id']}})[_0x0023('0x27')](handleEntityNotFound(_0x3096b8,null))[_0x0023('0x27')](removeEntity(_0x3096b8,null))[_0x0023('0x43')](handleError(_0x3096b8,null));};exports[_0x0023('0x4c')]=function(_0x2d608c,_0x21191f){return db[_0x0023('0x2e')]['describe']()[_0x0023('0x27')](respondWithResult(_0x21191f,null))[_0x0023('0x43')](handleError(_0x21191f,null));}; \ No newline at end of file +var _0x929f=['MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','includeAll','find','create','body','update','params','describe','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','status','end','error','stack','name','send','map'];(function(_0x579f5d,_0x4de225){var _0x11db8e=function(_0x2968e3){while(--_0x2968e3){_0x579f5d['push'](_0x579f5d['shift']());}};_0x11db8e(++_0x4de225);}(_0x929f,0x65));var _0xf929=function(_0x264716,_0x34ffe6){_0x264716=_0x264716-0x0;var _0x528eaa=_0x929f[_0x264716];return _0x528eaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf929('0x0'));var zipdir=require(_0xf929('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf929('0x2'));var BPromise=require(_0xf929('0x3'));var Mustache=require(_0xf929('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf929('0x5'));var csv=require(_0xf929('0x6'));var ejs=require(_0xf929('0x7'));var fs=require('fs');var fs_extra=require(_0xf929('0x8'));var _=require(_0xf929('0x9'));var squel=require(_0xf929('0xa'));var crypto=require(_0xf929('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf929('0x6'));var querystring=require(_0xf929('0xc'));var Papa=require('papaparse');var Redis=require(_0xf929('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf929('0xe'));var hardwareService=require(_0xf929('0xf'));var logger=require('../../config/logger')(_0xf929('0x10'));var utils=require(_0xf929('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54be9f,_0x1db7fa){_0x1db7fa=_0x1db7fa||0xcc;return function(_0x393a98){if(_0x393a98){return _0x54be9f[_0xf929('0x12')](_0x1db7fa);}return _0x54be9f['status'](_0x1db7fa)['end']();};}function respondWithResult(_0x3566bd,_0x1c3f63){_0x1c3f63=_0x1c3f63||0xc8;return function(_0x553f7a){if(_0x553f7a){return _0x3566bd['status'](_0x1c3f63)['json'](_0x553f7a);}};}function respondWithFilteredResult(_0x4fc618,_0x2f64c0){return function(_0x4067a3){if(_0x4067a3){var _0x1bd787=typeof _0x2f64c0[_0xf929('0x13')]===_0xf929('0x14')&&typeof _0x2f64c0['limit']===_0xf929('0x14');var _0x2eda90=_0x4067a3[_0xf929('0x15')];var _0x4d8f4e=_0x1bd787?0x0:_0x2f64c0[_0xf929('0x13')];var _0x4c098e=_0x1bd787?_0x4067a3[_0xf929('0x15')]:_0x2f64c0[_0xf929('0x13')]+_0x2f64c0[_0xf929('0x16')];var _0x5035bd;if(_0x4c098e>=_0x2eda90){_0x4c098e=_0x2eda90;_0x5035bd=0xc8;}else{_0x5035bd=0xce;}_0x4fc618['status'](_0x5035bd);return _0x4fc618[_0xf929('0x17')](_0xf929('0x18'),_0x4d8f4e+'-'+_0x4c098e+'/'+_0x2eda90)[_0xf929('0x19')](_0x4067a3);}return null;};}function patchUpdates(_0x7c2b05){return function(_0x13946c){try{jsonpatch[_0xf929('0x1a')](_0x13946c,_0x7c2b05,!![]);}catch(_0x45981f){return BPromise['reject'](_0x45981f);}return _0x13946c[_0xf929('0x1b')]();};}function saveUpdates(_0x3600d1,_0x1ec8ad){return function(_0x8a916c){if(_0x8a916c){return _0x8a916c['update'](_0x3600d1)[_0xf929('0x1c')](function(_0x1c8b16){return _0x1c8b16;});}return null;};}function removeEntity(_0x41214a,_0x33c6c0){return function(_0x437b5e){if(_0x437b5e){return _0x437b5e[_0xf929('0x1d')]()[_0xf929('0x1c')](function(){_0x41214a[_0xf929('0x1e')](0xcc)[_0xf929('0x1f')]();});}};}function handleEntityNotFound(_0x522b0a,_0x31affd){return function(_0x454697){if(!_0x454697){_0x522b0a[_0xf929('0x12')](0x194);}return _0x454697;};}function handleError(_0x46ac2a,_0x335de4){_0x335de4=_0x335de4||0x1f4;return function(_0x7af885){logger[_0xf929('0x20')](_0x7af885[_0xf929('0x21')]);if(_0x7af885[_0xf929('0x22')]){delete _0x7af885[_0xf929('0x22')];}_0x46ac2a[_0xf929('0x1e')](_0x335de4)[_0xf929('0x23')](_0x7af885);};}exports['index']=function(_0x39fc06,_0x5530da){var _0x34c455={},_0x3e57c5={},_0x1220a8={'count':0x0,'rows':[]};var _0x56730e=_[_0xf929('0x24')](db[_0xf929('0x25')][_0xf929('0x26')],function(_0x3173ce){return{'name':_0x3173ce[_0xf929('0x27')],'type':_0x3173ce[_0xf929('0x28')][_0xf929('0x29')]};});_0x3e57c5[_0xf929('0x2a')]=_[_0xf929('0x24')](_0x56730e,'name');_0x3e57c5['query']=_[_0xf929('0x2b')](_0x39fc06[_0xf929('0x2c')]);_0x3e57c5[_0xf929('0x2d')]=_[_0xf929('0x2e')](_0x3e57c5[_0xf929('0x2a')],_0x3e57c5[_0xf929('0x2c')]);_0x34c455[_0xf929('0x2f')]=_[_0xf929('0x2e')](_0x3e57c5[_0xf929('0x2a')],qs[_0xf929('0x30')](_0x39fc06['query']['fields']));_0x34c455[_0xf929('0x2f')]=_0x34c455[_0xf929('0x2f')][_0xf929('0x31')]?_0x34c455['attributes']:_0x3e57c5[_0xf929('0x2a')];if(!_0x39fc06[_0xf929('0x2c')][_0xf929('0x32')](_0xf929('0x33'))){_0x34c455['limit']=qs['limit'](_0x39fc06['query']['limit']);_0x34c455[_0xf929('0x13')]=qs[_0xf929('0x13')](_0x39fc06[_0xf929('0x2c')][_0xf929('0x13')]);}_0x34c455[_0xf929('0x34')]=qs[_0xf929('0x35')](_0x39fc06['query'][_0xf929('0x35')]);_0x34c455[_0xf929('0x36')]=qs['filters'](_[_0xf929('0x37')](_0x39fc06[_0xf929('0x2c')],_0x3e57c5[_0xf929('0x2d')]),_0x56730e);if(_0x39fc06['query']['filter']){_0x34c455[_0xf929('0x36')]=_[_0xf929('0x38')](_0x34c455[_0xf929('0x36')],{'$or':_['map'](_0x56730e,function(_0xc5681c){if(_0xc5681c[_0xf929('0x28')]!=='VIRTUAL'){var _0x48574a={};_0x48574a[_0xc5681c[_0xf929('0x22')]]={'$like':'%'+_0x39fc06[_0xf929('0x2c')]['filter']+'%'};return _0x48574a;}})});}_0x34c455=_[_0xf929('0x38')]({},_0x34c455,_0x39fc06[_0xf929('0x39')]);var _0xeb4972={'where':_0x34c455[_0xf929('0x36')]};return db[_0xf929('0x25')][_0xf929('0x15')](_0xeb4972)[_0xf929('0x1c')](function(_0x17ccf6){_0x1220a8['count']=_0x17ccf6;if(_0x39fc06[_0xf929('0x2c')]['includeAll']){_0x34c455[_0xf929('0x3a')]=[{'all':!![]}];}return db[_0xf929('0x25')][_0xf929('0x3b')](_0x34c455);})[_0xf929('0x1c')](function(_0x40be08){_0x1220a8[_0xf929('0x3c')]=_0x40be08;return _0x1220a8;})[_0xf929('0x1c')](respondWithFilteredResult(_0x5530da,_0x34c455))[_0xf929('0x3d')](handleError(_0x5530da,null));};exports['show']=function(_0x1596f8,_0x8de1d0){var _0x3c8039={'raw':!![],'where':{'id':_0x1596f8['params']['id']}},_0x585e4d={};_0x585e4d[_0xf929('0x2a')]=_[_0xf929('0x2b')](db['MailSubstatus']['rawAttributes']);_0x585e4d[_0xf929('0x2c')]=_[_0xf929('0x2b')](_0x1596f8[_0xf929('0x2c')]);_0x585e4d[_0xf929('0x2d')]=_[_0xf929('0x2e')](_0x585e4d[_0xf929('0x2a')],_0x585e4d[_0xf929('0x2c')]);_0x3c8039['attributes']=_['intersection'](_0x585e4d[_0xf929('0x2a')],qs[_0xf929('0x30')](_0x1596f8['query'][_0xf929('0x30')]));_0x3c8039[_0xf929('0x2f')]=_0x3c8039[_0xf929('0x2f')][_0xf929('0x31')]?_0x3c8039['attributes']:_0x585e4d[_0xf929('0x2a')];if(_0x1596f8['query'][_0xf929('0x3e')]){_0x3c8039[_0xf929('0x3a')]=[{'all':!![]}];}_0x3c8039=_[_0xf929('0x38')]({},_0x3c8039,_0x1596f8['options']);return db[_0xf929('0x25')][_0xf929('0x3f')](_0x3c8039)[_0xf929('0x1c')](handleEntityNotFound(_0x8de1d0,null))[_0xf929('0x1c')](respondWithResult(_0x8de1d0,null))[_0xf929('0x3d')](handleError(_0x8de1d0,null));};exports[_0xf929('0x40')]=function(_0x3443c0,_0x20ef7a){return db[_0xf929('0x25')]['create'](_0x3443c0[_0xf929('0x41')],{})[_0xf929('0x1c')](respondWithResult(_0x20ef7a,0xc9))[_0xf929('0x3d')](handleError(_0x20ef7a,null));};exports[_0xf929('0x42')]=function(_0x3c1075,_0xfda7f6){if(_0x3c1075[_0xf929('0x41')]['id']){delete _0x3c1075['body']['id'];}return db[_0xf929('0x25')][_0xf929('0x3f')]({'where':{'id':_0x3c1075['params']['id']}})['then'](handleEntityNotFound(_0xfda7f6,null))[_0xf929('0x1c')](saveUpdates(_0x3c1075['body'],null))['then'](respondWithResult(_0xfda7f6,null))[_0xf929('0x3d')](handleError(_0xfda7f6,null));};exports[_0xf929('0x1d')]=function(_0x52aef0,_0x54c390){return db['MailSubstatus'][_0xf929('0x3f')]({'where':{'id':_0x52aef0[_0xf929('0x43')]['id']}})['then'](handleEntityNotFound(_0x54c390,null))['then'](removeEntity(_0x54c390,null))[_0xf929('0x3d')](handleError(_0x54c390,null));};exports['describe']=function(_0x3e4d9d,_0x2254c3){return db['MailSubstatus'][_0xf929('0x44')]()[_0xf929('0x1c')](respondWithResult(_0x2254c3,null))[_0xf929('0x3d')](handleError(_0x2254c3,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 592fccd..399e396 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 _0x26e6=['../../mysqldb','MailSubstatus','update','emit','hook'];(function(_0x2ad9ae,_0x29a5f0){var _0x36a84a=function(_0x23f86f){while(--_0x23f86f){_0x2ad9ae['push'](_0x2ad9ae['shift']());}};_0x36a84a(++_0x29a5f0);}(_0x26e6,0x13b));var _0x626e=function(_0x107844,_0x41926f){_0x107844=_0x107844-0x0;var _0x40c2b5=_0x26e6[_0x107844];return _0x40c2b5;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x626e('0x0'))['db'][_0x626e('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x626e('0x2')};function emitEvent(_0x36a276){return function(_0x455126,_0x57807d,_0x23edf3){MailSubstatusEvents[_0x626e('0x3')](_0x36a276+':'+_0x455126['id'],_0x455126);MailSubstatusEvents[_0x626e('0x3')](_0x36a276,_0x455126);_0x23edf3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x626e('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x2330=['update','emit','hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x2330,0x175));var _0x0233=function(_0x32a516,_0x44695b){_0x32a516=_0x32a516-0x0;var _0x3625f6=_0x2330[_0x32a516];return _0x3625f6;};'use strict';var EventEmitter=require(_0x0233('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x0233('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0233('0x2')](0x0);var events={'afterUpdate':_0x0233('0x3')};function emitEvent(_0x52e2b8){return function(_0x53fa14,_0x143548,_0x3a9d2f){MailSubstatusEvents[_0x0233('0x4')](_0x52e2b8+':'+_0x53fa14['id'],_0x53fa14);MailSubstatusEvents[_0x0233('0x4')](_0x52e2b8,_0x53fa14);_0x3a9d2f(null);};}for(var e in events){if(events[_0x0233('0x5')](e)){var event=events[e];MailSubstatus[_0x0233('0x6')](e,emitEvent(event));}}module[_0x0233('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 509485e..fb8ea6f 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 _0x1e24=['define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports'];(function(_0x3b8d3a,_0x228fa1){var _0x32303c=function(_0x57eae8){while(--_0x57eae8){_0x3b8d3a['push'](_0x3b8d3a['shift']());}};_0x32303c(++_0x228fa1);}(_0x1e24,0x82));var _0x41e2=function(_0x252782,_0x5b7839){_0x252782=_0x252782-0x0;var _0x5123ea=_0x1e24[_0x252782];return _0x5123ea;};'use strict';var attributes=require(_0x41e2('0x0'));module[_0x41e2('0x1')]=function(_0x388070){var _0x1bce6d=_0x388070['models'];return _0x388070[_0x41e2('0x2')](_0x41e2('0x3'),attributes,{'tableName':_0x41e2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3d02e7,_0x50b618,_0x433cff){return _0x1bce6d[_0x41e2('0x5')][_0x41e2('0x6')]({'value':_0x3d02e7[_0x41e2('0x7')]},{'where':{'field':_0x41e2('0x8'),'value':_0x3d02e7[_0x41e2('0x9')][_0x41e2('0x7')]}})[_0x41e2('0xa')](function(){_0x433cff();})[_0x41e2('0xb')](function(_0x5ed6c7){_0x433cff(_0x5ed6c7);});}}});}; \ No newline at end of file +var _0x86f1=['Condition','name','mailSubstatus','_previousDataValues','then','exports','models','define','MailSubstatus'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x86f1,0xf8));var _0x186f=function(_0x170d9c,_0x4c3a6c){_0x170d9c=_0x170d9c-0x0;var _0x1a985b=_0x86f1[_0x170d9c];return _0x1a985b;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x186f('0x0')]=function(_0x3e2d16){var _0x223542=_0x3e2d16[_0x186f('0x1')];return _0x3e2d16[_0x186f('0x2')](_0x186f('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x54a40c,_0x52fd7e,_0x3da5ae){return _0x223542[_0x186f('0x4')]['update']({'value':_0x54a40c[_0x186f('0x5')]},{'where':{'field':_0x186f('0x6'),'value':_0x54a40c[_0x186f('0x7')][_0x186f('0x5')]}})[_0x186f('0x8')](function(){_0x3da5ae();})['catch'](function(_0x1bffd2){_0x3da5ae(_0x1bffd2);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d15431c..189fe2b 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 _0x048f=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x048f,0xcd));var _0xf048=function(_0xac86be,_0x3fe5ed){_0xac86be=_0xac86be-0x0;var _0xc93c94=_0x048f[_0xac86be];return _0xc93c94;};'use strict';var _=require(_0xf048('0x0'));var util=require(_0xf048('0x1'));var moment=require(_0xf048('0x2'));var BPromise=require(_0xf048('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf048('0x4'))['db'];var utils=require(_0xf048('0x5'));var logger=require(_0xf048('0x6'))(_0xf048('0x7'));var config=require(_0xf048('0x8'));var jayson=require(_0xf048('0x9'));var client=jayson[_0xf048('0xa')][_0xf048('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf75b9a,_0x9605f6,_0x238e4b){return new BPromise(function(_0x3460fa,_0x57ac26){return client[_0xf048('0xc')](_0xf75b9a,_0x238e4b)['then'](function(_0x3faa04){logger[_0xf048('0xd')](_0xf048('0xe'),_0x9605f6,_0xf048('0xf'));logger[_0xf048('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x9605f6,'request\x20sent',JSON[_0xf048('0x11')](_0x3faa04));if(_0x3faa04[_0xf048('0x12')]){if(_0x3faa04[_0xf048('0x12')][_0xf048('0x13')]===0x1f4){logger['error'](_0xf048('0xe'),_0x9605f6,_0x3faa04['error'][_0xf048('0x14')]);return _0x57ac26(_0x3faa04[_0xf048('0x12')][_0xf048('0x14')]);}logger[_0xf048('0x12')](_0xf048('0xe'),_0x9605f6,_0x3faa04['error']['message']);return _0x3460fa(_0x3faa04['error'][_0xf048('0x14')]);}else{logger[_0xf048('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x9605f6,_0xf048('0xf'));_0x3460fa(_0x3faa04[_0xf048('0x15')][_0xf048('0x14')]);}})[_0xf048('0x16')](function(_0x14f59f){logger[_0xf048('0x12')](_0xf048('0xe'),_0x9605f6,_0x14f59f);_0x57ac26(_0x14f59f);});});} \ No newline at end of file +var _0xc232=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','moment'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0xc232,0x1ca));var _0x2c23=function(_0x1e63fa,_0x1acec2){_0x1e63fa=_0x1e63fa-0x0;var _0x44ece3=_0xc232[_0x1e63fa];return _0x44ece3;};'use strict';var _=require(_0x2c23('0x0'));var util=require('util');var moment=require(_0x2c23('0x1'));var BPromise=require(_0x2c23('0x2'));var rs=require(_0x2c23('0x3'));var fs=require('fs');var Redis=require(_0x2c23('0x4'));var db=require(_0x2c23('0x5'))['db'];var utils=require(_0x2c23('0x6'));var logger=require(_0x2c23('0x7'))(_0x2c23('0x8'));var config=require('../../config/environment');var jayson=require(_0x2c23('0x9'));var client=jayson[_0x2c23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ee8f,_0x1411d3,_0x46c670){return new BPromise(function(_0x3cf36f,_0x212811){return client['request'](_0x24ee8f,_0x46c670)[_0x2c23('0xb')](function(_0x1eea62){logger['info'](_0x2c23('0xc'),_0x1411d3,_0x2c23('0xd'));logger[_0x2c23('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1411d3,_0x2c23('0xd'),JSON['stringify'](_0x1eea62));if(_0x1eea62[_0x2c23('0xf')]){if(_0x1eea62[_0x2c23('0xf')]['code']===0x1f4){logger[_0x2c23('0xf')](_0x2c23('0xc'),_0x1411d3,_0x1eea62[_0x2c23('0xf')][_0x2c23('0x10')]);return _0x212811(_0x1eea62[_0x2c23('0xf')][_0x2c23('0x10')]);}logger[_0x2c23('0xf')](_0x2c23('0xc'),_0x1411d3,_0x1eea62[_0x2c23('0xf')][_0x2c23('0x10')]);return _0x3cf36f(_0x1eea62[_0x2c23('0xf')]['message']);}else{logger[_0x2c23('0x11')](_0x2c23('0xc'),_0x1411d3,_0x2c23('0xd'));_0x3cf36f(_0x1eea62[_0x2c23('0x12')][_0x2c23('0x10')]);}})[_0x2c23('0x13')](function(_0x1c6582){logger['error'](_0x2c23('0xc'),_0x1411d3,_0x1c6582);_0x212811(_0x1c6582);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index dc51393..3f9db6d 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 _0xff82=['destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','put','delete'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0xff82,0xac));var _0x2ff8=function(_0x466d15,_0x23574e){_0x466d15=_0x466d15-0x0;var _0x53fa1b=_0xff82[_0x466d15];return _0x53fa1b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2ff8('0x0'));var router=express[_0x2ff8('0x1')]();var fs_extra=require(_0x2ff8('0x2'));var auth=require(_0x2ff8('0x3'));var interaction=require(_0x2ff8('0x4'));var config=require('../../config/environment');var controller=require(_0x2ff8('0x5'));router[_0x2ff8('0x6')]('/',auth['isAuthenticated'](),controller[_0x2ff8('0x7')]);router[_0x2ff8('0x6')](_0x2ff8('0x8'),auth[_0x2ff8('0x9')](),controller[_0x2ff8('0xa')]);router[_0x2ff8('0x6')](_0x2ff8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2ff8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2ff8('0xd')](_0x2ff8('0xb'),auth[_0x2ff8('0x9')](),controller['update']);router[_0x2ff8('0xe')](_0x2ff8('0xb'),auth[_0x2ff8('0x9')](),controller[_0x2ff8('0xf')]);module[_0x2ff8('0x10')]=router; \ No newline at end of file +var _0x0850=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','describe','post','create','put','/:id','update'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x0850,0x193));var _0x0085=function(_0x5be327,_0x447811){_0x5be327=_0x5be327-0x0;var _0x53d1d4=_0x0850[_0x5be327];return _0x53d1d4;};'use strict';var multer=require(_0x0085('0x0'));var util=require(_0x0085('0x1'));var path=require(_0x0085('0x2'));var timeout=require(_0x0085('0x3'));var express=require(_0x0085('0x4'));var router=express[_0x0085('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0085('0x6'));var interaction=require(_0x0085('0x7'));var config=require('../../config/environment');var controller=require(_0x0085('0x8'));router[_0x0085('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0085('0x9')]('/describe',auth[_0x0085('0xa')](),controller[_0x0085('0xb')]);router[_0x0085('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0085('0xc')]('/',auth[_0x0085('0xa')](),controller[_0x0085('0xd')]);router[_0x0085('0xe')](_0x0085('0xf'),auth['isAuthenticated'](),controller[_0x0085('0x10')]);router[_0x0085('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0085('0x12')]);module[_0x0085('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 11e3202..5d92df9 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x129fb9,_0x1c4b10){_0x129fb9=_0x129fb9-0x0;var _0x423fec=_0x9bde[_0x129fb9];return _0x423fec;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4c5664,_0x170d12){var _0x380651=function(_0x3b3834){while(--_0x3b3834){_0x4c5664['push'](_0x4c5664['shift']());}};_0x380651(++_0x170d12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f4974fd..653c54a 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 _0x1043=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','describe','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','map','MailTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty'];(function(_0x4c2fdb,_0x34ca04){var _0x286660=function(_0x23650e){while(--_0x23650e){_0x4c2fdb['push'](_0x4c2fdb['shift']());}};_0x286660(++_0x34ca04);}(_0x1043,0xe9));var _0x3104=function(_0x1ce13a,_0x50b58c){_0x1ce13a=_0x1ce13a-0x0;var _0x3e2188=_0x1043[_0x1ce13a];return _0x3e2188;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3104('0x0'));var zipdir=require(_0x3104('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3104('0x2'));var Mustache=require(_0x3104('0x3'));var util=require('util');var path=require(_0x3104('0x4'));var sox=require('sox');var csv=require(_0x3104('0x5'));var ejs=require(_0x3104('0x6'));var fs=require('fs');var fs_extra=require(_0x3104('0x7'));var _=require(_0x3104('0x8'));var squel=require(_0x3104('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3104('0x5'));var querystring=require(_0x3104('0xa'));var Papa=require(_0x3104('0xb'));var Redis=require(_0x3104('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3104('0xd'));var as=require(_0x3104('0xe'));var hardwareService=require(_0x3104('0xf'));var logger=require(_0x3104('0x10'))(_0x3104('0x11'));var utils=require('../../config/utils');var config=require(_0x3104('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3104('0x13'))['db'];function respondWithStatusCode(_0x142b86,_0x42943f){_0x42943f=_0x42943f||0xcc;return function(_0x169307){if(_0x169307){return _0x142b86['sendStatus'](_0x42943f);}return _0x142b86[_0x3104('0x14')](_0x42943f)[_0x3104('0x15')]();};}function respondWithResult(_0x18c8ea,_0x5c478e){_0x5c478e=_0x5c478e||0xc8;return function(_0x112441){if(_0x112441){return _0x18c8ea[_0x3104('0x14')](_0x5c478e)['json'](_0x112441);}};}function respondWithFilteredResult(_0x26783e,_0x3209be){return function(_0x2029ed){if(_0x2029ed){var _0x591b23=typeof _0x3209be[_0x3104('0x16')]===_0x3104('0x17')&&typeof _0x3209be[_0x3104('0x18')]===_0x3104('0x17');var _0x4407d7=_0x2029ed['count'];var _0x11b986=_0x591b23?0x0:_0x3209be['offset'];var _0x1e3667=_0x591b23?_0x2029ed[_0x3104('0x19')]:_0x3209be[_0x3104('0x16')]+_0x3209be['limit'];var _0x29f99d;if(_0x1e3667>=_0x4407d7){_0x1e3667=_0x4407d7;_0x29f99d=0xc8;}else{_0x29f99d=0xce;}_0x26783e[_0x3104('0x14')](_0x29f99d);return _0x26783e[_0x3104('0x1a')]('Content-Range',_0x11b986+'-'+_0x1e3667+'/'+_0x4407d7)[_0x3104('0x1b')](_0x2029ed);}return null;};}function patchUpdates(_0x18e4be){return function(_0xcb981e){try{jsonpatch[_0x3104('0x1c')](_0xcb981e,_0x18e4be,!![]);}catch(_0x73d9f7){return BPromise[_0x3104('0x1d')](_0x73d9f7);}return _0xcb981e[_0x3104('0x1e')]();};}function saveUpdates(_0xccc789,_0x25ab69){return function(_0x1a9da3){if(_0x1a9da3){return _0x1a9da3[_0x3104('0x1f')](_0xccc789)[_0x3104('0x20')](function(_0x504f66){return _0x504f66;});}return null;};}function removeEntity(_0x450b09,_0x58a2c8){return function(_0x447a41){if(_0x447a41){return _0x447a41[_0x3104('0x21')]()[_0x3104('0x20')](function(){_0x450b09['status'](0xcc)[_0x3104('0x15')]();});}};}function handleEntityNotFound(_0x565bfd,_0x21cf0a){return function(_0x181e36){if(!_0x181e36){_0x565bfd['sendStatus'](0x194);}return _0x181e36;};}function handleError(_0x4deff0,_0x816616){_0x816616=_0x816616||0x1f4;return function(_0x36047a){logger[_0x3104('0x22')](_0x36047a[_0x3104('0x23')]);if(_0x36047a[_0x3104('0x24')]){delete _0x36047a['name'];}_0x4deff0['status'](_0x816616)['send'](_0x36047a);};}exports['index']=function(_0x2564c4,_0x33881d){var _0x14f5ba={},_0x1ebb61={},_0x17a289={'count':0x0,'rows':[]};var _0x16fad9=_[_0x3104('0x25')](db[_0x3104('0x26')][_0x3104('0x27')],function(_0x589dfd){return{'name':_0x589dfd[_0x3104('0x28')],'type':_0x589dfd[_0x3104('0x29')][_0x3104('0x2a')]};});_0x1ebb61['model']=_[_0x3104('0x25')](_0x16fad9,'name');_0x1ebb61['query']=_[_0x3104('0x2b')](_0x2564c4[_0x3104('0x2c')]);_0x1ebb61[_0x3104('0x2d')]=_[_0x3104('0x2e')](_0x1ebb61['model'],_0x1ebb61['query']);_0x14f5ba['attributes']=_[_0x3104('0x2e')](_0x1ebb61[_0x3104('0x2f')],qs[_0x3104('0x30')](_0x2564c4[_0x3104('0x2c')][_0x3104('0x30')]));_0x14f5ba[_0x3104('0x31')]=_0x14f5ba[_0x3104('0x31')]['length']?_0x14f5ba[_0x3104('0x31')]:_0x1ebb61[_0x3104('0x2f')];if(!_0x2564c4[_0x3104('0x2c')][_0x3104('0x32')]('nolimit')){_0x14f5ba[_0x3104('0x18')]=qs['limit'](_0x2564c4[_0x3104('0x2c')][_0x3104('0x18')]);_0x14f5ba[_0x3104('0x16')]=qs[_0x3104('0x16')](_0x2564c4[_0x3104('0x2c')][_0x3104('0x16')]);}_0x14f5ba[_0x3104('0x33')]=qs[_0x3104('0x34')](_0x2564c4['query'][_0x3104('0x34')]);_0x14f5ba[_0x3104('0x35')]=qs[_0x3104('0x2d')](_[_0x3104('0x36')](_0x2564c4[_0x3104('0x2c')],_0x1ebb61[_0x3104('0x2d')]),_0x16fad9);if(_0x2564c4[_0x3104('0x2c')][_0x3104('0x37')]){_0x14f5ba[_0x3104('0x35')]=_[_0x3104('0x38')](_0x14f5ba[_0x3104('0x35')],{'$or':_[_0x3104('0x25')](_0x16fad9,function(_0x5f3b46){if(_0x5f3b46[_0x3104('0x29')]!==_0x3104('0x39')){var _0x26c4ce={};_0x26c4ce[_0x5f3b46['name']]={'$like':'%'+_0x2564c4[_0x3104('0x2c')]['filter']+'%'};return _0x26c4ce;}})});}_0x14f5ba=_[_0x3104('0x38')]({},_0x14f5ba,_0x2564c4[_0x3104('0x3a')]);var _0x314575={'where':_0x14f5ba[_0x3104('0x35')]};return db[_0x3104('0x26')]['count'](_0x314575)[_0x3104('0x20')](function(_0x2fcc87){_0x17a289[_0x3104('0x19')]=_0x2fcc87;if(_0x2564c4[_0x3104('0x2c')][_0x3104('0x3b')]){_0x14f5ba['include']=[{'all':!![]}];}return db[_0x3104('0x26')][_0x3104('0x3c')](_0x14f5ba);})[_0x3104('0x20')](function(_0x17c526){_0x17a289[_0x3104('0x3d')]=_0x17c526;return _0x17a289;})['then'](respondWithFilteredResult(_0x33881d,_0x14f5ba))[_0x3104('0x3e')](handleError(_0x33881d,null));};exports[_0x3104('0x3f')]=function(_0x123414,_0x39e609){var _0x50addc={'raw':!![],'where':{'id':_0x123414['params']['id']}},_0x3390f6={};_0x3390f6[_0x3104('0x2f')]=_['keys'](db[_0x3104('0x26')][_0x3104('0x27')]);_0x3390f6[_0x3104('0x2c')]=_[_0x3104('0x2b')](_0x123414[_0x3104('0x2c')]);_0x3390f6[_0x3104('0x2d')]=_[_0x3104('0x2e')](_0x3390f6[_0x3104('0x2f')],_0x3390f6[_0x3104('0x2c')]);_0x50addc[_0x3104('0x31')]=_[_0x3104('0x2e')](_0x3390f6['model'],qs[_0x3104('0x30')](_0x123414['query'][_0x3104('0x30')]));_0x50addc[_0x3104('0x31')]=_0x50addc[_0x3104('0x31')][_0x3104('0x40')]?_0x50addc[_0x3104('0x31')]:_0x3390f6[_0x3104('0x2f')];if(_0x123414[_0x3104('0x2c')][_0x3104('0x3b')]){_0x50addc[_0x3104('0x41')]=[{'all':!![]}];}_0x50addc=_[_0x3104('0x38')]({},_0x50addc,_0x123414['options']);return db[_0x3104('0x26')][_0x3104('0x42')](_0x50addc)['then'](handleEntityNotFound(_0x39e609,null))[_0x3104('0x20')](respondWithResult(_0x39e609,null))[_0x3104('0x3e')](handleError(_0x39e609,null));};exports[_0x3104('0x43')]=function(_0x530ea2,_0x1c5438){return db[_0x3104('0x26')][_0x3104('0x43')](_0x530ea2[_0x3104('0x44')],{})[_0x3104('0x20')](respondWithResult(_0x1c5438,0xc9))['catch'](handleError(_0x1c5438,null));};exports['update']=function(_0x3f9ac0,_0x52420d){if(_0x3f9ac0[_0x3104('0x44')]['id']){delete _0x3f9ac0[_0x3104('0x44')]['id'];}return db['MailTransferReport'][_0x3104('0x42')]({'where':{'id':_0x3f9ac0[_0x3104('0x45')]['id']}})[_0x3104('0x20')](handleEntityNotFound(_0x52420d,null))['then'](saveUpdates(_0x3f9ac0['body'],null))[_0x3104('0x20')](respondWithResult(_0x52420d,null))[_0x3104('0x3e')](handleError(_0x52420d,null));};exports[_0x3104('0x21')]=function(_0x21e3e5,_0x4408c8){return db['MailTransferReport'][_0x3104('0x42')]({'where':{'id':_0x21e3e5['params']['id']}})['then'](handleEntityNotFound(_0x4408c8,null))[_0x3104('0x20')](removeEntity(_0x4408c8,null))[_0x3104('0x3e')](handleError(_0x4408c8,null));};exports[_0x3104('0x46')]=function(_0x2d05a8,_0x1dc99d){return db[_0x3104('0x26')][_0x3104('0x46')]()[_0x3104('0x20')](respondWithResult(_0x1dc99d,null))[_0x3104('0x3e')](handleError(_0x1dc99d,null));}; \ No newline at end of file +var _0x4020=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x1f914d,_0x2f24a5){var _0x5d37db=function(_0x5ce44b){while(--_0x5ce44b){_0x1f914d['push'](_0x1f914d['shift']());}};_0x5d37db(++_0x2f24a5);}(_0x4020,0x1dc));var _0x0402=function(_0x52adce,_0x5fe2fe){_0x52adce=_0x52adce-0x0;var _0x1d9490=_0x4020[_0x52adce];return _0x1d9490;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0402('0x0'));var zipdir=require(_0x0402('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0402('0x2'));var BPromise=require(_0x0402('0x3'));var Mustache=require(_0x0402('0x4'));var util=require('util');var path=require(_0x0402('0x5'));var sox=require(_0x0402('0x6'));var csv=require('to-csv');var ejs=require(_0x0402('0x7'));var fs=require('fs');var fs_extra=require(_0x0402('0x8'));var _=require(_0x0402('0x9'));var squel=require(_0x0402('0xa'));var crypto=require(_0x0402('0xb'));var jsforce=require(_0x0402('0xc'));var deskjs=require(_0x0402('0xd'));var toCsv=require(_0x0402('0xe'));var querystring=require(_0x0402('0xf'));var Papa=require(_0x0402('0x10'));var Redis=require('ioredis');var authService=require(_0x0402('0x11'));var qs=require(_0x0402('0x12'));var as=require(_0x0402('0x13'));var hardwareService=require(_0x0402('0x14'));var logger=require(_0x0402('0x15'))(_0x0402('0x16'));var utils=require(_0x0402('0x17'));var config=require(_0x0402('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0402('0x19'))['db'];function respondWithStatusCode(_0x13d91e,_0x23eea3){_0x23eea3=_0x23eea3||0xcc;return function(_0x459a43){if(_0x459a43){return _0x13d91e[_0x0402('0x1a')](_0x23eea3);}return _0x13d91e['status'](_0x23eea3)['end']();};}function respondWithResult(_0x339ad4,_0x5648b6){_0x5648b6=_0x5648b6||0xc8;return function(_0x1dc64b){if(_0x1dc64b){return _0x339ad4[_0x0402('0x1b')](_0x5648b6)[_0x0402('0x1c')](_0x1dc64b);}};}function respondWithFilteredResult(_0x33f43b,_0x15075e){return function(_0x352ff5){if(_0x352ff5){var _0x83cbab=typeof _0x15075e[_0x0402('0x1d')]===_0x0402('0x1e')&&typeof _0x15075e[_0x0402('0x1f')]===_0x0402('0x1e');var _0x41498c=_0x352ff5[_0x0402('0x20')];var _0x18ef1e=_0x83cbab?0x0:_0x15075e['offset'];var _0x2ec566=_0x83cbab?_0x352ff5[_0x0402('0x20')]:_0x15075e[_0x0402('0x1d')]+_0x15075e[_0x0402('0x1f')];var _0x2cae65;if(_0x2ec566>=_0x41498c){_0x2ec566=_0x41498c;_0x2cae65=0xc8;}else{_0x2cae65=0xce;}_0x33f43b[_0x0402('0x1b')](_0x2cae65);return _0x33f43b[_0x0402('0x21')](_0x0402('0x22'),_0x18ef1e+'-'+_0x2ec566+'/'+_0x41498c)['json'](_0x352ff5);}return null;};}function patchUpdates(_0x4beb5b){return function(_0x8b2642){try{jsonpatch[_0x0402('0x23')](_0x8b2642,_0x4beb5b,!![]);}catch(_0x5d87dd){return BPromise['reject'](_0x5d87dd);}return _0x8b2642[_0x0402('0x24')]();};}function saveUpdates(_0x535c51,_0xd32d40){return function(_0x15e451){if(_0x15e451){return _0x15e451[_0x0402('0x25')](_0x535c51)[_0x0402('0x26')](function(_0x2a9fd5){return _0x2a9fd5;});}return null;};}function removeEntity(_0x3f4edb,_0xe209ab){return function(_0x25cc7e){if(_0x25cc7e){return _0x25cc7e[_0x0402('0x27')]()[_0x0402('0x26')](function(){_0x3f4edb[_0x0402('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a34b0,_0x2e7014){return function(_0x1bc5b6){if(!_0x1bc5b6){_0x4a34b0[_0x0402('0x1a')](0x194);}return _0x1bc5b6;};}function handleError(_0x48f27a,_0x5321e7){_0x5321e7=_0x5321e7||0x1f4;return function(_0x375ae1){logger['error'](_0x375ae1[_0x0402('0x28')]);if(_0x375ae1[_0x0402('0x29')]){delete _0x375ae1[_0x0402('0x29')];}_0x48f27a[_0x0402('0x1b')](_0x5321e7)[_0x0402('0x2a')](_0x375ae1);};}exports['index']=function(_0x157161,_0x325c73){var _0x598579={},_0x1cd78d={},_0x555c43={'count':0x0,'rows':[]};var _0x2a3f78=_[_0x0402('0x2b')](db[_0x0402('0x2c')][_0x0402('0x2d')],function(_0x15909b){return{'name':_0x15909b[_0x0402('0x2e')],'type':_0x15909b[_0x0402('0x2f')][_0x0402('0x30')]};});_0x1cd78d[_0x0402('0x31')]=_[_0x0402('0x2b')](_0x2a3f78,_0x0402('0x29'));_0x1cd78d[_0x0402('0x32')]=_[_0x0402('0x33')](_0x157161[_0x0402('0x32')]);_0x1cd78d[_0x0402('0x34')]=_['intersection'](_0x1cd78d[_0x0402('0x31')],_0x1cd78d[_0x0402('0x32')]);_0x598579[_0x0402('0x35')]=_[_0x0402('0x36')](_0x1cd78d['model'],qs[_0x0402('0x37')](_0x157161[_0x0402('0x32')][_0x0402('0x37')]));_0x598579[_0x0402('0x35')]=_0x598579[_0x0402('0x35')][_0x0402('0x38')]?_0x598579['attributes']:_0x1cd78d[_0x0402('0x31')];if(!_0x157161['query'][_0x0402('0x39')](_0x0402('0x3a'))){_0x598579[_0x0402('0x1f')]=qs['limit'](_0x157161[_0x0402('0x32')]['limit']);_0x598579[_0x0402('0x1d')]=qs[_0x0402('0x1d')](_0x157161['query'][_0x0402('0x1d')]);}_0x598579[_0x0402('0x3b')]=qs[_0x0402('0x3c')](_0x157161[_0x0402('0x32')][_0x0402('0x3c')]);_0x598579[_0x0402('0x3d')]=qs[_0x0402('0x34')](_[_0x0402('0x3e')](_0x157161[_0x0402('0x32')],_0x1cd78d[_0x0402('0x34')]),_0x2a3f78);if(_0x157161['query'][_0x0402('0x3f')]){_0x598579[_0x0402('0x3d')]=_[_0x0402('0x40')](_0x598579['where'],{'$or':_[_0x0402('0x2b')](_0x2a3f78,function(_0xe31524){if(_0xe31524[_0x0402('0x2f')]!==_0x0402('0x41')){var _0xa5b5d7={};_0xa5b5d7[_0xe31524['name']]={'$like':'%'+_0x157161[_0x0402('0x32')][_0x0402('0x3f')]+'%'};return _0xa5b5d7;}})});}_0x598579=_[_0x0402('0x40')]({},_0x598579,_0x157161[_0x0402('0x42')]);var _0x504f51={'where':_0x598579[_0x0402('0x3d')]};return db['MailTransferReport'][_0x0402('0x20')](_0x504f51)[_0x0402('0x26')](function(_0x36f363){_0x555c43['count']=_0x36f363;if(_0x157161['query'][_0x0402('0x43')]){_0x598579['include']=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x598579);})[_0x0402('0x26')](function(_0x5de426){_0x555c43[_0x0402('0x44')]=_0x5de426;return _0x555c43;})[_0x0402('0x26')](respondWithFilteredResult(_0x325c73,_0x598579))[_0x0402('0x45')](handleError(_0x325c73,null));};exports['show']=function(_0xedbd12,_0x2f7ef1){var _0x3a751f={'raw':!![],'where':{'id':_0xedbd12[_0x0402('0x46')]['id']}},_0x7c0c25={};_0x7c0c25['model']=_[_0x0402('0x33')](db[_0x0402('0x2c')][_0x0402('0x2d')]);_0x7c0c25[_0x0402('0x32')]=_['keys'](_0xedbd12['query']);_0x7c0c25[_0x0402('0x34')]=_['intersection'](_0x7c0c25[_0x0402('0x31')],_0x7c0c25[_0x0402('0x32')]);_0x3a751f[_0x0402('0x35')]=_[_0x0402('0x36')](_0x7c0c25[_0x0402('0x31')],qs[_0x0402('0x37')](_0xedbd12[_0x0402('0x32')]['fields']));_0x3a751f[_0x0402('0x35')]=_0x3a751f[_0x0402('0x35')][_0x0402('0x38')]?_0x3a751f[_0x0402('0x35')]:_0x7c0c25['model'];if(_0xedbd12[_0x0402('0x32')][_0x0402('0x43')]){_0x3a751f[_0x0402('0x47')]=[{'all':!![]}];}_0x3a751f=_[_0x0402('0x40')]({},_0x3a751f,_0xedbd12[_0x0402('0x42')]);return db[_0x0402('0x2c')][_0x0402('0x48')](_0x3a751f)['then'](handleEntityNotFound(_0x2f7ef1,null))[_0x0402('0x26')](respondWithResult(_0x2f7ef1,null))['catch'](handleError(_0x2f7ef1,null));};exports[_0x0402('0x49')]=function(_0xb9d497,_0x2db12a){return db[_0x0402('0x2c')]['create'](_0xb9d497[_0x0402('0x4a')],{})[_0x0402('0x26')](respondWithResult(_0x2db12a,0xc9))['catch'](handleError(_0x2db12a,null));};exports[_0x0402('0x25')]=function(_0x47a7f3,_0x50c98a){if(_0x47a7f3['body']['id']){delete _0x47a7f3['body']['id'];}return db[_0x0402('0x2c')]['find']({'where':{'id':_0x47a7f3[_0x0402('0x46')]['id']}})[_0x0402('0x26')](handleEntityNotFound(_0x50c98a,null))[_0x0402('0x26')](saveUpdates(_0x47a7f3[_0x0402('0x4a')],null))['then'](respondWithResult(_0x50c98a,null))['catch'](handleError(_0x50c98a,null));};exports[_0x0402('0x27')]=function(_0x4bf6f4,_0x303f9a){return db['MailTransferReport'][_0x0402('0x48')]({'where':{'id':_0x4bf6f4[_0x0402('0x46')]['id']}})[_0x0402('0x26')](handleEntityNotFound(_0x303f9a,null))[_0x0402('0x26')](removeEntity(_0x303f9a,null))[_0x0402('0x45')](handleError(_0x303f9a,null));};exports[_0x0402('0x4b')]=function(_0x280056,_0x9626e8){return db['MailTransferReport'][_0x0402('0x4b')]()['then'](respondWithResult(_0x9626e8,null))[_0x0402('0x45')](handleError(_0x9626e8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c39afc3..55adbf3 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 _0x2c79=['path','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','bluebird'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x2c79,0x164));var _0x92c7=function(_0x3e6607,_0x159582){_0x3e6607=_0x3e6607-0x0;var _0x551311=_0x2c79[_0x3e6607];return _0x551311;};'use strict';var _=require(_0x92c7('0x0'));var util=require('util');var logger=require(_0x92c7('0x1'))(_0x92c7('0x2'));var moment=require('moment');var BPromise=require(_0x92c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92c7('0x4'));var rimraf=require('rimraf');var config=require(_0x92c7('0x5'));var attributes=require(_0x92c7('0x6'));module['exports']=function(_0x42a70d,_0x4d2d3a){return _0x42a70d[_0x92c7('0x7')](_0x92c7('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x92c7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad36=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xad36,0x11c));var _0x6ad3=function(_0x5d5349,_0x3fa22e){_0x5d5349=_0x5d5349-0x0;var _0x3443c8=_0xad36[_0x5d5349];return _0x3443c8;};'use strict';var _=require('lodash');var util=require(_0x6ad3('0x0'));var logger=require(_0x6ad3('0x1'))(_0x6ad3('0x2'));var moment=require(_0x6ad3('0x3'));var BPromise=require(_0x6ad3('0x4'));var rp=require(_0x6ad3('0x5'));var fs=require('fs');var path=require(_0x6ad3('0x6'));var rimraf=require(_0x6ad3('0x7'));var config=require(_0x6ad3('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x6ad3('0x9')]=function(_0x3d669f,_0x3c3041){return _0x3d669f[_0x6ad3('0xa')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index bec6f59..c767ab6 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 _0xdad3=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x51ccc1,_0x177280){var _0x103c4b=function(_0x306c51){while(--_0x306c51){_0x51ccc1['push'](_0x51ccc1['shift']());}};_0x103c4b(++_0x177280);}(_0xdad3,0x17e));var _0x3dad=function(_0x47bdce,_0x728379){_0x47bdce=_0x47bdce-0x0;var _0x3d5aa5=_0xdad3[_0x47bdce];return _0x3d5aa5;};'use strict';var _=require(_0x3dad('0x0'));var util=require(_0x3dad('0x1'));var moment=require(_0x3dad('0x2'));var BPromise=require(_0x3dad('0x3'));var rs=require(_0x3dad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dad('0x5'))['db'];var utils=require(_0x3dad('0x6'));var logger=require('../../config/logger')(_0x3dad('0x7'));var config=require('../../config/environment');var jayson=require(_0x3dad('0x8'));var client=jayson[_0x3dad('0x9')][_0x3dad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x246d4e,_0x357411,_0x1a9ff2){return new BPromise(function(_0x4aa404,_0x129aaf){return client[_0x3dad('0xb')](_0x246d4e,_0x1a9ff2)[_0x3dad('0xc')](function(_0x538471){logger['info'](_0x3dad('0xd'),_0x357411,_0x3dad('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x357411,_0x3dad('0xe'),JSON[_0x3dad('0xf')](_0x538471));if(_0x538471[_0x3dad('0x10')]){if(_0x538471[_0x3dad('0x10')][_0x3dad('0x11')]===0x1f4){logger['error'](_0x3dad('0xd'),_0x357411,_0x538471[_0x3dad('0x10')][_0x3dad('0x12')]);return _0x129aaf(_0x538471[_0x3dad('0x10')][_0x3dad('0x12')]);}logger[_0x3dad('0x10')](_0x3dad('0xd'),_0x357411,_0x538471['error'][_0x3dad('0x12')]);return _0x4aa404(_0x538471[_0x3dad('0x10')]['message']);}else{logger[_0x3dad('0x13')](_0x3dad('0xd'),_0x357411,_0x3dad('0xe'));_0x4aa404(_0x538471[_0x3dad('0x14')][_0x3dad('0x12')]);}})[_0x3dad('0x15')](function(_0x3bfd1b){logger[_0x3dad('0x10')](_0x3dad('0xd'),_0x357411,_0x3bfd1b);_0x129aaf(_0x3bfd1b);});});} \ No newline at end of file +var _0x8259=['MailTransferReport,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3990d9,_0x2816f5){var _0x3bc2ab=function(_0x44dc08){while(--_0x44dc08){_0x3990d9['push'](_0x3990d9['shift']());}};_0x3bc2ab(++_0x2816f5);}(_0x8259,0xd5));var _0x9825=function(_0xfc8a45,_0x4af05d){_0xfc8a45=_0xfc8a45-0x0;var _0x18fd52=_0x8259[_0xfc8a45];return _0x18fd52;};'use strict';var _=require('lodash');var util=require(_0x9825('0x0'));var moment=require('moment');var BPromise=require(_0x9825('0x1'));var rs=require(_0x9825('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9825('0x3'));var logger=require(_0x9825('0x4'))(_0x9825('0x5'));var config=require(_0x9825('0x6'));var jayson=require(_0x9825('0x7'));var client=jayson['client'][_0x9825('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d8757,_0x30d1b1,_0x96884e){return new BPromise(function(_0x9ea8e0,_0x24ffc2){return client[_0x9825('0x9')](_0x1d8757,_0x96884e)[_0x9825('0xa')](function(_0x29ef93){logger[_0x9825('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x30d1b1,'request\x20sent');logger[_0x9825('0xc')](_0x9825('0xd'),_0x30d1b1,_0x9825('0xe'),JSON[_0x9825('0xf')](_0x29ef93));if(_0x29ef93[_0x9825('0x10')]){if(_0x29ef93['error'][_0x9825('0x11')]===0x1f4){logger[_0x9825('0x10')](_0x9825('0x12'),_0x30d1b1,_0x29ef93['error']['message']);return _0x24ffc2(_0x29ef93[_0x9825('0x10')][_0x9825('0x13')]);}logger[_0x9825('0x10')](_0x9825('0x12'),_0x30d1b1,_0x29ef93[_0x9825('0x10')]['message']);return _0x9ea8e0(_0x29ef93[_0x9825('0x10')][_0x9825('0x13')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x30d1b1,_0x9825('0xe'));_0x9ea8e0(_0x29ef93['result']['message']);}})[_0x9825('0x14')](function(_0x32cf9f){logger[_0x9825('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x30d1b1,_0x32cf9f);_0x24ffc2(_0x32cf9f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b40f66c..8bf5eb2 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 _0xa270=['get','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index'];(function(_0x4e26d9,_0xde73d8){var _0x18825a=function(_0x383eba){while(--_0x383eba){_0x4e26d9['push'](_0x4e26d9['shift']());}};_0x18825a(++_0xde73d8);}(_0xa270,0x18f));var _0x0a27=function(_0x20e8b0,_0x34f383){_0x20e8b0=_0x20e8b0-0x0;var _0x352003=_0xa270[_0x20e8b0];return _0x352003;};'use strict';var multer=require(_0x0a27('0x0'));var util=require(_0x0a27('0x1'));var path=require('path');var timeout=require(_0x0a27('0x2'));var express=require(_0x0a27('0x3'));var router=express[_0x0a27('0x4')]();var fs_extra=require(_0x0a27('0x5'));var auth=require(_0x0a27('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0a27('0x7'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0a27('0x8')]);router[_0x0a27('0x9')]('/describe',auth[_0x0a27('0xa')](),controller['describe']);router[_0x0a27('0x9')]('/:id',auth[_0x0a27('0xa')](),controller['show']);router['post']('/',auth[_0x0a27('0xa')](),controller[_0x0a27('0xb')]);router[_0x0a27('0xc')](_0x0a27('0xd'),auth[_0x0a27('0xa')](),controller[_0x0a27('0xe')]);router[_0x0a27('0xf')](_0x0a27('0xd'),auth[_0x0a27('0xa')](),controller[_0x0a27('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb898=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e5069,_0x3a1115){var _0x2f00ad=function(_0x3cba4f){while(--_0x3cba4f){_0x2e5069['push'](_0x2e5069['shift']());}};_0x2f00ad(++_0x3a1115);}(_0xb898,0x1db));var _0x8b89=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xb898[_0x249d99];return _0x5bfb05;};'use strict';var multer=require(_0x8b89('0x0'));var util=require(_0x8b89('0x1'));var path=require(_0x8b89('0x2'));var timeout=require(_0x8b89('0x3'));var express=require(_0x8b89('0x4'));var router=express[_0x8b89('0x5')]();var fs_extra=require(_0x8b89('0x6'));var auth=require(_0x8b89('0x7'));var interaction=require(_0x8b89('0x8'));var config=require(_0x8b89('0x9'));var controller=require(_0x8b89('0xa'));router[_0x8b89('0xb')]('/',auth[_0x8b89('0xc')](),controller[_0x8b89('0xd')]);router[_0x8b89('0xb')](_0x8b89('0xe'),auth[_0x8b89('0xc')](),controller[_0x8b89('0xf')]);router[_0x8b89('0xb')](_0x8b89('0x10'),auth[_0x8b89('0xc')](),controller[_0x8b89('0x11')]);router[_0x8b89('0x12')]('/',auth[_0x8b89('0xc')](),controller[_0x8b89('0x13')]);router['put'](_0x8b89('0x10'),auth[_0x8b89('0xc')](),controller[_0x8b89('0x14')]);router[_0x8b89('0x15')](_0x8b89('0x10'),auth[_0x8b89('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 72fa5cf..a777d5e 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 _0xaca4=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xaca4,0x135));var _0x4aca=function(_0x5717ac,_0xbb31e7){_0x5717ac=_0x5717ac-0x0;var _0xfcf5e=_0xaca4[_0x5717ac];return _0xfcf5e;};'use strict';var Sequelize=require(_0x4aca('0x0'));var moment=require('moment');module[_0x4aca('0x1')]={'channel':{'type':Sequelize[_0x4aca('0x2')]},'membername':{'type':Sequelize[_0x4aca('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4aca('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x4aca('0x3')},'duration':{'type':Sequelize[_0x4aca('0x4')]},'enterAt':{'type':Sequelize[_0x4aca('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x2bbd25){var _0x47c71a=moment(_0x2bbd25);var _0x54e558=moment(this[_0x4aca('0x6')](_0x4aca('0x7')));var _0x5a4974=_0x47c71a['diff'](_0x54e558,_0x4aca('0x8'));this[_0x4aca('0x9')](_0x4aca('0xa'),_0x2bbd25);this['setDataValue'](_0x4aca('0xb'),_0x5a4974>=0x0?_0x5a4974:null);}},'data1':{'type':Sequelize[_0x4aca('0x2')],'comment':_0x4aca('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x4aca('0xd')},'data3':{'type':Sequelize[_0x4aca('0x2')],'comment':_0x4aca('0xe')},'data4':{'type':Sequelize[_0x4aca('0x2')],'comment':_0x4aca('0xf')},'data5':{'type':Sequelize[_0x4aca('0x2')],'comment':_0x4aca('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x4aca('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb950=['enterAt','diff','seconds','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4fb061,_0x5c61f5){var _0x29e0df=function(_0x160130){while(--_0x160130){_0x4fb061['push'](_0x4fb061['shift']());}};_0x29e0df(++_0x5c61f5);}(_0xb950,0xa9));var _0x0b95=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb950[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0b95('0x0'));module[_0x0b95('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0b95('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x0b95('0x3'),'comment':_0x0b95('0x4')},'duration':{'type':Sequelize[_0x0b95('0x5')]},'enterAt':{'type':Sequelize[_0x0b95('0x6')]},'exitAt':{'type':Sequelize[_0x0b95('0x6')],'set':function(_0x3c68c7){var _0x26cc64=moment(_0x3c68c7);var _0x4ecdfe=moment(this['getDataValue'](_0x0b95('0x7')));var _0x4bf8e5=_0x26cc64[_0x0b95('0x8')](_0x4ecdfe,_0x0b95('0x9'));this['setDataValue']('exitAt',_0x3c68c7);this[_0x0b95('0xa')](_0x0b95('0xb'),_0x4bf8e5>=0x0?_0x4bf8e5:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x0b95('0x2')],'comment':_0x0b95('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0x0b95('0xd')},'data4':{'type':Sequelize[_0x0b95('0x2')],'comment':_0x0b95('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x0b95('0xf')},'role':{'type':Sequelize[_0x0b95('0x2')]},'internal':{'type':Sequelize[_0x0b95('0x5')]},'uniqueid':{'type':Sequelize[_0x0b95('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 590af3d..688e426 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x55ca,0x126));var _0xa55c=function(_0xbf19d7,_0x58b2bf){_0xbf19d7=_0xbf19d7-0x0;var _0x376e11=_0x55ca[_0xbf19d7];return _0x376e11;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +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(_0x1293fa,_0x446d6b){var _0x1dd054=function(_0x1b2d93){while(--_0x1b2d93){_0x1293fa['push'](_0x1293fa['shift']());}};_0x1dd054(++_0x446d6b);}(_0x008c,0x188));var _0xc008=function(_0x39782f,_0x4aa931){_0x39782f=_0x39782f-0x0;var _0x47768c=_0x008c[_0x39782f];return _0x47768c;};'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 8e68b02..eda324d 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 _0x37a7=['interface','lodash','util','bluebird','request-promise','./memberReport.attributes','exports','define','report_member','membername_interface','membername'];(function(_0x9924e5,_0x30183c){var _0x507b75=function(_0x1b7a00){while(--_0x1b7a00){_0x9924e5['push'](_0x9924e5['shift']());}};_0x507b75(++_0x30183c);}(_0x37a7,0x6f));var _0x737a=function(_0x26b6c4,_0x352500){_0x26b6c4=_0x26b6c4-0x0;var _0x31f3bb=_0x37a7[_0x26b6c4];return _0x31f3bb;};'use strict';var _=require(_0x737a('0x0'));var util=require(_0x737a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x737a('0x2'));var rp=require(_0x737a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x737a('0x4'));module[_0x737a('0x5')]=function(_0x7f4eed,_0x11109c){return _0x7f4eed[_0x737a('0x6')]('MemberReport',attributes,{'tableName':_0x737a('0x7'),'paranoid':![],'indexes':[{'name':_0x737a('0x8'),'fields':[_0x737a('0x9'),_0x737a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d07=['./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','path','rimraf','../../config/environment'];(function(_0x6923ea,_0x4b5785){var _0x37b5d1=function(_0x3dd161){while(--_0x3dd161){_0x6923ea['push'](_0x6923ea['shift']());}};_0x37b5d1(++_0x4b5785);}(_0x4d07,0x18e));var _0x74d0=function(_0x9586c7,_0x5abe16){_0x9586c7=_0x9586c7-0x0;var _0x268ad0=_0x4d07[_0x9586c7];return _0x268ad0;};'use strict';var _=require(_0x74d0('0x0'));var util=require('util');var logger=require(_0x74d0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x74d0('0x2'));var rimraf=require(_0x74d0('0x3'));var config=require(_0x74d0('0x4'));var attributes=require(_0x74d0('0x5'));module[_0x74d0('0x6')]=function(_0x32e893,_0x2d3541){return _0x32e893[_0x74d0('0x7')](_0x74d0('0x8'),attributes,{'tableName':_0x74d0('0x9'),'paranoid':![],'indexes':[{'name':_0x74d0('0xa'),'fields':[_0x74d0('0xb'),_0x74d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5787fd5..0e5864c 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 _0x21b7=['GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','debug','CreateMemberReport','create','body','UpdateMemberReport','update','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x21b7,0xef));var _0x721b=function(_0x22fb7d,_0x598ff0){_0x22fb7d=_0x22fb7d-0x0;var _0x426e34=_0x21b7[_0x22fb7d];return _0x426e34;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x721b('0x0'));var rs=require(_0x721b('0x1'));var fs=require('fs');var Redis=require(_0x721b('0x2'));var db=require(_0x721b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x721b('0x4'));var config=require(_0x721b('0x5'));var jayson=require(_0x721b('0x6'));var client=jayson[_0x721b('0x7')][_0x721b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x470ee0,_0x5aeb49,_0x45ca24){return new BPromise(function(_0x2c4096,_0x47b1ff){return client['request'](_0x470ee0,_0x45ca24)[_0x721b('0x9')](function(_0x1bfe2d){logger[_0x721b('0xa')](_0x721b('0xb'),_0x5aeb49,_0x721b('0xc'));logger['debug'](_0x721b('0xd'),_0x5aeb49,_0x721b('0xc'),JSON[_0x721b('0xe')](_0x1bfe2d));if(_0x1bfe2d[_0x721b('0xf')]){if(_0x1bfe2d[_0x721b('0xf')][_0x721b('0x10')]===0x1f4){logger[_0x721b('0xf')]('MemberReport,\x20%s,\x20%s',_0x5aeb49,_0x1bfe2d['error'][_0x721b('0x11')]);return _0x47b1ff(_0x1bfe2d['error'][_0x721b('0x11')]);}logger[_0x721b('0xf')]('MemberReport,\x20%s,\x20%s',_0x5aeb49,_0x1bfe2d['error'][_0x721b('0x11')]);return _0x2c4096(_0x1bfe2d[_0x721b('0xf')][_0x721b('0x11')]);}else{logger[_0x721b('0xa')](_0x721b('0xb'),_0x5aeb49,_0x721b('0xc'));_0x2c4096(_0x1bfe2d[_0x721b('0x12')][_0x721b('0x11')]);}})[_0x721b('0x13')](function(_0x3e6214){logger[_0x721b('0xf')](_0x721b('0xb'),_0x5aeb49,_0x3e6214);_0x47b1ff(_0x3e6214);});});}exports[_0x721b('0x14')]=function(_0x3f76af){var _0x4e2d24=this;return new Promise(function(_0x81745a,_0x1eca0d){return db[_0x721b('0x15')][_0x721b('0x16')]({'raw':_0x3f76af[_0x721b('0x17')]?_0x3f76af[_0x721b('0x17')][_0x721b('0x18')]===undefined?!![]:![]:!![],'where':_0x3f76af['options']?_0x3f76af[_0x721b('0x17')][_0x721b('0x19')]||null:null,'attributes':_0x3f76af[_0x721b('0x17')]?_0x3f76af[_0x721b('0x17')][_0x721b('0x1a')]||null:null,'limit':_0x3f76af[_0x721b('0x17')]?_0x3f76af[_0x721b('0x17')][_0x721b('0x1b')]||null:null,'include':_0x3f76af[_0x721b('0x17')]?_0x3f76af[_0x721b('0x17')]['include']?_[_0x721b('0x1c')](_0x3f76af[_0x721b('0x17')][_0x721b('0x1d')],function(_0x4e7d37){return{'model':db[_0x4e7d37['model']],'as':_0x4e7d37['as'],'attributes':_0x4e7d37[_0x721b('0x1a')],'include':_0x4e7d37[_0x721b('0x1d')]?_[_0x721b('0x1c')](_0x4e7d37[_0x721b('0x1d')],function(_0x20da5f){return{'model':db[_0x20da5f[_0x721b('0x1e')]],'as':_0x20da5f['as'],'attributes':_0x20da5f['attributes'],'include':_0x20da5f[_0x721b('0x1d')]?_[_0x721b('0x1c')](_0x20da5f['include'],function(_0x1fb2fc){return{'model':db[_0x1fb2fc[_0x721b('0x1e')]],'as':_0x1fb2fc['as'],'attributes':_0x1fb2fc[_0x721b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b1610){logger['info'](_0x721b('0x14'),_0x3f76af);logger[_0x721b('0x1f')](_0x721b('0x14'),_0x3f76af,JSON['stringify'](_0x3b1610));_0x81745a(_0x3b1610);})[_0x721b('0x13')](function(_0x383077){logger[_0x721b('0xf')]('GetMemberReport',_0x383077[_0x721b('0x11')],_0x3f76af);_0x1eca0d(_0x4e2d24['error'](0x1f4,_0x383077[_0x721b('0x11')]));});});};exports[_0x721b('0x20')]=function(_0x5c7c71){var _0x7451ad=this;return new Promise(function(_0x39cb7c,_0x1d9e1f){return db['MemberReport'][_0x721b('0x21')](_0x5c7c71[_0x721b('0x22')],{'raw':_0x5c7c71[_0x721b('0x17')]?_0x5c7c71['options'][_0x721b('0x18')]===undefined?!![]:![]:!![]})[_0x721b('0x9')](function(_0x24e37a){logger[_0x721b('0xa')]('CreateMemberReport',_0x5c7c71);logger[_0x721b('0x1f')](_0x721b('0x20'),_0x5c7c71,JSON[_0x721b('0xe')](_0x24e37a));_0x39cb7c(_0x24e37a);})[_0x721b('0x13')](function(_0x17b2a1){logger[_0x721b('0xf')](_0x721b('0x20'),_0x17b2a1[_0x721b('0x11')],_0x5c7c71);_0x1d9e1f(_0x7451ad[_0x721b('0xf')](0x1f4,_0x17b2a1[_0x721b('0x11')]));});});};exports[_0x721b('0x23')]=function(_0x22f129){var _0x1e44fc=this;return new Promise(function(_0x3c696a,_0x3a3b55){return db[_0x721b('0x15')][_0x721b('0x24')](_0x22f129[_0x721b('0x22')],{'raw':_0x22f129[_0x721b('0x17')]?_0x22f129[_0x721b('0x17')][_0x721b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22f129[_0x721b('0x17')]?_0x22f129['options'][_0x721b('0x19')]||null:null,'attributes':_0x22f129[_0x721b('0x17')]?_0x22f129[_0x721b('0x17')][_0x721b('0x1a')]||null:null,'limit':_0x22f129[_0x721b('0x17')]?_0x22f129[_0x721b('0x17')][_0x721b('0x1b')]||null:null})[_0x721b('0x9')](function(_0x14ff20){logger[_0x721b('0xa')](_0x721b('0x23'),_0x22f129);logger[_0x721b('0x1f')](_0x721b('0x23'),_0x22f129,JSON[_0x721b('0xe')](_0x14ff20));_0x3c696a(_0x14ff20);})[_0x721b('0x13')](function(_0x39fb56){logger[_0x721b('0xf')](_0x721b('0x23'),_0x39fb56[_0x721b('0x11')],_0x22f129);_0x3a3b55(_0x1e44fc['error'](0x1f4,_0x39fb56['message']));});});}; \ No newline at end of file +var _0xd819=['info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMemberReport','options','raw','where','attributes','limit','include','map','model','stringify','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0xc65be9,_0x11c689){var _0x559622=function(_0x2ef999){while(--_0x2ef999){_0xc65be9['push'](_0xc65be9['shift']());}};_0x559622(++_0x11c689);}(_0xd819,0x181));var _0x9d81=function(_0x4e29f1,_0x3da155){_0x4e29f1=_0x4e29f1-0x0;var _0x4bc72f=_0xd819[_0x4e29f1];return _0x4bc72f;};'use strict';var _=require('lodash');var util=require(_0x9d81('0x0'));var moment=require(_0x9d81('0x1'));var BPromise=require(_0x9d81('0x2'));var rs=require(_0x9d81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d81('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d81('0x5'))('rpc');var config=require(_0x9d81('0x6'));var jayson=require(_0x9d81('0x7'));var client=jayson[_0x9d81('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfc583e,_0x28ab9c,_0x1be93f){return new BPromise(function(_0x1e1329,_0x2bdd23){return client[_0x9d81('0x9')](_0xfc583e,_0x1be93f)[_0x9d81('0xa')](function(_0x21e4f7){logger[_0x9d81('0xb')](_0x9d81('0xc'),_0x28ab9c,_0x9d81('0xd'));logger[_0x9d81('0xe')](_0x9d81('0xf'),_0x28ab9c,_0x9d81('0xd'),JSON['stringify'](_0x21e4f7));if(_0x21e4f7[_0x9d81('0x10')]){if(_0x21e4f7[_0x9d81('0x10')]['code']===0x1f4){logger[_0x9d81('0x10')](_0x9d81('0xc'),_0x28ab9c,_0x21e4f7[_0x9d81('0x10')][_0x9d81('0x11')]);return _0x2bdd23(_0x21e4f7['error'][_0x9d81('0x11')]);}logger['error'](_0x9d81('0xc'),_0x28ab9c,_0x21e4f7['error'][_0x9d81('0x11')]);return _0x1e1329(_0x21e4f7[_0x9d81('0x10')]['message']);}else{logger[_0x9d81('0xb')](_0x9d81('0xc'),_0x28ab9c,_0x9d81('0xd'));_0x1e1329(_0x21e4f7[_0x9d81('0x12')][_0x9d81('0x11')]);}})[_0x9d81('0x13')](function(_0x446994){logger[_0x9d81('0x10')]('MemberReport,\x20%s,\x20%s',_0x28ab9c,_0x446994);_0x2bdd23(_0x446994);});});}exports[_0x9d81('0x14')]=function(_0x1bb0d7){var _0x3309c3=this;return new Promise(function(_0x406588,_0x3fd093){return db['MemberReport']['findAll']({'raw':_0x1bb0d7[_0x9d81('0x15')]?_0x1bb0d7[_0x9d81('0x15')][_0x9d81('0x16')]===undefined?!![]:![]:!![],'where':_0x1bb0d7[_0x9d81('0x15')]?_0x1bb0d7[_0x9d81('0x15')][_0x9d81('0x17')]||null:null,'attributes':_0x1bb0d7[_0x9d81('0x15')]?_0x1bb0d7[_0x9d81('0x15')][_0x9d81('0x18')]||null:null,'limit':_0x1bb0d7[_0x9d81('0x15')]?_0x1bb0d7[_0x9d81('0x15')][_0x9d81('0x19')]||null:null,'include':_0x1bb0d7[_0x9d81('0x15')]?_0x1bb0d7['options'][_0x9d81('0x1a')]?_[_0x9d81('0x1b')](_0x1bb0d7[_0x9d81('0x15')][_0x9d81('0x1a')],function(_0x46d0b5){return{'model':db[_0x46d0b5[_0x9d81('0x1c')]],'as':_0x46d0b5['as'],'attributes':_0x46d0b5[_0x9d81('0x18')],'include':_0x46d0b5[_0x9d81('0x1a')]?_['map'](_0x46d0b5[_0x9d81('0x1a')],function(_0xcb0df5){return{'model':db[_0xcb0df5[_0x9d81('0x1c')]],'as':_0xcb0df5['as'],'attributes':_0xcb0df5[_0x9d81('0x18')],'include':_0xcb0df5['include']?_[_0x9d81('0x1b')](_0xcb0df5['include'],function(_0x213a73){return{'model':db[_0x213a73['model']],'as':_0x213a73['as'],'attributes':_0x213a73[_0x9d81('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f44c0){logger[_0x9d81('0xb')](_0x9d81('0x14'),_0x1bb0d7);logger[_0x9d81('0xe')](_0x9d81('0x14'),_0x1bb0d7,JSON[_0x9d81('0x1d')](_0x3f44c0));_0x406588(_0x3f44c0);})[_0x9d81('0x13')](function(_0x385606){logger[_0x9d81('0x10')](_0x9d81('0x14'),_0x385606[_0x9d81('0x11')],_0x1bb0d7);_0x3fd093(_0x3309c3[_0x9d81('0x10')](0x1f4,_0x385606[_0x9d81('0x11')]));});});};exports[_0x9d81('0x1e')]=function(_0x25a9e0){var _0xe0cf0d=this;return new Promise(function(_0x494226,_0x593041){return db[_0x9d81('0x1f')][_0x9d81('0x20')](_0x25a9e0[_0x9d81('0x21')],{'raw':_0x25a9e0['options']?_0x25a9e0[_0x9d81('0x15')][_0x9d81('0x16')]===undefined?!![]:![]:!![]})[_0x9d81('0xa')](function(_0x494696){logger[_0x9d81('0xb')](_0x9d81('0x1e'),_0x25a9e0);logger[_0x9d81('0xe')](_0x9d81('0x1e'),_0x25a9e0,JSON[_0x9d81('0x1d')](_0x494696));_0x494226(_0x494696);})[_0x9d81('0x13')](function(_0x1bfb8b){logger[_0x9d81('0x10')](_0x9d81('0x1e'),_0x1bfb8b[_0x9d81('0x11')],_0x25a9e0);_0x593041(_0xe0cf0d[_0x9d81('0x10')](0x1f4,_0x1bfb8b[_0x9d81('0x11')]));});});};exports[_0x9d81('0x22')]=function(_0x4cad90){var _0x40020a=this;return new Promise(function(_0x10d26a,_0x3e4818){return db[_0x9d81('0x1f')][_0x9d81('0x23')](_0x4cad90['body'],{'raw':_0x4cad90[_0x9d81('0x15')]?_0x4cad90[_0x9d81('0x15')][_0x9d81('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cad90[_0x9d81('0x15')]?_0x4cad90[_0x9d81('0x15')][_0x9d81('0x17')]||null:null,'attributes':_0x4cad90[_0x9d81('0x15')]?_0x4cad90[_0x9d81('0x15')]['attributes']||null:null,'limit':_0x4cad90[_0x9d81('0x15')]?_0x4cad90[_0x9d81('0x15')][_0x9d81('0x19')]||null:null})['then'](function(_0xab5778){logger['info'](_0x9d81('0x22'),_0x4cad90);logger['debug'](_0x9d81('0x22'),_0x4cad90,JSON[_0x9d81('0x1d')](_0xab5778));_0x10d26a(_0xab5778);})[_0x9d81('0x13')](function(_0x5e5e33){logger[_0x9d81('0x10')](_0x9d81('0x22'),_0x5e5e33[_0x9d81('0x11')],_0x4cad90);_0x3e4818(_0x40020a[_0x9d81('0x10')](0x1f4,_0x5e5e33[_0x9d81('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e9b5761..9788539 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 _0x15ff=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','multer','util','connect-timeout','Router'];(function(_0x363319,_0x4fa1a1){var _0x182a62=function(_0x78f65b){while(--_0x78f65b){_0x363319['push'](_0x363319['shift']());}};_0x182a62(++_0x4fa1a1);}(_0x15ff,0x74));var _0xf15f=function(_0x244a2c,_0x5eb691){_0x244a2c=_0x244a2c-0x0;var _0x1bb2db=_0x15ff[_0x244a2c];return _0x1bb2db;};'use strict';var multer=require(_0xf15f('0x0'));var util=require(_0xf15f('0x1'));var path=require('path');var timeout=require(_0xf15f('0x2'));var express=require('express');var router=express[_0xf15f('0x3')]();var fs_extra=require(_0xf15f('0x4'));var auth=require(_0xf15f('0x5'));var interaction=require(_0xf15f('0x6'));var config=require(_0xf15f('0x7'));var controller=require(_0xf15f('0x8'));router['get']('/',controller[_0xf15f('0x9')]);module['exports']=router; \ No newline at end of file +var _0x4a33=['../../components/interaction/service','../../config/environment','./migration.controller','index','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4a33,0x199));var _0x34a3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4a33[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x34a3('0x0'));var path=require(_0x34a3('0x1'));var timeout=require(_0x34a3('0x2'));var express=require(_0x34a3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34a3('0x4'));var interaction=require(_0x34a3('0x5'));var config=require(_0x34a3('0x6'));var controller=require(_0x34a3('0x7'));router['get']('/',controller[_0x34a3('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4b764a2..68e68ac 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 _0x6f7e=['exports','STRING','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6f7e,0x7a));var _0xe6f7=function(_0x5d82e6,_0x7bbef7){_0x5d82e6=_0x5d82e6-0x0;var _0x464c67=_0x6f7e[_0x5d82e6];return _0x464c67;};'use strict';var Sequelize=require(_0xe6f7('0x0'));module[_0xe6f7('0x1')]={'version':{'type':Sequelize[_0xe6f7('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xe320=['sequelize','exports','STRING'];(function(_0x2ca5c3,_0x5184e6){var _0xa527c9=function(_0x451fff){while(--_0x451fff){_0x2ca5c3['push'](_0x2ca5c3['shift']());}};_0xa527c9(++_0x5184e6);}(_0xe320,0xa5));var _0x0e32=function(_0x5749b0,_0x88ef0f){_0x5749b0=_0x5749b0-0x0;var _0x10de61=_0xe320[_0x5749b0];return _0x10de61;};'use strict';var Sequelize=require(_0x0e32('0x0'));module[_0x0e32('0x1')]={'version':{'type':Sequelize[_0x0e32('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 38ec583..2a065b6 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 _0x446e=['keys','attributes','intersection','fields','length','order','sort','where','filters','pick','type','filter','options','include','findAll','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','name','index','Migration','fieldName','key','model','map','query'];(function(_0x2bfb43,_0x27592c){var _0x1f49fb=function(_0x1ceb1f){while(--_0x1ceb1f){_0x2bfb43['push'](_0x2bfb43['shift']());}};_0x1f49fb(++_0x27592c);}(_0x446e,0x1f0));var _0xe446=function(_0x58eb9a,_0x1ac70c){_0x58eb9a=_0x58eb9a-0x0;var _0x2508ea=_0x446e[_0x58eb9a];return _0x2508ea;};'use strict';var emlformat=require(_0xe446('0x0'));var rimraf=require(_0xe446('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe446('0x2'));var rp=require(_0xe446('0x3'));var moment=require(_0xe446('0x4'));var BPromise=require(_0xe446('0x5'));var Mustache=require(_0xe446('0x6'));var util=require(_0xe446('0x7'));var path=require(_0xe446('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe446('0x9'));var _=require('lodash');var squel=require(_0xe446('0xa'));var crypto=require(_0xe446('0xb'));var jsforce=require(_0xe446('0xc'));var deskjs=require(_0xe446('0xd'));var toCsv=require(_0xe446('0xe'));var querystring=require('querystring');var Papa=require(_0xe446('0xf'));var Redis=require('ioredis');var authService=require(_0xe446('0x10'));var qs=require(_0xe446('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe446('0x12'));var logger=require('../../config/logger')(_0xe446('0x13'));var utils=require(_0xe446('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe446('0x15'))['db'];function respondWithStatusCode(_0x4d6644,_0x3b5ca4){_0x3b5ca4=_0x3b5ca4||0xcc;return function(_0x57e18e){if(_0x57e18e){return _0x4d6644[_0xe446('0x16')](_0x3b5ca4);}return _0x4d6644[_0xe446('0x17')](_0x3b5ca4)[_0xe446('0x18')]();};}function respondWithResult(_0xd92d2c,_0x12bd3c){_0x12bd3c=_0x12bd3c||0xc8;return function(_0x510a06){if(_0x510a06){return _0xd92d2c[_0xe446('0x17')](_0x12bd3c)[_0xe446('0x19')](_0x510a06);}};}function respondWithFilteredResult(_0x478ff4,_0x380a08){return function(_0x4a0349){if(_0x4a0349){var _0x336049=typeof _0x380a08[_0xe446('0x1a')]===_0xe446('0x1b')&&typeof _0x380a08[_0xe446('0x1c')]===_0xe446('0x1b');var _0xcdffaa=_0x4a0349['count'];var _0x448ede=_0x336049?0x0:_0x380a08['offset'];var _0x1c41c4=_0x336049?_0x4a0349[_0xe446('0x1d')]:_0x380a08[_0xe446('0x1a')]+_0x380a08[_0xe446('0x1c')];var _0x6abc6d;if(_0x1c41c4>=_0xcdffaa){_0x1c41c4=_0xcdffaa;_0x6abc6d=0xc8;}else{_0x6abc6d=0xce;}_0x478ff4[_0xe446('0x17')](_0x6abc6d);return _0x478ff4['set'](_0xe446('0x1e'),_0x448ede+'-'+_0x1c41c4+'/'+_0xcdffaa)[_0xe446('0x19')](_0x4a0349);}return null;};}function patchUpdates(_0x781181){return function(_0x1e3d29){try{jsonpatch[_0xe446('0x1f')](_0x1e3d29,_0x781181,!![]);}catch(_0x5dda9b){return BPromise['reject'](_0x5dda9b);}return _0x1e3d29[_0xe446('0x20')]();};}function saveUpdates(_0x4879bc,_0x503cca){return function(_0x466a44){if(_0x466a44){return _0x466a44['update'](_0x4879bc)[_0xe446('0x21')](function(_0x13cb39){return _0x13cb39;});}return null;};}function removeEntity(_0x29a2e2,_0x31f0f4){return function(_0xf7d8c3){if(_0xf7d8c3){return _0xf7d8c3[_0xe446('0x22')]()[_0xe446('0x21')](function(){_0x29a2e2[_0xe446('0x17')](0xcc)[_0xe446('0x18')]();});}};}function handleEntityNotFound(_0x35511d,_0xeba72b){return function(_0x1342a6){if(!_0x1342a6){_0x35511d[_0xe446('0x16')](0x194);}return _0x1342a6;};}function handleError(_0xe8b2cc,_0x43cd84){_0x43cd84=_0x43cd84||0x1f4;return function(_0x142dfe){logger[_0xe446('0x23')](_0x142dfe['stack']);if(_0x142dfe[_0xe446('0x24')]){delete _0x142dfe[_0xe446('0x24')];}_0xe8b2cc['status'](_0x43cd84)['send'](_0x142dfe);};}exports[_0xe446('0x25')]=function(_0x35517e,_0x3b6795){var _0x577044={},_0x457787={},_0x3ea442={'count':0x0,'rows':[]};var _0x4df08f=_['map'](db[_0xe446('0x26')]['rawAttributes'],function(_0xb1bbfc){return{'name':_0xb1bbfc[_0xe446('0x27')],'type':_0xb1bbfc['type'][_0xe446('0x28')]};});_0x457787[_0xe446('0x29')]=_[_0xe446('0x2a')](_0x4df08f,_0xe446('0x24'));_0x457787[_0xe446('0x2b')]=_[_0xe446('0x2c')](_0x35517e['query']);_0x457787['filters']=_['intersection'](_0x457787[_0xe446('0x29')],_0x457787[_0xe446('0x2b')]);_0x577044[_0xe446('0x2d')]=_[_0xe446('0x2e')](_0x457787[_0xe446('0x29')],qs[_0xe446('0x2f')](_0x35517e[_0xe446('0x2b')][_0xe446('0x2f')]));_0x577044[_0xe446('0x2d')]=_0x577044[_0xe446('0x2d')][_0xe446('0x30')]?_0x577044[_0xe446('0x2d')]:_0x457787[_0xe446('0x29')];if(!_0x35517e[_0xe446('0x2b')]['hasOwnProperty']('nolimit')){_0x577044[_0xe446('0x1c')]=qs[_0xe446('0x1c')](_0x35517e['query'][_0xe446('0x1c')]);_0x577044[_0xe446('0x1a')]=qs[_0xe446('0x1a')](_0x35517e[_0xe446('0x2b')][_0xe446('0x1a')]);}_0x577044[_0xe446('0x31')]=qs[_0xe446('0x32')](_0x35517e[_0xe446('0x2b')][_0xe446('0x32')]);_0x577044[_0xe446('0x33')]=qs[_0xe446('0x34')](_[_0xe446('0x35')](_0x35517e[_0xe446('0x2b')],_0x457787[_0xe446('0x34')]),_0x4df08f);if(_0x35517e[_0xe446('0x2b')]['filter']){_0x577044[_0xe446('0x33')]=_['merge'](_0x577044[_0xe446('0x33')],{'$or':_[_0xe446('0x2a')](_0x4df08f,function(_0x4038f8){if(_0x4038f8[_0xe446('0x36')]!=='VIRTUAL'){var _0x27406d={};_0x27406d[_0x4038f8['name']]={'$like':'%'+_0x35517e['query'][_0xe446('0x37')]+'%'};return _0x27406d;}})});}_0x577044=_['merge']({},_0x577044,_0x35517e[_0xe446('0x38')]);var _0x19402f={'where':_0x577044[_0xe446('0x33')]};return db[_0xe446('0x26')][_0xe446('0x1d')](_0x19402f)[_0xe446('0x21')](function(_0x14e4e5){_0x3ea442[_0xe446('0x1d')]=_0x14e4e5;if(_0x35517e[_0xe446('0x2b')]['includeAll']){_0x577044[_0xe446('0x39')]=[{'all':!![]}];}return db[_0xe446('0x26')][_0xe446('0x3a')](_0x577044);})[_0xe446('0x21')](function(_0x7d77a){_0x3ea442[_0xe446('0x3b')]=_0x7d77a;return _0x3ea442;})[_0xe446('0x21')](respondWithFilteredResult(_0x3b6795,_0x577044))['catch'](handleError(_0x3b6795,null));}; \ No newline at end of file +var _0xbdf9=['name','send','index','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error'];(function(_0x3c7ecb,_0xfe99d5){var _0x3c8a56=function(_0x916ea1){while(--_0x916ea1){_0x3c7ecb['push'](_0x3c7ecb['shift']());}};_0x3c8a56(++_0xfe99d5);}(_0xbdf9,0x129));var _0x9bdf=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0xbdf9[_0x49fcfb];return _0x964926;};'use strict';var emlformat=require(_0x9bdf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9bdf('0x1'));var jsonpatch=require(_0x9bdf('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9bdf('0x3'));var Mustache=require('mustache');var util=require(_0x9bdf('0x4'));var path=require(_0x9bdf('0x5'));var sox=require(_0x9bdf('0x6'));var csv=require(_0x9bdf('0x7'));var ejs=require(_0x9bdf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bdf('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9bdf('0xa'));var deskjs=require(_0x9bdf('0xb'));var toCsv=require(_0x9bdf('0x7'));var querystring=require(_0x9bdf('0xc'));var Papa=require(_0x9bdf('0xd'));var Redis=require(_0x9bdf('0xe'));var authService=require(_0x9bdf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9bdf('0x10'));var hardwareService=require(_0x9bdf('0x11'));var logger=require(_0x9bdf('0x12'))(_0x9bdf('0x13'));var utils=require(_0x9bdf('0x14'));var config=require(_0x9bdf('0x15'));var licenseUtil=require(_0x9bdf('0x16'));var db=require(_0x9bdf('0x17'))['db'];function respondWithStatusCode(_0xc641a0,_0xeed0bc){_0xeed0bc=_0xeed0bc||0xcc;return function(_0x36ca2b){if(_0x36ca2b){return _0xc641a0[_0x9bdf('0x18')](_0xeed0bc);}return _0xc641a0[_0x9bdf('0x19')](_0xeed0bc)[_0x9bdf('0x1a')]();};}function respondWithResult(_0x1be995,_0x22f66a){_0x22f66a=_0x22f66a||0xc8;return function(_0x8bbbcc){if(_0x8bbbcc){return _0x1be995['status'](_0x22f66a)[_0x9bdf('0x1b')](_0x8bbbcc);}};}function respondWithFilteredResult(_0x29b03a,_0x59bca7){return function(_0x41d728){if(_0x41d728){var _0x32e198=typeof _0x59bca7[_0x9bdf('0x1c')]===_0x9bdf('0x1d')&&typeof _0x59bca7['limit']==='undefined';var _0x561185=_0x41d728['count'];var _0xc3c913=_0x32e198?0x0:_0x59bca7[_0x9bdf('0x1c')];var _0x5c5f89=_0x32e198?_0x41d728['count']:_0x59bca7[_0x9bdf('0x1c')]+_0x59bca7[_0x9bdf('0x1e')];var _0x35f5dd;if(_0x5c5f89>=_0x561185){_0x5c5f89=_0x561185;_0x35f5dd=0xc8;}else{_0x35f5dd=0xce;}_0x29b03a[_0x9bdf('0x19')](_0x35f5dd);return _0x29b03a[_0x9bdf('0x1f')](_0x9bdf('0x20'),_0xc3c913+'-'+_0x5c5f89+'/'+_0x561185)[_0x9bdf('0x1b')](_0x41d728);}return null;};}function patchUpdates(_0x2fea7f){return function(_0x42a1fc){try{jsonpatch[_0x9bdf('0x21')](_0x42a1fc,_0x2fea7f,!![]);}catch(_0x2712e2){return BPromise[_0x9bdf('0x22')](_0x2712e2);}return _0x42a1fc['save']();};}function saveUpdates(_0x5b3e1d,_0x320ad1){return function(_0x4a7ece){if(_0x4a7ece){return _0x4a7ece['update'](_0x5b3e1d)[_0x9bdf('0x23')](function(_0x426a56){return _0x426a56;});}return null;};}function removeEntity(_0x43143a,_0x529660){return function(_0x567d64){if(_0x567d64){return _0x567d64[_0x9bdf('0x24')]()[_0x9bdf('0x23')](function(){_0x43143a[_0x9bdf('0x19')](0xcc)[_0x9bdf('0x1a')]();});}};}function handleEntityNotFound(_0x5bf826,_0x12479e){return function(_0x47c363){if(!_0x47c363){_0x5bf826[_0x9bdf('0x18')](0x194);}return _0x47c363;};}function handleError(_0x331e9b,_0x1a9e19){_0x1a9e19=_0x1a9e19||0x1f4;return function(_0x2e29c1){logger[_0x9bdf('0x25')](_0x2e29c1['stack']);if(_0x2e29c1[_0x9bdf('0x26')]){delete _0x2e29c1[_0x9bdf('0x26')];}_0x331e9b['status'](_0x1a9e19)[_0x9bdf('0x27')](_0x2e29c1);};}exports[_0x9bdf('0x28')]=function(_0x41ed06,_0x27c214){var _0x525e0f={},_0x5f3d55={},_0x1f296d={'count':0x0,'rows':[]};var _0x403695=_[_0x9bdf('0x29')](db[_0x9bdf('0x2a')][_0x9bdf('0x2b')],function(_0x5d7046){return{'name':_0x5d7046['fieldName'],'type':_0x5d7046[_0x9bdf('0x2c')][_0x9bdf('0x2d')]};});_0x5f3d55[_0x9bdf('0x2e')]=_['map'](_0x403695,_0x9bdf('0x26'));_0x5f3d55[_0x9bdf('0x2f')]=_[_0x9bdf('0x30')](_0x41ed06[_0x9bdf('0x2f')]);_0x5f3d55[_0x9bdf('0x31')]=_[_0x9bdf('0x32')](_0x5f3d55['model'],_0x5f3d55['query']);_0x525e0f[_0x9bdf('0x33')]=_[_0x9bdf('0x32')](_0x5f3d55[_0x9bdf('0x2e')],qs['fields'](_0x41ed06[_0x9bdf('0x2f')][_0x9bdf('0x34')]));_0x525e0f[_0x9bdf('0x33')]=_0x525e0f[_0x9bdf('0x33')][_0x9bdf('0x35')]?_0x525e0f[_0x9bdf('0x33')]:_0x5f3d55[_0x9bdf('0x2e')];if(!_0x41ed06[_0x9bdf('0x2f')]['hasOwnProperty'](_0x9bdf('0x36'))){_0x525e0f[_0x9bdf('0x1e')]=qs['limit'](_0x41ed06[_0x9bdf('0x2f')][_0x9bdf('0x1e')]);_0x525e0f[_0x9bdf('0x1c')]=qs['offset'](_0x41ed06[_0x9bdf('0x2f')][_0x9bdf('0x1c')]);}_0x525e0f[_0x9bdf('0x37')]=qs['sort'](_0x41ed06[_0x9bdf('0x2f')]['sort']);_0x525e0f['where']=qs[_0x9bdf('0x31')](_[_0x9bdf('0x38')](_0x41ed06[_0x9bdf('0x2f')],_0x5f3d55['filters']),_0x403695);if(_0x41ed06['query'][_0x9bdf('0x39')]){_0x525e0f[_0x9bdf('0x3a')]=_[_0x9bdf('0x3b')](_0x525e0f[_0x9bdf('0x3a')],{'$or':_[_0x9bdf('0x29')](_0x403695,function(_0x20eae2){if(_0x20eae2['type']!==_0x9bdf('0x3c')){var _0x310b44={};_0x310b44[_0x20eae2[_0x9bdf('0x26')]]={'$like':'%'+_0x41ed06[_0x9bdf('0x2f')][_0x9bdf('0x39')]+'%'};return _0x310b44;}})});}_0x525e0f=_[_0x9bdf('0x3b')]({},_0x525e0f,_0x41ed06['options']);var _0x59d65a={'where':_0x525e0f[_0x9bdf('0x3a')]};return db[_0x9bdf('0x2a')][_0x9bdf('0x3d')](_0x59d65a)[_0x9bdf('0x23')](function(_0x5f02b3){_0x1f296d[_0x9bdf('0x3d')]=_0x5f02b3;if(_0x41ed06[_0x9bdf('0x2f')][_0x9bdf('0x3e')]){_0x525e0f[_0x9bdf('0x3f')]=[{'all':!![]}];}return db['Migration'][_0x9bdf('0x40')](_0x525e0f);})[_0x9bdf('0x23')](function(_0x264385){_0x1f296d[_0x9bdf('0x41')]=_0x264385;return _0x1f296d;})[_0x9bdf('0x23')](respondWithFilteredResult(_0x27c214,_0x525e0f))[_0x9bdf('0x42')](handleError(_0x27c214,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 77faaab..7190d6d 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 _0xcd64=['Migration','migrations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x3721cb,_0x9441b6){var _0xdaddc2=function(_0x2be210){while(--_0x2be210){_0x3721cb['push'](_0x3721cb['shift']());}};_0xdaddc2(++_0x9441b6);}(_0xcd64,0x136));var _0x4cd6=function(_0xcc43d6,_0x5d49f0){_0xcc43d6=_0xcc43d6-0x0;var _0x132e87=_0xcd64[_0xcc43d6];return _0x132e87;};'use strict';var _=require('lodash');var util=require(_0x4cd6('0x0'));var logger=require(_0x4cd6('0x1'))(_0x4cd6('0x2'));var moment=require('moment');var BPromise=require(_0x4cd6('0x3'));var rp=require(_0x4cd6('0x4'));var fs=require('fs');var path=require(_0x4cd6('0x5'));var rimraf=require('rimraf');var config=require(_0x4cd6('0x6'));var attributes=require('./migration.attributes');module[_0x4cd6('0x7')]=function(_0x19df22,_0x571f2b){return _0x19df22[_0x4cd6('0x8')](_0x4cd6('0x9'),attributes,{'tableName':_0x4cd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a7=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x4280b2,_0xff2b7){var _0x36b8cb=function(_0x575ee5){while(--_0x575ee5){_0x4280b2['push'](_0x4280b2['shift']());}};_0x36b8cb(++_0xff2b7);}(_0x07a7,0x167));var _0x707a=function(_0x5103ff,_0x262121){_0x5103ff=_0x5103ff-0x0;var _0x317c78=_0x07a7[_0x5103ff];return _0x317c78;};'use strict';var _=require(_0x707a('0x0'));var util=require(_0x707a('0x1'));var logger=require(_0x707a('0x2'))(_0x707a('0x3'));var moment=require('moment');var BPromise=require(_0x707a('0x4'));var rp=require(_0x707a('0x5'));var fs=require('fs');var path=require(_0x707a('0x6'));var rimraf=require(_0x707a('0x7'));var config=require(_0x707a('0x8'));var attributes=require(_0x707a('0x9'));module[_0x707a('0xa')]=function(_0xfd0f3a,_0x6206d3){return _0xfd0f3a['define']('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 4adbf23..1ab7cb8 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 _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x358004,_0x26f5eb){var _0xea3c83=function(_0x3f2a3f){while(--_0x3f2a3f){_0x358004['push'](_0x358004['shift']());}};_0xea3c83(++_0x26f5eb);}(_0xa45c,0x6d));var _0xca45=function(_0x5a38d6,_0x4450a7){_0x5a38d6=_0x5a38d6-0x0;var _0x91bd43=_0xa45c[_0x5a38d6];return _0x91bd43;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file +var _0x76bc=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','lodash'];(function(_0x33a3e5,_0x1dc1aa){var _0x4bb571=function(_0x2f4439){while(--_0x2f4439){_0x33a3e5['push'](_0x33a3e5['shift']());}};_0x4bb571(++_0x1dc1aa);}(_0x76bc,0x17f));var _0xc76b=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x76bc[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var moment=require(_0xc76b('0x2'));var BPromise=require(_0xc76b('0x3'));var rs=require(_0xc76b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc76b('0x5'));var logger=require(_0xc76b('0x6'))(_0xc76b('0x7'));var config=require(_0xc76b('0x8'));var jayson=require(_0xc76b('0x9'));var client=jayson[_0xc76b('0xa')][_0xc76b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe53,_0x110f3b,_0x1cb174){return new BPromise(function(_0x235ff3,_0xaf195c){return client[_0xc76b('0xc')](_0x2cbe53,_0x1cb174)[_0xc76b('0xd')](function(_0x2803e9){logger[_0xc76b('0xe')]('Migration,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));logger[_0xc76b('0x10')](_0xc76b('0x11'),_0x110f3b,_0xc76b('0xf'),JSON[_0xc76b('0x12')](_0x2803e9));if(_0x2803e9[_0xc76b('0x13')]){if(_0x2803e9['error'][_0xc76b('0x14')]===0x1f4){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0xaf195c(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}logger['error']('Migration,\x20%s,\x20%s',_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0x235ff3(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}else{logger[_0xc76b('0xe')]('Migration,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));_0x235ff3(_0x2803e9[_0xc76b('0x17')][_0xc76b('0x16')]);}})['catch'](function(_0x4e759e){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x4e759e);_0xaf195c(_0x4e759e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 07eaaa4..75c38fb 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 _0xd481=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x202015,_0x1b94e2){var _0x124a84=function(_0x4b8ad8){while(--_0x4b8ad8){_0x202015['push'](_0x202015['shift']());}};_0x124a84(++_0x1b94e2);}(_0xd481,0x1e4));var _0x1d48=function(_0x2f62b7,_0x27465f){_0x2f62b7=_0x2f62b7-0x0;var _0x21086c=_0xd481[_0x2f62b7];return _0x21086c;};'use strict';var multer=require(_0x1d48('0x0'));var util=require('util');var path=require(_0x1d48('0x1'));var timeout=require(_0x1d48('0x2'));var express=require('express');var router=express[_0x1d48('0x3')]();var fs_extra=require(_0x1d48('0x4'));var auth=require(_0x1d48('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d48('0x6'));var controller=require('./network.controller');router[_0x1d48('0x7')]('/',auth[_0x1d48('0x8')](),controller['index']);router[_0x1d48('0x7')](_0x1d48('0x9'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xa')]);router[_0x1d48('0xb')]('/',auth[_0x1d48('0x8')](),controller[_0x1d48('0xc')]);router[_0x1d48('0xd')](_0x1d48('0x9'),auth[_0x1d48('0x8')](),controller[_0x1d48('0xe')]);router[_0x1d48('0xf')]('/:id',auth[_0x1d48('0x8')](),controller[_0x1d48('0x10')]);module[_0x1d48('0x11')]=router; \ No newline at end of file +var _0x7795=['update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x19cb08,_0x4764fc){var _0x1b28d1=function(_0x2868a3){while(--_0x2868a3){_0x19cb08['push'](_0x19cb08['shift']());}};_0x1b28d1(++_0x4764fc);}(_0x7795,0x1a4));var _0x5779=function(_0x4bb16e,_0x4fdf1b){_0x4bb16e=_0x4bb16e-0x0;var _0x24901c=_0x7795[_0x4bb16e];return _0x24901c;};'use strict';var multer=require('multer');var util=require(_0x5779('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5779('0x1'));var router=express[_0x5779('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5779('0x3'));var config=require(_0x5779('0x4'));var controller=require('./network.controller');router[_0x5779('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5779('0x5')](_0x5779('0x6'),auth[_0x5779('0x7')](),controller[_0x5779('0x8')]);router[_0x5779('0x9')]('/',auth['isAuthenticated'](),controller[_0x5779('0xa')]);router[_0x5779('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5779('0xc')]);router[_0x5779('0xd')](_0x5779('0x6'),auth[_0x5779('0x7')](),controller[_0x5779('0xe')]);module[_0x5779('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9db3102..6561a16 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 _0xf93f=['exports','ENUM','localnet','stun','STRING'];(function(_0x3b1d1e,_0x10d8d9){var _0x5670b7=function(_0x2ed53a){while(--_0x2ed53a){_0x3b1d1e['push'](_0x3b1d1e['shift']());}};_0x5670b7(++_0x10d8d9);}(_0xf93f,0x1ea));var _0xff93=function(_0x42544b,_0xd0d2de){_0x42544b=_0x42544b-0x0;var _0x32e22c=_0xf93f[_0x42544b];return _0x32e22c;};'use strict';var Sequelize=require('sequelize');module[_0xff93('0x0')]={'type':{'type':Sequelize[_0xff93('0x1')](_0xff93('0x2'),'externip',_0xff93('0x3'),'turn')},'value':{'type':Sequelize[_0xff93('0x4')]},'username':{'type':Sequelize[_0xff93('0x4')]},'password':{'type':Sequelize[_0xff93('0x4')]}}; \ No newline at end of file +var _0x9249=['STRING','sequelize','exports','ENUM'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9249,0x185));var _0x9924=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x9249[_0x3f8759];return _0x2d33ca;};'use strict';var Sequelize=require(_0x9924('0x0'));module[_0x9924('0x1')]={'type':{'type':Sequelize[_0x9924('0x2')]('localnet','externip','stun','turn')},'value':{'type':Sequelize[_0x9924('0x3')]},'username':{'type':Sequelize[_0x9924('0x3')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 2ff680a..924d254 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 _0xdeae=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','/etc/asterisk/stun_xcally.conf','server/files/templates/network.ejs','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','json','undefined','limit','count','offset','set','update','destroy','then','end','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0xdeae,0x1d3));var _0xedea=function(_0x43ab53,_0x4715e6){_0x43ab53=_0x43ab53-0x0;var _0x2bf9b1=_0xdeae[_0x43ab53];return _0x2bf9b1;};'use strict';var util=require(_0xedea('0x0'));var path=require(_0xedea('0x1'));var ejs=require(_0xedea('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xedea('0x3'));var logger=require(_0xedea('0x4'))(_0xedea('0x5'));var config=require(_0xedea('0x6'));var db=require(_0xedea('0x7'))['db'];var jayson=require(_0xedea('0x8'));var client=jayson[_0xedea('0x9')][_0xedea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14edde,_0x552d24,_0x474697,_0x3d47af){return new Promise(function(_0xbd4b18,_0x14ea65){var _0x152f8d=_0x3d47af||client;return _0x152f8d[_0xedea('0xb')](_0x14edde,_0x474697)['then'](function(_0x5ed862){logger['info'](_0xedea('0xc'),_0x552d24,_0xedea('0xd'));logger[_0xedea('0xe')](_0xedea('0xf'),_0x552d24,_0xedea('0xd'),JSON['stringify'](_0x5ed862));if(_0x5ed862[_0xedea('0x10')]){if(_0x5ed862[_0xedea('0x10')][_0xedea('0x11')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x552d24,_0x5ed862[_0xedea('0x10')][_0xedea('0x12')]);return _0x14ea65(_0x5ed862['error']['message']);}logger[_0xedea('0x10')](_0xedea('0xc'),_0x552d24,_0x5ed862[_0xedea('0x10')][_0xedea('0x12')]);return _0xbd4b18(_0x5ed862[_0xedea('0x10')]['message']);}else{logger[_0xedea('0x13')](_0xedea('0xc'),_0x552d24,_0xedea('0xd'));_0xbd4b18(_0x5ed862[_0xedea('0x14')][_0xedea('0x12')]);}})['catch'](function(_0x283e63){logger[_0xedea('0x10')]('Network,\x20%s,\x20%s',_0x552d24,_0x283e63);_0x14ea65(_0x283e63);});});}function respondWithResult(_0x299fa4,_0x5dadc2){_0x5dadc2=_0x5dadc2||0xc8;return function(_0x4a9787){if(_0x4a9787){return _0x299fa4[_0xedea('0x15')](_0x5dadc2)[_0xedea('0x16')](_0x4a9787);}};}function respondWithFilteredResult(_0x24100f,_0x31c5c6){return function(_0x2bbecc){if(_0x2bbecc){var _0x2a6893=typeof _0x31c5c6['offset']===_0xedea('0x17')&&typeof _0x31c5c6[_0xedea('0x18')]==='undefined';var _0x459633=_0x2bbecc[_0xedea('0x19')];var _0x5761bd=_0x2a6893?0x0:_0x31c5c6[_0xedea('0x1a')];var _0x359cfe=_0x2a6893?_0x2bbecc[_0xedea('0x19')]:_0x31c5c6[_0xedea('0x1a')]+_0x31c5c6[_0xedea('0x18')];var _0x59c062;if(_0x359cfe>=_0x459633){_0x359cfe=_0x459633;_0x59c062=0xc8;}else{_0x59c062=0xce;}_0x24100f['status'](_0x59c062);return _0x24100f[_0xedea('0x1b')]('Content-Range',_0x5761bd+'-'+_0x359cfe+'/'+_0x459633)[_0xedea('0x16')](_0x2bbecc);}return null;};}function saveUpdates(_0x2c071e){return function(_0x51bd16){if(_0x51bd16){return _0x51bd16[_0xedea('0x1c')](_0x2c071e)['then'](function(_0x292296){return _0x292296;});}return null;};}function removeEntity(_0x4d0c03){return function(_0x29c2b2){if(_0x29c2b2){return _0x29c2b2[_0xedea('0x1d')]()[_0xedea('0x1e')](function(){_0x4d0c03[_0xedea('0x15')](0xcc)[_0xedea('0x1f')]();});}};}function handleEntityNotFound(_0x169e9a){return function(_0x283621){if(!_0x283621){_0x169e9a['sendStatus'](0x194);}return _0x283621;};}function handleError(_0x299764,_0x490b61){_0x490b61=_0x490b61||0x1f4;return function(_0x496cea){logger[_0xedea('0x10')](_0x496cea[_0xedea('0x20')]);if(_0x496cea[_0xedea('0x21')]){delete _0x496cea[_0xedea('0x21')];}_0x299764[_0xedea('0x15')](_0x490b61)[_0xedea('0x22')](_0x496cea);};}exports[_0xedea('0x23')]=function(_0x1f6697,_0x4b97fd){var _0x1c8076={},_0x461d62={},_0x19ce05={'count':0x0,'rows':[]};var _0xa66cd4=_[_0xedea('0x24')](db[_0xedea('0x25')][_0xedea('0x26')],function(_0x51697c){return{'name':_0x51697c[_0xedea('0x27')],'type':_0x51697c[_0xedea('0x28')][_0xedea('0x29')]};});_0x461d62['model']=_[_0xedea('0x24')](_0xa66cd4,_0xedea('0x21'));_0x461d62['query']=_['keys'](_0x1f6697[_0xedea('0x2a')]);_0x461d62[_0xedea('0x2b')]=_[_0xedea('0x2c')](_0x461d62[_0xedea('0x2d')],_0x461d62[_0xedea('0x2a')]);_0x1c8076[_0xedea('0x2e')]=_[_0xedea('0x2c')](_0x461d62[_0xedea('0x2d')],qs['fields'](_0x1f6697[_0xedea('0x2a')][_0xedea('0x2f')]));_0x1c8076[_0xedea('0x2e')]=_0x1c8076['attributes'][_0xedea('0x30')]?_0x1c8076[_0xedea('0x2e')]:_0x461d62[_0xedea('0x2d')];if(!_0x1f6697[_0xedea('0x2a')][_0xedea('0x31')](_0xedea('0x32'))){_0x1c8076[_0xedea('0x18')]=qs[_0xedea('0x18')](_0x1f6697[_0xedea('0x2a')]['limit']);_0x1c8076[_0xedea('0x1a')]=qs[_0xedea('0x1a')](_0x1f6697[_0xedea('0x2a')][_0xedea('0x1a')]);}_0x1c8076[_0xedea('0x33')]=qs[_0xedea('0x34')](_0x1f6697[_0xedea('0x2a')][_0xedea('0x34')]);_0x1c8076[_0xedea('0x35')]=qs[_0xedea('0x2b')](_['pick'](_0x1f6697['query'],_0x461d62['filters']),_0xa66cd4);if(_0x1f6697[_0xedea('0x2a')][_0xedea('0x36')]){_0x1c8076[_0xedea('0x35')]=_[_0xedea('0x37')](_0x1c8076[_0xedea('0x35')],{'$or':_['map'](_0xa66cd4,function(_0x46b01f){if(_0x46b01f[_0xedea('0x28')]!==_0xedea('0x38')){var _0x4c87b6={};_0x4c87b6[_0x46b01f[_0xedea('0x21')]]={'$like':'%'+_0x1f6697['query'][_0xedea('0x36')]+'%'};return _0x4c87b6;}})});}_0x1c8076=_[_0xedea('0x37')]({},_0x1c8076,_0x1f6697[_0xedea('0x39')]);var _0x4351e1={'where':_0x1c8076[_0xedea('0x35')]};return db[_0xedea('0x25')][_0xedea('0x19')](_0x4351e1)[_0xedea('0x1e')](function(_0x4c320a){_0x19ce05[_0xedea('0x19')]=_0x4c320a;if(_0x1f6697[_0xedea('0x2a')][_0xedea('0x3a')]){_0x1c8076[_0xedea('0x3b')]=[{'all':!![]}];}return db[_0xedea('0x25')][_0xedea('0x3c')](_0x1c8076);})[_0xedea('0x1e')](function(_0x22a02e){_0x19ce05[_0xedea('0x3d')]=_0x22a02e;return _0x19ce05;})[_0xedea('0x1e')](respondWithFilteredResult(_0x4b97fd,_0x1c8076))[_0xedea('0x3e')](handleError(_0x4b97fd,null));};exports['show']=function(_0x408fc2,_0xc05850){var _0x2f63c0={'raw':!![],'where':{'id':_0x408fc2[_0xedea('0x3f')]['id']}},_0x5583fc={};_0x5583fc[_0xedea('0x2d')]=_['keys'](db[_0xedea('0x25')][_0xedea('0x26')]);_0x5583fc[_0xedea('0x2a')]=_[_0xedea('0x40')](_0x408fc2['query']);_0x5583fc[_0xedea('0x2b')]=_[_0xedea('0x2c')](_0x5583fc[_0xedea('0x2d')],_0x5583fc[_0xedea('0x2a')]);_0x2f63c0[_0xedea('0x2e')]=_['intersection'](_0x5583fc['model'],qs[_0xedea('0x2f')](_0x408fc2[_0xedea('0x2a')][_0xedea('0x2f')]));_0x2f63c0['attributes']=_0x2f63c0[_0xedea('0x2e')][_0xedea('0x30')]?_0x2f63c0['attributes']:_0x5583fc['model'];if(_0x408fc2[_0xedea('0x2a')][_0xedea('0x3a')]){_0x2f63c0[_0xedea('0x3b')]=[{'all':!![]}];}_0x2f63c0=_[_0xedea('0x37')]({},_0x2f63c0,_0x408fc2['options']);return db['Network'][_0xedea('0x41')](_0x2f63c0)[_0xedea('0x1e')](handleEntityNotFound(_0xc05850,null))[_0xedea('0x1e')](respondWithResult(_0xc05850,null))[_0xedea('0x3e')](handleError(_0xc05850,null));};exports[_0xedea('0x42')]=function(_0x403a1c,_0x155e3c){var _0x5a2d8f;return db[_0xedea('0x25')][_0xedea('0x42')](_0x403a1c[_0xedea('0x43')],{'raw':!![]})[_0xedea('0x1e')](function(_0x3b618a){_0x5a2d8f=_0x3b618a;return db[_0xedea('0x25')]['findAll']({'where':{'type':_0x403a1c['body'][_0xedea('0x28')]},'raw':!![]});})['then'](function(_0x315e06){if(_0x5a2d8f[_0xedea('0x28')][_0xedea('0x44')]()==_0xedea('0x45')){var _0x3d439f=fs[_0xedea('0x46')](path['join'](config[_0xedea('0x47')],_0xedea('0x48')),'utf8');var _0x3328ca=ejs[_0xedea('0x49')](_0x3d439f,{'networks':_0x315e06||[]});fs[_0xedea('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x3328ca);return respondWithRpcPromise('Reload',_0xedea('0x42'),{'module':_0xedea('0x4b')});}else if(_0x5a2d8f[_0xedea('0x28')][_0xedea('0x44')]()==_0xedea('0x4c')){var _0x31a4b0=fs[_0xedea('0x46')](path[_0xedea('0x4d')](config['root'],_0xedea('0x4e')),_0xedea('0x4f'));var _0x1545b6=ejs[_0xedea('0x49')](_0x31a4b0,{'networks':_0x315e06||[]});fs[_0xedea('0x4a')](_0xedea('0x50'),_0x1545b6);return respondWithRpcPromise(_0xedea('0x51'),_0xedea('0x42'),{'module':_0xedea('0x4b')});}else{var _0x564f4b=fs[_0xedea('0x46')](path['join'](config[_0xedea('0x47')],'server/files/templates/network.ejs'),_0xedea('0x4f'));var _0x1d7377=ejs[_0xedea('0x49')](_0x564f4b,{'networks':_0x315e06||[]});fs[_0xedea('0x4a')](util[_0xedea('0x52')](_0xedea('0x53'),_0x403a1c['body'][_0xedea('0x28')][_0xedea('0x54')]()),_0x1d7377);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}})[_0xedea('0x1e')](function(){return _0x5a2d8f;})[_0xedea('0x1e')](respondWithResult(_0x155e3c,0xc9))[_0xedea('0x3e')](handleError(_0x155e3c,null));};exports[_0xedea('0x1c')]=function(_0x270e9c,_0x15a9ce){var _0x2bd9fe;return db[_0xedea('0x25')][_0xedea('0x41')]({'where':{'id':_0x270e9c[_0xedea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15a9ce,null))[_0xedea('0x1e')](saveUpdates(_0x270e9c['body'],null))[_0xedea('0x1e')](function(_0x8d303f){if(_0x8d303f){_0x2bd9fe=_0x8d303f;return db[_0xedea('0x25')][_0xedea('0x3c')]({'where':{'type':_0x2bd9fe[_0xedea('0x28')]},'raw':!![]});}return null;})[_0xedea('0x1e')](function(_0x57acc5){if(_0x2bd9fe[_0xedea('0x28')][_0xedea('0x44')]()==_0xedea('0x45')){var _0x26a84a=fs[_0xedea('0x46')](path[_0xedea('0x4d')](config['root'],_0xedea('0x48')),_0xedea('0x4f'));var _0x582f0e=ejs['render'](_0x26a84a,{'networks':_0x57acc5||[]});fs[_0xedea('0x4a')](_0xedea('0x55'),_0x582f0e);return respondWithRpcPromise(_0xedea('0x51'),'update',{'module':'res_stun_monitor.so'});}else if(_0x2bd9fe[_0xedea('0x28')][_0xedea('0x44')]()==_0xedea('0x4c')){var _0x545956=fs[_0xedea('0x46')](path[_0xedea('0x4d')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xedea('0x4f'));var _0x5b6787=ejs['render'](_0x545956,{'networks':_0x57acc5||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5b6787);return respondWithRpcPromise('Reload',_0xedea('0x1c'),{'module':_0xedea('0x4b')});}else{var _0x12b9bf=fs['readFileSync'](path[_0xedea('0x4d')](config[_0xedea('0x47')],_0xedea('0x56')),_0xedea('0x4f'));var _0x328549=ejs[_0xedea('0x49')](_0x12b9bf,{'networks':_0x57acc5||[]});fs['writeFileSync'](util[_0xedea('0x52')](_0xedea('0x53'),_0x270e9c[_0xedea('0x43')][_0xedea('0x28')][_0xedea('0x54')]()),_0x328549);return respondWithRpcPromise(_0xedea('0x51'),_0xedea('0x1c'),{'module':'chan_sip.so'});}})[_0xedea('0x1e')](function(_0x29bfcf){if(_0x29bfcf){return _0x2bd9fe;}return null;})[_0xedea('0x1e')](respondWithResult(_0x15a9ce,null))[_0xedea('0x3e')](handleError(_0x15a9ce,null));};exports[_0xedea('0x1d')]=function(_0x44d92d,_0x416b2e){var _0x1cceb5;return db['Network'][_0xedea('0x41')]({'where':{'id':_0x44d92d[_0xedea('0x3f')]['id']}})[_0xedea('0x1e')](function(_0x59128c){_0x1cceb5=_0x59128c;return _0x59128c;})[_0xedea('0x1e')](handleEntityNotFound(_0x416b2e,null))['then'](removeEntity(_0x416b2e,null))[_0xedea('0x1e')](function(){if(_0x1cceb5){return db[_0xedea('0x25')][_0xedea('0x3c')]({'where':{'type':_0x1cceb5[_0xedea('0x28')]},'raw':!![]});}})[_0xedea('0x1e')](function(_0x280127){if(_0x1cceb5[_0xedea('0x28')][_0xedea('0x44')]()==_0xedea('0x45')){var _0x22a799=fs[_0xedea('0x46')](path[_0xedea('0x4d')](config[_0xedea('0x47')],'server/files/templates/stun_multiple.ejs'),_0xedea('0x4f'));var _0x196f92=ejs[_0xedea('0x49')](_0x22a799,{'networks':_0x280127||[]});fs[_0xedea('0x4a')](_0xedea('0x55'),_0x196f92);return respondWithRpcPromise(_0xedea('0x51'),_0xedea('0x1d'),{'module':_0xedea('0x4b')});}else if(_0x1cceb5['type']['toUpperCase']()==_0xedea('0x4c')){var _0x474dac=fs[_0xedea('0x46')](path['join'](config[_0xedea('0x47')],_0xedea('0x4e')),_0xedea('0x4f'));var _0x4d3448=ejs[_0xedea('0x49')](_0x474dac,{'networks':_0x280127||[]});fs[_0xedea('0x4a')](_0xedea('0x50'),_0x4d3448);return respondWithRpcPromise('Reload','destroy',{'module':_0xedea('0x4b')});}else{var _0x25b8be=fs[_0xedea('0x46')](path['join'](config['root'],_0xedea('0x56')),'utf8');var _0xc8661d=ejs['render'](_0x25b8be,{'networks':_0x280127||[]});fs['writeFileSync'](util[_0xedea('0x52')](_0xedea('0x53'),_0x1cceb5[_0xedea('0x28')][_0xedea('0x54')]()),_0xc8661d);return respondWithRpcPromise(_0xedea('0x51'),_0xedea('0x1d'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x416b2e,null));}; \ No newline at end of file +var _0x0270=['path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','count','limit','status','set','Content-Range','destroy','end','stack','name','send','Network','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','findAll','show','params','rawAttributes','include','options','find','create','body','STUN','join','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','toUpperCase','util'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x0270,0xa5));var _0x0027=function(_0x5d73b7,_0x1341f0){_0x5d73b7=_0x5d73b7-0x0;var _0x539a95=_0x0270[_0x5d73b7];return _0x539a95;};'use strict';var util=require(_0x0027('0x0'));var path=require(_0x0027('0x1'));var ejs=require(_0x0027('0x2'));var fs=require('fs');var _=require(_0x0027('0x3'));var qs=require(_0x0027('0x4'));var logger=require('../../config/logger')(_0x0027('0x5'));var config=require(_0x0027('0x6'));var db=require(_0x0027('0x7'))['db'];var jayson=require(_0x0027('0x8'));var client=jayson['client'][_0x0027('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3af7a1,_0x19281d,_0x59b430,_0x362599){return new Promise(function(_0x4eb475,_0x13c15b){var _0xa96beb=_0x362599||client;return _0xa96beb[_0x0027('0xa')](_0x3af7a1,_0x59b430)[_0x0027('0xb')](function(_0x4ff82f){logger[_0x0027('0xc')](_0x0027('0xd'),_0x19281d,'request\x20sent');logger['debug'](_0x0027('0xe'),_0x19281d,_0x0027('0xf'),JSON[_0x0027('0x10')](_0x4ff82f));if(_0x4ff82f[_0x0027('0x11')]){if(_0x4ff82f[_0x0027('0x11')][_0x0027('0x12')]===0x1f4){logger['error'](_0x0027('0xd'),_0x19281d,_0x4ff82f['error'][_0x0027('0x13')]);return _0x13c15b(_0x4ff82f[_0x0027('0x11')][_0x0027('0x13')]);}logger[_0x0027('0x11')](_0x0027('0xd'),_0x19281d,_0x4ff82f[_0x0027('0x11')][_0x0027('0x13')]);return _0x4eb475(_0x4ff82f[_0x0027('0x11')][_0x0027('0x13')]);}else{logger[_0x0027('0xc')](_0x0027('0xd'),_0x19281d,_0x0027('0xf'));_0x4eb475(_0x4ff82f[_0x0027('0x14')]['message']);}})[_0x0027('0x15')](function(_0x1de25c){logger['error'](_0x0027('0xd'),_0x19281d,_0x1de25c);_0x13c15b(_0x1de25c);});});}function respondWithResult(_0x1d4ac4,_0x27f224){_0x27f224=_0x27f224||0xc8;return function(_0x2bea77){if(_0x2bea77){return _0x1d4ac4['status'](_0x27f224)[_0x0027('0x16')](_0x2bea77);}};}function respondWithFilteredResult(_0x1053c9,_0x53956b){return function(_0x57bdad){if(_0x57bdad){var _0x39fd35=typeof _0x53956b[_0x0027('0x17')]==='undefined'&&typeof _0x53956b['limit']==='undefined';var _0x31d357=_0x57bdad[_0x0027('0x18')];var _0x230c1e=_0x39fd35?0x0:_0x53956b['offset'];var _0xcb8118=_0x39fd35?_0x57bdad[_0x0027('0x18')]:_0x53956b[_0x0027('0x17')]+_0x53956b[_0x0027('0x19')];var _0x46e3c7;if(_0xcb8118>=_0x31d357){_0xcb8118=_0x31d357;_0x46e3c7=0xc8;}else{_0x46e3c7=0xce;}_0x1053c9[_0x0027('0x1a')](_0x46e3c7);return _0x1053c9[_0x0027('0x1b')](_0x0027('0x1c'),_0x230c1e+'-'+_0xcb8118+'/'+_0x31d357)[_0x0027('0x16')](_0x57bdad);}return null;};}function saveUpdates(_0x58248b){return function(_0x182c46){if(_0x182c46){return _0x182c46['update'](_0x58248b)[_0x0027('0xb')](function(_0x262b00){return _0x262b00;});}return null;};}function removeEntity(_0x25164b){return function(_0x4cfacd){if(_0x4cfacd){return _0x4cfacd[_0x0027('0x1d')]()[_0x0027('0xb')](function(){_0x25164b[_0x0027('0x1a')](0xcc)[_0x0027('0x1e')]();});}};}function handleEntityNotFound(_0xe250e7){return function(_0x424d65){if(!_0x424d65){_0xe250e7['sendStatus'](0x194);}return _0x424d65;};}function handleError(_0x23a4d0,_0x3f0d2a){_0x3f0d2a=_0x3f0d2a||0x1f4;return function(_0x47be11){logger[_0x0027('0x11')](_0x47be11[_0x0027('0x1f')]);if(_0x47be11[_0x0027('0x20')]){delete _0x47be11['name'];}_0x23a4d0[_0x0027('0x1a')](_0x3f0d2a)[_0x0027('0x21')](_0x47be11);};}exports['index']=function(_0x1a40e1,_0x4bbd51){var _0x4eef91={},_0x1dcbaa={},_0x3c546b={'count':0x0,'rows':[]};var _0x2bad14=_['map'](db[_0x0027('0x22')]['rawAttributes'],function(_0x8e9b5d){return{'name':_0x8e9b5d['fieldName'],'type':_0x8e9b5d['type']['key']};});_0x1dcbaa[_0x0027('0x23')]=_[_0x0027('0x24')](_0x2bad14,_0x0027('0x20'));_0x1dcbaa[_0x0027('0x25')]=_[_0x0027('0x26')](_0x1a40e1['query']);_0x1dcbaa['filters']=_['intersection'](_0x1dcbaa[_0x0027('0x23')],_0x1dcbaa[_0x0027('0x25')]);_0x4eef91[_0x0027('0x27')]=_[_0x0027('0x28')](_0x1dcbaa[_0x0027('0x23')],qs[_0x0027('0x29')](_0x1a40e1[_0x0027('0x25')]['fields']));_0x4eef91['attributes']=_0x4eef91[_0x0027('0x27')][_0x0027('0x2a')]?_0x4eef91[_0x0027('0x27')]:_0x1dcbaa[_0x0027('0x23')];if(!_0x1a40e1['query'][_0x0027('0x2b')]('nolimit')){_0x4eef91[_0x0027('0x19')]=qs[_0x0027('0x19')](_0x1a40e1[_0x0027('0x25')][_0x0027('0x19')]);_0x4eef91['offset']=qs[_0x0027('0x17')](_0x1a40e1[_0x0027('0x25')]['offset']);}_0x4eef91[_0x0027('0x2c')]=qs[_0x0027('0x2d')](_0x1a40e1[_0x0027('0x25')][_0x0027('0x2d')]);_0x4eef91[_0x0027('0x2e')]=qs[_0x0027('0x2f')](_['pick'](_0x1a40e1[_0x0027('0x25')],_0x1dcbaa[_0x0027('0x2f')]),_0x2bad14);if(_0x1a40e1[_0x0027('0x25')][_0x0027('0x30')]){_0x4eef91[_0x0027('0x2e')]=_[_0x0027('0x31')](_0x4eef91[_0x0027('0x2e')],{'$or':_[_0x0027('0x24')](_0x2bad14,function(_0x2a60c2){if(_0x2a60c2[_0x0027('0x32')]!==_0x0027('0x33')){var _0x4a89eb={};_0x4a89eb[_0x2a60c2[_0x0027('0x20')]]={'$like':'%'+_0x1a40e1['query'][_0x0027('0x30')]+'%'};return _0x4a89eb;}})});}_0x4eef91=_[_0x0027('0x31')]({},_0x4eef91,_0x1a40e1['options']);var _0x51ea45={'where':_0x4eef91[_0x0027('0x2e')]};return db[_0x0027('0x22')][_0x0027('0x18')](_0x51ea45)['then'](function(_0xa6b683){_0x3c546b[_0x0027('0x18')]=_0xa6b683;if(_0x1a40e1['query'][_0x0027('0x34')]){_0x4eef91['include']=[{'all':!![]}];}return db['Network'][_0x0027('0x35')](_0x4eef91);})[_0x0027('0xb')](function(_0x1e235d){_0x3c546b['rows']=_0x1e235d;return _0x3c546b;})[_0x0027('0xb')](respondWithFilteredResult(_0x4bbd51,_0x4eef91))[_0x0027('0x15')](handleError(_0x4bbd51,null));};exports[_0x0027('0x36')]=function(_0x258d95,_0x403439){var _0x2f47ac={'raw':!![],'where':{'id':_0x258d95[_0x0027('0x37')]['id']}},_0x4f218b={};_0x4f218b[_0x0027('0x23')]=_[_0x0027('0x26')](db['Network'][_0x0027('0x38')]);_0x4f218b[_0x0027('0x25')]=_[_0x0027('0x26')](_0x258d95[_0x0027('0x25')]);_0x4f218b[_0x0027('0x2f')]=_[_0x0027('0x28')](_0x4f218b[_0x0027('0x23')],_0x4f218b[_0x0027('0x25')]);_0x2f47ac[_0x0027('0x27')]=_['intersection'](_0x4f218b['model'],qs[_0x0027('0x29')](_0x258d95[_0x0027('0x25')][_0x0027('0x29')]));_0x2f47ac[_0x0027('0x27')]=_0x2f47ac[_0x0027('0x27')][_0x0027('0x2a')]?_0x2f47ac[_0x0027('0x27')]:_0x4f218b[_0x0027('0x23')];if(_0x258d95[_0x0027('0x25')][_0x0027('0x34')]){_0x2f47ac[_0x0027('0x39')]=[{'all':!![]}];}_0x2f47ac=_['merge']({},_0x2f47ac,_0x258d95[_0x0027('0x3a')]);return db['Network'][_0x0027('0x3b')](_0x2f47ac)[_0x0027('0xb')](handleEntityNotFound(_0x403439,null))[_0x0027('0xb')](respondWithResult(_0x403439,null))[_0x0027('0x15')](handleError(_0x403439,null));};exports[_0x0027('0x3c')]=function(_0x161ab9,_0x419b2f){var _0x339c24;return db[_0x0027('0x22')]['create'](_0x161ab9[_0x0027('0x3d')],{'raw':!![]})[_0x0027('0xb')](function(_0xd758bd){_0x339c24=_0xd758bd;return db['Network'][_0x0027('0x35')]({'where':{'type':_0x161ab9[_0x0027('0x3d')][_0x0027('0x32')]},'raw':!![]});})[_0x0027('0xb')](function(_0x374d6d){if(_0x339c24[_0x0027('0x32')]['toUpperCase']()==_0x0027('0x3e')){var _0x4ed06c=fs['readFileSync'](path[_0x0027('0x3f')](config['root'],_0x0027('0x40')),_0x0027('0x41'));var _0x33bd34=ejs['render'](_0x4ed06c,{'networks':_0x374d6d||[]});fs['writeFileSync'](_0x0027('0x42'),_0x33bd34);return respondWithRpcPromise(_0x0027('0x43'),'create',{'module':_0x0027('0x44')});}else if(_0x339c24[_0x0027('0x32')]['toUpperCase']()==_0x0027('0x45')){var _0x59f03a=fs[_0x0027('0x46')](path[_0x0027('0x3f')](config[_0x0027('0x47')],_0x0027('0x48')),_0x0027('0x41'));var _0xa25279=ejs[_0x0027('0x49')](_0x59f03a,{'networks':_0x374d6d||[]});fs[_0x0027('0x4a')](_0x0027('0x4b'),_0xa25279);return respondWithRpcPromise('Reload',_0x0027('0x3c'),{'module':_0x0027('0x44')});}else{var _0x3dbe55=fs[_0x0027('0x46')](path[_0x0027('0x3f')](config['root'],_0x0027('0x4c')),_0x0027('0x41'));var _0x437b7b=ejs['render'](_0x3dbe55,{'networks':_0x374d6d||[]});fs[_0x0027('0x4a')](util[_0x0027('0x4d')](_0x0027('0x4e'),_0x161ab9[_0x0027('0x3d')][_0x0027('0x32')][_0x0027('0x4f')]()),_0x437b7b);return respondWithRpcPromise(_0x0027('0x43'),_0x0027('0x3c'),{'module':_0x0027('0x50')});}})['then'](function(){return _0x339c24;})[_0x0027('0xb')](respondWithResult(_0x419b2f,0xc9))[_0x0027('0x15')](handleError(_0x419b2f,null));};exports[_0x0027('0x51')]=function(_0x28dc29,_0x2cc314){var _0x5016a1;return db[_0x0027('0x22')][_0x0027('0x3b')]({'where':{'id':_0x28dc29['params']['id']}})[_0x0027('0xb')](handleEntityNotFound(_0x2cc314,null))[_0x0027('0xb')](saveUpdates(_0x28dc29['body'],null))['then'](function(_0x3f23eb){if(_0x3f23eb){_0x5016a1=_0x3f23eb;return db[_0x0027('0x22')][_0x0027('0x35')]({'where':{'type':_0x5016a1['type']},'raw':!![]});}return null;})[_0x0027('0xb')](function(_0x139765){if(_0x5016a1['type'][_0x0027('0x52')]()=='STUN'){var _0x39b12=fs[_0x0027('0x46')](path[_0x0027('0x3f')](config[_0x0027('0x47')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x35104e=ejs['render'](_0x39b12,{'networks':_0x139765||[]});fs[_0x0027('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x35104e);return respondWithRpcPromise(_0x0027('0x43'),_0x0027('0x51'),{'module':_0x0027('0x44')});}else if(_0x5016a1[_0x0027('0x32')][_0x0027('0x52')]()=='TURN'){var _0x47f396=fs[_0x0027('0x46')](path[_0x0027('0x3f')](config[_0x0027('0x47')],_0x0027('0x48')),_0x0027('0x41'));var _0x4ca3fc=ejs[_0x0027('0x49')](_0x47f396,{'networks':_0x139765||[]});fs[_0x0027('0x4a')](_0x0027('0x4b'),_0x4ca3fc);return respondWithRpcPromise(_0x0027('0x43'),_0x0027('0x51'),{'module':'res_stun_monitor.so'});}else{var _0x3c881b=fs[_0x0027('0x46')](path[_0x0027('0x3f')](config[_0x0027('0x47')],_0x0027('0x4c')),_0x0027('0x41'));var _0x2acc28=ejs[_0x0027('0x49')](_0x3c881b,{'networks':_0x139765||[]});fs[_0x0027('0x4a')](util[_0x0027('0x4d')](_0x0027('0x4e'),_0x28dc29[_0x0027('0x3d')]['type'][_0x0027('0x4f')]()),_0x2acc28);return respondWithRpcPromise(_0x0027('0x43'),'update',{'module':_0x0027('0x50')});}})['then'](function(_0x403bb6){if(_0x403bb6){return _0x5016a1;}return null;})[_0x0027('0xb')](respondWithResult(_0x2cc314,null))[_0x0027('0x15')](handleError(_0x2cc314,null));};exports[_0x0027('0x1d')]=function(_0x17f535,_0x46839b){var _0x41f6c3;return db[_0x0027('0x22')][_0x0027('0x3b')]({'where':{'id':_0x17f535[_0x0027('0x37')]['id']}})['then'](function(_0x5d31af){_0x41f6c3=_0x5d31af;return _0x5d31af;})['then'](handleEntityNotFound(_0x46839b,null))['then'](removeEntity(_0x46839b,null))['then'](function(){if(_0x41f6c3){return db['Network'][_0x0027('0x35')]({'where':{'type':_0x41f6c3[_0x0027('0x32')]},'raw':!![]});}})[_0x0027('0xb')](function(_0x2a9976){if(_0x41f6c3[_0x0027('0x32')][_0x0027('0x52')]()==_0x0027('0x3e')){var _0x44335c=fs[_0x0027('0x46')](path['join'](config[_0x0027('0x47')],_0x0027('0x40')),_0x0027('0x41'));var _0x30695a=ejs[_0x0027('0x49')](_0x44335c,{'networks':_0x2a9976||[]});fs['writeFileSync'](_0x0027('0x42'),_0x30695a);return respondWithRpcPromise(_0x0027('0x43'),'destroy',{'module':_0x0027('0x44')});}else if(_0x41f6c3[_0x0027('0x32')]['toUpperCase']()=='TURN'){var _0x2bab82=fs['readFileSync'](path[_0x0027('0x3f')](config['root'],_0x0027('0x48')),_0x0027('0x41'));var _0x425a5f=ejs['render'](_0x2bab82,{'networks':_0x2a9976||[]});fs['writeFileSync'](_0x0027('0x4b'),_0x425a5f);return respondWithRpcPromise(_0x0027('0x43'),_0x0027('0x1d'),{'module':_0x0027('0x44')});}else{var _0x71519a=fs[_0x0027('0x46')](path['join'](config[_0x0027('0x47')],_0x0027('0x4c')),_0x0027('0x41'));var _0x172b3d=ejs[_0x0027('0x49')](_0x71519a,{'networks':_0x2a9976||[]});fs['writeFileSync'](util[_0x0027('0x4d')](_0x0027('0x4e'),_0x41f6c3[_0x0027('0x32')][_0x0027('0x4f')]()),_0x172b3d);return respondWithRpcPromise(_0x0027('0x43'),'destroy',{'module':_0x0027('0x50')});}})[_0x0027('0x15')](handleError(_0x46839b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index dcb7bba..de40b0b 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 _0x867f=['define','Network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x42fbdb,_0x23f532){var _0x12bdcc=function(_0x565b64){while(--_0x565b64){_0x42fbdb['push'](_0x42fbdb['shift']());}};_0x12bdcc(++_0x23f532);}(_0x867f,0xe6));var _0xf867=function(_0x340fc7,_0x12a901){_0x340fc7=_0x340fc7-0x0;var _0x586c93=_0x867f[_0x340fc7];return _0x586c93;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))(_0xf867('0x3'));var moment=require(_0xf867('0x4'));var BPromise=require(_0xf867('0x5'));var rp=require(_0xf867('0x6'));var fs=require('fs');var path=require(_0xf867('0x7'));var rimraf=require(_0xf867('0x8'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xf867('0x9')]=function(_0x2e0691,_0x2c09b1){return _0x2e0691[_0xf867('0xa')](_0xf867('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9434=['api','moment','bluebird','path','rimraf','./network.attributes','exports','network','lodash','util','../../config/logger'];(function(_0x1d2e4b,_0x3e2d3c){var _0x2d0701=function(_0x1a788e){while(--_0x1a788e){_0x1d2e4b['push'](_0x1d2e4b['shift']());}};_0x2d0701(++_0x3e2d3c);}(_0x9434,0x168));var _0x4943=function(_0x1d2bd8,_0x42fee0){_0x1d2bd8=_0x1d2bd8-0x0;var _0x1581fd=_0x9434[_0x1d2bd8];return _0x1581fd;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var logger=require(_0x4943('0x2'))(_0x4943('0x3'));var moment=require(_0x4943('0x4'));var BPromise=require(_0x4943('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4943('0x6'));var rimraf=require(_0x4943('0x7'));var config=require('../../config/environment');var attributes=require(_0x4943('0x8'));module[_0x4943('0x9')]=function(_0x4f930e,_0x394d9d){return _0x4f930e['define']('Network',attributes,{'tableName':_0x4943('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 3e0b5a8..d4f0a92 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x160e22,_0x22408f){_0x160e22=_0x160e22-0x0;var _0xff4f65=_0x7a54[_0x160e22];return _0xff4f65;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x504c25,_0x288879){_0x504c25=_0x504c25-0x0;var _0x573ba3=_0x7a54[_0x504c25];return _0x573ba3;};'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 baa5c4a..dda4d49 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 _0x4fd1=['notify','/:id/applications','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','isAuthenticated','get','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4fd1,0xea));var _0x14fd=function(_0x2cd42b,_0x4e3d10){_0x2cd42b=_0x2cd42b-0x0;var _0x329ab9=_0x4fd1[_0x2cd42b];return _0x329ab9;};'use strict';var multer=require(_0x14fd('0x0'));var util=require('util');var path=require(_0x14fd('0x1'));var timeout=require('connect-timeout');var express=require(_0x14fd('0x2'));var router=express[_0x14fd('0x3')]();var fs_extra=require(_0x14fd('0x4'));var auth=require(_0x14fd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x14fd('0x6'));router['get']('/',auth[_0x14fd('0x7')](),controller['index']);router[_0x14fd('0x8')]('/describe',auth[_0x14fd('0x7')](),controller[_0x14fd('0x9')]);router['get'](_0x14fd('0xa'),auth[_0x14fd('0x7')](),controller['show']);router[_0x14fd('0x8')](_0x14fd('0xb'),auth[_0x14fd('0x7')](),controller[_0x14fd('0xc')]);router[_0x14fd('0x8')](_0x14fd('0xd'),auth[_0x14fd('0x7')](),controller[_0x14fd('0xe')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x14fd('0xf')]);router[_0x14fd('0x8')](_0x14fd('0x10'),auth['isAuthenticated'](),controller[_0x14fd('0x11')]);router[_0x14fd('0x8')](_0x14fd('0x12'),auth['isAuthenticated'](),controller[_0x14fd('0x13')]);router[_0x14fd('0x14')]('/',auth[_0x14fd('0x7')](),controller[_0x14fd('0x15')]);router[_0x14fd('0x14')](_0x14fd('0xb'),auth[_0x14fd('0x7')](),controller[_0x14fd('0x16')]);router[_0x14fd('0x14')](_0x14fd('0xd'),auth['isAuthenticated'](),controller[_0x14fd('0x17')]);router['post'](_0x14fd('0x18'),controller[_0x14fd('0x19')]);router[_0x14fd('0x14')](_0x14fd('0x1a'),auth[_0x14fd('0x7')](),controller[_0x14fd('0x1b')]);router[_0x14fd('0x14')](_0x14fd('0x12'),auth['isAuthenticated'](),controller[_0x14fd('0x1c')]);router['post']('/:id/send',auth[_0x14fd('0x7')](),controller[_0x14fd('0x1d')]);router[_0x14fd('0x1e')](_0x14fd('0xa'),auth[_0x14fd('0x7')](),controller[_0x14fd('0x1f')]);router[_0x14fd('0x20')](_0x14fd('0xa'),auth['isAuthenticated'](),controller[_0x14fd('0x21')]);router[_0x14fd('0x20')](_0x14fd('0xb'),auth[_0x14fd('0x7')](),controller[_0x14fd('0x22')]);router[_0x14fd('0x20')]('/:id/canned_answers',auth[_0x14fd('0x7')](),controller[_0x14fd('0x23')]);router['delete'](_0x14fd('0x12'),auth[_0x14fd('0x7')](),controller[_0x14fd('0x24')]);module['exports']=router; \ No newline at end of file +var _0x6bd4=['addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify'];(function(_0x431b40,_0x59411a){var _0x6a007=function(_0x3cfedc){while(--_0x3cfedc){_0x431b40['push'](_0x431b40['shift']());}};_0x6a007(++_0x59411a);}(_0x6bd4,0x1b9));var _0x46bd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6bd4[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x46bd('0x0'));var util=require(_0x46bd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46bd('0x2'));var router=express[_0x46bd('0x3')]();var fs_extra=require(_0x46bd('0x4'));var auth=require(_0x46bd('0x5'));var interaction=require(_0x46bd('0x6'));var config=require('../../config/environment');var controller=require(_0x46bd('0x7'));router[_0x46bd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x46bd('0x8')](_0x46bd('0x9'),auth[_0x46bd('0xa')](),controller[_0x46bd('0xb')]);router[_0x46bd('0x8')](_0x46bd('0xc'),auth[_0x46bd('0xa')](),controller[_0x46bd('0xd')]);router[_0x46bd('0x8')](_0x46bd('0xe'),auth[_0x46bd('0xa')](),controller[_0x46bd('0xf')]);router[_0x46bd('0x8')](_0x46bd('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x46bd('0x8')](_0x46bd('0x11'),auth['isAuthenticated'](),controller[_0x46bd('0x12')]);router[_0x46bd('0x8')](_0x46bd('0x13'),auth[_0x46bd('0xa')](),controller[_0x46bd('0x14')]);router['get'](_0x46bd('0x15'),auth[_0x46bd('0xa')](),controller[_0x46bd('0x16')]);router[_0x46bd('0x17')]('/',auth['isAuthenticated'](),controller[_0x46bd('0x18')]);router[_0x46bd('0x17')](_0x46bd('0xe'),auth[_0x46bd('0xa')](),controller['addDisposition']);router[_0x46bd('0x17')](_0x46bd('0x10'),auth['isAuthenticated'](),controller[_0x46bd('0x19')]);router[_0x46bd('0x17')](_0x46bd('0x1a'),controller['notify']);router[_0x46bd('0x17')]('/:id/applications',auth[_0x46bd('0xa')](),controller[_0x46bd('0x1b')]);router[_0x46bd('0x17')](_0x46bd('0x15'),auth['isAuthenticated'](),controller[_0x46bd('0x1c')]);router[_0x46bd('0x17')](_0x46bd('0x1d'),auth[_0x46bd('0xa')](),controller[_0x46bd('0x1e')]);router[_0x46bd('0x1f')](_0x46bd('0xc'),auth['isAuthenticated'](),controller[_0x46bd('0x20')]);router[_0x46bd('0x21')](_0x46bd('0xc'),auth['isAuthenticated'](),controller[_0x46bd('0x22')]);router[_0x46bd('0x21')]('/:id/dispositions',auth[_0x46bd('0xa')](),controller[_0x46bd('0x23')]);router[_0x46bd('0x21')](_0x46bd('0x10'),auth[_0x46bd('0xa')](),controller[_0x46bd('0x24')]);router[_0x46bd('0x21')]('/:id/users',auth[_0x46bd('0xa')](),controller[_0x46bd('0x25')]);module[_0x46bd('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 431a520..63e8030 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 _0xe68e=['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'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xe68e,0x1f2));var _0xee68=function(_0x164b96,_0x12f735){_0x164b96=_0x164b96-0x0;var _0x5489d9=_0xe68e[_0x164b96];return _0x5489d9;};'use strict';var Sequelize=require(_0xee68('0x0'));var rs=require(_0xee68('0x1'));module[_0xee68('0x2')]={'name':{'type':Sequelize[_0xee68('0x3')],'unique':_0xee68('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xee68('0x3')]},'token':{'type':Sequelize[_0xee68('0x3')],'defaultValue':function(){return rs[_0xee68('0x5')]();}},'replyUri':{'type':Sequelize[_0xee68('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xee68('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xee68('0x6')],'defaultValue':function(){return _0xee68('0x7');}},'notificationSound':{'type':Sequelize[_0xee68('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee68('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee68('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xee68('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xee68('0x3')]},'queueTransfer':{'type':Sequelize[_0xee68('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee68('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xee68('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xee68('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xee68('0x8')],'defaultValue':![],'comment':_0xee68('0xb'),'set':function(_0x2dec40){if(!_0x2dec40)this[_0xee68('0xc')]('mandatoryDispositionPauseId',null);this[_0xee68('0xc')](_0xee68('0xd'),_0x2dec40);}}}; \ No newline at end of file +var _0x3c26=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x27baa5,_0x1f5ddf){var _0x467edc=function(_0x49f7d2){while(--_0x49f7d2){_0x27baa5['push'](_0x27baa5['shift']());}};_0x467edc(++_0x1f5ddf);}(_0x3c26,0x10c));var _0x63c2=function(_0x3a5412,_0x1a4b98){_0x3a5412=_0x3a5412-0x0;var _0x56b238=_0x3c26[_0x3a5412];return _0x56b238;};'use strict';var Sequelize=require(_0x63c2('0x0'));var rs=require(_0x63c2('0x1'));module[_0x63c2('0x2')]={'name':{'type':Sequelize[_0x63c2('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x63c2('0x3')]},'token':{'type':Sequelize[_0x63c2('0x3')],'defaultValue':function(){return rs[_0x63c2('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x63c2('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x63c2('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x63c2('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x63c2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x63c2('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x63c2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x63c2('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x63c2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x63c2('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x63c2('0x6')],'defaultValue':![],'comment':_0x63c2('0x9'),'set':function(_0x5e4344){if(!_0x5e4344)this[_0x63c2('0xa')](_0x63c2('0xb'),null);this[_0x63c2('0xa')](_0x63c2('0xc'),_0x5e4344);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 56e286b..55f52c1 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 _0x1c9c=['defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','map','OpenchannelAccount','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','mandatoryDispositionPause','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','include','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','ListId','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','waitForTheAssignedAgent','OpenchannelQueue','queueId','waitForTheAssignedQueue','startRouting','EventManager','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','getApplications','nolimit','order','Contact','Owner','internal','Tags','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','push','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x1c9c,0xa7));var _0xc1c9=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0x1c9c[_0xb4e052];return _0x5197e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1c9('0x0'));var zipdir=require(_0xc1c9('0x1'));var jsonpatch=require(_0xc1c9('0x2'));var rp=require(_0xc1c9('0x3'));var moment=require('moment');var BPromise=require(_0xc1c9('0x4'));var Mustache=require(_0xc1c9('0x5'));var util=require(_0xc1c9('0x6'));var path=require(_0xc1c9('0x7'));var sox=require(_0xc1c9('0x8'));var csv=require(_0xc1c9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1c9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc1c9('0xb'));var jsforce=require(_0xc1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1c9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc1c9('0xd'));var authService=require(_0xc1c9('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1c9('0xf'));var logger=require(_0xc1c9('0x10'))(_0xc1c9('0x11'));var utils=require(_0xc1c9('0x12'));var config=require(_0xc1c9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c9('0x14'))['db'];config['redis']=_[_0xc1c9('0x15')](config[_0xc1c9('0x16')],{'host':_0xc1c9('0x17'),'port':0x18eb});var socket=require(_0xc1c9('0x18'))(new Redis(config[_0xc1c9('0x16')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xc1c9('0x19'));var client=jayson[_0xc1c9('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0xc1c9('0x1a')][_0xc1c9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1abd7a,_0x3a0947,_0x35a90a,_0x12f51a){return new BPromise(function(_0x3bc28c,_0x507ea4){var _0xe29a5a=_0x12f51a||client;return _0xe29a5a[_0xc1c9('0x1c')](_0x1abd7a,_0x35a90a)[_0xc1c9('0x1d')](function(_0x504351){logger[_0xc1c9('0x1e')](_0xc1c9('0x1f'),_0x3a0947,_0xc1c9('0x20'));logger[_0xc1c9('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3a0947,_0xc1c9('0x20'),JSON[_0xc1c9('0x22')](_0x504351));if(_0x504351[_0xc1c9('0x23')]){if(_0x504351[_0xc1c9('0x23')][_0xc1c9('0x24')]===0x1f4){logger[_0xc1c9('0x23')](_0xc1c9('0x1f'),_0x3a0947,_0x504351['error'][_0xc1c9('0x25')]);return _0x507ea4(_0x504351[_0xc1c9('0x23')]['message']);}logger[_0xc1c9('0x23')](_0xc1c9('0x1f'),_0x3a0947,_0x504351[_0xc1c9('0x23')][_0xc1c9('0x25')]);return _0x3bc28c(_0x504351[_0xc1c9('0x23')][_0xc1c9('0x25')]);}else{logger[_0xc1c9('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x3a0947,'request\x20sent');_0x3bc28c(_0x504351['result'][_0xc1c9('0x25')]);}})[_0xc1c9('0x26')](function(_0x517381){logger[_0xc1c9('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x3a0947,_0x517381);_0x507ea4(_0x517381);});});}function respondWithStatusCode(_0x1571e4,_0x3fbc2c){_0x3fbc2c=_0x3fbc2c||0xcc;return function(_0x5622b2){if(_0x5622b2){return _0x1571e4[_0xc1c9('0x27')](_0x3fbc2c);}return _0x1571e4['status'](_0x3fbc2c)[_0xc1c9('0x28')]();};}function respondWithResult(_0x2bf744,_0x460e1c){_0x460e1c=_0x460e1c||0xc8;return function(_0x357671){if(_0x357671){return _0x2bf744[_0xc1c9('0x29')](_0x460e1c)[_0xc1c9('0x2a')](_0x357671);}};}function respondWithFilteredResult(_0x367559,_0x39e875){return function(_0x472a5b){if(_0x472a5b){var _0x1c261b=typeof _0x39e875[_0xc1c9('0x2b')]===_0xc1c9('0x2c')&&typeof _0x39e875[_0xc1c9('0x2d')]==='undefined';var _0x46b6b7=_0x472a5b[_0xc1c9('0x2e')];var _0x31a2d9=_0x1c261b?0x0:_0x39e875['offset'];var _0x2d6b20=_0x1c261b?_0x472a5b[_0xc1c9('0x2e')]:_0x39e875[_0xc1c9('0x2b')]+_0x39e875['limit'];var _0x5335c3;if(_0x2d6b20>=_0x46b6b7){_0x2d6b20=_0x46b6b7;_0x5335c3=0xc8;}else{_0x5335c3=0xce;}_0x367559['status'](_0x5335c3);return _0x367559['set'](_0xc1c9('0x2f'),_0x31a2d9+'-'+_0x2d6b20+'/'+_0x46b6b7)[_0xc1c9('0x2a')](_0x472a5b);}return null;};}function patchUpdates(_0x5d70bf){return function(_0x47b3b5){try{jsonpatch[_0xc1c9('0x30')](_0x47b3b5,_0x5d70bf,!![]);}catch(_0x34424d){return BPromise['reject'](_0x34424d);}return _0x47b3b5[_0xc1c9('0x31')]();};}function saveUpdates(_0x38bcfe,_0x4d70cd){return function(_0x484449){if(_0x484449){return _0x484449[_0xc1c9('0x32')](_0x38bcfe)['then'](function(_0xa75f02){return _0xa75f02;});}return null;};}function removeEntity(_0x2252b9,_0x5e6c78){return function(_0x4efe3d){if(_0x4efe3d){return _0x4efe3d[_0xc1c9('0x33')]()['then'](function(){var _0x43b4a2=_0x4efe3d['get']({'plain':!![]});var _0x4622cc=_0xc1c9('0x34');return db[_0xc1c9('0x35')][_0xc1c9('0x33')]({'where':{'type':_0x4622cc,'resourceId':_0x43b4a2['id']}})['then'](function(){return _0x4efe3d;});})[_0xc1c9('0x1d')](function(){_0x2252b9[_0xc1c9('0x29')](0xcc)[_0xc1c9('0x28')]();});}};}function handleEntityNotFound(_0x3e0485,_0x255967){return function(_0x583075){if(!_0x583075){_0x3e0485['sendStatus'](0x194);}return _0x583075;};}function handleError(_0x454db5,_0x1c1674){_0x1c1674=_0x1c1674||0x1f4;return function(_0x592ca6){logger[_0xc1c9('0x23')](_0x592ca6[_0xc1c9('0x36')]);if(_0x592ca6[_0xc1c9('0x37')]){delete _0x592ca6[_0xc1c9('0x37')];}_0x454db5[_0xc1c9('0x29')](_0x1c1674)[_0xc1c9('0x38')](_0x592ca6);};}exports[_0xc1c9('0x39')]=function(_0x5ab2fd,_0x142cb8){var _0x19e806={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1e4e9f={},_0x2bcf85={'count':0x0,'rows':[]};var _0x144dfd=_[_0xc1c9('0x3a')](db[_0xc1c9('0x3b')][_0xc1c9('0x3c')],function(_0x4de169){return{'name':_0x4de169[_0xc1c9('0x3d')],'type':_0x4de169[_0xc1c9('0x3e')][_0xc1c9('0x3f')]};});_0x1e4e9f['model']=_['map'](_0x144dfd,'name');_0x1e4e9f['query']=_[_0xc1c9('0x40')](_0x5ab2fd[_0xc1c9('0x41')]);_0x1e4e9f[_0xc1c9('0x42')]=_['intersection'](_0x1e4e9f[_0xc1c9('0x43')],_0x1e4e9f[_0xc1c9('0x41')]);_0x19e806[_0xc1c9('0x44')]=_[_0xc1c9('0x45')](_0x1e4e9f[_0xc1c9('0x43')],qs[_0xc1c9('0x46')](_0x5ab2fd[_0xc1c9('0x41')]['fields']));_0x19e806[_0xc1c9('0x44')]=_0x19e806[_0xc1c9('0x44')][_0xc1c9('0x47')]?_0x19e806[_0xc1c9('0x44')]:_0x1e4e9f[_0xc1c9('0x43')];if(!_0x5ab2fd['query'][_0xc1c9('0x48')]('nolimit')){_0x19e806[_0xc1c9('0x2d')]=qs[_0xc1c9('0x2d')](_0x5ab2fd[_0xc1c9('0x41')][_0xc1c9('0x2d')]);_0x19e806[_0xc1c9('0x2b')]=qs[_0xc1c9('0x2b')](_0x5ab2fd[_0xc1c9('0x41')][_0xc1c9('0x2b')]);}_0x19e806['order']=qs[_0xc1c9('0x49')](_0x5ab2fd['query'][_0xc1c9('0x49')]);_0x19e806[_0xc1c9('0x4a')]=qs[_0xc1c9('0x42')](_['pick'](_0x5ab2fd[_0xc1c9('0x41')],_0x1e4e9f[_0xc1c9('0x42')]),_0x144dfd);if(_0x5ab2fd['query'][_0xc1c9('0x4b')]){_0x19e806[_0xc1c9('0x4a')]=_[_0xc1c9('0x4c')](_0x19e806[_0xc1c9('0x4a')],{'$or':_[_0xc1c9('0x3a')](_0x144dfd,function(_0xb0ca14){if(_0xb0ca14[_0xc1c9('0x3e')]!==_0xc1c9('0x4d')){var _0x3a9b24={};_0x3a9b24[_0xb0ca14[_0xc1c9('0x37')]]={'$like':'%'+_0x5ab2fd[_0xc1c9('0x41')][_0xc1c9('0x4b')]+'%'};return _0x3a9b24;}})});}_0x19e806=_[_0xc1c9('0x4c')]({},_0x19e806,_0x5ab2fd[_0xc1c9('0x4e')]);var _0x39d5e1={'where':_0x19e806[_0xc1c9('0x4a')]};return db[_0xc1c9('0x3b')]['count'](_0x39d5e1)[_0xc1c9('0x1d')](function(_0x35ed42){_0x2bcf85['count']=_0x35ed42;if(_0x5ab2fd['query'][_0xc1c9('0x4f')]){_0x19e806['include']=[{'all':!![]}];}return db[_0xc1c9('0x3b')][_0xc1c9('0x50')](_0x19e806);})[_0xc1c9('0x1d')](function(_0x4c2075){_0x2bcf85[_0xc1c9('0x51')]=_0x4c2075;return _0x2bcf85;})[_0xc1c9('0x1d')](respondWithFilteredResult(_0x142cb8,_0x19e806))[_0xc1c9('0x26')](handleError(_0x142cb8,null));};exports['show']=function(_0x3d3b61,_0x428b1c){var _0x46ac67={'raw':![],'where':{'id':_0x3d3b61[_0xc1c9('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xc1c9('0x53')}]},_0x47cc22={};_0x47cc22['model']=_[_0xc1c9('0x40')](db[_0xc1c9('0x3b')][_0xc1c9('0x3c')]);_0x47cc22[_0xc1c9('0x41')]=_[_0xc1c9('0x40')](_0x3d3b61[_0xc1c9('0x41')]);_0x47cc22[_0xc1c9('0x42')]=_[_0xc1c9('0x45')](_0x47cc22['model'],_0x47cc22[_0xc1c9('0x41')]);_0x46ac67[_0xc1c9('0x44')]=_[_0xc1c9('0x45')](_0x47cc22[_0xc1c9('0x43')],qs[_0xc1c9('0x46')](_0x3d3b61[_0xc1c9('0x41')]['fields']));_0x46ac67[_0xc1c9('0x44')]=_0x46ac67['attributes']['length']?_0x46ac67[_0xc1c9('0x44')]:_0x47cc22[_0xc1c9('0x43')];if(_0x3d3b61[_0xc1c9('0x41')][_0xc1c9('0x4f')]){_0x46ac67['include']=[{'all':!![]}];}_0x46ac67=_[_0xc1c9('0x4c')]({},_0x46ac67,_0x3d3b61[_0xc1c9('0x4e')]);return db[_0xc1c9('0x3b')][_0xc1c9('0x54')](_0x46ac67)[_0xc1c9('0x1d')](handleEntityNotFound(_0x428b1c,null))['then'](respondWithResult(_0x428b1c,null))[_0xc1c9('0x26')](handleError(_0x428b1c,null));};exports['create']=function(_0x29365a,_0x2d1cd5){return db[_0xc1c9('0x3b')][_0xc1c9('0x55')](_0x29365a[_0xc1c9('0x56')],{})['then'](function(_0x42fa4f){var _0x54196b=_0x29365a['user'][_0xc1c9('0x57')]({'plain':!![]});if(!_0x54196b)throw new Error(_0xc1c9('0x58'));if(_0x54196b[_0xc1c9('0x59')]===_0xc1c9('0x5a')){var _0x3724f4=_0x42fa4f[_0xc1c9('0x57')]({'plain':!![]});var _0x59b6f0=_0xc1c9('0x34');return db[_0xc1c9('0x5b')][_0xc1c9('0x54')]({'where':{'name':_0x59b6f0,'userProfileId':_0x54196b[_0xc1c9('0x5c')]},'raw':!![]})[_0xc1c9('0x1d')](function(_0x34bc75){if(_0x34bc75&&_0x34bc75['autoAssociation']===0x0){return db[_0xc1c9('0x35')][_0xc1c9('0x55')]({'name':_0x3724f4[_0xc1c9('0x37')],'resourceId':_0x3724f4['id'],'type':_0x34bc75[_0xc1c9('0x37')],'sectionId':_0x34bc75['id']},{})['then'](function(){return _0x42fa4f;});}else{return _0x42fa4f;}})[_0xc1c9('0x26')](function(_0x58255b){logger[_0xc1c9('0x23')](_0xc1c9('0x5d'),_0x58255b);throw _0x58255b;});}return _0x42fa4f;})[_0xc1c9('0x1d')](respondWithResult(_0x2d1cd5,0xc9))['catch'](handleError(_0x2d1cd5,null));};exports[_0xc1c9('0x32')]=function(_0xc765d6,_0x534437){if(_0xc765d6['body']['id']){delete _0xc765d6[_0xc1c9('0x56')]['id'];}return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0xc765d6['params']['id']},'include':[{'model':db[_0xc1c9('0x5e')],'as':_0xc1c9('0x53')}]})['then'](handleEntityNotFound(_0x534437,null))[_0xc1c9('0x1d')](saveUpdates(_0xc765d6['body'],null))[_0xc1c9('0x1d')](respondWithResult(_0x534437,null))['catch'](handleError(_0x534437,null));};exports[_0xc1c9('0x33')]=function(_0x306e0e,_0x367f14){return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0x306e0e[_0xc1c9('0x52')]['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x367f14,null))['then'](removeEntity(_0x367f14,null))[_0xc1c9('0x26')](handleError(_0x367f14,null));};exports[_0xc1c9('0x5f')]=function(_0x12f082,_0x5184f4){return db[_0xc1c9('0x3b')][_0xc1c9('0x5f')]()[_0xc1c9('0x1d')](respondWithResult(_0x5184f4,null))[_0xc1c9('0x26')](handleError(_0x5184f4,null));};exports[_0xc1c9('0x60')]=function(_0x1fc33a,_0x56648d,_0xc30951){if(_0x1fc33a[_0xc1c9('0x56')]['id']){delete _0x1fc33a[_0xc1c9('0x56')]['id'];}return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0x1fc33a['params']['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x56648d,null))[_0xc1c9('0x1d')](function(_0x48a28e){if(_0x48a28e){_0x1fc33a[_0xc1c9('0x56')][_0xc1c9('0x61')]=_0x48a28e['id'];return db[_0xc1c9('0x62')]['create'](_0x1fc33a['body']);}})[_0xc1c9('0x1d')](respondWithResult(_0x56648d,null))[_0xc1c9('0x26')](handleError(_0x56648d,null));};exports[_0xc1c9('0x63')]=function(_0x161192,_0x4831b3,_0x5ac05a){var _0x4dc64d={'raw':![],'where':{}};var _0x37a8f4={};var _0x2388e8={'count':0x0,'rows':[]};return db[_0xc1c9('0x3b')][_0xc1c9('0x64')]({'where':{'id':_0x161192[_0xc1c9('0x52')]['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x4831b3,null))['then'](function(_0x11afdb){if(_0x11afdb){_0x37a8f4[_0xc1c9('0x43')]=_[_0xc1c9('0x40')](db[_0xc1c9('0x62')][_0xc1c9('0x3c')]);_0x37a8f4[_0xc1c9('0x41')]=_[_0xc1c9('0x40')](_0x161192['query']);_0x37a8f4[_0xc1c9('0x42')]=_['intersection'](_0x37a8f4['model'],_0x37a8f4[_0xc1c9('0x41')]);_0x4dc64d[_0xc1c9('0x44')]=_[_0xc1c9('0x45')](_0x37a8f4[_0xc1c9('0x43')],qs['fields'](_0x161192[_0xc1c9('0x41')][_0xc1c9('0x46')]));_0x4dc64d[_0xc1c9('0x44')]=_0x4dc64d[_0xc1c9('0x44')][_0xc1c9('0x47')]?_0x4dc64d[_0xc1c9('0x44')]:_0x37a8f4['model'];if(!_0x161192['query'][_0xc1c9('0x48')]('nolimit')){_0x4dc64d['limit']=qs[_0xc1c9('0x2d')](_0x161192[_0xc1c9('0x41')][_0xc1c9('0x2d')]);_0x4dc64d[_0xc1c9('0x2b')]=qs[_0xc1c9('0x2b')](_0x161192[_0xc1c9('0x41')][_0xc1c9('0x2b')]);}_0x4dc64d['order']=qs[_0xc1c9('0x49')](_0x161192['query'][_0xc1c9('0x49')]);_0x4dc64d[_0xc1c9('0x4a')]=qs[_0xc1c9('0x42')](_[_0xc1c9('0x65')](_0x161192[_0xc1c9('0x41')],_0x37a8f4[_0xc1c9('0x42')]));_0x4dc64d[_0xc1c9('0x4a')][_0xc1c9('0x61')]=_0x11afdb['id'];if(_0x161192[_0xc1c9('0x41')][_0xc1c9('0x4b')]){_0x4dc64d[_0xc1c9('0x4a')]=_[_0xc1c9('0x4c')](_0x4dc64d[_0xc1c9('0x4a')],{'$or':_[_0xc1c9('0x3a')](_0x4dc64d[_0xc1c9('0x44')],function(_0x6f467e){var _0x5aeefd={};_0x5aeefd[_0x6f467e]={'$like':'%'+_0x161192[_0xc1c9('0x41')]['filter']+'%'};return _0x5aeefd;})});}_0x4dc64d=_[_0xc1c9('0x4c')]({},_0x4dc64d,_0x161192[_0xc1c9('0x4e')]);return db['Disposition'][_0xc1c9('0x2e')]({'where':_0x4dc64d[_0xc1c9('0x4a')]})[_0xc1c9('0x1d')](function(_0x1f0c74){_0x2388e8[_0xc1c9('0x2e')]=_0x1f0c74;if(_0x161192[_0xc1c9('0x41')][_0xc1c9('0x4f')]){_0x4dc64d[_0xc1c9('0x66')]=[{'all':!![]}];}return db['Disposition'][_0xc1c9('0x50')](_0x4dc64d);})[_0xc1c9('0x1d')](function(_0x1ed3d0){_0x2388e8[_0xc1c9('0x51')]=_0x1ed3d0;return _0x2388e8;});}})[_0xc1c9('0x1d')](respondWithFilteredResult(_0x4831b3,_0x4dc64d))[_0xc1c9('0x26')](handleError(_0x4831b3,null));};exports['removeDispositions']=function(_0x15de9d,_0xbfa3f9,_0x3df674){return db['OpenchannelAccount'][_0xc1c9('0x54')]({'where':{'id':_0x15de9d[_0xc1c9('0x52')]['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0xbfa3f9,null))[_0xc1c9('0x1d')](function(_0x19a8fd){if(_0x19a8fd){return _0x19a8fd[_0xc1c9('0x67')](_0x15de9d[_0xc1c9('0x41')]['ids']);}})['then'](respondWithStatusCode(_0xbfa3f9,null))[_0xc1c9('0x26')](handleError(_0xbfa3f9,null));};exports[_0xc1c9('0x68')]=function(_0x50a400,_0x82397,_0x11d19f){if(_0x50a400['body']['id']){delete _0x50a400[_0xc1c9('0x56')]['id'];}return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0x50a400[_0xc1c9('0x52')]['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x82397,null))['then'](function(_0x124328){if(_0x124328){_0x50a400['body'][_0xc1c9('0x61')]=_0x124328['id'];return db[_0xc1c9('0x69')][_0xc1c9('0x55')](_0x50a400[_0xc1c9('0x56')]);}})['then'](respondWithResult(_0x82397,null))[_0xc1c9('0x26')](handleError(_0x82397,null));};exports[_0xc1c9('0x6a')]=function(_0x242a67,_0x3cdb96,_0x2f29ee){var _0x1ce6b0={'raw':![],'where':{}};var _0x2766e4={};var _0x469208={'count':0x0,'rows':[]};return db[_0xc1c9('0x3b')][_0xc1c9('0x64')]({'where':{'id':_0x242a67['params']['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x3cdb96,null))[_0xc1c9('0x1d')](function(_0xa4471b){if(_0xa4471b){_0x2766e4[_0xc1c9('0x43')]=_[_0xc1c9('0x40')](db['CannedAnswer'][_0xc1c9('0x3c')]);_0x2766e4['query']=_['keys'](_0x242a67['query']);_0x2766e4[_0xc1c9('0x42')]=_[_0xc1c9('0x45')](_0x2766e4[_0xc1c9('0x43')],_0x2766e4[_0xc1c9('0x41')]);_0x1ce6b0['attributes']=_[_0xc1c9('0x45')](_0x2766e4[_0xc1c9('0x43')],qs['fields'](_0x242a67[_0xc1c9('0x41')][_0xc1c9('0x46')]));_0x1ce6b0['attributes']=_0x1ce6b0[_0xc1c9('0x44')]['length']?_0x1ce6b0[_0xc1c9('0x44')]:_0x2766e4[_0xc1c9('0x43')];if(!_0x242a67[_0xc1c9('0x41')]['hasOwnProperty']('nolimit')){_0x1ce6b0[_0xc1c9('0x2d')]=qs['limit'](_0x242a67[_0xc1c9('0x41')][_0xc1c9('0x2d')]);_0x1ce6b0[_0xc1c9('0x2b')]=qs[_0xc1c9('0x2b')](_0x242a67['query'][_0xc1c9('0x2b')]);}_0x1ce6b0['order']=qs['sort'](_0x242a67[_0xc1c9('0x41')]['sort']);_0x1ce6b0[_0xc1c9('0x4a')]=qs[_0xc1c9('0x42')](_['pick'](_0x242a67['query'],_0x2766e4['filters']));_0x1ce6b0['where']['OpenchannelAccountId']=_0xa4471b['id'];if(_0x242a67[_0xc1c9('0x41')][_0xc1c9('0x4b')]){_0x1ce6b0[_0xc1c9('0x4a')]=_[_0xc1c9('0x4c')](_0x1ce6b0[_0xc1c9('0x4a')],{'$or':_['map'](_0x1ce6b0[_0xc1c9('0x44')],function(_0x1b285e){var _0x2d1fd4={};_0x2d1fd4[_0x1b285e]={'$like':'%'+_0x242a67['query'][_0xc1c9('0x4b')]+'%'};return _0x2d1fd4;})});}_0x1ce6b0=_[_0xc1c9('0x4c')]({},_0x1ce6b0,_0x242a67[_0xc1c9('0x4e')]);return db['CannedAnswer'][_0xc1c9('0x2e')]({'where':_0x1ce6b0[_0xc1c9('0x4a')]})['then'](function(_0x528da1){_0x469208['count']=_0x528da1;if(_0x242a67[_0xc1c9('0x41')][_0xc1c9('0x4f')]){_0x1ce6b0[_0xc1c9('0x66')]=[{'all':!![]}];}return db[_0xc1c9('0x69')][_0xc1c9('0x50')](_0x1ce6b0);})[_0xc1c9('0x1d')](function(_0x58b672){_0x469208[_0xc1c9('0x51')]=_0x58b672;return _0x469208;});}})[_0xc1c9('0x1d')](respondWithFilteredResult(_0x3cdb96,_0x1ce6b0))[_0xc1c9('0x26')](handleError(_0x3cdb96,null));};exports['removeAnswers']=function(_0x50fb52,_0x2fadd7,_0x480793){return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0x50fb52['params']['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x2fadd7,null))[_0xc1c9('0x1d')](function(_0x14765a){if(_0x14765a){return _0x14765a[_0xc1c9('0x6b')](_0x50fb52[_0xc1c9('0x41')]['ids']);}})[_0xc1c9('0x1d')](respondWithStatusCode(_0x2fadd7,null))[_0xc1c9('0x26')](handleError(_0x2fadd7,null));};exports[_0xc1c9('0x6c')]=function(_0x14b67b,_0x2b2cab,_0x5b1e7f){var _0x249c41={'body':_0x14b67b['body'],'channel':_0xc1c9('0x6d')};var _0x2f7f10=[];var _0x14a978=[];var _0x498e60={};var _0xea974f=![];return db['CmContact']['describe']()['then'](function(_0x18c3d5){if(!_0x18c3d5){throw new db[(_0xc1c9('0x6e'))][(_0xc1c9('0x6f'))](_0xc1c9('0x70'));}_0x2f7f10=_['difference'](_['keys'](_0x18c3d5),[_0xc1c9('0x71'),'updatedAt']);_0x14a978=_[_0xc1c9('0x72')](_[_0xc1c9('0x40')](_0x18c3d5),['createdAt',_0xc1c9('0x73'),'CompanyId','ListId']);if(_0x14b67b[_0xc1c9('0x56')]['id']){delete _0x14b67b[_0xc1c9('0x56')]['id'];}if(_[_0xc1c9('0x74')](_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x75')])){throw new db[(_0xc1c9('0x6e'))][(_0xc1c9('0x6f'))](_0xc1c9('0x76'));}if(_['isNil'](_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x56')])||_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x56')]===''){throw new db[(_0xc1c9('0x6e'))]['ValidationError'](_0xc1c9('0x77'));}if(_[_0xc1c9('0x74')](_0x14b67b['body'][_0xc1c9('0x78')])){throw new db[(_0xc1c9('0x6e'))][(_0xc1c9('0x6f'))](_0xc1c9('0x79')+_0x14a978);}if(!_['includes'](_0x14a978,_0x14b67b[_0xc1c9('0x56')]['mapKey'])){throw new db[(_0xc1c9('0x6e'))][(_0xc1c9('0x6f'))](_0xc1c9('0x7a')+_0x14a978);}_0x498e60[_0x14b67b['body'][_0xc1c9('0x78')]]=_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x75')];})[_0xc1c9('0x1d')](function(){return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0x14b67b['params']['id']},'include':[{'model':db[_0xc1c9('0x7b')],'as':_0xc1c9('0x7c'),'include':[{'model':db[_0xc1c9('0x7d')],'as':_0xc1c9('0x7e'),'where':_0x498e60,'limit':0x1,'order':[['updatedAt',_0xc1c9('0x7f')]]}]},{'model':db[_0xc1c9('0x80')],'as':_0xc1c9('0x81')}]});})[_0xc1c9('0x1d')](handleEntityNotFound(_0x2b2cab,null))[_0xc1c9('0x1d')](function(_0x4f293c){if(_0x4f293c&&_0x4f293c[_0xc1c9('0x7c')]){_0x249c41[_0xc1c9('0x82')]=_0x4f293c;_0x249c41[_0xc1c9('0x83')]=_0x4f293c[_0xc1c9('0x81')];_0x249c41[_0xc1c9('0x84')]=_0x4f293c[_0xc1c9('0x7c')];_0x249c41['applications']=_[_0xc1c9('0x85')](_0x249c41['applications'],['priority'],[_0xc1c9('0x86')]);if(_0x249c41['account'][_0xc1c9('0x81')]){delete _0x249c41[_0xc1c9('0x82')][_0xc1c9('0x81')];}if(_0x249c41['account']['List']&&_0x249c41['account'][_0xc1c9('0x7c')]['Contacts'][_0xc1c9('0x47')]){return _0x249c41['account']['List'][_0xc1c9('0x7e')][0x0];}var _0x9ea057=_[_0xc1c9('0x15')](_0x14b67b['body'],{'firstName':_0x14b67b[_0xc1c9('0x56')]['from'],'ListId':_0x4f293c[_0xc1c9('0x87')]});_0x9ea057[_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x78')]]=_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x75')];return db['CmContact']['create'](_0x9ea057,{'fields':_0x2f7f10,'raw':!![]});}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x2b2cab,null))['then'](function(_0x557a2f){_0x249c41['contact']=_0x557a2f;if(_0x557a2f){var _0x4baa96={'ContactId':_0x557a2f['id'],'OpenchannelAccountId':_0x14b67b[_0xc1c9('0x52')]['id'],'from':(_0x557a2f['firstName']||'')+'\x20'+(_0x557a2f[_0xc1c9('0x88')]||'')};var _0xccd4a4={'OpenchannelAccountId':_0x14b67b[_0xc1c9('0x52')]['id'],'closed':![]};if(_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x89')]){_0xccd4a4[_0xc1c9('0x89')]=_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x89')];return db[_0xc1c9('0x8a')]['find']({'where':_0xccd4a4})['then'](function(_0x1de7fc){if(_0x1de7fc){return[_0x1de7fc,![]];}_0x4baa96[_0xc1c9('0x89')]=_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x89')];_0x4baa96[_0xc1c9('0x8b')]=_0x14b67b['body'][_0xc1c9('0x8b')];return db[_0xc1c9('0x8a')]['create'](_0x4baa96)[_0xc1c9('0x1d')](function(_0x560f30){return[_0x560f30,!![]];});});}else{_0xccd4a4[_0xc1c9('0x89')]=null;}_0xccd4a4[_0xc1c9('0x8c')]=_0x557a2f['id'];return db[_0xc1c9('0x8a')][_0xc1c9('0x54')]({'where':_0xccd4a4})[_0xc1c9('0x1d')](function(_0x189365){if(_0x189365){return[_0x189365,![]];}return db['OpenchannelInteraction'][_0xc1c9('0x55')](_0x4baa96)[_0xc1c9('0x1d')](function(_0x4f849e){return[_0x4f849e,!![]];});});}})[_0xc1c9('0x8d')](function(_0x30acc3,_0xada8a7){if(_0x30acc3){_0xea974f=_0xada8a7;if(!_0xada8a7){var _0x54be8e={'from':(_0x249c41[_0xc1c9('0x8e')][_0xc1c9('0x8f')]||'')+'\x20'+(_0x249c41[_0xc1c9('0x8e')][_0xc1c9('0x88')]||'')};if(_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x89')]&&_0x14b67b['body'][_0xc1c9('0x90')]&&_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x89')]!=_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x90')]){_0x54be8e['threadId']=_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x90')];}return _0x30acc3[_0xc1c9('0x32')](_0x54be8e);}else{return _0x30acc3;}}})[_0xc1c9('0x1d')](function(_0x438e68){_0x249c41[_0xc1c9('0x91')]=_0x438e68['get']({'plain':!![]});_0x249c41[_0xc1c9('0x91')][_0xc1c9('0x92')]=_0xea974f;if(_0x249c41[_0xc1c9('0x91')][_0xc1c9('0x92')]){if(_0x249c41[_0xc1c9('0x82')][_0xc1c9('0x93')]){_0x249c41['applications']['push']({'id':0x0,'priority':_0x249c41[_0xc1c9('0x83')][_0xc1c9('0x47')]+0x1,'app':_0xc1c9('0x94'),'appdata':'unmanaged','interval':_0xc1c9('0x95')});}}return db[_0xc1c9('0x96')][_0xc1c9('0x55')]({'body':_0x14b67b['body'][_0xc1c9('0x56')],'OpenchannelAccountId':_0x14b67b[_0xc1c9('0x52')]['id'],'OpenchannelInteractionId':_0x438e68['id'],'direction':'in','ContactId':_0x249c41[_0xc1c9('0x8e')]['id'],'AttachmentId':_0x14b67b[_0xc1c9('0x56')][_0xc1c9('0x97')]});})[_0xc1c9('0x1d')](function(_0x189952){_0x249c41['message']=_0x189952;if(!_0x249c41[_0xc1c9('0x91')]['UserId'])return;return db[_0xc1c9('0x98')][_0xc1c9('0x54')]({'attributes':['id',_0xc1c9('0x37')],'where':{'id':_0x249c41[_0xc1c9('0x91')]['UserId']}});})[_0xc1c9('0x1d')](function(_0x56212d){if(_0x56212d){_0x249c41['applications'][_0xc1c9('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x56212d[_0xc1c9('0x37')]+','+(_0x249c41[_0xc1c9('0x82')][_0xc1c9('0x9a')]||0xa),'interval':'*,*,*,*'});}if(!_0x249c41[_0xc1c9('0x91')]['queueId'])return;return db[_0xc1c9('0x9b')][_0xc1c9('0x54')]({'attributes':['id','name'],'where':{'id':_0x249c41[_0xc1c9('0x91')][_0xc1c9('0x9c')]}});})['then'](function(_0x2f092f){if(_0x2f092f){_0x249c41[_0xc1c9('0x83')][_0xc1c9('0x99')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2f092f[_0xc1c9('0x37')]+','+(_0x249c41[_0xc1c9('0x82')][_0xc1c9('0x9d')]||0x12c),'interval':_0xc1c9('0x95')});}return respondWithRpcPromise('Start',_0xc1c9('0x9e'),_0x249c41);})[_0xc1c9('0x1d')](function(_0x251ae0){respondWithRpcPromise('EventManager',_0xc1c9('0x9f'),{'event':_0xc1c9('0x6c'),'message':_0x251ae0},client9002);return _0x251ae0;})[_0xc1c9('0x1d')](respondWithResult(_0x2b2cab,null))[_0xc1c9('0x26')](handleError(_0x2b2cab,null));};exports['addApplications']=function(_0x5dfafa,_0x5e3a32){var _0x314555=_0x5dfafa[_0xc1c9('0x52')]['id'];var _0x134910=_0x5dfafa['body'];var _0x5d87f8=0xc8;var _0x57a01b=null;return db[_0xc1c9('0xa0')][_0xc1c9('0xa1')]({'isolationLevel':db[_0xc1c9('0xa0')]['Transaction'][_0xc1c9('0xa2')]['READ_COMMITTED']},function(_0x573ae4){return db[_0xc1c9('0x3b')][_0xc1c9('0x64')]({'where':{'id':_0x314555},'transaction':_0x573ae4})[_0xc1c9('0x1d')](function(_0x1b0493){if(_0x1b0493){return db[_0xc1c9('0x80')][_0xc1c9('0x33')]({'where':{'OpenchannelAccountId':_0x314555},'transaction':_0x573ae4})[_0xc1c9('0x1d')](function(){var _0x514311=_[_0xc1c9('0x3a')](_0x134910,function(_0x4d324b){_0x4d324b[_0xc1c9('0x61')]=_0x314555;return _0x4d324b;});return db[_0xc1c9('0x80')][_0xc1c9('0xa3')](_0x514311,{'transaction':_0x573ae4});});}else{_0x5d87f8=0x194;_0x57a01b=[];}});})[_0xc1c9('0x1d')](function(){if(_0x5d87f8!==0x194){return db[_0xc1c9('0x80')][_0xc1c9('0xa4')]({'where':{'OpenchannelAccountId':_0x314555},'order':_0xc1c9('0xa5')})['then'](function(_0x5019f3){_0x57a01b=_0x5019f3;});}})[_0xc1c9('0x26')](function(_0x57ec57){_0x5d87f8=0x1f4;logger['error'](_0x57ec57[_0xc1c9('0x36')]);if(_0x57ec57[_0xc1c9('0x37')]){delete _0x57ec57[_0xc1c9('0x37')];}_0x57a01b=_0x57ec57;})[_0xc1c9('0xa6')](function(){if(_0x57a01b===null){_0x5e3a32['sendStatus'](_0x5d87f8);}else{if(_0x5d87f8===0x1f4){_0x5e3a32[_0xc1c9('0x29')](_0x5d87f8)[_0xc1c9('0x38')](_0x57a01b);}else{_0x5e3a32[_0xc1c9('0x29')](_0x5d87f8)['json'](_0x57a01b);}}});};exports[_0xc1c9('0xa7')]=function(_0x1e7f11,_0xd03d33,_0x3958ad){var _0x530820={};var _0x1c9665={};var _0x583dd8;var _0x186ffe;return db[_0xc1c9('0x3b')][_0xc1c9('0x64')]({'where':{'id':_0x1e7f11[_0xc1c9('0x52')]['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0xd03d33,null))[_0xc1c9('0x1d')](function(_0x528dfb){if(_0x528dfb){_0x583dd8=_0x528dfb;_0x1c9665[_0xc1c9('0x43')]=_[_0xc1c9('0x40')](db['OpenchannelApplication'][_0xc1c9('0x3c')]);_0x1c9665[_0xc1c9('0x41')]=_[_0xc1c9('0x40')](_0x1e7f11['query']);_0x1c9665[_0xc1c9('0x42')]=_[_0xc1c9('0x45')](_0x1c9665[_0xc1c9('0x43')],_0x1c9665[_0xc1c9('0x41')]);_0x530820['attributes']=_[_0xc1c9('0x45')](_0x1c9665[_0xc1c9('0x43')],qs[_0xc1c9('0x46')](_0x1e7f11[_0xc1c9('0x41')]['fields']));_0x530820[_0xc1c9('0x44')]=_0x530820[_0xc1c9('0x44')][_0xc1c9('0x47')]?_0x530820[_0xc1c9('0x44')]:_0x1c9665[_0xc1c9('0x43')];_0x530820['order']=qs[_0xc1c9('0x49')](_0x1e7f11['query'][_0xc1c9('0x49')]);_0x530820[_0xc1c9('0x4a')]=qs['filters'](_[_0xc1c9('0x65')](_0x1e7f11[_0xc1c9('0x41')],_0x1c9665[_0xc1c9('0x42')]));if(_0x1e7f11[_0xc1c9('0x41')][_0xc1c9('0x4b')]){_0x530820[_0xc1c9('0x4a')]=_[_0xc1c9('0x4c')](_0x530820[_0xc1c9('0x4a')],{'$or':_[_0xc1c9('0x3a')](_0x530820['attributes'],function(_0x4c7dcb){var _0x405f9e={};_0x405f9e[_0x4c7dcb]={'$like':'%'+_0x1e7f11[_0xc1c9('0x41')][_0xc1c9('0x4b')]+'%'};return _0x405f9e;})});}_0x530820=_[_0xc1c9('0x4c')]({},_0x530820,_0x1e7f11['options']);return _0x583dd8[_0xc1c9('0xa7')](_0x530820);}})[_0xc1c9('0x1d')](function(_0x59f826){if(_0x59f826){_0x186ffe=_0x59f826['length'];if(!_0x1e7f11['query'][_0xc1c9('0x48')](_0xc1c9('0xa8'))){_0x530820[_0xc1c9('0x2d')]=qs[_0xc1c9('0x2d')](_0x1e7f11['query']['limit']);_0x530820[_0xc1c9('0x2b')]=qs[_0xc1c9('0x2b')](_0x1e7f11[_0xc1c9('0x41')]['offset']);}return _0x583dd8['getApplications'](_0x530820);}})[_0xc1c9('0x1d')](function(_0xfbe419){if(_0xfbe419){return _0xfbe419?{'count':_0x186ffe,'rows':_0xfbe419}:null;}})[_0xc1c9('0x1d')](respondWithResult(_0xd03d33,null))[_0xc1c9('0x26')](handleError(_0xd03d33,null));};exports['getInteractions']=function(_0x3e413b,_0x30b0e8,_0x4c788d){var _0x1cfa38={'raw':![],'where':{}};var _0x5d5957={};var _0x5c249c={'count':0x0,'rows':[]};return db[_0xc1c9('0x3b')]['findOne']({'where':{'id':_0x3e413b[_0xc1c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x30b0e8,null))['then'](function(_0x30d991){if(_0x30d991){_0x5d5957['model']=_[_0xc1c9('0x40')](db[_0xc1c9('0x8a')][_0xc1c9('0x3c')]);_0x5d5957['query']=_[_0xc1c9('0x40')](_0x3e413b[_0xc1c9('0x41')]);_0x5d5957[_0xc1c9('0x42')]=_[_0xc1c9('0x45')](_0x5d5957[_0xc1c9('0x43')],_0x5d5957['query']);_0x1cfa38[_0xc1c9('0x44')]=_['intersection'](_0x5d5957[_0xc1c9('0x43')],qs[_0xc1c9('0x46')](_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x46')]));_0x1cfa38[_0xc1c9('0x44')]=_0x1cfa38['attributes'][_0xc1c9('0x47')]?_0x1cfa38['attributes']:_0x5d5957['model'];if(!_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x48')](_0xc1c9('0xa8'))){_0x1cfa38[_0xc1c9('0x2d')]=qs[_0xc1c9('0x2d')](_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x2d')]);_0x1cfa38[_0xc1c9('0x2b')]=qs[_0xc1c9('0x2b')](_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x2b')]);}_0x1cfa38[_0xc1c9('0xa9')]=qs[_0xc1c9('0x49')](_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x49')]);_0x1cfa38[_0xc1c9('0x4a')]=qs[_0xc1c9('0x42')](_[_0xc1c9('0x65')](_0x3e413b[_0xc1c9('0x41')],_0x5d5957[_0xc1c9('0x42')]));_0x1cfa38[_0xc1c9('0x4a')]['OpenchannelAccountId']=_0x30d991['id'];if(_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x4b')]){_0x1cfa38[_0xc1c9('0x4a')]=_[_0xc1c9('0x4c')](_0x1cfa38[_0xc1c9('0x4a')],{'$or':_[_0xc1c9('0x3a')](_0x1cfa38['attributes'],function(_0x214911){var _0x575ab7={};_0x575ab7[_0x214911]={'$like':'%'+_0x3e413b[_0xc1c9('0x41')]['filter']+'%'};return _0x575ab7;})});}_0x1cfa38=_[_0xc1c9('0x4c')]({},_0x1cfa38,_0x3e413b[_0xc1c9('0x4e')]);return db[_0xc1c9('0x8a')][_0xc1c9('0x2e')]({'where':_0x1cfa38[_0xc1c9('0x4a')]})[_0xc1c9('0x1d')](function(_0x26f83e){_0x5c249c['count']=_0x26f83e;if(_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0x4f')]){_0x1cfa38[_0xc1c9('0x66')]=[{'model':db['CmContact'],'as':_0xc1c9('0xaa'),'required':![]},{'model':db[_0xc1c9('0x98')],'as':_0xc1c9('0xab'),'attributes':['name','fullname',_0xc1c9('0xac')],'required':![]},{'model':db['Tag'],'as':_0xc1c9('0xad'),'attributes':['id',_0xc1c9('0x37'),'color'],'where':_0x3e413b['query'][_0xc1c9('0xae')]?{'id':_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0xae')]}:undefined,'required':_0x3e413b[_0xc1c9('0x41')][_0xc1c9('0xae')]?!![]:![]}];}return db[_0xc1c9('0x8a')][_0xc1c9('0x50')](_0x1cfa38);})[_0xc1c9('0x1d')](function(_0x267c4a){_0x5c249c[_0xc1c9('0x51')]=_0x267c4a;return _0x5c249c;});}})[_0xc1c9('0x1d')](respondWithFilteredResult(_0x30b0e8,_0x1cfa38))[_0xc1c9('0x26')](handleError(_0x30b0e8,null));};exports[_0xc1c9('0xaf')]=function(_0x3d442e,_0x1e4aed,_0x199ab8){return db['OpenchannelAccount'][_0xc1c9('0x54')]({'where':{'id':_0x3d442e[_0xc1c9('0x52')]['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x1e4aed,null))['then'](function(_0x67761a){if(_0x67761a){return _0x67761a[_0xc1c9('0xaf')](_0x3d442e[_0xc1c9('0x56')][_0xc1c9('0xb0')],_[_0xc1c9('0xb1')](_0x3d442e['body'],[_0xc1c9('0xb0'),'id'])||{})[_0xc1c9('0x8d')](function(_0x23849e){for(var _0x2e40de=0x0;_0x2e40de<_0x3d442e['body'][_0xc1c9('0xb0')]['length'];_0x2e40de+=0x1){socket[_0xc1c9('0xb2')](_0xc1c9('0xb3'),{'UserId':Number(_0x3d442e[_0xc1c9('0x56')][_0xc1c9('0xb0')][_0x2e40de]),'OpenchannelAccountId':Number(_0x3d442e[_0xc1c9('0x52')]['id'])});}return _0x23849e;});}})[_0xc1c9('0x1d')](respondWithResult(_0x1e4aed,null))[_0xc1c9('0x26')](handleError(_0x1e4aed,null));};exports['removeAgents']=function(_0x1b8134,_0x519633,_0x3f9e7c){return db[_0xc1c9('0x3b')][_0xc1c9('0x54')]({'where':{'id':_0x1b8134[_0xc1c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x519633,null))[_0xc1c9('0x1d')](function(_0x586490){if(_0x586490){return _0x586490[_0xc1c9('0xb4')](_0x1b8134[_0xc1c9('0x41')][_0xc1c9('0xb0')])[_0xc1c9('0x1d')](function(){if(_[_0xc1c9('0xb5')](_0x1b8134[_0xc1c9('0x41')]['ids'])){for(var _0x1d029e=0x0;_0x1d029e<_0x1b8134[_0xc1c9('0x41')]['ids'][_0xc1c9('0x47')];_0x1d029e+=0x1){socket['emit'](_0xc1c9('0xb6'),{'UserId':Number(_0x1b8134[_0xc1c9('0x41')]['ids'][_0x1d029e]),'OpenchannelAccountId':Number(_0x1b8134[_0xc1c9('0x52')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1b8134[_0xc1c9('0x41')]['ids']),'OpenchannelAccountId':Number(_0x1b8134['params']['id'])});}});}})['then'](respondWithStatusCode(_0x519633,null))[_0xc1c9('0x26')](handleError(_0x519633,null));};exports[_0xc1c9('0xb7')]=function(_0x5ee193,_0x5f4d58,_0x14a9a4){var _0x2378c5={};var _0x13452a={};var _0xa6e22d;var _0x3d6d00;return db[_0xc1c9('0x3b')][_0xc1c9('0x64')]({'where':{'id':_0x5ee193[_0xc1c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x5f4d58,null))[_0xc1c9('0x1d')](function(_0x2e5be0){if(_0x2e5be0){_0xa6e22d=_0x2e5be0;_0x13452a[_0xc1c9('0x43')]=_[_0xc1c9('0x40')](db[_0xc1c9('0x98')][_0xc1c9('0x3c')]);_0x13452a[_0xc1c9('0x41')]=_[_0xc1c9('0x40')](_0x5ee193['query']);_0x13452a['filters']=_[_0xc1c9('0x45')](_0x13452a['model'],_0x13452a['query']);_0x2378c5[_0xc1c9('0x44')]=_[_0xc1c9('0x45')](_0x13452a[_0xc1c9('0x43')],qs['fields'](_0x5ee193['query']['fields']));_0x2378c5[_0xc1c9('0x44')]=_0x2378c5['attributes'][_0xc1c9('0x47')]?_0x2378c5[_0xc1c9('0x44')]:_0x13452a['model'];_0x2378c5[_0xc1c9('0xa9')]=qs[_0xc1c9('0x49')](_0x5ee193[_0xc1c9('0x41')][_0xc1c9('0x49')]);_0x2378c5['where']=qs[_0xc1c9('0x42')](_[_0xc1c9('0x65')](_0x5ee193[_0xc1c9('0x41')],_0x13452a[_0xc1c9('0x42')]));if(_0x5ee193[_0xc1c9('0x41')][_0xc1c9('0x4b')]){_0x2378c5[_0xc1c9('0x4a')]=_[_0xc1c9('0x4c')](_0x2378c5[_0xc1c9('0x4a')],{'$or':_[_0xc1c9('0x3a')](_0x2378c5['attributes'],function(_0x1be1a6){var _0x3f4794={};_0x3f4794[_0x1be1a6]={'$like':'%'+_0x5ee193[_0xc1c9('0x41')][_0xc1c9('0x4b')]+'%'};return _0x3f4794;})});}_0x2378c5=_[_0xc1c9('0x4c')]({},_0x2378c5,_0x5ee193[_0xc1c9('0x4e')]);return _0xa6e22d['getAgents'](_0x2378c5);}})[_0xc1c9('0x1d')](function(_0x20e874){if(_0x20e874){_0x3d6d00=_0x20e874[_0xc1c9('0x47')];if(!_0x5ee193[_0xc1c9('0x41')]['hasOwnProperty'](_0xc1c9('0xa8'))){_0x2378c5[_0xc1c9('0x2d')]=qs['limit'](_0x5ee193[_0xc1c9('0x41')]['limit']);_0x2378c5[_0xc1c9('0x2b')]=qs[_0xc1c9('0x2b')](_0x5ee193['query']['offset']);}return _0xa6e22d['getAgents'](_0x2378c5);}})[_0xc1c9('0x1d')](function(_0x307da1){if(_0x307da1){return _0x307da1?{'count':_0x3d6d00,'rows':_0x307da1}:null;}})[_0xc1c9('0x1d')](respondWithResult(_0x5f4d58,null))[_0xc1c9('0x26')](handleError(_0x5f4d58,null));};exports['send']=function(_0x2111bb,_0x227ff1,_0x261767){var _0x5a1319,_0x45f247,_0x49f633;if(_['isNil'](_0x2111bb['body'][_0xc1c9('0x56')])||_0x2111bb[_0xc1c9('0x56')][_0xc1c9('0x56')]===''){throw new db[(_0xc1c9('0x6e'))][(_0xc1c9('0x6f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc1c9('0x74')](_0x2111bb['body']['to'])){}_0x5a1319=_0x2111bb[_0xc1c9('0x56')]['to'];return db[_0xc1c9('0x3b')][_0xc1c9('0x64')]({'where':{'id':_0x2111bb['params']['id']}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x227ff1,null))[_0xc1c9('0x1d')](function(_0x541df1){if(_0x541df1){return db[_0xc1c9('0x3b')]['find']({'where':{'id':_0x541df1['id']},'include':[{'model':db['CmList'],'as':_0xc1c9('0x7c'),'include':[{'model':db[_0xc1c9('0x7d')],'as':'Contacts','where':{[_0x541df1['mapKey']]:_0x5a1319},'limit':0x1,'order':[[_0xc1c9('0x73'),'DESC']]}]}]})[_0xc1c9('0x1d')](handleEntityNotFound(_0x227ff1,null))['then'](function(_0xa5acb4){if(_0xa5acb4&&_0xa5acb4[_0xc1c9('0x7c')]){_0x45f247=_0xa5acb4['get']({'plain':!![]});if(_0x45f247[_0xc1c9('0x7c')]&&_0x45f247[_0xc1c9('0x7c')][_0xc1c9('0x7e')][_0xc1c9('0x47')]){return _0x45f247[_0xc1c9('0x7c')][_0xc1c9('0x7e')][0x0];}return db[_0xc1c9('0x7d')][_0xc1c9('0x55')](_[_0xc1c9('0x15')](_0x2111bb[_0xc1c9('0x56')],{'firstName':_0x5a1319,[_0xa5acb4[_0xc1c9('0x78')]]:_0x5a1319,'phone':_0x5a1319,'ListId':_0x45f247[_0xc1c9('0x87')]}));}})[_0xc1c9('0x1d')](handleEntityNotFound(_0x227ff1,null))[_0xc1c9('0x1d')](function(_0x381a06){if(_0x381a06){_0x49f633=_0x381a06;return db['OpenchannelInteraction'][_0xc1c9('0x54')]({'where':{'ContactId':_0x49f633['id'],'closed':![],'OpenchannelAccountId':_0x45f247['id']}})[_0xc1c9('0x1d')](function(_0x5947b1){if(_0x5947b1){return[_0x5947b1,![]];}return db[_0xc1c9('0x8a')][_0xc1c9('0x55')]({'UserId':_0x2111bb[_0xc1c9('0x5a')]['id'],'ContactId':_0x49f633['id'],'OpenchannelAccountId':_0x45f247['id'],'lastMsgDirection':_0xc1c9('0xb8'),'firstMsgDirection':'out','Messages':[_['merge'](_0x2111bb['body'],{'read':![],'body':_0x2111bb[_0xc1c9('0x56')][_0xc1c9('0x56')],'OpenchannelAccountId':_0x45f247['id'],'UserId':_0x2111bb['user']['id'],'ContactId':_0x49f633['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xc1c9('0xb9')}]})[_0xc1c9('0x1d')](function(_0x12f879){return[_0x12f879,!![]];});});}})[_0xc1c9('0x8d')](function(_0x59e973,_0x436a7e){if(_0x436a7e){return _0x59e973;}return db[_0xc1c9('0x96')][_0xc1c9('0x55')](_['merge'](_0x2111bb[_0xc1c9('0x56')],{'read':![],'body':_0x2111bb[_0xc1c9('0x56')][_0xc1c9('0x56')],'OpenchannelAccountId':_0x45f247['id'],'OpenchannelInteractionId':_0x59e973['id'],'UserId':_0x2111bb[_0xc1c9('0x5a')]['id'],'ContactId':_0x49f633['id']}))[_0xc1c9('0x1d')](function(_0xad151a){_0x59e973['dataValues'][_0xc1c9('0xb9')]=[];_0x59e973['dataValues']['Messages'][_0xc1c9('0xba')](_0xad151a[_0xc1c9('0xbb')]);return _0x59e973;});});}})[_0xc1c9('0x1d')](respondWithResult(_0x227ff1,null))[_0xc1c9('0x26')](handleError(_0x227ff1,null));}; \ No newline at end of file +var _0x3a4a=['waitForTheAssignedQueue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','Contacts','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','destroy','get','UserProfileResource','then','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelAccount','includeAll','include','rows','options','find','create','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','OpenchannelApplication','Applications','account','applications','list','List','orderBy','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','created','push','OpenchannelMessage','UserId','User','interaction','unshift','waitForTheAssignedAgent','*,*,*,*','OpenchannelQueue','queue'];(function(_0x3c0ada,_0x533995){var _0x55fc93=function(_0x5b8bb6){while(--_0x5b8bb6){_0x3c0ada['push'](_0x3c0ada['shift']());}};_0x55fc93(++_0x533995);}(_0x3a4a,0xe6));var _0xa3a4=function(_0x239875,_0x52a793){_0x239875=_0x239875-0x0;var _0x55a8d6=_0x3a4a[_0x239875];return _0x55a8d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3a4('0x1'));var rp=require(_0xa3a4('0x2'));var moment=require(_0xa3a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa3a4('0x4'));var util=require(_0xa3a4('0x5'));var path=require(_0xa3a4('0x6'));var sox=require(_0xa3a4('0x7'));var csv=require(_0xa3a4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3a4('0x9'));var _=require(_0xa3a4('0xa'));var squel=require('squel');var crypto=require(_0xa3a4('0xb'));var jsforce=require(_0xa3a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa3a4('0x8'));var querystring=require(_0xa3a4('0xd'));var Papa=require('papaparse');var Redis=require(_0xa3a4('0xe'));var authService=require(_0xa3a4('0xf'));var qs=require(_0xa3a4('0x10'));var as=require(_0xa3a4('0x11'));var hardwareService=require(_0xa3a4('0x12'));var logger=require(_0xa3a4('0x13'))(_0xa3a4('0x14'));var utils=require('../../config/utils');var config=require(_0xa3a4('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa3a4('0x16')]=_[_0xa3a4('0x17')](config[_0xa3a4('0x16')],{'host':_0xa3a4('0x18'),'port':0x18eb});var socket=require(_0xa3a4('0x19'))(new Redis(config['redis']));require(_0xa3a4('0x1a'))[_0xa3a4('0x1b')](socket);var jayson=require(_0xa3a4('0x1c'));var client=jayson[_0xa3a4('0x1d')][_0xa3a4('0x1e')]({'port':0x232c});var client9002=jayson[_0xa3a4('0x1d')][_0xa3a4('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x40e4cb,_0x4b1d5b,_0x4f42b8,_0x1ff220){return new BPromise(function(_0x595c8f,_0x3978e0){var _0x4da56f=_0x1ff220||client;return _0x4da56f['request'](_0x40e4cb,_0x4f42b8)['then'](function(_0x530e8b){logger[_0xa3a4('0x1f')](_0xa3a4('0x20'),_0x4b1d5b,_0xa3a4('0x21'));logger[_0xa3a4('0x22')](_0xa3a4('0x23'),_0x4b1d5b,'request\x20sent',JSON[_0xa3a4('0x24')](_0x530e8b));if(_0x530e8b['error']){if(_0x530e8b['error'][_0xa3a4('0x25')]===0x1f4){logger[_0xa3a4('0x26')](_0xa3a4('0x20'),_0x4b1d5b,_0x530e8b[_0xa3a4('0x26')][_0xa3a4('0x27')]);return _0x3978e0(_0x530e8b[_0xa3a4('0x26')]['message']);}logger['error'](_0xa3a4('0x20'),_0x4b1d5b,_0x530e8b['error']['message']);return _0x595c8f(_0x530e8b['error'][_0xa3a4('0x27')]);}else{logger[_0xa3a4('0x1f')](_0xa3a4('0x20'),_0x4b1d5b,'request\x20sent');_0x595c8f(_0x530e8b[_0xa3a4('0x28')]['message']);}})[_0xa3a4('0x29')](function(_0x1a6d98){logger[_0xa3a4('0x26')](_0xa3a4('0x20'),_0x4b1d5b,_0x1a6d98);_0x3978e0(_0x1a6d98);});});}function respondWithStatusCode(_0xbee73d,_0x182be7){_0x182be7=_0x182be7||0xcc;return function(_0x560b09){if(_0x560b09){return _0xbee73d[_0xa3a4('0x2a')](_0x182be7);}return _0xbee73d[_0xa3a4('0x2b')](_0x182be7)[_0xa3a4('0x2c')]();};}function respondWithResult(_0x53dd3f,_0x47da23){_0x47da23=_0x47da23||0xc8;return function(_0x43efd9){if(_0x43efd9){return _0x53dd3f[_0xa3a4('0x2b')](_0x47da23)['json'](_0x43efd9);}};}function respondWithFilteredResult(_0x461700,_0x5c4df0){return function(_0x3aa2fb){if(_0x3aa2fb){var _0x3783cd=typeof _0x5c4df0[_0xa3a4('0x2d')]===_0xa3a4('0x2e')&&typeof _0x5c4df0['limit']===_0xa3a4('0x2e');var _0x262431=_0x3aa2fb[_0xa3a4('0x2f')];var _0x4d766b=_0x3783cd?0x0:_0x5c4df0[_0xa3a4('0x2d')];var _0x3bd3e0=_0x3783cd?_0x3aa2fb[_0xa3a4('0x2f')]:_0x5c4df0[_0xa3a4('0x2d')]+_0x5c4df0[_0xa3a4('0x30')];var _0x4c354a;if(_0x3bd3e0>=_0x262431){_0x3bd3e0=_0x262431;_0x4c354a=0xc8;}else{_0x4c354a=0xce;}_0x461700[_0xa3a4('0x2b')](_0x4c354a);return _0x461700['set'](_0xa3a4('0x31'),_0x4d766b+'-'+_0x3bd3e0+'/'+_0x262431)[_0xa3a4('0x32')](_0x3aa2fb);}return null;};}function patchUpdates(_0x29df39){return function(_0xb19d94){try{jsonpatch['apply'](_0xb19d94,_0x29df39,!![]);}catch(_0x325635){return BPromise[_0xa3a4('0x33')](_0x325635);}return _0xb19d94[_0xa3a4('0x34')]();};}function saveUpdates(_0x103744,_0x5ee4ef){return function(_0x4bc5f1){if(_0x4bc5f1){return _0x4bc5f1[_0xa3a4('0x35')](_0x103744)['then'](function(_0x2a7a75){return _0x2a7a75;});}return null;};}function removeEntity(_0x455ba9,_0x1102b7){return function(_0x3c404f){if(_0x3c404f){return _0x3c404f[_0xa3a4('0x36')]()['then'](function(){var _0x295283=_0x3c404f[_0xa3a4('0x37')]({'plain':!![]});var _0x36350f='OpenchannelAccounts';return db[_0xa3a4('0x38')][_0xa3a4('0x36')]({'where':{'type':_0x36350f,'resourceId':_0x295283['id']}})[_0xa3a4('0x39')](function(){return _0x3c404f;});})[_0xa3a4('0x39')](function(){_0x455ba9[_0xa3a4('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c7d5,_0x5cf927){return function(_0x5eba61){if(!_0x5eba61){_0x41c7d5[_0xa3a4('0x2a')](0x194);}return _0x5eba61;};}function handleError(_0xb90902,_0x4a3378){_0x4a3378=_0x4a3378||0x1f4;return function(_0x397e27){logger[_0xa3a4('0x26')](_0x397e27['stack']);if(_0x397e27['name']){delete _0x397e27[_0xa3a4('0x3a')];}_0xb90902[_0xa3a4('0x2b')](_0x4a3378)[_0xa3a4('0x3b')](_0x397e27);};}exports[_0xa3a4('0x3c')]=function(_0x3b4074,_0x1bd297){var _0x303991={'include':[{'model':db[_0xa3a4('0x3d')],'as':_0xa3a4('0x3e')}]},_0xadddaa={},_0x5c0a20={'count':0x0,'rows':[]};var _0x9e7644=_['map'](db['OpenchannelAccount'][_0xa3a4('0x3f')],function(_0x31537c){return{'name':_0x31537c['fieldName'],'type':_0x31537c[_0xa3a4('0x40')][_0xa3a4('0x41')]};});_0xadddaa[_0xa3a4('0x42')]=_[_0xa3a4('0x43')](_0x9e7644,_0xa3a4('0x3a'));_0xadddaa['query']=_[_0xa3a4('0x44')](_0x3b4074['query']);_0xadddaa[_0xa3a4('0x45')]=_['intersection'](_0xadddaa[_0xa3a4('0x42')],_0xadddaa[_0xa3a4('0x46')]);_0x303991[_0xa3a4('0x47')]=_[_0xa3a4('0x48')](_0xadddaa[_0xa3a4('0x42')],qs['fields'](_0x3b4074['query'][_0xa3a4('0x49')]));_0x303991[_0xa3a4('0x47')]=_0x303991['attributes'][_0xa3a4('0x4a')]?_0x303991[_0xa3a4('0x47')]:_0xadddaa[_0xa3a4('0x42')];if(!_0x3b4074[_0xa3a4('0x46')][_0xa3a4('0x4b')](_0xa3a4('0x4c'))){_0x303991[_0xa3a4('0x30')]=qs[_0xa3a4('0x30')](_0x3b4074[_0xa3a4('0x46')][_0xa3a4('0x30')]);_0x303991['offset']=qs[_0xa3a4('0x2d')](_0x3b4074[_0xa3a4('0x46')][_0xa3a4('0x2d')]);}_0x303991[_0xa3a4('0x4d')]=qs['sort'](_0x3b4074[_0xa3a4('0x46')][_0xa3a4('0x4e')]);_0x303991[_0xa3a4('0x4f')]=qs['filters'](_[_0xa3a4('0x50')](_0x3b4074[_0xa3a4('0x46')],_0xadddaa[_0xa3a4('0x45')]),_0x9e7644);if(_0x3b4074[_0xa3a4('0x46')][_0xa3a4('0x51')]){_0x303991['where']=_[_0xa3a4('0x52')](_0x303991['where'],{'$or':_['map'](_0x9e7644,function(_0x46717d){if(_0x46717d[_0xa3a4('0x40')]!==_0xa3a4('0x53')){var _0x34ed06={};_0x34ed06[_0x46717d['name']]={'$like':'%'+_0x3b4074[_0xa3a4('0x46')][_0xa3a4('0x51')]+'%'};return _0x34ed06;}})});}_0x303991=_[_0xa3a4('0x52')]({},_0x303991,_0x3b4074['options']);var _0x842330={'where':_0x303991[_0xa3a4('0x4f')]};return db[_0xa3a4('0x54')][_0xa3a4('0x2f')](_0x842330)[_0xa3a4('0x39')](function(_0x4f13ab){_0x5c0a20[_0xa3a4('0x2f')]=_0x4f13ab;if(_0x3b4074['query'][_0xa3a4('0x55')]){_0x303991[_0xa3a4('0x56')]=[{'all':!![]}];}return db[_0xa3a4('0x54')]['findAll'](_0x303991);})[_0xa3a4('0x39')](function(_0x3cbbf2){_0x5c0a20[_0xa3a4('0x57')]=_0x3cbbf2;return _0x5c0a20;})[_0xa3a4('0x39')](respondWithFilteredResult(_0x1bd297,_0x303991))['catch'](handleError(_0x1bd297,null));};exports['show']=function(_0x3c59df,_0x3e896a){var _0x34642f={'raw':![],'where':{'id':_0x3c59df['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5bfaa1={};_0x5bfaa1['model']=_[_0xa3a4('0x44')](db[_0xa3a4('0x54')][_0xa3a4('0x3f')]);_0x5bfaa1[_0xa3a4('0x46')]=_[_0xa3a4('0x44')](_0x3c59df[_0xa3a4('0x46')]);_0x5bfaa1[_0xa3a4('0x45')]=_[_0xa3a4('0x48')](_0x5bfaa1[_0xa3a4('0x42')],_0x5bfaa1['query']);_0x34642f[_0xa3a4('0x47')]=_[_0xa3a4('0x48')](_0x5bfaa1[_0xa3a4('0x42')],qs[_0xa3a4('0x49')](_0x3c59df[_0xa3a4('0x46')]['fields']));_0x34642f['attributes']=_0x34642f[_0xa3a4('0x47')][_0xa3a4('0x4a')]?_0x34642f[_0xa3a4('0x47')]:_0x5bfaa1['model'];if(_0x3c59df['query'][_0xa3a4('0x55')]){_0x34642f[_0xa3a4('0x56')]=[{'all':!![]}];}_0x34642f=_[_0xa3a4('0x52')]({},_0x34642f,_0x3c59df[_0xa3a4('0x58')]);return db[_0xa3a4('0x54')][_0xa3a4('0x59')](_0x34642f)[_0xa3a4('0x39')](handleEntityNotFound(_0x3e896a,null))[_0xa3a4('0x39')](respondWithResult(_0x3e896a,null))['catch'](handleError(_0x3e896a,null));};exports['create']=function(_0x67e4d5,_0x323bca){return db[_0xa3a4('0x54')][_0xa3a4('0x5a')](_0x67e4d5[_0xa3a4('0x5b')],{})[_0xa3a4('0x39')](function(_0x1691b3){var _0x13114d=_0x67e4d5['user'][_0xa3a4('0x37')]({'plain':!![]});if(!_0x13114d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13114d[_0xa3a4('0x5c')]===_0xa3a4('0x5d')){var _0x2b0ede=_0x1691b3['get']({'plain':!![]});var _0x201038='OpenchannelAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x201038,'userProfileId':_0x13114d[_0xa3a4('0x5e')]},'raw':!![]})[_0xa3a4('0x39')](function(_0x18079b){if(_0x18079b&&_0x18079b[_0xa3a4('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b0ede[_0xa3a4('0x3a')],'resourceId':_0x2b0ede['id'],'type':_0x18079b[_0xa3a4('0x3a')],'sectionId':_0x18079b['id']},{})[_0xa3a4('0x39')](function(){return _0x1691b3;});}else{return _0x1691b3;}})['catch'](function(_0x138842){logger[_0xa3a4('0x26')](_0xa3a4('0x60'),_0x138842);throw _0x138842;});}return _0x1691b3;})[_0xa3a4('0x39')](respondWithResult(_0x323bca,0xc9))[_0xa3a4('0x29')](handleError(_0x323bca,null));};exports[_0xa3a4('0x35')]=function(_0x291c9f,_0x16bb9a){if(_0x291c9f['body']['id']){delete _0x291c9f[_0xa3a4('0x5b')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x291c9f['params']['id']},'include':[{'model':db[_0xa3a4('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x16bb9a,null))[_0xa3a4('0x39')](saveUpdates(_0x291c9f['body'],null))[_0xa3a4('0x39')](respondWithResult(_0x16bb9a,null))[_0xa3a4('0x29')](handleError(_0x16bb9a,null));};exports['destroy']=function(_0x4c999b,_0x54149f){return db['OpenchannelAccount']['find']({'where':{'id':_0x4c999b[_0xa3a4('0x61')]['id']}})['then'](handleEntityNotFound(_0x54149f,null))[_0xa3a4('0x39')](removeEntity(_0x54149f,null))[_0xa3a4('0x29')](handleError(_0x54149f,null));};exports['describe']=function(_0x4adde5,_0xc2f687){return db['OpenchannelAccount'][_0xa3a4('0x62')]()[_0xa3a4('0x39')](respondWithResult(_0xc2f687,null))[_0xa3a4('0x29')](handleError(_0xc2f687,null));};exports[_0xa3a4('0x63')]=function(_0x648259,_0x7453c4,_0x2eb3bc){if(_0x648259[_0xa3a4('0x5b')]['id']){delete _0x648259['body']['id'];}return db['OpenchannelAccount'][_0xa3a4('0x59')]({'where':{'id':_0x648259[_0xa3a4('0x61')]['id']}})['then'](handleEntityNotFound(_0x7453c4,null))['then'](function(_0x16b999){if(_0x16b999){_0x648259[_0xa3a4('0x5b')][_0xa3a4('0x64')]=_0x16b999['id'];return db[_0xa3a4('0x65')][_0xa3a4('0x5a')](_0x648259[_0xa3a4('0x5b')]);}})[_0xa3a4('0x39')](respondWithResult(_0x7453c4,null))['catch'](handleError(_0x7453c4,null));};exports[_0xa3a4('0x66')]=function(_0x367052,_0x501217,_0xe9302f){var _0x3b8757={'raw':![],'where':{}};var _0x14cde6={};var _0x3a2e87={'count':0x0,'rows':[]};return db[_0xa3a4('0x54')][_0xa3a4('0x67')]({'where':{'id':_0x367052[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x501217,null))[_0xa3a4('0x39')](function(_0x3cc8e1){if(_0x3cc8e1){_0x14cde6[_0xa3a4('0x42')]=_['keys'](db[_0xa3a4('0x65')][_0xa3a4('0x3f')]);_0x14cde6[_0xa3a4('0x46')]=_[_0xa3a4('0x44')](_0x367052[_0xa3a4('0x46')]);_0x14cde6[_0xa3a4('0x45')]=_[_0xa3a4('0x48')](_0x14cde6[_0xa3a4('0x42')],_0x14cde6[_0xa3a4('0x46')]);_0x3b8757[_0xa3a4('0x47')]=_[_0xa3a4('0x48')](_0x14cde6[_0xa3a4('0x42')],qs[_0xa3a4('0x49')](_0x367052[_0xa3a4('0x46')][_0xa3a4('0x49')]));_0x3b8757[_0xa3a4('0x47')]=_0x3b8757['attributes'][_0xa3a4('0x4a')]?_0x3b8757['attributes']:_0x14cde6[_0xa3a4('0x42')];if(!_0x367052[_0xa3a4('0x46')][_0xa3a4('0x4b')]('nolimit')){_0x3b8757[_0xa3a4('0x30')]=qs['limit'](_0x367052[_0xa3a4('0x46')][_0xa3a4('0x30')]);_0x3b8757[_0xa3a4('0x2d')]=qs[_0xa3a4('0x2d')](_0x367052['query']['offset']);}_0x3b8757[_0xa3a4('0x4d')]=qs[_0xa3a4('0x4e')](_0x367052[_0xa3a4('0x46')][_0xa3a4('0x4e')]);_0x3b8757[_0xa3a4('0x4f')]=qs['filters'](_[_0xa3a4('0x50')](_0x367052[_0xa3a4('0x46')],_0x14cde6[_0xa3a4('0x45')]));_0x3b8757[_0xa3a4('0x4f')]['OpenchannelAccountId']=_0x3cc8e1['id'];if(_0x367052[_0xa3a4('0x46')][_0xa3a4('0x51')]){_0x3b8757['where']=_['merge'](_0x3b8757[_0xa3a4('0x4f')],{'$or':_['map'](_0x3b8757[_0xa3a4('0x47')],function(_0x145c3d){var _0x574635={};_0x574635[_0x145c3d]={'$like':'%'+_0x367052[_0xa3a4('0x46')][_0xa3a4('0x51')]+'%'};return _0x574635;})});}_0x3b8757=_['merge']({},_0x3b8757,_0x367052[_0xa3a4('0x58')]);return db[_0xa3a4('0x65')]['count']({'where':_0x3b8757[_0xa3a4('0x4f')]})[_0xa3a4('0x39')](function(_0x315278){_0x3a2e87[_0xa3a4('0x2f')]=_0x315278;if(_0x367052[_0xa3a4('0x46')][_0xa3a4('0x55')]){_0x3b8757[_0xa3a4('0x56')]=[{'all':!![]}];}return db[_0xa3a4('0x65')][_0xa3a4('0x68')](_0x3b8757);})[_0xa3a4('0x39')](function(_0x26d48f){_0x3a2e87['rows']=_0x26d48f;return _0x3a2e87;});}})[_0xa3a4('0x39')](respondWithFilteredResult(_0x501217,_0x3b8757))['catch'](handleError(_0x501217,null));};exports[_0xa3a4('0x69')]=function(_0x4d9a11,_0x505c92,_0x240ca3){return db[_0xa3a4('0x54')][_0xa3a4('0x59')]({'where':{'id':_0x4d9a11[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x505c92,null))[_0xa3a4('0x39')](function(_0x4c5ddf){if(_0x4c5ddf){return _0x4c5ddf[_0xa3a4('0x69')](_0x4d9a11[_0xa3a4('0x46')][_0xa3a4('0x6a')]);}})['then'](respondWithStatusCode(_0x505c92,null))['catch'](handleError(_0x505c92,null));};exports[_0xa3a4('0x6b')]=function(_0x33f750,_0x376979,_0x23f9d4){if(_0x33f750[_0xa3a4('0x5b')]['id']){delete _0x33f750['body']['id'];}return db[_0xa3a4('0x54')][_0xa3a4('0x59')]({'where':{'id':_0x33f750[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x376979,null))[_0xa3a4('0x39')](function(_0xbd27f9){if(_0xbd27f9){_0x33f750[_0xa3a4('0x5b')][_0xa3a4('0x64')]=_0xbd27f9['id'];return db['CannedAnswer'][_0xa3a4('0x5a')](_0x33f750[_0xa3a4('0x5b')]);}})['then'](respondWithResult(_0x376979,null))[_0xa3a4('0x29')](handleError(_0x376979,null));};exports[_0xa3a4('0x6c')]=function(_0x70aece,_0x2e57db,_0x3ccfa7){var _0x19f4b2={'raw':![],'where':{}};var _0x7df663={};var _0x3d1248={'count':0x0,'rows':[]};return db[_0xa3a4('0x54')][_0xa3a4('0x67')]({'where':{'id':_0x70aece[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x2e57db,null))[_0xa3a4('0x39')](function(_0xd19237){if(_0xd19237){_0x7df663['model']=_[_0xa3a4('0x44')](db[_0xa3a4('0x6d')][_0xa3a4('0x3f')]);_0x7df663['query']=_['keys'](_0x70aece[_0xa3a4('0x46')]);_0x7df663[_0xa3a4('0x45')]=_[_0xa3a4('0x48')](_0x7df663[_0xa3a4('0x42')],_0x7df663[_0xa3a4('0x46')]);_0x19f4b2[_0xa3a4('0x47')]=_['intersection'](_0x7df663[_0xa3a4('0x42')],qs[_0xa3a4('0x49')](_0x70aece[_0xa3a4('0x46')][_0xa3a4('0x49')]));_0x19f4b2['attributes']=_0x19f4b2[_0xa3a4('0x47')][_0xa3a4('0x4a')]?_0x19f4b2[_0xa3a4('0x47')]:_0x7df663[_0xa3a4('0x42')];if(!_0x70aece[_0xa3a4('0x46')]['hasOwnProperty']('nolimit')){_0x19f4b2[_0xa3a4('0x30')]=qs[_0xa3a4('0x30')](_0x70aece['query'][_0xa3a4('0x30')]);_0x19f4b2[_0xa3a4('0x2d')]=qs[_0xa3a4('0x2d')](_0x70aece['query'][_0xa3a4('0x2d')]);}_0x19f4b2[_0xa3a4('0x4d')]=qs[_0xa3a4('0x4e')](_0x70aece[_0xa3a4('0x46')][_0xa3a4('0x4e')]);_0x19f4b2['where']=qs[_0xa3a4('0x45')](_['pick'](_0x70aece[_0xa3a4('0x46')],_0x7df663[_0xa3a4('0x45')]));_0x19f4b2[_0xa3a4('0x4f')][_0xa3a4('0x64')]=_0xd19237['id'];if(_0x70aece[_0xa3a4('0x46')][_0xa3a4('0x51')]){_0x19f4b2['where']=_[_0xa3a4('0x52')](_0x19f4b2[_0xa3a4('0x4f')],{'$or':_['map'](_0x19f4b2[_0xa3a4('0x47')],function(_0x141715){var _0x1c2bae={};_0x1c2bae[_0x141715]={'$like':'%'+_0x70aece[_0xa3a4('0x46')][_0xa3a4('0x51')]+'%'};return _0x1c2bae;})});}_0x19f4b2=_[_0xa3a4('0x52')]({},_0x19f4b2,_0x70aece[_0xa3a4('0x58')]);return db['CannedAnswer'][_0xa3a4('0x2f')]({'where':_0x19f4b2[_0xa3a4('0x4f')]})[_0xa3a4('0x39')](function(_0x24ceed){_0x3d1248[_0xa3a4('0x2f')]=_0x24ceed;if(_0x70aece['query']['includeAll']){_0x19f4b2[_0xa3a4('0x56')]=[{'all':!![]}];}return db[_0xa3a4('0x6d')][_0xa3a4('0x68')](_0x19f4b2);})[_0xa3a4('0x39')](function(_0x529b38){_0x3d1248[_0xa3a4('0x57')]=_0x529b38;return _0x3d1248;});}})[_0xa3a4('0x39')](respondWithFilteredResult(_0x2e57db,_0x19f4b2))[_0xa3a4('0x29')](handleError(_0x2e57db,null));};exports[_0xa3a4('0x6e')]=function(_0x5861c7,_0x36c618,_0x48e9e3){return db[_0xa3a4('0x54')][_0xa3a4('0x59')]({'where':{'id':_0x5861c7[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x36c618,null))[_0xa3a4('0x39')](function(_0x1073d7){if(_0x1073d7){return _0x1073d7[_0xa3a4('0x6e')](_0x5861c7[_0xa3a4('0x46')][_0xa3a4('0x6a')]);}})[_0xa3a4('0x39')](respondWithStatusCode(_0x36c618,null))[_0xa3a4('0x29')](handleError(_0x36c618,null));};exports['notify']=function(_0xe563e1,_0x1ade75,_0x455337){var _0x31009d={'body':_0xe563e1[_0xa3a4('0x5b')],'channel':_0xa3a4('0x6f')};var _0x14dbd4=[];var _0x49d380=[];var _0x1bec32={};var _0x13628d=![];return db[_0xa3a4('0x70')]['describe']()[_0xa3a4('0x39')](function(_0x27eeb9){if(!_0x27eeb9){throw new db[(_0xa3a4('0x71'))][(_0xa3a4('0x72'))](_0xa3a4('0x73'));}_0x14dbd4=_[_0xa3a4('0x74')](_['keys'](_0x27eeb9),['createdAt',_0xa3a4('0x75')]);_0x49d380=_[_0xa3a4('0x74')](_[_0xa3a4('0x44')](_0x27eeb9),[_0xa3a4('0x76'),_0xa3a4('0x75'),_0xa3a4('0x77'),_0xa3a4('0x78')]);if(_0xe563e1[_0xa3a4('0x5b')]['id']){delete _0xe563e1[_0xa3a4('0x5b')]['id'];}if(_[_0xa3a4('0x79')](_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x7a')])){throw new db['Sequelize'][(_0xa3a4('0x72'))](_0xa3a4('0x7b'));}if(_[_0xa3a4('0x79')](_0xe563e1[_0xa3a4('0x5b')]['body'])||_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x5b')]===''){throw new db[(_0xa3a4('0x71'))][(_0xa3a4('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa3a4('0x79')](_0xe563e1['body'][_0xa3a4('0x7c')])){throw new db['Sequelize'][(_0xa3a4('0x72'))](_0xa3a4('0x7d')+_0x49d380);}if(!_[_0xa3a4('0x7e')](_0x49d380,_0xe563e1['body'][_0xa3a4('0x7c')])){throw new db[(_0xa3a4('0x71'))][(_0xa3a4('0x72'))](_0xa3a4('0x7f')+_0x49d380);}_0x1bec32[_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x7c')]]=_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x7a')];})[_0xa3a4('0x39')](function(){return db[_0xa3a4('0x54')][_0xa3a4('0x59')]({'where':{'id':_0xe563e1[_0xa3a4('0x61')]['id']},'include':[{'model':db[_0xa3a4('0x80')],'as':'List','include':[{'model':db[_0xa3a4('0x70')],'as':'Contacts','where':_0x1bec32,'limit':0x1,'order':[[_0xa3a4('0x75'),_0xa3a4('0x81')]]}]},{'model':db[_0xa3a4('0x82')],'as':_0xa3a4('0x83')}]});})[_0xa3a4('0x39')](handleEntityNotFound(_0x1ade75,null))[_0xa3a4('0x39')](function(_0x341d22){if(_0x341d22&&_0x341d22['List']){_0x31009d[_0xa3a4('0x84')]=_0x341d22;_0x31009d[_0xa3a4('0x85')]=_0x341d22[_0xa3a4('0x83')];_0x31009d[_0xa3a4('0x86')]=_0x341d22[_0xa3a4('0x87')];_0x31009d['applications']=_[_0xa3a4('0x88')](_0x31009d['applications'],['priority'],['asc']);if(_0x31009d[_0xa3a4('0x84')][_0xa3a4('0x83')]){delete _0x31009d[_0xa3a4('0x84')][_0xa3a4('0x83')];}if(_0x31009d[_0xa3a4('0x84')][_0xa3a4('0x87')]&&_0x31009d[_0xa3a4('0x84')][_0xa3a4('0x87')]['Contacts'][_0xa3a4('0x4a')]){return _0x31009d[_0xa3a4('0x84')][_0xa3a4('0x87')]['Contacts'][0x0];}var _0x134b7c=_[_0xa3a4('0x17')](_0xe563e1[_0xa3a4('0x5b')],{'firstName':_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x7a')],'ListId':_0x341d22['ListId']});_0x134b7c[_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x7c')]]=_0xe563e1['body'][_0xa3a4('0x7a')];return db[_0xa3a4('0x70')][_0xa3a4('0x5a')](_0x134b7c,{'fields':_0x14dbd4,'raw':!![]});}})[_0xa3a4('0x39')](handleEntityNotFound(_0x1ade75,null))[_0xa3a4('0x39')](function(_0x23fd43){_0x31009d[_0xa3a4('0x89')]=_0x23fd43;if(_0x23fd43){var _0x354ff4={'ContactId':_0x23fd43['id'],'OpenchannelAccountId':_0xe563e1[_0xa3a4('0x61')]['id'],'from':(_0x23fd43[_0xa3a4('0x8a')]||'')+'\x20'+(_0x23fd43[_0xa3a4('0x8b')]||'')};var _0xb5de97={'OpenchannelAccountId':_0xe563e1[_0xa3a4('0x61')]['id'],'closed':![]};if(_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x8c')]){_0xb5de97['threadId']=_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x8c')];return db[_0xa3a4('0x8d')][_0xa3a4('0x59')]({'where':_0xb5de97})[_0xa3a4('0x39')](function(_0x3b5984){if(_0x3b5984){return[_0x3b5984,![]];}_0x354ff4[_0xa3a4('0x8c')]=_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x8c')];_0x354ff4[_0xa3a4('0x8e')]=_0xe563e1['body']['externalUrl'];return db[_0xa3a4('0x8d')][_0xa3a4('0x5a')](_0x354ff4)[_0xa3a4('0x39')](function(_0x370177){return[_0x370177,!![]];});});}else{_0xb5de97[_0xa3a4('0x8c')]=null;}_0xb5de97[_0xa3a4('0x8f')]=_0x23fd43['id'];return db[_0xa3a4('0x8d')]['find']({'where':_0xb5de97})[_0xa3a4('0x39')](function(_0x73e30a){if(_0x73e30a){return[_0x73e30a,![]];}return db[_0xa3a4('0x8d')][_0xa3a4('0x5a')](_0x354ff4)[_0xa3a4('0x39')](function(_0x31fb73){return[_0x31fb73,!![]];});});}})['spread'](function(_0x2a5b71,_0x45c663){if(_0x2a5b71){_0x13628d=_0x45c663;if(!_0x45c663){var _0x2761e0={'from':(_0x31009d['contact'][_0xa3a4('0x8a')]||'')+'\x20'+(_0x31009d[_0xa3a4('0x89')][_0xa3a4('0x8b')]||'')};if(_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x8c')]&&_0xe563e1['body'][_0xa3a4('0x90')]&&_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x8c')]!=_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x90')]){_0x2761e0['threadId']=_0xe563e1['body'][_0xa3a4('0x90')];}return _0x2a5b71[_0xa3a4('0x35')](_0x2761e0);}else{return _0x2a5b71;}}})['then'](function(_0xcc9e4a){_0x31009d['interaction']=_0xcc9e4a[_0xa3a4('0x37')]({'plain':!![]});_0x31009d['interaction'][_0xa3a4('0x91')]=_0x13628d;if(_0x31009d['interaction']['created']){if(_0x31009d['account']['autoclose']){_0x31009d['applications'][_0xa3a4('0x92')]({'id':0x0,'priority':_0x31009d[_0xa3a4('0x85')][_0xa3a4('0x4a')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xa3a4('0x93')][_0xa3a4('0x5a')]({'body':_0xe563e1[_0xa3a4('0x5b')][_0xa3a4('0x5b')],'OpenchannelAccountId':_0xe563e1[_0xa3a4('0x61')]['id'],'OpenchannelInteractionId':_0xcc9e4a['id'],'direction':'in','ContactId':_0x31009d[_0xa3a4('0x89')]['id'],'AttachmentId':_0xe563e1[_0xa3a4('0x5b')]['AttachmentId']});})[_0xa3a4('0x39')](function(_0x3e4d29){_0x31009d[_0xa3a4('0x27')]=_0x3e4d29;if(!_0x31009d['interaction'][_0xa3a4('0x94')])return;return db[_0xa3a4('0x95')][_0xa3a4('0x59')]({'attributes':['id','name'],'where':{'id':_0x31009d[_0xa3a4('0x96')][_0xa3a4('0x94')]}});})[_0xa3a4('0x39')](function(_0x177d39){if(_0x177d39){_0x31009d[_0xa3a4('0x85')][_0xa3a4('0x97')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x177d39[_0xa3a4('0x3a')]+','+(_0x31009d[_0xa3a4('0x84')][_0xa3a4('0x98')]||0xa),'interval':_0xa3a4('0x99')});}if(!_0x31009d[_0xa3a4('0x96')]['queueId'])return;return db[_0xa3a4('0x9a')][_0xa3a4('0x59')]({'attributes':['id',_0xa3a4('0x3a')],'where':{'id':_0x31009d[_0xa3a4('0x96')]['queueId']}});})[_0xa3a4('0x39')](function(_0x38ec48){if(_0x38ec48){_0x31009d['applications'][_0xa3a4('0x97')]({'id':0x0,'priority':0x1,'app':_0xa3a4('0x9b'),'appdata':_0x38ec48[_0xa3a4('0x3a')]+','+(_0x31009d[_0xa3a4('0x84')][_0xa3a4('0x9c')]||0x12c),'interval':_0xa3a4('0x99')});}return respondWithRpcPromise(_0xa3a4('0x9d'),_0xa3a4('0x9e'),_0x31009d);})['then'](function(_0x144506){respondWithRpcPromise(_0xa3a4('0x9f'),_0xa3a4('0x9f'),{'event':_0xa3a4('0xa0'),'message':_0x144506},client9002);return _0x144506;})['then'](respondWithResult(_0x1ade75,null))[_0xa3a4('0x29')](handleError(_0x1ade75,null));};exports[_0xa3a4('0xa1')]=function(_0x1f013c,_0x2dab67){var _0x3b9ac0=_0x1f013c[_0xa3a4('0x61')]['id'];var _0x13762c=_0x1f013c[_0xa3a4('0x5b')];var _0x3667ca=0xc8;var _0x53809b=null;return db[_0xa3a4('0xa2')][_0xa3a4('0xa3')]({'isolationLevel':db[_0xa3a4('0xa2')][_0xa3a4('0xa4')][_0xa3a4('0xa5')][_0xa3a4('0xa6')]},function(_0x33b0ba){return db[_0xa3a4('0x54')][_0xa3a4('0x67')]({'where':{'id':_0x3b9ac0},'transaction':_0x33b0ba})['then'](function(_0x3caa5b){if(_0x3caa5b){return db[_0xa3a4('0x82')][_0xa3a4('0x36')]({'where':{'OpenchannelAccountId':_0x3b9ac0},'transaction':_0x33b0ba})[_0xa3a4('0x39')](function(){var _0x421f79=_[_0xa3a4('0x43')](_0x13762c,function(_0x376bbb){_0x376bbb['OpenchannelAccountId']=_0x3b9ac0;return _0x376bbb;});return db[_0xa3a4('0x82')][_0xa3a4('0xa7')](_0x421f79,{'transaction':_0x33b0ba});});}else{_0x3667ca=0x194;_0x53809b=[];}});})[_0xa3a4('0x39')](function(){if(_0x3667ca!==0x194){return db['OpenchannelApplication'][_0xa3a4('0xa8')]({'where':{'OpenchannelAccountId':_0x3b9ac0},'order':_0xa3a4('0xa9')})['then'](function(_0x355b83){_0x53809b=_0x355b83;});}})[_0xa3a4('0x29')](function(_0x4a20c8){_0x3667ca=0x1f4;logger[_0xa3a4('0x26')](_0x4a20c8[_0xa3a4('0xaa')]);if(_0x4a20c8[_0xa3a4('0x3a')]){delete _0x4a20c8[_0xa3a4('0x3a')];}_0x53809b=_0x4a20c8;})[_0xa3a4('0xab')](function(){if(_0x53809b===null){_0x2dab67[_0xa3a4('0x2a')](_0x3667ca);}else{if(_0x3667ca===0x1f4){_0x2dab67['status'](_0x3667ca)['send'](_0x53809b);}else{_0x2dab67['status'](_0x3667ca)[_0xa3a4('0x32')](_0x53809b);}}});};exports[_0xa3a4('0xac')]=function(_0x5bdee1,_0x247d39,_0x353bd6){var _0x4bc5af={};var _0xf997f5={};var _0x4a9674;var _0x2854bb;return db[_0xa3a4('0x54')][_0xa3a4('0x67')]({'where':{'id':_0x5bdee1['params']['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x247d39,null))['then'](function(_0x411355){if(_0x411355){_0x4a9674=_0x411355;_0xf997f5[_0xa3a4('0x42')]=_[_0xa3a4('0x44')](db[_0xa3a4('0x82')]['rawAttributes']);_0xf997f5['query']=_[_0xa3a4('0x44')](_0x5bdee1['query']);_0xf997f5[_0xa3a4('0x45')]=_[_0xa3a4('0x48')](_0xf997f5[_0xa3a4('0x42')],_0xf997f5[_0xa3a4('0x46')]);_0x4bc5af[_0xa3a4('0x47')]=_[_0xa3a4('0x48')](_0xf997f5[_0xa3a4('0x42')],qs[_0xa3a4('0x49')](_0x5bdee1[_0xa3a4('0x46')][_0xa3a4('0x49')]));_0x4bc5af[_0xa3a4('0x47')]=_0x4bc5af[_0xa3a4('0x47')][_0xa3a4('0x4a')]?_0x4bc5af[_0xa3a4('0x47')]:_0xf997f5[_0xa3a4('0x42')];_0x4bc5af[_0xa3a4('0x4d')]=qs[_0xa3a4('0x4e')](_0x5bdee1[_0xa3a4('0x46')][_0xa3a4('0x4e')]);_0x4bc5af[_0xa3a4('0x4f')]=qs[_0xa3a4('0x45')](_[_0xa3a4('0x50')](_0x5bdee1[_0xa3a4('0x46')],_0xf997f5[_0xa3a4('0x45')]));if(_0x5bdee1[_0xa3a4('0x46')][_0xa3a4('0x51')]){_0x4bc5af[_0xa3a4('0x4f')]=_[_0xa3a4('0x52')](_0x4bc5af['where'],{'$or':_[_0xa3a4('0x43')](_0x4bc5af['attributes'],function(_0x1e015a){var _0x1a2798={};_0x1a2798[_0x1e015a]={'$like':'%'+_0x5bdee1['query']['filter']+'%'};return _0x1a2798;})});}_0x4bc5af=_['merge']({},_0x4bc5af,_0x5bdee1[_0xa3a4('0x58')]);return _0x4a9674['getApplications'](_0x4bc5af);}})['then'](function(_0x4557cd){if(_0x4557cd){_0x2854bb=_0x4557cd['length'];if(!_0x5bdee1[_0xa3a4('0x46')][_0xa3a4('0x4b')](_0xa3a4('0x4c'))){_0x4bc5af[_0xa3a4('0x30')]=qs[_0xa3a4('0x30')](_0x5bdee1[_0xa3a4('0x46')][_0xa3a4('0x30')]);_0x4bc5af[_0xa3a4('0x2d')]=qs[_0xa3a4('0x2d')](_0x5bdee1[_0xa3a4('0x46')][_0xa3a4('0x2d')]);}return _0x4a9674[_0xa3a4('0xac')](_0x4bc5af);}})[_0xa3a4('0x39')](function(_0x35de39){if(_0x35de39){return _0x35de39?{'count':_0x2854bb,'rows':_0x35de39}:null;}})[_0xa3a4('0x39')](respondWithResult(_0x247d39,null))[_0xa3a4('0x29')](handleError(_0x247d39,null));};exports[_0xa3a4('0xad')]=function(_0x206ad5,_0x5031de,_0x16c42b){var _0x4596b5={'raw':![],'where':{}};var _0x17cbf8={};var _0xc625b9={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa3a4('0x67')]({'where':{'id':_0x206ad5['params']['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x5031de,null))['then'](function(_0x393d14){if(_0x393d14){_0x17cbf8[_0xa3a4('0x42')]=_['keys'](db[_0xa3a4('0x8d')][_0xa3a4('0x3f')]);_0x17cbf8[_0xa3a4('0x46')]=_['keys'](_0x206ad5[_0xa3a4('0x46')]);_0x17cbf8[_0xa3a4('0x45')]=_[_0xa3a4('0x48')](_0x17cbf8['model'],_0x17cbf8[_0xa3a4('0x46')]);_0x4596b5[_0xa3a4('0x47')]=_['intersection'](_0x17cbf8[_0xa3a4('0x42')],qs[_0xa3a4('0x49')](_0x206ad5[_0xa3a4('0x46')][_0xa3a4('0x49')]));_0x4596b5[_0xa3a4('0x47')]=_0x4596b5[_0xa3a4('0x47')][_0xa3a4('0x4a')]?_0x4596b5[_0xa3a4('0x47')]:_0x17cbf8['model'];if(!_0x206ad5[_0xa3a4('0x46')][_0xa3a4('0x4b')](_0xa3a4('0x4c'))){_0x4596b5['limit']=qs['limit'](_0x206ad5[_0xa3a4('0x46')]['limit']);_0x4596b5[_0xa3a4('0x2d')]=qs['offset'](_0x206ad5[_0xa3a4('0x46')]['offset']);}_0x4596b5[_0xa3a4('0x4d')]=qs['sort'](_0x206ad5[_0xa3a4('0x46')]['sort']);_0x4596b5['where']=qs[_0xa3a4('0x45')](_[_0xa3a4('0x50')](_0x206ad5[_0xa3a4('0x46')],_0x17cbf8[_0xa3a4('0x45')]));_0x4596b5['where'][_0xa3a4('0x64')]=_0x393d14['id'];if(_0x206ad5[_0xa3a4('0x46')][_0xa3a4('0x51')]){_0x4596b5['where']=_[_0xa3a4('0x52')](_0x4596b5[_0xa3a4('0x4f')],{'$or':_['map'](_0x4596b5[_0xa3a4('0x47')],function(_0x36256b){var _0x41f8f6={};_0x41f8f6[_0x36256b]={'$like':'%'+_0x206ad5[_0xa3a4('0x46')][_0xa3a4('0x51')]+'%'};return _0x41f8f6;})});}_0x4596b5=_[_0xa3a4('0x52')]({},_0x4596b5,_0x206ad5['options']);return db[_0xa3a4('0x8d')][_0xa3a4('0x2f')]({'where':_0x4596b5['where']})[_0xa3a4('0x39')](function(_0x385bee){_0xc625b9['count']=_0x385bee;if(_0x206ad5[_0xa3a4('0x46')][_0xa3a4('0x55')]){_0x4596b5[_0xa3a4('0x56')]=[{'model':db[_0xa3a4('0x70')],'as':'Contact','required':![]},{'model':db[_0xa3a4('0x95')],'as':_0xa3a4('0xae'),'attributes':['name',_0xa3a4('0xaf'),_0xa3a4('0xb0')],'required':![]},{'model':db[_0xa3a4('0xb1')],'as':_0xa3a4('0xb2'),'attributes':['id',_0xa3a4('0x3a'),_0xa3a4('0xb3')],'where':_0x206ad5[_0xa3a4('0x46')][_0xa3a4('0xb4')]?{'id':_0x206ad5['query'][_0xa3a4('0xb4')]}:undefined,'required':_0x206ad5[_0xa3a4('0x46')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xa3a4('0x68')](_0x4596b5);})[_0xa3a4('0x39')](function(_0x245a8e){_0xc625b9[_0xa3a4('0x57')]=_0x245a8e;return _0xc625b9;});}})['then'](respondWithFilteredResult(_0x5031de,_0x4596b5))[_0xa3a4('0x29')](handleError(_0x5031de,null));};exports[_0xa3a4('0xb5')]=function(_0x5220f2,_0x296cb0,_0x4b8838){return db['OpenchannelAccount']['find']({'where':{'id':_0x5220f2[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x296cb0,null))[_0xa3a4('0x39')](function(_0xf857c8){if(_0xf857c8){return _0xf857c8[_0xa3a4('0xb5')](_0x5220f2[_0xa3a4('0x5b')][_0xa3a4('0x6a')],_[_0xa3a4('0xb6')](_0x5220f2[_0xa3a4('0x5b')],[_0xa3a4('0x6a'),'id'])||{})[_0xa3a4('0xb7')](function(_0x4dc812){for(var _0x2f9027=0x0;_0x2f9027<_0x5220f2[_0xa3a4('0x5b')][_0xa3a4('0x6a')][_0xa3a4('0x4a')];_0x2f9027+=0x1){socket['emit'](_0xa3a4('0xb8'),{'UserId':Number(_0x5220f2[_0xa3a4('0x5b')][_0xa3a4('0x6a')][_0x2f9027]),'OpenchannelAccountId':Number(_0x5220f2['params']['id'])});}return _0x4dc812;});}})[_0xa3a4('0x39')](respondWithResult(_0x296cb0,null))[_0xa3a4('0x29')](handleError(_0x296cb0,null));};exports[_0xa3a4('0xb9')]=function(_0xd2fd8c,_0xe227c0,_0x35bb61){return db[_0xa3a4('0x54')][_0xa3a4('0x59')]({'where':{'id':_0xd2fd8c['params']['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0xe227c0,null))[_0xa3a4('0x39')](function(_0x2e0b33){if(_0x2e0b33){return _0x2e0b33[_0xa3a4('0xb9')](_0xd2fd8c[_0xa3a4('0x46')][_0xa3a4('0x6a')])['then'](function(){if(_['isArray'](_0xd2fd8c[_0xa3a4('0x46')][_0xa3a4('0x6a')])){for(var _0x58e2ad=0x0;_0x58e2ad<_0xd2fd8c[_0xa3a4('0x46')][_0xa3a4('0x6a')][_0xa3a4('0x4a')];_0x58e2ad+=0x1){socket[_0xa3a4('0xba')](_0xa3a4('0xbb'),{'UserId':Number(_0xd2fd8c[_0xa3a4('0x46')]['ids'][_0x58e2ad]),'OpenchannelAccountId':Number(_0xd2fd8c[_0xa3a4('0x61')]['id'])});}}else{socket[_0xa3a4('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0xd2fd8c[_0xa3a4('0x46')][_0xa3a4('0x6a')]),'OpenchannelAccountId':Number(_0xd2fd8c[_0xa3a4('0x61')]['id'])});}});}})[_0xa3a4('0x39')](respondWithStatusCode(_0xe227c0,null))[_0xa3a4('0x29')](handleError(_0xe227c0,null));};exports[_0xa3a4('0xbc')]=function(_0x28dca8,_0x399e76,_0x125660){var _0x3985fc={};var _0xbeb41={};var _0x5eb622;var _0x361515;return db[_0xa3a4('0x54')][_0xa3a4('0x67')]({'where':{'id':_0x28dca8[_0xa3a4('0x61')]['id']}})['then'](handleEntityNotFound(_0x399e76,null))[_0xa3a4('0x39')](function(_0x3b7cb3){if(_0x3b7cb3){_0x5eb622=_0x3b7cb3;_0xbeb41['model']=_['keys'](db['User'][_0xa3a4('0x3f')]);_0xbeb41[_0xa3a4('0x46')]=_[_0xa3a4('0x44')](_0x28dca8['query']);_0xbeb41[_0xa3a4('0x45')]=_[_0xa3a4('0x48')](_0xbeb41[_0xa3a4('0x42')],_0xbeb41['query']);_0x3985fc[_0xa3a4('0x47')]=_[_0xa3a4('0x48')](_0xbeb41['model'],qs[_0xa3a4('0x49')](_0x28dca8[_0xa3a4('0x46')]['fields']));_0x3985fc[_0xa3a4('0x47')]=_0x3985fc['attributes']['length']?_0x3985fc[_0xa3a4('0x47')]:_0xbeb41[_0xa3a4('0x42')];_0x3985fc[_0xa3a4('0x4d')]=qs[_0xa3a4('0x4e')](_0x28dca8[_0xa3a4('0x46')][_0xa3a4('0x4e')]);_0x3985fc[_0xa3a4('0x4f')]=qs[_0xa3a4('0x45')](_['pick'](_0x28dca8['query'],_0xbeb41[_0xa3a4('0x45')]));if(_0x28dca8[_0xa3a4('0x46')]['filter']){_0x3985fc[_0xa3a4('0x4f')]=_[_0xa3a4('0x52')](_0x3985fc[_0xa3a4('0x4f')],{'$or':_[_0xa3a4('0x43')](_0x3985fc['attributes'],function(_0x23d692){var _0x1fd02d={};_0x1fd02d[_0x23d692]={'$like':'%'+_0x28dca8[_0xa3a4('0x46')][_0xa3a4('0x51')]+'%'};return _0x1fd02d;})});}_0x3985fc=_[_0xa3a4('0x52')]({},_0x3985fc,_0x28dca8['options']);return _0x5eb622[_0xa3a4('0xbc')](_0x3985fc);}})[_0xa3a4('0x39')](function(_0x15f6f4){if(_0x15f6f4){_0x361515=_0x15f6f4['length'];if(!_0x28dca8['query']['hasOwnProperty']('nolimit')){_0x3985fc[_0xa3a4('0x30')]=qs[_0xa3a4('0x30')](_0x28dca8[_0xa3a4('0x46')][_0xa3a4('0x30')]);_0x3985fc[_0xa3a4('0x2d')]=qs[_0xa3a4('0x2d')](_0x28dca8[_0xa3a4('0x46')][_0xa3a4('0x2d')]);}return _0x5eb622[_0xa3a4('0xbc')](_0x3985fc);}})['then'](function(_0x1ac5b9){if(_0x1ac5b9){return _0x1ac5b9?{'count':_0x361515,'rows':_0x1ac5b9}:null;}})[_0xa3a4('0x39')](respondWithResult(_0x399e76,null))['catch'](handleError(_0x399e76,null));};exports[_0xa3a4('0x3b')]=function(_0x3b89e9,_0x2da233,_0xef4bbb){var _0x4ef920,_0x54f418,_0x150a0a;if(_['isNil'](_0x3b89e9[_0xa3a4('0x5b')][_0xa3a4('0x5b')])||_0x3b89e9[_0xa3a4('0x5b')][_0xa3a4('0x5b')]===''){throw new db[(_0xa3a4('0x71'))][(_0xa3a4('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa3a4('0x79')](_0x3b89e9['body']['to'])){}_0x4ef920=_0x3b89e9[_0xa3a4('0x5b')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3b89e9[_0xa3a4('0x61')]['id']}})[_0xa3a4('0x39')](handleEntityNotFound(_0x2da233,null))['then'](function(_0x4e8d37){if(_0x4e8d37){return db[_0xa3a4('0x54')][_0xa3a4('0x59')]({'where':{'id':_0x4e8d37['id']},'include':[{'model':db[_0xa3a4('0x80')],'as':_0xa3a4('0x87'),'include':[{'model':db['CmContact'],'as':_0xa3a4('0xbd'),'where':{[_0x4e8d37[_0xa3a4('0x7c')]]:_0x4ef920},'limit':0x1,'order':[[_0xa3a4('0x75'),_0xa3a4('0x81')]]}]}]})[_0xa3a4('0x39')](handleEntityNotFound(_0x2da233,null))[_0xa3a4('0x39')](function(_0x296d66){if(_0x296d66&&_0x296d66[_0xa3a4('0x87')]){_0x54f418=_0x296d66[_0xa3a4('0x37')]({'plain':!![]});if(_0x54f418[_0xa3a4('0x87')]&&_0x54f418[_0xa3a4('0x87')][_0xa3a4('0xbd')]['length']){return _0x54f418[_0xa3a4('0x87')][_0xa3a4('0xbd')][0x0];}return db['CmContact'][_0xa3a4('0x5a')](_['defaults'](_0x3b89e9[_0xa3a4('0x5b')],{'firstName':_0x4ef920,[_0x296d66[_0xa3a4('0x7c')]]:_0x4ef920,'phone':_0x4ef920,'ListId':_0x54f418['ListId']}));}})[_0xa3a4('0x39')](handleEntityNotFound(_0x2da233,null))['then'](function(_0x4a3781){if(_0x4a3781){_0x150a0a=_0x4a3781;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x150a0a['id'],'closed':![],'OpenchannelAccountId':_0x54f418['id']}})[_0xa3a4('0x39')](function(_0xe20b73){if(_0xe20b73){return[_0xe20b73,![]];}return db[_0xa3a4('0x8d')][_0xa3a4('0x5a')]({'UserId':_0x3b89e9['user']['id'],'ContactId':_0x150a0a['id'],'OpenchannelAccountId':_0x54f418['id'],'lastMsgDirection':_0xa3a4('0xbe'),'firstMsgDirection':'out','Messages':[_[_0xa3a4('0x52')](_0x3b89e9['body'],{'read':![],'body':_0x3b89e9['body'][_0xa3a4('0x5b')],'OpenchannelAccountId':_0x54f418['id'],'UserId':_0x3b89e9['user']['id'],'ContactId':_0x150a0a['id']})]},{'include':[{'model':db[_0xa3a4('0x93')],'as':_0xa3a4('0xbf')}]})[_0xa3a4('0x39')](function(_0xb70438){return[_0xb70438,!![]];});});}})[_0xa3a4('0xb7')](function(_0x58de1a,_0x1be789){if(_0x1be789){return _0x58de1a;}return db[_0xa3a4('0x93')][_0xa3a4('0x5a')](_['merge'](_0x3b89e9['body'],{'read':![],'body':_0x3b89e9[_0xa3a4('0x5b')]['body'],'OpenchannelAccountId':_0x54f418['id'],'OpenchannelInteractionId':_0x58de1a['id'],'UserId':_0x3b89e9[_0xa3a4('0x5d')]['id'],'ContactId':_0x150a0a['id']}))['then'](function(_0x4f2d3f){_0x58de1a[_0xa3a4('0xc0')][_0xa3a4('0xbf')]=[];_0x58de1a['dataValues'][_0xa3a4('0xbf')][_0xa3a4('0x92')](_0x4f2d3f[_0xa3a4('0xc0')]);return _0x58de1a;});});}})[_0xa3a4('0x39')](respondWithResult(_0x2da233,null))['catch'](handleError(_0x2da233,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 81b0e5f..b263899 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 _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3e1a0d,_0xcf5c64){_0x3e1a0d=_0x3e1a0d-0x0;var _0x316488=_0x6f7a[_0x3e1a0d];return _0x316488;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x350351,_0x3b66ef){var _0x8e7c3f=function(_0x1c083e){while(--_0x1c083e){_0x350351['push'](_0x350351['shift']());}};_0x8e7c3f(++_0x3b66ef);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('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 df744f4..f62ae12 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(_0x23a38c,_0x2edd){var _0x3618ac=function(_0x1499e4){while(--_0x1499e4){_0x23a38c['push'](_0x23a38c['shift']());}};_0x3618ac(++_0x2edd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x23f7e0,_0x1320f4){var _0x278602=function(_0x46b4e4){while(--_0x46b4e4){_0x23f7e0['push'](_0x23f7e0['shift']());}};_0x278602(++_0x1320f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 35bac67..467ce7b 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 _0x8580=['http','redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x64954c,_0x3ebec3){var _0x47c88b=function(_0x203439){while(--_0x203439){_0x64954c['push'](_0x64954c['shift']());}};_0x47c88b(++_0x3ebec3);}(_0x8580,0x1c7));var _0x0858=function(_0x4dec30,_0x53aa4e){_0x4dec30=_0x4dec30-0x0;var _0x49664d=_0x8580[_0x4dec30];return _0x49664d;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});config[_0x0858('0x8')]=_[_0x0858('0x9')](config['redis'],{'host':_0x0858('0xa'),'port':0x18eb});var socket=require(_0x0858('0xb'))(new Redis(config[_0x0858('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x470459,_0x4b5072,_0x24996d){return new BPromise(function(_0x1c214c,_0x38371f){return client[_0x0858('0xc')](_0x470459,_0x24996d)[_0x0858('0xd')](function(_0x207cda){logger[_0x0858('0xe')](_0x0858('0xf'),_0x4b5072,'request\x20sent');logger['debug'](_0x0858('0x10'),_0x4b5072,'request\x20sent',JSON['stringify'](_0x207cda));if(_0x207cda['error']){if(_0x207cda[_0x0858('0x11')][_0x0858('0x12')]===0x1f4){logger['error'](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x38371f(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x1c214c(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}else{logger[_0x0858('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5072,_0x0858('0x14'));_0x1c214c(_0x207cda['result'][_0x0858('0x13')]);}})[_0x0858('0x15')](function(_0x3a2d96){logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x3a2d96);_0x38371f(_0x3a2d96);});});} \ No newline at end of file +var _0xbf6e=['client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x484d64,_0x19dc03){var _0x7c41e4=function(_0x450883){while(--_0x450883){_0x484d64['push'](_0x484d64['shift']());}};_0x7c41e4(++_0x19dc03);}(_0xbf6e,0x149));var _0xebf6=function(_0x282f90,_0x415511){_0x282f90=_0x282f90-0x0;var _0x4aaa1e=_0xbf6e[_0x282f90];return _0x4aaa1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});config[_0xebf6('0xb')]=_[_0xebf6('0xc')](config[_0xebf6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xebf6('0xd'))(new Redis(config[_0xebf6('0xb')]));require(_0xebf6('0xe'))['register'](socket);function respondWithRpcPromise(_0x38cee4,_0x14f41e,_0x5c6727){return new BPromise(function(_0x3d4b60,_0x231d6b){return client[_0xebf6('0xf')](_0x38cee4,_0x5c6727)[_0xebf6('0x10')](function(_0x1bd481){logger[_0xebf6('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x14f41e,_0xebf6('0x12'));logger[_0xebf6('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x14f41e,_0xebf6('0x12'),JSON[_0xebf6('0x14')](_0x1bd481));if(_0x1bd481[_0xebf6('0x15')]){if(_0x1bd481[_0xebf6('0x15')][_0xebf6('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x14f41e,_0x1bd481['error'][_0xebf6('0x17')]);return _0x231d6b(_0x1bd481[_0xebf6('0x15')]['message']);}logger[_0xebf6('0x15')](_0xebf6('0x18'),_0x14f41e,_0x1bd481[_0xebf6('0x15')][_0xebf6('0x17')]);return _0x3d4b60(_0x1bd481[_0xebf6('0x15')][_0xebf6('0x17')]);}else{logger[_0xebf6('0x11')](_0xebf6('0x18'),_0x14f41e,_0xebf6('0x12'));_0x3d4b60(_0x1bd481[_0xebf6('0x19')]['message']);}})['catch'](function(_0xe03844){logger[_0xebf6('0x15')](_0xebf6('0x18'),_0x14f41e,_0xe03844);_0x231d6b(_0xe03844);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 488a1a2..93e5dc3 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 _0xd547=['openchannelAccount:','remove','update','removeListener'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xd547,0x1c1));var _0x7d54=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0xd547[_0x27fe26];return _0x4fcb35;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x7d54('0x0'),_0x7d54('0x1')];function createListener(_0x15a0c7,_0x1611f6){return function(_0x54ffc5){_0x1611f6['emit'](_0x15a0c7,_0x54ffc5);};}function removeListener(_0x21c23f,_0x5d21c1){return function(){OpenchannelAccountEvents[_0x7d54('0x2')](_0x21c23f,_0x5d21c1);};}exports['register']=function(_0x296dd6){for(var _0x37defc=0x0,_0x1b7fc1=events['length'];_0x37defc<_0x1b7fc1;_0x37defc++){var _0x5b0b16=events[_0x37defc];var _0x478f9b=createListener(_0x7d54('0x3')+_0x5b0b16,_0x296dd6);OpenchannelAccountEvents['on'](_0x5b0b16,_0x478f9b);}}; \ No newline at end of file +var _0x8b2b=['remove','emit','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x259d91,_0x2a2185){var _0x2844f9=function(_0x5aad72){while(--_0x5aad72){_0x259d91['push'](_0x259d91['shift']());}};_0x2844f9(++_0x2a2185);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x35569d,_0x5798d1){_0x35569d=_0x35569d-0x0;var _0x13ff0=_0x8b2b[_0x35569d];return _0x13ff0;};'use strict';var OpenchannelAccountEvents=require(_0xb8b2('0x0'));var events=[_0xb8b2('0x1'),_0xb8b2('0x2'),'update'];function createListener(_0x199e25,_0x415a60){return function(_0x3beb9e){_0x415a60[_0xb8b2('0x3')](_0x199e25,_0x3beb9e);};}function removeListener(_0x1199f8,_0x2928a7){return function(){OpenchannelAccountEvents['removeListener'](_0x1199f8,_0x2928a7);};}exports['register']=function(_0xba7734){for(var _0x31b3f9=0x0,_0x2f0032=events[_0xb8b2('0x4')];_0x31b3f9<_0x2f0032;_0x31b3f9++){var _0x4a4c69=events[_0x31b3f9];var _0x541b1b=createListener(_0xb8b2('0x5')+_0x4a4c69,_0xba7734);OpenchannelAccountEvents['on'](_0x4a4c69,_0x541b1b);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d363c86..0461368 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 _0xd719=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x9dd172,_0x1a49de){var _0xca52fa=function(_0x209cfe){while(--_0x209cfe){_0x9dd172['push'](_0x9dd172['shift']());}};_0xca52fa(++_0x1a49de);}(_0xd719,0x16d));var _0x9d71=function(_0xb5d151,_0x4535bb){_0xb5d151=_0xb5d151-0x0;var _0x22fa8d=_0xd719[_0xb5d151];return _0x22fa8d;};'use strict';var multer=require(_0x9d71('0x0'));var util=require(_0x9d71('0x1'));var path=require(_0x9d71('0x2'));var timeout=require(_0x9d71('0x3'));var express=require(_0x9d71('0x4'));var router=express[_0x9d71('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d71('0x7'));var controller=require(_0x9d71('0x8'));router[_0x9d71('0x9')]('/',auth[_0x9d71('0xa')](),controller[_0x9d71('0xb')]);router[_0x9d71('0x9')](_0x9d71('0xc'),auth['isAuthenticated'](),controller[_0x9d71('0xd')]);router[_0x9d71('0xe')]('/',auth[_0x9d71('0xa')](),controller[_0x9d71('0xf')]);router[_0x9d71('0x10')](_0x9d71('0xc'),auth[_0x9d71('0xa')](),controller[_0x9d71('0x11')]);router['delete'](_0x9d71('0xc'),auth[_0x9d71('0xa')](),controller[_0x9d71('0x12')]);module['exports']=router; \ No newline at end of file +var _0x298a=['isAuthenticated','index','post','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x18db56,_0xe8c98b){var _0x3be018=function(_0x1fa6fa){while(--_0x1fa6fa){_0x18db56['push'](_0x18db56['shift']());}};_0x3be018(++_0xe8c98b);}(_0x298a,0x158));var _0xa298=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x298a[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xa298('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa298('0x1'));var express=require(_0xa298('0x2'));var router=express[_0xa298('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa298('0x4'));var interaction=require(_0xa298('0x5'));var config=require(_0xa298('0x6'));var controller=require('./openchannelApplication.controller');router[_0xa298('0x7')]('/',auth[_0xa298('0x8')](),controller[_0xa298('0x9')]);router['get']('/:id',auth[_0xa298('0x8')](),controller['show']);router[_0xa298('0xa')]('/',auth[_0xa298('0x8')](),controller['create']);router[_0xa298('0xb')](_0xa298('0xc'),auth[_0xa298('0x8')](),controller[_0xa298('0xd')]);router[_0xa298('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa298('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9ca74dc..148a4fa 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 _0x8d09=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1d45e7,_0x4ce877){var _0x1ac9d9=function(_0x1a45a6){while(--_0x1a45a6){_0x1d45e7['push'](_0x1d45e7['shift']());}};_0x1ac9d9(++_0x4ce877);}(_0x8d09,0x16d));var _0x98d0=function(_0x2c00b3,_0x29b200){_0x2c00b3=_0x2c00b3-0x0;var _0x595512=_0x8d09[_0x2c00b3];return _0x595512;};'use strict';var Sequelize=require(_0x98d0('0x0'));module[_0x98d0('0x1')]={'priority':{'type':Sequelize[_0x98d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x98d0('0x3')],'allowNull':![],'defaultValue':_0x98d0('0x4')},'appdata':{'type':Sequelize[_0x98d0('0x5')]()},'description':{'type':Sequelize[_0x98d0('0x3')]},'interval':{'type':Sequelize[_0x98d0('0x3')],'defaultValue':_0x98d0('0x6')}}; \ No newline at end of file +var _0x3869=['sequelize','exports','STRING','TEXT'];(function(_0x13175f,_0x4133d6){var _0x1f127c=function(_0x536b62){while(--_0x536b62){_0x13175f['push'](_0x13175f['shift']());}};_0x1f127c(++_0x4133d6);}(_0x3869,0x1a0));var _0x9386=function(_0x43ffca,_0x3bb3c0){_0x43ffca=_0x43ffca-0x0;var _0x514f04=_0x3869[_0x43ffca];return _0x514f04;};'use strict';var Sequelize=require(_0x9386('0x0'));module[_0x9386('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9386('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9386('0x3')]()},'description':{'type':Sequelize[_0x9386('0x2')]},'interval':{'type':Sequelize[_0x9386('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d91caf3..af0ecb9 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 _0xefc8=['catch','show','rawAttributes','includeAll','include','create','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','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','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','OpenchannelApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','rows'];(function(_0x1264cb,_0x3a2d49){var _0x73f2ee=function(_0x19a194){while(--_0x19a194){_0x1264cb['push'](_0x1264cb['shift']());}};_0x73f2ee(++_0x3a2d49);}(_0xefc8,0xed));var _0x8efc=function(_0x446d0f,_0x5a1fe7){_0x446d0f=_0x446d0f-0x0;var _0x5502eb=_0xefc8[_0x446d0f];return _0x5502eb;};'use strict';var emlformat=require(_0x8efc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8efc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8efc('0x2'));var moment=require(_0x8efc('0x3'));var BPromise=require(_0x8efc('0x4'));var Mustache=require(_0x8efc('0x5'));var util=require(_0x8efc('0x6'));var path=require('path');var sox=require(_0x8efc('0x7'));var csv=require(_0x8efc('0x8'));var ejs=require(_0x8efc('0x9'));var fs=require('fs');var fs_extra=require(_0x8efc('0xa'));var _=require(_0x8efc('0xb'));var squel=require(_0x8efc('0xc'));var crypto=require(_0x8efc('0xd'));var jsforce=require(_0x8efc('0xe'));var deskjs=require(_0x8efc('0xf'));var toCsv=require(_0x8efc('0x8'));var querystring=require(_0x8efc('0x10'));var Papa=require('papaparse');var Redis=require(_0x8efc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8efc('0x12'));var as=require(_0x8efc('0x13'));var hardwareService=require(_0x8efc('0x14'));var logger=require(_0x8efc('0x15'))(_0x8efc('0x16'));var utils=require(_0x8efc('0x17'));var config=require(_0x8efc('0x18'));var licenseUtil=require(_0x8efc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51cd27,_0x1b50eb){_0x1b50eb=_0x1b50eb||0xcc;return function(_0x5512ac){if(_0x5512ac){return _0x51cd27['sendStatus'](_0x1b50eb);}return _0x51cd27[_0x8efc('0x1a')](_0x1b50eb)[_0x8efc('0x1b')]();};}function respondWithResult(_0x33f8c0,_0x9d00d6){_0x9d00d6=_0x9d00d6||0xc8;return function(_0x25b976){if(_0x25b976){return _0x33f8c0[_0x8efc('0x1a')](_0x9d00d6)['json'](_0x25b976);}};}function respondWithFilteredResult(_0x2ca351,_0x169af3){return function(_0x14354e){if(_0x14354e){var _0x439481=typeof _0x169af3[_0x8efc('0x1c')]===_0x8efc('0x1d')&&typeof _0x169af3[_0x8efc('0x1e')]===_0x8efc('0x1d');var _0x1b23d9=_0x14354e[_0x8efc('0x1f')];var _0x382519=_0x439481?0x0:_0x169af3[_0x8efc('0x1c')];var _0x1b7740=_0x439481?_0x14354e[_0x8efc('0x1f')]:_0x169af3[_0x8efc('0x1c')]+_0x169af3[_0x8efc('0x1e')];var _0x3e439f;if(_0x1b7740>=_0x1b23d9){_0x1b7740=_0x1b23d9;_0x3e439f=0xc8;}else{_0x3e439f=0xce;}_0x2ca351[_0x8efc('0x1a')](_0x3e439f);return _0x2ca351['set'](_0x8efc('0x20'),_0x382519+'-'+_0x1b7740+'/'+_0x1b23d9)[_0x8efc('0x21')](_0x14354e);}return null;};}function patchUpdates(_0x59be1b){return function(_0x57164f){try{jsonpatch[_0x8efc('0x22')](_0x57164f,_0x59be1b,!![]);}catch(_0x1f17b7){return BPromise[_0x8efc('0x23')](_0x1f17b7);}return _0x57164f[_0x8efc('0x24')]();};}function saveUpdates(_0x432551,_0x2e41c9){return function(_0x39c785){if(_0x39c785){return _0x39c785[_0x8efc('0x25')](_0x432551)['then'](function(_0x5169da){return _0x5169da;});}return null;};}function removeEntity(_0x4d7947,_0x3f4113){return function(_0x1193fe){if(_0x1193fe){return _0x1193fe[_0x8efc('0x26')]()[_0x8efc('0x27')](function(){_0x4d7947['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41e087,_0x21dd41){return function(_0x13bc98){if(!_0x13bc98){_0x41e087[_0x8efc('0x28')](0x194);}return _0x13bc98;};}function handleError(_0x4b1092,_0x427427){_0x427427=_0x427427||0x1f4;return function(_0x43aa0c){logger['error'](_0x43aa0c[_0x8efc('0x29')]);if(_0x43aa0c[_0x8efc('0x2a')]){delete _0x43aa0c[_0x8efc('0x2a')];}_0x4b1092['status'](_0x427427)[_0x8efc('0x2b')](_0x43aa0c);};}exports['index']=function(_0x105a51,_0x20acd4){var _0x177d01={},_0x9cbf9={},_0x29e218={'count':0x0,'rows':[]};var _0x5c32ed=_[_0x8efc('0x2c')](db[_0x8efc('0x2d')]['rawAttributes'],function(_0x358c92){return{'name':_0x358c92[_0x8efc('0x2e')],'type':_0x358c92[_0x8efc('0x2f')][_0x8efc('0x30')]};});_0x9cbf9['model']=_[_0x8efc('0x2c')](_0x5c32ed,_0x8efc('0x2a'));_0x9cbf9[_0x8efc('0x31')]=_[_0x8efc('0x32')](_0x105a51[_0x8efc('0x31')]);_0x9cbf9[_0x8efc('0x33')]=_[_0x8efc('0x34')](_0x9cbf9[_0x8efc('0x35')],_0x9cbf9[_0x8efc('0x31')]);_0x177d01[_0x8efc('0x36')]=_[_0x8efc('0x34')](_0x9cbf9[_0x8efc('0x35')],qs[_0x8efc('0x37')](_0x105a51[_0x8efc('0x31')][_0x8efc('0x37')]));_0x177d01[_0x8efc('0x36')]=_0x177d01['attributes'][_0x8efc('0x38')]?_0x177d01['attributes']:_0x9cbf9[_0x8efc('0x35')];if(!_0x105a51[_0x8efc('0x31')]['hasOwnProperty'](_0x8efc('0x39'))){_0x177d01[_0x8efc('0x1e')]=qs[_0x8efc('0x1e')](_0x105a51[_0x8efc('0x31')][_0x8efc('0x1e')]);_0x177d01['offset']=qs[_0x8efc('0x1c')](_0x105a51[_0x8efc('0x31')][_0x8efc('0x1c')]);}_0x177d01[_0x8efc('0x3a')]=qs['sort'](_0x105a51[_0x8efc('0x31')]['sort']);_0x177d01[_0x8efc('0x3b')]=qs['filters'](_[_0x8efc('0x3c')](_0x105a51['query'],_0x9cbf9[_0x8efc('0x33')]),_0x5c32ed);if(_0x105a51[_0x8efc('0x31')][_0x8efc('0x3d')]){_0x177d01[_0x8efc('0x3b')]=_[_0x8efc('0x3e')](_0x177d01[_0x8efc('0x3b')],{'$or':_['map'](_0x5c32ed,function(_0x1376ed){if(_0x1376ed[_0x8efc('0x2f')]!==_0x8efc('0x3f')){var _0xd8e12f={};_0xd8e12f[_0x1376ed[_0x8efc('0x2a')]]={'$like':'%'+_0x105a51[_0x8efc('0x31')][_0x8efc('0x3d')]+'%'};return _0xd8e12f;}})});}_0x177d01=_[_0x8efc('0x3e')]({},_0x177d01,_0x105a51[_0x8efc('0x40')]);var _0x335c71={'where':_0x177d01[_0x8efc('0x3b')]};return db[_0x8efc('0x2d')]['count'](_0x335c71)[_0x8efc('0x27')](function(_0xf7eadc){_0x29e218['count']=_0xf7eadc;if(_0x105a51['query']['includeAll']){_0x177d01['include']=[{'all':!![]}];}return db[_0x8efc('0x2d')][_0x8efc('0x41')](_0x177d01);})[_0x8efc('0x27')](function(_0x3e6c6b){_0x29e218[_0x8efc('0x42')]=_0x3e6c6b;return _0x29e218;})[_0x8efc('0x27')](respondWithFilteredResult(_0x20acd4,_0x177d01))[_0x8efc('0x43')](handleError(_0x20acd4,null));};exports[_0x8efc('0x44')]=function(_0x7d4819,_0xb87c6d){var _0x1a982b={'raw':!![],'where':{'id':_0x7d4819['params']['id']}},_0x4e4641={};_0x4e4641[_0x8efc('0x35')]=_[_0x8efc('0x32')](db[_0x8efc('0x2d')][_0x8efc('0x45')]);_0x4e4641[_0x8efc('0x31')]=_[_0x8efc('0x32')](_0x7d4819['query']);_0x4e4641[_0x8efc('0x33')]=_['intersection'](_0x4e4641['model'],_0x4e4641[_0x8efc('0x31')]);_0x1a982b['attributes']=_[_0x8efc('0x34')](_0x4e4641[_0x8efc('0x35')],qs['fields'](_0x7d4819[_0x8efc('0x31')][_0x8efc('0x37')]));_0x1a982b[_0x8efc('0x36')]=_0x1a982b[_0x8efc('0x36')][_0x8efc('0x38')]?_0x1a982b[_0x8efc('0x36')]:_0x4e4641[_0x8efc('0x35')];if(_0x7d4819[_0x8efc('0x31')][_0x8efc('0x46')]){_0x1a982b[_0x8efc('0x47')]=[{'all':!![]}];}_0x1a982b=_[_0x8efc('0x3e')]({},_0x1a982b,_0x7d4819['options']);return db[_0x8efc('0x2d')]['find'](_0x1a982b)[_0x8efc('0x27')](handleEntityNotFound(_0xb87c6d,null))['then'](respondWithResult(_0xb87c6d,null))['catch'](handleError(_0xb87c6d,null));};exports['create']=function(_0x2cf2e8,_0x3c4501){return db['OpenchannelApplication'][_0x8efc('0x48')](_0x2cf2e8[_0x8efc('0x49')],{})['then'](respondWithResult(_0x3c4501,0xc9))[_0x8efc('0x43')](handleError(_0x3c4501,null));};exports[_0x8efc('0x25')]=function(_0x390e44,_0x355a9a){if(_0x390e44[_0x8efc('0x49')]['id']){delete _0x390e44[_0x8efc('0x49')]['id'];}return db['OpenchannelApplication'][_0x8efc('0x4a')]({'where':{'id':_0x390e44[_0x8efc('0x4b')]['id']}})[_0x8efc('0x27')](handleEntityNotFound(_0x355a9a,null))[_0x8efc('0x27')](saveUpdates(_0x390e44[_0x8efc('0x49')],null))[_0x8efc('0x27')](respondWithResult(_0x355a9a,null))[_0x8efc('0x43')](handleError(_0x355a9a,null));};exports['destroy']=function(_0x55b4a8,_0x48cd3d){return db[_0x8efc('0x2d')]['find']({'where':{'id':_0x55b4a8[_0x8efc('0x4b')]['id']}})[_0x8efc('0x27')](handleEntityNotFound(_0x48cd3d,null))['then'](removeEntity(_0x48cd3d,null))[_0x8efc('0x43')](handleError(_0x48cd3d,null));}; \ No newline at end of file +var _0xcf26=['sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','include','options','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x1cfe78,_0x451783){var _0x512d9a=function(_0x48fccf){while(--_0x48fccf){_0x1cfe78['push'](_0x1cfe78['shift']());}};_0x512d9a(++_0x451783);}(_0xcf26,0xc3));var _0x6cf2=function(_0x9ec221,_0x2594a6){_0x9ec221=_0x9ec221-0x0;var _0xdbe55e=_0xcf26[_0x9ec221];return _0xdbe55e;};'use strict';var emlformat=require(_0x6cf2('0x0'));var rimraf=require(_0x6cf2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf2('0x2'));var moment=require(_0x6cf2('0x3'));var BPromise=require(_0x6cf2('0x4'));var Mustache=require('mustache');var util=require(_0x6cf2('0x5'));var path=require(_0x6cf2('0x6'));var sox=require('sox');var csv=require(_0x6cf2('0x7'));var ejs=require(_0x6cf2('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf2('0x9'));var _=require(_0x6cf2('0xa'));var squel=require(_0x6cf2('0xb'));var crypto=require('crypto');var jsforce=require(_0x6cf2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6cf2('0x7'));var querystring=require(_0x6cf2('0xd'));var Papa=require(_0x6cf2('0xe'));var Redis=require('ioredis');var authService=require(_0x6cf2('0xf'));var qs=require(_0x6cf2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf2('0x11'));var logger=require(_0x6cf2('0x12'))('api');var utils=require(_0x6cf2('0x13'));var config=require(_0x6cf2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26e576,_0x5f195b){_0x5f195b=_0x5f195b||0xcc;return function(_0x4c1252){if(_0x4c1252){return _0x26e576[_0x6cf2('0x15')](_0x5f195b);}return _0x26e576['status'](_0x5f195b)[_0x6cf2('0x16')]();};}function respondWithResult(_0x261e5a,_0x27aaf1){_0x27aaf1=_0x27aaf1||0xc8;return function(_0x113cbe){if(_0x113cbe){return _0x261e5a[_0x6cf2('0x17')](_0x27aaf1)[_0x6cf2('0x18')](_0x113cbe);}};}function respondWithFilteredResult(_0x488cf1,_0x1b4a92){return function(_0x29ef5d){if(_0x29ef5d){var _0x1442cb=typeof _0x1b4a92['offset']===_0x6cf2('0x19')&&typeof _0x1b4a92['limit']===_0x6cf2('0x19');var _0x4efc21=_0x29ef5d[_0x6cf2('0x1a')];var _0x424dad=_0x1442cb?0x0:_0x1b4a92[_0x6cf2('0x1b')];var _0x32b5bb=_0x1442cb?_0x29ef5d['count']:_0x1b4a92[_0x6cf2('0x1b')]+_0x1b4a92['limit'];var _0x29f3a1;if(_0x32b5bb>=_0x4efc21){_0x32b5bb=_0x4efc21;_0x29f3a1=0xc8;}else{_0x29f3a1=0xce;}_0x488cf1[_0x6cf2('0x17')](_0x29f3a1);return _0x488cf1[_0x6cf2('0x1c')](_0x6cf2('0x1d'),_0x424dad+'-'+_0x32b5bb+'/'+_0x4efc21)[_0x6cf2('0x18')](_0x29ef5d);}return null;};}function patchUpdates(_0x3efd37){return function(_0x4459f9){try{jsonpatch[_0x6cf2('0x1e')](_0x4459f9,_0x3efd37,!![]);}catch(_0x1e1803){return BPromise['reject'](_0x1e1803);}return _0x4459f9['save']();};}function saveUpdates(_0x2f9d74,_0x412786){return function(_0x1c8476){if(_0x1c8476){return _0x1c8476[_0x6cf2('0x1f')](_0x2f9d74)[_0x6cf2('0x20')](function(_0x4b1706){return _0x4b1706;});}return null;};}function removeEntity(_0x39f074,_0x3ccecf){return function(_0x100d88){if(_0x100d88){return _0x100d88[_0x6cf2('0x21')]()['then'](function(){_0x39f074[_0x6cf2('0x17')](0xcc)[_0x6cf2('0x16')]();});}};}function handleEntityNotFound(_0x503650,_0x2ee97f){return function(_0x1c157d){if(!_0x1c157d){_0x503650[_0x6cf2('0x15')](0x194);}return _0x1c157d;};}function handleError(_0x47294d,_0x12e128){_0x12e128=_0x12e128||0x1f4;return function(_0x1d63f6){logger['error'](_0x1d63f6[_0x6cf2('0x22')]);if(_0x1d63f6['name']){delete _0x1d63f6[_0x6cf2('0x23')];}_0x47294d[_0x6cf2('0x17')](_0x12e128)[_0x6cf2('0x24')](_0x1d63f6);};}exports[_0x6cf2('0x25')]=function(_0x204933,_0x3ef461){var _0x2fb2bf={},_0x388612={},_0x2db94b={'count':0x0,'rows':[]};var _0x1f83eb=_[_0x6cf2('0x26')](db[_0x6cf2('0x27')]['rawAttributes'],function(_0x3be6dd){return{'name':_0x3be6dd[_0x6cf2('0x28')],'type':_0x3be6dd['type'][_0x6cf2('0x29')]};});_0x388612[_0x6cf2('0x2a')]=_['map'](_0x1f83eb,_0x6cf2('0x23'));_0x388612['query']=_['keys'](_0x204933[_0x6cf2('0x2b')]);_0x388612[_0x6cf2('0x2c')]=_['intersection'](_0x388612['model'],_0x388612[_0x6cf2('0x2b')]);_0x2fb2bf[_0x6cf2('0x2d')]=_[_0x6cf2('0x2e')](_0x388612[_0x6cf2('0x2a')],qs[_0x6cf2('0x2f')](_0x204933['query'][_0x6cf2('0x2f')]));_0x2fb2bf[_0x6cf2('0x2d')]=_0x2fb2bf[_0x6cf2('0x2d')][_0x6cf2('0x30')]?_0x2fb2bf['attributes']:_0x388612[_0x6cf2('0x2a')];if(!_0x204933[_0x6cf2('0x2b')][_0x6cf2('0x31')](_0x6cf2('0x32'))){_0x2fb2bf[_0x6cf2('0x33')]=qs[_0x6cf2('0x33')](_0x204933[_0x6cf2('0x2b')][_0x6cf2('0x33')]);_0x2fb2bf['offset']=qs[_0x6cf2('0x1b')](_0x204933[_0x6cf2('0x2b')][_0x6cf2('0x1b')]);}_0x2fb2bf[_0x6cf2('0x34')]=qs[_0x6cf2('0x35')](_0x204933[_0x6cf2('0x2b')][_0x6cf2('0x35')]);_0x2fb2bf[_0x6cf2('0x36')]=qs[_0x6cf2('0x2c')](_[_0x6cf2('0x37')](_0x204933[_0x6cf2('0x2b')],_0x388612[_0x6cf2('0x2c')]),_0x1f83eb);if(_0x204933[_0x6cf2('0x2b')][_0x6cf2('0x38')]){_0x2fb2bf[_0x6cf2('0x36')]=_[_0x6cf2('0x39')](_0x2fb2bf[_0x6cf2('0x36')],{'$or':_[_0x6cf2('0x26')](_0x1f83eb,function(_0x3d2515){if(_0x3d2515[_0x6cf2('0x3a')]!==_0x6cf2('0x3b')){var _0x1c4ff4={};_0x1c4ff4[_0x3d2515[_0x6cf2('0x23')]]={'$like':'%'+_0x204933[_0x6cf2('0x2b')][_0x6cf2('0x38')]+'%'};return _0x1c4ff4;}})});}_0x2fb2bf=_[_0x6cf2('0x39')]({},_0x2fb2bf,_0x204933['options']);var _0x14b224={'where':_0x2fb2bf[_0x6cf2('0x36')]};return db['OpenchannelApplication'][_0x6cf2('0x1a')](_0x14b224)[_0x6cf2('0x20')](function(_0x4da801){_0x2db94b[_0x6cf2('0x1a')]=_0x4da801;if(_0x204933[_0x6cf2('0x2b')]['includeAll']){_0x2fb2bf['include']=[{'all':!![]}];}return db[_0x6cf2('0x27')][_0x6cf2('0x3c')](_0x2fb2bf);})['then'](function(_0x3c11b2){_0x2db94b[_0x6cf2('0x3d')]=_0x3c11b2;return _0x2db94b;})[_0x6cf2('0x20')](respondWithFilteredResult(_0x3ef461,_0x2fb2bf))[_0x6cf2('0x3e')](handleError(_0x3ef461,null));};exports[_0x6cf2('0x3f')]=function(_0x5527d2,_0x43a661){var _0x50d8f1={'raw':!![],'where':{'id':_0x5527d2[_0x6cf2('0x40')]['id']}},_0x598e44={};_0x598e44[_0x6cf2('0x2a')]=_[_0x6cf2('0x41')](db[_0x6cf2('0x27')][_0x6cf2('0x42')]);_0x598e44[_0x6cf2('0x2b')]=_['keys'](_0x5527d2[_0x6cf2('0x2b')]);_0x598e44['filters']=_['intersection'](_0x598e44[_0x6cf2('0x2a')],_0x598e44[_0x6cf2('0x2b')]);_0x50d8f1[_0x6cf2('0x2d')]=_[_0x6cf2('0x2e')](_0x598e44[_0x6cf2('0x2a')],qs[_0x6cf2('0x2f')](_0x5527d2[_0x6cf2('0x2b')][_0x6cf2('0x2f')]));_0x50d8f1[_0x6cf2('0x2d')]=_0x50d8f1[_0x6cf2('0x2d')][_0x6cf2('0x30')]?_0x50d8f1[_0x6cf2('0x2d')]:_0x598e44['model'];if(_0x5527d2[_0x6cf2('0x2b')][_0x6cf2('0x43')]){_0x50d8f1[_0x6cf2('0x44')]=[{'all':!![]}];}_0x50d8f1=_[_0x6cf2('0x39')]({},_0x50d8f1,_0x5527d2[_0x6cf2('0x45')]);return db[_0x6cf2('0x27')]['find'](_0x50d8f1)[_0x6cf2('0x20')](handleEntityNotFound(_0x43a661,null))['then'](respondWithResult(_0x43a661,null))[_0x6cf2('0x3e')](handleError(_0x43a661,null));};exports['create']=function(_0x51e16e,_0x4ddd10){return db[_0x6cf2('0x27')]['create'](_0x51e16e[_0x6cf2('0x46')],{})['then'](respondWithResult(_0x4ddd10,0xc9))[_0x6cf2('0x3e')](handleError(_0x4ddd10,null));};exports[_0x6cf2('0x1f')]=function(_0x4907d0,_0x5ce13d){if(_0x4907d0['body']['id']){delete _0x4907d0['body']['id'];}return db[_0x6cf2('0x27')][_0x6cf2('0x47')]({'where':{'id':_0x4907d0['params']['id']}})[_0x6cf2('0x20')](handleEntityNotFound(_0x5ce13d,null))[_0x6cf2('0x20')](saveUpdates(_0x4907d0[_0x6cf2('0x46')],null))[_0x6cf2('0x20')](respondWithResult(_0x5ce13d,null))[_0x6cf2('0x3e')](handleError(_0x5ce13d,null));};exports['destroy']=function(_0xdba99e,_0x76706f){return db[_0x6cf2('0x27')][_0x6cf2('0x47')]({'where':{'id':_0xdba99e[_0x6cf2('0x40')]['id']}})[_0x6cf2('0x20')](handleEntityNotFound(_0x76706f,null))[_0x6cf2('0x20')](removeEntity(_0x76706f,null))[_0x6cf2('0x3e')](handleError(_0x76706f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b417341..c4fc891 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 _0xe020=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x2556e6,_0x34a4fe){var _0x5c1423=function(_0x587cd0){while(--_0x587cd0){_0x2556e6['push'](_0x2556e6['shift']());}};_0x5c1423(++_0x34a4fe);}(_0xe020,0x1c1));var _0x0e02=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe020[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x0e02('0x0'));var util=require(_0x0e02('0x1'));var logger=require('../../config/logger')(_0x0e02('0x2'));var moment=require(_0x0e02('0x3'));var BPromise=require(_0x0e02('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e02('0x5'));var rimraf=require(_0x0e02('0x6'));var config=require(_0x0e02('0x7'));var attributes=require(_0x0e02('0x8'));module[_0x0e02('0x9')]=function(_0x579900,_0x322ae8){return _0x579900[_0x0e02('0xa')](_0x0e02('0xb'),attributes,{'tableName':_0x0e02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e02('0xd')});}; \ No newline at end of file +var _0xb3da=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1abb61,_0x475834){var _0x2d71e7=function(_0x46a3d8){while(--_0x46a3d8){_0x1abb61['push'](_0x1abb61['shift']());}};_0x2d71e7(++_0x475834);}(_0xb3da,0x12b));var _0xab3d=function(_0x333151,_0x8965a3){_0x333151=_0x333151-0x0;var _0x57154c=_0xb3da[_0x333151];return _0x57154c;};'use strict';var _=require(_0xab3d('0x0'));var util=require(_0xab3d('0x1'));var logger=require(_0xab3d('0x2'))(_0xab3d('0x3'));var moment=require(_0xab3d('0x4'));var BPromise=require(_0xab3d('0x5'));var rp=require(_0xab3d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab3d('0x7'));var attributes=require(_0xab3d('0x8'));module['exports']=function(_0x30724a,_0x5c823a){return _0x30724a[_0xab3d('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xab3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab3d('0xb'),'collate':_0xab3d('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 14f5208..835aa2f 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 _0x65ae=['attributes','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw'];(function(_0x45f133,_0x17c20f){var _0x2ff2ea=function(_0xada865){while(--_0xada865){_0x45f133['push'](_0x45f133['shift']());}};_0x2ff2ea(++_0x17c20f);}(_0x65ae,0xe2));var _0xe65a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65ae[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe65a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe65a('0x1'));var rs=require(_0xe65a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe65a('0x3'));var logger=require('../../config/logger')(_0xe65a('0x4'));var config=require(_0xe65a('0x5'));var jayson=require(_0xe65a('0x6'));var client=jayson[_0xe65a('0x7')][_0xe65a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x315ecb,_0x5d28cd,_0xda416b){return new BPromise(function(_0x5a2859,_0x5022d1){return client['request'](_0x315ecb,_0xda416b)[_0xe65a('0x9')](function(_0x51e253){logger['info'](_0xe65a('0xa'),_0x5d28cd,_0xe65a('0xb'));logger[_0xe65a('0xc')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5d28cd,_0xe65a('0xb'),JSON[_0xe65a('0xd')](_0x51e253));if(_0x51e253[_0xe65a('0xe')]){if(_0x51e253[_0xe65a('0xe')][_0xe65a('0xf')]===0x1f4){logger[_0xe65a('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5d28cd,_0x51e253[_0xe65a('0xe')]['message']);return _0x5022d1(_0x51e253['error'][_0xe65a('0x10')]);}logger[_0xe65a('0xe')](_0xe65a('0xa'),_0x5d28cd,_0x51e253['error']['message']);return _0x5a2859(_0x51e253[_0xe65a('0xe')][_0xe65a('0x10')]);}else{logger[_0xe65a('0x11')](_0xe65a('0xa'),_0x5d28cd,'request\x20sent');_0x5a2859(_0x51e253['result'][_0xe65a('0x10')]);}})[_0xe65a('0x12')](function(_0x2c11e0){logger['error'](_0xe65a('0xa'),_0x5d28cd,_0x2c11e0);_0x5022d1(_0x2c11e0);});});}exports[_0xe65a('0x13')]=function(_0x177e02){var _0x2a45da=this;return new Promise(function(_0x142cc7,_0x14d5af){return db[_0xe65a('0x14')]['update'](_0x177e02[_0xe65a('0x15')],{'raw':_0x177e02[_0xe65a('0x16')]?_0x177e02[_0xe65a('0x16')][_0xe65a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177e02[_0xe65a('0x16')]?_0x177e02['options']['where']||null:null,'attributes':_0x177e02[_0xe65a('0x16')]?_0x177e02['options'][_0xe65a('0x18')]||null:null,'limit':_0x177e02[_0xe65a('0x16')]?_0x177e02[_0xe65a('0x16')]['limit']||null:null})[_0xe65a('0x9')](function(_0x385cdc){logger[_0xe65a('0x11')]('UpdateOpenchannelApplication',_0x177e02);logger[_0xe65a('0xc')](_0xe65a('0x13'),_0x177e02,JSON[_0xe65a('0xd')](_0x385cdc));_0x142cc7(_0x385cdc);})[_0xe65a('0x12')](function(_0x1fa8cf){logger[_0xe65a('0xe')]('UpdateOpenchannelApplication',_0x1fa8cf[_0xe65a('0x10')],_0x177e02);_0x14d5af(_0x2a45da[_0xe65a('0xe')](0x1f4,_0x1fa8cf[_0xe65a('0x10')]));});});}; \ No newline at end of file +var _0xd341=['../../config/utils','../../config/logger','../../config/environment','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','OpenchannelApplication','update','body','options','raw','limit','UpdateOpenchannelApplication','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x442e55,_0x5c6404){var _0x547168=function(_0x5658fd){while(--_0x5658fd){_0x442e55['push'](_0x442e55['shift']());}};_0x547168(++_0x5c6404);}(_0xd341,0xd3));var _0x1d34=function(_0x2711fa,_0x1aa9db){_0x2711fa=_0x2711fa-0x0;var _0x2b2ab6=_0xd341[_0x2711fa];return _0x2b2ab6;};'use strict';var _=require('lodash');var util=require(_0x1d34('0x0'));var moment=require(_0x1d34('0x1'));var BPromise=require('bluebird');var rs=require(_0x1d34('0x2'));var fs=require('fs');var Redis=require(_0x1d34('0x3'));var db=require(_0x1d34('0x4'))['db'];var utils=require(_0x1d34('0x5'));var logger=require(_0x1d34('0x6'))('rpc');var config=require(_0x1d34('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1284aa,_0x261a14,_0x76885){return new BPromise(function(_0x4ef05f,_0x14d7be){return client[_0x1d34('0x8')](_0x1284aa,_0x76885)[_0x1d34('0x9')](function(_0x560d1e){logger[_0x1d34('0xa')](_0x1d34('0xb'),_0x261a14,'request\x20sent');logger[_0x1d34('0xc')](_0x1d34('0xd'),_0x261a14,_0x1d34('0xe'),JSON['stringify'](_0x560d1e));if(_0x560d1e[_0x1d34('0xf')]){if(_0x560d1e[_0x1d34('0xf')][_0x1d34('0x10')]===0x1f4){logger[_0x1d34('0xf')](_0x1d34('0xb'),_0x261a14,_0x560d1e[_0x1d34('0xf')]['message']);return _0x14d7be(_0x560d1e['error'][_0x1d34('0x11')]);}logger[_0x1d34('0xf')](_0x1d34('0xb'),_0x261a14,_0x560d1e[_0x1d34('0xf')][_0x1d34('0x11')]);return _0x4ef05f(_0x560d1e[_0x1d34('0xf')][_0x1d34('0x11')]);}else{logger[_0x1d34('0xa')](_0x1d34('0xb'),_0x261a14,_0x1d34('0xe'));_0x4ef05f(_0x560d1e[_0x1d34('0x12')][_0x1d34('0x11')]);}})['catch'](function(_0x3753ee){logger[_0x1d34('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x261a14,_0x3753ee);_0x14d7be(_0x3753ee);});});}exports['UpdateOpenchannelApplication']=function(_0xc1bc56){var _0x2dc566=this;return new Promise(function(_0x1efb14,_0x272b4f){return db[_0x1d34('0x13')][_0x1d34('0x14')](_0xc1bc56[_0x1d34('0x15')],{'raw':_0xc1bc56[_0x1d34('0x16')]?_0xc1bc56[_0x1d34('0x16')][_0x1d34('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc1bc56[_0x1d34('0x16')]?_0xc1bc56[_0x1d34('0x16')]['where']||null:null,'attributes':_0xc1bc56[_0x1d34('0x16')]?_0xc1bc56[_0x1d34('0x16')]['attributes']||null:null,'limit':_0xc1bc56[_0x1d34('0x16')]?_0xc1bc56[_0x1d34('0x16')][_0x1d34('0x18')]||null:null})['then'](function(_0x1f3c85){logger[_0x1d34('0xa')](_0x1d34('0x19'),_0xc1bc56);logger[_0x1d34('0xc')]('UpdateOpenchannelApplication',_0xc1bc56,JSON['stringify'](_0x1f3c85));_0x1efb14(_0x1f3c85);})[_0x1d34('0x1a')](function(_0x2263d){logger[_0x1d34('0xf')](_0x1d34('0x19'),_0x2263d[_0x1d34('0x11')],_0xc1bc56);_0x272b4f(_0x2dc566[_0x1d34('0xf')](0x1f4,_0x2263d[_0x1d34('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a886466..441a295 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 _0x5c87=['openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked'];(function(_0x18451c,_0x1f5c0a){var _0x268d83=function(_0x15e4b2){while(--_0x15e4b2){_0x18451c['push'](_0x18451c['shift']());}};_0x268d83(++_0x1f5c0a);}(_0x5c87,0x1e9));var _0x75c8=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x5c87[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require(_0x75c8('0x0'));var util=require('util');var path=require(_0x75c8('0x1'));var timeout=require(_0x75c8('0x2'));var express=require(_0x75c8('0x3'));var router=express[_0x75c8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x75c8('0x5'));var config=require(_0x75c8('0x6'));var controller=require(_0x75c8('0x7'));router[_0x75c8('0x8')]('/',auth[_0x75c8('0x9')](),controller['index']);router[_0x75c8('0x8')](_0x75c8('0xa'),auth[_0x75c8('0x9')](),controller[_0x75c8('0xb')]);router[_0x75c8('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x75c8('0xc'),auth[_0x75c8('0x9')](),controller[_0x75c8('0xd')]);router[_0x75c8('0x8')](_0x75c8('0xe'),auth['isAuthenticated'](),controller[_0x75c8('0xf')]);router['post']('/',auth[_0x75c8('0x9')](),controller[_0x75c8('0x10')]);router[_0x75c8('0x11')](_0x75c8('0xc'),auth[_0x75c8('0x9')](),controller[_0x75c8('0x12')]);router[_0x75c8('0x11')](_0x75c8('0x13'),auth[_0x75c8('0x9')](),interaction[_0x75c8('0x14')](_0x75c8('0x15'),_0x75c8('0x16')),controller[_0x75c8('0x17')]);router['put']('/:id',auth[_0x75c8('0x9')](),interaction[_0x75c8('0x14')]('openchannel',_0x75c8('0x18')),controller[_0x75c8('0x19')]);router[_0x75c8('0x1a')]('/:id',auth[_0x75c8('0x9')](),interaction[_0x75c8('0x14')](_0x75c8('0x15'),_0x75c8('0x1b')),controller[_0x75c8('0x1c')]);router['delete'](_0x75c8('0x13'),auth['isAuthenticated'](),controller[_0x75c8('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x38a9=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','put','/:id','openchannelinteraction:update','openchannel','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','index','get','isAuthenticated','show'];(function(_0x20a655,_0x1d37f0){var _0x15471e=function(_0x470727){while(--_0x470727){_0x20a655['push'](_0x20a655['shift']());}};_0x15471e(++_0x1d37f0);}(_0x38a9,0x10a));var _0x938a=function(_0xecebff,_0x28ddd5){_0xecebff=_0xecebff-0x0;var _0xc6db13=_0x38a9[_0xecebff];return _0xc6db13;};'use strict';var multer=require(_0x938a('0x0'));var util=require(_0x938a('0x1'));var path=require('path');var timeout=require(_0x938a('0x2'));var express=require(_0x938a('0x3'));var router=express[_0x938a('0x4')]();var fs_extra=require(_0x938a('0x5'));var auth=require(_0x938a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x938a('0x7'));var controller=require(_0x938a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x938a('0x9')]);router[_0x938a('0xa')]('/describe',auth[_0x938a('0xb')](),controller['describe']);router[_0x938a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x938a('0xc')]);router[_0x938a('0xa')](_0x938a('0xd'),auth['isAuthenticated'](),controller[_0x938a('0xe')]);router['get'](_0x938a('0xf'),auth['isAuthenticated'](),controller[_0x938a('0x10')]);router[_0x938a('0x11')]('/',auth[_0x938a('0xb')](),controller[_0x938a('0x12')]);router[_0x938a('0x11')](_0x938a('0xd'),auth[_0x938a('0xb')](),controller[_0x938a('0x13')]);router[_0x938a('0x11')]('/:id/tags',auth[_0x938a('0xb')](),interaction[_0x938a('0x14')]('openchannel','openchannelinteraction:addtags'),controller['addTags']);router[_0x938a('0x15')](_0x938a('0x16'),auth[_0x938a('0xb')](),interaction[_0x938a('0x14')]('openchannel',_0x938a('0x17')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x938a('0x18'),_0x938a('0x19')),controller[_0x938a('0x1a')]);router[_0x938a('0x1b')](_0x938a('0x1c'),auth[_0x938a('0xb')](),controller[_0x938a('0x1d')]);module[_0x938a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 0f4bcd8..678384d 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 _0x8286=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3169fc,_0xf3d81e){var _0xcd8048=function(_0x3fefec){while(--_0x3fefec){_0x3169fc['push'](_0x3169fc['shift']());}};_0xcd8048(++_0xf3d81e);}(_0x8286,0x66));var _0x6828=function(_0x1c23ec,_0x4f632f){_0x1c23ec=_0x1c23ec-0x0;var _0x1e97a4=_0x8286[_0x1c23ec];return _0x1e97a4;};'use strict';var Sequelize=require(_0x6828('0x0'));module[_0x6828('0x1')]={'closed':{'type':Sequelize[_0x6828('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6828('0x3')]},'disposition':{'type':Sequelize[_0x6828('0x4')]},'secondDisposition':{'type':Sequelize[_0x6828('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6828('0x4')]},'note':{'type':Sequelize[_0x6828('0x4')]},'read1stAt':{'type':Sequelize[_0x6828('0x3')]},'threadId':{'type':Sequelize[_0x6828('0x4')]},'externalUrl':{'type':Sequelize[_0x6828('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6828('0x5')]('in',_0x6828('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6828('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6828('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6828('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaac0=['ENUM','out','BOOLEAN','INTEGER','sequelize','exports','DATE','STRING'];(function(_0xf5a4c9,_0x5cf70e){var _0x23b68f=function(_0x35e79a){while(--_0x35e79a){_0xf5a4c9['push'](_0xf5a4c9['shift']());}};_0x23b68f(++_0x5cf70e);}(_0xaac0,0x10c));var _0x0aac=function(_0x3550b4,_0x59b309){_0x3550b4=_0x3550b4-0x0;var _0x237bca=_0xaac0[_0x3550b4];return _0x237bca;};'use strict';var Sequelize=require(_0x0aac('0x0'));module[_0x0aac('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0aac('0x2')]},'disposition':{'type':Sequelize[_0x0aac('0x3')]},'secondDisposition':{'type':Sequelize[_0x0aac('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0aac('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0aac('0x3')]},'externalUrl':{'type':Sequelize[_0x0aac('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0aac('0x4')]('in',_0x0aac('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x0aac('0x4')]('in',_0x0aac('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0aac('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x0aac('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0aac('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ab6505c..6bb341c 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 _0x4f1f=['read','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','disposition','threadId','Public','Private','basename','createReadStream','pipe','toString','System','Contact','firstName','lastName','out','renderFile','views','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','destroy','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','length','nolimit','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Attachment','Messages','createdAt','direction','secret'];(function(_0x4591c7,_0x4e56bf){var _0x5eb6f5=function(_0x283f08){while(--_0x283f08){_0x4591c7['push'](_0x4591c7['shift']());}};_0x5eb6f5(++_0x4e56bf);}(_0x4f1f,0x195));var _0xf4f1=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4f1f[_0x24061a];return _0x82054e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf4f1('0x0'));var moment=require(_0xf4f1('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xf4f1('0x2'));var fs=require('fs');var _=require(_0xf4f1('0x3'));var Redis=require(_0xf4f1('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xf4f1('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0xf4f1('0x6'))(_0xf4f1('0x7'));var config=require(_0xf4f1('0x8'));var db=require('../../mysqldb')['db'];config[_0xf4f1('0x9')]=_['defaults'](config[_0xf4f1('0x9')],{'host':_0xf4f1('0xa'),'port':0x18eb});var socket=require(_0xf4f1('0xb'))(new Redis(config[_0xf4f1('0x9')]));require(_0xf4f1('0xc'))[_0xf4f1('0xd')](socket);function respondWithStatusCode(_0x29146c,_0x45ebf6){_0x45ebf6=_0x45ebf6||0xcc;return function(_0x18996f){if(_0x18996f){return _0x29146c[_0xf4f1('0xe')](_0x45ebf6);}return _0x29146c[_0xf4f1('0xf')](_0x45ebf6)[_0xf4f1('0x10')]();};}function respondWithResult(_0x52ce59,_0x1b9442){_0x1b9442=_0x1b9442||0xc8;return function(_0x1efde6){if(_0x1efde6){return _0x52ce59[_0xf4f1('0xf')](_0x1b9442)[_0xf4f1('0x11')](_0x1efde6);}};}function respondWithFilteredResult(_0x2c32a7,_0x1a0ec5){return function(_0x2e3dc5){if(_0x2e3dc5){var _0x5274a4=typeof _0x1a0ec5[_0xf4f1('0x12')]===_0xf4f1('0x13')&&typeof _0x1a0ec5[_0xf4f1('0x14')]===_0xf4f1('0x13');var _0x4ccbee=_0x2e3dc5[_0xf4f1('0x15')];var _0x12bae3=_0x5274a4?0x0:_0x1a0ec5[_0xf4f1('0x12')];var _0xa6e710=_0x5274a4?_0x2e3dc5['count']:_0x1a0ec5[_0xf4f1('0x12')]+_0x1a0ec5[_0xf4f1('0x14')];var _0x428257;if(_0xa6e710>=_0x4ccbee){_0xa6e710=_0x4ccbee;_0x428257=0xc8;}else{_0x428257=0xce;}_0x2c32a7['status'](_0x428257);return _0x2c32a7[_0xf4f1('0x16')]('Content-Range',_0x12bae3+'-'+_0xa6e710+'/'+_0x4ccbee)[_0xf4f1('0x11')](_0x2e3dc5);}return null;};}function saveUpdates(_0x54581a){return function(_0x57a7cf){if(_0x57a7cf){return _0x57a7cf[_0xf4f1('0x17')](_0x54581a)['then'](function(_0x1703d3){return _0x1703d3;});}return null;};}function removeEntity(_0x3ff8d3){return function(_0x5455bc){if(_0x5455bc){return _0x5455bc['destroy']()[_0xf4f1('0x18')](function(){_0x3ff8d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b014){return function(_0x30c42e){if(!_0x30c42e){_0x14b014[_0xf4f1('0xe')](0x194);}return _0x30c42e;};}function handleError(_0x5cfb47,_0x503805){_0x503805=_0x503805||0x1f4;return function(_0xaa9413){logger[_0xf4f1('0x19')](_0xaa9413[_0xf4f1('0x1a')]);if(_0xaa9413[_0xf4f1('0x1b')]){delete _0xaa9413[_0xf4f1('0x1b')];}_0x5cfb47[_0xf4f1('0xf')](_0x503805)[_0xf4f1('0x1c')](_0xaa9413);};}exports[_0xf4f1('0x1d')]=function(_0x45ae12,_0x5edf31){var _0x69c0ee={};var _0x64e921=_[_0xf4f1('0x1e')](db[_0xf4f1('0x1f')][_0xf4f1('0x20')],function(_0x447139){return{'name':_0x447139[_0xf4f1('0x21')],'type':_0x447139[_0xf4f1('0x22')][_0xf4f1('0x23')]};});_0x69c0ee=qs[_0xf4f1('0x24')](_0x64e921,_0x45ae12);return interaction[_0xf4f1('0x25')](_0xf4f1('0x26'),_0x45ae12[_0xf4f1('0x27')],_0x45ae12[_0xf4f1('0x28')],_0x69c0ee,_0x64e921)[_0xf4f1('0x18')](respondWithFilteredResult(_0x5edf31,_0x69c0ee))[_0xf4f1('0x29')](handleError(_0x5edf31,null));};exports[_0xf4f1('0x2a')]=function(_0x2f1ec2,_0x2368de){var _0xe3b2d7={};if(_0x2f1ec2[_0xf4f1('0x27')][_0xf4f1('0x22')]&&_0x2f1ec2[_0xf4f1('0x27')][_0xf4f1('0x22')]==='from'){_0xe3b2d7[_0xf4f1('0x2b')]=_0x2f1ec2[_0xf4f1('0x2c')]['id'];}else{_0xe3b2d7['id']=_0x2f1ec2[_0xf4f1('0x2c')]['id'];}var _0x49ea0b={'raw':![],'where':_0xe3b2d7},_0x1ba4d7={};_0x1ba4d7[_0xf4f1('0x2d')]=_[_0xf4f1('0x2e')](db[_0xf4f1('0x1f')][_0xf4f1('0x20')]);_0x1ba4d7['query']=_[_0xf4f1('0x2e')](_0x2f1ec2[_0xf4f1('0x27')]);_0x1ba4d7[_0xf4f1('0x2f')]=_[_0xf4f1('0x30')](_0x1ba4d7[_0xf4f1('0x2d')],_0x1ba4d7['query']);_0x49ea0b[_0xf4f1('0x31')]=_[_0xf4f1('0x30')](_0x1ba4d7[_0xf4f1('0x2d')],qs[_0xf4f1('0x32')](_0x2f1ec2[_0xf4f1('0x27')][_0xf4f1('0x32')]));_0x49ea0b[_0xf4f1('0x31')]=_0x49ea0b[_0xf4f1('0x31')]['length']?_0x49ea0b[_0xf4f1('0x31')]:_0x1ba4d7[_0xf4f1('0x2d')];if(_0x2f1ec2['query'][_0xf4f1('0x33')]){_0x49ea0b['include']=[{'all':!![]}];}_0x49ea0b=_[_0xf4f1('0x34')]({},_0x49ea0b,_0x2f1ec2[_0xf4f1('0x35')]);return db[_0xf4f1('0x1f')][_0xf4f1('0x36')](_0x49ea0b)[_0xf4f1('0x18')](handleEntityNotFound(_0x2368de,null))[_0xf4f1('0x18')](respondWithResult(_0x2368de,null))['catch'](handleError(_0x2368de,null));};exports[_0xf4f1('0x37')]=function(_0x272103,_0x1dde94){return db[_0xf4f1('0x1f')][_0xf4f1('0x37')](_0x272103[_0xf4f1('0x38')],{})['then'](respondWithResult(_0x1dde94,0xc9))[_0xf4f1('0x29')](handleError(_0x1dde94,null));};exports[_0xf4f1('0x17')]=function(_0x10d983,_0x5f3691){if(_0x10d983[_0xf4f1('0x38')]['id']){delete _0x10d983[_0xf4f1('0x38')]['id'];}return db[_0xf4f1('0x1f')][_0xf4f1('0x36')]({'where':{'id':_0x10d983['params']['id']}})[_0xf4f1('0x18')](handleEntityNotFound(_0x5f3691,null))[_0xf4f1('0x18')](saveUpdates(_0x10d983['body'],null))[_0xf4f1('0x18')](respondWithResult(_0x5f3691,null))['catch'](handleError(_0x5f3691,null));};exports[_0xf4f1('0x39')]=function(_0x4dbc1c,_0x32efb9){return db[_0xf4f1('0x1f')][_0xf4f1('0x36')]({'where':{'id':_0x4dbc1c['params']['id']}})[_0xf4f1('0x18')](handleEntityNotFound(_0x32efb9,null))[_0xf4f1('0x18')](removeEntity(_0x32efb9,null))[_0xf4f1('0x29')](handleError(_0x32efb9,null));};exports[_0xf4f1('0x3a')]=function(_0x3603d0,_0x942ddd){return db['OpenchannelInteraction'][_0xf4f1('0x3a')]()['then'](respondWithResult(_0x942ddd,null))[_0xf4f1('0x29')](handleError(_0x942ddd,null));};exports['addMessage']=function(_0x3b4226,_0x212f60){return db[_0xf4f1('0x3b')][_0xf4f1('0x36')]({'where':{'id':_0x3b4226[_0xf4f1('0x2c')]['id']}})[_0xf4f1('0x18')](handleEntityNotFound(_0x212f60,null))[_0xf4f1('0x18')](function(_0x1a58ce){if(_0x1a58ce){return _0x1a58ce[_0xf4f1('0x3c')](_0x3b4226[_0xf4f1('0x38')][_0xf4f1('0x3d')],_[_0xf4f1('0x3e')](_0x3b4226[_0xf4f1('0x38')],[_0xf4f1('0x3d'),'id'])||{});}})[_0xf4f1('0x18')](respondWithResult(_0x212f60,null))['catch'](handleError(_0x212f60,null));};exports[_0xf4f1('0x3f')]=function(_0x235461,_0x245b83){var _0x5d3d86={'raw':![],'where':{}};var _0x298911={};var _0x35b4e6={'count':0x0,'rows':[]};return db[_0xf4f1('0x1f')]['findOne']({'where':{'id':_0x235461[_0xf4f1('0x2c')]['id']}})[_0xf4f1('0x18')](handleEntityNotFound(_0x245b83,null))[_0xf4f1('0x18')](function(_0x52b344){if(_0x52b344){_0x298911[_0xf4f1('0x2d')]=_['keys'](db[_0xf4f1('0x3b')][_0xf4f1('0x20')]);_0x298911['query']=_['keys'](_0x235461[_0xf4f1('0x27')]);_0x298911[_0xf4f1('0x2f')]=_['intersection'](_0x298911[_0xf4f1('0x2d')],_0x298911[_0xf4f1('0x27')]);_0x5d3d86[_0xf4f1('0x31')]=_[_0xf4f1('0x30')](_0x298911[_0xf4f1('0x2d')],qs[_0xf4f1('0x32')](_0x235461[_0xf4f1('0x27')][_0xf4f1('0x32')]));_0x5d3d86[_0xf4f1('0x31')]=_0x5d3d86['attributes'][_0xf4f1('0x40')]?_0x5d3d86['attributes']:_0x298911[_0xf4f1('0x2d')];if(!_0x235461[_0xf4f1('0x27')]['hasOwnProperty'](_0xf4f1('0x41'))){_0x5d3d86[_0xf4f1('0x14')]=qs['limit'](_0x235461['query'][_0xf4f1('0x14')]);_0x5d3d86['offset']=qs['offset'](_0x235461['query']['offset']);}_0x5d3d86['order']=qs[_0xf4f1('0x42')](_0x235461['query'][_0xf4f1('0x42')]);_0x5d3d86[_0xf4f1('0x43')]=qs[_0xf4f1('0x2f')](_[_0xf4f1('0x44')](_0x235461[_0xf4f1('0x27')],_0x298911[_0xf4f1('0x2f')]));_0x5d3d86[_0xf4f1('0x43')]['OpenchannelInteractionId']=_0x52b344['id'];if(_0x235461[_0xf4f1('0x27')][_0xf4f1('0x45')]){_0x5d3d86[_0xf4f1('0x43')]=_[_0xf4f1('0x34')](_0x5d3d86[_0xf4f1('0x43')],{'$or':_['map'](_0x5d3d86[_0xf4f1('0x31')],function(_0x11ff04){var _0x1e3773={};_0x1e3773[_0x11ff04]={'$like':'%'+_0x235461['query'][_0xf4f1('0x45')]+'%'};return _0x1e3773;})});}if(_0x235461['query'][_0xf4f1('0x46')]){var _0x11451c=_0x235461[_0xf4f1('0x27')][_0xf4f1('0x46')]['split'](',');var _0x21bb51={};_0x21bb51[_0x11451c[0x0]]={'$gte':moment(_0x11451c[0x1])[_0xf4f1('0x47')](_0xf4f1('0x48'))};_0x5d3d86['where']=_[_0xf4f1('0x34')](_0x5d3d86[_0xf4f1('0x43')],_0x21bb51);}_0x5d3d86=_[_0xf4f1('0x34')]({},_0x5d3d86,_0x235461[_0xf4f1('0x35')]);return db[_0xf4f1('0x3b')][_0xf4f1('0x15')]({'where':_0x5d3d86[_0xf4f1('0x43')]})[_0xf4f1('0x18')](function(_0x520128){_0x35b4e6['count']=_0x520128;if(_0x235461[_0xf4f1('0x27')][_0xf4f1('0x33')]){_0x5d3d86[_0xf4f1('0x49')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xf4f1('0x25')](_0x5d3d86);})['then'](function(_0x125b26){_0x35b4e6[_0xf4f1('0x4a')]=_0x125b26;return _0x35b4e6;});}})[_0xf4f1('0x18')](respondWithFilteredResult(_0x245b83,_0x5d3d86))[_0xf4f1('0x29')](handleError(_0x245b83,null));};exports[_0xf4f1('0x4b')]=function(_0x21103c,_0x25302b){return db[_0xf4f1('0x1f')]['find']({'where':{'id':_0x21103c[_0xf4f1('0x2c')]['id']}})[_0xf4f1('0x18')](handleEntityNotFound(_0x25302b,null))[_0xf4f1('0x18')](function(_0x18b482){if(_0x18b482){return _0x18b482['setTags'](_0x21103c[_0xf4f1('0x38')]['ids'],_['omit'](_0x21103c[_0xf4f1('0x38')],[_0xf4f1('0x3d'),'id'])||{})[_0xf4f1('0x4c')](function(){return db['Tag'][_0xf4f1('0x25')]({'attributes':['id',_0xf4f1('0x1b'),_0xf4f1('0x4d')],'where':{'id':_0x21103c['body'][_0xf4f1('0x3d')]}});})[_0xf4f1('0x18')](function(_0x54ed75){socket[_0xf4f1('0x4e')](_0xf4f1('0x4f'),{'id':Number(_0x21103c['params']['id']),'tags':_0x54ed75||[]});return{'id':Number(_0x21103c[_0xf4f1('0x2c')]['id']),'tags':_0x54ed75||[]};});}})[_0xf4f1('0x18')](respondWithResult(_0x25302b,null))[_0xf4f1('0x29')](handleError(_0x25302b,null));};exports['removeTags']=function(_0x56f631,_0xeea638){return db[_0xf4f1('0x1f')][_0xf4f1('0x36')]({'where':{'id':_0x56f631[_0xf4f1('0x2c')]['id']}})[_0xf4f1('0x18')](handleEntityNotFound(_0xeea638,null))[_0xf4f1('0x18')](function(_0x5c6a85){if(_0x5c6a85){return _0x5c6a85[_0xf4f1('0x50')](_0x56f631[_0xf4f1('0x27')][_0xf4f1('0x3d')]);}})[_0xf4f1('0x18')](respondWithStatusCode(_0xeea638,null))['catch'](handleError(_0xeea638,null));};exports[_0xf4f1('0x51')]=function(_0x4eb7e7,_0x3bd3e7){var _0xd2329=moment()[_0xf4f1('0x52')]()['toString']();var _0x10b14e=path[_0xf4f1('0x53')](config['root'],'server',_0xf4f1('0x54'),_0xf4f1('0x55'));var _0x6e06ef=path[_0xf4f1('0x53')](config[_0xf4f1('0x56')],_0xf4f1('0x57'),_0xf4f1('0x54'),_0xf4f1('0x58'));var _0x4c7446=path[_0xf4f1('0x53')](_0x10b14e,_0xd2329);var _0x2b02f7=util[_0xf4f1('0x47')](_0xf4f1('0x59'),_0x4eb7e7[_0xf4f1('0x2c')]['id'],_0xd2329);var _0x331651=path[_0xf4f1('0x53')](_0x10b14e,_0x2b02f7);var _0x4f9084=[];_0x4f9084[_0xf4f1('0x5a')]({'model':db[_0xf4f1('0x5b')],'as':_0xf4f1('0x5b'),'attributes':['id',_0xf4f1('0x5c')],'raw':!![]});_0x4f9084[_0xf4f1('0x5a')]({'model':db[_0xf4f1('0x5d')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4eb7e7[_0xf4f1('0x27')][_0xf4f1('0x58')]){_0x4f9084[_0xf4f1('0x5a')]({'model':db[_0xf4f1('0x5e')],'as':_0xf4f1('0x5e'),'raw':!![]});}var _0x1c67d5=[{'model':db[_0xf4f1('0x3b')],'as':_0xf4f1('0x5f'),'attributes':['id',_0xf4f1('0x38'),_0xf4f1('0x60'),_0xf4f1('0x61'),_0xf4f1('0x62'),_0xf4f1('0x63')],'include':_0x4f9084}];_0x1c67d5[_0xf4f1('0x5a')]({'model':db['OpenchannelAccount'],'as':_0xf4f1('0x64'),'attributes':['id','name']});_0x1c67d5[_0xf4f1('0x5a')]({'model':db['User'],'as':_0xf4f1('0x65'),'attributes':['id','fullname']});return db[_0xf4f1('0x1f')][_0xf4f1('0x36')]({'where':{'id':_0x4eb7e7[_0xf4f1('0x2c')]['id']},'include':_0x1c67d5})[_0xf4f1('0x18')](handleEntityNotFound(_0x3bd3e7,null))[_0xf4f1('0x18')](function(_0x34bf37){if(_0x34bf37){var _0x4ed0d5=_0x34bf37[_0xf4f1('0x66')]({'plain':!![]});fs[_0xf4f1('0x67')](_0x4c7446);var _0x35e80d={'channel':_0xf4f1('0x68'),'account':_0x4ed0d5['Account'][_0xf4f1('0x1b')],'agent':_0x4ed0d5[_0xf4f1('0x65')]?_0x4ed0d5[_0xf4f1('0x65')]['fullname']:_0xf4f1('0x69'),'createdAt':moment(_0x4ed0d5[_0xf4f1('0x60')])['format'](_0xf4f1('0x48'))['toString'](),'closedAt':_0x4ed0d5[_0xf4f1('0x6a')]?moment(_0x4ed0d5['closedAt'])[_0xf4f1('0x47')](_0xf4f1('0x48'))['toString']():'','disposition':_0x4ed0d5[_0xf4f1('0x6b')],'visibility':_0x4ed0d5[_0xf4f1('0x6c')]?_0xf4f1('0x6d'):_0xf4f1('0x6e'),'messages':_(_0x4ed0d5[_0xf4f1('0x5f')])[_0xf4f1('0x45')]({'secret':![]})[_0xf4f1('0x1e')](function(_0x23536d){if(_0x23536d[_0xf4f1('0x5e')]){var _0x3b51d7=path[_0xf4f1('0x53')](_0x6e06ef,_0x23536d[_0xf4f1('0x5e')][_0xf4f1('0x6f')]);if(fs['existsSync'](_0x3b51d7)){fs[_0xf4f1('0x70')](_0x3b51d7)[_0xf4f1('0x71')](fs['createWriteStream'](path[_0xf4f1('0x53')](_0x4c7446,_0x23536d[_0xf4f1('0x5e')][_0xf4f1('0x6f')])));}}return{'date':moment(_0x23536d['createdAt'])[_0xf4f1('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf4f1('0x72')](),'sender':_0x23536d[_0xf4f1('0x61')]==='out'?_0x23536d[_0xf4f1('0x5b')]?_0x23536d[_0xf4f1('0x5b')][_0xf4f1('0x5c')]:_0xf4f1('0x73'):_0x23536d[_0xf4f1('0x74')][_0xf4f1('0x75')]+(_0x23536d[_0xf4f1('0x74')][_0xf4f1('0x76')]?'\x20'+_0x23536d[_0xf4f1('0x74')][_0xf4f1('0x76')]:''),'body':_0x23536d['Attachment']?_0x23536d[_0xf4f1('0x5e')][_0xf4f1('0x6f')]:_0x23536d[_0xf4f1('0x38')],'direction':_0x23536d[_0xf4f1('0x61')]===_0xf4f1('0x77')?'A':'C','secret':_0x23536d[_0xf4f1('0x62')],'read':_0x23536d[_0xf4f1('0x63')],'attachment':_0x23536d[_0xf4f1('0x5e')]};})['value']()};return ejs[_0xf4f1('0x78')](path['join'](config[_0xf4f1('0x56')],_0xf4f1('0x57'),_0xf4f1('0x79'),'downloadInteraction.ejs'),{'interaction':_0x35e80d})[_0xf4f1('0x18')](function(_0x4aee94){var _0x287b2b=path[_0xf4f1('0x53')](_0x4c7446,'transcript-'+_0x4ed0d5['id']+'-'+_0xd2329+_0xf4f1('0x7a'));var _0xc2b6bf={'path':_0x287b2b,'channel':_0xf4f1('0x68'),'interactionId':_0x4ed0d5['id']};return pdf[_0xf4f1('0x7b')](_0x4aee94,_0xc2b6bf);})[_0xf4f1('0x18')](function(){return new Promise(function(_0x4b4731,_0x2721de){zipdir(_0x4c7446,{'saveTo':_0x331651},function(_0x2362d9,_0x4da8be){if(_0x2362d9)return _0x2721de(_0x2362d9);return _0x4b4731(_0x4da8be);});})[_0xf4f1('0x18')](function(){return new Promise(function(_0x507308,_0x423dae){rimraf(_0x4c7446,function(_0x3c9d9a){if(_0x3c9d9a)_0x423dae(_0x3c9d9a);return _0x507308();});});})[_0xf4f1('0x18')](function(){return _0x3bd3e7[_0xf4f1('0x51')](_0x331651,_0x2b02f7,function(_0x5afe73){if(_0x5afe73){logger['error'](_0xf4f1('0x7c'),_0x5afe73);}else{fs[_0xf4f1('0x7d')](_0x331651);}});});});}else{return _0x3bd3e7[_0xf4f1('0xe')](0xc8);}})[_0xf4f1('0x29')](handleError(_0x3bd3e7,null));}; \ No newline at end of file +var _0x1803=['unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','Openchannel','closed','threadId','Public','Private','basename','pipe','createWriteStream','out','System','read','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','moment','util','path','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','status','json','offset','undefined','count','limit','Content-Range','update','destroy','end','sendStatus','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','then','catch','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download'];(function(_0x4832df,_0x25f966){var _0x212038=function(_0xc86c0b){while(--_0xc86c0b){_0x4832df['push'](_0x4832df['shift']());}};_0x212038(++_0x25f966);}(_0x1803,0xa9));var _0x3180=function(_0x3a8c1b,_0x5d4e5d){_0x3a8c1b=_0x3a8c1b-0x0;var _0x2f3c39=_0x1803[_0x3a8c1b];return _0x2f3c39;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x3180('0x0'));var util=require(_0x3180('0x1'));var path=require(_0x3180('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3180('0x3'));var Redis=require(_0x3180('0x4'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x3180('0x5'))(_0x3180('0x6'));var config=require('../../config/environment');var db=require(_0x3180('0x7'))['db'];config[_0x3180('0x8')]=_[_0x3180('0x9')](config[_0x3180('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3180('0xa'))(new Redis(config['redis']));require(_0x3180('0xb'))['register'](socket);function respondWithStatusCode(_0xaca1e6,_0x4fb161){_0x4fb161=_0x4fb161||0xcc;return function(_0x1f36d8){if(_0x1f36d8){return _0xaca1e6['sendStatus'](_0x4fb161);}return _0xaca1e6[_0x3180('0xc')](_0x4fb161)['end']();};}function respondWithResult(_0x6e4ef8,_0x3e9cd2){_0x3e9cd2=_0x3e9cd2||0xc8;return function(_0x27b9f0){if(_0x27b9f0){return _0x6e4ef8[_0x3180('0xc')](_0x3e9cd2)[_0x3180('0xd')](_0x27b9f0);}};}function respondWithFilteredResult(_0x7ea2cb,_0x3bd2f6){return function(_0x529965){if(_0x529965){var _0x5ac542=typeof _0x3bd2f6[_0x3180('0xe')]===_0x3180('0xf')&&typeof _0x3bd2f6['limit']===_0x3180('0xf');var _0x2f6922=_0x529965['count'];var _0xd0ef53=_0x5ac542?0x0:_0x3bd2f6[_0x3180('0xe')];var _0x2a084a=_0x5ac542?_0x529965[_0x3180('0x10')]:_0x3bd2f6['offset']+_0x3bd2f6[_0x3180('0x11')];var _0x4d76ab;if(_0x2a084a>=_0x2f6922){_0x2a084a=_0x2f6922;_0x4d76ab=0xc8;}else{_0x4d76ab=0xce;}_0x7ea2cb[_0x3180('0xc')](_0x4d76ab);return _0x7ea2cb['set'](_0x3180('0x12'),_0xd0ef53+'-'+_0x2a084a+'/'+_0x2f6922)[_0x3180('0xd')](_0x529965);}return null;};}function saveUpdates(_0xbe7cf6){return function(_0x209ab8){if(_0x209ab8){return _0x209ab8[_0x3180('0x13')](_0xbe7cf6)['then'](function(_0x3cb81d){return _0x3cb81d;});}return null;};}function removeEntity(_0x527eb3){return function(_0x8b19dc){if(_0x8b19dc){return _0x8b19dc[_0x3180('0x14')]()['then'](function(){_0x527eb3['status'](0xcc)[_0x3180('0x15')]();});}};}function handleEntityNotFound(_0x543df2){return function(_0xabddf6){if(!_0xabddf6){_0x543df2[_0x3180('0x16')](0x194);}return _0xabddf6;};}function handleError(_0x1d246d,_0x2917e5){_0x2917e5=_0x2917e5||0x1f4;return function(_0x4b9a78){logger['error'](_0x4b9a78['stack']);if(_0x4b9a78[_0x3180('0x17')]){delete _0x4b9a78['name'];}_0x1d246d[_0x3180('0xc')](_0x2917e5)[_0x3180('0x18')](_0x4b9a78);};}exports[_0x3180('0x19')]=function(_0x178718,_0x350781){var _0x421aff={};var _0x19d41f=_[_0x3180('0x1a')](db[_0x3180('0x1b')][_0x3180('0x1c')],function(_0x483c3a){return{'name':_0x483c3a[_0x3180('0x1d')],'type':_0x483c3a[_0x3180('0x1e')][_0x3180('0x1f')]};});_0x421aff=qs[_0x3180('0x20')](_0x19d41f,_0x178718);return interaction[_0x3180('0x21')](_0x3180('0x22'),_0x178718[_0x3180('0x23')],_0x178718[_0x3180('0x24')],_0x421aff,_0x19d41f)[_0x3180('0x25')](respondWithFilteredResult(_0x350781,_0x421aff))[_0x3180('0x26')](handleError(_0x350781,null));};exports[_0x3180('0x27')]=function(_0x297134,_0x50ea46){var _0x3eb649={};if(_0x297134['query'][_0x3180('0x1e')]&&_0x297134[_0x3180('0x23')][_0x3180('0x1e')]==='from'){_0x3eb649[_0x3180('0x28')]=_0x297134[_0x3180('0x29')]['id'];}else{_0x3eb649['id']=_0x297134['params']['id'];}var _0x573502={'raw':![],'where':_0x3eb649},_0x33919b={};_0x33919b['model']=_[_0x3180('0x2a')](db[_0x3180('0x1b')][_0x3180('0x1c')]);_0x33919b['query']=_[_0x3180('0x2a')](_0x297134[_0x3180('0x23')]);_0x33919b[_0x3180('0x2b')]=_[_0x3180('0x2c')](_0x33919b[_0x3180('0x2d')],_0x33919b['query']);_0x573502[_0x3180('0x2e')]=_[_0x3180('0x2c')](_0x33919b['model'],qs['fields'](_0x297134[_0x3180('0x23')][_0x3180('0x2f')]));_0x573502[_0x3180('0x2e')]=_0x573502[_0x3180('0x2e')][_0x3180('0x30')]?_0x573502[_0x3180('0x2e')]:_0x33919b[_0x3180('0x2d')];if(_0x297134['query'][_0x3180('0x31')]){_0x573502[_0x3180('0x32')]=[{'all':!![]}];}_0x573502=_[_0x3180('0x33')]({},_0x573502,_0x297134[_0x3180('0x34')]);return db[_0x3180('0x1b')]['find'](_0x573502)[_0x3180('0x25')](handleEntityNotFound(_0x50ea46,null))[_0x3180('0x25')](respondWithResult(_0x50ea46,null))[_0x3180('0x26')](handleError(_0x50ea46,null));};exports[_0x3180('0x35')]=function(_0x4b82b2,_0x469d4c){return db[_0x3180('0x1b')]['create'](_0x4b82b2['body'],{})['then'](respondWithResult(_0x469d4c,0xc9))[_0x3180('0x26')](handleError(_0x469d4c,null));};exports['update']=function(_0x56374f,_0x1d3b94){if(_0x56374f[_0x3180('0x36')]['id']){delete _0x56374f[_0x3180('0x36')]['id'];}return db[_0x3180('0x1b')][_0x3180('0x37')]({'where':{'id':_0x56374f[_0x3180('0x29')]['id']}})[_0x3180('0x25')](handleEntityNotFound(_0x1d3b94,null))['then'](saveUpdates(_0x56374f[_0x3180('0x36')],null))[_0x3180('0x25')](respondWithResult(_0x1d3b94,null))[_0x3180('0x26')](handleError(_0x1d3b94,null));};exports[_0x3180('0x14')]=function(_0x37c5ef,_0x59bd79){return db[_0x3180('0x1b')][_0x3180('0x37')]({'where':{'id':_0x37c5ef['params']['id']}})['then'](handleEntityNotFound(_0x59bd79,null))[_0x3180('0x25')](removeEntity(_0x59bd79,null))['catch'](handleError(_0x59bd79,null));};exports[_0x3180('0x38')]=function(_0x3afc03,_0x3042bb){return db[_0x3180('0x1b')][_0x3180('0x38')]()[_0x3180('0x25')](respondWithResult(_0x3042bb,null))['catch'](handleError(_0x3042bb,null));};exports[_0x3180('0x39')]=function(_0x4b7203,_0xacede0){return db[_0x3180('0x3a')]['find']({'where':{'id':_0x4b7203[_0x3180('0x29')]['id']}})[_0x3180('0x25')](handleEntityNotFound(_0xacede0,null))[_0x3180('0x25')](function(_0x2914ee){if(_0x2914ee){return _0x2914ee[_0x3180('0x39')](_0x4b7203[_0x3180('0x36')][_0x3180('0x3b')],_[_0x3180('0x3c')](_0x4b7203[_0x3180('0x36')],[_0x3180('0x3b'),'id'])||{});}})[_0x3180('0x25')](respondWithResult(_0xacede0,null))[_0x3180('0x26')](handleError(_0xacede0,null));};exports[_0x3180('0x3d')]=function(_0x3f4265,_0x3b5f3a){var _0x2609ef={'raw':![],'where':{}};var _0x2936a0={};var _0x1f6567={'count':0x0,'rows':[]};return db[_0x3180('0x1b')][_0x3180('0x3e')]({'where':{'id':_0x3f4265[_0x3180('0x29')]['id']}})[_0x3180('0x25')](handleEntityNotFound(_0x3b5f3a,null))[_0x3180('0x25')](function(_0x1634b9){if(_0x1634b9){_0x2936a0[_0x3180('0x2d')]=_[_0x3180('0x2a')](db[_0x3180('0x3a')]['rawAttributes']);_0x2936a0[_0x3180('0x23')]=_[_0x3180('0x2a')](_0x3f4265[_0x3180('0x23')]);_0x2936a0['filters']=_[_0x3180('0x2c')](_0x2936a0[_0x3180('0x2d')],_0x2936a0[_0x3180('0x23')]);_0x2609ef[_0x3180('0x2e')]=_[_0x3180('0x2c')](_0x2936a0[_0x3180('0x2d')],qs[_0x3180('0x2f')](_0x3f4265['query'][_0x3180('0x2f')]));_0x2609ef['attributes']=_0x2609ef[_0x3180('0x2e')][_0x3180('0x30')]?_0x2609ef[_0x3180('0x2e')]:_0x2936a0[_0x3180('0x2d')];if(!_0x3f4265[_0x3180('0x23')][_0x3180('0x3f')]('nolimit')){_0x2609ef[_0x3180('0x11')]=qs[_0x3180('0x11')](_0x3f4265['query'][_0x3180('0x11')]);_0x2609ef[_0x3180('0xe')]=qs[_0x3180('0xe')](_0x3f4265[_0x3180('0x23')][_0x3180('0xe')]);}_0x2609ef['order']=qs[_0x3180('0x40')](_0x3f4265[_0x3180('0x23')][_0x3180('0x40')]);_0x2609ef[_0x3180('0x41')]=qs['filters'](_[_0x3180('0x42')](_0x3f4265[_0x3180('0x23')],_0x2936a0['filters']));_0x2609ef[_0x3180('0x41')][_0x3180('0x43')]=_0x1634b9['id'];if(_0x3f4265[_0x3180('0x23')][_0x3180('0x44')]){_0x2609ef[_0x3180('0x41')]=_[_0x3180('0x33')](_0x2609ef[_0x3180('0x41')],{'$or':_[_0x3180('0x1a')](_0x2609ef['attributes'],function(_0x4100ac){var _0x5e4604={};_0x5e4604[_0x4100ac]={'$like':'%'+_0x3f4265['query'][_0x3180('0x44')]+'%'};return _0x5e4604;})});}if(_0x3f4265[_0x3180('0x23')][_0x3180('0x45')]){var _0x53b424=_0x3f4265[_0x3180('0x23')][_0x3180('0x45')][_0x3180('0x46')](',');var _0x43a26d={};_0x43a26d[_0x53b424[0x0]]={'$gte':moment(_0x53b424[0x1])[_0x3180('0x47')](_0x3180('0x48'))};_0x2609ef[_0x3180('0x41')]=_[_0x3180('0x33')](_0x2609ef[_0x3180('0x41')],_0x43a26d);}_0x2609ef=_[_0x3180('0x33')]({},_0x2609ef,_0x3f4265[_0x3180('0x34')]);return db['OpenchannelMessage'][_0x3180('0x10')]({'where':_0x2609ef['where']})[_0x3180('0x25')](function(_0x3d1086){_0x1f6567[_0x3180('0x10')]=_0x3d1086;if(_0x3f4265[_0x3180('0x23')][_0x3180('0x31')]){_0x2609ef[_0x3180('0x32')]=[{'all':!![]}];}return db[_0x3180('0x3a')][_0x3180('0x21')](_0x2609ef);})[_0x3180('0x25')](function(_0xf1715f){_0x1f6567[_0x3180('0x49')]=_0xf1715f;return _0x1f6567;});}})[_0x3180('0x25')](respondWithFilteredResult(_0x3b5f3a,_0x2609ef))[_0x3180('0x26')](handleError(_0x3b5f3a,null));};exports['addTags']=function(_0x5ae2dd,_0x364b2b){return db[_0x3180('0x1b')][_0x3180('0x37')]({'where':{'id':_0x5ae2dd[_0x3180('0x29')]['id']}})[_0x3180('0x25')](handleEntityNotFound(_0x364b2b,null))[_0x3180('0x25')](function(_0x52e83d){if(_0x52e83d){return _0x52e83d[_0x3180('0x4a')](_0x5ae2dd[_0x3180('0x36')][_0x3180('0x3b')],_['omit'](_0x5ae2dd[_0x3180('0x36')],[_0x3180('0x3b'),'id'])||{})['spread'](function(){return db[_0x3180('0x4b')][_0x3180('0x21')]({'attributes':['id',_0x3180('0x17'),_0x3180('0x4c')],'where':{'id':_0x5ae2dd[_0x3180('0x36')][_0x3180('0x3b')]}});})[_0x3180('0x25')](function(_0x23805d){socket[_0x3180('0x4d')](_0x3180('0x4e'),{'id':Number(_0x5ae2dd[_0x3180('0x29')]['id']),'tags':_0x23805d||[]});return{'id':Number(_0x5ae2dd[_0x3180('0x29')]['id']),'tags':_0x23805d||[]};});}})[_0x3180('0x25')](respondWithResult(_0x364b2b,null))[_0x3180('0x26')](handleError(_0x364b2b,null));};exports['removeTags']=function(_0x1df4fb,_0x312a7d){return db[_0x3180('0x1b')][_0x3180('0x37')]({'where':{'id':_0x1df4fb['params']['id']}})['then'](handleEntityNotFound(_0x312a7d,null))[_0x3180('0x25')](function(_0x2c47e8){if(_0x2c47e8){return _0x2c47e8[_0x3180('0x4f')](_0x1df4fb[_0x3180('0x23')]['ids']);}})[_0x3180('0x25')](respondWithStatusCode(_0x312a7d,null))[_0x3180('0x26')](handleError(_0x312a7d,null));};exports[_0x3180('0x50')]=function(_0x1577f3,_0x18840f){var _0xf7d969=moment()[_0x3180('0x51')]()[_0x3180('0x52')]();var _0x472891=path[_0x3180('0x53')](config[_0x3180('0x54')],_0x3180('0x55'),_0x3180('0x56'),_0x3180('0x57'));var _0x322a4e=path[_0x3180('0x53')](config['root'],_0x3180('0x55'),'files','attachments');var _0x37c7b2=path[_0x3180('0x53')](_0x472891,_0xf7d969);var _0x1c915f=util['format'](_0x3180('0x58'),_0x1577f3[_0x3180('0x29')]['id'],_0xf7d969);var _0x5805da=path[_0x3180('0x53')](_0x472891,_0x1c915f);var _0x2f188e=[];_0x2f188e[_0x3180('0x59')]({'model':db[_0x3180('0x5a')],'as':_0x3180('0x5a'),'attributes':['id',_0x3180('0x5b')],'raw':!![]});_0x2f188e[_0x3180('0x59')]({'model':db[_0x3180('0x5c')],'as':_0x3180('0x5d'),'attributes':['id',_0x3180('0x5e'),_0x3180('0x5f')],'raw':!![]});if(_0x1577f3[_0x3180('0x23')][_0x3180('0x60')]){_0x2f188e[_0x3180('0x59')]({'model':db[_0x3180('0x61')],'as':_0x3180('0x61'),'raw':!![]});}var _0x5b92ad=[{'model':db[_0x3180('0x3a')],'as':_0x3180('0x62'),'attributes':['id',_0x3180('0x36'),_0x3180('0x63'),_0x3180('0x64'),_0x3180('0x65'),'read'],'include':_0x2f188e}];_0x5b92ad[_0x3180('0x59')]({'model':db['OpenchannelAccount'],'as':_0x3180('0x66'),'attributes':['id',_0x3180('0x17')]});_0x5b92ad[_0x3180('0x59')]({'model':db[_0x3180('0x5a')],'as':_0x3180('0x67'),'attributes':['id','fullname']});return db[_0x3180('0x1b')][_0x3180('0x37')]({'where':{'id':_0x1577f3['params']['id']},'include':_0x5b92ad})[_0x3180('0x25')](handleEntityNotFound(_0x18840f,null))[_0x3180('0x25')](function(_0x406b07){if(_0x406b07){var _0x327453=_0x406b07[_0x3180('0x68')]({'plain':!![]});fs['mkdirSync'](_0x37c7b2);var _0x3d319b={'channel':_0x3180('0x69'),'account':_0x327453[_0x3180('0x66')][_0x3180('0x17')],'agent':_0x327453[_0x3180('0x67')]?_0x327453[_0x3180('0x67')]['fullname']:'N.A.','createdAt':moment(_0x327453[_0x3180('0x63')])[_0x3180('0x47')](_0x3180('0x48'))[_0x3180('0x52')](),'closedAt':_0x327453[_0x3180('0x6a')]?moment(_0x327453['closedAt'])[_0x3180('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x327453['disposition'],'visibility':_0x327453[_0x3180('0x6b')]?_0x3180('0x6c'):_0x3180('0x6d'),'messages':_(_0x327453['Messages'])[_0x3180('0x44')]({'secret':![]})['map'](function(_0xfabd94){if(_0xfabd94['Attachment']){var _0x5a894b=path[_0x3180('0x53')](_0x322a4e,_0xfabd94['Attachment'][_0x3180('0x6e')]);if(fs['existsSync'](_0x5a894b)){fs['createReadStream'](_0x5a894b)[_0x3180('0x6f')](fs[_0x3180('0x70')](path['join'](_0x37c7b2,_0xfabd94[_0x3180('0x61')][_0x3180('0x6e')])));}}return{'date':moment(_0xfabd94[_0x3180('0x63')])[_0x3180('0x47')](_0x3180('0x48'))[_0x3180('0x52')](),'sender':_0xfabd94[_0x3180('0x64')]===_0x3180('0x71')?_0xfabd94[_0x3180('0x5a')]?_0xfabd94[_0x3180('0x5a')][_0x3180('0x5b')]:_0x3180('0x72'):_0xfabd94[_0x3180('0x5d')][_0x3180('0x5e')]+(_0xfabd94[_0x3180('0x5d')]['lastName']?'\x20'+_0xfabd94[_0x3180('0x5d')][_0x3180('0x5f')]:''),'body':_0xfabd94['Attachment']?_0xfabd94[_0x3180('0x61')][_0x3180('0x6e')]:_0xfabd94['body'],'direction':_0xfabd94[_0x3180('0x64')]==='out'?'A':'C','secret':_0xfabd94['secret'],'read':_0xfabd94[_0x3180('0x73')],'attachment':_0xfabd94[_0x3180('0x61')]};})[_0x3180('0x74')]()};return ejs[_0x3180('0x75')](path[_0x3180('0x53')](config[_0x3180('0x54')],_0x3180('0x55'),'views',_0x3180('0x76')),{'interaction':_0x3d319b})[_0x3180('0x25')](function(_0x5bdaad){var _0x574b08=path['join'](_0x37c7b2,_0x3180('0x77')+_0x327453['id']+'-'+_0xf7d969+_0x3180('0x78'));var _0x308389={'path':_0x574b08,'channel':_0x3180('0x69'),'interactionId':_0x327453['id']};return pdf[_0x3180('0x79')](_0x5bdaad,_0x308389);})[_0x3180('0x25')](function(){return new Promise(function(_0x3078b0,_0x56b1d5){zipdir(_0x37c7b2,{'saveTo':_0x5805da},function(_0x383189,_0x2cffb6){if(_0x383189)return _0x56b1d5(_0x383189);return _0x3078b0(_0x2cffb6);});})[_0x3180('0x25')](function(){return new Promise(function(_0x509024,_0x2e3eed){rimraf(_0x37c7b2,function(_0x21a027){if(_0x21a027)_0x2e3eed(_0x21a027);return _0x509024();});});})[_0x3180('0x25')](function(){return _0x18840f['download'](_0x5805da,_0x1c915f,function(_0x3df21e){if(_0x3df21e){logger[_0x3180('0x7a')](_0x3180('0x7b'),_0x3df21e);}else{fs[_0x3180('0x7c')](_0x5805da);}});});});}else{return _0x18840f[_0x3180('0x16')](0xc8);}})[_0x3180('0x26')](handleError(_0x18840f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 711325e..53c4e51 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 _0xb7b0=['update','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b0,0x1d7));var _0x0b7b=function(_0x28b7a2,_0x40aa58){_0x28b7a2=_0x28b7a2-0x0;var _0x404e08=_0xb7b0[_0x28b7a2];return _0x404e08;};'use strict';var EventEmitter=require(_0x0b7b('0x0'));var OpenchannelInteraction=require(_0x0b7b('0x1'))['db'][_0x0b7b('0x2')];var OpenchannelMessage=require(_0x0b7b('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0b7b('0x3')](0x0);var events={'afterCreate':_0x0b7b('0x4'),'afterUpdate':_0x0b7b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a2a7f){return function(_0x1429c8,_0x532b88,_0x73f4ba){_0x1429c8[_0x0b7b('0x6')]({'attributes':['id'],'raw':!![]})[_0x0b7b('0x7')](function(_0x40e1f5){_0x1429c8[_0x0b7b('0x8')](_0x0b7b('0x9'),_0x40e1f5['map'](function(_0x258dc8){return{'id':_0x258dc8['id']};}));return OpenchannelMessage[_0x0b7b('0xa')]({'where':{'OpenchannelInteractionId':_0x1429c8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0b7b('0x7')](function(_0x4041cd){_0x1429c8[_0x0b7b('0x8')]('unreadMessages',_0x4041cd[_0x0b7b('0xb')]);OpenchannelInteractionEvents[_0x0b7b('0xc')](_0x4a2a7f+':'+_0x1429c8['id'],_0x1429c8);OpenchannelInteractionEvents[_0x0b7b('0xc')](_0x4a2a7f,_0x1429c8);_0x73f4ba(null);})[_0x0b7b('0xd')](_0x73f4ba(null));};}for(var e in events){if(events[_0x0b7b('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x0b7b('0xf')](e,emitEvent(event));}}module[_0x0b7b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf87e=['hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','catch'];(function(_0xe0c36f,_0x4e2f07){var _0x439214=function(_0x17a64d){while(--_0x17a64d){_0xe0c36f['push'](_0xe0c36f['shift']());}};_0x439214(++_0x4e2f07);}(_0xf87e,0x158));var _0xef87=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xf87e[_0x4fde08];return _0x12e725;};'use strict';var EventEmitter=require(_0xef87('0x0'));var OpenchannelInteraction=require(_0xef87('0x1'))['db'][_0xef87('0x2')];var OpenchannelMessage=require(_0xef87('0x1'))['db'][_0xef87('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xef87('0x4')](0x0);var events={'afterCreate':_0xef87('0x5'),'afterUpdate':_0xef87('0x6'),'afterDestroy':'remove'};function emitEvent(_0x39a352){return function(_0x17ed4b,_0x524fba,_0x1e3942){_0x17ed4b[_0xef87('0x7')]({'attributes':['id'],'raw':!![]})[_0xef87('0x8')](function(_0x3fb2c4){_0x17ed4b[_0xef87('0x9')](_0xef87('0xa'),_0x3fb2c4[_0xef87('0xb')](function(_0x1b571b){return{'id':_0x1b571b['id']};}));return OpenchannelMessage[_0xef87('0xc')]({'where':{'OpenchannelInteractionId':_0x17ed4b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef87('0x8')](function(_0x958fa2){_0x17ed4b['setDataValue'](_0xef87('0xd'),_0x958fa2[_0xef87('0xe')]);OpenchannelInteractionEvents['emit'](_0x39a352+':'+_0x17ed4b['id'],_0x17ed4b);OpenchannelInteractionEvents['emit'](_0x39a352,_0x17ed4b);_0x1e3942(null);})[_0xef87('0xf')](_0x1e3942(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xef87('0x10')](e,emitEvent(event));}}module[_0xef87('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b842a65..f053bae 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 _0x9e58=['api','moment','bluebird','request-promise','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x2caedc,_0x208068){var _0x3f2ec3=function(_0x55670d){while(--_0x55670d){_0x2caedc['push'](_0x2caedc['shift']());}};_0x3f2ec3(++_0x208068);}(_0x9e58,0xec));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x89e5('0x0'));var logger=require(_0x89e5('0x1'))(_0x89e5('0x2'));var moment=require(_0x89e5('0x3'));var BPromise=require(_0x89e5('0x4'));var rp=require(_0x89e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x89e5('0x7'));module[_0x89e5('0x8')]=function(_0x213136,_0x4641d1){return _0x213136[_0x89e5('0x9')](_0x89e5('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5f3d70,_0x53c18b,_0x3d1029){if(_0x5f3d70[_0x89e5('0xb')](_0x89e5('0xc'))){_0x5f3d70['closedAt']=moment()['format'](_0x89e5('0xd'));}_0x3d1029(null,_0x5f3d70);}}});}; \ No newline at end of file +var _0xa992=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x17786e,_0x47b00e){var _0x4c9aef=function(_0x102f1d){while(--_0x102f1d){_0x17786e['push'](_0x17786e['shift']());}};_0x4c9aef(++_0x47b00e);}(_0xa992,0x18c));var _0x2a99=function(_0x131a9f,_0x4d7e08){_0x131a9f=_0x131a9f-0x0;var _0x3ba082=_0xa992[_0x131a9f];return _0x3ba082;};'use strict';var _=require(_0x2a99('0x0'));var util=require(_0x2a99('0x1'));var logger=require(_0x2a99('0x2'))(_0x2a99('0x3'));var moment=require('moment');var BPromise=require(_0x2a99('0x4'));var rp=require(_0x2a99('0x5'));var fs=require('fs');var path=require(_0x2a99('0x6'));var rimraf=require(_0x2a99('0x7'));var config=require(_0x2a99('0x8'));var attributes=require(_0x2a99('0x9'));module[_0x2a99('0xa')]=function(_0x90fbc9,_0x11c36a){return _0x90fbc9[_0x2a99('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x2a99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a99('0xd'),'collate':_0x2a99('0xe'),'hooks':{'beforeUpdate':function(_0xdc2714,_0x44d494,_0x243164){if(_0xdc2714[_0x2a99('0xf')](_0x2a99('0x10'))){_0xdc2714[_0x2a99('0x11')]=moment()[_0x2a99('0x12')](_0x2a99('0x13'));}_0x243164(null,_0xdc2714);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4449a85..e1e07d2 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 _0x8b37=['update','body','options','where','limit','catch','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','then','info','debug','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b37,0xae));var _0x78b3=function(_0x5064f5,_0xea3026){_0x5064f5=_0x5064f5-0x0;var _0x7b709=_0x8b37[_0x5064f5];return _0x7b709;};'use strict';var _=require(_0x78b3('0x0'));var util=require(_0x78b3('0x1'));var moment=require(_0x78b3('0x2'));var BPromise=require(_0x78b3('0x3'));var rs=require(_0x78b3('0x4'));var fs=require('fs');var Redis=require(_0x78b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x78b3('0x6'));var logger=require('../../config/logger')(_0x78b3('0x7'));var config=require(_0x78b3('0x8'));var jayson=require(_0x78b3('0x9'));var client=jayson['client'][_0x78b3('0xa')]({'port':0x232a});config[_0x78b3('0xb')]=_[_0x78b3('0xc')](config[_0x78b3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x78b3('0xd'))(new Redis(config[_0x78b3('0xb')]));require(_0x78b3('0xe'))[_0x78b3('0xf')](socket);function respondWithRpcPromise(_0x2952aa,_0x22593f,_0x3c74bf){return new BPromise(function(_0x3b1ca8,_0x54bf15){return client['request'](_0x2952aa,_0x3c74bf)[_0x78b3('0x10')](function(_0x19bc93){logger[_0x78b3('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x22593f,'request\x20sent');logger[_0x78b3('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x22593f,_0x78b3('0x13'),JSON[_0x78b3('0x14')](_0x19bc93));if(_0x19bc93[_0x78b3('0x15')]){if(_0x19bc93['error'][_0x78b3('0x16')]===0x1f4){logger['error'](_0x78b3('0x17'),_0x22593f,_0x19bc93[_0x78b3('0x15')][_0x78b3('0x18')]);return _0x54bf15(_0x19bc93[_0x78b3('0x15')][_0x78b3('0x18')]);}logger[_0x78b3('0x15')](_0x78b3('0x17'),_0x22593f,_0x19bc93[_0x78b3('0x15')][_0x78b3('0x18')]);return _0x3b1ca8(_0x19bc93['error']['message']);}else{logger['info'](_0x78b3('0x17'),_0x22593f,_0x78b3('0x13'));_0x3b1ca8(_0x19bc93[_0x78b3('0x19')][_0x78b3('0x18')]);}})['catch'](function(_0x33247b){logger[_0x78b3('0x15')](_0x78b3('0x17'),_0x22593f,_0x33247b);_0x54bf15(_0x33247b);});});}exports['UpdateOpenchannelInteraction']=function(_0x311351){var _0x27e27d=this;return new Promise(function(_0x40d5a8,_0x3746f7){return db['OpenchannelInteraction'][_0x78b3('0x1a')](_0x311351[_0x78b3('0x1b')],{'raw':_0x311351[_0x78b3('0x1c')]?_0x311351[_0x78b3('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x311351['options']?_0x311351['options'][_0x78b3('0x1d')]||null:null,'attributes':_0x311351[_0x78b3('0x1c')]?_0x311351[_0x78b3('0x1c')]['attributes']||null:null,'limit':_0x311351[_0x78b3('0x1c')]?_0x311351[_0x78b3('0x1c')][_0x78b3('0x1e')]||null:null})[_0x78b3('0x10')](function(_0x297720){logger[_0x78b3('0x11')]('UpdateOpenchannelInteraction',_0x311351);logger[_0x78b3('0x12')]('UpdateOpenchannelInteraction',_0x311351,JSON[_0x78b3('0x14')](_0x297720));_0x40d5a8(_0x297720);})[_0x78b3('0x1f')](function(_0x4f2b84){logger[_0x78b3('0x15')](_0x78b3('0x20'),_0x4f2b84[_0x78b3('0x18')],_0x311351);_0x3746f7(_0x27e27d[_0x78b3('0x15')](0x1f4,_0x4f2b84['message']));});});};exports[_0x78b3('0x21')]=function(_0x56f1fe){return new Promise(function(_0x22625e,_0x32df90){return db[_0x78b3('0x22')][_0x78b3('0x23')]({'where':_0x56f1fe['options']?_0x56f1fe[_0x78b3('0x1c')][_0x78b3('0x1d')]||null:null})[_0x78b3('0x10')](function(_0x99b870){if(_0x99b870){return _0x99b870[_0x78b3('0x24')](_0x56f1fe[_0x78b3('0x1b')]['ids'],_['omit'](_0x56f1fe[_0x78b3('0x1b')],[_0x78b3('0x25'),'id'])||{});}})[_0x78b3('0x26')](function(_0x4a216b){logger['info'](_0x78b3('0x27'),_0x56f1fe);logger[_0x78b3('0x12')](_0x78b3('0x27'),_0x56f1fe,JSON['stringify'](_0x4a216b));_0x22625e(_0x4a216b);})[_0x78b3('0x1f')](function(_0x5b54f0){logger[_0x78b3('0x15')](_0x78b3('0x27'),_0x5b54f0[_0x78b3('0x18')],_0x56f1fe);_0x32df90(_this[_0x78b3('0x15')](0x1f4,_0x5b54f0['message']));});});}; \ No newline at end of file +var _0x5283=['catch','update','body','options','raw','where','attributes','limit','info','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','then','addTags','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x3f7654,_0x2a9cf4){var _0x5cf7a8=function(_0x4e0d17){while(--_0x4e0d17){_0x3f7654['push'](_0x3f7654['shift']());}};_0x5cf7a8(++_0x2a9cf4);}(_0x5283,0x153));var _0x3528=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x5283[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x3528('0x0'));var util=require(_0x3528('0x1'));var moment=require('moment');var BPromise=require(_0x3528('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3528('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3528('0x4'))('rpc');var config=require(_0x3528('0x5'));var jayson=require(_0x3528('0x6'));var client=jayson[_0x3528('0x7')]['http']({'port':0x232a});config[_0x3528('0x8')]=_[_0x3528('0x9')](config[_0x3528('0x8')],{'host':_0x3528('0xa'),'port':0x18eb});var socket=require(_0x3528('0xb'))(new Redis(config[_0x3528('0x8')]));require(_0x3528('0xc'))[_0x3528('0xd')](socket);function respondWithRpcPromise(_0xe6156,_0x3635cf,_0x10f152){return new BPromise(function(_0xd62855,_0x46e0fa){return client[_0x3528('0xe')](_0xe6156,_0x10f152)['then'](function(_0x4ae865){logger['info'](_0x3528('0xf'),_0x3635cf,_0x3528('0x10'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3635cf,_0x3528('0x10'),JSON[_0x3528('0x11')](_0x4ae865));if(_0x4ae865[_0x3528('0x12')]){if(_0x4ae865[_0x3528('0x12')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3635cf,_0x4ae865[_0x3528('0x12')][_0x3528('0x13')]);return _0x46e0fa(_0x4ae865[_0x3528('0x12')][_0x3528('0x13')]);}logger[_0x3528('0x12')](_0x3528('0xf'),_0x3635cf,_0x4ae865[_0x3528('0x12')][_0x3528('0x13')]);return _0xd62855(_0x4ae865[_0x3528('0x12')][_0x3528('0x13')]);}else{logger['info'](_0x3528('0xf'),_0x3635cf,_0x3528('0x10'));_0xd62855(_0x4ae865[_0x3528('0x14')]['message']);}})[_0x3528('0x15')](function(_0x4ff4dd){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3635cf,_0x4ff4dd);_0x46e0fa(_0x4ff4dd);});});}exports['UpdateOpenchannelInteraction']=function(_0x3b54bd){var _0xa53459=this;return new Promise(function(_0x15608e,_0x564772){return db['OpenchannelInteraction'][_0x3528('0x16')](_0x3b54bd[_0x3528('0x17')],{'raw':_0x3b54bd[_0x3528('0x18')]?_0x3b54bd[_0x3528('0x18')][_0x3528('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b54bd[_0x3528('0x18')]?_0x3b54bd['options'][_0x3528('0x1a')]||null:null,'attributes':_0x3b54bd['options']?_0x3b54bd[_0x3528('0x18')][_0x3528('0x1b')]||null:null,'limit':_0x3b54bd[_0x3528('0x18')]?_0x3b54bd[_0x3528('0x18')][_0x3528('0x1c')]||null:null})['then'](function(_0x16638a){logger[_0x3528('0x1d')](_0x3528('0x1e'),_0x3b54bd);logger[_0x3528('0x1f')](_0x3528('0x1e'),_0x3b54bd,JSON['stringify'](_0x16638a));_0x15608e(_0x16638a);})['catch'](function(_0x5dba2a){logger[_0x3528('0x12')](_0x3528('0x1e'),_0x5dba2a['message'],_0x3b54bd);_0x564772(_0xa53459[_0x3528('0x12')](0x1f4,_0x5dba2a[_0x3528('0x13')]));});});};exports[_0x3528('0x20')]=function(_0xe2f6f0){return new Promise(function(_0x47f902,_0x116796){return db[_0x3528('0x21')][_0x3528('0x22')]({'where':_0xe2f6f0[_0x3528('0x18')]?_0xe2f6f0['options']['where']||null:null})[_0x3528('0x23')](function(_0x506774){if(_0x506774){return _0x506774[_0x3528('0x24')](_0xe2f6f0[_0x3528('0x17')][_0x3528('0x25')],_['omit'](_0xe2f6f0['body'],[_0x3528('0x25'),'id'])||{});}})[_0x3528('0x26')](function(_0x2918eb){logger[_0x3528('0x1d')](_0x3528('0x27'),_0xe2f6f0);logger[_0x3528('0x1f')](_0x3528('0x27'),_0xe2f6f0,JSON[_0x3528('0x11')](_0x2918eb));_0x47f902(_0x2918eb);})[_0x3528('0x15')](function(_0x274ed3){logger[_0x3528('0x12')](_0x3528('0x27'),_0x274ed3[_0x3528('0x13')],_0xe2f6f0);_0x116796(_this['error'](0x1f4,_0x274ed3[_0x3528('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d0e3280..a097251 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 _0xb9fb=['update','removeListener','register','length','./openchannelInteraction.events','save','remove'];(function(_0x58ad48,_0x14e054){var _0x173539=function(_0x52291a){while(--_0x52291a){_0x58ad48['push'](_0x58ad48['shift']());}};_0x173539(++_0x14e054);}(_0xb9fb,0xa5));var _0xbb9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb9fb[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelInteractionEvents=require(_0xbb9f('0x0'));var events=[_0xbb9f('0x1'),_0xbb9f('0x2'),_0xbb9f('0x3')];function createListener(_0x311a81,_0xacb07c){return function(_0x226ee8){_0xacb07c['emit'](_0x311a81,_0x226ee8);};}function removeListener(_0x5584b8,_0x5b5b13){return function(){OpenchannelInteractionEvents[_0xbb9f('0x4')](_0x5584b8,_0x5b5b13);};}exports[_0xbb9f('0x5')]=function(_0x3ad074){for(var _0x4afcee=0x0,_0x1b55e6=events[_0xbb9f('0x6')];_0x4afcee<_0x1b55e6;_0x4afcee++){var _0x1a778c=events[_0x4afcee];var _0x149cef=createListener('openchannelInteraction:'+_0x1a778c,_0x3ad074);OpenchannelInteractionEvents['on'](_0x1a778c,_0x149cef);}}; \ No newline at end of file +var _0x86d1=['openchannelInteraction:','save','remove','update','emit','register'];(function(_0x3159c0,_0x592776){var _0x12411f=function(_0x3b7d17){while(--_0x3b7d17){_0x3159c0['push'](_0x3159c0['shift']());}};_0x12411f(++_0x592776);}(_0x86d1,0x1cf));var _0x186d=function(_0x52564a,_0x1fd80c){_0x52564a=_0x52564a-0x0;var _0x78d9c4=_0x86d1[_0x52564a];return _0x78d9c4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x186d('0x0'),_0x186d('0x1'),_0x186d('0x2')];function createListener(_0x1e67ef,_0x4fc4f3){return function(_0x383c48){_0x4fc4f3[_0x186d('0x3')](_0x1e67ef,_0x383c48);};}function removeListener(_0xb2b2d0,_0x7f7814){return function(){OpenchannelInteractionEvents['removeListener'](_0xb2b2d0,_0x7f7814);};}exports[_0x186d('0x4')]=function(_0x2057df){for(var _0x43dc6c=0x0,_0x5087d0=events['length'];_0x43dc6c<_0x5087d0;_0x43dc6c++){var _0x56c9de=events[_0x43dc6c];var _0x177277=createListener(_0x186d('0x5')+_0x56c9de,_0x2057df);OpenchannelInteractionEvents['on'](_0x56c9de,_0x177277);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d029363..f30d0f3 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x260d03,_0x1fd42c){var _0x12ea8e=function(_0x1ca216){while(--_0x1ca216){_0x260d03['push'](_0x260d03['shift']());}};_0x12ea8e(++_0x1fd42c);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x557701,_0x180f95){var _0x4c6d09=function(_0x241b67){while(--_0x241b67){_0x557701['push'](_0x557701['shift']());}};_0x4c6d09(++_0x180f95);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'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['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6dff360..08cf08e 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 _0xdca3=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x2d2c5c,_0x1a06fe){var _0x46a8ad=function(_0x334ac9){while(--_0x334ac9){_0x2d2c5c['push'](_0x2d2c5c['shift']());}};_0x46a8ad(++_0x1a06fe);}(_0xdca3,0x64));var _0x3dca=function(_0x1db15c,_0xb7e2bd){_0x1db15c=_0x1db15c-0x0;var _0x45932e=_0xdca3[_0x1db15c];return _0x45932e;};'use strict';var Sequelize=require(_0x3dca('0x0'));module['exports']={'body':{'type':Sequelize[_0x3dca('0x1')](_0x3dca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3dca('0x4')]('in',_0x3dca('0x5')),'defaultValue':_0x3dca('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3dca('0x6')]},'providerName':{'type':Sequelize[_0x3dca('0x7')]},'providerResponse':{'type':Sequelize[_0x3dca('0x1')]}}; \ No newline at end of file +var _0x01d3=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x01d3,0xa2));var _0x301d=function(_0x937ba2,_0x13032a){_0x937ba2=_0x937ba2-0x0;var _0x3b6e7e=_0x01d3[_0x937ba2];return _0x3b6e7e;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'body':{'type':Sequelize[_0x301d('0x2')](_0x301d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x301d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x301d('0x5')]('in','out'),'defaultValue':_0x301d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x301d('0x7')]},'providerName':{'type':Sequelize[_0x301d('0x8')]},'providerResponse':{'type':Sequelize[_0x301d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 09f839c..1f90365 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 _0xfef2=['../../mysqldb','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','openchannel-interactions','accept','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','channel','event','EventManager','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','internal','SIP/%s','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x16a7d8,_0x326d5c){var _0xa4b589=function(_0x17add5){while(--_0x17add5){_0x16a7d8['push'](_0x16a7d8['shift']());}};_0xa4b589(++_0x326d5c);}(_0xfef2,0x1e0));var _0x2fef=function(_0x376de5,_0x1b44a9){_0x376de5=_0x376de5-0x0;var _0x58d8f7=_0xfef2[_0x376de5];return _0x58d8f7;};'use strict';var emlformat=require(_0x2fef('0x0'));var rimraf=require(_0x2fef('0x1'));var zipdir=require(_0x2fef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fef('0x3'));var moment=require(_0x2fef('0x4'));var BPromise=require(_0x2fef('0x5'));var Mustache=require(_0x2fef('0x6'));var util=require('util');var path=require(_0x2fef('0x7'));var sox=require('sox');var csv=require(_0x2fef('0x8'));var ejs=require(_0x2fef('0x9'));var fs=require('fs');var fs_extra=require(_0x2fef('0xa'));var _=require(_0x2fef('0xb'));var squel=require(_0x2fef('0xc'));var crypto=require(_0x2fef('0xd'));var jsforce=require(_0x2fef('0xe'));var deskjs=require(_0x2fef('0xf'));var toCsv=require(_0x2fef('0x8'));var querystring=require(_0x2fef('0x10'));var Papa=require(_0x2fef('0x11'));var Redis=require('ioredis');var authService=require(_0x2fef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2fef('0x13'));var hardwareService=require(_0x2fef('0x14'));var logger=require(_0x2fef('0x15'))(_0x2fef('0x16'));var utils=require(_0x2fef('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2fef('0x18'))['db'];config[_0x2fef('0x19')]=_['defaults'](config[_0x2fef('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2fef('0x19')]));require(_0x2fef('0x1a'))[_0x2fef('0x1b')](socket);var jayson=require(_0x2fef('0x1c'));var client=jayson[_0x2fef('0x1d')][_0x2fef('0x1e')]({'port':0x232c});var client9002=jayson[_0x2fef('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x524fdc,_0x134b67,_0x26dff2,_0x4b6862){return new BPromise(function(_0x5773d3,_0x1a0939){var _0x2483ac=_0x4b6862||client;return _0x2483ac[_0x2fef('0x1f')](_0x524fdc,_0x26dff2)[_0x2fef('0x20')](function(_0x2051ce){logger[_0x2fef('0x21')](_0x2fef('0x22'),_0x134b67,_0x2fef('0x23'));logger[_0x2fef('0x24')](_0x2fef('0x25'),_0x134b67,_0x2fef('0x23'),JSON[_0x2fef('0x26')](_0x2051ce));if(_0x2051ce[_0x2fef('0x27')]){if(_0x2051ce[_0x2fef('0x27')][_0x2fef('0x28')]===0x1f4){logger['error'](_0x2fef('0x22'),_0x134b67,_0x2051ce[_0x2fef('0x27')]['message']);return _0x1a0939(_0x2051ce[_0x2fef('0x27')][_0x2fef('0x29')]);}logger[_0x2fef('0x27')](_0x2fef('0x22'),_0x134b67,_0x2051ce[_0x2fef('0x27')][_0x2fef('0x29')]);return _0x5773d3(_0x2051ce[_0x2fef('0x27')][_0x2fef('0x29')]);}else{logger[_0x2fef('0x21')](_0x2fef('0x22'),_0x134b67,'request\x20sent');_0x5773d3(_0x2051ce[_0x2fef('0x2a')][_0x2fef('0x29')]);}})['catch'](function(_0x561c4b){logger['error'](_0x2fef('0x22'),_0x134b67,_0x561c4b);_0x1a0939(_0x561c4b);});});}function respondWithStatusCode(_0x2cf989,_0x5ab7ea){_0x5ab7ea=_0x5ab7ea||0xcc;return function(_0x343053){if(_0x343053){return _0x2cf989['sendStatus'](_0x5ab7ea);}return _0x2cf989[_0x2fef('0x2b')](_0x5ab7ea)[_0x2fef('0x2c')]();};}function respondWithResult(_0x2780cb,_0x5d5f5e){_0x5d5f5e=_0x5d5f5e||0xc8;return function(_0x2ec3a1){if(_0x2ec3a1){return _0x2780cb[_0x2fef('0x2b')](_0x5d5f5e)[_0x2fef('0x2d')](_0x2ec3a1);}};}function respondWithFilteredResult(_0x103bd9,_0x16fe17){return function(_0x1c8aed){if(_0x1c8aed){var _0x1c9e52=typeof _0x16fe17[_0x2fef('0x2e')]===_0x2fef('0x2f')&&typeof _0x16fe17[_0x2fef('0x30')]===_0x2fef('0x2f');var _0x10fa8a=_0x1c8aed['count'];var _0x19394a=_0x1c9e52?0x0:_0x16fe17['offset'];var _0x3bb0c1=_0x1c9e52?_0x1c8aed['count']:_0x16fe17['offset']+_0x16fe17[_0x2fef('0x30')];var _0x438a24;if(_0x3bb0c1>=_0x10fa8a){_0x3bb0c1=_0x10fa8a;_0x438a24=0xc8;}else{_0x438a24=0xce;}_0x103bd9['status'](_0x438a24);return _0x103bd9['set'](_0x2fef('0x31'),_0x19394a+'-'+_0x3bb0c1+'/'+_0x10fa8a)['json'](_0x1c8aed);}return null;};}function patchUpdates(_0x193965){return function(_0x3fe971){try{jsonpatch[_0x2fef('0x32')](_0x3fe971,_0x193965,!![]);}catch(_0x22fa04){return BPromise[_0x2fef('0x33')](_0x22fa04);}return _0x3fe971[_0x2fef('0x34')]();};}function saveUpdates(_0x23592d,_0x28ccd7){return function(_0x2b0746){if(_0x2b0746){return _0x2b0746[_0x2fef('0x35')](_0x23592d)[_0x2fef('0x20')](function(_0x4f9f98){return _0x4f9f98;});}return null;};}function removeEntity(_0x384142,_0x54ba3e){return function(_0x293eaf){if(_0x293eaf){return _0x293eaf['destroy']()[_0x2fef('0x20')](function(){_0x384142['status'](0xcc)[_0x2fef('0x2c')]();});}};}function handleEntityNotFound(_0x34b3b6,_0x3de987){return function(_0x548c71){if(!_0x548c71){_0x34b3b6[_0x2fef('0x36')](0x194);}return _0x548c71;};}function handleError(_0x57155e,_0x16a417){_0x16a417=_0x16a417||0x1f4;return function(_0x6cbfa7){logger[_0x2fef('0x27')](_0x6cbfa7[_0x2fef('0x37')]);if(_0x6cbfa7[_0x2fef('0x38')]){delete _0x6cbfa7[_0x2fef('0x38')];}_0x57155e[_0x2fef('0x2b')](_0x16a417)[_0x2fef('0x39')](_0x6cbfa7);};}exports['index']=function(_0x5e93db,_0xda2966){var _0x1ca16b={},_0x37e42a={},_0x42c4aa={'count':0x0,'rows':[]};var _0x46a034=_['map'](db[_0x2fef('0x3a')][_0x2fef('0x3b')],function(_0x10af02){return{'name':_0x10af02[_0x2fef('0x3c')],'type':_0x10af02[_0x2fef('0x3d')][_0x2fef('0x3e')]};});_0x37e42a[_0x2fef('0x3f')]=_[_0x2fef('0x40')](_0x46a034,_0x2fef('0x38'));_0x37e42a[_0x2fef('0x41')]=_[_0x2fef('0x42')](_0x5e93db[_0x2fef('0x41')]);_0x37e42a[_0x2fef('0x43')]=_[_0x2fef('0x44')](_0x37e42a['model'],_0x37e42a[_0x2fef('0x41')]);_0x1ca16b[_0x2fef('0x45')]=_[_0x2fef('0x44')](_0x37e42a[_0x2fef('0x3f')],qs[_0x2fef('0x46')](_0x5e93db[_0x2fef('0x41')]['fields']));_0x1ca16b[_0x2fef('0x45')]=_0x1ca16b[_0x2fef('0x45')]['length']?_0x1ca16b[_0x2fef('0x45')]:_0x37e42a[_0x2fef('0x3f')];if(!_0x5e93db[_0x2fef('0x41')][_0x2fef('0x47')]('nolimit')){_0x1ca16b[_0x2fef('0x30')]=qs['limit'](_0x5e93db[_0x2fef('0x41')][_0x2fef('0x30')]);_0x1ca16b['offset']=qs[_0x2fef('0x2e')](_0x5e93db[_0x2fef('0x41')][_0x2fef('0x2e')]);}_0x1ca16b['order']=qs['sort'](_0x5e93db[_0x2fef('0x41')][_0x2fef('0x48')]);_0x1ca16b[_0x2fef('0x49')]=qs[_0x2fef('0x43')](_['pick'](_0x5e93db[_0x2fef('0x41')],_0x37e42a[_0x2fef('0x43')]),_0x46a034);if(_0x5e93db['query']['filter']){_0x1ca16b[_0x2fef('0x49')]=_[_0x2fef('0x4a')](_0x1ca16b['where'],{'$or':_[_0x2fef('0x40')](_0x46a034,function(_0x54ea80){if(_0x54ea80[_0x2fef('0x3d')]!==_0x2fef('0x4b')){var _0x458d54={};_0x458d54[_0x54ea80[_0x2fef('0x38')]]={'$like':'%'+_0x5e93db[_0x2fef('0x41')]['filter']+'%'};return _0x458d54;}})});}_0x1ca16b=_[_0x2fef('0x4a')]({},_0x1ca16b,_0x5e93db[_0x2fef('0x4c')]);var _0x11b96b={'where':_0x1ca16b[_0x2fef('0x49')]};return db[_0x2fef('0x3a')][_0x2fef('0x4d')](_0x11b96b)[_0x2fef('0x20')](function(_0x3c0132){_0x42c4aa['count']=_0x3c0132;if(_0x5e93db['query'][_0x2fef('0x4e')]){_0x1ca16b[_0x2fef('0x4f')]=[{'all':!![]}];}return db[_0x2fef('0x3a')][_0x2fef('0x50')](_0x1ca16b);})[_0x2fef('0x20')](function(_0x47dac0){_0x42c4aa[_0x2fef('0x51')]=_0x47dac0;return _0x42c4aa;})[_0x2fef('0x20')](respondWithFilteredResult(_0xda2966,_0x1ca16b))[_0x2fef('0x52')](handleError(_0xda2966,null));};exports[_0x2fef('0x53')]=function(_0x3c30b4,_0x87441c){var _0x49edeb={'raw':!![],'where':{'id':_0x3c30b4['params']['id']}},_0x2c6f4b={};_0x2c6f4b[_0x2fef('0x3f')]=_[_0x2fef('0x42')](db[_0x2fef('0x3a')][_0x2fef('0x3b')]);_0x2c6f4b[_0x2fef('0x41')]=_[_0x2fef('0x42')](_0x3c30b4[_0x2fef('0x41')]);_0x2c6f4b[_0x2fef('0x43')]=_['intersection'](_0x2c6f4b['model'],_0x2c6f4b['query']);_0x49edeb['attributes']=_['intersection'](_0x2c6f4b[_0x2fef('0x3f')],qs[_0x2fef('0x46')](_0x3c30b4['query'][_0x2fef('0x46')]));_0x49edeb[_0x2fef('0x45')]=_0x49edeb[_0x2fef('0x45')]['length']?_0x49edeb[_0x2fef('0x45')]:_0x2c6f4b[_0x2fef('0x3f')];if(_0x3c30b4['query'][_0x2fef('0x4e')]){_0x49edeb[_0x2fef('0x4f')]=[{'all':!![]}];}_0x49edeb=_[_0x2fef('0x4a')]({},_0x49edeb,_0x3c30b4['options']);return db[_0x2fef('0x3a')][_0x2fef('0x54')](_0x49edeb)[_0x2fef('0x20')](handleEntityNotFound(_0x87441c,null))[_0x2fef('0x20')](respondWithResult(_0x87441c,null))[_0x2fef('0x52')](handleError(_0x87441c,null));};exports[_0x2fef('0x55')]=function(_0x37d193,_0x2a045e){return db[_0x2fef('0x3a')][_0x2fef('0x55')](_0x37d193['body'],{})[_0x2fef('0x20')](respondWithResult(_0x2a045e,0xc9))[_0x2fef('0x52')](handleError(_0x2a045e,null));};exports[_0x2fef('0x35')]=function(_0x8110fe,_0x37f862){if(_0x8110fe[_0x2fef('0x56')]['id']){delete _0x8110fe[_0x2fef('0x56')]['id'];}return db[_0x2fef('0x3a')][_0x2fef('0x54')]({'where':{'id':_0x8110fe[_0x2fef('0x57')]['id']}})[_0x2fef('0x20')](handleEntityNotFound(_0x37f862,null))[_0x2fef('0x20')](saveUpdates(_0x8110fe['body'],null))['then'](respondWithResult(_0x37f862,null))['catch'](handleError(_0x37f862,null));};exports[_0x2fef('0x58')]=function(_0x5f1715,_0x423c1b){return db['OpenchannelMessage'][_0x2fef('0x54')]({'where':{'id':_0x5f1715[_0x2fef('0x57')]['id']}})[_0x2fef('0x20')](handleEntityNotFound(_0x423c1b,null))[_0x2fef('0x20')](removeEntity(_0x423c1b,null))[_0x2fef('0x52')](handleError(_0x423c1b,null));};exports[_0x2fef('0x59')]=function(_0x299d6f,_0x476ec1){return db[_0x2fef('0x3a')][_0x2fef('0x59')]()['then'](respondWithResult(_0x476ec1,null))[_0x2fef('0x52')](handleError(_0x476ec1,null));};var interaction_log=require(_0x2fef('0x15'))(_0x2fef('0x5a'));exports[_0x2fef('0x5b')]=function(_0x2a1990,_0x4609b0,_0x4f0eb9){var _0x2638a3={'agent':{},'channel':'openchannel'};if(_0x2a1990[_0x2fef('0x56')]['id']){delete _0x2a1990[_0x2fef('0x56')]['id'];}_0x2a1990['body'][_0x2fef('0x5c')]=!![];_0x2a1990[_0x2fef('0x56')][_0x2fef('0x5d')]=moment()[_0x2fef('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a1990[_0x2fef('0x56')]['UserId']=_0x2a1990[_0x2fef('0x56')][_0x2fef('0x5f')]||_0x2a1990[_0x2fef('0x60')]['id'];_0x2638a3[_0x2fef('0x61')]['id']=_0x2a1990['body'][_0x2fef('0x5f')];return db[_0x2fef('0x3a')][_0x2fef('0x54')]({'where':{'id':_0x2a1990[_0x2fef('0x57')]['id'],'UserId':null}})[_0x2fef('0x20')](handleEntityNotFound(_0x4609b0,null))[_0x2fef('0x20')](saveUpdates(_0x2a1990[_0x2fef('0x56')],null))['then'](function(_0x3b05d){if(_0x3b05d){_0x2638a3[_0x2fef('0x29')]=_0x3b05d[_0x2fef('0x62')]({'plain':!![]});return db[_0x2fef('0x63')][_0x2fef('0x54')]({'where':{'id':_0x3b05d['OpenchannelInteractionId']}});}return null;})[_0x2fef('0x20')](handleEntityNotFound(_0x4609b0,null))[_0x2fef('0x20')](function(_0x327cb4){if(_0x327cb4){return _0x327cb4['update']({'UserId':_0x2a1990[_0x2fef('0x56')][_0x2fef('0x5f')],'read1stAt':_['isNil'](_0x327cb4['read1stAt'])?moment()[_0x2fef('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x101442){if(_0x101442){_0x2638a3[_0x2fef('0x64')]=_0x101442[_0x2fef('0x62')]({'plain':!![]});interaction_log[_0x2fef('0x21')](_0x2fef('0x65'),_0x2a1990[_0x2fef('0x60')]['id'],_0x2a1990['user'][_0x2fef('0x38')],_0x2a1990['user'][_0x2fef('0x66')],_0x2638a3[_0x2fef('0x64')]['id'],_0x2a1990[_0x2fef('0x56')]?JSON[_0x2fef('0x26')](_0x2a1990[_0x2fef('0x56')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2638a3);}return null;})['then'](function(_0x27db0a){var _0x4720ba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27db0a[_0x2fef('0x29')]['ContactId'];return db['sequelize'][_0x2fef('0x41')](_0x4720ba,{'type':db[_0x2fef('0x67')][_0x2fef('0x68')][_0x2fef('0x69')],'raw':!![]})[_0x2fef('0x20')](function(_0xe4e447){return _0xe4e447;});})[_0x2fef('0x20')](function(_0x27f4e6){if(_0x27f4e6){_0x2638a3[_0x2fef('0x29')][_0x2fef('0x6a')]=_0x27f4e6[0x0];if(!_0x2a1990[_0x2fef('0x56')][_0x2fef('0x5f')])return;return db[_0x2fef('0x6b')][_0x2fef('0x54')]({'where':{'id':_0x2a1990['body'][_0x2fef('0x5f')],'role':'agent'},'attributes':['id',_0x2fef('0x38'),_0x2fef('0x6c'),_0x2fef('0x6d'),'internal'],'raw':!![]});}return null;})[_0x2fef('0x20')](function(_0x18b891){if(!_0x18b891)return null;_0x2638a3[_0x2fef('0x29')][_0x2fef('0x61')]=_0x18b891;return _0x2638a3;})[_0x2fef('0x20')](function(_0x488f84){if(_0x488f84){if(_0x2a1990[_0x2fef('0x56')]['manual']){_0x2638a3['message'][_0x2fef('0x6e')]=util[_0x2fef('0x5e')]('SIP/%s',_0x2a1990[_0x2fef('0x60')][_0x2fef('0x38')]);_0x2638a3['message'][_0x2fef('0x6f')]=_0x2638a3[_0x2fef('0x6f')];_0x2638a3['message']['motionChannel']=_0x2638a3['channel'];_0x2638a3[_0x2fef('0x29')][_0x2fef('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x2fef('0x71'),{'event':'acceptmessage','message':_0x2638a3[_0x2fef('0x29')]},client9002)['then'](function(){return _0x2638a3;});}return _0x2638a3;}return null;})[_0x2fef('0x20')](respondWithResult(_0x4609b0,null))['catch'](handleError(_0x4609b0,null));};var interaction_log=require(_0x2fef('0x15'))(_0x2fef('0x5a'));exports[_0x2fef('0x33')]=function(_0x43648b,_0x642894,_0x5015db){var _0x2f3d54={'agent':{},'channel':_0x2fef('0x72')};if(_0x43648b[_0x2fef('0x56')]['id']){delete _0x43648b[_0x2fef('0x56')]['id'];}_0x43648b[_0x2fef('0x56')][_0x2fef('0x5f')]=_0x43648b[_0x2fef('0x56')][_0x2fef('0x5f')]||_0x43648b[_0x2fef('0x60')]['id'];_0x2f3d54[_0x2fef('0x61')]['id']=_0x43648b[_0x2fef('0x56')][_0x2fef('0x5f')];return db[_0x2fef('0x3a')][_0x2fef('0x54')]({'where':{'id':_0x43648b[_0x2fef('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x642894,null))[_0x2fef('0x20')](function(_0x434c6d){if(_0x434c6d){_0x2f3d54[_0x2fef('0x29')]=_0x434c6d[_0x2fef('0x62')]({'plain':!![]});return db[_0x2fef('0x63')][_0x2fef('0x54')]({'where':{'id':_0x434c6d[_0x2fef('0x73')]}});}return null;})[_0x2fef('0x20')](handleEntityNotFound(_0x642894,null))[_0x2fef('0x20')](function(_0x4477ef){if(_0x4477ef){_0x2f3d54[_0x2fef('0x64')]=_0x4477ef[_0x2fef('0x62')]({'plain':!![]});interaction_log[_0x2fef('0x21')](_0x2fef('0x74'),_0x43648b[_0x2fef('0x60')]['id'],_0x43648b[_0x2fef('0x60')]['name'],_0x43648b[_0x2fef('0x60')]['role'],_0x2f3d54[_0x2fef('0x64')]['id'],_0x43648b['body']?JSON['stringify'](_0x43648b[_0x2fef('0x56')]):_0x2fef('0x75'));return respondWithRpcPromise(_0x2fef('0x76'),'rejectMessage',_0x2f3d54);}return null;})[_0x2fef('0x20')](function(_0x45f14e){var _0x3d8f18=_0x2fef('0x77')+_0x45f14e[_0x2fef('0x29')][_0x2fef('0x78')];return db[_0x2fef('0x79')]['query'](_0x3d8f18,{'type':db[_0x2fef('0x67')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2fef('0x20')](function(_0x56075e){return _0x56075e;});})[_0x2fef('0x20')](function(_0x294b4c){if(_0x294b4c){_0x2f3d54[_0x2fef('0x29')][_0x2fef('0x6a')]=_0x294b4c[0x0];if(!_0x43648b[_0x2fef('0x56')][_0x2fef('0x5f')])return;return db['User'][_0x2fef('0x54')]({'where':{'id':_0x43648b[_0x2fef('0x56')]['UserId'],'role':_0x2fef('0x61')},'attributes':['id',_0x2fef('0x38'),_0x2fef('0x6c'),_0x2fef('0x6d'),_0x2fef('0x7a')],'raw':!![]});}return null;})[_0x2fef('0x20')](function(_0x56b7e8){if(!_0x56b7e8)return null;_0x2f3d54[_0x2fef('0x29')]['agent']=_0x56b7e8;return _0x2f3d54;})[_0x2fef('0x20')](function(_0x19928f){if(_0x19928f){_0x19928f['message']['interface']=util['format'](_0x2fef('0x7b'),_0x43648b[_0x2fef('0x60')][_0x2fef('0x38')]);_0x19928f[_0x2fef('0x29')][_0x2fef('0x6f')]=_0x2f3d54[_0x2fef('0x6f')];_0x19928f[_0x2fef('0x29')][_0x2fef('0x7c')]=_0x2f3d54[_0x2fef('0x6f')];_0x19928f[_0x2fef('0x29')]['event']=_0x2fef('0x33');respondWithRpcPromise('EventManager',_0x2fef('0x71'),{'event':_0x2fef('0x7d'),'message':_0x19928f[_0x2fef('0x29')]},client9002);return _0x2f3d54;}return null;})[_0x2fef('0x20')](respondWithResult(_0x642894,null))[_0x2fef('0x52')](handleError(_0x642894,null));}; \ No newline at end of file +var _0xa60b=['../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','find','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x17461e,_0x46ba13){var _0x32eb55=function(_0x2f6645){while(--_0x2f6645){_0x17461e['push'](_0x17461e['shift']());}};_0x32eb55(++_0x46ba13);}(_0xa60b,0x171));var _0xba60=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa60b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xba60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba60('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba60('0x2'));var moment=require(_0xba60('0x3'));var BPromise=require(_0xba60('0x4'));var Mustache=require(_0xba60('0x5'));var util=require(_0xba60('0x6'));var path=require('path');var sox=require(_0xba60('0x7'));var csv=require(_0xba60('0x8'));var ejs=require(_0xba60('0x9'));var fs=require('fs');var fs_extra=require(_0xba60('0xa'));var _=require(_0xba60('0xb'));var squel=require(_0xba60('0xc'));var crypto=require('crypto');var jsforce=require(_0xba60('0xd'));var deskjs=require(_0xba60('0xe'));var toCsv=require('to-csv');var querystring=require(_0xba60('0xf'));var Papa=require('papaparse');var Redis=require(_0xba60('0x10'));var authService=require(_0xba60('0x11'));var qs=require(_0xba60('0x12'));var as=require(_0xba60('0x13'));var hardwareService=require(_0xba60('0x14'));var logger=require(_0xba60('0x15'))(_0xba60('0x16'));var utils=require(_0xba60('0x17'));var config=require(_0xba60('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xba60('0x19')],{'host':_0xba60('0x1a'),'port':0x18eb});var socket=require(_0xba60('0x1b'))(new Redis(config['redis']));require(_0xba60('0x1c'))[_0xba60('0x1d')](socket);var jayson=require(_0xba60('0x1e'));var client=jayson[_0xba60('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xba60('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4de020,_0x22b580,_0x32d7e1,_0x49f54d){return new BPromise(function(_0x132f9a,_0x571313){var _0x1df6c2=_0x49f54d||client;return _0x1df6c2['request'](_0x4de020,_0x32d7e1)['then'](function(_0x2c08f5){logger[_0xba60('0x20')](_0xba60('0x21'),_0x22b580,_0xba60('0x22'));logger[_0xba60('0x23')](_0xba60('0x24'),_0x22b580,_0xba60('0x22'),JSON[_0xba60('0x25')](_0x2c08f5));if(_0x2c08f5[_0xba60('0x26')]){if(_0x2c08f5[_0xba60('0x26')][_0xba60('0x27')]===0x1f4){logger[_0xba60('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x22b580,_0x2c08f5[_0xba60('0x26')][_0xba60('0x28')]);return _0x571313(_0x2c08f5[_0xba60('0x26')][_0xba60('0x28')]);}logger[_0xba60('0x26')](_0xba60('0x21'),_0x22b580,_0x2c08f5['error'][_0xba60('0x28')]);return _0x132f9a(_0x2c08f5[_0xba60('0x26')][_0xba60('0x28')]);}else{logger['info'](_0xba60('0x21'),_0x22b580,_0xba60('0x22'));_0x132f9a(_0x2c08f5[_0xba60('0x29')][_0xba60('0x28')]);}})['catch'](function(_0x344388){logger[_0xba60('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x22b580,_0x344388);_0x571313(_0x344388);});});}function respondWithStatusCode(_0x36740f,_0x1edc76){_0x1edc76=_0x1edc76||0xcc;return function(_0x51abcb){if(_0x51abcb){return _0x36740f[_0xba60('0x2a')](_0x1edc76);}return _0x36740f[_0xba60('0x2b')](_0x1edc76)[_0xba60('0x2c')]();};}function respondWithResult(_0x1c80c4,_0x118b70){_0x118b70=_0x118b70||0xc8;return function(_0xb86268){if(_0xb86268){return _0x1c80c4[_0xba60('0x2b')](_0x118b70)[_0xba60('0x2d')](_0xb86268);}};}function respondWithFilteredResult(_0x3abab9,_0x576424){return function(_0x33afd1){if(_0x33afd1){var _0x10968b=typeof _0x576424[_0xba60('0x2e')]===_0xba60('0x2f')&&typeof _0x576424[_0xba60('0x30')]===_0xba60('0x2f');var _0x4c8906=_0x33afd1[_0xba60('0x31')];var _0x1b2ff2=_0x10968b?0x0:_0x576424[_0xba60('0x2e')];var _0xda4c01=_0x10968b?_0x33afd1[_0xba60('0x31')]:_0x576424[_0xba60('0x2e')]+_0x576424[_0xba60('0x30')];var _0xb3e42a;if(_0xda4c01>=_0x4c8906){_0xda4c01=_0x4c8906;_0xb3e42a=0xc8;}else{_0xb3e42a=0xce;}_0x3abab9[_0xba60('0x2b')](_0xb3e42a);return _0x3abab9[_0xba60('0x32')]('Content-Range',_0x1b2ff2+'-'+_0xda4c01+'/'+_0x4c8906)[_0xba60('0x2d')](_0x33afd1);}return null;};}function patchUpdates(_0x275450){return function(_0x274b95){try{jsonpatch['apply'](_0x274b95,_0x275450,!![]);}catch(_0x1bd664){return BPromise[_0xba60('0x33')](_0x1bd664);}return _0x274b95[_0xba60('0x34')]();};}function saveUpdates(_0x13c4a4,_0x40c3cf){return function(_0x208209){if(_0x208209){return _0x208209[_0xba60('0x35')](_0x13c4a4)[_0xba60('0x36')](function(_0x2d9699){return _0x2d9699;});}return null;};}function removeEntity(_0x29436f,_0x596b49){return function(_0xbaed0){if(_0xbaed0){return _0xbaed0[_0xba60('0x37')]()[_0xba60('0x36')](function(){_0x29436f[_0xba60('0x2b')](0xcc)[_0xba60('0x2c')]();});}};}function handleEntityNotFound(_0x5401cb,_0x3434ac){return function(_0x400c9e){if(!_0x400c9e){_0x5401cb[_0xba60('0x2a')](0x194);}return _0x400c9e;};}function handleError(_0x2a2aa4,_0x4127e2){_0x4127e2=_0x4127e2||0x1f4;return function(_0x70362b){logger['error'](_0x70362b['stack']);if(_0x70362b[_0xba60('0x38')]){delete _0x70362b[_0xba60('0x38')];}_0x2a2aa4[_0xba60('0x2b')](_0x4127e2)[_0xba60('0x39')](_0x70362b);};}exports[_0xba60('0x3a')]=function(_0x427043,_0x203aa8){var _0x414a8d={},_0x564b35={},_0x214a98={'count':0x0,'rows':[]};var _0xbd2b37=_[_0xba60('0x3b')](db[_0xba60('0x3c')][_0xba60('0x3d')],function(_0xe62076){return{'name':_0xe62076[_0xba60('0x3e')],'type':_0xe62076[_0xba60('0x3f')][_0xba60('0x40')]};});_0x564b35['model']=_[_0xba60('0x3b')](_0xbd2b37,_0xba60('0x38'));_0x564b35[_0xba60('0x41')]=_[_0xba60('0x42')](_0x427043[_0xba60('0x41')]);_0x564b35['filters']=_['intersection'](_0x564b35['model'],_0x564b35[_0xba60('0x41')]);_0x414a8d['attributes']=_[_0xba60('0x43')](_0x564b35[_0xba60('0x44')],qs[_0xba60('0x45')](_0x427043['query'][_0xba60('0x45')]));_0x414a8d[_0xba60('0x46')]=_0x414a8d[_0xba60('0x46')][_0xba60('0x47')]?_0x414a8d['attributes']:_0x564b35[_0xba60('0x44')];if(!_0x427043[_0xba60('0x41')][_0xba60('0x48')]('nolimit')){_0x414a8d['limit']=qs['limit'](_0x427043[_0xba60('0x41')]['limit']);_0x414a8d['offset']=qs['offset'](_0x427043[_0xba60('0x41')][_0xba60('0x2e')]);}_0x414a8d[_0xba60('0x49')]=qs[_0xba60('0x4a')](_0x427043[_0xba60('0x41')][_0xba60('0x4a')]);_0x414a8d[_0xba60('0x4b')]=qs[_0xba60('0x4c')](_[_0xba60('0x4d')](_0x427043['query'],_0x564b35[_0xba60('0x4c')]),_0xbd2b37);if(_0x427043['query']['filter']){_0x414a8d[_0xba60('0x4b')]=_[_0xba60('0x4e')](_0x414a8d[_0xba60('0x4b')],{'$or':_[_0xba60('0x3b')](_0xbd2b37,function(_0x29da0e){if(_0x29da0e[_0xba60('0x3f')]!==_0xba60('0x4f')){var _0x49caf8={};_0x49caf8[_0x29da0e[_0xba60('0x38')]]={'$like':'%'+_0x427043[_0xba60('0x41')]['filter']+'%'};return _0x49caf8;}})});}_0x414a8d=_[_0xba60('0x4e')]({},_0x414a8d,_0x427043[_0xba60('0x50')]);var _0x210bce={'where':_0x414a8d[_0xba60('0x4b')]};return db[_0xba60('0x3c')][_0xba60('0x31')](_0x210bce)[_0xba60('0x36')](function(_0x27bfd3){_0x214a98[_0xba60('0x31')]=_0x27bfd3;if(_0x427043[_0xba60('0x41')]['includeAll']){_0x414a8d[_0xba60('0x51')]=[{'all':!![]}];}return db[_0xba60('0x3c')]['findAll'](_0x414a8d);})['then'](function(_0x3d6cbd){_0x214a98[_0xba60('0x52')]=_0x3d6cbd;return _0x214a98;})[_0xba60('0x36')](respondWithFilteredResult(_0x203aa8,_0x414a8d))[_0xba60('0x53')](handleError(_0x203aa8,null));};exports[_0xba60('0x54')]=function(_0x139b6f,_0x5d9ceb){var _0x45f6aa={'raw':!![],'where':{'id':_0x139b6f[_0xba60('0x55')]['id']}},_0x125c9f={};_0x125c9f['model']=_['keys'](db[_0xba60('0x3c')][_0xba60('0x3d')]);_0x125c9f[_0xba60('0x41')]=_['keys'](_0x139b6f[_0xba60('0x41')]);_0x125c9f['filters']=_[_0xba60('0x43')](_0x125c9f['model'],_0x125c9f[_0xba60('0x41')]);_0x45f6aa[_0xba60('0x46')]=_[_0xba60('0x43')](_0x125c9f[_0xba60('0x44')],qs['fields'](_0x139b6f[_0xba60('0x41')][_0xba60('0x45')]));_0x45f6aa[_0xba60('0x46')]=_0x45f6aa['attributes'][_0xba60('0x47')]?_0x45f6aa[_0xba60('0x46')]:_0x125c9f['model'];if(_0x139b6f[_0xba60('0x41')][_0xba60('0x56')]){_0x45f6aa['include']=[{'all':!![]}];}_0x45f6aa=_['merge']({},_0x45f6aa,_0x139b6f[_0xba60('0x50')]);return db[_0xba60('0x3c')]['find'](_0x45f6aa)[_0xba60('0x36')](handleEntityNotFound(_0x5d9ceb,null))[_0xba60('0x36')](respondWithResult(_0x5d9ceb,null))['catch'](handleError(_0x5d9ceb,null));};exports['create']=function(_0x26bde7,_0x4ff7d2){return db['OpenchannelMessage'][_0xba60('0x57')](_0x26bde7['body'],{})[_0xba60('0x36')](respondWithResult(_0x4ff7d2,0xc9))[_0xba60('0x53')](handleError(_0x4ff7d2,null));};exports[_0xba60('0x35')]=function(_0x539f61,_0x45c5f3){if(_0x539f61['body']['id']){delete _0x539f61['body']['id'];}return db[_0xba60('0x3c')][_0xba60('0x58')]({'where':{'id':_0x539f61[_0xba60('0x55')]['id']}})[_0xba60('0x36')](handleEntityNotFound(_0x45c5f3,null))['then'](saveUpdates(_0x539f61[_0xba60('0x59')],null))[_0xba60('0x36')](respondWithResult(_0x45c5f3,null))[_0xba60('0x53')](handleError(_0x45c5f3,null));};exports[_0xba60('0x37')]=function(_0x542950,_0x526685){return db[_0xba60('0x3c')][_0xba60('0x58')]({'where':{'id':_0x542950[_0xba60('0x55')]['id']}})['then'](handleEntityNotFound(_0x526685,null))[_0xba60('0x36')](removeEntity(_0x526685,null))['catch'](handleError(_0x526685,null));};exports[_0xba60('0x5a')]=function(_0x295d0f,_0xcc555e){return db[_0xba60('0x3c')][_0xba60('0x5a')]()[_0xba60('0x36')](respondWithResult(_0xcc555e,null))[_0xba60('0x53')](handleError(_0xcc555e,null));};var interaction_log=require(_0xba60('0x15'))(_0xba60('0x5b'));exports['accept']=function(_0x49339f,_0xa0172a,_0x1e2ba9){var _0x3ce48d={'agent':{},'channel':_0xba60('0x5c')};if(_0x49339f[_0xba60('0x59')]['id']){delete _0x49339f[_0xba60('0x59')]['id'];}_0x49339f[_0xba60('0x59')][_0xba60('0x5d')]=!![];_0x49339f[_0xba60('0x59')][_0xba60('0x5e')]=moment()[_0xba60('0x5f')](_0xba60('0x60'));_0x49339f['body'][_0xba60('0x61')]=_0x49339f[_0xba60('0x59')]['UserId']||_0x49339f[_0xba60('0x62')]['id'];_0x3ce48d[_0xba60('0x63')]['id']=_0x49339f[_0xba60('0x59')]['UserId'];return db[_0xba60('0x3c')][_0xba60('0x58')]({'where':{'id':_0x49339f['params']['id'],'UserId':null}})[_0xba60('0x36')](handleEntityNotFound(_0xa0172a,null))['then'](saveUpdates(_0x49339f[_0xba60('0x59')],null))[_0xba60('0x36')](function(_0x458e37){if(_0x458e37){_0x3ce48d[_0xba60('0x28')]=_0x458e37['get']({'plain':!![]});return db[_0xba60('0x64')][_0xba60('0x58')]({'where':{'id':_0x458e37['OpenchannelInteractionId']}});}return null;})[_0xba60('0x36')](handleEntityNotFound(_0xa0172a,null))[_0xba60('0x36')](function(_0x46f416){if(_0x46f416){return _0x46f416[_0xba60('0x35')]({'UserId':_0x49339f[_0xba60('0x59')][_0xba60('0x61')],'read1stAt':_['isNil'](_0x46f416[_0xba60('0x65')])?moment()[_0xba60('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3ee57d){if(_0x3ee57d){_0x3ce48d['interaction']=_0x3ee57d[_0xba60('0x66')]({'plain':!![]});interaction_log[_0xba60('0x20')](_0xba60('0x67'),_0x49339f[_0xba60('0x62')]['id'],_0x49339f[_0xba60('0x62')][_0xba60('0x38')],_0x49339f[_0xba60('0x62')]['role'],_0x3ce48d[_0xba60('0x68')]['id'],_0x49339f[_0xba60('0x59')]?JSON[_0xba60('0x25')](_0x49339f[_0xba60('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xba60('0x69'),_0x3ce48d);}return null;})[_0xba60('0x36')](function(_0x236f16){var _0x2ef03e=_0xba60('0x6a')+_0x236f16[_0xba60('0x28')][_0xba60('0x6b')];return db[_0xba60('0x6c')][_0xba60('0x41')](_0x2ef03e,{'type':db[_0xba60('0x6d')][_0xba60('0x6e')][_0xba60('0x6f')],'raw':!![]})[_0xba60('0x36')](function(_0x2576ec){return _0x2576ec;});})[_0xba60('0x36')](function(_0x28e4c5){if(_0x28e4c5){_0x3ce48d[_0xba60('0x28')][_0xba60('0x70')]=_0x28e4c5[0x0];if(!_0x49339f['body'][_0xba60('0x61')])return;return db[_0xba60('0x71')]['find']({'where':{'id':_0x49339f[_0xba60('0x59')][_0xba60('0x61')],'role':'agent'},'attributes':['id',_0xba60('0x38'),'fullname',_0xba60('0x72'),_0xba60('0x73')],'raw':!![]});}return null;})['then'](function(_0x90654e){if(!_0x90654e)return null;_0x3ce48d['message'][_0xba60('0x63')]=_0x90654e;return _0x3ce48d;})[_0xba60('0x36')](function(_0xeaa769){if(_0xeaa769){if(_0x49339f[_0xba60('0x59')][_0xba60('0x74')]){_0x3ce48d[_0xba60('0x28')][_0xba60('0x75')]=util[_0xba60('0x5f')](_0xba60('0x76'),_0x49339f['user'][_0xba60('0x38')]);_0x3ce48d[_0xba60('0x28')][_0xba60('0x77')]=_0x3ce48d[_0xba60('0x77')];_0x3ce48d['message'][_0xba60('0x78')]=_0x3ce48d[_0xba60('0x77')];_0x3ce48d[_0xba60('0x28')][_0xba60('0x79')]=_0xba60('0x7a');return respondWithRpcPromise(_0xba60('0x7b'),_0xba60('0x7b'),{'event':_0xba60('0x7c'),'message':_0x3ce48d[_0xba60('0x28')]},client9002)[_0xba60('0x36')](function(){return _0x3ce48d;});}return _0x3ce48d;}return null;})[_0xba60('0x36')](respondWithResult(_0xa0172a,null))[_0xba60('0x53')](handleError(_0xa0172a,null));};var interaction_log=require(_0xba60('0x15'))(_0xba60('0x5b'));exports['reject']=function(_0x49ce6c,_0x4e1871,_0x447362){var _0x176584={'agent':{},'channel':_0xba60('0x5c')};if(_0x49ce6c[_0xba60('0x59')]['id']){delete _0x49ce6c[_0xba60('0x59')]['id'];}_0x49ce6c['body']['UserId']=_0x49ce6c[_0xba60('0x59')][_0xba60('0x61')]||_0x49ce6c['user']['id'];_0x176584[_0xba60('0x63')]['id']=_0x49ce6c['body'][_0xba60('0x61')];return db[_0xba60('0x3c')][_0xba60('0x58')]({'where':{'id':_0x49ce6c[_0xba60('0x55')]['id'],'UserId':null}})[_0xba60('0x36')](handleEntityNotFound(_0x4e1871,null))[_0xba60('0x36')](function(_0x231b8d){if(_0x231b8d){_0x176584[_0xba60('0x28')]=_0x231b8d[_0xba60('0x66')]({'plain':!![]});return db[_0xba60('0x64')]['find']({'where':{'id':_0x231b8d[_0xba60('0x7d')]}});}return null;})[_0xba60('0x36')](handleEntityNotFound(_0x4e1871,null))[_0xba60('0x36')](function(_0x188447){if(_0x188447){_0x176584[_0xba60('0x68')]=_0x188447[_0xba60('0x66')]({'plain':!![]});interaction_log[_0xba60('0x20')](_0xba60('0x7e'),_0x49ce6c[_0xba60('0x62')]['id'],_0x49ce6c[_0xba60('0x62')][_0xba60('0x38')],_0x49ce6c[_0xba60('0x62')][_0xba60('0x7f')],_0x176584[_0xba60('0x68')]['id'],_0x49ce6c['body']?JSON['stringify'](_0x49ce6c[_0xba60('0x59')]):_0xba60('0x80'));return respondWithRpcPromise('RejectMessage',_0xba60('0x81'),_0x176584);}return null;})[_0xba60('0x36')](function(_0x5d65ee){var _0x4ad032=_0xba60('0x6a')+_0x5d65ee['message'][_0xba60('0x6b')];return db['sequelize'][_0xba60('0x41')](_0x4ad032,{'type':db['Sequelize'][_0xba60('0x6e')][_0xba60('0x6f')],'raw':!![]})['then'](function(_0x13cd2e){return _0x13cd2e;});})[_0xba60('0x36')](function(_0x5246f7){if(_0x5246f7){_0x176584[_0xba60('0x28')]['contact']=_0x5246f7[0x0];if(!_0x49ce6c[_0xba60('0x59')][_0xba60('0x61')])return;return db[_0xba60('0x71')]['find']({'where':{'id':_0x49ce6c[_0xba60('0x59')][_0xba60('0x61')],'role':_0xba60('0x63')},'attributes':['id',_0xba60('0x38'),'fullname',_0xba60('0x72'),_0xba60('0x73')],'raw':!![]});}return null;})['then'](function(_0x3df3fb){if(!_0x3df3fb)return null;_0x176584[_0xba60('0x28')][_0xba60('0x63')]=_0x3df3fb;return _0x176584;})[_0xba60('0x36')](function(_0x54f22e){if(_0x54f22e){_0x54f22e[_0xba60('0x28')]['interface']=util['format'](_0xba60('0x76'),_0x49ce6c['user'][_0xba60('0x38')]);_0x54f22e[_0xba60('0x28')][_0xba60('0x77')]=_0x176584[_0xba60('0x77')];_0x54f22e[_0xba60('0x28')][_0xba60('0x78')]=_0x176584[_0xba60('0x77')];_0x54f22e[_0xba60('0x28')][_0xba60('0x79')]=_0xba60('0x33');respondWithRpcPromise(_0xba60('0x7b'),_0xba60('0x7b'),{'event':'rejectmessage','message':_0x54f22e[_0xba60('0x28')]},client9002);return _0x176584;}return null;})['then'](respondWithResult(_0x4e1871,null))[_0xba60('0x53')](handleError(_0x4e1871,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5d4aca5..46a7c04 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 _0x7441=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x20f63f,_0x41f75c){var _0x4f1963=function(_0x2329ac){while(--_0x2329ac){_0x20f63f['push'](_0x20f63f['shift']());}};_0x4f1963(++_0x41f75c);}(_0x7441,0xa4));var _0x1744=function(_0x56e7d6,_0x2971f4){_0x56e7d6=_0x56e7d6-0x0;var _0x3ebdcc=_0x7441[_0x56e7d6];return _0x3ebdcc;};'use strict';var EventEmitter=require(_0x1744('0x0'));var OpenchannelMessage=require(_0x1744('0x1'))['db'][_0x1744('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1744('0x3')](0x0);var events={'afterCreate':_0x1744('0x4'),'afterUpdate':_0x1744('0x5'),'afterDestroy':_0x1744('0x6')};function emitEvent(_0x3ef758){return function(_0xb755dc,_0x3e732b,_0x252cda){OpenchannelMessageEvents[_0x1744('0x7')](_0x3ef758+':'+_0xb755dc['id'],_0xb755dc);OpenchannelMessageEvents[_0x1744('0x7')](_0x3ef758,_0xb755dc);_0x252cda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x1744('0x8')](e,emitEvent(event));}}module[_0x1744('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3f4e=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x45872f,_0x589377){var _0x39650f=function(_0x71409f){while(--_0x71409f){_0x45872f['push'](_0x45872f['shift']());}};_0x39650f(++_0x589377);}(_0x3f4e,0x196));var _0xe3f4=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3f4e[_0x2112d4];return _0x434972;};'use strict';var EventEmitter=require(_0xe3f4('0x0'));var OpenchannelMessage=require(_0xe3f4('0x1'))['db'][_0xe3f4('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe3f4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe3f4('0x4')};function emitEvent(_0x202335){return function(_0x25f91a,_0xd0924a,_0x5724b5){OpenchannelMessageEvents[_0xe3f4('0x5')](_0x202335+':'+_0x25f91a['id'],_0x25f91a);OpenchannelMessageEvents[_0xe3f4('0x5')](_0x202335,_0x25f91a);_0x5724b5(null);};}for(var e in events){if(events[_0xe3f4('0x6')](e)){var event=events[e];OpenchannelMessage[_0xe3f4('0x7')](e,emitEvent(event));}}module[_0xe3f4('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index ab26447..def55c3 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 _0xfd3e=['toLowerCase','out','isNil','UserId','OpenchannelInteraction','then','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xfd3e,0xb1));var _0xefd3=function(_0x3131b1,_0x19e1fe){_0x3131b1=_0x3131b1-0x0;var _0x19e5d4=_0xfd3e[_0x3131b1];return _0x19e5d4;};'use strict';var _=require(_0xefd3('0x0'));var util=require(_0xefd3('0x1'));var logger=require('../../config/logger')(_0xefd3('0x2'));var moment=require(_0xefd3('0x3'));var BPromise=require(_0xefd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefd3('0x5'));var rimraf=require(_0xefd3('0x6'));var config=require(_0xefd3('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x15b78b,_0x15931c){return _0x15b78b['define'](_0xefd3('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xefd3('0x9'),'fields':[_0xefd3('0xa')],'type':_0xefd3('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x428a58,_0x562180,_0x5212d5){var _0x4c712d=_0x15b78b[_0xefd3('0xc')];var _0x2a7ebe=_0x428a58[_0xefd3('0xd')]({'plain':!![]});if(_0x2a7ebe[_0xefd3('0xe')][_0xefd3('0xf')]()==='in'||_0x2a7ebe[_0xefd3('0xe')]['toLowerCase']()===_0xefd3('0x10')&&!_0x2a7ebe['secret']&&!_[_0xefd3('0x11')](_0x2a7ebe[_0xefd3('0x12')])){_0x4c712d[_0xefd3('0x13')]['findOne']({'where':{'id':_0x2a7ebe['OpenchannelInteractionId']}})[_0xefd3('0x14')](function(_0x11d4f7){if(_0x11d4f7){_0x11d4f7['update']({'lastMsgAt':_0x2a7ebe[_0xefd3('0x15')],'lastMsgDirection':_0x2a7ebe[_0xefd3('0xe')][_0xefd3('0xf')]()});}})[_0xefd3('0x16')](function(_0x26819e){console[_0xefd3('0x17')](_0x26819e);});}if(_0x2a7ebe[_0xefd3('0xe')]===_0xefd3('0x10')&&!_0x2a7ebe[_0xefd3('0x18')]){var _0x536700;_0x4c712d[_0xefd3('0x19')][_0xefd3('0x1a')]()[_0xefd3('0x14')](function(_0x316c41){return _0x4c712d[_0xefd3('0x1b')][_0xefd3('0x1c')]({'where':{'id':_0x2a7ebe[_0xefd3('0x1d')]},'include':[{'model':_0x4c712d[_0xefd3('0x13')],'as':_0xefd3('0x1e'),'where':{'id':_0x2a7ebe[_0xefd3('0x1f')]},'limit':0x1,'include':[{'model':_0x4c712d['CmContact'],'as':_0xefd3('0x20'),'attributes':_['keys'](_0x316c41)}]}]});})[_0xefd3('0x14')](function(_0x13c88c){_0x536700=_0x13c88c[_0xefd3('0xd')]({'plain':!![]});if(_0x536700&&_0x536700[_0xefd3('0x21')]){logger[_0xefd3('0x22')](_0xefd3('0x23'),_0xefd3('0x24'),util['format'](_0xefd3('0x25'),_0x2a7ebe['id'],_0x536700['replyUri']));if(_0x536700[_0xefd3('0x1e')]&&_0x536700['Interactions'][_0xefd3('0x26')]){_0x2a7ebe[_0xefd3('0x27')]=_[_0xefd3('0x28')](_0x536700[_0xefd3('0x1e')][0x0],'Contact');_0x2a7ebe[_0xefd3('0x20')]=_0x536700[_0xefd3('0x1e')][0x0]['Contact'];}var _0x562180={'method':_0xefd3('0x29'),'uri':encodeURI(_0x536700[_0xefd3('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x562180[_0xefd3('0x2a')]){case'GET':_0x562180['qs']=_0x2a7ebe;break;case _0xefd3('0x29'):_0x562180[_0xefd3('0xa')]=_0x2a7ebe;break;}return rp(_0x562180)[_0xefd3('0x14')](function(_0x12dc50){logger[_0xefd3('0x22')](_0xefd3('0x23'),_0xefd3('0x24'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x2a7ebe['id'],_0x536700[_0xefd3('0x21')]));if(_0x12dc50['body'][_0xefd3('0x2b')]&&_0x12dc50[_0xefd3('0xa')][_0xefd3('0x2b')]!=_0x2a7ebe[_0xefd3('0x27')][_0xefd3('0x2b')]){return _0x4c712d[_0xefd3('0x13')][_0xefd3('0x2c')]({'threadId':_0x12dc50['body']['threadId']},{'where':{'id':_0x2a7ebe[_0xefd3('0x27')]['id']}});}else{return;}})[_0xefd3('0x14')](function(){return _0x428a58[_0xefd3('0x2c')]({'read':!![]});})[_0xefd3('0x16')](function(_0x94f65f){logger[_0xefd3('0x17')](_0xefd3('0x23'),_0xefd3('0x24'),util[_0xefd3('0x2d')](_0x94f65f,{'showHidden':![],'depth':null}));_0x5212d5();});}else{_0x5212d5();}})['finally'](function(){_0x5212d5();});}else{_0x5212d5();}}},'charset':_0xefd3('0x2e'),'collate':_0xefd3('0x2f')});}; \ No newline at end of file +var _0xded9=['FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','error','secret','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','replyUri','Interactions','length','Interaction','omit','POST','method','GET','body','threadId','update','catch','inspect','finally','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x41b9b1,_0x2189f6){var _0x6e0254=function(_0xba790e){while(--_0xba790e){_0x41b9b1['push'](_0x41b9b1['shift']());}};_0x6e0254(++_0x2189f6);}(_0xded9,0xff));var _0x9ded=function(_0x1cc27e,_0x366571){_0x1cc27e=_0x1cc27e-0x0;var _0x3a91fd=_0xded9[_0x1cc27e];return _0x3a91fd;};'use strict';var _=require(_0x9ded('0x0'));var util=require(_0x9ded('0x1'));var logger=require(_0x9ded('0x2'))(_0x9ded('0x3'));var moment=require('moment');var BPromise=require(_0x9ded('0x4'));var rp=require(_0x9ded('0x5'));var fs=require('fs');var path=require(_0x9ded('0x6'));var rimraf=require(_0x9ded('0x7'));var config=require(_0x9ded('0x8'));var attributes=require(_0x9ded('0x9'));module[_0x9ded('0xa')]=function(_0x4d8d23,_0x5c1cf4){return _0x4d8d23[_0x9ded('0xb')](_0x9ded('0xc'),attributes,{'tableName':_0x9ded('0xd'),'paranoid':![],'indexes':[{'name':_0x9ded('0xe'),'fields':['body'],'type':_0x9ded('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c2114,_0x11266a,_0x503187){var _0x555fb2=_0x4d8d23[_0x9ded('0x10')];var _0x4d3959=_0x5c2114[_0x9ded('0x11')]({'plain':!![]});if(_0x4d3959['direction']['toLowerCase']()==='in'||_0x4d3959[_0x9ded('0x12')][_0x9ded('0x13')]()==='out'&&!_0x4d3959['secret']&&!_[_0x9ded('0x14')](_0x4d3959[_0x9ded('0x15')])){_0x555fb2['OpenchannelInteraction'][_0x9ded('0x16')]({'where':{'id':_0x4d3959[_0x9ded('0x17')]}})['then'](function(_0xfb3e5d){if(_0xfb3e5d){_0xfb3e5d['update']({'lastMsgAt':_0x4d3959[_0x9ded('0x18')],'lastMsgDirection':_0x4d3959[_0x9ded('0x12')]['toLowerCase']()});}})['catch'](function(_0x3c4ada){console[_0x9ded('0x19')](_0x3c4ada);});}if(_0x4d3959[_0x9ded('0x12')]==='out'&&!_0x4d3959[_0x9ded('0x1a')]){var _0x450318;_0x555fb2[_0x9ded('0x1b')][_0x9ded('0x1c')]()[_0x9ded('0x1d')](function(_0x4e3615){return _0x555fb2[_0x9ded('0x1e')][_0x9ded('0x1f')]({'where':{'id':_0x4d3959[_0x9ded('0x20')]},'include':[{'model':_0x555fb2[_0x9ded('0x21')],'as':'Interactions','where':{'id':_0x4d3959[_0x9ded('0x17')]},'limit':0x1,'include':[{'model':_0x555fb2['CmContact'],'as':_0x9ded('0x22'),'attributes':_[_0x9ded('0x23')](_0x4e3615)}]}]});})['then'](function(_0x4bee17){_0x450318=_0x4bee17['get']({'plain':!![]});if(_0x450318&&_0x450318['replyUri']){logger[_0x9ded('0x24')](_0x9ded('0x25'),_0x9ded('0x26'),util[_0x9ded('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x4d3959['id'],_0x450318[_0x9ded('0x28')]));if(_0x450318[_0x9ded('0x29')]&&_0x450318[_0x9ded('0x29')][_0x9ded('0x2a')]){_0x4d3959[_0x9ded('0x2b')]=_[_0x9ded('0x2c')](_0x450318['Interactions'][0x0],'Contact');_0x4d3959[_0x9ded('0x22')]=_0x450318[_0x9ded('0x29')][0x0][_0x9ded('0x22')];}var _0x11266a={'method':_0x9ded('0x2d'),'uri':encodeURI(_0x450318['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x11266a[_0x9ded('0x2e')]){case _0x9ded('0x2f'):_0x11266a['qs']=_0x4d3959;break;case _0x9ded('0x2d'):_0x11266a[_0x9ded('0x30')]=_0x4d3959;break;}return rp(_0x11266a)[_0x9ded('0x1d')](function(_0x46565e){logger[_0x9ded('0x24')](_0x9ded('0x25'),_0x9ded('0x26'),util[_0x9ded('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4d3959['id'],_0x450318[_0x9ded('0x28')]));if(_0x46565e[_0x9ded('0x30')][_0x9ded('0x31')]&&_0x46565e[_0x9ded('0x30')][_0x9ded('0x31')]!=_0x4d3959[_0x9ded('0x2b')][_0x9ded('0x31')]){return _0x555fb2[_0x9ded('0x21')][_0x9ded('0x32')]({'threadId':_0x46565e[_0x9ded('0x30')][_0x9ded('0x31')]},{'where':{'id':_0x4d3959[_0x9ded('0x2b')]['id']}});}else{return;}})[_0x9ded('0x1d')](function(){return _0x5c2114[_0x9ded('0x32')]({'read':!![]});})[_0x9ded('0x33')](function(_0x6ec1a1){logger[_0x9ded('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x9ded('0x26'),util[_0x9ded('0x34')](_0x6ec1a1,{'showHidden':![],'depth':null}));_0x503187();});}else{_0x503187();}})[_0x9ded('0x35')](function(){_0x503187();});}else{_0x503187();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 905fa51..6bed223 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2dae5a,_0x178986){var _0x59c5a6=function(_0x2c6393){while(--_0x2c6393){_0x2dae5a['push'](_0x2dae5a['shift']());}};_0x59c5a6(++_0x178986);}(_0x7a54,0x106));var _0x47a5=function(_0x471be5,_0x485102){_0x471be5=_0x471be5-0x0;var _0xc4ad0=_0x7a54[_0x471be5];return _0xc4ad0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x82afde,_0x24c68b){var _0xa47fe7=function(_0x586f5d){while(--_0x586f5d){_0x82afde['push'](_0x82afde['shift']());}};_0xa47fe7(++_0x24c68b);}(_0xadb5,0xad));var _0x5adb=function(_0x34f791,_0x390246){_0x34f791=_0x34f791-0x0;var _0x238441=_0xadb5[_0x34f791];return _0x238441;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 72e7fcf..fb0c93e 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 _0xca66=['remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x125eb3,_0x4171a9){var _0x1b19c5=function(_0x26260c){while(--_0x26260c){_0x125eb3['push'](_0x125eb3['shift']());}};_0x1b19c5(++_0x4171a9);}(_0xca66,0x141));var _0x6ca6=function(_0x3d16ea,_0x13bc1f){_0x3d16ea=_0x3d16ea-0x0;var _0x4f712e=_0xca66[_0x3d16ea];return _0x4f712e;};'use strict';var OpenchannelMessageEvents=require(_0x6ca6('0x0'));var events=['save',_0x6ca6('0x1'),_0x6ca6('0x2')];function createListener(_0xb4318f,_0x5611a2){return function(_0x1a8a0b){_0x5611a2[_0x6ca6('0x3')](_0xb4318f,_0x1a8a0b);};}function removeListener(_0x2e8071,_0x141d6f){return function(){OpenchannelMessageEvents[_0x6ca6('0x4')](_0x2e8071,_0x141d6f);};}exports['register']=function(_0x16591a){for(var _0x1f872c=0x0,_0x1e8e30=events[_0x6ca6('0x5')];_0x1f872c<_0x1e8e30;_0x1f872c++){var _0x981bb7=events[_0x1f872c];var _0x435572=createListener(_0x6ca6('0x6')+_0x981bb7,_0x16591a);OpenchannelMessageEvents['on'](_0x981bb7,_0x435572);}}; \ No newline at end of file +var _0xb079=['save','remove','emit','removeListener','register','openchannelMessage:','./openchannelMessage.events'];(function(_0x405936,_0x2b8651){var _0x1b823d=function(_0x4e04cf){while(--_0x4e04cf){_0x405936['push'](_0x405936['shift']());}};_0x1b823d(++_0x2b8651);}(_0xb079,0x133));var _0x9b07=function(_0x184955,_0x4f6236){_0x184955=_0x184955-0x0;var _0x244562=_0xb079[_0x184955];return _0x244562;};'use strict';var OpenchannelMessageEvents=require(_0x9b07('0x0'));var events=[_0x9b07('0x1'),_0x9b07('0x2'),'update'];function createListener(_0x1c80f5,_0x732ff8){return function(_0x197870){_0x732ff8[_0x9b07('0x3')](_0x1c80f5,_0x197870);};}function removeListener(_0x5a5dda,_0x22dab1){return function(){OpenchannelMessageEvents[_0x9b07('0x4')](_0x5a5dda,_0x22dab1);};}exports[_0x9b07('0x5')]=function(_0x5866d3){for(var _0x333cb0=0x0,_0x59237b=events['length'];_0x333cb0<_0x59237b;_0x333cb0++){var _0x5621ea=events[_0x333cb0];var _0x239384=createListener(_0x9b07('0x6')+_0x5621ea,_0x5866d3);OpenchannelMessageEvents['on'](_0x5621ea,_0x239384);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d56b57b..fefcf5f 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 _0x799d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','post','create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express'];(function(_0x31f7b0,_0x348609){var _0x4ca05c=function(_0x5228df){while(--_0x5228df){_0x31f7b0['push'](_0x31f7b0['shift']());}};_0x4ca05c(++_0x348609);}(_0x799d,0x114));var _0xd799=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x799d[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xd799('0x0'));var util=require(_0xd799('0x1'));var path=require('path');var timeout=require(_0xd799('0x2'));var express=require(_0xd799('0x3'));var router=express[_0xd799('0x4')]();var fs_extra=require(_0xd799('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd799('0x6'));var config=require(_0xd799('0x7'));var controller=require(_0xd799('0x8'));router[_0xd799('0x9')]('/',auth[_0xd799('0xa')](),controller[_0xd799('0xb')]);router[_0xd799('0x9')](_0xd799('0xc'),auth[_0xd799('0xa')](),controller[_0xd799('0xd')]);router['get'](_0xd799('0xe'),auth[_0xd799('0xa')](),controller[_0xd799('0xf')]);router[_0xd799('0x9')]('/:id/members',auth[_0xd799('0xa')](),controller['getMembers']);router[_0xd799('0x9')](_0xd799('0x10'),auth['isAuthenticated'](),controller[_0xd799('0x11')]);router[_0xd799('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xd799('0x12')]('/',auth[_0xd799('0xa')](),controller[_0xd799('0x13')]);router[_0xd799('0x12')](_0xd799('0x10'),auth[_0xd799('0xa')](),controller[_0xd799('0x14')]);router[_0xd799('0x12')](_0xd799('0x15'),auth[_0xd799('0xa')](),controller['addAgents']);router[_0xd799('0x16')](_0xd799('0xe'),auth[_0xd799('0xa')](),controller[_0xd799('0x17')]);router[_0xd799('0x18')]('/:id',auth[_0xd799('0xa')](),controller[_0xd799('0x19')]);router[_0xd799('0x18')](_0xd799('0x10'),auth[_0xd799('0xa')](),controller[_0xd799('0x1a')]);router['delete'](_0xd799('0x15'),auth[_0xd799('0xa')](),controller['removeAgents']);module[_0xd799('0x1b')]=router; \ No newline at end of file +var _0xa2e5=['getAgents','post','create','addTeams','put','update','destroy','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x20c3cf,_0x2270af){var _0xfdcbe4=function(_0x18f50e){while(--_0x18f50e){_0x20c3cf['push'](_0x20c3cf['shift']());}};_0xfdcbe4(++_0x2270af);}(_0xa2e5,0x1d4));var _0x5a2e=function(_0x18b24e,_0xb9dc2e){_0x18b24e=_0x18b24e-0x0;var _0x2715a8=_0xa2e5[_0x18b24e];return _0x2715a8;};'use strict';var multer=require(_0x5a2e('0x0'));var util=require(_0x5a2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a2e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5a2e('0x3'));var interaction=require(_0x5a2e('0x4'));var config=require(_0x5a2e('0x5'));var controller=require(_0x5a2e('0x6'));router[_0x5a2e('0x7')]('/',auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x9')]);router['get'](_0x5a2e('0xa'),auth['isAuthenticated'](),controller[_0x5a2e('0xb')]);router['get'](_0x5a2e('0xc'),auth[_0x5a2e('0x8')](),controller[_0x5a2e('0xd')]);router[_0x5a2e('0x7')]('/:id/members',auth[_0x5a2e('0x8')](),controller[_0x5a2e('0xe')]);router[_0x5a2e('0x7')](_0x5a2e('0xf'),auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x10')]);router[_0x5a2e('0x7')](_0x5a2e('0x11'),auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x12')]);router[_0x5a2e('0x13')]('/',auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x14')]);router[_0x5a2e('0x13')](_0x5a2e('0xf'),auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x15')]);router[_0x5a2e('0x13')](_0x5a2e('0x11'),auth[_0x5a2e('0x8')](),controller['addAgents']);router[_0x5a2e('0x16')]('/:id',auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x17')]);router['delete'](_0x5a2e('0xc'),auth[_0x5a2e('0x8')](),controller[_0x5a2e('0x18')]);router['delete'](_0x5a2e('0xf'),auth[_0x5a2e('0x8')](),controller['removeTeams']);router['delete'](_0x5a2e('0x11'),auth['isAuthenticated'](),controller[_0x5a2e('0x19')]);module[_0x5a2e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9b48ef9..0f331cc 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 _0xf158=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0xec02db,_0x3fa48e){var _0x21db30=function(_0xe193cd){while(--_0xe193cd){_0xec02db['push'](_0xec02db['shift']());}};_0x21db30(++_0x3fa48e);}(_0xf158,0x1cf));var _0x8f15=function(_0x471582,_0x23c445){_0x471582=_0x471582-0x0;var _0x474082=_0xf158[_0x471582];return _0x474082;};'use strict';var Sequelize=require(_0x8f15('0x0'));module[_0x8f15('0x1')]={'name':{'type':Sequelize[_0x8f15('0x2')],'unique':_0x8f15('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f15('0x2')]},'timeout':{'type':Sequelize[_0x8f15('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f15('0x5')](_0x8f15('0x6'),_0x8f15('0x7'),_0x8f15('0x8'))}}; \ No newline at end of file +var _0xa5c3=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xa5c3,0x1d7));var _0x3a5c=function(_0xbb613e,_0x39ac7c){_0xbb613e=_0xbb613e-0x0;var _0x248ef5=_0xa5c3[_0xbb613e];return _0x248ef5;};'use strict';var Sequelize=require(_0x3a5c('0x0'));module[_0x3a5c('0x1')]={'name':{'type':Sequelize[_0x3a5c('0x2')],'unique':_0x3a5c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3a5c('0x2')]},'timeout':{'type':Sequelize[_0x3a5c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3a5c('0x5')](_0x3a5c('0x6'),'beepall',_0x3a5c('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9293d78..f93391d 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 _0xf7c8=['ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','addAgents','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','status','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','include','findAll','rows','catch','show','params','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','where','pick','OpenchannelQueueId','filter','User','findAndCountAll','UserId','createdAt','%s/%s','openchannelPause','updatedAt','getTeams','Team','order','ids','online','voicePause','interface','flatMap','transaction','findOrCreate','removeTeams','Agents','select','tq.TeamId','from','user_has_teams','OpenchannelQueueId\x20=\x20?','clone'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0xf7c8,0x1f4));var _0x8f7c=function(_0xd4538e,_0x31153f){_0xd4538e=_0xd4538e-0x0;var _0xf8a2ca=_0xf7c8[_0xd4538e];return _0xf8a2ca;};'use strict';var BPromise=require('bluebird');var util=require(_0x8f7c('0x0'));var _=require('lodash');var squel=require(_0x8f7c('0x1'));var Redis=require(_0x8f7c('0x2'));var qs=require(_0x8f7c('0x3'));var logger=require(_0x8f7c('0x4'))(_0x8f7c('0x5'));var config=require(_0x8f7c('0x6'));var db=require(_0x8f7c('0x7'))['db'];config[_0x8f7c('0x8')]=_[_0x8f7c('0x9')](config[_0x8f7c('0x8')],{'host':_0x8f7c('0xa'),'port':0x18eb});var socket=require(_0x8f7c('0xb'))(new Redis(config[_0x8f7c('0x8')]));require(_0x8f7c('0xc'))[_0x8f7c('0xd')](socket);function respondWithStatusCode(_0x555c7c,_0x1cad25){_0x1cad25=_0x1cad25||0xcc;return function(_0x5a59b9){if(_0x5a59b9){return _0x555c7c[_0x8f7c('0xe')](_0x1cad25);}return _0x555c7c['status'](_0x1cad25)[_0x8f7c('0xf')]();};}function respondWithResult(_0x477848,_0xac69b0){_0xac69b0=_0xac69b0||0xc8;return function(_0x567724){if(_0x567724){return _0x477848['status'](_0xac69b0)['json'](_0x567724);}};}function respondWithFilteredResult(_0x996183,_0x5c3d02){return function(_0x362cce){if(_0x362cce){var _0x39cb73=typeof _0x5c3d02[_0x8f7c('0x10')]===_0x8f7c('0x11')&&typeof _0x5c3d02[_0x8f7c('0x12')]==='undefined';var _0x530b5b=_0x362cce[_0x8f7c('0x13')];var _0x41576f=_0x39cb73?0x0:_0x5c3d02[_0x8f7c('0x10')];var _0x5408e1=_0x39cb73?_0x362cce[_0x8f7c('0x13')]:_0x5c3d02[_0x8f7c('0x10')]+_0x5c3d02['limit'];var _0x19b887;if(_0x5408e1>=_0x530b5b){_0x5408e1=_0x530b5b;_0x19b887=0xc8;}else{_0x19b887=0xce;}_0x996183['status'](_0x19b887);return _0x996183[_0x8f7c('0x14')](_0x8f7c('0x15'),_0x41576f+'-'+_0x5408e1+'/'+_0x530b5b)['json'](_0x362cce);}return null;};}function saveUpdates(_0x34c368){return function(_0x418bc1){if(_0x418bc1){return _0x418bc1[_0x8f7c('0x16')](_0x34c368)[_0x8f7c('0x17')](function(_0x284e32){return _0x284e32;});}return null;};}function removeEntity(_0x463040){return function(_0x364afe){if(_0x364afe){return _0x364afe[_0x8f7c('0x18')]()[_0x8f7c('0x17')](function(){var _0x5a0ade=_0x364afe['get']({'plain':!![]});var _0x2ea60b=_0x8f7c('0x19');return db[_0x8f7c('0x1a')][_0x8f7c('0x18')]({'where':{'type':_0x2ea60b,'resourceId':_0x5a0ade['id']}})['then'](function(){return _0x364afe;});})[_0x8f7c('0x17')](function(){_0x463040[_0x8f7c('0x1b')](0xcc)[_0x8f7c('0xf')]();});}};}function handleEntityNotFound(_0x15530b){return function(_0x2ae638){if(!_0x2ae638){_0x15530b[_0x8f7c('0xe')](0x194);}return _0x2ae638;};}function handleError(_0x5de816,_0x55866d){_0x55866d=_0x55866d||0x1f4;return function(_0x5783db){logger[_0x8f7c('0x1c')](_0x5783db[_0x8f7c('0x1d')]);if(_0x5783db[_0x8f7c('0x1e')]){delete _0x5783db[_0x8f7c('0x1e')];}_0x5de816[_0x8f7c('0x1b')](_0x55866d)[_0x8f7c('0x1f')](_0x5783db);};}exports[_0x8f7c('0x20')]=function(_0x276496,_0x5ce1f9){var _0x37a6b6={};var _0x37e9b5={'count':0x0,'rows':[]};var _0xb1cbd4=_[_0x8f7c('0x21')](db[_0x8f7c('0x22')][_0x8f7c('0x23')],function(_0x5bc82f){return{'name':_0x5bc82f[_0x8f7c('0x24')],'type':_0x5bc82f[_0x8f7c('0x25')]['key']};});_0x37a6b6=qs[_0x8f7c('0x26')](_0xb1cbd4,_0x276496);var _0x3d857a={'where':_0x37a6b6['where']};return db[_0x8f7c('0x22')][_0x8f7c('0x13')](_0x3d857a)[_0x8f7c('0x17')](function(_0x1490a3){_0x37e9b5[_0x8f7c('0x13')]=_0x1490a3;_0x37a6b6[_0x8f7c('0x27')]=qs[_0x8f7c('0x27')](_0x276496['query']);return db['OpenchannelQueue'][_0x8f7c('0x28')](_0x37a6b6);})[_0x8f7c('0x17')](function(_0x3f894e){_0x37e9b5[_0x8f7c('0x29')]=_0x3f894e;return _0x37e9b5;})['then'](respondWithFilteredResult(_0x5ce1f9,_0x37a6b6))[_0x8f7c('0x2a')](handleError(_0x5ce1f9,null));};exports[_0x8f7c('0x2b')]=function(_0x42cbf4,_0xfa76a2){var _0x15c633={'raw':!![],'where':{'id':_0x42cbf4[_0x8f7c('0x2c')]['id']}},_0x3f2a8d={};_0x3f2a8d['model']=_['keys'](db[_0x8f7c('0x22')]['rawAttributes']);_0x3f2a8d[_0x8f7c('0x2d')]=_[_0x8f7c('0x2e')](_0x42cbf4[_0x8f7c('0x2d')]);_0x3f2a8d[_0x8f7c('0x2f')]=_[_0x8f7c('0x30')](_0x3f2a8d[_0x8f7c('0x31')],_0x3f2a8d[_0x8f7c('0x2d')]);_0x15c633[_0x8f7c('0x32')]=_[_0x8f7c('0x30')](_0x3f2a8d[_0x8f7c('0x31')],qs[_0x8f7c('0x33')](_0x42cbf4['query']['fields']));_0x15c633[_0x8f7c('0x32')]=_0x15c633[_0x8f7c('0x32')][_0x8f7c('0x34')]?_0x15c633[_0x8f7c('0x32')]:_0x3f2a8d[_0x8f7c('0x31')];if(_0x42cbf4[_0x8f7c('0x2d')][_0x8f7c('0x35')]){_0x15c633[_0x8f7c('0x27')]=[{'all':!![]}];}_0x15c633=_[_0x8f7c('0x36')]({},_0x15c633,_0x42cbf4[_0x8f7c('0x37')]);return db[_0x8f7c('0x22')][_0x8f7c('0x38')](_0x15c633)[_0x8f7c('0x17')](handleEntityNotFound(_0xfa76a2,null))[_0x8f7c('0x17')](respondWithResult(_0xfa76a2,null))[_0x8f7c('0x2a')](handleError(_0xfa76a2,null));};exports[_0x8f7c('0x39')]=function(_0x2db1d4,_0xe1273e){return db[_0x8f7c('0x22')][_0x8f7c('0x39')](_0x2db1d4[_0x8f7c('0x3a')],{})[_0x8f7c('0x17')](function(_0x252fca){var _0x7b4f8f=_0x2db1d4['user'][_0x8f7c('0x3b')]({'plain':!![]});if(!_0x7b4f8f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7b4f8f[_0x8f7c('0x3c')]===_0x8f7c('0x3d')){var _0x382cc9=_0x252fca['get']({'plain':!![]});var _0x37f1de=_0x8f7c('0x19');return db[_0x8f7c('0x3e')][_0x8f7c('0x38')]({'where':{'name':_0x37f1de,'userProfileId':_0x7b4f8f['userProfileId']},'raw':!![]})[_0x8f7c('0x17')](function(_0x4b9646){if(_0x4b9646&&_0x4b9646[_0x8f7c('0x3f')]===0x0){return db[_0x8f7c('0x1a')][_0x8f7c('0x39')]({'name':_0x382cc9[_0x8f7c('0x1e')],'resourceId':_0x382cc9['id'],'type':_0x4b9646['name'],'sectionId':_0x4b9646['id']},{})[_0x8f7c('0x17')](function(){return _0x252fca;});}else{return _0x252fca;}})['catch'](function(_0x4cae40){logger['error'](_0x8f7c('0x40'),_0x4cae40);throw _0x4cae40;});}return _0x252fca;})[_0x8f7c('0x17')](respondWithResult(_0xe1273e,0xc9))[_0x8f7c('0x2a')](handleError(_0xe1273e,null));};exports[_0x8f7c('0x16')]=function(_0x133f7e,_0x532fca){if(_0x133f7e[_0x8f7c('0x3a')]['id']){delete _0x133f7e['body']['id'];}return db[_0x8f7c('0x22')][_0x8f7c('0x38')]({'where':{'id':_0x133f7e[_0x8f7c('0x2c')]['id']}})[_0x8f7c('0x17')](handleEntityNotFound(_0x532fca,null))[_0x8f7c('0x17')](saveUpdates(_0x133f7e['body'],null))[_0x8f7c('0x17')](respondWithResult(_0x532fca,null))['catch'](handleError(_0x532fca,null));};exports[_0x8f7c('0x18')]=function(_0x442411,_0x26f219){return db[_0x8f7c('0x22')][_0x8f7c('0x38')]({'where':{'id':_0x442411[_0x8f7c('0x2c')]['id']}})[_0x8f7c('0x17')](handleEntityNotFound(_0x26f219,null))[_0x8f7c('0x17')](removeEntity(_0x26f219,null))['catch'](handleError(_0x26f219,null));};exports[_0x8f7c('0x41')]=function(_0x5882d1,_0x1d1b10){return db[_0x8f7c('0x22')][_0x8f7c('0x41')]()[_0x8f7c('0x17')](respondWithResult(_0x1d1b10,null))[_0x8f7c('0x2a')](handleError(_0x1d1b10,null));};exports['getMembers']=function(_0x384e30,_0x20945c){var _0xc21e03={'raw':!![],'where':{}},_0xeabe15={},_0xdea006;return db[_0x8f7c('0x22')][_0x8f7c('0x42')]({'where':{'id':_0x384e30[_0x8f7c('0x2c')]['id']}})[_0x8f7c('0x17')](handleEntityNotFound(_0x20945c,null))[_0x8f7c('0x17')](function(_0x4eb7ac){if(_0x4eb7ac){_0xdea006=_0x4eb7ac[_0x8f7c('0x3b')]({'plain':!![]});_0xeabe15[_0x8f7c('0x31')]=_[_0x8f7c('0x2e')](db[_0x8f7c('0x43')][_0x8f7c('0x23')]);_0xeabe15[_0x8f7c('0x2d')]=_['keys'](_0x384e30[_0x8f7c('0x2d')]);_0xeabe15['filters']=_['intersection'](_0xeabe15['model'],_0xeabe15[_0x8f7c('0x2d')]);_0xc21e03[_0x8f7c('0x32')]=_[_0x8f7c('0x30')](_0xeabe15[_0x8f7c('0x31')],qs[_0x8f7c('0x33')](_0x384e30['query'][_0x8f7c('0x33')]));_0xc21e03[_0x8f7c('0x32')]=_0xc21e03[_0x8f7c('0x32')][_0x8f7c('0x34')]?_0xc21e03['attributes']:_0xeabe15[_0x8f7c('0x31')];if(!_0x384e30['query'][_0x8f7c('0x44')](_0x8f7c('0x45'))){_0xc21e03[_0x8f7c('0x12')]=qs[_0x8f7c('0x12')](_0x384e30['query']['limit']);_0xc21e03['offset']=qs['offset'](_0x384e30['query'][_0x8f7c('0x10')]);}_0xc21e03['order']=qs[_0x8f7c('0x46')](_0x384e30['query'][_0x8f7c('0x46')]);_0xc21e03[_0x8f7c('0x47')]=qs[_0x8f7c('0x2f')](_[_0x8f7c('0x48')](_0x384e30[_0x8f7c('0x2d')],_0xeabe15[_0x8f7c('0x2f')]));_0xc21e03[_0x8f7c('0x47')][_0x8f7c('0x49')]=_0x4eb7ac['id'];if(_0x384e30[_0x8f7c('0x2d')][_0x8f7c('0x4a')]){_0xc21e03['where']=_[_0x8f7c('0x36')](_0xc21e03['where'],{'$or':_[_0x8f7c('0x21')](_0xc21e03[_0x8f7c('0x32')],function(_0x39ebd8){var _0x5ab36c={};_0x5ab36c[_0x39ebd8]={'$like':'%'+_0x384e30[_0x8f7c('0x2d')][_0x8f7c('0x4a')]+'%'};return _0x5ab36c;})});}_0xc21e03=_['merge']({},_0xc21e03,_0x384e30[_0x8f7c('0x37')]);return db[_0x8f7c('0x43')]['findAll'](_0xc21e03);}})[_0x8f7c('0x17')](function(_0x10bad2){if(_0x10bad2){return db[_0x8f7c('0x4b')][_0x8f7c('0x4c')]({'where':{'id':_[_0x8f7c('0x21')](_0x10bad2,_0x8f7c('0x4d')),'role':'agent'},'attributes':['id',_0x8f7c('0x1e'),'openchannelPause','updatedAt',_0x8f7c('0x4e')]});}})[_0x8f7c('0x17')](function(_0x595e5b){if(_0x595e5b){return{'count':_0x595e5b[_0x8f7c('0x13')],'rows':_['map'](_0x595e5b[_0x8f7c('0x29')],function(_0xeac6c3){return{'membername':_0xeac6c3[_0x8f7c('0x1e')],'UserId':_0xeac6c3['id'],'queue_name':_0xdea006['name'],'OpenchannelQueueId':_0xdea006['id'],'interface':util['format'](_0x8f7c('0x4f'),'SIP',_0xeac6c3[_0x8f7c('0x1e')]),'penalty':0x0,'paused':_0xeac6c3[_0x8f7c('0x50')],'createdAt':_0xeac6c3[_0x8f7c('0x4e')],'updatedAt':_0xeac6c3[_0x8f7c('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8f7c('0x17')](respondWithFilteredResult(_0x20945c,_0xc21e03))[_0x8f7c('0x2a')](handleError(_0x20945c,null));};exports[_0x8f7c('0x52')]=function(_0x519dfe,_0x4fb141){var _0x2aae86={};var _0x5ce0d7={};var _0x468333;var _0x4766b0;return db['OpenchannelQueue'][_0x8f7c('0x42')]({'where':{'id':_0x519dfe[_0x8f7c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4fb141,null))[_0x8f7c('0x17')](function(_0x1ee7e5){if(_0x1ee7e5){_0x468333=_0x1ee7e5;_0x5ce0d7[_0x8f7c('0x31')]=_[_0x8f7c('0x2e')](db[_0x8f7c('0x53')][_0x8f7c('0x23')]);_0x5ce0d7['query']=_['keys'](_0x519dfe[_0x8f7c('0x2d')]);_0x5ce0d7[_0x8f7c('0x2f')]=_[_0x8f7c('0x30')](_0x5ce0d7['model'],_0x5ce0d7[_0x8f7c('0x2d')]);_0x2aae86['attributes']=_['intersection'](_0x5ce0d7[_0x8f7c('0x31')],qs[_0x8f7c('0x33')](_0x519dfe[_0x8f7c('0x2d')][_0x8f7c('0x33')]));_0x2aae86[_0x8f7c('0x32')]=_0x2aae86['attributes']['length']?_0x2aae86[_0x8f7c('0x32')]:_0x5ce0d7[_0x8f7c('0x31')];_0x2aae86[_0x8f7c('0x54')]=qs[_0x8f7c('0x46')](_0x519dfe[_0x8f7c('0x2d')]['sort']);_0x2aae86[_0x8f7c('0x47')]=qs[_0x8f7c('0x2f')](_[_0x8f7c('0x48')](_0x519dfe[_0x8f7c('0x2d')],_0x5ce0d7['filters']));if(_0x519dfe['query'][_0x8f7c('0x4a')]){_0x2aae86['where']=_[_0x8f7c('0x36')](_0x2aae86['where'],{'$or':_[_0x8f7c('0x21')](_0x2aae86[_0x8f7c('0x32')],function(_0x1c3fec){var _0x507296={};_0x507296[_0x1c3fec]={'$like':'%'+_0x519dfe[_0x8f7c('0x2d')][_0x8f7c('0x4a')]+'%'};return _0x507296;})});}_0x2aae86=_[_0x8f7c('0x36')]({},_0x2aae86,_0x519dfe[_0x8f7c('0x37')]);return _0x468333[_0x8f7c('0x52')](_0x2aae86);}})[_0x8f7c('0x17')](function(_0x3d3200){if(_0x3d3200){_0x4766b0=_0x3d3200[_0x8f7c('0x34')];if(!_0x519dfe[_0x8f7c('0x2d')][_0x8f7c('0x44')](_0x8f7c('0x45'))){_0x2aae86[_0x8f7c('0x12')]=qs[_0x8f7c('0x12')](_0x519dfe[_0x8f7c('0x2d')][_0x8f7c('0x12')]);_0x2aae86[_0x8f7c('0x10')]=qs[_0x8f7c('0x10')](_0x519dfe[_0x8f7c('0x2d')]['offset']);}return _0x468333[_0x8f7c('0x52')](_0x2aae86);}})[_0x8f7c('0x17')](function(_0x4ff6bb){if(_0x4ff6bb){return _0x4ff6bb?{'count':_0x4766b0,'rows':_0x4ff6bb}:null;}})[_0x8f7c('0x17')](respondWithResult(_0x4fb141,null))['catch'](handleError(_0x4fb141,null));};exports['addTeams']=function(_0xf6682e,_0x148bbb){var _0x347902=_0xf6682e[_0x8f7c('0x3a')][_0x8f7c('0x55')];return db[_0x8f7c('0x53')]['findAll']({'where':{'id':_0x347902},'attributes':['id'],'include':[{'model':db[_0x8f7c('0x4b')],'as':'Agents','attributes':['id','name',_0x8f7c('0x56'),_0x8f7c('0x57'),_0x8f7c('0x58')],'raw':!![]}]})['then'](function(_0x5847af){if(_0x5847af){var _0xa33596=_[_0x8f7c('0x59')](_0x5847af,function(_0x333119){var _0x3ff511=_0x333119[_0x8f7c('0x3b')]({'plain':!![]});return _0x3ff511['Agents'];});return db[_0x8f7c('0x22')]['find']({'where':{'id':_0xf6682e[_0x8f7c('0x2c')]['id']}})[_0x8f7c('0x17')](function(_0x1837e0){return db['sequelize'][_0x8f7c('0x5a')](function(_0x16dd7f){return _0x1837e0['addTeams'](_0x347902,{'transaction':_0x16dd7f})['then'](function(){return BPromise['each'](_0xa33596,function(_0x2b7c19){return db['UserOpenchannelQueue'][_0x8f7c('0x5b')]({'where':{'UserId':_0x2b7c19['id'],'OpenchannelQueueId':_0xf6682e['params']['id']},'transaction':_0x16dd7f});});})[_0x8f7c('0x17')](function(){_0xa33596['forEach'](function(_0x59bdcf){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x59bdcf['id'],'OpenchannelQueueId':_0x1837e0['id']});});});});});}})[_0x8f7c('0x17')](respondWithStatusCode(_0x148bbb,null))[_0x8f7c('0x2a')](handleError(_0x148bbb,null));};exports[_0x8f7c('0x5c')]=function(_0x1c80a8,_0x1c7306){return db[_0x8f7c('0x53')]['findAll']({'where':{'id':_0x1c80a8[_0x8f7c('0x2d')][_0x8f7c('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8f7c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x8f7c('0x17')](handleEntityNotFound(_0x1c7306,null))[_0x8f7c('0x17')](function(_0x80372f){var _0x5e04c9=_[_0x8f7c('0x21')](_0x80372f,'id');var _0x2153c5=[];var _0x5edad2=[];var _0x23e6bf=squel[_0x8f7c('0x5e')]();_0x23e6bf['field'](_0x8f7c('0x5f'))[_0x8f7c('0x60')]('team_has_openchannel_queues','tq')['join'](_0x8f7c('0x61'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8f7c('0x62'),_0x1c80a8[_0x8f7c('0x2c')]['id']);for(var _0x4348ab=0x0;_0x4348ab<_0x80372f['length'];_0x4348ab+=0x1){let _0x4750c7=_0x80372f[_0x4348ab];for(var _0x319043=0x0;_0x319043<_0x4750c7[_0x8f7c('0x5d')][_0x8f7c('0x34')];_0x319043+=0x1){let _0x1ad50f=_0x4750c7['Agents'][_0x319043];var _0x3bf266=_0x23e6bf[_0x8f7c('0x63')]();_0x3bf266[_0x8f7c('0x47')](_0x8f7c('0x64'),_0x1ad50f['id']);_0x5edad2[_0x8f7c('0x65')](db[_0x8f7c('0x66')]['query'](_0x3bf266['toString'](),{'type':db['sequelize'][_0x8f7c('0x67')][_0x8f7c('0x68')]})[_0x8f7c('0x17')](function(_0x288bf2){if(_0x288bf2[_0x8f7c('0x34')]===0x1){return _0x1ad50f['id'];}else{var _0x54fb6a=_[_0x8f7c('0x69')](_[_0x8f7c('0x21')](_0x288bf2,_0x8f7c('0x6a')),function(_0x12d029){return _[_0x8f7c('0x6b')](_0x5e04c9,_0x12d029);});if(_0x54fb6a){return _0x1ad50f['id'];}}}));}}return BPromise[_0x8f7c('0x6c')](_0x5edad2)[_0x8f7c('0x17')](function(_0x3bfda8){_0x2153c5=_(_0x2153c5)[_0x8f7c('0x6d')](_0x3bfda8)['compact']()[_0x8f7c('0x6e')]();return db[_0x8f7c('0x22')][_0x8f7c('0x38')]({'where':{'id':_0x1c80a8['params']['id']}})['then'](function(_0x34e69c){return db['sequelize'][_0x8f7c('0x5a')](function(_0x52ac01){return _0x34e69c[_0x8f7c('0x5c')](_0x1c80a8['query'][_0x8f7c('0x55')],{'transaction':_0x52ac01})[_0x8f7c('0x17')](function(){if(!_[_0x8f7c('0x6f')](_0x2153c5)){return _0x34e69c[_0x8f7c('0x70')](_0x2153c5,{'transaction':_0x52ac01});}})[_0x8f7c('0x17')](function(){_0x2153c5['forEach'](function(_0x38db98){socket[_0x8f7c('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x38db98,'OpenchannelQueueId':_0x34e69c['id']});});});});});});})[_0x8f7c('0x17')](respondWithStatusCode(_0x1c7306,null))[_0x8f7c('0x2a')](handleError(_0x1c7306,null));};exports[_0x8f7c('0x72')]=function(_0x272c08,_0x4f2f08){return db[_0x8f7c('0x22')][_0x8f7c('0x38')]({'where':{'id':_0x272c08[_0x8f7c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4f2f08,null))[_0x8f7c('0x17')](function(_0x5b2098){if(_0x5b2098){return _0x5b2098[_0x8f7c('0x72')](_0x272c08[_0x8f7c('0x3a')]['ids'],_['omit'](_0x272c08[_0x8f7c('0x3a')],[_0x8f7c('0x55'),'id'])||{})[_0x8f7c('0x73')](function(_0x5a51c1){for(var _0x26576c=0x0;_0x26576c<_0x272c08[_0x8f7c('0x3a')][_0x8f7c('0x55')][_0x8f7c('0x34')];_0x26576c+=0x1){socket['emit'](_0x8f7c('0x74'),{'UserId':Number(_0x272c08[_0x8f7c('0x3a')]['ids'][_0x26576c]),'OpenchannelQueueId':Number(_0x272c08[_0x8f7c('0x2c')]['id'])});}return _0x5a51c1;});}})['then'](respondWithResult(_0x4f2f08,null))[_0x8f7c('0x2a')](handleError(_0x4f2f08,null));};exports[_0x8f7c('0x70')]=function(_0xdc0ef4,_0x2d56bb){return db[_0x8f7c('0x22')][_0x8f7c('0x38')]({'where':{'id':_0xdc0ef4[_0x8f7c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2d56bb,null))[_0x8f7c('0x17')](function(_0x563d97){if(_0x563d97){return _0x563d97[_0x8f7c('0x70')](_0xdc0ef4['query'][_0x8f7c('0x55')])[_0x8f7c('0x17')](function(){if(_[_0x8f7c('0x75')](_0xdc0ef4[_0x8f7c('0x2d')]['ids'])){for(var _0x4934b4=0x0;_0x4934b4<_0xdc0ef4['query'][_0x8f7c('0x55')]['length'];_0x4934b4+=0x1){socket[_0x8f7c('0x71')](_0x8f7c('0x76'),{'UserId':Number(_0xdc0ef4[_0x8f7c('0x2d')][_0x8f7c('0x55')][_0x4934b4]),'OpenchannelQueueId':Number(_0xdc0ef4[_0x8f7c('0x2c')]['id'])});}}else{socket['emit'](_0x8f7c('0x76'),{'UserId':Number(_0xdc0ef4[_0x8f7c('0x2d')]['ids']),'OpenchannelQueueId':Number(_0xdc0ef4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2d56bb,null))['catch'](handleError(_0x2d56bb,null));};exports[_0x8f7c('0x77')]=function(_0x2574f8,_0x272a18){var _0x40990d={};var _0x108052={};var _0x2b1200;var _0x1b3f30;return db['OpenchannelQueue'][_0x8f7c('0x42')]({'where':{'id':_0x2574f8['params']['id']}})[_0x8f7c('0x17')](handleEntityNotFound(_0x272a18,null))[_0x8f7c('0x17')](function(_0x4afb30){if(_0x4afb30){_0x2b1200=_0x4afb30;_0x108052[_0x8f7c('0x31')]=_[_0x8f7c('0x2e')](db['User']['rawAttributes']);_0x108052['query']=_['keys'](_0x2574f8[_0x8f7c('0x2d')]);_0x108052[_0x8f7c('0x2f')]=_[_0x8f7c('0x30')](_0x108052[_0x8f7c('0x31')],_0x108052[_0x8f7c('0x2d')]);_0x40990d[_0x8f7c('0x32')]=_['intersection'](_0x108052['model'],qs['fields'](_0x2574f8[_0x8f7c('0x2d')][_0x8f7c('0x33')]));_0x40990d[_0x8f7c('0x32')]=_0x40990d[_0x8f7c('0x32')][_0x8f7c('0x34')]?_0x40990d['attributes']:_0x108052[_0x8f7c('0x31')];_0x40990d[_0x8f7c('0x54')]=qs['sort'](_0x2574f8[_0x8f7c('0x2d')][_0x8f7c('0x46')]);_0x40990d['where']=qs[_0x8f7c('0x2f')](_['pick'](_0x2574f8[_0x8f7c('0x2d')],_0x108052[_0x8f7c('0x2f')]));if(_0x2574f8[_0x8f7c('0x2d')][_0x8f7c('0x4a')]){_0x40990d['where']=_[_0x8f7c('0x36')](_0x40990d[_0x8f7c('0x47')],{'$or':_['map'](_0x40990d[_0x8f7c('0x32')],function(_0x7fc53c){var _0x189955={};_0x189955[_0x7fc53c]={'$like':'%'+_0x2574f8['query']['filter']+'%'};return _0x189955;})});}_0x40990d=_['merge']({},_0x40990d,_0x2574f8[_0x8f7c('0x37')]);return _0x2b1200[_0x8f7c('0x77')](_0x40990d);}})['then'](function(_0x36ed45){if(_0x36ed45){_0x1b3f30=_0x36ed45[_0x8f7c('0x34')];if(!_0x2574f8[_0x8f7c('0x2d')]['hasOwnProperty'](_0x8f7c('0x45'))){_0x40990d[_0x8f7c('0x12')]=qs[_0x8f7c('0x12')](_0x2574f8[_0x8f7c('0x2d')][_0x8f7c('0x12')]);_0x40990d[_0x8f7c('0x10')]=qs['offset'](_0x2574f8[_0x8f7c('0x2d')][_0x8f7c('0x10')]);}return _0x2b1200[_0x8f7c('0x77')](_0x40990d);}})['then'](function(_0x3d9e17){if(_0x3d9e17){return _0x3d9e17?{'count':_0x1b3f30,'rows':_0x3d9e17}:null;}})[_0x8f7c('0x17')](respondWithResult(_0x272a18,null))['catch'](handleError(_0x272a18,null));}; \ No newline at end of file +var _0xf456=['spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','get','OpenchannelQueues','then','error','name','send','index','map','OpenchannelQueue','rawAttributes','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','intersection','query','fields','attributes','length','includeAll','merge','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','filters','nolimit','order','sort','pick','OpenchannelQueueId','filter','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','User','voicePause','interface','Agents','sequelize','transaction','UserOpenchannelQueue','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit'];(function(_0x18a610,_0x5a0d62){var _0x1f3184=function(_0x9222b1){while(--_0x9222b1){_0x18a610['push'](_0x18a610['shift']());}};_0x1f3184(++_0x5a0d62);}(_0xf456,0x7b));var _0x6f45=function(_0xa04c88,_0x210509){_0xa04c88=_0xa04c88-0x0;var _0x2006b8=_0xf456[_0xa04c88];return _0x2006b8;};'use strict';var BPromise=require('bluebird');var util=require(_0x6f45('0x0'));var _=require(_0x6f45('0x1'));var squel=require(_0x6f45('0x2'));var Redis=require(_0x6f45('0x3'));var qs=require(_0x6f45('0x4'));var logger=require(_0x6f45('0x5'))(_0x6f45('0x6'));var config=require(_0x6f45('0x7'));var db=require(_0x6f45('0x8'))['db'];config[_0x6f45('0x9')]=_[_0x6f45('0xa')](config[_0x6f45('0x9')],{'host':_0x6f45('0xb'),'port':0x18eb});var socket=require(_0x6f45('0xc'))(new Redis(config[_0x6f45('0x9')]));require(_0x6f45('0xd'))[_0x6f45('0xe')](socket);function respondWithStatusCode(_0x40bfd8,_0x174797){_0x174797=_0x174797||0xcc;return function(_0x267372){if(_0x267372){return _0x40bfd8[_0x6f45('0xf')](_0x174797);}return _0x40bfd8[_0x6f45('0x10')](_0x174797)[_0x6f45('0x11')]();};}function respondWithResult(_0x3259dc,_0x47d0ff){_0x47d0ff=_0x47d0ff||0xc8;return function(_0x4cb0d1){if(_0x4cb0d1){return _0x3259dc[_0x6f45('0x10')](_0x47d0ff)[_0x6f45('0x12')](_0x4cb0d1);}};}function respondWithFilteredResult(_0x1db845,_0x3dd3d1){return function(_0x2ce97b){if(_0x2ce97b){var _0x5301dd=typeof _0x3dd3d1[_0x6f45('0x13')]===_0x6f45('0x14')&&typeof _0x3dd3d1[_0x6f45('0x15')]===_0x6f45('0x14');var _0x5e2ea5=_0x2ce97b[_0x6f45('0x16')];var _0x2f6ba1=_0x5301dd?0x0:_0x3dd3d1[_0x6f45('0x13')];var _0x41515f=_0x5301dd?_0x2ce97b[_0x6f45('0x16')]:_0x3dd3d1[_0x6f45('0x13')]+_0x3dd3d1[_0x6f45('0x15')];var _0x8142c2;if(_0x41515f>=_0x5e2ea5){_0x41515f=_0x5e2ea5;_0x8142c2=0xc8;}else{_0x8142c2=0xce;}_0x1db845[_0x6f45('0x10')](_0x8142c2);return _0x1db845['set'](_0x6f45('0x17'),_0x2f6ba1+'-'+_0x41515f+'/'+_0x5e2ea5)[_0x6f45('0x12')](_0x2ce97b);}return null;};}function saveUpdates(_0x330424){return function(_0x1ebf0f){if(_0x1ebf0f){return _0x1ebf0f[_0x6f45('0x18')](_0x330424)['then'](function(_0xfc9d6f){return _0xfc9d6f;});}return null;};}function removeEntity(_0xb919b7){return function(_0x35ba0f){if(_0x35ba0f){return _0x35ba0f[_0x6f45('0x19')]()['then'](function(){var _0x3e9a3c=_0x35ba0f[_0x6f45('0x1a')]({'plain':!![]});var _0x52eced=_0x6f45('0x1b');return db['UserProfileResource'][_0x6f45('0x19')]({'where':{'type':_0x52eced,'resourceId':_0x3e9a3c['id']}})[_0x6f45('0x1c')](function(){return _0x35ba0f;});})[_0x6f45('0x1c')](function(){_0xb919b7[_0x6f45('0x10')](0xcc)[_0x6f45('0x11')]();});}};}function handleEntityNotFound(_0x1ad528){return function(_0x51080d){if(!_0x51080d){_0x1ad528[_0x6f45('0xf')](0x194);}return _0x51080d;};}function handleError(_0x1d7365,_0x2f2dc0){_0x2f2dc0=_0x2f2dc0||0x1f4;return function(_0x182328){logger[_0x6f45('0x1d')](_0x182328['stack']);if(_0x182328[_0x6f45('0x1e')]){delete _0x182328[_0x6f45('0x1e')];}_0x1d7365[_0x6f45('0x10')](_0x2f2dc0)[_0x6f45('0x1f')](_0x182328);};}exports[_0x6f45('0x20')]=function(_0x5ed55d,_0x35d1a2){var _0x1e4186={};var _0x4f4a92={'count':0x0,'rows':[]};var _0x53f759=_[_0x6f45('0x21')](db[_0x6f45('0x22')][_0x6f45('0x23')],function(_0x33c14d){return{'name':_0x33c14d['fieldName'],'type':_0x33c14d['type'][_0x6f45('0x24')]};});_0x1e4186=qs[_0x6f45('0x25')](_0x53f759,_0x5ed55d);var _0x9de2e6={'where':_0x1e4186[_0x6f45('0x26')]};return db[_0x6f45('0x22')][_0x6f45('0x16')](_0x9de2e6)['then'](function(_0xeef820){_0x4f4a92['count']=_0xeef820;_0x1e4186[_0x6f45('0x27')]=qs[_0x6f45('0x27')](_0x5ed55d['query']);return db[_0x6f45('0x22')][_0x6f45('0x28')](_0x1e4186);})['then'](function(_0x3e6618){_0x4f4a92[_0x6f45('0x29')]=_0x3e6618;return _0x4f4a92;})['then'](respondWithFilteredResult(_0x35d1a2,_0x1e4186))[_0x6f45('0x2a')](handleError(_0x35d1a2,null));};exports[_0x6f45('0x2b')]=function(_0x78ed2e,_0x521a9f){var _0x4d3f88={'raw':!![],'where':{'id':_0x78ed2e[_0x6f45('0x2c')]['id']}},_0x21ddba={};_0x21ddba[_0x6f45('0x2d')]=_[_0x6f45('0x2e')](db[_0x6f45('0x22')][_0x6f45('0x23')]);_0x21ddba['query']=_['keys'](_0x78ed2e['query']);_0x21ddba['filters']=_[_0x6f45('0x2f')](_0x21ddba[_0x6f45('0x2d')],_0x21ddba[_0x6f45('0x30')]);_0x4d3f88['attributes']=_[_0x6f45('0x2f')](_0x21ddba[_0x6f45('0x2d')],qs[_0x6f45('0x31')](_0x78ed2e[_0x6f45('0x30')][_0x6f45('0x31')]));_0x4d3f88[_0x6f45('0x32')]=_0x4d3f88['attributes'][_0x6f45('0x33')]?_0x4d3f88[_0x6f45('0x32')]:_0x21ddba['model'];if(_0x78ed2e[_0x6f45('0x30')][_0x6f45('0x34')]){_0x4d3f88['include']=[{'all':!![]}];}_0x4d3f88=_[_0x6f45('0x35')]({},_0x4d3f88,_0x78ed2e[_0x6f45('0x36')]);return db[_0x6f45('0x22')][_0x6f45('0x37')](_0x4d3f88)[_0x6f45('0x1c')](handleEntityNotFound(_0x521a9f,null))[_0x6f45('0x1c')](respondWithResult(_0x521a9f,null))[_0x6f45('0x2a')](handleError(_0x521a9f,null));};exports['create']=function(_0x1edf3a,_0x5f2cf2){return db[_0x6f45('0x22')][_0x6f45('0x38')](_0x1edf3a[_0x6f45('0x39')],{})[_0x6f45('0x1c')](function(_0x404442){var _0x3f7598=_0x1edf3a[_0x6f45('0x3a')][_0x6f45('0x1a')]({'plain':!![]});if(!_0x3f7598)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f7598['role']==='user'){var _0x7802e0=_0x404442[_0x6f45('0x1a')]({'plain':!![]});var _0x541e6a=_0x6f45('0x1b');return db[_0x6f45('0x3b')]['find']({'where':{'name':_0x541e6a,'userProfileId':_0x3f7598[_0x6f45('0x3c')]},'raw':!![]})[_0x6f45('0x1c')](function(_0x21b429){if(_0x21b429&&_0x21b429[_0x6f45('0x3d')]===0x0){return db[_0x6f45('0x3e')][_0x6f45('0x38')]({'name':_0x7802e0[_0x6f45('0x1e')],'resourceId':_0x7802e0['id'],'type':_0x21b429[_0x6f45('0x1e')],'sectionId':_0x21b429['id']},{})[_0x6f45('0x1c')](function(){return _0x404442;});}else{return _0x404442;}})[_0x6f45('0x2a')](function(_0x2b0496){logger[_0x6f45('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b0496);throw _0x2b0496;});}return _0x404442;})[_0x6f45('0x1c')](respondWithResult(_0x5f2cf2,0xc9))[_0x6f45('0x2a')](handleError(_0x5f2cf2,null));};exports[_0x6f45('0x18')]=function(_0x4b070b,_0x13a699){if(_0x4b070b['body']['id']){delete _0x4b070b[_0x6f45('0x39')]['id'];}return db[_0x6f45('0x22')][_0x6f45('0x37')]({'where':{'id':_0x4b070b[_0x6f45('0x2c')]['id']}})[_0x6f45('0x1c')](handleEntityNotFound(_0x13a699,null))[_0x6f45('0x1c')](saveUpdates(_0x4b070b[_0x6f45('0x39')],null))[_0x6f45('0x1c')](respondWithResult(_0x13a699,null))['catch'](handleError(_0x13a699,null));};exports[_0x6f45('0x19')]=function(_0x39f9c1,_0x66a237){return db[_0x6f45('0x22')][_0x6f45('0x37')]({'where':{'id':_0x39f9c1[_0x6f45('0x2c')]['id']}})[_0x6f45('0x1c')](handleEntityNotFound(_0x66a237,null))[_0x6f45('0x1c')](removeEntity(_0x66a237,null))[_0x6f45('0x2a')](handleError(_0x66a237,null));};exports[_0x6f45('0x3f')]=function(_0x317464,_0x4e09d8){return db[_0x6f45('0x22')][_0x6f45('0x3f')]()[_0x6f45('0x1c')](respondWithResult(_0x4e09d8,null))[_0x6f45('0x2a')](handleError(_0x4e09d8,null));};exports[_0x6f45('0x40')]=function(_0x49782d,_0x1760ff){var _0x4908d0={'raw':!![],'where':{}},_0x49536a={},_0x136224;return db[_0x6f45('0x22')][_0x6f45('0x41')]({'where':{'id':_0x49782d[_0x6f45('0x2c')]['id']}})[_0x6f45('0x1c')](handleEntityNotFound(_0x1760ff,null))[_0x6f45('0x1c')](function(_0x5f32db){if(_0x5f32db){_0x136224=_0x5f32db['get']({'plain':!![]});_0x49536a['model']=_['keys'](db['UserOpenchannelQueue'][_0x6f45('0x23')]);_0x49536a['query']=_['keys'](_0x49782d[_0x6f45('0x30')]);_0x49536a[_0x6f45('0x42')]=_[_0x6f45('0x2f')](_0x49536a[_0x6f45('0x2d')],_0x49536a[_0x6f45('0x30')]);_0x4908d0[_0x6f45('0x32')]=_['intersection'](_0x49536a[_0x6f45('0x2d')],qs[_0x6f45('0x31')](_0x49782d[_0x6f45('0x30')][_0x6f45('0x31')]));_0x4908d0[_0x6f45('0x32')]=_0x4908d0[_0x6f45('0x32')][_0x6f45('0x33')]?_0x4908d0[_0x6f45('0x32')]:_0x49536a['model'];if(!_0x49782d[_0x6f45('0x30')]['hasOwnProperty'](_0x6f45('0x43'))){_0x4908d0['limit']=qs[_0x6f45('0x15')](_0x49782d['query'][_0x6f45('0x15')]);_0x4908d0[_0x6f45('0x13')]=qs[_0x6f45('0x13')](_0x49782d[_0x6f45('0x30')]['offset']);}_0x4908d0[_0x6f45('0x44')]=qs[_0x6f45('0x45')](_0x49782d[_0x6f45('0x30')]['sort']);_0x4908d0[_0x6f45('0x26')]=qs['filters'](_[_0x6f45('0x46')](_0x49782d[_0x6f45('0x30')],_0x49536a[_0x6f45('0x42')]));_0x4908d0[_0x6f45('0x26')][_0x6f45('0x47')]=_0x5f32db['id'];if(_0x49782d[_0x6f45('0x30')][_0x6f45('0x48')]){_0x4908d0['where']=_['merge'](_0x4908d0[_0x6f45('0x26')],{'$or':_[_0x6f45('0x21')](_0x4908d0[_0x6f45('0x32')],function(_0x3882e9){var _0x3c0d1d={};_0x3c0d1d[_0x3882e9]={'$like':'%'+_0x49782d[_0x6f45('0x30')][_0x6f45('0x48')]+'%'};return _0x3c0d1d;})});}_0x4908d0=_[_0x6f45('0x35')]({},_0x4908d0,_0x49782d[_0x6f45('0x36')]);return db['UserOpenchannelQueue'][_0x6f45('0x28')](_0x4908d0);}})['then'](function(_0x102770){if(_0x102770){return db['User']['findAndCountAll']({'where':{'id':_[_0x6f45('0x21')](_0x102770,_0x6f45('0x49')),'role':'agent'},'attributes':['id',_0x6f45('0x1e'),_0x6f45('0x4a'),_0x6f45('0x4b'),_0x6f45('0x4c')]});}})[_0x6f45('0x1c')](function(_0x3f2f1b){if(_0x3f2f1b){return{'count':_0x3f2f1b[_0x6f45('0x16')],'rows':_['map'](_0x3f2f1b[_0x6f45('0x29')],function(_0x5c7335){return{'membername':_0x5c7335[_0x6f45('0x1e')],'UserId':_0x5c7335['id'],'queue_name':_0x136224[_0x6f45('0x1e')],'OpenchannelQueueId':_0x136224['id'],'interface':util[_0x6f45('0x4d')](_0x6f45('0x4e'),_0x6f45('0x4f'),_0x5c7335[_0x6f45('0x1e')]),'penalty':0x0,'paused':_0x5c7335['openchannelPause'],'createdAt':_0x5c7335[_0x6f45('0x4c')],'updatedAt':_0x5c7335[_0x6f45('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6f45('0x1c')](respondWithFilteredResult(_0x1760ff,_0x4908d0))['catch'](handleError(_0x1760ff,null));};exports[_0x6f45('0x50')]=function(_0x2a1340,_0x23c89c){var _0x287e8a={};var _0x4d3896={};var _0x517290;var _0xb79914;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2a1340[_0x6f45('0x2c')]['id']}})[_0x6f45('0x1c')](handleEntityNotFound(_0x23c89c,null))[_0x6f45('0x1c')](function(_0x40f813){if(_0x40f813){_0x517290=_0x40f813;_0x4d3896[_0x6f45('0x2d')]=_[_0x6f45('0x2e')](db[_0x6f45('0x51')]['rawAttributes']);_0x4d3896['query']=_[_0x6f45('0x2e')](_0x2a1340[_0x6f45('0x30')]);_0x4d3896['filters']=_['intersection'](_0x4d3896[_0x6f45('0x2d')],_0x4d3896['query']);_0x287e8a['attributes']=_[_0x6f45('0x2f')](_0x4d3896[_0x6f45('0x2d')],qs[_0x6f45('0x31')](_0x2a1340[_0x6f45('0x30')][_0x6f45('0x31')]));_0x287e8a[_0x6f45('0x32')]=_0x287e8a['attributes']['length']?_0x287e8a[_0x6f45('0x32')]:_0x4d3896['model'];_0x287e8a['order']=qs[_0x6f45('0x45')](_0x2a1340[_0x6f45('0x30')][_0x6f45('0x45')]);_0x287e8a[_0x6f45('0x26')]=qs['filters'](_[_0x6f45('0x46')](_0x2a1340[_0x6f45('0x30')],_0x4d3896[_0x6f45('0x42')]));if(_0x2a1340[_0x6f45('0x30')][_0x6f45('0x48')]){_0x287e8a[_0x6f45('0x26')]=_['merge'](_0x287e8a[_0x6f45('0x26')],{'$or':_['map'](_0x287e8a['attributes'],function(_0x8472c7){var _0x1a8992={};_0x1a8992[_0x8472c7]={'$like':'%'+_0x2a1340['query'][_0x6f45('0x48')]+'%'};return _0x1a8992;})});}_0x287e8a=_[_0x6f45('0x35')]({},_0x287e8a,_0x2a1340[_0x6f45('0x36')]);return _0x517290[_0x6f45('0x50')](_0x287e8a);}})[_0x6f45('0x1c')](function(_0x585b5a){if(_0x585b5a){_0xb79914=_0x585b5a['length'];if(!_0x2a1340[_0x6f45('0x30')][_0x6f45('0x52')](_0x6f45('0x43'))){_0x287e8a[_0x6f45('0x15')]=qs[_0x6f45('0x15')](_0x2a1340[_0x6f45('0x30')][_0x6f45('0x15')]);_0x287e8a[_0x6f45('0x13')]=qs['offset'](_0x2a1340['query'][_0x6f45('0x13')]);}return _0x517290[_0x6f45('0x50')](_0x287e8a);}})[_0x6f45('0x1c')](function(_0x1fa071){if(_0x1fa071){return _0x1fa071?{'count':_0xb79914,'rows':_0x1fa071}:null;}})[_0x6f45('0x1c')](respondWithResult(_0x23c89c,null))[_0x6f45('0x2a')](handleError(_0x23c89c,null));};exports[_0x6f45('0x53')]=function(_0x3a42b4,_0x3647fa){var _0x16f34b=_0x3a42b4['body'][_0x6f45('0x54')];return db[_0x6f45('0x51')][_0x6f45('0x28')]({'where':{'id':_0x16f34b},'attributes':['id'],'include':[{'model':db[_0x6f45('0x55')],'as':'Agents','attributes':['id',_0x6f45('0x1e'),'online',_0x6f45('0x56'),_0x6f45('0x57')],'raw':!![]}]})['then'](function(_0x55a261){if(_0x55a261){var _0x25711a=_['flatMap'](_0x55a261,function(_0x39570e){var _0x2a216a=_0x39570e['get']({'plain':!![]});return _0x2a216a[_0x6f45('0x58')];});return db[_0x6f45('0x22')][_0x6f45('0x37')]({'where':{'id':_0x3a42b4[_0x6f45('0x2c')]['id']}})[_0x6f45('0x1c')](function(_0x58cad4){return db[_0x6f45('0x59')][_0x6f45('0x5a')](function(_0x26efde){return _0x58cad4['addTeams'](_0x16f34b,{'transaction':_0x26efde})[_0x6f45('0x1c')](function(){return BPromise['each'](_0x25711a,function(_0x545cb2){return db[_0x6f45('0x5b')][_0x6f45('0x5c')]({'where':{'UserId':_0x545cb2['id'],'OpenchannelQueueId':_0x3a42b4[_0x6f45('0x2c')]['id']},'transaction':_0x26efde});});})['then'](function(){_0x25711a[_0x6f45('0x5d')](function(_0x218126){socket[_0x6f45('0x5e')](_0x6f45('0x5f'),{'UserId':_0x218126['id'],'OpenchannelQueueId':_0x58cad4['id']});});});});});}})['then'](respondWithStatusCode(_0x3647fa,null))[_0x6f45('0x2a')](handleError(_0x3647fa,null));};exports[_0x6f45('0x60')]=function(_0x4b6cb1,_0x194b76){return db[_0x6f45('0x51')][_0x6f45('0x28')]({'where':{'id':_0x4b6cb1['query'][_0x6f45('0x54')]},'attributes':['id'],'include':[{'model':db[_0x6f45('0x55')],'as':_0x6f45('0x58'),'attributes':['id'],'raw':!![]}]})[_0x6f45('0x1c')](handleEntityNotFound(_0x194b76,null))['then'](function(_0x4532c2){var _0x4544e7=_[_0x6f45('0x21')](_0x4532c2,'id');var _0x5275de=[];var _0x4d7274=[];var _0x5ed2ff=squel[_0x6f45('0x61')]();_0x5ed2ff[_0x6f45('0x62')](_0x6f45('0x63'))[_0x6f45('0x64')]('team_has_openchannel_queues','tq')[_0x6f45('0x65')]('user_has_teams','ut',_0x6f45('0x66'))[_0x6f45('0x26')](_0x6f45('0x67'),_0x4b6cb1['params']['id']);for(var _0x69f66c=0x0;_0x69f66c<_0x4532c2[_0x6f45('0x33')];_0x69f66c+=0x1){let _0x213b9a=_0x4532c2[_0x69f66c];for(var _0x877bad=0x0;_0x877bad<_0x213b9a[_0x6f45('0x58')][_0x6f45('0x33')];_0x877bad+=0x1){let _0x54ee83=_0x213b9a[_0x6f45('0x58')][_0x877bad];var _0x261983=_0x5ed2ff['clone']();_0x261983['where'](_0x6f45('0x68'),_0x54ee83['id']);_0x4d7274[_0x6f45('0x69')](db[_0x6f45('0x59')][_0x6f45('0x30')](_0x261983['toString'](),{'type':db[_0x6f45('0x59')][_0x6f45('0x6a')][_0x6f45('0x6b')]})[_0x6f45('0x1c')](function(_0x58f3e7){if(_0x58f3e7['length']===0x1){return _0x54ee83['id'];}else{var _0x586c1c=_['every'](_[_0x6f45('0x21')](_0x58f3e7,_0x6f45('0x6c')),function(_0x22d94d){return _['includes'](_0x4544e7,_0x22d94d);});if(_0x586c1c){return _0x54ee83['id'];}}}));}}return BPromise[_0x6f45('0x6d')](_0x4d7274)[_0x6f45('0x1c')](function(_0x1a3a7b){_0x5275de=_(_0x5275de)['union'](_0x1a3a7b)[_0x6f45('0x6e')]()[_0x6f45('0x6f')]();return db['OpenchannelQueue'][_0x6f45('0x37')]({'where':{'id':_0x4b6cb1[_0x6f45('0x2c')]['id']}})[_0x6f45('0x1c')](function(_0x114b08){return db[_0x6f45('0x59')][_0x6f45('0x5a')](function(_0x172f7f){return _0x114b08[_0x6f45('0x60')](_0x4b6cb1['query'][_0x6f45('0x54')],{'transaction':_0x172f7f})[_0x6f45('0x1c')](function(){if(!_[_0x6f45('0x70')](_0x5275de)){return _0x114b08[_0x6f45('0x71')](_0x5275de,{'transaction':_0x172f7f});}})['then'](function(){_0x5275de[_0x6f45('0x5d')](function(_0x19d4ef){socket[_0x6f45('0x5e')](_0x6f45('0x72'),{'UserId':_0x19d4ef,'OpenchannelQueueId':_0x114b08['id']});});});});});});})[_0x6f45('0x1c')](respondWithStatusCode(_0x194b76,null))['catch'](handleError(_0x194b76,null));};exports[_0x6f45('0x73')]=function(_0x4e3056,_0x439cb6){return db[_0x6f45('0x22')][_0x6f45('0x37')]({'where':{'id':_0x4e3056[_0x6f45('0x2c')]['id']}})['then'](handleEntityNotFound(_0x439cb6,null))[_0x6f45('0x1c')](function(_0x264f6a){if(_0x264f6a){return _0x264f6a[_0x6f45('0x73')](_0x4e3056[_0x6f45('0x39')][_0x6f45('0x54')],_[_0x6f45('0x74')](_0x4e3056[_0x6f45('0x39')],[_0x6f45('0x54'),'id'])||{})[_0x6f45('0x75')](function(_0x24b14d){for(var _0x368cfc=0x0;_0x368cfc<_0x4e3056[_0x6f45('0x39')][_0x6f45('0x54')][_0x6f45('0x33')];_0x368cfc+=0x1){socket[_0x6f45('0x5e')](_0x6f45('0x5f'),{'UserId':Number(_0x4e3056[_0x6f45('0x39')]['ids'][_0x368cfc]),'OpenchannelQueueId':Number(_0x4e3056[_0x6f45('0x2c')]['id'])});}return _0x24b14d;});}})[_0x6f45('0x1c')](respondWithResult(_0x439cb6,null))[_0x6f45('0x2a')](handleError(_0x439cb6,null));};exports['removeAgents']=function(_0x455101,_0x4fc16a){return db['OpenchannelQueue'][_0x6f45('0x37')]({'where':{'id':_0x455101[_0x6f45('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4fc16a,null))[_0x6f45('0x1c')](function(_0x3fd6e8){if(_0x3fd6e8){return _0x3fd6e8[_0x6f45('0x71')](_0x455101[_0x6f45('0x30')]['ids'])[_0x6f45('0x1c')](function(){if(_[_0x6f45('0x76')](_0x455101[_0x6f45('0x30')]['ids'])){for(var _0x2cc05e=0x0;_0x2cc05e<_0x455101['query'][_0x6f45('0x54')][_0x6f45('0x33')];_0x2cc05e+=0x1){socket['emit'](_0x6f45('0x72'),{'UserId':Number(_0x455101[_0x6f45('0x30')]['ids'][_0x2cc05e]),'OpenchannelQueueId':Number(_0x455101[_0x6f45('0x2c')]['id'])});}}else{socket[_0x6f45('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x455101[_0x6f45('0x30')][_0x6f45('0x54')]),'OpenchannelQueueId':Number(_0x455101[_0x6f45('0x2c')]['id'])});}});}})[_0x6f45('0x1c')](respondWithStatusCode(_0x4fc16a,null))[_0x6f45('0x2a')](handleError(_0x4fc16a,null));};exports[_0x6f45('0x77')]=function(_0x4b8ca9,_0x1212db){var _0x2b1c2a={};var _0xa71d1e={};var _0x75db58;var _0xe8f9b4;return db[_0x6f45('0x22')][_0x6f45('0x41')]({'where':{'id':_0x4b8ca9[_0x6f45('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1212db,null))[_0x6f45('0x1c')](function(_0x2242c9){if(_0x2242c9){_0x75db58=_0x2242c9;_0xa71d1e[_0x6f45('0x2d')]=_[_0x6f45('0x2e')](db[_0x6f45('0x55')]['rawAttributes']);_0xa71d1e[_0x6f45('0x30')]=_['keys'](_0x4b8ca9[_0x6f45('0x30')]);_0xa71d1e[_0x6f45('0x42')]=_['intersection'](_0xa71d1e['model'],_0xa71d1e['query']);_0x2b1c2a[_0x6f45('0x32')]=_[_0x6f45('0x2f')](_0xa71d1e[_0x6f45('0x2d')],qs[_0x6f45('0x31')](_0x4b8ca9['query'][_0x6f45('0x31')]));_0x2b1c2a[_0x6f45('0x32')]=_0x2b1c2a['attributes']['length']?_0x2b1c2a['attributes']:_0xa71d1e['model'];_0x2b1c2a['order']=qs[_0x6f45('0x45')](_0x4b8ca9[_0x6f45('0x30')]['sort']);_0x2b1c2a[_0x6f45('0x26')]=qs[_0x6f45('0x42')](_[_0x6f45('0x46')](_0x4b8ca9[_0x6f45('0x30')],_0xa71d1e[_0x6f45('0x42')]));if(_0x4b8ca9[_0x6f45('0x30')][_0x6f45('0x48')]){_0x2b1c2a[_0x6f45('0x26')]=_['merge'](_0x2b1c2a[_0x6f45('0x26')],{'$or':_['map'](_0x2b1c2a['attributes'],function(_0x1a44d1){var _0x3f5f34={};_0x3f5f34[_0x1a44d1]={'$like':'%'+_0x4b8ca9[_0x6f45('0x30')][_0x6f45('0x48')]+'%'};return _0x3f5f34;})});}_0x2b1c2a=_['merge']({},_0x2b1c2a,_0x4b8ca9[_0x6f45('0x36')]);return _0x75db58['getAgents'](_0x2b1c2a);}})['then'](function(_0x432456){if(_0x432456){_0xe8f9b4=_0x432456['length'];if(!_0x4b8ca9['query'][_0x6f45('0x52')](_0x6f45('0x43'))){_0x2b1c2a[_0x6f45('0x15')]=qs['limit'](_0x4b8ca9[_0x6f45('0x30')]['limit']);_0x2b1c2a[_0x6f45('0x13')]=qs['offset'](_0x4b8ca9['query'][_0x6f45('0x13')]);}return _0x75db58[_0x6f45('0x77')](_0x2b1c2a);}})[_0x6f45('0x1c')](function(_0x3faaed){if(_0x3faaed){return _0x3faaed?{'count':_0xe8f9b4,'rows':_0x3faaed}:null;}})[_0x6f45('0x1c')](respondWithResult(_0x1212db,null))[_0x6f45('0x2a')](handleError(_0x1212db,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b42fced..c0e1d54 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 _0x11d4=['emit','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove'];(function(_0x30ab77,_0x21bfa4){var _0x392650=function(_0x24ea18){while(--_0x24ea18){_0x30ab77['push'](_0x30ab77['shift']());}};_0x392650(++_0x21bfa4);}(_0x11d4,0x1aa));var _0x411d=function(_0x36cbd,_0x339fb2){_0x36cbd=_0x36cbd-0x0;var _0x38082a=_0x11d4[_0x36cbd];return _0x38082a;};'use strict';var EventEmitter=require(_0x411d('0x0'));var OpenchannelQueue=require(_0x411d('0x1'))['db'][_0x411d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x411d('0x3')](0x0);var events={'afterCreate':_0x411d('0x4'),'afterUpdate':'update','afterDestroy':_0x411d('0x5')};function emitEvent(_0x2ed0f4){return function(_0xa1c4c1,_0xa305ed,_0x3ece31){OpenchannelQueueEvents[_0x411d('0x6')](_0x2ed0f4+':'+_0xa1c4c1['id'],_0xa1c4c1);OpenchannelQueueEvents[_0x411d('0x6')](_0x2ed0f4,_0xa1c4c1);_0x3ece31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x411d('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x844a=['hasOwnProperty','hook','events','OpenchannelQueue','setMaxListeners','remove','emit'];(function(_0x3a4503,_0x4660e5){var _0x355e59=function(_0x33245b){while(--_0x33245b){_0x3a4503['push'](_0x3a4503['shift']());}};_0x355e59(++_0x4660e5);}(_0x844a,0xbf));var _0xa844=function(_0x5def2d,_0x27f637){_0x5def2d=_0x5def2d-0x0;var _0x1a7757=_0x844a[_0x5def2d];return _0x1a7757;};'use strict';var EventEmitter=require(_0xa844('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xa844('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa844('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa844('0x3')};function emitEvent(_0x251f48){return function(_0x4993ab,_0xf5e6ff,_0x31816e){OpenchannelQueueEvents[_0xa844('0x4')](_0x251f48+':'+_0x4993ab['id'],_0x4993ab);OpenchannelQueueEvents[_0xa844('0x4')](_0x251f48,_0x4993ab);_0x31816e(null);};}for(var e in events){if(events[_0xa844('0x5')](e)){var event=events[e];OpenchannelQueue[_0xa844('0x6')](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 6282831..9725809 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 _0x1275=['openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue'];(function(_0x4f9abb,_0x108e0f){var _0x4ba87b=function(_0x369724){while(--_0x369724){_0x4f9abb['push'](_0x4f9abb['shift']());}};_0x4ba87b(++_0x108e0f);}(_0x1275,0xde));var _0x5127=function(_0x54c837,_0x371468){_0x54c837=_0x54c837-0x0;var _0x22fb45=_0x1275[_0x54c837];return _0x22fb45;};'use strict';var _=require(_0x5127('0x0'));var util=require(_0x5127('0x1'));var logger=require(_0x5127('0x2'))(_0x5127('0x3'));var moment=require(_0x5127('0x4'));var BPromise=require(_0x5127('0x5'));var rp=require(_0x5127('0x6'));var fs=require('fs');var path=require(_0x5127('0x7'));var rimraf=require(_0x5127('0x8'));var config=require(_0x5127('0x9'));var attributes=require(_0x5127('0xa'));module['exports']=function(_0x3dfef3,_0x5b3529){return _0x3dfef3['define'](_0x5127('0xb'),attributes,{'tableName':_0x5127('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dd4=['util','../../config/logger','request-promise','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x36c98a,_0x78f79e){var _0xaad26d=function(_0x4a6402){while(--_0x4a6402){_0x36c98a['push'](_0x36c98a['shift']());}};_0xaad26d(++_0x78f79e);}(_0x6dd4,0x90));var _0x46dd=function(_0x37dd04,_0x5e79e4){_0x37dd04=_0x37dd04-0x0;var _0x13f64f=_0x6dd4[_0x37dd04];return _0x13f64f;};'use strict';var _=require('lodash');var util=require(_0x46dd('0x0'));var logger=require(_0x46dd('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x46dd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46dd('0x3'));var config=require('../../config/environment');var attributes=require(_0x46dd('0x4'));module[_0x46dd('0x5')]=function(_0x53fd63,_0x159735){return _0x53fd63[_0x46dd('0x6')](_0x46dd('0x7'),attributes,{'tableName':_0x46dd('0x8'),'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 b46f932..7a3900f 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 _0x4a4d=['error','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','raw','options','where','attributes','include','map','model','debug','stringify','ShowOpenchannelQueue','find','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x22a8eb,_0x225ebe){var _0x15b30d=function(_0x5327f1){while(--_0x5327f1){_0x22a8eb['push'](_0x22a8eb['shift']());}};_0x15b30d(++_0x225ebe);}(_0x4a4d,0x1cf));var _0xd4a4=function(_0x21c1f2,_0x2cb2a4){_0x21c1f2=_0x21c1f2-0x0;var _0x4dace6=_0x4a4d[_0x21c1f2];return _0x4dace6;};'use strict';var _=require('lodash');var util=require(_0xd4a4('0x0'));var moment=require(_0xd4a4('0x1'));var BPromise=require(_0xd4a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd4a4('0x3'));var logger=require(_0xd4a4('0x4'))(_0xd4a4('0x5'));var config=require(_0xd4a4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd4a4('0x7')][_0xd4a4('0x8')]({'port':0x232a});config[_0xd4a4('0x9')]=_[_0xd4a4('0xa')](config[_0xd4a4('0x9')],{'host':_0xd4a4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd4a4('0xc'))[_0xd4a4('0xd')](socket);function respondWithRpcPromise(_0x4c89ab,_0x30ee58,_0x535327){return new BPromise(function(_0x162137,_0x1b56fa){return client[_0xd4a4('0xe')](_0x4c89ab,_0x535327)[_0xd4a4('0xf')](function(_0x1f07a1){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x30ee58,_0xd4a4('0x10'));logger['debug'](_0xd4a4('0x11'),_0x30ee58,_0xd4a4('0x10'),JSON['stringify'](_0x1f07a1));if(_0x1f07a1[_0xd4a4('0x12')]){if(_0x1f07a1['error']['code']===0x1f4){logger[_0xd4a4('0x12')](_0xd4a4('0x13'),_0x30ee58,_0x1f07a1['error'][_0xd4a4('0x14')]);return _0x1b56fa(_0x1f07a1[_0xd4a4('0x12')][_0xd4a4('0x14')]);}logger['error'](_0xd4a4('0x13'),_0x30ee58,_0x1f07a1['error'][_0xd4a4('0x14')]);return _0x162137(_0x1f07a1[_0xd4a4('0x12')]['message']);}else{logger[_0xd4a4('0x15')](_0xd4a4('0x13'),_0x30ee58,_0xd4a4('0x10'));_0x162137(_0x1f07a1[_0xd4a4('0x16')]['message']);}})[_0xd4a4('0x17')](function(_0x46e0ea){logger[_0xd4a4('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x30ee58,_0x46e0ea);_0x1b56fa(_0x46e0ea);});});}exports[_0xd4a4('0x18')]=function(_0x273aeb){var _0x396c9e=this;return new Promise(function(_0x2e29cb,_0x4d2a80){return db[_0xd4a4('0x19')]['findAll']({'raw':_0x273aeb['options']?_0x273aeb['options'][_0xd4a4('0x1a')]===undefined?!![]:![]:!![],'where':_0x273aeb[_0xd4a4('0x1b')]?_0x273aeb['options'][_0xd4a4('0x1c')]||null:null,'attributes':_0x273aeb[_0xd4a4('0x1b')]?_0x273aeb[_0xd4a4('0x1b')][_0xd4a4('0x1d')]||null:null,'limit':_0x273aeb[_0xd4a4('0x1b')]?_0x273aeb['options']['limit']||null:null,'include':_0x273aeb['options']?_0x273aeb[_0xd4a4('0x1b')][_0xd4a4('0x1e')]?_['map'](_0x273aeb[_0xd4a4('0x1b')][_0xd4a4('0x1e')],function(_0x5b1ef7){return{'model':db[_0x5b1ef7['model']],'as':_0x5b1ef7['as'],'attributes':_0x5b1ef7[_0xd4a4('0x1d')],'include':_0x5b1ef7[_0xd4a4('0x1e')]?_[_0xd4a4('0x1f')](_0x5b1ef7[_0xd4a4('0x1e')],function(_0x5e7152){return{'model':db[_0x5e7152[_0xd4a4('0x20')]],'as':_0x5e7152['as'],'attributes':_0x5e7152['attributes'],'include':_0x5e7152[_0xd4a4('0x1e')]?_[_0xd4a4('0x1f')](_0x5e7152['include'],function(_0x377454){return{'model':db[_0x377454[_0xd4a4('0x20')]],'as':_0x377454['as'],'attributes':_0x377454['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4a4('0xf')](function(_0x112913){logger[_0xd4a4('0x15')]('GetOpenchannelQueue',_0x273aeb);logger[_0xd4a4('0x21')](_0xd4a4('0x18'),_0x273aeb,JSON[_0xd4a4('0x22')](_0x112913));_0x2e29cb(_0x112913);})[_0xd4a4('0x17')](function(_0x27a18d){logger[_0xd4a4('0x12')](_0xd4a4('0x18'),_0x27a18d['message'],_0x273aeb);_0x4d2a80(_0x396c9e[_0xd4a4('0x12')](0x1f4,_0x27a18d[_0xd4a4('0x14')]));});});};exports[_0xd4a4('0x23')]=function(_0x15cb69){var _0x306c50=this;return new Promise(function(_0x1fffb7,_0x3f2673){return db[_0xd4a4('0x19')][_0xd4a4('0x24')]({'raw':_0x15cb69[_0xd4a4('0x1b')]?_0x15cb69[_0xd4a4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x15cb69[_0xd4a4('0x1b')]?_0x15cb69['options'][_0xd4a4('0x1c')]||null:null,'attributes':_0x15cb69['options']?_0x15cb69[_0xd4a4('0x1b')]['attributes']||null:null,'include':_0x15cb69[_0xd4a4('0x1b')]?_0x15cb69[_0xd4a4('0x1b')][_0xd4a4('0x1e')]?_[_0xd4a4('0x1f')](_0x15cb69[_0xd4a4('0x1b')][_0xd4a4('0x1e')],function(_0x4252d6){return{'model':db[_0x4252d6['model']],'as':_0x4252d6['as'],'attributes':_0x4252d6['attributes'],'include':_0x4252d6[_0xd4a4('0x1e')]?_[_0xd4a4('0x1f')](_0x4252d6[_0xd4a4('0x1e')],function(_0xf9e9f6){return{'model':db[_0xf9e9f6[_0xd4a4('0x20')]],'as':_0xf9e9f6['as'],'attributes':_0xf9e9f6[_0xd4a4('0x1d')],'include':_0xf9e9f6[_0xd4a4('0x1e')]?_[_0xd4a4('0x1f')](_0xf9e9f6[_0xd4a4('0x1e')],function(_0x1a2290){return{'model':db[_0x1a2290[_0xd4a4('0x20')]],'as':_0x1a2290['as'],'attributes':_0x1a2290[_0xd4a4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd4a4('0xf')](function(_0x2a9c64){logger[_0xd4a4('0x15')](_0xd4a4('0x23'),_0x15cb69);logger[_0xd4a4('0x21')]('ShowOpenchannelQueue',_0x15cb69,JSON[_0xd4a4('0x22')](_0x2a9c64));_0x1fffb7(_0x2a9c64);})[_0xd4a4('0x17')](function(_0x432f92){logger[_0xd4a4('0x12')]('ShowOpenchannelQueue',_0x432f92[_0xd4a4('0x14')],_0x15cb69);_0x3f2673(_0x306c50['error'](0x1f4,_0x432f92[_0xd4a4('0x14')]));});});}; \ No newline at end of file +var _0x94cf=['client','http','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','options','where','attributes','limit','include','map','model','then','GetOpenchannelQueue','ShowOpenchannelQueue','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3b0aab,_0x486c62){var _0x39efb2=function(_0x34d18c){while(--_0x34d18c){_0x3b0aab['push'](_0x3b0aab['shift']());}};_0x39efb2(++_0x486c62);}(_0x94cf,0x156));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf94c('0x0'));var BPromise=require(_0xf94c('0x1'));var rs=require(_0xf94c('0x2'));var fs=require('fs');var Redis=require(_0xf94c('0x3'));var db=require(_0xf94c('0x4'))['db'];var utils=require(_0xf94c('0x5'));var logger=require(_0xf94c('0x6'))(_0xf94c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf94c('0x8'));var client=jayson[_0xf94c('0x9')][_0xf94c('0xa')]({'port':0x232a});config[_0xf94c('0xb')]=_['defaults'](config[_0xf94c('0xb')],{'host':_0xf94c('0xc'),'port':0x18eb});var socket=require(_0xf94c('0xd'))(new Redis(config[_0xf94c('0xb')]));require('./openchannelQueue.socket')[_0xf94c('0xe')](socket);function respondWithRpcPromise(_0x1f1d8b,_0x313a7e,_0x49d121){return new BPromise(function(_0x52622f,_0x40e06b){return client[_0xf94c('0xf')](_0x1f1d8b,_0x49d121)['then'](function(_0xa7a49d){logger[_0xf94c('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x313a7e,_0xf94c('0x11'));logger[_0xf94c('0x12')](_0xf94c('0x13'),_0x313a7e,_0xf94c('0x11'),JSON[_0xf94c('0x14')](_0xa7a49d));if(_0xa7a49d[_0xf94c('0x15')]){if(_0xa7a49d[_0xf94c('0x15')][_0xf94c('0x16')]===0x1f4){logger[_0xf94c('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x313a7e,_0xa7a49d['error'][_0xf94c('0x17')]);return _0x40e06b(_0xa7a49d[_0xf94c('0x15')]['message']);}logger['error'](_0xf94c('0x18'),_0x313a7e,_0xa7a49d[_0xf94c('0x15')][_0xf94c('0x17')]);return _0x52622f(_0xa7a49d[_0xf94c('0x15')][_0xf94c('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x313a7e,_0xf94c('0x11'));_0x52622f(_0xa7a49d[_0xf94c('0x19')][_0xf94c('0x17')]);}})[_0xf94c('0x1a')](function(_0x20c295){logger[_0xf94c('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x313a7e,_0x20c295);_0x40e06b(_0x20c295);});});}exports['GetOpenchannelQueue']=function(_0x3a542b){var _0x334c55=this;return new Promise(function(_0x45ba6b,_0x739bd){return db['OpenchannelQueue']['findAll']({'raw':_0x3a542b[_0xf94c('0x1b')]?_0x3a542b[_0xf94c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a542b[_0xf94c('0x1b')]?_0x3a542b[_0xf94c('0x1b')][_0xf94c('0x1c')]||null:null,'attributes':_0x3a542b[_0xf94c('0x1b')]?_0x3a542b['options'][_0xf94c('0x1d')]||null:null,'limit':_0x3a542b[_0xf94c('0x1b')]?_0x3a542b[_0xf94c('0x1b')][_0xf94c('0x1e')]||null:null,'include':_0x3a542b[_0xf94c('0x1b')]?_0x3a542b[_0xf94c('0x1b')][_0xf94c('0x1f')]?_[_0xf94c('0x20')](_0x3a542b[_0xf94c('0x1b')][_0xf94c('0x1f')],function(_0xd2b2f7){return{'model':db[_0xd2b2f7[_0xf94c('0x21')]],'as':_0xd2b2f7['as'],'attributes':_0xd2b2f7[_0xf94c('0x1d')],'include':_0xd2b2f7[_0xf94c('0x1f')]?_[_0xf94c('0x20')](_0xd2b2f7[_0xf94c('0x1f')],function(_0x470ae3){return{'model':db[_0x470ae3[_0xf94c('0x21')]],'as':_0x470ae3['as'],'attributes':_0x470ae3[_0xf94c('0x1d')],'include':_0x470ae3[_0xf94c('0x1f')]?_[_0xf94c('0x20')](_0x470ae3[_0xf94c('0x1f')],function(_0x38236b){return{'model':db[_0x38236b[_0xf94c('0x21')]],'as':_0x38236b['as'],'attributes':_0x38236b[_0xf94c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf94c('0x22')](function(_0x18793b){logger[_0xf94c('0x10')](_0xf94c('0x23'),_0x3a542b);logger[_0xf94c('0x12')](_0xf94c('0x23'),_0x3a542b,JSON[_0xf94c('0x14')](_0x18793b));_0x45ba6b(_0x18793b);})[_0xf94c('0x1a')](function(_0x39e98f){logger[_0xf94c('0x15')]('GetOpenchannelQueue',_0x39e98f['message'],_0x3a542b);_0x739bd(_0x334c55[_0xf94c('0x15')](0x1f4,_0x39e98f[_0xf94c('0x17')]));});});};exports[_0xf94c('0x24')]=function(_0x4d0920){var _0x49d00d=this;return new Promise(function(_0x39ebe9,_0x1c041f){return db['OpenchannelQueue'][_0xf94c('0x25')]({'raw':_0x4d0920[_0xf94c('0x1b')]?_0x4d0920['options'][_0xf94c('0x26')]===undefined?!![]:![]:!![],'where':_0x4d0920[_0xf94c('0x1b')]?_0x4d0920[_0xf94c('0x1b')]['where']||null:null,'attributes':_0x4d0920['options']?_0x4d0920['options'][_0xf94c('0x1d')]||null:null,'include':_0x4d0920[_0xf94c('0x1b')]?_0x4d0920[_0xf94c('0x1b')][_0xf94c('0x1f')]?_[_0xf94c('0x20')](_0x4d0920[_0xf94c('0x1b')]['include'],function(_0x4369e0){return{'model':db[_0x4369e0[_0xf94c('0x21')]],'as':_0x4369e0['as'],'attributes':_0x4369e0[_0xf94c('0x1d')],'include':_0x4369e0['include']?_[_0xf94c('0x20')](_0x4369e0[_0xf94c('0x1f')],function(_0x25fe3f){return{'model':db[_0x25fe3f[_0xf94c('0x21')]],'as':_0x25fe3f['as'],'attributes':_0x25fe3f[_0xf94c('0x1d')],'include':_0x25fe3f[_0xf94c('0x1f')]?_['map'](_0x25fe3f[_0xf94c('0x1f')],function(_0x3004cc){return{'model':db[_0x3004cc[_0xf94c('0x21')]],'as':_0x3004cc['as'],'attributes':_0x3004cc[_0xf94c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf94c('0x22')](function(_0x3fc318){logger['info'](_0xf94c('0x24'),_0x4d0920);logger[_0xf94c('0x12')](_0xf94c('0x24'),_0x4d0920,JSON[_0xf94c('0x14')](_0x3fc318));_0x39ebe9(_0x3fc318);})['catch'](function(_0x2eec99){logger[_0xf94c('0x15')]('ShowOpenchannelQueue',_0x2eec99[_0xf94c('0x17')],_0x4d0920);_0x1c041f(_0x49d00d[_0xf94c('0x15')](0x1f4,_0x2eec99[_0xf94c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 14b8364..a135d4c 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 _0x3848=['register','openchannelQueue:','remove','update','emit','removeListener'];(function(_0x1ef509,_0x31d8ef){var _0xca0544=function(_0xf4fda7){while(--_0xf4fda7){_0x1ef509['push'](_0x1ef509['shift']());}};_0xca0544(++_0x31d8ef);}(_0x3848,0x1be));var _0x8384=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0x3848[_0x4c80d7];return _0x3c5095;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x8384('0x0'),_0x8384('0x1')];function createListener(_0x3ad5da,_0xe40290){return function(_0x498474){_0xe40290[_0x8384('0x2')](_0x3ad5da,_0x498474);};}function removeListener(_0x22963f,_0x272d95){return function(){OpenchannelQueueEvents[_0x8384('0x3')](_0x22963f,_0x272d95);};}exports[_0x8384('0x4')]=function(_0x3e4d50){for(var _0x11c3b4=0x0,_0x15cce0=events['length'];_0x11c3b4<_0x15cce0;_0x11c3b4++){var _0x40aea1=events[_0x11c3b4];var _0x4b0f60=createListener(_0x8384('0x5')+_0x40aea1,_0x3e4d50);OpenchannelQueueEvents['on'](_0x40aea1,_0x4b0f60);}}; \ No newline at end of file +var _0xb1a4=['remove','emit','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x2ba2d8,_0x317124){var _0x4f10c7=function(_0x3c423b){while(--_0x3c423b){_0x2ba2d8['push'](_0x2ba2d8['shift']());}};_0x4f10c7(++_0x317124);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x58510f,_0x2dde59){_0x58510f=_0x58510f-0x0;var _0xbe3788=_0xb1a4[_0x58510f];return _0xbe3788;};'use strict';var OpenchannelQueueEvents=require(_0x4b1a('0x0'));var events=[_0x4b1a('0x1'),_0x4b1a('0x2'),'update'];function createListener(_0x5141eb,_0x54a109){return function(_0x1ee07c){_0x54a109[_0x4b1a('0x3')](_0x5141eb,_0x1ee07c);};}function removeListener(_0x56135a,_0x1f2ed8){return function(){OpenchannelQueueEvents['removeListener'](_0x56135a,_0x1f2ed8);};}exports[_0x4b1a('0x4')]=function(_0x349b65){for(var _0x5e1826=0x0,_0x14411d=events[_0x4b1a('0x5')];_0x5e1826<_0x14411d;_0x5e1826++){var _0x312e2f=events[_0x5e1826];var _0x371066=createListener(_0x4b1a('0x6')+_0x312e2f,_0x349b65);OpenchannelQueueEvents['on'](_0x312e2f,_0x371066);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c57b01b..8ad2ce0 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 _0x46a1=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x1122b0,_0x3259ce){var _0x4dc9c9=function(_0x477a3e){while(--_0x477a3e){_0x1122b0['push'](_0x1122b0['shift']());}};_0x4dc9c9(++_0x3259ce);}(_0x46a1,0x17a));var _0x146a=function(_0x956d5b,_0x3376c1){_0x956d5b=_0x956d5b-0x0;var _0x2d1672=_0x46a1[_0x956d5b];return _0x2d1672;};'use strict';var multer=require('multer');var util=require(_0x146a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x146a('0x1'));var router=express[_0x146a('0x2')]();var fs_extra=require(_0x146a('0x3'));var auth=require(_0x146a('0x4'));var interaction=require(_0x146a('0x5'));var config=require(_0x146a('0x6'));var controller=require(_0x146a('0x7'));router[_0x146a('0x8')]('/',auth['isAuthenticated'](),controller[_0x146a('0x9')]);router[_0x146a('0x8')](_0x146a('0xa'),auth[_0x146a('0xb')](),controller[_0x146a('0xc')]);router['get'](_0x146a('0xd'),auth[_0x146a('0xb')](),controller[_0x146a('0xe')]);router[_0x146a('0xf')]('/',auth[_0x146a('0xb')](),controller[_0x146a('0x10')]);router[_0x146a('0x11')](_0x146a('0xd'),auth[_0x146a('0xb')](),controller[_0x146a('0x12')]);router[_0x146a('0x13')](_0x146a('0xd'),auth[_0x146a('0xb')](),controller['destroy']);module[_0x146a('0x14')]=router; \ No newline at end of file +var _0xbb36=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb36,0x181));var _0x6bb3=function(_0x47050f,_0x3b22b6){_0x47050f=_0x47050f-0x0;var _0x3cdd21=_0xbb36[_0x47050f];return _0x3cdd21;};'use strict';var multer=require(_0x6bb3('0x0'));var util=require(_0x6bb3('0x1'));var path=require(_0x6bb3('0x2'));var timeout=require(_0x6bb3('0x3'));var express=require('express');var router=express[_0x6bb3('0x4')]();var fs_extra=require(_0x6bb3('0x5'));var auth=require(_0x6bb3('0x6'));var interaction=require(_0x6bb3('0x7'));var config=require(_0x6bb3('0x8'));var controller=require(_0x6bb3('0x9'));router[_0x6bb3('0xa')]('/',auth[_0x6bb3('0xb')](),controller[_0x6bb3('0xc')]);router[_0x6bb3('0xa')](_0x6bb3('0xd'),auth['isAuthenticated'](),controller[_0x6bb3('0xe')]);router[_0x6bb3('0xa')](_0x6bb3('0xf'),auth[_0x6bb3('0xb')](),controller[_0x6bb3('0x10')]);router[_0x6bb3('0x11')]('/',auth['isAuthenticated'](),controller[_0x6bb3('0x12')]);router[_0x6bb3('0x13')](_0x6bb3('0xf'),auth[_0x6bb3('0xb')](),controller[_0x6bb3('0x14')]);router[_0x6bb3('0x15')](_0x6bb3('0xf'),auth[_0x6bb3('0xb')](),controller['destroy']);module[_0x6bb3('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 7fa6283..7f7640e 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 _0xfe51=['STRING','DATE','moment','sequelize','exports'];(function(_0x379c8d,_0x2e252f){var _0x4fa5ad=function(_0x17f20a){while(--_0x17f20a){_0x379c8d['push'](_0x379c8d['shift']());}};_0x4fa5ad(++_0x2e252f);}(_0xfe51,0x1ab));var _0x1fe5=function(_0x3721e8,_0x3619d4){_0x3721e8=_0x3721e8-0x0;var _0xf9336e=_0xfe51[_0x3721e8];return _0xf9336e;};'use strict';var moment=require(_0x1fe5('0x0'));var Sequelize=require(_0x1fe5('0x1'));module[_0x1fe5('0x2')]={'uniqueid':{'type':Sequelize[_0x1fe5('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1fe5('0x4')]},'leaveAt':{'type':Sequelize[_0x1fe5('0x4')]},'acceptAt':{'type':Sequelize[_0x1fe5('0x4')]},'exitAt':{'type':Sequelize[_0x1fe5('0x4')]},'reason':{'type':Sequelize[_0x1fe5('0x3')]}}; \ No newline at end of file +var _0x072d=['moment','exports','STRING','DATE'];(function(_0x7682dd,_0x2a4ceb){var _0xf1002f=function(_0x3a841b){while(--_0x3a841b){_0x7682dd['push'](_0x7682dd['shift']());}};_0xf1002f(++_0x2a4ceb);}(_0x072d,0x1d0));var _0xd072=function(_0x2adb42,_0xed8b12){_0x2adb42=_0x2adb42-0x0;var _0x101363=_0x072d[_0x2adb42];return _0x101363;};'use strict';var moment=require(_0xd072('0x0'));var Sequelize=require('sequelize');module[_0xd072('0x1')]={'uniqueid':{'type':Sequelize[_0xd072('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd072('0x2')]},'joinAt':{'type':Sequelize[_0xd072('0x3')]},'leaveAt':{'type':Sequelize[_0xd072('0x3')]},'acceptAt':{'type':Sequelize[_0xd072('0x3')]},'exitAt':{'type':Sequelize[_0xd072('0x3')]},'reason':{'type':Sequelize[_0xd072('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cd5dd42..9c70ada 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 _0xa2b0=['pick','filter','merge','VIRTUAL','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','where'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xa2b0,0x1ad));var _0x0a2b=function(_0x5f4ff6,_0x2a2b16){_0x5f4ff6=_0x5f4ff6-0x0;var _0x5ecc5b=_0xa2b0[_0x5f4ff6];return _0x5ecc5b;};'use strict';var emlformat=require(_0x0a2b('0x0'));var rimraf=require(_0x0a2b('0x1'));var zipdir=require(_0x0a2b('0x2'));var jsonpatch=require(_0x0a2b('0x3'));var rp=require(_0x0a2b('0x4'));var moment=require(_0x0a2b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a2b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a2b('0x7'));var fs=require('fs');var fs_extra=require(_0x0a2b('0x8'));var _=require(_0x0a2b('0x9'));var squel=require(_0x0a2b('0xa'));var crypto=require(_0x0a2b('0xb'));var jsforce=require(_0x0a2b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0a2b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a2b('0xe'));var qs=require(_0x0a2b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a2b('0x10'));var logger=require(_0x0a2b('0x11'))('api');var utils=require(_0x0a2b('0x12'));var config=require(_0x0a2b('0x13'));var licenseUtil=require(_0x0a2b('0x14'));var db=require(_0x0a2b('0x15'))['db'];function respondWithStatusCode(_0x2d3dc2,_0x32b339){_0x32b339=_0x32b339||0xcc;return function(_0x43fa02){if(_0x43fa02){return _0x2d3dc2[_0x0a2b('0x16')](_0x32b339);}return _0x2d3dc2['status'](_0x32b339)['end']();};}function respondWithResult(_0x311a80,_0x3be86e){_0x3be86e=_0x3be86e||0xc8;return function(_0xadd911){if(_0xadd911){return _0x311a80[_0x0a2b('0x17')](_0x3be86e)['json'](_0xadd911);}};}function respondWithFilteredResult(_0x363285,_0x30d173){return function(_0x182492){if(_0x182492){var _0xee42b5=typeof _0x30d173[_0x0a2b('0x18')]==='undefined'&&typeof _0x30d173[_0x0a2b('0x19')]===_0x0a2b('0x1a');var _0x3aba9e=_0x182492['count'];var _0x4cfcf1=_0xee42b5?0x0:_0x30d173[_0x0a2b('0x18')];var _0xa782da=_0xee42b5?_0x182492[_0x0a2b('0x1b')]:_0x30d173[_0x0a2b('0x18')]+_0x30d173[_0x0a2b('0x19')];var _0x52b78f;if(_0xa782da>=_0x3aba9e){_0xa782da=_0x3aba9e;_0x52b78f=0xc8;}else{_0x52b78f=0xce;}_0x363285[_0x0a2b('0x17')](_0x52b78f);return _0x363285['set'](_0x0a2b('0x1c'),_0x4cfcf1+'-'+_0xa782da+'/'+_0x3aba9e)[_0x0a2b('0x1d')](_0x182492);}return null;};}function patchUpdates(_0x249134){return function(_0x4c27ea){try{jsonpatch[_0x0a2b('0x1e')](_0x4c27ea,_0x249134,!![]);}catch(_0x13b4c3){return BPromise['reject'](_0x13b4c3);}return _0x4c27ea[_0x0a2b('0x1f')]();};}function saveUpdates(_0x426556,_0x1b37f7){return function(_0xd99219){if(_0xd99219){return _0xd99219[_0x0a2b('0x20')](_0x426556)[_0x0a2b('0x21')](function(_0x5051c8){return _0x5051c8;});}return null;};}function removeEntity(_0xda0cf8,_0x1d50c3){return function(_0x3e1218){if(_0x3e1218){return _0x3e1218[_0x0a2b('0x22')]()[_0x0a2b('0x21')](function(){_0xda0cf8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42808f,_0x172ff2){return function(_0x328030){if(!_0x328030){_0x42808f[_0x0a2b('0x16')](0x194);}return _0x328030;};}function handleError(_0x46423e,_0x3f8ae6){_0x3f8ae6=_0x3f8ae6||0x1f4;return function(_0x118784){logger['error'](_0x118784['stack']);if(_0x118784[_0x0a2b('0x23')]){delete _0x118784['name'];}_0x46423e['status'](_0x3f8ae6)[_0x0a2b('0x24')](_0x118784);};}exports[_0x0a2b('0x25')]=function(_0xc20e2e,_0x43fc78){var _0x364437={},_0x46656b={},_0x545e55={'count':0x0,'rows':[]};var _0x156a1e=_[_0x0a2b('0x26')](db[_0x0a2b('0x27')]['rawAttributes'],function(_0x35f404){return{'name':_0x35f404[_0x0a2b('0x28')],'type':_0x35f404[_0x0a2b('0x29')][_0x0a2b('0x2a')]};});_0x46656b[_0x0a2b('0x2b')]=_[_0x0a2b('0x26')](_0x156a1e,'name');_0x46656b['query']=_[_0x0a2b('0x2c')](_0xc20e2e['query']);_0x46656b[_0x0a2b('0x2d')]=_[_0x0a2b('0x2e')](_0x46656b['model'],_0x46656b['query']);_0x364437[_0x0a2b('0x2f')]=_[_0x0a2b('0x2e')](_0x46656b[_0x0a2b('0x2b')],qs[_0x0a2b('0x30')](_0xc20e2e[_0x0a2b('0x31')][_0x0a2b('0x30')]));_0x364437[_0x0a2b('0x2f')]=_0x364437[_0x0a2b('0x2f')][_0x0a2b('0x32')]?_0x364437[_0x0a2b('0x2f')]:_0x46656b[_0x0a2b('0x2b')];if(!_0xc20e2e[_0x0a2b('0x31')]['hasOwnProperty']('nolimit')){_0x364437[_0x0a2b('0x19')]=qs[_0x0a2b('0x19')](_0xc20e2e[_0x0a2b('0x31')][_0x0a2b('0x19')]);_0x364437['offset']=qs[_0x0a2b('0x18')](_0xc20e2e[_0x0a2b('0x31')][_0x0a2b('0x18')]);}_0x364437[_0x0a2b('0x33')]=qs[_0x0a2b('0x34')](_0xc20e2e['query']['sort']);_0x364437[_0x0a2b('0x35')]=qs[_0x0a2b('0x2d')](_[_0x0a2b('0x36')](_0xc20e2e[_0x0a2b('0x31')],_0x46656b[_0x0a2b('0x2d')]),_0x156a1e);if(_0xc20e2e[_0x0a2b('0x31')][_0x0a2b('0x37')]){_0x364437['where']=_[_0x0a2b('0x38')](_0x364437[_0x0a2b('0x35')],{'$or':_['map'](_0x156a1e,function(_0x3b86ed){if(_0x3b86ed[_0x0a2b('0x29')]!==_0x0a2b('0x39')){var _0x286352={};_0x286352[_0x3b86ed[_0x0a2b('0x23')]]={'$like':'%'+_0xc20e2e[_0x0a2b('0x31')][_0x0a2b('0x37')]+'%'};return _0x286352;}})});}_0x364437=_[_0x0a2b('0x38')]({},_0x364437,_0xc20e2e['options']);var _0x51cd5f={'where':_0x364437[_0x0a2b('0x35')]};return db[_0x0a2b('0x27')]['count'](_0x51cd5f)[_0x0a2b('0x21')](function(_0x5aa245){_0x545e55['count']=_0x5aa245;if(_0xc20e2e[_0x0a2b('0x31')]['includeAll']){_0x364437['include']=[{'all':!![]}];}return db[_0x0a2b('0x27')]['findAll'](_0x364437);})['then'](function(_0xc90d31){_0x545e55[_0x0a2b('0x3a')]=_0xc90d31;return _0x545e55;})['then'](respondWithFilteredResult(_0x43fc78,_0x364437))[_0x0a2b('0x3b')](handleError(_0x43fc78,null));};exports[_0x0a2b('0x3c')]=function(_0xe63d59,_0x791d0){var _0x164964={'raw':!![],'where':{'id':_0xe63d59[_0x0a2b('0x3d')]['id']}},_0x5aa701={};_0x5aa701[_0x0a2b('0x2b')]=_[_0x0a2b('0x2c')](db[_0x0a2b('0x27')][_0x0a2b('0x3e')]);_0x5aa701[_0x0a2b('0x31')]=_['keys'](_0xe63d59[_0x0a2b('0x31')]);_0x5aa701[_0x0a2b('0x2d')]=_[_0x0a2b('0x2e')](_0x5aa701[_0x0a2b('0x2b')],_0x5aa701[_0x0a2b('0x31')]);_0x164964[_0x0a2b('0x2f')]=_[_0x0a2b('0x2e')](_0x5aa701['model'],qs['fields'](_0xe63d59[_0x0a2b('0x31')][_0x0a2b('0x30')]));_0x164964['attributes']=_0x164964[_0x0a2b('0x2f')]['length']?_0x164964[_0x0a2b('0x2f')]:_0x5aa701['model'];if(_0xe63d59[_0x0a2b('0x31')][_0x0a2b('0x3f')]){_0x164964[_0x0a2b('0x40')]=[{'all':!![]}];}_0x164964=_[_0x0a2b('0x38')]({},_0x164964,_0xe63d59['options']);return db['OpenchannelQueueReport'][_0x0a2b('0x41')](_0x164964)[_0x0a2b('0x21')](handleEntityNotFound(_0x791d0,null))[_0x0a2b('0x21')](respondWithResult(_0x791d0,null))[_0x0a2b('0x3b')](handleError(_0x791d0,null));};exports[_0x0a2b('0x42')]=function(_0x232d17,_0x459459){return db[_0x0a2b('0x27')][_0x0a2b('0x42')](_0x232d17[_0x0a2b('0x43')],{})['then'](respondWithResult(_0x459459,0xc9))[_0x0a2b('0x3b')](handleError(_0x459459,null));};exports[_0x0a2b('0x20')]=function(_0x2ee63f,_0x78aa5a){if(_0x2ee63f[_0x0a2b('0x43')]['id']){delete _0x2ee63f[_0x0a2b('0x43')]['id'];}return db[_0x0a2b('0x27')]['find']({'where':{'id':_0x2ee63f[_0x0a2b('0x3d')]['id']}})[_0x0a2b('0x21')](handleEntityNotFound(_0x78aa5a,null))[_0x0a2b('0x21')](saveUpdates(_0x2ee63f[_0x0a2b('0x43')],null))['then'](respondWithResult(_0x78aa5a,null))['catch'](handleError(_0x78aa5a,null));};exports[_0x0a2b('0x22')]=function(_0x215aa1,_0x1bc415){return db[_0x0a2b('0x27')][_0x0a2b('0x41')]({'where':{'id':_0x215aa1['params']['id']}})['then'](handleEntityNotFound(_0x1bc415,null))['then'](removeEntity(_0x1bc415,null))[_0x0a2b('0x3b')](handleError(_0x1bc415,null));};exports[_0x0a2b('0x44')]=function(_0x463513,_0x32a57e){return db['OpenchannelQueueReport'][_0x0a2b('0x44')]()[_0x0a2b('0x21')](respondWithResult(_0x32a57e,null))[_0x0a2b('0x3b')](handleError(_0x32a57e,null));}; \ No newline at end of file +var _0x2057=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x2057,0x1c7));var _0x7205=function(_0x57d986,_0x588068){_0x57d986=_0x57d986-0x0;var _0x4e110f=_0x2057[_0x57d986];return _0x4e110f;};'use strict';var emlformat=require(_0x7205('0x0'));var rimraf=require(_0x7205('0x1'));var zipdir=require(_0x7205('0x2'));var jsonpatch=require(_0x7205('0x3'));var rp=require(_0x7205('0x4'));var moment=require('moment');var BPromise=require(_0x7205('0x5'));var Mustache=require(_0x7205('0x6'));var util=require(_0x7205('0x7'));var path=require(_0x7205('0x8'));var sox=require(_0x7205('0x9'));var csv=require(_0x7205('0xa'));var ejs=require(_0x7205('0xb'));var fs=require('fs');var fs_extra=require(_0x7205('0xc'));var _=require('lodash');var squel=require(_0x7205('0xd'));var crypto=require(_0x7205('0xe'));var jsforce=require(_0x7205('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7205('0xa'));var querystring=require('querystring');var Papa=require(_0x7205('0x10'));var Redis=require(_0x7205('0x11'));var authService=require(_0x7205('0x12'));var qs=require(_0x7205('0x13'));var as=require(_0x7205('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7205('0x15'))(_0x7205('0x16'));var utils=require(_0x7205('0x17'));var config=require(_0x7205('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7205('0x19'))['db'];function respondWithStatusCode(_0x4841fe,_0x2f76c7){_0x2f76c7=_0x2f76c7||0xcc;return function(_0x572efc){if(_0x572efc){return _0x4841fe[_0x7205('0x1a')](_0x2f76c7);}return _0x4841fe[_0x7205('0x1b')](_0x2f76c7)[_0x7205('0x1c')]();};}function respondWithResult(_0x14e1a1,_0x5db8a8){_0x5db8a8=_0x5db8a8||0xc8;return function(_0x3f8f16){if(_0x3f8f16){return _0x14e1a1['status'](_0x5db8a8)[_0x7205('0x1d')](_0x3f8f16);}};}function respondWithFilteredResult(_0x1ed222,_0x52cc68){return function(_0x3d332b){if(_0x3d332b){var _0xab0072=typeof _0x52cc68[_0x7205('0x1e')]===_0x7205('0x1f')&&typeof _0x52cc68[_0x7205('0x20')]===_0x7205('0x1f');var _0x2eef6d=_0x3d332b[_0x7205('0x21')];var _0x4af208=_0xab0072?0x0:_0x52cc68[_0x7205('0x1e')];var _0x55f319=_0xab0072?_0x3d332b[_0x7205('0x21')]:_0x52cc68['offset']+_0x52cc68['limit'];var _0x553007;if(_0x55f319>=_0x2eef6d){_0x55f319=_0x2eef6d;_0x553007=0xc8;}else{_0x553007=0xce;}_0x1ed222['status'](_0x553007);return _0x1ed222[_0x7205('0x22')](_0x7205('0x23'),_0x4af208+'-'+_0x55f319+'/'+_0x2eef6d)[_0x7205('0x1d')](_0x3d332b);}return null;};}function patchUpdates(_0x4300f8){return function(_0x5e6933){try{jsonpatch[_0x7205('0x24')](_0x5e6933,_0x4300f8,!![]);}catch(_0x4e594c){return BPromise['reject'](_0x4e594c);}return _0x5e6933[_0x7205('0x25')]();};}function saveUpdates(_0x1168ec,_0x3cccf1){return function(_0xbd3cad){if(_0xbd3cad){return _0xbd3cad['update'](_0x1168ec)[_0x7205('0x26')](function(_0x49c724){return _0x49c724;});}return null;};}function removeEntity(_0x2787b1,_0x3f531c){return function(_0x419ec9){if(_0x419ec9){return _0x419ec9[_0x7205('0x27')]()[_0x7205('0x26')](function(){_0x2787b1[_0x7205('0x1b')](0xcc)[_0x7205('0x1c')]();});}};}function handleEntityNotFound(_0x33c705,_0x3a53aa){return function(_0x1d3ea4){if(!_0x1d3ea4){_0x33c705[_0x7205('0x1a')](0x194);}return _0x1d3ea4;};}function handleError(_0x51a25b,_0x1204de){_0x1204de=_0x1204de||0x1f4;return function(_0x45c7d5){logger[_0x7205('0x28')](_0x45c7d5[_0x7205('0x29')]);if(_0x45c7d5[_0x7205('0x2a')]){delete _0x45c7d5[_0x7205('0x2a')];}_0x51a25b[_0x7205('0x1b')](_0x1204de)[_0x7205('0x2b')](_0x45c7d5);};}exports[_0x7205('0x2c')]=function(_0x197d4b,_0x3f967e){var _0x37bf85={},_0x4b2c47={},_0x51a784={'count':0x0,'rows':[]};var _0x1f9fff=_[_0x7205('0x2d')](db[_0x7205('0x2e')][_0x7205('0x2f')],function(_0x14420c){return{'name':_0x14420c[_0x7205('0x30')],'type':_0x14420c['type'][_0x7205('0x31')]};});_0x4b2c47[_0x7205('0x32')]=_[_0x7205('0x2d')](_0x1f9fff,_0x7205('0x2a'));_0x4b2c47[_0x7205('0x33')]=_['keys'](_0x197d4b['query']);_0x4b2c47[_0x7205('0x34')]=_[_0x7205('0x35')](_0x4b2c47[_0x7205('0x32')],_0x4b2c47[_0x7205('0x33')]);_0x37bf85['attributes']=_[_0x7205('0x35')](_0x4b2c47[_0x7205('0x32')],qs[_0x7205('0x36')](_0x197d4b[_0x7205('0x33')][_0x7205('0x36')]));_0x37bf85['attributes']=_0x37bf85[_0x7205('0x37')][_0x7205('0x38')]?_0x37bf85[_0x7205('0x37')]:_0x4b2c47[_0x7205('0x32')];if(!_0x197d4b['query']['hasOwnProperty'](_0x7205('0x39'))){_0x37bf85[_0x7205('0x20')]=qs[_0x7205('0x20')](_0x197d4b[_0x7205('0x33')]['limit']);_0x37bf85[_0x7205('0x1e')]=qs[_0x7205('0x1e')](_0x197d4b['query'][_0x7205('0x1e')]);}_0x37bf85[_0x7205('0x3a')]=qs[_0x7205('0x3b')](_0x197d4b[_0x7205('0x33')][_0x7205('0x3b')]);_0x37bf85[_0x7205('0x3c')]=qs['filters'](_[_0x7205('0x3d')](_0x197d4b[_0x7205('0x33')],_0x4b2c47[_0x7205('0x34')]),_0x1f9fff);if(_0x197d4b[_0x7205('0x33')][_0x7205('0x3e')]){_0x37bf85[_0x7205('0x3c')]=_[_0x7205('0x3f')](_0x37bf85[_0x7205('0x3c')],{'$or':_['map'](_0x1f9fff,function(_0x3521e7){if(_0x3521e7[_0x7205('0x40')]!==_0x7205('0x41')){var _0x3bae15={};_0x3bae15[_0x3521e7[_0x7205('0x2a')]]={'$like':'%'+_0x197d4b[_0x7205('0x33')]['filter']+'%'};return _0x3bae15;}})});}_0x37bf85=_['merge']({},_0x37bf85,_0x197d4b[_0x7205('0x42')]);var _0x35d0f0={'where':_0x37bf85[_0x7205('0x3c')]};return db[_0x7205('0x2e')][_0x7205('0x21')](_0x35d0f0)[_0x7205('0x26')](function(_0x1dc5ed){_0x51a784[_0x7205('0x21')]=_0x1dc5ed;if(_0x197d4b[_0x7205('0x33')][_0x7205('0x43')]){_0x37bf85[_0x7205('0x44')]=[{'all':!![]}];}return db[_0x7205('0x2e')][_0x7205('0x45')](_0x37bf85);})['then'](function(_0x42f7bb){_0x51a784['rows']=_0x42f7bb;return _0x51a784;})[_0x7205('0x26')](respondWithFilteredResult(_0x3f967e,_0x37bf85))[_0x7205('0x46')](handleError(_0x3f967e,null));};exports[_0x7205('0x47')]=function(_0x1ce773,_0x93d526){var _0xef78c4={'raw':!![],'where':{'id':_0x1ce773[_0x7205('0x48')]['id']}},_0x307f0d={};_0x307f0d[_0x7205('0x32')]=_[_0x7205('0x49')](db[_0x7205('0x2e')][_0x7205('0x2f')]);_0x307f0d[_0x7205('0x33')]=_[_0x7205('0x49')](_0x1ce773[_0x7205('0x33')]);_0x307f0d[_0x7205('0x34')]=_[_0x7205('0x35')](_0x307f0d[_0x7205('0x32')],_0x307f0d[_0x7205('0x33')]);_0xef78c4[_0x7205('0x37')]=_[_0x7205('0x35')](_0x307f0d['model'],qs[_0x7205('0x36')](_0x1ce773[_0x7205('0x33')][_0x7205('0x36')]));_0xef78c4['attributes']=_0xef78c4[_0x7205('0x37')]['length']?_0xef78c4[_0x7205('0x37')]:_0x307f0d['model'];if(_0x1ce773[_0x7205('0x33')][_0x7205('0x43')]){_0xef78c4[_0x7205('0x44')]=[{'all':!![]}];}_0xef78c4=_[_0x7205('0x3f')]({},_0xef78c4,_0x1ce773['options']);return db[_0x7205('0x2e')][_0x7205('0x4a')](_0xef78c4)[_0x7205('0x26')](handleEntityNotFound(_0x93d526,null))[_0x7205('0x26')](respondWithResult(_0x93d526,null))[_0x7205('0x46')](handleError(_0x93d526,null));};exports['create']=function(_0x2aa4f9,_0x3fbcad){return db[_0x7205('0x2e')][_0x7205('0x4b')](_0x2aa4f9[_0x7205('0x4c')],{})[_0x7205('0x26')](respondWithResult(_0x3fbcad,0xc9))[_0x7205('0x46')](handleError(_0x3fbcad,null));};exports['update']=function(_0x2cd6de,_0x539ccd){if(_0x2cd6de[_0x7205('0x4c')]['id']){delete _0x2cd6de[_0x7205('0x4c')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x2cd6de[_0x7205('0x48')]['id']}})[_0x7205('0x26')](handleEntityNotFound(_0x539ccd,null))['then'](saveUpdates(_0x2cd6de[_0x7205('0x4c')],null))[_0x7205('0x26')](respondWithResult(_0x539ccd,null))[_0x7205('0x46')](handleError(_0x539ccd,null));};exports['destroy']=function(_0x356185,_0x1d17a5){return db['OpenchannelQueueReport'][_0x7205('0x4a')]({'where':{'id':_0x356185['params']['id']}})[_0x7205('0x26')](handleEntityNotFound(_0x1d17a5,null))['then'](removeEntity(_0x1d17a5,null))[_0x7205('0x46')](handleError(_0x1d17a5,null));};exports[_0x7205('0x4d')]=function(_0x11f6b8,_0x35129a){return db[_0x7205('0x2e')][_0x7205('0x4d')]()['then'](respondWithResult(_0x35129a,null))['catch'](handleError(_0x35129a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3308a2a..efccedd 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x814b,0x1a2));var _0xb814=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x814b[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x814b,0x1a2));var _0xb814=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0x814b[_0x40a77f];return _0x415aa1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index aeec14b..1593af0 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 _0x26f9=['rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','options','CreateOpenchannelQueueReport','update','body','where','attributes','UpdateOpenchannelQueueReport','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x288fdf,_0x13b4c5){var _0x177996=function(_0xf00331){while(--_0xf00331){_0x288fdf['push'](_0x288fdf['shift']());}};_0x177996(++_0x13b4c5);}(_0x26f9,0x16f));var _0x926f=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x26f9[_0x55257d];return _0x4d296d;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var moment=require('moment');var BPromise=require(_0x926f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926f('0x3'))['db'];var utils=require(_0x926f('0x4'));var logger=require('../../config/logger')(_0x926f('0x5'));var config=require(_0x926f('0x6'));var jayson=require(_0x926f('0x7'));var client=jayson[_0x926f('0x8')][_0x926f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d2ded,_0xf56fcb,_0x1e455d){return new BPromise(function(_0x41a7ed,_0x2af11e){return client['request'](_0x3d2ded,_0x1e455d)[_0x926f('0xa')](function(_0x593c13){logger[_0x926f('0xb')](_0x926f('0xc'),_0xf56fcb,'request\x20sent');logger[_0x926f('0xd')](_0x926f('0xe'),_0xf56fcb,_0x926f('0xf'),JSON[_0x926f('0x10')](_0x593c13));if(_0x593c13[_0x926f('0x11')]){if(_0x593c13['error'][_0x926f('0x12')]===0x1f4){logger[_0x926f('0x11')](_0x926f('0xc'),_0xf56fcb,_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);return _0x2af11e(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x593c13['error'][_0x926f('0x13')]);return _0x41a7ed(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}else{logger[_0x926f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x926f('0xf'));_0x41a7ed(_0x593c13[_0x926f('0x14')]['message']);}})[_0x926f('0x15')](function(_0x52865b){logger[_0x926f('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x52865b);_0x2af11e(_0x52865b);});});}exports['CreateOpenchannelQueueReport']=function(_0x36ead3){var _0xab29b3=this;return new Promise(function(_0x4f25e3,_0x3ed07d){return db[_0x926f('0x16')][_0x926f('0x17')](_0x36ead3['body'],{'raw':_0x36ead3[_0x926f('0x18')]?_0x36ead3[_0x926f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x926f('0xa')](function(_0x4241ac){logger['info'](_0x926f('0x19'),_0x36ead3);logger[_0x926f('0xd')](_0x926f('0x19'),_0x36ead3,JSON[_0x926f('0x10')](_0x4241ac));_0x4f25e3(_0x4241ac);})[_0x926f('0x15')](function(_0x3b7179){logger[_0x926f('0x11')](_0x926f('0x19'),_0x3b7179[_0x926f('0x13')],_0x36ead3);_0x3ed07d(_0xab29b3[_0x926f('0x11')](0x1f4,_0x3b7179[_0x926f('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2d76eb){var _0x151f71=this;return new Promise(function(_0x53f10c,_0x640fe0){return db[_0x926f('0x16')][_0x926f('0x1a')](_0x2d76eb[_0x926f('0x1b')],{'raw':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb[_0x926f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb['options'][_0x926f('0x1c')]||null:null,'attributes':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb[_0x926f('0x18')][_0x926f('0x1d')]||null:null,'limit':_0x2d76eb['options']?_0x2d76eb[_0x926f('0x18')]['limit']||null:null})[_0x926f('0xa')](function(_0x2556ce){logger['info']('UpdateOpenchannelQueueReport',_0x2d76eb);logger[_0x926f('0xd')](_0x926f('0x1e'),_0x2d76eb,JSON['stringify'](_0x2556ce));_0x53f10c(_0x2556ce);})[_0x926f('0x15')](function(_0xb6b509){logger['error']('UpdateOpenchannelQueueReport',_0xb6b509[_0x926f('0x13')],_0x2d76eb);_0x640fe0(_0x151f71[_0x926f('0x11')](0x1f4,_0xb6b509[_0x926f('0x13')]));});});}; \ No newline at end of file +var _0x49db=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','lodash'];(function(_0x309ee3,_0x26c85f){var _0x2268e0=function(_0x330f5c){while(--_0x330f5c){_0x309ee3['push'](_0x309ee3['shift']());}};_0x2268e0(++_0x26c85f);}(_0x49db,0xc5));var _0xb49d=function(_0x396e72,_0x789bc0){_0x396e72=_0x396e72-0x0;var _0x4eb2b4=_0x49db[_0x396e72];return _0x4eb2b4;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var moment=require(_0xb49d('0x2'));var BPromise=require(_0xb49d('0x3'));var rs=require(_0xb49d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb49d('0x5'))['db'];var utils=require(_0xb49d('0x6'));var logger=require(_0xb49d('0x7'))('rpc');var config=require(_0xb49d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb49d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4180c8,_0x15f52f,_0x572ee4){return new BPromise(function(_0x12e114,_0x128caa){return client[_0xb49d('0xa')](_0x4180c8,_0x572ee4)[_0xb49d('0xb')](function(_0x3d4825){logger[_0xb49d('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x15f52f,'request\x20sent');logger[_0xb49d('0xd')](_0xb49d('0xe'),_0x15f52f,_0xb49d('0xf'),JSON[_0xb49d('0x10')](_0x3d4825));if(_0x3d4825[_0xb49d('0x11')]){if(_0x3d4825[_0xb49d('0x11')][_0xb49d('0x12')]===0x1f4){logger[_0xb49d('0x11')](_0xb49d('0x13'),_0x15f52f,_0x3d4825['error'][_0xb49d('0x14')]);return _0x128caa(_0x3d4825[_0xb49d('0x11')][_0xb49d('0x14')]);}logger[_0xb49d('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x15f52f,_0x3d4825[_0xb49d('0x11')][_0xb49d('0x14')]);return _0x12e114(_0x3d4825['error'][_0xb49d('0x14')]);}else{logger[_0xb49d('0xc')](_0xb49d('0x13'),_0x15f52f,_0xb49d('0xf'));_0x12e114(_0x3d4825[_0xb49d('0x15')][_0xb49d('0x14')]);}})[_0xb49d('0x16')](function(_0x584ade){logger[_0xb49d('0x11')](_0xb49d('0x13'),_0x15f52f,_0x584ade);_0x128caa(_0x584ade);});});}exports[_0xb49d('0x17')]=function(_0xf0bdff){var _0x4abce4=this;return new Promise(function(_0x4f3988,_0xfd7a95){return db[_0xb49d('0x18')][_0xb49d('0x19')](_0xf0bdff[_0xb49d('0x1a')],{'raw':_0xf0bdff[_0xb49d('0x1b')]?_0xf0bdff['options'][_0xb49d('0x1c')]===undefined?!![]:![]:!![]})[_0xb49d('0xb')](function(_0x3bf7a2){logger[_0xb49d('0xc')](_0xb49d('0x17'),_0xf0bdff);logger[_0xb49d('0xd')](_0xb49d('0x17'),_0xf0bdff,JSON[_0xb49d('0x10')](_0x3bf7a2));_0x4f3988(_0x3bf7a2);})[_0xb49d('0x16')](function(_0x38be04){logger[_0xb49d('0x11')](_0xb49d('0x17'),_0x38be04[_0xb49d('0x14')],_0xf0bdff);_0xfd7a95(_0x4abce4[_0xb49d('0x11')](0x1f4,_0x38be04[_0xb49d('0x14')]));});});};exports[_0xb49d('0x1d')]=function(_0x26db55){var _0x21c0e1=this;return new Promise(function(_0x165ec2,_0x1ae086){return db[_0xb49d('0x18')][_0xb49d('0x1e')](_0x26db55['body'],{'raw':_0x26db55[_0xb49d('0x1b')]?_0x26db55['options'][_0xb49d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26db55[_0xb49d('0x1b')]?_0x26db55['options'][_0xb49d('0x1f')]||null:null,'attributes':_0x26db55[_0xb49d('0x1b')]?_0x26db55[_0xb49d('0x1b')][_0xb49d('0x20')]||null:null,'limit':_0x26db55[_0xb49d('0x1b')]?_0x26db55[_0xb49d('0x1b')]['limit']||null:null})[_0xb49d('0xb')](function(_0xf734e1){logger[_0xb49d('0xc')](_0xb49d('0x1d'),_0x26db55);logger[_0xb49d('0xd')](_0xb49d('0x1d'),_0x26db55,JSON[_0xb49d('0x10')](_0xf734e1));_0x165ec2(_0xf734e1);})['catch'](function(_0x3f1796){logger['error'](_0xb49d('0x1d'),_0x3f1796[_0xb49d('0x14')],_0x26db55);_0x1ae086(_0x21c0e1[_0xb49d('0x11')](0x1f4,_0x3f1796[_0xb49d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 3ae0e22..dfa2366 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 _0xa000=['../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x23f49a,_0xf5538e){var _0x3934e1=function(_0x48b1ae){while(--_0x48b1ae){_0x23f49a['push'](_0x23f49a['shift']());}};_0x3934e1(++_0xf5538e);}(_0xa000,0x14b));var _0x0a00=function(_0x35638f,_0xfaf9d9){_0x35638f=_0x35638f-0x0;var _0x666e37=_0xa000[_0x35638f];return _0x666e37;};'use strict';var multer=require(_0x0a00('0x0'));var util=require(_0x0a00('0x1'));var path=require(_0x0a00('0x2'));var timeout=require(_0x0a00('0x3'));var express=require(_0x0a00('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0a00('0x5'));var interaction=require(_0x0a00('0x6'));var config=require('../../config/environment');var controller=require(_0x0a00('0x7'));router[_0x0a00('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a00('0x9')]);router[_0x0a00('0x8')](_0x0a00('0xa'),auth[_0x0a00('0xb')](),controller[_0x0a00('0xc')]);router[_0x0a00('0x8')](_0x0a00('0xd'),auth[_0x0a00('0xb')](),controller[_0x0a00('0xe')]);router[_0x0a00('0xf')]('/',auth[_0x0a00('0xb')](),controller[_0x0a00('0x10')]);router[_0x0a00('0x11')](_0x0a00('0xd'),auth[_0x0a00('0xb')](),controller['update']);router[_0x0a00('0x12')](_0x0a00('0xd'),auth[_0x0a00('0xb')](),controller[_0x0a00('0x13')]);module[_0x0a00('0x14')]=router; \ No newline at end of file +var _0x2ec2=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2ec2,0x133));var _0x22ec=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x2ec2[_0x23c6f2];return _0x4c270b;};'use strict';var multer=require(_0x22ec('0x0'));var util=require(_0x22ec('0x1'));var path=require(_0x22ec('0x2'));var timeout=require(_0x22ec('0x3'));var express=require(_0x22ec('0x4'));var router=express[_0x22ec('0x5')]();var fs_extra=require(_0x22ec('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22ec('0x7'));var controller=require(_0x22ec('0x8'));router['get']('/',auth[_0x22ec('0x9')](),controller[_0x22ec('0xa')]);router[_0x22ec('0xb')](_0x22ec('0xc'),auth['isAuthenticated'](),controller[_0x22ec('0xd')]);router[_0x22ec('0xb')](_0x22ec('0xe'),auth['isAuthenticated'](),controller[_0x22ec('0xf')]);router[_0x22ec('0x10')]('/',auth[_0x22ec('0x9')](),controller[_0x22ec('0x11')]);router[_0x22ec('0x12')](_0x22ec('0xe'),auth['isAuthenticated'](),controller[_0x22ec('0x13')]);router[_0x22ec('0x14')]('/:id',auth[_0x22ec('0x9')](),controller[_0x22ec('0x15')]);module[_0x22ec('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index af7d39e..71dd8fb 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2b73b9,_0x28364e){var _0x11463d=function(_0x3ccf29){while(--_0x3ccf29){_0x2b73b9['push'](_0x2b73b9['shift']());}};_0x11463d(++_0x28364e);}(_0xedd9,0xfc));var _0x9edd=function(_0x340e5f,_0x5b5642){_0x340e5f=_0x340e5f-0x0;var _0x40974c=_0xedd9[_0x340e5f];return _0x40974c;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4e59fd,_0x3e34f8){_0x4e59fd=_0x4e59fd-0x0;var _0x4cabd0=_0x9bde[_0x4e59fd];return _0x4cabd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 995d22b..ee060b3 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 _0xb497=['params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','merge','find','create','body','update'];(function(_0x4b66c0,_0x13a216){var _0x270e8a=function(_0xb7df0d){while(--_0xb7df0d){_0x4b66c0['push'](_0x4b66c0['shift']());}};_0x270e8a(++_0x13a216);}(_0xb497,0x12a));var _0x7b49=function(_0x5c2c21,_0x240b0a){_0x5c2c21=_0x5c2c21-0x0;var _0x49a0b1=_0xb497[_0x5c2c21];return _0x49a0b1;};'use strict';var emlformat=require(_0x7b49('0x0'));var rimraf=require(_0x7b49('0x1'));var zipdir=require(_0x7b49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b49('0x3'));var moment=require(_0x7b49('0x4'));var BPromise=require(_0x7b49('0x5'));var Mustache=require(_0x7b49('0x6'));var util=require(_0x7b49('0x7'));var path=require(_0x7b49('0x8'));var sox=require(_0x7b49('0x9'));var csv=require(_0x7b49('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b49('0xb'));var _=require(_0x7b49('0xc'));var squel=require(_0x7b49('0xd'));var crypto=require(_0x7b49('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7b49('0xf'));var toCsv=require(_0x7b49('0xa'));var querystring=require(_0x7b49('0x10'));var Papa=require(_0x7b49('0x11'));var Redis=require(_0x7b49('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7b49('0x13'));var as=require(_0x7b49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b49('0x15'))(_0x7b49('0x16'));var utils=require(_0x7b49('0x17'));var config=require(_0x7b49('0x18'));var licenseUtil=require(_0x7b49('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194cc9,_0x1a2aa4){_0x1a2aa4=_0x1a2aa4||0xcc;return function(_0x39cfe8){if(_0x39cfe8){return _0x194cc9[_0x7b49('0x1a')](_0x1a2aa4);}return _0x194cc9[_0x7b49('0x1b')](_0x1a2aa4)[_0x7b49('0x1c')]();};}function respondWithResult(_0x10f475,_0x2e13e2){_0x2e13e2=_0x2e13e2||0xc8;return function(_0x471e12){if(_0x471e12){return _0x10f475[_0x7b49('0x1b')](_0x2e13e2)[_0x7b49('0x1d')](_0x471e12);}};}function respondWithFilteredResult(_0x4199c4,_0x54edeb){return function(_0x219272){if(_0x219272){var _0x53b928=typeof _0x54edeb[_0x7b49('0x1e')]===_0x7b49('0x1f')&&typeof _0x54edeb[_0x7b49('0x20')]==='undefined';var _0x2b395b=_0x219272[_0x7b49('0x21')];var _0x53a101=_0x53b928?0x0:_0x54edeb[_0x7b49('0x1e')];var _0x31b5c1=_0x53b928?_0x219272[_0x7b49('0x21')]:_0x54edeb[_0x7b49('0x1e')]+_0x54edeb[_0x7b49('0x20')];var _0x1c43e4;if(_0x31b5c1>=_0x2b395b){_0x31b5c1=_0x2b395b;_0x1c43e4=0xc8;}else{_0x1c43e4=0xce;}_0x4199c4['status'](_0x1c43e4);return _0x4199c4[_0x7b49('0x22')]('Content-Range',_0x53a101+'-'+_0x31b5c1+'/'+_0x2b395b)['json'](_0x219272);}return null;};}function patchUpdates(_0x381598){return function(_0x17e389){try{jsonpatch['apply'](_0x17e389,_0x381598,!![]);}catch(_0x17c870){return BPromise[_0x7b49('0x23')](_0x17c870);}return _0x17e389['save']();};}function saveUpdates(_0x2ae0f7,_0x25f1a5){return function(_0x202630){if(_0x202630){return _0x202630['update'](_0x2ae0f7)['then'](function(_0x365219){return _0x365219;});}return null;};}function removeEntity(_0x1d349d,_0x504cc3){return function(_0xbdf6e4){if(_0xbdf6e4){return _0xbdf6e4[_0x7b49('0x24')]()[_0x7b49('0x25')](function(){_0x1d349d[_0x7b49('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7787b8,_0x888eed){return function(_0x5d0722){if(!_0x5d0722){_0x7787b8[_0x7b49('0x1a')](0x194);}return _0x5d0722;};}function handleError(_0x114e0c,_0x572c2c){_0x572c2c=_0x572c2c||0x1f4;return function(_0x3dab0d){logger[_0x7b49('0x26')](_0x3dab0d[_0x7b49('0x27')]);if(_0x3dab0d[_0x7b49('0x28')]){delete _0x3dab0d[_0x7b49('0x28')];}_0x114e0c[_0x7b49('0x1b')](_0x572c2c)[_0x7b49('0x29')](_0x3dab0d);};}exports[_0x7b49('0x2a')]=function(_0x3ce062,_0x3a94ab){var _0x57d6b={},_0x3fc7e1={},_0x1367ca={'count':0x0,'rows':[]};var _0x1c3660=_[_0x7b49('0x2b')](db[_0x7b49('0x2c')][_0x7b49('0x2d')],function(_0x587773){return{'name':_0x587773['fieldName'],'type':_0x587773['type']['key']};});_0x3fc7e1['model']=_[_0x7b49('0x2b')](_0x1c3660,_0x7b49('0x28'));_0x3fc7e1[_0x7b49('0x2e')]=_['keys'](_0x3ce062[_0x7b49('0x2e')]);_0x3fc7e1['filters']=_[_0x7b49('0x2f')](_0x3fc7e1['model'],_0x3fc7e1['query']);_0x57d6b['attributes']=_['intersection'](_0x3fc7e1[_0x7b49('0x30')],qs[_0x7b49('0x31')](_0x3ce062['query'][_0x7b49('0x31')]));_0x57d6b[_0x7b49('0x32')]=_0x57d6b[_0x7b49('0x32')][_0x7b49('0x33')]?_0x57d6b[_0x7b49('0x32')]:_0x3fc7e1[_0x7b49('0x30')];if(!_0x3ce062['query'][_0x7b49('0x34')](_0x7b49('0x35'))){_0x57d6b[_0x7b49('0x20')]=qs['limit'](_0x3ce062['query'][_0x7b49('0x20')]);_0x57d6b[_0x7b49('0x1e')]=qs['offset'](_0x3ce062[_0x7b49('0x2e')][_0x7b49('0x1e')]);}_0x57d6b['order']=qs['sort'](_0x3ce062['query'][_0x7b49('0x36')]);_0x57d6b[_0x7b49('0x37')]=qs[_0x7b49('0x38')](_[_0x7b49('0x39')](_0x3ce062['query'],_0x3fc7e1[_0x7b49('0x38')]),_0x1c3660);if(_0x3ce062[_0x7b49('0x2e')]['filter']){_0x57d6b[_0x7b49('0x37')]=_['merge'](_0x57d6b[_0x7b49('0x37')],{'$or':_[_0x7b49('0x2b')](_0x1c3660,function(_0x4ff14d){if(_0x4ff14d['type']!==_0x7b49('0x3a')){var _0x425083={};_0x425083[_0x4ff14d[_0x7b49('0x28')]]={'$like':'%'+_0x3ce062[_0x7b49('0x2e')][_0x7b49('0x3b')]+'%'};return _0x425083;}})});}_0x57d6b=_['merge']({},_0x57d6b,_0x3ce062[_0x7b49('0x3c')]);var _0xcac96d={'where':_0x57d6b[_0x7b49('0x37')]};return db[_0x7b49('0x2c')]['count'](_0xcac96d)['then'](function(_0x4ee49a){_0x1367ca[_0x7b49('0x21')]=_0x4ee49a;if(_0x3ce062['query'][_0x7b49('0x3d')]){_0x57d6b[_0x7b49('0x3e')]=[{'all':!![]}];}return db[_0x7b49('0x2c')][_0x7b49('0x3f')](_0x57d6b);})['then'](function(_0x1c47ab){_0x1367ca['rows']=_0x1c47ab;return _0x1367ca;})['then'](respondWithFilteredResult(_0x3a94ab,_0x57d6b))[_0x7b49('0x40')](handleError(_0x3a94ab,null));};exports[_0x7b49('0x41')]=function(_0x112af9,_0x1b902c){var _0x34a8cb={'raw':!![],'where':{'id':_0x112af9['params']['id']}},_0x5926ed={};_0x5926ed[_0x7b49('0x30')]=_[_0x7b49('0x42')](db[_0x7b49('0x2c')][_0x7b49('0x2d')]);_0x5926ed['query']=_[_0x7b49('0x42')](_0x112af9[_0x7b49('0x2e')]);_0x5926ed[_0x7b49('0x38')]=_['intersection'](_0x5926ed[_0x7b49('0x30')],_0x5926ed['query']);_0x34a8cb[_0x7b49('0x32')]=_['intersection'](_0x5926ed[_0x7b49('0x30')],qs[_0x7b49('0x31')](_0x112af9[_0x7b49('0x2e')][_0x7b49('0x31')]));_0x34a8cb[_0x7b49('0x32')]=_0x34a8cb[_0x7b49('0x32')][_0x7b49('0x33')]?_0x34a8cb[_0x7b49('0x32')]:_0x5926ed[_0x7b49('0x30')];if(_0x112af9[_0x7b49('0x2e')][_0x7b49('0x3d')]){_0x34a8cb[_0x7b49('0x3e')]=[{'all':!![]}];}_0x34a8cb=_[_0x7b49('0x43')]({},_0x34a8cb,_0x112af9[_0x7b49('0x3c')]);return db[_0x7b49('0x2c')][_0x7b49('0x44')](_0x34a8cb)[_0x7b49('0x25')](handleEntityNotFound(_0x1b902c,null))[_0x7b49('0x25')](respondWithResult(_0x1b902c,null))[_0x7b49('0x40')](handleError(_0x1b902c,null));};exports[_0x7b49('0x45')]=function(_0x5670dd,_0x38c6ee){return db[_0x7b49('0x2c')][_0x7b49('0x45')](_0x5670dd[_0x7b49('0x46')],{})[_0x7b49('0x25')](respondWithResult(_0x38c6ee,0xc9))[_0x7b49('0x40')](handleError(_0x38c6ee,null));};exports[_0x7b49('0x47')]=function(_0x2441de,_0x44be91){if(_0x2441de[_0x7b49('0x46')]['id']){delete _0x2441de[_0x7b49('0x46')]['id'];}return db[_0x7b49('0x2c')]['find']({'where':{'id':_0x2441de[_0x7b49('0x48')]['id']}})[_0x7b49('0x25')](handleEntityNotFound(_0x44be91,null))['then'](saveUpdates(_0x2441de[_0x7b49('0x46')],null))[_0x7b49('0x25')](respondWithResult(_0x44be91,null))['catch'](handleError(_0x44be91,null));};exports[_0x7b49('0x24')]=function(_0x2421d3,_0x232b28){return db[_0x7b49('0x2c')]['find']({'where':{'id':_0x2421d3['params']['id']}})['then'](handleEntityNotFound(_0x232b28,null))[_0x7b49('0x25')](removeEntity(_0x232b28,null))[_0x7b49('0x40')](handleError(_0x232b28,null));};exports[_0x7b49('0x49')]=function(_0x6bc6e2,_0x2aac3b){return db[_0x7b49('0x2c')][_0x7b49('0x49')]()['then'](respondWithResult(_0x2aac3b,null))['catch'](handleError(_0x2aac3b,null));}; \ No newline at end of file +var _0xadd1=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','fs-extra','crypto','jsforce','desk.js','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','apply','reject','save','update','then','destroy','end','error','name','send','index','map','OpenchannelTransferReport','rawAttributes'];(function(_0xc80186,_0x1dcc98){var _0x37e8d6=function(_0x2d387f){while(--_0x2d387f){_0xc80186['push'](_0xc80186['shift']());}};_0x37e8d6(++_0x1dcc98);}(_0xadd1,0x1ce));var _0x1add=function(_0x84c9ac,_0x1b5a7d){_0x84c9ac=_0x84c9ac-0x0;var _0x1001d5=_0xadd1[_0x84c9ac];return _0x1001d5;};'use strict';var emlformat=require(_0x1add('0x0'));var rimraf=require(_0x1add('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1add('0x2'));var rp=require(_0x1add('0x3'));var moment=require(_0x1add('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1add('0x5'));var util=require(_0x1add('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(_0x1add('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1add('0x8'));var jsforce=require(_0x1add('0x9'));var deskjs=require(_0x1add('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1add('0xb'));var Papa=require(_0x1add('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1add('0xd'));var as=require(_0x1add('0xe'));var hardwareService=require(_0x1add('0xf'));var logger=require(_0x1add('0x10'))(_0x1add('0x11'));var utils=require(_0x1add('0x12'));var config=require(_0x1add('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6b41eb,_0x50c091){_0x50c091=_0x50c091||0xcc;return function(_0x29c5ae){if(_0x29c5ae){return _0x6b41eb[_0x1add('0x14')](_0x50c091);}return _0x6b41eb['status'](_0x50c091)['end']();};}function respondWithResult(_0x34af55,_0x32a8b6){_0x32a8b6=_0x32a8b6||0xc8;return function(_0x38eba9){if(_0x38eba9){return _0x34af55[_0x1add('0x15')](_0x32a8b6)[_0x1add('0x16')](_0x38eba9);}};}function respondWithFilteredResult(_0x53fb61,_0x43bfd8){return function(_0x152c3e){if(_0x152c3e){var _0x591524=typeof _0x43bfd8[_0x1add('0x17')]===_0x1add('0x18')&&typeof _0x43bfd8[_0x1add('0x19')]===_0x1add('0x18');var _0x33f851=_0x152c3e[_0x1add('0x1a')];var _0x58a131=_0x591524?0x0:_0x43bfd8[_0x1add('0x17')];var _0x7a8666=_0x591524?_0x152c3e[_0x1add('0x1a')]:_0x43bfd8['offset']+_0x43bfd8[_0x1add('0x19')];var _0x2ecd83;if(_0x7a8666>=_0x33f851){_0x7a8666=_0x33f851;_0x2ecd83=0xc8;}else{_0x2ecd83=0xce;}_0x53fb61[_0x1add('0x15')](_0x2ecd83);return _0x53fb61[_0x1add('0x1b')]('Content-Range',_0x58a131+'-'+_0x7a8666+'/'+_0x33f851)[_0x1add('0x16')](_0x152c3e);}return null;};}function patchUpdates(_0x2c74fa){return function(_0x59777b){try{jsonpatch[_0x1add('0x1c')](_0x59777b,_0x2c74fa,!![]);}catch(_0x2ebb6a){return BPromise[_0x1add('0x1d')](_0x2ebb6a);}return _0x59777b[_0x1add('0x1e')]();};}function saveUpdates(_0x4e3269,_0x2d7beb){return function(_0x2f485f){if(_0x2f485f){return _0x2f485f[_0x1add('0x1f')](_0x4e3269)[_0x1add('0x20')](function(_0xc0bb89){return _0xc0bb89;});}return null;};}function removeEntity(_0x1b268f,_0x137cc3){return function(_0x1ebe89){if(_0x1ebe89){return _0x1ebe89[_0x1add('0x21')]()['then'](function(){_0x1b268f[_0x1add('0x15')](0xcc)[_0x1add('0x22')]();});}};}function handleEntityNotFound(_0x5aeded,_0x3b4109){return function(_0x4758d2){if(!_0x4758d2){_0x5aeded['sendStatus'](0x194);}return _0x4758d2;};}function handleError(_0xf3d5d0,_0x2c32de){_0x2c32de=_0x2c32de||0x1f4;return function(_0x395860){logger[_0x1add('0x23')](_0x395860['stack']);if(_0x395860[_0x1add('0x24')]){delete _0x395860[_0x1add('0x24')];}_0xf3d5d0[_0x1add('0x15')](_0x2c32de)[_0x1add('0x25')](_0x395860);};}exports[_0x1add('0x26')]=function(_0x5b26ee,_0x1b23b2){var _0x28eb2a={},_0x6249ad={},_0x59f705={'count':0x0,'rows':[]};var _0x41d177=_[_0x1add('0x27')](db[_0x1add('0x28')][_0x1add('0x29')],function(_0x31be8a){return{'name':_0x31be8a[_0x1add('0x2a')],'type':_0x31be8a[_0x1add('0x2b')][_0x1add('0x2c')]};});_0x6249ad[_0x1add('0x2d')]=_[_0x1add('0x27')](_0x41d177,_0x1add('0x24'));_0x6249ad[_0x1add('0x2e')]=_[_0x1add('0x2f')](_0x5b26ee[_0x1add('0x2e')]);_0x6249ad[_0x1add('0x30')]=_[_0x1add('0x31')](_0x6249ad[_0x1add('0x2d')],_0x6249ad[_0x1add('0x2e')]);_0x28eb2a[_0x1add('0x32')]=_[_0x1add('0x31')](_0x6249ad[_0x1add('0x2d')],qs[_0x1add('0x33')](_0x5b26ee['query']['fields']));_0x28eb2a[_0x1add('0x32')]=_0x28eb2a[_0x1add('0x32')][_0x1add('0x34')]?_0x28eb2a[_0x1add('0x32')]:_0x6249ad[_0x1add('0x2d')];if(!_0x5b26ee[_0x1add('0x2e')][_0x1add('0x35')](_0x1add('0x36'))){_0x28eb2a[_0x1add('0x19')]=qs[_0x1add('0x19')](_0x5b26ee[_0x1add('0x2e')][_0x1add('0x19')]);_0x28eb2a[_0x1add('0x17')]=qs[_0x1add('0x17')](_0x5b26ee[_0x1add('0x2e')]['offset']);}_0x28eb2a[_0x1add('0x37')]=qs[_0x1add('0x38')](_0x5b26ee[_0x1add('0x2e')][_0x1add('0x38')]);_0x28eb2a[_0x1add('0x39')]=qs[_0x1add('0x30')](_[_0x1add('0x3a')](_0x5b26ee[_0x1add('0x2e')],_0x6249ad['filters']),_0x41d177);if(_0x5b26ee[_0x1add('0x2e')]['filter']){_0x28eb2a[_0x1add('0x39')]=_['merge'](_0x28eb2a[_0x1add('0x39')],{'$or':_[_0x1add('0x27')](_0x41d177,function(_0x5dd159){if(_0x5dd159[_0x1add('0x2b')]!==_0x1add('0x3b')){var _0x2ae80e={};_0x2ae80e[_0x5dd159[_0x1add('0x24')]]={'$like':'%'+_0x5b26ee['query'][_0x1add('0x3c')]+'%'};return _0x2ae80e;}})});}_0x28eb2a=_[_0x1add('0x3d')]({},_0x28eb2a,_0x5b26ee['options']);var _0x2f29a6={'where':_0x28eb2a[_0x1add('0x39')]};return db[_0x1add('0x28')]['count'](_0x2f29a6)[_0x1add('0x20')](function(_0xa26bfc){_0x59f705[_0x1add('0x1a')]=_0xa26bfc;if(_0x5b26ee[_0x1add('0x2e')][_0x1add('0x3e')]){_0x28eb2a[_0x1add('0x3f')]=[{'all':!![]}];}return db[_0x1add('0x28')][_0x1add('0x40')](_0x28eb2a);})[_0x1add('0x20')](function(_0x466bba){_0x59f705['rows']=_0x466bba;return _0x59f705;})[_0x1add('0x20')](respondWithFilteredResult(_0x1b23b2,_0x28eb2a))[_0x1add('0x41')](handleError(_0x1b23b2,null));};exports[_0x1add('0x42')]=function(_0x27028c,_0x4d1bd6){var _0x2d40a8={'raw':!![],'where':{'id':_0x27028c['params']['id']}},_0x15271b={};_0x15271b['model']=_[_0x1add('0x2f')](db[_0x1add('0x28')][_0x1add('0x29')]);_0x15271b[_0x1add('0x2e')]=_['keys'](_0x27028c[_0x1add('0x2e')]);_0x15271b[_0x1add('0x30')]=_[_0x1add('0x31')](_0x15271b['model'],_0x15271b[_0x1add('0x2e')]);_0x2d40a8['attributes']=_[_0x1add('0x31')](_0x15271b[_0x1add('0x2d')],qs[_0x1add('0x33')](_0x27028c[_0x1add('0x2e')][_0x1add('0x33')]));_0x2d40a8[_0x1add('0x32')]=_0x2d40a8['attributes'][_0x1add('0x34')]?_0x2d40a8[_0x1add('0x32')]:_0x15271b[_0x1add('0x2d')];if(_0x27028c[_0x1add('0x2e')][_0x1add('0x3e')]){_0x2d40a8[_0x1add('0x3f')]=[{'all':!![]}];}_0x2d40a8=_[_0x1add('0x3d')]({},_0x2d40a8,_0x27028c['options']);return db[_0x1add('0x28')][_0x1add('0x43')](_0x2d40a8)['then'](handleEntityNotFound(_0x4d1bd6,null))['then'](respondWithResult(_0x4d1bd6,null))['catch'](handleError(_0x4d1bd6,null));};exports[_0x1add('0x44')]=function(_0x1b5ac7,_0x5d949c){return db[_0x1add('0x28')]['create'](_0x1b5ac7[_0x1add('0x45')],{})[_0x1add('0x20')](respondWithResult(_0x5d949c,0xc9))[_0x1add('0x41')](handleError(_0x5d949c,null));};exports[_0x1add('0x1f')]=function(_0x34f13d,_0x3ae1f2){if(_0x34f13d[_0x1add('0x45')]['id']){delete _0x34f13d['body']['id'];}return db[_0x1add('0x28')][_0x1add('0x43')]({'where':{'id':_0x34f13d['params']['id']}})['then'](handleEntityNotFound(_0x3ae1f2,null))[_0x1add('0x20')](saveUpdates(_0x34f13d[_0x1add('0x45')],null))['then'](respondWithResult(_0x3ae1f2,null))[_0x1add('0x41')](handleError(_0x3ae1f2,null));};exports[_0x1add('0x21')]=function(_0x2dbcd5,_0x37c105){return db[_0x1add('0x28')][_0x1add('0x43')]({'where':{'id':_0x2dbcd5[_0x1add('0x46')]['id']}})[_0x1add('0x20')](handleEntityNotFound(_0x37c105,null))[_0x1add('0x20')](removeEntity(_0x37c105,null))[_0x1add('0x41')](handleError(_0x37c105,null));};exports[_0x1add('0x47')]=function(_0x1afb02,_0x369942){return db[_0x1add('0x28')][_0x1add('0x47')]()[_0x1add('0x20')](respondWithResult(_0x369942,null))[_0x1add('0x41')](handleError(_0x369942,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 564bbb4..1c29069 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 _0xf705=['bluebird','request-promise','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1daf6d,_0x123588){var _0x269705=function(_0x19295b){while(--_0x19295b){_0x1daf6d['push'](_0x1daf6d['shift']());}};_0x269705(++_0x123588);}(_0xf705,0xcd));var _0x5f70=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf705[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x5f70('0x0'));var util=require('util');var logger=require(_0x5f70('0x1'))(_0x5f70('0x2'));var moment=require(_0x5f70('0x3'));var BPromise=require(_0x5f70('0x4'));var rp=require(_0x5f70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f70('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x5f70('0x7')]=function(_0x4052dc,_0x4557e5){return _0x4052dc[_0x5f70('0x8')](_0x5f70('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5f70('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0488=['exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x5bfea8,_0x234a6d){var _0x38009c=function(_0xea7171){while(--_0xea7171){_0x5bfea8['push'](_0x5bfea8['shift']());}};_0x38009c(++_0x234a6d);}(_0x0488,0x159));var _0x8048=function(_0x340c13,_0x595d66){_0x340c13=_0x340c13-0x0;var _0x5a7d96=_0x0488[_0x340c13];return _0x5a7d96;};'use strict';var _=require(_0x8048('0x0'));var util=require(_0x8048('0x1'));var logger=require(_0x8048('0x2'))('api');var moment=require(_0x8048('0x3'));var BPromise=require(_0x8048('0x4'));var rp=require(_0x8048('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8048('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8048('0x7')]=function(_0x54184b,_0x8cbbc3){return _0x54184b[_0x8048('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x8048('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8048('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7356a73..7002768 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 _0xea31=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0xbbc9a5,_0x336029){var _0x57fc50=function(_0x51f21b){while(--_0x51f21b){_0xbbc9a5['push'](_0xbbc9a5['shift']());}};_0x57fc50(++_0x336029);}(_0xea31,0x6b));var _0x1ea3=function(_0x5a5d90,_0x17105f){_0x5a5d90=_0x5a5d90-0x0;var _0x538185=_0xea31[_0x5a5d90];return _0x538185;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var moment=require(_0x1ea3('0x1'));var BPromise=require(_0x1ea3('0x2'));var rs=require(_0x1ea3('0x3'));var fs=require('fs');var Redis=require(_0x1ea3('0x4'));var db=require(_0x1ea3('0x5'))['db'];var utils=require(_0x1ea3('0x6'));var logger=require(_0x1ea3('0x7'))('rpc');var config=require(_0x1ea3('0x8'));var jayson=require(_0x1ea3('0x9'));var client=jayson[_0x1ea3('0xa')][_0x1ea3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13e6fb,_0x4c8f83,_0x1fa3a8){return new BPromise(function(_0x1b578e,_0x30a6db){return client[_0x1ea3('0xc')](_0x13e6fb,_0x1fa3a8)[_0x1ea3('0xd')](function(_0x2ff19a){logger['info'](_0x1ea3('0xe'),_0x4c8f83,_0x1ea3('0xf'));logger[_0x1ea3('0x10')](_0x1ea3('0x11'),_0x4c8f83,_0x1ea3('0xf'),JSON[_0x1ea3('0x12')](_0x2ff19a));if(_0x2ff19a[_0x1ea3('0x13')]){if(_0x2ff19a['error'][_0x1ea3('0x14')]===0x1f4){logger['error'](_0x1ea3('0xe'),_0x4c8f83,_0x2ff19a[_0x1ea3('0x13')][_0x1ea3('0x15')]);return _0x30a6db(_0x2ff19a['error'][_0x1ea3('0x15')]);}logger[_0x1ea3('0x13')](_0x1ea3('0xe'),_0x4c8f83,_0x2ff19a['error'][_0x1ea3('0x15')]);return _0x1b578e(_0x2ff19a[_0x1ea3('0x13')][_0x1ea3('0x15')]);}else{logger[_0x1ea3('0x16')](_0x1ea3('0xe'),_0x4c8f83,_0x1ea3('0xf'));_0x1b578e(_0x2ff19a[_0x1ea3('0x17')]['message']);}})[_0x1ea3('0x18')](function(_0x199728){logger[_0x1ea3('0x13')](_0x1ea3('0xe'),_0x4c8f83,_0x199728);_0x30a6db(_0x199728);});});} \ No newline at end of file +var _0x31c2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x31c2,0x1e1));var _0x231c=function(_0x1209b2,_0x29e710){_0x1209b2=_0x1209b2-0x0;var _0x530836=_0x31c2[_0x1209b2];return _0x530836;};'use strict';var _=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require(_0x231c('0x3'));var rs=require(_0x231c('0x4'));var fs=require('fs');var Redis=require(_0x231c('0x5'));var db=require(_0x231c('0x6'))['db'];var utils=require(_0x231c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x231c('0x8'));var jayson=require(_0x231c('0x9'));var client=jayson[_0x231c('0xa')][_0x231c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48bfb2,_0x111bf9,_0x49ff9e){return new BPromise(function(_0x439df8,_0x38b3b9){return client[_0x231c('0xc')](_0x48bfb2,_0x49ff9e)['then'](function(_0x2524bf){logger[_0x231c('0xd')](_0x231c('0xe'),_0x111bf9,_0x231c('0xf'));logger[_0x231c('0x10')](_0x231c('0x11'),_0x111bf9,_0x231c('0xf'),JSON['stringify'](_0x2524bf));if(_0x2524bf[_0x231c('0x12')]){if(_0x2524bf[_0x231c('0x12')]['code']===0x1f4){logger[_0x231c('0x12')](_0x231c('0xe'),_0x111bf9,_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);return _0x38b3b9(_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);}logger[_0x231c('0x12')](_0x231c('0xe'),_0x111bf9,_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);return _0x439df8(_0x2524bf[_0x231c('0x12')][_0x231c('0x13')]);}else{logger[_0x231c('0xd')](_0x231c('0xe'),_0x111bf9,_0x231c('0xf'));_0x439df8(_0x2524bf[_0x231c('0x14')][_0x231c('0x13')]);}})[_0x231c('0x15')](function(_0x1852e5){logger[_0x231c('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x111bf9,_0x1852e5);_0x38b3b9(_0x1852e5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3406c43..2064bed 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 _0x2fbf=['index','get','show','post','create','/:id','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','isAuthenticated'];(function(_0x1feeec,_0x3fd021){var _0x35edef=function(_0x5b5c6c){while(--_0x5b5c6c){_0x1feeec['push'](_0x1feeec['shift']());}};_0x35edef(++_0x3fd021);}(_0x2fbf,0xbc));var _0xf2fb=function(_0x398e76,_0x579389){_0x398e76=_0x398e76-0x0;var _0x2c6861=_0x2fbf[_0x398e76];return _0x2c6861;};'use strict';var multer=require(_0xf2fb('0x0'));var util=require(_0xf2fb('0x1'));var path=require(_0xf2fb('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2fb('0x3'));var router=express[_0xf2fb('0x4')]();var fs_extra=require(_0xf2fb('0x5'));var auth=require(_0xf2fb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf2fb('0x7'));var controller=require(_0xf2fb('0x8'));router['get']('/',auth[_0xf2fb('0x9')](),controller[_0xf2fb('0xa')]);router[_0xf2fb('0xb')]('/:id',auth[_0xf2fb('0x9')](),controller[_0xf2fb('0xc')]);router[_0xf2fb('0xd')]('/',auth[_0xf2fb('0x9')](),controller[_0xf2fb('0xe')]);router['put'](_0xf2fb('0xf'),auth[_0xf2fb('0x9')](),controller['update']);router[_0xf2fb('0x10')](_0xf2fb('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2fb('0x11')]=router; \ No newline at end of file +var _0x6d5e=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','multer','util','connect-timeout'];(function(_0x16568c,_0x251f9f){var _0x1e2d53=function(_0x437c43){while(--_0x437c43){_0x16568c['push'](_0x16568c['shift']());}};_0x1e2d53(++_0x251f9f);}(_0x6d5e,0xf4));var _0xe6d5=function(_0x218791,_0xeb7ba4){_0x218791=_0x218791-0x0;var _0x3e7abc=_0x6d5e[_0x218791];return _0x3e7abc;};'use strict';var multer=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var path=require('path');var timeout=require(_0xe6d5('0x2'));var express=require(_0xe6d5('0x3'));var router=express[_0xe6d5('0x4')]();var fs_extra=require(_0xe6d5('0x5'));var auth=require(_0xe6d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe6d5('0x7'));var controller=require(_0xe6d5('0x8'));router['get']('/',auth[_0xe6d5('0x9')](),controller[_0xe6d5('0xa')]);router[_0xe6d5('0xb')](_0xe6d5('0xc'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0xd')]);router[_0xe6d5('0xe')]('/',auth['isAuthenticated'](),controller[_0xe6d5('0xf')]);router[_0xe6d5('0x10')](_0xe6d5('0xc'),auth[_0xe6d5('0x9')](),controller[_0xe6d5('0x11')]);router[_0xe6d5('0x12')](_0xe6d5('0xc'),auth['isAuthenticated'](),controller['destroy']);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 9b61d2d..005e82e 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 _0x6da6=['name','sequelize','exports','STRING'];(function(_0x1437d5,_0x5f1de7){var _0x27c4fc=function(_0x32a5f3){while(--_0x32a5f3){_0x1437d5['push'](_0x1437d5['shift']());}};_0x27c4fc(++_0x5f1de7);}(_0x6da6,0x191));var _0x66da=function(_0x24ddf0,_0x4ef5a2){_0x24ddf0=_0x24ddf0-0x0;var _0x1d454e=_0x6da6[_0x24ddf0];return _0x1d454e;};'use strict';var Sequelize=require(_0x66da('0x0'));module[_0x66da('0x1')]={'name':{'type':Sequelize[_0x66da('0x2')],'unique':_0x66da('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x66da('0x2')]}}; \ No newline at end of file +var _0xb6cf=['name','sequelize','exports','STRING'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xb6cf,0x161));var _0xfb6c=function(_0x50d471,_0x2d9086){_0x50d471=_0x50d471-0x0;var _0x214900=_0xb6cf[_0x50d471];return _0x214900;};'use strict';var Sequelize=require(_0xfb6c('0x0'));module[_0xfb6c('0x1')]={'name':{'type':Sequelize[_0xfb6c('0x2')],'unique':_0xfb6c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfb6c('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 45fa80d..f1df930 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 _0xe6c8=['findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','find','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','filter','options','includeAll'];(function(_0x916ccc,_0x19734f){var _0xfd449b=function(_0xa31c4b){while(--_0xa31c4b){_0x916ccc['push'](_0x916ccc['shift']());}};_0xfd449b(++_0x19734f);}(_0xe6c8,0xf2));var _0x8e6c=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe6c8[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0x8e6c('0x0'));var rimraf=require(_0x8e6c('0x1'));var zipdir=require(_0x8e6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8e6c('0x3'));var Mustache=require(_0x8e6c('0x4'));var util=require('util');var path=require(_0x8e6c('0x5'));var sox=require(_0x8e6c('0x6'));var csv=require(_0x8e6c('0x7'));var ejs=require(_0x8e6c('0x8'));var fs=require('fs');var fs_extra=require(_0x8e6c('0x9'));var _=require(_0x8e6c('0xa'));var squel=require('squel');var crypto=require(_0x8e6c('0xb'));var jsforce=require(_0x8e6c('0xc'));var deskjs=require(_0x8e6c('0xd'));var toCsv=require(_0x8e6c('0x7'));var querystring=require('querystring');var Papa=require(_0x8e6c('0xe'));var Redis=require(_0x8e6c('0xf'));var authService=require(_0x8e6c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8e6c('0x11'));var hardwareService=require(_0x8e6c('0x12'));var logger=require(_0x8e6c('0x13'))(_0x8e6c('0x14'));var utils=require(_0x8e6c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8e6c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc20fc8,_0x4e1c75){_0x4e1c75=_0x4e1c75||0xcc;return function(_0x438098){if(_0x438098){return _0xc20fc8[_0x8e6c('0x17')](_0x4e1c75);}return _0xc20fc8[_0x8e6c('0x18')](_0x4e1c75)['end']();};}function respondWithResult(_0x4e78d1,_0x262179){_0x262179=_0x262179||0xc8;return function(_0x53c514){if(_0x53c514){return _0x4e78d1[_0x8e6c('0x18')](_0x262179)[_0x8e6c('0x19')](_0x53c514);}};}function respondWithFilteredResult(_0x266dcc,_0x444228){return function(_0x4c0f1e){if(_0x4c0f1e){var _0x50f2db=typeof _0x444228[_0x8e6c('0x1a')]===_0x8e6c('0x1b')&&typeof _0x444228[_0x8e6c('0x1c')]===_0x8e6c('0x1b');var _0x3bc975=_0x4c0f1e['count'];var _0x2ea61f=_0x50f2db?0x0:_0x444228['offset'];var _0x462b78=_0x50f2db?_0x4c0f1e[_0x8e6c('0x1d')]:_0x444228[_0x8e6c('0x1a')]+_0x444228[_0x8e6c('0x1c')];var _0x43d69a;if(_0x462b78>=_0x3bc975){_0x462b78=_0x3bc975;_0x43d69a=0xc8;}else{_0x43d69a=0xce;}_0x266dcc[_0x8e6c('0x18')](_0x43d69a);return _0x266dcc['set'](_0x8e6c('0x1e'),_0x2ea61f+'-'+_0x462b78+'/'+_0x3bc975)[_0x8e6c('0x19')](_0x4c0f1e);}return null;};}function patchUpdates(_0x17616f){return function(_0x31bf74){try{jsonpatch[_0x8e6c('0x1f')](_0x31bf74,_0x17616f,!![]);}catch(_0x81c758){return BPromise[_0x8e6c('0x20')](_0x81c758);}return _0x31bf74[_0x8e6c('0x21')]();};}function saveUpdates(_0x444b03,_0x4c6f1b){return function(_0x12c61f){if(_0x12c61f){return _0x12c61f[_0x8e6c('0x22')](_0x444b03)['then'](function(_0x4eb3f0){return _0x4eb3f0;});}return null;};}function removeEntity(_0x4177d7,_0x26b50a){return function(_0xc9e991){if(_0xc9e991){return _0xc9e991[_0x8e6c('0x23')]()[_0x8e6c('0x24')](function(){var _0xd4dda0=_0xc9e991[_0x8e6c('0x25')]({'plain':!![]});var _0x213abe='Pauses';return db[_0x8e6c('0x26')][_0x8e6c('0x23')]({'where':{'type':_0x213abe,'resourceId':_0xd4dda0['id']}})['then'](function(){return _0xc9e991;});})[_0x8e6c('0x24')](function(){_0x4177d7[_0x8e6c('0x18')](0xcc)[_0x8e6c('0x27')]();});}};}function handleEntityNotFound(_0x91c198,_0x183354){return function(_0x26a5f5){if(!_0x26a5f5){_0x91c198['sendStatus'](0x194);}return _0x26a5f5;};}function handleError(_0x28d28e,_0x557f02){_0x557f02=_0x557f02||0x1f4;return function(_0x6bf581){logger[_0x8e6c('0x28')](_0x6bf581['stack']);if(_0x6bf581[_0x8e6c('0x29')]){delete _0x6bf581[_0x8e6c('0x29')];}_0x28d28e[_0x8e6c('0x18')](_0x557f02)[_0x8e6c('0x2a')](_0x6bf581);};}exports[_0x8e6c('0x2b')]=function(_0x32b909,_0x4f7498){var _0xd674f={},_0x5c022c={},_0x20a8bc={'count':0x0,'rows':[]};var _0x3b2ea5=_[_0x8e6c('0x2c')](db[_0x8e6c('0x2d')][_0x8e6c('0x2e')],function(_0x1084e6){return{'name':_0x1084e6[_0x8e6c('0x2f')],'type':_0x1084e6[_0x8e6c('0x30')][_0x8e6c('0x31')]};});_0x5c022c['model']=_[_0x8e6c('0x2c')](_0x3b2ea5,'name');_0x5c022c[_0x8e6c('0x32')]=_[_0x8e6c('0x33')](_0x32b909[_0x8e6c('0x32')]);_0x5c022c['filters']=_[_0x8e6c('0x34')](_0x5c022c[_0x8e6c('0x35')],_0x5c022c[_0x8e6c('0x32')]);_0xd674f[_0x8e6c('0x36')]=_[_0x8e6c('0x34')](_0x5c022c[_0x8e6c('0x35')],qs[_0x8e6c('0x37')](_0x32b909['query']['fields']));_0xd674f[_0x8e6c('0x36')]=_0xd674f[_0x8e6c('0x36')][_0x8e6c('0x38')]?_0xd674f['attributes']:_0x5c022c[_0x8e6c('0x35')];if(!_0x32b909[_0x8e6c('0x32')][_0x8e6c('0x39')](_0x8e6c('0x3a'))){_0xd674f[_0x8e6c('0x1c')]=qs[_0x8e6c('0x1c')](_0x32b909['query'][_0x8e6c('0x1c')]);_0xd674f[_0x8e6c('0x1a')]=qs[_0x8e6c('0x1a')](_0x32b909['query']['offset']);}_0xd674f['order']=qs[_0x8e6c('0x3b')](_0x32b909['query'][_0x8e6c('0x3b')]);_0xd674f[_0x8e6c('0x3c')]=qs[_0x8e6c('0x3d')](_['pick'](_0x32b909[_0x8e6c('0x32')],_0x5c022c[_0x8e6c('0x3d')]),_0x3b2ea5);if(_0x32b909[_0x8e6c('0x32')]['filter']){_0xd674f[_0x8e6c('0x3c')]=_[_0x8e6c('0x3e')](_0xd674f[_0x8e6c('0x3c')],{'$or':_[_0x8e6c('0x2c')](_0x3b2ea5,function(_0x4bb6f0){if(_0x4bb6f0['type']!=='VIRTUAL'){var _0x39c750={};_0x39c750[_0x4bb6f0[_0x8e6c('0x29')]]={'$like':'%'+_0x32b909['query'][_0x8e6c('0x3f')]+'%'};return _0x39c750;}})});}_0xd674f=_['merge']({},_0xd674f,_0x32b909[_0x8e6c('0x40')]);var _0x3a2c3c={'where':_0xd674f[_0x8e6c('0x3c')]};return db[_0x8e6c('0x2d')]['count'](_0x3a2c3c)[_0x8e6c('0x24')](function(_0x41d25e){_0x20a8bc['count']=_0x41d25e;if(_0x32b909[_0x8e6c('0x32')][_0x8e6c('0x41')]){_0xd674f['include']=[{'all':!![]}];}return db[_0x8e6c('0x2d')][_0x8e6c('0x42')](_0xd674f);})[_0x8e6c('0x24')](function(_0x1fc793){_0x20a8bc[_0x8e6c('0x43')]=_0x1fc793;return _0x20a8bc;})[_0x8e6c('0x24')](respondWithFilteredResult(_0x4f7498,_0xd674f))[_0x8e6c('0x44')](handleError(_0x4f7498,null));};exports['show']=function(_0x36e305,_0x3ebc7c){var _0x5bc209={'raw':!![],'where':{'id':_0x36e305[_0x8e6c('0x45')]['id']}},_0x9ac0cc={};_0x9ac0cc[_0x8e6c('0x35')]=_[_0x8e6c('0x33')](db['Pause'][_0x8e6c('0x2e')]);_0x9ac0cc['query']=_[_0x8e6c('0x33')](_0x36e305[_0x8e6c('0x32')]);_0x9ac0cc['filters']=_[_0x8e6c('0x34')](_0x9ac0cc['model'],_0x9ac0cc['query']);_0x5bc209[_0x8e6c('0x36')]=_['intersection'](_0x9ac0cc[_0x8e6c('0x35')],qs['fields'](_0x36e305['query'][_0x8e6c('0x37')]));_0x5bc209[_0x8e6c('0x36')]=_0x5bc209[_0x8e6c('0x36')][_0x8e6c('0x38')]?_0x5bc209[_0x8e6c('0x36')]:_0x9ac0cc[_0x8e6c('0x35')];if(_0x36e305[_0x8e6c('0x32')][_0x8e6c('0x41')]){_0x5bc209['include']=[{'all':!![]}];}_0x5bc209=_[_0x8e6c('0x3e')]({},_0x5bc209,_0x36e305['options']);return db['Pause']['find'](_0x5bc209)[_0x8e6c('0x24')](handleEntityNotFound(_0x3ebc7c,null))[_0x8e6c('0x24')](respondWithResult(_0x3ebc7c,null))['catch'](handleError(_0x3ebc7c,null));};exports[_0x8e6c('0x46')]=function(_0x398665,_0x5f2d17){return db[_0x8e6c('0x2d')][_0x8e6c('0x46')](_0x398665[_0x8e6c('0x47')],{})[_0x8e6c('0x24')](function(_0x386397){var _0xaf7489=_0x398665[_0x8e6c('0x48')][_0x8e6c('0x25')]({'plain':!![]});if(!_0xaf7489)throw new Error(_0x8e6c('0x49'));if(_0xaf7489[_0x8e6c('0x4a')]===_0x8e6c('0x48')){var _0x3b0e9a=_0x386397['get']({'plain':!![]});var _0x30d227='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x30d227,'userProfileId':_0xaf7489['userProfileId']},'raw':!![]})['then'](function(_0x2f2531){if(_0x2f2531&&_0x2f2531[_0x8e6c('0x4b')]===0x0){return db[_0x8e6c('0x26')][_0x8e6c('0x46')]({'name':_0x3b0e9a[_0x8e6c('0x29')],'resourceId':_0x3b0e9a['id'],'type':_0x2f2531[_0x8e6c('0x29')],'sectionId':_0x2f2531['id']},{})[_0x8e6c('0x24')](function(){return _0x386397;});}else{return _0x386397;}})[_0x8e6c('0x44')](function(_0x3b401b){logger[_0x8e6c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b401b);throw _0x3b401b;});}return _0x386397;})[_0x8e6c('0x24')](respondWithResult(_0x5f2d17,0xc9))[_0x8e6c('0x44')](handleError(_0x5f2d17,null));};exports[_0x8e6c('0x22')]=function(_0x29e42b,_0x4c9114){if(_0x29e42b[_0x8e6c('0x47')]['id']){delete _0x29e42b['body']['id'];}return db['Pause'][_0x8e6c('0x4c')]({'where':{'id':_0x29e42b['params']['id']}})[_0x8e6c('0x24')](handleEntityNotFound(_0x4c9114,null))[_0x8e6c('0x24')](saveUpdates(_0x29e42b[_0x8e6c('0x47')],null))[_0x8e6c('0x24')](respondWithResult(_0x4c9114,null))[_0x8e6c('0x44')](handleError(_0x4c9114,null));};exports[_0x8e6c('0x23')]=function(_0x153343,_0x682efb){return db[_0x8e6c('0x2d')][_0x8e6c('0x4c')]({'where':{'id':_0x153343[_0x8e6c('0x45')]['id']}})[_0x8e6c('0x24')](handleEntityNotFound(_0x682efb,null))[_0x8e6c('0x24')](removeEntity(_0x682efb,null))[_0x8e6c('0x44')](handleError(_0x682efb,null));}; \ No newline at end of file +var _0x0b93=['squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','Pause','includeAll','include','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b93,0x199));var _0x30b9=function(_0x49a15,_0x6c14e3){_0x49a15=_0x49a15-0x0;var _0x20f915=_0x0b93[_0x49a15];return _0x20f915;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30b9('0x1'));var rp=require(_0x30b9('0x2'));var moment=require(_0x30b9('0x3'));var BPromise=require(_0x30b9('0x4'));var Mustache=require(_0x30b9('0x5'));var util=require(_0x30b9('0x6'));var path=require(_0x30b9('0x7'));var sox=require(_0x30b9('0x8'));var csv=require('to-csv');var ejs=require(_0x30b9('0x9'));var fs=require('fs');var fs_extra=require(_0x30b9('0xa'));var _=require('lodash');var squel=require(_0x30b9('0xb'));var crypto=require(_0x30b9('0xc'));var jsforce=require(_0x30b9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x30b9('0xe'));var querystring=require(_0x30b9('0xf'));var Papa=require(_0x30b9('0x10'));var Redis=require(_0x30b9('0x11'));var authService=require(_0x30b9('0x12'));var qs=require(_0x30b9('0x13'));var as=require(_0x30b9('0x14'));var hardwareService=require(_0x30b9('0x15'));var logger=require(_0x30b9('0x16'))(_0x30b9('0x17'));var utils=require(_0x30b9('0x18'));var config=require(_0x30b9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x30b9('0x1a'))['db'];function respondWithStatusCode(_0x424f67,_0x2fc1a8){_0x2fc1a8=_0x2fc1a8||0xcc;return function(_0x4e5967){if(_0x4e5967){return _0x424f67[_0x30b9('0x1b')](_0x2fc1a8);}return _0x424f67['status'](_0x2fc1a8)['end']();};}function respondWithResult(_0x56ec89,_0x3ba539){_0x3ba539=_0x3ba539||0xc8;return function(_0x347e50){if(_0x347e50){return _0x56ec89['status'](_0x3ba539)[_0x30b9('0x1c')](_0x347e50);}};}function respondWithFilteredResult(_0x290b08,_0xcf3524){return function(_0x5ad4e3){if(_0x5ad4e3){var _0x16a1dc=typeof _0xcf3524[_0x30b9('0x1d')]==='undefined'&&typeof _0xcf3524[_0x30b9('0x1e')]===_0x30b9('0x1f');var _0x4997cd=_0x5ad4e3[_0x30b9('0x20')];var _0x6eacab=_0x16a1dc?0x0:_0xcf3524[_0x30b9('0x1d')];var _0x2928ea=_0x16a1dc?_0x5ad4e3[_0x30b9('0x20')]:_0xcf3524['offset']+_0xcf3524[_0x30b9('0x1e')];var _0xd6e16;if(_0x2928ea>=_0x4997cd){_0x2928ea=_0x4997cd;_0xd6e16=0xc8;}else{_0xd6e16=0xce;}_0x290b08[_0x30b9('0x21')](_0xd6e16);return _0x290b08['set'](_0x30b9('0x22'),_0x6eacab+'-'+_0x2928ea+'/'+_0x4997cd)['json'](_0x5ad4e3);}return null;};}function patchUpdates(_0x428c24){return function(_0x55308d){try{jsonpatch[_0x30b9('0x23')](_0x55308d,_0x428c24,!![]);}catch(_0x171117){return BPromise[_0x30b9('0x24')](_0x171117);}return _0x55308d[_0x30b9('0x25')]();};}function saveUpdates(_0x579f0e,_0x186b1c){return function(_0x4499df){if(_0x4499df){return _0x4499df[_0x30b9('0x26')](_0x579f0e)[_0x30b9('0x27')](function(_0x17e25b){return _0x17e25b;});}return null;};}function removeEntity(_0x47b02d,_0x549ddd){return function(_0x24e8ee){if(_0x24e8ee){return _0x24e8ee[_0x30b9('0x28')]()[_0x30b9('0x27')](function(){var _0x638cdd=_0x24e8ee[_0x30b9('0x29')]({'plain':!![]});var _0x5e3c06=_0x30b9('0x2a');return db['UserProfileResource'][_0x30b9('0x28')]({'where':{'type':_0x5e3c06,'resourceId':_0x638cdd['id']}})[_0x30b9('0x27')](function(){return _0x24e8ee;});})[_0x30b9('0x27')](function(){_0x47b02d[_0x30b9('0x21')](0xcc)[_0x30b9('0x2b')]();});}};}function handleEntityNotFound(_0x473d06,_0x114a0a){return function(_0x55f1c1){if(!_0x55f1c1){_0x473d06[_0x30b9('0x1b')](0x194);}return _0x55f1c1;};}function handleError(_0x2c6eca,_0x150ebc){_0x150ebc=_0x150ebc||0x1f4;return function(_0x98b957){logger['error'](_0x98b957[_0x30b9('0x2c')]);if(_0x98b957['name']){delete _0x98b957[_0x30b9('0x2d')];}_0x2c6eca[_0x30b9('0x21')](_0x150ebc)[_0x30b9('0x2e')](_0x98b957);};}exports[_0x30b9('0x2f')]=function(_0x3c1394,_0x3efffd){var _0x3438d5={},_0x36af55={},_0x4bfca9={'count':0x0,'rows':[]};var _0x1b65e3=_[_0x30b9('0x30')](db['Pause'][_0x30b9('0x31')],function(_0x7ef18){return{'name':_0x7ef18['fieldName'],'type':_0x7ef18['type'][_0x30b9('0x32')]};});_0x36af55[_0x30b9('0x33')]=_['map'](_0x1b65e3,_0x30b9('0x2d'));_0x36af55[_0x30b9('0x34')]=_[_0x30b9('0x35')](_0x3c1394[_0x30b9('0x34')]);_0x36af55[_0x30b9('0x36')]=_[_0x30b9('0x37')](_0x36af55[_0x30b9('0x33')],_0x36af55['query']);_0x3438d5[_0x30b9('0x38')]=_[_0x30b9('0x37')](_0x36af55[_0x30b9('0x33')],qs[_0x30b9('0x39')](_0x3c1394[_0x30b9('0x34')][_0x30b9('0x39')]));_0x3438d5[_0x30b9('0x38')]=_0x3438d5['attributes'][_0x30b9('0x3a')]?_0x3438d5[_0x30b9('0x38')]:_0x36af55[_0x30b9('0x33')];if(!_0x3c1394[_0x30b9('0x34')][_0x30b9('0x3b')]('nolimit')){_0x3438d5[_0x30b9('0x1e')]=qs[_0x30b9('0x1e')](_0x3c1394[_0x30b9('0x34')]['limit']);_0x3438d5[_0x30b9('0x1d')]=qs['offset'](_0x3c1394[_0x30b9('0x34')][_0x30b9('0x1d')]);}_0x3438d5[_0x30b9('0x3c')]=qs['sort'](_0x3c1394[_0x30b9('0x34')][_0x30b9('0x3d')]);_0x3438d5['where']=qs[_0x30b9('0x36')](_[_0x30b9('0x3e')](_0x3c1394[_0x30b9('0x34')],_0x36af55[_0x30b9('0x36')]),_0x1b65e3);if(_0x3c1394[_0x30b9('0x34')]['filter']){_0x3438d5[_0x30b9('0x3f')]=_[_0x30b9('0x40')](_0x3438d5[_0x30b9('0x3f')],{'$or':_[_0x30b9('0x30')](_0x1b65e3,function(_0x1d8f99){if(_0x1d8f99['type']!==_0x30b9('0x41')){var _0x59a7d4={};_0x59a7d4[_0x1d8f99[_0x30b9('0x2d')]]={'$like':'%'+_0x3c1394[_0x30b9('0x34')][_0x30b9('0x42')]+'%'};return _0x59a7d4;}})});}_0x3438d5=_[_0x30b9('0x40')]({},_0x3438d5,_0x3c1394['options']);var _0x264a64={'where':_0x3438d5['where']};return db[_0x30b9('0x43')][_0x30b9('0x20')](_0x264a64)['then'](function(_0x56c705){_0x4bfca9[_0x30b9('0x20')]=_0x56c705;if(_0x3c1394['query'][_0x30b9('0x44')]){_0x3438d5[_0x30b9('0x45')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x3438d5);})[_0x30b9('0x27')](function(_0x3f03c9){_0x4bfca9[_0x30b9('0x46')]=_0x3f03c9;return _0x4bfca9;})[_0x30b9('0x27')](respondWithFilteredResult(_0x3efffd,_0x3438d5))[_0x30b9('0x47')](handleError(_0x3efffd,null));};exports[_0x30b9('0x48')]=function(_0x15fdad,_0x19b76a){var _0x4855fb={'raw':!![],'where':{'id':_0x15fdad['params']['id']}},_0x1fd91d={};_0x1fd91d[_0x30b9('0x33')]=_[_0x30b9('0x35')](db[_0x30b9('0x43')]['rawAttributes']);_0x1fd91d[_0x30b9('0x34')]=_[_0x30b9('0x35')](_0x15fdad[_0x30b9('0x34')]);_0x1fd91d['filters']=_[_0x30b9('0x37')](_0x1fd91d[_0x30b9('0x33')],_0x1fd91d[_0x30b9('0x34')]);_0x4855fb[_0x30b9('0x38')]=_[_0x30b9('0x37')](_0x1fd91d['model'],qs['fields'](_0x15fdad[_0x30b9('0x34')]['fields']));_0x4855fb[_0x30b9('0x38')]=_0x4855fb[_0x30b9('0x38')][_0x30b9('0x3a')]?_0x4855fb[_0x30b9('0x38')]:_0x1fd91d[_0x30b9('0x33')];if(_0x15fdad['query'][_0x30b9('0x44')]){_0x4855fb[_0x30b9('0x45')]=[{'all':!![]}];}_0x4855fb=_[_0x30b9('0x40')]({},_0x4855fb,_0x15fdad['options']);return db[_0x30b9('0x43')]['find'](_0x4855fb)[_0x30b9('0x27')](handleEntityNotFound(_0x19b76a,null))[_0x30b9('0x27')](respondWithResult(_0x19b76a,null))['catch'](handleError(_0x19b76a,null));};exports[_0x30b9('0x49')]=function(_0x20c29c,_0x59efd0){return db['Pause'][_0x30b9('0x49')](_0x20c29c[_0x30b9('0x4a')],{})[_0x30b9('0x27')](function(_0x46ae4c){var _0x1e9e9c=_0x20c29c['user']['get']({'plain':!![]});if(!_0x1e9e9c)throw new Error(_0x30b9('0x4b'));if(_0x1e9e9c[_0x30b9('0x4c')]==='user'){var _0x6e1c73=_0x46ae4c[_0x30b9('0x29')]({'plain':!![]});var _0x5906d2=_0x30b9('0x2a');return db[_0x30b9('0x4d')][_0x30b9('0x4e')]({'where':{'name':_0x5906d2,'userProfileId':_0x1e9e9c['userProfileId']},'raw':!![]})['then'](function(_0x53171b){if(_0x53171b&&_0x53171b[_0x30b9('0x4f')]===0x0){return db[_0x30b9('0x50')]['create']({'name':_0x6e1c73[_0x30b9('0x2d')],'resourceId':_0x6e1c73['id'],'type':_0x53171b[_0x30b9('0x2d')],'sectionId':_0x53171b['id']},{})[_0x30b9('0x27')](function(){return _0x46ae4c;});}else{return _0x46ae4c;}})[_0x30b9('0x47')](function(_0x3cccf4){logger[_0x30b9('0x51')](_0x30b9('0x52'),_0x3cccf4);throw _0x3cccf4;});}return _0x46ae4c;})['then'](respondWithResult(_0x59efd0,0xc9))['catch'](handleError(_0x59efd0,null));};exports[_0x30b9('0x26')]=function(_0xac30b,_0x426aae){if(_0xac30b['body']['id']){delete _0xac30b['body']['id'];}return db[_0x30b9('0x43')]['find']({'where':{'id':_0xac30b[_0x30b9('0x53')]['id']}})[_0x30b9('0x27')](handleEntityNotFound(_0x426aae,null))[_0x30b9('0x27')](saveUpdates(_0xac30b[_0x30b9('0x4a')],null))[_0x30b9('0x27')](respondWithResult(_0x426aae,null))[_0x30b9('0x47')](handleError(_0x426aae,null));};exports[_0x30b9('0x28')]=function(_0x18fb0d,_0x572418){return db['Pause'][_0x30b9('0x4e')]({'where':{'id':_0x18fb0d[_0x30b9('0x53')]['id']}})[_0x30b9('0x27')](handleEntityNotFound(_0x572418,null))[_0x30b9('0x27')](removeEntity(_0x572418,null))['catch'](handleError(_0x572418,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 652ee2b..e7cb1ed 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x1fabb5,_0xa37190){var _0x40b255=function(_0x5d3ce0){while(--_0x5d3ce0){_0x1fabb5['push'](_0x1fabb5['shift']());}};_0x40b255(++_0xa37190);}(_0x53ec,0x192));var _0xc53e=function(_0x372400,_0xdaeb10){_0x372400=_0x372400-0x0;var _0x4cd28c=_0x53ec[_0x372400];return _0x4cd28c;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x16dc2f,_0x4c9a15){var _0x3eb083=function(_0x342af4){while(--_0x342af4){_0x16dc2f['push'](_0x16dc2f['shift']());}};_0x3eb083(++_0x4c9a15);}(_0x1cb9,0x14e));var _0x91cb=function(_0x55e5e2,_0x2d427b){_0x55e5e2=_0x55e5e2-0x0;var _0x10d938=_0x1cb9[_0x55e5e2];return _0x10d938;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index ca3aefe..5b1dbd5 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(_0x2d4a70,_0xa0640c){var _0x45aeaf=function(_0x42f90c){while(--_0x42f90c){_0x2d4a70['push'](_0x2d4a70['shift']());}};_0x45aeaf(++_0xa0640c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d4460,_0x400e28){_0x5d4460=_0x5d4460-0x0;var _0x5bdc5e=_0xb10b[_0x5d4460];return _0x5bdc5e;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x28ecc3,_0x5eac50){var _0x3fcec2=function(_0x266066){while(--_0x266066){_0x28ecc3['push'](_0x28ecc3['shift']());}};_0x3fcec2(++_0x5eac50);}(_0x7a54,0x106));var _0x47a5=function(_0x5d3114,_0x2acdf4){_0x5d3114=_0x5d3114-0x0;var _0x3b2bd7=_0x7a54[_0x5d3114];return _0x3b2bd7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index afab816..dd921ad 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 _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(_0x30121d,_0x18cb1f){var _0x7f6a05=function(_0x154dc8){while(--_0x154dc8){_0x30121d['push'](_0x30121d['shift']());}};_0x7f6a05(++_0x18cb1f);}(_0x4bc3,0x16e));var _0x34bc=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x4bc3[_0x20589d];return _0x422de9;};'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 +var _0x3e74=['originalname','format','%s-%s%s','basename','now','extname','file','upload','post','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','download','diskStorage','join','root'];(function(_0x3f6b85,_0x5f4450){var _0x2ea993=function(_0x2954d2){while(--_0x2954d2){_0x3f6b85['push'](_0x3f6b85['shift']());}};_0x2ea993(++_0x5f4450);}(_0x3e74,0x175));var _0x43e7=function(_0x5cb744,_0x32fdc3){_0x5cb744=_0x5cb744-0x0;var _0x4532bc=_0x3e74[_0x5cb744];return _0x4532bc;};'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'),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['show']);router[_0x43e7('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);var upload=multer({'storage':multer[_0x43e7('0xe')]({'destination':function(_0x5c34f4,_0x2803d9,_0x513707){_0x513707(null,path[_0x43e7('0xf')](config[_0x43e7('0x10')],'server/files/plugins'));},'filename':function(_0x3eb206,_0xc960ea,_0x2718d3){_0xc960ea[_0x43e7('0x11')]=_0xc960ea['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2718d3(null,util[_0x43e7('0x12')](_0x43e7('0x13'),path[_0x43e7('0x14')](_0xc960ea['originalname'],path['extname'](_0xc960ea[_0x43e7('0x11')])),Date[_0x43e7('0x15')](),path[_0x43e7('0x16')](_0xc960ea[_0x43e7('0x11')])));}})});router['post']('/',upload['single'](_0x43e7('0x17')),controller[_0x43e7('0x18')]);router[_0x43e7('0x19')]('/webhook',controller['webhookPost']);router[_0x43e7('0x1a')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1b')]);router[_0x43e7('0x1c')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1c')]);module[_0x43e7('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 4997611..d40c9a7 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 _0x0879=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','exports','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0xf8f6bf,_0x110a1e){var _0x1e8c78=function(_0x119063){while(--_0x119063){_0xf8f6bf['push'](_0xf8f6bf['shift']());}};_0x1e8c78(++_0x110a1e);}(_0x0879,0x180));var _0x9087=function(_0x37b643,_0x2b3368){_0x37b643=_0x37b643-0x0;var _0xeda57e=_0x0879[_0x37b643];return _0xeda57e;};'use strict';var Sequelize=require('sequelize');module[_0x9087('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9087('0x1')](_0x9087('0x2'),'script')},'description':{'type':Sequelize[_0x9087('0x3')]},'version':{'type':Sequelize[_0x9087('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x9087('0x4')},'active':{'type':Sequelize[_0x9087('0x5')],'defaultValue':0x0,'comment':_0x9087('0x6')},'sidebar':{'type':Sequelize[_0x9087('0x1')](_0x9087('0x7'),_0x9087('0x8'),'always',_0x9087('0x9')),'defaultValue':_0x9087('0xa'),'comment':_0x9087('0xb')},'icon':{'type':Sequelize[_0x9087('0xc')]},'adminUrl':{'type':Sequelize[_0x9087('0xc')]},'agentUrl':{'type':Sequelize[_0x9087('0xc')]},'scriptName':{'type':Sequelize[_0x9087('0xc')]},'scriptPath':{'type':Sequelize[_0x9087('0xc')]}}; \ No newline at end of file +var _0xfe98=['adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xfe98,0x1c0));var _0x8fe9=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xfe98[_0xfc0976];return _0x23579f;};'use strict';var Sequelize=require(_0x8fe9('0x0'));module[_0x8fe9('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8fe9('0x2')](_0x8fe9('0x3'),'script')},'description':{'type':Sequelize[_0x8fe9('0x4')]},'version':{'type':Sequelize[_0x8fe9('0x4')]},'path':{'type':Sequelize[_0x8fe9('0x5')],'comment':_0x8fe9('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8fe9('0x7')},'sidebar':{'type':Sequelize[_0x8fe9('0x2')](_0x8fe9('0x8'),_0x8fe9('0x9'),'always','never'),'defaultValue':_0x8fe9('0xa'),'comment':_0x8fe9('0xb')},'icon':{'type':Sequelize[_0x8fe9('0x5')]},'adminUrl':{'type':Sequelize[_0x8fe9('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x8fe9('0x5')]},'scriptPath':{'type':Sequelize[_0x8fe9('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b4158f3..954383b 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 _0x505a=['order','sort','where','pick','filter','merge','count','include','rows','catch','find','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','role','body','user','get','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','method','%s%s','headers','content-length','content-type','endsWith','statusCode','sendStatus','send','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','index','Plugin','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x18ff75,_0x599762){var _0x3d283e=function(_0x52b657){while(--_0x52b657){_0x18ff75['push'](_0x18ff75['shift']());}};_0x3d283e(++_0x599762);}(_0x505a,0x6b));var _0xa505=function(_0x36cbae,_0x266039){_0x36cbae=_0x36cbae-0x0;var _0x2cdd1e=_0x505a[_0x36cbae];return _0x2cdd1e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa505('0x0'));var jsonpatch=require(_0xa505('0x1'));var rp=require('request-promise');var moment=require(_0xa505('0x2'));var BPromise=require(_0xa505('0x3'));var Mustache=require(_0xa505('0x4'));var util=require('util');var path=require(_0xa505('0x5'));var sox=require('sox');var csv=require(_0xa505('0x6'));var ejs=require(_0xa505('0x7'));var fs=require('fs');var fs_extra=require(_0xa505('0x8'));var _=require(_0xa505('0x9'));var squel=require(_0xa505('0xa'));var crypto=require(_0xa505('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa505('0xc'));var toCsv=require(_0xa505('0x6'));var querystring=require('querystring');var Papa=require(_0xa505('0xd'));var extract=require('extract-zip');var rimraf=require(_0xa505('0xe'));var archiver=require(_0xa505('0xf'));var Redis=require(_0xa505('0x10'));var authService=require(_0xa505('0x11'));var qs=require(_0xa505('0x12'));var as=require(_0xa505('0x13'));var hardwareService=require(_0xa505('0x14'));var logger=require('../../config/logger')(_0xa505('0x15'));var utils=require(_0xa505('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa505('0x17'));var db=require(_0xa505('0x18'))['db'];config[_0xa505('0x19')]=_[_0xa505('0x1a')](config[_0xa505('0x19')],{'host':_0xa505('0x1b'),'port':0x18eb});var socket=require(_0xa505('0x1c'))(new Redis(config[_0xa505('0x19')]));require(_0xa505('0x1d'))[_0xa505('0x1e')](socket);function respondWithStatusCode(_0x20e83b,_0x200232){_0x200232=_0x200232||0xcc;return function(_0x361881){if(_0x361881){return _0x20e83b['sendStatus'](_0x200232);}return _0x20e83b[_0xa505('0x1f')](_0x200232)[_0xa505('0x20')]();};}function respondWithResult(_0x2af741,_0x510eb6){_0x510eb6=_0x510eb6||0xc8;return function(_0x594174){if(_0x594174){return _0x2af741[_0xa505('0x1f')](_0x510eb6)['json'](_0x594174);}};}function respondWithFilteredResult(_0x4c0af6,_0x1efe55){return function(_0x13ecfe){if(_0x13ecfe){var _0x92f7=typeof _0x1efe55[_0xa505('0x21')]===_0xa505('0x22')&&typeof _0x1efe55[_0xa505('0x23')]===_0xa505('0x22');var _0x6c84ab=_0x13ecfe['count'];var _0x445dd1=_0x92f7?0x0:_0x1efe55[_0xa505('0x21')];var _0x37ff33=_0x92f7?_0x13ecfe['count']:_0x1efe55[_0xa505('0x21')]+_0x1efe55[_0xa505('0x23')];var _0x21d2fc;if(_0x37ff33>=_0x6c84ab){_0x37ff33=_0x6c84ab;_0x21d2fc=0xc8;}else{_0x21d2fc=0xce;}_0x4c0af6[_0xa505('0x1f')](_0x21d2fc);return _0x4c0af6[_0xa505('0x24')]('Content-Range',_0x445dd1+'-'+_0x37ff33+'/'+_0x6c84ab)[_0xa505('0x25')](_0x13ecfe);}return null;};}function patchUpdates(_0xc56411){return function(_0x2ce39a){try{jsonpatch[_0xa505('0x26')](_0x2ce39a,_0xc56411,!![]);}catch(_0x124f92){return BPromise[_0xa505('0x27')](_0x124f92);}return _0x2ce39a[_0xa505('0x28')]();};}function saveUpdates(_0x7eb2e2,_0x3f85f5){return function(_0x193d70){if(_0x193d70){return _0x193d70[_0xa505('0x29')](_0x7eb2e2)[_0xa505('0x2a')](function(_0x5943ec){return _0x5943ec;});}return null;};}function removeEntity(_0x2520a2,_0x122159){return function(_0x45e9b4){if(_0x45e9b4){return _0x45e9b4[_0xa505('0x2b')]()['then'](function(){var _0x1a50f5=_0x45e9b4['get']({'plain':!![]});var _0x325235=_0xa505('0x2c');return db[_0xa505('0x2d')][_0xa505('0x2b')]({'where':{'type':_0x325235,'resourceId':_0x1a50f5['id']}})['then'](function(){return _0x45e9b4;});})[_0xa505('0x2a')](function(){_0x2520a2[_0xa505('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3558e1,_0x3336b3){return function(_0x1b9856){if(!_0x1b9856){_0x3558e1['sendStatus'](0x194);}return _0x1b9856;};}function handleError(_0x3f6be7,_0x193869){_0x193869=_0x193869||0x1f4;return function(_0x404fe3){logger[_0xa505('0x2e')](_0x404fe3[_0xa505('0x2f')]);if(_0x404fe3[_0xa505('0x30')]){delete _0x404fe3[_0xa505('0x30')];}_0x3f6be7['status'](_0x193869)['send'](_0x404fe3);};}exports[_0xa505('0x31')]=function(_0x1c10b1,_0x26c67e){var _0x38bebb={},_0x242ab0={},_0xc368a4={'count':0x0,'rows':[]};var _0x45d04d=_['map'](db[_0xa505('0x32')][_0xa505('0x33')],function(_0x2ce337){return{'name':_0x2ce337[_0xa505('0x34')],'type':_0x2ce337[_0xa505('0x35')][_0xa505('0x36')]};});_0x242ab0[_0xa505('0x37')]=_[_0xa505('0x38')](_0x45d04d,'name');_0x242ab0['query']=_[_0xa505('0x39')](_0x1c10b1[_0xa505('0x3a')]);_0x242ab0[_0xa505('0x3b')]=_[_0xa505('0x3c')](_0x242ab0[_0xa505('0x37')],_0x242ab0[_0xa505('0x3a')]);_0x38bebb[_0xa505('0x3d')]=_[_0xa505('0x3c')](_0x242ab0[_0xa505('0x37')],qs[_0xa505('0x3e')](_0x1c10b1[_0xa505('0x3a')][_0xa505('0x3e')]));_0x38bebb['attributes']=_0x38bebb['attributes'][_0xa505('0x3f')]?_0x38bebb[_0xa505('0x3d')]:_0x242ab0[_0xa505('0x37')];if(!_0x1c10b1[_0xa505('0x3a')][_0xa505('0x40')]('nolimit')){_0x38bebb[_0xa505('0x23')]=qs[_0xa505('0x23')](_0x1c10b1[_0xa505('0x3a')][_0xa505('0x23')]);_0x38bebb['offset']=qs['offset'](_0x1c10b1[_0xa505('0x3a')][_0xa505('0x21')]);}_0x38bebb[_0xa505('0x41')]=qs[_0xa505('0x42')](_0x1c10b1[_0xa505('0x3a')]['sort']);_0x38bebb[_0xa505('0x43')]=qs[_0xa505('0x3b')](_[_0xa505('0x44')](_0x1c10b1[_0xa505('0x3a')],_0x242ab0[_0xa505('0x3b')]),_0x45d04d);if(_0x1c10b1['query'][_0xa505('0x45')]){_0x38bebb['where']=_[_0xa505('0x46')](_0x38bebb[_0xa505('0x43')],{'$or':_['map'](_0x45d04d,function(_0x3a59f6){if(_0x3a59f6['type']!=='VIRTUAL'){var _0x1cae96={};_0x1cae96[_0x3a59f6[_0xa505('0x30')]]={'$like':'%'+_0x1c10b1[_0xa505('0x3a')]['filter']+'%'};return _0x1cae96;}})});}_0x38bebb=_[_0xa505('0x46')]({},_0x38bebb,_0x1c10b1['options']);var _0x192a20={'where':_0x38bebb[_0xa505('0x43')]};return db[_0xa505('0x32')][_0xa505('0x47')](_0x192a20)[_0xa505('0x2a')](function(_0x22ae58){_0xc368a4[_0xa505('0x47')]=_0x22ae58;if(_0x1c10b1[_0xa505('0x3a')]['includeAll']){_0x38bebb[_0xa505('0x48')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x38bebb);})[_0xa505('0x2a')](function(_0x7ce201){_0xc368a4[_0xa505('0x49')]=_0x7ce201;return _0xc368a4;})['then'](respondWithFilteredResult(_0x26c67e,_0x38bebb))[_0xa505('0x4a')](handleError(_0x26c67e,null));};exports['show']=function(_0x46a1ff,_0x1a8d65){var _0x1d163b={'raw':!![],'where':{'id':_0x46a1ff['params']['id']}},_0x2e38f0={};_0x2e38f0[_0xa505('0x37')]=_[_0xa505('0x39')](db[_0xa505('0x32')][_0xa505('0x33')]);_0x2e38f0[_0xa505('0x3a')]=_[_0xa505('0x39')](_0x46a1ff['query']);_0x2e38f0[_0xa505('0x3b')]=_[_0xa505('0x3c')](_0x2e38f0['model'],_0x2e38f0[_0xa505('0x3a')]);_0x1d163b[_0xa505('0x3d')]=_['intersection'](_0x2e38f0['model'],qs[_0xa505('0x3e')](_0x46a1ff[_0xa505('0x3a')][_0xa505('0x3e')]));_0x1d163b[_0xa505('0x3d')]=_0x1d163b['attributes'][_0xa505('0x3f')]?_0x1d163b[_0xa505('0x3d')]:_0x2e38f0['model'];if(_0x46a1ff[_0xa505('0x3a')]['includeAll']){_0x1d163b['include']=[{'all':!![]}];}_0x1d163b=_[_0xa505('0x46')]({},_0x1d163b,_0x46a1ff['options']);return db['Plugin'][_0xa505('0x4b')](_0x1d163b)[_0xa505('0x2a')](handleEntityNotFound(_0x1a8d65,null))[_0xa505('0x2a')](respondWithResult(_0x1a8d65,null))[_0xa505('0x4a')](handleError(_0x1a8d65,null));};exports['download']=function(_0x142a18,_0x394b48,_0x1e577b){return db[_0xa505('0x32')][_0xa505('0x4b')]({'where':{'id':_0x142a18[_0xa505('0x4c')]['id']},'attributes':[_0xa505('0x30'),_0xa505('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x394b48,null))[_0xa505('0x2a')](function(_0x23fd25){if(_0x23fd25){var _0x551131=path[_0xa505('0x4d')](config[_0xa505('0x4e')],_0xa505('0x4f'),util[_0xa505('0x50')](_0xa505('0x51'),path[_0xa505('0x52')](_0x23fd25[_0xa505('0x5')])));var _0xceae44=fs[_0xa505('0x53')](_0x551131);var _0x30179a=archiver('zip',{'zlib':{'level':0x9}});_0x30179a['on'](_0xa505('0x54'),function(_0x34b77f){if(_0x34b77f['code']===_0xa505('0x55')){logger['error'](_0x34b77f);}else{throw new db[(_0xa505('0x56'))]['Error'](_0xa505('0x57'));}});_0x30179a['on'](_0xa505('0x2e'),function(_0x528979){throw new db['Sequelize'][(_0xa505('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x30179a['pipe'](_0xceae44);_0x30179a[_0xa505('0x59')](_0xa505('0x5a'),{'cwd':path[_0xa505('0x4d')](config[_0xa505('0x4e')],_0xa505('0x4f'),path['dirname'](_0x23fd25[_0xa505('0x5')])),'ignore':[path[_0xa505('0x4d')](path[_0xa505('0x52')](_0x23fd25['path']),_0xa505('0x5b')),path[_0xa505('0x4d')](path[_0xa505('0x52')](_0x23fd25[_0xa505('0x5')]),_0xa505('0x5c'))],'nodir':!![]})[_0xa505('0x5d')]();_0xceae44['on'](_0xa505('0x5e'),function(){if(!fs[_0xa505('0x5f')](_0x551131)){throw new db[(_0xa505('0x56'))][(_0xa505('0x58'))]('Plugin\x20not\x20found');}return _0x394b48[_0xa505('0x60')](_0x551131,util[_0xa505('0x50')]('%s.zip',path['basename'](_0x23fd25[_0xa505('0x5')])),function(_0x26d9ce){if(_0x26d9ce){throw new db[(_0xa505('0x56'))]['Error'](_0xa505('0x61'));}fs[_0xa505('0x62')](_0x551131);logger[_0xa505('0x63')]('Download\x20completed');logger[_0xa505('0x63')]('Temporary\x20file\x20removed');});});}return null;})[_0xa505('0x4a')](handleError(_0x394b48,null));};exports[_0xa505('0x64')]=function(_0x2cd1cb,_0x318afc,_0x446d15){var _0x34c20c=path[_0xa505('0x52')](_0x2cd1cb[_0xa505('0x65')]['filename'],path[_0xa505('0x66')](_0x2cd1cb[_0xa505('0x65')][_0xa505('0x67')]));var _0x440cd5=path[_0xa505('0x4d')](config[_0xa505('0x4e')],_0xa505('0x4f'),_0x2cd1cb[_0xa505('0x65')][_0xa505('0x67')]);var _0x420d12=path[_0xa505('0x4d')](config[_0xa505('0x4e')],'server/files/plugins',_0x34c20c);logger[_0xa505('0x63')](_0xa505('0x68'),_0x440cd5);logger[_0xa505('0x63')](_0xa505('0x69'),_0x420d12);try{fs[_0xa505('0x6a')](_0x440cd5,parseInt(_0xa505('0x6b'),0x8));extract(_0x440cd5,{'dir':_0x420d12},function(_0x2acc72){if(_0x2acc72){logger[_0xa505('0x2e')](_0x2acc72);handleError(_0x2acc72,!![]);};var _0x5dc33c=fs[_0xa505('0x6c')](_0x420d12);if(_0x5dc33c[_0xa505('0x3f')]>0x1){removeReferences(_0x440cd5,_0x420d12);logger['error'](_0xa505('0x6d'));return _0x446d15(new Error(_0xa505('0x6d')));}var _0x5ec763=fs[_0xa505('0x6e')](path['join'](_0x420d12,_0x5dc33c[0x0]));if(_0x5ec763[_0xa505('0x6f')]()){removeReferences(_0x440cd5,_0x420d12);logger['error'](_0xa505('0x6d'));return _0x446d15(new Error('Invalid\x20plugin\x20structure'));}if(_0x5ec763[_0xa505('0x70')]()){var _0x21e4a1=fs[_0xa505('0x6c')](path['join'](_0x420d12,_0x5dc33c[0x0]));if(_0x21e4a1['length']===0x0){removeReferences(_0x440cd5,_0x420d12);logger[_0xa505('0x2e')](_0xa505('0x6d'));return _0x446d15(new Error(_0xa505('0x6d')));}var _0x2aac3e=_0x21e4a1[_0xa505('0x71')](function(_0x6dd785){return _0x6dd785===_0xa505('0x72');});if(!_0x2aac3e){return _0x446d15(new Error('Plugin\x20manifest\x20missing'));}var _0x1cb072=fs[_0xa505('0x73')](path[_0xa505('0x4d')](_0x420d12,_0x5dc33c[0x0],_0xa505('0x72')));var _0x3e69a5=JSON[_0xa505('0x74')](_0x1cb072);if(_0xa505('0x22')==typeof _0x3e69a5[_0xa505('0x30')]){return _0x446d15(new Error(_0xa505('0x75')));}if(_0xa505('0x22')==typeof _0x3e69a5['type']){return _0x446d15(new Error(_0xa505('0x76')));}if(_0xa505('0x22')==typeof _0x3e69a5[_0xa505('0x77')]){return _0x446d15(new Error(_0xa505('0x78')));}if('undefined'==typeof _0x3e69a5[_0xa505('0x79')]){return _0x446d15(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3e69a5[_0xa505('0x35')]==='html'){if(_0xa505('0x22')==typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')]){return _0x446d15(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xa505('0x22')==typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7b')]&&_0xa505('0x22')==typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7c')]){return _0x446d15(new Error(_0xa505('0x7d')));}}else if(_0x3e69a5[_0xa505('0x35')]===_0xa505('0x7e')){if('undefined'==typeof _0x3e69a5['parameters'][_0xa505('0x7f')]){return _0x446d15(new Error(_0xa505('0x80')));}if(_0xa505('0x22')==typeof _0x3e69a5['parameters']['scriptPath']){return _0x446d15(new Error(_0xa505('0x81')));}}else{return _0x446d15(new Error(_0xa505('0x82')));}var _0x26be3f=_0x3e69a5[_0xa505('0x30')];var _0x3860a8=_0x3e69a5[_0xa505('0x83')];var _0x57e153=_0x3e69a5[_0xa505('0x35')];var _0x580f01=_0x3e69a5[_0xa505('0x84')]?_0x3e69a5[_0xa505('0x84')]:_0xa505('0x85');var _0x1b1db4=_0x3e69a5[_0xa505('0x86')]?_0x3e69a5['icon']:_0xa505('0x87');var _0x4924f7='';var _0x1ca58f='';var _0x14d5f8='';var _0x772f27='';var _0x5bc8d4=_0x3e69a5[_0xa505('0x77')];if(_0x57e153===_0xa505('0x88')){if(_0xa505('0x22')!=typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')]['admin']){var _0x4af0b8=_0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xa505('0x89')](_0x4af0b8)){_0x4924f7=path[_0xa505('0x4d')]('plugins',_0x34c20c,_0x5dc33c[0x0],_0x4af0b8);}else{_0x4924f7=_0x4af0b8;}}else{logger[_0xa505('0x63')](_0xa505('0x8a'));}if(_0xa505('0x22')!=typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7c')]){var _0x10ce81=_0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x10ce81)){_0x1ca58f=path[_0xa505('0x4d')](_0xa505('0x8b'),_0x34c20c,_0x5dc33c[0x0],_0x10ce81);}else{_0x1ca58f=_0x10ce81;}}else{logger[_0xa505('0x63')](_0xa505('0x8c'));}}else if(_0x57e153===_0xa505('0x7e')){_0x14d5f8=_0x3e69a5[_0xa505('0x79')][_0xa505('0x7f')];_0x772f27=_0x3e69a5[_0xa505('0x79')][_0xa505('0x8d')];if(_0xa505('0x22')!=typeof _0x3e69a5['parameters'][_0xa505('0x7a')]){if(_0xa505('0x22')!=typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7b')]){var _0x4af0b8=_0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xa505('0x89')](_0x4af0b8)){_0x4924f7=path[_0xa505('0x4d')](_0xa505('0x8b'),_0x34c20c,_0x5dc33c[0x0],_0x4af0b8);}else{_0x4924f7=_0x4af0b8;}}if(_0xa505('0x22')!=typeof _0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')][_0xa505('0x7c')]){var _0x10ce81=_0x3e69a5[_0xa505('0x79')][_0xa505('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x10ce81)){_0x1ca58f=path[_0xa505('0x4d')]('plugins',_0x34c20c,_0x5dc33c[0x0],_0x10ce81);}else{_0x1ca58f=_0x10ce81;}}}}var _0x26e92e={'name':_0x26be3f,'description':_0x3860a8,'path':path[_0xa505('0x4d')](_0x34c20c,_0x5dc33c[0x0]),'type':_0x57e153,'sidebar':_0x580f01,'icon':_0x1b1db4,'adminUrl':_0x4924f7,'agentUrl':_0x1ca58f,'scriptName':_0x14d5f8,'scriptPath':_0x772f27,'version':_0x5bc8d4};removeReferences(_0x440cd5,null);return db[_0xa505('0x32')]['create'](_0x26e92e)['then'](function(_0x5b68b1){var _0x44f390={'role':_0x2cd1cb['body'][_0xa505('0x8e')],'userProfileId':_0x2cd1cb[_0xa505('0x8f')]['userProfileId']};if(!_0x44f390)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44f390[_0xa505('0x8e')]===_0xa505('0x90')){var _0xd7208b=_0x5b68b1[_0xa505('0x91')]({'plain':!![]});return db[_0xa505('0x92')][_0xa505('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x44f390[_0xa505('0x93')]},'raw':!![]})[_0xa505('0x2a')](function(_0x644c97){if(_0x644c97&&_0x644c97['autoAssociation']===0x0){return db['UserProfileResource'][_0xa505('0x94')]({'name':_0xd7208b[_0xa505('0x30')],'resourceId':_0xd7208b['id'],'type':_0x644c97['name'],'sectionId':_0x644c97['id']},{})[_0xa505('0x2a')](function(){return _0x5b68b1;});}else{return _0x5b68b1;}})[_0xa505('0x4a')](function(_0x33f4ed){logger[_0xa505('0x2e')](_0xa505('0x95'),_0x33f4ed);throw _0x33f4ed;});}return _0x5b68b1;})[_0xa505('0x2a')](respondWithResult(_0x318afc,null))[_0xa505('0x4a')](handleError(_0x318afc,null));}});}catch(_0x33324c){_0x318afc[_0xa505('0x1f')](0x1f4)['send'](_0x33324c);}};function removeReferences(_0x247df6,_0x335aa8){try{if(_0x247df6){fs[_0xa505('0x62')](_0x247df6);logger[_0xa505('0x63')](_0xa505('0x96'));}if(_0x335aa8){rimraf(_0x335aa8,function(){});logger[_0xa505('0x63')](_0xa505('0x97'));}}catch(_0x3bf274){logger[_0xa505('0x2e')](_0x3bf274);}}exports['update']=function(_0x3e2a78,_0x531e27,_0x1e6353){return db['Plugin'][_0xa505('0x4b')]({'where':{'id':_0x3e2a78[_0xa505('0x4c')]['id']}})[_0xa505('0x2a')](handleEntityNotFound(_0x531e27,null))[_0xa505('0x2a')](saveUpdates(_0x3e2a78[_0xa505('0x8f')],null))['then'](respondWithResult(_0x531e27,null))[_0xa505('0x4a')](handleError(_0x531e27,null));};exports[_0xa505('0x98')]=function(_0x2b4ee4,_0x461965,_0x5c11f7){return db['Plugin'][_0xa505('0x4b')]({'where':{'id':_0x2b4ee4['params']['id']}})[_0xa505('0x2a')](function(_0x3cc4aa){if(_0x3cc4aa){return _0x3cc4aa['destroy']();}})[_0xa505('0x2a')](function(_0x25fd81){rimraf(path[_0xa505('0x4d')](config[_0xa505('0x4e')],_0xa505('0x4f'),path[_0xa505('0x99')](_0x25fd81[_0xa505('0x5')])),function(){});return _0x25fd81;})[_0xa505('0x2a')](handleEntityNotFound(_0x461965,null))[_0xa505('0x2a')](respondWithStatusCode(_0x461965,null))[_0xa505('0x4a')](handleError(_0x461965,null));};exports[_0xa505('0x9a')]=function(_0x360140,_0x570370,_0x168f16){return BPromise[_0xa505('0x9b')]()[_0xa505('0x2a')](function(){if(!_0x360140[_0xa505('0x3a')][_0xa505('0x5')]){throw new Error(_0xa505('0x9c'));}if(!_0x360140['query'][_0xa505('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3a2743=_0x360140['query'][_0xa505('0x9e')]?_0x360140['query']['hostname']+':'+_0x360140['query'][_0xa505('0x9d')]:_0xa505('0x9f')+_0x360140[_0xa505('0x3a')][_0xa505('0x9d')];var _0x17476b=_0x360140[_0xa505('0x3a')][_0xa505('0x25')]?_0x360140[_0xa505('0x3a')]['json']:!![];var _0x38b2ba=_0x360140['query']['encoding']?_0x360140[_0xa505('0x3a')]['encoding']:null;var _0x582446={'method':_0x360140[_0xa505('0xa0')],'uri':util[_0xa505('0x50')](_0xa505('0xa1'),_0x3a2743,_0x360140[_0xa505('0x3a')][_0xa505('0x5')]),'json':_0x17476b,'resolveWithFullResponse':!![],'encoding':_0x38b2ba,'qs':_0x360140[_0xa505('0x3a')]};if(_0x360140[_0xa505('0xa2')]){_0x582446['headers']=_0x360140['headers'];if(_0x582446[_0xa505('0xa2')]['content-length']){delete _0x582446[_0xa505('0xa2')][_0xa505('0xa3')];}}if(_0x582446[_0xa505('0xa2')][_0xa505('0xa4')]){delete _0x582446[_0xa505('0xa2')][_0xa505('0xa4')];}return rp(_0x582446);})['then'](function(_0x14bb83){if(_0x14bb83){_0x570370['set'](_0x14bb83[_0xa505('0xa2')]);logger[_0xa505('0x63')](_0x14bb83['body']);if(_[_0xa505('0xa5')](_0x360140[_0xa505('0x3a')][_0xa505('0x5')],'download')&&_0x14bb83[_0xa505('0xa6')]==0x1f4){return _0x570370[_0xa505('0xa7')](_0x14bb83['statusCode']);}else{return _0x570370[_0xa505('0x1f')](_0x14bb83['statusCode'])[_0xa505('0xa8')](_0x14bb83[_0xa505('0x8f')]);}}else{return _0x570370[_0xa505('0xa7')](0xc8);}})[_0xa505('0x4a')](handleError(_0x570370,null));};exports[_0xa505('0xa9')]=function(_0x3f8891,_0x4c7f4e,_0x108451){return BPromise[_0xa505('0x9b')]()[_0xa505('0x2a')](function(){if(!_0x3f8891[_0xa505('0x3a')][_0xa505('0x5')]){throw new Error(_0xa505('0x9c'));}if(!_0x3f8891['query'][_0xa505('0x9d')]){throw new Error(_0xa505('0xaa'));}var _0x54a809=_0x3f8891[_0xa505('0x3a')][_0xa505('0x9e')]?_0x3f8891[_0xa505('0x3a')]['hostname']+':'+_0x3f8891[_0xa505('0x3a')][_0xa505('0x9d')]:_0xa505('0x9f')+_0x3f8891[_0xa505('0x3a')]['port'];var _0x1258cd=_0x3f8891[_0xa505('0x3a')]['json']?_0x3f8891['query'][_0xa505('0x25')]:!![];var _0x247108=_0x3f8891['query'][_0xa505('0xab')]?_0x3f8891['query'][_0xa505('0xab')]:null;var _0x3e635f={'method':_0x3f8891[_0xa505('0xa0')],'uri':util[_0xa505('0x50')](_0xa505('0xa1'),_0x54a809,_0x3f8891['query'][_0xa505('0x5')]),'json':_0x1258cd,'resolveWithFullResponse':!![],'encoding':_0x247108,'body':_0x3f8891['body']};if(_0x3f8891[_0xa505('0xa2')]){_0x3e635f[_0xa505('0xa2')]=_0x3f8891[_0xa505('0xa2')];if(_0x3e635f[_0xa505('0xa2')][_0xa505('0xa3')]){delete _0x3e635f[_0xa505('0xa2')][_0xa505('0xa3')];}}if(_0x3e635f[_0xa505('0xa2')][_0xa505('0xa4')]){delete _0x3e635f[_0xa505('0xa2')][_0xa505('0xa4')];}return rp(_0x3e635f);})[_0xa505('0x2a')](function(_0x4d90d5){if(_0x4d90d5){_0x4c7f4e['set'](_0x4d90d5['headers']);logger[_0xa505('0x63')](_0x4d90d5[_0xa505('0x8f')]);return _0x4c7f4e[_0xa505('0x1f')](_0x4d90d5[_0xa505('0xa6')])['send'](_0x4d90d5[_0xa505('0x8f')]);}else{return _0x4c7f4e['sendStatus'](0xc8);}})[_0xa505('0x4a')](handleError(_0x4c7f4e,null));}; \ No newline at end of file +var _0x1eeb=['Invalid\x20manifest:\x20views\x20missing','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Plugin','findAll','rows','catch','params','length','find','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','basename','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing'];(function(_0x26cd0d,_0x5ef493){var _0x38ec81=function(_0x1d6c25){while(--_0x1d6c25){_0x26cd0d['push'](_0x26cd0d['shift']());}};_0x38ec81(++_0x5ef493);}(_0x1eeb,0xd1));var _0xb1ee=function(_0x4fab79,_0x4f76dc){_0x4fab79=_0x4fab79-0x0;var _0x31ec8e=_0x1eeb[_0x4fab79];return _0x31ec8e;};'use strict';var emlformat=require(_0xb1ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1ee('0x1'));var jsonpatch=require(_0xb1ee('0x2'));var rp=require('request-promise');var moment=require(_0xb1ee('0x3'));var BPromise=require(_0xb1ee('0x4'));var Mustache=require(_0xb1ee('0x5'));var util=require(_0xb1ee('0x6'));var path=require(_0xb1ee('0x7'));var sox=require(_0xb1ee('0x8'));var csv=require(_0xb1ee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1ee('0xa'));var squel=require(_0xb1ee('0xb'));var crypto=require(_0xb1ee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb1ee('0xd'));var toCsv=require(_0xb1ee('0x9'));var querystring=require(_0xb1ee('0xe'));var Papa=require(_0xb1ee('0xf'));var extract=require(_0xb1ee('0x10'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xb1ee('0x11'));var authService=require(_0xb1ee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb1ee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb1ee('0x14'));var config=require(_0xb1ee('0x15'));var licenseUtil=require(_0xb1ee('0x16'));var db=require(_0xb1ee('0x17'))['db'];config[_0xb1ee('0x18')]=_[_0xb1ee('0x19')](config[_0xb1ee('0x18')],{'host':_0xb1ee('0x1a'),'port':0x18eb});var socket=require(_0xb1ee('0x1b'))(new Redis(config['redis']));require(_0xb1ee('0x1c'))[_0xb1ee('0x1d')](socket);function respondWithStatusCode(_0x3d8a69,_0x42a32d){_0x42a32d=_0x42a32d||0xcc;return function(_0xab3181){if(_0xab3181){return _0x3d8a69[_0xb1ee('0x1e')](_0x42a32d);}return _0x3d8a69[_0xb1ee('0x1f')](_0x42a32d)[_0xb1ee('0x20')]();};}function respondWithResult(_0x266a52,_0x213806){_0x213806=_0x213806||0xc8;return function(_0x1f6dbf){if(_0x1f6dbf){return _0x266a52[_0xb1ee('0x1f')](_0x213806)['json'](_0x1f6dbf);}};}function respondWithFilteredResult(_0x4ff437,_0x512ecc){return function(_0x561eff){if(_0x561eff){var _0x5c0be0=typeof _0x512ecc[_0xb1ee('0x21')]==='undefined'&&typeof _0x512ecc[_0xb1ee('0x22')]===_0xb1ee('0x23');var _0x481794=_0x561eff[_0xb1ee('0x24')];var _0x2331e7=_0x5c0be0?0x0:_0x512ecc['offset'];var _0x84cd9a=_0x5c0be0?_0x561eff[_0xb1ee('0x24')]:_0x512ecc[_0xb1ee('0x21')]+_0x512ecc[_0xb1ee('0x22')];var _0x10b7dd;if(_0x84cd9a>=_0x481794){_0x84cd9a=_0x481794;_0x10b7dd=0xc8;}else{_0x10b7dd=0xce;}_0x4ff437[_0xb1ee('0x1f')](_0x10b7dd);return _0x4ff437[_0xb1ee('0x25')]('Content-Range',_0x2331e7+'-'+_0x84cd9a+'/'+_0x481794)[_0xb1ee('0x26')](_0x561eff);}return null;};}function patchUpdates(_0x4c5df8){return function(_0x43cd07){try{jsonpatch['apply'](_0x43cd07,_0x4c5df8,!![]);}catch(_0x288c44){return BPromise['reject'](_0x288c44);}return _0x43cd07[_0xb1ee('0x27')]();};}function saveUpdates(_0x8683dd,_0x6f1758){return function(_0x2a3280){if(_0x2a3280){return _0x2a3280[_0xb1ee('0x28')](_0x8683dd)[_0xb1ee('0x29')](function(_0x1c452b){return _0x1c452b;});}return null;};}function removeEntity(_0x5b5aa0,_0x508e88){return function(_0x52e971){if(_0x52e971){return _0x52e971[_0xb1ee('0x2a')]()[_0xb1ee('0x29')](function(){var _0xf5f922=_0x52e971['get']({'plain':!![]});var _0xe13fce=_0xb1ee('0x2b');return db[_0xb1ee('0x2c')]['destroy']({'where':{'type':_0xe13fce,'resourceId':_0xf5f922['id']}})[_0xb1ee('0x29')](function(){return _0x52e971;});})[_0xb1ee('0x29')](function(){_0x5b5aa0[_0xb1ee('0x1f')](0xcc)[_0xb1ee('0x20')]();});}};}function handleEntityNotFound(_0x1d5949,_0x498854){return function(_0x406472){if(!_0x406472){_0x1d5949['sendStatus'](0x194);}return _0x406472;};}function handleError(_0x25c4b3,_0x188f36){_0x188f36=_0x188f36||0x1f4;return function(_0x19a04a){logger[_0xb1ee('0x2d')](_0x19a04a[_0xb1ee('0x2e')]);if(_0x19a04a[_0xb1ee('0x2f')]){delete _0x19a04a[_0xb1ee('0x2f')];}_0x25c4b3[_0xb1ee('0x1f')](_0x188f36)['send'](_0x19a04a);};}exports['index']=function(_0x1df419,_0xbe4102){var _0xf9252e={},_0x4478d2={},_0x1130c6={'count':0x0,'rows':[]};var _0x16c53c=_[_0xb1ee('0x30')](db['Plugin'][_0xb1ee('0x31')],function(_0x29cfe7){return{'name':_0x29cfe7[_0xb1ee('0x32')],'type':_0x29cfe7[_0xb1ee('0x33')]['key']};});_0x4478d2[_0xb1ee('0x34')]=_[_0xb1ee('0x30')](_0x16c53c,_0xb1ee('0x2f'));_0x4478d2[_0xb1ee('0x35')]=_[_0xb1ee('0x36')](_0x1df419[_0xb1ee('0x35')]);_0x4478d2[_0xb1ee('0x37')]=_[_0xb1ee('0x38')](_0x4478d2['model'],_0x4478d2['query']);_0xf9252e[_0xb1ee('0x39')]=_[_0xb1ee('0x38')](_0x4478d2['model'],qs[_0xb1ee('0x3a')](_0x1df419[_0xb1ee('0x35')]['fields']));_0xf9252e[_0xb1ee('0x39')]=_0xf9252e[_0xb1ee('0x39')]['length']?_0xf9252e['attributes']:_0x4478d2['model'];if(!_0x1df419[_0xb1ee('0x35')][_0xb1ee('0x3b')]('nolimit')){_0xf9252e[_0xb1ee('0x22')]=qs[_0xb1ee('0x22')](_0x1df419[_0xb1ee('0x35')][_0xb1ee('0x22')]);_0xf9252e['offset']=qs['offset'](_0x1df419[_0xb1ee('0x35')]['offset']);}_0xf9252e['order']=qs['sort'](_0x1df419[_0xb1ee('0x35')][_0xb1ee('0x3c')]);_0xf9252e[_0xb1ee('0x3d')]=qs[_0xb1ee('0x37')](_['pick'](_0x1df419[_0xb1ee('0x35')],_0x4478d2[_0xb1ee('0x37')]),_0x16c53c);if(_0x1df419[_0xb1ee('0x35')][_0xb1ee('0x3e')]){_0xf9252e[_0xb1ee('0x3d')]=_[_0xb1ee('0x3f')](_0xf9252e[_0xb1ee('0x3d')],{'$or':_['map'](_0x16c53c,function(_0x31c22a){if(_0x31c22a[_0xb1ee('0x33')]!==_0xb1ee('0x40')){var _0x50d32e={};_0x50d32e[_0x31c22a[_0xb1ee('0x2f')]]={'$like':'%'+_0x1df419[_0xb1ee('0x35')][_0xb1ee('0x3e')]+'%'};return _0x50d32e;}})});}_0xf9252e=_[_0xb1ee('0x3f')]({},_0xf9252e,_0x1df419[_0xb1ee('0x41')]);var _0x567a63={'where':_0xf9252e[_0xb1ee('0x3d')]};return db['Plugin'][_0xb1ee('0x24')](_0x567a63)[_0xb1ee('0x29')](function(_0x19fafd){_0x1130c6[_0xb1ee('0x24')]=_0x19fafd;if(_0x1df419[_0xb1ee('0x35')][_0xb1ee('0x42')]){_0xf9252e[_0xb1ee('0x43')]=[{'all':!![]}];}return db[_0xb1ee('0x44')][_0xb1ee('0x45')](_0xf9252e);})['then'](function(_0x4988e0){_0x1130c6[_0xb1ee('0x46')]=_0x4988e0;return _0x1130c6;})[_0xb1ee('0x29')](respondWithFilteredResult(_0xbe4102,_0xf9252e))[_0xb1ee('0x47')](handleError(_0xbe4102,null));};exports['show']=function(_0x38fdb7,_0x71ff48){var _0x3081db={'raw':!![],'where':{'id':_0x38fdb7[_0xb1ee('0x48')]['id']}},_0x316dc6={};_0x316dc6['model']=_[_0xb1ee('0x36')](db[_0xb1ee('0x44')][_0xb1ee('0x31')]);_0x316dc6[_0xb1ee('0x35')]=_[_0xb1ee('0x36')](_0x38fdb7[_0xb1ee('0x35')]);_0x316dc6[_0xb1ee('0x37')]=_['intersection'](_0x316dc6[_0xb1ee('0x34')],_0x316dc6[_0xb1ee('0x35')]);_0x3081db['attributes']=_[_0xb1ee('0x38')](_0x316dc6[_0xb1ee('0x34')],qs[_0xb1ee('0x3a')](_0x38fdb7['query'][_0xb1ee('0x3a')]));_0x3081db['attributes']=_0x3081db['attributes'][_0xb1ee('0x49')]?_0x3081db['attributes']:_0x316dc6[_0xb1ee('0x34')];if(_0x38fdb7['query']['includeAll']){_0x3081db['include']=[{'all':!![]}];}_0x3081db=_[_0xb1ee('0x3f')]({},_0x3081db,_0x38fdb7['options']);return db[_0xb1ee('0x44')][_0xb1ee('0x4a')](_0x3081db)[_0xb1ee('0x29')](handleEntityNotFound(_0x71ff48,null))['then'](respondWithResult(_0x71ff48,null))[_0xb1ee('0x47')](handleError(_0x71ff48,null));};exports['download']=function(_0x558628,_0x29fd8c,_0x2d5f1e){return db['Plugin'][_0xb1ee('0x4a')]({'where':{'id':_0x558628[_0xb1ee('0x48')]['id']},'attributes':[_0xb1ee('0x2f'),_0xb1ee('0x7')],'raw':!![]})[_0xb1ee('0x29')](handleEntityNotFound(_0x29fd8c,null))[_0xb1ee('0x29')](function(_0x3330e2){if(_0x3330e2){var _0x459955=path[_0xb1ee('0x4b')](config[_0xb1ee('0x4c')],_0xb1ee('0x4d'),util[_0xb1ee('0x4e')](_0xb1ee('0x4f'),path['basename'](_0x3330e2[_0xb1ee('0x7')])));var _0x3e7175=fs[_0xb1ee('0x50')](_0x459955);var _0x39bac2=archiver(_0xb1ee('0x51'),{'zlib':{'level':0x9}});_0x39bac2['on']('warning',function(_0x15dd2d){if(_0x15dd2d[_0xb1ee('0x52')]==='ENOENT'){logger[_0xb1ee('0x2d')](_0x15dd2d);}else{throw new db[(_0xb1ee('0x53'))][(_0xb1ee('0x54'))](_0xb1ee('0x55'));}});_0x39bac2['on']('error',function(_0x37f8fb){throw new db[(_0xb1ee('0x53'))][(_0xb1ee('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x39bac2['pipe'](_0x3e7175);_0x39bac2[_0xb1ee('0x56')](_0xb1ee('0x57'),{'cwd':path['join'](config[_0xb1ee('0x4c')],_0xb1ee('0x4d'),path['dirname'](_0x3330e2[_0xb1ee('0x7')])),'ignore':[path[_0xb1ee('0x4b')](path[_0xb1ee('0x58')](_0x3330e2[_0xb1ee('0x7')]),_0xb1ee('0x59')),path[_0xb1ee('0x4b')](path[_0xb1ee('0x58')](_0x3330e2[_0xb1ee('0x7')]),_0xb1ee('0x5a'))],'nodir':!![]})['finalize']();_0x3e7175['on'](_0xb1ee('0x5b'),function(){if(!fs[_0xb1ee('0x5c')](_0x459955)){throw new db[(_0xb1ee('0x53'))][(_0xb1ee('0x54'))](_0xb1ee('0x5d'));}return _0x29fd8c[_0xb1ee('0x5e')](_0x459955,util[_0xb1ee('0x4e')](_0xb1ee('0x4f'),path[_0xb1ee('0x58')](_0x3330e2[_0xb1ee('0x7')])),function(_0x4c9557){if(_0x4c9557){throw new db[(_0xb1ee('0x53'))][(_0xb1ee('0x54'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb1ee('0x5f')](_0x459955);logger[_0xb1ee('0x60')]('Download\x20completed');logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0xb1ee('0x47')](handleError(_0x29fd8c,null));};exports[_0xb1ee('0x61')]=function(_0x128875,_0x30b3a7,_0x40cd93){var _0x17a781=path[_0xb1ee('0x58')](_0x128875[_0xb1ee('0x62')][_0xb1ee('0x63')],path[_0xb1ee('0x64')](_0x128875['file'][_0xb1ee('0x63')]));var _0x38e5b4=path[_0xb1ee('0x4b')](config[_0xb1ee('0x4c')],_0xb1ee('0x4d'),_0x128875[_0xb1ee('0x62')][_0xb1ee('0x63')]);var _0x2cce2f=path[_0xb1ee('0x4b')](config['root'],_0xb1ee('0x4d'),_0x17a781);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x38e5b4);logger['info'](_0xb1ee('0x65'),_0x2cce2f);try{fs[_0xb1ee('0x66')](_0x38e5b4,parseInt('0777',0x8));extract(_0x38e5b4,{'dir':_0x2cce2f},function(_0x38a0c3){if(_0x38a0c3){logger[_0xb1ee('0x2d')](_0x38a0c3);handleError(_0x38a0c3,!![]);};var _0x45fd95=fs[_0xb1ee('0x67')](_0x2cce2f);if(_0x45fd95[_0xb1ee('0x49')]>0x1){removeReferences(_0x38e5b4,_0x2cce2f);logger[_0xb1ee('0x2d')](_0xb1ee('0x68'));return _0x40cd93(new Error(_0xb1ee('0x68')));}var _0x550ffb=fs[_0xb1ee('0x69')](path[_0xb1ee('0x4b')](_0x2cce2f,_0x45fd95[0x0]));if(_0x550ffb[_0xb1ee('0x6a')]()){removeReferences(_0x38e5b4,_0x2cce2f);logger[_0xb1ee('0x2d')](_0xb1ee('0x68'));return _0x40cd93(new Error(_0xb1ee('0x68')));}if(_0x550ffb[_0xb1ee('0x6b')]()){var _0x1bdee7=fs[_0xb1ee('0x67')](path[_0xb1ee('0x4b')](_0x2cce2f,_0x45fd95[0x0]));if(_0x1bdee7['length']===0x0){removeReferences(_0x38e5b4,_0x2cce2f);logger[_0xb1ee('0x2d')](_0xb1ee('0x68'));return _0x40cd93(new Error('Invalid\x20plugin\x20structure'));}var _0x2ae2b7=_0x1bdee7[_0xb1ee('0x6c')](function(_0x91e227){return _0x91e227===_0xb1ee('0x6d');});if(!_0x2ae2b7){return _0x40cd93(new Error('Plugin\x20manifest\x20missing'));}var _0x214dc8=fs[_0xb1ee('0x6e')](path[_0xb1ee('0x4b')](_0x2cce2f,_0x45fd95[0x0],_0xb1ee('0x6d')));var _0x2e45e6=JSON['parse'](_0x214dc8);if(_0xb1ee('0x23')==typeof _0x2e45e6[_0xb1ee('0x2f')]){return _0x40cd93(new Error(_0xb1ee('0x6f')));}if(_0xb1ee('0x23')==typeof _0x2e45e6['type']){return _0x40cd93(new Error(_0xb1ee('0x70')));}if('undefined'==typeof _0x2e45e6[_0xb1ee('0x71')]){return _0x40cd93(new Error(_0xb1ee('0x72')));}if(_0xb1ee('0x23')==typeof _0x2e45e6[_0xb1ee('0x73')]){return _0x40cd93(new Error(_0xb1ee('0x74')));}if(_0x2e45e6[_0xb1ee('0x33')]==='html'){if(_0xb1ee('0x23')==typeof _0x2e45e6[_0xb1ee('0x73')]['views']){return _0x40cd93(new Error(_0xb1ee('0x75')));}if(_0xb1ee('0x23')==typeof _0x2e45e6['parameters'][_0xb1ee('0x76')][_0xb1ee('0x77')]&&_0xb1ee('0x23')==typeof _0x2e45e6['parameters'][_0xb1ee('0x76')]['agent']){return _0x40cd93(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x2e45e6[_0xb1ee('0x33')]===_0xb1ee('0x78')){if(_0xb1ee('0x23')==typeof _0x2e45e6[_0xb1ee('0x73')][_0xb1ee('0x79')]){return _0x40cd93(new Error(_0xb1ee('0x7a')));}if(_0xb1ee('0x23')==typeof _0x2e45e6[_0xb1ee('0x73')]['scriptPath']){return _0x40cd93(new Error(_0xb1ee('0x7b')));}}else{return _0x40cd93(new Error(_0xb1ee('0x7c')));}var _0x2e891f=_0x2e45e6[_0xb1ee('0x2f')];var _0x14fc87=_0x2e45e6[_0xb1ee('0x7d')];var _0xf621f7=_0x2e45e6['type'];var _0x2cf6c7=_0x2e45e6[_0xb1ee('0x7e')]?_0x2e45e6[_0xb1ee('0x7e')]:_0xb1ee('0x7f');var _0x519029=_0x2e45e6['icon']?_0x2e45e6[_0xb1ee('0x80')]:_0xb1ee('0x81');var _0x1d95d8='';var _0x5b4625='';var _0xfea895='';var _0x375ceb='';var _0x52d5e7=_0x2e45e6[_0xb1ee('0x71')];if(_0xf621f7===_0xb1ee('0x82')){if(_0xb1ee('0x23')!=typeof _0x2e45e6['parameters'][_0xb1ee('0x76')][_0xb1ee('0x77')]){var _0x28bb4e=_0x2e45e6[_0xb1ee('0x73')][_0xb1ee('0x76')][_0xb1ee('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xb1ee('0x83')](_0x28bb4e)){_0x1d95d8=path[_0xb1ee('0x4b')]('plugins',_0x17a781,_0x45fd95[0x0],_0x28bb4e);}else{_0x1d95d8=_0x28bb4e;}}else{logger['info'](_0xb1ee('0x84'));}if('undefined'!=typeof _0x2e45e6[_0xb1ee('0x73')]['views']['agent']){var _0x484643=_0x2e45e6[_0xb1ee('0x73')]['views'][_0xb1ee('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x484643)){_0x5b4625=path[_0xb1ee('0x4b')](_0xb1ee('0x86'),_0x17a781,_0x45fd95[0x0],_0x484643);}else{_0x5b4625=_0x484643;}}else{logger['info'](_0xb1ee('0x87'));}}else if(_0xf621f7===_0xb1ee('0x78')){_0xfea895=_0x2e45e6['parameters'][_0xb1ee('0x79')];_0x375ceb=_0x2e45e6[_0xb1ee('0x73')]['scriptPath'];if('undefined'!=typeof _0x2e45e6[_0xb1ee('0x73')][_0xb1ee('0x76')]){if(_0xb1ee('0x23')!=typeof _0x2e45e6[_0xb1ee('0x73')][_0xb1ee('0x76')][_0xb1ee('0x77')]){var _0x28bb4e=_0x2e45e6[_0xb1ee('0x73')][_0xb1ee('0x76')][_0xb1ee('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xb1ee('0x83')](_0x28bb4e)){_0x1d95d8=path[_0xb1ee('0x4b')]('plugins',_0x17a781,_0x45fd95[0x0],_0x28bb4e);}else{_0x1d95d8=_0x28bb4e;}}if(_0xb1ee('0x23')!=typeof _0x2e45e6[_0xb1ee('0x73')][_0xb1ee('0x76')]['agent']){var _0x484643=_0x2e45e6['parameters'][_0xb1ee('0x76')][_0xb1ee('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xb1ee('0x83')](_0x484643)){_0x5b4625=path[_0xb1ee('0x4b')](_0xb1ee('0x86'),_0x17a781,_0x45fd95[0x0],_0x484643);}else{_0x5b4625=_0x484643;}}}}var _0x101a59={'name':_0x2e891f,'description':_0x14fc87,'path':path[_0xb1ee('0x4b')](_0x17a781,_0x45fd95[0x0]),'type':_0xf621f7,'sidebar':_0x2cf6c7,'icon':_0x519029,'adminUrl':_0x1d95d8,'agentUrl':_0x5b4625,'scriptName':_0xfea895,'scriptPath':_0x375ceb,'version':_0x52d5e7};removeReferences(_0x38e5b4,null);return db[_0xb1ee('0x44')][_0xb1ee('0x88')](_0x101a59)['then'](function(_0x1700bb){var _0x1d9afb={'role':_0x128875['body']['role'],'userProfileId':_0x128875['body'][_0xb1ee('0x89')]};if(!_0x1d9afb)throw new Error(_0xb1ee('0x8a'));if(_0x1d9afb['role']==='user'){var _0x30bd77=_0x1700bb['get']({'plain':!![]});return db['UserProfileSection'][_0xb1ee('0x4a')]({'where':{'name':_0xb1ee('0x2b'),'userProfileId':_0x1d9afb[_0xb1ee('0x89')]},'raw':!![]})[_0xb1ee('0x29')](function(_0x15caca){if(_0x15caca&&_0x15caca[_0xb1ee('0x8b')]===0x0){return db[_0xb1ee('0x2c')][_0xb1ee('0x88')]({'name':_0x30bd77['name'],'resourceId':_0x30bd77['id'],'type':_0x15caca['name'],'sectionId':_0x15caca['id']},{})[_0xb1ee('0x29')](function(){return _0x1700bb;});}else{return _0x1700bb;}})[_0xb1ee('0x47')](function(_0x25d13f){logger['error'](_0xb1ee('0x8c'),_0x25d13f);throw _0x25d13f;});}return _0x1700bb;})[_0xb1ee('0x29')](respondWithResult(_0x30b3a7,null))[_0xb1ee('0x47')](handleError(_0x30b3a7,null));}});}catch(_0x381ec1){_0x30b3a7[_0xb1ee('0x1f')](0x1f4)[_0xb1ee('0x8d')](_0x381ec1);}};function removeReferences(_0x5c3ada,_0x395c19){try{if(_0x5c3ada){fs[_0xb1ee('0x5f')](_0x5c3ada);logger['info'](_0xb1ee('0x8e'));}if(_0x395c19){rimraf(_0x395c19,function(){});logger[_0xb1ee('0x60')](_0xb1ee('0x8f'));}}catch(_0x3b7a1c){logger['error'](_0x3b7a1c);}}exports[_0xb1ee('0x28')]=function(_0xa4dd8,_0x22d6d9,_0x1971a9){return db[_0xb1ee('0x44')][_0xb1ee('0x4a')]({'where':{'id':_0xa4dd8[_0xb1ee('0x48')]['id']}})['then'](handleEntityNotFound(_0x22d6d9,null))['then'](saveUpdates(_0xa4dd8[_0xb1ee('0x90')],null))[_0xb1ee('0x29')](respondWithResult(_0x22d6d9,null))[_0xb1ee('0x47')](handleError(_0x22d6d9,null));};exports[_0xb1ee('0x91')]=function(_0x14534d,_0x5b01d2,_0x219c90){return db[_0xb1ee('0x44')][_0xb1ee('0x4a')]({'where':{'id':_0x14534d['params']['id']}})['then'](function(_0x32b115){if(_0x32b115){return _0x32b115[_0xb1ee('0x2a')]();}})['then'](function(_0x7f340b){rimraf(path[_0xb1ee('0x4b')](config[_0xb1ee('0x4c')],_0xb1ee('0x4d'),path[_0xb1ee('0x92')](_0x7f340b[_0xb1ee('0x7')])),function(){});return _0x7f340b;})[_0xb1ee('0x29')](handleEntityNotFound(_0x5b01d2,null))[_0xb1ee('0x29')](respondWithStatusCode(_0x5b01d2,null))['catch'](handleError(_0x5b01d2,null));};exports[_0xb1ee('0x93')]=function(_0x160a58,_0x48ace3,_0x780cac){return BPromise[_0xb1ee('0x94')]()[_0xb1ee('0x29')](function(){if(!_0x160a58[_0xb1ee('0x35')]['path']){throw new Error(_0xb1ee('0x95'));}if(!_0x160a58['query']['port']){throw new Error(_0xb1ee('0x96'));}var _0x13274e=_0x160a58[_0xb1ee('0x35')][_0xb1ee('0x97')]?_0x160a58['query'][_0xb1ee('0x97')]+':'+_0x160a58[_0xb1ee('0x35')][_0xb1ee('0x98')]:_0xb1ee('0x99')+_0x160a58[_0xb1ee('0x35')][_0xb1ee('0x98')];var _0x4d66e0=_0x160a58[_0xb1ee('0x35')]['json']?_0x160a58[_0xb1ee('0x35')]['json']:!![];var _0x3a62e2=_0x160a58[_0xb1ee('0x35')]['encoding']?_0x160a58['query'][_0xb1ee('0x9a')]:null;var _0x2e33b0={'method':_0x160a58[_0xb1ee('0x9b')],'uri':util[_0xb1ee('0x4e')](_0xb1ee('0x9c'),_0x13274e,_0x160a58['query'][_0xb1ee('0x7')]),'json':_0x4d66e0,'resolveWithFullResponse':!![],'encoding':_0x3a62e2,'qs':_0x160a58[_0xb1ee('0x35')]};if(_0x160a58['headers']){_0x2e33b0['headers']=_0x160a58[_0xb1ee('0x9d')];if(_0x2e33b0[_0xb1ee('0x9d')][_0xb1ee('0x9e')]){delete _0x2e33b0[_0xb1ee('0x9d')][_0xb1ee('0x9e')];}}if(_0x2e33b0[_0xb1ee('0x9d')][_0xb1ee('0x9f')]){delete _0x2e33b0[_0xb1ee('0x9d')][_0xb1ee('0x9f')];}return rp(_0x2e33b0);})[_0xb1ee('0x29')](function(_0x1bbbd9){if(_0x1bbbd9){_0x48ace3['set'](_0x1bbbd9[_0xb1ee('0x9d')]);logger[_0xb1ee('0x60')](_0x1bbbd9[_0xb1ee('0x90')]);if(_[_0xb1ee('0xa0')](_0x160a58[_0xb1ee('0x35')][_0xb1ee('0x7')],'download')&&_0x1bbbd9[_0xb1ee('0xa1')]==0x1f4){return _0x48ace3['sendStatus'](_0x1bbbd9[_0xb1ee('0xa1')]);}else{return _0x48ace3[_0xb1ee('0x1f')](_0x1bbbd9[_0xb1ee('0xa1')])[_0xb1ee('0x8d')](_0x1bbbd9['body']);}}else{return _0x48ace3[_0xb1ee('0x1e')](0xc8);}})[_0xb1ee('0x47')](handleError(_0x48ace3,null));};exports[_0xb1ee('0xa2')]=function(_0x457d79,_0x2f1990,_0x299ba9){return BPromise[_0xb1ee('0x94')]()[_0xb1ee('0x29')](function(){if(!_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x7')]){throw new Error(_0xb1ee('0x95'));}if(!_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x27140f=_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x97')]?_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x97')]+':'+_0x457d79['query'][_0xb1ee('0x98')]:_0xb1ee('0x99')+_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x98')];var _0x57f410=_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x26')]?_0x457d79[_0xb1ee('0x35')][_0xb1ee('0x26')]:!![];var _0x3a4d63=_0x457d79[_0xb1ee('0x35')]['encoding']?_0x457d79[_0xb1ee('0x35')]['encoding']:null;var _0x48ae20={'method':_0x457d79[_0xb1ee('0x9b')],'uri':util[_0xb1ee('0x4e')]('%s%s',_0x27140f,_0x457d79[_0xb1ee('0x35')]['path']),'json':_0x57f410,'resolveWithFullResponse':!![],'encoding':_0x3a4d63,'body':_0x457d79[_0xb1ee('0x90')]};if(_0x457d79['headers']){_0x48ae20['headers']=_0x457d79[_0xb1ee('0x9d')];if(_0x48ae20[_0xb1ee('0x9d')][_0xb1ee('0x9e')]){delete _0x48ae20['headers'][_0xb1ee('0x9e')];}}if(_0x48ae20[_0xb1ee('0x9d')][_0xb1ee('0x9f')]){delete _0x48ae20[_0xb1ee('0x9d')]['content-type'];}return rp(_0x48ae20);})['then'](function(_0x752d38){if(_0x752d38){_0x2f1990[_0xb1ee('0x25')](_0x752d38[_0xb1ee('0x9d')]);logger[_0xb1ee('0x60')](_0x752d38[_0xb1ee('0x90')]);return _0x2f1990['status'](_0x752d38[_0xb1ee('0xa1')])[_0xb1ee('0x8d')](_0x752d38[_0xb1ee('0x90')]);}else{return _0x2f1990['sendStatus'](0xc8);}})[_0xb1ee('0x47')](handleError(_0x2f1990,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c7d9833..0b1cb79 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 _0x49c1=['Plugin','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x49c1,0xef));var _0x149c=function(_0x43130c,_0x11548f){_0x43130c=_0x43130c-0x0;var _0x17687b=_0x49c1[_0x43130c];return _0x17687b;};'use strict';var EventEmitter=require(_0x149c('0x0'));var Plugin=require('../../mysqldb')['db'][_0x149c('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x149c('0x2')](0x0);var events={'afterCreate':_0x149c('0x3'),'afterUpdate':'update','afterDestroy':_0x149c('0x4')};function emitEvent(_0x2297bf){return function(_0x4c3294,_0xdb4fdf,_0x8c3ab2){PluginEvents['emit'](_0x2297bf+':'+_0x4c3294['id'],_0x4c3294);PluginEvents[_0x149c('0x5')](_0x2297bf,_0x4c3294);_0x8c3ab2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x149c('0x6')](e,emitEvent(event));}}module[_0x149c('0x7')]=PluginEvents; \ No newline at end of file +var _0xa3eb=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save','update','remove','emit'];(function(_0x454b11,_0x4075cf){var _0x3241f2=function(_0x4d250f){while(--_0x4d250f){_0x454b11['push'](_0x454b11['shift']());}};_0x3241f2(++_0x4075cf);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa3eb[_0x134c2e];return _0x2825db;};'use strict';var EventEmitter=require(_0xba3e('0x0'));var Plugin=require(_0xba3e('0x1'))['db'][_0xba3e('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba3e('0x3'),'afterUpdate':_0xba3e('0x4'),'afterDestroy':_0xba3e('0x5')};function emitEvent(_0x3905e4){return function(_0x1c512e,_0x24a0f8,_0x113a07){PluginEvents[_0xba3e('0x6')](_0x3905e4+':'+_0x1c512e['id'],_0x1c512e);PluginEvents[_0xba3e('0x6')](_0x3905e4,_0x1c512e);_0x113a07(null);};}for(var e in events){if(events[_0xba3e('0x7')](e)){var event=events[e];Plugin[_0xba3e('0x8')](e,emitEvent(event));}}module[_0xba3e('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ad0452c..bd0bb98 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 _0x7ec7=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','util'];(function(_0x8a9138,_0x3d5d9d){var _0x2f95b0=function(_0x1cd7b2){while(--_0x1cd7b2){_0x8a9138['push'](_0x8a9138['shift']());}};_0x2f95b0(++_0x3d5d9d);}(_0x7ec7,0x1a2));var _0x77ec=function(_0x160596,_0x997e82){_0x160596=_0x160596-0x0;var _0x269036=_0x7ec7[_0x160596];return _0x269036;};'use strict';var _=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var logger=require(_0x77ec('0x2'))(_0x77ec('0x3'));var moment=require('moment');var BPromise=require(_0x77ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77ec('0x5'));var rimraf=require(_0x77ec('0x6'));var config=require(_0x77ec('0x7'));var attributes=require(_0x77ec('0x8'));module[_0x77ec('0x9')]=function(_0x3c03e5,_0x54f6f0){return _0x3c03e5[_0x77ec('0xa')]('Plugin',attributes,{'tableName':_0x77ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f5=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Plugin'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x39c760,_0x4daa3d){_0x39c760=_0x39c760-0x0;var _0x472eb3=_0xc4f5[_0x39c760];return _0x472eb3;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var logger=require(_0x5c4f('0x1'))(_0x5c4f('0x2'));var moment=require('moment');var BPromise=require(_0x5c4f('0x3'));var rp=require(_0x5c4f('0x4'));var fs=require('fs');var path=require(_0x5c4f('0x5'));var rimraf=require(_0x5c4f('0x6'));var config=require(_0x5c4f('0x7'));var attributes=require('./plugin.attributes');module[_0x5c4f('0x8')]=function(_0x299b8b,_0x3fd7bb){return _0x299b8b[_0x5c4f('0x9')](_0x5c4f('0xa'),attributes,{'tableName':'plugins','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 e1fb788..e53f311 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 _0x2226=['redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5cbab1,_0x32afac){var _0x2637f4=function(_0x47abed){while(--_0x47abed){_0x5cbab1['push'](_0x5cbab1['shift']());}};_0x2637f4(++_0x32afac);}(_0x2226,0x138));var _0x6222=function(_0x477598,_0x4dab5c){_0x477598=_0x477598-0x0;var _0x4c7ffb=_0x2226[_0x477598];return _0x4c7ffb;};'use strict';var _=require(_0x6222('0x0'));var util=require(_0x6222('0x1'));var moment=require(_0x6222('0x2'));var BPromise=require(_0x6222('0x3'));var rs=require(_0x6222('0x4'));var fs=require('fs');var Redis=require(_0x6222('0x5'));var db=require(_0x6222('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6222('0x7'))(_0x6222('0x8'));var config=require(_0x6222('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6222('0xa')][_0x6222('0xb')]({'port':0x232a});config[_0x6222('0xc')]=_[_0x6222('0xd')](config['redis'],{'host':_0x6222('0xe'),'port':0x18eb});var socket=require(_0x6222('0xf'))(new Redis(config[_0x6222('0xc')]));require(_0x6222('0x10'))[_0x6222('0x11')](socket);function respondWithRpcPromise(_0x46dc84,_0x555cfa,_0x1fc670){return new BPromise(function(_0x4142e1,_0x45e61c){return client[_0x6222('0x12')](_0x46dc84,_0x1fc670)[_0x6222('0x13')](function(_0x12a463){logger['info'](_0x6222('0x14'),_0x555cfa,_0x6222('0x15'));logger[_0x6222('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x555cfa,_0x6222('0x15'),JSON[_0x6222('0x17')](_0x12a463));if(_0x12a463[_0x6222('0x18')]){if(_0x12a463[_0x6222('0x18')][_0x6222('0x19')]===0x1f4){logger[_0x6222('0x18')](_0x6222('0x14'),_0x555cfa,_0x12a463['error'][_0x6222('0x1a')]);return _0x45e61c(_0x12a463['error'][_0x6222('0x1a')]);}logger[_0x6222('0x18')](_0x6222('0x14'),_0x555cfa,_0x12a463[_0x6222('0x18')][_0x6222('0x1a')]);return _0x4142e1(_0x12a463['error'][_0x6222('0x1a')]);}else{logger[_0x6222('0x1b')](_0x6222('0x14'),_0x555cfa,_0x6222('0x15'));_0x4142e1(_0x12a463[_0x6222('0x1c')][_0x6222('0x1a')]);}})[_0x6222('0x1d')](function(_0x5cb8b9){logger[_0x6222('0x18')](_0x6222('0x14'),_0x555cfa,_0x5cb8b9);_0x45e61c(_0x5cb8b9);});});}exports[_0x6222('0x1e')]=function(_0x4170d3){var _0x2fa25b=this;return new Promise(function(_0x1987c3,_0x579732){return db[_0x6222('0x1f')][_0x6222('0x20')](_0x4170d3[_0x6222('0x21')],{'raw':_0x4170d3[_0x6222('0x22')]?_0x4170d3[_0x6222('0x22')][_0x6222('0x23')]===undefined?!![]:![]:!![]})[_0x6222('0x13')](function(_0x28329a){logger[_0x6222('0x1b')]('CreatePlugin',_0x4170d3);logger['debug'](_0x6222('0x1e'),_0x4170d3,JSON[_0x6222('0x17')](_0x28329a));_0x1987c3(_0x28329a);})[_0x6222('0x1d')](function(_0xf49e88){logger[_0x6222('0x18')](_0x6222('0x1e'),_0xf49e88[_0x6222('0x1a')],_0x4170d3);_0x579732(_0x2fa25b[_0x6222('0x18')](0x1f4,_0xf49e88[_0x6222('0x1a')]));});});}; \ No newline at end of file +var _0x792f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','create','body','options','raw','then','debug','util','moment'];(function(_0x19e7f4,_0x58850f){var _0x1e4ffd=function(_0x28648d){while(--_0x28648d){_0x19e7f4['push'](_0x19e7f4['shift']());}};_0x1e4ffd(++_0x58850f);}(_0x792f,0x10e));var _0xf792=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x792f[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0xf792('0x0'));var moment=require(_0xf792('0x1'));var BPromise=require(_0xf792('0x2'));var rs=require(_0xf792('0x3'));var fs=require('fs');var Redis=require(_0xf792('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf792('0x5'));var logger=require(_0xf792('0x6'))(_0xf792('0x7'));var config=require('../../config/environment');var jayson=require(_0xf792('0x8'));var client=jayson[_0xf792('0x9')][_0xf792('0xa')]({'port':0x232a});config[_0xf792('0xb')]=_[_0xf792('0xc')](config['redis'],{'host':_0xf792('0xd'),'port':0x18eb});var socket=require(_0xf792('0xe'))(new Redis(config[_0xf792('0xb')]));require(_0xf792('0xf'))[_0xf792('0x10')](socket);function respondWithRpcPromise(_0x41a140,_0x3feefa,_0x43dadf){return new BPromise(function(_0x213aac,_0x2a9c73){return client[_0xf792('0x11')](_0x41a140,_0x43dadf)['then'](function(_0x47ff16){logger[_0xf792('0x12')](_0xf792('0x13'),_0x3feefa,_0xf792('0x14'));logger['debug'](_0xf792('0x15'),_0x3feefa,_0xf792('0x14'),JSON[_0xf792('0x16')](_0x47ff16));if(_0x47ff16[_0xf792('0x17')]){if(_0x47ff16['error']['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x3feefa,_0x47ff16[_0xf792('0x17')][_0xf792('0x18')]);return _0x2a9c73(_0x47ff16[_0xf792('0x17')]['message']);}logger[_0xf792('0x17')](_0xf792('0x13'),_0x3feefa,_0x47ff16[_0xf792('0x17')][_0xf792('0x18')]);return _0x213aac(_0x47ff16[_0xf792('0x17')][_0xf792('0x18')]);}else{logger[_0xf792('0x12')](_0xf792('0x13'),_0x3feefa,_0xf792('0x14'));_0x213aac(_0x47ff16[_0xf792('0x19')]['message']);}})[_0xf792('0x1a')](function(_0x29289c){logger['error']('Plugin,\x20%s,\x20%s',_0x3feefa,_0x29289c);_0x2a9c73(_0x29289c);});});}exports[_0xf792('0x1b')]=function(_0x53e52e){var _0x2710fc=this;return new Promise(function(_0x40b145,_0x5718f1){return db['Plugin'][_0xf792('0x1c')](_0x53e52e[_0xf792('0x1d')],{'raw':_0x53e52e[_0xf792('0x1e')]?_0x53e52e[_0xf792('0x1e')][_0xf792('0x1f')]===undefined?!![]:![]:!![]})[_0xf792('0x20')](function(_0x4792ec){logger[_0xf792('0x12')]('CreatePlugin',_0x53e52e);logger[_0xf792('0x21')](_0xf792('0x1b'),_0x53e52e,JSON[_0xf792('0x16')](_0x4792ec));_0x40b145(_0x4792ec);})['catch'](function(_0x26108a){logger[_0xf792('0x17')]('CreatePlugin',_0x26108a[_0xf792('0x18')],_0x53e52e);_0x5718f1(_0x2710fc[_0xf792('0x17')](0x1f4,_0x26108a[_0xf792('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8814178..a00bf5a 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 _0x18ae=['register','plugin:','remove','update','emit','removeListener'];(function(_0x1dacfa,_0x1c19ff){var _0x21649e=function(_0x39a67e){while(--_0x39a67e){_0x1dacfa['push'](_0x1dacfa['shift']());}};_0x21649e(++_0x1c19ff);}(_0x18ae,0x13a));var _0xe18a=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0x18ae[_0x485201];return _0x9ca98a;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xe18a('0x0'),_0xe18a('0x1')];function createListener(_0x39f02d,_0x6b1f2e){return function(_0x54897d){_0x6b1f2e[_0xe18a('0x2')](_0x39f02d,_0x54897d);};}function removeListener(_0x51426c,_0xbb3f99){return function(){PluginEvents[_0xe18a('0x3')](_0x51426c,_0xbb3f99);};}exports[_0xe18a('0x4')]=function(_0x4c4599){for(var _0x5cf2fa=0x0,_0x23b4f7=events['length'];_0x5cf2fa<_0x23b4f7;_0x5cf2fa++){var _0x39a550=events[_0x5cf2fa];var _0x5148a2=createListener(_0xe18a('0x5')+_0x39a550,_0x4c4599);PluginEvents['on'](_0x39a550,_0x5148a2);}}; \ No newline at end of file +var _0x08d8=['removeListener','register','length','./plugin.events','save','emit'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x08d8,0x171));var _0x808d=function(_0x231068,_0x5bbe87){_0x231068=_0x231068-0x0;var _0x13aa8b=_0x08d8[_0x231068];return _0x13aa8b;};'use strict';var PluginEvents=require(_0x808d('0x0'));var events=[_0x808d('0x1'),'remove','update'];function createListener(_0x331a1a,_0x90a0dd){return function(_0x5d5aae){_0x90a0dd[_0x808d('0x2')](_0x331a1a,_0x5d5aae);};}function removeListener(_0x524dbe,_0xdf65e){return function(){PluginEvents[_0x808d('0x3')](_0x524dbe,_0xdf65e);};}exports[_0x808d('0x4')]=function(_0x3df1ae){for(var _0x500d12=0x0,_0x5d15cd=events[_0x808d('0x5')];_0x500d12<_0x5d15cd;_0x500d12++){var _0x5af889=events[_0x500d12];var _0x19fe53=createListener('plugin:'+_0x5af889,_0x3df1ae);PluginEvents['on'](_0x5af889,_0x19fe53);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 02f247b..3ac390b 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(_0x2a7e3c,_0x594e32){var _0xb9f547=function(_0x535722){while(--_0x535722){_0x2a7e3c['push'](_0x2a7e3c['shift']());}};_0xb9f547(++_0x594e32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x54ab3a,_0xfa0242){var _0x31a645=function(_0x31debb){while(--_0x31debb){_0x54ab3a['push'](_0x54ab3a['shift']());}};_0x31a645(++_0xfa0242);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 1adfcc6..df68650 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 _0x5b02=['../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','catch','show','describe','params','create','body','script','join'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x5b02,0xe9));var _0x25b0=function(_0x449a8d,_0x8c3c4b){_0x449a8d=_0x449a8d-0x0;var _0x274ab0=_0x5b02[_0x449a8d];return _0x274ab0;};'use strict';var _=require(_0x25b0('0x0'));var pm2=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var path=require('path');var exec=require('child_process')[_0x25b0('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3e1d20,_0x31c9c2){return function(_0x38dc14){if(!_0x38dc14){_0x3e1d20[_0x25b0('0x5')](0x194);;}return _0x38dc14;};}function respondWithResult(_0x2d84a9,_0x4eea55){_0x4eea55=_0x4eea55||0xc8;return function(_0x1d82c6){if(_0x1d82c6){return _0x2d84a9[_0x25b0('0x6')](_0x4eea55)['json'](_0x1d82c6);}return null;};}function handleError(_0x412954,_0x4d3e71){_0x4d3e71=_0x4d3e71||0x1f4;return function(_0x56feca){logger[_0x25b0('0x7')](_0x56feca[_0x25b0('0x8')]);if(_0x56feca[_0x25b0('0x9')]){delete _0x56feca['name'];}_0x412954[_0x25b0('0x6')](_0x4d3e71)[_0x25b0('0xa')](_0x56feca);};}function execChildProcess(){return new BPromise(function(_0x135afb,_0x250d31){exec(_0x25b0('0xb'),function(_0x2f57af,_0x44afbc,_0x10c3fb){logger[_0x25b0('0xc')](_0x44afbc);logger[_0x25b0('0xc')](_0x10c3fb);if(_0x2f57af){logger[_0x25b0('0x7')](_0x2f57af);return _0x250d31(_0x2f57af);}return _0x135afb(_0x44afbc);});});}exports[_0x25b0('0xd')]=function(_0x2048dc,_0x3655c2){return pm2[_0x25b0('0xe')]()[_0x25b0('0xf')](function(_0x293203){if(_0x293203){var _0x211658=_[_0x25b0('0x10')](_0x293203,function(_0x3b89e7){return _0x3b89e7[_0x25b0('0x9')]==='express'||_0x3b89e7['name']===_0x25b0('0x11');});return{'rows':_0x211658,'count':_0x211658['length']};}return null;})[_0x25b0('0xf')](respondWithResult(_0x3655c2,null))[_0x25b0('0x12')](handleError(_0x3655c2,null));};exports[_0x25b0('0x13')]=function(_0x3267b9,_0x5e3a3a){return pm2[_0x25b0('0x14')](_0x3267b9[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x5e3a3a,null))[_0x25b0('0xf')](handleEntityNotFound(_0x5e3a3a,null))[_0x25b0('0x12')](handleError(_0x5e3a3a,null));};exports[_0x25b0('0x16')]=function(_0x54f458,_0x348d36){if(_0x54f458[_0x25b0('0x17')][_0x25b0('0x9')]&&_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]){var _0xea4162=path[_0x25b0('0x19')](__dirname,_0x25b0('0x1a'),_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]);var _0x2b2eda=process[_0x25b0('0x1b')]();process['chdir'](path[_0x25b0('0x1c')](_0xea4162));return execChildProcess()[_0x25b0('0xf')](function(_0x517ec5){process[_0x25b0('0x1d')](_0x2b2eda);return pm2[_0x25b0('0x1e')]({'name':_0x54f458[_0x25b0('0x17')]['name'],'script':_0xea4162});})['then'](function(_0x50089e){pm2[_0x25b0('0x1f')]();return _0x50089e[0x0];})[_0x25b0('0xf')](respondWithResult(_0x348d36,0xc9))[_0x25b0('0x12')](handleError(_0x348d36,null));}else{return _0x348d36[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x20')});}};exports[_0x25b0('0x21')]=function(_0x75ce7a,_0x22e024){if(_0x75ce7a['body']['id']){delete _0x75ce7a[_0x25b0('0x17')]['id'];}var _0xbfba84={'online':'restart','stopped':'stop'};if(_0xbfba84['hasOwnProperty'](_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')])){return pm2[_0xbfba84[_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')]]](_0x75ce7a[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x22e024,0xc8))[_0x25b0('0x12')](handleError(_0x22e024,null));}else{return _0x22e024[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x22')});}};exports[_0x25b0('0x23')]=function(_0x3161c1,_0x1ea374){if(_0x3161c1['body']['id']){delete _0x3161c1['body']['id'];}if(_0x3161c1[_0x25b0('0x15')]['id']){return pm2['delete'](_0x3161c1['params']['id'])[_0x25b0('0xf')](function(_0x419975){pm2[_0x25b0('0x1f')]();return _0x419975[0x0];})[_0x25b0('0xf')](respondWithResult(_0x1ea374,null))[_0x25b0('0x12')](handleError(_0x1ea374,null));}else{return _0x1ea374['status'](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x24')});}}; \ No newline at end of file +var _0x1be1=['stop','hasOwnProperty','status','destroy','delete','Unknown\x20id','../../config/logger','api','child_process','exec','bluebird','sendStatus','json','error','name','send','npm\x20install','info','index','express','motion2','length','then','catch','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart'];(function(_0x4afc80,_0x1743d5){var _0x1d7031=function(_0x44be25){while(--_0x44be25){_0x4afc80['push'](_0x4afc80['shift']());}};_0x1d7031(++_0x1743d5);}(_0x1be1,0x192));var _0x11be=function(_0x10aba7,_0x243de2){_0x10aba7=_0x10aba7-0x0;var _0x203686=_0x1be1[_0x10aba7];return _0x203686;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var path=require('path');var exec=require(_0x11be('0x2'))[_0x11be('0x3')];var BPromise=require(_0x11be('0x4'));function handleEntityNotFound(_0x318d41,_0x504d3a){return function(_0x3ce56d){if(!_0x3ce56d){_0x318d41[_0x11be('0x5')](0x194);;}return _0x3ce56d;};}function respondWithResult(_0x11f793,_0x479719){_0x479719=_0x479719||0xc8;return function(_0xfe8c62){if(_0xfe8c62){return _0x11f793['status'](_0x479719)[_0x11be('0x6')](_0xfe8c62);}return null;};}function handleError(_0x11fc15,_0x246772){_0x246772=_0x246772||0x1f4;return function(_0x461e17){logger[_0x11be('0x7')](_0x461e17['stack']);if(_0x461e17[_0x11be('0x8')]){delete _0x461e17[_0x11be('0x8')];}_0x11fc15['status'](_0x246772)[_0x11be('0x9')](_0x461e17);};}function execChildProcess(){return new BPromise(function(_0x2cd786,_0x40f0d1){exec(_0x11be('0xa'),function(_0x4e013c,_0x447e88,_0xcb8120){logger[_0x11be('0xb')](_0x447e88);logger['info'](_0xcb8120);if(_0x4e013c){logger[_0x11be('0x7')](_0x4e013c);return _0x40f0d1(_0x4e013c);}return _0x2cd786(_0x447e88);});});}exports[_0x11be('0xc')]=function(_0x4ce3ae,_0x44eff2){return pm2['list']()['then'](function(_0x569842){if(_0x569842){var _0x4b6e7e=_['reject'](_0x569842,function(_0x5aa444){return _0x5aa444['name']===_0x11be('0xd')||_0x5aa444['name']===_0x11be('0xe');});return{'rows':_0x4b6e7e,'count':_0x4b6e7e[_0x11be('0xf')]};}return null;})[_0x11be('0x10')](respondWithResult(_0x44eff2,null))[_0x11be('0x11')](handleError(_0x44eff2,null));};exports['show']=function(_0x2ed725,_0x403d7a){return pm2['describe'](_0x2ed725[_0x11be('0x12')]['id'])[_0x11be('0x10')](respondWithResult(_0x403d7a,null))[_0x11be('0x10')](handleEntityNotFound(_0x403d7a,null))['catch'](handleError(_0x403d7a,null));};exports['create']=function(_0x141391,_0x976e51){if(_0x141391[_0x11be('0x13')][_0x11be('0x8')]&&_0x141391['body'][_0x11be('0x14')]){var _0x45136f=path[_0x11be('0x15')](__dirname,_0x11be('0x16'),_0x141391[_0x11be('0x13')][_0x11be('0x14')]);var _0xa944ac=process[_0x11be('0x17')]();process[_0x11be('0x18')](path[_0x11be('0x19')](_0x45136f));return execChildProcess()['then'](function(_0xfe3737){process[_0x11be('0x18')](_0xa944ac);return pm2[_0x11be('0x1a')]({'name':_0x141391['body']['name'],'script':_0x45136f});})[_0x11be('0x10')](function(_0x10ce04){pm2[_0x11be('0x1b')]();return _0x10ce04[0x0];})['then'](respondWithResult(_0x976e51,0xc9))[_0x11be('0x11')](handleError(_0x976e51,null));}else{return _0x976e51['status'](0x1f4)[_0x11be('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x11be('0x1c')]=function(_0xb11f3d,_0x5002d7){if(_0xb11f3d[_0x11be('0x13')]['id']){delete _0xb11f3d[_0x11be('0x13')]['id'];}var _0x1d3b5c={'online':_0x11be('0x1d'),'stopped':_0x11be('0x1e')};if(_0x1d3b5c[_0x11be('0x1f')](_0xb11f3d[_0x11be('0x13')][_0x11be('0x20')])){return pm2[_0x1d3b5c[_0xb11f3d[_0x11be('0x13')]['status']]](_0xb11f3d[_0x11be('0x12')]['id'])['then'](respondWithResult(_0x5002d7,0xc8))[_0x11be('0x11')](handleError(_0x5002d7,null));}else{return _0x5002d7[_0x11be('0x20')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x11be('0x21')]=function(_0x265fc9,_0x5e8f9a){if(_0x265fc9[_0x11be('0x13')]['id']){delete _0x265fc9[_0x11be('0x13')]['id'];}if(_0x265fc9[_0x11be('0x12')]['id']){return pm2[_0x11be('0x22')](_0x265fc9[_0x11be('0x12')]['id'])[_0x11be('0x10')](function(_0x4b527e){pm2[_0x11be('0x1b')]();return _0x4b527e[0x0];})[_0x11be('0x10')](respondWithResult(_0x5e8f9a,null))[_0x11be('0x11')](handleError(_0x5e8f9a,null));}else{return _0x5e8f9a[_0x11be('0x20')](0x1f4)[_0x11be('0x9')]({'message':_0x11be('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index a6c1fe2..970d5a7 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 _0x2512=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','Router'];(function(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x2512,0x9f));var _0x2251=function(_0xc0921a,_0x1f107f){_0xc0921a=_0xc0921a-0x0;var _0x3f6189=_0x2512[_0xc0921a];return _0x3f6189;};'use strict';var express=require('express');var router=express[_0x2251('0x0')]();var auth=require(_0x2251('0x1'));var controller=require(_0x2251('0x2'));router[_0x2251('0x3')](_0x2251('0x4'),auth[_0x2251('0x5')](),controller[_0x2251('0x6')]);router[_0x2251('0x3')](_0x2251('0x7'),auth[_0x2251('0x5')](),controller[_0x2251('0x8')]);module[_0x2251('0x9')]=router; \ No newline at end of file +var _0x7d32=['./realtime.controller','get','isAuthenticated','getAgents','getQueues','exports','express'];(function(_0x100c80,_0x2bff5f){var _0x1f8909=function(_0x46ce1f){while(--_0x46ce1f){_0x100c80['push'](_0x100c80['shift']());}};_0x1f8909(++_0x2bff5f);}(_0x7d32,0x84));var _0x27d3=function(_0xf04272,_0x3adde4){_0xf04272=_0xf04272-0x0;var _0x18b674=_0x7d32[_0xf04272];return _0x18b674;};'use strict';var express=require(_0x27d3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x27d3('0x1'));router[_0x27d3('0x2')]('/agents',auth[_0x27d3('0x3')](),controller[_0x27d3('0x4')]);router['get']('/queues',auth[_0x27d3('0x3')](),controller[_0x27d3('0x5')]);module[_0x27d3('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2ddf8bb..be5ad60 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 _0x60fa=['Queues','initializeQueues','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','count','status','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','forEach','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','assign','getResources','findAndCountAll','find','merge','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','startCase','Queue','outbound','dialActive','dialMethod'];(function(_0x171797,_0x1e596c){var _0x4c3dd4=function(_0xbdf365){while(--_0xbdf365){_0x171797['push'](_0x171797['shift']());}};_0x4c3dd4(++_0x1e596c);}(_0x60fa,0x1dc));var _0xa60f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa60f('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0xa60f('0x1'));var qs=require(_0xa60f('0x2'));var utils=require(_0xa60f('0x3'));var db=require(_0xa60f('0x4'))['db'];var APIBadRequestError=require(_0xa60f('0x5'))['APIBadRequestError'];var APIHandleError=require(_0xa60f('0x5'))[_0xa60f('0x6')];function respondWithFilteredResult(_0x47c22e,_0x274540){return function(_0x591535){if(_0x591535){var _0x5d14ea=typeof _0x274540[_0xa60f('0x7')]===_0xa60f('0x8')&&typeof _0x274540['limit']===_0xa60f('0x8');var _0xad8b9=_0x591535['count'];var _0x4fb465=_0x5d14ea?0x0:_0x274540[_0xa60f('0x7')];var _0x3505bd=_0x5d14ea?_0x591535[_0xa60f('0x9')]:_0x274540[_0xa60f('0x7')]+_0x274540['limit'];var _0x495bb3;if(_0x3505bd>=_0xad8b9){_0x3505bd=_0xad8b9;_0x495bb3=0xc8;}else{_0x495bb3=0xce;}_0x47c22e[_0xa60f('0xa')](_0x495bb3);return _0x47c22e[_0xa60f('0xb')](_0xa60f('0xc'),_0x4fb465+'-'+_0x3505bd+'/'+_0xad8b9)[_0xa60f('0xd')](_0x591535);}return null;};}exports[_0xa60f('0xe')]=function(_0xa877cb,_0x361595){var _0x22ed90={'count':0x0,'rows':[]};var _0x1368ac={};var _0x12d50c;var _0x28a239=utils[_0xa60f('0xf')]();var _0x2e5198;var _0x17e937;var _0xf77171=_0xa877cb[_0xa60f('0x10')]['globalQueueFilter'];var _0x55b089=_0xa877cb['query'][_0xa60f('0x11')];var _0x14fbb4=_0xa877cb[_0xa60f('0x10')][_0xa60f('0x12')];var _0x371731=_0x55b089===_0xa60f('0x13')||_0x55b089==='*pause'?!![]:![];var _0x1de413=[];var _0x15d54b;var _0x2eec74;Promise[_0xa60f('0x14')]()[_0xa60f('0x15')](function(){if(_0xa877cb[_0xa60f('0x10')][_0xa60f('0x16')]){if(!utils[_0xa60f('0x17')](_0xa877cb['query'][_0xa60f('0x16')])){throw new APIBadRequestError(util[_0xa60f('0x18')](_0xa60f('0x19'),_0xa877cb['query']['channel']));}_0x12d50c=_0xa877cb[_0xa60f('0x10')]['channel'][_0xa60f('0x1a')]();}if(!_0xa877cb[_0xa60f('0x10')][_0xa60f('0x1b')]||!_0xa877cb[_0xa60f('0x10')][_0xa60f('0x1b')][_0xa60f('0x1c')](_0xa60f('0x1d'))){_0xa877cb[_0xa60f('0x10')][_0xa60f('0x1b')]=rta[_0xa60f('0x1e')](_0xa877cb['query']['sort']);return;}var _0x28f9fd=rta['getUpdatedSortOptions'](_0xa877cb[_0xa60f('0x10')]['sort']);_0xa877cb[_0xa60f('0x10')][_0xa60f('0x1b')]=_0x28f9fd[_0xa60f('0x1f')][_0xa60f('0x20')](',');_0x15d54b=_0x28f9fd[_0xa60f('0x21')];})[_0xa60f('0x15')](function(){if(!_0xf77171){return[];}return rta['getAgentIdsByQueues'](_0xf77171,_0x12d50c);})['then'](function(_0x444cab){_0x1de413=_0x444cab;return rta[_0xa60f('0x22')]();})['then'](function(_0x5a0c59){_0x17e937=_0x5a0c59[_0xa60f('0x23')];if((!_0x55b089||_0x371731)&&!_0x15d54b){return _0x1de413;}if(_0x15d54b&&!_0x55b089){return rta[_0xa60f('0x24')](_0x17e937,_0x1de413,_0x15d54b);}else{return rta[_0xa60f('0x25')](_0x17e937,_0x1de413,_0x55b089);}})[_0xa60f('0x15')](function(_0x497ea5){_0x1de413=_0x497ea5;var _0x558e42=![];if(_0x1de413[_0xa60f('0x26')]===0x0){if(_0xf77171||_0x55b089){_0x558e42=!![];}if(_0x371731){_0x558e42=![];}}if(_0x558e42){return _0x22ed90;}var _0x3ff5d3=_[_0xa60f('0x27')](db[_0xa60f('0x28')][_0xa60f('0x29')],function(_0x23760d){return{'name':_0x23760d[_0xa60f('0x2a')],'type':_0x23760d[_0xa60f('0x2b')][_0xa60f('0x2c')]};});_0xa877cb[_0xa60f('0x10')][_0xa60f('0x2d')]=_0xa60f('0x2e');_0x1368ac=qs[_0xa60f('0x2f')](_0x3ff5d3,_0xa877cb);_0x1368ac[_0xa60f('0x30')]=!![];var _0x16c477=[];if(_0x1de413[_0xa60f('0x26')]>0x0){_0x16c477[_0xa60f('0x31')]({'id':{'$in':_0x1de413}});if(_0x15d54b&&!_0x55b089){_0x2eec74=[db['sequelize']['literal']('FIELD(id,'+_0x1de413+')')];_0x1368ac[_0xa60f('0x21')]=_0x2eec74;}}if(_0x371731){_0x28a239[_0xa60f('0x32')](function(_0x157ead){var _0x61941d=!![];if(_0x55b089==='*pause'&&_0x12d50c!==_0x157ead){_0x61941d=![];}_0x16c477[_0xa60f('0x31')]({[_0x157ead+_0xa60f('0x33')]:_0x61941d});});if(_0x14fbb4){_0x16c477[_0xa60f('0x31')]({'pauseType':_0x14fbb4});}}else if(_0x55b089){_0x28a239[_0xa60f('0x32')](function(_0x27de61){_0x16c477[_0xa60f('0x31')]({[_0x27de61+_0xa60f('0x33')]:![]});});}_0x1368ac[_0xa60f('0x34')]=_['merge'](_0x1368ac[_0xa60f('0x34')],{'$and':_0x16c477});if(_0xa877cb[_0xa60f('0x35')][_0xa60f('0x2d')]==='user'){var _0x3b82f9={'params':{'id':_0xa877cb['user'][_0xa60f('0x36')]},'query':{'section':_0xa60f('0x37'),'role':_0xa60f('0x2e'),'raw':!![],'ids':_0x1de413,'customSorting':_0x2eec74}};if(_0xa877cb[_0xa60f('0x10')][_0xa60f('0x38')]){_0x3b82f9['query'][_0xa60f('0x38')]=!![];}if(_0x371731){_0x3b82f9[_0xa60f('0x10')][_0xa60f('0x39')]=_0x16c477;}_0x3b82f9[_0xa60f('0x10')]=Object[_0xa60f('0x3a')](_0x3b82f9['query'],_0xa877cb[_0xa60f('0x10')]);return db['UserProfile'][_0xa60f('0x3b')](_0x3b82f9);}return db[_0xa60f('0x28')][_0xa60f('0x3c')](_0x1368ac);})[_0xa60f('0x15')](function(_0x46c6fe){_0x22ed90[_0xa60f('0x9')]=_0x46c6fe[_0xa60f('0x9')];_0x2e5198=_0x46c6fe['rows'];return _0x2e5198[_0xa60f('0x27')](function(_0x5b4f5e){var _0x1da433=_[_0xa60f('0x3d')](_0x17e937,['id',_0x5b4f5e['id']]);if(_0x1da433){var _0x30f976=rta['filterAgentAttributes'](_0x1da433);_[_0xa60f('0x3e')](_0x5b4f5e,_0x30f976);}_0x5b4f5e[_0xa60f('0x1d')]=rta[_0xa60f('0x3f')](_0x5b4f5e);if(_0x5b4f5e[_0xa60f('0x1d')][_0xa60f('0x1c')]('pause')){_0x28a239[_0xa60f('0x32')](function(_0x38e386){if(_0x5b4f5e[_0x38e386+_0xa60f('0x33')]){if(_0x38e386===_0xa60f('0x40')){if(_0x5b4f5e[_0xa60f('0x41')]!==_0xa60f('0x42')){_0x5b4f5e[_0xa60f('0x41')]=_0xa60f('0x13');}}else{_0x5b4f5e[_0x38e386+_0xa60f('0x43')]=_0xa60f('0x13');}}});}return _0x5b4f5e;});})[_0xa60f('0x15')](function(_0x59ef8f){if(!_0x15d54b||_0x2eec74){return _0x59ef8f;}return rta[_0xa60f('0x44')](_0x59ef8f,_0x15d54b);})['then'](function(_0x5bc39d){var _0x4359f3=rta[_0xa60f('0x45')]();_0x22ed90[_0xa60f('0x23')]=_0x5bc39d[_0xa60f('0x27')](function(_0x199bf8){return _[_0xa60f('0x46')](_0x199bf8,_0x4359f3);});return _0x22ed90;})[_0xa60f('0x15')](respondWithFilteredResult(_0x361595,_0x1368ac))[_0xa60f('0x47')](APIHandleError(_0x361595));};exports['getQueues']=function(_0x31b404,_0x3f8641){var _0x21d87a={'count':0x0,'rows':[]};var _0x3b7156={};var _0x9e567e;var _0x17fb76;var _0x40aebd;Promise['resolve']()[_0xa60f('0x15')](function(){if(_0x31b404['query'][_0xa60f('0x16')]){if(!utils[_0xa60f('0x17')](_0x31b404['query'][_0xa60f('0x16')])){throw new APIBadRequestError(util[_0xa60f('0x18')](_0xa60f('0x19'),_0x31b404[_0xa60f('0x10')]['channel']));}_0x9e567e=_0x31b404['query'][_0xa60f('0x16')][_0xa60f('0x1a')]();}var _0x1c41be=_[_0xa60f('0x48')](_0x9e567e)+_0xa60f('0x49');var _0x34c395=_['map'](db[_0x1c41be][_0xa60f('0x29')],function(_0xe6fcd5){return{'name':_0xe6fcd5[_0xa60f('0x2a')],'type':_0xe6fcd5['type']['key']};});if(!_0x31b404[_0xa60f('0x10')][_0xa60f('0x1f')]){var _0x426778=['id','name'];if(_0x9e567e===_0xa60f('0x40')){_0x426778[_0xa60f('0x31')](_0xa60f('0x2b'));if(_0x31b404['query']['type']===_0xa60f('0x4a')){_0x426778['push']([_0xa60f('0x4b'),_0xa60f('0x4c')]);}}_0x31b404[_0xa60f('0x10')][_0xa60f('0x1f')]=_0x426778[_0xa60f('0x20')](',');}_0x3b7156=qs[_0xa60f('0x2f')](_0x34c395,_0x31b404);if(_0x31b404[_0xa60f('0x35')][_0xa60f('0x2d')]===_0xa60f('0x35')){var _0x146230={'params':{'id':_0x31b404[_0xa60f('0x35')][_0xa60f('0x36')]},'query':{'section':_0x9e567e===_0xa60f('0x40')&&_0x31b404[_0xa60f('0x10')]['type']===_0xa60f('0x4a')?'QueueCampaigns':_['startCase'](_0x9e567e)+_0xa60f('0x4d'),'type':_0x31b404['query'][_0xa60f('0x2b')],'nolimit':!![],'sort':'name','filter':_0x31b404[_0xa60f('0x10')]['filter']}};_0x146230[_0xa60f('0x10')]=Object['assign'](_0x146230[_0xa60f('0x10')],_0x31b404[_0xa60f('0x10')]);delete _0x146230[_0xa60f('0x10')]['id'];return db['UserProfile']['getResources'](_0x146230);}return db[_0x1c41be][_0xa60f('0x3c')](_0x3b7156);})[_0xa60f('0x15')](function(_0x17987a){_0x21d87a[_0xa60f('0x9')]=_0x17987a[_0xa60f('0x9')];_0x17fb76=_0x17987a[_0xa60f('0x23')];return rtq['getRealtimeQueues'](_0x31b404,_0x9e567e);})[_0xa60f('0x15')](function(_0x42ae3d){_0x40aebd=_0x42ae3d[_0xa60f('0x23')];return rtq[_0xa60f('0x4e')](_0x17fb76,_0x40aebd,_0x9e567e,_0x31b404['query'][_0xa60f('0x2b')]);})[_0xa60f('0x15')](function(_0x485155){_0x21d87a[_0xa60f('0x23')]=_0x485155;return _0x21d87a;})[_0xa60f('0x15')](respondWithFilteredResult(_0x3f8641,_0x3b7156))[_0xa60f('0x47')](APIHandleError(_0x3f8641));}; \ No newline at end of file +var _0x6cb6=['filter','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','undefined','limit','count','offset','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getRealtimeAgents','rows','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','Pause','where','merge','user','Agents','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','forEach','voice','voiceStatus','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','resolve','startCase','Queue','name','outbound','dialActive','dialMethod','join','userProfileId','Queues'];(function(_0x4011d3,_0x27df5c){var _0x1a1030=function(_0x4ca78a){while(--_0x4ca78a){_0x4011d3['push'](_0x4011d3['shift']());}};_0x1a1030(++_0x27df5c);}(_0x6cb6,0x104));var _0x66cb=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6cb6[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x66cb('0x0'));var util=require(_0x66cb('0x1'));var rta=require(_0x66cb('0x2'));var rtq=require(_0x66cb('0x3'));var qs=require(_0x66cb('0x4'));var utils=require(_0x66cb('0x5'));var db=require(_0x66cb('0x6'))['db'];var APIBadRequestError=require(_0x66cb('0x7'))['APIBadRequestError'];var APIHandleError=require(_0x66cb('0x7'))[_0x66cb('0x8')];function respondWithFilteredResult(_0x2458ea,_0xb2129e){return function(_0x51574e){if(_0x51574e){var _0x3de1ad=typeof _0xb2129e['offset']===_0x66cb('0x9')&&typeof _0xb2129e[_0x66cb('0xa')]===_0x66cb('0x9');var _0x20d7d4=_0x51574e[_0x66cb('0xb')];var _0x6b7758=_0x3de1ad?0x0:_0xb2129e['offset'];var _0x4fb2d7=_0x3de1ad?_0x51574e[_0x66cb('0xb')]:_0xb2129e[_0x66cb('0xc')]+_0xb2129e[_0x66cb('0xa')];var _0x5bac42;if(_0x4fb2d7>=_0x20d7d4){_0x4fb2d7=_0x20d7d4;_0x5bac42=0xc8;}else{_0x5bac42=0xce;}_0x2458ea['status'](_0x5bac42);return _0x2458ea[_0x66cb('0xd')](_0x66cb('0xe'),_0x6b7758+'-'+_0x4fb2d7+'/'+_0x20d7d4)[_0x66cb('0xf')](_0x51574e);}return null;};}exports[_0x66cb('0x10')]=function(_0x578ed4,_0x221e1c){var _0x2d86f6={'count':0x0,'rows':[]};var _0x20dbd4={};var _0x1e7fde;var _0xbe3aaa=utils[_0x66cb('0x11')]();var _0x5968f8;var _0x36fe49;var _0x53fc6e=_0x578ed4[_0x66cb('0x12')]['globalQueueFilter'];var _0x5daebe=_0x578ed4[_0x66cb('0x12')][_0x66cb('0x13')];var _0x3e3bf3=_0x578ed4['query'][_0x66cb('0x14')];var _0x34bc2b=_0x5daebe===_0x66cb('0x15')||_0x5daebe===_0x66cb('0x16')?!![]:![];var _0xc74ee7=[];var _0x205fbf;var _0x4b1818;Promise['resolve']()[_0x66cb('0x17')](function(){if(_0x578ed4[_0x66cb('0x12')]['channel']){if(!utils[_0x66cb('0x18')](_0x578ed4[_0x66cb('0x12')][_0x66cb('0x19')])){throw new APIBadRequestError(util[_0x66cb('0x1a')](_0x66cb('0x1b'),_0x578ed4[_0x66cb('0x12')][_0x66cb('0x19')]));}_0x1e7fde=_0x578ed4[_0x66cb('0x12')][_0x66cb('0x19')][_0x66cb('0x1c')]();}if(!_0x578ed4[_0x66cb('0x12')]['sort']||!_0x578ed4[_0x66cb('0x12')][_0x66cb('0x1d')][_0x66cb('0x1e')](_0x66cb('0x1f'))){_0x578ed4[_0x66cb('0x12')][_0x66cb('0x1d')]=rta[_0x66cb('0x20')](_0x578ed4['query'][_0x66cb('0x1d')]);return;}var _0x6d58b9=rta[_0x66cb('0x21')](_0x578ed4[_0x66cb('0x12')][_0x66cb('0x1d')]);_0x578ed4['query']['sort']=_0x6d58b9[_0x66cb('0x22')]['join'](',');_0x205fbf=_0x6d58b9[_0x66cb('0x23')];})[_0x66cb('0x17')](function(){if(!_0x53fc6e){return[];}return rta['getAgentIdsByQueues'](_0x53fc6e,_0x1e7fde);})[_0x66cb('0x17')](function(_0xf15757){_0xc74ee7=_0xf15757;return rta[_0x66cb('0x24')]();})[_0x66cb('0x17')](function(_0x5b153a){_0x36fe49=_0x5b153a[_0x66cb('0x25')];if((!_0x5daebe||_0x34bc2b)&&!_0x205fbf){return _0xc74ee7;}if(_0x205fbf&&!_0x5daebe){return rta['getSortedAgentsIdsByStatus'](_0x36fe49,_0xc74ee7,_0x205fbf);}else{return rta[_0x66cb('0x26')](_0x36fe49,_0xc74ee7,_0x5daebe);}})[_0x66cb('0x17')](function(_0x513893){_0xc74ee7=_0x513893;var _0x1f7d25=![];if(_0xc74ee7[_0x66cb('0x27')]===0x0){if(_0x53fc6e||_0x5daebe){_0x1f7d25=!![];}if(_0x34bc2b){_0x1f7d25=![];}}if(_0x1f7d25){return _0x2d86f6;}var _0x350329=_[_0x66cb('0x28')](db[_0x66cb('0x29')][_0x66cb('0x2a')],function(_0x2288e7){return{'name':_0x2288e7[_0x66cb('0x2b')],'type':_0x2288e7[_0x66cb('0x2c')][_0x66cb('0x2d')]};});_0x578ed4[_0x66cb('0x12')][_0x66cb('0x2e')]=_0x66cb('0x2f');_0x20dbd4=qs[_0x66cb('0x30')](_0x350329,_0x578ed4);_0x20dbd4[_0x66cb('0x31')]=!![];var _0x9bdbb5=[];if(_0xc74ee7[_0x66cb('0x27')]>0x0){_0x9bdbb5[_0x66cb('0x32')]({'id':{'$in':_0xc74ee7}});if(_0x205fbf&&!_0x5daebe){_0x4b1818=[db['sequelize'][_0x66cb('0x33')](_0x66cb('0x34')+_0xc74ee7+')')];_0x20dbd4[_0x66cb('0x23')]=_0x4b1818;}}if(_0x34bc2b){_0xbe3aaa['forEach'](function(_0x15102b){var _0x55b4ea=!![];if(_0x5daebe===_0x66cb('0x16')&&_0x1e7fde!==_0x15102b){_0x55b4ea=![];}_0x9bdbb5[_0x66cb('0x32')]({[_0x15102b+_0x66cb('0x35')]:_0x55b4ea});});if(_0x3e3bf3){_0x9bdbb5['push']({'pauseType':_0x3e3bf3});}}else if(_0x5daebe){_0xbe3aaa['forEach'](function(_0x299069){_0x9bdbb5[_0x66cb('0x32')]({[_0x299069+_0x66cb('0x35')]:![]});});}_0x20dbd4[_0x66cb('0x36')]=_[_0x66cb('0x37')](_0x20dbd4['where'],{'$and':_0x9bdbb5});if(_0x578ed4['user']['role']===_0x66cb('0x38')){var _0x18bbb5={'params':{'id':_0x578ed4[_0x66cb('0x38')]['userProfileId']},'query':{'section':_0x66cb('0x39'),'role':_0x66cb('0x2f'),'raw':!![],'ids':_0xc74ee7,'customSorting':_0x4b1818}};if(_0x578ed4[_0x66cb('0x12')]['online']){_0x18bbb5['query'][_0x66cb('0x3a')]=!![];}if(_0x34bc2b){_0x18bbb5[_0x66cb('0x12')][_0x66cb('0x3b')]=_0x9bdbb5;}_0x18bbb5['query']=Object[_0x66cb('0x3c')](_0x18bbb5[_0x66cb('0x12')],_0x578ed4[_0x66cb('0x12')]);return db[_0x66cb('0x3d')][_0x66cb('0x3e')](_0x18bbb5);}return db[_0x66cb('0x29')][_0x66cb('0x3f')](_0x20dbd4);})[_0x66cb('0x17')](function(_0x2540ef){_0x2d86f6['count']=_0x2540ef['count'];_0x5968f8=_0x2540ef['rows'];return _0x5968f8[_0x66cb('0x28')](function(_0xce81cf){var _0x390139=_[_0x66cb('0x40')](_0x36fe49,['id',_0xce81cf['id']]);if(_0x390139){var _0x316833=rta[_0x66cb('0x41')](_0x390139);_[_0x66cb('0x37')](_0xce81cf,_0x316833);}_0xce81cf['globalStatus']=rta[_0x66cb('0x42')](_0xce81cf);if(_0xce81cf[_0x66cb('0x1f')][_0x66cb('0x1e')](_0x66cb('0x15'))){_0xbe3aaa[_0x66cb('0x43')](function(_0x4acb4c){if(_0xce81cf[_0x4acb4c+_0x66cb('0x35')]){if(_0x4acb4c===_0x66cb('0x44')){if(_0xce81cf[_0x66cb('0x45')]!=='talking'){_0xce81cf[_0x66cb('0x45')]=_0x66cb('0x15');}}else{_0xce81cf[_0x4acb4c+'Status']=_0x66cb('0x15');}}});}return _0xce81cf;});})['then'](function(_0x239de0){if(!_0x205fbf||_0x4b1818){return _0x239de0;}return rta[_0x66cb('0x46')](_0x239de0,_0x205fbf);})[_0x66cb('0x17')](function(_0x5ab5fd){var _0x16ff1f=rta[_0x66cb('0x47')]();_0x2d86f6[_0x66cb('0x25')]=_0x5ab5fd['map'](function(_0x4ef338){return _[_0x66cb('0x48')](_0x4ef338,_0x16ff1f);});return _0x2d86f6;})[_0x66cb('0x17')](respondWithFilteredResult(_0x221e1c,_0x20dbd4))[_0x66cb('0x49')](APIHandleError(_0x221e1c));};exports['getQueues']=function(_0x12141d,_0x255393){var _0x46ff4d={'count':0x0,'rows':[]};var _0x2f61a6={};var _0x128c22;var _0x2e96db;var _0x4cfb14;Promise[_0x66cb('0x4a')]()[_0x66cb('0x17')](function(){if(_0x12141d[_0x66cb('0x12')][_0x66cb('0x19')]){if(!utils['isValidChannel'](_0x12141d[_0x66cb('0x12')][_0x66cb('0x19')])){throw new APIBadRequestError(util[_0x66cb('0x1a')](_0x66cb('0x1b'),_0x12141d[_0x66cb('0x12')][_0x66cb('0x19')]));}_0x128c22=_0x12141d['query']['channel'][_0x66cb('0x1c')]();}var _0x489330=_[_0x66cb('0x4b')](_0x128c22)+_0x66cb('0x4c');var _0x16df76=_[_0x66cb('0x28')](db[_0x489330][_0x66cb('0x2a')],function(_0x291ce6){return{'name':_0x291ce6['fieldName'],'type':_0x291ce6[_0x66cb('0x2c')]['key']};});if(!_0x12141d[_0x66cb('0x12')][_0x66cb('0x22')]){var _0x2b2dc8=['id',_0x66cb('0x4d')];if(_0x128c22===_0x66cb('0x44')){_0x2b2dc8[_0x66cb('0x32')](_0x66cb('0x2c'));if(_0x12141d['query'][_0x66cb('0x2c')]===_0x66cb('0x4e')){_0x2b2dc8['push']([_0x66cb('0x4f'),_0x66cb('0x50')]);}}_0x12141d[_0x66cb('0x12')][_0x66cb('0x22')]=_0x2b2dc8[_0x66cb('0x51')](',');}_0x2f61a6=qs['getOptions'](_0x16df76,_0x12141d);if(_0x12141d[_0x66cb('0x38')]['role']===_0x66cb('0x38')){var _0x12b634={'params':{'id':_0x12141d[_0x66cb('0x38')][_0x66cb('0x52')]},'query':{'section':_0x128c22===_0x66cb('0x44')&&_0x12141d['query']['type']===_0x66cb('0x4e')?'QueueCampaigns':_[_0x66cb('0x4b')](_0x128c22)+_0x66cb('0x53'),'type':_0x12141d[_0x66cb('0x12')][_0x66cb('0x2c')],'nolimit':!![],'sort':_0x66cb('0x4d'),'filter':_0x12141d[_0x66cb('0x12')][_0x66cb('0x54')]}};_0x12b634[_0x66cb('0x12')]=Object[_0x66cb('0x3c')](_0x12b634[_0x66cb('0x12')],_0x12141d[_0x66cb('0x12')]);delete _0x12b634['query']['id'];return db[_0x66cb('0x3d')]['getResources'](_0x12b634);}return db[_0x489330]['findAndCountAll'](_0x2f61a6);})[_0x66cb('0x17')](function(_0x40d811){_0x46ff4d[_0x66cb('0xb')]=_0x40d811['count'];_0x2e96db=_0x40d811['rows'];return rtq['getRealtimeQueues'](_0x12141d,_0x128c22);})[_0x66cb('0x17')](function(_0x426a1c){_0x4cfb14=_0x426a1c['rows'];return rtq[_0x66cb('0x55')](_0x2e96db,_0x4cfb14,_0x128c22,_0x12141d['query'][_0x66cb('0x2c')]);})['then'](function(_0x3a8504){_0x46ff4d[_0x66cb('0x25')]=_0x3a8504;return _0x46ff4d;})[_0x66cb('0x17')](respondWithFilteredResult(_0x255393,_0x2f61a6))['catch'](APIHandleError(_0x255393));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ffa3740..cba928f 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1e2a2c,_0x1c0399){var _0x2763c4=function(_0x2c3899){while(--_0x2c3899){_0x1e2a2c['push'](_0x1e2a2c['shift']());}};_0x2763c4(++_0x1c0399);}(_0x70e0,0x17b));var _0x070e=function(_0xfbf9f8,_0x1ee4ca){_0xfbf9f8=_0xfbf9f8-0x0;var _0x5b85db=_0x70e0[_0xfbf9f8];return _0x5b85db;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x389fee,_0x18baf5){var _0x1511f6=function(_0x4c27f1){while(--_0x4c27f1){_0x389fee['push'](_0x389fee['shift']());}};_0x1511f6(++_0x18baf5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 37e3c18..a56f54a 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 _0x6bb4=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x3bb787,_0x5a28a1){var _0x11b9c0=function(_0x364cbc){while(--_0x364cbc){_0x3bb787['push'](_0x3bb787['shift']());}};_0x11b9c0(++_0x5a28a1);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x537fff,_0x1a3cdc){_0x537fff=_0x537fff-0x0;var _0x34889b=_0x6bb4[_0x537fff];return _0x34889b;};'use strict';var Sequelize=require(_0x46bb('0x0'));module[_0x46bb('0x1')]={'state':{'type':Sequelize[_0x46bb('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x46bb('0x3')]},'uniqueid':{'type':Sequelize[_0x46bb('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x46bb('0x3')]},'ringtime':{'type':Sequelize[_0x46bb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x46bb('0x4')]},'campaigntype':{'type':Sequelize[_0x46bb('0x4')]},'membername':{'type':Sequelize[_0x46bb('0x4')]}}; \ No newline at end of file +var _0xfc65=['INTEGER','sequelize','STRING','DATE'];(function(_0xcb66c,_0x51d718){var _0x50af38=function(_0x25f466){while(--_0x25f466){_0xcb66c['push'](_0xcb66c['shift']());}};_0x50af38(++_0x51d718);}(_0xfc65,0x1e1));var _0x5fc6=function(_0xa394d7,_0x43f1a3){_0xa394d7=_0xa394d7-0x0;var _0xd75d2f=_0xfc65[_0xa394d7];return _0xd75d2f;};'use strict';var Sequelize=require(_0x5fc6('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5fc6('0x1')]},'scheduledat':{'type':Sequelize[_0x5fc6('0x2')]},'uniqueid':{'type':Sequelize[_0x5fc6('0x1')]},'starttime':{'type':Sequelize[_0x5fc6('0x2')]},'responsetime':{'type':Sequelize[_0x5fc6('0x2')]},'ringtime':{'type':Sequelize[_0x5fc6('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5fc6('0x1')]},'campaigntype':{'type':Sequelize[_0x5fc6('0x1')]},'membername':{'type':Sequelize[_0x5fc6('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index dea540a..da006a2 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 _0x4202=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview'];(function(_0x58f472,_0xdbb060){var _0x4d7f8e=function(_0x26dc4c){while(--_0x26dc4c){_0x58f472['push'](_0x58f472['shift']());}};_0x4d7f8e(++_0xdbb060);}(_0x4202,0x1d4));var _0x2420=function(_0x30121e,_0x240c86){_0x30121e=_0x30121e-0x0;var _0x4ba328=_0x4202[_0x30121e];return _0x4ba328;};'use strict';var _=require(_0x2420('0x0'));var util=require(_0x2420('0x1'));var logger=require('../../config/logger')(_0x2420('0x2'));var moment=require(_0x2420('0x3'));var BPromise=require(_0x2420('0x4'));var rp=require(_0x2420('0x5'));var fs=require('fs');var path=require(_0x2420('0x6'));var rimraf=require(_0x2420('0x7'));var config=require(_0x2420('0x8'));var attributes=require(_0x2420('0x9'));module['exports']=function(_0xd69e6b,_0x3ff301){return _0xd69e6b[_0x2420('0xa')](_0x2420('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x153b=['../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x656b37,_0xf42532){var _0x131459=function(_0x37eebc){while(--_0x37eebc){_0x656b37['push'](_0x656b37['shift']());}};_0x131459(++_0xf42532);}(_0x153b,0x1b2));var _0xb153=function(_0x242aec,_0x22a0da){_0x242aec=_0x242aec-0x0;var _0x560978=_0x153b[_0x242aec];return _0x560978;};'use strict';var _=require(_0xb153('0x0'));var util=require(_0xb153('0x1'));var logger=require(_0xb153('0x2'))(_0xb153('0x3'));var moment=require(_0xb153('0x4'));var BPromise=require(_0xb153('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb153('0x6'));var rimraf=require(_0xb153('0x7'));var config=require(_0xb153('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0xb153('0x9')]=function(_0x5e1841,_0x9f78f0){return _0x5e1841[_0xb153('0xa')](_0xb153('0xb'),attributes,{'tableName':_0xb153('0xc'),'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 fd94bc9..24a0138 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 _0x2756=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','util'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x2756,0x151));var _0x6275=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x2756[_0x59710f];return _0xaae66a;};'use strict';var _=require('lodash');var util=require(_0x6275('0x0'));var moment=require(_0x6275('0x1'));var BPromise=require(_0x6275('0x2'));var rs=require(_0x6275('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6275('0x4'));var logger=require(_0x6275('0x5'))(_0x6275('0x6'));var config=require(_0x6275('0x7'));var jayson=require(_0x6275('0x8'));var client=jayson[_0x6275('0x9')][_0x6275('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x320115,_0x271312,_0x4d47b9){return new BPromise(function(_0x5a6b51,_0x2c2627){return client['request'](_0x320115,_0x4d47b9)[_0x6275('0xb')](function(_0x5aeabe){logger[_0x6275('0xc')](_0x6275('0xd'),_0x271312,'request\x20sent');logger[_0x6275('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x271312,_0x6275('0xf'),JSON[_0x6275('0x10')](_0x5aeabe));if(_0x5aeabe[_0x6275('0x11')]){if(_0x5aeabe['error']['code']===0x1f4){logger[_0x6275('0x11')](_0x6275('0xd'),_0x271312,_0x5aeabe[_0x6275('0x11')]['message']);return _0x2c2627(_0x5aeabe['error'][_0x6275('0x12')]);}logger[_0x6275('0x11')](_0x6275('0xd'),_0x271312,_0x5aeabe['error'][_0x6275('0x12')]);return _0x5a6b51(_0x5aeabe['error']['message']);}else{logger[_0x6275('0xc')](_0x6275('0xd'),_0x271312,_0x6275('0xf'));_0x5a6b51(_0x5aeabe[_0x6275('0x13')]['message']);}})[_0x6275('0x14')](function(_0x4fd8a6){logger['error'](_0x6275('0xd'),_0x271312,_0x4fd8a6);_0x2c2627(_0x4fd8a6);});});}exports[_0x6275('0x15')]=function(_0xd908cc){var _0x202142=this;return new Promise(function(_0x25615,_0x2cf810){return db[_0x6275('0x16')]['create'](_0xd908cc[_0x6275('0x17')],{'raw':_0xd908cc[_0x6275('0x18')]?_0xd908cc[_0x6275('0x18')][_0x6275('0x19')]===undefined?!![]:![]:!![]})[_0x6275('0xb')](function(_0x9f955f){logger[_0x6275('0xc')]('CreateReportAgentPreview',_0xd908cc);logger[_0x6275('0xe')](_0x6275('0x15'),_0xd908cc,JSON[_0x6275('0x10')](_0x9f955f));_0x25615(_0x9f955f);})[_0x6275('0x14')](function(_0x2fb417){logger[_0x6275('0x11')]('CreateReportAgentPreview',_0x2fb417[_0x6275('0x12')],_0xd908cc);_0x2cf810(_0x202142[_0x6275('0x11')](0x1f4,_0x2fb417[_0x6275('0x12')]));});});}; \ No newline at end of file +var _0xaef0=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','util','moment'];(function(_0x1fdde1,_0x35f4db){var _0x5e8d00=function(_0x52ba38){while(--_0x52ba38){_0x1fdde1['push'](_0x1fdde1['shift']());}};_0x5e8d00(++_0x35f4db);}(_0xaef0,0x142));var _0x0aef=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xaef0[_0xe5b349];return _0x26b0ad;};'use strict';var _=require('lodash');var util=require(_0x0aef('0x0'));var moment=require(_0x0aef('0x1'));var BPromise=require('bluebird');var rs=require(_0x0aef('0x2'));var fs=require('fs');var Redis=require(_0x0aef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aef('0x4'));var logger=require(_0x0aef('0x5'))('rpc');var config=require(_0x0aef('0x6'));var jayson=require(_0x0aef('0x7'));var client=jayson[_0x0aef('0x8')][_0x0aef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc8da5d,_0x5d9708,_0x1bbb2d){return new BPromise(function(_0x1cb9f6,_0xa6c731){return client[_0x0aef('0xa')](_0xc8da5d,_0x1bbb2d)[_0x0aef('0xb')](function(_0x16066c){logger[_0x0aef('0xc')](_0x0aef('0xd'),_0x5d9708,'request\x20sent');logger[_0x0aef('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5d9708,_0x0aef('0xf'),JSON[_0x0aef('0x10')](_0x16066c));if(_0x16066c[_0x0aef('0x11')]){if(_0x16066c[_0x0aef('0x11')][_0x0aef('0x12')]===0x1f4){logger[_0x0aef('0x11')](_0x0aef('0xd'),_0x5d9708,_0x16066c['error']['message']);return _0xa6c731(_0x16066c[_0x0aef('0x11')]['message']);}logger['error'](_0x0aef('0xd'),_0x5d9708,_0x16066c['error'][_0x0aef('0x13')]);return _0x1cb9f6(_0x16066c['error'][_0x0aef('0x13')]);}else{logger[_0x0aef('0xc')](_0x0aef('0xd'),_0x5d9708,_0x0aef('0xf'));_0x1cb9f6(_0x16066c[_0x0aef('0x14')][_0x0aef('0x13')]);}})[_0x0aef('0x15')](function(_0x5a247b){logger[_0x0aef('0x11')](_0x0aef('0xd'),_0x5d9708,_0x5a247b);_0xa6c731(_0x5a247b);});});}exports[_0x0aef('0x16')]=function(_0x486493){var _0x27b269=this;return new Promise(function(_0x84bbe6,_0x3c4abe){return db[_0x0aef('0x17')]['create'](_0x486493[_0x0aef('0x18')],{'raw':_0x486493[_0x0aef('0x19')]?_0x486493[_0x0aef('0x19')][_0x0aef('0x1a')]===undefined?!![]:![]:!![]})[_0x0aef('0xb')](function(_0x394627){logger[_0x0aef('0xc')]('CreateReportAgentPreview',_0x486493);logger['debug'](_0x0aef('0x16'),_0x486493,JSON[_0x0aef('0x10')](_0x394627));_0x84bbe6(_0x394627);})[_0x0aef('0x15')](function(_0xc6d07e){logger[_0x0aef('0x11')](_0x0aef('0x16'),_0xc6d07e[_0x0aef('0x13')],_0x486493);_0x3c4abe(_0x27b269[_0x0aef('0x11')](0x1f4,_0xc6d07e[_0x0aef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d1fe76f..93e4558 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 _0xe6b2=['/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','outboundChannels','agents','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xe6b2,0x1c4));var _0x2e6b=function(_0x41232a,_0x20440d){_0x41232a=_0x41232a-0x0;var _0x1ab731=_0xe6b2[_0x41232a];return _0x1ab731;};'use strict';var multer=require('multer');var util=require(_0x2e6b('0x0'));var path=require(_0x2e6b('0x1'));var express=require(_0x2e6b('0x2'));var router=express[_0x2e6b('0x3')]();var auth=require(_0x2e6b('0x4'));var controller=require(_0x2e6b('0x5'));router[_0x2e6b('0x6')](_0x2e6b('0x7'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x9')]);router[_0x2e6b('0x6')](_0x2e6b('0xa'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0xb')]);router[_0x2e6b('0x6')](_0x2e6b('0xc'),auth['isAuthenticated'](),controller[_0x2e6b('0xd')]);router[_0x2e6b('0x6')](_0x2e6b('0xe'),auth['isAuthenticated'](),controller[_0x2e6b('0xf')]);router[_0x2e6b('0x6')](_0x2e6b('0x10'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x11')]);router['get']('/mail/queues',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x12')]);router['get'](_0x2e6b('0x13'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x14')]);router[_0x2e6b('0x6')](_0x2e6b('0x15'),auth[_0x2e6b('0x8')](),controller['openchannelQueues']);router[_0x2e6b('0x6')](_0x2e6b('0x16'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x17')]);router['get']('/whatsapp/queues',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x18')]);router[_0x2e6b('0x6')](_0x2e6b('0x19'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x1a')]);router[_0x2e6b('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x2e6b('0x1b')]);router[_0x2e6b('0x6')](_0x2e6b('0x1c'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x1d')]);router[_0x2e6b('0x6')](_0x2e6b('0x1e'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x1f')]);router[_0x2e6b('0x6')](_0x2e6b('0x20'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x21')]);router[_0x2e6b('0x6')](_0x2e6b('0x22'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x23')]);router['get'](_0x2e6b('0x24'),auth['isAuthenticated'](),controller[_0x2e6b('0x25')]);router[_0x2e6b('0x26')](_0x2e6b('0x24'),auth[_0x2e6b('0x8')](),controller['updateVoiceQueue']);router[_0x2e6b('0x6')](_0x2e6b('0x27'),auth['isAuthenticated'](),controller[_0x2e6b('0x28')]);router[_0x2e6b('0x6')]('/outbound/channels',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x29')]);router[_0x2e6b('0x6')]('/agents',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x2a')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x2e6b('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0x2e6b('0x2b')]);router['get'](_0x2e6b('0x2c'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x2d')]);router[_0x2e6b('0x6')]('/campaigns',auth['isAuthenticated'](),controller[_0x2e6b('0x2e')]);router['get'](_0x2e6b('0x2f'),auth['isAuthenticated'](),controller[_0x2e6b('0x30')]);router[_0x2e6b('0x6')]('/chat/queues/waitinginteractions',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x31')]);router['get'](_0x2e6b('0x32'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x33')]);router[_0x2e6b('0x6')](_0x2e6b('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2e6b('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x35')]);router['get'](_0x2e6b('0x36'),auth['isAuthenticated'](),controller[_0x2e6b('0x37')]);router['get'](_0x2e6b('0x38'),auth[_0x2e6b('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x2e6b('0x6')](_0x2e6b('0x39'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x3a')]);router[_0x2e6b('0x3b')](_0x2e6b('0x3c'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x3d')](_0x2e6b('0x3e')));router[_0x2e6b('0x6')]('/mail/queues/:id',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x3f')]);router['post'](_0x2e6b('0x40'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x3d')](_0x2e6b('0x41')));router['get'](_0x2e6b('0x42'),auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x43')]);router[_0x2e6b('0x3b')](_0x2e6b('0x44'),auth['isAuthenticated'](),controller[_0x2e6b('0x3d')](_0x2e6b('0x45')));router[_0x2e6b('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x2e6b('0x46')]);router['post'](_0x2e6b('0x47'),auth['isAuthenticated'](),controller[_0x2e6b('0x3d')]('openchannel'));router[_0x2e6b('0x6')](_0x2e6b('0x48'),auth['isAuthenticated'](),controller[_0x2e6b('0x49')]);router['post']('/sms/queues/:id/notify',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x3d')]('sms'));router[_0x2e6b('0x3b')]('/whatsapp/queues/:id/notify',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x3d')]('whatsapp'));router[_0x2e6b('0x6')](_0x2e6b('0x4a'),auth[_0x2e6b('0x8')](),controller['showSmsQueues']);router[_0x2e6b('0x6')]('/whatsapp/queues/:id',auth[_0x2e6b('0x8')](),controller['showWhatsappQueues']);router[_0x2e6b('0x3b')]('/agents/:id/notify',auth[_0x2e6b('0x8')](),controller[_0x2e6b('0x4b')]);module[_0x2e6b('0x4c')]=router; \ No newline at end of file +var _0x1aa6=['/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1aa6,0xcb));var _0x61aa=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x1aa6[_0x38b2d9];return _0x23a3e1;};'use strict';var multer=require(_0x61aa('0x0'));var util=require(_0x61aa('0x1'));var path=require(_0x61aa('0x2'));var express=require(_0x61aa('0x3'));var router=express[_0x61aa('0x4')]();var auth=require(_0x61aa('0x5'));var controller=require(_0x61aa('0x6'));router[_0x61aa('0x7')](_0x61aa('0x8'),auth[_0x61aa('0x9')](),controller[_0x61aa('0xa')]);router[_0x61aa('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x61aa('0xb')]);router['get'](_0x61aa('0xc'),auth[_0x61aa('0x9')](),controller[_0x61aa('0xd')]);router[_0x61aa('0x7')](_0x61aa('0xe'),auth['isAuthenticated'](),controller[_0x61aa('0xf')]);router[_0x61aa('0x7')](_0x61aa('0x10'),auth[_0x61aa('0x9')](),controller['chatQueues']);router[_0x61aa('0x7')](_0x61aa('0x11'),auth[_0x61aa('0x9')](),controller['mailQueues']);router[_0x61aa('0x7')]('/mail/accounts',auth[_0x61aa('0x9')](),controller[_0x61aa('0x12')]);router['get']('/openchannel/queues',auth[_0x61aa('0x9')](),controller[_0x61aa('0x13')]);router[_0x61aa('0x7')](_0x61aa('0x14'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x15')]);router[_0x61aa('0x7')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x61aa('0x16')]);router['get'](_0x61aa('0x17'),auth['isAuthenticated'](),controller[_0x61aa('0x18')]);router[_0x61aa('0x7')]('/voice/queues/preview/:id',auth[_0x61aa('0x9')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x61aa('0x7')](_0x61aa('0x19'),auth[_0x61aa('0x9')](),controller['voiceQueuesChannel']);router[_0x61aa('0x7')](_0x61aa('0x1a'),auth[_0x61aa('0x9')](),controller['voiceQueuesChannelHangup']);router[_0x61aa('0x7')](_0x61aa('0x1b'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x1c')]);router[_0x61aa('0x7')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x61aa('0x1d')]);router[_0x61aa('0x1e')]('/voice/queues/:id',auth[_0x61aa('0x9')](),controller[_0x61aa('0x1f')]);router[_0x61aa('0x7')](_0x61aa('0x20'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x21')]);router['get'](_0x61aa('0x22'),auth[_0x61aa('0x9')](),controller['outboundChannels']);router[_0x61aa('0x7')](_0x61aa('0x23'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x24')]);router[_0x61aa('0x1e')]('/agents/:id/capacity',auth[_0x61aa('0x9')](),controller[_0x61aa('0x25')]);router[_0x61aa('0x7')](_0x61aa('0x26'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x27')]);router[_0x61aa('0x7')]('/trunks',auth[_0x61aa('0x9')](),controller[_0x61aa('0x28')]);router[_0x61aa('0x7')](_0x61aa('0x29'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x2a')]);router['get'](_0x61aa('0x2b'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x2c')]);router['get'](_0x61aa('0x2d'),auth['isAuthenticated'](),controller[_0x61aa('0x2e')]);router[_0x61aa('0x7')](_0x61aa('0x2f'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x30')]);router['get'](_0x61aa('0x31'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x32')]);router[_0x61aa('0x7')](_0x61aa('0x33'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x34')]);router[_0x61aa('0x7')]('/sms/queues/waitinginteractions',auth[_0x61aa('0x9')](),controller[_0x61aa('0x35')]);router[_0x61aa('0x7')](_0x61aa('0x36'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x37')]);router[_0x61aa('0x7')](_0x61aa('0x38'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x39')]);router[_0x61aa('0x3a')](_0x61aa('0x3b'),auth['isAuthenticated'](),controller['queueNotify'](_0x61aa('0x3c')));router[_0x61aa('0x7')]('/mail/queues/:id',auth[_0x61aa('0x9')](),controller[_0x61aa('0x3d')]);router[_0x61aa('0x3a')](_0x61aa('0x3e'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x3f')](_0x61aa('0x40')));router[_0x61aa('0x7')](_0x61aa('0x41'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x42')]);router[_0x61aa('0x3a')]('/fax/queues/:id/notify',auth[_0x61aa('0x9')](),controller[_0x61aa('0x3f')](_0x61aa('0x43')));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x61aa('0x44')]);router[_0x61aa('0x3a')](_0x61aa('0x45'),auth[_0x61aa('0x9')](),controller['queueNotify'](_0x61aa('0x46')));router[_0x61aa('0x7')]('/openchannel/queues/:id',auth[_0x61aa('0x9')](),controller[_0x61aa('0x47')]);router[_0x61aa('0x3a')](_0x61aa('0x48'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x3f')](_0x61aa('0x49')));router[_0x61aa('0x3a')](_0x61aa('0x4a'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x3f')]('whatsapp'));router[_0x61aa('0x7')](_0x61aa('0x4b'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x4c')]);router['get'](_0x61aa('0x4d'),auth[_0x61aa('0x9')](),controller[_0x61aa('0x4e')]);router['post'](_0x61aa('0x4f'),auth['isAuthenticated'](),controller[_0x61aa('0x50')]);module[_0x61aa('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f19ad89..706ffb3 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x2ec036,_0x365efa){var _0x1806dc=function(_0x1ec1dc){while(--_0x1ec1dc){_0x2ec036['push'](_0x2ec036['shift']());}};_0x1806dc(++_0x365efa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +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(_0x569a90,_0x57bd2a){var _0xc6ae24=function(_0x386a30){while(--_0x386a30){_0x569a90['push'](_0x569a90['shift']());}};_0xc6ae24(++_0x57bd2a);}(_0xe706,0xa3));var _0x6e70=function(_0x127af0,_0x49fbc5){_0x127af0=_0x127af0-0x0;var _0x1fc410=_0xe706[_0x127af0];return _0x1fc410;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1a0a349..07a7242 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 _0xf9d7=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','show','/:id/run','run','post','create','/:id'];(function(_0x11792d,_0x4a9bb3){var _0x3086d2=function(_0x31c8ac){while(--_0x31c8ac){_0x11792d['push'](_0x11792d['shift']());}};_0x3086d2(++_0x4a9bb3);}(_0xf9d7,0xce));var _0x7f9d=function(_0x377199,_0x1439fa){_0x377199=_0x377199-0x0;var _0x501155=_0xf9d7[_0x377199];return _0x501155;};'use strict';var multer=require('multer');var util=require(_0x7f9d('0x0'));var path=require(_0x7f9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x7f9d('0x2'));var router=express[_0x7f9d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f9d('0x4'));var interaction=require(_0x7f9d('0x5'));var config=require('../../config/environment');var controller=require(_0x7f9d('0x6'));router[_0x7f9d('0x7')]('/',auth[_0x7f9d('0x8')](),controller['index']);router[_0x7f9d('0x7')]('/:id',auth[_0x7f9d('0x8')](),controller[_0x7f9d('0x9')]);router[_0x7f9d('0x7')](_0x7f9d('0xa'),auth[_0x7f9d('0x8')](),controller[_0x7f9d('0xb')]);router[_0x7f9d('0xc')]('/',auth['isAuthenticated'](),controller[_0x7f9d('0xd')]);router['put'](_0x7f9d('0xe'),auth[_0x7f9d('0x8')](),controller['update']);router['delete'](_0x7f9d('0xe'),auth['isAuthenticated'](),controller[_0x7f9d('0xf')]);module[_0x7f9d('0x10')]=router; \ No newline at end of file +var _0x87cb=['update','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','put'];(function(_0x458112,_0x3d33d0){var _0x301d91=function(_0x10c9e2){while(--_0x10c9e2){_0x458112['push'](_0x458112['shift']());}};_0x301d91(++_0x3d33d0);}(_0x87cb,0x1a1));var _0xb87c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x87cb[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb87c('0x0'));var timeout=require('connect-timeout');var express=require(_0xb87c('0x1'));var router=express[_0xb87c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb87c('0x3'));var interaction=require(_0xb87c('0x4'));var config=require(_0xb87c('0x5'));var controller=require(_0xb87c('0x6'));router['get']('/',auth[_0xb87c('0x7')](),controller[_0xb87c('0x8')]);router[_0xb87c('0x9')](_0xb87c('0xa'),auth[_0xb87c('0x7')](),controller[_0xb87c('0xb')]);router[_0xb87c('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xb87c('0xc')]);router[_0xb87c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb87c('0xe')](_0xb87c('0xa'),auth[_0xb87c('0x7')](),controller[_0xb87c('0xf')]);router['delete']('/:id',auth[_0xb87c('0x7')](),controller[_0xb87c('0x10')]);module[_0xb87c('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index bed7d48..247ad6f 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 _0xfb8f=['xlsx','custom','default','STRING','sequelize','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','days','csv','pdf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfb8f,0x1e5));var _0xffb8=function(_0x34107f,_0x5a3ed1){_0x34107f=_0x34107f-0x0;var _0x563191=_0xfb8f[_0x34107f];return _0x563191;};'use strict';var Sequelize=require(_0xffb8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xffb8('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xffb8('0x2')},'startAt':{'type':Sequelize[_0xffb8('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xffb8('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xffb8('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xffb8('0x5'),'quarters','months','weeks','days','hours','minutes'),'allowNull':![],'defaultValue':_0xffb8('0x6')},'output':{'type':Sequelize['ENUM'](_0xffb8('0x7'),_0xffb8('0x8'),_0xffb8('0x9')),'allowNull':![],'defaultValue':_0xffb8('0x7')},'type':{'type':Sequelize['ENUM'](_0xffb8('0xa'),_0xffb8('0xb')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xffb8('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xffb8('0xc')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xffb8('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x51d5=['ENUM','csv','xlsx','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','years','months','weeks','days','hours'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x51d5,0x1a6));var _0x551d=function(_0x14e966,_0x2a1d00){_0x14e966=_0x14e966-0x0;var _0x4b40de=_0x51d5[_0x14e966];return _0x4b40de;};'use strict';var Sequelize=require(_0x551d('0x0'));module[_0x551d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x551d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x551d('0x3')},'startAt':{'type':Sequelize[_0x551d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x551d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x551d('0x5'),'quarters',_0x551d('0x6'),_0x551d('0x7'),_0x551d('0x8'),_0x551d('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x551d('0x8')},'output':{'type':Sequelize[_0x551d('0xa')](_0x551d('0xb'),'pdf',_0x551d('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x551d('0xd'),'default'),'allowNull':![],'defaultValue':_0x551d('0xd')},'sendMail':{'type':Sequelize[_0x551d('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x551d('0x2')]},'cc':{'type':Sequelize[_0x551d('0xf')]},'bcc':{'type':Sequelize[_0x551d('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x551d('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 7539a3a..7ef3352 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 _0x0f4f=['update','then','get','Scheduler','error','name','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','params','destroy','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','set','apply','reject','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0f4f,0xd8));var _0xf0f4=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x0f4f[_0x1b95a1];return _0x57aef1;};'use strict';var emlformat=require(_0xf0f4('0x0'));var rimraf=require(_0xf0f4('0x1'));var zipdir=require(_0xf0f4('0x2'));var jsonpatch=require(_0xf0f4('0x3'));var rp=require(_0xf0f4('0x4'));var moment=require(_0xf0f4('0x5'));var BPromise=require(_0xf0f4('0x6'));var Mustache=require('mustache');var util=require(_0xf0f4('0x7'));var path=require('path');var sox=require(_0xf0f4('0x8'));var csv=require(_0xf0f4('0x9'));var ejs=require(_0xf0f4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0f4('0xb'));var squel=require(_0xf0f4('0xc'));var crypto=require(_0xf0f4('0xd'));var jsforce=require(_0xf0f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f4('0x9'));var querystring=require('querystring');var Papa=require(_0xf0f4('0xf'));var Redis=require(_0xf0f4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf0f4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0f4('0x12'));var logger=require(_0xf0f4('0x13'))('api');var utils=require(_0xf0f4('0x14'));var config=require(_0xf0f4('0x15'));var licenseUtil=require(_0xf0f4('0x16'));var db=require(_0xf0f4('0x17'))['db'];function respondWithStatusCode(_0x214e15,_0x22fb95){_0x22fb95=_0x22fb95||0xcc;return function(_0x92426f){if(_0x92426f){return _0x214e15[_0xf0f4('0x18')](_0x22fb95);}return _0x214e15[_0xf0f4('0x19')](_0x22fb95)[_0xf0f4('0x1a')]();};}function respondWithResult(_0x55ce4b,_0x58ca84){_0x58ca84=_0x58ca84||0xc8;return function(_0x5cbeb1){if(_0x5cbeb1){return _0x55ce4b[_0xf0f4('0x19')](_0x58ca84)[_0xf0f4('0x1b')](_0x5cbeb1);}};}function respondWithFilteredResult(_0x12bbe0,_0x57bbd4){return function(_0x21bec7){if(_0x21bec7){var _0x4fcc0a=typeof _0x57bbd4[_0xf0f4('0x1c')]===_0xf0f4('0x1d')&&typeof _0x57bbd4[_0xf0f4('0x1e')]===_0xf0f4('0x1d');var _0x458b15=_0x21bec7[_0xf0f4('0x1f')];var _0x28f512=_0x4fcc0a?0x0:_0x57bbd4[_0xf0f4('0x1c')];var _0x5cfdd8=_0x4fcc0a?_0x21bec7[_0xf0f4('0x1f')]:_0x57bbd4[_0xf0f4('0x1c')]+_0x57bbd4[_0xf0f4('0x1e')];var _0x148f56;if(_0x5cfdd8>=_0x458b15){_0x5cfdd8=_0x458b15;_0x148f56=0xc8;}else{_0x148f56=0xce;}_0x12bbe0[_0xf0f4('0x19')](_0x148f56);return _0x12bbe0[_0xf0f4('0x20')]('Content-Range',_0x28f512+'-'+_0x5cfdd8+'/'+_0x458b15)['json'](_0x21bec7);}return null;};}function patchUpdates(_0x3a3afa){return function(_0xdc7b3f){try{jsonpatch[_0xf0f4('0x21')](_0xdc7b3f,_0x3a3afa,!![]);}catch(_0x588205){return BPromise[_0xf0f4('0x22')](_0x588205);}return _0xdc7b3f[_0xf0f4('0x23')]();};}function saveUpdates(_0x4a069c,_0x2a8f2c){return function(_0x40df51){if(_0x40df51){return _0x40df51[_0xf0f4('0x24')](_0x4a069c)['then'](function(_0x1c54ea){return _0x1c54ea;});}return null;};}function removeEntity(_0x2b131a,_0x212593){return function(_0x37a18d){if(_0x37a18d){return _0x37a18d['destroy']()[_0xf0f4('0x25')](function(){var _0x3a1009=_0x37a18d[_0xf0f4('0x26')]({'plain':!![]});var _0x5ae6d2=_0xf0f4('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x5ae6d2,'resourceId':_0x3a1009['id']}})[_0xf0f4('0x25')](function(){return _0x37a18d;});})['then'](function(){_0x2b131a['status'](0xcc)[_0xf0f4('0x1a')]();});}};}function handleEntityNotFound(_0x4781e1,_0x4cd731){return function(_0x4dfd7c){if(!_0x4dfd7c){_0x4781e1[_0xf0f4('0x18')](0x194);}return _0x4dfd7c;};}function handleError(_0x112446,_0x5cdc8d){_0x5cdc8d=_0x5cdc8d||0x1f4;return function(_0xbb9850){logger[_0xf0f4('0x28')](_0xbb9850['stack']);if(_0xbb9850[_0xf0f4('0x29')]){delete _0xbb9850['name'];}_0x112446['status'](_0x5cdc8d)['send'](_0xbb9850);};}exports[_0xf0f4('0x2a')]=function(_0xc7775,_0x57e840){var _0x24a55e={},_0x15c30c={},_0x140aa3={'count':0x0,'rows':[]};var _0x3d4701=_[_0xf0f4('0x2b')](db[_0xf0f4('0x2c')][_0xf0f4('0x2d')],function(_0x1ec982){return{'name':_0x1ec982[_0xf0f4('0x2e')],'type':_0x1ec982[_0xf0f4('0x2f')][_0xf0f4('0x30')]};});_0x15c30c['model']=_[_0xf0f4('0x2b')](_0x3d4701,_0xf0f4('0x29'));_0x15c30c[_0xf0f4('0x31')]=_[_0xf0f4('0x32')](_0xc7775['query']);_0x15c30c[_0xf0f4('0x33')]=_[_0xf0f4('0x34')](_0x15c30c[_0xf0f4('0x35')],_0x15c30c[_0xf0f4('0x31')]);_0x24a55e[_0xf0f4('0x36')]=_[_0xf0f4('0x34')](_0x15c30c[_0xf0f4('0x35')],qs['fields'](_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x37')]));_0x24a55e[_0xf0f4('0x36')]=_0x24a55e['attributes']['length']?_0x24a55e['attributes']:_0x15c30c['model'];if(!_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x38')](_0xf0f4('0x39'))){_0x24a55e[_0xf0f4('0x1e')]=qs[_0xf0f4('0x1e')](_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x1e')]);_0x24a55e[_0xf0f4('0x1c')]=qs[_0xf0f4('0x1c')](_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x1c')]);}_0x24a55e[_0xf0f4('0x3a')]=qs[_0xf0f4('0x3b')](_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x3b')]);_0x24a55e[_0xf0f4('0x3c')]=qs['filters'](_[_0xf0f4('0x3d')](_0xc7775[_0xf0f4('0x31')],_0x15c30c[_0xf0f4('0x33')]),_0x3d4701);if(_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x3e')]){_0x24a55e[_0xf0f4('0x3c')]=_['merge'](_0x24a55e[_0xf0f4('0x3c')],{'$or':_[_0xf0f4('0x2b')](_0x3d4701,function(_0x562a78){if(_0x562a78[_0xf0f4('0x2f')]!==_0xf0f4('0x3f')){var _0x179b3f={};_0x179b3f[_0x562a78[_0xf0f4('0x29')]]={'$like':'%'+_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x3e')]+'%'};return _0x179b3f;}})});}_0x24a55e=_[_0xf0f4('0x40')]({},_0x24a55e,_0xc7775['options']);var _0x2db435={'where':_0x24a55e[_0xf0f4('0x3c')]};return db[_0xf0f4('0x2c')][_0xf0f4('0x1f')](_0x2db435)[_0xf0f4('0x25')](function(_0x1d58d1){_0x140aa3['count']=_0x1d58d1;if(_0xc7775[_0xf0f4('0x31')][_0xf0f4('0x41')]){_0x24a55e[_0xf0f4('0x42')]=[{'all':!![]}];}return db[_0xf0f4('0x2c')][_0xf0f4('0x43')](_0x24a55e);})[_0xf0f4('0x25')](function(_0x423573){_0x140aa3[_0xf0f4('0x44')]=_0x423573;return _0x140aa3;})['then'](respondWithFilteredResult(_0x57e840,_0x24a55e))[_0xf0f4('0x45')](handleError(_0x57e840,null));};exports[_0xf0f4('0x46')]=function(_0x485d15,_0xdd8c80){var _0x54a43b={'raw':![],'where':{'id':_0x485d15['params']['id']}},_0x574f7e={};_0x574f7e[_0xf0f4('0x35')]=_[_0xf0f4('0x32')](db[_0xf0f4('0x2c')]['rawAttributes']);_0x574f7e[_0xf0f4('0x31')]=_[_0xf0f4('0x32')](_0x485d15[_0xf0f4('0x31')]);_0x574f7e[_0xf0f4('0x33')]=_[_0xf0f4('0x34')](_0x574f7e[_0xf0f4('0x35')],_0x574f7e[_0xf0f4('0x31')]);_0x54a43b[_0xf0f4('0x36')]=_[_0xf0f4('0x34')](_0x574f7e[_0xf0f4('0x35')],qs[_0xf0f4('0x37')](_0x485d15['query'][_0xf0f4('0x37')]));_0x54a43b['attributes']=_0x54a43b[_0xf0f4('0x36')][_0xf0f4('0x47')]?_0x54a43b['attributes']:_0x574f7e[_0xf0f4('0x35')];if(_0x485d15[_0xf0f4('0x31')][_0xf0f4('0x41')]){_0x54a43b[_0xf0f4('0x42')]=[{'all':!![]}];}_0x54a43b=_[_0xf0f4('0x40')]({},_0x54a43b,_0x485d15[_0xf0f4('0x48')]);return db[_0xf0f4('0x2c')]['find'](_0x54a43b)[_0xf0f4('0x25')](handleEntityNotFound(_0xdd8c80,null))[_0xf0f4('0x25')](respondWithResult(_0xdd8c80,null))[_0xf0f4('0x45')](handleError(_0xdd8c80,null));};exports[_0xf0f4('0x49')]=function(_0x5ed9f7,_0xc43d07){return db[_0xf0f4('0x2c')][_0xf0f4('0x49')](_0x5ed9f7[_0xf0f4('0x4a')],{})['then'](function(_0x2b1ef6){var _0x76a871=_0x5ed9f7[_0xf0f4('0x4b')][_0xf0f4('0x26')]({'plain':!![]});if(!_0x76a871)throw new Error(_0xf0f4('0x4c'));if(_0x76a871[_0xf0f4('0x4d')]==='user'){var _0x54c566=_0x2b1ef6['get']({'plain':!![]});var _0x4afda4=_0xf0f4('0x27');return db['UserProfileSection'][_0xf0f4('0x4e')]({'where':{'name':_0x4afda4,'userProfileId':_0x76a871[_0xf0f4('0x4f')]},'raw':!![]})[_0xf0f4('0x25')](function(_0x50ecb7){if(_0x50ecb7&&_0x50ecb7[_0xf0f4('0x50')]===0x0){return db['UserProfileResource'][_0xf0f4('0x49')]({'name':_0x54c566[_0xf0f4('0x29')],'resourceId':_0x54c566['id'],'type':_0x50ecb7[_0xf0f4('0x29')],'sectionId':_0x50ecb7['id']},{})['then'](function(){return _0x2b1ef6;});}else{return _0x2b1ef6;}})[_0xf0f4('0x45')](function(_0x165a7e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x165a7e);throw _0x165a7e;});}return _0x2b1ef6;})[_0xf0f4('0x25')](respondWithResult(_0xc43d07,0xc9))[_0xf0f4('0x45')](handleError(_0xc43d07,null));};exports[_0xf0f4('0x24')]=function(_0x2737a7,_0x477cf5){if(_0x2737a7['body']['id']){delete _0x2737a7[_0xf0f4('0x4a')]['id'];}return db['Schedule'][_0xf0f4('0x4e')]({'where':{'id':_0x2737a7[_0xf0f4('0x51')]['id']}})[_0xf0f4('0x25')](handleEntityNotFound(_0x477cf5,null))[_0xf0f4('0x25')](saveUpdates(_0x2737a7['body'],null))[_0xf0f4('0x25')](respondWithResult(_0x477cf5,null))[_0xf0f4('0x45')](handleError(_0x477cf5,null));};exports[_0xf0f4('0x52')]=function(_0x2456dd,_0x5885d7){return db[_0xf0f4('0x2c')][_0xf0f4('0x4e')]({'where':{'id':_0x2456dd[_0xf0f4('0x51')]['id']}})[_0xf0f4('0x25')](handleEntityNotFound(_0x5885d7,null))[_0xf0f4('0x25')](removeEntity(_0x5885d7,null))[_0xf0f4('0x45')](handleError(_0x5885d7,null));};exports['run']=function(_0x377758,_0x4c501e,_0x42d575){var _0x189035=require(_0xf0f4('0x53'));return db[_0xf0f4('0x2c')][_0xf0f4('0x4e')]({'where':{'id':_0x377758[_0xf0f4('0x51')]['id']},'raw':!![]})[_0xf0f4('0x25')](handleEntityNotFound(_0x4c501e,null))[_0xf0f4('0x25')](function(){_0x189035['run'](_0x377758[_0xf0f4('0x51')]['id']);})['then'](respondWithStatusCode(_0x4c501e,null))[_0xf0f4('0x45')](handleError(_0x4c501e,null));}; \ No newline at end of file +var _0x8271=['update','then','destroy','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','type','keys','filters','model','attributes','intersection','fields','query','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','findAll','rows','catch','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','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','../../mysqldb','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x352ff8,_0x5e6f83){var _0x5c49b1=function(_0x233d86){while(--_0x233d86){_0x352ff8['push'](_0x352ff8['shift']());}};_0x5c49b1(++_0x5e6f83);}(_0x8271,0x178));var _0x1827=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x8271[_0x2f2360];return _0x1cc8d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1827('0x0'));var zipdir=require(_0x1827('0x1'));var jsonpatch=require(_0x1827('0x2'));var rp=require(_0x1827('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1827('0x4'));var path=require('path');var sox=require(_0x1827('0x5'));var csv=require(_0x1827('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1827('0x7'));var _=require(_0x1827('0x8'));var squel=require(_0x1827('0x9'));var crypto=require(_0x1827('0xa'));var jsforce=require(_0x1827('0xb'));var deskjs=require(_0x1827('0xc'));var toCsv=require(_0x1827('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1827('0xd'));var authService=require(_0x1827('0xe'));var qs=require(_0x1827('0xf'));var as=require(_0x1827('0x10'));var hardwareService=require(_0x1827('0x11'));var logger=require(_0x1827('0x12'))('api');var utils=require(_0x1827('0x13'));var config=require(_0x1827('0x14'));var licenseUtil=require(_0x1827('0x15'));var db=require(_0x1827('0x16'))['db'];function respondWithStatusCode(_0x23e5bf,_0x50e4d8){_0x50e4d8=_0x50e4d8||0xcc;return function(_0x4b4794){if(_0x4b4794){return _0x23e5bf['sendStatus'](_0x50e4d8);}return _0x23e5bf[_0x1827('0x17')](_0x50e4d8)[_0x1827('0x18')]();};}function respondWithResult(_0x4a2f32,_0x4c5863){_0x4c5863=_0x4c5863||0xc8;return function(_0x1b92e7){if(_0x1b92e7){return _0x4a2f32['status'](_0x4c5863)[_0x1827('0x19')](_0x1b92e7);}};}function respondWithFilteredResult(_0x4d1112,_0x2fc38d){return function(_0x561277){if(_0x561277){var _0x47ebe2=typeof _0x2fc38d['offset']===_0x1827('0x1a')&&typeof _0x2fc38d['limit']===_0x1827('0x1a');var _0x109707=_0x561277[_0x1827('0x1b')];var _0x2e3c73=_0x47ebe2?0x0:_0x2fc38d['offset'];var _0x4b4ab8=_0x47ebe2?_0x561277[_0x1827('0x1b')]:_0x2fc38d['offset']+_0x2fc38d[_0x1827('0x1c')];var _0x2789e6;if(_0x4b4ab8>=_0x109707){_0x4b4ab8=_0x109707;_0x2789e6=0xc8;}else{_0x2789e6=0xce;}_0x4d1112['status'](_0x2789e6);return _0x4d1112[_0x1827('0x1d')](_0x1827('0x1e'),_0x2e3c73+'-'+_0x4b4ab8+'/'+_0x109707)[_0x1827('0x19')](_0x561277);}return null;};}function patchUpdates(_0x3d4469){return function(_0x14e559){try{jsonpatch[_0x1827('0x1f')](_0x14e559,_0x3d4469,!![]);}catch(_0x43d0a3){return BPromise[_0x1827('0x20')](_0x43d0a3);}return _0x14e559[_0x1827('0x21')]();};}function saveUpdates(_0x17c7bf,_0x3c698e){return function(_0x14ecac){if(_0x14ecac){return _0x14ecac[_0x1827('0x22')](_0x17c7bf)[_0x1827('0x23')](function(_0x5ccb81){return _0x5ccb81;});}return null;};}function removeEntity(_0x1dc8e1,_0x1ae25e){return function(_0x36d487){if(_0x36d487){return _0x36d487[_0x1827('0x24')]()[_0x1827('0x23')](function(){var _0x4e2041=_0x36d487['get']({'plain':!![]});var _0x3eb233=_0x1827('0x25');return db[_0x1827('0x26')][_0x1827('0x24')]({'where':{'type':_0x3eb233,'resourceId':_0x4e2041['id']}})['then'](function(){return _0x36d487;});})['then'](function(){_0x1dc8e1[_0x1827('0x17')](0xcc)[_0x1827('0x18')]();});}};}function handleEntityNotFound(_0x31fd0e,_0x44c9b5){return function(_0xbeb8a0){if(!_0xbeb8a0){_0x31fd0e[_0x1827('0x27')](0x194);}return _0xbeb8a0;};}function handleError(_0x3487b7,_0x4d73d8){_0x4d73d8=_0x4d73d8||0x1f4;return function(_0x5002a8){logger[_0x1827('0x28')](_0x5002a8[_0x1827('0x29')]);if(_0x5002a8['name']){delete _0x5002a8[_0x1827('0x2a')];}_0x3487b7[_0x1827('0x17')](_0x4d73d8)[_0x1827('0x2b')](_0x5002a8);};}exports[_0x1827('0x2c')]=function(_0x685291,_0x43d17c){var _0xef1d76={},_0x14eec4={},_0x389e6f={'count':0x0,'rows':[]};var _0xda6cde=_[_0x1827('0x2d')](db[_0x1827('0x2e')][_0x1827('0x2f')],function(_0x42f8b3){return{'name':_0x42f8b3['fieldName'],'type':_0x42f8b3[_0x1827('0x30')]['key']};});_0x14eec4['model']=_[_0x1827('0x2d')](_0xda6cde,_0x1827('0x2a'));_0x14eec4['query']=_[_0x1827('0x31')](_0x685291['query']);_0x14eec4[_0x1827('0x32')]=_['intersection'](_0x14eec4[_0x1827('0x33')],_0x14eec4['query']);_0xef1d76[_0x1827('0x34')]=_[_0x1827('0x35')](_0x14eec4[_0x1827('0x33')],qs[_0x1827('0x36')](_0x685291[_0x1827('0x37')][_0x1827('0x36')]));_0xef1d76[_0x1827('0x34')]=_0xef1d76[_0x1827('0x34')][_0x1827('0x38')]?_0xef1d76[_0x1827('0x34')]:_0x14eec4['model'];if(!_0x685291[_0x1827('0x37')][_0x1827('0x39')]('nolimit')){_0xef1d76[_0x1827('0x1c')]=qs[_0x1827('0x1c')](_0x685291[_0x1827('0x37')][_0x1827('0x1c')]);_0xef1d76[_0x1827('0x3a')]=qs[_0x1827('0x3a')](_0x685291[_0x1827('0x37')][_0x1827('0x3a')]);}_0xef1d76[_0x1827('0x3b')]=qs['sort'](_0x685291[_0x1827('0x37')][_0x1827('0x3c')]);_0xef1d76['where']=qs[_0x1827('0x32')](_[_0x1827('0x3d')](_0x685291['query'],_0x14eec4['filters']),_0xda6cde);if(_0x685291['query'][_0x1827('0x3e')]){_0xef1d76[_0x1827('0x3f')]=_[_0x1827('0x40')](_0xef1d76[_0x1827('0x3f')],{'$or':_[_0x1827('0x2d')](_0xda6cde,function(_0x1c3966){if(_0x1c3966[_0x1827('0x30')]!=='VIRTUAL'){var _0x1addf9={};_0x1addf9[_0x1c3966['name']]={'$like':'%'+_0x685291[_0x1827('0x37')][_0x1827('0x3e')]+'%'};return _0x1addf9;}})});}_0xef1d76=_[_0x1827('0x40')]({},_0xef1d76,_0x685291['options']);var _0x14576d={'where':_0xef1d76[_0x1827('0x3f')]};return db[_0x1827('0x2e')][_0x1827('0x1b')](_0x14576d)[_0x1827('0x23')](function(_0x30afb9){_0x389e6f[_0x1827('0x1b')]=_0x30afb9;if(_0x685291['query']['includeAll']){_0xef1d76['include']=[{'all':!![]}];}return db[_0x1827('0x2e')][_0x1827('0x41')](_0xef1d76);})['then'](function(_0x6672c0){_0x389e6f[_0x1827('0x42')]=_0x6672c0;return _0x389e6f;})[_0x1827('0x23')](respondWithFilteredResult(_0x43d17c,_0xef1d76))[_0x1827('0x43')](handleError(_0x43d17c,null));};exports['show']=function(_0x52c42e,_0x218dfa){var _0x22c1d2={'raw':![],'where':{'id':_0x52c42e['params']['id']}},_0x51808c={};_0x51808c['model']=_[_0x1827('0x31')](db[_0x1827('0x2e')][_0x1827('0x2f')]);_0x51808c[_0x1827('0x37')]=_['keys'](_0x52c42e[_0x1827('0x37')]);_0x51808c[_0x1827('0x32')]=_[_0x1827('0x35')](_0x51808c[_0x1827('0x33')],_0x51808c[_0x1827('0x37')]);_0x22c1d2[_0x1827('0x34')]=_[_0x1827('0x35')](_0x51808c[_0x1827('0x33')],qs[_0x1827('0x36')](_0x52c42e['query']['fields']));_0x22c1d2['attributes']=_0x22c1d2[_0x1827('0x34')][_0x1827('0x38')]?_0x22c1d2['attributes']:_0x51808c[_0x1827('0x33')];if(_0x52c42e[_0x1827('0x37')][_0x1827('0x44')]){_0x22c1d2['include']=[{'all':!![]}];}_0x22c1d2=_[_0x1827('0x40')]({},_0x22c1d2,_0x52c42e[_0x1827('0x45')]);return db[_0x1827('0x2e')]['find'](_0x22c1d2)[_0x1827('0x23')](handleEntityNotFound(_0x218dfa,null))[_0x1827('0x23')](respondWithResult(_0x218dfa,null))[_0x1827('0x43')](handleError(_0x218dfa,null));};exports[_0x1827('0x46')]=function(_0x137406,_0x2daecd){return db[_0x1827('0x2e')]['create'](_0x137406[_0x1827('0x47')],{})[_0x1827('0x23')](function(_0x3376b9){var _0x381288=_0x137406['user']['get']({'plain':!![]});if(!_0x381288)throw new Error(_0x1827('0x48'));if(_0x381288['role']==='user'){var _0x2f2109=_0x3376b9[_0x1827('0x49')]({'plain':!![]});var _0x43f48a='Scheduler';return db[_0x1827('0x4a')][_0x1827('0x4b')]({'where':{'name':_0x43f48a,'userProfileId':_0x381288[_0x1827('0x4c')]},'raw':!![]})['then'](function(_0x42638a){if(_0x42638a&&_0x42638a[_0x1827('0x4d')]===0x0){return db[_0x1827('0x26')][_0x1827('0x46')]({'name':_0x2f2109[_0x1827('0x2a')],'resourceId':_0x2f2109['id'],'type':_0x42638a[_0x1827('0x2a')],'sectionId':_0x42638a['id']},{})[_0x1827('0x23')](function(){return _0x3376b9;});}else{return _0x3376b9;}})[_0x1827('0x43')](function(_0x281847){logger[_0x1827('0x28')](_0x1827('0x4e'),_0x281847);throw _0x281847;});}return _0x3376b9;})[_0x1827('0x23')](respondWithResult(_0x2daecd,0xc9))[_0x1827('0x43')](handleError(_0x2daecd,null));};exports[_0x1827('0x22')]=function(_0x458325,_0x43099d){if(_0x458325['body']['id']){delete _0x458325[_0x1827('0x47')]['id'];}return db[_0x1827('0x2e')][_0x1827('0x4b')]({'where':{'id':_0x458325['params']['id']}})['then'](handleEntityNotFound(_0x43099d,null))['then'](saveUpdates(_0x458325[_0x1827('0x47')],null))[_0x1827('0x23')](respondWithResult(_0x43099d,null))['catch'](handleError(_0x43099d,null));};exports[_0x1827('0x24')]=function(_0x55cd99,_0x406f06){return db[_0x1827('0x2e')]['find']({'where':{'id':_0x55cd99[_0x1827('0x4f')]['id']}})[_0x1827('0x23')](handleEntityNotFound(_0x406f06,null))[_0x1827('0x23')](removeEntity(_0x406f06,null))[_0x1827('0x43')](handleError(_0x406f06,null));};exports[_0x1827('0x50')]=function(_0x99f7b4,_0x496b8b,_0x451dd5){var _0x4c662c=require(_0x1827('0x51'));return db[_0x1827('0x2e')][_0x1827('0x4b')]({'where':{'id':_0x99f7b4['params']['id']},'raw':!![]})[_0x1827('0x23')](handleEntityNotFound(_0x496b8b,null))[_0x1827('0x23')](function(){_0x4c662c[_0x1827('0x50')](_0x99f7b4[_0x1827('0x4f')]['id']);})['then'](respondWithStatusCode(_0x496b8b,null))[_0x1827('0x43')](handleError(_0x496b8b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index e7910de..3a8b3f7 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 _0xc231=['path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x23b966,_0x1e633d){var _0x4b15ff=function(_0x1b3282){while(--_0x1b3282){_0x23b966['push'](_0x23b966['shift']());}};_0x4b15ff(++_0x1e633d);}(_0xc231,0x192));var _0x1c23=function(_0x5036e9,_0x13a0e1){_0x5036e9=_0x5036e9-0x0;var _0x115fd9=_0xc231[_0x5036e9];return _0x115fd9;};'use strict';var _=require(_0x1c23('0x0'));var util=require(_0x1c23('0x1'));var logger=require(_0x1c23('0x2'))(_0x1c23('0x3'));var moment=require(_0x1c23('0x4'));var BPromise=require(_0x1c23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c23('0x6'));var rimraf=require(_0x1c23('0x7'));var config=require(_0x1c23('0x8'));var attributes=require(_0x1c23('0x9'));module[_0x1c23('0xa')]=function(_0x57a9dc,_0x1d84c3){return _0x57a9dc['define'](_0x1c23('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c7=['bluebird','request-promise','path','./schedule.attributes','define','lodash','../../config/logger','api','moment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xc9c7,0xef));var _0x7c9c=function(_0x23c215,_0x3ccfca){_0x23c215=_0x23c215-0x0;var _0x43198f=_0xc9c7[_0x23c215];return _0x43198f;};'use strict';var _=require(_0x7c9c('0x0'));var util=require('util');var logger=require(_0x7c9c('0x1'))(_0x7c9c('0x2'));var moment=require(_0x7c9c('0x3'));var BPromise=require(_0x7c9c('0x4'));var rp=require(_0x7c9c('0x5'));var fs=require('fs');var path=require(_0x7c9c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c9c('0x7'));module['exports']=function(_0x416ae2,_0x1bf40c){return _0x416ae2[_0x7c9c('0x8')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index f26172f..b1aafc2 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 _0xd188=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x7f58af,_0x5787cc){var _0x47f99d=function(_0x25a162){while(--_0x25a162){_0x7f58af['push'](_0x7f58af['shift']());}};_0x47f99d(++_0x5787cc);}(_0xd188,0x1f4));var _0x8d18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd188[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8d18('0x0'));var moment=require('moment');var BPromise=require(_0x8d18('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d18('0x2'));var db=require(_0x8d18('0x3'))['db'];var utils=require(_0x8d18('0x4'));var logger=require(_0x8d18('0x5'))(_0x8d18('0x6'));var config=require(_0x8d18('0x7'));var jayson=require(_0x8d18('0x8'));var client=jayson[_0x8d18('0x9')][_0x8d18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39b808,_0x1c3cb9,_0x2d2f43){return new BPromise(function(_0x21e5ac,_0x517d7a){return client[_0x8d18('0xb')](_0x39b808,_0x2d2f43)[_0x8d18('0xc')](function(_0x1eae74){logger[_0x8d18('0xd')](_0x8d18('0xe'),_0x1c3cb9,_0x8d18('0xf'));logger['debug'](_0x8d18('0x10'),_0x1c3cb9,_0x8d18('0xf'),JSON[_0x8d18('0x11')](_0x1eae74));if(_0x1eae74[_0x8d18('0x12')]){if(_0x1eae74[_0x8d18('0x12')][_0x8d18('0x13')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x1c3cb9,_0x1eae74[_0x8d18('0x12')][_0x8d18('0x14')]);return _0x517d7a(_0x1eae74[_0x8d18('0x12')][_0x8d18('0x14')]);}logger[_0x8d18('0x12')](_0x8d18('0xe'),_0x1c3cb9,_0x1eae74[_0x8d18('0x12')][_0x8d18('0x14')]);return _0x21e5ac(_0x1eae74[_0x8d18('0x12')]['message']);}else{logger[_0x8d18('0xd')](_0x8d18('0xe'),_0x1c3cb9,_0x8d18('0xf'));_0x21e5ac(_0x1eae74['result']['message']);}})[_0x8d18('0x15')](function(_0x512e2f){logger[_0x8d18('0x12')](_0x8d18('0xe'),_0x1c3cb9,_0x512e2f);_0x517d7a(_0x512e2f);});});} \ No newline at end of file +var _0xda4c=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','catch'];(function(_0x562eea,_0x1f9ea7){var _0x39caf9=function(_0x14f022){while(--_0x14f022){_0x562eea['push'](_0x562eea['shift']());}};_0x39caf9(++_0x1f9ea7);}(_0xda4c,0x1e4));var _0xcda4=function(_0x204fc8,_0x495c06){_0x204fc8=_0x204fc8-0x0;var _0x296ad1=_0xda4c[_0x204fc8];return _0x296ad1;};'use strict';var _=require(_0xcda4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcda4('0x1'));var rs=require(_0xcda4('0x2'));var fs=require('fs');var Redis=require(_0xcda4('0x3'));var db=require(_0xcda4('0x4'))['db'];var utils=require(_0xcda4('0x5'));var logger=require(_0xcda4('0x6'))(_0xcda4('0x7'));var config=require(_0xcda4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcda4('0x9')][_0xcda4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7e53ff,_0x15931d,_0x54d9c6){return new BPromise(function(_0x810a8,_0x17791d){return client['request'](_0x7e53ff,_0x54d9c6)[_0xcda4('0xb')](function(_0x203e03){logger['info']('Schedule,\x20%s,\x20%s',_0x15931d,_0xcda4('0xc'));logger[_0xcda4('0xd')](_0xcda4('0xe'),_0x15931d,_0xcda4('0xc'),JSON[_0xcda4('0xf')](_0x203e03));if(_0x203e03['error']){if(_0x203e03[_0xcda4('0x10')][_0xcda4('0x11')]===0x1f4){logger[_0xcda4('0x10')](_0xcda4('0x12'),_0x15931d,_0x203e03[_0xcda4('0x10')][_0xcda4('0x13')]);return _0x17791d(_0x203e03[_0xcda4('0x10')][_0xcda4('0x13')]);}logger[_0xcda4('0x10')]('Schedule,\x20%s,\x20%s',_0x15931d,_0x203e03[_0xcda4('0x10')]['message']);return _0x810a8(_0x203e03[_0xcda4('0x10')][_0xcda4('0x13')]);}else{logger[_0xcda4('0x14')](_0xcda4('0x12'),_0x15931d,_0xcda4('0xc'));_0x810a8(_0x203e03['result'][_0xcda4('0x13')]);}})[_0xcda4('0x15')](function(_0x212087){logger[_0xcda4('0x10')]('Schedule,\x20%s,\x20%s',_0x15931d,_0x212087);_0x17791d(_0x212087);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cf8a257..11f917f 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 _0x8f23=['get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index'];(function(_0x423a1f,_0x3039dc){var _0x52f2ba=function(_0x43bf69){while(--_0x43bf69){_0x423a1f['push'](_0x423a1f['shift']());}};_0x52f2ba(++_0x3039dc);}(_0x8f23,0x13b));var _0x38f2=function(_0x148425,_0x11224a){_0x148425=_0x148425-0x0;var _0x120049=_0x8f23[_0x148425];return _0x120049;};'use strict';var multer=require(_0x38f2('0x0'));var util=require('util');var path=require(_0x38f2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x38f2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x38f2('0x3'));var interaction=require(_0x38f2('0x4'));var config=require('../../config/environment');var controller=require(_0x38f2('0x5'));router['get']('/',auth[_0x38f2('0x6')](),controller[_0x38f2('0x7')]);router[_0x38f2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x38f2('0x9')]);router['get'](_0x38f2('0xa'),auth[_0x38f2('0x6')](),controller[_0x38f2('0xb')]);router[_0x38f2('0x8')]('/:id/download',auth[_0x38f2('0x6')](),controller['download']);router[_0x38f2('0xc')]('/',auth['isAuthenticated'](),controller[_0x38f2('0xd')]);router[_0x38f2('0xe')](_0x38f2('0xa'),auth['isAuthenticated'](),controller[_0x38f2('0xf')]);router[_0x38f2('0x10')](_0x38f2('0xa'),auth['isAuthenticated'](),controller[_0x38f2('0x11')]);module[_0x38f2('0x12')]=router; \ No newline at end of file +var _0x0125=['describe','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0x0125,0x182));var _0x5012=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x0125[_0x879e31];return _0x3467e8;};'use strict';var multer=require(_0x5012('0x0'));var util=require(_0x5012('0x1'));var path=require(_0x5012('0x2'));var timeout=require(_0x5012('0x3'));var express=require(_0x5012('0x4'));var router=express[_0x5012('0x5')]();var fs_extra=require(_0x5012('0x6'));var auth=require(_0x5012('0x7'));var interaction=require(_0x5012('0x8'));var config=require(_0x5012('0x9'));var controller=require('./screenRecording.controller');router[_0x5012('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5012('0xa')](_0x5012('0xb'),auth[_0x5012('0xc')](),controller[_0x5012('0xd')]);router['get']('/:id',auth[_0x5012('0xc')](),controller['show']);router['get']('/:id/download',auth[_0x5012('0xc')](),controller['download']);router[_0x5012('0xe')]('/',auth[_0x5012('0xc')](),controller[_0x5012('0xf')]);router[_0x5012('0x10')](_0x5012('0x11'),auth[_0x5012('0xc')](),controller['update']);router[_0x5012('0x12')]('/:id',auth[_0x5012('0xc')](),controller[_0x5012('0x13')]);module[_0x5012('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a2fac25..36a6dcd 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 _0x8aad=['MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','STRING','replace','setDataValue','value','INTEGER','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x2e4e3e,_0x75ae94){var _0x51476b=function(_0x53afdc){while(--_0x53afdc){_0x2e4e3e['push'](_0x2e4e3e['shift']());}};_0x51476b(++_0x75ae94);}(_0x8aad,0x146));var _0xd8aa=function(_0x50a2c6,_0x6ef01c){_0x50a2c6=_0x50a2c6-0x0;var _0x4b0de2=_0x8aad[_0x50a2c6];return _0x4b0de2;};'use strict';var Sequelize=require(_0xd8aa('0x0'));var moment=require(_0xd8aa('0x1'));var path=require('path');var config=require(_0xd8aa('0x2'));module['exports']={'format':{'type':Sequelize[_0xd8aa('0x3')],'get':function(){return this[_0xd8aa('0x4')]('value')?path['extname'](this[_0xd8aa('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd8aa('0x5')]},'value':{'type':Sequelize[_0xd8aa('0x5')],'set':function(_0x16ea12){var _0x4a4b10=_0x16ea12[_0xd8aa('0x6')](/\\/g,'/');this[_0xd8aa('0x7')](_0xd8aa('0x8'),_0x4a4b10);}},'rating':{'type':Sequelize[_0xd8aa('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5de228){this[_0xd8aa('0x7')](_0xd8aa('0xa'),moment()[_0xd8aa('0xb')](_0x5de228,'ms'));this[_0xd8aa('0x7')](_0xd8aa('0xc'),moment());this['setDataValue'](_0xd8aa('0xd'),_0x5de228);}},'startedAt':{'type':Sequelize[_0xd8aa('0xe')],'get':function(){return moment(this[_0xd8aa('0x4')](_0xd8aa('0xa')))[_0xd8aa('0xf')](_0xd8aa('0x10'))[_0xd8aa('0x11')]();}},'closedAt':{'type':Sequelize[_0xd8aa('0xe')],'get':function(){return moment(this[_0xd8aa('0x4')](_0xd8aa('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xd8aa('0x11')]();}},'createdAt':{'type':Sequelize[_0xd8aa('0xe')],'get':function(){return moment(this[_0xd8aa('0x4')]('createdAt'))[_0xd8aa('0xf')](_0xd8aa('0x10'))[_0xd8aa('0x11')]();}},'updatedAt':{'type':Sequelize[_0xd8aa('0xe')],'get':function(){return moment(this['getDataValue'](_0xd8aa('0x12')))[_0xd8aa('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xd8aa('0x11')]();}}}; \ No newline at end of file +var _0x881e=['createdAt','toString','updatedAt','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','closedAt'];(function(_0x1d9cc8,_0x5248dc){var _0x116175=function(_0x364662){while(--_0x364662){_0x1d9cc8['push'](_0x1d9cc8['shift']());}};_0x116175(++_0x5248dc);}(_0x881e,0x146));var _0xe881=function(_0x489e78,_0x3ba1c3){_0x489e78=_0x489e78-0x0;var _0x18e743=_0x881e[_0x489e78];return _0x18e743;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xe881('0x0'));var config=require(_0xe881('0x1'));module['exports']={'format':{'type':Sequelize[_0xe881('0x2')],'get':function(){return this['getDataValue'](_0xe881('0x3'))?path[_0xe881('0x4')](this[_0xe881('0x5')](_0xe881('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe881('0x6')]},'value':{'type':Sequelize[_0xe881('0x6')],'set':function(_0x561c1c){var _0x3f6894=_0x561c1c[_0xe881('0x7')](/\\/g,'/');this[_0xe881('0x8')]('value',_0x3f6894);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe881('0x9')],'set':function(_0x26e29e){this[_0xe881('0x8')](_0xe881('0xa'),moment()['subtract'](_0x26e29e,'ms'));this[_0xe881('0x8')]('closedAt',moment());this[_0xe881('0x8')](_0xe881('0xb'),_0x26e29e);}},'startedAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0xa')))[_0xe881('0xd')](_0xe881('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0xf')))['format'](_0xe881('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0x10')))[_0xe881('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xe881('0x11')]();}},'updatedAt':{'type':Sequelize[_0xe881('0xc')],'get':function(){return moment(this[_0xe881('0x5')](_0xe881('0x12')))['format'](_0xe881('0xe'))[_0xe881('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 105fd56..b129948 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 _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x25add9,_0x235f27){var _0x465181=function(_0x26eaa2){while(--_0x26eaa2){_0x25add9['push'](_0x25add9['shift']());}};_0x465181(++_0x235f27);}(_0x98a8,0x12c));var _0x898a=function(_0x2ff6b7,_0x34fb22){_0x2ff6b7=_0x2ff6b7-0x0;var _0x111de1=_0x98a8[_0x2ff6b7];return _0x111de1;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file +var _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','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','sendStatus'];(function(_0x1a9936,_0x1b9391){var _0x67f23=function(_0x3aa5e1){while(--_0x3aa5e1){_0x1a9936['push'](_0x1a9936['shift']());}};_0x67f23(++_0x1b9391);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x5fc3[_0x4191af];return _0x27bebf;};'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'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bf7a5a9..aebe0ea 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 _0x8159=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','ScreenRecording','screen_recordings','lodash'];(function(_0x4ca731,_0x3d9665){var _0x1fd0a1=function(_0x2c938f){while(--_0x2c938f){_0x4ca731['push'](_0x4ca731['shift']());}};_0x1fd0a1(++_0x3d9665);}(_0x8159,0x6b));var _0x9815=function(_0x236912,_0x318e15){_0x236912=_0x236912-0x0;var _0x2e9733=_0x8159[_0x236912];return _0x2e9733;};'use strict';var _=require(_0x9815('0x0'));var util=require(_0x9815('0x1'));var logger=require(_0x9815('0x2'))(_0x9815('0x3'));var moment=require(_0x9815('0x4'));var BPromise=require(_0x9815('0x5'));var rp=require(_0x9815('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9815('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x9815('0x8')]=function(_0x616262,_0x80c576){return _0x616262[_0x9815('0x9')](_0x9815('0xa'),attributes,{'tableName':_0x9815('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x50ed=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x53eab3,_0x1944e8){var _0x33dd60=function(_0xe741a){while(--_0xe741a){_0x53eab3['push'](_0x53eab3['shift']());}};_0x33dd60(++_0x1944e8);}(_0x50ed,0x182));var _0xd50e=function(_0x30fc08,_0x4fd6bc){_0x30fc08=_0x30fc08-0x0;var _0x239678=_0x50ed[_0x30fc08];return _0x239678;};'use strict';var _=require(_0xd50e('0x0'));var util=require(_0xd50e('0x1'));var logger=require(_0xd50e('0x2'))(_0xd50e('0x3'));var moment=require(_0xd50e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd50e('0x5'));var fs=require('fs');var path=require(_0xd50e('0x6'));var rimraf=require(_0xd50e('0x7'));var config=require(_0xd50e('0x8'));var attributes=require(_0xd50e('0x9'));module[_0xd50e('0xa')]=function(_0x4509be,_0x53a56b){return _0x4509be[_0xd50e('0xb')](_0xd50e('0xc'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xd50e('0xd'),'fields':[_0xd50e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ba3b372..0e66b29 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 _0x3da6=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x55291a,_0x814018){var _0x3c870c=function(_0x1fd787){while(--_0x1fd787){_0x55291a['push'](_0x55291a['shift']());}};_0x3c870c(++_0x814018);}(_0x3da6,0xe8));var _0x63da=function(_0x3ed211,_0x44ff7d){_0x3ed211=_0x3ed211-0x0;var _0x44e593=_0x3da6[_0x3ed211];return _0x44e593;};'use strict';var _=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var moment=require(_0x63da('0x2'));var BPromise=require(_0x63da('0x3'));var rs=require(_0x63da('0x4'));var fs=require('fs');var Redis=require(_0x63da('0x5'));var db=require(_0x63da('0x6'))['db'];var utils=require(_0x63da('0x7'));var logger=require(_0x63da('0x8'))(_0x63da('0x9'));var config=require(_0x63da('0xa'));var jayson=require(_0x63da('0xb'));var client=jayson[_0x63da('0xc')][_0x63da('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x240ffb,_0x6b8c66,_0x492cd0){return new BPromise(function(_0x2161c7,_0x17f575){return client['request'](_0x240ffb,_0x492cd0)[_0x63da('0xe')](function(_0x33eb41){logger[_0x63da('0xf')](_0x63da('0x10'),_0x6b8c66,'request\x20sent');logger['debug'](_0x63da('0x11'),_0x6b8c66,'request\x20sent',JSON[_0x63da('0x12')](_0x33eb41));if(_0x33eb41['error']){if(_0x33eb41[_0x63da('0x13')][_0x63da('0x14')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x6b8c66,_0x33eb41[_0x63da('0x13')][_0x63da('0x15')]);return _0x17f575(_0x33eb41['error']['message']);}logger[_0x63da('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x6b8c66,_0x33eb41[_0x63da('0x13')][_0x63da('0x15')]);return _0x2161c7(_0x33eb41['error']['message']);}else{logger[_0x63da('0xf')](_0x63da('0x10'),_0x6b8c66,_0x63da('0x16'));_0x2161c7(_0x33eb41[_0x63da('0x17')][_0x63da('0x15')]);}})[_0x63da('0x18')](function(_0xef0e38){logger['error'](_0x63da('0x10'),_0x6b8c66,_0xef0e38);_0x17f575(_0xef0e38);});});} \ No newline at end of file +var _0x2db4=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x5cc67c,_0x3efdca){var _0x6637d=function(_0x64f9fa){while(--_0x64f9fa){_0x5cc67c['push'](_0x5cc67c['shift']());}};_0x6637d(++_0x3efdca);}(_0x2db4,0x10e));var _0x42db=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2db4[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x42db('0x0'));var util=require('util');var moment=require(_0x42db('0x1'));var BPromise=require(_0x42db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42db('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x42db('0x4'))(_0x42db('0x5'));var config=require(_0x42db('0x6'));var jayson=require(_0x42db('0x7'));var client=jayson[_0x42db('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a864,_0x517e2b,_0x52900d){return new BPromise(function(_0x33a11d,_0xb16dc5){return client[_0x42db('0x9')](_0x24a864,_0x52900d)[_0x42db('0xa')](function(_0x5e0f2b){logger[_0x42db('0xb')](_0x42db('0xc'),_0x517e2b,_0x42db('0xd'));logger[_0x42db('0xe')](_0x42db('0xf'),_0x517e2b,_0x42db('0xd'),JSON[_0x42db('0x10')](_0x5e0f2b));if(_0x5e0f2b[_0x42db('0x11')]){if(_0x5e0f2b[_0x42db('0x11')][_0x42db('0x12')]===0x1f4){logger[_0x42db('0x11')](_0x42db('0xc'),_0x517e2b,_0x5e0f2b['error'][_0x42db('0x13')]);return _0xb16dc5(_0x5e0f2b['error'][_0x42db('0x13')]);}logger['error'](_0x42db('0xc'),_0x517e2b,_0x5e0f2b['error'][_0x42db('0x13')]);return _0x33a11d(_0x5e0f2b[_0x42db('0x11')][_0x42db('0x13')]);}else{logger['info'](_0x42db('0xc'),_0x517e2b,_0x42db('0xd'));_0x33a11d(_0x5e0f2b[_0x42db('0x14')]['message']);}})[_0x42db('0x15')](function(_0x8f66a8){logger[_0x42db('0x11')](_0x42db('0xc'),_0x517e2b,_0x8f66a8);_0xb16dc5(_0x8f66a8);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4ab445f..a333541 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 _0x8e23=['addLogo','extname','preferred','/:id/preferred','addPreferred','favicon','put','isAuthenticated','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./setting.controller','index','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','originalname','post','single','file'];(function(_0x47653a,_0x244de7){var _0x43a51f=function(_0x3de844){while(--_0x3de844){_0x47653a['push'](_0x47653a['shift']());}};_0x43a51f(++_0x244de7);}(_0x8e23,0xae));var _0x38e2=function(_0x220404,_0x1f5a75){_0x220404=_0x220404-0x0;var _0x5db6d2=_0x8e23[_0x220404];return _0x5db6d2;};'use strict';var multer=require(_0x38e2('0x0'));var util=require(_0x38e2('0x1'));var path=require('path');var timeout=require(_0x38e2('0x2'));var express=require('express');var router=express[_0x38e2('0x3')]();var fs_extra=require(_0x38e2('0x4'));var auth=require(_0x38e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38e2('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x38e2('0x7')]);router[_0x38e2('0x8')](_0x38e2('0x9'),controller[_0x38e2('0xa')]);router['get'](_0x38e2('0xb'),controller[_0x38e2('0xc')]);router[_0x38e2('0x8')](_0x38e2('0xd'),controller['getLogo']);router[_0x38e2('0x8')](_0x38e2('0xe'),controller[_0x38e2('0xf')]);router[_0x38e2('0x8')](_0x38e2('0x10'),controller[_0x38e2('0x11')]);router[_0x38e2('0x8')]('/:id/preferred',controller[_0x38e2('0x12')]);router[_0x38e2('0x8')](_0x38e2('0x13'),controller[_0x38e2('0x14')]);var upload=multer({'storage':multer[_0x38e2('0x15')]({'destination':function(_0x559bf0,_0x2eec92,_0x4bfe6a){_0x4bfe6a(null,path[_0x38e2('0x16')](config[_0x38e2('0x17')],_0x38e2('0x18')));},'filename':function(_0x132a75,_0x8353ed,_0x1a997f){_0x1a997f(null,util[_0x38e2('0x19')](_0x38e2('0x1a'),'logo',path['extname'](_0x8353ed[_0x38e2('0x1b')])));}})});router[_0x38e2('0x1c')](_0x38e2('0xd'),upload[_0x38e2('0x1d')](_0x38e2('0x1e')),controller[_0x38e2('0x1f')]);var upload=multer({'storage':multer[_0x38e2('0x15')]({'destination':function(_0x51e482,_0x5b4d27,_0x229d70){_0x229d70(null,path[_0x38e2('0x16')](config['root'],_0x38e2('0x18')));},'filename':function(_0x2dc8ef,_0x587ab0,_0x1a60fd){_0x1a60fd(null,util['format'](_0x38e2('0x1a'),'logologin',path[_0x38e2('0x20')](_0x587ab0['originalname'])));}})});router[_0x38e2('0x1c')](_0x38e2('0xe'),upload[_0x38e2('0x1d')](_0x38e2('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x38e2('0x15')]({'destination':function(_0x3230ef,_0x3e5817,_0x49fa59){_0x49fa59(null,path[_0x38e2('0x16')](config[_0x38e2('0x17')],_0x38e2('0x18')));},'filename':function(_0x4069af,_0x4a38d1,_0x4d026e){_0x4d026e(null,util[_0x38e2('0x19')](_0x38e2('0x1a'),_0x38e2('0x21'),path[_0x38e2('0x20')](_0x4a38d1[_0x38e2('0x1b')])));}})});router[_0x38e2('0x1c')](_0x38e2('0x22'),upload['single'](_0x38e2('0x1e')),controller[_0x38e2('0x23')]);var upload=multer({'storage':multer[_0x38e2('0x15')]({'destination':function(_0x4b09eb,_0x23e627,_0x42b8b2){_0x42b8b2(null,path[_0x38e2('0x16')](config[_0x38e2('0x17')],_0x38e2('0x18')));},'filename':function(_0x2f8347,_0x2bed81,_0x3f7163){_0x3f7163(null,util[_0x38e2('0x19')]('%s%s',_0x38e2('0x24'),path['extname'](_0x2bed81[_0x38e2('0x1b')])));}})});router[_0x38e2('0x1c')](_0x38e2('0x13'),upload[_0x38e2('0x1d')](_0x38e2('0x1e')),controller['addFavicon']);router[_0x38e2('0x25')]('/:id',auth[_0x38e2('0x26')](),controller[_0x38e2('0x27')]);module[_0x38e2('0x28')]=router; \ No newline at end of file +var _0x2d7c=['put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','diskStorage','root','logologin','single','addLogoLogin','preferred','favicon','addFavicon'];(function(_0x5f170f,_0x553d8e){var _0x2419de=function(_0x2f54f9){while(--_0x2f54f9){_0x5f170f['push'](_0x5f170f['shift']());}};_0x2419de(++_0x553d8e);}(_0x2d7c,0x183));var _0xc2d7=function(_0x3ce571,_0x52e126){_0x3ce571=_0x3ce571-0x0;var _0xcef624=_0x2d7c[_0x3ce571];return _0xcef624;};'use strict';var multer=require(_0xc2d7('0x0'));var util=require(_0xc2d7('0x1'));var path=require(_0xc2d7('0x2'));var timeout=require(_0xc2d7('0x3'));var express=require(_0xc2d7('0x4'));var router=express[_0xc2d7('0x5')]();var fs_extra=require(_0xc2d7('0x6'));var auth=require(_0xc2d7('0x7'));var interaction=require(_0xc2d7('0x8'));var config=require(_0xc2d7('0x9'));var controller=require(_0xc2d7('0xa'));router['get']('/',auth[_0xc2d7('0xb')](),controller[_0xc2d7('0xc')]);router[_0xc2d7('0xd')](_0xc2d7('0xe'),controller[_0xc2d7('0xf')]);router['get'](_0xc2d7('0x10'),controller[_0xc2d7('0x11')]);router[_0xc2d7('0xd')](_0xc2d7('0x12'),controller[_0xc2d7('0x13')]);router[_0xc2d7('0xd')](_0xc2d7('0x14'),controller[_0xc2d7('0x15')]);router['get'](_0xc2d7('0x16'),controller[_0xc2d7('0x17')]);router[_0xc2d7('0xd')](_0xc2d7('0x18'),controller['getPreferred']);router[_0xc2d7('0xd')](_0xc2d7('0x19'),controller[_0xc2d7('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x47b168,_0x1a8fd6,_0x236825){_0x236825(null,path[_0xc2d7('0x1b')](config['root'],_0xc2d7('0x1c')));},'filename':function(_0x43522c,_0x77dffd,_0x3766aa){_0x3766aa(null,util[_0xc2d7('0x1d')](_0xc2d7('0x1e'),_0xc2d7('0x1f'),path[_0xc2d7('0x20')](_0x77dffd[_0xc2d7('0x21')])));}})});router[_0xc2d7('0x22')](_0xc2d7('0x12'),upload['single'](_0xc2d7('0x23')),controller[_0xc2d7('0x24')]);var upload=multer({'storage':multer[_0xc2d7('0x25')]({'destination':function(_0x3f8fec,_0x1ba19a,_0x27a8c5){_0x27a8c5(null,path['join'](config[_0xc2d7('0x26')],'server/files/images/logos/'));},'filename':function(_0x55d488,_0x41be69,_0xd7785){_0xd7785(null,util[_0xc2d7('0x1d')](_0xc2d7('0x1e'),_0xc2d7('0x27'),path[_0xc2d7('0x20')](_0x41be69['originalname'])));}})});router['post']('/:id/logo_login',upload[_0xc2d7('0x28')]('file'),controller[_0xc2d7('0x29')]);var upload=multer({'storage':multer[_0xc2d7('0x25')]({'destination':function(_0x46d4f4,_0x1d8206,_0x57a655){_0x57a655(null,path[_0xc2d7('0x1b')](config[_0xc2d7('0x26')],_0xc2d7('0x1c')));},'filename':function(_0x274f82,_0x530cb0,_0x28abdc){_0x28abdc(null,util[_0xc2d7('0x1d')](_0xc2d7('0x1e'),_0xc2d7('0x2a'),path[_0xc2d7('0x20')](_0x530cb0[_0xc2d7('0x21')])));}})});router['post'](_0xc2d7('0x18'),upload[_0xc2d7('0x28')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xc2d7('0x25')]({'destination':function(_0x2c5e3c,_0x179e40,_0x361cff){_0x361cff(null,path[_0xc2d7('0x1b')](config[_0xc2d7('0x26')],_0xc2d7('0x1c')));},'filename':function(_0x504cf0,_0x5cada7,_0x2be9b6){_0x2be9b6(null,util[_0xc2d7('0x1d')](_0xc2d7('0x1e'),_0xc2d7('0x2b'),path[_0xc2d7('0x20')](_0x5cada7[_0xc2d7('0x21')])));}})});router['post']('/:id/favicon',upload[_0xc2d7('0x28')]('file'),controller[_0xc2d7('0x2c')]);router[_0xc2d7('0x2d')](_0xc2d7('0x10'),auth[_0xc2d7('0xb')](),controller[_0xc2d7('0x2e')]);module[_0xc2d7('0x2f')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d31f9fb..685ebe5 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x20b527,_0x295c88){var _0x4e0689=function(_0x3f3058){while(--_0x3f3058){_0x20b527['push'](_0x20b527['shift']());}};_0x4e0689(++_0x295c88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xd2de9b,_0x56a96d){var _0xbb5c77=function(_0x16fd16){while(--_0x16fd16){_0xd2de9b['push'](_0xd2de9b['shift']());}};_0xbb5c77(++_0x56a96d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index fc30c6a..9c98713 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 _0x3273=['api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','rows','params','body','find','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','getLogoLogin','getLicense','default_loginLogo.svg','custom','\x20not\x20found','download','gdpr','addPreferred','getPreferred','default_preferred.png','getFavicon','server/files/images/logos','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x3273,0x1d1));var _0x3327=function(_0x30bdff,_0x308063){_0x30bdff=_0x30bdff-0x0;var _0x1e7ca9=_0x3273[_0x30bdff];return _0x1e7ca9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3327('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3327('0x1'));var rp=require('request-promise');var moment=require(_0x3327('0x2'));var BPromise=require(_0x3327('0x3'));var Mustache=require(_0x3327('0x4'));var util=require(_0x3327('0x5'));var path=require(_0x3327('0x6'));var sox=require(_0x3327('0x7'));var csv=require('to-csv');var ejs=require(_0x3327('0x8'));var fs=require('fs');var fs_extra=require(_0x3327('0x9'));var _=require(_0x3327('0xa'));var squel=require('squel');var crypto=require(_0x3327('0xb'));var jsforce=require(_0x3327('0xc'));var deskjs=require(_0x3327('0xd'));var toCsv=require(_0x3327('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3327('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3327('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3327('0x11'));var logger=require(_0x3327('0x12'))(_0x3327('0x13'));var utils=require(_0x3327('0x14'));var config=require(_0x3327('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3327('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3327('0x17')][_0x3327('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1140d4,_0x560103,_0x2aa8fa,_0x41342f){return new BPromise(function(_0x16b0f5,_0x1035ff){var _0xe7429a=_0x41342f||client;return _0xe7429a[_0x3327('0x19')](_0x1140d4,_0x2aa8fa)[_0x3327('0x1a')](function(_0x3af0ed){logger[_0x3327('0x1b')](_0x3327('0x1c'),_0x560103,_0x3327('0x1d'));logger['debug'](_0x3327('0x1e'),_0x560103,_0x3327('0x1d'),JSON[_0x3327('0x1f')](_0x3af0ed));if(_0x3af0ed['error']){if(_0x3af0ed[_0x3327('0x20')][_0x3327('0x21')]===0x1f4){logger[_0x3327('0x20')](_0x3327('0x1c'),_0x560103,_0x3af0ed['error'][_0x3327('0x22')]);return _0x1035ff(_0x3af0ed[_0x3327('0x20')][_0x3327('0x22')]);}logger[_0x3327('0x20')](_0x3327('0x1c'),_0x560103,_0x3af0ed[_0x3327('0x20')]['message']);return _0x16b0f5(_0x3af0ed['error']['message']);}else{logger[_0x3327('0x1b')](_0x3327('0x1c'),_0x560103,'request\x20sent');_0x16b0f5(_0x3af0ed[_0x3327('0x23')][_0x3327('0x22')]);}})[_0x3327('0x24')](function(_0xf34c9a){logger[_0x3327('0x20')]('Setting,\x20%s,\x20%s',_0x560103,_0xf34c9a);_0x1035ff(_0xf34c9a);});});}function respondWithStatusCode(_0x2e9e40,_0x1e8f0d){_0x1e8f0d=_0x1e8f0d||0xcc;return function(_0x2af3ba){if(_0x2af3ba){return _0x2e9e40[_0x3327('0x25')](_0x1e8f0d);}return _0x2e9e40['status'](_0x1e8f0d)[_0x3327('0x26')]();};}function respondWithResult(_0x545e9f,_0x578519){_0x578519=_0x578519||0xc8;return function(_0x5ad367){if(_0x5ad367){return _0x545e9f[_0x3327('0x27')](_0x578519)[_0x3327('0x28')](_0x5ad367);}};}function respondWithFilteredResult(_0x2db04d,_0x5d570d){return function(_0x162ca9){if(_0x162ca9){var _0x4f2d0f=typeof _0x5d570d['offset']===_0x3327('0x29')&&typeof _0x5d570d[_0x3327('0x2a')]===_0x3327('0x29');var _0x32d8d1=_0x162ca9['count'];var _0x501e03=_0x4f2d0f?0x0:_0x5d570d['offset'];var _0x5dda7c=_0x4f2d0f?_0x162ca9[_0x3327('0x2b')]:_0x5d570d[_0x3327('0x2c')]+_0x5d570d[_0x3327('0x2a')];var _0x2aa5b2;if(_0x5dda7c>=_0x32d8d1){_0x5dda7c=_0x32d8d1;_0x2aa5b2=0xc8;}else{_0x2aa5b2=0xce;}_0x2db04d[_0x3327('0x27')](_0x2aa5b2);return _0x2db04d[_0x3327('0x2d')](_0x3327('0x2e'),_0x501e03+'-'+_0x5dda7c+'/'+_0x32d8d1)['json'](_0x162ca9);}return null;};}function patchUpdates(_0xa47fb9){return function(_0x5da450){try{jsonpatch[_0x3327('0x2f')](_0x5da450,_0xa47fb9,!![]);}catch(_0x43ec4f){return BPromise['reject'](_0x43ec4f);}return _0x5da450[_0x3327('0x30')]();};}function saveUpdates(_0x158147,_0x5c339f){return function(_0x1b7149){if(_0x1b7149){return _0x1b7149[_0x3327('0x31')](_0x158147)['then'](function(_0x5de13b){return _0x5de13b;});}return null;};}function removeEntity(_0x4d7d1a,_0x3a641f){return function(_0x241c83){if(_0x241c83){return _0x241c83[_0x3327('0x32')]()[_0x3327('0x1a')](function(){_0x4d7d1a[_0x3327('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf204ed,_0xadd15e){return function(_0x1740eb){if(!_0x1740eb){_0xf204ed[_0x3327('0x25')](0x194);}return _0x1740eb;};}function handleError(_0x16791b,_0x59a32b){_0x59a32b=_0x59a32b||0x1f4;return function(_0x726997){logger[_0x3327('0x20')](_0x726997[_0x3327('0x33')]);if(_0x726997[_0x3327('0x34')]){delete _0x726997[_0x3327('0x34')];}_0x16791b[_0x3327('0x27')](_0x59a32b)[_0x3327('0x35')](_0x726997);};}exports[_0x3327('0x36')]=function(_0x384f0c,_0xae62f0){var _0x1a5499={},_0x42483d={},_0x475290={'count':0x0,'rows':[]};var _0x2baca0=_[_0x3327('0x37')](db[_0x3327('0x38')][_0x3327('0x39')],function(_0x1945db){return{'name':_0x1945db[_0x3327('0x3a')],'type':_0x1945db[_0x3327('0x3b')][_0x3327('0x3c')]};});_0x42483d[_0x3327('0x3d')]=_[_0x3327('0x37')](_0x2baca0,_0x3327('0x34'));_0x42483d[_0x3327('0x3e')]=_['keys'](_0x384f0c[_0x3327('0x3e')]);_0x42483d[_0x3327('0x3f')]=_['intersection'](_0x42483d[_0x3327('0x3d')],_0x42483d[_0x3327('0x3e')]);_0x1a5499[_0x3327('0x40')]=_[_0x3327('0x41')](_0x42483d[_0x3327('0x3d')],qs[_0x3327('0x42')](_0x384f0c['query'][_0x3327('0x42')]));_0x1a5499['attributes']=_0x1a5499[_0x3327('0x40')]['length']?_0x1a5499[_0x3327('0x40')]:_0x42483d[_0x3327('0x3d')];if(!_0x384f0c['query'][_0x3327('0x43')](_0x3327('0x44'))){_0x1a5499[_0x3327('0x2a')]=qs['limit'](_0x384f0c['query'][_0x3327('0x2a')]);_0x1a5499[_0x3327('0x2c')]=qs[_0x3327('0x2c')](_0x384f0c[_0x3327('0x3e')][_0x3327('0x2c')]);}_0x1a5499['order']=qs[_0x3327('0x45')](_0x384f0c[_0x3327('0x3e')][_0x3327('0x45')]);_0x1a5499['where']=qs['filters'](_[_0x3327('0x46')](_0x384f0c[_0x3327('0x3e')],_0x42483d[_0x3327('0x3f')]),_0x2baca0);if(_0x384f0c['query'][_0x3327('0x47')]){_0x1a5499[_0x3327('0x48')]=_[_0x3327('0x49')](_0x1a5499['where'],{'$or':_[_0x3327('0x37')](_0x2baca0,function(_0x744450){if(_0x744450[_0x3327('0x3b')]!=='VIRTUAL'){var _0x54b017={};_0x54b017[_0x744450[_0x3327('0x34')]]={'$like':'%'+_0x384f0c[_0x3327('0x3e')][_0x3327('0x47')]+'%'};return _0x54b017;}})});}_0x1a5499=_[_0x3327('0x49')]({},_0x1a5499,_0x384f0c[_0x3327('0x4a')]);var _0x5cc509={'where':_0x1a5499[_0x3327('0x48')]};return db[_0x3327('0x38')]['count'](_0x5cc509)[_0x3327('0x1a')](function(_0x177a67){_0x475290['count']=_0x177a67;if(_0x384f0c['query'][_0x3327('0x4b')]){_0x1a5499[_0x3327('0x4c')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x1a5499);})[_0x3327('0x1a')](function(_0x234111){_0x475290[_0x3327('0x4d')]=_0x234111;return _0x475290;})[_0x3327('0x1a')](respondWithFilteredResult(_0xae62f0,_0x1a5499))[_0x3327('0x24')](handleError(_0xae62f0,null));};exports['show']=function(_0x431b70,_0xdcccba){var _0x107fe4={'raw':![],'where':{'id':_0x431b70[_0x3327('0x4e')]['id']}},_0x3762ad={};_0x3762ad[_0x3327('0x3d')]=_['keys'](db['Setting'][_0x3327('0x39')]);_0x3762ad[_0x3327('0x3e')]=_['keys'](_0x431b70[_0x3327('0x3e')]);_0x3762ad['filters']=_[_0x3327('0x41')](_0x3762ad[_0x3327('0x3d')],_0x3762ad['query']);_0x107fe4[_0x3327('0x40')]=_['intersection'](_0x3762ad[_0x3327('0x3d')],qs[_0x3327('0x42')](_0x431b70['query'][_0x3327('0x42')]));_0x107fe4[_0x3327('0x40')]=_0x107fe4[_0x3327('0x40')]['length']?_0x107fe4['attributes']:_0x3762ad[_0x3327('0x3d')];if(_0x431b70['query'][_0x3327('0x4b')]){_0x107fe4[_0x3327('0x4c')]=[{'all':!![]}];}_0x107fe4=_[_0x3327('0x49')]({},_0x107fe4,_0x431b70[_0x3327('0x4a')]);return db[_0x3327('0x38')]['find'](_0x107fe4)['then'](handleEntityNotFound(_0xdcccba,null))[_0x3327('0x1a')](respondWithResult(_0xdcccba,null))['catch'](handleError(_0xdcccba,null));};exports[_0x3327('0x31')]=function(_0x1cdc50,_0x4e1e9e){if(_0x1cdc50[_0x3327('0x4f')]['id']){delete _0x1cdc50['body']['id'];}return db[_0x3327('0x38')][_0x3327('0x50')]({'where':{'id':_0x1cdc50[_0x3327('0x4e')]['id']}})[_0x3327('0x1a')](handleEntityNotFound(_0x4e1e9e,null))[_0x3327('0x1a')](saveUpdates(_0x1cdc50[_0x3327('0x4f')],null))[_0x3327('0x1a')](respondWithResult(_0x4e1e9e,null))[_0x3327('0x24')](handleError(_0x4e1e9e,null));};exports[_0x3327('0x51')]=function(_0x221750,_0x32b41c,_0x505780){if(_0x221750[_0x3327('0x52')]&&_0x221750['file'][_0x3327('0x53')]){_0x221750[_0x3327('0x4f')]['logo']=_0x221750[_0x3327('0x52')][_0x3327('0x53')];}return db[_0x3327('0x38')]['find']({'where':{'id':_0x221750['params']['id']}})['then'](handleEntityNotFound(_0x32b41c,null))[_0x3327('0x1a')](saveUpdates(_0x221750[_0x3327('0x4f')],null))[_0x3327('0x1a')](respondWithResult(_0x32b41c,null))['catch'](handleError(_0x32b41c,null));};exports[_0x3327('0x54')]=function(_0x28dece,_0x15d843,_0x306c96){if(_0x28dece[_0x3327('0x52')]&&_0x28dece[_0x3327('0x52')][_0x3327('0x53')]){_0x28dece['body'][_0x3327('0x55')]=_0x28dece[_0x3327('0x52')][_0x3327('0x53')];}return db[_0x3327('0x38')][_0x3327('0x50')]({'where':{'id':_0x28dece[_0x3327('0x4e')]['id']}})[_0x3327('0x1a')](handleEntityNotFound(_0x15d843,null))[_0x3327('0x1a')](saveUpdates(_0x28dece[_0x3327('0x4f')],null))[_0x3327('0x1a')](respondWithResult(_0x15d843,null))[_0x3327('0x24')](handleError(_0x15d843,null));};var utilLicense=require(_0x3327('0x56'));exports['getLogo']=function(_0x32c50b,_0x3d5710,_0x14fb63){var _0x2616d0='server/files/images/logos';var _0x350bad={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x132559){if(_0x132559){_0x350bad=_0x132559;}return db[_0x3327('0x38')][_0x3327('0x50')]({'where':{'id':_0x32c50b[_0x3327('0x4e')]['id']},'attributes':[_0x3327('0x57'),_0x3327('0x55'),_0x3327('0x58'),_0x3327('0x59'),_0x3327('0x5a'),_0x3327('0x5b'),_0x3327('0x5c'),_0x3327('0x5d')],'raw':!![]});})[_0x3327('0x1a')](handleEntityNotFound(_0x3d5710,null))[_0x3327('0x1a')](function(_0x4d8b75){if(_0x4d8b75){var _0x38101e=_0x4d8b75[_0x3327('0x57')]&&fs['existsSync'](path[_0x3327('0x5e')](config['root'],_0x2616d0,_[_0x3327('0x5f')](_0x4d8b75[_0x3327('0x57')])))?path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x2616d0,_[_0x3327('0x5f')](_0x4d8b75[_0x3327('0x57')])):path['join'](config['root'],_0x2616d0,_[_0x3327('0x5f')](_0x3327('0x61')));var _0x2dd799=_0x3327('0x62')+_[_0x3327('0x63')](_0x3327('0x57'));if(_0x4d8b75[_0x2dd799]||!_0x350bad['custom']){_0x38101e=path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x2616d0,_[_0x3327('0x5f')]('default_logo.svg'));}if(!fs[_0x3327('0x64')](_0x38101e)){throw new db[(_0x3327('0x65'))][(_0x3327('0x66'))](_[_0x3327('0x63')](_0x3327('0x57'))+'\x20not\x20found');}return _0x3d5710['download'](_0x38101e);}})[_0x3327('0x24')](handleError(_0x3d5710,null));};var utilLicense=require(_0x3327('0x56'));exports[_0x3327('0x67')]=function(_0x538025,_0x5d0207,_0x2df651){var _0x1040dd='server/files/images/logos';var _0x4d4ccd={'custom':![]};return utilLicense[_0x3327('0x68')]()[_0x3327('0x1a')](function(_0x132c5e){if(_0x132c5e){_0x4d4ccd=_0x132c5e;}return db[_0x3327('0x38')]['find']({'where':{'id':_0x538025[_0x3327('0x4e')]['id']},'attributes':[_0x3327('0x57'),_0x3327('0x55'),_0x3327('0x58'),'favicon',_0x3327('0x5a'),_0x3327('0x5b'),'defaultPreferred',_0x3327('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d0207,null))['then'](function(_0x1a3bba){if(_0x1a3bba){var _0x19492b=_0x1a3bba[_0x3327('0x55')]&&fs[_0x3327('0x64')](path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x1040dd,_[_0x3327('0x5f')](_0x1a3bba['loginLogo'])))?path['join'](config[_0x3327('0x60')],_0x1040dd,_[_0x3327('0x5f')](_0x1a3bba[_0x3327('0x55')])):path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x1040dd,_[_0x3327('0x5f')](_0x3327('0x69')));var _0xf60f69=_0x3327('0x62')+_[_0x3327('0x63')](_0x3327('0x55'));if(_0x1a3bba[_0xf60f69]||!_0x4d4ccd[_0x3327('0x6a')]){_0x19492b=path['join'](config[_0x3327('0x60')],_0x1040dd,_[_0x3327('0x5f')](_0x3327('0x69')));}if(!fs['existsSync'](_0x19492b)){throw new db['Sequelize'][(_0x3327('0x66'))](_['upperFirst'](_0x3327('0x55'))+_0x3327('0x6b'));}return _0x5d0207[_0x3327('0x6c')](_0x19492b);}})[_0x3327('0x24')](handleError(_0x5d0207,null));};exports[_0x3327('0x6d')]=function(_0xd6080c,_0x16110e){return db[_0x3327('0x38')][_0x3327('0x50')]({'where':{'id':_0xd6080c[_0x3327('0x4e')]['id']},'attributes':['securePassword']})[_0x3327('0x1a')](respondWithResult(_0x16110e,null))[_0x3327('0x24')](handleError(_0x16110e,null));};exports[_0x3327('0x6e')]=function(_0x4c763c,_0x5c0099,_0x44cf2b){if(_0x4c763c[_0x3327('0x52')]&&_0x4c763c[_0x3327('0x52')][_0x3327('0x53')]){_0x4c763c[_0x3327('0x4f')][_0x3327('0x58')]=_0x4c763c['file'][_0x3327('0x53')];}return db[_0x3327('0x38')][_0x3327('0x50')]({'where':{'id':_0x4c763c[_0x3327('0x4e')]['id']}})[_0x3327('0x1a')](handleEntityNotFound(_0x5c0099,null))[_0x3327('0x1a')](saveUpdates(_0x4c763c[_0x3327('0x4f')],null))[_0x3327('0x1a')](respondWithResult(_0x5c0099,null))[_0x3327('0x24')](handleError(_0x5c0099,null));};var utilLicense=require(_0x3327('0x56'));exports[_0x3327('0x6f')]=function(_0x215af8,_0x329cfb,_0x1eab32){var _0x4ea3f1='server/files/images/logos';var _0x286e85={'custom':![]};return utilLicense[_0x3327('0x68')]()['then'](function(_0x49c3a5){if(_0x49c3a5){_0x286e85=_0x49c3a5;}return db[_0x3327('0x38')]['find']({'where':{'id':_0x215af8[_0x3327('0x4e')]['id']},'attributes':[_0x3327('0x57'),_0x3327('0x55'),'preferred','favicon',_0x3327('0x5a'),_0x3327('0x5b'),_0x3327('0x5c'),_0x3327('0x5d')],'raw':!![]});})[_0x3327('0x1a')](handleEntityNotFound(_0x329cfb,null))['then'](function(_0x3fe427){if(_0x3fe427){var _0x13c099=_0x3fe427[_0x3327('0x58')]&&fs['existsSync'](path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4ea3f1,_[_0x3327('0x5f')](_0x3fe427['preferred'])))?path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4ea3f1,_['toLower'](_0x3fe427[_0x3327('0x58')])):path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4ea3f1,_[_0x3327('0x5f')](_0x3327('0x70')));var _0x46095f=_0x3327('0x62')+_[_0x3327('0x63')](_0x3327('0x58'));if(_0x3fe427[_0x46095f]||!_0x286e85[_0x3327('0x6a')]||!_0x286e85[_0x3327('0x58')]){_0x13c099=path[_0x3327('0x5e')](config['root'],_0x4ea3f1,_[_0x3327('0x5f')](_0x3327('0x70')));}if(!fs[_0x3327('0x64')](_0x13c099)){throw new db[(_0x3327('0x65'))][(_0x3327('0x66'))](_[_0x3327('0x63')]('preferred')+_0x3327('0x6b'));}return _0x329cfb[_0x3327('0x6c')](_0x13c099);}})['catch'](handleError(_0x329cfb,null));};exports['addFavicon']=function(_0x135494,_0x5bd348,_0x15cc3e){if(_0x135494[_0x3327('0x52')]&&_0x135494[_0x3327('0x52')][_0x3327('0x53')]){_0x135494[_0x3327('0x4f')][_0x3327('0x59')]=_0x135494[_0x3327('0x52')][_0x3327('0x53')];}return db[_0x3327('0x38')]['find']({'where':{'id':_0x135494[_0x3327('0x4e')]['id']}})[_0x3327('0x1a')](handleEntityNotFound(_0x5bd348,null))['then'](saveUpdates(_0x135494['body'],null))[_0x3327('0x1a')](respondWithResult(_0x5bd348,null))[_0x3327('0x24')](handleError(_0x5bd348,null));};var utilLicense=require(_0x3327('0x56'));exports[_0x3327('0x71')]=function(_0x942d3f,_0x5b4b9f,_0x506b4f){var _0x4a185c=_0x3327('0x72');var _0x1c8e42={'custom':![]};return utilLicense['getLicense']()[_0x3327('0x1a')](function(_0x210e94){if(_0x210e94){_0x1c8e42=_0x210e94;}return db[_0x3327('0x38')]['find']({'where':{'id':_0x942d3f[_0x3327('0x4e')]['id']},'attributes':['logo',_0x3327('0x55'),_0x3327('0x58'),_0x3327('0x59'),_0x3327('0x5a'),_0x3327('0x5b'),_0x3327('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x3327('0x1a')](handleEntityNotFound(_0x5b4b9f,null))[_0x3327('0x1a')](function(_0x3b455b){if(_0x3b455b){var _0xd70350=_0x3b455b[_0x3327('0x59')]&&fs[_0x3327('0x64')](path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4a185c,_[_0x3327('0x5f')](_0x3b455b[_0x3327('0x59')])))?path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4a185c,_[_0x3327('0x5f')](_0x3b455b[_0x3327('0x59')])):path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4a185c,_[_0x3327('0x5f')](_0x3327('0x73')));var _0x539e8d='default'+_['upperFirst'](_0x3327('0x59'));if(_0x3b455b[_0x539e8d]||!_0x1c8e42[_0x3327('0x6a')]){_0xd70350=path[_0x3327('0x5e')](config[_0x3327('0x60')],_0x4a185c,_[_0x3327('0x5f')]('default_favicon.ico'));}if(!fs[_0x3327('0x64')](_0xd70350)){throw new db['Sequelize']['ValidationError'](_[_0x3327('0x63')](_0x3327('0x59'))+'\x20not\x20found');}return _0x5b4b9f[_0x3327('0x6c')](_0xd70350);}})['catch'](handleError(_0x5b4b9f,null));};exports[_0x3327('0x74')]=function(_0x15a934,_0x180eda){var _0x18c395={'offset':moment()[_0x3327('0x75')]()};_0x18c395[_0x3327('0x76')]=moment()['utcOffset'](_0x18c395['offset'])[_0x3327('0x77')](_0x3327('0x78'));return _0x180eda[_0x3327('0x27')](0xc8)[_0x3327('0x35')](_0x18c395);}; \ No newline at end of file +var _0x33cf=['result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','Setting','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','options','find','update','body','params','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','logo','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','getLicense','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x302d0d,_0x5a9457){var _0xc6574c=function(_0x68950d){while(--_0x68950d){_0x302d0d['push'](_0x302d0d['shift']());}};_0xc6574c(++_0x5a9457);}(_0x33cf,0x14a));var _0xf33c=function(_0x177ccb,_0x40ed77){_0x177ccb=_0x177ccb-0x0;var _0x48d7db=_0x33cf[_0x177ccb];return _0x48d7db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf33c('0x0'));var jsonpatch=require(_0xf33c('0x1'));var rp=require(_0xf33c('0x2'));var moment=require(_0xf33c('0x3'));var BPromise=require(_0xf33c('0x4'));var Mustache=require(_0xf33c('0x5'));var util=require(_0xf33c('0x6'));var path=require(_0xf33c('0x7'));var sox=require(_0xf33c('0x8'));var csv=require('to-csv');var ejs=require(_0xf33c('0x9'));var fs=require('fs');var fs_extra=require(_0xf33c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf33c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf33c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf33c('0xd'));var Redis=require(_0xf33c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf33c('0xf'));var as=require(_0xf33c('0x10'));var hardwareService=require(_0xf33c('0x11'));var logger=require(_0xf33c('0x12'))(_0xf33c('0x13'));var utils=require(_0xf33c('0x14'));var config=require(_0xf33c('0x15'));var licenseUtil=require(_0xf33c('0x16'));var db=require(_0xf33c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf33c('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e318d,_0x1e5d28,_0x5a6f79,_0x4b37e0){return new BPromise(function(_0x4afe0a,_0x47001e){var _0x1dc954=_0x4b37e0||client;return _0x1dc954[_0xf33c('0x19')](_0x5e318d,_0x5a6f79)[_0xf33c('0x1a')](function(_0x17d9c0){logger['info'](_0xf33c('0x1b'),_0x1e5d28,_0xf33c('0x1c'));logger[_0xf33c('0x1d')](_0xf33c('0x1e'),_0x1e5d28,_0xf33c('0x1c'),JSON[_0xf33c('0x1f')](_0x17d9c0));if(_0x17d9c0[_0xf33c('0x20')]){if(_0x17d9c0[_0xf33c('0x20')][_0xf33c('0x21')]===0x1f4){logger['error'](_0xf33c('0x1b'),_0x1e5d28,_0x17d9c0[_0xf33c('0x20')][_0xf33c('0x22')]);return _0x47001e(_0x17d9c0[_0xf33c('0x20')][_0xf33c('0x22')]);}logger[_0xf33c('0x20')](_0xf33c('0x1b'),_0x1e5d28,_0x17d9c0[_0xf33c('0x20')][_0xf33c('0x22')]);return _0x4afe0a(_0x17d9c0[_0xf33c('0x20')][_0xf33c('0x22')]);}else{logger[_0xf33c('0x23')](_0xf33c('0x1b'),_0x1e5d28,'request\x20sent');_0x4afe0a(_0x17d9c0[_0xf33c('0x24')][_0xf33c('0x22')]);}})['catch'](function(_0x4bfa5b){logger[_0xf33c('0x20')](_0xf33c('0x1b'),_0x1e5d28,_0x4bfa5b);_0x47001e(_0x4bfa5b);});});}function respondWithStatusCode(_0x214078,_0x1816b2){_0x1816b2=_0x1816b2||0xcc;return function(_0x4ec8d5){if(_0x4ec8d5){return _0x214078[_0xf33c('0x25')](_0x1816b2);}return _0x214078[_0xf33c('0x26')](_0x1816b2)[_0xf33c('0x27')]();};}function respondWithResult(_0x28e631,_0x4fd9f8){_0x4fd9f8=_0x4fd9f8||0xc8;return function(_0x4f84c5){if(_0x4f84c5){return _0x28e631[_0xf33c('0x26')](_0x4fd9f8)['json'](_0x4f84c5);}};}function respondWithFilteredResult(_0x47c83a,_0x182fdd){return function(_0x1bf4bc){if(_0x1bf4bc){var _0x146ff8=typeof _0x182fdd[_0xf33c('0x28')]===_0xf33c('0x29')&&typeof _0x182fdd[_0xf33c('0x2a')]==='undefined';var _0x46acf5=_0x1bf4bc[_0xf33c('0x2b')];var _0x1f627d=_0x146ff8?0x0:_0x182fdd[_0xf33c('0x28')];var _0x11c17f=_0x146ff8?_0x1bf4bc['count']:_0x182fdd[_0xf33c('0x28')]+_0x182fdd[_0xf33c('0x2a')];var _0x2ab7e0;if(_0x11c17f>=_0x46acf5){_0x11c17f=_0x46acf5;_0x2ab7e0=0xc8;}else{_0x2ab7e0=0xce;}_0x47c83a[_0xf33c('0x26')](_0x2ab7e0);return _0x47c83a[_0xf33c('0x2c')](_0xf33c('0x2d'),_0x1f627d+'-'+_0x11c17f+'/'+_0x46acf5)['json'](_0x1bf4bc);}return null;};}function patchUpdates(_0x38722a){return function(_0x19a01c){try{jsonpatch[_0xf33c('0x2e')](_0x19a01c,_0x38722a,!![]);}catch(_0x42c822){return BPromise[_0xf33c('0x2f')](_0x42c822);}return _0x19a01c[_0xf33c('0x30')]();};}function saveUpdates(_0x26e9e7,_0x3ef4b8){return function(_0x55305b){if(_0x55305b){return _0x55305b['update'](_0x26e9e7)[_0xf33c('0x1a')](function(_0x5628e4){return _0x5628e4;});}return null;};}function removeEntity(_0x1e10a7,_0x4f4970){return function(_0x44176b){if(_0x44176b){return _0x44176b[_0xf33c('0x31')]()['then'](function(){_0x1e10a7[_0xf33c('0x26')](0xcc)[_0xf33c('0x27')]();});}};}function handleEntityNotFound(_0x2c4155,_0x4ee92f){return function(_0xa3f9ee){if(!_0xa3f9ee){_0x2c4155[_0xf33c('0x25')](0x194);}return _0xa3f9ee;};}function handleError(_0xc2df75,_0x144ea2){_0x144ea2=_0x144ea2||0x1f4;return function(_0x29f623){logger[_0xf33c('0x20')](_0x29f623[_0xf33c('0x32')]);if(_0x29f623[_0xf33c('0x33')]){delete _0x29f623['name'];}_0xc2df75['status'](_0x144ea2)[_0xf33c('0x34')](_0x29f623);};}exports[_0xf33c('0x35')]=function(_0xd34e3a,_0x574008){var _0x5ab0b8={},_0x39adab={},_0x4020f7={'count':0x0,'rows':[]};var _0x3ee474=_[_0xf33c('0x36')](db[_0xf33c('0x37')][_0xf33c('0x38')],function(_0xb375b4){return{'name':_0xb375b4['fieldName'],'type':_0xb375b4['type']['key']};});_0x39adab['model']=_['map'](_0x3ee474,'name');_0x39adab[_0xf33c('0x39')]=_[_0xf33c('0x3a')](_0xd34e3a['query']);_0x39adab[_0xf33c('0x3b')]=_[_0xf33c('0x3c')](_0x39adab[_0xf33c('0x3d')],_0x39adab[_0xf33c('0x39')]);_0x5ab0b8['attributes']=_[_0xf33c('0x3c')](_0x39adab['model'],qs[_0xf33c('0x3e')](_0xd34e3a['query'][_0xf33c('0x3e')]));_0x5ab0b8[_0xf33c('0x3f')]=_0x5ab0b8[_0xf33c('0x3f')][_0xf33c('0x40')]?_0x5ab0b8[_0xf33c('0x3f')]:_0x39adab[_0xf33c('0x3d')];if(!_0xd34e3a[_0xf33c('0x39')]['hasOwnProperty']('nolimit')){_0x5ab0b8[_0xf33c('0x2a')]=qs[_0xf33c('0x2a')](_0xd34e3a[_0xf33c('0x39')][_0xf33c('0x2a')]);_0x5ab0b8[_0xf33c('0x28')]=qs[_0xf33c('0x28')](_0xd34e3a['query'][_0xf33c('0x28')]);}_0x5ab0b8[_0xf33c('0x41')]=qs[_0xf33c('0x42')](_0xd34e3a['query'][_0xf33c('0x42')]);_0x5ab0b8['where']=qs[_0xf33c('0x3b')](_[_0xf33c('0x43')](_0xd34e3a['query'],_0x39adab[_0xf33c('0x3b')]),_0x3ee474);if(_0xd34e3a[_0xf33c('0x39')][_0xf33c('0x44')]){_0x5ab0b8[_0xf33c('0x45')]=_['merge'](_0x5ab0b8['where'],{'$or':_[_0xf33c('0x36')](_0x3ee474,function(_0x55c3b9){if(_0x55c3b9[_0xf33c('0x46')]!==_0xf33c('0x47')){var _0x11a078={};_0x11a078[_0x55c3b9['name']]={'$like':'%'+_0xd34e3a[_0xf33c('0x39')][_0xf33c('0x44')]+'%'};return _0x11a078;}})});}_0x5ab0b8=_['merge']({},_0x5ab0b8,_0xd34e3a['options']);var _0x16fd8f={'where':_0x5ab0b8[_0xf33c('0x45')]};return db['Setting']['count'](_0x16fd8f)['then'](function(_0x11c89f){_0x4020f7['count']=_0x11c89f;if(_0xd34e3a[_0xf33c('0x39')][_0xf33c('0x48')]){_0x5ab0b8[_0xf33c('0x49')]=[{'all':!![]}];}return db[_0xf33c('0x37')][_0xf33c('0x4a')](_0x5ab0b8);})['then'](function(_0x5ceeff){_0x4020f7[_0xf33c('0x4b')]=_0x5ceeff;return _0x4020f7;})[_0xf33c('0x1a')](respondWithFilteredResult(_0x574008,_0x5ab0b8))[_0xf33c('0x4c')](handleError(_0x574008,null));};exports[_0xf33c('0x4d')]=function(_0x7a02ec,_0x4183e5){var _0x17d4f3={'raw':![],'where':{'id':_0x7a02ec['params']['id']}},_0x7cd06b={};_0x7cd06b[_0xf33c('0x3d')]=_[_0xf33c('0x3a')](db[_0xf33c('0x37')][_0xf33c('0x38')]);_0x7cd06b[_0xf33c('0x39')]=_[_0xf33c('0x3a')](_0x7a02ec['query']);_0x7cd06b[_0xf33c('0x3b')]=_[_0xf33c('0x3c')](_0x7cd06b[_0xf33c('0x3d')],_0x7cd06b['query']);_0x17d4f3['attributes']=_[_0xf33c('0x3c')](_0x7cd06b[_0xf33c('0x3d')],qs[_0xf33c('0x3e')](_0x7a02ec['query'][_0xf33c('0x3e')]));_0x17d4f3['attributes']=_0x17d4f3[_0xf33c('0x3f')]['length']?_0x17d4f3[_0xf33c('0x3f')]:_0x7cd06b['model'];if(_0x7a02ec[_0xf33c('0x39')][_0xf33c('0x48')]){_0x17d4f3['include']=[{'all':!![]}];}_0x17d4f3=_[_0xf33c('0x4e')]({},_0x17d4f3,_0x7a02ec[_0xf33c('0x4f')]);return db[_0xf33c('0x37')][_0xf33c('0x50')](_0x17d4f3)[_0xf33c('0x1a')](handleEntityNotFound(_0x4183e5,null))[_0xf33c('0x1a')](respondWithResult(_0x4183e5,null))[_0xf33c('0x4c')](handleError(_0x4183e5,null));};exports[_0xf33c('0x51')]=function(_0x1e148e,_0x1878c3){if(_0x1e148e[_0xf33c('0x52')]['id']){delete _0x1e148e['body']['id'];}return db[_0xf33c('0x37')][_0xf33c('0x50')]({'where':{'id':_0x1e148e[_0xf33c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1878c3,null))[_0xf33c('0x1a')](saveUpdates(_0x1e148e[_0xf33c('0x52')],null))[_0xf33c('0x1a')](respondWithResult(_0x1878c3,null))['catch'](handleError(_0x1878c3,null));};exports[_0xf33c('0x54')]=function(_0x48547b,_0x545f46,_0xe48421){if(_0x48547b['file']&&_0x48547b[_0xf33c('0x55')][_0xf33c('0x56')]){_0x48547b[_0xf33c('0x52')]['logo']=_0x48547b[_0xf33c('0x55')]['filename'];}return db['Setting'][_0xf33c('0x50')]({'where':{'id':_0x48547b['params']['id']}})[_0xf33c('0x1a')](handleEntityNotFound(_0x545f46,null))[_0xf33c('0x1a')](saveUpdates(_0x48547b[_0xf33c('0x52')],null))[_0xf33c('0x1a')](respondWithResult(_0x545f46,null))[_0xf33c('0x4c')](handleError(_0x545f46,null));};exports['addLogoLogin']=function(_0x243b85,_0x59b1ae,_0x4cbe4b){if(_0x243b85[_0xf33c('0x55')]&&_0x243b85[_0xf33c('0x55')]['filename']){_0x243b85['body'][_0xf33c('0x57')]=_0x243b85[_0xf33c('0x55')][_0xf33c('0x56')];}return db[_0xf33c('0x37')]['find']({'where':{'id':_0x243b85[_0xf33c('0x53')]['id']}})['then'](handleEntityNotFound(_0x59b1ae,null))[_0xf33c('0x1a')](saveUpdates(_0x243b85[_0xf33c('0x52')],null))[_0xf33c('0x1a')](respondWithResult(_0x59b1ae,null))[_0xf33c('0x4c')](handleError(_0x59b1ae,null));};var utilLicense=require(_0xf33c('0x16'));exports[_0xf33c('0x58')]=function(_0x130408,_0x4c70fa,_0x36d8a0){var _0x79a1ca=_0xf33c('0x59');var _0x1b52a7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x375caa){if(_0x375caa){_0x1b52a7=_0x375caa;}return db['Setting'][_0xf33c('0x50')]({'where':{'id':_0x130408[_0xf33c('0x53')]['id']},'attributes':['logo',_0xf33c('0x57'),_0xf33c('0x5a'),_0xf33c('0x5b'),_0xf33c('0x5c'),_0xf33c('0x5d'),'defaultPreferred',_0xf33c('0x5e')],'raw':!![]});})[_0xf33c('0x1a')](handleEntityNotFound(_0x4c70fa,null))[_0xf33c('0x1a')](function(_0x5ea759){if(_0x5ea759){var _0x587c33=_0x5ea759['logo']&&fs[_0xf33c('0x5f')](path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x79a1ca,_[_0xf33c('0x62')](_0x5ea759[_0xf33c('0x63')])))?path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x79a1ca,_['toLower'](_0x5ea759[_0xf33c('0x63')])):path[_0xf33c('0x60')](config['root'],_0x79a1ca,_[_0xf33c('0x62')](_0xf33c('0x64')));var _0x394fa9=_0xf33c('0x65')+_[_0xf33c('0x66')](_0xf33c('0x63'));if(_0x5ea759[_0x394fa9]||!_0x1b52a7[_0xf33c('0x67')]){_0x587c33=path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x79a1ca,_['toLower'](_0xf33c('0x64')));}if(!fs[_0xf33c('0x5f')](_0x587c33)){throw new db[(_0xf33c('0x68'))][(_0xf33c('0x69'))](_['upperFirst']('logo')+'\x20not\x20found');}return _0x4c70fa[_0xf33c('0x6a')](_0x587c33);}})[_0xf33c('0x4c')](handleError(_0x4c70fa,null));};var utilLicense=require(_0xf33c('0x16'));exports[_0xf33c('0x6b')]=function(_0xbe822d,_0x19b22f,_0x3b84d0){var _0x54f595=_0xf33c('0x59');var _0x22c44e={'custom':![]};return utilLicense[_0xf33c('0x6c')]()[_0xf33c('0x1a')](function(_0x61ffce){if(_0x61ffce){_0x22c44e=_0x61ffce;}return db[_0xf33c('0x37')][_0xf33c('0x50')]({'where':{'id':_0xbe822d[_0xf33c('0x53')]['id']},'attributes':[_0xf33c('0x63'),_0xf33c('0x57'),'preferred',_0xf33c('0x5b'),_0xf33c('0x5c'),_0xf33c('0x5d'),'defaultPreferred',_0xf33c('0x5e')],'raw':!![]});})[_0xf33c('0x1a')](handleEntityNotFound(_0x19b22f,null))[_0xf33c('0x1a')](function(_0x1701ec){if(_0x1701ec){var _0x1274f9=_0x1701ec[_0xf33c('0x57')]&&fs[_0xf33c('0x5f')](path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x54f595,_[_0xf33c('0x62')](_0x1701ec[_0xf33c('0x57')])))?path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x54f595,_['toLower'](_0x1701ec[_0xf33c('0x57')])):path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x54f595,_['toLower']('default_loginLogo.svg'));var _0x23e777=_0xf33c('0x65')+_[_0xf33c('0x66')](_0xf33c('0x57'));if(_0x1701ec[_0x23e777]||!_0x22c44e['custom']){_0x1274f9=path[_0xf33c('0x60')](config['root'],_0x54f595,_[_0xf33c('0x62')](_0xf33c('0x6d')));}if(!fs[_0xf33c('0x5f')](_0x1274f9)){throw new db[(_0xf33c('0x68'))][(_0xf33c('0x69'))](_[_0xf33c('0x66')](_0xf33c('0x57'))+_0xf33c('0x6e'));}return _0x19b22f['download'](_0x1274f9);}})[_0xf33c('0x4c')](handleError(_0x19b22f,null));};exports[_0xf33c('0x6f')]=function(_0x1b3994,_0x1a6cc7){return db['Setting'][_0xf33c('0x50')]({'where':{'id':_0x1b3994[_0xf33c('0x53')]['id']},'attributes':[_0xf33c('0x70')]})[_0xf33c('0x1a')](respondWithResult(_0x1a6cc7,null))[_0xf33c('0x4c')](handleError(_0x1a6cc7,null));};exports[_0xf33c('0x71')]=function(_0x2ecee7,_0x5a7bb2,_0x444126){if(_0x2ecee7[_0xf33c('0x55')]&&_0x2ecee7[_0xf33c('0x55')][_0xf33c('0x56')]){_0x2ecee7[_0xf33c('0x52')]['preferred']=_0x2ecee7[_0xf33c('0x55')][_0xf33c('0x56')];}return db[_0xf33c('0x37')][_0xf33c('0x50')]({'where':{'id':_0x2ecee7[_0xf33c('0x53')]['id']}})[_0xf33c('0x1a')](handleEntityNotFound(_0x5a7bb2,null))[_0xf33c('0x1a')](saveUpdates(_0x2ecee7[_0xf33c('0x52')],null))['then'](respondWithResult(_0x5a7bb2,null))[_0xf33c('0x4c')](handleError(_0x5a7bb2,null));};var utilLicense=require('../../config/license/util');exports[_0xf33c('0x72')]=function(_0x5e8bac,_0x5ca8b8,_0x496723){var _0x4d3433=_0xf33c('0x59');var _0x291b6f={'custom':![]};return utilLicense[_0xf33c('0x6c')]()[_0xf33c('0x1a')](function(_0x33bbfb){if(_0x33bbfb){_0x291b6f=_0x33bbfb;}return db[_0xf33c('0x37')]['find']({'where':{'id':_0x5e8bac[_0xf33c('0x53')]['id']},'attributes':[_0xf33c('0x63'),'loginLogo',_0xf33c('0x5a'),'favicon',_0xf33c('0x5c'),_0xf33c('0x5d'),_0xf33c('0x73'),_0xf33c('0x5e')],'raw':!![]});})[_0xf33c('0x1a')](handleEntityNotFound(_0x5ca8b8,null))[_0xf33c('0x1a')](function(_0x3cbbcb){if(_0x3cbbcb){var _0x46ac88=_0x3cbbcb[_0xf33c('0x5a')]&&fs[_0xf33c('0x5f')](path['join'](config[_0xf33c('0x61')],_0x4d3433,_['toLower'](_0x3cbbcb[_0xf33c('0x5a')])))?path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x4d3433,_[_0xf33c('0x62')](_0x3cbbcb[_0xf33c('0x5a')])):path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x4d3433,_[_0xf33c('0x62')]('default_preferred.png'));var _0x8a16e8=_0xf33c('0x65')+_['upperFirst'](_0xf33c('0x5a'));if(_0x3cbbcb[_0x8a16e8]||!_0x291b6f['custom']||!_0x291b6f[_0xf33c('0x5a')]){_0x46ac88=path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x4d3433,_[_0xf33c('0x62')]('default_preferred.png'));}if(!fs['existsSync'](_0x46ac88)){throw new db[(_0xf33c('0x68'))][(_0xf33c('0x69'))](_[_0xf33c('0x66')](_0xf33c('0x5a'))+_0xf33c('0x6e'));}return _0x5ca8b8['download'](_0x46ac88);}})[_0xf33c('0x4c')](handleError(_0x5ca8b8,null));};exports[_0xf33c('0x74')]=function(_0xcab1d0,_0xe847ed,_0x54993e){if(_0xcab1d0[_0xf33c('0x55')]&&_0xcab1d0[_0xf33c('0x55')][_0xf33c('0x56')]){_0xcab1d0[_0xf33c('0x52')][_0xf33c('0x5b')]=_0xcab1d0[_0xf33c('0x55')][_0xf33c('0x56')];}return db['Setting']['find']({'where':{'id':_0xcab1d0[_0xf33c('0x53')]['id']}})['then'](handleEntityNotFound(_0xe847ed,null))[_0xf33c('0x1a')](saveUpdates(_0xcab1d0[_0xf33c('0x52')],null))[_0xf33c('0x1a')](respondWithResult(_0xe847ed,null))[_0xf33c('0x4c')](handleError(_0xe847ed,null));};var utilLicense=require(_0xf33c('0x16'));exports[_0xf33c('0x75')]=function(_0x264638,_0x5daca2,_0x5cd3ed){var _0x3486bf=_0xf33c('0x59');var _0x2c3b21={'custom':![]};return utilLicense[_0xf33c('0x6c')]()[_0xf33c('0x1a')](function(_0x2bec9a){if(_0x2bec9a){_0x2c3b21=_0x2bec9a;}return db[_0xf33c('0x37')][_0xf33c('0x50')]({'where':{'id':_0x264638[_0xf33c('0x53')]['id']},'attributes':['logo',_0xf33c('0x57'),'preferred',_0xf33c('0x5b'),_0xf33c('0x5c'),'defaultLoginLogo',_0xf33c('0x73'),_0xf33c('0x5e')],'raw':!![]});})[_0xf33c('0x1a')](handleEntityNotFound(_0x5daca2,null))['then'](function(_0x3ed960){if(_0x3ed960){var _0x3665df=_0x3ed960[_0xf33c('0x5b')]&&fs['existsSync'](path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x3486bf,_[_0xf33c('0x62')](_0x3ed960[_0xf33c('0x5b')])))?path['join'](config[_0xf33c('0x61')],_0x3486bf,_['toLower'](_0x3ed960['favicon'])):path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x3486bf,_['toLower'](_0xf33c('0x76')));var _0xd5520d=_0xf33c('0x65')+_[_0xf33c('0x66')](_0xf33c('0x5b'));if(_0x3ed960[_0xd5520d]||!_0x2c3b21[_0xf33c('0x67')]){_0x3665df=path[_0xf33c('0x60')](config[_0xf33c('0x61')],_0x3486bf,_[_0xf33c('0x62')](_0xf33c('0x76')));}if(!fs[_0xf33c('0x5f')](_0x3665df)){throw new db['Sequelize'][(_0xf33c('0x69'))](_[_0xf33c('0x66')]('favicon')+'\x20not\x20found');}return _0x5daca2[_0xf33c('0x6a')](_0x3665df);}})[_0xf33c('0x4c')](handleError(_0x5daca2,null));};exports[_0xf33c('0x77')]=function(_0x1862ae,_0xf91326){var _0x32a80d={'offset':moment()[_0xf33c('0x78')]()};_0x32a80d['now']=moment()[_0xf33c('0x78')](_0x32a80d['offset'])[_0xf33c('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xf91326[_0xf33c('0x26')](0xc8)[_0xf33c('0x34')](_0x32a80d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6ba638d..a63d829 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(_0x4610f6,_0x5fe8c3){var _0x422a4d=function(_0x31f4c8){while(--_0x31f4c8){_0x4610f6['push'](_0x4610f6['shift']());}};_0x422a4d(++_0x5fe8c3);}(_0x3e74,0x175));var _0x43e7=function(_0x21b11c,_0x298eb9){_0x21b11c=_0x21b11c-0x0;var _0x5d7bf6=_0x3e74[_0x21b11c];return _0x5d7bf6;};'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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_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':'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 4a2ee0a..9d41e03 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 _0x8b46=['find','options','where','attributes','map','include','model','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting'];(function(_0x421a2d,_0xefe4a4){var _0x461f53=function(_0x42fdc3){while(--_0x42fdc3){_0x421a2d['push'](_0x421a2d['shift']());}};_0x461f53(++_0xefe4a4);}(_0x8b46,0x1d7));var _0x68b4=function(_0x42a0f4,_0x4c1ef2){_0x42a0f4=_0x42a0f4-0x0;var _0x36dca3=_0x8b46[_0x42a0f4];return _0x36dca3;};'use strict';var _=require(_0x68b4('0x0'));var util=require(_0x68b4('0x1'));var moment=require(_0x68b4('0x2'));var BPromise=require(_0x68b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68b4('0x4'));var db=require(_0x68b4('0x5'))['db'];var utils=require(_0x68b4('0x6'));var logger=require(_0x68b4('0x7'))(_0x68b4('0x8'));var config=require('../../config/environment');var jayson=require(_0x68b4('0x9'));var client=jayson['client'][_0x68b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3084a4,_0x46d1af,_0x4f2af0){return new BPromise(function(_0x2c4e60,_0x33f09f){return client[_0x68b4('0xb')](_0x3084a4,_0x4f2af0)[_0x68b4('0xc')](function(_0x364df0){logger[_0x68b4('0xd')](_0x68b4('0xe'),_0x46d1af,_0x68b4('0xf'));logger['debug'](_0x68b4('0x10'),_0x46d1af,_0x68b4('0xf'),JSON['stringify'](_0x364df0));if(_0x364df0[_0x68b4('0x11')]){if(_0x364df0[_0x68b4('0x11')][_0x68b4('0x12')]===0x1f4){logger[_0x68b4('0x11')](_0x68b4('0xe'),_0x46d1af,_0x364df0[_0x68b4('0x11')][_0x68b4('0x13')]);return _0x33f09f(_0x364df0[_0x68b4('0x11')][_0x68b4('0x13')]);}logger[_0x68b4('0x11')](_0x68b4('0xe'),_0x46d1af,_0x364df0['error'][_0x68b4('0x13')]);return _0x2c4e60(_0x364df0[_0x68b4('0x11')]['message']);}else{logger['info'](_0x68b4('0xe'),_0x46d1af,_0x68b4('0xf'));_0x2c4e60(_0x364df0[_0x68b4('0x14')][_0x68b4('0x13')]);}})[_0x68b4('0x15')](function(_0x3037f3){logger['error'](_0x68b4('0xe'),_0x46d1af,_0x3037f3);_0x33f09f(_0x3037f3);});});}exports[_0x68b4('0x16')]=function(_0x1e46df){var _0x45b635=this;return new Promise(function(_0x14effd,_0x14c9ff){return db[_0x68b4('0x17')][_0x68b4('0x18')]({'raw':_0x1e46df['options']?_0x1e46df['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e46df['options']?_0x1e46df[_0x68b4('0x19')][_0x68b4('0x1a')]||null:null,'attributes':_0x1e46df[_0x68b4('0x19')]?_0x1e46df['options'][_0x68b4('0x1b')]||null:null,'include':_0x1e46df[_0x68b4('0x19')]?_0x1e46df[_0x68b4('0x19')]['include']?_[_0x68b4('0x1c')](_0x1e46df['options'][_0x68b4('0x1d')],function(_0x269ef0){return{'model':db[_0x269ef0['model']],'as':_0x269ef0['as'],'attributes':_0x269ef0[_0x68b4('0x1b')],'include':_0x269ef0[_0x68b4('0x1d')]?_['map'](_0x269ef0[_0x68b4('0x1d')],function(_0x568dad){return{'model':db[_0x568dad[_0x68b4('0x1e')]],'as':_0x568dad['as'],'attributes':_0x568dad[_0x68b4('0x1b')],'include':_0x568dad['include']?_['map'](_0x568dad[_0x68b4('0x1d')],function(_0x3cbea6){return{'model':db[_0x3cbea6[_0x68b4('0x1e')]],'as':_0x3cbea6['as'],'attributes':_0x3cbea6[_0x68b4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x68b4('0xc')](function(_0x1793ff){logger[_0x68b4('0xd')](_0x68b4('0x16'),_0x1e46df);logger[_0x68b4('0x1f')](_0x68b4('0x16'),_0x1e46df,JSON[_0x68b4('0x20')](_0x1793ff));_0x14effd(_0x1793ff);})[_0x68b4('0x15')](function(_0x1a34aa){logger[_0x68b4('0x11')](_0x68b4('0x16'),_0x1a34aa[_0x68b4('0x13')],_0x1e46df);_0x14c9ff(_0x45b635[_0x68b4('0x11')](0x1f4,_0x1a34aa[_0x68b4('0x13')]));});});}; \ No newline at end of file +var _0x5b1e=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','find','raw','options','where','attributes','map','include','model','debug'];(function(_0x2da840,_0xb0568d){var _0x4b0c96=function(_0x2cb3f8){while(--_0x2cb3f8){_0x2da840['push'](_0x2da840['shift']());}};_0x4b0c96(++_0xb0568d);}(_0x5b1e,0xc1));var _0xe5b1=function(_0x230abb,_0x421322){_0x230abb=_0x230abb-0x0;var _0x1ede31=_0x5b1e[_0x230abb];return _0x1ede31;};'use strict';var _=require(_0xe5b1('0x0'));var util=require(_0xe5b1('0x1'));var moment=require(_0xe5b1('0x2'));var BPromise=require(_0xe5b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5b1('0x4'));var db=require(_0xe5b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5b1('0x6'))('rpc');var config=require(_0xe5b1('0x7'));var jayson=require(_0xe5b1('0x8'));var client=jayson[_0xe5b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e4a57,_0x1b461a,_0x3c5590){return new BPromise(function(_0x3c3374,_0x5a3b6f){return client[_0xe5b1('0xa')](_0x5e4a57,_0x3c5590)[_0xe5b1('0xb')](function(_0x2a6fb5){logger[_0xe5b1('0xc')](_0xe5b1('0xd'),_0x1b461a,_0xe5b1('0xe'));logger['debug'](_0xe5b1('0xf'),_0x1b461a,'request\x20sent',JSON[_0xe5b1('0x10')](_0x2a6fb5));if(_0x2a6fb5[_0xe5b1('0x11')]){if(_0x2a6fb5[_0xe5b1('0x11')][_0xe5b1('0x12')]===0x1f4){logger[_0xe5b1('0x11')]('Setting,\x20%s,\x20%s',_0x1b461a,_0x2a6fb5[_0xe5b1('0x11')][_0xe5b1('0x13')]);return _0x5a3b6f(_0x2a6fb5[_0xe5b1('0x11')][_0xe5b1('0x13')]);}logger[_0xe5b1('0x11')](_0xe5b1('0xd'),_0x1b461a,_0x2a6fb5['error'][_0xe5b1('0x13')]);return _0x3c3374(_0x2a6fb5[_0xe5b1('0x11')]['message']);}else{logger[_0xe5b1('0xc')](_0xe5b1('0xd'),_0x1b461a,'request\x20sent');_0x3c3374(_0x2a6fb5['result']['message']);}})['catch'](function(_0x9fcfe6){logger['error'](_0xe5b1('0xd'),_0x1b461a,_0x9fcfe6);_0x5a3b6f(_0x9fcfe6);});});}exports[_0xe5b1('0x14')]=function(_0x4404a0){var _0x4d7134=this;return new Promise(function(_0x1a5d13,_0x579ee1){return db[_0xe5b1('0x15')][_0xe5b1('0x16')]({'raw':_0x4404a0['options']?_0x4404a0['options'][_0xe5b1('0x17')]===undefined?!![]:![]:!![],'where':_0x4404a0[_0xe5b1('0x18')]?_0x4404a0[_0xe5b1('0x18')][_0xe5b1('0x19')]||null:null,'attributes':_0x4404a0[_0xe5b1('0x18')]?_0x4404a0[_0xe5b1('0x18')][_0xe5b1('0x1a')]||null:null,'include':_0x4404a0[_0xe5b1('0x18')]?_0x4404a0[_0xe5b1('0x18')]['include']?_[_0xe5b1('0x1b')](_0x4404a0[_0xe5b1('0x18')][_0xe5b1('0x1c')],function(_0x4cf192){return{'model':db[_0x4cf192['model']],'as':_0x4cf192['as'],'attributes':_0x4cf192[_0xe5b1('0x1a')],'include':_0x4cf192[_0xe5b1('0x1c')]?_[_0xe5b1('0x1b')](_0x4cf192['include'],function(_0x159585){return{'model':db[_0x159585[_0xe5b1('0x1d')]],'as':_0x159585['as'],'attributes':_0x159585[_0xe5b1('0x1a')],'include':_0x159585[_0xe5b1('0x1c')]?_[_0xe5b1('0x1b')](_0x159585[_0xe5b1('0x1c')],function(_0x2bf737){return{'model':db[_0x2bf737[_0xe5b1('0x1d')]],'as':_0x2bf737['as'],'attributes':_0x2bf737[_0xe5b1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe5b1('0xb')](function(_0x1f5d8e){logger[_0xe5b1('0xc')](_0xe5b1('0x14'),_0x4404a0);logger[_0xe5b1('0x1e')](_0xe5b1('0x14'),_0x4404a0,JSON[_0xe5b1('0x10')](_0x1f5d8e));_0x1a5d13(_0x1f5d8e);})[_0xe5b1('0x1f')](function(_0x85e908){logger[_0xe5b1('0x11')](_0xe5b1('0x14'),_0x85e908[_0xe5b1('0x13')],_0x4404a0);_0x579ee1(_0x4d7134[_0xe5b1('0x11')](0x1f4,_0x85e908['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 04f01af..19786b0 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(_0x4fdc3e,_0x47de79){var _0x3abc09=function(_0x1b8a37){while(--_0x1b8a37){_0x4fdc3e['push'](_0x4fdc3e['shift']());}};_0x3abc09(++_0x47de79);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 215df6c..83c1fbb 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 _0xdf8b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','bandwidth','infobip','BOOLEAN','TEXT'];(function(_0x863e9e,_0x5854b0){var _0x24fa60=function(_0x346970){while(--_0x346970){_0x863e9e['push'](_0x863e9e['shift']());}};_0x24fa60(++_0x5854b0);}(_0xdf8b,0x10a));var _0xbdf8=function(_0x3b7976,_0x540132){_0x3b7976=_0x3b7976-0x0;var _0x51fc0f=_0xdf8b[_0x3b7976];return _0x51fc0f;};'use strict';var Sequelize=require(_0xbdf8('0x0'));var rs=require(_0xbdf8('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xbdf8('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xbdf8('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xbdf8('0x2')],'defaultValue':function(){return rs[_0xbdf8('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbdf8('0x4')](_0xbdf8('0x5'),_0xbdf8('0x6'),_0xbdf8('0x7'),'clicksend',_0xbdf8('0x8'),_0xbdf8('0x9'),_0xbdf8('0xa'),'csc',_0xbdf8('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0xbdf8('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xbdf8('0x2')]},'smsMethod':{'type':Sequelize[_0xbdf8('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbdf8('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xbdf8('0x2')]},'accountId':{'type':Sequelize[_0xbdf8('0x2')]},'senderString':{'type':Sequelize[_0xbdf8('0x2')]},'deliveryReport':{'type':Sequelize[_0xbdf8('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xbdf8('0x2')]},'notificationTemplate':{'type':Sequelize[_0xbdf8('0xd')],'defaultValue':function(){return _0xbdf8('0xe');}},'notificationSound':{'type':Sequelize[_0xbdf8('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbdf8('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbdf8('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbdf8('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbdf8('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbdf8('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbdf8('0xf')],'comment':_0xbdf8('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xbdf8('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a351f){if(!_0x1a351f)this[_0xbdf8('0x11')](_0xbdf8('0x12'),null);this[_0xbdf8('0x11')](_0xbdf8('0x13'),_0x1a351f);}}}; \ No newline at end of file +var _0x78bf=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x272ea6,_0x3f0673){var _0x43ef03=function(_0x2307e2){while(--_0x2307e2){_0x272ea6['push'](_0x272ea6['shift']());}};_0x43ef03(++_0x3f0673);}(_0x78bf,0xee));var _0xf78b=function(_0xc93556,_0x840f41){_0xc93556=_0xc93556-0x0;var _0x4453a1=_0x78bf[_0xc93556];return _0x4453a1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf78b('0x0'));module[_0xf78b('0x1')]={'name':{'type':Sequelize[_0xf78b('0x2')],'unique':_0xf78b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf78b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf78b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf78b('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf78b('0x2')]},'type':{'type':Sequelize[_0xf78b('0x4')](_0xf78b('0x5'),'skebby','connectel','clicksend',_0xf78b('0x6'),_0xf78b('0x7'),_0xf78b('0x8'),_0xf78b('0x9'),_0xf78b('0xa'),_0xf78b('0xb'))},'accountSid':{'type':Sequelize[_0xf78b('0x2')]},'authId':{'type':Sequelize[_0xf78b('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xf78b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf78b('0x2')]},'password':{'type':Sequelize[_0xf78b('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xf78b('0x2')]},'accountId':{'type':Sequelize[_0xf78b('0x2')]},'senderString':{'type':Sequelize[_0xf78b('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf78b('0xc')],'defaultValue':function(){return _0xf78b('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf78b('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf78b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf78b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf78b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf78b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf78b('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf78b('0xf')],'comment':_0xf78b('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf78b('0x11'),'set':function(_0x3c2bae){if(!_0x3c2bae)this[_0xf78b('0x12')](_0xf78b('0x13'),null);this[_0xf78b('0x12')](_0xf78b('0x14'),_0x3c2bae);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 82fc782..86a7e8e 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 _0xf062=['receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','stack','finally','sendStatus','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','user','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','clicksend','message_id','status_code','infobip','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','name','index','Pause','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','filter','merge','type','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','sort','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','notify','sms','Applications','account','orderBy','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','Body','messageId','skebby','text','connectel','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','applications','unmanaged','*,*,*,*','SmsMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0xf062,0x128));var _0x2f06=function(_0x25d88d,_0x5e10ef){_0x25d88d=_0x25d88d-0x0;var _0x3269e5=_0xf062[_0x25d88d];return _0x3269e5;};'use strict';var emlformat=require(_0x2f06('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f06('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f06('0x2'));var Mustache=require('mustache');var util=require(_0x2f06('0x3'));var path=require(_0x2f06('0x4'));var sox=require(_0x2f06('0x5'));var csv=require(_0x2f06('0x6'));var ejs=require(_0x2f06('0x7'));var fs=require('fs');var fs_extra=require(_0x2f06('0x8'));var _=require('lodash');var squel=require(_0x2f06('0x9'));var crypto=require(_0x2f06('0xa'));var jsforce=require(_0x2f06('0xb'));var deskjs=require(_0x2f06('0xc'));var toCsv=require(_0x2f06('0x6'));var querystring=require(_0x2f06('0xd'));var Papa=require(_0x2f06('0xe'));var Redis=require(_0x2f06('0xf'));var authService=require(_0x2f06('0x10'));var qs=require(_0x2f06('0x11'));var as=require(_0x2f06('0x12'));var hardwareService=require(_0x2f06('0x13'));var logger=require('../../config/logger')(_0x2f06('0x14'));var utils=require(_0x2f06('0x15'));var config=require(_0x2f06('0x16'));var licenseUtil=require(_0x2f06('0x17'));var db=require(_0x2f06('0x18'))['db'];config['redis']=_[_0x2f06('0x19')](config[_0x2f06('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f06('0x1b'))(new Redis(config[_0x2f06('0x1a')]));require(_0x2f06('0x1c'))[_0x2f06('0x1d')](socket);var jayson=require(_0x2f06('0x1e'));var client=jayson[_0x2f06('0x1f')][_0x2f06('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x104c35,_0x2eeb86,_0x2fb3c4,_0x1f2480){return new BPromise(function(_0x2097cc,_0x3b268d){var _0x527412=_0x1f2480||client;return _0x527412[_0x2f06('0x21')](_0x104c35,_0x2fb3c4)['then'](function(_0x2ea0f6){logger[_0x2f06('0x22')](_0x2f06('0x23'),_0x2eeb86,_0x2f06('0x24'));logger[_0x2f06('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2eeb86,'request\x20sent',JSON[_0x2f06('0x26')](_0x2ea0f6));if(_0x2ea0f6[_0x2f06('0x27')]){if(_0x2ea0f6[_0x2f06('0x27')][_0x2f06('0x28')]===0x1f4){logger['error'](_0x2f06('0x23'),_0x2eeb86,_0x2ea0f6[_0x2f06('0x27')][_0x2f06('0x29')]);return _0x3b268d(_0x2ea0f6[_0x2f06('0x27')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x2eeb86,_0x2ea0f6[_0x2f06('0x27')][_0x2f06('0x29')]);return _0x2097cc(_0x2ea0f6[_0x2f06('0x27')][_0x2f06('0x29')]);}else{logger['info'](_0x2f06('0x23'),_0x2eeb86,'request\x20sent');_0x2097cc(_0x2ea0f6[_0x2f06('0x2a')]['message']);}})['catch'](function(_0xac98c6){logger[_0x2f06('0x27')](_0x2f06('0x23'),_0x2eeb86,_0xac98c6);_0x3b268d(_0xac98c6);});});}function respondWithStatusCode(_0x2a4656,_0x409757){_0x409757=_0x409757||0xcc;return function(_0x395133){if(_0x395133){return _0x2a4656['sendStatus'](_0x409757);}return _0x2a4656[_0x2f06('0x2b')](_0x409757)[_0x2f06('0x2c')]();};}function respondWithResult(_0x54850f,_0x4c041b){_0x4c041b=_0x4c041b||0xc8;return function(_0x338fdb){if(_0x338fdb){return _0x54850f[_0x2f06('0x2b')](_0x4c041b)[_0x2f06('0x2d')](_0x338fdb);}};}function respondWithFilteredResult(_0x3cd371,_0x22a1b6){return function(_0x20cda1){if(_0x20cda1){var _0x43ab77=typeof _0x22a1b6[_0x2f06('0x2e')]===_0x2f06('0x2f')&&typeof _0x22a1b6['limit']===_0x2f06('0x2f');var _0x355ead=_0x20cda1[_0x2f06('0x30')];var _0x373929=_0x43ab77?0x0:_0x22a1b6['offset'];var _0x32a74d=_0x43ab77?_0x20cda1[_0x2f06('0x30')]:_0x22a1b6[_0x2f06('0x2e')]+_0x22a1b6[_0x2f06('0x31')];var _0x5014df;if(_0x32a74d>=_0x355ead){_0x32a74d=_0x355ead;_0x5014df=0xc8;}else{_0x5014df=0xce;}_0x3cd371[_0x2f06('0x2b')](_0x5014df);return _0x3cd371[_0x2f06('0x32')](_0x2f06('0x33'),_0x373929+'-'+_0x32a74d+'/'+_0x355ead)[_0x2f06('0x2d')](_0x20cda1);}return null;};}function patchUpdates(_0x56bd80){return function(_0x536938){try{jsonpatch[_0x2f06('0x34')](_0x536938,_0x56bd80,!![]);}catch(_0x72ff8f){return BPromise[_0x2f06('0x35')](_0x72ff8f);}return _0x536938[_0x2f06('0x36')]();};}function saveUpdates(_0x3d7804,_0x53d942){return function(_0x253ef6){if(_0x253ef6){return _0x253ef6[_0x2f06('0x37')](_0x3d7804)[_0x2f06('0x38')](function(_0x5ae835){return _0x5ae835;});}return null;};}function removeEntity(_0x4fcd2b,_0x3165ba){return function(_0x199572){if(_0x199572){return _0x199572['destroy']()['then'](function(){var _0x4c39bc=_0x199572[_0x2f06('0x39')]({'plain':!![]});var _0xaec7d2=_0x2f06('0x3a');return db[_0x2f06('0x3b')][_0x2f06('0x3c')]({'where':{'type':_0xaec7d2,'resourceId':_0x4c39bc['id']}})[_0x2f06('0x38')](function(){return _0x199572;});})[_0x2f06('0x38')](function(){_0x4fcd2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5ffa,_0x2ac471){return function(_0x1f2d04){if(!_0x1f2d04){_0x2f5ffa['sendStatus'](0x194);}return _0x1f2d04;};}function handleError(_0x4ad32e,_0x1ba353){_0x1ba353=_0x1ba353||0x1f4;return function(_0x17d181){logger[_0x2f06('0x27')](_0x17d181['stack']);if(_0x17d181[_0x2f06('0x3d')]){delete _0x17d181['name'];}_0x4ad32e[_0x2f06('0x2b')](_0x1ba353)['send'](_0x17d181);};}exports[_0x2f06('0x3e')]=function(_0x70630e,_0x3ca9c2){var _0x5c48b3={'include':[{'model':db[_0x2f06('0x3f')],'as':'mandatoryDispositionPause'}]},_0x25af26={},_0x4547e5={'count':0x0,'rows':[]};var _0x35ce4f=_[_0x2f06('0x40')](db['SmsAccount'][_0x2f06('0x41')],function(_0xd879a1){return{'name':_0xd879a1['fieldName'],'type':_0xd879a1['type'][_0x2f06('0x42')]};});_0x25af26['model']=_[_0x2f06('0x40')](_0x35ce4f,_0x2f06('0x3d'));_0x25af26[_0x2f06('0x43')]=_[_0x2f06('0x44')](_0x70630e[_0x2f06('0x43')]);_0x25af26[_0x2f06('0x45')]=_[_0x2f06('0x46')](_0x25af26[_0x2f06('0x47')],_0x25af26[_0x2f06('0x43')]);_0x5c48b3['attributes']=_[_0x2f06('0x46')](_0x25af26['model'],qs[_0x2f06('0x48')](_0x70630e[_0x2f06('0x43')][_0x2f06('0x48')]));_0x5c48b3[_0x2f06('0x49')]=_0x5c48b3[_0x2f06('0x49')][_0x2f06('0x4a')]?_0x5c48b3[_0x2f06('0x49')]:_0x25af26[_0x2f06('0x47')];if(!_0x70630e[_0x2f06('0x43')]['hasOwnProperty'](_0x2f06('0x4b'))){_0x5c48b3['limit']=qs[_0x2f06('0x31')](_0x70630e['query'][_0x2f06('0x31')]);_0x5c48b3[_0x2f06('0x2e')]=qs[_0x2f06('0x2e')](_0x70630e[_0x2f06('0x43')][_0x2f06('0x2e')]);}_0x5c48b3[_0x2f06('0x4c')]=qs['sort'](_0x70630e[_0x2f06('0x43')]['sort']);_0x5c48b3[_0x2f06('0x4d')]=qs[_0x2f06('0x45')](_['pick'](_0x70630e[_0x2f06('0x43')],_0x25af26[_0x2f06('0x45')]),_0x35ce4f);if(_0x70630e[_0x2f06('0x43')][_0x2f06('0x4e')]){_0x5c48b3[_0x2f06('0x4d')]=_[_0x2f06('0x4f')](_0x5c48b3[_0x2f06('0x4d')],{'$or':_[_0x2f06('0x40')](_0x35ce4f,function(_0x2c11f4){if(_0x2c11f4[_0x2f06('0x50')]!==_0x2f06('0x51')){var _0x2bd21={};_0x2bd21[_0x2c11f4[_0x2f06('0x3d')]]={'$like':'%'+_0x70630e[_0x2f06('0x43')]['filter']+'%'};return _0x2bd21;}})});}_0x5c48b3=_[_0x2f06('0x4f')]({},_0x5c48b3,_0x70630e[_0x2f06('0x52')]);var _0x97bf63={'where':_0x5c48b3[_0x2f06('0x4d')]};return db[_0x2f06('0x53')]['count'](_0x97bf63)['then'](function(_0x1848da){_0x4547e5['count']=_0x1848da;if(_0x70630e[_0x2f06('0x43')][_0x2f06('0x54')]){_0x5c48b3[_0x2f06('0x55')]=[{'all':!![]}];}return db[_0x2f06('0x53')][_0x2f06('0x56')](_0x5c48b3);})[_0x2f06('0x38')](function(_0x5026d3){_0x4547e5[_0x2f06('0x57')]=_0x5026d3;return _0x4547e5;})[_0x2f06('0x38')](respondWithFilteredResult(_0x3ca9c2,_0x5c48b3))[_0x2f06('0x58')](handleError(_0x3ca9c2,null));};exports[_0x2f06('0x59')]=function(_0x3eaabc,_0x45a718){var _0x41682c={'raw':![],'where':{'id':_0x3eaabc['params']['id']},'include':[{'model':db[_0x2f06('0x3f')],'as':'mandatoryDispositionPause'}]},_0x268c2={};_0x268c2[_0x2f06('0x47')]=_['keys'](db['SmsAccount'][_0x2f06('0x41')]);_0x268c2['query']=_[_0x2f06('0x44')](_0x3eaabc['query']);_0x268c2['filters']=_['intersection'](_0x268c2['model'],_0x268c2[_0x2f06('0x43')]);_0x41682c[_0x2f06('0x49')]=_[_0x2f06('0x46')](_0x268c2[_0x2f06('0x47')],qs['fields'](_0x3eaabc[_0x2f06('0x43')][_0x2f06('0x48')]));_0x41682c[_0x2f06('0x49')]=_0x41682c['attributes'][_0x2f06('0x4a')]?_0x41682c[_0x2f06('0x49')]:_0x268c2[_0x2f06('0x47')];if(_0x3eaabc[_0x2f06('0x43')]['includeAll']){_0x41682c[_0x2f06('0x55')]=[{'all':!![]}];}_0x41682c=_[_0x2f06('0x4f')]({},_0x41682c,_0x3eaabc[_0x2f06('0x52')]);return db[_0x2f06('0x53')][_0x2f06('0x5a')](_0x41682c)[_0x2f06('0x38')](handleEntityNotFound(_0x45a718,null))['then'](respondWithResult(_0x45a718,null))['catch'](handleError(_0x45a718,null));};exports['create']=function(_0xa4dcd8,_0x116fb6){return db['SmsAccount'][_0x2f06('0x5b')](_0xa4dcd8[_0x2f06('0x5c')],{})[_0x2f06('0x38')](function(_0x2c87cb){var _0x345f48=_0xa4dcd8['user'][_0x2f06('0x39')]({'plain':!![]});if(!_0x345f48)throw new Error(_0x2f06('0x5d'));if(_0x345f48[_0x2f06('0x5e')]==='user'){var _0x2d383d=_0x2c87cb[_0x2f06('0x39')]({'plain':!![]});var _0x39732c='SmsAccounts';return db[_0x2f06('0x5f')]['find']({'where':{'name':_0x39732c,'userProfileId':_0x345f48[_0x2f06('0x60')]},'raw':!![]})[_0x2f06('0x38')](function(_0x534569){if(_0x534569&&_0x534569[_0x2f06('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d383d[_0x2f06('0x3d')],'resourceId':_0x2d383d['id'],'type':_0x534569[_0x2f06('0x3d')],'sectionId':_0x534569['id']},{})[_0x2f06('0x38')](function(){return _0x2c87cb;});}else{return _0x2c87cb;}})[_0x2f06('0x58')](function(_0x1cca12){logger[_0x2f06('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cca12);throw _0x1cca12;});}return _0x2c87cb;})[_0x2f06('0x38')](respondWithResult(_0x116fb6,0xc9))[_0x2f06('0x58')](handleError(_0x116fb6,null));};exports['update']=function(_0x2c1d23,_0x4ba4fd){if(_0x2c1d23['body']['id']){delete _0x2c1d23[_0x2f06('0x5c')]['id'];}return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x2c1d23[_0x2f06('0x62')]['id']},'include':[{'model':db[_0x2f06('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x2f06('0x38')](handleEntityNotFound(_0x4ba4fd,null))[_0x2f06('0x38')](saveUpdates(_0x2c1d23['body'],null))[_0x2f06('0x38')](respondWithResult(_0x4ba4fd,null))[_0x2f06('0x58')](handleError(_0x4ba4fd,null));};exports[_0x2f06('0x3c')]=function(_0x5e04d0,_0x4faab6){return db['SmsAccount'][_0x2f06('0x5a')]({'where':{'id':_0x5e04d0['params']['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x4faab6,null))[_0x2f06('0x38')](removeEntity(_0x4faab6,null))[_0x2f06('0x58')](handleError(_0x4faab6,null));};exports['describe']=function(_0x135f41,_0x4e718f){return db['SmsAccount'][_0x2f06('0x63')]()[_0x2f06('0x38')](respondWithResult(_0x4e718f,null))[_0x2f06('0x58')](handleError(_0x4e718f,null));};exports[_0x2f06('0x64')]=function(_0x10f016,_0xb9f876,_0x4b4a62){if(_0x10f016[_0x2f06('0x5c')]['id']){delete _0x10f016[_0x2f06('0x5c')]['id'];}return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x10f016['params']['id']}})['then'](handleEntityNotFound(_0xb9f876,null))[_0x2f06('0x38')](function(_0x31079f){if(_0x31079f){_0x10f016[_0x2f06('0x5c')][_0x2f06('0x65')]=_0x31079f['id'];return db[_0x2f06('0x66')][_0x2f06('0x5b')](_0x10f016[_0x2f06('0x5c')]);}})['then'](respondWithResult(_0xb9f876,null))['catch'](handleError(_0xb9f876,null));};exports[_0x2f06('0x67')]=function(_0x29f7e8,_0x1175a2,_0x4661d4){var _0x106a17={'raw':![],'where':{}};var _0x1707b1={};var _0x28538e={'count':0x0,'rows':[]};return db[_0x2f06('0x53')][_0x2f06('0x68')]({'where':{'id':_0x29f7e8[_0x2f06('0x62')]['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x1175a2,null))[_0x2f06('0x38')](function(_0x5ab9b9){if(_0x5ab9b9){_0x1707b1['model']=_[_0x2f06('0x44')](db[_0x2f06('0x66')][_0x2f06('0x41')]);_0x1707b1[_0x2f06('0x43')]=_[_0x2f06('0x44')](_0x29f7e8['query']);_0x1707b1[_0x2f06('0x45')]=_[_0x2f06('0x46')](_0x1707b1[_0x2f06('0x47')],_0x1707b1[_0x2f06('0x43')]);_0x106a17[_0x2f06('0x49')]=_[_0x2f06('0x46')](_0x1707b1[_0x2f06('0x47')],qs[_0x2f06('0x48')](_0x29f7e8['query']['fields']));_0x106a17[_0x2f06('0x49')]=_0x106a17[_0x2f06('0x49')]['length']?_0x106a17[_0x2f06('0x49')]:_0x1707b1[_0x2f06('0x47')];if(!_0x29f7e8[_0x2f06('0x43')][_0x2f06('0x69')](_0x2f06('0x4b'))){_0x106a17[_0x2f06('0x31')]=qs[_0x2f06('0x31')](_0x29f7e8[_0x2f06('0x43')][_0x2f06('0x31')]);_0x106a17[_0x2f06('0x2e')]=qs['offset'](_0x29f7e8[_0x2f06('0x43')]['offset']);}_0x106a17[_0x2f06('0x4c')]=qs[_0x2f06('0x6a')](_0x29f7e8[_0x2f06('0x43')]['sort']);_0x106a17[_0x2f06('0x4d')]=qs[_0x2f06('0x45')](_[_0x2f06('0x6b')](_0x29f7e8[_0x2f06('0x43')],_0x1707b1[_0x2f06('0x45')]));_0x106a17[_0x2f06('0x4d')]['SmsAccountId']=_0x5ab9b9['id'];if(_0x29f7e8[_0x2f06('0x43')][_0x2f06('0x4e')]){_0x106a17[_0x2f06('0x4d')]=_[_0x2f06('0x4f')](_0x106a17['where'],{'$or':_[_0x2f06('0x40')](_0x106a17['attributes'],function(_0x4739fe){var _0x349a55={};_0x349a55[_0x4739fe]={'$like':'%'+_0x29f7e8[_0x2f06('0x43')][_0x2f06('0x4e')]+'%'};return _0x349a55;})});}_0x106a17=_['merge']({},_0x106a17,_0x29f7e8[_0x2f06('0x52')]);return db[_0x2f06('0x66')][_0x2f06('0x30')]({'where':_0x106a17[_0x2f06('0x4d')]})['then'](function(_0xc58df){_0x28538e['count']=_0xc58df;if(_0x29f7e8['query'][_0x2f06('0x54')]){_0x106a17[_0x2f06('0x55')]=[{'all':!![]}];}return db[_0x2f06('0x66')]['findAll'](_0x106a17);})[_0x2f06('0x38')](function(_0x56744b){_0x28538e[_0x2f06('0x57')]=_0x56744b;return _0x28538e;});}})[_0x2f06('0x38')](respondWithFilteredResult(_0x1175a2,_0x106a17))['catch'](handleError(_0x1175a2,null));};exports[_0x2f06('0x6c')]=function(_0x2ab755,_0x337c08,_0x1fec34){return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x2ab755[_0x2f06('0x62')]['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x337c08,null))[_0x2f06('0x38')](function(_0x5558e6){if(_0x5558e6){return _0x5558e6[_0x2f06('0x6c')](_0x2ab755[_0x2f06('0x43')]['ids']);}})[_0x2f06('0x38')](respondWithStatusCode(_0x337c08,null))[_0x2f06('0x58')](handleError(_0x337c08,null));};exports[_0x2f06('0x6d')]=function(_0x1827a4,_0x3f54c8,_0x391535){if(_0x1827a4[_0x2f06('0x5c')]['id']){delete _0x1827a4[_0x2f06('0x5c')]['id'];}return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x1827a4[_0x2f06('0x62')]['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x3f54c8,null))[_0x2f06('0x38')](function(_0x32075b){if(_0x32075b){_0x1827a4[_0x2f06('0x5c')]['SmsAccountId']=_0x32075b['id'];return db[_0x2f06('0x6e')]['create'](_0x1827a4['body']);}})[_0x2f06('0x38')](respondWithResult(_0x3f54c8,null))['catch'](handleError(_0x3f54c8,null));};exports[_0x2f06('0x6f')]=function(_0x362fd6,_0x13de41,_0x38f37f){var _0x3a5e6c={'raw':![],'where':{}};var _0x5c38ea={};var _0x21b7b9={'count':0x0,'rows':[]};return db[_0x2f06('0x53')]['findOne']({'where':{'id':_0x362fd6['params']['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x13de41,null))[_0x2f06('0x38')](function(_0x296dd1){if(_0x296dd1){_0x5c38ea[_0x2f06('0x47')]=_[_0x2f06('0x44')](db[_0x2f06('0x6e')][_0x2f06('0x41')]);_0x5c38ea[_0x2f06('0x43')]=_['keys'](_0x362fd6['query']);_0x5c38ea[_0x2f06('0x45')]=_[_0x2f06('0x46')](_0x5c38ea[_0x2f06('0x47')],_0x5c38ea['query']);_0x3a5e6c[_0x2f06('0x49')]=_[_0x2f06('0x46')](_0x5c38ea[_0x2f06('0x47')],qs[_0x2f06('0x48')](_0x362fd6[_0x2f06('0x43')][_0x2f06('0x48')]));_0x3a5e6c['attributes']=_0x3a5e6c[_0x2f06('0x49')][_0x2f06('0x4a')]?_0x3a5e6c[_0x2f06('0x49')]:_0x5c38ea[_0x2f06('0x47')];if(!_0x362fd6[_0x2f06('0x43')]['hasOwnProperty'](_0x2f06('0x4b'))){_0x3a5e6c[_0x2f06('0x31')]=qs['limit'](_0x362fd6[_0x2f06('0x43')][_0x2f06('0x31')]);_0x3a5e6c[_0x2f06('0x2e')]=qs[_0x2f06('0x2e')](_0x362fd6[_0x2f06('0x43')]['offset']);}_0x3a5e6c[_0x2f06('0x4c')]=qs['sort'](_0x362fd6['query'][_0x2f06('0x6a')]);_0x3a5e6c[_0x2f06('0x4d')]=qs[_0x2f06('0x45')](_[_0x2f06('0x6b')](_0x362fd6[_0x2f06('0x43')],_0x5c38ea[_0x2f06('0x45')]));_0x3a5e6c['where'][_0x2f06('0x65')]=_0x296dd1['id'];if(_0x362fd6['query'][_0x2f06('0x4e')]){_0x3a5e6c[_0x2f06('0x4d')]=_[_0x2f06('0x4f')](_0x3a5e6c['where'],{'$or':_['map'](_0x3a5e6c['attributes'],function(_0x4428f1){var _0x11e027={};_0x11e027[_0x4428f1]={'$like':'%'+_0x362fd6['query'][_0x2f06('0x4e')]+'%'};return _0x11e027;})});}_0x3a5e6c=_[_0x2f06('0x4f')]({},_0x3a5e6c,_0x362fd6[_0x2f06('0x52')]);return db['CannedAnswer']['count']({'where':_0x3a5e6c[_0x2f06('0x4d')]})[_0x2f06('0x38')](function(_0x3faa74){_0x21b7b9['count']=_0x3faa74;if(_0x362fd6[_0x2f06('0x43')]['includeAll']){_0x3a5e6c[_0x2f06('0x55')]=[{'all':!![]}];}return db[_0x2f06('0x6e')][_0x2f06('0x56')](_0x3a5e6c);})[_0x2f06('0x38')](function(_0x28969f){_0x21b7b9[_0x2f06('0x57')]=_0x28969f;return _0x21b7b9;});}})[_0x2f06('0x38')](respondWithFilteredResult(_0x13de41,_0x3a5e6c))[_0x2f06('0x58')](handleError(_0x13de41,null));};exports['removeAnswers']=function(_0xa997e1,_0x2d9bf4,_0x2c7fd9){return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0xa997e1[_0x2f06('0x62')]['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x2d9bf4,null))['then'](function(_0x5e66d5){if(_0x5e66d5){return _0x5e66d5['removeAnswers'](_0xa997e1[_0x2f06('0x43')][_0x2f06('0x70')]);}})[_0x2f06('0x38')](respondWithStatusCode(_0x2d9bf4,null))[_0x2f06('0x58')](handleError(_0x2d9bf4,null));};exports[_0x2f06('0x71')]=function(_0x890a00,_0x5271fb,_0x11a458){var _0x5c9bea={'channel':_0x2f06('0x72')};var _0x40481d=[];var _0x35a710=[];var _0x1129b3={};return db['SmsAccount'][_0x2f06('0x5a')]({'where':{'id':_0x890a00['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x2f06('0x73')}]})[_0x2f06('0x38')](handleEntityNotFound(_0x5271fb,null))[_0x2f06('0x38')](function(_0x102244){_0x5c9bea[_0x2f06('0x74')]=_0x102244;_0x5c9bea['applications']=_[_0x2f06('0x75')](_0x102244[_0x2f06('0x73')],[_0x2f06('0x76')],['asc']);if(_0x5c9bea[_0x2f06('0x74')]['Applications']){delete _0x5c9bea[_0x2f06('0x74')][_0x2f06('0x73')];}return db[_0x2f06('0x77')][_0x2f06('0x63')]();})[_0x2f06('0x38')](function(_0x24382c){if(!_0x24382c){throw new db[(_0x2f06('0x78'))]['ValidationError'](_0x2f06('0x79'));}_0x40481d=_[_0x2f06('0x7a')](_['keys'](_0x24382c),[_0x2f06('0x7b'),_0x2f06('0x7c')]);_0x35a710=_[_0x2f06('0x7a')](_[_0x2f06('0x44')](_0x24382c),[_0x2f06('0x7b'),_0x2f06('0x7c'),'CompanyId',_0x2f06('0x7d')]);_0x5c9bea[_0x2f06('0x5c')]={'mapKey':_0x2f06('0x7e')};if(_0x5c9bea['account'][_0x2f06('0x50')]){switch(_0x5c9bea['account'][_0x2f06('0x50')]){case'twilio':_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x80')];_0x5c9bea[_0x2f06('0x5c')]['body']=_0x890a00['body'][_0x2f06('0x81')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x82')]=_0x890a00['body']['MessageSid'];break;case _0x2f06('0x83'):_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')]='+'+_0x890a00['body']['sender'];_0x5c9bea['body'][_0x2f06('0x5c')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x84')];break;case _0x2f06('0x85'):_0x5c9bea[_0x2f06('0x5c')]['from']=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x7f')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x29')];break;case'clicksend':_0x5c9bea['body'][_0x2f06('0x7f')]=_0x890a00[_0x2f06('0x5c')]['from'];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x5c')];_0x5c9bea['body'][_0x2f06('0x82')]=_0x890a00[_0x2f06('0x5c')]['message_id'];break;case'plivo':_0x5c9bea[_0x2f06('0x5c')]['from']=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x80')];_0x5c9bea[_0x2f06('0x5c')]['body']=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x86')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x82')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x87')];break;case'infobip':_0x5c9bea['body'][_0x2f06('0x7f')]='+'+_0x890a00[_0x2f06('0x5c')][_0x2f06('0x88')][0x0]['from'];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]=_0x890a00['body'][_0x2f06('0x88')][0x0][_0x2f06('0x84')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x82')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x88')][0x0][_0x2f06('0x82')];break;case _0x2f06('0x89'):_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')]=_0x890a00['body'][_0x2f06('0x8a')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]=_0x890a00[_0x2f06('0x5c')]['segmentedMessage'][_0x2f06('0x29')];break;case _0x2f06('0x8b'):_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x8c')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]=_0x890a00['body'][_0x2f06('0x84')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x82')]=_0x890a00['body'][_0x2f06('0x8d')];break;case _0x2f06('0x8e'):_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x82')]=_0x890a00['body'][0x0][_0x2f06('0x29')]['id'];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')]=_0x890a00[_0x2f06('0x5c')][0x0]['message'][_0x2f06('0x7f')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]=_0x890a00[_0x2f06('0x5c')][0x0][_0x2f06('0x29')][_0x2f06('0x84')];break;case _0x2f06('0x8f'):_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x7f')];_0x5c9bea[_0x2f06('0x5c')]['body']=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x29')];_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x82')]=_0x890a00[_0x2f06('0x5c')][_0x2f06('0x90')];break;}}if(_0x5c9bea['body']['id']){delete _0x5c9bea[_0x2f06('0x5c')]['id'];}if(_[_0x2f06('0x91')](_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')])){throw new db[(_0x2f06('0x78'))]['ValidationError'](_0x2f06('0x92'));}if(_[_0x2f06('0x91')](_0x5c9bea[_0x2f06('0x5c')]['body'])||_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')]===''){throw new db[(_0x2f06('0x78'))][(_0x2f06('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2f06('0x91')](_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x94')])){throw new db[(_0x2f06('0x78'))]['ValidationError'](_0x2f06('0x95')+_0x35a710);}if(!_[_0x2f06('0x96')](_0x35a710,_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x94')])){throw new db['Sequelize']['ValidationError'](_0x2f06('0x97')+_0x35a710);}_0x1129b3[_0x5c9bea[_0x2f06('0x5c')]['mapKey']]=_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')];return db['CmList'][_0x2f06('0x5a')]({'where':{'id':_0x5c9bea[_0x2f06('0x74')]['ListId']},'include':[{'model':db[_0x2f06('0x77')],'as':_0x2f06('0x98'),'where':_0x1129b3,'limit':0x1,'order':[[_0x2f06('0x7c'),_0x2f06('0x99')]]}]});})[_0x2f06('0x38')](handleEntityNotFound(_0x5271fb,null))['then'](function(_0x57c064){if(_0x57c064){_0x5c9bea[_0x2f06('0x9a')]=_['omit'](_0x57c064,[_0x2f06('0x98')]);if(_0x57c064[_0x2f06('0x98')][_0x2f06('0x4a')]){return _0x57c064['Contacts'][0x0];}var _0x31e1c7=_[_0x2f06('0x19')](_0x5c9bea['body'],{'firstName':_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')],'ListId':_0x57c064['id']});_0x31e1c7[_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x94')]]=_0x5c9bea[_0x2f06('0x5c')]['from'];return db['CmContact'][_0x2f06('0x5b')](_0x31e1c7,{'fields':_0x40481d,'raw':!![]});}})[_0x2f06('0x38')](handleEntityNotFound(_0x5271fb,null))[_0x2f06('0x38')](function(_0x394ee6){if(_0x394ee6){_0x5c9bea[_0x2f06('0x9b')]=_0x394ee6;var _0x3c9abd={'ContactId':_0x394ee6['id'],'phone':_0x5c9bea[_0x2f06('0x5c')]['from'],'SmsAccountId':_0x890a00['params']['id']};var _0x3f690b={'ContactId':_0x394ee6['id'],'SmsAccountId':_0x890a00['params']['id'],'closed':![]};return db[_0x2f06('0x9c')][_0x2f06('0x5a')]({'where':_0x3f690b})[_0x2f06('0x38')](function(_0x5f4dbd){if(_0x5f4dbd){return[_0x5f4dbd,![]];}return db[_0x2f06('0x9c')]['create'](_0x3c9abd)['then'](function(_0x57ffae){return[_0x57ffae,!![]];});});}})[_0x2f06('0x9d')](function(_0x3e9068,_0x3da480){_0x5c9bea[_0x2f06('0x9e')]=_0x3e9068[_0x2f06('0x39')]({'plain':!![]});_0x5c9bea['interaction'][_0x2f06('0x9f')]=![];if(_0x3da480){if(_0x5c9bea[_0x2f06('0x74')][_0x2f06('0xa0')]){_0x5c9bea['applications']['push']({'id':0x0,'priority':_0x5c9bea[_0x2f06('0xa1')]['length']+0x1,'app':'close','appdata':_0x2f06('0xa2'),'interval':_0x2f06('0xa3')});}_0x5c9bea[_0x2f06('0x9e')][_0x2f06('0x9f')]=!![];}return db[_0x2f06('0xa4')]['create']({'phone':_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x7f')],'messageId':_0x5c9bea['body']['messageId'],'body':_0x5c9bea[_0x2f06('0x5c')][_0x2f06('0x5c')],'SmsAccountId':_0x890a00['params']['id'],'SmsInteractionId':_0x3e9068['id'],'direction':'in','ContactId':_0x3e9068['ContactId'],'AttachmentId':_0x5c9bea['body']['AttachmentId']});})[_0x2f06('0x38')](function(_0x125e21){_0x5c9bea[_0x2f06('0x29')]=_0x125e21;if(!_0x5c9bea[_0x2f06('0x9e')][_0x2f06('0xa5')])return;return db[_0x2f06('0xa6')][_0x2f06('0x5a')]({'attributes':['id',_0x2f06('0x3d')],'where':{'id':_0x5c9bea[_0x2f06('0x9e')][_0x2f06('0xa5')]}});})['then'](function(_0x1bc418){if(_0x1bc418){_0x5c9bea[_0x2f06('0xa1')][_0x2f06('0xa7')]({'id':0x0,'priority':0x0,'app':_0x2f06('0xa8'),'appdata':_0x1bc418[_0x2f06('0x3d')]+','+(_0x5c9bea[_0x2f06('0x74')][_0x2f06('0xa9')]||0xa),'interval':_0x2f06('0xa3')});}if(!_0x5c9bea[_0x2f06('0x9e')][_0x2f06('0xaa')])return;return db[_0x2f06('0xab')][_0x2f06('0x5a')]({'attributes':['id',_0x2f06('0x3d')],'where':{'id':_0x5c9bea['interaction'][_0x2f06('0xaa')]}});})['then'](function(_0x3a69ad){if(_0x3a69ad){_0x5c9bea[_0x2f06('0xa1')][_0x2f06('0xa7')]({'id':0x0,'priority':0x1,'app':_0x2f06('0xac'),'appdata':_0x3a69ad[_0x2f06('0x3d')]+','+(_0x5c9bea[_0x2f06('0x74')][_0x2f06('0xad')]||0x12c),'interval':_0x2f06('0xa3')});}return respondWithRpcPromise('Start','startRouting',_0x5c9bea);})['then'](function(_0x50a42f){if(_0x50a42f){var _0x20f605=0xc8;var _0x110742=_0x2f06('0xae');logger[_0x2f06('0x22')](_0x2f06('0xaf'),_0x110742,_0x20f605,_0x2f06('0xb0'));logger['debug'](_0x2f06('0xb1'),_0x110742,_0x20f605,'entity\x20found',JSON[_0x2f06('0x26')](_0x50a42f));if(_0x5c9bea[_0x2f06('0x74')][_0x2f06('0x50')]===_0x2f06('0xb2')){return _0x5271fb[_0x2f06('0x2b')](_0x20f605)[_0x2f06('0x32')](_0x2f06('0xb3'),_0x2f06('0xb4'))[_0x2f06('0xb5')](_0x2f06('0xb6'));}else{return _0x5271fb[_0x2f06('0x2b')](_0x20f605)['json'](_0x50a42f);}}})[_0x2f06('0x58')](handleError(_0x5271fb,null));};exports[_0x2f06('0xb7')]=function(_0x1cfb93,_0x2ca6e7){var _0x4de8b0=_0x1cfb93['params']['id'];var _0x596dcf=_0x1cfb93['body'];var _0x3e70ef=0xc8;var _0x426002=null;return db[_0x2f06('0xb8')]['transaction']({'isolationLevel':db[_0x2f06('0xb8')][_0x2f06('0xb9')]['ISOLATION_LEVELS'][_0x2f06('0xba')]},function(_0x1f18f6){return db['SmsAccount']['findOne']({'where':{'id':_0x4de8b0},'transaction':_0x1f18f6})[_0x2f06('0x38')](function(_0x5d0588){if(_0x5d0588){return db[_0x2f06('0xbb')][_0x2f06('0x3c')]({'where':{'SmsAccountId':_0x4de8b0},'transaction':_0x1f18f6})[_0x2f06('0x38')](function(){var _0x3bd7e0=_[_0x2f06('0x40')](_0x596dcf,function(_0x38ca80){_0x38ca80[_0x2f06('0x65')]=_0x4de8b0;return _0x38ca80;});return db[_0x2f06('0xbb')][_0x2f06('0xbc')](_0x3bd7e0,{'transaction':_0x1f18f6});});}else{_0x3e70ef=0x194;_0x426002=[];}});})['then'](function(){if(_0x3e70ef!==0x194){return db[_0x2f06('0xbb')][_0x2f06('0xbd')]({'where':{'SmsAccountId':_0x4de8b0},'order':'priority'})[_0x2f06('0x38')](function(_0x14442b){_0x426002=_0x14442b;});}})[_0x2f06('0x58')](function(_0x3392b7){_0x3e70ef=0x1f4;logger[_0x2f06('0x27')](_0x3392b7[_0x2f06('0xbe')]);if(_0x3392b7[_0x2f06('0x3d')]){delete _0x3392b7[_0x2f06('0x3d')];}_0x426002=_0x3392b7;})[_0x2f06('0xbf')](function(){if(_0x426002===null){_0x2ca6e7[_0x2f06('0xc0')](_0x3e70ef);}else{if(_0x3e70ef===0x1f4){_0x2ca6e7[_0x2f06('0x2b')](_0x3e70ef)[_0x2f06('0xb5')](_0x426002);}else{_0x2ca6e7[_0x2f06('0x2b')](_0x3e70ef)[_0x2f06('0x2d')](_0x426002);}}});};exports[_0x2f06('0xc1')]=function(_0x3935fb,_0xe79f44,_0x386a00){var _0x29ffe4={};var _0x4a1a31={};var _0x405733;var _0x5f3ae7;return db[_0x2f06('0x53')]['findOne']({'where':{'id':_0x3935fb[_0x2f06('0x62')]['id']}})['then'](handleEntityNotFound(_0xe79f44,null))[_0x2f06('0x38')](function(_0x5daa31){if(_0x5daa31){_0x405733=_0x5daa31;_0x4a1a31[_0x2f06('0x47')]=_[_0x2f06('0x44')](db['SmsApplication']['rawAttributes']);_0x4a1a31['query']=_[_0x2f06('0x44')](_0x3935fb[_0x2f06('0x43')]);_0x4a1a31['filters']=_[_0x2f06('0x46')](_0x4a1a31[_0x2f06('0x47')],_0x4a1a31['query']);_0x29ffe4['attributes']=_[_0x2f06('0x46')](_0x4a1a31[_0x2f06('0x47')],qs[_0x2f06('0x48')](_0x3935fb['query'][_0x2f06('0x48')]));_0x29ffe4['attributes']=_0x29ffe4['attributes'][_0x2f06('0x4a')]?_0x29ffe4[_0x2f06('0x49')]:_0x4a1a31[_0x2f06('0x47')];_0x29ffe4[_0x2f06('0x4c')]=qs[_0x2f06('0x6a')](_0x3935fb[_0x2f06('0x43')][_0x2f06('0x6a')]);_0x29ffe4[_0x2f06('0x4d')]=qs[_0x2f06('0x45')](_[_0x2f06('0x6b')](_0x3935fb['query'],_0x4a1a31['filters']));if(_0x3935fb[_0x2f06('0x43')][_0x2f06('0x4e')]){_0x29ffe4['where']=_[_0x2f06('0x4f')](_0x29ffe4['where'],{'$or':_[_0x2f06('0x40')](_0x29ffe4['attributes'],function(_0x7637fc){var _0x740280={};_0x740280[_0x7637fc]={'$like':'%'+_0x3935fb['query'][_0x2f06('0x4e')]+'%'};return _0x740280;})});}_0x29ffe4=_[_0x2f06('0x4f')]({},_0x29ffe4,_0x3935fb[_0x2f06('0x52')]);return _0x405733[_0x2f06('0xc1')](_0x29ffe4);}})[_0x2f06('0x38')](function(_0x539eb9){if(_0x539eb9){_0x5f3ae7=_0x539eb9[_0x2f06('0x4a')];if(!_0x3935fb[_0x2f06('0x43')][_0x2f06('0x69')](_0x2f06('0x4b'))){_0x29ffe4['limit']=qs[_0x2f06('0x31')](_0x3935fb[_0x2f06('0x43')][_0x2f06('0x31')]);_0x29ffe4[_0x2f06('0x2e')]=qs[_0x2f06('0x2e')](_0x3935fb[_0x2f06('0x43')][_0x2f06('0x2e')]);}return _0x405733[_0x2f06('0xc1')](_0x29ffe4);}})[_0x2f06('0x38')](function(_0x16c4c2){if(_0x16c4c2){return _0x16c4c2?{'count':_0x5f3ae7,'rows':_0x16c4c2}:null;}})[_0x2f06('0x38')](respondWithResult(_0xe79f44,null))[_0x2f06('0x58')](handleError(_0xe79f44,null));};exports[_0x2f06('0xc2')]=function(_0x54b88c,_0x372073,_0x2f7331){var _0x54ba53={'raw':![],'where':{}};var _0x3c7bf9={};var _0x374d55={'count':0x0,'rows':[]};return db[_0x2f06('0x53')][_0x2f06('0x68')]({'where':{'id':_0x54b88c['params']['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x372073,null))[_0x2f06('0x38')](function(_0x3fd8c1){if(_0x3fd8c1){_0x3c7bf9['model']=_['keys'](db[_0x2f06('0x9c')][_0x2f06('0x41')]);_0x3c7bf9[_0x2f06('0x43')]=_[_0x2f06('0x44')](_0x54b88c['query']);_0x3c7bf9[_0x2f06('0x45')]=_[_0x2f06('0x46')](_0x3c7bf9[_0x2f06('0x47')],_0x3c7bf9[_0x2f06('0x43')]);_0x54ba53[_0x2f06('0x49')]=_['intersection'](_0x3c7bf9[_0x2f06('0x47')],qs[_0x2f06('0x48')](_0x54b88c[_0x2f06('0x43')][_0x2f06('0x48')]));_0x54ba53['attributes']=_0x54ba53[_0x2f06('0x49')][_0x2f06('0x4a')]?_0x54ba53['attributes']:_0x3c7bf9['model'];if(!_0x54b88c[_0x2f06('0x43')][_0x2f06('0x69')]('nolimit')){_0x54ba53[_0x2f06('0x31')]=qs[_0x2f06('0x31')](_0x54b88c[_0x2f06('0x43')][_0x2f06('0x31')]);_0x54ba53[_0x2f06('0x2e')]=qs[_0x2f06('0x2e')](_0x54b88c[_0x2f06('0x43')]['offset']);}_0x54ba53[_0x2f06('0x4c')]=qs[_0x2f06('0x6a')](_0x54b88c[_0x2f06('0x43')][_0x2f06('0x6a')]);_0x54ba53[_0x2f06('0x4d')]=qs[_0x2f06('0x45')](_[_0x2f06('0x6b')](_0x54b88c['query'],_0x3c7bf9[_0x2f06('0x45')]));_0x54ba53[_0x2f06('0x4d')][_0x2f06('0x65')]=_0x3fd8c1['id'];if(_0x54b88c[_0x2f06('0x43')][_0x2f06('0x4e')]){_0x54ba53[_0x2f06('0x4d')]=_['merge'](_0x54ba53[_0x2f06('0x4d')],{'$or':_[_0x2f06('0x40')](_0x54ba53[_0x2f06('0x49')],function(_0x53953c){var _0x3a19c1={};_0x3a19c1[_0x53953c]={'$like':'%'+_0x54b88c[_0x2f06('0x43')][_0x2f06('0x4e')]+'%'};return _0x3a19c1;})});}_0x54ba53=_['merge']({},_0x54ba53,_0x54b88c[_0x2f06('0x52')]);return db[_0x2f06('0x9c')]['count']({'where':_0x54ba53[_0x2f06('0x4d')]})[_0x2f06('0x38')](function(_0x416901){_0x374d55['count']=_0x416901;if(_0x54b88c[_0x2f06('0x43')]['includeAll']){_0x54ba53[_0x2f06('0x55')]=[{'model':db[_0x2f06('0x77')],'as':_0x2f06('0xc3'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x2f06('0x3d'),_0x2f06('0xc4'),_0x2f06('0xc5')],'required':![]},{'model':db[_0x2f06('0xc6')],'as':'Tags','attributes':['id',_0x2f06('0x3d'),_0x2f06('0xc7')],'where':_0x54b88c['query'][_0x2f06('0xc8')]?{'id':_0x54b88c['query'][_0x2f06('0xc8')]}:undefined,'required':_0x54b88c[_0x2f06('0x43')][_0x2f06('0xc8')]?!![]:![]}];}return db[_0x2f06('0x9c')][_0x2f06('0x56')](_0x54ba53);})[_0x2f06('0x38')](function(_0x12824a){_0x374d55[_0x2f06('0x57')]=_0x12824a;return _0x374d55;});}})[_0x2f06('0x38')](respondWithFilteredResult(_0x372073,_0x54ba53))[_0x2f06('0x58')](handleError(_0x372073,null));};exports[_0x2f06('0xb5')]=function(_0x297361,_0x10ebd5,_0x212c63){var _0x424e7c,_0x240da7,_0x539446;if(_[_0x2f06('0x91')](_0x297361[_0x2f06('0x5c')]['body'])||_0x297361[_0x2f06('0x5c')][_0x2f06('0x5c')]===''){throw new db['Sequelize'][(_0x2f06('0x93'))](_0x2f06('0xc9'));}if(_[_0x2f06('0x91')](_0x297361['body']['to'])){throw new db[(_0x2f06('0x78'))][(_0x2f06('0x93'))](_0x2f06('0xca'));}_0x424e7c=_0x297361[_0x2f06('0x5c')]['to'];return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x297361[_0x2f06('0x62')]['id']},'include':[{'model':db[_0x2f06('0xcb')],'as':_0x2f06('0xcc'),'include':[{'model':db[_0x2f06('0x77')],'as':_0x2f06('0x98'),'where':{'mobile':_0x424e7c},'limit':0x1,'order':[['updatedAt',_0x2f06('0x99')]]}]}]})[_0x2f06('0x38')](handleEntityNotFound(_0x10ebd5,null))[_0x2f06('0x38')](function(_0x208be6){if(_0x208be6&&_0x208be6[_0x2f06('0xcc')]){_0x240da7=_0x208be6[_0x2f06('0x39')]({'plain':!![]});if(_0x240da7['List']&&_0x240da7[_0x2f06('0xcc')][_0x2f06('0x98')]['length']){return _0x240da7['List'][_0x2f06('0x98')][0x0];}return db[_0x2f06('0x77')]['create'](_['defaults'](_0x297361[_0x2f06('0x5c')],{'firstName':_0x424e7c,'mobile':_0x424e7c,'phone':_0x424e7c,'ListId':_0x240da7[_0x2f06('0x7d')]}));}})[_0x2f06('0x38')](handleEntityNotFound(_0x10ebd5,null))['then'](function(_0x3c0c36){if(_0x3c0c36){_0x539446=_0x3c0c36;return db[_0x2f06('0x9c')][_0x2f06('0x5a')]({'where':{'ContactId':_0x539446['id'],'closed':![],'SmsAccountId':_0x240da7['id']}})[_0x2f06('0x38')](function(_0x4c0817){if(_0x4c0817){return[_0x4c0817,![]];}return db[_0x2f06('0x9c')][_0x2f06('0x5b')]({'UserId':_0x297361['user']['id'],'ContactId':_0x539446['id'],'SmsAccountId':_0x240da7['id'],'phone':_0x424e7c,'firstMsgDirection':_0x2f06('0xcd'),'Messages':[_['merge'](_0x297361[_0x2f06('0x5c')],{'read':![],'body':_0x297361['body'][_0x2f06('0x5c')],'phone':_0x424e7c,'SmsAccountId':_0x240da7['id'],'UserId':_0x297361[_0x2f06('0xce')]['id'],'ContactId':_0x539446['id']})]},{'include':[{'model':db[_0x2f06('0xa4')],'as':_0x2f06('0xcf')}]})['then'](function(_0x3fe455){return[_0x3fe455,!![]];});});}})[_0x2f06('0x9d')](function(_0xc3febe,_0xf6cf1a){if(_0xf6cf1a){return _0xc3febe;}return db[_0x2f06('0xa4')][_0x2f06('0x5b')](_[_0x2f06('0x4f')](_0x297361['body'],{'read':![],'body':_0x297361[_0x2f06('0x5c')][_0x2f06('0x5c')],'phone':_0x424e7c,'SmsAccountId':_0x240da7['id'],'SmsInteractionId':_0xc3febe['id'],'UserId':_0x297361[_0x2f06('0xce')]['id'],'ContactId':_0x539446['id']}))[_0x2f06('0x38')](function(_0x3e9971){_0xc3febe[_0x2f06('0xd0')]['Messages']=[];_0xc3febe['dataValues'][_0x2f06('0xcf')][_0x2f06('0xd1')](_0x3e9971[_0x2f06('0xd0')]);return _0xc3febe;});})['then'](respondWithResult(_0x10ebd5,null))['catch'](handleError(_0x10ebd5,null));};exports[_0x2f06('0x2b')]=function(_0x1fbde4,_0x652de,_0x272afb){if(_0x1fbde4[_0x2f06('0x5c')]['id']){delete _0x1fbde4[_0x2f06('0x5c')]['id'];}var _0x5311ff,_0x4964,_0xbfb69f;return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x1fbde4[_0x2f06('0x62')]['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x652de,null))['then'](function(_0x34e0ce){if(_0x34e0ce){_0xbfb69f=_0x34e0ce;logger['debug'](_0x2f06('0xaf'),'status',_0x2f06('0xd2'),_0x34e0ce[_0x2f06('0x50')],util[_0x2f06('0xd3')](_0x1fbde4[_0x2f06('0x5c')],{'showHidden':![],'depth':null}));switch(_0x34e0ce[_0x2f06('0x50')]){case _0x2f06('0x83'):if(_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xd4')]&&_0x1fbde4['body'][_0x2f06('0x2b')]){_0x4964=_0x1fbde4[_0x2f06('0x5c')]['status'];return db[_0x2f06('0xa4')][_0x2f06('0x5a')]({'where':{'messageId':_0x1fbde4['body'][_0x2f06('0xd4')]}});}break;case _0x2f06('0x85'):if(_0x1fbde4[_0x2f06('0x5c')]['requestid']&&_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xd5')]){_0x4964=_0x1fbde4[_0x2f06('0x5c')]['statusInt'];return db['SmsMessage'][_0x2f06('0x5a')]({'where':{'messageId':_0x1fbde4[_0x2f06('0x5c')]['requestid']}});}break;case _0x2f06('0xd6'):if(_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xd7')]&&_0x1fbde4[_0x2f06('0x5c')]['status_code']){_0x4964=_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xd8')];return db[_0x2f06('0xa4')][_0x2f06('0x5a')]({'where':{'messageId':_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xd7')]}});}break;case _0x2f06('0xd9'):var _0x16d633=_0x1fbde4['body'][_0x2f06('0x88')][0x0];if(_0x16d633['messageId']&&_0x16d633[_0x2f06('0x2b')][_0x2f06('0xda')]===_0x2f06('0xdb')){_0x4964=_0x16d633[_0x2f06('0x2b')]['groupName'];return db['SmsMessage'][_0x2f06('0x5a')]({'where':{'messageId':_0x16d633[_0x2f06('0x82')]}});}break;case _0x2f06('0x8b'):if(_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0x82')]&&_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0x2b')]){_0x4964=_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0x2b')];return db[_0x2f06('0xa4')][_0x2f06('0x5a')]({'where':{'messageId':_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0x82')]}});}break;case _0x2f06('0x8e'):if(_0x1fbde4[_0x2f06('0x5c')][0x0][_0x2f06('0x29')]['id']){_0x4964=_0x1fbde4['body'][0x0][_0x2f06('0x50')];return db[_0x2f06('0xa4')][_0x2f06('0x5a')]({'where':{'messageId':_0x1fbde4['body'][0x0][_0x2f06('0x29')]['id']}});}break;case _0x2f06('0x8f'):if(_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xdc')]&&_0x1fbde4['body'][_0x2f06('0x2b')]){_0x4964=_0x1fbde4['body'][_0x2f06('0x2b')];return db[_0x2f06('0xa4')]['find']({'where':{'messageId':_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x652de,null))[_0x2f06('0x38')](function(_0xef020b){if(_0xef020b){_0x5311ff=_0xef020b;switch(_0xbfb69f['type']){case _0x2f06('0x83'):if(_0x4964===_0x2f06('0xdb')){return _0x5311ff[_0x2f06('0x37')]({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),_0x2f06('0x2b'),'skebby',util[_0x2f06('0xd3')](_0x1fbde4[_0x2f06('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x2f06('0x85'):if(_0x4964==='1'){return _0x5311ff['update']({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),'status',_0x2f06('0x83'),util[_0x2f06('0xd3')](_0x1fbde4[_0x2f06('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x2f06('0xd6'):if(!_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0xdd')]&&_0x4964>=0xc8&&_0x4964<=0xce){return _0x5311ff['update']({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),_0x2f06('0x2b'),_0x2f06('0xd6'),util['inspect'](_0x1fbde4['body'],{'showHidden':![],'depth':null}));}break;case _0x2f06('0xd9'):var _0x1dd74e=_0x1fbde4[_0x2f06('0x5c')][_0x2f06('0x88')][0x0];if(_0x1dd74e[_0x2f06('0x2b')]['groupName']===_0x2f06('0xdb')){return _0x5311ff['update']({'read':!![]});}else{logger[_0x2f06('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2f06('0x2b'),_0x2f06('0xd9'),util[_0x2f06('0xd3')](_0x1fbde4['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4964==_0x2f06('0xde')||_0x4964=='RECEIVED_BY_RECIPIENT'){return _0x5311ff[_0x2f06('0x37')]({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),_0x2f06('0x2b'),_0x2f06('0x8b'),util[_0x2f06('0xd3')](_0x1fbde4[_0x2f06('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x2f06('0x8e'):if(_0x4964=='message-delivered'){return _0x5311ff['update']({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),_0x2f06('0x2b'),_0x2f06('0x8e'),util['inspect'](_0x1fbde4[_0x2f06('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x2f06('0x8f'):if(_0x4964===_0x2f06('0xdf')||_0x4964===_0x2f06('0xe0')){return _0x5311ff[_0x2f06('0x37')]({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),_0x2f06('0x2b'),'intelepeer',util[_0x2f06('0xd3')](_0x1fbde4[_0x2f06('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x5311ff;}})[_0x2f06('0x38')](respondWithResult(_0x652de,null))[_0x2f06('0x58')](handleError(_0x652de,null));};exports[_0x2f06('0xe1')]=function(_0x21b500,_0x3b2257,_0x1e843f){var _0x122dbe,_0x56b589,_0x2eb3c9;return db[_0x2f06('0x53')][_0x2f06('0x5a')]({'where':{'id':_0x21b500['params']['id']}})['then'](handleEntityNotFound(_0x3b2257,null))[_0x2f06('0x38')](function(_0x354ecf){if(_0x354ecf){_0x2eb3c9=_0x354ecf;logger[_0x2f06('0x25')](_0x2f06('0xaf'),_0x2f06('0x2b'),_0x2f06('0xd2'),_0x354ecf[_0x2f06('0x50')],util[_0x2f06('0xd3')](_0x21b500['query'],{'showHidden':![],'depth':null}));switch(_0x354ecf[_0x2f06('0x50')]){case _0x2f06('0x89'):if(_0x21b500[_0x2f06('0x43')][_0x2f06('0xe2')]&&_0x21b500['query']['state']){_0x56b589=_0x21b500[_0x2f06('0x43')][_0x2f06('0xe3')];return db['SmsMessage'][_0x2f06('0x5a')]({'where':{'messageId':_0x21b500[_0x2f06('0x43')]['message-id']}});}break;}}})[_0x2f06('0x38')](handleEntityNotFound(_0x3b2257,null))['then'](function(_0x5964a2){if(_0x5964a2){_0x122dbe=_0x5964a2;switch(_0x2eb3c9[_0x2f06('0x50')]){case _0x2f06('0x89'):if(_0x56b589==='2'||_0x56b589==='6'){return _0x122dbe[_0x2f06('0x37')]({'read':!![]});}else{logger[_0x2f06('0x27')](_0x2f06('0xaf'),'status',_0x2f06('0x89'),util[_0x2f06('0xd3')](_0x21b500[_0x2f06('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x122dbe;}})['then'](respondWithResult(_0x3b2257,null))['catch'](handleError(_0x3b2257,null));};exports[_0x2f06('0xe4')]=function(_0x5f451c,_0x180589,_0x413e0c){return db['SmsAccount'][_0x2f06('0x5a')]({'where':{'id':_0x5f451c[_0x2f06('0x62')]['id']}})['then'](handleEntityNotFound(_0x180589,null))['then'](function(_0x29638d){if(_0x29638d){return _0x29638d[_0x2f06('0xe4')](_0x5f451c[_0x2f06('0x5c')][_0x2f06('0x70')],_[_0x2f06('0xe5')](_0x5f451c[_0x2f06('0x5c')],[_0x2f06('0x70'),'id'])||{})[_0x2f06('0x9d')](function(_0x432784){for(var _0x380e3e=0x0;_0x380e3e<_0x5f451c[_0x2f06('0x5c')][_0x2f06('0x70')][_0x2f06('0x4a')];_0x380e3e+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x5f451c['body']['ids'][_0x380e3e]),'SmsAccountId':Number(_0x5f451c[_0x2f06('0x62')]['id'])});}return _0x432784;});}})[_0x2f06('0x38')](respondWithResult(_0x180589,null))[_0x2f06('0x58')](handleError(_0x180589,null));};exports[_0x2f06('0xe6')]=function(_0xa0fcb2,_0x3a7dcb,_0x542dfb){return db['SmsAccount'][_0x2f06('0x5a')]({'where':{'id':_0xa0fcb2[_0x2f06('0x62')]['id']}})[_0x2f06('0x38')](handleEntityNotFound(_0x3a7dcb,null))[_0x2f06('0x38')](function(_0x2330f6){if(_0x2330f6){return _0x2330f6[_0x2f06('0xe6')](_0xa0fcb2[_0x2f06('0x43')][_0x2f06('0x70')])['then'](function(){if(_[_0x2f06('0xe7')](_0xa0fcb2[_0x2f06('0x43')][_0x2f06('0x70')])){for(var _0x290bfd=0x0;_0x290bfd<_0xa0fcb2['query'][_0x2f06('0x70')]['length'];_0x290bfd+=0x1){socket['emit'](_0x2f06('0xe8'),{'UserId':Number(_0xa0fcb2['query']['ids'][_0x290bfd]),'SmsAccountId':Number(_0xa0fcb2[_0x2f06('0x62')]['id'])});}}else{socket[_0x2f06('0xe9')](_0x2f06('0xe8'),{'UserId':Number(_0xa0fcb2['query']['ids']),'SmsAccountId':Number(_0xa0fcb2[_0x2f06('0x62')]['id'])});}});}})[_0x2f06('0x38')](respondWithStatusCode(_0x3a7dcb,null))['catch'](handleError(_0x3a7dcb,null));};exports['getAgents']=function(_0x3a7345,_0x2a535c,_0x541a14){var _0x3bb0fe={};var _0x3dfb76={};var _0x453ad0;var _0x123a6a;return db[_0x2f06('0x53')]['findOne']({'where':{'id':_0x3a7345[_0x2f06('0x62')]['id']}})['then'](handleEntityNotFound(_0x2a535c,null))['then'](function(_0x481968){if(_0x481968){_0x453ad0=_0x481968;_0x3dfb76[_0x2f06('0x47')]=_[_0x2f06('0x44')](db[_0x2f06('0xa6')]['rawAttributes']);_0x3dfb76['query']=_[_0x2f06('0x44')](_0x3a7345[_0x2f06('0x43')]);_0x3dfb76[_0x2f06('0x45')]=_[_0x2f06('0x46')](_0x3dfb76['model'],_0x3dfb76[_0x2f06('0x43')]);_0x3bb0fe[_0x2f06('0x49')]=_['intersection'](_0x3dfb76[_0x2f06('0x47')],qs[_0x2f06('0x48')](_0x3a7345[_0x2f06('0x43')][_0x2f06('0x48')]));_0x3bb0fe[_0x2f06('0x49')]=_0x3bb0fe[_0x2f06('0x49')][_0x2f06('0x4a')]?_0x3bb0fe[_0x2f06('0x49')]:_0x3dfb76['model'];_0x3bb0fe['order']=qs[_0x2f06('0x6a')](_0x3a7345['query'][_0x2f06('0x6a')]);_0x3bb0fe[_0x2f06('0x4d')]=qs[_0x2f06('0x45')](_['pick'](_0x3a7345[_0x2f06('0x43')],_0x3dfb76['filters']));if(_0x3a7345[_0x2f06('0x43')][_0x2f06('0x4e')]){_0x3bb0fe[_0x2f06('0x4d')]=_['merge'](_0x3bb0fe[_0x2f06('0x4d')],{'$or':_[_0x2f06('0x40')](_0x3bb0fe['attributes'],function(_0x82824d){var _0x5c4de5={};_0x5c4de5[_0x82824d]={'$like':'%'+_0x3a7345[_0x2f06('0x43')][_0x2f06('0x4e')]+'%'};return _0x5c4de5;})});}_0x3bb0fe=_[_0x2f06('0x4f')]({},_0x3bb0fe,_0x3a7345[_0x2f06('0x52')]);return _0x453ad0[_0x2f06('0xea')](_0x3bb0fe);}})[_0x2f06('0x38')](function(_0x2a51f0){if(_0x2a51f0){_0x123a6a=_0x2a51f0['length'];if(!_0x3a7345[_0x2f06('0x43')]['hasOwnProperty'](_0x2f06('0x4b'))){_0x3bb0fe[_0x2f06('0x31')]=qs[_0x2f06('0x31')](_0x3a7345[_0x2f06('0x43')][_0x2f06('0x31')]);_0x3bb0fe[_0x2f06('0x2e')]=qs[_0x2f06('0x2e')](_0x3a7345['query'][_0x2f06('0x2e')]);}return _0x453ad0[_0x2f06('0xea')](_0x3bb0fe);}})[_0x2f06('0x38')](function(_0x4d5aca){if(_0x4d5aca){return _0x4d5aca?{'count':_0x123a6a,'rows':_0x4d5aca}:null;}})[_0x2f06('0x38')](respondWithResult(_0x2a535c,null))['catch'](handleError(_0x2a535c,null));}; \ No newline at end of file +var _0xae88=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','SmsAccounts','stack','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','SmsAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','include','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','User','UserId','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','List','SmsMessage','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','redif','connectel','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x58c074,_0x57a0cb){var _0x31eab2=function(_0x21834e){while(--_0x21834e){_0x58c074['push'](_0x58c074['shift']());}};_0x31eab2(++_0x57a0cb);}(_0xae88,0x1bd));var _0x8ae8=function(_0x10eb6f,_0x48928a){_0x10eb6f=_0x10eb6f-0x0;var _0x2c1b95=_0xae88[_0x10eb6f];return _0x2c1b95;};'use strict';var emlformat=require(_0x8ae8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ae8('0x1'));var jsonpatch=require(_0x8ae8('0x2'));var rp=require(_0x8ae8('0x3'));var moment=require('moment');var BPromise=require(_0x8ae8('0x4'));var Mustache=require(_0x8ae8('0x5'));var util=require(_0x8ae8('0x6'));var path=require(_0x8ae8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ae8('0x8'));var fs=require('fs');var fs_extra=require(_0x8ae8('0x9'));var _=require('lodash');var squel=require(_0x8ae8('0xa'));var crypto=require(_0x8ae8('0xb'));var jsforce=require(_0x8ae8('0xc'));var deskjs=require(_0x8ae8('0xd'));var toCsv=require(_0x8ae8('0xe'));var querystring=require(_0x8ae8('0xf'));var Papa=require(_0x8ae8('0x10'));var Redis=require(_0x8ae8('0x11'));var authService=require(_0x8ae8('0x12'));var qs=require(_0x8ae8('0x13'));var as=require(_0x8ae8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ae8('0x15'))('api');var utils=require(_0x8ae8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ae8('0x17'));var db=require(_0x8ae8('0x18'))['db'];config[_0x8ae8('0x19')]=_[_0x8ae8('0x1a')](config['redis'],{'host':_0x8ae8('0x1b'),'port':0x18eb});var socket=require(_0x8ae8('0x1c'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x8ae8('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8ae8('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x18192d,_0x5a7ee9,_0x5dcad1,_0x56d6cf){return new BPromise(function(_0x27962c,_0x389e2a){var _0x5857d9=_0x56d6cf||client;return _0x5857d9[_0x8ae8('0x1f')](_0x18192d,_0x5dcad1)[_0x8ae8('0x20')](function(_0x537d9a){logger[_0x8ae8('0x21')](_0x8ae8('0x22'),_0x5a7ee9,_0x8ae8('0x23'));logger[_0x8ae8('0x24')](_0x8ae8('0x25'),_0x5a7ee9,_0x8ae8('0x23'),JSON[_0x8ae8('0x26')](_0x537d9a));if(_0x537d9a['error']){if(_0x537d9a[_0x8ae8('0x27')][_0x8ae8('0x28')]===0x1f4){logger[_0x8ae8('0x27')](_0x8ae8('0x22'),_0x5a7ee9,_0x537d9a[_0x8ae8('0x27')]['message']);return _0x389e2a(_0x537d9a[_0x8ae8('0x27')][_0x8ae8('0x29')]);}logger[_0x8ae8('0x27')]('SmsAccount,\x20%s,\x20%s',_0x5a7ee9,_0x537d9a[_0x8ae8('0x27')][_0x8ae8('0x29')]);return _0x27962c(_0x537d9a[_0x8ae8('0x27')][_0x8ae8('0x29')]);}else{logger[_0x8ae8('0x21')](_0x8ae8('0x22'),_0x5a7ee9,_0x8ae8('0x23'));_0x27962c(_0x537d9a[_0x8ae8('0x2a')][_0x8ae8('0x29')]);}})[_0x8ae8('0x2b')](function(_0xbbf9c7){logger[_0x8ae8('0x27')](_0x8ae8('0x22'),_0x5a7ee9,_0xbbf9c7);_0x389e2a(_0xbbf9c7);});});}function respondWithStatusCode(_0x506537,_0x31c087){_0x31c087=_0x31c087||0xcc;return function(_0x1f7220){if(_0x1f7220){return _0x506537[_0x8ae8('0x2c')](_0x31c087);}return _0x506537[_0x8ae8('0x2d')](_0x31c087)['end']();};}function respondWithResult(_0xffbd29,_0x1a8ad1){_0x1a8ad1=_0x1a8ad1||0xc8;return function(_0x1f27dd){if(_0x1f27dd){return _0xffbd29['status'](_0x1a8ad1)[_0x8ae8('0x2e')](_0x1f27dd);}};}function respondWithFilteredResult(_0x45af88,_0x42e04f){return function(_0x31ca76){if(_0x31ca76){var _0x5ecc3e=typeof _0x42e04f[_0x8ae8('0x2f')]===_0x8ae8('0x30')&&typeof _0x42e04f[_0x8ae8('0x31')]===_0x8ae8('0x30');var _0x447b66=_0x31ca76['count'];var _0xd02f4c=_0x5ecc3e?0x0:_0x42e04f[_0x8ae8('0x2f')];var _0x3eca71=_0x5ecc3e?_0x31ca76[_0x8ae8('0x32')]:_0x42e04f[_0x8ae8('0x2f')]+_0x42e04f[_0x8ae8('0x31')];var _0x3a1aa3;if(_0x3eca71>=_0x447b66){_0x3eca71=_0x447b66;_0x3a1aa3=0xc8;}else{_0x3a1aa3=0xce;}_0x45af88[_0x8ae8('0x2d')](_0x3a1aa3);return _0x45af88[_0x8ae8('0x33')](_0x8ae8('0x34'),_0xd02f4c+'-'+_0x3eca71+'/'+_0x447b66)['json'](_0x31ca76);}return null;};}function patchUpdates(_0x52d4f0){return function(_0x26e6af){try{jsonpatch[_0x8ae8('0x35')](_0x26e6af,_0x52d4f0,!![]);}catch(_0x1d9d04){return BPromise['reject'](_0x1d9d04);}return _0x26e6af[_0x8ae8('0x36')]();};}function saveUpdates(_0x531dbb,_0x224e52){return function(_0x5e18fe){if(_0x5e18fe){return _0x5e18fe['update'](_0x531dbb)[_0x8ae8('0x20')](function(_0x40821a){return _0x40821a;});}return null;};}function removeEntity(_0x5394f6,_0x936fe6){return function(_0x480589){if(_0x480589){return _0x480589[_0x8ae8('0x37')]()[_0x8ae8('0x20')](function(){var _0x4e7f11=_0x480589[_0x8ae8('0x38')]({'plain':!![]});var _0x13cd82=_0x8ae8('0x39');return db['UserProfileResource'][_0x8ae8('0x37')]({'where':{'type':_0x13cd82,'resourceId':_0x4e7f11['id']}})[_0x8ae8('0x20')](function(){return _0x480589;});})[_0x8ae8('0x20')](function(){_0x5394f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45534a,_0x3c7d90){return function(_0x57e54a){if(!_0x57e54a){_0x45534a[_0x8ae8('0x2c')](0x194);}return _0x57e54a;};}function handleError(_0x5456cf,_0x164277){_0x164277=_0x164277||0x1f4;return function(_0x3cce01){logger[_0x8ae8('0x27')](_0x3cce01[_0x8ae8('0x3a')]);if(_0x3cce01['name']){delete _0x3cce01[_0x8ae8('0x3b')];}_0x5456cf[_0x8ae8('0x2d')](_0x164277)[_0x8ae8('0x3c')](_0x3cce01);};}exports[_0x8ae8('0x3d')]=function(_0x119092,_0x856b10){var _0x6a82f6={'include':[{'model':db['Pause'],'as':_0x8ae8('0x3e')}]},_0x25e727={},_0xe1aa73={'count':0x0,'rows':[]};var _0x15860b=_['map'](db[_0x8ae8('0x3f')][_0x8ae8('0x40')],function(_0x3a4d83){return{'name':_0x3a4d83[_0x8ae8('0x41')],'type':_0x3a4d83[_0x8ae8('0x42')][_0x8ae8('0x43')]};});_0x25e727['model']=_[_0x8ae8('0x44')](_0x15860b,_0x8ae8('0x3b'));_0x25e727[_0x8ae8('0x45')]=_[_0x8ae8('0x46')](_0x119092[_0x8ae8('0x45')]);_0x25e727[_0x8ae8('0x47')]=_['intersection'](_0x25e727[_0x8ae8('0x48')],_0x25e727['query']);_0x6a82f6[_0x8ae8('0x49')]=_[_0x8ae8('0x4a')](_0x25e727[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x119092[_0x8ae8('0x45')][_0x8ae8('0x4b')]));_0x6a82f6[_0x8ae8('0x49')]=_0x6a82f6['attributes'][_0x8ae8('0x4c')]?_0x6a82f6[_0x8ae8('0x49')]:_0x25e727['model'];if(!_0x119092[_0x8ae8('0x45')][_0x8ae8('0x4d')](_0x8ae8('0x4e'))){_0x6a82f6[_0x8ae8('0x31')]=qs[_0x8ae8('0x31')](_0x119092['query'][_0x8ae8('0x31')]);_0x6a82f6[_0x8ae8('0x2f')]=qs[_0x8ae8('0x2f')](_0x119092[_0x8ae8('0x45')][_0x8ae8('0x2f')]);}_0x6a82f6[_0x8ae8('0x4f')]=qs[_0x8ae8('0x50')](_0x119092['query'][_0x8ae8('0x50')]);_0x6a82f6[_0x8ae8('0x51')]=qs[_0x8ae8('0x47')](_[_0x8ae8('0x52')](_0x119092[_0x8ae8('0x45')],_0x25e727[_0x8ae8('0x47')]),_0x15860b);if(_0x119092[_0x8ae8('0x45')][_0x8ae8('0x53')]){_0x6a82f6[_0x8ae8('0x51')]=_[_0x8ae8('0x54')](_0x6a82f6['where'],{'$or':_[_0x8ae8('0x44')](_0x15860b,function(_0x12e2cc){if(_0x12e2cc[_0x8ae8('0x42')]!=='VIRTUAL'){var _0x135e32={};_0x135e32[_0x12e2cc[_0x8ae8('0x3b')]]={'$like':'%'+_0x119092[_0x8ae8('0x45')][_0x8ae8('0x53')]+'%'};return _0x135e32;}})});}_0x6a82f6=_[_0x8ae8('0x54')]({},_0x6a82f6,_0x119092[_0x8ae8('0x55')]);var _0x4baf98={'where':_0x6a82f6[_0x8ae8('0x51')]};return db[_0x8ae8('0x3f')]['count'](_0x4baf98)['then'](function(_0x2bdd1a){_0xe1aa73['count']=_0x2bdd1a;if(_0x119092[_0x8ae8('0x45')][_0x8ae8('0x56')]){_0x6a82f6['include']=[{'all':!![]}];}return db[_0x8ae8('0x3f')][_0x8ae8('0x57')](_0x6a82f6);})[_0x8ae8('0x20')](function(_0x4ccbc3){_0xe1aa73[_0x8ae8('0x58')]=_0x4ccbc3;return _0xe1aa73;})['then'](respondWithFilteredResult(_0x856b10,_0x6a82f6))[_0x8ae8('0x2b')](handleError(_0x856b10,null));};exports[_0x8ae8('0x59')]=function(_0x4a6c7a,_0x2ff83a){var _0x94bbce={'raw':![],'where':{'id':_0x4a6c7a[_0x8ae8('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x8ae8('0x3e')}]},_0x4937b3={};_0x4937b3[_0x8ae8('0x48')]=_[_0x8ae8('0x46')](db['SmsAccount']['rawAttributes']);_0x4937b3['query']=_[_0x8ae8('0x46')](_0x4a6c7a[_0x8ae8('0x45')]);_0x4937b3['filters']=_[_0x8ae8('0x4a')](_0x4937b3[_0x8ae8('0x48')],_0x4937b3[_0x8ae8('0x45')]);_0x94bbce['attributes']=_[_0x8ae8('0x4a')](_0x4937b3[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x4a6c7a[_0x8ae8('0x45')]['fields']));_0x94bbce[_0x8ae8('0x49')]=_0x94bbce['attributes']['length']?_0x94bbce[_0x8ae8('0x49')]:_0x4937b3[_0x8ae8('0x48')];if(_0x4a6c7a['query'][_0x8ae8('0x56')]){_0x94bbce['include']=[{'all':!![]}];}_0x94bbce=_[_0x8ae8('0x54')]({},_0x94bbce,_0x4a6c7a[_0x8ae8('0x55')]);return db[_0x8ae8('0x3f')][_0x8ae8('0x5b')](_0x94bbce)[_0x8ae8('0x20')](handleEntityNotFound(_0x2ff83a,null))[_0x8ae8('0x20')](respondWithResult(_0x2ff83a,null))['catch'](handleError(_0x2ff83a,null));};exports[_0x8ae8('0x5c')]=function(_0x58f08e,_0x1dad26){return db[_0x8ae8('0x3f')][_0x8ae8('0x5c')](_0x58f08e[_0x8ae8('0x5d')],{})[_0x8ae8('0x20')](function(_0x5b6731){var _0x4b8c47=_0x58f08e[_0x8ae8('0x5e')][_0x8ae8('0x38')]({'plain':!![]});if(!_0x4b8c47)throw new Error(_0x8ae8('0x5f'));if(_0x4b8c47[_0x8ae8('0x60')]===_0x8ae8('0x5e')){var _0x209899=_0x5b6731['get']({'plain':!![]});var _0x25238e=_0x8ae8('0x39');return db[_0x8ae8('0x61')][_0x8ae8('0x5b')]({'where':{'name':_0x25238e,'userProfileId':_0x4b8c47[_0x8ae8('0x62')]},'raw':!![]})[_0x8ae8('0x20')](function(_0x3f576c){if(_0x3f576c&&_0x3f576c[_0x8ae8('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x209899[_0x8ae8('0x3b')],'resourceId':_0x209899['id'],'type':_0x3f576c[_0x8ae8('0x3b')],'sectionId':_0x3f576c['id']},{})[_0x8ae8('0x20')](function(){return _0x5b6731;});}else{return _0x5b6731;}})[_0x8ae8('0x2b')](function(_0x2ebe49){logger['error'](_0x8ae8('0x64'),_0x2ebe49);throw _0x2ebe49;});}return _0x5b6731;})['then'](respondWithResult(_0x1dad26,0xc9))[_0x8ae8('0x2b')](handleError(_0x1dad26,null));};exports[_0x8ae8('0x65')]=function(_0x4973b7,_0xac4388){if(_0x4973b7[_0x8ae8('0x5d')]['id']){delete _0x4973b7[_0x8ae8('0x5d')]['id'];}return db[_0x8ae8('0x3f')]['find']({'where':{'id':_0x4973b7[_0x8ae8('0x5a')]['id']},'include':[{'model':db[_0x8ae8('0x66')],'as':_0x8ae8('0x3e')}]})['then'](handleEntityNotFound(_0xac4388,null))[_0x8ae8('0x20')](saveUpdates(_0x4973b7['body'],null))[_0x8ae8('0x20')](respondWithResult(_0xac4388,null))[_0x8ae8('0x2b')](handleError(_0xac4388,null));};exports[_0x8ae8('0x37')]=function(_0x372ccd,_0x102a40){return db['SmsAccount'][_0x8ae8('0x5b')]({'where':{'id':_0x372ccd['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x102a40,null))['then'](removeEntity(_0x102a40,null))[_0x8ae8('0x2b')](handleError(_0x102a40,null));};exports[_0x8ae8('0x67')]=function(_0x43bca3,_0x3a91f2){return db['SmsAccount']['describe']()[_0x8ae8('0x20')](respondWithResult(_0x3a91f2,null))[_0x8ae8('0x2b')](handleError(_0x3a91f2,null));};exports['addDisposition']=function(_0x681078,_0x38a309,_0x4a15bd){if(_0x681078['body']['id']){delete _0x681078['body']['id'];}return db[_0x8ae8('0x3f')][_0x8ae8('0x5b')]({'where':{'id':_0x681078['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x38a309,null))[_0x8ae8('0x20')](function(_0x3e3ea6){if(_0x3e3ea6){_0x681078[_0x8ae8('0x5d')][_0x8ae8('0x68')]=_0x3e3ea6['id'];return db[_0x8ae8('0x69')][_0x8ae8('0x5c')](_0x681078[_0x8ae8('0x5d')]);}})['then'](respondWithResult(_0x38a309,null))['catch'](handleError(_0x38a309,null));};exports['getDispositions']=function(_0x20546c,_0x5d5de5,_0x559124){var _0x42518c={'raw':![],'where':{}};var _0x3bb1fe={};var _0x357feb={'count':0x0,'rows':[]};return db[_0x8ae8('0x3f')][_0x8ae8('0x6a')]({'where':{'id':_0x20546c[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x5d5de5,null))[_0x8ae8('0x20')](function(_0x275355){if(_0x275355){_0x3bb1fe['model']=_[_0x8ae8('0x46')](db[_0x8ae8('0x69')][_0x8ae8('0x40')]);_0x3bb1fe['query']=_['keys'](_0x20546c[_0x8ae8('0x45')]);_0x3bb1fe[_0x8ae8('0x47')]=_['intersection'](_0x3bb1fe[_0x8ae8('0x48')],_0x3bb1fe[_0x8ae8('0x45')]);_0x42518c[_0x8ae8('0x49')]=_['intersection'](_0x3bb1fe[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x20546c[_0x8ae8('0x45')]['fields']));_0x42518c[_0x8ae8('0x49')]=_0x42518c[_0x8ae8('0x49')][_0x8ae8('0x4c')]?_0x42518c[_0x8ae8('0x49')]:_0x3bb1fe[_0x8ae8('0x48')];if(!_0x20546c[_0x8ae8('0x45')][_0x8ae8('0x4d')](_0x8ae8('0x4e'))){_0x42518c[_0x8ae8('0x31')]=qs[_0x8ae8('0x31')](_0x20546c[_0x8ae8('0x45')]['limit']);_0x42518c[_0x8ae8('0x2f')]=qs[_0x8ae8('0x2f')](_0x20546c[_0x8ae8('0x45')][_0x8ae8('0x2f')]);}_0x42518c['order']=qs[_0x8ae8('0x50')](_0x20546c[_0x8ae8('0x45')][_0x8ae8('0x50')]);_0x42518c[_0x8ae8('0x51')]=qs[_0x8ae8('0x47')](_[_0x8ae8('0x52')](_0x20546c[_0x8ae8('0x45')],_0x3bb1fe['filters']));_0x42518c[_0x8ae8('0x51')][_0x8ae8('0x68')]=_0x275355['id'];if(_0x20546c[_0x8ae8('0x45')][_0x8ae8('0x53')]){_0x42518c['where']=_['merge'](_0x42518c[_0x8ae8('0x51')],{'$or':_[_0x8ae8('0x44')](_0x42518c['attributes'],function(_0x24db95){var _0x3167af={};_0x3167af[_0x24db95]={'$like':'%'+_0x20546c['query']['filter']+'%'};return _0x3167af;})});}_0x42518c=_['merge']({},_0x42518c,_0x20546c[_0x8ae8('0x55')]);return db['Disposition']['count']({'where':_0x42518c[_0x8ae8('0x51')]})['then'](function(_0x506018){_0x357feb['count']=_0x506018;if(_0x20546c['query']['includeAll']){_0x42518c['include']=[{'all':!![]}];}return db[_0x8ae8('0x69')]['findAll'](_0x42518c);})[_0x8ae8('0x20')](function(_0xfb3711){_0x357feb[_0x8ae8('0x58')]=_0xfb3711;return _0x357feb;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x5d5de5,_0x42518c))[_0x8ae8('0x2b')](handleError(_0x5d5de5,null));};exports[_0x8ae8('0x6b')]=function(_0x1851fe,_0x11c604,_0x59ac20){return db[_0x8ae8('0x3f')]['find']({'where':{'id':_0x1851fe[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x11c604,null))[_0x8ae8('0x20')](function(_0x532fa1){if(_0x532fa1){return _0x532fa1[_0x8ae8('0x6b')](_0x1851fe[_0x8ae8('0x45')]['ids']);}})[_0x8ae8('0x20')](respondWithStatusCode(_0x11c604,null))[_0x8ae8('0x2b')](handleError(_0x11c604,null));};exports[_0x8ae8('0x6c')]=function(_0x3f3d9f,_0x1f8374,_0x20f29c){if(_0x3f3d9f[_0x8ae8('0x5d')]['id']){delete _0x3f3d9f[_0x8ae8('0x5d')]['id'];}return db['SmsAccount'][_0x8ae8('0x5b')]({'where':{'id':_0x3f3d9f[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x1f8374,null))[_0x8ae8('0x20')](function(_0x6254df){if(_0x6254df){_0x3f3d9f[_0x8ae8('0x5d')][_0x8ae8('0x68')]=_0x6254df['id'];return db['CannedAnswer']['create'](_0x3f3d9f[_0x8ae8('0x5d')]);}})[_0x8ae8('0x20')](respondWithResult(_0x1f8374,null))['catch'](handleError(_0x1f8374,null));};exports['getAnswers']=function(_0x539a76,_0x581327,_0x50037c){var _0x5c069f={'raw':![],'where':{}};var _0xe096c5={};var _0x4133fb={'count':0x0,'rows':[]};return db[_0x8ae8('0x3f')][_0x8ae8('0x6a')]({'where':{'id':_0x539a76[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x581327,null))[_0x8ae8('0x20')](function(_0x22764a){if(_0x22764a){_0xe096c5[_0x8ae8('0x48')]=_[_0x8ae8('0x46')](db[_0x8ae8('0x6d')]['rawAttributes']);_0xe096c5[_0x8ae8('0x45')]=_[_0x8ae8('0x46')](_0x539a76[_0x8ae8('0x45')]);_0xe096c5[_0x8ae8('0x47')]=_[_0x8ae8('0x4a')](_0xe096c5[_0x8ae8('0x48')],_0xe096c5[_0x8ae8('0x45')]);_0x5c069f[_0x8ae8('0x49')]=_[_0x8ae8('0x4a')](_0xe096c5[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x539a76['query'][_0x8ae8('0x4b')]));_0x5c069f[_0x8ae8('0x49')]=_0x5c069f[_0x8ae8('0x49')][_0x8ae8('0x4c')]?_0x5c069f[_0x8ae8('0x49')]:_0xe096c5['model'];if(!_0x539a76['query']['hasOwnProperty'](_0x8ae8('0x4e'))){_0x5c069f[_0x8ae8('0x31')]=qs['limit'](_0x539a76[_0x8ae8('0x45')][_0x8ae8('0x31')]);_0x5c069f[_0x8ae8('0x2f')]=qs[_0x8ae8('0x2f')](_0x539a76[_0x8ae8('0x45')][_0x8ae8('0x2f')]);}_0x5c069f[_0x8ae8('0x4f')]=qs[_0x8ae8('0x50')](_0x539a76[_0x8ae8('0x45')][_0x8ae8('0x50')]);_0x5c069f['where']=qs[_0x8ae8('0x47')](_['pick'](_0x539a76[_0x8ae8('0x45')],_0xe096c5[_0x8ae8('0x47')]));_0x5c069f[_0x8ae8('0x51')][_0x8ae8('0x68')]=_0x22764a['id'];if(_0x539a76[_0x8ae8('0x45')][_0x8ae8('0x53')]){_0x5c069f['where']=_[_0x8ae8('0x54')](_0x5c069f[_0x8ae8('0x51')],{'$or':_[_0x8ae8('0x44')](_0x5c069f[_0x8ae8('0x49')],function(_0x120d64){var _0x3fc05a={};_0x3fc05a[_0x120d64]={'$like':'%'+_0x539a76[_0x8ae8('0x45')][_0x8ae8('0x53')]+'%'};return _0x3fc05a;})});}_0x5c069f=_[_0x8ae8('0x54')]({},_0x5c069f,_0x539a76[_0x8ae8('0x55')]);return db['CannedAnswer'][_0x8ae8('0x32')]({'where':_0x5c069f['where']})['then'](function(_0x5afca7){_0x4133fb[_0x8ae8('0x32')]=_0x5afca7;if(_0x539a76[_0x8ae8('0x45')][_0x8ae8('0x56')]){_0x5c069f[_0x8ae8('0x6e')]=[{'all':!![]}];}return db[_0x8ae8('0x6d')][_0x8ae8('0x57')](_0x5c069f);})['then'](function(_0x1a0949){_0x4133fb[_0x8ae8('0x58')]=_0x1a0949;return _0x4133fb;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x581327,_0x5c069f))[_0x8ae8('0x2b')](handleError(_0x581327,null));};exports[_0x8ae8('0x6f')]=function(_0x39598b,_0x2c80e9,_0x499ebe){return db[_0x8ae8('0x3f')][_0x8ae8('0x5b')]({'where':{'id':_0x39598b[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x2c80e9,null))[_0x8ae8('0x20')](function(_0x557774){if(_0x557774){return _0x557774[_0x8ae8('0x6f')](_0x39598b['query']['ids']);}})[_0x8ae8('0x20')](respondWithStatusCode(_0x2c80e9,null))[_0x8ae8('0x2b')](handleError(_0x2c80e9,null));};exports[_0x8ae8('0x70')]=function(_0x5048d3,_0xd02bca,_0x12e633){var _0x276fff={'channel':_0x8ae8('0x71')};var _0xd8e77d=[];var _0x2b71a9=[];var _0x4e09c4={};return db['SmsAccount'][_0x8ae8('0x5b')]({'where':{'id':_0x5048d3[_0x8ae8('0x5a')]['id']},'include':[{'model':db[_0x8ae8('0x72')],'as':_0x8ae8('0x73')}]})[_0x8ae8('0x20')](handleEntityNotFound(_0xd02bca,null))[_0x8ae8('0x20')](function(_0x16c935){_0x276fff[_0x8ae8('0x74')]=_0x16c935;_0x276fff[_0x8ae8('0x75')]=_[_0x8ae8('0x76')](_0x16c935[_0x8ae8('0x73')],[_0x8ae8('0x77')],[_0x8ae8('0x78')]);if(_0x276fff[_0x8ae8('0x74')]['Applications']){delete _0x276fff['account'][_0x8ae8('0x73')];}return db[_0x8ae8('0x79')][_0x8ae8('0x67')]();})[_0x8ae8('0x20')](function(_0x188a0a){if(!_0x188a0a){throw new db['Sequelize']['ValidationError'](_0x8ae8('0x7a'));}_0xd8e77d=_[_0x8ae8('0x7b')](_[_0x8ae8('0x46')](_0x188a0a),[_0x8ae8('0x7c'),_0x8ae8('0x7d')]);_0x2b71a9=_[_0x8ae8('0x7b')](_[_0x8ae8('0x46')](_0x188a0a),['createdAt',_0x8ae8('0x7d'),_0x8ae8('0x7e'),_0x8ae8('0x7f')]);_0x276fff[_0x8ae8('0x5d')]={'mapKey':_0x8ae8('0x80')};if(_0x276fff[_0x8ae8('0x74')][_0x8ae8('0x42')]){switch(_0x276fff[_0x8ae8('0x74')][_0x8ae8('0x42')]){case'twilio':_0x276fff['body'][_0x8ae8('0x81')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x82')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x83')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x84')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x85')];break;case _0x8ae8('0x86'):_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')]='+'+_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x87')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x88')];break;case'connectel':_0x276fff['body']['from']=_0x5048d3['body'][_0x8ae8('0x81')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x29')];break;case _0x8ae8('0x89'):_0x276fff['body'][_0x8ae8('0x81')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x81')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x5d')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x84')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x8a')];break;case'plivo':_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')]=_0x5048d3['body'][_0x8ae8('0x82')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3['body']['Text'];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x84')]=_0x5048d3['body']['MessageUUID'];break;case _0x8ae8('0x8b'):_0x276fff['body'][_0x8ae8('0x81')]='+'+_0x5048d3[_0x8ae8('0x5d')]['results'][0x0][_0x8ae8('0x81')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x8c')][0x0][_0x8ae8('0x88')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x84')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x8c')][0x0][_0x8ae8('0x84')];break;case _0x8ae8('0x8d'):_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x8e')];_0x276fff['body'][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x8f')]['message'];break;case _0x8ae8('0x90'):_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x91')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x88')];_0x276fff[_0x8ae8('0x5d')]['messageId']=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x92')];break;case _0x8ae8('0x93'):_0x276fff['body'][_0x8ae8('0x84')]=_0x5048d3[_0x8ae8('0x5d')][0x0][_0x8ae8('0x29')]['id'];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')]=_0x5048d3[_0x8ae8('0x5d')][0x0]['message'][_0x8ae8('0x81')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3[_0x8ae8('0x5d')][0x0][_0x8ae8('0x29')][_0x8ae8('0x88')];break;case _0x8ae8('0x94'):_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x81')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]=_0x5048d3['body'][_0x8ae8('0x29')];_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x84')]=_0x5048d3[_0x8ae8('0x5d')][_0x8ae8('0x95')];break;}}if(_0x276fff[_0x8ae8('0x5d')]['id']){delete _0x276fff[_0x8ae8('0x5d')]['id'];}if(_['isNil'](_0x276fff['body']['from'])){throw new db[(_0x8ae8('0x96'))][(_0x8ae8('0x97'))](_0x8ae8('0x98'));}if(_[_0x8ae8('0x99')](_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')])||_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x5d')]===''){throw new db[(_0x8ae8('0x96'))][(_0x8ae8('0x97'))](_0x8ae8('0x9a'));}if(_['isNil'](_0x276fff['body'][_0x8ae8('0x9b')])){throw new db['Sequelize'][(_0x8ae8('0x97'))](_0x8ae8('0x9c')+_0x2b71a9);}if(!_['includes'](_0x2b71a9,_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x9b')])){throw new db[(_0x8ae8('0x96'))][(_0x8ae8('0x97'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b71a9);}_0x4e09c4[_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x9b')]]=_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')];return db[_0x8ae8('0x9d')][_0x8ae8('0x5b')]({'where':{'id':_0x276fff[_0x8ae8('0x74')][_0x8ae8('0x7f')]},'include':[{'model':db[_0x8ae8('0x79')],'as':'Contacts','where':_0x4e09c4,'limit':0x1,'order':[['updatedAt',_0x8ae8('0x9e')]]}]});})[_0x8ae8('0x20')](handleEntityNotFound(_0xd02bca,null))[_0x8ae8('0x20')](function(_0x2fd1db){if(_0x2fd1db){_0x276fff[_0x8ae8('0x9f')]=_[_0x8ae8('0xa0')](_0x2fd1db,[_0x8ae8('0xa1')]);if(_0x2fd1db[_0x8ae8('0xa1')]['length']){return _0x2fd1db[_0x8ae8('0xa1')][0x0];}var _0x491b30=_[_0x8ae8('0x1a')](_0x276fff[_0x8ae8('0x5d')],{'firstName':_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')],'ListId':_0x2fd1db['id']});_0x491b30[_0x276fff['body'][_0x8ae8('0x9b')]]=_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x81')];return db[_0x8ae8('0x79')]['create'](_0x491b30,{'fields':_0xd8e77d,'raw':!![]});}})[_0x8ae8('0x20')](handleEntityNotFound(_0xd02bca,null))[_0x8ae8('0x20')](function(_0x1d992b){if(_0x1d992b){_0x276fff[_0x8ae8('0xa2')]=_0x1d992b;var _0x2c59d0={'ContactId':_0x1d992b['id'],'phone':_0x276fff[_0x8ae8('0x5d')]['from'],'SmsAccountId':_0x5048d3[_0x8ae8('0x5a')]['id']};var _0x1f5c2c={'ContactId':_0x1d992b['id'],'SmsAccountId':_0x5048d3[_0x8ae8('0x5a')]['id'],'closed':![]};return db[_0x8ae8('0xa3')][_0x8ae8('0x5b')]({'where':_0x1f5c2c})['then'](function(_0x3cc0f4){if(_0x3cc0f4){return[_0x3cc0f4,![]];}return db[_0x8ae8('0xa3')][_0x8ae8('0x5c')](_0x2c59d0)[_0x8ae8('0x20')](function(_0x560e05){return[_0x560e05,!![]];});});}})[_0x8ae8('0xa4')](function(_0x37b1a2,_0x2f14c0){_0x276fff[_0x8ae8('0xa5')]=_0x37b1a2['get']({'plain':!![]});_0x276fff[_0x8ae8('0xa5')]['created']=![];if(_0x2f14c0){if(_0x276fff[_0x8ae8('0x74')][_0x8ae8('0xa6')]){_0x276fff[_0x8ae8('0x75')]['push']({'id':0x0,'priority':_0x276fff['applications'][_0x8ae8('0x4c')]+0x1,'app':_0x8ae8('0xa7'),'appdata':_0x8ae8('0xa8'),'interval':'*,*,*,*'});}_0x276fff[_0x8ae8('0xa5')]['created']=!![];}return db['SmsMessage'][_0x8ae8('0x5c')]({'phone':_0x276fff['body']['from'],'messageId':_0x276fff[_0x8ae8('0x5d')][_0x8ae8('0x84')],'body':_0x276fff['body'][_0x8ae8('0x5d')],'SmsAccountId':_0x5048d3[_0x8ae8('0x5a')]['id'],'SmsInteractionId':_0x37b1a2['id'],'direction':'in','ContactId':_0x37b1a2['ContactId'],'AttachmentId':_0x276fff['body']['AttachmentId']});})['then'](function(_0x53edeb){_0x276fff['message']=_0x53edeb;if(!_0x276fff[_0x8ae8('0xa5')]['UserId'])return;return db[_0x8ae8('0xa9')]['find']({'attributes':['id',_0x8ae8('0x3b')],'where':{'id':_0x276fff[_0x8ae8('0xa5')][_0x8ae8('0xaa')]}});})['then'](function(_0x58690e){if(_0x58690e){_0x276fff[_0x8ae8('0x75')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8ae8('0xab'),'appdata':_0x58690e[_0x8ae8('0x3b')]+','+(_0x276fff[_0x8ae8('0x74')][_0x8ae8('0xac')]||0xa),'interval':'*,*,*,*'});}if(!_0x276fff[_0x8ae8('0xa5')][_0x8ae8('0xad')])return;return db[_0x8ae8('0xae')][_0x8ae8('0x5b')]({'attributes':['id',_0x8ae8('0x3b')],'where':{'id':_0x276fff[_0x8ae8('0xa5')][_0x8ae8('0xad')]}});})[_0x8ae8('0x20')](function(_0x4c07f3){if(_0x4c07f3){_0x276fff['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x8ae8('0xaf'),'appdata':_0x4c07f3[_0x8ae8('0x3b')]+','+(_0x276fff['account'][_0x8ae8('0xb0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x8ae8('0xb1'),_0x276fff);})[_0x8ae8('0x20')](function(_0x33d4b1){if(_0x33d4b1){var _0x5c9da8=0xc8;var _0x57f206='receiveMessage';logger[_0x8ae8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57f206,_0x5c9da8,_0x8ae8('0xb2'));logger['debug'](_0x8ae8('0xb3'),_0x57f206,_0x5c9da8,_0x8ae8('0xb2'),JSON[_0x8ae8('0x26')](_0x33d4b1));if(_0x276fff[_0x8ae8('0x74')][_0x8ae8('0x42')]===_0x8ae8('0xb4')){return _0xd02bca[_0x8ae8('0x2d')](_0x5c9da8)[_0x8ae8('0x33')](_0x8ae8('0xb5'),_0x8ae8('0xb6'))[_0x8ae8('0x3c')](_0x8ae8('0xb7'));}else{return _0xd02bca[_0x8ae8('0x2d')](_0x5c9da8)['json'](_0x33d4b1);}}})[_0x8ae8('0x2b')](handleError(_0xd02bca,null));};exports[_0x8ae8('0xb8')]=function(_0x4f32bd,_0x517752){var _0x7a625f=_0x4f32bd[_0x8ae8('0x5a')]['id'];var _0x46f109=_0x4f32bd[_0x8ae8('0x5d')];var _0x127d88=0xc8;var _0x55197f=null;return db[_0x8ae8('0xb9')]['transaction']({'isolationLevel':db[_0x8ae8('0xb9')][_0x8ae8('0xba')][_0x8ae8('0xbb')]['READ_COMMITTED']},function(_0x10063f){return db[_0x8ae8('0x3f')]['findOne']({'where':{'id':_0x7a625f},'transaction':_0x10063f})[_0x8ae8('0x20')](function(_0x53846e){if(_0x53846e){return db['SmsApplication'][_0x8ae8('0x37')]({'where':{'SmsAccountId':_0x7a625f},'transaction':_0x10063f})[_0x8ae8('0x20')](function(){var _0x83d5d6=_[_0x8ae8('0x44')](_0x46f109,function(_0x513f88){_0x513f88[_0x8ae8('0x68')]=_0x7a625f;return _0x513f88;});return db[_0x8ae8('0x72')][_0x8ae8('0xbc')](_0x83d5d6,{'transaction':_0x10063f});});}else{_0x127d88=0x194;_0x55197f=[];}});})['then'](function(){if(_0x127d88!==0x194){return db['SmsApplication'][_0x8ae8('0xbd')]({'where':{'SmsAccountId':_0x7a625f},'order':'priority'})[_0x8ae8('0x20')](function(_0xc916de){_0x55197f=_0xc916de;});}})[_0x8ae8('0x2b')](function(_0xeb9f2f){_0x127d88=0x1f4;logger[_0x8ae8('0x27')](_0xeb9f2f[_0x8ae8('0x3a')]);if(_0xeb9f2f['name']){delete _0xeb9f2f[_0x8ae8('0x3b')];}_0x55197f=_0xeb9f2f;})[_0x8ae8('0xbe')](function(){if(_0x55197f===null){_0x517752['sendStatus'](_0x127d88);}else{if(_0x127d88===0x1f4){_0x517752['status'](_0x127d88)[_0x8ae8('0x3c')](_0x55197f);}else{_0x517752['status'](_0x127d88)[_0x8ae8('0x2e')](_0x55197f);}}});};exports[_0x8ae8('0xbf')]=function(_0x39f98e,_0x3e2648,_0x5b806c){var _0x2353ed={};var _0x3edde5={};var _0x438263;var _0x2a4509;return db[_0x8ae8('0x3f')]['findOne']({'where':{'id':_0x39f98e[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x3e2648,null))[_0x8ae8('0x20')](function(_0x55cd1b){if(_0x55cd1b){_0x438263=_0x55cd1b;_0x3edde5[_0x8ae8('0x48')]=_[_0x8ae8('0x46')](db['SmsApplication'][_0x8ae8('0x40')]);_0x3edde5['query']=_['keys'](_0x39f98e[_0x8ae8('0x45')]);_0x3edde5[_0x8ae8('0x47')]=_[_0x8ae8('0x4a')](_0x3edde5[_0x8ae8('0x48')],_0x3edde5[_0x8ae8('0x45')]);_0x2353ed[_0x8ae8('0x49')]=_[_0x8ae8('0x4a')](_0x3edde5[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x39f98e[_0x8ae8('0x45')][_0x8ae8('0x4b')]));_0x2353ed[_0x8ae8('0x49')]=_0x2353ed['attributes'][_0x8ae8('0x4c')]?_0x2353ed[_0x8ae8('0x49')]:_0x3edde5[_0x8ae8('0x48')];_0x2353ed['order']=qs[_0x8ae8('0x50')](_0x39f98e['query'][_0x8ae8('0x50')]);_0x2353ed[_0x8ae8('0x51')]=qs[_0x8ae8('0x47')](_[_0x8ae8('0x52')](_0x39f98e[_0x8ae8('0x45')],_0x3edde5[_0x8ae8('0x47')]));if(_0x39f98e[_0x8ae8('0x45')]['filter']){_0x2353ed[_0x8ae8('0x51')]=_['merge'](_0x2353ed[_0x8ae8('0x51')],{'$or':_[_0x8ae8('0x44')](_0x2353ed[_0x8ae8('0x49')],function(_0xb4cfa){var _0x30f7df={};_0x30f7df[_0xb4cfa]={'$like':'%'+_0x39f98e['query'][_0x8ae8('0x53')]+'%'};return _0x30f7df;})});}_0x2353ed=_[_0x8ae8('0x54')]({},_0x2353ed,_0x39f98e[_0x8ae8('0x55')]);return _0x438263[_0x8ae8('0xbf')](_0x2353ed);}})['then'](function(_0x250b46){if(_0x250b46){_0x2a4509=_0x250b46['length'];if(!_0x39f98e['query'][_0x8ae8('0x4d')](_0x8ae8('0x4e'))){_0x2353ed[_0x8ae8('0x31')]=qs[_0x8ae8('0x31')](_0x39f98e[_0x8ae8('0x45')]['limit']);_0x2353ed['offset']=qs[_0x8ae8('0x2f')](_0x39f98e['query'][_0x8ae8('0x2f')]);}return _0x438263['getApplications'](_0x2353ed);}})[_0x8ae8('0x20')](function(_0xd77c08){if(_0xd77c08){return _0xd77c08?{'count':_0x2a4509,'rows':_0xd77c08}:null;}})[_0x8ae8('0x20')](respondWithResult(_0x3e2648,null))['catch'](handleError(_0x3e2648,null));};exports[_0x8ae8('0xc0')]=function(_0x32e095,_0x834375,_0xa087a9){var _0x15544d={'raw':![],'where':{}};var _0xd54a31={};var _0x1f2079={'count':0x0,'rows':[]};return db[_0x8ae8('0x3f')][_0x8ae8('0x6a')]({'where':{'id':_0x32e095[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x834375,null))[_0x8ae8('0x20')](function(_0x3e7074){if(_0x3e7074){_0xd54a31[_0x8ae8('0x48')]=_[_0x8ae8('0x46')](db[_0x8ae8('0xa3')][_0x8ae8('0x40')]);_0xd54a31[_0x8ae8('0x45')]=_[_0x8ae8('0x46')](_0x32e095[_0x8ae8('0x45')]);_0xd54a31['filters']=_[_0x8ae8('0x4a')](_0xd54a31[_0x8ae8('0x48')],_0xd54a31['query']);_0x15544d['attributes']=_[_0x8ae8('0x4a')](_0xd54a31[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x32e095[_0x8ae8('0x45')]['fields']));_0x15544d[_0x8ae8('0x49')]=_0x15544d[_0x8ae8('0x49')][_0x8ae8('0x4c')]?_0x15544d[_0x8ae8('0x49')]:_0xd54a31[_0x8ae8('0x48')];if(!_0x32e095[_0x8ae8('0x45')][_0x8ae8('0x4d')]('nolimit')){_0x15544d['limit']=qs[_0x8ae8('0x31')](_0x32e095[_0x8ae8('0x45')][_0x8ae8('0x31')]);_0x15544d[_0x8ae8('0x2f')]=qs[_0x8ae8('0x2f')](_0x32e095[_0x8ae8('0x45')][_0x8ae8('0x2f')]);}_0x15544d[_0x8ae8('0x4f')]=qs['sort'](_0x32e095[_0x8ae8('0x45')][_0x8ae8('0x50')]);_0x15544d[_0x8ae8('0x51')]=qs[_0x8ae8('0x47')](_[_0x8ae8('0x52')](_0x32e095['query'],_0xd54a31[_0x8ae8('0x47')]));_0x15544d[_0x8ae8('0x51')][_0x8ae8('0x68')]=_0x3e7074['id'];if(_0x32e095[_0x8ae8('0x45')][_0x8ae8('0x53')]){_0x15544d[_0x8ae8('0x51')]=_['merge'](_0x15544d[_0x8ae8('0x51')],{'$or':_['map'](_0x15544d[_0x8ae8('0x49')],function(_0x2014a4){var _0x49b3fe={};_0x49b3fe[_0x2014a4]={'$like':'%'+_0x32e095[_0x8ae8('0x45')][_0x8ae8('0x53')]+'%'};return _0x49b3fe;})});}_0x15544d=_[_0x8ae8('0x54')]({},_0x15544d,_0x32e095[_0x8ae8('0x55')]);return db[_0x8ae8('0xa3')]['count']({'where':_0x15544d[_0x8ae8('0x51')]})[_0x8ae8('0x20')](function(_0x25e9fa){_0x1f2079[_0x8ae8('0x32')]=_0x25e9fa;if(_0x32e095[_0x8ae8('0x45')]['includeAll']){_0x15544d[_0x8ae8('0x6e')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8ae8('0xa9')],'as':'Owner','attributes':[_0x8ae8('0x3b'),_0x8ae8('0xc1'),_0x8ae8('0xc2')],'required':![]},{'model':db[_0x8ae8('0xc3')],'as':_0x8ae8('0xc4'),'attributes':['id',_0x8ae8('0x3b'),_0x8ae8('0xc5')],'where':_0x32e095[_0x8ae8('0x45')][_0x8ae8('0xc6')]?{'id':_0x32e095[_0x8ae8('0x45')][_0x8ae8('0xc6')]}:undefined,'required':_0x32e095[_0x8ae8('0x45')][_0x8ae8('0xc6')]?!![]:![]}];}return db[_0x8ae8('0xa3')]['findAll'](_0x15544d);})[_0x8ae8('0x20')](function(_0x40e95f){_0x1f2079[_0x8ae8('0x58')]=_0x40e95f;return _0x1f2079;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x834375,_0x15544d))['catch'](handleError(_0x834375,null));};exports[_0x8ae8('0x3c')]=function(_0x1aae2c,_0x5298e3,_0x41d698){var _0x33d3d0,_0x1b4423,_0x1d44e0;if(_[_0x8ae8('0x99')](_0x1aae2c[_0x8ae8('0x5d')][_0x8ae8('0x5d')])||_0x1aae2c[_0x8ae8('0x5d')][_0x8ae8('0x5d')]===''){throw new db[(_0x8ae8('0x96'))][(_0x8ae8('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1aae2c[_0x8ae8('0x5d')]['to'])){throw new db[(_0x8ae8('0x96'))][(_0x8ae8('0x97'))]('to\x20is\x20mandatory');}_0x33d3d0=_0x1aae2c['body']['to'];return db['SmsAccount'][_0x8ae8('0x5b')]({'where':{'id':_0x1aae2c[_0x8ae8('0x5a')]['id']},'include':[{'model':db[_0x8ae8('0x9d')],'as':_0x8ae8('0xc7'),'include':[{'model':db[_0x8ae8('0x79')],'as':'Contacts','where':{'mobile':_0x33d3d0},'limit':0x1,'order':[['updatedAt',_0x8ae8('0x9e')]]}]}]})[_0x8ae8('0x20')](handleEntityNotFound(_0x5298e3,null))[_0x8ae8('0x20')](function(_0x388ea2){if(_0x388ea2&&_0x388ea2[_0x8ae8('0xc7')]){_0x1b4423=_0x388ea2[_0x8ae8('0x38')]({'plain':!![]});if(_0x1b4423[_0x8ae8('0xc7')]&&_0x1b4423[_0x8ae8('0xc7')][_0x8ae8('0xa1')][_0x8ae8('0x4c')]){return _0x1b4423[_0x8ae8('0xc7')]['Contacts'][0x0];}return db[_0x8ae8('0x79')][_0x8ae8('0x5c')](_[_0x8ae8('0x1a')](_0x1aae2c['body'],{'firstName':_0x33d3d0,'mobile':_0x33d3d0,'phone':_0x33d3d0,'ListId':_0x1b4423[_0x8ae8('0x7f')]}));}})[_0x8ae8('0x20')](handleEntityNotFound(_0x5298e3,null))[_0x8ae8('0x20')](function(_0x1c96d7){if(_0x1c96d7){_0x1d44e0=_0x1c96d7;return db[_0x8ae8('0xa3')][_0x8ae8('0x5b')]({'where':{'ContactId':_0x1d44e0['id'],'closed':![],'SmsAccountId':_0x1b4423['id']}})[_0x8ae8('0x20')](function(_0x5ba3ca){if(_0x5ba3ca){return[_0x5ba3ca,![]];}return db[_0x8ae8('0xa3')][_0x8ae8('0x5c')]({'UserId':_0x1aae2c['user']['id'],'ContactId':_0x1d44e0['id'],'SmsAccountId':_0x1b4423['id'],'phone':_0x33d3d0,'firstMsgDirection':'out','Messages':[_['merge'](_0x1aae2c['body'],{'read':![],'body':_0x1aae2c[_0x8ae8('0x5d')]['body'],'phone':_0x33d3d0,'SmsAccountId':_0x1b4423['id'],'UserId':_0x1aae2c['user']['id'],'ContactId':_0x1d44e0['id']})]},{'include':[{'model':db[_0x8ae8('0xc8')],'as':_0x8ae8('0xc9')}]})[_0x8ae8('0x20')](function(_0x13480f){return[_0x13480f,!![]];});});}})['spread'](function(_0x2d641c,_0x515f7d){if(_0x515f7d){return _0x2d641c;}return db['SmsMessage'][_0x8ae8('0x5c')](_[_0x8ae8('0x54')](_0x1aae2c[_0x8ae8('0x5d')],{'read':![],'body':_0x1aae2c[_0x8ae8('0x5d')][_0x8ae8('0x5d')],'phone':_0x33d3d0,'SmsAccountId':_0x1b4423['id'],'SmsInteractionId':_0x2d641c['id'],'UserId':_0x1aae2c['user']['id'],'ContactId':_0x1d44e0['id']}))[_0x8ae8('0x20')](function(_0x2105d3){_0x2d641c['dataValues'][_0x8ae8('0xc9')]=[];_0x2d641c['dataValues']['Messages']['push'](_0x2105d3[_0x8ae8('0xca')]);return _0x2d641c;});})[_0x8ae8('0x20')](respondWithResult(_0x5298e3,null))[_0x8ae8('0x2b')](handleError(_0x5298e3,null));};exports[_0x8ae8('0x2d')]=function(_0x293fad,_0x1fdc12,_0x403624){if(_0x293fad[_0x8ae8('0x5d')]['id']){delete _0x293fad[_0x8ae8('0x5d')]['id'];}var _0x14818a,_0x165e71,_0x494c36;return db[_0x8ae8('0x3f')][_0x8ae8('0x5b')]({'where':{'id':_0x293fad[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x1fdc12,null))[_0x8ae8('0x20')](function(_0x1652d6){if(_0x1652d6){_0x494c36=_0x1652d6;logger[_0x8ae8('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ae8('0x2d'),'received\x20delivery\x20report\x20from',_0x1652d6[_0x8ae8('0x42')],util['inspect'](_0x293fad['body'],{'showHidden':![],'depth':null}));switch(_0x1652d6[_0x8ae8('0x42')]){case _0x8ae8('0x86'):if(_0x293fad['body'][_0x8ae8('0xcb')]&&_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x2d')]){_0x165e71=_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x2d')];return db[_0x8ae8('0xc8')][_0x8ae8('0x5b')]({'where':{'messageId':_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0xcb')]}});}break;case'connectel':if(_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0xcc')]&&_0x293fad['body'][_0x8ae8('0xcd')]){_0x165e71=_0x293fad['body'][_0x8ae8('0xcd')];return db[_0x8ae8('0xc8')][_0x8ae8('0x5b')]({'where':{'messageId':_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0xcc')]}});}break;case _0x8ae8('0x89'):if(_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x8a')]&&_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0xce')]){_0x165e71=_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0xce')];return db['SmsMessage']['find']({'where':{'messageId':_0x293fad[_0x8ae8('0x5d')]['message_id']}});}break;case _0x8ae8('0x8b'):var _0x10dcba=_0x293fad['body'][_0x8ae8('0x8c')][0x0];if(_0x10dcba[_0x8ae8('0x84')]&&_0x10dcba['status']['groupName']===_0x8ae8('0xcf')){_0x165e71=_0x10dcba['status'][_0x8ae8('0xd0')];return db['SmsMessage'][_0x8ae8('0x5b')]({'where':{'messageId':_0x10dcba[_0x8ae8('0x84')]}});}break;case _0x8ae8('0x90'):if(_0x293fad[_0x8ae8('0x5d')]['messageId']&&_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x2d')]){_0x165e71=_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x2d')];return db['SmsMessage'][_0x8ae8('0x5b')]({'where':{'messageId':_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x84')]}});}break;case'bandwidth':if(_0x293fad[_0x8ae8('0x5d')][0x0]['message']['id']){_0x165e71=_0x293fad['body'][0x0]['type'];return db[_0x8ae8('0xc8')][_0x8ae8('0x5b')]({'where':{'messageId':_0x293fad[_0x8ae8('0x5d')][0x0][_0x8ae8('0x29')]['id']}});}break;case _0x8ae8('0x94'):if(_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0xd1')]&&_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x2d')]){_0x165e71=_0x293fad[_0x8ae8('0x5d')][_0x8ae8('0x2d')];return db[_0x8ae8('0xc8')][_0x8ae8('0x5b')]({'where':{'messageId':_0x293fad[_0x8ae8('0x5d')]['redif']}});}break;}}})[_0x8ae8('0x20')](handleEntityNotFound(_0x1fdc12,null))[_0x8ae8('0x20')](function(_0x19c509){if(_0x19c509){_0x14818a=_0x19c509;switch(_0x494c36[_0x8ae8('0x42')]){case _0x8ae8('0x86'):if(_0x165e71===_0x8ae8('0xcf')){return _0x14818a['update']({'read':!![]});}else{logger[_0x8ae8('0x27')](_0x8ae8('0x25'),_0x8ae8('0x2d'),'skebby',util['inspect'](_0x293fad['body'],{'showHidden':![],'depth':null}));}break;case _0x8ae8('0xd2'):if(_0x165e71==='1'){return _0x14818a['update']({'read':!![]});}else{logger[_0x8ae8('0x27')](_0x8ae8('0x25'),_0x8ae8('0x2d'),'skebby',util[_0x8ae8('0xd3')](_0x293fad[_0x8ae8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8ae8('0x89'):if(!_0x293fad['body'][_0x8ae8('0xd4')]&&_0x165e71>=0xc8&&_0x165e71<=0xce){return _0x14818a[_0x8ae8('0x65')]({'read':!![]});}else{logger[_0x8ae8('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ae8('0x2d'),_0x8ae8('0x89'),util[_0x8ae8('0xd3')](_0x293fad[_0x8ae8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8ae8('0x8b'):var _0x410f95=_0x293fad[_0x8ae8('0x5d')]['results'][0x0];if(_0x410f95[_0x8ae8('0x2d')]['groupName']===_0x8ae8('0xcf')){return _0x14818a[_0x8ae8('0x65')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ae8('0x2d'),_0x8ae8('0x8b'),util[_0x8ae8('0xd3')](_0x293fad[_0x8ae8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8ae8('0x90'):if(_0x165e71==_0x8ae8('0xd5')||_0x165e71==_0x8ae8('0xd6')){return _0x14818a[_0x8ae8('0x65')]({'read':!![]});}else{logger[_0x8ae8('0x27')](_0x8ae8('0x25'),_0x8ae8('0x2d'),_0x8ae8('0x90'),util['inspect'](_0x293fad[_0x8ae8('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8ae8('0x93'):if(_0x165e71=='message-delivered'){return _0x14818a[_0x8ae8('0x65')]({'read':!![]});}else{logger[_0x8ae8('0x27')](_0x8ae8('0x25'),'status','bandwidth',util[_0x8ae8('0xd3')](_0x293fad['body'],{'showHidden':![],'depth':null}));}break;case _0x8ae8('0x94'):if(_0x165e71===_0x8ae8('0xd7')||_0x165e71===_0x8ae8('0xd8')){return _0x14818a[_0x8ae8('0x65')]({'read':!![]});}else{logger[_0x8ae8('0x27')](_0x8ae8('0x25'),'status',_0x8ae8('0x94'),util[_0x8ae8('0xd3')](_0x293fad['body'],{'showHidden':![],'depth':null}));}break;}return _0x14818a;}})[_0x8ae8('0x20')](respondWithResult(_0x1fdc12,null))[_0x8ae8('0x2b')](handleError(_0x1fdc12,null));};exports[_0x8ae8('0xd9')]=function(_0x264e82,_0x50ccf1,_0x1a2bfb){var _0x4c78d7,_0x4f040d,_0x3a9e33;return db[_0x8ae8('0x3f')][_0x8ae8('0x5b')]({'where':{'id':_0x264e82[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x50ccf1,null))['then'](function(_0x463aa8){if(_0x463aa8){_0x3a9e33=_0x463aa8;logger[_0x8ae8('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8ae8('0xda'),_0x463aa8['type'],util[_0x8ae8('0xd3')](_0x264e82['query'],{'showHidden':![],'depth':null}));switch(_0x463aa8['type']){case _0x8ae8('0x8d'):if(_0x264e82[_0x8ae8('0x45')]['message-id']&&_0x264e82['query']['state']){_0x4f040d=_0x264e82[_0x8ae8('0x45')][_0x8ae8('0xdb')];return db[_0x8ae8('0xc8')][_0x8ae8('0x5b')]({'where':{'messageId':_0x264e82['query'][_0x8ae8('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x50ccf1,null))[_0x8ae8('0x20')](function(_0x2c854e){if(_0x2c854e){_0x4c78d7=_0x2c854e;switch(_0x3a9e33[_0x8ae8('0x42')]){case'csc':if(_0x4f040d==='2'||_0x4f040d==='6'){return _0x4c78d7[_0x8ae8('0x65')]({'read':!![]});}else{logger['error'](_0x8ae8('0x25'),_0x8ae8('0x2d'),_0x8ae8('0x8d'),util[_0x8ae8('0xd3')](_0x264e82[_0x8ae8('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x4c78d7;}})[_0x8ae8('0x20')](respondWithResult(_0x50ccf1,null))[_0x8ae8('0x2b')](handleError(_0x50ccf1,null));};exports[_0x8ae8('0xdd')]=function(_0x487e20,_0x15bf39,_0x40be42){return db[_0x8ae8('0x3f')][_0x8ae8('0x5b')]({'where':{'id':_0x487e20[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x15bf39,null))[_0x8ae8('0x20')](function(_0x1201dd){if(_0x1201dd){return _0x1201dd[_0x8ae8('0xdd')](_0x487e20[_0x8ae8('0x5d')]['ids'],_[_0x8ae8('0xa0')](_0x487e20['body'],[_0x8ae8('0xde'),'id'])||{})[_0x8ae8('0xa4')](function(_0x2c0b50){for(var _0xc46c9a=0x0;_0xc46c9a<_0x487e20[_0x8ae8('0x5d')][_0x8ae8('0xde')][_0x8ae8('0x4c')];_0xc46c9a+=0x1){socket[_0x8ae8('0xdf')](_0x8ae8('0xe0'),{'UserId':Number(_0x487e20[_0x8ae8('0x5d')][_0x8ae8('0xde')][_0xc46c9a]),'SmsAccountId':Number(_0x487e20[_0x8ae8('0x5a')]['id'])});}return _0x2c0b50;});}})[_0x8ae8('0x20')](respondWithResult(_0x15bf39,null))[_0x8ae8('0x2b')](handleError(_0x15bf39,null));};exports[_0x8ae8('0xe1')]=function(_0x2bcb17,_0x33ffbc,_0x156c90){return db[_0x8ae8('0x3f')]['find']({'where':{'id':_0x2bcb17[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x33ffbc,null))['then'](function(_0x538f25){if(_0x538f25){return _0x538f25[_0x8ae8('0xe1')](_0x2bcb17[_0x8ae8('0x45')][_0x8ae8('0xde')])[_0x8ae8('0x20')](function(){if(_[_0x8ae8('0xe2')](_0x2bcb17[_0x8ae8('0x45')][_0x8ae8('0xde')])){for(var _0x4fd3f9=0x0;_0x4fd3f9<_0x2bcb17[_0x8ae8('0x45')]['ids'][_0x8ae8('0x4c')];_0x4fd3f9+=0x1){socket[_0x8ae8('0xdf')](_0x8ae8('0xe3'),{'UserId':Number(_0x2bcb17[_0x8ae8('0x45')][_0x8ae8('0xde')][_0x4fd3f9]),'SmsAccountId':Number(_0x2bcb17['params']['id'])});}}else{socket[_0x8ae8('0xdf')](_0x8ae8('0xe3'),{'UserId':Number(_0x2bcb17[_0x8ae8('0x45')][_0x8ae8('0xde')]),'SmsAccountId':Number(_0x2bcb17['params']['id'])});}});}})[_0x8ae8('0x20')](respondWithStatusCode(_0x33ffbc,null))[_0x8ae8('0x2b')](handleError(_0x33ffbc,null));};exports['getAgents']=function(_0x7eb530,_0x11a9e0,_0x1888b3){var _0x3578c3={};var _0x47110a={};var _0x4ac4cf;var _0x24e611;return db['SmsAccount'][_0x8ae8('0x6a')]({'where':{'id':_0x7eb530[_0x8ae8('0x5a')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x11a9e0,null))[_0x8ae8('0x20')](function(_0x26bd74){if(_0x26bd74){_0x4ac4cf=_0x26bd74;_0x47110a[_0x8ae8('0x48')]=_[_0x8ae8('0x46')](db[_0x8ae8('0xa9')][_0x8ae8('0x40')]);_0x47110a[_0x8ae8('0x45')]=_[_0x8ae8('0x46')](_0x7eb530[_0x8ae8('0x45')]);_0x47110a[_0x8ae8('0x47')]=_[_0x8ae8('0x4a')](_0x47110a[_0x8ae8('0x48')],_0x47110a[_0x8ae8('0x45')]);_0x3578c3['attributes']=_[_0x8ae8('0x4a')](_0x47110a[_0x8ae8('0x48')],qs[_0x8ae8('0x4b')](_0x7eb530['query'][_0x8ae8('0x4b')]));_0x3578c3[_0x8ae8('0x49')]=_0x3578c3[_0x8ae8('0x49')][_0x8ae8('0x4c')]?_0x3578c3['attributes']:_0x47110a['model'];_0x3578c3[_0x8ae8('0x4f')]=qs['sort'](_0x7eb530[_0x8ae8('0x45')]['sort']);_0x3578c3['where']=qs[_0x8ae8('0x47')](_[_0x8ae8('0x52')](_0x7eb530[_0x8ae8('0x45')],_0x47110a[_0x8ae8('0x47')]));if(_0x7eb530[_0x8ae8('0x45')][_0x8ae8('0x53')]){_0x3578c3[_0x8ae8('0x51')]=_[_0x8ae8('0x54')](_0x3578c3['where'],{'$or':_['map'](_0x3578c3[_0x8ae8('0x49')],function(_0x480384){var _0x5d23cc={};_0x5d23cc[_0x480384]={'$like':'%'+_0x7eb530[_0x8ae8('0x45')]['filter']+'%'};return _0x5d23cc;})});}_0x3578c3=_[_0x8ae8('0x54')]({},_0x3578c3,_0x7eb530['options']);return _0x4ac4cf[_0x8ae8('0xe4')](_0x3578c3);}})['then'](function(_0x1826f2){if(_0x1826f2){_0x24e611=_0x1826f2[_0x8ae8('0x4c')];if(!_0x7eb530['query'][_0x8ae8('0x4d')]('nolimit')){_0x3578c3['limit']=qs[_0x8ae8('0x31')](_0x7eb530[_0x8ae8('0x45')]['limit']);_0x3578c3[_0x8ae8('0x2f')]=qs[_0x8ae8('0x2f')](_0x7eb530[_0x8ae8('0x45')][_0x8ae8('0x2f')]);}return _0x4ac4cf[_0x8ae8('0xe4')](_0x3578c3);}})[_0x8ae8('0x20')](function(_0x430cd2){if(_0x430cd2){return _0x430cd2?{'count':_0x24e611,'rows':_0x430cd2}:null;}})[_0x8ae8('0x20')](respondWithResult(_0x11a9e0,null))[_0x8ae8('0x2b')](handleError(_0x11a9e0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 50f85f9..28d5fbb 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 _0x02bb=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x02bb,0x7f));var _0xb02b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x02bb[_0x413feb];return _0x40ee88;};'use strict';var EventEmitter=require(_0xb02b('0x0'));var SmsAccount=require(_0xb02b('0x1'))['db'][_0xb02b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb02b('0x3')](0x0);var events={'afterCreate':_0xb02b('0x4'),'afterUpdate':'update','afterDestroy':_0xb02b('0x5')};function emitEvent(_0x4d0f17){return function(_0x4de8ef,_0x3b8ab2,_0x4d2a81){SmsAccountEvents['emit'](_0x4d0f17+':'+_0x4de8ef['id'],_0x4de8ef);SmsAccountEvents['emit'](_0x4d0f17,_0x4de8ef);_0x4d2a81(null);};}for(var e in events){if(events[_0xb02b('0x6')](e)){var event=events[e];SmsAccount[_0xb02b('0x7')](e,emitEvent(event));}}module[_0xb02b('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x50aa=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount'];(function(_0x334d52,_0x40d32b){var _0x32aacf=function(_0x2a904e){while(--_0x2a904e){_0x334d52['push'](_0x334d52['shift']());}};_0x32aacf(++_0x40d32b);}(_0x50aa,0xe7));var _0xa50a=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x50aa[_0x1ab180];return _0xfb2c2d;};'use strict';var EventEmitter=require(_0xa50a('0x0'));var SmsAccount=require(_0xa50a('0x1'))['db'][_0xa50a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa50a('0x3'),'afterUpdate':_0xa50a('0x4'),'afterDestroy':_0xa50a('0x5')};function emitEvent(_0x4b6149){return function(_0x37ffe5,_0x2c5b0c,_0x58465c){SmsAccountEvents[_0xa50a('0x6')](_0x4b6149+':'+_0x37ffe5['id'],_0x37ffe5);SmsAccountEvents['emit'](_0x4b6149,_0x37ffe5);_0x58465c(null);};}for(var e in events){if(events[_0xa50a('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xa50a('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 848c3f3..4e68a67 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 _0x6e74=['../../config/logger','path','rimraf','../../config/environment','exports','define','SmsAccount','lodash'];(function(_0x31b3ab,_0x3a9872){var _0x457aba=function(_0x2b02ca){while(--_0x2b02ca){_0x31b3ab['push'](_0x31b3ab['shift']());}};_0x457aba(++_0x3a9872);}(_0x6e74,0x1b7));var _0x46e7=function(_0x11b3bf,_0xca12c){_0x11b3bf=_0x11b3bf-0x0;var _0x2eeb8b=_0x6e74[_0x11b3bf];return _0x2eeb8b;};'use strict';var _=require(_0x46e7('0x0'));var util=require('util');var logger=require(_0x46e7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46e7('0x2'));var rimraf=require(_0x46e7('0x3'));var config=require(_0x46e7('0x4'));var attributes=require('./smsAccount.attributes');module[_0x46e7('0x5')]=function(_0xf02dfa,_0x32a9){return _0xf02dfa[_0x46e7('0x6')](_0x46e7('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7543=['../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f0531,_0x515d33){var _0x1b58fb=function(_0x3b6101){while(--_0x3b6101){_0x1f0531['push'](_0x1f0531['shift']());}};_0x1b58fb(++_0x515d33);}(_0x7543,0x1bc));var _0x3754=function(_0x28f4e2,_0x3f9280){_0x28f4e2=_0x28f4e2-0x0;var _0x3061fb=_0x7543[_0x28f4e2];return _0x3061fb;};'use strict';var _=require(_0x3754('0x0'));var util=require('util');var logger=require(_0x3754('0x1'))(_0x3754('0x2'));var moment=require(_0x3754('0x3'));var BPromise=require(_0x3754('0x4'));var rp=require(_0x3754('0x5'));var fs=require('fs');var path=require(_0x3754('0x6'));var rimraf=require('rimraf');var config=require(_0x3754('0x7'));var attributes=require(_0x3754('0x8'));module[_0x3754('0x9')]=function(_0xe6189c,_0x5cd731){return _0xe6189c['define'](_0x3754('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 8488f02..b9a05e3 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 _0x92e2=['options','raw','where','include','map','attributes','model','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount'];(function(_0x2ac7f2,_0x4b80a6){var _0x441784=function(_0x2e5345){while(--_0x2e5345){_0x2ac7f2['push'](_0x2ac7f2['shift']());}};_0x441784(++_0x4b80a6);}(_0x92e2,0x87));var _0x292e=function(_0x46874f,_0x2e4bb2){_0x46874f=_0x46874f-0x0;var _0x37436c=_0x92e2[_0x46874f];return _0x37436c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x292e('0x0'));var BPromise=require(_0x292e('0x1'));var rs=require(_0x292e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x292e('0x3'))['db'];var utils=require(_0x292e('0x4'));var logger=require(_0x292e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x292e('0x6')][_0x292e('0x7')]({'port':0x232a});config[_0x292e('0x8')]=_[_0x292e('0x9')](config[_0x292e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x292e('0xa'))(new Redis(config[_0x292e('0x8')]));require(_0x292e('0xb'))[_0x292e('0xc')](socket);function respondWithRpcPromise(_0x99d19b,_0x3e3baa,_0x21ddac){return new BPromise(function(_0x4ea10f,_0x246a1d){return client['request'](_0x99d19b,_0x21ddac)[_0x292e('0xd')](function(_0xcf0e1a){logger[_0x292e('0xe')](_0x292e('0xf'),_0x3e3baa,_0x292e('0x10'));logger['debug'](_0x292e('0x11'),_0x3e3baa,'request\x20sent',JSON[_0x292e('0x12')](_0xcf0e1a));if(_0xcf0e1a[_0x292e('0x13')]){if(_0xcf0e1a[_0x292e('0x13')][_0x292e('0x14')]===0x1f4){logger[_0x292e('0x13')](_0x292e('0xf'),_0x3e3baa,_0xcf0e1a['error'][_0x292e('0x15')]);return _0x246a1d(_0xcf0e1a[_0x292e('0x13')][_0x292e('0x15')]);}logger[_0x292e('0x13')](_0x292e('0xf'),_0x3e3baa,_0xcf0e1a['error'][_0x292e('0x15')]);return _0x4ea10f(_0xcf0e1a[_0x292e('0x13')][_0x292e('0x15')]);}else{logger[_0x292e('0xe')](_0x292e('0xf'),_0x3e3baa,_0x292e('0x10'));_0x4ea10f(_0xcf0e1a['result'][_0x292e('0x15')]);}})[_0x292e('0x16')](function(_0x160be2){logger[_0x292e('0x13')](_0x292e('0xf'),_0x3e3baa,_0x160be2);_0x246a1d(_0x160be2);});});}exports[_0x292e('0x17')]=function(_0xae317d){var _0x5ab4c8=this;return new Promise(function(_0x3bcb97,_0x4a411b){return db[_0x292e('0x18')]['find']({'raw':_0xae317d[_0x292e('0x19')]?_0xae317d[_0x292e('0x19')][_0x292e('0x1a')]===undefined?!![]:![]:!![],'where':_0xae317d['options']?_0xae317d['options'][_0x292e('0x1b')]||null:null,'attributes':_0xae317d[_0x292e('0x19')]?_0xae317d[_0x292e('0x19')]['attributes']||null:null,'include':_0xae317d[_0x292e('0x19')]?_0xae317d[_0x292e('0x19')][_0x292e('0x1c')]?_[_0x292e('0x1d')](_0xae317d['options'][_0x292e('0x1c')],function(_0xe2da54){return{'model':db[_0xe2da54['model']],'as':_0xe2da54['as'],'attributes':_0xe2da54[_0x292e('0x1e')],'include':_0xe2da54['include']?_[_0x292e('0x1d')](_0xe2da54[_0x292e('0x1c')],function(_0x1be78c){return{'model':db[_0x1be78c[_0x292e('0x1f')]],'as':_0x1be78c['as'],'attributes':_0x1be78c[_0x292e('0x1e')],'include':_0x1be78c['include']?_['map'](_0x1be78c[_0x292e('0x1c')],function(_0x470339){return{'model':db[_0x470339[_0x292e('0x1f')]],'as':_0x470339['as'],'attributes':_0x470339[_0x292e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x292e('0xd')](function(_0x21d810){logger[_0x292e('0xe')](_0x292e('0x17'),_0xae317d);logger['debug'](_0x292e('0x17'),_0xae317d,JSON[_0x292e('0x12')](_0x21d810));_0x3bcb97(_0x21d810);})[_0x292e('0x16')](function(_0x3c642b){logger[_0x292e('0x13')](_0x292e('0x17'),_0x3c642b['message'],_0xae317d);_0x4a411b(_0x5ab4c8[_0x292e('0x13')](0x1f4,_0x3c642b[_0x292e('0x15')]));});});}; \ No newline at end of file +var _0xcea3=['request','then','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','request\x20sent','result','SmsAccount','find','options','raw','include','attributes','map','model','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsAccount.socket','register'];(function(_0x17a558,_0xf2ca4b){var _0x27f950=function(_0x1012a8){while(--_0x1012a8){_0x17a558['push'](_0x17a558['shift']());}};_0x27f950(++_0xf2ca4b);}(_0xcea3,0x1d0));var _0x3cea=function(_0x5e035f,_0x3ad520){_0x5e035f=_0x5e035f-0x0;var _0x34c881=_0xcea3[_0x5e035f];return _0x34c881;};'use strict';var _=require(_0x3cea('0x0'));var util=require('util');var moment=require(_0x3cea('0x1'));var BPromise=require(_0x3cea('0x2'));var rs=require(_0x3cea('0x3'));var fs=require('fs');var Redis=require(_0x3cea('0x4'));var db=require(_0x3cea('0x5'))['db'];var utils=require(_0x3cea('0x6'));var logger=require(_0x3cea('0x7'))(_0x3cea('0x8'));var config=require(_0x3cea('0x9'));var jayson=require(_0x3cea('0xa'));var client=jayson[_0x3cea('0xb')][_0x3cea('0xc')]({'port':0x232a});config[_0x3cea('0xd')]=_['defaults'](config[_0x3cea('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3cea('0xe'))(new Redis(config[_0x3cea('0xd')]));require(_0x3cea('0xf'))[_0x3cea('0x10')](socket);function respondWithRpcPromise(_0x5c88a4,_0x404c70,_0x2d73f9){return new BPromise(function(_0x17dc36,_0x174ac1){return client[_0x3cea('0x11')](_0x5c88a4,_0x2d73f9)[_0x3cea('0x12')](function(_0x13e6d9){logger['info']('SmsAccount,\x20%s,\x20%s',_0x404c70,'request\x20sent');logger[_0x3cea('0x13')](_0x3cea('0x14'),_0x404c70,'request\x20sent',JSON['stringify'](_0x13e6d9));if(_0x13e6d9[_0x3cea('0x15')]){if(_0x13e6d9['error'][_0x3cea('0x16')]===0x1f4){logger[_0x3cea('0x15')]('SmsAccount,\x20%s,\x20%s',_0x404c70,_0x13e6d9[_0x3cea('0x15')]['message']);return _0x174ac1(_0x13e6d9[_0x3cea('0x15')][_0x3cea('0x17')]);}logger['error'](_0x3cea('0x18'),_0x404c70,_0x13e6d9['error']['message']);return _0x17dc36(_0x13e6d9[_0x3cea('0x15')][_0x3cea('0x17')]);}else{logger['info'](_0x3cea('0x18'),_0x404c70,_0x3cea('0x19'));_0x17dc36(_0x13e6d9[_0x3cea('0x1a')][_0x3cea('0x17')]);}})['catch'](function(_0x948da4){logger[_0x3cea('0x15')](_0x3cea('0x18'),_0x404c70,_0x948da4);_0x174ac1(_0x948da4);});});}exports['ShowSmsAccount']=function(_0x2a5614){var _0x2b3234=this;return new Promise(function(_0x1754e7,_0x324904){return db[_0x3cea('0x1b')][_0x3cea('0x1c')]({'raw':_0x2a5614[_0x3cea('0x1d')]?_0x2a5614[_0x3cea('0x1d')][_0x3cea('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a5614[_0x3cea('0x1d')]?_0x2a5614[_0x3cea('0x1d')]['where']||null:null,'attributes':_0x2a5614['options']?_0x2a5614[_0x3cea('0x1d')]['attributes']||null:null,'include':_0x2a5614[_0x3cea('0x1d')]?_0x2a5614[_0x3cea('0x1d')][_0x3cea('0x1f')]?_['map'](_0x2a5614[_0x3cea('0x1d')][_0x3cea('0x1f')],function(_0x1a08ff){return{'model':db[_0x1a08ff['model']],'as':_0x1a08ff['as'],'attributes':_0x1a08ff[_0x3cea('0x20')],'include':_0x1a08ff[_0x3cea('0x1f')]?_[_0x3cea('0x21')](_0x1a08ff['include'],function(_0x35037c){return{'model':db[_0x35037c[_0x3cea('0x22')]],'as':_0x35037c['as'],'attributes':_0x35037c[_0x3cea('0x20')],'include':_0x35037c[_0x3cea('0x1f')]?_[_0x3cea('0x21')](_0x35037c[_0x3cea('0x1f')],function(_0x577bc5){return{'model':db[_0x577bc5['model']],'as':_0x577bc5['as'],'attributes':_0x577bc5[_0x3cea('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f31e7){logger['info'](_0x3cea('0x23'),_0x2a5614);logger['debug'](_0x3cea('0x23'),_0x2a5614,JSON['stringify'](_0x5f31e7));_0x1754e7(_0x5f31e7);})[_0x3cea('0x24')](function(_0x3413ac){logger[_0x3cea('0x15')](_0x3cea('0x23'),_0x3413ac['message'],_0x2a5614);_0x324904(_0x2b3234[_0x3cea('0x15')](0x1f4,_0x3413ac['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 08d24af..30c8d1d 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 12918b5..f4fb41e 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x9db135,_0x5a12a0){var _0x5ec73d=function(_0x46efd5){while(--_0x46efd5){_0x9db135['push'](_0x9db135['shift']());}};_0x5ec73d(++_0x5a12a0);}(_0x7217,0x19e));var _0x7721=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7217[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 08095e8..1af2e15 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 _0x25f1=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x772dec,_0x2d583f){var _0x3001bf=function(_0x40e4ab){while(--_0x40e4ab){_0x772dec['push'](_0x772dec['shift']());}};_0x3001bf(++_0x2d583f);}(_0x25f1,0xa4));var _0x125f=function(_0x2713e0,_0x16fbf9){_0x2713e0=_0x2713e0-0x0;var _0x3ce6d7=_0x25f1[_0x2713e0];return _0x3ce6d7;};'use strict';var Sequelize=require(_0x125f('0x0'));module[_0x125f('0x1')]={'priority':{'type':Sequelize[_0x125f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x125f('0x3')},'appdata':{'type':Sequelize[_0x125f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x125f('0x5')],'defaultValue':_0x125f('0x6')}}; \ No newline at end of file +var _0x7575=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4700fa,_0x3b46ca){var _0x4926e4=function(_0x2c58be){while(--_0x2c58be){_0x4700fa['push'](_0x4700fa['shift']());}};_0x4926e4(++_0x3b46ca);}(_0x7575,0xb1));var _0x5757=function(_0x586d90,_0x3081aa){_0x586d90=_0x586d90-0x0;var _0x1a1703=_0x7575[_0x586d90];return _0x1a1703;};'use strict';var Sequelize=require(_0x5757('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5757('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5757('0x2')],'allowNull':![],'defaultValue':_0x5757('0x3')},'appdata':{'type':Sequelize[_0x5757('0x4')]()},'description':{'type':Sequelize[_0x5757('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5757('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ac61985..3a5fde8 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 _0xbcb8=['offset','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit'];(function(_0x1f0714,_0xde0530){var _0x33669d=function(_0x38cb83){while(--_0x38cb83){_0x1f0714['push'](_0x1f0714['shift']());}};_0x33669d(++_0xde0530);}(_0xbcb8,0xc6));var _0x8bcb=function(_0x5d3b00,_0xc62f64){_0x5d3b00=_0x5d3b00-0x0;var _0x24427e=_0xbcb8[_0x5d3b00];return _0x24427e;};'use strict';var emlformat=require(_0x8bcb('0x0'));var rimraf=require(_0x8bcb('0x1'));var zipdir=require(_0x8bcb('0x2'));var jsonpatch=require(_0x8bcb('0x3'));var rp=require(_0x8bcb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bcb('0x5'));var util=require(_0x8bcb('0x6'));var path=require('path');var sox=require(_0x8bcb('0x7'));var csv=require(_0x8bcb('0x8'));var ejs=require(_0x8bcb('0x9'));var fs=require('fs');var fs_extra=require(_0x8bcb('0xa'));var _=require('lodash');var squel=require(_0x8bcb('0xb'));var crypto=require(_0x8bcb('0xc'));var jsforce=require(_0x8bcb('0xd'));var deskjs=require(_0x8bcb('0xe'));var toCsv=require(_0x8bcb('0x8'));var querystring=require(_0x8bcb('0xf'));var Papa=require(_0x8bcb('0x10'));var Redis=require('ioredis');var authService=require(_0x8bcb('0x11'));var qs=require(_0x8bcb('0x12'));var as=require(_0x8bcb('0x13'));var hardwareService=require(_0x8bcb('0x14'));var logger=require(_0x8bcb('0x15'))(_0x8bcb('0x16'));var utils=require(_0x8bcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8bcb('0x18'));var db=require(_0x8bcb('0x19'))['db'];function respondWithStatusCode(_0x2bbd68,_0x1bbc44){_0x1bbc44=_0x1bbc44||0xcc;return function(_0x58f7e7){if(_0x58f7e7){return _0x2bbd68['sendStatus'](_0x1bbc44);}return _0x2bbd68[_0x8bcb('0x1a')](_0x1bbc44)['end']();};}function respondWithResult(_0x2efa0b,_0x1967c2){_0x1967c2=_0x1967c2||0xc8;return function(_0x3af097){if(_0x3af097){return _0x2efa0b[_0x8bcb('0x1a')](_0x1967c2)[_0x8bcb('0x1b')](_0x3af097);}};}function respondWithFilteredResult(_0x20f386,_0x2b470b){return function(_0x41f22d){if(_0x41f22d){var _0x446fc6=typeof _0x2b470b['offset']===_0x8bcb('0x1c')&&typeof _0x2b470b[_0x8bcb('0x1d')]==='undefined';var _0x17201f=_0x41f22d['count'];var _0x1259e4=_0x446fc6?0x0:_0x2b470b[_0x8bcb('0x1e')];var _0x23d7c0=_0x446fc6?_0x41f22d[_0x8bcb('0x1f')]:_0x2b470b[_0x8bcb('0x1e')]+_0x2b470b[_0x8bcb('0x1d')];var _0x36d788;if(_0x23d7c0>=_0x17201f){_0x23d7c0=_0x17201f;_0x36d788=0xc8;}else{_0x36d788=0xce;}_0x20f386[_0x8bcb('0x1a')](_0x36d788);return _0x20f386[_0x8bcb('0x20')](_0x8bcb('0x21'),_0x1259e4+'-'+_0x23d7c0+'/'+_0x17201f)[_0x8bcb('0x1b')](_0x41f22d);}return null;};}function patchUpdates(_0x214f0c){return function(_0x388cd7){try{jsonpatch[_0x8bcb('0x22')](_0x388cd7,_0x214f0c,!![]);}catch(_0x1bb1d0){return BPromise[_0x8bcb('0x23')](_0x1bb1d0);}return _0x388cd7[_0x8bcb('0x24')]();};}function saveUpdates(_0x3a13c0,_0x474131){return function(_0x199967){if(_0x199967){return _0x199967[_0x8bcb('0x25')](_0x3a13c0)['then'](function(_0x2bd6b6){return _0x2bd6b6;});}return null;};}function removeEntity(_0x25a96f,_0x507767){return function(_0x32d1fb){if(_0x32d1fb){return _0x32d1fb[_0x8bcb('0x26')]()[_0x8bcb('0x27')](function(){_0x25a96f[_0x8bcb('0x1a')](0xcc)[_0x8bcb('0x28')]();});}};}function handleEntityNotFound(_0x4503d2,_0x1500f6){return function(_0x518b22){if(!_0x518b22){_0x4503d2[_0x8bcb('0x29')](0x194);}return _0x518b22;};}function handleError(_0x5a8ca7,_0x530d96){_0x530d96=_0x530d96||0x1f4;return function(_0x1996e9){logger[_0x8bcb('0x2a')](_0x1996e9[_0x8bcb('0x2b')]);if(_0x1996e9[_0x8bcb('0x2c')]){delete _0x1996e9[_0x8bcb('0x2c')];}_0x5a8ca7[_0x8bcb('0x1a')](_0x530d96)[_0x8bcb('0x2d')](_0x1996e9);};}exports['index']=function(_0x2a6104,_0x483f34){var _0x2c1ee4={},_0x2994fa={},_0x4e7250={'count':0x0,'rows':[]};var _0x4b0605=_[_0x8bcb('0x2e')](db[_0x8bcb('0x2f')][_0x8bcb('0x30')],function(_0x5a6e85){return{'name':_0x5a6e85[_0x8bcb('0x31')],'type':_0x5a6e85[_0x8bcb('0x32')][_0x8bcb('0x33')]};});_0x2994fa[_0x8bcb('0x34')]=_[_0x8bcb('0x2e')](_0x4b0605,_0x8bcb('0x2c'));_0x2994fa[_0x8bcb('0x35')]=_[_0x8bcb('0x36')](_0x2a6104[_0x8bcb('0x35')]);_0x2994fa[_0x8bcb('0x37')]=_[_0x8bcb('0x38')](_0x2994fa[_0x8bcb('0x34')],_0x2994fa['query']);_0x2c1ee4[_0x8bcb('0x39')]=_['intersection'](_0x2994fa[_0x8bcb('0x34')],qs[_0x8bcb('0x3a')](_0x2a6104['query'][_0x8bcb('0x3a')]));_0x2c1ee4['attributes']=_0x2c1ee4[_0x8bcb('0x39')]['length']?_0x2c1ee4[_0x8bcb('0x39')]:_0x2994fa[_0x8bcb('0x34')];if(!_0x2a6104[_0x8bcb('0x35')][_0x8bcb('0x3b')]('nolimit')){_0x2c1ee4[_0x8bcb('0x1d')]=qs[_0x8bcb('0x1d')](_0x2a6104[_0x8bcb('0x35')][_0x8bcb('0x1d')]);_0x2c1ee4['offset']=qs[_0x8bcb('0x1e')](_0x2a6104[_0x8bcb('0x35')][_0x8bcb('0x1e')]);}_0x2c1ee4['order']=qs['sort'](_0x2a6104['query'][_0x8bcb('0x3c')]);_0x2c1ee4['where']=qs[_0x8bcb('0x37')](_['pick'](_0x2a6104[_0x8bcb('0x35')],_0x2994fa[_0x8bcb('0x37')]),_0x4b0605);if(_0x2a6104['query']['filter']){_0x2c1ee4[_0x8bcb('0x3d')]=_[_0x8bcb('0x3e')](_0x2c1ee4['where'],{'$or':_['map'](_0x4b0605,function(_0x219501){if(_0x219501[_0x8bcb('0x32')]!==_0x8bcb('0x3f')){var _0x11a6fb={};_0x11a6fb[_0x219501[_0x8bcb('0x2c')]]={'$like':'%'+_0x2a6104['query'][_0x8bcb('0x40')]+'%'};return _0x11a6fb;}})});}_0x2c1ee4=_['merge']({},_0x2c1ee4,_0x2a6104[_0x8bcb('0x41')]);var _0x1eea8d={'where':_0x2c1ee4[_0x8bcb('0x3d')]};return db['SmsApplication'][_0x8bcb('0x1f')](_0x1eea8d)['then'](function(_0x3a7490){_0x4e7250[_0x8bcb('0x1f')]=_0x3a7490;if(_0x2a6104[_0x8bcb('0x35')][_0x8bcb('0x42')]){_0x2c1ee4[_0x8bcb('0x43')]=[{'all':!![]}];}return db[_0x8bcb('0x2f')]['findAll'](_0x2c1ee4);})['then'](function(_0x55649d){_0x4e7250[_0x8bcb('0x44')]=_0x55649d;return _0x4e7250;})[_0x8bcb('0x27')](respondWithFilteredResult(_0x483f34,_0x2c1ee4))[_0x8bcb('0x45')](handleError(_0x483f34,null));};exports[_0x8bcb('0x46')]=function(_0xc882d6,_0x51309a){var _0xd6afb1={'raw':!![],'where':{'id':_0xc882d6[_0x8bcb('0x47')]['id']}},_0x68992e={};_0x68992e[_0x8bcb('0x34')]=_['keys'](db[_0x8bcb('0x2f')][_0x8bcb('0x30')]);_0x68992e[_0x8bcb('0x35')]=_[_0x8bcb('0x36')](_0xc882d6[_0x8bcb('0x35')]);_0x68992e['filters']=_[_0x8bcb('0x38')](_0x68992e[_0x8bcb('0x34')],_0x68992e['query']);_0xd6afb1['attributes']=_['intersection'](_0x68992e[_0x8bcb('0x34')],qs[_0x8bcb('0x3a')](_0xc882d6[_0x8bcb('0x35')][_0x8bcb('0x3a')]));_0xd6afb1[_0x8bcb('0x39')]=_0xd6afb1['attributes'][_0x8bcb('0x48')]?_0xd6afb1[_0x8bcb('0x39')]:_0x68992e[_0x8bcb('0x34')];if(_0xc882d6['query'][_0x8bcb('0x42')]){_0xd6afb1['include']=[{'all':!![]}];}_0xd6afb1=_[_0x8bcb('0x3e')]({},_0xd6afb1,_0xc882d6[_0x8bcb('0x41')]);return db['SmsApplication'][_0x8bcb('0x49')](_0xd6afb1)[_0x8bcb('0x27')](handleEntityNotFound(_0x51309a,null))['then'](respondWithResult(_0x51309a,null))[_0x8bcb('0x45')](handleError(_0x51309a,null));};exports['create']=function(_0x4f91f4,_0x4c722f){return db[_0x8bcb('0x2f')][_0x8bcb('0x4a')](_0x4f91f4[_0x8bcb('0x4b')],{})[_0x8bcb('0x27')](respondWithResult(_0x4c722f,0xc9))[_0x8bcb('0x45')](handleError(_0x4c722f,null));};exports[_0x8bcb('0x25')]=function(_0xbad065,_0x3e5c71){if(_0xbad065[_0x8bcb('0x4b')]['id']){delete _0xbad065[_0x8bcb('0x4b')]['id'];}return db[_0x8bcb('0x2f')]['find']({'where':{'id':_0xbad065[_0x8bcb('0x47')]['id']}})[_0x8bcb('0x27')](handleEntityNotFound(_0x3e5c71,null))['then'](saveUpdates(_0xbad065[_0x8bcb('0x4b')],null))[_0x8bcb('0x27')](respondWithResult(_0x3e5c71,null))[_0x8bcb('0x45')](handleError(_0x3e5c71,null));};exports[_0x8bcb('0x26')]=function(_0x54ba76,_0x49edd5){return db['SmsApplication'][_0x8bcb('0x49')]({'where':{'id':_0x54ba76[_0x8bcb('0x47')]['id']}})[_0x8bcb('0x27')](handleEntityNotFound(_0x49edd5,null))['then'](removeEntity(_0x49edd5,null))['catch'](handleError(_0x49edd5,null));}; \ No newline at end of file +var _0x77b6=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2a23ae,_0x39b344){var _0x565d60=function(_0x196812){while(--_0x196812){_0x2a23ae['push'](_0x2a23ae['shift']());}};_0x565d60(++_0x39b344);}(_0x77b6,0x121));var _0x677b=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x77b6[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require(_0x677b('0x0'));var rimraf=require(_0x677b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x677b('0x2'));var rp=require(_0x677b('0x3'));var moment=require(_0x677b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x677b('0x5'));var util=require(_0x677b('0x6'));var path=require(_0x677b('0x7'));var sox=require('sox');var csv=require(_0x677b('0x8'));var ejs=require(_0x677b('0x9'));var fs=require('fs');var fs_extra=require(_0x677b('0xa'));var _=require(_0x677b('0xb'));var squel=require(_0x677b('0xc'));var crypto=require(_0x677b('0xd'));var jsforce=require(_0x677b('0xe'));var deskjs=require(_0x677b('0xf'));var toCsv=require(_0x677b('0x8'));var querystring=require(_0x677b('0x10'));var Papa=require('papaparse');var Redis=require(_0x677b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x677b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x677b('0x13'))(_0x677b('0x14'));var utils=require(_0x677b('0x15'));var config=require(_0x677b('0x16'));var licenseUtil=require(_0x677b('0x17'));var db=require(_0x677b('0x18'))['db'];function respondWithStatusCode(_0x42646a,_0x30366e){_0x30366e=_0x30366e||0xcc;return function(_0x504191){if(_0x504191){return _0x42646a[_0x677b('0x19')](_0x30366e);}return _0x42646a[_0x677b('0x1a')](_0x30366e)[_0x677b('0x1b')]();};}function respondWithResult(_0x37e414,_0x1f2e5c){_0x1f2e5c=_0x1f2e5c||0xc8;return function(_0xcb58fd){if(_0xcb58fd){return _0x37e414[_0x677b('0x1a')](_0x1f2e5c)['json'](_0xcb58fd);}};}function respondWithFilteredResult(_0x4d9ffb,_0x363ff0){return function(_0x4bc305){if(_0x4bc305){var _0x19e394=typeof _0x363ff0[_0x677b('0x1c')]===_0x677b('0x1d')&&typeof _0x363ff0[_0x677b('0x1e')]==='undefined';var _0x1b285d=_0x4bc305[_0x677b('0x1f')];var _0x305148=_0x19e394?0x0:_0x363ff0[_0x677b('0x1c')];var _0x4e8770=_0x19e394?_0x4bc305[_0x677b('0x1f')]:_0x363ff0[_0x677b('0x1c')]+_0x363ff0[_0x677b('0x1e')];var _0x12bade;if(_0x4e8770>=_0x1b285d){_0x4e8770=_0x1b285d;_0x12bade=0xc8;}else{_0x12bade=0xce;}_0x4d9ffb['status'](_0x12bade);return _0x4d9ffb[_0x677b('0x20')](_0x677b('0x21'),_0x305148+'-'+_0x4e8770+'/'+_0x1b285d)[_0x677b('0x22')](_0x4bc305);}return null;};}function patchUpdates(_0x36c5b8){return function(_0x345d28){try{jsonpatch[_0x677b('0x23')](_0x345d28,_0x36c5b8,!![]);}catch(_0x170870){return BPromise['reject'](_0x170870);}return _0x345d28[_0x677b('0x24')]();};}function saveUpdates(_0x39c4a7,_0x207b0a){return function(_0x32645f){if(_0x32645f){return _0x32645f[_0x677b('0x25')](_0x39c4a7)['then'](function(_0x1cf6ec){return _0x1cf6ec;});}return null;};}function removeEntity(_0x70c3b,_0x53c668){return function(_0x97afc7){if(_0x97afc7){return _0x97afc7[_0x677b('0x26')]()[_0x677b('0x27')](function(){_0x70c3b[_0x677b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34fcae,_0x24678a){return function(_0x5f562d){if(!_0x5f562d){_0x34fcae[_0x677b('0x19')](0x194);}return _0x5f562d;};}function handleError(_0x513de9,_0x8359b0){_0x8359b0=_0x8359b0||0x1f4;return function(_0x4e74cc){logger[_0x677b('0x28')](_0x4e74cc[_0x677b('0x29')]);if(_0x4e74cc[_0x677b('0x2a')]){delete _0x4e74cc[_0x677b('0x2a')];}_0x513de9[_0x677b('0x1a')](_0x8359b0)[_0x677b('0x2b')](_0x4e74cc);};}exports[_0x677b('0x2c')]=function(_0x54a4b1,_0x465c74){var _0x221554={},_0x59bd73={},_0x46414d={'count':0x0,'rows':[]};var _0x3dc448=_[_0x677b('0x2d')](db[_0x677b('0x2e')][_0x677b('0x2f')],function(_0x4aa391){return{'name':_0x4aa391[_0x677b('0x30')],'type':_0x4aa391[_0x677b('0x31')][_0x677b('0x32')]};});_0x59bd73[_0x677b('0x33')]=_[_0x677b('0x2d')](_0x3dc448,_0x677b('0x2a'));_0x59bd73['query']=_[_0x677b('0x34')](_0x54a4b1[_0x677b('0x35')]);_0x59bd73[_0x677b('0x36')]=_[_0x677b('0x37')](_0x59bd73[_0x677b('0x33')],_0x59bd73[_0x677b('0x35')]);_0x221554[_0x677b('0x38')]=_[_0x677b('0x37')](_0x59bd73[_0x677b('0x33')],qs[_0x677b('0x39')](_0x54a4b1['query'][_0x677b('0x39')]));_0x221554['attributes']=_0x221554[_0x677b('0x38')][_0x677b('0x3a')]?_0x221554['attributes']:_0x59bd73[_0x677b('0x33')];if(!_0x54a4b1[_0x677b('0x35')][_0x677b('0x3b')](_0x677b('0x3c'))){_0x221554[_0x677b('0x1e')]=qs[_0x677b('0x1e')](_0x54a4b1[_0x677b('0x35')]['limit']);_0x221554['offset']=qs[_0x677b('0x1c')](_0x54a4b1[_0x677b('0x35')]['offset']);}_0x221554[_0x677b('0x3d')]=qs[_0x677b('0x3e')](_0x54a4b1[_0x677b('0x35')][_0x677b('0x3e')]);_0x221554[_0x677b('0x3f')]=qs[_0x677b('0x36')](_[_0x677b('0x40')](_0x54a4b1[_0x677b('0x35')],_0x59bd73[_0x677b('0x36')]),_0x3dc448);if(_0x54a4b1[_0x677b('0x35')][_0x677b('0x41')]){_0x221554[_0x677b('0x3f')]=_[_0x677b('0x42')](_0x221554[_0x677b('0x3f')],{'$or':_[_0x677b('0x2d')](_0x3dc448,function(_0xc971ed){if(_0xc971ed[_0x677b('0x31')]!==_0x677b('0x43')){var _0x171e60={};_0x171e60[_0xc971ed[_0x677b('0x2a')]]={'$like':'%'+_0x54a4b1[_0x677b('0x35')][_0x677b('0x41')]+'%'};return _0x171e60;}})});}_0x221554=_[_0x677b('0x42')]({},_0x221554,_0x54a4b1[_0x677b('0x44')]);var _0xb4faad={'where':_0x221554[_0x677b('0x3f')]};return db[_0x677b('0x2e')][_0x677b('0x1f')](_0xb4faad)['then'](function(_0x2c1298){_0x46414d['count']=_0x2c1298;if(_0x54a4b1['query'][_0x677b('0x45')]){_0x221554[_0x677b('0x46')]=[{'all':!![]}];}return db['SmsApplication'][_0x677b('0x47')](_0x221554);})['then'](function(_0xd9ae94){_0x46414d[_0x677b('0x48')]=_0xd9ae94;return _0x46414d;})[_0x677b('0x27')](respondWithFilteredResult(_0x465c74,_0x221554))['catch'](handleError(_0x465c74,null));};exports['show']=function(_0x31d0be,_0x2143a4){var _0x26f0a1={'raw':!![],'where':{'id':_0x31d0be[_0x677b('0x49')]['id']}},_0x4db7ec={};_0x4db7ec['model']=_[_0x677b('0x34')](db[_0x677b('0x2e')][_0x677b('0x2f')]);_0x4db7ec['query']=_['keys'](_0x31d0be[_0x677b('0x35')]);_0x4db7ec[_0x677b('0x36')]=_['intersection'](_0x4db7ec['model'],_0x4db7ec[_0x677b('0x35')]);_0x26f0a1['attributes']=_['intersection'](_0x4db7ec[_0x677b('0x33')],qs[_0x677b('0x39')](_0x31d0be[_0x677b('0x35')][_0x677b('0x39')]));_0x26f0a1['attributes']=_0x26f0a1[_0x677b('0x38')][_0x677b('0x3a')]?_0x26f0a1[_0x677b('0x38')]:_0x4db7ec['model'];if(_0x31d0be[_0x677b('0x35')][_0x677b('0x45')]){_0x26f0a1[_0x677b('0x46')]=[{'all':!![]}];}_0x26f0a1=_['merge']({},_0x26f0a1,_0x31d0be[_0x677b('0x44')]);return db[_0x677b('0x2e')][_0x677b('0x4a')](_0x26f0a1)['then'](handleEntityNotFound(_0x2143a4,null))[_0x677b('0x27')](respondWithResult(_0x2143a4,null))[_0x677b('0x4b')](handleError(_0x2143a4,null));};exports[_0x677b('0x4c')]=function(_0x29a9e2,_0x5b4904){return db[_0x677b('0x2e')][_0x677b('0x4c')](_0x29a9e2[_0x677b('0x4d')],{})[_0x677b('0x27')](respondWithResult(_0x5b4904,0xc9))['catch'](handleError(_0x5b4904,null));};exports['update']=function(_0x6fd366,_0x23aaf0){if(_0x6fd366['body']['id']){delete _0x6fd366[_0x677b('0x4d')]['id'];}return db[_0x677b('0x2e')][_0x677b('0x4a')]({'where':{'id':_0x6fd366['params']['id']}})[_0x677b('0x27')](handleEntityNotFound(_0x23aaf0,null))[_0x677b('0x27')](saveUpdates(_0x6fd366[_0x677b('0x4d')],null))[_0x677b('0x27')](respondWithResult(_0x23aaf0,null))['catch'](handleError(_0x23aaf0,null));};exports[_0x677b('0x26')]=function(_0x3d7984,_0x9d549d){return db[_0x677b('0x2e')][_0x677b('0x4a')]({'where':{'id':_0x3d7984['params']['id']}})[_0x677b('0x27')](handleEntityNotFound(_0x9d549d,null))['then'](removeEntity(_0x9d549d,null))[_0x677b('0x4b')](handleError(_0x9d549d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index db31be8..a8c5c4e 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 _0x36e2=['exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1b046f,_0x8e5fa6){var _0x1f6c8f=function(_0x4a2f64){while(--_0x4a2f64){_0x1b046f['push'](_0x1b046f['shift']());}};_0x1f6c8f(++_0x8e5fa6);}(_0x36e2,0x64));var _0x236e=function(_0xc6136c,_0x2113b8){_0xc6136c=_0xc6136c-0x0;var _0x210956=_0x36e2[_0xc6136c];return _0x210956;};'use strict';var _=require('lodash');var util=require(_0x236e('0x0'));var logger=require(_0x236e('0x1'))(_0x236e('0x2'));var moment=require(_0x236e('0x3'));var BPromise=require(_0x236e('0x4'));var rp=require(_0x236e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x236e('0x6'));var config=require(_0x236e('0x7'));var attributes=require('./smsApplication.attributes');module[_0x236e('0x8')]=function(_0x4a328f,_0x39cbe6){return _0x4a328f['define']('SmsApplication',attributes,{'tableName':_0x236e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x236e('0xa'),'collate':_0x236e('0xb')});}; \ No newline at end of file +var _0xc7a3=['moment','bluebird','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5c7770,_0x4e1863){var _0x4c7195=function(_0x1907f4){while(--_0x1907f4){_0x5c7770['push'](_0x5c7770['shift']());}};_0x4c7195(++_0x4e1863);}(_0xc7a3,0x182));var _0x3c7a=function(_0x2178ec,_0x1f4c66){_0x2178ec=_0x2178ec-0x0;var _0x117c34=_0xc7a3[_0x2178ec];return _0x117c34;};'use strict';var _=require(_0x3c7a('0x0'));var util=require(_0x3c7a('0x1'));var logger=require(_0x3c7a('0x2'))(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var BPromise=require(_0x3c7a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var attributes=require('./smsApplication.attributes');module[_0x3c7a('0x8')]=function(_0x4d7b60,_0x1f2567){return _0x4d7b60[_0x3c7a('0x9')](_0x3c7a('0xa'),attributes,{'tableName':_0x3c7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3c7a('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index bdb8b3f..ab1b671 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 _0xd5a2=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x3d3c7f,_0x1c76ba){var _0x455722=function(_0x4f5ca8){while(--_0x4f5ca8){_0x3d3c7f['push'](_0x3d3c7f['shift']());}};_0x455722(++_0x1c76ba);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x3f84ce,_0x48b0af){_0x3f84ce=_0x3f84ce-0x0;var _0x5a1676=_0xd5a2[_0x3f84ce];return _0x5a1676;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});} \ No newline at end of file +var _0x9b09=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1b4f25,_0x387b6c){var _0x3491f2=function(_0xbc1629){while(--_0xbc1629){_0x1b4f25['push'](_0x1b4f25['shift']());}};_0x3491f2(++_0x387b6c);}(_0x9b09,0x1ad));var _0x99b0=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x9b09[_0x120123];return _0x3bec4c;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var moment=require('moment');var BPromise=require(_0x99b0('0x2'));var rs=require(_0x99b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99b0('0x5'))('rpc');var config=require(_0x99b0('0x6'));var jayson=require(_0x99b0('0x7'));var client=jayson['client'][_0x99b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x220c95,_0x5cfd09,_0x278d98){return new BPromise(function(_0x22d09a,_0x226a32){return client[_0x99b0('0x9')](_0x220c95,_0x278d98)[_0x99b0('0xa')](function(_0x4affe4){logger[_0x99b0('0xb')](_0x99b0('0xc'),_0x5cfd09,_0x99b0('0xd'));logger[_0x99b0('0xe')](_0x99b0('0xf'),_0x5cfd09,'request\x20sent',JSON[_0x99b0('0x10')](_0x4affe4));if(_0x4affe4[_0x99b0('0x11')]){if(_0x4affe4[_0x99b0('0x11')][_0x99b0('0x12')]===0x1f4){logger[_0x99b0('0x11')](_0x99b0('0xc'),_0x5cfd09,_0x4affe4['error'][_0x99b0('0x13')]);return _0x226a32(_0x4affe4['error'][_0x99b0('0x13')]);}logger[_0x99b0('0x11')]('SmsApplication,\x20%s,\x20%s',_0x5cfd09,_0x4affe4['error'][_0x99b0('0x13')]);return _0x22d09a(_0x4affe4[_0x99b0('0x11')][_0x99b0('0x13')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x5cfd09,'request\x20sent');_0x22d09a(_0x4affe4[_0x99b0('0x14')][_0x99b0('0x13')]);}})['catch'](function(_0x250e22){logger[_0x99b0('0x11')](_0x99b0('0xc'),_0x5cfd09,_0x250e22);_0x226a32(_0x250e22);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3df6d09..09e3178 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 _0x1eba=['put','/:id','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x1eba[_0xfb0cfd];return _0x2fd8aa;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0x9')]('/:id',auth[_0xa1eb('0xa')](),controller['show']);router[_0xa1eb('0x9')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['getMessages']);router[_0xa1eb('0x9')]('/:id/download',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xe')]);router[_0xa1eb('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router[_0xa1eb('0xf')]('/:id/messages',auth[_0xa1eb('0xa')](),controller['addMessage']);router['post'](_0xa1eb('0x11'),auth['isAuthenticated'](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),_0xa1eb('0x14')),controller[_0xa1eb('0x15')]);router[_0xa1eb('0x16')](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:update'),controller[_0xa1eb('0x18')]);router['delete'](_0xa1eb('0x17'),auth[_0xa1eb('0xa')](),interaction[_0xa1eb('0x12')](_0xa1eb('0x13'),'smsinteraction:destroy'),controller[_0xa1eb('0x19')]);router[_0xa1eb('0x1a')](_0xa1eb('0x11'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0x1b')]);module[_0xa1eb('0x1c')]=router; \ No newline at end of file +var _0x4cf8=['/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','describe'];(function(_0x464e01,_0xdc78ea){var _0x28d792=function(_0x177be6){while(--_0x177be6){_0x464e01['push'](_0x464e01['shift']());}};_0x28d792(++_0xdc78ea);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x4cf8[_0x401676];return _0x4f13fe;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/describe',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['show']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['get'](_0x84cf('0x11'),auth[_0x84cf('0xc')](),controller['download']);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x14')]);router[_0x84cf('0x13')](_0x84cf('0x15'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x18')),controller[_0x84cf('0x19')]);router[_0x84cf('0x1a')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1b')),controller['update']);router[_0x84cf('0x1c')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1d')),controller[_0x84cf('0x1e')]);router['delete']('/:id/tags',auth[_0x84cf('0xc')](),controller[_0x84cf('0x1f')]);module[_0x84cf('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8436c1e..02dbe5e 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 _0xa49b=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','moment','exports'];(function(_0x5cd1c8,_0xef075f){var _0x948379=function(_0x402136){while(--_0x402136){_0x5cd1c8['push'](_0x5cd1c8['shift']());}};_0x948379(++_0xef075f);}(_0xa49b,0x126));var _0xba49=function(_0x3b3a8e,_0x2549bd){_0x3b3a8e=_0x3b3a8e-0x0;var _0xbf80d2=_0xa49b[_0x3b3a8e];return _0xbf80d2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xba49('0x0'));module[_0xba49('0x1')]={'closed':{'type':Sequelize[_0xba49('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xba49('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xba49('0x4')]},'thirdDisposition':{'type':Sequelize[_0xba49('0x4')]},'note':{'type':Sequelize[_0xba49('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xba49('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xba49('0x5')]('in',_0xba49('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xba49('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xba49('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xba49('0x7')]}}; \ No newline at end of file +var _0x40ac=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x550651,_0x32926b){var _0x53edcf=function(_0x1ebc42){while(--_0x1ebc42){_0x550651['push'](_0x550651['shift']());}};_0x53edcf(++_0x32926b);}(_0x40ac,0x1de));var _0xc40a=function(_0x11ba32,_0x5a7ba6){_0x11ba32=_0x11ba32-0x0;var _0x296558=_0x40ac[_0x11ba32];return _0x296558;};'use strict';var Sequelize=require(_0xc40a('0x0'));var moment=require('moment');module[_0xc40a('0x1')]={'closed':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc40a('0x3')]},'disposition':{'type':Sequelize[_0xc40a('0x4')]},'secondDisposition':{'type':Sequelize[_0xc40a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc40a('0x4')]},'note':{'type':Sequelize[_0xc40a('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc40a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc40a('0x5')]('in',_0xc40a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc40a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc40a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 2c4900d..df33217 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 _0x7850=['unlinkSync','rimraf','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','then','destroy','send','index','SmsInteraction','findAll','sms','query','user','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','includeAll','include','merge','options','find','create','body','update','describe','addMessage','ids','getMessages','findOne','length','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','rows','addTags','setTags','omit','spread','Tag','name','emit','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','CmContact','Contact','lastName','Messages','createdAt','direction','secret','read','push','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','map','firstName','out','value','renderFile','views','transcript-','createPdfFromHTML','err'];(function(_0x49bb70,_0x81f90e){var _0x3b0d52=function(_0x3b5ddc){while(--_0x3b5ddc){_0x49bb70['push'](_0x49bb70['shift']());}};_0x3b0d52(++_0x81f90e);}(_0x7850,0x1e1));var _0x0785=function(_0x147a04,_0x173f22){_0x147a04=_0x147a04-0x0;var _0x18fff2=_0x7850[_0x147a04];return _0x18fff2;};'use strict';var rimraf=require(_0x0785('0x0'));var zipdir=require(_0x0785('0x1'));var moment=require(_0x0785('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x0785('0x3'));var ejs=require(_0x0785('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0785('0x5'));var interaction=require(_0x0785('0x6'));var qs=require(_0x0785('0x7'));var pdf=require(_0x0785('0x8'));var logger=require(_0x0785('0x9'))(_0x0785('0xa'));var config=require(_0x0785('0xb'));var db=require(_0x0785('0xc'))['db'];config[_0x0785('0xd')]=_[_0x0785('0xe')](config[_0x0785('0xd')],{'host':_0x0785('0xf'),'port':0x18eb});var socket=require(_0x0785('0x10'))(new Redis(config[_0x0785('0xd')]));require(_0x0785('0x11'))[_0x0785('0x12')](socket);function respondWithStatusCode(_0x30185d,_0x23a54b){_0x23a54b=_0x23a54b||0xcc;return function(_0x5b2056){if(_0x5b2056){return _0x30185d[_0x0785('0x13')](_0x23a54b);}return _0x30185d[_0x0785('0x14')](_0x23a54b)[_0x0785('0x15')]();};}function respondWithResult(_0x385e13,_0x23311a){_0x23311a=_0x23311a||0xc8;return function(_0x2c5e8c){if(_0x2c5e8c){return _0x385e13[_0x0785('0x14')](_0x23311a)['json'](_0x2c5e8c);}};}function respondWithFilteredResult(_0x5c72d2,_0x2e9da6){return function(_0xc9179f){if(_0xc9179f){var _0x589362=typeof _0x2e9da6['offset']===_0x0785('0x16')&&typeof _0x2e9da6[_0x0785('0x17')]===_0x0785('0x16');var _0x4c76f7=_0xc9179f[_0x0785('0x18')];var _0x53ea15=_0x589362?0x0:_0x2e9da6[_0x0785('0x19')];var _0x341ece=_0x589362?_0xc9179f[_0x0785('0x18')]:_0x2e9da6['offset']+_0x2e9da6[_0x0785('0x17')];var _0x370de8;if(_0x341ece>=_0x4c76f7){_0x341ece=_0x4c76f7;_0x370de8=0xc8;}else{_0x370de8=0xce;}_0x5c72d2[_0x0785('0x14')](_0x370de8);return _0x5c72d2[_0x0785('0x1a')](_0x0785('0x1b'),_0x53ea15+'-'+_0x341ece+'/'+_0x4c76f7)[_0x0785('0x1c')](_0xc9179f);}return null;};}function saveUpdates(_0x45c69f){return function(_0x36bed2){if(_0x36bed2){return _0x36bed2['update'](_0x45c69f)[_0x0785('0x1d')](function(_0x4cfda9){return _0x4cfda9;});}return null;};}function removeEntity(_0x197746){return function(_0xc842e7){if(_0xc842e7){return _0xc842e7[_0x0785('0x1e')]()[_0x0785('0x1d')](function(){_0x197746[_0x0785('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4901b4){return function(_0x1d8c55){if(!_0x1d8c55){_0x4901b4[_0x0785('0x13')](0x194);}return _0x1d8c55;};}function handleError(_0x1d25aa,_0x3ab8f4){_0x3ab8f4=_0x3ab8f4||0x1f4;return function(_0x2059e5){logger['error'](_0x2059e5['stack']);if(_0x2059e5['name']){delete _0x2059e5['name'];}_0x1d25aa['status'](_0x3ab8f4)[_0x0785('0x1f')](_0x2059e5);};}exports[_0x0785('0x20')]=function(_0x320a6a,_0xec1096){var _0x7e5926={};var _0x1baeee=_['map'](db[_0x0785('0x21')]['rawAttributes'],function(_0x2312f8){return{'name':_0x2312f8['fieldName'],'type':_0x2312f8['type']['key']};});_0x7e5926=qs['getOptions'](_0x1baeee,_0x320a6a);return interaction[_0x0785('0x22')](_0x0785('0x23'),_0x320a6a[_0x0785('0x24')],_0x320a6a[_0x0785('0x25')],_0x7e5926,_0x1baeee)[_0x0785('0x1d')](respondWithFilteredResult(_0xec1096,_0x7e5926))[_0x0785('0x26')](handleError(_0xec1096,null));};exports['show']=function(_0x323f62,_0x13b522){var _0xaae7bc={'raw':![],'where':{'id':_0x323f62[_0x0785('0x27')]['id']}},_0x7001c0={};_0x7001c0[_0x0785('0x28')]=_[_0x0785('0x29')](db['SmsInteraction'][_0x0785('0x2a')]);_0x7001c0[_0x0785('0x24')]=_[_0x0785('0x29')](_0x323f62[_0x0785('0x24')]);_0x7001c0[_0x0785('0x2b')]=_['intersection'](_0x7001c0[_0x0785('0x28')],_0x7001c0['query']);_0xaae7bc[_0x0785('0x2c')]=_[_0x0785('0x2d')](_0x7001c0[_0x0785('0x28')],qs[_0x0785('0x2e')](_0x323f62[_0x0785('0x24')][_0x0785('0x2e')]));_0xaae7bc[_0x0785('0x2c')]=_0xaae7bc[_0x0785('0x2c')]['length']?_0xaae7bc[_0x0785('0x2c')]:_0x7001c0[_0x0785('0x28')];if(_0x323f62[_0x0785('0x24')][_0x0785('0x2f')]){_0xaae7bc[_0x0785('0x30')]=[{'all':!![]}];}_0xaae7bc=_[_0x0785('0x31')]({},_0xaae7bc,_0x323f62[_0x0785('0x32')]);return db[_0x0785('0x21')][_0x0785('0x33')](_0xaae7bc)[_0x0785('0x1d')](handleEntityNotFound(_0x13b522,null))[_0x0785('0x1d')](respondWithResult(_0x13b522,null))[_0x0785('0x26')](handleError(_0x13b522,null));};exports[_0x0785('0x34')]=function(_0x46fe10,_0x5bf37a){return db['SmsInteraction'][_0x0785('0x34')](_0x46fe10[_0x0785('0x35')],{})[_0x0785('0x1d')](respondWithResult(_0x5bf37a,0xc9))[_0x0785('0x26')](handleError(_0x5bf37a,null));};exports[_0x0785('0x36')]=function(_0x592842,_0x262ca4){if(_0x592842[_0x0785('0x35')]['id']){delete _0x592842[_0x0785('0x35')]['id'];}return db[_0x0785('0x21')]['find']({'where':{'id':_0x592842[_0x0785('0x27')]['id']}})[_0x0785('0x1d')](handleEntityNotFound(_0x262ca4,null))['then'](saveUpdates(_0x592842['body'],null))[_0x0785('0x1d')](respondWithResult(_0x262ca4,null))['catch'](handleError(_0x262ca4,null));};exports[_0x0785('0x1e')]=function(_0x318675,_0x1e9eb6){return db['SmsInteraction'][_0x0785('0x33')]({'where':{'id':_0x318675[_0x0785('0x27')]['id']}})[_0x0785('0x1d')](handleEntityNotFound(_0x1e9eb6,null))[_0x0785('0x1d')](removeEntity(_0x1e9eb6,null))['catch'](handleError(_0x1e9eb6,null));};exports[_0x0785('0x37')]=function(_0x1c8f35,_0x1027dc){return db[_0x0785('0x21')]['describe']()[_0x0785('0x1d')](respondWithResult(_0x1027dc,null))['catch'](handleError(_0x1027dc,null));};exports['addMessage']=function(_0x32dde8,_0xeb2f5f){return db['SmsMessage'][_0x0785('0x33')]({'where':{'id':_0x32dde8[_0x0785('0x27')]['id']}})[_0x0785('0x1d')](handleEntityNotFound(_0xeb2f5f,null))[_0x0785('0x1d')](function(_0x551ee5){if(_0x551ee5){return _0x551ee5[_0x0785('0x38')](_0x32dde8[_0x0785('0x35')][_0x0785('0x39')],_['omit'](_0x32dde8[_0x0785('0x35')],[_0x0785('0x39'),'id'])||{});}})[_0x0785('0x1d')](respondWithResult(_0xeb2f5f,null))[_0x0785('0x26')](handleError(_0xeb2f5f,null));};exports[_0x0785('0x3a')]=function(_0x19fff9,_0x452f36){var _0x133124={'raw':![],'where':{}};var _0x7c083f={};var _0x32e61c={'count':0x0,'rows':[]};return db[_0x0785('0x21')][_0x0785('0x3b')]({'where':{'id':_0x19fff9[_0x0785('0x27')]['id']}})[_0x0785('0x1d')](handleEntityNotFound(_0x452f36,null))[_0x0785('0x1d')](function(_0xbd81ed){if(_0xbd81ed){_0x7c083f[_0x0785('0x28')]=_[_0x0785('0x29')](db['SmsMessage'][_0x0785('0x2a')]);_0x7c083f[_0x0785('0x24')]=_[_0x0785('0x29')](_0x19fff9['query']);_0x7c083f[_0x0785('0x2b')]=_[_0x0785('0x2d')](_0x7c083f[_0x0785('0x28')],_0x7c083f[_0x0785('0x24')]);_0x133124[_0x0785('0x2c')]=_['intersection'](_0x7c083f[_0x0785('0x28')],qs[_0x0785('0x2e')](_0x19fff9[_0x0785('0x24')][_0x0785('0x2e')]));_0x133124[_0x0785('0x2c')]=_0x133124[_0x0785('0x2c')][_0x0785('0x3c')]?_0x133124['attributes']:_0x7c083f[_0x0785('0x28')];if(!_0x19fff9['query'][_0x0785('0x3d')]('nolimit')){_0x133124[_0x0785('0x17')]=qs['limit'](_0x19fff9[_0x0785('0x24')][_0x0785('0x17')]);_0x133124[_0x0785('0x19')]=qs[_0x0785('0x19')](_0x19fff9[_0x0785('0x24')][_0x0785('0x19')]);}_0x133124[_0x0785('0x3e')]=qs['sort'](_0x19fff9['query'][_0x0785('0x3f')]);_0x133124[_0x0785('0x40')]=qs[_0x0785('0x2b')](_[_0x0785('0x41')](_0x19fff9[_0x0785('0x24')],_0x7c083f['filters']));_0x133124[_0x0785('0x40')][_0x0785('0x42')]=_0xbd81ed['id'];if(_0x19fff9[_0x0785('0x24')][_0x0785('0x43')]){_0x133124[_0x0785('0x40')]=_[_0x0785('0x31')](_0x133124['where'],{'$or':_['map'](_0x133124['attributes'],function(_0x576ba7){var _0x4f5f21={};_0x4f5f21[_0x576ba7]={'$like':'%'+_0x19fff9[_0x0785('0x24')]['filter']+'%'};return _0x4f5f21;})});}if(_0x19fff9['query']['$gte']){var _0x20f143=_0x19fff9[_0x0785('0x24')][_0x0785('0x44')][_0x0785('0x45')](',');var _0x2c6245={};_0x2c6245[_0x20f143[0x0]]={'$gte':moment(_0x20f143[0x1])[_0x0785('0x46')](_0x0785('0x47'))};_0x133124[_0x0785('0x40')]=_[_0x0785('0x31')](_0x133124[_0x0785('0x40')],_0x2c6245);}_0x133124=_[_0x0785('0x31')]({},_0x133124,_0x19fff9[_0x0785('0x32')]);return db[_0x0785('0x48')][_0x0785('0x18')]({'where':_0x133124[_0x0785('0x40')]})['then'](function(_0x43402f){_0x32e61c[_0x0785('0x18')]=_0x43402f;if(_0x19fff9['query'][_0x0785('0x2f')]){_0x133124[_0x0785('0x30')]=[{'all':!![]}];}return db[_0x0785('0x48')]['findAll'](_0x133124);})['then'](function(_0x198f6c){_0x32e61c[_0x0785('0x49')]=_0x198f6c;return _0x32e61c;});}})[_0x0785('0x1d')](respondWithFilteredResult(_0x452f36,_0x133124))[_0x0785('0x26')](handleError(_0x452f36,null));};exports[_0x0785('0x4a')]=function(_0x105b8e,_0x165e54){return db[_0x0785('0x21')]['find']({'where':{'id':_0x105b8e[_0x0785('0x27')]['id']}})['then'](handleEntityNotFound(_0x165e54,null))[_0x0785('0x1d')](function(_0x76e462){if(_0x76e462){return _0x76e462[_0x0785('0x4b')](_0x105b8e[_0x0785('0x35')][_0x0785('0x39')],_[_0x0785('0x4c')](_0x105b8e[_0x0785('0x35')],[_0x0785('0x39'),'id'])||{})[_0x0785('0x4d')](function(){return db[_0x0785('0x4e')][_0x0785('0x22')]({'attributes':['id',_0x0785('0x4f'),'color'],'where':{'id':_0x105b8e['body'][_0x0785('0x39')]}});})[_0x0785('0x1d')](function(_0x1021de){socket[_0x0785('0x50')]('smsInteractionTags:save',{'id':Number(_0x105b8e['params']['id']),'tags':_0x1021de||[]});return{'id':Number(_0x105b8e[_0x0785('0x27')]['id']),'tags':_0x1021de||[]};});}})['then'](respondWithResult(_0x165e54,null))[_0x0785('0x26')](handleError(_0x165e54,null));};exports[_0x0785('0x51')]=function(_0x329825,_0x143b21){return db[_0x0785('0x21')][_0x0785('0x33')]({'where':{'id':_0x329825[_0x0785('0x27')]['id']}})[_0x0785('0x1d')](handleEntityNotFound(_0x143b21,null))['then'](function(_0x5532d9){if(_0x5532d9){return _0x5532d9['removeTags'](_0x329825[_0x0785('0x24')][_0x0785('0x39')]);}})[_0x0785('0x1d')](respondWithStatusCode(_0x143b21,null))[_0x0785('0x26')](handleError(_0x143b21,null));};exports[_0x0785('0x52')]=function(_0x46948a,_0x55a4be){var _0x46a56e=moment()[_0x0785('0x53')]()[_0x0785('0x54')]();var _0x2ecd83=path[_0x0785('0x55')](config[_0x0785('0x56')],_0x0785('0x57'),_0x0785('0x58'),_0x0785('0x59'));var _0x5b6766=path[_0x0785('0x55')](_0x2ecd83,_0x46a56e);var _0x2c06d7=util[_0x0785('0x46')](_0x0785('0x5a'),_0x46948a['params']['id'],_0x46a56e);var _0x2053f7=path['join'](_0x2ecd83,_0x2c06d7);var _0x57192d=[];_0x57192d['push']({'model':db['User'],'as':_0x0785('0x5b'),'attributes':['id',_0x0785('0x5c')],'raw':!![]});_0x57192d['push']({'model':db[_0x0785('0x5d')],'as':_0x0785('0x5e'),'attributes':['id','firstName',_0x0785('0x5f')],'raw':!![]});var _0x364a91=[{'model':db[_0x0785('0x48')],'as':_0x0785('0x60'),'attributes':['id',_0x0785('0x35'),_0x0785('0x61'),_0x0785('0x62'),_0x0785('0x63'),_0x0785('0x64')],'include':_0x57192d}];_0x364a91[_0x0785('0x65')]({'model':db['SmsAccount'],'as':_0x0785('0x66'),'attributes':['id',_0x0785('0x4f')]});_0x364a91[_0x0785('0x65')]({'model':db[_0x0785('0x5b')],'as':_0x0785('0x67'),'attributes':['id','fullname']});return db[_0x0785('0x21')][_0x0785('0x33')]({'where':{'id':_0x46948a['params']['id']},'include':_0x364a91})['then'](handleEntityNotFound(_0x55a4be,null))[_0x0785('0x1d')](function(_0x93a6c1){if(_0x93a6c1){var _0x4c095a=_0x93a6c1[_0x0785('0x68')]({'plain':!![]});fs[_0x0785('0x69')](_0x5b6766);var _0x398b52={'channel':_0x0785('0x6a'),'account':_0x4c095a[_0x0785('0x66')][_0x0785('0x4f')],'agent':_0x4c095a[_0x0785('0x67')]?_0x4c095a[_0x0785('0x67')][_0x0785('0x5c')]:_0x0785('0x6b'),'createdAt':moment(_0x4c095a[_0x0785('0x61')])[_0x0785('0x46')](_0x0785('0x47'))[_0x0785('0x54')](),'closedAt':_0x4c095a['closed']?moment(_0x4c095a[_0x0785('0x6c')])[_0x0785('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0785('0x54')]():'','disposition':_0x4c095a[_0x0785('0x6d')],'messages':_(_0x4c095a[_0x0785('0x60')])[_0x0785('0x43')]({'secret':![]})[_0x0785('0x6e')](function(_0x2905e1){return{'date':moment(_0x2905e1[_0x0785('0x61')])[_0x0785('0x46')](_0x0785('0x47'))[_0x0785('0x54')](),'sender':_0x2905e1[_0x0785('0x62')]==='out'?_0x2905e1[_0x0785('0x5b')]?_0x2905e1[_0x0785('0x5b')][_0x0785('0x5c')]:'System':_0x2905e1['Contact'][_0x0785('0x6f')]+(_0x2905e1[_0x0785('0x5e')]['lastName']?'\x20'+_0x2905e1[_0x0785('0x5e')][_0x0785('0x5f')]:''),'body':_0x2905e1[_0x0785('0x35')],'direction':_0x2905e1[_0x0785('0x62')]===_0x0785('0x70')?'A':'C','secret':_0x2905e1[_0x0785('0x63')],'read':_0x2905e1['read']};})[_0x0785('0x71')]()};return ejs[_0x0785('0x72')](path['join'](config['root'],_0x0785('0x57'),_0x0785('0x73'),'downloadInteraction.ejs'),{'interaction':_0x398b52})['then'](function(_0xc9b1){var _0x4b725c=path[_0x0785('0x55')](_0x5b6766,_0x0785('0x74')+_0x4c095a['id']+'-'+_0x46a56e+'.pdf');var _0x52c5c9={'path':_0x4b725c,'channel':_0x0785('0x6a'),'interactionId':_0x4c095a['id']};return pdf[_0x0785('0x75')](_0xc9b1,_0x52c5c9);})[_0x0785('0x1d')](function(){return new BPromise(function(_0x5c6f4e,_0x54982c){zipdir(_0x5b6766,{'saveTo':_0x2053f7},function(_0x322a0f,_0x162840){if(_0x322a0f)return _0x54982c(_0x322a0f);return _0x5c6f4e(_0x162840);});})[_0x0785('0x1d')](function(){return new BPromise(function(_0x30977a,_0x67a3bc){rimraf(_0x5b6766,function(_0x19225f){if(_0x19225f)_0x67a3bc(_0x19225f);return _0x30977a();});});})['then'](function(){return _0x55a4be[_0x0785('0x52')](_0x2053f7,_0x2c06d7,function(_0x1c4cda){if(_0x1c4cda){console['log'](_0x0785('0x76'),_0x1c4cda);}else{fs[_0x0785('0x77')](_0x2053f7);}});});});}else{return _0x55a4be[_0x0785('0x13')](0xc8);}})[_0x0785('0x26')](handleError(_0x55a4be,null));}; \ No newline at end of file +var _0x2b8f=['moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','stack','name','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','limit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','removeTags','download','toString','join','server','files','User','fullname','push','CmContact','firstName','Messages','createdAt','secret','read','SmsAccount','Owner','get','mkdirSync','Account','N.A.','closed','closedAt','disposition','direction','System','Contact','lastName','value','renderFile','root','views','.pdf','Sms','createPdfFromHTML','err','unlinkSync','zip-dir'];(function(_0x58068d,_0x8699ff){var _0x56b5c0=function(_0x4da341){while(--_0x4da341){_0x58068d['push'](_0x58068d['shift']());}};_0x56b5c0(++_0x8699ff);}(_0x2b8f,0x73));var _0xf2b8=function(_0x5a67dc,_0x220c33){_0x5a67dc=_0x5a67dc-0x0;var _0x5aeaa8=_0x2b8f[_0x5a67dc];return _0x5aeaa8;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf2b8('0x0'));var moment=require(_0xf2b8('0x1'));var BPromise=require(_0xf2b8('0x2'));var util=require('util');var path=require(_0xf2b8('0x3'));var ejs=require(_0xf2b8('0x4'));var fs=require('fs');var _=require(_0xf2b8('0x5'));var Redis=require(_0xf2b8('0x6'));var interaction=require(_0xf2b8('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xf2b8('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf2b8('0x9')](config['redis'],{'host':_0xf2b8('0xa'),'port':0x18eb});var socket=require(_0xf2b8('0xb'))(new Redis(config[_0xf2b8('0xc')]));require(_0xf2b8('0xd'))[_0xf2b8('0xe')](socket);function respondWithStatusCode(_0x43a56a,_0x1e4bef){_0x1e4bef=_0x1e4bef||0xcc;return function(_0x46974f){if(_0x46974f){return _0x43a56a[_0xf2b8('0xf')](_0x1e4bef);}return _0x43a56a[_0xf2b8('0x10')](_0x1e4bef)['end']();};}function respondWithResult(_0x125ef5,_0x2a330b){_0x2a330b=_0x2a330b||0xc8;return function(_0xaa6558){if(_0xaa6558){return _0x125ef5[_0xf2b8('0x10')](_0x2a330b)['json'](_0xaa6558);}};}function respondWithFilteredResult(_0x505a36,_0x5c43a2){return function(_0x3cd6b6){if(_0x3cd6b6){var _0x357af3=typeof _0x5c43a2[_0xf2b8('0x11')]===_0xf2b8('0x12')&&typeof _0x5c43a2['limit']==='undefined';var _0x5318a4=_0x3cd6b6[_0xf2b8('0x13')];var _0x1307f2=_0x357af3?0x0:_0x5c43a2[_0xf2b8('0x11')];var _0x2496eb=_0x357af3?_0x3cd6b6[_0xf2b8('0x13')]:_0x5c43a2['offset']+_0x5c43a2['limit'];var _0xc1cbbd;if(_0x2496eb>=_0x5318a4){_0x2496eb=_0x5318a4;_0xc1cbbd=0xc8;}else{_0xc1cbbd=0xce;}_0x505a36[_0xf2b8('0x10')](_0xc1cbbd);return _0x505a36[_0xf2b8('0x14')](_0xf2b8('0x15'),_0x1307f2+'-'+_0x2496eb+'/'+_0x5318a4)[_0xf2b8('0x16')](_0x3cd6b6);}return null;};}function saveUpdates(_0x55a3dc){return function(_0x52e9df){if(_0x52e9df){return _0x52e9df[_0xf2b8('0x17')](_0x55a3dc)[_0xf2b8('0x18')](function(_0x17c505){return _0x17c505;});}return null;};}function removeEntity(_0xf6a834){return function(_0x21063c){if(_0x21063c){return _0x21063c[_0xf2b8('0x19')]()[_0xf2b8('0x18')](function(){_0xf6a834[_0xf2b8('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e1ae){return function(_0x3b5b90){if(!_0x3b5b90){_0x17e1ae[_0xf2b8('0xf')](0x194);}return _0x3b5b90;};}function handleError(_0x4f0d23,_0x596377){_0x596377=_0x596377||0x1f4;return function(_0x286118){logger['error'](_0x286118[_0xf2b8('0x1a')]);if(_0x286118[_0xf2b8('0x1b')]){delete _0x286118[_0xf2b8('0x1b')];}_0x4f0d23[_0xf2b8('0x10')](_0x596377)['send'](_0x286118);};}exports['index']=function(_0x1c3b96,_0x2d73c2){var _0xa9fb12={};var _0x790b1=_[_0xf2b8('0x1c')](db[_0xf2b8('0x1d')][_0xf2b8('0x1e')],function(_0x564c7b){return{'name':_0x564c7b[_0xf2b8('0x1f')],'type':_0x564c7b[_0xf2b8('0x20')][_0xf2b8('0x21')]};});_0xa9fb12=qs[_0xf2b8('0x22')](_0x790b1,_0x1c3b96);return interaction[_0xf2b8('0x23')](_0xf2b8('0x24'),_0x1c3b96[_0xf2b8('0x25')],_0x1c3b96[_0xf2b8('0x26')],_0xa9fb12,_0x790b1)[_0xf2b8('0x18')](respondWithFilteredResult(_0x2d73c2,_0xa9fb12))[_0xf2b8('0x27')](handleError(_0x2d73c2,null));};exports[_0xf2b8('0x28')]=function(_0x5f3dd6,_0x2219ed){var _0x4e7956={'raw':![],'where':{'id':_0x5f3dd6[_0xf2b8('0x29')]['id']}},_0x376fae={};_0x376fae[_0xf2b8('0x2a')]=_[_0xf2b8('0x2b')](db[_0xf2b8('0x1d')][_0xf2b8('0x1e')]);_0x376fae[_0xf2b8('0x25')]=_[_0xf2b8('0x2b')](_0x5f3dd6[_0xf2b8('0x25')]);_0x376fae[_0xf2b8('0x2c')]=_[_0xf2b8('0x2d')](_0x376fae[_0xf2b8('0x2a')],_0x376fae[_0xf2b8('0x25')]);_0x4e7956[_0xf2b8('0x2e')]=_[_0xf2b8('0x2d')](_0x376fae[_0xf2b8('0x2a')],qs[_0xf2b8('0x2f')](_0x5f3dd6[_0xf2b8('0x25')]['fields']));_0x4e7956[_0xf2b8('0x2e')]=_0x4e7956[_0xf2b8('0x2e')][_0xf2b8('0x30')]?_0x4e7956['attributes']:_0x376fae['model'];if(_0x5f3dd6[_0xf2b8('0x25')][_0xf2b8('0x31')]){_0x4e7956[_0xf2b8('0x32')]=[{'all':!![]}];}_0x4e7956=_[_0xf2b8('0x33')]({},_0x4e7956,_0x5f3dd6[_0xf2b8('0x34')]);return db[_0xf2b8('0x1d')][_0xf2b8('0x35')](_0x4e7956)['then'](handleEntityNotFound(_0x2219ed,null))['then'](respondWithResult(_0x2219ed,null))[_0xf2b8('0x27')](handleError(_0x2219ed,null));};exports[_0xf2b8('0x36')]=function(_0x214f5f,_0x546596){return db[_0xf2b8('0x1d')][_0xf2b8('0x36')](_0x214f5f['body'],{})[_0xf2b8('0x18')](respondWithResult(_0x546596,0xc9))[_0xf2b8('0x27')](handleError(_0x546596,null));};exports[_0xf2b8('0x17')]=function(_0xa9c9bd,_0xd160a7){if(_0xa9c9bd[_0xf2b8('0x37')]['id']){delete _0xa9c9bd[_0xf2b8('0x37')]['id'];}return db[_0xf2b8('0x1d')][_0xf2b8('0x35')]({'where':{'id':_0xa9c9bd[_0xf2b8('0x29')]['id']}})[_0xf2b8('0x18')](handleEntityNotFound(_0xd160a7,null))[_0xf2b8('0x18')](saveUpdates(_0xa9c9bd[_0xf2b8('0x37')],null))[_0xf2b8('0x18')](respondWithResult(_0xd160a7,null))[_0xf2b8('0x27')](handleError(_0xd160a7,null));};exports[_0xf2b8('0x19')]=function(_0xe4977a,_0x2b37f7){return db[_0xf2b8('0x1d')][_0xf2b8('0x35')]({'where':{'id':_0xe4977a[_0xf2b8('0x29')]['id']}})[_0xf2b8('0x18')](handleEntityNotFound(_0x2b37f7,null))[_0xf2b8('0x18')](removeEntity(_0x2b37f7,null))[_0xf2b8('0x27')](handleError(_0x2b37f7,null));};exports[_0xf2b8('0x38')]=function(_0x55433f,_0x6c3a28){return db[_0xf2b8('0x1d')][_0xf2b8('0x38')]()[_0xf2b8('0x18')](respondWithResult(_0x6c3a28,null))['catch'](handleError(_0x6c3a28,null));};exports['addMessage']=function(_0x13aed4,_0x395146){return db['SmsMessage']['find']({'where':{'id':_0x13aed4[_0xf2b8('0x29')]['id']}})['then'](handleEntityNotFound(_0x395146,null))[_0xf2b8('0x18')](function(_0x47f6ca){if(_0x47f6ca){return _0x47f6ca[_0xf2b8('0x39')](_0x13aed4[_0xf2b8('0x37')][_0xf2b8('0x3a')],_[_0xf2b8('0x3b')](_0x13aed4[_0xf2b8('0x37')],['ids','id'])||{});}})[_0xf2b8('0x18')](respondWithResult(_0x395146,null))[_0xf2b8('0x27')](handleError(_0x395146,null));};exports[_0xf2b8('0x3c')]=function(_0x5ef1e1,_0x1e0643){var _0x67517b={'raw':![],'where':{}};var _0x48f9c2={};var _0x365e15={'count':0x0,'rows':[]};return db[_0xf2b8('0x1d')][_0xf2b8('0x3d')]({'where':{'id':_0x5ef1e1['params']['id']}})[_0xf2b8('0x18')](handleEntityNotFound(_0x1e0643,null))[_0xf2b8('0x18')](function(_0x56d4b3){if(_0x56d4b3){_0x48f9c2[_0xf2b8('0x2a')]=_[_0xf2b8('0x2b')](db[_0xf2b8('0x3e')][_0xf2b8('0x1e')]);_0x48f9c2[_0xf2b8('0x25')]=_['keys'](_0x5ef1e1[_0xf2b8('0x25')]);_0x48f9c2['filters']=_[_0xf2b8('0x2d')](_0x48f9c2[_0xf2b8('0x2a')],_0x48f9c2[_0xf2b8('0x25')]);_0x67517b[_0xf2b8('0x2e')]=_[_0xf2b8('0x2d')](_0x48f9c2[_0xf2b8('0x2a')],qs[_0xf2b8('0x2f')](_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x2f')]));_0x67517b[_0xf2b8('0x2e')]=_0x67517b['attributes'][_0xf2b8('0x30')]?_0x67517b['attributes']:_0x48f9c2[_0xf2b8('0x2a')];if(!_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x3f')]('nolimit')){_0x67517b['limit']=qs[_0xf2b8('0x40')](_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x40')]);_0x67517b[_0xf2b8('0x11')]=qs[_0xf2b8('0x11')](_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x11')]);}_0x67517b[_0xf2b8('0x41')]=qs[_0xf2b8('0x42')](_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x42')]);_0x67517b[_0xf2b8('0x43')]=qs[_0xf2b8('0x2c')](_[_0xf2b8('0x44')](_0x5ef1e1['query'],_0x48f9c2[_0xf2b8('0x2c')]));_0x67517b[_0xf2b8('0x43')]['SmsInteractionId']=_0x56d4b3['id'];if(_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x45')]){_0x67517b[_0xf2b8('0x43')]=_['merge'](_0x67517b[_0xf2b8('0x43')],{'$or':_[_0xf2b8('0x1c')](_0x67517b['attributes'],function(_0x5444d3){var _0x31cb39={};_0x31cb39[_0x5444d3]={'$like':'%'+_0x5ef1e1['query'][_0xf2b8('0x45')]+'%'};return _0x31cb39;})});}if(_0x5ef1e1[_0xf2b8('0x25')][_0xf2b8('0x46')]){var _0x51431e=_0x5ef1e1[_0xf2b8('0x25')]['$gte'][_0xf2b8('0x47')](',');var _0x37d449={};_0x37d449[_0x51431e[0x0]]={'$gte':moment(_0x51431e[0x1])[_0xf2b8('0x48')](_0xf2b8('0x49'))};_0x67517b[_0xf2b8('0x43')]=_[_0xf2b8('0x33')](_0x67517b[_0xf2b8('0x43')],_0x37d449);}_0x67517b=_['merge']({},_0x67517b,_0x5ef1e1[_0xf2b8('0x34')]);return db[_0xf2b8('0x3e')][_0xf2b8('0x13')]({'where':_0x67517b[_0xf2b8('0x43')]})['then'](function(_0x14ef3c){_0x365e15[_0xf2b8('0x13')]=_0x14ef3c;if(_0x5ef1e1[_0xf2b8('0x25')]['includeAll']){_0x67517b[_0xf2b8('0x32')]=[{'all':!![]}];}return db[_0xf2b8('0x3e')]['findAll'](_0x67517b);})[_0xf2b8('0x18')](function(_0x162e08){_0x365e15[_0xf2b8('0x4a')]=_0x162e08;return _0x365e15;});}})['then'](respondWithFilteredResult(_0x1e0643,_0x67517b))[_0xf2b8('0x27')](handleError(_0x1e0643,null));};exports[_0xf2b8('0x4b')]=function(_0x5ac514,_0x5a2402){return db[_0xf2b8('0x1d')]['find']({'where':{'id':_0x5ac514[_0xf2b8('0x29')]['id']}})[_0xf2b8('0x18')](handleEntityNotFound(_0x5a2402,null))[_0xf2b8('0x18')](function(_0x3cdc8b){if(_0x3cdc8b){return _0x3cdc8b[_0xf2b8('0x4c')](_0x5ac514[_0xf2b8('0x37')][_0xf2b8('0x3a')],_[_0xf2b8('0x3b')](_0x5ac514[_0xf2b8('0x37')],[_0xf2b8('0x3a'),'id'])||{})['spread'](function(){return db[_0xf2b8('0x4d')][_0xf2b8('0x23')]({'attributes':['id','name',_0xf2b8('0x4e')],'where':{'id':_0x5ac514['body'][_0xf2b8('0x3a')]}});})[_0xf2b8('0x18')](function(_0x335133){socket['emit']('smsInteractionTags:save',{'id':Number(_0x5ac514[_0xf2b8('0x29')]['id']),'tags':_0x335133||[]});return{'id':Number(_0x5ac514[_0xf2b8('0x29')]['id']),'tags':_0x335133||[]};});}})[_0xf2b8('0x18')](respondWithResult(_0x5a2402,null))[_0xf2b8('0x27')](handleError(_0x5a2402,null));};exports[_0xf2b8('0x4f')]=function(_0x360805,_0x2bf9f7){return db[_0xf2b8('0x1d')][_0xf2b8('0x35')]({'where':{'id':_0x360805[_0xf2b8('0x29')]['id']}})[_0xf2b8('0x18')](handleEntityNotFound(_0x2bf9f7,null))[_0xf2b8('0x18')](function(_0x3a75d0){if(_0x3a75d0){return _0x3a75d0[_0xf2b8('0x4f')](_0x360805[_0xf2b8('0x25')][_0xf2b8('0x3a')]);}})[_0xf2b8('0x18')](respondWithStatusCode(_0x2bf9f7,null))[_0xf2b8('0x27')](handleError(_0x2bf9f7,null));};exports[_0xf2b8('0x50')]=function(_0x59c363,_0xa9b0ed){var _0xd7a53c=moment()['unix']()[_0xf2b8('0x51')]();var _0x4a78d3=path[_0xf2b8('0x52')](config['root'],_0xf2b8('0x53'),_0xf2b8('0x54'),'tmp');var _0x460e41=path[_0xf2b8('0x52')](_0x4a78d3,_0xd7a53c);var _0x3f671b=util[_0xf2b8('0x48')]('transcript-%d-%s.zip',_0x59c363[_0xf2b8('0x29')]['id'],_0xd7a53c);var _0x651233=path['join'](_0x4a78d3,_0x3f671b);var _0x1a98bf=[];_0x1a98bf['push']({'model':db[_0xf2b8('0x55')],'as':_0xf2b8('0x55'),'attributes':['id',_0xf2b8('0x56')],'raw':!![]});_0x1a98bf[_0xf2b8('0x57')]({'model':db[_0xf2b8('0x58')],'as':'Contact','attributes':['id',_0xf2b8('0x59'),'lastName'],'raw':!![]});var _0x491c8f=[{'model':db[_0xf2b8('0x3e')],'as':_0xf2b8('0x5a'),'attributes':['id',_0xf2b8('0x37'),_0xf2b8('0x5b'),'direction',_0xf2b8('0x5c'),_0xf2b8('0x5d')],'include':_0x1a98bf}];_0x491c8f['push']({'model':db[_0xf2b8('0x5e')],'as':'Account','attributes':['id',_0xf2b8('0x1b')]});_0x491c8f[_0xf2b8('0x57')]({'model':db[_0xf2b8('0x55')],'as':_0xf2b8('0x5f'),'attributes':['id',_0xf2b8('0x56')]});return db[_0xf2b8('0x1d')][_0xf2b8('0x35')]({'where':{'id':_0x59c363[_0xf2b8('0x29')]['id']},'include':_0x491c8f})['then'](handleEntityNotFound(_0xa9b0ed,null))[_0xf2b8('0x18')](function(_0x670faa){if(_0x670faa){var _0x1d823c=_0x670faa[_0xf2b8('0x60')]({'plain':!![]});fs[_0xf2b8('0x61')](_0x460e41);var _0x1588d1={'channel':'Sms','account':_0x1d823c[_0xf2b8('0x62')][_0xf2b8('0x1b')],'agent':_0x1d823c[_0xf2b8('0x5f')]?_0x1d823c[_0xf2b8('0x5f')][_0xf2b8('0x56')]:_0xf2b8('0x63'),'createdAt':moment(_0x1d823c[_0xf2b8('0x5b')])[_0xf2b8('0x48')](_0xf2b8('0x49'))[_0xf2b8('0x51')](),'closedAt':_0x1d823c[_0xf2b8('0x64')]?moment(_0x1d823c[_0xf2b8('0x65')])[_0xf2b8('0x48')](_0xf2b8('0x49'))[_0xf2b8('0x51')]():'','disposition':_0x1d823c[_0xf2b8('0x66')],'messages':_(_0x1d823c[_0xf2b8('0x5a')])[_0xf2b8('0x45')]({'secret':![]})[_0xf2b8('0x1c')](function(_0x35a412){return{'date':moment(_0x35a412['createdAt'])[_0xf2b8('0x48')](_0xf2b8('0x49'))[_0xf2b8('0x51')](),'sender':_0x35a412[_0xf2b8('0x67')]==='out'?_0x35a412[_0xf2b8('0x55')]?_0x35a412['User'][_0xf2b8('0x56')]:_0xf2b8('0x68'):_0x35a412[_0xf2b8('0x69')][_0xf2b8('0x59')]+(_0x35a412[_0xf2b8('0x69')][_0xf2b8('0x6a')]?'\x20'+_0x35a412[_0xf2b8('0x69')]['lastName']:''),'body':_0x35a412[_0xf2b8('0x37')],'direction':_0x35a412[_0xf2b8('0x67')]==='out'?'A':'C','secret':_0x35a412[_0xf2b8('0x5c')],'read':_0x35a412[_0xf2b8('0x5d')]};})[_0xf2b8('0x6b')]()};return ejs[_0xf2b8('0x6c')](path[_0xf2b8('0x52')](config[_0xf2b8('0x6d')],'server',_0xf2b8('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x1588d1})['then'](function(_0x9f4705){var _0x452a4f=path[_0xf2b8('0x52')](_0x460e41,'transcript-'+_0x1d823c['id']+'-'+_0xd7a53c+_0xf2b8('0x6f'));var _0x1127d8={'path':_0x452a4f,'channel':_0xf2b8('0x70'),'interactionId':_0x1d823c['id']};return pdf[_0xf2b8('0x71')](_0x9f4705,_0x1127d8);})[_0xf2b8('0x18')](function(){return new BPromise(function(_0x4b81de,_0x3dcf1f){zipdir(_0x460e41,{'saveTo':_0x651233},function(_0x4125d7,_0x5e9203){if(_0x4125d7)return _0x3dcf1f(_0x4125d7);return _0x4b81de(_0x5e9203);});})[_0xf2b8('0x18')](function(){return new BPromise(function(_0x47a67a,_0x2ff8c2){rimraf(_0x460e41,function(_0x1064bd){if(_0x1064bd)_0x2ff8c2(_0x1064bd);return _0x47a67a();});});})['then'](function(){return _0xa9b0ed[_0xf2b8('0x50')](_0x651233,_0x3f671b,function(_0x7b3030){if(_0x7b3030){console['log'](_0xf2b8('0x72'),_0x7b3030);}else{fs[_0xf2b8('0x73')](_0x651233);}});});});}else{return _0xa9b0ed['sendStatus'](0xc8);}})[_0xf2b8('0x27')](handleError(_0xa9b0ed,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7d4eb53..3aca17d 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 _0x4b17=['SmsInteraction','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0xda0a8,_0x534718){var _0x1d65e2=function(_0x5b4c7f){while(--_0x5b4c7f){_0xda0a8['push'](_0xda0a8['shift']());}};_0x1d65e2(++_0x534718);}(_0x4b17,0x10f));var _0x74b1=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x4b17[_0x10791d];return _0x1b4f9c;};'use strict';var EventEmitter=require(_0x74b1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x74b1('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x74b1('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x74b1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x74b1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fdea2){return function(_0x7b3c36,_0x30d910,_0x379dcc){_0x7b3c36[_0x74b1('0x5')]({'attributes':['id'],'raw':!![]})[_0x74b1('0x6')](function(_0x191d2b){_0x7b3c36[_0x74b1('0x7')]('Users',_0x191d2b[_0x74b1('0x8')](function(_0x98bb33){return{'id':_0x98bb33['id']};}));return SmsMessage[_0x74b1('0x9')]({'where':{'SmsInteractionId':_0x7b3c36['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74b1('0x6')](function(_0xc1952){_0x7b3c36['setDataValue'](_0x74b1('0xa'),_0xc1952[_0x74b1('0xb')]);SmsInteractionEvents['emit'](_0x4fdea2+':'+_0x7b3c36['id'],_0x7b3c36);SmsInteractionEvents[_0x74b1('0xc')](_0x4fdea2,_0x7b3c36);_0x379dcc(null);})[_0x74b1('0xd')](_0x379dcc(null));};}for(var e in events){if(events[_0x74b1('0xe')](e)){var event=events[e];SmsInteraction[_0x74b1('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x1aecaf,_0x11f23b){var _0x549de3=function(_0x2eed65){while(--_0x2eed65){_0x1aecaf['push'](_0x1aecaf['shift']());}};_0x549de3(++_0x11f23b);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 29d6bf7..fb9af1b 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 _0x43fa=['../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ad76f,_0x538c95){var _0x1a387a=function(_0x5e045f){while(--_0x5e045f){_0x2ad76f['push'](_0x2ad76f['shift']());}};_0x1a387a(++_0x538c95);}(_0x43fa,0x90));var _0xa43f=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x43fa[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0xa43f('0x0'));var util=require(_0xa43f('0x1'));var logger=require(_0xa43f('0x2'))(_0xa43f('0x3'));var moment=require(_0xa43f('0x4'));var BPromise=require(_0xa43f('0x5'));var rp=require(_0xa43f('0x6'));var fs=require('fs');var path=require(_0xa43f('0x7'));var rimraf=require(_0xa43f('0x8'));var config=require(_0xa43f('0x9'));var attributes=require(_0xa43f('0xa'));module['exports']=function(_0x5af035,_0x25b567){return _0x5af035[_0xa43f('0xb')]('SmsInteraction',attributes,{'tableName':_0xa43f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59ef30,_0x51c9bd,_0x152182){if(_0x59ef30[_0xa43f('0xd')]('closed')){_0x59ef30[_0xa43f('0xe')]=moment()[_0xa43f('0xf')](_0xa43f('0x10'));}_0x152182(null,_0x59ef30);}}});}; \ No newline at end of file +var _0x2d91=['util','api','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d91,0x1c1));var _0x12d9=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x2d91[_0x585133];return _0x18254a;};'use strict';var _=require(_0x12d9('0x0'));var util=require(_0x12d9('0x1'));var logger=require('../../config/logger')(_0x12d9('0x2'));var moment=require('moment');var BPromise=require(_0x12d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12d9('0x4'));var rimraf=require(_0x12d9('0x5'));var config=require(_0x12d9('0x6'));var attributes=require(_0x12d9('0x7'));module['exports']=function(_0x18d4e2,_0x5c550c){return _0x18d4e2[_0x12d9('0x8')](_0x12d9('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e8340,_0x3094da,_0x48ce2f){if(_0x4e8340[_0x12d9('0xa')](_0x12d9('0xb'))){_0x4e8340[_0x12d9('0xc')]=moment()[_0x12d9('0xd')](_0x12d9('0xe'));}_0x48ce2f(null,_0x4e8340);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 9354305..78773b7 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 _0x711e=['raw','attributes','limit','then','debug','AddTagsToSmsInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','catch','UpdateSmsInteraction','SmsInteraction','update','body','options'];(function(_0x2dda96,_0x380a19){var _0x188657=function(_0x225ba1){while(--_0x225ba1){_0x2dda96['push'](_0x2dda96['shift']());}};_0x188657(++_0x380a19);}(_0x711e,0x1c4));var _0xe711=function(_0x2319b0,_0x215176){_0x2319b0=_0x2319b0-0x0;var _0x32039b=_0x711e[_0x2319b0];return _0x32039b;};'use strict';var _=require(_0xe711('0x0'));var util=require('util');var moment=require(_0xe711('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe711('0x2'));var db=require(_0xe711('0x3'))['db'];var utils=require(_0xe711('0x4'));var logger=require(_0xe711('0x5'))(_0xe711('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe711('0x7')]({'port':0x232a});config['redis']=_[_0xe711('0x8')](config[_0xe711('0x9')],{'host':_0xe711('0xa'),'port':0x18eb});var socket=require(_0xe711('0xb'))(new Redis(config[_0xe711('0x9')]));require(_0xe711('0xc'))[_0xe711('0xd')](socket);function respondWithRpcPromise(_0x4fe636,_0x3429f0,_0x4a6d37){return new BPromise(function(_0x1989fe,_0x66a9fe){return client[_0xe711('0xe')](_0x4fe636,_0x4a6d37)['then'](function(_0x390e22){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3429f0,_0xe711('0xf'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3429f0,_0xe711('0xf'),JSON[_0xe711('0x10')](_0x390e22));if(_0x390e22[_0xe711('0x11')]){if(_0x390e22[_0xe711('0x11')][_0xe711('0x12')]===0x1f4){logger[_0xe711('0x11')](_0xe711('0x13'),_0x3429f0,_0x390e22[_0xe711('0x11')]['message']);return _0x66a9fe(_0x390e22['error'][_0xe711('0x14')]);}logger[_0xe711('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3429f0,_0x390e22[_0xe711('0x11')]['message']);return _0x1989fe(_0x390e22['error']['message']);}else{logger[_0xe711('0x15')](_0xe711('0x13'),_0x3429f0,_0xe711('0xf'));_0x1989fe(_0x390e22['result'][_0xe711('0x14')]);}})[_0xe711('0x16')](function(_0x34094d){logger[_0xe711('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3429f0,_0x34094d);_0x66a9fe(_0x34094d);});});}exports[_0xe711('0x17')]=function(_0x5b33a3){var _0x256a03=this;return new Promise(function(_0x314fe0,_0x112dca){return db[_0xe711('0x18')][_0xe711('0x19')](_0x5b33a3[_0xe711('0x1a')],{'raw':_0x5b33a3[_0xe711('0x1b')]?_0x5b33a3[_0xe711('0x1b')][_0xe711('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b33a3[_0xe711('0x1b')]?_0x5b33a3[_0xe711('0x1b')]['where']||null:null,'attributes':_0x5b33a3[_0xe711('0x1b')]?_0x5b33a3[_0xe711('0x1b')][_0xe711('0x1d')]||null:null,'limit':_0x5b33a3[_0xe711('0x1b')]?_0x5b33a3[_0xe711('0x1b')][_0xe711('0x1e')]||null:null})[_0xe711('0x1f')](function(_0x3176a2){logger[_0xe711('0x15')](_0xe711('0x17'),_0x5b33a3);logger[_0xe711('0x20')](_0xe711('0x17'),_0x5b33a3,JSON[_0xe711('0x10')](_0x3176a2));_0x314fe0(_0x3176a2);})[_0xe711('0x16')](function(_0x37d425){logger[_0xe711('0x11')](_0xe711('0x17'),_0x37d425[_0xe711('0x14')],_0x5b33a3);_0x112dca(_0x256a03[_0xe711('0x11')](0x1f4,_0x37d425[_0xe711('0x14')]));});});};exports[_0xe711('0x21')]=function(_0x5af347){return new Promise(function(_0x40677f,_0x11cf2c){return db[_0xe711('0x18')][_0xe711('0x22')]({'where':_0x5af347[_0xe711('0x1b')]?_0x5af347[_0xe711('0x1b')][_0xe711('0x23')]||null:null})[_0xe711('0x1f')](function(_0x5bef68){if(_0x5bef68){return _0x5bef68[_0xe711('0x24')](_0x5af347[_0xe711('0x1a')][_0xe711('0x25')],_[_0xe711('0x26')](_0x5af347[_0xe711('0x1a')],[_0xe711('0x25'),'id'])||{});}})['spread'](function(_0x3c8f1f){logger[_0xe711('0x15')](_0xe711('0x27'),_0x5af347);logger[_0xe711('0x20')](_0xe711('0x27'),_0x5af347,JSON[_0xe711('0x10')](_0x3c8f1f));_0x40677f(_0x3c8f1f);})['catch'](function(_0x51cd45){logger[_0xe711('0x11')]('AddTags',_0x51cd45[_0xe711('0x14')],_0x5af347);_0x11cf2c(_this[_0xe711('0x11')](0x1f4,_0x51cd45['message']));});});}; \ No newline at end of file +var _0x1d01=['register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','UpdateSmsInteraction','SmsInteraction','update','options','where','attributes','catch','body','ids','spread','AddTags','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket'];(function(_0x15e427,_0x3f9a31){var _0x4afa1e=function(_0x314ada){while(--_0x314ada){_0x15e427['push'](_0x15e427['shift']());}};_0x4afa1e(++_0x3f9a31);}(_0x1d01,0x1dc));var _0x11d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d01[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11d0('0x0'));var util=require(_0x11d0('0x1'));var moment=require(_0x11d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x11d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x11d0('0x4'))('rpc');var config=require(_0x11d0('0x5'));var jayson=require(_0x11d0('0x6'));var client=jayson[_0x11d0('0x7')][_0x11d0('0x8')]({'port':0x232a});config[_0x11d0('0x9')]=_[_0x11d0('0xa')](config['redis'],{'host':_0x11d0('0xb'),'port':0x18eb});var socket=require(_0x11d0('0xc'))(new Redis(config[_0x11d0('0x9')]));require(_0x11d0('0xd'))[_0x11d0('0xe')](socket);function respondWithRpcPromise(_0x1da8c9,_0x19a32b,_0x503d9c){return new BPromise(function(_0x2ebc88,_0x2ae73b){return client[_0x11d0('0xf')](_0x1da8c9,_0x503d9c)[_0x11d0('0x10')](function(_0x45f7dd){logger[_0x11d0('0x11')](_0x11d0('0x12'),_0x19a32b,'request\x20sent');logger[_0x11d0('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x19a32b,'request\x20sent',JSON[_0x11d0('0x14')](_0x45f7dd));if(_0x45f7dd[_0x11d0('0x15')]){if(_0x45f7dd[_0x11d0('0x15')]['code']===0x1f4){logger[_0x11d0('0x15')](_0x11d0('0x12'),_0x19a32b,_0x45f7dd['error'][_0x11d0('0x16')]);return _0x2ae73b(_0x45f7dd[_0x11d0('0x15')][_0x11d0('0x16')]);}logger[_0x11d0('0x15')](_0x11d0('0x12'),_0x19a32b,_0x45f7dd[_0x11d0('0x15')][_0x11d0('0x16')]);return _0x2ebc88(_0x45f7dd[_0x11d0('0x15')]['message']);}else{logger[_0x11d0('0x11')](_0x11d0('0x12'),_0x19a32b,_0x11d0('0x17'));_0x2ebc88(_0x45f7dd['result'][_0x11d0('0x16')]);}})['catch'](function(_0x3374d8){logger[_0x11d0('0x15')](_0x11d0('0x12'),_0x19a32b,_0x3374d8);_0x2ae73b(_0x3374d8);});});}exports[_0x11d0('0x18')]=function(_0x2ce304){var _0x4765a3=this;return new Promise(function(_0x430692,_0x525c93){return db[_0x11d0('0x19')][_0x11d0('0x1a')](_0x2ce304['body'],{'raw':_0x2ce304[_0x11d0('0x1b')]?_0x2ce304[_0x11d0('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ce304['options']?_0x2ce304[_0x11d0('0x1b')][_0x11d0('0x1c')]||null:null,'attributes':_0x2ce304['options']?_0x2ce304[_0x11d0('0x1b')][_0x11d0('0x1d')]||null:null,'limit':_0x2ce304[_0x11d0('0x1b')]?_0x2ce304[_0x11d0('0x1b')]['limit']||null:null})[_0x11d0('0x10')](function(_0x453614){logger[_0x11d0('0x11')]('UpdateSmsInteraction',_0x2ce304);logger[_0x11d0('0x13')](_0x11d0('0x18'),_0x2ce304,JSON['stringify'](_0x453614));_0x430692(_0x453614);})[_0x11d0('0x1e')](function(_0x38f8fe){logger[_0x11d0('0x15')](_0x11d0('0x18'),_0x38f8fe['message'],_0x2ce304);_0x525c93(_0x4765a3['error'](0x1f4,_0x38f8fe[_0x11d0('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1c9189){return new Promise(function(_0x407c5,_0xfaebab){return db[_0x11d0('0x19')]['find']({'where':_0x1c9189['options']?_0x1c9189[_0x11d0('0x1b')][_0x11d0('0x1c')]||null:null})[_0x11d0('0x10')](function(_0xe2adb7){if(_0xe2adb7){return _0xe2adb7['addTags'](_0x1c9189[_0x11d0('0x1f')][_0x11d0('0x20')],_['omit'](_0x1c9189[_0x11d0('0x1f')],[_0x11d0('0x20'),'id'])||{});}})[_0x11d0('0x21')](function(_0x1fc721){logger[_0x11d0('0x11')](_0x11d0('0x22'),_0x1c9189);logger['debug'](_0x11d0('0x22'),_0x1c9189,JSON[_0x11d0('0x14')](_0x1fc721));_0x407c5(_0x1fc721);})['catch'](function(_0x463a3e){logger[_0x11d0('0x15')]('AddTags',_0x463a3e[_0x11d0('0x16')],_0x1c9189);_0xfaebab(_this[_0x11d0('0x15')](0x1f4,_0x463a3e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 182d050..c0d0560 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 _0x6c1d=['removeListener','register','length','smsInteraction:','save','remove','update','emit'];(function(_0x4fc92d,_0x5765fc){var _0x1438e5=function(_0x527b2e){while(--_0x527b2e){_0x4fc92d['push'](_0x4fc92d['shift']());}};_0x1438e5(++_0x5765fc);}(_0x6c1d,0x174));var _0xd6c1=function(_0x4176b1,_0xeeebd3){_0x4176b1=_0x4176b1-0x0;var _0x23f92c=_0x6c1d[_0x4176b1];return _0x23f92c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xd6c1('0x0'),_0xd6c1('0x1'),_0xd6c1('0x2')];function createListener(_0x3a78ea,_0x1de543){return function(_0x321e91){_0x1de543[_0xd6c1('0x3')](_0x3a78ea,_0x321e91);};}function removeListener(_0x540dd1,_0x599c5a){return function(){SmsInteractionEvents[_0xd6c1('0x4')](_0x540dd1,_0x599c5a);};}exports[_0xd6c1('0x5')]=function(_0x4a679b){for(var _0x5d0583=0x0,_0x42ed18=events[_0xd6c1('0x6')];_0x5d0583<_0x42ed18;_0x5d0583++){var _0x41e389=events[_0x5d0583];var _0x74b5c1=createListener(_0xd6c1('0x7')+_0x41e389,_0x4a679b);SmsInteractionEvents['on'](_0x41e389,_0x74b5c1);}}; \ No newline at end of file +var _0x1f5b=['remove','update','emit','removeListener','register','length','smsInteraction:','save'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0x1f5b,0x67));var _0xb1f5=function(_0x28c5dd,_0xb19524){_0x28c5dd=_0x28c5dd-0x0;var _0x3228d8=_0x1f5b[_0x28c5dd];return _0x3228d8;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xb1f5('0x0'),_0xb1f5('0x1'),_0xb1f5('0x2')];function createListener(_0x5cf82d,_0x5f06f9){return function(_0x1ceefd){_0x5f06f9[_0xb1f5('0x3')](_0x5cf82d,_0x1ceefd);};}function removeListener(_0x490bc4,_0xcb16e0){return function(){SmsInteractionEvents[_0xb1f5('0x4')](_0x490bc4,_0xcb16e0);};}exports[_0xb1f5('0x5')]=function(_0x30ead8){for(var _0x326df3=0x0,_0x225668=events[_0xb1f5('0x6')];_0x326df3<_0x225668;_0x326df3++){var _0x3e6b4e=events[_0x326df3];var _0x10ba8f=createListener(_0xb1f5('0x7')+_0x3e6b4e,_0x30ead8);SmsInteractionEvents['on'](_0x3e6b4e,_0x10ba8f);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d1c774a..60c3508 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 _0x1afa=['/:id/accept','accept','reject','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','put','update'];(function(_0x5e30d6,_0xf30797){var _0x427273=function(_0x4896e3){while(--_0x4896e3){_0x5e30d6['push'](_0x5e30d6['shift']());}};_0x427273(++_0xf30797);}(_0x1afa,0x70));var _0xa1af=function(_0x19fe31,_0x4664eb){_0x19fe31=_0x19fe31-0x0;var _0x1ed7d0=_0x1afa[_0x19fe31];return _0x1ed7d0;};'use strict';var multer=require(_0xa1af('0x0'));var util=require(_0xa1af('0x1'));var path=require(_0xa1af('0x2'));var timeout=require(_0xa1af('0x3'));var express=require(_0xa1af('0x4'));var router=express[_0xa1af('0x5')]();var fs_extra=require(_0xa1af('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa1af('0x7'));var config=require(_0xa1af('0x8'));var controller=require(_0xa1af('0x9'));router[_0xa1af('0xa')]('/',auth[_0xa1af('0xb')](),controller[_0xa1af('0xc')]);router[_0xa1af('0xa')]('/describe',auth[_0xa1af('0xb')](),controller['describe']);router['get'](_0xa1af('0xd'),auth['isAuthenticated'](),controller[_0xa1af('0xe')]);router['post']('/',auth[_0xa1af('0xb')](),interaction[_0xa1af('0xf')](_0xa1af('0x10'),_0xa1af('0x11')),controller[_0xa1af('0x12')]);router[_0xa1af('0x13')](_0xa1af('0x14'),controller['status']);router[_0xa1af('0x15')]('/:id',auth[_0xa1af('0xb')](),controller[_0xa1af('0x16')]);router['put'](_0xa1af('0x17'),auth[_0xa1af('0xb')](),controller[_0xa1af('0x18')]);router['put']('/:id/reject',auth[_0xa1af('0xb')](),controller[_0xa1af('0x19')]);router['delete'](_0xa1af('0xd'),auth[_0xa1af('0xb')](),controller[_0xa1af('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xe5a9=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','/:id','show','tracked','sms','post','status','put','update','/:id/accept','accept','reject','delete'];(function(_0x563742,_0x366f3c){var _0x1b9800=function(_0x3fba74){while(--_0x3fba74){_0x563742['push'](_0x563742['shift']());}};_0x1b9800(++_0x366f3c);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x37656f,_0x350ac6){_0x37656f=_0x37656f-0x0;var _0x5cd9d8=_0xe5a9[_0x37656f];return _0x5cd9d8;};'use strict';var multer=require('multer');var util=require(_0x9e5a('0x0'));var path=require(_0x9e5a('0x1'));var timeout=require(_0x9e5a('0x2'));var express=require(_0x9e5a('0x3'));var router=express[_0x9e5a('0x4')]();var fs_extra=require(_0x9e5a('0x5'));var auth=require(_0x9e5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e5a('0x7'));var controller=require(_0x9e5a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9e5a('0x9')](_0x9e5a('0xa'),auth[_0x9e5a('0xb')](),controller['describe']);router[_0x9e5a('0x9')](_0x9e5a('0xc'),auth[_0x9e5a('0xb')](),controller[_0x9e5a('0xd')]);router['post']('/',auth[_0x9e5a('0xb')](),interaction[_0x9e5a('0xe')](_0x9e5a('0xf'),'smsmessage:create'),controller['create']);router[_0x9e5a('0x10')]('/:id/status',controller[_0x9e5a('0x11')]);router[_0x9e5a('0x12')](_0x9e5a('0xc'),auth['isAuthenticated'](),controller[_0x9e5a('0x13')]);router[_0x9e5a('0x12')](_0x9e5a('0x14'),auth['isAuthenticated'](),controller[_0x9e5a('0x15')]);router[_0x9e5a('0x12')]('/:id/reject',auth[_0x9e5a('0xb')](),controller[_0x9e5a('0x16')]);router[_0x9e5a('0x17')](_0x9e5a('0xc'),auth[_0x9e5a('0xb')](),controller[_0x9e5a('0x18')]);module[_0x9e5a('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d232b24..17435ac 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 _0x0af1=['DATE','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0af1,0x135));var _0x10af=function(_0x1f3eed,_0x1df117){_0x1f3eed=_0x1f3eed-0x0;var _0x2d8813=_0x0af1[_0x1f3eed];return _0x2d8813;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x10af('0x0')](_0x10af('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x10af('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x10af('0x3')]('in','out'),'defaultValue':_0x10af('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x10af('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x10af('0x6')]},'secret':{'type':Sequelize[_0x10af('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x10af('0x0')]}}; \ No newline at end of file +var _0x01ad=['sequelize','TEXT','ENUM','out','STRING','DATE','BOOLEAN'];(function(_0x1e8e76,_0x4bcdce){var _0x42c56d=function(_0x49e34e){while(--_0x49e34e){_0x1e8e76['push'](_0x1e8e76['shift']());}};_0x42c56d(++_0x4bcdce);}(_0x01ad,0xd2));var _0xd01a=function(_0x5b1389,_0x3f0664){_0x5b1389=_0x5b1389-0x0;var _0x559a88=_0x01ad[_0x5b1389];return _0x559a88;};'use strict';var Sequelize=require(_0xd01a('0x0'));module['exports']={'body':{'type':Sequelize[_0xd01a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd01a('0x2')]('in',_0xd01a('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd01a('0x4')](0xbe)},'phone':{'type':Sequelize[_0xd01a('0x4')]},'readAt':{'type':Sequelize[_0xd01a('0x5')]},'secret':{'type':Sequelize[_0xd01a('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd01a('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index d9b7e91..18904a4 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 _0xed1c=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','params','keys','find','create','body','destroy','describe','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','email','internal','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model'];(function(_0x39edc8,_0x45c197){var _0x271318=function(_0x4f9231){while(--_0x4f9231){_0x39edc8['push'](_0x39edc8['shift']());}};_0x271318(++_0x45c197);}(_0xed1c,0xe4));var _0xced1=function(_0x2ed304,_0x2b69d9){_0x2ed304=_0x2ed304-0x0;var _0x4ce71=_0xed1c[_0x2ed304];return _0x4ce71;};'use strict';var emlformat=require(_0xced1('0x0'));var rimraf=require(_0xced1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xced1('0x2'));var Mustache=require(_0xced1('0x3'));var util=require(_0xced1('0x4'));var path=require('path');var sox=require(_0xced1('0x5'));var csv=require(_0xced1('0x6'));var ejs=require(_0xced1('0x7'));var fs=require('fs');var fs_extra=require(_0xced1('0x8'));var _=require('lodash');var squel=require(_0xced1('0x9'));var crypto=require(_0xced1('0xa'));var jsforce=require(_0xced1('0xb'));var deskjs=require(_0xced1('0xc'));var toCsv=require(_0xced1('0x6'));var querystring=require(_0xced1('0xd'));var Papa=require(_0xced1('0xe'));var Redis=require(_0xced1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xced1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xced1('0x11'));var logger=require(_0xced1('0x12'))(_0xced1('0x13'));var utils=require(_0xced1('0x14'));var config=require(_0xced1('0x15'));var licenseUtil=require(_0xced1('0x16'));var db=require(_0xced1('0x17'))['db'];config['redis']=_[_0xced1('0x18')](config[_0xced1('0x19')],{'host':_0xced1('0x1a'),'port':0x18eb});var socket=require(_0xced1('0x1b'))(new Redis(config['redis']));require(_0xced1('0x1c'))[_0xced1('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xced1('0x1e')][_0xced1('0x1f')]({'port':0x232c});var client9002=jayson[_0xced1('0x1e')][_0xced1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x47baec,_0x5560af,_0x3eb3ac,_0x4178d8){return new BPromise(function(_0x236473,_0x17e8ab){var _0x3e53bd=_0x4178d8||client;return _0x3e53bd[_0xced1('0x20')](_0x47baec,_0x3eb3ac)['then'](function(_0x56fc50){logger[_0xced1('0x21')](_0xced1('0x22'),_0x5560af,_0xced1('0x23'));logger['debug'](_0xced1('0x24'),_0x5560af,_0xced1('0x23'),JSON[_0xced1('0x25')](_0x56fc50));if(_0x56fc50['error']){if(_0x56fc50[_0xced1('0x26')][_0xced1('0x27')]===0x1f4){logger[_0xced1('0x26')]('SmsMessage,\x20%s,\x20%s',_0x5560af,_0x56fc50[_0xced1('0x26')][_0xced1('0x28')]);return _0x17e8ab(_0x56fc50[_0xced1('0x26')]['message']);}logger['error'](_0xced1('0x22'),_0x5560af,_0x56fc50[_0xced1('0x26')][_0xced1('0x28')]);return _0x236473(_0x56fc50[_0xced1('0x26')][_0xced1('0x28')]);}else{logger['info'](_0xced1('0x22'),_0x5560af,_0xced1('0x23'));_0x236473(_0x56fc50['result']['message']);}})[_0xced1('0x29')](function(_0x258c9a){logger[_0xced1('0x26')](_0xced1('0x22'),_0x5560af,_0x258c9a);_0x17e8ab(_0x258c9a);});});}function respondWithStatusCode(_0x1c2ba7,_0x25b6e7){_0x25b6e7=_0x25b6e7||0xcc;return function(_0x50c543){if(_0x50c543){return _0x1c2ba7[_0xced1('0x2a')](_0x25b6e7);}return _0x1c2ba7[_0xced1('0x2b')](_0x25b6e7)[_0xced1('0x2c')]();};}function respondWithResult(_0x351afc,_0x34dd2e){_0x34dd2e=_0x34dd2e||0xc8;return function(_0x8b3ffb){if(_0x8b3ffb){return _0x351afc[_0xced1('0x2b')](_0x34dd2e)['json'](_0x8b3ffb);}};}function respondWithFilteredResult(_0x15c4f4,_0x4ef64e){return function(_0x45cb03){if(_0x45cb03){var _0x2c2269=typeof _0x4ef64e[_0xced1('0x2d')]===_0xced1('0x2e')&&typeof _0x4ef64e['limit']==='undefined';var _0xec7760=_0x45cb03[_0xced1('0x2f')];var _0x2bc785=_0x2c2269?0x0:_0x4ef64e['offset'];var _0x573146=_0x2c2269?_0x45cb03['count']:_0x4ef64e[_0xced1('0x2d')]+_0x4ef64e[_0xced1('0x30')];var _0x2a6197;if(_0x573146>=_0xec7760){_0x573146=_0xec7760;_0x2a6197=0xc8;}else{_0x2a6197=0xce;}_0x15c4f4[_0xced1('0x2b')](_0x2a6197);return _0x15c4f4['set'](_0xced1('0x31'),_0x2bc785+'-'+_0x573146+'/'+_0xec7760)[_0xced1('0x32')](_0x45cb03);}return null;};}function patchUpdates(_0x46b672){return function(_0x2109c4){try{jsonpatch[_0xced1('0x33')](_0x2109c4,_0x46b672,!![]);}catch(_0x33ac43){return BPromise[_0xced1('0x34')](_0x33ac43);}return _0x2109c4['save']();};}function saveUpdates(_0x5453e6,_0x31f14e){return function(_0x2091f6){if(_0x2091f6){return _0x2091f6[_0xced1('0x35')](_0x5453e6)[_0xced1('0x36')](function(_0x63d21e){return _0x63d21e;});}return null;};}function removeEntity(_0x3eb109,_0x512c76){return function(_0x486562){if(_0x486562){return _0x486562['destroy']()['then'](function(){_0x3eb109[_0xced1('0x2b')](0xcc)[_0xced1('0x2c')]();});}};}function handleEntityNotFound(_0x1b68a8,_0x12da46){return function(_0x5c76bb){if(!_0x5c76bb){_0x1b68a8[_0xced1('0x2a')](0x194);}return _0x5c76bb;};}function handleError(_0x3c32c5,_0x11205e){_0x11205e=_0x11205e||0x1f4;return function(_0x4021de){logger[_0xced1('0x26')](_0x4021de[_0xced1('0x37')]);if(_0x4021de[_0xced1('0x38')]){delete _0x4021de[_0xced1('0x38')];}_0x3c32c5['status'](_0x11205e)[_0xced1('0x39')](_0x4021de);};}exports[_0xced1('0x3a')]=function(_0x1116de,_0x376927){var _0x3bdc6f={},_0x1bfd61={},_0x4b8187={'count':0x0,'rows':[]};var _0xc7afa1=_[_0xced1('0x3b')](db[_0xced1('0x3c')][_0xced1('0x3d')],function(_0x282361){return{'name':_0x282361[_0xced1('0x3e')],'type':_0x282361[_0xced1('0x3f')][_0xced1('0x40')]};});_0x1bfd61[_0xced1('0x41')]=_[_0xced1('0x3b')](_0xc7afa1,_0xced1('0x38'));_0x1bfd61['query']=_['keys'](_0x1116de[_0xced1('0x42')]);_0x1bfd61[_0xced1('0x43')]=_[_0xced1('0x44')](_0x1bfd61['model'],_0x1bfd61[_0xced1('0x42')]);_0x3bdc6f[_0xced1('0x45')]=_[_0xced1('0x44')](_0x1bfd61['model'],qs[_0xced1('0x46')](_0x1116de[_0xced1('0x42')]['fields']));_0x3bdc6f[_0xced1('0x45')]=_0x3bdc6f['attributes'][_0xced1('0x47')]?_0x3bdc6f[_0xced1('0x45')]:_0x1bfd61['model'];if(!_0x1116de[_0xced1('0x42')][_0xced1('0x48')](_0xced1('0x49'))){_0x3bdc6f['limit']=qs[_0xced1('0x30')](_0x1116de[_0xced1('0x42')]['limit']);_0x3bdc6f[_0xced1('0x2d')]=qs['offset'](_0x1116de['query'][_0xced1('0x2d')]);}_0x3bdc6f['order']=qs[_0xced1('0x4a')](_0x1116de[_0xced1('0x42')][_0xced1('0x4a')]);_0x3bdc6f['where']=qs[_0xced1('0x43')](_['pick'](_0x1116de[_0xced1('0x42')],_0x1bfd61[_0xced1('0x43')]),_0xc7afa1);if(_0x1116de[_0xced1('0x42')][_0xced1('0x4b')]){_0x3bdc6f['where']=_[_0xced1('0x4c')](_0x3bdc6f[_0xced1('0x4d')],{'$or':_['map'](_0xc7afa1,function(_0x4733f0){if(_0x4733f0[_0xced1('0x3f')]!=='VIRTUAL'){var _0x1800c8={};_0x1800c8[_0x4733f0[_0xced1('0x38')]]={'$like':'%'+_0x1116de[_0xced1('0x42')]['filter']+'%'};return _0x1800c8;}})});}_0x3bdc6f=_[_0xced1('0x4c')]({},_0x3bdc6f,_0x1116de[_0xced1('0x4e')]);var _0x39fc4a={'where':_0x3bdc6f[_0xced1('0x4d')]};return db[_0xced1('0x3c')]['count'](_0x39fc4a)[_0xced1('0x36')](function(_0x5e6669){_0x4b8187[_0xced1('0x2f')]=_0x5e6669;if(_0x1116de[_0xced1('0x42')][_0xced1('0x4f')]){_0x3bdc6f[_0xced1('0x50')]=[{'all':!![]}];}return db[_0xced1('0x3c')][_0xced1('0x51')](_0x3bdc6f);})['then'](function(_0x3570ff){_0x4b8187[_0xced1('0x52')]=_0x3570ff;return _0x4b8187;})['then'](respondWithFilteredResult(_0x376927,_0x3bdc6f))[_0xced1('0x29')](handleError(_0x376927,null));};exports['show']=function(_0x5153a6,_0x296d62){var _0x43d982={'raw':!![],'where':{'id':_0x5153a6[_0xced1('0x53')]['id']}},_0x1b3a1c={};_0x1b3a1c['model']=_[_0xced1('0x54')](db[_0xced1('0x3c')][_0xced1('0x3d')]);_0x1b3a1c['query']=_['keys'](_0x5153a6[_0xced1('0x42')]);_0x1b3a1c[_0xced1('0x43')]=_[_0xced1('0x44')](_0x1b3a1c[_0xced1('0x41')],_0x1b3a1c['query']);_0x43d982['attributes']=_['intersection'](_0x1b3a1c[_0xced1('0x41')],qs[_0xced1('0x46')](_0x5153a6[_0xced1('0x42')][_0xced1('0x46')]));_0x43d982[_0xced1('0x45')]=_0x43d982[_0xced1('0x45')][_0xced1('0x47')]?_0x43d982[_0xced1('0x45')]:_0x1b3a1c[_0xced1('0x41')];if(_0x5153a6['query'][_0xced1('0x4f')]){_0x43d982[_0xced1('0x50')]=[{'all':!![]}];}_0x43d982=_[_0xced1('0x4c')]({},_0x43d982,_0x5153a6['options']);return db[_0xced1('0x3c')][_0xced1('0x55')](_0x43d982)[_0xced1('0x36')](handleEntityNotFound(_0x296d62,null))[_0xced1('0x36')](respondWithResult(_0x296d62,null))['catch'](handleError(_0x296d62,null));};exports[_0xced1('0x56')]=function(_0x4e96eb,_0x539ee2){return db[_0xced1('0x3c')][_0xced1('0x56')](_0x4e96eb['body'],{})['then'](respondWithResult(_0x539ee2,0xc9))['catch'](handleError(_0x539ee2,null));};exports[_0xced1('0x35')]=function(_0x5dfcf4,_0x1af125){if(_0x5dfcf4[_0xced1('0x57')]['id']){delete _0x5dfcf4[_0xced1('0x57')]['id'];}return db[_0xced1('0x3c')][_0xced1('0x55')]({'where':{'id':_0x5dfcf4[_0xced1('0x53')]['id']}})[_0xced1('0x36')](handleEntityNotFound(_0x1af125,null))[_0xced1('0x36')](saveUpdates(_0x5dfcf4['body'],null))['then'](respondWithResult(_0x1af125,null))[_0xced1('0x29')](handleError(_0x1af125,null));};exports[_0xced1('0x58')]=function(_0x235651,_0x34262e){return db['SmsMessage'][_0xced1('0x55')]({'where':{'id':_0x235651[_0xced1('0x53')]['id']}})[_0xced1('0x36')](handleEntityNotFound(_0x34262e,null))[_0xced1('0x36')](removeEntity(_0x34262e,null))['catch'](handleError(_0x34262e,null));};exports[_0xced1('0x59')]=function(_0x2abd02,_0xf0d72a){return db[_0xced1('0x3c')][_0xced1('0x59')]()[_0xced1('0x36')](respondWithResult(_0xf0d72a,null))[_0xced1('0x29')](handleError(_0xf0d72a,null));};var interaction_log=require(_0xced1('0x12'))('sms-interactions');exports['accept']=function(_0x4cc559,_0x440b22,_0x52e873){var _0x398264={'agent':{},'channel':'sms'};if(_0x4cc559['body']['id']){delete _0x4cc559[_0xced1('0x57')]['id'];}_0x4cc559[_0xced1('0x57')][_0xced1('0x5a')]=!![];_0x4cc559[_0xced1('0x57')][_0xced1('0x5b')]=moment()[_0xced1('0x5c')](_0xced1('0x5d'));_0x4cc559[_0xced1('0x57')][_0xced1('0x5e')]=_0x4cc559[_0xced1('0x57')][_0xced1('0x5e')]||_0x4cc559['user']['id'];_0x398264[_0xced1('0x5f')]['id']=_0x4cc559[_0xced1('0x57')]['UserId'];return db[_0xced1('0x3c')][_0xced1('0x55')]({'where':{'id':_0x4cc559['params']['id'],'UserId':null}})[_0xced1('0x36')](handleEntityNotFound(_0x440b22,null))[_0xced1('0x36')](saveUpdates(_0x4cc559[_0xced1('0x57')],null))[_0xced1('0x36')](function(_0x16a7ce){if(_0x16a7ce){_0x398264['message']=_0x16a7ce['get']({'plain':!![]});return db['SmsInteraction'][_0xced1('0x55')]({'where':{'id':_0x16a7ce[_0xced1('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x440b22,null))[_0xced1('0x36')](function(_0x10447b){if(_0x10447b){return _0x10447b[_0xced1('0x35')]({'UserId':_0x4cc559['body'][_0xced1('0x5e')],'read1stAt':_[_0xced1('0x61')](_0x10447b['read1stAt'])?moment()[_0xced1('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xced1('0x36')](function(_0x355046){if(_0x355046){_0x398264[_0xced1('0x62')]=_0x355046[_0xced1('0x63')]({'plain':!![]});interaction_log[_0xced1('0x21')](_0xced1('0x64'),_0x4cc559[_0xced1('0x65')]['id'],_0x4cc559['user'][_0xced1('0x38')],_0x4cc559[_0xced1('0x65')][_0xced1('0x66')],_0x398264['interaction']['id'],_0x4cc559['body']?JSON[_0xced1('0x25')](_0x4cc559[_0xced1('0x57')]):'null');return respondWithRpcPromise(_0xced1('0x67'),_0xced1('0x68'),_0x398264);}return null;})[_0xced1('0x36')](function(_0x51c879){var _0x57107b=_0xced1('0x69')+_0x51c879[_0xced1('0x28')][_0xced1('0x6a')];return db[_0xced1('0x6b')][_0xced1('0x42')](_0x57107b,{'type':db[_0xced1('0x6c')]['QueryTypes'][_0xced1('0x6d')],'raw':!![]})['then'](function(_0x513315){return _0x513315;});})['then'](function(_0x4ae2af){if(_0x4ae2af){_0x398264[_0xced1('0x28')][_0xced1('0x6e')]=_0x4ae2af[0x0];if(!_0x4cc559['body']['UserId'])return;return db[_0xced1('0x6f')][_0xced1('0x55')]({'where':{'id':_0x4cc559['body']['UserId'],'role':_0xced1('0x5f')},'attributes':['id',_0xced1('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x45bc94){if(!_0x45bc94)return null;_0x398264[_0xced1('0x28')][_0xced1('0x5f')]=_0x45bc94;return _0x398264;})[_0xced1('0x36')](function(_0x3314e4){if(_0x3314e4){if(_0x4cc559[_0xced1('0x57')]['manual']){_0x398264[_0xced1('0x28')][_0xced1('0x70')]=util[_0xced1('0x5c')](_0xced1('0x71'),_0x4cc559[_0xced1('0x65')][_0xced1('0x38')]);_0x398264[_0xced1('0x28')][_0xced1('0x72')]=_0x398264[_0xced1('0x72')];_0x398264['message']['motionChannel']=_0x398264[_0xced1('0x72')];_0x398264['message'][_0xced1('0x73')]='accept';return respondWithRpcPromise(_0xced1('0x74'),_0xced1('0x74'),{'event':_0xced1('0x75'),'message':_0x398264[_0xced1('0x28')]},client9002)[_0xced1('0x36')](function(){return _0x398264;});}return _0x398264;}return null;})[_0xced1('0x36')](respondWithResult(_0x440b22,null))['catch'](handleError(_0x440b22,null));};var interaction_log=require(_0xced1('0x12'))(_0xced1('0x76'));exports[_0xced1('0x34')]=function(_0x3e7070,_0x137460,_0x2ec441){var _0x4fc259={'agent':{},'channel':'sms'};if(_0x3e7070[_0xced1('0x57')]['id']){delete _0x3e7070[_0xced1('0x57')]['id'];}_0x3e7070[_0xced1('0x57')][_0xced1('0x5e')]=_0x3e7070[_0xced1('0x57')]['UserId']||_0x3e7070[_0xced1('0x65')]['id'];_0x4fc259[_0xced1('0x5f')]['id']=_0x3e7070[_0xced1('0x57')][_0xced1('0x5e')];return db['SmsMessage'][_0xced1('0x55')]({'where':{'id':_0x3e7070[_0xced1('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x137460,null))[_0xced1('0x36')](function(_0x5854ee){if(_0x5854ee){_0x4fc259[_0xced1('0x28')]=_0x5854ee[_0xced1('0x63')]({'plain':!![]});return db[_0xced1('0x77')][_0xced1('0x55')]({'where':{'id':_0x5854ee[_0xced1('0x60')]}});}return null;})[_0xced1('0x36')](handleEntityNotFound(_0x137460,null))[_0xced1('0x36')](function(_0x17137e){if(_0x17137e){_0x4fc259[_0xced1('0x62')]=_0x17137e[_0xced1('0x63')]({'plain':!![]});interaction_log['info'](_0xced1('0x78'),_0x3e7070[_0xced1('0x65')]['id'],_0x3e7070[_0xced1('0x65')][_0xced1('0x38')],_0x3e7070['user'][_0xced1('0x66')],_0x4fc259[_0xced1('0x62')]['id'],_0x3e7070[_0xced1('0x57')]?JSON[_0xced1('0x25')](_0x3e7070['body']):_0xced1('0x79'));return respondWithRpcPromise(_0xced1('0x7a'),_0xced1('0x7b'),_0x4fc259);}return null;})[_0xced1('0x36')](function(_0x3beefd){var _0x4fa469=_0xced1('0x69')+_0x3beefd['message'][_0xced1('0x6a')];return db[_0xced1('0x6b')][_0xced1('0x42')](_0x4fa469,{'type':db['Sequelize'][_0xced1('0x7c')][_0xced1('0x6d')],'raw':!![]})['then'](function(_0x217afb){return _0x217afb;});})['then'](function(_0xc4a5c8){if(_0xc4a5c8){_0x4fc259[_0xced1('0x28')][_0xced1('0x6e')]=_0xc4a5c8[0x0];if(!_0x3e7070['body']['UserId'])return;return db[_0xced1('0x6f')][_0xced1('0x55')]({'where':{'id':_0x3e7070[_0xced1('0x57')][_0xced1('0x5e')],'role':_0xced1('0x5f')},'attributes':['id','name','fullname',_0xced1('0x7d'),_0xced1('0x7e')],'raw':!![]});}return null;})[_0xced1('0x36')](function(_0x4cf606){if(!_0x4cf606)return null;_0x4fc259[_0xced1('0x28')]['agent']=_0x4cf606;return _0x4fc259;})['then'](function(_0xd54ed3){if(_0xd54ed3){_0xd54ed3['message'][_0xced1('0x70')]=util['format'](_0xced1('0x71'),_0x3e7070[_0xced1('0x65')][_0xced1('0x38')]);_0xd54ed3[_0xced1('0x28')][_0xced1('0x72')]=_0x4fc259[_0xced1('0x72')];_0xd54ed3[_0xced1('0x28')]['motionChannel']=_0x4fc259['channel'];_0xd54ed3[_0xced1('0x28')][_0xced1('0x73')]=_0xced1('0x34');respondWithRpcPromise(_0xced1('0x74'),'EventManager',{'event':'rejectmessage','message':_0xd54ed3[_0xced1('0x28')]},client9002);return _0x4fc259;}return null;})['then'](respondWithResult(_0x137460,null))[_0xced1('0x29')](handleError(_0x137460,null));};exports[_0xced1('0x2b')]=function(_0x36184c,_0x4e13d1,_0x41f0a6){if(_0x36184c[_0xced1('0x57')]['id']){delete _0x36184c['body']['id'];}var _0x2e1c96;return db[_0xced1('0x3c')][_0xced1('0x55')]({'where':{'id':_0x36184c['params']['id']}})[_0xced1('0x36')](handleEntityNotFound(_0x4e13d1,null))[_0xced1('0x36')](function(_0x273987){if(_0x273987){_0x2e1c96=_0x273987;return db[_0xced1('0x7f')][_0xced1('0x55')]({'where':{'id':_0x273987[_0xced1('0x80')]}});}})['then'](handleEntityNotFound(_0x4e13d1,null))['then'](function(_0x35aefb){if(_0x35aefb){logger[_0xced1('0x81')](_0xced1('0x24'),_0xced1('0x2b'),_0xced1('0x82'),_0x35aefb[_0xced1('0x3f')],util[_0xced1('0x83')](_0x36184c[_0xced1('0x57')],{'showHidden':![],'depth':null}));switch(_0x35aefb[_0xced1('0x3f')]){case _0xced1('0x84'):if(_0x36184c[_0xced1('0x57')]['MessageSid']&&_0x36184c['body'][_0xced1('0x85')]===_0x2e1c96[_0xced1('0x86')]){return _0x2e1c96[_0xced1('0x35')]({'read':!![]});}else{logger[_0xced1('0x26')](_0xced1('0x87'),_0xced1('0x2b'),_0xced1('0x84'),util[_0xced1('0x83')](_0x36184c[_0xced1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xced1('0x88'):if(_0x36184c[_0xced1('0x57')][_0xced1('0x89')]&&_0x36184c[_0xced1('0x57')][_0xced1('0x89')]===_0x2e1c96[_0xced1('0x86')]&&_[_0xced1('0x8a')]([_0xced1('0x8b'),_0xced1('0x8c')],_0x36184c['body'][_0xced1('0x8d')])>=0x0){return _0x2e1c96['update']({'read':!![]});}else{logger[_0xced1('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xced1('0x2b'),_0xced1('0x8e'),util[_0xced1('0x83')](_0x36184c[_0xced1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xced1('0x8f'):var _0x3a0f4b=_0x36184c[_0xced1('0x57')][_0xced1('0x90')][0x0];if(_0x3a0f4b[_0xced1('0x2b')][_0xced1('0x91')]===_0xced1('0x92')){return _0x2e1c96[_0xced1('0x35')]({'read':!![]});}else{logger[_0xced1('0x26')](_0xced1('0x87'),_0xced1('0x2b'),_0xced1('0x8f'),util[_0xced1('0x83')](_0x36184c[_0xced1('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x2e1c96;}})[_0xced1('0x36')](respondWithResult(_0x4e13d1,null))[_0xced1('0x29')](handleError(_0x4e13d1,null));}; \ No newline at end of file +var _0xc599=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','name','send','map','SmsMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','keys','rawAttributes','includeAll','find','create','body','update','describe','../../config/logger','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','infobip','groupName','DELIVERED','rimraf'];(function(_0x1a3042,_0x5a995b){var _0x16cc6a=function(_0x4f47ab){while(--_0x4f47ab){_0x1a3042['push'](_0x1a3042['shift']());}};_0x16cc6a(++_0x5a995b);}(_0xc599,0x1b2));var _0x9c59=function(_0x5be40e,_0x12997e){_0x5be40e=_0x5be40e-0x0;var _0x3db6e1=_0xc599[_0x5be40e];return _0x3db6e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c59('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c59('0x1'));var rp=require(_0x9c59('0x2'));var moment=require(_0x9c59('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c59('0x4'));var util=require(_0x9c59('0x5'));var path=require(_0x9c59('0x6'));var sox=require(_0x9c59('0x7'));var csv=require(_0x9c59('0x8'));var ejs=require(_0x9c59('0x9'));var fs=require('fs');var fs_extra=require(_0x9c59('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9c59('0xd'));var Papa=require(_0x9c59('0xe'));var Redis=require(_0x9c59('0xf'));var authService=require(_0x9c59('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c59('0x11'));var logger=require('../../config/logger')(_0x9c59('0x12'));var utils=require('../../config/utils');var config=require(_0x9c59('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c59('0x14'))['db'];config[_0x9c59('0x15')]=_[_0x9c59('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x9c59('0x17')](socket);var jayson=require(_0x9c59('0x18'));var client=jayson[_0x9c59('0x19')][_0x9c59('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x9c59('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4019ae,_0x1d07fd,_0x562069,_0x5792d3){return new BPromise(function(_0x4d6ca7,_0x5c5a86){var _0x36983f=_0x5792d3||client;return _0x36983f[_0x9c59('0x1b')](_0x4019ae,_0x562069)[_0x9c59('0x1c')](function(_0x3faae5){logger[_0x9c59('0x1d')](_0x9c59('0x1e'),_0x1d07fd,_0x9c59('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1d07fd,'request\x20sent',JSON[_0x9c59('0x20')](_0x3faae5));if(_0x3faae5[_0x9c59('0x21')]){if(_0x3faae5[_0x9c59('0x21')][_0x9c59('0x22')]===0x1f4){logger['error'](_0x9c59('0x1e'),_0x1d07fd,_0x3faae5['error'][_0x9c59('0x23')]);return _0x5c5a86(_0x3faae5[_0x9c59('0x21')]['message']);}logger[_0x9c59('0x21')](_0x9c59('0x1e'),_0x1d07fd,_0x3faae5[_0x9c59('0x21')][_0x9c59('0x23')]);return _0x4d6ca7(_0x3faae5[_0x9c59('0x21')]['message']);}else{logger[_0x9c59('0x1d')](_0x9c59('0x1e'),_0x1d07fd,_0x9c59('0x1f'));_0x4d6ca7(_0x3faae5['result'][_0x9c59('0x23')]);}})[_0x9c59('0x24')](function(_0x335e36){logger[_0x9c59('0x21')]('SmsMessage,\x20%s,\x20%s',_0x1d07fd,_0x335e36);_0x5c5a86(_0x335e36);});});}function respondWithStatusCode(_0x41e458,_0x1960f0){_0x1960f0=_0x1960f0||0xcc;return function(_0x41f81c){if(_0x41f81c){return _0x41e458['sendStatus'](_0x1960f0);}return _0x41e458[_0x9c59('0x25')](_0x1960f0)[_0x9c59('0x26')]();};}function respondWithResult(_0x214dcb,_0x3da24a){_0x3da24a=_0x3da24a||0xc8;return function(_0x190793){if(_0x190793){return _0x214dcb['status'](_0x3da24a)[_0x9c59('0x27')](_0x190793);}};}function respondWithFilteredResult(_0x9e8833,_0x4f497d){return function(_0x5d3856){if(_0x5d3856){var _0x28fecc=typeof _0x4f497d[_0x9c59('0x28')]===_0x9c59('0x29')&&typeof _0x4f497d[_0x9c59('0x2a')]==='undefined';var _0x10b971=_0x5d3856[_0x9c59('0x2b')];var _0x5664a6=_0x28fecc?0x0:_0x4f497d[_0x9c59('0x28')];var _0x5479aa=_0x28fecc?_0x5d3856[_0x9c59('0x2b')]:_0x4f497d[_0x9c59('0x28')]+_0x4f497d[_0x9c59('0x2a')];var _0x13387f;if(_0x5479aa>=_0x10b971){_0x5479aa=_0x10b971;_0x13387f=0xc8;}else{_0x13387f=0xce;}_0x9e8833[_0x9c59('0x25')](_0x13387f);return _0x9e8833[_0x9c59('0x2c')](_0x9c59('0x2d'),_0x5664a6+'-'+_0x5479aa+'/'+_0x10b971)[_0x9c59('0x27')](_0x5d3856);}return null;};}function patchUpdates(_0x2ac265){return function(_0x41726e){try{jsonpatch[_0x9c59('0x2e')](_0x41726e,_0x2ac265,!![]);}catch(_0xedf388){return BPromise[_0x9c59('0x2f')](_0xedf388);}return _0x41726e['save']();};}function saveUpdates(_0x46558b,_0x2ea01a){return function(_0x565184){if(_0x565184){return _0x565184['update'](_0x46558b)[_0x9c59('0x1c')](function(_0x288f12){return _0x288f12;});}return null;};}function removeEntity(_0x2c4d54,_0x3b9aa5){return function(_0x56434e){if(_0x56434e){return _0x56434e[_0x9c59('0x30')]()[_0x9c59('0x1c')](function(){_0x2c4d54['status'](0xcc)[_0x9c59('0x26')]();});}};}function handleEntityNotFound(_0x435d67,_0x47c725){return function(_0x145d4c){if(!_0x145d4c){_0x435d67['sendStatus'](0x194);}return _0x145d4c;};}function handleError(_0x2fc643,_0x122e8b){_0x122e8b=_0x122e8b||0x1f4;return function(_0x4b8eca){logger[_0x9c59('0x21')](_0x4b8eca['stack']);if(_0x4b8eca['name']){delete _0x4b8eca[_0x9c59('0x31')];}_0x2fc643['status'](_0x122e8b)[_0x9c59('0x32')](_0x4b8eca);};}exports['index']=function(_0x547718,_0x490f6e){var _0x3c0280={},_0x25d14a={},_0x30ca33={'count':0x0,'rows':[]};var _0x261c1e=_[_0x9c59('0x33')](db[_0x9c59('0x34')]['rawAttributes'],function(_0xeb9134){return{'name':_0xeb9134['fieldName'],'type':_0xeb9134[_0x9c59('0x35')][_0x9c59('0x36')]};});_0x25d14a[_0x9c59('0x37')]=_[_0x9c59('0x33')](_0x261c1e,_0x9c59('0x31'));_0x25d14a[_0x9c59('0x38')]=_['keys'](_0x547718[_0x9c59('0x38')]);_0x25d14a[_0x9c59('0x39')]=_[_0x9c59('0x3a')](_0x25d14a[_0x9c59('0x37')],_0x25d14a[_0x9c59('0x38')]);_0x3c0280[_0x9c59('0x3b')]=_['intersection'](_0x25d14a[_0x9c59('0x37')],qs[_0x9c59('0x3c')](_0x547718[_0x9c59('0x38')]['fields']));_0x3c0280[_0x9c59('0x3b')]=_0x3c0280[_0x9c59('0x3b')][_0x9c59('0x3d')]?_0x3c0280[_0x9c59('0x3b')]:_0x25d14a['model'];if(!_0x547718[_0x9c59('0x38')][_0x9c59('0x3e')](_0x9c59('0x3f'))){_0x3c0280[_0x9c59('0x2a')]=qs[_0x9c59('0x2a')](_0x547718[_0x9c59('0x38')]['limit']);_0x3c0280['offset']=qs['offset'](_0x547718['query'][_0x9c59('0x28')]);}_0x3c0280[_0x9c59('0x40')]=qs[_0x9c59('0x41')](_0x547718[_0x9c59('0x38')][_0x9c59('0x41')]);_0x3c0280['where']=qs['filters'](_[_0x9c59('0x42')](_0x547718[_0x9c59('0x38')],_0x25d14a[_0x9c59('0x39')]),_0x261c1e);if(_0x547718[_0x9c59('0x38')][_0x9c59('0x43')]){_0x3c0280[_0x9c59('0x44')]=_[_0x9c59('0x45')](_0x3c0280[_0x9c59('0x44')],{'$or':_[_0x9c59('0x33')](_0x261c1e,function(_0x169ded){if(_0x169ded[_0x9c59('0x35')]!==_0x9c59('0x46')){var _0x49f31d={};_0x49f31d[_0x169ded[_0x9c59('0x31')]]={'$like':'%'+_0x547718[_0x9c59('0x38')]['filter']+'%'};return _0x49f31d;}})});}_0x3c0280=_[_0x9c59('0x45')]({},_0x3c0280,_0x547718[_0x9c59('0x47')]);var _0x390dca={'where':_0x3c0280[_0x9c59('0x44')]};return db[_0x9c59('0x34')][_0x9c59('0x2b')](_0x390dca)[_0x9c59('0x1c')](function(_0x2188f7){_0x30ca33['count']=_0x2188f7;if(_0x547718[_0x9c59('0x38')]['includeAll']){_0x3c0280[_0x9c59('0x48')]=[{'all':!![]}];}return db[_0x9c59('0x34')][_0x9c59('0x49')](_0x3c0280);})[_0x9c59('0x1c')](function(_0x841640){_0x30ca33[_0x9c59('0x4a')]=_0x841640;return _0x30ca33;})[_0x9c59('0x1c')](respondWithFilteredResult(_0x490f6e,_0x3c0280))[_0x9c59('0x24')](handleError(_0x490f6e,null));};exports['show']=function(_0x2b9f99,_0x151d42){var _0x1bea98={'raw':!![],'where':{'id':_0x2b9f99[_0x9c59('0x4b')]['id']}},_0x405d65={};_0x405d65[_0x9c59('0x37')]=_[_0x9c59('0x4c')](db[_0x9c59('0x34')][_0x9c59('0x4d')]);_0x405d65['query']=_[_0x9c59('0x4c')](_0x2b9f99[_0x9c59('0x38')]);_0x405d65[_0x9c59('0x39')]=_[_0x9c59('0x3a')](_0x405d65['model'],_0x405d65[_0x9c59('0x38')]);_0x1bea98[_0x9c59('0x3b')]=_['intersection'](_0x405d65[_0x9c59('0x37')],qs['fields'](_0x2b9f99['query'][_0x9c59('0x3c')]));_0x1bea98[_0x9c59('0x3b')]=_0x1bea98[_0x9c59('0x3b')][_0x9c59('0x3d')]?_0x1bea98[_0x9c59('0x3b')]:_0x405d65['model'];if(_0x2b9f99[_0x9c59('0x38')][_0x9c59('0x4e')]){_0x1bea98[_0x9c59('0x48')]=[{'all':!![]}];}_0x1bea98=_[_0x9c59('0x45')]({},_0x1bea98,_0x2b9f99[_0x9c59('0x47')]);return db[_0x9c59('0x34')][_0x9c59('0x4f')](_0x1bea98)['then'](handleEntityNotFound(_0x151d42,null))[_0x9c59('0x1c')](respondWithResult(_0x151d42,null))[_0x9c59('0x24')](handleError(_0x151d42,null));};exports['create']=function(_0x280300,_0x373712){return db[_0x9c59('0x34')][_0x9c59('0x50')](_0x280300[_0x9c59('0x51')],{})['then'](respondWithResult(_0x373712,0xc9))[_0x9c59('0x24')](handleError(_0x373712,null));};exports[_0x9c59('0x52')]=function(_0xf31c4,_0xbf6918){if(_0xf31c4[_0x9c59('0x51')]['id']){delete _0xf31c4[_0x9c59('0x51')]['id'];}return db[_0x9c59('0x34')]['find']({'where':{'id':_0xf31c4['params']['id']}})[_0x9c59('0x1c')](handleEntityNotFound(_0xbf6918,null))[_0x9c59('0x1c')](saveUpdates(_0xf31c4[_0x9c59('0x51')],null))[_0x9c59('0x1c')](respondWithResult(_0xbf6918,null))[_0x9c59('0x24')](handleError(_0xbf6918,null));};exports['destroy']=function(_0x1acd80,_0x4cd16f){return db[_0x9c59('0x34')]['find']({'where':{'id':_0x1acd80[_0x9c59('0x4b')]['id']}})[_0x9c59('0x1c')](handleEntityNotFound(_0x4cd16f,null))[_0x9c59('0x1c')](removeEntity(_0x4cd16f,null))[_0x9c59('0x24')](handleError(_0x4cd16f,null));};exports[_0x9c59('0x53')]=function(_0x3f145e,_0x573837){return db['SmsMessage'][_0x9c59('0x53')]()[_0x9c59('0x1c')](respondWithResult(_0x573837,null))[_0x9c59('0x24')](handleError(_0x573837,null));};var interaction_log=require(_0x9c59('0x54'))('sms-interactions');exports[_0x9c59('0x55')]=function(_0x3ee0b2,_0x4c737b,_0x13aa5a){var _0x1af3d0={'agent':{},'channel':_0x9c59('0x56')};if(_0x3ee0b2[_0x9c59('0x51')]['id']){delete _0x3ee0b2[_0x9c59('0x51')]['id'];}_0x3ee0b2[_0x9c59('0x51')][_0x9c59('0x57')]=!![];_0x3ee0b2[_0x9c59('0x51')][_0x9c59('0x58')]=moment()[_0x9c59('0x59')](_0x9c59('0x5a'));_0x3ee0b2[_0x9c59('0x51')]['UserId']=_0x3ee0b2['body'][_0x9c59('0x5b')]||_0x3ee0b2['user']['id'];_0x1af3d0[_0x9c59('0x5c')]['id']=_0x3ee0b2[_0x9c59('0x51')][_0x9c59('0x5b')];return db['SmsMessage'][_0x9c59('0x4f')]({'where':{'id':_0x3ee0b2[_0x9c59('0x4b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c737b,null))[_0x9c59('0x1c')](saveUpdates(_0x3ee0b2[_0x9c59('0x51')],null))[_0x9c59('0x1c')](function(_0x6313fe){if(_0x6313fe){_0x1af3d0[_0x9c59('0x23')]=_0x6313fe[_0x9c59('0x5d')]({'plain':!![]});return db[_0x9c59('0x5e')]['find']({'where':{'id':_0x6313fe[_0x9c59('0x5f')]}});}return null;})[_0x9c59('0x1c')](handleEntityNotFound(_0x4c737b,null))[_0x9c59('0x1c')](function(_0x3f6077){if(_0x3f6077){return _0x3f6077[_0x9c59('0x52')]({'UserId':_0x3ee0b2[_0x9c59('0x51')][_0x9c59('0x5b')],'read1stAt':_[_0x9c59('0x60')](_0x3f6077[_0x9c59('0x61')])?moment()['format'](_0x9c59('0x5a')):undefined});}return null;})[_0x9c59('0x1c')](function(_0x143a81){if(_0x143a81){_0x1af3d0['interaction']=_0x143a81[_0x9c59('0x5d')]({'plain':!![]});interaction_log['info'](_0x9c59('0x62'),_0x3ee0b2[_0x9c59('0x63')]['id'],_0x3ee0b2[_0x9c59('0x63')][_0x9c59('0x31')],_0x3ee0b2[_0x9c59('0x63')][_0x9c59('0x64')],_0x1af3d0[_0x9c59('0x65')]['id'],_0x3ee0b2['body']?JSON[_0x9c59('0x20')](_0x3ee0b2['body']):_0x9c59('0x66'));return respondWithRpcPromise(_0x9c59('0x67'),_0x9c59('0x68'),_0x1af3d0);}return null;})[_0x9c59('0x1c')](function(_0xd61c21){var _0x5f3210=_0x9c59('0x69')+_0xd61c21[_0x9c59('0x23')][_0x9c59('0x6a')];return db[_0x9c59('0x6b')]['query'](_0x5f3210,{'type':db[_0x9c59('0x6c')][_0x9c59('0x6d')][_0x9c59('0x6e')],'raw':!![]})[_0x9c59('0x1c')](function(_0x1b7ed){return _0x1b7ed;});})[_0x9c59('0x1c')](function(_0x240b13){if(_0x240b13){_0x1af3d0[_0x9c59('0x23')]['contact']=_0x240b13[0x0];if(!_0x3ee0b2['body'][_0x9c59('0x5b')])return;return db[_0x9c59('0x6f')][_0x9c59('0x4f')]({'where':{'id':_0x3ee0b2[_0x9c59('0x51')][_0x9c59('0x5b')],'role':'agent'},'attributes':['id',_0x9c59('0x31'),_0x9c59('0x70'),_0x9c59('0x71'),_0x9c59('0x72')],'raw':!![]});}return null;})[_0x9c59('0x1c')](function(_0x3a920b){if(!_0x3a920b)return null;_0x1af3d0[_0x9c59('0x23')][_0x9c59('0x5c')]=_0x3a920b;return _0x1af3d0;})[_0x9c59('0x1c')](function(_0x165281){if(_0x165281){if(_0x3ee0b2['body'][_0x9c59('0x73')]){_0x1af3d0[_0x9c59('0x23')][_0x9c59('0x74')]=util['format'](_0x9c59('0x75'),_0x3ee0b2[_0x9c59('0x63')][_0x9c59('0x31')]);_0x1af3d0[_0x9c59('0x23')]['channel']=_0x1af3d0[_0x9c59('0x76')];_0x1af3d0['message'][_0x9c59('0x77')]=_0x1af3d0[_0x9c59('0x76')];_0x1af3d0[_0x9c59('0x23')][_0x9c59('0x78')]=_0x9c59('0x55');return respondWithRpcPromise(_0x9c59('0x79'),_0x9c59('0x79'),{'event':_0x9c59('0x7a'),'message':_0x1af3d0['message']},client9002)['then'](function(){return _0x1af3d0;});}return _0x1af3d0;}return null;})['then'](respondWithResult(_0x4c737b,null))[_0x9c59('0x24')](handleError(_0x4c737b,null));};var interaction_log=require(_0x9c59('0x54'))(_0x9c59('0x7b'));exports[_0x9c59('0x2f')]=function(_0x1f04fb,_0x4e4197,_0xeb6cd3){var _0x2ca6be={'agent':{},'channel':'sms'};if(_0x1f04fb[_0x9c59('0x51')]['id']){delete _0x1f04fb[_0x9c59('0x51')]['id'];}_0x1f04fb[_0x9c59('0x51')][_0x9c59('0x5b')]=_0x1f04fb[_0x9c59('0x51')][_0x9c59('0x5b')]||_0x1f04fb[_0x9c59('0x63')]['id'];_0x2ca6be[_0x9c59('0x5c')]['id']=_0x1f04fb[_0x9c59('0x51')][_0x9c59('0x5b')];return db[_0x9c59('0x34')][_0x9c59('0x4f')]({'where':{'id':_0x1f04fb[_0x9c59('0x4b')]['id'],'UserId':null}})[_0x9c59('0x1c')](handleEntityNotFound(_0x4e4197,null))['then'](function(_0x454940){if(_0x454940){_0x2ca6be[_0x9c59('0x23')]=_0x454940[_0x9c59('0x5d')]({'plain':!![]});return db[_0x9c59('0x5e')][_0x9c59('0x4f')]({'where':{'id':_0x454940[_0x9c59('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x4e4197,null))['then'](function(_0x22b2ea){if(_0x22b2ea){_0x2ca6be[_0x9c59('0x65')]=_0x22b2ea[_0x9c59('0x5d')]({'plain':!![]});interaction_log[_0x9c59('0x1d')](_0x9c59('0x7c'),_0x1f04fb[_0x9c59('0x63')]['id'],_0x1f04fb[_0x9c59('0x63')][_0x9c59('0x31')],_0x1f04fb[_0x9c59('0x63')][_0x9c59('0x64')],_0x2ca6be[_0x9c59('0x65')]['id'],_0x1f04fb['body']?JSON['stringify'](_0x1f04fb[_0x9c59('0x51')]):'null');return respondWithRpcPromise(_0x9c59('0x7d'),_0x9c59('0x7e'),_0x2ca6be);}return null;})[_0x9c59('0x1c')](function(_0x4fd5f){var _0x601505=_0x9c59('0x69')+_0x4fd5f[_0x9c59('0x23')]['ContactId'];return db['sequelize']['query'](_0x601505,{'type':db[_0x9c59('0x6c')][_0x9c59('0x6d')][_0x9c59('0x6e')],'raw':!![]})['then'](function(_0x231d5b){return _0x231d5b;});})[_0x9c59('0x1c')](function(_0x438a62){if(_0x438a62){_0x2ca6be[_0x9c59('0x23')][_0x9c59('0x7f')]=_0x438a62[0x0];if(!_0x1f04fb[_0x9c59('0x51')][_0x9c59('0x5b')])return;return db['User'][_0x9c59('0x4f')]({'where':{'id':_0x1f04fb[_0x9c59('0x51')]['UserId'],'role':_0x9c59('0x5c')},'attributes':['id',_0x9c59('0x31'),'fullname',_0x9c59('0x71'),_0x9c59('0x72')],'raw':!![]});}return null;})[_0x9c59('0x1c')](function(_0x5d5143){if(!_0x5d5143)return null;_0x2ca6be[_0x9c59('0x23')]['agent']=_0x5d5143;return _0x2ca6be;})[_0x9c59('0x1c')](function(_0x53e06e){if(_0x53e06e){_0x53e06e[_0x9c59('0x23')]['interface']=util[_0x9c59('0x59')](_0x9c59('0x75'),_0x1f04fb['user'][_0x9c59('0x31')]);_0x53e06e[_0x9c59('0x23')][_0x9c59('0x76')]=_0x2ca6be['channel'];_0x53e06e[_0x9c59('0x23')]['motionChannel']=_0x2ca6be[_0x9c59('0x76')];_0x53e06e[_0x9c59('0x23')][_0x9c59('0x78')]=_0x9c59('0x2f');respondWithRpcPromise(_0x9c59('0x79'),_0x9c59('0x79'),{'event':_0x9c59('0x80'),'message':_0x53e06e[_0x9c59('0x23')]},client9002);return _0x2ca6be;}return null;})['then'](respondWithResult(_0x4e4197,null))[_0x9c59('0x24')](handleError(_0x4e4197,null));};exports['status']=function(_0x4ec30f,_0x71e275,_0x3d8710){if(_0x4ec30f[_0x9c59('0x51')]['id']){delete _0x4ec30f[_0x9c59('0x51')]['id'];}var _0x231ce0;return db['SmsMessage']['find']({'where':{'id':_0x4ec30f[_0x9c59('0x4b')]['id']}})[_0x9c59('0x1c')](handleEntityNotFound(_0x71e275,null))[_0x9c59('0x1c')](function(_0x36780a){if(_0x36780a){_0x231ce0=_0x36780a;return db[_0x9c59('0x81')][_0x9c59('0x4f')]({'where':{'id':_0x36780a[_0x9c59('0x82')]}});}})[_0x9c59('0x1c')](handleEntityNotFound(_0x71e275,null))[_0x9c59('0x1c')](function(_0x884204){if(_0x884204){logger['debug'](_0x9c59('0x83'),_0x9c59('0x25'),'received\x20delivery\x20report\x20from',_0x884204[_0x9c59('0x35')],util[_0x9c59('0x84')](_0x4ec30f[_0x9c59('0x51')],{'showHidden':![],'depth':null}));switch(_0x884204[_0x9c59('0x35')]){case _0x9c59('0x85'):if(_0x4ec30f[_0x9c59('0x51')]['MessageSid']&&_0x4ec30f['body'][_0x9c59('0x86')]===_0x231ce0[_0x9c59('0x87')]){return _0x231ce0[_0x9c59('0x52')]({'read':!![]});}else{logger['error'](_0x9c59('0x88'),_0x9c59('0x25'),_0x9c59('0x85'),util[_0x9c59('0x84')](_0x4ec30f['body'],{'showHidden':![],'depth':null}));}break;case _0x9c59('0x89'):if(_0x4ec30f['body']['MessageUUID']&&_0x4ec30f['body'][_0x9c59('0x8a')]===_0x231ce0[_0x9c59('0x87')]&&_[_0x9c59('0x8b')](['sent',_0x9c59('0x8c')],_0x4ec30f[_0x9c59('0x51')][_0x9c59('0x8d')])>=0x0){return _0x231ce0[_0x9c59('0x52')]({'read':!![]});}else{logger[_0x9c59('0x21')](_0x9c59('0x88'),'status','plivio',util['inspect'](_0x4ec30f[_0x9c59('0x51')],{'showHidden':![],'depth':null}));}break;case _0x9c59('0x8e'):var _0x287936=_0x4ec30f['body']['results'][0x0];if(_0x287936['status'][_0x9c59('0x8f')]===_0x9c59('0x90')){return _0x231ce0[_0x9c59('0x52')]({'read':!![]});}else{logger[_0x9c59('0x21')](_0x9c59('0x88'),_0x9c59('0x25'),_0x9c59('0x8e'),util[_0x9c59('0x84')](_0x4ec30f['body'],{'showHidden':![],'depth':null}));}break;}return _0x231ce0;}})[_0x9c59('0x1c')](respondWithResult(_0x71e275,null))[_0x9c59('0x24')](handleError(_0x71e275,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 245cfa9..1a99d22 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 _0x80ba=['remove','emit','hook','exports','events','../../mysqldb','SmsMessage','save','update'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x80ba,0xee));var _0xa80b=function(_0x5ce2ab,_0x278694){_0x5ce2ab=_0x5ce2ab-0x0;var _0x28351f=_0x80ba[_0x5ce2ab];return _0x28351f;};'use strict';var EventEmitter=require(_0xa80b('0x0'));var SmsMessage=require(_0xa80b('0x1'))['db'][_0xa80b('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa80b('0x3'),'afterUpdate':_0xa80b('0x4'),'afterDestroy':_0xa80b('0x5')};function emitEvent(_0x1d06b2){return function(_0xf98b45,_0x3f8634,_0x156767){SmsMessageEvents[_0xa80b('0x6')](_0x1d06b2+':'+_0xf98b45['id'],_0xf98b45);SmsMessageEvents[_0xa80b('0x6')](_0x1d06b2,_0xf98b45);_0x156767(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xa80b('0x7')](e,emitEvent(event));}}module[_0xa80b('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xa3ec=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3ec,0xae));var _0xca3e=function(_0x5a7857,_0x595b4d){_0x5a7857=_0x5a7857-0x0;var _0x2e40b7=_0xa3ec[_0x5a7857];return _0x2e40b7;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xca3e('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xca3e('0x1')](0x0);var events={'afterCreate':_0xca3e('0x2'),'afterUpdate':_0xca3e('0x3'),'afterDestroy':_0xca3e('0x4')};function emitEvent(_0x16da01){return function(_0x5253f5,_0x47fb57,_0x539d37){SmsMessageEvents[_0xca3e('0x5')](_0x16da01+':'+_0x5253f5['id'],_0x5253f5);SmsMessageEvents[_0xca3e('0x5')](_0x16da01,_0x5253f5);_0x539d37(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xca3e('0x6')](e,emitEvent(event));}}module[_0xca3e('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index fc4f54e..c1bd5a7 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 _0x6bde=['connectel','senderString','requestid','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','then','type','twilio','authToken','phone','accountSid','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x6bde,0x13d));var _0xe6bd=function(_0x47cbee,_0x2c77d6){_0x47cbee=_0x47cbee-0x0;var _0x306a46=_0x6bde[_0x47cbee];return _0x306a46;};'use strict';var _=require('lodash');var util=require(_0xe6bd('0x0'));var logger=require(_0xe6bd('0x1'))(_0xe6bd('0x2'));var moment=require('moment');var BPromise=require(_0xe6bd('0x3'));var rp=require(_0xe6bd('0x4'));var fs=require('fs');var path=require(_0xe6bd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6bd('0x6'));module[_0xe6bd('0x7')]=function(_0x4c13d5,_0xf19f83){return _0x4c13d5[_0xe6bd('0x8')]('SmsMessage',attributes,{'tableName':_0xe6bd('0x9'),'paranoid':![],'indexes':[{'name':_0xe6bd('0xa'),'fields':[_0xe6bd('0xa')]},{'name':_0xe6bd('0xb'),'fields':[_0xe6bd('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5eb77a,_0x3bf274,_0x5b72c1){var _0x4a5f52=_0x4c13d5[_0xe6bd('0xd')];var _0x3c3ed5=_0x5eb77a['get']({'plain':!![]});if(_0x3c3ed5[_0xe6bd('0xe')][_0xe6bd('0xf')]()==='in'||_0x3c3ed5[_0xe6bd('0xe')]['toLowerCase']()===_0xe6bd('0x10')&&!_0x3c3ed5[_0xe6bd('0x11')]&&!_[_0xe6bd('0x12')](_0x3c3ed5[_0xe6bd('0x13')])&&!_[_0xe6bd('0x12')](_0x3c3ed5[_0xe6bd('0x14')])){_0x4a5f52[_0xe6bd('0x15')][_0xe6bd('0x16')]({'where':{'id':_0x3c3ed5['SmsInteractionId']}})['then'](function(_0x245644){if(_0x245644){_0x245644['update']({'lastMsgAt':_0x3c3ed5[_0xe6bd('0x17')],'lastMsgDirection':_0x3c3ed5[_0xe6bd('0xe')][_0xe6bd('0xf')]()});}})[_0xe6bd('0x18')](function(_0x4cdf59){console[_0xe6bd('0x19')](_0x4cdf59);});}if(_0x3c3ed5[_0xe6bd('0xe')]==='out'&&!_0x3c3ed5['secret']){var _0x196ce0;_0x4a5f52[_0xe6bd('0x1a')][_0xe6bd('0x1b')]({'where':{'id':_0x3c3ed5['SmsAccountId']},'raw':!![]})[_0xe6bd('0x1c')](function(_0x155fc3){_0x196ce0=_0x155fc3;if(_0x196ce0&&_0x196ce0['type']){switch(_0x196ce0[_0xe6bd('0x1d')]){case _0xe6bd('0x1e'):var _0x38aa95=require(_0xe6bd('0x1e'));if(_0x196ce0['accountSid']&&_0x196ce0[_0xe6bd('0x1f')]&&_0x196ce0[_0xe6bd('0x20')]){var _0x58d4fc=new _0x38aa95(_0x196ce0[_0xe6bd('0x21')],_0x196ce0['authToken']);_0x58d4fc['messages']['create']({'body':_0x3c3ed5[_0xe6bd('0xc')],'to':_0x3c3ed5[_0xe6bd('0x20')],'from':_0x196ce0[_0xe6bd('0x20')],'statusCallback':_0x196ce0[_0xe6bd('0x22')]+_0xe6bd('0x23')+_0x3c3ed5['id']+_0xe6bd('0x24')+_0x196ce0['token']})['then'](function(_0x34f6b6){if(_0x34f6b6[_0xe6bd('0x25')]){return _0x5eb77a['update']({'messageId':_0x34f6b6[_0xe6bd('0x25')]});}})[_0xe6bd('0x18')](function(_0x344505){logger['error'](_0xe6bd('0x26'),'afterCreate','twilio',util[_0xe6bd('0x27')](_0x344505,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x1e'),_0xe6bd('0x29'));}break;case _0xe6bd('0x2a'):var _0x2497d3=_0xe6bd('0x2b');if(_0x196ce0[_0xe6bd('0x2c')]&&_0x196ce0[_0xe6bd('0x2d')]){var _0x567c8e={'recipient':[_0x3c3ed5['phone']],'message':_0x3c3ed5[_0xe6bd('0xc')],'message_type':_0x196ce0[_0xe6bd('0x2e')]};if(_0x196ce0[_0xe6bd('0x2e')]&&_0x196ce0[_0xe6bd('0x2e')]!=='SI'){_0x567c8e[_0xe6bd('0x2f')]=_0x196ce0[_0xe6bd('0x20')];}var _0x4024b9={'url':_0x2497d3+_0xe6bd('0x30')+_0x196ce0['username']+'&password='+_0x196ce0[_0xe6bd('0x2d')],'method':_0xe6bd('0x31')};rp(_0x4024b9)['then'](function(_0x5ac467){var _0x2d8651=_0x5ac467[_0xe6bd('0x32')](';');var _0x7e8732={'user_key':_0x2d8651[0x0],'session_key':_0x2d8651[0x1]};_0x4024b9={'url':_0x2497d3+_0xe6bd('0x33'),'method':_0xe6bd('0x34'),'headers':{'user_key':_0x7e8732[_0xe6bd('0x35')],'Session_key':_0x7e8732[_0xe6bd('0x36')]},'json':!![],'body':_0x567c8e};return rp(_0x4024b9);})[_0xe6bd('0x1c')](function(_0x2b0456){if(_0x2b0456[_0xe6bd('0x37')]>=0x1){var _0x55428c={'messageId':_0x2b0456[_0xe6bd('0x38')]};if(_0x196ce0[_0xe6bd('0x2e')]!=='GP'||!_0x196ce0[_0xe6bd('0x39')]){_0x55428c[_0xe6bd('0x3a')]=!![];}return _0x5eb77a[_0xe6bd('0x3b')](_0x55428c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe6bd('0x28'),_0xe6bd('0x2a'),util[_0xe6bd('0x27')](_0x2b0456,{'showHidden':![],'depth':null}));}})[_0xe6bd('0x18')](function(_0x1cb689){return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x2a'),util[_0xe6bd('0x27')](_0x1cb689,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe6bd('0x28'),_0xe6bd('0x2a'),_0xe6bd('0x3c'));}break;case _0xe6bd('0x3d'):if(_0x196ce0['authToken']){var _0x3d8116={'recipient':_0x3c3ed5['phone'],'message':_0x3c3ed5[_0xe6bd('0xc')],'sender':_0x196ce0[_0xe6bd('0x3e')]||_0x196ce0[_0xe6bd('0x20')],'authorization':_0x196ce0[_0xe6bd('0x1f')]};var _0x3bf274={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3d8116,'json':!![]};rp(_0x3bf274)[_0xe6bd('0x1c')](function(_0x10a509){var _0x2174c0={'messageId':_0x10a509[_0xe6bd('0x3f')]};if(!_0x196ce0[_0xe6bd('0x39')]){_0x2174c0[_0xe6bd('0x3a')]=!![];}return _0x5eb77a['update'](_0x2174c0);})[_0xe6bd('0x18')](function(_0xcb2232){logger[_0xe6bd('0x19')](_0xe6bd('0x26'),'afterCreate','connectel',util['inspect'](_0xcb2232,{'showHidden':![],'depth':null}));});}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xe6bd('0x40'):if(_0x196ce0['username']&&_0x196ce0[_0xe6bd('0x2d')]){var _0x3d8116={'messages':[{'source':'xCALLY\x20Motion','to':_0x3c3ed5['phone'],'body':_0x3c3ed5[_0xe6bd('0xc')],'from':_0x196ce0[_0xe6bd('0x3e')]||_0x196ce0[_0xe6bd('0x20')]}]};var _0x4ef43a=util[_0xe6bd('0x41')](_0xe6bd('0x42'),_0x196ce0['username'],_0x196ce0['password']);var _0x3bf274={'method':_0xe6bd('0x34'),'uri':_0xe6bd('0x43'),'body':_0x3d8116,'headers':{'Authorization':util[_0xe6bd('0x41')](_0xe6bd('0x44'),new Buffer(_0x4ef43a)[_0xe6bd('0x45')](_0xe6bd('0x46')))},'json':!![]};rp(_0x3bf274)[_0xe6bd('0x1c')](function(_0x248d2d){if(_0x248d2d[_0xe6bd('0x47')]>=0xc8&&_0x248d2d[_0xe6bd('0x47')]<=0xce){if(_0x248d2d[_0xe6bd('0x48')]&&_0x248d2d[_0xe6bd('0x48')][_0xe6bd('0x49')]>0x0){var _0x54d791=_[_0xe6bd('0x4a')](_0x248d2d['data'][_0xe6bd('0x4b')]);var _0x34c07d={'messageId':_0x54d791[_0xe6bd('0x4c')]};if(!_0x196ce0[_0xe6bd('0x39')]){_0x34c07d['read']=!![];}return _0x5eb77a[_0xe6bd('0x3b')](_0x34c07d);}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x4d'),util['inspect'](_0x248d2d,{'showHidden':![],'depth':null}));}}else{logger[_0xe6bd('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe6bd('0x28'),_0xe6bd('0x4d'),util[_0xe6bd('0x27')](_0x248d2d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bc31c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe6bd('0x28'),'clickSend',util[_0xe6bd('0x27')](_0x3bc31c,{'showHidden':![],'depth':null}));});}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),'clickSend',_0xe6bd('0x3c'));}break;case _0xe6bd('0x4e'):if(_0x196ce0[_0xe6bd('0x4f')]&&_0x196ce0[_0xe6bd('0x1f')]){var _0x3d8116={'dst':_0x3c3ed5[_0xe6bd('0x20')],'text':_0x3c3ed5[_0xe6bd('0xc')],'src':_0x196ce0[_0xe6bd('0x3e')]||_0x196ce0[_0xe6bd('0x20')],'url':_0x196ce0[_0xe6bd('0x22')]+_0xe6bd('0x23')+_0x3c3ed5['id']+'/status?token='+_0x196ce0['token']};var _0x4ef43a=util[_0xe6bd('0x41')](_0xe6bd('0x42'),_0x196ce0[_0xe6bd('0x4f')],_0x196ce0['authToken']);var _0x3bf274={'method':'POST','uri':util[_0xe6bd('0x41')](_0xe6bd('0x50'),_0x196ce0[_0xe6bd('0x4f')]),'body':_0x3d8116,'headers':{'Authorization':util['format'](_0xe6bd('0x44'),new Buffer(_0x4ef43a)[_0xe6bd('0x45')](_0xe6bd('0x46')))},'json':!![]};rp(_0x3bf274)['then'](function(_0x26f693){var _0x284883={'messageId':_0x26f693[_0xe6bd('0x51')][0x0]};return _0x5eb77a['update'](_0x284883);})['catch'](function(_0x1af47f){logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x4e'),util['inspect'](_0x1af47f,{'showHidden':![],'depth':null}));});}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x4e'),_0xe6bd('0x52'));}break;case _0xe6bd('0x53'):if(_0x196ce0[_0xe6bd('0x2c')]&&_0x196ce0[_0xe6bd('0x2d')]){if(_0x196ce0[_0xe6bd('0x54')]){var _0x298ec9={'method':_0xe6bd('0x34'),'uri':_0x196ce0[_0xe6bd('0x54')]+_0xe6bd('0x55'),'body':{'username':_0x196ce0[_0xe6bd('0x2c')],'password':_0x196ce0[_0xe6bd('0x2d')]},'json':!![]};return rp(_0x298ec9)[_0xe6bd('0x1c')](function(_0x5acaf5){var _0x53c703={'method':_0xe6bd('0x34'),'uri':_0x196ce0[_0xe6bd('0x54')]+_0xe6bd('0x56'),'body':{'messages':[{'from':_0x196ce0[_0xe6bd('0x20')],'destinations':[{'to':_0x3c3ed5[_0xe6bd('0x20')]}],'text':_0x3c3ed5[_0xe6bd('0xc')],'notifyUrl':_0x196ce0['remote']+_0xe6bd('0x23')+_0x3c3ed5['id']+_0xe6bd('0x24')+_0x196ce0[_0xe6bd('0x57')],'notifyContentType':_0xe6bd('0x58'),'callbackData':_0x196ce0[_0xe6bd('0x20')]+';'+_0x3c3ed5[_0xe6bd('0xc')]}]},'headers':{'Authorization':_0xe6bd('0x59')+_0x5acaf5[_0xe6bd('0x57')]},'json':!![]};return rp(_0x53c703)[_0xe6bd('0x1c')](function(_0x512d3e){if(_0x512d3e[_0xe6bd('0x4b')]){var _0x4c6fa2={'messageId':_0x512d3e['messages'][0x0][_0xe6bd('0xa')]};if(!_0x196ce0[_0xe6bd('0x39')]){_0x4c6fa2[_0xe6bd('0x3a')]=!![];}return _0x5eb77a[_0xe6bd('0x3b')](_0x4c6fa2);}else{return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x53'),util['inspect'](_0x512d3e,{'showHidden':![],'depth':null}));}});})[_0xe6bd('0x18')](function(_0x358d54){return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x53'),util['inspect'](_0x358d54,{'showHidden':![],'depth':null}));});}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),'afterCreate',_0xe6bd('0x53'),_0xe6bd('0x5a'));}}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x53'),_0xe6bd('0x3c'));}break;case _0xe6bd('0x5b'):var _0x5383cb=require(_0xe6bd('0x5c'));if(_0x196ce0['apiKey']){var _0x327cb4={};_0x327cb4[_0xe6bd('0x5d')]=_0x196ce0['username'];_0x327cb4['phone']=_0x3c3ed5[_0xe6bd('0x20')];_0x327cb4[_0xe6bd('0x2f')]=_0x196ce0[_0xe6bd('0x20')];_0x327cb4['text']=_0x3c3ed5[_0xe6bd('0xc')];_0x327cb4[_0xe6bd('0x5e')]=+new Date();var _0x23e2c0='';var _0x500891='';var _0x2787e1=Object[_0xe6bd('0x5f')](_0x327cb4);_0x2787e1[_0xe6bd('0x60')]();for(var _0xe49fcb=0x0;_0xe49fcb<_0x2787e1[_0xe6bd('0x61')];_0xe49fcb++){if(_0x23e2c0!=''){_0x23e2c0+='&';}_0x23e2c0+=_0x2787e1[_0xe49fcb]+'='+encodeURIComponent(_0x327cb4[_0x2787e1[_0xe49fcb]]);_0x500891+=_0x327cb4[_0x2787e1[_0xe49fcb]];}_0x500891+=_0x196ce0[_0xe6bd('0x62')];_0x500891=_0x5383cb[_0xe6bd('0x63')](_0xe6bd('0x64'))['update'](_0x500891)[_0xe6bd('0x65')](_0xe6bd('0x66'));if(_0x23e2c0!==''){_0x23e2c0+='&';}_0x23e2c0+='signature='+_0x500891;var _0x4024b9={'method':_0xe6bd('0x31'),'uri':_0x196ce0['baseUrl']+_0xe6bd('0x67')+_0x23e2c0,'json':!![]};return rp(_0x4024b9)['then'](function(_0x5d0aa8){var _0x55f5b7=Object[_0xe6bd('0x5f')](_0x5d0aa8);if(_0x5d0aa8[_0x55f5b7[0x0]]['error']&&parseInt(_0x5d0aa8[_0x55f5b7[0x0]][_0xe6bd('0x19')])===0x0){var _0x1ed2f8={'messageId':_0x5d0aa8[_0x55f5b7[0x0]][_0xe6bd('0x68')]};if(!_0x196ce0[_0xe6bd('0x39')]){_0x1ed2f8[_0xe6bd('0x3a')]=!![];}return _0x5eb77a[_0xe6bd('0x3b')](_0x1ed2f8);}else{return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x5b'),util[_0xe6bd('0x27')](_0x5d0aa8[_0xe6bd('0x19')],{'showHidden':![],'depth':null}));}})[_0xe6bd('0x18')](function(_0x1e58a1){return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x5b'),util['inspect'](_0x1e58a1,{'showHidden':![],'depth':null}));});}else{logger[_0xe6bd('0x19')](_0xe6bd('0x26'),'afterCreate',_0xe6bd('0x5b'),_0xe6bd('0x69'));}break;case'clickatell':if(_0x196ce0[_0xe6bd('0x62')]){var _0x17bb90={'method':_0xe6bd('0x34'),'uri':_0xe6bd('0x6a'),'headers':{'Authorization':_0x196ce0['apiKey']},'body':{'content':_0x3c3ed5[_0xe6bd('0xc')],'to':[_0x3c3ed5[_0xe6bd('0x20')]],'from':_0x196ce0[_0xe6bd('0x20')],'binary':![],'clientMessageId':_0xe6bd('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x17bb90)['then'](function(_0x40bbd1){if(!_0x40bbd1[_0xe6bd('0x19')]){var _0x14935a={'messageId':_0x40bbd1['messages'][0x0][_0xe6bd('0x6c')]};if(!_0x196ce0[_0xe6bd('0x39')]){_0x14935a[_0xe6bd('0x3a')]=!![];}return _0x5eb77a['update'](_0x14935a);}else{return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x6d'),util[_0xe6bd('0x27')](_0x40bbd1[_0xe6bd('0x19')],{'showHidden':![],'depth':null}));}})[_0xe6bd('0x18')](function(_0x31ebf7){return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x6d'),util[_0xe6bd('0x27')](_0x31ebf7,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe6bd('0x28'),_0xe6bd('0x6d'),_0xe6bd('0x69'));}break;case _0xe6bd('0x6e'):if(_0x196ce0[_0xe6bd('0x2c')]&&_0x196ce0[_0xe6bd('0x2d')]){var _0x4ef43a=util['format'](_0xe6bd('0x42'),_0x196ce0[_0xe6bd('0x2c')],_0x196ce0[_0xe6bd('0x2d')]);var _0x3bf274={'method':'POST','uri':_0xe6bd('0x6f')+_0x196ce0[_0xe6bd('0x70')]+_0xe6bd('0x71'),'body':{'to':[_0x3c3ed5[_0xe6bd('0x20')]],'text':_0x3c3ed5[_0xe6bd('0xc')],'from':_0x196ce0['phone'],'applicationId':_0x196ce0['applicationId']},'headers':{'Authorization':util[_0xe6bd('0x41')](_0xe6bd('0x44'),new Buffer(_0x4ef43a)['toString'](_0xe6bd('0x46')))},'json':!![]};rp(_0x3bf274)[_0xe6bd('0x1c')](function(_0xd631b2){if(_0xd631b2['id']){var _0x56fc77={'messageId':_0xd631b2['id']};return _0x5eb77a[_0xe6bd('0x3b')](_0x56fc77);}else{logger['error'](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x6e'),util[_0xe6bd('0x27')](_0xd631b2,{'showHidden':![],'depth':null}));}})[_0xe6bd('0x18')](function(_0x432030){logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x6e'),util[_0xe6bd('0x27')](_0x432030,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe6bd('0x26'),_0xe6bd('0x28'),_0xe6bd('0x6e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe6bd('0x72'):if(_0x196ce0['apiKey']){var _0x45299a={};var _0x4024b9={'method':'POST','uri':_0xe6bd('0x73'),'headers':{'Authorization':_0xe6bd('0x74')+_0x196ce0[_0xe6bd('0x62')],'Content-Type':_0xe6bd('0x58')},'body':{'from':_0x196ce0[_0xe6bd('0x20')],'to':_0x3c3ed5[_0xe6bd('0x20')],'text':_0x3c3ed5[_0xe6bd('0xc')]},'json':!![]};return rp(_0x4024b9)[_0xe6bd('0x1c')](function(_0xc96afd){if(_0xc96afd[_0xe6bd('0x75')]==0xca){_0x45299a['message']=_0xc96afd;var _0x1eb364={'method':_0xe6bd('0x34'),'uri':_0xe6bd('0x76'),'headers':{'Authorization':_0xe6bd('0x74')+_0x196ce0[_0xe6bd('0x62')],'Content-Type':_0xe6bd('0x58')},'body':{'refid':_0x45299a['message'][_0xe6bd('0x77')]},'json':!![]};return rp(_0x1eb364)[_0xe6bd('0x1c')](function(_0x4886a5){_0x45299a[_0xe6bd('0x78')]=_0x4886a5;var _0x2dc9bd={'messageId':_0x45299a[_0xe6bd('0x79')][_0xe6bd('0x77')],'read':!![]};return _0x5eb77a[_0xe6bd('0x3b')](_0x2dc9bd);});}else{return logger[_0xe6bd('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe6bd('0x28'),_0xe6bd('0x72'),util[_0xe6bd('0x27')](_0xc96afd,{'showHidden':![],'depth':null}));}})[_0xe6bd('0x18')](function(_0x4d69dd){return logger['error'](_0xe6bd('0x26'),_0xe6bd('0x28'),'intelepeer',util[_0xe6bd('0x27')](_0x4d69dd,{'showHidden':![],'depth':null}));});}else{return logger[_0xe6bd('0x19')](_0xe6bd('0x26'),_0xe6bd('0x28'),'intelepeer',_0xe6bd('0x7a'));}break;}}})[_0xe6bd('0x7b')](function(){_0x5b72c1();});}else{_0x5b72c1();}}},'charset':_0xe6bd('0x7c'),'collate':_0xe6bd('0x7d')});}; \ No newline at end of file +var _0x23d6=['secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/status?token=','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','plivo','authId','/api/sms/messages/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','login','text','timestamp','keys','sort','length','apiKey','createHash','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x23d6,0x67));var _0x623d=function(_0x39a10e,_0x23c6a8){_0x39a10e=_0x39a10e-0x0;var _0x355d59=_0x23d6[_0x39a10e];return _0x355d59;};'use strict';var _=require('lodash');var util=require(_0x623d('0x0'));var logger=require(_0x623d('0x1'))(_0x623d('0x2'));var moment=require(_0x623d('0x3'));var BPromise=require('bluebird');var rp=require(_0x623d('0x4'));var fs=require('fs');var path=require(_0x623d('0x5'));var rimraf=require('rimraf');var config=require(_0x623d('0x6'));var attributes=require(_0x623d('0x7'));module[_0x623d('0x8')]=function(_0x5a3a37,_0x529640){return _0x5a3a37[_0x623d('0x9')](_0x623d('0xa'),attributes,{'tableName':_0x623d('0xb'),'paranoid':![],'indexes':[{'name':_0x623d('0xc'),'fields':[_0x623d('0xc')]},{'name':_0x623d('0xd'),'fields':[_0x623d('0xe')],'type':_0x623d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28876a,_0x8fc2cf,_0x133315){var _0x44c53b=_0x5a3a37[_0x623d('0x10')];var _0x55c443=_0x28876a[_0x623d('0x11')]({'plain':!![]});if(_0x55c443['direction'][_0x623d('0x12')]()==='in'||_0x55c443[_0x623d('0x13')][_0x623d('0x12')]()===_0x623d('0x14')&&!_0x55c443[_0x623d('0x15')]&&!_[_0x623d('0x16')](_0x55c443[_0x623d('0x17')])&&!_[_0x623d('0x16')](_0x55c443[_0x623d('0x18')])){_0x44c53b[_0x623d('0x19')][_0x623d('0x1a')]({'where':{'id':_0x55c443['SmsInteractionId']}})[_0x623d('0x1b')](function(_0x3b61d8){if(_0x3b61d8){_0x3b61d8[_0x623d('0x1c')]({'lastMsgAt':_0x55c443[_0x623d('0x1d')],'lastMsgDirection':_0x55c443['direction'][_0x623d('0x12')]()});}})[_0x623d('0x1e')](function(_0x345b35){console[_0x623d('0x1f')](_0x345b35);});}if(_0x55c443[_0x623d('0x13')]===_0x623d('0x14')&&!_0x55c443[_0x623d('0x15')]){var _0x38e468;_0x44c53b['SmsAccount']['find']({'where':{'id':_0x55c443[_0x623d('0x20')]},'raw':!![]})[_0x623d('0x1b')](function(_0x5b013e){_0x38e468=_0x5b013e;if(_0x38e468&&_0x38e468[_0x623d('0x21')]){switch(_0x38e468[_0x623d('0x21')]){case _0x623d('0x22'):var _0x434b3a=require(_0x623d('0x22'));if(_0x38e468['accountSid']&&_0x38e468[_0x623d('0x23')]&&_0x38e468[_0x623d('0x24')]){var _0x1070ed=new _0x434b3a(_0x38e468[_0x623d('0x25')],_0x38e468[_0x623d('0x23')]);_0x1070ed[_0x623d('0x26')][_0x623d('0x27')]({'body':_0x55c443[_0x623d('0xe')],'to':_0x55c443[_0x623d('0x24')],'from':_0x38e468[_0x623d('0x24')],'statusCallback':_0x38e468[_0x623d('0x28')]+'/api/sms/messages/'+_0x55c443['id']+_0x623d('0x29')+_0x38e468['token']})['then'](function(_0x2491d4){if(_0x2491d4['sid']){return _0x28876a[_0x623d('0x1c')]({'messageId':_0x2491d4['sid']});}})[_0x623d('0x1e')](function(_0x5df978){logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x22'),util[_0x623d('0x2c')](_0x5df978,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x623d('0x2d'):var _0x1a55f9=_0x623d('0x2e');if(_0x38e468[_0x623d('0x2f')]&&_0x38e468[_0x623d('0x30')]){var _0x567ac6={'recipient':[_0x55c443[_0x623d('0x24')]],'message':_0x55c443[_0x623d('0xe')],'message_type':_0x38e468[_0x623d('0x31')]};if(_0x38e468[_0x623d('0x31')]&&_0x38e468[_0x623d('0x31')]!=='SI'){_0x567ac6[_0x623d('0x32')]=_0x38e468[_0x623d('0x24')];}var _0x59c147={'url':_0x1a55f9+_0x623d('0x33')+_0x38e468[_0x623d('0x2f')]+_0x623d('0x34')+_0x38e468[_0x623d('0x30')],'method':_0x623d('0x35')};rp(_0x59c147)[_0x623d('0x1b')](function(_0x1592c0){var _0x1b0b79=_0x1592c0[_0x623d('0x36')](';');var _0x117d94={'user_key':_0x1b0b79[0x0],'session_key':_0x1b0b79[0x1]};_0x59c147={'url':_0x1a55f9+_0x623d('0x37'),'method':_0x623d('0x38'),'headers':{'user_key':_0x117d94[_0x623d('0x39')],'Session_key':_0x117d94['session_key']},'json':!![],'body':_0x567ac6};return rp(_0x59c147);})[_0x623d('0x1b')](function(_0x5dbced){if(_0x5dbced[_0x623d('0x3a')]>=0x1){var _0x50fa8e={'messageId':_0x5dbced[_0x623d('0x3b')]};if(_0x38e468[_0x623d('0x31')]!=='GP'||!_0x38e468[_0x623d('0x3c')]){_0x50fa8e[_0x623d('0x3d')]=!![];}return _0x28876a['update'](_0x50fa8e);}else{return logger['error'](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x2d'),util[_0x623d('0x2c')](_0x5dbced,{'showHidden':![],'depth':null}));}})[_0x623d('0x1e')](function(_0x25d007){return logger['error'](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x2d'),util[_0x623d('0x2c')](_0x25d007,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x623d('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x623d('0x3e'):if(_0x38e468[_0x623d('0x23')]){var _0x48c8c4={'recipient':_0x55c443['phone'],'message':_0x55c443['body'],'sender':_0x38e468[_0x623d('0x3f')]||_0x38e468[_0x623d('0x24')],'authorization':_0x38e468['authToken']};var _0x8fc2cf={'method':_0x623d('0x38'),'uri':_0x623d('0x40'),'body':_0x48c8c4,'json':!![]};rp(_0x8fc2cf)[_0x623d('0x1b')](function(_0x7000d2){var _0x1d4f46={'messageId':_0x7000d2[_0x623d('0x41')]};if(!_0x38e468[_0x623d('0x3c')]){_0x1d4f46['read']=!![];}return _0x28876a[_0x623d('0x1c')](_0x1d4f46);})[_0x623d('0x1e')](function(_0x4d07a2){logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),'connectel',util['inspect'](_0x4d07a2,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x3e'),_0x623d('0x42'));}break;case _0x623d('0x43'):if(_0x38e468[_0x623d('0x2f')]&&_0x38e468[_0x623d('0x30')]){var _0x48c8c4={'messages':[{'source':_0x623d('0x44'),'to':_0x55c443['phone'],'body':_0x55c443[_0x623d('0xe')],'from':_0x38e468['senderString']||_0x38e468[_0x623d('0x24')]}]};var _0x26e9e4=util[_0x623d('0x45')](_0x623d('0x46'),_0x38e468['username'],_0x38e468[_0x623d('0x30')]);var _0x8fc2cf={'method':_0x623d('0x38'),'uri':_0x623d('0x47'),'body':_0x48c8c4,'headers':{'Authorization':util[_0x623d('0x45')](_0x623d('0x48'),new Buffer(_0x26e9e4)[_0x623d('0x49')](_0x623d('0x4a')))},'json':!![]};rp(_0x8fc2cf)['then'](function(_0x2f364c){if(_0x2f364c['http_code']>=0xc8&&_0x2f364c[_0x623d('0x4b')]<=0xce){if(_0x2f364c['data']&&_0x2f364c['data']['queued_count']>0x0){var _0x5e6a32=_['head'](_0x2f364c[_0x623d('0x4c')]['messages']);var _0x1b21b4={'messageId':_0x5e6a32[_0x623d('0x4d')]};if(!_0x38e468[_0x623d('0x3c')]){_0x1b21b4[_0x623d('0x3d')]=!![];}return _0x28876a[_0x623d('0x1c')](_0x1b21b4);}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),'afterCreate',_0x623d('0x4e'),util[_0x623d('0x2c')](_0x2f364c,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x4e'),util[_0x623d('0x2c')](_0x2f364c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x29605d){logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x4e'),util[_0x623d('0x2c')](_0x29605d,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x623d('0x4f'):if(_0x38e468[_0x623d('0x50')]&&_0x38e468[_0x623d('0x23')]){var _0x48c8c4={'dst':_0x55c443[_0x623d('0x24')],'text':_0x55c443[_0x623d('0xe')],'src':_0x38e468['senderString']||_0x38e468[_0x623d('0x24')],'url':_0x38e468[_0x623d('0x28')]+_0x623d('0x51')+_0x55c443['id']+'/status?token='+_0x38e468['token']};var _0x26e9e4=util[_0x623d('0x45')]('%s:%s',_0x38e468[_0x623d('0x50')],_0x38e468['authToken']);var _0x8fc2cf={'method':_0x623d('0x38'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x38e468[_0x623d('0x50')]),'body':_0x48c8c4,'headers':{'Authorization':util[_0x623d('0x45')](_0x623d('0x48'),new Buffer(_0x26e9e4)['toString']('base64'))},'json':!![]};rp(_0x8fc2cf)['then'](function(_0x1b8d93){var _0x2d3256={'messageId':_0x1b8d93[_0x623d('0x52')][0x0]};return _0x28876a[_0x623d('0x1c')](_0x2d3256);})[_0x623d('0x1e')](function(_0x5f2ff6){logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x4f'),util['inspect'](_0x5f2ff6,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x623d('0x53'):if(_0x38e468[_0x623d('0x2f')]&&_0x38e468[_0x623d('0x30')]){if(_0x38e468['baseUrl']){var _0x31b44f={'method':_0x623d('0x38'),'uri':_0x38e468[_0x623d('0x54')]+_0x623d('0x55'),'body':{'username':_0x38e468[_0x623d('0x2f')],'password':_0x38e468[_0x623d('0x30')]},'json':!![]};return rp(_0x31b44f)['then'](function(_0x45856f){var _0x1c764e={'method':_0x623d('0x38'),'uri':_0x38e468[_0x623d('0x54')]+_0x623d('0x56'),'body':{'messages':[{'from':_0x38e468['phone'],'destinations':[{'to':_0x55c443[_0x623d('0x24')]}],'text':_0x55c443['body'],'notifyUrl':_0x38e468[_0x623d('0x28')]+_0x623d('0x51')+_0x55c443['id']+_0x623d('0x29')+_0x38e468[_0x623d('0x57')],'notifyContentType':_0x623d('0x58'),'callbackData':_0x38e468['phone']+';'+_0x55c443[_0x623d('0xe')]}]},'headers':{'Authorization':_0x623d('0x59')+_0x45856f[_0x623d('0x57')]},'json':!![]};return rp(_0x1c764e)[_0x623d('0x1b')](function(_0x200fde){if(_0x200fde[_0x623d('0x26')]){var _0x22491e={'messageId':_0x200fde['messages'][0x0][_0x623d('0xc')]};if(!_0x38e468['deliveryReport']){_0x22491e[_0x623d('0x3d')]=!![];}return _0x28876a[_0x623d('0x1c')](_0x22491e);}else{return logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x623d('0x53'),util[_0x623d('0x2c')](_0x200fde,{'showHidden':![],'depth':null}));}});})[_0x623d('0x1e')](function(_0x3aae9b){return logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),'infobip',util[_0x623d('0x2c')](_0x3aae9b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x623d('0x2a'),_0x623d('0x2b'),'infobip',_0x623d('0x5a'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x53'),_0x623d('0x5b'));}break;case _0x623d('0x5c'):var _0xb81111=require('crypto');if(_0x38e468['apiKey']){var _0x4d3300={};_0x4d3300[_0x623d('0x5d')]=_0x38e468[_0x623d('0x2f')];_0x4d3300['phone']=_0x55c443[_0x623d('0x24')];_0x4d3300[_0x623d('0x32')]=_0x38e468[_0x623d('0x24')];_0x4d3300[_0x623d('0x5e')]=_0x55c443[_0x623d('0xe')];_0x4d3300[_0x623d('0x5f')]=+new Date();var _0x397520='';var _0x226135='';var _0x487ab1=Object[_0x623d('0x60')](_0x4d3300);_0x487ab1[_0x623d('0x61')]();for(var _0x5cf29c=0x0;_0x5cf29c<_0x487ab1[_0x623d('0x62')];_0x5cf29c++){if(_0x397520!=''){_0x397520+='&';}_0x397520+=_0x487ab1[_0x5cf29c]+'='+encodeURIComponent(_0x4d3300[_0x487ab1[_0x5cf29c]]);_0x226135+=_0x4d3300[_0x487ab1[_0x5cf29c]];}_0x226135+=_0x38e468[_0x623d('0x63')];_0x226135=_0xb81111[_0x623d('0x64')]('md5')[_0x623d('0x1c')](_0x226135)[_0x623d('0x65')]('hex');if(_0x397520!==''){_0x397520+='&';}_0x397520+=_0x623d('0x66')+_0x226135;var _0x59c147={'method':_0x623d('0x35'),'uri':_0x38e468[_0x623d('0x54')]+_0x623d('0x67')+_0x397520,'json':!![]};return rp(_0x59c147)[_0x623d('0x1b')](function(_0x44f1b4){var _0x3780ac=Object[_0x623d('0x60')](_0x44f1b4);if(_0x44f1b4[_0x3780ac[0x0]]['error']&&parseInt(_0x44f1b4[_0x3780ac[0x0]]['error'])===0x0){var _0x142601={'messageId':_0x44f1b4[_0x3780ac[0x0]][_0x623d('0x68')]};if(!_0x38e468[_0x623d('0x3c')]){_0x142601['read']=!![];}return _0x28876a[_0x623d('0x1c')](_0x142601);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x5c'),util[_0x623d('0x2c')](_0x44f1b4[_0x623d('0x1f')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xb26bb0){return logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x5c'),util[_0x623d('0x2c')](_0xb26bb0,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x5c'),_0x623d('0x69'));}break;case _0x623d('0x6a'):if(_0x38e468[_0x623d('0x63')]){var _0x513fb0={'method':_0x623d('0x38'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x38e468['apiKey']},'body':{'content':_0x55c443['body'],'to':[_0x55c443[_0x623d('0x24')]],'from':_0x38e468[_0x623d('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0x623d('0x6b')},'json':!![]};rp(_0x513fb0)['then'](function(_0xa4c57f){if(!_0xa4c57f[_0x623d('0x1f')]){var _0x23e219={'messageId':_0xa4c57f[_0x623d('0x26')][0x0][_0x623d('0x6c')]};if(!_0x38e468[_0x623d('0x3c')]){_0x23e219[_0x623d('0x3d')]=!![];}return _0x28876a[_0x623d('0x1c')](_0x23e219);}else{return logger['error'](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x6a'),util[_0x623d('0x2c')](_0xa4c57f[_0x623d('0x1f')],{'showHidden':![],'depth':null}));}})[_0x623d('0x1e')](function(_0x451357){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x6a'),util[_0x623d('0x2c')](_0x451357,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),'clickatell',_0x623d('0x69'));}break;case'bandwidth':if(_0x38e468['username']&&_0x38e468[_0x623d('0x30')]){var _0x26e9e4=util['format'](_0x623d('0x46'),_0x38e468[_0x623d('0x2f')],_0x38e468[_0x623d('0x30')]);var _0x8fc2cf={'method':_0x623d('0x38'),'uri':_0x623d('0x6d')+_0x38e468[_0x623d('0x6e')]+_0x623d('0x6f'),'body':{'to':[_0x55c443[_0x623d('0x24')]],'text':_0x55c443['body'],'from':_0x38e468[_0x623d('0x24')],'applicationId':_0x38e468[_0x623d('0x70')]},'headers':{'Authorization':util[_0x623d('0x45')](_0x623d('0x48'),new Buffer(_0x26e9e4)[_0x623d('0x49')](_0x623d('0x4a')))},'json':!![]};rp(_0x8fc2cf)[_0x623d('0x1b')](function(_0x408c62){if(_0x408c62['id']){var _0x462931={'messageId':_0x408c62['id']};return _0x28876a[_0x623d('0x1c')](_0x462931);}else{logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),'bandwidth',util[_0x623d('0x2c')](_0x408c62,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d7504){logger[_0x623d('0x1f')](_0x623d('0x2a'),'afterCreate',_0x623d('0x71'),util[_0x623d('0x2c')](_0x1d7504,{'showHidden':![],'depth':null}));});}else{logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x71'),_0x623d('0x5b'));}break;case _0x623d('0x72'):if(_0x38e468[_0x623d('0x63')]){var _0x4239f8={};var _0x59c147={'method':_0x623d('0x38'),'uri':_0x623d('0x73'),'headers':{'Authorization':_0x623d('0x74')+_0x38e468[_0x623d('0x63')],'Content-Type':_0x623d('0x58')},'body':{'from':_0x38e468[_0x623d('0x24')],'to':_0x55c443[_0x623d('0x24')],'text':_0x55c443[_0x623d('0xe')]},'json':!![]};return rp(_0x59c147)['then'](function(_0x512f29){if(_0x512f29[_0x623d('0x75')]==0xca){_0x4239f8[_0x623d('0x76')]=_0x512f29;var _0x49d5aa={'method':'POST','uri':_0x623d('0x77'),'headers':{'Authorization':_0x623d('0x74')+_0x38e468[_0x623d('0x63')],'Content-Type':_0x623d('0x58')},'body':{'refid':_0x4239f8['message']['refid']},'json':!![]};return rp(_0x49d5aa)[_0x623d('0x1b')](function(_0x5527e9){_0x4239f8[_0x623d('0x78')]=_0x5527e9;var _0x48ec76={'messageId':_0x4239f8[_0x623d('0x76')][_0x623d('0x79')],'read':!![]};return _0x28876a[_0x623d('0x1c')](_0x48ec76);});}else{return logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x512f29,{'showHidden':![],'depth':null}));}})[_0x623d('0x1e')](function(_0x181d19){return logger[_0x623d('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x623d('0x2b'),_0x623d('0x72'),util[_0x623d('0x2c')](_0x181d19,{'showHidden':![],'depth':null}));});}else{return logger[_0x623d('0x1f')](_0x623d('0x2a'),_0x623d('0x2b'),_0x623d('0x72'),_0x623d('0x7a'));}break;}}})['finally'](function(){_0x133315();});}else{_0x133315();}}},'charset':'utf8mb4','collate':_0x623d('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 03698a7..cc792d8 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 _0xc388=['http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','options','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52db4f,_0x4a4483){var _0x585142=function(_0x4e56c1){while(--_0x4e56c1){_0x52db4f['push'](_0x52db4f['shift']());}};_0x585142(++_0x4a4483);}(_0xc388,0x18b));var _0x8c38=function(_0x59f4ca,_0x39737b){_0x59f4ca=_0x59f4ca-0x0;var _0x136ff3=_0xc388[_0x59f4ca];return _0x136ff3;};'use strict';var _=require(_0x8c38('0x0'));var util=require('util');var moment=require(_0x8c38('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c38('0x2'));var fs=require('fs');var Redis=require(_0x8c38('0x3'));var db=require(_0x8c38('0x4'))['db'];var utils=require(_0x8c38('0x5'));var logger=require(_0x8c38('0x6'))(_0x8c38('0x7'));var config=require(_0x8c38('0x8'));var jayson=require(_0x8c38('0x9'));var client=jayson[_0x8c38('0xa')][_0x8c38('0xb')]({'port':0x232a});config[_0x8c38('0xc')]=_[_0x8c38('0xd')](config[_0x8c38('0xc')],{'host':_0x8c38('0xe'),'port':0x18eb});var socket=require(_0x8c38('0xf'))(new Redis(config[_0x8c38('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x9b8e81,_0x5797ff,_0x585df7){return new BPromise(function(_0x131a15,_0x69279d){return client['request'](_0x9b8e81,_0x585df7)[_0x8c38('0x10')](function(_0xc48e9b){logger[_0x8c38('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5797ff,_0x8c38('0x12'));logger[_0x8c38('0x13')](_0x8c38('0x14'),_0x5797ff,_0x8c38('0x12'),JSON['stringify'](_0xc48e9b));if(_0xc48e9b[_0x8c38('0x15')]){if(_0xc48e9b[_0x8c38('0x15')][_0x8c38('0x16')]===0x1f4){logger[_0x8c38('0x15')](_0x8c38('0x17'),_0x5797ff,_0xc48e9b[_0x8c38('0x15')][_0x8c38('0x18')]);return _0x69279d(_0xc48e9b[_0x8c38('0x15')][_0x8c38('0x18')]);}logger[_0x8c38('0x15')](_0x8c38('0x17'),_0x5797ff,_0xc48e9b['error'][_0x8c38('0x18')]);return _0x131a15(_0xc48e9b[_0x8c38('0x15')]['message']);}else{logger[_0x8c38('0x11')](_0x8c38('0x17'),_0x5797ff,_0x8c38('0x12'));_0x131a15(_0xc48e9b['result']['message']);}})[_0x8c38('0x19')](function(_0x50b504){logger[_0x8c38('0x15')](_0x8c38('0x17'),_0x5797ff,_0x50b504);_0x69279d(_0x50b504);});});}exports[_0x8c38('0x1a')]=function(_0x3a24b8){var _0x38589c=this;return new Promise(function(_0x236484,_0x128727){return db[_0x8c38('0x1b')]['create'](_0x3a24b8['body'],{'raw':_0x3a24b8[_0x8c38('0x1c')]?_0x3a24b8[_0x8c38('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x8c38('0x10')](function(_0xa7a486){logger[_0x8c38('0x11')](_0x8c38('0x1a'),_0x3a24b8);logger['debug'](_0x8c38('0x1a'),_0x3a24b8,JSON['stringify'](_0xa7a486));_0x236484(_0xa7a486);})[_0x8c38('0x19')](function(_0x563e23){logger['error']('CreateSmsMessage',_0x563e23[_0x8c38('0x18')],_0x3a24b8);_0x128727(_0x38589c[_0x8c38('0x15')](0x1f4,_0x563e23['message']));});});}; \ No newline at end of file +var _0x0342=['stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','body','options','raw','then','debug','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x0342,0x14d));var _0x2034=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0x0342[_0x58b301];return _0x2171b3;};'use strict';var _=require(_0x2034('0x0'));var util=require('util');var moment=require(_0x2034('0x1'));var BPromise=require('bluebird');var rs=require(_0x2034('0x2'));var fs=require('fs');var Redis=require(_0x2034('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2034('0x4'))(_0x2034('0x5'));var config=require(_0x2034('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2034('0x7')][_0x2034('0x8')]({'port':0x232a});config[_0x2034('0x9')]=_[_0x2034('0xa')](config[_0x2034('0x9')],{'host':_0x2034('0xb'),'port':0x18eb});var socket=require(_0x2034('0xc'))(new Redis(config[_0x2034('0x9')]));require(_0x2034('0xd'))[_0x2034('0xe')](socket);function respondWithRpcPromise(_0x386e7f,_0x5c7ffd,_0x562b03){return new BPromise(function(_0x4cd6e3,_0x51d4d5){return client[_0x2034('0xf')](_0x386e7f,_0x562b03)['then'](function(_0x4997cf){logger[_0x2034('0x10')]('SmsMessage,\x20%s,\x20%s',_0x5c7ffd,_0x2034('0x11'));logger['debug'](_0x2034('0x12'),_0x5c7ffd,'request\x20sent',JSON[_0x2034('0x13')](_0x4997cf));if(_0x4997cf[_0x2034('0x14')]){if(_0x4997cf[_0x2034('0x14')][_0x2034('0x15')]===0x1f4){logger['error'](_0x2034('0x16'),_0x5c7ffd,_0x4997cf[_0x2034('0x14')][_0x2034('0x17')]);return _0x51d4d5(_0x4997cf[_0x2034('0x14')][_0x2034('0x17')]);}logger[_0x2034('0x14')]('SmsMessage,\x20%s,\x20%s',_0x5c7ffd,_0x4997cf['error'][_0x2034('0x17')]);return _0x4cd6e3(_0x4997cf[_0x2034('0x14')]['message']);}else{logger[_0x2034('0x10')](_0x2034('0x16'),_0x5c7ffd,'request\x20sent');_0x4cd6e3(_0x4997cf[_0x2034('0x18')]['message']);}})[_0x2034('0x19')](function(_0x51e387){logger[_0x2034('0x14')]('SmsMessage,\x20%s,\x20%s',_0x5c7ffd,_0x51e387);_0x51d4d5(_0x51e387);});});}exports[_0x2034('0x1a')]=function(_0xc3646f){var _0x31b7cc=this;return new Promise(function(_0x3c4bb8,_0x30f69c){return db['SmsMessage']['create'](_0xc3646f[_0x2034('0x1b')],{'raw':_0xc3646f[_0x2034('0x1c')]?_0xc3646f[_0x2034('0x1c')][_0x2034('0x1d')]===undefined?!![]:![]:!![]})[_0x2034('0x1e')](function(_0x9eb64f){logger[_0x2034('0x10')](_0x2034('0x1a'),_0xc3646f);logger[_0x2034('0x1f')](_0x2034('0x1a'),_0xc3646f,JSON[_0x2034('0x13')](_0x9eb64f));_0x3c4bb8(_0x9eb64f);})['catch'](function(_0x33bc73){logger[_0x2034('0x14')](_0x2034('0x1a'),_0x33bc73[_0x2034('0x17')],_0xc3646f);_0x30f69c(_0x31b7cc['error'](0x1f4,_0x33bc73[_0x2034('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e8e5680..1178461 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 _0x3488=['emit','removeListener','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x355a53,_0x4875bd){var _0x3a4721=function(_0x5919cd){while(--_0x5919cd){_0x355a53['push'](_0x355a53['shift']());}};_0x3a4721(++_0x4875bd);}(_0x3488,0x82));var _0x8348=function(_0x27933b,_0x2769ee){_0x27933b=_0x27933b-0x0;var _0x3065b9=_0x3488[_0x27933b];return _0x3065b9;};'use strict';var SmsMessageEvents=require(_0x8348('0x0'));var events=['save',_0x8348('0x1'),_0x8348('0x2')];function createListener(_0x1e6fab,_0x32afc5){return function(_0x520026){_0x32afc5[_0x8348('0x3')](_0x1e6fab,_0x520026);};}function removeListener(_0x360078,_0x40730e){return function(){SmsMessageEvents[_0x8348('0x4')](_0x360078,_0x40730e);};}exports['register']=function(_0x2ad262){for(var _0x489506=0x0,_0x32c596=events[_0x8348('0x5')];_0x489506<_0x32c596;_0x489506++){var _0x2d9568=events[_0x489506];var _0x4dbbd3=createListener(_0x8348('0x6')+_0x2d9568,_0x2ad262);SmsMessageEvents['on'](_0x2d9568,_0x4dbbd3);}}; \ No newline at end of file +var _0x4fed=['remove','emit','length','smsMessage:','./smsMessage.events'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0x4fed,0x167));var _0xd4fe=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x4fed[_0x3f0b30];return _0x2748a5;};'use strict';var SmsMessageEvents=require(_0xd4fe('0x0'));var events=['save',_0xd4fe('0x1'),'update'];function createListener(_0x7e528a,_0x1c4581){return function(_0x18411b){_0x1c4581[_0xd4fe('0x2')](_0x7e528a,_0x18411b);};}function removeListener(_0x162710,_0x367bae){return function(){SmsMessageEvents['removeListener'](_0x162710,_0x367bae);};}exports['register']=function(_0xec5d02){for(var _0x259114=0x0,_0x57b402=events[_0xd4fe('0x3')];_0x259114<_0x57b402;_0x259114++){var _0x134a75=events[_0x259114];var _0x19dcff=createListener(_0xd4fe('0x4')+_0x134a75,_0xec5d02);SmsMessageEvents['on'](_0x134a75,_0x19dcff);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ee1bb63..dfd7adc 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 _0xeb28=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','create','post','addTeams','/:id/users','put','update','delete','destroy','removeAgents','multer','util'];(function(_0x47e5c6,_0x1da014){var _0x5aa374=function(_0x2d2068){while(--_0x2d2068){_0x47e5c6['push'](_0x47e5c6['shift']());}};_0x5aa374(++_0x1da014);}(_0xeb28,0x94));var _0x8eb2=function(_0x5ca169,_0x50cee4){_0x5ca169=_0x5ca169-0x0;var _0x285371=_0xeb28[_0x5ca169];return _0x285371;};'use strict';var multer=require(_0x8eb2('0x0'));var util=require(_0x8eb2('0x1'));var path=require(_0x8eb2('0x2'));var timeout=require(_0x8eb2('0x3'));var express=require(_0x8eb2('0x4'));var router=express[_0x8eb2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8eb2('0x6'));var config=require(_0x8eb2('0x7'));var controller=require('./smsQueue.controller');router[_0x8eb2('0x8')]('/',auth[_0x8eb2('0x9')](),controller['index']);router[_0x8eb2('0x8')]('/describe',auth[_0x8eb2('0x9')](),controller[_0x8eb2('0xa')]);router[_0x8eb2('0x8')](_0x8eb2('0xb'),auth[_0x8eb2('0x9')](),controller[_0x8eb2('0xc')]);router[_0x8eb2('0x8')](_0x8eb2('0xd'),auth[_0x8eb2('0x9')](),controller[_0x8eb2('0xe')]);router[_0x8eb2('0x8')](_0x8eb2('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x8eb2('0x8')]('/:id/users',auth[_0x8eb2('0x9')](),controller['getAgents']);router['post']('/',auth[_0x8eb2('0x9')](),controller[_0x8eb2('0x10')]);router[_0x8eb2('0x11')](_0x8eb2('0xf'),auth['isAuthenticated'](),controller[_0x8eb2('0x12')]);router[_0x8eb2('0x11')](_0x8eb2('0x13'),auth[_0x8eb2('0x9')](),controller['addAgents']);router[_0x8eb2('0x14')](_0x8eb2('0xb'),auth['isAuthenticated'](),controller[_0x8eb2('0x15')]);router[_0x8eb2('0x16')](_0x8eb2('0xb'),auth[_0x8eb2('0x9')](),controller[_0x8eb2('0x17')]);router[_0x8eb2('0x16')]('/:id/teams',auth[_0x8eb2('0x9')](),controller['removeTeams']);router['delete'](_0x8eb2('0x13'),auth['isAuthenticated'](),controller[_0x8eb2('0x18')]);module['exports']=router; \ No newline at end of file +var _0xaad7=['removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy'];(function(_0x6f2ce5,_0x4231eb){var _0x28a54a=function(_0x1bc980){while(--_0x1bc980){_0x6f2ce5['push'](_0x6f2ce5['shift']());}};_0x28a54a(++_0x4231eb);}(_0xaad7,0x1ab));var _0x7aad=function(_0x499d07,_0x4bebd2){_0x499d07=_0x499d07-0x0;var _0x2728b8=_0xaad7[_0x499d07];return _0x2728b8;};'use strict';var multer=require('multer');var util=require(_0x7aad('0x0'));var path=require('path');var timeout=require(_0x7aad('0x1'));var express=require(_0x7aad('0x2'));var router=express[_0x7aad('0x3')]();var fs_extra=require(_0x7aad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7aad('0x5'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x7aad('0x6')]('/',auth[_0x7aad('0x7')](),controller[_0x7aad('0x8')]);router[_0x7aad('0x6')]('/describe',auth[_0x7aad('0x7')](),controller['describe']);router[_0x7aad('0x6')](_0x7aad('0x9'),auth['isAuthenticated'](),controller[_0x7aad('0xa')]);router[_0x7aad('0x6')]('/:id/members',auth[_0x7aad('0x7')](),controller[_0x7aad('0xb')]);router['get'](_0x7aad('0xc'),auth['isAuthenticated'](),controller[_0x7aad('0xd')]);router[_0x7aad('0x6')](_0x7aad('0xe'),auth['isAuthenticated'](),controller[_0x7aad('0xf')]);router['post']('/',auth[_0x7aad('0x7')](),controller[_0x7aad('0x10')]);router[_0x7aad('0x11')](_0x7aad('0xc'),auth[_0x7aad('0x7')](),controller[_0x7aad('0x12')]);router['post'](_0x7aad('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7aad('0x13')](_0x7aad('0x9'),auth['isAuthenticated'](),controller[_0x7aad('0x14')]);router[_0x7aad('0x15')](_0x7aad('0x9'),auth[_0x7aad('0x7')](),controller[_0x7aad('0x16')]);router[_0x7aad('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x7aad('0xe'),auth[_0x7aad('0x7')](),controller[_0x7aad('0x17')]);module[_0x7aad('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index a18c6f8..8466df4 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 _0x1c28=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','name'];(function(_0x48740a,_0x552ec1){var _0x41097e=function(_0x27ac03){while(--_0x27ac03){_0x48740a['push'](_0x48740a['shift']());}};_0x41097e(++_0x552ec1);}(_0x1c28,0x7d));var _0x81c2=function(_0x3c4165,_0x1ab0b1){_0x3c4165=_0x3c4165-0x0;var _0x4dc920=_0x1c28[_0x3c4165];return _0x4dc920;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x81c2('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x81c2('0x1')]},'timeout':{'type':Sequelize[_0x81c2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x81c2('0x3')](_0x81c2('0x4'),_0x81c2('0x5'),_0x81c2('0x6'))}}; \ No newline at end of file +var _0x262d=['name','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x244ad2,_0x51d1bc){var _0x10fa3d=function(_0x4f6cb7){while(--_0x4f6cb7){_0x244ad2['push'](_0x244ad2['shift']());}};_0x10fa3d(++_0x51d1bc);}(_0x262d,0x6d));var _0xd262=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x262d[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0xd262('0x0'));module[_0xd262('0x1')]={'name':{'type':Sequelize[_0xd262('0x2')],'unique':_0xd262('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd262('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd262('0x4'),_0xd262('0x5'),_0xd262('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ad52e4e..7078b67 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xadb5,0xad));var _0x5adb=function(_0x29c0ac,_0x580408){_0x29c0ac=_0x29c0ac-0x0;var _0x13aa2c=_0xadb5[_0x29c0ac];return _0x13aa2c;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _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(_0x1746c6,_0x9ac0ff){var _0x25c091=function(_0x263ba7){while(--_0x263ba7){_0x1746c6['push'](_0x1746c6['shift']());}};_0x25c091(++_0x9ac0ff);}(_0x7a54,0x106));var _0x47a5=function(_0x895776,_0x3b3dfb){_0x895776=_0x895776-0x0;var _0x601ef2=_0x7a54[_0x895776];return _0x601ef2;};'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 diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3f9c102..9fdeb89 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 _0x24e1=['SmsQueue','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x14e9de,_0x1801af){var _0x3e1929=function(_0x5072e5){while(--_0x5072e5){_0x14e9de['push'](_0x14e9de['shift']());}};_0x3e1929(++_0x1801af);}(_0x24e1,0xcc));var _0x124e=function(_0x55f0f2,_0x20f85b){_0x55f0f2=_0x55f0f2-0x0;var _0x3b0734=_0x24e1[_0x55f0f2];return _0x3b0734;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x124e('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x124e('0x1')](0x0);var events={'afterCreate':_0x124e('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x291841){return function(_0x3d7145,_0x56ae6c,_0x43344f){SmsQueueEvents[_0x124e('0x3')](_0x291841+':'+_0x3d7145['id'],_0x3d7145);SmsQueueEvents[_0x124e('0x3')](_0x291841,_0x3d7145);_0x43344f(null);};}for(var e in events){if(events[_0x124e('0x4')](e)){var event=events[e];SmsQueue[_0x124e('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x4dc4=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x3dc089,_0x5ccb0d){var _0x34d9d3=function(_0x4556bf){while(--_0x4556bf){_0x3dc089['push'](_0x3dc089['shift']());}};_0x34d9d3(++_0x5ccb0d);}(_0x4dc4,0x175));var _0x44dc=function(_0x2abf03,_0xda4a7){_0x2abf03=_0x2abf03-0x0;var _0x275177=_0x4dc4[_0x2abf03];return _0x275177;};'use strict';var EventEmitter=require(_0x44dc('0x0'));var SmsQueue=require(_0x44dc('0x1'))['db'][_0x44dc('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x44dc('0x3')](0x0);var events={'afterCreate':_0x44dc('0x4'),'afterUpdate':_0x44dc('0x5'),'afterDestroy':_0x44dc('0x6')};function emitEvent(_0xdc8961){return function(_0x577c0e,_0x7774c0,_0x3123e1){SmsQueueEvents[_0x44dc('0x7')](_0xdc8961+':'+_0x577c0e['id'],_0x577c0e);SmsQueueEvents['emit'](_0xdc8961,_0x577c0e);_0x3123e1(null);};}for(var e in events){if(events[_0x44dc('0x8')](e)){var event=events[e];SmsQueue[_0x44dc('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 611ff96..fe18f4b 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 _0x9379=['moment','request-promise','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api'];(function(_0x118272,_0x6d0b7a){var _0x213655=function(_0x43dae0){while(--_0x43dae0){_0x118272['push'](_0x118272['shift']());}};_0x213655(++_0x6d0b7a);}(_0x9379,0x1e1));var _0x9937=function(_0x44c731,_0x2e2259){_0x44c731=_0x44c731-0x0;var _0x509835=_0x9379[_0x44c731];return _0x509835;};'use strict';var _=require(_0x9937('0x0'));var util=require(_0x9937('0x1'));var logger=require('../../config/logger')(_0x9937('0x2'));var moment=require(_0x9937('0x3'));var BPromise=require('bluebird');var rp=require(_0x9937('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9937('0x5'));var attributes=require(_0x9937('0x6'));module[_0x9937('0x7')]=function(_0x581c77,_0x499e88){return _0x581c77[_0x9937('0x8')](_0x9937('0x9'),attributes,{'tableName':_0x9937('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1b4=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xc1b4,0x1d9));var _0x4c1b=function(_0x1b161d,_0x28ea23){_0x1b161d=_0x1b161d-0x0;var _0x1b9195=_0xc1b4[_0x1b161d];return _0x1b9195;};'use strict';var _=require(_0x4c1b('0x0'));var util=require(_0x4c1b('0x1'));var logger=require(_0x4c1b('0x2'))('api');var moment=require(_0x4c1b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c1b('0x4'));var fs=require('fs');var path=require(_0x4c1b('0x5'));var rimraf=require(_0x4c1b('0x6'));var config=require(_0x4c1b('0x7'));var attributes=require(_0x4c1b('0x8'));module[_0x4c1b('0x9')]=function(_0x59c755,_0x36cd04){return _0x59c755[_0x4c1b('0xa')](_0x4c1b('0xb'),attributes,{'tableName':_0x4c1b('0xc'),'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 cac50b1..c72f64c 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 _0x6d8f=['limit','include','model','attributes','then','stringify','catch','ShowSmsQueue','find','map','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetSmsQueue','SmsQueue','options','raw','where'];(function(_0xebd34d,_0xc27e49){var _0x110926=function(_0x3a2e55){while(--_0x3a2e55){_0xebd34d['push'](_0xebd34d['shift']());}};_0x110926(++_0xc27e49);}(_0x6d8f,0x1b7));var _0xf6d8=function(_0x116c88,_0x1b27e6){_0x116c88=_0x116c88-0x0;var _0x7d2a72=_0x6d8f[_0x116c88];return _0x7d2a72;};'use strict';var _=require('lodash');var util=require(_0xf6d8('0x0'));var moment=require(_0xf6d8('0x1'));var BPromise=require(_0xf6d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6d8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6d8('0x4'))(_0xf6d8('0x5'));var config=require(_0xf6d8('0x6'));var jayson=require(_0xf6d8('0x7'));var client=jayson[_0xf6d8('0x8')][_0xf6d8('0x9')]({'port':0x232a});config[_0xf6d8('0xa')]=_[_0xf6d8('0xb')](config[_0xf6d8('0xa')],{'host':_0xf6d8('0xc'),'port':0x18eb});var socket=require(_0xf6d8('0xd'))(new Redis(config['redis']));require(_0xf6d8('0xe'))[_0xf6d8('0xf')](socket);function respondWithRpcPromise(_0x2076c9,_0x144270,_0x3e7101){return new BPromise(function(_0x364ba6,_0x3da693){return client['request'](_0x2076c9,_0x3e7101)['then'](function(_0x2e84f0){logger[_0xf6d8('0x10')](_0xf6d8('0x11'),_0x144270,_0xf6d8('0x12'));logger[_0xf6d8('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x144270,_0xf6d8('0x12'),JSON['stringify'](_0x2e84f0));if(_0x2e84f0[_0xf6d8('0x14')]){if(_0x2e84f0[_0xf6d8('0x14')][_0xf6d8('0x15')]===0x1f4){logger[_0xf6d8('0x14')]('SmsQueue,\x20%s,\x20%s',_0x144270,_0x2e84f0[_0xf6d8('0x14')][_0xf6d8('0x16')]);return _0x3da693(_0x2e84f0[_0xf6d8('0x14')][_0xf6d8('0x16')]);}logger['error'](_0xf6d8('0x11'),_0x144270,_0x2e84f0['error'][_0xf6d8('0x16')]);return _0x364ba6(_0x2e84f0[_0xf6d8('0x14')][_0xf6d8('0x16')]);}else{logger[_0xf6d8('0x10')](_0xf6d8('0x11'),_0x144270,'request\x20sent');_0x364ba6(_0x2e84f0[_0xf6d8('0x17')][_0xf6d8('0x16')]);}})['catch'](function(_0x16d07c){logger[_0xf6d8('0x14')](_0xf6d8('0x11'),_0x144270,_0x16d07c);_0x3da693(_0x16d07c);});});}exports[_0xf6d8('0x18')]=function(_0x57cbbf){var _0x45e70f=this;return new Promise(function(_0x3c2c29,_0x3e02c1){return db[_0xf6d8('0x19')]['findAll']({'raw':_0x57cbbf[_0xf6d8('0x1a')]?_0x57cbbf['options'][_0xf6d8('0x1b')]===undefined?!![]:![]:!![],'where':_0x57cbbf[_0xf6d8('0x1a')]?_0x57cbbf[_0xf6d8('0x1a')][_0xf6d8('0x1c')]||null:null,'attributes':_0x57cbbf['options']?_0x57cbbf[_0xf6d8('0x1a')]['attributes']||null:null,'limit':_0x57cbbf['options']?_0x57cbbf[_0xf6d8('0x1a')][_0xf6d8('0x1d')]||null:null,'include':_0x57cbbf[_0xf6d8('0x1a')]?_0x57cbbf['options'][_0xf6d8('0x1e')]?_['map'](_0x57cbbf[_0xf6d8('0x1a')][_0xf6d8('0x1e')],function(_0x454e31){return{'model':db[_0x454e31[_0xf6d8('0x1f')]],'as':_0x454e31['as'],'attributes':_0x454e31[_0xf6d8('0x20')],'include':_0x454e31[_0xf6d8('0x1e')]?_['map'](_0x454e31['include'],function(_0x3baf4c){return{'model':db[_0x3baf4c['model']],'as':_0x3baf4c['as'],'attributes':_0x3baf4c[_0xf6d8('0x20')],'include':_0x3baf4c[_0xf6d8('0x1e')]?_['map'](_0x3baf4c['include'],function(_0x139605){return{'model':db[_0x139605[_0xf6d8('0x1f')]],'as':_0x139605['as'],'attributes':_0x139605[_0xf6d8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf6d8('0x21')](function(_0x5e9d19){logger[_0xf6d8('0x10')](_0xf6d8('0x18'),_0x57cbbf);logger[_0xf6d8('0x13')]('GetSmsQueue',_0x57cbbf,JSON[_0xf6d8('0x22')](_0x5e9d19));_0x3c2c29(_0x5e9d19);})[_0xf6d8('0x23')](function(_0x3aba28){logger['error'](_0xf6d8('0x18'),_0x3aba28[_0xf6d8('0x16')],_0x57cbbf);_0x3e02c1(_0x45e70f[_0xf6d8('0x14')](0x1f4,_0x3aba28['message']));});});};exports[_0xf6d8('0x24')]=function(_0x58ba74){var _0x331ec0=this;return new Promise(function(_0x35b926,_0x330082){return db['SmsQueue'][_0xf6d8('0x25')]({'raw':_0x58ba74['options']?_0x58ba74[_0xf6d8('0x1a')][_0xf6d8('0x1b')]===undefined?!![]:![]:!![],'where':_0x58ba74['options']?_0x58ba74[_0xf6d8('0x1a')]['where']||null:null,'attributes':_0x58ba74[_0xf6d8('0x1a')]?_0x58ba74['options'][_0xf6d8('0x20')]||null:null,'include':_0x58ba74[_0xf6d8('0x1a')]?_0x58ba74['options'][_0xf6d8('0x1e')]?_[_0xf6d8('0x26')](_0x58ba74[_0xf6d8('0x1a')]['include'],function(_0x56c20f){return{'model':db[_0x56c20f['model']],'as':_0x56c20f['as'],'attributes':_0x56c20f[_0xf6d8('0x20')],'include':_0x56c20f['include']?_[_0xf6d8('0x26')](_0x56c20f[_0xf6d8('0x1e')],function(_0x5441c7){return{'model':db[_0x5441c7['model']],'as':_0x5441c7['as'],'attributes':_0x5441c7[_0xf6d8('0x20')],'include':_0x5441c7[_0xf6d8('0x1e')]?_[_0xf6d8('0x26')](_0x5441c7[_0xf6d8('0x1e')],function(_0xdda290){return{'model':db[_0xdda290[_0xf6d8('0x1f')]],'as':_0xdda290['as'],'attributes':_0xdda290[_0xf6d8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x578f49){logger[_0xf6d8('0x10')](_0xf6d8('0x24'),_0x58ba74);logger[_0xf6d8('0x13')](_0xf6d8('0x24'),_0x58ba74,JSON[_0xf6d8('0x22')](_0x578f49));_0x35b926(_0x578f49);})[_0xf6d8('0x23')](function(_0x44ae05){logger[_0xf6d8('0x14')](_0xf6d8('0x24'),_0x44ae05[_0xf6d8('0x16')],_0x58ba74);_0x330082(_0x331ec0[_0xf6d8('0x14')](0x1f4,_0x44ae05[_0xf6d8('0x16')]));});});}; \ No newline at end of file +var _0xa5d1=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowSmsQueue','SmsQueue','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xa5d1,0xa5));var _0x1a5d=function(_0x54f73e,_0x4946c1){_0x54f73e=_0x54f73e-0x0;var _0x5ed7cd=_0xa5d1[_0x54f73e];return _0x5ed7cd;};'use strict';var _=require('lodash');var util=require(_0x1a5d('0x0'));var moment=require('moment');var BPromise=require(_0x1a5d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5d('0x2'));var db=require(_0x1a5d('0x3'))['db'];var utils=require(_0x1a5d('0x4'));var logger=require(_0x1a5d('0x5'))(_0x1a5d('0x6'));var config=require(_0x1a5d('0x7'));var jayson=require(_0x1a5d('0x8'));var client=jayson[_0x1a5d('0x9')][_0x1a5d('0xa')]({'port':0x232a});config['redis']=_[_0x1a5d('0xb')](config[_0x1a5d('0xc')],{'host':_0x1a5d('0xd'),'port':0x18eb});var socket=require(_0x1a5d('0xe'))(new Redis(config[_0x1a5d('0xc')]));require(_0x1a5d('0xf'))[_0x1a5d('0x10')](socket);function respondWithRpcPromise(_0x303983,_0x256ed8,_0x22a4c8){return new BPromise(function(_0x405ad6,_0x1a27ec){return client[_0x1a5d('0x11')](_0x303983,_0x22a4c8)[_0x1a5d('0x12')](function(_0x245abc){logger[_0x1a5d('0x13')](_0x1a5d('0x14'),_0x256ed8,_0x1a5d('0x15'));logger['debug'](_0x1a5d('0x16'),_0x256ed8,_0x1a5d('0x15'),JSON[_0x1a5d('0x17')](_0x245abc));if(_0x245abc[_0x1a5d('0x18')]){if(_0x245abc[_0x1a5d('0x18')][_0x1a5d('0x19')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x256ed8,_0x245abc[_0x1a5d('0x18')][_0x1a5d('0x1a')]);return _0x1a27ec(_0x245abc[_0x1a5d('0x18')]['message']);}logger['error'](_0x1a5d('0x14'),_0x256ed8,_0x245abc[_0x1a5d('0x18')][_0x1a5d('0x1a')]);return _0x405ad6(_0x245abc['error'][_0x1a5d('0x1a')]);}else{logger[_0x1a5d('0x13')]('SmsQueue,\x20%s,\x20%s',_0x256ed8,'request\x20sent');_0x405ad6(_0x245abc[_0x1a5d('0x1b')][_0x1a5d('0x1a')]);}})[_0x1a5d('0x1c')](function(_0x470d67){logger[_0x1a5d('0x18')](_0x1a5d('0x14'),_0x256ed8,_0x470d67);_0x1a27ec(_0x470d67);});});}exports[_0x1a5d('0x1d')]=function(_0x36d186){var _0x5d8abf=this;return new Promise(function(_0x5b54b3,_0x918041){return db['SmsQueue'][_0x1a5d('0x1e')]({'raw':_0x36d186[_0x1a5d('0x1f')]?_0x36d186[_0x1a5d('0x1f')][_0x1a5d('0x20')]===undefined?!![]:![]:!![],'where':_0x36d186[_0x1a5d('0x1f')]?_0x36d186[_0x1a5d('0x1f')][_0x1a5d('0x21')]||null:null,'attributes':_0x36d186[_0x1a5d('0x1f')]?_0x36d186[_0x1a5d('0x1f')][_0x1a5d('0x22')]||null:null,'limit':_0x36d186[_0x1a5d('0x1f')]?_0x36d186[_0x1a5d('0x1f')][_0x1a5d('0x23')]||null:null,'include':_0x36d186[_0x1a5d('0x1f')]?_0x36d186[_0x1a5d('0x1f')]['include']?_[_0x1a5d('0x24')](_0x36d186[_0x1a5d('0x1f')][_0x1a5d('0x25')],function(_0x1d304f){return{'model':db[_0x1d304f[_0x1a5d('0x26')]],'as':_0x1d304f['as'],'attributes':_0x1d304f['attributes'],'include':_0x1d304f[_0x1a5d('0x25')]?_[_0x1a5d('0x24')](_0x1d304f[_0x1a5d('0x25')],function(_0x567ad8){return{'model':db[_0x567ad8[_0x1a5d('0x26')]],'as':_0x567ad8['as'],'attributes':_0x567ad8[_0x1a5d('0x22')],'include':_0x567ad8['include']?_['map'](_0x567ad8[_0x1a5d('0x25')],function(_0x21293d){return{'model':db[_0x21293d[_0x1a5d('0x26')]],'as':_0x21293d['as'],'attributes':_0x21293d[_0x1a5d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1a5d('0x12')](function(_0x539277){logger['info']('GetSmsQueue',_0x36d186);logger[_0x1a5d('0x27')]('GetSmsQueue',_0x36d186,JSON[_0x1a5d('0x17')](_0x539277));_0x5b54b3(_0x539277);})[_0x1a5d('0x1c')](function(_0x393c55){logger[_0x1a5d('0x18')]('GetSmsQueue',_0x393c55['message'],_0x36d186);_0x918041(_0x5d8abf['error'](0x1f4,_0x393c55[_0x1a5d('0x1a')]));});});};exports[_0x1a5d('0x28')]=function(_0x5639ba){var _0x2e8e2f=this;return new Promise(function(_0x69e6d4,_0xb90a06){return db[_0x1a5d('0x29')][_0x1a5d('0x2a')]({'raw':_0x5639ba[_0x1a5d('0x1f')]?_0x5639ba[_0x1a5d('0x1f')][_0x1a5d('0x20')]===undefined?!![]:![]:!![],'where':_0x5639ba[_0x1a5d('0x1f')]?_0x5639ba[_0x1a5d('0x1f')][_0x1a5d('0x21')]||null:null,'attributes':_0x5639ba[_0x1a5d('0x1f')]?_0x5639ba[_0x1a5d('0x1f')][_0x1a5d('0x22')]||null:null,'include':_0x5639ba[_0x1a5d('0x1f')]?_0x5639ba[_0x1a5d('0x1f')][_0x1a5d('0x25')]?_[_0x1a5d('0x24')](_0x5639ba[_0x1a5d('0x1f')][_0x1a5d('0x25')],function(_0x2d4a76){return{'model':db[_0x2d4a76[_0x1a5d('0x26')]],'as':_0x2d4a76['as'],'attributes':_0x2d4a76['attributes'],'include':_0x2d4a76[_0x1a5d('0x25')]?_[_0x1a5d('0x24')](_0x2d4a76[_0x1a5d('0x25')],function(_0x206e87){return{'model':db[_0x206e87[_0x1a5d('0x26')]],'as':_0x206e87['as'],'attributes':_0x206e87['attributes'],'include':_0x206e87[_0x1a5d('0x25')]?_['map'](_0x206e87[_0x1a5d('0x25')],function(_0x25b13c){return{'model':db[_0x25b13c[_0x1a5d('0x26')]],'as':_0x25b13c['as'],'attributes':_0x25b13c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a5d('0x12')](function(_0x47147c){logger[_0x1a5d('0x13')]('ShowSmsQueue',_0x5639ba);logger[_0x1a5d('0x27')]('ShowSmsQueue',_0x5639ba,JSON['stringify'](_0x47147c));_0x69e6d4(_0x47147c);})[_0x1a5d('0x1c')](function(_0x4a9881){logger[_0x1a5d('0x18')](_0x1a5d('0x28'),_0x4a9881['message'],_0x5639ba);_0xb90a06(_0x2e8e2f[_0x1a5d('0x18')](0x1f4,_0x4a9881[_0x1a5d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index deed998..4358d35 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 _0x7abf=['emit','removeListener','register','./smsQueue.events','save','remove','update'];(function(_0x4e08ce,_0x1c95d5){var _0x583777=function(_0x3c2343){while(--_0x3c2343){_0x4e08ce['push'](_0x4e08ce['shift']());}};_0x583777(++_0x1c95d5);}(_0x7abf,0x81));var _0xf7ab=function(_0x7c506f,_0x23ab0e){_0x7c506f=_0x7c506f-0x0;var _0xbd4bf0=_0x7abf[_0x7c506f];return _0xbd4bf0;};'use strict';var SmsQueueEvents=require(_0xf7ab('0x0'));var events=[_0xf7ab('0x1'),_0xf7ab('0x2'),_0xf7ab('0x3')];function createListener(_0xcf148a,_0x4d52d1){return function(_0x3e3bd1){_0x4d52d1[_0xf7ab('0x4')](_0xcf148a,_0x3e3bd1);};}function removeListener(_0x571d43,_0x133c4e){return function(){SmsQueueEvents[_0xf7ab('0x5')](_0x571d43,_0x133c4e);};}exports[_0xf7ab('0x6')]=function(_0x24c82c){for(var _0x697883=0x0,_0xf48b46=events['length'];_0x697883<_0xf48b46;_0x697883++){var _0x420a2f=events[_0x697883];var _0x2e23f9=createListener('smsQueue:'+_0x420a2f,_0x24c82c);SmsQueueEvents['on'](_0x420a2f,_0x2e23f9);}}; \ No newline at end of file +var _0xe926=['./smsQueue.events','save','update','register','smsQueue:'];(function(_0x33d9c5,_0x2c159d){var _0x28f547=function(_0x61fc92){while(--_0x61fc92){_0x33d9c5['push'](_0x33d9c5['shift']());}};_0x28f547(++_0x2c159d);}(_0xe926,0xf0));var _0x6e92=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xe926[_0x49ca18];return _0x145d54;};'use strict';var SmsQueueEvents=require(_0x6e92('0x0'));var events=[_0x6e92('0x1'),'remove',_0x6e92('0x2')];function createListener(_0x5e40df,_0x4209eb){return function(_0x4b6610){_0x4209eb['emit'](_0x5e40df,_0x4b6610);};}function removeListener(_0x57f482,_0x164906){return function(){SmsQueueEvents['removeListener'](_0x57f482,_0x164906);};}exports[_0x6e92('0x3')]=function(_0x14cfae){for(var _0x5c9416=0x0,_0x2305db=events['length'];_0x5c9416<_0x2305db;_0x5c9416++){var _0x52458c=events[_0x5c9416];var _0x38e372=createListener(_0x6e92('0x4')+_0x52458c,_0x14cfae);SmsQueueEvents['on'](_0x52458c,_0x38e372);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2d3e80d..5bb8a6c 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 _0x158f=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x158f,0x137));var _0xf158=function(_0x444e21,_0x3f63fb){_0x444e21=_0x444e21-0x0;var _0x56227d=_0x158f[_0x444e21];return _0x56227d;};'use strict';var multer=require('multer');var util=require(_0xf158('0x0'));var path=require(_0xf158('0x1'));var timeout=require(_0xf158('0x2'));var express=require(_0xf158('0x3'));var router=express[_0xf158('0x4')]();var fs_extra=require(_0xf158('0x5'));var auth=require(_0xf158('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf158('0x7'));var controller=require('./smsQueueReport.controller');router[_0xf158('0x8')]('/',auth[_0xf158('0x9')](),controller[_0xf158('0xa')]);router[_0xf158('0x8')](_0xf158('0xb'),auth[_0xf158('0x9')](),controller[_0xf158('0xc')]);router[_0xf158('0x8')](_0xf158('0xd'),auth[_0xf158('0x9')](),controller[_0xf158('0xe')]);router[_0xf158('0xf')]('/',auth['isAuthenticated'](),controller[_0xf158('0x10')]);router[_0xf158('0x11')](_0xf158('0xd'),auth[_0xf158('0x9')](),controller['update']);router[_0xf158('0x12')](_0xf158('0xd'),auth[_0xf158('0x9')](),controller[_0xf158('0x13')]);module[_0xf158('0x14')]=router; \ No newline at end of file +var _0x4e0a=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x8dedb7,_0x1cfb46){var _0x27b550=function(_0x44aea6){while(--_0x44aea6){_0x8dedb7['push'](_0x8dedb7['shift']());}};_0x27b550(++_0x1cfb46);}(_0x4e0a,0x1d5));var _0xa4e0=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0x4e0a[_0x722103];return _0x3e2435;};'use strict';var multer=require(_0xa4e0('0x0'));var util=require('util');var path=require(_0xa4e0('0x1'));var timeout=require(_0xa4e0('0x2'));var express=require('express');var router=express[_0xa4e0('0x3')]();var fs_extra=require(_0xa4e0('0x4'));var auth=require(_0xa4e0('0x5'));var interaction=require(_0xa4e0('0x6'));var config=require(_0xa4e0('0x7'));var controller=require(_0xa4e0('0x8'));router[_0xa4e0('0x9')]('/',auth[_0xa4e0('0xa')](),controller[_0xa4e0('0xb')]);router[_0xa4e0('0x9')]('/describe',auth[_0xa4e0('0xa')](),controller[_0xa4e0('0xc')]);router[_0xa4e0('0x9')](_0xa4e0('0xd'),auth[_0xa4e0('0xa')](),controller[_0xa4e0('0xe')]);router[_0xa4e0('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa4e0('0xd'),auth[_0xa4e0('0xa')](),controller[_0xa4e0('0x10')]);router['delete'](_0xa4e0('0xd'),auth[_0xa4e0('0xa')](),controller[_0xa4e0('0x11')]);module[_0xa4e0('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3fb9f83..67a2bf1 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 _0xbef8=['exports','DATE','moment','sequelize'];(function(_0x2f11,_0x9f5ca6){var _0x22f54c=function(_0x1850b4){while(--_0x1850b4){_0x2f11['push'](_0x2f11['shift']());}};_0x22f54c(++_0x9f5ca6);}(_0xbef8,0x1ea));var _0x8bef=function(_0x5b98f6,_0x404e48){_0x5b98f6=_0x5b98f6-0x0;var _0x13f65b=_0xbef8[_0x5b98f6];return _0x13f65b;};'use strict';var moment=require(_0x8bef('0x0'));var Sequelize=require(_0x8bef('0x1'));module[_0x8bef('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8bef('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8bef('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3716=['moment','sequelize','exports','STRING','DATE'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x3716,0xbe));var _0x6371=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x3716[_0x289891];return _0x31cf2e;};'use strict';var moment=require(_0x6371('0x0'));var Sequelize=require(_0x6371('0x1'));module[_0x6371('0x2')]={'uniqueid':{'type':Sequelize[_0x6371('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6371('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6371('0x4')]},'acceptAt':{'type':Sequelize[_0x6371('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6371('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4c16d92..8ef2f12 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 _0x0409=['to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','name','SmsQueueReport','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x1c41a9,_0x489de9){var _0x3e9d80=function(_0x4e4237){while(--_0x4e4237){_0x1c41a9['push'](_0x1c41a9['shift']());}};_0x3e9d80(++_0x489de9);}(_0x0409,0x123));var _0x9040=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x0409[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x9040('0x0'));var rimraf=require(_0x9040('0x1'));var zipdir=require(_0x9040('0x2'));var jsonpatch=require(_0x9040('0x3'));var rp=require(_0x9040('0x4'));var moment=require(_0x9040('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9040('0x6'));var util=require('util');var path=require(_0x9040('0x7'));var sox=require(_0x9040('0x8'));var csv=require(_0x9040('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9040('0xa'));var squel=require('squel');var crypto=require(_0x9040('0xb'));var jsforce=require(_0x9040('0xc'));var deskjs=require(_0x9040('0xd'));var toCsv=require(_0x9040('0x9'));var querystring=require(_0x9040('0xe'));var Papa=require(_0x9040('0xf'));var Redis=require(_0x9040('0x10'));var authService=require(_0x9040('0x11'));var qs=require(_0x9040('0x12'));var as=require(_0x9040('0x13'));var hardwareService=require(_0x9040('0x14'));var logger=require(_0x9040('0x15'))(_0x9040('0x16'));var utils=require(_0x9040('0x17'));var config=require(_0x9040('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9040('0x19'))['db'];function respondWithStatusCode(_0x1d5ae7,_0x217950){_0x217950=_0x217950||0xcc;return function(_0x404248){if(_0x404248){return _0x1d5ae7[_0x9040('0x1a')](_0x217950);}return _0x1d5ae7[_0x9040('0x1b')](_0x217950)[_0x9040('0x1c')]();};}function respondWithResult(_0x50f5b8,_0x200710){_0x200710=_0x200710||0xc8;return function(_0x266cbe){if(_0x266cbe){return _0x50f5b8[_0x9040('0x1b')](_0x200710)[_0x9040('0x1d')](_0x266cbe);}};}function respondWithFilteredResult(_0x10820f,_0x3a0041){return function(_0x42c225){if(_0x42c225){var _0x347b4a=typeof _0x3a0041[_0x9040('0x1e')]===_0x9040('0x1f')&&typeof _0x3a0041[_0x9040('0x20')]===_0x9040('0x1f');var _0x15895c=_0x42c225[_0x9040('0x21')];var _0x15cc42=_0x347b4a?0x0:_0x3a0041[_0x9040('0x1e')];var _0x53cfa2=_0x347b4a?_0x42c225[_0x9040('0x21')]:_0x3a0041[_0x9040('0x1e')]+_0x3a0041[_0x9040('0x20')];var _0x49a609;if(_0x53cfa2>=_0x15895c){_0x53cfa2=_0x15895c;_0x49a609=0xc8;}else{_0x49a609=0xce;}_0x10820f[_0x9040('0x1b')](_0x49a609);return _0x10820f[_0x9040('0x22')](_0x9040('0x23'),_0x15cc42+'-'+_0x53cfa2+'/'+_0x15895c)[_0x9040('0x1d')](_0x42c225);}return null;};}function patchUpdates(_0xc2ed6b){return function(_0x2ca0f5){try{jsonpatch[_0x9040('0x24')](_0x2ca0f5,_0xc2ed6b,!![]);}catch(_0x3c9891){return BPromise['reject'](_0x3c9891);}return _0x2ca0f5['save']();};}function saveUpdates(_0x510ac4,_0x4995d6){return function(_0x1dbbb4){if(_0x1dbbb4){return _0x1dbbb4[_0x9040('0x25')](_0x510ac4)[_0x9040('0x26')](function(_0x3a47d3){return _0x3a47d3;});}return null;};}function removeEntity(_0x149608,_0x13cdc4){return function(_0xae7bde){if(_0xae7bde){return _0xae7bde[_0x9040('0x27')]()['then'](function(){_0x149608[_0x9040('0x1b')](0xcc)[_0x9040('0x1c')]();});}};}function handleEntityNotFound(_0x464f2c,_0x1a167d){return function(_0x542aec){if(!_0x542aec){_0x464f2c['sendStatus'](0x194);}return _0x542aec;};}function handleError(_0x47e1b6,_0x55499a){_0x55499a=_0x55499a||0x1f4;return function(_0x5bb95c){logger[_0x9040('0x28')](_0x5bb95c['stack']);if(_0x5bb95c['name']){delete _0x5bb95c[_0x9040('0x29')];}_0x47e1b6['status'](_0x55499a)['send'](_0x5bb95c);};}exports['index']=function(_0x5568f5,_0x2ddab6){var _0x5b9d8b={},_0x469748={},_0x543062={'count':0x0,'rows':[]};var _0x1bc376=_['map'](db[_0x9040('0x2a')]['rawAttributes'],function(_0x762115){return{'name':_0x762115[_0x9040('0x2b')],'type':_0x762115['type'][_0x9040('0x2c')]};});_0x469748[_0x9040('0x2d')]=_[_0x9040('0x2e')](_0x1bc376,'name');_0x469748[_0x9040('0x2f')]=_[_0x9040('0x30')](_0x5568f5[_0x9040('0x2f')]);_0x469748[_0x9040('0x31')]=_[_0x9040('0x32')](_0x469748[_0x9040('0x2d')],_0x469748[_0x9040('0x2f')]);_0x5b9d8b['attributes']=_[_0x9040('0x32')](_0x469748[_0x9040('0x2d')],qs[_0x9040('0x33')](_0x5568f5[_0x9040('0x2f')]['fields']));_0x5b9d8b[_0x9040('0x34')]=_0x5b9d8b[_0x9040('0x34')]['length']?_0x5b9d8b[_0x9040('0x34')]:_0x469748['model'];if(!_0x5568f5[_0x9040('0x2f')]['hasOwnProperty'](_0x9040('0x35'))){_0x5b9d8b[_0x9040('0x20')]=qs['limit'](_0x5568f5[_0x9040('0x2f')][_0x9040('0x20')]);_0x5b9d8b[_0x9040('0x1e')]=qs[_0x9040('0x1e')](_0x5568f5['query']['offset']);}_0x5b9d8b[_0x9040('0x36')]=qs[_0x9040('0x37')](_0x5568f5['query'][_0x9040('0x37')]);_0x5b9d8b[_0x9040('0x38')]=qs[_0x9040('0x31')](_[_0x9040('0x39')](_0x5568f5[_0x9040('0x2f')],_0x469748[_0x9040('0x31')]),_0x1bc376);if(_0x5568f5[_0x9040('0x2f')][_0x9040('0x3a')]){_0x5b9d8b['where']=_[_0x9040('0x3b')](_0x5b9d8b['where'],{'$or':_[_0x9040('0x2e')](_0x1bc376,function(_0x34cd4e){if(_0x34cd4e[_0x9040('0x3c')]!==_0x9040('0x3d')){var _0x2aa5cc={};_0x2aa5cc[_0x34cd4e[_0x9040('0x29')]]={'$like':'%'+_0x5568f5[_0x9040('0x2f')][_0x9040('0x3a')]+'%'};return _0x2aa5cc;}})});}_0x5b9d8b=_['merge']({},_0x5b9d8b,_0x5568f5[_0x9040('0x3e')]);var _0x2d4c5a={'where':_0x5b9d8b[_0x9040('0x38')]};return db['SmsQueueReport'][_0x9040('0x21')](_0x2d4c5a)[_0x9040('0x26')](function(_0x370f51){_0x543062[_0x9040('0x21')]=_0x370f51;if(_0x5568f5[_0x9040('0x2f')][_0x9040('0x3f')]){_0x5b9d8b[_0x9040('0x40')]=[{'all':!![]}];}return db[_0x9040('0x2a')][_0x9040('0x41')](_0x5b9d8b);})[_0x9040('0x26')](function(_0x452edd){_0x543062[_0x9040('0x42')]=_0x452edd;return _0x543062;})['then'](respondWithFilteredResult(_0x2ddab6,_0x5b9d8b))[_0x9040('0x43')](handleError(_0x2ddab6,null));};exports['show']=function(_0x17d8b9,_0x4b232b){var _0x4169d9={'raw':!![],'where':{'id':_0x17d8b9['params']['id']}},_0x432073={};_0x432073['model']=_['keys'](db[_0x9040('0x2a')][_0x9040('0x44')]);_0x432073[_0x9040('0x2f')]=_['keys'](_0x17d8b9['query']);_0x432073[_0x9040('0x31')]=_['intersection'](_0x432073['model'],_0x432073[_0x9040('0x2f')]);_0x4169d9['attributes']=_[_0x9040('0x32')](_0x432073[_0x9040('0x2d')],qs[_0x9040('0x33')](_0x17d8b9[_0x9040('0x2f')][_0x9040('0x33')]));_0x4169d9[_0x9040('0x34')]=_0x4169d9[_0x9040('0x34')][_0x9040('0x45')]?_0x4169d9[_0x9040('0x34')]:_0x432073[_0x9040('0x2d')];if(_0x17d8b9[_0x9040('0x2f')]['includeAll']){_0x4169d9['include']=[{'all':!![]}];}_0x4169d9=_[_0x9040('0x3b')]({},_0x4169d9,_0x17d8b9[_0x9040('0x3e')]);return db[_0x9040('0x2a')][_0x9040('0x46')](_0x4169d9)[_0x9040('0x26')](handleEntityNotFound(_0x4b232b,null))['then'](respondWithResult(_0x4b232b,null))[_0x9040('0x43')](handleError(_0x4b232b,null));};exports[_0x9040('0x47')]=function(_0x2d93fb,_0x3be4ff){return db[_0x9040('0x2a')][_0x9040('0x47')](_0x2d93fb[_0x9040('0x48')],{})[_0x9040('0x26')](respondWithResult(_0x3be4ff,0xc9))['catch'](handleError(_0x3be4ff,null));};exports['update']=function(_0x4855ab,_0x3e27bb){if(_0x4855ab['body']['id']){delete _0x4855ab[_0x9040('0x48')]['id'];}return db[_0x9040('0x2a')]['find']({'where':{'id':_0x4855ab[_0x9040('0x49')]['id']}})[_0x9040('0x26')](handleEntityNotFound(_0x3e27bb,null))[_0x9040('0x26')](saveUpdates(_0x4855ab['body'],null))[_0x9040('0x26')](respondWithResult(_0x3e27bb,null))[_0x9040('0x43')](handleError(_0x3e27bb,null));};exports[_0x9040('0x27')]=function(_0x22d1f8,_0x394738){return db['SmsQueueReport'][_0x9040('0x46')]({'where':{'id':_0x22d1f8[_0x9040('0x49')]['id']}})[_0x9040('0x26')](handleEntityNotFound(_0x394738,null))[_0x9040('0x26')](removeEntity(_0x394738,null))['catch'](handleError(_0x394738,null));};exports['describe']=function(_0x3bde1b,_0x235597){return db[_0x9040('0x2a')][_0x9040('0x4a')]()[_0x9040('0x26')](respondWithResult(_0x235597,null))[_0x9040('0x43')](handleError(_0x235597,null));}; \ No newline at end of file +var _0xb768=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SmsQueueReport','rawAttributes','key','model','query'];(function(_0x486008,_0x2b2d05){var _0x2fefc7=function(_0x4177fe){while(--_0x4177fe){_0x486008['push'](_0x486008['shift']());}};_0x2fefc7(++_0x2b2d05);}(_0xb768,0xaf));var _0x8b76=function(_0x48d0f6,_0x1def0e){_0x48d0f6=_0x48d0f6-0x0;var _0x3ba238=_0xb768[_0x48d0f6];return _0x3ba238;};'use strict';var emlformat=require(_0x8b76('0x0'));var rimraf=require(_0x8b76('0x1'));var zipdir=require(_0x8b76('0x2'));var jsonpatch=require(_0x8b76('0x3'));var rp=require(_0x8b76('0x4'));var moment=require('moment');var BPromise=require(_0x8b76('0x5'));var Mustache=require(_0x8b76('0x6'));var util=require(_0x8b76('0x7'));var path=require(_0x8b76('0x8'));var sox=require(_0x8b76('0x9'));var csv=require(_0x8b76('0xa'));var ejs=require(_0x8b76('0xb'));var fs=require('fs');var fs_extra=require(_0x8b76('0xc'));var _=require(_0x8b76('0xd'));var squel=require(_0x8b76('0xe'));var crypto=require(_0x8b76('0xf'));var jsforce=require(_0x8b76('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b76('0x11'));var Redis=require(_0x8b76('0x12'));var authService=require(_0x8b76('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8b76('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b76('0x15'))('api');var utils=require(_0x8b76('0x16'));var config=require(_0x8b76('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b76('0x18'))['db'];function respondWithStatusCode(_0x572516,_0x30f777){_0x30f777=_0x30f777||0xcc;return function(_0xabf5fa){if(_0xabf5fa){return _0x572516[_0x8b76('0x19')](_0x30f777);}return _0x572516[_0x8b76('0x1a')](_0x30f777)['end']();};}function respondWithResult(_0xa1520d,_0xd0b1f9){_0xd0b1f9=_0xd0b1f9||0xc8;return function(_0x3e8db4){if(_0x3e8db4){return _0xa1520d[_0x8b76('0x1a')](_0xd0b1f9)[_0x8b76('0x1b')](_0x3e8db4);}};}function respondWithFilteredResult(_0x3265d3,_0x479996){return function(_0x17688e){if(_0x17688e){var _0x4aae3c=typeof _0x479996[_0x8b76('0x1c')]===_0x8b76('0x1d')&&typeof _0x479996[_0x8b76('0x1e')]===_0x8b76('0x1d');var _0x3a800d=_0x17688e[_0x8b76('0x1f')];var _0x58ecfa=_0x4aae3c?0x0:_0x479996[_0x8b76('0x1c')];var _0x52926c=_0x4aae3c?_0x17688e[_0x8b76('0x1f')]:_0x479996['offset']+_0x479996[_0x8b76('0x1e')];var _0x2dd181;if(_0x52926c>=_0x3a800d){_0x52926c=_0x3a800d;_0x2dd181=0xc8;}else{_0x2dd181=0xce;}_0x3265d3[_0x8b76('0x1a')](_0x2dd181);return _0x3265d3[_0x8b76('0x20')](_0x8b76('0x21'),_0x58ecfa+'-'+_0x52926c+'/'+_0x3a800d)[_0x8b76('0x1b')](_0x17688e);}return null;};}function patchUpdates(_0x360530){return function(_0x50c26f){try{jsonpatch[_0x8b76('0x22')](_0x50c26f,_0x360530,!![]);}catch(_0x392846){return BPromise[_0x8b76('0x23')](_0x392846);}return _0x50c26f[_0x8b76('0x24')]();};}function saveUpdates(_0x526ad0,_0x28b50c){return function(_0x54aaf6){if(_0x54aaf6){return _0x54aaf6[_0x8b76('0x25')](_0x526ad0)[_0x8b76('0x26')](function(_0x301d52){return _0x301d52;});}return null;};}function removeEntity(_0x941b69,_0x3b7c05){return function(_0x5a1bad){if(_0x5a1bad){return _0x5a1bad[_0x8b76('0x27')]()[_0x8b76('0x26')](function(){_0x941b69[_0x8b76('0x1a')](0xcc)[_0x8b76('0x28')]();});}};}function handleEntityNotFound(_0x310d8f,_0x5dd83b){return function(_0x156aac){if(!_0x156aac){_0x310d8f[_0x8b76('0x19')](0x194);}return _0x156aac;};}function handleError(_0x2b1842,_0x507a63){_0x507a63=_0x507a63||0x1f4;return function(_0x5eeb14){logger['error'](_0x5eeb14['stack']);if(_0x5eeb14['name']){delete _0x5eeb14[_0x8b76('0x29')];}_0x2b1842[_0x8b76('0x1a')](_0x507a63)[_0x8b76('0x2a')](_0x5eeb14);};}exports[_0x8b76('0x2b')]=function(_0x4d4eff,_0x20860b){var _0x2b98e8={},_0x3ff506={},_0x1b23ed={'count':0x0,'rows':[]};var _0x4a7a22=_[_0x8b76('0x2c')](db[_0x8b76('0x2d')][_0x8b76('0x2e')],function(_0x52961d){return{'name':_0x52961d['fieldName'],'type':_0x52961d['type'][_0x8b76('0x2f')]};});_0x3ff506[_0x8b76('0x30')]=_[_0x8b76('0x2c')](_0x4a7a22,_0x8b76('0x29'));_0x3ff506['query']=_['keys'](_0x4d4eff[_0x8b76('0x31')]);_0x3ff506[_0x8b76('0x32')]=_[_0x8b76('0x33')](_0x3ff506[_0x8b76('0x30')],_0x3ff506[_0x8b76('0x31')]);_0x2b98e8[_0x8b76('0x34')]=_[_0x8b76('0x33')](_0x3ff506[_0x8b76('0x30')],qs['fields'](_0x4d4eff[_0x8b76('0x31')][_0x8b76('0x35')]));_0x2b98e8[_0x8b76('0x34')]=_0x2b98e8[_0x8b76('0x34')][_0x8b76('0x36')]?_0x2b98e8[_0x8b76('0x34')]:_0x3ff506[_0x8b76('0x30')];if(!_0x4d4eff['query']['hasOwnProperty'](_0x8b76('0x37'))){_0x2b98e8[_0x8b76('0x1e')]=qs[_0x8b76('0x1e')](_0x4d4eff['query']['limit']);_0x2b98e8['offset']=qs[_0x8b76('0x1c')](_0x4d4eff['query'][_0x8b76('0x1c')]);}_0x2b98e8[_0x8b76('0x38')]=qs[_0x8b76('0x39')](_0x4d4eff[_0x8b76('0x31')][_0x8b76('0x39')]);_0x2b98e8[_0x8b76('0x3a')]=qs[_0x8b76('0x32')](_['pick'](_0x4d4eff[_0x8b76('0x31')],_0x3ff506[_0x8b76('0x32')]),_0x4a7a22);if(_0x4d4eff[_0x8b76('0x31')][_0x8b76('0x3b')]){_0x2b98e8[_0x8b76('0x3a')]=_[_0x8b76('0x3c')](_0x2b98e8['where'],{'$or':_[_0x8b76('0x2c')](_0x4a7a22,function(_0x41f1aa){if(_0x41f1aa[_0x8b76('0x3d')]!==_0x8b76('0x3e')){var _0x3be16d={};_0x3be16d[_0x41f1aa[_0x8b76('0x29')]]={'$like':'%'+_0x4d4eff[_0x8b76('0x31')]['filter']+'%'};return _0x3be16d;}})});}_0x2b98e8=_[_0x8b76('0x3c')]({},_0x2b98e8,_0x4d4eff[_0x8b76('0x3f')]);var _0x3ad6da={'where':_0x2b98e8['where']};return db[_0x8b76('0x2d')]['count'](_0x3ad6da)[_0x8b76('0x26')](function(_0x3eadc6){_0x1b23ed[_0x8b76('0x1f')]=_0x3eadc6;if(_0x4d4eff[_0x8b76('0x31')]['includeAll']){_0x2b98e8[_0x8b76('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x8b76('0x41')](_0x2b98e8);})[_0x8b76('0x26')](function(_0x505df5){_0x1b23ed[_0x8b76('0x42')]=_0x505df5;return _0x1b23ed;})[_0x8b76('0x26')](respondWithFilteredResult(_0x20860b,_0x2b98e8))['catch'](handleError(_0x20860b,null));};exports[_0x8b76('0x43')]=function(_0x4dd218,_0x128d81){var _0x437de0={'raw':!![],'where':{'id':_0x4dd218[_0x8b76('0x44')]['id']}},_0xae4320={};_0xae4320[_0x8b76('0x30')]=_[_0x8b76('0x45')](db[_0x8b76('0x2d')][_0x8b76('0x2e')]);_0xae4320[_0x8b76('0x31')]=_[_0x8b76('0x45')](_0x4dd218[_0x8b76('0x31')]);_0xae4320[_0x8b76('0x32')]=_[_0x8b76('0x33')](_0xae4320[_0x8b76('0x30')],_0xae4320['query']);_0x437de0[_0x8b76('0x34')]=_['intersection'](_0xae4320[_0x8b76('0x30')],qs['fields'](_0x4dd218[_0x8b76('0x31')][_0x8b76('0x35')]));_0x437de0[_0x8b76('0x34')]=_0x437de0[_0x8b76('0x34')]['length']?_0x437de0[_0x8b76('0x34')]:_0xae4320[_0x8b76('0x30')];if(_0x4dd218['query'][_0x8b76('0x46')]){_0x437de0[_0x8b76('0x40')]=[{'all':!![]}];}_0x437de0=_[_0x8b76('0x3c')]({},_0x437de0,_0x4dd218[_0x8b76('0x3f')]);return db[_0x8b76('0x2d')]['find'](_0x437de0)[_0x8b76('0x26')](handleEntityNotFound(_0x128d81,null))[_0x8b76('0x26')](respondWithResult(_0x128d81,null))[_0x8b76('0x47')](handleError(_0x128d81,null));};exports['create']=function(_0x37831a,_0x7e5312){return db['SmsQueueReport']['create'](_0x37831a[_0x8b76('0x48')],{})[_0x8b76('0x26')](respondWithResult(_0x7e5312,0xc9))[_0x8b76('0x47')](handleError(_0x7e5312,null));};exports[_0x8b76('0x25')]=function(_0x46ab94,_0x28b3c7){if(_0x46ab94['body']['id']){delete _0x46ab94[_0x8b76('0x48')]['id'];}return db[_0x8b76('0x2d')][_0x8b76('0x49')]({'where':{'id':_0x46ab94['params']['id']}})['then'](handleEntityNotFound(_0x28b3c7,null))[_0x8b76('0x26')](saveUpdates(_0x46ab94[_0x8b76('0x48')],null))[_0x8b76('0x26')](respondWithResult(_0x28b3c7,null))[_0x8b76('0x47')](handleError(_0x28b3c7,null));};exports[_0x8b76('0x27')]=function(_0x19d34e,_0x4b4ea7){return db['SmsQueueReport'][_0x8b76('0x49')]({'where':{'id':_0x19d34e[_0x8b76('0x44')]['id']}})[_0x8b76('0x26')](handleEntityNotFound(_0x4b4ea7,null))[_0x8b76('0x26')](removeEntity(_0x4b4ea7,null))[_0x8b76('0x47')](handleError(_0x4b4ea7,null));};exports[_0x8b76('0x4a')]=function(_0x4803c1,_0x553f75){return db[_0x8b76('0x2d')][_0x8b76('0x4a')]()[_0x8b76('0x26')](respondWithResult(_0x553f75,null))[_0x8b76('0x47')](handleError(_0x553f75,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 6a5e960..7cd831e 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x9dc8be,_0x1bab69){var _0x115701=function(_0x5d563c){while(--_0x5d563c){_0x9dc8be['push'](_0x9dc8be['shift']());}};_0x115701(++_0x1bab69);}(_0xe706,0xa3));var _0x6e70=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0xe706[_0x1196b0];return _0x111c52;};'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 +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4326cc8..7fe9f51 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 _0x4c0e=['body','options','CreateSmsQueueReport','catch','SmsQueueReport','update','raw','where','attributes','limit','UpdateSmsQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4c0e,0xab));var _0xe4c0=function(_0x280dd8,_0x5c8eb8){_0x280dd8=_0x280dd8-0x0;var _0x2a6aa6=_0x4c0e[_0x280dd8];return _0x2a6aa6;};'use strict';var _=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var moment=require('moment');var BPromise=require(_0xe4c0('0x2'));var rs=require(_0xe4c0('0x3'));var fs=require('fs');var Redis=require(_0xe4c0('0x4'));var db=require(_0xe4c0('0x5'))['db'];var utils=require(_0xe4c0('0x6'));var logger=require('../../config/logger')(_0xe4c0('0x7'));var config=require(_0xe4c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x514d3e,_0x20753d,_0x21c251){return new BPromise(function(_0x4e4e7b,_0x2146eb){return client[_0xe4c0('0x9')](_0x514d3e,_0x21c251)[_0xe4c0('0xa')](function(_0x577547){logger[_0xe4c0('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x20753d,'request\x20sent');logger[_0xe4c0('0xc')](_0xe4c0('0xd'),_0x20753d,_0xe4c0('0xe'),JSON[_0xe4c0('0xf')](_0x577547));if(_0x577547[_0xe4c0('0x10')]){if(_0x577547[_0xe4c0('0x10')][_0xe4c0('0x11')]===0x1f4){logger['error'](_0xe4c0('0x12'),_0x20753d,_0x577547['error'][_0xe4c0('0x13')]);return _0x2146eb(_0x577547[_0xe4c0('0x10')]['message']);}logger[_0xe4c0('0x10')](_0xe4c0('0x12'),_0x20753d,_0x577547[_0xe4c0('0x10')]['message']);return _0x4e4e7b(_0x577547[_0xe4c0('0x10')][_0xe4c0('0x13')]);}else{logger[_0xe4c0('0xb')](_0xe4c0('0x12'),_0x20753d,_0xe4c0('0xe'));_0x4e4e7b(_0x577547[_0xe4c0('0x14')][_0xe4c0('0x13')]);}})['catch'](function(_0x29d8bf){logger[_0xe4c0('0x10')](_0xe4c0('0x12'),_0x20753d,_0x29d8bf);_0x2146eb(_0x29d8bf);});});}exports['CreateSmsQueueReport']=function(_0x1c91c0){var _0x3d1af2=this;return new Promise(function(_0xd13c49,_0x47649c){return db['SmsQueueReport']['create'](_0x1c91c0[_0xe4c0('0x15')],{'raw':_0x1c91c0[_0xe4c0('0x16')]?_0x1c91c0['options']['raw']===undefined?!![]:![]:!![]})[_0xe4c0('0xa')](function(_0x2aa325){logger[_0xe4c0('0xb')](_0xe4c0('0x17'),_0x1c91c0);logger[_0xe4c0('0xc')]('CreateSmsQueueReport',_0x1c91c0,JSON[_0xe4c0('0xf')](_0x2aa325));_0xd13c49(_0x2aa325);})[_0xe4c0('0x18')](function(_0x426932){logger[_0xe4c0('0x10')](_0xe4c0('0x17'),_0x426932[_0xe4c0('0x13')],_0x1c91c0);_0x47649c(_0x3d1af2['error'](0x1f4,_0x426932['message']));});});};exports['UpdateSmsQueueReport']=function(_0x2493ef){var _0x1148d0=this;return new Promise(function(_0xfbc14b,_0x111eb7){return db[_0xe4c0('0x19')][_0xe4c0('0x1a')](_0x2493ef[_0xe4c0('0x15')],{'raw':_0x2493ef[_0xe4c0('0x16')]?_0x2493ef[_0xe4c0('0x16')][_0xe4c0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2493ef[_0xe4c0('0x16')]?_0x2493ef[_0xe4c0('0x16')][_0xe4c0('0x1c')]||null:null,'attributes':_0x2493ef[_0xe4c0('0x16')]?_0x2493ef[_0xe4c0('0x16')][_0xe4c0('0x1d')]||null:null,'limit':_0x2493ef[_0xe4c0('0x16')]?_0x2493ef[_0xe4c0('0x16')][_0xe4c0('0x1e')]||null:null})['then'](function(_0x4e2d0e){logger['info'](_0xe4c0('0x1f'),_0x2493ef);logger[_0xe4c0('0xc')](_0xe4c0('0x1f'),_0x2493ef,JSON[_0xe4c0('0xf')](_0x4e2d0e));_0xfbc14b(_0x4e2d0e);})[_0xe4c0('0x18')](function(_0x167de2){logger[_0xe4c0('0x10')]('UpdateSmsQueueReport',_0x167de2['message'],_0x2493ef);_0x111eb7(_0x1148d0[_0xe4c0('0x10')](0x1f4,_0x167de2[_0xe4c0('0x13')]));});});}; \ No newline at end of file +var _0x8a2d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','raw','catch','UpdateSmsQueueReport','update','options','where','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x8a2d,0x1d8));var _0xd8a2=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8a2d[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xd8a2('0x0'));var util=require('util');var moment=require(_0xd8a2('0x1'));var BPromise=require(_0xd8a2('0x2'));var rs=require(_0xd8a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8a2('0x4'))(_0xd8a2('0x5'));var config=require(_0xd8a2('0x6'));var jayson=require(_0xd8a2('0x7'));var client=jayson[_0xd8a2('0x8')][_0xd8a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e82d6,_0x9cf768,_0x26123a){return new BPromise(function(_0x5a4234,_0x5edebd){return client[_0xd8a2('0xa')](_0x4e82d6,_0x26123a)[_0xd8a2('0xb')](function(_0x2b961e){logger[_0xd8a2('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x9cf768,_0xd8a2('0xd'));logger[_0xd8a2('0xe')](_0xd8a2('0xf'),_0x9cf768,_0xd8a2('0xd'),JSON[_0xd8a2('0x10')](_0x2b961e));if(_0x2b961e['error']){if(_0x2b961e[_0xd8a2('0x11')][_0xd8a2('0x12')]===0x1f4){logger['error'](_0xd8a2('0x13'),_0x9cf768,_0x2b961e[_0xd8a2('0x11')][_0xd8a2('0x14')]);return _0x5edebd(_0x2b961e[_0xd8a2('0x11')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x9cf768,_0x2b961e['error'][_0xd8a2('0x14')]);return _0x5a4234(_0x2b961e[_0xd8a2('0x11')][_0xd8a2('0x14')]);}else{logger['info'](_0xd8a2('0x13'),_0x9cf768,_0xd8a2('0xd'));_0x5a4234(_0x2b961e[_0xd8a2('0x15')][_0xd8a2('0x14')]);}})['catch'](function(_0x792a7d){logger[_0xd8a2('0x11')](_0xd8a2('0x13'),_0x9cf768,_0x792a7d);_0x5edebd(_0x792a7d);});});}exports[_0xd8a2('0x16')]=function(_0x4d3276){var _0x27d756=this;return new Promise(function(_0x5a85b7,_0x2e2353){return db[_0xd8a2('0x17')][_0xd8a2('0x18')](_0x4d3276[_0xd8a2('0x19')],{'raw':_0x4d3276['options']?_0x4d3276['options'][_0xd8a2('0x1a')]===undefined?!![]:![]:!![]})[_0xd8a2('0xb')](function(_0x28f896){logger[_0xd8a2('0xc')]('CreateSmsQueueReport',_0x4d3276);logger['debug']('CreateSmsQueueReport',_0x4d3276,JSON['stringify'](_0x28f896));_0x5a85b7(_0x28f896);})[_0xd8a2('0x1b')](function(_0x682257){logger[_0xd8a2('0x11')](_0xd8a2('0x16'),_0x682257['message'],_0x4d3276);_0x2e2353(_0x27d756[_0xd8a2('0x11')](0x1f4,_0x682257[_0xd8a2('0x14')]));});});};exports[_0xd8a2('0x1c')]=function(_0x2a97a3){var _0x5b437f=this;return new Promise(function(_0x3574d4,_0x2a6896){return db['SmsQueueReport'][_0xd8a2('0x1d')](_0x2a97a3[_0xd8a2('0x19')],{'raw':_0x2a97a3[_0xd8a2('0x1e')]?_0x2a97a3[_0xd8a2('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a97a3[_0xd8a2('0x1e')]?_0x2a97a3[_0xd8a2('0x1e')][_0xd8a2('0x1f')]||null:null,'attributes':_0x2a97a3[_0xd8a2('0x1e')]?_0x2a97a3[_0xd8a2('0x1e')][_0xd8a2('0x20')]||null:null,'limit':_0x2a97a3['options']?_0x2a97a3[_0xd8a2('0x1e')][_0xd8a2('0x21')]||null:null})[_0xd8a2('0xb')](function(_0xe04669){logger['info'](_0xd8a2('0x1c'),_0x2a97a3);logger[_0xd8a2('0xe')](_0xd8a2('0x1c'),_0x2a97a3,JSON[_0xd8a2('0x10')](_0xe04669));_0x3574d4(_0xe04669);})[_0xd8a2('0x1b')](function(_0x51ff59){logger[_0xd8a2('0x11')](_0xd8a2('0x1c'),_0x51ff59[_0xd8a2('0x14')],_0x2a97a3);_0x2a6896(_0x5b437f['error'](0x1f4,_0x51ff59[_0xd8a2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 871be02..db3a98a 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 _0x029b=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','exports'];(function(_0x593f68,_0x39dc51){var _0x160833=function(_0x56557e){while(--_0x56557e){_0x593f68['push'](_0x593f68['shift']());}};_0x160833(++_0x39dc51);}(_0x029b,0x66));var _0xb029=function(_0x1527ec,_0xa2afb9){_0x1527ec=_0x1527ec-0x0;var _0x22533d=_0x029b[_0x1527ec];return _0x22533d;};'use strict';var multer=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var path=require('path');var timeout=require(_0xb029('0x2'));var express=require(_0xb029('0x3'));var router=express['Router']();var fs_extra=require(_0xb029('0x4'));var auth=require(_0xb029('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb029('0x6'));router[_0xb029('0x7')]('/',auth[_0xb029('0x8')](),controller[_0xb029('0x9')]);router[_0xb029('0x7')]('/describe',auth[_0xb029('0x8')](),controller['describe']);router[_0xb029('0x7')]('/:id',auth[_0xb029('0x8')](),controller['show']);router[_0xb029('0xa')]('/',auth['isAuthenticated'](),controller[_0xb029('0xb')]);router[_0xb029('0xc')]('/:id',auth[_0xb029('0x8')](),controller[_0xb029('0xd')]);router[_0xb029('0xe')](_0xb029('0xf'),auth[_0xb029('0x8')](),controller['destroy']);module[_0xb029('0x10')]=router; \ No newline at end of file +var _0x1670=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x412f44,_0x2b7567){var _0x566e9a=function(_0x1a8321){while(--_0x1a8321){_0x412f44['push'](_0x412f44['shift']());}};_0x566e9a(++_0x2b7567);}(_0x1670,0x9a));var _0x0167=function(_0x380bd6,_0x15dff9){_0x380bd6=_0x380bd6-0x0;var _0x4b8d66=_0x1670[_0x380bd6];return _0x4b8d66;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var fs_extra=require(_0x0167('0x4'));var auth=require(_0x0167('0x5'));var interaction=require(_0x0167('0x6'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x0167('0x7')]('/',auth[_0x0167('0x8')](),controller[_0x0167('0x9')]);router[_0x0167('0x7')](_0x0167('0xa'),auth[_0x0167('0x8')](),controller[_0x0167('0xb')]);router[_0x0167('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0167('0xc')]);router[_0x0167('0xd')]('/',auth[_0x0167('0x8')](),controller[_0x0167('0xe')]);router[_0x0167('0xf')](_0x0167('0x10'),auth[_0x0167('0x8')](),controller[_0x0167('0x11')]);router[_0x0167('0x12')](_0x0167('0x10'),auth[_0x0167('0x8')](),controller[_0x0167('0x13')]);module[_0x0167('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 17b9166..9b4da6e 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0xb43b,0x1b2));var _0xbb43=function(_0x809db3,_0x4b7b5f){_0x809db3=_0x809db3-0x0;var _0x5b34a7=_0xb43b[_0x809db3];return _0x5b34a7;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x383521,_0x5e87de){var _0x3310de=function(_0x1eec35){while(--_0x1eec35){_0x383521['push'](_0x383521['shift']());}};_0x3310de(++_0x5e87de);}(_0x4b84,0x1cc));var _0x44b8=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x4b84[_0x39fd11];return _0x302799;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e6a50c2..4790fe8 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 _0xa20c=['intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','name','query','filters'];(function(_0x32ebbd,_0x856bd0){var _0x18e6b3=function(_0x3015c8){while(--_0x3015c8){_0x32ebbd['push'](_0x32ebbd['shift']());}};_0x18e6b3(++_0x856bd0);}(_0xa20c,0x141));var _0xca20=function(_0x5e70f4,_0x45206a){_0x5e70f4=_0x5e70f4-0x0;var _0x169695=_0xa20c[_0x5e70f4];return _0x169695;};'use strict';var emlformat=require(_0xca20('0x0'));var rimraf=require(_0xca20('0x1'));var zipdir=require(_0xca20('0x2'));var jsonpatch=require(_0xca20('0x3'));var rp=require(_0xca20('0x4'));var moment=require(_0xca20('0x5'));var BPromise=require(_0xca20('0x6'));var Mustache=require(_0xca20('0x7'));var util=require(_0xca20('0x8'));var path=require('path');var sox=require(_0xca20('0x9'));var csv=require(_0xca20('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca20('0xb'));var _=require(_0xca20('0xc'));var squel=require(_0xca20('0xd'));var crypto=require(_0xca20('0xe'));var jsforce=require(_0xca20('0xf'));var deskjs=require(_0xca20('0x10'));var toCsv=require(_0xca20('0xa'));var querystring=require(_0xca20('0x11'));var Papa=require('papaparse');var Redis=require(_0xca20('0x12'));var authService=require(_0xca20('0x13'));var qs=require(_0xca20('0x14'));var as=require(_0xca20('0x15'));var hardwareService=require(_0xca20('0x16'));var logger=require(_0xca20('0x17'))(_0xca20('0x18'));var utils=require(_0xca20('0x19'));var config=require(_0xca20('0x1a'));var licenseUtil=require(_0xca20('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c26da,_0x5c56e4){_0x5c56e4=_0x5c56e4||0xcc;return function(_0x3fb0ff){if(_0x3fb0ff){return _0x1c26da['sendStatus'](_0x5c56e4);}return _0x1c26da[_0xca20('0x1c')](_0x5c56e4)['end']();};}function respondWithResult(_0x16848e,_0x3f6449){_0x3f6449=_0x3f6449||0xc8;return function(_0x46ec8d){if(_0x46ec8d){return _0x16848e['status'](_0x3f6449)[_0xca20('0x1d')](_0x46ec8d);}};}function respondWithFilteredResult(_0x527f0a,_0x45a2a1){return function(_0x11425d){if(_0x11425d){var _0xe8aea2=typeof _0x45a2a1[_0xca20('0x1e')]==='undefined'&&typeof _0x45a2a1[_0xca20('0x1f')]==='undefined';var _0x41a31a=_0x11425d[_0xca20('0x20')];var _0x2cbd0e=_0xe8aea2?0x0:_0x45a2a1[_0xca20('0x1e')];var _0x447997=_0xe8aea2?_0x11425d['count']:_0x45a2a1[_0xca20('0x1e')]+_0x45a2a1['limit'];var _0x4efbcc;if(_0x447997>=_0x41a31a){_0x447997=_0x41a31a;_0x4efbcc=0xc8;}else{_0x4efbcc=0xce;}_0x527f0a['status'](_0x4efbcc);return _0x527f0a[_0xca20('0x21')](_0xca20('0x22'),_0x2cbd0e+'-'+_0x447997+'/'+_0x41a31a)[_0xca20('0x1d')](_0x11425d);}return null;};}function patchUpdates(_0xa4340e){return function(_0x5982cd){try{jsonpatch[_0xca20('0x23')](_0x5982cd,_0xa4340e,!![]);}catch(_0x49cb24){return BPromise[_0xca20('0x24')](_0x49cb24);}return _0x5982cd[_0xca20('0x25')]();};}function saveUpdates(_0x2e48dd,_0x38d316){return function(_0x2f9b72){if(_0x2f9b72){return _0x2f9b72[_0xca20('0x26')](_0x2e48dd)[_0xca20('0x27')](function(_0x1a6a2b){return _0x1a6a2b;});}return null;};}function removeEntity(_0x4610bf,_0x470f9b){return function(_0x98b00b){if(_0x98b00b){return _0x98b00b[_0xca20('0x28')]()[_0xca20('0x27')](function(){_0x4610bf['status'](0xcc)[_0xca20('0x29')]();});}};}function handleEntityNotFound(_0x414fe8,_0x1891cb){return function(_0x15e562){if(!_0x15e562){_0x414fe8[_0xca20('0x2a')](0x194);}return _0x15e562;};}function handleError(_0x4c4a94,_0x229dc9){_0x229dc9=_0x229dc9||0x1f4;return function(_0x32ec88){logger['error'](_0x32ec88[_0xca20('0x2b')]);if(_0x32ec88['name']){delete _0x32ec88['name'];}_0x4c4a94[_0xca20('0x1c')](_0x229dc9)['send'](_0x32ec88);};}exports[_0xca20('0x2c')]=function(_0x26236f,_0x25b55f){var _0x1ac53b={},_0x5c1e08={},_0x5d8909={'count':0x0,'rows':[]};var _0x2c8415=_[_0xca20('0x2d')](db[_0xca20('0x2e')][_0xca20('0x2f')],function(_0x3043a9){return{'name':_0x3043a9[_0xca20('0x30')],'type':_0x3043a9['type'][_0xca20('0x31')]};});_0x5c1e08[_0xca20('0x32')]=_[_0xca20('0x2d')](_0x2c8415,_0xca20('0x33'));_0x5c1e08[_0xca20('0x34')]=_['keys'](_0x26236f['query']);_0x5c1e08[_0xca20('0x35')]=_['intersection'](_0x5c1e08['model'],_0x5c1e08['query']);_0x1ac53b['attributes']=_[_0xca20('0x36')](_0x5c1e08[_0xca20('0x32')],qs[_0xca20('0x37')](_0x26236f[_0xca20('0x34')][_0xca20('0x37')]));_0x1ac53b[_0xca20('0x38')]=_0x1ac53b[_0xca20('0x38')][_0xca20('0x39')]?_0x1ac53b[_0xca20('0x38')]:_0x5c1e08['model'];if(!_0x26236f[_0xca20('0x34')][_0xca20('0x3a')]('nolimit')){_0x1ac53b[_0xca20('0x1f')]=qs[_0xca20('0x1f')](_0x26236f[_0xca20('0x34')][_0xca20('0x1f')]);_0x1ac53b['offset']=qs[_0xca20('0x1e')](_0x26236f[_0xca20('0x34')][_0xca20('0x1e')]);}_0x1ac53b['order']=qs[_0xca20('0x3b')](_0x26236f[_0xca20('0x34')][_0xca20('0x3b')]);_0x1ac53b[_0xca20('0x3c')]=qs[_0xca20('0x35')](_[_0xca20('0x3d')](_0x26236f[_0xca20('0x34')],_0x5c1e08['filters']),_0x2c8415);if(_0x26236f[_0xca20('0x34')][_0xca20('0x3e')]){_0x1ac53b[_0xca20('0x3c')]=_['merge'](_0x1ac53b[_0xca20('0x3c')],{'$or':_[_0xca20('0x2d')](_0x2c8415,function(_0x500a84){if(_0x500a84['type']!=='VIRTUAL'){var _0x23b0f8={};_0x23b0f8[_0x500a84[_0xca20('0x33')]]={'$like':'%'+_0x26236f[_0xca20('0x34')][_0xca20('0x3e')]+'%'};return _0x23b0f8;}})});}_0x1ac53b=_[_0xca20('0x3f')]({},_0x1ac53b,_0x26236f[_0xca20('0x40')]);var _0x4e6ea4={'where':_0x1ac53b['where']};return db[_0xca20('0x2e')][_0xca20('0x20')](_0x4e6ea4)[_0xca20('0x27')](function(_0x278079){_0x5d8909[_0xca20('0x20')]=_0x278079;if(_0x26236f[_0xca20('0x34')]['includeAll']){_0x1ac53b[_0xca20('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xca20('0x42')](_0x1ac53b);})[_0xca20('0x27')](function(_0x94c71){_0x5d8909[_0xca20('0x43')]=_0x94c71;return _0x5d8909;})[_0xca20('0x27')](respondWithFilteredResult(_0x25b55f,_0x1ac53b))[_0xca20('0x44')](handleError(_0x25b55f,null));};exports[_0xca20('0x45')]=function(_0x3f82f9,_0x361d68){var _0x160a57={'raw':!![],'where':{'id':_0x3f82f9[_0xca20('0x46')]['id']}},_0x2ce307={};_0x2ce307[_0xca20('0x32')]=_['keys'](db[_0xca20('0x2e')][_0xca20('0x2f')]);_0x2ce307[_0xca20('0x34')]=_['keys'](_0x3f82f9[_0xca20('0x34')]);_0x2ce307['filters']=_['intersection'](_0x2ce307['model'],_0x2ce307['query']);_0x160a57[_0xca20('0x38')]=_[_0xca20('0x36')](_0x2ce307[_0xca20('0x32')],qs[_0xca20('0x37')](_0x3f82f9['query'][_0xca20('0x37')]));_0x160a57[_0xca20('0x38')]=_0x160a57[_0xca20('0x38')][_0xca20('0x39')]?_0x160a57['attributes']:_0x2ce307[_0xca20('0x32')];if(_0x3f82f9[_0xca20('0x34')]['includeAll']){_0x160a57[_0xca20('0x41')]=[{'all':!![]}];}_0x160a57=_['merge']({},_0x160a57,_0x3f82f9[_0xca20('0x40')]);return db[_0xca20('0x2e')][_0xca20('0x47')](_0x160a57)['then'](handleEntityNotFound(_0x361d68,null))[_0xca20('0x27')](respondWithResult(_0x361d68,null))[_0xca20('0x44')](handleError(_0x361d68,null));};exports[_0xca20('0x48')]=function(_0xc269ec,_0x3a4c44){return db[_0xca20('0x2e')][_0xca20('0x48')](_0xc269ec[_0xca20('0x49')],{})[_0xca20('0x27')](respondWithResult(_0x3a4c44,0xc9))[_0xca20('0x44')](handleError(_0x3a4c44,null));};exports[_0xca20('0x26')]=function(_0x48ec05,_0x25649f){if(_0x48ec05[_0xca20('0x49')]['id']){delete _0x48ec05[_0xca20('0x49')]['id'];}return db[_0xca20('0x2e')][_0xca20('0x47')]({'where':{'id':_0x48ec05[_0xca20('0x46')]['id']}})['then'](handleEntityNotFound(_0x25649f,null))['then'](saveUpdates(_0x48ec05[_0xca20('0x49')],null))['then'](respondWithResult(_0x25649f,null))['catch'](handleError(_0x25649f,null));};exports['destroy']=function(_0x30f274,_0x27ddb8){return db['SmsTransferReport'][_0xca20('0x47')]({'where':{'id':_0x30f274[_0xca20('0x46')]['id']}})[_0xca20('0x27')](handleEntityNotFound(_0x27ddb8,null))[_0xca20('0x27')](removeEntity(_0x27ddb8,null))[_0xca20('0x44')](handleError(_0x27ddb8,null));};exports[_0xca20('0x4a')]=function(_0x449db0,_0x422e01){return db['SmsTransferReport']['describe']()[_0xca20('0x27')](respondWithResult(_0x422e01,null))['catch'](handleError(_0x422e01,null));}; \ No newline at end of file +var _0xcd36=['SmsTransferReport','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','create','body','catch','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xcd36,0xba));var _0x6cd3=function(_0x4bdc01,_0x470950){_0x4bdc01=_0x4bdc01-0x0;var _0x4f7ea1=_0xcd36[_0x4bdc01];return _0x4f7ea1;};'use strict';var emlformat=require(_0x6cd3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cd3('0x1'));var rp=require(_0x6cd3('0x2'));var moment=require('moment');var BPromise=require(_0x6cd3('0x3'));var Mustache=require(_0x6cd3('0x4'));var util=require('util');var path=require(_0x6cd3('0x5'));var sox=require(_0x6cd3('0x6'));var csv=require(_0x6cd3('0x7'));var ejs=require(_0x6cd3('0x8'));var fs=require('fs');var fs_extra=require(_0x6cd3('0x9'));var _=require(_0x6cd3('0xa'));var squel=require('squel');var crypto=require(_0x6cd3('0xb'));var jsforce=require(_0x6cd3('0xc'));var deskjs=require(_0x6cd3('0xd'));var toCsv=require(_0x6cd3('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cd3('0xe'));var authService=require(_0x6cd3('0xf'));var qs=require(_0x6cd3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cd3('0x11'));var logger=require(_0x6cd3('0x12'))(_0x6cd3('0x13'));var utils=require(_0x6cd3('0x14'));var config=require(_0x6cd3('0x15'));var licenseUtil=require(_0x6cd3('0x16'));var db=require(_0x6cd3('0x17'))['db'];function respondWithStatusCode(_0x5c1769,_0x10950e){_0x10950e=_0x10950e||0xcc;return function(_0x401331){if(_0x401331){return _0x5c1769[_0x6cd3('0x18')](_0x10950e);}return _0x5c1769[_0x6cd3('0x19')](_0x10950e)['end']();};}function respondWithResult(_0x37973b,_0x4ee386){_0x4ee386=_0x4ee386||0xc8;return function(_0xd7e636){if(_0xd7e636){return _0x37973b['status'](_0x4ee386)[_0x6cd3('0x1a')](_0xd7e636);}};}function respondWithFilteredResult(_0x57ea95,_0x7fde69){return function(_0x26e642){if(_0x26e642){var _0x322d3b=typeof _0x7fde69[_0x6cd3('0x1b')]==='undefined'&&typeof _0x7fde69['limit']===_0x6cd3('0x1c');var _0x50f9cc=_0x26e642[_0x6cd3('0x1d')];var _0x105716=_0x322d3b?0x0:_0x7fde69[_0x6cd3('0x1b')];var _0x5e46fe=_0x322d3b?_0x26e642[_0x6cd3('0x1d')]:_0x7fde69[_0x6cd3('0x1b')]+_0x7fde69['limit'];var _0x3bc7c4;if(_0x5e46fe>=_0x50f9cc){_0x5e46fe=_0x50f9cc;_0x3bc7c4=0xc8;}else{_0x3bc7c4=0xce;}_0x57ea95[_0x6cd3('0x19')](_0x3bc7c4);return _0x57ea95[_0x6cd3('0x1e')](_0x6cd3('0x1f'),_0x105716+'-'+_0x5e46fe+'/'+_0x50f9cc)[_0x6cd3('0x1a')](_0x26e642);}return null;};}function patchUpdates(_0x5ba22a){return function(_0x639cc9){try{jsonpatch[_0x6cd3('0x20')](_0x639cc9,_0x5ba22a,!![]);}catch(_0x2eef51){return BPromise['reject'](_0x2eef51);}return _0x639cc9[_0x6cd3('0x21')]();};}function saveUpdates(_0x1a27eb,_0x583ebf){return function(_0x5303f8){if(_0x5303f8){return _0x5303f8[_0x6cd3('0x22')](_0x1a27eb)[_0x6cd3('0x23')](function(_0xcb79d){return _0xcb79d;});}return null;};}function removeEntity(_0x2c8a0f,_0x238a6b){return function(_0x4580e0){if(_0x4580e0){return _0x4580e0[_0x6cd3('0x24')]()['then'](function(){_0x2c8a0f[_0x6cd3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f615,_0x19e158){return function(_0x5c48aa){if(!_0x5c48aa){_0x22f615['sendStatus'](0x194);}return _0x5c48aa;};}function handleError(_0x510df5,_0x2c2621){_0x2c2621=_0x2c2621||0x1f4;return function(_0x31af02){logger[_0x6cd3('0x25')](_0x31af02[_0x6cd3('0x26')]);if(_0x31af02[_0x6cd3('0x27')]){delete _0x31af02[_0x6cd3('0x27')];}_0x510df5[_0x6cd3('0x19')](_0x2c2621)[_0x6cd3('0x28')](_0x31af02);};}exports[_0x6cd3('0x29')]=function(_0x116ffb,_0x161550){var _0x3e2837={},_0x234ad5={},_0x7792f9={'count':0x0,'rows':[]};var _0x534562=_['map'](db[_0x6cd3('0x2a')]['rawAttributes'],function(_0x270f02){return{'name':_0x270f02['fieldName'],'type':_0x270f02[_0x6cd3('0x2b')][_0x6cd3('0x2c')]};});_0x234ad5[_0x6cd3('0x2d')]=_[_0x6cd3('0x2e')](_0x534562,'name');_0x234ad5[_0x6cd3('0x2f')]=_['keys'](_0x116ffb[_0x6cd3('0x2f')]);_0x234ad5[_0x6cd3('0x30')]=_['intersection'](_0x234ad5[_0x6cd3('0x2d')],_0x234ad5['query']);_0x3e2837['attributes']=_[_0x6cd3('0x31')](_0x234ad5['model'],qs[_0x6cd3('0x32')](_0x116ffb[_0x6cd3('0x2f')][_0x6cd3('0x32')]));_0x3e2837[_0x6cd3('0x33')]=_0x3e2837['attributes'][_0x6cd3('0x34')]?_0x3e2837[_0x6cd3('0x33')]:_0x234ad5[_0x6cd3('0x2d')];if(!_0x116ffb[_0x6cd3('0x2f')][_0x6cd3('0x35')](_0x6cd3('0x36'))){_0x3e2837['limit']=qs['limit'](_0x116ffb['query'][_0x6cd3('0x37')]);_0x3e2837[_0x6cd3('0x1b')]=qs[_0x6cd3('0x1b')](_0x116ffb[_0x6cd3('0x2f')]['offset']);}_0x3e2837[_0x6cd3('0x38')]=qs[_0x6cd3('0x39')](_0x116ffb['query'][_0x6cd3('0x39')]);_0x3e2837[_0x6cd3('0x3a')]=qs[_0x6cd3('0x30')](_[_0x6cd3('0x3b')](_0x116ffb[_0x6cd3('0x2f')],_0x234ad5[_0x6cd3('0x30')]),_0x534562);if(_0x116ffb[_0x6cd3('0x2f')][_0x6cd3('0x3c')]){_0x3e2837['where']=_['merge'](_0x3e2837['where'],{'$or':_[_0x6cd3('0x2e')](_0x534562,function(_0x2d059a){if(_0x2d059a['type']!==_0x6cd3('0x3d')){var _0x51f0f0={};_0x51f0f0[_0x2d059a[_0x6cd3('0x27')]]={'$like':'%'+_0x116ffb['query'][_0x6cd3('0x3c')]+'%'};return _0x51f0f0;}})});}_0x3e2837=_[_0x6cd3('0x3e')]({},_0x3e2837,_0x116ffb['options']);var _0x379aa4={'where':_0x3e2837['where']};return db[_0x6cd3('0x2a')][_0x6cd3('0x1d')](_0x379aa4)['then'](function(_0x3952e3){_0x7792f9[_0x6cd3('0x1d')]=_0x3952e3;if(_0x116ffb['query'][_0x6cd3('0x3f')]){_0x3e2837[_0x6cd3('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x6cd3('0x41')](_0x3e2837);})[_0x6cd3('0x23')](function(_0x28bba1){_0x7792f9['rows']=_0x28bba1;return _0x7792f9;})['then'](respondWithFilteredResult(_0x161550,_0x3e2837))['catch'](handleError(_0x161550,null));};exports[_0x6cd3('0x42')]=function(_0x269aec,_0x26c346){var _0xad650={'raw':!![],'where':{'id':_0x269aec[_0x6cd3('0x43')]['id']}},_0x4d25f9={};_0x4d25f9[_0x6cd3('0x2d')]=_[_0x6cd3('0x44')](db[_0x6cd3('0x2a')][_0x6cd3('0x45')]);_0x4d25f9[_0x6cd3('0x2f')]=_['keys'](_0x269aec['query']);_0x4d25f9[_0x6cd3('0x30')]=_[_0x6cd3('0x31')](_0x4d25f9['model'],_0x4d25f9[_0x6cd3('0x2f')]);_0xad650['attributes']=_[_0x6cd3('0x31')](_0x4d25f9[_0x6cd3('0x2d')],qs[_0x6cd3('0x32')](_0x269aec[_0x6cd3('0x2f')][_0x6cd3('0x32')]));_0xad650[_0x6cd3('0x33')]=_0xad650['attributes'][_0x6cd3('0x34')]?_0xad650[_0x6cd3('0x33')]:_0x4d25f9[_0x6cd3('0x2d')];if(_0x269aec['query'][_0x6cd3('0x3f')]){_0xad650[_0x6cd3('0x40')]=[{'all':!![]}];}_0xad650=_['merge']({},_0xad650,_0x269aec[_0x6cd3('0x46')]);return db[_0x6cd3('0x2a')][_0x6cd3('0x47')](_0xad650)[_0x6cd3('0x23')](handleEntityNotFound(_0x26c346,null))[_0x6cd3('0x23')](respondWithResult(_0x26c346,null))['catch'](handleError(_0x26c346,null));};exports['create']=function(_0x433195,_0x308bc4){return db['SmsTransferReport'][_0x6cd3('0x48')](_0x433195[_0x6cd3('0x49')],{})[_0x6cd3('0x23')](respondWithResult(_0x308bc4,0xc9))[_0x6cd3('0x4a')](handleError(_0x308bc4,null));};exports[_0x6cd3('0x22')]=function(_0x3e71a0,_0x97e576){if(_0x3e71a0[_0x6cd3('0x49')]['id']){delete _0x3e71a0[_0x6cd3('0x49')]['id'];}return db[_0x6cd3('0x2a')][_0x6cd3('0x47')]({'where':{'id':_0x3e71a0[_0x6cd3('0x43')]['id']}})[_0x6cd3('0x23')](handleEntityNotFound(_0x97e576,null))[_0x6cd3('0x23')](saveUpdates(_0x3e71a0['body'],null))['then'](respondWithResult(_0x97e576,null))[_0x6cd3('0x4a')](handleError(_0x97e576,null));};exports[_0x6cd3('0x24')]=function(_0x3d6e07,_0x53e807){return db[_0x6cd3('0x2a')][_0x6cd3('0x47')]({'where':{'id':_0x3d6e07[_0x6cd3('0x43')]['id']}})['then'](handleEntityNotFound(_0x53e807,null))[_0x6cd3('0x23')](removeEntity(_0x53e807,null))['catch'](handleError(_0x53e807,null));};exports[_0x6cd3('0x4b')]=function(_0x1fc4d3,_0x35e511){return db['SmsTransferReport'][_0x6cd3('0x4b')]()[_0x6cd3('0x23')](respondWithResult(_0x35e511,null))[_0x6cd3('0x4a')](handleError(_0x35e511,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index da4a971..8325013 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 _0x6690=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SmsTransferReport'];(function(_0x137a9c,_0x55841d){var _0x45ebe8=function(_0x2cc3bf){while(--_0x2cc3bf){_0x137a9c['push'](_0x137a9c['shift']());}};_0x45ebe8(++_0x55841d);}(_0x6690,0x7a));var _0x0669=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x6690[_0x1da04e];return _0xdd8c41;};'use strict';var _=require('lodash');var util=require(_0x0669('0x0'));var logger=require(_0x0669('0x1'))(_0x0669('0x2'));var moment=require(_0x0669('0x3'));var BPromise=require('bluebird');var rp=require(_0x0669('0x4'));var fs=require('fs');var path=require(_0x0669('0x5'));var rimraf=require(_0x0669('0x6'));var config=require(_0x0669('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x5419a0,_0x3d219e){return _0x5419a0[_0x0669('0x8')](_0x0669('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0669('0xa'),'fields':[_0x0669('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeedf=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','report_sms_transfer','uniqueid'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xeedf,0x12c));var _0xfeed=function(_0x1f25c4,_0x5d2543){_0x1f25c4=_0x1f25c4-0x0;var _0xc68740=_0xeedf[_0x1f25c4];return _0xc68740;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('SmsTransferReport',attributes,{'tableName':_0xfeed('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfeed('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 f5d222d..83eab59 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 _0xdbbe=['../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x53e348,_0x2cf26b){var _0x1238c7=function(_0x2dd0c0){while(--_0x2dd0c0){_0x53e348['push'](_0x53e348['shift']());}};_0x1238c7(++_0x2cf26b);}(_0xdbbe,0x148));var _0xedbb=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0xdbbe[_0x390733];return _0x33beb9;};'use strict';var _=require('lodash');var util=require(_0xedbb('0x0'));var moment=require(_0xedbb('0x1'));var BPromise=require(_0xedbb('0x2'));var rs=require(_0xedbb('0x3'));var fs=require('fs');var Redis=require(_0xedbb('0x4'));var db=require(_0xedbb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedbb('0x6'))(_0xedbb('0x7'));var config=require(_0xedbb('0x8'));var jayson=require(_0xedbb('0x9'));var client=jayson[_0xedbb('0xa')][_0xedbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb3dd,_0x51f66c,_0xd9cf8c){return new BPromise(function(_0x1ba82a,_0x498ff2){return client[_0xedbb('0xc')](_0x2bb3dd,_0xd9cf8c)['then'](function(_0x1d67b5){logger[_0xedbb('0xd')](_0xedbb('0xe'),_0x51f66c,'request\x20sent');logger[_0xedbb('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x51f66c,_0xedbb('0x10'),JSON[_0xedbb('0x11')](_0x1d67b5));if(_0x1d67b5[_0xedbb('0x12')]){if(_0x1d67b5[_0xedbb('0x12')]['code']===0x1f4){logger[_0xedbb('0x12')](_0xedbb('0xe'),_0x51f66c,_0x1d67b5[_0xedbb('0x12')][_0xedbb('0x13')]);return _0x498ff2(_0x1d67b5[_0xedbb('0x12')][_0xedbb('0x13')]);}logger['error'](_0xedbb('0xe'),_0x51f66c,_0x1d67b5[_0xedbb('0x12')][_0xedbb('0x13')]);return _0x1ba82a(_0x1d67b5[_0xedbb('0x12')][_0xedbb('0x13')]);}else{logger[_0xedbb('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x51f66c,'request\x20sent');_0x1ba82a(_0x1d67b5[_0xedbb('0x14')][_0xedbb('0x13')]);}})['catch'](function(_0xb83c31){logger[_0xedbb('0x12')](_0xedbb('0xe'),_0x51f66c,_0xb83c31);_0x498ff2(_0xb83c31);});});} \ No newline at end of file +var _0xf350=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x5879a9,_0x30ba2d){var _0x4b8e59=function(_0x5a8025){while(--_0x5a8025){_0x5879a9['push'](_0x5879a9['shift']());}};_0x4b8e59(++_0x30ba2d);}(_0xf350,0x105));var _0x0f35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf350[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0f35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f35('0x1'));var rs=require(_0x0f35('0x2'));var fs=require('fs');var Redis=require(_0x0f35('0x3'));var db=require(_0x0f35('0x4'))['db'];var utils=require(_0x0f35('0x5'));var logger=require(_0x0f35('0x6'))(_0x0f35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0f35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c61c4,_0x481712,_0x544342){return new BPromise(function(_0x2c716b,_0x49c0fe){return client[_0x0f35('0x9')](_0x2c61c4,_0x544342)['then'](function(_0x3d928d){logger[_0x0f35('0xa')](_0x0f35('0xb'),_0x481712,_0x0f35('0xc'));logger[_0x0f35('0xd')](_0x0f35('0xe'),_0x481712,_0x0f35('0xc'),JSON[_0x0f35('0xf')](_0x3d928d));if(_0x3d928d[_0x0f35('0x10')]){if(_0x3d928d['error'][_0x0f35('0x11')]===0x1f4){logger[_0x0f35('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x481712,_0x3d928d[_0x0f35('0x10')]['message']);return _0x49c0fe(_0x3d928d[_0x0f35('0x10')]['message']);}logger['error'](_0x0f35('0xb'),_0x481712,_0x3d928d[_0x0f35('0x10')][_0x0f35('0x12')]);return _0x2c716b(_0x3d928d['error'][_0x0f35('0x12')]);}else{logger[_0x0f35('0xa')](_0x0f35('0xb'),_0x481712,_0x0f35('0xc'));_0x2c716b(_0x3d928d[_0x0f35('0x13')][_0x0f35('0x12')]);}})[_0x0f35('0x14')](function(_0x1a2ffc){logger[_0x0f35('0x10')](_0x0f35('0xb'),_0x481712,_0x1a2ffc);_0x49c0fe(_0x1a2ffc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 378da95..4d620e4 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 _0xf0a7=['single','file','create','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now'];(function(_0x119a01,_0x57e57e){var _0x2b7843=function(_0x490394){while(--_0x490394){_0x119a01['push'](_0x119a01['shift']());}};_0x2b7843(++_0x57e57e);}(_0xf0a7,0xfd));var _0x7f0a=function(_0x4b9a46,_0x4812bb){_0x4b9a46=_0x4b9a46-0x0;var _0x3a7334=_0xf0a7[_0x4b9a46];return _0x3a7334;};'use strict';var multer=require(_0x7f0a('0x0'));var util=require(_0x7f0a('0x1'));var path=require(_0x7f0a('0x2'));var timeout=require(_0x7f0a('0x3'));var express=require('express');var router=express[_0x7f0a('0x4')]();var fs_extra=require(_0x7f0a('0x5'));var auth=require(_0x7f0a('0x6'));var interaction=require(_0x7f0a('0x7'));var config=require(_0x7f0a('0x8'));var controller=require(_0x7f0a('0x9'));router[_0x7f0a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7f0a('0xb'),auth['isAuthenticated'](),controller[_0x7f0a('0xc')]);router['get'](_0x7f0a('0xd'),auth[_0x7f0a('0xe')](),controller[_0x7f0a('0xf')]);var upload=multer({'storage':multer[_0x7f0a('0x10')]({'destination':function(_0x489dc4,_0x442ba1,_0x3d5e93){_0x3d5e93(null,path[_0x7f0a('0x11')](config[_0x7f0a('0x12')],'server/files/sounds/original/'));},'filename':function(_0x334b8b,_0x45bec2,_0x101dfd){_0x45bec2[_0x7f0a('0x13')]=_0x45bec2[_0x7f0a('0x13')][_0x7f0a('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101dfd(null,util[_0x7f0a('0x15')](_0x7f0a('0x16'),path[_0x7f0a('0x17')](_0x45bec2[_0x7f0a('0x13')],path[_0x7f0a('0x18')](_0x45bec2['originalname'])),Date[_0x7f0a('0x19')](),path['extname'](_0x45bec2[_0x7f0a('0x13')])));}})});router['post']('/',upload[_0x7f0a('0x1a')](_0x7f0a('0x1b')),controller[_0x7f0a('0x1c')]);router['put'](_0x7f0a('0xb'),auth['isAuthenticated'](),controller[_0x7f0a('0x1d')]);router[_0x7f0a('0x1e')]('/:id',auth[_0x7f0a('0xe')](),controller[_0x7f0a('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x2754=['put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create'];(function(_0x4dd7e3,_0xc65d8d){var _0x5c2f5e=function(_0x14a98f){while(--_0x14a98f){_0x4dd7e3['push'](_0x4dd7e3['shift']());}};_0x5c2f5e(++_0xc65d8d);}(_0x2754,0x1e4));var _0x4275=function(_0x25e812,_0x1342a2){_0x25e812=_0x25e812-0x0;var _0x727c56=_0x2754[_0x25e812];return _0x727c56;};'use strict';var multer=require(_0x4275('0x0'));var util=require('util');var path=require(_0x4275('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4275('0x2')]();var fs_extra=require(_0x4275('0x3'));var auth=require(_0x4275('0x4'));var interaction=require(_0x4275('0x5'));var config=require(_0x4275('0x6'));var controller=require(_0x4275('0x7'));router[_0x4275('0x8')]('/',auth[_0x4275('0x9')](),controller[_0x4275('0xa')]);router[_0x4275('0x8')](_0x4275('0xb'),auth[_0x4275('0x9')](),controller[_0x4275('0xc')]);router[_0x4275('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4275('0xd')]);var upload=multer({'storage':multer[_0x4275('0xe')]({'destination':function(_0x38eea2,_0x182b9a,_0x3b8202){_0x3b8202(null,path[_0x4275('0xf')](config['root'],_0x4275('0x10')));},'filename':function(_0xde1deb,_0x44ab54,_0x6467cf){_0x44ab54[_0x4275('0x11')]=_0x44ab54['originalname'][_0x4275('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6467cf(null,util[_0x4275('0x13')](_0x4275('0x14'),path[_0x4275('0x15')](_0x44ab54[_0x4275('0x11')],path[_0x4275('0x16')](_0x44ab54[_0x4275('0x11')])),Date[_0x4275('0x17')](),path[_0x4275('0x16')](_0x44ab54[_0x4275('0x11')])));}})});router[_0x4275('0x18')]('/',upload[_0x4275('0x19')](_0x4275('0x1a')),controller[_0x4275('0x1b')]);router[_0x4275('0x1c')](_0x4275('0xb'),auth['isAuthenticated'](),controller[_0x4275('0x1d')]);router[_0x4275('0x1e')](_0x4275('0xb'),auth['isAuthenticated'](),controller[_0x4275('0x1e')]);module[_0x4275('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 8e957a4..a415df6 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 _0x4b7b=['FLOAT','BIGINT','INTEGER','sequelize','exports','name','STRING'];(function(_0x1c351b,_0x177ebd){var _0x175344=function(_0x37d578){while(--_0x37d578){_0x1c351b['push'](_0x1c351b['shift']());}};_0x175344(++_0x177ebd);}(_0x4b7b,0x73));var _0xb4b7=function(_0x1907e4,_0x1dee82){_0x1907e4=_0x1907e4-0x0;var _0x1fbe98=_0x4b7b[_0x1907e4];return _0x1fbe98;};'use strict';var Sequelize=require(_0xb4b7('0x0'));module[_0xb4b7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb4b7('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xb4b7('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xb4b7('0x4')]},'original_sampleCount':{'type':Sequelize[_0xb4b7('0x5')]},'original_channelCount':{'type':Sequelize[_0xb4b7('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xb4b7('0x6')]},'converted_format':{'type':Sequelize[_0xb4b7('0x3')]},'converted_duration':{'type':Sequelize[_0xb4b7('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xb4b7('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xb4b7('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xb4b7('0x6')]}}; \ No newline at end of file +var _0x3443=['name','STRING','INTEGER','BIGINT','sequelize','exports'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x3443,0x1c6));var _0x3344=function(_0x40f4cc,_0x432f55){_0x40f4cc=_0x40f4cc-0x0;var _0x458315=_0x3443[_0x40f4cc];return _0x458315;};'use strict';var Sequelize=require(_0x3344('0x0'));module[_0x3344('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3344('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3344('0x3')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3344('0x3')]},'original_format':{'type':Sequelize[_0x3344('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x3344('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x3344('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3344('0x5')]},'converted_channelCount':{'type':Sequelize[_0x3344('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3344('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x3344('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d35fa3c..8db20a0 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 _0xcc23=['converted_sampleCount','converted_channelCount','converted_sampleRate','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','include','Sound','rows','show','includeAll','find','catch','params','save_name','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','converted_format','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration'];(function(_0x2d011d,_0x1e8212){var _0x4f2cc8=function(_0x54e4ef){while(--_0x54e4ef){_0x2d011d['push'](_0x2d011d['shift']());}};_0x4f2cc8(++_0x1e8212);}(_0xcc23,0x104));var _0x3cc2=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xcc23[_0x47e549];return _0x251374;};'use strict';var emlformat=require(_0x3cc2('0x0'));var rimraf=require(_0x3cc2('0x1'));var zipdir=require(_0x3cc2('0x2'));var jsonpatch=require(_0x3cc2('0x3'));var rp=require('request-promise');var moment=require(_0x3cc2('0x4'));var BPromise=require(_0x3cc2('0x5'));var Mustache=require(_0x3cc2('0x6'));var util=require('util');var path=require(_0x3cc2('0x7'));var sox=require(_0x3cc2('0x8'));var csv=require(_0x3cc2('0x9'));var ejs=require(_0x3cc2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3cc2('0xb'));var crypto=require(_0x3cc2('0xc'));var jsforce=require(_0x3cc2('0xd'));var deskjs=require(_0x3cc2('0xe'));var toCsv=require(_0x3cc2('0x9'));var querystring=require(_0x3cc2('0xf'));var Papa=require(_0x3cc2('0x10'));var Redis=require(_0x3cc2('0x11'));var authService=require(_0x3cc2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3cc2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cc2('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3cc2('0x15'));var db=require(_0x3cc2('0x16'))['db'];function respondWithStatusCode(_0x3cd7c7,_0x4de6d0){_0x4de6d0=_0x4de6d0||0xcc;return function(_0x32e11e){if(_0x32e11e){return _0x3cd7c7[_0x3cc2('0x17')](_0x4de6d0);}return _0x3cd7c7['status'](_0x4de6d0)[_0x3cc2('0x18')]();};}function respondWithResult(_0x56e848,_0x123747){_0x123747=_0x123747||0xc8;return function(_0x43f48b){if(_0x43f48b){return _0x56e848[_0x3cc2('0x19')](_0x123747)[_0x3cc2('0x1a')](_0x43f48b);}};}function respondWithFilteredResult(_0xc4d38a,_0x4e2074){return function(_0x7bebc4){if(_0x7bebc4){var _0x501b11=typeof _0x4e2074['offset']===_0x3cc2('0x1b')&&typeof _0x4e2074[_0x3cc2('0x1c')]===_0x3cc2('0x1b');var _0x2bda2b=_0x7bebc4['count'];var _0x2b483a=_0x501b11?0x0:_0x4e2074[_0x3cc2('0x1d')];var _0xdf79eb=_0x501b11?_0x7bebc4[_0x3cc2('0x1e')]:_0x4e2074[_0x3cc2('0x1d')]+_0x4e2074[_0x3cc2('0x1c')];var _0x17c4f2;if(_0xdf79eb>=_0x2bda2b){_0xdf79eb=_0x2bda2b;_0x17c4f2=0xc8;}else{_0x17c4f2=0xce;}_0xc4d38a[_0x3cc2('0x19')](_0x17c4f2);return _0xc4d38a[_0x3cc2('0x1f')](_0x3cc2('0x20'),_0x2b483a+'-'+_0xdf79eb+'/'+_0x2bda2b)[_0x3cc2('0x1a')](_0x7bebc4);}return null;};}function patchUpdates(_0x78ba2e){return function(_0x40c6d6){try{jsonpatch[_0x3cc2('0x21')](_0x40c6d6,_0x78ba2e,!![]);}catch(_0x34d797){return BPromise[_0x3cc2('0x22')](_0x34d797);}return _0x40c6d6[_0x3cc2('0x23')]();};}function saveUpdates(_0x107c94,_0x3a4b32){return function(_0x4263ec){if(_0x4263ec){return _0x4263ec[_0x3cc2('0x24')](_0x107c94)['then'](function(_0x408cc8){return _0x408cc8;});}return null;};}function removeEntity(_0x4dad9e,_0x308c5e){return function(_0xd67dad){if(_0xd67dad){return _0xd67dad[_0x3cc2('0x25')]()[_0x3cc2('0x26')](function(){var _0x5e0043=_0xd67dad[_0x3cc2('0x27')]({'plain':!![]});var _0x2ff30a=_0x3cc2('0x28');return db['UserProfileResource'][_0x3cc2('0x25')]({'where':{'type':_0x2ff30a,'resourceId':_0x5e0043['id']}})[_0x3cc2('0x26')](function(){return _0xd67dad;});})[_0x3cc2('0x26')](function(){_0x4dad9e[_0x3cc2('0x19')](0xcc)[_0x3cc2('0x18')]();});}};}function handleEntityNotFound(_0x4921f3,_0x2fd9ce){return function(_0x377688){if(!_0x377688){_0x4921f3[_0x3cc2('0x17')](0x194);}return _0x377688;};}function handleError(_0x41c619,_0x574bf4){_0x574bf4=_0x574bf4||0x1f4;return function(_0x4c68c6){logger['error'](_0x4c68c6['stack']);if(_0x4c68c6[_0x3cc2('0x29')]){delete _0x4c68c6[_0x3cc2('0x29')];}_0x41c619[_0x3cc2('0x19')](_0x574bf4)[_0x3cc2('0x2a')](_0x4c68c6);};}exports[_0x3cc2('0x2b')]=function(_0xf608d1,_0x21b6aa){var _0x45af81={},_0xe31007={},_0x27e158={'count':0x0,'rows':[]};var _0x5df51e=_['map'](db['Sound'][_0x3cc2('0x2c')],function(_0x53abab){return{'name':_0x53abab[_0x3cc2('0x2d')],'type':_0x53abab[_0x3cc2('0x2e')]['key']};});_0xe31007[_0x3cc2('0x2f')]=_[_0x3cc2('0x30')](_0x5df51e,_0x3cc2('0x29'));_0xe31007[_0x3cc2('0x31')]=_[_0x3cc2('0x32')](_0xf608d1['query']);_0xe31007[_0x3cc2('0x33')]=_[_0x3cc2('0x34')](_0xe31007['model'],_0xe31007[_0x3cc2('0x31')]);_0x45af81[_0x3cc2('0x35')]=_[_0x3cc2('0x34')](_0xe31007[_0x3cc2('0x2f')],qs[_0x3cc2('0x36')](_0xf608d1[_0x3cc2('0x31')][_0x3cc2('0x36')]));_0x45af81[_0x3cc2('0x35')]=_0x45af81[_0x3cc2('0x35')][_0x3cc2('0x37')]?_0x45af81['attributes']:_0xe31007[_0x3cc2('0x2f')];if(!_0xf608d1[_0x3cc2('0x31')][_0x3cc2('0x38')](_0x3cc2('0x39'))){_0x45af81[_0x3cc2('0x1c')]=qs[_0x3cc2('0x1c')](_0xf608d1[_0x3cc2('0x31')][_0x3cc2('0x1c')]);_0x45af81[_0x3cc2('0x1d')]=qs[_0x3cc2('0x1d')](_0xf608d1[_0x3cc2('0x31')][_0x3cc2('0x1d')]);}_0x45af81[_0x3cc2('0x3a')]=qs[_0x3cc2('0x3b')](_0xf608d1[_0x3cc2('0x31')][_0x3cc2('0x3b')]);_0x45af81['where']=qs[_0x3cc2('0x33')](_[_0x3cc2('0x3c')](_0xf608d1['query'],_0xe31007[_0x3cc2('0x33')]),_0x5df51e);if(_0xf608d1[_0x3cc2('0x31')]['filter']){_0x45af81[_0x3cc2('0x3d')]=_['merge'](_0x45af81[_0x3cc2('0x3d')],{'$or':_['map'](_0x5df51e,function(_0x2dc582){if(_0x2dc582[_0x3cc2('0x2e')]!==_0x3cc2('0x3e')){var _0x3aa10e={};_0x3aa10e[_0x2dc582[_0x3cc2('0x29')]]={'$like':'%'+_0xf608d1[_0x3cc2('0x31')]['filter']+'%'};return _0x3aa10e;}})});}_0x45af81=_[_0x3cc2('0x3f')]({},_0x45af81,_0xf608d1[_0x3cc2('0x40')]);var _0x35894e={'where':_0x45af81[_0x3cc2('0x3d')]};return db['Sound']['count'](_0x35894e)['then'](function(_0xcc19a){_0x27e158[_0x3cc2('0x1e')]=_0xcc19a;if(_0xf608d1[_0x3cc2('0x31')]['includeAll']){_0x45af81[_0x3cc2('0x41')]=[{'all':!![]}];}return db[_0x3cc2('0x42')]['findAll'](_0x45af81);})[_0x3cc2('0x26')](function(_0xa57f79){_0x27e158[_0x3cc2('0x43')]=_0xa57f79;return _0x27e158;})[_0x3cc2('0x26')](respondWithFilteredResult(_0x21b6aa,_0x45af81))['catch'](handleError(_0x21b6aa,null));};exports[_0x3cc2('0x44')]=function(_0xde37d2,_0x315078){var _0xe249dd={'raw':!![],'where':{'id':_0xde37d2['params']['id']}},_0x5e200a={};_0x5e200a[_0x3cc2('0x2f')]=_[_0x3cc2('0x32')](db[_0x3cc2('0x42')]['rawAttributes']);_0x5e200a[_0x3cc2('0x31')]=_['keys'](_0xde37d2[_0x3cc2('0x31')]);_0x5e200a['filters']=_[_0x3cc2('0x34')](_0x5e200a['model'],_0x5e200a[_0x3cc2('0x31')]);_0xe249dd['attributes']=_['intersection'](_0x5e200a[_0x3cc2('0x2f')],qs[_0x3cc2('0x36')](_0xde37d2['query'][_0x3cc2('0x36')]));_0xe249dd['attributes']=_0xe249dd[_0x3cc2('0x35')][_0x3cc2('0x37')]?_0xe249dd[_0x3cc2('0x35')]:_0x5e200a['model'];if(_0xde37d2[_0x3cc2('0x31')][_0x3cc2('0x45')]){_0xe249dd[_0x3cc2('0x41')]=[{'all':!![]}];}_0xe249dd=_[_0x3cc2('0x3f')]({},_0xe249dd,_0xde37d2['options']);return db[_0x3cc2('0x42')][_0x3cc2('0x46')](_0xe249dd)[_0x3cc2('0x26')](handleEntityNotFound(_0x315078,null))[_0x3cc2('0x26')](respondWithResult(_0x315078,null))[_0x3cc2('0x47')](handleError(_0x315078,null));};exports['download']=function(_0x578c65,_0xee6065,_0x43ecc4){return db['Sound'][_0x3cc2('0x46')]({'where':{'id':_0x578c65[_0x3cc2('0x48')]['id']},'attributes':[_0x3cc2('0x29'),_0x3cc2('0x49'),'converted_format'],'raw':!![]})[_0x3cc2('0x26')](handleEntityNotFound(_0xee6065,null))[_0x3cc2('0x26')](function(_0x19b6be){if(_0x19b6be){if(!fs[_0x3cc2('0x4a')](path[_0x3cc2('0x4b')](config[_0x3cc2('0x4c')],_0x3cc2('0x4d'),_0x19b6be[_0x3cc2('0x49')]+'.'+_0x19b6be['converted_format']))){throw new db[(_0x3cc2('0x4e'))][(_0x3cc2('0x4f'))](_0x3cc2('0x50'));}return _0xee6065['download'](path[_0x3cc2('0x4b')](config['root'],'server/files/sounds/converted',util[_0x3cc2('0x51')]('%s.%s',_0x19b6be[_0x3cc2('0x49')],_0x19b6be[_0x3cc2('0x52')])),util[_0x3cc2('0x51')]('%s.%s',_0x19b6be[_0x3cc2('0x29')],_0x19b6be[_0x3cc2('0x52')]));}return null;})[_0x3cc2('0x47')](handleError(_0xee6065,null));};exports['create']=function(_0xb214c3,_0x26f993,_0x50630e){var _0x1ce357={'name':path['basename'](_0xb214c3[_0x3cc2('0x53')][_0x3cc2('0x54')],path[_0x3cc2('0x55')](_0xb214c3['file']['originalname'])),'save_name':path[_0x3cc2('0x56')](_0xb214c3[_0x3cc2('0x53')][_0x3cc2('0x57')],path[_0x3cc2('0x55')](_0xb214c3[_0x3cc2('0x53')]['filename'])),'original_format':path[_0x3cc2('0x55')](_0xb214c3['file'][_0x3cc2('0x54')])[_0x3cc2('0x58')](0x1),'converted_format':_0x3cc2('0x59')};var _0x6a81df=path['join'](config[_0x3cc2('0x4c')],_0x3cc2('0x5a'),_0xb214c3[_0x3cc2('0x53')][_0x3cc2('0x57')]);var _0x2e6508=path[_0x3cc2('0x4b')](config['root'],'server/files/sounds/converted',util[_0x3cc2('0x51')](_0x3cc2('0x5b'),path[_0x3cc2('0x56')](_0xb214c3[_0x3cc2('0x53')][_0x3cc2('0x57')],path['extname'](_0xb214c3[_0x3cc2('0x53')][_0x3cc2('0x57')])),_0x1ce357[_0x3cc2('0x52')]));logger[_0x3cc2('0x5c')](_0x3cc2('0x5d'),_0x6a81df);logger[_0x3cc2('0x5c')](_0x3cc2('0x5e'),_0x2e6508);try{fs[_0x3cc2('0x5f')](_0x6a81df,parseInt(_0x3cc2('0x60'),0x8));var _0x29ad0b=sox['transcode'](_0x6a81df,_0x2e6508,{'sampleRate':0x1f40,'format':_0x3cc2('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29ad0b['on']('error',function(_0x57d8d3){fs['unlinkSync'](_0x6a81df);_0x26f993[_0x3cc2('0x19')](0x1f4)[_0x3cc2('0x2a')](_0x57d8d3);});_0x29ad0b['on']('src',function(_0x6f05b6){_0x1ce357[_0x3cc2('0x61')]=isNaN(_0x6f05b6['duration'])?null:_0x6f05b6[_0x3cc2('0x62')]*0x3e8;_0x1ce357[_0x3cc2('0x63')]=isNaN(_0x6f05b6[_0x3cc2('0x64')])?null:_0x6f05b6[_0x3cc2('0x64')];_0x1ce357['original_channelCount']=isNaN(_0x6f05b6[_0x3cc2('0x65')])?null:_0x6f05b6[_0x3cc2('0x65')];_0x1ce357[_0x3cc2('0x66')]=isNaN(_0x6f05b6[_0x3cc2('0x67')])?null:_0x6f05b6[_0x3cc2('0x67')];_0x1ce357['original_sampleRate']=isNaN(_0x6f05b6[_0x3cc2('0x68')])?null:_0x6f05b6[_0x3cc2('0x68')];});_0x29ad0b['on']('dest',function(_0x3e1dc4){_0x1ce357[_0x3cc2('0x69')]=isNaN(_0x3e1dc4['duration'])?null:_0x3e1dc4[_0x3cc2('0x62')]*0x3e8;_0x1ce357[_0x3cc2('0x6a')]=isNaN(_0x3e1dc4[_0x3cc2('0x64')])?null:_0x3e1dc4['sampleCount'];_0x1ce357[_0x3cc2('0x6b')]=isNaN(_0x3e1dc4[_0x3cc2('0x65')])?null:_0x3e1dc4[_0x3cc2('0x65')];_0x1ce357['converted_bitRate']=isNaN(_0x3e1dc4['bitRate'])?null:_0x3e1dc4[_0x3cc2('0x67')];_0x1ce357[_0x3cc2('0x6c')]=isNaN(_0x3e1dc4[_0x3cc2('0x68')])?null:_0x3e1dc4[_0x3cc2('0x68')];});_0x29ad0b['on'](_0x3cc2('0x18'),function(){fs['chmodSync'](_0x2e6508,parseInt('0777',0x8));return db[_0x3cc2('0x42')][_0x3cc2('0x6d')](_0x1ce357)[_0x3cc2('0x26')](function(_0x37f093){var _0x46cc54={'role':_0xb214c3['body'][_0x3cc2('0x6e')],'userProfileId':_0xb214c3[_0x3cc2('0x6f')][_0x3cc2('0x70')]};if(!_0x46cc54)throw new Error(_0x3cc2('0x71'));if(_0x46cc54[_0x3cc2('0x6e')]===_0x3cc2('0x72')){var _0x219e96=_0x37f093['get']({'plain':!![]});return db[_0x3cc2('0x73')][_0x3cc2('0x46')]({'where':{'name':_0x3cc2('0x28'),'userProfileId':_0x46cc54[_0x3cc2('0x70')]},'raw':!![]})[_0x3cc2('0x26')](function(_0x2ab559){if(_0x2ab559&&_0x2ab559[_0x3cc2('0x74')]===0x0){return db['UserProfileResource'][_0x3cc2('0x6d')]({'name':_0x219e96[_0x3cc2('0x29')],'resourceId':_0x219e96['id'],'type':_0x2ab559[_0x3cc2('0x29')],'sectionId':_0x2ab559['id']},{})[_0x3cc2('0x26')](function(){return _0x37f093;});}else{return _0x37f093;}})['catch'](function(_0x3d2d20){logger[_0x3cc2('0x75')](_0x3cc2('0x76'),_0x3d2d20);throw _0x3d2d20;});}return _0x37f093;})['then'](respondWithResult(_0x26f993,null))[_0x3cc2('0x47')](handleError(_0x26f993,null));});_0x29ad0b[_0x3cc2('0x77')]();}catch(_0x290d10){_0x26f993[_0x3cc2('0x19')](0x1f4)[_0x3cc2('0x2a')](_0x290d10);}};exports['update']=function(_0x49b277,_0x76ff18,_0x4e6cf1){return db['Sound'][_0x3cc2('0x46')]({'where':{'id':_0x49b277[_0x3cc2('0x48')]['id']}})[_0x3cc2('0x26')](handleEntityNotFound(_0x76ff18,null))[_0x3cc2('0x26')](saveUpdates(_[_0x3cc2('0x3c')](_0x49b277[_0x3cc2('0x6f')],[_0x3cc2('0x29'),'description']),null))[_0x3cc2('0x26')](respondWithResult(_0x76ff18,null))[_0x3cc2('0x47')](handleError(_0x76ff18,null));};exports[_0x3cc2('0x78')]=function(_0x190a0e,_0x3d4b8b,_0xacf93d){return db[_0x3cc2('0x42')][_0x3cc2('0x46')]({'where':{'id':_0x190a0e['params']['id']}})['then'](function(_0x36a535){if(_0x36a535){return _0x36a535['destroy']();}})[_0x3cc2('0x26')](function(_0x5dde40){var _0x23b5a3=path[_0x3cc2('0x4b')](config[_0x3cc2('0x4c')],'server/files/sounds/original',util[_0x3cc2('0x51')]('%s.%s',_0x5dde40['save_name'],_0x5dde40['original_format']));var _0x1d3b5e=path[_0x3cc2('0x4b')](config[_0x3cc2('0x4c')],_0x3cc2('0x4d'),util[_0x3cc2('0x51')](_0x3cc2('0x5b'),_0x5dde40[_0x3cc2('0x49')],_0x5dde40[_0x3cc2('0x52')]));fs[_0x3cc2('0x79')](_0x23b5a3);fs[_0x3cc2('0x79')](_0x1d3b5e);return _0x5dde40;})['then'](function(_0x4595ba){if(_0x4595ba){return _0x3d4b8b['status'](0xcc)[_0x3cc2('0x18')]();}})[_0x3cc2('0x26')](handleEntityNotFound(_0x3d4b8b,null))[_0x3cc2('0x47')](handleError(_0x3d4b8b,null));}; \ No newline at end of file +var _0x16bc=['mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','Sound','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','length','download','save_name','converted_format','existsSync','join','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','extname','filename','originalname','substring','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','0777','body','role','userProfileId','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x21fd8e,_0x553dc7){var _0x157b97=function(_0x48f3e1){while(--_0x48f3e1){_0x21fd8e['push'](_0x21fd8e['shift']());}};_0x157b97(++_0x553dc7);}(_0x16bc,0x75));var _0xc16b=function(_0xafdaf4,_0x5bd4d1){_0xafdaf4=_0xafdaf4-0x0;var _0x1e70a8=_0x16bc[_0xafdaf4];return _0x1e70a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc16b('0x0'));var zipdir=require(_0xc16b('0x1'));var jsonpatch=require(_0xc16b('0x2'));var rp=require(_0xc16b('0x3'));var moment=require(_0xc16b('0x4'));var BPromise=require(_0xc16b('0x5'));var Mustache=require(_0xc16b('0x6'));var util=require('util');var path=require(_0xc16b('0x7'));var sox=require(_0xc16b('0x8'));var csv=require(_0xc16b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc16b('0xa'));var squel=require(_0xc16b('0xb'));var crypto=require(_0xc16b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc16b('0xd'));var toCsv=require(_0xc16b('0x9'));var querystring=require(_0xc16b('0xe'));var Papa=require('papaparse');var Redis=require(_0xc16b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc16b('0x10'));var hardwareService=require(_0xc16b('0x11'));var logger=require(_0xc16b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc16b('0x13'));var licenseUtil=require(_0xc16b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d0c58,_0x5f16b6){_0x5f16b6=_0x5f16b6||0xcc;return function(_0x39e602){if(_0x39e602){return _0x3d0c58['sendStatus'](_0x5f16b6);}return _0x3d0c58[_0xc16b('0x15')](_0x5f16b6)['end']();};}function respondWithResult(_0x57f2d3,_0x338424){_0x338424=_0x338424||0xc8;return function(_0x296248){if(_0x296248){return _0x57f2d3[_0xc16b('0x15')](_0x338424)[_0xc16b('0x16')](_0x296248);}};}function respondWithFilteredResult(_0x2830ec,_0x25ba21){return function(_0x22b599){if(_0x22b599){var _0x474381=typeof _0x25ba21[_0xc16b('0x17')]===_0xc16b('0x18')&&typeof _0x25ba21[_0xc16b('0x19')]==='undefined';var _0x18015b=_0x22b599[_0xc16b('0x1a')];var _0x5204fd=_0x474381?0x0:_0x25ba21['offset'];var _0x1d699e=_0x474381?_0x22b599[_0xc16b('0x1a')]:_0x25ba21[_0xc16b('0x17')]+_0x25ba21[_0xc16b('0x19')];var _0x44bb34;if(_0x1d699e>=_0x18015b){_0x1d699e=_0x18015b;_0x44bb34=0xc8;}else{_0x44bb34=0xce;}_0x2830ec['status'](_0x44bb34);return _0x2830ec[_0xc16b('0x1b')]('Content-Range',_0x5204fd+'-'+_0x1d699e+'/'+_0x18015b)['json'](_0x22b599);}return null;};}function patchUpdates(_0x2b86b8){return function(_0x34bb62){try{jsonpatch[_0xc16b('0x1c')](_0x34bb62,_0x2b86b8,!![]);}catch(_0x2fb4ff){return BPromise[_0xc16b('0x1d')](_0x2fb4ff);}return _0x34bb62[_0xc16b('0x1e')]();};}function saveUpdates(_0x478bbf,_0x3523ac){return function(_0x1e7df1){if(_0x1e7df1){return _0x1e7df1[_0xc16b('0x1f')](_0x478bbf)['then'](function(_0x15ab9d){return _0x15ab9d;});}return null;};}function removeEntity(_0x5670d7,_0x510b61){return function(_0x1fecb2){if(_0x1fecb2){return _0x1fecb2[_0xc16b('0x20')]()[_0xc16b('0x21')](function(){var _0x43436f=_0x1fecb2[_0xc16b('0x22')]({'plain':!![]});var _0x2d6369=_0xc16b('0x23');return db[_0xc16b('0x24')]['destroy']({'where':{'type':_0x2d6369,'resourceId':_0x43436f['id']}})[_0xc16b('0x21')](function(){return _0x1fecb2;});})[_0xc16b('0x21')](function(){_0x5670d7[_0xc16b('0x15')](0xcc)[_0xc16b('0x25')]();});}};}function handleEntityNotFound(_0x19e8fa,_0x506062){return function(_0x1ea878){if(!_0x1ea878){_0x19e8fa[_0xc16b('0x26')](0x194);}return _0x1ea878;};}function handleError(_0x340ac6,_0x344fbf){_0x344fbf=_0x344fbf||0x1f4;return function(_0x3a44db){logger[_0xc16b('0x27')](_0x3a44db[_0xc16b('0x28')]);if(_0x3a44db[_0xc16b('0x29')]){delete _0x3a44db[_0xc16b('0x29')];}_0x340ac6[_0xc16b('0x15')](_0x344fbf)[_0xc16b('0x2a')](_0x3a44db);};}exports[_0xc16b('0x2b')]=function(_0x9c9d0c,_0x217312){var _0x32e6ea={},_0x4fd450={},_0x2bcc77={'count':0x0,'rows':[]};var _0x34c31c=_['map'](db[_0xc16b('0x2c')][_0xc16b('0x2d')],function(_0xbaade7){return{'name':_0xbaade7['fieldName'],'type':_0xbaade7[_0xc16b('0x2e')][_0xc16b('0x2f')]};});_0x4fd450['model']=_[_0xc16b('0x30')](_0x34c31c,_0xc16b('0x29'));_0x4fd450[_0xc16b('0x31')]=_[_0xc16b('0x32')](_0x9c9d0c[_0xc16b('0x31')]);_0x4fd450[_0xc16b('0x33')]=_[_0xc16b('0x34')](_0x4fd450[_0xc16b('0x35')],_0x4fd450[_0xc16b('0x31')]);_0x32e6ea[_0xc16b('0x36')]=_[_0xc16b('0x34')](_0x4fd450[_0xc16b('0x35')],qs[_0xc16b('0x37')](_0x9c9d0c[_0xc16b('0x31')][_0xc16b('0x37')]));_0x32e6ea[_0xc16b('0x36')]=_0x32e6ea[_0xc16b('0x36')]['length']?_0x32e6ea[_0xc16b('0x36')]:_0x4fd450[_0xc16b('0x35')];if(!_0x9c9d0c[_0xc16b('0x31')]['hasOwnProperty'](_0xc16b('0x38'))){_0x32e6ea[_0xc16b('0x19')]=qs[_0xc16b('0x19')](_0x9c9d0c['query'][_0xc16b('0x19')]);_0x32e6ea[_0xc16b('0x17')]=qs[_0xc16b('0x17')](_0x9c9d0c[_0xc16b('0x31')]['offset']);}_0x32e6ea[_0xc16b('0x39')]=qs['sort'](_0x9c9d0c['query'][_0xc16b('0x3a')]);_0x32e6ea['where']=qs['filters'](_['pick'](_0x9c9d0c[_0xc16b('0x31')],_0x4fd450['filters']),_0x34c31c);if(_0x9c9d0c['query']['filter']){_0x32e6ea[_0xc16b('0x3b')]=_[_0xc16b('0x3c')](_0x32e6ea['where'],{'$or':_[_0xc16b('0x30')](_0x34c31c,function(_0x430907){if(_0x430907[_0xc16b('0x2e')]!==_0xc16b('0x3d')){var _0x390550={};_0x390550[_0x430907['name']]={'$like':'%'+_0x9c9d0c['query'][_0xc16b('0x3e')]+'%'};return _0x390550;}})});}_0x32e6ea=_[_0xc16b('0x3c')]({},_0x32e6ea,_0x9c9d0c[_0xc16b('0x3f')]);var _0x2934b5={'where':_0x32e6ea[_0xc16b('0x3b')]};return db[_0xc16b('0x2c')][_0xc16b('0x1a')](_0x2934b5)[_0xc16b('0x21')](function(_0x1df452){_0x2bcc77[_0xc16b('0x1a')]=_0x1df452;if(_0x9c9d0c[_0xc16b('0x31')][_0xc16b('0x40')]){_0x32e6ea[_0xc16b('0x41')]=[{'all':!![]}];}return db[_0xc16b('0x2c')]['findAll'](_0x32e6ea);})[_0xc16b('0x21')](function(_0x2c78ac){_0x2bcc77['rows']=_0x2c78ac;return _0x2bcc77;})[_0xc16b('0x21')](respondWithFilteredResult(_0x217312,_0x32e6ea))[_0xc16b('0x42')](handleError(_0x217312,null));};exports[_0xc16b('0x43')]=function(_0x53da1d,_0x2eaafa){var _0x4dd151={'raw':!![],'where':{'id':_0x53da1d[_0xc16b('0x44')]['id']}},_0x9cc7d9={};_0x9cc7d9[_0xc16b('0x35')]=_[_0xc16b('0x32')](db[_0xc16b('0x2c')]['rawAttributes']);_0x9cc7d9[_0xc16b('0x31')]=_[_0xc16b('0x32')](_0x53da1d[_0xc16b('0x31')]);_0x9cc7d9[_0xc16b('0x33')]=_[_0xc16b('0x34')](_0x9cc7d9['model'],_0x9cc7d9[_0xc16b('0x31')]);_0x4dd151[_0xc16b('0x36')]=_[_0xc16b('0x34')](_0x9cc7d9[_0xc16b('0x35')],qs[_0xc16b('0x37')](_0x53da1d['query']['fields']));_0x4dd151[_0xc16b('0x36')]=_0x4dd151['attributes'][_0xc16b('0x45')]?_0x4dd151[_0xc16b('0x36')]:_0x9cc7d9[_0xc16b('0x35')];if(_0x53da1d['query'][_0xc16b('0x40')]){_0x4dd151[_0xc16b('0x41')]=[{'all':!![]}];}_0x4dd151=_[_0xc16b('0x3c')]({},_0x4dd151,_0x53da1d['options']);return db[_0xc16b('0x2c')]['find'](_0x4dd151)['then'](handleEntityNotFound(_0x2eaafa,null))[_0xc16b('0x21')](respondWithResult(_0x2eaafa,null))[_0xc16b('0x42')](handleError(_0x2eaafa,null));};exports[_0xc16b('0x46')]=function(_0x21ceae,_0xb5456,_0x59ecc2){return db[_0xc16b('0x2c')]['find']({'where':{'id':_0x21ceae[_0xc16b('0x44')]['id']},'attributes':['name',_0xc16b('0x47'),_0xc16b('0x48')],'raw':!![]})[_0xc16b('0x21')](handleEntityNotFound(_0xb5456,null))[_0xc16b('0x21')](function(_0x242c00){if(_0x242c00){if(!fs[_0xc16b('0x49')](path[_0xc16b('0x4a')](config['root'],'server/files/sounds/converted',_0x242c00['save_name']+'.'+_0x242c00[_0xc16b('0x48')]))){throw new db[(_0xc16b('0x4b'))][(_0xc16b('0x4c'))](_0xc16b('0x4d'));}return _0xb5456[_0xc16b('0x46')](path[_0xc16b('0x4a')](config[_0xc16b('0x4e')],'server/files/sounds/converted',util[_0xc16b('0x4f')](_0xc16b('0x50'),_0x242c00[_0xc16b('0x47')],_0x242c00[_0xc16b('0x48')])),util[_0xc16b('0x4f')](_0xc16b('0x50'),_0x242c00[_0xc16b('0x29')],_0x242c00[_0xc16b('0x48')]));}return null;})[_0xc16b('0x42')](handleError(_0xb5456,null));};exports[_0xc16b('0x51')]=function(_0x581f32,_0x567951,_0xd9e186){var _0x21a902={'name':path[_0xc16b('0x52')](_0x581f32[_0xc16b('0x53')]['originalname'],path[_0xc16b('0x54')](_0x581f32[_0xc16b('0x53')]['originalname'])),'save_name':path[_0xc16b('0x52')](_0x581f32['file'][_0xc16b('0x55')],path['extname'](_0x581f32['file'][_0xc16b('0x55')])),'original_format':path[_0xc16b('0x54')](_0x581f32[_0xc16b('0x53')][_0xc16b('0x56')])[_0xc16b('0x57')](0x1),'converted_format':_0xc16b('0x58')};var _0x51c943=path[_0xc16b('0x4a')](config[_0xc16b('0x4e')],_0xc16b('0x59'),_0x581f32['file'][_0xc16b('0x55')]);var _0x1554aa=path['join'](config['root'],_0xc16b('0x5a'),util[_0xc16b('0x4f')]('%s.%s',path[_0xc16b('0x52')](_0x581f32['file'][_0xc16b('0x55')],path['extname'](_0x581f32[_0xc16b('0x53')][_0xc16b('0x55')])),_0x21a902[_0xc16b('0x48')]));logger[_0xc16b('0x5b')](_0xc16b('0x5c'),_0x51c943);logger[_0xc16b('0x5b')](_0xc16b('0x5d'),_0x1554aa);try{fs[_0xc16b('0x5e')](_0x51c943,parseInt('0777',0x8));var _0x1e07ca=sox[_0xc16b('0x5f')](_0x51c943,_0x1554aa,{'sampleRate':0x1f40,'format':_0xc16b('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e07ca['on'](_0xc16b('0x27'),function(_0x76842e){fs['unlinkSync'](_0x51c943);_0x567951[_0xc16b('0x15')](0x1f4)[_0xc16b('0x2a')](_0x76842e);});_0x1e07ca['on'](_0xc16b('0x60'),function(_0xfa9c0e){_0x21a902[_0xc16b('0x61')]=isNaN(_0xfa9c0e[_0xc16b('0x62')])?null:_0xfa9c0e[_0xc16b('0x62')]*0x3e8;_0x21a902[_0xc16b('0x63')]=isNaN(_0xfa9c0e[_0xc16b('0x64')])?null:_0xfa9c0e[_0xc16b('0x64')];_0x21a902[_0xc16b('0x65')]=isNaN(_0xfa9c0e[_0xc16b('0x66')])?null:_0xfa9c0e['channelCount'];_0x21a902[_0xc16b('0x67')]=isNaN(_0xfa9c0e['bitRate'])?null:_0xfa9c0e[_0xc16b('0x68')];_0x21a902[_0xc16b('0x69')]=isNaN(_0xfa9c0e[_0xc16b('0x6a')])?null:_0xfa9c0e[_0xc16b('0x6a')];});_0x1e07ca['on']('dest',function(_0x3f6e75){_0x21a902[_0xc16b('0x6b')]=isNaN(_0x3f6e75[_0xc16b('0x62')])?null:_0x3f6e75['duration']*0x3e8;_0x21a902['converted_sampleCount']=isNaN(_0x3f6e75[_0xc16b('0x64')])?null:_0x3f6e75[_0xc16b('0x64')];_0x21a902[_0xc16b('0x6c')]=isNaN(_0x3f6e75[_0xc16b('0x66')])?null:_0x3f6e75['channelCount'];_0x21a902['converted_bitRate']=isNaN(_0x3f6e75['bitRate'])?null:_0x3f6e75['bitRate'];_0x21a902['converted_sampleRate']=isNaN(_0x3f6e75['sampleRate'])?null:_0x3f6e75[_0xc16b('0x6a')];});_0x1e07ca['on'](_0xc16b('0x25'),function(){fs['chmodSync'](_0x1554aa,parseInt(_0xc16b('0x6d'),0x8));return db['Sound'][_0xc16b('0x51')](_0x21a902)[_0xc16b('0x21')](function(_0x293a7a){var _0x1b03be={'role':_0x581f32[_0xc16b('0x6e')][_0xc16b('0x6f')],'userProfileId':_0x581f32['body'][_0xc16b('0x70')]};if(!_0x1b03be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b03be[_0xc16b('0x6f')]===_0xc16b('0x71')){var _0x2a9369=_0x293a7a[_0xc16b('0x22')]({'plain':!![]});return db[_0xc16b('0x72')][_0xc16b('0x73')]({'where':{'name':_0xc16b('0x23'),'userProfileId':_0x1b03be[_0xc16b('0x70')]},'raw':!![]})[_0xc16b('0x21')](function(_0x36d6f6){if(_0x36d6f6&&_0x36d6f6[_0xc16b('0x74')]===0x0){return db[_0xc16b('0x24')][_0xc16b('0x51')]({'name':_0x2a9369[_0xc16b('0x29')],'resourceId':_0x2a9369['id'],'type':_0x36d6f6['name'],'sectionId':_0x36d6f6['id']},{})['then'](function(){return _0x293a7a;});}else{return _0x293a7a;}})['catch'](function(_0x4c9b66){logger['error'](_0xc16b('0x75'),_0x4c9b66);throw _0x4c9b66;});}return _0x293a7a;})['then'](respondWithResult(_0x567951,null))[_0xc16b('0x42')](handleError(_0x567951,null));});_0x1e07ca['start']();}catch(_0xd0dd3f){_0x567951[_0xc16b('0x15')](0x1f4)[_0xc16b('0x2a')](_0xd0dd3f);}};exports[_0xc16b('0x1f')]=function(_0x584897,_0x2f3586,_0x49145a){return db[_0xc16b('0x2c')][_0xc16b('0x73')]({'where':{'id':_0x584897[_0xc16b('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f3586,null))[_0xc16b('0x21')](saveUpdates(_[_0xc16b('0x76')](_0x584897[_0xc16b('0x6e')],[_0xc16b('0x29'),_0xc16b('0x77')]),null))['then'](respondWithResult(_0x2f3586,null))[_0xc16b('0x42')](handleError(_0x2f3586,null));};exports[_0xc16b('0x78')]=function(_0x13261b,_0x819b91,_0x34c98){return db[_0xc16b('0x2c')][_0xc16b('0x73')]({'where':{'id':_0x13261b[_0xc16b('0x44')]['id']}})[_0xc16b('0x21')](function(_0x24e232){if(_0x24e232){return _0x24e232[_0xc16b('0x20')]();}})[_0xc16b('0x21')](function(_0x418763){var _0xf8b134=path[_0xc16b('0x4a')](config[_0xc16b('0x4e')],'server/files/sounds/original',util[_0xc16b('0x4f')](_0xc16b('0x50'),_0x418763['save_name'],_0x418763[_0xc16b('0x79')]));var _0x2c2de7=path[_0xc16b('0x4a')](config[_0xc16b('0x4e')],'server/files/sounds/converted',util['format'](_0xc16b('0x50'),_0x418763['save_name'],_0x418763['converted_format']));fs[_0xc16b('0x7a')](_0xf8b134);fs[_0xc16b('0x7a')](_0x2c2de7);return _0x418763;})[_0xc16b('0x21')](function(_0x374d38){if(_0x374d38){return _0x819b91[_0xc16b('0x15')](0xcc)['end']();}})[_0xc16b('0x21')](handleEntityNotFound(_0x819b91,null))[_0xc16b('0x42')](handleError(_0x819b91,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 132f671..2e7337d 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 _0xd264=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xd264,0x1a4));var _0x4d26=function(_0x1195ff,_0x186e7e){_0x1195ff=_0x1195ff-0x0;var _0x513623=_0xd264[_0x1195ff];return _0x513623;};'use strict';var _=require('lodash');var util=require(_0x4d26('0x0'));var logger=require(_0x4d26('0x1'))(_0x4d26('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d26('0x3'));var fs=require('fs');var path=require(_0x4d26('0x4'));var rimraf=require(_0x4d26('0x5'));var config=require(_0x4d26('0x6'));var attributes=require(_0x4d26('0x7'));module['exports']=function(_0x48ebc0,_0xd2d2ed){return _0x48ebc0[_0x4d26('0x8')](_0x4d26('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74a5=['request-promise','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird'];(function(_0xaf4e3b,_0x3527ac){var _0x37a1e1=function(_0x49dc7f){while(--_0x49dc7f){_0xaf4e3b['push'](_0xaf4e3b['shift']());}};_0x37a1e1(++_0x3527ac);}(_0x74a5,0xf5));var _0x574a=function(_0x1ff257,_0x4eb105){_0x1ff257=_0x1ff257-0x0;var _0x1abaa9=_0x74a5[_0x1ff257];return _0x1abaa9;};'use strict';var _=require(_0x574a('0x0'));var util=require(_0x574a('0x1'));var logger=require(_0x574a('0x2'))('api');var moment=require(_0x574a('0x3'));var BPromise=require(_0x574a('0x4'));var rp=require(_0x574a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x574a('0x6'));module['exports']=function(_0x5eeee6,_0x1a7a99){return _0x5eeee6[_0x574a('0x7')](_0x574a('0x8'),attributes,{'tableName':_0x574a('0x9'),'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 0debb50..b71ddc1 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 _0x9381=['request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','Sound','find','raw','options','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x9381,0x7a));var _0x1938=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x9381[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x1938('0x0'));var util=require('util');var moment=require(_0x1938('0x1'));var BPromise=require(_0x1938('0x2'));var rs=require(_0x1938('0x3'));var fs=require('fs');var Redis=require(_0x1938('0x4'));var db=require(_0x1938('0x5'))['db'];var utils=require(_0x1938('0x6'));var logger=require(_0x1938('0x7'))('rpc');var config=require(_0x1938('0x8'));var jayson=require(_0x1938('0x9'));var client=jayson['client'][_0x1938('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xace7a1,_0xc6b603,_0x25e759){return new BPromise(function(_0x10eaaf,_0x1a7e20){return client[_0x1938('0xb')](_0xace7a1,_0x25e759)[_0x1938('0xc')](function(_0x513393){logger[_0x1938('0xd')]('Sound,\x20%s,\x20%s',_0xc6b603,_0x1938('0xe'));logger['debug'](_0x1938('0xf'),_0xc6b603,_0x1938('0xe'),JSON[_0x1938('0x10')](_0x513393));if(_0x513393[_0x1938('0x11')]){if(_0x513393[_0x1938('0x11')][_0x1938('0x12')]===0x1f4){logger[_0x1938('0x11')]('Sound,\x20%s,\x20%s',_0xc6b603,_0x513393[_0x1938('0x11')][_0x1938('0x13')]);return _0x1a7e20(_0x513393['error'][_0x1938('0x13')]);}logger['error'](_0x1938('0x14'),_0xc6b603,_0x513393['error'][_0x1938('0x13')]);return _0x10eaaf(_0x513393['error']['message']);}else{logger[_0x1938('0xd')](_0x1938('0x14'),_0xc6b603,_0x1938('0xe'));_0x10eaaf(_0x513393[_0x1938('0x15')][_0x1938('0x13')]);}})[_0x1938('0x16')](function(_0x4e1e5f){logger['error'](_0x1938('0x14'),_0xc6b603,_0x4e1e5f);_0x1a7e20(_0x4e1e5f);});});}exports[_0x1938('0x17')]=function(_0x188654){var _0x10fb30=this;return new Promise(function(_0x1d5172,_0x576f53){return db[_0x1938('0x18')][_0x1938('0x19')]({'raw':_0x188654['options']?_0x188654['options'][_0x1938('0x1a')]===undefined?!![]:![]:!![],'where':_0x188654[_0x1938('0x1b')]?_0x188654['options'][_0x1938('0x1c')]||null:null,'attributes':_0x188654[_0x1938('0x1b')]?_0x188654[_0x1938('0x1b')][_0x1938('0x1d')]||null:null,'include':_0x188654[_0x1938('0x1b')]?_0x188654[_0x1938('0x1b')][_0x1938('0x1e')]?_[_0x1938('0x1f')](_0x188654['options'][_0x1938('0x1e')],function(_0x4a9698){return{'model':db[_0x4a9698[_0x1938('0x20')]],'as':_0x4a9698['as'],'attributes':_0x4a9698['attributes'],'include':_0x4a9698[_0x1938('0x1e')]?_['map'](_0x4a9698[_0x1938('0x1e')],function(_0x9a0f99){return{'model':db[_0x9a0f99[_0x1938('0x20')]],'as':_0x9a0f99['as'],'attributes':_0x9a0f99[_0x1938('0x1d')],'include':_0x9a0f99[_0x1938('0x1e')]?_[_0x1938('0x1f')](_0x9a0f99[_0x1938('0x1e')],function(_0x446044){return{'model':db[_0x446044[_0x1938('0x20')]],'as':_0x446044['as'],'attributes':_0x446044[_0x1938('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf04595){logger[_0x1938('0xd')](_0x1938('0x17'),_0x188654);logger[_0x1938('0x21')](_0x1938('0x17'),_0x188654,JSON['stringify'](_0xf04595));_0x1d5172(_0xf04595);})[_0x1938('0x16')](function(_0x29c189){logger[_0x1938('0x11')](_0x1938('0x17'),_0x29c189[_0x1938('0x13')],_0x188654);_0x576f53(_0x10fb30[_0x1938('0x11')](0x1f4,_0x29c189['message']));});});}; \ No newline at end of file +var _0xeea4=['include','map','model','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ShowSound','Sound','find','options','raw','where','attributes'];(function(_0x4439ee,_0x58676d){var _0x481430=function(_0x21ae0c){while(--_0x21ae0c){_0x4439ee['push'](_0x4439ee['shift']());}};_0x481430(++_0x58676d);}(_0xeea4,0x1a8));var _0x4eea=function(_0x4b251d,_0x370bf4){_0x4b251d=_0x4b251d-0x0;var _0x32259e=_0xeea4[_0x4b251d];return _0x32259e;};'use strict';var _=require(_0x4eea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4eea('0x1'));var fs=require('fs');var Redis=require(_0x4eea('0x2'));var db=require(_0x4eea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eea('0x4'))('rpc');var config=require(_0x4eea('0x5'));var jayson=require(_0x4eea('0x6'));var client=jayson['client'][_0x4eea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18c2fc,_0x440b5e,_0x249767){return new BPromise(function(_0x2a6294,_0x364707){return client[_0x4eea('0x8')](_0x18c2fc,_0x249767)[_0x4eea('0x9')](function(_0x2288e4){logger['info'](_0x4eea('0xa'),_0x440b5e,_0x4eea('0xb'));logger[_0x4eea('0xc')](_0x4eea('0xd'),_0x440b5e,_0x4eea('0xb'),JSON['stringify'](_0x2288e4));if(_0x2288e4[_0x4eea('0xe')]){if(_0x2288e4['error']['code']===0x1f4){logger[_0x4eea('0xe')](_0x4eea('0xa'),_0x440b5e,_0x2288e4[_0x4eea('0xe')][_0x4eea('0xf')]);return _0x364707(_0x2288e4[_0x4eea('0xe')][_0x4eea('0xf')]);}logger[_0x4eea('0xe')]('Sound,\x20%s,\x20%s',_0x440b5e,_0x2288e4['error']['message']);return _0x2a6294(_0x2288e4[_0x4eea('0xe')][_0x4eea('0xf')]);}else{logger[_0x4eea('0x10')]('Sound,\x20%s,\x20%s',_0x440b5e,_0x4eea('0xb'));_0x2a6294(_0x2288e4[_0x4eea('0x11')][_0x4eea('0xf')]);}})[_0x4eea('0x12')](function(_0x14167){logger[_0x4eea('0xe')](_0x4eea('0xa'),_0x440b5e,_0x14167);_0x364707(_0x14167);});});}exports[_0x4eea('0x13')]=function(_0x4714fd){var _0x5240fd=this;return new Promise(function(_0x48c315,_0x475149){return db[_0x4eea('0x14')][_0x4eea('0x15')]({'raw':_0x4714fd[_0x4eea('0x16')]?_0x4714fd[_0x4eea('0x16')][_0x4eea('0x17')]===undefined?!![]:![]:!![],'where':_0x4714fd[_0x4eea('0x16')]?_0x4714fd[_0x4eea('0x16')][_0x4eea('0x18')]||null:null,'attributes':_0x4714fd[_0x4eea('0x16')]?_0x4714fd['options'][_0x4eea('0x19')]||null:null,'include':_0x4714fd['options']?_0x4714fd['options'][_0x4eea('0x1a')]?_[_0x4eea('0x1b')](_0x4714fd['options']['include'],function(_0x377418){return{'model':db[_0x377418[_0x4eea('0x1c')]],'as':_0x377418['as'],'attributes':_0x377418[_0x4eea('0x19')],'include':_0x377418['include']?_['map'](_0x377418['include'],function(_0x1506a1){return{'model':db[_0x1506a1[_0x4eea('0x1c')]],'as':_0x1506a1['as'],'attributes':_0x1506a1[_0x4eea('0x19')],'include':_0x1506a1[_0x4eea('0x1a')]?_[_0x4eea('0x1b')](_0x1506a1[_0x4eea('0x1a')],function(_0x5ab318){return{'model':db[_0x5ab318[_0x4eea('0x1c')]],'as':_0x5ab318['as'],'attributes':_0x5ab318['attributes']};}):[]};}):[]};}):[]:[]})[_0x4eea('0x9')](function(_0x1a63e6){logger[_0x4eea('0x10')](_0x4eea('0x13'),_0x4714fd);logger[_0x4eea('0xc')](_0x4eea('0x13'),_0x4714fd,JSON[_0x4eea('0x1d')](_0x1a63e6));_0x48c315(_0x1a63e6);})[_0x4eea('0x12')](function(_0x182b0b){logger['error'](_0x4eea('0x13'),_0x182b0b[_0x4eea('0xf')],_0x4714fd);_0x475149(_0x5240fd['error'](0x1f4,_0x182b0b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b28db28..9ef51a7 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x13f0ee,_0x403066){_0x13f0ee=_0x13f0ee-0x0;var _0x2ef710=_0x9ffd[_0x13f0ee];return _0x2ef710;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0x4fc2,0x111));var _0x24fc=function(_0x265b89,_0x3b9dde){_0x265b89=_0x265b89-0x0;var _0x3d972c=_0x4fc2[_0x265b89];return _0x3d972c;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 88d156a..4c50ba1 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 _0x9c42=['medium','ENUM','out','STRING','TEXT'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c42,0xb2));var _0x29c4=function(_0x2302a1,_0x4bc33d){_0x2302a1=_0x2302a1-0x0;var _0x413cae=_0x9c42[_0x2302a1];return _0x413cae;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x29c4('0x0')]},'body':{'type':Sequelize[_0x29c4('0x1')](_0x29c4('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x29c4('0x3')]('in','out'),'defaultValue':_0x29c4('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x29c4('0x0')]},'providerResponse':{'type':Sequelize[_0x29c4('0x1')]}}; \ No newline at end of file +var _0x5d75=['exports','STRING','TEXT','ENUM','out','sequelize'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x5d75,0x107));var _0x55d7=function(_0x16bb10,_0x570445){_0x16bb10=_0x16bb10-0x0;var _0x2b63eb=_0x5d75[_0x16bb10];return _0x2b63eb;};'use strict';var Sequelize=require(_0x55d7('0x0'));module[_0x55d7('0x1')]={'uniqueid':{'type':Sequelize[_0x55d7('0x2')]},'body':{'type':Sequelize[_0x55d7('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x55d7('0x4')]('in',_0x55d7('0x5')),'defaultValue':_0x55d7('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x55d7('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4ae11e6..ee54679 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 _0x2a19=['merge','includeAll','include','SquareMessage','rows','catch','show','options','find','create','body','update','params','destroy','eml-format','rimraf','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3a07d4,_0xa80b88){var _0x2c352=function(_0x27926b){while(--_0x27926b){_0x3a07d4['push'](_0x3a07d4['shift']());}};_0x2c352(++_0xa80b88);}(_0x2a19,0x199));var _0x92a1=function(_0x2682b9,_0x1bfbf4){_0x2682b9=_0x2682b9-0x0;var _0x1166b6=_0x2a19[_0x2682b9];return _0x1166b6;};'use strict';var emlformat=require(_0x92a1('0x0'));var rimraf=require(_0x92a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x92a1('0x2'));var moment=require(_0x92a1('0x3'));var BPromise=require(_0x92a1('0x4'));var Mustache=require(_0x92a1('0x5'));var util=require(_0x92a1('0x6'));var path=require(_0x92a1('0x7'));var sox=require('sox');var csv=require(_0x92a1('0x8'));var ejs=require(_0x92a1('0x9'));var fs=require('fs');var fs_extra=require(_0x92a1('0xa'));var _=require(_0x92a1('0xb'));var squel=require(_0x92a1('0xc'));var crypto=require(_0x92a1('0xd'));var jsforce=require(_0x92a1('0xe'));var deskjs=require(_0x92a1('0xf'));var toCsv=require(_0x92a1('0x8'));var querystring=require(_0x92a1('0x10'));var Papa=require(_0x92a1('0x11'));var Redis=require(_0x92a1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x92a1('0x13'));var as=require(_0x92a1('0x14'));var hardwareService=require(_0x92a1('0x15'));var logger=require(_0x92a1('0x16'))('api');var utils=require(_0x92a1('0x17'));var config=require(_0x92a1('0x18'));var licenseUtil=require(_0x92a1('0x19'));var db=require(_0x92a1('0x1a'))['db'];function respondWithStatusCode(_0x838615,_0x3454bd){_0x3454bd=_0x3454bd||0xcc;return function(_0x5cbf18){if(_0x5cbf18){return _0x838615[_0x92a1('0x1b')](_0x3454bd);}return _0x838615['status'](_0x3454bd)['end']();};}function respondWithResult(_0x517bb4,_0x316b6d){_0x316b6d=_0x316b6d||0xc8;return function(_0x38ed36){if(_0x38ed36){return _0x517bb4['status'](_0x316b6d)[_0x92a1('0x1c')](_0x38ed36);}};}function respondWithFilteredResult(_0x55161f,_0x4868d6){return function(_0x5567ac){if(_0x5567ac){var _0xf0957e=typeof _0x4868d6[_0x92a1('0x1d')]===_0x92a1('0x1e')&&typeof _0x4868d6[_0x92a1('0x1f')]===_0x92a1('0x1e');var _0x5b1b6a=_0x5567ac[_0x92a1('0x20')];var _0x3eca19=_0xf0957e?0x0:_0x4868d6[_0x92a1('0x1d')];var _0x570258=_0xf0957e?_0x5567ac[_0x92a1('0x20')]:_0x4868d6[_0x92a1('0x1d')]+_0x4868d6[_0x92a1('0x1f')];var _0x1e2025;if(_0x570258>=_0x5b1b6a){_0x570258=_0x5b1b6a;_0x1e2025=0xc8;}else{_0x1e2025=0xce;}_0x55161f[_0x92a1('0x21')](_0x1e2025);return _0x55161f['set'](_0x92a1('0x22'),_0x3eca19+'-'+_0x570258+'/'+_0x5b1b6a)[_0x92a1('0x1c')](_0x5567ac);}return null;};}function patchUpdates(_0x15df07){return function(_0x46be9f){try{jsonpatch[_0x92a1('0x23')](_0x46be9f,_0x15df07,!![]);}catch(_0x11531b){return BPromise[_0x92a1('0x24')](_0x11531b);}return _0x46be9f[_0x92a1('0x25')]();};}function saveUpdates(_0x33d55b,_0x412407){return function(_0x13790f){if(_0x13790f){return _0x13790f['update'](_0x33d55b)[_0x92a1('0x26')](function(_0x4f5b4e){return _0x4f5b4e;});}return null;};}function removeEntity(_0x48a0b6,_0x51de69){return function(_0x5392fc){if(_0x5392fc){return _0x5392fc['destroy']()['then'](function(){_0x48a0b6[_0x92a1('0x21')](0xcc)[_0x92a1('0x27')]();});}};}function handleEntityNotFound(_0x55f4d1,_0x18bf20){return function(_0x1e818a){if(!_0x1e818a){_0x55f4d1[_0x92a1('0x1b')](0x194);}return _0x1e818a;};}function handleError(_0x1c790b,_0x471f63){_0x471f63=_0x471f63||0x1f4;return function(_0x35fcf5){logger[_0x92a1('0x28')](_0x35fcf5[_0x92a1('0x29')]);if(_0x35fcf5[_0x92a1('0x2a')]){delete _0x35fcf5['name'];}_0x1c790b['status'](_0x471f63)[_0x92a1('0x2b')](_0x35fcf5);};}exports[_0x92a1('0x2c')]=function(_0x3d94ce,_0x59b02f){var _0x871d93={},_0xa54a22={},_0x4b6d45={'count':0x0,'rows':[]};var _0x2121d7=_['map'](db['SquareMessage'][_0x92a1('0x2d')],function(_0x2d7528){return{'name':_0x2d7528[_0x92a1('0x2e')],'type':_0x2d7528[_0x92a1('0x2f')][_0x92a1('0x30')]};});_0xa54a22[_0x92a1('0x31')]=_[_0x92a1('0x32')](_0x2121d7,_0x92a1('0x2a'));_0xa54a22['query']=_[_0x92a1('0x33')](_0x3d94ce[_0x92a1('0x34')]);_0xa54a22[_0x92a1('0x35')]=_[_0x92a1('0x36')](_0xa54a22[_0x92a1('0x31')],_0xa54a22[_0x92a1('0x34')]);_0x871d93[_0x92a1('0x37')]=_[_0x92a1('0x36')](_0xa54a22['model'],qs[_0x92a1('0x38')](_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x38')]));_0x871d93[_0x92a1('0x37')]=_0x871d93['attributes'][_0x92a1('0x39')]?_0x871d93[_0x92a1('0x37')]:_0xa54a22[_0x92a1('0x31')];if(!_0x3d94ce['query'][_0x92a1('0x3a')](_0x92a1('0x3b'))){_0x871d93[_0x92a1('0x1f')]=qs[_0x92a1('0x1f')](_0x3d94ce['query'][_0x92a1('0x1f')]);_0x871d93['offset']=qs[_0x92a1('0x1d')](_0x3d94ce[_0x92a1('0x34')]['offset']);}_0x871d93[_0x92a1('0x3c')]=qs[_0x92a1('0x3d')](_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x3d')]);_0x871d93[_0x92a1('0x3e')]=qs['filters'](_[_0x92a1('0x3f')](_0x3d94ce[_0x92a1('0x34')],_0xa54a22['filters']),_0x2121d7);if(_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x40')]){_0x871d93[_0x92a1('0x3e')]=_[_0x92a1('0x41')](_0x871d93[_0x92a1('0x3e')],{'$or':_[_0x92a1('0x32')](_0x2121d7,function(_0x691357){if(_0x691357[_0x92a1('0x2f')]!=='VIRTUAL'){var _0x3b2025={};_0x3b2025[_0x691357['name']]={'$like':'%'+_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x40')]+'%'};return _0x3b2025;}})});}_0x871d93=_[_0x92a1('0x41')]({},_0x871d93,_0x3d94ce['options']);var _0x348e77={'where':_0x871d93[_0x92a1('0x3e')]};return db['SquareMessage'][_0x92a1('0x20')](_0x348e77)[_0x92a1('0x26')](function(_0x274a30){_0x4b6d45['count']=_0x274a30;if(_0x3d94ce['query'][_0x92a1('0x42')]){_0x871d93[_0x92a1('0x43')]=[{'all':!![]}];}return db[_0x92a1('0x44')]['findAll'](_0x871d93);})[_0x92a1('0x26')](function(_0x1b5094){_0x4b6d45[_0x92a1('0x45')]=_0x1b5094;return _0x4b6d45;})[_0x92a1('0x26')](respondWithFilteredResult(_0x59b02f,_0x871d93))[_0x92a1('0x46')](handleError(_0x59b02f,null));};exports[_0x92a1('0x47')]=function(_0x18ed0e,_0x2359ca){var _0x3b8932={'raw':!![],'where':{'id':_0x18ed0e['params']['id']}},_0x3f1e48={};_0x3f1e48[_0x92a1('0x31')]=_[_0x92a1('0x33')](db[_0x92a1('0x44')]['rawAttributes']);_0x3f1e48[_0x92a1('0x34')]=_['keys'](_0x18ed0e[_0x92a1('0x34')]);_0x3f1e48[_0x92a1('0x35')]=_[_0x92a1('0x36')](_0x3f1e48[_0x92a1('0x31')],_0x3f1e48[_0x92a1('0x34')]);_0x3b8932['attributes']=_['intersection'](_0x3f1e48['model'],qs[_0x92a1('0x38')](_0x18ed0e[_0x92a1('0x34')][_0x92a1('0x38')]));_0x3b8932['attributes']=_0x3b8932['attributes'][_0x92a1('0x39')]?_0x3b8932[_0x92a1('0x37')]:_0x3f1e48[_0x92a1('0x31')];if(_0x18ed0e[_0x92a1('0x34')][_0x92a1('0x42')]){_0x3b8932[_0x92a1('0x43')]=[{'all':!![]}];}_0x3b8932=_[_0x92a1('0x41')]({},_0x3b8932,_0x18ed0e[_0x92a1('0x48')]);return db[_0x92a1('0x44')][_0x92a1('0x49')](_0x3b8932)[_0x92a1('0x26')](handleEntityNotFound(_0x2359ca,null))['then'](respondWithResult(_0x2359ca,null))['catch'](handleError(_0x2359ca,null));};exports[_0x92a1('0x4a')]=function(_0x154ca1,_0x3054fe){return db[_0x92a1('0x44')]['create'](_0x154ca1[_0x92a1('0x4b')],{})[_0x92a1('0x26')](respondWithResult(_0x3054fe,0xc9))[_0x92a1('0x46')](handleError(_0x3054fe,null));};exports[_0x92a1('0x4c')]=function(_0x2d9350,_0xd9d0ff){if(_0x2d9350[_0x92a1('0x4b')]['id']){delete _0x2d9350[_0x92a1('0x4b')]['id'];}return db[_0x92a1('0x44')][_0x92a1('0x49')]({'where':{'id':_0x2d9350[_0x92a1('0x4d')]['id']}})[_0x92a1('0x26')](handleEntityNotFound(_0xd9d0ff,null))[_0x92a1('0x26')](saveUpdates(_0x2d9350[_0x92a1('0x4b')],null))[_0x92a1('0x26')](respondWithResult(_0xd9d0ff,null))[_0x92a1('0x46')](handleError(_0xd9d0ff,null));};exports[_0x92a1('0x4e')]=function(_0x12c4c2,_0x63bba6){return db['SquareMessage'][_0x92a1('0x49')]({'where':{'id':_0x12c4c2[_0x92a1('0x4d')]['id']}})[_0x92a1('0x26')](handleEntityNotFound(_0x63bba6,null))[_0x92a1('0x26')](removeEntity(_0x63bba6,null))[_0x92a1('0x46')](handleError(_0x63bba6,null));}; \ No newline at end of file +var _0x5d5c=['rows','show','params','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d5c,0xee));var _0xc5d5=function(_0x3aa12a,_0x334658){_0x3aa12a=_0x3aa12a-0x0;var _0xca7ba8=_0x5d5c[_0x3aa12a];return _0xca7ba8;};'use strict';var emlformat=require(_0xc5d5('0x0'));var rimraf=require(_0xc5d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc5d5('0x2'));var moment=require(_0xc5d5('0x3'));var BPromise=require(_0xc5d5('0x4'));var Mustache=require(_0xc5d5('0x5'));var util=require(_0xc5d5('0x6'));var path=require(_0xc5d5('0x7'));var sox=require(_0xc5d5('0x8'));var csv=require(_0xc5d5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5d5('0xa'));var _=require(_0xc5d5('0xb'));var squel=require(_0xc5d5('0xc'));var crypto=require(_0xc5d5('0xd'));var jsforce=require(_0xc5d5('0xe'));var deskjs=require(_0xc5d5('0xf'));var toCsv=require(_0xc5d5('0x9'));var querystring=require(_0xc5d5('0x10'));var Papa=require(_0xc5d5('0x11'));var Redis=require(_0xc5d5('0x12'));var authService=require(_0xc5d5('0x13'));var qs=require(_0xc5d5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5d5('0x15'));var logger=require(_0xc5d5('0x16'))(_0xc5d5('0x17'));var utils=require(_0xc5d5('0x18'));var config=require(_0xc5d5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5d5('0x1a'))['db'];function respondWithStatusCode(_0x15c597,_0x589ced){_0x589ced=_0x589ced||0xcc;return function(_0x26e0dd){if(_0x26e0dd){return _0x15c597['sendStatus'](_0x589ced);}return _0x15c597[_0xc5d5('0x1b')](_0x589ced)[_0xc5d5('0x1c')]();};}function respondWithResult(_0x30f217,_0x1e6f14){_0x1e6f14=_0x1e6f14||0xc8;return function(_0x549683){if(_0x549683){return _0x30f217[_0xc5d5('0x1b')](_0x1e6f14)[_0xc5d5('0x1d')](_0x549683);}};}function respondWithFilteredResult(_0x422738,_0xd03235){return function(_0x1fb313){if(_0x1fb313){var _0x11dbef=typeof _0xd03235[_0xc5d5('0x1e')]===_0xc5d5('0x1f')&&typeof _0xd03235['limit']==='undefined';var _0x1c6462=_0x1fb313[_0xc5d5('0x20')];var _0x58b38c=_0x11dbef?0x0:_0xd03235[_0xc5d5('0x1e')];var _0x209ec7=_0x11dbef?_0x1fb313['count']:_0xd03235[_0xc5d5('0x1e')]+_0xd03235[_0xc5d5('0x21')];var _0x416569;if(_0x209ec7>=_0x1c6462){_0x209ec7=_0x1c6462;_0x416569=0xc8;}else{_0x416569=0xce;}_0x422738[_0xc5d5('0x1b')](_0x416569);return _0x422738[_0xc5d5('0x22')](_0xc5d5('0x23'),_0x58b38c+'-'+_0x209ec7+'/'+_0x1c6462)[_0xc5d5('0x1d')](_0x1fb313);}return null;};}function patchUpdates(_0x2f6ac3){return function(_0x441692){try{jsonpatch['apply'](_0x441692,_0x2f6ac3,!![]);}catch(_0x290368){return BPromise[_0xc5d5('0x24')](_0x290368);}return _0x441692[_0xc5d5('0x25')]();};}function saveUpdates(_0x91f786,_0x2e455e){return function(_0x23549d){if(_0x23549d){return _0x23549d[_0xc5d5('0x26')](_0x91f786)[_0xc5d5('0x27')](function(_0x4337c8){return _0x4337c8;});}return null;};}function removeEntity(_0x4b6664,_0x9c252e){return function(_0x2ea350){if(_0x2ea350){return _0x2ea350[_0xc5d5('0x28')]()['then'](function(){_0x4b6664[_0xc5d5('0x1b')](0xcc)[_0xc5d5('0x1c')]();});}};}function handleEntityNotFound(_0x2e4a5f,_0x338c1e){return function(_0x35b8f9){if(!_0x35b8f9){_0x2e4a5f['sendStatus'](0x194);}return _0x35b8f9;};}function handleError(_0x5f77c6,_0x778335){_0x778335=_0x778335||0x1f4;return function(_0x428f41){logger[_0xc5d5('0x29')](_0x428f41[_0xc5d5('0x2a')]);if(_0x428f41[_0xc5d5('0x2b')]){delete _0x428f41[_0xc5d5('0x2b')];}_0x5f77c6[_0xc5d5('0x1b')](_0x778335)[_0xc5d5('0x2c')](_0x428f41);};}exports[_0xc5d5('0x2d')]=function(_0x46d9a4,_0x1e26ba){var _0x29b201={},_0x3236c5={},_0x5b225f={'count':0x0,'rows':[]};var _0x1b56b0=_[_0xc5d5('0x2e')](db[_0xc5d5('0x2f')][_0xc5d5('0x30')],function(_0x1c05db){return{'name':_0x1c05db[_0xc5d5('0x31')],'type':_0x1c05db['type'][_0xc5d5('0x32')]};});_0x3236c5[_0xc5d5('0x33')]=_[_0xc5d5('0x2e')](_0x1b56b0,_0xc5d5('0x2b'));_0x3236c5['query']=_[_0xc5d5('0x34')](_0x46d9a4[_0xc5d5('0x35')]);_0x3236c5[_0xc5d5('0x36')]=_[_0xc5d5('0x37')](_0x3236c5[_0xc5d5('0x33')],_0x3236c5[_0xc5d5('0x35')]);_0x29b201[_0xc5d5('0x38')]=_['intersection'](_0x3236c5[_0xc5d5('0x33')],qs[_0xc5d5('0x39')](_0x46d9a4[_0xc5d5('0x35')][_0xc5d5('0x39')]));_0x29b201[_0xc5d5('0x38')]=_0x29b201[_0xc5d5('0x38')]['length']?_0x29b201[_0xc5d5('0x38')]:_0x3236c5[_0xc5d5('0x33')];if(!_0x46d9a4[_0xc5d5('0x35')][_0xc5d5('0x3a')](_0xc5d5('0x3b'))){_0x29b201[_0xc5d5('0x21')]=qs[_0xc5d5('0x21')](_0x46d9a4[_0xc5d5('0x35')]['limit']);_0x29b201[_0xc5d5('0x1e')]=qs[_0xc5d5('0x1e')](_0x46d9a4['query'][_0xc5d5('0x1e')]);}_0x29b201[_0xc5d5('0x3c')]=qs[_0xc5d5('0x3d')](_0x46d9a4[_0xc5d5('0x35')]['sort']);_0x29b201[_0xc5d5('0x3e')]=qs['filters'](_[_0xc5d5('0x3f')](_0x46d9a4[_0xc5d5('0x35')],_0x3236c5[_0xc5d5('0x36')]),_0x1b56b0);if(_0x46d9a4[_0xc5d5('0x35')][_0xc5d5('0x40')]){_0x29b201['where']=_['merge'](_0x29b201[_0xc5d5('0x3e')],{'$or':_[_0xc5d5('0x2e')](_0x1b56b0,function(_0x3f9457){if(_0x3f9457['type']!=='VIRTUAL'){var _0x4e2c37={};_0x4e2c37[_0x3f9457[_0xc5d5('0x2b')]]={'$like':'%'+_0x46d9a4[_0xc5d5('0x35')][_0xc5d5('0x40')]+'%'};return _0x4e2c37;}})});}_0x29b201=_[_0xc5d5('0x41')]({},_0x29b201,_0x46d9a4[_0xc5d5('0x42')]);var _0x526f37={'where':_0x29b201[_0xc5d5('0x3e')]};return db[_0xc5d5('0x2f')][_0xc5d5('0x20')](_0x526f37)['then'](function(_0x4fc420){_0x5b225f[_0xc5d5('0x20')]=_0x4fc420;if(_0x46d9a4['query'][_0xc5d5('0x43')]){_0x29b201[_0xc5d5('0x44')]=[{'all':!![]}];}return db[_0xc5d5('0x2f')][_0xc5d5('0x45')](_0x29b201);})[_0xc5d5('0x27')](function(_0x55c971){_0x5b225f[_0xc5d5('0x46')]=_0x55c971;return _0x5b225f;})['then'](respondWithFilteredResult(_0x1e26ba,_0x29b201))['catch'](handleError(_0x1e26ba,null));};exports[_0xc5d5('0x47')]=function(_0x287efe,_0x199a2f){var _0x182057={'raw':!![],'where':{'id':_0x287efe[_0xc5d5('0x48')]['id']}},_0x3319d2={};_0x3319d2[_0xc5d5('0x33')]=_[_0xc5d5('0x34')](db['SquareMessage'][_0xc5d5('0x30')]);_0x3319d2[_0xc5d5('0x35')]=_['keys'](_0x287efe[_0xc5d5('0x35')]);_0x3319d2[_0xc5d5('0x36')]=_['intersection'](_0x3319d2[_0xc5d5('0x33')],_0x3319d2[_0xc5d5('0x35')]);_0x182057[_0xc5d5('0x38')]=_[_0xc5d5('0x37')](_0x3319d2[_0xc5d5('0x33')],qs[_0xc5d5('0x39')](_0x287efe['query']['fields']));_0x182057[_0xc5d5('0x38')]=_0x182057[_0xc5d5('0x38')]['length']?_0x182057[_0xc5d5('0x38')]:_0x3319d2[_0xc5d5('0x33')];if(_0x287efe[_0xc5d5('0x35')][_0xc5d5('0x43')]){_0x182057['include']=[{'all':!![]}];}_0x182057=_[_0xc5d5('0x41')]({},_0x182057,_0x287efe[_0xc5d5('0x42')]);return db[_0xc5d5('0x2f')][_0xc5d5('0x49')](_0x182057)[_0xc5d5('0x27')](handleEntityNotFound(_0x199a2f,null))[_0xc5d5('0x27')](respondWithResult(_0x199a2f,null))[_0xc5d5('0x4a')](handleError(_0x199a2f,null));};exports['create']=function(_0x214e6f,_0x52d532){return db[_0xc5d5('0x2f')][_0xc5d5('0x4b')](_0x214e6f[_0xc5d5('0x4c')],{})['then'](respondWithResult(_0x52d532,0xc9))[_0xc5d5('0x4a')](handleError(_0x52d532,null));};exports[_0xc5d5('0x26')]=function(_0xb77f13,_0x57e747){if(_0xb77f13[_0xc5d5('0x4c')]['id']){delete _0xb77f13[_0xc5d5('0x4c')]['id'];}return db[_0xc5d5('0x2f')]['find']({'where':{'id':_0xb77f13[_0xc5d5('0x48')]['id']}})[_0xc5d5('0x27')](handleEntityNotFound(_0x57e747,null))[_0xc5d5('0x27')](saveUpdates(_0xb77f13[_0xc5d5('0x4c')],null))['then'](respondWithResult(_0x57e747,null))[_0xc5d5('0x4a')](handleError(_0x57e747,null));};exports[_0xc5d5('0x28')]=function(_0x4e40db,_0x384c3a){return db[_0xc5d5('0x2f')][_0xc5d5('0x49')]({'where':{'id':_0x4e40db[_0xc5d5('0x48')]['id']}})[_0xc5d5('0x27')](handleEntityNotFound(_0x384c3a,null))[_0xc5d5('0x27')](removeEntity(_0x384c3a,null))[_0xc5d5('0x4a')](handleError(_0x384c3a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b25de09..9749d81 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 _0x82c4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','util','api'];(function(_0x117d63,_0x56a1cd){var _0x35ecbe=function(_0x510287){while(--_0x510287){_0x117d63['push'](_0x117d63['shift']());}};_0x35ecbe(++_0x56a1cd);}(_0x82c4,0xb9));var _0x482c=function(_0x2b00fa,_0x4551db){_0x2b00fa=_0x2b00fa-0x0;var _0x3c5297=_0x82c4[_0x2b00fa];return _0x3c5297;};'use strict';var _=require('lodash');var util=require(_0x482c('0x0'));var logger=require('../../config/logger')(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rp=require(_0x482c('0x4'));var fs=require('fs');var path=require(_0x482c('0x5'));var rimraf=require(_0x482c('0x6'));var config=require(_0x482c('0x7'));var attributes=require('./squareMessage.attributes');module[_0x482c('0x8')]=function(_0x293024,_0x1f017c){return _0x293024[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc943=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api'];(function(_0x8307e3,_0x48eb78){var _0x492db9=function(_0x1284f7){while(--_0x1284f7){_0x8307e3['push'](_0x8307e3['shift']());}};_0x492db9(++_0x48eb78);}(_0xc943,0x173));var _0x3c94=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xc943[_0x34c063];return _0x2c63a3;};'use strict';var _=require(_0x3c94('0x0'));var util=require(_0x3c94('0x1'));var logger=require(_0x3c94('0x2'))(_0x3c94('0x3'));var moment=require(_0x3c94('0x4'));var BPromise=require(_0x3c94('0x5'));var rp=require(_0x3c94('0x6'));var fs=require('fs');var path=require(_0x3c94('0x7'));var rimraf=require(_0x3c94('0x8'));var config=require(_0x3c94('0x9'));var attributes=require(_0x3c94('0xa'));module[_0x3c94('0xb')]=function(_0x1146bb,_0x4fe61f){return _0x1146bb[_0x3c94('0xc')](_0x3c94('0xd'),attributes,{'tableName':_0x3c94('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 9bc1e32..53b874e 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 _0x4039=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw'];(function(_0x2594e0,_0x1ee198){var _0x1eadb9=function(_0x52a325){while(--_0x52a325){_0x2594e0['push'](_0x2594e0['shift']());}};_0x1eadb9(++_0x1ee198);}(_0x4039,0x15e));var _0x9403=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4039[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9403('0x0'));var util=require(_0x9403('0x1'));var moment=require(_0x9403('0x2'));var BPromise=require('bluebird');var rs=require(_0x9403('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9403('0x4'))['db'];var utils=require(_0x9403('0x5'));var logger=require(_0x9403('0x6'))(_0x9403('0x7'));var config=require('../../config/environment');var jayson=require(_0x9403('0x8'));var client=jayson[_0x9403('0x9')][_0x9403('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x338c2a,_0x3c7c29,_0x57d695){return new BPromise(function(_0x46db73,_0x572356){return client['request'](_0x338c2a,_0x57d695)[_0x9403('0xb')](function(_0x23f918){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3c7c29,'request\x20sent');logger[_0x9403('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3c7c29,'request\x20sent',JSON[_0x9403('0xd')](_0x23f918));if(_0x23f918[_0x9403('0xe')]){if(_0x23f918[_0x9403('0xe')][_0x9403('0xf')]===0x1f4){logger[_0x9403('0xe')](_0x9403('0x10'),_0x3c7c29,_0x23f918[_0x9403('0xe')][_0x9403('0x11')]);return _0x572356(_0x23f918['error'][_0x9403('0x11')]);}logger[_0x9403('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3c7c29,_0x23f918[_0x9403('0xe')][_0x9403('0x11')]);return _0x46db73(_0x23f918['error'][_0x9403('0x11')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x3c7c29,'request\x20sent');_0x46db73(_0x23f918[_0x9403('0x12')][_0x9403('0x11')]);}})[_0x9403('0x13')](function(_0x476ab1){logger[_0x9403('0xe')](_0x9403('0x10'),_0x3c7c29,_0x476ab1);_0x572356(_0x476ab1);});});}exports[_0x9403('0x14')]=function(_0xadb4ce){var _0x500148=this;return new Promise(function(_0x16eda2,_0x555a0d){return db[_0x9403('0x15')]['create'](_0xadb4ce[_0x9403('0x16')],{'raw':_0xadb4ce[_0x9403('0x17')]?_0xadb4ce['options'][_0x9403('0x18')]===undefined?!![]:![]:!![]})[_0x9403('0xb')](function(_0x698840){logger['info'](_0x9403('0x14'),_0xadb4ce);logger['debug'](_0x9403('0x14'),_0xadb4ce,JSON[_0x9403('0xd')](_0x698840));_0x16eda2(_0x698840);})[_0x9403('0x13')](function(_0x3df463){logger[_0x9403('0xe')](_0x9403('0x14'),_0x3df463[_0x9403('0x11')],_0xadb4ce);_0x555a0d(_0x500148[_0x9403('0xe')](0x1f4,_0x3df463['message']));});});}; \ No newline at end of file +var _0xccc4=['code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','moment','ioredis','../../config/logger','rpc','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xccc4,0xe9));var _0x4ccc=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xccc4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x4ccc('0x0'));var util=require(_0x4ccc('0x1'));var moment=require(_0x4ccc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ccc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ccc('0x4'))(_0x4ccc('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ccc('0x6')][_0x4ccc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bc688,_0x5362be,_0x13ab4f){return new BPromise(function(_0x5dce92,_0x136194){return client[_0x4ccc('0x8')](_0x3bc688,_0x13ab4f)[_0x4ccc('0x9')](function(_0x155c3b){logger[_0x4ccc('0xa')](_0x4ccc('0xb'),_0x5362be,_0x4ccc('0xc'));logger[_0x4ccc('0xd')](_0x4ccc('0xe'),_0x5362be,_0x4ccc('0xc'),JSON[_0x4ccc('0xf')](_0x155c3b));if(_0x155c3b[_0x4ccc('0x10')]){if(_0x155c3b[_0x4ccc('0x10')][_0x4ccc('0x11')]===0x1f4){logger[_0x4ccc('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5362be,_0x155c3b[_0x4ccc('0x10')][_0x4ccc('0x12')]);return _0x136194(_0x155c3b['error']['message']);}logger[_0x4ccc('0x10')](_0x4ccc('0xb'),_0x5362be,_0x155c3b['error'][_0x4ccc('0x12')]);return _0x5dce92(_0x155c3b[_0x4ccc('0x10')][_0x4ccc('0x12')]);}else{logger['info'](_0x4ccc('0xb'),_0x5362be,_0x4ccc('0xc'));_0x5dce92(_0x155c3b['result'][_0x4ccc('0x12')]);}})[_0x4ccc('0x13')](function(_0x43baca){logger[_0x4ccc('0x10')](_0x4ccc('0xb'),_0x5362be,_0x43baca);_0x136194(_0x43baca);});});}exports[_0x4ccc('0x14')]=function(_0x1f51cc){var _0x423718=this;return new Promise(function(_0x121863,_0x5784b5){return db[_0x4ccc('0x15')][_0x4ccc('0x16')](_0x1f51cc[_0x4ccc('0x17')],{'raw':_0x1f51cc[_0x4ccc('0x18')]?_0x1f51cc[_0x4ccc('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a8636){logger['info'](_0x4ccc('0x14'),_0x1f51cc);logger[_0x4ccc('0xd')]('CreateSquareMessage',_0x1f51cc,JSON[_0x4ccc('0xf')](_0x1a8636));_0x121863(_0x1a8636);})['catch'](function(_0x58890c){logger[_0x4ccc('0x10')](_0x4ccc('0x14'),_0x58890c[_0x4ccc('0x12')],_0x1f51cc);_0x5784b5(_0x423718['error'](0x1f4,_0x58890c[_0x4ccc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 053198b..30a2afc 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 _0x927f=['15s','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','show','/:id/test'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x927f,0xcc));var _0xf927=function(_0x35ea3c,_0x1c31ea){_0x35ea3c=_0x35ea3c-0x0;var _0x3c5cc3=_0x927f[_0x35ea3c];return _0x3c5cc3;};'use strict';var multer=require(_0xf927('0x0'));var util=require(_0xf927('0x1'));var path=require(_0xf927('0x2'));var timeout=require(_0xf927('0x3'));var express=require(_0xf927('0x4'));var router=express[_0xf927('0x5')]();var fs_extra=require(_0xf927('0x6'));var auth=require(_0xf927('0x7'));var interaction=require(_0xf927('0x8'));var config=require(_0xf927('0x9'));var controller=require(_0xf927('0xa'));router['get']('/',auth[_0xf927('0xb')](),controller[_0xf927('0xc')]);router['get'](_0xf927('0xd'),auth[_0xf927('0xb')](),controller[_0xf927('0xe')]);router['get'](_0xf927('0xf'),auth['isAuthenticated'](),timeout(_0xf927('0x10')),controller['test']);router[_0xf927('0x11')]('/',auth[_0xf927('0xb')](),controller[_0xf927('0x12')]);router['put'](_0xf927('0xd'),auth[_0xf927('0xb')](),controller[_0xf927('0x13')]);router[_0xf927('0x14')](_0xf927('0xd'),auth[_0xf927('0xb')](),controller['destroy']);module[_0xf927('0x15')]=router; \ No newline at end of file +var _0xae9e=['isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2e071a,_0x49802b){var _0x53789d=function(_0x4af3a4){while(--_0x4af3a4){_0x2e071a['push'](_0x2e071a['shift']());}};_0x53789d(++_0x49802b);}(_0xae9e,0xa3));var _0xeae9=function(_0x5bd95e,_0x2c6710){_0x5bd95e=_0x5bd95e-0x0;var _0x5b436=_0xae9e[_0x5bd95e];return _0x5b436;};'use strict';var multer=require(_0xeae9('0x0'));var util=require(_0xeae9('0x1'));var path=require(_0xeae9('0x2'));var timeout=require(_0xeae9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeae9('0x4'));var auth=require(_0xeae9('0x5'));var interaction=require(_0xeae9('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0xeae9('0x7')]('/',auth[_0xeae9('0x8')](),controller['index']);router[_0xeae9('0x7')](_0xeae9('0x9'),auth[_0xeae9('0x8')](),controller[_0xeae9('0xa')]);router['get'](_0xeae9('0xb'),auth[_0xeae9('0x8')](),timeout(_0xeae9('0xc')),controller[_0xeae9('0xd')]);router[_0xeae9('0xe')]('/',auth[_0xeae9('0x8')](),controller[_0xeae9('0xf')]);router[_0xeae9('0x10')](_0xeae9('0x9'),auth[_0xeae9('0x8')](),controller['update']);router[_0xeae9('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeae9('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 7bc1115..4c5c67e 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 _0xd620=['sequelize','STRING','name'];(function(_0x5eedd4,_0xd1e738){var _0x8cc7e1=function(_0x4fdf4e){while(--_0x4fdf4e){_0x5eedd4['push'](_0x5eedd4['shift']());}};_0x8cc7e1(++_0xd1e738);}(_0xd620,0x168));var _0x0d62=function(_0x544c3f,_0x4046e3){_0x544c3f=_0x544c3f-0x0;var _0x412258=_0xd620[_0x544c3f];return _0x412258;};'use strict';var Sequelize=require(_0x0d62('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d62('0x1')],'unique':_0x0d62('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0d62('0x1')]},'description':{'type':Sequelize[_0x0d62('0x1')]}}; \ No newline at end of file +var _0xd935=['sequelize','exports','STRING','name'];(function(_0x5454c4,_0x945165){var _0x48e5d7=function(_0x3b1e28){while(--_0x3b1e28){_0x5454c4['push'](_0x5454c4['shift']());}};_0x48e5d7(++_0x945165);}(_0xd935,0x108));var _0x5d93=function(_0x30ead7,_0x5d8dd5){_0x30ead7=_0x30ead7-0x0;var _0x38f88d=_0xd935[_0x30ead7];return _0x38f88d;};'use strict';var Sequelize=require(_0x5d93('0x0'));module[_0x5d93('0x1')]={'name':{'type':Sequelize[_0x5d93('0x2')],'unique':_0x5d93('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5d93('0x2')]},'description':{'type':Sequelize[_0x5d93('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 50d2607..7f64fa9 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 _0x1080=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ODBC','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','options','SquareOdbc','includeAll','include','findAll','rows','catch','length','find'];(function(_0x26f6ac,_0x4e0610){var _0x3386d3=function(_0x4370dd){while(--_0x4370dd){_0x26f6ac['push'](_0x26f6ac['shift']());}};_0x3386d3(++_0x4e0610);}(_0x1080,0x119));var _0x0108=function(_0x284d56,_0x5e983e){_0x284d56=_0x284d56-0x0;var _0x846868=_0x1080[_0x284d56];return _0x846868;};'use strict';var emlformat=require(_0x0108('0x0'));var rimraf=require(_0x0108('0x1'));var zipdir=require(_0x0108('0x2'));var jsonpatch=require(_0x0108('0x3'));var rp=require(_0x0108('0x4'));var moment=require('moment');var BPromise=require(_0x0108('0x5'));var Mustache=require(_0x0108('0x6'));var util=require(_0x0108('0x7'));var path=require(_0x0108('0x8'));var sox=require(_0x0108('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0108('0xa'));var _=require(_0x0108('0xb'));var squel=require(_0x0108('0xc'));var crypto=require('crypto');var jsforce=require(_0x0108('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0108('0xe'));var querystring=require(_0x0108('0xf'));var Papa=require('papaparse');var Redis=require(_0x0108('0x10'));var authService=require(_0x0108('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0108('0x12'));var logger=require(_0x0108('0x13'))(_0x0108('0x14'));var utils=require(_0x0108('0x15'));var config=require(_0x0108('0x16'));var licenseUtil=require(_0x0108('0x17'));var db=require(_0x0108('0x18'))['db'];function respondWithStatusCode(_0x378b66,_0x11fd76){_0x11fd76=_0x11fd76||0xcc;return function(_0x1c584c){if(_0x1c584c){return _0x378b66[_0x0108('0x19')](_0x11fd76);}return _0x378b66[_0x0108('0x1a')](_0x11fd76)[_0x0108('0x1b')]();};}function respondWithResult(_0x24a5bb,_0x4f2f35){_0x4f2f35=_0x4f2f35||0xc8;return function(_0x41e9b1){if(_0x41e9b1){return _0x24a5bb[_0x0108('0x1a')](_0x4f2f35)[_0x0108('0x1c')](_0x41e9b1);}};}function respondWithFilteredResult(_0x3ff74e,_0x5cdb4b){return function(_0xb970a5){if(_0xb970a5){var _0x283eaa=typeof _0x5cdb4b[_0x0108('0x1d')]===_0x0108('0x1e')&&typeof _0x5cdb4b['limit']===_0x0108('0x1e');var _0x4c49de=_0xb970a5[_0x0108('0x1f')];var _0x127213=_0x283eaa?0x0:_0x5cdb4b[_0x0108('0x1d')];var _0x17ee7f=_0x283eaa?_0xb970a5[_0x0108('0x1f')]:_0x5cdb4b[_0x0108('0x1d')]+_0x5cdb4b[_0x0108('0x20')];var _0x397831;if(_0x17ee7f>=_0x4c49de){_0x17ee7f=_0x4c49de;_0x397831=0xc8;}else{_0x397831=0xce;}_0x3ff74e[_0x0108('0x1a')](_0x397831);return _0x3ff74e['set'](_0x0108('0x21'),_0x127213+'-'+_0x17ee7f+'/'+_0x4c49de)[_0x0108('0x1c')](_0xb970a5);}return null;};}function patchUpdates(_0x54d1fb){return function(_0x4e7781){try{jsonpatch[_0x0108('0x22')](_0x4e7781,_0x54d1fb,!![]);}catch(_0x35c402){return BPromise[_0x0108('0x23')](_0x35c402);}return _0x4e7781[_0x0108('0x24')]();};}function saveUpdates(_0x211fbd,_0x1d0665){return function(_0x28bad4){if(_0x28bad4){return _0x28bad4['update'](_0x211fbd)['then'](function(_0x4c54b3){return _0x4c54b3;});}return null;};}function removeEntity(_0x3946a7,_0x46d748){return function(_0x141860){if(_0x141860){return _0x141860[_0x0108('0x25')]()[_0x0108('0x26')](function(){var _0x4587d6=_0x141860['get']({'plain':!![]});var _0x54140a='ODBC';return db[_0x0108('0x27')]['destroy']({'where':{'type':_0x54140a,'resourceId':_0x4587d6['id']}})[_0x0108('0x26')](function(){return _0x141860;});})[_0x0108('0x26')](function(){_0x3946a7[_0x0108('0x1a')](0xcc)[_0x0108('0x1b')]();});}};}function handleEntityNotFound(_0x3751d3,_0x4c897e){return function(_0x41f5c8){if(!_0x41f5c8){_0x3751d3[_0x0108('0x19')](0x194);}return _0x41f5c8;};}function handleError(_0x3576de,_0x5c2e48){_0x5c2e48=_0x5c2e48||0x1f4;return function(_0x56da57){logger['error'](_0x56da57[_0x0108('0x28')]);if(_0x56da57[_0x0108('0x29')]){delete _0x56da57[_0x0108('0x29')];}_0x3576de[_0x0108('0x1a')](_0x5c2e48)[_0x0108('0x2a')](_0x56da57);};}exports['index']=function(_0x35f264,_0x396cef){var _0x538503={},_0x112da0={},_0x2d5d3b={'count':0x0,'rows':[]};var _0x536df3=_[_0x0108('0x2b')](db['SquareOdbc'][_0x0108('0x2c')],function(_0x25c0fd){return{'name':_0x25c0fd[_0x0108('0x2d')],'type':_0x25c0fd['type'][_0x0108('0x2e')]};});_0x112da0['model']=_['map'](_0x536df3,_0x0108('0x29'));_0x112da0[_0x0108('0x2f')]=_[_0x0108('0x30')](_0x35f264[_0x0108('0x2f')]);_0x112da0[_0x0108('0x31')]=_[_0x0108('0x32')](_0x112da0[_0x0108('0x33')],_0x112da0[_0x0108('0x2f')]);_0x538503[_0x0108('0x34')]=_[_0x0108('0x32')](_0x112da0[_0x0108('0x33')],qs[_0x0108('0x35')](_0x35f264['query']['fields']));_0x538503[_0x0108('0x34')]=_0x538503['attributes']['length']?_0x538503['attributes']:_0x112da0['model'];if(!_0x35f264[_0x0108('0x2f')]['hasOwnProperty'](_0x0108('0x36'))){_0x538503['limit']=qs[_0x0108('0x20')](_0x35f264['query'][_0x0108('0x20')]);_0x538503[_0x0108('0x1d')]=qs[_0x0108('0x1d')](_0x35f264[_0x0108('0x2f')][_0x0108('0x1d')]);}_0x538503[_0x0108('0x37')]=qs[_0x0108('0x38')](_0x35f264['query']['sort']);_0x538503[_0x0108('0x39')]=qs[_0x0108('0x31')](_[_0x0108('0x3a')](_0x35f264['query'],_0x112da0[_0x0108('0x31')]),_0x536df3);if(_0x35f264[_0x0108('0x2f')][_0x0108('0x3b')]){_0x538503[_0x0108('0x39')]=_[_0x0108('0x3c')](_0x538503[_0x0108('0x39')],{'$or':_['map'](_0x536df3,function(_0x1ce713){if(_0x1ce713[_0x0108('0x3d')]!=='VIRTUAL'){var _0xbb64f9={};_0xbb64f9[_0x1ce713[_0x0108('0x29')]]={'$like':'%'+_0x35f264['query'][_0x0108('0x3b')]+'%'};return _0xbb64f9;}})});}_0x538503=_[_0x0108('0x3c')]({},_0x538503,_0x35f264[_0x0108('0x3e')]);var _0x5467bc={'where':_0x538503[_0x0108('0x39')]};return db[_0x0108('0x3f')]['count'](_0x5467bc)[_0x0108('0x26')](function(_0x1348f5){_0x2d5d3b[_0x0108('0x1f')]=_0x1348f5;if(_0x35f264[_0x0108('0x2f')][_0x0108('0x40')]){_0x538503[_0x0108('0x41')]=[{'all':!![]}];}return db[_0x0108('0x3f')][_0x0108('0x42')](_0x538503);})[_0x0108('0x26')](function(_0x4f9e4e){_0x2d5d3b[_0x0108('0x43')]=_0x4f9e4e;return _0x2d5d3b;})[_0x0108('0x26')](respondWithFilteredResult(_0x396cef,_0x538503))[_0x0108('0x44')](handleError(_0x396cef,null));};exports['show']=function(_0x30a0e6,_0x5df030){var _0x3ebdfd={'raw':!![],'where':{'id':_0x30a0e6['params']['id']}},_0xffc9cc={};_0xffc9cc[_0x0108('0x33')]=_[_0x0108('0x30')](db[_0x0108('0x3f')]['rawAttributes']);_0xffc9cc[_0x0108('0x2f')]=_[_0x0108('0x30')](_0x30a0e6[_0x0108('0x2f')]);_0xffc9cc['filters']=_['intersection'](_0xffc9cc['model'],_0xffc9cc[_0x0108('0x2f')]);_0x3ebdfd['attributes']=_[_0x0108('0x32')](_0xffc9cc[_0x0108('0x33')],qs[_0x0108('0x35')](_0x30a0e6[_0x0108('0x2f')][_0x0108('0x35')]));_0x3ebdfd[_0x0108('0x34')]=_0x3ebdfd[_0x0108('0x34')][_0x0108('0x45')]?_0x3ebdfd[_0x0108('0x34')]:_0xffc9cc[_0x0108('0x33')];if(_0x30a0e6[_0x0108('0x2f')]['includeAll']){_0x3ebdfd[_0x0108('0x41')]=[{'all':!![]}];}_0x3ebdfd=_[_0x0108('0x3c')]({},_0x3ebdfd,_0x30a0e6[_0x0108('0x3e')]);return db[_0x0108('0x3f')][_0x0108('0x46')](_0x3ebdfd)[_0x0108('0x26')](handleEntityNotFound(_0x5df030,null))[_0x0108('0x26')](respondWithResult(_0x5df030,null))[_0x0108('0x44')](handleError(_0x5df030,null));};exports['create']=function(_0x3cfecf,_0x4e0686){return db[_0x0108('0x3f')][_0x0108('0x47')](_0x3cfecf[_0x0108('0x48')],{})[_0x0108('0x26')](function(_0x1505fd){var _0xa9ced5=_0x3cfecf[_0x0108('0x49')]['get']({'plain':!![]});if(!_0xa9ced5)throw new Error(_0x0108('0x4a'));if(_0xa9ced5[_0x0108('0x4b')]===_0x0108('0x49')){var _0xc2bc13=_0x1505fd[_0x0108('0x4c')]({'plain':!![]});var _0x1e6dcd=_0x0108('0x4d');return db[_0x0108('0x4e')][_0x0108('0x46')]({'where':{'name':_0x1e6dcd,'userProfileId':_0xa9ced5[_0x0108('0x4f')]},'raw':!![]})[_0x0108('0x26')](function(_0x1e4e06){if(_0x1e4e06&&_0x1e4e06['autoAssociation']===0x0){return db[_0x0108('0x27')][_0x0108('0x47')]({'name':_0xc2bc13['name'],'resourceId':_0xc2bc13['id'],'type':_0x1e4e06[_0x0108('0x29')],'sectionId':_0x1e4e06['id']},{})[_0x0108('0x26')](function(){return _0x1505fd;});}else{return _0x1505fd;}})[_0x0108('0x44')](function(_0x2b4f90){logger[_0x0108('0x50')](_0x0108('0x51'),_0x2b4f90);throw _0x2b4f90;});}return _0x1505fd;})[_0x0108('0x26')](respondWithResult(_0x4e0686,0xc9))['catch'](handleError(_0x4e0686,null));};exports[_0x0108('0x52')]=function(_0x483848,_0x2579b6){if(_0x483848[_0x0108('0x48')]['id']){delete _0x483848[_0x0108('0x48')]['id'];}return db[_0x0108('0x3f')]['find']({'where':{'id':_0x483848[_0x0108('0x53')]['id']}})['then'](handleEntityNotFound(_0x2579b6,null))['then'](saveUpdates(_0x483848['body'],null))['then'](respondWithResult(_0x2579b6,null))[_0x0108('0x44')](handleError(_0x2579b6,null));};exports[_0x0108('0x25')]=function(_0x1365e4,_0x3245c3){return db[_0x0108('0x3f')]['find']({'where':{'id':_0x1365e4[_0x0108('0x53')]['id']}})[_0x0108('0x26')](handleEntityNotFound(_0x3245c3,null))[_0x0108('0x26')](removeEntity(_0x3245c3,null))[_0x0108('0x44')](handleError(_0x3245c3,null));};exports[_0x0108('0x54')]=function(_0x4b4233,_0x5eba31,_0x26b50a){var _0x102331;return db[_0x0108('0x3f')][_0x0108('0x46')]({'where':{'id':_0x4b4233[_0x0108('0x53')]['id']},'attributes':['id',_0x0108('0x55')]})[_0x0108('0x26')](handleEntityNotFound(_0x5eba31,null))['then'](function(_0x2aeb29){if(_0x2aeb29){var _0xa5a1c5=require(_0x0108('0x56'))();_0xa5a1c5[_0x0108('0x57')](_0x2aeb29[_0x0108('0x55')]);_0xa5a1c5['closeSync']();return _0x2aeb29;}})['then'](respondWithResult(_0x5eba31,null))['catch'](handleError(_0x5eba31,null));}; \ No newline at end of file +var _0xb522=['params','length','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x17a3d7,_0x271dc7){var _0x5c5309=function(_0x55ac47){while(--_0x55ac47){_0x17a3d7['push'](_0x17a3d7['shift']());}};_0x5c5309(++_0x271dc7);}(_0xb522,0xb6));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x2b52('0x0'));var rimraf=require(_0x2b52('0x1'));var zipdir=require(_0x2b52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b52('0x3'));var moment=require(_0x2b52('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b52('0x5'));var util=require(_0x2b52('0x6'));var path=require('path');var sox=require(_0x2b52('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b52('0x8'));var _=require('lodash');var squel=require(_0x2b52('0x9'));var crypto=require(_0x2b52('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2b52('0xb'));var toCsv=require(_0x2b52('0xc'));var querystring=require(_0x2b52('0xd'));var Papa=require('papaparse');var Redis=require(_0x2b52('0xe'));var authService=require(_0x2b52('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2b52('0x10'));var hardwareService=require(_0x2b52('0x11'));var logger=require(_0x2b52('0x12'))(_0x2b52('0x13'));var utils=require(_0x2b52('0x14'));var config=require(_0x2b52('0x15'));var licenseUtil=require(_0x2b52('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1be5c2,_0x498086){_0x498086=_0x498086||0xcc;return function(_0x1fbb0d){if(_0x1fbb0d){return _0x1be5c2[_0x2b52('0x17')](_0x498086);}return _0x1be5c2['status'](_0x498086)[_0x2b52('0x18')]();};}function respondWithResult(_0x402a11,_0x4e4aa4){_0x4e4aa4=_0x4e4aa4||0xc8;return function(_0x558430){if(_0x558430){return _0x402a11['status'](_0x4e4aa4)[_0x2b52('0x19')](_0x558430);}};}function respondWithFilteredResult(_0x5956e2,_0x14a052){return function(_0x98f13d){if(_0x98f13d){var _0x49b812=typeof _0x14a052[_0x2b52('0x1a')]===_0x2b52('0x1b')&&typeof _0x14a052[_0x2b52('0x1c')]===_0x2b52('0x1b');var _0x3bfd0f=_0x98f13d[_0x2b52('0x1d')];var _0x3ff627=_0x49b812?0x0:_0x14a052[_0x2b52('0x1a')];var _0x29535d=_0x49b812?_0x98f13d['count']:_0x14a052[_0x2b52('0x1a')]+_0x14a052[_0x2b52('0x1c')];var _0x26f493;if(_0x29535d>=_0x3bfd0f){_0x29535d=_0x3bfd0f;_0x26f493=0xc8;}else{_0x26f493=0xce;}_0x5956e2[_0x2b52('0x1e')](_0x26f493);return _0x5956e2[_0x2b52('0x1f')]('Content-Range',_0x3ff627+'-'+_0x29535d+'/'+_0x3bfd0f)['json'](_0x98f13d);}return null;};}function patchUpdates(_0xc7ca17){return function(_0x19b071){try{jsonpatch['apply'](_0x19b071,_0xc7ca17,!![]);}catch(_0x580167){return BPromise['reject'](_0x580167);}return _0x19b071[_0x2b52('0x20')]();};}function saveUpdates(_0x4e3c64,_0x259684){return function(_0x49ce64){if(_0x49ce64){return _0x49ce64[_0x2b52('0x21')](_0x4e3c64)['then'](function(_0x13ef57){return _0x13ef57;});}return null;};}function removeEntity(_0x13e650,_0x1268c5){return function(_0x348017){if(_0x348017){return _0x348017[_0x2b52('0x22')]()[_0x2b52('0x23')](function(){var _0x4920ed=_0x348017[_0x2b52('0x24')]({'plain':!![]});var _0x270d1f='ODBC';return db[_0x2b52('0x25')][_0x2b52('0x22')]({'where':{'type':_0x270d1f,'resourceId':_0x4920ed['id']}})[_0x2b52('0x23')](function(){return _0x348017;});})[_0x2b52('0x23')](function(){_0x13e650[_0x2b52('0x1e')](0xcc)[_0x2b52('0x18')]();});}};}function handleEntityNotFound(_0xc24e41,_0xf2910c){return function(_0x24f78e){if(!_0x24f78e){_0xc24e41[_0x2b52('0x17')](0x194);}return _0x24f78e;};}function handleError(_0x40e445,_0x457e4a){_0x457e4a=_0x457e4a||0x1f4;return function(_0x51cbf2){logger[_0x2b52('0x26')](_0x51cbf2[_0x2b52('0x27')]);if(_0x51cbf2['name']){delete _0x51cbf2[_0x2b52('0x28')];}_0x40e445[_0x2b52('0x1e')](_0x457e4a)['send'](_0x51cbf2);};}exports[_0x2b52('0x29')]=function(_0x3091c6,_0x275175){var _0x236aa3={},_0x1b1569={},_0x4eb6de={'count':0x0,'rows':[]};var _0x3c689b=_[_0x2b52('0x2a')](db[_0x2b52('0x2b')][_0x2b52('0x2c')],function(_0x2e377f){return{'name':_0x2e377f[_0x2b52('0x2d')],'type':_0x2e377f[_0x2b52('0x2e')][_0x2b52('0x2f')]};});_0x1b1569[_0x2b52('0x30')]=_[_0x2b52('0x2a')](_0x3c689b,'name');_0x1b1569[_0x2b52('0x31')]=_[_0x2b52('0x32')](_0x3091c6[_0x2b52('0x31')]);_0x1b1569['filters']=_[_0x2b52('0x33')](_0x1b1569[_0x2b52('0x30')],_0x1b1569[_0x2b52('0x31')]);_0x236aa3['attributes']=_[_0x2b52('0x33')](_0x1b1569[_0x2b52('0x30')],qs[_0x2b52('0x34')](_0x3091c6[_0x2b52('0x31')][_0x2b52('0x34')]));_0x236aa3['attributes']=_0x236aa3[_0x2b52('0x35')]['length']?_0x236aa3[_0x2b52('0x35')]:_0x1b1569['model'];if(!_0x3091c6[_0x2b52('0x31')][_0x2b52('0x36')](_0x2b52('0x37'))){_0x236aa3['limit']=qs[_0x2b52('0x1c')](_0x3091c6[_0x2b52('0x31')][_0x2b52('0x1c')]);_0x236aa3[_0x2b52('0x1a')]=qs[_0x2b52('0x1a')](_0x3091c6[_0x2b52('0x31')][_0x2b52('0x1a')]);}_0x236aa3[_0x2b52('0x38')]=qs[_0x2b52('0x39')](_0x3091c6[_0x2b52('0x31')][_0x2b52('0x39')]);_0x236aa3[_0x2b52('0x3a')]=qs[_0x2b52('0x3b')](_[_0x2b52('0x3c')](_0x3091c6['query'],_0x1b1569[_0x2b52('0x3b')]),_0x3c689b);if(_0x3091c6['query'][_0x2b52('0x3d')]){_0x236aa3[_0x2b52('0x3a')]=_[_0x2b52('0x3e')](_0x236aa3['where'],{'$or':_['map'](_0x3c689b,function(_0x12bfbf){if(_0x12bfbf['type']!==_0x2b52('0x3f')){var _0x36430f={};_0x36430f[_0x12bfbf[_0x2b52('0x28')]]={'$like':'%'+_0x3091c6[_0x2b52('0x31')][_0x2b52('0x3d')]+'%'};return _0x36430f;}})});}_0x236aa3=_[_0x2b52('0x3e')]({},_0x236aa3,_0x3091c6[_0x2b52('0x40')]);var _0x5e70d8={'where':_0x236aa3[_0x2b52('0x3a')]};return db[_0x2b52('0x2b')][_0x2b52('0x1d')](_0x5e70d8)[_0x2b52('0x23')](function(_0x3f2b41){_0x4eb6de[_0x2b52('0x1d')]=_0x3f2b41;if(_0x3091c6[_0x2b52('0x31')][_0x2b52('0x41')]){_0x236aa3[_0x2b52('0x42')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x236aa3);})[_0x2b52('0x23')](function(_0x32b867){_0x4eb6de[_0x2b52('0x43')]=_0x32b867;return _0x4eb6de;})[_0x2b52('0x23')](respondWithFilteredResult(_0x275175,_0x236aa3))[_0x2b52('0x44')](handleError(_0x275175,null));};exports[_0x2b52('0x45')]=function(_0x29ca75,_0x49558c){var _0xc9ba3d={'raw':!![],'where':{'id':_0x29ca75[_0x2b52('0x46')]['id']}},_0x2d752c={};_0x2d752c[_0x2b52('0x30')]=_['keys'](db[_0x2b52('0x2b')][_0x2b52('0x2c')]);_0x2d752c['query']=_[_0x2b52('0x32')](_0x29ca75[_0x2b52('0x31')]);_0x2d752c['filters']=_[_0x2b52('0x33')](_0x2d752c[_0x2b52('0x30')],_0x2d752c[_0x2b52('0x31')]);_0xc9ba3d[_0x2b52('0x35')]=_[_0x2b52('0x33')](_0x2d752c['model'],qs[_0x2b52('0x34')](_0x29ca75[_0x2b52('0x31')]['fields']));_0xc9ba3d[_0x2b52('0x35')]=_0xc9ba3d[_0x2b52('0x35')][_0x2b52('0x47')]?_0xc9ba3d[_0x2b52('0x35')]:_0x2d752c[_0x2b52('0x30')];if(_0x29ca75[_0x2b52('0x31')]['includeAll']){_0xc9ba3d[_0x2b52('0x42')]=[{'all':!![]}];}_0xc9ba3d=_[_0x2b52('0x3e')]({},_0xc9ba3d,_0x29ca75[_0x2b52('0x40')]);return db[_0x2b52('0x2b')][_0x2b52('0x48')](_0xc9ba3d)[_0x2b52('0x23')](handleEntityNotFound(_0x49558c,null))[_0x2b52('0x23')](respondWithResult(_0x49558c,null))[_0x2b52('0x44')](handleError(_0x49558c,null));};exports['create']=function(_0x59e2e4,_0x727845){return db[_0x2b52('0x2b')][_0x2b52('0x49')](_0x59e2e4[_0x2b52('0x4a')],{})['then'](function(_0x43cd8a){var _0x320d28=_0x59e2e4[_0x2b52('0x4b')][_0x2b52('0x24')]({'plain':!![]});if(!_0x320d28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320d28[_0x2b52('0x4c')]===_0x2b52('0x4b')){var _0x2d9c01=_0x43cd8a[_0x2b52('0x24')]({'plain':!![]});var _0x3b1b24='ODBC';return db[_0x2b52('0x4d')][_0x2b52('0x48')]({'where':{'name':_0x3b1b24,'userProfileId':_0x320d28[_0x2b52('0x4e')]},'raw':!![]})[_0x2b52('0x23')](function(_0x39b23b){if(_0x39b23b&&_0x39b23b['autoAssociation']===0x0){return db[_0x2b52('0x25')][_0x2b52('0x49')]({'name':_0x2d9c01[_0x2b52('0x28')],'resourceId':_0x2d9c01['id'],'type':_0x39b23b[_0x2b52('0x28')],'sectionId':_0x39b23b['id']},{})[_0x2b52('0x23')](function(){return _0x43cd8a;});}else{return _0x43cd8a;}})['catch'](function(_0x1e9210){logger[_0x2b52('0x26')](_0x2b52('0x4f'),_0x1e9210);throw _0x1e9210;});}return _0x43cd8a;})['then'](respondWithResult(_0x727845,0xc9))['catch'](handleError(_0x727845,null));};exports['update']=function(_0x47972b,_0x138094){if(_0x47972b[_0x2b52('0x4a')]['id']){delete _0x47972b['body']['id'];}return db[_0x2b52('0x2b')][_0x2b52('0x48')]({'where':{'id':_0x47972b[_0x2b52('0x46')]['id']}})[_0x2b52('0x23')](handleEntityNotFound(_0x138094,null))['then'](saveUpdates(_0x47972b[_0x2b52('0x4a')],null))[_0x2b52('0x23')](respondWithResult(_0x138094,null))[_0x2b52('0x44')](handleError(_0x138094,null));};exports[_0x2b52('0x22')]=function(_0x256bcb,_0x39b8a6){return db[_0x2b52('0x2b')]['find']({'where':{'id':_0x256bcb['params']['id']}})[_0x2b52('0x23')](handleEntityNotFound(_0x39b8a6,null))[_0x2b52('0x23')](removeEntity(_0x39b8a6,null))[_0x2b52('0x44')](handleError(_0x39b8a6,null));};exports[_0x2b52('0x50')]=function(_0x4ec69a,_0x5d325e,_0x37a7f8){var _0x9b62d5;return db['SquareOdbc'][_0x2b52('0x48')]({'where':{'id':_0x4ec69a[_0x2b52('0x46')]['id']},'attributes':['id','dsn']})[_0x2b52('0x23')](handleEntityNotFound(_0x5d325e,null))[_0x2b52('0x23')](function(_0x427f8b){if(_0x427f8b){var _0x3f0796=require('odbc')();_0x3f0796[_0x2b52('0x51')](_0x427f8b[_0x2b52('0x52')]);_0x3f0796[_0x2b52('0x53')]();return _0x427f8b;}})[_0x2b52('0x23')](respondWithResult(_0x5d325e,null))[_0x2b52('0x44')](handleError(_0x5d325e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7995955..ec738c4 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 _0x9137=['./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3136e3,_0x25c2a7){var _0x1de961=function(_0x3ae9b4){while(--_0x3ae9b4){_0x3136e3['push'](_0x3136e3['shift']());}};_0x1de961(++_0x25c2a7);}(_0x9137,0x79));var _0x7913=function(_0x5a164c,_0x44d73a){_0x5a164c=_0x5a164c-0x0;var _0x17a713=_0x9137[_0x5a164c];return _0x17a713;};'use strict';var _=require(_0x7913('0x0'));var util=require(_0x7913('0x1'));var logger=require(_0x7913('0x2'))(_0x7913('0x3'));var moment=require(_0x7913('0x4'));var BPromise=require(_0x7913('0x5'));var rp=require(_0x7913('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7913('0x7'));var config=require(_0x7913('0x8'));var attributes=require(_0x7913('0x9'));module[_0x7913('0xa')]=function(_0x16c693,_0x5df1a8){return _0x16c693['define'](_0x7913('0xb'),attributes,{'tableName':_0x7913('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a94=['square_odbc','lodash','util','../../config/logger','api','moment','path','../../config/environment','define','SquareOdbc'];(function(_0x43e2f3,_0x1ecf27){var _0x2bfd6f=function(_0x26c21c){while(--_0x26c21c){_0x43e2f3['push'](_0x43e2f3['shift']());}};_0x2bfd6f(++_0x1ecf27);}(_0x5a94,0x1cd));var _0x45a9=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x5a94[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x45a9('0x0'));var util=require(_0x45a9('0x1'));var logger=require(_0x45a9('0x2'))(_0x45a9('0x3'));var moment=require(_0x45a9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x45a9('0x5'));var rimraf=require('rimraf');var config=require(_0x45a9('0x6'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x3e8d57,_0x2b0270){return _0x3e8d57[_0x45a9('0x7')](_0x45a9('0x8'),attributes,{'tableName':_0x45a9('0x9'),'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 bb84e2a..6f2d3c3 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 _0x38ae=['request\x20sent','error','code','message','result','options','raw','attributes','include','map','model','ShowSquareOdbc','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','SquareOdbc,\x20%s,\x20%s','debug'];(function(_0x22799d,_0x46b4bf){var _0x152e2c=function(_0x35dc76){while(--_0x35dc76){_0x22799d['push'](_0x22799d['shift']());}};_0x152e2c(++_0x46b4bf);}(_0x38ae,0x9a));var _0xe38a=function(_0x2c4b73,_0x3e6ce9){_0x2c4b73=_0x2c4b73-0x0;var _0x4aa12b=_0x38ae[_0x2c4b73];return _0x4aa12b;};'use strict';var _=require(_0xe38a('0x0'));var util=require(_0xe38a('0x1'));var moment=require(_0xe38a('0x2'));var BPromise=require(_0xe38a('0x3'));var rs=require(_0xe38a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe38a('0x5'))['db'];var utils=require(_0xe38a('0x6'));var logger=require(_0xe38a('0x7'))('rpc');var config=require(_0xe38a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe38a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3677d5,_0x3c97dd,_0x3ec642){return new BPromise(function(_0x5c746e,_0x4cd29c){return client['request'](_0x3677d5,_0x3ec642)[_0xe38a('0xa')](function(_0x5eb539){logger[_0xe38a('0xb')](_0xe38a('0xc'),_0x3c97dd,'request\x20sent');logger[_0xe38a('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3c97dd,_0xe38a('0xe'),JSON['stringify'](_0x5eb539));if(_0x5eb539[_0xe38a('0xf')]){if(_0x5eb539[_0xe38a('0xf')][_0xe38a('0x10')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3c97dd,_0x5eb539[_0xe38a('0xf')]['message']);return _0x4cd29c(_0x5eb539[_0xe38a('0xf')][_0xe38a('0x11')]);}logger['error'](_0xe38a('0xc'),_0x3c97dd,_0x5eb539['error']['message']);return _0x5c746e(_0x5eb539[_0xe38a('0xf')][_0xe38a('0x11')]);}else{logger[_0xe38a('0xb')](_0xe38a('0xc'),_0x3c97dd,_0xe38a('0xe'));_0x5c746e(_0x5eb539[_0xe38a('0x12')]['message']);}})['catch'](function(_0x570744){logger['error'](_0xe38a('0xc'),_0x3c97dd,_0x570744);_0x4cd29c(_0x570744);});});}exports['ShowSquareOdbc']=function(_0x4eb297){var _0x4ecf73=this;return new Promise(function(_0x3ffc11,_0x265a4d){return db['SquareOdbc']['find']({'raw':_0x4eb297[_0xe38a('0x13')]?_0x4eb297['options'][_0xe38a('0x14')]===undefined?!![]:![]:!![],'where':_0x4eb297[_0xe38a('0x13')]?_0x4eb297[_0xe38a('0x13')]['where']||null:null,'attributes':_0x4eb297[_0xe38a('0x13')]?_0x4eb297[_0xe38a('0x13')][_0xe38a('0x15')]||null:null,'include':_0x4eb297[_0xe38a('0x13')]?_0x4eb297[_0xe38a('0x13')]['include']?_['map'](_0x4eb297[_0xe38a('0x13')][_0xe38a('0x16')],function(_0x27ff80){return{'model':db[_0x27ff80['model']],'as':_0x27ff80['as'],'attributes':_0x27ff80[_0xe38a('0x15')],'include':_0x27ff80[_0xe38a('0x16')]?_[_0xe38a('0x17')](_0x27ff80['include'],function(_0x1d7d65){return{'model':db[_0x1d7d65[_0xe38a('0x18')]],'as':_0x1d7d65['as'],'attributes':_0x1d7d65[_0xe38a('0x15')],'include':_0x1d7d65['include']?_['map'](_0x1d7d65['include'],function(_0x1fb4c0){return{'model':db[_0x1fb4c0[_0xe38a('0x18')]],'as':_0x1fb4c0['as'],'attributes':_0x1fb4c0[_0xe38a('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x285a41){logger[_0xe38a('0xb')]('ShowSquareOdbc',_0x4eb297);logger[_0xe38a('0xd')](_0xe38a('0x19'),_0x4eb297,JSON[_0xe38a('0x1a')](_0x285a41));_0x3ffc11(_0x285a41);})[_0xe38a('0x1b')](function(_0x3c701b){logger[_0xe38a('0xf')](_0xe38a('0x19'),_0x3c701b[_0xe38a('0x11')],_0x4eb297);_0x265a4d(_0x4ecf73[_0xe38a('0xf')](0x1f4,_0x3c701b[_0xe38a('0x11')]));});});}; \ No newline at end of file +var _0x64ac=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareOdbc','find','options','raw','where','attributes','map','model','include','lodash','util','bluebird','randomstring'];(function(_0x5826d2,_0x43ad97){var _0x316742=function(_0x1b097d){while(--_0x1b097d){_0x5826d2['push'](_0x5826d2['shift']());}};_0x316742(++_0x43ad97);}(_0x64ac,0xbc));var _0xc64a=function(_0x13da9b,_0x8410f6){_0x13da9b=_0x13da9b-0x0;var _0xe359b5=_0x64ac[_0x13da9b];return _0xe359b5;};'use strict';var _=require(_0xc64a('0x0'));var util=require(_0xc64a('0x1'));var moment=require('moment');var BPromise=require(_0xc64a('0x2'));var rs=require(_0xc64a('0x3'));var fs=require('fs');var Redis=require(_0xc64a('0x4'));var db=require(_0xc64a('0x5'))['db'];var utils=require(_0xc64a('0x6'));var logger=require(_0xc64a('0x7'))(_0xc64a('0x8'));var config=require('../../config/environment');var jayson=require(_0xc64a('0x9'));var client=jayson['client'][_0xc64a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x542c57,_0x1fa87c,_0x1bf43a){return new BPromise(function(_0x50db6d,_0x9b6140){return client[_0xc64a('0xb')](_0x542c57,_0x1bf43a)[_0xc64a('0xc')](function(_0x2b94a2){logger[_0xc64a('0xd')](_0xc64a('0xe'),_0x1fa87c,_0xc64a('0xf'));logger[_0xc64a('0x10')](_0xc64a('0x11'),_0x1fa87c,_0xc64a('0xf'),JSON[_0xc64a('0x12')](_0x2b94a2));if(_0x2b94a2['error']){if(_0x2b94a2[_0xc64a('0x13')][_0xc64a('0x14')]===0x1f4){logger[_0xc64a('0x13')](_0xc64a('0xe'),_0x1fa87c,_0x2b94a2[_0xc64a('0x13')][_0xc64a('0x15')]);return _0x9b6140(_0x2b94a2['error'][_0xc64a('0x15')]);}logger[_0xc64a('0x13')](_0xc64a('0xe'),_0x1fa87c,_0x2b94a2['error'][_0xc64a('0x15')]);return _0x50db6d(_0x2b94a2[_0xc64a('0x13')][_0xc64a('0x15')]);}else{logger['info'](_0xc64a('0xe'),_0x1fa87c,_0xc64a('0xf'));_0x50db6d(_0x2b94a2['result']['message']);}})[_0xc64a('0x16')](function(_0x4ec94b){logger[_0xc64a('0x13')](_0xc64a('0xe'),_0x1fa87c,_0x4ec94b);_0x9b6140(_0x4ec94b);});});}exports[_0xc64a('0x17')]=function(_0x56fad5){var _0x33f996=this;return new Promise(function(_0x307be2,_0xc52e01){return db['SquareOdbc'][_0xc64a('0x18')]({'raw':_0x56fad5['options']?_0x56fad5[_0xc64a('0x19')][_0xc64a('0x1a')]===undefined?!![]:![]:!![],'where':_0x56fad5[_0xc64a('0x19')]?_0x56fad5[_0xc64a('0x19')][_0xc64a('0x1b')]||null:null,'attributes':_0x56fad5['options']?_0x56fad5[_0xc64a('0x19')][_0xc64a('0x1c')]||null:null,'include':_0x56fad5[_0xc64a('0x19')]?_0x56fad5[_0xc64a('0x19')]['include']?_[_0xc64a('0x1d')](_0x56fad5[_0xc64a('0x19')]['include'],function(_0x11a228){return{'model':db[_0x11a228[_0xc64a('0x1e')]],'as':_0x11a228['as'],'attributes':_0x11a228[_0xc64a('0x1c')],'include':_0x11a228[_0xc64a('0x1f')]?_[_0xc64a('0x1d')](_0x11a228[_0xc64a('0x1f')],function(_0x4ed83c){return{'model':db[_0x4ed83c[_0xc64a('0x1e')]],'as':_0x4ed83c['as'],'attributes':_0x4ed83c[_0xc64a('0x1c')],'include':_0x4ed83c[_0xc64a('0x1f')]?_[_0xc64a('0x1d')](_0x4ed83c[_0xc64a('0x1f')],function(_0x42a79c){return{'model':db[_0x42a79c[_0xc64a('0x1e')]],'as':_0x42a79c['as'],'attributes':_0x42a79c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc64a('0xc')](function(_0x51971e){logger['info']('ShowSquareOdbc',_0x56fad5);logger[_0xc64a('0x10')]('ShowSquareOdbc',_0x56fad5,JSON[_0xc64a('0x12')](_0x51971e));_0x307be2(_0x51971e);})[_0xc64a('0x16')](function(_0x564078){logger['error']('ShowSquareOdbc',_0x564078[_0xc64a('0x15')],_0x56fad5);_0xc52e01(_0x33f996[_0xc64a('0x13')](0x1f4,_0x564078[_0xc64a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2c4f084..7108a98 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 _0x38bd=['isAuthenticated','index','/:id','show','create','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../config/environment','./squareProject.controller','get'];(function(_0x76ae2f,_0x3cc477){var _0x587f5c=function(_0x3b36ca){while(--_0x3b36ca){_0x76ae2f['push'](_0x76ae2f['shift']());}};_0x587f5c(++_0x3cc477);}(_0x38bd,0x152));var _0xd38b=function(_0x5c8841,_0x1d58ea){_0x5c8841=_0x5c8841-0x0;var _0x2789df=_0x38bd[_0x5c8841];return _0x2789df;};'use strict';var multer=require(_0xd38b('0x0'));var util=require(_0xd38b('0x1'));var path=require('path');var timeout=require(_0xd38b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd38b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd38b('0x4'));var controller=require(_0xd38b('0x5'));router[_0xd38b('0x6')]('/',auth[_0xd38b('0x7')](),controller[_0xd38b('0x8')]);router['get'](_0xd38b('0x9'),auth[_0xd38b('0x7')](),controller[_0xd38b('0xa')]);router['post']('/',auth[_0xd38b('0x7')](),controller[_0xd38b('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd38b('0xc')]);router[_0xd38b('0xd')](_0xd38b('0x9'),auth[_0xd38b('0x7')](),controller[_0xd38b('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc31f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','create','put','delete','exports','multer','util'];(function(_0x115ac0,_0x3dc028){var _0x1bc04e=function(_0x1eefef){while(--_0x1eefef){_0x115ac0['push'](_0x115ac0['shift']());}};_0x1bc04e(++_0x3dc028);}(_0xc31f,0x14e));var _0xfc31=function(_0x225944,_0xbaf68a){_0x225944=_0x225944-0x0;var _0x5393e1=_0xc31f[_0x225944];return _0x5393e1;};'use strict';var multer=require(_0xfc31('0x0'));var util=require(_0xfc31('0x1'));var path=require(_0xfc31('0x2'));var timeout=require(_0xfc31('0x3'));var express=require(_0xfc31('0x4'));var router=express[_0xfc31('0x5')]();var fs_extra=require(_0xfc31('0x6'));var auth=require(_0xfc31('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xfc31('0x8')]('/',auth[_0xfc31('0x9')](),controller['index']);router['get'](_0xfc31('0xa'),auth['isAuthenticated'](),controller[_0xfc31('0xb')]);router['post']('/',auth[_0xfc31('0x9')](),controller[_0xfc31('0xc')]);router[_0xfc31('0xd')](_0xfc31('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xfc31('0xe')](_0xfc31('0xa'),auth[_0xfc31('0x9')](),controller['destroy']);module[_0xfc31('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 222e3ff..1682a4a 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 _0x7455=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name'];(function(_0xf949f1,_0x3662ec){var _0x2f9e80=function(_0x34e112){while(--_0x34e112){_0xf949f1['push'](_0xf949f1['shift']());}};_0x2f9e80(++_0x3662ec);}(_0x7455,0x17d));var _0x5745=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7455[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x5745('0x0')]={'name':{'type':Sequelize[_0x5745('0x1')],'unique':_0x5745('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5745('0x1')]},'notes':{'type':Sequelize[_0x5745('0x3')]},'preproduction':{'type':Sequelize[_0x5745('0x4')](_0x5745('0x5')),'get':function(){if(this[_0x5745('0x6')]('preproduction')){return this[_0x5745('0x6')](_0x5745('0x7'))[_0x5745('0x8')](_0x5745('0x9'));}}},'production':{'type':Sequelize[_0x5745('0x4')]('long'),'get':function(){if(this[_0x5745('0x6')]('production')){return this['getDataValue'](_0x5745('0xa'))[_0x5745('0x8')](_0x5745('0x9'));}}},'savedAt':{'type':Sequelize[_0x5745('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6888=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','toString','utf8','getDataValue','production'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x6888,0x146));var _0x8688=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6888[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x8688('0x0'));module[_0x8688('0x1')]={'name':{'type':Sequelize[_0x8688('0x2')],'unique':_0x8688('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8688('0x2')]},'notes':{'type':Sequelize[_0x8688('0x4')]},'preproduction':{'type':Sequelize[_0x8688('0x5')](_0x8688('0x6')),'get':function(){if(this['getDataValue'](_0x8688('0x7'))){return this['getDataValue']('preproduction')[_0x8688('0x8')](_0x8688('0x9'));}}},'production':{'type':Sequelize[_0x8688('0x5')](_0x8688('0x6')),'get':function(){if(this[_0x8688('0xa')](_0x8688('0xb'))){return this['getDataValue'](_0x8688('0xb'))[_0x8688('0x8')](_0x8688('0x9'));}}},'savedAt':{'type':Sequelize[_0x8688('0xc')]},'publishedAt':{'type':Sequelize[_0x8688('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index fefce71..a8e6052 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 _0x16df=['find','UserProfileResource','stringify','production','destroy','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','then','get','SquareProjects','agi','end','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','include','catch','show','params','intersection','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x548b46,_0x18ed41){var _0x3b9d65=function(_0x26c020){while(--_0x26c020){_0x548b46['push'](_0x548b46['shift']());}};_0x3b9d65(++_0x18ed41);}(_0x16df,0x145));var _0xf16d=function(_0x2f48bb,_0x4d2f89){_0x2f48bb=_0x2f48bb-0x0;var _0x2a9a31=_0x16df[_0x2f48bb];return _0x2a9a31;};'use strict';var _=require(_0xf16d('0x0'));var Redis=require(_0xf16d('0x1'));var qs=require(_0xf16d('0x2'));var logger=require('../../config/logger')(_0xf16d('0x3'));var config=require(_0xf16d('0x4'));var db=require('../../mysqldb')['db'];config[_0xf16d('0x5')]=_[_0xf16d('0x6')](config['redis'],{'host':_0xf16d('0x7'),'port':0x18eb});var socket=require(_0xf16d('0x8'))(new Redis(config[_0xf16d('0x5')]));require(_0xf16d('0x9'))[_0xf16d('0xa')](socket);function respondWithResult(_0x3ec84f,_0xb9a68c){_0xb9a68c=_0xb9a68c||0xc8;return function(_0x4cb8ca){if(_0x4cb8ca){return _0x3ec84f[_0xf16d('0xb')](_0xb9a68c)[_0xf16d('0xc')](_0x4cb8ca);}};}function respondWithFilteredResult(_0x2b188c,_0x5a2fc0){return function(_0x33376f){if(_0x33376f){var _0x4d2073=typeof _0x5a2fc0[_0xf16d('0xd')]===_0xf16d('0xe')&&typeof _0x5a2fc0[_0xf16d('0xf')]===_0xf16d('0xe');var _0x1909eb=_0x33376f[_0xf16d('0x10')];var _0xf204e4=_0x4d2073?0x0:_0x5a2fc0[_0xf16d('0xd')];var _0xc33185=_0x4d2073?_0x33376f[_0xf16d('0x10')]:_0x5a2fc0[_0xf16d('0xd')]+_0x5a2fc0[_0xf16d('0xf')];var _0x14b6bf;if(_0xc33185>=_0x1909eb){_0xc33185=_0x1909eb;_0x14b6bf=0xc8;}else{_0x14b6bf=0xce;}_0x2b188c[_0xf16d('0xb')](_0x14b6bf);return _0x2b188c['set'](_0xf16d('0x11'),_0xf204e4+'-'+_0xc33185+'/'+_0x1909eb)[_0xf16d('0xc')](_0x33376f);}return null;};}function saveUpdates(_0x525178){return function(_0x43292e){if(_0x43292e){return _0x43292e[_0xf16d('0x12')](_0x525178)['then'](function(_0x573473){return _0x573473;});}return null;};}function removeEntity(_0x16e6a4){return function(_0x16ef43){if(_0x16ef43){return _0x16ef43['destroy']()[_0xf16d('0x13')](function(){var _0x1bc860=_0x16ef43[_0xf16d('0x14')]({'plain':!![]});var _0x4fb26e=_0xf16d('0x15');return db['UserProfileResource']['destroy']({'where':{'type':_0x4fb26e,'resourceId':_0x1bc860['id']}})['then'](function(){return _0x16ef43;});})[_0xf16d('0x13')](function(){var _0x3f7cbd=new Redis(config[_0xf16d('0x5')]);_0x3f7cbd['publish'](_0xf16d('0x16'),JSON['stringify']({'id':_0x16ef43['id'],'deleted':!![]}));})[_0xf16d('0x13')](function(){_0x16e6a4[_0xf16d('0xb')](0xcc)[_0xf16d('0x17')]();});}};}function handleEntityNotFound(_0x284ba7){return function(_0x1ab1ea){if(!_0x1ab1ea){_0x284ba7[_0xf16d('0x18')](0x194);}return _0x1ab1ea;};}function handleError(_0x3a827b,_0x1a4372){_0x1a4372=_0x1a4372||0x1f4;return function(_0x5e8c07){logger[_0xf16d('0x19')](_0x5e8c07[_0xf16d('0x1a')]);if(_0x5e8c07[_0xf16d('0x1b')]){delete _0x5e8c07[_0xf16d('0x1b')];}_0x3a827b[_0xf16d('0xb')](_0x1a4372)[_0xf16d('0x1c')](_0x5e8c07);};}exports['index']=function(_0x5abf2a,_0x54172a){var _0xe9fd58={},_0x3deee5={},_0xc43413={'count':0x0,'rows':[]};var _0x235769=_[_0xf16d('0x1d')](db['SquareProject'][_0xf16d('0x1e')],function(_0x27cee3){return{'name':_0x27cee3['fieldName'],'type':_0x27cee3[_0xf16d('0x1f')][_0xf16d('0x20')]};});_0x3deee5[_0xf16d('0x21')]=_[_0xf16d('0x1d')](_0x235769,'name');_0x3deee5[_0xf16d('0x22')]=_[_0xf16d('0x23')](_0x5abf2a['query']);_0x3deee5[_0xf16d('0x24')]=_['intersection'](_0x3deee5['model'],_0x3deee5[_0xf16d('0x22')]);_0xe9fd58[_0xf16d('0x25')]=_['intersection'](_0x3deee5[_0xf16d('0x21')],qs[_0xf16d('0x26')](_0x5abf2a['query'][_0xf16d('0x26')]));_0xe9fd58['attributes']=_0xe9fd58['attributes']['length']?_0xe9fd58[_0xf16d('0x25')]:_0x3deee5[_0xf16d('0x21')];if(!_0x5abf2a[_0xf16d('0x22')][_0xf16d('0x27')]('nolimit')){_0xe9fd58[_0xf16d('0xf')]=qs[_0xf16d('0xf')](_0x5abf2a[_0xf16d('0x22')][_0xf16d('0xf')]);_0xe9fd58[_0xf16d('0xd')]=qs['offset'](_0x5abf2a[_0xf16d('0x22')][_0xf16d('0xd')]);}_0xe9fd58['order']=qs[_0xf16d('0x28')](_0x5abf2a['query']['sort']);_0xe9fd58[_0xf16d('0x29')]=qs[_0xf16d('0x24')](_[_0xf16d('0x2a')](_0x5abf2a[_0xf16d('0x22')],_0x3deee5[_0xf16d('0x24')]),_0x235769);if(_0x5abf2a[_0xf16d('0x22')][_0xf16d('0x2b')]){_0xe9fd58[_0xf16d('0x29')]=_[_0xf16d('0x2c')](_0xe9fd58[_0xf16d('0x29')],{'$or':_['map'](_0x235769,function(_0x4946fc){if(_0x4946fc[_0xf16d('0x1f')]!==_0xf16d('0x2d')){var _0xfd9dc7={};_0xfd9dc7[_0x4946fc[_0xf16d('0x1b')]]={'$like':'%'+_0x5abf2a[_0xf16d('0x22')][_0xf16d('0x2b')]+'%'};return _0xfd9dc7;}})});}_0xe9fd58=_[_0xf16d('0x2c')]({},_0xe9fd58,_0x5abf2a[_0xf16d('0x2e')]);var _0xc1d13e={'where':_0xe9fd58[_0xf16d('0x29')]};return db[_0xf16d('0x2f')][_0xf16d('0x10')](_0xc1d13e)[_0xf16d('0x13')](function(_0xebe228){_0xc43413[_0xf16d('0x10')]=_0xebe228;if(_0x5abf2a[_0xf16d('0x22')][_0xf16d('0x30')]){_0xe9fd58[_0xf16d('0x31')]=[{'all':!![]}];}return db[_0xf16d('0x2f')]['findAll'](_0xe9fd58);})[_0xf16d('0x13')](function(_0x3d0d72){_0xc43413['rows']=_0x3d0d72;return _0xc43413;})[_0xf16d('0x13')](respondWithFilteredResult(_0x54172a,_0xe9fd58))[_0xf16d('0x32')](handleError(_0x54172a,null));};exports[_0xf16d('0x33')]=function(_0x3b148f,_0x538f78){var _0xad8b49={'raw':![],'where':{'id':_0x3b148f[_0xf16d('0x34')]['id']}},_0x2a0de8={};_0x2a0de8[_0xf16d('0x21')]=_[_0xf16d('0x23')](db['SquareProject'][_0xf16d('0x1e')]);_0x2a0de8['query']=_[_0xf16d('0x23')](_0x3b148f['query']);_0x2a0de8[_0xf16d('0x24')]=_[_0xf16d('0x35')](_0x2a0de8['model'],_0x2a0de8[_0xf16d('0x22')]);_0xad8b49[_0xf16d('0x25')]=_['intersection'](_0x2a0de8[_0xf16d('0x21')],qs[_0xf16d('0x26')](_0x3b148f[_0xf16d('0x22')][_0xf16d('0x26')]));_0xad8b49[_0xf16d('0x25')]=_0xad8b49['attributes'][_0xf16d('0x36')]?_0xad8b49[_0xf16d('0x25')]:_0x2a0de8[_0xf16d('0x21')];if(_0x3b148f[_0xf16d('0x22')][_0xf16d('0x30')]){_0xad8b49[_0xf16d('0x31')]=[{'all':!![]}];}_0xad8b49=_[_0xf16d('0x2c')]({},_0xad8b49,_0x3b148f[_0xf16d('0x2e')]);return db[_0xf16d('0x2f')]['find'](_0xad8b49)[_0xf16d('0x13')](handleEntityNotFound(_0x538f78,null))[_0xf16d('0x13')](respondWithResult(_0x538f78,null))[_0xf16d('0x32')](handleError(_0x538f78,null));};exports['create']=function(_0x1b08d3,_0x195521){return db[_0xf16d('0x2f')]['create'](_0x1b08d3[_0xf16d('0x37')],{})[_0xf16d('0x13')](function(_0x424c5a){var _0x577393=_0x1b08d3[_0xf16d('0x38')][_0xf16d('0x14')]({'plain':!![]});if(!_0x577393)throw new Error(_0xf16d('0x39'));if(_0x577393[_0xf16d('0x3a')]===_0xf16d('0x38')){var _0x127d01=_0x424c5a[_0xf16d('0x14')]({'plain':!![]});var _0x327dfd=_0xf16d('0x15');return db['UserProfileSection'][_0xf16d('0x3b')]({'where':{'name':_0x327dfd,'userProfileId':_0x577393['userProfileId']},'raw':!![]})[_0xf16d('0x13')](function(_0x436f7b){if(_0x436f7b&&_0x436f7b['autoAssociation']===0x0){return db[_0xf16d('0x3c')]['create']({'name':_0x127d01['name'],'resourceId':_0x127d01['id'],'type':_0x436f7b['name'],'sectionId':_0x436f7b['id']},{})['then'](function(){return _0x424c5a;});}else{return _0x424c5a;}})[_0xf16d('0x32')](function(_0x2999a8){logger[_0xf16d('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2999a8);throw _0x2999a8;});}return _0x424c5a;})[_0xf16d('0x13')](respondWithResult(_0x195521,0xc9))[_0xf16d('0x32')](handleError(_0x195521,null));};exports[_0xf16d('0x12')]=function(_0x380d6d,_0x5752b9){if(_0x380d6d[_0xf16d('0x37')]['id']){delete _0x380d6d[_0xf16d('0x37')]['id'];}return db[_0xf16d('0x2f')][_0xf16d('0x3b')]({'where':{'id':_0x380d6d['params']['id']}})['then'](handleEntityNotFound(_0x5752b9,null))[_0xf16d('0x13')](saveUpdates(_0x380d6d['body'],null))['then'](function(_0x4511a1){if(!_0x4511a1)return;var _0x476aee=_0x4511a1[_0xf16d('0x14')]({'plain':!![]});return _0x476aee;})[_0xf16d('0x13')](function(_0x10a2be){var _0x23bdf0=new Redis(config[_0xf16d('0x5')]);_0x23bdf0['publish'](_0xf16d('0x16'),JSON[_0xf16d('0x3d')](_[_0xf16d('0x2a')](_0x10a2be,['id',_0xf16d('0x1b'),_0xf16d('0x3e')])));return _0x10a2be;})[_0xf16d('0x13')](respondWithResult(_0x5752b9,null))[_0xf16d('0x32')](handleError(_0x5752b9,null));};exports[_0xf16d('0x3f')]=function(_0x32aa5b,_0x599e8c){return db[_0xf16d('0x2f')]['find']({'where':{'id':_0x32aa5b[_0xf16d('0x34')]['id']}})[_0xf16d('0x13')](handleEntityNotFound(_0x599e8c,null))['then'](removeEntity(_0x599e8c,null))[_0xf16d('0x32')](handleError(_0x599e8c,null));}; \ No newline at end of file +var _0xe7be=['production','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','count','Content-Range','update','destroy','then','get','publish','agi','stringify','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','merge','filter','includeAll','findAll','rows','catch','show','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','pick'];(function(_0x353c9b,_0x963d4b){var _0x37b8f4=function(_0x56d4ee){while(--_0x56d4ee){_0x353c9b['push'](_0x353c9b['shift']());}};_0x37b8f4(++_0x963d4b);}(_0xe7be,0x1cf));var _0xee7b=function(_0x5f0d94,_0x5618be){_0x5f0d94=_0x5f0d94-0x0;var _0x4fe50d=_0xe7be[_0x5f0d94];return _0x4fe50d;};'use strict';var _=require('lodash');var Redis=require(_0xee7b('0x0'));var qs=require(_0xee7b('0x1'));var logger=require(_0xee7b('0x2'))('api');var config=require('../../config/environment');var db=require(_0xee7b('0x3'))['db'];config[_0xee7b('0x4')]=_[_0xee7b('0x5')](config[_0xee7b('0x4')],{'host':_0xee7b('0x6'),'port':0x18eb});var socket=require(_0xee7b('0x7'))(new Redis(config['redis']));require(_0xee7b('0x8'))['register'](socket);function respondWithResult(_0x140240,_0x14e274){_0x14e274=_0x14e274||0xc8;return function(_0x338032){if(_0x338032){return _0x140240[_0xee7b('0x9')](_0x14e274)[_0xee7b('0xa')](_0x338032);}};}function respondWithFilteredResult(_0xbb8bdf,_0xb2f785){return function(_0x1355c1){if(_0x1355c1){var _0x489dd7=typeof _0xb2f785[_0xee7b('0xb')]===_0xee7b('0xc')&&typeof _0xb2f785['limit']===_0xee7b('0xc');var _0x515f5e=_0x1355c1[_0xee7b('0xd')];var _0x4fbb0f=_0x489dd7?0x0:_0xb2f785['offset'];var _0x36b60d=_0x489dd7?_0x1355c1[_0xee7b('0xd')]:_0xb2f785['offset']+_0xb2f785['limit'];var _0x3852d8;if(_0x36b60d>=_0x515f5e){_0x36b60d=_0x515f5e;_0x3852d8=0xc8;}else{_0x3852d8=0xce;}_0xbb8bdf[_0xee7b('0x9')](_0x3852d8);return _0xbb8bdf['set'](_0xee7b('0xe'),_0x4fbb0f+'-'+_0x36b60d+'/'+_0x515f5e)['json'](_0x1355c1);}return null;};}function saveUpdates(_0x1ba541){return function(_0x3e2b90){if(_0x3e2b90){return _0x3e2b90[_0xee7b('0xf')](_0x1ba541)['then'](function(_0x960e0){return _0x960e0;});}return null;};}function removeEntity(_0x1f8582){return function(_0x12243f){if(_0x12243f){return _0x12243f[_0xee7b('0x10')]()[_0xee7b('0x11')](function(){var _0x4da326=_0x12243f[_0xee7b('0x12')]({'plain':!![]});var _0x5b982c='SquareProjects';return db['UserProfileResource'][_0xee7b('0x10')]({'where':{'type':_0x5b982c,'resourceId':_0x4da326['id']}})['then'](function(){return _0x12243f;});})[_0xee7b('0x11')](function(){var _0x4dbf0f=new Redis(config[_0xee7b('0x4')]);_0x4dbf0f[_0xee7b('0x13')](_0xee7b('0x14'),JSON[_0xee7b('0x15')]({'id':_0x12243f['id'],'deleted':!![]}));})[_0xee7b('0x11')](function(){_0x1f8582[_0xee7b('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa15f){return function(_0x16d543){if(!_0x16d543){_0x4aa15f[_0xee7b('0x16')](0x194);}return _0x16d543;};}function handleError(_0x538b67,_0x5a20f3){_0x5a20f3=_0x5a20f3||0x1f4;return function(_0x14a62b){logger[_0xee7b('0x17')](_0x14a62b[_0xee7b('0x18')]);if(_0x14a62b['name']){delete _0x14a62b[_0xee7b('0x19')];}_0x538b67[_0xee7b('0x9')](_0x5a20f3)[_0xee7b('0x1a')](_0x14a62b);};}exports[_0xee7b('0x1b')]=function(_0x571e68,_0x23c84d){var _0x1a46c8={},_0x23babf={},_0x28a27e={'count':0x0,'rows':[]};var _0x8b6b69=_[_0xee7b('0x1c')](db[_0xee7b('0x1d')][_0xee7b('0x1e')],function(_0x19af4e){return{'name':_0x19af4e[_0xee7b('0x1f')],'type':_0x19af4e[_0xee7b('0x20')]['key']};});_0x23babf[_0xee7b('0x21')]=_[_0xee7b('0x1c')](_0x8b6b69,_0xee7b('0x19'));_0x23babf[_0xee7b('0x22')]=_['keys'](_0x571e68[_0xee7b('0x22')]);_0x23babf[_0xee7b('0x23')]=_[_0xee7b('0x24')](_0x23babf[_0xee7b('0x21')],_0x23babf[_0xee7b('0x22')]);_0x1a46c8[_0xee7b('0x25')]=_['intersection'](_0x23babf[_0xee7b('0x21')],qs[_0xee7b('0x26')](_0x571e68['query']['fields']));_0x1a46c8['attributes']=_0x1a46c8[_0xee7b('0x25')]['length']?_0x1a46c8['attributes']:_0x23babf['model'];if(!_0x571e68[_0xee7b('0x22')][_0xee7b('0x27')](_0xee7b('0x28'))){_0x1a46c8[_0xee7b('0x29')]=qs[_0xee7b('0x29')](_0x571e68[_0xee7b('0x22')][_0xee7b('0x29')]);_0x1a46c8[_0xee7b('0xb')]=qs['offset'](_0x571e68[_0xee7b('0x22')][_0xee7b('0xb')]);}_0x1a46c8['order']=qs[_0xee7b('0x2a')](_0x571e68[_0xee7b('0x22')]['sort']);_0x1a46c8[_0xee7b('0x2b')]=qs[_0xee7b('0x23')](_['pick'](_0x571e68['query'],_0x23babf[_0xee7b('0x23')]),_0x8b6b69);if(_0x571e68[_0xee7b('0x22')]['filter']){_0x1a46c8[_0xee7b('0x2b')]=_[_0xee7b('0x2c')](_0x1a46c8['where'],{'$or':_[_0xee7b('0x1c')](_0x8b6b69,function(_0x1b6dbc){if(_0x1b6dbc[_0xee7b('0x20')]!=='VIRTUAL'){var _0x4262af={};_0x4262af[_0x1b6dbc[_0xee7b('0x19')]]={'$like':'%'+_0x571e68['query'][_0xee7b('0x2d')]+'%'};return _0x4262af;}})});}_0x1a46c8=_[_0xee7b('0x2c')]({},_0x1a46c8,_0x571e68['options']);var _0x29dd4b={'where':_0x1a46c8[_0xee7b('0x2b')]};return db['SquareProject'][_0xee7b('0xd')](_0x29dd4b)[_0xee7b('0x11')](function(_0x56fc07){_0x28a27e[_0xee7b('0xd')]=_0x56fc07;if(_0x571e68['query'][_0xee7b('0x2e')]){_0x1a46c8['include']=[{'all':!![]}];}return db['SquareProject'][_0xee7b('0x2f')](_0x1a46c8);})[_0xee7b('0x11')](function(_0x49b9b2){_0x28a27e[_0xee7b('0x30')]=_0x49b9b2;return _0x28a27e;})[_0xee7b('0x11')](respondWithFilteredResult(_0x23c84d,_0x1a46c8))[_0xee7b('0x31')](handleError(_0x23c84d,null));};exports[_0xee7b('0x32')]=function(_0x28a37b,_0x5ea799){var _0x3432a1={'raw':![],'where':{'id':_0x28a37b['params']['id']}},_0x3c8178={};_0x3c8178[_0xee7b('0x21')]=_[_0xee7b('0x33')](db['SquareProject'][_0xee7b('0x1e')]);_0x3c8178['query']=_[_0xee7b('0x33')](_0x28a37b[_0xee7b('0x22')]);_0x3c8178[_0xee7b('0x23')]=_[_0xee7b('0x24')](_0x3c8178['model'],_0x3c8178[_0xee7b('0x22')]);_0x3432a1['attributes']=_['intersection'](_0x3c8178[_0xee7b('0x21')],qs[_0xee7b('0x26')](_0x28a37b[_0xee7b('0x22')]['fields']));_0x3432a1[_0xee7b('0x25')]=_0x3432a1['attributes'][_0xee7b('0x34')]?_0x3432a1[_0xee7b('0x25')]:_0x3c8178['model'];if(_0x28a37b['query'][_0xee7b('0x2e')]){_0x3432a1['include']=[{'all':!![]}];}_0x3432a1=_[_0xee7b('0x2c')]({},_0x3432a1,_0x28a37b[_0xee7b('0x35')]);return db[_0xee7b('0x1d')]['find'](_0x3432a1)[_0xee7b('0x11')](handleEntityNotFound(_0x5ea799,null))[_0xee7b('0x11')](respondWithResult(_0x5ea799,null))[_0xee7b('0x31')](handleError(_0x5ea799,null));};exports['create']=function(_0x317313,_0x3eeb85){return db[_0xee7b('0x1d')][_0xee7b('0x36')](_0x317313[_0xee7b('0x37')],{})[_0xee7b('0x11')](function(_0xefc6f9){var _0x362bbf=_0x317313[_0xee7b('0x38')]['get']({'plain':!![]});if(!_0x362bbf)throw new Error(_0xee7b('0x39'));if(_0x362bbf['role']==='user'){var _0x6f7239=_0xefc6f9[_0xee7b('0x12')]({'plain':!![]});var _0x370136='SquareProjects';return db['UserProfileSection'][_0xee7b('0x3a')]({'where':{'name':_0x370136,'userProfileId':_0x362bbf[_0xee7b('0x3b')]},'raw':!![]})[_0xee7b('0x11')](function(_0x5446f1){if(_0x5446f1&&_0x5446f1[_0xee7b('0x3c')]===0x0){return db[_0xee7b('0x3d')][_0xee7b('0x36')]({'name':_0x6f7239['name'],'resourceId':_0x6f7239['id'],'type':_0x5446f1[_0xee7b('0x19')],'sectionId':_0x5446f1['id']},{})['then'](function(){return _0xefc6f9;});}else{return _0xefc6f9;}})[_0xee7b('0x31')](function(_0x25870e){logger[_0xee7b('0x17')](_0xee7b('0x3e'),_0x25870e);throw _0x25870e;});}return _0xefc6f9;})[_0xee7b('0x11')](respondWithResult(_0x3eeb85,0xc9))[_0xee7b('0x31')](handleError(_0x3eeb85,null));};exports[_0xee7b('0xf')]=function(_0x3c61b3,_0x391980){if(_0x3c61b3[_0xee7b('0x37')]['id']){delete _0x3c61b3[_0xee7b('0x37')]['id'];}return db['SquareProject'][_0xee7b('0x3a')]({'where':{'id':_0x3c61b3[_0xee7b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x391980,null))[_0xee7b('0x11')](saveUpdates(_0x3c61b3['body'],null))[_0xee7b('0x11')](function(_0x28a957){if(!_0x28a957)return;var _0x314047=_0x28a957[_0xee7b('0x12')]({'plain':!![]});return _0x314047;})[_0xee7b('0x11')](function(_0x416ffe){var _0x378b11=new Redis(config[_0xee7b('0x4')]);_0x378b11[_0xee7b('0x13')](_0xee7b('0x14'),JSON['stringify'](_[_0xee7b('0x40')](_0x416ffe,['id',_0xee7b('0x19'),_0xee7b('0x41')])));return _0x416ffe;})[_0xee7b('0x11')](respondWithResult(_0x391980,null))[_0xee7b('0x31')](handleError(_0x391980,null));};exports[_0xee7b('0x10')]=function(_0x2ad726,_0x7d5d02){return db['SquareProject'][_0xee7b('0x3a')]({'where':{'id':_0x2ad726[_0xee7b('0x3f')]['id']}})[_0xee7b('0x11')](handleEntityNotFound(_0x7d5d02,null))[_0xee7b('0x11')](removeEntity(_0x7d5d02,null))[_0xee7b('0x31')](handleError(_0x7d5d02,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f85f542..4bd4190 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 _0x9c7b=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','SquareProject'];(function(_0x5e07f6,_0x26f599){var _0x220f5c=function(_0xa8d5fd){while(--_0xa8d5fd){_0x5e07f6['push'](_0x5e07f6['shift']());}};_0x220f5c(++_0x26f599);}(_0x9c7b,0x114));var _0xb9c7=function(_0x18695a,_0x23222b){_0x18695a=_0x18695a-0x0;var _0x336fea=_0x9c7b[_0x18695a];return _0x336fea;};'use strict';var EventEmitter=require(_0xb9c7('0x0'));var SquareProject=require(_0xb9c7('0x1'))['db'][_0xb9c7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb9c7('0x3')](0x0);var events={'afterCreate':_0xb9c7('0x4'),'afterUpdate':_0xb9c7('0x5'),'afterDestroy':_0xb9c7('0x6')};function emitEvent(_0xdc46a8){return function(_0x48da22,_0x325b0e,_0x3ffc55){SquareProjectEvents['emit'](_0xdc46a8+':'+_0x48da22['id'],_0x48da22);SquareProjectEvents[_0xb9c7('0x7')](_0xdc46a8,_0x48da22);_0x3ffc55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb9c7('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x2b12=['events','../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty','exports'];(function(_0x201c3a,_0x191c6c){var _0x315db2=function(_0x3a774e){while(--_0x3a774e){_0x201c3a['push'](_0x201c3a['shift']());}};_0x315db2(++_0x191c6c);}(_0x2b12,0xa8));var _0x22b1=function(_0x29ef6f,_0x15cf37){_0x29ef6f=_0x29ef6f-0x0;var _0x18eb5f=_0x2b12[_0x29ef6f];return _0x18eb5f;};'use strict';var EventEmitter=require(_0x22b1('0x0'));var SquareProject=require(_0x22b1('0x1'))['db'][_0x22b1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x22b1('0x3'),'afterDestroy':_0x22b1('0x4')};function emitEvent(_0x47f3a9){return function(_0x51ccfd,_0x43a0bd,_0x5409a4){SquareProjectEvents['emit'](_0x47f3a9+':'+_0x51ccfd['id'],_0x51ccfd);SquareProjectEvents[_0x22b1('0x5')](_0x47f3a9,_0x51ccfd);_0x5409a4(null);};}for(var e in events){if(events[_0x22b1('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x22b1('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 ee4be95..73ed37c 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 _0x09c6=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x09c6,0x7f));var _0x609c=function(_0x3b4062,_0x56d905){_0x3b4062=_0x3b4062-0x0;var _0x122330=_0x09c6[_0x3b4062];return _0x122330;};'use strict';var _=require('lodash');var util=require(_0x609c('0x0'));var logger=require(_0x609c('0x1'))('api');var moment=require(_0x609c('0x2'));var BPromise=require(_0x609c('0x3'));var rp=require(_0x609c('0x4'));var fs=require('fs');var path=require(_0x609c('0x5'));var rimraf=require('rimraf');var config=require(_0x609c('0x6'));var attributes=require(_0x609c('0x7'));module[_0x609c('0x8')]=function(_0x4bd95d,_0x350064){return _0x4bd95d[_0x609c('0x9')](_0x609c('0xa'),attributes,{'tableName':_0x609c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x581640,_0x1699b7,_0x56f80d){if(_0x581640[_0x609c('0xc')](_0x609c('0xd'))){_0x581640[_0x609c('0xe')]=moment()[_0x609c('0xf')](_0x609c('0x10'));}if(_0x581640[_0x609c('0xc')](_0x609c('0x11'))){_0x581640[_0x609c('0x12')]=moment()['format'](_0x609c('0x10'));}_0x56f80d(null,_0x581640);}}});}; \ No newline at end of file +var _0xe6e2=['rimraf','../../config/environment','./squareProject.attributes','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','util','moment','bluebird','request-promise','path'];(function(_0x3f66a9,_0x30d183){var _0x4a9876=function(_0x16879c){while(--_0x16879c){_0x3f66a9['push'](_0x3f66a9['shift']());}};_0x4a9876(++_0x30d183);}(_0xe6e2,0x8b));var _0x2e6e=function(_0x3fe76b,_0x3c6c63){_0x3fe76b=_0x3fe76b-0x0;var _0x15df75=_0xe6e2[_0x3fe76b];return _0x15df75;};'use strict';var _=require('lodash');var util=require(_0x2e6e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2e6e('0x1'));var BPromise=require(_0x2e6e('0x2'));var rp=require(_0x2e6e('0x3'));var fs=require('fs');var path=require(_0x2e6e('0x4'));var rimraf=require(_0x2e6e('0x5'));var config=require(_0x2e6e('0x6'));var attributes=require(_0x2e6e('0x7'));module['exports']=function(_0x4c4f27,_0x769cae){return _0x4c4f27['define'](_0x2e6e('0x8'),attributes,{'tableName':_0x2e6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a59ba,_0x45b391,_0x4dabc0){if(_0x1a59ba['changed'](_0x2e6e('0xa'))){_0x1a59ba[_0x2e6e('0xb')]=moment()[_0x2e6e('0xc')](_0x2e6e('0xd'));}if(_0x1a59ba[_0x2e6e('0xe')](_0x2e6e('0xf'))){_0x1a59ba['publishedAt']=moment()[_0x2e6e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4dabc0(null,_0x1a59ba);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index bb89940..b58e54c 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 _0x2e50=['findAll','options','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','register','GetSquareProjects','SquareProject'];(function(_0xc11214,_0x2fec4f){var _0xe318e8=function(_0x4603ff){while(--_0x4603ff){_0xc11214['push'](_0xc11214['shift']());}};_0xe318e8(++_0x2fec4f);}(_0x2e50,0x170));var _0x02e5=function(_0x3b5e02,_0x535469){_0x3b5e02=_0x3b5e02-0x0;var _0x59464c=_0x2e50[_0x3b5e02];return _0x59464c;};'use strict';var _=require(_0x02e5('0x0'));var Redis=require('ioredis');var db=require(_0x02e5('0x1'))['db'];var logger=require(_0x02e5('0x2'))(_0x02e5('0x3'));var config=require(_0x02e5('0x4'));config[_0x02e5('0x5')]=_['defaults'](config[_0x02e5('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x02e5('0x6'))(new Redis(config[_0x02e5('0x5')]));require('./squareProject.socket')[_0x02e5('0x7')](socket);exports[_0x02e5('0x8')]=function(_0x10e7e4){var _0x4dcaba=this;return new Promise(function(_0x440e9f,_0x136910){return db[_0x02e5('0x9')][_0x02e5('0xa')]({'raw':_0x10e7e4[_0x02e5('0xb')]?_0x10e7e4['options']['raw']===undefined?!![]:![]:!![],'where':_0x10e7e4[_0x02e5('0xb')]?_0x10e7e4[_0x02e5('0xb')][_0x02e5('0xc')]||null:null,'attributes':_0x10e7e4[_0x02e5('0xb')]?_0x10e7e4[_0x02e5('0xb')][_0x02e5('0xd')]||null:null,'limit':_0x10e7e4[_0x02e5('0xb')]?_0x10e7e4[_0x02e5('0xb')][_0x02e5('0xe')]||null:null,'include':_0x10e7e4[_0x02e5('0xb')]?_0x10e7e4[_0x02e5('0xb')]['include']?_['map'](_0x10e7e4[_0x02e5('0xb')][_0x02e5('0xf')],function(_0xd421cc){return{'model':db[_0xd421cc[_0x02e5('0x10')]],'as':_0xd421cc['as'],'attributes':_0xd421cc['attributes'],'include':_0xd421cc[_0x02e5('0xf')]?_['map'](_0xd421cc[_0x02e5('0xf')],function(_0x277e3e){return{'model':db[_0x277e3e[_0x02e5('0x10')]],'as':_0x277e3e['as'],'attributes':_0x277e3e['attributes'],'include':_0x277e3e['include']?_[_0x02e5('0x11')](_0x277e3e[_0x02e5('0xf')],function(_0x502845){return{'model':db[_0x502845[_0x02e5('0x10')]],'as':_0x502845['as'],'attributes':_0x502845[_0x02e5('0xd')]};}):[]};}):[]};}):[]:[]})[_0x02e5('0x12')](function(_0x12e71d){logger[_0x02e5('0x13')](_0x02e5('0x8'),_0x10e7e4);logger[_0x02e5('0x14')]('GetSquareProjects',_0x10e7e4,JSON[_0x02e5('0x15')](_0x12e71d));_0x440e9f(_0x12e71d);})[_0x02e5('0x16')](function(_0x4c598f){logger[_0x02e5('0x17')](_0x02e5('0x8'),_0x4c598f['message'],_0x10e7e4);_0x136910(_0x4dcaba[_0x02e5('0x17')](0x1f4,_0x4c598f[_0x02e5('0x18')]));});});};exports[_0x02e5('0x19')]=function(_0x4aa0cf){var _0x5c659a=this;return new Promise(function(_0x52b9be,_0x3b2074){return db[_0x02e5('0x9')][_0x02e5('0x1a')]({'raw':_0x4aa0cf[_0x02e5('0xb')]?_0x4aa0cf[_0x02e5('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x4aa0cf[_0x02e5('0xb')]?_0x4aa0cf[_0x02e5('0xb')]['where']||null:null,'attributes':_0x4aa0cf[_0x02e5('0xb')]?_0x4aa0cf[_0x02e5('0xb')][_0x02e5('0xd')]||null:null,'include':_0x4aa0cf['options']?_0x4aa0cf[_0x02e5('0xb')]['include']?_[_0x02e5('0x11')](_0x4aa0cf[_0x02e5('0xb')][_0x02e5('0xf')],function(_0x534b58){return{'model':db[_0x534b58[_0x02e5('0x10')]],'as':_0x534b58['as'],'attributes':_0x534b58[_0x02e5('0xd')],'include':_0x534b58[_0x02e5('0xf')]?_[_0x02e5('0x11')](_0x534b58[_0x02e5('0xf')],function(_0x1bde99){return{'model':db[_0x1bde99[_0x02e5('0x10')]],'as':_0x1bde99['as'],'attributes':_0x1bde99[_0x02e5('0xd')],'include':_0x1bde99['include']?_[_0x02e5('0x11')](_0x1bde99[_0x02e5('0xf')],function(_0x45cc46){return{'model':db[_0x45cc46[_0x02e5('0x10')]],'as':_0x45cc46['as'],'attributes':_0x45cc46[_0x02e5('0xd')]};}):[]};}):[]};}):[]:[]})[_0x02e5('0x12')](function(_0x506b2e){logger[_0x02e5('0x13')](_0x02e5('0x19'),_0x4aa0cf);logger[_0x02e5('0x14')](_0x02e5('0x19'),_0x4aa0cf,JSON[_0x02e5('0x15')](_0x506b2e));_0x52b9be(_0x506b2e);})[_0x02e5('0x16')](function(_0x476082){logger[_0x02e5('0x17')](_0x02e5('0x19'),_0x476082[_0x02e5('0x18')],_0x4aa0cf);_0x3b2074(_0x5c659a[_0x02e5('0x17')](0x1f4,_0x476082['message']));});});}; \ No newline at end of file +var _0x6af4=['message','ShowSquareProject','find','stringify','ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','include','map','model','attributes','then','info','debug','catch','error'];(function(_0x4096a5,_0xc11b3a){var _0x4a0117=function(_0x3ea803){while(--_0x3ea803){_0x4096a5['push'](_0x4096a5['shift']());}};_0x4a0117(++_0xc11b3a);}(_0x6af4,0x17e));var _0x46af=function(_0x5091c1,_0x26ad59){_0x5091c1=_0x5091c1-0x0;var _0x5b7dd1=_0x6af4[_0x5091c1];return _0x5b7dd1;};'use strict';var _=require('lodash');var Redis=require(_0x46af('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x46af('0x1'));var config=require(_0x46af('0x2'));config[_0x46af('0x3')]=_[_0x46af('0x4')](config['redis'],{'host':_0x46af('0x5'),'port':0x18eb});var socket=require(_0x46af('0x6'))(new Redis(config[_0x46af('0x3')]));require(_0x46af('0x7'))[_0x46af('0x8')](socket);exports[_0x46af('0x9')]=function(_0x459f77){var _0x564469=this;return new Promise(function(_0x589e6b,_0x1f58d9){return db[_0x46af('0xa')]['findAll']({'raw':_0x459f77['options']?_0x459f77[_0x46af('0xb')][_0x46af('0xc')]===undefined?!![]:![]:!![],'where':_0x459f77[_0x46af('0xb')]?_0x459f77[_0x46af('0xb')][_0x46af('0xd')]||null:null,'attributes':_0x459f77[_0x46af('0xb')]?_0x459f77[_0x46af('0xb')]['attributes']||null:null,'limit':_0x459f77[_0x46af('0xb')]?_0x459f77[_0x46af('0xb')]['limit']||null:null,'include':_0x459f77[_0x46af('0xb')]?_0x459f77[_0x46af('0xb')][_0x46af('0xe')]?_[_0x46af('0xf')](_0x459f77['options'][_0x46af('0xe')],function(_0x2cb8e1){return{'model':db[_0x2cb8e1[_0x46af('0x10')]],'as':_0x2cb8e1['as'],'attributes':_0x2cb8e1['attributes'],'include':_0x2cb8e1[_0x46af('0xe')]?_[_0x46af('0xf')](_0x2cb8e1[_0x46af('0xe')],function(_0x2c8e89){return{'model':db[_0x2c8e89[_0x46af('0x10')]],'as':_0x2c8e89['as'],'attributes':_0x2c8e89[_0x46af('0x11')],'include':_0x2c8e89[_0x46af('0xe')]?_[_0x46af('0xf')](_0x2c8e89[_0x46af('0xe')],function(_0xaaa1cf){return{'model':db[_0xaaa1cf[_0x46af('0x10')]],'as':_0xaaa1cf['as'],'attributes':_0xaaa1cf[_0x46af('0x11')]};}):[]};}):[]};}):[]:[]})[_0x46af('0x12')](function(_0x36003d){logger[_0x46af('0x13')](_0x46af('0x9'),_0x459f77);logger[_0x46af('0x14')](_0x46af('0x9'),_0x459f77,JSON['stringify'](_0x36003d));_0x589e6b(_0x36003d);})[_0x46af('0x15')](function(_0x431818){logger[_0x46af('0x16')](_0x46af('0x9'),_0x431818[_0x46af('0x17')],_0x459f77);_0x1f58d9(_0x564469['error'](0x1f4,_0x431818[_0x46af('0x17')]));});});};exports[_0x46af('0x18')]=function(_0x2e7e2d){var _0x35c7aa=this;return new Promise(function(_0x2a67c3,_0x52b97e){return db[_0x46af('0xa')][_0x46af('0x19')]({'raw':_0x2e7e2d[_0x46af('0xb')]?_0x2e7e2d[_0x46af('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7e2d[_0x46af('0xb')]?_0x2e7e2d[_0x46af('0xb')][_0x46af('0xd')]||null:null,'attributes':_0x2e7e2d[_0x46af('0xb')]?_0x2e7e2d[_0x46af('0xb')]['attributes']||null:null,'include':_0x2e7e2d['options']?_0x2e7e2d[_0x46af('0xb')][_0x46af('0xe')]?_[_0x46af('0xf')](_0x2e7e2d['options'][_0x46af('0xe')],function(_0x2ed831){return{'model':db[_0x2ed831[_0x46af('0x10')]],'as':_0x2ed831['as'],'attributes':_0x2ed831[_0x46af('0x11')],'include':_0x2ed831[_0x46af('0xe')]?_[_0x46af('0xf')](_0x2ed831[_0x46af('0xe')],function(_0xe8ac5f){return{'model':db[_0xe8ac5f[_0x46af('0x10')]],'as':_0xe8ac5f['as'],'attributes':_0xe8ac5f[_0x46af('0x11')],'include':_0xe8ac5f[_0x46af('0xe')]?_['map'](_0xe8ac5f[_0x46af('0xe')],function(_0x10bce4){return{'model':db[_0x10bce4[_0x46af('0x10')]],'as':_0x10bce4['as'],'attributes':_0x10bce4[_0x46af('0x11')]};}):[]};}):[]};}):[]:[]})[_0x46af('0x12')](function(_0x31b172){logger[_0x46af('0x13')](_0x46af('0x18'),_0x2e7e2d);logger[_0x46af('0x14')]('ShowSquareProject',_0x2e7e2d,JSON[_0x46af('0x1a')](_0x31b172));_0x2a67c3(_0x31b172);})[_0x46af('0x15')](function(_0x56a7eb){logger['error'](_0x46af('0x18'),_0x56a7eb[_0x46af('0x17')],_0x2e7e2d);_0x52b97e(_0x35c7aa[_0x46af('0x16')](0x1f4,_0x56a7eb[_0x46af('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0dc646d..7d3ea93 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 _0x587a=['squareProject:','./squareProject.events','removeListener','register','length'];(function(_0x4131da,_0x124783){var _0x583242=function(_0x4c899f){while(--_0x4c899f){_0x4131da['push'](_0x4131da['shift']());}};_0x583242(++_0x124783);}(_0x587a,0x150));var _0xa587=function(_0x61b4c7,_0xf6eafa){_0x61b4c7=_0x61b4c7-0x0;var _0x5f57a1=_0x587a[_0x61b4c7];return _0x5f57a1;};'use strict';var SquareProjectEvents=require(_0xa587('0x0'));var events=['save','remove','update'];function createListener(_0x25405c,_0x596f95){return function(_0x1ed317){_0x596f95['emit'](_0x25405c,_0x1ed317);};}function removeListener(_0x299fcb,_0x49c822){return function(){SquareProjectEvents[_0xa587('0x1')](_0x299fcb,_0x49c822);};}exports[_0xa587('0x2')]=function(_0x19acff){for(var _0xbe92bc=0x0,_0xbf19b4=events[_0xa587('0x3')];_0xbe92bc<_0xbf19b4;_0xbe92bc++){var _0x33a3d8=events[_0xbe92bc];var _0x868871=createListener(_0xa587('0x4')+_0x33a3d8,_0x19acff);SquareProjectEvents['on'](_0x33a3d8,_0x868871);}}; \ No newline at end of file +var _0x33d9=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x33d9,0xd8));var _0x933d=function(_0xab985e,_0x39efd1){_0xab985e=_0xab985e-0x0;var _0x52e718=_0x33d9[_0xab985e];return _0x52e718;};'use strict';var SquareProjectEvents=require(_0x933d('0x0'));var events=[_0x933d('0x1'),_0x933d('0x2'),_0x933d('0x3')];function createListener(_0x23ad38,_0x4ff360){return function(_0xee4a69){_0x4ff360[_0x933d('0x4')](_0x23ad38,_0xee4a69);};}function removeListener(_0x181630,_0x439aa5){return function(){SquareProjectEvents[_0x933d('0x5')](_0x181630,_0x439aa5);};}exports[_0x933d('0x6')]=function(_0x1f2c41){for(var _0x2b618b=0x0,_0x4e3b56=events[_0x933d('0x7')];_0x2b618b<_0x4e3b56;_0x2b618b++){var _0x321e2b=events[_0x2b618b];var _0x565239=createListener(_0x933d('0x8')+_0x321e2b,_0x1f2c41);SquareProjectEvents['on'](_0x321e2b,_0x565239);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 63d53ae..b90185f 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x5d24a4,_0x396b5e){var _0x11cabe=function(_0x29cc0f){while(--_0x29cc0f){_0x5d24a4['push'](_0x5d24a4['shift']());}};_0x11cabe(++_0x396b5e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x448b7c,_0x422db8){_0x448b7c=_0x448b7c-0x0;var _0x5ec783=_0x1cb9[_0x448b7c];return _0x5ec783;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x396646,_0x35baa5){var _0x29451b=function(_0x26c7dc){while(--_0x26c7dc){_0x396646['push'](_0x396646['shift']());}};_0x29451b(++_0x35baa5);}(_0x7a54,0x106));var _0x47a5=function(_0x25f8bc,_0x53fc97){_0x25f8bc=_0x25f8bc-0x0;var _0xf3bf74=_0x7a54[_0x25f8bc];return _0xf3bf74;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 122ce4a..d0b70ee 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 _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2eb2[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'callerid':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'extension':{'type':Sequelize[_0x22eb('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x22eb('0x1')]},'filename':{'type':Sequelize[_0x22eb('0x1')]},'savePath':{'type':Sequelize[_0x22eb('0x1')]},'format':{'type':Sequelize[_0x22eb('0x2')],'get':function(){var _0x4539d0='';var _0x396806=this[_0x22eb('0x3')](_0x22eb('0x4'));if(_0x396806){_0x4539d0=_0x396806[_0x22eb('0x5')](_0x396806[_0x22eb('0x6')]('.'));}return _0x4539d0;}}}; \ No newline at end of file +var _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x55c7e4,_0x1746d7){var _0x48b877=function(_0x299ec0){while(--_0x299ec0){_0x55c7e4['push'](_0x55c7e4['shift']());}};_0x48b877(++_0x1746d7);}(_0xac31,0xca));var _0x1ac3=function(_0x29250c,_0x480051){_0x29250c=_0x29250c-0x0;var _0x482c7b=_0xac31[_0x29250c];return _0x482c7b;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 18e7ec1..35e1a21 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 _0x9858=['VIRTUAL','filter','options','includeAll','include','findAll','rows','show','rawAttributes','length','catch','create','body','find','params','../../components/encryptor','filename','format','existsSync','decryptFile','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','download','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge'];(function(_0x4af5d0,_0x15da48){var _0x260e8e=function(_0x5f3607){while(--_0x5f3607){_0x4af5d0['push'](_0x4af5d0['shift']());}};_0x260e8e(++_0x15da48);}(_0x9858,0x88));var _0x8985=function(_0x4a1786,_0x547f47){_0x4a1786=_0x4a1786-0x0;var _0x40136b=_0x9858[_0x4a1786];return _0x40136b;};'use strict';var emlformat=require(_0x8985('0x0'));var rimraf=require(_0x8985('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8985('0x2'));var moment=require(_0x8985('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8985('0x4'));var path=require(_0x8985('0x5'));var sox=require(_0x8985('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8985('0x7'));var _=require(_0x8985('0x8'));var squel=require('squel');var crypto=require(_0x8985('0x9'));var jsforce=require(_0x8985('0xa'));var deskjs=require(_0x8985('0xb'));var toCsv=require(_0x8985('0xc'));var querystring=require('querystring');var Papa=require(_0x8985('0xd'));var Redis=require('ioredis');var authService=require(_0x8985('0xe'));var qs=require(_0x8985('0xf'));var as=require(_0x8985('0x10'));var hardwareService=require(_0x8985('0x11'));var logger=require(_0x8985('0x12'))(_0x8985('0x13'));var utils=require(_0x8985('0x14'));var config=require(_0x8985('0x15'));var licenseUtil=require(_0x8985('0x16'));var db=require(_0x8985('0x17'))['db'];function respondWithStatusCode(_0x352bc0,_0x2dbd86){_0x2dbd86=_0x2dbd86||0xcc;return function(_0x3a6b46){if(_0x3a6b46){return _0x352bc0[_0x8985('0x18')](_0x2dbd86);}return _0x352bc0[_0x8985('0x19')](_0x2dbd86)[_0x8985('0x1a')]();};}function respondWithResult(_0x102f62,_0x2d589a){_0x2d589a=_0x2d589a||0xc8;return function(_0x244b90){if(_0x244b90){return _0x102f62[_0x8985('0x19')](_0x2d589a)[_0x8985('0x1b')](_0x244b90);}};}function respondWithFilteredResult(_0x513d8c,_0xab1a9c){return function(_0x4c9372){if(_0x4c9372){var _0x389a53=typeof _0xab1a9c[_0x8985('0x1c')]===_0x8985('0x1d')&&typeof _0xab1a9c[_0x8985('0x1e')]==='undefined';var _0x5614ee=_0x4c9372[_0x8985('0x1f')];var _0xb485a9=_0x389a53?0x0:_0xab1a9c[_0x8985('0x1c')];var _0x46a460=_0x389a53?_0x4c9372[_0x8985('0x1f')]:_0xab1a9c[_0x8985('0x1c')]+_0xab1a9c[_0x8985('0x1e')];var _0x44a5e4;if(_0x46a460>=_0x5614ee){_0x46a460=_0x5614ee;_0x44a5e4=0xc8;}else{_0x44a5e4=0xce;}_0x513d8c[_0x8985('0x19')](_0x44a5e4);return _0x513d8c[_0x8985('0x20')](_0x8985('0x21'),_0xb485a9+'-'+_0x46a460+'/'+_0x5614ee)[_0x8985('0x1b')](_0x4c9372);}return null;};}function patchUpdates(_0x31cfd1){return function(_0x44b8ea){try{jsonpatch[_0x8985('0x22')](_0x44b8ea,_0x31cfd1,!![]);}catch(_0xba1af1){return BPromise[_0x8985('0x23')](_0xba1af1);}return _0x44b8ea[_0x8985('0x24')]();};}function saveUpdates(_0x599132,_0x2e3b59){return function(_0x118de7){if(_0x118de7){return _0x118de7['update'](_0x599132)[_0x8985('0x25')](function(_0x27ae9e){return _0x27ae9e;});}return null;};}function removeEntity(_0x35f988,_0x2b10c2){return function(_0x10c8e6){if(_0x10c8e6){return _0x10c8e6['destroy']()['then'](function(){_0x35f988[_0x8985('0x19')](0xcc)[_0x8985('0x1a')]();});}};}function handleEntityNotFound(_0x5ee26d,_0x34260a){return function(_0x5c913f){if(!_0x5c913f){_0x5ee26d[_0x8985('0x18')](0x194);}return _0x5c913f;};}function handleError(_0x10d2fa,_0x4c2476){_0x4c2476=_0x4c2476||0x1f4;return function(_0x12d7ed){logger['error'](_0x12d7ed[_0x8985('0x26')]);if(_0x12d7ed[_0x8985('0x27')]){delete _0x12d7ed['name'];}_0x10d2fa['status'](_0x4c2476)[_0x8985('0x28')](_0x12d7ed);};}exports[_0x8985('0x29')]=function(_0x2377da,_0x160ace){var _0x2366bc={},_0x593763={},_0xb19403={'count':0x0,'rows':[]};var _0x442e4a=_[_0x8985('0x2a')](db[_0x8985('0x2b')]['rawAttributes'],function(_0x6347ee){return{'name':_0x6347ee[_0x8985('0x2c')],'type':_0x6347ee[_0x8985('0x2d')][_0x8985('0x2e')]};});_0x593763[_0x8985('0x2f')]=_[_0x8985('0x2a')](_0x442e4a,'name');_0x593763[_0x8985('0x30')]=_[_0x8985('0x31')](_0x2377da[_0x8985('0x30')]);_0x593763['filters']=_[_0x8985('0x32')](_0x593763[_0x8985('0x2f')],_0x593763[_0x8985('0x30')]);_0x2366bc[_0x8985('0x33')]=_['intersection'](_0x593763['model'],qs[_0x8985('0x34')](_0x2377da[_0x8985('0x30')][_0x8985('0x34')]));_0x2366bc['attributes']=_0x2366bc['attributes']['length']?_0x2366bc[_0x8985('0x33')]:_0x593763[_0x8985('0x2f')];if(!_0x2377da[_0x8985('0x30')][_0x8985('0x35')]('nolimit')){_0x2366bc['limit']=qs[_0x8985('0x1e')](_0x2377da[_0x8985('0x30')][_0x8985('0x1e')]);_0x2366bc[_0x8985('0x1c')]=qs['offset'](_0x2377da[_0x8985('0x30')][_0x8985('0x1c')]);}_0x2366bc[_0x8985('0x36')]=qs[_0x8985('0x37')](_0x2377da[_0x8985('0x30')][_0x8985('0x37')]);_0x2366bc['where']=qs[_0x8985('0x38')](_[_0x8985('0x39')](_0x2377da[_0x8985('0x30')],_0x593763[_0x8985('0x38')]),_0x442e4a);if(_0x2377da[_0x8985('0x30')]['filter']){_0x2366bc[_0x8985('0x3a')]=_[_0x8985('0x3b')](_0x2366bc[_0x8985('0x3a')],{'$or':_[_0x8985('0x2a')](_0x442e4a,function(_0x553927){if(_0x553927[_0x8985('0x2d')]!==_0x8985('0x3c')){var _0x5c7e37={};_0x5c7e37[_0x553927[_0x8985('0x27')]]={'$like':'%'+_0x2377da[_0x8985('0x30')][_0x8985('0x3d')]+'%'};return _0x5c7e37;}})});}_0x2366bc=_['merge']({},_0x2366bc,_0x2377da[_0x8985('0x3e')]);var _0x43e412={'where':_0x2366bc[_0x8985('0x3a')]};return db[_0x8985('0x2b')][_0x8985('0x1f')](_0x43e412)[_0x8985('0x25')](function(_0x5af66e){_0xb19403[_0x8985('0x1f')]=_0x5af66e;if(_0x2377da[_0x8985('0x30')][_0x8985('0x3f')]){_0x2366bc[_0x8985('0x40')]=[{'all':!![]}];}return db['SquareRecording'][_0x8985('0x41')](_0x2366bc);})[_0x8985('0x25')](function(_0x57dda7){_0xb19403[_0x8985('0x42')]=_0x57dda7;return _0xb19403;})[_0x8985('0x25')](respondWithFilteredResult(_0x160ace,_0x2366bc))['catch'](handleError(_0x160ace,null));};exports[_0x8985('0x43')]=function(_0x2c2ee5,_0x35dde6){var _0xba9c99={'raw':!![],'where':{'id':_0x2c2ee5['params']['id']}},_0x398bfd={};_0x398bfd['model']=_[_0x8985('0x31')](db[_0x8985('0x2b')][_0x8985('0x44')]);_0x398bfd[_0x8985('0x30')]=_['keys'](_0x2c2ee5[_0x8985('0x30')]);_0x398bfd[_0x8985('0x38')]=_[_0x8985('0x32')](_0x398bfd[_0x8985('0x2f')],_0x398bfd[_0x8985('0x30')]);_0xba9c99[_0x8985('0x33')]=_[_0x8985('0x32')](_0x398bfd[_0x8985('0x2f')],qs[_0x8985('0x34')](_0x2c2ee5[_0x8985('0x30')]['fields']));_0xba9c99['attributes']=_0xba9c99[_0x8985('0x33')][_0x8985('0x45')]?_0xba9c99['attributes']:_0x398bfd['model'];if(_0x2c2ee5[_0x8985('0x30')][_0x8985('0x3f')]){_0xba9c99[_0x8985('0x40')]=[{'all':!![]}];}_0xba9c99=_['merge']({},_0xba9c99,_0x2c2ee5[_0x8985('0x3e')]);return db[_0x8985('0x2b')]['find'](_0xba9c99)[_0x8985('0x25')](handleEntityNotFound(_0x35dde6,null))['then'](respondWithResult(_0x35dde6,null))[_0x8985('0x46')](handleError(_0x35dde6,null));};exports[_0x8985('0x47')]=function(_0xa8ee74,_0x106387){return db['SquareRecording'][_0x8985('0x47')](_0xa8ee74[_0x8985('0x48')],{})[_0x8985('0x25')](respondWithResult(_0x106387,0xc9))[_0x8985('0x46')](handleError(_0x106387,null));};exports['update']=function(_0x1cafc6,_0x47fee8){if(_0x1cafc6[_0x8985('0x48')]['id']){delete _0x1cafc6['body']['id'];}return db[_0x8985('0x2b')][_0x8985('0x49')]({'where':{'id':_0x1cafc6[_0x8985('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47fee8,null))['then'](saveUpdates(_0x1cafc6[_0x8985('0x48')],null))[_0x8985('0x25')](respondWithResult(_0x47fee8,null))['catch'](handleError(_0x47fee8,null));};exports['download']=function(_0x51fe7e,_0x59e9e5,_0x161e46){var _0x32c29b=require(_0x8985('0x4b'));var _0x224959=![];var _0x34c13b={};if(_0x51fe7e[_0x8985('0x30')][_0x8985('0x2d')]&&_0x51fe7e[_0x8985('0x30')][_0x8985('0x2d')]==='uniqueid'){_0x34c13b['uniqueid']=_0x51fe7e[_0x8985('0x4a')]['id'];}else{_0x34c13b['id']=_0x51fe7e['params']['id'];}return db[_0x8985('0x2b')][_0x8985('0x49')]({'where':_0x34c13b,'attributes':['id','savePath',_0x8985('0x4c')],'raw':!![]})[_0x8985('0x25')](handleEntityNotFound(_0x59e9e5,null))[_0x8985('0x25')](function(_0x11063e){if(_0x11063e){var _0x3b5c7a=_0x11063e['savePath'];var _0x5e19f8=util[_0x8985('0x4d')]('%s.cypher',_0x3b5c7a);if(fs[_0x8985('0x4e')](_0x5e19f8)){_0x224959=!![];return _0x32c29b[_0x8985('0x4f')](_0x5e19f8,_0x3b5c7a,config['secrets'][_0x8985('0x50')])[_0x8985('0x25')](function(){return _0x11063e;});}return _0x11063e;}})[_0x8985('0x25')](function(_0x347867){if(_0x347867){var _0xf2a810=_0x347867[_0x8985('0x51')];if(!fs['existsSync'](_0xf2a810)){throw new db[(_0x8985('0x52'))][(_0x8985('0x53'))](_0x8985('0x54'));}if(_0x347867[_0x8985('0x4c')]){return _0x59e9e5['download'](_0xf2a810,_0x347867[_0x8985('0x4c')]+path[_0x8985('0x55')](_0xf2a810),function(){if(_0x224959){fs['unlink'](_0xf2a810);}});}else{return _0x59e9e5[_0x8985('0x56')](_0xf2a810,function(_0x1821eb){if(_0x224959){fs[_0x8985('0x57')](_0xf2a810);}});}}})['catch'](function(_0x9e5f19){if(_0x9e5f19[_0x8985('0x58')]===_0x8985('0x54')){_0x59e9e5[_0x8985('0x19')](0x194)[_0x8985('0x28')](_0x8985('0x59'));}else{return handleError(_0x59e9e5,null);}});};exports[_0x8985('0x5a')]=function(_0x20491d,_0x560842){return db[_0x8985('0x2b')][_0x8985('0x49')]({'where':{'id':_0x20491d[_0x8985('0x4a')]['id']}})['then'](function(_0x5d1791){if(_[_0x8985('0x5b')](_0x5d1791)){throw new ReferenceError(_0x8985('0x5c'));}return _0x5d1791;})[_0x8985('0x25')](function(_0x4e7ed7){var _0x1fa6e0=_0x4e7ed7[_0x8985('0x51')];logger[_0x8985('0x5d')](_0x8985('0x5e'),_0x1fa6e0);if(!_['isNil'](_0x4e7ed7[_0x8985('0x51')])&&fs[_0x8985('0x4e')](_0x1fa6e0)){logger['info'](_0x8985('0x5f')+_0x1fa6e0+_0x8985('0x60'));fs[_0x8985('0x61')](_0x1fa6e0);}_0x1fa6e0=_0x1fa6e0+'.cypher';if(!_['isNil'](_0x4e7ed7[_0x8985('0x51')])&&fs[_0x8985('0x4e')](_0x1fa6e0)){logger[_0x8985('0x5d')]('File:\x20\x22'+_0x1fa6e0+_0x8985('0x60'));fs[_0x8985('0x61')](_0x1fa6e0);}return _0x4e7ed7;})[_0x8985('0x25')](function(_0x2ae1bd){if(!_0x2ae1bd)throw new InternalError();return _0x2ae1bd[_0x8985('0x5a')]();})[_0x8985('0x25')](function(){_0x560842[_0x8985('0x19')](0xcc)[_0x8985('0x1a')]();})[_0x8985('0x46')](handleError(_0x560842,null));}; \ No newline at end of file +var _0xfca0=['%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','error','name','send','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','SquareRecording','include','catch','show','params','keys','length','includeAll','merge','create','body','find','download','../../components/encryptor','uniqueid','filename','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfca0,0x121));var _0x0fca=function(_0x45a2e2,_0x92d820){_0x45a2e2=_0x45a2e2-0x0;var _0x9cdd87=_0xfca0[_0x45a2e2];return _0x9cdd87;};'use strict';var emlformat=require(_0x0fca('0x0'));var rimraf=require(_0x0fca('0x1'));var zipdir=require(_0x0fca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0fca('0x3'));var Mustache=require(_0x0fca('0x4'));var util=require('util');var path=require(_0x0fca('0x5'));var sox=require(_0x0fca('0x6'));var csv=require(_0x0fca('0x7'));var ejs=require(_0x0fca('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fca('0x9'));var squel=require('squel');var crypto=require(_0x0fca('0xa'));var jsforce=require(_0x0fca('0xb'));var deskjs=require(_0x0fca('0xc'));var toCsv=require(_0x0fca('0x7'));var querystring=require('querystring');var Papa=require(_0x0fca('0xd'));var Redis=require(_0x0fca('0xe'));var authService=require(_0x0fca('0xf'));var qs=require(_0x0fca('0x10'));var as=require(_0x0fca('0x11'));var hardwareService=require(_0x0fca('0x12'));var logger=require(_0x0fca('0x13'))(_0x0fca('0x14'));var utils=require(_0x0fca('0x15'));var config=require(_0x0fca('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fca('0x17'))['db'];function respondWithStatusCode(_0x507e9b,_0x2dba32){_0x2dba32=_0x2dba32||0xcc;return function(_0x110545){if(_0x110545){return _0x507e9b[_0x0fca('0x18')](_0x2dba32);}return _0x507e9b['status'](_0x2dba32)[_0x0fca('0x19')]();};}function respondWithResult(_0x2d6434,_0x49cac2){_0x49cac2=_0x49cac2||0xc8;return function(_0x35f2f8){if(_0x35f2f8){return _0x2d6434[_0x0fca('0x1a')](_0x49cac2)[_0x0fca('0x1b')](_0x35f2f8);}};}function respondWithFilteredResult(_0x1ff45b,_0x521a48){return function(_0x22a633){if(_0x22a633){var _0x46f10f=typeof _0x521a48[_0x0fca('0x1c')]==='undefined'&&typeof _0x521a48[_0x0fca('0x1d')]===_0x0fca('0x1e');var _0x3a6fcb=_0x22a633[_0x0fca('0x1f')];var _0x12170b=_0x46f10f?0x0:_0x521a48['offset'];var _0x19fb42=_0x46f10f?_0x22a633['count']:_0x521a48[_0x0fca('0x1c')]+_0x521a48[_0x0fca('0x1d')];var _0x21c1e6;if(_0x19fb42>=_0x3a6fcb){_0x19fb42=_0x3a6fcb;_0x21c1e6=0xc8;}else{_0x21c1e6=0xce;}_0x1ff45b[_0x0fca('0x1a')](_0x21c1e6);return _0x1ff45b['set'](_0x0fca('0x20'),_0x12170b+'-'+_0x19fb42+'/'+_0x3a6fcb)[_0x0fca('0x1b')](_0x22a633);}return null;};}function patchUpdates(_0xe8009){return function(_0x505546){try{jsonpatch[_0x0fca('0x21')](_0x505546,_0xe8009,!![]);}catch(_0x213102){return BPromise['reject'](_0x213102);}return _0x505546[_0x0fca('0x22')]();};}function saveUpdates(_0x32d1f6,_0x3bea4c){return function(_0x365ab9){if(_0x365ab9){return _0x365ab9['update'](_0x32d1f6)[_0x0fca('0x23')](function(_0x3ac562){return _0x3ac562;});}return null;};}function removeEntity(_0x5002fc,_0x21e96e){return function(_0x49d515){if(_0x49d515){return _0x49d515[_0x0fca('0x24')]()['then'](function(){_0x5002fc[_0x0fca('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0a14,_0x5533e6){return function(_0x41aba8){if(!_0x41aba8){_0x2f0a14[_0x0fca('0x18')](0x194);}return _0x41aba8;};}function handleError(_0x4f9b70,_0x4f101e){_0x4f101e=_0x4f101e||0x1f4;return function(_0x46bcb6){logger[_0x0fca('0x25')](_0x46bcb6['stack']);if(_0x46bcb6[_0x0fca('0x26')]){delete _0x46bcb6[_0x0fca('0x26')];}_0x4f9b70['status'](_0x4f101e)[_0x0fca('0x27')](_0x46bcb6);};}exports['index']=function(_0x8e80a,_0x41d8e8){var _0x163690={},_0x4e2a66={},_0x56954d={'count':0x0,'rows':[]};var _0x3c547c=_['map'](db['SquareRecording'][_0x0fca('0x28')],function(_0x1344c8){return{'name':_0x1344c8[_0x0fca('0x29')],'type':_0x1344c8[_0x0fca('0x2a')]['key']};});_0x4e2a66['model']=_[_0x0fca('0x2b')](_0x3c547c,_0x0fca('0x26'));_0x4e2a66['query']=_['keys'](_0x8e80a[_0x0fca('0x2c')]);_0x4e2a66[_0x0fca('0x2d')]=_[_0x0fca('0x2e')](_0x4e2a66[_0x0fca('0x2f')],_0x4e2a66[_0x0fca('0x2c')]);_0x163690['attributes']=_['intersection'](_0x4e2a66[_0x0fca('0x2f')],qs[_0x0fca('0x30')](_0x8e80a[_0x0fca('0x2c')][_0x0fca('0x30')]));_0x163690[_0x0fca('0x31')]=_0x163690[_0x0fca('0x31')]['length']?_0x163690[_0x0fca('0x31')]:_0x4e2a66['model'];if(!_0x8e80a[_0x0fca('0x2c')][_0x0fca('0x32')](_0x0fca('0x33'))){_0x163690[_0x0fca('0x1d')]=qs[_0x0fca('0x1d')](_0x8e80a['query'][_0x0fca('0x1d')]);_0x163690[_0x0fca('0x1c')]=qs[_0x0fca('0x1c')](_0x8e80a[_0x0fca('0x2c')]['offset']);}_0x163690[_0x0fca('0x34')]=qs[_0x0fca('0x35')](_0x8e80a[_0x0fca('0x2c')]['sort']);_0x163690[_0x0fca('0x36')]=qs[_0x0fca('0x2d')](_[_0x0fca('0x37')](_0x8e80a['query'],_0x4e2a66[_0x0fca('0x2d')]),_0x3c547c);if(_0x8e80a[_0x0fca('0x2c')]['filter']){_0x163690[_0x0fca('0x36')]=_['merge'](_0x163690[_0x0fca('0x36')],{'$or':_['map'](_0x3c547c,function(_0xc17a02){if(_0xc17a02[_0x0fca('0x2a')]!=='VIRTUAL'){var _0x58076f={};_0x58076f[_0xc17a02[_0x0fca('0x26')]]={'$like':'%'+_0x8e80a[_0x0fca('0x2c')][_0x0fca('0x38')]+'%'};return _0x58076f;}})});}_0x163690=_['merge']({},_0x163690,_0x8e80a[_0x0fca('0x39')]);var _0x332a80={'where':_0x163690['where']};return db[_0x0fca('0x3a')]['count'](_0x332a80)[_0x0fca('0x23')](function(_0x19a65b){_0x56954d[_0x0fca('0x1f')]=_0x19a65b;if(_0x8e80a['query']['includeAll']){_0x163690[_0x0fca('0x3b')]=[{'all':!![]}];}return db[_0x0fca('0x3a')]['findAll'](_0x163690);})[_0x0fca('0x23')](function(_0x3b17b3){_0x56954d['rows']=_0x3b17b3;return _0x56954d;})[_0x0fca('0x23')](respondWithFilteredResult(_0x41d8e8,_0x163690))[_0x0fca('0x3c')](handleError(_0x41d8e8,null));};exports[_0x0fca('0x3d')]=function(_0x2d85ff,_0x1b0239){var _0x3a6c78={'raw':!![],'where':{'id':_0x2d85ff[_0x0fca('0x3e')]['id']}},_0x3aa77f={};_0x3aa77f[_0x0fca('0x2f')]=_['keys'](db[_0x0fca('0x3a')]['rawAttributes']);_0x3aa77f[_0x0fca('0x2c')]=_[_0x0fca('0x3f')](_0x2d85ff[_0x0fca('0x2c')]);_0x3aa77f[_0x0fca('0x2d')]=_['intersection'](_0x3aa77f[_0x0fca('0x2f')],_0x3aa77f[_0x0fca('0x2c')]);_0x3a6c78['attributes']=_[_0x0fca('0x2e')](_0x3aa77f['model'],qs[_0x0fca('0x30')](_0x2d85ff[_0x0fca('0x2c')]['fields']));_0x3a6c78[_0x0fca('0x31')]=_0x3a6c78[_0x0fca('0x31')][_0x0fca('0x40')]?_0x3a6c78['attributes']:_0x3aa77f[_0x0fca('0x2f')];if(_0x2d85ff['query'][_0x0fca('0x41')]){_0x3a6c78[_0x0fca('0x3b')]=[{'all':!![]}];}_0x3a6c78=_[_0x0fca('0x42')]({},_0x3a6c78,_0x2d85ff[_0x0fca('0x39')]);return db[_0x0fca('0x3a')]['find'](_0x3a6c78)['then'](handleEntityNotFound(_0x1b0239,null))[_0x0fca('0x23')](respondWithResult(_0x1b0239,null))['catch'](handleError(_0x1b0239,null));};exports[_0x0fca('0x43')]=function(_0x27858a,_0x1ec119){return db[_0x0fca('0x3a')]['create'](_0x27858a[_0x0fca('0x44')],{})['then'](respondWithResult(_0x1ec119,0xc9))[_0x0fca('0x3c')](handleError(_0x1ec119,null));};exports['update']=function(_0x26a946,_0x31f643){if(_0x26a946[_0x0fca('0x44')]['id']){delete _0x26a946['body']['id'];}return db[_0x0fca('0x3a')][_0x0fca('0x45')]({'where':{'id':_0x26a946[_0x0fca('0x3e')]['id']}})[_0x0fca('0x23')](handleEntityNotFound(_0x31f643,null))[_0x0fca('0x23')](saveUpdates(_0x26a946['body'],null))['then'](respondWithResult(_0x31f643,null))[_0x0fca('0x3c')](handleError(_0x31f643,null));};exports[_0x0fca('0x46')]=function(_0x5a945d,_0x22f800,_0x566d3b){var _0xcafa25=require(_0x0fca('0x47'));var _0x1a66c8=![];var _0x4906df={};if(_0x5a945d[_0x0fca('0x2c')][_0x0fca('0x2a')]&&_0x5a945d[_0x0fca('0x2c')]['type']===_0x0fca('0x48')){_0x4906df[_0x0fca('0x48')]=_0x5a945d[_0x0fca('0x3e')]['id'];}else{_0x4906df['id']=_0x5a945d[_0x0fca('0x3e')]['id'];}return db[_0x0fca('0x3a')]['find']({'where':_0x4906df,'attributes':['id','savePath',_0x0fca('0x49')],'raw':!![]})[_0x0fca('0x23')](handleEntityNotFound(_0x22f800,null))['then'](function(_0x241f2e){if(_0x241f2e){var _0x2bdf4e=_0x241f2e[_0x0fca('0x4a')];var _0x1501a2=util['format'](_0x0fca('0x4b'),_0x2bdf4e);if(fs[_0x0fca('0x4c')](_0x1501a2)){_0x1a66c8=!![];return _0xcafa25[_0x0fca('0x4d')](_0x1501a2,_0x2bdf4e,config['secrets'][_0x0fca('0x4e')])[_0x0fca('0x23')](function(){return _0x241f2e;});}return _0x241f2e;}})['then'](function(_0x379864){if(_0x379864){var _0x23e2ab=_0x379864[_0x0fca('0x4a')];if(!fs[_0x0fca('0x4c')](_0x23e2ab)){throw new db[(_0x0fca('0x4f'))][(_0x0fca('0x50'))](_0x0fca('0x51'));}if(_0x379864[_0x0fca('0x49')]){return _0x22f800[_0x0fca('0x46')](_0x23e2ab,_0x379864[_0x0fca('0x49')]+path['extname'](_0x23e2ab),function(){if(_0x1a66c8){fs[_0x0fca('0x52')](_0x23e2ab);}});}else{return _0x22f800['download'](_0x23e2ab,function(_0x5d659f){if(_0x1a66c8){fs[_0x0fca('0x52')](_0x23e2ab);}});}}})[_0x0fca('0x3c')](function(_0x2140ce){if(_0x2140ce[_0x0fca('0x53')]===_0x0fca('0x51')){_0x22f800[_0x0fca('0x1a')](0x194)[_0x0fca('0x27')]('Not\x20found');}else{return handleError(_0x22f800,null);}});};exports[_0x0fca('0x24')]=function(_0x2aecbc,_0x13e202){return db[_0x0fca('0x3a')][_0x0fca('0x45')]({'where':{'id':_0x2aecbc[_0x0fca('0x3e')]['id']}})[_0x0fca('0x23')](function(_0x2730ca){if(_[_0x0fca('0x54')](_0x2730ca)){throw new ReferenceError(_0x0fca('0x55'));}return _0x2730ca;})[_0x0fca('0x23')](function(_0xdd1bb1){var _0x22a4eb=_0xdd1bb1[_0x0fca('0x4a')];logger['info'](_0x0fca('0x56'),_0x22a4eb);if(!_[_0x0fca('0x54')](_0xdd1bb1[_0x0fca('0x4a')])&&fs[_0x0fca('0x4c')](_0x22a4eb)){logger[_0x0fca('0x57')](_0x0fca('0x58')+_0x22a4eb+_0x0fca('0x59'));fs[_0x0fca('0x5a')](_0x22a4eb);}_0x22a4eb=_0x22a4eb+'.cypher';if(!_['isNil'](_0xdd1bb1[_0x0fca('0x4a')])&&fs[_0x0fca('0x4c')](_0x22a4eb)){logger[_0x0fca('0x57')](_0x0fca('0x58')+_0x22a4eb+_0x0fca('0x59'));fs['unlinkSync'](_0x22a4eb);}return _0xdd1bb1;})[_0x0fca('0x23')](function(_0xee2d07){if(!_0xee2d07)throw new InternalError();return _0xee2d07[_0x0fca('0x24')]();})[_0x0fca('0x23')](function(){_0x13e202[_0x0fca('0x1a')](0xcc)[_0x0fca('0x19')]();})['catch'](handleError(_0x13e202,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index feb9fe9..cf0cefe 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 _0x9261=['api','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util'];(function(_0x1945a3,_0x5b8502){var _0x48dce1=function(_0x2a3763){while(--_0x2a3763){_0x1945a3['push'](_0x1945a3['shift']());}};_0x48dce1(++_0x5b8502);}(_0x9261,0x1de));var _0x1926=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x9261[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x1926('0x0'));var util=require(_0x1926('0x1'));var logger=require('../../config/logger')(_0x1926('0x2'));var moment=require(_0x1926('0x3'));var BPromise=require(_0x1926('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1926('0x5'));var rimraf=require(_0x1926('0x6'));var config=require(_0x1926('0x7'));var attributes=require(_0x1926('0x8'));module[_0x1926('0x9')]=function(_0x549cec,_0x17f1c6){return _0x549cec['define'](_0x1926('0xa'),attributes,{'tableName':_0x1926('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c4a=['path','../../config/environment','exports','SquareRecording','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x253a0e,_0x498d5c){_0x253a0e=_0x253a0e-0x0;var _0x163cf5=_0x4c4a[_0x253a0e];return _0x163cf5;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var logger=require(_0xa4c4('0x2'))('api');var moment=require(_0xa4c4('0x3'));var BPromise=require(_0xa4c4('0x4'));var rp=require(_0xa4c4('0x5'));var fs=require('fs');var path=require(_0xa4c4('0x6'));var rimraf=require('rimraf');var config=require(_0xa4c4('0x7'));var attributes=require('./squareRecording.attributes');module[_0xa4c4('0x8')]=function(_0x11aded,_0x5ca539){return _0x11aded['define'](_0xa4c4('0x9'),attributes,{'tableName':'square_recordings','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 7d855bd..ab6645a 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 _0x37e3=['request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareRecording,\x20%s,\x20%s','result','SquareRecording','body','options','raw','CreateSquareRecording','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x549539,_0x3f0255){var _0x4b488e=function(_0x2838ab){while(--_0x2838ab){_0x549539['push'](_0x549539['shift']());}};_0x4b488e(++_0x3f0255);}(_0x37e3,0x161));var _0x337e=function(_0x160c40,_0x1d80e2){_0x160c40=_0x160c40-0x0;var _0x40a7b4=_0x37e3[_0x160c40];return _0x40a7b4;};'use strict';var _=require(_0x337e('0x0'));var util=require(_0x337e('0x1'));var moment=require('moment');var BPromise=require(_0x337e('0x2'));var rs=require(_0x337e('0x3'));var fs=require('fs');var Redis=require(_0x337e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x337e('0x5'));var logger=require(_0x337e('0x6'))('rpc');var config=require(_0x337e('0x7'));var jayson=require(_0x337e('0x8'));var client=jayson[_0x337e('0x9')][_0x337e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33caa9,_0xac991f,_0x9efce9){return new BPromise(function(_0x13ee07,_0x263ab8){return client[_0x337e('0xb')](_0x33caa9,_0x9efce9)['then'](function(_0xd533d2){logger[_0x337e('0xc')]('SquareRecording,\x20%s,\x20%s',_0xac991f,_0x337e('0xd'));logger[_0x337e('0xe')](_0x337e('0xf'),_0xac991f,_0x337e('0xd'),JSON[_0x337e('0x10')](_0xd533d2));if(_0xd533d2[_0x337e('0x11')]){if(_0xd533d2[_0x337e('0x11')]['code']===0x1f4){logger[_0x337e('0x11')]('SquareRecording,\x20%s,\x20%s',_0xac991f,_0xd533d2[_0x337e('0x11')][_0x337e('0x12')]);return _0x263ab8(_0xd533d2[_0x337e('0x11')][_0x337e('0x12')]);}logger[_0x337e('0x11')](_0x337e('0x13'),_0xac991f,_0xd533d2[_0x337e('0x11')]['message']);return _0x13ee07(_0xd533d2[_0x337e('0x11')][_0x337e('0x12')]);}else{logger[_0x337e('0xc')](_0x337e('0x13'),_0xac991f,'request\x20sent');_0x13ee07(_0xd533d2[_0x337e('0x14')][_0x337e('0x12')]);}})['catch'](function(_0x3b71e8){logger[_0x337e('0x11')]('SquareRecording,\x20%s,\x20%s',_0xac991f,_0x3b71e8);_0x263ab8(_0x3b71e8);});});}exports['CreateSquareRecording']=function(_0x5bc341){var _0x552165=this;return new Promise(function(_0x91cfc6,_0x4073bf){return db[_0x337e('0x15')]['create'](_0x5bc341[_0x337e('0x16')],{'raw':_0x5bc341[_0x337e('0x17')]?_0x5bc341[_0x337e('0x17')][_0x337e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x138ca6){logger[_0x337e('0xc')](_0x337e('0x19'),_0x5bc341);logger['debug'](_0x337e('0x19'),_0x5bc341,JSON[_0x337e('0x10')](_0x138ca6));_0x91cfc6(_0x138ca6);})['catch'](function(_0x29884a){logger[_0x337e('0x11')](_0x337e('0x19'),_0x29884a[_0x337e('0x12')],_0x5bc341);_0x4073bf(_0x552165[_0x337e('0x11')](0x1f4,_0x29884a[_0x337e('0x12')]));});});}; \ No newline at end of file +var _0x1600=['SquareRecording','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSquareRecording'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x1600,0x1df));var _0x0160=function(_0x56d138,_0x924339){_0x56d138=_0x56d138-0x0;var _0x42f723=_0x1600[_0x56d138];return _0x42f723;};'use strict';var _=require(_0x0160('0x0'));var util=require(_0x0160('0x1'));var moment=require(_0x0160('0x2'));var BPromise=require(_0x0160('0x3'));var rs=require(_0x0160('0x4'));var fs=require('fs');var Redis=require(_0x0160('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0160('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0160('0x7')][_0x0160('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50eaa7,_0x3ff795,_0x2b189e){return new BPromise(function(_0x12ba3f,_0x12259c){return client[_0x0160('0x9')](_0x50eaa7,_0x2b189e)[_0x0160('0xa')](function(_0x2be0bd){logger[_0x0160('0xb')](_0x0160('0xc'),_0x3ff795,'request\x20sent');logger[_0x0160('0xd')](_0x0160('0xe'),_0x3ff795,_0x0160('0xf'),JSON[_0x0160('0x10')](_0x2be0bd));if(_0x2be0bd[_0x0160('0x11')]){if(_0x2be0bd[_0x0160('0x11')][_0x0160('0x12')]===0x1f4){logger[_0x0160('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3ff795,_0x2be0bd['error'][_0x0160('0x13')]);return _0x12259c(_0x2be0bd[_0x0160('0x11')][_0x0160('0x13')]);}logger[_0x0160('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3ff795,_0x2be0bd[_0x0160('0x11')]['message']);return _0x12ba3f(_0x2be0bd[_0x0160('0x11')][_0x0160('0x13')]);}else{logger['info'](_0x0160('0xc'),_0x3ff795,'request\x20sent');_0x12ba3f(_0x2be0bd['result']['message']);}})['catch'](function(_0x20246c){logger[_0x0160('0x11')](_0x0160('0xc'),_0x3ff795,_0x20246c);_0x12259c(_0x20246c);});});}exports[_0x0160('0x14')]=function(_0x101807){var _0x52a513=this;return new Promise(function(_0x14015b,_0x2f4ff0){return db[_0x0160('0x15')]['create'](_0x101807[_0x0160('0x16')],{'raw':_0x101807['options']?_0x101807[_0x0160('0x17')][_0x0160('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2d56c3){logger['info'](_0x0160('0x14'),_0x101807);logger[_0x0160('0xd')](_0x0160('0x14'),_0x101807,JSON[_0x0160('0x10')](_0x2d56c3));_0x14015b(_0x2d56c3);})['catch'](function(_0x194572){logger[_0x0160('0x11')](_0x0160('0x14'),_0x194572['message'],_0x101807);_0x2f4ff0(_0x52a513[_0x0160('0x11')](0x1f4,_0x194572[_0x0160('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 60060df..27529f5 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x30953e,_0x5ecdb0){var _0x4c6516=function(_0x1a15f3){while(--_0x1a15f3){_0x30953e['push'](_0x30953e['shift']());}};_0x4c6516(++_0x5ecdb0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x292d97,_0x4de4bd){var _0xb4c274=function(_0x382c9e){while(--_0x382c9e){_0x292d97['push'](_0x292d97['shift']());}};_0xb4c274(++_0x4de4bd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0b65769..30a48e2 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 _0x8a95=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x3c42d1,_0x4c7876){var _0x5d2cbd=function(_0x210717){while(--_0x210717){_0x3c42d1['push'](_0x3c42d1['shift']());}};_0x5d2cbd(++_0x4c7876);}(_0x8a95,0x10e));var _0x58a9=function(_0x118311,_0x5f11b9){_0x118311=_0x118311-0x0;var _0x3fc58d=_0x8a95[_0x118311];return _0x3fc58d;};'use strict';var Sequelize=require(_0x58a9('0x0'));module['exports']={'network':{'type':Sequelize[_0x58a9('0x1')]},'network_script':{'type':Sequelize[_0x58a9('0x1')]},'request':{'type':Sequelize[_0x58a9('0x1')]},'channel':{'type':Sequelize[_0x58a9('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x58a9('0x1')]},'uniqueid':{'type':Sequelize[_0x58a9('0x1')]},'version':{'type':Sequelize[_0x58a9('0x1')]},'callerid':{'type':Sequelize[_0x58a9('0x1')]},'calleridname':{'type':Sequelize[_0x58a9('0x1')]},'callingpres':{'type':Sequelize[_0x58a9('0x1')]},'callingani2':{'type':Sequelize[_0x58a9('0x1')]},'callington':{'type':Sequelize[_0x58a9('0x1')]},'callingtns':{'type':Sequelize[_0x58a9('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x58a9('0x1')]},'context':{'type':Sequelize[_0x58a9('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x58a9('0x1')]},'enhanced':{'type':Sequelize[_0x58a9('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x58a9('0x1')]},'project_name':{'type':Sequelize[_0x58a9('0x1')]},'joinAt':{'type':Sequelize[_0x58a9('0x2')]},'leaveAt':{'type':Sequelize[_0x58a9('0x2')]},'bot':{'type':Sequelize[_0x58a9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7d87=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3205c6,_0x581f15){var _0x120200=function(_0x397593){while(--_0x397593){_0x3205c6['push'](_0x3205c6['shift']());}};_0x120200(++_0x581f15);}(_0x7d87,0x1d2));var _0x77d8=function(_0x412937,_0xdbe7e9){_0x412937=_0x412937-0x0;var _0x20772e=_0x7d87[_0x412937];return _0x20772e;};'use strict';var Sequelize=require(_0x77d8('0x0'));module[_0x77d8('0x1')]={'network':{'type':Sequelize[_0x77d8('0x2')]},'network_script':{'type':Sequelize[_0x77d8('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x77d8('0x2')]},'language':{'type':Sequelize[_0x77d8('0x2')]},'type':{'type':Sequelize[_0x77d8('0x2')]},'uniqueid':{'type':Sequelize[_0x77d8('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x77d8('0x2')]},'calleridname':{'type':Sequelize[_0x77d8('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x77d8('0x2')]},'callington':{'type':Sequelize[_0x77d8('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x77d8('0x2')]},'rdnis':{'type':Sequelize[_0x77d8('0x2')]},'context':{'type':Sequelize[_0x77d8('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x77d8('0x2')]},'enhanced':{'type':Sequelize[_0x77d8('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x77d8('0x2')]},'project_name':{'type':Sequelize[_0x77d8('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x77d8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 06bbec9..39c52c6 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 _0x5f82=['ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x57ecd9,_0x2b86bb){var _0x4dbe8e=function(_0x33ac44){while(--_0x33ac44){_0x57ecd9['push'](_0x57ecd9['shift']());}};_0x4dbe8e(++_0x2b86bb);}(_0x5f82,0x8a));var _0x25f8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5f82[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x25f8('0x0'));var rimraf=require(_0x25f8('0x1'));var zipdir=require(_0x25f8('0x2'));var jsonpatch=require(_0x25f8('0x3'));var rp=require('request-promise');var moment=require(_0x25f8('0x4'));var BPromise=require(_0x25f8('0x5'));var Mustache=require(_0x25f8('0x6'));var util=require(_0x25f8('0x7'));var path=require(_0x25f8('0x8'));var sox=require(_0x25f8('0x9'));var csv=require('to-csv');var ejs=require(_0x25f8('0xa'));var fs=require('fs');var fs_extra=require(_0x25f8('0xb'));var _=require('lodash');var squel=require(_0x25f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x25f8('0xd'));var deskjs=require(_0x25f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x25f8('0xf'));var Papa=require(_0x25f8('0x10'));var Redis=require(_0x25f8('0x11'));var authService=require(_0x25f8('0x12'));var qs=require(_0x25f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25f8('0x14'));var logger=require('../../config/logger')(_0x25f8('0x15'));var utils=require(_0x25f8('0x16'));var config=require(_0x25f8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25f8('0x18'))['db'];function respondWithStatusCode(_0x304696,_0x323e00){_0x323e00=_0x323e00||0xcc;return function(_0x77e2a9){if(_0x77e2a9){return _0x304696[_0x25f8('0x19')](_0x323e00);}return _0x304696[_0x25f8('0x1a')](_0x323e00)[_0x25f8('0x1b')]();};}function respondWithResult(_0x3a0420,_0x44ca1d){_0x44ca1d=_0x44ca1d||0xc8;return function(_0x214db4){if(_0x214db4){return _0x3a0420[_0x25f8('0x1a')](_0x44ca1d)[_0x25f8('0x1c')](_0x214db4);}};}function respondWithFilteredResult(_0x4f3161,_0x59a038){return function(_0x4f88dc){if(_0x4f88dc){var _0x44f117=typeof _0x59a038[_0x25f8('0x1d')]==='undefined'&&typeof _0x59a038[_0x25f8('0x1e')]===_0x25f8('0x1f');var _0x2e0bd1=_0x4f88dc[_0x25f8('0x20')];var _0x2633db=_0x44f117?0x0:_0x59a038['offset'];var _0x138854=_0x44f117?_0x4f88dc[_0x25f8('0x20')]:_0x59a038['offset']+_0x59a038[_0x25f8('0x1e')];var _0x44e6c0;if(_0x138854>=_0x2e0bd1){_0x138854=_0x2e0bd1;_0x44e6c0=0xc8;}else{_0x44e6c0=0xce;}_0x4f3161[_0x25f8('0x1a')](_0x44e6c0);return _0x4f3161['set'](_0x25f8('0x21'),_0x2633db+'-'+_0x138854+'/'+_0x2e0bd1)[_0x25f8('0x1c')](_0x4f88dc);}return null;};}function patchUpdates(_0x58b89e){return function(_0x4ceec0){try{jsonpatch[_0x25f8('0x22')](_0x4ceec0,_0x58b89e,!![]);}catch(_0x5060f6){return BPromise[_0x25f8('0x23')](_0x5060f6);}return _0x4ceec0[_0x25f8('0x24')]();};}function saveUpdates(_0x367e02,_0x35c3b1){return function(_0x503564){if(_0x503564){return _0x503564[_0x25f8('0x25')](_0x367e02)[_0x25f8('0x26')](function(_0x475e65){return _0x475e65;});}return null;};}function removeEntity(_0x3d83be,_0x191b0d){return function(_0x26a351){if(_0x26a351){return _0x26a351[_0x25f8('0x27')]()[_0x25f8('0x26')](function(){_0x3d83be[_0x25f8('0x1a')](0xcc)[_0x25f8('0x1b')]();});}};}function handleEntityNotFound(_0x10495e,_0x3672b1){return function(_0x43859f){if(!_0x43859f){_0x10495e['sendStatus'](0x194);}return _0x43859f;};}function handleError(_0x158faa,_0xa09b98){_0xa09b98=_0xa09b98||0x1f4;return function(_0x155b22){logger['error'](_0x155b22[_0x25f8('0x28')]);if(_0x155b22[_0x25f8('0x29')]){delete _0x155b22[_0x25f8('0x29')];}_0x158faa[_0x25f8('0x1a')](_0xa09b98)['send'](_0x155b22);};}exports[_0x25f8('0x2a')]=function(_0x21b16a,_0x2e8814){var _0x4c389c={},_0x4be0db={},_0x6d8acb={'count':0x0,'rows':[]};var _0x1e13ea=_[_0x25f8('0x2b')](db[_0x25f8('0x2c')][_0x25f8('0x2d')],function(_0x201807){return{'name':_0x201807[_0x25f8('0x2e')],'type':_0x201807[_0x25f8('0x2f')][_0x25f8('0x30')]};});_0x4be0db[_0x25f8('0x31')]=_[_0x25f8('0x2b')](_0x1e13ea,'name');_0x4be0db['query']=_[_0x25f8('0x32')](_0x21b16a[_0x25f8('0x33')]);_0x4be0db[_0x25f8('0x34')]=_[_0x25f8('0x35')](_0x4be0db['model'],_0x4be0db[_0x25f8('0x33')]);_0x4c389c[_0x25f8('0x36')]=_[_0x25f8('0x35')](_0x4be0db[_0x25f8('0x31')],qs['fields'](_0x21b16a[_0x25f8('0x33')][_0x25f8('0x37')]));_0x4c389c[_0x25f8('0x36')]=_0x4c389c['attributes'][_0x25f8('0x38')]?_0x4c389c[_0x25f8('0x36')]:_0x4be0db[_0x25f8('0x31')];if(!_0x21b16a['query'][_0x25f8('0x39')](_0x25f8('0x3a'))){_0x4c389c[_0x25f8('0x1e')]=qs[_0x25f8('0x1e')](_0x21b16a['query'][_0x25f8('0x1e')]);_0x4c389c['offset']=qs[_0x25f8('0x1d')](_0x21b16a[_0x25f8('0x33')][_0x25f8('0x1d')]);}_0x4c389c[_0x25f8('0x3b')]=qs[_0x25f8('0x3c')](_0x21b16a['query'][_0x25f8('0x3c')]);_0x4c389c[_0x25f8('0x3d')]=qs['filters'](_[_0x25f8('0x3e')](_0x21b16a['query'],_0x4be0db[_0x25f8('0x34')]),_0x1e13ea);if(_0x21b16a[_0x25f8('0x33')]['filter']){_0x4c389c[_0x25f8('0x3d')]=_[_0x25f8('0x3f')](_0x4c389c[_0x25f8('0x3d')],{'$or':_['map'](_0x1e13ea,function(_0x458f57){if(_0x458f57[_0x25f8('0x2f')]!==_0x25f8('0x40')){var _0x55629e={};_0x55629e[_0x458f57[_0x25f8('0x29')]]={'$like':'%'+_0x21b16a[_0x25f8('0x33')]['filter']+'%'};return _0x55629e;}})});}_0x4c389c=_[_0x25f8('0x3f')]({},_0x4c389c,_0x21b16a[_0x25f8('0x41')]);var _0x351ed1={'where':_0x4c389c[_0x25f8('0x3d')]};return db[_0x25f8('0x2c')][_0x25f8('0x20')](_0x351ed1)['then'](function(_0x4cedf2){_0x6d8acb['count']=_0x4cedf2;if(_0x21b16a[_0x25f8('0x33')]['includeAll']){_0x4c389c['include']=[{'all':!![]}];}return db[_0x25f8('0x2c')][_0x25f8('0x42')](_0x4c389c);})[_0x25f8('0x26')](function(_0x17e5d1){_0x6d8acb['rows']=_0x17e5d1;return _0x6d8acb;})[_0x25f8('0x26')](respondWithFilteredResult(_0x2e8814,_0x4c389c))[_0x25f8('0x43')](handleError(_0x2e8814,null));};exports[_0x25f8('0x44')]=function(_0x4eda9e,_0x23629c){var _0x11b467={'raw':!![],'where':{'id':_0x4eda9e['params']['id']}},_0x2581b1={};_0x2581b1[_0x25f8('0x31')]=_[_0x25f8('0x32')](db[_0x25f8('0x2c')][_0x25f8('0x2d')]);_0x2581b1[_0x25f8('0x33')]=_[_0x25f8('0x32')](_0x4eda9e['query']);_0x2581b1[_0x25f8('0x34')]=_[_0x25f8('0x35')](_0x2581b1['model'],_0x2581b1[_0x25f8('0x33')]);_0x11b467[_0x25f8('0x36')]=_[_0x25f8('0x35')](_0x2581b1[_0x25f8('0x31')],qs[_0x25f8('0x37')](_0x4eda9e[_0x25f8('0x33')][_0x25f8('0x37')]));_0x11b467[_0x25f8('0x36')]=_0x11b467[_0x25f8('0x36')]['length']?_0x11b467[_0x25f8('0x36')]:_0x2581b1[_0x25f8('0x31')];if(_0x4eda9e['query'][_0x25f8('0x45')]){_0x11b467['include']=[{'all':!![]}];}_0x11b467=_[_0x25f8('0x3f')]({},_0x11b467,_0x4eda9e[_0x25f8('0x41')]);return db[_0x25f8('0x2c')][_0x25f8('0x46')](_0x11b467)[_0x25f8('0x26')](handleEntityNotFound(_0x23629c,null))[_0x25f8('0x26')](respondWithResult(_0x23629c,null))['catch'](handleError(_0x23629c,null));};exports['create']=function(_0xb30525,_0x455cf6){return db[_0x25f8('0x2c')][_0x25f8('0x47')](_0xb30525['body'],{})[_0x25f8('0x26')](respondWithResult(_0x455cf6,0xc9))[_0x25f8('0x43')](handleError(_0x455cf6,null));};exports[_0x25f8('0x25')]=function(_0x1003cc,_0x1ebecb){if(_0x1003cc['body']['id']){delete _0x1003cc[_0x25f8('0x48')]['id'];}return db[_0x25f8('0x2c')][_0x25f8('0x46')]({'where':{'id':_0x1003cc[_0x25f8('0x49')]['id']}})[_0x25f8('0x26')](handleEntityNotFound(_0x1ebecb,null))[_0x25f8('0x26')](saveUpdates(_0x1003cc['body'],null))[_0x25f8('0x26')](respondWithResult(_0x1ebecb,null))[_0x25f8('0x43')](handleError(_0x1ebecb,null));};exports[_0x25f8('0x27')]=function(_0x90696f,_0x533b4a){return db['SquareReport'][_0x25f8('0x46')]({'where':{'id':_0x90696f[_0x25f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x533b4a,null))[_0x25f8('0x26')](removeEntity(_0x533b4a,null))['catch'](handleError(_0x533b4a,null));};exports['describe']=function(_0x4a3a1b,_0x7e585f){return db['SquareReport']['describe']()[_0x25f8('0x26')](respondWithResult(_0x7e585f,null))['catch'](handleError(_0x7e585f,null));}; \ No newline at end of file +var _0x81c7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','update','then','end','error','stack','name','send','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x81c7,0x12b));var _0x781c=function(_0x6bbc3c,_0x22325e){_0x6bbc3c=_0x6bbc3c-0x0;var _0x19c8aa=_0x81c7[_0x6bbc3c];return _0x19c8aa;};'use strict';var emlformat=require(_0x781c('0x0'));var rimraf=require(_0x781c('0x1'));var zipdir=require(_0x781c('0x2'));var jsonpatch=require(_0x781c('0x3'));var rp=require(_0x781c('0x4'));var moment=require(_0x781c('0x5'));var BPromise=require(_0x781c('0x6'));var Mustache=require(_0x781c('0x7'));var util=require(_0x781c('0x8'));var path=require(_0x781c('0x9'));var sox=require(_0x781c('0xa'));var csv=require(_0x781c('0xb'));var ejs=require(_0x781c('0xc'));var fs=require('fs');var fs_extra=require(_0x781c('0xd'));var _=require(_0x781c('0xe'));var squel=require(_0x781c('0xf'));var crypto=require(_0x781c('0x10'));var jsforce=require(_0x781c('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x781c('0x12'));var Papa=require(_0x781c('0x13'));var Redis=require(_0x781c('0x14'));var authService=require(_0x781c('0x15'));var qs=require(_0x781c('0x16'));var as=require(_0x781c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x781c('0x18'))('api');var utils=require(_0x781c('0x19'));var config=require(_0x781c('0x1a'));var licenseUtil=require(_0x781c('0x1b'));var db=require(_0x781c('0x1c'))['db'];function respondWithStatusCode(_0x3a5458,_0x2b87f0){_0x2b87f0=_0x2b87f0||0xcc;return function(_0x33d898){if(_0x33d898){return _0x3a5458['sendStatus'](_0x2b87f0);}return _0x3a5458[_0x781c('0x1d')](_0x2b87f0)['end']();};}function respondWithResult(_0x55ccd9,_0x4b09a5){_0x4b09a5=_0x4b09a5||0xc8;return function(_0x256aca){if(_0x256aca){return _0x55ccd9[_0x781c('0x1d')](_0x4b09a5)[_0x781c('0x1e')](_0x256aca);}};}function respondWithFilteredResult(_0x6ab8b1,_0x54cff4){return function(_0x37e36c){if(_0x37e36c){var _0xd053bd=typeof _0x54cff4[_0x781c('0x1f')]===_0x781c('0x20')&&typeof _0x54cff4[_0x781c('0x21')]===_0x781c('0x20');var _0x294727=_0x37e36c['count'];var _0x2f219d=_0xd053bd?0x0:_0x54cff4[_0x781c('0x1f')];var _0x408691=_0xd053bd?_0x37e36c[_0x781c('0x22')]:_0x54cff4['offset']+_0x54cff4[_0x781c('0x21')];var _0xd18b32;if(_0x408691>=_0x294727){_0x408691=_0x294727;_0xd18b32=0xc8;}else{_0xd18b32=0xce;}_0x6ab8b1['status'](_0xd18b32);return _0x6ab8b1[_0x781c('0x23')]('Content-Range',_0x2f219d+'-'+_0x408691+'/'+_0x294727)['json'](_0x37e36c);}return null;};}function patchUpdates(_0xba92d9){return function(_0x415fd8){try{jsonpatch[_0x781c('0x24')](_0x415fd8,_0xba92d9,!![]);}catch(_0x40834c){return BPromise['reject'](_0x40834c);}return _0x415fd8[_0x781c('0x25')]();};}function saveUpdates(_0x543628,_0x4aef09){return function(_0x10fa0a){if(_0x10fa0a){return _0x10fa0a[_0x781c('0x26')](_0x543628)[_0x781c('0x27')](function(_0x2e9e9e){return _0x2e9e9e;});}return null;};}function removeEntity(_0x2d4b54,_0x332e59){return function(_0x12b16){if(_0x12b16){return _0x12b16['destroy']()[_0x781c('0x27')](function(){_0x2d4b54[_0x781c('0x1d')](0xcc)[_0x781c('0x28')]();});}};}function handleEntityNotFound(_0x2e9a66,_0xfda8c9){return function(_0xa82fd6){if(!_0xa82fd6){_0x2e9a66['sendStatus'](0x194);}return _0xa82fd6;};}function handleError(_0x34d2fc,_0x3af50f){_0x3af50f=_0x3af50f||0x1f4;return function(_0xe46496){logger[_0x781c('0x29')](_0xe46496[_0x781c('0x2a')]);if(_0xe46496['name']){delete _0xe46496[_0x781c('0x2b')];}_0x34d2fc[_0x781c('0x1d')](_0x3af50f)[_0x781c('0x2c')](_0xe46496);};}exports[_0x781c('0x2d')]=function(_0x4fb676,_0x4e2761){var _0x2d0317={},_0x20e824={},_0x369158={'count':0x0,'rows':[]};var _0x2b9507=_[_0x781c('0x2e')](db[_0x781c('0x2f')]['rawAttributes'],function(_0x4c83da){return{'name':_0x4c83da[_0x781c('0x30')],'type':_0x4c83da[_0x781c('0x31')][_0x781c('0x32')]};});_0x20e824[_0x781c('0x33')]=_['map'](_0x2b9507,_0x781c('0x2b'));_0x20e824[_0x781c('0x34')]=_[_0x781c('0x35')](_0x4fb676['query']);_0x20e824[_0x781c('0x36')]=_['intersection'](_0x20e824['model'],_0x20e824['query']);_0x2d0317[_0x781c('0x37')]=_[_0x781c('0x38')](_0x20e824[_0x781c('0x33')],qs[_0x781c('0x39')](_0x4fb676['query'][_0x781c('0x39')]));_0x2d0317['attributes']=_0x2d0317[_0x781c('0x37')][_0x781c('0x3a')]?_0x2d0317[_0x781c('0x37')]:_0x20e824[_0x781c('0x33')];if(!_0x4fb676['query'][_0x781c('0x3b')]('nolimit')){_0x2d0317['limit']=qs[_0x781c('0x21')](_0x4fb676[_0x781c('0x34')][_0x781c('0x21')]);_0x2d0317[_0x781c('0x1f')]=qs[_0x781c('0x1f')](_0x4fb676[_0x781c('0x34')][_0x781c('0x1f')]);}_0x2d0317[_0x781c('0x3c')]=qs[_0x781c('0x3d')](_0x4fb676[_0x781c('0x34')]['sort']);_0x2d0317[_0x781c('0x3e')]=qs['filters'](_[_0x781c('0x3f')](_0x4fb676[_0x781c('0x34')],_0x20e824[_0x781c('0x36')]),_0x2b9507);if(_0x4fb676[_0x781c('0x34')][_0x781c('0x40')]){_0x2d0317[_0x781c('0x3e')]=_[_0x781c('0x41')](_0x2d0317[_0x781c('0x3e')],{'$or':_['map'](_0x2b9507,function(_0x2f7ff1){if(_0x2f7ff1[_0x781c('0x31')]!=='VIRTUAL'){var _0x1c6601={};_0x1c6601[_0x2f7ff1[_0x781c('0x2b')]]={'$like':'%'+_0x4fb676['query']['filter']+'%'};return _0x1c6601;}})});}_0x2d0317=_[_0x781c('0x41')]({},_0x2d0317,_0x4fb676[_0x781c('0x42')]);var _0x561ba8={'where':_0x2d0317['where']};return db[_0x781c('0x2f')][_0x781c('0x22')](_0x561ba8)[_0x781c('0x27')](function(_0x5c7fdd){_0x369158['count']=_0x5c7fdd;if(_0x4fb676['query'][_0x781c('0x43')]){_0x2d0317[_0x781c('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x781c('0x45')](_0x2d0317);})[_0x781c('0x27')](function(_0x108698){_0x369158[_0x781c('0x46')]=_0x108698;return _0x369158;})[_0x781c('0x27')](respondWithFilteredResult(_0x4e2761,_0x2d0317))[_0x781c('0x47')](handleError(_0x4e2761,null));};exports[_0x781c('0x48')]=function(_0x418be6,_0x446c31){var _0x4865f0={'raw':!![],'where':{'id':_0x418be6['params']['id']}},_0x1a7c3a={};_0x1a7c3a[_0x781c('0x33')]=_['keys'](db[_0x781c('0x2f')][_0x781c('0x49')]);_0x1a7c3a[_0x781c('0x34')]=_[_0x781c('0x35')](_0x418be6['query']);_0x1a7c3a['filters']=_['intersection'](_0x1a7c3a[_0x781c('0x33')],_0x1a7c3a[_0x781c('0x34')]);_0x4865f0[_0x781c('0x37')]=_['intersection'](_0x1a7c3a['model'],qs[_0x781c('0x39')](_0x418be6[_0x781c('0x34')][_0x781c('0x39')]));_0x4865f0[_0x781c('0x37')]=_0x4865f0[_0x781c('0x37')][_0x781c('0x3a')]?_0x4865f0[_0x781c('0x37')]:_0x1a7c3a['model'];if(_0x418be6['query']['includeAll']){_0x4865f0[_0x781c('0x44')]=[{'all':!![]}];}_0x4865f0=_['merge']({},_0x4865f0,_0x418be6[_0x781c('0x42')]);return db['SquareReport'][_0x781c('0x4a')](_0x4865f0)[_0x781c('0x27')](handleEntityNotFound(_0x446c31,null))['then'](respondWithResult(_0x446c31,null))[_0x781c('0x47')](handleError(_0x446c31,null));};exports[_0x781c('0x4b')]=function(_0x53d04e,_0x337841){return db['SquareReport'][_0x781c('0x4b')](_0x53d04e['body'],{})['then'](respondWithResult(_0x337841,0xc9))[_0x781c('0x47')](handleError(_0x337841,null));};exports[_0x781c('0x26')]=function(_0x2d5998,_0x19cc72){if(_0x2d5998[_0x781c('0x4c')]['id']){delete _0x2d5998[_0x781c('0x4c')]['id'];}return db[_0x781c('0x2f')][_0x781c('0x4a')]({'where':{'id':_0x2d5998[_0x781c('0x4d')]['id']}})[_0x781c('0x27')](handleEntityNotFound(_0x19cc72,null))[_0x781c('0x27')](saveUpdates(_0x2d5998[_0x781c('0x4c')],null))['then'](respondWithResult(_0x19cc72,null))[_0x781c('0x47')](handleError(_0x19cc72,null));};exports[_0x781c('0x4e')]=function(_0x4a0bf4,_0x11fc3d){return db[_0x781c('0x2f')][_0x781c('0x4a')]({'where':{'id':_0x4a0bf4[_0x781c('0x4d')]['id']}})[_0x781c('0x27')](handleEntityNotFound(_0x11fc3d,null))[_0x781c('0x27')](removeEntity(_0x11fc3d,null))[_0x781c('0x47')](handleError(_0x11fc3d,null));};exports[_0x781c('0x4f')]=function(_0x16bba8,_0x1ac73d){return db[_0x781c('0x2f')][_0x781c('0x4f')]()[_0x781c('0x27')](respondWithResult(_0x1ac73d,null))[_0x781c('0x47')](handleError(_0x1ac73d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 15d8360..b025755 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 _0xfe2c=['bluebird','rimraf','../../config/environment','./squareReport.attributes','SquareReport','uid_pname','uniqueid','project_name','lodash','api','moment'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0xfe2c,0x168));var _0xcfe2=function(_0x212a80,_0x45235a){_0x212a80=_0x212a80-0x0;var _0xcac84a=_0xfe2c[_0x212a80];return _0xcac84a;};'use strict';var _=require(_0xcfe2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcfe2('0x1'));var moment=require(_0xcfe2('0x2'));var BPromise=require(_0xcfe2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcfe2('0x4'));var config=require(_0xcfe2('0x5'));var attributes=require(_0xcfe2('0x6'));module['exports']=function(_0x393d0b,_0x6aa05d){return _0x393d0b['define'](_0xcfe2('0x7'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xcfe2('0x8'),'fields':[_0xcfe2('0x9'),_0xcfe2('0xa')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a51=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','project_name','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c315a,_0x187fc3){var _0x2310d8=function(_0x35006d){while(--_0x35006d){_0x4c315a['push'](_0x4c315a['shift']());}};_0x2310d8(++_0x187fc3);}(_0x2a51,0x1ab));var _0x12a5=function(_0x4ff2a4,_0x27fbd0){_0x4ff2a4=_0x4ff2a4-0x0;var _0x578342=_0x2a51[_0x4ff2a4];return _0x578342;};'use strict';var _=require('lodash');var util=require(_0x12a5('0x0'));var logger=require(_0x12a5('0x1'))(_0x12a5('0x2'));var moment=require(_0x12a5('0x3'));var BPromise=require(_0x12a5('0x4'));var rp=require(_0x12a5('0x5'));var fs=require('fs');var path=require(_0x12a5('0x6'));var rimraf=require('rimraf');var config=require(_0x12a5('0x7'));var attributes=require(_0x12a5('0x8'));module[_0x12a5('0x9')]=function(_0x2dcb3a,_0x45da06){return _0x2dcb3a[_0x12a5('0xa')]('SquareReport',attributes,{'tableName':_0x12a5('0xb'),'paranoid':![],'indexes':[{'name':_0x12a5('0xc'),'fields':['uniqueid',_0x12a5('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 090f302..0f3570a 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 _0x87a5=['stringify','error','code','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','SquareReport','create','body','options','info','debug','UpdateSquareReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87a5,0xb3));var _0x587a=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x87a5[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0x587a('0x0'));var moment=require(_0x587a('0x1'));var BPromise=require(_0x587a('0x2'));var rs=require(_0x587a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x587a('0x4'));var logger=require(_0x587a('0x5'))(_0x587a('0x6'));var config=require('../../config/environment');var jayson=require(_0x587a('0x7'));var client=jayson['client'][_0x587a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x506bce,_0x542580,_0x4778a8){return new BPromise(function(_0x4c4fe6,_0x308e8c){return client[_0x587a('0x9')](_0x506bce,_0x4778a8)[_0x587a('0xa')](function(_0x3b7ae4){logger['info']('SquareReport,\x20%s,\x20%s',_0x542580,_0x587a('0xb'));logger['debug'](_0x587a('0xc'),_0x542580,'request\x20sent',JSON[_0x587a('0xd')](_0x3b7ae4));if(_0x3b7ae4[_0x587a('0xe')]){if(_0x3b7ae4[_0x587a('0xe')][_0x587a('0xf')]===0x1f4){logger[_0x587a('0xe')](_0x587a('0x10'),_0x542580,_0x3b7ae4[_0x587a('0xe')]['message']);return _0x308e8c(_0x3b7ae4[_0x587a('0xe')]['message']);}logger[_0x587a('0xe')](_0x587a('0x10'),_0x542580,_0x3b7ae4[_0x587a('0xe')][_0x587a('0x11')]);return _0x4c4fe6(_0x3b7ae4['error'][_0x587a('0x11')]);}else{logger['info'](_0x587a('0x10'),_0x542580,'request\x20sent');_0x4c4fe6(_0x3b7ae4['result'][_0x587a('0x11')]);}})[_0x587a('0x12')](function(_0x1d320b){logger[_0x587a('0xe')](_0x587a('0x10'),_0x542580,_0x1d320b);_0x308e8c(_0x1d320b);});});}exports[_0x587a('0x13')]=function(_0x54c431){var _0x33ccee=this;return new Promise(function(_0x327dc9,_0x9e8251){return db[_0x587a('0x14')][_0x587a('0x15')](_0x54c431[_0x587a('0x16')],{'raw':_0x54c431[_0x587a('0x17')]?_0x54c431[_0x587a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x587a('0xa')](function(_0x1389e0){logger[_0x587a('0x18')](_0x587a('0x13'),_0x54c431);logger[_0x587a('0x19')]('CreateSquareReport',_0x54c431,JSON[_0x587a('0xd')](_0x1389e0));_0x327dc9(_0x1389e0);})[_0x587a('0x12')](function(_0x517fd0){logger[_0x587a('0xe')](_0x587a('0x13'),_0x517fd0[_0x587a('0x11')],_0x54c431);_0x9e8251(_0x33ccee[_0x587a('0xe')](0x1f4,_0x517fd0[_0x587a('0x11')]));});});};exports[_0x587a('0x1a')]=function(_0x3e1c20){var _0x574828=this;return new Promise(function(_0x541157,_0x7bd867){return db['SquareReport'][_0x587a('0x1b')](_0x3e1c20[_0x587a('0x16')],{'raw':_0x3e1c20['options']?_0x3e1c20[_0x587a('0x17')][_0x587a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e1c20[_0x587a('0x17')]?_0x3e1c20['options'][_0x587a('0x1d')]||null:null,'attributes':_0x3e1c20[_0x587a('0x17')]?_0x3e1c20[_0x587a('0x17')][_0x587a('0x1e')]||null:null,'limit':_0x3e1c20[_0x587a('0x17')]?_0x3e1c20[_0x587a('0x17')][_0x587a('0x1f')]||null:null})[_0x587a('0xa')](function(_0xfacece){logger[_0x587a('0x18')](_0x587a('0x1a'),_0x3e1c20);logger['debug']('UpdateSquareReport',_0x3e1c20,JSON[_0x587a('0xd')](_0xfacece));_0x541157(_0xfacece);})[_0x587a('0x12')](function(_0x405be4){logger[_0x587a('0xe')](_0x587a('0x1a'),_0x405be4['message'],_0x3e1c20);_0x7bd867(_0x574828['error'](0x1f4,_0x405be4['message']));});});}; \ No newline at end of file +var _0xbe2f=['raw','then','debug','where','attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options'];(function(_0x50f211,_0x308322){var _0x3ba891=function(_0x510968){while(--_0x510968){_0x50f211['push'](_0x50f211['shift']());}};_0x3ba891(++_0x308322);}(_0xbe2f,0x1ab));var _0xfbe2=function(_0x2b1f0f,_0x29d810){_0x2b1f0f=_0x2b1f0f-0x0;var _0x28be53=_0xbe2f[_0x2b1f0f];return _0x28be53;};'use strict';var _=require(_0xfbe2('0x0'));var util=require(_0xfbe2('0x1'));var moment=require(_0xfbe2('0x2'));var BPromise=require(_0xfbe2('0x3'));var rs=require(_0xfbe2('0x4'));var fs=require('fs');var Redis=require(_0xfbe2('0x5'));var db=require(_0xfbe2('0x6'))['db'];var utils=require(_0xfbe2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xfbe2('0x8'));var jayson=require(_0xfbe2('0x9'));var client=jayson[_0xfbe2('0xa')][_0xfbe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21a5a1,_0x2b6ed7,_0x464e10){return new BPromise(function(_0x2385a0,_0x31d2c3){return client[_0xfbe2('0xc')](_0x21a5a1,_0x464e10)['then'](function(_0x146b20){logger[_0xfbe2('0xd')](_0xfbe2('0xe'),_0x2b6ed7,_0xfbe2('0xf'));logger['debug'](_0xfbe2('0x10'),_0x2b6ed7,_0xfbe2('0xf'),JSON[_0xfbe2('0x11')](_0x146b20));if(_0x146b20[_0xfbe2('0x12')]){if(_0x146b20[_0xfbe2('0x12')][_0xfbe2('0x13')]===0x1f4){logger[_0xfbe2('0x12')](_0xfbe2('0xe'),_0x2b6ed7,_0x146b20[_0xfbe2('0x12')][_0xfbe2('0x14')]);return _0x31d2c3(_0x146b20[_0xfbe2('0x12')][_0xfbe2('0x14')]);}logger[_0xfbe2('0x12')](_0xfbe2('0xe'),_0x2b6ed7,_0x146b20[_0xfbe2('0x12')]['message']);return _0x2385a0(_0x146b20[_0xfbe2('0x12')][_0xfbe2('0x14')]);}else{logger[_0xfbe2('0xd')]('SquareReport,\x20%s,\x20%s',_0x2b6ed7,_0xfbe2('0xf'));_0x2385a0(_0x146b20[_0xfbe2('0x15')][_0xfbe2('0x14')]);}})[_0xfbe2('0x16')](function(_0x3f4084){logger['error'](_0xfbe2('0xe'),_0x2b6ed7,_0x3f4084);_0x31d2c3(_0x3f4084);});});}exports[_0xfbe2('0x17')]=function(_0x27f7f0){var _0x796414=this;return new Promise(function(_0xb7e53f,_0x3cbb6c){return db[_0xfbe2('0x18')][_0xfbe2('0x19')](_0x27f7f0[_0xfbe2('0x1a')],{'raw':_0x27f7f0[_0xfbe2('0x1b')]?_0x27f7f0[_0xfbe2('0x1b')][_0xfbe2('0x1c')]===undefined?!![]:![]:!![]})[_0xfbe2('0x1d')](function(_0x4b2bc9){logger[_0xfbe2('0xd')](_0xfbe2('0x17'),_0x27f7f0);logger[_0xfbe2('0x1e')](_0xfbe2('0x17'),_0x27f7f0,JSON[_0xfbe2('0x11')](_0x4b2bc9));_0xb7e53f(_0x4b2bc9);})['catch'](function(_0x455026){logger[_0xfbe2('0x12')](_0xfbe2('0x17'),_0x455026[_0xfbe2('0x14')],_0x27f7f0);_0x3cbb6c(_0x796414[_0xfbe2('0x12')](0x1f4,_0x455026['message']));});});};exports['UpdateSquareReport']=function(_0x29a308){var _0x40ccc0=this;return new Promise(function(_0x476609,_0x27ab46){return db[_0xfbe2('0x18')]['update'](_0x29a308[_0xfbe2('0x1a')],{'raw':_0x29a308[_0xfbe2('0x1b')]?_0x29a308['options'][_0xfbe2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a308[_0xfbe2('0x1b')]?_0x29a308['options'][_0xfbe2('0x1f')]||null:null,'attributes':_0x29a308['options']?_0x29a308[_0xfbe2('0x1b')][_0xfbe2('0x20')]||null:null,'limit':_0x29a308['options']?_0x29a308[_0xfbe2('0x1b')][_0xfbe2('0x21')]||null:null})[_0xfbe2('0x1d')](function(_0x1ae3ea){logger['info'](_0xfbe2('0x22'),_0x29a308);logger[_0xfbe2('0x1e')](_0xfbe2('0x22'),_0x29a308,JSON[_0xfbe2('0x11')](_0x1ae3ea));_0x476609(_0x1ae3ea);})[_0xfbe2('0x16')](function(_0x527350){logger[_0xfbe2('0x12')]('UpdateSquareReport',_0x527350[_0xfbe2('0x14')],_0x29a308);_0x27ab46(_0x40ccc0[_0xfbe2('0x12')](0x1f4,_0x527350[_0xfbe2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6537bb3..841fd6c 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 _0x9ab7=['Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x367cad,_0x23edf3){var _0x540d05=function(_0x20b6fc){while(--_0x20b6fc){_0x367cad['push'](_0x367cad['shift']());}};_0x540d05(++_0x23edf3);}(_0x9ab7,0xf8));var _0x79ab=function(_0x100278,_0x186c47){_0x100278=_0x100278-0x0;var _0x3b0556=_0x9ab7[_0x100278];return _0x3b0556;};'use strict';var multer=require(_0x79ab('0x0'));var util=require('util');var path=require(_0x79ab('0x1'));var timeout=require(_0x79ab('0x2'));var express=require(_0x79ab('0x3'));var router=express[_0x79ab('0x4')]();var fs_extra=require(_0x79ab('0x5'));var auth=require(_0x79ab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x79ab('0x7'));var controller=require(_0x79ab('0x8'));router[_0x79ab('0x9')]('/',auth['isAuthenticated'](),controller[_0x79ab('0xa')]);router[_0x79ab('0x9')](_0x79ab('0xb'),auth['isAuthenticated'](),controller[_0x79ab('0xc')]);router['get'](_0x79ab('0xd'),auth[_0x79ab('0xe')](),controller[_0x79ab('0xf')]);router[_0x79ab('0x10')]('/',auth[_0x79ab('0xe')](),controller['create']);router[_0x79ab('0x11')](_0x79ab('0xd'),auth[_0x79ab('0xe')](),controller[_0x79ab('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x79ab('0x13')]);module[_0x79ab('0x14')]=router; \ No newline at end of file +var _0x7ec7=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','describe','get','/:id','post','create','update','exports','util'];(function(_0x10de9c,_0x5a81b0){var _0x198a7e=function(_0x1c0c93){while(--_0x1c0c93){_0x10de9c['push'](_0x10de9c['shift']());}};_0x198a7e(++_0x5a81b0);}(_0x7ec7,0x131));var _0x77ec=function(_0x1a4cac,_0x116f47){_0x1a4cac=_0x1a4cac-0x0;var _0x142f2f=_0x7ec7[_0x1a4cac];return _0x142f2f;};'use strict';var multer=require('multer');var util=require(_0x77ec('0x0'));var path=require(_0x77ec('0x1'));var timeout=require(_0x77ec('0x2'));var express=require('express');var router=express[_0x77ec('0x3')]();var fs_extra=require(_0x77ec('0x4'));var auth=require(_0x77ec('0x5'));var interaction=require(_0x77ec('0x6'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x77ec('0x7')]);router['get'](_0x77ec('0x8'),auth[_0x77ec('0x9')](),controller[_0x77ec('0xa')]);router[_0x77ec('0xb')](_0x77ec('0xc'),auth[_0x77ec('0x9')](),controller['show']);router[_0x77ec('0xd')]('/',auth[_0x77ec('0x9')](),controller[_0x77ec('0xe')]);router['put'](_0x77ec('0xc'),auth['isAuthenticated'](),controller[_0x77ec('0xf')]);router['delete'](_0x77ec('0xc'),auth[_0x77ec('0x9')](),controller['destroy']);module[_0x77ec('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 99cec43..f3358b5 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 _0x92b9=['STRING','TEXT','exports'];(function(_0x3d55bd,_0x561577){var _0x4c7ba9=function(_0x52a4f8){while(--_0x52a4f8){_0x3d55bd['push'](_0x3d55bd['shift']());}};_0x4c7ba9(++_0x561577);}(_0x92b9,0x170));var _0x992b=function(_0x125c55,_0x911db0){_0x125c55=_0x125c55-0x0;var _0x2dfd5a=_0x92b9[_0x125c55];return _0x2dfd5a;};'use strict';var Sequelize=require('sequelize');module[_0x992b('0x0')]={'uniqueid':{'type':Sequelize[_0x992b('0x1')]},'node':{'type':Sequelize[_0x992b('0x1')]},'application':{'type':Sequelize[_0x992b('0x1')]},'data':{'type':Sequelize[_0x992b('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x992b('0x1')]}}; \ No newline at end of file +var _0x03ae=['TEXT','sequelize','exports','STRING'];(function(_0x5193d2,_0x27d826){var _0x49d7b2=function(_0x578e1b){while(--_0x578e1b){_0x5193d2['push'](_0x5193d2['shift']());}};_0x49d7b2(++_0x27d826);}(_0x03ae,0x135));var _0xe03a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x03ae[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xe03a('0x0'));module[_0xe03a('0x1')]={'uniqueid':{'type':Sequelize[_0xe03a('0x2')]},'node':{'type':Sequelize[_0xe03a('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xe03a('0x3')]},'project_name':{'type':Sequelize[_0xe03a('0x2')]},'callerid':{'type':Sequelize[_0xe03a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index faa1e32..e508428 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 _0x8987=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','keys','catch','create','body','update','params','destroy','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','apply','reject','then','error','stack','name','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit'];(function(_0xb11c19,_0x57e183){var _0x23be44=function(_0x543e64){while(--_0x543e64){_0xb11c19['push'](_0xb11c19['shift']());}};_0x23be44(++_0x57e183);}(_0x8987,0x192));var _0x7898=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x8987[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0x7898('0x0'));var rimraf=require(_0x7898('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7898('0x2'));var rp=require(_0x7898('0x3'));var moment=require('moment');var BPromise=require(_0x7898('0x4'));var Mustache=require(_0x7898('0x5'));var util=require(_0x7898('0x6'));var path=require(_0x7898('0x7'));var sox=require(_0x7898('0x8'));var csv=require(_0x7898('0x9'));var ejs=require(_0x7898('0xa'));var fs=require('fs');var fs_extra=require(_0x7898('0xb'));var _=require(_0x7898('0xc'));var squel=require(_0x7898('0xd'));var crypto=require(_0x7898('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7898('0x9'));var querystring=require(_0x7898('0xf'));var Papa=require(_0x7898('0x10'));var Redis=require(_0x7898('0x11'));var authService=require(_0x7898('0x12'));var qs=require(_0x7898('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7898('0x14'));var logger=require(_0x7898('0x15'))(_0x7898('0x16'));var utils=require(_0x7898('0x17'));var config=require(_0x7898('0x18'));var licenseUtil=require(_0x7898('0x19'));var db=require(_0x7898('0x1a'))['db'];function respondWithStatusCode(_0x14ff99,_0x11a9f1){_0x11a9f1=_0x11a9f1||0xcc;return function(_0x3f6728){if(_0x3f6728){return _0x14ff99[_0x7898('0x1b')](_0x11a9f1);}return _0x14ff99[_0x7898('0x1c')](_0x11a9f1)[_0x7898('0x1d')]();};}function respondWithResult(_0x4b1dcf,_0x1fecb3){_0x1fecb3=_0x1fecb3||0xc8;return function(_0x4104c0){if(_0x4104c0){return _0x4b1dcf[_0x7898('0x1c')](_0x1fecb3)[_0x7898('0x1e')](_0x4104c0);}};}function respondWithFilteredResult(_0xb8f30e,_0x3e5db9){return function(_0x45b42b){if(_0x45b42b){var _0x211706=typeof _0x3e5db9[_0x7898('0x1f')]===_0x7898('0x20')&&typeof _0x3e5db9[_0x7898('0x21')]==='undefined';var _0x2b17c7=_0x45b42b[_0x7898('0x22')];var _0x20207=_0x211706?0x0:_0x3e5db9[_0x7898('0x1f')];var _0x57945d=_0x211706?_0x45b42b[_0x7898('0x22')]:_0x3e5db9['offset']+_0x3e5db9['limit'];var _0xb3da63;if(_0x57945d>=_0x2b17c7){_0x57945d=_0x2b17c7;_0xb3da63=0xc8;}else{_0xb3da63=0xce;}_0xb8f30e[_0x7898('0x1c')](_0xb3da63);return _0xb8f30e[_0x7898('0x23')]('Content-Range',_0x20207+'-'+_0x57945d+'/'+_0x2b17c7)[_0x7898('0x1e')](_0x45b42b);}return null;};}function patchUpdates(_0x3cca70){return function(_0xe6213c){try{jsonpatch[_0x7898('0x24')](_0xe6213c,_0x3cca70,!![]);}catch(_0x3bde1f){return BPromise[_0x7898('0x25')](_0x3bde1f);}return _0xe6213c['save']();};}function saveUpdates(_0xe5b3c0,_0xa7499a){return function(_0x51e344){if(_0x51e344){return _0x51e344['update'](_0xe5b3c0)[_0x7898('0x26')](function(_0x1b0d41){return _0x1b0d41;});}return null;};}function removeEntity(_0x421f3a,_0x2b6c34){return function(_0x4285cc){if(_0x4285cc){return _0x4285cc['destroy']()[_0x7898('0x26')](function(){_0x421f3a['status'](0xcc)[_0x7898('0x1d')]();});}};}function handleEntityNotFound(_0x225513,_0x3f4b86){return function(_0x575b87){if(!_0x575b87){_0x225513[_0x7898('0x1b')](0x194);}return _0x575b87;};}function handleError(_0xf972af,_0x8a0f76){_0x8a0f76=_0x8a0f76||0x1f4;return function(_0x3a8f30){logger[_0x7898('0x27')](_0x3a8f30[_0x7898('0x28')]);if(_0x3a8f30[_0x7898('0x29')]){delete _0x3a8f30[_0x7898('0x29')];}_0xf972af[_0x7898('0x1c')](_0x8a0f76)['send'](_0x3a8f30);};}exports['index']=function(_0x3a26fc,_0x31b027){var _0x46f6af={},_0x4ff7f1={},_0xb74a5c={'count':0x0,'rows':[]};var _0x5416b3=_[_0x7898('0x2a')](db[_0x7898('0x2b')]['rawAttributes'],function(_0x4df645){return{'name':_0x4df645[_0x7898('0x2c')],'type':_0x4df645[_0x7898('0x2d')][_0x7898('0x2e')]};});_0x4ff7f1[_0x7898('0x2f')]=_[_0x7898('0x2a')](_0x5416b3,_0x7898('0x29'));_0x4ff7f1[_0x7898('0x30')]=_['keys'](_0x3a26fc[_0x7898('0x30')]);_0x4ff7f1[_0x7898('0x31')]=_[_0x7898('0x32')](_0x4ff7f1[_0x7898('0x2f')],_0x4ff7f1[_0x7898('0x30')]);_0x46f6af['attributes']=_[_0x7898('0x32')](_0x4ff7f1[_0x7898('0x2f')],qs['fields'](_0x3a26fc[_0x7898('0x30')][_0x7898('0x33')]));_0x46f6af[_0x7898('0x34')]=_0x46f6af[_0x7898('0x34')]['length']?_0x46f6af['attributes']:_0x4ff7f1['model'];if(!_0x3a26fc[_0x7898('0x30')]['hasOwnProperty'](_0x7898('0x35'))){_0x46f6af[_0x7898('0x21')]=qs[_0x7898('0x21')](_0x3a26fc['query']['limit']);_0x46f6af[_0x7898('0x1f')]=qs[_0x7898('0x1f')](_0x3a26fc[_0x7898('0x30')][_0x7898('0x1f')]);}_0x46f6af[_0x7898('0x36')]=qs['sort'](_0x3a26fc[_0x7898('0x30')][_0x7898('0x37')]);_0x46f6af[_0x7898('0x38')]=qs['filters'](_[_0x7898('0x39')](_0x3a26fc['query'],_0x4ff7f1[_0x7898('0x31')]),_0x5416b3);if(_0x3a26fc['query'][_0x7898('0x3a')]){_0x46f6af[_0x7898('0x38')]=_[_0x7898('0x3b')](_0x46f6af[_0x7898('0x38')],{'$or':_[_0x7898('0x2a')](_0x5416b3,function(_0xd18d1e){if(_0xd18d1e['type']!==_0x7898('0x3c')){var _0x2a4d41={};_0x2a4d41[_0xd18d1e[_0x7898('0x29')]]={'$like':'%'+_0x3a26fc['query'][_0x7898('0x3a')]+'%'};return _0x2a4d41;}})});}_0x46f6af=_[_0x7898('0x3b')]({},_0x46f6af,_0x3a26fc['options']);var _0x2a172d={'where':_0x46f6af[_0x7898('0x38')]};return db[_0x7898('0x2b')][_0x7898('0x22')](_0x2a172d)[_0x7898('0x26')](function(_0x4db9f2){_0xb74a5c['count']=_0x4db9f2;if(_0x3a26fc[_0x7898('0x30')][_0x7898('0x3d')]){_0x46f6af[_0x7898('0x3e')]=[{'all':!![]}];}return db[_0x7898('0x2b')][_0x7898('0x3f')](_0x46f6af);})[_0x7898('0x26')](function(_0x43cb8a){_0xb74a5c[_0x7898('0x40')]=_0x43cb8a;return _0xb74a5c;})['then'](respondWithFilteredResult(_0x31b027,_0x46f6af))['catch'](handleError(_0x31b027,null));};exports[_0x7898('0x41')]=function(_0x249995,_0x14812f){var _0x8d1133={'raw':!![],'where':{'id':_0x249995['params']['id']}},_0x5534bd={};_0x5534bd[_0x7898('0x2f')]=_['keys'](db[_0x7898('0x2b')][_0x7898('0x42')]);_0x5534bd['query']=_[_0x7898('0x43')](_0x249995[_0x7898('0x30')]);_0x5534bd[_0x7898('0x31')]=_[_0x7898('0x32')](_0x5534bd['model'],_0x5534bd[_0x7898('0x30')]);_0x8d1133[_0x7898('0x34')]=_[_0x7898('0x32')](_0x5534bd[_0x7898('0x2f')],qs[_0x7898('0x33')](_0x249995['query'][_0x7898('0x33')]));_0x8d1133[_0x7898('0x34')]=_0x8d1133[_0x7898('0x34')]['length']?_0x8d1133['attributes']:_0x5534bd[_0x7898('0x2f')];if(_0x249995[_0x7898('0x30')][_0x7898('0x3d')]){_0x8d1133[_0x7898('0x3e')]=[{'all':!![]}];}_0x8d1133=_[_0x7898('0x3b')]({},_0x8d1133,_0x249995['options']);return db[_0x7898('0x2b')]['find'](_0x8d1133)['then'](handleEntityNotFound(_0x14812f,null))[_0x7898('0x26')](respondWithResult(_0x14812f,null))[_0x7898('0x44')](handleError(_0x14812f,null));};exports[_0x7898('0x45')]=function(_0x48ded0,_0x4c1ae9){return db[_0x7898('0x2b')][_0x7898('0x45')](_0x48ded0[_0x7898('0x46')],{})['then'](respondWithResult(_0x4c1ae9,0xc9))[_0x7898('0x44')](handleError(_0x4c1ae9,null));};exports[_0x7898('0x47')]=function(_0x108f23,_0xd3472a){if(_0x108f23[_0x7898('0x46')]['id']){delete _0x108f23[_0x7898('0x46')]['id'];}return db[_0x7898('0x2b')]['find']({'where':{'id':_0x108f23[_0x7898('0x48')]['id']}})[_0x7898('0x26')](handleEntityNotFound(_0xd3472a,null))[_0x7898('0x26')](saveUpdates(_0x108f23['body'],null))['then'](respondWithResult(_0xd3472a,null))[_0x7898('0x44')](handleError(_0xd3472a,null));};exports[_0x7898('0x49')]=function(_0x1aebbb,_0x356052){return db[_0x7898('0x2b')][_0x7898('0x4a')]({'where':{'id':_0x1aebbb[_0x7898('0x48')]['id']}})[_0x7898('0x26')](handleEntityNotFound(_0x356052,null))[_0x7898('0x26')](removeEntity(_0x356052,null))['catch'](handleError(_0x356052,null));};exports[_0x7898('0x4b')]=function(_0x9cba19,_0x42d564){return db[_0x7898('0x2b')][_0x7898('0x4b')]()[_0x7898('0x26')](respondWithResult(_0x42d564,null))[_0x7898('0x44')](handleError(_0x42d564,null));}; \ No newline at end of file +var _0x93d3=['intersection','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','include','findAll','rows','catch','params','rawAttributes','fields','length','includeAll','create','body','find','describe','eml-format','zip-dir','mustache','util','path','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','index','map','SquareDetailsReport','fieldName','key','model','keys','query','filters'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x93d3,0x1e9));var _0x393d=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x93d3[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0x393d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x393d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x393d('0x2'));var util=require(_0x393d('0x3'));var path=require(_0x393d('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('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x393d('0x5'));var deskjs=require('desk.js');var toCsv=require(_0x393d('0x6'));var querystring=require(_0x393d('0x7'));var Papa=require('papaparse');var Redis=require(_0x393d('0x8'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x393d('0x9'));var hardwareService=require(_0x393d('0xa'));var logger=require(_0x393d('0xb'))('api');var utils=require(_0x393d('0xc'));var config=require(_0x393d('0xd'));var licenseUtil=require(_0x393d('0xe'));var db=require(_0x393d('0xf'))['db'];function respondWithStatusCode(_0x578a43,_0x39b8b3){_0x39b8b3=_0x39b8b3||0xcc;return function(_0x3cf62a){if(_0x3cf62a){return _0x578a43[_0x393d('0x10')](_0x39b8b3);}return _0x578a43[_0x393d('0x11')](_0x39b8b3)['end']();};}function respondWithResult(_0x17bc58,_0x483596){_0x483596=_0x483596||0xc8;return function(_0x3417b6){if(_0x3417b6){return _0x17bc58[_0x393d('0x11')](_0x483596)[_0x393d('0x12')](_0x3417b6);}};}function respondWithFilteredResult(_0x56ba70,_0x216159){return function(_0x2afa31){if(_0x2afa31){var _0x5c4802=typeof _0x216159[_0x393d('0x13')]===_0x393d('0x14')&&typeof _0x216159['limit']===_0x393d('0x14');var _0x5f239e=_0x2afa31[_0x393d('0x15')];var _0x596f2f=_0x5c4802?0x0:_0x216159[_0x393d('0x13')];var _0xa68587=_0x5c4802?_0x2afa31[_0x393d('0x15')]:_0x216159[_0x393d('0x13')]+_0x216159['limit'];var _0x42fc17;if(_0xa68587>=_0x5f239e){_0xa68587=_0x5f239e;_0x42fc17=0xc8;}else{_0x42fc17=0xce;}_0x56ba70['status'](_0x42fc17);return _0x56ba70['set'](_0x393d('0x16'),_0x596f2f+'-'+_0xa68587+'/'+_0x5f239e)[_0x393d('0x12')](_0x2afa31);}return null;};}function patchUpdates(_0x420ee1){return function(_0x38d550){try{jsonpatch[_0x393d('0x17')](_0x38d550,_0x420ee1,!![]);}catch(_0x5d69fd){return BPromise[_0x393d('0x18')](_0x5d69fd);}return _0x38d550[_0x393d('0x19')]();};}function saveUpdates(_0x4b7ec9,_0xd4f173){return function(_0x4e29a2){if(_0x4e29a2){return _0x4e29a2[_0x393d('0x1a')](_0x4b7ec9)[_0x393d('0x1b')](function(_0x726e8f){return _0x726e8f;});}return null;};}function removeEntity(_0x58e451,_0x4da66c){return function(_0x3bee2f){if(_0x3bee2f){return _0x3bee2f[_0x393d('0x1c')]()[_0x393d('0x1b')](function(){_0x58e451['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6b36,_0x35f7ae){return function(_0x416c79){if(!_0x416c79){_0x5b6b36[_0x393d('0x10')](0x194);}return _0x416c79;};}function handleError(_0x375da0,_0x5da764){_0x5da764=_0x5da764||0x1f4;return function(_0x21b0c2){logger['error'](_0x21b0c2[_0x393d('0x1d')]);if(_0x21b0c2['name']){delete _0x21b0c2['name'];}_0x375da0[_0x393d('0x11')](_0x5da764)['send'](_0x21b0c2);};}exports[_0x393d('0x1e')]=function(_0x108884,_0x57bfa2){var _0x4e0e24={},_0x158e26={},_0x35a05d={'count':0x0,'rows':[]};var _0x4e1eb9=_[_0x393d('0x1f')](db[_0x393d('0x20')]['rawAttributes'],function(_0x461d4e){return{'name':_0x461d4e[_0x393d('0x21')],'type':_0x461d4e['type'][_0x393d('0x22')]};});_0x158e26[_0x393d('0x23')]=_['map'](_0x4e1eb9,'name');_0x158e26['query']=_[_0x393d('0x24')](_0x108884[_0x393d('0x25')]);_0x158e26[_0x393d('0x26')]=_[_0x393d('0x27')](_0x158e26['model'],_0x158e26[_0x393d('0x25')]);_0x4e0e24['attributes']=_[_0x393d('0x27')](_0x158e26[_0x393d('0x23')],qs['fields'](_0x108884[_0x393d('0x25')]['fields']));_0x4e0e24[_0x393d('0x28')]=_0x4e0e24[_0x393d('0x28')]['length']?_0x4e0e24[_0x393d('0x28')]:_0x158e26['model'];if(!_0x108884['query'][_0x393d('0x29')]('nolimit')){_0x4e0e24['limit']=qs[_0x393d('0x2a')](_0x108884[_0x393d('0x25')][_0x393d('0x2a')]);_0x4e0e24[_0x393d('0x13')]=qs['offset'](_0x108884[_0x393d('0x25')][_0x393d('0x13')]);}_0x4e0e24[_0x393d('0x2b')]=qs[_0x393d('0x2c')](_0x108884[_0x393d('0x25')][_0x393d('0x2c')]);_0x4e0e24[_0x393d('0x2d')]=qs[_0x393d('0x26')](_[_0x393d('0x2e')](_0x108884['query'],_0x158e26[_0x393d('0x26')]),_0x4e1eb9);if(_0x108884[_0x393d('0x25')][_0x393d('0x2f')]){_0x4e0e24[_0x393d('0x2d')]=_[_0x393d('0x30')](_0x4e0e24[_0x393d('0x2d')],{'$or':_[_0x393d('0x1f')](_0x4e1eb9,function(_0x1f6205){if(_0x1f6205[_0x393d('0x31')]!==_0x393d('0x32')){var _0x4cbec8={};_0x4cbec8[_0x1f6205[_0x393d('0x33')]]={'$like':'%'+_0x108884[_0x393d('0x25')][_0x393d('0x2f')]+'%'};return _0x4cbec8;}})});}_0x4e0e24=_['merge']({},_0x4e0e24,_0x108884[_0x393d('0x34')]);var _0x165728={'where':_0x4e0e24[_0x393d('0x2d')]};return db['SquareDetailsReport'][_0x393d('0x15')](_0x165728)[_0x393d('0x1b')](function(_0x4bedf2){_0x35a05d[_0x393d('0x15')]=_0x4bedf2;if(_0x108884[_0x393d('0x25')]['includeAll']){_0x4e0e24[_0x393d('0x35')]=[{'all':!![]}];}return db[_0x393d('0x20')][_0x393d('0x36')](_0x4e0e24);})[_0x393d('0x1b')](function(_0x2f40c0){_0x35a05d[_0x393d('0x37')]=_0x2f40c0;return _0x35a05d;})['then'](respondWithFilteredResult(_0x57bfa2,_0x4e0e24))[_0x393d('0x38')](handleError(_0x57bfa2,null));};exports['show']=function(_0x13c3b4,_0x372dc5){var _0x36589b={'raw':!![],'where':{'id':_0x13c3b4[_0x393d('0x39')]['id']}},_0x257f8a={};_0x257f8a['model']=_['keys'](db[_0x393d('0x20')][_0x393d('0x3a')]);_0x257f8a[_0x393d('0x25')]=_[_0x393d('0x24')](_0x13c3b4[_0x393d('0x25')]);_0x257f8a[_0x393d('0x26')]=_[_0x393d('0x27')](_0x257f8a[_0x393d('0x23')],_0x257f8a[_0x393d('0x25')]);_0x36589b[_0x393d('0x28')]=_[_0x393d('0x27')](_0x257f8a[_0x393d('0x23')],qs[_0x393d('0x3b')](_0x13c3b4[_0x393d('0x25')][_0x393d('0x3b')]));_0x36589b[_0x393d('0x28')]=_0x36589b[_0x393d('0x28')][_0x393d('0x3c')]?_0x36589b[_0x393d('0x28')]:_0x257f8a['model'];if(_0x13c3b4[_0x393d('0x25')][_0x393d('0x3d')]){_0x36589b[_0x393d('0x35')]=[{'all':!![]}];}_0x36589b=_[_0x393d('0x30')]({},_0x36589b,_0x13c3b4[_0x393d('0x34')]);return db['SquareDetailsReport']['find'](_0x36589b)[_0x393d('0x1b')](handleEntityNotFound(_0x372dc5,null))['then'](respondWithResult(_0x372dc5,null))[_0x393d('0x38')](handleError(_0x372dc5,null));};exports[_0x393d('0x3e')]=function(_0xf31469,_0x46f1bb){return db['SquareDetailsReport']['create'](_0xf31469[_0x393d('0x3f')],{})['then'](respondWithResult(_0x46f1bb,0xc9))[_0x393d('0x38')](handleError(_0x46f1bb,null));};exports[_0x393d('0x1a')]=function(_0x5e8605,_0x19cadd){if(_0x5e8605[_0x393d('0x3f')]['id']){delete _0x5e8605[_0x393d('0x3f')]['id'];}return db[_0x393d('0x20')][_0x393d('0x40')]({'where':{'id':_0x5e8605['params']['id']}})[_0x393d('0x1b')](handleEntityNotFound(_0x19cadd,null))[_0x393d('0x1b')](saveUpdates(_0x5e8605[_0x393d('0x3f')],null))[_0x393d('0x1b')](respondWithResult(_0x19cadd,null))['catch'](handleError(_0x19cadd,null));};exports[_0x393d('0x1c')]=function(_0x1be187,_0x157c4a){return db[_0x393d('0x20')][_0x393d('0x40')]({'where':{'id':_0x1be187[_0x393d('0x39')]['id']}})[_0x393d('0x1b')](handleEntityNotFound(_0x157c4a,null))['then'](removeEntity(_0x157c4a,null))['catch'](handleError(_0x157c4a,null));};exports[_0x393d('0x41')]=function(_0x4867db,_0x566445){return db['SquareDetailsReport'][_0x393d('0x41')]()['then'](respondWithResult(_0x566445,null))[_0x393d('0x38')](handleError(_0x566445,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1c5c8f2..def6089 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 _0x0492=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details'];(function(_0x12f2b9,_0x39b1c3){var _0x19b550=function(_0x5a6dce){while(--_0x5a6dce){_0x12f2b9['push'](_0x12f2b9['shift']());}};_0x19b550(++_0x39b1c3);}(_0x0492,0xbe));var _0x2049=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x0492[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x2049('0x0'));var util=require(_0x2049('0x1'));var logger=require(_0x2049('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2049('0x3'));var fs=require('fs');var path=require(_0x2049('0x4'));var rimraf=require('rimraf');var config=require(_0x2049('0x5'));var attributes=require(_0x2049('0x6'));module[_0x2049('0x7')]=function(_0x42f59a,_0x26f84e){return _0x42f59a[_0x2049('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x2049('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbf1=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x275e85,_0x2fc5c1){var _0xe1e5f2=function(_0x4565d6){while(--_0x4565d6){_0x275e85['push'](_0x275e85['shift']());}};_0xe1e5f2(++_0x2fc5c1);}(_0xbbf1,0x166));var _0x1bbf=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xbbf1[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0x1bbf('0x0'));var util=require(_0x1bbf('0x1'));var logger=require(_0x1bbf('0x2'))(_0x1bbf('0x3'));var moment=require(_0x1bbf('0x4'));var BPromise=require('bluebird');var rp=require(_0x1bbf('0x5'));var fs=require('fs');var path=require(_0x1bbf('0x6'));var rimraf=require(_0x1bbf('0x7'));var config=require(_0x1bbf('0x8'));var attributes=require(_0x1bbf('0x9'));module[_0x1bbf('0xa')]=function(_0x2e2aed,_0x20e3da){return _0x2e2aed[_0x1bbf('0xb')](_0x1bbf('0xc'),attributes,{'tableName':_0x1bbf('0xd'),'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 314551f..53a875d 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 _0x0833=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','then','CreateSquareDetailsReport','lodash','util','moment'];(function(_0x416f3c,_0x4ac0b4){var _0x558b7d=function(_0xbd54e9){while(--_0xbd54e9){_0x416f3c['push'](_0x416f3c['shift']());}};_0x558b7d(++_0x4ac0b4);}(_0x0833,0x1bd));var _0x3083=function(_0x42305c,_0x10c561){_0x42305c=_0x42305c-0x0;var _0x5a15d1=_0x0833[_0x42305c];return _0x5a15d1;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var moment=require(_0x3083('0x2'));var BPromise=require(_0x3083('0x3'));var rs=require(_0x3083('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3083('0x5'))('rpc');var config=require(_0x3083('0x6'));var jayson=require(_0x3083('0x7'));var client=jayson[_0x3083('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9c3a,_0x1378a5,_0x529df1){return new BPromise(function(_0x5591b0,_0x4f51da){return client[_0x3083('0x9')](_0x2f9c3a,_0x529df1)['then'](function(_0x5cce3c){logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));logger[_0x3083('0xd')](_0x3083('0xe'),_0x1378a5,_0x3083('0xc'),JSON[_0x3083('0xf')](_0x5cce3c));if(_0x5cce3c[_0x3083('0x10')]){if(_0x5cce3c[_0x3083('0x10')][_0x3083('0x11')]===0x1f4){logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c[_0x3083('0x10')][_0x3083('0x12')]);return _0x4f51da(_0x5cce3c[_0x3083('0x10')]['message']);}logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c['error'][_0x3083('0x12')]);return _0x5591b0(_0x5cce3c[_0x3083('0x10')]['message']);}else{logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));_0x5591b0(_0x5cce3c[_0x3083('0x13')][_0x3083('0x12')]);}})[_0x3083('0x14')](function(_0xecb368){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1378a5,_0xecb368);_0x4f51da(_0xecb368);});});}exports['CreateSquareDetailsReport']=function(_0x424c59){var _0x57fdf7=this;return new Promise(function(_0x3bbfe3,_0x2cdeca){return db[_0x3083('0x15')][_0x3083('0x16')](_0x424c59[_0x3083('0x17')],{'raw':_0x424c59[_0x3083('0x18')]?_0x424c59[_0x3083('0x18')][_0x3083('0x19')]===undefined?!![]:![]:!![]})[_0x3083('0x1a')](function(_0x164988){logger[_0x3083('0xa')](_0x3083('0x1b'),_0x424c59);logger[_0x3083('0xd')](_0x3083('0x1b'),_0x424c59,JSON['stringify'](_0x164988));_0x3bbfe3(_0x164988);})['catch'](function(_0x4dc9ad){logger['error'](_0x3083('0x1b'),_0x4dc9ad[_0x3083('0x12')],_0x424c59);_0x2cdeca(_0x57fdf7[_0x3083('0x10')](0x1f4,_0x4dc9ad[_0x3083('0x12')]));});});}; \ No newline at end of file +var _0x351d=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','then'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x351d,0x90));var _0xd351=function(_0x4743cc,_0x13609b){_0x4743cc=_0x4743cc-0x0;var _0x40d6c4=_0x351d[_0x4743cc];return _0x40d6c4;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')](_0x4e0164['body'],{'raw':_0x4e0164[_0xd351('0x16')]?_0x4e0164['options']['raw']===undefined?!![]:![]:!![]})[_0xd351('0x17')](function(_0x4a427b){logger[_0xd351('0xb')](_0xd351('0x13'),_0x4e0164);logger[_0xd351('0xd')](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x4a427b));_0x1e1a3c(_0x4a427b);})['catch'](function(_0x18625b){logger[_0xd351('0xf')](_0xd351('0x13'),_0x18625b['message'],_0x4e0164);_0x2bfc53(_0x4c6693[_0xd351('0xf')](0x1f4,_0x18625b[_0xd351('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b3bebe3..295a0ac 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 _0xd027=['get','isAuthenticated','killProcess','exports','express','Router'];(function(_0x189aca,_0x258dd9){var _0x2194f1=function(_0x4f6429){while(--_0x4f6429){_0x189aca['push'](_0x189aca['shift']());}};_0x2194f1(++_0x258dd9);}(_0xd027,0x106));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x7d02('0x0'));var router=express[_0x7d02('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x7d02('0x2')]('/',auth[_0x7d02('0x3')](),controller['index']);router[_0x7d02('0x2')]('/process/:pid/kill',auth[_0x7d02('0x3')](),controller[_0x7d02('0x4')]);module[_0x7d02('0x5')]=router; \ No newline at end of file +var _0x64ab=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0xdc5a08,_0x4eab21){var _0x3f6e2e=function(_0x3cb5ca){while(--_0x3cb5ca){_0xdc5a08['push'](_0xdc5a08['shift']());}};_0x3f6e2e(++_0x4eab21);}(_0x64ab,0x165));var _0xb64a=function(_0x51f023,_0xf4526d){_0x51f023=_0x51f023-0x0;var _0x3340db=_0x64ab[_0x51f023];return _0x3340db;};'use strict';var express=require(_0xb64a('0x0'));var router=express[_0xb64a('0x1')]();var auth=require(_0xb64a('0x2'));var controller=require(_0xb64a('0x3'));router[_0xb64a('0x4')]('/',auth['isAuthenticated'](),controller[_0xb64a('0x5')]);router[_0xb64a('0x4')](_0xb64a('0x6'),auth[_0xb64a('0x7')](),controller[_0xb64a('0x8')]);module[_0xb64a('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0d5e1ef..f0206a1 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 _0x29c2=['error','inspect','name','status','send','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash'];(function(_0xd1bccd,_0x5621f2){var _0x34e22b=function(_0xf2fc66){while(--_0xf2fc66){_0xd1bccd['push'](_0xd1bccd['shift']());}};_0x34e22b(++_0x5621f2);}(_0x29c2,0x149));var _0x229c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x29c2[_0x5d6456];return _0x4d66c1;};'use strict';var info=require(_0x229c('0x0'));var exec=require(_0x229c('0x1'))['exec'];var logger=require(_0x229c('0x2'))(_0x229c('0x3'));var util=require(_0x229c('0x4'));var BPromise=require(_0x229c('0x5'));var _=require(_0x229c('0x6'));function handleError(_0x2a155f,_0x5dd9fb,_0x4ee7cc){_0x5dd9fb=_0x5dd9fb||0x1f4;return function(_0x25fd78){logger[_0x229c('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4ee7cc,_0x5dd9fb,util[_0x229c('0x8')](_0x25fd78,{'showHidden':![],'depth':null}));delete _0x25fd78[_0x229c('0x9')];_0x2a155f[_0x229c('0xa')](_0x5dd9fb)[_0x229c('0xb')](_0x25fd78);};}exports['index']=function(_0x3498b6,_0x51a372){return info['getAllData']()[_0x229c('0xc')](function(_0x1c71c5){return _0x51a372[_0x229c('0xa')](0xc8)[_0x229c('0xd')](_0x1c71c5);})['catch'](function(_0x17efe1){return _0x51a372[_0x229c('0xa')](0x1f4)[_0x229c('0xd')](_0x17efe1);});};exports[_0x229c('0xe')]=function(_0x1d4dd9,_0x946128){var _0x387ad8=['components/import/cm'];return new BPromise(function(_0x35b16e,_0xaf0fe6){return exec(util[_0x229c('0xf')](_0x229c('0x10'),_0x1d4dd9['params'][_0x229c('0x11')]),function(_0x1f0787,_0x3df7ae,_0x4a0edb){if(_0x1f0787){return _0xaf0fe6(_0x1f0787);}return _0x35b16e(_0x3df7ae);});})['then'](function(_0x3cf198){var _0x189113=![];var _0x219e6b=_0x3cf198[_0x229c('0x12')](/\n/);for(var _0x4656a5=0x0,_0x35299c=_0x387ad8['length'];_0x4656a5<_0x35299c,_0x189113===![];_0x4656a5+=0x1){if(_0x3cf198[_0x229c('0x13')](_0x387ad8[_0x4656a5])>=0x0){_0x189113=!![];}}if(!_0x189113){throw new Error(util[_0x229c('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1d4dd9[_0x229c('0x14')][_0x229c('0x11')]));}process['kill'](_0x1d4dd9[_0x229c('0x14')][_0x229c('0x11')],_0x229c('0x15'));return _0x946128[_0x229c('0xa')](0xc8)[_0x229c('0xd')]({'message':util['format'](_0x229c('0x16'),_0x1d4dd9[_0x229c('0x14')]['pid'])});})[_0x229c('0x17')](handleError(_0x946128,null,_0x229c('0xe')));}; \ No newline at end of file +var _0xf2f5=['exec','../../config/logger','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process'];(function(_0x22e134,_0xb69611){var _0x3b7a20=function(_0x531b75){while(--_0x531b75){_0x22e134['push'](_0x22e134['shift']());}};_0x3b7a20(++_0xb69611);}(_0xf2f5,0x1d9));var _0x5f2f=function(_0x552d46,_0x2a8900){_0x552d46=_0x552d46-0x0;var _0x1d3599=_0xf2f5[_0x552d46];return _0x1d3599;};'use strict';var info=require(_0x5f2f('0x0'));var exec=require(_0x5f2f('0x1'))[_0x5f2f('0x2')];var logger=require(_0x5f2f('0x3'))('api');var util=require('util');var BPromise=require(_0x5f2f('0x4'));var _=require(_0x5f2f('0x5'));function handleError(_0x5c1234,_0x1704be,_0x5868c8){_0x1704be=_0x1704be||0x1f4;return function(_0x182a37){logger['error'](_0x5f2f('0x6'),_0x5868c8,_0x1704be,util[_0x5f2f('0x7')](_0x182a37,{'showHidden':![],'depth':null}));delete _0x182a37[_0x5f2f('0x8')];_0x5c1234[_0x5f2f('0x9')](_0x1704be)['send'](_0x182a37);};}exports[_0x5f2f('0xa')]=function(_0x1d02c7,_0x2c5944){return info['getAllData']()[_0x5f2f('0xb')](function(_0x3d9f2d){return _0x2c5944['status'](0xc8)[_0x5f2f('0xc')](_0x3d9f2d);})['catch'](function(_0x5129bb){return _0x2c5944['status'](0x1f4)[_0x5f2f('0xc')](_0x5129bb);});};exports[_0x5f2f('0xd')]=function(_0x12c06a,_0x2e0361){var _0x298d78=[_0x5f2f('0xe')];return new BPromise(function(_0x3d59ea,_0x28c16f){return exec(util[_0x5f2f('0xf')](_0x5f2f('0x10'),_0x12c06a[_0x5f2f('0x11')]['pid']),function(_0x4d0602,_0x44d9ea,_0x53f28a){if(_0x4d0602){return _0x28c16f(_0x4d0602);}return _0x3d59ea(_0x44d9ea);});})[_0x5f2f('0xb')](function(_0x34a529){var _0x50e530=![];var _0x304f11=_0x34a529[_0x5f2f('0x12')](/\n/);for(var _0x1afa2a=0x0,_0x294ca1=_0x298d78['length'];_0x1afa2a<_0x294ca1,_0x50e530===![];_0x1afa2a+=0x1){if(_0x34a529[_0x5f2f('0x13')](_0x298d78[_0x1afa2a])>=0x0){_0x50e530=!![];}}if(!_0x50e530){throw new Error(util[_0x5f2f('0xf')](_0x5f2f('0x14'),_0x12c06a[_0x5f2f('0x11')][_0x5f2f('0x15')]));}process[_0x5f2f('0x16')](_0x12c06a[_0x5f2f('0x11')]['pid'],_0x5f2f('0x17'));return _0x2e0361['status'](0xc8)[_0x5f2f('0xc')]({'message':util[_0x5f2f('0xf')](_0x5f2f('0x18'),_0x12c06a['params'][_0x5f2f('0x15')])});})['catch'](handleError(_0x2e0361,null,_0x5f2f('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c39085a..7b79afa 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 _0xc1d3=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xc1d3,0x147));var _0x3c1d=function(_0x4a328d,_0x4c62d6){_0x4a328d=_0x4a328d-0x0;var _0x4410d9=_0xc1d3[_0x4a328d];return _0x4410d9;};'use strict';var multer=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var path=require(_0x3c1d('0x2'));var timeout=require(_0x3c1d('0x3'));var express=require(_0x3c1d('0x4'));var router=express[_0x3c1d('0x5')]();var fs_extra=require(_0x3c1d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c1d('0x7'));var controller=require(_0x3c1d('0x8'));router[_0x3c1d('0x9')]('/',auth['isAuthenticated'](),controller[_0x3c1d('0xa')]);router[_0x3c1d('0x9')](_0x3c1d('0xb'),auth[_0x3c1d('0xc')](),controller[_0x3c1d('0xd')]);router['post']('/',auth[_0x3c1d('0xc')](),controller[_0x3c1d('0xe')]);router[_0x3c1d('0xf')](_0x3c1d('0xb'),auth[_0x3c1d('0xc')](),controller[_0x3c1d('0x10')]);router[_0x3c1d('0x11')](_0x3c1d('0xb'),auth['isAuthenticated'](),controller[_0x3c1d('0x12')]);module[_0x3c1d('0x13')]=router; \ No newline at end of file +var _0xefc3=['../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xefc3,0xa9));var _0x3efc=function(_0x2d1bc8,_0x26f326){_0x2d1bc8=_0x2d1bc8-0x0;var _0x5c0c8b=_0xefc3[_0x2d1bc8];return _0x5c0c8b;};'use strict';var multer=require(_0x3efc('0x0'));var util=require(_0x3efc('0x1'));var path=require(_0x3efc('0x2'));var timeout=require(_0x3efc('0x3'));var express=require(_0x3efc('0x4'));var router=express[_0x3efc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3efc('0x6'));var interaction=require(_0x3efc('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x3efc('0x8')]('/',auth[_0x3efc('0x9')](),controller['index']);router[_0x3efc('0x8')](_0x3efc('0xa'),auth[_0x3efc('0x9')](),controller[_0x3efc('0xb')]);router[_0x3efc('0xc')]('/',auth['isAuthenticated'](),controller[_0x3efc('0xd')]);router['put']('/:id',auth[_0x3efc('0x9')](),controller['update']);router[_0x3efc('0xe')](_0x3efc('0xa'),auth[_0x3efc('0x9')](),controller[_0x3efc('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 94a4f25..6a4a3dd 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 _0x7334=['sequelize','exports','STRING','#0091EA'];(function(_0x1895cb,_0x248c9f){var _0x4ff1a2=function(_0x3e6574){while(--_0x3e6574){_0x1895cb['push'](_0x1895cb['shift']());}};_0x4ff1a2(++_0x248c9f);}(_0x7334,0x184));var _0x4733=function(_0x28f267,_0x1fa75d){_0x28f267=_0x28f267-0x0;var _0x13f82b=_0x7334[_0x28f267];return _0x13f82b;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'name':{'type':Sequelize[_0x4733('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x4733('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0x4fc2,0x111));var _0x24fc=function(_0x3f7e37,_0x32f790){_0x3f7e37=_0x3f7e37-0x0;var _0x2a3ec7=_0x4fc2[_0x3f7e37];return _0x2a3ec7;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index bca4fad..77a3efb 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 _0xc874=['query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','include','catch','show','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Tags','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','type','model'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xc874,0x154));var _0x4c87=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xc874[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x4c87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c87('0x1'));var jsonpatch=require(_0x4c87('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c87('0x3'));var Mustache=require(_0x4c87('0x4'));var util=require(_0x4c87('0x5'));var path=require('path');var sox=require(_0x4c87('0x6'));var csv=require(_0x4c87('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c87('0x8'));var _=require(_0x4c87('0x9'));var squel=require(_0x4c87('0xa'));var crypto=require(_0x4c87('0xb'));var jsforce=require(_0x4c87('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4c87('0x7'));var querystring=require('querystring');var Papa=require(_0x4c87('0xd'));var Redis=require(_0x4c87('0xe'));var authService=require(_0x4c87('0xf'));var qs=require(_0x4c87('0x10'));var as=require(_0x4c87('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c87('0x12'))(_0x4c87('0x13'));var utils=require('../../config/utils');var config=require(_0x4c87('0x14'));var licenseUtil=require(_0x4c87('0x15'));var db=require(_0x4c87('0x16'))['db'];function respondWithStatusCode(_0x3b01bb,_0x3a2aa2){_0x3a2aa2=_0x3a2aa2||0xcc;return function(_0x50590a){if(_0x50590a){return _0x3b01bb['sendStatus'](_0x3a2aa2);}return _0x3b01bb['status'](_0x3a2aa2)[_0x4c87('0x17')]();};}function respondWithResult(_0x355e94,_0x2c66bc){_0x2c66bc=_0x2c66bc||0xc8;return function(_0x3f1cc5){if(_0x3f1cc5){return _0x355e94[_0x4c87('0x18')](_0x2c66bc)[_0x4c87('0x19')](_0x3f1cc5);}};}function respondWithFilteredResult(_0x45e476,_0x21712e){return function(_0x532a63){if(_0x532a63){var _0x27abb9=typeof _0x21712e[_0x4c87('0x1a')]==='undefined'&&typeof _0x21712e['limit']===_0x4c87('0x1b');var _0x8cebb9=_0x532a63[_0x4c87('0x1c')];var _0x547d92=_0x27abb9?0x0:_0x21712e[_0x4c87('0x1a')];var _0x561441=_0x27abb9?_0x532a63[_0x4c87('0x1c')]:_0x21712e[_0x4c87('0x1a')]+_0x21712e[_0x4c87('0x1d')];var _0x22f775;if(_0x561441>=_0x8cebb9){_0x561441=_0x8cebb9;_0x22f775=0xc8;}else{_0x22f775=0xce;}_0x45e476['status'](_0x22f775);return _0x45e476[_0x4c87('0x1e')](_0x4c87('0x1f'),_0x547d92+'-'+_0x561441+'/'+_0x8cebb9)[_0x4c87('0x19')](_0x532a63);}return null;};}function patchUpdates(_0x3f27d4){return function(_0xa4baa7){try{jsonpatch[_0x4c87('0x20')](_0xa4baa7,_0x3f27d4,!![]);}catch(_0x14dabf){return BPromise[_0x4c87('0x21')](_0x14dabf);}return _0xa4baa7['save']();};}function saveUpdates(_0x353ac9,_0x33aafd){return function(_0x5cc15d){if(_0x5cc15d){return _0x5cc15d[_0x4c87('0x22')](_0x353ac9)[_0x4c87('0x23')](function(_0x5a9496){return _0x5a9496;});}return null;};}function removeEntity(_0x115253,_0x293754){return function(_0x40a413){if(_0x40a413){return _0x40a413[_0x4c87('0x24')]()['then'](function(){var _0x4735f2=_0x40a413[_0x4c87('0x25')]({'plain':!![]});var _0x4525df=_0x4c87('0x26');return db[_0x4c87('0x27')][_0x4c87('0x24')]({'where':{'type':_0x4525df,'resourceId':_0x4735f2['id']}})[_0x4c87('0x23')](function(){return _0x40a413;});})[_0x4c87('0x23')](function(){_0x115253['status'](0xcc)[_0x4c87('0x17')]();});}};}function handleEntityNotFound(_0x47ef54,_0x27f13d){return function(_0x381af7){if(!_0x381af7){_0x47ef54[_0x4c87('0x28')](0x194);}return _0x381af7;};}function handleError(_0x1f246e,_0x5fb5e){_0x5fb5e=_0x5fb5e||0x1f4;return function(_0x583371){logger['error'](_0x583371[_0x4c87('0x29')]);if(_0x583371[_0x4c87('0x2a')]){delete _0x583371[_0x4c87('0x2a')];}_0x1f246e[_0x4c87('0x18')](_0x5fb5e)[_0x4c87('0x2b')](_0x583371);};}exports[_0x4c87('0x2c')]=function(_0x32ae5e,_0x10aea2){var _0x2a6d03={},_0x2de21a={},_0x41468f={'count':0x0,'rows':[]};var _0x272392=_[_0x4c87('0x2d')](db[_0x4c87('0x2e')][_0x4c87('0x2f')],function(_0x185590){return{'name':_0x185590['fieldName'],'type':_0x185590[_0x4c87('0x30')]['key']};});_0x2de21a[_0x4c87('0x31')]=_['map'](_0x272392,_0x4c87('0x2a'));_0x2de21a[_0x4c87('0x32')]=_[_0x4c87('0x33')](_0x32ae5e[_0x4c87('0x32')]);_0x2de21a['filters']=_[_0x4c87('0x34')](_0x2de21a[_0x4c87('0x31')],_0x2de21a[_0x4c87('0x32')]);_0x2a6d03[_0x4c87('0x35')]=_['intersection'](_0x2de21a[_0x4c87('0x31')],qs[_0x4c87('0x36')](_0x32ae5e[_0x4c87('0x32')][_0x4c87('0x36')]));_0x2a6d03['attributes']=_0x2a6d03[_0x4c87('0x35')][_0x4c87('0x37')]?_0x2a6d03[_0x4c87('0x35')]:_0x2de21a[_0x4c87('0x31')];if(!_0x32ae5e['query']['hasOwnProperty'](_0x4c87('0x38'))){_0x2a6d03['limit']=qs[_0x4c87('0x1d')](_0x32ae5e[_0x4c87('0x32')][_0x4c87('0x1d')]);_0x2a6d03[_0x4c87('0x1a')]=qs[_0x4c87('0x1a')](_0x32ae5e['query'][_0x4c87('0x1a')]);}_0x2a6d03[_0x4c87('0x39')]=qs[_0x4c87('0x3a')](_0x32ae5e['query']['sort']);_0x2a6d03[_0x4c87('0x3b')]=qs[_0x4c87('0x3c')](_[_0x4c87('0x3d')](_0x32ae5e['query'],_0x2de21a[_0x4c87('0x3c')]),_0x272392);if(_0x32ae5e['query']['filter']){_0x2a6d03['where']=_[_0x4c87('0x3e')](_0x2a6d03[_0x4c87('0x3b')],{'$or':_[_0x4c87('0x2d')](_0x272392,function(_0x5c1831){if(_0x5c1831[_0x4c87('0x30')]!==_0x4c87('0x3f')){var _0x5de7b1={};_0x5de7b1[_0x5c1831[_0x4c87('0x2a')]]={'$like':'%'+_0x32ae5e['query']['filter']+'%'};return _0x5de7b1;}})});}_0x2a6d03=_[_0x4c87('0x3e')]({},_0x2a6d03,_0x32ae5e['options']);var _0x46c25f={'where':_0x2a6d03[_0x4c87('0x3b')]};return db['Tag'][_0x4c87('0x1c')](_0x46c25f)[_0x4c87('0x23')](function(_0x48cfe6){_0x41468f[_0x4c87('0x1c')]=_0x48cfe6;if(_0x32ae5e['query']['includeAll']){_0x2a6d03[_0x4c87('0x40')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2a6d03);})[_0x4c87('0x23')](function(_0x32e45b){_0x41468f['rows']=_0x32e45b;return _0x41468f;})[_0x4c87('0x23')](respondWithFilteredResult(_0x10aea2,_0x2a6d03))[_0x4c87('0x41')](handleError(_0x10aea2,null));};exports[_0x4c87('0x42')]=function(_0x45b950,_0x5a4fef){var _0x44e6c7={'raw':!![],'where':{'id':_0x45b950[_0x4c87('0x43')]['id']}},_0x448208={};_0x448208[_0x4c87('0x31')]=_['keys'](db[_0x4c87('0x2e')][_0x4c87('0x2f')]);_0x448208[_0x4c87('0x32')]=_['keys'](_0x45b950[_0x4c87('0x32')]);_0x448208[_0x4c87('0x3c')]=_[_0x4c87('0x34')](_0x448208[_0x4c87('0x31')],_0x448208['query']);_0x44e6c7[_0x4c87('0x35')]=_[_0x4c87('0x34')](_0x448208[_0x4c87('0x31')],qs['fields'](_0x45b950['query'][_0x4c87('0x36')]));_0x44e6c7[_0x4c87('0x35')]=_0x44e6c7[_0x4c87('0x35')][_0x4c87('0x37')]?_0x44e6c7['attributes']:_0x448208['model'];if(_0x45b950[_0x4c87('0x32')][_0x4c87('0x44')]){_0x44e6c7[_0x4c87('0x40')]=[{'all':!![]}];}_0x44e6c7=_[_0x4c87('0x3e')]({},_0x44e6c7,_0x45b950[_0x4c87('0x45')]);return db[_0x4c87('0x2e')][_0x4c87('0x46')](_0x44e6c7)[_0x4c87('0x23')](handleEntityNotFound(_0x5a4fef,null))[_0x4c87('0x23')](respondWithResult(_0x5a4fef,null))[_0x4c87('0x41')](handleError(_0x5a4fef,null));};exports['create']=function(_0x20f4f2,_0x212d87){return db[_0x4c87('0x2e')][_0x4c87('0x47')](_0x20f4f2['body'],{})[_0x4c87('0x23')](function(_0x152e70){var _0x27d82e=_0x20f4f2['user'][_0x4c87('0x25')]({'plain':!![]});if(!_0x27d82e)throw new Error(_0x4c87('0x48'));if(_0x27d82e[_0x4c87('0x49')]==='user'){var _0x31f23a=_0x152e70[_0x4c87('0x25')]({'plain':!![]});var _0x1f10be='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x1f10be,'userProfileId':_0x27d82e['userProfileId']},'raw':!![]})['then'](function(_0x263c8b){if(_0x263c8b&&_0x263c8b[_0x4c87('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x31f23a[_0x4c87('0x2a')],'resourceId':_0x31f23a['id'],'type':_0x263c8b[_0x4c87('0x2a')],'sectionId':_0x263c8b['id']},{})[_0x4c87('0x23')](function(){return _0x152e70;});}else{return _0x152e70;}})[_0x4c87('0x41')](function(_0x31c1e2){logger[_0x4c87('0x4b')](_0x4c87('0x4c'),_0x31c1e2);throw _0x31c1e2;});}return _0x152e70;})[_0x4c87('0x23')](respondWithResult(_0x212d87,0xc9))['catch'](handleError(_0x212d87,null));};exports['update']=function(_0x348754,_0x4debb0){if(_0x348754[_0x4c87('0x4d')]['id']){delete _0x348754[_0x4c87('0x4d')]['id'];}return db[_0x4c87('0x2e')][_0x4c87('0x46')]({'where':{'id':_0x348754[_0x4c87('0x43')]['id']}})[_0x4c87('0x23')](handleEntityNotFound(_0x4debb0,null))[_0x4c87('0x23')](saveUpdates(_0x348754[_0x4c87('0x4d')],null))['then'](respondWithResult(_0x4debb0,null))['catch'](handleError(_0x4debb0,null));};exports[_0x4c87('0x24')]=function(_0x505365,_0x3fae0d){return db[_0x4c87('0x2e')][_0x4c87('0x46')]({'where':{'id':_0x505365['params']['id']}})[_0x4c87('0x23')](handleEntityNotFound(_0x3fae0d,null))[_0x4c87('0x23')](removeEntity(_0x3fae0d,null))[_0x4c87('0x41')](handleError(_0x3fae0d,null));}; \ No newline at end of file +var _0x3685=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5368('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5368('0x1'));var jsonpatch=require(_0x5368('0x2'));var rp=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var BPromise=require(_0x5368('0x5'));var Mustache=require(_0x5368('0x6'));var util=require(_0x5368('0x7'));var path=require(_0x5368('0x8'));var sox=require(_0x5368('0x9'));var csv=require(_0x5368('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5368('0xb'));var _=require(_0x5368('0xc'));var squel=require(_0x5368('0xd'));var crypto=require(_0x5368('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5368('0xf'));var toCsv=require(_0x5368('0xa'));var querystring=require(_0x5368('0x10'));var Papa=require(_0x5368('0x11'));var Redis=require(_0x5368('0x12'));var authService=require(_0x5368('0x13'));var qs=require(_0x5368('0x14'));var as=require(_0x5368('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5368('0x16'))(_0x5368('0x17'));var utils=require(_0x5368('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5368('0x19'));var db=require(_0x5368('0x1a'))['db'];function respondWithStatusCode(_0x4940af,_0x5d6a86){_0x5d6a86=_0x5d6a86||0xcc;return function(_0x5c626a){if(_0x5c626a){return _0x4940af[_0x5368('0x1b')](_0x5d6a86);}return _0x4940af[_0x5368('0x1c')](_0x5d6a86)[_0x5368('0x1d')]();};}function respondWithResult(_0x5df43,_0xa5ce3c){_0xa5ce3c=_0xa5ce3c||0xc8;return function(_0x2f18dd){if(_0x2f18dd){return _0x5df43[_0x5368('0x1c')](_0xa5ce3c)[_0x5368('0x1e')](_0x2f18dd);}};}function respondWithFilteredResult(_0x3a3b8e,_0x5b1da2){return function(_0x524fbf){if(_0x524fbf){var _0x41ce0e=typeof _0x5b1da2[_0x5368('0x1f')]==='undefined'&&typeof _0x5b1da2[_0x5368('0x20')]===_0x5368('0x21');var _0x973143=_0x524fbf[_0x5368('0x22')];var _0x5b10e9=_0x41ce0e?0x0:_0x5b1da2[_0x5368('0x1f')];var _0x56ac4d=_0x41ce0e?_0x524fbf['count']:_0x5b1da2[_0x5368('0x1f')]+_0x5b1da2['limit'];var _0x52afa9;if(_0x56ac4d>=_0x973143){_0x56ac4d=_0x973143;_0x52afa9=0xc8;}else{_0x52afa9=0xce;}_0x3a3b8e['status'](_0x52afa9);return _0x3a3b8e[_0x5368('0x23')](_0x5368('0x24'),_0x5b10e9+'-'+_0x56ac4d+'/'+_0x973143)[_0x5368('0x1e')](_0x524fbf);}return null;};}function patchUpdates(_0x5cef40){return function(_0x4e3267){try{jsonpatch[_0x5368('0x25')](_0x4e3267,_0x5cef40,!![]);}catch(_0x3c891a){return BPromise[_0x5368('0x26')](_0x3c891a);}return _0x4e3267[_0x5368('0x27')]();};}function saveUpdates(_0x1c2fcd,_0x1093e2){return function(_0x4885d0){if(_0x4885d0){return _0x4885d0[_0x5368('0x28')](_0x1c2fcd)[_0x5368('0x29')](function(_0x4705f2){return _0x4705f2;});}return null;};}function removeEntity(_0x57108b,_0x45884f){return function(_0xb994f4){if(_0xb994f4){return _0xb994f4[_0x5368('0x2a')]()[_0x5368('0x29')](function(){var _0x1c287f=_0xb994f4[_0x5368('0x2b')]({'plain':!![]});var _0xabac8c=_0x5368('0x2c');return db[_0x5368('0x2d')]['destroy']({'where':{'type':_0xabac8c,'resourceId':_0x1c287f['id']}})['then'](function(){return _0xb994f4;});})[_0x5368('0x29')](function(){_0x57108b[_0x5368('0x1c')](0xcc)[_0x5368('0x1d')]();});}};}function handleEntityNotFound(_0x452c81,_0x131722){return function(_0x4b94cd){if(!_0x4b94cd){_0x452c81[_0x5368('0x1b')](0x194);}return _0x4b94cd;};}function handleError(_0x200ad0,_0x2e18e0){_0x2e18e0=_0x2e18e0||0x1f4;return function(_0x2bcf41){logger[_0x5368('0x2e')](_0x2bcf41[_0x5368('0x2f')]);if(_0x2bcf41[_0x5368('0x30')]){delete _0x2bcf41[_0x5368('0x30')];}_0x200ad0[_0x5368('0x1c')](_0x2e18e0)[_0x5368('0x31')](_0x2bcf41);};}exports[_0x5368('0x32')]=function(_0x46ea22,_0x7449cd){var _0x5810cb={},_0x73111b={},_0x256abd={'count':0x0,'rows':[]};var _0x36e230=_['map'](db[_0x5368('0x33')]['rawAttributes'],function(_0x26fc48){return{'name':_0x26fc48[_0x5368('0x34')],'type':_0x26fc48['type'][_0x5368('0x35')]};});_0x73111b[_0x5368('0x36')]=_['map'](_0x36e230,'name');_0x73111b[_0x5368('0x37')]=_[_0x5368('0x38')](_0x46ea22['query']);_0x73111b[_0x5368('0x39')]=_[_0x5368('0x3a')](_0x73111b[_0x5368('0x36')],_0x73111b['query']);_0x5810cb[_0x5368('0x3b')]=_['intersection'](_0x73111b[_0x5368('0x36')],qs[_0x5368('0x3c')](_0x46ea22[_0x5368('0x37')]['fields']));_0x5810cb[_0x5368('0x3b')]=_0x5810cb[_0x5368('0x3b')][_0x5368('0x3d')]?_0x5810cb[_0x5368('0x3b')]:_0x73111b['model'];if(!_0x46ea22[_0x5368('0x37')]['hasOwnProperty'](_0x5368('0x3e'))){_0x5810cb[_0x5368('0x20')]=qs['limit'](_0x46ea22[_0x5368('0x37')][_0x5368('0x20')]);_0x5810cb[_0x5368('0x1f')]=qs[_0x5368('0x1f')](_0x46ea22['query'][_0x5368('0x1f')]);}_0x5810cb[_0x5368('0x3f')]=qs[_0x5368('0x40')](_0x46ea22[_0x5368('0x37')][_0x5368('0x40')]);_0x5810cb['where']=qs[_0x5368('0x39')](_[_0x5368('0x41')](_0x46ea22['query'],_0x73111b[_0x5368('0x39')]),_0x36e230);if(_0x46ea22[_0x5368('0x37')][_0x5368('0x42')]){_0x5810cb['where']=_[_0x5368('0x43')](_0x5810cb[_0x5368('0x44')],{'$or':_[_0x5368('0x45')](_0x36e230,function(_0x25e432){if(_0x25e432['type']!=='VIRTUAL'){var _0x1be46a={};_0x1be46a[_0x25e432[_0x5368('0x30')]]={'$like':'%'+_0x46ea22[_0x5368('0x37')]['filter']+'%'};return _0x1be46a;}})});}_0x5810cb=_['merge']({},_0x5810cb,_0x46ea22[_0x5368('0x46')]);var _0x5ae3f1={'where':_0x5810cb[_0x5368('0x44')]};return db[_0x5368('0x33')]['count'](_0x5ae3f1)[_0x5368('0x29')](function(_0x3b57a2){_0x256abd[_0x5368('0x22')]=_0x3b57a2;if(_0x46ea22[_0x5368('0x37')][_0x5368('0x47')]){_0x5810cb[_0x5368('0x48')]=[{'all':!![]}];}return db[_0x5368('0x33')][_0x5368('0x49')](_0x5810cb);})[_0x5368('0x29')](function(_0x43c776){_0x256abd[_0x5368('0x4a')]=_0x43c776;return _0x256abd;})[_0x5368('0x29')](respondWithFilteredResult(_0x7449cd,_0x5810cb))['catch'](handleError(_0x7449cd,null));};exports[_0x5368('0x4b')]=function(_0x61b1a1,_0xd4e247){var _0x4cb800={'raw':!![],'where':{'id':_0x61b1a1[_0x5368('0x4c')]['id']}},_0x1b66a1={};_0x1b66a1['model']=_[_0x5368('0x38')](db[_0x5368('0x33')][_0x5368('0x4d')]);_0x1b66a1[_0x5368('0x37')]=_[_0x5368('0x38')](_0x61b1a1[_0x5368('0x37')]);_0x1b66a1[_0x5368('0x39')]=_[_0x5368('0x3a')](_0x1b66a1[_0x5368('0x36')],_0x1b66a1[_0x5368('0x37')]);_0x4cb800['attributes']=_['intersection'](_0x1b66a1[_0x5368('0x36')],qs[_0x5368('0x3c')](_0x61b1a1[_0x5368('0x37')][_0x5368('0x3c')]));_0x4cb800['attributes']=_0x4cb800['attributes'][_0x5368('0x3d')]?_0x4cb800['attributes']:_0x1b66a1[_0x5368('0x36')];if(_0x61b1a1['query'][_0x5368('0x47')]){_0x4cb800['include']=[{'all':!![]}];}_0x4cb800=_[_0x5368('0x43')]({},_0x4cb800,_0x61b1a1[_0x5368('0x46')]);return db['Tag']['find'](_0x4cb800)[_0x5368('0x29')](handleEntityNotFound(_0xd4e247,null))['then'](respondWithResult(_0xd4e247,null))[_0x5368('0x4e')](handleError(_0xd4e247,null));};exports[_0x5368('0x4f')]=function(_0x2ee00b,_0x121d8d){return db['Tag'][_0x5368('0x4f')](_0x2ee00b[_0x5368('0x50')],{})[_0x5368('0x29')](function(_0x1d9c87){var _0x20e641=_0x2ee00b[_0x5368('0x51')][_0x5368('0x2b')]({'plain':!![]});if(!_0x20e641)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e641['role']===_0x5368('0x51')){var _0x7d7a5=_0x1d9c87[_0x5368('0x2b')]({'plain':!![]});var _0x4850f8=_0x5368('0x2c');return db[_0x5368('0x52')][_0x5368('0x53')]({'where':{'name':_0x4850f8,'userProfileId':_0x20e641[_0x5368('0x54')]},'raw':!![]})[_0x5368('0x29')](function(_0x233bf6){if(_0x233bf6&&_0x233bf6[_0x5368('0x55')]===0x0){return db[_0x5368('0x2d')]['create']({'name':_0x7d7a5[_0x5368('0x30')],'resourceId':_0x7d7a5['id'],'type':_0x233bf6[_0x5368('0x30')],'sectionId':_0x233bf6['id']},{})[_0x5368('0x29')](function(){return _0x1d9c87;});}else{return _0x1d9c87;}})[_0x5368('0x4e')](function(_0x5720c8){logger[_0x5368('0x2e')](_0x5368('0x56'),_0x5720c8);throw _0x5720c8;});}return _0x1d9c87;})[_0x5368('0x29')](respondWithResult(_0x121d8d,0xc9))[_0x5368('0x4e')](handleError(_0x121d8d,null));};exports[_0x5368('0x28')]=function(_0x44a481,_0x42544e){if(_0x44a481[_0x5368('0x50')]['id']){delete _0x44a481[_0x5368('0x50')]['id'];}return db[_0x5368('0x33')][_0x5368('0x53')]({'where':{'id':_0x44a481[_0x5368('0x4c')]['id']}})[_0x5368('0x29')](handleEntityNotFound(_0x42544e,null))[_0x5368('0x29')](saveUpdates(_0x44a481['body'],null))[_0x5368('0x29')](respondWithResult(_0x42544e,null))[_0x5368('0x4e')](handleError(_0x42544e,null));};exports[_0x5368('0x2a')]=function(_0x2971de,_0x2688a9){return db[_0x5368('0x33')]['find']({'where':{'id':_0x2971de[_0x5368('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2688a9,null))[_0x5368('0x29')](removeEntity(_0x2688a9,null))[_0x5368('0x4e')](handleError(_0x2688a9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ee87b19..ae901cd 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 _0x0463=['../../config/environment','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3504a1,_0x5448ee){var _0x132874=function(_0x51fe00){while(--_0x51fe00){_0x3504a1['push'](_0x3504a1['shift']());}};_0x132874(++_0x5448ee);}(_0x0463,0x7d));var _0x3046=function(_0x41556c,_0x2686b1){_0x41556c=_0x41556c-0x0;var _0x436102=_0x0463[_0x41556c];return _0x436102;};'use strict';var _=require(_0x3046('0x0'));var util=require(_0x3046('0x1'));var logger=require(_0x3046('0x2'))(_0x3046('0x3'));var moment=require('moment');var BPromise=require(_0x3046('0x4'));var rp=require(_0x3046('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3046('0x6'));var config=require(_0x3046('0x7'));var attributes=require('./tag.attributes');module[_0x3046('0x8')]=function(_0x58c8d2,_0x4a8649){return _0x58c8d2[_0x3046('0x9')](_0x3046('0xa'),attributes,{'tableName':_0x3046('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc943=['bluebird','request-promise','rimraf','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x350744,_0x7d9b13){var _0x14ad39=function(_0x1306dd){while(--_0x1306dd){_0x350744['push'](_0x350744['shift']());}};_0x14ad39(++_0x7d9b13);}(_0xc943,0x157));var _0x3c94=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xc943[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0x3c94('0x0'));var util=require(_0x3c94('0x1'));var logger=require(_0x3c94('0x2'))(_0x3c94('0x3'));var moment=require(_0x3c94('0x4'));var BPromise=require(_0x3c94('0x5'));var rp=require(_0x3c94('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c94('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x3c94('0x8')]=function(_0x1809c8,_0x283333){return _0x1809c8[_0x3c94('0x9')](_0x3c94('0xa'),attributes,{'tableName':_0x3c94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index da26845..5fe6d27 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 _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f1c91,_0x317972){var _0x14ee79=function(_0x991e3f){while(--_0x991e3f){_0x5f1c91['push'](_0x5f1c91['shift']());}};_0x14ee79(++_0x317972);}(_0xdd0c,0x165));var _0xcdd0=function(_0x1b33b5,_0x4ec10e){_0x1b33b5=_0x1b33b5-0x0;var _0x513038=_0xdd0c[_0x1b33b5];return _0x513038;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('Tag,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file +var _0x303a=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x303a,0x1a0));var _0xa303=function(_0x332c1b,_0x28d711){_0x332c1b=_0x332c1b-0x0;var _0x21b49b=_0x303a[_0x332c1b];return _0x21b49b;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('Tag,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('Tag,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('Tag,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 3f2e615..98f1732 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 3aa2028..fa4cb59 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 _0xbaf0=['name','exports','STRING'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x3852d4,_0x46b516){var _0x3df901=function(_0x36ddcc){while(--_0x36ddcc){_0x3852d4['push'](_0x3852d4['shift']());}};_0x3df901(++_0x46b516);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c0e3da1..3dc0050 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 _0x8026=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','Team','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','params','destroy','sequelize','transaction','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','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','Teams','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','ValidationError','ids','removeQueues','remove','addAgents','isArray','Mail','Sms','Fax','Voice','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','spread','removeAgents','Chat','Openchannel','Queue:remove','VoicePrefixId','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x8026,0x1ba));var _0x6802=function(_0x45f7c9,_0x192a73){_0x45f7c9=_0x45f7c9-0x0;var _0x2c6810=_0x8026[_0x45f7c9];return _0x2c6810;};'use strict';var emlformat=require(_0x6802('0x0'));var rimraf=require(_0x6802('0x1'));var zipdir=require(_0x6802('0x2'));var jsonpatch=require(_0x6802('0x3'));var rp=require('request-promise');var moment=require(_0x6802('0x4'));var BPromise=require(_0x6802('0x5'));var Mustache=require(_0x6802('0x6'));var util=require(_0x6802('0x7'));var path=require(_0x6802('0x8'));var sox=require(_0x6802('0x9'));var csv=require(_0x6802('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6802('0xb'));var _=require(_0x6802('0xc'));var squel=require('squel');var crypto=require(_0x6802('0xd'));var jsforce=require(_0x6802('0xe'));var deskjs=require(_0x6802('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6802('0x10'));var authService=require(_0x6802('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6802('0x12'));var hardwareService=require(_0x6802('0x13'));var logger=require(_0x6802('0x14'))(_0x6802('0x15'));var utils=require(_0x6802('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6802('0x17'));var db=require(_0x6802('0x18'))['db'];config['redis']=_['defaults'](config[_0x6802('0x19')],{'host':_0x6802('0x1a'),'port':0x18eb});var socket=require(_0x6802('0x1b'))(new Redis(config['redis']));require('./team.socket')[_0x6802('0x1c')](socket);function respondWithStatusCode(_0x1434e2,_0x1ff620){_0x1ff620=_0x1ff620||0xcc;return function(_0x17115e){if(_0x17115e){return _0x1434e2['sendStatus'](_0x1ff620);}return _0x1434e2[_0x6802('0x1d')](_0x1ff620)[_0x6802('0x1e')]();};}function respondWithResult(_0x3d2ebe,_0x6f0b12){_0x6f0b12=_0x6f0b12||0xc8;return function(_0x34c8a3){if(_0x34c8a3){return _0x3d2ebe[_0x6802('0x1d')](_0x6f0b12)[_0x6802('0x1f')](_0x34c8a3);}};}function respondWithFilteredResult(_0x5d6bcb,_0x22b12d){return function(_0x251268){if(_0x251268){var _0x99afa1=typeof _0x22b12d[_0x6802('0x20')]===_0x6802('0x21')&&typeof _0x22b12d['limit']===_0x6802('0x21');var _0x184fe8=_0x251268[_0x6802('0x22')];var _0x2fe56d=_0x99afa1?0x0:_0x22b12d[_0x6802('0x20')];var _0x2da941=_0x99afa1?_0x251268[_0x6802('0x22')]:_0x22b12d[_0x6802('0x20')]+_0x22b12d[_0x6802('0x23')];var _0x248cc3;if(_0x2da941>=_0x184fe8){_0x2da941=_0x184fe8;_0x248cc3=0xc8;}else{_0x248cc3=0xce;}_0x5d6bcb[_0x6802('0x1d')](_0x248cc3);return _0x5d6bcb[_0x6802('0x24')](_0x6802('0x25'),_0x2fe56d+'-'+_0x2da941+'/'+_0x184fe8)[_0x6802('0x1f')](_0x251268);}return null;};}function patchUpdates(_0x217132){return function(_0x48193b){try{jsonpatch[_0x6802('0x26')](_0x48193b,_0x217132,!![]);}catch(_0xebb35f){return BPromise['reject'](_0xebb35f);}return _0x48193b['save']();};}function saveUpdates(_0x154b33,_0x3e6f4e){return function(_0x5c906a){if(_0x5c906a){return _0x5c906a[_0x6802('0x27')](_0x154b33)[_0x6802('0x28')](function(_0x480897){return _0x480897;});}return null;};}function handleEntityNotFound(_0x4aacd2,_0x3194eb){return function(_0xefadcf){if(!_0xefadcf){_0x4aacd2[_0x6802('0x29')](0x194);}return _0xefadcf;};}function handleError(_0x10977c,_0xe041ae){_0xe041ae=_0xe041ae||0x1f4;return function(_0x2c360e){logger[_0x6802('0x2a')](_0x2c360e[_0x6802('0x2b')]);if(_0x2c360e[_0x6802('0x2c')]){delete _0x2c360e[_0x6802('0x2c')];}_0x10977c[_0x6802('0x1d')](_0xe041ae)[_0x6802('0x2d')](_0x2c360e);};}exports[_0x6802('0x2e')]=function(_0x151ce7,_0x30bf20){var _0x2f67a1={},_0x51bc17={},_0x2b108b={'count':0x0,'rows':[]};var _0xbe7c81=_[_0x6802('0x2f')](db[_0x6802('0x30')]['rawAttributes'],function(_0x459a99){return{'name':_0x459a99['fieldName'],'type':_0x459a99['type'][_0x6802('0x31')]};});_0x51bc17[_0x6802('0x32')]=_[_0x6802('0x2f')](_0xbe7c81,'name');_0x51bc17[_0x6802('0x33')]=_[_0x6802('0x34')](_0x151ce7['query']);_0x51bc17[_0x6802('0x35')]=_[_0x6802('0x36')](_0x51bc17[_0x6802('0x32')],_0x51bc17[_0x6802('0x33')]);_0x2f67a1[_0x6802('0x37')]=_[_0x6802('0x36')](_0x51bc17['model'],qs[_0x6802('0x38')](_0x151ce7['query'][_0x6802('0x38')]));_0x2f67a1[_0x6802('0x37')]=_0x2f67a1[_0x6802('0x37')][_0x6802('0x39')]?_0x2f67a1[_0x6802('0x37')]:_0x51bc17['model'];if(!_0x151ce7['query'][_0x6802('0x3a')](_0x6802('0x3b'))){_0x2f67a1[_0x6802('0x23')]=qs[_0x6802('0x23')](_0x151ce7[_0x6802('0x33')]['limit']);_0x2f67a1[_0x6802('0x20')]=qs['offset'](_0x151ce7[_0x6802('0x33')]['offset']);}_0x2f67a1[_0x6802('0x3c')]=qs[_0x6802('0x3d')](_0x151ce7[_0x6802('0x33')][_0x6802('0x3d')]);_0x2f67a1[_0x6802('0x3e')]=qs[_0x6802('0x35')](_['pick'](_0x151ce7[_0x6802('0x33')],_0x51bc17[_0x6802('0x35')]),_0xbe7c81);if(_0x151ce7[_0x6802('0x33')][_0x6802('0x3f')]){_0x2f67a1[_0x6802('0x3e')]=_['merge'](_0x2f67a1[_0x6802('0x3e')],{'$or':_['map'](_0xbe7c81,function(_0x5c76b2){if(_0x5c76b2['type']!==_0x6802('0x40')){var _0x3763fe={};_0x3763fe[_0x5c76b2['name']]={'$like':'%'+_0x151ce7[_0x6802('0x33')][_0x6802('0x3f')]+'%'};return _0x3763fe;}})});}_0x2f67a1=_[_0x6802('0x41')]({},_0x2f67a1,_0x151ce7[_0x6802('0x42')]);var _0x5accca={'where':_0x2f67a1[_0x6802('0x3e')]};return db[_0x6802('0x30')][_0x6802('0x22')](_0x5accca)[_0x6802('0x28')](function(_0x4a11de){_0x2b108b[_0x6802('0x22')]=_0x4a11de;if(_0x151ce7[_0x6802('0x33')][_0x6802('0x43')]){_0x2f67a1['include']=[{'all':!![]}];}return db['Team'][_0x6802('0x44')](_0x2f67a1);})[_0x6802('0x28')](function(_0x15715f){_0x2b108b[_0x6802('0x45')]=_0x15715f;return _0x2b108b;})['then'](respondWithFilteredResult(_0x30bf20,_0x2f67a1))[_0x6802('0x46')](handleError(_0x30bf20,null));};exports[_0x6802('0x47')]=function(_0x3942e1,_0x4aaccd){var _0xd8e32a={'raw':![],'where':{'id':_0x3942e1['params']['id']}},_0xe5e78c={};_0xe5e78c['model']=_[_0x6802('0x34')](db[_0x6802('0x30')][_0x6802('0x48')]);_0xe5e78c['query']=_[_0x6802('0x34')](_0x3942e1['query']);_0xe5e78c[_0x6802('0x35')]=_[_0x6802('0x36')](_0xe5e78c[_0x6802('0x32')],_0xe5e78c[_0x6802('0x33')]);_0xd8e32a[_0x6802('0x37')]=_[_0x6802('0x36')](_0xe5e78c[_0x6802('0x32')],qs[_0x6802('0x38')](_0x3942e1[_0x6802('0x33')][_0x6802('0x38')]));_0xd8e32a['attributes']=_0xd8e32a[_0x6802('0x37')][_0x6802('0x39')]?_0xd8e32a[_0x6802('0x37')]:_0xe5e78c[_0x6802('0x32')];if(_0x3942e1[_0x6802('0x33')][_0x6802('0x43')]){_0xd8e32a['include']=[{'all':!![]}];}_0xd8e32a=_[_0x6802('0x41')]({},_0xd8e32a,_0x3942e1[_0x6802('0x42')]);return db[_0x6802('0x30')][_0x6802('0x49')](_0xd8e32a)['then'](handleEntityNotFound(_0x4aaccd,null))[_0x6802('0x28')](respondWithResult(_0x4aaccd,null))[_0x6802('0x46')](handleError(_0x4aaccd,null));};exports[_0x6802('0x4a')]=function(_0x4670d2,_0x576441){return db[_0x6802('0x30')]['create'](_0x4670d2[_0x6802('0x4b')],{})[_0x6802('0x28')](function(_0x19b7de){var _0x5a31ad=_0x4670d2['user'][_0x6802('0x4c')]({'plain':!![]});if(!_0x5a31ad)throw new Error(_0x6802('0x4d'));if(_0x5a31ad['role']===_0x6802('0x4e')){var _0x5ae588=_0x19b7de[_0x6802('0x4c')]({'plain':!![]});var _0x5324ff='Teams';return db[_0x6802('0x4f')]['find']({'where':{'name':_0x5324ff,'userProfileId':_0x5a31ad['userProfileId']},'raw':!![]})[_0x6802('0x28')](function(_0x4974f4){if(_0x4974f4&&_0x4974f4['autoAssociation']===0x0){return db['UserProfileResource'][_0x6802('0x4a')]({'name':_0x5ae588['name'],'resourceId':_0x5ae588['id'],'type':_0x4974f4[_0x6802('0x2c')],'sectionId':_0x4974f4['id']},{})[_0x6802('0x28')](function(){return _0x19b7de;});}else{return _0x19b7de;}})[_0x6802('0x46')](function(_0x112187){logger[_0x6802('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x112187);throw _0x112187;});}return _0x19b7de;})[_0x6802('0x28')](respondWithResult(_0x576441,0xc9))[_0x6802('0x46')](handleError(_0x576441,null));};exports[_0x6802('0x27')]=function(_0x5a445a,_0x28ada3){if(_0x5a445a[_0x6802('0x4b')]['id']){delete _0x5a445a[_0x6802('0x4b')]['id'];}return db[_0x6802('0x30')][_0x6802('0x49')]({'where':{'id':_0x5a445a[_0x6802('0x50')]['id']}})['then'](handleEntityNotFound(_0x28ada3,null))[_0x6802('0x28')](saveUpdates(_0x5a445a['body'],null))[_0x6802('0x28')](respondWithResult(_0x28ada3,null))[_0x6802('0x46')](handleError(_0x28ada3,null));};exports[_0x6802('0x51')]=function(_0x343e94,_0x3313e4){var _0x54568a=_0x343e94[_0x6802('0x50')]['id'];var _0x3eb4ee=[];return db[_0x6802('0x52')][_0x6802('0x53')](function(_0x3cbb23){var _0x40d21a='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x54568a;return db[_0x6802('0x52')][_0x6802('0x33')](_0x40d21a,{'type':db[_0x6802('0x54')]['QueryTypes'][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23})[_0x6802('0x28')](function(_0x4f1bc8){_0x3eb4ee=_['map'](_0x4f1bc8,function(_0x31e86c){return Number(_0x31e86c[_0x6802('0x56')]);});})[_0x6802('0x28')](function(){var _0x48cc87=_0x6802('0x57')+_0x54568a;return db[_0x6802('0x52')][_0x6802('0x33')](_0x48cc87,{'type':db[_0x6802('0x54')][_0x6802('0x58')][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x406c68){var _0x4edecd=_[_0x6802('0x2f')](_0x406c68,function(_0x27d42b){return Number(_0x27d42b[_0x6802('0x59')]);});return db[_0x6802('0x5a')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'VoiceQueueId':{'$in':_0x4edecd}},'transaction':_0x3cbb23});})[_0x6802('0x28')](function(){var _0x1890b9=_0x6802('0x5b')+_0x54568a;return db[_0x6802('0x52')][_0x6802('0x33')](_0x1890b9,{'type':db[_0x6802('0x54')][_0x6802('0x58')][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x4b4d81){var _0x4315a6=_[_0x6802('0x2f')](_0x4b4d81,function(_0x48bfa5){return Number(_0x48bfa5[_0x6802('0x5c')]);});return db[_0x6802('0x5d')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'MailQueueId':{'$in':_0x4315a6}},'transaction':_0x3cbb23});})[_0x6802('0x28')](function(){var _0x23abdd=_0x6802('0x5e')+_0x54568a;return db['sequelize'][_0x6802('0x33')](_0x23abdd,{'type':db[_0x6802('0x54')][_0x6802('0x58')][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x46afdc){var _0x5a6a36=_[_0x6802('0x2f')](_0x46afdc,function(_0x178c90){return Number(_0x178c90[_0x6802('0x5f')]);});return db[_0x6802('0x60')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'SmsQueueId':{'$in':_0x5a6a36}},'transaction':_0x3cbb23});})[_0x6802('0x28')](function(){var _0x282fe9='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54568a;return db[_0x6802('0x52')][_0x6802('0x33')](_0x282fe9,{'type':db[_0x6802('0x54')][_0x6802('0x58')][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x49f006){var _0x4f2ff8=_[_0x6802('0x2f')](_0x49f006,function(_0x19cb14){return Number(_0x19cb14['ChatQueueId']);});return db[_0x6802('0x61')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'ChatQueueId':{'$in':_0x4f2ff8}},'transaction':_0x3cbb23});})[_0x6802('0x28')](function(){var _0x1f2769=_0x6802('0x62')+_0x54568a;return db[_0x6802('0x52')]['query'](_0x1f2769,{'type':db[_0x6802('0x54')][_0x6802('0x58')]['SELECT'],'raw':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x5290ec){var _0x279e6f=_[_0x6802('0x2f')](_0x5290ec,function(_0x195f4a){return Number(_0x195f4a[_0x6802('0x63')]);});return db['UserFaxQueue'][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'FaxQueueId':{'$in':_0x279e6f}},'transaction':_0x3cbb23});})['then'](function(){var _0x1a1c7f=_0x6802('0x64')+_0x54568a;return db[_0x6802('0x52')]['query'](_0x1a1c7f,{'type':db[_0x6802('0x54')]['QueryTypes'][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23});})['then'](function(_0x58be22){var _0x1332a2=_[_0x6802('0x2f')](_0x58be22,function(_0x56d755){return Number(_0x56d755[_0x6802('0x65')]);});return db[_0x6802('0x66')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'OpenchannelQueueId':{'$in':_0x1332a2}},'transaction':_0x3cbb23});})[_0x6802('0x28')](function(){var _0x3fa2b7=_0x6802('0x67')+_0x54568a;return db[_0x6802('0x52')]['query'](_0x3fa2b7,{'type':db['Sequelize']['QueryTypes'][_0x6802('0x55')],'raw':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x5d2d6f){var _0x27ad26=_[_0x6802('0x2f')](_0x5d2d6f,function(_0x44cddf){return Number(_0x44cddf['WhatsappQueueId']);});return db[_0x6802('0x68')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'WhatsappQueueId':{'$in':_0x27ad26}},'transaction':_0x3cbb23});})['then'](function(){return db[_0x6802('0x69')][_0x6802('0x49')]({'where':{'TeamId':_0x54568a}});})['then'](function(_0x1bbab0){if(_0x1bbab0===null){return;}return db[_0x6802('0x6a')][_0x6802('0x51')]({'where':{'UserId':{'$in':_0x3eb4ee},'VoicePrefixId':_0x1bbab0['VoicePrefixId']},'transaction':_0x3cbb23});})[_0x6802('0x28')](function(){return db['Team'][_0x6802('0x51')]({'where':{'id':_0x54568a},'cascade':!![],'transaction':_0x3cbb23});})[_0x6802('0x28')](function(_0x353807){if(_0x353807===0x0){_0x3313e4[_0x6802('0x29')](0x194);}else{return db['UserProfileResource'][_0x6802('0x51')]({'where':{'type':_0x6802('0x6b'),'resourceId':_0x54568a},'cascade':!![],'transaction':_0x3cbb23})[_0x6802('0x28')](function(){_0x3313e4[_0x6802('0x1d')](0xcc)['end']();});}})['catch'](function(_0x543a80){_0x3313e4[_0x6802('0x1d')](0x1f4)['send'](_0x543a80);});});};exports[_0x6802('0x6c')]=function(_0x2a204a,_0x1bddd9,_0x1ca3bc){return db[_0x6802('0x30')]['findOne']({'where':{'id':_0x2a204a[_0x6802('0x50')]['id']}})[_0x6802('0x28')](handleEntityNotFound(_0x1bddd9,null))['then'](function(_0xe85788){if(!_0x2a204a[_0x6802('0x33')][_0x6802('0x6d')]||!utils[_0x6802('0x6e')](_0x2a204a[_0x6802('0x33')][_0x6802('0x6d')])){throw new db[(_0x6802('0x54'))]['ValidationError'](_0x6802('0x6f'));}var _0x531620={};var _0x43324e={};_0x43324e['model']=_[_0x6802('0x34')](db[_[_0x6802('0x70')](_0x2a204a[_0x6802('0x33')][_0x6802('0x6d')][_0x6802('0x71')]())+_0x6802('0x72')][_0x6802('0x48')]);_0x43324e[_0x6802('0x33')]=_['keys'](_0x2a204a[_0x6802('0x33')]);_0x43324e[_0x6802('0x35')]=_[_0x6802('0x36')](_0x43324e['model'],_0x43324e[_0x6802('0x33')]);_0x531620[_0x6802('0x37')]=_[_0x6802('0x36')](_0x43324e[_0x6802('0x32')],qs[_0x6802('0x38')](_0x2a204a[_0x6802('0x33')][_0x6802('0x38')]));_0x531620[_0x6802('0x37')]=_0x531620['attributes'][_0x6802('0x39')]?_0x531620['attributes']:_0x43324e['model'];_0x531620[_0x6802('0x23')]=qs[_0x6802('0x23')](_0x2a204a[_0x6802('0x33')][_0x6802('0x23')]);_0x531620[_0x6802('0x20')]=qs['offset'](_0x2a204a['query']['offset']);_0x531620[_0x6802('0x3c')]=qs[_0x6802('0x3d')](_0x2a204a['query']['sort']);_0x531620[_0x6802('0x3e')]=qs[_0x6802('0x35')](_[_0x6802('0x73')](_0x2a204a['query'],_0x43324e[_0x6802('0x35')]));_0x531620=_[_0x6802('0x41')]({},_0x531620,_0x2a204a[_0x6802('0x42')]);return _0xe85788[_0x6802('0x4c')+_['capitalize'](_0x2a204a[_0x6802('0x33')][_0x6802('0x6d')][_0x6802('0x71')]())+_0x6802('0x74')](_0x531620);})[_0x6802('0x28')](respondWithResult(_0x1bddd9,null))[_0x6802('0x46')](handleError(_0x1bddd9,null));};exports[_0x6802('0x75')]=function(_0x2cff02,_0x1ae234,_0x5bef1f){return db[_0x6802('0x30')][_0x6802('0x76')]({'where':{'id':_0x2cff02[_0x6802('0x50')]['id']}})[_0x6802('0x28')](function(_0x2b2605){if(_0x2b2605){if(!_0x2cff02[_0x6802('0x4b')][_0x6802('0x6d')]||!utils[_0x6802('0x6e')](_0x2cff02[_0x6802('0x4b')][_0x6802('0x6d')])){throw new db[(_0x6802('0x54'))][(_0x6802('0x77'))](_0x6802('0x6f'));}return _0x2b2605['add'+_[_0x6802('0x70')](_0x2cff02[_0x6802('0x4b')][_0x6802('0x6d')][_0x6802('0x71')]())+_0x6802('0x74')](_0x2cff02['body'][_0x6802('0x78')]);}return null;})['then'](handleEntityNotFound(_0x1ae234,null))[_0x6802('0x28')](respondWithStatusCode(_0x1ae234,null))[_0x6802('0x46')](handleError(_0x1ae234,null));};exports[_0x6802('0x79')]=function(_0xa54920,_0x34cafc,_0x86f383){return db['Team']['findOne']({'where':{'id':_0xa54920[_0x6802('0x50')]['id']}})[_0x6802('0x28')](function(_0x175b6f){if(_0x175b6f){if(!_0xa54920[_0x6802('0x33')][_0x6802('0x6d')]||!utils['isValidChannel'](_0xa54920[_0x6802('0x33')][_0x6802('0x6d')])){throw new db[(_0x6802('0x54'))][(_0x6802('0x77'))](_0x6802('0x6f'));}return _0x175b6f[_0x6802('0x7a')+_[_0x6802('0x70')](_0xa54920['query']['channel'][_0x6802('0x71')]())+_0x6802('0x74')](_0xa54920[_0x6802('0x33')][_0x6802('0x78')]);}return null;})[_0x6802('0x28')](handleEntityNotFound(_0x34cafc,null))[_0x6802('0x28')](respondWithStatusCode(_0x34cafc,null))[_0x6802('0x46')](handleError(_0x34cafc,null));};exports[_0x6802('0x7b')]=function(_0x3c6087,_0x23ed38){var _0x3a9d60=_[_0x6802('0x7c')](_0x3c6087[_0x6802('0x4b')][_0x6802('0x78')])?_0x3c6087[_0x6802('0x4b')][_0x6802('0x78')]:[_0x3c6087[_0x6802('0x4b')]['ids']];var _0x2b4299=_0x3c6087[_0x6802('0x50')]['id'];return db['Team'][_0x6802('0x49')]({'where':{'id':_0x2b4299}})['then'](handleEntityNotFound(_0x23ed38,null))[_0x6802('0x28')](function(_0x1947c0){if(_0x1947c0){var _0x891dd7=['Voice','Chat',_0x6802('0x7d'),_0x6802('0x7e'),_0x6802('0x7f'),'Openchannel','Whatsapp'];return db[_0x6802('0x52')][_0x6802('0x53')](function(_0x5089e6){var _0x933afe=_[_0x6802('0x2f')](_0x891dd7,function(_0x2892fe){var _0x414111={'attributes':['id',_0x6802('0x2c')]};if(_0x2892fe===_0x6802('0x80')){_0x414111[_0x6802('0x81')]={'attributes':[_0x6802('0x82')]};}return _0x1947c0[_0x6802('0x4c')+_0x2892fe+_0x6802('0x74')](_0x414111)[_0x6802('0x28')](function(_0x53faa3){var _0x540a77=_[_0x6802('0x2f')](_0x53faa3,function(_0x547103){var _0x199460=_['map'](_0x3a9d60,function(_0x24d93c){var _0x48bf3b={'where':{'UserId':_0x24d93c,[_0x2892fe+_0x6802('0x83')]:_0x547103['id']},'transaction':_0x5089e6};if(_0x2892fe===_0x6802('0x80')){_0x48bf3b[_0x6802('0x84')]={'penalty':_0x547103[_0x6802('0x85')][_0x6802('0x82')]};}return db[_0x6802('0x86')+_0x2892fe+_0x6802('0x72')][_0x6802('0x87')](_0x48bf3b)[_0x6802('0x28')](function(){socket[_0x6802('0x88')](_0x6802('0x4e')+_0x2892fe+_0x6802('0x89'),{'UserId':_0x24d93c,[_0x2892fe+_0x6802('0x83')]:_0x547103['id']});if(_0x2892fe!==_0x6802('0x80')){return;}return db['User'][_0x6802('0x44')]({'where':{'id':_0x3a9d60,'online':0x1},'attributes':['id','name',_0x6802('0x8a'),_0x6802('0x8b'),_0x6802('0x8c')],'raw':!![]})[_0x6802('0x28')](function(_0x4b6b48){var _0x358deb=_[_0x6802('0x2f')](_0x4b6b48,function(_0x15e823){return db[_0x6802('0x8d')][_0x6802('0x8e')]({'membername':_0x15e823[_0x6802('0x2c')],'UserId':_0x15e823['id'],'queue_name':_0x547103[_0x6802('0x2c')],'VoiceQueueId':_0x547103['id'],'interface':_[_0x6802('0x8f')](_0x15e823[_0x6802('0x8c')])?util[_0x6802('0x90')]('SIP/%s',_0x15e823[_0x6802('0x2c')]):_0x15e823['interface'],'paused':_0x15e823[_0x6802('0x8b')]||![],'penalty':_0x547103[_0x6802('0x85')][_0x6802('0x82')]},{'transaction':_0x5089e6});});return Promise[_0x6802('0x91')](_0x358deb);});});});return Promise[_0x6802('0x91')](_0x199460);});return Promise[_0x6802('0x91')](_0x540a77);})[_0x6802('0x28')](function(){return db[_0x6802('0x69')][_0x6802('0x76')]({'where':{'teamId':_0x2b4299}})[_0x6802('0x28')](function(_0x122545){if(_0x122545){var _0x48f77a=_[_0x6802('0x2f')](_0x3a9d60,function(_0x502876){db[_0x6802('0x6a')][_0x6802('0x8e')]({'UserId':_0x502876,'VoicePrefixId':_0x122545['VoicePrefixId']});});return Promise[_0x6802('0x91')](_0x48f77a);}});});});return Promise['all'](_0x933afe)[_0x6802('0x28')](function(){return _0x1947c0[_0x6802('0x7b')](_0x3a9d60,{'transaction':_0x5089e6})[_0x6802('0x92')](function(_0x1b0ce0){return _0x1b0ce0;});});});}})['then'](respondWithResult(_0x23ed38,null))[_0x6802('0x46')](handleError(_0x23ed38,null));};exports[_0x6802('0x93')]=function(_0x99f15e,_0x1983ea){var _0x1f6493=_[_0x6802('0x7c')](_0x99f15e['query'][_0x6802('0x78')])?_0x99f15e['query'][_0x6802('0x78')]:[_0x99f15e['query']['ids']];var _0x32c72d=_0x99f15e[_0x6802('0x50')]['id'];return db[_0x6802('0x30')][_0x6802('0x49')]({'where':{'id':_0x32c72d}})[_0x6802('0x28')](handleEntityNotFound(_0x1983ea,null))[_0x6802('0x28')](function(_0x1d2144){if(_0x1d2144){var _0x4f778d=[_0x6802('0x80'),_0x6802('0x94'),_0x6802('0x7d'),'Sms',_0x6802('0x7f'),_0x6802('0x95'),'Whatsapp'];return db[_0x6802('0x52')]['transaction'](function(_0xee01db){var _0x34ba81=_[_0x6802('0x2f')](_0x4f778d,function(_0x69d3b){var _0x36737d={'attributes':['id',_0x6802('0x2c')]};return _0x1d2144[_0x6802('0x4c')+_0x69d3b+'Queues'](_0x36737d)['then'](function(_0x49ffba){var _0x2c8d29=_[_0x6802('0x2f')](_0x49ffba,function(_0x346577){return _0x346577[_0x6802('0x93')](_0x1f6493,{'transaction':_0xee01db})[_0x6802('0x28')](function(){var _0x1a394d=_['map'](_0x1f6493,function(_0x199eba){socket[_0x6802('0x88')](_0x6802('0x4e')+_0x69d3b+_0x6802('0x96'),{'UserId':Number(_0x199eba),[_0x69d3b+_0x6802('0x83')]:_0x346577['id']});if(_0x69d3b!=='Voice'){return;}return db[_0x6802('0x8d')][_0x6802('0x51')]({'where':{'VoiceQueueId':_0x346577['id'],'UserId':_0x199eba},'transaction':_0xee01db});});return Promise[_0x6802('0x91')](_0x1a394d);});});return Promise['all'](_0x2c8d29);});});return Promise[_0x6802('0x91')](_0x34ba81)[_0x6802('0x28')](function(){return _0x1d2144[_0x6802('0x93')](_0x1f6493,{'transaction':_0xee01db});})[_0x6802('0x28')](function(){return db[_0x6802('0x69')][_0x6802('0x76')]({'where':{'teamId':_0x32c72d}})[_0x6802('0x28')](function(_0x56298f){if(_0x56298f){var _0x10ed61=_[_0x6802('0x2f')](_0x1f6493,function(_0x44be15){db[_0x6802('0x6a')]['destroy']({'where':{'UserId':_0x44be15,'VoicePrefixId':_0x56298f[_0x6802('0x97')]}});});return Promise['all'](_0x10ed61);}});});});}})[_0x6802('0x28')](respondWithStatusCode(_0x1983ea,null))[_0x6802('0x46')](handleError(_0x1983ea,null));};exports[_0x6802('0x98')]=function(_0x8589c7,_0x1ee0cf,_0x21749e){var _0x3d0162={};var _0xcd57e4={};var _0x21b78c;var _0x592f3c;return db[_0x6802('0x30')]['findOne']({'where':{'id':_0x8589c7[_0x6802('0x50')]['id']}})[_0x6802('0x28')](handleEntityNotFound(_0x1ee0cf,null))[_0x6802('0x28')](function(_0x43a604){if(_0x43a604){_0x21b78c=_0x43a604;_0xcd57e4[_0x6802('0x32')]=_['keys'](db[_0x6802('0x86')][_0x6802('0x48')]);_0xcd57e4[_0x6802('0x33')]=_[_0x6802('0x34')](_0x8589c7['query']);_0xcd57e4['filters']=_[_0x6802('0x36')](_0xcd57e4[_0x6802('0x32')],_0xcd57e4['query']);_0x3d0162[_0x6802('0x37')]=_[_0x6802('0x36')](_0xcd57e4[_0x6802('0x32')],qs[_0x6802('0x38')](_0x8589c7[_0x6802('0x33')][_0x6802('0x38')]));_0x3d0162['attributes']=_0x3d0162[_0x6802('0x37')]['length']?_0x3d0162[_0x6802('0x37')]:_0xcd57e4[_0x6802('0x32')];_0x3d0162[_0x6802('0x3c')]=qs['sort'](_0x8589c7[_0x6802('0x33')][_0x6802('0x3d')]);_0x3d0162[_0x6802('0x3e')]=qs['filters'](_[_0x6802('0x73')](_0x8589c7[_0x6802('0x33')],_0xcd57e4[_0x6802('0x35')]));if(_0x8589c7[_0x6802('0x33')][_0x6802('0x3f')]){_0x3d0162['where']=_[_0x6802('0x41')](_0x3d0162[_0x6802('0x3e')],{'$or':_[_0x6802('0x2f')](_0x3d0162[_0x6802('0x37')],function(_0x2e412e){var _0x49c891={};_0x49c891[_0x2e412e]={'$like':'%'+_0x8589c7[_0x6802('0x33')]['filter']+'%'};return _0x49c891;})});}_0x3d0162=_[_0x6802('0x41')]({},_0x3d0162,_0x8589c7[_0x6802('0x42')]);return _0x21b78c[_0x6802('0x98')](_0x3d0162);}})['then'](function(_0xe1a30d){if(_0xe1a30d){_0x592f3c=_0xe1a30d[_0x6802('0x39')];if(!_0x8589c7['query'][_0x6802('0x3a')](_0x6802('0x3b'))){_0x3d0162['limit']=qs['limit'](_0x8589c7[_0x6802('0x33')][_0x6802('0x23')]);_0x3d0162['offset']=qs[_0x6802('0x20')](_0x8589c7['query'][_0x6802('0x20')]);}return _0x21b78c[_0x6802('0x98')](_0x3d0162);}})[_0x6802('0x28')](function(_0x3c31db){if(_0x3c31db){return _0x3c31db?{'count':_0x592f3c,'rows':_0x3c31db}:null;}})['then'](respondWithResult(_0x1ee0cf,null))[_0x6802('0x46')](handleError(_0x1ee0cf,null));}; \ No newline at end of file +var _0x993a=['../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','./team.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','index','map','rawAttributes','fieldName','key','name','query','model','attributes','intersection','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','Team','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','userProfileId','UserProfileResource','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','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','send','findOne','channel','ValidationError','Unknown\x20channel','keys','capitalize','toLowerCase','Queue','filters','Queues','addQueues','isValidChannel','add','removeQueues','remove','addAgents','isArray','ids','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','QueueId','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','TeamVoiceQueue','all','VoicePrefixId','spread','Chat','Queue:remove','removeAgents','hasOwnProperty','nolimit','getAgents','zip-dir','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x258ed7,_0x184498){var _0x20ffde=function(_0x1f3ffb){while(--_0x1f3ffb){_0x258ed7['push'](_0x258ed7['shift']());}};_0x20ffde(++_0x184498);}(_0x993a,0x1ba));var _0xa993=function(_0x28c778,_0x23588d){_0x28c778=_0x28c778-0x0;var _0x3bdbae=_0x993a[_0x28c778];return _0x3bdbae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa993('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa993('0x1'));var Mustache=require('mustache');var util=require(_0xa993('0x2'));var path=require(_0xa993('0x3'));var sox=require('sox');var csv=require(_0xa993('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa993('0x5'));var _=require(_0xa993('0x6'));var squel=require(_0xa993('0x7'));var crypto=require(_0xa993('0x8'));var jsforce=require(_0xa993('0x9'));var deskjs=require(_0xa993('0xa'));var toCsv=require(_0xa993('0x4'));var querystring=require(_0xa993('0xb'));var Papa=require(_0xa993('0xc'));var Redis=require(_0xa993('0xd'));var authService=require(_0xa993('0xe'));var qs=require(_0xa993('0xf'));var as=require(_0xa993('0x10'));var hardwareService=require(_0xa993('0x11'));var logger=require(_0xa993('0x12'))(_0xa993('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa993('0x14'))['db'];config[_0xa993('0x15')]=_['defaults'](config[_0xa993('0x15')],{'host':_0xa993('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa993('0x15')]));require(_0xa993('0x17'))[_0xa993('0x18')](socket);function respondWithStatusCode(_0x19c753,_0x36db46){_0x36db46=_0x36db46||0xcc;return function(_0x5a5f4b){if(_0x5a5f4b){return _0x19c753['sendStatus'](_0x36db46);}return _0x19c753[_0xa993('0x19')](_0x36db46)[_0xa993('0x1a')]();};}function respondWithResult(_0x594992,_0x3b30d4){_0x3b30d4=_0x3b30d4||0xc8;return function(_0x380993){if(_0x380993){return _0x594992['status'](_0x3b30d4)[_0xa993('0x1b')](_0x380993);}};}function respondWithFilteredResult(_0x1e5c3e,_0x4083fa){return function(_0xeec6c6){if(_0xeec6c6){var _0x428165=typeof _0x4083fa[_0xa993('0x1c')]===_0xa993('0x1d')&&typeof _0x4083fa[_0xa993('0x1e')]===_0xa993('0x1d');var _0x54b094=_0xeec6c6[_0xa993('0x1f')];var _0x143242=_0x428165?0x0:_0x4083fa['offset'];var _0xc146d2=_0x428165?_0xeec6c6[_0xa993('0x1f')]:_0x4083fa[_0xa993('0x1c')]+_0x4083fa[_0xa993('0x1e')];var _0x4566cf;if(_0xc146d2>=_0x54b094){_0xc146d2=_0x54b094;_0x4566cf=0xc8;}else{_0x4566cf=0xce;}_0x1e5c3e[_0xa993('0x19')](_0x4566cf);return _0x1e5c3e[_0xa993('0x20')](_0xa993('0x21'),_0x143242+'-'+_0xc146d2+'/'+_0x54b094)[_0xa993('0x1b')](_0xeec6c6);}return null;};}function patchUpdates(_0x4706aa){return function(_0x27ba44){try{jsonpatch[_0xa993('0x22')](_0x27ba44,_0x4706aa,!![]);}catch(_0x464c58){return BPromise[_0xa993('0x23')](_0x464c58);}return _0x27ba44[_0xa993('0x24')]();};}function saveUpdates(_0x2ac8e2,_0x2a3ed){return function(_0x3adcee){if(_0x3adcee){return _0x3adcee[_0xa993('0x25')](_0x2ac8e2)[_0xa993('0x26')](function(_0x30d83c){return _0x30d83c;});}return null;};}function handleEntityNotFound(_0x35da13,_0xad2c46){return function(_0x6aa5d3){if(!_0x6aa5d3){_0x35da13[_0xa993('0x27')](0x194);}return _0x6aa5d3;};}function handleError(_0x55c348,_0x18f7ba){_0x18f7ba=_0x18f7ba||0x1f4;return function(_0x207b13){logger[_0xa993('0x28')](_0x207b13[_0xa993('0x29')]);if(_0x207b13['name']){delete _0x207b13['name'];}_0x55c348[_0xa993('0x19')](_0x18f7ba)['send'](_0x207b13);};}exports[_0xa993('0x2a')]=function(_0x76de30,_0x40edec){var _0xfd4c47={},_0x55c699={},_0x2f8073={'count':0x0,'rows':[]};var _0x3d856c=_[_0xa993('0x2b')](db['Team'][_0xa993('0x2c')],function(_0x2403c0){return{'name':_0x2403c0[_0xa993('0x2d')],'type':_0x2403c0['type'][_0xa993('0x2e')]};});_0x55c699['model']=_[_0xa993('0x2b')](_0x3d856c,_0xa993('0x2f'));_0x55c699[_0xa993('0x30')]=_['keys'](_0x76de30[_0xa993('0x30')]);_0x55c699['filters']=_['intersection'](_0x55c699[_0xa993('0x31')],_0x55c699[_0xa993('0x30')]);_0xfd4c47[_0xa993('0x32')]=_[_0xa993('0x33')](_0x55c699[_0xa993('0x31')],qs['fields'](_0x76de30['query'][_0xa993('0x34')]));_0xfd4c47[_0xa993('0x32')]=_0xfd4c47[_0xa993('0x32')][_0xa993('0x35')]?_0xfd4c47['attributes']:_0x55c699[_0xa993('0x31')];if(!_0x76de30[_0xa993('0x30')]['hasOwnProperty']('nolimit')){_0xfd4c47['limit']=qs[_0xa993('0x1e')](_0x76de30[_0xa993('0x30')][_0xa993('0x1e')]);_0xfd4c47[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x76de30[_0xa993('0x30')]['offset']);}_0xfd4c47[_0xa993('0x36')]=qs[_0xa993('0x37')](_0x76de30['query'][_0xa993('0x37')]);_0xfd4c47[_0xa993('0x38')]=qs['filters'](_[_0xa993('0x39')](_0x76de30[_0xa993('0x30')],_0x55c699['filters']),_0x3d856c);if(_0x76de30[_0xa993('0x30')][_0xa993('0x3a')]){_0xfd4c47['where']=_['merge'](_0xfd4c47[_0xa993('0x38')],{'$or':_['map'](_0x3d856c,function(_0x55abbe){if(_0x55abbe[_0xa993('0x3b')]!==_0xa993('0x3c')){var _0x4ed7c5={};_0x4ed7c5[_0x55abbe[_0xa993('0x2f')]]={'$like':'%'+_0x76de30[_0xa993('0x30')][_0xa993('0x3a')]+'%'};return _0x4ed7c5;}})});}_0xfd4c47=_[_0xa993('0x3d')]({},_0xfd4c47,_0x76de30[_0xa993('0x3e')]);var _0x461b1d={'where':_0xfd4c47[_0xa993('0x38')]};return db['Team'][_0xa993('0x1f')](_0x461b1d)[_0xa993('0x26')](function(_0x46976b){_0x2f8073[_0xa993('0x1f')]=_0x46976b;if(_0x76de30[_0xa993('0x30')][_0xa993('0x3f')]){_0xfd4c47[_0xa993('0x40')]=[{'all':!![]}];}return db['Team'][_0xa993('0x41')](_0xfd4c47);})[_0xa993('0x26')](function(_0x1f4c0c){_0x2f8073[_0xa993('0x42')]=_0x1f4c0c;return _0x2f8073;})[_0xa993('0x26')](respondWithFilteredResult(_0x40edec,_0xfd4c47))[_0xa993('0x43')](handleError(_0x40edec,null));};exports[_0xa993('0x44')]=function(_0x19728c,_0x1c2d6c){var _0x1bcfc6={'raw':![],'where':{'id':_0x19728c[_0xa993('0x45')]['id']}},_0x312856={};_0x312856[_0xa993('0x31')]=_['keys'](db[_0xa993('0x46')][_0xa993('0x2c')]);_0x312856[_0xa993('0x30')]=_['keys'](_0x19728c['query']);_0x312856['filters']=_['intersection'](_0x312856['model'],_0x312856['query']);_0x1bcfc6['attributes']=_[_0xa993('0x33')](_0x312856['model'],qs['fields'](_0x19728c[_0xa993('0x30')]['fields']));_0x1bcfc6[_0xa993('0x32')]=_0x1bcfc6[_0xa993('0x32')][_0xa993('0x35')]?_0x1bcfc6[_0xa993('0x32')]:_0x312856[_0xa993('0x31')];if(_0x19728c['query'][_0xa993('0x3f')]){_0x1bcfc6[_0xa993('0x40')]=[{'all':!![]}];}_0x1bcfc6=_[_0xa993('0x3d')]({},_0x1bcfc6,_0x19728c[_0xa993('0x3e')]);return db[_0xa993('0x46')][_0xa993('0x47')](_0x1bcfc6)[_0xa993('0x26')](handleEntityNotFound(_0x1c2d6c,null))['then'](respondWithResult(_0x1c2d6c,null))[_0xa993('0x43')](handleError(_0x1c2d6c,null));};exports[_0xa993('0x48')]=function(_0x21e3d0,_0x44cb0e){return db[_0xa993('0x46')][_0xa993('0x48')](_0x21e3d0[_0xa993('0x49')],{})['then'](function(_0x287ff2){var _0x20a92=_0x21e3d0[_0xa993('0x4a')][_0xa993('0x4b')]({'plain':!![]});if(!_0x20a92)throw new Error(_0xa993('0x4c'));if(_0x20a92['role']==='user'){var _0x4843bc=_0x287ff2['get']({'plain':!![]});var _0x31cd47=_0xa993('0x4d');return db['UserProfileSection'][_0xa993('0x47')]({'where':{'name':_0x31cd47,'userProfileId':_0x20a92[_0xa993('0x4e')]},'raw':!![]})[_0xa993('0x26')](function(_0x3d9e39){if(_0x3d9e39&&_0x3d9e39['autoAssociation']===0x0){return db[_0xa993('0x4f')][_0xa993('0x48')]({'name':_0x4843bc[_0xa993('0x2f')],'resourceId':_0x4843bc['id'],'type':_0x3d9e39[_0xa993('0x2f')],'sectionId':_0x3d9e39['id']},{})[_0xa993('0x26')](function(){return _0x287ff2;});}else{return _0x287ff2;}})[_0xa993('0x43')](function(_0x1ce741){logger[_0xa993('0x28')](_0xa993('0x50'),_0x1ce741);throw _0x1ce741;});}return _0x287ff2;})['then'](respondWithResult(_0x44cb0e,0xc9))[_0xa993('0x43')](handleError(_0x44cb0e,null));};exports[_0xa993('0x25')]=function(_0x392409,_0x1fe25d){if(_0x392409[_0xa993('0x49')]['id']){delete _0x392409[_0xa993('0x49')]['id'];}return db[_0xa993('0x46')][_0xa993('0x47')]({'where':{'id':_0x392409['params']['id']}})[_0xa993('0x26')](handleEntityNotFound(_0x1fe25d,null))[_0xa993('0x26')](saveUpdates(_0x392409[_0xa993('0x49')],null))['then'](respondWithResult(_0x1fe25d,null))[_0xa993('0x43')](handleError(_0x1fe25d,null));};exports[_0xa993('0x51')]=function(_0x2b5869,_0x2353f7){var _0x4ebb22=_0x2b5869[_0xa993('0x45')]['id'];var _0x340b69=[];return db[_0xa993('0x52')][_0xa993('0x53')](function(_0xef602a){var _0x1c5723=_0xa993('0x54')+_0x4ebb22;return db[_0xa993('0x52')]['query'](_0x1c5723,{'type':db[_0xa993('0x55')][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a})[_0xa993('0x26')](function(_0x775137){_0x340b69=_[_0xa993('0x2b')](_0x775137,function(_0x2de7e2){return Number(_0x2de7e2['UserId']);});})[_0xa993('0x26')](function(){var _0x1b3816=_0xa993('0x58')+_0x4ebb22;return db['sequelize']['query'](_0x1b3816,{'type':db[_0xa993('0x55')][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x16a0cd){var _0x166837=_[_0xa993('0x2b')](_0x16a0cd,function(_0x296d4b){return Number(_0x296d4b[_0xa993('0x59')]);});return db[_0xa993('0x5a')][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'VoiceQueueId':{'$in':_0x166837}},'transaction':_0xef602a});})['then'](function(){var _0x5ce6a8=_0xa993('0x5b')+_0x4ebb22;return db[_0xa993('0x52')]['query'](_0x5ce6a8,{'type':db['Sequelize'][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x49d3b5){var _0x165da9=_['map'](_0x49d3b5,function(_0x572fb8){return Number(_0x572fb8['MailQueueId']);});return db[_0xa993('0x5c')][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'MailQueueId':{'$in':_0x165da9}},'transaction':_0xef602a});})[_0xa993('0x26')](function(){var _0x3abbb5=_0xa993('0x5d')+_0x4ebb22;return db[_0xa993('0x52')]['query'](_0x3abbb5,{'type':db['Sequelize'][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x728ce9){var _0x2b70b1=_['map'](_0x728ce9,function(_0x3a9780){return Number(_0x3a9780[_0xa993('0x5e')]);});return db['UserSmsQueue'][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'SmsQueueId':{'$in':_0x2b70b1}},'transaction':_0xef602a});})[_0xa993('0x26')](function(){var _0x32e8bb=_0xa993('0x5f')+_0x4ebb22;return db['sequelize'][_0xa993('0x30')](_0x32e8bb,{'type':db[_0xa993('0x55')][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x57f468){var _0x2c24e2=_[_0xa993('0x2b')](_0x57f468,function(_0x54090e){return Number(_0x54090e[_0xa993('0x60')]);});return db['UserChatQueue'][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'ChatQueueId':{'$in':_0x2c24e2}},'transaction':_0xef602a});})[_0xa993('0x26')](function(){var _0xe2462e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4ebb22;return db['sequelize'][_0xa993('0x30')](_0xe2462e,{'type':db['Sequelize'][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x337fc6){var _0x44e166=_['map'](_0x337fc6,function(_0x20881e){return Number(_0x20881e['FaxQueueId']);});return db[_0xa993('0x61')]['destroy']({'where':{'UserId':{'$in':_0x340b69},'FaxQueueId':{'$in':_0x44e166}},'transaction':_0xef602a});})[_0xa993('0x26')](function(){var _0x4d419b=_0xa993('0x62')+_0x4ebb22;return db[_0xa993('0x52')]['query'](_0x4d419b,{'type':db[_0xa993('0x55')]['QueryTypes'][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x1f6b63){var _0x580eff=_['map'](_0x1f6b63,function(_0x10e4ed){return Number(_0x10e4ed[_0xa993('0x63')]);});return db['UserOpenchannelQueue'][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'OpenchannelQueueId':{'$in':_0x580eff}},'transaction':_0xef602a});})['then'](function(){var _0x257a7b=_0xa993('0x64')+_0x4ebb22;return db[_0xa993('0x52')][_0xa993('0x30')](_0x257a7b,{'type':db['Sequelize'][_0xa993('0x56')][_0xa993('0x57')],'raw':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x48d682){var _0x5846b1=_['map'](_0x48d682,function(_0x30c39b){return Number(_0x30c39b[_0xa993('0x65')]);});return db[_0xa993('0x66')][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'WhatsappQueueId':{'$in':_0x5846b1}},'transaction':_0xef602a});})[_0xa993('0x26')](function(){return db[_0xa993('0x67')][_0xa993('0x47')]({'where':{'TeamId':_0x4ebb22}});})['then'](function(_0x18ea6a){if(_0x18ea6a===null){return;}return db[_0xa993('0x68')][_0xa993('0x51')]({'where':{'UserId':{'$in':_0x340b69},'VoicePrefixId':_0x18ea6a['VoicePrefixId']},'transaction':_0xef602a});})[_0xa993('0x26')](function(){return db[_0xa993('0x46')][_0xa993('0x51')]({'where':{'id':_0x4ebb22},'cascade':!![],'transaction':_0xef602a});})[_0xa993('0x26')](function(_0x4cf3ea){if(_0x4cf3ea===0x0){_0x2353f7[_0xa993('0x27')](0x194);}else{return db[_0xa993('0x4f')][_0xa993('0x51')]({'where':{'type':_0xa993('0x4d'),'resourceId':_0x4ebb22},'cascade':!![],'transaction':_0xef602a})[_0xa993('0x26')](function(){_0x2353f7[_0xa993('0x19')](0xcc)[_0xa993('0x1a')]();});}})[_0xa993('0x43')](function(_0x399a5e){_0x2353f7[_0xa993('0x19')](0x1f4)[_0xa993('0x69')](_0x399a5e);});});};exports['getQueues']=function(_0x425447,_0x5892eb,_0x1dd969){return db[_0xa993('0x46')][_0xa993('0x6a')]({'where':{'id':_0x425447[_0xa993('0x45')]['id']}})[_0xa993('0x26')](handleEntityNotFound(_0x5892eb,null))['then'](function(_0x393caa){if(!_0x425447['query']['channel']||!utils['isValidChannel'](_0x425447[_0xa993('0x30')][_0xa993('0x6b')])){throw new db[(_0xa993('0x55'))][(_0xa993('0x6c'))](_0xa993('0x6d'));}var _0x3af97a={};var _0x46d676={};_0x46d676['model']=_[_0xa993('0x6e')](db[_[_0xa993('0x6f')](_0x425447['query'][_0xa993('0x6b')][_0xa993('0x70')]())+_0xa993('0x71')]['rawAttributes']);_0x46d676[_0xa993('0x30')]=_[_0xa993('0x6e')](_0x425447[_0xa993('0x30')]);_0x46d676[_0xa993('0x72')]=_[_0xa993('0x33')](_0x46d676[_0xa993('0x31')],_0x46d676[_0xa993('0x30')]);_0x3af97a[_0xa993('0x32')]=_[_0xa993('0x33')](_0x46d676['model'],qs['fields'](_0x425447['query'][_0xa993('0x34')]));_0x3af97a[_0xa993('0x32')]=_0x3af97a[_0xa993('0x32')][_0xa993('0x35')]?_0x3af97a['attributes']:_0x46d676[_0xa993('0x31')];_0x3af97a[_0xa993('0x1e')]=qs[_0xa993('0x1e')](_0x425447[_0xa993('0x30')][_0xa993('0x1e')]);_0x3af97a[_0xa993('0x1c')]=qs['offset'](_0x425447[_0xa993('0x30')][_0xa993('0x1c')]);_0x3af97a[_0xa993('0x36')]=qs['sort'](_0x425447[_0xa993('0x30')][_0xa993('0x37')]);_0x3af97a[_0xa993('0x38')]=qs[_0xa993('0x72')](_[_0xa993('0x39')](_0x425447[_0xa993('0x30')],_0x46d676['filters']));_0x3af97a=_[_0xa993('0x3d')]({},_0x3af97a,_0x425447[_0xa993('0x3e')]);return _0x393caa[_0xa993('0x4b')+_[_0xa993('0x6f')](_0x425447[_0xa993('0x30')][_0xa993('0x6b')][_0xa993('0x70')]())+_0xa993('0x73')](_0x3af97a);})[_0xa993('0x26')](respondWithResult(_0x5892eb,null))[_0xa993('0x43')](handleError(_0x5892eb,null));};exports[_0xa993('0x74')]=function(_0x18caac,_0x48da8a,_0x8ba60b){return db[_0xa993('0x46')][_0xa993('0x6a')]({'where':{'id':_0x18caac[_0xa993('0x45')]['id']}})[_0xa993('0x26')](function(_0xef306){if(_0xef306){if(!_0x18caac[_0xa993('0x49')]['channel']||!utils[_0xa993('0x75')](_0x18caac['body'][_0xa993('0x6b')])){throw new db['Sequelize'][(_0xa993('0x6c'))](_0xa993('0x6d'));}return _0xef306[_0xa993('0x76')+_[_0xa993('0x6f')](_0x18caac['body']['channel'][_0xa993('0x70')]())+_0xa993('0x73')](_0x18caac['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x48da8a,null))[_0xa993('0x26')](respondWithStatusCode(_0x48da8a,null))['catch'](handleError(_0x48da8a,null));};exports[_0xa993('0x77')]=function(_0x5433b8,_0x522a97,_0x3a1d0e){return db[_0xa993('0x46')]['findOne']({'where':{'id':_0x5433b8[_0xa993('0x45')]['id']}})['then'](function(_0x1d522f){if(_0x1d522f){if(!_0x5433b8['query']['channel']||!utils[_0xa993('0x75')](_0x5433b8['query']['channel'])){throw new db[(_0xa993('0x55'))][(_0xa993('0x6c'))](_0xa993('0x6d'));}return _0x1d522f[_0xa993('0x78')+_[_0xa993('0x6f')](_0x5433b8['query'][_0xa993('0x6b')][_0xa993('0x70')]())+'Queues'](_0x5433b8[_0xa993('0x30')]['ids']);}return null;})[_0xa993('0x26')](handleEntityNotFound(_0x522a97,null))['then'](respondWithStatusCode(_0x522a97,null))['catch'](handleError(_0x522a97,null));};exports[_0xa993('0x79')]=function(_0x4376e1,_0x180239){var _0xa552ca=_[_0xa993('0x7a')](_0x4376e1['body'][_0xa993('0x7b')])?_0x4376e1[_0xa993('0x49')]['ids']:[_0x4376e1['body'][_0xa993('0x7b')]];var _0x330535=_0x4376e1[_0xa993('0x45')]['id'];return db[_0xa993('0x46')][_0xa993('0x47')]({'where':{'id':_0x330535}})[_0xa993('0x26')](handleEntityNotFound(_0x180239,null))[_0xa993('0x26')](function(_0x343e1e){if(_0x343e1e){var _0x5e18d2=[_0xa993('0x7c'),'Chat',_0xa993('0x7d'),_0xa993('0x7e'),_0xa993('0x7f'),_0xa993('0x80'),_0xa993('0x81')];return db['sequelize'][_0xa993('0x53')](function(_0x3ca865){var _0x24c6db=_['map'](_0x5e18d2,function(_0x485b18){var _0x4aee5b={'attributes':['id','name']};if(_0x485b18===_0xa993('0x7c')){_0x4aee5b['through']={'attributes':['penalty']};}return _0x343e1e[_0xa993('0x4b')+_0x485b18+'Queues'](_0x4aee5b)[_0xa993('0x26')](function(_0x14fbec){var _0x573ac7=_[_0xa993('0x2b')](_0x14fbec,function(_0x5e2452){var _0x11d080=_[_0xa993('0x2b')](_0xa552ca,function(_0x2b4eeb){var _0x16a95e={'where':{'UserId':_0x2b4eeb,[_0x485b18+_0xa993('0x82')]:_0x5e2452['id']},'transaction':_0x3ca865};if(_0x485b18===_0xa993('0x7c')){_0x16a95e['defaults']={'penalty':_0x5e2452['TeamVoiceQueue'][_0xa993('0x83')]};}return db[_0xa993('0x84')+_0x485b18+_0xa993('0x71')][_0xa993('0x85')](_0x16a95e)['then'](function(){socket[_0xa993('0x86')]('user'+_0x485b18+_0xa993('0x87'),{'UserId':_0x2b4eeb,[_0x485b18+_0xa993('0x82')]:_0x5e2452['id']});if(_0x485b18!==_0xa993('0x7c')){return;}return db[_0xa993('0x84')][_0xa993('0x41')]({'where':{'id':_0xa552ca,'online':0x1},'attributes':['id','name',_0xa993('0x88'),_0xa993('0x89'),_0xa993('0x8a')],'raw':!![]})[_0xa993('0x26')](function(_0x202566){var _0x244279=_[_0xa993('0x2b')](_0x202566,function(_0x31c01c){return db[_0xa993('0x8b')][_0xa993('0x8c')]({'membername':_0x31c01c['name'],'UserId':_0x31c01c['id'],'queue_name':_0x5e2452['name'],'VoiceQueueId':_0x5e2452['id'],'interface':_[_0xa993('0x8d')](_0x31c01c['interface'])?util['format'](_0xa993('0x8e'),_0x31c01c[_0xa993('0x2f')]):_0x31c01c[_0xa993('0x8a')],'paused':_0x31c01c[_0xa993('0x89')]||![],'penalty':_0x5e2452[_0xa993('0x8f')]['penalty']},{'transaction':_0x3ca865});});return Promise['all'](_0x244279);});});});return Promise[_0xa993('0x90')](_0x11d080);});return Promise[_0xa993('0x90')](_0x573ac7);})[_0xa993('0x26')](function(){return db['TeamVoicePrefix'][_0xa993('0x6a')]({'where':{'teamId':_0x330535}})[_0xa993('0x26')](function(_0x4e736a){if(_0x4e736a){var _0x496580=_[_0xa993('0x2b')](_0xa552ca,function(_0xc684ee){db[_0xa993('0x68')]['upsert']({'UserId':_0xc684ee,'VoicePrefixId':_0x4e736a[_0xa993('0x91')]});});return Promise['all'](_0x496580);}});});});return Promise['all'](_0x24c6db)[_0xa993('0x26')](function(){return _0x343e1e[_0xa993('0x79')](_0xa552ca,{'transaction':_0x3ca865})[_0xa993('0x92')](function(_0x218477){return _0x218477;});});});}})['then'](respondWithResult(_0x180239,null))['catch'](handleError(_0x180239,null));};exports['removeAgents']=function(_0x3b05d9,_0x1fd079){var _0x499a29=_[_0xa993('0x7a')](_0x3b05d9[_0xa993('0x30')][_0xa993('0x7b')])?_0x3b05d9[_0xa993('0x30')]['ids']:[_0x3b05d9[_0xa993('0x30')]['ids']];var _0x5917fa=_0x3b05d9[_0xa993('0x45')]['id'];return db['Team'][_0xa993('0x47')]({'where':{'id':_0x5917fa}})[_0xa993('0x26')](handleEntityNotFound(_0x1fd079,null))[_0xa993('0x26')](function(_0x472c0f){if(_0x472c0f){var _0x5ffaaf=['Voice',_0xa993('0x93'),_0xa993('0x7d'),_0xa993('0x7e'),_0xa993('0x7f'),'Openchannel',_0xa993('0x81')];return db[_0xa993('0x52')][_0xa993('0x53')](function(_0x5274a6){var _0x39ef30=_[_0xa993('0x2b')](_0x5ffaaf,function(_0x56a3e5){var _0x4a9f0c={'attributes':['id',_0xa993('0x2f')]};return _0x472c0f[_0xa993('0x4b')+_0x56a3e5+_0xa993('0x73')](_0x4a9f0c)['then'](function(_0x24f540){var _0x5b0936=_[_0xa993('0x2b')](_0x24f540,function(_0x1d736b){return _0x1d736b['removeAgents'](_0x499a29,{'transaction':_0x5274a6})[_0xa993('0x26')](function(){var _0x4aa3a5=_[_0xa993('0x2b')](_0x499a29,function(_0x584e9a){socket[_0xa993('0x86')](_0xa993('0x4a')+_0x56a3e5+_0xa993('0x94'),{'UserId':Number(_0x584e9a),[_0x56a3e5+'QueueId']:_0x1d736b['id']});if(_0x56a3e5!==_0xa993('0x7c')){return;}return db[_0xa993('0x8b')][_0xa993('0x51')]({'where':{'VoiceQueueId':_0x1d736b['id'],'UserId':_0x584e9a},'transaction':_0x5274a6});});return Promise[_0xa993('0x90')](_0x4aa3a5);});});return Promise['all'](_0x5b0936);});});return Promise[_0xa993('0x90')](_0x39ef30)[_0xa993('0x26')](function(){return _0x472c0f[_0xa993('0x95')](_0x499a29,{'transaction':_0x5274a6});})[_0xa993('0x26')](function(){return db[_0xa993('0x67')][_0xa993('0x6a')]({'where':{'teamId':_0x5917fa}})['then'](function(_0x8e8975){if(_0x8e8975){var _0x13a8de=_[_0xa993('0x2b')](_0x499a29,function(_0x5761ac){db[_0xa993('0x68')][_0xa993('0x51')]({'where':{'UserId':_0x5761ac,'VoicePrefixId':_0x8e8975['VoicePrefixId']}});});return Promise['all'](_0x13a8de);}});});});}})[_0xa993('0x26')](respondWithStatusCode(_0x1fd079,null))[_0xa993('0x43')](handleError(_0x1fd079,null));};exports['getAgents']=function(_0x28adb9,_0x5dccf9,_0x228340){var _0x3a6d87={};var _0x59ca92={};var _0x3bf658;var _0x4945a8;return db['Team'][_0xa993('0x6a')]({'where':{'id':_0x28adb9[_0xa993('0x45')]['id']}})[_0xa993('0x26')](handleEntityNotFound(_0x5dccf9,null))[_0xa993('0x26')](function(_0x168234){if(_0x168234){_0x3bf658=_0x168234;_0x59ca92[_0xa993('0x31')]=_[_0xa993('0x6e')](db['User'][_0xa993('0x2c')]);_0x59ca92[_0xa993('0x30')]=_[_0xa993('0x6e')](_0x28adb9['query']);_0x59ca92[_0xa993('0x72')]=_[_0xa993('0x33')](_0x59ca92['model'],_0x59ca92['query']);_0x3a6d87[_0xa993('0x32')]=_[_0xa993('0x33')](_0x59ca92[_0xa993('0x31')],qs[_0xa993('0x34')](_0x28adb9['query'][_0xa993('0x34')]));_0x3a6d87[_0xa993('0x32')]=_0x3a6d87['attributes'][_0xa993('0x35')]?_0x3a6d87[_0xa993('0x32')]:_0x59ca92['model'];_0x3a6d87[_0xa993('0x36')]=qs[_0xa993('0x37')](_0x28adb9[_0xa993('0x30')]['sort']);_0x3a6d87['where']=qs[_0xa993('0x72')](_[_0xa993('0x39')](_0x28adb9[_0xa993('0x30')],_0x59ca92[_0xa993('0x72')]));if(_0x28adb9[_0xa993('0x30')][_0xa993('0x3a')]){_0x3a6d87[_0xa993('0x38')]=_[_0xa993('0x3d')](_0x3a6d87[_0xa993('0x38')],{'$or':_[_0xa993('0x2b')](_0x3a6d87[_0xa993('0x32')],function(_0x2985f2){var _0x2a575f={};_0x2a575f[_0x2985f2]={'$like':'%'+_0x28adb9[_0xa993('0x30')][_0xa993('0x3a')]+'%'};return _0x2a575f;})});}_0x3a6d87=_[_0xa993('0x3d')]({},_0x3a6d87,_0x28adb9['options']);return _0x3bf658['getAgents'](_0x3a6d87);}})[_0xa993('0x26')](function(_0x2b8a01){if(_0x2b8a01){_0x4945a8=_0x2b8a01[_0xa993('0x35')];if(!_0x28adb9['query'][_0xa993('0x96')](_0xa993('0x97'))){_0x3a6d87[_0xa993('0x1e')]=qs[_0xa993('0x1e')](_0x28adb9[_0xa993('0x30')][_0xa993('0x1e')]);_0x3a6d87[_0xa993('0x1c')]=qs['offset'](_0x28adb9[_0xa993('0x30')][_0xa993('0x1c')]);}return _0x3bf658[_0xa993('0x98')](_0x3a6d87);}})['then'](function(_0x4859f1){if(_0x4859f1){return _0x4859f1?{'count':_0x4945a8,'rows':_0x4859f1}:null;}})[_0xa993('0x26')](respondWithResult(_0x5dccf9,null))[_0xa993('0x43')](handleError(_0x5dccf9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index af8fb36..ae2d63b 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 _0x71f9=['update','remove','emit','hook','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x1787a5,_0x30149b){var _0x3c6ba9=function(_0x3a65ac){while(--_0x3a65ac){_0x1787a5['push'](_0x1787a5['shift']());}};_0x3c6ba9(++_0x30149b);}(_0x71f9,0x145));var _0x971f=function(_0x299fa6,_0x341e97){_0x299fa6=_0x299fa6-0x0;var _0x5d8fdf=_0x71f9[_0x299fa6];return _0x5d8fdf;};'use strict';var EventEmitter=require(_0x971f('0x0'));var Team=require(_0x971f('0x1'))['db'][_0x971f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x971f('0x3')](0x0);var events={'afterCreate':_0x971f('0x4'),'afterUpdate':_0x971f('0x5'),'afterDestroy':_0x971f('0x6')};function emitEvent(_0x13fc9a){return function(_0x5ed541,_0x209629,_0x54e0cf){TeamEvents['emit'](_0x13fc9a+':'+_0x5ed541['id'],_0x5ed541);TeamEvents[_0x971f('0x7')](_0x13fc9a,_0x5ed541);_0x54e0cf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x971f('0x8')](e,emitEvent(event));}}module[_0x971f('0x9')]=TeamEvents; \ No newline at end of file +var _0xd926=['update','emit','hook','exports','../../mysqldb','Team','setMaxListeners'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0xd926,0xe4));var _0x6d92=function(_0x44cc11,_0x255e4c){_0x44cc11=_0x44cc11-0x0;var _0x37b592=_0xd926[_0x44cc11];return _0x37b592;};'use strict';var EventEmitter=require('events');var Team=require(_0x6d92('0x0'))['db'][_0x6d92('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x6d92('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d92('0x3'),'afterDestroy':'remove'};function emitEvent(_0x23fdef){return function(_0x42691e,_0x834e5e,_0x4527a8){TeamEvents[_0x6d92('0x4')](_0x23fdef+':'+_0x42691e['id'],_0x42691e);TeamEvents['emit'](_0x23fdef,_0x42691e);_0x4527a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x6d92('0x5')](e,emitEvent(event));}}module[_0x6d92('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1f47109..ded332e 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 _0xaca4=['Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','get','Queues','then','channel','exports','define','Chat'];(function(_0x1213ff,_0x1e60fa){var _0x5b1850=function(_0x512509){while(--_0x512509){_0x1213ff['push'](_0x1213ff['shift']());}};_0x5b1850(++_0x1e60fa);}(_0xaca4,0xcf));var _0x4aca=function(_0xf6ac4d,_0x18979a){_0xf6ac4d=_0xf6ac4d-0x0;var _0x3cfeb3=_0xaca4[_0xf6ac4d];return _0x3cfeb3;};'use strict';var _=require(_0x4aca('0x0'));var attributes=require(_0x4aca('0x1'));function getQueuesByChannel(_0x45a7da,_0x1fcee5){var _0xf8ebcd=_0x4aca('0x2')+_0x1fcee5+_0x4aca('0x3');return _0x45a7da[_0xf8ebcd]()[_0x4aca('0x4')](function(_0x460958){return _['map'](_0x460958,function(_0x6addda){_0x6addda['setDataValue'](_0x4aca('0x5'),_0x1fcee5);return _0x6addda;});})['catch'](function(_0x1a49d6){throw _0x1a49d6;});}module[_0x4aca('0x6')]=function(_0xdba9a4){return _0xdba9a4[_0x4aca('0x7')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x7a00bc=this;var _0x154e3f=[_0x4aca('0x8'),_0x4aca('0x9'),_0x4aca('0xa'),_0x4aca('0xb'),_0x4aca('0xc'),_0x4aca('0xd'),_0x4aca('0xe')];return Promise[_0x4aca('0xf')]()[_0x4aca('0x4')](function(){var _0xe088c4=_['map'](_0x154e3f,function(_0x535218){return getQueuesByChannel(_0x7a00bc,_0x535218);});return Promise[_0x4aca('0x10')](_0xe088c4);})[_0x4aca('0x11')](function(_0x1c9e8e){throw _0x1c9e8e;});}}});}; \ No newline at end of file +var _0x6a41=['Team','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define'];(function(_0x431f4d,_0x2abbf4){var _0x237c46=function(_0x38f57c){while(--_0x38f57c){_0x431f4d['push'](_0x431f4d['shift']());}};_0x237c46(++_0x2abbf4);}(_0x6a41,0xc7));var _0x16a4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6a41[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x16a4('0x0'));var attributes=require(_0x16a4('0x1'));function getQueuesByChannel(_0x68affa,_0x4a0d82){var _0x1b0ab9=_0x16a4('0x2')+_0x4a0d82+_0x16a4('0x3');return _0x68affa[_0x1b0ab9]()[_0x16a4('0x4')](function(_0x576e89){return _[_0x16a4('0x5')](_0x576e89,function(_0x2e7d8d){_0x2e7d8d[_0x16a4('0x6')](_0x16a4('0x7'),_0x4a0d82);return _0x2e7d8d;});})[_0x16a4('0x8')](function(_0x2ccce3){throw _0x2ccce3;});}module[_0x16a4('0x9')]=function(_0x52966f){return _0x52966f[_0x16a4('0xa')](_0x16a4('0xb'),attributes,{'tableName':_0x16a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1b6900=this;var _0x3da615=[_0x16a4('0xd'),_0x16a4('0xe'),_0x16a4('0xf'),_0x16a4('0x10'),'Sms',_0x16a4('0x11'),_0x16a4('0x12')];return Promise[_0x16a4('0x13')]()[_0x16a4('0x4')](function(){var _0x545aab=_[_0x16a4('0x5')](_0x3da615,function(_0x19d0f4){return getQueuesByChannel(_0x1b6900,_0x19d0f4);});return Promise[_0x16a4('0x14')](_0x545aab);})[_0x16a4('0x8')](function(_0x561616){throw _0x561616;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 81a6f24..cb381ef 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 _0xec60=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','info','result','catch','moment','ioredis'];(function(_0x500c0d,_0x22a500){var _0x38a9b8=function(_0x114e28){while(--_0x114e28){_0x500c0d['push'](_0x500c0d['shift']());}};_0x38a9b8(++_0x22a500);}(_0xec60,0x8e));var _0x0ec6=function(_0x44f076,_0x354ff5){_0x44f076=_0x44f076-0x0;var _0x5d01d7=_0xec60[_0x44f076];return _0x5d01d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ec6('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ec6('0x1'));var db=require(_0x0ec6('0x2'))['db'];var utils=require(_0x0ec6('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ec6('0x4'));var jayson=require(_0x0ec6('0x5'));var client=jayson[_0x0ec6('0x6')][_0x0ec6('0x7')]({'port':0x232a});config[_0x0ec6('0x8')]=_[_0x0ec6('0x9')](config[_0x0ec6('0x8')],{'host':_0x0ec6('0xa'),'port':0x18eb});var socket=require(_0x0ec6('0xb'))(new Redis(config[_0x0ec6('0x8')]));require(_0x0ec6('0xc'))[_0x0ec6('0xd')](socket);function respondWithRpcPromise(_0x24d8bd,_0x453618,_0x1f604c){return new BPromise(function(_0x3ef7e3,_0x14f951){return client['request'](_0x24d8bd,_0x1f604c)[_0x0ec6('0xe')](function(_0x389b12){logger['info']('Team,\x20%s,\x20%s',_0x453618,_0x0ec6('0xf'));logger[_0x0ec6('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x453618,_0x0ec6('0xf'),JSON[_0x0ec6('0x11')](_0x389b12));if(_0x389b12[_0x0ec6('0x12')]){if(_0x389b12[_0x0ec6('0x12')]['code']===0x1f4){logger[_0x0ec6('0x12')](_0x0ec6('0x13'),_0x453618,_0x389b12[_0x0ec6('0x12')][_0x0ec6('0x14')]);return _0x14f951(_0x389b12[_0x0ec6('0x12')][_0x0ec6('0x14')]);}logger[_0x0ec6('0x12')](_0x0ec6('0x13'),_0x453618,_0x389b12[_0x0ec6('0x12')][_0x0ec6('0x14')]);return _0x3ef7e3(_0x389b12[_0x0ec6('0x12')][_0x0ec6('0x14')]);}else{logger[_0x0ec6('0x15')]('Team,\x20%s,\x20%s',_0x453618,_0x0ec6('0xf'));_0x3ef7e3(_0x389b12[_0x0ec6('0x16')][_0x0ec6('0x14')]);}})[_0x0ec6('0x17')](function(_0x55f47b){logger[_0x0ec6('0x12')](_0x0ec6('0x13'),_0x453618,_0x55f47b);_0x14f951(_0x55f47b);});});} \ No newline at end of file +var _0x02d1=['rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53ef61,_0x44cda6){var _0x4e4207=function(_0x50af1b){while(--_0x50af1b){_0x53ef61['push'](_0x53ef61['shift']());}};_0x4e4207(++_0x44cda6);}(_0x02d1,0xa8));var _0x102d=function(_0x42c01d,_0x17e327){_0x42c01d=_0x42c01d-0x0;var _0x2d8cef=_0x02d1[_0x42c01d];return _0x2d8cef;};'use strict';var _=require(_0x102d('0x0'));var util=require('util');var moment=require(_0x102d('0x1'));var BPromise=require(_0x102d('0x2'));var rs=require(_0x102d('0x3'));var fs=require('fs');var Redis=require(_0x102d('0x4'));var db=require(_0x102d('0x5'))['db'];var utils=require(_0x102d('0x6'));var logger=require('../../config/logger')(_0x102d('0x7'));var config=require(_0x102d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x102d('0x9')]({'port':0x232a});config[_0x102d('0xa')]=_[_0x102d('0xb')](config[_0x102d('0xa')],{'host':_0x102d('0xc'),'port':0x18eb});var socket=require(_0x102d('0xd'))(new Redis(config['redis']));require('./team.socket')[_0x102d('0xe')](socket);function respondWithRpcPromise(_0x46cdff,_0x3c8257,_0x27fd1d){return new BPromise(function(_0x6bb968,_0x53c15f){return client['request'](_0x46cdff,_0x27fd1d)[_0x102d('0xf')](function(_0x189894){logger[_0x102d('0x10')](_0x102d('0x11'),_0x3c8257,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x3c8257,_0x102d('0x12'),JSON[_0x102d('0x13')](_0x189894));if(_0x189894[_0x102d('0x14')]){if(_0x189894[_0x102d('0x14')][_0x102d('0x15')]===0x1f4){logger[_0x102d('0x14')](_0x102d('0x11'),_0x3c8257,_0x189894[_0x102d('0x14')][_0x102d('0x16')]);return _0x53c15f(_0x189894[_0x102d('0x14')][_0x102d('0x16')]);}logger[_0x102d('0x14')]('Team,\x20%s,\x20%s',_0x3c8257,_0x189894['error'][_0x102d('0x16')]);return _0x6bb968(_0x189894[_0x102d('0x14')][_0x102d('0x16')]);}else{logger[_0x102d('0x10')](_0x102d('0x11'),_0x3c8257,_0x102d('0x12'));_0x6bb968(_0x189894[_0x102d('0x17')]['message']);}})[_0x102d('0x18')](function(_0x1b1858){logger[_0x102d('0x14')](_0x102d('0x11'),_0x3c8257,_0x1b1858);_0x53c15f(_0x1b1858);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2ef1c4f..9c5240b 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 _0xe2c5=['team:','save','remove','emit','removeListener','register','length'];(function(_0x4212ec,_0x7a8b44){var _0x4a685b=function(_0x5f4693){while(--_0x5f4693){_0x4212ec['push'](_0x4212ec['shift']());}};_0x4a685b(++_0x7a8b44);}(_0xe2c5,0xd3));var _0x5e2c=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0xe2c5[_0x566168];return _0x4e1f7a;};'use strict';var TeamEvents=require('./team.events');var events=[_0x5e2c('0x0'),_0x5e2c('0x1'),'update'];function createListener(_0x4aeaa8,_0x5c26df){return function(_0x195c92){_0x5c26df[_0x5e2c('0x2')](_0x4aeaa8,_0x195c92);};}function removeListener(_0x68b424,_0xb1958e){return function(){TeamEvents[_0x5e2c('0x3')](_0x68b424,_0xb1958e);};}exports[_0x5e2c('0x4')]=function(_0x36eb1f){for(var _0x2ab378=0x0,_0xa49ccf=events[_0x5e2c('0x5')];_0x2ab378<_0xa49ccf;_0x2ab378++){var _0x35386e=events[_0x2ab378];var _0x55f66d=createListener(_0x5e2c('0x6')+_0x35386e,_0x36eb1f);TeamEvents['on'](_0x35386e,_0x55f66d);}}; \ No newline at end of file +var _0x4178=['removeListener','length','team:','update'];(function(_0x586a2a,_0x3067a8){var _0x2d30f5=function(_0x4d93c7){while(--_0x4d93c7){_0x586a2a['push'](_0x586a2a['shift']());}};_0x2d30f5(++_0x3067a8);}(_0x4178,0x1df));var _0x8417=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4178[_0x160c73];return _0xd9302;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove',_0x8417('0x0')];function createListener(_0x51f614,_0xe9453f){return function(_0x1c4f62){_0xe9453f['emit'](_0x51f614,_0x1c4f62);};}function removeListener(_0x2c8b83,_0x352a69){return function(){TeamEvents[_0x8417('0x1')](_0x2c8b83,_0x352a69);};}exports['register']=function(_0x1700b3){for(var _0x32d707=0x0,_0x440552=events[_0x8417('0x2')];_0x32d707<_0x440552;_0x32d707++){var _0x373b35=events[_0x32d707];var _0x5ace9c=createListener(_0x8417('0x3')+_0x373b35,_0x1700b3);TeamEvents['on'](_0x373b35,_0x5ace9c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 83b6a0e..bb13551 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 _0xf972=['INTEGER','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf972,0x171));var _0x2f97=function(_0x4b8709,_0x9648bc){_0x4b8709=_0x4b8709-0x0;var _0x16a67d=_0xf972[_0x4b8709];return _0x16a67d;};'use strict';var Sequelize=require(_0x2f97('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x2f97('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x2f97('0x1')]}}; \ No newline at end of file +var _0x9efb=['INTEGER','exports'];(function(_0x5bf2c8,_0x2b5120){var _0x279d74=function(_0x39a44f){while(--_0x39a44f){_0x5bf2c8['push'](_0x5bf2c8['shift']());}};_0x279d74(++_0x2b5120);}(_0x9efb,0x143));var _0xb9ef=function(_0x2725e7,_0x25b928){_0x2725e7=_0x2725e7-0x0;var _0x1214ee=_0x9efb[_0x2725e7];return _0x1214ee;};'use strict';var Sequelize=require('sequelize');module[_0xb9ef('0x0')]={'TeamId':{'type':Sequelize[_0xb9ef('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index de54c21..049eee7 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','../../config/logger','api'];(function(_0x170b82,_0x2fff28){var _0x40dbf7=function(_0x300fbe){while(--_0x300fbe){_0x170b82['push'](_0x170b82['shift']());}};_0x40dbf7(++_0x2fff28);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b17=['team_has_voice_prefixes','lodash','../../config/logger','moment','bluebird','path','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix'];(function(_0x5d90b8,_0x71f07d){var _0x14408f=function(_0x11f22f){while(--_0x11f22f){_0x5d90b8['push'](_0x5d90b8['shift']());}};_0x14408f(++_0x71f07d);}(_0x4b17,0x10f));var _0x74b1=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x4b17[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var logger=require(_0x74b1('0x1'))('api');var moment=require(_0x74b1('0x2'));var BPromise=require(_0x74b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b1('0x5'));module[_0x74b1('0x6')]=function(_0x379dcc,_0x3873a6){return _0x379dcc[_0x74b1('0x7')](_0x74b1('0x8'),attributes,{'tableName':_0x74b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 593a107..b3862ca 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(_0x5e761b,_0x355e38){var _0x98502c=function(_0x4e52d5){while(--_0x4e52d5){_0x5e761b['push'](_0x5e761b['shift']());}};_0x98502c(++_0x355e38);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x52bbdc,_0x191120){var _0x576eed=function(_0x3ad5c0){while(--_0x3ad5c0){_0x52bbdc['push'](_0x52bbdc['shift']());}};_0x576eed(++_0x191120);}(_0x70e0,0x17b));var _0x070e=function(_0x4290c3,_0x3579de){_0x4290c3=_0x4290c3-0x0;var _0x43eb2b=_0x70e0[_0x4290c3];return _0x43eb2b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index dbebaa1..d18d676 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 _0x07b5=['INTEGER','sequelize','exports'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x07b5,0x10f));var _0x507b=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x07b5[_0x528575];return _0x3063b7;};'use strict';var Sequelize=require(_0x507b('0x0'));module[_0x507b('0x1')]={'penalty':{'type':Sequelize[_0x507b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0849=['exports','INTEGER'];(function(_0x261de2,_0x68ba7f){var _0x10ac2f=function(_0xb2a468){while(--_0xb2a468){_0x261de2['push'](_0x261de2['shift']());}};_0x10ac2f(++_0x68ba7f);}(_0x0849,0x90));var _0x9084=function(_0x21605f,_0x22308a){_0x21605f=_0x21605f-0x0;var _0x466f25=_0x0849[_0x21605f];return _0x466f25;};'use strict';var Sequelize=require('sequelize');module[_0x9084('0x0')]={'penalty':{'type':Sequelize[_0x9084('0x1')],'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 0f86555..f6c3393 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 _0x89f7=['moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x25a6a7,_0x3337b9){var _0x4fff03=function(_0x35e13d){while(--_0x35e13d){_0x25a6a7['push'](_0x25a6a7['shift']());}};_0x4fff03(++_0x3337b9);}(_0x89f7,0x105));var _0x789f=function(_0x7e3bb8,_0x27c048){_0x7e3bb8=_0x7e3bb8-0x0;var _0x44c887=_0x89f7[_0x7e3bb8];return _0x44c887;};'use strict';var _=require(_0x789f('0x0'));var util=require(_0x789f('0x1'));var logger=require(_0x789f('0x2'))('api');var moment=require(_0x789f('0x3'));var BPromise=require('bluebird');var rp=require(_0x789f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x789f('0x5'));var config=require(_0x789f('0x6'));var attributes=require(_0x789f('0x7'));module[_0x789f('0x8')]=function(_0x5d7abe,_0x273a16){return _0x5d7abe[_0x789f('0x9')](_0x789f('0xa'),attributes,{'tableName':_0x789f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc770=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','moment','bluebird','request-promise'];(function(_0x5bdc31,_0x40dad6){var _0x570f7c=function(_0x2b4869){while(--_0x2b4869){_0x5bdc31['push'](_0x5bdc31['shift']());}};_0x570f7c(++_0x40dad6);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c77('0x2'));var BPromise=require(_0x0c77('0x3'));var rp=require(_0x0c77('0x4'));var fs=require('fs');var path=require(_0x0c77('0x5'));var rimraf=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var attributes=require(_0x0c77('0x8'));module[_0x0c77('0x9')]=function(_0x575bb3,_0x26a0ff){return _0x575bb3[_0x0c77('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x0c77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index ffed5ab..ea532b0 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 _0x6ec9=['http','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x38881b,_0x137d6c){var _0x31164e=function(_0x1c3fde){while(--_0x1c3fde){_0x38881b['push'](_0x38881b['shift']());}};_0x31164e(++_0x137d6c);}(_0x6ec9,0x174));var _0x96ec=function(_0x3cc519,_0x5d0427){_0x3cc519=_0x3cc519-0x0;var _0x5774f7=_0x6ec9[_0x3cc519];return _0x5774f7;};'use strict';var _=require(_0x96ec('0x0'));var util=require('util');var moment=require(_0x96ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x96ec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x96ec('0x4'))(_0x96ec('0x5'));var config=require('../../config/environment');var jayson=require(_0x96ec('0x6'));var client=jayson[_0x96ec('0x7')][_0x96ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bc079,_0x5870ab,_0x5ee7a3){return new BPromise(function(_0x8214b2,_0x195366){return client['request'](_0x5bc079,_0x5ee7a3)[_0x96ec('0x9')](function(_0x95ef8){logger[_0x96ec('0xa')](_0x96ec('0xb'),_0x5870ab,'request\x20sent');logger['debug'](_0x96ec('0xc'),_0x5870ab,_0x96ec('0xd'),JSON[_0x96ec('0xe')](_0x95ef8));if(_0x95ef8[_0x96ec('0xf')]){if(_0x95ef8[_0x96ec('0xf')][_0x96ec('0x10')]===0x1f4){logger[_0x96ec('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5870ab,_0x95ef8[_0x96ec('0xf')][_0x96ec('0x11')]);return _0x195366(_0x95ef8[_0x96ec('0xf')][_0x96ec('0x11')]);}logger[_0x96ec('0xf')](_0x96ec('0xb'),_0x5870ab,_0x95ef8[_0x96ec('0xf')][_0x96ec('0x11')]);return _0x8214b2(_0x95ef8['error']['message']);}else{logger[_0x96ec('0xa')](_0x96ec('0xb'),_0x5870ab,_0x96ec('0xd'));_0x8214b2(_0x95ef8[_0x96ec('0x12')][_0x96ec('0x11')]);}})[_0x96ec('0x13')](function(_0x5e9f05){logger[_0x96ec('0xf')](_0x96ec('0xb'),_0x5870ab,_0x5e9f05);_0x195366(_0x5e9f05);});});} \ No newline at end of file +var _0xa37e=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x15756e,_0x548eb6){var _0x4c37ed=function(_0x48aefa){while(--_0x48aefa){_0x15756e['push'](_0x15756e['shift']());}};_0x4c37ed(++_0x548eb6);}(_0xa37e,0x97));var _0xea37=function(_0x35d109,_0x39fbd3){_0x35d109=_0x35d109-0x0;var _0x4851b0=_0xa37e[_0x35d109];return _0x4851b0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea37('0x0'));var BPromise=require(_0xea37('0x1'));var rs=require(_0xea37('0x2'));var fs=require('fs');var Redis=require(_0xea37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea37('0x4'));var logger=require('../../config/logger')(_0xea37('0x5'));var config=require(_0xea37('0x6'));var jayson=require(_0xea37('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36c489,_0x4a9e08,_0x4ae081){return new BPromise(function(_0x2c2890,_0x1401e1){return client[_0xea37('0x8')](_0x36c489,_0x4ae081)[_0xea37('0x9')](function(_0x5e4ebe){logger[_0xea37('0xa')](_0xea37('0xb'),_0x4a9e08,_0xea37('0xc'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4a9e08,_0xea37('0xc'),JSON[_0xea37('0xd')](_0x5e4ebe));if(_0x5e4ebe[_0xea37('0xe')]){if(_0x5e4ebe['error'][_0xea37('0xf')]===0x1f4){logger[_0xea37('0xe')](_0xea37('0xb'),_0x4a9e08,_0x5e4ebe['error'][_0xea37('0x10')]);return _0x1401e1(_0x5e4ebe[_0xea37('0xe')]['message']);}logger[_0xea37('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a9e08,_0x5e4ebe[_0xea37('0xe')]['message']);return _0x2c2890(_0x5e4ebe[_0xea37('0xe')][_0xea37('0x10')]);}else{logger[_0xea37('0xa')](_0xea37('0xb'),_0x4a9e08,'request\x20sent');_0x2c2890(_0x5e4ebe[_0xea37('0x11')]['message']);}})['catch'](function(_0x3ae3cc){logger['error'](_0xea37('0xb'),_0x4a9e08,_0x3ae3cc);_0x1401e1(_0x3ae3cc);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 00806ac..22c6078 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 _0xdfdd=['show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0xa05271,_0x52e263){var _0x3f1a0c=function(_0x420cfc){while(--_0x420cfc){_0xa05271['push'](_0xa05271['shift']());}};_0x3f1a0c(++_0x52e263);}(_0xdfdd,0x104));var _0xddfd=function(_0x415e6b,_0x3868ce){_0x415e6b=_0x415e6b-0x0;var _0x44ba29=_0xdfdd[_0x415e6b];return _0x44ba29;};'use strict';var multer=require(_0xddfd('0x0'));var util=require(_0xddfd('0x1'));var path=require(_0xddfd('0x2'));var timeout=require(_0xddfd('0x3'));var express=require('express');var router=express[_0xddfd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddfd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddfd('0x6'));var controller=require(_0xddfd('0x7'));router[_0xddfd('0x8')]('/',auth[_0xddfd('0x9')](),controller['index']);router[_0xddfd('0x8')]('/:id',auth[_0xddfd('0x9')](),controller[_0xddfd('0xa')]);router[_0xddfd('0xb')]('/',auth[_0xddfd('0x9')](),controller[_0xddfd('0xc')]);router[_0xddfd('0xd')]('/:id',auth[_0xddfd('0x9')](),controller[_0xddfd('0xe')]);router['delete'](_0xddfd('0xf'),auth[_0xddfd('0x9')](),controller[_0xddfd('0x10')]);module[_0xddfd('0x11')]=router; \ No newline at end of file +var _0xceef=['create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','/:id','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceef,0xf6));var _0xfcee=function(_0x4c5a24,_0x5ef60c){_0x4c5a24=_0x4c5a24-0x0;var _0x4b067e=_0xceef[_0x4c5a24];return _0x4b067e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfcee('0x0'));var timeout=require(_0xfcee('0x1'));var express=require('express');var router=express[_0xfcee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfcee('0x3'));var interaction=require(_0xfcee('0x4'));var config=require('../../config/environment');var controller=require(_0xfcee('0x5'));router[_0xfcee('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfcee('0x6')](_0xfcee('0x7'),auth[_0xfcee('0x8')](),controller['show']);router['post']('/',auth[_0xfcee('0x8')](),controller[_0xfcee('0x9')]);router[_0xfcee('0xa')](_0xfcee('0x7'),auth[_0xfcee('0x8')](),controller[_0xfcee('0xb')]);router[_0xfcee('0xc')]('/:id',auth[_0xfcee('0x8')](),controller[_0xfcee('0xd')]);module[_0xfcee('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0bbf248..f9844f3 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 _0x2910=['exports','STRING','TEXT','sequelize'];(function(_0x36e114,_0x3ff0e3){var _0x4e5ac3=function(_0x14cf07){while(--_0x14cf07){_0x36e114['push'](_0x36e114['shift']());}};_0x4e5ac3(++_0x3ff0e3);}(_0x2910,0xf7));var _0x0291=function(_0x19e1f6,_0x52d013){_0x19e1f6=_0x19e1f6-0x0;var _0x4b9242=_0x2910[_0x19e1f6];return _0x4b9242;};'use strict';var Sequelize=require(_0x0291('0x0'));module[_0x0291('0x1')]={'name':{'type':Sequelize[_0x0291('0x2')]},'description':{'type':Sequelize[_0x0291('0x2')]},'html':{'type':Sequelize[_0x0291('0x3')]}}; \ No newline at end of file +var _0xdec7=['sequelize','STRING','TEXT'];(function(_0x4cc03b,_0x299f1c){var _0xf0358c=function(_0x3d0da8){while(--_0x3d0da8){_0x4cc03b['push'](_0x4cc03b['shift']());}};_0xf0358c(++_0x299f1c);}(_0xdec7,0x132));var _0x7dec=function(_0x59fe72,_0x21cd0b){_0x59fe72=_0x59fe72-0x0;var _0x583b28=_0xdec7[_0x59fe72];return _0x583b28;};'use strict';var Sequelize=require(_0x7dec('0x0'));module['exports']={'name':{'type':Sequelize[_0x7dec('0x1')]},'description':{'type':Sequelize[_0x7dec('0x1')]},'html':{'type':Sequelize[_0x7dec('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5e8e937..226dcff 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 _0x23b6=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','intersection','attributes','fields'];(function(_0x3804ef,_0x2ff57d){var _0x4c7944=function(_0x290d77){while(--_0x290d77){_0x3804ef['push'](_0x3804ef['shift']());}};_0x4c7944(++_0x2ff57d);}(_0x23b6,0x6d));var _0x623b=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0x23b6[_0x3f2ecf];return _0xa6dd7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x623b('0x0'));var zipdir=require(_0x623b('0x1'));var jsonpatch=require(_0x623b('0x2'));var rp=require(_0x623b('0x3'));var moment=require(_0x623b('0x4'));var BPromise=require(_0x623b('0x5'));var Mustache=require('mustache');var util=require(_0x623b('0x6'));var path=require('path');var sox=require(_0x623b('0x7'));var csv=require('to-csv');var ejs=require(_0x623b('0x8'));var fs=require('fs');var fs_extra=require(_0x623b('0x9'));var _=require(_0x623b('0xa'));var squel=require(_0x623b('0xb'));var crypto=require(_0x623b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x623b('0xd'));var toCsv=require(_0x623b('0xe'));var querystring=require(_0x623b('0xf'));var Papa=require('papaparse');var Redis=require(_0x623b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x623b('0x11'));var hardwareService=require(_0x623b('0x12'));var logger=require('../../config/logger')(_0x623b('0x13'));var utils=require(_0x623b('0x14'));var config=require(_0x623b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x623b('0x16'))['db'];function respondWithStatusCode(_0x418ac9,_0x45bd1a){_0x45bd1a=_0x45bd1a||0xcc;return function(_0x276800){if(_0x276800){return _0x418ac9[_0x623b('0x17')](_0x45bd1a);}return _0x418ac9[_0x623b('0x18')](_0x45bd1a)[_0x623b('0x19')]();};}function respondWithResult(_0x4002f8,_0x1932c4){_0x1932c4=_0x1932c4||0xc8;return function(_0x2b9105){if(_0x2b9105){return _0x4002f8['status'](_0x1932c4)[_0x623b('0x1a')](_0x2b9105);}};}function respondWithFilteredResult(_0x282321,_0x40f0a6){return function(_0x34cbc3){if(_0x34cbc3){var _0x741e0d=typeof _0x40f0a6['offset']===_0x623b('0x1b')&&typeof _0x40f0a6[_0x623b('0x1c')]===_0x623b('0x1b');var _0x415559=_0x34cbc3[_0x623b('0x1d')];var _0x2acd87=_0x741e0d?0x0:_0x40f0a6[_0x623b('0x1e')];var _0x268097=_0x741e0d?_0x34cbc3[_0x623b('0x1d')]:_0x40f0a6[_0x623b('0x1e')]+_0x40f0a6[_0x623b('0x1c')];var _0x20bbba;if(_0x268097>=_0x415559){_0x268097=_0x415559;_0x20bbba=0xc8;}else{_0x20bbba=0xce;}_0x282321[_0x623b('0x18')](_0x20bbba);return _0x282321[_0x623b('0x1f')]('Content-Range',_0x2acd87+'-'+_0x268097+'/'+_0x415559)['json'](_0x34cbc3);}return null;};}function patchUpdates(_0x1bdd3f){return function(_0x50388b){try{jsonpatch['apply'](_0x50388b,_0x1bdd3f,!![]);}catch(_0x4503d7){return BPromise[_0x623b('0x20')](_0x4503d7);}return _0x50388b[_0x623b('0x21')]();};}function saveUpdates(_0x53f707,_0x45d347){return function(_0x16f048){if(_0x16f048){return _0x16f048[_0x623b('0x22')](_0x53f707)[_0x623b('0x23')](function(_0x477269){return _0x477269;});}return null;};}function removeEntity(_0x46f5ec,_0x17849d){return function(_0x5f3a8e){if(_0x5f3a8e){return _0x5f3a8e[_0x623b('0x24')]()[_0x623b('0x23')](function(){var _0x3ba780=_0x5f3a8e[_0x623b('0x25')]({'plain':!![]});var _0x25d391=_0x623b('0x26');return db[_0x623b('0x27')]['destroy']({'where':{'type':_0x25d391,'resourceId':_0x3ba780['id']}})[_0x623b('0x23')](function(){return _0x5f3a8e;});})[_0x623b('0x23')](function(){_0x46f5ec[_0x623b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7327c3,_0x1456da){return function(_0x230074){if(!_0x230074){_0x7327c3[_0x623b('0x17')](0x194);}return _0x230074;};}function handleError(_0x2c28ac,_0x35f9f7){_0x35f9f7=_0x35f9f7||0x1f4;return function(_0x1e92d6){logger[_0x623b('0x28')](_0x1e92d6[_0x623b('0x29')]);if(_0x1e92d6[_0x623b('0x2a')]){delete _0x1e92d6[_0x623b('0x2a')];}_0x2c28ac[_0x623b('0x18')](_0x35f9f7)[_0x623b('0x2b')](_0x1e92d6);};}exports[_0x623b('0x2c')]=function(_0x4115ea,_0x4de01f){var _0x5d98f1={},_0x16f384={},_0x3ccd4a={'count':0x0,'rows':[]};var _0x563a59=_[_0x623b('0x2d')](db[_0x623b('0x2e')][_0x623b('0x2f')],function(_0x3ba457){return{'name':_0x3ba457[_0x623b('0x30')],'type':_0x3ba457[_0x623b('0x31')]['key']};});_0x16f384[_0x623b('0x32')]=_[_0x623b('0x2d')](_0x563a59,'name');_0x16f384[_0x623b('0x33')]=_['keys'](_0x4115ea['query']);_0x16f384['filters']=_[_0x623b('0x34')](_0x16f384[_0x623b('0x32')],_0x16f384[_0x623b('0x33')]);_0x5d98f1[_0x623b('0x35')]=_[_0x623b('0x34')](_0x16f384[_0x623b('0x32')],qs['fields'](_0x4115ea['query'][_0x623b('0x36')]));_0x5d98f1['attributes']=_0x5d98f1['attributes'][_0x623b('0x37')]?_0x5d98f1['attributes']:_0x16f384[_0x623b('0x32')];if(!_0x4115ea[_0x623b('0x33')][_0x623b('0x38')](_0x623b('0x39'))){_0x5d98f1[_0x623b('0x1c')]=qs[_0x623b('0x1c')](_0x4115ea[_0x623b('0x33')][_0x623b('0x1c')]);_0x5d98f1['offset']=qs[_0x623b('0x1e')](_0x4115ea[_0x623b('0x33')][_0x623b('0x1e')]);}_0x5d98f1[_0x623b('0x3a')]=qs[_0x623b('0x3b')](_0x4115ea[_0x623b('0x33')]['sort']);_0x5d98f1[_0x623b('0x3c')]=qs[_0x623b('0x3d')](_['pick'](_0x4115ea[_0x623b('0x33')],_0x16f384['filters']),_0x563a59);if(_0x4115ea[_0x623b('0x33')][_0x623b('0x3e')]){_0x5d98f1[_0x623b('0x3c')]=_[_0x623b('0x3f')](_0x5d98f1[_0x623b('0x3c')],{'$or':_['map'](_0x563a59,function(_0x7bab06){if(_0x7bab06[_0x623b('0x31')]!==_0x623b('0x40')){var _0x4e3e82={};_0x4e3e82[_0x7bab06[_0x623b('0x2a')]]={'$like':'%'+_0x4115ea[_0x623b('0x33')][_0x623b('0x3e')]+'%'};return _0x4e3e82;}})});}_0x5d98f1=_[_0x623b('0x3f')]({},_0x5d98f1,_0x4115ea[_0x623b('0x41')]);var _0x168b53={'where':_0x5d98f1['where']};return db[_0x623b('0x2e')][_0x623b('0x1d')](_0x168b53)[_0x623b('0x23')](function(_0x33157c){_0x3ccd4a[_0x623b('0x1d')]=_0x33157c;if(_0x4115ea[_0x623b('0x33')]['includeAll']){_0x5d98f1['include']=[{'all':!![]}];}return db['Template'][_0x623b('0x42')](_0x5d98f1);})[_0x623b('0x23')](function(_0x1ae878){_0x3ccd4a[_0x623b('0x43')]=_0x1ae878;return _0x3ccd4a;})[_0x623b('0x23')](respondWithFilteredResult(_0x4de01f,_0x5d98f1))[_0x623b('0x44')](handleError(_0x4de01f,null));};exports[_0x623b('0x45')]=function(_0x378475,_0x4c9101){var _0x26e9f4={'raw':!![],'where':{'id':_0x378475[_0x623b('0x46')]['id']}},_0x2538ec={};_0x2538ec[_0x623b('0x32')]=_[_0x623b('0x47')](db['Template'][_0x623b('0x2f')]);_0x2538ec[_0x623b('0x33')]=_[_0x623b('0x47')](_0x378475[_0x623b('0x33')]);_0x2538ec['filters']=_[_0x623b('0x34')](_0x2538ec[_0x623b('0x32')],_0x2538ec[_0x623b('0x33')]);_0x26e9f4['attributes']=_[_0x623b('0x34')](_0x2538ec[_0x623b('0x32')],qs[_0x623b('0x36')](_0x378475[_0x623b('0x33')]['fields']));_0x26e9f4[_0x623b('0x35')]=_0x26e9f4[_0x623b('0x35')][_0x623b('0x37')]?_0x26e9f4[_0x623b('0x35')]:_0x2538ec['model'];if(_0x378475[_0x623b('0x33')][_0x623b('0x48')]){_0x26e9f4[_0x623b('0x49')]=[{'all':!![]}];}_0x26e9f4=_[_0x623b('0x3f')]({},_0x26e9f4,_0x378475[_0x623b('0x41')]);return db['Template'][_0x623b('0x4a')](_0x26e9f4)[_0x623b('0x23')](handleEntityNotFound(_0x4c9101,null))[_0x623b('0x23')](respondWithResult(_0x4c9101,null))[_0x623b('0x44')](handleError(_0x4c9101,null));};exports[_0x623b('0x4b')]=function(_0x308e88,_0x3c6961){return db[_0x623b('0x2e')][_0x623b('0x4b')](_0x308e88[_0x623b('0x4c')],{})['then'](function(_0x5cd67b){var _0x23c0a7=_0x308e88[_0x623b('0x4d')][_0x623b('0x25')]({'plain':!![]});if(!_0x23c0a7)throw new Error(_0x623b('0x4e'));if(_0x23c0a7['role']===_0x623b('0x4d')){var _0x2eaab0=_0x5cd67b['get']({'plain':!![]});var _0x95683f=_0x623b('0x26');return db['UserProfileSection'][_0x623b('0x4a')]({'where':{'name':_0x95683f,'userProfileId':_0x23c0a7[_0x623b('0x4f')]},'raw':!![]})[_0x623b('0x23')](function(_0x472bf8){if(_0x472bf8&&_0x472bf8[_0x623b('0x50')]===0x0){return db[_0x623b('0x27')][_0x623b('0x4b')]({'name':_0x2eaab0[_0x623b('0x2a')],'resourceId':_0x2eaab0['id'],'type':_0x472bf8[_0x623b('0x2a')],'sectionId':_0x472bf8['id']},{})[_0x623b('0x23')](function(){return _0x5cd67b;});}else{return _0x5cd67b;}})[_0x623b('0x44')](function(_0x370b34){logger[_0x623b('0x28')](_0x623b('0x51'),_0x370b34);throw _0x370b34;});}return _0x5cd67b;})['then'](respondWithResult(_0x3c6961,0xc9))[_0x623b('0x44')](handleError(_0x3c6961,null));};exports[_0x623b('0x22')]=function(_0x48ce48,_0x5dbc76){if(_0x48ce48[_0x623b('0x4c')]['id']){delete _0x48ce48[_0x623b('0x4c')]['id'];}return db[_0x623b('0x2e')]['find']({'where':{'id':_0x48ce48[_0x623b('0x46')]['id']}})[_0x623b('0x23')](handleEntityNotFound(_0x5dbc76,null))['then'](saveUpdates(_0x48ce48[_0x623b('0x4c')],null))[_0x623b('0x23')](respondWithResult(_0x5dbc76,null))[_0x623b('0x44')](handleError(_0x5dbc76,null));};exports[_0x623b('0x24')]=function(_0x5ae1de,_0x3e007a){return db[_0x623b('0x2e')][_0x623b('0x4a')]({'where':{'id':_0x5ae1de[_0x623b('0x46')]['id']}})[_0x623b('0x23')](handleEntityNotFound(_0x3e007a,null))[_0x623b('0x23')](removeEntity(_0x3e007a,null))['catch'](handleError(_0x3e007a,null));}; \ No newline at end of file +var _0xb2f5=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','get','user','Templates','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0xb2f5,0x114));var _0x5b2f=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xb2f5[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x5b2f('0x0'));var rimraf=require(_0x5b2f('0x1'));var zipdir=require(_0x5b2f('0x2'));var jsonpatch=require(_0x5b2f('0x3'));var rp=require(_0x5b2f('0x4'));var moment=require('moment');var BPromise=require(_0x5b2f('0x5'));var Mustache=require(_0x5b2f('0x6'));var util=require('util');var path=require(_0x5b2f('0x7'));var sox=require(_0x5b2f('0x8'));var csv=require(_0x5b2f('0x9'));var ejs=require(_0x5b2f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b2f('0xb'));var squel=require(_0x5b2f('0xc'));var crypto=require(_0x5b2f('0xd'));var jsforce=require(_0x5b2f('0xe'));var deskjs=require(_0x5b2f('0xf'));var toCsv=require(_0x5b2f('0x9'));var querystring=require(_0x5b2f('0x10'));var Papa=require(_0x5b2f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5b2f('0x12'));var as=require(_0x5b2f('0x13'));var hardwareService=require(_0x5b2f('0x14'));var logger=require(_0x5b2f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5b2f('0x16'));var licenseUtil=require(_0x5b2f('0x17'));var db=require(_0x5b2f('0x18'))['db'];function respondWithStatusCode(_0x50e761,_0x5f2c05){_0x5f2c05=_0x5f2c05||0xcc;return function(_0xafa737){if(_0xafa737){return _0x50e761['sendStatus'](_0x5f2c05);}return _0x50e761[_0x5b2f('0x19')](_0x5f2c05)[_0x5b2f('0x1a')]();};}function respondWithResult(_0x450094,_0x4911ec){_0x4911ec=_0x4911ec||0xc8;return function(_0x5d5747){if(_0x5d5747){return _0x450094[_0x5b2f('0x19')](_0x4911ec)[_0x5b2f('0x1b')](_0x5d5747);}};}function respondWithFilteredResult(_0x20f104,_0x231a1e){return function(_0x1122f1){if(_0x1122f1){var _0x2b2ed0=typeof _0x231a1e[_0x5b2f('0x1c')]===_0x5b2f('0x1d')&&typeof _0x231a1e['limit']===_0x5b2f('0x1d');var _0x33a34a=_0x1122f1[_0x5b2f('0x1e')];var _0x270d74=_0x2b2ed0?0x0:_0x231a1e[_0x5b2f('0x1c')];var _0xf1f095=_0x2b2ed0?_0x1122f1[_0x5b2f('0x1e')]:_0x231a1e[_0x5b2f('0x1c')]+_0x231a1e[_0x5b2f('0x1f')];var _0x206ddd;if(_0xf1f095>=_0x33a34a){_0xf1f095=_0x33a34a;_0x206ddd=0xc8;}else{_0x206ddd=0xce;}_0x20f104['status'](_0x206ddd);return _0x20f104['set'](_0x5b2f('0x20'),_0x270d74+'-'+_0xf1f095+'/'+_0x33a34a)[_0x5b2f('0x1b')](_0x1122f1);}return null;};}function patchUpdates(_0x59c6d4){return function(_0x1c1447){try{jsonpatch[_0x5b2f('0x21')](_0x1c1447,_0x59c6d4,!![]);}catch(_0x534720){return BPromise[_0x5b2f('0x22')](_0x534720);}return _0x1c1447[_0x5b2f('0x23')]();};}function saveUpdates(_0x174f54,_0x5ed8f8){return function(_0x11d6d8){if(_0x11d6d8){return _0x11d6d8[_0x5b2f('0x24')](_0x174f54)[_0x5b2f('0x25')](function(_0x2ab092){return _0x2ab092;});}return null;};}function removeEntity(_0x23288c,_0x24868f){return function(_0x648ac7){if(_0x648ac7){return _0x648ac7[_0x5b2f('0x26')]()[_0x5b2f('0x25')](function(){var _0x5da57e=_0x648ac7['get']({'plain':!![]});var _0x5f0f2b='Templates';return db[_0x5b2f('0x27')][_0x5b2f('0x26')]({'where':{'type':_0x5f0f2b,'resourceId':_0x5da57e['id']}})['then'](function(){return _0x648ac7;});})['then'](function(){_0x23288c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x202110,_0x4e3db1){return function(_0x101fbe){if(!_0x101fbe){_0x202110['sendStatus'](0x194);}return _0x101fbe;};}function handleError(_0x2a3359,_0x3727fa){_0x3727fa=_0x3727fa||0x1f4;return function(_0x11b38d){logger[_0x5b2f('0x28')](_0x11b38d['stack']);if(_0x11b38d['name']){delete _0x11b38d[_0x5b2f('0x29')];}_0x2a3359[_0x5b2f('0x19')](_0x3727fa)[_0x5b2f('0x2a')](_0x11b38d);};}exports[_0x5b2f('0x2b')]=function(_0x5450db,_0x3742af){var _0xd7ad0c={},_0x1785e4={},_0x3e7b2a={'count':0x0,'rows':[]};var _0x530f6f=_[_0x5b2f('0x2c')](db[_0x5b2f('0x2d')][_0x5b2f('0x2e')],function(_0x3f34eb){return{'name':_0x3f34eb[_0x5b2f('0x2f')],'type':_0x3f34eb[_0x5b2f('0x30')][_0x5b2f('0x31')]};});_0x1785e4[_0x5b2f('0x32')]=_[_0x5b2f('0x2c')](_0x530f6f,_0x5b2f('0x29'));_0x1785e4[_0x5b2f('0x33')]=_[_0x5b2f('0x34')](_0x5450db[_0x5b2f('0x33')]);_0x1785e4[_0x5b2f('0x35')]=_[_0x5b2f('0x36')](_0x1785e4[_0x5b2f('0x32')],_0x1785e4['query']);_0xd7ad0c[_0x5b2f('0x37')]=_[_0x5b2f('0x36')](_0x1785e4[_0x5b2f('0x32')],qs[_0x5b2f('0x38')](_0x5450db['query']['fields']));_0xd7ad0c[_0x5b2f('0x37')]=_0xd7ad0c[_0x5b2f('0x37')][_0x5b2f('0x39')]?_0xd7ad0c[_0x5b2f('0x37')]:_0x1785e4[_0x5b2f('0x32')];if(!_0x5450db[_0x5b2f('0x33')][_0x5b2f('0x3a')](_0x5b2f('0x3b'))){_0xd7ad0c['limit']=qs['limit'](_0x5450db[_0x5b2f('0x33')][_0x5b2f('0x1f')]);_0xd7ad0c[_0x5b2f('0x1c')]=qs['offset'](_0x5450db[_0x5b2f('0x33')][_0x5b2f('0x1c')]);}_0xd7ad0c[_0x5b2f('0x3c')]=qs[_0x5b2f('0x3d')](_0x5450db[_0x5b2f('0x33')][_0x5b2f('0x3d')]);_0xd7ad0c[_0x5b2f('0x3e')]=qs[_0x5b2f('0x35')](_[_0x5b2f('0x3f')](_0x5450db['query'],_0x1785e4['filters']),_0x530f6f);if(_0x5450db[_0x5b2f('0x33')][_0x5b2f('0x40')]){_0xd7ad0c['where']=_[_0x5b2f('0x41')](_0xd7ad0c['where'],{'$or':_[_0x5b2f('0x2c')](_0x530f6f,function(_0x7f2b02){if(_0x7f2b02[_0x5b2f('0x30')]!==_0x5b2f('0x42')){var _0x4f85a4={};_0x4f85a4[_0x7f2b02[_0x5b2f('0x29')]]={'$like':'%'+_0x5450db['query']['filter']+'%'};return _0x4f85a4;}})});}_0xd7ad0c=_['merge']({},_0xd7ad0c,_0x5450db[_0x5b2f('0x43')]);var _0x16b424={'where':_0xd7ad0c[_0x5b2f('0x3e')]};return db['Template'][_0x5b2f('0x1e')](_0x16b424)[_0x5b2f('0x25')](function(_0x5d5eb4){_0x3e7b2a[_0x5b2f('0x1e')]=_0x5d5eb4;if(_0x5450db[_0x5b2f('0x33')][_0x5b2f('0x44')]){_0xd7ad0c[_0x5b2f('0x45')]=[{'all':!![]}];}return db[_0x5b2f('0x2d')][_0x5b2f('0x46')](_0xd7ad0c);})[_0x5b2f('0x25')](function(_0x7fdb53){_0x3e7b2a[_0x5b2f('0x47')]=_0x7fdb53;return _0x3e7b2a;})[_0x5b2f('0x25')](respondWithFilteredResult(_0x3742af,_0xd7ad0c))[_0x5b2f('0x48')](handleError(_0x3742af,null));};exports[_0x5b2f('0x49')]=function(_0x1bf33c,_0x4971f0){var _0x8bd90c={'raw':!![],'where':{'id':_0x1bf33c[_0x5b2f('0x4a')]['id']}},_0x45683a={};_0x45683a[_0x5b2f('0x32')]=_[_0x5b2f('0x34')](db[_0x5b2f('0x2d')][_0x5b2f('0x2e')]);_0x45683a[_0x5b2f('0x33')]=_[_0x5b2f('0x34')](_0x1bf33c[_0x5b2f('0x33')]);_0x45683a[_0x5b2f('0x35')]=_[_0x5b2f('0x36')](_0x45683a[_0x5b2f('0x32')],_0x45683a['query']);_0x8bd90c[_0x5b2f('0x37')]=_[_0x5b2f('0x36')](_0x45683a[_0x5b2f('0x32')],qs[_0x5b2f('0x38')](_0x1bf33c[_0x5b2f('0x33')]['fields']));_0x8bd90c[_0x5b2f('0x37')]=_0x8bd90c[_0x5b2f('0x37')]['length']?_0x8bd90c['attributes']:_0x45683a[_0x5b2f('0x32')];if(_0x1bf33c['query'][_0x5b2f('0x44')]){_0x8bd90c[_0x5b2f('0x45')]=[{'all':!![]}];}_0x8bd90c=_['merge']({},_0x8bd90c,_0x1bf33c['options']);return db['Template']['find'](_0x8bd90c)[_0x5b2f('0x25')](handleEntityNotFound(_0x4971f0,null))[_0x5b2f('0x25')](respondWithResult(_0x4971f0,null))[_0x5b2f('0x48')](handleError(_0x4971f0,null));};exports[_0x5b2f('0x4b')]=function(_0xf599af,_0x36e62b){return db[_0x5b2f('0x2d')]['create'](_0xf599af['body'],{})[_0x5b2f('0x25')](function(_0x2c6fc7){var _0x5df156=_0xf599af['user'][_0x5b2f('0x4c')]({'plain':!![]});if(!_0x5df156)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5df156['role']===_0x5b2f('0x4d')){var _0x2dde46=_0x2c6fc7[_0x5b2f('0x4c')]({'plain':!![]});var _0x4dc066=_0x5b2f('0x4e');return db['UserProfileSection'][_0x5b2f('0x4f')]({'where':{'name':_0x4dc066,'userProfileId':_0x5df156[_0x5b2f('0x50')]},'raw':!![]})[_0x5b2f('0x25')](function(_0x3df8ce){if(_0x3df8ce&&_0x3df8ce[_0x5b2f('0x51')]===0x0){return db[_0x5b2f('0x27')][_0x5b2f('0x4b')]({'name':_0x2dde46[_0x5b2f('0x29')],'resourceId':_0x2dde46['id'],'type':_0x3df8ce['name'],'sectionId':_0x3df8ce['id']},{})[_0x5b2f('0x25')](function(){return _0x2c6fc7;});}else{return _0x2c6fc7;}})['catch'](function(_0x4ef4e7){logger[_0x5b2f('0x28')](_0x5b2f('0x52'),_0x4ef4e7);throw _0x4ef4e7;});}return _0x2c6fc7;})[_0x5b2f('0x25')](respondWithResult(_0x36e62b,0xc9))[_0x5b2f('0x48')](handleError(_0x36e62b,null));};exports[_0x5b2f('0x24')]=function(_0x4755be,_0x1bc4dd){if(_0x4755be[_0x5b2f('0x53')]['id']){delete _0x4755be[_0x5b2f('0x53')]['id'];}return db[_0x5b2f('0x2d')][_0x5b2f('0x4f')]({'where':{'id':_0x4755be['params']['id']}})[_0x5b2f('0x25')](handleEntityNotFound(_0x1bc4dd,null))['then'](saveUpdates(_0x4755be['body'],null))[_0x5b2f('0x25')](respondWithResult(_0x1bc4dd,null))['catch'](handleError(_0x1bc4dd,null));};exports[_0x5b2f('0x26')]=function(_0x599586,_0x29db68){return db[_0x5b2f('0x2d')]['find']({'where':{'id':_0x599586[_0x5b2f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x29db68,null))['then'](removeEntity(_0x29db68,null))[_0x5b2f('0x48')](handleError(_0x29db68,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2d62532..28d4e52 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 _0xc47f=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','Template'];(function(_0x1694ab,_0x3d3831){var _0x170f7d=function(_0x368d7c){while(--_0x368d7c){_0x1694ab['push'](_0x1694ab['shift']());}};_0x170f7d(++_0x3d3831);}(_0xc47f,0xb7));var _0xfc47=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc47f[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xfc47('0x0'));var util=require(_0xfc47('0x1'));var logger=require(_0xfc47('0x2'))(_0xfc47('0x3'));var moment=require(_0xfc47('0x4'));var BPromise=require(_0xfc47('0x5'));var rp=require(_0xfc47('0x6'));var fs=require('fs');var path=require(_0xfc47('0x7'));var rimraf=require(_0xfc47('0x8'));var config=require('../../config/environment');var attributes=require(_0xfc47('0x9'));module[_0xfc47('0xa')]=function(_0x4ca192,_0x202670){return _0x4ca192[_0xfc47('0xb')](_0xfc47('0xc'),attributes,{'tableName':_0xfc47('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d9=['Template','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./template.attributes','exports'];(function(_0x2761a0,_0x59b0e6){var _0xe8c366=function(_0x5e36ad){while(--_0x5e36ad){_0x2761a0['push'](_0x2761a0['shift']());}};_0xe8c366(++_0x59b0e6);}(_0xb0d9,0x1a8));var _0x9b0d=function(_0x36c596,_0x2c8107){_0x36c596=_0x36c596-0x0;var _0x179aa3=_0xb0d9[_0x36c596];return _0x179aa3;};'use strict';var _=require(_0x9b0d('0x0'));var util=require('util');var logger=require(_0x9b0d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9b0d('0x2'));var rp=require(_0x9b0d('0x3'));var fs=require('fs');var path=require(_0x9b0d('0x4'));var rimraf=require('rimraf');var config=require(_0x9b0d('0x5'));var attributes=require(_0x9b0d('0x6'));module[_0x9b0d('0x7')]=function(_0x5afbd4,_0x3575ea){return _0x5afbd4['define'](_0x9b0d('0x8'),attributes,{'tableName':'tools_templates','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 8c16276..11508e2 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 _0xbefc=['info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','raw','options','attributes','limit','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2df01f,_0x542398){var _0x5e487b=function(_0x490723){while(--_0x490723){_0x2df01f['push'](_0x2df01f['shift']());}};_0x5e487b(++_0x542398);}(_0xbefc,0x195));var _0xcbef=function(_0x4e4fcf,_0x355f77){_0x4e4fcf=_0x4e4fcf-0x0;var _0x540cb9=_0xbefc[_0x4e4fcf];return _0x540cb9;};'use strict';var _=require('lodash');var util=require(_0xcbef('0x0'));var moment=require(_0xcbef('0x1'));var BPromise=require(_0xcbef('0x2'));var rs=require(_0xcbef('0x3'));var fs=require('fs');var Redis=require(_0xcbef('0x4'));var db=require(_0xcbef('0x5'))['db'];var utils=require(_0xcbef('0x6'));var logger=require(_0xcbef('0x7'))(_0xcbef('0x8'));var config=require(_0xcbef('0x9'));var jayson=require(_0xcbef('0xa'));var client=jayson[_0xcbef('0xb')][_0xcbef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17bf41,_0x3137a4,_0x36eae6){return new BPromise(function(_0x3c76cd,_0x10e840){return client[_0xcbef('0xd')](_0x17bf41,_0x36eae6)[_0xcbef('0xe')](function(_0x2e10e4){logger[_0xcbef('0xf')]('Template,\x20%s,\x20%s',_0x3137a4,_0xcbef('0x10'));logger[_0xcbef('0x11')](_0xcbef('0x12'),_0x3137a4,'request\x20sent',JSON['stringify'](_0x2e10e4));if(_0x2e10e4[_0xcbef('0x13')]){if(_0x2e10e4[_0xcbef('0x13')][_0xcbef('0x14')]===0x1f4){logger[_0xcbef('0x13')](_0xcbef('0x15'),_0x3137a4,_0x2e10e4[_0xcbef('0x13')][_0xcbef('0x16')]);return _0x10e840(_0x2e10e4['error'][_0xcbef('0x16')]);}logger[_0xcbef('0x13')](_0xcbef('0x15'),_0x3137a4,_0x2e10e4[_0xcbef('0x13')][_0xcbef('0x16')]);return _0x3c76cd(_0x2e10e4[_0xcbef('0x13')][_0xcbef('0x16')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x3137a4,_0xcbef('0x10'));_0x3c76cd(_0x2e10e4[_0xcbef('0x17')][_0xcbef('0x16')]);}})['catch'](function(_0x48a6c9){logger[_0xcbef('0x13')](_0xcbef('0x15'),_0x3137a4,_0x48a6c9);_0x10e840(_0x48a6c9);});});}exports[_0xcbef('0x18')]=function(_0x5b02be){var _0x2a3887=this;return new Promise(function(_0x17f198,_0x4d59b3){return db[_0xcbef('0x19')][_0xcbef('0x1a')]({'raw':_0x5b02be['options']?_0x5b02be['options'][_0xcbef('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b02be[_0xcbef('0x1c')]?_0x5b02be[_0xcbef('0x1c')]['where']||null:null,'attributes':_0x5b02be[_0xcbef('0x1c')]?_0x5b02be[_0xcbef('0x1c')][_0xcbef('0x1d')]||null:null,'limit':_0x5b02be['options']?_0x5b02be[_0xcbef('0x1c')][_0xcbef('0x1e')]||null:null,'include':_0x5b02be[_0xcbef('0x1c')]?_0x5b02be['options'][_0xcbef('0x1f')]?_[_0xcbef('0x20')](_0x5b02be[_0xcbef('0x1c')][_0xcbef('0x1f')],function(_0x1cf41e){return{'model':db[_0x1cf41e['model']],'as':_0x1cf41e['as'],'attributes':_0x1cf41e[_0xcbef('0x1d')],'include':_0x1cf41e[_0xcbef('0x1f')]?_[_0xcbef('0x20')](_0x1cf41e[_0xcbef('0x1f')],function(_0x119443){return{'model':db[_0x119443['model']],'as':_0x119443['as'],'attributes':_0x119443[_0xcbef('0x1d')],'include':_0x119443['include']?_[_0xcbef('0x20')](_0x119443[_0xcbef('0x1f')],function(_0xaaa05a){return{'model':db[_0xaaa05a[_0xcbef('0x21')]],'as':_0xaaa05a['as'],'attributes':_0xaaa05a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbef('0xe')](function(_0x4ee886){logger[_0xcbef('0xf')](_0xcbef('0x18'),_0x5b02be);logger[_0xcbef('0x11')](_0xcbef('0x18'),_0x5b02be,JSON['stringify'](_0x4ee886));_0x17f198(_0x4ee886);})[_0xcbef('0x22')](function(_0x2ca2a7){logger[_0xcbef('0x13')](_0xcbef('0x18'),_0x2ca2a7[_0xcbef('0x16')],_0x5b02be);_0x4d59b3(_0x2a3887[_0xcbef('0x13')](0x1f4,_0x2ca2a7['message']));});});}; \ No newline at end of file +var _0xdc09=['options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll'];(function(_0x310669,_0xea2d6a){var _0xd86097=function(_0x19a5e5){while(--_0x19a5e5){_0x310669['push'](_0x310669['shift']());}};_0xd86097(++_0xea2d6a);}(_0xdc09,0xc2));var _0x9dc0=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0xdc09[_0x867b0a];return _0x137438;};'use strict';var _=require('lodash');var util=require(_0x9dc0('0x0'));var moment=require(_0x9dc0('0x1'));var BPromise=require(_0x9dc0('0x2'));var rs=require(_0x9dc0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9dc0('0x4'));var logger=require(_0x9dc0('0x5'))('rpc');var config=require(_0x9dc0('0x6'));var jayson=require(_0x9dc0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16b586,_0x12a353,_0x2a7fb8){return new BPromise(function(_0x1abd4e,_0x353fb1){return client[_0x9dc0('0x8')](_0x16b586,_0x2a7fb8)[_0x9dc0('0x9')](function(_0xbb57ec){logger[_0x9dc0('0xa')](_0x9dc0('0xb'),_0x12a353,_0x9dc0('0xc'));logger[_0x9dc0('0xd')](_0x9dc0('0xe'),_0x12a353,'request\x20sent',JSON[_0x9dc0('0xf')](_0xbb57ec));if(_0xbb57ec[_0x9dc0('0x10')]){if(_0xbb57ec[_0x9dc0('0x10')]['code']===0x1f4){logger[_0x9dc0('0x10')](_0x9dc0('0xb'),_0x12a353,_0xbb57ec[_0x9dc0('0x10')][_0x9dc0('0x11')]);return _0x353fb1(_0xbb57ec[_0x9dc0('0x10')][_0x9dc0('0x11')]);}logger[_0x9dc0('0x10')](_0x9dc0('0xb'),_0x12a353,_0xbb57ec[_0x9dc0('0x10')]['message']);return _0x1abd4e(_0xbb57ec[_0x9dc0('0x10')]['message']);}else{logger[_0x9dc0('0xa')](_0x9dc0('0xb'),_0x12a353,_0x9dc0('0xc'));_0x1abd4e(_0xbb57ec[_0x9dc0('0x12')][_0x9dc0('0x11')]);}})[_0x9dc0('0x13')](function(_0xce7ffc){logger['error'](_0x9dc0('0xb'),_0x12a353,_0xce7ffc);_0x353fb1(_0xce7ffc);});});}exports[_0x9dc0('0x14')]=function(_0x4dda7c){var _0x41b62b=this;return new Promise(function(_0x375b33,_0x20627a){return db[_0x9dc0('0x15')][_0x9dc0('0x16')]({'raw':_0x4dda7c['options']?_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x18')]===undefined?!![]:![]:!![],'where':_0x4dda7c[_0x9dc0('0x17')]?_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x19')]||null:null,'attributes':_0x4dda7c['options']?_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x1a')]||null:null,'limit':_0x4dda7c['options']?_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x1b')]||null:null,'include':_0x4dda7c['options']?_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x1c')]?_[_0x9dc0('0x1d')](_0x4dda7c[_0x9dc0('0x17')][_0x9dc0('0x1c')],function(_0x350075){return{'model':db[_0x350075['model']],'as':_0x350075['as'],'attributes':_0x350075[_0x9dc0('0x1a')],'include':_0x350075['include']?_['map'](_0x350075[_0x9dc0('0x1c')],function(_0x1ba196){return{'model':db[_0x1ba196[_0x9dc0('0x1e')]],'as':_0x1ba196['as'],'attributes':_0x1ba196[_0x9dc0('0x1a')],'include':_0x1ba196['include']?_['map'](_0x1ba196[_0x9dc0('0x1c')],function(_0x50c92c){return{'model':db[_0x50c92c[_0x9dc0('0x1e')]],'as':_0x50c92c['as'],'attributes':_0x50c92c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9dc0('0x9')](function(_0x1eb6e5){logger[_0x9dc0('0xa')](_0x9dc0('0x14'),_0x4dda7c);logger[_0x9dc0('0xd')](_0x9dc0('0x14'),_0x4dda7c,JSON['stringify'](_0x1eb6e5));_0x375b33(_0x1eb6e5);})[_0x9dc0('0x13')](function(_0x4804c8){logger[_0x9dc0('0x10')](_0x9dc0('0x14'),_0x4804c8[_0x9dc0('0x11')],_0x4dda7c);_0x20627a(_0x41b62b[_0x9dc0('0x10')](0x1f4,_0x4804c8[_0x9dc0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3940807..d8432e4 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 _0x9153=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','/:id','show','get','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAnyCondition','put','update','delete','destroy','exports'];(function(_0x47a1f2,_0x490e17){var _0x15b217=function(_0x166b74){while(--_0x166b74){_0x47a1f2['push'](_0x47a1f2['shift']());}};_0x15b217(++_0x490e17);}(_0x9153,0xd8));var _0x3915=function(_0x128367,_0x56807a){_0x128367=_0x128367-0x0;var _0x237084=_0x9153[_0x128367];return _0x237084;};'use strict';var multer=require(_0x3915('0x0'));var util=require(_0x3915('0x1'));var path=require(_0x3915('0x2'));var timeout=require(_0x3915('0x3'));var express=require(_0x3915('0x4'));var router=express[_0x3915('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3915('0x6'));var interaction=require(_0x3915('0x7'));var config=require(_0x3915('0x8'));var controller=require(_0x3915('0x9'));router['get']('/',auth[_0x3915('0xa')](),controller['index']);router['get'](_0x3915('0xb'),auth[_0x3915('0xa')](),controller[_0x3915('0xc')]);router[_0x3915('0xd')]('/:id/all_conditions',auth[_0x3915('0xa')](),controller['getAllConditions']);router['get'](_0x3915('0xe'),auth[_0x3915('0xa')](),controller[_0x3915('0xf')]);router[_0x3915('0xd')](_0x3915('0x10'),auth[_0x3915('0xa')](),controller[_0x3915('0x11')]);router[_0x3915('0x12')]('/',auth[_0x3915('0xa')](),controller[_0x3915('0x13')]);router['post'](_0x3915('0x14'),auth[_0x3915('0xa')](),controller['addAllCondition']);router[_0x3915('0x12')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x3915('0x15')]);router[_0x3915('0x12')](_0x3915('0x10'),auth[_0x3915('0xa')](),controller['addAction']);router[_0x3915('0x16')](_0x3915('0xb'),auth[_0x3915('0xa')](),controller[_0x3915('0x17')]);router[_0x3915('0x18')]('/:id',auth[_0x3915('0xa')](),controller[_0x3915('0x19')]);module[_0x3915('0x1a')]=router; \ No newline at end of file +var _0xa2b7=['./trigger.controller','get','index','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa2b7,0xd9));var _0x7a2b=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xa2b7[_0x5cabfd];return _0x4bc06c;};'use strict';var multer=require(_0x7a2b('0x0'));var util=require(_0x7a2b('0x1'));var path=require('path');var timeout=require(_0x7a2b('0x2'));var express=require('express');var router=express[_0x7a2b('0x3')]();var fs_extra=require(_0x7a2b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7a2b('0x5'));var config=require(_0x7a2b('0x6'));var controller=require(_0x7a2b('0x7'));router[_0x7a2b('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a2b('0x9')]);router[_0x7a2b('0x8')]('/:id',auth[_0x7a2b('0xa')](),controller[_0x7a2b('0xb')]);router[_0x7a2b('0x8')](_0x7a2b('0xc'),auth['isAuthenticated'](),controller[_0x7a2b('0xd')]);router['get'](_0x7a2b('0xe'),auth[_0x7a2b('0xa')](),controller[_0x7a2b('0xf')]);router[_0x7a2b('0x8')](_0x7a2b('0x10'),auth[_0x7a2b('0xa')](),controller[_0x7a2b('0x11')]);router['post']('/',auth[_0x7a2b('0xa')](),controller[_0x7a2b('0x12')]);router[_0x7a2b('0x13')]('/:id/all_conditions',auth[_0x7a2b('0xa')](),controller['addAllCondition']);router[_0x7a2b('0x13')](_0x7a2b('0xe'),auth['isAuthenticated'](),controller[_0x7a2b('0x14')]);router[_0x7a2b('0x13')](_0x7a2b('0x10'),auth['isAuthenticated'](),controller[_0x7a2b('0x15')]);router[_0x7a2b('0x16')](_0x7a2b('0x17'),auth[_0x7a2b('0xa')](),controller[_0x7a2b('0x18')]);router[_0x7a2b('0x19')](_0x7a2b('0x17'),auth['isAuthenticated'](),controller[_0x7a2b('0x1a')]);module[_0x7a2b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6e5197f..480c03c 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 _0xb403=['sequelize','STRING','BOOLEAN'];(function(_0x5e7173,_0x37b118){var _0x491084=function(_0x4550c9){while(--_0x4550c9){_0x5e7173['push'](_0x5e7173['shift']());}};_0x491084(++_0x37b118);}(_0xb403,0x1e0));var _0x3b40=function(_0xde639e,_0x508b44){_0xde639e=_0xde639e-0x0;var _0x105a83=_0xb403[_0xde639e];return _0x105a83;};'use strict';var Sequelize=require(_0x3b40('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b40('0x1')]},'channel':{'type':Sequelize[_0x3b40('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x3b40('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3450=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3b9cf1,_0x5cc906){var _0x5d4992=function(_0x32bf1a){while(--_0x32bf1a){_0x3b9cf1['push'](_0x3b9cf1['shift']());}};_0x5d4992(++_0x5cc906);}(_0x3450,0x14b));var _0x0345=function(_0x3a196b,_0x1a03c4){_0x3a196b=_0x3a196b-0x0;var _0x192dd8=_0x3450[_0x3a196b];return _0x192dd8;};'use strict';var Sequelize=require(_0x0345('0x0'));module[_0x0345('0x1')]={'name':{'type':Sequelize[_0x0345('0x2')]},'channel':{'type':Sequelize[_0x0345('0x2')]},'description':{'type':Sequelize[_0x0345('0x2')]},'status':{'type':Sequelize[_0x0345('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 0ed937d..6900a1d 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 _0xa2f9=['then','destroy','get','sendStatus','error','name','send','map','Trigger','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','findOne','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x42f3da,_0x231369){var _0x34e76c=function(_0x3d911a){while(--_0x3d911a){_0x42f3da['push'](_0x42f3da['shift']());}};_0x34e76c(++_0x231369);}(_0xa2f9,0x19a));var _0x9a2f=function(_0x113a7b,_0x3d8bae){_0x113a7b=_0x113a7b-0x0;var _0xa6fedf=_0xa2f9[_0x113a7b];return _0xa6fedf;};'use strict';var emlformat=require(_0x9a2f('0x0'));var rimraf=require(_0x9a2f('0x1'));var zipdir=require(_0x9a2f('0x2'));var jsonpatch=require(_0x9a2f('0x3'));var rp=require(_0x9a2f('0x4'));var moment=require('moment');var BPromise=require(_0x9a2f('0x5'));var Mustache=require(_0x9a2f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9a2f('0x7'));var csv=require(_0x9a2f('0x8'));var ejs=require(_0x9a2f('0x9'));var fs=require('fs');var fs_extra=require(_0x9a2f('0xa'));var _=require('lodash');var squel=require(_0x9a2f('0xb'));var crypto=require(_0x9a2f('0xc'));var jsforce=require(_0x9a2f('0xd'));var deskjs=require(_0x9a2f('0xe'));var toCsv=require(_0x9a2f('0x8'));var querystring=require(_0x9a2f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a2f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a2f('0x11'));var logger=require(_0x9a2f('0x12'))(_0x9a2f('0x13'));var utils=require(_0x9a2f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a2f('0x15'));var db=require(_0x9a2f('0x16'))['db'];function respondWithStatusCode(_0x575b7d,_0x47c775){_0x47c775=_0x47c775||0xcc;return function(_0x643233){if(_0x643233){return _0x575b7d['sendStatus'](_0x47c775);}return _0x575b7d[_0x9a2f('0x17')](_0x47c775)[_0x9a2f('0x18')]();};}function respondWithResult(_0x12a6f1,_0x25df8e){_0x25df8e=_0x25df8e||0xc8;return function(_0xac0a02){if(_0xac0a02){return _0x12a6f1[_0x9a2f('0x17')](_0x25df8e)[_0x9a2f('0x19')](_0xac0a02);}};}function respondWithFilteredResult(_0x16934b,_0x5ce846){return function(_0x46cae8){if(_0x46cae8){var _0x121eff=typeof _0x5ce846[_0x9a2f('0x1a')]===_0x9a2f('0x1b')&&typeof _0x5ce846[_0x9a2f('0x1c')]===_0x9a2f('0x1b');var _0x3ad8f5=_0x46cae8['count'];var _0x487881=_0x121eff?0x0:_0x5ce846[_0x9a2f('0x1a')];var _0x3e12ea=_0x121eff?_0x46cae8[_0x9a2f('0x1d')]:_0x5ce846[_0x9a2f('0x1a')]+_0x5ce846[_0x9a2f('0x1c')];var _0x1bad41;if(_0x3e12ea>=_0x3ad8f5){_0x3e12ea=_0x3ad8f5;_0x1bad41=0xc8;}else{_0x1bad41=0xce;}_0x16934b[_0x9a2f('0x17')](_0x1bad41);return _0x16934b[_0x9a2f('0x1e')](_0x9a2f('0x1f'),_0x487881+'-'+_0x3e12ea+'/'+_0x3ad8f5)[_0x9a2f('0x19')](_0x46cae8);}return null;};}function patchUpdates(_0x4b5a74){return function(_0x2939af){try{jsonpatch[_0x9a2f('0x20')](_0x2939af,_0x4b5a74,!![]);}catch(_0x2cf241){return BPromise['reject'](_0x2cf241);}return _0x2939af[_0x9a2f('0x21')]();};}function saveUpdates(_0x2e1c89,_0x586863){return function(_0xdd542d){if(_0xdd542d){return _0xdd542d[_0x9a2f('0x22')](_0x2e1c89)[_0x9a2f('0x23')](function(_0x2a60ca){return _0x2a60ca;});}return null;};}function removeEntity(_0x36f25a,_0x558873){return function(_0xa93297){if(_0xa93297){return _0xa93297[_0x9a2f('0x24')]()[_0x9a2f('0x23')](function(){var _0x390871=_0xa93297[_0x9a2f('0x25')]({'plain':!![]});var _0x218b96='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x218b96,'resourceId':_0x390871['id']}})[_0x9a2f('0x23')](function(){return _0xa93297;});})[_0x9a2f('0x23')](function(){_0x36f25a['status'](0xcc)[_0x9a2f('0x18')]();});}};}function handleEntityNotFound(_0x59f90c,_0x16cb14){return function(_0x1ced34){if(!_0x1ced34){_0x59f90c[_0x9a2f('0x26')](0x194);}return _0x1ced34;};}function handleError(_0x4a0447,_0x502c5a){_0x502c5a=_0x502c5a||0x1f4;return function(_0x446d69){logger[_0x9a2f('0x27')](_0x446d69['stack']);if(_0x446d69[_0x9a2f('0x28')]){delete _0x446d69[_0x9a2f('0x28')];}_0x4a0447['status'](_0x502c5a)[_0x9a2f('0x29')](_0x446d69);};}exports['index']=function(_0x2164d2,_0x4015b3){var _0x28f536={},_0x720a3={},_0x1415da={'count':0x0,'rows':[]};var _0x6d2255=_[_0x9a2f('0x2a')](db[_0x9a2f('0x2b')][_0x9a2f('0x2c')],function(_0x202fa9){return{'name':_0x202fa9['fieldName'],'type':_0x202fa9['type'][_0x9a2f('0x2d')]};});_0x720a3[_0x9a2f('0x2e')]=_['map'](_0x6d2255,_0x9a2f('0x28'));_0x720a3[_0x9a2f('0x2f')]=_[_0x9a2f('0x30')](_0x2164d2[_0x9a2f('0x2f')]);_0x720a3[_0x9a2f('0x31')]=_[_0x9a2f('0x32')](_0x720a3['model'],_0x720a3[_0x9a2f('0x2f')]);_0x28f536[_0x9a2f('0x33')]=_[_0x9a2f('0x32')](_0x720a3[_0x9a2f('0x2e')],qs['fields'](_0x2164d2[_0x9a2f('0x2f')]['fields']));_0x28f536['attributes']=_0x28f536[_0x9a2f('0x33')][_0x9a2f('0x34')]?_0x28f536[_0x9a2f('0x33')]:_0x720a3[_0x9a2f('0x2e')];if(!_0x2164d2[_0x9a2f('0x2f')][_0x9a2f('0x35')]('nolimit')){_0x28f536[_0x9a2f('0x1c')]=qs[_0x9a2f('0x1c')](_0x2164d2[_0x9a2f('0x2f')][_0x9a2f('0x1c')]);_0x28f536[_0x9a2f('0x1a')]=qs[_0x9a2f('0x1a')](_0x2164d2[_0x9a2f('0x2f')][_0x9a2f('0x1a')]);}_0x28f536[_0x9a2f('0x36')]=qs[_0x9a2f('0x37')](_0x2164d2[_0x9a2f('0x2f')][_0x9a2f('0x37')]);_0x28f536[_0x9a2f('0x38')]=qs[_0x9a2f('0x31')](_[_0x9a2f('0x39')](_0x2164d2['query'],_0x720a3[_0x9a2f('0x31')]),_0x6d2255);if(_0x2164d2['query']['filter']){_0x28f536[_0x9a2f('0x38')]=_['merge'](_0x28f536['where'],{'$or':_[_0x9a2f('0x2a')](_0x6d2255,function(_0x33b83c){if(_0x33b83c['type']!==_0x9a2f('0x3a')){var _0x31d47c={};_0x31d47c[_0x33b83c[_0x9a2f('0x28')]]={'$like':'%'+_0x2164d2[_0x9a2f('0x2f')][_0x9a2f('0x3b')]+'%'};return _0x31d47c;}})});}_0x28f536=_[_0x9a2f('0x3c')]({},_0x28f536,_0x2164d2['options']);var _0x25dd3f={'where':_0x28f536[_0x9a2f('0x38')]};return db[_0x9a2f('0x2b')]['count'](_0x25dd3f)[_0x9a2f('0x23')](function(_0x49cdab){_0x1415da[_0x9a2f('0x1d')]=_0x49cdab;if(_0x2164d2[_0x9a2f('0x2f')][_0x9a2f('0x3d')]){_0x28f536[_0x9a2f('0x3e')]=[{'all':!![]}];}return db[_0x9a2f('0x2b')][_0x9a2f('0x3f')](_0x28f536);})['then'](function(_0x40ce35){_0x1415da[_0x9a2f('0x40')]=_0x40ce35;return _0x1415da;})[_0x9a2f('0x23')](respondWithFilteredResult(_0x4015b3,_0x28f536))[_0x9a2f('0x41')](handleError(_0x4015b3,null));};exports[_0x9a2f('0x42')]=function(_0x312e7d,_0x1fe066){var _0x1337f9={'raw':![],'where':{'id':_0x312e7d[_0x9a2f('0x43')]['id']}},_0x4e1a81={};_0x4e1a81[_0x9a2f('0x2e')]=_[_0x9a2f('0x30')](db[_0x9a2f('0x2b')][_0x9a2f('0x2c')]);_0x4e1a81['query']=_[_0x9a2f('0x30')](_0x312e7d['query']);_0x4e1a81['filters']=_[_0x9a2f('0x32')](_0x4e1a81[_0x9a2f('0x2e')],_0x4e1a81[_0x9a2f('0x2f')]);_0x1337f9['attributes']=_['intersection'](_0x4e1a81[_0x9a2f('0x2e')],qs['fields'](_0x312e7d['query'][_0x9a2f('0x44')]));_0x1337f9[_0x9a2f('0x33')]=_0x1337f9[_0x9a2f('0x33')][_0x9a2f('0x34')]?_0x1337f9[_0x9a2f('0x33')]:_0x4e1a81[_0x9a2f('0x2e')];if(_0x312e7d['query'][_0x9a2f('0x3d')]){_0x1337f9[_0x9a2f('0x3e')]=[{'all':!![]}];}_0x1337f9=_[_0x9a2f('0x3c')]({},_0x1337f9,_0x312e7d[_0x9a2f('0x45')]);return db[_0x9a2f('0x2b')][_0x9a2f('0x46')](_0x1337f9)[_0x9a2f('0x23')](handleEntityNotFound(_0x1fe066,null))[_0x9a2f('0x23')](respondWithResult(_0x1fe066,null))[_0x9a2f('0x41')](handleError(_0x1fe066,null));};exports['create']=function(_0x2f3245,_0x49d7a8){return db[_0x9a2f('0x2b')][_0x9a2f('0x47')](_0x2f3245['body'],{})[_0x9a2f('0x23')](function(_0x573f72){var _0x3a2039=_0x2f3245[_0x9a2f('0x48')]['get']({'plain':!![]});if(!_0x3a2039)throw new Error(_0x9a2f('0x49'));if(_0x3a2039[_0x9a2f('0x4a')]==='user'){var _0x45af0c=_0x573f72['get']({'plain':!![]});var _0x268b4b='Triggers';return db['UserProfileSection'][_0x9a2f('0x46')]({'where':{'name':_0x268b4b,'userProfileId':_0x3a2039['userProfileId']},'raw':!![]})['then'](function(_0x43eec0){if(_0x43eec0&&_0x43eec0['autoAssociation']===0x0){return db[_0x9a2f('0x4b')][_0x9a2f('0x47')]({'name':_0x45af0c['name'],'resourceId':_0x45af0c['id'],'type':_0x43eec0[_0x9a2f('0x28')],'sectionId':_0x43eec0['id']},{})[_0x9a2f('0x23')](function(){return _0x573f72;});}else{return _0x573f72;}})[_0x9a2f('0x41')](function(_0x2b8bdd){logger[_0x9a2f('0x27')](_0x9a2f('0x4c'),_0x2b8bdd);throw _0x2b8bdd;});}return _0x573f72;})['then'](respondWithResult(_0x49d7a8,0xc9))['catch'](handleError(_0x49d7a8,null));};exports['update']=function(_0xf0b3ae,_0xba0be2){if(_0xf0b3ae[_0x9a2f('0x4d')]['id']){delete _0xf0b3ae['body']['id'];}return db[_0x9a2f('0x2b')][_0x9a2f('0x46')]({'where':{'id':_0xf0b3ae[_0x9a2f('0x43')]['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0xba0be2,null))[_0x9a2f('0x23')](saveUpdates(_0xf0b3ae['body'],null))[_0x9a2f('0x23')](respondWithResult(_0xba0be2,null))[_0x9a2f('0x41')](handleError(_0xba0be2,null));};exports[_0x9a2f('0x24')]=function(_0x3fe3c3,_0x978ba4){return db[_0x9a2f('0x2b')]['find']({'where':{'id':_0x3fe3c3['params']['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0x978ba4,null))[_0x9a2f('0x23')](removeEntity(_0x978ba4,null))[_0x9a2f('0x41')](handleError(_0x978ba4,null));};exports[_0x9a2f('0x4e')]=function(_0x2dacad,_0x4e6588,_0x5c7450){if(_0x2dacad['body']['id']){delete _0x2dacad[_0x9a2f('0x4d')]['id'];}return db[_0x9a2f('0x2b')]['find']({'where':{'id':_0x2dacad[_0x9a2f('0x43')]['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0x4e6588,null))[_0x9a2f('0x23')](function(_0x3f9a07){if(_0x3f9a07){_0x2dacad['body']['TriggerAllId']=_0x3f9a07['id'];return db[_0x9a2f('0x4f')][_0x9a2f('0x47')](_0x2dacad[_0x9a2f('0x4d')]);}})[_0x9a2f('0x23')](respondWithResult(_0x4e6588,null))[_0x9a2f('0x41')](handleError(_0x4e6588,null));};exports[_0x9a2f('0x50')]=function(_0x54c9b7,_0x19c9f8,_0x708dfc){if(_0x54c9b7[_0x9a2f('0x4d')]['id']){delete _0x54c9b7[_0x9a2f('0x4d')]['id'];}return db['Trigger'][_0x9a2f('0x46')]({'where':{'id':_0x54c9b7[_0x9a2f('0x43')]['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0x19c9f8,null))[_0x9a2f('0x23')](function(_0xe0dd4a){if(_0xe0dd4a){_0x54c9b7['body']['TriggerAnyId']=_0xe0dd4a['id'];return db[_0x9a2f('0x4f')][_0x9a2f('0x47')](_0x54c9b7[_0x9a2f('0x4d')]);}})[_0x9a2f('0x23')](respondWithResult(_0x19c9f8,null))[_0x9a2f('0x41')](handleError(_0x19c9f8,null));};exports['getAllConditions']=function(_0x5329fb,_0x5c8ce0,_0x50633d){var _0x1a33d7={};var _0x2dc837={};var _0x148561;var _0x523408;return db[_0x9a2f('0x2b')][_0x9a2f('0x51')]({'where':{'id':_0x5329fb[_0x9a2f('0x43')]['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0x5c8ce0,null))['then'](function(_0x8ed036){if(_0x8ed036){_0x148561=_0x8ed036;_0x2dc837[_0x9a2f('0x2e')]=_[_0x9a2f('0x30')](db[_0x9a2f('0x4f')]['rawAttributes']);_0x2dc837[_0x9a2f('0x2f')]=_['keys'](_0x5329fb['query']);_0x2dc837[_0x9a2f('0x31')]=_[_0x9a2f('0x32')](_0x2dc837['model'],_0x2dc837[_0x9a2f('0x2f')]);_0x1a33d7[_0x9a2f('0x33')]=_[_0x9a2f('0x32')](_0x2dc837[_0x9a2f('0x2e')],qs['fields'](_0x5329fb[_0x9a2f('0x2f')][_0x9a2f('0x44')]));_0x1a33d7[_0x9a2f('0x33')]=_0x1a33d7['attributes']['length']?_0x1a33d7[_0x9a2f('0x33')]:_0x2dc837[_0x9a2f('0x2e')];_0x1a33d7[_0x9a2f('0x36')]=qs[_0x9a2f('0x37')](_0x5329fb[_0x9a2f('0x2f')][_0x9a2f('0x37')]);_0x1a33d7['where']=qs['filters'](_['pick'](_0x5329fb[_0x9a2f('0x2f')],_0x2dc837[_0x9a2f('0x31')]));if(_0x5329fb['query']['filter']){_0x1a33d7[_0x9a2f('0x38')]=_['merge'](_0x1a33d7[_0x9a2f('0x38')],{'$or':_['map'](_0x1a33d7[_0x9a2f('0x33')],function(_0x14b335){var _0x51d0a1={};_0x51d0a1[_0x14b335]={'$like':'%'+_0x5329fb[_0x9a2f('0x2f')][_0x9a2f('0x3b')]+'%'};return _0x51d0a1;})});}_0x1a33d7=_[_0x9a2f('0x3c')]({},_0x1a33d7,_0x5329fb[_0x9a2f('0x45')]);return _0x148561['getAllConditions'](_0x1a33d7);}})[_0x9a2f('0x23')](function(_0x27a42e){if(_0x27a42e){_0x523408=_0x27a42e['length'];if(!_0x5329fb[_0x9a2f('0x2f')]['hasOwnProperty']('nolimit')){_0x1a33d7['limit']=qs[_0x9a2f('0x1c')](_0x5329fb[_0x9a2f('0x2f')][_0x9a2f('0x1c')]);_0x1a33d7[_0x9a2f('0x1a')]=qs[_0x9a2f('0x1a')](_0x5329fb[_0x9a2f('0x2f')]['offset']);}return _0x148561[_0x9a2f('0x52')](_0x1a33d7);}})['then'](function(_0x3e83a0){if(_0x3e83a0){return _0x3e83a0?{'count':_0x523408,'rows':_0x3e83a0}:null;}})[_0x9a2f('0x23')](respondWithResult(_0x5c8ce0,null))[_0x9a2f('0x41')](handleError(_0x5c8ce0,null));};exports['getAnyConditions']=function(_0x102635,_0x265c91,_0x505822){var _0x386327={};var _0x1790f3={};var _0x5dea66;var _0x1d7916;return db['Trigger'][_0x9a2f('0x51')]({'where':{'id':_0x102635[_0x9a2f('0x43')]['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0x265c91,null))[_0x9a2f('0x23')](function(_0x47906c){if(_0x47906c){_0x5dea66=_0x47906c;_0x1790f3['model']=_['keys'](db[_0x9a2f('0x4f')]['rawAttributes']);_0x1790f3[_0x9a2f('0x2f')]=_['keys'](_0x102635[_0x9a2f('0x2f')]);_0x1790f3['filters']=_[_0x9a2f('0x32')](_0x1790f3[_0x9a2f('0x2e')],_0x1790f3['query']);_0x386327[_0x9a2f('0x33')]=_['intersection'](_0x1790f3[_0x9a2f('0x2e')],qs['fields'](_0x102635['query']['fields']));_0x386327[_0x9a2f('0x33')]=_0x386327[_0x9a2f('0x33')]['length']?_0x386327[_0x9a2f('0x33')]:_0x1790f3[_0x9a2f('0x2e')];_0x386327[_0x9a2f('0x36')]=qs[_0x9a2f('0x37')](_0x102635[_0x9a2f('0x2f')][_0x9a2f('0x37')]);_0x386327[_0x9a2f('0x38')]=qs['filters'](_[_0x9a2f('0x39')](_0x102635[_0x9a2f('0x2f')],_0x1790f3[_0x9a2f('0x31')]));if(_0x102635[_0x9a2f('0x2f')][_0x9a2f('0x3b')]){_0x386327['where']=_[_0x9a2f('0x3c')](_0x386327[_0x9a2f('0x38')],{'$or':_['map'](_0x386327[_0x9a2f('0x33')],function(_0x4166b5){var _0x2f7ece={};_0x2f7ece[_0x4166b5]={'$like':'%'+_0x102635['query'][_0x9a2f('0x3b')]+'%'};return _0x2f7ece;})});}_0x386327=_[_0x9a2f('0x3c')]({},_0x386327,_0x102635[_0x9a2f('0x45')]);return _0x5dea66['getAnyConditions'](_0x386327);}})[_0x9a2f('0x23')](function(_0x459147){if(_0x459147){_0x1d7916=_0x459147[_0x9a2f('0x34')];if(!_0x102635[_0x9a2f('0x2f')][_0x9a2f('0x35')](_0x9a2f('0x53'))){_0x386327[_0x9a2f('0x1c')]=qs[_0x9a2f('0x1c')](_0x102635[_0x9a2f('0x2f')][_0x9a2f('0x1c')]);_0x386327[_0x9a2f('0x1a')]=qs[_0x9a2f('0x1a')](_0x102635[_0x9a2f('0x2f')][_0x9a2f('0x1a')]);}return _0x5dea66[_0x9a2f('0x54')](_0x386327);}})[_0x9a2f('0x23')](function(_0x43e33e){if(_0x43e33e){return _0x43e33e?{'count':_0x1d7916,'rows':_0x43e33e}:null;}})[_0x9a2f('0x23')](respondWithResult(_0x265c91,null))[_0x9a2f('0x41')](handleError(_0x265c91,null));};exports[_0x9a2f('0x55')]=function(_0x140efb,_0x4fa7a9,_0x2f0a3f){if(_0x140efb['body']['id']){delete _0x140efb[_0x9a2f('0x4d')]['id'];}return db[_0x9a2f('0x2b')]['find']({'where':{'id':_0x140efb[_0x9a2f('0x43')]['id']}})[_0x9a2f('0x23')](handleEntityNotFound(_0x4fa7a9,null))[_0x9a2f('0x23')](function(_0x686341){if(_0x686341){_0x140efb[_0x9a2f('0x4d')][_0x9a2f('0x56')]=_0x686341['id'];return db[_0x9a2f('0x57')]['create'](_0x140efb['body']);}})[_0x9a2f('0x23')](respondWithResult(_0x4fa7a9,null))['catch'](handleError(_0x4fa7a9,null));};exports[_0x9a2f('0x58')]=function(_0x2c5ad1,_0xb5c297,_0xcb47ae){var _0x4a5c45={};var _0x507310={};var _0xb34046;var _0x2c412e;return db[_0x9a2f('0x2b')][_0x9a2f('0x51')]({'where':{'id':_0x2c5ad1['params']['id']}})['then'](handleEntityNotFound(_0xb5c297,null))[_0x9a2f('0x23')](function(_0x33e301){if(_0x33e301){_0xb34046=_0x33e301;_0x507310['model']=_[_0x9a2f('0x30')](db['Action'][_0x9a2f('0x2c')]);_0x507310[_0x9a2f('0x2f')]=_['keys'](_0x2c5ad1[_0x9a2f('0x2f')]);_0x507310[_0x9a2f('0x31')]=_[_0x9a2f('0x32')](_0x507310[_0x9a2f('0x2e')],_0x507310['query']);_0x4a5c45[_0x9a2f('0x33')]=_[_0x9a2f('0x32')](_0x507310[_0x9a2f('0x2e')],qs[_0x9a2f('0x44')](_0x2c5ad1[_0x9a2f('0x2f')][_0x9a2f('0x44')]));_0x4a5c45[_0x9a2f('0x33')]=_0x4a5c45['attributes'][_0x9a2f('0x34')]?_0x4a5c45[_0x9a2f('0x33')]:_0x507310[_0x9a2f('0x2e')];_0x4a5c45[_0x9a2f('0x36')]=qs['sort'](_0x2c5ad1[_0x9a2f('0x2f')]['sort']);_0x4a5c45[_0x9a2f('0x38')]=qs['filters'](_[_0x9a2f('0x39')](_0x2c5ad1[_0x9a2f('0x2f')],_0x507310[_0x9a2f('0x31')]));if(_0x2c5ad1[_0x9a2f('0x2f')][_0x9a2f('0x3b')]){_0x4a5c45[_0x9a2f('0x38')]=_[_0x9a2f('0x3c')](_0x4a5c45['where'],{'$or':_[_0x9a2f('0x2a')](_0x4a5c45[_0x9a2f('0x33')],function(_0x1d764a){var _0x593a6b={};_0x593a6b[_0x1d764a]={'$like':'%'+_0x2c5ad1['query'][_0x9a2f('0x3b')]+'%'};return _0x593a6b;})});}_0x4a5c45=_[_0x9a2f('0x3c')]({},_0x4a5c45,_0x2c5ad1[_0x9a2f('0x45')]);return _0xb34046[_0x9a2f('0x58')](_0x4a5c45);}})[_0x9a2f('0x23')](function(_0x88b9ab){if(_0x88b9ab){_0x2c412e=_0x88b9ab[_0x9a2f('0x34')];if(!_0x2c5ad1['query'][_0x9a2f('0x35')](_0x9a2f('0x53'))){_0x4a5c45[_0x9a2f('0x1c')]=qs['limit'](_0x2c5ad1[_0x9a2f('0x2f')][_0x9a2f('0x1c')]);_0x4a5c45[_0x9a2f('0x1a')]=qs[_0x9a2f('0x1a')](_0x2c5ad1['query'][_0x9a2f('0x1a')]);}return _0xb34046[_0x9a2f('0x58')](_0x4a5c45);}})['then'](function(_0xdfc9a8){if(_0xdfc9a8){return _0xdfc9a8?{'count':_0x2c412e,'rows':_0xdfc9a8}:null;}})[_0x9a2f('0x23')](respondWithResult(_0xb5c297,null))[_0x9a2f('0x41')](handleError(_0xb5c297,null));}; \ No newline at end of file +var _0x408c=['then','destroy','get','Triggers','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Trigger','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','hasOwnProperty','getAnyConditions','addAction','getActions','Action','rimraf','request-promise','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update'];(function(_0x470170,_0x454483){var _0x2cc1cc=function(_0x212a4c){while(--_0x212a4c){_0x470170['push'](_0x470170['shift']());}};_0x2cc1cc(++_0x454483);}(_0x408c,0xf8));var _0xc408=function(_0x229a6b,_0x5e4a9a){_0x229a6b=_0x229a6b-0x0;var _0x5edf49=_0x408c[_0x229a6b];return _0x5edf49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc408('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc408('0x1'));var moment=require('moment');var BPromise=require(_0xc408('0x2'));var Mustache=require('mustache');var util=require(_0xc408('0x3'));var path=require('path');var sox=require(_0xc408('0x4'));var csv=require('to-csv');var ejs=require(_0xc408('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc408('0x6'));var crypto=require(_0xc408('0x7'));var jsforce=require(_0xc408('0x8'));var deskjs=require(_0xc408('0x9'));var toCsv=require(_0xc408('0xa'));var querystring=require(_0xc408('0xb'));var Papa=require(_0xc408('0xc'));var Redis=require(_0xc408('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc408('0xe'));var as=require(_0xc408('0xf'));var hardwareService=require(_0xc408('0x10'));var logger=require(_0xc408('0x11'))(_0xc408('0x12'));var utils=require(_0xc408('0x13'));var config=require(_0xc408('0x14'));var licenseUtil=require(_0xc408('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a0aa,_0x544441){_0x544441=_0x544441||0xcc;return function(_0x21b83a){if(_0x21b83a){return _0x18a0aa[_0xc408('0x16')](_0x544441);}return _0x18a0aa[_0xc408('0x17')](_0x544441)[_0xc408('0x18')]();};}function respondWithResult(_0x465284,_0x118374){_0x118374=_0x118374||0xc8;return function(_0x111203){if(_0x111203){return _0x465284[_0xc408('0x17')](_0x118374)[_0xc408('0x19')](_0x111203);}};}function respondWithFilteredResult(_0x4ee2e9,_0x5acbdd){return function(_0x178e9e){if(_0x178e9e){var _0xb941b6=typeof _0x5acbdd[_0xc408('0x1a')]===_0xc408('0x1b')&&typeof _0x5acbdd[_0xc408('0x1c')]==='undefined';var _0x57324f=_0x178e9e[_0xc408('0x1d')];var _0x91fab8=_0xb941b6?0x0:_0x5acbdd['offset'];var _0x2ea9c3=_0xb941b6?_0x178e9e[_0xc408('0x1d')]:_0x5acbdd[_0xc408('0x1a')]+_0x5acbdd[_0xc408('0x1c')];var _0x9e783b;if(_0x2ea9c3>=_0x57324f){_0x2ea9c3=_0x57324f;_0x9e783b=0xc8;}else{_0x9e783b=0xce;}_0x4ee2e9[_0xc408('0x17')](_0x9e783b);return _0x4ee2e9['set'](_0xc408('0x1e'),_0x91fab8+'-'+_0x2ea9c3+'/'+_0x57324f)['json'](_0x178e9e);}return null;};}function patchUpdates(_0xa9c0cd){return function(_0x54bd27){try{jsonpatch[_0xc408('0x1f')](_0x54bd27,_0xa9c0cd,!![]);}catch(_0x569eb9){return BPromise[_0xc408('0x20')](_0x569eb9);}return _0x54bd27['save']();};}function saveUpdates(_0x35f167,_0x522189){return function(_0x5bd662){if(_0x5bd662){return _0x5bd662[_0xc408('0x21')](_0x35f167)[_0xc408('0x22')](function(_0x4e7832){return _0x4e7832;});}return null;};}function removeEntity(_0x36e4b9,_0x2b41f8){return function(_0x3804b8){if(_0x3804b8){return _0x3804b8[_0xc408('0x23')]()[_0xc408('0x22')](function(){var _0x365fd7=_0x3804b8[_0xc408('0x24')]({'plain':!![]});var _0x384487=_0xc408('0x25');return db[_0xc408('0x26')]['destroy']({'where':{'type':_0x384487,'resourceId':_0x365fd7['id']}})[_0xc408('0x22')](function(){return _0x3804b8;});})['then'](function(){_0x36e4b9[_0xc408('0x17')](0xcc)[_0xc408('0x18')]();});}};}function handleEntityNotFound(_0x533fa9,_0x5de54c){return function(_0x433eaf){if(!_0x433eaf){_0x533fa9[_0xc408('0x16')](0x194);}return _0x433eaf;};}function handleError(_0x597eda,_0x4e9c9d){_0x4e9c9d=_0x4e9c9d||0x1f4;return function(_0x1219f6){logger['error'](_0x1219f6[_0xc408('0x27')]);if(_0x1219f6['name']){delete _0x1219f6[_0xc408('0x28')];}_0x597eda[_0xc408('0x17')](_0x4e9c9d)['send'](_0x1219f6);};}exports[_0xc408('0x29')]=function(_0x4c0fde,_0xf46ab){var _0x3e89ac={},_0x3e3393={},_0x4c72fe={'count':0x0,'rows':[]};var _0x48b0fb=_['map'](db['Trigger'][_0xc408('0x2a')],function(_0x27ce76){return{'name':_0x27ce76[_0xc408('0x2b')],'type':_0x27ce76[_0xc408('0x2c')]['key']};});_0x3e3393[_0xc408('0x2d')]=_['map'](_0x48b0fb,'name');_0x3e3393[_0xc408('0x2e')]=_[_0xc408('0x2f')](_0x4c0fde[_0xc408('0x2e')]);_0x3e3393[_0xc408('0x30')]=_['intersection'](_0x3e3393[_0xc408('0x2d')],_0x3e3393['query']);_0x3e89ac[_0xc408('0x31')]=_['intersection'](_0x3e3393[_0xc408('0x2d')],qs['fields'](_0x4c0fde[_0xc408('0x2e')][_0xc408('0x32')]));_0x3e89ac[_0xc408('0x31')]=_0x3e89ac[_0xc408('0x31')][_0xc408('0x33')]?_0x3e89ac[_0xc408('0x31')]:_0x3e3393[_0xc408('0x2d')];if(!_0x4c0fde[_0xc408('0x2e')]['hasOwnProperty'](_0xc408('0x34'))){_0x3e89ac['limit']=qs[_0xc408('0x1c')](_0x4c0fde[_0xc408('0x2e')][_0xc408('0x1c')]);_0x3e89ac['offset']=qs[_0xc408('0x1a')](_0x4c0fde[_0xc408('0x2e')]['offset']);}_0x3e89ac[_0xc408('0x35')]=qs[_0xc408('0x36')](_0x4c0fde[_0xc408('0x2e')]['sort']);_0x3e89ac[_0xc408('0x37')]=qs['filters'](_['pick'](_0x4c0fde[_0xc408('0x2e')],_0x3e3393[_0xc408('0x30')]),_0x48b0fb);if(_0x4c0fde[_0xc408('0x2e')][_0xc408('0x38')]){_0x3e89ac[_0xc408('0x37')]=_[_0xc408('0x39')](_0x3e89ac[_0xc408('0x37')],{'$or':_[_0xc408('0x3a')](_0x48b0fb,function(_0x1b8dc2){if(_0x1b8dc2[_0xc408('0x2c')]!==_0xc408('0x3b')){var _0x5f726f={};_0x5f726f[_0x1b8dc2[_0xc408('0x28')]]={'$like':'%'+_0x4c0fde[_0xc408('0x2e')]['filter']+'%'};return _0x5f726f;}})});}_0x3e89ac=_[_0xc408('0x39')]({},_0x3e89ac,_0x4c0fde[_0xc408('0x3c')]);var _0x1fcc08={'where':_0x3e89ac[_0xc408('0x37')]};return db[_0xc408('0x3d')][_0xc408('0x1d')](_0x1fcc08)[_0xc408('0x22')](function(_0x19af47){_0x4c72fe[_0xc408('0x1d')]=_0x19af47;if(_0x4c0fde[_0xc408('0x2e')]['includeAll']){_0x3e89ac[_0xc408('0x3e')]=[{'all':!![]}];}return db[_0xc408('0x3d')][_0xc408('0x3f')](_0x3e89ac);})['then'](function(_0x4d8efc){_0x4c72fe[_0xc408('0x40')]=_0x4d8efc;return _0x4c72fe;})[_0xc408('0x22')](respondWithFilteredResult(_0xf46ab,_0x3e89ac))[_0xc408('0x41')](handleError(_0xf46ab,null));};exports[_0xc408('0x42')]=function(_0x40849b,_0x319361){var _0x470c9b={'raw':![],'where':{'id':_0x40849b[_0xc408('0x43')]['id']}},_0x2c6e34={};_0x2c6e34[_0xc408('0x2d')]=_[_0xc408('0x2f')](db[_0xc408('0x3d')][_0xc408('0x2a')]);_0x2c6e34['query']=_[_0xc408('0x2f')](_0x40849b[_0xc408('0x2e')]);_0x2c6e34[_0xc408('0x30')]=_[_0xc408('0x44')](_0x2c6e34['model'],_0x2c6e34[_0xc408('0x2e')]);_0x470c9b[_0xc408('0x31')]=_[_0xc408('0x44')](_0x2c6e34[_0xc408('0x2d')],qs[_0xc408('0x32')](_0x40849b['query'][_0xc408('0x32')]));_0x470c9b[_0xc408('0x31')]=_0x470c9b[_0xc408('0x31')][_0xc408('0x33')]?_0x470c9b['attributes']:_0x2c6e34[_0xc408('0x2d')];if(_0x40849b[_0xc408('0x2e')][_0xc408('0x45')]){_0x470c9b[_0xc408('0x3e')]=[{'all':!![]}];}_0x470c9b=_[_0xc408('0x39')]({},_0x470c9b,_0x40849b[_0xc408('0x3c')]);return db[_0xc408('0x3d')][_0xc408('0x46')](_0x470c9b)[_0xc408('0x22')](handleEntityNotFound(_0x319361,null))[_0xc408('0x22')](respondWithResult(_0x319361,null))[_0xc408('0x41')](handleError(_0x319361,null));};exports[_0xc408('0x47')]=function(_0x37e1ec,_0x2f7f52){return db[_0xc408('0x3d')][_0xc408('0x47')](_0x37e1ec[_0xc408('0x48')],{})[_0xc408('0x22')](function(_0x185305){var _0x45552c=_0x37e1ec[_0xc408('0x49')]['get']({'plain':!![]});if(!_0x45552c)throw new Error(_0xc408('0x4a'));if(_0x45552c[_0xc408('0x4b')]===_0xc408('0x49')){var _0x4252cf=_0x185305[_0xc408('0x24')]({'plain':!![]});var _0x4d3d5b=_0xc408('0x25');return db[_0xc408('0x4c')][_0xc408('0x46')]({'where':{'name':_0x4d3d5b,'userProfileId':_0x45552c[_0xc408('0x4d')]},'raw':!![]})[_0xc408('0x22')](function(_0x1e0e3f){if(_0x1e0e3f&&_0x1e0e3f[_0xc408('0x4e')]===0x0){return db[_0xc408('0x26')][_0xc408('0x47')]({'name':_0x4252cf['name'],'resourceId':_0x4252cf['id'],'type':_0x1e0e3f[_0xc408('0x28')],'sectionId':_0x1e0e3f['id']},{})[_0xc408('0x22')](function(){return _0x185305;});}else{return _0x185305;}})[_0xc408('0x41')](function(_0x24e8e6){logger[_0xc408('0x4f')](_0xc408('0x50'),_0x24e8e6);throw _0x24e8e6;});}return _0x185305;})[_0xc408('0x22')](respondWithResult(_0x2f7f52,0xc9))[_0xc408('0x41')](handleError(_0x2f7f52,null));};exports['update']=function(_0x268520,_0x57b89c){if(_0x268520[_0xc408('0x48')]['id']){delete _0x268520[_0xc408('0x48')]['id'];}return db[_0xc408('0x3d')]['find']({'where':{'id':_0x268520[_0xc408('0x43')]['id']}})[_0xc408('0x22')](handleEntityNotFound(_0x57b89c,null))['then'](saveUpdates(_0x268520[_0xc408('0x48')],null))[_0xc408('0x22')](respondWithResult(_0x57b89c,null))[_0xc408('0x41')](handleError(_0x57b89c,null));};exports[_0xc408('0x23')]=function(_0x2424dc,_0x2ffce2){return db['Trigger'][_0xc408('0x46')]({'where':{'id':_0x2424dc[_0xc408('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ffce2,null))[_0xc408('0x22')](removeEntity(_0x2ffce2,null))['catch'](handleError(_0x2ffce2,null));};exports[_0xc408('0x51')]=function(_0x373d39,_0x697abd,_0x373142){if(_0x373d39[_0xc408('0x48')]['id']){delete _0x373d39[_0xc408('0x48')]['id'];}return db[_0xc408('0x3d')][_0xc408('0x46')]({'where':{'id':_0x373d39[_0xc408('0x43')]['id']}})[_0xc408('0x22')](handleEntityNotFound(_0x697abd,null))[_0xc408('0x22')](function(_0x233992){if(_0x233992){_0x373d39[_0xc408('0x48')][_0xc408('0x52')]=_0x233992['id'];return db[_0xc408('0x53')][_0xc408('0x47')](_0x373d39['body']);}})[_0xc408('0x22')](respondWithResult(_0x697abd,null))[_0xc408('0x41')](handleError(_0x697abd,null));};exports[_0xc408('0x54')]=function(_0x235e8b,_0x54459d,_0x522279){if(_0x235e8b[_0xc408('0x48')]['id']){delete _0x235e8b[_0xc408('0x48')]['id'];}return db[_0xc408('0x3d')][_0xc408('0x46')]({'where':{'id':_0x235e8b[_0xc408('0x43')]['id']}})[_0xc408('0x22')](handleEntityNotFound(_0x54459d,null))[_0xc408('0x22')](function(_0xac95b1){if(_0xac95b1){_0x235e8b[_0xc408('0x48')][_0xc408('0x55')]=_0xac95b1['id'];return db[_0xc408('0x53')][_0xc408('0x47')](_0x235e8b[_0xc408('0x48')]);}})[_0xc408('0x22')](respondWithResult(_0x54459d,null))[_0xc408('0x41')](handleError(_0x54459d,null));};exports[_0xc408('0x56')]=function(_0x2f6d8c,_0xdfdf0d,_0x5e0b3f){var _0x504bde={};var _0x5380c0={};var _0x5fbbc5;var _0x2bc6a2;return db['Trigger'][_0xc408('0x57')]({'where':{'id':_0x2f6d8c[_0xc408('0x43')]['id']}})[_0xc408('0x22')](handleEntityNotFound(_0xdfdf0d,null))[_0xc408('0x22')](function(_0x36d2c2){if(_0x36d2c2){_0x5fbbc5=_0x36d2c2;_0x5380c0['model']=_[_0xc408('0x2f')](db[_0xc408('0x53')]['rawAttributes']);_0x5380c0[_0xc408('0x2e')]=_[_0xc408('0x2f')](_0x2f6d8c[_0xc408('0x2e')]);_0x5380c0[_0xc408('0x30')]=_[_0xc408('0x44')](_0x5380c0[_0xc408('0x2d')],_0x5380c0[_0xc408('0x2e')]);_0x504bde[_0xc408('0x31')]=_[_0xc408('0x44')](_0x5380c0['model'],qs['fields'](_0x2f6d8c['query'][_0xc408('0x32')]));_0x504bde[_0xc408('0x31')]=_0x504bde['attributes'][_0xc408('0x33')]?_0x504bde[_0xc408('0x31')]:_0x5380c0['model'];_0x504bde[_0xc408('0x35')]=qs[_0xc408('0x36')](_0x2f6d8c[_0xc408('0x2e')]['sort']);_0x504bde[_0xc408('0x37')]=qs['filters'](_[_0xc408('0x58')](_0x2f6d8c[_0xc408('0x2e')],_0x5380c0[_0xc408('0x30')]));if(_0x2f6d8c[_0xc408('0x2e')][_0xc408('0x38')]){_0x504bde[_0xc408('0x37')]=_['merge'](_0x504bde[_0xc408('0x37')],{'$or':_[_0xc408('0x3a')](_0x504bde[_0xc408('0x31')],function(_0x4f7081){var _0x147427={};_0x147427[_0x4f7081]={'$like':'%'+_0x2f6d8c['query']['filter']+'%'};return _0x147427;})});}_0x504bde=_['merge']({},_0x504bde,_0x2f6d8c[_0xc408('0x3c')]);return _0x5fbbc5[_0xc408('0x56')](_0x504bde);}})[_0xc408('0x22')](function(_0x2ba156){if(_0x2ba156){_0x2bc6a2=_0x2ba156[_0xc408('0x33')];if(!_0x2f6d8c[_0xc408('0x2e')][_0xc408('0x59')]('nolimit')){_0x504bde[_0xc408('0x1c')]=qs[_0xc408('0x1c')](_0x2f6d8c['query'][_0xc408('0x1c')]);_0x504bde[_0xc408('0x1a')]=qs['offset'](_0x2f6d8c[_0xc408('0x2e')][_0xc408('0x1a')]);}return _0x5fbbc5[_0xc408('0x56')](_0x504bde);}})[_0xc408('0x22')](function(_0x535913){if(_0x535913){return _0x535913?{'count':_0x2bc6a2,'rows':_0x535913}:null;}})[_0xc408('0x22')](respondWithResult(_0xdfdf0d,null))[_0xc408('0x41')](handleError(_0xdfdf0d,null));};exports['getAnyConditions']=function(_0x336b6f,_0x1cb33e,_0x45e7f7){var _0x5a7b31={};var _0x552862={};var _0x2ce352;var _0x4a27d1;return db[_0xc408('0x3d')][_0xc408('0x57')]({'where':{'id':_0x336b6f[_0xc408('0x43')]['id']}})['then'](handleEntityNotFound(_0x1cb33e,null))[_0xc408('0x22')](function(_0x3ec6e0){if(_0x3ec6e0){_0x2ce352=_0x3ec6e0;_0x552862[_0xc408('0x2d')]=_[_0xc408('0x2f')](db[_0xc408('0x53')]['rawAttributes']);_0x552862[_0xc408('0x2e')]=_[_0xc408('0x2f')](_0x336b6f['query']);_0x552862['filters']=_[_0xc408('0x44')](_0x552862[_0xc408('0x2d')],_0x552862[_0xc408('0x2e')]);_0x5a7b31[_0xc408('0x31')]=_[_0xc408('0x44')](_0x552862[_0xc408('0x2d')],qs['fields'](_0x336b6f[_0xc408('0x2e')][_0xc408('0x32')]));_0x5a7b31['attributes']=_0x5a7b31[_0xc408('0x31')]['length']?_0x5a7b31[_0xc408('0x31')]:_0x552862[_0xc408('0x2d')];_0x5a7b31['order']=qs[_0xc408('0x36')](_0x336b6f[_0xc408('0x2e')][_0xc408('0x36')]);_0x5a7b31[_0xc408('0x37')]=qs[_0xc408('0x30')](_[_0xc408('0x58')](_0x336b6f[_0xc408('0x2e')],_0x552862[_0xc408('0x30')]));if(_0x336b6f[_0xc408('0x2e')][_0xc408('0x38')]){_0x5a7b31['where']=_[_0xc408('0x39')](_0x5a7b31[_0xc408('0x37')],{'$or':_[_0xc408('0x3a')](_0x5a7b31[_0xc408('0x31')],function(_0x4e9b0d){var _0x37fdb7={};_0x37fdb7[_0x4e9b0d]={'$like':'%'+_0x336b6f[_0xc408('0x2e')]['filter']+'%'};return _0x37fdb7;})});}_0x5a7b31=_[_0xc408('0x39')]({},_0x5a7b31,_0x336b6f[_0xc408('0x3c')]);return _0x2ce352[_0xc408('0x5a')](_0x5a7b31);}})[_0xc408('0x22')](function(_0x488183){if(_0x488183){_0x4a27d1=_0x488183[_0xc408('0x33')];if(!_0x336b6f['query']['hasOwnProperty'](_0xc408('0x34'))){_0x5a7b31[_0xc408('0x1c')]=qs['limit'](_0x336b6f[_0xc408('0x2e')]['limit']);_0x5a7b31['offset']=qs[_0xc408('0x1a')](_0x336b6f[_0xc408('0x2e')][_0xc408('0x1a')]);}return _0x2ce352['getAnyConditions'](_0x5a7b31);}})[_0xc408('0x22')](function(_0x4bd287){if(_0x4bd287){return _0x4bd287?{'count':_0x4a27d1,'rows':_0x4bd287}:null;}})[_0xc408('0x22')](respondWithResult(_0x1cb33e,null))['catch'](handleError(_0x1cb33e,null));};exports[_0xc408('0x5b')]=function(_0x34cc3e,_0x5e0ecb,_0x4e3a34){if(_0x34cc3e['body']['id']){delete _0x34cc3e['body']['id'];}return db[_0xc408('0x3d')][_0xc408('0x46')]({'where':{'id':_0x34cc3e[_0xc408('0x43')]['id']}})[_0xc408('0x22')](handleEntityNotFound(_0x5e0ecb,null))[_0xc408('0x22')](function(_0x80bc91){if(_0x80bc91){_0x34cc3e['body']['TriggerId']=_0x80bc91['id'];return db['Action'][_0xc408('0x47')](_0x34cc3e[_0xc408('0x48')]);}})['then'](respondWithResult(_0x5e0ecb,null))[_0xc408('0x41')](handleError(_0x5e0ecb,null));};exports[_0xc408('0x5c')]=function(_0x39ab41,_0x56ac80,_0x4a0f9e){var _0x42ec82={};var _0x359f18={};var _0x5c0593;var _0x2953e6;return db[_0xc408('0x3d')]['findOne']({'where':{'id':_0x39ab41[_0xc408('0x43')]['id']}})[_0xc408('0x22')](handleEntityNotFound(_0x56ac80,null))[_0xc408('0x22')](function(_0x513808){if(_0x513808){_0x5c0593=_0x513808;_0x359f18['model']=_[_0xc408('0x2f')](db[_0xc408('0x5d')]['rawAttributes']);_0x359f18[_0xc408('0x2e')]=_['keys'](_0x39ab41['query']);_0x359f18[_0xc408('0x30')]=_[_0xc408('0x44')](_0x359f18[_0xc408('0x2d')],_0x359f18[_0xc408('0x2e')]);_0x42ec82[_0xc408('0x31')]=_[_0xc408('0x44')](_0x359f18[_0xc408('0x2d')],qs['fields'](_0x39ab41[_0xc408('0x2e')][_0xc408('0x32')]));_0x42ec82[_0xc408('0x31')]=_0x42ec82[_0xc408('0x31')][_0xc408('0x33')]?_0x42ec82[_0xc408('0x31')]:_0x359f18[_0xc408('0x2d')];_0x42ec82['order']=qs['sort'](_0x39ab41[_0xc408('0x2e')][_0xc408('0x36')]);_0x42ec82['where']=qs[_0xc408('0x30')](_['pick'](_0x39ab41[_0xc408('0x2e')],_0x359f18['filters']));if(_0x39ab41[_0xc408('0x2e')][_0xc408('0x38')]){_0x42ec82[_0xc408('0x37')]=_[_0xc408('0x39')](_0x42ec82[_0xc408('0x37')],{'$or':_[_0xc408('0x3a')](_0x42ec82[_0xc408('0x31')],function(_0x7bfe6){var _0xf55020={};_0xf55020[_0x7bfe6]={'$like':'%'+_0x39ab41['query'][_0xc408('0x38')]+'%'};return _0xf55020;})});}_0x42ec82=_[_0xc408('0x39')]({},_0x42ec82,_0x39ab41['options']);return _0x5c0593['getActions'](_0x42ec82);}})[_0xc408('0x22')](function(_0x2be4e7){if(_0x2be4e7){_0x2953e6=_0x2be4e7[_0xc408('0x33')];if(!_0x39ab41['query'][_0xc408('0x59')]('nolimit')){_0x42ec82['limit']=qs[_0xc408('0x1c')](_0x39ab41[_0xc408('0x2e')][_0xc408('0x1c')]);_0x42ec82[_0xc408('0x1a')]=qs[_0xc408('0x1a')](_0x39ab41['query'][_0xc408('0x1a')]);}return _0x5c0593[_0xc408('0x5c')](_0x42ec82);}})[_0xc408('0x22')](function(_0x261bea){if(_0x261bea){return _0x261bea?{'count':_0x2953e6,'rows':_0x261bea}:null;}})['then'](respondWithResult(_0x56ac80,null))[_0xc408('0x41')](handleError(_0x56ac80,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9ce0520..5f5804d 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 _0x1ee2=['../../config/logger','api','moment','request-promise','path','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x378f31,_0x5db48c){var _0x135bbc=function(_0x50dfe1){while(--_0x50dfe1){_0x378f31['push'](_0x378f31['shift']());}};_0x135bbc(++_0x5db48c);}(_0x1ee2,0x11c));var _0x21ee=function(_0x1660ca,_0x488a5e){_0x1660ca=_0x1660ca-0x0;var _0x1c5686=_0x1ee2[_0x1660ca];return _0x1c5686;};'use strict';var _=require(_0x21ee('0x0'));var util=require(_0x21ee('0x1'));var logger=require(_0x21ee('0x2'))(_0x21ee('0x3'));var moment=require(_0x21ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x21ee('0x5'));var fs=require('fs');var path=require(_0x21ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21ee('0x7'));module[_0x21ee('0x8')]=function(_0x221a30,_0x20a492){return _0x221a30['define'](_0x21ee('0x9'),attributes,{'tableName':_0x21ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d4=['util','api','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x5e25b8,_0x19bd6f){var _0x123ce4=function(_0x501183){while(--_0x501183){_0x5e25b8['push'](_0x5e25b8['shift']());}};_0x123ce4(++_0x19bd6f);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xd1d4[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0x4d1d('0x0'));var util=require(_0x4d1d('0x1'));var logger=require('../../config/logger')(_0x4d1d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d1d('0x3'));var fs=require('fs');var path=require(_0x4d1d('0x4'));var rimraf=require(_0x4d1d('0x5'));var config=require(_0x4d1d('0x6'));var attributes=require(_0x4d1d('0x7'));module[_0x4d1d('0x8')]=function(_0x30466a,_0xb8a403){return _0x30466a[_0x4d1d('0x9')](_0x4d1d('0xa'),attributes,{'tableName':_0x4d1d('0xb'),'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 8de05cc..1dd3bd6 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 _0x1ccb=['find','raw','where','ShowTrigger','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrigger','findAll','options','attributes','limit','map','include','model','catch','Trigger'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1ccb,0x1d9));var _0xb1cc=function(_0x43ad2d,_0x2b03f7){_0x43ad2d=_0x43ad2d-0x0;var _0x3ade44=_0x1ccb[_0x43ad2d];return _0x3ade44;};'use strict';var _=require(_0xb1cc('0x0'));var util=require(_0xb1cc('0x1'));var moment=require(_0xb1cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1cc('0x3'));var fs=require('fs');var Redis=require(_0xb1cc('0x4'));var db=require(_0xb1cc('0x5'))['db'];var utils=require(_0xb1cc('0x6'));var logger=require(_0xb1cc('0x7'))(_0xb1cc('0x8'));var config=require(_0xb1cc('0x9'));var jayson=require(_0xb1cc('0xa'));var client=jayson[_0xb1cc('0xb')][_0xb1cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac6dc,_0x347a94,_0xbe394c){return new BPromise(function(_0x3c2c43,_0x2b3083){return client[_0xb1cc('0xd')](_0x2ac6dc,_0xbe394c)[_0xb1cc('0xe')](function(_0x32fe8f){logger[_0xb1cc('0xf')](_0xb1cc('0x10'),_0x347a94,_0xb1cc('0x11'));logger[_0xb1cc('0x12')](_0xb1cc('0x13'),_0x347a94,_0xb1cc('0x11'),JSON['stringify'](_0x32fe8f));if(_0x32fe8f['error']){if(_0x32fe8f[_0xb1cc('0x14')][_0xb1cc('0x15')]===0x1f4){logger[_0xb1cc('0x14')](_0xb1cc('0x10'),_0x347a94,_0x32fe8f['error'][_0xb1cc('0x16')]);return _0x2b3083(_0x32fe8f['error'][_0xb1cc('0x16')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x347a94,_0x32fe8f[_0xb1cc('0x14')][_0xb1cc('0x16')]);return _0x3c2c43(_0x32fe8f[_0xb1cc('0x14')][_0xb1cc('0x16')]);}else{logger[_0xb1cc('0xf')](_0xb1cc('0x10'),_0x347a94,_0xb1cc('0x11'));_0x3c2c43(_0x32fe8f[_0xb1cc('0x17')][_0xb1cc('0x16')]);}})['catch'](function(_0x20f4bd){logger[_0xb1cc('0x14')](_0xb1cc('0x10'),_0x347a94,_0x20f4bd);_0x2b3083(_0x20f4bd);});});}exports[_0xb1cc('0x18')]=function(_0x75a8ed){var _0x39989c=this;return new Promise(function(_0x2a2882,_0x587e7b){return db['Trigger'][_0xb1cc('0x19')]({'raw':_0x75a8ed[_0xb1cc('0x1a')]?_0x75a8ed['options']['raw']===undefined?!![]:![]:!![],'where':_0x75a8ed[_0xb1cc('0x1a')]?_0x75a8ed[_0xb1cc('0x1a')]['where']||null:null,'attributes':_0x75a8ed[_0xb1cc('0x1a')]?_0x75a8ed[_0xb1cc('0x1a')][_0xb1cc('0x1b')]||null:null,'limit':_0x75a8ed[_0xb1cc('0x1a')]?_0x75a8ed[_0xb1cc('0x1a')][_0xb1cc('0x1c')]||null:null,'include':_0x75a8ed[_0xb1cc('0x1a')]?_0x75a8ed['options']['include']?_[_0xb1cc('0x1d')](_0x75a8ed[_0xb1cc('0x1a')]['include'],function(_0x1cb6d5){return{'model':db[_0x1cb6d5['model']],'as':_0x1cb6d5['as'],'attributes':_0x1cb6d5[_0xb1cc('0x1b')],'include':_0x1cb6d5[_0xb1cc('0x1e')]?_[_0xb1cc('0x1d')](_0x1cb6d5['include'],function(_0x1c201c){return{'model':db[_0x1c201c[_0xb1cc('0x1f')]],'as':_0x1c201c['as'],'attributes':_0x1c201c[_0xb1cc('0x1b')],'include':_0x1c201c[_0xb1cc('0x1e')]?_[_0xb1cc('0x1d')](_0x1c201c[_0xb1cc('0x1e')],function(_0x4075e8){return{'model':db[_0x4075e8[_0xb1cc('0x1f')]],'as':_0x4075e8['as'],'attributes':_0x4075e8[_0xb1cc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7fac4f){logger['info'](_0xb1cc('0x18'),_0x75a8ed);logger['debug']('GetTrigger',_0x75a8ed,JSON['stringify'](_0x7fac4f));_0x2a2882(_0x7fac4f);})[_0xb1cc('0x20')](function(_0xdbf754){logger[_0xb1cc('0x14')](_0xb1cc('0x18'),_0xdbf754[_0xb1cc('0x16')],_0x75a8ed);_0x587e7b(_0x39989c['error'](0x1f4,_0xdbf754[_0xb1cc('0x16')]));});});};exports['ShowTrigger']=function(_0x17002d){var _0x362633=this;return new Promise(function(_0x20b503,_0x5d5e1a){return db[_0xb1cc('0x21')][_0xb1cc('0x22')]({'raw':_0x17002d[_0xb1cc('0x1a')]?_0x17002d[_0xb1cc('0x1a')][_0xb1cc('0x23')]===undefined?!![]:![]:!![],'where':_0x17002d[_0xb1cc('0x1a')]?_0x17002d[_0xb1cc('0x1a')][_0xb1cc('0x24')]||null:null,'attributes':_0x17002d[_0xb1cc('0x1a')]?_0x17002d[_0xb1cc('0x1a')][_0xb1cc('0x1b')]||null:null,'include':_0x17002d[_0xb1cc('0x1a')]?_0x17002d['options'][_0xb1cc('0x1e')]?_[_0xb1cc('0x1d')](_0x17002d[_0xb1cc('0x1a')][_0xb1cc('0x1e')],function(_0x3b70e3){return{'model':db[_0x3b70e3[_0xb1cc('0x1f')]],'as':_0x3b70e3['as'],'attributes':_0x3b70e3[_0xb1cc('0x1b')],'include':_0x3b70e3[_0xb1cc('0x1e')]?_[_0xb1cc('0x1d')](_0x3b70e3['include'],function(_0x16f125){return{'model':db[_0x16f125[_0xb1cc('0x1f')]],'as':_0x16f125['as'],'attributes':_0x16f125[_0xb1cc('0x1b')],'include':_0x16f125['include']?_[_0xb1cc('0x1d')](_0x16f125['include'],function(_0xeb7fb2){return{'model':db[_0xeb7fb2[_0xb1cc('0x1f')]],'as':_0xeb7fb2['as'],'attributes':_0xeb7fb2[_0xb1cc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x298a20){logger[_0xb1cc('0xf')](_0xb1cc('0x25'),_0x17002d);logger[_0xb1cc('0x12')]('ShowTrigger',_0x17002d,JSON[_0xb1cc('0x26')](_0x298a20));_0x20b503(_0x298a20);})['catch'](function(_0x4cf652){logger[_0xb1cc('0x14')](_0xb1cc('0x25'),_0x4cf652[_0xb1cc('0x16')],_0x17002d);_0x5d5e1a(_0x362633['error'](0x1f4,_0x4cf652['message']));});});}; \ No newline at end of file +var _0x8da5=['findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','GetTrigger','Trigger'];(function(_0x1f6b4b,_0x39b510){var _0x33156f=function(_0x411eae){while(--_0x411eae){_0x1f6b4b['push'](_0x1f6b4b['shift']());}};_0x33156f(++_0x39b510);}(_0x8da5,0xb5));var _0x58da=function(_0x57a777,_0x46d31a){_0x57a777=_0x57a777-0x0;var _0x2f7882=_0x8da5[_0x57a777];return _0x2f7882;};'use strict';var _=require(_0x58da('0x0'));var util=require(_0x58da('0x1'));var moment=require(_0x58da('0x2'));var BPromise=require('bluebird');var rs=require(_0x58da('0x3'));var fs=require('fs');var Redis=require(_0x58da('0x4'));var db=require(_0x58da('0x5'))['db'];var utils=require(_0x58da('0x6'));var logger=require(_0x58da('0x7'))(_0x58da('0x8'));var config=require(_0x58da('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2d1e,_0xb95875,_0x5bf9d4){return new BPromise(function(_0x528cb5,_0x353e93){return client[_0x58da('0xb')](_0x1e2d1e,_0x5bf9d4)[_0x58da('0xc')](function(_0x1fba8f){logger[_0x58da('0xd')](_0x58da('0xe'),_0xb95875,_0x58da('0xf'));logger[_0x58da('0x10')](_0x58da('0x11'),_0xb95875,'request\x20sent',JSON[_0x58da('0x12')](_0x1fba8f));if(_0x1fba8f[_0x58da('0x13')]){if(_0x1fba8f[_0x58da('0x13')]['code']===0x1f4){logger['error'](_0x58da('0xe'),_0xb95875,_0x1fba8f['error'][_0x58da('0x14')]);return _0x353e93(_0x1fba8f[_0x58da('0x13')][_0x58da('0x14')]);}logger['error'](_0x58da('0xe'),_0xb95875,_0x1fba8f[_0x58da('0x13')]['message']);return _0x528cb5(_0x1fba8f[_0x58da('0x13')][_0x58da('0x14')]);}else{logger[_0x58da('0xd')](_0x58da('0xe'),_0xb95875,'request\x20sent');_0x528cb5(_0x1fba8f['result'][_0x58da('0x14')]);}})['catch'](function(_0x353583){logger[_0x58da('0x13')](_0x58da('0xe'),_0xb95875,_0x353583);_0x353e93(_0x353583);});});}exports[_0x58da('0x15')]=function(_0x251741){var _0x5b6f12=this;return new Promise(function(_0x543f2a,_0x5def16){return db[_0x58da('0x16')][_0x58da('0x17')]({'raw':_0x251741[_0x58da('0x18')]?_0x251741[_0x58da('0x18')][_0x58da('0x19')]===undefined?!![]:![]:!![],'where':_0x251741[_0x58da('0x18')]?_0x251741[_0x58da('0x18')][_0x58da('0x1a')]||null:null,'attributes':_0x251741[_0x58da('0x18')]?_0x251741[_0x58da('0x18')][_0x58da('0x1b')]||null:null,'limit':_0x251741['options']?_0x251741[_0x58da('0x18')][_0x58da('0x1c')]||null:null,'include':_0x251741['options']?_0x251741[_0x58da('0x18')][_0x58da('0x1d')]?_[_0x58da('0x1e')](_0x251741[_0x58da('0x18')][_0x58da('0x1d')],function(_0x38360e){return{'model':db[_0x38360e[_0x58da('0x1f')]],'as':_0x38360e['as'],'attributes':_0x38360e[_0x58da('0x1b')],'include':_0x38360e['include']?_[_0x58da('0x1e')](_0x38360e['include'],function(_0x4a272e){return{'model':db[_0x4a272e[_0x58da('0x1f')]],'as':_0x4a272e['as'],'attributes':_0x4a272e['attributes'],'include':_0x4a272e[_0x58da('0x1d')]?_[_0x58da('0x1e')](_0x4a272e[_0x58da('0x1d')],function(_0x5cc923){return{'model':db[_0x5cc923[_0x58da('0x1f')]],'as':_0x5cc923['as'],'attributes':_0x5cc923[_0x58da('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x58da('0xc')](function(_0x4712d7){logger[_0x58da('0xd')](_0x58da('0x15'),_0x251741);logger[_0x58da('0x10')]('GetTrigger',_0x251741,JSON[_0x58da('0x12')](_0x4712d7));_0x543f2a(_0x4712d7);})[_0x58da('0x20')](function(_0x175d0f){logger[_0x58da('0x13')](_0x58da('0x15'),_0x175d0f[_0x58da('0x14')],_0x251741);_0x5def16(_0x5b6f12[_0x58da('0x13')](0x1f4,_0x175d0f[_0x58da('0x14')]));});});};exports[_0x58da('0x21')]=function(_0x470bb6){var _0x25838=this;return new Promise(function(_0x43e7b6,_0x353a4e){return db[_0x58da('0x16')]['find']({'raw':_0x470bb6[_0x58da('0x18')]?_0x470bb6[_0x58da('0x18')][_0x58da('0x19')]===undefined?!![]:![]:!![],'where':_0x470bb6[_0x58da('0x18')]?_0x470bb6[_0x58da('0x18')][_0x58da('0x1a')]||null:null,'attributes':_0x470bb6['options']?_0x470bb6['options'][_0x58da('0x1b')]||null:null,'include':_0x470bb6[_0x58da('0x18')]?_0x470bb6['options'][_0x58da('0x1d')]?_[_0x58da('0x1e')](_0x470bb6[_0x58da('0x18')][_0x58da('0x1d')],function(_0xca0d7e){return{'model':db[_0xca0d7e['model']],'as':_0xca0d7e['as'],'attributes':_0xca0d7e['attributes'],'include':_0xca0d7e['include']?_[_0x58da('0x1e')](_0xca0d7e[_0x58da('0x1d')],function(_0x1e4a1e){return{'model':db[_0x1e4a1e['model']],'as':_0x1e4a1e['as'],'attributes':_0x1e4a1e['attributes'],'include':_0x1e4a1e[_0x58da('0x1d')]?_['map'](_0x1e4a1e['include'],function(_0x156bff){return{'model':db[_0x156bff[_0x58da('0x1f')]],'as':_0x156bff['as'],'attributes':_0x156bff['attributes']};}):[]};}):[]};}):[]:[]})[_0x58da('0xc')](function(_0xd1ea67){logger[_0x58da('0xd')](_0x58da('0x21'),_0x470bb6);logger[_0x58da('0x10')](_0x58da('0x21'),_0x470bb6,JSON[_0x58da('0x12')](_0xd1ea67));_0x43e7b6(_0xd1ea67);})['catch'](function(_0x8f1a28){logger[_0x58da('0x13')](_0x58da('0x21'),_0x8f1a28[_0x58da('0x14')],_0x470bb6);_0x353a4e(_0x25838[_0x58da('0x13')](0x1f4,_0x8f1a28[_0x58da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ce91829..2b64d42 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 _0x9361=['clone','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','/:id/clone'];(function(_0x4f75c8,_0x4ef999){var _0x3e75ff=function(_0x32a9fe){while(--_0x32a9fe){_0x4f75c8['push'](_0x4f75c8['shift']());}};_0x3e75ff(++_0x4ef999);}(_0x9361,0x146));var _0x1936=function(_0x3f2a7d,_0x56b51d){_0x3f2a7d=_0x3f2a7d-0x0;var _0xce213d=_0x9361[_0x3f2a7d];return _0xce213d;};'use strict';var multer=require(_0x1936('0x0'));var util=require(_0x1936('0x1'));var path=require('path');var timeout=require(_0x1936('0x2'));var express=require(_0x1936('0x3'));var router=express[_0x1936('0x4')]();var fs_extra=require(_0x1936('0x5'));var auth=require(_0x1936('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1936('0x7'));var controller=require(_0x1936('0x8'));router[_0x1936('0x9')]('/',auth[_0x1936('0xa')](),controller[_0x1936('0xb')]);router[_0x1936('0x9')](_0x1936('0xc'),auth['isAuthenticated'](),controller['show']);router['post'](_0x1936('0xd'),auth['isAuthenticated'](),controller[_0x1936('0xe')]);router[_0x1936('0xf')]('/',auth['isAuthenticated'](),controller[_0x1936('0x10')]);router['put'](_0x1936('0xc'),auth[_0x1936('0xa')](),controller[_0x1936('0x11')]);router[_0x1936('0x12')](_0x1936('0xc'),auth[_0x1936('0xa')](),controller[_0x1936('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f95=['/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','index','/:id','isAuthenticated','post'];(function(_0x51c3ed,_0x550d79){var _0x54806b=function(_0x21ef80){while(--_0x21ef80){_0x51c3ed['push'](_0x51c3ed['shift']());}};_0x54806b(++_0x550d79);}(_0x0f95,0x92));var _0x50f9=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x0f95[_0x3fe042];return _0x7d4a1f;};'use strict';var multer=require(_0x50f9('0x0'));var util=require(_0x50f9('0x1'));var path=require(_0x50f9('0x2'));var timeout=require(_0x50f9('0x3'));var express=require(_0x50f9('0x4'));var router=express[_0x50f9('0x5')]();var fs_extra=require(_0x50f9('0x6'));var auth=require(_0x50f9('0x7'));var interaction=require(_0x50f9('0x8'));var config=require('../../config/environment');var controller=require(_0x50f9('0x9'));router[_0x50f9('0xa')]('/',auth['isAuthenticated'](),controller[_0x50f9('0xb')]);router[_0x50f9('0xa')](_0x50f9('0xc'),auth[_0x50f9('0xd')](),controller['show']);router[_0x50f9('0xe')](_0x50f9('0xf'),auth[_0x50f9('0xd')](),controller[_0x50f9('0x10')]);router['post']('/',auth[_0x50f9('0xd')](),controller[_0x50f9('0x11')]);router[_0x50f9('0x12')]('/:id',auth[_0x50f9('0xd')](),controller[_0x50f9('0x13')]);router[_0x50f9('0x14')](_0x50f9('0xc'),auth['isAuthenticated'](),controller[_0x50f9('0x15')]);module[_0x50f9('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 12ffd72..bc0618e 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 _0xcef6=['originate','uac','pai','fingerprint','certificate','active','passive','actpass','update,nonat','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept'];(function(_0x201d3e,_0x28f61a){var _0x36d221=function(_0x5e68f4){while(--_0x5e68f4){_0x201d3e['push'](_0x201d3e['shift']());}};_0x36d221(++_0x28f61a);}(_0xcef6,0x71));var _0x6cef=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xcef6[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require('sequelize');module[_0x6cef('0x0')]={'name':{'type':Sequelize[_0x6cef('0x1')],'allowNull':![],'unique':_0x6cef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x4'),_0x6cef('0x5'),_0x6cef('0x6')),'allowNull':![],'defaultValue':_0x6cef('0x4')},'context':{'type':Sequelize[_0x6cef('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x6cef('0x7'),_0x6cef('0x8'),_0x6cef('0x9'),_0x6cef('0xa'),_0x6cef('0xb'),_0x6cef('0xc'),_0x6cef('0xd'),_0x6cef('0xe'))},'deny':{'type':Sequelize[_0x6cef('0x1')]},'permit':{'type':Sequelize[_0x6cef('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x6cef('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x6cef('0xf'),'set':function(_0x51b074){this[_0x6cef('0x10')](_0x6cef('0x11'),_0x51b074?_0x51b074[_0x6cef('0x12')](','):null);},'get':function(){return this[_0x6cef('0x13')]('transport')?this['getDataValue']('transport')[_0x6cef('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x15'),_0x6cef('0x16'),_0x6cef('0x17'),_0x6cef('0x18'),'auto'),'defaultValue':_0x6cef('0x15')},'directmedia':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no','nonat',_0x6cef('0x1a'),_0x6cef('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6cef('0x1')]},'directmediadeny':{'type':Sequelize[_0x6cef('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x6cef('0x1c'),'set':function(_0x4bdda8){this[_0x6cef('0x10')](_0x6cef('0x1d'),_0x4bdda8?_0x4bdda8['join'](','):null);},'get':function(){return this[_0x6cef('0x13')](_0x6cef('0x1d'))?this[_0x6cef('0x13')]('nat')['split'](','):null;},'comment':_0x6cef('0x1e')},'callgroup':{'type':Sequelize[_0x6cef('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x6cef('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6cef('0x1')]},'language':{'type':Sequelize[_0x6cef('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6cef('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6cef('0x1')],'defaultValue':_0x6cef('0x1f')},'allow':{'type':Sequelize[_0x6cef('0x1')],'allowNull':![],'defaultValue':_0x6cef('0x20'),'set':function(_0x226d5d){this[_0x6cef('0x10')]('allow',_0x226d5d?_0x226d5d[_0x6cef('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x6cef('0x13')](_0x6cef('0x21'))?this[_0x6cef('0x13')]('allow')[_0x6cef('0x14')](';'):null;},'comment':_0x6cef('0x22')},'autoframing':{'type':Sequelize[_0x6cef('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x6cef('0x1')],'defaultValue':_0x6cef('0x23'),'set':function(_0x5cdeb2){this['setDataValue'](_0x6cef('0x24'),_0x5cdeb2?_0x5cdeb2[_0x6cef('0x12')](','):null);},'get':function(){return this[_0x6cef('0x13')](_0x6cef('0x24'))?this[_0x6cef('0x13')](_0x6cef('0x24'))[_0x6cef('0x14')](','):null;},'comment':_0x6cef('0x25')},'trustrpid':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6cef('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no',_0x6cef('0x26'))},'promiscredir':{'type':Sequelize[_0x6cef('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'accountcode':{'type':Sequelize[_0x6cef('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x6cef('0x28')},'amaflags':{'type':Sequelize[_0x6cef('0x1')]},'callcounter':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x6cef('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x6cef('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x6cef('0x1')]},'template':{'type':Sequelize[_0x6cef('0x1')]},'videosupport':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no',_0x6cef('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6cef('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'mailbox':{'type':Sequelize[_0x6cef('0x1')]},'session_timers':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x2a'),'refuse',_0x6cef('0x2b'))},'session_expires':{'type':Sequelize[_0x6cef('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x6cef('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x6cef('0x2c'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x6cef('0x1')]},'regexten':{'type':Sequelize[_0x6cef('0x1')]},'fromdomain':{'type':Sequelize[_0x6cef('0x1')]},'fromuser':{'type':Sequelize[_0x6cef('0x1')]},'port':{'type':Sequelize[_0x6cef('0x27')](0x5)},'qualify':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no'),'defaultValue':_0x6cef('0x19')},'keepalive':{'type':Sequelize[_0x6cef('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x6cef('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6cef('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6cef('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no',_0x6cef('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6cef('0x1')]},'callbackextension':{'type':Sequelize[_0x6cef('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x6cef('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x6cef('0x1')]},'contactdeny':{'type':Sequelize[_0x6cef('0x1')]},'contactacl':{'type':Sequelize[_0x6cef('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6cef('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6cef('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no')},'force_avp':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'icesupport':{'type':Sequelize[_0x6cef('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x6cef('0x2e'),_0x6cef('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x6cef('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6cef('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x6cef('0x1')]},'dtlscipher':{'type':Sequelize[_0x6cef('0x1')]},'dtlscafile':{'type':Sequelize[_0x6cef('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x30'),_0x6cef('0x31'),_0x6cef('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6cef('0x1')]},'usereqphone':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6cef('0x1')]},'call_limit':{'type':Sequelize[_0x6cef('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x6cef('0x19'),'no')},'vmexten':{'type':Sequelize[_0x6cef('0x1')]},'mohinterpret':{'type':Sequelize[_0x6cef('0x1')]},'mohsuggest':{'type':Sequelize[_0x6cef('0x1')]},'parkinglot':{'type':Sequelize[_0x6cef('0x1')]},'description':{'type':Sequelize[_0x6cef('0x1')]},'host':{'type':Sequelize[_0x6cef('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x6cef('0x3')](_0x6cef('0x19'),'no','nonat',_0x6cef('0x1a'),_0x6cef('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6cef('0x1')]},'otherFields':{'type':Sequelize[_0x6cef('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6cef('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xba9d=['ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','all'];(function(_0x26b8ee,_0x9a7070){var _0x5a0488=function(_0x51c0d9){while(--_0x51c0d9){_0x26b8ee['push'](_0x26b8ee['shift']());}};_0x5a0488(++_0x9a7070);}(_0xba9d,0x14d));var _0xdba9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xba9d[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xdba9('0x0'));module['exports']={'name':{'type':Sequelize[_0xdba9('0x1')],'allowNull':![],'unique':_0xdba9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x4'),_0xdba9('0x5'),_0xdba9('0x6')),'allowNull':![],'defaultValue':_0xdba9('0x4')},'context':{'type':Sequelize[_0xdba9('0x1')],'allowNull':![],'defaultValue':_0xdba9('0x7')},'callingpres':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x8'),_0xdba9('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xdba9('0xa'),_0xdba9('0xb'),_0xdba9('0xc'),_0xdba9('0xd'))},'deny':{'type':Sequelize[_0xdba9('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xdba9('0x1')]},'md5secret':{'type':Sequelize[_0xdba9('0x1')]},'remotesecret':{'type':Sequelize[_0xdba9('0x1')]},'transport':{'type':Sequelize[_0xdba9('0x1')],'defaultValue':_0xdba9('0xe'),'set':function(_0x5f0376){this[_0xdba9('0xf')](_0xdba9('0x10'),_0x5f0376?_0x5f0376[_0xdba9('0x11')](','):null);},'get':function(){return this[_0xdba9('0x12')]('transport')?this[_0xdba9('0x12')](_0xdba9('0x10'))[_0xdba9('0x13')](','):null;},'comment':_0xdba9('0x14')},'dtmfmode':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x15'),'info',_0xdba9('0x16'),_0xdba9('0x17'),_0xdba9('0x18')),'defaultValue':_0xdba9('0x15')},'directmedia':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no',_0xdba9('0x1a'),'update',_0xdba9('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdba9('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xdba9('0x1')]},'nat':{'type':Sequelize[_0xdba9('0x1')],'defaultValue':_0xdba9('0x1c'),'set':function(_0x557864){this[_0xdba9('0xf')](_0xdba9('0x1d'),_0x557864?_0x557864['join'](','):null);},'get':function(){return this[_0xdba9('0x12')](_0xdba9('0x1d'))?this[_0xdba9('0x12')](_0xdba9('0x1d'))[_0xdba9('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdba9('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdba9('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xdba9('0x1')],'defaultValue':_0xdba9('0x1e')},'allow':{'type':Sequelize[_0xdba9('0x1')],'allowNull':![],'defaultValue':_0xdba9('0x1f'),'set':function(_0x4dc550){this[_0xdba9('0xf')](_0xdba9('0x20'),_0x4dc550?_0x4dc550[_0xdba9('0x11')](';'):_0xdba9('0x1f'));},'get':function(){return this['getDataValue'](_0xdba9('0x20'))?this[_0xdba9('0x12')](_0xdba9('0x20'))[_0xdba9('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xdba9('0x21'),'set':function(_0x14dfc6){this[_0xdba9('0xf')](_0xdba9('0x22'),_0x14dfc6?_0x14dfc6[_0xdba9('0x11')](','):null);},'get':function(){return this[_0xdba9('0x12')]('insecure')?this['getDataValue'](_0xdba9('0x22'))[_0xdba9('0x13')](','):null;},'comment':_0xdba9('0x23')},'trustrpid':{'type':Sequelize[_0xdba9('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xdba9('0x19'),'no')},'accountcode':{'type':Sequelize[_0xdba9('0x24')](0xb)},'setvar':{'type':Sequelize[_0xdba9('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no'),'defaultValue':_0xdba9('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xdba9('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xdba9('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xdba9('0x1')]},'template':{'type':Sequelize[_0xdba9('0x1')]},'videosupport':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no',_0xdba9('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdba9('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x26'),_0xdba9('0x27'),_0xdba9('0x28'))},'session_expires':{'type':Sequelize[_0xdba9('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xdba9('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xdba9('0x29')),'defaultValue':_0xdba9('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xdba9('0x1')]},'fromdomain':{'type':Sequelize[_0xdba9('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdba9('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xdba9('0x19'),'no'),'defaultValue':_0xdba9('0x19')},'keepalive':{'type':Sequelize[_0xdba9('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xdba9('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xdba9('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdba9('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xdba9('0x3')]('yes','no',_0xdba9('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdba9('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xdba9('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xdba9('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xdba9('0x1')]},'contactdeny':{'type':Sequelize[_0xdba9('0x1')]},'contactacl':{'type':Sequelize[_0xdba9('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xdba9('0x1')]},'use_q850_reason':{'type':Sequelize[_0xdba9('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xdba9('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xdba9('0x19'),'no')},'icesupport':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no',_0xdba9('0x2b'),_0xdba9('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xdba9('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xdba9('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xdba9('0x1')]},'dtlssetup':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x2d'),_0xdba9('0x2e'),_0xdba9('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdba9('0x1')]},'recordofffeature':{'type':Sequelize[_0xdba9('0x1')]},'call_limit':{'type':Sequelize[_0xdba9('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xdba9('0x19'),'no')},'vmexten':{'type':Sequelize[_0xdba9('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xdba9('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xdba9('0x1')],'defaultValue':_0xdba9('0x30')},'canreinvite':{'type':Sequelize[_0xdba9('0x3')](_0xdba9('0x19'),'no',_0xdba9('0x1a'),_0xdba9('0x31'),_0xdba9('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xdba9('0x1')]},'active':{'type':Sequelize[_0xdba9('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 49f9eba..cd0a813 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 _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x4eab50,_0x475f3a){var _0x463f58=function(_0x3a8c63){while(--_0x3a8c63){_0x4eab50['push'](_0x4eab50['shift']());}};_0x463f58(++_0x475f3a);}(_0x3e74,0x175));var _0x43e7=function(_0x349bc6,_0x57d340){_0x349bc6=_0x349bc6-0x0;var _0x2424ec=_0x3e74[_0x349bc6];return _0x2424ec;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file +var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x4fe18f,_0x571907){var _0x1ae78f=function(_0x117d93){while(--_0x117d93){_0x4fe18f['push'](_0x4fe18f['shift']());}};_0x1ae78f(++_0x571907);}(_0xb821,0xa7));var _0x1b82=function(_0x5ab8bb,_0x139e42){_0x5ab8bb=_0x5ab8bb-0x0;var _0x51adcf=_0xb821[_0x5ab8bb];return _0x51adcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6dbb1ab..031235d 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 _0x7962=['Trunk','tools_trunks','util','../../config/logger','api','bluebird','../../config/environment','./trunk.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7962,0x11a));var _0x2796=function(_0x29f3d0,_0x37f91f){_0x29f3d0=_0x29f3d0-0x0;var _0x479afe=_0x7962[_0x29f3d0];return _0x479afe;};'use strict';var _=require('lodash');var util=require(_0x2796('0x0'));var logger=require(_0x2796('0x1'))(_0x2796('0x2'));var moment=require('moment');var BPromise=require(_0x2796('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2796('0x4'));var attributes=require(_0x2796('0x5'));module[_0x2796('0x6')]=function(_0x438447,_0x514377){return _0x438447[_0x2796('0x7')](_0x2796('0x8'),attributes,{'tableName':_0x2796('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bbf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger'];(function(_0x28de32,_0x242d8b){var _0x5ec7a8=function(_0x4c1a27){while(--_0x4c1a27){_0x28de32['push'](_0x28de32['shift']());}};_0x5ec7a8(++_0x242d8b);}(_0x0bbf,0xcf));var _0xf0bb=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x0bbf[_0x32056c];return _0x317313;};'use strict';var _=require(_0xf0bb('0x0'));var util=require(_0xf0bb('0x1'));var logger=require(_0xf0bb('0x2'))(_0xf0bb('0x3'));var moment=require(_0xf0bb('0x4'));var BPromise=require(_0xf0bb('0x5'));var rp=require(_0xf0bb('0x6'));var fs=require('fs');var path=require(_0xf0bb('0x7'));var rimraf=require(_0xf0bb('0x8'));var config=require(_0xf0bb('0x9'));var attributes=require(_0xf0bb('0xa'));module[_0xf0bb('0xb')]=function(_0x2acf2d,_0x2be7e6){return _0x2acf2d[_0xf0bb('0xc')](_0xf0bb('0xd'),attributes,{'tableName':'tools_trunks','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 b52ef11..d211abc 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 _0x2814=['Trunk','options','raw','where','attributes','include','map','model','debug','ShowTrunk','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x2814,0xb5));var _0x4281=function(_0x559ae3,_0x259e00){_0x559ae3=_0x559ae3-0x0;var _0x3edef1=_0x2814[_0x559ae3];return _0x3edef1;};'use strict';var _=require(_0x4281('0x0'));var util=require('util');var moment=require(_0x4281('0x1'));var BPromise=require(_0x4281('0x2'));var rs=require(_0x4281('0x3'));var fs=require('fs');var Redis=require(_0x4281('0x4'));var db=require(_0x4281('0x5'))['db'];var utils=require(_0x4281('0x6'));var logger=require(_0x4281('0x7'))('rpc');var config=require(_0x4281('0x8'));var jayson=require(_0x4281('0x9'));var client=jayson['client'][_0x4281('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f65a,_0x2170b2,_0x16c8cf){return new BPromise(function(_0x212efb,_0x1270f0){return client[_0x4281('0xb')](_0x25f65a,_0x16c8cf)[_0x4281('0xc')](function(_0x5026e8){logger[_0x4281('0xd')](_0x4281('0xe'),_0x2170b2,_0x4281('0xf'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x2170b2,'request\x20sent',JSON[_0x4281('0x10')](_0x5026e8));if(_0x5026e8['error']){if(_0x5026e8[_0x4281('0x11')][_0x4281('0x12')]===0x1f4){logger['error'](_0x4281('0xe'),_0x2170b2,_0x5026e8[_0x4281('0x11')]['message']);return _0x1270f0(_0x5026e8['error'][_0x4281('0x13')]);}logger['error'](_0x4281('0xe'),_0x2170b2,_0x5026e8['error'][_0x4281('0x13')]);return _0x212efb(_0x5026e8[_0x4281('0x11')][_0x4281('0x13')]);}else{logger[_0x4281('0xd')](_0x4281('0xe'),_0x2170b2,_0x4281('0xf'));_0x212efb(_0x5026e8[_0x4281('0x14')][_0x4281('0x13')]);}})[_0x4281('0x15')](function(_0x1b8030){logger[_0x4281('0x11')](_0x4281('0xe'),_0x2170b2,_0x1b8030);_0x1270f0(_0x1b8030);});});}exports[_0x4281('0x16')]=function(_0x130e38){var _0x5887d0=this;return new Promise(function(_0x254998,_0x5e9858){return db[_0x4281('0x17')]['findAll']({'raw':_0x130e38['options']?_0x130e38[_0x4281('0x18')][_0x4281('0x19')]===undefined?!![]:![]:!![],'where':_0x130e38[_0x4281('0x18')]?_0x130e38[_0x4281('0x18')][_0x4281('0x1a')]||null:null,'attributes':_0x130e38[_0x4281('0x18')]?_0x130e38[_0x4281('0x18')][_0x4281('0x1b')]||null:null,'limit':_0x130e38['options']?_0x130e38[_0x4281('0x18')]['limit']||null:null,'include':_0x130e38['options']?_0x130e38[_0x4281('0x18')][_0x4281('0x1c')]?_[_0x4281('0x1d')](_0x130e38[_0x4281('0x18')]['include'],function(_0xb748fc){return{'model':db[_0xb748fc[_0x4281('0x1e')]],'as':_0xb748fc['as'],'attributes':_0xb748fc[_0x4281('0x1b')],'include':_0xb748fc[_0x4281('0x1c')]?_[_0x4281('0x1d')](_0xb748fc[_0x4281('0x1c')],function(_0x500e23){return{'model':db[_0x500e23[_0x4281('0x1e')]],'as':_0x500e23['as'],'attributes':_0x500e23[_0x4281('0x1b')],'include':_0x500e23['include']?_[_0x4281('0x1d')](_0x500e23[_0x4281('0x1c')],function(_0xb1d61e){return{'model':db[_0xb1d61e[_0x4281('0x1e')]],'as':_0xb1d61e['as'],'attributes':_0xb1d61e[_0x4281('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4281('0xc')](function(_0x4ee661){logger['info'](_0x4281('0x16'),_0x130e38);logger[_0x4281('0x1f')](_0x4281('0x16'),_0x130e38,JSON[_0x4281('0x10')](_0x4ee661));_0x254998(_0x4ee661);})[_0x4281('0x15')](function(_0x34d50a){logger[_0x4281('0x11')]('GetTrunk',_0x34d50a[_0x4281('0x13')],_0x130e38);_0x5e9858(_0x5887d0[_0x4281('0x11')](0x1f4,_0x34d50a[_0x4281('0x13')]));});});};exports[_0x4281('0x20')]=function(_0x28b40f){var _0x3cacf1=this;return new Promise(function(_0x18b6fe,_0x45e2e3){return db['Trunk'][_0x4281('0x21')]({'raw':_0x28b40f[_0x4281('0x18')]?_0x28b40f['options'][_0x4281('0x19')]===undefined?!![]:![]:!![],'where':_0x28b40f['options']?_0x28b40f[_0x4281('0x18')][_0x4281('0x1a')]||null:null,'attributes':_0x28b40f[_0x4281('0x18')]?_0x28b40f[_0x4281('0x18')][_0x4281('0x1b')]||null:null,'include':_0x28b40f[_0x4281('0x18')]?_0x28b40f['options']['include']?_[_0x4281('0x1d')](_0x28b40f['options'][_0x4281('0x1c')],function(_0x7d2fd1){return{'model':db[_0x7d2fd1[_0x4281('0x1e')]],'as':_0x7d2fd1['as'],'attributes':_0x7d2fd1[_0x4281('0x1b')],'include':_0x7d2fd1[_0x4281('0x1c')]?_[_0x4281('0x1d')](_0x7d2fd1['include'],function(_0x2e9867){return{'model':db[_0x2e9867[_0x4281('0x1e')]],'as':_0x2e9867['as'],'attributes':_0x2e9867[_0x4281('0x1b')],'include':_0x2e9867['include']?_[_0x4281('0x1d')](_0x2e9867[_0x4281('0x1c')],function(_0x414117){return{'model':db[_0x414117[_0x4281('0x1e')]],'as':_0x414117['as'],'attributes':_0x414117[_0x4281('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4281('0xc')](function(_0x2c2330){logger['info'](_0x4281('0x20'),_0x28b40f);logger[_0x4281('0x1f')]('ShowTrunk',_0x28b40f,JSON['stringify'](_0x2c2330));_0x18b6fe(_0x2c2330);})['catch'](function(_0x55218c){logger[_0x4281('0x11')]('ShowTrunk',_0x55218c[_0x4281('0x13')],_0x28b40f);_0x45e2e3(_0x3cacf1['error'](0x1f4,_0x55218c[_0x4281('0x13')]));});});}; \ No newline at end of file +var _0x263e=['where','attributes','limit','include','map','model','ShowTrunk','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','findAll','options','raw'];(function(_0x37cdd9,_0x4ac392){var _0x2ce804=function(_0x472e0b){while(--_0x472e0b){_0x37cdd9['push'](_0x37cdd9['shift']());}};_0x2ce804(++_0x4ac392);}(_0x263e,0x1d8));var _0xe263=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0x263e[_0x1103c4];return _0x1c19ab;};'use strict';var _=require(_0xe263('0x0'));var util=require(_0xe263('0x1'));var moment=require(_0xe263('0x2'));var BPromise=require('bluebird');var rs=require(_0xe263('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe263('0x4'));var logger=require(_0xe263('0x5'))(_0xe263('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe263('0x7')][_0xe263('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eba99,_0x1407fe,_0x4201aa){return new BPromise(function(_0x2547b0,_0x5844f9){return client[_0xe263('0x9')](_0x3eba99,_0x4201aa)[_0xe263('0xa')](function(_0xb579ae){logger[_0xe263('0xb')](_0xe263('0xc'),_0x1407fe,_0xe263('0xd'));logger[_0xe263('0xe')](_0xe263('0xf'),_0x1407fe,_0xe263('0xd'),JSON[_0xe263('0x10')](_0xb579ae));if(_0xb579ae[_0xe263('0x11')]){if(_0xb579ae[_0xe263('0x11')]['code']===0x1f4){logger[_0xe263('0x11')](_0xe263('0xc'),_0x1407fe,_0xb579ae[_0xe263('0x11')][_0xe263('0x12')]);return _0x5844f9(_0xb579ae[_0xe263('0x11')][_0xe263('0x12')]);}logger[_0xe263('0x11')](_0xe263('0xc'),_0x1407fe,_0xb579ae[_0xe263('0x11')][_0xe263('0x12')]);return _0x2547b0(_0xb579ae[_0xe263('0x11')][_0xe263('0x12')]);}else{logger[_0xe263('0xb')](_0xe263('0xc'),_0x1407fe,_0xe263('0xd'));_0x2547b0(_0xb579ae['result'][_0xe263('0x12')]);}})[_0xe263('0x13')](function(_0x5c8e0b){logger[_0xe263('0x11')](_0xe263('0xc'),_0x1407fe,_0x5c8e0b);_0x5844f9(_0x5c8e0b);});});}exports[_0xe263('0x14')]=function(_0x2e3449){var _0x48bc0e=this;return new Promise(function(_0x5388b2,_0x136511){return db['Trunk'][_0xe263('0x15')]({'raw':_0x2e3449['options']?_0x2e3449[_0xe263('0x16')][_0xe263('0x17')]===undefined?!![]:![]:!![],'where':_0x2e3449['options']?_0x2e3449['options'][_0xe263('0x18')]||null:null,'attributes':_0x2e3449[_0xe263('0x16')]?_0x2e3449[_0xe263('0x16')][_0xe263('0x19')]||null:null,'limit':_0x2e3449['options']?_0x2e3449[_0xe263('0x16')][_0xe263('0x1a')]||null:null,'include':_0x2e3449[_0xe263('0x16')]?_0x2e3449[_0xe263('0x16')][_0xe263('0x1b')]?_[_0xe263('0x1c')](_0x2e3449['options']['include'],function(_0x11ed57){return{'model':db[_0x11ed57['model']],'as':_0x11ed57['as'],'attributes':_0x11ed57[_0xe263('0x19')],'include':_0x11ed57[_0xe263('0x1b')]?_[_0xe263('0x1c')](_0x11ed57[_0xe263('0x1b')],function(_0x35cf8b){return{'model':db[_0x35cf8b['model']],'as':_0x35cf8b['as'],'attributes':_0x35cf8b[_0xe263('0x19')],'include':_0x35cf8b[_0xe263('0x1b')]?_['map'](_0x35cf8b[_0xe263('0x1b')],function(_0xda60cb){return{'model':db[_0xda60cb[_0xe263('0x1d')]],'as':_0xda60cb['as'],'attributes':_0xda60cb[_0xe263('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe263('0xa')](function(_0x1cb7c9){logger['info'](_0xe263('0x14'),_0x2e3449);logger[_0xe263('0xe')]('GetTrunk',_0x2e3449,JSON[_0xe263('0x10')](_0x1cb7c9));_0x5388b2(_0x1cb7c9);})[_0xe263('0x13')](function(_0x482577){logger['error'](_0xe263('0x14'),_0x482577[_0xe263('0x12')],_0x2e3449);_0x136511(_0x48bc0e[_0xe263('0x11')](0x1f4,_0x482577[_0xe263('0x12')]));});});};exports[_0xe263('0x1e')]=function(_0x1d1d4e){var _0x4edde2=this;return new Promise(function(_0x18ba56,_0x27388c){return db['Trunk']['find']({'raw':_0x1d1d4e['options']?_0x1d1d4e[_0xe263('0x16')][_0xe263('0x17')]===undefined?!![]:![]:!![],'where':_0x1d1d4e['options']?_0x1d1d4e[_0xe263('0x16')]['where']||null:null,'attributes':_0x1d1d4e[_0xe263('0x16')]?_0x1d1d4e[_0xe263('0x16')]['attributes']||null:null,'include':_0x1d1d4e[_0xe263('0x16')]?_0x1d1d4e[_0xe263('0x16')][_0xe263('0x1b')]?_[_0xe263('0x1c')](_0x1d1d4e[_0xe263('0x16')][_0xe263('0x1b')],function(_0x4e7244){return{'model':db[_0x4e7244['model']],'as':_0x4e7244['as'],'attributes':_0x4e7244[_0xe263('0x19')],'include':_0x4e7244['include']?_[_0xe263('0x1c')](_0x4e7244[_0xe263('0x1b')],function(_0xf01876){return{'model':db[_0xf01876[_0xe263('0x1d')]],'as':_0xf01876['as'],'attributes':_0xf01876[_0xe263('0x19')],'include':_0xf01876[_0xe263('0x1b')]?_['map'](_0xf01876[_0xe263('0x1b')],function(_0x4cf3f1){return{'model':db[_0x4cf3f1[_0xe263('0x1d')]],'as':_0x4cf3f1['as'],'attributes':_0x4cf3f1[_0xe263('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3429e1){logger[_0xe263('0xb')](_0xe263('0x1e'),_0x1d1d4e);logger['debug'](_0xe263('0x1e'),_0x1d1d4e,JSON['stringify'](_0x3429e1));_0x18ba56(_0x3429e1);})[_0xe263('0x13')](function(_0x8365a5){logger[_0xe263('0x11')](_0xe263('0x1e'),_0x8365a5[_0xe263('0x12')],_0x1d1d4e);_0x27388c(_0x4edde2[_0xe263('0x11')](0x1f4,_0x8365a5[_0xe263('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 05fef50..15d992c 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 _0xdaba=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x2f12b7,_0x27f28d){var _0xe20bb6=function(_0x31ada0){while(--_0x31ada0){_0x2f12b7['push'](_0x2f12b7['shift']());}};_0xe20bb6(++_0x27f28d);}(_0xdaba,0x197));var _0xadab=function(_0x59eb84,_0x5f2faf){_0x59eb84=_0x59eb84-0x0;var _0x32ad0b=_0xdaba[_0x59eb84];return _0x32ad0b;};'use strict';var express=require(_0xadab('0x0'));var router=express[_0xadab('0x1')]();var auth=require(_0xadab('0x2'));var controller=require(_0xadab('0x3'));router[_0xadab('0x4')](_0xadab('0x5'),auth['isAuthenticated'](),controller['update']);module[_0xadab('0x6')]=router; \ No newline at end of file +var _0x1b1d=['update','exports','Router','../../components/auth/service','./user-setting.controller','/:id'];(function(_0x4b6b8b,_0x73c39){var _0x2b2295=function(_0x52a6e7){while(--_0x52a6e7){_0x4b6b8b['push'](_0x4b6b8b['shift']());}};_0x2b2295(++_0x73c39);}(_0x1b1d,0x140));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0xd1b1('0x0')]();var auth=require(_0xd1b1('0x1'));var controller=require(_0xd1b1('0x2'));router['put'](_0xd1b1('0x3'),auth['isAuthenticated'](),controller[_0xd1b1('0x4')]);module[_0xd1b1('0x5')]=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 ed24204..dac6ad8 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 _0x00fd=['exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x1b0478,_0x225e61){var _0x440583=function(_0x1f79f4){while(--_0x1f79f4){_0x1b0478['push'](_0x1b0478['shift']());}};_0x440583(++_0x225e61);}(_0x00fd,0x19f));var _0xd00f=function(_0x3e8da7,_0x18486c){_0x3e8da7=_0x3e8da7-0x0;var _0x3d45e2=_0x00fd[_0x3e8da7];return _0x3d45e2;};'use strict';var Sequelize=require(_0xd00f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd00f('0x1'),_0xd00f('0x2'),_0xd00f('0x3'),_0xd00f('0x4')];module[_0xd00f('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd00f('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd00f('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd00f('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd00f('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd00f('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd00f('0xa')],'unique':_0xd00f('0xb')}}; \ No newline at end of file +var _0x95ad=['error','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','UserId','sequelize'];(function(_0x35e244,_0x5b2e8c){var _0x501c55=function(_0x15e236){while(--_0x15e236){_0x35e244['push'](_0x35e244['shift']());}};_0x501c55(++_0x5b2e8c);}(_0x95ad,0x6d));var _0xd95a=function(_0x361c42,_0x5b810a){_0x361c42=_0x361c42-0x0;var _0x53190a=_0x95ad[_0x361c42];return _0x53190a;};'use strict';var Sequelize=require(_0xd95a('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd95a('0x1'),'warning',_0xd95a('0x2'),_0xd95a('0x3')];module[_0xd95a('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd95a('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd95a('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd95a('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd95a('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xd95a('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 18a166d..8b982e8 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 _0xcea2=['register','redis','status','json','update','then','sendStatus','stack','name','send','user','params','UserSetting','find','body','catch','lodash','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket'];(function(_0x3444eb,_0xbd4562){var _0x286e50=function(_0x5cad9b){while(--_0x5cad9b){_0x3444eb['push'](_0x3444eb['shift']());}};_0x286e50(++_0xbd4562);}(_0xcea2,0x15a));var _0x2cea=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xcea2[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x2cea('0x0'));var Redis=require('ioredis');var logger=require(_0x2cea('0x1'))('api');var config=require(_0x2cea('0x2'));var db=require(_0x2cea('0x3'))['db'];var socket=require(_0x2cea('0x4'))(new Redis(config['redis']));require(_0x2cea('0x5'))[_0x2cea('0x6')](socket);config[_0x2cea('0x7')]=_['defaults'](config[_0x2cea('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2d69ff,_0xc04963){_0xc04963=_0xc04963||0xc8;return function(_0x805a1b){if(_0x805a1b){return _0x2d69ff[_0x2cea('0x8')](_0xc04963)[_0x2cea('0x9')](_0x805a1b);}};}function saveUpdates(_0x1519f6){return function(_0x5e9060){if(_0x5e9060){return _0x5e9060[_0x2cea('0xa')](_0x1519f6)[_0x2cea('0xb')](function(_0x205a4e){return _0x205a4e;});}return null;};}function handleEntityNotFound(_0x2b437a){return function(_0x306cf7){if(!_0x306cf7){_0x2b437a[_0x2cea('0xc')](0x194);}return _0x306cf7;};}function handleError(_0x4298a4,_0x1c9142){_0x1c9142=_0x1c9142||0x1f4;return function(_0x58a102){logger['error'](_0x58a102[_0x2cea('0xd')]);if(_0x58a102[_0x2cea('0xe')]){delete _0x58a102['name'];}_0x4298a4['status'](_0x1c9142)[_0x2cea('0xf')](_0x58a102);};}exports['update']=function(_0xa4ce3d,_0xc5d08e){if(_0xa4ce3d[_0x2cea('0x10')]['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0xa4ce3d[_0x2cea('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x2cea('0x12')][_0x2cea('0x13')]({'where':{'id':_0xa4ce3d[_0x2cea('0x11')]['id']}})[_0x2cea('0xb')](handleEntityNotFound(_0xc5d08e,null))[_0x2cea('0xb')](saveUpdates(_0xa4ce3d[_0x2cea('0x14')],null))[_0x2cea('0xb')](respondWithResult(_0xc5d08e,null))[_0x2cea('0x15')](handleError(_0xc5d08e,null));}; \ No newline at end of file +var _0x5c4a=['error','stack','name','send','user','Unauthorized','find','params','body','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then'];(function(_0x2ff03b,_0x1206be){var _0x1df7d3=function(_0x27f0a5){while(--_0x27f0a5){_0x2ff03b['push'](_0x2ff03b['shift']());}};_0x1df7d3(++_0x1206be);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x2bcb71,_0x1bd33c){_0x2bcb71=_0x2bcb71-0x0;var _0x58ce62=_0x5c4a[_0x2bcb71];return _0x58ce62;};'use strict';var _=require('lodash');var Redis=require(_0xa5c4('0x0'));var logger=require(_0xa5c4('0x1'))('api');var config=require(_0xa5c4('0x2'));var db=require(_0xa5c4('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xa5c4('0x4')]));require(_0xa5c4('0x5'))[_0xa5c4('0x6')](socket);config[_0xa5c4('0x4')]=_[_0xa5c4('0x7')](config['redis'],{'host':_0xa5c4('0x8'),'port':0x18eb});function respondWithResult(_0x4210e8,_0x163c03){_0x163c03=_0x163c03||0xc8;return function(_0x435ccb){if(_0x435ccb){return _0x4210e8[_0xa5c4('0x9')](_0x163c03)[_0xa5c4('0xa')](_0x435ccb);}};}function saveUpdates(_0x4cd657){return function(_0x11e089){if(_0x11e089){return _0x11e089[_0xa5c4('0xb')](_0x4cd657)[_0xa5c4('0xc')](function(_0x51c7b1){return _0x51c7b1;});}return null;};}function handleEntityNotFound(_0x5e986b){return function(_0x179fcd){if(!_0x179fcd){_0x5e986b['sendStatus'](0x194);}return _0x179fcd;};}function handleError(_0x34db1f,_0x32acea){_0x32acea=_0x32acea||0x1f4;return function(_0x4eb7cd){logger[_0xa5c4('0xd')](_0x4eb7cd[_0xa5c4('0xe')]);if(_0x4eb7cd[_0xa5c4('0xf')]){delete _0x4eb7cd[_0xa5c4('0xf')];}_0x34db1f[_0xa5c4('0x9')](_0x32acea)[_0xa5c4('0x10')](_0x4eb7cd);};}exports[_0xa5c4('0xb')]=function(_0x2f9a4a,_0x4c82d6){if(_0x2f9a4a[_0xa5c4('0x11')]['role']!=='admin')throw new Error(_0xa5c4('0x12'));if(isNaN(Number(_0x2f9a4a['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0xa5c4('0x13')]({'where':{'id':_0x2f9a4a[_0xa5c4('0x14')]['id']}})[_0xa5c4('0xc')](handleEntityNotFound(_0x4c82d6,null))[_0xa5c4('0xc')](saveUpdates(_0x2f9a4a[_0xa5c4('0x15')],null))[_0xa5c4('0xc')](respondWithResult(_0x4c82d6,null))['catch'](handleError(_0x4c82d6,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 ff07101..559643f 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 _0x94bb=['exports','../../mysqldb','UserSetting','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2a3d2b,_0x7f960a){var _0x5c06b5=function(_0x4a1ebb){while(--_0x4a1ebb){_0x2a3d2b['push'](_0x2a3d2b['shift']());}};_0x5c06b5(++_0x7f960a);}(_0x94bb,0x7f));var _0xb94b=function(_0x1fd437,_0x2c0b47){_0x1fd437=_0x1fd437-0x0;var _0x40d9e6=_0x94bb[_0x1fd437];return _0x40d9e6;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xb94b('0x0'))['db'][_0xb94b('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb94b('0x2'),'afterUpdate':_0xb94b('0x3'),'afterDestroy':_0xb94b('0x4')};function emitEvent(_0x54bc54){return function(_0x475547,_0xb51c11,_0xdad747){UserSettingEvents[_0xb94b('0x5')](_0x54bc54+':'+_0x475547['id'],_0x475547);UserSettingEvents[_0xb94b('0x5')](_0x54bc54,_0x475547);_0xdad747(null);};}for(var e in events){if(events[_0xb94b('0x6')](e)){var event=events[e];UserSetting[_0xb94b('0x7')](e,emitEvent(event));}}module[_0xb94b('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x35d1=['events','../../mysqldb','UserSetting','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x108d68,_0x9b39de){var _0x11476a=function(_0x21cc20){while(--_0x21cc20){_0x108d68['push'](_0x108d68['shift']());}};_0x11476a(++_0x9b39de);}(_0x35d1,0x144));var _0x135d=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x35d1[_0x136619];return _0x38c4a5;};'use strict';var EventEmitter=require(_0x135d('0x0'));var UserSetting=require(_0x135d('0x1'))['db'][_0x135d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x135d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x135d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e6504){return function(_0x23b8f2,_0x528596,_0x381c78){UserSettingEvents['emit'](_0x5e6504+':'+_0x23b8f2['id'],_0x23b8f2);UserSettingEvents[_0x135d('0x5')](_0x5e6504,_0x23b8f2);_0x381c78(null);};}for(var e in events){if(events[_0x135d('0x6')](e)){var event=events[e];UserSetting[_0x135d('0x7')](e,emitEvent(event));}}module[_0x135d('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 241e2ae..7280c1f 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 _0xeef7=['./user-setting.attributes','exports','define','UserSetting','clientSideLoggingEnabledSince'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xeef7,0x7d));var _0x7eef=function(_0x507c66,_0x30d0ae){_0x507c66=_0x507c66-0x0;var _0x4735b2=_0xeef7[_0x507c66];return _0x4735b2;};'use strict';var attributes=require(_0x7eef('0x0'));module[_0x7eef('0x1')]=function(_0x524f04){return _0x524f04[_0x7eef('0x2')](_0x7eef('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b2894){if(!_0x5b2894['clientSideLoggingEnabled'])_0x5b2894[_0x7eef('0x4')]=null;else if(_0x5b2894[_0x7eef('0x4')]===null)_0x5b2894[_0x7eef('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x6ea9=['exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x55bdf7,_0x3f7fca){var _0x55465f=function(_0x2c2a9a){while(--_0x2c2a9a){_0x55bdf7['push'](_0x55bdf7['shift']());}};_0x55465f(++_0x3f7fca);}(_0x6ea9,0x89));var _0x96ea=function(_0x9a7de4,_0x1b6585){_0x9a7de4=_0x9a7de4-0x0;var _0x7af308=_0x6ea9[_0x9a7de4];return _0x7af308;};'use strict';var attributes=require(_0x96ea('0x0'));module[_0x96ea('0x1')]=function(_0x27c316){return _0x27c316[_0x96ea('0x2')](_0x96ea('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fb6c1){if(!_0x1fb6c1[_0x96ea('0x4')])_0x1fb6c1[_0x96ea('0x5')]=null;else if(_0x1fb6c1['clientSideLoggingEnabledSince']===null)_0x1fb6c1[_0x96ea('0x5')]=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 bf2020c..1a96747 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 _0x6337=['user-setting:update','user-setting:update:user-','register','save','update','emit'];(function(_0x552f18,_0x403f49){var _0x3ecdc2=function(_0x4746a0){while(--_0x4746a0){_0x552f18['push'](_0x552f18['shift']());}};_0x3ecdc2(++_0x403f49);}(_0x6337,0xd5));var _0x7633=function(_0x4a3058,_0x1f434d){_0x4a3058=_0x4a3058-0x0;var _0x25627c=_0x6337[_0x4a3058];return _0x25627c;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x7633('0x0'),'remove',_0x7633('0x1')];function createListener(_0x41cb9f,_0x115517){return function(_0x2ca8f6){_0x115517[_0x7633('0x2')](_0x41cb9f,_0x2ca8f6);if(_0x41cb9f===_0x7633('0x3')){_0x115517['emit'](_0x7633('0x4')+_0x2ca8f6['UserId'],_0x2ca8f6);}};}exports[_0x7633('0x5')]=function(_0x48c924){for(var _0x5b6dac=0x0,_0x34052a=events['length'];_0x5b6dac<_0x34052a;_0x5b6dac++){var _0x271138=events[_0x5b6dac];var _0x45045f=createListener('user-setting:'+_0x271138,_0x48c924);UserSettingEvents['on'](_0x271138,_0x45045f);}}; \ No newline at end of file +var _0x3029=['./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-','length'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x3029,0x90));var _0x9302=function(_0x462bff,_0x151a16){_0x462bff=_0x462bff-0x0;var _0x27229a=_0x3029[_0x462bff];return _0x27229a;};'use strict';var UserSettingEvents=require(_0x9302('0x0'));var events=[_0x9302('0x1'),_0x9302('0x2'),_0x9302('0x3')];function createListener(_0x4ad307,_0x4c82be){return function(_0x1d6a2d){_0x4c82be['emit'](_0x4ad307,_0x1d6a2d);if(_0x4ad307===_0x9302('0x4')){_0x4c82be[_0x9302('0x5')](_0x9302('0x6')+_0x1d6a2d['UserId'],_0x1d6a2d);}};}exports['register']=function(_0x286901){for(var _0x293e47=0x0,_0x13d224=events[_0x9302('0x7')];_0x293e47<_0x13d224;_0x293e47++){var _0x58a501=events[_0x293e47];var _0x49ac51=createListener('user-setting:'+_0x58a501,_0x286901);UserSettingEvents['on'](_0x58a501,_0x49ac51);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 347a1f2..e5d522d 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 _0x0375=['getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeQueues','/:id/teams','removeTeams','destroy','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','messengerSoundNotification','exports','multer','util','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts'];(function(_0xd971b4,_0x445070){var _0x5ed2a2=function(_0xf4b51c){while(--_0xf4b51c){_0xd971b4['push'](_0xd971b4['shift']());}};_0x5ed2a2(++_0x445070);}(_0x0375,0x116));var _0x5037=function(_0xfab188,_0x18208f){_0xfab188=_0xfab188-0x0;var _0x4fda32=_0x0375[_0xfab188];return _0x4fda32;};'use strict';var multer=require(_0x5037('0x0'));var util=require(_0x5037('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5037('0x2'));var router=express[_0x5037('0x3')]();var fs_extra=require(_0x5037('0x4'));var auth=require(_0x5037('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0x5037('0x6')]('/',auth[_0x5037('0x7')](),controller['index']);router[_0x5037('0x6')](_0x5037('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5037('0x6')](_0x5037('0x9'),auth[_0x5037('0x7')](),controller[_0x5037('0xa')]);router['get'](_0x5037('0xb'),auth[_0x5037('0x7')](),controller[_0x5037('0xc')]);router['get'](_0x5037('0xd'),auth[_0x5037('0x7')](),controller[_0x5037('0xe')]);router['get'](_0x5037('0xf'),controller[_0x5037('0x10')]);router['get'](_0x5037('0x11'),auth['isAuthenticated'](),controller[_0x5037('0x12')]);router['get'](_0x5037('0x13'),auth[_0x5037('0x7')](),controller[_0x5037('0x14')]);router[_0x5037('0x6')](_0x5037('0x15'),auth[_0x5037('0x7')](),controller['getQueues']);router[_0x5037('0x6')](_0x5037('0x16'),auth[_0x5037('0x7')](),controller[_0x5037('0x17')]);router[_0x5037('0x6')](_0x5037('0x18'),auth['isAuthenticated'](),controller[_0x5037('0x19')]);router[_0x5037('0x6')](_0x5037('0x1a'),auth['isAuthenticated'](),controller[_0x5037('0x1b')]);router[_0x5037('0x6')](_0x5037('0x1c'),auth['isAuthenticated'](),controller[_0x5037('0x1d')]);router[_0x5037('0x6')](_0x5037('0x1e'),auth[_0x5037('0x7')](),controller[_0x5037('0x1f')]);router[_0x5037('0x6')](_0x5037('0x20'),auth[_0x5037('0x7')](),controller[_0x5037('0x21')]);router['get'](_0x5037('0x22'),auth[_0x5037('0x7')](),controller['getMailInteractions']);router['get'](_0x5037('0x23'),auth[_0x5037('0x7')](),controller[_0x5037('0x24')]);router[_0x5037('0x6')](_0x5037('0x25'),auth[_0x5037('0x7')](),controller['getFaxInteractions']);router[_0x5037('0x6')]('/:id/whatsapp/interactions',auth[_0x5037('0x7')](),controller[_0x5037('0x26')]);router['get']('/:id/teams',auth[_0x5037('0x7')](),controller['getTeams']);router['get'](_0x5037('0x27'),auth['isAuthenticated'](),controller['getLists']);router[_0x5037('0x6')](_0x5037('0x28'),auth[_0x5037('0x7')](),controller[_0x5037('0x29')]);router['get'](_0x5037('0x2a'),auth['isAuthenticated'](),controller[_0x5037('0x2b')]);router[_0x5037('0x6')]('/:id/fax_accounts',auth[_0x5037('0x7')](),controller[_0x5037('0x2c')]);router['get'](_0x5037('0x2d'),auth[_0x5037('0x7')](),controller[_0x5037('0x2e')]);router[_0x5037('0x6')](_0x5037('0x2f'),auth[_0x5037('0x7')](),controller[_0x5037('0x30')]);router[_0x5037('0x6')]('/:id/sms_accounts',auth[_0x5037('0x7')](),controller[_0x5037('0x31')]);router[_0x5037('0x6')](_0x5037('0x32'),auth[_0x5037('0x7')](),controller['getChatWebsites']);router[_0x5037('0x6')](_0x5037('0x33'),auth[_0x5037('0x7')](),controller[_0x5037('0x34')]);router[_0x5037('0x6')](_0x5037('0x35'),auth[_0x5037('0x7')](),controller[_0x5037('0x36')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0x5037('0x37')]);router[_0x5037('0x38')](_0x5037('0x13'),auth[_0x5037('0x7')](),controller[_0x5037('0x39')]);router[_0x5037('0x38')]('/',auth[_0x5037('0x7')](),controller[_0x5037('0x3a')]);router[_0x5037('0x38')](_0x5037('0x3b'),auth[_0x5037('0x7')](),controller[_0x5037('0x3c')]);router[_0x5037('0x38')](_0x5037('0x15'),auth['isAuthenticated'](),controller[_0x5037('0x3d')]);var upload=multer({'storage':multer[_0x5037('0x3e')]({'destination':function(_0x4c0098,_0x3dc75a,_0x49bf8c){_0x49bf8c(null,path[_0x5037('0x3f')](config[_0x5037('0x40')],'server/files/images/'));},'filename':function(_0x46b2df,_0x2684f2,_0x299f98){_0x299f98(null,util[_0x5037('0x41')](_0x5037('0x42'),Date['now'](),_0x2684f2[_0x5037('0x43')]));}})});router['post'](_0x5037('0xf'),upload[_0x5037('0x44')](_0x5037('0x45')),controller[_0x5037('0x46')]);router[_0x5037('0x38')](_0x5037('0x47'),auth[_0x5037('0x7')](),controller['login']);router['post'](_0x5037('0x48'),auth['isAuthenticated'](),controller[_0x5037('0x49')]);router[_0x5037('0x38')]('/:id/pause',auth[_0x5037('0x7')](),controller[_0x5037('0x4a')]);router[_0x5037('0x38')]('/:id/unpause',auth[_0x5037('0x7')](),controller['unpause']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x5037('0x4b')]);router['post'](_0x5037('0x4c'),auth[_0x5037('0x7')](),controller[_0x5037('0x4d')]);router[_0x5037('0x38')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x5037('0x7')](),controller['addFaxInteractions']);router[_0x5037('0x38')](_0x5037('0x4e'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x5037('0x38')](_0x5037('0x4f'),auth[_0x5037('0x7')](),controller[_0x5037('0x50')]);router[_0x5037('0x38')](_0x5037('0x51'),auth['isAuthenticated'](),controller[_0x5037('0x52')]);router['post']('/:id/fax_accounts',auth[_0x5037('0x7')](),controller[_0x5037('0x53')]);router[_0x5037('0x38')]('/:id/mail_accounts',auth[_0x5037('0x7')](),controller[_0x5037('0x54')]);router[_0x5037('0x38')](_0x5037('0x2f'),auth[_0x5037('0x7')](),controller[_0x5037('0x55')]);router[_0x5037('0x38')](_0x5037('0x56'),auth[_0x5037('0x7')](),controller['addSmsAccounts']);router['post'](_0x5037('0x32'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x5037('0x38')](_0x5037('0x33'),auth[_0x5037('0x7')](),controller[_0x5037('0x57')]);router[_0x5037('0x38')]('/:id/api_key',auth[_0x5037('0x7')](),controller[_0x5037('0x58')]);router[_0x5037('0x59')](_0x5037('0xd'),auth[_0x5037('0x7')](),controller[_0x5037('0x5a')]);router[_0x5037('0x59')]('/:id/password',auth[_0x5037('0x7')](),controller[_0x5037('0x5b')]);router[_0x5037('0x5c')]('/:id/queues',auth[_0x5037('0x7')](),controller[_0x5037('0x5d')]);router[_0x5037('0x5c')](_0x5037('0x5e'),auth['isAuthenticated'](),controller[_0x5037('0x5f')]);router[_0x5037('0x5c')](_0x5037('0xd'),auth[_0x5037('0x7')](),controller[_0x5037('0x60')]);router[_0x5037('0x5c')](_0x5037('0x4c'),auth[_0x5037('0x7')](),controller['removeChatInteractions']);router[_0x5037('0x5c')](_0x5037('0x61'),auth['isAuthenticated'](),controller[_0x5037('0x62')]);router[_0x5037('0x5c')]('/:id/fax_interactions',auth[_0x5037('0x7')](),controller['removeFaxInteractions']);router[_0x5037('0x5c')](_0x5037('0x4e'),auth[_0x5037('0x7')](),controller[_0x5037('0x63')]);router[_0x5037('0x5c')](_0x5037('0x4f'),auth[_0x5037('0x7')](),controller[_0x5037('0x64')]);router[_0x5037('0x5c')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x5037('0x65')]);router[_0x5037('0x5c')](_0x5037('0x66'),auth[_0x5037('0x7')](),controller['removeFaxAccounts']);router[_0x5037('0x5c')](_0x5037('0x2d'),auth[_0x5037('0x7')](),controller['removeMailAccounts']);router[_0x5037('0x5c')](_0x5037('0x2f'),auth[_0x5037('0x7')](),controller[_0x5037('0x67')]);router[_0x5037('0x5c')](_0x5037('0x56'),auth[_0x5037('0x7')](),controller[_0x5037('0x68')]);router[_0x5037('0x5c')](_0x5037('0x32'),auth[_0x5037('0x7')](),controller[_0x5037('0x69')]);router[_0x5037('0x5c')]('/:id/whatsapp_accounts',auth[_0x5037('0x7')](),controller[_0x5037('0x6a')]);router[_0x5037('0x5c')](_0x5037('0x6b'),auth['isAuthenticated'](),controller['removeApiKey']);router[_0x5037('0x38')]('/:id/messengerSoundNotification',auth[_0x5037('0x7')](),controller[_0x5037('0x6c')]);module[_0x5037('0x6d')]=router; \ No newline at end of file +var _0xcdf0=['/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','whoami','/presence','getPresence','/:id','show','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xcdf0,0xa8));var _0x0cdf=function(_0x4ce818,_0xc23665){_0x4ce818=_0x4ce818-0x0;var _0x4c8d65=_0xcdf0[_0x4ce818];return _0x4c8d65;};'use strict';var multer=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var path=require(_0x0cdf('0x2'));var timeout=require(_0x0cdf('0x3'));var express=require(_0x0cdf('0x4'));var router=express['Router']();var fs_extra=require(_0x0cdf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0cdf('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x0cdf('0x7')]('/',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x9')]);router[_0x0cdf('0x7')](_0x0cdf('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0cdf('0x7')]('/whoami',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0xb')]);router['get'](_0x0cdf('0xc'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0xd')]);router['get'](_0x0cdf('0xe'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0xf')]);router[_0x0cdf('0x7')]('/:id/avatar',controller[_0x0cdf('0x10')]);router[_0x0cdf('0x7')]('/:id/open_tabs',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x11')]);router[_0x0cdf('0x7')](_0x0cdf('0x12'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x13')]);router['get'](_0x0cdf('0x14'),auth[_0x0cdf('0x8')](),controller['getQueues']);router[_0x0cdf('0x7')](_0x0cdf('0x15'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x16')]);router['get']('/:id/groups',auth[_0x0cdf('0x8')](),controller['getGroups']);router[_0x0cdf('0x7')](_0x0cdf('0x17'),auth['isAuthenticated'](),controller['getRecordings']);router['get']('/:id/screen_recordings',auth[_0x0cdf('0x8')](),controller['getScreenRecordings']);router[_0x0cdf('0x7')](_0x0cdf('0x18'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x19')]);router[_0x0cdf('0x7')](_0x0cdf('0x1a'),auth['isAuthenticated'](),controller[_0x0cdf('0x1b')]);router[_0x0cdf('0x7')](_0x0cdf('0x1c'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x1d')]);router[_0x0cdf('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x0cdf('0x1e')]);router[_0x0cdf('0x7')](_0x0cdf('0x1f'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x20')]);router['get'](_0x0cdf('0x21'),auth['isAuthenticated'](),controller[_0x0cdf('0x22')]);router[_0x0cdf('0x7')](_0x0cdf('0x23'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x24')]);router[_0x0cdf('0x7')](_0x0cdf('0x25'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x26')]);router[_0x0cdf('0x7')]('/:id/agents',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x27')]);router[_0x0cdf('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x0cdf('0x28')]);router['get'](_0x0cdf('0x29'),auth['isAuthenticated'](),controller[_0x0cdf('0x2a')]);router[_0x0cdf('0x7')](_0x0cdf('0x2b'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x2c')]);router['get'](_0x0cdf('0x2d'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x0cdf('0x7')](_0x0cdf('0x2e'),auth['isAuthenticated'](),controller[_0x0cdf('0x2f')]);router[_0x0cdf('0x7')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x0cdf('0x7')](_0x0cdf('0x30'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x31')]);router['get'](_0x0cdf('0x32'),auth['isAuthenticated'](),controller[_0x0cdf('0x33')]);router[_0x0cdf('0x7')](_0x0cdf('0x34'),auth[_0x0cdf('0x8')](),controller['getApiKey']);router[_0x0cdf('0x35')](_0x0cdf('0x12'),auth['isAuthenticated'](),controller[_0x0cdf('0x36')]);router['post']('/',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x37')]);router[_0x0cdf('0x35')](_0x0cdf('0x38'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x39')]);router[_0x0cdf('0x35')](_0x0cdf('0x14'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x3a')]);var upload=multer({'storage':multer[_0x0cdf('0x3b')]({'destination':function(_0xcdf2f7,_0x35eb2c,_0x55de2e){_0x55de2e(null,path[_0x0cdf('0x3c')](config[_0x0cdf('0x3d')],_0x0cdf('0x3e')));},'filename':function(_0x15f1cb,_0x547e96,_0x3847a8){_0x3847a8(null,util[_0x0cdf('0x3f')](_0x0cdf('0x40'),Date[_0x0cdf('0x41')](),_0x547e96['originalname']));}})});router['post']('/:id/avatar',upload[_0x0cdf('0x42')](_0x0cdf('0x43')),controller['addAvatar']);router[_0x0cdf('0x35')](_0x0cdf('0x44'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x45')]);router[_0x0cdf('0x35')](_0x0cdf('0x46'),auth['isAuthenticated'](),controller[_0x0cdf('0x47')]);router[_0x0cdf('0x35')](_0x0cdf('0x48'),auth['isAuthenticated'](),controller[_0x0cdf('0x49')]);router[_0x0cdf('0x35')](_0x0cdf('0x4a'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x4b')]);router[_0x0cdf('0x35')](_0x0cdf('0x23'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x4c')]);router['post'](_0x0cdf('0x4d'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x4e')]);router['post']('/:id/mail_interactions',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x4f')]);router[_0x0cdf('0x35')](_0x0cdf('0x50'),auth['isAuthenticated'](),controller[_0x0cdf('0x51')]);router['post'](_0x0cdf('0x52'),auth['isAuthenticated'](),controller[_0x0cdf('0x53')]);router[_0x0cdf('0x35')](_0x0cdf('0x54'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x55')]);router[_0x0cdf('0x35')](_0x0cdf('0x56'),auth[_0x0cdf('0x8')](),controller['addWhatsappInteractions']);router['post'](_0x0cdf('0x29'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x57')]);router[_0x0cdf('0x35')](_0x0cdf('0x2b'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x58')]);router[_0x0cdf('0x35')](_0x0cdf('0x2d'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x59')]);router['post']('/:id/sms_accounts',auth[_0x0cdf('0x8')](),controller['addSmsAccounts']);router[_0x0cdf('0x35')](_0x0cdf('0x5a'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x5b')]);router[_0x0cdf('0x35')](_0x0cdf('0x30'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x5c')]);router['post'](_0x0cdf('0x34'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x5d')]);router[_0x0cdf('0x5e')](_0x0cdf('0xe'),auth['isAuthenticated'](),controller[_0x0cdf('0x5f')]);router['put'](_0x0cdf('0x60'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x61')]);router[_0x0cdf('0x62')](_0x0cdf('0x14'),auth[_0x0cdf('0x8')](),controller['removeQueues']);router['delete'](_0x0cdf('0x23'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id',auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x63')]);router[_0x0cdf('0x62')](_0x0cdf('0x4d'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x64')]);router[_0x0cdf('0x62')](_0x0cdf('0x65'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x66')]);router[_0x0cdf('0x62')](_0x0cdf('0x50'),auth[_0x0cdf('0x8')](),controller['removeFaxInteractions']);router[_0x0cdf('0x62')](_0x0cdf('0x52'),auth['isAuthenticated'](),controller[_0x0cdf('0x67')]);router['delete'](_0x0cdf('0x54'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x68')]);router[_0x0cdf('0x62')](_0x0cdf('0x56'),auth['isAuthenticated'](),controller[_0x0cdf('0x69')]);router[_0x0cdf('0x62')](_0x0cdf('0x29'),auth['isAuthenticated'](),controller[_0x0cdf('0x6a')]);router[_0x0cdf('0x62')](_0x0cdf('0x2b'),auth[_0x0cdf('0x8')](),controller['removeMailAccounts']);router[_0x0cdf('0x62')](_0x0cdf('0x2d'),auth[_0x0cdf('0x8')](),controller['removeOpenchannelAccounts']);router[_0x0cdf('0x62')](_0x0cdf('0x2e'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x0cdf('0x62')](_0x0cdf('0x5a'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x6b')]);router[_0x0cdf('0x62')](_0x0cdf('0x30'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x6c')]);router['delete'](_0x0cdf('0x34'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x6d')]);router[_0x0cdf('0x35')](_0x0cdf('0x6e'),auth[_0x0cdf('0x8')](),controller[_0x0cdf('0x6f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index dbc9075..4c3002b 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 _0x491b=['user','telephone','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uas','fingerprint','certificate','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','force_avp','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','avpf','icesupport','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','getDataValue','internal','email','toLowerCase','ENUM'];(function(_0x4a5a89,_0x5caaa9){var _0x508585=function(_0x534704){while(--_0x534704){_0x4a5a89['push'](_0x4a5a89['shift']());}};_0x508585(++_0x5caaa9);}(_0x491b,0x154));var _0xb491=function(_0x194dbf,_0x5035b1){_0x194dbf=_0x194dbf-0x0;var _0xc46816=_0x491b[_0x194dbf];return _0xc46816;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb491('0x0'));var util=require(_0xb491('0x1'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xb491('0x2')],'allowNull':![],'unique':_0xb491('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x42c393){this['setDataValue'](_0xb491('0x3'),_0x42c393);this[_0xb491('0x4')]('defaultuser',_0x42c393);},'comment':_0xb491('0x5')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x31f32d){this[_0xb491('0x4')]('fullname',_0x31f32d);this[_0xb491('0x4')](_0xb491('0x6'),util['format']('\x22%s\x22\x20<%s>',_0x31f32d,this[_0xb491('0x7')](_0xb491('0x8'))));}},'alias':{'type':Sequelize[_0xb491('0x2')]},'email':{'type':Sequelize[_0xb491('0x2')],'allowNull':![],'unique':_0xb491('0x9'),'validate':{'isEmail':!![]},'set':function(_0x338e27){if(_0x338e27){this[_0xb491('0x4')]('email',_0x338e27[_0xb491('0xa')]());}}},'role':{'type':Sequelize[_0xb491('0xb')]('admin',_0xb491('0xc'),'agent',_0xb491('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0xb491('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb491('0x2')],'defaultValue':_0xb491('0xe')},'internal':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':![],'unique':_0xb491('0x8'),'set':function(_0x4001a2){this['setDataValue']('internal',_0x4001a2);this[_0xb491('0x4')](_0xb491('0x10'),_0x4001a2);this[_0xb491('0x4')](_0xb491('0x6'),util[_0xb491('0x11')](_0xb491('0x12'),this[_0xb491('0x7')](_0xb491('0x13')),_0x4001a2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb491('0x2')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xb491('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb491('0x2')]},'city':{'type':Sequelize[_0xb491('0x2')]},'country':{'type':Sequelize[_0xb491('0x2')]},'online':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb491('0x2')],'defaultValue':_0xb491('0x15')},'lastPauseAt':{'type':Sequelize[_0xb491('0x16')]},'chatCapacity':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb491('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb491('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xb491('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x17'),'user',_0xb491('0x18')),'allowNull':!![],'defaultValue':_0xb491('0x17')},'context':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![],'defaultValue':_0xb491('0x19')},'callingpres':{'type':Sequelize[_0xb491('0xb')]('ALLOWED_NOT_SCREENED',_0xb491('0x1a'),_0xb491('0x1b'),'ALLOWED',_0xb491('0x1c'),_0xb491('0x1d'),'PROHIB_FAILED_SCREEN',_0xb491('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb491('0x1f'),'set':function(_0x5a1712){this[_0xb491('0x4')](_0xb491('0x20'),_0x5a1712?_0x5a1712[_0xb491('0x21')](','):null);},'get':function(){return this['getDataValue'](_0xb491('0x20'))?this['getDataValue'](_0xb491('0x20'))[_0xb491('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xb491('0xb')]('rfc2833',_0xb491('0x23'),_0xb491('0x24'),_0xb491('0x25'),_0xb491('0x26')),'allowNull':!![],'defaultValue':_0xb491('0x27')},'directmedia':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no',_0xb491('0x29'),_0xb491('0x2a'),_0xb491('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![],'defaultValue':_0xb491('0x2c'),'set':function(_0x3b6b5b){this[_0xb491('0x4')](_0xb491('0x2d'),_0x3b6b5b?_0x3b6b5b[_0xb491('0x21')](','):null);},'get':function(){return this[_0xb491('0x7')](_0xb491('0x2d'))?this[_0xb491('0x7')](_0xb491('0x2d'))[_0xb491('0x22')](','):null;},'comment':_0xb491('0x2e')},'callgroup':{'type':Sequelize[_0xb491('0x2')]},'namedcallgroup':{'type':Sequelize[_0xb491('0x2')]},'pickupgroup':{'type':Sequelize[_0xb491('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xb491('0x2')]},'language':{'type':Sequelize[_0xb491('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb491('0x2')]},'disallow':{'type':Sequelize[_0xb491('0x2')],'allowNull':![],'defaultValue':_0xb491('0x2f')},'allow':{'type':Sequelize[_0xb491('0x2')],'allowNull':![],'defaultValue':_0xb491('0x30'),'set':function(_0x1d79c8){this['setDataValue'](_0xb491('0x31'),_0x1d79c8?_0x1d79c8['join'](';'):_0xb491('0x30'));},'get':function(){return this[_0xb491('0x7')](_0xb491('0x31'))?this[_0xb491('0x7')](_0xb491('0x31'))[_0xb491('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![],'set':function(_0x1a28cc){this[_0xb491('0x4')](_0xb491('0x32'),_0x1a28cc?_0x1a28cc[_0xb491('0x21')](','):null);},'get':function(){return this[_0xb491('0x7')](_0xb491('0x32'))?this[_0xb491('0x7')]('insecure')['split'](','):null;},'comment':_0xb491('0x33')},'trustrpid':{'type':Sequelize[_0xb491('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb491('0xb')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb491('0xb')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'allowNull':!![],'defaultValue':_0xb491('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no',_0xb491('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xb491('0x35'),_0xb491('0x36'),_0xb491('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb491('0xb')]('uac',_0xb491('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb491('0xb')]('yes','no'),'allowNull':!![],'defaultValue':_0xb491('0x28')},'keepalive':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb491('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb491('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb491('0xb')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no',_0xb491('0x39'),_0xb491('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb491('0xb')]('active','passive',_0xb491('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb491('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb491('0xb')](_0xb491('0x28'),'no',_0xb491('0x29'),_0xb491('0x2a'),_0xb491('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb491('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xb491('0x16')]},'passwordResetAt':{'type':Sequelize[_0xb491('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb491('0x3d')]},'showWebBar':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0,'set':function(_0x1ff1d4){this[_0xb491('0x4')](_0xb491('0x3e'),_0x1ff1d4);var _0x2cc8e4=this[_0xb491('0x3f')]({'plain':!![]});switch(_0x1ff1d4){case 0x0:case 0x1:var _0x743069=_0x2cc8e4[_0xb491('0x20')]?_[_0xb491('0x40')](_0x2cc8e4['transport'])?_0x2cc8e4[_0xb491('0x20')][_0xb491('0x21')]():_0x2cc8e4[_0xb491('0x20')]:'udp';if(_0x743069===_0xb491('0x41')){_0x743069='udp';}this[_0xb491('0x4')](_0xb491('0x20'),_0x743069);this[_0xb491('0x4')]('encryption','no');this[_0xb491('0x4')]('avpf',null);this['setDataValue'](_0xb491('0x42'),null);this[_0xb491('0x4')]('icesupport',null);this['setDataValue'](_0xb491('0x43'),null);this[_0xb491('0x4')]('dtlsverify',null);this[_0xb491('0x4')](_0xb491('0x44'),null);this['setDataValue'](_0xb491('0x45'),null);this['setDataValue'](_0xb491('0x46'),null);this[_0xb491('0x4')](_0xb491('0x47'),'no');break;case 0x2:this[_0xb491('0x4')](_0xb491('0x20'),'wss');this[_0xb491('0x4')](_0xb491('0x48'),_0xb491('0x28'));this[_0xb491('0x4')](_0xb491('0x49'),_0xb491('0x28'));this[_0xb491('0x4')]('force_avp',_0xb491('0x28'));this['setDataValue'](_0xb491('0x4a'),_0xb491('0x28'));this[_0xb491('0x4')](_0xb491('0x43'),_0xb491('0x28'));this['setDataValue'](_0xb491('0x4b'),'no');this[_0xb491('0x4')](_0xb491('0x44'),_0xb491('0x3b'));this[_0xb491('0x4')](_0xb491('0x45'),_0x2cc8e4[_0xb491('0x45')]||_0xb491('0x4c'));this[_0xb491('0x4')]('dtlsprivatekey',_0x2cc8e4[_0xb491('0x46')]||_0xb491('0x4d'));this[_0xb491('0x4')](_0xb491('0x47'),_0xb491('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0xb491('0x3d')],'set':function(_0x12e2b1){this[_0xb491('0x4')](_0xb491('0x4e'),_0x12e2b1?_0x12e2b1[_0xb491('0x21')](','):[]);},'get':function(){return this[_0xb491('0x7')]('permissions')?_[_0xb491('0x4f')](this[_0xb491('0x7')](_0xb491('0x4e'))['split'](','),function(_0x544763){return parseInt(_0x544763,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb491('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xb491('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb491('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb491('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb491('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb491('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb491('0x50')],'get':function(){return this[_0xb491('0x7')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb491('0x7')](_0xb491('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb491('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb491('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![],'set':function(_0x16a116){if(typeof _0x16a116===_0xb491('0x52')){var _0x4c990c=_0x16a116==='1'?!![]:_0x16a116==='0'?![]:_0x16a116===_0xb491('0x53')?!![]:_0x16a116===_0xb491('0x54')?![]:![];this[_0xb491('0x4')](_0xb491('0x55'),_0x4c990c);}else{this['setDataValue'](_0xb491('0x55'),_0x16a116);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3d7a04){this[_0xb491('0x4')]('blocked',_0x3d7a04);if(_0x3d7a04===!![]){this['setDataValue'](_0xb491('0x56'),moment());this[_0xb491('0x4')](_0xb491('0x57'),0x0);}else{this[_0xb491('0x4')](_0xb491('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xb491('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb491('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb491('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb491('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xb491('0xf')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xb491('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x4192=['INTEGER','internal','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','rfc2833','info','shortinfo','inband','nonat','yes','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','refuse','originate','uas','certificate','passive','actpass','update','update,nonat','TEXT','showWebBar','get','wss','encryption','force_avp','icesupport','dtlsverify','dtlssetup','rtcp_mux','avpf','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','user','local'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0x4192,0xe3));var _0x2419=function(_0x5b2a15,_0xd200ec){_0x5b2a15=_0x5b2a15-0x0;var _0x33038d=_0x4192[_0x5b2a15];return _0x33038d;};'use strict';var Sequelize=require(_0x2419('0x0'));var moment=require(_0x2419('0x1'));var util=require(_0x2419('0x2'));var _=require('lodash');module[_0x2419('0x3')]={'name':{'type':Sequelize[_0x2419('0x4')],'allowNull':![],'unique':_0x2419('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xa2ac78){this[_0x2419('0x6')](_0x2419('0x5'),_0xa2ac78);this[_0x2419('0x6')](_0x2419('0x7'),_0xa2ac78);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x2419('0x4')],'allowNull':![],'set':function(_0xfe7f4e){this[_0x2419('0x6')](_0x2419('0x8'),_0xfe7f4e);this[_0x2419('0x6')](_0x2419('0x9'),util['format'](_0x2419('0xa'),_0xfe7f4e,this[_0x2419('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x2419('0x4')]},'email':{'type':Sequelize[_0x2419('0x4')],'allowNull':![],'unique':_0x2419('0xc'),'validate':{'isEmail':!![]},'set':function(_0x21a75a){if(_0x21a75a){this['setDataValue'](_0x2419('0xc'),_0x21a75a['toLowerCase']());}}},'role':{'type':Sequelize[_0x2419('0xd')]('admin',_0x2419('0xe'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x2419('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x2419('0xf')},'internal':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':![],'unique':_0x2419('0x11'),'set':function(_0x2b25cf){this[_0x2419('0x6')](_0x2419('0x11'),_0x2b25cf);this[_0x2419('0x6')]('accountcode',_0x2b25cf);this[_0x2419('0x6')](_0x2419('0x9'),util[_0x2419('0x12')](_0x2419('0xa'),this[_0x2419('0xb')](_0x2419('0x8')),_0x2b25cf));}},'salt':{'type':Sequelize[_0x2419('0x4')]},'phone':{'type':Sequelize[_0x2419('0x4')]},'mobile':{'type':Sequelize[_0x2419('0x4')]},'address':{'type':Sequelize[_0x2419('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2419('0x4')]},'city':{'type':Sequelize[_0x2419('0x4')]},'country':{'type':Sequelize[_0x2419('0x4')]},'online':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2419('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2419('0x4')],'defaultValue':_0x2419('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2419('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x2419('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x16'),_0x2419('0xe'),_0x2419('0x17')),'allowNull':!![],'defaultValue':_0x2419('0x16')},'context':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![],'defaultValue':_0x2419('0x18')},'callingpres':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x19'),_0x2419('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x2419('0x1b'),_0x2419('0x1c'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![],'defaultValue':_0x2419('0x1d'),'set':function(_0x51858a){this[_0x2419('0x6')]('transport',_0x51858a?_0x51858a[_0x2419('0x1e')](','):null);},'get':function(){return this[_0x2419('0xb')](_0x2419('0x1f'))?this[_0x2419('0xb')]('transport')[_0x2419('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x21'),_0x2419('0x22'),_0x2419('0x23'),_0x2419('0x24'),'auto'),'allowNull':!![],'defaultValue':_0x2419('0x21')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x2419('0x25'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5a16c8){this[_0x2419('0x6')](_0x2419('0x27'),_0x5a16c8?_0x5a16c8['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x2419('0xb')](_0x2419('0x27'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2419('0x4')]},'namedcallgroup':{'type':Sequelize[_0x2419('0x4')]},'pickupgroup':{'type':Sequelize[_0x2419('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x2419('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2419('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2419('0x28')},'allow':{'type':Sequelize[_0x2419('0x4')],'allowNull':![],'defaultValue':_0x2419('0x29'),'set':function(_0x5e9f85){this[_0x2419('0x6')](_0x2419('0x2a'),_0x5e9f85?_0x5e9f85[_0x2419('0x1e')](';'):_0x2419('0x29'));},'get':function(){return this[_0x2419('0xb')](_0x2419('0x2a'))?this['getDataValue'](_0x2419('0x2a'))[_0x2419('0x20')](';'):null;},'comment':_0x2419('0x2b')},'autoframing':{'type':Sequelize[_0x2419('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![],'set':function(_0x5ad9cf){this[_0x2419('0x6')](_0x2419('0x2c'),_0x5ad9cf?_0x5ad9cf[_0x2419('0x1e')](','):null);},'get':function(){return this['getDataValue'](_0x2419('0x2c'))?this['getDataValue'](_0x2419('0x2c'))[_0x2419('0x20')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2419('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![],'defaultValue':_0x2419('0x2d')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':_0x2419('0x26')},'busylevel':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no',_0x2419('0x2e')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x2419('0x2f'),_0x2419('0x30')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2419('0xd')]('uac',_0x2419('0x31')),'allowNull':!![],'defaultValue':_0x2419('0x31')},'t38pt_usertpsource':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':_0x2419('0x26')},'keepalive':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no','fingerprint',_0x2419('0x32')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2419('0xd')]('active',_0x2419('0x33'),_0x2419('0x34')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2419('0xd')](_0x2419('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2419('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no',_0x2419('0x25'),_0x2419('0x35'),_0x2419('0x36')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x2419('0x14')]},'passwordResetAt':{'type':Sequelize[_0x2419('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2419('0x37')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x13d912){this['setDataValue'](_0x2419('0x38'),_0x13d912);var _0x2d6d2f=this[_0x2419('0x39')]({'plain':!![]});switch(_0x13d912){case 0x0:case 0x1:var _0x4c2797=_0x2d6d2f[_0x2419('0x1f')]?_['isArray'](_0x2d6d2f['transport'])?_0x2d6d2f[_0x2419('0x1f')]['join']():_0x2d6d2f['transport']:_0x2419('0x1d');if(_0x4c2797===_0x2419('0x3a')){_0x4c2797=_0x2419('0x1d');}this[_0x2419('0x6')]('transport',_0x4c2797);this[_0x2419('0x6')](_0x2419('0x3b'),'no');this[_0x2419('0x6')]('avpf',null);this['setDataValue'](_0x2419('0x3c'),null);this['setDataValue'](_0x2419('0x3d'),null);this['setDataValue']('dtlsenable',null);this[_0x2419('0x6')](_0x2419('0x3e'),null);this[_0x2419('0x6')](_0x2419('0x3f'),null);this['setDataValue']('dtlscertfile',null);this[_0x2419('0x6')]('dtlsprivatekey',null);this[_0x2419('0x6')](_0x2419('0x40'),'no');break;case 0x2:this['setDataValue'](_0x2419('0x1f'),'wss');this['setDataValue'](_0x2419('0x3b'),_0x2419('0x26'));this[_0x2419('0x6')](_0x2419('0x41'),_0x2419('0x26'));this[_0x2419('0x6')](_0x2419('0x3c'),_0x2419('0x26'));this[_0x2419('0x6')](_0x2419('0x3d'),_0x2419('0x26'));this[_0x2419('0x6')]('dtlsenable',_0x2419('0x26'));this[_0x2419('0x6')](_0x2419('0x3e'),'no');this[_0x2419('0x6')](_0x2419('0x3f'),_0x2419('0x34'));this[_0x2419('0x6')](_0x2419('0x42'),_0x2d6d2f['dtlscertfile']||_0x2419('0x43'));this[_0x2419('0x6')](_0x2419('0x44'),_0x2d6d2f[_0x2419('0x44')]||_0x2419('0x45'));this[_0x2419('0x6')](_0x2419('0x40'),_0x2419('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0x2419('0x37')],'set':function(_0x49399d){this['setDataValue']('permissions',_0x49399d?_0x49399d[_0x2419('0x1e')](','):[]);},'get':function(){return this[_0x2419('0xb')](_0x2419('0x46'))?_[_0x2419('0x47')](this[_0x2419('0xb')]('permissions')[_0x2419('0x20')](','),function(_0x3bde8b){return parseInt(_0x3bde8b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2419('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2419('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2419('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2419('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2419('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2419('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x2419('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2419('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2419('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2419('0x48')],'get':function(){return this[_0x2419('0xb')](_0x2419('0x49'))?this[_0x2419('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2419('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2419('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![],'set':function(_0x1a75c7){if(typeof _0x1a75c7==='string'){var _0x463ca6=_0x1a75c7==='1'?!![]:_0x1a75c7==='0'?![]:_0x1a75c7===_0x2419('0x4a')?!![]:_0x1a75c7===_0x2419('0x4b')?![]:![];this[_0x2419('0x6')](_0x2419('0x4c'),_0x463ca6);}else{this['setDataValue'](_0x2419('0x4c'),_0x1a75c7);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x43334a){this[_0x2419('0x6')](_0x2419('0x4d'),_0x43334a);if(_0x43334a===!![]){this[_0x2419('0x6')](_0x2419('0x4e'),moment());this['setDataValue'](_0x2419('0x4f'),0x0);}else{this['setDataValue'](_0x2419('0x4e'),null);}}},'blockedAt':{'type':Sequelize[_0x2419('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2419('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2419('0x10')](0x5)[_0x2419('0x50')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2419('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2419('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x2419('0x10')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x2419('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 671a1bf..a6c5c05 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 _0x518d=['ui.','InteractionId','ui.createdAt','user_has_','_interactions','enabled','util','path','lodash','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','end','json','offset','undefined','count','status','set','update','role','agent','then','get','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','destroy','sendStatus','error','stack','name','send','User','rawAttributes','fieldName','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','index','where','query','true','userSetting','attributes','push','findAll','rows','length','chat','dataValues','fax','mail','openchannel','all','catch','show','getOptions','includeAll','UserSetting','options','openTabs','whatsapp','body','params','describe','addContacts','ids','omit','Setting','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','105','107','108','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','passwordHistoryLimit','enforcePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','online','format','SIP/%s','UserVoiceQueueRt','upsert','remove','isArray','Queue:remove','addAvatar','file','filename','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','sms','CHAT','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','WHATSAPP','concat','getContacts','findOne','hasOwnProperty','include','CmList','List','Tags','color','tag','getQueues','model','Queue','keys','filters','intersection','fields','sort','pick','merge','Unknown\x20role','limit','getVoiceQueuesRt','order','ChatGroup','getGroups','nolimit','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','updateAttributes','type','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','flattenDeep','removeAgent','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','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','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$gt','$gte','$lt','$ne','$eq','$not','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','firstName','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','getUserSetting','getPresence','idle','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','pause','unavailable','voiceStatus','busy','slice','toUpperCase','field'];(function(_0x19eb43,_0x10c355){var _0x57598c=function(_0x1d32c6){while(--_0x1d32c6){_0x19eb43['push'](_0x19eb43['shift']());}};_0x57598c(++_0x10c355);}(_0x518d,0x188));var _0xd518=function(_0x342a9c,_0x18b3e0){_0x342a9c=_0x342a9c-0x0;var _0x3b9963=_0x518d[_0x342a9c];return _0x3b9963;};'use strict';var moment=require('moment');var util=require(_0xd518('0x0'));var path=require(_0xd518('0x1'));var fs=require('fs');var _=require(_0xd518('0x2'));var squel=require('squel');var Redis=require(_0xd518('0x3'));var authService=require(_0xd518('0x4'));var contacts=require(_0xd518('0x5'));var qs=require('../../components/parsers/qs');var rta=require(_0xd518('0x6'));var logger=require('../../config/logger')(_0xd518('0x7'));var utils=require(_0xd518('0x8'));var config=require('../../config/environment');var licenseUtil=require(_0xd518('0x9'));var APIBadRequestError=require(_0xd518('0xa'))[_0xd518('0xb')];var APINotFoundError=require(_0xd518('0xa'))['APINotFoundError'];var APIForbiddenError=require(_0xd518('0xa'))['APIForbiddenrror'];var APIHandleError=require(_0xd518('0xa'))[_0xd518('0xc')];var db=require(_0xd518('0xd'))['db'];var socket=require(_0xd518('0xe'))(new Redis(config[_0xd518('0xf')]));require(_0xd518('0x10'))[_0xd518('0x11')](socket);config[_0xd518('0xf')]=_[_0xd518('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x537917,_0x1a1bca){_0x1a1bca=_0x1a1bca||0xcc;return function(_0x48c8e1){if(_0x48c8e1){return _0x537917['sendStatus'](_0x1a1bca);}return _0x537917['status'](_0x1a1bca)[_0xd518('0x13')]();};}function respondWithResult(_0xe767d3,_0x16e605){_0x16e605=_0x16e605||0xc8;return function(_0x27d735){if(_0x27d735){return _0xe767d3['status'](_0x16e605)[_0xd518('0x14')](_0x27d735);}};}function respondWithFilteredResult(_0x52159e,_0x27ef2e){return function(_0xb72e52){if(_0xb72e52){var _0x56510d=typeof _0x27ef2e[_0xd518('0x15')]===_0xd518('0x16')&&typeof _0x27ef2e['limit']==='undefined';var _0x3aa095=_0xb72e52[_0xd518('0x17')];var _0xba363a=_0x56510d?0x0:_0x27ef2e[_0xd518('0x15')];var _0x284a2c=_0x56510d?_0xb72e52[_0xd518('0x17')]:_0x27ef2e[_0xd518('0x15')]+_0x27ef2e['limit'];var _0x56e917;if(_0x284a2c>=_0x3aa095){_0x284a2c=_0x3aa095;_0x56e917=0xc8;}else{_0x56e917=0xce;}_0x52159e[_0xd518('0x18')](_0x56e917);return _0x52159e[_0xd518('0x19')]('Content-Range',_0xba363a+'-'+_0x284a2c+'/'+_0x3aa095)['json'](_0xb72e52);}return null;};}function saveUpdates(_0x28e041){return function(_0x28e14f){if(_0x28e14f){return _0x28e14f[_0xd518('0x1a')](_0x28e041)['then'](function(_0xd2826b){if(_0xd2826b[_0xd518('0x1b')]===_0xd518('0x1c')){socket['emit']('userNotification:recalc:'+_0xd2826b['id'],_0xd2826b);}return _0xd2826b;});}return null;};}function removeEntity(_0xd43413,_0x4e9b58){return function(_0x50ffdd){if(_0x50ffdd){return _0x50ffdd['destroy']({'transaction':_0x4e9b58})[_0xd518('0x1d')](function(){var _0x3d2cf5=_0x50ffdd[_0xd518('0x1e')]({'plain':!![]});if(_0x3d2cf5[_0xd518('0x1b')]===_0xd518('0x1f'))return;var _0x9b2e8f=[{'name':_0xd518('0x20'),'value':_0xd518('0x21'),'ignore':!![]},{'name':_0xd518('0x22'),'value':'agent','ignore':![]},{'name':_0xd518('0x23'),'value':_0xd518('0x24'),'ignore':![]}];var _0x2b5bf4=_(_0x9b2e8f)[_0xd518('0x25')](_0xd518('0x26'))[_0xd518('0x27')]('value')[_0xd518('0x28')]();if(_[_0xd518('0x29')](_0x2b5bf4,_0x3d2cf5[_0xd518('0x1b')])){return;}var _0xdc7535=_[_0xd518('0x2a')](_0x9b2e8f,['value',_0x3d2cf5[_0xd518('0x1b')]])['name'];return db[_0xd518('0x2b')][_0xd518('0x2c')]({'where':{'type':_0xdc7535,'resourceId':_0x3d2cf5['id']},'transaction':_0x4e9b58})[_0xd518('0x1d')](function(){return _0x50ffdd;});})[_0xd518('0x1d')](function(){_0xd43413['status'](0xcc)[_0xd518('0x13')]();});}};}function handleEntityNotFound(_0x5a7fa0){return function(_0x8bc4fd){if(!_0x8bc4fd){_0x5a7fa0[_0xd518('0x2d')](0x194);}return _0x8bc4fd;};}function handleError(_0xbcfc58,_0x22cf4b){_0x22cf4b=_0x22cf4b||0x1f4;return function(_0x2e195b){logger[_0xd518('0x2e')](_0x2e195b[_0xd518('0x2f')]);if(_0x2e195b[_0xd518('0x30')]){delete _0x2e195b[_0xd518('0x30')];}_0xbcfc58['status'](_0x22cf4b)[_0xd518('0x31')](_0x2e195b);};}function getUserAttributes(){return _(db[_0xd518('0x32')][_0xd518('0x33')])['map'](function(_0x590801){return{'name':_0x590801[_0xd518('0x34')],'type':_0x590801['type'][_0xd518('0x35')]};})[_0xd518('0x25')](function(_0x5a7de1){return![_0xd518('0x36'),_0xd518('0x37'),_0xd518('0x38'),_0xd518('0x39'),_0xd518('0x3a'),'md5secret'][_0xd518('0x29')](_0x5a7de1[_0xd518('0x30')]);})['value']();}exports[_0xd518('0x3b')]=function(_0x3662ed,_0x2d42d1){var _0x14939b={},_0x38c429={'count':0x0,'rows':[]};var _0x52b275=getUserAttributes();_0x14939b=qs['getOptions'](_0x52b275,_0x3662ed);var _0x4b4025={'where':_0x14939b[_0xd518('0x3c')]};return db[_0xd518('0x32')][_0xd518('0x17')](_0x4b4025)['then'](function(_0x26787f){_0x38c429['count']=_0x26787f;if(_0x3662ed[_0xd518('0x3d')]['includeAll']){_0x14939b['include']=[{'all':!![]}];}if(_0x3662ed[_0xd518('0x3d')]['userSetting']===_0xd518('0x3e')){_0x14939b['include']=[{'model':db['UserSetting'],'as':_0xd518('0x3f')}];}if(!_[_0xd518('0x29')](_0x14939b[_0xd518('0x40')],'id')){_0x14939b[_0xd518('0x40')][_0xd518('0x41')]('id');}return db['User'][_0xd518('0x42')](_0x14939b);})['then'](function(_0x5d25f4){_0x38c429[_0xd518('0x43')]=_0x5d25f4;if(_0x3662ed['query']['openTabs']===_0xd518('0x3e')){var _0x58ebe3=[];for(var _0x5ae782=0x0;_0x5ae782<_0x38c429[_0xd518('0x43')][_0xd518('0x44')];_0x5ae782++){_0x58ebe3['push'](get_open_tabs(_0xd518('0x45'),_0x38c429['rows'][_0x5ae782][_0xd518('0x46')]));_0x58ebe3[_0xd518('0x41')](get_open_tabs('sms',_0x38c429[_0xd518('0x43')][_0x5ae782][_0xd518('0x46')]));_0x58ebe3['push'](get_open_tabs(_0xd518('0x47'),_0x38c429[_0xd518('0x43')][_0x5ae782][_0xd518('0x46')]));_0x58ebe3[_0xd518('0x41')](get_open_tabs(_0xd518('0x48'),_0x38c429[_0xd518('0x43')][_0x5ae782][_0xd518('0x46')]));_0x58ebe3[_0xd518('0x41')](get_open_tabs(_0xd518('0x49'),_0x38c429['rows'][_0x5ae782][_0xd518('0x46')]));_0x58ebe3['push'](get_open_tabs('whatsapp',_0x38c429[_0xd518('0x43')][_0x5ae782][_0xd518('0x46')]));}return Promise[_0xd518('0x4a')](_0x58ebe3)[_0xd518('0x1d')](function(){return _0x38c429;});}else{return _0x38c429;}})[_0xd518('0x1d')](respondWithFilteredResult(_0x2d42d1,_0x14939b))[_0xd518('0x4b')](handleError(_0x2d42d1,null));};exports[_0xd518('0x4c')]=function(_0x75dc1d,_0x4054da){var _0x5b765e=getUserAttributes();_0x75dc1d[_0xd518('0x3d')]['id']=_0x75dc1d['params']['id'];var _0x5d9789=qs[_0xd518('0x4d')](_0x5b765e,_0x75dc1d);if(_0x75dc1d[_0xd518('0x3d')][_0xd518('0x4e')]){_0x5d9789['include']=[{'all':!![]}];}if(_0x75dc1d[_0xd518('0x3d')][_0xd518('0x3f')]===_0xd518('0x3e')){_0x5d9789['include']=[{'model':db[_0xd518('0x4f')],'as':_0xd518('0x3f')}];}_0x5d9789=_['merge']({},_0x5d9789,_0x75dc1d[_0xd518('0x50')]);if(!_[_0xd518('0x29')](_0x5d9789[_0xd518('0x40')],'id')){_0x5d9789[_0xd518('0x40')]['push']('id');}return db[_0xd518('0x32')][_0xd518('0x2a')](_0x5d9789)['then'](handleEntityNotFound(_0x4054da,null))['then'](function(_0x5184d4){var _0x4c00e3=[];values=_0x5184d4;if(_0x75dc1d[_0xd518('0x3d')][_0xd518('0x51')]===_0xd518('0x3e')){_0x4c00e3[_0xd518('0x41')](get_open_tabs(_0xd518('0x45'),_0x5184d4[_0xd518('0x46')]));_0x4c00e3['push'](get_open_tabs('sms',_0x5184d4['dataValues']));_0x4c00e3[_0xd518('0x41')](get_open_tabs(_0xd518('0x49'),_0x5184d4['dataValues']));_0x4c00e3[_0xd518('0x41')](get_open_tabs(_0xd518('0x52'),_0x5184d4[_0xd518('0x46')]));_0x4c00e3[_0xd518('0x41')](get_open_tabs(_0xd518('0x47'),_0x5184d4[_0xd518('0x46')]));_0x4c00e3[_0xd518('0x41')](get_open_tabs(_0xd518('0x48'),_0x5184d4[_0xd518('0x46')]));return Promise[_0xd518('0x4a')](_0x4c00e3);}else{return values;}})[_0xd518('0x1d')](function(){return values;})[_0xd518('0x1d')](respondWithResult(_0x4054da,null))[_0xd518('0x4b')](handleError(_0x4054da,null));};exports[_0xd518('0x1a')]=function(_0x56c052,_0x40be17){if(_0x56c052[_0xd518('0x53')]['id']){delete _0x56c052['body']['id'];}delete _0x56c052[_0xd518('0x53')][_0xd518('0x1b')];return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0x56c052[_0xd518('0x54')]['id']}})['then'](handleEntityNotFound(_0x40be17,null))[_0xd518('0x1d')](saveUpdates(_0x56c052[_0xd518('0x53')],null))[_0xd518('0x1d')](respondWithResult(_0x40be17,null))[_0xd518('0x4b')](handleError(_0x40be17,null));};exports[_0xd518('0x55')]=function(_0x30f987,_0x19463f){return db[_0xd518('0x32')][_0xd518('0x55')]()['then'](respondWithResult(_0x19463f,null))[_0xd518('0x4b')](handleError(_0x19463f,null));};exports['addContacts']=function(_0x1e4bcf,_0x444951){return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0x1e4bcf[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x444951,null))[_0xd518('0x1d')](function(_0x46749f){if(_0x46749f){return _0x46749f[_0xd518('0x56')](_0x1e4bcf[_0xd518('0x53')][_0xd518('0x57')],_[_0xd518('0x58')](_0x1e4bcf[_0xd518('0x53')],[_0xd518('0x57'),'id'])||{});}})['then'](respondWithResult(_0x444951,null))[_0xd518('0x4b')](handleError(_0x444951,null));};function validateUser(_0x1c286c){return new Promise(function(_0x6e7368,_0x5ba13f){if(_0x1c286c['internal'])return _0x6e7368(_0x1c286c);return db[_0xd518('0x59')]['findById'](0x1)[_0xd518('0x1d')](function(_0x1f532e){if(_0x1f532e[_0xd518('0x5a')])authService[_0xd518('0x5b')](_0x1c286c[_0xd518('0x36')]);db[_0xd518('0x32')][_0xd518('0x5c')](_0xd518('0x5d'))[_0xd518('0x1d')](function(_0x36d3e2){if(_[_0xd518('0x5e')](_0x36d3e2)){_0x1c286c['internal']=_0x1f532e[_0xd518('0x5f')]||0x1;return;}if(_['isNil'](_0x1f532e['min_internal'])||_0x1f532e['min_internal']===_0x36d3e2){_0x1c286c[_0xd518('0x5d')]=_0x36d3e2+0x1;return;}if(_0x1f532e[_0xd518('0x5f')]>_0x36d3e2){_0x1c286c['internal']=_0x1f532e[_0xd518('0x5f')];return;}return db[_0xd518('0x60')]['query'](_0xd518('0x61'),{'type':db[_0xd518('0x60')][_0xd518('0x62')][_0xd518('0x63')]})[_0xd518('0x1d')](function(_0x2c5388){if(_0x2c5388&&_0x2c5388[_0xd518('0x44')]){for(var _0x147b54=0x0,_0x24ad93=_0x2c5388[_0xd518('0x44')];_0x147b54<_0x24ad93&&_[_0xd518('0x5e')](_0x1c286c[_0xd518('0x5d')]);_0x147b54++){if(_0x1f532e[_0xd518('0x5f')]<=_0x2c5388[_0x147b54]['from']){_0x1c286c[_0xd518('0x5d')]=_0x2c5388[_0x147b54][_0xd518('0x64')];}else if(_0x1f532e[_0xd518('0x5f')]>_0x2c5388[_0x147b54][_0xd518('0x64')]&&_0x1f532e[_0xd518('0x5f')]<=_0x2c5388[_0x147b54]['to']){_0x1c286c['internal']=_0x1f532e['min_internal'];}}}if(_[_0xd518('0x5e')](_0x1c286c[_0xd518('0x5d')])){_0x1c286c[_0xd518('0x5d')]=_0x36d3e2+0x1;}return _0x6e7368(_0x1c286c);});});})[_0xd518('0x4b')](function(_0x4da101){_0x5ba13f(_0x4da101);});});}function updateUser(_0x531f60){return new Promise(function(_0x23bc3f,_0x45881c){try{if(_0x531f60[_0xd518('0x65')]){_0x531f60[_0xd518('0x66')]=_0x531f60[_0xd518('0x5d')];_0x531f60[_0xd518('0x67')]={'mailbox':_0x531f60['internal'],'password':_0x531f60[_0xd518('0x36')],'fullname':_0x531f60['fullname'],'email':_0x531f60[_0xd518('0x68')]};}if(_0x531f60[_0xd518('0x1b')]===_0xd518('0x1c')){if(!_0x531f60[_0xd518('0x69')])_0x531f60[_0xd518('0x69')]=[_0xd518('0x6a'),_0xd518('0x6b'),_0xd518('0x6c'),_0xd518('0x6d'),_0xd518('0x6e'),'104',_0xd518('0x6f'),'106',_0xd518('0x70'),_0xd518('0x71'),'109',_0xd518('0x72'),_0xd518('0x73'),_0xd518('0x74'),_0xd518('0x75')];}_0x23bc3f(_0x531f60);}catch(_0x417d45){_0x45881c(_0x417d45);}});}exports[_0xd518('0x76')]=function(_0x29b74d,_0x251276){if(_0x29b74d[_0xd518('0x21')]['role']===_0xd518('0x1c'))throw new Error(_0xd518('0x77'));if(_0x29b74d[_0xd518('0x53')][_0xd518('0x1b')]===_0xd518('0x21')&&_0x29b74d['user'][_0xd518('0x1b')]!==_0xd518('0x1f')){throw new Error(_0xd518('0x78'));}if(_0x29b74d[_0xd518('0x53')][_0xd518('0x1b')]==='admin'&&_0x29b74d['user']['role']!==_0xd518('0x1f')){throw new Error(_0xd518('0x79'));}return licenseUtil[_0xd518('0x7a')]([_0x29b74d[_0xd518('0x53')]])['then'](function(){return validateUser(_0x29b74d[_0xd518('0x53')]);})[_0xd518('0x1d')](function(_0x30a4c1){return updateUser(_0x30a4c1)[_0xd518('0x1d')](function(_0x1a294c){if(_0x1a294c['role']===_0xd518('0x1f')){_0x1a294c[_0xd518('0x7b')]=_0x29b74d[_0xd518('0x21')][_0xd518('0x7b')];delete _0x1a294c[_0xd518('0x7c')];}return _0x1a294c;});})[_0xd518('0x1d')](function(_0x54734d){return db['User'][_0xd518('0x76')](_0x54734d,{'include':[{'model':db[_0xd518('0x67')],'as':'VoiceMail'}]});})[_0xd518('0x1d')](function(_0x5bd4bb){if(_0x29b74d[_0xd518('0x53')][_0xd518('0x1b')]===_0xd518('0x21'))return _0x5bd4bb;if(_0x29b74d[_0xd518('0x21')]['role']!=='user')return _0x5bd4bb;return db[_0xd518('0x7d')][_0xd518('0x2a')]({'where':{'name':_0x5bd4bb[_0xd518('0x1b')]===_0xd518('0x1c')?_0xd518('0x22'):_0xd518('0x23'),'userProfileId':_0x29b74d['user']['userProfileId']},'raw':!![]})[_0xd518('0x1d')](function(_0x297419){if(!_0x297419||_0x297419[_0xd518('0x7e')]!=0x0)return _0x5bd4bb;return db['UserProfileResource'][_0xd518('0x76')]({'name':_0x5bd4bb[_0xd518('0x30')],'resourceId':_0x5bd4bb['id'],'type':_0x297419[_0xd518('0x30')],'sectionId':_0x297419['id']},{})['then'](function(){return _0x5bd4bb;});})[_0xd518('0x4b')](function(_0x2ed5ba){logger[_0xd518('0x2e')](_0xd518('0x7f'),_0x2ed5ba);throw _0x2ed5ba;});})['then'](respondWithResult(_0x251276,0xc9))[_0xd518('0x4b')](handleError(_0x251276,null));};exports[_0xd518('0x80')]=function(_0x466a79,_0x554e7a){var _0x3f8d6e=_0x466a79['body'];var _0x45cb72=[];if(_0x466a79[_0xd518('0x21')][_0xd518('0x1b')]===_0xd518('0x1c'))throw new Error(_0xd518('0x77'));if(_['some'](_0x3f8d6e,[_0xd518('0x1b'),_0xd518('0x21')])&&_0x466a79['user']['role']!=='admin'){throw new Error(_0xd518('0x78'));}if(_[_0xd518('0x81')](_0x3f8d6e,[_0xd518('0x1b'),'admin'])&&_0x466a79[_0xd518('0x21')][_0xd518('0x1b')]!==_0xd518('0x1f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x3f8d6e)['then'](function(){return validateUser(_0x3f8d6e[0x0]);})[_0xd518('0x1d')](function(){for(var _0x38e72d=0x1;_0x38e72d<_0x3f8d6e[_0xd518('0x44')];_0x38e72d++){var _0xdd8b93=_0x3f8d6e[_0x38e72d-0x1][_0xd518('0x5d')];if(!_0x3f8d6e[_0x38e72d][_0xd518('0x5d')])_0x3f8d6e[_0x38e72d]['internal']=_0xdd8b93+0x1;_0x45cb72[_0xd518('0x41')](validateUser(_0x3f8d6e[_0x38e72d]));}return Promise['all'](_0x45cb72);})[_0xd518('0x1d')](function(){_0x45cb72=[];for(var _0x2c27e8=0x0;_0x2c27e8<_0x3f8d6e[_0xd518('0x44')];_0x2c27e8++){_0x45cb72[_0xd518('0x41')](updateUser(_0x3f8d6e[_0x2c27e8]));}return Promise[_0xd518('0x4a')](_0x45cb72);})[_0xd518('0x1d')](function(){_0x45cb72=_0x3f8d6e['map'](function(_0x5574e3){return db[_0xd518('0x32')][_0xd518('0x76')](_0x5574e3,{'include':[{'model':db[_0xd518('0x67')],'as':'VoiceMail'}]})[_0xd518('0x1d')](function(_0x16e723){_0x5574e3['id']=_0x16e723['id'];return _0x5574e3;});});return Promise[_0xd518('0x4a')](_0x45cb72);})[_0xd518('0x1d')](function(_0x5e6e1f){if(_0x466a79['body'][_0xd518('0x1b')]===_0xd518('0x21'))return _0x5e6e1f;if(_0x466a79[_0xd518('0x21')][_0xd518('0x1b')]!=='user')return _0x5e6e1f;var _0x165a54=_[_0xd518('0x81')](_0x5e6e1f,function(_0x5d6061){return _0x5d6061[_0xd518('0x1b')]===_0xd518('0x1c')||_0x5d6061[_0xd518('0x1b')]===_0xd518('0x24');});if(!_0x165a54)return _0x5e6e1f;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xd518('0x22'),_0xd518('0x23')]},'userProfileId':_0x466a79[_0xd518('0x21')][_0xd518('0x7c')]},'raw':!![]})[_0xd518('0x1d')](function(_0x213d0d){if(_['isEmpty'](_0x213d0d)||!_[_0xd518('0x81')](_0x213d0d,[_0xd518('0x7e'),0x0]))return _0x5e6e1f;_0x45cb72=[];var _0x4f966c=_(_0x213d0d)['map'](function(_0x282575){if(_0x282575[_0xd518('0x7e')]===0x1)return;return _0x282575[_0xd518('0x30')]===_0xd518('0x22')?_0xd518('0x1c'):'telephone';})[_0xd518('0x82')]()[_0xd518('0x28')]();for(var _0x3ba12c=0x0;_0x3ba12c<_0x5e6e1f[_0xd518('0x44')];_0x3ba12c++){if(!_['includes'](_0x4f966c,_0x5e6e1f[_0x3ba12c][_0xd518('0x1b')]))return;var _0x46dbaf=_0x5e6e1f[_0x3ba12c][_0xd518('0x1b')]===_0xd518('0x1c')?_0xd518('0x22'):_0xd518('0x23');_0x45cb72['push'](db[_0xd518('0x2b')]['create']({'name':_0x5e6e1f[_0x3ba12c][_0xd518('0x30')],'resourceId':_0x5e6e1f[_0x3ba12c]['id'],'type':_0x46dbaf,'sectionId':_[_0xd518('0x2a')](_0x213d0d,[_0xd518('0x30'),_0x46dbaf])['id']},{}));}return Promise['all'](_0x45cb72);});})[_0xd518('0x1d')](respondWithResult(_0x554e7a,0xc9))[_0xd518('0x4b')](handleError(_0x554e7a,null));};exports[_0xd518('0x83')]=function(_0x9c31b4,_0x461051){if(_0x9c31b4['body']['id']){delete _0x9c31b4['body']['id'];}return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0x9c31b4[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](function(_0x10e678){if(!_0x10e678)return null;if(_0x10e678['id']===_0x9c31b4[_0xd518('0x21')]['id']){if(!_0x9c31b4[_0xd518('0x53')][_0xd518('0x84')]||!_0x9c31b4[_0xd518('0x53')][_0xd518('0x85')]){throw new db[(_0xd518('0x86'))][(_0xd518('0x87'))](_0xd518('0x88'));}if(!_0x10e678[_0xd518('0x89')](_0x9c31b4[_0xd518('0x53')][_0xd518('0x84')])){throw new db['Sequelize']['ValidationError'](_0xd518('0x8a'));}if(_0x9c31b4['body'][_0xd518('0x84')]===_0x9c31b4['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0xd518('0x8b'));}}else if(_0x9c31b4[_0xd518('0x21')][_0xd518('0x1b')]===_0xd518('0x1f')){if(!_0x9c31b4[_0xd518('0x53')][_0xd518('0x85')]){throw new db[(_0xd518('0x86'))]['ValidationError'](_0xd518('0x8c'));}}else if(_0x9c31b4[_0xd518('0x21')]['role']===_0xd518('0x21')){if(!_0x9c31b4['body'][_0xd518('0x85')]){throw new db['Sequelize'][(_0xd518('0x87'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x10e678[_0xd518('0x1b')]!==_0xd518('0x1c')){throw new db[(_0xd518('0x86'))][(_0xd518('0x87'))](_0xd518('0x77'));}}else{throw new db[(_0xd518('0x86'))][(_0xd518('0x87'))](_0xd518('0x77'));}return _0x10e678;})[_0xd518('0x1d')](handleEntityNotFound(_0x461051,null))[_0xd518('0x1d')](function(_0x1119de){return db[_0xd518('0x59')]['findOne']({'attributes':['id',_0xd518('0x5a'),'enforcePasswordHistory',_0xd518('0x8d')]})[_0xd518('0x1d')](function(_0x298ef3){if(_0x298ef3[_0xd518('0x5a')])authService[_0xd518('0x5b')](_0x9c31b4[_0xd518('0x53')][_0xd518('0x85')]);if(!_0x298ef3[_0xd518('0x8e')]||!_0x1119de['previousPasswords'])return _0x1119de;authService['validatePasswordHistory'](_0x9c31b4[_0xd518('0x53')][_0xd518('0x85')],_0x1119de[_0xd518('0x38')],_0x298ef3[_0xd518('0x8d')]);return _0x1119de;})[_0xd518('0x1d')](saveUpdates({'password':_0x9c31b4[_0xd518('0x53')][_0xd518('0x85')],'passwordResetAt':_0x9c31b4[_0xd518('0x21')]['id']==_0x9c31b4[_0xd518('0x54')]['id']?moment():null,'previousPasswords':authService[_0xd518('0x8f')](_0x9c31b4[_0xd518('0x53')]['newPassword'],_0x1119de[_0xd518('0x38')])},null));})[_0xd518('0x1d')](respondWithResult(_0x461051,null))[_0xd518('0x4b')](handleError(_0x461051,null));};exports[_0xd518('0x90')]=function(_0x5484cf,_0xde1097){var _0x326c64=_0x5484cf[_0xd518('0x53')][_0xd518('0x91')];return db[_0xd518('0x32')]['find']({'where':{'id':_0x5484cf[_0xd518('0x54')]['id']},'attributes':['id',_0xd518('0x30'),'role','online',_0xd518('0x92'),_0xd518('0x93'),_0xd518('0x94')]})[_0xd518('0x1d')](handleEntityNotFound(_0xde1097,null))['then'](function(_0x2b8de8){if(_0x2b8de8){if(!utils[_0xd518('0x95')](_0x326c64)){throw new db[(_0xd518('0x86'))][(_0xd518('0x87'))](_0xd518('0x96'));}return _0x2b8de8[_0xd518('0x97')+_[_0xd518('0x98')](_0x326c64[_0xd518('0x99')]())+_0xd518('0x9a')](_0x5484cf['body'][_0xd518('0x57')],{'penalty':_0x5484cf[_0xd518('0x53')][_0xd518('0x9b')]||0x0})[_0xd518('0x9c')](function(_0x396369){for(var _0x48b51b=0x0;_0x48b51b<_0x5484cf[_0xd518('0x53')][_0xd518('0x57')][_0xd518('0x44')];_0x48b51b+=0x1){var _0x58c821={'UserId':Number(_0x5484cf[_0xd518('0x54')]['id'])};_0x58c821[_[_0xd518('0x98')](_0x326c64[_0xd518('0x99')]())+_0xd518('0x9d')]=Number(_0x5484cf[_0xd518('0x53')][_0xd518('0x57')][_0x48b51b]);socket[_0xd518('0x9e')](_0xd518('0x21')+_[_0xd518('0x98')](_0x326c64['toLowerCase']())+_0xd518('0x9f'),_0x58c821);}return _0x396369;})[_0xd518('0x1d')](function(){if(_0x326c64===_0xd518('0xa0')){return db[_0xd518('0xa1')][_0xd518('0x42')]({'where':{'id':_0x5484cf[_0xd518('0x53')][_0xd518('0x57')]||[]},'raw':!![],'attributes':['id',_0xd518('0x30')]});}})[_0xd518('0x1d')](function(_0x373279){var _0x3722dd=_0x2b8de8[_0xd518('0x1e')]({'plain':!![]});var _0x166948=[];if(_0x326c64===_0xd518('0xa0')&&_0x3722dd[_0xd518('0x1b')]===_0xd518('0x1c')&&_0x3722dd[_0xd518('0xa2')]){for(let _0x11fc01=0x0;_0x11fc01<_0x373279['length'];_0x11fc01+=0x1){_0x166948['push']({'membername':_0x3722dd[_0xd518('0x30')],'UserId':_0x3722dd['id'],'queue_name':_0x373279[_0x11fc01]['name'],'VoiceQueueId':_0x373279[_0x11fc01]['id'],'interface':_[_0xd518('0x5e')](_0x3722dd[_0xd518('0x94')])?util[_0xd518('0xa3')](_0xd518('0xa4'),_0x3722dd[_0xd518('0x30')]):_0x3722dd['interface'],'paused':_0x3722dd[_0xd518('0x93')]||![],'penalty':_0x5484cf['body'][_0xd518('0x9b')]||0x0});}return Promise[_0xd518('0x4a')](_0x166948[_0xd518('0x27')](function(_0x5338f4){return db[_0xd518('0xa5')][_0xd518('0xa6')](_0x5338f4);}));}return _0x2b8de8;});}})[_0xd518('0x1d')](respondWithStatusCode(_0xde1097,null))[_0xd518('0x4b')](handleError(_0xde1097,null));};exports['removeQueues']=function(_0xf1ad3d,_0x4df635){var _0x49fada,_0x13b298;return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0xf1ad3d[_0xd518('0x54')]['id']},'attributes':['id',_0xd518('0x30'),_0xd518('0x1b')]})[_0xd518('0x1d')](handleEntityNotFound(_0x4df635,null))[_0xd518('0x1d')](function(_0x28596e){if(_0x28596e){_0x49fada=_0x28596e;if(!_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')]||!utils[_0xd518('0x95')](_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')])){throw new db[(_0xd518('0x86'))][(_0xd518('0x87'))]('Unknown\x20channel');}return _0x28596e[_0xd518('0xa7')+_['capitalize'](_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')][_0xd518('0x99')]())+_0xd518('0x9a')](_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x57')]);}})['then'](function(_0x2e587d){if(_[_0xd518('0xa8')](_0xf1ad3d['query'][_0xd518('0x57')])){for(var _0x2560e4=0x0;_0x2560e4<_0xf1ad3d['query'][_0xd518('0x57')][_0xd518('0x44')];_0x2560e4+=0x1){_0x13b298={'UserId':Number(_0xf1ad3d[_0xd518('0x54')]['id'])};_0x13b298[_['capitalize'](_0xf1ad3d['query']['channel'][_0xd518('0x99')]())+'QueueId']=Number(_0xf1ad3d['query'][_0xd518('0x57')][_0x2560e4]);socket[_0xd518('0x9e')](_0xd518('0x21')+_[_0xd518('0x98')](_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')]['toLowerCase']())+_0xd518('0xa9'),_0x13b298);}}else{_0x13b298={'UserId':Number(_0xf1ad3d[_0xd518('0x54')]['id'])};_0x13b298[_[_0xd518('0x98')](_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')][_0xd518('0x99')]())+'QueueId']=Number(_0xf1ad3d[_0xd518('0x3d')]['ids']);socket[_0xd518('0x9e')](_0xd518('0x21')+_[_0xd518('0x98')](_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')]['toLowerCase']())+_0xd518('0xa9'),_0x13b298);}return _0x2e587d;})[_0xd518('0x1d')](function(){if(_0xf1ad3d[_0xd518('0x3d')][_0xd518('0x91')]===_0xd518('0xa0')){return db[_0xd518('0xa5')][_0xd518('0x2c')]({'where':{'UserId':_0xf1ad3d[_0xd518('0x54')]['id'],'VoiceQueueId':_0xf1ad3d['query'][_0xd518('0x57')]},'individualHooks':!![]})[_0xd518('0x1d')](function(){return _0x49fada;});}return _0x49fada;})[_0xd518('0x1d')](respondWithStatusCode(_0x4df635,null))[_0xd518('0x4b')](handleError(_0x4df635,null));};exports[_0xd518('0xaa')]=function(_0x3cf643,_0x15885b){_0x3cf643['body']['userpic']=_0x3cf643[_0xd518('0xab')][_0xd518('0xac')];return db[_0xd518('0x32')]['find']({'where':{'id':_0x3cf643[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x15885b,null))[_0xd518('0x1d')](saveUpdates(_0x3cf643[_0xd518('0x53')],null))['then'](respondWithResult(_0x15885b,null))['catch'](handleError(_0x15885b,null));};exports['getAvatar']=function(_0x70200e,_0xde43c2){var _0x40aaf1=path[_0xd518('0xad')](config[_0xd518('0xae')],_0xd518('0xaf'));return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0x70200e[_0xd518('0x54')]['id']},'attributes':['id',_0xd518('0xb0')],'raw':!![]})[_0xd518('0x1d')](handleEntityNotFound(_0xde43c2,null))[_0xd518('0x1d')](function(_0x4e7f9d){if(_0x4e7f9d){if(_[_0xd518('0x5e')](_0x4e7f9d[_0xd518('0xb0')])){return _0xde43c2[_0xd518('0xb1')](_0x40aaf1);}else{if(!fs[_0xd518('0xb2')](path[_0xd518('0xad')](config['root'],'server/files/images/',_0x4e7f9d[_0xd518('0xb0')]))){return _0xde43c2['download'](_0x40aaf1);}return _0xde43c2['download'](path[_0xd518('0xad')](config[_0xd518('0xae')],_0xd518('0xb3'),_0x4e7f9d[_0xd518('0xb0')]));}}})[_0xd518('0x4b')](handleError(_0xde43c2,null));};exports['getOpenTabs']=function(_0x2fd4b4,_0x1ff06f){return db[_0xd518('0x32')]['find']({'where':{'id':_0x2fd4b4['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1ff06f,null))['then'](function(_0x52e68c){var _0x134ce3=[];values=_0x52e68c[_0xd518('0x46')];_0x134ce3['push'](get_open_tabs('chat',_0x52e68c[_0xd518('0x46')]));_0x134ce3[_0xd518('0x41')](get_open_tabs(_0xd518('0xb4'),_0x52e68c['dataValues']));_0x134ce3[_0xd518('0x41')](get_open_tabs('openchannel',_0x52e68c['dataValues']));_0x134ce3['push'](get_open_tabs(_0xd518('0x52'),_0x52e68c[_0xd518('0x46')]));_0x134ce3['push'](get_open_tabs(_0xd518('0x47'),_0x52e68c[_0xd518('0x46')]));_0x134ce3[_0xd518('0x41')](get_open_tabs(_0xd518('0x48'),_0x52e68c['dataValues']));return Promise[_0xd518('0x4a')](_0x134ce3);})[_0xd518('0x1d')](function(_0x389fc2){if(_0x389fc2){var _0x2d4229=_[_0xd518('0x27')](values['ChatOpenTabs'],function(_0x23f1c9){return{'channel':_0xd518('0xb5'),'id':_0x23f1c9['id'],'createdAt':_0x23f1c9[_0xd518('0xb6')]};});var _0x25395f=_['map'](values['FaxOpenTabs'],function(_0x503f41){return{'channel':'FAX','id':_0x503f41['id'],'createdAt':_0x503f41[_0xd518('0xb6')]};});var _0x179c45=_[_0xd518('0x27')](values[_0xd518('0xb7')],function(_0x42cce0){return{'channel':_0xd518('0xb8'),'id':_0x42cce0['id'],'createdAt':_0x42cce0['createdAt']};});var _0x209f58=_['map'](values['MailOpenTabs'],function(_0x5dff66){return{'channel':_0xd518('0xb9'),'id':_0x5dff66['id'],'createdAt':_0x5dff66['createdAt']};});var _0x1ce540=_['map'](values[_0xd518('0xba')],function(_0x5b8d4f){return{'channel':'SMS','id':_0x5b8d4f['id'],'createdAt':_0x5b8d4f['createdAt']};});var _0x3e8383=_['map'](values['WhatsappOpenTabs'],function(_0xc19870){return{'channel':_0xd518('0xbb'),'id':_0xc19870['id'],'createdAt':_0xc19870['createdAt']};});var _0xc341a=_[_0xd518('0xbc')](_0x2d4229,_0x25395f,_0x179c45,_0x209f58,_0x1ce540,_0x3e8383);var _0x2be6f9={'count':_0xc341a[_0xd518('0x44')],'rows':_0xc341a};return _0x2be6f9;}else return null;})[_0xd518('0x1d')](respondWithResult(_0x1ff06f,null))[_0xd518('0x4b')](handleError(_0x1ff06f,null));};exports[_0xd518('0xbd')]=function(_0x27d21d,_0x5637a5){var _0x1052bc={};return db['User'][_0xd518('0xbe')]({'where':{'id':_0x27d21d['params']['id']}})[_0xd518('0x1d')](function(_0x522378){if(!_0x522378){throw new APINotFoundError(util[_0xd518('0xa3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x27d21d[_0xd518('0x54')]['id']));}return contacts[_0xd518('0x55')]();})[_0xd518('0x1d')](function(_0x432f51){_0x27d21d['query'][_0xd518('0x32')]=_0x27d21d['params']['id'];_0x1052bc=qs[_0xd518('0x4d')](_0x432f51,_0x27d21d);if(_0x27d21d['query'][_0xd518('0xbf')]('includeAll')){_0x1052bc[_0xd518('0xc0')]=[{'model':db[_0xd518('0xc1')],'as':_0xd518('0xc2'),'required':![]},{'model':db['Tag'],'as':_0xd518('0xc3'),'attributes':['id','name',_0xd518('0xc4')],'where':_0x27d21d['query'][_0xd518('0xc5')]?{'id':_0x27d21d[_0xd518('0x3d')]['tag']}:undefined,'required':_0x27d21d['query'][_0xd518('0xc5')]?!![]:![]}];}return contacts[_0xd518('0x42')](_0x27d21d['query'],_0x27d21d['user'],_0x1052bc,_0x432f51);})[_0xd518('0x1d')](respondWithFilteredResult(_0x5637a5,_0x1052bc))[_0xd518('0x4b')](APIHandleError(_0x5637a5));};exports[_0xd518('0xc6')]=function(_0x4c5a4d,_0x579d2a){var _0x898e30;var _0x97b9e0={};var _0x2d97f9;return db[_0xd518('0x32')]['findOne']({'where':{'id':_0x4c5a4d['params']['id']},'attributes':['id',_0xd518('0x30'),'role']})[_0xd518('0x1d')](handleEntityNotFound(_0x579d2a,null))['then'](function(_0x522a91){if(!utils[_0xd518('0x95')](_0x4c5a4d[_0xd518('0x3d')]['channel'])){throw new db[(_0xd518('0x86'))][(_0xd518('0x87'))]('Unknown\x20channel');}_0x898e30=_0x522a91;var _0x1fa17a={};_0x1fa17a[_0xd518('0xc7')]=_['keys'](db[_['capitalize'](_0x4c5a4d[_0xd518('0x3d')][_0xd518('0x91')])+_0xd518('0xc8')][_0xd518('0x33')]);_0x1fa17a[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x4c5a4d['query']);_0x1fa17a[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x1fa17a['model'],_0x1fa17a[_0xd518('0x3d')]);_0x97b9e0[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x1fa17a[_0xd518('0xc7')],qs['fields'](_0x4c5a4d[_0xd518('0x3d')][_0xd518('0xcc')]));_0x97b9e0[_0xd518('0x40')]=_0x97b9e0['attributes'][_0xd518('0x44')]?_0x97b9e0[_0xd518('0x40')]:_0x1fa17a[_0xd518('0xc7')];_0x97b9e0['order']=qs[_0xd518('0xcd')](_0x4c5a4d['query'][_0xd518('0xcd')]);_0x97b9e0[_0xd518('0x3c')]=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x4c5a4d[_0xd518('0x3d')],_0x1fa17a[_0xd518('0xca')]));if(_0x4c5a4d['query'][_0xd518('0x25')]){_0x97b9e0['where']=_[_0xd518('0xcf')](_0x97b9e0['where'],{'$or':_[_0xd518('0x27')](_0x97b9e0[_0xd518('0x40')],function(_0x52a5d5){var _0x5d167e={};_0x5d167e[_0x52a5d5]={'$like':'%'+_0x4c5a4d[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x5d167e;})});}_0x97b9e0=_['merge']({},_0x97b9e0,_0x4c5a4d[_0xd518('0x50')]);switch(_0x898e30[_0xd518('0x1b')]){case _0xd518('0x1f'):return db[_['capitalize'](_0x4c5a4d['query'][_0xd518('0x91')])+_0xd518('0xc8')][_0xd518('0x42')](_0x97b9e0);case _0xd518('0x21'):case _0xd518('0x1c'):return _0x898e30[_0xd518('0x1e')+_[_0xd518('0x98')](_0x4c5a4d[_0xd518('0x3d')][_0xd518('0x91')])+_0xd518('0x9a')](_0x97b9e0);default:throw new db[(_0xd518('0x86'))]['ValidationError'](_0xd518('0xd0'));}})[_0xd518('0x1d')](function(_0x345a57){_0x2d97f9=_0x345a57['length'];if(!_0x4c5a4d[_0xd518('0x3d')]['hasOwnProperty']('nolimit')){_0x97b9e0[_0xd518('0xd1')]=qs[_0xd518('0xd1')](_0x4c5a4d[_0xd518('0x3d')]['limit']);_0x97b9e0[_0xd518('0x15')]=qs['offset'](_0x4c5a4d[_0xd518('0x3d')]['offset']);}switch(_0x898e30[_0xd518('0x1b')]){case _0xd518('0x1f'):return db[_[_0xd518('0x98')](_0x4c5a4d[_0xd518('0x3d')][_0xd518('0x91')])+_0xd518('0xc8')][_0xd518('0x42')](_0x97b9e0);case'user':case _0xd518('0x1c'):return _0x898e30[_0xd518('0x1e')+_['capitalize'](_0x4c5a4d['query']['channel'])+_0xd518('0x9a')](_0x97b9e0);}})['then'](function(_0x321f3f){return{'count':_0x2d97f9,'rows':_0x321f3f};})[_0xd518('0x1d')](respondWithResult(_0x579d2a,null))[_0xd518('0x4b')](handleError(_0x579d2a,null));};exports[_0xd518('0xd2')]=function(_0x4fe871,_0x193f43){var _0x27f76e={};var _0x396931={};var _0xab30a4;var _0x1770a6;return db['User'][_0xd518('0xbe')]({'where':{'id':_0x4fe871[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x193f43,null))[_0xd518('0x1d')](function(_0xdb2e4f){if(_0xdb2e4f){_0xab30a4=_0xdb2e4f;_0x396931[_0xd518('0xc7')]=_[_0xd518('0xc9')](db[_0xd518('0xa5')]['rawAttributes']);_0x396931['query']=_['keys'](_0x4fe871[_0xd518('0x3d')]);_0x396931[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x396931[_0xd518('0xc7')],_0x396931['query']);_0x27f76e[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x396931[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x4fe871[_0xd518('0x3d')][_0xd518('0xcc')]));_0x27f76e[_0xd518('0x40')]=_0x27f76e[_0xd518('0x40')]['length']?_0x27f76e[_0xd518('0x40')]:_0x396931['model'];_0x27f76e[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x4fe871[_0xd518('0x3d')][_0xd518('0xcd')]);_0x27f76e[_0xd518('0x3c')]=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x4fe871[_0xd518('0x3d')],_0x396931[_0xd518('0xca')]));if(_0x4fe871[_0xd518('0x3d')][_0xd518('0x25')]){_0x27f76e['where']=_[_0xd518('0xcf')](_0x27f76e[_0xd518('0x3c')],{'$or':_['map'](_0x27f76e[_0xd518('0x40')],function(_0x36c3dc){var _0x516be9={};_0x516be9[_0x36c3dc]={'$like':'%'+_0x4fe871['query'][_0xd518('0x25')]+'%'};return _0x516be9;})});}_0x27f76e=_['merge']({},_0x27f76e,_0x4fe871[_0xd518('0x50')]);return _0xab30a4[_0xd518('0xd2')](_0x27f76e);}})[_0xd518('0x1d')](function(_0x5ab7fb){if(_0x5ab7fb){_0x1770a6=_0x5ab7fb[_0xd518('0x44')];if(!_0x4fe871[_0xd518('0x3d')]['hasOwnProperty']('nolimit')){_0x27f76e['limit']=qs['limit'](_0x4fe871[_0xd518('0x3d')][_0xd518('0xd1')]);_0x27f76e[_0xd518('0x15')]=qs['offset'](_0x4fe871[_0xd518('0x3d')]['offset']);}return _0xab30a4[_0xd518('0xd2')](_0x27f76e);}})[_0xd518('0x1d')](function(_0x1a21e4){if(_0x1a21e4){return _0x1a21e4?{'count':_0x1770a6,'rows':_0x1a21e4}:null;}})['then'](respondWithResult(_0x193f43,null))[_0xd518('0x4b')](handleError(_0x193f43,null));};exports['getGroups']=function(_0x902f3,_0x3a990a){var _0x505469={};var _0x8d6897={};var _0x3eb2de;var _0x45d1ad;return db['User'][_0xd518('0xbe')]({'where':{'id':_0x902f3[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x3a990a,null))['then'](function(_0x439fef){if(_0x439fef){_0x3eb2de=_0x439fef;_0x8d6897['model']=_['keys'](db[_0xd518('0xd4')][_0xd518('0x33')]);_0x8d6897[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x902f3[_0xd518('0x3d')]);_0x8d6897[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x8d6897['model'],_0x8d6897[_0xd518('0x3d')]);_0x505469['attributes']=_[_0xd518('0xcb')](_0x8d6897[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x902f3['query'][_0xd518('0xcc')]));_0x505469[_0xd518('0x40')]=_0x505469[_0xd518('0x40')][_0xd518('0x44')]?_0x505469['attributes']:_0x8d6897[_0xd518('0xc7')];_0x505469[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x902f3['query']['sort']);_0x505469[_0xd518('0x3c')]=qs[_0xd518('0xca')](_['pick'](_0x902f3[_0xd518('0x3d')],_0x8d6897[_0xd518('0xca')]));if(_0x902f3['query'][_0xd518('0x25')]){_0x505469[_0xd518('0x3c')]=_['merge'](_0x505469['where'],{'$or':_[_0xd518('0x27')](_0x505469['attributes'],function(_0x2763b6){var _0x2864d9={};_0x2864d9[_0x2763b6]={'$like':'%'+_0x902f3['query']['filter']+'%'};return _0x2864d9;})});}_0x505469=_[_0xd518('0xcf')]({},_0x505469,_0x902f3['options']);return _0x3eb2de[_0xd518('0xd5')](_0x505469);}})[_0xd518('0x1d')](function(_0x4707b7){if(_0x4707b7){_0x45d1ad=_0x4707b7[_0xd518('0x44')];if(!_0x902f3['query'][_0xd518('0xbf')](_0xd518('0xd6'))){_0x505469[_0xd518('0xd1')]=qs[_0xd518('0xd1')](_0x902f3[_0xd518('0x3d')][_0xd518('0xd1')]);_0x505469['offset']=qs[_0xd518('0x15')](_0x902f3[_0xd518('0x3d')][_0xd518('0x15')]);}return _0x3eb2de[_0xd518('0xd5')](_0x505469);}})[_0xd518('0x1d')](function(_0x54f4ff){if(_0x54f4ff){return _0x54f4ff?{'count':_0x45d1ad,'rows':_0x54f4ff}:null;}})[_0xd518('0x1d')](respondWithResult(_0x3a990a,null))[_0xd518('0x4b')](handleError(_0x3a990a,null));};exports[_0xd518('0xd7')]=function(_0x23289d,_0x54b15){var _0xddb110={'raw':!![],'where':{}};var _0x8315a={};var _0x5eb818={'count':0x0,'rows':[]};return db[_0xd518('0x32')][_0xd518('0xbe')]({'where':{'id':_0x23289d[_0xd518('0x54')]['id']}})['then'](handleEntityNotFound(_0x54b15,null))[_0xd518('0x1d')](function(_0x53c919){if(_0x53c919){_0x8315a[_0xd518('0xc7')]=_[_0xd518('0xc9')](db[_0xd518('0xd8')][_0xd518('0x33')]);_0x8315a['query']=_[_0xd518('0xc9')](_0x23289d[_0xd518('0x3d')]);_0x8315a['filters']=_[_0xd518('0xcb')](_0x8315a[_0xd518('0xc7')],_0x8315a[_0xd518('0x3d')]);_0xddb110[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x8315a[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x23289d[_0xd518('0x3d')][_0xd518('0xcc')]));_0xddb110[_0xd518('0x40')]=_0xddb110[_0xd518('0x40')][_0xd518('0x44')]?_0xddb110[_0xd518('0x40')]:_0x8315a[_0xd518('0xc7')];if(!_0x23289d[_0xd518('0x3d')][_0xd518('0xbf')]('nolimit')){_0xddb110[_0xd518('0xd1')]=qs[_0xd518('0xd1')](_0x23289d[_0xd518('0x3d')]['limit']);_0xddb110[_0xd518('0x15')]=qs[_0xd518('0x15')](_0x23289d[_0xd518('0x3d')][_0xd518('0x15')]);}_0xddb110[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x23289d[_0xd518('0x3d')][_0xd518('0xcd')]);_0xddb110[_0xd518('0x3c')]=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x23289d[_0xd518('0x3d')],_0x8315a['filters']));_0xddb110['where']['UserId']=_0x53c919['id'];if(_0x23289d[_0xd518('0x3d')][_0xd518('0x25')]){_0xddb110['where']=_['merge'](_0xddb110[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0xddb110[_0xd518('0x40')],function(_0x38bd35){var _0x113f4b={};_0x113f4b[_0x38bd35]={'$like':'%'+_0x23289d[_0xd518('0x3d')]['filter']+'%'};return _0x113f4b;})});}_0xddb110=_[_0xd518('0xcf')]({},_0xddb110,_0x23289d['options']);return db[_0xd518('0xd8')][_0xd518('0x17')]({'where':_0xddb110[_0xd518('0x3c')]})[_0xd518('0x1d')](function(_0x1ee009){_0x5eb818[_0xd518('0x17')]=_0x1ee009;if(_0x23289d[_0xd518('0x3d')][_0xd518('0x4e')]){_0xddb110[_0xd518('0xc0')]=[{'all':!![]}];}return db[_0xd518('0xd8')][_0xd518('0x42')](_0xddb110);})[_0xd518('0x1d')](function(_0x533570){_0x5eb818['rows']=_0x533570;return _0x5eb818;});}})[_0xd518('0x1d')](respondWithFilteredResult(_0x54b15,_0xddb110))['catch'](handleError(_0x54b15,null));};exports[_0xd518('0xd9')]=function(_0x5e70f9,_0x2bee8f){var _0x547a62={'raw':!![],'where':{}};var _0x4b7373={};var _0x4f27b4={'count':0x0,'rows':[]};return db[_0xd518('0x32')]['findOne']({'where':{'id':_0x5e70f9[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x2bee8f,null))[_0xd518('0x1d')](function(_0x40b994){if(_0x40b994){_0x4b7373[_0xd518('0xc7')]=_[_0xd518('0xc9')](db['ScreenRecording'][_0xd518('0x33')]);_0x4b7373[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x5e70f9[_0xd518('0x3d')]);_0x4b7373[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x4b7373[_0xd518('0xc7')],_0x4b7373[_0xd518('0x3d')]);_0x547a62[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x4b7373[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x5e70f9[_0xd518('0x3d')]['fields']));_0x547a62[_0xd518('0x40')]=_0x547a62['attributes']['length']?_0x547a62[_0xd518('0x40')]:_0x4b7373[_0xd518('0xc7')];if(!_0x5e70f9[_0xd518('0x3d')][_0xd518('0xbf')](_0xd518('0xd6'))){_0x547a62[_0xd518('0xd1')]=qs[_0xd518('0xd1')](_0x5e70f9['query'][_0xd518('0xd1')]);_0x547a62['offset']=qs[_0xd518('0x15')](_0x5e70f9[_0xd518('0x3d')]['offset']);}_0x547a62[_0xd518('0xd3')]=qs['sort'](_0x5e70f9['query'][_0xd518('0xcd')]);_0x547a62[_0xd518('0x3c')]=qs[_0xd518('0xca')](_['pick'](_0x5e70f9[_0xd518('0x3d')],_0x4b7373[_0xd518('0xca')]));_0x547a62[_0xd518('0x3c')][_0xd518('0xda')]=_0x40b994['id'];if(_0x5e70f9[_0xd518('0x3d')][_0xd518('0x25')]){_0x547a62[_0xd518('0x3c')]=_[_0xd518('0xcf')](_0x547a62['where'],{'$or':_[_0xd518('0x27')](_0x547a62[_0xd518('0x40')],function(_0x27162f){var _0xef2323={};_0xef2323[_0x27162f]={'$like':'%'+_0x5e70f9['query'][_0xd518('0x25')]+'%'};return _0xef2323;})});}_0x547a62=_[_0xd518('0xcf')]({},_0x547a62,_0x5e70f9[_0xd518('0x50')]);return db[_0xd518('0xdb')][_0xd518('0x17')]({'where':_0x547a62[_0xd518('0x3c')]})[_0xd518('0x1d')](function(_0x852966){_0x4f27b4[_0xd518('0x17')]=_0x852966;if(_0x5e70f9[_0xd518('0x3d')]['includeAll']){_0x547a62[_0xd518('0xc0')]=[{'all':!![]}];}return db[_0xd518('0xdb')]['findAll'](_0x547a62);})[_0xd518('0x1d')](function(_0x42b0db){_0x4f27b4[_0xd518('0x43')]=_0x42b0db;return _0x4f27b4;});}})[_0xd518('0x1d')](respondWithFilteredResult(_0x2bee8f,_0x547a62))[_0xd518('0x4b')](handleError(_0x2bee8f,null));};exports['getChatInteractions']=function(_0x757c,_0x461e8e){var _0x2a190b={};var _0x3b2ef7={};var _0x4bff51;var _0x19a58d;return db[_0xd518('0x32')][_0xd518('0xbe')]({'where':{'id':_0x757c[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x461e8e,null))[_0xd518('0x1d')](function(_0x429cd7){if(_0x429cd7){_0x4bff51=_0x429cd7;_0x3b2ef7['model']=_['keys'](db[_0xd518('0xdc')][_0xd518('0x33')]);_0x3b2ef7[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x757c['query']);_0x3b2ef7['filters']=_[_0xd518('0xcb')](_0x3b2ef7[_0xd518('0xc7')],_0x3b2ef7[_0xd518('0x3d')]);_0x2a190b['attributes']=_['intersection'](_0x3b2ef7[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x757c[_0xd518('0x3d')]['fields']));_0x2a190b[_0xd518('0x40')]=_0x2a190b[_0xd518('0x40')][_0xd518('0x44')]?_0x2a190b[_0xd518('0x40')]:_0x3b2ef7[_0xd518('0xc7')];_0x2a190b[_0xd518('0xd3')]=qs['sort'](_0x757c[_0xd518('0x3d')]['sort']);_0x2a190b['where']=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x757c[_0xd518('0x3d')],_0x3b2ef7[_0xd518('0xca')]));if(_0x757c[_0xd518('0x3d')][_0xd518('0x25')]){_0x2a190b[_0xd518('0x3c')]=_['merge'](_0x2a190b[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0x2a190b[_0xd518('0x40')],function(_0x54bcd9){var _0x4f2852={};_0x4f2852[_0x54bcd9]={'$like':'%'+_0x757c[_0xd518('0x3d')]['filter']+'%'};return _0x4f2852;})});}_0x2a190b=_[_0xd518('0xcf')]({},_0x2a190b,_0x757c['options']);return _0x4bff51[_0xd518('0xdd')](_0x2a190b);}})['then'](function(_0x23deda){if(_0x23deda){_0x19a58d=_0x23deda[_0xd518('0x44')];if(!_0x757c['query'][_0xd518('0xbf')](_0xd518('0xd6'))){_0x2a190b['limit']=qs[_0xd518('0xd1')](_0x757c[_0xd518('0x3d')][_0xd518('0xd1')]);_0x2a190b[_0xd518('0x15')]=qs['offset'](_0x757c['query'][_0xd518('0x15')]);}return _0x4bff51[_0xd518('0xdd')](_0x2a190b);}})[_0xd518('0x1d')](function(_0x393bbe){if(_0x393bbe){return _0x393bbe?{'count':_0x19a58d,'rows':_0x393bbe}:null;}})[_0xd518('0x1d')](respondWithResult(_0x461e8e,null))[_0xd518('0x4b')](handleError(_0x461e8e,null));};exports[_0xd518('0xde')]=function(_0x4c7594,_0x4a2c8d){var _0x14696f={};var _0x9db7fb={};var _0x2b491b;var _0xcff32b;return db['User']['findOne']({'where':{'id':_0x4c7594[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x4a2c8d,null))[_0xd518('0x1d')](function(_0x579c73){if(_0x579c73){_0x2b491b=_0x579c73;_0x9db7fb[_0xd518('0xc7')]=_['keys'](db['OpenchannelInteraction'][_0xd518('0x33')]);_0x9db7fb[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x4c7594['query']);_0x9db7fb[_0xd518('0xca')]=_['intersection'](_0x9db7fb['model'],_0x9db7fb[_0xd518('0x3d')]);_0x14696f['attributes']=_[_0xd518('0xcb')](_0x9db7fb['model'],qs[_0xd518('0xcc')](_0x4c7594[_0xd518('0x3d')][_0xd518('0xcc')]));_0x14696f['attributes']=_0x14696f[_0xd518('0x40')][_0xd518('0x44')]?_0x14696f[_0xd518('0x40')]:_0x9db7fb[_0xd518('0xc7')];_0x14696f['order']=qs[_0xd518('0xcd')](_0x4c7594[_0xd518('0x3d')]['sort']);_0x14696f[_0xd518('0x3c')]=qs['filters'](_[_0xd518('0xce')](_0x4c7594[_0xd518('0x3d')],_0x9db7fb[_0xd518('0xca')]));if(_0x4c7594[_0xd518('0x3d')][_0xd518('0x25')]){_0x14696f[_0xd518('0x3c')]=_[_0xd518('0xcf')](_0x14696f[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0x14696f[_0xd518('0x40')],function(_0x474602){var _0x6bc37d={};_0x6bc37d[_0x474602]={'$like':'%'+_0x4c7594[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x6bc37d;})});}_0x14696f=_[_0xd518('0xcf')]({},_0x14696f,_0x4c7594[_0xd518('0x50')]);return _0x2b491b[_0xd518('0xde')](_0x14696f);}})['then'](function(_0x38a3d1){if(_0x38a3d1){_0xcff32b=_0x38a3d1[_0xd518('0x44')];if(!_0x4c7594['query'][_0xd518('0xbf')](_0xd518('0xd6'))){_0x14696f['limit']=qs['limit'](_0x4c7594[_0xd518('0x3d')][_0xd518('0xd1')]);_0x14696f[_0xd518('0x15')]=qs[_0xd518('0x15')](_0x4c7594[_0xd518('0x3d')][_0xd518('0x15')]);}return _0x2b491b[_0xd518('0xde')](_0x14696f);}})[_0xd518('0x1d')](function(_0x35ebbf){if(_0x35ebbf){return _0x35ebbf?{'count':_0xcff32b,'rows':_0x35ebbf}:null;}})[_0xd518('0x1d')](respondWithResult(_0x4a2c8d,null))[_0xd518('0x4b')](handleError(_0x4a2c8d,null));};exports['getMailInteractions']=function(_0x5ad80c,_0x5311d5){var _0x2c2d72={'raw':!![],'where':{}};var _0x582972={};var _0x10bc30={'count':0x0,'rows':[]};return db[_0xd518('0x32')][_0xd518('0xbe')]({'where':{'id':_0x5ad80c['params']['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x5311d5,null))[_0xd518('0x1d')](function(_0x2e214b){if(_0x2e214b){_0x582972['model']=_['keys'](db['MailInteraction'][_0xd518('0x33')]);_0x582972['query']=_[_0xd518('0xc9')](_0x5ad80c['query']);_0x582972[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x582972[_0xd518('0xc7')],_0x582972[_0xd518('0x3d')]);_0x2c2d72['attributes']=_[_0xd518('0xcb')](_0x582972['model'],qs[_0xd518('0xcc')](_0x5ad80c[_0xd518('0x3d')][_0xd518('0xcc')]));_0x2c2d72[_0xd518('0x40')]=_0x2c2d72[_0xd518('0x40')][_0xd518('0x44')]?_0x2c2d72[_0xd518('0x40')]:_0x582972['model'];if(!_0x5ad80c[_0xd518('0x3d')]['hasOwnProperty'](_0xd518('0xd6'))){_0x2c2d72[_0xd518('0xd1')]=qs[_0xd518('0xd1')](_0x5ad80c[_0xd518('0x3d')][_0xd518('0xd1')]);_0x2c2d72[_0xd518('0x15')]=qs[_0xd518('0x15')](_0x5ad80c[_0xd518('0x3d')][_0xd518('0x15')]);}_0x2c2d72['order']=qs[_0xd518('0xcd')](_0x5ad80c[_0xd518('0x3d')][_0xd518('0xcd')]);_0x2c2d72['where']=qs['filters'](_['pick'](_0x5ad80c[_0xd518('0x3d')],_0x582972[_0xd518('0xca')]));_0x2c2d72[_0xd518('0x3c')]['UserId']=_0x2e214b['id'];if(_0x5ad80c['query'][_0xd518('0x25')]){_0x2c2d72[_0xd518('0x3c')]=_[_0xd518('0xcf')](_0x2c2d72[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0x2c2d72['attributes'],function(_0x41cd74){var _0x376fd5={};_0x376fd5[_0x41cd74]={'$like':'%'+_0x5ad80c[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x376fd5;})});}_0x2c2d72=_[_0xd518('0xcf')]({},_0x2c2d72,_0x5ad80c[_0xd518('0x50')]);return db[_0xd518('0xdf')][_0xd518('0x17')]({'where':_0x2c2d72[_0xd518('0x3c')]})[_0xd518('0x1d')](function(_0x445561){_0x10bc30[_0xd518('0x17')]=_0x445561;if(_0x5ad80c[_0xd518('0x3d')][_0xd518('0x4e')]){_0x2c2d72['include']=[{'all':!![]}];}return db[_0xd518('0xdf')]['findAll'](_0x2c2d72);})[_0xd518('0x1d')](function(_0x3646d6){_0x10bc30[_0xd518('0x43')]=_0x3646d6;return _0x10bc30;});}})[_0xd518('0x1d')](respondWithFilteredResult(_0x5311d5,_0x2c2d72))[_0xd518('0x4b')](handleError(_0x5311d5,null));};exports[_0xd518('0xe0')]=function(_0x3cb522,_0x461bb6){var _0x5ec703={};var _0x4ddf35={};var _0x41230e;var _0x589bf4;return db[_0xd518('0x32')]['findOne']({'where':{'id':_0x3cb522[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x461bb6,null))[_0xd518('0x1d')](function(_0x439186){if(_0x439186){_0x41230e=_0x439186;_0x4ddf35[_0xd518('0xc7')]=_[_0xd518('0xc9')](db[_0xd518('0xe1')][_0xd518('0x33')]);_0x4ddf35[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x3cb522[_0xd518('0x3d')]);_0x4ddf35[_0xd518('0xca')]=_['intersection'](_0x4ddf35[_0xd518('0xc7')],_0x4ddf35['query']);_0x5ec703[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x4ddf35[_0xd518('0xc7')],qs['fields'](_0x3cb522[_0xd518('0x3d')][_0xd518('0xcc')]));_0x5ec703['attributes']=_0x5ec703['attributes'][_0xd518('0x44')]?_0x5ec703['attributes']:_0x4ddf35['model'];_0x5ec703[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x3cb522[_0xd518('0x3d')][_0xd518('0xcd')]);_0x5ec703[_0xd518('0x3c')]=qs[_0xd518('0xca')](_['pick'](_0x3cb522[_0xd518('0x3d')],_0x4ddf35['filters']));if(_0x3cb522[_0xd518('0x3d')]['filter']){_0x5ec703[_0xd518('0x3c')]=_['merge'](_0x5ec703['where'],{'$or':_['map'](_0x5ec703[_0xd518('0x40')],function(_0x18faca){var _0x28f34a={};_0x28f34a[_0x18faca]={'$like':'%'+_0x3cb522[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x28f34a;})});}_0x5ec703=_[_0xd518('0xcf')]({},_0x5ec703,_0x3cb522['options']);return _0x41230e[_0xd518('0xe0')](_0x5ec703);}})['then'](function(_0x1a5ada){if(_0x1a5ada){_0x589bf4=_0x1a5ada[_0xd518('0x44')];if(!_0x3cb522[_0xd518('0x3d')][_0xd518('0xbf')](_0xd518('0xd6'))){_0x5ec703[_0xd518('0xd1')]=qs['limit'](_0x3cb522[_0xd518('0x3d')]['limit']);_0x5ec703[_0xd518('0x15')]=qs[_0xd518('0x15')](_0x3cb522[_0xd518('0x3d')][_0xd518('0x15')]);}return _0x41230e[_0xd518('0xe0')](_0x5ec703);}})[_0xd518('0x1d')](function(_0x1f8bdf){if(_0x1f8bdf){return _0x1f8bdf?{'count':_0x589bf4,'rows':_0x1f8bdf}:null;}})[_0xd518('0x1d')](respondWithResult(_0x461bb6,null))['catch'](handleError(_0x461bb6,null));};exports[_0xd518('0xe2')]=function(_0x2e7846,_0x3ee6a6){var _0x4cf2e2={};var _0x42d6d8={};var _0x1cfab6;var _0x5815e6;return db[_0xd518('0x32')][_0xd518('0xbe')]({'where':{'id':_0x2e7846[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x3ee6a6,null))[_0xd518('0x1d')](function(_0x2a1db9){if(_0x2a1db9){_0x1cfab6=_0x2a1db9;_0x42d6d8[_0xd518('0xc7')]=_['keys'](db[_0xd518('0xe3')][_0xd518('0x33')]);_0x42d6d8['query']=_[_0xd518('0xc9')](_0x2e7846[_0xd518('0x3d')]);_0x42d6d8[_0xd518('0xca')]=_['intersection'](_0x42d6d8[_0xd518('0xc7')],_0x42d6d8['query']);_0x4cf2e2[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x42d6d8[_0xd518('0xc7')],qs['fields'](_0x2e7846[_0xd518('0x3d')]['fields']));_0x4cf2e2[_0xd518('0x40')]=_0x4cf2e2[_0xd518('0x40')]['length']?_0x4cf2e2[_0xd518('0x40')]:_0x42d6d8[_0xd518('0xc7')];_0x4cf2e2[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x2e7846['query']['sort']);_0x4cf2e2['where']=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x2e7846['query'],_0x42d6d8[_0xd518('0xca')]));if(_0x2e7846[_0xd518('0x3d')]['filter']){_0x4cf2e2['where']=_[_0xd518('0xcf')](_0x4cf2e2[_0xd518('0x3c')],{'$or':_['map'](_0x4cf2e2[_0xd518('0x40')],function(_0x3b5b6c){var _0x3d9c8f={};_0x3d9c8f[_0x3b5b6c]={'$like':'%'+_0x2e7846[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x3d9c8f;})});}_0x4cf2e2=_['merge']({},_0x4cf2e2,_0x2e7846[_0xd518('0x50')]);return _0x1cfab6[_0xd518('0xe2')](_0x4cf2e2);}})[_0xd518('0x1d')](function(_0x25a3af){if(_0x25a3af){_0x5815e6=_0x25a3af[_0xd518('0x44')];if(!_0x2e7846['query'][_0xd518('0xbf')](_0xd518('0xd6'))){_0x4cf2e2[_0xd518('0xd1')]=qs['limit'](_0x2e7846['query'][_0xd518('0xd1')]);_0x4cf2e2['offset']=qs[_0xd518('0x15')](_0x2e7846['query'][_0xd518('0x15')]);}return _0x1cfab6[_0xd518('0xe2')](_0x4cf2e2);}})['then'](function(_0x1e561b){if(_0x1e561b){return _0x1e561b?{'count':_0x5815e6,'rows':_0x1e561b}:null;}})[_0xd518('0x1d')](respondWithResult(_0x3ee6a6,null))['catch'](handleError(_0x3ee6a6,null));};exports[_0xd518('0xe4')]=function(_0x4b37af,_0x59de94){var _0x3915a8={};var _0x7d15e0={};var _0x28355f;var _0x3fe4f5;return db[_0xd518('0x32')]['findOne']({'where':{'id':_0x4b37af[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x59de94,null))[_0xd518('0x1d')](function(_0x394ce6){if(_0x394ce6){_0x28355f=_0x394ce6;_0x7d15e0[_0xd518('0xc7')]=_[_0xd518('0xc9')](db['WhatsappInteraction']['rawAttributes']);_0x7d15e0[_0xd518('0x3d')]=_[_0xd518('0xc9')](_0x4b37af[_0xd518('0x3d')]);_0x7d15e0[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x7d15e0['model'],_0x7d15e0[_0xd518('0x3d')]);_0x3915a8['attributes']=_['intersection'](_0x7d15e0[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x4b37af['query']['fields']));_0x3915a8[_0xd518('0x40')]=_0x3915a8[_0xd518('0x40')][_0xd518('0x44')]?_0x3915a8[_0xd518('0x40')]:_0x7d15e0[_0xd518('0xc7')];_0x3915a8[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x4b37af[_0xd518('0x3d')]['sort']);_0x3915a8[_0xd518('0x3c')]=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x4b37af[_0xd518('0x3d')],_0x7d15e0[_0xd518('0xca')]));if(_0x4b37af[_0xd518('0x3d')]['filter']){_0x3915a8[_0xd518('0x3c')]=_['merge'](_0x3915a8[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0x3915a8[_0xd518('0x40')],function(_0x5e2336){var _0x3d2149={};_0x3d2149[_0x5e2336]={'$like':'%'+_0x4b37af[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x3d2149;})});}_0x3915a8=_['merge']({},_0x3915a8,_0x4b37af[_0xd518('0x50')]);return _0x28355f[_0xd518('0xe4')](_0x3915a8);}})[_0xd518('0x1d')](function(_0x1b5f48){if(_0x1b5f48){_0x3fe4f5=_0x1b5f48[_0xd518('0x44')];if(!_0x4b37af['query'][_0xd518('0xbf')](_0xd518('0xd6'))){_0x3915a8[_0xd518('0xd1')]=qs['limit'](_0x4b37af['query']['limit']);_0x3915a8['offset']=qs[_0xd518('0x15')](_0x4b37af[_0xd518('0x3d')]['offset']);}return _0x28355f[_0xd518('0xe4')](_0x3915a8);}})[_0xd518('0x1d')](function(_0x45f299){if(_0x45f299){return _0x45f299?{'count':_0x3fe4f5,'rows':_0x45f299}:null;}})[_0xd518('0x1d')](respondWithResult(_0x59de94,null))[_0xd518('0x4b')](handleError(_0x59de94,null));};exports[_0xd518('0xe5')]=function(_0x887ec,_0x379546,_0x4dcbfa){var _0x53b4c7;var _0x36779d;var _0x115466;var _0x114e9f=!_[_0xd518('0x5e')](_0x887ec[_0xd518('0x54')]['id'])?_0x887ec['params']['id']:!_[_0xd518('0x5e')](_0x887ec[_0xd518('0x21')]['id'])?_0x887ec[_0xd518('0x21')]['id']:null;return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0x114e9f,'role':{'$or':['admin','user',_0xd518('0x1c')]}},'attributes':['id',_0xd518('0x30'),_0xd518('0xe6'),'mobile',_0xd518('0x1b'),_0xd518('0x5d'),'loginInPause']})['then'](function(_0x30820c){if(_0x30820c){if(_0x30820c['role']===_0xd518('0x1c')){_0x53b4c7=_0x30820c;if(_0x887ec[_0xd518('0x53')]['interface']){_0x115466=util['format'](_0xd518('0xe7'),_0x53b4c7[_0x887ec[_0xd518('0x53')][_0xd518('0x94')]]);}else if(_0x887ec['body'][_0xd518('0xe8')]){_0x115466=util[_0xd518('0xa3')](_0xd518('0xa4'),_0x887ec['body'][_0xd518('0xe8')]);}else{_0x115466=util[_0xd518('0xa3')](_0xd518('0xa4'),_0x53b4c7[_0xd518('0x30')]);}socket['to'](util[_0xd518('0xa3')](_0xd518('0xe9'),_0x53b4c7[_0xd518('0x30')]))['emit'](_0xd518('0xea'),{'user':{'id':_0x53b4c7['id'],'name':_0x53b4c7[_0xd518('0x30')]},'ip':_0x887ec[_0xd518('0xeb')][_0xd518('0xec')]||_0x887ec[_0xd518('0xed')]['remoteAddress']||_0x887ec['socket'][_0xd518('0xee')]||_0x887ec[_0xd518('0xed')]['socket'][_0xd518('0xee')]});return db[_0xd518('0xa5')][_0xd518('0x2c')]({'where':{'membername':_0x53b4c7['name']},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0xd518('0xef'));}})[_0xd518('0x1d')](function(){if(_0x53b4c7){return _0x53b4c7[_0xd518('0xf0')]({'raw':!![]});}})['then'](function(_0x42109e){if(_0x53b4c7){if(_0x42109e){_0x36779d=_0x42109e;if(_0x36779d[_0xd518('0x44')]){var _0x33bf99=_0x36779d[_0xd518('0x27')](function(_0x1b458e){var _0x1171a3={'membername':_0x53b4c7[_0xd518('0x30')],'UserId':_0x53b4c7['id'],'queue_name':_0x1b458e[_0xd518('0x30')],'VoiceQueueId':_0x1b458e['id'],'interface':_0x115466,'paused':_0x53b4c7[_0xd518('0x92')]||![],'penalty':_0x1b458e['UserVoiceQueue.penalty']||0x0};return db[_0xd518('0xa5')][_0xd518('0xa6')](_0x1171a3);});return Promise[_0xd518('0x4a')](_0x33bf99);}}}})[_0xd518('0x1d')](function(){if(_0x53b4c7){return db[_0xd518('0xf1')][_0xd518('0x42')]({'where':{'membername':_0x53b4c7['name'],'exitAt':null}});}})[_0xd518('0x1d')](function(_0x54908d){if(_0x53b4c7){var _0x46c421=[];_0x54908d[_0xd518('0xf2')](function(_0x43ed7a){_0x46c421['push'](_0x43ed7a['update']({'exitAt':moment()[_0xd518('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x46c421);}})[_0xd518('0x1d')](function(){if(_0x53b4c7){var _0x6b1333=[];var _0x3d7e31=[];var _0x27ce08=utils[_0xd518('0xf3')]();var _0x28b4aa={'membername':_0x53b4c7[_0xd518('0x30')],'interface':_0x115466,'enterAt':moment()['format'](_0xd518('0xf4')),'role':_0x53b4c7[_0xd518('0x1b')],'internal':_0x53b4c7[_0xd518('0x5d')]};_0x27ce08[_0xd518('0xf2')](function(_0x3b96f7){_0x6b1333[_0xd518('0x41')](_[_0xd518('0xcf')]({'channel':_0x3b96f7,'type':_0xd518('0xf5'),'data1':_0x887ec[_0xd518('0x53')][_0xd518('0xf6')],'data2':_0x115466},_0x28b4aa));if(_0x53b4c7[_0xd518('0x92')]){_0x3d7e31[_0xd518('0x41')](_[_0xd518('0xcf')]({'channel':_0x3b96f7,'type':_0xd518('0xf7'),'data1':_0xd518('0xf8')},_0x28b4aa));}});return db[_0xd518('0xf1')][_0xd518('0x80')](_0x6b1333['concat'](_0x3d7e31),{'individualHooks':!![]});}})[_0xd518('0x1d')](function(){if(_0x53b4c7){return _0x53b4c7[_0xd518('0x1a')]({'online':!![],'lastLoginAt':moment()['format'](_0xd518('0xf4')),'voicePause':_0x53b4c7['loginInPause']||![],'mailPause':_0x53b4c7[_0xd518('0x92')]||![],'chatPause':_0x53b4c7[_0xd518('0x92')]||![],'faxPause':_0x53b4c7[_0xd518('0x92')]||![],'smsPause':_0x53b4c7[_0xd518('0x92')]||![],'openchannelPause':_0x53b4c7[_0xd518('0x92')]||![],'whatsappPause':_0x53b4c7['loginInPause']||![],'pauseType':_0x53b4c7[_0xd518('0x92')]?'LOGININPAUSE':null,'interface':_0x115466,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd518('0x1d')](function(_0x3ccd04){if(_0x887ec[_0xd518('0xf9')]){return _0x4dcbfa();}else{return Promise[_0xd518('0xfa')](_0x3ccd04)[_0xd518('0x1d')](respondWithResult(_0x379546,null));}})['catch'](handleError(_0x379546,null));};exports[_0xd518('0xfb')]=function(_0x2e3b4b,_0x1dba43){var _0x14e6cb;return db[_0xd518('0x32')][_0xd518('0x2a')]({'where':{'id':_0x2e3b4b[_0xd518('0x54')]['id'],'role':'agent'},'attributes':['id',_0xd518('0x30'),_0xd518('0x1b')]})[_0xd518('0x1d')](handleEntityNotFound(_0x1dba43,null))[_0xd518('0x1d')](function(_0x5c08c0){if(_0x5c08c0){_0x14e6cb=_0x5c08c0;return db['UserVoiceQueueRt'][_0xd518('0x2c')]({'where':{'membername':_0x14e6cb['name']},'individualHooks':!![]});}})[_0xd518('0x1d')](function(){return db[_0xd518('0xf1')][_0xd518('0x42')]({'where':{'membername':_0x14e6cb[_0xd518('0x30')],'exitAt':null}});})[_0xd518('0x1d')](function(_0x43e09b){var _0x46ec91=[];_0x43e09b[_0xd518('0xf2')](function(_0x4a0918){_0x46ec91[_0xd518('0x41')](_0x4a0918[_0xd518('0x1a')]({'exitAt':moment()[_0xd518('0xa3')](_0xd518('0xf4'))}));});return Promise[_0xd518('0x4a')](_0x46ec91);})[_0xd518('0x1d')](function(){return _0x14e6cb[_0xd518('0x1a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1dba43,null))[_0xd518('0x4b')](handleError(_0x1dba43,null));};exports['pause']=function(_0x35048c,_0x6d8f02){var _0x182be7;return db[_0xd518('0xa5')][_0xd518('0x1a')]({'paused':0x1},{'where':{'UserId':_0x35048c[_0xd518('0x54')]['id']},'individualHooks':!![]})[_0xd518('0x1d')](function(){return db['User'][_0xd518('0x2a')]({'where':{'id':_0x35048c['params']['id'],'role':_0xd518('0x1c')},'attributes':['id',_0xd518('0x30'),_0xd518('0x1b'),_0xd518('0x5d'),'interface',_0xd518('0xa2')]});})[_0xd518('0x1d')](handleEntityNotFound(_0x6d8f02,null))[_0xd518('0x1d')](function(_0x1878fd){if(_0x1878fd){_0x182be7=_0x1878fd;return db[_0xd518('0xf1')][_0xd518('0x42')]({'where':{'membername':_0x182be7[_0xd518('0x30')],'type':_0xd518('0xf7'),'exitAt':null}});}})[_0xd518('0x1d')](function(_0x47cfe7){if(_0x47cfe7[_0xd518('0x44')]){var _0x246cc3=moment()[_0xd518('0xa3')](_0xd518('0xf4'));for(var _0x2728a5=0x0,_0x2191aa=_0x47cfe7[_0xd518('0x44')];_0x2728a5<_0x2191aa;_0x2728a5++){_0x47cfe7[_0x2728a5][_0xd518('0xfc')]({'exitAt':_0x246cc3});}}})['then'](function(){var _0x1acca7=[];var _0x53e691=utils[_0xd518('0xf3')]();_0x53e691[_0xd518('0xf2')](function(_0x59d7c4){_0x1acca7[_0xd518('0x41')]({'channel':_0x59d7c4,'membername':_0x182be7[_0xd518('0x30')],'interface':_[_0xd518('0x5e')](_0x182be7[_0xd518('0x94')])?util[_0xd518('0xa3')](_0xd518('0xa4'),_0x182be7[_0xd518('0x30')]):_0x182be7[_0xd518('0x94')],'type':'PAUSE','enterAt':moment()[_0xd518('0xa3')](_0xd518('0xf4')),'data1':_0x35048c[_0xd518('0x53')][_0xd518('0xfd')]||'DEFAULT\x20PAUSE','role':_0x182be7[_0xd518('0x1b')],'internal':_0x182be7['internal']});});return db[_0xd518('0xf1')][_0xd518('0x80')](_0x1acca7,{'individualHooks':!![]});})[_0xd518('0x1d')](function(){return _0x182be7[_0xd518('0x1a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x35048c[_0xd518('0x53')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd518('0xa3')](_0xd518('0xf4'))});})[_0xd518('0x1d')](respondWithResult(_0x6d8f02,null))[_0xd518('0x4b')](handleError(_0x6d8f02,null));};exports[_0xd518('0xfe')]=function(_0x439cfe,_0x1f02f8){if(_0x439cfe[_0xd518('0x53')][_0xd518('0x91')]&&!utils['isValidChannel'](_0x439cfe[_0xd518('0x53')][_0xd518('0x91')])){throw new APIBadRequestError(util[_0xd518('0xa3')](_0xd518('0xff'),_0x439cfe[_0xd518('0x53')][_0xd518('0x91')]));}return db['User'][_0xd518('0x2a')]({'where':{'id':_0x439cfe[_0xd518('0x54')]['id']},'attributes':['id',_0xd518('0x30'),_0xd518('0x1b'),_0xd518('0x5d'),_0xd518('0x94'),'online','voicePause',_0xd518('0x100'),_0xd518('0x101'),'faxPause',_0xd518('0x102'),'smsPause',_0xd518('0x103'),_0xd518('0x104'),'lastPauseAt']})[_0xd518('0x1d')](function(_0x34444c){if(!_0x34444c){throw new APINotFoundError(util[_0xd518('0xa3')](_0xd518('0x105'),_0x439cfe[_0xd518('0x54')]['id']));}return _0x34444c['unpause'](_0x439cfe[_0xd518('0x53')]['channel']);})[_0xd518('0x1d')](respondWithResult(_0x1f02f8,null))[_0xd518('0x4b')](APIHandleError(_0x1f02f8));};exports['getTeams']=function(_0x393196,_0x57f8b5){var _0x9038ad={};var _0x425ba8={};var _0x1c4ad8;var _0x24ee31;return db[_0xd518('0x32')]['findOne']({'where':{'id':_0x393196[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x57f8b5,null))['then'](function(_0x673b17){if(_0x673b17){_0x1c4ad8=_0x673b17;_0x425ba8[_0xd518('0xc7')]=_[_0xd518('0xc9')](db[_0xd518('0x106')][_0xd518('0x33')]);_0x425ba8[_0xd518('0x3d')]=_['keys'](_0x393196[_0xd518('0x3d')]);_0x425ba8[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x425ba8[_0xd518('0xc7')],_0x425ba8[_0xd518('0x3d')]);_0x9038ad[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x425ba8['model'],qs[_0xd518('0xcc')](_0x393196['query'][_0xd518('0xcc')]));_0x9038ad[_0xd518('0x40')]=_0x9038ad[_0xd518('0x40')][_0xd518('0x44')]?_0x9038ad[_0xd518('0x40')]:_0x425ba8[_0xd518('0xc7')];_0x9038ad['order']=qs[_0xd518('0xcd')](_0x393196[_0xd518('0x3d')][_0xd518('0xcd')]);_0x9038ad['where']=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x393196['query'],_0x425ba8[_0xd518('0xca')]));if(_0x393196[_0xd518('0x3d')][_0xd518('0x25')]){_0x9038ad[_0xd518('0x3c')]=_[_0xd518('0xcf')](_0x9038ad[_0xd518('0x3c')],{'$or':_['map'](_0x9038ad[_0xd518('0x40')],function(_0x186bda){var _0x8b40b8={};_0x8b40b8[_0x186bda]={'$like':'%'+_0x393196[_0xd518('0x3d')][_0xd518('0x25')]+'%'};return _0x8b40b8;})});}_0x9038ad=_[_0xd518('0xcf')]({},_0x9038ad,_0x393196[_0xd518('0x50')]);return _0x1c4ad8[_0xd518('0x107')](_0x9038ad);}})['then'](function(_0x3589b6){if(_0x3589b6){_0x24ee31=_0x3589b6[_0xd518('0x44')];if(!_0x393196[_0xd518('0x3d')][_0xd518('0xbf')]('nolimit')){_0x9038ad[_0xd518('0xd1')]=qs[_0xd518('0xd1')](_0x393196[_0xd518('0x3d')][_0xd518('0xd1')]);_0x9038ad[_0xd518('0x15')]=qs[_0xd518('0x15')](_0x393196[_0xd518('0x3d')]['offset']);}return _0x1c4ad8[_0xd518('0x107')](_0x9038ad);}})[_0xd518('0x1d')](function(_0x5ccf79){if(_0x5ccf79){return _0x5ccf79?{'count':_0x24ee31,'rows':_0x5ccf79}:null;}})[_0xd518('0x1d')](respondWithResult(_0x57f8b5,null))[_0xd518('0x4b')](handleError(_0x57f8b5,null));};exports[_0xd518('0x108')]=function(_0x230df8,_0x1b0b4b){var _0xa60618=_0x230df8['params']['id'];var _0x42f672=_0x230df8[_0xd518('0x53')]?_0x230df8[_0xd518('0x53')][_0xd518('0x57')]:null;var _0x29c722=[];return Promise[_0xd518('0xfa')]()[_0xd518('0x1d')](function(){if(!_0x42f672)throw new APIBadRequestError(_0xd518('0x109'));})[_0xd518('0x1d')](function(){return db[_0xd518('0x32')]['findOne']({'where':{'id':_0xa60618}});})[_0xd518('0x1d')](function(_0xcbf9e4){if(!_0xcbf9e4)throw new APINotFoundError(util[_0xd518('0xa3')](_0xd518('0x105'),_0x230df8['params']['id']));return db[_0xd518('0x60')][_0xd518('0x10a')](function(_0x4f7974){return _0xcbf9e4[_0xd518('0x108')](_0x42f672,{'transaction':_0x4f7974})[_0xd518('0x1d')](function(){return db[_0xd518('0x106')]['findAll']({'where':{'id':{'$in':_0x42f672}}});})[_0xd518('0x1d')](function(_0x2d196c){var _0x3eee15=_[_0xd518('0x27')](_0x2d196c,function(_0x1e1de4){return _0x1e1de4[_0xd518('0x10b')]();});return Promise[_0xd518('0x4a')](_0x3eee15);})['then'](function(_0x395b33){_0x29c722=_['flattenDeep'](_0x395b33);var _0x21596b=_[_0xd518('0x27')](_0x29c722,function(_0x5e88b9){return _0x5e88b9[_0xd518('0x10c')](_0xcbf9e4['id'],{'transaction':_0x4f7974});});return Promise[_0xd518('0x4a')](_0x21596b);})[_0xd518('0x1d')](function(){if(!_0xcbf9e4[_0xd518('0xa2')])return;var _0x11d69b=_['filter'](_0x29c722,function(_0xf633b1){return _0xf633b1[_0xd518('0x10d')](_0xd518('0x91'))===_0xd518('0x10e');});var _0x3968a9=_[_0xd518('0x27')](_0x11d69b,function(_0x35843e){return db[_0xd518('0xa5')]['upsert']({'membername':_0xcbf9e4['name'],'UserId':_0xcbf9e4['id'],'queue_name':_0x35843e[_0xd518('0x30')],'VoiceQueueId':_0x35843e['id'],'interface':_[_0xd518('0x5e')](_0xcbf9e4['interface'])?util[_0xd518('0xa3')]('SIP/%s',_0xcbf9e4[_0xd518('0x30')]):_0xcbf9e4['interface'],'paused':_0xcbf9e4[_0xd518('0x93')]||![],'penalty':_0xcbf9e4[_0xd518('0x9b')]},{'transaction':_0x4f7974});});return Promise[_0xd518('0x4a')](_0x3968a9);})[_0xd518('0x1d')](function(){return db[_0xd518('0x10f')][_0xd518('0x42')]({'where':{'teamId':{'$in':_0x42f672}}});})[_0xd518('0x1d')](function(_0x3b5e5b){var _0x1e565a=_[_0xd518('0x27')](_0x3b5e5b,function(_0x516eda){return db['UserVoicePrefix']['create']({'UserId':_0xcbf9e4['id'],'VoicePrefixId':_0x516eda[_0xd518('0x110')]},{'transaction':_0x4f7974});});return Promise[_0xd518('0x4a')](_0x1e565a);});});})['then'](function(){for(var _0x443ec1=0x0;_0x443ec1<_0x29c722[_0xd518('0x44')];_0x443ec1++){var _0x501dec=_0x29c722[_0x443ec1][_0xd518('0x10d')]('channel');var _0x540723=_0x501dec+'QueueId';socket[_0xd518('0x9e')](_0xd518('0x21')+_0x501dec+'Queue:save',{'UserId':_0xa60618,['queueField']:_0x29c722[_0x443ec1]['id']});}})[_0xd518('0x1d')](respondWithStatusCode(_0x1b0b4b,null))['catch'](APIHandleError(_0x1b0b4b));};exports[_0xd518('0x111')]=function(_0x1e837f,_0x6e5028){var _0xa96b44=_0x1e837f['params']['id'];var _0x1b94d8=null;if(_0x1e837f[_0xd518('0x3d')][_0xd518('0x57')]){_0x1b94d8=_[_0xd518('0xa8')](_0x1e837f[_0xd518('0x3d')][_0xd518('0x57')])?_0x1e837f[_0xd518('0x3d')]['ids']:[_0x1e837f[_0xd518('0x3d')][_0xd518('0x57')]];}var _0x579975=[];return Promise['resolve']()[_0xd518('0x1d')](function(){if(!_0x1b94d8)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd518('0x1d')](function(){return db[_0xd518('0x32')][_0xd518('0xbe')]({'where':{'id':_0xa96b44}});})[_0xd518('0x1d')](function(_0xb70656){if(!_0xb70656)throw new APINotFoundError(util[_0xd518('0xa3')](_0xd518('0x105'),_0x1e837f['params']['id']));return db[_0xd518('0x60')][_0xd518('0x10a')](function(_0x470cb8){return _0xb70656['removeTeams'](_0x1b94d8,{'transaction':_0x470cb8})[_0xd518('0x1d')](function(){return db[_0xd518('0x106')][_0xd518('0x42')]({'where':{'id':{'$in':_0x1b94d8}}});})[_0xd518('0x1d')](function(_0x34fee5){var _0x24a60d=_[_0xd518('0x27')](_0x34fee5,function(_0x424fff){return _0x424fff[_0xd518('0x10b')]();});return Promise[_0xd518('0x4a')](_0x24a60d);})['then'](function(_0x19fccb){_0x579975=_[_0xd518('0x112')](_0x19fccb);var _0xba3614=_[_0xd518('0x27')](_0x579975,function(_0x2009f9){return _0x2009f9[_0xd518('0x113')](_0xb70656['id'],{'transaction':_0x470cb8});});return Promise[_0xd518('0x4a')](_0xba3614);})[_0xd518('0x1d')](function(){if(!_0xb70656['online'])return;var _0x464687=_[_0xd518('0x25')](_0x579975,function(_0x1b524e){return _0x1b524e[_0xd518('0x10d')](_0xd518('0x91'))===_0xd518('0x10e');});var _0xc65a9d=_[_0xd518('0x27')](_0x464687,function(_0x459829){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x459829['id'],'UserId':_0xb70656['id']},'transaction':_0x470cb8});});return Promise['all'](_0xc65a9d);})['then'](function(){return db[_0xd518('0x10f')][_0xd518('0x42')]({'where':{'teamId':{'$in':_0x1b94d8}}});})[_0xd518('0x1d')](function(_0x12de1a){var _0x3b51a3=_['map'](_0x12de1a,function(_0xb6b7d6){return db[_0xd518('0x114')][_0xd518('0x2c')]({'where':{'UserId':_0xb70656['id'],'VoicePrefixId':_0xb6b7d6[_0xd518('0x110')]}},{'transaction':_0x470cb8});});return Promise[_0xd518('0x4a')](_0x3b51a3);});});})[_0xd518('0x1d')](function(){for(var _0x3fd5ea=0x0;_0x3fd5ea<_0x579975[_0xd518('0x44')];_0x3fd5ea++){var _0x3bbda1=_0x579975[_0x3fd5ea]['getDataValue'](_0xd518('0x91'));var _0xe3b26b=_0x3bbda1+_0xd518('0x9d');socket[_0xd518('0x9e')]('user'+_0x3bbda1+_0xd518('0xa9'),{'UserId':_0xa96b44,['queueField']:_0x579975[_0x3fd5ea]['id']});}})[_0xd518('0x1d')](respondWithStatusCode(_0x6e5028,null))['catch'](APIHandleError(_0x6e5028));};exports[_0xd518('0x115')]=function(_0x158ed1,_0x472b8f){var _0x6b00d7={};var _0x2b4717={};var _0x3b7007;var _0x3f623d;return db['User'][_0xd518('0xbe')]({'where':{'id':_0x158ed1[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0x472b8f,null))[_0xd518('0x1d')](function(_0x123527){if(_0x123527){_0x3b7007=_0x123527;_0x2b4717[_0xd518('0xc7')]=_['keys'](db['CmList'][_0xd518('0x33')]);_0x2b4717[_0xd518('0x3d')]=_['keys'](_0x158ed1[_0xd518('0x3d')]);_0x2b4717[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x2b4717[_0xd518('0xc7')],_0x2b4717[_0xd518('0x3d')]);_0x6b00d7[_0xd518('0x40')]=_[_0xd518('0xcb')](_0x2b4717[_0xd518('0xc7')],qs[_0xd518('0xcc')](_0x158ed1[_0xd518('0x3d')][_0xd518('0xcc')]));_0x6b00d7[_0xd518('0x40')]=_0x6b00d7[_0xd518('0x40')][_0xd518('0x44')]?_0x6b00d7[_0xd518('0x40')]:_0x2b4717[_0xd518('0xc7')];_0x6b00d7[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x158ed1['query'][_0xd518('0xcd')]);_0x6b00d7[_0xd518('0x3c')]=qs['filters'](_[_0xd518('0xce')](_0x158ed1[_0xd518('0x3d')],_0x2b4717[_0xd518('0xca')]));if(_0x158ed1[_0xd518('0x3d')][_0xd518('0x25')]){_0x6b00d7['where']=_[_0xd518('0xcf')](_0x6b00d7[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0x6b00d7[_0xd518('0x40')],function(_0x120557){var _0x193afd={};_0x193afd[_0x120557]={'$like':'%'+_0x158ed1['query']['filter']+'%'};return _0x193afd;})});}_0x6b00d7=_['merge']({},_0x6b00d7,_0x158ed1[_0xd518('0x50')]);return _0x3b7007[_0xd518('0x115')](_0x6b00d7);}})[_0xd518('0x1d')](function(_0x489214){if(_0x489214){_0x3f623d=_0x489214[_0xd518('0x44')];if(!_0x158ed1[_0xd518('0x3d')][_0xd518('0xbf')](_0xd518('0xd6'))){_0x6b00d7['limit']=qs[_0xd518('0xd1')](_0x158ed1[_0xd518('0x3d')]['limit']);_0x6b00d7[_0xd518('0x15')]=qs[_0xd518('0x15')](_0x158ed1[_0xd518('0x3d')][_0xd518('0x15')]);}return _0x3b7007[_0xd518('0x115')](_0x6b00d7);}})['then'](function(_0x5902d0){if(_0x5902d0){return _0x5902d0?{'count':_0x3f623d,'rows':_0x5902d0}:null;}})[_0xd518('0x1d')](respondWithResult(_0x472b8f,null))[_0xd518('0x4b')](handleError(_0x472b8f,null));};exports[_0xd518('0x116')]=function(_0x43d16c,_0xd35a89){var _0x2d9103={};var _0x4cf932={};var _0x32ae4a;return db['User'][_0xd518('0xbe')]({'where':{'id':_0x43d16c[_0xd518('0x54')]['id']}})[_0xd518('0x1d')](handleEntityNotFound(_0xd35a89,null))[_0xd518('0x1d')](function(_0x4a5e6f){if(_0x4a5e6f){_0x32ae4a=_0x4a5e6f;_0x4cf932[_0xd518('0xc7')]=_[_0xd518('0xc9')](db[_0xd518('0x32')][_0xd518('0x33')]);_0x4cf932['query']=_['keys'](_0x43d16c['query']);_0x4cf932[_0xd518('0xca')]=_[_0xd518('0xcb')](_0x4cf932['model'],_0x4cf932['query']);_0x2d9103['attributes']=_[_0xd518('0xcb')](_0x4cf932['model'],qs[_0xd518('0xcc')](_0x43d16c[_0xd518('0x3d')]['fields']));_0x2d9103['attributes']=_0x2d9103[_0xd518('0x40')][_0xd518('0x44')]?_0x2d9103[_0xd518('0x40')]:_0x4cf932[_0xd518('0xc7')];_0x2d9103[_0xd518('0xd3')]=qs[_0xd518('0xcd')](_0x43d16c[_0xd518('0x3d')][_0xd518('0xcd')]);_0x2d9103[_0xd518('0x3c')]=qs[_0xd518('0xca')](_[_0xd518('0xce')](_0x43d16c[_0xd518('0x3d')],_0x4cf932[_0xd518('0xca')]));if(_0x43d16c[_0xd518('0x3d')][_0xd518('0x25')]){_0x2d9103[_0xd518('0x3c')]=_['merge'](_0x2d9103[_0xd518('0x3c')],{'$or':_[_0xd518('0x27')](_0x2d9103['attributes'],function(_0x511dc5){var _0x2bdc7f={};_0x2bdc7f[_0x511dc5]={'$like':'%'+_0x43d16c['query'][_0xd518('0x25')]+'%'};return _0x2bdc7f;})});}_0x2d9103['model']=db[_0xd518('0x32')];_0x2d9103['as']='Agents';_0x2d9103=_['merge']({},_0x2d9103,_0x43d16c[_0xd518('0x50')]);return _0x32ae4a[_0xd518('0xf0')]({'include':[_0x2d9103]});}})[_0xd518('0x1d')](function(_0x570e6a){if(_0x570e6a){var _0x49cfc4={},_0x5e6eef=[];for(var _0x8a3b8e=0x0;_0x8a3b8e<_0x570e6a['length'];_0x8a3b8e+=0x1){for(var _0x528065=0x0,_0x438adc;_0x528065<_0x570e6a[_0x8a3b8e][_0xd518('0x22')][_0xd518('0x44')];_0x528065+=0x1){_0x438adc=_0x570e6a[_0x8a3b8e]['Agents'][_0x528065][_0xd518('0x1e')]({'plain':!![]});_0x49cfc4[_0x438adc['id']]=_0x438adc;}}_0x49cfc4=_[_0xd518('0x117')](_0x49cfc4);for(var _0x3142c2=qs['offset'](_0x43d16c['query'][_0xd518('0x15')]);_0x3142c2<_0x49cfc4[_0xd518('0x44')]&&_0x5e6eef[_0xd518('0x44')]=_0x4c6987){_0x25fefe=_0x4c6987;_0x45463c=0xc8;}else{_0x45463c=0xce;}_0x1c2913['status'](_0x45463c);return _0x1c2913[_0x2974('0x1b')]('Content-Range',_0x322876+'-'+_0x25fefe+'/'+_0x4c6987)[_0x2974('0x16')](_0xeada34);}return null;};}function saveUpdates(_0xce775b){return function(_0x267615){if(_0x267615){return _0x267615[_0x2974('0x1c')](_0xce775b)[_0x2974('0x1d')](function(_0x56cba1){if(_0x56cba1[_0x2974('0x1e')]===_0x2974('0x1f')){socket[_0x2974('0x20')](_0x2974('0x21')+_0x56cba1['id'],_0x56cba1);}return _0x56cba1;});}return null;};}function removeEntity(_0x23b200){return function(_0x1a889f){if(_0x1a889f){return _0x1a889f[_0x2974('0x22')]()['then'](function(){var _0x35a361=_0x1a889f['get']({'plain':!![]});if(_0x35a361[_0x2974('0x1e')]==='admin')return;var _0xd5d768=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x2974('0x23'),'value':_0x2974('0x1f'),'ignore':![]},{'name':_0x2974('0x24'),'value':_0x2974('0x25'),'ignore':![]}];var _0x37f09e=_(_0xd5d768)[_0x2974('0x26')](_0x2974('0x27'))['map'](_0x2974('0x28'))[_0x2974('0x28')]();if(_[_0x2974('0x29')](_0x37f09e,_0x35a361[_0x2974('0x1e')])){return;}var _0x1a5b81=_['find'](_0xd5d768,[_0x2974('0x28'),_0x35a361[_0x2974('0x1e')]])[_0x2974('0x2a')];return db[_0x2974('0x2b')][_0x2974('0x22')]({'where':{'type':_0x1a5b81,'resourceId':_0x35a361['id']}})[_0x2974('0x1d')](function(){return _0x1a889f;});})['then'](function(){_0x23b200[_0x2974('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1d38f){return function(_0x22917c){if(!_0x22917c){_0xd1d38f[_0x2974('0x14')](0x194);}return _0x22917c;};}function handleError(_0x212c8e,_0x4616bc){_0x4616bc=_0x4616bc||0x1f4;return function(_0x437775){logger['error'](_0x437775[_0x2974('0x2d')]);if(_0x437775[_0x2974('0x2a')]){delete _0x437775[_0x2974('0x2a')];}_0x212c8e[_0x2974('0x2c')](_0x4616bc)[_0x2974('0x2e')](_0x437775);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x2974('0x2f')](function(_0x1d83c8){return{'name':_0x1d83c8[_0x2974('0x30')],'type':_0x1d83c8[_0x2974('0x31')][_0x2974('0x32')]};})[_0x2974('0x26')](function(_0x28e617){return![_0x2974('0x33'),_0x2974('0x34'),_0x2974('0x35'),_0x2974('0x36'),_0x2974('0x37'),'md5secret'][_0x2974('0x29')](_0x28e617[_0x2974('0x2a')]);})['value']();}exports[_0x2974('0x38')]=function(_0x8494af,_0x29db5f){var _0x43a54f={},_0x202d30={'count':0x0,'rows':[]};var _0x4f9210=getUserAttributes();_0x43a54f=qs['getOptions'](_0x4f9210,_0x8494af);var _0x420e78={'where':_0x43a54f[_0x2974('0x39')]};return db['User']['count'](_0x420e78)[_0x2974('0x1d')](function(_0x298cc6){_0x202d30[_0x2974('0x1a')]=_0x298cc6;if(_0x8494af[_0x2974('0x3a')][_0x2974('0x3b')]){_0x43a54f[_0x2974('0x3c')]=[{'all':!![]}];}if(_0x8494af[_0x2974('0x3a')][_0x2974('0x3d')]===_0x2974('0x3e')){_0x43a54f['include']=[{'model':db[_0x2974('0x3f')],'as':'userSetting'}];}if(!_[_0x2974('0x29')](_0x43a54f[_0x2974('0x40')],'id')){_0x43a54f[_0x2974('0x40')][_0x2974('0x41')]('id');}return db[_0x2974('0x42')]['findAll'](_0x43a54f);})[_0x2974('0x1d')](function(_0x29509b){_0x202d30[_0x2974('0x43')]=_0x29509b;if(_0x8494af[_0x2974('0x3a')][_0x2974('0x44')]===_0x2974('0x3e')){var _0x210538=[];for(var _0x4c38f7=0x0;_0x4c38f7<_0x202d30[_0x2974('0x43')][_0x2974('0x45')];_0x4c38f7++){_0x210538['push'](get_open_tabs(_0x2974('0x46'),_0x202d30[_0x2974('0x43')][_0x4c38f7][_0x2974('0x47')]));_0x210538['push'](get_open_tabs('sms',_0x202d30[_0x2974('0x43')][_0x4c38f7]['dataValues']));_0x210538[_0x2974('0x41')](get_open_tabs(_0x2974('0x48'),_0x202d30[_0x2974('0x43')][_0x4c38f7][_0x2974('0x47')]));_0x210538[_0x2974('0x41')](get_open_tabs('mail',_0x202d30[_0x2974('0x43')][_0x4c38f7]['dataValues']));_0x210538[_0x2974('0x41')](get_open_tabs('openchannel',_0x202d30[_0x2974('0x43')][_0x4c38f7]['dataValues']));_0x210538[_0x2974('0x41')](get_open_tabs('whatsapp',_0x202d30[_0x2974('0x43')][_0x4c38f7]['dataValues']));}return Promise[_0x2974('0x49')](_0x210538)[_0x2974('0x1d')](function(){return _0x202d30;});}else{return _0x202d30;}})[_0x2974('0x1d')](respondWithFilteredResult(_0x29db5f,_0x43a54f))[_0x2974('0x4a')](handleError(_0x29db5f,null));};exports[_0x2974('0x4b')]=function(_0x4ebe0e,_0x188c47){var _0x262f54=getUserAttributes();_0x4ebe0e['query']['id']=_0x4ebe0e['params']['id'];var _0x23737c=qs['getOptions'](_0x262f54,_0x4ebe0e);if(_0x4ebe0e['query'][_0x2974('0x3b')]){_0x23737c['include']=[{'all':!![]}];}if(_0x4ebe0e[_0x2974('0x3a')]['userSetting']==='true'){_0x23737c[_0x2974('0x3c')]=[{'model':db[_0x2974('0x3f')],'as':_0x2974('0x3d')}];}_0x23737c=_['merge']({},_0x23737c,_0x4ebe0e[_0x2974('0x4c')]);if(!_[_0x2974('0x29')](_0x23737c[_0x2974('0x40')],'id')){_0x23737c[_0x2974('0x40')][_0x2974('0x41')]('id');}return db['User'][_0x2974('0x4d')](_0x23737c)[_0x2974('0x1d')](handleEntityNotFound(_0x188c47,null))[_0x2974('0x1d')](function(_0x36aa6f){var _0x35e5a6=[];values=_0x36aa6f;if(_0x4ebe0e[_0x2974('0x3a')][_0x2974('0x44')]===_0x2974('0x3e')){_0x35e5a6[_0x2974('0x41')](get_open_tabs(_0x2974('0x46'),_0x36aa6f[_0x2974('0x47')]));_0x35e5a6['push'](get_open_tabs(_0x2974('0x4e'),_0x36aa6f[_0x2974('0x47')]));_0x35e5a6[_0x2974('0x41')](get_open_tabs(_0x2974('0x4f'),_0x36aa6f[_0x2974('0x47')]));_0x35e5a6[_0x2974('0x41')](get_open_tabs(_0x2974('0x50'),_0x36aa6f['dataValues']));_0x35e5a6['push'](get_open_tabs('fax',_0x36aa6f['dataValues']));_0x35e5a6[_0x2974('0x41')](get_open_tabs('mail',_0x36aa6f[_0x2974('0x47')]));return Promise['all'](_0x35e5a6);}else{return values;}})[_0x2974('0x1d')](function(){return values;})[_0x2974('0x1d')](respondWithResult(_0x188c47,null))[_0x2974('0x4a')](handleError(_0x188c47,null));};exports[_0x2974('0x1c')]=function(_0x1bdb4e,_0x2c61c4){if(_0x1bdb4e[_0x2974('0x51')]['id']){delete _0x1bdb4e[_0x2974('0x51')]['id'];}delete _0x1bdb4e[_0x2974('0x51')][_0x2974('0x1e')];return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x1bdb4e['params']['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x2c61c4,null))['then'](saveUpdates(_0x1bdb4e[_0x2974('0x51')],null))[_0x2974('0x1d')](respondWithResult(_0x2c61c4,null))['catch'](handleError(_0x2c61c4,null));};exports[_0x2974('0x52')]=function(_0x660b60,_0x1d041f){return db[_0x2974('0x42')][_0x2974('0x52')]()[_0x2974('0x1d')](respondWithResult(_0x1d041f,null))[_0x2974('0x4a')](handleError(_0x1d041f,null));};exports['addContacts']=function(_0x1ca11d,_0x510a60){return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x1ca11d[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x510a60,null))[_0x2974('0x1d')](function(_0x1d36b6){if(_0x1d36b6){return _0x1d36b6[_0x2974('0x54')](_0x1ca11d[_0x2974('0x51')][_0x2974('0x55')],_['omit'](_0x1ca11d[_0x2974('0x51')],[_0x2974('0x55'),'id'])||{});}})[_0x2974('0x1d')](respondWithResult(_0x510a60,null))[_0x2974('0x4a')](handleError(_0x510a60,null));};function validateUser(_0xbf376e){return new Promise(function(_0x55d4b8,_0x301bb2){if(_0xbf376e['internal'])return _0x55d4b8(_0xbf376e);return db[_0x2974('0x56')]['findById'](0x1)[_0x2974('0x1d')](function(_0x111805){if(_0x111805[_0x2974('0x57')])authService[_0x2974('0x58')](_0xbf376e['password']);db[_0x2974('0x42')][_0x2974('0x59')](_0x2974('0x5a'))[_0x2974('0x1d')](function(_0x14da99){if(_[_0x2974('0x5b')](_0x14da99)){_0xbf376e[_0x2974('0x5a')]=_0x111805['min_internal']||0x1;return;}if(_[_0x2974('0x5b')](_0x111805[_0x2974('0x5c')])||_0x111805[_0x2974('0x5c')]===_0x14da99){_0xbf376e['internal']=_0x14da99+0x1;return;}if(_0x111805['min_internal']>_0x14da99){_0xbf376e[_0x2974('0x5a')]=_0x111805['min_internal'];return;}return db[_0x2974('0x5d')][_0x2974('0x3a')](_0x2974('0x5e'),{'type':db[_0x2974('0x5d')][_0x2974('0x5f')]['SELECT']})[_0x2974('0x1d')](function(_0x4cf01c){if(_0x4cf01c&&_0x4cf01c['length']){for(var _0x59ff7c=0x0,_0x3e7dc5=_0x4cf01c[_0x2974('0x45')];_0x59ff7c<_0x3e7dc5&&_[_0x2974('0x5b')](_0xbf376e[_0x2974('0x5a')]);_0x59ff7c++){if(_0x111805['min_internal']<=_0x4cf01c[_0x59ff7c][_0x2974('0x60')]){_0xbf376e['internal']=_0x4cf01c[_0x59ff7c][_0x2974('0x60')];}else if(_0x111805[_0x2974('0x5c')]>_0x4cf01c[_0x59ff7c][_0x2974('0x60')]&&_0x111805[_0x2974('0x5c')]<=_0x4cf01c[_0x59ff7c]['to']){_0xbf376e[_0x2974('0x5a')]=_0x111805[_0x2974('0x5c')];}}}if(_['isNil'](_0xbf376e['internal'])){_0xbf376e['internal']=_0x14da99+0x1;}return _0x55d4b8(_0xbf376e);});});})[_0x2974('0x4a')](function(_0x5dc687){_0x301bb2(_0x5dc687);});});}function updateUser(_0x89c038){return new Promise(function(_0x21b4db,_0x2d85f3){try{if(_0x89c038[_0x2974('0x61')]){_0x89c038[_0x2974('0x62')]=_0x89c038[_0x2974('0x5a')];_0x89c038[_0x2974('0x63')]={'mailbox':_0x89c038['internal'],'password':_0x89c038[_0x2974('0x33')],'fullname':_0x89c038[_0x2974('0x64')],'email':_0x89c038[_0x2974('0x65')]};}if(_0x89c038[_0x2974('0x1e')]==='agent'){if(!_0x89c038[_0x2974('0x66')])_0x89c038[_0x2974('0x66')]=[_0x2974('0x67'),_0x2974('0x68'),_0x2974('0x69'),_0x2974('0x6a'),_0x2974('0x6b'),_0x2974('0x6c'),_0x2974('0x6d'),'106','107','108',_0x2974('0x6e'),_0x2974('0x6f'),_0x2974('0x70'),'114',_0x2974('0x71')];}_0x21b4db(_0x89c038);}catch(_0x59b67c){_0x2d85f3(_0x59b67c);}});}exports[_0x2974('0x72')]=function(_0x58bd41,_0x5cdd92){if(_0x58bd41[_0x2974('0x73')]['role']==='agent')throw new Error(_0x2974('0x74'));if(_0x58bd41[_0x2974('0x51')][_0x2974('0x1e')]===_0x2974('0x73')&&_0x58bd41[_0x2974('0x73')][_0x2974('0x1e')]!==_0x2974('0x75')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x58bd41[_0x2974('0x51')][_0x2974('0x1e')]===_0x2974('0x75')&&_0x58bd41[_0x2974('0x73')]['role']!==_0x2974('0x75')){throw new Error(_0x2974('0x76'));}return licenseUtil[_0x2974('0x77')]([_0x58bd41['body']])['then'](function(){return validateUser(_0x58bd41[_0x2974('0x51')]);})['then'](function(_0x49eb80){return updateUser(_0x49eb80)[_0x2974('0x1d')](function(_0x6c7e34){if(_0x6c7e34[_0x2974('0x1e')]===_0x2974('0x75')){_0x6c7e34[_0x2974('0x78')]=_0x58bd41[_0x2974('0x73')][_0x2974('0x78')];delete _0x6c7e34[_0x2974('0x79')];}return _0x6c7e34;});})[_0x2974('0x1d')](function(_0x2047a7){return db[_0x2974('0x42')][_0x2974('0x72')](_0x2047a7,{'include':[{'model':db['VoiceMail'],'as':_0x2974('0x63')}]});})[_0x2974('0x1d')](function(_0x5e02e4){if(_0x58bd41[_0x2974('0x51')][_0x2974('0x1e')]===_0x2974('0x73'))return _0x5e02e4;if(_0x58bd41['user'][_0x2974('0x1e')]!==_0x2974('0x73'))return _0x5e02e4;return db[_0x2974('0x7a')][_0x2974('0x4d')]({'where':{'name':_0x5e02e4[_0x2974('0x1e')]===_0x2974('0x1f')?'Agents':'Telephones','userProfileId':_0x58bd41[_0x2974('0x73')]['userProfileId']},'raw':!![]})[_0x2974('0x1d')](function(_0x53ffaf){if(!_0x53ffaf||_0x53ffaf[_0x2974('0x7b')]!=0x0)return _0x5e02e4;return db['UserProfileResource'][_0x2974('0x72')]({'name':_0x5e02e4[_0x2974('0x2a')],'resourceId':_0x5e02e4['id'],'type':_0x53ffaf[_0x2974('0x2a')],'sectionId':_0x53ffaf['id']},{})[_0x2974('0x1d')](function(){return _0x5e02e4;});})[_0x2974('0x4a')](function(_0x4a6f78){logger[_0x2974('0x7c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a6f78);throw _0x4a6f78;});})[_0x2974('0x1d')](respondWithResult(_0x5cdd92,0xc9))['catch'](handleError(_0x5cdd92,null));};exports[_0x2974('0x7d')]=function(_0x16ef5a,_0x2f33fc){var _0x2962ef=_0x16ef5a[_0x2974('0x51')];var _0x192f6b=[];if(_0x16ef5a['user'][_0x2974('0x1e')]===_0x2974('0x1f'))throw new Error(_0x2974('0x74'));if(_['some'](_0x2962ef,['role',_0x2974('0x73')])&&_0x16ef5a[_0x2974('0x73')]['role']!==_0x2974('0x75')){throw new Error(_0x2974('0x7e'));}if(_[_0x2974('0x7f')](_0x2962ef,['role',_0x2974('0x75')])&&_0x16ef5a['user'][_0x2974('0x1e')]!==_0x2974('0x75')){throw new Error(_0x2974('0x80'));}return licenseUtil[_0x2974('0x77')](_0x2962ef)['then'](function(){return validateUser(_0x2962ef[0x0]);})[_0x2974('0x1d')](function(){for(var _0x14ca45=0x1;_0x14ca45<_0x2962ef[_0x2974('0x45')];_0x14ca45++){var _0x130615=_0x2962ef[_0x14ca45-0x1][_0x2974('0x5a')];if(!_0x2962ef[_0x14ca45][_0x2974('0x5a')])_0x2962ef[_0x14ca45]['internal']=_0x130615+0x1;_0x192f6b[_0x2974('0x41')](validateUser(_0x2962ef[_0x14ca45]));}return Promise[_0x2974('0x49')](_0x192f6b);})[_0x2974('0x1d')](function(){_0x192f6b=[];for(var _0x9a825f=0x0;_0x9a825f<_0x2962ef['length'];_0x9a825f++){_0x192f6b[_0x2974('0x41')](updateUser(_0x2962ef[_0x9a825f]));}return Promise[_0x2974('0x49')](_0x192f6b);})[_0x2974('0x1d')](function(){_0x192f6b=_0x2962ef[_0x2974('0x2f')](function(_0xdb9cb4){return db['User'][_0x2974('0x72')](_0xdb9cb4,{'include':[{'model':db[_0x2974('0x63')],'as':_0x2974('0x63')}]})[_0x2974('0x1d')](function(_0x2d1c31){_0xdb9cb4['id']=_0x2d1c31['id'];return _0xdb9cb4;});});return Promise[_0x2974('0x49')](_0x192f6b);})['then'](function(_0x459f9e){if(_0x16ef5a['body']['role']===_0x2974('0x73'))return _0x459f9e;if(_0x16ef5a['user']['role']!=='user')return _0x459f9e;var _0x1b01c2=_[_0x2974('0x7f')](_0x459f9e,function(_0x3e6eee){return _0x3e6eee[_0x2974('0x1e')]==='agent'||_0x3e6eee[_0x2974('0x1e')]===_0x2974('0x25');});if(!_0x1b01c2)return _0x459f9e;return db[_0x2974('0x7a')]['findAll']({'where':{'name':{'$or':[_0x2974('0x23'),'Telephones']},'userProfileId':_0x16ef5a['user'][_0x2974('0x79')]},'raw':!![]})['then'](function(_0x5a0c3a){if(_['isEmpty'](_0x5a0c3a)||!_['some'](_0x5a0c3a,[_0x2974('0x7b'),0x0]))return _0x459f9e;_0x192f6b=[];var _0x11fad3=_(_0x5a0c3a)['map'](function(_0x597ae9){if(_0x597ae9[_0x2974('0x7b')]===0x1)return;return _0x597ae9[_0x2974('0x2a')]===_0x2974('0x23')?'agent':'telephone';})[_0x2974('0x81')]()['value']();for(var _0x2ef8f2=0x0;_0x2ef8f2<_0x459f9e[_0x2974('0x45')];_0x2ef8f2++){if(!_[_0x2974('0x29')](_0x11fad3,_0x459f9e[_0x2ef8f2][_0x2974('0x1e')]))return;var _0xd96e0d=_0x459f9e[_0x2ef8f2][_0x2974('0x1e')]===_0x2974('0x1f')?_0x2974('0x23'):_0x2974('0x24');_0x192f6b[_0x2974('0x41')](db[_0x2974('0x2b')][_0x2974('0x72')]({'name':_0x459f9e[_0x2ef8f2]['name'],'resourceId':_0x459f9e[_0x2ef8f2]['id'],'type':_0xd96e0d,'sectionId':_['find'](_0x5a0c3a,[_0x2974('0x2a'),_0xd96e0d])['id']},{}));}return Promise[_0x2974('0x49')](_0x192f6b);});})[_0x2974('0x1d')](respondWithResult(_0x2f33fc,0xc9))[_0x2974('0x4a')](handleError(_0x2f33fc,null));};exports[_0x2974('0x82')]=function(_0x47e45e,_0x3d123d){if(_0x47e45e['body']['id']){delete _0x47e45e[_0x2974('0x51')]['id'];}return db[_0x2974('0x42')]['find']({'where':{'id':_0x47e45e[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](function(_0x53c339){if(!_0x53c339)return null;if(_0x53c339['id']===_0x47e45e[_0x2974('0x73')]['id']){if(!_0x47e45e[_0x2974('0x51')]['oldPassword']||!_0x47e45e['body'][_0x2974('0x83')]){throw new db['Sequelize'][(_0x2974('0x84'))](_0x2974('0x85'));}if(!_0x53c339[_0x2974('0x86')](_0x47e45e[_0x2974('0x51')][_0x2974('0x87')])){throw new db['Sequelize']['ValidationError'](_0x2974('0x88'));}if(_0x47e45e['body'][_0x2974('0x87')]===_0x47e45e[_0x2974('0x51')][_0x2974('0x83')]){throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))](_0x2974('0x8a'));}}else if(_0x47e45e[_0x2974('0x73')][_0x2974('0x1e')]===_0x2974('0x75')){if(!_0x47e45e[_0x2974('0x51')][_0x2974('0x83')]){throw new db[(_0x2974('0x89'))]['ValidationError'](_0x2974('0x8b'));}}else if(_0x47e45e[_0x2974('0x73')][_0x2974('0x1e')]==='user'){if(!_0x47e45e['body']['newPassword']){throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))](_0x2974('0x8b'));}if(_0x53c339[_0x2974('0x1e')]!=='agent'){throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))](_0x2974('0x74'));}}else{throw new db['Sequelize'][(_0x2974('0x84'))](_0x2974('0x74'));}return _0x53c339;})[_0x2974('0x1d')](handleEntityNotFound(_0x3d123d,null))[_0x2974('0x1d')](function(_0x86f47b){return db[_0x2974('0x56')][_0x2974('0x8c')]({'attributes':['id',_0x2974('0x57'),_0x2974('0x8d'),_0x2974('0x8e')]})[_0x2974('0x1d')](function(_0x3022c0){if(_0x3022c0['securePassword'])authService[_0x2974('0x58')](_0x47e45e[_0x2974('0x51')][_0x2974('0x83')]);if(!_0x3022c0[_0x2974('0x8d')]||!_0x86f47b['previousPasswords'])return _0x86f47b;authService[_0x2974('0x8f')](_0x47e45e[_0x2974('0x51')]['newPassword'],_0x86f47b[_0x2974('0x35')],_0x3022c0[_0x2974('0x8e')]);return _0x86f47b;})[_0x2974('0x1d')](saveUpdates({'password':_0x47e45e['body'][_0x2974('0x83')],'passwordResetAt':_0x47e45e[_0x2974('0x73')]['id']==_0x47e45e[_0x2974('0x53')]['id']?moment():null,'previousPasswords':authService[_0x2974('0x90')](_0x47e45e[_0x2974('0x51')][_0x2974('0x83')],_0x86f47b[_0x2974('0x35')])},null));})[_0x2974('0x1d')](respondWithResult(_0x3d123d,null))['catch'](handleError(_0x3d123d,null));};exports[_0x2974('0x91')]=function(_0x46a600,_0x26f4cf){var _0x57659e=_0x46a600[_0x2974('0x51')][_0x2974('0x92')];return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x46a600['params']['id']},'attributes':['id','name',_0x2974('0x1e'),_0x2974('0x93'),_0x2974('0x94'),_0x2974('0x95'),_0x2974('0x96')]})[_0x2974('0x1d')](handleEntityNotFound(_0x26f4cf,null))[_0x2974('0x1d')](function(_0xe465a5){if(_0xe465a5){if(!utils[_0x2974('0x97')](_0x57659e)){throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))](_0x2974('0x98'));}return _0xe465a5[_0x2974('0x99')+_[_0x2974('0x9a')](_0x57659e['toLowerCase']())+_0x2974('0x9b')](_0x46a600[_0x2974('0x51')]['ids'],{'penalty':_0x46a600[_0x2974('0x51')][_0x2974('0x9c')]||0x0})[_0x2974('0x9d')](function(_0x2fdfe3){for(var _0x446fbb=0x0;_0x446fbb<_0x46a600[_0x2974('0x51')]['ids'][_0x2974('0x45')];_0x446fbb+=0x1){var _0x4f7d0f={'UserId':Number(_0x46a600[_0x2974('0x53')]['id'])};_0x4f7d0f[_['capitalize'](_0x57659e[_0x2974('0x9e')]())+_0x2974('0x9f')]=Number(_0x46a600[_0x2974('0x51')][_0x2974('0x55')][_0x446fbb]);socket[_0x2974('0x20')](_0x2974('0x73')+_['capitalize'](_0x57659e[_0x2974('0x9e')]())+_0x2974('0xa0'),_0x4f7d0f);}return _0x2fdfe3;})['then'](function(){if(_0x57659e===_0x2974('0xa1')){return db[_0x2974('0xa2')]['findAll']({'where':{'id':_0x46a600[_0x2974('0x51')][_0x2974('0x55')]||[]},'raw':!![],'attributes':['id',_0x2974('0x2a')]});}})[_0x2974('0x1d')](function(_0x48d28a){var _0x20f4f0=_0xe465a5[_0x2974('0xa3')]({'plain':!![]});var _0x287f7b=[];if(_0x57659e===_0x2974('0xa1')&&_0x20f4f0[_0x2974('0x1e')]===_0x2974('0x1f')&&_0x20f4f0[_0x2974('0x93')]){for(let _0x45dc40=0x0;_0x45dc40<_0x48d28a[_0x2974('0x45')];_0x45dc40+=0x1){_0x287f7b[_0x2974('0x41')]({'membername':_0x20f4f0[_0x2974('0x2a')],'UserId':_0x20f4f0['id'],'queue_name':_0x48d28a[_0x45dc40][_0x2974('0x2a')],'VoiceQueueId':_0x48d28a[_0x45dc40]['id'],'interface':_['isNil'](_0x20f4f0[_0x2974('0x96')])?util[_0x2974('0xa4')](_0x2974('0xa5'),_0x20f4f0[_0x2974('0x2a')]):_0x20f4f0['interface'],'paused':_0x20f4f0[_0x2974('0x95')]||![],'penalty':_0x46a600[_0x2974('0x51')][_0x2974('0x9c')]||0x0});}return Promise[_0x2974('0x49')](_0x287f7b[_0x2974('0x2f')](function(_0x526a21){return db['UserVoiceQueueRt']['upsert'](_0x526a21);}));}return _0xe465a5;});}})[_0x2974('0x1d')](respondWithStatusCode(_0x26f4cf,null))['catch'](handleError(_0x26f4cf,null));};exports[_0x2974('0xa6')]=function(_0x5929f7,_0x5416c5){var _0x4130ef,_0x14c47d;return db[_0x2974('0x42')]['find']({'where':{'id':_0x5929f7[_0x2974('0x53')]['id']},'attributes':['id','name','role']})[_0x2974('0x1d')](handleEntityNotFound(_0x5416c5,null))[_0x2974('0x1d')](function(_0x9d482e){if(_0x9d482e){_0x4130ef=_0x9d482e;if(!_0x5929f7[_0x2974('0x3a')][_0x2974('0x92')]||!utils[_0x2974('0x97')](_0x5929f7[_0x2974('0x3a')]['channel'])){throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))](_0x2974('0x98'));}return _0x9d482e[_0x2974('0xa7')+_[_0x2974('0x9a')](_0x5929f7[_0x2974('0x3a')]['channel']['toLowerCase']())+'Queues'](_0x5929f7[_0x2974('0x3a')][_0x2974('0x55')]);}})['then'](function(_0x31df25){if(_['isArray'](_0x5929f7[_0x2974('0x3a')]['ids'])){for(var _0x33fec5=0x0;_0x33fec5<_0x5929f7[_0x2974('0x3a')][_0x2974('0x55')][_0x2974('0x45')];_0x33fec5+=0x1){_0x14c47d={'UserId':Number(_0x5929f7[_0x2974('0x53')]['id'])};_0x14c47d[_[_0x2974('0x9a')](_0x5929f7[_0x2974('0x3a')][_0x2974('0x92')][_0x2974('0x9e')]())+_0x2974('0x9f')]=Number(_0x5929f7[_0x2974('0x3a')]['ids'][_0x33fec5]);socket[_0x2974('0x20')](_0x2974('0x73')+_[_0x2974('0x9a')](_0x5929f7[_0x2974('0x3a')][_0x2974('0x92')][_0x2974('0x9e')]())+'Queue:remove',_0x14c47d);}}else{_0x14c47d={'UserId':Number(_0x5929f7[_0x2974('0x53')]['id'])};_0x14c47d[_[_0x2974('0x9a')](_0x5929f7[_0x2974('0x3a')][_0x2974('0x92')][_0x2974('0x9e')]())+'QueueId']=Number(_0x5929f7[_0x2974('0x3a')][_0x2974('0x55')]);socket[_0x2974('0x20')](_0x2974('0x73')+_[_0x2974('0x9a')](_0x5929f7[_0x2974('0x3a')][_0x2974('0x92')]['toLowerCase']())+_0x2974('0xa8'),_0x14c47d);}return _0x31df25;})['then'](function(){if(_0x5929f7[_0x2974('0x3a')][_0x2974('0x92')]===_0x2974('0xa1')){return db[_0x2974('0xa9')][_0x2974('0x22')]({'where':{'UserId':_0x5929f7[_0x2974('0x53')]['id'],'VoiceQueueId':_0x5929f7[_0x2974('0x3a')][_0x2974('0x55')]},'individualHooks':!![]})['then'](function(){return _0x4130ef;});}return _0x4130ef;})[_0x2974('0x1d')](respondWithStatusCode(_0x5416c5,null))[_0x2974('0x4a')](handleError(_0x5416c5,null));};exports[_0x2974('0xaa')]=function(_0x1a8298,_0x537d67){_0x1a8298[_0x2974('0x51')][_0x2974('0xab')]=_0x1a8298[_0x2974('0xac')][_0x2974('0xad')];return db[_0x2974('0x42')]['find']({'where':{'id':_0x1a8298['params']['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x537d67,null))[_0x2974('0x1d')](saveUpdates(_0x1a8298['body'],null))[_0x2974('0x1d')](respondWithResult(_0x537d67,null))[_0x2974('0x4a')](handleError(_0x537d67,null));};exports['getAvatar']=function(_0x113897,_0x18fe1e){var _0x57d016=path['join'](config[_0x2974('0xae')],_0x2974('0xaf'));return db['User'][_0x2974('0x4d')]({'where':{'id':_0x113897[_0x2974('0x53')]['id']},'attributes':['id',_0x2974('0xab')],'raw':!![]})[_0x2974('0x1d')](handleEntityNotFound(_0x18fe1e,null))['then'](function(_0x1127c4){if(_0x1127c4){if(_[_0x2974('0x5b')](_0x1127c4['userpic'])){return _0x18fe1e[_0x2974('0xb0')](_0x57d016);}else{if(!fs[_0x2974('0xb1')](path[_0x2974('0xb2')](config[_0x2974('0xae')],_0x2974('0xb3'),_0x1127c4['userpic']))){return _0x18fe1e[_0x2974('0xb0')](_0x57d016);}return _0x18fe1e[_0x2974('0xb0')](path[_0x2974('0xb2')](config[_0x2974('0xae')],_0x2974('0xb3'),_0x1127c4[_0x2974('0xab')]));}}})['catch'](handleError(_0x18fe1e,null));};exports[_0x2974('0xb4')]=function(_0x40e625,_0x59cf41){return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x40e625['params']['id']},'attributes':['id']})[_0x2974('0x1d')](handleEntityNotFound(_0x59cf41,null))[_0x2974('0x1d')](function(_0x40b99c){var _0x461d9b=[];values=_0x40b99c[_0x2974('0x47')];_0x461d9b['push'](get_open_tabs(_0x2974('0x46'),_0x40b99c[_0x2974('0x47')]));_0x461d9b[_0x2974('0x41')](get_open_tabs(_0x2974('0x4e'),_0x40b99c[_0x2974('0x47')]));_0x461d9b[_0x2974('0x41')](get_open_tabs('openchannel',_0x40b99c[_0x2974('0x47')]));_0x461d9b[_0x2974('0x41')](get_open_tabs(_0x2974('0x50'),_0x40b99c['dataValues']));_0x461d9b[_0x2974('0x41')](get_open_tabs(_0x2974('0x48'),_0x40b99c['dataValues']));_0x461d9b[_0x2974('0x41')](get_open_tabs(_0x2974('0xb5'),_0x40b99c[_0x2974('0x47')]));return Promise['all'](_0x461d9b);})[_0x2974('0x1d')](function(_0x31f770){if(_0x31f770){var _0x589698=_['map'](values[_0x2974('0xb6')],function(_0x5d94eb){return{'channel':_0x2974('0xb7'),'id':_0x5d94eb['id'],'createdAt':_0x5d94eb[_0x2974('0xb8')]};});var _0x4f27e3=_[_0x2974('0x2f')](values['FaxOpenTabs'],function(_0x425672){return{'channel':'FAX','id':_0x425672['id'],'createdAt':_0x425672[_0x2974('0xb8')]};});var _0x5e0acb=_[_0x2974('0x2f')](values[_0x2974('0xb9')],function(_0x820ed7){return{'channel':_0x2974('0xba'),'id':_0x820ed7['id'],'createdAt':_0x820ed7[_0x2974('0xb8')]};});var _0x2a8629=_[_0x2974('0x2f')](values['MailOpenTabs'],function(_0x24f89f){return{'channel':'MAIL','id':_0x24f89f['id'],'createdAt':_0x24f89f['createdAt']};});var _0xdfbd93=_[_0x2974('0x2f')](values['SmsOpenTabs'],function(_0x26753a){return{'channel':_0x2974('0xbb'),'id':_0x26753a['id'],'createdAt':_0x26753a['createdAt']};});var _0x17d6da=_[_0x2974('0x2f')](values['WhatsappOpenTabs'],function(_0x15b038){return{'channel':_0x2974('0xbc'),'id':_0x15b038['id'],'createdAt':_0x15b038[_0x2974('0xb8')]};});var _0x4341ed=_[_0x2974('0xbd')](_0x589698,_0x4f27e3,_0x5e0acb,_0x2a8629,_0xdfbd93,_0x17d6da);var _0x4c9540={'count':_0x4341ed[_0x2974('0x45')],'rows':_0x4341ed};return _0x4c9540;}else return null;})[_0x2974('0x1d')](respondWithResult(_0x59cf41,null))[_0x2974('0x4a')](handleError(_0x59cf41,null));};exports[_0x2974('0xbe')]=function(_0x40859a,_0x26037c){var _0x534544={};return db['User'][_0x2974('0x8c')]({'where':{'id':_0x40859a[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](function(_0x57d7fb){if(!_0x57d7fb){throw new APINotFoundError(util[_0x2974('0xa4')](_0x2974('0xbf'),_0x40859a[_0x2974('0x53')]['id']));}return contacts[_0x2974('0x52')]();})['then'](function(_0x4d6de1){_0x40859a[_0x2974('0x3a')][_0x2974('0x42')]=_0x40859a[_0x2974('0x53')]['id'];_0x534544=qs[_0x2974('0xc0')](_0x4d6de1,_0x40859a);if(_0x40859a[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0x3b'))){_0x534544['include']=[{'model':db[_0x2974('0xc2')],'as':_0x2974('0xc3'),'required':![]},{'model':db[_0x2974('0xc4')],'as':_0x2974('0xc5'),'attributes':['id','name',_0x2974('0xc6')],'where':_0x40859a[_0x2974('0x3a')][_0x2974('0xc7')]?{'id':_0x40859a[_0x2974('0x3a')][_0x2974('0xc7')]}:undefined,'required':_0x40859a[_0x2974('0x3a')][_0x2974('0xc7')]?!![]:![]}];}return contacts[_0x2974('0xc8')](_0x40859a[_0x2974('0x3a')],_0x40859a[_0x2974('0x73')],_0x534544,_0x4d6de1);})[_0x2974('0x1d')](respondWithFilteredResult(_0x26037c,_0x534544))['catch'](APIHandleError(_0x26037c));};exports['getQueues']=function(_0x2cd20e,_0x2b7a73){var _0x432c22;var _0x5a719b={};var _0x153240;return db['User']['findOne']({'where':{'id':_0x2cd20e[_0x2974('0x53')]['id']},'attributes':['id','name',_0x2974('0x1e')]})[_0x2974('0x1d')](handleEntityNotFound(_0x2b7a73,null))['then'](function(_0x2e136a){if(!utils[_0x2974('0x97')](_0x2cd20e[_0x2974('0x3a')]['channel'])){throw new db[(_0x2974('0x89'))]['ValidationError']('Unknown\x20channel');}_0x432c22=_0x2e136a;var _0x127617={};_0x127617[_0x2974('0xc9')]=_[_0x2974('0xca')](db[_[_0x2974('0x9a')](_0x2cd20e[_0x2974('0x3a')]['channel'])+_0x2974('0xcb')][_0x2974('0xcc')]);_0x127617[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x2cd20e[_0x2974('0x3a')]);_0x127617[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x127617[_0x2974('0xc9')],_0x127617[_0x2974('0x3a')]);_0x5a719b[_0x2974('0x40')]=_[_0x2974('0xce')](_0x127617[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x2cd20e['query']['fields']));_0x5a719b['attributes']=_0x5a719b[_0x2974('0x40')][_0x2974('0x45')]?_0x5a719b[_0x2974('0x40')]:_0x127617['model'];_0x5a719b[_0x2974('0xd0')]=qs[_0x2974('0xd1')](_0x2cd20e[_0x2974('0x3a')][_0x2974('0xd1')]);_0x5a719b[_0x2974('0x39')]=qs[_0x2974('0xcd')](_['pick'](_0x2cd20e['query'],_0x127617[_0x2974('0xcd')]));if(_0x2cd20e[_0x2974('0x3a')][_0x2974('0x26')]){_0x5a719b[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x5a719b[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x5a719b['attributes'],function(_0x1c9d7d){var _0x38777b={};_0x38777b[_0x1c9d7d]={'$like':'%'+_0x2cd20e[_0x2974('0x3a')]['filter']+'%'};return _0x38777b;})});}_0x5a719b=_[_0x2974('0xd2')]({},_0x5a719b,_0x2cd20e['options']);switch(_0x432c22[_0x2974('0x1e')]){case'admin':return db[_[_0x2974('0x9a')](_0x2cd20e[_0x2974('0x3a')][_0x2974('0x92')])+_0x2974('0xcb')][_0x2974('0xc8')](_0x5a719b);case _0x2974('0x73'):case _0x2974('0x1f'):return _0x432c22[_0x2974('0xa3')+_['capitalize'](_0x2cd20e['query'][_0x2974('0x92')])+_0x2974('0x9b')](_0x5a719b);default:throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))](_0x2974('0xd3'));}})[_0x2974('0x1d')](function(_0x4aca53){_0x153240=_0x4aca53[_0x2974('0x45')];if(!_0x2cd20e['query']['hasOwnProperty'](_0x2974('0xd4'))){_0x5a719b[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x2cd20e['query'][_0x2974('0x19')]);_0x5a719b['offset']=qs['offset'](_0x2cd20e['query']['offset']);}switch(_0x432c22[_0x2974('0x1e')]){case _0x2974('0x75'):return db[_[_0x2974('0x9a')](_0x2cd20e[_0x2974('0x3a')]['channel'])+'Queue']['findAll'](_0x5a719b);case'user':case'agent':return _0x432c22['get'+_[_0x2974('0x9a')](_0x2cd20e[_0x2974('0x3a')]['channel'])+_0x2974('0x9b')](_0x5a719b);}})[_0x2974('0x1d')](function(_0x5e7007){return{'count':_0x153240,'rows':_0x5e7007};})[_0x2974('0x1d')](respondWithResult(_0x2b7a73,null))[_0x2974('0x4a')](handleError(_0x2b7a73,null));};exports[_0x2974('0xd5')]=function(_0x12b2a7,_0x5df768){var _0x51f351={};var _0x3cc3db={};var _0x5f283e;var _0x425d13;return db[_0x2974('0x42')]['findOne']({'where':{'id':_0x12b2a7[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x5df768,null))[_0x2974('0x1d')](function(_0x26db1b){if(_0x26db1b){_0x5f283e=_0x26db1b;_0x3cc3db['model']=_[_0x2974('0xca')](db[_0x2974('0xa9')][_0x2974('0xcc')]);_0x3cc3db[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x12b2a7['query']);_0x3cc3db[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x3cc3db[_0x2974('0xc9')],_0x3cc3db[_0x2974('0x3a')]);_0x51f351[_0x2974('0x40')]=_[_0x2974('0xce')](_0x3cc3db['model'],qs[_0x2974('0xcf')](_0x12b2a7[_0x2974('0x3a')][_0x2974('0xcf')]));_0x51f351['attributes']=_0x51f351['attributes'][_0x2974('0x45')]?_0x51f351[_0x2974('0x40')]:_0x3cc3db[_0x2974('0xc9')];_0x51f351[_0x2974('0xd0')]=qs['sort'](_0x12b2a7[_0x2974('0x3a')][_0x2974('0xd1')]);_0x51f351[_0x2974('0x39')]=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x12b2a7[_0x2974('0x3a')],_0x3cc3db[_0x2974('0xcd')]));if(_0x12b2a7['query'][_0x2974('0x26')]){_0x51f351[_0x2974('0x39')]=_['merge'](_0x51f351[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x51f351['attributes'],function(_0x1ec028){var _0x538e56={};_0x538e56[_0x1ec028]={'$like':'%'+_0x12b2a7[_0x2974('0x3a')][_0x2974('0x26')]+'%'};return _0x538e56;})});}_0x51f351=_[_0x2974('0xd2')]({},_0x51f351,_0x12b2a7[_0x2974('0x4c')]);return _0x5f283e['getVoiceQueuesRt'](_0x51f351);}})[_0x2974('0x1d')](function(_0xa8fa0d){if(_0xa8fa0d){_0x425d13=_0xa8fa0d[_0x2974('0x45')];if(!_0x12b2a7[_0x2974('0x3a')][_0x2974('0xc1')]('nolimit')){_0x51f351[_0x2974('0x19')]=qs['limit'](_0x12b2a7[_0x2974('0x3a')][_0x2974('0x19')]);_0x51f351[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x12b2a7[_0x2974('0x3a')][_0x2974('0x17')]);}return _0x5f283e[_0x2974('0xd5')](_0x51f351);}})[_0x2974('0x1d')](function(_0x2c1d60){if(_0x2c1d60){return _0x2c1d60?{'count':_0x425d13,'rows':_0x2c1d60}:null;}})[_0x2974('0x1d')](respondWithResult(_0x5df768,null))[_0x2974('0x4a')](handleError(_0x5df768,null));};exports[_0x2974('0xd7')]=function(_0x1b48d3,_0x48a7eb){var _0x146153={};var _0x29d2f8={};var _0x36e7b1;var _0x193bf6;return db[_0x2974('0x42')]['findOne']({'where':{'id':_0x1b48d3[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x48a7eb,null))[_0x2974('0x1d')](function(_0x1e8518){if(_0x1e8518){_0x36e7b1=_0x1e8518;_0x29d2f8[_0x2974('0xc9')]=_['keys'](db[_0x2974('0xd8')][_0x2974('0xcc')]);_0x29d2f8[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x1b48d3[_0x2974('0x3a')]);_0x29d2f8['filters']=_['intersection'](_0x29d2f8['model'],_0x29d2f8[_0x2974('0x3a')]);_0x146153[_0x2974('0x40')]=_[_0x2974('0xce')](_0x29d2f8['model'],qs[_0x2974('0xcf')](_0x1b48d3['query'][_0x2974('0xcf')]));_0x146153[_0x2974('0x40')]=_0x146153['attributes']['length']?_0x146153[_0x2974('0x40')]:_0x29d2f8[_0x2974('0xc9')];_0x146153['order']=qs[_0x2974('0xd1')](_0x1b48d3[_0x2974('0x3a')][_0x2974('0xd1')]);_0x146153[_0x2974('0x39')]=qs[_0x2974('0xcd')](_['pick'](_0x1b48d3[_0x2974('0x3a')],_0x29d2f8[_0x2974('0xcd')]));if(_0x1b48d3[_0x2974('0x3a')][_0x2974('0x26')]){_0x146153[_0x2974('0x39')]=_['merge'](_0x146153['where'],{'$or':_[_0x2974('0x2f')](_0x146153[_0x2974('0x40')],function(_0x1dd0cc){var _0x315e1e={};_0x315e1e[_0x1dd0cc]={'$like':'%'+_0x1b48d3[_0x2974('0x3a')][_0x2974('0x26')]+'%'};return _0x315e1e;})});}_0x146153=_[_0x2974('0xd2')]({},_0x146153,_0x1b48d3[_0x2974('0x4c')]);return _0x36e7b1[_0x2974('0xd7')](_0x146153);}})[_0x2974('0x1d')](function(_0x2e0c2e){if(_0x2e0c2e){_0x193bf6=_0x2e0c2e[_0x2974('0x45')];if(!_0x1b48d3[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0xd4'))){_0x146153[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x1b48d3[_0x2974('0x3a')][_0x2974('0x19')]);_0x146153[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x1b48d3[_0x2974('0x3a')]['offset']);}return _0x36e7b1[_0x2974('0xd7')](_0x146153);}})['then'](function(_0x2824b6){if(_0x2824b6){return _0x2824b6?{'count':_0x193bf6,'rows':_0x2824b6}:null;}})['then'](respondWithResult(_0x48a7eb,null))[_0x2974('0x4a')](handleError(_0x48a7eb,null));};exports[_0x2974('0xd9')]=function(_0x3b0de9,_0xa107da){var _0x150c87={'raw':!![],'where':{}};var _0x1de012={};var _0x100362={'count':0x0,'rows':[]};return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x3b0de9[_0x2974('0x53')]['id']}})['then'](handleEntityNotFound(_0xa107da,null))['then'](function(_0x2750c9){if(_0x2750c9){_0x1de012[_0x2974('0xc9')]=_[_0x2974('0xca')](db[_0x2974('0xda')][_0x2974('0xcc')]);_0x1de012[_0x2974('0x3a')]=_['keys'](_0x3b0de9[_0x2974('0x3a')]);_0x1de012[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x1de012[_0x2974('0xc9')],_0x1de012[_0x2974('0x3a')]);_0x150c87[_0x2974('0x40')]=_['intersection'](_0x1de012[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x3b0de9[_0x2974('0x3a')][_0x2974('0xcf')]));_0x150c87[_0x2974('0x40')]=_0x150c87['attributes'][_0x2974('0x45')]?_0x150c87['attributes']:_0x1de012[_0x2974('0xc9')];if(!_0x3b0de9[_0x2974('0x3a')]['hasOwnProperty'](_0x2974('0xd4'))){_0x150c87['limit']=qs[_0x2974('0x19')](_0x3b0de9[_0x2974('0x3a')][_0x2974('0x19')]);_0x150c87[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x3b0de9['query'][_0x2974('0x17')]);}_0x150c87[_0x2974('0xd0')]=qs[_0x2974('0xd1')](_0x3b0de9[_0x2974('0x3a')][_0x2974('0xd1')]);_0x150c87[_0x2974('0x39')]=qs['filters'](_['pick'](_0x3b0de9['query'],_0x1de012[_0x2974('0xcd')]));_0x150c87['where']['UserId']=_0x2750c9['id'];if(_0x3b0de9[_0x2974('0x3a')]['filter']){_0x150c87[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x150c87['where'],{'$or':_[_0x2974('0x2f')](_0x150c87['attributes'],function(_0x4ef0de){var _0x121b59={};_0x121b59[_0x4ef0de]={'$like':'%'+_0x3b0de9['query'][_0x2974('0x26')]+'%'};return _0x121b59;})});}_0x150c87=_[_0x2974('0xd2')]({},_0x150c87,_0x3b0de9[_0x2974('0x4c')]);return db['VoiceRecording']['count']({'where':_0x150c87[_0x2974('0x39')]})[_0x2974('0x1d')](function(_0xac7f3a){_0x100362[_0x2974('0x1a')]=_0xac7f3a;if(_0x3b0de9['query'][_0x2974('0x3b')]){_0x150c87[_0x2974('0x3c')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2974('0xc8')](_0x150c87);})[_0x2974('0x1d')](function(_0x408392){_0x100362['rows']=_0x408392;return _0x100362;});}})[_0x2974('0x1d')](respondWithFilteredResult(_0xa107da,_0x150c87))['catch'](handleError(_0xa107da,null));};exports[_0x2974('0xdb')]=function(_0x4d2d7b,_0x53dfe7){var _0x10e92d={'raw':!![],'where':{}};var _0x378841={};var _0x31492b={'count':0x0,'rows':[]};return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x4d2d7b[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x53dfe7,null))[_0x2974('0x1d')](function(_0x5f10f8){if(_0x5f10f8){_0x378841[_0x2974('0xc9')]=_[_0x2974('0xca')](db[_0x2974('0xdc')][_0x2974('0xcc')]);_0x378841[_0x2974('0x3a')]=_['keys'](_0x4d2d7b['query']);_0x378841[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x378841[_0x2974('0xc9')],_0x378841[_0x2974('0x3a')]);_0x10e92d[_0x2974('0x40')]=_['intersection'](_0x378841['model'],qs['fields'](_0x4d2d7b['query']['fields']));_0x10e92d[_0x2974('0x40')]=_0x10e92d[_0x2974('0x40')][_0x2974('0x45')]?_0x10e92d[_0x2974('0x40')]:_0x378841[_0x2974('0xc9')];if(!_0x4d2d7b[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0xd4'))){_0x10e92d['limit']=qs[_0x2974('0x19')](_0x4d2d7b[_0x2974('0x3a')]['limit']);_0x10e92d[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x4d2d7b[_0x2974('0x3a')][_0x2974('0x17')]);}_0x10e92d[_0x2974('0xd0')]=qs['sort'](_0x4d2d7b[_0x2974('0x3a')][_0x2974('0xd1')]);_0x10e92d[_0x2974('0x39')]=qs['filters'](_[_0x2974('0xd6')](_0x4d2d7b[_0x2974('0x3a')],_0x378841['filters']));_0x10e92d[_0x2974('0x39')][_0x2974('0xdd')]=_0x5f10f8['id'];if(_0x4d2d7b[_0x2974('0x3a')]['filter']){_0x10e92d['where']=_[_0x2974('0xd2')](_0x10e92d[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x10e92d['attributes'],function(_0xaa1db4){var _0x37cc2c={};_0x37cc2c[_0xaa1db4]={'$like':'%'+_0x4d2d7b['query'][_0x2974('0x26')]+'%'};return _0x37cc2c;})});}_0x10e92d=_[_0x2974('0xd2')]({},_0x10e92d,_0x4d2d7b[_0x2974('0x4c')]);return db['ScreenRecording'][_0x2974('0x1a')]({'where':_0x10e92d[_0x2974('0x39')]})['then'](function(_0x1da0f7){_0x31492b['count']=_0x1da0f7;if(_0x4d2d7b[_0x2974('0x3a')]['includeAll']){_0x10e92d[_0x2974('0x3c')]=[{'all':!![]}];}return db[_0x2974('0xdc')][_0x2974('0xc8')](_0x10e92d);})['then'](function(_0x38a5f6){_0x31492b[_0x2974('0x43')]=_0x38a5f6;return _0x31492b;});}})[_0x2974('0x1d')](respondWithFilteredResult(_0x53dfe7,_0x10e92d))[_0x2974('0x4a')](handleError(_0x53dfe7,null));};exports[_0x2974('0xde')]=function(_0x5a25d6,_0x11aaa6){var _0x706279={};var _0x5af210={};var _0x45bb2a;var _0x2fcd1f;return db['User'][_0x2974('0x8c')]({'where':{'id':_0x5a25d6[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x11aaa6,null))[_0x2974('0x1d')](function(_0x67b6fa){if(_0x67b6fa){_0x45bb2a=_0x67b6fa;_0x5af210[_0x2974('0xc9')]=_['keys'](db[_0x2974('0xdf')][_0x2974('0xcc')]);_0x5af210['query']=_[_0x2974('0xca')](_0x5a25d6[_0x2974('0x3a')]);_0x5af210['filters']=_['intersection'](_0x5af210[_0x2974('0xc9')],_0x5af210[_0x2974('0x3a')]);_0x706279[_0x2974('0x40')]=_[_0x2974('0xce')](_0x5af210[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x5a25d6['query']['fields']));_0x706279[_0x2974('0x40')]=_0x706279['attributes'][_0x2974('0x45')]?_0x706279[_0x2974('0x40')]:_0x5af210[_0x2974('0xc9')];_0x706279['order']=qs[_0x2974('0xd1')](_0x5a25d6['query'][_0x2974('0xd1')]);_0x706279[_0x2974('0x39')]=qs['filters'](_['pick'](_0x5a25d6['query'],_0x5af210[_0x2974('0xcd')]));if(_0x5a25d6['query'][_0x2974('0x26')]){_0x706279[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x706279[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x706279[_0x2974('0x40')],function(_0x5b0bab){var _0x4830ed={};_0x4830ed[_0x5b0bab]={'$like':'%'+_0x5a25d6[_0x2974('0x3a')]['filter']+'%'};return _0x4830ed;})});}_0x706279=_[_0x2974('0xd2')]({},_0x706279,_0x5a25d6[_0x2974('0x4c')]);return _0x45bb2a[_0x2974('0xde')](_0x706279);}})['then'](function(_0x23cd0e){if(_0x23cd0e){_0x2fcd1f=_0x23cd0e[_0x2974('0x45')];if(!_0x5a25d6[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0xd4'))){_0x706279[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x5a25d6[_0x2974('0x3a')]['limit']);_0x706279[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x5a25d6[_0x2974('0x3a')][_0x2974('0x17')]);}return _0x45bb2a['getChatInteractions'](_0x706279);}})[_0x2974('0x1d')](function(_0x1374aa){if(_0x1374aa){return _0x1374aa?{'count':_0x2fcd1f,'rows':_0x1374aa}:null;}})[_0x2974('0x1d')](respondWithResult(_0x11aaa6,null))[_0x2974('0x4a')](handleError(_0x11aaa6,null));};exports[_0x2974('0xe0')]=function(_0x2afa4e,_0x4ed877){var _0x526ca6={};var _0xbc7c37={};var _0x4e2cd8;var _0x4dca79;return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x2afa4e[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x4ed877,null))[_0x2974('0x1d')](function(_0x46f0a8){if(_0x46f0a8){_0x4e2cd8=_0x46f0a8;_0xbc7c37[_0x2974('0xc9')]=_['keys'](db['OpenchannelInteraction'][_0x2974('0xcc')]);_0xbc7c37[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x2afa4e[_0x2974('0x3a')]);_0xbc7c37[_0x2974('0xcd')]=_[_0x2974('0xce')](_0xbc7c37['model'],_0xbc7c37[_0x2974('0x3a')]);_0x526ca6[_0x2974('0x40')]=_['intersection'](_0xbc7c37[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x2afa4e[_0x2974('0x3a')][_0x2974('0xcf')]));_0x526ca6[_0x2974('0x40')]=_0x526ca6['attributes']['length']?_0x526ca6[_0x2974('0x40')]:_0xbc7c37[_0x2974('0xc9')];_0x526ca6[_0x2974('0xd0')]=qs[_0x2974('0xd1')](_0x2afa4e[_0x2974('0x3a')][_0x2974('0xd1')]);_0x526ca6['where']=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x2afa4e['query'],_0xbc7c37[_0x2974('0xcd')]));if(_0x2afa4e[_0x2974('0x3a')][_0x2974('0x26')]){_0x526ca6[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x526ca6[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x526ca6[_0x2974('0x40')],function(_0x56e127){var _0xd56a52={};_0xd56a52[_0x56e127]={'$like':'%'+_0x2afa4e['query'][_0x2974('0x26')]+'%'};return _0xd56a52;})});}_0x526ca6=_[_0x2974('0xd2')]({},_0x526ca6,_0x2afa4e[_0x2974('0x4c')]);return _0x4e2cd8[_0x2974('0xe0')](_0x526ca6);}})[_0x2974('0x1d')](function(_0x250477){if(_0x250477){_0x4dca79=_0x250477[_0x2974('0x45')];if(!_0x2afa4e['query']['hasOwnProperty'](_0x2974('0xd4'))){_0x526ca6[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x2afa4e[_0x2974('0x3a')][_0x2974('0x19')]);_0x526ca6[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x2afa4e[_0x2974('0x3a')][_0x2974('0x17')]);}return _0x4e2cd8['getOpenchannelInteractions'](_0x526ca6);}})[_0x2974('0x1d')](function(_0x5db423){if(_0x5db423){return _0x5db423?{'count':_0x4dca79,'rows':_0x5db423}:null;}})[_0x2974('0x1d')](respondWithResult(_0x4ed877,null))[_0x2974('0x4a')](handleError(_0x4ed877,null));};exports[_0x2974('0xe1')]=function(_0x57bd0f,_0x57fa37){var _0x14c3c5={'raw':!![],'where':{}};var _0x339dff={};var _0x51d408={'count':0x0,'rows':[]};return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x57bd0f['params']['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x57fa37,null))['then'](function(_0x34382c){if(_0x34382c){_0x339dff[_0x2974('0xc9')]=_[_0x2974('0xca')](db[_0x2974('0xe2')][_0x2974('0xcc')]);_0x339dff[_0x2974('0x3a')]=_['keys'](_0x57bd0f[_0x2974('0x3a')]);_0x339dff[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x339dff['model'],_0x339dff[_0x2974('0x3a')]);_0x14c3c5[_0x2974('0x40')]=_[_0x2974('0xce')](_0x339dff[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x57bd0f[_0x2974('0x3a')][_0x2974('0xcf')]));_0x14c3c5[_0x2974('0x40')]=_0x14c3c5[_0x2974('0x40')]['length']?_0x14c3c5[_0x2974('0x40')]:_0x339dff[_0x2974('0xc9')];if(!_0x57bd0f[_0x2974('0x3a')]['hasOwnProperty'](_0x2974('0xd4'))){_0x14c3c5[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x57bd0f['query']['limit']);_0x14c3c5[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x57bd0f[_0x2974('0x3a')][_0x2974('0x17')]);}_0x14c3c5[_0x2974('0xd0')]=qs['sort'](_0x57bd0f[_0x2974('0x3a')][_0x2974('0xd1')]);_0x14c3c5[_0x2974('0x39')]=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x57bd0f[_0x2974('0x3a')],_0x339dff[_0x2974('0xcd')]));_0x14c3c5[_0x2974('0x39')]['UserId']=_0x34382c['id'];if(_0x57bd0f[_0x2974('0x3a')][_0x2974('0x26')]){_0x14c3c5['where']=_['merge'](_0x14c3c5['where'],{'$or':_[_0x2974('0x2f')](_0x14c3c5['attributes'],function(_0x225947){var _0x257f6c={};_0x257f6c[_0x225947]={'$like':'%'+_0x57bd0f[_0x2974('0x3a')][_0x2974('0x26')]+'%'};return _0x257f6c;})});}_0x14c3c5=_[_0x2974('0xd2')]({},_0x14c3c5,_0x57bd0f[_0x2974('0x4c')]);return db[_0x2974('0xe2')]['count']({'where':_0x14c3c5[_0x2974('0x39')]})['then'](function(_0x20093b){_0x51d408[_0x2974('0x1a')]=_0x20093b;if(_0x57bd0f['query'][_0x2974('0x3b')]){_0x14c3c5[_0x2974('0x3c')]=[{'all':!![]}];}return db[_0x2974('0xe2')][_0x2974('0xc8')](_0x14c3c5);})['then'](function(_0x35e1c2){_0x51d408['rows']=_0x35e1c2;return _0x51d408;});}})[_0x2974('0x1d')](respondWithFilteredResult(_0x57fa37,_0x14c3c5))[_0x2974('0x4a')](handleError(_0x57fa37,null));};exports[_0x2974('0xe3')]=function(_0x38de9d,_0x3e6ed4){var _0xb9fed4={};var _0x301007={};var _0xe051e1;var _0x428cfe;return db[_0x2974('0x42')]['findOne']({'where':{'id':_0x38de9d[_0x2974('0x53')]['id']}})['then'](handleEntityNotFound(_0x3e6ed4,null))[_0x2974('0x1d')](function(_0x480015){if(_0x480015){_0xe051e1=_0x480015;_0x301007[_0x2974('0xc9')]=_[_0x2974('0xca')](db[_0x2974('0xe4')][_0x2974('0xcc')]);_0x301007[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x38de9d[_0x2974('0x3a')]);_0x301007[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x301007[_0x2974('0xc9')],_0x301007['query']);_0xb9fed4[_0x2974('0x40')]=_[_0x2974('0xce')](_0x301007[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x38de9d['query'][_0x2974('0xcf')]));_0xb9fed4[_0x2974('0x40')]=_0xb9fed4['attributes'][_0x2974('0x45')]?_0xb9fed4[_0x2974('0x40')]:_0x301007[_0x2974('0xc9')];_0xb9fed4[_0x2974('0xd0')]=qs['sort'](_0x38de9d[_0x2974('0x3a')][_0x2974('0xd1')]);_0xb9fed4[_0x2974('0x39')]=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x38de9d['query'],_0x301007['filters']));if(_0x38de9d[_0x2974('0x3a')]['filter']){_0xb9fed4[_0x2974('0x39')]=_[_0x2974('0xd2')](_0xb9fed4[_0x2974('0x39')],{'$or':_['map'](_0xb9fed4[_0x2974('0x40')],function(_0x3ee231){var _0x303480={};_0x303480[_0x3ee231]={'$like':'%'+_0x38de9d[_0x2974('0x3a')][_0x2974('0x26')]+'%'};return _0x303480;})});}_0xb9fed4=_[_0x2974('0xd2')]({},_0xb9fed4,_0x38de9d[_0x2974('0x4c')]);return _0xe051e1[_0x2974('0xe3')](_0xb9fed4);}})['then'](function(_0x1ebf38){if(_0x1ebf38){_0x428cfe=_0x1ebf38[_0x2974('0x45')];if(!_0x38de9d[_0x2974('0x3a')]['hasOwnProperty'](_0x2974('0xd4'))){_0xb9fed4[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x38de9d['query']['limit']);_0xb9fed4[_0x2974('0x17')]=qs['offset'](_0x38de9d[_0x2974('0x3a')][_0x2974('0x17')]);}return _0xe051e1['getSmsInteractions'](_0xb9fed4);}})[_0x2974('0x1d')](function(_0x3f7ccf){if(_0x3f7ccf){return _0x3f7ccf?{'count':_0x428cfe,'rows':_0x3f7ccf}:null;}})['then'](respondWithResult(_0x3e6ed4,null))[_0x2974('0x4a')](handleError(_0x3e6ed4,null));};exports[_0x2974('0xe5')]=function(_0x7e7568,_0x247169){var _0x2bf01f={};var _0x45185d={};var _0x12d3cb;var _0x4294f6;return db['User']['findOne']({'where':{'id':_0x7e7568[_0x2974('0x53')]['id']}})['then'](handleEntityNotFound(_0x247169,null))[_0x2974('0x1d')](function(_0x168d06){if(_0x168d06){_0x12d3cb=_0x168d06;_0x45185d[_0x2974('0xc9')]=_[_0x2974('0xca')](db['FaxInteraction'][_0x2974('0xcc')]);_0x45185d[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x7e7568['query']);_0x45185d[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x45185d['model'],_0x45185d['query']);_0x2bf01f[_0x2974('0x40')]=_[_0x2974('0xce')](_0x45185d['model'],qs[_0x2974('0xcf')](_0x7e7568[_0x2974('0x3a')]['fields']));_0x2bf01f[_0x2974('0x40')]=_0x2bf01f[_0x2974('0x40')][_0x2974('0x45')]?_0x2bf01f[_0x2974('0x40')]:_0x45185d[_0x2974('0xc9')];_0x2bf01f['order']=qs[_0x2974('0xd1')](_0x7e7568[_0x2974('0x3a')]['sort']);_0x2bf01f[_0x2974('0x39')]=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x7e7568[_0x2974('0x3a')],_0x45185d[_0x2974('0xcd')]));if(_0x7e7568[_0x2974('0x3a')][_0x2974('0x26')]){_0x2bf01f['where']=_[_0x2974('0xd2')](_0x2bf01f['where'],{'$or':_[_0x2974('0x2f')](_0x2bf01f['attributes'],function(_0x2589ef){var _0x34ec97={};_0x34ec97[_0x2589ef]={'$like':'%'+_0x7e7568['query'][_0x2974('0x26')]+'%'};return _0x34ec97;})});}_0x2bf01f=_[_0x2974('0xd2')]({},_0x2bf01f,_0x7e7568['options']);return _0x12d3cb['getFaxInteractions'](_0x2bf01f);}})['then'](function(_0x52de0b){if(_0x52de0b){_0x4294f6=_0x52de0b[_0x2974('0x45')];if(!_0x7e7568[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0xd4'))){_0x2bf01f[_0x2974('0x19')]=qs['limit'](_0x7e7568['query'][_0x2974('0x19')]);_0x2bf01f[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x7e7568[_0x2974('0x3a')][_0x2974('0x17')]);}return _0x12d3cb[_0x2974('0xe5')](_0x2bf01f);}})['then'](function(_0x4158e0){if(_0x4158e0){return _0x4158e0?{'count':_0x4294f6,'rows':_0x4158e0}:null;}})['then'](respondWithResult(_0x247169,null))[_0x2974('0x4a')](handleError(_0x247169,null));};exports['getWhatsappInteractions']=function(_0x33346a,_0x571d10){var _0x4dc105={};var _0x5ae4b0={};var _0x1d2b3b;var _0x4ba2a6;return db[_0x2974('0x42')]['findOne']({'where':{'id':_0x33346a[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x571d10,null))[_0x2974('0x1d')](function(_0x164324){if(_0x164324){_0x1d2b3b=_0x164324;_0x5ae4b0['model']=_[_0x2974('0xca')](db[_0x2974('0xe6')][_0x2974('0xcc')]);_0x5ae4b0[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x33346a[_0x2974('0x3a')]);_0x5ae4b0[_0x2974('0xcd')]=_['intersection'](_0x5ae4b0[_0x2974('0xc9')],_0x5ae4b0[_0x2974('0x3a')]);_0x4dc105['attributes']=_[_0x2974('0xce')](_0x5ae4b0[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x33346a[_0x2974('0x3a')][_0x2974('0xcf')]));_0x4dc105[_0x2974('0x40')]=_0x4dc105[_0x2974('0x40')][_0x2974('0x45')]?_0x4dc105[_0x2974('0x40')]:_0x5ae4b0['model'];_0x4dc105[_0x2974('0xd0')]=qs[_0x2974('0xd1')](_0x33346a[_0x2974('0x3a')]['sort']);_0x4dc105[_0x2974('0x39')]=qs[_0x2974('0xcd')](_['pick'](_0x33346a[_0x2974('0x3a')],_0x5ae4b0['filters']));if(_0x33346a[_0x2974('0x3a')][_0x2974('0x26')]){_0x4dc105[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x4dc105[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x4dc105[_0x2974('0x40')],function(_0xfcd43f){var _0x402b66={};_0x402b66[_0xfcd43f]={'$like':'%'+_0x33346a[_0x2974('0x3a')][_0x2974('0x26')]+'%'};return _0x402b66;})});}_0x4dc105=_[_0x2974('0xd2')]({},_0x4dc105,_0x33346a['options']);return _0x1d2b3b[_0x2974('0xe7')](_0x4dc105);}})[_0x2974('0x1d')](function(_0x273bc2){if(_0x273bc2){_0x4ba2a6=_0x273bc2['length'];if(!_0x33346a[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0xd4'))){_0x4dc105[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x33346a[_0x2974('0x3a')][_0x2974('0x19')]);_0x4dc105[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x33346a['query']['offset']);}return _0x1d2b3b[_0x2974('0xe7')](_0x4dc105);}})[_0x2974('0x1d')](function(_0x238257){if(_0x238257){return _0x238257?{'count':_0x4ba2a6,'rows':_0x238257}:null;}})['then'](respondWithResult(_0x571d10,null))[_0x2974('0x4a')](handleError(_0x571d10,null));};exports['login']=function(_0x35c242,_0x15e2c7,_0x2de64c){var _0x19b0a0;var _0x4f1fc6;var _0x23d8d1;var _0x1052e8=!_['isNil'](_0x35c242[_0x2974('0x53')]['id'])?_0x35c242[_0x2974('0x53')]['id']:!_['isNil'](_0x35c242[_0x2974('0x73')]['id'])?_0x35c242[_0x2974('0x73')]['id']:null;return db['User'][_0x2974('0x4d')]({'where':{'id':_0x1052e8,'role':{'$or':[_0x2974('0x75'),_0x2974('0x73'),_0x2974('0x1f')]}},'attributes':['id',_0x2974('0x2a'),_0x2974('0xe8'),_0x2974('0xe9'),_0x2974('0x1e'),_0x2974('0x5a'),_0x2974('0x94')]})[_0x2974('0x1d')](function(_0xd2ce8f){if(_0xd2ce8f){if(_0xd2ce8f[_0x2974('0x1e')]===_0x2974('0x1f')){_0x19b0a0=_0xd2ce8f;if(_0x35c242[_0x2974('0x51')][_0x2974('0x96')]){_0x23d8d1=util[_0x2974('0xa4')](_0x2974('0xea'),_0x19b0a0[_0x35c242[_0x2974('0x51')][_0x2974('0x96')]]);}else if(_0x35c242[_0x2974('0x51')][_0x2974('0xeb')]){_0x23d8d1=util['format']('SIP/%s',_0x35c242[_0x2974('0x51')][_0x2974('0xeb')]);}else{_0x23d8d1=util[_0x2974('0xa4')](_0x2974('0xa5'),_0x19b0a0['name']);}socket['to'](util['format'](_0x2974('0xec'),_0x19b0a0[_0x2974('0x2a')]))[_0x2974('0x20')]('user:forcelogout',{'user':{'id':_0x19b0a0['id'],'name':_0x19b0a0['name']},'ip':_0x35c242[_0x2974('0xed')][_0x2974('0xee')]||_0x35c242[_0x2974('0xef')][_0x2974('0xf0')]||_0x35c242[_0x2974('0xf1')][_0x2974('0xf0')]||_0x35c242[_0x2974('0xef')][_0x2974('0xf1')]['remoteAddress']});return db[_0x2974('0xa9')][_0x2974('0x22')]({'where':{'membername':_0x19b0a0[_0x2974('0x2a')]},'individualHooks':!![]});}}else{throw new db[(_0x2974('0x89'))][(_0x2974('0x84'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2974('0x1d')](function(){if(_0x19b0a0){return _0x19b0a0[_0x2974('0xf2')]({'raw':!![]});}})['then'](function(_0x30803a){if(_0x19b0a0){if(_0x30803a){_0x4f1fc6=_0x30803a;if(_0x4f1fc6[_0x2974('0x45')]){var _0x188e37=_0x4f1fc6['map'](function(_0x472f43){var _0x46b1ea={'membername':_0x19b0a0[_0x2974('0x2a')],'UserId':_0x19b0a0['id'],'queue_name':_0x472f43[_0x2974('0x2a')],'VoiceQueueId':_0x472f43['id'],'interface':_0x23d8d1,'paused':_0x19b0a0[_0x2974('0x94')]||![],'penalty':_0x472f43['UserVoiceQueue.penalty']||0x0};return db[_0x2974('0xa9')][_0x2974('0xf3')](_0x46b1ea);});return Promise[_0x2974('0x49')](_0x188e37);}}}})[_0x2974('0x1d')](function(){if(_0x19b0a0){return db[_0x2974('0xf4')]['findAll']({'where':{'membername':_0x19b0a0[_0x2974('0x2a')],'exitAt':null}});}})[_0x2974('0x1d')](function(_0x54b857){if(_0x19b0a0){var _0x2994e7=[];_0x54b857[_0x2974('0xf5')](function(_0x2f5b51){_0x2994e7[_0x2974('0x41')](_0x2f5b51[_0x2974('0x1c')]({'exitAt':moment()[_0x2974('0xa4')](_0x2974('0xf6'))}));});return Promise[_0x2974('0x49')](_0x2994e7);}})[_0x2974('0x1d')](function(){if(_0x19b0a0){var _0x349de9=[];var _0x2958aa=[];var _0x3856e6=utils[_0x2974('0xf7')]();var _0x31b83b={'membername':_0x19b0a0['name'],'interface':_0x23d8d1,'enterAt':moment()[_0x2974('0xa4')](_0x2974('0xf6')),'role':_0x19b0a0['role'],'internal':_0x19b0a0[_0x2974('0x5a')]};_0x3856e6[_0x2974('0xf5')](function(_0x5aacf2){_0x349de9[_0x2974('0x41')](_[_0x2974('0xd2')]({'channel':_0x5aacf2,'type':_0x2974('0xf8'),'data1':_0x35c242['body'][_0x2974('0xf9')],'data2':_0x23d8d1},_0x31b83b));if(_0x19b0a0[_0x2974('0x94')]){_0x2958aa['push'](_['merge']({'channel':_0x5aacf2,'type':_0x2974('0xfa'),'data1':_0x2974('0xfb')},_0x31b83b));}});return db[_0x2974('0xf4')][_0x2974('0x7d')](_0x349de9[_0x2974('0xbd')](_0x2958aa),{'individualHooks':!![]});}})[_0x2974('0x1d')](function(){if(_0x19b0a0){return _0x19b0a0[_0x2974('0x1c')]({'online':!![],'lastLoginAt':moment()[_0x2974('0xa4')](_0x2974('0xf6')),'voicePause':_0x19b0a0[_0x2974('0x94')]||![],'mailPause':_0x19b0a0[_0x2974('0x94')]||![],'chatPause':_0x19b0a0[_0x2974('0x94')]||![],'faxPause':_0x19b0a0[_0x2974('0x94')]||![],'smsPause':_0x19b0a0[_0x2974('0x94')]||![],'openchannelPause':_0x19b0a0['loginInPause']||![],'whatsappPause':_0x19b0a0['loginInPause']||![],'pauseType':_0x19b0a0['loginInPause']?'LOGININPAUSE':null,'interface':_0x23d8d1,'lastPauseAt':moment()[_0x2974('0xa4')](_0x2974('0xf6'))});}})['then'](function(_0x4447ba){if(_0x35c242[_0x2974('0xfc')]){return _0x2de64c();}else{return Promise['resolve'](_0x4447ba)['then'](respondWithResult(_0x15e2c7,null));}})['catch'](handleError(_0x15e2c7,null));};exports['logout']=function(_0x545c64,_0x585852){var _0x421d7f;return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x545c64[_0x2974('0x53')]['id'],'role':_0x2974('0x1f')},'attributes':['id',_0x2974('0x2a'),_0x2974('0x1e')]})['then'](handleEntityNotFound(_0x585852,null))[_0x2974('0x1d')](function(_0xc0db4d){if(_0xc0db4d){_0x421d7f=_0xc0db4d;return db[_0x2974('0xa9')][_0x2974('0x22')]({'where':{'membername':_0x421d7f['name']},'individualHooks':!![]});}})[_0x2974('0x1d')](function(){return db[_0x2974('0xf4')]['findAll']({'where':{'membername':_0x421d7f[_0x2974('0x2a')],'exitAt':null}});})[_0x2974('0x1d')](function(_0x57a8f1){var _0x1400ea=[];_0x57a8f1[_0x2974('0xf5')](function(_0x3564ac){_0x1400ea[_0x2974('0x41')](_0x3564ac['update']({'exitAt':moment()[_0x2974('0xa4')](_0x2974('0xf6'))}));});return Promise[_0x2974('0x49')](_0x1400ea);})[_0x2974('0x1d')](function(){return _0x421d7f[_0x2974('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2974('0x1d')](respondWithResult(_0x585852,null))[_0x2974('0x4a')](handleError(_0x585852,null));};exports[_0x2974('0xfd')]=function(_0x36d0c2,_0x4cddc6){var _0x1bf89e;return db[_0x2974('0xa9')][_0x2974('0x1c')]({'paused':0x1},{'where':{'UserId':_0x36d0c2[_0x2974('0x53')]['id']},'individualHooks':!![]})[_0x2974('0x1d')](function(){return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x36d0c2[_0x2974('0x53')]['id'],'role':_0x2974('0x1f')},'attributes':['id','name',_0x2974('0x1e'),_0x2974('0x5a'),'interface',_0x2974('0x93')]});})[_0x2974('0x1d')](handleEntityNotFound(_0x4cddc6,null))[_0x2974('0x1d')](function(_0x43004e){if(_0x43004e){_0x1bf89e=_0x43004e;return db[_0x2974('0xf4')]['findAll']({'where':{'membername':_0x1bf89e[_0x2974('0x2a')],'type':_0x2974('0xfa'),'exitAt':null}});}})[_0x2974('0x1d')](function(_0x27fda4){if(_0x27fda4[_0x2974('0x45')]){var _0x1f5d92=moment()['format'](_0x2974('0xf6'));for(var _0x183f79=0x0,_0x386380=_0x27fda4[_0x2974('0x45')];_0x183f79<_0x386380;_0x183f79++){_0x27fda4[_0x183f79][_0x2974('0xfe')]({'exitAt':_0x1f5d92});}}})['then'](function(){var _0x4048d5=[];var _0x3fab57=utils['getChannels']();_0x3fab57['forEach'](function(_0x57f423){_0x4048d5[_0x2974('0x41')]({'channel':_0x57f423,'membername':_0x1bf89e[_0x2974('0x2a')],'interface':_[_0x2974('0x5b')](_0x1bf89e['interface'])?util[_0x2974('0xa4')](_0x2974('0xa5'),_0x1bf89e[_0x2974('0x2a')]):_0x1bf89e[_0x2974('0x96')],'type':'PAUSE','enterAt':moment()['format'](_0x2974('0xf6')),'data1':_0x36d0c2[_0x2974('0x51')][_0x2974('0x31')]||_0x2974('0xff'),'role':_0x1bf89e['role'],'internal':_0x1bf89e['internal']});});return db[_0x2974('0xf4')][_0x2974('0x7d')](_0x4048d5,{'individualHooks':!![]});})[_0x2974('0x1d')](function(){return _0x1bf89e[_0x2974('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x36d0c2[_0x2974('0x51')][_0x2974('0x31')]||_0x2974('0xff'),'lastPauseAt':moment()[_0x2974('0xa4')](_0x2974('0xf6'))});})['then'](respondWithResult(_0x4cddc6,null))[_0x2974('0x4a')](handleError(_0x4cddc6,null));};exports[_0x2974('0x100')]=function(_0x4708ef,_0x185088){if(_0x4708ef[_0x2974('0x51')][_0x2974('0x92')]&&!utils['isValidChannel'](_0x4708ef[_0x2974('0x51')]['channel'])){throw new APIBadRequestError(util[_0x2974('0xa4')](_0x2974('0x101'),_0x4708ef[_0x2974('0x51')]['channel']));}return db[_0x2974('0x42')][_0x2974('0x4d')]({'where':{'id':_0x4708ef[_0x2974('0x53')]['id']},'attributes':['id',_0x2974('0x2a'),_0x2974('0x1e'),_0x2974('0x5a'),_0x2974('0x96'),_0x2974('0x93'),_0x2974('0x95'),_0x2974('0x102'),_0x2974('0x103'),'faxPause',_0x2974('0x104'),_0x2974('0x105'),_0x2974('0x106'),'pauseType','lastPauseAt']})[_0x2974('0x1d')](function(_0x1f5bb0){if(!_0x1f5bb0){throw new APINotFoundError(util[_0x2974('0xa4')](_0x2974('0xbf'),_0x4708ef[_0x2974('0x53')]['id']));}return _0x1f5bb0['unpause'](_0x4708ef[_0x2974('0x51')][_0x2974('0x92')]);})[_0x2974('0x1d')](respondWithResult(_0x185088,null))[_0x2974('0x4a')](APIHandleError(_0x185088));};exports[_0x2974('0x107')]=function(_0x2d2456,_0x1797c0){var _0x15a607={};var _0x337474={};var _0x16e7d8;var _0x5a2596;return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x2d2456[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x1797c0,null))[_0x2974('0x1d')](function(_0x81469b){if(_0x81469b){_0x16e7d8=_0x81469b;_0x337474[_0x2974('0xc9')]=_['keys'](db[_0x2974('0x108')]['rawAttributes']);_0x337474[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x2d2456['query']);_0x337474['filters']=_['intersection'](_0x337474['model'],_0x337474[_0x2974('0x3a')]);_0x15a607[_0x2974('0x40')]=_[_0x2974('0xce')](_0x337474[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x2d2456[_0x2974('0x3a')]['fields']));_0x15a607[_0x2974('0x40')]=_0x15a607[_0x2974('0x40')][_0x2974('0x45')]?_0x15a607[_0x2974('0x40')]:_0x337474[_0x2974('0xc9')];_0x15a607[_0x2974('0xd0')]=qs['sort'](_0x2d2456['query']['sort']);_0x15a607['where']=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x2d2456['query'],_0x337474['filters']));if(_0x2d2456[_0x2974('0x3a')][_0x2974('0x26')]){_0x15a607['where']=_[_0x2974('0xd2')](_0x15a607[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x15a607['attributes'],function(_0x3e5dc2){var _0x46a70e={};_0x46a70e[_0x3e5dc2]={'$like':'%'+_0x2d2456['query'][_0x2974('0x26')]+'%'};return _0x46a70e;})});}_0x15a607=_['merge']({},_0x15a607,_0x2d2456[_0x2974('0x4c')]);return _0x16e7d8[_0x2974('0x107')](_0x15a607);}})[_0x2974('0x1d')](function(_0x4d3dfd){if(_0x4d3dfd){_0x5a2596=_0x4d3dfd[_0x2974('0x45')];if(!_0x2d2456[_0x2974('0x3a')][_0x2974('0xc1')](_0x2974('0xd4'))){_0x15a607[_0x2974('0x19')]=qs[_0x2974('0x19')](_0x2d2456[_0x2974('0x3a')][_0x2974('0x19')]);_0x15a607[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x2d2456[_0x2974('0x3a')][_0x2974('0x17')]);}return _0x16e7d8[_0x2974('0x107')](_0x15a607);}})[_0x2974('0x1d')](function(_0x4a5727){if(_0x4a5727){return _0x4a5727?{'count':_0x5a2596,'rows':_0x4a5727}:null;}})[_0x2974('0x1d')](respondWithResult(_0x1797c0,null))['catch'](handleError(_0x1797c0,null));};exports[_0x2974('0x109')]=function(_0x571c30,_0x2ac9f5){var _0x4f31da=_0x571c30[_0x2974('0x53')]['id'];var _0x10fc34=_0x571c30[_0x2974('0x51')]?_0x571c30[_0x2974('0x51')][_0x2974('0x55')]:null;var _0x42236c=[];return Promise[_0x2974('0x10a')]()[_0x2974('0x1d')](function(){if(!_0x10fc34)throw new APIBadRequestError(_0x2974('0x10b'));})[_0x2974('0x1d')](function(){return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x4f31da}});})['then'](function(_0x43df99){if(!_0x43df99)throw new APINotFoundError(util['format'](_0x2974('0xbf'),_0x571c30[_0x2974('0x53')]['id']));return db[_0x2974('0x5d')][_0x2974('0x10c')](function(_0x1ac4f6){return _0x43df99[_0x2974('0x109')](_0x10fc34,{'transaction':_0x1ac4f6})[_0x2974('0x1d')](function(){return db[_0x2974('0x108')]['findAll']({'where':{'id':{'$in':_0x10fc34}}});})[_0x2974('0x1d')](function(_0x1c4a63){var _0x541316=_['map'](_0x1c4a63,function(_0x1c6533){return _0x1c6533['getAssociatedQueues']();});return Promise[_0x2974('0x49')](_0x541316);})['then'](function(_0x141868){_0x42236c=_[_0x2974('0x10d')](_0x141868);var _0x2b80df=_[_0x2974('0x2f')](_0x42236c,function(_0x40c499){return _0x40c499['addAgent'](_0x43df99['id'],{'transaction':_0x1ac4f6});});return Promise[_0x2974('0x49')](_0x2b80df);})[_0x2974('0x1d')](function(){if(!_0x43df99[_0x2974('0x93')])return;var _0x3019e0=_[_0x2974('0x26')](_0x42236c,function(_0x4bc2ac){return _0x4bc2ac[_0x2974('0x10e')](_0x2974('0x92'))===_0x2974('0x10f');});var _0x3e38eb=_[_0x2974('0x2f')](_0x3019e0,function(_0xdbd9a7){return db[_0x2974('0xa9')][_0x2974('0xf3')]({'membername':_0x43df99[_0x2974('0x2a')],'UserId':_0x43df99['id'],'queue_name':_0xdbd9a7[_0x2974('0x2a')],'VoiceQueueId':_0xdbd9a7['id'],'interface':_[_0x2974('0x5b')](_0x43df99[_0x2974('0x96')])?util['format'](_0x2974('0xa5'),_0x43df99['name']):_0x43df99['interface'],'paused':_0x43df99['voicePause']||![],'penalty':_0x43df99[_0x2974('0x9c')]},{'transaction':_0x1ac4f6});});return Promise[_0x2974('0x49')](_0x3e38eb);})['then'](function(){return db[_0x2974('0x110')][_0x2974('0xc8')]({'where':{'teamId':{'$in':_0x10fc34}}});})['then'](function(_0x30b3e0){var _0x575d33=_[_0x2974('0x2f')](_0x30b3e0,function(_0x532b81){return db[_0x2974('0x111')][_0x2974('0x72')]({'UserId':_0x43df99['id'],'VoicePrefixId':_0x532b81[_0x2974('0x112')]},{'transaction':_0x1ac4f6});});return Promise['all'](_0x575d33);});});})[_0x2974('0x1d')](function(){for(var _0x2eeec8=0x0;_0x2eeec8<_0x42236c[_0x2974('0x45')];_0x2eeec8++){var _0x326817=_0x42236c[_0x2eeec8]['getDataValue']('channel');var _0x25c6e3=_0x326817+'QueueId';socket[_0x2974('0x20')](_0x2974('0x73')+_0x326817+_0x2974('0xa0'),{'UserId':_0x4f31da,['queueField']:_0x42236c[_0x2eeec8]['id']});}})[_0x2974('0x1d')](respondWithStatusCode(_0x2ac9f5,null))[_0x2974('0x4a')](APIHandleError(_0x2ac9f5));};exports[_0x2974('0x113')]=function(_0x445a5c,_0x219db4){var _0x51fb66=_0x445a5c[_0x2974('0x53')]['id'];var _0x24b237=null;if(_0x445a5c[_0x2974('0x3a')][_0x2974('0x55')]){_0x24b237=_[_0x2974('0x114')](_0x445a5c[_0x2974('0x3a')][_0x2974('0x55')])?_0x445a5c['query'][_0x2974('0x55')]:[_0x445a5c[_0x2974('0x3a')][_0x2974('0x55')]];}var _0x111c8a=[];return Promise[_0x2974('0x10a')]()[_0x2974('0x1d')](function(){if(!_0x24b237)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2974('0x1d')](function(){return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x51fb66}});})[_0x2974('0x1d')](function(_0x4b10b0){if(!_0x4b10b0)throw new APINotFoundError(util[_0x2974('0xa4')](_0x2974('0xbf'),_0x445a5c[_0x2974('0x53')]['id']));return db['sequelize'][_0x2974('0x10c')](function(_0x14237d){return _0x4b10b0[_0x2974('0x113')](_0x24b237,{'transaction':_0x14237d})[_0x2974('0x1d')](function(){return db[_0x2974('0x108')][_0x2974('0xc8')]({'where':{'id':{'$in':_0x24b237}}});})[_0x2974('0x1d')](function(_0x282628){var _0x50e910=_[_0x2974('0x2f')](_0x282628,function(_0x326b7e){return _0x326b7e['getAssociatedQueues']();});return Promise[_0x2974('0x49')](_0x50e910);})[_0x2974('0x1d')](function(_0x1a3fb7){_0x111c8a=_[_0x2974('0x10d')](_0x1a3fb7);var _0x5d630b=_[_0x2974('0x2f')](_0x111c8a,function(_0x1caa73){return _0x1caa73[_0x2974('0x115')](_0x4b10b0['id'],{'transaction':_0x14237d});});return Promise['all'](_0x5d630b);})[_0x2974('0x1d')](function(){if(!_0x4b10b0['online'])return;var _0x31f1f1=_[_0x2974('0x26')](_0x111c8a,function(_0x481cab){return _0x481cab[_0x2974('0x10e')](_0x2974('0x92'))===_0x2974('0x10f');});var _0x1a5a3a=_[_0x2974('0x2f')](_0x31f1f1,function(_0x34dab6){return db[_0x2974('0xa9')][_0x2974('0x22')]({'where':{'VoiceQueueId':_0x34dab6['id'],'UserId':_0x4b10b0['id']},'transaction':_0x14237d});});return Promise['all'](_0x1a5a3a);})[_0x2974('0x1d')](function(){return db[_0x2974('0x110')]['findAll']({'where':{'teamId':{'$in':_0x24b237}}});})['then'](function(_0x34a734){var _0x11b807=_['map'](_0x34a734,function(_0x2ecf88){return db[_0x2974('0x111')][_0x2974('0x22')]({'where':{'UserId':_0x4b10b0['id'],'VoicePrefixId':_0x2ecf88['VoicePrefixId']}},{'transaction':_0x14237d});});return Promise['all'](_0x11b807);});});})[_0x2974('0x1d')](function(){for(var _0x58a07d=0x0;_0x58a07d<_0x111c8a['length'];_0x58a07d++){var _0x327bbd=_0x111c8a[_0x58a07d][_0x2974('0x10e')]('channel');var _0x238c79=_0x327bbd+_0x2974('0x9f');socket[_0x2974('0x20')](_0x2974('0x73')+_0x327bbd+_0x2974('0xa8'),{'UserId':_0x51fb66,['queueField']:_0x111c8a[_0x58a07d]['id']});}})['then'](respondWithStatusCode(_0x219db4,null))[_0x2974('0x4a')](APIHandleError(_0x219db4));};exports[_0x2974('0x116')]=function(_0x247e09,_0x2dacfb){var _0x5350e6={};var _0x47f425={};var _0x4a646c;var _0x967363;return db[_0x2974('0x42')][_0x2974('0x8c')]({'where':{'id':_0x247e09[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x2dacfb,null))[_0x2974('0x1d')](function(_0x418495){if(_0x418495){_0x4a646c=_0x418495;_0x47f425[_0x2974('0xc9')]=_[_0x2974('0xca')](db['CmList']['rawAttributes']);_0x47f425[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x247e09['query']);_0x47f425['filters']=_[_0x2974('0xce')](_0x47f425['model'],_0x47f425['query']);_0x5350e6[_0x2974('0x40')]=_[_0x2974('0xce')](_0x47f425[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x247e09[_0x2974('0x3a')]['fields']));_0x5350e6['attributes']=_0x5350e6['attributes']['length']?_0x5350e6[_0x2974('0x40')]:_0x47f425[_0x2974('0xc9')];_0x5350e6[_0x2974('0xd0')]=qs['sort'](_0x247e09['query']['sort']);_0x5350e6['where']=qs[_0x2974('0xcd')](_[_0x2974('0xd6')](_0x247e09[_0x2974('0x3a')],_0x47f425[_0x2974('0xcd')]));if(_0x247e09[_0x2974('0x3a')][_0x2974('0x26')]){_0x5350e6[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x5350e6[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x5350e6[_0x2974('0x40')],function(_0x23d712){var _0x3de148={};_0x3de148[_0x23d712]={'$like':'%'+_0x247e09['query'][_0x2974('0x26')]+'%'};return _0x3de148;})});}_0x5350e6=_['merge']({},_0x5350e6,_0x247e09[_0x2974('0x4c')]);return _0x4a646c[_0x2974('0x116')](_0x5350e6);}})[_0x2974('0x1d')](function(_0x34adfe){if(_0x34adfe){_0x967363=_0x34adfe[_0x2974('0x45')];if(!_0x247e09[_0x2974('0x3a')]['hasOwnProperty'](_0x2974('0xd4'))){_0x5350e6['limit']=qs[_0x2974('0x19')](_0x247e09[_0x2974('0x3a')][_0x2974('0x19')]);_0x5350e6[_0x2974('0x17')]=qs[_0x2974('0x17')](_0x247e09[_0x2974('0x3a')][_0x2974('0x17')]);}return _0x4a646c[_0x2974('0x116')](_0x5350e6);}})[_0x2974('0x1d')](function(_0x2f9787){if(_0x2f9787){return _0x2f9787?{'count':_0x967363,'rows':_0x2f9787}:null;}})[_0x2974('0x1d')](respondWithResult(_0x2dacfb,null))[_0x2974('0x4a')](handleError(_0x2dacfb,null));};exports[_0x2974('0x117')]=function(_0x400253,_0x1cc859){var _0x21cc73={};var _0x49dc5b={};var _0x239230;return db['User'][_0x2974('0x8c')]({'where':{'id':_0x400253[_0x2974('0x53')]['id']}})[_0x2974('0x1d')](handleEntityNotFound(_0x1cc859,null))[_0x2974('0x1d')](function(_0x3e7900){if(_0x3e7900){_0x239230=_0x3e7900;_0x49dc5b[_0x2974('0xc9')]=_[_0x2974('0xca')](db[_0x2974('0x42')][_0x2974('0xcc')]);_0x49dc5b[_0x2974('0x3a')]=_[_0x2974('0xca')](_0x400253[_0x2974('0x3a')]);_0x49dc5b[_0x2974('0xcd')]=_[_0x2974('0xce')](_0x49dc5b[_0x2974('0xc9')],_0x49dc5b['query']);_0x21cc73[_0x2974('0x40')]=_['intersection'](_0x49dc5b[_0x2974('0xc9')],qs[_0x2974('0xcf')](_0x400253['query']['fields']));_0x21cc73[_0x2974('0x40')]=_0x21cc73[_0x2974('0x40')][_0x2974('0x45')]?_0x21cc73['attributes']:_0x49dc5b[_0x2974('0xc9')];_0x21cc73[_0x2974('0xd0')]=qs[_0x2974('0xd1')](_0x400253['query']['sort']);_0x21cc73[_0x2974('0x39')]=qs['filters'](_['pick'](_0x400253[_0x2974('0x3a')],_0x49dc5b[_0x2974('0xcd')]));if(_0x400253[_0x2974('0x3a')]['filter']){_0x21cc73[_0x2974('0x39')]=_[_0x2974('0xd2')](_0x21cc73[_0x2974('0x39')],{'$or':_[_0x2974('0x2f')](_0x21cc73['attributes'],function(_0x31f6bc){var _0x56b548={};_0x56b548[_0x31f6bc]={'$like':'%'+_0x400253[_0x2974('0x3a')]['filter']+'%'};return _0x56b548;})});}_0x21cc73[_0x2974('0xc9')]=db[_0x2974('0x42')];_0x21cc73['as']='Agents';_0x21cc73=_[_0x2974('0xd2')]({},_0x21cc73,_0x400253[_0x2974('0x4c')]);return _0x239230[_0x2974('0xf2')]({'include':[_0x21cc73]});}})['then'](function(_0x2520f8){if(_0x2520f8){var _0x2f61df={},_0x2b77a4=[];for(var _0x5ea7ce=0x0;_0x5ea7ce<_0x2520f8[_0x2974('0x45')];_0x5ea7ce+=0x1){for(var _0x5653cd=0x0,_0x44b8a3;_0x5653cd<_0x2520f8[_0x5ea7ce][_0x2974('0x23')]['length'];_0x5653cd+=0x1){_0x44b8a3=_0x2520f8[_0x5ea7ce]['Agents'][_0x5653cd][_0x2974('0xa3')]({'plain':!![]});_0x2f61df[_0x44b8a3['id']]=_0x44b8a3;}}_0x2f61df=_[_0x2974('0x118')](_0x2f61df);for(var _0x486193=qs[_0x2974('0x17')](_0x400253[_0x2974('0x3a')][_0x2974('0x17')]);_0x486193<_0x2f61df[_0x2974('0x45')]&&_0x2b77a4[_0x2974('0x45')]=_0x122856[_0xd145('0x4c')]){throw new Error(_0xd145('0x4d'));}})[_0xd145('0x15')](function(){if(_0xcd6a2d){return db[_0xd145('0x4e')][_0xd145('0x4f')]({'where':{'membername':_0xcd6a2d[_0xd145('0x20')]},'individualHooks':!![]});}})[_0xd145('0x15')](function(){if(_0xcd6a2d){return _0xcd6a2d[_0xd145('0x50')]({'raw':!![]});}})[_0xd145('0x15')](function(_0x76ce0d){if(_0xcd6a2d){if(_0x76ce0d){var _0x14d4ca=[];_0x2cd40a=_0x76ce0d;if(_0x2cd40a[_0xd145('0x2a')]){for(var _0xa3b7fd=0x0;_0xa3b7fd<_0x2cd40a[_0xd145('0x2a')];_0xa3b7fd++){_0x14d4ca[_0xd145('0x46')](db[_0xd145('0x4e')]['upsert']({'membername':_0xcd6a2d[_0xd145('0x20')],'UserId':_0xcd6a2d['id'],'queue_name':_0x2cd40a[_0xa3b7fd]['name'],'VoiceQueueId':_0x2cd40a[_0xa3b7fd]['id'],'interface':_0x42ee0f,'paused':_0xcd6a2d[_0xd145('0x49')]||![],'penalty':_0x2cd40a[_0xa3b7fd]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd145('0x47')](_0x14d4ca);}}}})[_0xd145('0x15')](function(){if(_0xcd6a2d){return db[_0xd145('0x27')][_0xd145('0x28')]({'where':{'membername':_0xcd6a2d[_0xd145('0x20')],'exitAt':null}});}})[_0xd145('0x15')](function(_0x152b50){if(_0xcd6a2d){if(_0x152b50&&_0x152b50[_0xd145('0x2a')]){var _0x1a6fa5=[];_0x152b50[_0xd145('0x45')](function(_0x3ca717){_0x1a6fa5[_0xd145('0x46')](_0x3ca717[_0xd145('0x26')]({'exitAt':moment()[_0xd145('0x23')](_0xd145('0x2b'))}));});return BPromise['all'](_0x1a6fa5);}}})[_0xd145('0x15')](function(){if(_0xcd6a2d){var _0x4de72c=[];var _0x33eaaa=[];var _0x698faa=utils['getChannels']();var _0x560b0f={'membername':_0xcd6a2d[_0xd145('0x20')],'interface':_0x42ee0f,'enterAt':moment()['format'](_0xd145('0x2b')),'role':_0xcd6a2d['role'],'internal':_0xcd6a2d[_0xd145('0x22')]};_0x698faa[_0xd145('0x45')](function(_0x322795){_0x4de72c[_0xd145('0x46')](_['merge']({'channel':_0x322795,'type':_0xd145('0x51'),'data1':'callysquare','data2':_0x42ee0f},_0x560b0f));if(_0xcd6a2d['loginInPause']){_0x33eaaa[_0xd145('0x46')](_[_0xd145('0x52')]({'channel':_0x322795,'type':'PAUSE','data1':_0xd145('0x53')},_0x560b0f));}});return db[_0xd145('0x27')][_0xd145('0x54')](_0x4de72c[_0xd145('0x55')](_0x33eaaa),{'individualHooks':!![]});}})[_0xd145('0x15')](function(){if(_0xcd6a2d){return _0xcd6a2d[_0xd145('0x26')]({'online':!![],'lastLoginAt':moment()[_0xd145('0x23')](_0xd145('0x2b')),'voicePause':_0xcd6a2d[_0xd145('0x49')]||![],'mailPause':_0xcd6a2d[_0xd145('0x49')]||![],'chatPause':_0xcd6a2d[_0xd145('0x49')]||![],'faxPause':_0xcd6a2d[_0xd145('0x49')]||![],'smsPause':_0xcd6a2d[_0xd145('0x49')]||![],'openchannelPause':_0xcd6a2d[_0xd145('0x49')]||![],'pauseType':_0xcd6a2d['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xd145('0x23')](_0xd145('0x2b')),'interface':_0x42ee0f});}})[_0xd145('0x15')](function(_0x93be3b){_0x47bf5e(_0x93be3b);})[_0xd145('0x1a')](function(_0x567278){_0x23f430(_0x46f637['error'](0x1f4,_0x567278[_0xd145('0x1c')]));});});}; \ No newline at end of file +var _0x8e15=['model','map','then','info','debug','stringify','message','error','ShowUser','catch','PauseUser','name','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','role','internal','uniqueid','MemberReport','resolve','channel','isValidChannel','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','bulkCreate','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','User','findAll','options','raw','where','attributes','include'];(function(_0x327967,_0x55e802){var _0x161787=function(_0x5ccd9b){while(--_0x5ccd9b){_0x327967['push'](_0x327967['shift']());}};_0x161787(++_0x55e802);}(_0x8e15,0x9f));var _0x58e1=function(_0x3d075a,_0x507f04){_0x3d075a=_0x3d075a-0x0;var _0x418be1=_0x8e15[_0x3d075a];return _0x418be1;};'use strict';var _=require(_0x58e1('0x0'));var util=require(_0x58e1('0x1'));var moment=require(_0x58e1('0x2'));var BPromise=require(_0x58e1('0x3'));var Redis=require(_0x58e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x58e1('0x5'))(_0x58e1('0x6'));var config=require(_0x58e1('0x7'));config[_0x58e1('0x8')]=_[_0x58e1('0x9')](config[_0x58e1('0x8')],{'host':_0x58e1('0xa'),'port':0x18eb});var socket=require(_0x58e1('0xb'))(new Redis(config[_0x58e1('0x8')]));require('./user.socket')[_0x58e1('0xc')](socket);exports[_0x58e1('0xd')]=function(_0x3e8d40){var _0x271117=this;return new Promise(function(_0x3c6411,_0x4d00b9){return db[_0x58e1('0xe')][_0x58e1('0xf')]({'raw':_0x3e8d40[_0x58e1('0x10')]?_0x3e8d40[_0x58e1('0x10')][_0x58e1('0x11')]===undefined?!![]:![]:!![],'where':_0x3e8d40['options']?_0x3e8d40[_0x58e1('0x10')][_0x58e1('0x12')]||null:null,'attributes':_0x3e8d40['options']?_0x3e8d40[_0x58e1('0x10')][_0x58e1('0x13')]||null:null,'limit':_0x3e8d40[_0x58e1('0x10')]?_0x3e8d40[_0x58e1('0x10')]['limit']||null:null,'include':_0x3e8d40['options']?_0x3e8d40[_0x58e1('0x10')][_0x58e1('0x14')]?_['map'](_0x3e8d40[_0x58e1('0x10')][_0x58e1('0x14')],function(_0x58ed8e){return{'model':db[_0x58ed8e[_0x58e1('0x15')]],'as':_0x58ed8e['as'],'attributes':_0x58ed8e[_0x58e1('0x13')],'include':_0x58ed8e['include']?_[_0x58e1('0x16')](_0x58ed8e['include'],function(_0x28cabd){return{'model':db[_0x28cabd[_0x58e1('0x15')]],'as':_0x28cabd['as'],'attributes':_0x28cabd['attributes'],'include':_0x28cabd[_0x58e1('0x14')]?_[_0x58e1('0x16')](_0x28cabd[_0x58e1('0x14')],function(_0x209808){return{'model':db[_0x209808['model']],'as':_0x209808['as'],'attributes':_0x209808[_0x58e1('0x13')]};}):[]};}):[]};}):[]:[]})[_0x58e1('0x17')](function(_0x4f4c11){logger[_0x58e1('0x18')](_0x58e1('0xd'),_0x3e8d40);logger[_0x58e1('0x19')]('GetUser',_0x3e8d40,JSON[_0x58e1('0x1a')](_0x4f4c11));_0x3c6411(_0x4f4c11);})['catch'](function(_0x1d8f75){logger['error'](_0x58e1('0xd'),_0x1d8f75[_0x58e1('0x1b')],_0x3e8d40);_0x4d00b9(_0x271117[_0x58e1('0x1c')](0x1f4,_0x1d8f75[_0x58e1('0x1b')]));});});};exports[_0x58e1('0x1d')]=function(_0x48e4ec){var _0x3a21f2=this;return new Promise(function(_0x183f40,_0x404c36){return db[_0x58e1('0xe')]['find']({'raw':_0x48e4ec[_0x58e1('0x10')]?_0x48e4ec[_0x58e1('0x10')][_0x58e1('0x11')]===undefined?!![]:![]:!![],'where':_0x48e4ec[_0x58e1('0x10')]?_0x48e4ec[_0x58e1('0x10')][_0x58e1('0x12')]||null:null,'attributes':_0x48e4ec[_0x58e1('0x10')]?_0x48e4ec['options'][_0x58e1('0x13')]||null:null,'include':_0x48e4ec[_0x58e1('0x10')]?_0x48e4ec[_0x58e1('0x10')][_0x58e1('0x14')]?_['map'](_0x48e4ec['options'][_0x58e1('0x14')],function(_0x4b48a0){return{'model':db[_0x4b48a0[_0x58e1('0x15')]],'as':_0x4b48a0['as'],'attributes':_0x4b48a0['attributes'],'include':_0x4b48a0['include']?_[_0x58e1('0x16')](_0x4b48a0[_0x58e1('0x14')],function(_0x4d1e1f){return{'model':db[_0x4d1e1f[_0x58e1('0x15')]],'as':_0x4d1e1f['as'],'attributes':_0x4d1e1f[_0x58e1('0x13')],'include':_0x4d1e1f[_0x58e1('0x14')]?_[_0x58e1('0x16')](_0x4d1e1f[_0x58e1('0x14')],function(_0x2f9885){return{'model':db[_0x2f9885[_0x58e1('0x15')]],'as':_0x2f9885['as'],'attributes':_0x2f9885[_0x58e1('0x13')]};}):[]};}):[]};}):[]:[]})[_0x58e1('0x17')](function(_0x38d173){logger[_0x58e1('0x18')](_0x58e1('0x1d'),_0x48e4ec);logger[_0x58e1('0x19')](_0x58e1('0x1d'),_0x48e4ec,JSON[_0x58e1('0x1a')](_0x38d173));_0x183f40(_0x38d173);})[_0x58e1('0x1e')](function(_0x2071d6){logger[_0x58e1('0x1c')](_0x58e1('0x1d'),_0x2071d6[_0x58e1('0x1b')],_0x48e4ec);_0x404c36(_0x3a21f2[_0x58e1('0x1c')](0x1f4,_0x2071d6[_0x58e1('0x1b')]));});});};exports[_0x58e1('0x1f')]=function(_0xc01f2d){var _0x80aaf4;return db[_0x58e1('0xe')]['find']({'where':_0xc01f2d[_0x58e1('0x10')]['where']||{},'attributes':['id',_0x58e1('0x20'),'role','internal',_0x58e1('0x21')]})[_0x58e1('0x17')](function(_0x16f211){if(!_0x16f211){throw new Error(util[_0x58e1('0x22')](_0x58e1('0x23'),_0xc01f2d[_0x58e1('0x24')]['id']));}_0x80aaf4=_0x16f211;return db[_0x58e1('0x25')][_0x58e1('0x26')]({'paused':0x1},{'where':{'UserId':_0x80aaf4['id']},'individualHooks':!![]});})[_0x58e1('0x17')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x80aaf4[_0x58e1('0x20')],'type':_0x58e1('0x27'),'exitAt':null}});})[_0x58e1('0x17')](function(_0xa909e9){if(_0xa909e9&&_0xa909e9[_0x58e1('0x28')]){var _0x7c4a02=moment()[_0x58e1('0x22')](_0x58e1('0x29'));for(var _0x49acff=0x0,_0x3964ef=_0xa909e9['length'];_0x49acff<_0x3964ef;_0x49acff++){_0xa909e9[_0x49acff][_0x58e1('0x2a')]({'exitAt':_0x7c4a02});}}})[_0x58e1('0x17')](function(){var _0x1b192f=[];var _0x2456a9=utils[_0x58e1('0x2b')]();_0x2456a9[_0x58e1('0x2c')](function(_0x52a582){_0x1b192f[_0x58e1('0x2d')]({'channel':_0x52a582,'membername':_0x80aaf4[_0x58e1('0x20')],'interface':_[_0x58e1('0x2e')](_0x80aaf4[_0x58e1('0x21')])?util[_0x58e1('0x22')](_0x58e1('0x2f'),_0x80aaf4[_0x58e1('0x20')]):_0x80aaf4['interface'],'type':_0x58e1('0x27'),'enterAt':moment()[_0x58e1('0x22')](_0x58e1('0x29')),'data1':_0xc01f2d[_0x58e1('0x30')][_0x58e1('0x31')]||_0x58e1('0x32'),'role':_0x80aaf4[_0x58e1('0x33')],'internal':_0x80aaf4[_0x58e1('0x34')],'uniqueid':_0xc01f2d[_0x58e1('0x30')][_0x58e1('0x35')]||null});});return db[_0x58e1('0x36')]['bulkCreate'](_0x1b192f,{'individualHooks':!![]});})[_0x58e1('0x17')](function(){return _0x80aaf4[_0x58e1('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xc01f2d[_0x58e1('0x30')]['type']||_0x58e1('0x32'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x58e1('0x1e')](function(_0x10c140){throw _0x10c140;});};exports['UnpauseUser']=function(_0xe489c1){return Promise[_0x58e1('0x37')]()['then'](function(){if(_0xe489c1['body'][_0x58e1('0x38')]&&!utils[_0x58e1('0x39')](_0xe489c1[_0x58e1('0x30')][_0x58e1('0x38')])){throw new Error(util[_0x58e1('0x22')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0xe489c1[_0x58e1('0x30')]['channel']));}return db[_0x58e1('0xe')][_0x58e1('0x3a')]({'where':_0xe489c1[_0x58e1('0x10')][_0x58e1('0x12')]||{},'attributes':['id',_0x58e1('0x20'),_0x58e1('0x33'),_0x58e1('0x34'),_0x58e1('0x21'),_0x58e1('0x3b'),_0x58e1('0x3c'),_0x58e1('0x3d'),_0x58e1('0x3e'),_0x58e1('0x3f'),_0x58e1('0x40'),_0x58e1('0x41'),'whatsappPause',_0x58e1('0x42'),'lastPauseAt']});})[_0x58e1('0x17')](function(_0x52a110){if(!_0x52a110){throw new Error(util['format'](_0x58e1('0x23'),_0xe489c1[_0x58e1('0x24')]['id']));}return _0x52a110[_0x58e1('0x43')](_0xe489c1[_0x58e1('0x30')][_0x58e1('0x38')],_0x58e1('0x44'));})[_0x58e1('0x1e')](function(_0x1c55c3){throw _0x1c55c3;});};exports[_0x58e1('0x45')]=function(_0x4100e5){var _0x5029b1=this;return new Promise(function(_0x2c89f5,_0x425a6a){var _0x564300;return db[_0x58e1('0xe')][_0x58e1('0x3a')]({'where':_0x4100e5[_0x58e1('0x10')][_0x58e1('0x12')]||{},'attributes':['id',_0x58e1('0x20')]})[_0x58e1('0x17')](function(_0x4c2f14){if(_0x4c2f14){_0x564300=_0x4c2f14;return db[_0x58e1('0x25')][_0x58e1('0x46')]({'where':{'membername':_0x564300[_0x58e1('0x20')]},'individualHooks':!![]});}})['then'](function(){if(_0x564300){return db[_0x58e1('0x36')][_0x58e1('0xf')]({'where':{'membername':_0x564300['name'],'exitAt':null}});}})[_0x58e1('0x17')](function(_0x16b14b){if(_0x564300){if(_0x16b14b&&_0x16b14b['length']){var _0x10298d=[];_0x16b14b[_0x58e1('0x2c')](function(_0x38f12a){_0x10298d[_0x58e1('0x2d')](_0x38f12a[_0x58e1('0x26')]({'exitAt':moment()[_0x58e1('0x22')](_0x58e1('0x29'))}));});return BPromise[_0x58e1('0x47')](_0x10298d);}}})[_0x58e1('0x17')](function(){if(_0x564300){return _0x564300['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x58e1('0x17')](function(_0x26a084){_0x2c89f5(_0x26a084);})[_0x58e1('0x1e')](function(_0x1fd46c){_0x425a6a(_0x5029b1[_0x58e1('0x1c')](0x1f4,_0x1fd46c[_0x58e1('0x1b')]));});});};exports[_0x58e1('0x48')]=function(_0x16afbc){var _0x4e08d4=this;return new Promise(function(_0x20faf7,_0x2c8442){var _0x42227f;var _0x5cfe9f;var _0xc27d44;var _0x58f93c;return db[_0x58e1('0xe')][_0x58e1('0x3a')]({'where':_0x16afbc[_0x58e1('0x10')][_0x58e1('0x12')]||{},'attributes':['id',_0x58e1('0x20'),_0x58e1('0x33'),_0x58e1('0x49'),_0x58e1('0x4a'),_0x58e1('0x34'),_0x58e1('0x4b'),_0x58e1('0x21')]})[_0x58e1('0x17')](function(_0x3ad7e7){if(_0x3ad7e7){_0x42227f=_0x3ad7e7;_0x58f93c=_0x16afbc[_0x58e1('0x30')][_0x58e1('0x21')]?_0x16afbc[_0x58e1('0x30')][_0x58e1('0x21')]:util[_0x58e1('0x22')](_0x58e1('0x2f'),_0x42227f[_0x58e1('0x20')]);return db[_0x58e1('0xe')][_0x58e1('0x4c')]({'where':{'role':_0x58e1('0x4d'),'online':!![],'id':{'$ne':_0x42227f['id']}}});}})[_0x58e1('0x17')](function(_0x5a54fa){if(_0x5a54fa){_0xc27d44=_0x5a54fa;return require(_0x58e1('0x4e'))[_0x58e1('0x4f')]();}})['then'](function(_0x55eec6){if(_0x55eec6&&_0x55eec6[_0x58e1('0x50')]&&_0xc27d44>=_0x55eec6['agents']){throw new Error(_0x58e1('0x51'));}})[_0x58e1('0x17')](function(){if(_0x42227f){return db[_0x58e1('0x25')]['destroy']({'where':{'membername':_0x42227f[_0x58e1('0x20')]},'individualHooks':!![]});}})[_0x58e1('0x17')](function(){if(_0x42227f){return _0x42227f[_0x58e1('0x52')]({'raw':!![]});}})[_0x58e1('0x17')](function(_0x1e9b21){if(_0x42227f){if(_0x1e9b21){var _0xc6048a=[];_0x5cfe9f=_0x1e9b21;if(_0x5cfe9f[_0x58e1('0x28')]){for(var _0x36ca76=0x0;_0x36ca76<_0x5cfe9f['length'];_0x36ca76++){_0xc6048a[_0x58e1('0x2d')](db[_0x58e1('0x25')][_0x58e1('0x53')]({'membername':_0x42227f[_0x58e1('0x20')],'UserId':_0x42227f['id'],'queue_name':_0x5cfe9f[_0x36ca76]['name'],'VoiceQueueId':_0x5cfe9f[_0x36ca76]['id'],'interface':_0x58f93c,'paused':_0x42227f[_0x58e1('0x4b')]||![],'penalty':_0x5cfe9f[_0x36ca76][_0x58e1('0x54')]||0x0}));}return BPromise[_0x58e1('0x47')](_0xc6048a);}}}})[_0x58e1('0x17')](function(){if(_0x42227f){return db[_0x58e1('0x36')]['findAll']({'where':{'membername':_0x42227f[_0x58e1('0x20')],'exitAt':null}});}})[_0x58e1('0x17')](function(_0x91ec77){if(_0x42227f){if(_0x91ec77&&_0x91ec77[_0x58e1('0x28')]){var _0x577457=[];_0x91ec77['forEach'](function(_0x4d6f40){_0x577457['push'](_0x4d6f40[_0x58e1('0x26')]({'exitAt':moment()[_0x58e1('0x22')](_0x58e1('0x29'))}));});return BPromise[_0x58e1('0x47')](_0x577457);}}})[_0x58e1('0x17')](function(){if(_0x42227f){var _0xe813d0=[];var _0x1d23d8=[];var _0x4fa700=utils[_0x58e1('0x2b')]();var _0x1c82af={'membername':_0x42227f[_0x58e1('0x20')],'interface':_0x58f93c,'enterAt':moment()[_0x58e1('0x22')](_0x58e1('0x29')),'role':_0x42227f[_0x58e1('0x33')],'internal':_0x42227f[_0x58e1('0x34')]};_0x4fa700['forEach'](function(_0x548e0d){_0xe813d0[_0x58e1('0x2d')](_[_0x58e1('0x55')]({'channel':_0x548e0d,'type':_0x58e1('0x56'),'data1':'callysquare','data2':_0x58f93c},_0x1c82af));if(_0x42227f[_0x58e1('0x4b')]){_0x1d23d8[_0x58e1('0x2d')](_[_0x58e1('0x55')]({'channel':_0x548e0d,'type':_0x58e1('0x27'),'data1':'LOGININPAUSE'},_0x1c82af));}});return db[_0x58e1('0x36')][_0x58e1('0x57')](_0xe813d0[_0x58e1('0x58')](_0x1d23d8),{'individualHooks':!![]});}})[_0x58e1('0x17')](function(){if(_0x42227f){return _0x42227f['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x42227f[_0x58e1('0x4b')]||![],'mailPause':_0x42227f[_0x58e1('0x4b')]||![],'chatPause':_0x42227f['loginInPause']||![],'faxPause':_0x42227f[_0x58e1('0x4b')]||![],'smsPause':_0x42227f['loginInPause']||![],'openchannelPause':_0x42227f['loginInPause']||![],'pauseType':_0x42227f[_0x58e1('0x4b')]?_0x58e1('0x59'):null,'lastPauseAt':moment()[_0x58e1('0x22')](_0x58e1('0x29')),'interface':_0x58f93c});}})['then'](function(_0x30aa7f){_0x20faf7(_0x30aa7f);})[_0x58e1('0x1e')](function(_0x417877){_0x2c8442(_0x4e08d4[_0x58e1('0x1c')](0x1f4,_0x417877['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d757852..f7d3ac8 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 _0x5e6d=['removeListener','register','length','save','remove','update','emit'];(function(_0x23e156,_0x38f15d){var _0x5e76eb=function(_0x18e160){while(--_0x18e160){_0x23e156['push'](_0x23e156['shift']());}};_0x5e76eb(++_0x38f15d);}(_0x5e6d,0xff));var _0xd5e6=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x5e6d[_0x725b8e];return _0x43ac45;};'use strict';var UserEvents=require('./user.events');var events=[_0xd5e6('0x0'),_0xd5e6('0x1'),_0xd5e6('0x2')];function createListener(_0x4f4eca,_0x182139){return function(_0x1eddf6){_0x182139[_0xd5e6('0x3')](_0x4f4eca,_0x1eddf6);};}function removeListener(_0x39b2fe,_0x2c57ad){return function(){UserEvents[_0xd5e6('0x4')](_0x39b2fe,_0x2c57ad);};}exports[_0xd5e6('0x5')]=function(_0x383d0d){for(var _0x1df49c=0x0,_0x3ed894=events[_0xd5e6('0x6')];_0x1df49c<_0x3ed894;_0x1df49c++){var _0x35d85e=events[_0x1df49c];var _0x5d9199=createListener('user:'+_0x35d85e,_0x383d0d);UserEvents['on'](_0x35d85e,_0x5d9199);}}; \ No newline at end of file +var _0x3163=['remove','update','emit','user:','./user.events'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x3163,0x149));var _0x3316=function(_0x1fb5db,_0x5eec00){_0x1fb5db=_0x1fb5db-0x0;var _0x59df5c=_0x3163[_0x1fb5db];return _0x59df5c;};'use strict';var UserEvents=require(_0x3316('0x0'));var events=['save',_0x3316('0x1'),_0x3316('0x2')];function createListener(_0x251f41,_0x43be32){return function(_0x5981ab){_0x43be32[_0x3316('0x3')](_0x251f41,_0x5981ab);};}function removeListener(_0x349c1b,_0x5bb75a){return function(){UserEvents['removeListener'](_0x349c1b,_0x5bb75a);};}exports['register']=function(_0x3f0d29){for(var _0x8b569d=0x0,_0x35f6aa=events['length'];_0x8b569d<_0x35f6aa;_0x8b569d++){var _0x174f45=events[_0x8b569d];var _0x4661d1=createListener(_0x3316('0x4')+_0x174f45,_0x3f0d29);UserEvents['on'](_0x174f45,_0x4661d1);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c48491b..d0ba5b7 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1f687a,_0x47f54c){var _0x2d1e04=function(_0x4dc6e){while(--_0x4dc6e){_0x1f687a['push'](_0x1f687a['shift']());}};_0x2d1e04(++_0x47f54c);}(_0x70e0,0x17b));var _0x070e=function(_0x1a45db,_0x3290dc){_0x1a45db=_0x1a45db-0x0;var _0x29a7eb=_0x70e0[_0x1a45db];return _0x29a7eb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4da886,_0x4b6e85){var _0xd86f03=function(_0x2a8d81){while(--_0x2a8d81){_0x4da886['push'](_0x4da886['shift']());}};_0xd86f03(++_0x4b6e85);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fa44d39..f9dedb0 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 _0xa1a5=['sequelize','INTEGER'];(function(_0x54e428,_0x14b472){var _0x131cb3=function(_0x2a9834){while(--_0x2a9834){_0x54e428['push'](_0x54e428['shift']());}};_0x131cb3(++_0x14b472);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x55af63,_0x4afa97){_0x55af63=_0x55af63-0x0;var _0x749b32=_0xa1a5[_0x55af63];return _0x749b32;};'use strict';var Sequelize=require(_0x5a1a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5a1a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x760d=['exports','INTEGER','sequelize'];(function(_0x1bd6fa,_0x22d856){var _0x1ec425=function(_0x1005a3){while(--_0x1005a3){_0x1bd6fa['push'](_0x1bd6fa['shift']());}};_0x1ec425(++_0x22d856);}(_0x760d,0x113));var _0xd760=function(_0x161400,_0x3feb33){_0x161400=_0x161400-0x0;var _0x43b0f9=_0x760d[_0x161400];return _0x43b0f9;};'use strict';var Sequelize=require(_0xd760('0x0'));module[_0xd760('0x1')]={'penalty':{'type':Sequelize[_0xd760('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 038ecca..c32aab8 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 _0xedee=['util','../../config/logger','bluebird','path','../../config/environment','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x19f66a,_0x59f143){var _0x127266=function(_0x4b3fbc){while(--_0x4b3fbc){_0x19f66a['push'](_0x19f66a['shift']());}};_0x127266(++_0x59f143);}(_0xedee,0x170));var _0xeede=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xedee[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xeede('0x0'));var util=require(_0xeede('0x1'));var logger=require(_0xeede('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeede('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeede('0x4'));var rimraf=require('rimraf');var config=require(_0xeede('0x5'));var attributes=require('./userChatQueue.attributes');module[_0xeede('0x6')]=function(_0x196d8e,_0xfbf4b3){return _0x196d8e['define'](_0xeede('0x7'),attributes,{'tableName':_0xeede('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec2b=['define','UserChatQueue','user_has_chat_queues','api','moment','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xec2b,0x14d));var _0xbec2=function(_0x5bb304,_0x40b9d2){_0x5bb304=_0x5bb304-0x0;var _0x2e2026=_0xec2b[_0x5bb304];return _0x2e2026;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbec2('0x0'));var moment=require(_0xbec2('0x1'));var BPromise=require(_0xbec2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbec2('0x3'));var config=require(_0xbec2('0x4'));var attributes=require(_0xbec2('0x5'));module[_0xbec2('0x6')]=function(_0x1c8ede,_0x2e8a71){return _0x1c8ede[_0xbec2('0x7')](_0xbec2('0x8'),attributes,{'tableName':_0xbec2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 2006342..6178cc5 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 _0x6b01=['info','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x1fd06e,_0x29d505){var _0x5aec60=function(_0x4546be){while(--_0x4546be){_0x1fd06e['push'](_0x1fd06e['shift']());}};_0x5aec60(++_0x29d505);}(_0x6b01,0x17d));var _0x16b0=function(_0xd84c36,_0x5e14be){_0xd84c36=_0xd84c36-0x0;var _0x32c2bf=_0x6b01[_0xd84c36];return _0x32c2bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16b0('0x0'));var fs=require('fs');var Redis=require(_0x16b0('0x1'));var db=require(_0x16b0('0x2'))['db'];var utils=require(_0x16b0('0x3'));var logger=require('../../config/logger')(_0x16b0('0x4'));var config=require(_0x16b0('0x5'));var jayson=require(_0x16b0('0x6'));var client=jayson[_0x16b0('0x7')][_0x16b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4387b1,_0x248219,_0x207ad6){return new BPromise(function(_0x29d9bc,_0x10f109){return client[_0x16b0('0x9')](_0x4387b1,_0x207ad6)[_0x16b0('0xa')](function(_0x45fbcc){logger['info'](_0x16b0('0xb'),_0x248219,'request\x20sent');logger[_0x16b0('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x248219,_0x16b0('0xd'),JSON[_0x16b0('0xe')](_0x45fbcc));if(_0x45fbcc[_0x16b0('0xf')]){if(_0x45fbcc[_0x16b0('0xf')][_0x16b0('0x10')]===0x1f4){logger[_0x16b0('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x248219,_0x45fbcc[_0x16b0('0xf')][_0x16b0('0x11')]);return _0x10f109(_0x45fbcc[_0x16b0('0xf')]['message']);}logger[_0x16b0('0xf')](_0x16b0('0xb'),_0x248219,_0x45fbcc['error'][_0x16b0('0x11')]);return _0x29d9bc(_0x45fbcc[_0x16b0('0xf')][_0x16b0('0x11')]);}else{logger[_0x16b0('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x248219,_0x16b0('0xd'));_0x29d9bc(_0x45fbcc[_0x16b0('0x13')][_0x16b0('0x11')]);}})[_0x16b0('0x14')](function(_0x33d4e9){logger[_0x16b0('0xf')](_0x16b0('0xb'),_0x248219,_0x33d4e9);_0x10f109(_0x33d4e9);});});} \ No newline at end of file +var _0xc1ae=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d4a58,_0x2bcaf6){var _0x531989=function(_0x26e691){while(--_0x26e691){_0x4d4a58['push'](_0x4d4a58['shift']());}};_0x531989(++_0x2bcaf6);}(_0xc1ae,0x84));var _0xec1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec1a('0x0'));var util=require('util');var moment=require(_0xec1a('0x1'));var BPromise=require(_0xec1a('0x2'));var rs=require(_0xec1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec1a('0x4'))['db'];var utils=require(_0xec1a('0x5'));var logger=require('../../config/logger')(_0xec1a('0x6'));var config=require(_0xec1a('0x7'));var jayson=require(_0xec1a('0x8'));var client=jayson[_0xec1a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7787a1,_0x536bc4,_0x4f1509){return new BPromise(function(_0x458d80,_0x3c0937){return client['request'](_0x7787a1,_0x4f1509)[_0xec1a('0xa')](function(_0x2b08ae){logger[_0xec1a('0xb')](_0xec1a('0xc'),_0x536bc4,_0xec1a('0xd'));logger[_0xec1a('0xe')](_0xec1a('0xf'),_0x536bc4,'request\x20sent',JSON['stringify'](_0x2b08ae));if(_0x2b08ae[_0xec1a('0x10')]){if(_0x2b08ae[_0xec1a('0x10')][_0xec1a('0x11')]===0x1f4){logger['error'](_0xec1a('0xc'),_0x536bc4,_0x2b08ae[_0xec1a('0x10')][_0xec1a('0x12')]);return _0x3c0937(_0x2b08ae['error'][_0xec1a('0x12')]);}logger[_0xec1a('0x10')](_0xec1a('0xc'),_0x536bc4,_0x2b08ae['error'][_0xec1a('0x12')]);return _0x458d80(_0x2b08ae[_0xec1a('0x10')]['message']);}else{logger['info'](_0xec1a('0xc'),_0x536bc4,_0xec1a('0xd'));_0x458d80(_0x2b08ae[_0xec1a('0x13')][_0xec1a('0x12')]);}})[_0xec1a('0x14')](function(_0x39c471){logger[_0xec1a('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x536bc4,_0x39c471);_0x3c0937(_0x39c471);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d173f00..e048794 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x320fe8,_0x336026){var _0x5051d6=function(_0x37a925){while(--_0x37a925){_0x320fe8['push'](_0x320fe8['shift']());}};_0x5051d6(++_0x336026);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xcb91[_0x4d8a8f];return _0xfc4adc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a9d8b,_0x144d15){var _0x355243=function(_0x5948a2){while(--_0x5948a2){_0x2a9d8b['push'](_0x2a9d8b['shift']());}};_0x355243(++_0x144d15);}(_0x70e0,0x17b));var _0x070e=function(_0x10113e,_0x2c6861){_0x10113e=_0x10113e-0x0;var _0x2051d4=_0x70e0[_0x10113e];return _0x2051d4;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b2d748e..14e9c93 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 _0x62a4=['exports','INTEGER','sequelize'];(function(_0x2833ed,_0x338d53){var _0x2f603c=function(_0x397d10){while(--_0x397d10){_0x2833ed['push'](_0x2833ed['shift']());}};_0x2f603c(++_0x338d53);}(_0x62a4,0x7d));var _0x462a=function(_0x15653b,_0x3a8af9){_0x15653b=_0x15653b-0x0;var _0xb18aed=_0x62a4[_0x15653b];return _0xb18aed;};'use strict';var Sequelize=require(_0x462a('0x0'));module[_0x462a('0x1')]={'penalty':{'type':Sequelize[_0x462a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x462a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf49=['exports','INTEGER','STRING','sequelize'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xbf49,0x1eb));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9bf4('0x0'));module[_0x9bf4('0x1')]={'penalty':{'type':Sequelize[_0x9bf4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9bf4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9bf4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0093c06..2d4eea1 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 _0xf9f3=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x3b9bef,_0x4c96eb){var _0x58f5ac=function(_0x4ae64e){while(--_0x4ae64e){_0x3b9bef['push'](_0x3b9bef['shift']());}};_0x58f5ac(++_0x4c96eb);}(_0xf9f3,0x194));var _0x3f9f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf9f3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3f9f('0x0'));var util=require(_0x3f9f('0x1'));var logger=require(_0x3f9f('0x2'))(_0x3f9f('0x3'));var moment=require(_0x3f9f('0x4'));var BPromise=require(_0x3f9f('0x5'));var rp=require(_0x3f9f('0x6'));var fs=require('fs');var path=require(_0x3f9f('0x7'));var rimraf=require(_0x3f9f('0x8'));var config=require(_0x3f9f('0x9'));var attributes=require(_0x3f9f('0xa'));module[_0x3f9f('0xb')]=function(_0x5d8c78,_0x5e77f0){return _0x5d8c78[_0x3f9f('0xc')](_0x3f9f('0xd'),attributes,{'tableName':_0x3f9f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9891=['rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5b1939,_0x5b2646){var _0x4b7f01=function(_0x3d971d){while(--_0x3d971d){_0x5b1939['push'](_0x5b1939['shift']());}};_0x4b7f01(++_0x5b2646);}(_0x9891,0x1c0));var _0x1989=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x9891[_0x26b8b5];return _0x2150a9;};'use strict';var _=require(_0x1989('0x0'));var util=require(_0x1989('0x1'));var logger=require('../../config/logger')(_0x1989('0x2'));var moment=require(_0x1989('0x3'));var BPromise=require(_0x1989('0x4'));var rp=require(_0x1989('0x5'));var fs=require('fs');var path=require(_0x1989('0x6'));var rimraf=require(_0x1989('0x7'));var config=require(_0x1989('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x1989('0x9')]=function(_0x3cd0ca,_0x145ac4){return _0x3cd0ca[_0x1989('0xa')](_0x1989('0xb'),attributes,{'tableName':_0x1989('0xc'),'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 dbbe038..1876ddd 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 _0x9114=['stringify','error','code','message','result','catch','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x9114,0x1bf));var _0x4911=function(_0x70a059,_0x251f31){_0x70a059=_0x70a059-0x0;var _0x562132=_0x9114[_0x70a059];return _0x562132;};'use strict';var _=require('lodash');var util=require(_0x4911('0x0'));var moment=require(_0x4911('0x1'));var BPromise=require(_0x4911('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4911('0x3'))('rpc');var config=require(_0x4911('0x4'));var jayson=require(_0x4911('0x5'));var client=jayson[_0x4911('0x6')][_0x4911('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2cd325,_0x233e9a,_0x7f4afc){return new BPromise(function(_0x102eeb,_0x22e600){return client[_0x4911('0x8')](_0x2cd325,_0x7f4afc)[_0x4911('0x9')](function(_0xddee9f){logger[_0x4911('0xa')](_0x4911('0xb'),_0x233e9a,'request\x20sent');logger[_0x4911('0xc')](_0x4911('0xd'),_0x233e9a,_0x4911('0xe'),JSON[_0x4911('0xf')](_0xddee9f));if(_0xddee9f['error']){if(_0xddee9f[_0x4911('0x10')][_0x4911('0x11')]===0x1f4){logger[_0x4911('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x233e9a,_0xddee9f['error']['message']);return _0x22e600(_0xddee9f['error'][_0x4911('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x233e9a,_0xddee9f[_0x4911('0x10')]['message']);return _0x102eeb(_0xddee9f['error'][_0x4911('0x12')]);}else{logger[_0x4911('0xa')](_0x4911('0xb'),_0x233e9a,_0x4911('0xe'));_0x102eeb(_0xddee9f[_0x4911('0x13')][_0x4911('0x12')]);}})[_0x4911('0x14')](function(_0x31f90f){logger['error'](_0x4911('0xb'),_0x233e9a,_0x31f90f);_0x22e600(_0x31f90f);});});} \ No newline at end of file +var _0xc7d6=['http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x273717,_0x2c1c10){var _0x313ed2=function(_0x360dbc){while(--_0x360dbc){_0x273717['push'](_0x273717['shift']());}};_0x313ed2(++_0x2c1c10);}(_0xc7d6,0x1ac));var _0x6c7d=function(_0x22ca55,_0x4d2a17){_0x22ca55=_0x22ca55-0x0;var _0x191044=_0xc7d6[_0x22ca55];return _0x191044;};'use strict';var _=require(_0x6c7d('0x0'));var util=require(_0x6c7d('0x1'));var moment=require(_0x6c7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c7d('0x3'));var db=require(_0x6c7d('0x4'))['db'];var utils=require(_0x6c7d('0x5'));var logger=require(_0x6c7d('0x6'))(_0x6c7d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6c7d('0x8')][_0x6c7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bb779,_0x5c289e,_0x569e67){return new BPromise(function(_0x384408,_0x50033e){return client[_0x6c7d('0xa')](_0x2bb779,_0x569e67)['then'](function(_0x5bb110){logger[_0x6c7d('0xb')](_0x6c7d('0xc'),_0x5c289e,_0x6c7d('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5c289e,_0x6c7d('0xd'),JSON[_0x6c7d('0xe')](_0x5bb110));if(_0x5bb110['error']){if(_0x5bb110[_0x6c7d('0xf')][_0x6c7d('0x10')]===0x1f4){logger[_0x6c7d('0xf')](_0x6c7d('0xc'),_0x5c289e,_0x5bb110[_0x6c7d('0xf')][_0x6c7d('0x11')]);return _0x50033e(_0x5bb110[_0x6c7d('0xf')][_0x6c7d('0x11')]);}logger[_0x6c7d('0xf')](_0x6c7d('0xc'),_0x5c289e,_0x5bb110[_0x6c7d('0xf')][_0x6c7d('0x11')]);return _0x384408(_0x5bb110[_0x6c7d('0xf')][_0x6c7d('0x11')]);}else{logger['info'](_0x6c7d('0xc'),_0x5c289e,_0x6c7d('0xd'));_0x384408(_0x5bb110[_0x6c7d('0x12')][_0x6c7d('0x11')]);}})['catch'](function(_0x21d077){logger[_0x6c7d('0xf')](_0x6c7d('0xc'),_0x5c289e,_0x21d077);_0x50033e(_0x21d077);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index cb31813..1c94a8d 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(_0x544e8b,_0x10d5fa){var _0x237718=function(_0x199ed4){while(--_0x199ed4){_0x544e8b['push'](_0x544e8b['shift']());}};_0x237718(++_0x10d5fa);}(_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(_0x21d4c1,_0x1042d8){var _0x440412=function(_0x4d96c7){while(--_0x4d96c7){_0x21d4c1['push'](_0x21d4c1['shift']());}};_0x440412(++_0x1042d8);}(_0xe706,0xa3));var _0x6e70=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0xe706[_0x27097a];return _0x26378b;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 637f64c..412e0bf 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 _0x0a12=['sequelize','exports','INTEGER'];(function(_0x1fb522,_0x5a7a10){var _0x4ba059=function(_0xa5f5f7){while(--_0xa5f5f7){_0x1fb522['push'](_0x1fb522['shift']());}};_0x4ba059(++_0x5a7a10);}(_0x0a12,0x1bf));var _0x20a1=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x0a12[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0x20a1('0x0'));module[_0x20a1('0x1')]={'penalty':{'type':Sequelize[_0x20a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x243b=['INTEGER','exports'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x243b,0xb1));var _0xb243=function(_0x2ad50a,_0x170f2f){_0x2ad50a=_0x2ad50a-0x0;var _0x3d6a63=_0x243b[_0x2ad50a];return _0x3d6a63;};'use strict';var Sequelize=require('sequelize');module[_0xb243('0x0')]={'penalty':{'type':Sequelize[_0xb243('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 8045efd..b927bdc 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 _0xe783=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','util','../../config/logger'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe783,0xb4));var _0x3e78=function(_0x1375c6,_0xa0ac61){_0x1375c6=_0x1375c6-0x0;var _0x17b8c7=_0xe783[_0x1375c6];return _0x17b8c7;};'use strict';var _=require('lodash');var util=require(_0x3e78('0x0'));var logger=require(_0x3e78('0x1'))(_0x3e78('0x2'));var moment=require(_0x3e78('0x3'));var BPromise=require(_0x3e78('0x4'));var rp=require(_0x3e78('0x5'));var fs=require('fs');var path=require(_0x3e78('0x6'));var rimraf=require(_0x3e78('0x7'));var config=require(_0x3e78('0x8'));var attributes=require(_0x3e78('0x9'));module[_0x3e78('0xa')]=function(_0x2fe9c6,_0x1f57a4){return _0x2fe9c6['define'](_0x3e78('0xb'),attributes,{'tableName':_0x3e78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc61=['moment','bluebird','request-promise','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','api'];(function(_0x478e89,_0x9d1545){var _0x4eb4e5=function(_0x51790b){while(--_0x51790b){_0x478e89['push'](_0x478e89['shift']());}};_0x4eb4e5(++_0x9d1545);}(_0xfc61,0xcd));var _0x1fc6=function(_0x40bbf5,_0x20da60){_0x40bbf5=_0x40bbf5-0x0;var _0x572ca7=_0xfc61[_0x40bbf5];return _0x572ca7;};'use strict';var _=require(_0x1fc6('0x0'));var util=require(_0x1fc6('0x1'));var logger=require(_0x1fc6('0x2'))(_0x1fc6('0x3'));var moment=require(_0x1fc6('0x4'));var BPromise=require(_0x1fc6('0x5'));var rp=require(_0x1fc6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1fc6('0x7'));module[_0x1fc6('0x8')]=function(_0x45a91c,_0x259f0e){return _0x45a91c[_0x1fc6('0x9')](_0x1fc6('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e9e3f5d..97bdd28 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x312912,_0x5adf8b){var _0x4ed959=function(_0x5e9a48){while(--_0x5e9a48){_0x312912['push'](_0x312912['shift']());}};_0x4ed959(++_0x5adf8b);}(_0x55ca,0x126));var _0xa55c=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0x55ca[_0x3871d7];return _0x28ec09;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x96d52d,_0x509f16){var _0x2575d4=function(_0x415bd0){while(--_0x415bd0){_0x96d52d['push'](_0x96d52d['shift']());}};_0x2575d4(++_0x509f16);}(_0xe14b,0x93));var _0xbe14=function(_0x2b3686,_0x81df85){_0x2b3686=_0x2b3686-0x0;var _0x235fd8=_0xe14b[_0x2b3686];return _0x235fd8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ee85d6a..6e1ee8b 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 _0xac5f=['Router','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','path','connect-timeout','express'];(function(_0x52cf07,_0x168dfe){var _0x335bca=function(_0x31e9c6){while(--_0x31e9c6){_0x52cf07['push'](_0x52cf07['shift']());}};_0x335bca(++_0x168dfe);}(_0xac5f,0x1bf));var _0xfac5=function(_0x16d988,_0x47fd13){_0x16d988=_0x16d988-0x0;var _0x3b527d=_0xac5f[_0x16d988];return _0x3b527d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfac5('0x0'));var timeout=require(_0xfac5('0x1'));var express=require(_0xfac5('0x2'));var router=express[_0xfac5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfac5('0x4'));var controller=require(_0xfac5('0x5'));router[_0xfac5('0x6')]('/',auth[_0xfac5('0x7')](),controller[_0xfac5('0x8')]);module[_0xfac5('0x9')]=router; \ No newline at end of file +var _0x8977=['post','sendUserNotification','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8977,0x18f));var _0x7897=function(_0x12c15d,_0x1298d7){_0x12c15d=_0x12c15d-0x0;var _0x173fd0=_0x8977[_0x12c15d];return _0x173fd0;};'use strict';var multer=require(_0x7897('0x0'));var util=require(_0x7897('0x1'));var path=require('path');var timeout=require(_0x7897('0x2'));var express=require('express');var router=express[_0x7897('0x3')]();var fs_extra=require(_0x7897('0x4'));var auth=require(_0x7897('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7897('0x6'));var controller=require(_0x7897('0x7'));router[_0x7897('0x8')]('/',auth['isAuthenticated'](),controller[_0x7897('0x9')]);module[_0x7897('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 1256d3d..b3a4f74 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 _0x0bef=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x3404fd,_0x116396){var _0x5aa40c=function(_0x2124d1){while(--_0x2124d1){_0x3404fd['push'](_0x3404fd['shift']());}};_0x5aa40c(++_0x116396);}(_0x0bef,0x161));var _0xf0be=function(_0x50354b,_0x4e474e){_0x50354b=_0x50354b-0x0;var _0x5506e9=_0x0bef[_0x50354b];return _0x5506e9;};'use strict';var Sequelize=require(_0xf0be('0x0'));module[_0xf0be('0x1')]={'body':{'type':Sequelize[_0xf0be('0x2')]},'senderName':{'type':Sequelize[_0xf0be('0x3')]},'recipientsId':{'type':Sequelize[_0xf0be('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf0be('0x3')]},'beep':{'type':Sequelize[_0xf0be('0x4')]}}; \ No newline at end of file +var _0xcd15=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x1a49cb,_0x5ac9cd){var _0x302261=function(_0x2d9270){while(--_0x2d9270){_0x1a49cb['push'](_0x1a49cb['shift']());}};_0x302261(++_0x5ac9cd);}(_0xcd15,0xc8));var _0x5cd1=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0xcd15[_0x231a47];return _0x48d7c9;};'use strict';var Sequelize=require(_0x5cd1('0x0'));module[_0x5cd1('0x1')]={'body':{'type':Sequelize[_0x5cd1('0x2')]},'senderName':{'type':Sequelize[_0x5cd1('0x3')]},'recipientsId':{'type':Sequelize[_0x5cd1('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5cd1('0x3')]},'beep':{'type':Sequelize[_0x5cd1('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 36db25e..db0cdae 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 _0x5f6c=['team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','create','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','queue','Queue','ids','push','all','flatten','map','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/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x196ed7,_0x2f9181){var _0x121d12=function(_0x134057){while(--_0x134057){_0x196ed7['push'](_0x196ed7['shift']());}};_0x121d12(++_0x2f9181);}(_0x5f6c,0x14a));var _0xc5f6=function(_0x8ee23f,_0x11b8ab){_0x8ee23f=_0x8ee23f-0x0;var _0x23cf0f=_0x5f6c[_0x8ee23f];return _0x23cf0f;};'use strict';var emlformat=require(_0xc5f6('0x0'));var rimraf=require(_0xc5f6('0x1'));var zipdir=require(_0xc5f6('0x2'));var jsonpatch=require(_0xc5f6('0x3'));var rp=require(_0xc5f6('0x4'));var moment=require(_0xc5f6('0x5'));var BPromise=require(_0xc5f6('0x6'));var Mustache=require(_0xc5f6('0x7'));var util=require(_0xc5f6('0x8'));var path=require(_0xc5f6('0x9'));var sox=require('sox');var csv=require(_0xc5f6('0xa'));var ejs=require(_0xc5f6('0xb'));var fs=require('fs');var fs_extra=require(_0xc5f6('0xc'));var _=require(_0xc5f6('0xd'));var squel=require(_0xc5f6('0xe'));var crypto=require(_0xc5f6('0xf'));var jsforce=require(_0xc5f6('0x10'));var deskjs=require(_0xc5f6('0x11'));var toCsv=require(_0xc5f6('0xa'));var querystring=require(_0xc5f6('0x12'));var Papa=require(_0xc5f6('0x13'));var Redis=require(_0xc5f6('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5f6('0x15'));var hardwareService=require(_0xc5f6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc5f6('0x17'));var config=require(_0xc5f6('0x18'));var licenseUtil=require(_0xc5f6('0x19'));var db=require('../../mysqldb')['db'];config[_0xc5f6('0x1a')]=_['defaults'](config[_0xc5f6('0x1a')],{'host':_0xc5f6('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5f6('0x1a')]));require('./userNotification.socket')[_0xc5f6('0x1c')](socket);function respondWithStatusCode(_0x5c343d,_0x63044d){_0x63044d=_0x63044d||0xcc;return function(_0x27f68f){if(_0x27f68f){return _0x5c343d[_0xc5f6('0x1d')](_0x63044d);}return _0x5c343d[_0xc5f6('0x1e')](_0x63044d)[_0xc5f6('0x1f')]();};}function respondWithResult(_0xc4f747,_0x54e8d3){_0x54e8d3=_0x54e8d3||0xc8;return function(_0x3c8bde){if(_0x3c8bde){return _0xc4f747[_0xc5f6('0x1e')](_0x54e8d3)[_0xc5f6('0x20')](_0x3c8bde);}};}function respondWithFilteredResult(_0xe4d811,_0x5e6a69){return function(_0x1e902b){if(_0x1e902b){var _0x1fd5fc=typeof _0x5e6a69['offset']==='undefined'&&typeof _0x5e6a69[_0xc5f6('0x21')]===_0xc5f6('0x22');var _0x3ee2d2=_0x1e902b['count'];var _0x4e4960=_0x1fd5fc?0x0:_0x5e6a69[_0xc5f6('0x23')];var _0x3d310a=_0x1fd5fc?_0x1e902b[_0xc5f6('0x24')]:_0x5e6a69[_0xc5f6('0x23')]+_0x5e6a69[_0xc5f6('0x21')];var _0x558c43;if(_0x3d310a>=_0x3ee2d2){_0x3d310a=_0x3ee2d2;_0x558c43=0xc8;}else{_0x558c43=0xce;}_0xe4d811[_0xc5f6('0x1e')](_0x558c43);return _0xe4d811[_0xc5f6('0x25')](_0xc5f6('0x26'),_0x4e4960+'-'+_0x3d310a+'/'+_0x3ee2d2)[_0xc5f6('0x20')](_0x1e902b);}return null;};}function patchUpdates(_0x3b642d){return function(_0x320f66){try{jsonpatch['apply'](_0x320f66,_0x3b642d,!![]);}catch(_0x35b0de){return BPromise[_0xc5f6('0x27')](_0x35b0de);}return _0x320f66[_0xc5f6('0x28')]();};}function saveUpdates(_0x2e1f44,_0x1c2717){return function(_0x927a5e){if(_0x927a5e){return _0x927a5e[_0xc5f6('0x29')](_0x2e1f44)[_0xc5f6('0x2a')](function(_0x5059f5){return _0x5059f5;});}return null;};}function removeEntity(_0x5be305,_0xc39d9b){return function(_0x418b29){if(_0x418b29){return _0x418b29[_0xc5f6('0x2b')]()['then'](function(){_0x5be305[_0xc5f6('0x1e')](0xcc)[_0xc5f6('0x1f')]();});}};}function handleEntityNotFound(_0xb9105f,_0x58a64d){return function(_0x42d0fa){if(!_0x42d0fa){_0xb9105f[_0xc5f6('0x1d')](0x194);}return _0x42d0fa;};}function handleError(_0x50c0ca,_0x284f24){_0x284f24=_0x284f24||0x1f4;return function(_0x57e16d){logger['error'](_0x57e16d[_0xc5f6('0x2c')]);if(_0x57e16d[_0xc5f6('0x2d')]){delete _0x57e16d[_0xc5f6('0x2d')];}_0x50c0ca[_0xc5f6('0x1e')](_0x284f24)[_0xc5f6('0x2e')](_0x57e16d);};}exports[_0xc5f6('0x2f')]=function(_0x3c684f,_0x3fd7d0,_0x10d472){if(!_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x31')](_0xc5f6('0x32'))&&!_0x3c684f['body'][_0xc5f6('0x31')](_0xc5f6('0x33'))){throw new db[(_0xc5f6('0x34'))][(_0xc5f6('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x31')](_0xc5f6('0x33'))&&!_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x31')](_0xc5f6('0x36'))){throw new db[(_0xc5f6('0x34'))][(_0xc5f6('0x35'))](_0xc5f6('0x37'));}if(!_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x31')](_0xc5f6('0x38'))){throw new db['Sequelize']['ValidationError'](_0xc5f6('0x39'));}else{try{var _0x1edfbc=JSON[_0xc5f6('0x3a')](_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x38')]);}catch(_0x3d28c0){logger[_0xc5f6('0x3b')](_0x3d28c0);throw new db['Sequelize'][(_0xc5f6('0x35'))](_0xc5f6('0x3c'));}var _0x1fffac=[_0xc5f6('0x3d'),_0xc5f6('0x3e'),_0xc5f6('0x3f'),_0xc5f6('0x40'),_0xc5f6('0x41'),'voicequeue','whatsappqueue',_0xc5f6('0x42'),_0xc5f6('0x43')];if(_[_0xc5f6('0x44')](_0x1edfbc,function(_0x3d0166){return!_['includes'](_0x1fffac,_0x3d0166[_0xc5f6('0x45')][_0xc5f6('0x46')]());})){throw new db[(_0xc5f6('0x34'))][(_0xc5f6('0x35'))](_0xc5f6('0x47'));}}}var _0x2159e1={};_0x2159e1[_0xc5f6('0x48')]=_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x31')]('senderName')?_0x3c684f['body'][_0xc5f6('0x48')]:_0x3c684f[_0xc5f6('0x43')][_0xc5f6('0x49')];_0x2159e1['recipientsDescription']=_['isEmpty'](_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x4a')])?null:_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x4a')];_0x2159e1['beep']=_0x3c684f[_0xc5f6('0x30')][_0xc5f6('0x4b')]||![];_0x2159e1[_0xc5f6('0x4c')]=_0x3c684f[_0xc5f6('0x43')]['id'];return getContent(_0x3c684f[_0xc5f6('0x30')])[_0xc5f6('0x2a')](function(_0x3c405e){_0x2159e1[_0xc5f6('0x30')]=_0x3c405e;return getRecipients(_0x1edfbc);})[_0xc5f6('0x2a')](function(_0x23c2fd){_0x2159e1[_0xc5f6('0x4d')]=_[_0xc5f6('0x4e')](_0x23c2fd)[_0xc5f6('0x4f')](',');return db[_0xc5f6('0x50')]['transaction'](function(_0x2c864e){return db['UserNotification'][_0xc5f6('0x51')](_0x2159e1,{'raw':!![],'transaction':_0x2c864e})['then'](function(_0x3cccb8){var _0x5795f6={'sender':_0x2159e1[_0xc5f6('0x48')],'description':_0x2159e1[_0xc5f6('0x4a')],'content':_0x2159e1['body'],'beep':_0x2159e1[_0xc5f6('0x4b')]};_0x23c2fd[_0xc5f6('0x52')](function(_0x3fcb98){_0x5795f6[_0xc5f6('0x53')]=_0x3fcb98;socket[_0xc5f6('0x54')]('userNotification:send',_0x5795f6);});return _0x3cccb8;});});})[_0xc5f6('0x2a')](respondWithResult(_0x3fd7d0,0xc9))[_0xc5f6('0x55')](handleError(_0x3fd7d0,null));};function getContent(_0x4b176e){return new BPromise(function(_0x4d5bc3,_0x2c73d0){if(_0x4b176e['text']){_0x4d5bc3(_0x4b176e['text']);return;}return db[_0xc5f6('0x56')][_0xc5f6('0x57')]({'attributes':[_0xc5f6('0x58')],'where':{'id':_0x4b176e[_0xc5f6('0x33')]},'raw':!![]})['then'](function(_0x28d1a5){if(!_0x28d1a5)throw new db['Sequelize'][(_0xc5f6('0x35'))](_0xc5f6('0x59'));var _0x3c3a22=Mustache[_0xc5f6('0x5a')](_0x28d1a5[_0xc5f6('0x58')],_0x4b176e[_0xc5f6('0x36')]);_0x4d5bc3(_0x3c3a22);})['catch'](function(_0x4bb8c6){_0x2c73d0(_0x4bb8c6);});});}function getRecipients(_0x3d6f47){return new BPromise(function(_0x511fde,_0xece017){var _0x85262c=[];var _0x35c805=[];_0x3d6f47[_0xc5f6('0x52')](function(_0x32c8db){var _0xaeb19f=_['startCase'](_0x32c8db[_0xc5f6('0x45')][_0xc5f6('0x46')]());if(_0xaeb19f==='User'){_0x85262c=_[_0xc5f6('0x5b')](_0x85262c,_0x32c8db['ids']);}else{if(_['includes'](_0xaeb19f,_0xc5f6('0x5c')))_0xaeb19f=_0xaeb19f['replace'](_0xc5f6('0x5c'),_0xc5f6('0x5d'));_0x32c8db[_0xc5f6('0x5e')][_0xc5f6('0x52')](function(_0x30990f){_0x35c805[_0xc5f6('0x5f')](getAgents(_0xaeb19f,_0x30990f));});}});return BPromise[_0xc5f6('0x60')](_0x35c805)[_0xc5f6('0x2a')](function(_0x1788f8){_0x85262c=_[_0xc5f6('0x5b')](_0x85262c,_[_0xc5f6('0x61')](_0x1788f8));_0x511fde(_0x85262c);})['catch'](function(_0x100405){_0xece017(_0x100405);});});}function getAgents(_0x54f698,_0x4a5f3a){return new BPromise(function(_0x4a9599,_0x51febe){return db[_0x54f698]['findOne']({'where':{'id':_0x4a5f3a}})[_0xc5f6('0x2a')](function(_0x560676){return _0x560676['getAgents']({'attributes':['id'],'raw':!![]})[_0xc5f6('0x2a')](function(_0x1928de){var _0x43ae02=_[_0xc5f6('0x62')](_0x1928de,'id');_0x4a9599(_0x43ae02);});})['catch'](function(_0x4a21cd){_0x51febe(_0x4a21cd);});});} \ No newline at end of file +var _0x7a8d=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','end','offset','count','limit','set','Content-Range','json','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','transaction','UserNotification','forEach','recipient','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','queue','replace','push','all','flatten','findOne','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5d7ad1,_0x348f92){var _0x2dff2f=function(_0x4cb2e9){while(--_0x4cb2e9){_0x5d7ad1['push'](_0x5d7ad1['shift']());}};_0x2dff2f(++_0x348f92);}(_0x7a8d,0xc0));var _0xd7a8=function(_0x526d54,_0x43323b){_0x526d54=_0x526d54-0x0;var _0x341042=_0x7a8d[_0x526d54];return _0x341042;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7a8('0x0'));var zipdir=require(_0xd7a8('0x1'));var jsonpatch=require(_0xd7a8('0x2'));var rp=require(_0xd7a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7a8('0x4'));var util=require(_0xd7a8('0x5'));var path=require(_0xd7a8('0x6'));var sox=require(_0xd7a8('0x7'));var csv=require(_0xd7a8('0x8'));var ejs=require(_0xd7a8('0x9'));var fs=require('fs');var fs_extra=require(_0xd7a8('0xa'));var _=require(_0xd7a8('0xb'));var squel=require(_0xd7a8('0xc'));var crypto=require('crypto');var jsforce=require(_0xd7a8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd7a8('0x8'));var querystring=require('querystring');var Papa=require(_0xd7a8('0xe'));var Redis=require(_0xd7a8('0xf'));var authService=require(_0xd7a8('0x10'));var qs=require(_0xd7a8('0x11'));var as=require(_0xd7a8('0x12'));var hardwareService=require(_0xd7a8('0x13'));var logger=require('../../config/logger')(_0xd7a8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd7a8('0x15'));var db=require(_0xd7a8('0x16'))['db'];config['redis']=_[_0xd7a8('0x17')](config['redis'],{'host':_0xd7a8('0x18'),'port':0x18eb});var socket=require(_0xd7a8('0x19'))(new Redis(config[_0xd7a8('0x1a')]));require(_0xd7a8('0x1b'))[_0xd7a8('0x1c')](socket);function respondWithStatusCode(_0x524b5b,_0x190168){_0x190168=_0x190168||0xcc;return function(_0x607a3d){if(_0x607a3d){return _0x524b5b[_0xd7a8('0x1d')](_0x190168);}return _0x524b5b[_0xd7a8('0x1e')](_0x190168)[_0xd7a8('0x1f')]();};}function respondWithResult(_0x4347ca,_0x151816){_0x151816=_0x151816||0xc8;return function(_0x1850bf){if(_0x1850bf){return _0x4347ca[_0xd7a8('0x1e')](_0x151816)['json'](_0x1850bf);}};}function respondWithFilteredResult(_0x51371a,_0x5737a8){return function(_0x5418a7){if(_0x5418a7){var _0x11e61e=typeof _0x5737a8[_0xd7a8('0x20')]==='undefined'&&typeof _0x5737a8['limit']==='undefined';var _0xecd9e9=_0x5418a7[_0xd7a8('0x21')];var _0xdffcc5=_0x11e61e?0x0:_0x5737a8['offset'];var _0x2443be=_0x11e61e?_0x5418a7[_0xd7a8('0x21')]:_0x5737a8['offset']+_0x5737a8[_0xd7a8('0x22')];var _0x2a07ba;if(_0x2443be>=_0xecd9e9){_0x2443be=_0xecd9e9;_0x2a07ba=0xc8;}else{_0x2a07ba=0xce;}_0x51371a[_0xd7a8('0x1e')](_0x2a07ba);return _0x51371a[_0xd7a8('0x23')](_0xd7a8('0x24'),_0xdffcc5+'-'+_0x2443be+'/'+_0xecd9e9)[_0xd7a8('0x25')](_0x5418a7);}return null;};}function patchUpdates(_0x597363){return function(_0x72cd0e){try{jsonpatch['apply'](_0x72cd0e,_0x597363,!![]);}catch(_0x1fef50){return BPromise['reject'](_0x1fef50);}return _0x72cd0e[_0xd7a8('0x26')]();};}function saveUpdates(_0x400cc2,_0x11ca66){return function(_0x3a0370){if(_0x3a0370){return _0x3a0370[_0xd7a8('0x27')](_0x400cc2)[_0xd7a8('0x28')](function(_0x2623ab){return _0x2623ab;});}return null;};}function removeEntity(_0x3fe7c5,_0x400bd4){return function(_0x22206f){if(_0x22206f){return _0x22206f[_0xd7a8('0x29')]()[_0xd7a8('0x28')](function(){_0x3fe7c5['status'](0xcc)[_0xd7a8('0x1f')]();});}};}function handleEntityNotFound(_0x1c55d5,_0x3f7a36){return function(_0x2bec02){if(!_0x2bec02){_0x1c55d5[_0xd7a8('0x1d')](0x194);}return _0x2bec02;};}function handleError(_0x4c3214,_0x17480f){_0x17480f=_0x17480f||0x1f4;return function(_0x5da3c8){logger[_0xd7a8('0x2a')](_0x5da3c8['stack']);if(_0x5da3c8[_0xd7a8('0x2b')]){delete _0x5da3c8[_0xd7a8('0x2b')];}_0x4c3214[_0xd7a8('0x1e')](_0x17480f)[_0xd7a8('0x2c')](_0x5da3c8);};}exports[_0xd7a8('0x2d')]=function(_0x4a4add,_0x49d6ba,_0x3824e6){if(!_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x2f')](_0xd7a8('0x30'))&&!_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x2f')](_0xd7a8('0x31'))){throw new db[(_0xd7a8('0x32'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x2f')](_0xd7a8('0x31'))&&!_0x4a4add[_0xd7a8('0x2e')]['hasOwnProperty'](_0xd7a8('0x33'))){throw new db['Sequelize'][(_0xd7a8('0x34'))](_0xd7a8('0x35'));}if(!_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x2f')](_0xd7a8('0x36'))){throw new db['Sequelize'][(_0xd7a8('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1d6e51=JSON['parse'](_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x36')]);}catch(_0x150023){logger[_0xd7a8('0x2a')](_0x150023);throw new db[(_0xd7a8('0x32'))][(_0xd7a8('0x34'))](_0xd7a8('0x37'));}var _0xe16aaa=[_0xd7a8('0x38'),_0xd7a8('0x39'),_0xd7a8('0x3a'),_0xd7a8('0x3b'),_0xd7a8('0x3c'),_0xd7a8('0x3d'),_0xd7a8('0x3e'),_0xd7a8('0x3f'),'user'];if(_[_0xd7a8('0x40')](_0x1d6e51,function(_0x11e509){return!_[_0xd7a8('0x41')](_0xe16aaa,_0x11e509[_0xd7a8('0x42')][_0xd7a8('0x43')]());})){throw new db[(_0xd7a8('0x32'))][(_0xd7a8('0x34'))](_0xd7a8('0x44'));}}}var _0x541016={};_0x541016['senderName']=_0x4a4add[_0xd7a8('0x2e')]['hasOwnProperty'](_0xd7a8('0x45'))?_0x4a4add['body']['senderName']:_0x4a4add[_0xd7a8('0x46')][_0xd7a8('0x47')];_0x541016[_0xd7a8('0x48')]=_[_0xd7a8('0x49')](_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x48')])?null:_0x4a4add[_0xd7a8('0x2e')]['recipientsDescription'];_0x541016['beep']=_0x4a4add[_0xd7a8('0x2e')][_0xd7a8('0x4a')]||![];_0x541016[_0xd7a8('0x4b')]=_0x4a4add[_0xd7a8('0x46')]['id'];return getContent(_0x4a4add[_0xd7a8('0x2e')])[_0xd7a8('0x28')](function(_0x55f763){_0x541016[_0xd7a8('0x2e')]=_0x55f763;return getRecipients(_0x1d6e51);})[_0xd7a8('0x28')](function(_0x2be4cf){_0x541016['recipientsId']=_['sortBy'](_0x2be4cf)[_0xd7a8('0x4c')](',');return db[_0xd7a8('0x4d')][_0xd7a8('0x4e')](function(_0x694c23){return db[_0xd7a8('0x4f')]['create'](_0x541016,{'raw':!![],'transaction':_0x694c23})[_0xd7a8('0x28')](function(_0x1680fd){var _0x377119={'sender':_0x541016[_0xd7a8('0x45')],'description':_0x541016['recipientsDescription'],'content':_0x541016[_0xd7a8('0x2e')],'beep':_0x541016[_0xd7a8('0x4a')]};_0x2be4cf[_0xd7a8('0x50')](function(_0x184fb9){_0x377119[_0xd7a8('0x51')]=_0x184fb9;socket['emit']('userNotification:send',_0x377119);});return _0x1680fd;});});})[_0xd7a8('0x28')](respondWithResult(_0x49d6ba,0xc9))[_0xd7a8('0x52')](handleError(_0x49d6ba,null));};function getContent(_0x4e7817){return new BPromise(function(_0x3b9218,_0x1b1276){if(_0x4e7817['text']){_0x3b9218(_0x4e7817['text']);return;}return db[_0xd7a8('0x53')]['findOne']({'attributes':[_0xd7a8('0x54')],'where':{'id':_0x4e7817[_0xd7a8('0x31')]},'raw':!![]})[_0xd7a8('0x28')](function(_0x2489d6){if(!_0x2489d6)throw new db['Sequelize']['ValidationError'](_0xd7a8('0x55'));var _0x29455d=Mustache['render'](_0x2489d6['html'],_0x4e7817[_0xd7a8('0x33')]);_0x3b9218(_0x29455d);})[_0xd7a8('0x52')](function(_0x45ec72){_0x1b1276(_0x45ec72);});});}function getRecipients(_0x44225){return new BPromise(function(_0xf0460e,_0x22e6ef){var _0x25ea34=[];var _0x2d699e=[];_0x44225[_0xd7a8('0x50')](function(_0x880a39){var _0x2613b7=_[_0xd7a8('0x56')](_0x880a39[_0xd7a8('0x42')][_0xd7a8('0x43')]());if(_0x2613b7===_0xd7a8('0x57')){_0x25ea34=_[_0xd7a8('0x58')](_0x25ea34,_0x880a39[_0xd7a8('0x59')]);}else{if(_['includes'](_0x2613b7,_0xd7a8('0x5a')))_0x2613b7=_0x2613b7[_0xd7a8('0x5b')](_0xd7a8('0x5a'),'Queue');_0x880a39[_0xd7a8('0x59')][_0xd7a8('0x50')](function(_0x18a735){_0x2d699e[_0xd7a8('0x5c')](getAgents(_0x2613b7,_0x18a735));});}});return BPromise[_0xd7a8('0x5d')](_0x2d699e)[_0xd7a8('0x28')](function(_0xe893a0){_0x25ea34=_[_0xd7a8('0x58')](_0x25ea34,_[_0xd7a8('0x5e')](_0xe893a0));_0xf0460e(_0x25ea34);})[_0xd7a8('0x52')](function(_0x410949){_0x22e6ef(_0x410949);});});}function getAgents(_0x13cf5e,_0x36223f){return new BPromise(function(_0x33231d,_0x198f58){return db[_0x13cf5e][_0xd7a8('0x5f')]({'where':{'id':_0x36223f}})['then'](function(_0x5498fc){return _0x5498fc[_0xd7a8('0x60')]({'attributes':['id'],'raw':!![]})[_0xd7a8('0x28')](function(_0x4d0817){var _0x96cdf0=_[_0xd7a8('0x61')](_0x4d0817,'id');_0x33231d(_0x96cdf0);});})[_0xd7a8('0x52')](function(_0x3be5b7){_0x198f58(_0x3be5b7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index eb8cd81..2e40e20 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 _0xda79=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x11c61e,_0x5bdd3c){var _0x2e52fc=function(_0x221aba){while(--_0x221aba){_0x11c61e['push'](_0x11c61e['shift']());}};_0x2e52fc(++_0x5bdd3c);}(_0xda79,0xde));var _0x9da7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xda79[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9da7('0x0'))['db'][_0x9da7('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9da7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9da7('0x3'),'afterDestroy':_0x9da7('0x4')};function emitEvent(_0x52005b){return function(_0x3aa88f,_0x5b79e5,_0x40d694){UserNotificationEvents[_0x9da7('0x5')](_0x52005b+':'+_0x3aa88f['id'],_0x3aa88f);UserNotificationEvents[_0x9da7('0x5')](_0x52005b,_0x3aa88f);_0x40d694(null);};}for(var e in events){if(events[_0x9da7('0x6')](e)){var event=events[e];UserNotification[_0x9da7('0x7')](e,emitEvent(event));}}module[_0x9da7('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xb1b6=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb1b6,0x181));var _0x6b1b=function(_0x551c1a,_0x3a5c39){_0x551c1a=_0x551c1a-0x0;var _0x409cff=_0xb1b6[_0x551c1a];return _0x409cff;};'use strict';var EventEmitter=require(_0x6b1b('0x0'));var UserNotification=require(_0x6b1b('0x1'))['db'][_0x6b1b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b1b('0x3'),'afterUpdate':_0x6b1b('0x4'),'afterDestroy':_0x6b1b('0x5')};function emitEvent(_0x332ebe){return function(_0x5c4185,_0x3c2c1e,_0x400079){UserNotificationEvents[_0x6b1b('0x6')](_0x332ebe+':'+_0x5c4185['id'],_0x5c4185);UserNotificationEvents[_0x6b1b('0x6')](_0x332ebe,_0x5c4185);_0x400079(null);};}for(var e in events){if(events[_0x6b1b('0x7')](e)){var event=events[e];UserNotification[_0x6b1b('0x8')](e,emitEvent(event));}}module[_0x6b1b('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 0f9a30a..5b7221e 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 _0xd2cd=['request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd2cd,0x159));var _0xdd2c=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xd2cd[_0xcd5a3d];return _0xd43207;};'use strict';var _=require(_0xdd2c('0x0'));var util=require(_0xdd2c('0x1'));var logger=require('../../config/logger')(_0xdd2c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd2c('0x3'));var fs=require('fs');var path=require(_0xdd2c('0x4'));var rimraf=require(_0xdd2c('0x5'));var config=require(_0xdd2c('0x6'));var attributes=require(_0xdd2c('0x7'));module[_0xdd2c('0x8')]=function(_0x10cc8b,_0x3e3034){return _0x10cc8b['define'](_0xdd2c('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd2c('0xa'),'collate':_0xdd2c('0xb')});}; \ No newline at end of file +var _0x552d=['path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x552d,0xbe));var _0xd552=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x552d[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xd552('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd552('0x1'));var moment=require(_0xd552('0x2'));var BPromise=require(_0xd552('0x3'));var rp=require(_0xd552('0x4'));var fs=require('fs');var path=require(_0xd552('0x5'));var rimraf=require(_0xd552('0x6'));var config=require(_0xd552('0x7'));var attributes=require(_0xd552('0x8'));module[_0xd552('0x9')]=function(_0x4ceaca,_0x68f9b2){return _0x4ceaca[_0xd552('0xa')](_0xd552('0xb'),attributes,{'tableName':_0xd552('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd552('0xd'),'collate':_0xd552('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b11160b..1158f2d 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 _0xa1bb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x1ce037,_0x18c6aa){var _0x4266b7=function(_0x4f552d){while(--_0x4f552d){_0x1ce037['push'](_0x1ce037['shift']());}};_0x4266b7(++_0x18c6aa);}(_0xa1bb,0x8a));var _0xba1b=function(_0x512f67,_0x1267d0){_0x512f67=_0x512f67-0x0;var _0xbd8e6b=_0xa1bb[_0x512f67];return _0xbd8e6b;};'use strict';var _=require(_0xba1b('0x0'));var util=require(_0xba1b('0x1'));var moment=require(_0xba1b('0x2'));var BPromise=require(_0xba1b('0x3'));var rs=require(_0xba1b('0x4'));var fs=require('fs');var Redis=require(_0xba1b('0x5'));var db=require(_0xba1b('0x6'))['db'];var utils=require(_0xba1b('0x7'));var logger=require(_0xba1b('0x8'))(_0xba1b('0x9'));var config=require(_0xba1b('0xa'));var jayson=require(_0xba1b('0xb'));var client=jayson[_0xba1b('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xba1b('0xd')],{'host':_0xba1b('0xe'),'port':0x18eb});var socket=require(_0xba1b('0xf'))(new Redis(config[_0xba1b('0xd')]));require(_0xba1b('0x10'))['register'](socket);function respondWithRpcPromise(_0x3739f9,_0x26b81d,_0x3810bd){return new BPromise(function(_0x48da9f,_0x39d600){return client[_0xba1b('0x11')](_0x3739f9,_0x3810bd)[_0xba1b('0x12')](function(_0x11eec0){logger['info']('UserNotification,\x20%s,\x20%s',_0x26b81d,_0xba1b('0x13'));logger['debug'](_0xba1b('0x14'),_0x26b81d,_0xba1b('0x13'),JSON[_0xba1b('0x15')](_0x11eec0));if(_0x11eec0[_0xba1b('0x16')]){if(_0x11eec0[_0xba1b('0x16')]['code']===0x1f4){logger[_0xba1b('0x16')](_0xba1b('0x17'),_0x26b81d,_0x11eec0['error']['message']);return _0x39d600(_0x11eec0[_0xba1b('0x16')][_0xba1b('0x18')]);}logger[_0xba1b('0x16')](_0xba1b('0x17'),_0x26b81d,_0x11eec0['error']['message']);return _0x48da9f(_0x11eec0[_0xba1b('0x16')][_0xba1b('0x18')]);}else{logger[_0xba1b('0x19')](_0xba1b('0x17'),_0x26b81d,_0xba1b('0x13'));_0x48da9f(_0x11eec0[_0xba1b('0x1a')]['message']);}})[_0xba1b('0x1b')](function(_0x4401ec){logger[_0xba1b('0x16')](_0xba1b('0x17'),_0x26b81d,_0x4401ec);_0x39d600(_0x4401ec);});});} \ No newline at end of file +var _0x8849=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s'];(function(_0x31520f,_0x7b9adb){var _0x5785ce=function(_0x5c28df){while(--_0x5c28df){_0x31520f['push'](_0x31520f['shift']());}};_0x5785ce(++_0x7b9adb);}(_0x8849,0x7b));var _0x9884=function(_0x5b4fdb,_0x2d36c0){_0x5b4fdb=_0x5b4fdb-0x0;var _0x3d51ef=_0x8849[_0x5b4fdb];return _0x3d51ef;};'use strict';var _=require(_0x9884('0x0'));var util=require('util');var moment=require(_0x9884('0x1'));var BPromise=require(_0x9884('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9884('0x3'));var db=require(_0x9884('0x4'))['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[_0x9884('0x5')][_0x9884('0x6')]({'port':0x232a});config[_0x9884('0x7')]=_['defaults'](config[_0x9884('0x7')],{'host':_0x9884('0x8'),'port':0x18eb});var socket=require(_0x9884('0x9'))(new Redis(config[_0x9884('0x7')]));require(_0x9884('0xa'))['register'](socket);function respondWithRpcPromise(_0x22aa21,_0x298478,_0x46126d){return new BPromise(function(_0xde276,_0x437e0a){return client[_0x9884('0xb')](_0x22aa21,_0x46126d)[_0x9884('0xc')](function(_0x4b85a7){logger[_0x9884('0xd')](_0x9884('0xe'),_0x298478,_0x9884('0xf'));logger[_0x9884('0x10')](_0x9884('0x11'),_0x298478,_0x9884('0xf'),JSON['stringify'](_0x4b85a7));if(_0x4b85a7[_0x9884('0x12')]){if(_0x4b85a7[_0x9884('0x12')][_0x9884('0x13')]===0x1f4){logger['error'](_0x9884('0xe'),_0x298478,_0x4b85a7['error'][_0x9884('0x14')]);return _0x437e0a(_0x4b85a7['error'][_0x9884('0x14')]);}logger[_0x9884('0x12')]('UserNotification,\x20%s,\x20%s',_0x298478,_0x4b85a7['error'][_0x9884('0x14')]);return _0xde276(_0x4b85a7[_0x9884('0x12')][_0x9884('0x14')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x298478,'request\x20sent');_0xde276(_0x4b85a7[_0x9884('0x15')]['message']);}})[_0x9884('0x16')](function(_0x23f40e){logger['error'](_0x9884('0xe'),_0x298478,_0x23f40e);_0x437e0a(_0x23f40e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 820e0e8..e220bc8 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 _0xc0ef=['./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x2f1242,_0x575561){var _0x4a542f=function(_0x1dfe83){while(--_0x1dfe83){_0x2f1242['push'](_0x2f1242['shift']());}};_0x4a542f(++_0x575561);}(_0xc0ef,0x134));var _0xfc0e=function(_0x5a03cd,_0x4ba653){_0x5a03cd=_0x5a03cd-0x0;var _0x2a0d8a=_0xc0ef[_0x5a03cd];return _0x2a0d8a;};'use strict';var UserNotificationEvents=require(_0xfc0e('0x0'));var events=[_0xfc0e('0x1'),_0xfc0e('0x2'),_0xfc0e('0x3')];function createListener(_0x4833b1,_0x5efea8){return function(_0x102613){_0x5efea8[_0xfc0e('0x4')](_0x4833b1,_0x102613);};}function removeListener(_0x301491,_0x23ab43){return function(){UserNotificationEvents[_0xfc0e('0x5')](_0x301491,_0x23ab43);};}exports[_0xfc0e('0x6')]=function(_0x259209){for(var _0x43793f=0x0,_0x426999=events['length'];_0x43793f<_0x426999;_0x43793f++){var _0x521cb1=events[_0x43793f];var _0x2a34c8=createListener('userNotification:'+_0x521cb1,_0x259209);UserNotificationEvents['on'](_0x521cb1,_0x2a34c8);}}; \ No newline at end of file +var _0x27a9=['length','userNotification:','./userNotification.events','update','removeListener','register'];(function(_0x39c61f,_0x22d16e){var _0x344842=function(_0x127100){while(--_0x127100){_0x39c61f['push'](_0x39c61f['shift']());}};_0x344842(++_0x22d16e);}(_0x27a9,0xb0));var _0x927a=function(_0x421528,_0x16b8a0){_0x421528=_0x421528-0x0;var _0x1ea128=_0x27a9[_0x421528];return _0x1ea128;};'use strict';var UserNotificationEvents=require(_0x927a('0x0'));var events=['save','remove',_0x927a('0x1')];function createListener(_0x1ebeae,_0x19891c){return function(_0x379b20){_0x19891c['emit'](_0x1ebeae,_0x379b20);};}function removeListener(_0x4476de,_0x2dd2df){return function(){UserNotificationEvents[_0x927a('0x2')](_0x4476de,_0x2dd2df);};}exports[_0x927a('0x3')]=function(_0x4f4069){for(var _0x2edbde=0x0,_0x1cb27b=events[_0x927a('0x4')];_0x2edbde<_0x1cb27b;_0x2edbde++){var _0x4a6b1a=events[_0x2edbde];var _0x39d27c=createListener(_0x927a('0x5')+_0x4a6b1a,_0x4f4069);UserNotificationEvents['on'](_0x4a6b1a,_0x39d27c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e2bdc37..89b4f9f 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(_0xd10f4d,_0x34fdbf){var _0x505625=function(_0x485e88){while(--_0x485e88){_0xd10f4d['push'](_0xd10f4d['shift']());}};_0x505625(++_0x34fdbf);}(_0xedd9,0xfc));var _0x9edd=function(_0xa824c3,_0xd4a860){_0xa824c3=_0xa824c3-0x0;var _0x8204da=_0xedd9[_0xa824c3];return _0x8204da;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4dcb47,_0x50ef92){var _0x352b40=function(_0x5bce21){while(--_0x5bce21){_0x4dcb47['push'](_0x4dcb47['shift']());}};_0x352b40(++_0x50ef92);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e53cbb1..9b05daf 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 _0x4215=['sequelize'];(function(_0x56923e,_0x48b080){var _0x38b368=function(_0x252711){while(--_0x252711){_0x56923e['push'](_0x56923e['shift']());}};_0x38b368(++_0x48b080);}(_0x4215,0x6e));var _0x5421=function(_0x58ff8e,_0x39fe0d){_0x58ff8e=_0x58ff8e-0x0;var _0x701683=_0x4215[_0x58ff8e];return _0x701683;};'use strict';var Sequelize=require(_0x5421('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x93a6=['INTEGER','sequelize','exports'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x93a6,0x1ab));var _0x693a=function(_0x2715b5,_0xdc645f){_0x2715b5=_0x2715b5-0x0;var _0x114369=_0x93a6[_0x2715b5];return _0x114369;};'use strict';var Sequelize=require(_0x693a('0x0'));module[_0x693a('0x1')]={'penalty':{'type':Sequelize[_0x693a('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 fb507d4..a75c24e 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 _0xe12c=['../../config/environment','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xe12c,0xc9));var _0xce12=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xe12c[_0x16b1a5];return _0x475e25;};'use strict';var _=require(_0xce12('0x0'));var util=require(_0xce12('0x1'));var logger=require(_0xce12('0x2'))(_0xce12('0x3'));var moment=require(_0xce12('0x4'));var BPromise=require(_0xce12('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce12('0x6'));var rimraf=require(_0xce12('0x7'));var config=require(_0xce12('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x31c85f,_0xe5ad46){return _0x31c85f[_0xce12('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xce12('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f4d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash'];(function(_0x2f8409,_0x369a87){var _0x40ad89=function(_0x299403){while(--_0x299403){_0x2f8409['push'](_0x2f8409['shift']());}};_0x40ad89(++_0x369a87);}(_0x3f4d,0x12a));var _0xd3f4=function(_0x125dea,_0xb160c1){_0x125dea=_0x125dea-0x0;var _0x3f612a=_0x3f4d[_0x125dea];return _0x3f612a;};'use strict';var _=require(_0xd3f4('0x0'));var util=require(_0xd3f4('0x1'));var logger=require(_0xd3f4('0x2'))(_0xd3f4('0x3'));var moment=require(_0xd3f4('0x4'));var BPromise=require(_0xd3f4('0x5'));var rp=require(_0xd3f4('0x6'));var fs=require('fs');var path=require(_0xd3f4('0x7'));var rimraf=require(_0xd3f4('0x8'));var config=require('../../config/environment');var attributes=require(_0xd3f4('0x9'));module[_0xd3f4('0xa')]=function(_0x25115b,_0x375751){return _0x25115b[_0xd3f4('0xb')](_0xd3f4('0xc'),attributes,{'tableName':'user_has_openchannel_queues','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 b576f9d..22827f7 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 _0xaa7e=['result','UserOpenchannelQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x162efe,_0xf67199){var _0xa4359a=function(_0x542954){while(--_0x542954){_0x162efe['push'](_0x162efe['shift']());}};_0xa4359a(++_0xf67199);}(_0xaa7e,0x15b));var _0xeaa7=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0xaa7e[_0x539fb2];return _0x4d583d;};'use strict';var _=require(_0xeaa7('0x0'));var util=require(_0xeaa7('0x1'));var moment=require(_0xeaa7('0x2'));var BPromise=require(_0xeaa7('0x3'));var rs=require(_0xeaa7('0x4'));var fs=require('fs');var Redis=require(_0xeaa7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeaa7('0x6'))(_0xeaa7('0x7'));var config=require(_0xeaa7('0x8'));var jayson=require(_0xeaa7('0x9'));var client=jayson[_0xeaa7('0xa')][_0xeaa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41d692,_0x1a85c7,_0x10889c){return new BPromise(function(_0x69f935,_0x46fa74){return client[_0xeaa7('0xc')](_0x41d692,_0x10889c)[_0xeaa7('0xd')](function(_0x46d3fa){logger[_0xeaa7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a85c7,_0xeaa7('0xf'));logger[_0xeaa7('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1a85c7,'request\x20sent',JSON[_0xeaa7('0x11')](_0x46d3fa));if(_0x46d3fa[_0xeaa7('0x12')]){if(_0x46d3fa[_0xeaa7('0x12')][_0xeaa7('0x13')]===0x1f4){logger[_0xeaa7('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a85c7,_0x46d3fa[_0xeaa7('0x12')][_0xeaa7('0x14')]);return _0x46fa74(_0x46d3fa['error'][_0xeaa7('0x14')]);}logger[_0xeaa7('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a85c7,_0x46d3fa['error'][_0xeaa7('0x14')]);return _0x69f935(_0x46d3fa['error']['message']);}else{logger[_0xeaa7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a85c7,_0xeaa7('0xf'));_0x69f935(_0x46d3fa[_0xeaa7('0x15')][_0xeaa7('0x14')]);}})['catch'](function(_0x5475ff){logger[_0xeaa7('0x12')](_0xeaa7('0x16'),_0x1a85c7,_0x5475ff);_0x46fa74(_0x5475ff);});});} \ No newline at end of file +var _0xf5cd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result'];(function(_0x16c5ad,_0x36c89c){var _0x588205=function(_0x27de97){while(--_0x27de97){_0x16c5ad['push'](_0x16c5ad['shift']());}};_0x588205(++_0x36c89c);}(_0xf5cd,0xd1));var _0xdf5c=function(_0x3f2f56,_0x386433){_0x3f2f56=_0x3f2f56-0x0;var _0x3ec0fd=_0xf5cd[_0x3f2f56];return _0x3ec0fd;};'use strict';var _=require(_0xdf5c('0x0'));var util=require(_0xdf5c('0x1'));var moment=require(_0xdf5c('0x2'));var BPromise=require(_0xdf5c('0x3'));var rs=require(_0xdf5c('0x4'));var fs=require('fs');var Redis=require(_0xdf5c('0x5'));var db=require(_0xdf5c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdf5c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf5c('0x8')][_0xdf5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x584f69,_0x38a45d,_0x1a2281){return new BPromise(function(_0xef2699,_0x15971a){return client['request'](_0x584f69,_0x1a2281)[_0xdf5c('0xa')](function(_0x94a044){logger[_0xdf5c('0xb')](_0xdf5c('0xc'),_0x38a45d,'request\x20sent');logger[_0xdf5c('0xd')](_0xdf5c('0xe'),_0x38a45d,'request\x20sent',JSON['stringify'](_0x94a044));if(_0x94a044[_0xdf5c('0xf')]){if(_0x94a044[_0xdf5c('0xf')]['code']===0x1f4){logger['error'](_0xdf5c('0xc'),_0x38a45d,_0x94a044[_0xdf5c('0xf')]['message']);return _0x15971a(_0x94a044['error'][_0xdf5c('0x10')]);}logger[_0xdf5c('0xf')](_0xdf5c('0xc'),_0x38a45d,_0x94a044[_0xdf5c('0xf')][_0xdf5c('0x10')]);return _0xef2699(_0x94a044[_0xdf5c('0xf')]['message']);}else{logger[_0xdf5c('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38a45d,_0xdf5c('0x11'));_0xef2699(_0x94a044[_0xdf5c('0x12')][_0xdf5c('0x10')]);}})['catch'](function(_0x11eba2){logger[_0xdf5c('0xf')](_0xdf5c('0xc'),_0x38a45d,_0x11eba2);_0x15971a(_0x11eba2);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 21e9222..bdf4287 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 _0x6cf2=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections'];(function(_0x4ba102,_0x3dc213){var _0x1f35e7=function(_0xceae5a){while(--_0xceae5a){_0x4ba102['push'](_0x4ba102['shift']());}};_0x1f35e7(++_0x3dc213);}(_0x6cf2,0x7c));var _0x26cf=function(_0x593fd4,_0x132274){_0x593fd4=_0x593fd4-0x0;var _0x485b9c=_0x6cf2[_0x593fd4];return _0x485b9c;};'use strict';var multer=require('multer');var util=require(_0x26cf('0x0'));var path=require(_0x26cf('0x1'));var timeout=require(_0x26cf('0x2'));var express=require(_0x26cf('0x3'));var router=express[_0x26cf('0x4')]();var fs_extra=require(_0x26cf('0x5'));var auth=require(_0x26cf('0x6'));var interaction=require(_0x26cf('0x7'));var config=require(_0x26cf('0x8'));var controller=require(_0x26cf('0x9'));router[_0x26cf('0xa')]('/',auth[_0x26cf('0xb')](),controller[_0x26cf('0xc')]);router[_0x26cf('0xa')](_0x26cf('0xd'),auth['isAuthenticated'](),controller[_0x26cf('0xe')]);router['get'](_0x26cf('0xf'),auth[_0x26cf('0xb')](),controller['show']);router[_0x26cf('0xa')](_0x26cf('0x10'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x11')]);router[_0x26cf('0xa')](_0x26cf('0x12'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x13')]);router['post']('/',auth[_0x26cf('0xb')](),controller[_0x26cf('0x14')]);router[_0x26cf('0x15')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x17')]);router[_0x26cf('0x15')]('/:id/sections',auth[_0x26cf('0xb')](),controller[_0x26cf('0x18')]);router[_0x26cf('0x15')](_0x26cf('0x12'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x19')]);router[_0x26cf('0x1a')](_0x26cf('0xf'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x1b')]);router[_0x26cf('0x1c')](_0x26cf('0xf'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x1d')]);router[_0x26cf('0x1c')]('/:id/sections',auth[_0x26cf('0xb')](),controller[_0x26cf('0x1e')]);router[_0x26cf('0x1c')](_0x26cf('0x12'),auth[_0x26cf('0xb')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0xc653=['/describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','addSections','/:id/resources','addResources','put','update','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc653,0x6e));var _0x3c65=function(_0x524280,_0x46045c){_0x524280=_0x524280-0x0;var _0x2b2ceb=_0xc653[_0x524280];return _0x2b2ceb;};'use strict';var multer=require(_0x3c65('0x0'));var util=require(_0x3c65('0x1'));var path=require(_0x3c65('0x2'));var timeout=require(_0x3c65('0x3'));var express=require(_0x3c65('0x4'));var router=express[_0x3c65('0x5')]();var fs_extra=require(_0x3c65('0x6'));var auth=require(_0x3c65('0x7'));var interaction=require(_0x3c65('0x8'));var config=require(_0x3c65('0x9'));var controller=require(_0x3c65('0xa'));router[_0x3c65('0xb')]('/',auth[_0x3c65('0xc')](),controller[_0x3c65('0xd')]);router[_0x3c65('0xb')](_0x3c65('0xe'),auth[_0x3c65('0xc')](),controller['describe']);router[_0x3c65('0xb')](_0x3c65('0xf'),auth['isAuthenticated'](),controller[_0x3c65('0x10')]);router['get'](_0x3c65('0x11'),auth[_0x3c65('0xc')](),controller[_0x3c65('0x12')]);router['get']('/:id/resources',auth[_0x3c65('0xc')](),controller[_0x3c65('0x13')]);router[_0x3c65('0x14')]('/',auth[_0x3c65('0xc')](),controller[_0x3c65('0x15')]);router['post'](_0x3c65('0x16'),auth['isAuthenticated'](),controller['clone']);router[_0x3c65('0x14')](_0x3c65('0x11'),auth['isAuthenticated'](),controller[_0x3c65('0x17')]);router[_0x3c65('0x14')](_0x3c65('0x18'),auth[_0x3c65('0xc')](),controller[_0x3c65('0x19')]);router[_0x3c65('0x1a')](_0x3c65('0xf'),auth[_0x3c65('0xc')](),controller[_0x3c65('0x1b')]);router['delete'](_0x3c65('0xf'),auth[_0x3c65('0xc')](),controller[_0x3c65('0x1c')]);router['delete'](_0x3c65('0x11'),auth['isAuthenticated'](),controller['removeSections']);router[_0x3c65('0x1d')](_0x3c65('0x18'),auth[_0x3c65('0xc')](),controller['removeResources']);module[_0x3c65('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 311cb95..b454163 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 _0x8759=['STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name'];(function(_0xcd637e,_0x18508d){var _0x507b8f=function(_0x4d3c94){while(--_0x4d3c94){_0xcd637e['push'](_0xcd637e['shift']());}};_0x507b8f(++_0x18508d);}(_0x8759,0xbb));var _0x9875=function(_0x5344a4,_0x25e521){_0x5344a4=_0x5344a4-0x0;var _0x367022=_0x8759[_0x5344a4];return _0x367022;};'use strict';var Sequelize=require(_0x9875('0x0'));module[_0x9875('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9875('0x2')},'crudPermissions':{'type':Sequelize[_0x9875('0x3')],'set':function(_0x45629f){this[_0x9875('0x4')](_0x9875('0x5'),_0x45629f?_0x45629f[_0x9875('0x6')](''):[]);},'get':function(){return this[_0x9875('0x7')](_0x9875('0x5'))?this[_0x9875('0x7')]('crudPermissions')[_0x9875('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9875('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9875('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9875('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9875('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9875('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9875('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9875('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9875('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb4fc=['getDataValue','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x1b869b,_0x14f997){var _0x1aa3f8=function(_0x2d04a8){while(--_0x2d04a8){_0x1b869b['push'](_0x1b869b['shift']());}};_0x1aa3f8(++_0x14f997);}(_0xb4fc,0xea));var _0xcb4f=function(_0x1a2bd0,_0x29fbab){_0x1a2bd0=_0x1a2bd0-0x0;var _0x57d3ca=_0xb4fc[_0x1a2bd0];return _0x57d3ca;};'use strict';var Sequelize=require('sequelize');module[_0xcb4f('0x0')]={'name':{'type':Sequelize[_0xcb4f('0x1')],'allowNull':![],'unique':_0xcb4f('0x2')},'crudPermissions':{'type':Sequelize[_0xcb4f('0x1')],'set':function(_0x210f15){this[_0xcb4f('0x3')](_0xcb4f('0x4'),_0x210f15?_0x210f15[_0xcb4f('0x5')](''):[]);},'get':function(){return this[_0xcb4f('0x6')]('crudPermissions')?this[_0xcb4f('0x6')](_0xcb4f('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcb4f('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcb4f('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1afaad7..034dfcc 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 _0x15ed=['findAll','show','find','catch','create','clone','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','params','each','UserProfileResource','userProfileId','Resources','update','describe','destroy','sectionId','push','ids','isEmpty','includes','subsections','enabled','concat','autoAssociation','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','end','error','name','send','index','UserProfile','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include'];(function(_0x3ec5e8,_0x4fa7f9){var _0xd556f0=function(_0x57c04a){while(--_0x57c04a){_0x3ec5e8['push'](_0x3ec5e8['shift']());}};_0xd556f0(++_0x4fa7f9);}(_0x15ed,0x1e6));var _0xd15e=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x15ed[_0x4704dc];return _0x254d81;};'use strict';var emlformat=require(_0xd15e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd15e('0x1'));var jsonpatch=require(_0xd15e('0x2'));var rp=require(_0xd15e('0x3'));var moment=require(_0xd15e('0x4'));var BPromise=require(_0xd15e('0x5'));var Mustache=require(_0xd15e('0x6'));var util=require(_0xd15e('0x7'));var path=require('path');var sox=require(_0xd15e('0x8'));var csv=require(_0xd15e('0x9'));var ejs=require(_0xd15e('0xa'));var fs=require('fs');var fs_extra=require(_0xd15e('0xb'));var _=require(_0xd15e('0xc'));var squel=require('squel');var crypto=require(_0xd15e('0xd'));var jsforce=require(_0xd15e('0xe'));var deskjs=require(_0xd15e('0xf'));var toCsv=require(_0xd15e('0x9'));var querystring=require(_0xd15e('0x10'));var Papa=require(_0xd15e('0x11'));var Redis=require('ioredis');var authService=require(_0xd15e('0x12'));var qs=require(_0xd15e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd15e('0x14'))(_0xd15e('0x15'));var utils=require(_0xd15e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd15e('0x17'));var db=require(_0xd15e('0x18'))['db'];config[_0xd15e('0x19')]=_['defaults'](config[_0xd15e('0x19')],{'host':_0xd15e('0x1a'),'port':0x18eb});var socket=require(_0xd15e('0x1b'))(new Redis(config[_0xd15e('0x19')]));require(_0xd15e('0x1c'))['register'](socket);function respondWithStatusCode(_0x2b7fda,_0x193d27){_0x193d27=_0x193d27||0xcc;return function(_0x364630){if(_0x364630){return _0x2b7fda[_0xd15e('0x1d')](_0x193d27);}return _0x2b7fda[_0xd15e('0x1e')](_0x193d27)['end']();};}function respondWithResult(_0x2aceb4,_0x55d978){_0x55d978=_0x55d978||0xc8;return function(_0x15f473){if(_0x15f473){return _0x2aceb4['status'](_0x55d978)['json'](_0x15f473);}};}function respondWithFilteredResult(_0x5027b4,_0x3bafec){return function(_0x13fbfa){if(_0x13fbfa){var _0x3a42b4=typeof _0x3bafec[_0xd15e('0x1f')]===_0xd15e('0x20')&&typeof _0x3bafec[_0xd15e('0x21')]===_0xd15e('0x20');var _0x4063f8=_0x13fbfa['count'];var _0x38305a=_0x3a42b4?0x0:_0x3bafec['offset'];var _0x271f41=_0x3a42b4?_0x13fbfa['count']:_0x3bafec[_0xd15e('0x1f')]+_0x3bafec[_0xd15e('0x21')];var _0x5f8d0c;if(_0x271f41>=_0x4063f8){_0x271f41=_0x4063f8;_0x5f8d0c=0xc8;}else{_0x5f8d0c=0xce;}_0x5027b4[_0xd15e('0x1e')](_0x5f8d0c);return _0x5027b4[_0xd15e('0x22')](_0xd15e('0x23'),_0x38305a+'-'+_0x271f41+'/'+_0x4063f8)[_0xd15e('0x24')](_0x13fbfa);}return null;};}function patchUpdates(_0x1bb382){return function(_0x2b6fcc){try{jsonpatch[_0xd15e('0x25')](_0x2b6fcc,_0x1bb382,!![]);}catch(_0x143d6e){return BPromise[_0xd15e('0x26')](_0x143d6e);}return _0x2b6fcc['save']();};}function saveUpdates(_0x1065c8,_0x2f551f){return function(_0x4f8c59){if(_0x4f8c59){return _0x4f8c59['update'](_0x1065c8)['then'](function(_0x16356a){return _0x16356a;});}return null;};}function removeEntity(_0x38792b,_0x3ac2f4){return function(_0x159d3c){if(_0x159d3c){return _0x159d3c['destroy']()[_0xd15e('0x27')](function(){_0x38792b[_0xd15e('0x1e')](0xcc)[_0xd15e('0x28')]();});}};}function handleEntityNotFound(_0x1940f1,_0x52f69a){return function(_0x5eb662){if(!_0x5eb662){_0x1940f1[_0xd15e('0x1d')](0x194);}return _0x5eb662;};}function handleError(_0x1b0147,_0x230b6e){_0x230b6e=_0x230b6e||0x1f4;return function(_0x34592a){logger[_0xd15e('0x29')](_0x34592a['stack']);if(_0x34592a['name']){delete _0x34592a[_0xd15e('0x2a')];}_0x1b0147[_0xd15e('0x1e')](_0x230b6e)[_0xd15e('0x2b')](_0x34592a);};}exports[_0xd15e('0x2c')]=function(_0x721166,_0x380785){var _0x5bff13={},_0xc36a81={},_0xaaf0f0={'count':0x0,'rows':[]};var _0x3434d8=_['map'](db[_0xd15e('0x2d')][_0xd15e('0x2e')],function(_0x21bcb2){return{'name':_0x21bcb2['fieldName'],'type':_0x21bcb2[_0xd15e('0x2f')][_0xd15e('0x30')]};});_0xc36a81[_0xd15e('0x31')]=_[_0xd15e('0x32')](_0x3434d8,_0xd15e('0x2a'));_0xc36a81[_0xd15e('0x33')]=_[_0xd15e('0x34')](_0x721166['query']);_0xc36a81[_0xd15e('0x35')]=_[_0xd15e('0x36')](_0xc36a81[_0xd15e('0x31')],_0xc36a81[_0xd15e('0x33')]);_0x5bff13['attributes']=_[_0xd15e('0x36')](_0xc36a81[_0xd15e('0x31')],qs[_0xd15e('0x37')](_0x721166[_0xd15e('0x33')][_0xd15e('0x37')]));_0x5bff13['attributes']=_0x5bff13[_0xd15e('0x38')][_0xd15e('0x39')]?_0x5bff13[_0xd15e('0x38')]:_0xc36a81['model'];if(!_0x721166['query'][_0xd15e('0x3a')](_0xd15e('0x3b'))){_0x5bff13['limit']=qs[_0xd15e('0x21')](_0x721166['query'][_0xd15e('0x21')]);_0x5bff13['offset']=qs['offset'](_0x721166['query'][_0xd15e('0x1f')]);}_0x5bff13['order']=qs['sort'](_0x721166[_0xd15e('0x33')][_0xd15e('0x3c')]);_0x5bff13[_0xd15e('0x3d')]=qs[_0xd15e('0x35')](_['pick'](_0x721166[_0xd15e('0x33')],_0xc36a81['filters']),_0x3434d8);if(_0x721166['query'][_0xd15e('0x3e')]){_0x5bff13[_0xd15e('0x3d')]=_['merge'](_0x5bff13[_0xd15e('0x3d')],{'$or':_['map'](_0x3434d8,function(_0x39e37e){if(_0x39e37e[_0xd15e('0x2f')]!==_0xd15e('0x3f')){var _0x4f39a1={};_0x4f39a1[_0x39e37e[_0xd15e('0x2a')]]={'$like':'%'+_0x721166['query'][_0xd15e('0x3e')]+'%'};return _0x4f39a1;}})});}_0x5bff13=_[_0xd15e('0x40')]({},_0x5bff13,_0x721166[_0xd15e('0x41')]);var _0x5450e7={'where':_0x5bff13['where']};return db[_0xd15e('0x2d')][_0xd15e('0x42')](_0x5450e7)[_0xd15e('0x27')](function(_0x54094d){_0xaaf0f0[_0xd15e('0x42')]=_0x54094d;if(_0x721166[_0xd15e('0x33')][_0xd15e('0x43')]){_0x5bff13[_0xd15e('0x44')]=[{'all':!![]}];}return db[_0xd15e('0x2d')][_0xd15e('0x45')](_0x5bff13);})[_0xd15e('0x27')](function(_0x466caa){_0xaaf0f0['rows']=_0x466caa;return _0xaaf0f0;})[_0xd15e('0x27')](respondWithFilteredResult(_0x380785,_0x5bff13))['catch'](handleError(_0x380785,null));};exports[_0xd15e('0x46')]=function(_0x441c16,_0x576925){var _0x5e3b33={'raw':![],'where':{'id':_0x441c16['params']['id']}},_0x10c706={};_0x10c706[_0xd15e('0x31')]=_[_0xd15e('0x34')](db[_0xd15e('0x2d')][_0xd15e('0x2e')]);_0x10c706[_0xd15e('0x33')]=_[_0xd15e('0x34')](_0x441c16[_0xd15e('0x33')]);_0x10c706['filters']=_[_0xd15e('0x36')](_0x10c706[_0xd15e('0x31')],_0x10c706[_0xd15e('0x33')]);_0x5e3b33[_0xd15e('0x38')]=_[_0xd15e('0x36')](_0x10c706[_0xd15e('0x31')],qs[_0xd15e('0x37')](_0x441c16[_0xd15e('0x33')]['fields']));_0x5e3b33['attributes']=_0x5e3b33[_0xd15e('0x38')][_0xd15e('0x39')]?_0x5e3b33[_0xd15e('0x38')]:_0x10c706[_0xd15e('0x31')];if(_0x441c16[_0xd15e('0x33')][_0xd15e('0x43')]){_0x5e3b33['include']=[{'all':!![]}];}_0x5e3b33=_[_0xd15e('0x40')]({},_0x5e3b33,_0x441c16[_0xd15e('0x41')]);return db[_0xd15e('0x2d')][_0xd15e('0x47')](_0x5e3b33)[_0xd15e('0x27')](handleEntityNotFound(_0x576925,null))[_0xd15e('0x27')](respondWithResult(_0x576925,null))[_0xd15e('0x48')](handleError(_0x576925,null));};exports['create']=function(_0x1ae99f,_0x19cdaf){return db[_0xd15e('0x2d')][_0xd15e('0x49')](_0x1ae99f['body'],{})['then'](respondWithResult(_0x19cdaf,0xc9))[_0xd15e('0x48')](handleError(_0x19cdaf,null));};exports[_0xd15e('0x4a')]=function(_0xbddf97,_0x51e6dc){var _0x571ba1={'where':{'id':_0xbddf97['params']['id']}},_0x2e9e2c={};_0x2e9e2c[_0xd15e('0x31')]=_['keys'](db[_0xd15e('0x2d')]['rawAttributes']);_0x571ba1[_0xd15e('0x38')]=_[_0xd15e('0x36')](_0x2e9e2c['model'],qs[_0xd15e('0x37')](_0xbddf97['query'][_0xd15e('0x37')]));_0x571ba1[_0xd15e('0x38')]=_0x571ba1[_0xd15e('0x38')][_0xd15e('0x39')]?_0x571ba1[_0xd15e('0x38')]:_0x2e9e2c[_0xd15e('0x31')];if(_0xbddf97[_0xd15e('0x33')][_0xd15e('0x43')]){_0x571ba1[_0xd15e('0x44')]=[{'all':!![]}];}_0x571ba1=_['merge']({},_0x571ba1,_0xbddf97[_0xd15e('0x41')]);return db[_0xd15e('0x2d')][_0xd15e('0x47')](_0x571ba1)[_0xd15e('0x27')](handleEntityNotFound(_0x51e6dc,null))[_0xd15e('0x27')](function(_0x22a04f){if(_0x22a04f){var _0x231538=_0x22a04f[_0xd15e('0x4b')]({'plain':!![]});_0x231538=qs[_0xd15e('0x4c')](_0x231538,['id','createdAt',_0xd15e('0x4d'),_0xd15e('0x4e')]);_0xbddf97['body']=_[_0xd15e('0x4c')](_0xbddf97[_0xd15e('0x4f')],['id',_0xd15e('0x50'),_0xd15e('0x4d')]);return db[_0xd15e('0x51')][_0xd15e('0x52')](function(_0x5bc3c0){return db[_0xd15e('0x2d')][_0xd15e('0x49')](_['merge'](_0x231538,_0xbddf97[_0xd15e('0x4f')]),{'include':_0xbddf97[_0xd15e('0x33')][_0xd15e('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x5bc3c0})['then'](function(_0x29c317){var _0x4686fa=_0x29c317['get']({'plain':!![]});return db[_0xd15e('0x53')][_0xd15e('0x45')]({'where':{'userProfileId':_0xbddf97[_0xd15e('0x54')]['id']},'raw':!![]})[_0xd15e('0x27')](function(_0x494d7f){if(_0x494d7f){return BPromise[_0xd15e('0x55')](_0x494d7f,function(_0x44e8c5){return new BPromise(function(_0x3f0f20,_0x315c0f){if(_0x44e8c5['autoAssociation']===null||_0x44e8c5['autoAssociation']===0x1)_0x3f0f20(null);return db[_0xd15e('0x56')][_0xd15e('0x45')]({'where':{'sectionId':_0x44e8c5['id']},'raw':!![]})[_0xd15e('0x27')](function(_0x3f21b5){var _0x4242e3=_[_0xd15e('0x32')](_0x3f21b5,function(_0x5b50c8){return qs['omit'](_0x5b50c8,['id',_0xd15e('0x50'),'updatedAt','sectionId']);});_0x3f0f20(_0x4242e3);})[_0xd15e('0x48')](function(_0x388f0f){_0x315c0f(_0x388f0f);});})[_0xd15e('0x27')](function(_0x1ddf60){var _0x2c51b9=qs[_0xd15e('0x4c')](_0x44e8c5,['id',_0xd15e('0x50'),_0xd15e('0x4d')]);_0x2c51b9[_0xd15e('0x57')]=_0x4686fa['id'];if(_0x1ddf60)_0x2c51b9[_0xd15e('0x58')]=_0x1ddf60;return _0x2c51b9;})['then'](function(_0x1d0e56){return db[_0xd15e('0x53')][_0xd15e('0x49')](_0x1d0e56,{'include':[{'model':db[_0xd15e('0x56')],'as':_0xd15e('0x58')}],'raw':!![],'transaction':_0x5bc3c0});});})[_0xd15e('0x27')](function(){return _0x4686fa;});}});});});}})[_0xd15e('0x27')](respondWithResult(_0x51e6dc,0xc9))['catch'](handleError(_0x51e6dc,null));};exports[_0xd15e('0x59')]=function(_0x1da3b0,_0x3c018a){if(_0x1da3b0[_0xd15e('0x4f')]['id']){delete _0x1da3b0[_0xd15e('0x4f')]['id'];}return db[_0xd15e('0x2d')][_0xd15e('0x47')]({'where':{'id':_0x1da3b0[_0xd15e('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c018a,null))[_0xd15e('0x27')](saveUpdates(_0x1da3b0[_0xd15e('0x4f')],null))[_0xd15e('0x27')](respondWithResult(_0x3c018a,null))[_0xd15e('0x48')](handleError(_0x3c018a,null));};exports['destroy']=function(_0x1451be,_0x1a4f84){return db[_0xd15e('0x2d')][_0xd15e('0x47')]({'where':{'id':_0x1451be[_0xd15e('0x54')]['id']}})[_0xd15e('0x27')](handleEntityNotFound(_0x1a4f84,null))[_0xd15e('0x27')](removeEntity(_0x1a4f84,null))[_0xd15e('0x48')](handleError(_0x1a4f84,null));};exports[_0xd15e('0x5a')]=function(_0x310f2e,_0x31131b){return db[_0xd15e('0x2d')]['describe']()[_0xd15e('0x27')](respondWithResult(_0x31131b,null))['catch'](handleError(_0x31131b,null));};exports['addSections']=function(_0x1f0da,_0x4ebd8d){var _0x42a9e3=_0x1f0da[_0xd15e('0x4f')];return db[_0xd15e('0x2d')]['find']({'where':{'id':_0x1f0da[_0xd15e('0x54')]['id']}})[_0xd15e('0x27')](handleEntityNotFound(_0x4ebd8d,null))[_0xd15e('0x27')](function(_0x625307){if(_0x625307){return db[_0xd15e('0x51')]['transaction'](function(_0x28397b){return db['UserProfileSection'][_0xd15e('0x5b')]({'where':{'userProfileId':_0x1f0da[_0xd15e('0x54')]['id'],'sectionId':_[_0xd15e('0x32')](_0x42a9e3,function(_0x8677c4){return _0x8677c4[_0xd15e('0x5c')];})},'transaction':_0x28397b})[_0xd15e('0x27')](function(){var _0x169949=_[_0xd15e('0x32')](_0x42a9e3,function(_0x2f1d96){_0x2f1d96[_0xd15e('0x57')]=_0x1f0da[_0xd15e('0x54')]['id'];return _0x2f1d96;});var _0x546ab5=[];return BPromise[_0xd15e('0x55')](_0x169949,function(_0x2f9328){return db[_0xd15e('0x53')]['create'](_0x2f9328,{'include':[{'model':db[_0xd15e('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x28397b})[_0xd15e('0x27')](function(_0x3d12a9){_0x546ab5[_0xd15e('0x5d')](_0x3d12a9[_0xd15e('0x4b')]({'plain':!![]}));});})[_0xd15e('0x27')](function(){return _0x546ab5;});});});}})[_0xd15e('0x27')](function(_0x107b06){return _0x107b06;})[_0xd15e('0x27')](respondWithResult(_0x4ebd8d,null))['catch'](handleError(_0x4ebd8d,null));};exports['removeSections']=function(_0x16dc33,_0x513783){var _0x1a2b33;return db[_0xd15e('0x2d')][_0xd15e('0x47')]({'where':{'id':_0x16dc33[_0xd15e('0x54')]['id']},'attributes':['id','name']})[_0xd15e('0x27')](handleEntityNotFound(_0x513783,null))['then'](function(_0x327127){if(_0x327127){_0x1a2b33=_0x327127;return db[_0xd15e('0x53')][_0xd15e('0x5b')]({'where':{'userProfileId':_0x16dc33[_0xd15e('0x54')]['id'],'sectionId':_0x16dc33[_0xd15e('0x33')][_0xd15e('0x5e')]}});}})['then'](function(){return _0x1a2b33;})[_0xd15e('0x27')](respondWithStatusCode(_0x513783,null))['catch'](handleError(_0x513783,null));};exports['getSections']=function(_0x16d248,_0x50ddc5){var _0x46d08a=[];var _0x26587c=[];return db[_0xd15e('0x53')][_0xd15e('0x45')]({'where':{'userProfileId':_0x16d248[_0xd15e('0x54')]['id']},'raw':!![]})[_0xd15e('0x27')](function(_0x38af23){_0x46d08a=_['filter'](_0x38af23,function(_0x2f9520){return _0x2f9520['enabled']===0x1||_['includes']([0x3eb,0x709],_0x2f9520['sectionId']);});if(!_[_0xd15e('0x5f')](_0x46d08a)){return _['map'](_0x46d08a,function(_0x296119){return _0x296119[_0xd15e('0x5c')];});}else{return;}})[_0xd15e('0x27')](function(_0x267582){if(_0x267582)_0x26587c=_0x267582;if(_[_0xd15e('0x60')](_0x26587c,0x64)){var _0x57d03d=_[_0xd15e('0x47')](_0x46d08a,{'sectionId':0x64});return hasDefaultDashboard(_0x57d03d)[_0xd15e('0x27')](function(_0x2ccc1b){return _[_0xd15e('0x32')](_0x46d08a,function(_0x44ec68){if(_0x44ec68[_0xd15e('0x5c')]===0x64){_0x44ec68[_0xd15e('0x61')]=_0x2ccc1b;}return _0x44ec68;});});}else{return;}})[_0xd15e('0x27')](function(_0x2842d5){if(_0x2842d5)_0x46d08a=_0x2842d5;if(_[_0xd15e('0x60')](_0x26587c,0x3eb)){var _0x819e29=_[_0xd15e('0x47')](_0x46d08a,{'sectionId':0x3eb});return getCustomDashboards(_0x819e29)['then'](function(_0x2cc888){return _['map'](_0x46d08a,function(_0x2fe91d){if(_0x819e29[_0xd15e('0x62')]){if(_0x2fe91d[_0xd15e('0x5c')]===0x3eb){_0x2fe91d[_0xd15e('0x61')]=_0x2cc888;}}else{if(_0x2fe91d[_0xd15e('0x5c')]===0x64){if(!_0x2fe91d['subsections']){_0x2fe91d['subsections']=[];}_0x2fe91d['subsections']=_0x2fe91d[_0xd15e('0x61')][_0xd15e('0x63')](_0x2cc888);}}return _0x2fe91d;});});}else{return;}})[_0xd15e('0x27')](function(_0xc32813){if(_0xc32813)_0x46d08a=_0xc32813;if(_[_0xd15e('0x60')](_0x26587c,0x709)){var _0x4f920a=_[_0xd15e('0x47')](_0x46d08a,{'sectionId':0x709});return getPlugins(_0x4f920a)[_0xd15e('0x27')](function(_0x2aa130){if(_0x4f920a[_0xd15e('0x62')]){return _[_0xd15e('0x32')](_0x46d08a,function(_0x326b4){if(_0x326b4[_0xd15e('0x5c')]===0x709){_0x326b4[_0xd15e('0x61')]=_0x2aa130;}return _0x326b4;});}else{var _0x405367={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2aa130};var _0x10874e=_[_0xd15e('0x32')](_0x46d08a);_0x10874e[_0xd15e('0x5d')](_0x405367);return _0x10874e;}});}else{return;}})[_0xd15e('0x27')](function(_0x3cd595){if(_0x3cd595)_0x46d08a=_0x3cd595;return _['filter'](_0x46d08a,[_0xd15e('0x62'),0x1]);})[_0xd15e('0x27')](respondWithResult(_0x50ddc5,null))[_0xd15e('0x48')](handleError(_0x50ddc5,null));};function hasDefaultDashboard(_0xe5b5da){var _0x3e817a=[0x65];return new BPromise(function(_0x5cd266,_0x3ec9f4){try{if(_0xe5b5da[_0xd15e('0x64')]){_0x5cd266(_0x3e817a);}else{return db[_0xd15e('0x56')][_0xd15e('0x65')]({'where':{'sectionId':_0xe5b5da['id']},'raw':!![]})[_0xd15e('0x27')](function(_0x596d4d){_0x596d4d?_0x5cd266(_0x3e817a):_0x5cd266();});}}catch(_0x4f725e){_0x3ec9f4(_0x4f725e);}});}function getCustomDashboards(_0x9d7452){var _0x3135be=[];return new BPromise(function(_0x29a457,_0x2083d4){try{if(_0x9d7452['autoAssociation']){return db[_0xd15e('0x66')][_0xd15e('0x45')]({'raw':!![]})[_0xd15e('0x27')](function(_0x4cbcb7){_0x4cbcb7['forEach'](function(_0x3e031a){_0x3135be['push'](_0x3e031a['id']+0x1869f);});_0x29a457(_0x3135be);});}else{return db[_0xd15e('0x56')]['findAll']({'where':{'sectionId':_0x9d7452['id']},'raw':!![]})['then'](function(_0x55b2f7){_0x55b2f7[_0xd15e('0x67')](function(_0x1b66dd){_0x3135be['push'](_0x1b66dd[_0xd15e('0x68')]+0x1869f);});_0x29a457(_0x3135be);});}}catch(_0x1ab963){_0x2083d4(_0x1ab963);}});}function getPlugins(_0x4557b2){var _0x593918=[];return new BPromise(function(_0xc78504,_0x16a3f6){try{if(_0x4557b2[_0xd15e('0x64')]){return db[_0xd15e('0x69')]['findAll']({'raw':!![]})[_0xd15e('0x27')](function(_0x1a7fbb){_0x1a7fbb['forEach'](function(_0x18faeb){_0x593918[_0xd15e('0x5d')](_0x18faeb['id']+0x15b38);});_0xc78504(_0x593918);});}else{return db[_0xd15e('0x56')][_0xd15e('0x45')]({'where':{'sectionId':_0x4557b2['id']},'raw':!![]})[_0xd15e('0x27')](function(_0x580675){_0x580675[_0xd15e('0x67')](function(_0x2bddb1){_0x593918[_0xd15e('0x5d')](_0x2bddb1['resourceId']+0x15b38);});_0xc78504(_0x593918);});}}catch(_0xee7adb){_0x16a3f6(_0xee7adb);}});}exports[_0xd15e('0x6a')]=function(_0x42bbdb,_0x3a34e1){return db[_0xd15e('0x2d')][_0xd15e('0x47')]({'where':{'id':_0x42bbdb['params']['id']}})[_0xd15e('0x27')](handleEntityNotFound(_0x3a34e1,null))[_0xd15e('0x27')](function(_0x549675){if(_0x549675){return db['sequelize'][_0xd15e('0x52')](function(_0x33043f){return db['UserProfileSection'][_0xd15e('0x45')]({'where':{'userProfileId':_0x42bbdb['params']['id']},'attributes':['id'],'raw':!![]})[_0xd15e('0x27')](function(_0x53b628){if(_0x53b628){return db[_0xd15e('0x53')][_0xd15e('0x5b')]({'where':{'userProfileId':_0x42bbdb[_0xd15e('0x54')]['id'],'id':_[_0xd15e('0x32')](_0x53b628,function(_0x17c77c){return _0x17c77c['id'];})},'transaction':_0x33043f});}})[_0xd15e('0x27')](function(_0x4d7d03){var _0x47304b=_[_0xd15e('0x32')](_0x42bbdb[_0xd15e('0x4f')],function(_0x43a1db){_0x43a1db['userProfileId']=_0x42bbdb['params']['id'];return _0x43a1db;});return db[_0xd15e('0x53')][_0xd15e('0x6b')](_0x47304b,{'raw':!![],'transaction':_0x33043f});})[_0xd15e('0x27')](function(_0x2fcf6f){var _0x2955fa=_[_0xd15e('0x3e')](_[_0xd15e('0x32')](_0x2fcf6f,function(_0x546e49){return _0x546e49['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2955fa){return db[_0xd15e('0x53')]['findAll']({'where':{'userProfileId':_0x42bbdb[_0xd15e('0x54')]['id'],'sectionId':_[_0xd15e('0x32')](_0x2955fa,function(_0x11b883){return _0x11b883[_0xd15e('0x5c')];})},'attributes':['id',_0xd15e('0x5c')],'raw':!![]})[_0xd15e('0x27')](function(_0x14f5c8){var _0x16c762=_[_0xd15e('0x32')](_0x42bbdb['body'],function(_0x5539a7){_0x5539a7[_0xd15e('0x57')]=_0x42bbdb[_0xd15e('0x54')]['id'];return _0x5539a7;});return db[_0xd15e('0x56')][_0xd15e('0x6b')](_0x16c762,{'raw':!![],'transaction':_0x33043f});});}})[_0xd15e('0x48')](handleError(_0x3a34e1,null));});}})['then'](function(_0x4c9899){var _0x5716c8=_[_0xd15e('0x32')](_0x4c9899,function(_0x1f15b8){return _0x1f15b8[_0xd15e('0x4b')]({'plain':!![]});});})[_0xd15e('0x27')](respondWithResult(_0x3a34e1,null))[_0xd15e('0x48')](handleError(_0x3a34e1,null));};exports['removeResources']=function(_0x26ccf3,_0x482f59,_0x4cc9a0){return db[_0xd15e('0x2d')][_0xd15e('0x47')]({'where':{'id':_0x26ccf3[_0xd15e('0x54')]['id']}})[_0xd15e('0x27')](handleEntityNotFound(_0x482f59,null))[_0xd15e('0x27')](function(_0x2879e3){if(_0x2879e3){return _0x2879e3[_0xd15e('0x6c')](_0x26ccf3[_0xd15e('0x33')]['ids']);}})[_0xd15e('0x27')](respondWithStatusCode(_0x482f59,null))[_0xd15e('0x48')](handleError(_0x482f59,null));};exports[_0xd15e('0x6d')]=function(_0x411197,_0x4a6a44){var _0x50f973={};if(!_0x411197[_0xd15e('0x33')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x411197[_0xd15e('0x33')][_0xd15e('0x3a')](_0xd15e('0x3b'))){_0x50f973[_0xd15e('0x21')]=qs[_0xd15e('0x21')](_0x411197[_0xd15e('0x33')][_0xd15e('0x21')]);_0x50f973[_0xd15e('0x1f')]=qs[_0xd15e('0x1f')](_0x411197['query'][_0xd15e('0x1f')]);}return db['UserProfile'][_0xd15e('0x47')]({'where':{'id':_0x411197[_0xd15e('0x54')]['id']}})[_0xd15e('0x27')](function(_0x3a54d2){if(!_0x3a54d2)throw new Error(_0xd15e('0x6e')+_0x411197['params']['id']);return db['UserProfile'][_0xd15e('0x6d')](_0x411197);})[_0xd15e('0x27')](respondWithFilteredResult(_0x4a6a44,_0x50f973))['catch'](handleError(_0x4a6a44,null));}; \ No newline at end of file +var _0xe51c=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','map','options','UserProfile','includeAll','include','then','catch','params','length','find','create','body','clone','get','updatedAt','crudPermissions','omit','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','transaction','sectionId','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','push','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto'];(function(_0x3dde3a,_0x5345be){var _0x3f934a=function(_0x482f15){while(--_0x482f15){_0x3dde3a['push'](_0x3dde3a['shift']());}};_0x3f934a(++_0x5345be);}(_0xe51c,0x143));var _0xce51=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0xe51c[_0x5613de];return _0x5b40cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce51('0x0'));var zipdir=require(_0xce51('0x1'));var jsonpatch=require(_0xce51('0x2'));var rp=require(_0xce51('0x3'));var moment=require(_0xce51('0x4'));var BPromise=require(_0xce51('0x5'));var Mustache=require(_0xce51('0x6'));var util=require(_0xce51('0x7'));var path=require(_0xce51('0x8'));var sox=require('sox');var csv=require(_0xce51('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce51('0xa'));var _=require(_0xce51('0xb'));var squel=require('squel');var crypto=require(_0xce51('0xc'));var jsforce=require(_0xce51('0xd'));var deskjs=require(_0xce51('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce51('0xf'));var Papa=require(_0xce51('0x10'));var Redis=require('ioredis');var authService=require(_0xce51('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce51('0x12'));var hardwareService=require(_0xce51('0x13'));var logger=require(_0xce51('0x14'))(_0xce51('0x15'));var utils=require('../../config/utils');var config=require(_0xce51('0x16'));var licenseUtil=require(_0xce51('0x17'));var db=require(_0xce51('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xce51('0x19'),'port':0x18eb});var socket=require(_0xce51('0x1a'))(new Redis(config['redis']));require(_0xce51('0x1b'))[_0xce51('0x1c')](socket);function respondWithStatusCode(_0x55cafe,_0x56a312){_0x56a312=_0x56a312||0xcc;return function(_0x110a58){if(_0x110a58){return _0x55cafe['sendStatus'](_0x56a312);}return _0x55cafe[_0xce51('0x1d')](_0x56a312)[_0xce51('0x1e')]();};}function respondWithResult(_0x3339b1,_0x378620){_0x378620=_0x378620||0xc8;return function(_0x4a7c15){if(_0x4a7c15){return _0x3339b1['status'](_0x378620)[_0xce51('0x1f')](_0x4a7c15);}};}function respondWithFilteredResult(_0x4c5010,_0x12f332){return function(_0x18360d){if(_0x18360d){var _0x863fd6=typeof _0x12f332['offset']==='undefined'&&typeof _0x12f332[_0xce51('0x20')]===_0xce51('0x21');var _0x2918af=_0x18360d[_0xce51('0x22')];var _0x2c71bf=_0x863fd6?0x0:_0x12f332[_0xce51('0x23')];var _0x2d9508=_0x863fd6?_0x18360d['count']:_0x12f332[_0xce51('0x23')]+_0x12f332[_0xce51('0x20')];var _0xa884f2;if(_0x2d9508>=_0x2918af){_0x2d9508=_0x2918af;_0xa884f2=0xc8;}else{_0xa884f2=0xce;}_0x4c5010[_0xce51('0x1d')](_0xa884f2);return _0x4c5010[_0xce51('0x24')](_0xce51('0x25'),_0x2c71bf+'-'+_0x2d9508+'/'+_0x2918af)[_0xce51('0x1f')](_0x18360d);}return null;};}function patchUpdates(_0x311823){return function(_0x2aebe6){try{jsonpatch[_0xce51('0x26')](_0x2aebe6,_0x311823,!![]);}catch(_0x3e4677){return BPromise[_0xce51('0x27')](_0x3e4677);}return _0x2aebe6[_0xce51('0x28')]();};}function saveUpdates(_0x3404ad,_0x4dc723){return function(_0x3463f9){if(_0x3463f9){return _0x3463f9[_0xce51('0x29')](_0x3404ad)['then'](function(_0x24fba8){return _0x24fba8;});}return null;};}function removeEntity(_0x45e1ca,_0x1c82c5){return function(_0x1e8abb){if(_0x1e8abb){return _0x1e8abb[_0xce51('0x2a')]()['then'](function(){_0x45e1ca[_0xce51('0x1d')](0xcc)[_0xce51('0x1e')]();});}};}function handleEntityNotFound(_0x10a352,_0x456c0c){return function(_0x19a3be){if(!_0x19a3be){_0x10a352[_0xce51('0x2b')](0x194);}return _0x19a3be;};}function handleError(_0x1dddab,_0x101114){_0x101114=_0x101114||0x1f4;return function(_0x543297){logger[_0xce51('0x2c')](_0x543297[_0xce51('0x2d')]);if(_0x543297[_0xce51('0x2e')]){delete _0x543297[_0xce51('0x2e')];}_0x1dddab['status'](_0x101114)[_0xce51('0x2f')](_0x543297);};}exports['index']=function(_0xb19cf,_0x492848){var _0x18f09a={},_0x4a6983={},_0x3eaf44={'count':0x0,'rows':[]};var _0x102168=_['map'](db['UserProfile'][_0xce51('0x30')],function(_0x33a638){return{'name':_0x33a638[_0xce51('0x31')],'type':_0x33a638['type'][_0xce51('0x32')]};});_0x4a6983[_0xce51('0x33')]=_['map'](_0x102168,'name');_0x4a6983[_0xce51('0x34')]=_[_0xce51('0x35')](_0xb19cf[_0xce51('0x34')]);_0x4a6983[_0xce51('0x36')]=_[_0xce51('0x37')](_0x4a6983['model'],_0x4a6983[_0xce51('0x34')]);_0x18f09a[_0xce51('0x38')]=_[_0xce51('0x37')](_0x4a6983[_0xce51('0x33')],qs[_0xce51('0x39')](_0xb19cf[_0xce51('0x34')][_0xce51('0x39')]));_0x18f09a['attributes']=_0x18f09a[_0xce51('0x38')]['length']?_0x18f09a[_0xce51('0x38')]:_0x4a6983[_0xce51('0x33')];if(!_0xb19cf[_0xce51('0x34')][_0xce51('0x3a')]('nolimit')){_0x18f09a[_0xce51('0x20')]=qs['limit'](_0xb19cf[_0xce51('0x34')][_0xce51('0x20')]);_0x18f09a[_0xce51('0x23')]=qs['offset'](_0xb19cf[_0xce51('0x34')][_0xce51('0x23')]);}_0x18f09a[_0xce51('0x3b')]=qs[_0xce51('0x3c')](_0xb19cf[_0xce51('0x34')][_0xce51('0x3c')]);_0x18f09a['where']=qs[_0xce51('0x36')](_['pick'](_0xb19cf[_0xce51('0x34')],_0x4a6983[_0xce51('0x36')]),_0x102168);if(_0xb19cf[_0xce51('0x34')][_0xce51('0x3d')]){_0x18f09a[_0xce51('0x3e')]=_[_0xce51('0x3f')](_0x18f09a[_0xce51('0x3e')],{'$or':_[_0xce51('0x40')](_0x102168,function(_0x2a7b84){if(_0x2a7b84['type']!=='VIRTUAL'){var _0x41a73b={};_0x41a73b[_0x2a7b84[_0xce51('0x2e')]]={'$like':'%'+_0xb19cf[_0xce51('0x34')][_0xce51('0x3d')]+'%'};return _0x41a73b;}})});}_0x18f09a=_[_0xce51('0x3f')]({},_0x18f09a,_0xb19cf[_0xce51('0x41')]);var _0x255b9d={'where':_0x18f09a[_0xce51('0x3e')]};return db[_0xce51('0x42')][_0xce51('0x22')](_0x255b9d)['then'](function(_0x5e51dc){_0x3eaf44[_0xce51('0x22')]=_0x5e51dc;if(_0xb19cf[_0xce51('0x34')][_0xce51('0x43')]){_0x18f09a[_0xce51('0x44')]=[{'all':!![]}];}return db[_0xce51('0x42')]['findAll'](_0x18f09a);})[_0xce51('0x45')](function(_0x2c354c){_0x3eaf44['rows']=_0x2c354c;return _0x3eaf44;})[_0xce51('0x45')](respondWithFilteredResult(_0x492848,_0x18f09a))[_0xce51('0x46')](handleError(_0x492848,null));};exports['show']=function(_0x5407f0,_0x1a6308){var _0x51d65c={'raw':![],'where':{'id':_0x5407f0[_0xce51('0x47')]['id']}},_0x2b71a9={};_0x2b71a9['model']=_[_0xce51('0x35')](db[_0xce51('0x42')][_0xce51('0x30')]);_0x2b71a9[_0xce51('0x34')]=_[_0xce51('0x35')](_0x5407f0[_0xce51('0x34')]);_0x2b71a9[_0xce51('0x36')]=_['intersection'](_0x2b71a9[_0xce51('0x33')],_0x2b71a9[_0xce51('0x34')]);_0x51d65c[_0xce51('0x38')]=_[_0xce51('0x37')](_0x2b71a9['model'],qs[_0xce51('0x39')](_0x5407f0['query'][_0xce51('0x39')]));_0x51d65c[_0xce51('0x38')]=_0x51d65c['attributes'][_0xce51('0x48')]?_0x51d65c[_0xce51('0x38')]:_0x2b71a9['model'];if(_0x5407f0[_0xce51('0x34')][_0xce51('0x43')]){_0x51d65c[_0xce51('0x44')]=[{'all':!![]}];}_0x51d65c=_['merge']({},_0x51d65c,_0x5407f0[_0xce51('0x41')]);return db[_0xce51('0x42')][_0xce51('0x49')](_0x51d65c)['then'](handleEntityNotFound(_0x1a6308,null))[_0xce51('0x45')](respondWithResult(_0x1a6308,null))[_0xce51('0x46')](handleError(_0x1a6308,null));};exports[_0xce51('0x4a')]=function(_0x3b72b6,_0x530f98){return db[_0xce51('0x42')][_0xce51('0x4a')](_0x3b72b6[_0xce51('0x4b')],{})[_0xce51('0x45')](respondWithResult(_0x530f98,0xc9))[_0xce51('0x46')](handleError(_0x530f98,null));};exports[_0xce51('0x4c')]=function(_0x206c15,_0x48fd0e){var _0x2179d7={'where':{'id':_0x206c15['params']['id']}},_0x2c5c61={};_0x2c5c61[_0xce51('0x33')]=_[_0xce51('0x35')](db[_0xce51('0x42')][_0xce51('0x30')]);_0x2179d7[_0xce51('0x38')]=_[_0xce51('0x37')](_0x2c5c61['model'],qs[_0xce51('0x39')](_0x206c15[_0xce51('0x34')][_0xce51('0x39')]));_0x2179d7['attributes']=_0x2179d7['attributes'][_0xce51('0x48')]?_0x2179d7[_0xce51('0x38')]:_0x2c5c61['model'];if(_0x206c15['query'][_0xce51('0x43')]){_0x2179d7[_0xce51('0x44')]=[{'all':!![]}];}_0x2179d7=_[_0xce51('0x3f')]({},_0x2179d7,_0x206c15[_0xce51('0x41')]);return db[_0xce51('0x42')][_0xce51('0x49')](_0x2179d7)[_0xce51('0x45')](handleEntityNotFound(_0x48fd0e,null))[_0xce51('0x45')](function(_0x5c4935){if(_0x5c4935){var _0x4d488b=_0x5c4935[_0xce51('0x4d')]({'plain':!![]});_0x4d488b=qs['omit'](_0x4d488b,['id','createdAt',_0xce51('0x4e'),_0xce51('0x4f')]);_0x206c15['body']=_[_0xce51('0x50')](_0x206c15[_0xce51('0x4b')],['id',_0xce51('0x51'),'updatedAt']);return db[_0xce51('0x52')]['transaction'](function(_0x43ae66){return db['UserProfile']['create'](_[_0xce51('0x3f')](_0x4d488b,_0x206c15[_0xce51('0x4b')]),{'include':_0x206c15[_0xce51('0x34')][_0xce51('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x43ae66})['then'](function(_0x4bcb79){var _0x5d96c6=_0x4bcb79['get']({'plain':!![]});return db[_0xce51('0x53')][_0xce51('0x54')]({'where':{'userProfileId':_0x206c15[_0xce51('0x47')]['id']},'raw':!![]})[_0xce51('0x45')](function(_0x230772){if(_0x230772){return BPromise[_0xce51('0x55')](_0x230772,function(_0x3f8d49){return new BPromise(function(_0x5153e2,_0x2e080f){if(_0x3f8d49[_0xce51('0x56')]===null||_0x3f8d49[_0xce51('0x56')]===0x1)_0x5153e2(null);return db[_0xce51('0x57')][_0xce51('0x54')]({'where':{'sectionId':_0x3f8d49['id']},'raw':!![]})[_0xce51('0x45')](function(_0x15ea73){var _0x2ff5d0=_[_0xce51('0x40')](_0x15ea73,function(_0x4fe86c){return qs[_0xce51('0x50')](_0x4fe86c,['id',_0xce51('0x51'),_0xce51('0x4e'),'sectionId']);});_0x5153e2(_0x2ff5d0);})[_0xce51('0x46')](function(_0x324eb6){_0x2e080f(_0x324eb6);});})[_0xce51('0x45')](function(_0x2c058f){var _0x33809b=qs[_0xce51('0x50')](_0x3f8d49,['id',_0xce51('0x51'),_0xce51('0x4e')]);_0x33809b[_0xce51('0x58')]=_0x5d96c6['id'];if(_0x2c058f)_0x33809b['Resources']=_0x2c058f;return _0x33809b;})[_0xce51('0x45')](function(_0x4cb1c3){return db[_0xce51('0x53')][_0xce51('0x4a')](_0x4cb1c3,{'include':[{'model':db[_0xce51('0x57')],'as':_0xce51('0x59')}],'raw':!![],'transaction':_0x43ae66});});})[_0xce51('0x45')](function(){return _0x5d96c6;});}});});});}})[_0xce51('0x45')](respondWithResult(_0x48fd0e,0xc9))[_0xce51('0x46')](handleError(_0x48fd0e,null));};exports[_0xce51('0x29')]=function(_0x5c5701,_0x20f58e){if(_0x5c5701[_0xce51('0x4b')]['id']){delete _0x5c5701[_0xce51('0x4b')]['id'];}return db['UserProfile'][_0xce51('0x49')]({'where':{'id':_0x5c5701[_0xce51('0x47')]['id']}})[_0xce51('0x45')](handleEntityNotFound(_0x20f58e,null))['then'](saveUpdates(_0x5c5701[_0xce51('0x4b')],null))[_0xce51('0x45')](respondWithResult(_0x20f58e,null))[_0xce51('0x46')](handleError(_0x20f58e,null));};exports[_0xce51('0x2a')]=function(_0x5edc0f,_0x4b2ced){return db[_0xce51('0x42')][_0xce51('0x49')]({'where':{'id':_0x5edc0f[_0xce51('0x47')]['id']}})[_0xce51('0x45')](handleEntityNotFound(_0x4b2ced,null))[_0xce51('0x45')](removeEntity(_0x4b2ced,null))[_0xce51('0x46')](handleError(_0x4b2ced,null));};exports[_0xce51('0x5a')]=function(_0x5d045d,_0x4f6f9f){return db['UserProfile'][_0xce51('0x5a')]()[_0xce51('0x45')](respondWithResult(_0x4f6f9f,null))[_0xce51('0x46')](handleError(_0x4f6f9f,null));};exports[_0xce51('0x5b')]=function(_0x267eba,_0x5d530f){var _0x500edd=_0x267eba[_0xce51('0x4b')];return db[_0xce51('0x42')]['find']({'where':{'id':_0x267eba[_0xce51('0x47')]['id']}})[_0xce51('0x45')](handleEntityNotFound(_0x5d530f,null))['then'](function(_0x27c0a0){if(_0x27c0a0){return db['sequelize'][_0xce51('0x5c')](function(_0x38f808){return db[_0xce51('0x53')][_0xce51('0x2a')]({'where':{'userProfileId':_0x267eba[_0xce51('0x47')]['id'],'sectionId':_['map'](_0x500edd,function(_0x377007){return _0x377007[_0xce51('0x5d')];})},'transaction':_0x38f808})[_0xce51('0x45')](function(){var _0x312799=_[_0xce51('0x40')](_0x500edd,function(_0x3d1deb){_0x3d1deb['userProfileId']=_0x267eba[_0xce51('0x47')]['id'];return _0x3d1deb;});var _0x111a24=[];return BPromise[_0xce51('0x55')](_0x312799,function(_0x1e5cfd){return db[_0xce51('0x53')]['create'](_0x1e5cfd,{'include':[{'model':db[_0xce51('0x57')],'as':_0xce51('0x59')}],'raw':!![],'transaction':_0x38f808})[_0xce51('0x45')](function(_0xaeb8c4){_0x111a24['push'](_0xaeb8c4[_0xce51('0x4d')]({'plain':!![]}));});})[_0xce51('0x45')](function(){return _0x111a24;});});});}})[_0xce51('0x45')](function(_0x41e97a){return _0x41e97a;})['then'](respondWithResult(_0x5d530f,null))[_0xce51('0x46')](handleError(_0x5d530f,null));};exports['removeSections']=function(_0x27041e,_0x575d53){var _0x2e3aec;return db[_0xce51('0x42')][_0xce51('0x49')]({'where':{'id':_0x27041e[_0xce51('0x47')]['id']},'attributes':['id',_0xce51('0x2e')]})[_0xce51('0x45')](handleEntityNotFound(_0x575d53,null))[_0xce51('0x45')](function(_0x58270f){if(_0x58270f){_0x2e3aec=_0x58270f;return db[_0xce51('0x53')][_0xce51('0x2a')]({'where':{'userProfileId':_0x27041e[_0xce51('0x47')]['id'],'sectionId':_0x27041e[_0xce51('0x34')][_0xce51('0x5e')]}});}})[_0xce51('0x45')](function(){return _0x2e3aec;})['then'](respondWithStatusCode(_0x575d53,null))['catch'](handleError(_0x575d53,null));};exports[_0xce51('0x5f')]=function(_0x12fdca,_0x5e0dbb){var _0xad84=[];var _0x3b53b4=[];return db[_0xce51('0x53')][_0xce51('0x54')]({'where':{'userProfileId':_0x12fdca[_0xce51('0x47')]['id']},'raw':!![]})[_0xce51('0x45')](function(_0x5952bf){_0xad84=_['filter'](_0x5952bf,function(_0x21f51b){return _0x21f51b[_0xce51('0x60')]===0x1||_[_0xce51('0x61')]([0x3eb,0x709],_0x21f51b[_0xce51('0x5d')]);});if(!_[_0xce51('0x62')](_0xad84)){return _['map'](_0xad84,function(_0x3808af){return _0x3808af[_0xce51('0x5d')];});}else{return;}})[_0xce51('0x45')](function(_0x5f37e1){if(_0x5f37e1)_0x3b53b4=_0x5f37e1;if(_[_0xce51('0x61')](_0x3b53b4,0x64)){var _0x3e3304=_['find'](_0xad84,{'sectionId':0x64});return hasDefaultDashboard(_0x3e3304)[_0xce51('0x45')](function(_0x59c70b){return _['map'](_0xad84,function(_0x1e7426){if(_0x1e7426[_0xce51('0x5d')]===0x64){_0x1e7426[_0xce51('0x63')]=_0x59c70b;}return _0x1e7426;});});}else{return;}})[_0xce51('0x45')](function(_0x3ad257){if(_0x3ad257)_0xad84=_0x3ad257;if(_['includes'](_0x3b53b4,0x3eb)){var _0xdcb8a9=_[_0xce51('0x49')](_0xad84,{'sectionId':0x3eb});return getCustomDashboards(_0xdcb8a9)[_0xce51('0x45')](function(_0x371a6b){return _[_0xce51('0x40')](_0xad84,function(_0x3115fc){if(_0xdcb8a9[_0xce51('0x60')]){if(_0x3115fc[_0xce51('0x5d')]===0x3eb){_0x3115fc[_0xce51('0x63')]=_0x371a6b;}}else{if(_0x3115fc[_0xce51('0x5d')]===0x64){if(!_0x3115fc[_0xce51('0x63')]){_0x3115fc[_0xce51('0x63')]=[];}_0x3115fc[_0xce51('0x63')]=_0x3115fc['subsections']['concat'](_0x371a6b);}}return _0x3115fc;});});}else{return;}})[_0xce51('0x45')](function(_0x5d65f9){if(_0x5d65f9)_0xad84=_0x5d65f9;if(_['includes'](_0x3b53b4,0x709)){var _0x53a45b=_[_0xce51('0x49')](_0xad84,{'sectionId':0x709});return getPlugins(_0x53a45b)[_0xce51('0x45')](function(_0x3d3e5b){if(_0x53a45b['enabled']){return _[_0xce51('0x40')](_0xad84,function(_0x3098c6){if(_0x3098c6['sectionId']===0x709){_0x3098c6[_0xce51('0x63')]=_0x3d3e5b;}return _0x3098c6;});}else{var _0x345192={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3d3e5b};var _0x55755e=_[_0xce51('0x40')](_0xad84);_0x55755e['push'](_0x345192);return _0x55755e;}});}else{return;}})[_0xce51('0x45')](function(_0x92976d){if(_0x92976d)_0xad84=_0x92976d;return _['filter'](_0xad84,[_0xce51('0x60'),0x1]);})[_0xce51('0x45')](respondWithResult(_0x5e0dbb,null))['catch'](handleError(_0x5e0dbb,null));};function hasDefaultDashboard(_0x4b2058){var _0x3239e0=[0x65];return new BPromise(function(_0x483b91,_0x3cb0ed){try{if(_0x4b2058[_0xce51('0x56')]){_0x483b91(_0x3239e0);}else{return db[_0xce51('0x57')]['findOne']({'where':{'sectionId':_0x4b2058['id']},'raw':!![]})[_0xce51('0x45')](function(_0x37e207){_0x37e207?_0x483b91(_0x3239e0):_0x483b91();});}}catch(_0x412e75){_0x3cb0ed(_0x412e75);}});}function getCustomDashboards(_0x909337){var _0x2930b4=[];return new BPromise(function(_0x36b00c,_0x1c6108){try{if(_0x909337['autoAssociation']){return db[_0xce51('0x64')][_0xce51('0x54')]({'raw':!![]})[_0xce51('0x45')](function(_0x4e0e4f){_0x4e0e4f['forEach'](function(_0x267e2c){_0x2930b4[_0xce51('0x65')](_0x267e2c['id']+0x1869f);});_0x36b00c(_0x2930b4);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x909337['id']},'raw':!![]})[_0xce51('0x45')](function(_0x340d9f){_0x340d9f[_0xce51('0x66')](function(_0x5d4680){_0x2930b4[_0xce51('0x65')](_0x5d4680['resourceId']+0x1869f);});_0x36b00c(_0x2930b4);});}}catch(_0x4318d0){_0x1c6108(_0x4318d0);}});}function getPlugins(_0x579eb6){var _0x373d60=[];return new BPromise(function(_0x8aecd7,_0x589d96){try{if(_0x579eb6['autoAssociation']){return db[_0xce51('0x67')][_0xce51('0x54')]({'raw':!![]})[_0xce51('0x45')](function(_0x2dcaad){_0x2dcaad[_0xce51('0x66')](function(_0x412be7){_0x373d60['push'](_0x412be7['id']+0x15b38);});_0x8aecd7(_0x373d60);});}else{return db['UserProfileResource'][_0xce51('0x54')]({'where':{'sectionId':_0x579eb6['id']},'raw':!![]})['then'](function(_0x5cb24c){_0x5cb24c[_0xce51('0x66')](function(_0x170b94){_0x373d60['push'](_0x170b94[_0xce51('0x68')]+0x15b38);});_0x8aecd7(_0x373d60);});}}catch(_0x10631e){_0x589d96(_0x10631e);}});}exports[_0xce51('0x69')]=function(_0x5de6da,_0x32efea){return db['UserProfile'][_0xce51('0x49')]({'where':{'id':_0x5de6da[_0xce51('0x47')]['id']}})[_0xce51('0x45')](handleEntityNotFound(_0x32efea,null))[_0xce51('0x45')](function(_0x424b79){if(_0x424b79){return db[_0xce51('0x52')]['transaction'](function(_0x35674d){return db[_0xce51('0x53')][_0xce51('0x54')]({'where':{'userProfileId':_0x5de6da[_0xce51('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xce51('0x45')](function(_0x2beeb7){if(_0x2beeb7){return db[_0xce51('0x53')]['destroy']({'where':{'userProfileId':_0x5de6da[_0xce51('0x47')]['id'],'id':_['map'](_0x2beeb7,function(_0x30a047){return _0x30a047['id'];})},'transaction':_0x35674d});}})['then'](function(_0x59237c){var _0x4bc01f=_[_0xce51('0x40')](_0x5de6da['body'],function(_0xce3408){_0xce3408[_0xce51('0x58')]=_0x5de6da['params']['id'];return _0xce3408;});return db['UserProfileSection']['bulkCreate'](_0x4bc01f,{'raw':!![],'transaction':_0x35674d});})[_0xce51('0x45')](function(_0x434fdb){var _0xa1f72a=_[_0xce51('0x3d')](_['map'](_0x434fdb,function(_0x45c18a){return _0x45c18a[_0xce51('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0xa1f72a){return db[_0xce51('0x53')]['findAll']({'where':{'userProfileId':_0x5de6da[_0xce51('0x47')]['id'],'sectionId':_[_0xce51('0x40')](_0xa1f72a,function(_0xce67b9){return _0xce67b9['sectionId'];})},'attributes':['id',_0xce51('0x5d')],'raw':!![]})['then'](function(_0x3b5c39){var _0x3f66f9=_[_0xce51('0x40')](_0x5de6da[_0xce51('0x4b')],function(_0x29cc12){_0x29cc12[_0xce51('0x58')]=_0x5de6da[_0xce51('0x47')]['id'];return _0x29cc12;});return db[_0xce51('0x57')][_0xce51('0x6a')](_0x3f66f9,{'raw':!![],'transaction':_0x35674d});});}})['catch'](handleError(_0x32efea,null));});}})[_0xce51('0x45')](function(_0x2b019d){var _0x53d8a6=_[_0xce51('0x40')](_0x2b019d,function(_0x1d100c){return _0x1d100c[_0xce51('0x4d')]({'plain':!![]});});})[_0xce51('0x45')](respondWithResult(_0x32efea,null))[_0xce51('0x46')](handleError(_0x32efea,null));};exports['removeResources']=function(_0x5977d1,_0x4eb856,_0x2418d1){return db['UserProfile']['find']({'where':{'id':_0x5977d1['params']['id']}})['then'](handleEntityNotFound(_0x4eb856,null))[_0xce51('0x45')](function(_0x56689e){if(_0x56689e){return _0x56689e[_0xce51('0x6b')](_0x5977d1[_0xce51('0x34')][_0xce51('0x5e')]);}})['then'](respondWithStatusCode(_0x4eb856,null))[_0xce51('0x46')](handleError(_0x4eb856,null));};exports[_0xce51('0x6c')]=function(_0x140630,_0x36dfab){var _0x4d6cea={};if(!_0x140630[_0xce51('0x34')][_0xce51('0x6d')])throw new Error(_0xce51('0x6e'));if(!_0x140630[_0xce51('0x34')][_0xce51('0x3a')]('nolimit')){_0x4d6cea[_0xce51('0x20')]=qs[_0xce51('0x20')](_0x140630['query'][_0xce51('0x20')]);_0x4d6cea[_0xce51('0x23')]=qs[_0xce51('0x23')](_0x140630[_0xce51('0x34')][_0xce51('0x23')]);}return db['UserProfile']['find']({'where':{'id':_0x140630['params']['id']}})[_0xce51('0x45')](function(_0x2bb55f){if(!_0x2bb55f)throw new Error(_0xce51('0x6f')+_0x140630[_0xce51('0x47')]['id']);return db['UserProfile'][_0xce51('0x6c')](_0x140630);})[_0xce51('0x45')](respondWithFilteredResult(_0x36dfab,_0x4d6cea))[_0xce51('0x46')](handleError(_0x36dfab,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e49ada0..6cd216e 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 _0x002d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','update','remove'];(function(_0x1e1297,_0x5ecca8){var _0x5b8654=function(_0xfbc015){while(--_0xfbc015){_0x1e1297['push'](_0x1e1297['shift']());}};_0x5b8654(++_0x5ecca8);}(_0x002d,0xca));var _0xd002=function(_0x409846,_0xeb3235){_0x409846=_0x409846-0x0;var _0x357bdf=_0x002d[_0x409846];return _0x357bdf;};'use strict';var EventEmitter=require(_0xd002('0x0'));var UserProfile=require(_0xd002('0x1'))['db'][_0xd002('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd002('0x3'),'afterDestroy':_0xd002('0x4')};function emitEvent(_0x1c0d0a){return function(_0x24ff42,_0x1323f0,_0x179915){UserProfileEvents[_0xd002('0x5')](_0x1c0d0a+':'+_0x24ff42['id'],_0x24ff42);UserProfileEvents[_0xd002('0x5')](_0x1c0d0a,_0x24ff42);_0x179915(null);};}for(var e in events){if(events[_0xd002('0x6')](e)){var event=events[e];UserProfile[_0xd002('0x7')](e,emitEvent(event));}}module[_0xd002('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xf40b=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x11498f,_0x24a9ce){var _0x47c861=function(_0x582a6c){while(--_0x582a6c){_0x11498f['push'](_0x11498f['shift']());}};_0x47c861(++_0x24a9ce);}(_0xf40b,0xb0));var _0xbf40=function(_0x2475fb,_0x238ba5){_0x2475fb=_0x2475fb-0x0;var _0x5a879a=_0xf40b[_0x2475fb];return _0x5a879a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xbf40('0x0'))['db'][_0xbf40('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbf40('0x2')](0x0);var events={'afterCreate':_0xbf40('0x3'),'afterUpdate':'update','afterDestroy':_0xbf40('0x4')};function emitEvent(_0x2a92dc){return function(_0x118fce,_0x887cae,_0x1a1c6f){UserProfileEvents['emit'](_0x2a92dc+':'+_0x118fce['id'],_0x118fce);UserProfileEvents[_0xbf40('0x5')](_0x2a92dc,_0x118fce);_0x1a1c6f(null);};}for(var e in events){if(events[_0xbf40('0x6')](e)){var event=events[e];UserProfile[_0xbf40('0x7')](e,emitEvent(event));}}module[_0xbf40('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index c57a91d..171c5d3 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 _0x03cc=['WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','telephones','Users','admin','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','sounds','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','ignore','isEmpty','union','autoAssociation','all','rawAttributes','model','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','key','foreignKey','forEach','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','include','tag','ThroughTags','true','chat','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','exports','models','filter','field','findAll','then','map','catch','value','associatedResources','name','UserProfileResource','type','resourceId','squareprojects','childModel','SquareProject','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','membername','User','role','agent','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x03cc,0x74));var _0xc03c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x03cc[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var attributes=require(_0xc03c('0x0'));var squel=require('squel');module[_0xc03c('0x1')]=function(_0x54eafb){var _0x354f10=_0x54eafb[_0xc03c('0x2')];function _0x293358(_0x90131,_0x304b66){return new Promise(function(_0x172e99,_0x46728f){if(!_0x304b66)return _0x172e99(null);var _0x54468f=_0x304b66[_0xc03c('0x3')]?{[_0x304b66[_0xc03c('0x3')][_0xc03c('0x4')]]:_0x304b66[_0xc03c('0x3')]['value']}:undefined;return _0x354f10[_0x90131][_0xc03c('0x5')]({'where':_0x54468f,'raw':!![]})[_0xc03c('0x6')](function(_0x47712f){_0x304b66['associatedResources']=_[_0xc03c('0x7')](_0x47712f,'id');_0x172e99(_0x304b66);})[_0xc03c('0x8')](function(_0x8564e7){_0x46728f(_0x8564e7);});});}function _0x4f5044(_0x48f4d3,_0x4d5499){return new Promise(function(_0x5cf963,_0xaf56f5){var _0x5ac575=_0x48f4d3[_0xc03c('0x3')]?{[_0x48f4d3[_0xc03c('0x3')][_0xc03c('0x4')]]:_0x48f4d3[_0xc03c('0x3')][_0xc03c('0x9')]}:undefined;return _0x354f10[_0x48f4d3['model']][_0xc03c('0x5')]({'where':_0x5ac575,'raw':!![]})['then'](function(_0x3c4442){_0x4d5499[_0xc03c('0xa')]=_['map'](_0x3c4442,function(_0x1b8a84){return _0x1b8a84[_0xc03c('0xb')];});_0x5cf963(_0x4d5499);})['catch'](function(_0x30d025){_0xaf56f5(_0x30d025);});});}function _0x5eb650(_0x1f9f86,_0x250a14,_0xb7fb6e){if(!_0x250a14)return Promise['resolve'](null);return new Promise(function(_0x538534,_0x32bf12){return _0x354f10[_0xc03c('0xc')][_0xc03c('0x5')]({'where':{'sectionId':_0x250a14['id']},'raw':!![]})[_0xc03c('0x6')](function(_0x5c4eb1){if(_0x1f9f86[_0xc03c('0x4')]&&_0x1f9f86[_0xc03c('0x4')]!=='id'){_0x250a14[_0xc03c('0xa')]=_[_0xc03c('0x7')](_0x5c4eb1,function(_0x27ec19){return _0x27ec19[_0x1f9f86[_0xc03c('0x4')]];});}else{if(_0xb7fb6e==='AnalyticExtractedReport'){_0x250a14['associatedResources']=_[_0xc03c('0x7')](_0x5c4eb1,function(_0x14ef3f){return{'id':_0x14ef3f['resourceId'],'type':_0x14ef3f[_0xc03c('0xd')]};});}else{_0x250a14[_0xc03c('0xa')]=_[_0xc03c('0x7')](_0x5c4eb1,function(_0x54feb6){return _0x54feb6[_0xc03c('0xe')];});}}_0x538534(_0x250a14);})['catch'](function(_0x2e5a19){_0x32bf12(_0x2e5a19);});});}function _0x190a75(_0x48ecd4,_0xe98de9){var _0x5e858b={'parentSections':[]};switch(_0x48ecd4['toLowerCase']()){case _0xc03c('0xf'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x11');break;case'odbc':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x12');break;case'squarerecordings':_0x5e858b['childModel']=_0xc03c('0x13');_0x5e858b[_0xc03c('0x14')]=[{'name':_0xc03c('0x15'),'field':_0xc03c('0xb'),'foreignKey':_0xc03c('0x16')}];break;case _0xc03c('0x17'):_0x5e858b['childModel']=_0xc03c('0x18');break;case _0xc03c('0x19'):_0x5e858b['childModel']=_0xc03c('0x1a');_0x5e858b[_0xc03c('0x14')]=[{'name':_0xc03c('0x1b'),'field':'id','foreignKey':'ListId'}];break;case _0xc03c('0x1c'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x1d');break;case _0xc03c('0x1e'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x1f');break;case _0xc03c('0x20'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x21');break;case _0xc03c('0x22'):_0x5e858b[_0xc03c('0x10')]='ChatQueue';break;case _0xc03c('0x23'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x24');break;case'faxqueues':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x25');break;case _0xc03c('0x26'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x27');break;case _0xc03c('0x28'):case _0xc03c('0x29'):case _0xc03c('0x2a'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x2b');break;case _0xc03c('0x2c'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x2d');break;case'voicemails':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x2e');break;case _0xc03c('0x2f'):_0x5e858b[_0xc03c('0x10')]='VoiceRecording';_0x5e858b['parentSections']=[{'name':_0xc03c('0x30'),'field':'name','foreignKey':_0xc03c('0x31'),'model':_0xc03c('0x32'),'filter':{'field':_0xc03c('0x33'),'value':[_0xc03c('0x34')]}},{'name':'Telephones','field':_0xc03c('0xb'),'foreignKey':_0xc03c('0x31'),'model':_0xc03c('0x32'),'filter':{'field':_0xc03c('0x33'),'value':['telephone']}},{'name':'VoiceQueues','field':_0xc03c('0xb'),'foreignKey':_0xc03c('0x35'),'model':_0xc03c('0x36'),'filter':{'field':_0xc03c('0xd'),'value':[_0xc03c('0x37')]}},{'name':_0xc03c('0x38'),'field':_0xc03c('0xb'),'foreignKey':_0xc03c('0x35'),'model':_0xc03c('0x36'),'filter':{'field':_0xc03c('0xd'),'value':[_0xc03c('0x39')]}}];break;case'musiconholds':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x3a');break;case _0xc03c('0x3b'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x3c');break;case'voiceprefixes':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x3d');break;case'ivrcampaigns':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x3e');break;case'mailqueues':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x3f');break;case _0xc03c('0x40'):_0x5e858b['childModel']=_0xc03c('0x41');break;case _0xc03c('0x42'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x43');break;case _0xc03c('0x44'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x45');break;case _0xc03c('0x46'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x47');break;case _0xc03c('0x48'):_0x5e858b['childModel']='SmsQueue';break;case'smsaccounts':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x49');break;case _0xc03c('0x4a'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x4b');break;case _0xc03c('0x4c'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x4d');break;case _0xc03c('0x4e'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x4f');break;case _0xc03c('0x50'):case'queuecampaigns':_0x5e858b[_0xc03c('0x10')]='VoiceQueue';if(_0xe98de9){_0x5e858b[_0xc03c('0x14')]=[{'name':'VoiceQueues'},{'name':_0xc03c('0x38')}];}break;case'users':case'agents':case _0xc03c('0x51'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x32');if(_0xe98de9){_0x5e858b['parentSections']=[{'name':_0xc03c('0x52'),'filter':{'field':'role','value':[_0xc03c('0x53'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xc03c('0x54')}];}break;case _0xc03c('0x55'):_0x5e858b['childModel']=_0xc03c('0x56');break;case _0xc03c('0x57'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x58');break;case _0xc03c('0x59'):_0x5e858b['childModel']='FreshdeskAccount';break;case _0xc03c('0x5a'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x5b');break;case _0xc03c('0x5c'):_0x5e858b['childModel']=_0xc03c('0x5d');break;case _0xc03c('0x5e'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x5f');break;case _0xc03c('0x60'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x32');break;case'cannedanswers':_0x5e858b['childModel']=_0xc03c('0x61');break;case'dispositions':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x62');break;case _0xc03c('0x63'):_0x5e858b[_0xc03c('0x10')]='Dashboard';break;case _0xc03c('0x64'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x65');break;case _0xc03c('0x66'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x67');break;case _0xc03c('0x68'):_0x5e858b[_0xc03c('0x10')]='Schedule';break;case _0xc03c('0x69'):_0x5e858b[_0xc03c('0x10')]='Sound';break;case'tags':_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x6a');break;case _0xc03c('0x6b'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x6c');break;case _0xc03c('0x6d'):_0x5e858b['childModel']=_0xc03c('0x6e');break;case _0xc03c('0x6f'):_0x5e858b['childModel']=_0xc03c('0x70');break;case _0xc03c('0x71'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x72');break;case _0xc03c('0x73'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x74');break;case _0xc03c('0x75'):_0x5e858b['childModel']=_0xc03c('0x76');_0x5e858b[_0xc03c('0x14')]=[{'name':_0xc03c('0x77'),'field':'id','foreignKey':_0xc03c('0x78')}];break;case _0xc03c('0x79'):_0x5e858b[_0xc03c('0x10')]=_0xc03c('0x7a');break;}return _0x5e858b;}function _0x20d6e8(_0xebb32a,_0x2103e8){var _0x4e8d55=_0xebb32a['charAt'](0x0)[_0xc03c('0x7b')]()+_0xebb32a[_0xc03c('0x7c')](0x1);var _0x172584={'type':_0x354f10['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x1714fa,_0x3870a6){var _0x18fa2c=squel[_0xc03c('0x7d')]()[_0xc03c('0x4')](_0xc03c('0x7e')+_0x4e8d55+_0xc03c('0x7f'),'id')['field'](_0xc03c('0x80'))[_0xc03c('0x81')](_0xc03c('0x82')+_0xebb32a+_0xc03c('0x83'),'ui')['where']('ui.UserId\x20=\x20?',_0x2103e8['id']);return _0x354f10[_0xc03c('0x84')][_0xc03c('0x85')](_0x18fa2c[_0xc03c('0x86')](),_0x172584)[_0xc03c('0x6')](function(_0x1293a0){_0x2103e8[_0x4e8d55+_0xc03c('0x87')]=_0x1293a0;_0x1714fa(_0x1293a0);})[_0xc03c('0x8')](function(_0x285156){_0x3870a6(_0x285156);});});}return _0x54eafb[_0xc03c('0x88')](_0xc03c('0x89'),attributes,{'tableName':_0xc03c('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1d8cff){var _0x31edb0=require('../../components/parsers/qs');var _0x381a21={'raw':_0x1d8cff[_0xc03c('0x85')][_0xc03c('0x8b')],'where':{}};var _0x3e2ef7={};var _0x5a4fa6={'count':0x0,'rows':[]};var _0x24eeb0=_0x1d8cff['query'][_0xc03c('0x8c')];var _0x132eb9=_0x1d8cff['query'][_0xc03c('0x8d')]||![];var _0x166518=_0x190a75(_0x24eeb0,_0x132eb9);if(!_0x166518[_0xc03c('0x10')])throw new Error(_0xc03c('0x8e')+_0x24eeb0+'\x27');var _0x1c8e51=[{'name':_0x24eeb0}];if(!_['isEmpty'](_0x166518['parentSections']))_0x1c8e51=_0x166518[_0xc03c('0x14')];var _0x1e4be9=[];for(var _0x199ed2=0x0;_0x199ed2<_0x1c8e51[_0xc03c('0x8f')];_0x199ed2++){_0x1e4be9[_0xc03c('0x90')](_0x354f10[_0xc03c('0x91')][_0xc03c('0x92')]({'where':{'userProfileId':_0x1d8cff[_0xc03c('0x93')]['id'],'name':_0x1c8e51[_0x199ed2]['name']},'raw':!![]}));}return Promise['all'](_0x1e4be9)[_0xc03c('0x6')](function(_0x1bda4a){var _0x328a24=_[_0xc03c('0x3')](_0x1bda4a,function(_0x44bc3f){return _0x44bc3f?_0x44bc3f:undefined;});var _0x2f6324=_[_0xc03c('0x3')](_0x1c8e51,[_0xc03c('0x94'),!![]]);var _0x1df4bb=_[_0xc03c('0x95')](_0x328a24)&&_['isEmpty'](_0x2f6324)?null:_[_0xc03c('0x96')](_0x2f6324,_0x328a24);if(!_0x1df4bb)return null;var _0xb0253f=[];for(var _0x44517d=0x0;_0x44517d<_0x1df4bb['length'];_0x44517d++){var _0x52bf83=_[_0xc03c('0x92')](_0x1c8e51,function(_0x1fdf25){return _0x1df4bb[_0x44517d]?_0x1fdf25[_0xc03c('0xb')]===_0x1df4bb[_0x44517d][_0xc03c('0xb')]:null;});if(_0x52bf83){if(_0x1df4bb[_0x44517d][_0xc03c('0x94')]){_0xb0253f['push'](_0x293358(_0x166518[_0xc03c('0x10')],_0x1df4bb[_0x44517d]));}else{if(!_0x1df4bb[_0x44517d][_0xc03c('0x97')]){_0xb0253f[_0xc03c('0x90')](_0x5eb650(_0x52bf83,_0x1df4bb[_0x44517d],_0x166518[_0xc03c('0x10')]));}else{if(_0x52bf83['model']){_0xb0253f[_0xc03c('0x90')](_0x4f5044(_0x52bf83,_0x1df4bb[_0x44517d]));}}}}}return Promise[_0xc03c('0x98')](_0xb0253f);})[_0xc03c('0x6')](function(_0x36f564){var _0x2606dd=_0x36f564;var _0x4787b2=null;if(_0x2606dd){_0x4787b2=_0x2606dd[_0xc03c('0x8f')]===0x1?_0x2606dd[0x0]:null;}if(!_0x4787b2&&!_0x2606dd)return _0x5a4fa6;var _0x7c1a69=_0x354f10[_0x166518[_0xc03c('0x10')]][_0xc03c('0x99')];_0x3e2ef7[_0xc03c('0x9a')]=_['keys'](_0x7c1a69);_0x3e2ef7[_0xc03c('0x85')]=_[_0xc03c('0x9b')](_0x1d8cff['query']);_0x3e2ef7[_0xc03c('0x9c')]=_['intersection'](_0x3e2ef7[_0xc03c('0x9a')],_0x3e2ef7['query']);_0x381a21[_0xc03c('0x9d')]=_[_0xc03c('0x9e')](_0x3e2ef7[_0xc03c('0x9a')],_0x31edb0[_0xc03c('0x9f')](_0x1d8cff['query'][_0xc03c('0x9f')]));_0x381a21[_0xc03c('0x9d')]=_0x381a21[_0xc03c('0x9d')][_0xc03c('0x8f')]?_0x381a21[_0xc03c('0x9d')]:_0x3e2ef7[_0xc03c('0x9a')];if(!_0x1d8cff['query'][_0xc03c('0xa0')](_0xc03c('0xa1'))){_0x381a21[_0xc03c('0xa2')]=_0x31edb0[_0xc03c('0xa2')](_0x1d8cff[_0xc03c('0x85')]['limit']);_0x381a21['offset']=_0x31edb0[_0xc03c('0xa3')](_0x1d8cff['query']['offset']);}_0x381a21[_0xc03c('0xa4')]=_0x31edb0[_0xc03c('0xa5')](_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xa5')]);_0x381a21['where']=_0x31edb0[_0xc03c('0x9c')](_[_0xc03c('0xa6')](_0x1d8cff[_0xc03c('0x85')],_0x3e2ef7[_0xc03c('0x9c')]));if(_0x1d8cff[_0xc03c('0x85')][_0xc03c('0x3')]){_0x381a21[_0xc03c('0xa7')]=_[_0xc03c('0xa8')](_0x381a21[_0xc03c('0xa7')],{'$or':_[_0xc03c('0x7')](_0x7c1a69,function(_0x37ae1a){if(_0x37ae1a[_0xc03c('0xd')][_0xc03c('0xa9')]!=='VIRTUAL'){var _0x73d4a2={};_0x73d4a2[_0x37ae1a[_0xc03c('0x4')]]={'$like':'%'+_0x1d8cff['query'][_0xc03c('0x3')]+'%'};return _0x73d4a2;}})});}var _0x528f42=[];var _0x5c77b6=null;var _0x1595cb={};if(_0x4787b2){_0x5c77b6=_['find'](_0x1c8e51,[_0xc03c('0xb'),_0x4787b2[_0xc03c('0xb')]]);if(_0x5c77b6[_0xc03c('0x4')]){_0x1595cb={};if(_0x166518[_0xc03c('0x10')]==='AnalyticExtractedReport'){_0x1595cb[_0x5c77b6['foreignKey']]=_[_0xc03c('0x7')](_0x4787b2[_0xc03c('0xa')],'id');}else{_0x1595cb[_0x5c77b6[_0xc03c('0xaa')]]=_0x4787b2[_0xc03c('0xa')];}_0x528f42[_0xc03c('0x90')](_0x1595cb);}else{_0x381a21[_0xc03c('0xa7')]['id']=_0x4787b2['associatedResources'];}}else{for(var _0x5dce1f=0x0;_0x5dce1f<_0x2606dd[_0xc03c('0x8f')];_0x5dce1f++){_0x5c77b6=_['find'](_0x1c8e51,[_0xc03c('0xb'),_0x2606dd[_0x5dce1f][_0xc03c('0xb')]]);if(_0x5c77b6[_0xc03c('0x4')]){_0x1595cb={};_0x1595cb[_0x5c77b6[_0xc03c('0xaa')]]=_0x2606dd[_0x5dce1f]['associatedResources'];_0x528f42[_0xc03c('0x90')](_0x1595cb);}else{if(!_0x381a21[_0xc03c('0xa7')]['id'])_0x381a21[_0xc03c('0xa7')]['id']=[];_0x2606dd[_0x5dce1f]['associatedResources'][_0xc03c('0xab')](function(_0x1541b6){_0x381a21[_0xc03c('0xa7')]['id'][_0xc03c('0x90')](_0x1541b6);});}}}if(!_[_0xc03c('0x95')](_0x528f42)){_0x381a21[_0xc03c('0xa7')]=_[_0xc03c('0xa8')](_0x381a21['where'],{'$and':{'$or':_0x528f42}});}_0x381a21=_[_0xc03c('0xa8')]({},_0x381a21,_0x1d8cff['options']);if(_0x4787b2&&!_0x4787b2[_0xc03c('0x97')]&&_0x166518[_0xc03c('0x10')]===_0xc03c('0x76')){if(_0x1d8cff[_0xc03c('0x85')]['includeAll']){_0x381a21['include']=[{'all':!![]}];}return _0x354f10[_0x166518['childModel']][_0xc03c('0x5')](_0x381a21)[_0xc03c('0x6')](function(_0x2f3f31){var _0x10f38f=[];_0x2f3f31[_0xc03c('0xab')](function(_0x2f116e){var _0x673193;switch(_0x2f116e['reportType']){case _0xc03c('0xac'):_0x673193=_[_0xc03c('0x92')](_0x4787b2[_0xc03c('0xa')],function(_0x1c2a03){return _0x1c2a03['id']===_0x2f116e['reportId']&&_0x1c2a03[_0xc03c('0xd')]===_0xc03c('0xad');});break;case _0xc03c('0xae'):_0x673193=_[_0xc03c('0x92')](_0x4787b2[_0xc03c('0xa')],function(_0x28d6ec){return _0x28d6ec['id']===_0x2f116e[_0xc03c('0x78')]&&_0x28d6ec[_0xc03c('0xd')]===_0xc03c('0xaf');});break;}if(_0x673193)_0x10f38f[_0xc03c('0x90')](_0x2f116e);});_0x5a4fa6['count']=_0x10f38f[_0xc03c('0x8f')];_0x5a4fa6[_0xc03c('0xb0')]=_0x10f38f;return _0x5a4fa6;});}else{if(!_[_0xc03c('0x95')](_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xb1')])){_0x381a21[_0xc03c('0xa7')]['id']=_0x381a21['where']['id']?_[_0xc03c('0x9e')](_0x381a21['where']['id'],_0x1d8cff[_0xc03c('0x85')]['ids']):_0x1d8cff['query'][_0xc03c('0xb1')];if(_0x1d8cff['query'][_0xc03c('0xb2')]){_0x381a21[_0xc03c('0xa4')]=_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xb2')];}}if(_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xb3')]){_0x381a21[_0xc03c('0xa7')]=_[_0xc03c('0xa8')](_0x381a21[_0xc03c('0xa7')],{'$and':_0x1d8cff['query'][_0xc03c('0xb3')]});}return _0x354f10[_0x166518['childModel']]['count']({'where':_0x381a21[_0xc03c('0xa7')]})['then'](function(_0x51267){_0x5a4fa6[_0xc03c('0xb4')]=_0x51267;if(_0x1d8cff['query']['includeAll']){if(_0x166518[_0xc03c('0x10')]===_0xc03c('0x1a')){_0x381a21[_0xc03c('0xb5')]=[{'model':_0x354f10['Tag'],'as':'Tags','attributes':['id',_0xc03c('0xb'),'color'],'required':_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xb6')]?!![]:![]},{'model':_0x354f10[_0xc03c('0x6a')],'as':_0xc03c('0xb7'),'attributes':['id',_0xc03c('0xb'),'color'],'through':_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xb6')]?{'attributes':[],'where':{'TagId':_0x1d8cff[_0xc03c('0x85')]['tag']||undefined}}:{},'required':_0x1d8cff[_0xc03c('0x85')][_0xc03c('0xb6')]?!![]:![]}];}else{_0x381a21['include']=[{'all':!![]}];}}return _0x354f10[_0x166518[_0xc03c('0x10')]][_0xc03c('0x5')](_0x381a21);})[_0xc03c('0x6')](function(_0x233dad){_0x5a4fa6[_0xc03c('0xb0')]=_0x233dad;if(_0x24eeb0===_0xc03c('0x30')&&_0x1d8cff['query']['openTabs']===_0xc03c('0xb8')){var _0x3e217e=[];for(var _0x33ed1c=0x0;_0x33ed1c<_0x5a4fa6[_0xc03c('0xb0')][_0xc03c('0x8f')];_0x33ed1c++){_0x3e217e[_0xc03c('0x90')](_0x20d6e8(_0xc03c('0xb9'),_0x5a4fa6[_0xc03c('0xb0')][_0x33ed1c]['dataValues']));_0x3e217e['push'](_0x20d6e8('sms',_0x5a4fa6[_0xc03c('0xb0')][_0x33ed1c][_0xc03c('0xba')]));_0x3e217e[_0xc03c('0x90')](_0x20d6e8(_0xc03c('0xbb'),_0x5a4fa6['rows'][_0x33ed1c][_0xc03c('0xba')]));_0x3e217e['push'](_0x20d6e8(_0xc03c('0xbc'),_0x5a4fa6[_0xc03c('0xb0')][_0x33ed1c][_0xc03c('0xba')]));_0x3e217e['push'](_0x20d6e8(_0xc03c('0xbd'),_0x5a4fa6[_0xc03c('0xb0')][_0x33ed1c]['dataValues']));_0x3e217e['push'](_0x20d6e8(_0xc03c('0xbe'),_0x5a4fa6['rows'][_0x33ed1c][_0xc03c('0xba')]));}return Promise['all'](_0x3e217e)[_0xc03c('0x6')](function(){return _0x5a4fa6;});}return _0x5a4fa6;});}});}}});}; \ No newline at end of file +var _0x0b9c=['Dashboard','intervals','Interval','Pause','Schedule','Tag','templates','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','mergeResources','length','push','UserProfileSection','all','ignore','isEmpty','union','find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','include','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','then','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','resourceId','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','projectName','JscriptyProject','contacts','CmContact','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','VoiceQueues','VoiceQueue','type','inbound','QueueCampaigns','queue','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','agents','telephones','Users','admin','user','ZendeskAccount','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','Disposition','customdashboards'];(function(_0x18be13,_0x12f269){var _0x17317b=function(_0x449d31){while(--_0x449d31){_0x18be13['push'](_0x18be13['shift']());}};_0x17317b(++_0x12f269);}(_0x0b9c,0x11c));var _0xc0b9=function(_0x1a5c41,_0xcd5c02){_0x1a5c41=_0x1a5c41-0x0;var _0x17629c=_0x0b9c[_0x1a5c41];return _0x17629c;};'use strict';var _=require(_0xc0b9('0x0'));var attributes=require(_0xc0b9('0x1'));var squel=require(_0xc0b9('0x2'));module[_0xc0b9('0x3')]=function(_0x26d93f){var _0x2967f5=_0x26d93f['models'];function _0x191b8f(_0x1a2e6a,_0x17a2de){return new Promise(function(_0x569b73,_0x4d0c34){if(!_0x17a2de)return _0x569b73(null);var _0x5b587a=_0x17a2de[_0xc0b9('0x4')]?{[_0x17a2de[_0xc0b9('0x4')]['field']]:_0x17a2de['filter'][_0xc0b9('0x5')]}:undefined;return _0x2967f5[_0x1a2e6a][_0xc0b9('0x6')]({'where':_0x5b587a,'raw':!![]})[_0xc0b9('0x7')](function(_0x1e607b){_0x17a2de[_0xc0b9('0x8')]=_[_0xc0b9('0x9')](_0x1e607b,'id');_0x569b73(_0x17a2de);})[_0xc0b9('0xa')](function(_0x16b74e){_0x4d0c34(_0x16b74e);});});}function _0x583fd6(_0x3e368d,_0x2bf1be){return new Promise(function(_0xe7763d,_0x4c256a){var _0x55f0ea=_0x3e368d[_0xc0b9('0x4')]?{[_0x3e368d[_0xc0b9('0x4')][_0xc0b9('0xb')]]:_0x3e368d[_0xc0b9('0x4')][_0xc0b9('0x5')]}:undefined;return _0x2967f5[_0x3e368d[_0xc0b9('0xc')]]['findAll']({'where':_0x55f0ea,'raw':!![]})[_0xc0b9('0x7')](function(_0xa826ef){_0x2bf1be[_0xc0b9('0x8')]=_[_0xc0b9('0x9')](_0xa826ef,function(_0x444342){return _0x444342[_0xc0b9('0xd')];});_0xe7763d(_0x2bf1be);})['catch'](function(_0xd44b21){_0x4c256a(_0xd44b21);});});}function _0x482fa0(_0x1f2d2a,_0x81ad78,_0x2eb050){if(!_0x81ad78)return Promise[_0xc0b9('0xe')](null);return new Promise(function(_0x5a12ef,_0x355396){return _0x2967f5[_0xc0b9('0xf')][_0xc0b9('0x6')]({'where':{'sectionId':_0x81ad78['id']},'raw':!![]})['then'](function(_0x257e73){if(_0x1f2d2a[_0xc0b9('0xb')]&&_0x1f2d2a[_0xc0b9('0xb')]!=='id'){_0x81ad78[_0xc0b9('0x8')]=_['map'](_0x257e73,function(_0x20f07b){return _0x20f07b[_0x1f2d2a['field']];});}else{if(_0x2eb050==='AnalyticExtractedReport'){_0x81ad78['associatedResources']=_['map'](_0x257e73,function(_0x32c517){return{'id':_0x32c517[_0xc0b9('0x10')],'type':_0x32c517['type']};});}else{_0x81ad78[_0xc0b9('0x8')]=_[_0xc0b9('0x9')](_0x257e73,function(_0x5f26af){return _0x5f26af[_0xc0b9('0x10')];});}}_0x5a12ef(_0x81ad78);})[_0xc0b9('0xa')](function(_0x486cee){_0x355396(_0x486cee);});});}function _0x8d2b58(_0x46bb6d,_0x7397d1){var _0x41c87f={'parentSections':[]};switch(_0x46bb6d[_0xc0b9('0x11')]()){case'squareprojects':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x13');break;case _0xc0b9('0x14'):_0x41c87f['childModel']=_0xc0b9('0x15');break;case'squarerecordings':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x16');_0x41c87f[_0xc0b9('0x17')]=[{'name':'SquareProjects','field':_0xc0b9('0xd'),'foreignKey':_0xc0b9('0x18')}];break;case'projects':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x19');break;case _0xc0b9('0x1a'):_0x41c87f['childModel']=_0xc0b9('0x1b');_0x41c87f[_0xc0b9('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0xc0b9('0x1c')}];break;case'lists':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x1d');break;case _0xc0b9('0x1e'):_0x41c87f['childModel']='CmCompany';break;case _0xc0b9('0x1f'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x20');break;case _0xc0b9('0x21'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x22');break;case'chatwebsites':_0x41c87f['childModel']=_0xc0b9('0x23');break;case _0xc0b9('0x24'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x25');break;case _0xc0b9('0x26'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x27');break;case'inboundroutes':case _0xc0b9('0x28'):case _0xc0b9('0x29'):_0x41c87f[_0xc0b9('0x12')]='VoiceExtension';break;case'contexts':_0x41c87f['childModel']=_0xc0b9('0x2a');break;case _0xc0b9('0x2b'):_0x41c87f['childModel']=_0xc0b9('0x2c');break;case'voicerecordings':_0x41c87f[_0xc0b9('0x12')]='VoiceRecording';_0x41c87f[_0xc0b9('0x17')]=[{'name':_0xc0b9('0x2d'),'field':_0xc0b9('0xd'),'foreignKey':_0xc0b9('0x2e'),'model':_0xc0b9('0x2f'),'filter':{'field':_0xc0b9('0x30'),'value':[_0xc0b9('0x31')]}},{'name':_0xc0b9('0x32'),'field':_0xc0b9('0xd'),'foreignKey':_0xc0b9('0x2e'),'model':_0xc0b9('0x2f'),'filter':{'field':'role','value':['telephone']}},{'name':_0xc0b9('0x33'),'field':'name','foreignKey':'queue','model':_0xc0b9('0x34'),'filter':{'field':_0xc0b9('0x35'),'value':[_0xc0b9('0x36')]}},{'name':_0xc0b9('0x37'),'field':_0xc0b9('0xd'),'foreignKey':_0xc0b9('0x38'),'model':'VoiceQueue','filter':{'field':_0xc0b9('0x35'),'value':[_0xc0b9('0x39')]}}];break;case _0xc0b9('0x3a'):_0x41c87f['childModel']='VoiceMusicOnHold';break;case _0xc0b9('0x3b'):_0x41c87f[_0xc0b9('0x12')]='VoiceChanSpy';break;case _0xc0b9('0x3c'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x3d');break;case _0xc0b9('0x3e'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x3f');break;case _0xc0b9('0x40'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x41');break;case _0xc0b9('0x42'):_0x41c87f[_0xc0b9('0x12')]='MailAccount';break;case _0xc0b9('0x43'):_0x41c87f['childModel']=_0xc0b9('0x44');break;case _0xc0b9('0x45'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x46');break;case _0xc0b9('0x47'):_0x41c87f['childModel']=_0xc0b9('0x48');break;case _0xc0b9('0x49'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x4a');break;case _0xc0b9('0x4b'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x4c');break;case'whatsappqueues':_0x41c87f[_0xc0b9('0x12')]='WhatsappQueue';break;case _0xc0b9('0x4d'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x4e');break;case _0xc0b9('0x4f'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x50');break;case _0xc0b9('0x51'):case'queuecampaigns':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x34');if(_0x7397d1){_0x41c87f['parentSections']=[{'name':_0xc0b9('0x33')},{'name':_0xc0b9('0x37')}];}break;case'users':case _0xc0b9('0x52'):case _0xc0b9('0x53'):_0x41c87f[_0xc0b9('0x12')]='User';if(_0x7397d1){_0x41c87f['parentSections']=[{'name':_0xc0b9('0x54'),'filter':{'field':'role','value':[_0xc0b9('0x55'),_0xc0b9('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':_0xc0b9('0x32')}];}break;case'zendeskaccounts':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x57');break;case'salesforceaccounts':_0x41c87f['childModel']=_0xc0b9('0x58');break;case'freshdeskaccounts':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x59');break;case'sugarcrmaccounts':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x5a');break;case _0xc0b9('0x5b'):_0x41c87f['childModel']=_0xc0b9('0x5c');break;case _0xc0b9('0x5d'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x5e');break;case'vtigeraccounts':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x2f');break;case'cannedanswers':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x5f');break;case'dispositions':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x60');break;case _0xc0b9('0x61'):_0x41c87f['childModel']=_0xc0b9('0x62');break;case _0xc0b9('0x63'):_0x41c87f['childModel']=_0xc0b9('0x64');break;case'pauses':_0x41c87f['childModel']=_0xc0b9('0x65');break;case'scheduler':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x66');break;case'sounds':_0x41c87f[_0xc0b9('0x12')]='Sound';break;case'tags':_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x67');break;case _0xc0b9('0x68'):_0x41c87f[_0xc0b9('0x12')]='Template';break;case _0xc0b9('0x69'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x6a');break;case _0xc0b9('0x6b'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x6c');break;case _0xc0b9('0x6d'):_0x41c87f[_0xc0b9('0x12')]='Variable';break;case _0xc0b9('0x6e'):_0x41c87f[_0xc0b9('0x12')]='Plugin';break;case _0xc0b9('0x6f'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x70');_0x41c87f['parentSections']=[{'name':_0xc0b9('0x71'),'field':'id','foreignKey':_0xc0b9('0x72')}];break;case _0xc0b9('0x73'):_0x41c87f[_0xc0b9('0x12')]=_0xc0b9('0x74');break;}return _0x41c87f;}function _0x28dc02(_0x19b7c2,_0x422320){var _0x516985=_0x19b7c2[_0xc0b9('0x75')](0x0)[_0xc0b9('0x76')]()+_0x19b7c2[_0xc0b9('0x77')](0x1);var _0x42be3c={'type':_0x2967f5[_0xc0b9('0x78')][_0xc0b9('0x79')][_0xc0b9('0x7a')],'raw':!![]};return new Promise(function(_0x11f177,_0x531c39){var _0x5df328=squel[_0xc0b9('0x7b')]()[_0xc0b9('0xb')](_0xc0b9('0x7c')+_0x516985+_0xc0b9('0x7d'),'id')[_0xc0b9('0xb')](_0xc0b9('0x7e'))[_0xc0b9('0x7f')](_0xc0b9('0x80')+_0x19b7c2+'_interactions','ui')[_0xc0b9('0x81')](_0xc0b9('0x82'),_0x422320['id']);return _0x2967f5[_0xc0b9('0x83')][_0xc0b9('0x84')](_0x5df328[_0xc0b9('0x85')](),_0x42be3c)[_0xc0b9('0x7')](function(_0x540d9d){_0x422320[_0x516985+_0xc0b9('0x86')]=_0x540d9d;_0x11f177(_0x540d9d);})[_0xc0b9('0xa')](function(_0x1d6ccd){_0x531c39(_0x1d6ccd);});});}return _0x26d93f[_0xc0b9('0x87')](_0xc0b9('0x88'),attributes,{'tableName':_0xc0b9('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3eb894){var _0x57130d=require(_0xc0b9('0x8a'));var _0x1e9343={'raw':_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0x8b')],'where':{}};var _0x3df3b0={};var _0x2a344e={'count':0x0,'rows':[]};var _0x3079bd=_0x3eb894[_0xc0b9('0x84')]['section'];var _0x307032=_0x3eb894['query'][_0xc0b9('0x8c')]||![];var _0x58b985=_0x8d2b58(_0x3079bd,_0x307032);if(!_0x58b985[_0xc0b9('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x3079bd+'\x27');var _0x4ed4a8=[{'name':_0x3079bd}];if(!_['isEmpty'](_0x58b985[_0xc0b9('0x17')]))_0x4ed4a8=_0x58b985[_0xc0b9('0x17')];var _0x1b013e=[];for(var _0x391997=0x0;_0x391997<_0x4ed4a8[_0xc0b9('0x8d')];_0x391997++){_0x1b013e[_0xc0b9('0x8e')](_0x2967f5[_0xc0b9('0x8f')]['find']({'where':{'userProfileId':_0x3eb894['params']['id'],'name':_0x4ed4a8[_0x391997][_0xc0b9('0xd')]},'raw':!![]}));}return Promise[_0xc0b9('0x90')](_0x1b013e)[_0xc0b9('0x7')](function(_0x578ec7){var _0x3a3723=_['filter'](_0x578ec7,function(_0x54e489){return _0x54e489?_0x54e489:undefined;});var _0x7da7cb=_[_0xc0b9('0x4')](_0x4ed4a8,[_0xc0b9('0x91'),!![]]);var _0x8becfb=_[_0xc0b9('0x92')](_0x3a3723)&&_[_0xc0b9('0x92')](_0x7da7cb)?null:_[_0xc0b9('0x93')](_0x7da7cb,_0x3a3723);if(!_0x8becfb)return null;var _0x811b54=[];for(var _0x35b9cd=0x0;_0x35b9cd<_0x8becfb[_0xc0b9('0x8d')];_0x35b9cd++){var _0x2891dc=_[_0xc0b9('0x94')](_0x4ed4a8,function(_0x1c9665){return _0x8becfb[_0x35b9cd]?_0x1c9665[_0xc0b9('0xd')]===_0x8becfb[_0x35b9cd][_0xc0b9('0xd')]:null;});if(_0x2891dc){if(_0x8becfb[_0x35b9cd][_0xc0b9('0x91')]){_0x811b54['push'](_0x191b8f(_0x58b985['childModel'],_0x8becfb[_0x35b9cd]));}else{if(!_0x8becfb[_0x35b9cd][_0xc0b9('0x95')]){_0x811b54['push'](_0x482fa0(_0x2891dc,_0x8becfb[_0x35b9cd],_0x58b985['childModel']));}else{if(_0x2891dc[_0xc0b9('0xc')]){_0x811b54['push'](_0x583fd6(_0x2891dc,_0x8becfb[_0x35b9cd]));}}}}}return Promise[_0xc0b9('0x90')](_0x811b54);})[_0xc0b9('0x7')](function(_0x3af0ed){var _0xc30d21=_0x3af0ed;var _0x525f45=null;if(_0xc30d21){_0x525f45=_0xc30d21[_0xc0b9('0x8d')]===0x1?_0xc30d21[0x0]:null;}if(!_0x525f45&&!_0xc30d21)return _0x2a344e;var _0x2621fb=_0x2967f5[_0x58b985[_0xc0b9('0x12')]][_0xc0b9('0x96')];_0x3df3b0[_0xc0b9('0xc')]=_[_0xc0b9('0x97')](_0x2621fb);_0x3df3b0[_0xc0b9('0x84')]=_['keys'](_0x3eb894[_0xc0b9('0x84')]);_0x3df3b0[_0xc0b9('0x98')]=_['intersection'](_0x3df3b0[_0xc0b9('0xc')],_0x3df3b0[_0xc0b9('0x84')]);_0x1e9343['attributes']=_[_0xc0b9('0x99')](_0x3df3b0[_0xc0b9('0xc')],_0x57130d['fields'](_0x3eb894['query']['fields']));_0x1e9343[_0xc0b9('0x9a')]=_0x1e9343[_0xc0b9('0x9a')][_0xc0b9('0x8d')]?_0x1e9343['attributes']:_0x3df3b0[_0xc0b9('0xc')];if(!_0x3eb894['query'][_0xc0b9('0x9b')](_0xc0b9('0x9c'))){_0x1e9343[_0xc0b9('0x9d')]=_0x57130d[_0xc0b9('0x9d')](_0x3eb894['query']['limit']);_0x1e9343[_0xc0b9('0x9e')]=_0x57130d[_0xc0b9('0x9e')](_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0x9e')]);}_0x1e9343[_0xc0b9('0x9f')]=_0x57130d[_0xc0b9('0xa0')](_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xa0')]);_0x1e9343['where']=_0x57130d[_0xc0b9('0x98')](_[_0xc0b9('0xa1')](_0x3eb894['query'],_0x3df3b0[_0xc0b9('0x98')]));if(_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0x4')]){_0x1e9343[_0xc0b9('0x81')]=_[_0xc0b9('0xa2')](_0x1e9343['where'],{'$or':_[_0xc0b9('0x9')](_0x2621fb,function(_0x467d71){if(_0x467d71['type'][_0xc0b9('0xa3')]!==_0xc0b9('0xa4')){var _0x3825ef={};_0x3825ef[_0x467d71[_0xc0b9('0xb')]]={'$like':'%'+_0x3eb894[_0xc0b9('0x84')]['filter']+'%'};return _0x3825ef;}})});}var _0x4dc2ed=[];var _0xcdeb8f=null;var _0x348960={};if(_0x525f45){_0xcdeb8f=_[_0xc0b9('0x94')](_0x4ed4a8,[_0xc0b9('0xd'),_0x525f45['name']]);if(_0xcdeb8f['field']){_0x348960={};if(_0x58b985[_0xc0b9('0x12')]===_0xc0b9('0x70')){_0x348960[_0xcdeb8f[_0xc0b9('0xa5')]]=_[_0xc0b9('0x9')](_0x525f45[_0xc0b9('0x8')],'id');}else{_0x348960[_0xcdeb8f[_0xc0b9('0xa5')]]=_0x525f45[_0xc0b9('0x8')];}_0x4dc2ed[_0xc0b9('0x8e')](_0x348960);}else{_0x1e9343[_0xc0b9('0x81')]['id']=_0x525f45[_0xc0b9('0x8')];}}else{for(var _0x55f14c=0x0;_0x55f14c<_0xc30d21[_0xc0b9('0x8d')];_0x55f14c++){_0xcdeb8f=_[_0xc0b9('0x94')](_0x4ed4a8,[_0xc0b9('0xd'),_0xc30d21[_0x55f14c][_0xc0b9('0xd')]]);if(_0xcdeb8f[_0xc0b9('0xb')]){_0x348960={};_0x348960[_0xcdeb8f[_0xc0b9('0xa5')]]=_0xc30d21[_0x55f14c][_0xc0b9('0x8')];_0x4dc2ed[_0xc0b9('0x8e')](_0x348960);}else{if(!_0x1e9343[_0xc0b9('0x81')]['id'])_0x1e9343[_0xc0b9('0x81')]['id']=[];_0xc30d21[_0x55f14c][_0xc0b9('0x8')][_0xc0b9('0xa6')](function(_0x501794){_0x1e9343[_0xc0b9('0x81')]['id']['push'](_0x501794);});}}}if(!_[_0xc0b9('0x92')](_0x4dc2ed)){_0x1e9343[_0xc0b9('0x81')]=_[_0xc0b9('0xa2')](_0x1e9343[_0xc0b9('0x81')],{'$and':{'$or':_0x4dc2ed}});}_0x1e9343=_[_0xc0b9('0xa2')]({},_0x1e9343,_0x3eb894[_0xc0b9('0xa7')]);if(_0x525f45&&!_0x525f45[_0xc0b9('0x95')]&&_0x58b985['childModel']===_0xc0b9('0x70')){if(_0x3eb894[_0xc0b9('0x84')]['includeAll']){_0x1e9343['include']=[{'all':!![]}];}return _0x2967f5[_0x58b985[_0xc0b9('0x12')]][_0xc0b9('0x6')](_0x1e9343)[_0xc0b9('0x7')](function(_0x127f41){var _0x1c7437=[];_0x127f41[_0xc0b9('0xa6')](function(_0x467fb3){var _0x5079a2;switch(_0x467fb3[_0xc0b9('0xa8')]){case _0xc0b9('0xa9'):_0x5079a2=_[_0xc0b9('0x94')](_0x525f45['associatedResources'],function(_0x5f0187){return _0x5f0187['id']===_0x467fb3[_0xc0b9('0x72')]&&_0x5f0187[_0xc0b9('0x35')]===_0xc0b9('0xaa');});break;case _0xc0b9('0xab'):_0x5079a2=_[_0xc0b9('0x94')](_0x525f45[_0xc0b9('0x8')],function(_0x43cf85){return _0x43cf85['id']===_0x467fb3[_0xc0b9('0x72')]&&_0x43cf85['type']===_0xc0b9('0xac');});break;}if(_0x5079a2)_0x1c7437[_0xc0b9('0x8e')](_0x467fb3);});_0x2a344e['count']=_0x1c7437[_0xc0b9('0x8d')];_0x2a344e[_0xc0b9('0xad')]=_0x1c7437;return _0x2a344e;});}else{if(!_[_0xc0b9('0x92')](_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xae')])){_0x1e9343[_0xc0b9('0x81')]['id']=_0x1e9343[_0xc0b9('0x81')]['id']?_[_0xc0b9('0x99')](_0x1e9343['where']['id'],_0x3eb894[_0xc0b9('0x84')]['ids']):_0x3eb894[_0xc0b9('0x84')]['ids'];if(_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xaf')]){_0x1e9343['order']=_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xaf')];}}if(_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xb0')]){_0x1e9343[_0xc0b9('0x81')]=_[_0xc0b9('0xa2')](_0x1e9343[_0xc0b9('0x81')],{'$and':_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xb0')]});}return _0x2967f5[_0x58b985[_0xc0b9('0x12')]]['count']({'where':_0x1e9343['where']})[_0xc0b9('0x7')](function(_0x17ae71){_0x2a344e[_0xc0b9('0xb1')]=_0x17ae71;if(_0x3eb894[_0xc0b9('0x84')]['includeAll']){if(_0x58b985[_0xc0b9('0x12')]==='CmContact'){_0x1e9343[_0xc0b9('0xb2')]=[{'model':_0x2967f5[_0xc0b9('0x67')],'as':_0xc0b9('0xb3'),'attributes':['id',_0xc0b9('0xd'),_0xc0b9('0xb4')],'required':_0x3eb894['query'][_0xc0b9('0xb5')]?!![]:![]},{'model':_0x2967f5[_0xc0b9('0x67')],'as':_0xc0b9('0xb6'),'attributes':['id','name',_0xc0b9('0xb4')],'through':_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xb5')]?{'attributes':[],'where':{'TagId':_0x3eb894['query']['tag']||undefined}}:{},'required':_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xb5')]?!![]:![]}];}else{_0x1e9343[_0xc0b9('0xb2')]=[{'all':!![]}];}}return _0x2967f5[_0x58b985['childModel']][_0xc0b9('0x6')](_0x1e9343);})[_0xc0b9('0x7')](function(_0x4cf973){_0x2a344e['rows']=_0x4cf973;if(_0x3079bd===_0xc0b9('0x2d')&&_0x3eb894[_0xc0b9('0x84')][_0xc0b9('0xb7')]===_0xc0b9('0xb8')){var _0x1679ab=[];for(var _0x14e3cc=0x0;_0x14e3cc<_0x2a344e[_0xc0b9('0xad')][_0xc0b9('0x8d')];_0x14e3cc++){_0x1679ab[_0xc0b9('0x8e')](_0x28dc02(_0xc0b9('0xb9'),_0x2a344e['rows'][_0x14e3cc]['dataValues']));_0x1679ab[_0xc0b9('0x8e')](_0x28dc02('sms',_0x2a344e[_0xc0b9('0xad')][_0x14e3cc][_0xc0b9('0xba')]));_0x1679ab['push'](_0x28dc02(_0xc0b9('0xbb'),_0x2a344e[_0xc0b9('0xad')][_0x14e3cc][_0xc0b9('0xba')]));_0x1679ab[_0xc0b9('0x8e')](_0x28dc02(_0xc0b9('0xbc'),_0x2a344e[_0xc0b9('0xad')][_0x14e3cc][_0xc0b9('0xba')]));_0x1679ab[_0xc0b9('0x8e')](_0x28dc02(_0xc0b9('0xbd'),_0x2a344e['rows'][_0x14e3cc][_0xc0b9('0xba')]));_0x1679ab[_0xc0b9('0x8e')](_0x28dc02(_0xc0b9('0xbe'),_0x2a344e[_0xc0b9('0xad')][_0x14e3cc][_0xc0b9('0xba')]));}return Promise[_0xc0b9('0x90')](_0x1679ab)['then'](function(){return _0x2a344e;});}return _0x2a344e;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 11d1241..8cef2b0 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 _0x9aac=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x4ecaea,_0x478cfa){var _0x219af4=function(_0x29a33e){while(--_0x29a33e){_0x4ecaea['push'](_0x4ecaea['shift']());}};_0x219af4(++_0x478cfa);}(_0x9aac,0x135));var _0xc9aa=function(_0x29221d,_0x56f145){_0x29221d=_0x29221d-0x0;var _0x49b3f7=_0x9aac[_0x29221d];return _0x49b3f7;};'use strict';var _=require(_0xc9aa('0x0'));var util=require('util');var moment=require(_0xc9aa('0x1'));var BPromise=require(_0xc9aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9aa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9aa('0x4'));var logger=require('../../config/logger')(_0xc9aa('0x5'));var config=require(_0xc9aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc9aa('0x7')][_0xc9aa('0x8')]({'port':0x232a});config[_0xc9aa('0x9')]=_['defaults'](config[_0xc9aa('0x9')],{'host':_0xc9aa('0xa'),'port':0x18eb});var socket=require(_0xc9aa('0xb'))(new Redis(config['redis']));require(_0xc9aa('0xc'))[_0xc9aa('0xd')](socket);function respondWithRpcPromise(_0x39c4e3,_0x54efbc,_0x55d434){return new BPromise(function(_0x32f449,_0x5346e3){return client[_0xc9aa('0xe')](_0x39c4e3,_0x55d434)[_0xc9aa('0xf')](function(_0x248d4e){logger[_0xc9aa('0x10')](_0xc9aa('0x11'),_0x54efbc,_0xc9aa('0x12'));logger[_0xc9aa('0x13')](_0xc9aa('0x14'),_0x54efbc,_0xc9aa('0x12'),JSON[_0xc9aa('0x15')](_0x248d4e));if(_0x248d4e[_0xc9aa('0x16')]){if(_0x248d4e[_0xc9aa('0x16')][_0xc9aa('0x17')]===0x1f4){logger[_0xc9aa('0x16')](_0xc9aa('0x11'),_0x54efbc,_0x248d4e[_0xc9aa('0x16')][_0xc9aa('0x18')]);return _0x5346e3(_0x248d4e['error'][_0xc9aa('0x18')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x54efbc,_0x248d4e[_0xc9aa('0x16')][_0xc9aa('0x18')]);return _0x32f449(_0x248d4e[_0xc9aa('0x16')][_0xc9aa('0x18')]);}else{logger['info'](_0xc9aa('0x11'),_0x54efbc,_0xc9aa('0x12'));_0x32f449(_0x248d4e[_0xc9aa('0x19')]['message']);}})[_0xc9aa('0x1a')](function(_0x13d32d){logger[_0xc9aa('0x16')](_0xc9aa('0x11'),_0x54efbc,_0x13d32d);_0x5346e3(_0x13d32d);});});} \ No newline at end of file +var _0x7409=['socket.io-emitter','register','then','info','error','UserProfile,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7409,0x6e));var _0x9740=function(_0x4afc2c,_0x336a88){_0x4afc2c=_0x4afc2c-0x0;var _0x164084=_0x7409[_0x4afc2c];return _0x164084;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var moment=require('moment');var BPromise=require(_0x9740('0x2'));var rs=require(_0x9740('0x3'));var fs=require('fs');var Redis=require(_0x9740('0x4'));var db=require(_0x9740('0x5'))['db'];var utils=require(_0x9740('0x6'));var logger=require(_0x9740('0x7'))(_0x9740('0x8'));var config=require(_0x9740('0x9'));var jayson=require(_0x9740('0xa'));var client=jayson['client'][_0x9740('0xb')]({'port':0x232a});config[_0x9740('0xc')]=_[_0x9740('0xd')](config['redis'],{'host':_0x9740('0xe'),'port':0x18eb});var socket=require(_0x9740('0xf'))(new Redis(config[_0x9740('0xc')]));require('./userProfile.socket')[_0x9740('0x10')](socket);function respondWithRpcPromise(_0x548bf8,_0x1a6ff9,_0xc27c18){return new BPromise(function(_0x4e39f9,_0x59dd44){return client['request'](_0x548bf8,_0xc27c18)[_0x9740('0x11')](function(_0x3bc357){logger[_0x9740('0x12')]('UserProfile,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent');logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent',JSON['stringify'](_0x3bc357));if(_0x3bc357['error']){if(_0x3bc357[_0x9740('0x13')]['code']===0x1f4){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x3bc357['error'][_0x9740('0x15')]);return _0x59dd44(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}logger[_0x9740('0x13')]('UserProfile,\x20%s,\x20%s',_0x1a6ff9,_0x3bc357[_0x9740('0x13')]['message']);return _0x4e39f9(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}else{logger[_0x9740('0x12')](_0x9740('0x14'),_0x1a6ff9,_0x9740('0x16'));_0x4e39f9(_0x3bc357[_0x9740('0x17')][_0x9740('0x15')]);}})[_0x9740('0x18')](function(_0x206c4d){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x206c4d);_0x59dd44(_0x206c4d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c0035a6..c04d25c 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 _0x1f00=['./userProfile.events','save','remove','register','length','userProfile:'];(function(_0x2af12e,_0x21203c){var _0x17fae7=function(_0x51de82){while(--_0x51de82){_0x2af12e['push'](_0x2af12e['shift']());}};_0x17fae7(++_0x21203c);}(_0x1f00,0xb4));var _0x01f0=function(_0x11cdfb,_0x571760){_0x11cdfb=_0x11cdfb-0x0;var _0x327566=_0x1f00[_0x11cdfb];return _0x327566;};'use strict';var UserProfileEvents=require(_0x01f0('0x0'));var events=[_0x01f0('0x1'),_0x01f0('0x2'),'update'];function createListener(_0x17d215,_0x24f521){return function(_0x2d1f03){_0x24f521['emit'](_0x17d215,_0x2d1f03);};}function removeListener(_0x46f37d,_0x386661){return function(){UserProfileEvents['removeListener'](_0x46f37d,_0x386661);};}exports[_0x01f0('0x3')]=function(_0x563ad1){for(var _0x3a5853=0x0,_0x1a724c=events[_0x01f0('0x4')];_0x3a5853<_0x1a724c;_0x3a5853++){var _0x5a9444=events[_0x3a5853];var _0x23c4fe=createListener(_0x01f0('0x5')+_0x5a9444,_0x563ad1);UserProfileEvents['on'](_0x5a9444,_0x23c4fe);}}; \ No newline at end of file +var _0x7f29=['removeListener','register','userProfile:','remove'];(function(_0x5c41f1,_0x598888){var _0x5f0924=function(_0x4226c2){while(--_0x4226c2){_0x5c41f1['push'](_0x5c41f1['shift']());}};_0x5f0924(++_0x598888);}(_0x7f29,0xf3));var _0x97f2=function(_0x3b6975,_0x290607){_0x3b6975=_0x3b6975-0x0;var _0x58f6ae=_0x7f29[_0x3b6975];return _0x58f6ae;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x97f2('0x0'),'update'];function createListener(_0x5d17b8,_0x405594){return function(_0x58a473){_0x405594['emit'](_0x5d17b8,_0x58a473);};}function removeListener(_0x14445a,_0x3248f6){return function(){UserProfileEvents[_0x97f2('0x1')](_0x14445a,_0x3248f6);};}exports[_0x97f2('0x2')]=function(_0x3aea2b){for(var _0x49bc00=0x0,_0x1524a3=events['length'];_0x49bc00<_0x1524a3;_0x49bc00++){var _0x1e76ca=events[_0x49bc00];var _0x5901d2=createListener(_0x97f2('0x3')+_0x1e76ca,_0x3aea2b);UserProfileEvents['on'](_0x1e76ca,_0x5901d2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2e1bc36..ef14ae0 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 _0x4bad=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','update'];(function(_0x5692ad,_0x27f1e6){var _0x26c6c0=function(_0x225450){while(--_0x225450){_0x5692ad['push'](_0x5692ad['shift']());}};_0x26c6c0(++_0x27f1e6);}(_0x4bad,0x179));var _0xd4ba=function(_0x1cfe79,_0x320b03){_0x1cfe79=_0x1cfe79-0x0;var _0x3f6e87=_0x4bad[_0x1cfe79];return _0x3f6e87;};'use strict';var multer=require(_0xd4ba('0x0'));var util=require('util');var path=require(_0xd4ba('0x1'));var timeout=require(_0xd4ba('0x2'));var express=require(_0xd4ba('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd4ba('0x4'));var interaction=require(_0xd4ba('0x5'));var config=require(_0xd4ba('0x6'));var controller=require('./userProfileResource.controller');router[_0xd4ba('0x7')]('/',auth[_0xd4ba('0x8')](),controller['index']);router[_0xd4ba('0x7')](_0xd4ba('0x9'),auth[_0xd4ba('0x8')](),controller[_0xd4ba('0xa')]);router['get'](_0xd4ba('0xb'),auth[_0xd4ba('0x8')](),controller['show']);router['post']('/',auth[_0xd4ba('0x8')](),controller[_0xd4ba('0xc')]);router['put']('/:id',auth[_0xd4ba('0x8')](),controller[_0xd4ba('0xd')]);router[_0xd4ba('0xe')](_0xd4ba('0xb'),auth[_0xd4ba('0x8')](),controller[_0xd4ba('0xf')]);module[_0xd4ba('0x10')]=router; \ No newline at end of file +var _0xd3b9=['/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0xd3b9,0xd7));var _0x9d3b=function(_0x2202bd,_0x203d44){_0x2202bd=_0x2202bd-0x0;var _0x262693=_0xd3b9[_0x2202bd];return _0x262693;};'use strict';var multer=require(_0x9d3b('0x0'));var util=require(_0x9d3b('0x1'));var path=require(_0x9d3b('0x2'));var timeout=require(_0x9d3b('0x3'));var express=require(_0x9d3b('0x4'));var router=express[_0x9d3b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9d3b('0x6'));var interaction=require(_0x9d3b('0x7'));var config=require('../../config/environment');var controller=require(_0x9d3b('0x8'));router[_0x9d3b('0x9')]('/',auth[_0x9d3b('0xa')](),controller[_0x9d3b('0xb')]);router[_0x9d3b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9d3b('0xc')]);router[_0x9d3b('0x9')](_0x9d3b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9d3b('0xe')]('/',auth[_0x9d3b('0xa')](),controller[_0x9d3b('0xf')]);router[_0x9d3b('0x10')](_0x9d3b('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9d3b('0x11')](_0x9d3b('0xd'),auth[_0x9d3b('0xa')](),controller['destroy']);module[_0x9d3b('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8a59a3a..246de2f 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 _0x9da0=['sequelize','STRING'];(function(_0x3dd317,_0x395ac2){var _0x1aa7d9=function(_0x26ac3f){while(--_0x26ac3f){_0x3dd317['push'](_0x3dd317['shift']());}};_0x1aa7d9(++_0x395ac2);}(_0x9da0,0xde));var _0x09da=function(_0x449e92,_0x3896d8){_0x449e92=_0x449e92-0x0;var _0x3fc2c9=_0x9da0[_0x449e92];return _0x3fc2c9;};'use strict';var Sequelize=require(_0x09da('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x09da('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x64d0=['sequelize','exports','STRING','INTEGER'];(function(_0xe3839f,_0x555463){var _0x43c987=function(_0x4a592f){while(--_0x4a592f){_0xe3839f['push'](_0xe3839f['shift']());}};_0x43c987(++_0x555463);}(_0x64d0,0xa0));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x064d('0x0'));module[_0x064d('0x1')]={'name':{'type':Sequelize[_0x064d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x064d('0x3')],'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 7272aa1..63af77f 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x508c0a,_0x1bcd5e){var _0x1c19b7=function(_0x21300d){while(--_0x21300d){_0x508c0a['push'](_0x508c0a['shift']());}};_0x1c19b7(++_0x1bcd5e);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x781d,0x14a));var _0xd781=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x781d[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 35f4ef0..d228a59 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 _0x4f8b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define','user_profile_has_resources','compositeIndex','sectionId'];(function(_0x36f641,_0x1a3063){var _0x39b299=function(_0x20c0a3){while(--_0x20c0a3){_0x36f641['push'](_0x36f641['shift']());}};_0x39b299(++_0x1a3063);}(_0x4f8b,0xb6));var _0xb4f8=function(_0x514816,_0x57c091){_0x514816=_0x514816-0x0;var _0x5c3a43=_0x4f8b[_0x514816];return _0x5c3a43;};'use strict';var _=require(_0xb4f8('0x0'));var util=require(_0xb4f8('0x1'));var logger=require(_0xb4f8('0x2'))(_0xb4f8('0x3'));var moment=require(_0xb4f8('0x4'));var BPromise=require(_0xb4f8('0x5'));var rp=require(_0xb4f8('0x6'));var fs=require('fs');var path=require(_0xb4f8('0x7'));var rimraf=require(_0xb4f8('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4f8('0x9'));module['exports']=function(_0x49e8a6,_0x120e96){return _0x49e8a6[_0xb4f8('0xa')]('UserProfileResource',attributes,{'tableName':_0xb4f8('0xb'),'paranoid':![],'indexes':[{'name':_0xb4f8('0xc'),'fields':['resourceId',_0xb4f8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2816=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0xb82b9a,_0x1910da){var _0x3aeb99=function(_0x1dc745){while(--_0x1dc745){_0xb82b9a['push'](_0xb82b9a['shift']());}};_0x3aeb99(++_0x1910da);}(_0x2816,0x1de));var _0x6281=function(_0x2995e1,_0x42c521){_0x2995e1=_0x2995e1-0x0;var _0x4ad4c5=_0x2816[_0x2995e1];return _0x4ad4c5;};'use strict';var _=require(_0x6281('0x0'));var util=require(_0x6281('0x1'));var logger=require(_0x6281('0x2'))('api');var moment=require(_0x6281('0x3'));var BPromise=require(_0x6281('0x4'));var rp=require(_0x6281('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6281('0x6'));var config=require(_0x6281('0x7'));var attributes=require(_0x6281('0x8'));module[_0x6281('0x9')]=function(_0x223e64,_0x59df71){return _0x223e64[_0x6281('0xa')]('UserProfileResource',attributes,{'tableName':_0x6281('0xb'),'paranoid':![],'indexes':[{'name':_0x6281('0xc'),'fields':[_0x6281('0xd'),_0x6281('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d3cd2f1..fb8daac 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 _0xe39d=['request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x4df5d3,_0x522c48){var _0x34a8d=function(_0x52f363){while(--_0x52f363){_0x4df5d3['push'](_0x4df5d3['shift']());}};_0x34a8d(++_0x522c48);}(_0xe39d,0x9a));var _0xde39=function(_0x118142,_0x44f0d6){_0x118142=_0x118142-0x0;var _0x512dfc=_0xe39d[_0x118142];return _0x512dfc;};'use strict';var _=require(_0xde39('0x0'));var util=require('util');var moment=require(_0xde39('0x1'));var BPromise=require(_0xde39('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde39('0x3'));var db=require(_0xde39('0x4'))['db'];var utils=require(_0xde39('0x5'));var logger=require(_0xde39('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xde39('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f4c93,_0x1d0f28,_0x986df4){return new BPromise(function(_0x43a2a7,_0x4369c6){return client[_0xde39('0x8')](_0x5f4c93,_0x986df4)['then'](function(_0xf49ce0){logger[_0xde39('0x9')](_0xde39('0xa'),_0x1d0f28,_0xde39('0xb'));logger[_0xde39('0xc')](_0xde39('0xd'),_0x1d0f28,_0xde39('0xb'),JSON['stringify'](_0xf49ce0));if(_0xf49ce0[_0xde39('0xe')]){if(_0xf49ce0['error'][_0xde39('0xf')]===0x1f4){logger[_0xde39('0xe')](_0xde39('0xa'),_0x1d0f28,_0xf49ce0[_0xde39('0xe')][_0xde39('0x10')]);return _0x4369c6(_0xf49ce0[_0xde39('0xe')][_0xde39('0x10')]);}logger[_0xde39('0xe')](_0xde39('0xa'),_0x1d0f28,_0xf49ce0['error'][_0xde39('0x10')]);return _0x43a2a7(_0xf49ce0[_0xde39('0xe')][_0xde39('0x10')]);}else{logger[_0xde39('0x9')](_0xde39('0xa'),_0x1d0f28,'request\x20sent');_0x43a2a7(_0xf49ce0[_0xde39('0x11')]['message']);}})['catch'](function(_0x162a60){logger[_0xde39('0xe')](_0xde39('0xa'),_0x1d0f28,_0x162a60);_0x4369c6(_0x162a60);});});} \ No newline at end of file +var _0xb48a=['info','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5bacb9,_0x58dbab){var _0x58ab22=function(_0x2469d1){while(--_0x2469d1){_0x5bacb9['push'](_0x5bacb9['shift']());}};_0x58ab22(++_0x58dbab);}(_0xb48a,0x1d5));var _0xab48=function(_0x1fc715,_0x310ef){_0x1fc715=_0x1fc715-0x0;var _0x4c92a6=_0xb48a[_0x1fc715];return _0x4c92a6;};'use strict';var _=require('lodash');var util=require(_0xab48('0x0'));var moment=require(_0xab48('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab48('0x2'));var db=require(_0xab48('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab48('0x4'))(_0xab48('0x5'));var config=require(_0xab48('0x6'));var jayson=require(_0xab48('0x7'));var client=jayson[_0xab48('0x8')][_0xab48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e83cd,_0x4d79b4,_0xae02d7){return new BPromise(function(_0x2a866b,_0x256956){return client['request'](_0x3e83cd,_0xae02d7)[_0xab48('0xa')](function(_0x26fda8){logger['info'](_0xab48('0xb'),_0x4d79b4,'request\x20sent');logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4d79b4,_0xab48('0xc'),JSON[_0xab48('0xd')](_0x26fda8));if(_0x26fda8[_0xab48('0xe')]){if(_0x26fda8[_0xab48('0xe')][_0xab48('0xf')]===0x1f4){logger['error'](_0xab48('0xb'),_0x4d79b4,_0x26fda8[_0xab48('0xe')]['message']);return _0x256956(_0x26fda8[_0xab48('0xe')][_0xab48('0x10')]);}logger[_0xab48('0xe')](_0xab48('0xb'),_0x4d79b4,_0x26fda8[_0xab48('0xe')][_0xab48('0x10')]);return _0x2a866b(_0x26fda8[_0xab48('0xe')][_0xab48('0x10')]);}else{logger[_0xab48('0x11')](_0xab48('0xb'),_0x4d79b4,_0xab48('0xc'));_0x2a866b(_0x26fda8['result'][_0xab48('0x10')]);}})['catch'](function(_0x325b3b){logger[_0xab48('0xe')](_0xab48('0xb'),_0x4d79b4,_0x325b3b);_0x256956(_0x325b3b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3f9284e..c50453e 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 _0x90bd=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','put'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x90bd,0x16b));var _0xd90b=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x90bd[_0xf0ec6e];return _0x8bbc27;};'use strict';var multer=require(_0xd90b('0x0'));var util=require(_0xd90b('0x1'));var path=require(_0xd90b('0x2'));var timeout=require(_0xd90b('0x3'));var express=require(_0xd90b('0x4'));var router=express[_0xd90b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd90b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd90b('0x7'));var controller=require(_0xd90b('0x8'));router[_0xd90b('0x9')]('/',auth[_0xd90b('0xa')](),controller['index']);router['get'](_0xd90b('0xb'),auth[_0xd90b('0xa')](),controller[_0xd90b('0xc')]);router[_0xd90b('0x9')]('/:id',auth[_0xd90b('0xa')](),controller[_0xd90b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd90b('0xe')](_0xd90b('0xf'),auth[_0xd90b('0xa')](),controller['update']);router['delete']('/:id',auth[_0xd90b('0xa')](),controller[_0xd90b('0x10')]);module[_0xd90b('0x11')]=router; \ No newline at end of file +var _0x2f35=['index','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x290a36,_0x561046){var _0xc59237=function(_0x5c0c52){while(--_0x5c0c52){_0x290a36['push'](_0x290a36['shift']());}};_0xc59237(++_0x561046);}(_0x2f35,0x15b));var _0x52f3=function(_0x50e202,_0x268014){_0x50e202=_0x50e202-0x0;var _0x4a4993=_0x2f35[_0x50e202];return _0x4a4993;};'use strict';var multer=require(_0x52f3('0x0'));var util=require(_0x52f3('0x1'));var path=require(_0x52f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52f3('0x3'));var router=express[_0x52f3('0x4')]();var fs_extra=require(_0x52f3('0x5'));var auth=require(_0x52f3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x52f3('0x7'));var controller=require(_0x52f3('0x8'));router['get']('/',auth[_0x52f3('0x9')](),controller[_0x52f3('0xa')]);router[_0x52f3('0xb')](_0x52f3('0xc'),auth[_0x52f3('0x9')](),controller[_0x52f3('0xd')]);router[_0x52f3('0xb')](_0x52f3('0xe'),auth[_0x52f3('0x9')](),controller[_0x52f3('0xf')]);router[_0x52f3('0x10')]('/',auth['isAuthenticated'](),controller[_0x52f3('0x11')]);router['put'](_0x52f3('0xe'),auth[_0x52f3('0x9')](),controller[_0x52f3('0x12')]);router[_0x52f3('0x13')]('/:id',auth[_0x52f3('0x9')](),controller['destroy']);module[_0x52f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8e9c401..69a7d30 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0x57f8,0x198));var _0x857f=function(_0x5cb71a,_0x263bdf){_0x5cb71a=_0x5cb71a-0x0;var _0x3f380f=_0x57f8[_0x5cb71a];return _0x3f380f;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file +var _0xe511=['exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x2324cd,_0x56b1b6){var _0x1ce0fe=function(_0x4245cc){while(--_0x4245cc){_0x2324cd['push'](_0x2324cd['shift']());}};_0x1ce0fe(++_0x56b1b6);}(_0xe511,0x16f));var _0x1e51=function(_0x19d707,_0x17ca70){_0x19d707=_0x19d707-0x0;var _0x4475b1=_0xe511[_0x19d707];return _0x4475b1;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x1e51('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x42e242){this[_0x1e51('0x4')](_0x1e51('0x5'),_0x42e242?_0x42e242[_0x1e51('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x1e51('0x5'))?this[_0x1e51('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 969884d..d2e1f76 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 _0x570d=['index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','UserProfileSection','then','include','rows','catch','show','params','intersection','includeAll','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','error','stack','name'];(function(_0x546b58,_0x305fef){var _0x341476=function(_0x2a1d8e){while(--_0x2a1d8e){_0x546b58['push'](_0x546b58['shift']());}};_0x341476(++_0x305fef);}(_0x570d,0x174));var _0xd570=function(_0x549bd8,_0xcfd76b){_0x549bd8=_0x549bd8-0x0;var _0x42267e=_0x570d[_0x549bd8];return _0x42267e;};'use strict';var emlformat=require(_0xd570('0x0'));var rimraf=require(_0xd570('0x1'));var zipdir=require(_0xd570('0x2'));var jsonpatch=require(_0xd570('0x3'));var rp=require('request-promise');var moment=require(_0xd570('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd570('0x5'));var path=require(_0xd570('0x6'));var sox=require(_0xd570('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd570('0x8'));var squel=require(_0xd570('0x9'));var crypto=require('crypto');var jsforce=require(_0xd570('0xa'));var deskjs=require(_0xd570('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd570('0xc'));var Redis=require('ioredis');var authService=require(_0xd570('0xd'));var qs=require(_0xd570('0xe'));var as=require(_0xd570('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd570('0x10'))(_0xd570('0x11'));var utils=require(_0xd570('0x12'));var config=require(_0xd570('0x13'));var licenseUtil=require(_0xd570('0x14'));var db=require(_0xd570('0x15'))['db'];function respondWithStatusCode(_0x303223,_0x31a7ba){_0x31a7ba=_0x31a7ba||0xcc;return function(_0x2f6586){if(_0x2f6586){return _0x303223[_0xd570('0x16')](_0x31a7ba);}return _0x303223[_0xd570('0x17')](_0x31a7ba)['end']();};}function respondWithResult(_0x2a5ea3,_0x30c1b){_0x30c1b=_0x30c1b||0xc8;return function(_0x6b67d6){if(_0x6b67d6){return _0x2a5ea3[_0xd570('0x17')](_0x30c1b)[_0xd570('0x18')](_0x6b67d6);}};}function respondWithFilteredResult(_0x3ff08e,_0x33a76c){return function(_0x10078d){if(_0x10078d){var _0x5117dc=typeof _0x33a76c[_0xd570('0x19')]===_0xd570('0x1a')&&typeof _0x33a76c[_0xd570('0x1b')]===_0xd570('0x1a');var _0x51be45=_0x10078d[_0xd570('0x1c')];var _0x269eb6=_0x5117dc?0x0:_0x33a76c[_0xd570('0x19')];var _0x2cf645=_0x5117dc?_0x10078d[_0xd570('0x1c')]:_0x33a76c[_0xd570('0x19')]+_0x33a76c[_0xd570('0x1b')];var _0x52b141;if(_0x2cf645>=_0x51be45){_0x2cf645=_0x51be45;_0x52b141=0xc8;}else{_0x52b141=0xce;}_0x3ff08e[_0xd570('0x17')](_0x52b141);return _0x3ff08e['set']('Content-Range',_0x269eb6+'-'+_0x2cf645+'/'+_0x51be45)[_0xd570('0x18')](_0x10078d);}return null;};}function patchUpdates(_0x2230b7){return function(_0x344ef3){try{jsonpatch[_0xd570('0x1d')](_0x344ef3,_0x2230b7,!![]);}catch(_0x51ecd9){return BPromise[_0xd570('0x1e')](_0x51ecd9);}return _0x344ef3[_0xd570('0x1f')]();};}function saveUpdates(_0x2b0b44,_0x4111c0){return function(_0x35a8e2){if(_0x35a8e2){return _0x35a8e2[_0xd570('0x20')](_0x2b0b44)['then'](function(_0x2fcd4f){return _0x2fcd4f;});}return null;};}function removeEntity(_0x140a24,_0x432840){return function(_0x2de3c2){if(_0x2de3c2){return _0x2de3c2['destroy']()['then'](function(){_0x140a24[_0xd570('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1af6,_0x255d2f){return function(_0x1eb550){if(!_0x1eb550){_0x4a1af6[_0xd570('0x16')](0x194);}return _0x1eb550;};}function handleError(_0x16ede8,_0x55385b){_0x55385b=_0x55385b||0x1f4;return function(_0x5b0c66){logger[_0xd570('0x21')](_0x5b0c66[_0xd570('0x22')]);if(_0x5b0c66[_0xd570('0x23')]){delete _0x5b0c66[_0xd570('0x23')];}_0x16ede8[_0xd570('0x17')](_0x55385b)['send'](_0x5b0c66);};}exports[_0xd570('0x24')]=function(_0x5dd3c8,_0x12cc98){var _0x5a5d4c={},_0x3085e6={},_0x5bb0aa={'count':0x0,'rows':[]};var _0xd4d0f8=_[_0xd570('0x25')](db['UserProfileSection'][_0xd570('0x26')],function(_0x52e6ad){return{'name':_0x52e6ad[_0xd570('0x27')],'type':_0x52e6ad[_0xd570('0x28')][_0xd570('0x29')]};});_0x3085e6[_0xd570('0x2a')]=_[_0xd570('0x25')](_0xd4d0f8,_0xd570('0x23'));_0x3085e6['query']=_[_0xd570('0x2b')](_0x5dd3c8[_0xd570('0x2c')]);_0x3085e6[_0xd570('0x2d')]=_['intersection'](_0x3085e6[_0xd570('0x2a')],_0x3085e6[_0xd570('0x2c')]);_0x5a5d4c[_0xd570('0x2e')]=_['intersection'](_0x3085e6['model'],qs[_0xd570('0x2f')](_0x5dd3c8[_0xd570('0x2c')][_0xd570('0x2f')]));_0x5a5d4c[_0xd570('0x2e')]=_0x5a5d4c['attributes'][_0xd570('0x30')]?_0x5a5d4c[_0xd570('0x2e')]:_0x3085e6[_0xd570('0x2a')];if(!_0x5dd3c8['query'][_0xd570('0x31')]('nolimit')){_0x5a5d4c[_0xd570('0x1b')]=qs['limit'](_0x5dd3c8[_0xd570('0x2c')]['limit']);_0x5a5d4c[_0xd570('0x19')]=qs[_0xd570('0x19')](_0x5dd3c8[_0xd570('0x2c')][_0xd570('0x19')]);}_0x5a5d4c['order']=qs[_0xd570('0x32')](_0x5dd3c8[_0xd570('0x2c')][_0xd570('0x32')]);_0x5a5d4c['where']=qs['filters'](_['pick'](_0x5dd3c8['query'],_0x3085e6[_0xd570('0x2d')]),_0xd4d0f8);if(_0x5dd3c8['query'][_0xd570('0x33')]){_0x5a5d4c[_0xd570('0x34')]=_[_0xd570('0x35')](_0x5a5d4c[_0xd570('0x34')],{'$or':_['map'](_0xd4d0f8,function(_0x32f411){if(_0x32f411['type']!==_0xd570('0x36')){var _0x3d59ea={};_0x3d59ea[_0x32f411[_0xd570('0x23')]]={'$like':'%'+_0x5dd3c8[_0xd570('0x2c')]['filter']+'%'};return _0x3d59ea;}})});}_0x5a5d4c=_[_0xd570('0x35')]({},_0x5a5d4c,_0x5dd3c8['options']);var _0x1b06e3={'where':_0x5a5d4c[_0xd570('0x34')]};return db[_0xd570('0x37')][_0xd570('0x1c')](_0x1b06e3)[_0xd570('0x38')](function(_0xdf368e){_0x5bb0aa[_0xd570('0x1c')]=_0xdf368e;if(_0x5dd3c8['query']['includeAll']){_0x5a5d4c[_0xd570('0x39')]=[{'all':!![]}];}return db[_0xd570('0x37')]['findAll'](_0x5a5d4c);})[_0xd570('0x38')](function(_0x155891){_0x5bb0aa[_0xd570('0x3a')]=_0x155891;return _0x5bb0aa;})[_0xd570('0x38')](respondWithFilteredResult(_0x12cc98,_0x5a5d4c))[_0xd570('0x3b')](handleError(_0x12cc98,null));};exports[_0xd570('0x3c')]=function(_0x549e14,_0x3f1fe4){var _0xb36537={'raw':![],'where':{'id':_0x549e14[_0xd570('0x3d')]['id']}},_0xab4f0b={};_0xab4f0b[_0xd570('0x2a')]=_[_0xd570('0x2b')](db[_0xd570('0x37')][_0xd570('0x26')]);_0xab4f0b[_0xd570('0x2c')]=_['keys'](_0x549e14[_0xd570('0x2c')]);_0xab4f0b[_0xd570('0x2d')]=_[_0xd570('0x3e')](_0xab4f0b[_0xd570('0x2a')],_0xab4f0b[_0xd570('0x2c')]);_0xb36537['attributes']=_['intersection'](_0xab4f0b['model'],qs[_0xd570('0x2f')](_0x549e14[_0xd570('0x2c')]['fields']));_0xb36537[_0xd570('0x2e')]=_0xb36537[_0xd570('0x2e')][_0xd570('0x30')]?_0xb36537[_0xd570('0x2e')]:_0xab4f0b[_0xd570('0x2a')];if(_0x549e14[_0xd570('0x2c')][_0xd570('0x3f')]){_0xb36537['include']=[{'all':!![]}];}_0xb36537=_[_0xd570('0x35')]({},_0xb36537,_0x549e14['options']);return db['UserProfileSection'][_0xd570('0x40')](_0xb36537)[_0xd570('0x38')](handleEntityNotFound(_0x3f1fe4,null))[_0xd570('0x38')](respondWithResult(_0x3f1fe4,null))['catch'](handleError(_0x3f1fe4,null));};exports['create']=function(_0x1bc353,_0x5096f6){return db['UserProfileSection']['create'](_0x1bc353[_0xd570('0x41')],{})[_0xd570('0x38')](respondWithResult(_0x5096f6,0xc9))[_0xd570('0x3b')](handleError(_0x5096f6,null));};exports[_0xd570('0x20')]=function(_0x2a3a26,_0x32abcc){if(_0x2a3a26['body']['id']){delete _0x2a3a26[_0xd570('0x41')]['id'];}return db[_0xd570('0x37')][_0xd570('0x40')]({'where':{'id':_0x2a3a26[_0xd570('0x3d')]['id']}})[_0xd570('0x38')](handleEntityNotFound(_0x32abcc,null))['then'](saveUpdates(_0x2a3a26['body'],null))[_0xd570('0x38')](respondWithResult(_0x32abcc,null))[_0xd570('0x3b')](handleError(_0x32abcc,null));};exports[_0xd570('0x42')]=function(_0x5ebd0e,_0x17d23a){return db[_0xd570('0x37')][_0xd570('0x40')]({'where':{'id':_0x5ebd0e[_0xd570('0x3d')]['id']}})[_0xd570('0x38')](handleEntityNotFound(_0x17d23a,null))['then'](removeEntity(_0x17d23a,null))['catch'](handleError(_0x17d23a,null));};exports['describe']=function(_0x39d802,_0x4d767){return db[_0xd570('0x37')][_0xd570('0x43')]()[_0xd570('0x38')](respondWithResult(_0x4d767,null))[_0xd570('0x3b')](handleError(_0x4d767,null));}; \ No newline at end of file +var _0xda6a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xda6a,0xc7));var _0xada6=function(_0x1cddba,_0x3e497b){_0x1cddba=_0x1cddba-0x0;var _0x4bf2d1=_0xda6a[_0x1cddba];return _0x4bf2d1;};'use strict';var emlformat=require(_0xada6('0x0'));var rimraf=require(_0xada6('0x1'));var zipdir=require(_0xada6('0x2'));var jsonpatch=require(_0xada6('0x3'));var rp=require(_0xada6('0x4'));var moment=require('moment');var BPromise=require(_0xada6('0x5'));var Mustache=require('mustache');var util=require(_0xada6('0x6'));var path=require(_0xada6('0x7'));var sox=require(_0xada6('0x8'));var csv=require(_0xada6('0x9'));var ejs=require(_0xada6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xada6('0xb'));var squel=require(_0xada6('0xc'));var crypto=require(_0xada6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xada6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xada6('0xe'));var qs=require(_0xada6('0xf'));var as=require(_0xada6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xada6('0x11'))(_0xada6('0x12'));var utils=require('../../config/utils');var config=require(_0xada6('0x13'));var licenseUtil=require(_0xada6('0x14'));var db=require(_0xada6('0x15'))['db'];function respondWithStatusCode(_0x433df5,_0x572d65){_0x572d65=_0x572d65||0xcc;return function(_0x5c9894){if(_0x5c9894){return _0x433df5[_0xada6('0x16')](_0x572d65);}return _0x433df5[_0xada6('0x17')](_0x572d65)[_0xada6('0x18')]();};}function respondWithResult(_0x4accb6,_0x346706){_0x346706=_0x346706||0xc8;return function(_0x39ed13){if(_0x39ed13){return _0x4accb6['status'](_0x346706)['json'](_0x39ed13);}};}function respondWithFilteredResult(_0x192a10,_0x357c76){return function(_0x1f08d4){if(_0x1f08d4){var _0x25b18f=typeof _0x357c76[_0xada6('0x19')]==='undefined'&&typeof _0x357c76[_0xada6('0x1a')]===_0xada6('0x1b');var _0x707c26=_0x1f08d4['count'];var _0x474ed7=_0x25b18f?0x0:_0x357c76[_0xada6('0x19')];var _0x2b4793=_0x25b18f?_0x1f08d4[_0xada6('0x1c')]:_0x357c76[_0xada6('0x19')]+_0x357c76['limit'];var _0x521bdc;if(_0x2b4793>=_0x707c26){_0x2b4793=_0x707c26;_0x521bdc=0xc8;}else{_0x521bdc=0xce;}_0x192a10['status'](_0x521bdc);return _0x192a10[_0xada6('0x1d')](_0xada6('0x1e'),_0x474ed7+'-'+_0x2b4793+'/'+_0x707c26)[_0xada6('0x1f')](_0x1f08d4);}return null;};}function patchUpdates(_0x12b6d7){return function(_0x2baf9f){try{jsonpatch[_0xada6('0x20')](_0x2baf9f,_0x12b6d7,!![]);}catch(_0x438d48){return BPromise['reject'](_0x438d48);}return _0x2baf9f[_0xada6('0x21')]();};}function saveUpdates(_0x435e4d,_0x52b5d5){return function(_0x2355d7){if(_0x2355d7){return _0x2355d7['update'](_0x435e4d)[_0xada6('0x22')](function(_0x5d5980){return _0x5d5980;});}return null;};}function removeEntity(_0x5ca418,_0x47081a){return function(_0x381ff5){if(_0x381ff5){return _0x381ff5['destroy']()[_0xada6('0x22')](function(){_0x5ca418[_0xada6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557916,_0x83a641){return function(_0x181cc2){if(!_0x181cc2){_0x557916[_0xada6('0x16')](0x194);}return _0x181cc2;};}function handleError(_0x536942,_0x2b14cf){_0x2b14cf=_0x2b14cf||0x1f4;return function(_0x486e21){logger[_0xada6('0x23')](_0x486e21['stack']);if(_0x486e21['name']){delete _0x486e21[_0xada6('0x24')];}_0x536942[_0xada6('0x17')](_0x2b14cf)[_0xada6('0x25')](_0x486e21);};}exports[_0xada6('0x26')]=function(_0x124a5e,_0x5ed6a9){var _0x440861={},_0xf34e13={},_0x26059c={'count':0x0,'rows':[]};var _0x5beb1a=_[_0xada6('0x27')](db[_0xada6('0x28')][_0xada6('0x29')],function(_0xa3ed0a){return{'name':_0xa3ed0a[_0xada6('0x2a')],'type':_0xa3ed0a[_0xada6('0x2b')]['key']};});_0xf34e13['model']=_[_0xada6('0x27')](_0x5beb1a,_0xada6('0x24'));_0xf34e13[_0xada6('0x2c')]=_[_0xada6('0x2d')](_0x124a5e[_0xada6('0x2c')]);_0xf34e13[_0xada6('0x2e')]=_[_0xada6('0x2f')](_0xf34e13[_0xada6('0x30')],_0xf34e13['query']);_0x440861[_0xada6('0x31')]=_[_0xada6('0x2f')](_0xf34e13['model'],qs[_0xada6('0x32')](_0x124a5e[_0xada6('0x2c')][_0xada6('0x32')]));_0x440861[_0xada6('0x31')]=_0x440861['attributes'][_0xada6('0x33')]?_0x440861[_0xada6('0x31')]:_0xf34e13[_0xada6('0x30')];if(!_0x124a5e[_0xada6('0x2c')]['hasOwnProperty'](_0xada6('0x34'))){_0x440861['limit']=qs[_0xada6('0x1a')](_0x124a5e['query'][_0xada6('0x1a')]);_0x440861[_0xada6('0x19')]=qs['offset'](_0x124a5e['query'][_0xada6('0x19')]);}_0x440861[_0xada6('0x35')]=qs[_0xada6('0x36')](_0x124a5e['query'][_0xada6('0x36')]);_0x440861[_0xada6('0x37')]=qs['filters'](_[_0xada6('0x38')](_0x124a5e['query'],_0xf34e13['filters']),_0x5beb1a);if(_0x124a5e[_0xada6('0x2c')][_0xada6('0x39')]){_0x440861[_0xada6('0x37')]=_[_0xada6('0x3a')](_0x440861[_0xada6('0x37')],{'$or':_[_0xada6('0x27')](_0x5beb1a,function(_0x4df40a){if(_0x4df40a[_0xada6('0x2b')]!==_0xada6('0x3b')){var _0x2cbc0d={};_0x2cbc0d[_0x4df40a[_0xada6('0x24')]]={'$like':'%'+_0x124a5e[_0xada6('0x2c')][_0xada6('0x39')]+'%'};return _0x2cbc0d;}})});}_0x440861=_['merge']({},_0x440861,_0x124a5e['options']);var _0x3a5ad9={'where':_0x440861[_0xada6('0x37')]};return db[_0xada6('0x28')][_0xada6('0x1c')](_0x3a5ad9)[_0xada6('0x22')](function(_0x4f8ddd){_0x26059c['count']=_0x4f8ddd;if(_0x124a5e[_0xada6('0x2c')][_0xada6('0x3c')]){_0x440861[_0xada6('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0xada6('0x3e')](_0x440861);})['then'](function(_0x14ddba){_0x26059c[_0xada6('0x3f')]=_0x14ddba;return _0x26059c;})['then'](respondWithFilteredResult(_0x5ed6a9,_0x440861))[_0xada6('0x40')](handleError(_0x5ed6a9,null));};exports[_0xada6('0x41')]=function(_0x5f15d5,_0x4739d6){var _0x352039={'raw':![],'where':{'id':_0x5f15d5[_0xada6('0x42')]['id']}},_0xed6206={};_0xed6206['model']=_['keys'](db['UserProfileSection'][_0xada6('0x29')]);_0xed6206[_0xada6('0x2c')]=_[_0xada6('0x2d')](_0x5f15d5[_0xada6('0x2c')]);_0xed6206[_0xada6('0x2e')]=_[_0xada6('0x2f')](_0xed6206[_0xada6('0x30')],_0xed6206[_0xada6('0x2c')]);_0x352039[_0xada6('0x31')]=_['intersection'](_0xed6206[_0xada6('0x30')],qs['fields'](_0x5f15d5[_0xada6('0x2c')]['fields']));_0x352039[_0xada6('0x31')]=_0x352039[_0xada6('0x31')][_0xada6('0x33')]?_0x352039[_0xada6('0x31')]:_0xed6206[_0xada6('0x30')];if(_0x5f15d5[_0xada6('0x2c')][_0xada6('0x3c')]){_0x352039[_0xada6('0x3d')]=[{'all':!![]}];}_0x352039=_['merge']({},_0x352039,_0x5f15d5['options']);return db[_0xada6('0x28')]['find'](_0x352039)['then'](handleEntityNotFound(_0x4739d6,null))[_0xada6('0x22')](respondWithResult(_0x4739d6,null))[_0xada6('0x40')](handleError(_0x4739d6,null));};exports['create']=function(_0x4f34d1,_0x5c8a32){return db['UserProfileSection']['create'](_0x4f34d1[_0xada6('0x43')],{})[_0xada6('0x22')](respondWithResult(_0x5c8a32,0xc9))[_0xada6('0x40')](handleError(_0x5c8a32,null));};exports['update']=function(_0x394ca1,_0x1e0605){if(_0x394ca1[_0xada6('0x43')]['id']){delete _0x394ca1[_0xada6('0x43')]['id'];}return db[_0xada6('0x28')][_0xada6('0x44')]({'where':{'id':_0x394ca1[_0xada6('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e0605,null))[_0xada6('0x22')](saveUpdates(_0x394ca1['body'],null))[_0xada6('0x22')](respondWithResult(_0x1e0605,null))[_0xada6('0x40')](handleError(_0x1e0605,null));};exports[_0xada6('0x45')]=function(_0x3a3cf7,_0x3f0443){return db[_0xada6('0x28')]['find']({'where':{'id':_0x3a3cf7[_0xada6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f0443,null))[_0xada6('0x22')](removeEntity(_0x3f0443,null))[_0xada6('0x40')](handleError(_0x3f0443,null));};exports[_0xada6('0x46')]=function(_0x73d8da,_0x151aeb){return db[_0xada6('0x28')][_0xada6('0x46')]()[_0xada6('0x22')](respondWithResult(_0x151aeb,null))[_0xada6('0x40')](handleError(_0x151aeb,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8f024c5..cd50147 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 _0xfbf7=['./userProfileSection.attributes','exports','define','user_profile_has_sections','sectionId','userProfileId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a9734,_0x5baebc){var _0xab0682=function(_0x40d75d){while(--_0x40d75d){_0x5a9734['push'](_0x5a9734['shift']());}};_0xab0682(++_0x5baebc);}(_0xfbf7,0x14b));var _0x7fbf=function(_0x69005c,_0x3185ae){_0x69005c=_0x69005c-0x0;var _0x5f5978=_0xfbf7[_0x69005c];return _0x5f5978;};'use strict';var _=require('lodash');var util=require(_0x7fbf('0x0'));var logger=require(_0x7fbf('0x1'))('api');var moment=require(_0x7fbf('0x2'));var BPromise=require(_0x7fbf('0x3'));var rp=require(_0x7fbf('0x4'));var fs=require('fs');var path=require(_0x7fbf('0x5'));var rimraf=require(_0x7fbf('0x6'));var config=require('../../config/environment');var attributes=require(_0x7fbf('0x7'));module[_0x7fbf('0x8')]=function(_0x12d9cb,_0x44c8fc){return _0x12d9cb[_0x7fbf('0x9')]('UserProfileSection',attributes,{'tableName':_0x7fbf('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7fbf('0xb'),_0x7fbf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xece1=['path','rimraf','../../config/environment','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xece1,0x89));var _0x1ece=function(_0x2702c5,_0x121a91){_0x2702c5=_0x2702c5-0x0;var _0x400d27=_0xece1[_0x2702c5];return _0x400d27;};'use strict';var _=require(_0x1ece('0x0'));var util=require(_0x1ece('0x1'));var logger=require(_0x1ece('0x2'))(_0x1ece('0x3'));var moment=require(_0x1ece('0x4'));var BPromise=require(_0x1ece('0x5'));var rp=require(_0x1ece('0x6'));var fs=require('fs');var path=require(_0x1ece('0x7'));var rimraf=require(_0x1ece('0x8'));var config=require(_0x1ece('0x9'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x219f3a,_0xb621f9){return _0x219f3a['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1ece('0xa'),_0x1ece('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 09a2207..80cb3ef 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 _0x8a1a=['info','result','lodash','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8a1a,0x110));var _0xa8a1=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8a1a[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xa8a1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa8a1('0x1'));var fs=require('fs');var Redis=require(_0xa8a1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8a1('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8a1('0x4'));var jayson=require(_0xa8a1('0x5'));var client=jayson[_0xa8a1('0x6')][_0xa8a1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f946e,_0x458c08,_0x1c2989){return new BPromise(function(_0x396154,_0xfdc516){return client[_0xa8a1('0x8')](_0x1f946e,_0x1c2989)['then'](function(_0x256311){logger['info'](_0xa8a1('0x9'),_0x458c08,_0xa8a1('0xa'));logger[_0xa8a1('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x458c08,_0xa8a1('0xa'),JSON[_0xa8a1('0xc')](_0x256311));if(_0x256311[_0xa8a1('0xd')]){if(_0x256311['error'][_0xa8a1('0xe')]===0x1f4){logger[_0xa8a1('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x458c08,_0x256311['error'][_0xa8a1('0xf')]);return _0xfdc516(_0x256311[_0xa8a1('0xd')][_0xa8a1('0xf')]);}logger[_0xa8a1('0xd')](_0xa8a1('0x9'),_0x458c08,_0x256311[_0xa8a1('0xd')][_0xa8a1('0xf')]);return _0x396154(_0x256311['error'][_0xa8a1('0xf')]);}else{logger[_0xa8a1('0x10')](_0xa8a1('0x9'),_0x458c08,_0xa8a1('0xa'));_0x396154(_0x256311[_0xa8a1('0x11')]['message']);}})['catch'](function(_0x10583b){logger[_0xa8a1('0xd')](_0xa8a1('0x9'),_0x458c08,_0x10583b);_0xfdc516(_0x10583b);});});} \ No newline at end of file +var _0xa77c=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x21f22e,_0x3868a7){var _0x3bc364=function(_0x255b24){while(--_0x255b24){_0x21f22e['push'](_0x21f22e['shift']());}};_0x3bc364(++_0x3868a7);}(_0xa77c,0x131));var _0xca77=function(_0x47042c,_0x339d8b){_0x47042c=_0x47042c-0x0;var _0x542e56=_0xa77c[_0x47042c];return _0x542e56;};'use strict';var _=require(_0xca77('0x0'));var util=require(_0xca77('0x1'));var moment=require(_0xca77('0x2'));var BPromise=require('bluebird');var rs=require(_0xca77('0x3'));var fs=require('fs');var Redis=require(_0xca77('0x4'));var db=require(_0xca77('0x5'))['db'];var utils=require(_0xca77('0x6'));var logger=require(_0xca77('0x7'))(_0xca77('0x8'));var config=require(_0xca77('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xca77('0xa')][_0xca77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41afa4,_0x59e19b,_0x2b557e){return new BPromise(function(_0x24475b,_0x400806){return client[_0xca77('0xc')](_0x41afa4,_0x2b557e)[_0xca77('0xd')](function(_0x55dc11){logger[_0xca77('0xe')](_0xca77('0xf'),_0x59e19b,_0xca77('0x10'));logger[_0xca77('0x11')](_0xca77('0x12'),_0x59e19b,_0xca77('0x10'),JSON[_0xca77('0x13')](_0x55dc11));if(_0x55dc11['error']){if(_0x55dc11[_0xca77('0x14')][_0xca77('0x15')]===0x1f4){logger[_0xca77('0x14')](_0xca77('0xf'),_0x59e19b,_0x55dc11[_0xca77('0x14')][_0xca77('0x16')]);return _0x400806(_0x55dc11['error'][_0xca77('0x16')]);}logger[_0xca77('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x59e19b,_0x55dc11[_0xca77('0x14')][_0xca77('0x16')]);return _0x24475b(_0x55dc11[_0xca77('0x14')][_0xca77('0x16')]);}else{logger[_0xca77('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x59e19b,_0xca77('0x10'));_0x24475b(_0x55dc11[_0xca77('0x17')][_0xca77('0x16')]);}})['catch'](function(_0x3f53d7){logger[_0xca77('0x14')](_0xca77('0xf'),_0x59e19b,_0x3f53d7);_0x400806(_0x3f53d7);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9848154..941345a 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4de490,_0x1ad277){var _0x31b8b7=function(_0x4a0d36){while(--_0x4a0d36){_0x4de490['push'](_0x4de490['shift']());}};_0x31b8b7(++_0x1ad277);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xcb91[_0x54ea7a];return _0x65a10d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4c8d9c,_0x5a7bac){var _0x41e860=function(_0xd6d6c5){while(--_0xd6d6c5){_0x4c8d9c['push'](_0x4c8d9c['shift']());}};_0x41e860(++_0x5a7bac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xcb91[_0x1e91eb];return _0x2af75a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 98aa143..1668c1e 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 _0xc42f=['exports','INTEGER','sequelize'];(function(_0xb88f77,_0x58677e){var _0x52c1c1=function(_0x2bc12d){while(--_0x2bc12d){_0xb88f77['push'](_0xb88f77['shift']());}};_0x52c1c1(++_0x58677e);}(_0xc42f,0x1d0));var _0xfc42=function(_0x120b87,_0x2c8cb7){_0x120b87=_0x120b87-0x0;var _0x1f8927=_0xc42f[_0x120b87];return _0x1f8927;};'use strict';var Sequelize=require(_0xfc42('0x0'));module[_0xfc42('0x1')]={'penalty':{'type':Sequelize[_0xfc42('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5a29=['INTEGER','sequelize','exports'];(function(_0x28d9ab,_0x4b68b1){var _0x5a46d9=function(_0x3b7b38){while(--_0x3b7b38){_0x28d9ab['push'](_0x28d9ab['shift']());}};_0x5a46d9(++_0x4b68b1);}(_0x5a29,0x1db));var _0x95a2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5a29[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x95a2('0x0'));module[_0x95a2('0x1')]={'penalty':{'type':Sequelize[_0x95a2('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 54cdd60..c43c2fa 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 _0xe3da=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e4b=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','../../config/environment'];(function(_0x4858ed,_0x47de67){var _0x5b74f3=function(_0xf753fa){while(--_0xf753fa){_0x4858ed['push'](_0x4858ed['shift']());}};_0x5b74f3(++_0x47de67);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x20f37d,_0x20a575){_0x20f37d=_0x20f37d-0x0;var _0x35e958=_0x0e4b[_0x20f37d];return _0x35e958;};'use strict';var _=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var logger=require(_0xb0e4('0x2'))('api');var moment=require(_0xb0e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0e4('0x4'));var attributes=require(_0xb0e4('0x5'));module['exports']=function(_0x45bdf2,_0x3b56c3){return _0x45bdf2[_0xb0e4('0x6')](_0xb0e4('0x7'),attributes,{'tableName':_0xb0e4('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 46bc7b7..948f9f9 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 _0x17da=['then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x4bb1f8,_0xe4b469){var _0xadfcc3=function(_0x4465fa){while(--_0x4465fa){_0x4bb1f8['push'](_0x4bb1f8['shift']());}};_0xadfcc3(++_0xe4b469);}(_0x17da,0x15e));var _0xa17d=function(_0x313e2e,_0x5735ac){_0x313e2e=_0x313e2e-0x0;var _0x31000d=_0x17da[_0x313e2e];return _0x31000d;};'use strict';var _=require(_0xa17d('0x0'));var util=require('util');var moment=require(_0xa17d('0x1'));var BPromise=require(_0xa17d('0x2'));var rs=require(_0xa17d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa17d('0x4'))['db'];var utils=require(_0xa17d('0x5'));var logger=require(_0xa17d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa17d('0x7'));var client=jayson[_0xa17d('0x8')][_0xa17d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c5b5,_0x89e34c,_0x4afde7){return new BPromise(function(_0x29a65a,_0x5cc7f7){return client[_0xa17d('0xa')](_0x48c5b5,_0x4afde7)[_0xa17d('0xb')](function(_0x5ead9e){logger['info'](_0xa17d('0xc'),_0x89e34c,_0xa17d('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x89e34c,_0xa17d('0xd'),JSON[_0xa17d('0xe')](_0x5ead9e));if(_0x5ead9e[_0xa17d('0xf')]){if(_0x5ead9e[_0xa17d('0xf')]['code']===0x1f4){logger[_0xa17d('0xf')](_0xa17d('0xc'),_0x89e34c,_0x5ead9e[_0xa17d('0xf')][_0xa17d('0x10')]);return _0x5cc7f7(_0x5ead9e[_0xa17d('0xf')][_0xa17d('0x10')]);}logger[_0xa17d('0xf')](_0xa17d('0xc'),_0x89e34c,_0x5ead9e[_0xa17d('0xf')]['message']);return _0x29a65a(_0x5ead9e['error'][_0xa17d('0x10')]);}else{logger[_0xa17d('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x89e34c,_0xa17d('0xd'));_0x29a65a(_0x5ead9e[_0xa17d('0x12')][_0xa17d('0x10')]);}})['catch'](function(_0x362539){logger[_0xa17d('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x89e34c,_0x362539);_0x5cc7f7(_0x362539);});});} \ No newline at end of file +var _0xb267=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x4300b1,_0x50389e){var _0x3c073d=function(_0x30c6fd){while(--_0x30c6fd){_0x4300b1['push'](_0x4300b1['shift']());}};_0x3c073d(++_0x50389e);}(_0xb267,0x15e));var _0x7b26=function(_0x35d575,_0x5f5733){_0x35d575=_0x35d575-0x0;var _0x527650=_0xb267[_0x35d575];return _0x527650;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b26('0x0'));var BPromise=require(_0x7b26('0x1'));var rs=require(_0x7b26('0x2'));var fs=require('fs');var Redis=require(_0x7b26('0x3'));var db=require(_0x7b26('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7b26('0x5'));var jayson=require(_0x7b26('0x6'));var client=jayson[_0x7b26('0x7')][_0x7b26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x308c23,_0x8b5dff,_0x360b76){return new BPromise(function(_0x592b0c,_0x30cedf){return client[_0x7b26('0x9')](_0x308c23,_0x360b76)[_0x7b26('0xa')](function(_0xb4eebb){logger[_0x7b26('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x8b5dff,'request\x20sent');logger['debug'](_0x7b26('0xc'),_0x8b5dff,_0x7b26('0xd'),JSON[_0x7b26('0xe')](_0xb4eebb));if(_0xb4eebb[_0x7b26('0xf')]){if(_0xb4eebb['error'][_0x7b26('0x10')]===0x1f4){logger[_0x7b26('0xf')](_0x7b26('0x11'),_0x8b5dff,_0xb4eebb[_0x7b26('0xf')][_0x7b26('0x12')]);return _0x30cedf(_0xb4eebb['error'][_0x7b26('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x8b5dff,_0xb4eebb['error'][_0x7b26('0x12')]);return _0x592b0c(_0xb4eebb['error'][_0x7b26('0x12')]);}else{logger[_0x7b26('0xb')](_0x7b26('0x11'),_0x8b5dff,_0x7b26('0xd'));_0x592b0c(_0xb4eebb[_0x7b26('0x13')][_0x7b26('0x12')]);}})[_0x7b26('0x14')](function(_0x2b170e){logger[_0x7b26('0xf')](_0x7b26('0x11'),_0x8b5dff,_0x2b170e);_0x30cedf(_0x2b170e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 992dcd1..fb5643c 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 _0x443e=['exports','INTEGER','sequelize'];(function(_0x1d0809,_0x591d85){var _0x3fca58=function(_0xcd0f01){while(--_0xcd0f01){_0x1d0809['push'](_0x1d0809['shift']());}};_0x3fca58(++_0x591d85);}(_0x443e,0xdd));var _0xe443=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x443e[_0x442f02];return _0xab6ef1;};'use strict';var Sequelize=require(_0xe443('0x0'));module[_0xe443('0x1')]={'UserId':{'type':Sequelize[_0xe443('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe443('0x2')]}}; \ No newline at end of file +var _0x3aa5=['sequelize','exports','INTEGER'];(function(_0x67936a,_0x2047bc){var _0x3aa79a=function(_0x467d7d){while(--_0x467d7d){_0x67936a['push'](_0x67936a['shift']());}};_0x3aa79a(++_0x2047bc);}(_0x3aa5,0x87));var _0x53aa=function(_0x39bd2f,_0x2971ba){_0x39bd2f=_0x39bd2f-0x0;var _0x5d9775=_0x3aa5[_0x39bd2f];return _0x5d9775;};'use strict';var Sequelize=require(_0x53aa('0x0'));module[_0x53aa('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x53aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3bba187..52def34 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(_0x8382f6,_0x5e3944){var _0xe599a1=function(_0x351072){while(--_0x351072){_0x8382f6['push'](_0x8382f6['shift']());}};_0xe599a1(++_0x5e3944);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x13f5a7,_0x24da6b){var _0x4bc1ca=function(_0x1f93c4){while(--_0x1f93c4){_0x13f5a7['push'](_0x13f5a7['shift']());}};_0x4bc1ca(++_0x24da6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 bb6d4ed..cb41250 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_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(_0x2d1dd2,_0x5ff0e0){var _0x5db677=function(_0x22f373){while(--_0x22f373){_0x2d1dd2['push'](_0x2d1dd2['shift']());}};_0x5db677(++_0x5ff0e0);}(_0x70e0,0x17b));var _0x070e=function(_0x5d5445,_0x49be14){_0x5d5445=_0x5d5445-0x0;var _0x37c0b7=_0x70e0[_0x5d5445];return _0x37c0b7;};'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 1d28d78..f0030fe 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 _0xb8f0=['sequelize','INTEGER'];(function(_0x1b3368,_0x714dac){var _0x454fb6=function(_0x98d4f){while(--_0x98d4f){_0x1b3368['push'](_0x1b3368['shift']());}};_0x454fb6(++_0x714dac);}(_0xb8f0,0xf2));var _0x0b8f=function(_0x3485ba,_0x3b5fa6){_0x3485ba=_0x3485ba-0x0;var _0x53b26d=_0xb8f0[_0x3485ba];return _0x53b26d;};'use strict';var Sequelize=require(_0x0b8f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0b8f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d1b=['sequelize','exports'];(function(_0x408d4c,_0x1fe565){var _0x123cd0=function(_0x40f93f){while(--_0x40f93f){_0x408d4c['push'](_0x408d4c['shift']());}};_0x123cd0(++_0x1fe565);}(_0x4d1b,0x128));var _0xb4d1=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x4d1b[_0x40aaa4];return _0x4e21e5;};'use strict';var Sequelize=require(_0xb4d1('0x0'));module[_0xb4d1('0x1')]={'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 79dac4c..9a6d8fb 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 _0xf376=['UserVoiceQueue','user_has_voice_queues','util','api','moment','bluebird','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x221d6c,_0x438a53){var _0xebcf1b=function(_0x2073d0){while(--_0x2073d0){_0x221d6c['push'](_0x221d6c['shift']());}};_0xebcf1b(++_0x438a53);}(_0xf376,0xf5));var _0x6f37=function(_0x1a9a73,_0x1b4f7a){_0x1a9a73=_0x1a9a73-0x0;var _0x5098a3=_0xf376[_0x1a9a73];return _0x5098a3;};'use strict';var _=require('lodash');var util=require(_0x6f37('0x0'));var logger=require('../../config/logger')(_0x6f37('0x1'));var moment=require(_0x6f37('0x2'));var BPromise=require(_0x6f37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f37('0x4'));var attributes=require(_0x6f37('0x5'));module['exports']=function(_0x3d135c,_0x5983f9){return _0x3d135c[_0x6f37('0x6')](_0x6f37('0x7'),attributes,{'tableName':_0x6f37('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x811e=['moment','bluebird','request-promise','../../config/environment','exports','lodash','util','api'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x811e,0x1d5));var _0xe811=function(_0x18a342,_0xe3c72f){_0x18a342=_0x18a342-0x0;var _0x10be3a=_0x811e[_0x18a342];return _0x10be3a;};'use strict';var _=require(_0xe811('0x0'));var util=require(_0xe811('0x1'));var logger=require('../../config/logger')(_0xe811('0x2'));var moment=require(_0xe811('0x3'));var BPromise=require(_0xe811('0x4'));var rp=require(_0xe811('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe811('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0xe811('0x7')]=function(_0x1115ef,_0x5a1408){return _0x1115ef['define']('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 c70323c..25ebc85 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 _0xa784=['message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xa784,0x74));var _0x4a78=function(_0x5877c4,_0x3e988d){_0x5877c4=_0x5877c4-0x0;var _0x5f2236=_0xa784[_0x5877c4];return _0x5f2236;};'use strict';var _=require('lodash');var util=require(_0x4a78('0x0'));var moment=require(_0x4a78('0x1'));var BPromise=require('bluebird');var rs=require(_0x4a78('0x2'));var fs=require('fs');var Redis=require(_0x4a78('0x3'));var db=require(_0x4a78('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a78('0x5'))(_0x4a78('0x6'));var config=require(_0x4a78('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a78('0x8')][_0x4a78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1db545,_0x388094,_0x2311cb){return new BPromise(function(_0x4086da,_0x4f23a1){return client['request'](_0x1db545,_0x2311cb)[_0x4a78('0xa')](function(_0x2f8eb8){logger[_0x4a78('0xb')](_0x4a78('0xc'),_0x388094,'request\x20sent');logger[_0x4a78('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x388094,_0x4a78('0xe'),JSON[_0x4a78('0xf')](_0x2f8eb8));if(_0x2f8eb8[_0x4a78('0x10')]){if(_0x2f8eb8[_0x4a78('0x10')]['code']===0x1f4){logger['error'](_0x4a78('0xc'),_0x388094,_0x2f8eb8[_0x4a78('0x10')][_0x4a78('0x11')]);return _0x4f23a1(_0x2f8eb8[_0x4a78('0x10')][_0x4a78('0x11')]);}logger[_0x4a78('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x388094,_0x2f8eb8['error'][_0x4a78('0x11')]);return _0x4086da(_0x2f8eb8[_0x4a78('0x10')][_0x4a78('0x11')]);}else{logger[_0x4a78('0xb')](_0x4a78('0xc'),_0x388094,_0x4a78('0xe'));_0x4086da(_0x2f8eb8[_0x4a78('0x12')][_0x4a78('0x11')]);}})['catch'](function(_0x5a68ae){logger[_0x4a78('0x10')](_0x4a78('0xc'),_0x388094,_0x5a68ae);_0x4f23a1(_0x5a68ae);});});} \ No newline at end of file +var _0x2f83=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x2f83,0x180));var _0x32f8=function(_0xcd49bd,_0x2a12a3){_0xcd49bd=_0xcd49bd-0x0;var _0xb6ee44=_0x2f83[_0xcd49bd];return _0xb6ee44;};'use strict';var _=require(_0x32f8('0x0'));var util=require(_0x32f8('0x1'));var moment=require(_0x32f8('0x2'));var BPromise=require(_0x32f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32f8('0x4'));var db=require(_0x32f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32f8('0x6'))(_0x32f8('0x7'));var config=require(_0x32f8('0x8'));var jayson=require(_0x32f8('0x9'));var client=jayson[_0x32f8('0xa')][_0x32f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ce02,_0xee71a1,_0x2e639e){return new BPromise(function(_0x375368,_0x1ba754){return client[_0x32f8('0xc')](_0x54ce02,_0x2e639e)['then'](function(_0x12187b){logger[_0x32f8('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0xee71a1,_0x32f8('0xe'));logger[_0x32f8('0xf')](_0x32f8('0x10'),_0xee71a1,_0x32f8('0xe'),JSON[_0x32f8('0x11')](_0x12187b));if(_0x12187b['error']){if(_0x12187b[_0x32f8('0x12')][_0x32f8('0x13')]===0x1f4){logger['error'](_0x32f8('0x14'),_0xee71a1,_0x12187b[_0x32f8('0x12')][_0x32f8('0x15')]);return _0x1ba754(_0x12187b[_0x32f8('0x12')]['message']);}logger['error'](_0x32f8('0x14'),_0xee71a1,_0x12187b[_0x32f8('0x12')][_0x32f8('0x15')]);return _0x375368(_0x12187b[_0x32f8('0x12')]['message']);}else{logger[_0x32f8('0xd')](_0x32f8('0x14'),_0xee71a1,_0x32f8('0xe'));_0x375368(_0x12187b['result'][_0x32f8('0x15')]);}})[_0x32f8('0x16')](function(_0x368f43){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xee71a1,_0x368f43);_0x1ba754(_0x368f43);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 45b8899..38afdec 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x43f585,_0x3f8ba8){var _0x399005=function(_0x1e0027){while(--_0x1e0027){_0x43f585['push'](_0x43f585['shift']());}};_0x399005(++_0x3f8ba8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index fe4cea8..bb0dd5b 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 _0xae3d=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x5c2c72,_0x22cf09){var _0x11c44c=function(_0x37bcca){while(--_0x37bcca){_0x5c2c72['push'](_0x5c2c72['shift']());}};_0x11c44c(++_0x22cf09);}(_0xae3d,0x148));var _0xdae3=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xae3d[_0x79b649];return _0x1af9b1;};'use strict';var Sequelize=require('sequelize');module[_0xdae3('0x0')]={'uniqueid':{'type':Sequelize[_0xdae3('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xdae3('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xdae3('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdae3('0x3')],'allowNull':![],'unique':_0xdae3('0x4'),'comment':_0xdae3('0x2')},'VoiceQueueId':{'type':Sequelize[_0xdae3('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdae3('0x4'),'comment':_0xdae3('0x2')},'penalty':{'type':Sequelize[_0xdae3('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xdae3('0x1')](0xb),'defaultValue':0x0,'comment':_0xdae3('0x2')}}; \ No newline at end of file +var _0xb3e4=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x3fefc9,_0xb564ef){var _0x2826dd=function(_0x4ce2bc){while(--_0x4ce2bc){_0x3fefc9['push'](_0x3fefc9['shift']());}};_0x2826dd(++_0xb564ef);}(_0xb3e4,0x18a));var _0x4b3e=function(_0x29d1dc,_0x59a24e){_0x29d1dc=_0x29d1dc-0x0;var _0x11c157=_0xb3e4[_0x29d1dc];return _0x11c157;};'use strict';var Sequelize=require(_0x4b3e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4b3e('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4b3e('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x4b3e('0x2')},'UserId':{'type':Sequelize[_0x4b3e('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4b3e('0x3')],'allowNull':![],'unique':_0x4b3e('0x4'),'comment':_0x4b3e('0x2')},'VoiceQueueId':{'type':Sequelize[_0x4b3e('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x4b3e('0x3')],'allowNull':![],'unique':_0x4b3e('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4b3e('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f3a50b1..e864c4b 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 _0xceea=['update','remove','emit','hook','exports','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0xceea,0x164));var _0xacee=function(_0xb1e99e,_0x5a20ef){_0xb1e99e=_0xb1e99e-0x0;var _0x11ba35=_0xceea[_0xb1e99e];return _0x11ba35;};'use strict';var EventEmitter=require(_0xacee('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xacee('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xacee('0x2')](0x0);var events={'afterCreate':_0xacee('0x3'),'afterUpdate':_0xacee('0x4'),'afterDestroy':_0xacee('0x5')};function emitEvent(_0xd74cf1){return function(_0x561d25,_0x592364,_0x4cd5e9){UserVoiceQueueRtEvents[_0xacee('0x6')](_0xd74cf1+':'+_0x561d25['id'],_0x561d25);UserVoiceQueueRtEvents[_0xacee('0x6')](_0xd74cf1,_0x561d25);_0x4cd5e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xacee('0x7')](e,emitEvent(event));}}module[_0xacee('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb6c6=['save','update','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0xcb37df,_0x167e90){var _0x5d3122=function(_0x14e707){while(--_0x14e707){_0xcb37df['push'](_0xcb37df['shift']());}};_0x5d3122(++_0x167e90);}(_0xb6c6,0x1be));var _0x6b6c=function(_0xcfe1e3,_0x1d2820){_0xcfe1e3=_0xcfe1e3-0x0;var _0x2f305e=_0xb6c6[_0xcfe1e3];return _0x2f305e;};'use strict';var EventEmitter=require(_0x6b6c('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6b6c('0x1')](0x0);var events={'afterCreate':_0x6b6c('0x2'),'afterUpdate':_0x6b6c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10d8bf){return function(_0x2635f0,_0x386c68,_0xcd6b09){UserVoiceQueueRtEvents['emit'](_0x10d8bf+':'+_0x2635f0['id'],_0x2635f0);UserVoiceQueueRtEvents[_0x6b6c('0x4')](_0x10d8bf,_0x2635f0);_0xcd6b09(null);};}for(var e in events){if(events[_0x6b6c('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x6b6c('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4c5ac03..ddb6e6b 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 _0x8365=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8365,0x176));var _0x5836=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x8365[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x5836('0x0'));var util=require(_0x5836('0x1'));var logger=require(_0x5836('0x2'))(_0x5836('0x3'));var moment=require(_0x5836('0x4'));var BPromise=require(_0x5836('0x5'));var rp=require(_0x5836('0x6'));var fs=require('fs');var path=require(_0x5836('0x7'));var rimraf=require('rimraf');var config=require(_0x5836('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x5836('0x9')]=function(_0x340ada,_0xbba5c8){return _0x340ada[_0x5836('0xa')](_0x5836('0xb'),attributes,{'tableName':_0x5836('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7901=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird'];(function(_0x22ef1d,_0x57d3aa){var _0x11d109=function(_0x5bcee0){while(--_0x5bcee0){_0x22ef1d['push'](_0x22ef1d['shift']());}};_0x11d109(++_0x57d3aa);}(_0x7901,0x97));var _0x1790=function(_0x5c04a8,_0x1cf1e2){_0x5c04a8=_0x5c04a8-0x0;var _0x415022=_0x7901[_0x5c04a8];return _0x415022;};'use strict';var _=require(_0x1790('0x0'));var util=require(_0x1790('0x1'));var logger=require('../../config/logger')(_0x1790('0x2'));var moment=require(_0x1790('0x3'));var BPromise=require(_0x1790('0x4'));var rp=require(_0x1790('0x5'));var fs=require('fs');var path=require(_0x1790('0x6'));var rimraf=require(_0x1790('0x7'));var config=require(_0x1790('0x8'));var attributes=require(_0x1790('0x9'));module[_0x1790('0xa')]=function(_0x1e9772,_0x3e6917){return _0x1e9772[_0x1790('0xb')](_0x1790('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','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 511f30a..2989071 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 _0x955c=['stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x49c6cc,_0x308bdb){var _0x22e239=function(_0x48507d){while(--_0x48507d){_0x49c6cc['push'](_0x49c6cc['shift']());}};_0x22e239(++_0x308bdb);}(_0x955c,0x12a));var _0xc955=function(_0x1f3b04,_0x1f5b64){_0x1f3b04=_0x1f3b04-0x0;var _0x203225=_0x955c[_0x1f3b04];return _0x203225;};'use strict';var _=require(_0xc955('0x0'));var util=require(_0xc955('0x1'));var moment=require('moment');var BPromise=require(_0xc955('0x2'));var rs=require(_0xc955('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc955('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc955('0x5'))(_0xc955('0x6'));var config=require('../../config/environment');var jayson=require(_0xc955('0x7'));var client=jayson['client'][_0xc955('0x8')]({'port':0x232a});config['redis']=_[_0xc955('0x9')](config[_0xc955('0xa')],{'host':_0xc955('0xb'),'port':0x18eb});var socket=require(_0xc955('0xc'))(new Redis(config[_0xc955('0xa')]));require(_0xc955('0xd'))['register'](socket);function respondWithRpcPromise(_0x1c547f,_0x4af784,_0x30216c){return new BPromise(function(_0x47e8e7,_0x439931){return client[_0xc955('0xe')](_0x1c547f,_0x30216c)[_0xc955('0xf')](function(_0x2c0078){logger['info'](_0xc955('0x10'),_0x4af784,_0xc955('0x11'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4af784,_0xc955('0x11'),JSON['stringify'](_0x2c0078));if(_0x2c0078[_0xc955('0x12')]){if(_0x2c0078[_0xc955('0x12')]['code']===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4af784,_0x2c0078[_0xc955('0x12')][_0xc955('0x13')]);return _0x439931(_0x2c0078[_0xc955('0x12')][_0xc955('0x13')]);}logger[_0xc955('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4af784,_0x2c0078['error'][_0xc955('0x13')]);return _0x47e8e7(_0x2c0078['error'][_0xc955('0x13')]);}else{logger[_0xc955('0x14')](_0xc955('0x10'),_0x4af784,_0xc955('0x11'));_0x47e8e7(_0x2c0078[_0xc955('0x15')]['message']);}})[_0xc955('0x16')](function(_0x1f397c){logger[_0xc955('0x12')](_0xc955('0x10'),_0x4af784,_0x1f397c);_0x439931(_0x1f397c);});});}exports[_0xc955('0x17')]=function(_0x18cf3a){var _0xab9a2=this;return new Promise(function(_0x1b1372,_0xf2011a){return db[_0xc955('0x18')][_0xc955('0x19')]({'raw':_0x18cf3a[_0xc955('0x1a')]?_0x18cf3a[_0xc955('0x1a')][_0xc955('0x1b')]===undefined?!![]:![]:!![],'where':_0x18cf3a[_0xc955('0x1a')]?_0x18cf3a[_0xc955('0x1a')]['where']||null:null,'attributes':[[db[_0xc955('0x1c')]['fn'](_0xc955('0x1d'),db['sequelize']['fn']('IF',db[_0xc955('0x1c')]['literal'](_0xc955('0x1e')))),_0xc955('0x1f')]]})[_0xc955('0xf')](function(_0x27d799){logger['info'](_0xc955('0x17'),_0x18cf3a);logger['debug']('GetVoiceQueueRtPauses',_0x18cf3a,JSON[_0xc955('0x20')](_0x27d799));_0x1b1372(_0x27d799);})[_0xc955('0x16')](function(_0x5022b7){logger[_0xc955('0x12')]('GetVoiceQueueRtPauses',_0x5022b7[_0xc955('0x13')],_0x18cf3a);_0xf2011a(_0xab9a2[_0xc955('0x12')](0x1f4,_0x5022b7[_0xc955('0x13')]));});});}; \ No newline at end of file +var _0x6d31=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','util','moment','bluebird','randomstring','ioredis'];(function(_0x14bdfb,_0x7ebb3c){var _0x433477=function(_0x499bf6){while(--_0x499bf6){_0x14bdfb['push'](_0x14bdfb['shift']());}};_0x433477(++_0x7ebb3c);}(_0x6d31,0x6d));var _0x16d3=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6d31[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0x16d3('0x0'));var moment=require(_0x16d3('0x1'));var BPromise=require(_0x16d3('0x2'));var rs=require(_0x16d3('0x3'));var fs=require('fs');var Redis=require(_0x16d3('0x4'));var db=require(_0x16d3('0x5'))['db'];var utils=require(_0x16d3('0x6'));var logger=require(_0x16d3('0x7'))(_0x16d3('0x8'));var config=require('../../config/environment');var jayson=require(_0x16d3('0x9'));var client=jayson[_0x16d3('0xa')][_0x16d3('0xb')]({'port':0x232a});config[_0x16d3('0xc')]=_[_0x16d3('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x16d3('0xe'))(new Redis(config['redis']));require(_0x16d3('0xf'))[_0x16d3('0x10')](socket);function respondWithRpcPromise(_0x384705,_0x424085,_0x4d2cc0){return new BPromise(function(_0x5c29d2,_0x51d560){return client[_0x16d3('0x11')](_0x384705,_0x4d2cc0)[_0x16d3('0x12')](function(_0xd6af){logger[_0x16d3('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x424085,_0x16d3('0x14'));logger[_0x16d3('0x15')](_0x16d3('0x16'),_0x424085,_0x16d3('0x14'),JSON[_0x16d3('0x17')](_0xd6af));if(_0xd6af[_0x16d3('0x18')]){if(_0xd6af['error'][_0x16d3('0x19')]===0x1f4){logger[_0x16d3('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x424085,_0xd6af[_0x16d3('0x18')][_0x16d3('0x1a')]);return _0x51d560(_0xd6af['error']['message']);}logger[_0x16d3('0x18')](_0x16d3('0x1b'),_0x424085,_0xd6af[_0x16d3('0x18')]['message']);return _0x5c29d2(_0xd6af[_0x16d3('0x18')][_0x16d3('0x1a')]);}else{logger['info'](_0x16d3('0x1b'),_0x424085,_0x16d3('0x14'));_0x5c29d2(_0xd6af[_0x16d3('0x1c')][_0x16d3('0x1a')]);}})[_0x16d3('0x1d')](function(_0x3888e7){logger[_0x16d3('0x18')](_0x16d3('0x1b'),_0x424085,_0x3888e7);_0x51d560(_0x3888e7);});});}exports[_0x16d3('0x1e')]=function(_0xd210f7){var _0x40980d=this;return new Promise(function(_0x114c5f,_0xb804dd){return db[_0x16d3('0x1f')][_0x16d3('0x20')]({'raw':_0xd210f7['options']?_0xd210f7[_0x16d3('0x21')][_0x16d3('0x22')]===undefined?!![]:![]:!![],'where':_0xd210f7[_0x16d3('0x21')]?_0xd210f7[_0x16d3('0x21')]['where']||null:null,'attributes':[[db[_0x16d3('0x23')]['fn']('COUNT',db[_0x16d3('0x23')]['fn']('IF',db['sequelize'][_0x16d3('0x24')](_0x16d3('0x25')))),'outboundQueuePauses']]})[_0x16d3('0x12')](function(_0x5b3219){logger['info']('GetVoiceQueueRtPauses',_0xd210f7);logger['debug'](_0x16d3('0x1e'),_0xd210f7,JSON[_0x16d3('0x17')](_0x5b3219));_0x114c5f(_0x5b3219);})[_0x16d3('0x1d')](function(_0x511505){logger[_0x16d3('0x18')](_0x16d3('0x1e'),_0x511505[_0x16d3('0x1a')],_0xd210f7);_0xb804dd(_0x40980d['error'](0x1f4,_0x511505['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 391177c..432cde7 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 _0x6657=['update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x736618,_0x2907cf){var _0x31ada6=function(_0x4ab05c){while(--_0x4ab05c){_0x736618['push'](_0x736618['shift']());}};_0x31ada6(++_0x2907cf);}(_0x6657,0x17f));var _0x7665=function(_0x3da7ab,_0x2e00dc){_0x3da7ab=_0x3da7ab-0x0;var _0x4819ed=_0x6657[_0x3da7ab];return _0x4819ed;};'use strict';var UserVoiceQueueRtEvents=require(_0x7665('0x0'));var events=['save',_0x7665('0x1'),_0x7665('0x2')];function createListener(_0x40f0aa,_0x3b7cc4){return function(_0x5c6cda){_0x3b7cc4[_0x7665('0x3')](_0x40f0aa,_0x5c6cda);};}function removeListener(_0x2ed8cb,_0x26acc4){return function(){UserVoiceQueueRtEvents[_0x7665('0x4')](_0x2ed8cb,_0x26acc4);};}exports[_0x7665('0x5')]=function(_0x28b410){for(var _0x1a6f2f=0x0,_0x3387d8=events['length'];_0x1a6f2f<_0x3387d8;_0x1a6f2f++){var _0x31da89=events[_0x1a6f2f];var _0x464ec1=createListener(_0x7665('0x6')+_0x31da89,_0x28b410);UserVoiceQueueRtEvents['on'](_0x31da89,_0x464ec1);}}; \ No newline at end of file +var _0xc051=['length','./userVoiceQueueRt.events','save','emit','removeListener','register'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xc051,0xb5));var _0x1c05=function(_0x17d646,_0x1e94df){_0x17d646=_0x17d646-0x0;var _0x369353=_0xc051[_0x17d646];return _0x369353;};'use strict';var UserVoiceQueueRtEvents=require(_0x1c05('0x0'));var events=[_0x1c05('0x1'),'remove','update'];function createListener(_0x502bb6,_0x3d0368){return function(_0x151bdf){_0x3d0368[_0x1c05('0x2')](_0x502bb6,_0x151bdf);};}function removeListener(_0x5d181d,_0x352877){return function(){UserVoiceQueueRtEvents[_0x1c05('0x3')](_0x5d181d,_0x352877);};}exports[_0x1c05('0x4')]=function(_0x294fcb){for(var _0x14284f=0x0,_0x28a978=events[_0x1c05('0x5')];_0x14284f<_0x28a978;_0x14284f++){var _0x44d233=events[_0x14284f];var _0x87b897=createListener('userVoiceQueueRt:'+_0x44d233,_0x294fcb);UserVoiceQueueRtEvents['on'](_0x44d233,_0x87b897);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1daf55e..6919323 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(_0x25e214,_0x42a13e){var _0x48ca06=function(_0x34c6ca){while(--_0x34c6ca){_0x25e214['push'](_0x25e214['shift']());}};_0x48ca06(++_0x42a13e);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xe4b358,_0x36c25c){var _0x394873=function(_0x37c696){while(--_0x37c696){_0xe4b358['push'](_0xe4b358['shift']());}};_0x394873(++_0x36c25c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xcb91[_0x337748];return _0x3bb03f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0bc939b..f5a2a0c 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 _0x93b4=['sequelize','exports'];(function(_0x322bd1,_0x82d137){var _0x28cad7=function(_0x17185f){while(--_0x17185f){_0x322bd1['push'](_0x322bd1['shift']());}};_0x28cad7(++_0x82d137);}(_0x93b4,0x1c4));var _0x493b=function(_0x5bc647,_0x37db43){_0x5bc647=_0x5bc647-0x0;var _0x48fc98=_0x93b4[_0x5bc647];return _0x48fc98;};'use strict';var Sequelize=require(_0x493b('0x0'));module[_0x493b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa95a=['exports','sequelize'];(function(_0x4a5ba4,_0x1c18a7){var _0x2247e7=function(_0x4ddeeb){while(--_0x4ddeeb){_0x4a5ba4['push'](_0x4a5ba4['shift']());}};_0x2247e7(++_0x1c18a7);}(_0xa95a,0x191));var _0xaa95=function(_0x3722f9,_0x32d494){_0x3722f9=_0x3722f9-0x0;var _0x1d22a1=_0xa95a[_0x3722f9];return _0x1d22a1;};'use strict';var Sequelize=require(_0xaa95('0x0'));module[_0xaa95('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 a4e881b..064ab1e 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 _0xf4d4=['request-promise','path','rimraf','exports','define','user_has_whatsapp_queues','../../config/logger','api','moment','bluebird'];(function(_0x3c11e5,_0x72618c){var _0x163e43=function(_0x246ecc){while(--_0x246ecc){_0x3c11e5['push'](_0x3c11e5['shift']());}};_0x163e43(++_0x72618c);}(_0xf4d4,0x9c));var _0x4f4d=function(_0xfdd296,_0x53e76b){_0xfdd296=_0xfdd296-0x0;var _0x9d76ba=_0xf4d4[_0xfdd296];return _0x9d76ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f4d('0x0'))(_0x4f4d('0x1'));var moment=require(_0x4f4d('0x2'));var BPromise=require(_0x4f4d('0x3'));var rp=require(_0x4f4d('0x4'));var fs=require('fs');var path=require(_0x4f4d('0x5'));var rimraf=require(_0x4f4d('0x6'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x4f4d('0x7')]=function(_0x3cdce7,_0x13c3f8){return _0x3cdce7[_0x4f4d('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x4f4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a99=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x39092b,_0x39c819){var _0x5bd171=function(_0x5e165c){while(--_0x5e165c){_0x39092b['push'](_0x39092b['shift']());}};_0x5bd171(++_0x39c819);}(_0x8a99,0x7c));var _0x98a9=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x8a99[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x98a9('0x0'));var util=require(_0x98a9('0x1'));var logger=require(_0x98a9('0x2'))(_0x98a9('0x3'));var moment=require(_0x98a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x98a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98a9('0x6'));var config=require(_0x98a9('0x7'));var attributes=require(_0x98a9('0x8'));module[_0x98a9('0x9')]=function(_0x2f0465,_0xd708bd){return _0x2f0465[_0x98a9('0xa')](_0x98a9('0xb'),attributes,{'tableName':_0x98a9('0xc'),'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 d2aa228..a06fa36 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 _0x8d59=['code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x8d59,0x1d2));var _0x98d5=function(_0x1eccd6,_0x4f1284){_0x1eccd6=_0x1eccd6-0x0;var _0x10f7dc=_0x8d59[_0x1eccd6];return _0x10f7dc;};'use strict';var _=require(_0x98d5('0x0'));var util=require(_0x98d5('0x1'));var moment=require(_0x98d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x98d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98d5('0x4'));var logger=require('../../config/logger')(_0x98d5('0x5'));var config=require(_0x98d5('0x6'));var jayson=require(_0x98d5('0x7'));var client=jayson[_0x98d5('0x8')][_0x98d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a8ca0,_0x349189,_0x2d520e){return new BPromise(function(_0xa0557a,_0xed0f06){return client[_0x98d5('0xa')](_0x4a8ca0,_0x2d520e)[_0x98d5('0xb')](function(_0x247044){logger[_0x98d5('0xc')](_0x98d5('0xd'),_0x349189,_0x98d5('0xe'));logger[_0x98d5('0xf')](_0x98d5('0x10'),_0x349189,_0x98d5('0xe'),JSON['stringify'](_0x247044));if(_0x247044[_0x98d5('0x11')]){if(_0x247044[_0x98d5('0x11')][_0x98d5('0x12')]===0x1f4){logger[_0x98d5('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x349189,_0x247044[_0x98d5('0x11')][_0x98d5('0x13')]);return _0xed0f06(_0x247044['error'][_0x98d5('0x13')]);}logger['error'](_0x98d5('0xd'),_0x349189,_0x247044[_0x98d5('0x11')][_0x98d5('0x13')]);return _0xa0557a(_0x247044['error']['message']);}else{logger[_0x98d5('0xc')](_0x98d5('0xd'),_0x349189,_0x98d5('0xe'));_0xa0557a(_0x247044[_0x98d5('0x14')]['message']);}})[_0x98d5('0x15')](function(_0x360f6a){logger[_0x98d5('0x11')](_0x98d5('0xd'),_0x349189,_0x360f6a);_0xed0f06(_0x360f6a);});});} \ No newline at end of file +var _0x4645=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0x4645,0x1ea));var _0x5464=function(_0x11e368,_0x1320e8){_0x11e368=_0x11e368-0x0;var _0x294f52=_0x4645[_0x11e368];return _0x294f52;};'use strict';var _=require(_0x5464('0x0'));var util=require(_0x5464('0x1'));var moment=require(_0x5464('0x2'));var BPromise=require(_0x5464('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5464('0x4'))['db'];var utils=require(_0x5464('0x5'));var logger=require(_0x5464('0x6'))(_0x5464('0x7'));var config=require(_0x5464('0x8'));var jayson=require(_0x5464('0x9'));var client=jayson['client'][_0x5464('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b7645,_0x14870a,_0x5b0df5){return new BPromise(function(_0x463b3f,_0x4359cd){return client[_0x5464('0xb')](_0x5b7645,_0x5b0df5)[_0x5464('0xc')](function(_0x5c379a){logger[_0x5464('0xd')](_0x5464('0xe'),_0x14870a,_0x5464('0xf'));logger[_0x5464('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x14870a,_0x5464('0xf'),JSON[_0x5464('0x11')](_0x5c379a));if(_0x5c379a['error']){if(_0x5c379a[_0x5464('0x12')][_0x5464('0x13')]===0x1f4){logger[_0x5464('0x12')](_0x5464('0xe'),_0x14870a,_0x5c379a[_0x5464('0x12')][_0x5464('0x14')]);return _0x4359cd(_0x5c379a[_0x5464('0x12')][_0x5464('0x14')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x14870a,_0x5c379a['error'][_0x5464('0x14')]);return _0x463b3f(_0x5c379a[_0x5464('0x12')][_0x5464('0x14')]);}else{logger['info'](_0x5464('0xe'),_0x14870a,_0x5464('0xf'));_0x463b3f(_0x5c379a['result'][_0x5464('0x14')]);}})['catch'](function(_0x47da40){logger[_0x5464('0x12')](_0x5464('0xe'),_0x14870a,_0x47da40);_0x4359cd(_0x47da40);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6a3f849..d8ecc74 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 _0xc1c4=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show','create','put','/:id','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x5cbc07,_0x378287){_0x5cbc07=_0x5cbc07-0x0;var _0x3be1e0=_0xc1c4[_0x5cbc07];return _0x3be1e0;};'use strict';var multer=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var path=require(_0x4c1c('0x2'));var timeout=require(_0x4c1c('0x3'));var express=require(_0x4c1c('0x4'));var router=express[_0x4c1c('0x5')]();var fs_extra=require(_0x4c1c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4c1c('0x7'));var config=require(_0x4c1c('0x8'));var controller=require(_0x4c1c('0x9'));router[_0x4c1c('0xa')]('/',auth['isAuthenticated'](),controller[_0x4c1c('0xb')]);router['get']('/:id',auth[_0x4c1c('0xc')](),controller[_0x4c1c('0xd')]);router['post']('/',auth[_0x4c1c('0xc')](),controller[_0x4c1c('0xe')]);router[_0x4c1c('0xf')](_0x4c1c('0x10'),auth[_0x4c1c('0xc')](),controller['update']);router['delete'](_0x4c1c('0x10'),auth[_0x4c1c('0xc')](),controller[_0x4c1c('0x11')]);module[_0x4c1c('0x12')]=router; \ No newline at end of file +var _0x956a=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','util','path','connect-timeout','express','Router'];(function(_0x48a108,_0x355314){var _0x44458d=function(_0x2e8cad){while(--_0x2e8cad){_0x48a108['push'](_0x48a108['shift']());}};_0x44458d(++_0x355314);}(_0x956a,0xb6));var _0xa956=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x956a[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xa956('0x0'));var path=require(_0xa956('0x1'));var timeout=require(_0xa956('0x2'));var express=require(_0xa956('0x3'));var router=express[_0xa956('0x4')]();var fs_extra=require(_0xa956('0x5'));var auth=require(_0xa956('0x6'));var interaction=require(_0xa956('0x7'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xa956('0x8')]('/',auth[_0xa956('0x9')](),controller[_0xa956('0xa')]);router['get'](_0xa956('0xb'),auth[_0xa956('0x9')](),controller[_0xa956('0xc')]);router[_0xa956('0xd')]('/',auth[_0xa956('0x9')](),controller[_0xa956('0xe')]);router[_0xa956('0xf')]('/:id',auth[_0xa956('0x9')](),controller[_0xa956('0x10')]);router['delete'](_0xa956('0xb'),auth[_0xa956('0x9')](),controller['destroy']);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 08fb23d..82f321b 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 _0x7f2b=['name','sequelize','exports','STRING'];(function(_0x1f2fbf,_0xfe8bcc){var _0xef8cfa=function(_0x4de263){while(--_0x4de263){_0x1f2fbf['push'](_0x1f2fbf['shift']());}};_0xef8cfa(++_0xfe8bcc);}(_0x7f2b,0x11d));var _0xb7f2=function(_0x17d061,_0x2703b1){_0x17d061=_0x17d061-0x0;var _0x500844=_0x7f2b[_0x17d061];return _0x500844;};'use strict';var Sequelize=require(_0xb7f2('0x0'));module[_0xb7f2('0x1')]={'name':{'type':Sequelize[_0xb7f2('0x2')],'unique':_0xb7f2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb7f2('0x2')]}}; \ No newline at end of file +var _0x4c85=['sequelize','STRING','name'];(function(_0x23d5fe,_0x59c243){var _0x4524b2=function(_0x501392){while(--_0x501392){_0x23d5fe['push'](_0x23d5fe['shift']());}};_0x4524b2(++_0x59c243);}(_0x4c85,0xa5));var _0x54c8=function(_0x46cec7,_0x4ec5e0){_0x46cec7=_0x46cec7-0x0;var _0x332904=_0x4c85[_0x46cec7];return _0x332904;};'use strict';var Sequelize=require(_0x54c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x54c8('0x1')],'unique':_0x54c8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x54c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6e1bdee..942006b 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 _0x8953=['mustache','sox','ejs','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Variables','UserProfileResource','end','error','name','send','map','Variable','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xd80264,_0x4ddf21){var _0x55da7c=function(_0x124fae){while(--_0x124fae){_0xd80264['push'](_0xd80264['shift']());}};_0x55da7c(++_0x4ddf21);}(_0x8953,0x180));var _0x3895=function(_0x11fdb4,_0x126ff0){_0x11fdb4=_0x11fdb4-0x0;var _0x7a2344=_0x8953[_0x11fdb4];return _0x7a2344;};'use strict';var emlformat=require(_0x3895('0x0'));var rimraf=require(_0x3895('0x1'));var zipdir=require(_0x3895('0x2'));var jsonpatch=require(_0x3895('0x3'));var rp=require(_0x3895('0x4'));var moment=require(_0x3895('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3895('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3895('0x7'));var csv=require('to-csv');var ejs=require(_0x3895('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3895('0x9'));var crypto=require(_0x3895('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3895('0xb'));var querystring=require(_0x3895('0xc'));var Papa=require('papaparse');var Redis=require(_0x3895('0xd'));var authService=require(_0x3895('0xe'));var qs=require(_0x3895('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3895('0x10'));var logger=require('../../config/logger')(_0x3895('0x11'));var utils=require(_0x3895('0x12'));var config=require(_0x3895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3895('0x14'))['db'];function respondWithStatusCode(_0x39bc53,_0x79c641){_0x79c641=_0x79c641||0xcc;return function(_0x5b4eae){if(_0x5b4eae){return _0x39bc53[_0x3895('0x15')](_0x79c641);}return _0x39bc53[_0x3895('0x16')](_0x79c641)['end']();};}function respondWithResult(_0x1d8404,_0x2da76b){_0x2da76b=_0x2da76b||0xc8;return function(_0x478c3b){if(_0x478c3b){return _0x1d8404[_0x3895('0x16')](_0x2da76b)[_0x3895('0x17')](_0x478c3b);}};}function respondWithFilteredResult(_0x247f80,_0x1c3928){return function(_0x16ab3c){if(_0x16ab3c){var _0x15e351=typeof _0x1c3928[_0x3895('0x18')]===_0x3895('0x19')&&typeof _0x1c3928[_0x3895('0x1a')]===_0x3895('0x19');var _0x440724=_0x16ab3c['count'];var _0x4b449f=_0x15e351?0x0:_0x1c3928[_0x3895('0x18')];var _0x558ee5=_0x15e351?_0x16ab3c[_0x3895('0x1b')]:_0x1c3928[_0x3895('0x18')]+_0x1c3928[_0x3895('0x1a')];var _0x504433;if(_0x558ee5>=_0x440724){_0x558ee5=_0x440724;_0x504433=0xc8;}else{_0x504433=0xce;}_0x247f80[_0x3895('0x16')](_0x504433);return _0x247f80[_0x3895('0x1c')](_0x3895('0x1d'),_0x4b449f+'-'+_0x558ee5+'/'+_0x440724)[_0x3895('0x17')](_0x16ab3c);}return null;};}function patchUpdates(_0x57b3ed){return function(_0x42041e){try{jsonpatch['apply'](_0x42041e,_0x57b3ed,!![]);}catch(_0x43541d){return BPromise['reject'](_0x43541d);}return _0x42041e[_0x3895('0x1e')]();};}function saveUpdates(_0x12414b,_0x4d5858){return function(_0x2c4e05){if(_0x2c4e05){return _0x2c4e05[_0x3895('0x1f')](_0x12414b)[_0x3895('0x20')](function(_0x1ca863){return _0x1ca863;});}return null;};}function removeEntity(_0x101f74,_0x3a06ff){return function(_0x2ca055){if(_0x2ca055){return _0x2ca055[_0x3895('0x21')]()[_0x3895('0x20')](function(){var _0x548369=_0x2ca055[_0x3895('0x22')]({'plain':!![]});var _0x587ba7=_0x3895('0x23');return db[_0x3895('0x24')][_0x3895('0x21')]({'where':{'type':_0x587ba7,'resourceId':_0x548369['id']}})[_0x3895('0x20')](function(){return _0x2ca055;});})[_0x3895('0x20')](function(){_0x101f74[_0x3895('0x16')](0xcc)[_0x3895('0x25')]();});}};}function handleEntityNotFound(_0x8330da,_0x8ac50d){return function(_0x5cd866){if(!_0x5cd866){_0x8330da[_0x3895('0x15')](0x194);}return _0x5cd866;};}function handleError(_0x2c0ea6,_0xea3a55){_0xea3a55=_0xea3a55||0x1f4;return function(_0x320367){logger[_0x3895('0x26')](_0x320367['stack']);if(_0x320367[_0x3895('0x27')]){delete _0x320367[_0x3895('0x27')];}_0x2c0ea6[_0x3895('0x16')](_0xea3a55)[_0x3895('0x28')](_0x320367);};}exports['index']=function(_0x23cf6f,_0x24eb00){var _0x380b6d={},_0x418e87={},_0x2b548f={'count':0x0,'rows':[]};var _0x260a81=_[_0x3895('0x29')](db[_0x3895('0x2a')][_0x3895('0x2b')],function(_0x1fab66){return{'name':_0x1fab66[_0x3895('0x2c')],'type':_0x1fab66[_0x3895('0x2d')]['key']};});_0x418e87[_0x3895('0x2e')]=_['map'](_0x260a81,'name');_0x418e87['query']=_[_0x3895('0x2f')](_0x23cf6f[_0x3895('0x30')]);_0x418e87[_0x3895('0x31')]=_[_0x3895('0x32')](_0x418e87[_0x3895('0x2e')],_0x418e87['query']);_0x380b6d[_0x3895('0x33')]=_[_0x3895('0x32')](_0x418e87[_0x3895('0x2e')],qs[_0x3895('0x34')](_0x23cf6f['query'][_0x3895('0x34')]));_0x380b6d[_0x3895('0x33')]=_0x380b6d[_0x3895('0x33')][_0x3895('0x35')]?_0x380b6d['attributes']:_0x418e87[_0x3895('0x2e')];if(!_0x23cf6f[_0x3895('0x30')][_0x3895('0x36')](_0x3895('0x37'))){_0x380b6d['limit']=qs['limit'](_0x23cf6f['query'][_0x3895('0x1a')]);_0x380b6d[_0x3895('0x18')]=qs[_0x3895('0x18')](_0x23cf6f['query'][_0x3895('0x18')]);}_0x380b6d['order']=qs[_0x3895('0x38')](_0x23cf6f[_0x3895('0x30')][_0x3895('0x38')]);_0x380b6d[_0x3895('0x39')]=qs[_0x3895('0x31')](_[_0x3895('0x3a')](_0x23cf6f['query'],_0x418e87['filters']),_0x260a81);if(_0x23cf6f[_0x3895('0x30')][_0x3895('0x3b')]){_0x380b6d[_0x3895('0x39')]=_['merge'](_0x380b6d['where'],{'$or':_[_0x3895('0x29')](_0x260a81,function(_0x41cb3e){if(_0x41cb3e[_0x3895('0x2d')]!==_0x3895('0x3c')){var _0x1c4b87={};_0x1c4b87[_0x41cb3e[_0x3895('0x27')]]={'$like':'%'+_0x23cf6f[_0x3895('0x30')][_0x3895('0x3b')]+'%'};return _0x1c4b87;}})});}_0x380b6d=_['merge']({},_0x380b6d,_0x23cf6f[_0x3895('0x3d')]);var _0x27d124={'where':_0x380b6d[_0x3895('0x39')]};return db['Variable'][_0x3895('0x1b')](_0x27d124)[_0x3895('0x20')](function(_0x50f07b){_0x2b548f['count']=_0x50f07b;if(_0x23cf6f[_0x3895('0x30')]['includeAll']){_0x380b6d[_0x3895('0x3e')]=[{'all':!![]}];}return db[_0x3895('0x2a')][_0x3895('0x3f')](_0x380b6d);})[_0x3895('0x20')](function(_0x283ac1){_0x2b548f[_0x3895('0x40')]=_0x283ac1;return _0x2b548f;})[_0x3895('0x20')](respondWithFilteredResult(_0x24eb00,_0x380b6d))[_0x3895('0x41')](handleError(_0x24eb00,null));};exports['show']=function(_0x228221,_0x205f2c){var _0x20860a={'raw':!![],'where':{'id':_0x228221['params']['id']}},_0x3e219b={};_0x3e219b[_0x3895('0x2e')]=_[_0x3895('0x2f')](db[_0x3895('0x2a')][_0x3895('0x2b')]);_0x3e219b[_0x3895('0x30')]=_[_0x3895('0x2f')](_0x228221[_0x3895('0x30')]);_0x3e219b[_0x3895('0x31')]=_[_0x3895('0x32')](_0x3e219b[_0x3895('0x2e')],_0x3e219b[_0x3895('0x30')]);_0x20860a[_0x3895('0x33')]=_['intersection'](_0x3e219b[_0x3895('0x2e')],qs[_0x3895('0x34')](_0x228221['query']['fields']));_0x20860a[_0x3895('0x33')]=_0x20860a[_0x3895('0x33')][_0x3895('0x35')]?_0x20860a[_0x3895('0x33')]:_0x3e219b[_0x3895('0x2e')];if(_0x228221[_0x3895('0x30')][_0x3895('0x42')]){_0x20860a[_0x3895('0x3e')]=[{'all':!![]}];}_0x20860a=_[_0x3895('0x43')]({},_0x20860a,_0x228221['options']);return db['Variable']['find'](_0x20860a)[_0x3895('0x20')](handleEntityNotFound(_0x205f2c,null))[_0x3895('0x20')](respondWithResult(_0x205f2c,null))[_0x3895('0x41')](handleError(_0x205f2c,null));};exports[_0x3895('0x44')]=function(_0x37fa1c,_0x56c373){return db[_0x3895('0x2a')][_0x3895('0x44')](_0x37fa1c[_0x3895('0x45')],{})[_0x3895('0x20')](function(_0xeea083){var _0x5ca404=_0x37fa1c[_0x3895('0x46')]['get']({'plain':!![]});if(!_0x5ca404)throw new Error(_0x3895('0x47'));if(_0x5ca404[_0x3895('0x48')]===_0x3895('0x46')){var _0x40b979=_0xeea083['get']({'plain':!![]});var _0x2a3dc1='Variables';return db[_0x3895('0x49')][_0x3895('0x4a')]({'where':{'name':_0x2a3dc1,'userProfileId':_0x5ca404[_0x3895('0x4b')]},'raw':!![]})['then'](function(_0x2c72d3){if(_0x2c72d3&&_0x2c72d3['autoAssociation']===0x0){return db[_0x3895('0x24')]['create']({'name':_0x40b979[_0x3895('0x27')],'resourceId':_0x40b979['id'],'type':_0x2c72d3[_0x3895('0x27')],'sectionId':_0x2c72d3['id']},{})[_0x3895('0x20')](function(){return _0xeea083;});}else{return _0xeea083;}})[_0x3895('0x41')](function(_0x14d7f8){logger[_0x3895('0x26')](_0x3895('0x4c'),_0x14d7f8);throw _0x14d7f8;});}return _0xeea083;})[_0x3895('0x20')](respondWithResult(_0x56c373,0xc9))['catch'](handleError(_0x56c373,null));};exports[_0x3895('0x1f')]=function(_0x2f1f86,_0xe75e4c){if(_0x2f1f86[_0x3895('0x45')]['id']){delete _0x2f1f86[_0x3895('0x45')]['id'];}return db['Variable'][_0x3895('0x4a')]({'where':{'id':_0x2f1f86[_0x3895('0x4d')]['id']}})[_0x3895('0x20')](handleEntityNotFound(_0xe75e4c,null))['then'](saveUpdates(_0x2f1f86[_0x3895('0x45')],null))[_0x3895('0x20')](respondWithResult(_0xe75e4c,null))[_0x3895('0x41')](handleError(_0xe75e4c,null));};exports[_0x3895('0x21')]=function(_0x35df2f,_0x4caea9){return db[_0x3895('0x2a')][_0x3895('0x4a')]({'where':{'id':_0x35df2f['params']['id']}})['then'](handleEntityNotFound(_0x4caea9,null))['then'](removeEntity(_0x4caea9,null))[_0x3895('0x41')](handleError(_0x4caea9,null));}; \ No newline at end of file +var _0x5489=['show','length','includeAll','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x4cf447,_0x536a74){var _0x4bd4fd=function(_0x54a5c5){while(--_0x54a5c5){_0x4cf447['push'](_0x4cf447['shift']());}};_0x4bd4fd(++_0x536a74);}(_0x5489,0x1ed));var _0x9548=function(_0x4323fd,_0xd5f17c){_0x4323fd=_0x4323fd-0x0;var _0x2f20d8=_0x5489[_0x4323fd];return _0x2f20d8;};'use strict';var emlformat=require(_0x9548('0x0'));var rimraf=require(_0x9548('0x1'));var zipdir=require(_0x9548('0x2'));var jsonpatch=require(_0x9548('0x3'));var rp=require(_0x9548('0x4'));var moment=require(_0x9548('0x5'));var BPromise=require(_0x9548('0x6'));var Mustache=require(_0x9548('0x7'));var util=require(_0x9548('0x8'));var path=require(_0x9548('0x9'));var sox=require(_0x9548('0xa'));var csv=require(_0x9548('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9548('0xc'));var _=require(_0x9548('0xd'));var squel=require(_0x9548('0xe'));var crypto=require('crypto');var jsforce=require(_0x9548('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9548('0xb'));var querystring=require(_0x9548('0x10'));var Papa=require(_0x9548('0x11'));var Redis=require(_0x9548('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9548('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9548('0x14'));var logger=require(_0x9548('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9548('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x582ccb,_0xf4338d){_0xf4338d=_0xf4338d||0xcc;return function(_0x155742){if(_0x155742){return _0x582ccb[_0x9548('0x17')](_0xf4338d);}return _0x582ccb[_0x9548('0x18')](_0xf4338d)[_0x9548('0x19')]();};}function respondWithResult(_0x1ec2db,_0x5d3903){_0x5d3903=_0x5d3903||0xc8;return function(_0x4ee012){if(_0x4ee012){return _0x1ec2db['status'](_0x5d3903)[_0x9548('0x1a')](_0x4ee012);}};}function respondWithFilteredResult(_0xc5b51f,_0x205e05){return function(_0x1e9ac3){if(_0x1e9ac3){var _0x11e7aa=typeof _0x205e05['offset']===_0x9548('0x1b')&&typeof _0x205e05[_0x9548('0x1c')]===_0x9548('0x1b');var _0x596482=_0x1e9ac3[_0x9548('0x1d')];var _0x4f653e=_0x11e7aa?0x0:_0x205e05[_0x9548('0x1e')];var _0x3f6402=_0x11e7aa?_0x1e9ac3[_0x9548('0x1d')]:_0x205e05['offset']+_0x205e05[_0x9548('0x1c')];var _0x2c735c;if(_0x3f6402>=_0x596482){_0x3f6402=_0x596482;_0x2c735c=0xc8;}else{_0x2c735c=0xce;}_0xc5b51f['status'](_0x2c735c);return _0xc5b51f['set']('Content-Range',_0x4f653e+'-'+_0x3f6402+'/'+_0x596482)[_0x9548('0x1a')](_0x1e9ac3);}return null;};}function patchUpdates(_0x5b0c87){return function(_0x131088){try{jsonpatch[_0x9548('0x1f')](_0x131088,_0x5b0c87,!![]);}catch(_0x1e7829){return BPromise[_0x9548('0x20')](_0x1e7829);}return _0x131088[_0x9548('0x21')]();};}function saveUpdates(_0x20a909,_0x63d800){return function(_0x55e6cc){if(_0x55e6cc){return _0x55e6cc[_0x9548('0x22')](_0x20a909)[_0x9548('0x23')](function(_0x633162){return _0x633162;});}return null;};}function removeEntity(_0x19c11b,_0x287afc){return function(_0x31307c){if(_0x31307c){return _0x31307c[_0x9548('0x24')]()[_0x9548('0x23')](function(){var _0x17c772=_0x31307c['get']({'plain':!![]});var _0x1c8c4a=_0x9548('0x25');return db[_0x9548('0x26')][_0x9548('0x24')]({'where':{'type':_0x1c8c4a,'resourceId':_0x17c772['id']}})[_0x9548('0x23')](function(){return _0x31307c;});})['then'](function(){_0x19c11b[_0x9548('0x18')](0xcc)[_0x9548('0x19')]();});}};}function handleEntityNotFound(_0x359e20,_0x4983a3){return function(_0x4ac818){if(!_0x4ac818){_0x359e20[_0x9548('0x17')](0x194);}return _0x4ac818;};}function handleError(_0x57cd28,_0x11b81c){_0x11b81c=_0x11b81c||0x1f4;return function(_0x2028a6){logger[_0x9548('0x27')](_0x2028a6[_0x9548('0x28')]);if(_0x2028a6[_0x9548('0x29')]){delete _0x2028a6[_0x9548('0x29')];}_0x57cd28[_0x9548('0x18')](_0x11b81c)[_0x9548('0x2a')](_0x2028a6);};}exports[_0x9548('0x2b')]=function(_0x3536c3,_0x1a741c){var _0x2090c8={},_0x15e5c7={},_0x14a2fa={'count':0x0,'rows':[]};var _0x2a6457=_[_0x9548('0x2c')](db[_0x9548('0x2d')][_0x9548('0x2e')],function(_0x3d2168){return{'name':_0x3d2168[_0x9548('0x2f')],'type':_0x3d2168[_0x9548('0x30')]['key']};});_0x15e5c7[_0x9548('0x31')]=_[_0x9548('0x2c')](_0x2a6457,_0x9548('0x29'));_0x15e5c7[_0x9548('0x32')]=_[_0x9548('0x33')](_0x3536c3[_0x9548('0x32')]);_0x15e5c7[_0x9548('0x34')]=_[_0x9548('0x35')](_0x15e5c7['model'],_0x15e5c7[_0x9548('0x32')]);_0x2090c8[_0x9548('0x36')]=_['intersection'](_0x15e5c7[_0x9548('0x31')],qs[_0x9548('0x37')](_0x3536c3[_0x9548('0x32')][_0x9548('0x37')]));_0x2090c8[_0x9548('0x36')]=_0x2090c8['attributes']['length']?_0x2090c8[_0x9548('0x36')]:_0x15e5c7[_0x9548('0x31')];if(!_0x3536c3['query'][_0x9548('0x38')]('nolimit')){_0x2090c8[_0x9548('0x1c')]=qs[_0x9548('0x1c')](_0x3536c3[_0x9548('0x32')][_0x9548('0x1c')]);_0x2090c8[_0x9548('0x1e')]=qs[_0x9548('0x1e')](_0x3536c3[_0x9548('0x32')][_0x9548('0x1e')]);}_0x2090c8['order']=qs['sort'](_0x3536c3[_0x9548('0x32')]['sort']);_0x2090c8[_0x9548('0x39')]=qs[_0x9548('0x34')](_[_0x9548('0x3a')](_0x3536c3['query'],_0x15e5c7[_0x9548('0x34')]),_0x2a6457);if(_0x3536c3['query'][_0x9548('0x3b')]){_0x2090c8[_0x9548('0x39')]=_[_0x9548('0x3c')](_0x2090c8[_0x9548('0x39')],{'$or':_[_0x9548('0x2c')](_0x2a6457,function(_0x160cbb){if(_0x160cbb[_0x9548('0x30')]!==_0x9548('0x3d')){var _0xf4e04d={};_0xf4e04d[_0x160cbb[_0x9548('0x29')]]={'$like':'%'+_0x3536c3[_0x9548('0x32')][_0x9548('0x3b')]+'%'};return _0xf4e04d;}})});}_0x2090c8=_[_0x9548('0x3c')]({},_0x2090c8,_0x3536c3[_0x9548('0x3e')]);var _0xab061c={'where':_0x2090c8[_0x9548('0x39')]};return db[_0x9548('0x2d')][_0x9548('0x1d')](_0xab061c)[_0x9548('0x23')](function(_0x4d4751){_0x14a2fa[_0x9548('0x1d')]=_0x4d4751;if(_0x3536c3[_0x9548('0x32')]['includeAll']){_0x2090c8[_0x9548('0x3f')]=[{'all':!![]}];}return db[_0x9548('0x2d')][_0x9548('0x40')](_0x2090c8);})[_0x9548('0x23')](function(_0x11cec9){_0x14a2fa[_0x9548('0x41')]=_0x11cec9;return _0x14a2fa;})['then'](respondWithFilteredResult(_0x1a741c,_0x2090c8))[_0x9548('0x42')](handleError(_0x1a741c,null));};exports[_0x9548('0x43')]=function(_0x4aeb0c,_0x3ad880){var _0x1b538d={'raw':!![],'where':{'id':_0x4aeb0c['params']['id']}},_0x143d47={};_0x143d47[_0x9548('0x31')]=_[_0x9548('0x33')](db[_0x9548('0x2d')][_0x9548('0x2e')]);_0x143d47[_0x9548('0x32')]=_['keys'](_0x4aeb0c[_0x9548('0x32')]);_0x143d47[_0x9548('0x34')]=_['intersection'](_0x143d47[_0x9548('0x31')],_0x143d47[_0x9548('0x32')]);_0x1b538d[_0x9548('0x36')]=_[_0x9548('0x35')](_0x143d47[_0x9548('0x31')],qs[_0x9548('0x37')](_0x4aeb0c[_0x9548('0x32')][_0x9548('0x37')]));_0x1b538d['attributes']=_0x1b538d[_0x9548('0x36')][_0x9548('0x44')]?_0x1b538d[_0x9548('0x36')]:_0x143d47[_0x9548('0x31')];if(_0x4aeb0c[_0x9548('0x32')][_0x9548('0x45')]){_0x1b538d[_0x9548('0x3f')]=[{'all':!![]}];}_0x1b538d=_[_0x9548('0x3c')]({},_0x1b538d,_0x4aeb0c['options']);return db['Variable'][_0x9548('0x46')](_0x1b538d)[_0x9548('0x23')](handleEntityNotFound(_0x3ad880,null))[_0x9548('0x23')](respondWithResult(_0x3ad880,null))[_0x9548('0x42')](handleError(_0x3ad880,null));};exports[_0x9548('0x47')]=function(_0xbe0a91,_0x573cbc){return db[_0x9548('0x2d')][_0x9548('0x47')](_0xbe0a91['body'],{})[_0x9548('0x23')](function(_0x248c3a){var _0x2ab869=_0xbe0a91[_0x9548('0x48')][_0x9548('0x49')]({'plain':!![]});if(!_0x2ab869)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ab869[_0x9548('0x4a')]===_0x9548('0x48')){var _0x54109a=_0x248c3a['get']({'plain':!![]});var _0x4469c1=_0x9548('0x25');return db[_0x9548('0x4b')][_0x9548('0x46')]({'where':{'name':_0x4469c1,'userProfileId':_0x2ab869[_0x9548('0x4c')]},'raw':!![]})['then'](function(_0x958e98){if(_0x958e98&&_0x958e98['autoAssociation']===0x0){return db[_0x9548('0x26')][_0x9548('0x47')]({'name':_0x54109a[_0x9548('0x29')],'resourceId':_0x54109a['id'],'type':_0x958e98[_0x9548('0x29')],'sectionId':_0x958e98['id']},{})[_0x9548('0x23')](function(){return _0x248c3a;});}else{return _0x248c3a;}})[_0x9548('0x42')](function(_0x3fd4cd){logger[_0x9548('0x27')](_0x9548('0x4d'),_0x3fd4cd);throw _0x3fd4cd;});}return _0x248c3a;})[_0x9548('0x23')](respondWithResult(_0x573cbc,0xc9))[_0x9548('0x42')](handleError(_0x573cbc,null));};exports[_0x9548('0x22')]=function(_0x3412fb,_0x3fb1d8){if(_0x3412fb[_0x9548('0x4e')]['id']){delete _0x3412fb['body']['id'];}return db['Variable']['find']({'where':{'id':_0x3412fb[_0x9548('0x4f')]['id']}})[_0x9548('0x23')](handleEntityNotFound(_0x3fb1d8,null))[_0x9548('0x23')](saveUpdates(_0x3412fb[_0x9548('0x4e')],null))[_0x9548('0x23')](respondWithResult(_0x3fb1d8,null))[_0x9548('0x42')](handleError(_0x3fb1d8,null));};exports['destroy']=function(_0x1791e8,_0x1376f4){return db[_0x9548('0x2d')][_0x9548('0x46')]({'where':{'id':_0x1791e8[_0x9548('0x4f')]['id']}})[_0x9548('0x23')](handleEntityNotFound(_0x1376f4,null))[_0x9548('0x23')](removeEntity(_0x1376f4,null))[_0x9548('0x42')](handleError(_0x1376f4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a7391b6..bb5b02a 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 _0xb2e0=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','define','tools_variables','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb2e0,0x185));var _0x0b2e=function(_0x3b5a97,_0x228e2d){_0x3b5a97=_0x3b5a97-0x0;var _0x4270c7=_0xb2e0[_0x3b5a97];return _0x4270c7;};'use strict';var _=require('lodash');var util=require(_0x0b2e('0x0'));var logger=require(_0x0b2e('0x1'))('api');var moment=require(_0x0b2e('0x2'));var BPromise=require(_0x0b2e('0x3'));var rp=require(_0x0b2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b2e('0x5'));var config=require(_0x0b2e('0x6'));var attributes=require(_0x0b2e('0x7'));module['exports']=function(_0xf69185,_0x16a7a6){return _0xf69185[_0x0b2e('0x8')]('Variable',attributes,{'tableName':_0x0b2e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9abd=['../../config/logger','api','moment','request-promise','path','./variable.attributes','exports','define','Variable','tools_variables','lodash','util'];(function(_0x4d53f9,_0x570532){var _0x5dd4eb=function(_0x579454){while(--_0x579454){_0x4d53f9['push'](_0x4d53f9['shift']());}};_0x5dd4eb(++_0x570532);}(_0x9abd,0x196));var _0xd9ab=function(_0x834fec,_0x4f452){_0x834fec=_0x834fec-0x0;var _0x3822bc=_0x9abd[_0x834fec];return _0x3822bc;};'use strict';var _=require(_0xd9ab('0x0'));var util=require(_0xd9ab('0x1'));var logger=require(_0xd9ab('0x2'))(_0xd9ab('0x3'));var moment=require(_0xd9ab('0x4'));var BPromise=require('bluebird');var rp=require(_0xd9ab('0x5'));var fs=require('fs');var path=require(_0xd9ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd9ab('0x7'));module[_0xd9ab('0x8')]=function(_0x437ed8,_0x13cbff){return _0x437ed8[_0xd9ab('0x9')](_0xd9ab('0xa'),attributes,{'tableName':_0xd9ab('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 40b5722..e19e588 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x2a6119,_0x4c5639){var _0x1577a7=function(_0x25c309){while(--_0x25c309){_0x2a6119['push'](_0x2a6119['shift']());}};_0x1577a7(++_0x4c5639);}(_0x814b,0x1a2));var _0xb814=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x814b[_0x1a36a5];return _0x746243;};'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')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x288f50,_0x402312){var _0x1944a4=function(_0x50ed11){while(--_0x50ed11){_0x288f50['push'](_0x288f50['shift']());}};_0x1944a4(++_0x402312);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x32ad69,_0x518f0c){_0x32ad69=_0x32ad69-0x0;var _0x1062ef=_0x7fbe[_0x32ad69];return _0x1062ef;};'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);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e491145..5d2f6a1 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 _0x218a=['pull','/restart','restart','/migrations','exports','express','Router','index','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset'];(function(_0x102e00,_0x36bdef){var _0x5c28c8=function(_0x186e96){while(--_0x186e96){_0x102e00['push'](_0x102e00['shift']());}};_0x5c28c8(++_0x36bdef);}(_0x218a,0x1f4));var _0xa218=function(_0x372aae,_0x3f56ef){_0x372aae=_0x372aae-0x0;var _0x1ef48e=_0x218a[_0x372aae];return _0x1ef48e;};'use strict';var express=require(_0xa218('0x0'));var router=express[_0xa218('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router['get']('/',controller[_0xa218('0x2')]);router[_0xa218('0x3')](_0xa218('0x4'),auth['isAuthenticated'](),auth[_0xa218('0x5')](),controller[_0xa218('0x6')]);router[_0xa218('0x3')](_0xa218('0x7'),auth[_0xa218('0x8')](),auth[_0xa218('0x5')](),controller[_0xa218('0x9')]);router[_0xa218('0x3')]('/pull',auth[_0xa218('0x8')](),auth['canUpdate'](),controller[_0xa218('0xa')]);router[_0xa218('0x3')](_0xa218('0xb'),auth[_0xa218('0x8')](),controller[_0xa218('0xc')]);router[_0xa218('0x3')](_0xa218('0xd'),controller['migrations']);module[_0xa218('0xe')]=router; \ No newline at end of file +var _0x7ece=['migrations','exports','Router','./version.controller','get','index','isAuthenticated','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x7ece,0xb6));var _0xe7ec=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x7ece[_0x5f1391];return _0x50ebe3;};'use strict';var express=require('express');var router=express[_0xe7ec('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe7ec('0x1'));router[_0xe7ec('0x2')]('/',controller[_0xe7ec('0x3')]);router[_0xe7ec('0x2')]('/fetch',auth[_0xe7ec('0x4')](),auth['canUpdate'](),controller['fetch']);router[_0xe7ec('0x2')](_0xe7ec('0x5'),auth['isAuthenticated'](),auth[_0xe7ec('0x6')](),controller[_0xe7ec('0x7')]);router[_0xe7ec('0x2')](_0xe7ec('0x8'),auth[_0xe7ec('0x4')](),auth['canUpdate'](),controller[_0xe7ec('0x9')]);router['get'](_0xe7ec('0xa'),auth[_0xe7ec('0x4')](),controller[_0xe7ec('0xb')]);router['get'](_0xe7ec('0xc'),controller[_0xe7ec('0xd')]);module[_0xe7ec('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 43f636c..3fc29d9 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 _0xb011=['\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','version','query','fetch','latest','2.0.0','json','status','origin','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','replace','exports','push','sequelize','Migration','getQueryInterface','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x395e83,_0x3663a4){var _0x2a25d8=function(_0x1e8b2c){while(--_0x1e8b2c){_0x395e83['push'](_0x395e83['shift']());}};_0x2a25d8(++_0x3663a4);}(_0xb011,0xc8));var _0x1b01=function(_0x6396ed,_0x64de38){_0x6396ed=_0x6396ed-0x0;var _0x3e86ef=_0xb011[_0x6396ed];return _0x3e86ef;};'use strict';var Umzug=require(_0x1b01('0x0'));var path=require(_0x1b01('0x1'));var fs=require('fs');var _=require(_0x1b01('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x1b01('0x3'))[_0x1b01('0x4')];var db=require(_0x1b01('0x5'))['db'];var config=require(_0x1b01('0x6'));var pm2=require(_0x1b01('0x7'));var logger=require(_0x1b01('0x8'))('update');var git=require(_0x1b01('0x9'))(config[_0x1b01('0xa')]);exports['index']=function(_0x3c9a84,_0x5249f6){var _0xd4e07d={'current':module['exports'][_0x1b01('0xb')],'phonebar':0x2};if(_0x3c9a84[_0x1b01('0xc')]&&_0x3c9a84['query']['latest']){return git[_0x1b01('0xd')]()['tags'](function(_0x3b57e0,_0x75e629){_0xd4e07d[_0x1b01('0xe')]=(_0x3b57e0?module['exports'][_0x1b01('0xb')]:_0x75e629['latest'])||_0x1b01('0xf');return _0x5249f6['status'](0xc8)[_0x1b01('0x10')](_0xd4e07d);});}else{return _0x5249f6[_0x1b01('0x11')](0xc8)[_0x1b01('0x10')](_0xd4e07d);}};exports['fetch']=function(_0xcbd818,_0x4450bc){return git[_0x1b01('0xd')]([_0x1b01('0x12'),'master'],function(_0x304e43){if(_0x304e43){logger[_0x1b01('0x13')](_0x304e43);return _0x4450bc[_0x1b01('0x11')](0x1f4)['json'](_0x304e43);}logger['info'](_0x1b01('0x14'));return _0x4450bc[_0x1b01('0x11')](0xc8)[_0x1b01('0x10')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x1b01('0x15')]=function(_0x4d8837,_0x22fa30){return git['reset']([_0x1b01('0x16'),_0x1b01('0x17')],function(_0x33d387){if(_0x33d387){logger[_0x1b01('0x13')](_0x33d387);return _0x22fa30[_0x1b01('0x11')](0x1f4)[_0x1b01('0x10')](_0x33d387);}logger[_0x1b01('0x18')](_0x1b01('0x19'));return _0x22fa30['status'](0xc8)[_0x1b01('0x10')]({'output':_0x1b01('0x1a')});});};exports['pull']=function(_0xc584b5,_0x4d9e6b){exec(_0x1b01('0x1b'),function(_0x53e28d,_0x350e96,_0x324d3f){logger['info'](_0x350e96);logger[_0x1b01('0x18')](_0x324d3f);if(_0x53e28d){logger['error'](_0x53e28d);return _0x4d9e6b[_0x1b01('0x11')](0x1f4)[_0x1b01('0x10')](_0x53e28d);}return _0x4d9e6b[_0x1b01('0x11')](0xc8)[_0x1b01('0x10')]({'output':_0x350e96});});};exports[_0x1b01('0x1c')]=function(_0x22e6d1,_0x46b701){return pm2[_0x1b01('0x1c')]('motion2')[_0x1b01('0x1d')](function(_0x225073){logger[_0x1b01('0x18')](_0x1b01('0x1e'),_0x225073);return _0x46b701[_0x1b01('0x11')](0xc8)[_0x1b01('0x10')]({'output':_0x1b01('0x1f')});})['catch'](function(_0x4493cc){logger[_0x1b01('0x13')](_0x4493cc);return _0x46b701[_0x1b01('0x11')](0x1f4)[_0x1b01('0x10')](_0x4493cc);});};exports[_0x1b01('0x20')]=function(_0x272c51,_0x13579c){var _0x5e1750=fs[_0x1b01('0x21')](path['join'](config[_0x1b01('0xa')],_0x1b01('0x22'),_0x1b01('0x20')));var _0x10aade=[];for(var _0x471b61=0x0;_0x471b61<_0x5e1750[_0x1b01('0x23')];_0x471b61++){var _0x454719=_0x5e1750[_0x471b61][_0x1b01('0x24')]('.js','');if(compareVersions(module[_0x1b01('0x25')]['version'],_0x454719)===-0x1){_0x10aade[_0x1b01('0x26')](_0x454719);}}if(_0x10aade[_0x1b01('0x23')]){var _0x40ff69=_0x10aade['sort'](compareVersions);var _0x501656=new Umzug({'storage':_0x1b01('0x27'),'storageOptions':{'model':db[_0x1b01('0x28')],'modelName':_0x1b01('0x28'),'columnName':'version'},'migrations':{'params':[db[_0x1b01('0x27')][_0x1b01('0x29')](),db[_0x1b01('0x27')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x1b01('0xa')],_0x1b01('0x22'),_0x1b01('0x20')),'pattern':/\.js$/}});_0x501656['up']({'migrations':_[_0x1b01('0x2a')](_0x40ff69,function(_0x568d2a){return _0x568d2a+_0x1b01('0x2b');})})[_0x1b01('0x1d')](function(){return _0x13579c[_0x1b01('0x11')](0xc8)[_0x1b01('0x10')]({'output':_0x1b01('0x2c')+module[_0x1b01('0x25')][_0x1b01('0xb')]+_0x1b01('0x2d')+_['last'](_0x40ff69),'migrations':_['join'](_0x40ff69)});})[_0x1b01('0x2e')](function(_0x4a80f7){if(_0x4a80f7 instanceof db[_0x1b01('0x27')][_0x1b01('0x2f')]){return _0x13579c['status'](0xc8)['json']({'output':_0x1b01('0x30')});}else{return _0x13579c[_0x1b01('0x11')](0x1f4)[_0x1b01('0x10')](_0x4a80f7);}});}else{return _0x13579c[_0x1b01('0x11')](0xc8)[_0x1b01('0x10')]({'output':_0x1b01('0x30')});}}; \ No newline at end of file +var _0xf13e=['pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','version','query','latest','fetch','tags','exports','2.0.0','json','status','master','info','reset','--hard','FETCH_HEAD','error','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','length','.js','push','sort','sequelize','Migration','getQueryInterface','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','umzug','path','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf13e,0xb9));var _0xef13=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xf13e[_0x234ae1];return _0x227ba0;};'use strict';var Umzug=require(_0xef13('0x0'));var path=require(_0xef13('0x1'));var fs=require('fs');var _=require(_0xef13('0x2'));var pkginfo=require(_0xef13('0x3'))(module,'version');var compareVersions=require(_0xef13('0x4'));var exec=require(_0xef13('0x5'))['exec'];var db=require(_0xef13('0x6'))['db'];var config=require(_0xef13('0x7'));var pm2=require(_0xef13('0x8'));var logger=require('../../config/logger')(_0xef13('0x9'));var git=require(_0xef13('0xa'))(config[_0xef13('0xb')]);exports['index']=function(_0x17baca,_0x1001cd){var _0x54aa4e={'current':module['exports'][_0xef13('0xc')],'phonebar':0x2};if(_0x17baca[_0xef13('0xd')]&&_0x17baca['query'][_0xef13('0xe')]){return git[_0xef13('0xf')]()[_0xef13('0x10')](function(_0x40e031,_0x17912b){_0x54aa4e[_0xef13('0xe')]=(_0x40e031?module[_0xef13('0x11')][_0xef13('0xc')]:_0x17912b['latest'])||_0xef13('0x12');return _0x1001cd['status'](0xc8)[_0xef13('0x13')](_0x54aa4e);});}else{return _0x1001cd[_0xef13('0x14')](0xc8)['json'](_0x54aa4e);}};exports['fetch']=function(_0x1c4245,_0x433bbe){return git[_0xef13('0xf')](['origin',_0xef13('0x15')],function(_0x4da378){if(_0x4da378){logger['error'](_0x4da378);return _0x433bbe[_0xef13('0x14')](0x1f4)[_0xef13('0x13')](_0x4da378);}logger[_0xef13('0x16')]('git\x20fetch');return _0x433bbe[_0xef13('0x14')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xef13('0x17')]=function(_0x16bc50,_0x4fdca7){return git[_0xef13('0x17')]([_0xef13('0x18'),_0xef13('0x19')],function(_0x387695){if(_0x387695){logger[_0xef13('0x1a')](_0x387695);return _0x4fdca7[_0xef13('0x14')](0x1f4)['json'](_0x387695);}logger[_0xef13('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4fdca7[_0xef13('0x14')](0xc8)[_0xef13('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0xef13('0x1b')]=function(_0x51e0fd,_0x2f55fd){exec(_0xef13('0x1c'),function(_0x221484,_0x267956,_0x55dd01){logger['info'](_0x267956);logger[_0xef13('0x16')](_0x55dd01);if(_0x221484){logger['error'](_0x221484);return _0x2f55fd[_0xef13('0x14')](0x1f4)[_0xef13('0x13')](_0x221484);}return _0x2f55fd[_0xef13('0x14')](0xc8)[_0xef13('0x13')]({'output':_0x267956});});};exports[_0xef13('0x1d')]=function(_0x323d60,_0xa84e02){return pm2[_0xef13('0x1d')]('motion2')[_0xef13('0x1e')](function(_0x350316){logger['info'](_0xef13('0x1f'),_0x350316);return _0xa84e02[_0xef13('0x14')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xef13('0x20')](function(_0x3b3ae3){logger[_0xef13('0x1a')](_0x3b3ae3);return _0xa84e02['status'](0x1f4)[_0xef13('0x13')](_0x3b3ae3);});};exports[_0xef13('0x21')]=function(_0x4e31c6,_0x290eff){var _0x1dbd30=fs['readdirSync'](path[_0xef13('0x22')](config[_0xef13('0xb')],'server',_0xef13('0x21')));var _0x5691b3=[];for(var _0x29e51b=0x0;_0x29e51b<_0x1dbd30[_0xef13('0x23')];_0x29e51b++){var _0x91845e=_0x1dbd30[_0x29e51b]['replace'](_0xef13('0x24'),'');if(compareVersions(module[_0xef13('0x11')]['version'],_0x91845e)===-0x1){_0x5691b3[_0xef13('0x25')](_0x91845e);}}if(_0x5691b3[_0xef13('0x23')]){var _0x36c284=_0x5691b3[_0xef13('0x26')](compareVersions);var _0x337c21=new Umzug({'storage':_0xef13('0x27'),'storageOptions':{'model':db['Migration'],'modelName':_0xef13('0x28'),'columnName':_0xef13('0xc')},'migrations':{'params':[db[_0xef13('0x27')][_0xef13('0x29')](),db[_0xef13('0x27')]['constructor'],function(){throw new Error(_0xef13('0x2a'));}],'path':path[_0xef13('0x22')](config[_0xef13('0xb')],'server',_0xef13('0x21')),'pattern':/\.js$/}});_0x337c21['up']({'migrations':_[_0xef13('0x2b')](_0x36c284,function(_0x5b05f4){return _0x5b05f4+_0xef13('0x24');})})['then'](function(){return _0x290eff['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xef13('0x11')][_0xef13('0xc')]+_0xef13('0x2c')+_[_0xef13('0x2d')](_0x36c284),'migrations':_[_0xef13('0x22')](_0x36c284)});})[_0xef13('0x20')](function(_0x33cd79){if(_0x33cd79 instanceof db[_0xef13('0x27')]['UniqueConstraintError']){return _0x290eff['status'](0xc8)[_0xef13('0x13')]({'output':_0xef13('0x2e')});}else{return _0x290eff[_0xef13('0x14')](0x1f4)['json'](_0x33cd79);}});}else{return _0x290eff['status'](0xc8)['json']({'output':_0xef13('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index e5cd439..9949f8b 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 _0x45e2=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','post','create','put','/:id','update','destroy','exports','util','path'];(function(_0x2bd612,_0x5ebad4){var _0x882eec=function(_0x2b0cdb){while(--_0x2b0cdb){_0x2bd612['push'](_0x2bd612['shift']());}};_0x882eec(++_0x5ebad4);}(_0x45e2,0x1a0));var _0x245e=function(_0x25f13f,_0x325ab1){_0x25f13f=_0x25f13f-0x0;var _0x38332f=_0x45e2[_0x25f13f];return _0x38332f;};'use strict';var multer=require('multer');var util=require(_0x245e('0x0'));var path=require(_0x245e('0x1'));var timeout=require('connect-timeout');var express=require(_0x245e('0x2'));var router=express[_0x245e('0x3')]();var fs_extra=require(_0x245e('0x4'));var auth=require(_0x245e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x245e('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x245e('0x7')]('/',auth['isAuthenticated'](),controller[_0x245e('0x8')]);router[_0x245e('0x7')](_0x245e('0x9'),auth[_0x245e('0xa')](),controller[_0x245e('0xb')]);router[_0x245e('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x245e('0xc')]('/',auth[_0x245e('0xa')](),controller[_0x245e('0xd')]);router[_0x245e('0xe')](_0x245e('0xf'),auth['isAuthenticated'](),controller[_0x245e('0x10')]);router['delete'](_0x245e('0xf'),auth[_0x245e('0xa')](),controller[_0x245e('0x11')]);module[_0x245e('0x12')]=router; \ No newline at end of file +var _0x3f65=['describe','/:id','show','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe'];(function(_0x562614,_0x53b1e4){var _0x19266a=function(_0x5d0d0a){while(--_0x5d0d0a){_0x562614['push'](_0x562614['shift']());}};_0x19266a(++_0x53b1e4);}(_0x3f65,0xd9));var _0x53f6=function(_0x50f288,_0xfecd76){_0x50f288=_0x50f288-0x0;var _0x2a0755=_0x3f65[_0x50f288];return _0x2a0755;};'use strict';var multer=require(_0x53f6('0x0'));var util=require(_0x53f6('0x1'));var path=require('path');var timeout=require(_0x53f6('0x2'));var express=require(_0x53f6('0x3'));var router=express[_0x53f6('0x4')]();var fs_extra=require(_0x53f6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x53f6('0x6'));var config=require(_0x53f6('0x7'));var controller=require(_0x53f6('0x8'));router[_0x53f6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x53f6('0x9')](_0x53f6('0xa'),auth['isAuthenticated'](),controller[_0x53f6('0xb')]);router[_0x53f6('0x9')](_0x53f6('0xc'),auth['isAuthenticated'](),controller[_0x53f6('0xd')]);router['post']('/',auth[_0x53f6('0xe')](),controller['create']);router['put'](_0x53f6('0xc'),auth[_0x53f6('0xe')](),controller[_0x53f6('0xf')]);router[_0x53f6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x53f6('0x11')]);module[_0x53f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 17b3680..08f500e 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 _0x5454=['DATE','INTEGER','BOOLEAN','STRING'];(function(_0x462407,_0x27e8d4){var _0x243c3f=function(_0x16b705){while(--_0x16b705){_0x462407['push'](_0x462407['shift']());}};_0x243c3f(++_0x27e8d4);}(_0x5454,0x15b));var _0x4545=function(_0x4ffd35,_0x572e06){_0x4ffd35=_0x4ffd35-0x0;var _0xb1308a=_0x5454[_0x4ffd35];return _0xb1308a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4545('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4545('0x0')]},'membername':{'type':Sequelize[_0x4545('0x0')]},'agentcalledAt':{'type':Sequelize[_0x4545('0x1')]},'agentconnectAt':{'type':Sequelize[_0x4545('0x1')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4545('0x1')]},'agentdumpAt':{'type':Sequelize[_0x4545('0x1')]},'holdtime':{'type':Sequelize[_0x4545('0x2')]},'agentcomplete':{'type':Sequelize[_0x4545('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4545('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4545('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4545('0x2')]},'agentacw':{'type':Sequelize[_0x4545('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4545('0x2')]},'reason':{'type':Sequelize[_0x4545('0x0')]},'lastevent':{'type':Sequelize[_0x4545('0x0')]},'channel':{'type':Sequelize[_0x4545('0x0')]},'channelstate':{'type':Sequelize[_0x4545('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4545('0x0')]},'connectedlinename':{'type':Sequelize[_0x4545('0x0')]},'language':{'type':Sequelize[_0x4545('0x0')]},'accountcode':{'type':Sequelize[_0x4545('0x0')]},'context':{'type':Sequelize[_0x4545('0x0')]},'exten':{'type':Sequelize[_0x4545('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4545('0x0')]},'destchannelstate':{'type':Sequelize[_0x4545('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4545('0x0')]},'destcalleridnum':{'type':Sequelize[_0x4545('0x0')]},'destcalleridname':{'type':Sequelize[_0x4545('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x4545('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x4545('0x0')]},'destlanguage':{'type':Sequelize[_0x4545('0x0')]},'destaccountcode':{'type':Sequelize[_0x4545('0x0')]},'destcontext':{'type':Sequelize[_0x4545('0x0')]},'destexten':{'type':Sequelize[_0x4545('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4545('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4545('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x4545('0x0')]},'transfer':{'type':Sequelize[_0x4545('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4545('0x0')]},'transferuniqueid':{'type':Sequelize[_0x4545('0x0')]},'agententerreason':{'type':Sequelize[_0x4545('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xccef=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4b768d,_0x4b72c5){var _0x1368a8=function(_0x36abea){while(--_0x36abea){_0x4b768d['push'](_0x4b768d['shift']());}};_0x1368a8(++_0x4b72c5);}(_0xccef,0x1d4));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xfcce('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfcce('0x1')]},'calleridnum':{'type':Sequelize[_0xfcce('0x1')]},'calleridname':{'type':Sequelize[_0xfcce('0x1')]},'queue':{'type':Sequelize[_0xfcce('0x1')]},'interface':{'type':Sequelize[_0xfcce('0x1')]},'membername':{'type':Sequelize[_0xfcce('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xfcce('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xfcce('0x2')]},'holdtime':{'type':Sequelize[_0xfcce('0x3')]},'agentcomplete':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfcce('0x3')]},'agentacw':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcce('0x1')]},'lastevent':{'type':Sequelize[_0xfcce('0x1')]},'channel':{'type':Sequelize[_0xfcce('0x1')]},'channelstate':{'type':Sequelize[_0xfcce('0x3')]},'channelstatedesc':{'type':Sequelize[_0xfcce('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfcce('0x1')]},'connectedlinename':{'type':Sequelize[_0xfcce('0x1')]},'language':{'type':Sequelize[_0xfcce('0x1')]},'accountcode':{'type':Sequelize[_0xfcce('0x1')]},'context':{'type':Sequelize[_0xfcce('0x1')]},'exten':{'type':Sequelize[_0xfcce('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xfcce('0x1')]},'destchannelstate':{'type':Sequelize[_0xfcce('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xfcce('0x1')]},'destcalleridnum':{'type':Sequelize[_0xfcce('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xfcce('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfcce('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xfcce('0x1')]},'destexten':{'type':Sequelize[_0xfcce('0x1')]},'destpriority':{'type':Sequelize[_0xfcce('0x1')]},'destuniqueid':{'type':Sequelize[_0xfcce('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfcce('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xfcce('0x1')]},'transfer':{'type':Sequelize[_0xfcce('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfcce('0x1')],'comment':_0xfcce('0x5')},'transferexten':{'type':Sequelize[_0xfcce('0x1')]},'transferuniqueid':{'type':Sequelize[_0xfcce('0x1')]},'agententerreason':{'type':Sequelize[_0xfcce('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 522af19..709d37e 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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 93cfc69..4416ca1 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 _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0x4b1b8f,_0x375dd8){var _0xf4541a=function(_0x484d45){while(--_0x484d45){_0x4b1b8f['push'](_0x4b1b8f['shift']());}};_0xf4541a(++_0x375dd8);}(_0xcea5,0xed));var _0x5cea=function(_0x2f6515,_0x3f9118){_0x2f6515=_0x2f6515-0x0;var _0x392f77=_0xcea5[_0x2f6515];return _0x392f77;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5cea('0xa'),_0x5cea('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7118=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x358e3b,_0x72233f){var _0x4906c0=function(_0x5d25fb){while(--_0x5d25fb){_0x358e3b['push'](_0x358e3b['shift']());}};_0x4906c0(++_0x72233f);}(_0x7118,0x159));var _0x8711=function(_0x25d459,_0x57be10){_0x25d459=_0x25d459-0x0;var _0x6b46b3=_0x7118[_0x25d459];return _0x6b46b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8711('0x0'))(_0x8711('0x1'));var moment=require('moment');var BPromise=require(_0x8711('0x2'));var rp=require(_0x8711('0x3'));var fs=require('fs');var path=require(_0x8711('0x4'));var rimraf=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var attributes=require(_0x8711('0x7'));module[_0x8711('0x8')]=function(_0x54885e,_0x385033){return _0x54885e[_0x8711('0x9')](_0x8711('0xa'),attributes,{'tableName':_0x8711('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8711('0xc'),_0x8711('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 543d900..e190770 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 _0x5857=['CreateVoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','code','error','message','info','catch'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x5857,0x1e8));var _0x7585=function(_0x2c906f,_0x3389e9){_0x2c906f=_0x2c906f-0x0;var _0x1c0088=_0x5857[_0x2c906f];return _0x1c0088;};'use strict';var _=require(_0x7585('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7585('0x1'));var rs=require(_0x7585('0x2'));var fs=require('fs');var Redis=require(_0x7585('0x3'));var db=require(_0x7585('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7585('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0b67,_0x280296,_0x3b3bf5){return new BPromise(function(_0x5669b8,_0x1a4c43){return client['request'](_0x2e0b67,_0x3b3bf5)[_0x7585('0x6')](function(_0x400095){logger['info'](_0x7585('0x7'),_0x280296,_0x7585('0x8'));logger[_0x7585('0x9')](_0x7585('0xa'),_0x280296,_0x7585('0x8'),JSON['stringify'](_0x400095));if(_0x400095['error']){if(_0x400095['error'][_0x7585('0xb')]===0x1f4){logger[_0x7585('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x280296,_0x400095[_0x7585('0xc')][_0x7585('0xd')]);return _0x1a4c43(_0x400095['error'][_0x7585('0xd')]);}logger[_0x7585('0xc')](_0x7585('0x7'),_0x280296,_0x400095['error'][_0x7585('0xd')]);return _0x5669b8(_0x400095[_0x7585('0xc')]['message']);}else{logger[_0x7585('0xe')](_0x7585('0x7'),_0x280296,_0x7585('0x8'));_0x5669b8(_0x400095['result'][_0x7585('0xd')]);}})[_0x7585('0xf')](function(_0x2ea346){logger['error'](_0x7585('0x7'),_0x280296,_0x2ea346);_0x1a4c43(_0x2ea346);});});}exports[_0x7585('0x10')]=function(_0x366890){var _0x3d841b=this;return new Promise(function(_0x1f847b,_0x15188e){return db['VoiceAgentReport'][_0x7585('0x11')](_0x366890['body'],{'raw':_0x366890[_0x7585('0x12')]?_0x366890[_0x7585('0x12')][_0x7585('0x13')]===undefined?!![]:![]:!![]})[_0x7585('0x6')](function(_0x3013cb){logger[_0x7585('0xe')](_0x7585('0x10'),_0x366890);logger[_0x7585('0x9')](_0x7585('0x10'),_0x366890,JSON[_0x7585('0x14')](_0x3013cb));_0x1f847b(_0x3013cb);})[_0x7585('0xf')](function(_0x2c80ed){logger[_0x7585('0xc')](_0x7585('0x10'),_0x2c80ed[_0x7585('0xd')],_0x366890);_0x15188e(_0x3d841b['error'](0x1f4,_0x2c80ed[_0x7585('0xd')]));});});};exports[_0x7585('0x15')]=function(_0x448848){var _0x31d6ab=this;return new Promise(function(_0xbaf9dd,_0x3ccce2){return db[_0x7585('0x16')][_0x7585('0x17')](_0x448848[_0x7585('0x18')],{'raw':_0x448848['options']?_0x448848['options'][_0x7585('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x448848['options']?_0x448848[_0x7585('0x12')][_0x7585('0x19')]||null:null,'attributes':_0x448848[_0x7585('0x12')]?_0x448848['options'][_0x7585('0x1a')]||null:null,'limit':_0x448848['options']?_0x448848['options'][_0x7585('0x1b')]||null:null})[_0x7585('0x6')](function(_0x5899dd){logger[_0x7585('0xe')]('UpdateVoiceAgentReport',_0x448848);logger['debug'](_0x7585('0x15'),_0x448848,JSON[_0x7585('0x14')](_0x5899dd));_0xbaf9dd(_0x5899dd);})[_0x7585('0xf')](function(_0x8d3851){logger[_0x7585('0xc')](_0x7585('0x15'),_0x8d3851[_0x7585('0xd')],_0x448848);_0x3ccce2(_0x31d6ab['error'](0x1f4,_0x8d3851[_0x7585('0xd')]));});});}; \ No newline at end of file +var _0xfbd9=['request\x20sent','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','body','where','attributes','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x22c154,_0x30b413){var _0x38dea0=function(_0x18c06a){while(--_0x18c06a){_0x22c154['push'](_0x22c154['shift']());}};_0x38dea0(++_0x30b413);}(_0xfbd9,0x1a1));var _0x9fbd=function(_0x12ea79,_0x1f0c6e){_0x12ea79=_0x12ea79-0x0;var _0x83481a=_0xfbd9[_0x12ea79];return _0x83481a;};'use strict';var _=require(_0x9fbd('0x0'));var util=require(_0x9fbd('0x1'));var moment=require(_0x9fbd('0x2'));var BPromise=require(_0x9fbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fbd('0x4'));var db=require(_0x9fbd('0x5'))['db'];var utils=require(_0x9fbd('0x6'));var logger=require(_0x9fbd('0x7'))(_0x9fbd('0x8'));var config=require(_0x9fbd('0x9'));var jayson=require(_0x9fbd('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3241a1,_0xb37b31,_0x88fd51){return new BPromise(function(_0x615715,_0x11e3c3){return client['request'](_0x3241a1,_0x88fd51)['then'](function(_0x24c136){logger['info'](_0x9fbd('0xb'),_0xb37b31,_0x9fbd('0xc'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xb37b31,'request\x20sent',JSON[_0x9fbd('0xd')](_0x24c136));if(_0x24c136[_0x9fbd('0xe')]){if(_0x24c136[_0x9fbd('0xe')][_0x9fbd('0xf')]===0x1f4){logger['error'](_0x9fbd('0xb'),_0xb37b31,_0x24c136[_0x9fbd('0xe')][_0x9fbd('0x10')]);return _0x11e3c3(_0x24c136[_0x9fbd('0xe')][_0x9fbd('0x10')]);}logger[_0x9fbd('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0xb37b31,_0x24c136[_0x9fbd('0xe')][_0x9fbd('0x10')]);return _0x615715(_0x24c136[_0x9fbd('0xe')]['message']);}else{logger[_0x9fbd('0x11')](_0x9fbd('0xb'),_0xb37b31,_0x9fbd('0xc'));_0x615715(_0x24c136[_0x9fbd('0x12')][_0x9fbd('0x10')]);}})[_0x9fbd('0x13')](function(_0x3a3e5f){logger[_0x9fbd('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0xb37b31,_0x3a3e5f);_0x11e3c3(_0x3a3e5f);});});}exports[_0x9fbd('0x14')]=function(_0x2bddbf){var _0x3662eb=this;return new Promise(function(_0xb7196f,_0x17045f){return db[_0x9fbd('0x15')][_0x9fbd('0x16')](_0x2bddbf['body'],{'raw':_0x2bddbf[_0x9fbd('0x17')]?_0x2bddbf[_0x9fbd('0x17')][_0x9fbd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x541e01){logger[_0x9fbd('0x11')](_0x9fbd('0x14'),_0x2bddbf);logger[_0x9fbd('0x19')](_0x9fbd('0x14'),_0x2bddbf,JSON[_0x9fbd('0xd')](_0x541e01));_0xb7196f(_0x541e01);})[_0x9fbd('0x13')](function(_0x2ed43b){logger[_0x9fbd('0xe')](_0x9fbd('0x14'),_0x2ed43b[_0x9fbd('0x10')],_0x2bddbf);_0x17045f(_0x3662eb[_0x9fbd('0xe')](0x1f4,_0x2ed43b[_0x9fbd('0x10')]));});});};exports[_0x9fbd('0x1a')]=function(_0x5a7e66){var _0x598b26=this;return new Promise(function(_0x357092,_0x4cea2d){return db[_0x9fbd('0x15')][_0x9fbd('0x1b')](_0x5a7e66[_0x9fbd('0x1c')],{'raw':_0x5a7e66['options']?_0x5a7e66[_0x9fbd('0x17')][_0x9fbd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7e66[_0x9fbd('0x17')]?_0x5a7e66[_0x9fbd('0x17')][_0x9fbd('0x1d')]||null:null,'attributes':_0x5a7e66[_0x9fbd('0x17')]?_0x5a7e66['options'][_0x9fbd('0x1e')]||null:null,'limit':_0x5a7e66[_0x9fbd('0x17')]?_0x5a7e66['options'][_0x9fbd('0x1f')]||null:null})[_0x9fbd('0x20')](function(_0x2edf21){logger['info']('UpdateVoiceAgentReport',_0x5a7e66);logger['debug'](_0x9fbd('0x1a'),_0x5a7e66,JSON[_0x9fbd('0xd')](_0x2edf21));_0x357092(_0x2edf21);})[_0x9fbd('0x13')](function(_0x59641b){logger[_0x9fbd('0xe')](_0x9fbd('0x1a'),_0x59641b[_0x9fbd('0x10')],_0x5a7e66);_0x4cea2d(_0x598b26['error'](0x1f4,_0x59641b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f5ca910..02ffb5e 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 _0x3baf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2bebaa,_0x3482c9){var _0x35705d=function(_0x381a74){while(--_0x381a74){_0x2bebaa['push'](_0x2bebaa['shift']());}};_0x35705d(++_0x3482c9);}(_0x3baf,0xf7));var _0xf3ba=function(_0x45b1ad,_0x215b03){_0x45b1ad=_0x45b1ad-0x0;var _0x3d5696=_0x3baf[_0x45b1ad];return _0x3d5696;};'use strict';var multer=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var path=require(_0xf3ba('0x2'));var timeout=require(_0xf3ba('0x3'));var express=require(_0xf3ba('0x4'));var router=express[_0xf3ba('0x5')]();var fs_extra=require(_0xf3ba('0x6'));var auth=require(_0xf3ba('0x7'));var interaction=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var controller=require(_0xf3ba('0xa'));router[_0xf3ba('0xb')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xd')]);router[_0xf3ba('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf3ba('0xb')]('/:id',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xe')]);router[_0xf3ba('0xf')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x10')]);router[_0xf3ba('0x11')](_0xf3ba('0x12'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x13')]);router[_0xf3ba('0x14')](_0xf3ba('0x12'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x15')]);module[_0xf3ba('0x16')]=router; \ No newline at end of file +var _0x6c7b=['./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x29557d,_0x517862){_0x29557d=_0x29557d-0x0;var _0x239694=_0x6c7b[_0x29557d];return _0x239694;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 34065d6..cfb4130 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 _0x306e=['TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING'];(function(_0x2ace70,_0x19c69c){var _0x35475f=function(_0x15d9b8){while(--_0x15d9b8){_0x2ace70['push'](_0x2ace70['shift']());}};_0x35475f(++_0x19c69c);}(_0x306e,0x13b));var _0xe306=function(_0x26d0c6,_0x1d685a){_0x26d0c6=_0x26d0c6-0x0;var _0x1d943b=_0x306e[_0x26d0c6];return _0x1d943b;};'use strict';var Sequelize=require(_0xe306('0x0'));module[_0xe306('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe306('0x2')](_0xe306('0x3'),_0xe306('0x4'),_0xe306('0x5'),_0xe306('0x6'),_0xe306('0x7'),_0xe306('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe306('0x9')]},'source':{'type':Sequelize[_0xe306('0x9')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xe306('0x9')]},'callerid':{'type':Sequelize[_0xe306('0x9')]},'channel':{'type':Sequelize[_0xe306('0x9')]},'destinationchannel':{'type':Sequelize[_0xe306('0x9')]},'lastapplication':{'type':Sequelize[_0xe306('0x9')]},'lastdata':{'type':Sequelize[_0xe306('0xa')]},'starttime':{'type':Sequelize[_0xe306('0xb')]},'systemanswertime':{'type':Sequelize[_0xe306('0xb')]},'answertime':{'type':Sequelize[_0xe306('0xb')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xe306('0xc')]},'billableseconds':{'type':Sequelize[_0xe306('0xc')]},'mohtime':{'type':Sequelize[_0xe306('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe306('0x9')]},'amaflags':{'type':Sequelize[_0xe306('0x9')]},'userfield':{'type':Sequelize[_0xe306('0x9')]},'userDisposition':{'type':Sequelize[_0xe306('0x9')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe306('0x9')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe306('0x9')]},'routeid':{'type':Sequelize[_0xe306('0xc')]},'sipcallid':{'type':Sequelize[_0xe306('0x9')]}}; \ No newline at end of file +var _0x48fa=['STRING','ENUM','inbound','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x48fa,0x127));var _0xa48f=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x48fa[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xa48f('0x0'));module[_0xa48f('0x1')]={'uniqueid':{'type':Sequelize[_0xa48f('0x2')]},'type':{'type':Sequelize[_0xa48f('0x3')](_0xa48f('0x4'),'internal','outbound','inbound-fax',_0xa48f('0x5'),_0xa48f('0x6'))},'tag':{'type':Sequelize[_0xa48f('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xa48f('0x2')]},'destination':{'type':Sequelize[_0xa48f('0x2')]},'destinationcontext':{'type':Sequelize[_0xa48f('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xa48f('0x2')]},'lastapplication':{'type':Sequelize[_0xa48f('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xa48f('0x7')]},'systemanswertime':{'type':Sequelize[_0xa48f('0x7')]},'answertime':{'type':Sequelize[_0xa48f('0x7')]},'endtime':{'type':Sequelize[_0xa48f('0x7')]},'duration':{'type':Sequelize[_0xa48f('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa48f('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa48f('0x2')]},'amaflags':{'type':Sequelize[_0xa48f('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xa48f('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xa48f('0x2')]},'note':{'type':Sequelize[_0xa48f('0x2')]},'prefix':{'type':Sequelize[_0xa48f('0x2')]},'routeid':{'type':Sequelize[_0xa48f('0x8')]},'sipcallid':{'type':Sequelize[_0xa48f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ebcea5b..245e758 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x2ef3,0xba));var _0x32ef=function(_0x46e3d5,_0x24bdbd){_0x46e3d5=_0x46e3d5-0x0;var _0x159f37=_0x2ef3[_0x46e3d5];return _0x159f37;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x555faa,_0x2fc199){var _0x19a33c=function(_0x3897fc){while(--_0x3897fc){_0x555faa['push'](_0x555faa['shift']());}};_0x19a33c(++_0x2fc199);}(_0xdb28,0x106));var _0x8db2=function(_0x580ca9,_0x26920f){_0x580ca9=_0x580ca9-0x0;var _0x1c5eb9=_0xdb28[_0x580ca9];return _0x1c5eb9;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 476cb68..d8b2751 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 _0x0953=['./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ecbd4,_0x57edd7){var _0x41e196=function(_0x1c4dc6){while(--_0x1c4dc6){_0x4ecbd4['push'](_0x4ecbd4['shift']());}};_0x41e196(++_0x57edd7);}(_0x0953,0x12b));var _0x3095=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x0953[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0x3095('0x0'));var util=require(_0x3095('0x1'));var logger=require(_0x3095('0x2'))(_0x3095('0x3'));var moment=require(_0x3095('0x4'));var BPromise=require(_0x3095('0x5'));var rp=require(_0x3095('0x6'));var fs=require('fs');var path=require(_0x3095('0x7'));var rimraf=require(_0x3095('0x8'));var config=require('../../config/environment');var attributes=require(_0x3095('0x9'));module[_0x3095('0xa')]=function(_0xd61a81,_0x28ce18){return _0xd61a81[_0x3095('0xb')](_0x3095('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x3095('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d99=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid'];(function(_0x23ce8a,_0x288aa7){var _0x108679=function(_0x355cfb){while(--_0x355cfb){_0x23ce8a['push'](_0x23ce8a['shift']());}};_0x108679(++_0x288aa7);}(_0x5d99,0x150));var _0x95d9=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x5d99[_0x810e4d];return _0x13f01c;};'use strict';var _=require('lodash');var util=require(_0x95d9('0x0'));var logger=require(_0x95d9('0x1'))(_0x95d9('0x2'));var moment=require(_0x95d9('0x3'));var BPromise=require(_0x95d9('0x4'));var rp=require(_0x95d9('0x5'));var fs=require('fs');var path=require(_0x95d9('0x6'));var rimraf=require(_0x95d9('0x7'));var config=require(_0x95d9('0x8'));var attributes=require(_0x95d9('0x9'));module[_0x95d9('0xa')]=function(_0x70af06,_0x2a3a71){return _0x70af06[_0x95d9('0xb')]('VoiceCallReport',attributes,{'tableName':_0x95d9('0xc'),'paranoid':![],'indexes':[{'fields':[_0x95d9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b9f4ea9..69e6f82 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 _0xa5ae=['GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','model','map','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2ca2fa,_0x13b02e){var _0xbce4e5=function(_0x54cf43){while(--_0x54cf43){_0x2ca2fa['push'](_0x2ca2fa['shift']());}};_0xbce4e5(++_0x13b02e);}(_0xa5ae,0x1f2));var _0xea5a=function(_0x2bdcfd,_0x32697d){_0x2bdcfd=_0x2bdcfd-0x0;var _0x53a635=_0xa5ae[_0x2bdcfd];return _0x53a635;};'use strict';var _=require(_0xea5a('0x0'));var util=require('util');var moment=require(_0xea5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xea5a('0x2'));var fs=require('fs');var Redis=require(_0xea5a('0x3'));var db=require(_0xea5a('0x4'))['db'];var utils=require(_0xea5a('0x5'));var logger=require(_0xea5a('0x6'))(_0xea5a('0x7'));var config=require('../../config/environment');var jayson=require(_0xea5a('0x8'));var client=jayson[_0xea5a('0x9')][_0xea5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46ee75,_0x55f127,_0x11e6ee){return new BPromise(function(_0x566bbf,_0x5f56cf){return client[_0xea5a('0xb')](_0x46ee75,_0x11e6ee)[_0xea5a('0xc')](function(_0x4e7d8a){logger[_0xea5a('0xd')](_0xea5a('0xe'),_0x55f127,'request\x20sent');logger['debug'](_0xea5a('0xf'),_0x55f127,_0xea5a('0x10'),JSON[_0xea5a('0x11')](_0x4e7d8a));if(_0x4e7d8a[_0xea5a('0x12')]){if(_0x4e7d8a[_0xea5a('0x12')][_0xea5a('0x13')]===0x1f4){logger[_0xea5a('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x55f127,_0x4e7d8a[_0xea5a('0x12')][_0xea5a('0x14')]);return _0x5f56cf(_0x4e7d8a['error'][_0xea5a('0x14')]);}logger['error'](_0xea5a('0xe'),_0x55f127,_0x4e7d8a[_0xea5a('0x12')][_0xea5a('0x14')]);return _0x566bbf(_0x4e7d8a['error'][_0xea5a('0x14')]);}else{logger[_0xea5a('0xd')](_0xea5a('0xe'),_0x55f127,_0xea5a('0x10'));_0x566bbf(_0x4e7d8a[_0xea5a('0x15')][_0xea5a('0x14')]);}})['catch'](function(_0x4ecb93){logger[_0xea5a('0x12')](_0xea5a('0xe'),_0x55f127,_0x4ecb93);_0x5f56cf(_0x4ecb93);});});}exports[_0xea5a('0x16')]=function(_0x29ced7){var _0x2798c2=this;return new Promise(function(_0x1b04da,_0x2631d4){return db[_0xea5a('0x17')][_0xea5a('0x18')]({'raw':_0x29ced7['options']?_0x29ced7[_0xea5a('0x19')][_0xea5a('0x1a')]===undefined?!![]:![]:!![],'where':_0x29ced7[_0xea5a('0x19')]?_0x29ced7[_0xea5a('0x19')][_0xea5a('0x1b')]||null:null,'attributes':_0x29ced7[_0xea5a('0x19')]?_0x29ced7[_0xea5a('0x19')][_0xea5a('0x1c')]||null:null,'limit':_0x29ced7[_0xea5a('0x19')]?_0x29ced7['options']['limit']||null:null,'include':_0x29ced7[_0xea5a('0x19')]?_0x29ced7[_0xea5a('0x19')]['include']?_['map'](_0x29ced7[_0xea5a('0x19')][_0xea5a('0x1d')],function(_0x32afed){return{'model':db[_0x32afed[_0xea5a('0x1e')]],'as':_0x32afed['as'],'attributes':_0x32afed[_0xea5a('0x1c')],'include':_0x32afed['include']?_[_0xea5a('0x1f')](_0x32afed[_0xea5a('0x1d')],function(_0x5cdb7f){return{'model':db[_0x5cdb7f[_0xea5a('0x1e')]],'as':_0x5cdb7f['as'],'attributes':_0x5cdb7f[_0xea5a('0x1c')],'include':_0x5cdb7f[_0xea5a('0x1d')]?_['map'](_0x5cdb7f[_0xea5a('0x1d')],function(_0x446a3e){return{'model':db[_0x446a3e[_0xea5a('0x1e')]],'as':_0x446a3e['as'],'attributes':_0x446a3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xea5a('0xc')](function(_0x5b9d23){logger['info'](_0xea5a('0x16'),_0x29ced7);logger[_0xea5a('0x20')]('GetVoiceCallReport',_0x29ced7,JSON[_0xea5a('0x11')](_0x5b9d23));_0x1b04da(_0x5b9d23);})['catch'](function(_0x1e2034){logger[_0xea5a('0x12')]('GetVoiceCallReport',_0x1e2034['message'],_0x29ced7);_0x2631d4(_0x2798c2['error'](0x1f4,_0x1e2034[_0xea5a('0x14')]));});});};exports[_0xea5a('0x21')]=function(_0x1c9f82){var _0x58e2e9=this;return new Promise(function(_0x8f4bfe,_0x3203ad){return db['VoiceCallReport'][_0xea5a('0x22')](_0x1c9f82[_0xea5a('0x23')],{'raw':_0x1c9f82[_0xea5a('0x19')]?_0x1c9f82[_0xea5a('0x19')][_0xea5a('0x1a')]===undefined?!![]:![]:!![]})[_0xea5a('0xc')](function(_0x4837ac){logger[_0xea5a('0xd')]('CreateVoiceCallReport',_0x1c9f82);logger['debug'](_0xea5a('0x21'),_0x1c9f82,JSON[_0xea5a('0x11')](_0x4837ac));_0x8f4bfe(_0x4837ac);})['catch'](function(_0x173ca8){logger['error']('CreateVoiceCallReport',_0x173ca8[_0xea5a('0x14')],_0x1c9f82);_0x3203ad(_0x58e2e9[_0xea5a('0x12')](0x1f4,_0x173ca8[_0xea5a('0x14')]));});});};exports[_0xea5a('0x24')]=function(_0x548409){var _0x57d6a7=this;return new Promise(function(_0x3bd43c,_0x1a5d52){return db['VoiceCallReport'][_0xea5a('0x25')](_0x548409[_0xea5a('0x23')],{'raw':_0x548409[_0xea5a('0x19')]?_0x548409[_0xea5a('0x19')][_0xea5a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x548409[_0xea5a('0x19')]?_0x548409[_0xea5a('0x19')][_0xea5a('0x1b')]||null:null,'attributes':_0x548409[_0xea5a('0x19')]?_0x548409[_0xea5a('0x19')][_0xea5a('0x1c')]||null:null,'limit':_0x548409[_0xea5a('0x19')]?_0x548409[_0xea5a('0x19')][_0xea5a('0x26')]||null:null})[_0xea5a('0xc')](function(_0x4f32af){logger[_0xea5a('0xd')]('UpdateVoiceCallReport',_0x548409);logger[_0xea5a('0x20')](_0xea5a('0x24'),_0x548409,JSON[_0xea5a('0x11')](_0x4f32af));_0x3bd43c(_0x4f32af);})[_0xea5a('0x27')](function(_0xe91d1){logger[_0xea5a('0x12')](_0xea5a('0x24'),_0xe91d1[_0xea5a('0x14')],_0x548409);_0x1a5d52(_0x57d6a7['error'](0x1f4,_0xe91d1[_0xea5a('0x14')]));});});}; \ No newline at end of file +var _0x8591=['options','raw','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceCallReport','findAll'];(function(_0x23f947,_0x2ec81b){var _0x2969a4=function(_0x57bb2f){while(--_0x57bb2f){_0x23f947['push'](_0x23f947['shift']());}};_0x2969a4(++_0x2ec81b);}(_0x8591,0x1ee));var _0x1859=function(_0x4f48e4,_0x21af0b){_0x4f48e4=_0x4f48e4-0x0;var _0x581c5d=_0x8591[_0x4f48e4];return _0x581c5d;};'use strict';var _=require('lodash');var util=require(_0x1859('0x0'));var moment=require(_0x1859('0x1'));var BPromise=require(_0x1859('0x2'));var rs=require(_0x1859('0x3'));var fs=require('fs');var Redis=require(_0x1859('0x4'));var db=require(_0x1859('0x5'))['db'];var utils=require(_0x1859('0x6'));var logger=require(_0x1859('0x7'))(_0x1859('0x8'));var config=require(_0x1859('0x9'));var jayson=require(_0x1859('0xa'));var client=jayson['client'][_0x1859('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48f9df,_0x21f367,_0x4bc578){return new BPromise(function(_0x1ab500,_0x5e602a){return client[_0x1859('0xc')](_0x48f9df,_0x4bc578)[_0x1859('0xd')](function(_0x59b1b0){logger[_0x1859('0xe')](_0x1859('0xf'),_0x21f367,'request\x20sent');logger[_0x1859('0x10')](_0x1859('0x11'),_0x21f367,'request\x20sent',JSON[_0x1859('0x12')](_0x59b1b0));if(_0x59b1b0[_0x1859('0x13')]){if(_0x59b1b0[_0x1859('0x13')]['code']===0x1f4){logger['error'](_0x1859('0xf'),_0x21f367,_0x59b1b0[_0x1859('0x13')][_0x1859('0x14')]);return _0x5e602a(_0x59b1b0['error'][_0x1859('0x14')]);}logger[_0x1859('0x13')](_0x1859('0xf'),_0x21f367,_0x59b1b0[_0x1859('0x13')][_0x1859('0x14')]);return _0x1ab500(_0x59b1b0[_0x1859('0x13')][_0x1859('0x14')]);}else{logger[_0x1859('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x21f367,_0x1859('0x15'));_0x1ab500(_0x59b1b0[_0x1859('0x16')][_0x1859('0x14')]);}})[_0x1859('0x17')](function(_0x810dbe){logger[_0x1859('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x21f367,_0x810dbe);_0x5e602a(_0x810dbe);});});}exports[_0x1859('0x18')]=function(_0x59c1e9){var _0x186289=this;return new Promise(function(_0x44f5d7,_0x101292){return db['VoiceCallReport'][_0x1859('0x19')]({'raw':_0x59c1e9[_0x1859('0x1a')]?_0x59c1e9[_0x1859('0x1a')][_0x1859('0x1b')]===undefined?!![]:![]:!![],'where':_0x59c1e9[_0x1859('0x1a')]?_0x59c1e9[_0x1859('0x1a')]['where']||null:null,'attributes':_0x59c1e9['options']?_0x59c1e9['options'][_0x1859('0x1c')]||null:null,'limit':_0x59c1e9[_0x1859('0x1a')]?_0x59c1e9[_0x1859('0x1a')][_0x1859('0x1d')]||null:null,'include':_0x59c1e9[_0x1859('0x1a')]?_0x59c1e9[_0x1859('0x1a')][_0x1859('0x1e')]?_[_0x1859('0x1f')](_0x59c1e9['options'][_0x1859('0x1e')],function(_0x4c510c){return{'model':db[_0x4c510c['model']],'as':_0x4c510c['as'],'attributes':_0x4c510c[_0x1859('0x1c')],'include':_0x4c510c[_0x1859('0x1e')]?_['map'](_0x4c510c[_0x1859('0x1e')],function(_0xabb122){return{'model':db[_0xabb122[_0x1859('0x20')]],'as':_0xabb122['as'],'attributes':_0xabb122['attributes'],'include':_0xabb122['include']?_[_0x1859('0x1f')](_0xabb122['include'],function(_0x2841bd){return{'model':db[_0x2841bd[_0x1859('0x20')]],'as':_0x2841bd['as'],'attributes':_0x2841bd[_0x1859('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1859('0xd')](function(_0xd6e98){logger[_0x1859('0xe')](_0x1859('0x18'),_0x59c1e9);logger[_0x1859('0x10')](_0x1859('0x18'),_0x59c1e9,JSON[_0x1859('0x12')](_0xd6e98));_0x44f5d7(_0xd6e98);})[_0x1859('0x17')](function(_0x2b3980){logger[_0x1859('0x13')](_0x1859('0x18'),_0x2b3980['message'],_0x59c1e9);_0x101292(_0x186289['error'](0x1f4,_0x2b3980[_0x1859('0x14')]));});});};exports[_0x1859('0x21')]=function(_0x4e1b24){var _0x46004d=this;return new Promise(function(_0x2573fa,_0x3ed0fd){return db[_0x1859('0x22')][_0x1859('0x23')](_0x4e1b24[_0x1859('0x24')],{'raw':_0x4e1b24[_0x1859('0x1a')]?_0x4e1b24[_0x1859('0x1a')][_0x1859('0x1b')]===undefined?!![]:![]:!![]})[_0x1859('0xd')](function(_0x2ad474){logger['info'](_0x1859('0x21'),_0x4e1b24);logger[_0x1859('0x10')](_0x1859('0x21'),_0x4e1b24,JSON[_0x1859('0x12')](_0x2ad474));_0x2573fa(_0x2ad474);})[_0x1859('0x17')](function(_0x132ec3){logger[_0x1859('0x13')]('CreateVoiceCallReport',_0x132ec3[_0x1859('0x14')],_0x4e1b24);_0x3ed0fd(_0x46004d['error'](0x1f4,_0x132ec3[_0x1859('0x14')]));});});};exports[_0x1859('0x25')]=function(_0x16dc8f){var _0x28e43e=this;return new Promise(function(_0x41964e,_0x3e9652){return db['VoiceCallReport'][_0x1859('0x26')](_0x16dc8f[_0x1859('0x24')],{'raw':_0x16dc8f[_0x1859('0x1a')]?_0x16dc8f[_0x1859('0x1a')][_0x1859('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16dc8f[_0x1859('0x1a')]?_0x16dc8f[_0x1859('0x1a')][_0x1859('0x27')]||null:null,'attributes':_0x16dc8f[_0x1859('0x1a')]?_0x16dc8f[_0x1859('0x1a')][_0x1859('0x1c')]||null:null,'limit':_0x16dc8f['options']?_0x16dc8f[_0x1859('0x1a')][_0x1859('0x1d')]||null:null})[_0x1859('0xd')](function(_0x23cd0a){logger[_0x1859('0xe')](_0x1859('0x25'),_0x16dc8f);logger[_0x1859('0x10')](_0x1859('0x25'),_0x16dc8f,JSON[_0x1859('0x12')](_0x23cd0a));_0x41964e(_0x23cd0a);})[_0x1859('0x17')](function(_0x316101){logger[_0x1859('0x13')](_0x1859('0x25'),_0x316101['message'],_0x16dc8f);_0x3e9652(_0x28e43e[_0x1859('0x13')](0x1f4,_0x316101[_0x1859('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9689d6f..ea6f8d6 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 _0xab33=['show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5558b0,_0x3a0345){var _0x243294=function(_0x295169){while(--_0x295169){_0x5558b0['push'](_0x5558b0['shift']());}};_0x243294(++_0x3a0345);}(_0xab33,0x1e8));var _0x3ab3=function(_0x2850ab,_0x3d6a5d){_0x2850ab=_0x2850ab-0x0;var _0xfed0e1=_0xab33[_0x2850ab];return _0xfed0e1;};'use strict';var multer=require(_0x3ab3('0x0'));var util=require(_0x3ab3('0x1'));var path=require(_0x3ab3('0x2'));var timeout=require(_0x3ab3('0x3'));var express=require(_0x3ab3('0x4'));var router=express[_0x3ab3('0x5')]();var fs_extra=require(_0x3ab3('0x6'));var auth=require(_0x3ab3('0x7'));var interaction=require(_0x3ab3('0x8'));var config=require(_0x3ab3('0x9'));var controller=require('./voiceChanSpy.controller');router[_0x3ab3('0xa')]('/',auth[_0x3ab3('0xb')](),controller['index']);router[_0x3ab3('0xa')]('/:id',auth[_0x3ab3('0xb')](),controller[_0x3ab3('0xc')]);router[_0x3ab3('0xd')]('/',auth[_0x3ab3('0xb')](),controller[_0x3ab3('0xe')]);router[_0x3ab3('0xf')](_0x3ab3('0x10'),auth[_0x3ab3('0xb')](),controller[_0x3ab3('0x11')]);router[_0x3ab3('0x12')](_0x3ab3('0x10'),auth[_0x3ab3('0xb')](),controller[_0x3ab3('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbdfc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','show','post','put','/:id','update','delete','exports','multer','util','connect-timeout','express'];(function(_0xae1475,_0x24fc8b){var _0x1f5d5e=function(_0x2385b6){while(--_0x2385b6){_0xae1475['push'](_0xae1475['shift']());}};_0x1f5d5e(++_0x24fc8b);}(_0xbdfc,0x68));var _0xcbdf=function(_0x4f2b6a,_0x40583f){_0x4f2b6a=_0x4f2b6a-0x0;var _0x140925=_0xbdfc[_0x4f2b6a];return _0x140925;};'use strict';var multer=require(_0xcbdf('0x0'));var util=require(_0xcbdf('0x1'));var path=require('path');var timeout=require(_0xcbdf('0x2'));var express=require(_0xcbdf('0x3'));var router=express[_0xcbdf('0x4')]();var fs_extra=require(_0xcbdf('0x5'));var auth=require(_0xcbdf('0x6'));var interaction=require(_0xcbdf('0x7'));var config=require('../../config/environment');var controller=require(_0xcbdf('0x8'));router[_0xcbdf('0x9')]('/',auth[_0xcbdf('0xa')](),controller['index']);router[_0xcbdf('0x9')]('/:id',auth[_0xcbdf('0xa')](),controller[_0xcbdf('0xb')]);router[_0xcbdf('0xc')]('/',auth[_0xcbdf('0xa')](),controller['create']);router[_0xcbdf('0xd')](_0xcbdf('0xe'),auth['isAuthenticated'](),controller[_0xcbdf('0xf')]);router[_0xcbdf('0x10')](_0xcbdf('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xcbdf('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b90b023..21d8fcb 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 _0x69e3=['STRING','join','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x2ef6dc,_0x5ad3fa){var _0x1e3426=function(_0x4d399f){while(--_0x4d399f){_0x2ef6dc['push'](_0x2ef6dc['shift']());}};_0x1e3426(++_0x5ad3fa);}(_0x69e3,0x109));var _0x369e=function(_0x5cfe33,_0x42be32){_0x5cfe33=_0x5cfe33-0x0;var _0x3b1223=_0x69e3[_0x5cfe33];return _0x3b1223;};'use strict';var Sequelize=require(_0x369e('0x0'));module['exports']={'name':{'type':Sequelize[_0x369e('0x1')]},'prefix':{'type':Sequelize[_0x369e('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x369e('0x1')],'set':function(_0x1100fd){this['setDataValue']('options',_0x1100fd?_0x1100fd[_0x369e('0x2')](''):[]);},'get':function(){return this[_0x369e('0x3')](_0x369e('0x4'))?this[_0x369e('0x3')](_0x369e('0x4'))[_0x369e('0x5')](''):[];}},'auth':{'type':Sequelize[_0x369e('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x369e('0x1')]},'record':{'type':Sequelize[_0x369e('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x369e('0x1')]},'description':{'type':Sequelize[_0x369e('0x1')]}}; \ No newline at end of file +var _0x2a76=['join','getDataValue','split','BOOLEAN','exports','STRING','name','options'];(function(_0x49e02c,_0x88247){var _0xa40e64=function(_0x5c202a){while(--_0x5c202a){_0x49e02c['push'](_0x49e02c['shift']());}};_0xa40e64(++_0x88247);}(_0x2a76,0xcc));var _0x62a7=function(_0x498fea,_0x3e2bab){_0x498fea=_0x498fea-0x0;var _0x10f3ee=_0x2a76[_0x498fea];return _0x10f3ee;};'use strict';var Sequelize=require('sequelize');module[_0x62a7('0x0')]={'name':{'type':Sequelize[_0x62a7('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x62a7('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x62a7('0x1')],'set':function(_0x5e6993){this['setDataValue'](_0x62a7('0x3'),_0x5e6993?_0x5e6993[_0x62a7('0x4')](''):[]);},'get':function(){return this[_0x62a7('0x5')](_0x62a7('0x3'))?this['getDataValue'](_0x62a7('0x3'))[_0x62a7('0x6')](''):[];}},'auth':{'type':Sequelize[_0x62a7('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x62a7('0x1')]},'record':{'type':Sequelize[_0x62a7('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x62a7('0x1')]},'description':{'type':Sequelize[_0x62a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 34089ba..9ef8cb9 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 _0xf874=['ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','ChanSpies','UserProfileResource','error','stack','name','index','VoiceChanSpy','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','show','length','include','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x2442dd,_0x269ded){var _0x9d4594=function(_0x4964ff){while(--_0x4964ff){_0x2442dd['push'](_0x2442dd['shift']());}};_0x9d4594(++_0x269ded);}(_0xf874,0xed));var _0x4f87=function(_0x3e1acf,_0x47f207){_0x3e1acf=_0x3e1acf-0x0;var _0x34bb08=_0xf874[_0x3e1acf];return _0x34bb08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f87('0x0'));var jsonpatch=require(_0x4f87('0x1'));var rp=require(_0x4f87('0x2'));var moment=require(_0x4f87('0x3'));var BPromise=require(_0x4f87('0x4'));var Mustache=require(_0x4f87('0x5'));var util=require('util');var path=require(_0x4f87('0x6'));var sox=require(_0x4f87('0x7'));var csv=require(_0x4f87('0x8'));var ejs=require(_0x4f87('0x9'));var fs=require('fs');var fs_extra=require(_0x4f87('0xa'));var _=require(_0x4f87('0xb'));var squel=require('squel');var crypto=require(_0x4f87('0xc'));var jsforce=require(_0x4f87('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f87('0x8'));var querystring=require(_0x4f87('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f87('0xf'));var authService=require(_0x4f87('0x10'));var qs=require(_0x4f87('0x11'));var as=require(_0x4f87('0x12'));var hardwareService=require(_0x4f87('0x13'));var logger=require(_0x4f87('0x14'))(_0x4f87('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f87('0x16'));var db=require(_0x4f87('0x17'))['db'];function respondWithStatusCode(_0x107d98,_0x5e6d04){_0x5e6d04=_0x5e6d04||0xcc;return function(_0x4ebb6a){if(_0x4ebb6a){return _0x107d98[_0x4f87('0x18')](_0x5e6d04);}return _0x107d98[_0x4f87('0x19')](_0x5e6d04)[_0x4f87('0x1a')]();};}function respondWithResult(_0x482c6e,_0x2f11d2){_0x2f11d2=_0x2f11d2||0xc8;return function(_0x4a0e2f){if(_0x4a0e2f){return _0x482c6e[_0x4f87('0x19')](_0x2f11d2)[_0x4f87('0x1b')](_0x4a0e2f);}};}function respondWithFilteredResult(_0x4ea72f,_0x2907f6){return function(_0x325edc){if(_0x325edc){var _0xa47360=typeof _0x2907f6[_0x4f87('0x1c')]===_0x4f87('0x1d')&&typeof _0x2907f6[_0x4f87('0x1e')]==='undefined';var _0x3571be=_0x325edc['count'];var _0x10551e=_0xa47360?0x0:_0x2907f6[_0x4f87('0x1c')];var _0x46492d=_0xa47360?_0x325edc[_0x4f87('0x1f')]:_0x2907f6[_0x4f87('0x1c')]+_0x2907f6[_0x4f87('0x1e')];var _0x36cd37;if(_0x46492d>=_0x3571be){_0x46492d=_0x3571be;_0x36cd37=0xc8;}else{_0x36cd37=0xce;}_0x4ea72f[_0x4f87('0x19')](_0x36cd37);return _0x4ea72f[_0x4f87('0x20')](_0x4f87('0x21'),_0x10551e+'-'+_0x46492d+'/'+_0x3571be)[_0x4f87('0x1b')](_0x325edc);}return null;};}function patchUpdates(_0x2c13a0){return function(_0x17d5f8){try{jsonpatch['apply'](_0x17d5f8,_0x2c13a0,!![]);}catch(_0x47ed1e){return BPromise[_0x4f87('0x22')](_0x47ed1e);}return _0x17d5f8[_0x4f87('0x23')]();};}function saveUpdates(_0x5bc73b,_0x592edd){return function(_0x30636d){if(_0x30636d){return _0x30636d['update'](_0x5bc73b)['then'](function(_0x401cd6){return _0x401cd6;});}return null;};}function removeEntity(_0x3c4450,_0x2a382c){return function(_0x3cf180){if(_0x3cf180){return _0x3cf180[_0x4f87('0x24')]()[_0x4f87('0x25')](function(){var _0x197f44=_0x3cf180['get']({'plain':!![]});var _0x234106=_0x4f87('0x26');return db[_0x4f87('0x27')]['destroy']({'where':{'type':_0x234106,'resourceId':_0x197f44['id']}})[_0x4f87('0x25')](function(){return _0x3cf180;});})[_0x4f87('0x25')](function(){_0x3c4450['status'](0xcc)[_0x4f87('0x1a')]();});}};}function handleEntityNotFound(_0xe299f1,_0x3eab48){return function(_0x41e940){if(!_0x41e940){_0xe299f1['sendStatus'](0x194);}return _0x41e940;};}function handleError(_0x4f60dc,_0x2ed28d){_0x2ed28d=_0x2ed28d||0x1f4;return function(_0x208f0a){logger[_0x4f87('0x28')](_0x208f0a[_0x4f87('0x29')]);if(_0x208f0a[_0x4f87('0x2a')]){delete _0x208f0a['name'];}_0x4f60dc[_0x4f87('0x19')](_0x2ed28d)['send'](_0x208f0a);};}exports[_0x4f87('0x2b')]=function(_0x8f847e,_0x149a5b){var _0x430cf9={},_0x3e04ce={},_0x23e54a={'count':0x0,'rows':[]};var _0xaa4ba4=_['map'](db[_0x4f87('0x2c')]['rawAttributes'],function(_0x1d3bec){return{'name':_0x1d3bec[_0x4f87('0x2d')],'type':_0x1d3bec[_0x4f87('0x2e')][_0x4f87('0x2f')]};});_0x3e04ce[_0x4f87('0x30')]=_[_0x4f87('0x31')](_0xaa4ba4,_0x4f87('0x2a'));_0x3e04ce[_0x4f87('0x32')]=_[_0x4f87('0x33')](_0x8f847e[_0x4f87('0x32')]);_0x3e04ce[_0x4f87('0x34')]=_[_0x4f87('0x35')](_0x3e04ce['model'],_0x3e04ce[_0x4f87('0x32')]);_0x430cf9[_0x4f87('0x36')]=_['intersection'](_0x3e04ce[_0x4f87('0x30')],qs[_0x4f87('0x37')](_0x8f847e[_0x4f87('0x32')]['fields']));_0x430cf9[_0x4f87('0x36')]=_0x430cf9[_0x4f87('0x36')]['length']?_0x430cf9[_0x4f87('0x36')]:_0x3e04ce['model'];if(!_0x8f847e[_0x4f87('0x32')][_0x4f87('0x38')](_0x4f87('0x39'))){_0x430cf9['limit']=qs[_0x4f87('0x1e')](_0x8f847e['query']['limit']);_0x430cf9[_0x4f87('0x1c')]=qs[_0x4f87('0x1c')](_0x8f847e['query'][_0x4f87('0x1c')]);}_0x430cf9[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x8f847e[_0x4f87('0x32')]['sort']);_0x430cf9['where']=qs['filters'](_['pick'](_0x8f847e[_0x4f87('0x32')],_0x3e04ce[_0x4f87('0x34')]),_0xaa4ba4);if(_0x8f847e['query'][_0x4f87('0x3c')]){_0x430cf9[_0x4f87('0x3d')]=_[_0x4f87('0x3e')](_0x430cf9[_0x4f87('0x3d')],{'$or':_[_0x4f87('0x31')](_0xaa4ba4,function(_0x42bf41){if(_0x42bf41['type']!==_0x4f87('0x3f')){var _0x4bae2d={};_0x4bae2d[_0x42bf41['name']]={'$like':'%'+_0x8f847e[_0x4f87('0x32')][_0x4f87('0x3c')]+'%'};return _0x4bae2d;}})});}_0x430cf9=_[_0x4f87('0x3e')]({},_0x430cf9,_0x8f847e['options']);var _0x1d6415={'where':_0x430cf9[_0x4f87('0x3d')]};return db['VoiceChanSpy'][_0x4f87('0x1f')](_0x1d6415)[_0x4f87('0x25')](function(_0x3ae242){_0x23e54a[_0x4f87('0x1f')]=_0x3ae242;if(_0x8f847e[_0x4f87('0x32')][_0x4f87('0x40')]){_0x430cf9['include']=[{'all':!![]}];}return db[_0x4f87('0x2c')][_0x4f87('0x41')](_0x430cf9);})[_0x4f87('0x25')](function(_0x29c7c5){_0x23e54a['rows']=_0x29c7c5;return _0x23e54a;})[_0x4f87('0x25')](respondWithFilteredResult(_0x149a5b,_0x430cf9))['catch'](handleError(_0x149a5b,null));};exports[_0x4f87('0x42')]=function(_0x28f049,_0x3afdcb){var _0x1610f1={'raw':![],'where':{'id':_0x28f049['params']['id']}},_0x58f2db={};_0x58f2db['model']=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x58f2db[_0x4f87('0x32')]=_[_0x4f87('0x33')](_0x28f049[_0x4f87('0x32')]);_0x58f2db[_0x4f87('0x34')]=_[_0x4f87('0x35')](_0x58f2db[_0x4f87('0x30')],_0x58f2db[_0x4f87('0x32')]);_0x1610f1[_0x4f87('0x36')]=_['intersection'](_0x58f2db[_0x4f87('0x30')],qs[_0x4f87('0x37')](_0x28f049[_0x4f87('0x32')][_0x4f87('0x37')]));_0x1610f1[_0x4f87('0x36')]=_0x1610f1[_0x4f87('0x36')][_0x4f87('0x43')]?_0x1610f1[_0x4f87('0x36')]:_0x58f2db[_0x4f87('0x30')];if(_0x28f049[_0x4f87('0x32')][_0x4f87('0x40')]){_0x1610f1[_0x4f87('0x44')]=[{'all':!![]}];}_0x1610f1=_[_0x4f87('0x3e')]({},_0x1610f1,_0x28f049[_0x4f87('0x45')]);return db[_0x4f87('0x2c')][_0x4f87('0x46')](_0x1610f1)[_0x4f87('0x25')](handleEntityNotFound(_0x3afdcb,null))['then'](respondWithResult(_0x3afdcb,null))[_0x4f87('0x47')](handleError(_0x3afdcb,null));};exports['create']=function(_0x59a7ce,_0x3e7383){return db[_0x4f87('0x2c')][_0x4f87('0x48')](_0x59a7ce[_0x4f87('0x49')],{})[_0x4f87('0x25')](function(_0x1e29dc){var _0x221c14=_0x59a7ce[_0x4f87('0x4a')][_0x4f87('0x4b')]({'plain':!![]});if(!_0x221c14)throw new Error(_0x4f87('0x4c'));if(_0x221c14['role']==='user'){var _0x2b9af9=_0x1e29dc[_0x4f87('0x4b')]({'plain':!![]});var _0xb34275='ChanSpies';return db['UserProfileSection'][_0x4f87('0x46')]({'where':{'name':_0xb34275,'userProfileId':_0x221c14[_0x4f87('0x4d')]},'raw':!![]})[_0x4f87('0x25')](function(_0xc81d81){if(_0xc81d81&&_0xc81d81[_0x4f87('0x4e')]===0x0){return db[_0x4f87('0x27')]['create']({'name':_0x2b9af9[_0x4f87('0x2a')],'resourceId':_0x2b9af9['id'],'type':_0xc81d81['name'],'sectionId':_0xc81d81['id']},{})[_0x4f87('0x25')](function(){return _0x1e29dc;});}else{return _0x1e29dc;}})['catch'](function(_0x225c5c){logger[_0x4f87('0x28')](_0x4f87('0x4f'),_0x225c5c);throw _0x225c5c;});}return _0x1e29dc;})[_0x4f87('0x25')](respondWithResult(_0x3e7383,0xc9))[_0x4f87('0x47')](handleError(_0x3e7383,null));};exports[_0x4f87('0x50')]=function(_0x22c389,_0x526c78){if(_0x22c389[_0x4f87('0x49')]['id']){delete _0x22c389[_0x4f87('0x49')]['id'];}return db[_0x4f87('0x2c')]['find']({'where':{'id':_0x22c389[_0x4f87('0x51')]['id']}})['then'](handleEntityNotFound(_0x526c78,null))[_0x4f87('0x25')](saveUpdates(_0x22c389[_0x4f87('0x49')],null))[_0x4f87('0x25')](respondWithResult(_0x526c78,null))[_0x4f87('0x47')](handleError(_0x526c78,null));};exports[_0x4f87('0x24')]=function(_0x51ee0e,_0x16e323){return db[_0x4f87('0x2c')]['find']({'where':{'id':_0x51ee0e[_0x4f87('0x51')]['id']}})[_0x4f87('0x25')](handleEntityNotFound(_0x16e323,null))[_0x4f87('0x25')](removeEntity(_0x16e323,null))[_0x4f87('0x47')](handleError(_0x16e323,null));}; \ No newline at end of file +var _0x49e9=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','error','name','index','map','VoiceChanSpy','rawAttributes','type'];(function(_0x58c86a,_0x602654){var _0x2bb374=function(_0x1302a9){while(--_0x1302a9){_0x58c86a['push'](_0x58c86a['shift']());}};_0x2bb374(++_0x602654);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){var _0x36c890=_0x23b38e[_0x949e('0x27')]({'plain':!![]});var _0x1185b3=_0x949e('0x28');return db[_0x949e('0x29')][_0x949e('0x26')]({'where':{'type':_0x1185b3,'resourceId':_0x36c890['id']}})[_0x949e('0x25')](function(){return _0x23b38e;});})['then'](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x59b3a1,_0x39308f){return function(_0x20061d){if(!_0x20061d){_0x59b3a1['sendStatus'](0x194);}return _0x20061d;};}function handleError(_0x446401,_0x36dc1d){_0x36dc1d=_0x36dc1d||0x1f4;return function(_0x5b9f28){logger[_0x949e('0x2a')](_0x5b9f28['stack']);if(_0x5b9f28['name']){delete _0x5b9f28[_0x949e('0x2b')];}_0x446401['status'](_0x36dc1d)['send'](_0x5b9f28);};}exports[_0x949e('0x2c')]=function(_0x3502c1,_0x3051ec){var _0x4c890f={},_0x4ca7ae={},_0x56dc85={'count':0x0,'rows':[]};var _0x4eddbd=_[_0x949e('0x2d')](db[_0x949e('0x2e')][_0x949e('0x2f')],function(_0x1fe31b){return{'name':_0x1fe31b['fieldName'],'type':_0x1fe31b[_0x949e('0x30')][_0x949e('0x31')]};});_0x4ca7ae[_0x949e('0x32')]=_['map'](_0x4eddbd,_0x949e('0x2b'));_0x4ca7ae[_0x949e('0x33')]=_[_0x949e('0x34')](_0x3502c1['query']);_0x4ca7ae['filters']=_[_0x949e('0x35')](_0x4ca7ae[_0x949e('0x32')],_0x4ca7ae[_0x949e('0x33')]);_0x4c890f[_0x949e('0x36')]=_['intersection'](_0x4ca7ae[_0x949e('0x32')],qs[_0x949e('0x37')](_0x3502c1[_0x949e('0x33')][_0x949e('0x37')]));_0x4c890f[_0x949e('0x36')]=_0x4c890f[_0x949e('0x36')][_0x949e('0x38')]?_0x4c890f[_0x949e('0x36')]:_0x4ca7ae['model'];if(!_0x3502c1['query'][_0x949e('0x39')]('nolimit')){_0x4c890f['limit']=qs[_0x949e('0x1c')](_0x3502c1[_0x949e('0x33')][_0x949e('0x1c')]);_0x4c890f[_0x949e('0x1e')]=qs[_0x949e('0x1e')](_0x3502c1[_0x949e('0x33')][_0x949e('0x1e')]);}_0x4c890f[_0x949e('0x3a')]=qs[_0x949e('0x3b')](_0x3502c1[_0x949e('0x33')][_0x949e('0x3b')]);_0x4c890f[_0x949e('0x3c')]=qs[_0x949e('0x3d')](_[_0x949e('0x3e')](_0x3502c1[_0x949e('0x33')],_0x4ca7ae[_0x949e('0x3d')]),_0x4eddbd);if(_0x3502c1[_0x949e('0x33')]['filter']){_0x4c890f[_0x949e('0x3c')]=_['merge'](_0x4c890f[_0x949e('0x3c')],{'$or':_[_0x949e('0x2d')](_0x4eddbd,function(_0x53629d){if(_0x53629d['type']!=='VIRTUAL'){var _0x1e848c={};_0x1e848c[_0x53629d[_0x949e('0x2b')]]={'$like':'%'+_0x3502c1['query']['filter']+'%'};return _0x1e848c;}})});}_0x4c890f=_['merge']({},_0x4c890f,_0x3502c1[_0x949e('0x3f')]);var _0x2bd51b={'where':_0x4c890f['where']};return db[_0x949e('0x2e')][_0x949e('0x1d')](_0x2bd51b)['then'](function(_0x3a1bc7){_0x56dc85[_0x949e('0x1d')]=_0x3a1bc7;if(_0x3502c1[_0x949e('0x33')][_0x949e('0x40')]){_0x4c890f['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x949e('0x41')](_0x4c890f);})[_0x949e('0x25')](function(_0x7201da){_0x56dc85[_0x949e('0x42')]=_0x7201da;return _0x56dc85;})[_0x949e('0x25')](respondWithFilteredResult(_0x3051ec,_0x4c890f))[_0x949e('0x43')](handleError(_0x3051ec,null));};exports[_0x949e('0x44')]=function(_0x572f20,_0x4c7d73){var _0x985ff8={'raw':![],'where':{'id':_0x572f20[_0x949e('0x45')]['id']}},_0x5e970b={};_0x5e970b[_0x949e('0x32')]=_[_0x949e('0x34')](db[_0x949e('0x2e')][_0x949e('0x2f')]);_0x5e970b[_0x949e('0x33')]=_['keys'](_0x572f20['query']);_0x5e970b[_0x949e('0x3d')]=_[_0x949e('0x35')](_0x5e970b[_0x949e('0x32')],_0x5e970b[_0x949e('0x33')]);_0x985ff8[_0x949e('0x36')]=_['intersection'](_0x5e970b[_0x949e('0x32')],qs[_0x949e('0x37')](_0x572f20['query'][_0x949e('0x37')]));_0x985ff8[_0x949e('0x36')]=_0x985ff8[_0x949e('0x36')][_0x949e('0x38')]?_0x985ff8[_0x949e('0x36')]:_0x5e970b[_0x949e('0x32')];if(_0x572f20[_0x949e('0x33')][_0x949e('0x40')]){_0x985ff8[_0x949e('0x46')]=[{'all':!![]}];}_0x985ff8=_['merge']({},_0x985ff8,_0x572f20[_0x949e('0x3f')]);return db['VoiceChanSpy'][_0x949e('0x47')](_0x985ff8)[_0x949e('0x25')](handleEntityNotFound(_0x4c7d73,null))['then'](respondWithResult(_0x4c7d73,null))[_0x949e('0x43')](handleError(_0x4c7d73,null));};exports[_0x949e('0x48')]=function(_0x121355,_0x2e2b6a){return db[_0x949e('0x2e')][_0x949e('0x48')](_0x121355[_0x949e('0x49')],{})[_0x949e('0x25')](function(_0x5d4348){var _0x8f2a58=_0x121355[_0x949e('0x4a')][_0x949e('0x27')]({'plain':!![]});if(!_0x8f2a58)throw new Error(_0x949e('0x4b'));if(_0x8f2a58[_0x949e('0x4c')]==='user'){var _0x5f23b2=_0x5d4348[_0x949e('0x27')]({'plain':!![]});var _0x16f5ad='ChanSpies';return db[_0x949e('0x4d')][_0x949e('0x47')]({'where':{'name':_0x16f5ad,'userProfileId':_0x8f2a58[_0x949e('0x4e')]},'raw':!![]})[_0x949e('0x25')](function(_0x48c677){if(_0x48c677&&_0x48c677['autoAssociation']===0x0){return db[_0x949e('0x29')][_0x949e('0x48')]({'name':_0x5f23b2[_0x949e('0x2b')],'resourceId':_0x5f23b2['id'],'type':_0x48c677[_0x949e('0x2b')],'sectionId':_0x48c677['id']},{})[_0x949e('0x25')](function(){return _0x5d4348;});}else{return _0x5d4348;}})[_0x949e('0x43')](function(_0x29ebb6){logger[_0x949e('0x2a')](_0x949e('0x4f'),_0x29ebb6);throw _0x29ebb6;});}return _0x5d4348;})['then'](respondWithResult(_0x2e2b6a,0xc9))[_0x949e('0x43')](handleError(_0x2e2b6a,null));};exports['update']=function(_0x2f63aa,_0x4fb3d5){if(_0x2f63aa[_0x949e('0x49')]['id']){delete _0x2f63aa['body']['id'];}return db[_0x949e('0x2e')][_0x949e('0x47')]({'where':{'id':_0x2f63aa['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x4fb3d5,null))[_0x949e('0x25')](saveUpdates(_0x2f63aa[_0x949e('0x49')],null))[_0x949e('0x25')](respondWithResult(_0x4fb3d5,null))[_0x949e('0x43')](handleError(_0x4fb3d5,null));};exports['destroy']=function(_0x48a016,_0x287a45){return db[_0x949e('0x2e')]['find']({'where':{'id':_0x48a016[_0x949e('0x45')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x287a45,null))['then'](removeEntity(_0x287a45,null))[_0x949e('0x43')](handleError(_0x287a45,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 134e1ca..8a66e23 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 _0xbf30=['name','options','join','record','StopMixMonitor','concat','User','agent','then','catch','exports','models','define','VoiceChanSpy','length','bulkCreate','destroy','VoiceExtension','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy'];(function(_0xf00800,_0x1f50ba){var _0x381043=function(_0x4850fc){while(--_0x4850fc){_0xf00800['push'](_0xf00800['shift']());}};_0x381043(++_0x1f50ba);}(_0xbf30,0xd0));var _0x0bf3=function(_0x4add04,_0x47f426){_0x4add04=_0x4add04-0x0;var _0x55475f=_0xbf30[_0x4add04];return _0x55475f;};'use strict';var _=require(_0x0bf3('0x0'));var util=require(_0x0bf3('0x1'));var BPromise=require(_0x0bf3('0x2'));var attributes=require(_0x0bf3('0x3'));var getUserApplications=function(_0x232411,_0xa4d0a0,_0x529265){var _0x336d11=0x1;var _0x47b508=[];var _0x173c81={'context':_0xa4d0a0[_0x0bf3('0x4')]||_0x0bf3('0x5'),'exten':util[_0x0bf3('0x6')](_0x0bf3('0x7'),_0x232411[_0x0bf3('0x8')],_0x529265),'type':_0x0bf3('0x9'),'isApp':![],'ChanSpyId':_0x232411['id'],'UserId':_0xa4d0a0['id']};_0x47b508[_0x0bf3('0xa')](_[_0x0bf3('0xb')]({'app':_0x0bf3('0xc'),'appdata':util[_0x0bf3('0x6')]('CDR(type)=%s','chanspy'),'priority':_0x336d11++},_0x173c81));if(_0x232411['record']){_0x47b508['push'](_[_0x0bf3('0xb')]({'app':_0x0bf3('0xd'),'appdata':util['format'](_0x0bf3('0xe'),_0x232411[_0x0bf3('0xf')]),'priority':_0x336d11++},_0x173c81));}if(_0x232411[_0x0bf3('0x10')]){_0x47b508[_0x0bf3('0xa')](_[_0x0bf3('0xb')]({'app':_0x0bf3('0x11'),'appdata':_0x232411[_0x0bf3('0x12')],'priority':_0x336d11++},_0x173c81));}_0x47b508[_0x0bf3('0xa')](_[_0x0bf3('0xb')]({'app':_0x0bf3('0x13'),'appdata':util['format']('SIP/%s,%s',_0xa4d0a0[_0x0bf3('0x14')],_0x232411[_0x0bf3('0x15')]?_0x232411[_0x0bf3('0x15')][_0x0bf3('0x16')](''):''),'priority':_0x336d11++},_0x173c81));if(_0x232411[_0x0bf3('0x17')]){_0x47b508[_0x0bf3('0xa')](_['merge']({'app':_0x0bf3('0x18'),'priority':_0x336d11++},_0x173c81));}return _0x47b508;};var getChanSpyApplications=function(_0x1a3d2c,_0x1a30cc){var _0x53b072=[];for(var _0x165d20=0x0,_0x6dba9f=0x1;_0x165d20<_0x1a30cc['length'];_0x165d20++,_0x6dba9f=0x1){_0x53b072=_0x53b072[_0x0bf3('0x19')](getUserApplications(_0x1a3d2c,_0x1a30cc[_0x165d20],_0x1a30cc[_0x165d20]['internal']));if(_0x1a30cc[_0x165d20]['internal']!=_0x1a30cc[_0x165d20][_0x0bf3('0x14')]){_0x53b072=_0x53b072['concat'](getUserApplications(_0x1a3d2c,_0x1a30cc[_0x165d20],_0x1a30cc[_0x165d20]['name']));}}return _0x53b072;};var getChanSpyPromise=function(_0x5cf743,_0xa2a54c){return new BPromise(function(_0x428f63,_0x13038e){return _0x5cf743[_0x0bf3('0x1a')]['findAll']({'attributes':['id',_0x0bf3('0x14'),'internal'],'where':{'role':_0x0bf3('0x1b'),'chanspy':!![]},'raw':!![]})[_0x0bf3('0x1c')](function(_0x355db1){if(_0x355db1){return _0x428f63(getChanSpyApplications(_0xa2a54c,_0x355db1));}return _0x428f63([]);})[_0x0bf3('0x1d')](function(_0x42d1ad){_0x13038e(_0x42d1ad);});});};module[_0x0bf3('0x1e')]=function(_0x3af54c,_0xf163d0){var _0x20447d=_0x3af54c[_0x0bf3('0x1f')];return _0x3af54c[_0x0bf3('0x20')](_0x0bf3('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f5497,_0x45734f,_0x5db201){return getChanSpyPromise(_0x20447d,_0x2f5497)['then'](function(_0x7a7024){if(_0x7a7024&&_0x7a7024[_0x0bf3('0x22')]){return _0x20447d['VoiceExtension'][_0x0bf3('0x23')](_0x7a7024);}})[_0x0bf3('0x1c')](function(){_0x5db201();})[_0x0bf3('0x1d')](function(_0x4c8e70){_0x5db201(_0x4c8e70);});},'afterUpdate':function(_0x2115c8,_0x2dbc74,_0x6d664e){return _0x20447d['VoiceExtension'][_0x0bf3('0x24')]({'where':{'ChanSpyId':_0x2115c8['id']}})[_0x0bf3('0x1c')](function(){return getChanSpyPromise(_0x20447d,_0x2115c8);})[_0x0bf3('0x1c')](function(_0xc00611){if(_0xc00611&&_0xc00611['length']){return _0x20447d[_0x0bf3('0x25')][_0x0bf3('0x23')](_0xc00611);}})[_0x0bf3('0x1c')](function(){_0x6d664e();})[_0x0bf3('0x1d')](function(_0x5a50b0){_0x6d664e(_0x5a50b0);});},'afterDestroy':function(_0xe7474b,_0x11588d,_0x5b1ef8){return _0x20447d['VoiceExtension'][_0x0bf3('0x24')]({'where':{'ChanSpyId':_0xe7474b['id']}})['then'](function(){_0x5b1ef8();})['catch'](function(_0x42b986){_0x5b1ef8(_0x42b986);});}}});}; \ No newline at end of file +var _0xdf99=['StopMixMonitor','length','internal','concat','User','exports','models','define','VoiceChanSpy','then','VoiceExtension','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record'];(function(_0x38ccf2,_0x1bdfec){var _0x3425eb=function(_0xd86255){while(--_0xd86255){_0x38ccf2['push'](_0x38ccf2['shift']());}};_0x3425eb(++_0x1bdfec);}(_0xdf99,0x161));var _0x9df9=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0xdf99[_0x19f9e6];return _0x45c862;};'use strict';var _=require(_0x9df9('0x0'));var util=require(_0x9df9('0x1'));var BPromise=require(_0x9df9('0x2'));var attributes=require(_0x9df9('0x3'));var getUserApplications=function(_0x292fcd,_0x790a2a,_0x5bbfc5){var _0x28482b=0x1;var _0x2932cd=[];var _0x4176ba={'context':_0x790a2a[_0x9df9('0x4')]||_0x9df9('0x5'),'exten':util[_0x9df9('0x6')](_0x9df9('0x7'),_0x292fcd[_0x9df9('0x8')],_0x5bbfc5),'type':'system','isApp':![],'ChanSpyId':_0x292fcd['id'],'UserId':_0x790a2a['id']};_0x2932cd['push'](_['merge']({'app':'Set','appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x28482b++},_0x4176ba));if(_0x292fcd['record']){_0x2932cd[_0x9df9('0x9')](_[_0x9df9('0xa')]({'app':_0x9df9('0xb'),'appdata':util[_0x9df9('0x6')](_0x9df9('0xc'),_0x292fcd['recordingFormat']),'priority':_0x28482b++},_0x4176ba));}if(_0x292fcd['auth']){_0x2932cd[_0x9df9('0x9')](_[_0x9df9('0xa')]({'app':_0x9df9('0xd'),'appdata':_0x292fcd[_0x9df9('0xe')],'priority':_0x28482b++},_0x4176ba));}_0x2932cd[_0x9df9('0x9')](_[_0x9df9('0xa')]({'app':_0x9df9('0xf'),'appdata':util[_0x9df9('0x6')](_0x9df9('0x10'),_0x790a2a[_0x9df9('0x11')],_0x292fcd['options']?_0x292fcd[_0x9df9('0x12')][_0x9df9('0x13')](''):''),'priority':_0x28482b++},_0x4176ba));if(_0x292fcd[_0x9df9('0x14')]){_0x2932cd[_0x9df9('0x9')](_['merge']({'app':_0x9df9('0x15'),'priority':_0x28482b++},_0x4176ba));}return _0x2932cd;};var getChanSpyApplications=function(_0x52ae31,_0x3bad70){var _0x53482c=[];for(var _0x3dd703=0x0,_0x33a1c3=0x1;_0x3dd703<_0x3bad70[_0x9df9('0x16')];_0x3dd703++,_0x33a1c3=0x1){_0x53482c=_0x53482c['concat'](getUserApplications(_0x52ae31,_0x3bad70[_0x3dd703],_0x3bad70[_0x3dd703][_0x9df9('0x17')]));if(_0x3bad70[_0x3dd703][_0x9df9('0x17')]!=_0x3bad70[_0x3dd703][_0x9df9('0x11')]){_0x53482c=_0x53482c[_0x9df9('0x18')](getUserApplications(_0x52ae31,_0x3bad70[_0x3dd703],_0x3bad70[_0x3dd703][_0x9df9('0x11')]));}}return _0x53482c;};var getChanSpyPromise=function(_0x362072,_0x3c41d7){return new BPromise(function(_0x3a1280,_0x384f6b){return _0x362072[_0x9df9('0x19')]['findAll']({'attributes':['id',_0x9df9('0x11'),_0x9df9('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x5eddb8){if(_0x5eddb8){return _0x3a1280(getChanSpyApplications(_0x3c41d7,_0x5eddb8));}return _0x3a1280([]);})['catch'](function(_0x497aa2){_0x384f6b(_0x497aa2);});});};module[_0x9df9('0x1a')]=function(_0x28a4c9,_0x164f7f){var _0x1fd245=_0x28a4c9[_0x9df9('0x1b')];return _0x28a4c9[_0x9df9('0x1c')](_0x9df9('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30e542,_0x176219,_0xda8643){return getChanSpyPromise(_0x1fd245,_0x30e542)[_0x9df9('0x1e')](function(_0x2f9ec8){if(_0x2f9ec8&&_0x2f9ec8[_0x9df9('0x16')]){return _0x1fd245[_0x9df9('0x1f')]['bulkCreate'](_0x2f9ec8);}})['then'](function(){_0xda8643();})['catch'](function(_0x51fa25){_0xda8643(_0x51fa25);});},'afterUpdate':function(_0x2fdd61,_0x2ec999,_0x2f1fd8){return _0x1fd245['VoiceExtension'][_0x9df9('0x20')]({'where':{'ChanSpyId':_0x2fdd61['id']}})[_0x9df9('0x1e')](function(){return getChanSpyPromise(_0x1fd245,_0x2fdd61);})[_0x9df9('0x1e')](function(_0x1a2b9b){if(_0x1a2b9b&&_0x1a2b9b[_0x9df9('0x16')]){return _0x1fd245[_0x9df9('0x1f')]['bulkCreate'](_0x1a2b9b);}})[_0x9df9('0x1e')](function(){_0x2f1fd8();})[_0x9df9('0x21')](function(_0x304359){_0x2f1fd8(_0x304359);});},'afterDestroy':function(_0x54e741,_0x53218b,_0x1e41e4){return _0x1fd245['VoiceExtension'][_0x9df9('0x20')]({'where':{'ChanSpyId':_0x54e741['id']}})['then'](function(){_0x1e41e4();})[_0x9df9('0x21')](function(_0x46e244){_0x1e41e4(_0x46e244);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ac7ea12..c057587 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 _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x47052b,_0x1853fa){var _0x829812=function(_0x65ac50){while(--_0x65ac50){_0x47052b['push'](_0x47052b['shift']());}};_0x829812(++_0x1853fa);}(_0x4483,0x1a3));var _0x3448=function(_0xb206e4,_0x54e76c){_0xb206e4=_0xb206e4-0x0;var _0x51ab28=_0x4483[_0xb206e4];return _0x51ab28;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file +var _0x574d=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x29f562,_0x50a039){var _0x281052=function(_0x58f622){while(--_0x58f622){_0x29f562['push'](_0x29f562['shift']());}};_0x281052(++_0x50a039);}(_0x574d,0xc0));var _0xd574=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x574d[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var moment=require(_0xd574('0x2'));var BPromise=require(_0xd574('0x3'));var rs=require(_0xd574('0x4'));var fs=require('fs');var Redis=require(_0xd574('0x5'));var db=require(_0xd574('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd574('0x7'))(_0xd574('0x8'));var config=require(_0xd574('0x9'));var jayson=require(_0xd574('0xa'));var client=jayson['client'][_0xd574('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a566,_0x3ce54f,_0x1558b3){return new BPromise(function(_0x3a1e54,_0x20751c){return client['request'](_0x13a566,_0x1558b3)['then'](function(_0x4306f7){logger[_0xd574('0xc')](_0xd574('0xd'),_0x3ce54f,_0xd574('0xe'));logger[_0xd574('0xf')](_0xd574('0x10'),_0x3ce54f,_0xd574('0xe'),JSON['stringify'](_0x4306f7));if(_0x4306f7[_0xd574('0x11')]){if(_0x4306f7[_0xd574('0x11')][_0xd574('0x12')]===0x1f4){logger[_0xd574('0x11')](_0xd574('0xd'),_0x3ce54f,_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);return _0x20751c(_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);}logger[_0xd574('0x11')](_0xd574('0xd'),_0x3ce54f,_0x4306f7[_0xd574('0x11')]['message']);return _0x3a1e54(_0x4306f7[_0xd574('0x11')][_0xd574('0x13')]);}else{logger[_0xd574('0xc')](_0xd574('0xd'),_0x3ce54f,_0xd574('0xe'));_0x3a1e54(_0x4306f7[_0xd574('0x14')][_0xd574('0x13')]);}})[_0xd574('0x15')](function(_0x5c1db1){logger['error'](_0xd574('0xd'),_0x3ce54f,_0x5c1db1);_0x20751c(_0x5c1db1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 603184d..7e3bfc0 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 _0x9114=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1fb4ff,_0x172d25){var _0x3f2d20=function(_0x358d44){while(--_0x358d44){_0x1fb4ff['push'](_0x1fb4ff['shift']());}};_0x3f2d20(++_0x172d25);}(_0x9114,0x14e));var _0x4911=function(_0x39dd96,_0x59cbe9){_0x39dd96=_0x39dd96-0x0;var _0x999bde=_0x9114[_0x39dd96];return _0x999bde;};'use strict';var multer=require(_0x4911('0x0'));var util=require(_0x4911('0x1'));var path=require(_0x4911('0x2'));var timeout=require(_0x4911('0x3'));var express=require(_0x4911('0x4'));var router=express[_0x4911('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4911('0x6'));var interaction=require(_0x4911('0x7'));var config=require(_0x4911('0x8'));var controller=require(_0x4911('0x9'));router[_0x4911('0xa')]('/',auth[_0x4911('0xb')](),controller[_0x4911('0xc')]);router[_0x4911('0xa')]('/:id',auth[_0x4911('0xb')](),controller[_0x4911('0xd')]);router[_0x4911('0xe')]('/',auth[_0x4911('0xb')](),controller[_0x4911('0xf')]);router[_0x4911('0x10')](_0x4911('0x11'),auth[_0x4911('0xb')](),controller[_0x4911('0x12')]);router['delete'](_0x4911('0x11'),auth[_0x4911('0xb')](),controller[_0x4911('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7438=['create','put','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x39471e,_0x4a195d){var _0x51693a=function(_0x2dc0b9){while(--_0x2dc0b9){_0x39471e['push'](_0x39471e['shift']());}};_0x51693a(++_0x4a195d);}(_0x7438,0x1b4));var _0x8743=function(_0x467cba,_0x140db7){_0x467cba=_0x467cba-0x0;var _0x3b630e=_0x7438[_0x467cba];return _0x3b630e;};'use strict';var multer=require(_0x8743('0x0'));var util=require(_0x8743('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8743('0x2'));var router=express[_0x8743('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8743('0x4'));var interaction=require(_0x8743('0x5'));var config=require(_0x8743('0x6'));var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8743('0x7')](_0x8743('0x8'),auth[_0x8743('0x9')](),controller[_0x8743('0xa')]);router[_0x8743('0xb')]('/',auth[_0x8743('0x9')](),controller[_0x8743('0xc')]);router[_0x8743('0xd')](_0x8743('0x8'),auth['isAuthenticated'](),controller[_0x8743('0xe')]);router['delete'](_0x8743('0x8'),auth[_0x8743('0x9')](),controller['destroy']);module[_0x8743('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a18226a..366e70e 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 _0xf92d=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x1ebe9e,_0x58b245){var _0x2386d8=function(_0x38d4ac){while(--_0x38d4ac){_0x1ebe9e['push'](_0x1ebe9e['shift']());}};_0x2386d8(++_0x58b245);}(_0xf92d,0xdb));var _0xdf92=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xf92d[_0x2b5513];return _0x578fd2;};'use strict';var Sequelize=require(_0xdf92('0x0'));module[_0xdf92('0x1')]={'name':{'type':Sequelize[_0xdf92('0x2')],'unique':_0xdf92('0x3')},'description':{'type':Sequelize[_0xdf92('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdf92('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0fc0=['STRING','name','BOOLEAN','sequelize'];(function(_0x42b17c,_0x30451e){var _0x9ecc60=function(_0x3d82e8){while(--_0x3d82e8){_0x42b17c['push'](_0x42b17c['shift']());}};_0x9ecc60(++_0x30451e);}(_0x0fc0,0x13b));var _0x00fc=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x0fc0[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x00fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x00fc('0x1')],'unique':_0x00fc('0x2')},'description':{'type':Sequelize[_0x00fc('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x00fc('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 b0bf1d2..bd6eeea 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 _0xc485=['fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','get','Contexts','UserProfileResource','destroy','name','send','index','VoiceContext','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','options','includeAll','include','findAll','rawAttributes','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','params','eml-format','zip-dir','fast-json-patch','moment','sox','to-csv','ejs'];(function(_0x2d5ea1,_0x15b690){var _0x143a4f=function(_0x2eaa36){while(--_0x2eaa36){_0x2d5ea1['push'](_0x2d5ea1['shift']());}};_0x143a4f(++_0x15b690);}(_0xc485,0x16d));var _0x5c48=function(_0x2865c9,_0x575948){_0x2865c9=_0x2865c9-0x0;var _0x585985=_0xc485[_0x2865c9];return _0x585985;};'use strict';var emlformat=require(_0x5c48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c48('0x1'));var jsonpatch=require(_0x5c48('0x2'));var rp=require('request-promise');var moment=require(_0x5c48('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5c48('0x4'));var csv=require(_0x5c48('0x5'));var ejs=require(_0x5c48('0x6'));var fs=require('fs');var fs_extra=require(_0x5c48('0x7'));var _=require('lodash');var squel=require(_0x5c48('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c48('0x9'));var toCsv=require('to-csv');var querystring=require(_0x5c48('0xa'));var Papa=require(_0x5c48('0xb'));var Redis=require('ioredis');var authService=require(_0x5c48('0xc'));var qs=require(_0x5c48('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c48('0xe'));var logger=require(_0x5c48('0xf'))(_0x5c48('0x10'));var utils=require(_0x5c48('0x11'));var config=require(_0x5c48('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c48('0x13'))['db'];var jayson=require(_0x5c48('0x14'));var client=jayson[_0x5c48('0x15')][_0x5c48('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2d45e6,_0xaca92a,_0x1a7c56,_0x2795a9){return new BPromise(function(_0x4e5996,_0x50f312){var _0x5961e4=_0x2795a9||client;return _0x5961e4['request'](_0x2d45e6,_0x1a7c56)[_0x5c48('0x17')](function(_0x36837b){logger[_0x5c48('0x18')](_0x5c48('0x19'),_0xaca92a,_0x5c48('0x1a'));logger[_0x5c48('0x1b')](_0x5c48('0x1c'),_0xaca92a,'request\x20sent',JSON[_0x5c48('0x1d')](_0x36837b));if(_0x36837b[_0x5c48('0x1e')]){if(_0x36837b[_0x5c48('0x1e')]['code']===0x1f4){logger[_0x5c48('0x1e')](_0x5c48('0x19'),_0xaca92a,_0x36837b[_0x5c48('0x1e')][_0x5c48('0x1f')]);return _0x50f312(_0x36837b[_0x5c48('0x1e')][_0x5c48('0x1f')]);}logger[_0x5c48('0x1e')](_0x5c48('0x19'),_0xaca92a,_0x36837b['error']['message']);return _0x4e5996(_0x36837b['error'][_0x5c48('0x1f')]);}else{logger[_0x5c48('0x18')](_0x5c48('0x19'),_0xaca92a,'request\x20sent');_0x4e5996(_0x36837b[_0x5c48('0x20')][_0x5c48('0x1f')]);}})[_0x5c48('0x21')](function(_0x3f6be9){logger[_0x5c48('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xaca92a,_0x3f6be9);_0x50f312(_0x3f6be9);});});}function respondWithStatusCode(_0x25d97a,_0x14bf61){_0x14bf61=_0x14bf61||0xcc;return function(_0x58008b){if(_0x58008b){return _0x25d97a['sendStatus'](_0x14bf61);}return _0x25d97a[_0x5c48('0x22')](_0x14bf61)[_0x5c48('0x23')]();};}function respondWithResult(_0xf38283,_0x436a6f){_0x436a6f=_0x436a6f||0xc8;return function(_0x3a27ed){if(_0x3a27ed){return _0xf38283['status'](_0x436a6f)[_0x5c48('0x24')](_0x3a27ed);}};}function respondWithFilteredResult(_0x2ffbb3,_0x429ff3){return function(_0x8210d2){if(_0x8210d2){var _0x3d1c62=typeof _0x429ff3[_0x5c48('0x25')]==='undefined'&&typeof _0x429ff3[_0x5c48('0x26')]===_0x5c48('0x27');var _0x1591a7=_0x8210d2[_0x5c48('0x28')];var _0x21dbdd=_0x3d1c62?0x0:_0x429ff3[_0x5c48('0x25')];var _0x1c47c7=_0x3d1c62?_0x8210d2['count']:_0x429ff3[_0x5c48('0x25')]+_0x429ff3['limit'];var _0xe73e33;if(_0x1c47c7>=_0x1591a7){_0x1c47c7=_0x1591a7;_0xe73e33=0xc8;}else{_0xe73e33=0xce;}_0x2ffbb3[_0x5c48('0x22')](_0xe73e33);return _0x2ffbb3[_0x5c48('0x29')](_0x5c48('0x2a'),_0x21dbdd+'-'+_0x1c47c7+'/'+_0x1591a7)[_0x5c48('0x24')](_0x8210d2);}return null;};}function patchUpdates(_0x17548d){return function(_0x10832f){try{jsonpatch[_0x5c48('0x2b')](_0x10832f,_0x17548d,!![]);}catch(_0x36f27b){return BPromise[_0x5c48('0x2c')](_0x36f27b);}return _0x10832f[_0x5c48('0x2d')]();};}function saveUpdates(_0x9fec3c,_0x565b2a){return function(_0x28badf){if(_0x28badf){return _0x28badf['update'](_0x9fec3c)[_0x5c48('0x17')](function(_0x5277f2){return _0x5277f2;});}return null;};}function removeEntity(_0x235480,_0x52b95e){return function(_0x59003b){if(_0x59003b){return _0x59003b['destroy']()['then'](function(){var _0x5ca3a3=_0x59003b[_0x5c48('0x2e')]({'plain':!![]});var _0x211fca=_0x5c48('0x2f');return db[_0x5c48('0x30')][_0x5c48('0x31')]({'where':{'type':_0x211fca,'resourceId':_0x5ca3a3['id']}})[_0x5c48('0x17')](function(){return _0x59003b;});})[_0x5c48('0x17')](function(){_0x235480[_0x5c48('0x22')](0xcc)[_0x5c48('0x23')]();});}};}function handleEntityNotFound(_0x10950c,_0x211e36){return function(_0x290b1f){if(!_0x290b1f){_0x10950c['sendStatus'](0x194);}return _0x290b1f;};}function handleError(_0x440065,_0x1610a0){_0x1610a0=_0x1610a0||0x1f4;return function(_0x178b28){logger['error'](_0x178b28['stack']);if(_0x178b28['name']){delete _0x178b28[_0x5c48('0x32')];}_0x440065[_0x5c48('0x22')](_0x1610a0)[_0x5c48('0x33')](_0x178b28);};}exports[_0x5c48('0x34')]=function(_0xd7c88e,_0xe50fa5){var _0x541fad={},_0x526020={},_0xc5ef9d={'count':0x0,'rows':[]};var _0xab0c06=_['map'](db[_0x5c48('0x35')]['rawAttributes'],function(_0x47daca){return{'name':_0x47daca['fieldName'],'type':_0x47daca['type']['key']};});_0x526020[_0x5c48('0x36')]=_[_0x5c48('0x37')](_0xab0c06,'name');_0x526020[_0x5c48('0x38')]=_[_0x5c48('0x39')](_0xd7c88e[_0x5c48('0x38')]);_0x526020['filters']=_[_0x5c48('0x3a')](_0x526020[_0x5c48('0x36')],_0x526020[_0x5c48('0x38')]);_0x541fad[_0x5c48('0x3b')]=_['intersection'](_0x526020[_0x5c48('0x36')],qs[_0x5c48('0x3c')](_0xd7c88e[_0x5c48('0x38')][_0x5c48('0x3c')]));_0x541fad['attributes']=_0x541fad[_0x5c48('0x3b')][_0x5c48('0x3d')]?_0x541fad[_0x5c48('0x3b')]:_0x526020['model'];if(!_0xd7c88e[_0x5c48('0x38')][_0x5c48('0x3e')](_0x5c48('0x3f'))){_0x541fad[_0x5c48('0x26')]=qs[_0x5c48('0x26')](_0xd7c88e['query'][_0x5c48('0x26')]);_0x541fad[_0x5c48('0x25')]=qs[_0x5c48('0x25')](_0xd7c88e['query']['offset']);}_0x541fad[_0x5c48('0x40')]=qs['sort'](_0xd7c88e['query']['sort']);_0x541fad[_0x5c48('0x41')]=qs[_0x5c48('0x42')](_['pick'](_0xd7c88e['query'],_0x526020['filters']),_0xab0c06);if(_0xd7c88e[_0x5c48('0x38')][_0x5c48('0x43')]){_0x541fad['where']=_[_0x5c48('0x44')](_0x541fad[_0x5c48('0x41')],{'$or':_[_0x5c48('0x37')](_0xab0c06,function(_0x161914){if(_0x161914['type']!=='VIRTUAL'){var _0x1b5d49={};_0x1b5d49[_0x161914[_0x5c48('0x32')]]={'$like':'%'+_0xd7c88e['query'][_0x5c48('0x43')]+'%'};return _0x1b5d49;}})});}_0x541fad=_[_0x5c48('0x44')]({},_0x541fad,_0xd7c88e[_0x5c48('0x45')]);var _0x2a6059={'where':_0x541fad['where']};return db[_0x5c48('0x35')][_0x5c48('0x28')](_0x2a6059)[_0x5c48('0x17')](function(_0x59ef32){_0xc5ef9d[_0x5c48('0x28')]=_0x59ef32;if(_0xd7c88e['query'][_0x5c48('0x46')]){_0x541fad[_0x5c48('0x47')]=[{'all':!![]}];}return db['VoiceContext'][_0x5c48('0x48')](_0x541fad);})[_0x5c48('0x17')](function(_0x34b1aa){_0xc5ef9d['rows']=_0x34b1aa;return _0xc5ef9d;})[_0x5c48('0x17')](respondWithFilteredResult(_0xe50fa5,_0x541fad))[_0x5c48('0x21')](handleError(_0xe50fa5,null));};exports['show']=function(_0x46da36,_0x49749a){var _0x18fc54={'raw':![],'where':{'id':_0x46da36['params']['id']}},_0x368c26={};_0x368c26[_0x5c48('0x36')]=_['keys'](db['VoiceContext'][_0x5c48('0x49')]);_0x368c26[_0x5c48('0x38')]=_[_0x5c48('0x39')](_0x46da36[_0x5c48('0x38')]);_0x368c26[_0x5c48('0x42')]=_[_0x5c48('0x3a')](_0x368c26[_0x5c48('0x36')],_0x368c26[_0x5c48('0x38')]);_0x18fc54['attributes']=_['intersection'](_0x368c26[_0x5c48('0x36')],qs[_0x5c48('0x3c')](_0x46da36[_0x5c48('0x38')][_0x5c48('0x3c')]));_0x18fc54['attributes']=_0x18fc54['attributes'][_0x5c48('0x3d')]?_0x18fc54['attributes']:_0x368c26[_0x5c48('0x36')];if(_0x46da36[_0x5c48('0x38')][_0x5c48('0x46')]){_0x18fc54[_0x5c48('0x47')]=[{'all':!![]}];}_0x18fc54=_[_0x5c48('0x44')]({},_0x18fc54,_0x46da36[_0x5c48('0x45')]);return db['VoiceContext'][_0x5c48('0x4a')](_0x18fc54)[_0x5c48('0x17')](handleEntityNotFound(_0x49749a,null))[_0x5c48('0x17')](respondWithResult(_0x49749a,null))['catch'](handleError(_0x49749a,null));};exports[_0x5c48('0x4b')]=function(_0x55ca00,_0x26f15d,_0x28182f){var _0xc5452b;return db['VoiceContext'][_0x5c48('0x4b')](_0x55ca00[_0x5c48('0x4c')],{'raw':!![]})[_0x5c48('0x17')](function(_0x116d4b){_0xc5452b=_0x116d4b;return db[_0x5c48('0x35')][_0x5c48('0x48')]({'raw':!![]});})['then'](function(_0x5d780b){var _0x4edf6c=fs[_0x5c48('0x4d')](path['join'](config[_0x5c48('0x4e')],_0x5c48('0x4f')),_0x5c48('0x50'));var _0x370c8a=ejs[_0x5c48('0x51')](_0x4edf6c,{'contexts':_0x5d780b||[]});fs[_0x5c48('0x52')](_0x5c48('0x53'),_0x370c8a);})[_0x5c48('0x17')](function(){return respondWithRpcPromise(_0x5c48('0x54'),_0x5c48('0x4b'),{'module':_0x5c48('0x55')});})[_0x5c48('0x17')](function(){var _0x17b4f1=_0x55ca00[_0x5c48('0x56')]['get']({'plain':!![]});if(!_0x17b4f1)throw new Error(_0x5c48('0x57'));if(_0x17b4f1[_0x5c48('0x58')]==='user'){var _0x55231b=_0xc5452b[_0x5c48('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x5c48('0x4a')]({'where':{'name':_0x5c48('0x2f'),'userProfileId':_0x17b4f1[_0x5c48('0x59')]},'raw':!![]})['then'](function(_0x5f1663){if(_0x5f1663&&_0x5f1663[_0x5c48('0x5a')]===0x0){return db[_0x5c48('0x30')][_0x5c48('0x4b')]({'name':_0x55231b[_0x5c48('0x32')],'resourceId':_0x55231b['id'],'type':_0x5f1663['name'],'sectionId':_0x5f1663['id']},{})[_0x5c48('0x17')](function(){return _0xc5452b;});}else{return _0xc5452b;}})[_0x5c48('0x21')](function(_0x2121d5){logger[_0x5c48('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2121d5);throw _0x2121d5;});}return _0xc5452b;})[_0x5c48('0x17')](respondWithResult(_0x26f15d,0xc9))[_0x5c48('0x21')](handleError(_0x26f15d,null));};exports[_0x5c48('0x5b')]=function(_0x620a51,_0xcbdfcf,_0x1f8271){var _0x4d3fbc;return db[_0x5c48('0x35')]['find']({'where':{'id':_0x620a51[_0x5c48('0x5c')]['id']}})['then'](handleEntityNotFound(_0xcbdfcf,null))[_0x5c48('0x17')](saveUpdates(_0x620a51[_0x5c48('0x4c')],null))[_0x5c48('0x17')](function(_0x4dad3e){if(_0x4dad3e){_0x4d3fbc=_0x4dad3e;return db[_0x5c48('0x35')]['findAll']({'raw':!![]});}})[_0x5c48('0x17')](function(_0x180de6){var _0x2d5035=fs[_0x5c48('0x4d')](path['join'](config[_0x5c48('0x4e')],_0x5c48('0x4f')),_0x5c48('0x50'));var _0x48ee9c=ejs[_0x5c48('0x51')](_0x2d5035,{'contexts':_0x180de6||[]});fs[_0x5c48('0x52')](_0x5c48('0x53'),_0x48ee9c);})[_0x5c48('0x17')](function(){return respondWithRpcPromise(_0x5c48('0x54'),_0x5c48('0x5b'),{'module':'chan_sip.so'});})['then'](function(){return _0x4d3fbc;})[_0x5c48('0x17')](respondWithResult(_0xcbdfcf,null))['catch'](handleError(_0xcbdfcf,null));};exports[_0x5c48('0x31')]=function(_0x3a9fd6,_0xc4128d,_0x21fd19){var _0x1a2cb6;return db[_0x5c48('0x35')][_0x5c48('0x4a')]({'where':{'id':_0x3a9fd6['params']['id']}})[_0x5c48('0x17')](handleEntityNotFound(_0xc4128d,null))[_0x5c48('0x17')](removeEntity(_0xc4128d,null))[_0x5c48('0x17')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x5c48('0x17')](function(_0x30c5c9){var _0x9c122f=fs[_0x5c48('0x4d')](path['join'](config[_0x5c48('0x4e')],_0x5c48('0x4f')),_0x5c48('0x50'));var _0x8b3a0c=ejs[_0x5c48('0x51')](_0x9c122f,{'contexts':_0x30c5c9});fs['writeFileSync'](_0x5c48('0x53'),_0x8b3a0c);return respondWithRpcPromise(_0x5c48('0x54'),_0x5c48('0x31'),{'module':'chan_sip.so'});})[_0x5c48('0x21')](handleError(_0xc4128d,null));}; \ No newline at end of file +var _0x53a9=['root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','get','user','UserProfileSection','userProfileId','autoAssociation','body','destroy','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','readFileSync'];(function(_0x1a0a7b,_0x39dc10){var _0x32e078=function(_0x819f2b){while(--_0x819f2b){_0x1a0a7b['push'](_0x1a0a7b['shift']());}};_0x32e078(++_0x39dc10);}(_0x53a9,0x141));var _0x953a=function(_0x717919,_0x3b1695){_0x717919=_0x717919-0x0;var _0x4df2e5=_0x53a9[_0x717919];return _0x4df2e5;};'use strict';var emlformat=require(_0x953a('0x0'));var rimraf=require(_0x953a('0x1'));var zipdir=require(_0x953a('0x2'));var jsonpatch=require(_0x953a('0x3'));var rp=require('request-promise');var moment=require(_0x953a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x953a('0x5'));var util=require('util');var path=require(_0x953a('0x6'));var sox=require('sox');var csv=require(_0x953a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x953a('0x8'));var squel=require('squel');var crypto=require(_0x953a('0x9'));var jsforce=require(_0x953a('0xa'));var deskjs=require(_0x953a('0xb'));var toCsv=require(_0x953a('0x7'));var querystring=require(_0x953a('0xc'));var Papa=require(_0x953a('0xd'));var Redis=require('ioredis');var authService=require(_0x953a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x953a('0xf'));var hardwareService=require(_0x953a('0x10'));var logger=require(_0x953a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x953a('0x12'));var licenseUtil=require(_0x953a('0x13'));var db=require(_0x953a('0x14'))['db'];var jayson=require(_0x953a('0x15'));var client=jayson[_0x953a('0x16')][_0x953a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x36681b,_0x54185c,_0x2d045f,_0x2b2248){return new BPromise(function(_0x354a5e,_0x32dece){var _0x313d09=_0x2b2248||client;return _0x313d09[_0x953a('0x18')](_0x36681b,_0x2d045f)['then'](function(_0x422153){logger[_0x953a('0x19')](_0x953a('0x1a'),_0x54185c,_0x953a('0x1b'));logger[_0x953a('0x1c')](_0x953a('0x1d'),_0x54185c,_0x953a('0x1b'),JSON[_0x953a('0x1e')](_0x422153));if(_0x422153['error']){if(_0x422153[_0x953a('0x1f')][_0x953a('0x20')]===0x1f4){logger[_0x953a('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x54185c,_0x422153[_0x953a('0x1f')][_0x953a('0x21')]);return _0x32dece(_0x422153[_0x953a('0x1f')][_0x953a('0x21')]);}logger[_0x953a('0x1f')](_0x953a('0x1a'),_0x54185c,_0x422153[_0x953a('0x1f')]['message']);return _0x354a5e(_0x422153[_0x953a('0x1f')][_0x953a('0x21')]);}else{logger[_0x953a('0x19')]('VoiceContext,\x20%s,\x20%s',_0x54185c,_0x953a('0x1b'));_0x354a5e(_0x422153[_0x953a('0x22')][_0x953a('0x21')]);}})[_0x953a('0x23')](function(_0x4995e7){logger[_0x953a('0x1f')](_0x953a('0x1a'),_0x54185c,_0x4995e7);_0x32dece(_0x4995e7);});});}function respondWithStatusCode(_0x4082b8,_0x1d8e6d){_0x1d8e6d=_0x1d8e6d||0xcc;return function(_0x51dfa4){if(_0x51dfa4){return _0x4082b8[_0x953a('0x24')](_0x1d8e6d);}return _0x4082b8[_0x953a('0x25')](_0x1d8e6d)[_0x953a('0x26')]();};}function respondWithResult(_0x4f96c8,_0x4be556){_0x4be556=_0x4be556||0xc8;return function(_0xef6574){if(_0xef6574){return _0x4f96c8[_0x953a('0x25')](_0x4be556)[_0x953a('0x27')](_0xef6574);}};}function respondWithFilteredResult(_0x146bb6,_0x4ec9f2){return function(_0x368019){if(_0x368019){var _0x1332ae=typeof _0x4ec9f2[_0x953a('0x28')]===_0x953a('0x29')&&typeof _0x4ec9f2['limit']===_0x953a('0x29');var _0x556b12=_0x368019[_0x953a('0x2a')];var _0x37bee6=_0x1332ae?0x0:_0x4ec9f2[_0x953a('0x28')];var _0x3669a1=_0x1332ae?_0x368019[_0x953a('0x2a')]:_0x4ec9f2[_0x953a('0x28')]+_0x4ec9f2['limit'];var _0x62b7b9;if(_0x3669a1>=_0x556b12){_0x3669a1=_0x556b12;_0x62b7b9=0xc8;}else{_0x62b7b9=0xce;}_0x146bb6['status'](_0x62b7b9);return _0x146bb6[_0x953a('0x2b')]('Content-Range',_0x37bee6+'-'+_0x3669a1+'/'+_0x556b12)[_0x953a('0x27')](_0x368019);}return null;};}function patchUpdates(_0x36da7e){return function(_0x36ef83){try{jsonpatch['apply'](_0x36ef83,_0x36da7e,!![]);}catch(_0x4ae1dc){return BPromise[_0x953a('0x2c')](_0x4ae1dc);}return _0x36ef83[_0x953a('0x2d')]();};}function saveUpdates(_0x2ee0c4,_0x47e4bd){return function(_0x53557e){if(_0x53557e){return _0x53557e[_0x953a('0x2e')](_0x2ee0c4)[_0x953a('0x2f')](function(_0x107ef4){return _0x107ef4;});}return null;};}function removeEntity(_0x295ad0,_0x5a0336){return function(_0x370d4c){if(_0x370d4c){return _0x370d4c['destroy']()[_0x953a('0x2f')](function(){var _0x322d17=_0x370d4c['get']({'plain':!![]});var _0x1b876e=_0x953a('0x30');return db[_0x953a('0x31')]['destroy']({'where':{'type':_0x1b876e,'resourceId':_0x322d17['id']}})['then'](function(){return _0x370d4c;});})[_0x953a('0x2f')](function(){_0x295ad0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x816d29,_0x90aa95){return function(_0x42a438){if(!_0x42a438){_0x816d29[_0x953a('0x24')](0x194);}return _0x42a438;};}function handleError(_0x1054df,_0x3650ec){_0x3650ec=_0x3650ec||0x1f4;return function(_0x5acf34){logger[_0x953a('0x1f')](_0x5acf34[_0x953a('0x32')]);if(_0x5acf34[_0x953a('0x33')]){delete _0x5acf34['name'];}_0x1054df['status'](_0x3650ec)[_0x953a('0x34')](_0x5acf34);};}exports[_0x953a('0x35')]=function(_0x4043ff,_0x1eba0d){var _0x19d3fb={},_0x4bac22={},_0x5e06b7={'count':0x0,'rows':[]};var _0xd07a65=_[_0x953a('0x36')](db[_0x953a('0x37')][_0x953a('0x38')],function(_0x4d9f32){return{'name':_0x4d9f32[_0x953a('0x39')],'type':_0x4d9f32[_0x953a('0x3a')][_0x953a('0x3b')]};});_0x4bac22[_0x953a('0x3c')]=_[_0x953a('0x36')](_0xd07a65,_0x953a('0x33'));_0x4bac22[_0x953a('0x3d')]=_[_0x953a('0x3e')](_0x4043ff[_0x953a('0x3d')]);_0x4bac22[_0x953a('0x3f')]=_['intersection'](_0x4bac22[_0x953a('0x3c')],_0x4bac22[_0x953a('0x3d')]);_0x19d3fb[_0x953a('0x40')]=_[_0x953a('0x41')](_0x4bac22[_0x953a('0x3c')],qs[_0x953a('0x42')](_0x4043ff[_0x953a('0x3d')]['fields']));_0x19d3fb[_0x953a('0x40')]=_0x19d3fb[_0x953a('0x40')][_0x953a('0x43')]?_0x19d3fb[_0x953a('0x40')]:_0x4bac22['model'];if(!_0x4043ff[_0x953a('0x3d')][_0x953a('0x44')](_0x953a('0x45'))){_0x19d3fb['limit']=qs[_0x953a('0x46')](_0x4043ff[_0x953a('0x3d')][_0x953a('0x46')]);_0x19d3fb[_0x953a('0x28')]=qs[_0x953a('0x28')](_0x4043ff[_0x953a('0x3d')][_0x953a('0x28')]);}_0x19d3fb[_0x953a('0x47')]=qs['sort'](_0x4043ff['query'][_0x953a('0x48')]);_0x19d3fb[_0x953a('0x49')]=qs['filters'](_[_0x953a('0x4a')](_0x4043ff[_0x953a('0x3d')],_0x4bac22[_0x953a('0x3f')]),_0xd07a65);if(_0x4043ff[_0x953a('0x3d')][_0x953a('0x4b')]){_0x19d3fb[_0x953a('0x49')]=_[_0x953a('0x4c')](_0x19d3fb['where'],{'$or':_[_0x953a('0x36')](_0xd07a65,function(_0x5eecd2){if(_0x5eecd2[_0x953a('0x3a')]!==_0x953a('0x4d')){var _0x46e33e={};_0x46e33e[_0x5eecd2[_0x953a('0x33')]]={'$like':'%'+_0x4043ff[_0x953a('0x3d')][_0x953a('0x4b')]+'%'};return _0x46e33e;}})});}_0x19d3fb=_[_0x953a('0x4c')]({},_0x19d3fb,_0x4043ff['options']);var _0x5d0786={'where':_0x19d3fb[_0x953a('0x49')]};return db[_0x953a('0x37')][_0x953a('0x2a')](_0x5d0786)['then'](function(_0x67bcda){_0x5e06b7['count']=_0x67bcda;if(_0x4043ff['query'][_0x953a('0x4e')]){_0x19d3fb[_0x953a('0x4f')]=[{'all':!![]}];}return db[_0x953a('0x37')][_0x953a('0x50')](_0x19d3fb);})['then'](function(_0x36b93a){_0x5e06b7[_0x953a('0x51')]=_0x36b93a;return _0x5e06b7;})[_0x953a('0x2f')](respondWithFilteredResult(_0x1eba0d,_0x19d3fb))[_0x953a('0x23')](handleError(_0x1eba0d,null));};exports['show']=function(_0x2118a9,_0x525f4e){var _0x1f8183={'raw':![],'where':{'id':_0x2118a9[_0x953a('0x52')]['id']}},_0x4a956e={};_0x4a956e[_0x953a('0x3c')]=_[_0x953a('0x3e')](db['VoiceContext'][_0x953a('0x38')]);_0x4a956e['query']=_[_0x953a('0x3e')](_0x2118a9[_0x953a('0x3d')]);_0x4a956e[_0x953a('0x3f')]=_[_0x953a('0x41')](_0x4a956e[_0x953a('0x3c')],_0x4a956e[_0x953a('0x3d')]);_0x1f8183[_0x953a('0x40')]=_[_0x953a('0x41')](_0x4a956e[_0x953a('0x3c')],qs[_0x953a('0x42')](_0x2118a9[_0x953a('0x3d')][_0x953a('0x42')]));_0x1f8183[_0x953a('0x40')]=_0x1f8183[_0x953a('0x40')][_0x953a('0x43')]?_0x1f8183[_0x953a('0x40')]:_0x4a956e[_0x953a('0x3c')];if(_0x2118a9[_0x953a('0x3d')][_0x953a('0x4e')]){_0x1f8183[_0x953a('0x4f')]=[{'all':!![]}];}_0x1f8183=_[_0x953a('0x4c')]({},_0x1f8183,_0x2118a9[_0x953a('0x53')]);return db[_0x953a('0x37')][_0x953a('0x54')](_0x1f8183)['then'](handleEntityNotFound(_0x525f4e,null))[_0x953a('0x2f')](respondWithResult(_0x525f4e,null))[_0x953a('0x23')](handleError(_0x525f4e,null));};exports[_0x953a('0x55')]=function(_0x227433,_0xc40809,_0x3c0148){var _0x26ef46;return db[_0x953a('0x37')][_0x953a('0x55')](_0x227433['body'],{'raw':!![]})[_0x953a('0x2f')](function(_0x4d0c7b){_0x26ef46=_0x4d0c7b;return db[_0x953a('0x37')][_0x953a('0x50')]({'raw':!![]});})[_0x953a('0x2f')](function(_0x1906e5){var _0x25627a=fs[_0x953a('0x56')](path['join'](config[_0x953a('0x57')],_0x953a('0x58')),_0x953a('0x59'));var _0x1b5275=ejs[_0x953a('0x5a')](_0x25627a,{'contexts':_0x1906e5||[]});fs[_0x953a('0x5b')](_0x953a('0x5c'),_0x1b5275);})['then'](function(){return respondWithRpcPromise(_0x953a('0x5d'),_0x953a('0x55'),{'module':'chan_sip.so'});})[_0x953a('0x2f')](function(){var _0x150e22=_0x227433['user'][_0x953a('0x5e')]({'plain':!![]});if(!_0x150e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x150e22['role']===_0x953a('0x5f')){var _0x434b4d=_0x26ef46['get']({'plain':!![]});return db[_0x953a('0x60')][_0x953a('0x54')]({'where':{'name':_0x953a('0x30'),'userProfileId':_0x150e22[_0x953a('0x61')]},'raw':!![]})[_0x953a('0x2f')](function(_0x1bf9dd){if(_0x1bf9dd&&_0x1bf9dd[_0x953a('0x62')]===0x0){return db[_0x953a('0x31')][_0x953a('0x55')]({'name':_0x434b4d['name'],'resourceId':_0x434b4d['id'],'type':_0x1bf9dd[_0x953a('0x33')],'sectionId':_0x1bf9dd['id']},{})[_0x953a('0x2f')](function(){return _0x26ef46;});}else{return _0x26ef46;}})[_0x953a('0x23')](function(_0x7c09a3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7c09a3);throw _0x7c09a3;});}return _0x26ef46;})['then'](respondWithResult(_0xc40809,0xc9))[_0x953a('0x23')](handleError(_0xc40809,null));};exports[_0x953a('0x2e')]=function(_0x4567b9,_0x1b383c,_0x3d5d53){var _0x16ae44;return db[_0x953a('0x37')][_0x953a('0x54')]({'where':{'id':_0x4567b9['params']['id']}})['then'](handleEntityNotFound(_0x1b383c,null))[_0x953a('0x2f')](saveUpdates(_0x4567b9[_0x953a('0x63')],null))[_0x953a('0x2f')](function(_0x1d6180){if(_0x1d6180){_0x16ae44=_0x1d6180;return db[_0x953a('0x37')]['findAll']({'raw':!![]});}})[_0x953a('0x2f')](function(_0x25cef7){var _0x51e19b=fs[_0x953a('0x56')](path['join'](config[_0x953a('0x57')],_0x953a('0x58')),_0x953a('0x59'));var _0x4965ff=ejs['render'](_0x51e19b,{'contexts':_0x25cef7||[]});fs[_0x953a('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4965ff);})[_0x953a('0x2f')](function(){return respondWithRpcPromise(_0x953a('0x5d'),_0x953a('0x2e'),{'module':'chan_sip.so'});})[_0x953a('0x2f')](function(){return _0x16ae44;})[_0x953a('0x2f')](respondWithResult(_0x1b383c,null))[_0x953a('0x23')](handleError(_0x1b383c,null));};exports[_0x953a('0x64')]=function(_0x15e1fd,_0x545390,_0x26082c){var _0x401a46;return db[_0x953a('0x37')][_0x953a('0x54')]({'where':{'id':_0x15e1fd[_0x953a('0x52')]['id']}})['then'](handleEntityNotFound(_0x545390,null))[_0x953a('0x2f')](removeEntity(_0x545390,null))[_0x953a('0x2f')](function(){return db[_0x953a('0x37')][_0x953a('0x50')]({'raw':!![]});})['then'](function(_0x2e13db){var _0x3bc76f=fs[_0x953a('0x56')](path['join'](config[_0x953a('0x57')],_0x953a('0x58')),'utf8');var _0x177bb9=ejs[_0x953a('0x5a')](_0x3bc76f,{'contexts':_0x2e13db});fs['writeFileSync'](_0x953a('0x5c'),_0x177bb9);return respondWithRpcPromise(_0x953a('0x5d'),_0x953a('0x64'),{'module':_0x953a('0x65')});})[_0x953a('0x23')](handleError(_0x545390,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b2ef0a5..52d48ef 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 _0x5ba3=['request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','bluebird'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x5ba3,0x140));var _0x35ba=function(_0x26292b,_0x3e5aa1){_0x26292b=_0x26292b-0x0;var _0x26d1b3=_0x5ba3[_0x26292b];return _0x26d1b3;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var logger=require(_0x35ba('0x1'))(_0x35ba('0x2'));var moment=require('moment');var BPromise=require(_0x35ba('0x3'));var rp=require(_0x35ba('0x4'));var fs=require('fs');var path=require(_0x35ba('0x5'));var rimraf=require('rimraf');var config=require(_0x35ba('0x6'));var attributes=require(_0x35ba('0x7'));module[_0x35ba('0x8')]=function(_0x596785,_0x54c722){return _0x596785[_0x35ba('0x9')](_0x35ba('0xa'),attributes,{'tableName':_0x35ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b65=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','lodash'];(function(_0x11deab,_0x595015){var _0x2a9bcf=function(_0x52d1cc){while(--_0x52d1cc){_0x11deab['push'](_0x11deab['shift']());}};_0x2a9bcf(++_0x595015);}(_0x8b65,0x13e));var _0x58b6=function(_0x25470a,_0x2b3f98){_0x25470a=_0x25470a-0x0;var _0x1bcae2=_0x8b65[_0x25470a];return _0x1bcae2;};'use strict';var _=require(_0x58b6('0x0'));var util=require(_0x58b6('0x1'));var logger=require(_0x58b6('0x2'))(_0x58b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58b6('0x4'));var fs=require('fs');var path=require(_0x58b6('0x5'));var rimraf=require(_0x58b6('0x6'));var config=require(_0x58b6('0x7'));var attributes=require(_0x58b6('0x8'));module[_0x58b6('0x9')]=function(_0x528888,_0x2cec99){return _0x528888['define'](_0x58b6('0xa'),attributes,{'tableName':'voice_contexts','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 2ce036c..d6752f7 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 _0x4f7b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x8ec332,_0x49e459){var _0x4b2bb1=function(_0x81a267){while(--_0x81a267){_0x8ec332['push'](_0x8ec332['shift']());}};_0x4b2bb1(++_0x49e459);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x4f032e,_0x15b76b){_0x4f032e=_0x4f032e-0x0;var _0x4fdb31=_0x4f7b[_0x4f032e];return _0x4fdb31;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});} \ No newline at end of file +var _0xa596=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug'];(function(_0x5bf6b8,_0x464f48){var _0x44b425=function(_0x4e1b70){while(--_0x4e1b70){_0x5bf6b8['push'](_0x5bf6b8['shift']());}};_0x44b425(++_0x464f48);}(_0xa596,0x7b));var _0x6a59=function(_0x1f875b,_0x1ef023){_0x1f875b=_0x1f875b-0x0;var _0x31fdcb=_0xa596[_0x1f875b];return _0x31fdcb;};'use strict';var _=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var moment=require('moment');var BPromise=require(_0x6a59('0x2'));var rs=require(_0x6a59('0x3'));var fs=require('fs');var Redis=require(_0x6a59('0x4'));var db=require(_0x6a59('0x5'))['db'];var utils=require(_0x6a59('0x6'));var logger=require(_0x6a59('0x7'))(_0x6a59('0x8'));var config=require(_0x6a59('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6a59('0xa')][_0x6a59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21e97f,_0x375a77,_0xb50532){return new BPromise(function(_0x3c392f,_0x5aa5fe){return client[_0x6a59('0xc')](_0x21e97f,_0xb50532)['then'](function(_0x21008c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x375a77,_0x6a59('0xd'));logger[_0x6a59('0xe')](_0x6a59('0xf'),_0x375a77,'request\x20sent',JSON[_0x6a59('0x10')](_0x21008c));if(_0x21008c[_0x6a59('0x11')]){if(_0x21008c['error'][_0x6a59('0x12')]===0x1f4){logger['error'](_0x6a59('0x13'),_0x375a77,_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);return _0x5aa5fe(_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);}logger[_0x6a59('0x11')](_0x6a59('0x13'),_0x375a77,_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);return _0x3c392f(_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);}else{logger['info'](_0x6a59('0x13'),_0x375a77,_0x6a59('0xd'));_0x3c392f(_0x21008c[_0x6a59('0x15')][_0x6a59('0x14')]);}})[_0x6a59('0x16')](function(_0x39ad1e){logger['error'](_0x6a59('0x13'),_0x375a77,_0x39ad1e);_0x5aa5fe(_0x39ad1e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index ad3c7a2..ed2a74a 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 _0xe6b9=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe6b9,0x1cd));var _0x9e6b=function(_0x837dad,_0x1d9098){_0x837dad=_0x837dad-0x0;var _0x1d62d3=_0xe6b9[_0x837dad];return _0x1d62d3;};'use strict';var multer=require(_0x9e6b('0x0'));var util=require(_0x9e6b('0x1'));var path=require(_0x9e6b('0x2'));var timeout=require(_0x9e6b('0x3'));var express=require('express');var router=express[_0x9e6b('0x4')]();var fs_extra=require(_0x9e6b('0x5'));var auth=require(_0x9e6b('0x6'));var interaction=require(_0x9e6b('0x7'));var config=require(_0x9e6b('0x8'));var controller=require(_0x9e6b('0x9'));router[_0x9e6b('0xa')]('/',auth[_0x9e6b('0xb')](),controller[_0x9e6b('0xc')]);router[_0x9e6b('0xa')](_0x9e6b('0xd'),auth[_0x9e6b('0xb')](),controller['describe']);router[_0x9e6b('0xa')]('/:id',auth[_0x9e6b('0xb')](),controller[_0x9e6b('0xe')]);router[_0x9e6b('0xf')]('/',auth[_0x9e6b('0xb')](),controller[_0x9e6b('0x10')]);router[_0x9e6b('0x11')](_0x9e6b('0x12'),auth[_0x9e6b('0xb')](),controller[_0x9e6b('0x13')]);router[_0x9e6b('0x14')](_0x9e6b('0x12'),auth[_0x9e6b('0xb')](),controller[_0x9e6b('0x15')]);module[_0x9e6b('0x16')]=router; \ No newline at end of file +var _0x654e=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3631bd,_0x37d121){var _0xbf0068=function(_0x457120){while(--_0x457120){_0x3631bd['push'](_0x3631bd['shift']());}};_0xbf0068(++_0x37d121);}(_0x654e,0x1e8));var _0xe654=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x654e[_0x810e4d];return _0x13f01c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe654('0x0'));var timeout=require('connect-timeout');var express=require(_0xe654('0x1'));var router=express[_0xe654('0x2')]();var fs_extra=require(_0xe654('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe654('0x4'));var config=require('../../config/environment');var controller=require(_0xe654('0x5'));router[_0xe654('0x6')]('/',auth[_0xe654('0x7')](),controller[_0xe654('0x8')]);router[_0xe654('0x6')](_0xe654('0x9'),auth[_0xe654('0x7')](),controller[_0xe654('0xa')]);router[_0xe654('0x6')](_0xe654('0xb'),auth[_0xe654('0x7')](),controller[_0xe654('0xc')]);router['post']('/',auth[_0xe654('0x7')](),controller[_0xe654('0xd')]);router['put'](_0xe654('0xb'),auth[_0xe654('0x7')](),controller[_0xe654('0xe')]);router[_0xe654('0xf')]('/:id',auth[_0xe654('0x7')](),controller[_0xe654('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 4331a5f..19ca650 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x1d91ae,_0xd48858){var _0x534016=function(_0x249c1e){while(--_0x249c1e){_0x1d91ae['push'](_0x1d91ae['shift']());}};_0x534016(++_0xd48858);}(_0x98a8,0x12c));var _0x898a=function(_0x273904,_0x40a8c7){_0x273904=_0x273904-0x0;var _0x5f2d68=_0x98a8[_0x273904];return _0x5f2d68;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x26c80e,_0x12f763){var _0x9443b4=function(_0x1cbec8){while(--_0x1cbec8){_0x26c80e['push'](_0x26c80e['shift']());}};_0x9443b4(++_0x12f763);}(_0x24ca,0x1bc));var _0xa24c=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x24ca[_0x687ddc];return _0x441991;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 514efc3..81a33aa 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 _0x1889=['rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','then','error','stack','send','index','map','VoiceDialReport','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','name','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','create','update','body','find','destroy','describe','eml-format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1889,0x176));var _0x9188=function(_0xbaab91,_0x5bad90){_0xbaab91=_0xbaab91-0x0;var _0x509352=_0x1889[_0xbaab91];return _0x509352;};'use strict';var emlformat=require(_0x9188('0x0'));var rimraf=require(_0x9188('0x1'));var zipdir=require(_0x9188('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9188('0x3'));var Mustache=require(_0x9188('0x4'));var util=require(_0x9188('0x5'));var path=require(_0x9188('0x6'));var sox=require('sox');var csv=require(_0x9188('0x7'));var ejs=require(_0x9188('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9188('0x9'));var squel=require(_0x9188('0xa'));var crypto=require(_0x9188('0xb'));var jsforce=require(_0x9188('0xc'));var deskjs=require(_0x9188('0xd'));var toCsv=require(_0x9188('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9188('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9188('0xf'));var as=require(_0x9188('0x10'));var hardwareService=require(_0x9188('0x11'));var logger=require(_0x9188('0x12'))('api');var utils=require(_0x9188('0x13'));var config=require(_0x9188('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9188('0x15'))['db'];function respondWithStatusCode(_0x4d266b,_0x415999){_0x415999=_0x415999||0xcc;return function(_0xfc5ed2){if(_0xfc5ed2){return _0x4d266b[_0x9188('0x16')](_0x415999);}return _0x4d266b['status'](_0x415999)[_0x9188('0x17')]();};}function respondWithResult(_0x2bd0b6,_0x36ee43){_0x36ee43=_0x36ee43||0xc8;return function(_0x513f84){if(_0x513f84){return _0x2bd0b6['status'](_0x36ee43)[_0x9188('0x18')](_0x513f84);}};}function respondWithFilteredResult(_0x5d1ce8,_0x727706){return function(_0x418bf9){if(_0x418bf9){var _0x56193e=typeof _0x727706[_0x9188('0x19')]===_0x9188('0x1a')&&typeof _0x727706['limit']==='undefined';var _0x4ba2b5=_0x418bf9[_0x9188('0x1b')];var _0x3066ae=_0x56193e?0x0:_0x727706['offset'];var _0x24fb3d=_0x56193e?_0x418bf9[_0x9188('0x1b')]:_0x727706[_0x9188('0x19')]+_0x727706['limit'];var _0x113389;if(_0x24fb3d>=_0x4ba2b5){_0x24fb3d=_0x4ba2b5;_0x113389=0xc8;}else{_0x113389=0xce;}_0x5d1ce8[_0x9188('0x1c')](_0x113389);return _0x5d1ce8[_0x9188('0x1d')](_0x9188('0x1e'),_0x3066ae+'-'+_0x24fb3d+'/'+_0x4ba2b5)['json'](_0x418bf9);}return null;};}function patchUpdates(_0xfb1b28){return function(_0x286e7a){try{jsonpatch[_0x9188('0x1f')](_0x286e7a,_0xfb1b28,!![]);}catch(_0x3607c7){return BPromise[_0x9188('0x20')](_0x3607c7);}return _0x286e7a[_0x9188('0x21')]();};}function saveUpdates(_0x25c2f9,_0x1d7d10){return function(_0x57e4c1){if(_0x57e4c1){return _0x57e4c1['update'](_0x25c2f9)['then'](function(_0x171da4){return _0x171da4;});}return null;};}function removeEntity(_0xd35a14,_0x29908f){return function(_0x3611f7){if(_0x3611f7){return _0x3611f7['destroy']()[_0x9188('0x22')](function(){_0xd35a14[_0x9188('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc7a0,_0x31ab1d){return function(_0x120526){if(!_0x120526){_0x2dc7a0['sendStatus'](0x194);}return _0x120526;};}function handleError(_0x1c68b7,_0x4ca2b1){_0x4ca2b1=_0x4ca2b1||0x1f4;return function(_0x51e461){logger[_0x9188('0x23')](_0x51e461[_0x9188('0x24')]);if(_0x51e461['name']){delete _0x51e461['name'];}_0x1c68b7['status'](_0x4ca2b1)[_0x9188('0x25')](_0x51e461);};}exports[_0x9188('0x26')]=function(_0x3df803,_0x591a7b){var _0x175a0d={},_0x242a76={},_0x254ebc={'count':0x0,'rows':[]};var _0x3fc43c=_[_0x9188('0x27')](db[_0x9188('0x28')]['rawAttributes'],function(_0x5d830e){return{'name':_0x5d830e[_0x9188('0x29')],'type':_0x5d830e[_0x9188('0x2a')][_0x9188('0x2b')]};});_0x242a76['model']=_[_0x9188('0x27')](_0x3fc43c,'name');_0x242a76[_0x9188('0x2c')]=_['keys'](_0x3df803['query']);_0x242a76[_0x9188('0x2d')]=_[_0x9188('0x2e')](_0x242a76['model'],_0x242a76['query']);_0x175a0d[_0x9188('0x2f')]=_[_0x9188('0x2e')](_0x242a76[_0x9188('0x30')],qs[_0x9188('0x31')](_0x3df803[_0x9188('0x2c')][_0x9188('0x31')]));_0x175a0d[_0x9188('0x2f')]=_0x175a0d[_0x9188('0x2f')][_0x9188('0x32')]?_0x175a0d[_0x9188('0x2f')]:_0x242a76[_0x9188('0x30')];if(!_0x3df803[_0x9188('0x2c')]['hasOwnProperty'](_0x9188('0x33'))){_0x175a0d[_0x9188('0x34')]=qs[_0x9188('0x34')](_0x3df803[_0x9188('0x2c')]['limit']);_0x175a0d['offset']=qs[_0x9188('0x19')](_0x3df803[_0x9188('0x2c')][_0x9188('0x19')]);}_0x175a0d[_0x9188('0x35')]=qs[_0x9188('0x36')](_0x3df803[_0x9188('0x2c')][_0x9188('0x36')]);_0x175a0d[_0x9188('0x37')]=qs[_0x9188('0x2d')](_[_0x9188('0x38')](_0x3df803[_0x9188('0x2c')],_0x242a76['filters']),_0x3fc43c);if(_0x3df803[_0x9188('0x2c')][_0x9188('0x39')]){_0x175a0d[_0x9188('0x37')]=_[_0x9188('0x3a')](_0x175a0d[_0x9188('0x37')],{'$or':_[_0x9188('0x27')](_0x3fc43c,function(_0x12626e){if(_0x12626e[_0x9188('0x2a')]!=='VIRTUAL'){var _0x5ad3dd={};_0x5ad3dd[_0x12626e[_0x9188('0x3b')]]={'$like':'%'+_0x3df803[_0x9188('0x2c')][_0x9188('0x39')]+'%'};return _0x5ad3dd;}})});}_0x175a0d=_[_0x9188('0x3a')]({},_0x175a0d,_0x3df803[_0x9188('0x3c')]);var _0xf5f16d={'where':_0x175a0d[_0x9188('0x37')]};return db['VoiceDialReport'][_0x9188('0x1b')](_0xf5f16d)[_0x9188('0x22')](function(_0x1f9932){_0x254ebc['count']=_0x1f9932;if(_0x3df803['query']['includeAll']){_0x175a0d[_0x9188('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x175a0d);})[_0x9188('0x22')](function(_0x2f5287){_0x254ebc[_0x9188('0x3e')]=_0x2f5287;return _0x254ebc;})[_0x9188('0x22')](respondWithFilteredResult(_0x591a7b,_0x175a0d))[_0x9188('0x3f')](handleError(_0x591a7b,null));};exports[_0x9188('0x40')]=function(_0x4a1629,_0x4e2a3c){var _0x5e91d4={'raw':!![],'where':{'id':_0x4a1629[_0x9188('0x41')]['id']}},_0x53841f={};_0x53841f['model']=_[_0x9188('0x42')](db[_0x9188('0x28')][_0x9188('0x43')]);_0x53841f[_0x9188('0x2c')]=_[_0x9188('0x42')](_0x4a1629['query']);_0x53841f['filters']=_[_0x9188('0x2e')](_0x53841f['model'],_0x53841f[_0x9188('0x2c')]);_0x5e91d4[_0x9188('0x2f')]=_['intersection'](_0x53841f['model'],qs[_0x9188('0x31')](_0x4a1629['query']['fields']));_0x5e91d4[_0x9188('0x2f')]=_0x5e91d4[_0x9188('0x2f')]['length']?_0x5e91d4[_0x9188('0x2f')]:_0x53841f[_0x9188('0x30')];if(_0x4a1629[_0x9188('0x2c')][_0x9188('0x44')]){_0x5e91d4[_0x9188('0x3d')]=[{'all':!![]}];}_0x5e91d4=_[_0x9188('0x3a')]({},_0x5e91d4,_0x4a1629['options']);return db['VoiceDialReport']['find'](_0x5e91d4)[_0x9188('0x22')](handleEntityNotFound(_0x4e2a3c,null))[_0x9188('0x22')](respondWithResult(_0x4e2a3c,null))[_0x9188('0x3f')](handleError(_0x4e2a3c,null));};exports[_0x9188('0x45')]=function(_0xd71701,_0x332438){return db[_0x9188('0x28')]['create'](_0xd71701['body'],{})[_0x9188('0x22')](respondWithResult(_0x332438,0xc9))[_0x9188('0x3f')](handleError(_0x332438,null));};exports[_0x9188('0x46')]=function(_0x48227f,_0x19b9ee){if(_0x48227f['body']['id']){delete _0x48227f[_0x9188('0x47')]['id'];}return db[_0x9188('0x28')][_0x9188('0x48')]({'where':{'id':_0x48227f[_0x9188('0x41')]['id']}})['then'](handleEntityNotFound(_0x19b9ee,null))['then'](saveUpdates(_0x48227f['body'],null))['then'](respondWithResult(_0x19b9ee,null))['catch'](handleError(_0x19b9ee,null));};exports[_0x9188('0x49')]=function(_0x133435,_0x5ef54c){return db[_0x9188('0x28')][_0x9188('0x48')]({'where':{'id':_0x133435[_0x9188('0x41')]['id']}})[_0x9188('0x22')](handleEntityNotFound(_0x5ef54c,null))[_0x9188('0x22')](removeEntity(_0x5ef54c,null))[_0x9188('0x3f')](handleError(_0x5ef54c,null));};exports['describe']=function(_0x3718e4,_0x1a2cde){return db[_0x9188('0x28')][_0x9188('0x4a')]()[_0x9188('0x22')](respondWithResult(_0x1a2cde,null))['catch'](handleError(_0x1a2cde,null));}; \ No newline at end of file +var _0xbdca=['includeAll','findAll','rows','catch','show','params','keys','include','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','VoiceDialReport','rawAttributes','type','key','query','filters','intersection','fields','attributes','length','model','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xbdca,0x137));var _0xabdc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbdca[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xabdc('0x0'));var rimraf=require(_0xabdc('0x1'));var zipdir=require(_0xabdc('0x2'));var jsonpatch=require(_0xabdc('0x3'));var rp=require(_0xabdc('0x4'));var moment=require(_0xabdc('0x5'));var BPromise=require(_0xabdc('0x6'));var Mustache=require(_0xabdc('0x7'));var util=require(_0xabdc('0x8'));var path=require(_0xabdc('0x9'));var sox=require(_0xabdc('0xa'));var csv=require(_0xabdc('0xb'));var ejs=require(_0xabdc('0xc'));var fs=require('fs');var fs_extra=require(_0xabdc('0xd'));var _=require(_0xabdc('0xe'));var squel=require(_0xabdc('0xf'));var crypto=require('crypto');var jsforce=require(_0xabdc('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xabdc('0x11'));var Papa=require('papaparse');var Redis=require(_0xabdc('0x12'));var authService=require(_0xabdc('0x13'));var qs=require(_0xabdc('0x14'));var as=require(_0xabdc('0x15'));var hardwareService=require(_0xabdc('0x16'));var logger=require(_0xabdc('0x17'))('api');var utils=require(_0xabdc('0x18'));var config=require(_0xabdc('0x19'));var licenseUtil=require(_0xabdc('0x1a'));var db=require(_0xabdc('0x1b'))['db'];function respondWithStatusCode(_0x125f42,_0x3bea6f){_0x3bea6f=_0x3bea6f||0xcc;return function(_0x3e516f){if(_0x3e516f){return _0x125f42[_0xabdc('0x1c')](_0x3bea6f);}return _0x125f42[_0xabdc('0x1d')](_0x3bea6f)['end']();};}function respondWithResult(_0x4fe5a4,_0x19ab96){_0x19ab96=_0x19ab96||0xc8;return function(_0x5d97a9){if(_0x5d97a9){return _0x4fe5a4['status'](_0x19ab96)[_0xabdc('0x1e')](_0x5d97a9);}};}function respondWithFilteredResult(_0x7d6644,_0x1a683e){return function(_0x520747){if(_0x520747){var _0x1505e9=typeof _0x1a683e[_0xabdc('0x1f')]===_0xabdc('0x20')&&typeof _0x1a683e[_0xabdc('0x21')]==='undefined';var _0x5b3b6a=_0x520747['count'];var _0x95d0b8=_0x1505e9?0x0:_0x1a683e[_0xabdc('0x1f')];var _0x35fb0c=_0x1505e9?_0x520747[_0xabdc('0x22')]:_0x1a683e['offset']+_0x1a683e[_0xabdc('0x21')];var _0x8806a9;if(_0x35fb0c>=_0x5b3b6a){_0x35fb0c=_0x5b3b6a;_0x8806a9=0xc8;}else{_0x8806a9=0xce;}_0x7d6644[_0xabdc('0x1d')](_0x8806a9);return _0x7d6644[_0xabdc('0x23')](_0xabdc('0x24'),_0x95d0b8+'-'+_0x35fb0c+'/'+_0x5b3b6a)[_0xabdc('0x1e')](_0x520747);}return null;};}function patchUpdates(_0x44285c){return function(_0x141367){try{jsonpatch[_0xabdc('0x25')](_0x141367,_0x44285c,!![]);}catch(_0x5bcab8){return BPromise[_0xabdc('0x26')](_0x5bcab8);}return _0x141367['save']();};}function saveUpdates(_0x1c2e8a,_0x59a236){return function(_0x34967b){if(_0x34967b){return _0x34967b[_0xabdc('0x27')](_0x1c2e8a)[_0xabdc('0x28')](function(_0x108d62){return _0x108d62;});}return null;};}function removeEntity(_0x2a5a42,_0x11ec5a){return function(_0x24e982){if(_0x24e982){return _0x24e982[_0xabdc('0x29')]()['then'](function(){_0x2a5a42[_0xabdc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd150f1,_0x32eabd){return function(_0x4eaaa9){if(!_0x4eaaa9){_0xd150f1['sendStatus'](0x194);}return _0x4eaaa9;};}function handleError(_0x125400,_0x5af4a1){_0x5af4a1=_0x5af4a1||0x1f4;return function(_0x1cee88){logger['error'](_0x1cee88[_0xabdc('0x2a')]);if(_0x1cee88[_0xabdc('0x2b')]){delete _0x1cee88[_0xabdc('0x2b')];}_0x125400[_0xabdc('0x1d')](_0x5af4a1)['send'](_0x1cee88);};}exports[_0xabdc('0x2c')]=function(_0x346ab6,_0xec0b0e){var _0xdf81d0={},_0x27d6b1={},_0x529286={'count':0x0,'rows':[]};var _0x1f6fd1=_[_0xabdc('0x2d')](db[_0xabdc('0x2e')][_0xabdc('0x2f')],function(_0x51031d){return{'name':_0x51031d['fieldName'],'type':_0x51031d[_0xabdc('0x30')][_0xabdc('0x31')]};});_0x27d6b1['model']=_[_0xabdc('0x2d')](_0x1f6fd1,_0xabdc('0x2b'));_0x27d6b1[_0xabdc('0x32')]=_['keys'](_0x346ab6[_0xabdc('0x32')]);_0x27d6b1[_0xabdc('0x33')]=_[_0xabdc('0x34')](_0x27d6b1['model'],_0x27d6b1[_0xabdc('0x32')]);_0xdf81d0['attributes']=_[_0xabdc('0x34')](_0x27d6b1['model'],qs[_0xabdc('0x35')](_0x346ab6[_0xabdc('0x32')][_0xabdc('0x35')]));_0xdf81d0[_0xabdc('0x36')]=_0xdf81d0[_0xabdc('0x36')][_0xabdc('0x37')]?_0xdf81d0[_0xabdc('0x36')]:_0x27d6b1[_0xabdc('0x38')];if(!_0x346ab6[_0xabdc('0x32')]['hasOwnProperty']('nolimit')){_0xdf81d0[_0xabdc('0x21')]=qs[_0xabdc('0x21')](_0x346ab6[_0xabdc('0x32')][_0xabdc('0x21')]);_0xdf81d0[_0xabdc('0x1f')]=qs[_0xabdc('0x1f')](_0x346ab6[_0xabdc('0x32')][_0xabdc('0x1f')]);}_0xdf81d0[_0xabdc('0x39')]=qs['sort'](_0x346ab6[_0xabdc('0x32')][_0xabdc('0x3a')]);_0xdf81d0[_0xabdc('0x3b')]=qs[_0xabdc('0x33')](_['pick'](_0x346ab6[_0xabdc('0x32')],_0x27d6b1['filters']),_0x1f6fd1);if(_0x346ab6[_0xabdc('0x32')][_0xabdc('0x3c')]){_0xdf81d0[_0xabdc('0x3b')]=_['merge'](_0xdf81d0[_0xabdc('0x3b')],{'$or':_[_0xabdc('0x2d')](_0x1f6fd1,function(_0x8eb423){if(_0x8eb423[_0xabdc('0x30')]!==_0xabdc('0x3d')){var _0x4595c6={};_0x4595c6[_0x8eb423[_0xabdc('0x2b')]]={'$like':'%'+_0x346ab6[_0xabdc('0x32')][_0xabdc('0x3c')]+'%'};return _0x4595c6;}})});}_0xdf81d0=_[_0xabdc('0x3e')]({},_0xdf81d0,_0x346ab6[_0xabdc('0x3f')]);var _0x568fdc={'where':_0xdf81d0['where']};return db[_0xabdc('0x2e')]['count'](_0x568fdc)[_0xabdc('0x28')](function(_0x4ff557){_0x529286[_0xabdc('0x22')]=_0x4ff557;if(_0x346ab6[_0xabdc('0x32')][_0xabdc('0x40')]){_0xdf81d0['include']=[{'all':!![]}];}return db[_0xabdc('0x2e')][_0xabdc('0x41')](_0xdf81d0);})['then'](function(_0x5cc418){_0x529286[_0xabdc('0x42')]=_0x5cc418;return _0x529286;})[_0xabdc('0x28')](respondWithFilteredResult(_0xec0b0e,_0xdf81d0))[_0xabdc('0x43')](handleError(_0xec0b0e,null));};exports[_0xabdc('0x44')]=function(_0x2410e5,_0xfe9a1f){var _0x42581b={'raw':!![],'where':{'id':_0x2410e5[_0xabdc('0x45')]['id']}},_0xbb33dc={};_0xbb33dc['model']=_['keys'](db['VoiceDialReport'][_0xabdc('0x2f')]);_0xbb33dc[_0xabdc('0x32')]=_[_0xabdc('0x46')](_0x2410e5['query']);_0xbb33dc[_0xabdc('0x33')]=_[_0xabdc('0x34')](_0xbb33dc[_0xabdc('0x38')],_0xbb33dc[_0xabdc('0x32')]);_0x42581b[_0xabdc('0x36')]=_[_0xabdc('0x34')](_0xbb33dc[_0xabdc('0x38')],qs[_0xabdc('0x35')](_0x2410e5['query']['fields']));_0x42581b[_0xabdc('0x36')]=_0x42581b[_0xabdc('0x36')][_0xabdc('0x37')]?_0x42581b[_0xabdc('0x36')]:_0xbb33dc['model'];if(_0x2410e5[_0xabdc('0x32')][_0xabdc('0x40')]){_0x42581b[_0xabdc('0x47')]=[{'all':!![]}];}_0x42581b=_[_0xabdc('0x3e')]({},_0x42581b,_0x2410e5[_0xabdc('0x3f')]);return db['VoiceDialReport'][_0xabdc('0x48')](_0x42581b)[_0xabdc('0x28')](handleEntityNotFound(_0xfe9a1f,null))['then'](respondWithResult(_0xfe9a1f,null))['catch'](handleError(_0xfe9a1f,null));};exports[_0xabdc('0x49')]=function(_0x29b784,_0x833d1a){return db[_0xabdc('0x2e')]['create'](_0x29b784['body'],{})[_0xabdc('0x28')](respondWithResult(_0x833d1a,0xc9))['catch'](handleError(_0x833d1a,null));};exports[_0xabdc('0x27')]=function(_0x1f8b8b,_0x5db32b){if(_0x1f8b8b['body']['id']){delete _0x1f8b8b['body']['id'];}return db[_0xabdc('0x2e')]['find']({'where':{'id':_0x1f8b8b[_0xabdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x5db32b,null))[_0xabdc('0x28')](saveUpdates(_0x1f8b8b['body'],null))[_0xabdc('0x28')](respondWithResult(_0x5db32b,null))['catch'](handleError(_0x5db32b,null));};exports['destroy']=function(_0x516dea,_0x169a73){return db[_0xabdc('0x2e')]['find']({'where':{'id':_0x516dea[_0xabdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x169a73,null))[_0xabdc('0x28')](removeEntity(_0x169a73,null))[_0xabdc('0x43')](handleError(_0x169a73,null));};exports[_0xabdc('0x4a')]=function(_0x5ddee5,_0x19024e){return db[_0xabdc('0x2e')][_0xabdc('0x4a')]()[_0xabdc('0x28')](respondWithResult(_0x19024e,null))[_0xabdc('0x43')](handleError(_0x19024e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9fa5936..b17476a 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 _0x8832=['./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8832,0x1f4));var _0x2883=function(_0x15ade3,_0x56f5d3){_0x15ade3=_0x15ade3-0x0;var _0x2999aa=_0x8832[_0x15ade3];return _0x2999aa;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2883('0x2'));var BPromise=require(_0x2883('0x3'));var rp=require(_0x2883('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2883('0x5'));var config=require('../../config/environment');var attributes=require(_0x2883('0x6'));module[_0x2883('0x7')]=function(_0x278026,_0x556903){return _0x278026[_0x2883('0x8')]('VoiceDialReport',attributes,{'tableName':_0x2883('0x9'),'paranoid':![],'indexes':[{'fields':[_0x2883('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4927=['report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x4ab395,_0x3a81c6){var _0x4e56ed=function(_0x68f7f3){while(--_0x68f7f3){_0x4ab395['push'](_0x4ab395['shift']());}};_0x4e56ed(++_0x3a81c6);}(_0x4927,0x122));var _0x7492=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4927[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var logger=require(_0x7492('0x2'))(_0x7492('0x3'));var moment=require(_0x7492('0x4'));var BPromise=require(_0x7492('0x5'));var rp=require(_0x7492('0x6'));var fs=require('fs');var path=require(_0x7492('0x7'));var rimraf=require(_0x7492('0x8'));var config=require(_0x7492('0x9'));var attributes=require(_0x7492('0xa'));module[_0x7492('0xb')]=function(_0x110eca,_0x276317){return _0x110eca[_0x7492('0xc')](_0x7492('0xd'),attributes,{'tableName':_0x7492('0xe'),'paranoid':![],'indexes':[{'fields':[_0x7492('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6e5b179..36c5efd 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 _0x9a52=['limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x9a52,0x97));var _0x29a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x29a5('0x0'));var util=require('util');var moment=require(_0x29a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x29a5('0x2'));var fs=require('fs');var Redis=require(_0x29a5('0x3'));var db=require(_0x29a5('0x4'))['db'];var utils=require(_0x29a5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x29a5('0x6')][_0x29a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b181f,_0xd5dd47,_0x398ebe){return new BPromise(function(_0x333099,_0x14226e){return client[_0x29a5('0x8')](_0x2b181f,_0x398ebe)[_0x29a5('0x9')](function(_0x44a41b){logger[_0x29a5('0xa')](_0x29a5('0xb'),_0xd5dd47,_0x29a5('0xc'));logger['debug'](_0x29a5('0xd'),_0xd5dd47,_0x29a5('0xc'),JSON['stringify'](_0x44a41b));if(_0x44a41b[_0x29a5('0xe')]){if(_0x44a41b['error'][_0x29a5('0xf')]===0x1f4){logger[_0x29a5('0xe')](_0x29a5('0xb'),_0xd5dd47,_0x44a41b[_0x29a5('0xe')]['message']);return _0x14226e(_0x44a41b[_0x29a5('0xe')]['message']);}logger['error'](_0x29a5('0xb'),_0xd5dd47,_0x44a41b[_0x29a5('0xe')]['message']);return _0x333099(_0x44a41b['error'][_0x29a5('0x10')]);}else{logger['info'](_0x29a5('0xb'),_0xd5dd47,_0x29a5('0xc'));_0x333099(_0x44a41b[_0x29a5('0x11')][_0x29a5('0x10')]);}})[_0x29a5('0x12')](function(_0x409fff){logger[_0x29a5('0xe')](_0x29a5('0xb'),_0xd5dd47,_0x409fff);_0x14226e(_0x409fff);});});}exports[_0x29a5('0x13')]=function(_0x4edd93){var _0x4f5ae2=this;return new Promise(function(_0x4148af,_0x363ef1){return db[_0x29a5('0x14')][_0x29a5('0x15')](_0x4edd93['body'],{'raw':_0x4edd93[_0x29a5('0x16')]?_0x4edd93[_0x29a5('0x16')][_0x29a5('0x17')]===undefined?!![]:![]:!![]})[_0x29a5('0x9')](function(_0x1a6232){logger['info'](_0x29a5('0x13'),_0x4edd93);logger['debug'](_0x29a5('0x13'),_0x4edd93,JSON[_0x29a5('0x18')](_0x1a6232));_0x4148af(_0x1a6232);})[_0x29a5('0x12')](function(_0x469066){logger['error'](_0x29a5('0x13'),_0x469066[_0x29a5('0x10')],_0x4edd93);_0x363ef1(_0x4f5ae2[_0x29a5('0xe')](0x1f4,_0x469066[_0x29a5('0x10')]));});});};exports[_0x29a5('0x19')]=function(_0x8a875){var _0x3b113c=this;return new Promise(function(_0x8e9ff1,_0x2a7a85){return db[_0x29a5('0x14')][_0x29a5('0x1a')](_0x8a875['body'],{'raw':_0x8a875[_0x29a5('0x16')]?_0x8a875[_0x29a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a875['options']?_0x8a875[_0x29a5('0x16')][_0x29a5('0x1b')]||null:null,'attributes':_0x8a875[_0x29a5('0x16')]?_0x8a875[_0x29a5('0x16')][_0x29a5('0x1c')]||null:null,'limit':_0x8a875[_0x29a5('0x16')]?_0x8a875['options'][_0x29a5('0x1d')]||null:null})[_0x29a5('0x9')](function(_0xbaa1e2){logger[_0x29a5('0xa')]('UpdateVoiceDialReport',_0x8a875);logger['debug'](_0x29a5('0x19'),_0x8a875,JSON[_0x29a5('0x18')](_0xbaa1e2));_0x8e9ff1(_0xbaa1e2);})['catch'](function(_0x1ef8ff){logger[_0x29a5('0xe')](_0x29a5('0x19'),_0x1ef8ff[_0x29a5('0x10')],_0x8a875);_0x2a7a85(_0x3b113c[_0x29a5('0xe')](0x1f4,_0x1ef8ff['message']));});});}; \ No newline at end of file +var _0x883f=['message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','where','attributes','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55ddb3,_0x438146){var _0x355a70=function(_0x5b18ce){while(--_0x5b18ce){_0x55ddb3['push'](_0x55ddb3['shift']());}};_0x355a70(++_0x438146);}(_0x883f,0x14c));var _0xf883=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0x883f[_0x1be790];return _0x7668c8;};'use strict';var _=require(_0xf883('0x0'));var util=require('util');var moment=require(_0xf883('0x1'));var BPromise=require(_0xf883('0x2'));var rs=require(_0xf883('0x3'));var fs=require('fs');var Redis=require(_0xf883('0x4'));var db=require(_0xf883('0x5'))['db'];var utils=require(_0xf883('0x6'));var logger=require('../../config/logger')(_0xf883('0x7'));var config=require(_0xf883('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf883('0x9')][_0xf883('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x580e41,_0x55fa98,_0x38338a){return new BPromise(function(_0x3e845e,_0x7ecf5f){return client[_0xf883('0xb')](_0x580e41,_0x38338a)[_0xf883('0xc')](function(_0x313e65){logger[_0xf883('0xd')](_0xf883('0xe'),_0x55fa98,_0xf883('0xf'));logger[_0xf883('0x10')](_0xf883('0x11'),_0x55fa98,'request\x20sent',JSON[_0xf883('0x12')](_0x313e65));if(_0x313e65['error']){if(_0x313e65[_0xf883('0x13')]['code']===0x1f4){logger[_0xf883('0x13')](_0xf883('0xe'),_0x55fa98,_0x313e65[_0xf883('0x13')][_0xf883('0x14')]);return _0x7ecf5f(_0x313e65[_0xf883('0x13')][_0xf883('0x14')]);}logger[_0xf883('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x55fa98,_0x313e65['error']['message']);return _0x3e845e(_0x313e65[_0xf883('0x13')][_0xf883('0x14')]);}else{logger[_0xf883('0xd')](_0xf883('0xe'),_0x55fa98,_0xf883('0xf'));_0x3e845e(_0x313e65[_0xf883('0x15')]['message']);}})[_0xf883('0x16')](function(_0x1b2dd5){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x55fa98,_0x1b2dd5);_0x7ecf5f(_0x1b2dd5);});});}exports[_0xf883('0x17')]=function(_0x5242de){var _0x2837d1=this;return new Promise(function(_0x2d41c3,_0x29338a){return db[_0xf883('0x18')][_0xf883('0x19')](_0x5242de[_0xf883('0x1a')],{'raw':_0x5242de[_0xf883('0x1b')]?_0x5242de[_0xf883('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf883('0xc')](function(_0x40d90d){logger[_0xf883('0xd')]('CreateVoiceDialReport',_0x5242de);logger[_0xf883('0x10')]('CreateVoiceDialReport',_0x5242de,JSON[_0xf883('0x12')](_0x40d90d));_0x2d41c3(_0x40d90d);})[_0xf883('0x16')](function(_0x25714c){logger[_0xf883('0x13')](_0xf883('0x17'),_0x25714c['message'],_0x5242de);_0x29338a(_0x2837d1[_0xf883('0x13')](0x1f4,_0x25714c[_0xf883('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x53849f){var _0x2a4a0a=this;return new Promise(function(_0x45c22a,_0x5c85e0){return db[_0xf883('0x18')]['update'](_0x53849f['body'],{'raw':_0x53849f[_0xf883('0x1b')]?_0x53849f[_0xf883('0x1b')][_0xf883('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53849f[_0xf883('0x1b')]?_0x53849f[_0xf883('0x1b')][_0xf883('0x1d')]||null:null,'attributes':_0x53849f[_0xf883('0x1b')]?_0x53849f[_0xf883('0x1b')][_0xf883('0x1e')]||null:null,'limit':_0x53849f[_0xf883('0x1b')]?_0x53849f[_0xf883('0x1b')]['limit']||null:null})['then'](function(_0x222488){logger['info'](_0xf883('0x1f'),_0x53849f);logger[_0xf883('0x10')](_0xf883('0x1f'),_0x53849f,JSON[_0xf883('0x12')](_0x222488));_0x45c22a(_0x222488);})[_0xf883('0x16')](function(_0x519a00){logger[_0xf883('0x13')]('UpdateVoiceDialReport',_0x519a00[_0xf883('0x14')],_0x53849f);_0x5c85e0(_0x2a4a0a[_0xf883('0x13')](0x1f4,_0x519a00[_0xf883('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 259b202..cb047c8 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 _0xd04d=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3b0418,_0x32447b){var _0x5c8459=function(_0x1f297b){while(--_0x1f297b){_0x3b0418['push'](_0x3b0418['shift']());}};_0x5c8459(++_0x32447b);}(_0xd04d,0x11f));var _0xdd04=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd04d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xdd04('0x0'));var util=require(_0xdd04('0x1'));var path=require('path');var timeout=require(_0xdd04('0x2'));var express=require(_0xdd04('0x3'));var router=express[_0xdd04('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdd04('0x5'));var interaction=require(_0xdd04('0x6'));var config=require(_0xdd04('0x7'));var controller=require(_0xdd04('0x8'));router[_0xdd04('0x9')]('/',auth[_0xdd04('0xa')](),controller['index']);router[_0xdd04('0x9')](_0xdd04('0xb'),auth['isAuthenticated'](),controller[_0xdd04('0xc')]);router[_0xdd04('0xd')]('/',auth[_0xdd04('0xa')](),controller[_0xdd04('0xe')]);router[_0xdd04('0xd')](_0xdd04('0xf'),auth['isAuthenticated'](),controller[_0xdd04('0x10')]);router[_0xdd04('0x11')](_0xdd04('0xb'),auth[_0xdd04('0xa')](),controller[_0xdd04('0x12')]);router[_0xdd04('0x13')](_0xdd04('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xdd04('0x14')]=router; \ No newline at end of file +var _0x3a32=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports'];(function(_0x13fd82,_0x1ee0dd){var _0x55cc3a=function(_0x1190a8){while(--_0x1190a8){_0x13fd82['push'](_0x13fd82['shift']());}};_0x55cc3a(++_0x1ee0dd);}(_0x3a32,0x66));var _0x23a3=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x3a32[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x23a3('0x0'));var util=require('util');var path=require(_0x23a3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x23a3('0x2')]();var fs_extra=require(_0x23a3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x23a3('0x4'));var config=require(_0x23a3('0x5'));var controller=require(_0x23a3('0x6'));router[_0x23a3('0x7')]('/',auth[_0x23a3('0x8')](),controller[_0x23a3('0x9')]);router[_0x23a3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x23a3('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x23a3('0xa')]('/:id/applications',auth[_0x23a3('0x8')](),controller['addApplications']);router[_0x23a3('0xb')](_0x23a3('0xc'),auth[_0x23a3('0x8')](),controller[_0x23a3('0xd')]);router[_0x23a3('0xe')](_0x23a3('0xc'),auth[_0x23a3('0x8')](),controller[_0x23a3('0xf')]);module[_0x23a3('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 830fd15..808f936 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 _0xa054=['exports','STRING','compositeIndex','ENUM','inbound-fax','outbound-fax','system','any','BOOLEAN','INTEGER','VIRTUAL','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa054,0x167));var _0x4a05=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0xa054[_0x187d80];return _0x498a77;};'use strict';var Sequelize=require(_0x4a05('0x0'));module[_0x4a05('0x1')]={'context':{'type':Sequelize[_0x4a05('0x2')],'allowNull':![],'unique':_0x4a05('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4a05('0x2')],'allowNull':![],'unique':_0x4a05('0x3')},'priority':{'type':Sequelize[_0x4a05('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x4a05('0x3')},'tag':{'type':Sequelize[_0x4a05('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4a05('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x4a05('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4a05('0x4')]('inbound','outbound','internal',_0x4a05('0x5'),_0x4a05('0x6'),_0x4a05('0x7'),_0x4a05('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x4a05('0x2')]},'interval':{'type':Sequelize[_0x4a05('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4a05('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x4a05('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4a05('0xa')]},'recordingFormat':{'type':Sequelize[_0x4a05('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x4a05('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4a05('0xb')],'get':function(_0x48dbe2){return this['getDataValue']('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xeaf3=['sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten'];(function(_0x403ff8,_0x459e58){var _0xfdee81=function(_0x2f65f8){while(--_0x2f65f8){_0x403ff8['push'](_0x403ff8['shift']());}};_0xfdee81(++_0x459e58);}(_0xeaf3,0x17a));var _0x3eaf=function(_0xf51f07,_0x56eb8d){_0xf51f07=_0xf51f07-0x0;var _0x41748a=_0xeaf3[_0xf51f07];return _0x41748a;};'use strict';var Sequelize=require(_0x3eaf('0x0'));module[_0x3eaf('0x1')]={'context':{'type':Sequelize[_0x3eaf('0x2')],'allowNull':![],'unique':_0x3eaf('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3eaf('0x2')],'allowNull':![],'unique':_0x3eaf('0x3')},'priority':{'type':Sequelize[_0x3eaf('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3eaf('0x2')],'allowNull':![],'defaultValue':_0x3eaf('0x4')},'appdata':{'type':Sequelize[_0x3eaf('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3eaf('0x5')]('inbound',_0x3eaf('0x6'),_0x3eaf('0x7'),'inbound-fax',_0x3eaf('0x8'),_0x3eaf('0x9'),_0x3eaf('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3eaf('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3eaf('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x3eaf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3eaf('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x3eaf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3eaf('0xd')]},'recordingFormat':{'type':Sequelize[_0x3eaf('0x2')],'defaultValue':_0x3eaf('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x3eaf('0xf')],'get':function(_0x1fe0c0){return this[_0x3eaf('0x10')](_0x3eaf('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 9661521..8f2e759 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 _0xd310=['recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','InternalRoutes','internal','ignore','value','includes','type','find','name','UserProfileResource','then','end','error','stack','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','sort','pick','filter','where','merge','options','VoiceExtension','includeAll','include','rows','catch','params','fields','length','create','body','startsWith','exten','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description'];(function(_0x21a913,_0x54bc66){var _0x4b5ae4=function(_0x51c6f1){while(--_0x51c6f1){_0x21a913['push'](_0x21a913['shift']());}};_0x4b5ae4(++_0x54bc66);}(_0xd310,0xbf));var _0x0d31=function(_0x4160f3,_0x511990){_0x4160f3=_0x4160f3-0x0;var _0x5f4f44=_0xd310[_0x4160f3];return _0x5f4f44;};'use strict';var _=require('lodash');var Redis=require(_0x0d31('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0d31('0x1'));var config=require('../../config/environment');var db=require(_0x0d31('0x2'))['db'];config[_0x0d31('0x3')]=_[_0x0d31('0x4')](config[_0x0d31('0x3')],{'host':_0x0d31('0x5'),'port':0x18eb});var socket=require(_0x0d31('0x6'))(new Redis(config['redis']));require(_0x0d31('0x7'))[_0x0d31('0x8')](socket);function respondWithStatusCode(_0x394602,_0xd3e17){_0xd3e17=_0xd3e17||0xcc;return function(_0x5a1152){if(_0x5a1152){return _0x394602[_0x0d31('0x9')](_0xd3e17);}return _0x394602['status'](_0xd3e17)['end']();};}function respondWithResult(_0x168f11,_0x2f51ee){_0x2f51ee=_0x2f51ee||0xc8;return function(_0xd41130){if(_0xd41130){return _0x168f11[_0x0d31('0xa')](_0x2f51ee)[_0x0d31('0xb')](_0xd41130);}};}function respondWithFilteredResult(_0xd79c3b,_0x3acf7e){return function(_0x4a375){if(_0x4a375){var _0x2c975a=typeof _0x3acf7e[_0x0d31('0xc')]===_0x0d31('0xd')&&typeof _0x3acf7e[_0x0d31('0xe')]===_0x0d31('0xd');var _0x5473b9=_0x4a375[_0x0d31('0xf')];var _0x13cdaf=_0x2c975a?0x0:_0x3acf7e[_0x0d31('0xc')];var _0x2e078d=_0x2c975a?_0x4a375['count']:_0x3acf7e['offset']+_0x3acf7e[_0x0d31('0xe')];var _0x1270ac;if(_0x2e078d>=_0x5473b9){_0x2e078d=_0x5473b9;_0x1270ac=0xc8;}else{_0x1270ac=0xce;}_0xd79c3b[_0x0d31('0xa')](_0x1270ac);return _0xd79c3b[_0x0d31('0x10')](_0x0d31('0x11'),_0x13cdaf+'-'+_0x2e078d+'/'+_0x5473b9)[_0x0d31('0xb')](_0x4a375);}return null;};}function removeEntity(_0x338a91){return function(_0x1f1184){if(_0x1f1184){return _0x1f1184[_0x0d31('0x12')]()['then'](function(){var _0x4b08b0=_0x1f1184[_0x0d31('0x13')]({'plain':!![]});var _0xa6a70c=[{'name':_0x0d31('0x14'),'value':'inbound','ignore':![]},{'name':_0x0d31('0x15'),'value':'outbound','ignore':![]},{'name':_0x0d31('0x16'),'value':_0x0d31('0x17'),'ignore':![]}];var _0x1f08f7=_(_0xa6a70c)['filter'](_0x0d31('0x18'))['map'](_0x0d31('0x19'))['value']();if(_[_0x0d31('0x1a')](_0x1f08f7,_0x4b08b0[_0x0d31('0x1b')])){return;}var _0x69a32b=_[_0x0d31('0x1c')](_0xa6a70c,[_0x0d31('0x19'),_0x4b08b0[_0x0d31('0x1b')]])[_0x0d31('0x1d')];return db[_0x0d31('0x1e')]['destroy']({'where':{'type':_0x69a32b,'resourceId':_0x4b08b0['id']}})[_0x0d31('0x1f')](function(){return _0x1f1184;});})[_0x0d31('0x1f')](function(){_0x338a91[_0x0d31('0xa')](0xcc)[_0x0d31('0x20')]();});}};}function handleEntityNotFound(_0xf3f22d){return function(_0x44b81e){if(!_0x44b81e){_0xf3f22d[_0x0d31('0x9')](0x194);}return _0x44b81e;};}function handleError(_0x51c56a,_0x85200b){_0x85200b=_0x85200b||0x1f4;return function(_0x2bb46d){logger[_0x0d31('0x21')](_0x2bb46d[_0x0d31('0x22')]);if(_0x2bb46d[_0x0d31('0x1d')]){delete _0x2bb46d[_0x0d31('0x1d')];}_0x51c56a[_0x0d31('0xa')](_0x85200b)[_0x0d31('0x23')](_0x2bb46d);};}exports[_0x0d31('0x24')]=function(_0x17929c,_0xcc5b5){var _0x26c48d={},_0x510f2b={},_0x1dd958={'count':0x0,'rows':[]};var _0x4a3e19=_['map'](db['VoiceExtension'][_0x0d31('0x25')],function(_0x3e88d8){return{'name':_0x3e88d8[_0x0d31('0x26')],'type':_0x3e88d8[_0x0d31('0x1b')]['key']};});_0x510f2b[_0x0d31('0x27')]=_[_0x0d31('0x28')](_0x4a3e19,_0x0d31('0x1d'));_0x510f2b[_0x0d31('0x29')]=_[_0x0d31('0x2a')](_0x17929c[_0x0d31('0x29')]);_0x510f2b[_0x0d31('0x2b')]=_[_0x0d31('0x2c')](_0x510f2b[_0x0d31('0x27')],_0x510f2b['query']);_0x26c48d['attributes']=_['intersection'](_0x510f2b[_0x0d31('0x27')],qs['fields'](_0x17929c[_0x0d31('0x29')]['fields']));_0x26c48d[_0x0d31('0x2d')]=_0x26c48d['attributes']['length']?_0x26c48d[_0x0d31('0x2d')]:_0x510f2b[_0x0d31('0x27')];if(!_0x17929c[_0x0d31('0x29')][_0x0d31('0x2e')]('nolimit')){_0x26c48d['limit']=qs[_0x0d31('0xe')](_0x17929c[_0x0d31('0x29')][_0x0d31('0xe')]);_0x26c48d[_0x0d31('0xc')]=qs[_0x0d31('0xc')](_0x17929c['query'][_0x0d31('0xc')]);}_0x26c48d['order']=qs['sort'](_0x17929c[_0x0d31('0x29')][_0x0d31('0x2f')]);_0x26c48d['where']=qs[_0x0d31('0x2b')](_[_0x0d31('0x30')](_0x17929c[_0x0d31('0x29')],_0x510f2b[_0x0d31('0x2b')]),_0x4a3e19);if(_0x17929c[_0x0d31('0x29')][_0x0d31('0x31')]){_0x26c48d[_0x0d31('0x32')]=_[_0x0d31('0x33')](_0x26c48d[_0x0d31('0x32')],{'$or':_[_0x0d31('0x28')](_0x4a3e19,function(_0x58f3dc){if(_0x58f3dc[_0x0d31('0x1b')]!=='VIRTUAL'){var _0x2dee4a={};_0x2dee4a[_0x58f3dc['name']]={'$like':'%'+_0x17929c['query'][_0x0d31('0x31')]+'%'};return _0x2dee4a;}})});}_0x26c48d=_['merge']({},_0x26c48d,_0x17929c[_0x0d31('0x34')]);var _0x1d9c03={'where':_0x26c48d[_0x0d31('0x32')]};return db[_0x0d31('0x35')][_0x0d31('0xf')](_0x1d9c03)['then'](function(_0x3817f5){_0x1dd958[_0x0d31('0xf')]=_0x3817f5;if(_0x17929c['query'][_0x0d31('0x36')]){_0x26c48d[_0x0d31('0x37')]=[{'all':!![]}];}return db[_0x0d31('0x35')]['findAll'](_0x26c48d);})[_0x0d31('0x1f')](function(_0x4d2ab4){_0x1dd958[_0x0d31('0x38')]=_0x4d2ab4;return _0x1dd958;})[_0x0d31('0x1f')](respondWithFilteredResult(_0xcc5b5,_0x26c48d))[_0x0d31('0x39')](handleError(_0xcc5b5,null));};exports['show']=function(_0x2334f5,_0x6773d){var _0x100b5d={'raw':![],'where':{'id':_0x2334f5[_0x0d31('0x3a')]['id']}},_0x3dfa85={};_0x3dfa85[_0x0d31('0x27')]=_[_0x0d31('0x2a')](db[_0x0d31('0x35')][_0x0d31('0x25')]);_0x3dfa85[_0x0d31('0x29')]=_[_0x0d31('0x2a')](_0x2334f5[_0x0d31('0x29')]);_0x3dfa85[_0x0d31('0x2b')]=_[_0x0d31('0x2c')](_0x3dfa85[_0x0d31('0x27')],_0x3dfa85[_0x0d31('0x29')]);_0x100b5d[_0x0d31('0x2d')]=_[_0x0d31('0x2c')](_0x3dfa85[_0x0d31('0x27')],qs[_0x0d31('0x3b')](_0x2334f5[_0x0d31('0x29')][_0x0d31('0x3b')]));_0x100b5d['attributes']=_0x100b5d[_0x0d31('0x2d')][_0x0d31('0x3c')]?_0x100b5d['attributes']:_0x3dfa85['model'];if(_0x2334f5[_0x0d31('0x29')][_0x0d31('0x36')]){_0x100b5d[_0x0d31('0x37')]=[{'all':!![]}];}_0x100b5d=_[_0x0d31('0x33')]({},_0x100b5d,_0x2334f5['options']);return db[_0x0d31('0x35')][_0x0d31('0x1c')](_0x100b5d)[_0x0d31('0x1f')](handleEntityNotFound(_0x6773d,null))[_0x0d31('0x1f')](respondWithResult(_0x6773d,null))[_0x0d31('0x39')](handleError(_0x6773d,null));};exports[_0x0d31('0x12')]=function(_0x38d806,_0x140628){return db[_0x0d31('0x35')][_0x0d31('0x1c')]({'where':{'id':_0x38d806[_0x0d31('0x3a')]['id']}})[_0x0d31('0x1f')](handleEntityNotFound(_0x140628,null))[_0x0d31('0x1f')](removeEntity(_0x140628,null))[_0x0d31('0x39')](handleError(_0x140628,null));};exports[_0x0d31('0x3d')]=function(_0x1cdcf1,_0x20d33b){if(_0x1cdcf1[_0x0d31('0x3e')]['type']==='outbound'&&!_[_0x0d31('0x3f')](_0x1cdcf1[_0x0d31('0x3e')][_0x0d31('0x40')],'_')){_0x1cdcf1[_0x0d31('0x3e')][_0x0d31('0x40')]='_'['concat'](_0x1cdcf1['body'][_0x0d31('0x40')]);}return db[_0x0d31('0x35')][_0x0d31('0x3d')](_0x1cdcf1[_0x0d31('0x3e')],{'raw':![]})['then'](function(_0x49ac49){var _0x3909a9=_0x1cdcf1['user'][_0x0d31('0x13')]({'plain':!![]});if(!_0x3909a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3909a9[_0x0d31('0x41')]===_0x0d31('0x42')){var _0x214a89=_0x49ac49[_0x0d31('0x13')]({'plain':!![]});var _0x4b26f0=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x0d31('0x16'),'value':_0x0d31('0x17')}];var _0x47633b=_[_0x0d31('0x1c')](_0x4b26f0,['value',_0x214a89[_0x0d31('0x1b')]])[_0x0d31('0x1d')];return db['UserProfileSection'][_0x0d31('0x1c')]({'where':{'name':_0x47633b,'userProfileId':_0x3909a9[_0x0d31('0x43')]},'raw':!![]})['then'](function(_0x55732e){if(_0x55732e&&_0x55732e[_0x0d31('0x44')]===0x0){return db[_0x0d31('0x1e')]['create']({'name':_0x214a89[_0x0d31('0x1d')],'resourceId':_0x214a89['id'],'type':_0x55732e[_0x0d31('0x1d')],'sectionId':_0x55732e['id']},{})['then'](function(){return _0x49ac49;});}else{return _0x49ac49;}})[_0x0d31('0x39')](function(_0x436cf6){logger[_0x0d31('0x21')](_0x0d31('0x45'),_0x436cf6);throw _0x436cf6;});}return _0x49ac49;})['then'](respondWithResult(_0x20d33b,0xc9))[_0x0d31('0x39')](handleError(_0x20d33b,null));};exports[_0x0d31('0x46')]=function(_0x420c27,_0x24150c){if(_0x420c27[_0x0d31('0x3e')]['id']){delete _0x420c27[_0x0d31('0x3e')]['id'];}return db[_0x0d31('0x35')][_0x0d31('0x1c')]({'where':{'id':_0x420c27[_0x0d31('0x3a')]['id']}})[_0x0d31('0x1f')](handleEntityNotFound(_0x24150c,null))[_0x0d31('0x1f')](function(_0x19f546){if(_0x19f546){return db[_0x0d31('0x35')][_0x0d31('0x46')](_[_0x0d31('0x30')](_0x420c27[_0x0d31('0x3e')],[_0x0d31('0x40'),_0x0d31('0x47'),_0x0d31('0x48'),_0x0d31('0x49'),_0x0d31('0x4a'),_0x0d31('0x4b'),_0x0d31('0x4c')]),{'where':{'context':_0x19f546[_0x0d31('0x47')],'exten':_0x19f546[_0x0d31('0x40')]},'individualHooks':!![]})[_0x0d31('0x1f')](function(_0x37168e){return _0x37168e;});}return null;})[_0x0d31('0x1f')](respondWithStatusCode(_0x24150c,null))[_0x0d31('0x39')](handleError(_0x24150c,null));};exports['addApplications']=function(_0x27df4a,_0x51f605){var _0x368fa6=_0x27df4a[_0x0d31('0x3a')]['id'];var _0x2f8718=_0x27df4a['body'];var _0x1f6850=0xc8;var _0x2f2eb5=null;return db[_0x0d31('0x4d')][_0x0d31('0x4e')]({'isolationLevel':db[_0x0d31('0x4d')]['Transaction'][_0x0d31('0x4f')][_0x0d31('0x50')]},function(_0x10c4b2){return db[_0x0d31('0x35')]['findOne']({'where':{'id':_0x368fa6},'transaction':_0x10c4b2})['then'](function(_0x4b094f){if(_0x4b094f){return db[_0x0d31('0x35')]['destroy']({'where':{'VoiceExtensionId':_0x368fa6},'transaction':_0x10c4b2})['then'](function(){var _0x4306a8=_['map'](_0x2f8718,function(_0xa3da0c){_0xa3da0c[_0x0d31('0x51')]=_0x368fa6;_0xa3da0c[_0x0d31('0x52')]=!![];return _0xa3da0c;});return _0x4b094f[_0x0d31('0x53')](_0x4306a8);})[_0x0d31('0x1f')](function(_0x2701af){return db[_0x0d31('0x35')][_0x0d31('0x54')](_0x2701af,{'transaction':_0x10c4b2});});}else{_0x1f6850=0x194;_0x2f2eb5=[];}});})['then'](function(){if(_0x1f6850!==0x194){return db['VoiceExtension'][_0x0d31('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x368fa6},'order':_0x0d31('0x56')})[_0x0d31('0x1f')](function(_0x473619){_0x2f2eb5=_0x473619;});}})[_0x0d31('0x39')](function(_0x49c63b){_0x1f6850=0x1f4;logger[_0x0d31('0x21')](_0x49c63b[_0x0d31('0x22')]);if(_0x49c63b[_0x0d31('0x1d')]){delete _0x49c63b[_0x0d31('0x1d')];}_0x2f2eb5=_0x49c63b;})[_0x0d31('0x57')](function(){if(_0x2f2eb5===null){_0x51f605[_0x0d31('0x9')](_0x1f6850);}else{if(_0x1f6850===0x1f4){_0x51f605['status'](_0x1f6850)[_0x0d31('0x23')](_0x2f2eb5);}else{_0x51f605['status'](_0x1f6850)[_0x0d31('0xb')](_0x2f2eb5);}}});}; \ No newline at end of file +var _0x4b58=['OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','includes','type','find','value','name','UserProfileResource','stack','send','index','VoiceExtension','fieldName','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','create','body','startsWith','exten','concat','role','user','inbound','internal','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','destroy','then','get','InboundRoutes'];(function(_0x14571a,_0x2622b9){var _0x275d7=function(_0x4de168){while(--_0x4de168){_0x14571a['push'](_0x14571a['shift']());}};_0x275d7(++_0x2622b9);}(_0x4b58,0xfb));var _0x84b5=function(_0x539491,_0x4db64d){_0x539491=_0x539491-0x0;var _0x38551f=_0x4b58[_0x539491];return _0x38551f;};'use strict';var _=require(_0x84b5('0x0'));var Redis=require(_0x84b5('0x1'));var qs=require(_0x84b5('0x2'));var logger=require(_0x84b5('0x3'))('api');var config=require(_0x84b5('0x4'));var db=require(_0x84b5('0x5'))['db'];config[_0x84b5('0x6')]=_[_0x84b5('0x7')](config[_0x84b5('0x6')],{'host':_0x84b5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84b5('0x6')]));require(_0x84b5('0x9'))[_0x84b5('0xa')](socket);function respondWithStatusCode(_0x25e77c,_0x32d3b5){_0x32d3b5=_0x32d3b5||0xcc;return function(_0x53a5a4){if(_0x53a5a4){return _0x25e77c[_0x84b5('0xb')](_0x32d3b5);}return _0x25e77c[_0x84b5('0xc')](_0x32d3b5)[_0x84b5('0xd')]();};}function respondWithResult(_0x4540e8,_0x1fe1bf){_0x1fe1bf=_0x1fe1bf||0xc8;return function(_0x59cf72){if(_0x59cf72){return _0x4540e8[_0x84b5('0xc')](_0x1fe1bf)['json'](_0x59cf72);}};}function respondWithFilteredResult(_0x2754db,_0x13f66b){return function(_0x2eec25){if(_0x2eec25){var _0x224c76=typeof _0x13f66b['offset']===_0x84b5('0xe')&&typeof _0x13f66b[_0x84b5('0xf')]===_0x84b5('0xe');var _0x58d861=_0x2eec25['count'];var _0x5f32e3=_0x224c76?0x0:_0x13f66b[_0x84b5('0x10')];var _0x597d4d=_0x224c76?_0x2eec25[_0x84b5('0x11')]:_0x13f66b['offset']+_0x13f66b[_0x84b5('0xf')];var _0x5dba03;if(_0x597d4d>=_0x58d861){_0x597d4d=_0x58d861;_0x5dba03=0xc8;}else{_0x5dba03=0xce;}_0x2754db['status'](_0x5dba03);return _0x2754db[_0x84b5('0x12')](_0x84b5('0x13'),_0x5f32e3+'-'+_0x597d4d+'/'+_0x58d861)[_0x84b5('0x14')](_0x2eec25);}return null;};}function removeEntity(_0x3203a6){return function(_0x46a4ac){if(_0x46a4ac){return _0x46a4ac[_0x84b5('0x15')]()[_0x84b5('0x16')](function(){var _0x385ae3=_0x46a4ac[_0x84b5('0x17')]({'plain':!![]});var _0x4d1752=[{'name':_0x84b5('0x18'),'value':'inbound','ignore':![]},{'name':_0x84b5('0x19'),'value':_0x84b5('0x1a'),'ignore':![]},{'name':_0x84b5('0x1b'),'value':'internal','ignore':![]}];var _0x105187=_(_0x4d1752)[_0x84b5('0x1c')](_0x84b5('0x1d'))[_0x84b5('0x1e')]('value')['value']();if(_[_0x84b5('0x1f')](_0x105187,_0x385ae3[_0x84b5('0x20')])){return;}var _0x2af5e1=_[_0x84b5('0x21')](_0x4d1752,[_0x84b5('0x22'),_0x385ae3[_0x84b5('0x20')]])[_0x84b5('0x23')];return db[_0x84b5('0x24')][_0x84b5('0x15')]({'where':{'type':_0x2af5e1,'resourceId':_0x385ae3['id']}})[_0x84b5('0x16')](function(){return _0x46a4ac;});})['then'](function(){_0x3203a6[_0x84b5('0xc')](0xcc)[_0x84b5('0xd')]();});}};}function handleEntityNotFound(_0x2f7321){return function(_0x599bd9){if(!_0x599bd9){_0x2f7321[_0x84b5('0xb')](0x194);}return _0x599bd9;};}function handleError(_0x54d1b4,_0x352203){_0x352203=_0x352203||0x1f4;return function(_0x1ec59f){logger['error'](_0x1ec59f[_0x84b5('0x25')]);if(_0x1ec59f['name']){delete _0x1ec59f[_0x84b5('0x23')];}_0x54d1b4[_0x84b5('0xc')](_0x352203)[_0x84b5('0x26')](_0x1ec59f);};}exports[_0x84b5('0x27')]=function(_0x344246,_0xb63088){var _0x118d6b={},_0x5bb090={},_0x2118dc={'count':0x0,'rows':[]};var _0x59bff9=_[_0x84b5('0x1e')](db[_0x84b5('0x28')]['rawAttributes'],function(_0x220867){return{'name':_0x220867[_0x84b5('0x29')],'type':_0x220867['type'][_0x84b5('0x2a')]};});_0x5bb090['model']=_[_0x84b5('0x1e')](_0x59bff9,_0x84b5('0x23'));_0x5bb090[_0x84b5('0x2b')]=_['keys'](_0x344246[_0x84b5('0x2b')]);_0x5bb090[_0x84b5('0x2c')]=_['intersection'](_0x5bb090['model'],_0x5bb090[_0x84b5('0x2b')]);_0x118d6b[_0x84b5('0x2d')]=_['intersection'](_0x5bb090[_0x84b5('0x2e')],qs[_0x84b5('0x2f')](_0x344246[_0x84b5('0x2b')][_0x84b5('0x2f')]));_0x118d6b['attributes']=_0x118d6b['attributes'][_0x84b5('0x30')]?_0x118d6b[_0x84b5('0x2d')]:_0x5bb090[_0x84b5('0x2e')];if(!_0x344246[_0x84b5('0x2b')][_0x84b5('0x31')](_0x84b5('0x32'))){_0x118d6b[_0x84b5('0xf')]=qs[_0x84b5('0xf')](_0x344246[_0x84b5('0x2b')][_0x84b5('0xf')]);_0x118d6b[_0x84b5('0x10')]=qs[_0x84b5('0x10')](_0x344246[_0x84b5('0x2b')][_0x84b5('0x10')]);}_0x118d6b['order']=qs['sort'](_0x344246['query']['sort']);_0x118d6b[_0x84b5('0x33')]=qs[_0x84b5('0x2c')](_[_0x84b5('0x34')](_0x344246[_0x84b5('0x2b')],_0x5bb090[_0x84b5('0x2c')]),_0x59bff9);if(_0x344246['query'][_0x84b5('0x1c')]){_0x118d6b['where']=_['merge'](_0x118d6b[_0x84b5('0x33')],{'$or':_['map'](_0x59bff9,function(_0x10c710){if(_0x10c710[_0x84b5('0x20')]!=='VIRTUAL'){var _0x506773={};_0x506773[_0x10c710[_0x84b5('0x23')]]={'$like':'%'+_0x344246[_0x84b5('0x2b')][_0x84b5('0x1c')]+'%'};return _0x506773;}})});}_0x118d6b=_[_0x84b5('0x35')]({},_0x118d6b,_0x344246['options']);var _0x3be3cd={'where':_0x118d6b[_0x84b5('0x33')]};return db[_0x84b5('0x28')]['count'](_0x3be3cd)[_0x84b5('0x16')](function(_0x3457de){_0x2118dc[_0x84b5('0x11')]=_0x3457de;if(_0x344246['query'][_0x84b5('0x36')]){_0x118d6b[_0x84b5('0x37')]=[{'all':!![]}];}return db[_0x84b5('0x28')][_0x84b5('0x38')](_0x118d6b);})['then'](function(_0xa67258){_0x2118dc[_0x84b5('0x39')]=_0xa67258;return _0x2118dc;})[_0x84b5('0x16')](respondWithFilteredResult(_0xb63088,_0x118d6b))[_0x84b5('0x3a')](handleError(_0xb63088,null));};exports[_0x84b5('0x3b')]=function(_0x6c00d4,_0x24ea60){var _0x5637db={'raw':![],'where':{'id':_0x6c00d4[_0x84b5('0x3c')]['id']}},_0x48c265={};_0x48c265['model']=_[_0x84b5('0x3d')](db[_0x84b5('0x28')]['rawAttributes']);_0x48c265['query']=_['keys'](_0x6c00d4[_0x84b5('0x2b')]);_0x48c265[_0x84b5('0x2c')]=_[_0x84b5('0x3e')](_0x48c265[_0x84b5('0x2e')],_0x48c265[_0x84b5('0x2b')]);_0x5637db[_0x84b5('0x2d')]=_[_0x84b5('0x3e')](_0x48c265[_0x84b5('0x2e')],qs[_0x84b5('0x2f')](_0x6c00d4[_0x84b5('0x2b')][_0x84b5('0x2f')]));_0x5637db[_0x84b5('0x2d')]=_0x5637db['attributes']['length']?_0x5637db[_0x84b5('0x2d')]:_0x48c265[_0x84b5('0x2e')];if(_0x6c00d4[_0x84b5('0x2b')]['includeAll']){_0x5637db[_0x84b5('0x37')]=[{'all':!![]}];}_0x5637db=_['merge']({},_0x5637db,_0x6c00d4[_0x84b5('0x3f')]);return db[_0x84b5('0x28')][_0x84b5('0x21')](_0x5637db)[_0x84b5('0x16')](handleEntityNotFound(_0x24ea60,null))[_0x84b5('0x16')](respondWithResult(_0x24ea60,null))[_0x84b5('0x3a')](handleError(_0x24ea60,null));};exports[_0x84b5('0x15')]=function(_0xa83d5b,_0x3a207e){return db['VoiceExtension']['find']({'where':{'id':_0xa83d5b[_0x84b5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3a207e,null))['then'](removeEntity(_0x3a207e,null))['catch'](handleError(_0x3a207e,null));};exports[_0x84b5('0x40')]=function(_0x1ed8e6,_0x41cfb1){if(_0x1ed8e6[_0x84b5('0x41')][_0x84b5('0x20')]===_0x84b5('0x1a')&&!_[_0x84b5('0x42')](_0x1ed8e6[_0x84b5('0x41')][_0x84b5('0x43')],'_')){_0x1ed8e6['body'][_0x84b5('0x43')]='_'[_0x84b5('0x44')](_0x1ed8e6[_0x84b5('0x41')][_0x84b5('0x43')]);}return db[_0x84b5('0x28')][_0x84b5('0x40')](_0x1ed8e6[_0x84b5('0x41')],{'raw':![]})[_0x84b5('0x16')](function(_0xc09c7a){var _0x11ebda=_0x1ed8e6['user']['get']({'plain':!![]});if(!_0x11ebda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11ebda[_0x84b5('0x45')]===_0x84b5('0x46')){var _0x2f8726=_0xc09c7a['get']({'plain':!![]});var _0x24e1fd=[{'name':_0x84b5('0x18'),'value':_0x84b5('0x47')},{'name':'OutboundRoutes','value':_0x84b5('0x1a')},{'name':_0x84b5('0x1b'),'value':_0x84b5('0x48')}];var _0x82f532=_[_0x84b5('0x21')](_0x24e1fd,['value',_0x2f8726['type']])[_0x84b5('0x23')];return db['UserProfileSection'][_0x84b5('0x21')]({'where':{'name':_0x82f532,'userProfileId':_0x11ebda[_0x84b5('0x49')]},'raw':!![]})[_0x84b5('0x16')](function(_0x1082be){if(_0x1082be&&_0x1082be[_0x84b5('0x4a')]===0x0){return db['UserProfileResource'][_0x84b5('0x40')]({'name':_0x2f8726[_0x84b5('0x23')],'resourceId':_0x2f8726['id'],'type':_0x1082be[_0x84b5('0x23')],'sectionId':_0x1082be['id']},{})['then'](function(){return _0xc09c7a;});}else{return _0xc09c7a;}})['catch'](function(_0x1f3f1a){logger[_0x84b5('0x4b')](_0x84b5('0x4c'),_0x1f3f1a);throw _0x1f3f1a;});}return _0xc09c7a;})[_0x84b5('0x16')](respondWithResult(_0x41cfb1,0xc9))[_0x84b5('0x3a')](handleError(_0x41cfb1,null));};exports['update']=function(_0x5de2dd,_0x5df908){if(_0x5de2dd[_0x84b5('0x41')]['id']){delete _0x5de2dd[_0x84b5('0x41')]['id'];}return db[_0x84b5('0x28')][_0x84b5('0x21')]({'where':{'id':_0x5de2dd[_0x84b5('0x3c')]['id']}})[_0x84b5('0x16')](handleEntityNotFound(_0x5df908,null))[_0x84b5('0x16')](function(_0x26b233){if(_0x26b233){return db['VoiceExtension'][_0x84b5('0x4d')](_[_0x84b5('0x34')](_0x5de2dd[_0x84b5('0x41')],['exten','context','description','recordingFormat',_0x84b5('0x4e'),_0x84b5('0x4f'),_0x84b5('0x50')]),{'where':{'context':_0x26b233[_0x84b5('0x51')],'exten':_0x26b233[_0x84b5('0x43')]},'individualHooks':!![]})[_0x84b5('0x16')](function(_0x14d0db){return _0x14d0db;});}return null;})[_0x84b5('0x16')](respondWithStatusCode(_0x5df908,null))[_0x84b5('0x3a')](handleError(_0x5df908,null));};exports['addApplications']=function(_0x17cafd,_0x5921d3){var _0x1aa873=_0x17cafd[_0x84b5('0x3c')]['id'];var _0xdeb6be=_0x17cafd[_0x84b5('0x41')];var _0xeb42ee=0xc8;var _0x3572f4=null;return db[_0x84b5('0x52')][_0x84b5('0x53')]({'isolationLevel':db['sequelize'][_0x84b5('0x54')][_0x84b5('0x55')][_0x84b5('0x56')]},function(_0x4faa7b){return db['VoiceExtension'][_0x84b5('0x57')]({'where':{'id':_0x1aa873},'transaction':_0x4faa7b})[_0x84b5('0x16')](function(_0x197dfd){if(_0x197dfd){return db[_0x84b5('0x28')][_0x84b5('0x15')]({'where':{'VoiceExtensionId':_0x1aa873},'transaction':_0x4faa7b})[_0x84b5('0x16')](function(){var _0x175cd6=_[_0x84b5('0x1e')](_0xdeb6be,function(_0x2f3ceb){_0x2f3ceb['VoiceExtensionId']=_0x1aa873;_0x2f3ceb[_0x84b5('0x58')]=!![];return _0x2f3ceb;});return _0x197dfd[_0x84b5('0x59')](_0x175cd6);})['then'](function(_0x15be35){return db['VoiceExtension'][_0x84b5('0x5a')](_0x15be35,{'transaction':_0x4faa7b});});}else{_0xeb42ee=0x194;_0x3572f4=[];}});})[_0x84b5('0x16')](function(){if(_0xeb42ee!==0x194){return db['VoiceExtension'][_0x84b5('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1aa873},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x3e340b){_0x3572f4=_0x3e340b;});}})[_0x84b5('0x3a')](function(_0x427e10){_0xeb42ee=0x1f4;logger[_0x84b5('0x4b')](_0x427e10['stack']);if(_0x427e10['name']){delete _0x427e10[_0x84b5('0x23')];}_0x3572f4=_0x427e10;})['finally'](function(){if(_0x3572f4===null){_0x5921d3[_0x84b5('0xb')](_0xeb42ee);}else{if(_0xeb42ee===0x1f4){_0x5921d3[_0x84b5('0xc')](_0xeb42ee)[_0x84b5('0x26')](_0x3572f4);}else{_0x5921d3[_0x84b5('0xc')](_0xeb42ee)['json'](_0x3572f4);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e8025b9..7a88c44 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 _0xbff0=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3e4624,_0x26a97f){var _0x1b56a9=function(_0x164808){while(--_0x164808){_0x3e4624['push'](_0x3e4624['shift']());}};_0x1b56a9(++_0x26a97f);}(_0xbff0,0xd9));var _0x0bff=function(_0x570c6c,_0x36de74){_0x570c6c=_0x570c6c-0x0;var _0x2d13e8=_0xbff0[_0x570c6c];return _0x2d13e8;};'use strict';var EventEmitter=require(_0x0bff('0x0'));var VoiceExtension=require(_0x0bff('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0bff('0x2')](0x0);var events={'afterCreate':_0x0bff('0x3'),'afterUpdate':_0x0bff('0x4'),'afterDestroy':_0x0bff('0x5')};function emitEvent(_0x5c2589){return function(_0xddee87,_0x399fb3,_0x3207f7){VoiceExtensionEvents['emit'](_0x5c2589+':'+_0xddee87['id'],_0xddee87);VoiceExtensionEvents[_0x0bff('0x6')](_0x5c2589,_0xddee87);_0x3207f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x0bff('0x7')](e,emitEvent(event));}}module[_0x0bff('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x4b01=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2195dc,_0x41bf5e){var _0x4a3db2=function(_0x1dbb05){while(--_0x1dbb05){_0x2195dc['push'](_0x2195dc['shift']());}};_0x4a3db2(++_0x41bf5e);}(_0x4b01,0x18a));var _0x14b0=function(_0x2132e6,_0x31fdd2){_0x2132e6=_0x2132e6-0x0;var _0x24ad7c=_0x4b01[_0x2132e6];return _0x24ad7c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x14b0('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x14b0('0x1')](0x0);var events={'afterCreate':_0x14b0('0x2'),'afterUpdate':_0x14b0('0x3'),'afterDestroy':_0x14b0('0x4')};function emitEvent(_0x22e5af){return function(_0x466a21,_0x48ccd4,_0x3fede8){VoiceExtensionEvents[_0x14b0('0x5')](_0x22e5af+':'+_0x466a21['id'],_0x466a21);VoiceExtensionEvents['emit'](_0x22e5af,_0x466a21);_0x3fede8(null);};}for(var e in events){if(events[_0x14b0('0x6')](e)){var event=events[e];VoiceExtension[_0x14b0('0x7')](e,emitEvent(event));}}module[_0x14b0('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d9dba2f..8d1fc1c 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 _0x6753=['models','type','context','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','${EXTEN:','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','length','name','trunk','param','prefix','phone','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6753,0xa1));var _0x3675=function(_0x59e039,_0xc0dcb9){_0x59e039=_0x59e039-0x0;var _0x3b37fe=_0x6753[_0x59e039];return _0x3b37fe;};'use strict';var _=require(_0x3675('0x0'));var attributes=require(_0x3675('0x1'));module[_0x3675('0x2')]=function(_0x2835a4){var _0x485956=_0x2835a4[_0x3675('0x3')];function _0x461046(_0x5966cb){var _0x2c892a=0x2;var _0x2b2c83=[{'type':_0x5966cb['type'],'app':'Set','appdata':'CDR(type)='+_0x5966cb[_0x3675('0x4')],'context':_0x5966cb[_0x3675('0x5')],'exten':_0x5966cb[_0x3675('0x6')],'priority':_0x2c892a++,'VoiceExtensionId':_0x5966cb['id']},{'type':_0x5966cb[_0x3675('0x4')],'app':_0x5966cb[_0x3675('0x7')]?_0x3675('0x8'):_0x3675('0x9'),'appdata':_0x5966cb[_0x3675('0x7')]?_0x3675('0xa')+_0x5966cb[_0x3675('0x7')]:_0x3675('0xb'),'context':_0x5966cb[_0x3675('0x5')],'exten':_0x5966cb[_0x3675('0x6')],'priority':_0x2c892a++,'VoiceExtensionId':_0x5966cb['id']}];if(_0x5966cb[_0x3675('0x4')]==='inbound'){_0x2b2c83[_0x3675('0xc')]({'type':_0x3675('0xd'),'app':'Set','appdata':_0x3675('0xe')+_0x5966cb['id'],'context':_0x5966cb[_0x3675('0x5')],'exten':_0x5966cb[_0x3675('0x6')],'priority':_0x2c892a++,'VoiceExtensionId':_0x5966cb['id']});}_0x2b2c83[_0x3675('0xc')]({'type':_0x5966cb[_0x3675('0x4')],'app':_0x3675('0x8'),'appdata':_0x3675('0xf'),'context':_0x5966cb['context'],'exten':_0x5966cb[_0x3675('0x6')],'priority':_0x2c892a++,'VoiceExtensionId':_0x5966cb['id']},{'type':_0x5966cb[_0x3675('0x4')],'app':_0x3675('0x8'),'appdata':_0x3675('0x10'),'context':_0x5966cb['context'],'exten':_0x5966cb[_0x3675('0x6')],'priority':_0x2c892a++,'VoiceExtensionId':_0x5966cb['id']},{'type':_0x5966cb[_0x3675('0x4')],'app':_0x3675('0x8'),'appdata':_0x3675('0x11'),'context':_0x5966cb['context'],'exten':_0x5966cb[_0x3675('0x6')],'priority':_0x2c892a++,'VoiceExtensionId':_0x5966cb['id']});return _0x2b2c83;}function _0x4c4017(_0x3cf655){var _0x22e7ce=0x2;var _0x2adb30=[{'type':'outbound','app':_0x3675('0x8'),'appdata':_0x3675('0x12'),'context':_0x3cf655['context'],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':'outbound','app':_0x3cf655[_0x3675('0x7')]?_0x3675('0x8'):'NoOp','appdata':_0x3cf655['alias']?_0x3675('0xa')+_0x3cf655[_0x3675('0x7')]:_0x3675('0xb'),'context':_0x3cf655['context'],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':'Set','appdata':'CDR(destination)='+(_0x3cf655['cutdigits']?_0x3675('0x14')+_0x3cf655[_0x3675('0x15')]+'}':_0x3675('0x16')),'context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':_0x3675('0x8'),'appdata':_0x3675('0xe')+_0x3cf655['id'],'context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x22e7ce+0x2)+_0x3675('0x17')+(_0x22e7ce+0x1)+')','context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':_0x3675('0x8'),'appdata':_0x3cf655['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x3cf655['cutdigits']+'}':_0x3675('0x18'),'context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655['exten'],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':_0x3675('0x8'),'appdata':_0x3675('0xf'),'context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655['exten'],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':'outbound','app':_0x3675('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':'outbound','app':_0x3675('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':_0x3675('0x8'),'appdata':'outboundrouteid='+_0x3cf655['id'],'context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']}];if(_0x3cf655['hasOwnProperty'](_0x3675('0x19'))&&_0x3cf655[_0x3675('0x19')]!==_0x3675('0x1a')){_0x2adb30['push']({'type':_0x3675('0x13'),'app':_0x3675('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']},{'type':_0x3675('0x13'),'app':_0x3675('0x8'),'appdata':_0x3675('0x1b')+_0x3cf655[_0x3675('0x19')]||'wav','context':_0x3cf655[_0x3675('0x5')],'exten':_0x3cf655[_0x3675('0x6')],'priority':_0x22e7ce++,'VoiceExtensionId':_0x3cf655['id']});}return _0x2adb30;}function _0x178355(_0x2fe420,_0x1da58d){var _0x237eb4=[{'name':'trunk','param':0x0},{'name':_0x3675('0x1c'),'param':0x1},{'name':_0x3675('0x1d'),'param':0x2},{'name':_0x3675('0x1e'),'param':0x3}];var _0x522896={};var _0xf5441a=_0x1da58d[_0x3675('0x1f')](',');var _0x4c88c2=[];for(var _0x5164af=0x0;_0x5164af<_0x237eb4[_0x3675('0x20')];_0x5164af++){switch(_0x237eb4[_0x5164af][_0x3675('0x21')]){case'trunk':_0x522896[_0x3675('0x22')]=_0xf5441a[_0x237eb4[_0x5164af][_0x3675('0x23')]][_0x3675('0x1f')]('/')[0x1];_0x522896['phone']=_0xf5441a[_0x237eb4[_0x5164af][_0x3675('0x23')]][_0x3675('0x1f')]('/')[0x2];_0x522896[_0x3675('0x24')]=_0x522896[_0x3675('0x25')]?_0x522896[_0x3675('0x25')]['split']('$')[0x0]:undefined;_0x522896[_0x3675('0x25')]=_0x2fe420['cutdigits']?(_0x522896['prefix']||'')+_0x3675('0x14')+_0x2fe420[_0x3675('0x15')]+'}':(_0x522896[_0x3675('0x24')]||'')+_0x3675('0x16');_0x4c88c2[_0x237eb4[_0x5164af]['param']]=[_0x3675('0x26'),_0x522896[_0x3675('0x22')],_0x522896[_0x3675('0x25')]][_0x3675('0x27')]('/');break;case _0x3675('0x1d'):_0x522896[_0x3675('0x1d')]=_0xf5441a[_0x237eb4[_0x5164af][_0x3675('0x23')]];if(_0x2fe420[_0x3675('0x19')]!==_0x3675('0x1a')){if(_0x522896[_0x3675('0x1d')]['indexOf'](_0x3675('0x28'))<0x0){_0x522896['options']+='U(xcally-mixmonitor-context)';}}else{_0x522896[_0x3675('0x1d')]=_0x522896['options'][_0x3675('0x29')](_0x3675('0x28'),'');}_0x4c88c2[_0x237eb4[_0x5164af]['param']]=_0x522896[_0x3675('0x1d')];break;default:_0x4c88c2[_0x237eb4[_0x5164af]['param']]=_0xf5441a[_0x237eb4[_0x5164af][_0x3675('0x23')]];}}return _0x4c88c2[_0x3675('0x27')](',');}function _0x507ca2(_0x379ea0,_0x157df8,_0x299643){return new Promise(function(_0x44c194,_0x428c08){var _0x50d7fc=[];if(_[_0x3675('0x2a')](_0x157df8))return _0x44c194(_0x50d7fc);_0x485956[_0x3675('0x2b')][_0x3675('0x2c')]({'attributes':['id',_0x3675('0x2d'),'IntervalId'],'raw':!![]})[_0x3675('0x2e')](function(_0x192cb1){for(var _0x19a4d0=0x0,_0x370950=0x0;_0x19a4d0<_0x157df8['length'];_0x19a4d0++,_0x370950=0x0){var _0x4b7f0b=_0x157df8[_0x19a4d0];var _0x362ac7=[];var _0x3e6996=[];delete _0x4b7f0b['id'];if(_0x4b7f0b[_0x3675('0x2d')]!==_0x3675('0x2f')){_0x4b7f0b[_0x3675('0x30')]=[_0x4b7f0b['interval']];}else{_0x4b7f0b[_0x3675('0x30')]=_0x4b7f0b[_0x3675('0x31')]?_[_0x3675('0x32')](_['filter'](_0x192cb1,{'IntervalId':_0x4b7f0b[_0x3675('0x31')]}),_0x3675('0x2d')):[];}_0x4b7f0b[_0x3675('0x5')]=_0x379ea0['context'];_0x4b7f0b[_0x3675('0x6')]=_0x379ea0['exten'];if(_0x4b7f0b[_0x3675('0x4')])_0x4b7f0b[_0x3675('0x4')]=_0x4b7f0b[_0x3675('0x4')][_0x3675('0x33')]();if(_0x379ea0[_0x3675('0x4')]===_0x3675('0x13')){if(_0x4b7f0b[_0x3675('0x34')]('tag')&&_0x4b7f0b[_0x3675('0x35')]&&_0x4b7f0b[_0x3675('0x35')]!=='--'){_0x362ac7['push']({'type':_0x4b7f0b[_0x3675('0x4')]['toLowerCase'](),'app':_0x3675('0x8'),'appdata':_0x3675('0x36')+_0x4b7f0b[_0x3675('0x35')],'context':_0x379ea0[_0x3675('0x5')],'exten':_0x379ea0['exten'],'priority':_0x4b7f0b['intervals'][_0x3675('0x20')]+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});}_0x362ac7[_0x3675('0xc')]({'type':_0x4b7f0b['type']['toLowerCase'](),'app':_0x3675('0x37'),'appdata':_0x3675('0x38')+(_0x4b7f0b[_0x3675('0x39')]?_0x3675('0x3a')+_0x4b7f0b['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x379ea0[_0x3675('0x5')],'exten':_0x379ea0[_0x3675('0x6')],'priority':_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')]+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});}else{if(_0x4b7f0b[_0x3675('0x34')](_0x3675('0x3b'))){if(['queue',_0x3675('0x3c')]['includes'](_0x4b7f0b[_0x3675('0x3d')][_0x3675('0x33')]())&&_0x4b7f0b[_0x3675('0x3e')]!==_0x3675('0x3f')){if(_0x4b7f0b[_0x3675('0x3b')]){_0x362ac7[_0x3675('0xc')]({'type':_0x4b7f0b[_0x3675('0x4')][_0x3675('0x33')](),'app':_0x3675('0x37'),'appdata':_0x3675('0x40'),'context':_0x379ea0[_0x3675('0x5')],'exten':_0x379ea0[_0x3675('0x6')],'priority':_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')]+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});_0x362ac7['push']({'type':_0x4b7f0b[_0x3675('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x3675('0x41'),'context':_0x379ea0[_0x3675('0x5')],'exten':_0x379ea0[_0x3675('0x6')],'priority':_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')]+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});}else{_0x362ac7[_0x3675('0xc')]({'type':_0x4b7f0b[_0x3675('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0x3675('0x42'),'context':_0x379ea0['context'],'exten':_0x379ea0[_0x3675('0x6')],'priority':_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')]+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});_0x362ac7['push']({'type':_0x4b7f0b['type']['toLowerCase'](),'app':_0x3675('0x8'),'appdata':_0x3675('0x43'),'context':_0x379ea0[_0x3675('0x5')],'exten':_0x379ea0[_0x3675('0x6')],'priority':_0x4b7f0b[_0x3675('0x30')]['length']+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});}}}}for(var _0x52cac1=0x0;_0x52cac1<_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')];_0x52cac1++){var _0x23e80e=_0x299643+_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')];var _0x56fa45=_0x52cac1===_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')]-0x1?_0x299643+_0x362ac7[_0x3675('0x20')]+_0x3e6996[_0x3675('0x20')]+0x2:_0x299643+_0x52cac1+0x1;_0x362ac7[_0x3675('0x44')](_0x52cac1,0x0,{'type':_0x379ea0[_0x3675('0x4')],'app':_0x3675('0x45'),'appdata':_0x4b7f0b['intervals'][_0x52cac1]+'?'+_0x379ea0[_0x3675('0x5')]+',${EXTEN},'+_0x23e80e+':'+_0x379ea0[_0x3675('0x5')]+_0x3675('0x46')+_0x56fa45,'exten':_0x379ea0['exten'],'context':_0x379ea0[_0x3675('0x5')],'priority':_0x299643+_0x52cac1,'VoiceExtensionId':_0x379ea0['id']});}if(_0x4b7f0b[_0x3675('0x3e')]===_0x3675('0x47')){_0x4b7f0b['appdata']=_0x178355(_0x379ea0,_0x4b7f0b[_0x3675('0x48')]);}if(_0x4b7f0b['appType']===_0x3675('0x49')){_0x362ac7[_0x3675('0xc')]({'type':_0x4b7f0b[_0x3675('0x4')][_0x3675('0x33')](),'app':_0x3675('0x8'),'appdata':_0x3675('0x4a'),'context':_0x379ea0['context'],'exten':_0x379ea0['exten'],'priority':_0x4b7f0b[_0x3675('0x30')][_0x3675('0x20')]+_0x299643+_0x370950++,'VoiceExtensionId':_0x379ea0['id']});}_0x4b7f0b[_0x3675('0x4b')]=_0x362ac7[_0x3675('0x20')]?_[_0x3675('0x4c')](_0x362ac7)[_0x3675('0x4b')]+0x1:_0x299643;_0x50d7fc=_[_0x3675('0x4d')](_0x50d7fc,_0x362ac7,[_0x4b7f0b],_0x3e6996);_0x299643=_['last'](_0x50d7fc)[_0x3675('0x4b')]+0x1;}return _0x44c194(_0x50d7fc);})['catch'](function(_0x3c679d){_0x428c08(_0x3c679d);});});}return _0x2835a4[_0x3675('0x4e')](_0x3675('0x4f'),attributes,{'tableName':_0x3675('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1db2ab){var _0x45b623=this['get']({'plain':!![]});var _0x50ef1b=_0x45b623[_0x3675('0x4')]==='outbound'?_0x4c4017(_0x45b623):_0x461046(_0x45b623);return _0x507ca2(_0x45b623,_0x1db2ab,_[_0x3675('0x4c')](_0x50ef1b)['priority']+0x1)[_0x3675('0x2e')](function(_0x59902e){var _0x73e3da=_['concat'](_0x50ef1b,_0x59902e);_0x73e3da['push']({'type':_0x45b623[_0x3675('0x4')],'app':_0x3675('0x51'),'exten':_0x45b623[_0x3675('0x6')],'context':_0x45b623[_0x3675('0x5')],'priority':_[_0x3675('0x4c')](_0x73e3da)[_0x3675('0x4b')]+0x1,'VoiceExtensionId':_0x45b623['id']});return _0x73e3da;});}}});}; \ No newline at end of file +var _0xf398=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','length','name','param','split','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','IntervalId','then','intervals','map','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf398,0x10a));var _0x8f39=function(_0xdc4445,_0x4b9e17){_0xdc4445=_0xdc4445-0x0;var _0x356c67=_0xf398[_0xdc4445];return _0x356c67;};'use strict';var _=require(_0x8f39('0x0'));var attributes=require(_0x8f39('0x1'));module[_0x8f39('0x2')]=function(_0x40c8bf){var _0x159ae1=_0x40c8bf[_0x8f39('0x3')];function _0xb1a246(_0x1b4285){var _0x2952d2=0x2;var _0x1e8b4d=[{'type':_0x1b4285[_0x8f39('0x4')],'app':'Set','appdata':_0x8f39('0x5')+_0x1b4285[_0x8f39('0x4')],'context':_0x1b4285[_0x8f39('0x6')],'exten':_0x1b4285[_0x8f39('0x7')],'priority':_0x2952d2++,'VoiceExtensionId':_0x1b4285['id']},{'type':_0x1b4285[_0x8f39('0x4')],'app':_0x1b4285[_0x8f39('0x8')]?_0x8f39('0x9'):_0x8f39('0xa'),'appdata':_0x1b4285[_0x8f39('0x8')]?_0x8f39('0xb')+_0x1b4285[_0x8f39('0x8')]:_0x8f39('0xc'),'context':_0x1b4285[_0x8f39('0x6')],'exten':_0x1b4285[_0x8f39('0x7')],'priority':_0x2952d2++,'VoiceExtensionId':_0x1b4285['id']}];if(_0x1b4285['type']===_0x8f39('0xd')){_0x1e8b4d[_0x8f39('0xe')]({'type':_0x8f39('0xd'),'app':_0x8f39('0x9'),'appdata':_0x8f39('0xf')+_0x1b4285['id'],'context':_0x1b4285['context'],'exten':_0x1b4285['exten'],'priority':_0x2952d2++,'VoiceExtensionId':_0x1b4285['id']});}_0x1e8b4d[_0x8f39('0xe')]({'type':_0x1b4285[_0x8f39('0x4')],'app':_0x8f39('0x9'),'appdata':_0x8f39('0x10'),'context':_0x1b4285['context'],'exten':_0x1b4285[_0x8f39('0x7')],'priority':_0x2952d2++,'VoiceExtensionId':_0x1b4285['id']},{'type':_0x1b4285['type'],'app':_0x8f39('0x9'),'appdata':_0x8f39('0x11'),'context':_0x1b4285[_0x8f39('0x6')],'exten':_0x1b4285[_0x8f39('0x7')],'priority':_0x2952d2++,'VoiceExtensionId':_0x1b4285['id']},{'type':_0x1b4285[_0x8f39('0x4')],'app':'Set','appdata':_0x8f39('0x12'),'context':_0x1b4285[_0x8f39('0x6')],'exten':_0x1b4285[_0x8f39('0x7')],'priority':_0x2952d2++,'VoiceExtensionId':_0x1b4285['id']});return _0x1e8b4d;}function _0x4d7911(_0x28fd0f){var _0x4e9c50=0x2;var _0x2db45f=[{'type':_0x8f39('0x13'),'app':_0x8f39('0x9'),'appdata':'CDR(type)=outbound','context':_0x28fd0f[_0x8f39('0x6')],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':_0x8f39('0x13'),'app':_0x28fd0f[_0x8f39('0x8')]?_0x8f39('0x9'):_0x8f39('0xa'),'appdata':_0x28fd0f[_0x8f39('0x8')]?_0x8f39('0xb')+_0x28fd0f[_0x8f39('0x8')]:_0x8f39('0xc'),'context':_0x28fd0f[_0x8f39('0x6')],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':'outbound','app':_0x8f39('0x9'),'appdata':_0x8f39('0x14')+(_0x28fd0f['cutdigits']?_0x8f39('0x15')+_0x28fd0f[_0x8f39('0x16')]+'}':_0x8f39('0x17')),'context':_0x28fd0f[_0x8f39('0x6')],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':_0x8f39('0x13'),'app':_0x8f39('0x9'),'appdata':_0x8f39('0xf')+_0x28fd0f['id'],'context':_0x28fd0f[_0x8f39('0x6')],'exten':_0x28fd0f['exten'],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':'outbound','app':'ExecIf','appdata':_0x8f39('0x18')+(_0x4e9c50+0x2)+_0x8f39('0x19')+(_0x4e9c50+0x1)+')','context':_0x28fd0f['context'],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':_0x8f39('0x13'),'app':_0x8f39('0x9'),'appdata':_0x28fd0f[_0x8f39('0x16')]?'CDR(prefix)=${EXTEN:0:'+_0x28fd0f[_0x8f39('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x28fd0f['context'],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':_0x8f39('0x13'),'app':'Set','appdata':_0x8f39('0x10'),'context':_0x28fd0f['context'],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':'outbound','app':_0x8f39('0x9'),'appdata':_0x8f39('0x11'),'context':_0x28fd0f[_0x8f39('0x6')],'exten':_0x28fd0f['exten'],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':_0x8f39('0x13'),'app':_0x8f39('0x9'),'appdata':'MONITOR_OPTIONS=ab','context':_0x28fd0f['context'],'exten':_0x28fd0f['exten'],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':'outbound','app':'Set','appdata':_0x8f39('0x1a')+_0x28fd0f['id'],'context':_0x28fd0f['context'],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']}];if(_0x28fd0f[_0x8f39('0x1b')](_0x8f39('0x1c'))&&_0x28fd0f['recordingFormat']!==_0x8f39('0x1d')){_0x2db45f[_0x8f39('0xe')]({'type':_0x8f39('0x13'),'app':'Set','appdata':_0x8f39('0x1e'),'context':_0x28fd0f['context'],'exten':_0x28fd0f[_0x8f39('0x7')],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']},{'type':_0x8f39('0x13'),'app':_0x8f39('0x9'),'appdata':_0x8f39('0x1f')+_0x28fd0f[_0x8f39('0x1c')]||'wav','context':_0x28fd0f[_0x8f39('0x6')],'exten':_0x28fd0f['exten'],'priority':_0x4e9c50++,'VoiceExtensionId':_0x28fd0f['id']});}return _0x2db45f;}function _0x18c16f(_0x65624c,_0x32436a){var _0xc1f7b7=[{'name':_0x8f39('0x20'),'param':0x0},{'name':_0x8f39('0x21'),'param':0x1},{'name':_0x8f39('0x22'),'param':0x2},{'name':_0x8f39('0x23'),'param':0x3}];var _0x64de85={};var _0xbee572=_0x32436a['split'](',');var _0x77ed43=[];for(var _0xb2f934=0x0;_0xb2f934<_0xc1f7b7[_0x8f39('0x24')];_0xb2f934++){switch(_0xc1f7b7[_0xb2f934][_0x8f39('0x25')]){case'trunk':_0x64de85[_0x8f39('0x20')]=_0xbee572[_0xc1f7b7[_0xb2f934][_0x8f39('0x26')]][_0x8f39('0x27')]('/')[0x1];_0x64de85[_0x8f39('0x28')]=_0xbee572[_0xc1f7b7[_0xb2f934]['param']]['split']('/')[0x2];_0x64de85['prefix']=_0x64de85[_0x8f39('0x28')]?_0x64de85[_0x8f39('0x28')][_0x8f39('0x27')]('$')[0x0]:undefined;_0x64de85[_0x8f39('0x28')]=_0x65624c[_0x8f39('0x16')]?(_0x64de85[_0x8f39('0x29')]||'')+_0x8f39('0x15')+_0x65624c['cutdigits']+'}':(_0x64de85['prefix']||'')+'${EXTEN}';_0x77ed43[_0xc1f7b7[_0xb2f934][_0x8f39('0x26')]]=[_0x8f39('0x2a'),_0x64de85['trunk'],_0x64de85[_0x8f39('0x28')]][_0x8f39('0x2b')]('/');break;case _0x8f39('0x22'):_0x64de85[_0x8f39('0x22')]=_0xbee572[_0xc1f7b7[_0xb2f934][_0x8f39('0x26')]];if(_0x65624c[_0x8f39('0x1c')]!==_0x8f39('0x1d')){if(_0x64de85[_0x8f39('0x22')][_0x8f39('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x64de85['options']+=_0x8f39('0x2d');}}else{_0x64de85['options']=_0x64de85[_0x8f39('0x22')]['replace'](_0x8f39('0x2d'),'');}_0x77ed43[_0xc1f7b7[_0xb2f934][_0x8f39('0x26')]]=_0x64de85[_0x8f39('0x22')];break;default:_0x77ed43[_0xc1f7b7[_0xb2f934]['param']]=_0xbee572[_0xc1f7b7[_0xb2f934][_0x8f39('0x26')]];}}return _0x77ed43[_0x8f39('0x2b')](',');}function _0x34e068(_0x34794a,_0x122b9a,_0x361fc1){return new Promise(function(_0x272a97,_0x5c188d){var _0x18f276=[];if(_[_0x8f39('0x2e')](_0x122b9a))return _0x272a97(_0x18f276);_0x159ae1[_0x8f39('0x2f')]['findAll']({'attributes':['id',_0x8f39('0x30'),_0x8f39('0x31')],'raw':!![]})[_0x8f39('0x32')](function(_0x65a23b){for(var _0x5adb28=0x0,_0x42c2f8=0x0;_0x5adb28<_0x122b9a[_0x8f39('0x24')];_0x5adb28++,_0x42c2f8=0x0){var _0x19b728=_0x122b9a[_0x5adb28];var _0x247804=[];var _0x2abbbd=[];delete _0x19b728['id'];if(_0x19b728['interval']!=='*,*,*,*'){_0x19b728[_0x8f39('0x33')]=[_0x19b728[_0x8f39('0x30')]];}else{_0x19b728[_0x8f39('0x33')]=_0x19b728[_0x8f39('0x31')]?_[_0x8f39('0x34')](_['filter'](_0x65a23b,{'IntervalId':_0x19b728[_0x8f39('0x31')]}),_0x8f39('0x30')):[];}_0x19b728[_0x8f39('0x6')]=_0x34794a[_0x8f39('0x6')];_0x19b728[_0x8f39('0x7')]=_0x34794a['exten'];if(_0x19b728[_0x8f39('0x4')])_0x19b728['type']=_0x19b728['type'][_0x8f39('0x35')]();if(_0x34794a['type']===_0x8f39('0x13')){if(_0x19b728[_0x8f39('0x1b')](_0x8f39('0x36'))&&_0x19b728[_0x8f39('0x36')]&&_0x19b728['tag']!=='--'){_0x247804[_0x8f39('0xe')]({'type':_0x19b728[_0x8f39('0x4')][_0x8f39('0x35')](),'app':'Set','appdata':_0x8f39('0x37')+_0x19b728[_0x8f39('0x36')],'context':_0x34794a['context'],'exten':_0x34794a['exten'],'priority':_0x19b728[_0x8f39('0x33')][_0x8f39('0x24')]+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});}_0x247804[_0x8f39('0xe')]({'type':_0x19b728[_0x8f39('0x4')][_0x8f39('0x35')](),'app':_0x8f39('0x38'),'appdata':_0x8f39('0x39')+(_0x19b728[_0x8f39('0x3a')]?_0x8f39('0x3b')+_0x19b728[_0x8f39('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x34794a[_0x8f39('0x6')],'exten':_0x34794a[_0x8f39('0x7')],'priority':_0x19b728[_0x8f39('0x33')][_0x8f39('0x24')]+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});}else{if(_0x19b728['hasOwnProperty'](_0x8f39('0x3c'))){if(['queue',_0x8f39('0x3d')][_0x8f39('0x3e')](_0x19b728[_0x8f39('0x3f')][_0x8f39('0x35')]())&&_0x19b728['appType']!=='custom'){if(_0x19b728[_0x8f39('0x3c')]){_0x247804[_0x8f39('0xe')]({'type':_0x19b728[_0x8f39('0x4')]['toLowerCase'](),'app':_0x8f39('0x38'),'appdata':_0x8f39('0x40'),'context':_0x34794a[_0x8f39('0x6')],'exten':_0x34794a[_0x8f39('0x7')],'priority':_0x19b728[_0x8f39('0x33')][_0x8f39('0x24')]+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});_0x247804[_0x8f39('0xe')]({'type':_0x19b728[_0x8f39('0x4')][_0x8f39('0x35')](),'app':_0x8f39('0x9'),'appdata':_0x8f39('0x41'),'context':_0x34794a[_0x8f39('0x6')],'exten':_0x34794a[_0x8f39('0x7')],'priority':_0x19b728[_0x8f39('0x33')]['length']+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});}else{_0x247804['push']({'type':_0x19b728[_0x8f39('0x4')][_0x8f39('0x35')](),'app':'ExecIf','appdata':_0x8f39('0x42'),'context':_0x34794a[_0x8f39('0x6')],'exten':_0x34794a[_0x8f39('0x7')],'priority':_0x19b728[_0x8f39('0x33')][_0x8f39('0x24')]+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});_0x247804[_0x8f39('0xe')]({'type':_0x19b728[_0x8f39('0x4')][_0x8f39('0x35')](),'app':_0x8f39('0x9'),'appdata':_0x8f39('0x43'),'context':_0x34794a[_0x8f39('0x6')],'exten':_0x34794a[_0x8f39('0x7')],'priority':_0x19b728[_0x8f39('0x33')]['length']+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});}}}}for(var _0x1532ba=0x0;_0x1532ba<_0x19b728[_0x8f39('0x33')]['length'];_0x1532ba++){var _0x3fd58d=_0x361fc1+_0x19b728[_0x8f39('0x33')]['length'];var _0x49a102=_0x1532ba===_0x19b728[_0x8f39('0x33')][_0x8f39('0x24')]-0x1?_0x361fc1+_0x247804[_0x8f39('0x24')]+_0x2abbbd['length']+0x2:_0x361fc1+_0x1532ba+0x1;_0x247804[_0x8f39('0x44')](_0x1532ba,0x0,{'type':_0x34794a[_0x8f39('0x4')],'app':_0x8f39('0x45'),'appdata':_0x19b728[_0x8f39('0x33')][_0x1532ba]+'?'+_0x34794a[_0x8f39('0x6')]+',${EXTEN},'+_0x3fd58d+':'+_0x34794a['context']+_0x8f39('0x46')+_0x49a102,'exten':_0x34794a['exten'],'context':_0x34794a[_0x8f39('0x6')],'priority':_0x361fc1+_0x1532ba,'VoiceExtensionId':_0x34794a['id']});}if(_0x19b728[_0x8f39('0x47')]===_0x8f39('0x48')){_0x19b728[_0x8f39('0x49')]=_0x18c16f(_0x34794a,_0x19b728[_0x8f39('0x49')]);}if(_0x19b728[_0x8f39('0x47')]==='agi'){_0x247804['push']({'type':_0x19b728[_0x8f39('0x4')][_0x8f39('0x35')](),'app':_0x8f39('0x9'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x34794a[_0x8f39('0x6')],'exten':_0x34794a['exten'],'priority':_0x19b728[_0x8f39('0x33')]['length']+_0x361fc1+_0x42c2f8++,'VoiceExtensionId':_0x34794a['id']});}_0x19b728['priority']=_0x247804['length']?_[_0x8f39('0x4a')](_0x247804)[_0x8f39('0x4b')]+0x1:_0x361fc1;_0x18f276=_[_0x8f39('0x4c')](_0x18f276,_0x247804,[_0x19b728],_0x2abbbd);_0x361fc1=_[_0x8f39('0x4a')](_0x18f276)[_0x8f39('0x4b')]+0x1;}return _0x272a97(_0x18f276);})[_0x8f39('0x4d')](function(_0x25c6f5){_0x5c188d(_0x25c6f5);});});}return _0x40c8bf[_0x8f39('0x4e')](_0x8f39('0x4f'),attributes,{'tableName':_0x8f39('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3388a9){var _0x163413=this[_0x8f39('0x51')]({'plain':!![]});var _0x4c2ea6=_0x163413[_0x8f39('0x4')]==='outbound'?_0x4d7911(_0x163413):_0xb1a246(_0x163413);return _0x34e068(_0x163413,_0x3388a9,_[_0x8f39('0x4a')](_0x4c2ea6)[_0x8f39('0x4b')]+0x1)['then'](function(_0x7de869){var _0x108914=_[_0x8f39('0x4c')](_0x4c2ea6,_0x7de869);_0x108914['push']({'type':_0x163413[_0x8f39('0x4')],'app':_0x8f39('0x52'),'exten':_0x163413[_0x8f39('0x7')],'context':_0x163413[_0x8f39('0x6')],'priority':_[_0x8f39('0x4a')](_0x108914)['priority']+0x1,'VoiceExtensionId':_0x163413['id']});return _0x108914;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 419f396..2142335 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 _0x5a63=['GetVoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','stringify','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0xfed474,_0x238d1e){var _0x3b3aab=function(_0xeaa3a3){while(--_0xeaa3a3){_0xfed474['push'](_0xfed474['shift']());}};_0x3b3aab(++_0x238d1e);}(_0x5a63,0xe3));var _0x35a6=function(_0x285786,_0x4715f5){_0x285786=_0x285786-0x0;var _0x2986fa=_0x5a63[_0x285786];return _0x2986fa;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a6('0x3'));var logger=require(_0x35a6('0x4'))(_0x35a6('0x5'));var config=require(_0x35a6('0x6'));var jayson=require(_0x35a6('0x7'));var client=jayson['client'][_0x35a6('0x8')]({'port':0x232a});config['redis']=_[_0x35a6('0x9')](config['redis'],{'host':_0x35a6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35a6('0xb')]));require(_0x35a6('0xc'))[_0x35a6('0xd')](socket);function respondWithRpcPromise(_0x44d0d5,_0x1df564,_0x4e4c93){return new BPromise(function(_0x2899a8,_0xf55896){return client[_0x35a6('0xe')](_0x44d0d5,_0x4e4c93)['then'](function(_0x24afc4){logger['info'](_0x35a6('0xf'),_0x1df564,_0x35a6('0x10'));logger[_0x35a6('0x11')](_0x35a6('0x12'),_0x1df564,_0x35a6('0x10'),JSON['stringify'](_0x24afc4));if(_0x24afc4[_0x35a6('0x13')]){if(_0x24afc4[_0x35a6('0x13')][_0x35a6('0x14')]===0x1f4){logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x24afc4[_0x35a6('0x13')]['message']);return _0xf55896(_0x24afc4[_0x35a6('0x13')][_0x35a6('0x15')]);}logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x24afc4[_0x35a6('0x13')][_0x35a6('0x15')]);return _0x2899a8(_0x24afc4['error'][_0x35a6('0x15')]);}else{logger[_0x35a6('0x16')](_0x35a6('0xf'),_0x1df564,_0x35a6('0x10'));_0x2899a8(_0x24afc4[_0x35a6('0x17')][_0x35a6('0x15')]);}})[_0x35a6('0x18')](function(_0x5818e0){logger[_0x35a6('0x13')](_0x35a6('0xf'),_0x1df564,_0x5818e0);_0xf55896(_0x5818e0);});});}exports[_0x35a6('0x19')]=function(_0x5d82c0){var _0x3dbf65=this;return new Promise(function(_0x32a260,_0x3183eb){return db['VoiceExtension'][_0x35a6('0x1a')]({'raw':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0['options'][_0x35a6('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0['options']['where']||null:null,'attributes':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1d')]||null:null,'limit':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1e')]||null:null,'include':_0x5d82c0[_0x35a6('0x1b')]?_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1f')]?_[_0x35a6('0x20')](_0x5d82c0[_0x35a6('0x1b')][_0x35a6('0x1f')],function(_0x5e9a69){return{'model':db[_0x5e9a69[_0x35a6('0x21')]],'as':_0x5e9a69['as'],'attributes':_0x5e9a69[_0x35a6('0x1d')],'include':_0x5e9a69['include']?_['map'](_0x5e9a69[_0x35a6('0x1f')],function(_0x287c0b){return{'model':db[_0x287c0b[_0x35a6('0x21')]],'as':_0x287c0b['as'],'attributes':_0x287c0b['attributes'],'include':_0x287c0b[_0x35a6('0x1f')]?_[_0x35a6('0x20')](_0x287c0b[_0x35a6('0x1f')],function(_0x422ca0){return{'model':db[_0x422ca0['model']],'as':_0x422ca0['as'],'attributes':_0x422ca0[_0x35a6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35a6('0x22')](function(_0x1bdbe2){logger[_0x35a6('0x16')]('GetVoiceExtension',_0x5d82c0);logger['debug'](_0x35a6('0x19'),_0x5d82c0,JSON[_0x35a6('0x23')](_0x1bdbe2));_0x32a260(_0x1bdbe2);})[_0x35a6('0x18')](function(_0x2a0719){logger[_0x35a6('0x13')](_0x35a6('0x19'),_0x2a0719[_0x35a6('0x15')],_0x5d82c0);_0x3183eb(_0x3dbf65[_0x35a6('0x13')](0x1f4,_0x2a0719[_0x35a6('0x15')]));});});}; \ No newline at end of file +var _0x943c=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x40c18a,_0x12bfb3){var _0x512703=function(_0x199e1f){while(--_0x199e1f){_0x40c18a['push'](_0x40c18a['shift']());}};_0x512703(++_0x12bfb3);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var moment=require(_0xc943('0x2'));var BPromise=require(_0xc943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc943('0x4'))['db'];var utils=require(_0xc943('0x5'));var logger=require(_0xc943('0x6'))('rpc');var config=require(_0xc943('0x7'));var jayson=require(_0xc943('0x8'));var client=jayson[_0xc943('0x9')][_0xc943('0xa')]({'port':0x232a});config[_0xc943('0xb')]=_[_0xc943('0xc')](config[_0xc943('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc943('0xd'))(new Redis(config[_0xc943('0xb')]));require(_0xc943('0xe'))[_0xc943('0xf')](socket);function respondWithRpcPromise(_0x5ea94b,_0x4b054c,_0x4a4313){return new BPromise(function(_0x142a27,_0x578a7b){return client['request'](_0x5ea94b,_0x4a4313)[_0xc943('0x10')](function(_0x401b9a){logger[_0xc943('0x11')](_0xc943('0x12'),_0x4b054c,_0xc943('0x13'));logger[_0xc943('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x4b054c,_0xc943('0x13'),JSON[_0xc943('0x15')](_0x401b9a));if(_0x401b9a['error']){if(_0x401b9a['error']['code']===0x1f4){logger[_0xc943('0x16')](_0xc943('0x12'),_0x4b054c,_0x401b9a['error'][_0xc943('0x17')]);return _0x578a7b(_0x401b9a['error']['message']);}logger[_0xc943('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x4b054c,_0x401b9a[_0xc943('0x16')][_0xc943('0x17')]);return _0x142a27(_0x401b9a[_0xc943('0x16')][_0xc943('0x17')]);}else{logger['info'](_0xc943('0x12'),_0x4b054c,_0xc943('0x13'));_0x142a27(_0x401b9a[_0xc943('0x18')]['message']);}})[_0xc943('0x19')](function(_0x320b62){logger[_0xc943('0x16')](_0xc943('0x12'),_0x4b054c,_0x320b62);_0x578a7b(_0x320b62);});});}exports[_0xc943('0x1a')]=function(_0x23da3a){var _0x18a50c=this;return new Promise(function(_0x397598,_0x2dbb35){return db[_0xc943('0x1b')][_0xc943('0x1c')]({'raw':_0x23da3a[_0xc943('0x1d')]?_0x23da3a[_0xc943('0x1d')][_0xc943('0x1e')]===undefined?!![]:![]:!![],'where':_0x23da3a[_0xc943('0x1d')]?_0x23da3a[_0xc943('0x1d')][_0xc943('0x1f')]||null:null,'attributes':_0x23da3a[_0xc943('0x1d')]?_0x23da3a[_0xc943('0x1d')]['attributes']||null:null,'limit':_0x23da3a[_0xc943('0x1d')]?_0x23da3a[_0xc943('0x1d')][_0xc943('0x20')]||null:null,'include':_0x23da3a[_0xc943('0x1d')]?_0x23da3a[_0xc943('0x1d')][_0xc943('0x21')]?_[_0xc943('0x22')](_0x23da3a[_0xc943('0x1d')][_0xc943('0x21')],function(_0x41b83e){return{'model':db[_0x41b83e[_0xc943('0x23')]],'as':_0x41b83e['as'],'attributes':_0x41b83e[_0xc943('0x24')],'include':_0x41b83e[_0xc943('0x21')]?_[_0xc943('0x22')](_0x41b83e['include'],function(_0x34a9ea){return{'model':db[_0x34a9ea[_0xc943('0x23')]],'as':_0x34a9ea['as'],'attributes':_0x34a9ea[_0xc943('0x24')],'include':_0x34a9ea[_0xc943('0x21')]?_[_0xc943('0x22')](_0x34a9ea[_0xc943('0x21')],function(_0x4e77b3){return{'model':db[_0x4e77b3[_0xc943('0x23')]],'as':_0x4e77b3['as'],'attributes':_0x4e77b3[_0xc943('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc943('0x10')](function(_0x288700){logger[_0xc943('0x11')](_0xc943('0x1a'),_0x23da3a);logger[_0xc943('0x14')](_0xc943('0x1a'),_0x23da3a,JSON['stringify'](_0x288700));_0x397598(_0x288700);})['catch'](function(_0x23bd30){logger[_0xc943('0x16')](_0xc943('0x1a'),_0x23bd30[_0xc943('0x17')],_0x23da3a);_0x2dbb35(_0x18a50c['error'](0x1f4,_0x23bd30['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ed2cca7..573bff1 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 _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x1cb9,0x14e));var _0x91cb=function(_0xe3c99a,_0x55c655){_0xe3c99a=_0xe3c99a-0x0;var _0xe66670=_0x1cb9[_0xe3c99a];return _0xe66670;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x314209,_0x580b43){var _0x3b8c3a=function(_0x522659){while(--_0x522659){_0x314209['push'](_0x314209['shift']());}};_0x3b8c3a(++_0x580b43);}(_0x5fab,0x177));var _0xb5fa=function(_0x11d08e,_0x1cd670){_0x11d08e=_0x11d08e-0x0;var _0x19c8cb=_0x5fab[_0x11d08e];return _0x19c8cb;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 62ae756..457b138 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 _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','show','/:id/messages','isAuthenticated','getMessages','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x6d0b7d,_0x43a26d){var _0x11ce2e=function(_0x2adf6a){while(--_0x2adf6a){_0x6d0b7d['push'](_0x6d0b7d['shift']());}};_0x11ce2e(++_0x43a26d);}(_0x524e,0x15e));var _0xe524=function(_0x275518,_0x1e1408){_0x275518=_0x275518-0x0;var _0x25bef1=_0x524e[_0x275518];return _0x25bef1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9fd4=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/messages'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9fd4,0x16c));var _0x49fd=function(_0x273e4c,_0x24c349){_0x273e4c=_0x273e4c-0x0;var _0x11adb4=_0x9fd4[_0x273e4c];return _0x11adb4;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/:id',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['getMessages']);router[_0x49fd('0xe')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x10')](_0x49fd('0x11'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router['delete'](_0x49fd('0x11'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);module[_0x49fd('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 39b1390..efe1e3d 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 _0xe8cd=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x366500,_0xcadc8a){var _0x10fc82=function(_0x4bf4f5){while(--_0x4bf4f5){_0x366500['push'](_0x366500['shift']());}};_0x10fc82(++_0xcadc8a);}(_0xe8cd,0x96));var _0xde8c=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0xe8cd[_0x4ba380];return _0x4b111b;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xde8c('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xde8c('0x1'),'unique':_0xde8c('0x2')},'mailbox':{'type':Sequelize[_0xde8c('0x0')],'defaultValue':'','allowNull':![],'unique':_0xde8c('0x2')},'password':{'type':Sequelize[_0xde8c('0x0')]},'fullname':{'type':Sequelize[_0xde8c('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x489f70){this[_0xde8c('0x3')](_0xde8c('0x4'),typeof _0x489f70===_0xde8c('0x5')&&_0x489f70[_0xde8c('0x6')]()?_0x489f70[_0xde8c('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xde8c('0x0')],'defaultValue':_0xde8c('0x7')},'attach':{'type':Sequelize[_0xde8c('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xde8c('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xde8c('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xde8c('0x8')](_0xde8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xde8c('0x8')]('yes','no'),'defaultValue':_0xde8c('0x9'),'allowNull':![]},'stamp':{'type':_0xde8c('0xa')},'emailsubject':{'type':Sequelize[_0xde8c('0x0')]},'emailbody':{'type':Sequelize[_0xde8c('0x0')]},'maxsecs':{'type':Sequelize[_0xde8c('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xde8c('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xde8c('0xc')],'get':function(){return this['getDataValue'](_0xde8c('0xd'))+_0xde8c('0xe')+this['getDataValue'](_0xde8c('0xf'));}}}; \ No newline at end of file +var _0x11f2=['INTEGER','VIRTUAL','fullname','getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x4a9e4a,_0x585df1){var _0xaa903e=function(_0x4190dd){while(--_0x4190dd){_0x4a9e4a['push'](_0x4a9e4a['shift']());}};_0xaa903e(++_0x585df1);}(_0x11f2,0x82));var _0x211f=function(_0xf763ec,_0x251c78){_0xf763ec=_0xf763ec-0x0;var _0x3b8884=_0x11f2[_0xf763ec];return _0x3b8884;};'use strict';var Sequelize=require(_0x211f('0x0'));module[_0x211f('0x1')]={'customer_id':{'type':Sequelize[_0x211f('0x2')]},'context':{'type':Sequelize[_0x211f('0x2')],'defaultValue':_0x211f('0x3'),'unique':_0x211f('0x4')},'mailbox':{'type':Sequelize[_0x211f('0x2')],'defaultValue':'','allowNull':![],'unique':_0x211f('0x4')},'password':{'type':Sequelize[_0x211f('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x211f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x10ad49){this[_0x211f('0x5')](_0x211f('0x6'),typeof _0x10ad49===_0x211f('0x7')&&_0x10ad49[_0x211f('0x8')]()?_0x10ad49[_0x211f('0x8')]():null);}},'pager':{'type':Sequelize[_0x211f('0x2')]},'tz':{'type':Sequelize[_0x211f('0x2')],'defaultValue':_0x211f('0x9')},'attach':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x211f('0x2')]},'callback':{'type':Sequelize[_0x211f('0x2')]},'review':{'type':Sequelize['ENUM'](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x211f('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':_0x211f('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x211f('0xa')](_0x211f('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x211f('0xd')},'emailsubject':{'type':Sequelize[_0x211f('0x2')]},'emailbody':{'type':Sequelize[_0x211f('0x2')]},'maxsecs':{'type':Sequelize[_0x211f('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x211f('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x211f('0xf')],'get':function(){return this['getDataValue'](_0x211f('0x10'))+'\x20-\x20'+this[_0x211f('0x11')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 07f4ea8..68774bc 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 _0xda3f=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','length','mailbox','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x588a16,_0x484c4f){var _0x46fdf9=function(_0x2bf80e){while(--_0x2bf80e){_0x588a16['push'](_0x588a16['shift']());}};_0x46fdf9(++_0x484c4f);}(_0xda3f,0xec));var _0xfda3=function(_0x38bdf8,_0x5842ee){_0x38bdf8=_0x38bdf8-0x0;var _0x5bb8e2=_0xda3f[_0x38bdf8];return _0x5bb8e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){var _0x2d5b44=_0x16eaa6[_0xfda3('0x24')]({'plain':!![]});var _0x4ae9b9=_0xfda3('0x25');return db[_0xfda3('0x26')][_0xfda3('0x27')]({'where':{'type':_0x4ae9b9,'resourceId':_0x2d5b44['id']}})[_0xfda3('0x23')](function(){return _0x16eaa6;});})[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6d7d,_0x1e87fe){return function(_0x2bef2b){if(!_0x2bef2b){_0x3c6d7d[_0xfda3('0x17')](0x194);}return _0x2bef2b;};}function handleError(_0x33ffd4,_0x5704c7){_0x5704c7=_0x5704c7||0x1f4;return function(_0x3c1549){logger[_0xfda3('0x28')](_0x3c1549[_0xfda3('0x29')]);if(_0x3c1549[_0xfda3('0x2a')]){delete _0x3c1549[_0xfda3('0x2a')];}_0x33ffd4[_0xfda3('0x18')](_0x5704c7)[_0xfda3('0x2b')](_0x3c1549);};}exports['index']=function(_0x56ca3a,_0x3aef3c){var _0x4fd277={},_0x4b9d90={},_0x16b4a2={'count':0x0,'rows':[]};var _0x2a5971=_[_0xfda3('0x2c')](db[_0xfda3('0x2d')][_0xfda3('0x2e')],function(_0x35ec7a){return{'name':_0x35ec7a[_0xfda3('0x2f')],'type':_0x35ec7a[_0xfda3('0x30')][_0xfda3('0x31')]};});_0x4b9d90['model']=_[_0xfda3('0x2c')](_0x2a5971,_0xfda3('0x2a'));_0x4b9d90[_0xfda3('0x32')]=_[_0xfda3('0x33')](_0x56ca3a[_0xfda3('0x32')]);_0x4b9d90[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x4b9d90[_0xfda3('0x36')],_0x4b9d90[_0xfda3('0x32')]);_0x4fd277['attributes']=_['intersection'](_0x4b9d90[_0xfda3('0x36')],qs[_0xfda3('0x37')](_0x56ca3a['query'][_0xfda3('0x37')]));_0x4fd277[_0xfda3('0x38')]=_0x4fd277[_0xfda3('0x38')]['length']?_0x4fd277[_0xfda3('0x38')]:_0x4b9d90[_0xfda3('0x36')];if(!_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x39')](_0xfda3('0x3a'))){_0x4fd277['limit']=qs[_0xfda3('0x1b')](_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x1b')]);_0x4fd277['offset']=qs[_0xfda3('0x19')](_0x56ca3a['query'][_0xfda3('0x19')]);}_0x4fd277[_0xfda3('0x3b')]=qs[_0xfda3('0x3c')](_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x3c')]);_0x4fd277[_0xfda3('0x3d')]=qs[_0xfda3('0x34')](_[_0xfda3('0x3e')](_0x56ca3a['query'],_0x4b9d90[_0xfda3('0x34')]),_0x2a5971);if(_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x3f')]){_0x4fd277[_0xfda3('0x3d')]=_['merge'](_0x4fd277[_0xfda3('0x3d')],{'$or':_[_0xfda3('0x2c')](_0x2a5971,function(_0x590ba5){if(_0x590ba5['type']!=='VIRTUAL'){var _0x31b173={};_0x31b173[_0x590ba5[_0xfda3('0x2a')]]={'$like':'%'+_0x56ca3a[_0xfda3('0x32')][_0xfda3('0x3f')]+'%'};return _0x31b173;}})});}_0x4fd277=_[_0xfda3('0x40')]({},_0x4fd277,_0x56ca3a[_0xfda3('0x41')]);var _0x40b814={'where':_0x4fd277[_0xfda3('0x3d')]};return db[_0xfda3('0x2d')][_0xfda3('0x1c')](_0x40b814)['then'](function(_0x27200f){_0x16b4a2[_0xfda3('0x1c')]=_0x27200f;if(_0x56ca3a['query'][_0xfda3('0x42')]){_0x4fd277['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x4fd277);})[_0xfda3('0x23')](function(_0x107fb1){_0x16b4a2[_0xfda3('0x43')]=_0x107fb1;return _0x16b4a2;})[_0xfda3('0x23')](respondWithFilteredResult(_0x3aef3c,_0x4fd277))['catch'](handleError(_0x3aef3c,null));};exports[_0xfda3('0x44')]=function(_0x25b9a6,_0x154ae7){var _0x2ce504={'raw':!![],'where':{'id':_0x25b9a6[_0xfda3('0x45')]['id']}},_0x564ccd={};_0x564ccd[_0xfda3('0x36')]=_[_0xfda3('0x33')](db['VoiceMail']['rawAttributes']);_0x564ccd[_0xfda3('0x32')]=_[_0xfda3('0x33')](_0x25b9a6[_0xfda3('0x32')]);_0x564ccd[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x564ccd[_0xfda3('0x36')],_0x564ccd[_0xfda3('0x32')]);_0x2ce504[_0xfda3('0x38')]=_[_0xfda3('0x35')](_0x564ccd[_0xfda3('0x36')],qs[_0xfda3('0x37')](_0x25b9a6[_0xfda3('0x32')][_0xfda3('0x37')]));_0x2ce504[_0xfda3('0x38')]=_0x2ce504['attributes']['length']?_0x2ce504[_0xfda3('0x38')]:_0x564ccd[_0xfda3('0x36')];if(_0x25b9a6[_0xfda3('0x32')][_0xfda3('0x42')]){_0x2ce504[_0xfda3('0x46')]=[{'all':!![]}];}_0x2ce504=_[_0xfda3('0x40')]({},_0x2ce504,_0x25b9a6[_0xfda3('0x41')]);return db[_0xfda3('0x2d')][_0xfda3('0x47')](_0x2ce504)[_0xfda3('0x23')](handleEntityNotFound(_0x154ae7,null))['then'](respondWithResult(_0x154ae7,null))[_0xfda3('0x48')](handleError(_0x154ae7,null));};exports[_0xfda3('0x49')]=function(_0x481356,_0x36aa3a){return db[_0xfda3('0x2d')]['create'](_0x481356[_0xfda3('0x4a')],{})[_0xfda3('0x23')](function(_0x15eb87){var _0x4bcd2b=_0x481356[_0xfda3('0x4b')][_0xfda3('0x24')]({'plain':!![]});if(!_0x4bcd2b)throw new Error(_0xfda3('0x4c'));if(_0x4bcd2b['role']===_0xfda3('0x4b')){var _0x33565d=_0x15eb87[_0xfda3('0x24')]({'plain':!![]});var _0x2f6e62=_0xfda3('0x25');return db['UserProfileSection'][_0xfda3('0x47')]({'where':{'name':_0x2f6e62,'userProfileId':_0x4bcd2b['userProfileId']},'raw':!![]})[_0xfda3('0x23')](function(_0x587eef){if(_0x587eef&&_0x587eef[_0xfda3('0x4d')]===0x0){return db[_0xfda3('0x26')][_0xfda3('0x49')]({'name':_0x33565d[_0xfda3('0x2a')],'resourceId':_0x33565d['id'],'type':_0x587eef['name'],'sectionId':_0x587eef['id']},{})[_0xfda3('0x23')](function(){return _0x15eb87;});}else{return _0x15eb87;}})[_0xfda3('0x48')](function(_0x2f2c32){logger[_0xfda3('0x28')](_0xfda3('0x4e'),_0x2f2c32);throw _0x2f2c32;});}return _0x15eb87;})[_0xfda3('0x23')](respondWithResult(_0x36aa3a,0xc9))[_0xfda3('0x48')](handleError(_0x36aa3a,null));};exports['update']=function(_0x4b1410,_0x4fb214){if(_0x4b1410[_0xfda3('0x4a')]['id']){delete _0x4b1410[_0xfda3('0x4a')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x4b1410[_0xfda3('0x45')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x4fb214,null))[_0xfda3('0x23')](saveUpdates(_0x4b1410[_0xfda3('0x4a')],null))[_0xfda3('0x23')](respondWithResult(_0x4fb214,null))['catch'](handleError(_0x4fb214,null));};exports[_0xfda3('0x27')]=function(_0x2a30e8,_0x167424){return db[_0xfda3('0x2d')][_0xfda3('0x47')]({'where':{'id':_0x2a30e8[_0xfda3('0x45')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x167424,null))[_0xfda3('0x23')](removeEntity(_0x167424,null))[_0xfda3('0x48')](handleError(_0x167424,null));};exports[_0xfda3('0x4f')]=function(_0x3ed7c1,_0x1fa27a,_0x5b426b){return db[_0xfda3('0x2d')][_0xfda3('0x50')]({'where':{'id':_0x3ed7c1[_0xfda3('0x45')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x1fa27a,null))[_0xfda3('0x23')](function(_0x405d7e){var _0x42c7a1;var _0x4ce31c={},_0x5a3a6f={};_0x5a3a6f[_0xfda3('0x36')]=_[_0xfda3('0x33')](db['VoiceMailMessage'][_0xfda3('0x2e')]);_0x5a3a6f[_0xfda3('0x32')]=_[_0xfda3('0x33')](_0x3ed7c1[_0xfda3('0x32')]);_0x5a3a6f['filters']=_['intersection'](_0x5a3a6f[_0xfda3('0x36')],_0x5a3a6f[_0xfda3('0x32')]);_0x4ce31c[_0xfda3('0x38')]=_['intersection'](_0x5a3a6f[_0xfda3('0x36')],qs['fields'](_0x3ed7c1[_0xfda3('0x32')][_0xfda3('0x37')]));_0x4ce31c[_0xfda3('0x38')]=_0x4ce31c[_0xfda3('0x38')][_0xfda3('0x51')]?_0x4ce31c[_0xfda3('0x38')]:_0x5a3a6f['model'];if(!_0x3ed7c1[_0xfda3('0x32')][_0xfda3('0x39')](_0xfda3('0x3a'))){_0x4ce31c[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3ed7c1['query']['limit']);_0x4ce31c[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3ed7c1['query']['offset']);}_0x4ce31c['order']=qs[_0xfda3('0x3c')](_0x3ed7c1[_0xfda3('0x32')]['sort']);_0x4ce31c[_0xfda3('0x3d')]=qs[_0xfda3('0x34')](_[_0xfda3('0x3e')](_0x3ed7c1[_0xfda3('0x32')],_0x5a3a6f['filters']));if(_0x3ed7c1[_0xfda3('0x32')][_0xfda3('0x3f')]){_0x4ce31c[_0xfda3('0x3d')]=_[_0xfda3('0x40')](_0x4ce31c[_0xfda3('0x3d')],{'$or':_[_0xfda3('0x2c')](_0x4ce31c['attributes'],function(_0x4e312d){var _0x31d657={};_0x31d657[_0x4e312d]={'$like':'%'+_0x3ed7c1['query'][_0xfda3('0x3f')]+'%'};return _0x31d657;})});}_0x4ce31c[_0xfda3('0x3d')]=_[_0xfda3('0x40')](_0x4ce31c[_0xfda3('0x3d')],{'mailboxuser':_0x405d7e[_0xfda3('0x52')]});_0x4ce31c=_[_0xfda3('0x40')]({},_0x4ce31c,_0x3ed7c1[_0xfda3('0x41')]);return db[_0xfda3('0x53')][_0xfda3('0x54')](_0x4ce31c)[_0xfda3('0x23')](respondWithFilteredResult(_0x1fa27a,_0x4ce31c));})['catch'](handleError(_0x1fa27a,null));}; \ No newline at end of file +var _0xed3c=['body','getMessages','findOne','order','sort','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3e9081,_0x99b751){var _0x523517=function(_0x2af3ee){while(--_0x2af3ee){_0x3e9081['push'](_0x3e9081['shift']());}};_0x523517(++_0x99b751);}(_0xed3c,0x1a6));var _0xced3=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xed3c[_0x56740a];return _0x257144;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){var _0x50f7c1=_0x101708[_0xced3('0x23')]({'plain':!![]});var _0x23f92b='Voicemails';return db[_0xced3('0x24')]['destroy']({'where':{'type':_0x23f92b,'resourceId':_0x50f7c1['id']}})[_0xced3('0x21')](function(){return _0x101708;});})[_0xced3('0x21')](function(){_0x559fa2[_0xced3('0x17')](0xcc)[_0xced3('0x25')]();});}};}function handleEntityNotFound(_0x2ec2c4,_0x502cf1){return function(_0x5454c0){if(!_0x5454c0){_0x2ec2c4[_0xced3('0x16')](0x194);}return _0x5454c0;};}function handleError(_0x5bb425,_0x2ab8a8){_0x2ab8a8=_0x2ab8a8||0x1f4;return function(_0x1e6923){logger['error'](_0x1e6923[_0xced3('0x26')]);if(_0x1e6923[_0xced3('0x27')]){delete _0x1e6923[_0xced3('0x27')];}_0x5bb425[_0xced3('0x17')](_0x2ab8a8)[_0xced3('0x28')](_0x1e6923);};}exports[_0xced3('0x29')]=function(_0x895a32,_0x41d003){var _0x116cc7={},_0x559b8e={},_0xa78899={'count':0x0,'rows':[]};var _0x1b8baa=_[_0xced3('0x2a')](db[_0xced3('0x2b')][_0xced3('0x2c')],function(_0x21e4a2){return{'name':_0x21e4a2[_0xced3('0x2d')],'type':_0x21e4a2[_0xced3('0x2e')][_0xced3('0x2f')]};});_0x559b8e[_0xced3('0x30')]=_[_0xced3('0x2a')](_0x1b8baa,_0xced3('0x27'));_0x559b8e[_0xced3('0x31')]=_[_0xced3('0x32')](_0x895a32[_0xced3('0x31')]);_0x559b8e[_0xced3('0x33')]=_[_0xced3('0x34')](_0x559b8e[_0xced3('0x30')],_0x559b8e[_0xced3('0x31')]);_0x116cc7[_0xced3('0x35')]=_[_0xced3('0x34')](_0x559b8e['model'],qs[_0xced3('0x36')](_0x895a32['query'][_0xced3('0x36')]));_0x116cc7[_0xced3('0x35')]=_0x116cc7[_0xced3('0x35')][_0xced3('0x37')]?_0x116cc7[_0xced3('0x35')]:_0x559b8e[_0xced3('0x30')];if(!_0x895a32[_0xced3('0x31')][_0xced3('0x38')](_0xced3('0x39'))){_0x116cc7[_0xced3('0x1a')]=qs['limit'](_0x895a32[_0xced3('0x31')][_0xced3('0x1a')]);_0x116cc7['offset']=qs[_0xced3('0x1c')](_0x895a32[_0xced3('0x31')][_0xced3('0x1c')]);}_0x116cc7['order']=qs['sort'](_0x895a32[_0xced3('0x31')]['sort']);_0x116cc7[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x895a32[_0xced3('0x31')],_0x559b8e[_0xced3('0x33')]),_0x1b8baa);if(_0x895a32[_0xced3('0x31')]['filter']){_0x116cc7[_0xced3('0x3a')]=_['merge'](_0x116cc7['where'],{'$or':_[_0xced3('0x2a')](_0x1b8baa,function(_0x31e281){if(_0x31e281[_0xced3('0x2e')]!=='VIRTUAL'){var _0xb2cf20={};_0xb2cf20[_0x31e281[_0xced3('0x27')]]={'$like':'%'+_0x895a32[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0xb2cf20;}})});}_0x116cc7=_[_0xced3('0x3c')]({},_0x116cc7,_0x895a32[_0xced3('0x3d')]);var _0x30e890={'where':_0x116cc7[_0xced3('0x3a')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x30e890)[_0xced3('0x21')](function(_0x38855f){_0xa78899[_0xced3('0x1b')]=_0x38855f;if(_0x895a32[_0xced3('0x31')][_0xced3('0x3e')]){_0x116cc7['include']=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x3f')](_0x116cc7);})[_0xced3('0x21')](function(_0x1a6c1f){_0xa78899[_0xced3('0x40')]=_0x1a6c1f;return _0xa78899;})[_0xced3('0x21')](respondWithFilteredResult(_0x41d003,_0x116cc7))[_0xced3('0x41')](handleError(_0x41d003,null));};exports[_0xced3('0x42')]=function(_0x1ab7e0,_0x4cea5c){var _0x6c0238={'raw':!![],'where':{'id':_0x1ab7e0[_0xced3('0x43')]['id']}},_0x47ab23={};_0x47ab23[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMail'][_0xced3('0x2c')]);_0x47ab23[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1ab7e0[_0xced3('0x31')]);_0x47ab23['filters']=_[_0xced3('0x34')](_0x47ab23[_0xced3('0x30')],_0x47ab23[_0xced3('0x31')]);_0x6c0238[_0xced3('0x35')]=_[_0xced3('0x34')](_0x47ab23['model'],qs[_0xced3('0x36')](_0x1ab7e0[_0xced3('0x31')][_0xced3('0x36')]));_0x6c0238[_0xced3('0x35')]=_0x6c0238[_0xced3('0x35')][_0xced3('0x37')]?_0x6c0238[_0xced3('0x35')]:_0x47ab23['model'];if(_0x1ab7e0[_0xced3('0x31')][_0xced3('0x3e')]){_0x6c0238['include']=[{'all':!![]}];}_0x6c0238=_['merge']({},_0x6c0238,_0x1ab7e0[_0xced3('0x3d')]);return db['VoiceMail'][_0xced3('0x44')](_0x6c0238)[_0xced3('0x21')](handleEntityNotFound(_0x4cea5c,null))[_0xced3('0x21')](respondWithResult(_0x4cea5c,null))[_0xced3('0x41')](handleError(_0x4cea5c,null));};exports[_0xced3('0x45')]=function(_0x1b3396,_0x3700ed){return db[_0xced3('0x2b')][_0xced3('0x45')](_0x1b3396['body'],{})[_0xced3('0x21')](function(_0x8df206){var _0x2aa876=_0x1b3396[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x2aa876)throw new Error(_0xced3('0x47'));if(_0x2aa876['role']===_0xced3('0x46')){var _0x629ecf=_0x8df206[_0xced3('0x23')]({'plain':!![]});var _0x409da0=_0xced3('0x48');return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x409da0,'userProfileId':_0x2aa876[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x44d779){if(_0x44d779&&_0x44d779[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')]['create']({'name':_0x629ecf[_0xced3('0x27')],'resourceId':_0x629ecf['id'],'type':_0x44d779['name'],'sectionId':_0x44d779['id']},{})[_0xced3('0x21')](function(){return _0x8df206;});}else{return _0x8df206;}})[_0xced3('0x41')](function(_0xc93e05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93e05);throw _0xc93e05;});}return _0x8df206;})[_0xced3('0x21')](respondWithResult(_0x3700ed,0xc9))[_0xced3('0x41')](handleError(_0x3700ed,null));};exports['update']=function(_0x3f41cc,_0x4ae67d){if(_0x3f41cc[_0xced3('0x4c')]['id']){delete _0x3f41cc[_0xced3('0x4c')]['id'];}return db['VoiceMail'][_0xced3('0x44')]({'where':{'id':_0x3f41cc[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x4ae67d,null))['then'](saveUpdates(_0x3f41cc[_0xced3('0x4c')],null))['then'](respondWithResult(_0x4ae67d,null))[_0xced3('0x41')](handleError(_0x4ae67d,null));};exports[_0xced3('0x22')]=function(_0x4694b8,_0x168c36){return db[_0xced3('0x2b')][_0xced3('0x44')]({'where':{'id':_0x4694b8[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x168c36,null))[_0xced3('0x21')](removeEntity(_0x168c36,null))[_0xced3('0x41')](handleError(_0x168c36,null));};exports[_0xced3('0x4d')]=function(_0x4b14dd,_0x3859e8,_0x3de35d){return db[_0xced3('0x2b')][_0xced3('0x4e')]({'where':{'id':_0x4b14dd[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3859e8,null))['then'](function(_0x9db425){var _0x171081;var _0x21ea6a={},_0x440a0f={};_0x440a0f[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMailMessage'][_0xced3('0x2c')]);_0x440a0f['query']=_[_0xced3('0x32')](_0x4b14dd['query']);_0x440a0f[_0xced3('0x33')]=_[_0xced3('0x34')](_0x440a0f['model'],_0x440a0f[_0xced3('0x31')]);_0x21ea6a[_0xced3('0x35')]=_[_0xced3('0x34')](_0x440a0f[_0xced3('0x30')],qs[_0xced3('0x36')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x36')]));_0x21ea6a[_0xced3('0x35')]=_0x21ea6a[_0xced3('0x35')][_0xced3('0x37')]?_0x21ea6a[_0xced3('0x35')]:_0x440a0f[_0xced3('0x30')];if(!_0x4b14dd[_0xced3('0x31')]['hasOwnProperty'](_0xced3('0x39'))){_0x21ea6a[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0x4b14dd[_0xced3('0x31')]['limit']);_0x21ea6a[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x1c')]);}_0x21ea6a[_0xced3('0x4f')]=qs[_0xced3('0x50')](_0x4b14dd[_0xced3('0x31')]['sort']);_0x21ea6a[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x4b14dd[_0xced3('0x31')],_0x440a0f[_0xced3('0x33')]));if(_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]){_0x21ea6a['where']=_[_0xced3('0x3c')](_0x21ea6a[_0xced3('0x3a')],{'$or':_[_0xced3('0x2a')](_0x21ea6a[_0xced3('0x35')],function(_0x3992d2){var _0x385d45={};_0x385d45[_0x3992d2]={'$like':'%'+_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x385d45;})});}_0x21ea6a[_0xced3('0x3a')]=_[_0xced3('0x3c')](_0x21ea6a['where'],{'mailboxuser':_0x9db425[_0xced3('0x51')]});_0x21ea6a=_[_0xced3('0x3c')]({},_0x21ea6a,_0x4b14dd['options']);return db['VoiceMailMessage'][_0xced3('0x52')](_0x21ea6a)['then'](respondWithFilteredResult(_0x3859e8,_0x21ea6a));})[_0xced3('0x41')](handleError(_0x3859e8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ae842e7..9776298 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 _0x311d=['mailbox_context','mailbox','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','voice_voicemail'];(function(_0x3eee56,_0x176daf){var _0x506bcd=function(_0x3cfe8b){while(--_0x3cfe8b){_0x3eee56['push'](_0x3eee56['shift']());}};_0x506bcd(++_0x176daf);}(_0x311d,0x120));var _0xd311=function(_0x347129,_0x573de1){_0x347129=_0x347129-0x0;var _0x105435=_0x311d[_0x347129];return _0x105435;};'use strict';var _=require(_0xd311('0x0'));var util=require(_0xd311('0x1'));var logger=require(_0xd311('0x2'))('api');var moment=require(_0xd311('0x3'));var BPromise=require('bluebird');var rp=require(_0xd311('0x4'));var fs=require('fs');var path=require(_0xd311('0x5'));var rimraf=require(_0xd311('0x6'));var config=require(_0xd311('0x7'));var attributes=require(_0xd311('0x8'));module['exports']=function(_0x1e7c2e,_0x456cac){return _0x1e7c2e['define'](_0xd311('0x9'),attributes,{'tableName':_0xd311('0xa'),'paranoid':![],'indexes':[{'name':_0xd311('0xb'),'fields':[_0xd311('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0bdd=['context','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','define','voice_voicemail'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0x0bdd,0x1f0));var _0xd0bd=function(_0x197191,_0x412830){_0x197191=_0x197191-0x0;var _0x15d150=_0x0bdd[_0x197191];return _0x15d150;};'use strict';var _=require(_0xd0bd('0x0'));var util=require('util');var logger=require(_0xd0bd('0x1'))(_0xd0bd('0x2'));var moment=require('moment');var BPromise=require(_0xd0bd('0x3'));var rp=require(_0xd0bd('0x4'));var fs=require('fs');var path=require(_0xd0bd('0x5'));var rimraf=require('rimraf');var config=require(_0xd0bd('0x6'));var attributes=require(_0xd0bd('0x7'));module['exports']=function(_0x54f3a9,_0x4626d5){return _0x54f3a9[_0xd0bd('0x8')]('VoiceMail',attributes,{'tableName':_0xd0bd('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xd0bd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c192a5c..6795701 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 _0xe508=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xe508,0x108));var _0x8e50=function(_0x14f017,_0x5a01d4){_0x14f017=_0x14f017-0x0;var _0x215004=_0xe508[_0x14f017];return _0x215004;};'use strict';var _=require(_0x8e50('0x0'));var util=require(_0x8e50('0x1'));var moment=require(_0x8e50('0x2'));var BPromise=require(_0x8e50('0x3'));var rs=require(_0x8e50('0x4'));var fs=require('fs');var Redis=require(_0x8e50('0x5'));var db=require(_0x8e50('0x6'))['db'];var utils=require(_0x8e50('0x7'));var logger=require(_0x8e50('0x8'))(_0x8e50('0x9'));var config=require(_0x8e50('0xa'));var jayson=require(_0x8e50('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59f98a,_0x14ad44,_0x18ff7f){return new BPromise(function(_0x54db8c,_0x397607){return client[_0x8e50('0xc')](_0x59f98a,_0x18ff7f)[_0x8e50('0xd')](function(_0x52969f){logger[_0x8e50('0xe')](_0x8e50('0xf'),_0x14ad44,'request\x20sent');logger['debug'](_0x8e50('0x10'),_0x14ad44,_0x8e50('0x11'),JSON['stringify'](_0x52969f));if(_0x52969f['error']){if(_0x52969f[_0x8e50('0x12')]['code']===0x1f4){logger[_0x8e50('0x12')](_0x8e50('0xf'),_0x14ad44,_0x52969f[_0x8e50('0x12')][_0x8e50('0x13')]);return _0x397607(_0x52969f[_0x8e50('0x12')][_0x8e50('0x13')]);}logger[_0x8e50('0x12')](_0x8e50('0xf'),_0x14ad44,_0x52969f['error'][_0x8e50('0x13')]);return _0x54db8c(_0x52969f[_0x8e50('0x12')][_0x8e50('0x13')]);}else{logger[_0x8e50('0xe')](_0x8e50('0xf'),_0x14ad44,'request\x20sent');_0x54db8c(_0x52969f[_0x8e50('0x14')]['message']);}})[_0x8e50('0x15')](function(_0x5abbbd){logger[_0x8e50('0x12')](_0x8e50('0xf'),_0x14ad44,_0x5abbbd);_0x397607(_0x5abbbd);});});} \ No newline at end of file +var _0x5df8=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5df8,0x15f));var _0x85df=function(_0x4038b3,_0x3696d7){_0x4038b3=_0x4038b3-0x0;var _0x4df483=_0x5df8[_0x4038b3];return _0x4df483;};'use strict';var _=require(_0x85df('0x0'));var util=require(_0x85df('0x1'));var moment=require(_0x85df('0x2'));var BPromise=require(_0x85df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85df('0x4'));var db=require(_0x85df('0x5'))['db'];var utils=require(_0x85df('0x6'));var logger=require(_0x85df('0x7'))(_0x85df('0x8'));var config=require(_0x85df('0x9'));var jayson=require(_0x85df('0xa'));var client=jayson[_0x85df('0xb')][_0x85df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x311661,_0xf31c82,_0x1d1849){return new BPromise(function(_0x58cb87,_0x28886c){return client[_0x85df('0xd')](_0x311661,_0x1d1849)['then'](function(_0x3b896d){logger[_0x85df('0xe')](_0x85df('0xf'),_0xf31c82,_0x85df('0x10'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0xf31c82,_0x85df('0x10'),JSON[_0x85df('0x11')](_0x3b896d));if(_0x3b896d[_0x85df('0x12')]){if(_0x3b896d['error'][_0x85df('0x13')]===0x1f4){logger[_0x85df('0x12')]('VoiceMail,\x20%s,\x20%s',_0xf31c82,_0x3b896d[_0x85df('0x12')][_0x85df('0x14')]);return _0x28886c(_0x3b896d['error']['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xf31c82,_0x3b896d[_0x85df('0x12')]['message']);return _0x58cb87(_0x3b896d['error'][_0x85df('0x14')]);}else{logger[_0x85df('0xe')](_0x85df('0xf'),_0xf31c82,'request\x20sent');_0x58cb87(_0x3b896d['result'][_0x85df('0x14')]);}})[_0x85df('0x15')](function(_0x5d724a){logger[_0x85df('0x12')](_0x85df('0xf'),_0xf31c82,_0x5d724a);_0x28886c(_0x5d724a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7ea2636..cbc6b3e 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 _0x37d3=['/:id/download','download','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2c1073,_0x1b4938){var _0x3f794e=function(_0x45b24f){while(--_0x45b24f){_0x2c1073['push'](_0x2c1073['shift']());}};_0x3f794e(++_0x1b4938);}(_0x37d3,0x1bc));var _0x337d=function(_0xbd5a3f,_0x502afe){_0xbd5a3f=_0xbd5a3f-0x0;var _0x23db9c=_0x37d3[_0xbd5a3f];return _0x23db9c;};'use strict';var multer=require(_0x337d('0x0'));var util=require(_0x337d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x337d('0x2'));var router=express[_0x337d('0x3')]();var fs_extra=require(_0x337d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x337d('0x5'));var config=require('../../config/environment');var controller=require(_0x337d('0x6'));router['get']('/',auth[_0x337d('0x7')](),controller[_0x337d('0x8')]);router[_0x337d('0x9')](_0x337d('0xa'),auth[_0x337d('0x7')](),controller[_0x337d('0xb')]);router[_0x337d('0x9')](_0x337d('0xc'),auth['isAuthenticated'](),controller[_0x337d('0xd')]);router['post']('/',auth[_0x337d('0x7')](),controller['create']);router[_0x337d('0xe')](_0x337d('0xa'),auth[_0x337d('0x7')](),controller[_0x337d('0xf')]);router[_0x337d('0x10')]('/:id',auth[_0x337d('0x7')](),controller[_0x337d('0x11')]);module[_0x337d('0x12')]=router; \ No newline at end of file +var _0x1f3b=['/:id/download','download','create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','/:id','show','get'];(function(_0x526f9b,_0x458c4e){var _0x468133=function(_0x504ce4){while(--_0x504ce4){_0x526f9b['push'](_0x526f9b['shift']());}};_0x468133(++_0x458c4e);}(_0x1f3b,0x146));var _0xb1f3=function(_0x52e2a8,_0x22d875){_0x52e2a8=_0x52e2a8-0x0;var _0x3d3fb0=_0x1f3b[_0x52e2a8];return _0x3d3fb0;};'use strict';var multer=require(_0xb1f3('0x0'));var util=require('util');var path=require(_0xb1f3('0x1'));var timeout=require(_0xb1f3('0x2'));var express=require(_0xb1f3('0x3'));var router=express[_0xb1f3('0x4')]();var fs_extra=require(_0xb1f3('0x5'));var auth=require(_0xb1f3('0x6'));var interaction=require(_0xb1f3('0x7'));var config=require(_0xb1f3('0x8'));var controller=require(_0xb1f3('0x9'));router['get']('/',auth[_0xb1f3('0xa')](),controller['index']);router['get'](_0xb1f3('0xb'),auth[_0xb1f3('0xa')](),controller[_0xb1f3('0xc')]);router[_0xb1f3('0xd')](_0xb1f3('0xe'),auth[_0xb1f3('0xa')](),controller[_0xb1f3('0xf')]);router['post']('/',auth[_0xb1f3('0xa')](),controller[_0xb1f3('0x10')]);router['put'](_0xb1f3('0xb'),auth[_0xb1f3('0xa')](),controller[_0xb1f3('0x11')]);router['delete'](_0xb1f3('0xb'),auth[_0xb1f3('0xa')](),controller[_0xb1f3('0x12')]);module[_0xb1f3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7715c30..11aa85c 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 _0x027d=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING','BLOB'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x027d,0x1cf));var _0xd027=function(_0x2c561e,_0x483e18){_0x2c561e=_0x2c561e-0x0;var _0x2aa4e0=_0x027d[_0x2c561e];return _0x2aa4e0;};'use strict';var Sequelize=require(_0xd027('0x0'));module['exports']={'name':{'type':Sequelize[_0xd027('0x1')],'get':function(_0x4b3f31){return this[_0xd027('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xd027('0x4')](_0xd027('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd027('0x3')],'defaultValue':''},'stamp':{'type':_0xd027('0x6'),'defaultValue':Sequelize[_0xd027('0x7')](_0xd027('0x8'))}}; \ No newline at end of file +var _0x3fce=['sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3fce,0x1cc));var _0xe3fc=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0x3fce[_0x2b9d5c];return _0x37bb93;};'use strict';var Sequelize=require(_0xe3fc('0x0'));module[_0xe3fc('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5d61e0){return this[_0xe3fc('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xe3fc('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xe3fc('0x5')](_0xe3fc('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe3fc('0x4')],'defaultValue':''},'stamp':{'type':_0xe3fc('0x7'),'defaultValue':Sequelize[_0xe3fc('0x8')](_0xe3fc('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 03d708d..9e9626c 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 _0x1c47=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','body','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x4f16a3,_0x45e69d){var _0x3947f1=function(_0x32eea8){while(--_0x32eea8){_0x4f16a3['push'](_0x4f16a3['shift']());}};_0x3947f1(++_0x45e69d);}(_0x1c47,0x71));var _0x71c4=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x1c47[_0x421196];return _0x2738af;};'use strict';var emlformat=require(_0x71c4('0x0'));var rimraf=require(_0x71c4('0x1'));var zipdir=require(_0x71c4('0x2'));var jsonpatch=require(_0x71c4('0x3'));var rp=require('request-promise');var moment=require(_0x71c4('0x4'));var BPromise=require(_0x71c4('0x5'));var Mustache=require('mustache');var util=require(_0x71c4('0x6'));var path=require(_0x71c4('0x7'));var sox=require(_0x71c4('0x8'));var csv=require(_0x71c4('0x9'));var ejs=require(_0x71c4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71c4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x71c4('0x9'));var querystring=require(_0x71c4('0xc'));var Papa=require(_0x71c4('0xd'));var Redis=require(_0x71c4('0xe'));var authService=require(_0x71c4('0xf'));var qs=require(_0x71c4('0x10'));var as=require(_0x71c4('0x11'));var hardwareService=require(_0x71c4('0x12'));var logger=require(_0x71c4('0x13'))(_0x71c4('0x14'));var utils=require(_0x71c4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71c4('0x16'))['db'];function respondWithStatusCode(_0x5e2fad,_0x45d193){_0x45d193=_0x45d193||0xcc;return function(_0x3201ed){if(_0x3201ed){return _0x5e2fad[_0x71c4('0x17')](_0x45d193);}return _0x5e2fad[_0x71c4('0x18')](_0x45d193)['end']();};}function respondWithResult(_0x518a7c,_0x647293){_0x647293=_0x647293||0xc8;return function(_0x42010c){if(_0x42010c){return _0x518a7c[_0x71c4('0x18')](_0x647293)['json'](_0x42010c);}};}function respondWithFilteredResult(_0x3db90a,_0x2505b9){return function(_0xe5fd1e){if(_0xe5fd1e){var _0x42d0f7=typeof _0x2505b9[_0x71c4('0x19')]===_0x71c4('0x1a')&&typeof _0x2505b9[_0x71c4('0x1b')]==='undefined';var _0x507293=_0xe5fd1e[_0x71c4('0x1c')];var _0x41dfa4=_0x42d0f7?0x0:_0x2505b9[_0x71c4('0x19')];var _0x3b3f52=_0x42d0f7?_0xe5fd1e['count']:_0x2505b9[_0x71c4('0x19')]+_0x2505b9[_0x71c4('0x1b')];var _0x527000;if(_0x3b3f52>=_0x507293){_0x3b3f52=_0x507293;_0x527000=0xc8;}else{_0x527000=0xce;}_0x3db90a[_0x71c4('0x18')](_0x527000);return _0x3db90a[_0x71c4('0x1d')](_0x71c4('0x1e'),_0x41dfa4+'-'+_0x3b3f52+'/'+_0x507293)[_0x71c4('0x1f')](_0xe5fd1e);}return null;};}function patchUpdates(_0x8cbbe5){return function(_0x5ef804){try{jsonpatch[_0x71c4('0x20')](_0x5ef804,_0x8cbbe5,!![]);}catch(_0x3d043a){return BPromise[_0x71c4('0x21')](_0x3d043a);}return _0x5ef804['save']();};}function saveUpdates(_0xa9a5f2,_0x59366c){return function(_0x2bedb7){if(_0x2bedb7){return _0x2bedb7[_0x71c4('0x22')](_0xa9a5f2)['then'](function(_0x151ab5){return _0x151ab5;});}return null;};}function removeEntity(_0x521151,_0x1dff38){return function(_0x53dd90){if(_0x53dd90){return _0x53dd90[_0x71c4('0x23')]()[_0x71c4('0x24')](function(){_0x521151[_0x71c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x574834,_0x3b03ca){return function(_0x1442c3){if(!_0x1442c3){_0x574834[_0x71c4('0x17')](0x194);}return _0x1442c3;};}function handleError(_0x4a1d4a,_0x4eaa1b){_0x4eaa1b=_0x4eaa1b||0x1f4;return function(_0x562fa1){logger[_0x71c4('0x25')](_0x562fa1[_0x71c4('0x26')]);if(_0x562fa1[_0x71c4('0x27')]){delete _0x562fa1[_0x71c4('0x27')];}_0x4a1d4a[_0x71c4('0x18')](_0x4eaa1b)['send'](_0x562fa1);};}exports[_0x71c4('0x28')]=function(_0x3dcd70,_0x1f8303){var _0x423ea9={},_0x4e11d7={},_0x2889fb={'count':0x0,'rows':[]};var _0x65d79a=_[_0x71c4('0x29')](db[_0x71c4('0x2a')][_0x71c4('0x2b')],function(_0x63eeea){return{'name':_0x63eeea[_0x71c4('0x2c')],'type':_0x63eeea[_0x71c4('0x2d')][_0x71c4('0x2e')]};});_0x4e11d7['model']=_['differenceBy'](_[_0x71c4('0x29')](_0x65d79a,_0x71c4('0x27')),['name']);_0x4e11d7[_0x71c4('0x2f')]=_[_0x71c4('0x30')](_0x3dcd70['query']);_0x4e11d7[_0x71c4('0x31')]=_[_0x71c4('0x32')](_0x4e11d7[_0x71c4('0x33')],_0x4e11d7[_0x71c4('0x2f')]);_0x423ea9[_0x71c4('0x34')]=_[_0x71c4('0x32')](_0x4e11d7[_0x71c4('0x33')],qs[_0x71c4('0x35')](_0x3dcd70[_0x71c4('0x2f')][_0x71c4('0x35')]));_0x423ea9[_0x71c4('0x34')]=_0x423ea9[_0x71c4('0x34')][_0x71c4('0x36')]?_0x423ea9[_0x71c4('0x34')]:_0x4e11d7[_0x71c4('0x33')];if(!_0x3dcd70[_0x71c4('0x2f')][_0x71c4('0x37')](_0x71c4('0x38'))){_0x423ea9[_0x71c4('0x1b')]=qs[_0x71c4('0x1b')](_0x3dcd70[_0x71c4('0x2f')]['limit']);_0x423ea9[_0x71c4('0x19')]=qs[_0x71c4('0x19')](_0x3dcd70['query'][_0x71c4('0x19')]);}_0x423ea9[_0x71c4('0x39')]=qs[_0x71c4('0x3a')](_0x3dcd70[_0x71c4('0x2f')][_0x71c4('0x3a')]);_0x423ea9['where']=qs[_0x71c4('0x31')](_[_0x71c4('0x3b')](_0x3dcd70[_0x71c4('0x2f')],_0x4e11d7[_0x71c4('0x31')]),_0x65d79a);if(_0x3dcd70[_0x71c4('0x2f')][_0x71c4('0x3c')]){_0x423ea9[_0x71c4('0x3d')]=_[_0x71c4('0x3e')](_0x423ea9['where'],{'$or':_['map'](_0x65d79a,function(_0x305f07){if(_0x305f07[_0x71c4('0x2d')]!==_0x71c4('0x3f')){var _0x42250b={};_0x42250b[_0x305f07[_0x71c4('0x27')]]={'$like':'%'+_0x3dcd70[_0x71c4('0x2f')][_0x71c4('0x3c')]+'%'};return _0x42250b;}})});}_0x423ea9=_[_0x71c4('0x3e')]({},_0x423ea9,_0x3dcd70[_0x71c4('0x40')]);var _0x3a2975={'where':_0x423ea9[_0x71c4('0x3d')]};return db[_0x71c4('0x2a')][_0x71c4('0x1c')](_0x3a2975)[_0x71c4('0x24')](function(_0x12dfc5){_0x2889fb[_0x71c4('0x1c')]=_0x12dfc5;if(_0x3dcd70['query']['includeAll']){_0x423ea9[_0x71c4('0x41')]=[{'all':!![]}];}return db[_0x71c4('0x2a')][_0x71c4('0x42')](_0x423ea9);})[_0x71c4('0x24')](function(_0xb52538){_0x2889fb['rows']=_0xb52538;return _0x2889fb;})['then'](respondWithFilteredResult(_0x1f8303,_0x423ea9))[_0x71c4('0x43')](handleError(_0x1f8303,null));};exports['show']=function(_0xf43117,_0x3095d5){var _0x314718={'raw':!![],'where':{'id':_0xf43117[_0x71c4('0x44')]['id']}},_0x44ae0b={};_0x44ae0b[_0x71c4('0x33')]=_[_0x71c4('0x30')](db[_0x71c4('0x2a')]['rawAttributes']);_0x44ae0b['query']=_['keys'](_0xf43117[_0x71c4('0x2f')]);_0x44ae0b['filters']=_[_0x71c4('0x32')](_0x44ae0b[_0x71c4('0x33')],_0x44ae0b[_0x71c4('0x2f')]);_0x314718[_0x71c4('0x34')]=_[_0x71c4('0x32')](_0x44ae0b[_0x71c4('0x33')],qs[_0x71c4('0x35')](_0xf43117[_0x71c4('0x2f')]['fields']));_0x314718[_0x71c4('0x34')]=_0x314718['attributes'][_0x71c4('0x36')]?_0x314718[_0x71c4('0x34')]:_0x44ae0b[_0x71c4('0x33')];if(_0xf43117['query'][_0x71c4('0x45')]){_0x314718[_0x71c4('0x41')]=[{'all':!![]}];}_0x314718=_[_0x71c4('0x3e')]({},_0x314718,_0xf43117['options']);return db[_0x71c4('0x2a')][_0x71c4('0x46')](_0x314718)[_0x71c4('0x24')](handleEntityNotFound(_0x3095d5,null))[_0x71c4('0x24')](respondWithResult(_0x3095d5,null))['catch'](handleError(_0x3095d5,null));};exports['create']=function(_0x4c7589,_0x4e8f7e){return db[_0x71c4('0x2a')]['create'](_0x4c7589[_0x71c4('0x47')],{})[_0x71c4('0x24')](respondWithResult(_0x4e8f7e,0xc9))[_0x71c4('0x43')](handleError(_0x4e8f7e,null));};exports['update']=function(_0x2c7bb5,_0x4cabe6){if(_0x2c7bb5[_0x71c4('0x47')]['id']){delete _0x2c7bb5[_0x71c4('0x47')]['id'];}return db[_0x71c4('0x2a')]['find']({'where':{'id':_0x2c7bb5['params']['id']}})['then'](handleEntityNotFound(_0x4cabe6,null))[_0x71c4('0x24')](saveUpdates(_0x2c7bb5['body'],null))[_0x71c4('0x24')](respondWithResult(_0x4cabe6,null))[_0x71c4('0x43')](handleError(_0x4cabe6,null));};exports['destroy']=function(_0x7b14f9,_0x83e89c){return db['VoiceMailMessage'][_0x71c4('0x46')]({'where':{'id':_0x7b14f9[_0x71c4('0x44')]['id']}})[_0x71c4('0x24')](handleEntityNotFound(_0x83e89c,null))[_0x71c4('0x24')](removeEntity(_0x83e89c,null))[_0x71c4('0x43')](handleError(_0x83e89c,null));};exports['download']=function(_0x32e0dc,_0x51315d,_0x264e00){return db[_0x71c4('0x2a')][_0x71c4('0x46')]({'where':{'id':_0x32e0dc[_0x71c4('0x44')]['id']},'attributes':['id','recording',_0x71c4('0x48')]})[_0x71c4('0x24')](handleEntityNotFound(_0x51315d,null))[_0x71c4('0x24')](function(_0x5ae874){if(_0x5ae874){if(!_0x5ae874['recording']){throw new db[(_0x71c4('0x49'))][(_0x71c4('0x4a'))](_0x71c4('0x4b'));}var _0x271259={'Content-Type':_0x71c4('0x4c'),'Content-Disposition':_0x71c4('0x4d')};if(_0x5ae874['msg_id']){_0x271259[_0x71c4('0x4e')]=_0x71c4('0x4f')+_0x5ae874[_0x71c4('0x48')]+_0x71c4('0x50');}_0x51315d[_0x71c4('0x1d')](_0x271259);return _0x51315d['send'](new Buffer(_0x5ae874[_0x71c4('0x51')]));}})[_0x71c4('0x43')](handleError(_0x51315d,null));}; \ No newline at end of file +var _0x6089=['name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then'];(function(_0x26b4fd,_0x132c60){var _0x3cbd38=function(_0x2952c4){while(--_0x2952c4){_0x26b4fd['push'](_0x26b4fd['shift']());}};_0x3cbd38(++_0x132c60);}(_0x6089,0xd2));var _0x9608=function(_0x1d4269,_0x1f560b){_0x1d4269=_0x1d4269-0x0;var _0x412a58=_0x6089[_0x1d4269];return _0x412a58;};'use strict';var emlformat=require(_0x9608('0x0'));var rimraf=require(_0x9608('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9608('0x2'));var rp=require(_0x9608('0x3'));var moment=require(_0x9608('0x4'));var BPromise=require(_0x9608('0x5'));var Mustache=require('mustache');var util=require(_0x9608('0x6'));var path=require(_0x9608('0x7'));var sox=require(_0x9608('0x8'));var csv=require(_0x9608('0x9'));var ejs=require(_0x9608('0xa'));var fs=require('fs');var fs_extra=require(_0x9608('0xb'));var _=require('lodash');var squel=require(_0x9608('0xc'));var crypto=require(_0x9608('0xd'));var jsforce=require(_0x9608('0xe'));var deskjs=require(_0x9608('0xf'));var toCsv=require(_0x9608('0x9'));var querystring=require('querystring');var Papa=require(_0x9608('0x10'));var Redis=require(_0x9608('0x11'));var authService=require(_0x9608('0x12'));var qs=require(_0x9608('0x13'));var as=require(_0x9608('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9608('0x15'));var utils=require(_0x9608('0x16'));var config=require(_0x9608('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9608('0x18'))['db'];function respondWithStatusCode(_0x39fee0,_0x2400f0){_0x2400f0=_0x2400f0||0xcc;return function(_0x3abd69){if(_0x3abd69){return _0x39fee0[_0x9608('0x19')](_0x2400f0);}return _0x39fee0['status'](_0x2400f0)[_0x9608('0x1a')]();};}function respondWithResult(_0x4db591,_0x4adbe0){_0x4adbe0=_0x4adbe0||0xc8;return function(_0x3f197d){if(_0x3f197d){return _0x4db591[_0x9608('0x1b')](_0x4adbe0)[_0x9608('0x1c')](_0x3f197d);}};}function respondWithFilteredResult(_0x5573ec,_0xd9999){return function(_0xae5a9e){if(_0xae5a9e){var _0x476d3a=typeof _0xd9999[_0x9608('0x1d')]===_0x9608('0x1e')&&typeof _0xd9999['limit']==='undefined';var _0x5283a1=_0xae5a9e[_0x9608('0x1f')];var _0xb6c49f=_0x476d3a?0x0:_0xd9999[_0x9608('0x1d')];var _0x5e1458=_0x476d3a?_0xae5a9e[_0x9608('0x1f')]:_0xd9999['offset']+_0xd9999[_0x9608('0x20')];var _0x25c278;if(_0x5e1458>=_0x5283a1){_0x5e1458=_0x5283a1;_0x25c278=0xc8;}else{_0x25c278=0xce;}_0x5573ec['status'](_0x25c278);return _0x5573ec[_0x9608('0x21')](_0x9608('0x22'),_0xb6c49f+'-'+_0x5e1458+'/'+_0x5283a1)['json'](_0xae5a9e);}return null;};}function patchUpdates(_0xec187a){return function(_0x459a72){try{jsonpatch[_0x9608('0x23')](_0x459a72,_0xec187a,!![]);}catch(_0x2d4d84){return BPromise['reject'](_0x2d4d84);}return _0x459a72[_0x9608('0x24')]();};}function saveUpdates(_0x5dade6,_0x35dd2a){return function(_0xeeb1f3){if(_0xeeb1f3){return _0xeeb1f3[_0x9608('0x25')](_0x5dade6)['then'](function(_0x506b91){return _0x506b91;});}return null;};}function removeEntity(_0x1ca5dc,_0x6fa549){return function(_0x1b434b){if(_0x1b434b){return _0x1b434b['destroy']()[_0x9608('0x26')](function(){_0x1ca5dc[_0x9608('0x1b')](0xcc)[_0x9608('0x1a')]();});}};}function handleEntityNotFound(_0x377317,_0x5663e2){return function(_0x308041){if(!_0x308041){_0x377317[_0x9608('0x19')](0x194);}return _0x308041;};}function handleError(_0x4eba60,_0x2d68ec){_0x2d68ec=_0x2d68ec||0x1f4;return function(_0x260dbe){logger['error'](_0x260dbe['stack']);if(_0x260dbe[_0x9608('0x27')]){delete _0x260dbe[_0x9608('0x27')];}_0x4eba60['status'](_0x2d68ec)[_0x9608('0x28')](_0x260dbe);};}exports[_0x9608('0x29')]=function(_0x2ac8d6,_0x584926){var _0x1fe705={},_0x4cf03c={},_0x7cd1e9={'count':0x0,'rows':[]};var _0x2976ec=_[_0x9608('0x2a')](db[_0x9608('0x2b')][_0x9608('0x2c')],function(_0x2e82cc){return{'name':_0x2e82cc[_0x9608('0x2d')],'type':_0x2e82cc[_0x9608('0x2e')][_0x9608('0x2f')]};});_0x4cf03c[_0x9608('0x30')]=_[_0x9608('0x31')](_[_0x9608('0x2a')](_0x2976ec,_0x9608('0x27')),['name']);_0x4cf03c['query']=_['keys'](_0x2ac8d6['query']);_0x4cf03c[_0x9608('0x32')]=_[_0x9608('0x33')](_0x4cf03c['model'],_0x4cf03c[_0x9608('0x34')]);_0x1fe705['attributes']=_['intersection'](_0x4cf03c[_0x9608('0x30')],qs[_0x9608('0x35')](_0x2ac8d6[_0x9608('0x34')][_0x9608('0x35')]));_0x1fe705[_0x9608('0x36')]=_0x1fe705[_0x9608('0x36')]['length']?_0x1fe705[_0x9608('0x36')]:_0x4cf03c[_0x9608('0x30')];if(!_0x2ac8d6[_0x9608('0x34')][_0x9608('0x37')](_0x9608('0x38'))){_0x1fe705[_0x9608('0x20')]=qs[_0x9608('0x20')](_0x2ac8d6['query'][_0x9608('0x20')]);_0x1fe705[_0x9608('0x1d')]=qs['offset'](_0x2ac8d6[_0x9608('0x34')]['offset']);}_0x1fe705[_0x9608('0x39')]=qs[_0x9608('0x3a')](_0x2ac8d6[_0x9608('0x34')]['sort']);_0x1fe705['where']=qs[_0x9608('0x32')](_[_0x9608('0x3b')](_0x2ac8d6[_0x9608('0x34')],_0x4cf03c['filters']),_0x2976ec);if(_0x2ac8d6[_0x9608('0x34')][_0x9608('0x3c')]){_0x1fe705[_0x9608('0x3d')]=_[_0x9608('0x3e')](_0x1fe705[_0x9608('0x3d')],{'$or':_['map'](_0x2976ec,function(_0x3d3fc5){if(_0x3d3fc5['type']!=='VIRTUAL'){var _0x27b502={};_0x27b502[_0x3d3fc5[_0x9608('0x27')]]={'$like':'%'+_0x2ac8d6[_0x9608('0x34')][_0x9608('0x3c')]+'%'};return _0x27b502;}})});}_0x1fe705=_[_0x9608('0x3e')]({},_0x1fe705,_0x2ac8d6[_0x9608('0x3f')]);var _0x710a9={'where':_0x1fe705['where']};return db[_0x9608('0x2b')]['count'](_0x710a9)[_0x9608('0x26')](function(_0x4cca30){_0x7cd1e9['count']=_0x4cca30;if(_0x2ac8d6['query']['includeAll']){_0x1fe705[_0x9608('0x40')]=[{'all':!![]}];}return db[_0x9608('0x2b')]['findAll'](_0x1fe705);})[_0x9608('0x26')](function(_0x159cae){_0x7cd1e9[_0x9608('0x41')]=_0x159cae;return _0x7cd1e9;})['then'](respondWithFilteredResult(_0x584926,_0x1fe705))[_0x9608('0x42')](handleError(_0x584926,null));};exports[_0x9608('0x43')]=function(_0x337ea6,_0x3173be){var _0x4b03f5={'raw':!![],'where':{'id':_0x337ea6[_0x9608('0x44')]['id']}},_0x5716ba={};_0x5716ba[_0x9608('0x30')]=_[_0x9608('0x45')](db[_0x9608('0x2b')]['rawAttributes']);_0x5716ba[_0x9608('0x34')]=_['keys'](_0x337ea6['query']);_0x5716ba[_0x9608('0x32')]=_['intersection'](_0x5716ba[_0x9608('0x30')],_0x5716ba['query']);_0x4b03f5[_0x9608('0x36')]=_[_0x9608('0x33')](_0x5716ba[_0x9608('0x30')],qs[_0x9608('0x35')](_0x337ea6[_0x9608('0x34')][_0x9608('0x35')]));_0x4b03f5[_0x9608('0x36')]=_0x4b03f5[_0x9608('0x36')]['length']?_0x4b03f5['attributes']:_0x5716ba[_0x9608('0x30')];if(_0x337ea6[_0x9608('0x34')][_0x9608('0x46')]){_0x4b03f5[_0x9608('0x40')]=[{'all':!![]}];}_0x4b03f5=_['merge']({},_0x4b03f5,_0x337ea6[_0x9608('0x3f')]);return db[_0x9608('0x2b')][_0x9608('0x47')](_0x4b03f5)[_0x9608('0x26')](handleEntityNotFound(_0x3173be,null))['then'](respondWithResult(_0x3173be,null))[_0x9608('0x42')](handleError(_0x3173be,null));};exports['create']=function(_0x51d414,_0x20d26d){return db['VoiceMailMessage'][_0x9608('0x48')](_0x51d414[_0x9608('0x49')],{})[_0x9608('0x26')](respondWithResult(_0x20d26d,0xc9))['catch'](handleError(_0x20d26d,null));};exports['update']=function(_0x1df3d5,_0x3e43b8){if(_0x1df3d5[_0x9608('0x49')]['id']){delete _0x1df3d5[_0x9608('0x49')]['id'];}return db[_0x9608('0x2b')][_0x9608('0x47')]({'where':{'id':_0x1df3d5['params']['id']}})[_0x9608('0x26')](handleEntityNotFound(_0x3e43b8,null))['then'](saveUpdates(_0x1df3d5['body'],null))['then'](respondWithResult(_0x3e43b8,null))[_0x9608('0x42')](handleError(_0x3e43b8,null));};exports['destroy']=function(_0x34d65e,_0x2b0d26){return db[_0x9608('0x2b')][_0x9608('0x47')]({'where':{'id':_0x34d65e['params']['id']}})[_0x9608('0x26')](handleEntityNotFound(_0x2b0d26,null))[_0x9608('0x26')](removeEntity(_0x2b0d26,null))[_0x9608('0x42')](handleError(_0x2b0d26,null));};exports['download']=function(_0x49526a,_0x3d8e2d,_0x226e13){return db[_0x9608('0x2b')]['find']({'where':{'id':_0x49526a[_0x9608('0x44')]['id']},'attributes':['id',_0x9608('0x4a'),'msg_id']})[_0x9608('0x26')](handleEntityNotFound(_0x3d8e2d,null))[_0x9608('0x26')](function(_0x38db80){if(_0x38db80){if(!_0x38db80[_0x9608('0x4a')]){throw new db[(_0x9608('0x4b'))][(_0x9608('0x4c'))](_0x9608('0x4d'));}var _0x3fd926={'Content-Type':_0x9608('0x4e'),'Content-Disposition':'attachment'};if(_0x38db80[_0x9608('0x4f')]){_0x3fd926[_0x9608('0x50')]=_0x9608('0x51')+_0x38db80['msg_id']+_0x9608('0x52');}_0x3d8e2d[_0x9608('0x21')](_0x3fd926);return _0x3d8e2d[_0x9608('0x28')](new Buffer(_0x38db80[_0x9608('0x4a')]));}})[_0x9608('0x42')](handleError(_0x3d8e2d,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4a73908..f4e0d92 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 _0x31c0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x1ed693,_0x562da9){var _0xc07fff=function(_0x334062){while(--_0x334062){_0x1ed693['push'](_0x1ed693['shift']());}};_0xc07fff(++_0x562da9);}(_0x31c0,0xc2));var _0x031c=function(_0x511d50,_0x527d32){_0x511d50=_0x511d50-0x0;var _0x473500=_0x31c0[_0x511d50];return _0x473500;};'use strict';var _=require('lodash');var util=require(_0x031c('0x0'));var logger=require(_0x031c('0x1'))(_0x031c('0x2'));var moment=require(_0x031c('0x3'));var BPromise=require(_0x031c('0x4'));var rp=require(_0x031c('0x5'));var fs=require('fs');var path=require(_0x031c('0x6'));var rimraf=require(_0x031c('0x7'));var config=require(_0x031c('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x031c('0x9')]=function(_0x428313,_0x5999b4){return _0x428313['define'](_0x031c('0xa'),attributes,{'tableName':_0x031c('0xb'),'paranoid':![],'indexes':[{'name':_0x031c('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x92c6=['voice_voicemail_messages','dir','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x2140ae,_0x276645){var _0x33ccc7=function(_0xedb37c){while(--_0xedb37c){_0x2140ae['push'](_0x2140ae['shift']());}};_0x33ccc7(++_0x276645);}(_0x92c6,0xe2));var _0x692c=function(_0x75e717,_0x458bd0){_0x75e717=_0x75e717-0x0;var _0x162c70=_0x92c6[_0x75e717];return _0x162c70;};'use strict';var _=require(_0x692c('0x0'));var util=require(_0x692c('0x1'));var logger=require(_0x692c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x692c('0x3'));var rp=require(_0x692c('0x4'));var fs=require('fs');var path=require(_0x692c('0x5'));var rimraf=require(_0x692c('0x6'));var config=require(_0x692c('0x7'));var attributes=require(_0x692c('0x8'));module[_0x692c('0x9')]=function(_0x3cf61a,_0x149bce){return _0x3cf61a[_0x692c('0xa')](_0x692c('0xb'),attributes,{'tableName':_0x692c('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x692c('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 14aa2c9..0122b6e 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 _0x97ad=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x97ad,0x127));var _0xd97a=function(_0x442095,_0x21d807){_0x442095=_0x442095-0x0;var _0x5233d3=_0x97ad[_0x442095];return _0x5233d3;};'use strict';var _=require('lodash');var util=require(_0xd97a('0x0'));var moment=require(_0xd97a('0x1'));var BPromise=require(_0xd97a('0x2'));var rs=require(_0xd97a('0x3'));var fs=require('fs');var Redis=require(_0xd97a('0x4'));var db=require(_0xd97a('0x5'))['db'];var utils=require(_0xd97a('0x6'));var logger=require(_0xd97a('0x7'))(_0xd97a('0x8'));var config=require('../../config/environment');var jayson=require(_0xd97a('0x9'));var client=jayson['client'][_0xd97a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e940e,_0xf2344b,_0x4fcb75){return new BPromise(function(_0x14277d,_0x2597fb){return client['request'](_0x4e940e,_0x4fcb75)['then'](function(_0x3d5590){logger['info'](_0xd97a('0xb'),_0xf2344b,_0xd97a('0xc'));logger[_0xd97a('0xd')](_0xd97a('0xe'),_0xf2344b,_0xd97a('0xc'),JSON[_0xd97a('0xf')](_0x3d5590));if(_0x3d5590[_0xd97a('0x10')]){if(_0x3d5590['error'][_0xd97a('0x11')]===0x1f4){logger[_0xd97a('0x10')](_0xd97a('0xb'),_0xf2344b,_0x3d5590[_0xd97a('0x10')][_0xd97a('0x12')]);return _0x2597fb(_0x3d5590[_0xd97a('0x10')]['message']);}logger['error'](_0xd97a('0xb'),_0xf2344b,_0x3d5590['error']['message']);return _0x14277d(_0x3d5590[_0xd97a('0x10')][_0xd97a('0x12')]);}else{logger[_0xd97a('0x13')](_0xd97a('0xb'),_0xf2344b,_0xd97a('0xc'));_0x14277d(_0x3d5590[_0xd97a('0x14')][_0xd97a('0x12')]);}})[_0xd97a('0x15')](function(_0xc71201){logger['error'](_0xd97a('0xb'),_0xf2344b,_0xc71201);_0x2597fb(_0xc71201);});});} \ No newline at end of file +var _0x4c94=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result'];(function(_0x118535,_0x1b9a59){var _0x5c1bfd=function(_0x458d89){while(--_0x458d89){_0x118535['push'](_0x118535['shift']());}};_0x5c1bfd(++_0x1b9a59);}(_0x4c94,0x1e4));var _0x44c9=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x4c94[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0x44c9('0x0'));var util=require(_0x44c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44c9('0x2'));var fs=require('fs');var Redis=require(_0x44c9('0x3'));var db=require(_0x44c9('0x4'))['db'];var utils=require(_0x44c9('0x5'));var logger=require('../../config/logger')(_0x44c9('0x6'));var config=require(_0x44c9('0x7'));var jayson=require(_0x44c9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e2de3,_0x5ac31d,_0x15da21){return new BPromise(function(_0x551ad2,_0x2b6679){return client[_0x44c9('0x9')](_0x5e2de3,_0x15da21)[_0x44c9('0xa')](function(_0x21260d){logger[_0x44c9('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x5ac31d,_0x44c9('0xc'));logger[_0x44c9('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5ac31d,_0x44c9('0xc'),JSON[_0x44c9('0xe')](_0x21260d));if(_0x21260d[_0x44c9('0xf')]){if(_0x21260d['error'][_0x44c9('0x10')]===0x1f4){logger[_0x44c9('0xf')](_0x44c9('0x11'),_0x5ac31d,_0x21260d[_0x44c9('0xf')][_0x44c9('0x12')]);return _0x2b6679(_0x21260d[_0x44c9('0xf')][_0x44c9('0x12')]);}logger[_0x44c9('0xf')](_0x44c9('0x11'),_0x5ac31d,_0x21260d[_0x44c9('0xf')][_0x44c9('0x12')]);return _0x551ad2(_0x21260d[_0x44c9('0xf')]['message']);}else{logger[_0x44c9('0xb')](_0x44c9('0x11'),_0x5ac31d,'request\x20sent');_0x551ad2(_0x21260d[_0x44c9('0x13')][_0x44c9('0x12')]);}})[_0x44c9('0x14')](function(_0x448224){logger[_0x44c9('0xf')](_0x44c9('0x11'),_0x5ac31d,_0x448224);_0x2b6679(_0x448224);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ac36762..7669bd1 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 _0x84de=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds','post','/:id/sounds','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x84de,0x1b7));var _0xe84d=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x84de[_0xf04c6d];return _0x4a804e;};'use strict';var multer=require(_0xe84d('0x0'));var util=require(_0xe84d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe84d('0x2')]();var fs_extra=require(_0xe84d('0x3'));var auth=require(_0xe84d('0x4'));var interaction=require(_0xe84d('0x5'));var config=require(_0xe84d('0x6'));var controller=require(_0xe84d('0x7'));router[_0xe84d('0x8')]('/',auth[_0xe84d('0x9')](),controller['index']);router[_0xe84d('0x8')](_0xe84d('0xa'),auth['isAuthenticated'](),controller[_0xe84d('0xb')]);router[_0xe84d('0x8')]('/:id/sounds',auth[_0xe84d('0x9')](),controller[_0xe84d('0xc')]);router[_0xe84d('0xd')]('/',auth[_0xe84d('0x9')](),controller['create']);router['post'](_0xe84d('0xe'),auth[_0xe84d('0x9')](),controller['addSound']);router[_0xe84d('0xf')]('/:id',auth[_0xe84d('0x9')](),controller['update']);router[_0xe84d('0x10')](_0xe84d('0xa'),auth[_0xe84d('0x9')](),controller[_0xe84d('0x11')]);router[_0xe84d('0x10')](_0xe84d('0x12'),auth[_0xe84d('0x9')](),controller[_0xe84d('0x13')]);module[_0xe84d('0x14')]=router; \ No newline at end of file +var _0xeccb=['/:id/sounds','post','create','put','/:id','update','destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','show'];(function(_0x226190,_0x95f7b1){var _0x253fe7=function(_0x5c3a90){while(--_0x5c3a90){_0x226190['push'](_0x226190['shift']());}};_0x253fe7(++_0x95f7b1);}(_0xeccb,0xab));var _0xbecc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeccb[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbecc('0x0'));var timeout=require(_0xbecc('0x1'));var express=require(_0xbecc('0x2'));var router=express[_0xbecc('0x3')]();var fs_extra=require(_0xbecc('0x4'));var auth=require(_0xbecc('0x5'));var interaction=require(_0xbecc('0x6'));var config=require(_0xbecc('0x7'));var controller=require(_0xbecc('0x8'));router['get']('/',auth[_0xbecc('0x9')](),controller[_0xbecc('0xa')]);router[_0xbecc('0xb')]('/:id',auth[_0xbecc('0x9')](),controller[_0xbecc('0xc')]);router[_0xbecc('0xb')](_0xbecc('0xd'),auth[_0xbecc('0x9')](),controller['getSounds']);router[_0xbecc('0xe')]('/',auth['isAuthenticated'](),controller[_0xbecc('0xf')]);router['post']('/:id/sounds',auth['isAuthenticated'](),controller['addSound']);router[_0xbecc('0x10')](_0xbecc('0x11'),auth[_0xbecc('0x9')](),controller[_0xbecc('0x12')]);router['delete'](_0xbecc('0x11'),auth[_0xbecc('0x9')](),controller[_0xbecc('0x13')]);router['delete'](_0xbecc('0x14'),auth['isAuthenticated'](),controller[_0xbecc('0x15')]);module[_0xbecc('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 69007d6..1f8e789 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 _0xb2c8=['custom','files','quietmp3nb','mp3','alpha','BOOLEAN','exports','STRING','name'];(function(_0x45a5a4,_0x4649dd){var _0x14c450=function(_0x4f05c8){while(--_0x4f05c8){_0x45a5a4['push'](_0x45a5a4['shift']());}};_0x14c450(++_0x4649dd);}(_0xb2c8,0xba));var _0x8b2c=function(_0x38ead5,_0x5b4fa2){_0x38ead5=_0x38ead5-0x0;var _0x4e40bc=_0xb2c8[_0x38ead5];return _0x4e40bc;};'use strict';var Sequelize=require('sequelize');module[_0x8b2c('0x0')]={'name':{'type':Sequelize[_0x8b2c('0x1')],'allowNull':![],'unique':_0x8b2c('0x2')},'mode':{'type':Sequelize['ENUM'](_0x8b2c('0x3'),_0x8b2c('0x4'),'mp3nb',_0x8b2c('0x5'),'quietmp3',_0x8b2c('0x6')),'allowNull':!![],'defaultValue':_0x8b2c('0x4')},'directory':{'type':Sequelize[_0x8b2c('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x8b2c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8b2c('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8b2c('0x1')],'allowNull':!![],'defaultValue':_0x8b2c('0x7')},'format':{'type':Sequelize[_0x8b2c('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x8b2c('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b94=['sequelize','exports','STRING','name','ENUM','custom','mp3nb','files','TIMESTAMP','BOOLEAN'];(function(_0x208ec9,_0x2ecf52){var _0x489740=function(_0x1909fd){while(--_0x1909fd){_0x208ec9['push'](_0x208ec9['shift']());}};_0x489740(++_0x2ecf52);}(_0x3b94,0x154));var _0x43b9=function(_0x561a55,_0x1fb793){_0x561a55=_0x561a55-0x0;var _0x17b9b9=_0x3b94[_0x561a55];return _0x17b9b9;};'use strict';var Sequelize=require(_0x43b9('0x0'));module[_0x43b9('0x1')]={'name':{'type':Sequelize[_0x43b9('0x2')],'allowNull':![],'unique':_0x43b9('0x3')},'mode':{'type':Sequelize[_0x43b9('0x4')](_0x43b9('0x5'),'files',_0x43b9('0x6'),'quietmp3nb','quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x43b9('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x43b9('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x43b9('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x43b9('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x43b9('0x8')},'defaultEntry':{'type':Sequelize[_0x43b9('0x9')],'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 28ce707..8be0680 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 _0x890d=['merge','find','body','catch','create','sequelize','transaction','mode','files','directory','server/files/moh','mkdirSync','0777','role','user','userProfileId','autoAssociation','error','readdirSync','forEach','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','id2','unlinkSync','getSounds','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','undefined','limit','count','set','apply','reject','save','update','destroy','get','UserProfileResource','then','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','includeAll','include','rows','params','keys','length'];(function(_0x5de6a6,_0x29effa){var _0x87a12c=function(_0x30d049){while(--_0x30d049){_0x5de6a6['push'](_0x5de6a6['shift']());}};_0x87a12c(++_0x29effa);}(_0x890d,0x17d));var _0xd890=function(_0x54516d,_0x8f282f){_0x54516d=_0x54516d-0x0;var _0x2d70b5=_0x890d[_0x54516d];return _0x2d70b5;};'use strict';var emlformat=require(_0xd890('0x0'));var rimraf=require(_0xd890('0x1'));var zipdir=require(_0xd890('0x2'));var jsonpatch=require(_0xd890('0x3'));var rp=require(_0xd890('0x4'));var moment=require(_0xd890('0x5'));var BPromise=require(_0xd890('0x6'));var Mustache=require(_0xd890('0x7'));var util=require('util');var path=require(_0xd890('0x8'));var sox=require(_0xd890('0x9'));var csv=require(_0xd890('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd890('0xb'));var squel=require(_0xd890('0xc'));var crypto=require(_0xd890('0xd'));var jsforce=require(_0xd890('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd890('0xf'));var Papa=require(_0xd890('0x10'));var Redis=require('ioredis');var authService=require(_0xd890('0x11'));var qs=require(_0xd890('0x12'));var as=require(_0xd890('0x13'));var hardwareService=require(_0xd890('0x14'));var logger=require(_0xd890('0x15'))(_0xd890('0x16'));var utils=require('../../config/utils');var config=require(_0xd890('0x17'));var licenseUtil=require(_0xd890('0x18'));var db=require(_0xd890('0x19'))['db'];function respondWithStatusCode(_0x25e9d2,_0x36a79e){_0x36a79e=_0x36a79e||0xcc;return function(_0x12d7d4){if(_0x12d7d4){return _0x25e9d2['sendStatus'](_0x36a79e);}return _0x25e9d2[_0xd890('0x1a')](_0x36a79e)[_0xd890('0x1b')]();};}function respondWithResult(_0x39badf,_0x37d0bf){_0x37d0bf=_0x37d0bf||0xc8;return function(_0x353bae){if(_0x353bae){return _0x39badf[_0xd890('0x1a')](_0x37d0bf)[_0xd890('0x1c')](_0x353bae);}};}function respondWithFilteredResult(_0x3d182c,_0x471d40){return function(_0x153396){if(_0x153396){var _0x54a1d8=typeof _0x471d40[_0xd890('0x1d')]===_0xd890('0x1e')&&typeof _0x471d40[_0xd890('0x1f')]===_0xd890('0x1e');var _0x272593=_0x153396[_0xd890('0x20')];var _0x458a34=_0x54a1d8?0x0:_0x471d40[_0xd890('0x1d')];var _0x52a220=_0x54a1d8?_0x153396[_0xd890('0x20')]:_0x471d40[_0xd890('0x1d')]+_0x471d40[_0xd890('0x1f')];var _0x521cc1;if(_0x52a220>=_0x272593){_0x52a220=_0x272593;_0x521cc1=0xc8;}else{_0x521cc1=0xce;}_0x3d182c['status'](_0x521cc1);return _0x3d182c[_0xd890('0x21')]('Content-Range',_0x458a34+'-'+_0x52a220+'/'+_0x272593)[_0xd890('0x1c')](_0x153396);}return null;};}function patchUpdates(_0x2e91e5){return function(_0xe14714){try{jsonpatch[_0xd890('0x22')](_0xe14714,_0x2e91e5,!![]);}catch(_0x322fbb){return BPromise[_0xd890('0x23')](_0x322fbb);}return _0xe14714[_0xd890('0x24')]();};}function saveUpdates(_0x3ca659,_0x2150b8){return function(_0x392189){if(_0x392189){return _0x392189[_0xd890('0x25')](_0x3ca659)['then'](function(_0x4617d9){return _0x4617d9;});}return null;};}function removeEntity(_0x2aad28,_0x1b0ccb){return function(_0x552e79){if(_0x552e79){return _0x552e79[_0xd890('0x26')]()['then'](function(){var _0x341786=_0x552e79[_0xd890('0x27')]({'plain':!![]});var _0x4e5b7a='MusicOnHolds';return db[_0xd890('0x28')]['destroy']({'where':{'type':_0x4e5b7a,'resourceId':_0x341786['id']}})[_0xd890('0x29')](function(){return _0x552e79;});})['then'](function(){_0x2aad28[_0xd890('0x1a')](0xcc)[_0xd890('0x1b')]();});}};}function handleEntityNotFound(_0x374a96,_0x55061b){return function(_0x1ba70){if(!_0x1ba70){_0x374a96['sendStatus'](0x194);}return _0x1ba70;};}function handleError(_0x9dd661,_0x53df8e){_0x53df8e=_0x53df8e||0x1f4;return function(_0x34563a){logger['error'](_0x34563a[_0xd890('0x2a')]);if(_0x34563a[_0xd890('0x2b')]){delete _0x34563a[_0xd890('0x2b')];}_0x9dd661[_0xd890('0x1a')](_0x53df8e)['send'](_0x34563a);};}exports[_0xd890('0x2c')]=function(_0x383bd0,_0x50b287){var _0x3a2542={},_0x586641={},_0x47ed21={'count':0x0,'rows':[]};var _0x27cbf1=_['map'](db[_0xd890('0x2d')][_0xd890('0x2e')],function(_0x24022c){return{'name':_0x24022c[_0xd890('0x2f')],'type':_0x24022c[_0xd890('0x30')][_0xd890('0x31')]};});_0x586641[_0xd890('0x32')]=_['map'](_0x27cbf1,_0xd890('0x2b'));_0x586641[_0xd890('0x33')]=_['keys'](_0x383bd0[_0xd890('0x33')]);_0x586641[_0xd890('0x34')]=_[_0xd890('0x35')](_0x586641[_0xd890('0x32')],_0x586641[_0xd890('0x33')]);_0x3a2542[_0xd890('0x36')]=_[_0xd890('0x35')](_0x586641[_0xd890('0x32')],qs[_0xd890('0x37')](_0x383bd0[_0xd890('0x33')]['fields']));_0x3a2542[_0xd890('0x36')]=_0x3a2542[_0xd890('0x36')]['length']?_0x3a2542[_0xd890('0x36')]:_0x586641['model'];if(!_0x383bd0[_0xd890('0x33')][_0xd890('0x38')](_0xd890('0x39'))){_0x3a2542[_0xd890('0x1f')]=qs[_0xd890('0x1f')](_0x383bd0['query'][_0xd890('0x1f')]);_0x3a2542['offset']=qs[_0xd890('0x1d')](_0x383bd0[_0xd890('0x33')][_0xd890('0x1d')]);}_0x3a2542[_0xd890('0x3a')]=qs[_0xd890('0x3b')](_0x383bd0[_0xd890('0x33')][_0xd890('0x3b')]);delete _0x383bd0[_0xd890('0x33')][_0xd890('0x3b')];_0x3a2542[_0xd890('0x3c')]=qs[_0xd890('0x34')](_[_0xd890('0x3d')](_0x383bd0[_0xd890('0x33')],_0x586641['filters']),_0x27cbf1);if(_0x383bd0[_0xd890('0x33')]['filter']){_0x3a2542[_0xd890('0x3c')]=_['merge'](_0x3a2542[_0xd890('0x3c')],{'$or':_[_0xd890('0x3e')](_0x27cbf1,function(_0x37adc9){if(_0x37adc9[_0xd890('0x30')]!==_0xd890('0x3f')){var _0x4f5e39={};_0x4f5e39[_0x37adc9[_0xd890('0x2b')]]={'$like':'%'+_0x383bd0['query'][_0xd890('0x40')]+'%'};return _0x4f5e39;}})});}_0x3a2542=_['merge']({},_0x3a2542,_0x383bd0['options']);var _0xf06b15={'where':_0x3a2542[_0xd890('0x3c')]};return db['VoiceMusicOnHold'][_0xd890('0x20')](_0xf06b15)[_0xd890('0x29')](function(_0x45579d){_0x47ed21[_0xd890('0x20')]=_0x45579d;if(_0x383bd0[_0xd890('0x33')][_0xd890('0x41')]){_0x3a2542[_0xd890('0x42')]=[{'all':!![]}];}return db[_0xd890('0x2d')]['findAll'](_0x3a2542);})[_0xd890('0x29')](function(_0xd14386){_0x47ed21[_0xd890('0x43')]=_0xd14386;return _0x47ed21;})[_0xd890('0x29')](respondWithFilteredResult(_0x50b287,_0x3a2542))['catch'](handleError(_0x50b287,null));};exports['show']=function(_0x5606e8,_0x2d676a){var _0x644a5d={'raw':![],'where':{'id':_0x5606e8[_0xd890('0x44')]['id']}},_0x4e2a8d={};_0x4e2a8d[_0xd890('0x32')]=_[_0xd890('0x45')](db[_0xd890('0x2d')][_0xd890('0x2e')]);_0x4e2a8d['query']=_[_0xd890('0x45')](_0x5606e8[_0xd890('0x33')]);_0x4e2a8d['filters']=_[_0xd890('0x35')](_0x4e2a8d[_0xd890('0x32')],_0x4e2a8d[_0xd890('0x33')]);_0x644a5d[_0xd890('0x36')]=_[_0xd890('0x35')](_0x4e2a8d[_0xd890('0x32')],qs[_0xd890('0x37')](_0x5606e8[_0xd890('0x33')]['fields']));_0x644a5d[_0xd890('0x36')]=_0x644a5d[_0xd890('0x36')][_0xd890('0x46')]?_0x644a5d[_0xd890('0x36')]:_0x4e2a8d[_0xd890('0x32')];if(_0x5606e8['query'][_0xd890('0x41')]){_0x644a5d[_0xd890('0x42')]=[{'all':!![]}];}_0x644a5d=_[_0xd890('0x47')]({},_0x644a5d,_0x5606e8['options']);return db['VoiceMusicOnHold'][_0xd890('0x48')](_0x644a5d)[_0xd890('0x29')](handleEntityNotFound(_0x2d676a,null))[_0xd890('0x29')](respondWithResult(_0x2d676a,null))['catch'](handleError(_0x2d676a,null));};exports[_0xd890('0x25')]=function(_0x348379,_0x48857a){if(_0x348379['body']['id']){delete _0x348379[_0xd890('0x49')]['id'];}return db[_0xd890('0x2d')][_0xd890('0x48')]({'where':{'id':_0x348379[_0xd890('0x44')]['id']}})[_0xd890('0x29')](handleEntityNotFound(_0x48857a,null))[_0xd890('0x29')](saveUpdates(_0x348379['body'],null))['then'](respondWithResult(_0x48857a,null))[_0xd890('0x4a')](handleError(_0x48857a,null));};exports[_0xd890('0x4b')]=function(_0x33caee,_0x2fad37,_0x298044){return db[_0xd890('0x4c')][_0xd890('0x4d')](function(_0x1b13c4){if(_0x33caee[_0xd890('0x49')][_0xd890('0x4e')]===_0xd890('0x4f')){_0x33caee[_0xd890('0x49')][_0xd890('0x50')]=path['join'](config['root'],_0xd890('0x51'),_0x33caee[_0xd890('0x49')]['name']);}return db['VoiceMusicOnHold'][_0xd890('0x4b')](_0x33caee[_0xd890('0x49')],{'transaction':_0x1b13c4})[_0xd890('0x29')](function(_0x2b207a){if(_0x33caee[_0xd890('0x49')][_0xd890('0x4e')]===_0xd890('0x4f')){fs[_0xd890('0x52')](_0x2b207a['directory'],parseInt(_0xd890('0x53'),0x8));}var _0xa087c5=_0x33caee['user'][_0xd890('0x27')]({'plain':!![]});if(!_0xa087c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa087c5[_0xd890('0x54')]===_0xd890('0x55')){var _0x1c2390=_0x2b207a['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0xa087c5[_0xd890('0x56')]},'raw':!![]})['then'](function(_0x1e9e7a){if(_0x1e9e7a&&_0x1e9e7a[_0xd890('0x57')]===0x0){return db['UserProfileResource'][_0xd890('0x4b')]({'name':_0x1c2390[_0xd890('0x2b')],'resourceId':_0x1c2390['id'],'type':_0x1e9e7a[_0xd890('0x2b')],'sectionId':_0x1e9e7a['id']},{})[_0xd890('0x29')](function(){return _0x2b207a;});}else{return _0x2b207a;}})[_0xd890('0x4a')](function(_0x12fd8a){logger[_0xd890('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12fd8a);});}return _0x2b207a;});})['then'](respondWithResult(_0x2fad37,0xc9))[_0xd890('0x4a')](handleError(_0x2fad37,null));};exports[_0xd890('0x26')]=function(_0x465a75,_0x2227f7,_0x442104){var _0x775ff0;return db[_0xd890('0x2d')]['find']({'where':{'id':_0x465a75[_0xd890('0x44')]['id']}})[_0xd890('0x29')](function(_0x5acc2d){if(_0x5acc2d){return db[_0xd890('0x4c')][_0xd890('0x4d')](function(_0x368ce7){return _0x5acc2d[_0xd890('0x26')]({'transaction':_0x368ce7,'raw':!![]})[_0xd890('0x29')](function(_0x1177cb){if(_0x1177cb[_0xd890('0x50')]){fs[_0xd890('0x59')](_0x1177cb[_0xd890('0x50')])[_0xd890('0x5a')](function(_0x161d0d){fs['unlinkSync'](path[_0xd890('0x5b')](_0x1177cb[_0xd890('0x50')],_0x161d0d));});fs[_0xd890('0x5c')](_0x1177cb[_0xd890('0x50')]);}return _0x1177cb;});})['catch'](function(_0x6302e2){throw new db[(_0xd890('0x5d'))][(_0xd890('0x5e'))](_0x6302e2[_0xd890('0x5f')]);});}})[_0xd890('0x29')](handleEntityNotFound(_0x2227f7,null))[_0xd890('0x29')](removeEntity(_0x2227f7,null))[_0xd890('0x4a')](handleError(_0x2227f7,null));};exports['addSound']=function(_0x46df51,_0x2433d2,_0x40c994){return db['sequelize'][_0xd890('0x4d')](function(_0x3c2d69){var _0x492ad5;return db[_0xd890('0x2d')][_0xd890('0x48')]({'where':{'id':_0x46df51[_0xd890('0x44')]['id']}})[_0xd890('0x29')](function(_0x12b32a){if(_0x12b32a){_0x492ad5=_0x12b32a;return _0x12b32a[_0xd890('0x60')](_0x46df51[_0xd890('0x49')]['id'],{'transaction':_0x3c2d69});}})[_0xd890('0x29')](function(_0x59f153){if(_0x59f153){return db[_0xd890('0x61')][_0xd890('0x62')]({'where':{'id':_0x46df51[_0xd890('0x49')]['id']},'attributes':['id',_0xd890('0x2b'),_0xd890('0x63'),_0xd890('0x64'),_0xd890('0x65')],'raw':!![]});}})[_0xd890('0x29')](function(_0x322528){if(_0x322528){var _0x58b375=path[_0xd890('0x5b')](config[_0xd890('0x66')],_0xd890('0x67'),util[_0xd890('0x68')](_0xd890('0x69'),path[_0xd890('0x6a')](_0x322528[_0xd890('0x63')],path[_0xd890('0x6b')](_0x322528[_0xd890('0x63')])),_0x322528['converted_format']));var _0x3180a7=path[_0xd890('0x5b')](config['root'],_0xd890('0x51'),_0x492ad5[_0xd890('0x2b')],util[_0xd890('0x68')](_0xd890('0x69'),_0x322528[_0xd890('0x2b')],_0x322528[_0xd890('0x64')]));fs[_0xd890('0x6c')](_0x58b375,_0x3180a7);return _0x322528;}})[_0xd890('0x4a')](function(_0x34331e){throw new db[(_0xd890('0x5d'))][(_0xd890('0x5e'))](_0x34331e[_0xd890('0x5f')]);});})['then'](handleEntityNotFound(_0x2433d2,null))[_0xd890('0x29')](respondWithResult(_0x2433d2,0xc9))[_0xd890('0x4a')](handleError(_0x2433d2,null));};exports['removeSound']=function(_0x52c5e6,_0xa269f1,_0x4e0905){return db[_0xd890('0x4c')][_0xd890('0x4d')](function(_0x4a0f56){var _0x43c2f5;return db[_0xd890('0x2d')][_0xd890('0x62')]({'where':{'id':_0x52c5e6['params']['id']}})['then'](handleEntityNotFound(_0xa269f1,null))[_0xd890('0x29')](function(_0x45a171){if(_0x45a171){_0x43c2f5=_0x45a171;return _0x45a171['removeSound'](_0x52c5e6[_0xd890('0x44')][_0xd890('0x6d')]);}})[_0xd890('0x29')](function(_0x1fdb77){if(_0x1fdb77){return db[_0xd890('0x61')][_0xd890('0x62')]({'where':{'id':_0x52c5e6[_0xd890('0x44')][_0xd890('0x6d')]},'attributes':['id',_0xd890('0x2b'),_0xd890('0x63'),_0xd890('0x64'),'createdAt'],'raw':!![]});}})[_0xd890('0x29')](function(_0x393984){if(_0x393984){fs[_0xd890('0x6e')](path[_0xd890('0x5b')](_0x43c2f5[_0xd890('0x50')],util[_0xd890('0x68')](_0xd890('0x69'),_0x393984[_0xd890('0x2b')],_0x393984[_0xd890('0x64')])));return _0x393984;}})['catch'](function(_0x225324){throw new db[(_0xd890('0x5d'))][(_0xd890('0x5e'))](_0x225324[_0xd890('0x5f')]);});})[_0xd890('0x29')](handleEntityNotFound(_0xa269f1,null))[_0xd890('0x29')](respondWithStatusCode(_0xa269f1,0xcc))['catch'](handleError(_0xa269f1,null));};exports[_0xd890('0x6f')]=function(_0x4c7261,_0x46eec6,_0x32577d){var _0x1ff57f={};var _0x1a9e8a={};var _0x5151d1;var _0x28dad5;return db['VoiceMusicOnHold'][_0xd890('0x62')]({'where':{'id':_0x4c7261[_0xd890('0x44')]['id']}})[_0xd890('0x29')](handleEntityNotFound(_0x46eec6,null))[_0xd890('0x29')](function(_0x279616){if(_0x279616){_0x5151d1=_0x279616;_0x1a9e8a['model']=_[_0xd890('0x45')](db[_0xd890('0x61')][_0xd890('0x2e')]);_0x1a9e8a[_0xd890('0x33')]=_[_0xd890('0x45')](_0x4c7261[_0xd890('0x33')]);_0x1a9e8a[_0xd890('0x34')]=_[_0xd890('0x35')](_0x1a9e8a[_0xd890('0x32')],_0x1a9e8a[_0xd890('0x33')]);_0x1ff57f[_0xd890('0x36')]=_[_0xd890('0x35')](_0x1a9e8a['model'],qs[_0xd890('0x37')](_0x4c7261[_0xd890('0x33')][_0xd890('0x37')]));_0x1ff57f[_0xd890('0x36')]=_0x1ff57f['attributes'][_0xd890('0x46')]?_0x1ff57f[_0xd890('0x36')]:_0x1a9e8a[_0xd890('0x32')];_0x1ff57f[_0xd890('0x3a')]=qs[_0xd890('0x3b')](_0x4c7261[_0xd890('0x33')][_0xd890('0x3b')]);_0x1ff57f[_0xd890('0x3c')]=qs[_0xd890('0x34')](_[_0xd890('0x3d')](_0x4c7261[_0xd890('0x33')],_0x1a9e8a[_0xd890('0x34')]));if(_0x4c7261[_0xd890('0x33')][_0xd890('0x40')]){_0x1ff57f['where']=_[_0xd890('0x47')](_0x1ff57f[_0xd890('0x3c')],{'$or':_['map'](_0x1ff57f[_0xd890('0x36')],function(_0x533d8f){var _0x2d5227={};_0x2d5227[_0x533d8f]={'$like':'%'+_0x4c7261[_0xd890('0x33')][_0xd890('0x40')]+'%'};return _0x2d5227;})});}_0x1ff57f=_[_0xd890('0x47')]({},_0x1ff57f,_0x4c7261[_0xd890('0x70')]);return _0x5151d1[_0xd890('0x6f')](_0x1ff57f);}})['then'](function(_0x301905){if(_0x301905){_0x28dad5=_0x301905[_0xd890('0x46')];if(!_0x4c7261[_0xd890('0x33')]['hasOwnProperty']('nolimit')){_0x1ff57f['limit']=qs[_0xd890('0x1f')](_0x4c7261[_0xd890('0x33')]['limit']);_0x1ff57f[_0xd890('0x1d')]=qs[_0xd890('0x1d')](_0x4c7261[_0xd890('0x33')][_0xd890('0x1d')]);}return _0x5151d1[_0xd890('0x6f')](_0x1ff57f);}})[_0xd890('0x29')](function(_0xf8fb10){if(_0xf8fb10){return _0xf8fb10?{'count':_0x28dad5,'rows':_0xf8fb10}:null;}})[_0xd890('0x29')](respondWithResult(_0x46eec6,null))['catch'](handleError(_0x46eec6,null));}; \ No newline at end of file +var _0x8e27=['basename','id2','createdAt','format','getSounds','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','map','VoiceMusicOnHold','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','create','sequelize','transaction','mode','files','directory','join','server/files/moh','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','%s.%s'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0x8e27,0x14a));var _0x78e2=function(_0x39017c,_0x15f210){_0x39017c=_0x39017c-0x0;var _0x584624=_0x8e27[_0x39017c];return _0x584624;};'use strict';var emlformat=require(_0x78e2('0x0'));var rimraf=require(_0x78e2('0x1'));var zipdir=require(_0x78e2('0x2'));var jsonpatch=require(_0x78e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x78e2('0x4'));var Mustache=require(_0x78e2('0x5'));var util=require(_0x78e2('0x6'));var path=require(_0x78e2('0x7'));var sox=require(_0x78e2('0x8'));var csv=require(_0x78e2('0x9'));var ejs=require(_0x78e2('0xa'));var fs=require('fs');var fs_extra=require(_0x78e2('0xb'));var _=require(_0x78e2('0xc'));var squel=require(_0x78e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x78e2('0xe'));var deskjs=require(_0x78e2('0xf'));var toCsv=require(_0x78e2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78e2('0x10'));var qs=require(_0x78e2('0x11'));var as=require(_0x78e2('0x12'));var hardwareService=require(_0x78e2('0x13'));var logger=require('../../config/logger')(_0x78e2('0x14'));var utils=require(_0x78e2('0x15'));var config=require(_0x78e2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x78e2('0x17'))['db'];function respondWithStatusCode(_0x5d0922,_0x381525){_0x381525=_0x381525||0xcc;return function(_0x3f9f7d){if(_0x3f9f7d){return _0x5d0922[_0x78e2('0x18')](_0x381525);}return _0x5d0922[_0x78e2('0x19')](_0x381525)[_0x78e2('0x1a')]();};}function respondWithResult(_0x4efdcd,_0x186802){_0x186802=_0x186802||0xc8;return function(_0x46184f){if(_0x46184f){return _0x4efdcd[_0x78e2('0x19')](_0x186802)[_0x78e2('0x1b')](_0x46184f);}};}function respondWithFilteredResult(_0x5d5514,_0x260b5c){return function(_0x36fe32){if(_0x36fe32){var _0x3afef9=typeof _0x260b5c[_0x78e2('0x1c')]===_0x78e2('0x1d')&&typeof _0x260b5c[_0x78e2('0x1e')]===_0x78e2('0x1d');var _0x50f3f1=_0x36fe32[_0x78e2('0x1f')];var _0x579730=_0x3afef9?0x0:_0x260b5c['offset'];var _0x57f9c6=_0x3afef9?_0x36fe32[_0x78e2('0x1f')]:_0x260b5c['offset']+_0x260b5c['limit'];var _0x30e2d8;if(_0x57f9c6>=_0x50f3f1){_0x57f9c6=_0x50f3f1;_0x30e2d8=0xc8;}else{_0x30e2d8=0xce;}_0x5d5514[_0x78e2('0x19')](_0x30e2d8);return _0x5d5514[_0x78e2('0x20')]('Content-Range',_0x579730+'-'+_0x57f9c6+'/'+_0x50f3f1)['json'](_0x36fe32);}return null;};}function patchUpdates(_0x5c6f0a){return function(_0x243b41){try{jsonpatch[_0x78e2('0x21')](_0x243b41,_0x5c6f0a,!![]);}catch(_0x3a30d8){return BPromise[_0x78e2('0x22')](_0x3a30d8);}return _0x243b41[_0x78e2('0x23')]();};}function saveUpdates(_0x21011b,_0x43e127){return function(_0x44bef7){if(_0x44bef7){return _0x44bef7[_0x78e2('0x24')](_0x21011b)[_0x78e2('0x25')](function(_0x1f0577){return _0x1f0577;});}return null;};}function removeEntity(_0x593c55,_0x3546a0){return function(_0x4ad83b){if(_0x4ad83b){return _0x4ad83b[_0x78e2('0x26')]()[_0x78e2('0x25')](function(){var _0x4b0518=_0x4ad83b[_0x78e2('0x27')]({'plain':!![]});var _0x5708f7=_0x78e2('0x28');return db[_0x78e2('0x29')][_0x78e2('0x26')]({'where':{'type':_0x5708f7,'resourceId':_0x4b0518['id']}})[_0x78e2('0x25')](function(){return _0x4ad83b;});})[_0x78e2('0x25')](function(){_0x593c55[_0x78e2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1000f7,_0x3a8581){return function(_0x2bd676){if(!_0x2bd676){_0x1000f7[_0x78e2('0x18')](0x194);}return _0x2bd676;};}function handleError(_0x4a0d08,_0x3c09ec){_0x3c09ec=_0x3c09ec||0x1f4;return function(_0x440ca9){logger[_0x78e2('0x2a')](_0x440ca9['stack']);if(_0x440ca9[_0x78e2('0x2b')]){delete _0x440ca9[_0x78e2('0x2b')];}_0x4a0d08[_0x78e2('0x19')](_0x3c09ec)[_0x78e2('0x2c')](_0x440ca9);};}exports['index']=function(_0x1d3fe2,_0x2e1efe){var _0x5a9001={},_0x48845a={},_0x4aecf0={'count':0x0,'rows':[]};var _0x280c88=_[_0x78e2('0x2d')](db[_0x78e2('0x2e')][_0x78e2('0x2f')],function(_0x11ee47){return{'name':_0x11ee47['fieldName'],'type':_0x11ee47[_0x78e2('0x30')]['key']};});_0x48845a[_0x78e2('0x31')]=_[_0x78e2('0x2d')](_0x280c88,_0x78e2('0x2b'));_0x48845a[_0x78e2('0x32')]=_[_0x78e2('0x33')](_0x1d3fe2[_0x78e2('0x32')]);_0x48845a[_0x78e2('0x34')]=_[_0x78e2('0x35')](_0x48845a[_0x78e2('0x31')],_0x48845a[_0x78e2('0x32')]);_0x5a9001[_0x78e2('0x36')]=_['intersection'](_0x48845a[_0x78e2('0x31')],qs[_0x78e2('0x37')](_0x1d3fe2[_0x78e2('0x32')][_0x78e2('0x37')]));_0x5a9001['attributes']=_0x5a9001[_0x78e2('0x36')][_0x78e2('0x38')]?_0x5a9001[_0x78e2('0x36')]:_0x48845a[_0x78e2('0x31')];if(!_0x1d3fe2[_0x78e2('0x32')]['hasOwnProperty'](_0x78e2('0x39'))){_0x5a9001[_0x78e2('0x1e')]=qs[_0x78e2('0x1e')](_0x1d3fe2[_0x78e2('0x32')][_0x78e2('0x1e')]);_0x5a9001['offset']=qs['offset'](_0x1d3fe2[_0x78e2('0x32')][_0x78e2('0x1c')]);}_0x5a9001[_0x78e2('0x3a')]=qs[_0x78e2('0x3b')](_0x1d3fe2['query'][_0x78e2('0x3b')]);delete _0x1d3fe2[_0x78e2('0x32')][_0x78e2('0x3b')];_0x5a9001[_0x78e2('0x3c')]=qs[_0x78e2('0x34')](_['pick'](_0x1d3fe2[_0x78e2('0x32')],_0x48845a[_0x78e2('0x34')]),_0x280c88);if(_0x1d3fe2[_0x78e2('0x32')][_0x78e2('0x3d')]){_0x5a9001['where']=_[_0x78e2('0x3e')](_0x5a9001[_0x78e2('0x3c')],{'$or':_['map'](_0x280c88,function(_0x1feb2a){if(_0x1feb2a[_0x78e2('0x30')]!=='VIRTUAL'){var _0x416bc8={};_0x416bc8[_0x1feb2a[_0x78e2('0x2b')]]={'$like':'%'+_0x1d3fe2['query'][_0x78e2('0x3d')]+'%'};return _0x416bc8;}})});}_0x5a9001=_[_0x78e2('0x3e')]({},_0x5a9001,_0x1d3fe2[_0x78e2('0x3f')]);var _0x48db6d={'where':_0x5a9001[_0x78e2('0x3c')]};return db[_0x78e2('0x2e')][_0x78e2('0x1f')](_0x48db6d)[_0x78e2('0x25')](function(_0x14ed0d){_0x4aecf0[_0x78e2('0x1f')]=_0x14ed0d;if(_0x1d3fe2[_0x78e2('0x32')][_0x78e2('0x40')]){_0x5a9001[_0x78e2('0x41')]=[{'all':!![]}];}return db[_0x78e2('0x2e')][_0x78e2('0x42')](_0x5a9001);})[_0x78e2('0x25')](function(_0x4664b3){_0x4aecf0['rows']=_0x4664b3;return _0x4aecf0;})[_0x78e2('0x25')](respondWithFilteredResult(_0x2e1efe,_0x5a9001))[_0x78e2('0x43')](handleError(_0x2e1efe,null));};exports[_0x78e2('0x44')]=function(_0x16469d,_0xc431a0){var _0x38781c={'raw':![],'where':{'id':_0x16469d[_0x78e2('0x45')]['id']}},_0x5db281={};_0x5db281[_0x78e2('0x31')]=_['keys'](db[_0x78e2('0x2e')][_0x78e2('0x2f')]);_0x5db281[_0x78e2('0x32')]=_['keys'](_0x16469d['query']);_0x5db281['filters']=_[_0x78e2('0x35')](_0x5db281[_0x78e2('0x31')],_0x5db281['query']);_0x38781c[_0x78e2('0x36')]=_['intersection'](_0x5db281[_0x78e2('0x31')],qs[_0x78e2('0x37')](_0x16469d[_0x78e2('0x32')]['fields']));_0x38781c[_0x78e2('0x36')]=_0x38781c[_0x78e2('0x36')][_0x78e2('0x38')]?_0x38781c[_0x78e2('0x36')]:_0x5db281[_0x78e2('0x31')];if(_0x16469d[_0x78e2('0x32')]['includeAll']){_0x38781c[_0x78e2('0x41')]=[{'all':!![]}];}_0x38781c=_[_0x78e2('0x3e')]({},_0x38781c,_0x16469d[_0x78e2('0x3f')]);return db[_0x78e2('0x2e')][_0x78e2('0x46')](_0x38781c)[_0x78e2('0x25')](handleEntityNotFound(_0xc431a0,null))[_0x78e2('0x25')](respondWithResult(_0xc431a0,null))[_0x78e2('0x43')](handleError(_0xc431a0,null));};exports['update']=function(_0x499837,_0xb7e437){if(_0x499837[_0x78e2('0x47')]['id']){delete _0x499837['body']['id'];}return db[_0x78e2('0x2e')][_0x78e2('0x46')]({'where':{'id':_0x499837['params']['id']}})[_0x78e2('0x25')](handleEntityNotFound(_0xb7e437,null))[_0x78e2('0x25')](saveUpdates(_0x499837[_0x78e2('0x47')],null))['then'](respondWithResult(_0xb7e437,null))[_0x78e2('0x43')](handleError(_0xb7e437,null));};exports[_0x78e2('0x48')]=function(_0x41ca98,_0xb3bfb9,_0x1ad5ad){return db[_0x78e2('0x49')][_0x78e2('0x4a')](function(_0x54a6f1){if(_0x41ca98[_0x78e2('0x47')][_0x78e2('0x4b')]===_0x78e2('0x4c')){_0x41ca98[_0x78e2('0x47')][_0x78e2('0x4d')]=path[_0x78e2('0x4e')](config['root'],_0x78e2('0x4f'),_0x41ca98[_0x78e2('0x47')][_0x78e2('0x2b')]);}return db['VoiceMusicOnHold']['create'](_0x41ca98[_0x78e2('0x47')],{'transaction':_0x54a6f1})[_0x78e2('0x25')](function(_0x31e407){if(_0x41ca98[_0x78e2('0x47')][_0x78e2('0x4b')]==='files'){fs['mkdirSync'](_0x31e407['directory'],parseInt('0777',0x8));}var _0x354288=_0x41ca98[_0x78e2('0x50')][_0x78e2('0x27')]({'plain':!![]});if(!_0x354288)throw new Error(_0x78e2('0x51'));if(_0x354288[_0x78e2('0x52')]==='user'){var _0x3800cf=_0x31e407[_0x78e2('0x27')]({'plain':!![]});return db[_0x78e2('0x53')][_0x78e2('0x46')]({'where':{'name':'MusicOnHolds','userProfileId':_0x354288[_0x78e2('0x54')]},'raw':!![]})['then'](function(_0x108725){if(_0x108725&&_0x108725[_0x78e2('0x55')]===0x0){return db[_0x78e2('0x29')]['create']({'name':_0x3800cf[_0x78e2('0x2b')],'resourceId':_0x3800cf['id'],'type':_0x108725[_0x78e2('0x2b')],'sectionId':_0x108725['id']},{})['then'](function(){return _0x31e407;});}else{return _0x31e407;}})['catch'](function(_0x166578){logger['error'](_0x78e2('0x56'),_0x166578);});}return _0x31e407;});})[_0x78e2('0x25')](respondWithResult(_0xb3bfb9,0xc9))[_0x78e2('0x43')](handleError(_0xb3bfb9,null));};exports[_0x78e2('0x26')]=function(_0x3b1556,_0x2cc385,_0x3d0bdf){var _0x2a686f;return db[_0x78e2('0x2e')][_0x78e2('0x46')]({'where':{'id':_0x3b1556[_0x78e2('0x45')]['id']}})[_0x78e2('0x25')](function(_0x368781){if(_0x368781){return db[_0x78e2('0x49')]['transaction'](function(_0x279687){return _0x368781['destroy']({'transaction':_0x279687,'raw':!![]})[_0x78e2('0x25')](function(_0x22e046){if(_0x22e046[_0x78e2('0x4d')]){fs[_0x78e2('0x57')](_0x22e046[_0x78e2('0x4d')])[_0x78e2('0x58')](function(_0x50b4b2){fs[_0x78e2('0x59')](path['join'](_0x22e046[_0x78e2('0x4d')],_0x50b4b2));});fs[_0x78e2('0x5a')](_0x22e046[_0x78e2('0x4d')]);}return _0x22e046;});})[_0x78e2('0x43')](function(_0x4ef92a){throw new db[(_0x78e2('0x5b'))][(_0x78e2('0x5c'))](_0x4ef92a[_0x78e2('0x5d')]);});}})[_0x78e2('0x25')](handleEntityNotFound(_0x2cc385,null))['then'](removeEntity(_0x2cc385,null))[_0x78e2('0x43')](handleError(_0x2cc385,null));};exports[_0x78e2('0x5e')]=function(_0x4d6a4f,_0x1d0913,_0x3d9177){return db[_0x78e2('0x49')][_0x78e2('0x4a')](function(_0x4beae0){var _0x513a08;return db[_0x78e2('0x2e')][_0x78e2('0x46')]({'where':{'id':_0x4d6a4f[_0x78e2('0x45')]['id']}})[_0x78e2('0x25')](function(_0x1c9a70){if(_0x1c9a70){_0x513a08=_0x1c9a70;return _0x1c9a70[_0x78e2('0x5e')](_0x4d6a4f[_0x78e2('0x47')]['id'],{'transaction':_0x4beae0});}})[_0x78e2('0x25')](function(_0x1ceeb5){if(_0x1ceeb5){return db[_0x78e2('0x5f')][_0x78e2('0x60')]({'where':{'id':_0x4d6a4f['body']['id']},'attributes':['id',_0x78e2('0x2b'),_0x78e2('0x61'),_0x78e2('0x62'),'createdAt'],'raw':!![]});}})[_0x78e2('0x25')](function(_0x304424){if(_0x304424){var _0x47f2f6=path[_0x78e2('0x4e')](config[_0x78e2('0x63')],_0x78e2('0x64'),util['format'](_0x78e2('0x65'),path[_0x78e2('0x66')](_0x304424[_0x78e2('0x61')],path['extname'](_0x304424[_0x78e2('0x61')])),_0x304424[_0x78e2('0x62')]));var _0x24b7e4=path[_0x78e2('0x4e')](config['root'],_0x78e2('0x4f'),_0x513a08[_0x78e2('0x2b')],util['format'](_0x78e2('0x65'),_0x304424[_0x78e2('0x2b')],_0x304424[_0x78e2('0x62')]));fs['symlinkSync'](_0x47f2f6,_0x24b7e4);return _0x304424;}})[_0x78e2('0x43')](function(_0x50ceb0){throw new db[(_0x78e2('0x5b'))][(_0x78e2('0x5c'))](_0x50ceb0[_0x78e2('0x5d')]);});})[_0x78e2('0x25')](handleEntityNotFound(_0x1d0913,null))[_0x78e2('0x25')](respondWithResult(_0x1d0913,0xc9))[_0x78e2('0x43')](handleError(_0x1d0913,null));};exports['removeSound']=function(_0xdfc637,_0x2046d5,_0x258da9){return db[_0x78e2('0x49')][_0x78e2('0x4a')](function(_0x1c74ce){var _0xfd855c;return db[_0x78e2('0x2e')]['findOne']({'where':{'id':_0xdfc637[_0x78e2('0x45')]['id']}})['then'](handleEntityNotFound(_0x2046d5,null))[_0x78e2('0x25')](function(_0x4ecb06){if(_0x4ecb06){_0xfd855c=_0x4ecb06;return _0x4ecb06['removeSound'](_0xdfc637[_0x78e2('0x45')][_0x78e2('0x67')]);}})['then'](function(_0x53669e){if(_0x53669e){return db[_0x78e2('0x5f')][_0x78e2('0x60')]({'where':{'id':_0xdfc637[_0x78e2('0x45')][_0x78e2('0x67')]},'attributes':['id','name',_0x78e2('0x61'),_0x78e2('0x62'),_0x78e2('0x68')],'raw':!![]});}})['then'](function(_0x54d350){if(_0x54d350){fs[_0x78e2('0x59')](path[_0x78e2('0x4e')](_0xfd855c[_0x78e2('0x4d')],util[_0x78e2('0x69')](_0x78e2('0x65'),_0x54d350[_0x78e2('0x2b')],_0x54d350[_0x78e2('0x62')])));return _0x54d350;}})['catch'](function(_0x3dc7a8){throw new db[(_0x78e2('0x5b'))][(_0x78e2('0x5c'))](_0x3dc7a8[_0x78e2('0x5d')]);});})['then'](handleEntityNotFound(_0x2046d5,null))[_0x78e2('0x25')](respondWithStatusCode(_0x2046d5,0xcc))[_0x78e2('0x43')](handleError(_0x2046d5,null));};exports[_0x78e2('0x6a')]=function(_0x262e3e,_0xaf7ac6,_0x434bca){var _0x3a485b={};var _0x364dc0={};var _0x147eb3;var _0x4fab34;return db[_0x78e2('0x2e')][_0x78e2('0x60')]({'where':{'id':_0x262e3e[_0x78e2('0x45')]['id']}})[_0x78e2('0x25')](handleEntityNotFound(_0xaf7ac6,null))['then'](function(_0x31219d){if(_0x31219d){_0x147eb3=_0x31219d;_0x364dc0[_0x78e2('0x31')]=_[_0x78e2('0x33')](db[_0x78e2('0x5f')][_0x78e2('0x2f')]);_0x364dc0[_0x78e2('0x32')]=_['keys'](_0x262e3e[_0x78e2('0x32')]);_0x364dc0[_0x78e2('0x34')]=_[_0x78e2('0x35')](_0x364dc0['model'],_0x364dc0[_0x78e2('0x32')]);_0x3a485b[_0x78e2('0x36')]=_[_0x78e2('0x35')](_0x364dc0[_0x78e2('0x31')],qs['fields'](_0x262e3e[_0x78e2('0x32')][_0x78e2('0x37')]));_0x3a485b[_0x78e2('0x36')]=_0x3a485b[_0x78e2('0x36')]['length']?_0x3a485b[_0x78e2('0x36')]:_0x364dc0[_0x78e2('0x31')];_0x3a485b[_0x78e2('0x3a')]=qs[_0x78e2('0x3b')](_0x262e3e[_0x78e2('0x32')][_0x78e2('0x3b')]);_0x3a485b[_0x78e2('0x3c')]=qs[_0x78e2('0x34')](_[_0x78e2('0x6b')](_0x262e3e[_0x78e2('0x32')],_0x364dc0[_0x78e2('0x34')]));if(_0x262e3e[_0x78e2('0x32')][_0x78e2('0x3d')]){_0x3a485b[_0x78e2('0x3c')]=_['merge'](_0x3a485b[_0x78e2('0x3c')],{'$or':_['map'](_0x3a485b['attributes'],function(_0x29d580){var _0x574e6f={};_0x574e6f[_0x29d580]={'$like':'%'+_0x262e3e[_0x78e2('0x32')]['filter']+'%'};return _0x574e6f;})});}_0x3a485b=_[_0x78e2('0x3e')]({},_0x3a485b,_0x262e3e[_0x78e2('0x3f')]);return _0x147eb3[_0x78e2('0x6a')](_0x3a485b);}})[_0x78e2('0x25')](function(_0x1c4a4a){if(_0x1c4a4a){_0x4fab34=_0x1c4a4a[_0x78e2('0x38')];if(!_0x262e3e['query']['hasOwnProperty']('nolimit')){_0x3a485b[_0x78e2('0x1e')]=qs[_0x78e2('0x1e')](_0x262e3e[_0x78e2('0x32')][_0x78e2('0x1e')]);_0x3a485b[_0x78e2('0x1c')]=qs['offset'](_0x262e3e[_0x78e2('0x32')][_0x78e2('0x1c')]);}return _0x147eb3[_0x78e2('0x6a')](_0x3a485b);}})[_0x78e2('0x25')](function(_0x6e8646){if(_0x6e8646){return _0x6e8646?{'count':_0x4fab34,'rows':_0x6e8646}:null;}})[_0x78e2('0x25')](respondWithResult(_0xaf7ac6,null))['catch'](handleError(_0xaf7ac6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 53fb760..6ae8567 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 _0x06dc=['../../config/logger','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util'];(function(_0x169602,_0x5c530d){var _0x1f5249=function(_0x37e4fa){while(--_0x37e4fa){_0x169602['push'](_0x169602['shift']());}};_0x1f5249(++_0x5c530d);}(_0x06dc,0x1de));var _0xc06d=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0x06dc[_0x207061];return _0x4a2833;};'use strict';var _=require(_0xc06d('0x0'));var util=require(_0xc06d('0x1'));var logger=require(_0xc06d('0x2'))('api');var moment=require(_0xc06d('0x3'));var BPromise=require('bluebird');var rp=require(_0xc06d('0x4'));var fs=require('fs');var path=require(_0xc06d('0x5'));var rimraf=require(_0xc06d('0x6'));var config=require('../../config/environment');var attributes=require(_0xc06d('0x7'));module['exports']=function(_0x4980e6,_0x249324){return _0x4980e6[_0xc06d('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xc06d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b3=['bluebird','rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','api','moment'];(function(_0x4a56bd,_0x9e704c){var _0x1961cd=function(_0x255c99){while(--_0x255c99){_0x4a56bd['push'](_0x4a56bd['shift']());}};_0x1961cd(++_0x9e704c);}(_0x39b3,0x1ad));var _0x339b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x39b3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x339b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x339b('0x1'));var moment=require(_0x339b('0x2'));var BPromise=require(_0x339b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x339b('0x4'));var config=require('../../config/environment');var attributes=require(_0x339b('0x5'));module[_0x339b('0x6')]=function(_0x5d26a8,_0x219544){return _0x5d26a8['define'](_0x339b('0x7'),attributes,{'tableName':_0x339b('0x8'),'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 a5d255e..5cb4e0b 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4bb8e3,_0x1d7b5b){var _0x548684=function(_0x437b97){while(--_0x437b97){_0x4bb8e3['push'](_0x4bb8e3['shift']());}};_0x548684(++_0x1d7b5b);}(_0x34e8,0x12c));var _0x834e=function(_0x2d9228,_0x322db0){_0x2d9228=_0x2d9228-0x0;var _0x49a20a=_0x34e8[_0x2d9228];return _0x49a20a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12957c,_0x234c86){var _0x27b62e=function(_0x388ce6){while(--_0x388ce6){_0x12957c['push'](_0x12957c['shift']());}};_0x27b62e(++_0x234c86);}(_0xe706,0xa3));var _0x6e70=function(_0x85e9c6,_0xedec06){_0x85e9c6=_0x85e9c6-0x0;var _0x880842=_0xe706[_0x85e9c6];return _0x880842;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index bd27fbc..a2f5ee7 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 _0xef89=['show','/:id/teams','post','create','/:id/users','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','describe','get','/:id'];(function(_0x5dd834,_0x315495){var _0x3cd210=function(_0x150af0){while(--_0x150af0){_0x5dd834['push'](_0x5dd834['shift']());}};_0x3cd210(++_0x315495);}(_0xef89,0xf6));var _0x9ef8=function(_0x1db993,_0x317ce1){_0x1db993=_0x1db993-0x0;var _0x398821=_0xef89[_0x1db993];return _0x398821;};'use strict';var multer=require(_0x9ef8('0x0'));var util=require(_0x9ef8('0x1'));var path=require(_0x9ef8('0x2'));var timeout=require(_0x9ef8('0x3'));var express=require(_0x9ef8('0x4'));var router=express['Router']();var fs_extra=require(_0x9ef8('0x5'));var auth=require(_0x9ef8('0x6'));var interaction=require(_0x9ef8('0x7'));var config=require(_0x9ef8('0x8'));var controller=require(_0x9ef8('0x9'));router['get']('/',auth[_0x9ef8('0xa')](),controller['index']);router['get']('/describe',auth[_0x9ef8('0xa')](),controller[_0x9ef8('0xb')]);router[_0x9ef8('0xc')](_0x9ef8('0xd'),auth[_0x9ef8('0xa')](),controller[_0x9ef8('0xe')]);router[_0x9ef8('0xc')]('/:id/users',auth[_0x9ef8('0xa')](),controller['getAgents']);router['get'](_0x9ef8('0xf'),auth[_0x9ef8('0xa')](),controller['getTeams']);router[_0x9ef8('0x10')]('/',auth[_0x9ef8('0xa')](),controller[_0x9ef8('0x11')]);router[_0x9ef8('0x10')](_0x9ef8('0x12'),auth[_0x9ef8('0xa')](),controller['addAgents']);router['post'](_0x9ef8('0xf'),auth[_0x9ef8('0xa')](),controller[_0x9ef8('0x13')]);router[_0x9ef8('0x14')](_0x9ef8('0xd'),auth[_0x9ef8('0xa')](),controller[_0x9ef8('0x15')]);router[_0x9ef8('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9ef8('0x17')]);router[_0x9ef8('0x16')](_0x9ef8('0x12'),auth['isAuthenticated'](),controller[_0x9ef8('0x18')]);router[_0x9ef8('0x16')](_0x9ef8('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x9ef8('0x19')]=router; \ No newline at end of file +var _0xeb9e=['/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','destroy','removeTeams','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe'];(function(_0x42e0c8,_0x153375){var _0x1311cf=function(_0x1cc6fb){while(--_0x1cc6fb){_0x42e0c8['push'](_0x42e0c8['shift']());}};_0x1311cf(++_0x153375);}(_0xeb9e,0x143));var _0xeeb9=function(_0x135ffe,_0xc2481e){_0x135ffe=_0x135ffe-0x0;var _0x58b7c2=_0xeb9e[_0x135ffe];return _0x58b7c2;};'use strict';var multer=require('multer');var util=require(_0xeeb9('0x0'));var path=require('path');var timeout=require(_0xeeb9('0x1'));var express=require(_0xeeb9('0x2'));var router=express[_0xeeb9('0x3')]();var fs_extra=require(_0xeeb9('0x4'));var auth=require(_0xeeb9('0x5'));var interaction=require(_0xeeb9('0x6'));var config=require(_0xeeb9('0x7'));var controller=require(_0xeeb9('0x8'));router[_0xeeb9('0x9')]('/',auth[_0xeeb9('0xa')](),controller['index']);router['get'](_0xeeb9('0xb'),auth[_0xeeb9('0xa')](),controller[_0xeeb9('0xc')]);router[_0xeeb9('0x9')](_0xeeb9('0xd'),auth['isAuthenticated'](),controller[_0xeeb9('0xe')]);router[_0xeeb9('0x9')](_0xeeb9('0xf'),auth[_0xeeb9('0xa')](),controller[_0xeeb9('0x10')]);router[_0xeeb9('0x9')](_0xeeb9('0x11'),auth[_0xeeb9('0xa')](),controller[_0xeeb9('0x12')]);router['post']('/',auth[_0xeeb9('0xa')](),controller[_0xeeb9('0x13')]);router[_0xeeb9('0x14')](_0xeeb9('0xf'),auth[_0xeeb9('0xa')](),controller[_0xeeb9('0x15')]);router['post']('/:id/teams',auth[_0xeeb9('0xa')](),controller[_0xeeb9('0x16')]);router[_0xeeb9('0x17')]('/:id',auth[_0xeeb9('0xa')](),controller[_0xeeb9('0x18')]);router[_0xeeb9('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xeeb9('0x1a')]);router['delete'](_0xeeb9('0xf'),auth[_0xeeb9('0xa')](),controller['removeAgents']);router[_0xeeb9('0x19')](_0xeeb9('0x11'),auth['isAuthenticated'](),controller[_0xeeb9('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b0fa4ac..a32a66b 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 _0x527a=['system-','getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x25e812,_0x1342a2){var _0x727c56=function(_0x243b79){while(--_0x243b79){_0x25e812['push'](_0x25e812['shift']());}};_0x727c56(++_0x1342a2);}(_0x527a,0x10b));var _0xa527=function(_0x568ebb,_0x5b8e54){_0x568ebb=_0x568ebb-0x0;var _0x10bb98=_0x527a[_0x568ebb];return _0x10bb98;};'use strict';var Sequelize=require(_0xa527('0x0'));module[_0xa527('0x1')]={'name':{'type':Sequelize[_0xa527('0x2')],'allowNull':![],'unique':_0xa527('0x3')},'prefix':{'type':Sequelize[_0xa527('0x4')],'get':function(_0x83f69){return _0xa527('0x5')+this[_0xa527('0x6')](_0xa527('0x3'))+'-';}},'description':{'type':Sequelize[_0xa527('0x2')]},'callerIdAll':{'type':Sequelize[_0xa527('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa527('0x7')]}}; \ No newline at end of file +var _0x0191=['INTEGER','sequelize','exports','STRING','name','system-','getDataValue'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x0191,0xb7));var _0x1019=function(_0x2673bb,_0x292576){_0x2673bb=_0x2673bb-0x0;var _0x3edc1c=_0x0191[_0x2673bb];return _0x3edc1c;};'use strict';var Sequelize=require(_0x1019('0x0'));module[_0x1019('0x1')]={'name':{'type':Sequelize[_0x1019('0x2')],'allowNull':![],'unique':_0x1019('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5bce67){return _0x1019('0x4')+this[_0x1019('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x1019('0x2')]},'callerIdAll':{'type':Sequelize[_0x1019('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1019('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5e7b22e..5257e68 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 _0xf7b4=['filter','nolimit','User','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','sequelize','transaction','create','body','get','VoiceExtension','VoiceExtensionId','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','update','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','filters','getTeams','Team'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4b1fc2,_0x2b0e9d){_0x4b1fc2=_0x4b1fc2-0x0;var _0x2be5d9=_0xf7b4[_0x4b1fc2];return _0x2be5d9;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4f7b('0x17')]=_[_0x4f7b('0x18')](config[_0x4f7b('0x17')],{'host':_0x4f7b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f7b('0x17')]));require(_0x4f7b('0x1a'))[_0x4f7b('0x1b')](socket);function respondWithStatusCode(_0x43a51a,_0x339486){_0x339486=_0x339486||0xcc;return function(_0x330de9){if(_0x330de9){return _0x43a51a[_0x4f7b('0x1c')](_0x339486);}return _0x43a51a[_0x4f7b('0x1d')](_0x339486)[_0x4f7b('0x1e')]();};}function respondWithResult(_0x29fdd5,_0x1a28b8){_0x1a28b8=_0x1a28b8||0xc8;return function(_0x1e7afc){if(_0x1e7afc){return _0x29fdd5['status'](_0x1a28b8)[_0x4f7b('0x1f')](_0x1e7afc);}};}function respondWithFilteredResult(_0x496322,_0x5b5ee3){return function(_0x24e5cf){if(_0x24e5cf){var _0x3813da=typeof _0x5b5ee3['offset']===_0x4f7b('0x20')&&typeof _0x5b5ee3[_0x4f7b('0x21')]===_0x4f7b('0x20');var _0xf2311f=_0x24e5cf['count'];var _0x1daa79=_0x3813da?0x0:_0x5b5ee3['offset'];var _0x41cf36=_0x3813da?_0x24e5cf[_0x4f7b('0x22')]:_0x5b5ee3[_0x4f7b('0x23')]+_0x5b5ee3[_0x4f7b('0x21')];var _0x27127b;if(_0x41cf36>=_0xf2311f){_0x41cf36=_0xf2311f;_0x27127b=0xc8;}else{_0x27127b=0xce;}_0x496322[_0x4f7b('0x1d')](_0x27127b);return _0x496322[_0x4f7b('0x24')](_0x4f7b('0x25'),_0x1daa79+'-'+_0x41cf36+'/'+_0xf2311f)[_0x4f7b('0x1f')](_0x24e5cf);}return null;};}function patchUpdates(_0x5508bd){return function(_0x410176){try{jsonpatch[_0x4f7b('0x26')](_0x410176,_0x5508bd,!![]);}catch(_0x2c9ea6){return BPromise['reject'](_0x2c9ea6);}return _0x410176[_0x4f7b('0x27')]();};}function saveUpdates(_0x4610a4,_0x5d22f4){return function(_0x15dbec){if(_0x15dbec){return _0x15dbec['update'](_0x4610a4)[_0x4f7b('0x28')](function(_0x2429be){return _0x2429be;});}return null;};}function removeEntity(_0x23c820,_0x278c41){return function(_0x17aa9d){if(_0x17aa9d){return _0x17aa9d[_0x4f7b('0x29')]()[_0x4f7b('0x28')](function(){var _0x3ad769=_0x17aa9d['get']({'plain':!![]});var _0x6c9626=_0x4f7b('0x2a');return db[_0x4f7b('0x2b')]['destroy']({'where':{'type':_0x6c9626,'resourceId':_0x3ad769['id']}})[_0x4f7b('0x28')](function(){return _0x17aa9d;});})[_0x4f7b('0x28')](function(){_0x23c820[_0x4f7b('0x1d')](0xcc)[_0x4f7b('0x1e')]();});}};}function handleEntityNotFound(_0x1ccce0,_0x4ebffa){return function(_0xac1f93){if(!_0xac1f93){_0x1ccce0[_0x4f7b('0x1c')](0x194);}return _0xac1f93;};}function handleError(_0x9a675c,_0x59d3ad){_0x59d3ad=_0x59d3ad||0x1f4;return function(_0x7de561){logger['error'](_0x7de561['stack']);if(_0x7de561[_0x4f7b('0x2c')]){delete _0x7de561['name'];}_0x9a675c[_0x4f7b('0x1d')](_0x59d3ad)[_0x4f7b('0x2d')](_0x7de561);};}exports[_0x4f7b('0x2e')]=function(_0x1cf980,_0x105ffb){var _0x4e5862={},_0x13a113={},_0x179372={'count':0x0,'rows':[]};var _0xba46b8=_[_0x4f7b('0x2f')](db[_0x4f7b('0x30')][_0x4f7b('0x31')],function(_0x3e7fb4){return{'name':_0x3e7fb4[_0x4f7b('0x32')],'type':_0x3e7fb4[_0x4f7b('0x33')][_0x4f7b('0x34')]};});_0x13a113[_0x4f7b('0x35')]=_[_0x4f7b('0x2f')](_0xba46b8,_0x4f7b('0x2c'));_0x13a113[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1cf980[_0x4f7b('0x36')]);_0x13a113['filters']=_[_0x4f7b('0x38')](_0x13a113['model'],_0x13a113[_0x4f7b('0x36')]);_0x4e5862[_0x4f7b('0x39')]=_['intersection'](_0x13a113[_0x4f7b('0x35')],qs[_0x4f7b('0x3a')](_0x1cf980[_0x4f7b('0x36')]['fields']));_0x4e5862[_0x4f7b('0x39')]=_0x4e5862[_0x4f7b('0x39')][_0x4f7b('0x3b')]?_0x4e5862[_0x4f7b('0x39')]:_0x13a113[_0x4f7b('0x35')];if(!_0x1cf980[_0x4f7b('0x36')][_0x4f7b('0x3c')]('nolimit')){_0x4e5862[_0x4f7b('0x21')]=qs['limit'](_0x1cf980[_0x4f7b('0x36')][_0x4f7b('0x21')]);_0x4e5862[_0x4f7b('0x23')]=qs['offset'](_0x1cf980[_0x4f7b('0x36')]['offset']);}_0x4e5862[_0x4f7b('0x3d')]=qs[_0x4f7b('0x3e')](_0x1cf980['query']['sort']);_0x4e5862[_0x4f7b('0x3f')]=qs['filters'](_[_0x4f7b('0x40')](_0x1cf980[_0x4f7b('0x36')],_0x13a113['filters']),_0xba46b8);if(_0x1cf980[_0x4f7b('0x36')]['filter']){_0x4e5862['where']=_['merge'](_0x4e5862[_0x4f7b('0x3f')],{'$or':_[_0x4f7b('0x2f')](_0xba46b8,function(_0xa5532b){if(_0xa5532b[_0x4f7b('0x33')]!=='VIRTUAL'){var _0x3da93f={};_0x3da93f[_0xa5532b['name']]={'$like':'%'+_0x1cf980[_0x4f7b('0x36')]['filter']+'%'};return _0x3da93f;}})});}_0x4e5862=_[_0x4f7b('0x41')]({},_0x4e5862,_0x1cf980['options']);var _0x2c2b10={'where':_0x4e5862[_0x4f7b('0x3f')]};return db[_0x4f7b('0x30')][_0x4f7b('0x22')](_0x2c2b10)[_0x4f7b('0x28')](function(_0x325cd6){_0x179372[_0x4f7b('0x22')]=_0x325cd6;if(_0x1cf980[_0x4f7b('0x36')][_0x4f7b('0x42')]){_0x4e5862[_0x4f7b('0x43')]=[{'all':!![]}];}return db[_0x4f7b('0x30')][_0x4f7b('0x44')](_0x4e5862);})[_0x4f7b('0x28')](function(_0x508eaa){_0x179372[_0x4f7b('0x45')]=_0x508eaa;return _0x179372;})[_0x4f7b('0x28')](respondWithFilteredResult(_0x105ffb,_0x4e5862))[_0x4f7b('0x46')](handleError(_0x105ffb,null));};exports[_0x4f7b('0x47')]=function(_0x5cfca1,_0x581356){var _0x10d0ac={'raw':![],'where':{'id':_0x5cfca1[_0x4f7b('0x48')]['id']}},_0x1d1e10={};_0x1d1e10[_0x4f7b('0x35')]=_['keys'](db['VoicePrefix'][_0x4f7b('0x31')]);_0x1d1e10[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x5cfca1[_0x4f7b('0x36')]);_0x1d1e10['filters']=_['intersection'](_0x1d1e10[_0x4f7b('0x35')],_0x1d1e10[_0x4f7b('0x36')]);_0x10d0ac[_0x4f7b('0x39')]=_[_0x4f7b('0x38')](_0x1d1e10[_0x4f7b('0x35')],qs['fields'](_0x5cfca1[_0x4f7b('0x36')][_0x4f7b('0x3a')]));_0x10d0ac[_0x4f7b('0x39')]=_0x10d0ac['attributes'][_0x4f7b('0x3b')]?_0x10d0ac[_0x4f7b('0x39')]:_0x1d1e10[_0x4f7b('0x35')];if(_0x5cfca1[_0x4f7b('0x36')][_0x4f7b('0x42')]){_0x10d0ac[_0x4f7b('0x43')]=[{'all':!![]}];}_0x10d0ac=_[_0x4f7b('0x41')]({},_0x10d0ac,_0x5cfca1[_0x4f7b('0x49')]);return db[_0x4f7b('0x30')][_0x4f7b('0x4a')](_0x10d0ac)['then'](handleEntityNotFound(_0x581356,null))[_0x4f7b('0x28')](respondWithResult(_0x581356,null))[_0x4f7b('0x46')](handleError(_0x581356,null));};exports[_0x4f7b('0x29')]=function(_0x5003f1,_0x16eaef){return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0x5003f1[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x16eaef,null))[_0x4f7b('0x28')](removeEntity(_0x16eaef,null))[_0x4f7b('0x46')](handleError(_0x16eaef,null));};exports[_0x4f7b('0x4b')]=function(_0x776ce7,_0x23d5f3){return db['VoicePrefix'][_0x4f7b('0x4b')]()[_0x4f7b('0x28')](respondWithResult(_0x23d5f3,null))[_0x4f7b('0x46')](handleError(_0x23d5f3,null));};exports['create']=function(_0x2c9cee,_0x40c183){var _0xeeb227;return db[_0x4f7b('0x4c')][_0x4f7b('0x4d')](function(_0x819fb3){return db['VoicePrefix'][_0x4f7b('0x4e')](_0x2c9cee[_0x4f7b('0x4f')],{'transaction':_0x819fb3})[_0x4f7b('0x28')](function(_0x4c9496){_0xeeb227=_0x4c9496[_0x4f7b('0x50')]({'plain':!![]});return db[_0x4f7b('0x51')][_0x4f7b('0x4a')]({'where':{'id':_0xeeb227[_0x4f7b('0x52')]},'raw':!![]})[_0x4f7b('0x28')](function(_0x6e448f){return createVoicePrefixExtensions(_0xeeb227,_0x6e448f,_0x819fb3);});});})['then'](function(){var _0x13bb98=_0x2c9cee['user']['get']({'plain':!![]});if(!_0x13bb98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13bb98[_0x4f7b('0x53')]===_0x4f7b('0x54')){var _0x27b2e1=_0xeeb227;return db['UserProfileSection']['find']({'where':{'name':_0x4f7b('0x2a'),'userProfileId':_0x13bb98[_0x4f7b('0x55')]},'raw':!![]})['then'](function(_0xf957ca){if(_0xf957ca&&_0xf957ca[_0x4f7b('0x56')]===0x0){return db[_0x4f7b('0x2b')][_0x4f7b('0x4e')]({'name':_0x27b2e1['name'],'resourceId':_0x27b2e1['id'],'type':_0xf957ca[_0x4f7b('0x2c')],'sectionId':_0xf957ca['id']},{})[_0x4f7b('0x28')](function(){return _0xeeb227;});}else{return _0xeeb227;}})[_0x4f7b('0x46')](function(_0x42b378){logger[_0x4f7b('0x57')](_0x4f7b('0x58'),_0x42b378);throw _0x42b378;});}return _0xeeb227;})[_0x4f7b('0x28')](respondWithResult(_0x40c183,null))['catch'](handleError(_0x40c183,null));};function Extension(_0x529821,_0x507199,_0x133074,_0x5530cb){this['context']='from-sip';this['exten']=_0x529821;this[_0x4f7b('0x59')]=_0x133074;this[_0x4f7b('0x33')]=_0x4f7b('0x5a');this[_0x4f7b('0x5b')]=_0x4f7b('0x5c');this[_0x4f7b('0x5d')]=_0x507199;this[_0x4f7b('0x5e')]=_0x5530cb;}function createVoicePrefixExtensions(_0x80efcb,_0x1d500c,_0x2a80fe){return new BPromise(function(_0x31bed4,_0x12456e){var _0x1ba432=new Extension(formatPrefixName(_0x80efcb[_0x4f7b('0x5f')]),0x1,_0x4f7b('0x60'),_0x4f7b('0x61'));_0x1ba432[_0x4f7b('0x62')]=_0x80efcb['id'];return db[_0x4f7b('0x51')]['create'](_0x1ba432,{'transaction':_0x2a80fe})[_0x4f7b('0x28')](function(_0x46d15c){var _0x3c5b28=_0x46d15c[_0x4f7b('0x50')]({'plain':!![]});var _0x321f36=_['map'](addVoicePrefixExtensions(_0x80efcb,_0x1d500c),function(_0x4b9f3a){_0x4b9f3a[_0x4f7b('0x52')]=_0x3c5b28['id'];_0x4b9f3a['VoicePrefixId']=_0x80efcb['id'];return _0x4b9f3a;});return db[_0x4f7b('0x51')][_0x4f7b('0x63')](_0x321f36,{'transaction':_0x2a80fe})[_0x4f7b('0x28')](function(_0x7509ab){if(!_0x7509ab){return _0x12456e('Extensions\x20creation\x20failed');}else{return _0x31bed4(_0x7509ab);}})[_0x4f7b('0x46')](function(_0x35b569){return _0x12456e(_0x35b569);});});;});};function addVoicePrefixExtensions(_0x5a6db0,_0x58baa5){var _0x4b2089=[];var _0x5b16cb=formatPrefixName(_0x5a6db0[_0x4f7b('0x5f')]);_0x4b2089['push'](new Extension(_0x5b16cb,0x2,'Set','CDR(prefix)='+_0x5a6db0[_0x4f7b('0x2c')]));if(_0x5a6db0[_0x4f7b('0x64')]){_0x4b2089[_0x4f7b('0x65')](new Extension(_0x5b16cb,0x3,'Set',_0x4f7b('0x66')+_0x5a6db0[_0x4f7b('0x64')]));}else{_0x4b2089['push'](new Extension(_0x5b16cb,0x3,'NoOp',_0x4f7b('0x67')));}_0x4b2089[_0x4f7b('0x65')](new Extension(_0x5b16cb,0x4,_0x4f7b('0x68'),_0x58baa5[_0x4f7b('0x69')]+','+'${EXTEN:'+(0x8+_0x5a6db0[_0x4f7b('0x2c')][_0x4f7b('0x3b')])+'}'+','+0x1));return _0x4b2089;}function formatPrefixName(_0xc6b94e){var _0x2cb5f1='_';for(var _0x2ac8db=0x0;_0x2ac8db<_0xc6b94e[_0x4f7b('0x3b')];_0x2ac8db++){if(_0xc6b94e['charAt'](_0x2ac8db)=='-'){_0x2cb5f1+=_0xc6b94e[_0x4f7b('0x6a')](_0x2ac8db);}else{_0x2cb5f1+='['+_0xc6b94e[_0x4f7b('0x6a')](_0x2ac8db)+']';}}_0x2cb5f1+='.';return _0x2cb5f1;}exports[_0x4f7b('0x6b')]=function(_0x220f21,_0x1ca442,_0x509763){var _0x579363=_0x220f21['body'];_0x579363[_0x4f7b('0x5f')]=_0x4f7b('0x6c')+_0x579363[_0x4f7b('0x2c')]+'-';return db[_0x4f7b('0x4c')][_0x4f7b('0x4d')](function(_0x53034b){return db[_0x4f7b('0x30')][_0x4f7b('0x6b')](_0x579363,{'where':{'id':_0x579363['id']},'transaction':_0x53034b})[_0x4f7b('0x28')](function(){return db[_0x4f7b('0x51')][_0x4f7b('0x29')]({'where':{'VoicePrefixId':_0x579363['id']},'transaction':_0x53034b})[_0x4f7b('0x28')](function(){return db[_0x4f7b('0x51')][_0x4f7b('0x4a')]({'where':{'id':_0x579363[_0x4f7b('0x52')]},'raw':!![]})[_0x4f7b('0x28')](function(_0x36b46d){return createVoicePrefixExtensions(_0x579363,_0x36b46d,_0x53034b);});});});})[_0x4f7b('0x28')](function(){return db[_0x4f7b('0x30')][_0x4f7b('0x6d')](_0x579363['id']);})[_0x4f7b('0x28')](respondWithResult(_0x1ca442,null))[_0x4f7b('0x46')](handleError(_0x1ca442,null));};exports[_0x4f7b('0x6e')]=function(_0xf0691e,_0x531da6,_0x5bce88){return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0xf0691e[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x531da6,null))['then'](function(_0x1102fe){if(_0x1102fe){return _0x1102fe[_0x4f7b('0x6e')](_0xf0691e[_0x4f7b('0x4f')][_0x4f7b('0x6f')],_[_0x4f7b('0x70')](_0xf0691e[_0x4f7b('0x4f')],[_0x4f7b('0x6f'),'id'])||{})[_0x4f7b('0x71')](function(_0x3ddd33){for(var _0x13f190=0x0;_0x13f190<_0xf0691e[_0x4f7b('0x4f')][_0x4f7b('0x6f')][_0x4f7b('0x3b')];_0x13f190+=0x1){socket[_0x4f7b('0x72')](_0x4f7b('0x73'),{'UserId':Number(_0xf0691e['body'][_0x4f7b('0x6f')][_0x13f190]),'VoicePrefixId':Number(_0xf0691e[_0x4f7b('0x48')]['id'])});}return _0x3ddd33;});}})['then'](respondWithResult(_0x531da6,null))['catch'](handleError(_0x531da6,null));};exports[_0x4f7b('0x74')]=function(_0x4beb8e,_0x3d25a6,_0x12125d){return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0x4beb8e[_0x4f7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d25a6,null))['then'](function(_0x42bd6b){if(_0x42bd6b){return _0x42bd6b[_0x4f7b('0x74')](_0x4beb8e[_0x4f7b('0x36')][_0x4f7b('0x6f')])['then'](function(){if(_[_0x4f7b('0x75')](_0x4beb8e[_0x4f7b('0x36')]['ids'])){for(var _0x6aef20=0x0;_0x6aef20<_0x4beb8e[_0x4f7b('0x36')]['ids']['length'];_0x6aef20+=0x1){socket[_0x4f7b('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x4beb8e['query']['ids'][_0x6aef20]),'VoicePrefixId':Number(_0x4beb8e[_0x4f7b('0x48')]['id'])});}}else{socket['emit'](_0x4f7b('0x76'),{'UserId':Number(_0x4beb8e[_0x4f7b('0x36')][_0x4f7b('0x6f')]),'VoicePrefixId':Number(_0x4beb8e[_0x4f7b('0x48')]['id'])});}});}})[_0x4f7b('0x28')](respondWithStatusCode(_0x3d25a6,null))[_0x4f7b('0x46')](handleError(_0x3d25a6,null));};exports[_0x4f7b('0x77')]=function(_0x1f6650,_0x39799b,_0x4da13f){var _0x476637={};var _0x35c3cb={};var _0x37d151;var _0x40120d;return db[_0x4f7b('0x30')][_0x4f7b('0x78')]({'where':{'id':_0x1f6650[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x39799b,null))['then'](function(_0x24289e){if(_0x24289e){_0x37d151=_0x24289e;_0x35c3cb[_0x4f7b('0x35')]=_[_0x4f7b('0x37')](db['User'][_0x4f7b('0x31')]);_0x35c3cb['query']=_[_0x4f7b('0x37')](_0x1f6650[_0x4f7b('0x36')]);_0x35c3cb['filters']=_['intersection'](_0x35c3cb[_0x4f7b('0x35')],_0x35c3cb['query']);_0x476637[_0x4f7b('0x39')]=_['intersection'](_0x35c3cb[_0x4f7b('0x35')],qs[_0x4f7b('0x3a')](_0x1f6650[_0x4f7b('0x36')]['fields']));_0x476637[_0x4f7b('0x39')]=_0x476637['attributes'][_0x4f7b('0x3b')]?_0x476637[_0x4f7b('0x39')]:_0x35c3cb[_0x4f7b('0x35')];_0x476637[_0x4f7b('0x3d')]=qs[_0x4f7b('0x3e')](_0x1f6650[_0x4f7b('0x36')][_0x4f7b('0x3e')]);_0x476637['where']=qs[_0x4f7b('0x79')](_['pick'](_0x1f6650['query'],_0x35c3cb['filters']));if(_0x1f6650[_0x4f7b('0x36')]['filter']){_0x476637[_0x4f7b('0x3f')]=_[_0x4f7b('0x41')](_0x476637[_0x4f7b('0x3f')],{'$or':_[_0x4f7b('0x2f')](_0x476637[_0x4f7b('0x39')],function(_0x3f5f81){var _0x30a003={};_0x30a003[_0x3f5f81]={'$like':'%'+_0x1f6650[_0x4f7b('0x36')]['filter']+'%'};return _0x30a003;})});}_0x476637=_['merge']({},_0x476637,_0x1f6650['options']);return _0x37d151['getAgents'](_0x476637);}})[_0x4f7b('0x28')](function(_0x34bca4){if(_0x34bca4){_0x40120d=_0x34bca4[_0x4f7b('0x3b')];if(!_0x1f6650['query'][_0x4f7b('0x3c')]('nolimit')){_0x476637[_0x4f7b('0x21')]=qs[_0x4f7b('0x21')](_0x1f6650['query'][_0x4f7b('0x21')]);_0x476637[_0x4f7b('0x23')]=qs[_0x4f7b('0x23')](_0x1f6650['query'][_0x4f7b('0x23')]);}return _0x37d151[_0x4f7b('0x77')](_0x476637);}})[_0x4f7b('0x28')](function(_0x3927b5){if(_0x3927b5){return _0x3927b5?{'count':_0x40120d,'rows':_0x3927b5}:null;}})[_0x4f7b('0x28')](respondWithResult(_0x39799b,null))[_0x4f7b('0x46')](handleError(_0x39799b,null));};exports[_0x4f7b('0x7a')]=function(_0x1a91ce,_0xd249a,_0x4f2c6e){var _0x147e14={};var _0x55922a={};var _0x5afd27;var _0x471caa;return db[_0x4f7b('0x30')]['findOne']({'where':{'id':_0x1a91ce['params']['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0xd249a,null))['then'](function(_0x13c2e4){if(_0x13c2e4){_0x5afd27=_0x13c2e4;_0x55922a[_0x4f7b('0x35')]=_[_0x4f7b('0x37')](db[_0x4f7b('0x7b')][_0x4f7b('0x31')]);_0x55922a[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1a91ce[_0x4f7b('0x36')]);_0x55922a['filters']=_[_0x4f7b('0x38')](_0x55922a[_0x4f7b('0x35')],_0x55922a[_0x4f7b('0x36')]);_0x147e14[_0x4f7b('0x39')]=_[_0x4f7b('0x38')](_0x55922a[_0x4f7b('0x35')],qs[_0x4f7b('0x3a')](_0x1a91ce['query'][_0x4f7b('0x3a')]));_0x147e14[_0x4f7b('0x39')]=_0x147e14[_0x4f7b('0x39')][_0x4f7b('0x3b')]?_0x147e14[_0x4f7b('0x39')]:_0x55922a[_0x4f7b('0x35')];_0x147e14[_0x4f7b('0x3d')]=qs[_0x4f7b('0x3e')](_0x1a91ce[_0x4f7b('0x36')]['sort']);_0x147e14['where']=qs['filters'](_['pick'](_0x1a91ce[_0x4f7b('0x36')],_0x55922a[_0x4f7b('0x79')]));if(_0x1a91ce[_0x4f7b('0x36')][_0x4f7b('0x7c')]){_0x147e14[_0x4f7b('0x3f')]=_[_0x4f7b('0x41')](_0x147e14[_0x4f7b('0x3f')],{'$or':_['map'](_0x147e14[_0x4f7b('0x39')],function(_0x265a8f){var _0x39ec96={};_0x39ec96[_0x265a8f]={'$like':'%'+_0x1a91ce[_0x4f7b('0x36')]['filter']+'%'};return _0x39ec96;})});}_0x147e14=_[_0x4f7b('0x41')]({},_0x147e14,_0x1a91ce[_0x4f7b('0x49')]);return _0x5afd27[_0x4f7b('0x7a')](_0x147e14);}})['then'](function(_0x3f844f){if(_0x3f844f){_0x471caa=_0x3f844f[_0x4f7b('0x3b')];if(!_0x1a91ce[_0x4f7b('0x36')][_0x4f7b('0x3c')](_0x4f7b('0x7d'))){_0x147e14[_0x4f7b('0x21')]=qs[_0x4f7b('0x21')](_0x1a91ce[_0x4f7b('0x36')][_0x4f7b('0x21')]);_0x147e14[_0x4f7b('0x23')]=qs[_0x4f7b('0x23')](_0x1a91ce[_0x4f7b('0x36')]['offset']);}return _0x5afd27['getTeams'](_0x147e14);}})[_0x4f7b('0x28')](function(_0x4cd4d6){if(_0x4cd4d6){return _0x4cd4d6?{'count':_0x471caa,'rows':_0x4cd4d6}:null;}})[_0x4f7b('0x28')](respondWithResult(_0xd249a,null))[_0x4f7b('0x46')](handleError(_0xd249a,null));};exports['addTeams']=function(_0x411a94,_0x1e934e,_0x5ec78b){var _0x4e07ce=_0x411a94['body'][_0x4f7b('0x6f')];var _0x5a8bda;return db['Team'][_0x4f7b('0x44')]({'where':{'id':_0x4e07ce},'attributes':['id'],'include':[{'model':db[_0x4f7b('0x7e')],'as':_0x4f7b('0x7f'),'attributes':['id',_0x4f7b('0x2c'),_0x4f7b('0x80'),_0x4f7b('0x81'),'interface'],'raw':!![]}]})[_0x4f7b('0x28')](function(_0x1ebf36){if(_0x1ebf36){_0x5a8bda=_0x1ebf36;var _0x4daeb1=_[_0x4f7b('0x82')](_0x1ebf36,function(_0x5556b4){var _0x4d5eb3=_0x5556b4['get']({'plain':!![]});return _0x4d5eb3[_0x4f7b('0x7f')];});return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0x411a94[_0x4f7b('0x48')]['id']}})['then'](function(_0x3e0d84){return db['sequelize']['transaction'](function(_0x5c2027){return _0x3e0d84['addTeams'](_0x4e07ce,{'transaction':_0x5c2027})[_0x4f7b('0x28')](function(){return BPromise[_0x4f7b('0x83')](_0x5a8bda,function(_0xb3a12b){return db[_0x4f7b('0x84')][_0x4f7b('0x85')]({'TeamId':_0xb3a12b['id'],'VoicePrefixId':_0x411a94['params']['id']},{'transaction':_0x5c2027});});})[_0x4f7b('0x28')](function(){return BPromise[_0x4f7b('0x83')](_0x4daeb1,function(_0x20daa0){return db[_0x4f7b('0x86')][_0x4f7b('0x87')]({'where':{'UserId':_0x20daa0['id'],'VoicePrefixId':_0x411a94[_0x4f7b('0x48')]['id']},'transaction':_0x5c2027});});})['then'](function(){_0x4daeb1[_0x4f7b('0x88')](function(_0x5f4ea9){socket[_0x4f7b('0x72')](_0x4f7b('0x73'),{'UserId':_0x5f4ea9['id'],'VoicePrefixId':_0x3e0d84['id']});});});});});}})[_0x4f7b('0x28')](respondWithStatusCode(_0x1e934e,null))[_0x4f7b('0x46')](handleError(_0x1e934e,null));};exports[_0x4f7b('0x89')]=function(_0x3aaa25,_0x344257,_0x36209e){return db[_0x4f7b('0x7b')][_0x4f7b('0x44')]({'where':{'id':_0x3aaa25[_0x4f7b('0x36')][_0x4f7b('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4f7b('0x28')](handleEntityNotFound(_0x344257,null))[_0x4f7b('0x28')](function(_0x136804){var _0x13d7cd=_[_0x4f7b('0x2f')](_0x136804,'id');var _0x1cf812=[];var _0x3434a1=[];var _0x3acd39=squel[_0x4f7b('0x8a')]();_0x3acd39['field']('tq.TeamId')[_0x4f7b('0x8b')]('team_has_voice_prefixes','tq')[_0x4f7b('0x8c')](_0x4f7b('0x8d'),'ut',_0x4f7b('0x8e'))[_0x4f7b('0x3f')](_0x4f7b('0x8f'),_0x3aaa25['params']['id']);for(var _0x324ee3=0x0;_0x324ee3<_0x136804[_0x4f7b('0x3b')];_0x324ee3+=0x1){let _0x14c427=_0x136804[_0x324ee3];for(var _0x5dd4cd=0x0;_0x5dd4cd<_0x14c427[_0x4f7b('0x7f')][_0x4f7b('0x3b')];_0x5dd4cd+=0x1){let _0x43276a=_0x14c427[_0x4f7b('0x7f')][_0x5dd4cd];var _0x58cf43=_0x3acd39[_0x4f7b('0x90')]();_0x58cf43['where'](_0x4f7b('0x91'),_0x43276a['id']);_0x3434a1[_0x4f7b('0x65')](db[_0x4f7b('0x4c')][_0x4f7b('0x36')](_0x58cf43[_0x4f7b('0x92')](),{'type':db[_0x4f7b('0x4c')][_0x4f7b('0x93')][_0x4f7b('0x94')]})[_0x4f7b('0x28')](function(_0xe6b4de){if(_0xe6b4de[_0x4f7b('0x3b')]===0x1){return _0x43276a['id'];}else{var _0x4088d7=_[_0x4f7b('0x95')](_[_0x4f7b('0x2f')](_0xe6b4de,_0x4f7b('0x96')),function(_0x8fa122){return _[_0x4f7b('0x97')](_0x13d7cd,_0x8fa122);});if(_0x4088d7){return _0x43276a['id'];}}}));}}return BPromise['all'](_0x3434a1)['then'](function(_0x50a1e5){_0x1cf812=_(_0x1cf812)[_0x4f7b('0x98')](_0x50a1e5)['compact']()[_0x4f7b('0x99')]();return db['VoicePrefix'][_0x4f7b('0x4a')]({'where':{'id':_0x3aaa25[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](function(_0x196911){return db['sequelize']['transaction'](function(_0x228e98){return _0x196911[_0x4f7b('0x89')](_0x3aaa25['query']['ids'],{'transaction':_0x228e98})[_0x4f7b('0x28')](function(){if(!_['isEmpty'](_0x1cf812)){return _0x196911[_0x4f7b('0x74')](_0x1cf812,{'transaction':_0x228e98});}})['then'](function(){_0x1cf812[_0x4f7b('0x88')](function(_0x3dd10a){socket[_0x4f7b('0x72')](_0x4f7b('0x76'),{'UserId':_0x3dd10a,'VoicePrefixId':_0x196911['id']});});});});});});})[_0x4f7b('0x28')](respondWithStatusCode(_0x344257,null))[_0x4f7b('0x46')](handleError(_0x344257,null));}; \ No newline at end of file +var _0x1c7c=['isArray','userVoicePrefix:remove','getAgents','findOne','keys','User','order','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoicePrefix','includeAll','findAll','rows','catch','show','include','find','describe','sequelize','transaction','create','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','addAgents','params','omit','ids','emit','userVoicePrefix:save','removeAgents'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1c7c,0x164));var _0xc1c7=function(_0x248ff4,_0x516512){_0x248ff4=_0x248ff4-0x0;var _0x42e816=_0x1c7c[_0x248ff4];return _0x42e816;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];config[_0xc1c7('0x1b')]=_[_0xc1c7('0x1c')](config[_0xc1c7('0x1b')],{'host':_0xc1c7('0x1d'),'port':0x18eb});var socket=require(_0xc1c7('0x1e'))(new Redis(config[_0xc1c7('0x1b')]));require(_0xc1c7('0x1f'))[_0xc1c7('0x20')](socket);function respondWithStatusCode(_0x1b6905,_0x99b874){_0x99b874=_0x99b874||0xcc;return function(_0x34d392){if(_0x34d392){return _0x1b6905['sendStatus'](_0x99b874);}return _0x1b6905[_0xc1c7('0x21')](_0x99b874)[_0xc1c7('0x22')]();};}function respondWithResult(_0x21911c,_0x555b59){_0x555b59=_0x555b59||0xc8;return function(_0x94678a){if(_0x94678a){return _0x21911c[_0xc1c7('0x21')](_0x555b59)[_0xc1c7('0x23')](_0x94678a);}};}function respondWithFilteredResult(_0x39ac54,_0x20439e){return function(_0xb42702){if(_0xb42702){var _0x21758a=typeof _0x20439e[_0xc1c7('0x24')]==='undefined'&&typeof _0x20439e[_0xc1c7('0x25')]===_0xc1c7('0x26');var _0x3ec66a=_0xb42702[_0xc1c7('0x27')];var _0x4b706e=_0x21758a?0x0:_0x20439e[_0xc1c7('0x24')];var _0x4d6171=_0x21758a?_0xb42702[_0xc1c7('0x27')]:_0x20439e[_0xc1c7('0x24')]+_0x20439e['limit'];var _0x5846f0;if(_0x4d6171>=_0x3ec66a){_0x4d6171=_0x3ec66a;_0x5846f0=0xc8;}else{_0x5846f0=0xce;}_0x39ac54[_0xc1c7('0x21')](_0x5846f0);return _0x39ac54[_0xc1c7('0x28')](_0xc1c7('0x29'),_0x4b706e+'-'+_0x4d6171+'/'+_0x3ec66a)['json'](_0xb42702);}return null;};}function patchUpdates(_0x813853){return function(_0x341b41){try{jsonpatch[_0xc1c7('0x2a')](_0x341b41,_0x813853,!![]);}catch(_0x31a0e0){return BPromise[_0xc1c7('0x2b')](_0x31a0e0);}return _0x341b41[_0xc1c7('0x2c')]();};}function saveUpdates(_0x3180fd,_0x120168){return function(_0x22b654){if(_0x22b654){return _0x22b654[_0xc1c7('0x2d')](_0x3180fd)[_0xc1c7('0x2e')](function(_0x363fbc){return _0x363fbc;});}return null;};}function removeEntity(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(_0xf1c405){return _0xf1c405[_0xc1c7('0x2f')]()['then'](function(){var _0xf0ab9c=_0xf1c405[_0xc1c7('0x30')]({'plain':!![]});var _0x4e1721='VoicePrefixes';return db[_0xc1c7('0x31')]['destroy']({'where':{'type':_0x4e1721,'resourceId':_0xf0ab9c['id']}})['then'](function(){return _0xf1c405;});})[_0xc1c7('0x2e')](function(){_0x33aac7[_0xc1c7('0x21')](0xcc)[_0xc1c7('0x22')]();});}};}function handleEntityNotFound(_0x243450,_0x461360){return function(_0x4adb81){if(!_0x4adb81){_0x243450['sendStatus'](0x194);}return _0x4adb81;};}function handleError(_0x1b6f97,_0x4275f9){_0x4275f9=_0x4275f9||0x1f4;return function(_0x9a0ab3){logger[_0xc1c7('0x32')](_0x9a0ab3[_0xc1c7('0x33')]);if(_0x9a0ab3['name']){delete _0x9a0ab3['name'];}_0x1b6f97[_0xc1c7('0x21')](_0x4275f9)[_0xc1c7('0x34')](_0x9a0ab3);};}exports['index']=function(_0x41b154,_0x3cf425){var _0x39b68c={},_0x1f9708={},_0x74b523={'count':0x0,'rows':[]};var _0x2d69d3=_[_0xc1c7('0x35')](db['VoicePrefix'][_0xc1c7('0x36')],function(_0xeac123){return{'name':_0xeac123[_0xc1c7('0x37')],'type':_0xeac123[_0xc1c7('0x38')][_0xc1c7('0x39')]};});_0x1f9708[_0xc1c7('0x3a')]=_[_0xc1c7('0x35')](_0x2d69d3,_0xc1c7('0x3b'));_0x1f9708[_0xc1c7('0x3c')]=_['keys'](_0x41b154['query']);_0x1f9708[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],_0x1f9708[_0xc1c7('0x3c')]);_0x39b68c[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x39b68c[_0xc1c7('0x3f')]=_0x39b68c[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x39b68c[_0xc1c7('0x3f')]:_0x1f9708[_0xc1c7('0x3a')];if(!_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x39b68c[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x41b154[_0xc1c7('0x3c')]['limit']);_0x39b68c['offset']=qs['offset'](_0x41b154[_0xc1c7('0x3c')]['offset']);}_0x39b68c['order']=qs[_0xc1c7('0x44')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x44')]);_0x39b68c[_0xc1c7('0x45')]=qs['filters'](_[_0xc1c7('0x46')](_0x41b154[_0xc1c7('0x3c')],_0x1f9708[_0xc1c7('0x3d')]),_0x2d69d3);if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x39b68c[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x39b68c[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x2d69d3,function(_0x1810c7){if(_0x1810c7[_0xc1c7('0x38')]!==_0xc1c7('0x49')){var _0x23d0b2={};_0x23d0b2[_0x1810c7['name']]={'$like':'%'+_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x23d0b2;}})});}_0x39b68c=_['merge']({},_0x39b68c,_0x41b154[_0xc1c7('0x4a')]);var _0x23b10b={'where':_0x39b68c[_0xc1c7('0x45')]};return db[_0xc1c7('0x4b')][_0xc1c7('0x27')](_0x23b10b)[_0xc1c7('0x2e')](function(_0xd5e06a){_0x74b523[_0xc1c7('0x27')]=_0xd5e06a;if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x39b68c['include']=[{'all':!![]}];}return db[_0xc1c7('0x4b')][_0xc1c7('0x4d')](_0x39b68c);})['then'](function(_0x4c6834){_0x74b523[_0xc1c7('0x4e')]=_0x4c6834;return _0x74b523;})[_0xc1c7('0x2e')](respondWithFilteredResult(_0x3cf425,_0x39b68c))[_0xc1c7('0x4f')](handleError(_0x3cf425,null));};exports[_0xc1c7('0x50')]=function(_0x429221,_0x51a33f){var _0x1eca39={'raw':![],'where':{'id':_0x429221['params']['id']}},_0x805dac={};_0x805dac['model']=_['keys'](db[_0xc1c7('0x4b')][_0xc1c7('0x36')]);_0x805dac[_0xc1c7('0x3c')]=_['keys'](_0x429221[_0xc1c7('0x3c')]);_0x805dac[_0xc1c7('0x3d')]=_['intersection'](_0x805dac[_0xc1c7('0x3a')],_0x805dac[_0xc1c7('0x3c')]);_0x1eca39[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x805dac[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x1eca39[_0xc1c7('0x3f')]=_0x1eca39[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x1eca39[_0xc1c7('0x3f')]:_0x805dac[_0xc1c7('0x3a')];if(_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x1eca39[_0xc1c7('0x51')]=[{'all':!![]}];}_0x1eca39=_[_0xc1c7('0x48')]({},_0x1eca39,_0x429221[_0xc1c7('0x4a')]);return db['VoicePrefix'][_0xc1c7('0x52')](_0x1eca39)['then'](handleEntityNotFound(_0x51a33f,null))[_0xc1c7('0x2e')](respondWithResult(_0x51a33f,null))[_0xc1c7('0x4f')](handleError(_0x51a33f,null));};exports[_0xc1c7('0x2f')]=function(_0x524088,_0x473e8d){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x524088['params']['id']}})['then'](handleEntityNotFound(_0x473e8d,null))[_0xc1c7('0x2e')](removeEntity(_0x473e8d,null))[_0xc1c7('0x4f')](handleError(_0x473e8d,null));};exports['describe']=function(_0x49542,_0x12a1d2){return db[_0xc1c7('0x4b')][_0xc1c7('0x53')]()[_0xc1c7('0x2e')](respondWithResult(_0x12a1d2,null))[_0xc1c7('0x4f')](handleError(_0x12a1d2,null));};exports['create']=function(_0x259e55,_0x568377){var _0x307b5e;return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x557cb6){return db[_0xc1c7('0x4b')][_0xc1c7('0x56')](_0x259e55[_0xc1c7('0x57')],{'transaction':_0x557cb6})[_0xc1c7('0x2e')](function(_0x1679c5){_0x307b5e=_0x1679c5[_0xc1c7('0x30')]({'plain':!![]});return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0x307b5e['VoiceExtensionId']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x2a8664){return createVoicePrefixExtensions(_0x307b5e,_0x2a8664,_0x557cb6);});});})[_0xc1c7('0x2e')](function(){var _0x575fc5=_0x259e55['user'][_0xc1c7('0x30')]({'plain':!![]});if(!_0x575fc5)throw new Error(_0xc1c7('0x59'));if(_0x575fc5[_0xc1c7('0x5a')]==='user'){var _0x1c636c=_0x307b5e;return db['UserProfileSection'][_0xc1c7('0x52')]({'where':{'name':_0xc1c7('0x5b'),'userProfileId':_0x575fc5[_0xc1c7('0x5c')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x345a46){if(_0x345a46&&_0x345a46[_0xc1c7('0x5d')]===0x0){return db[_0xc1c7('0x31')]['create']({'name':_0x1c636c[_0xc1c7('0x3b')],'resourceId':_0x1c636c['id'],'type':_0x345a46[_0xc1c7('0x3b')],'sectionId':_0x345a46['id']},{})[_0xc1c7('0x2e')](function(){return _0x307b5e;});}else{return _0x307b5e;}})['catch'](function(_0x24fa71){logger['error'](_0xc1c7('0x5e'),_0x24fa71);throw _0x24fa71;});}return _0x307b5e;})['then'](respondWithResult(_0x568377,null))[_0xc1c7('0x4f')](handleError(_0x568377,null));};function Extension(_0x212d53,_0x314232,_0x3a94fb,_0x156d51){this['context']='from-sip';this['exten']=_0x212d53;this[_0xc1c7('0x5f')]=_0x3a94fb;this[_0xc1c7('0x38')]=_0xc1c7('0x60');this[_0xc1c7('0x61')]=_0xc1c7('0x62');this[_0xc1c7('0x63')]=_0x314232;this['appdata']=_0x156d51;}function createVoicePrefixExtensions(_0x19b8d7,_0xe5882,_0x1c010a){return new BPromise(function(_0x6e300e,_0x5f4f7a){var _0x2e4673=new Extension(formatPrefixName(_0x19b8d7[_0xc1c7('0x64')]),0x1,_0xc1c7('0x65'),'Voice\x20Prefix');_0x2e4673[_0xc1c7('0x66')]=_0x19b8d7['id'];return db[_0xc1c7('0x58')][_0xc1c7('0x56')](_0x2e4673,{'transaction':_0x1c010a})[_0xc1c7('0x2e')](function(_0x58b08b){var _0x552691=_0x58b08b[_0xc1c7('0x30')]({'plain':!![]});var _0x203790=_['map'](addVoicePrefixExtensions(_0x19b8d7,_0xe5882),function(_0x46dc1e){_0x46dc1e[_0xc1c7('0x67')]=_0x552691['id'];_0x46dc1e['VoicePrefixId']=_0x19b8d7['id'];return _0x46dc1e;});return db[_0xc1c7('0x58')][_0xc1c7('0x68')](_0x203790,{'transaction':_0x1c010a})['then'](function(_0x6b9337){if(!_0x6b9337){return _0x5f4f7a(_0xc1c7('0x69'));}else{return _0x6e300e(_0x6b9337);}})[_0xc1c7('0x4f')](function(_0x2b4db2){return _0x5f4f7a(_0x2b4db2);});});;});};function addVoicePrefixExtensions(_0x1087b2,_0x11c9d8){var _0x1ed9fc=[];var _0x33104e=formatPrefixName(_0x1087b2[_0xc1c7('0x64')]);_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x2,_0xc1c7('0x6b'),_0xc1c7('0x6c')+_0x1087b2[_0xc1c7('0x3b')]));if(_0x1087b2[_0xc1c7('0x6d')]){_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x6b'),_0xc1c7('0x6e')+_0x1087b2[_0xc1c7('0x6d')]));}else{_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x65'),_0xc1c7('0x6f')));}_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x4,_0xc1c7('0x70'),_0x11c9d8[_0xc1c7('0x71')]+','+_0xc1c7('0x72')+(0x8+_0x1087b2[_0xc1c7('0x3b')][_0xc1c7('0x41')])+'}'+','+0x1));return _0x1ed9fc;}function formatPrefixName(_0x1448d8){var _0x47d58e='_';for(var _0x8c88c0=0x0;_0x8c88c0<_0x1448d8[_0xc1c7('0x41')];_0x8c88c0++){if(_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)=='-'){_0x47d58e+=_0x1448d8[_0xc1c7('0x73')](_0x8c88c0);}else{_0x47d58e+='['+_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)+']';}}_0x47d58e+='.';return _0x47d58e;}exports[_0xc1c7('0x2d')]=function(_0x1ccd7d,_0x29181f,_0x5f4f50){var _0xbbd4e3=_0x1ccd7d[_0xc1c7('0x57')];_0xbbd4e3[_0xc1c7('0x64')]=_0xc1c7('0x74')+_0xbbd4e3[_0xc1c7('0x3b')]+'-';return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0xa00af6){return db['VoicePrefix'][_0xc1c7('0x2d')](_0xbbd4e3,{'where':{'id':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x2f')]({'where':{'VoicePrefixId':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0xbbd4e3[_0xc1c7('0x67')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x125270){return createVoicePrefixExtensions(_0xbbd4e3,_0x125270,_0xa00af6);});});});})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x4b')]['findById'](_0xbbd4e3['id']);})['then'](respondWithResult(_0x29181f,null))[_0xc1c7('0x4f')](handleError(_0x29181f,null));};exports[_0xc1c7('0x75')]=function(_0xc16f09,_0x11fd01,_0x44a24b){return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0xc16f09[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x11fd01,null))[_0xc1c7('0x2e')](function(_0x180607){if(_0x180607){return _0x180607[_0xc1c7('0x75')](_0xc16f09[_0xc1c7('0x57')]['ids'],_[_0xc1c7('0x77')](_0xc16f09[_0xc1c7('0x57')],[_0xc1c7('0x78'),'id'])||{})['spread'](function(_0x4de022){for(var _0x550c4a=0x0;_0x550c4a<_0xc16f09[_0xc1c7('0x57')][_0xc1c7('0x78')]['length'];_0x550c4a+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7a'),{'UserId':Number(_0xc16f09['body']['ids'][_0x550c4a]),'VoicePrefixId':Number(_0xc16f09['params']['id'])});}return _0x4de022;});}})[_0xc1c7('0x2e')](respondWithResult(_0x11fd01,null))['catch'](handleError(_0x11fd01,null));};exports[_0xc1c7('0x7b')]=function(_0x3bc3aa,_0xf899a,_0x4b7a34){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x3bc3aa[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0xf899a,null))['then'](function(_0xf7b22e){if(_0xf7b22e){return _0xf7b22e[_0xc1c7('0x7b')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])[_0xc1c7('0x2e')](function(){if(_[_0xc1c7('0x7c')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])){for(var _0x425f3d=0x0;_0x425f3d<_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0xc1c7('0x41')];_0x425f3d+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':Number(_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0x425f3d]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}}else{socket[_0xc1c7('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x3bc3aa['query'][_0xc1c7('0x78')]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0xf899a,null))[_0xc1c7('0x4f')](handleError(_0xf899a,null));};exports[_0xc1c7('0x7e')]=function(_0x176603,_0x48309e,_0x1f0c3f){var _0x2ad4f5={};var _0x5698e9={};var _0x65161e;var _0x32c26e;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x176603[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x48309e,null))[_0xc1c7('0x2e')](function(_0x175bba){if(_0x175bba){_0x65161e=_0x175bba;_0x5698e9[_0xc1c7('0x3a')]=_[_0xc1c7('0x80')](db[_0xc1c7('0x81')][_0xc1c7('0x36')]);_0x5698e9[_0xc1c7('0x3c')]=_[_0xc1c7('0x80')](_0x176603['query']);_0x5698e9[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x5698e9[_0xc1c7('0x3a')],_0x5698e9[_0xc1c7('0x3c')]);_0x2ad4f5[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x5698e9['model'],qs[_0xc1c7('0x40')](_0x176603[_0xc1c7('0x3c')]['fields']));_0x2ad4f5['attributes']=_0x2ad4f5[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x2ad4f5[_0xc1c7('0x3f')]:_0x5698e9[_0xc1c7('0x3a')];_0x2ad4f5[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x176603['query'][_0xc1c7('0x44')]);_0x2ad4f5[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x176603['query'],_0x5698e9[_0xc1c7('0x3d')]));if(_0x176603['query'][_0xc1c7('0x47')]){_0x2ad4f5['where']=_[_0xc1c7('0x48')](_0x2ad4f5[_0xc1c7('0x45')],{'$or':_['map'](_0x2ad4f5[_0xc1c7('0x3f')],function(_0x30e6ca){var _0x44aee1={};_0x44aee1[_0x30e6ca]={'$like':'%'+_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x44aee1;})});}_0x2ad4f5=_[_0xc1c7('0x48')]({},_0x2ad4f5,_0x176603[_0xc1c7('0x4a')]);return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})[_0xc1c7('0x2e')](function(_0xe1e5dd){if(_0xe1e5dd){_0x32c26e=_0xe1e5dd[_0xc1c7('0x41')];if(!_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x2ad4f5[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x25')]);_0x2ad4f5[_0xc1c7('0x24')]=qs['offset'](_0x176603['query']['offset']);}return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})['then'](function(_0x49c29b){if(_0x49c29b){return _0x49c29b?{'count':_0x32c26e,'rows':_0x49c29b}:null;}})['then'](respondWithResult(_0x48309e,null))[_0xc1c7('0x4f')](handleError(_0x48309e,null));};exports[_0xc1c7('0x83')]=function(_0x56cd17,_0x5d60e8,_0x57b04b){var _0x238077={};var _0x454b0d={};var _0x20a948;var _0x18b20f;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x56cd17['params']['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x5d60e8,null))[_0xc1c7('0x2e')](function(_0x2b9cff){if(_0x2b9cff){_0x20a948=_0x2b9cff;_0x454b0d['model']=_[_0xc1c7('0x80')](db[_0xc1c7('0x84')][_0xc1c7('0x36')]);_0x454b0d['query']=_[_0xc1c7('0x80')](_0x56cd17[_0xc1c7('0x3c')]);_0x454b0d[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x454b0d[_0xc1c7('0x3a')],_0x454b0d[_0xc1c7('0x3c')]);_0x238077[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x454b0d['model'],qs['fields'](_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x238077[_0xc1c7('0x3f')]=_0x238077['attributes'][_0xc1c7('0x41')]?_0x238077[_0xc1c7('0x3f')]:_0x454b0d[_0xc1c7('0x3a')];_0x238077[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x56cd17['query'][_0xc1c7('0x44')]);_0x238077[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x56cd17[_0xc1c7('0x3c')],_0x454b0d[_0xc1c7('0x3d')]));if(_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x238077[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x238077[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x238077[_0xc1c7('0x3f')],function(_0x38e932){var _0x265a7a={};_0x265a7a[_0x38e932]={'$like':'%'+_0x56cd17['query'][_0xc1c7('0x47')]+'%'};return _0x265a7a;})});}_0x238077=_[_0xc1c7('0x48')]({},_0x238077,_0x56cd17[_0xc1c7('0x4a')]);return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x4855ba){if(_0x4855ba){_0x18b20f=_0x4855ba[_0xc1c7('0x41')];if(!_0x56cd17['query'][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x238077[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x56cd17['query'][_0xc1c7('0x25')]);_0x238077['offset']=qs[_0xc1c7('0x24')](_0x56cd17[_0xc1c7('0x3c')]['offset']);}return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x324a87){if(_0x324a87){return _0x324a87?{'count':_0x18b20f,'rows':_0x324a87}:null;}})['then'](respondWithResult(_0x5d60e8,null))[_0xc1c7('0x4f')](handleError(_0x5d60e8,null));};exports[_0xc1c7('0x85')]=function(_0x2b4a14,_0x18e4c4,_0x27edc3){var _0x4bae45=_0x2b4a14[_0xc1c7('0x57')]['ids'];var _0x183c59;return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x4bae45},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id','name',_0xc1c7('0x87'),_0xc1c7('0x88'),_0xc1c7('0x89')],'raw':!![]}]})[_0xc1c7('0x2e')](function(_0x4ccff5){if(_0x4ccff5){_0x183c59=_0x4ccff5;var _0x287d57=_[_0xc1c7('0x8a')](_0x4ccff5,function(_0x1732a5){var _0x20dccd=_0x1732a5[_0xc1c7('0x30')]({'plain':!![]});return _0x20dccd[_0xc1c7('0x86')];});return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0x2b4a14[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](function(_0x45e974){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x4d78b8){return _0x45e974[_0xc1c7('0x85')](_0x4bae45,{'transaction':_0x4d78b8})[_0xc1c7('0x2e')](function(){return BPromise['each'](_0x183c59,function(_0x125085){return db[_0xc1c7('0x8b')][_0xc1c7('0x8c')]({'TeamId':_0x125085['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},{'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){return BPromise[_0xc1c7('0x8d')](_0x287d57,function(_0x846c80){return db['UserVoicePrefix'][_0xc1c7('0x8e')]({'where':{'UserId':_0x846c80['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){_0x287d57[_0xc1c7('0x8f')](function(_0x2a5267){socket['emit'](_0xc1c7('0x7a'),{'UserId':_0x2a5267['id'],'VoicePrefixId':_0x45e974['id']});});});});});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0x18e4c4,null))[_0xc1c7('0x4f')](handleError(_0x18e4c4,null));};exports[_0xc1c7('0x90')]=function(_0x1bed9e,_0x39997a,_0x1273ae){return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')]},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x39997a,null))[_0xc1c7('0x2e')](function(_0x1e7149){var _0x23d84c=_[_0xc1c7('0x35')](_0x1e7149,'id');var _0x22052c=[];var _0x2ca2c1=[];var _0x1f926a=squel[_0xc1c7('0x91')]();_0x1f926a['field'](_0xc1c7('0x92'))[_0xc1c7('0x93')](_0xc1c7('0x94'),'tq')['join'](_0xc1c7('0x95'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc1c7('0x45')](_0xc1c7('0x96'),_0x1bed9e[_0xc1c7('0x76')]['id']);for(var _0x146e74=0x0;_0x146e74<_0x1e7149[_0xc1c7('0x41')];_0x146e74+=0x1){let _0x3f10ac=_0x1e7149[_0x146e74];for(var _0x3a5abd=0x0;_0x3a5abd<_0x3f10ac[_0xc1c7('0x86')][_0xc1c7('0x41')];_0x3a5abd+=0x1){let _0x494ba4=_0x3f10ac[_0xc1c7('0x86')][_0x3a5abd];var _0x4fead5=_0x1f926a[_0xc1c7('0x97')]();_0x4fead5[_0xc1c7('0x45')](_0xc1c7('0x98'),_0x494ba4['id']);_0x2ca2c1[_0xc1c7('0x6a')](db[_0xc1c7('0x54')][_0xc1c7('0x3c')](_0x4fead5[_0xc1c7('0x99')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xc1c7('0x2e')](function(_0x198e78){if(_0x198e78[_0xc1c7('0x41')]===0x1){return _0x494ba4['id'];}else{var _0xde9a91=_[_0xc1c7('0x9a')](_['map'](_0x198e78,_0xc1c7('0x9b')),function(_0x3d6078){return _[_0xc1c7('0x9c')](_0x23d84c,_0x3d6078);});if(_0xde9a91){return _0x494ba4['id'];}}}));}}return BPromise[_0xc1c7('0x9d')](_0x2ca2c1)[_0xc1c7('0x2e')](function(_0x3f0e2c){_0x22052c=_(_0x22052c)[_0xc1c7('0x9e')](_0x3f0e2c)['compact']()[_0xc1c7('0x9f')]();return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x1bed9e['params']['id']}})[_0xc1c7('0x2e')](function(_0x2801fb){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x43c3c3){return _0x2801fb[_0xc1c7('0x90')](_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')],{'transaction':_0x43c3c3})[_0xc1c7('0x2e')](function(){if(!_['isEmpty'](_0x22052c)){return _0x2801fb['removeAgents'](_0x22052c,{'transaction':_0x43c3c3});}})[_0xc1c7('0x2e')](function(){_0x22052c['forEach'](function(_0x479d8a){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':_0x479d8a,'VoicePrefixId':_0x2801fb['id']});});});});});});})[_0xc1c7('0x2e')](respondWithStatusCode(_0x39997a,null))[_0xc1c7('0x4f')](handleError(_0x39997a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2752866..3a1c542 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 _0x6825=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x2a5325,_0x33d41d){var _0x3c22e5=function(_0x521aab){while(--_0x521aab){_0x2a5325['push'](_0x2a5325['shift']());}};_0x3c22e5(++_0x33d41d);}(_0x6825,0x1e2));var _0x5682=function(_0x489bdc,_0x1e9863){_0x489bdc=_0x489bdc-0x0;var _0x91207b=_0x6825[_0x489bdc];return _0x91207b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x5682('0x0'))['db'][_0x5682('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5682('0x2')](0x0);var events={'afterCreate':_0x5682('0x3'),'afterUpdate':_0x5682('0x4'),'afterDestroy':_0x5682('0x5')};function emitEvent(_0x46e64d){return function(_0x24330b,_0x5c66a6,_0xa3fd4e){VoicePrefixEvents['emit'](_0x46e64d+':'+_0x24330b['id'],_0x24330b);VoicePrefixEvents[_0x5682('0x6')](_0x46e64d,_0x24330b);_0xa3fd4e(null);};}for(var e in events){if(events[_0x5682('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x5682('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x864c=['hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x18d272,_0x22a8cc){var _0x329899=function(_0x36834a){while(--_0x36834a){_0x18d272['push'](_0x18d272['shift']());}};_0x329899(++_0x22a8cc);}(_0x864c,0x1e8));var _0xc864=function(_0x2c3211,_0x545a69){_0x2c3211=_0x2c3211-0x0;var _0x502975=_0x864c[_0x2c3211];return _0x502975;};'use strict';var EventEmitter=require(_0xc864('0x0'));var VoicePrefix=require(_0xc864('0x1'))['db'][_0xc864('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc864('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc864('0x4'),'afterDestroy':_0xc864('0x5')};function emitEvent(_0x5bde7e){return function(_0x307484,_0x3c6524,_0x433634){VoicePrefixEvents['emit'](_0x5bde7e+':'+_0x307484['id'],_0x307484);VoicePrefixEvents[_0xc864('0x6')](_0x5bde7e,_0x307484);_0x433634(null);};}for(var e in events){if(events[_0xc864('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xc864('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ca55c62..8e4a4d1 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 _0x7704=['moment','bluebird','request-promise','path','./voicePrefix.attributes','define','util','../../config/logger','api'];(function(_0x20b100,_0x2e7dbf){var _0x35be82=function(_0xbaeea2){while(--_0xbaeea2){_0x20b100['push'](_0x20b100['shift']());}};_0x35be82(++_0x2e7dbf);}(_0x7704,0xde));var _0x4770=function(_0x5c6c33,_0x5b25e6){_0x5c6c33=_0x5c6c33-0x0;var _0x2b25eb=_0x7704[_0x5c6c33];return _0x2b25eb;};'use strict';var _=require('lodash');var util=require(_0x4770('0x0'));var logger=require(_0x4770('0x1'))(_0x4770('0x2'));var moment=require(_0x4770('0x3'));var BPromise=require(_0x4770('0x4'));var rp=require(_0x4770('0x5'));var fs=require('fs');var path=require(_0x4770('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4770('0x7'));module['exports']=function(_0x37a0e8,_0x29b004){return _0x37a0e8[_0x4770('0x8')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ae=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./voicePrefix.attributes'];(function(_0x48fbb8,_0xbe3e3c){var _0x245d2e=function(_0x7ced96){while(--_0x7ced96){_0x48fbb8['push'](_0x48fbb8['shift']());}};_0x245d2e(++_0xbe3e3c);}(_0x16ae,0xdf));var _0xe16a=function(_0x5e7654,_0x55fc47){_0x5e7654=_0x5e7654-0x0;var _0x214357=_0x16ae[_0x5e7654];return _0x214357;};'use strict';var _=require(_0xe16a('0x0'));var util=require(_0xe16a('0x1'));var logger=require(_0xe16a('0x2'))('api');var moment=require(_0xe16a('0x3'));var BPromise=require('bluebird');var rp=require(_0xe16a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe16a('0x5'));var attributes=require(_0xe16a('0x6'));module['exports']=function(_0x2f8c82,_0x33ea61){return _0x2f8c82[_0xe16a('0x7')](_0xe16a('0x8'),attributes,{'tableName':_0xe16a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 2f43ac5..3875a57 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 _0x073d=['message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0x073d,0xd2));var _0xd073=function(_0xf022be,_0x14e78e){_0xf022be=_0xf022be-0x0;var _0x18d7d5=_0x073d[_0xf022be];return _0x18d7d5;};'use strict';var _=require('lodash');var util=require(_0xd073('0x0'));var moment=require(_0xd073('0x1'));var BPromise=require(_0xd073('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd073('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd073('0x4'));var logger=require(_0xd073('0x5'))('rpc');var config=require(_0xd073('0x6'));var jayson=require(_0xd073('0x7'));var client=jayson[_0xd073('0x8')][_0xd073('0x9')]({'port':0x232a});config[_0xd073('0xa')]=_[_0xd073('0xb')](config[_0xd073('0xa')],{'host':_0xd073('0xc'),'port':0x18eb});var socket=require(_0xd073('0xd'))(new Redis(config[_0xd073('0xa')]));require(_0xd073('0xe'))[_0xd073('0xf')](socket);function respondWithRpcPromise(_0x238d31,_0x3f1fc6,_0x5c916e){return new BPromise(function(_0x53abea,_0xf39d94){return client['request'](_0x238d31,_0x5c916e)[_0xd073('0x10')](function(_0xf3f0f0){logger[_0xd073('0x11')](_0xd073('0x12'),_0x3f1fc6,_0xd073('0x13'));logger['debug'](_0xd073('0x14'),_0x3f1fc6,_0xd073('0x13'),JSON[_0xd073('0x15')](_0xf3f0f0));if(_0xf3f0f0[_0xd073('0x16')]){if(_0xf3f0f0['error'][_0xd073('0x17')]===0x1f4){logger[_0xd073('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3f1fc6,_0xf3f0f0[_0xd073('0x16')][_0xd073('0x18')]);return _0xf39d94(_0xf3f0f0[_0xd073('0x16')][_0xd073('0x18')]);}logger['error'](_0xd073('0x12'),_0x3f1fc6,_0xf3f0f0['error']['message']);return _0x53abea(_0xf3f0f0[_0xd073('0x16')][_0xd073('0x18')]);}else{logger[_0xd073('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3f1fc6,_0xd073('0x13'));_0x53abea(_0xf3f0f0[_0xd073('0x19')][_0xd073('0x18')]);}})['catch'](function(_0x194db8){logger[_0xd073('0x16')](_0xd073('0x12'),_0x3f1fc6,_0x194db8);_0xf39d94(_0x194db8);});});} \ No newline at end of file +var _0x7e02=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4e2750,_0xcbaafb){var _0x35a95d=function(_0x17066e){while(--_0x17066e){_0x4e2750['push'](_0x4e2750['shift']());}};_0x35a95d(++_0xcbaafb);}(_0x7e02,0x71));var _0x27e0=function(_0x334f61,_0x20cd4c){_0x334f61=_0x334f61-0x0;var _0x307da4=_0x7e02[_0x334f61];return _0x307da4;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var moment=require(_0x27e0('0x2'));var BPromise=require(_0x27e0('0x3'));var rs=require(_0x27e0('0x4'));var fs=require('fs');var Redis=require(_0x27e0('0x5'));var db=require(_0x27e0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x27e0('0x8'));var client=jayson[_0x27e0('0x9')][_0x27e0('0xa')]({'port':0x232a});config[_0x27e0('0xb')]=_[_0x27e0('0xc')](config[_0x27e0('0xb')],{'host':_0x27e0('0xd'),'port':0x18eb});var socket=require(_0x27e0('0xe'))(new Redis(config['redis']));require(_0x27e0('0xf'))['register'](socket);function respondWithRpcPromise(_0xa5a2fd,_0x1d7413,_0x480486){return new BPromise(function(_0x17f18d,_0xbf3ce5){return client[_0x27e0('0x10')](_0xa5a2fd,_0x480486)[_0x27e0('0x11')](function(_0x12db7d){logger[_0x27e0('0x12')](_0x27e0('0x13'),_0x1d7413,_0x27e0('0x14'));logger[_0x27e0('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1d7413,_0x27e0('0x14'),JSON[_0x27e0('0x16')](_0x12db7d));if(_0x12db7d[_0x27e0('0x17')]){if(_0x12db7d['error'][_0x27e0('0x18')]===0x1f4){logger[_0x27e0('0x17')](_0x27e0('0x13'),_0x1d7413,_0x12db7d['error'][_0x27e0('0x19')]);return _0xbf3ce5(_0x12db7d[_0x27e0('0x17')][_0x27e0('0x19')]);}logger[_0x27e0('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x1d7413,_0x12db7d['error'][_0x27e0('0x19')]);return _0x17f18d(_0x12db7d[_0x27e0('0x17')][_0x27e0('0x19')]);}else{logger[_0x27e0('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x1d7413,_0x27e0('0x14'));_0x17f18d(_0x12db7d[_0x27e0('0x1a')][_0x27e0('0x19')]);}})[_0x27e0('0x1b')](function(_0x608e4f){logger[_0x27e0('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x1d7413,_0x608e4f);_0xbf3ce5(_0x608e4f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7c4ca82..4eb38f9 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 _0x9090=['remove','update','emit','register','length','./voicePrefix.events','save'];(function(_0x2e8390,_0x7ff493){var _0xefdfd5=function(_0x5136bf){while(--_0x5136bf){_0x2e8390['push'](_0x2e8390['shift']());}};_0xefdfd5(++_0x7ff493);}(_0x9090,0x17f));var _0x0909=function(_0x558df9,_0x1ab271){_0x558df9=_0x558df9-0x0;var _0x182a88=_0x9090[_0x558df9];return _0x182a88;};'use strict';var VoicePrefixEvents=require(_0x0909('0x0'));var events=[_0x0909('0x1'),_0x0909('0x2'),_0x0909('0x3')];function createListener(_0x27eba2,_0x5466c8){return function(_0x51923f){_0x5466c8[_0x0909('0x4')](_0x27eba2,_0x51923f);};}function removeListener(_0x289665,_0x29bc19){return function(){VoicePrefixEvents['removeListener'](_0x289665,_0x29bc19);};}exports[_0x0909('0x5')]=function(_0x42af40){for(var _0x5317db=0x0,_0x41d8fc=events[_0x0909('0x6')];_0x5317db<_0x41d8fc;_0x5317db++){var _0x32bf48=events[_0x5317db];var _0x1755ee=createListener('voicePrefix:'+_0x32bf48,_0x42af40);VoicePrefixEvents['on'](_0x32bf48,_0x1755ee);}}; \ No newline at end of file +var _0x6c4b=['emit','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x59f136,_0x52c0d){var _0x1949ce=function(_0x1f292a){while(--_0x1f292a){_0x59f136['push'](_0x59f136['shift']());}};_0x1949ce(++_0x52c0d);}(_0x6c4b,0x93));var _0xb6c4=function(_0x3eead8,_0x58145a){_0x3eead8=_0x3eead8-0x0;var _0x1df4a2=_0x6c4b[_0x3eead8];return _0x1df4a2;};'use strict';var VoicePrefixEvents=require(_0xb6c4('0x0'));var events=[_0xb6c4('0x1'),_0xb6c4('0x2'),'update'];function createListener(_0x1f07f4,_0x2a1872){return function(_0x235930){_0x2a1872[_0xb6c4('0x3')](_0x1f07f4,_0x235930);};}function removeListener(_0x459ef7,_0x27f46b){return function(){VoicePrefixEvents['removeListener'](_0x459ef7,_0x27f46b);};}exports['register']=function(_0x1f7abc){for(var _0x5a290a=0x0,_0x109973=events[_0xb6c4('0x4')];_0x5a290a<_0x109973;_0x5a290a++){var _0x554935=events[_0x5a290a];var _0x312141=createListener(_0xb6c4('0x5')+_0x554935,_0x1f7abc);VoicePrefixEvents['on'](_0x554935,_0x312141);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7ad1765..a1dad95 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(_0x350e20,_0x11d843){var _0x4d25c7=function(_0x35e7a7){while(--_0x35e7a7){_0x350e20['push'](_0x350e20['shift']());}};_0x4d25c7(++_0x11d843);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xb10b,0x12a));var _0xbb10=function(_0x1005d4,_0x5199ab){_0x1005d4=_0x1005d4-0x0;var _0x421977=_0xb10b[_0x1005d4];return _0x421977;};'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 0824b14..cbeb464 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 _0xbfe8=['Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','STRING','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','setDataValue','strategy','getDataValue','dialMethod','outbound','preview','roundrobin','includes','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','booked','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x161eba,_0x23688b){var _0xe56027=function(_0x1198f2){while(--_0x1198f2){_0x161eba['push'](_0x161eba['shift']());}};_0xe56027(++_0x23688b);}(_0xbfe8,0x105));var _0x8bfe=function(_0xd4346f,_0x143bbd){_0xd4346f=_0xd4346f-0x0;var _0x5dd725=_0xbfe8[_0xd4346f];return _0x5dd725;};'use strict';var Sequelize=require(_0x8bfe('0x0'));module[_0x8bfe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8bfe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x8bfe('0x4')},'musiconhold':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':_0x8bfe('0x6')},'announce':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8bfe('0x3')]('rr',_0x8bfe('0x7'),_0x8bfe('0x8'),_0x8bfe('0x9'),'random',_0x8bfe('0xa'),'linear',_0x8bfe('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x396977){this[_0x8bfe('0xc')](_0x8bfe('0xd'),_0x396977?_0x396977:_0x8bfe('0xa'));},'get':function(){var _0x454dc5=this[_0x8bfe('0xe')]('type');var _0x5d7cfc=this['getDataValue'](_0x8bfe('0xf'));var _0x4bf33d=this['getDataValue']('strategy');if(_0x454dc5===_0x8bfe('0x10')){if(_0x5d7cfc===_0x8bfe('0x11')){return null;}if(_0x5d7cfc==='booked'&&![_0x8bfe('0xa'),_0x8bfe('0x12')][_0x8bfe('0x13')](_0x4bf33d)){this[_0x8bfe('0xc')]('strategy',_0x8bfe('0xa'));}}return _0x4bf33d;}},'servicelevel':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8bfe('0x5')]},'weight':{'type':Sequelize[_0x8bfe('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':_0x8bfe('0x15')},'autopause':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8bfe('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8bfe('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8bfe('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8bfe('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8bfe('0x3')]('yes','no'),'defaultValue':_0x8bfe('0x15')},'announce_holdtime':{'type':Sequelize[_0x8bfe('0x3')]('yes','no',_0x8bfe('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x8bfe('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8bfe('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8bfe('0x5')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8bfe('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8bfe('0x5')]},'queue_quantity1':{'type':Sequelize[_0x8bfe('0x5')]},'queue_quantity2':{'type':Sequelize[_0x8bfe('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x8bfe('0x5')]},'queue_less_than':{'type':Sequelize[_0x8bfe('0x5')]},'periodic_announce':{'type':Sequelize[_0x8bfe('0x17')],'set':function(_0x8fccac){this[_0x8bfe('0xc')]('periodic_announce',_0x8fccac?_0x8fccac[_0x8bfe('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0x8bfe('0x19'))?this[_0x8bfe('0xe')](_0x8bfe('0x19'))[_0x8bfe('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':_0x8bfe('0x15'),'set':function(_0x189259){this[_0x8bfe('0xc')](_0x8bfe('0x1b'),_0x189259?_0x189259[_0x8bfe('0x18')](','):undefined);},'get':function(){return this[_0x8bfe('0xe')](_0x8bfe('0x1b'))?this[_0x8bfe('0xe')](_0x8bfe('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':'no','set':function(_0x29205d){this['setDataValue'](_0x8bfe('0x1c'),_0x29205d?_0x29205d['join'](','):undefined);},'get':function(){return this[_0x8bfe('0xe')]('leavewhenempty')?this[_0x8bfe('0xe')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8bfe('0x5')]},'description':{'type':Sequelize[_0x8bfe('0x5')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3c87d6){this['setDataValue'](_0x8bfe('0x1d'),_0x3c87d6);if(_0x3c87d6){if(this[_0x8bfe('0xe')]('wrapuptime')<0x2){this['setDataValue'](_0x8bfe('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8bfe('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':0x0,'comment':_0x8bfe('0x20')},'dialMethod':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x11'),_0x8bfe('0x21'),'power',_0x8bfe('0x22'),_0x8bfe('0x23')),'defaultValue':_0x8bfe('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x8bfe('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x8bfe('0x14')](0x4)[_0x8bfe('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8bfe('0x25')},'dialPowerLevel':{'type':Sequelize[_0x8bfe('0x26')](0x2)[_0x8bfe('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8bfe('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x28'),_0x8bfe('0x29')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x8bfe('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8bfe('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8bfe('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8bfe('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bfe('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x8bfe('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bfe('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x8bfe('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8bfe('0x14')](0x5)[_0x8bfe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bfe('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bfe('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8bfe('0x14')](0x5)[_0x8bfe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'comment':_0x8bfe('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bfe('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8bfe('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8bfe('0x33')},'dialTimezone':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8bfe('0x5')],'defaultValue':_0x8bfe('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8bfe('0x35'),'never',_0x8bfe('0x36')),'defaultValue':_0x8bfe('0x35')},'dialAMDActive':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':0x0,'comment':_0x8bfe('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x8bfe('0x14')](0x9)[_0x8bfe('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8bfe('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x8bfe('0x14')](0x9)[_0x8bfe('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8bfe('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8bfe('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8bfe('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x8bfe('0x14')](0x9)[_0x8bfe('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8bfe('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8bfe('0x14')](0x9)[_0x8bfe('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8bfe('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8bfe('0x14')](0x9)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8bfe('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8bfe('0x14')](0x5)[_0x8bfe('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8bfe('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8bfe('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x8bfe('0x14')](0x5)[_0x8bfe('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8bfe('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':0x0,'comment':_0x8bfe('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8bfe('0x3')](_0x8bfe('0x40'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x8bfe('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8bfe('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8bfe('0x41')},'dialCutDigit':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8bfe('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8bfe('0x14')](0x5)[_0x8bfe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bfe('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bfe('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x8bfe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8bfe('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bfe('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8bfe('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8bfe('0x14')](0x5)[_0x8bfe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bfe('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bfe('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8bfe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bfe('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8bfe('0x14')],'allowNull':!![],'comment':_0x8bfe('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x560712){if(!_0x560712)this[_0x8bfe('0xc')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x8bfe('0x4a'),_0x560712);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8bfe('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x8bfe('0x14')](0x3)[_0x8bfe('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8bfe('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x2e27=['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)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','inbound','outbound','ENUM','leastrecent','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','preview','booked','includes','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2e27,0x162));var _0x72e2=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x2e27[_0x383356];return _0x32ee5a;};'use strict';var Sequelize=require(_0x72e2('0x0'));module[_0x72e2('0x1')]={'name':{'type':Sequelize[_0x72e2('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x72e2('0x3'),_0x72e2('0x4')),'allowNull':![],'defaultValue':_0x72e2('0x3')},'musiconhold':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x72e2('0x5')]('rr','ringall',_0x72e2('0x6'),'fewestcalls',_0x72e2('0x7'),_0x72e2('0x8'),_0x72e2('0x9'),_0x72e2('0xa'),_0x72e2('0xb')),'allowNull':![],'defaultValue':_0x72e2('0xc'),'set':function(_0x4130d3){this[_0x72e2('0xd')](_0x72e2('0xe'),_0x4130d3?_0x4130d3:_0x72e2('0x8'));},'get':function(){var _0x9342ae=this[_0x72e2('0xf')](_0x72e2('0x10'));var _0x5d7ebf=this[_0x72e2('0xf')]('dialMethod');var _0x3f3f4c=this[_0x72e2('0xf')]('strategy');if(_0x9342ae==='outbound'){if(_0x5d7ebf===_0x72e2('0x11')){return null;}if(_0x5d7ebf===_0x72e2('0x12')&&![_0x72e2('0x8'),'roundrobin'][_0x72e2('0x13')](_0x3f3f4c)){this[_0x72e2('0xd')](_0x72e2('0xe'),_0x72e2('0x8'));}}return _0x3f3f4c;}},'servicelevel':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x72e2('0x14')](0xb)},'timeout':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x72e2('0x2')]},'weight':{'type':Sequelize[_0x72e2('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no',_0x72e2('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x72e2('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x72e2('0x5')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x72e2('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x72e2('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x72e2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':_0x72e2('0x15')},'announce_holdtime':{'type':Sequelize[_0x72e2('0x5')]('yes','no',_0x72e2('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x72e2('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x72e2('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x72e2('0x2')]},'queue_youarenext':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x72e2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x72e2('0x2')]},'queue_quantity1':{'type':Sequelize[_0x72e2('0x2')]},'queue_quantity2':{'type':Sequelize[_0x72e2('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x72e2('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xb56237){this['setDataValue']('periodic_announce',_0xb56237?_0xb56237[_0x72e2('0x18')](','):[]);},'get':function(){return this[_0x72e2('0xf')](_0x72e2('0x19'))?this[_0x72e2('0xf')](_0x72e2('0x19'))[_0x72e2('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':'yes','set':function(_0x39fb8c){this[_0x72e2('0xd')](_0x72e2('0x1b'),_0x39fb8c?_0x39fb8c[_0x72e2('0x18')](','):undefined);},'get':function(){return this[_0x72e2('0xf')](_0x72e2('0x1b'))?this[_0x72e2('0xf')](_0x72e2('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':'no','set':function(_0x4524ed){this[_0x72e2('0xd')](_0x72e2('0x1c'),_0x4524ed?_0x4524ed[_0x72e2('0x18')](','):undefined);},'get':function(){return this[_0x72e2('0xf')]('leavewhenempty')?this[_0x72e2('0xf')](_0x72e2('0x1c'))[_0x72e2('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x72e2('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x72e2('0x2')]},'description':{'type':Sequelize[_0x72e2('0x2')]},'acw':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':0x0,'set':function(_0x56abf9){this[_0x72e2('0xd')]('acw',_0x56abf9);if(_0x56abf9){if(this['getDataValue']('wrapuptime')<0x2){this[_0x72e2('0xd')](_0x72e2('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x72e2('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':0x0,'comment':_0x72e2('0x1f')},'dialMethod':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x11'),'progressive',_0x72e2('0x20'),_0x72e2('0x21'),_0x72e2('0x12')),'defaultValue':_0x72e2('0x22'),'comment':_0x72e2('0x23')},'dialLimitChannel':{'type':Sequelize[_0x72e2('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x72e2('0x24')},'dialLimitQueue':{'type':Sequelize[_0x72e2('0x14')](0x4)[_0x72e2('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x72e2('0x26')},'dialPowerLevel':{'type':Sequelize[_0x72e2('0x27')](0x2)[_0x72e2('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x72e2('0x5')]('agentBusyFactor',_0x72e2('0x28')),'defaultValue':_0x72e2('0x28'),'comment':_0x72e2('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x72e2('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x72e2('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x72e2('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x72e2('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x72e2('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':'tTxX','comment':_0x72e2('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x2e')},'dialQueueProject':{'type':Sequelize[_0x72e2('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)[_0x72e2('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x72e2('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x72e2('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x72e2('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x72e2('0x35')},'dialTimezone':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x72e2('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x36'),_0x72e2('0x37'),_0x72e2('0x38')),'defaultValue':_0x72e2('0x36')},'dialAMDActive':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':0x0,'comment':_0x72e2('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x72e2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x72e2('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x72e2('0x14')](0x9)[_0x72e2('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x72e2('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x72e2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x72e2('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x72e2('0x14')](0x9)[_0x72e2('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x72e2('0x14')](0x9)[_0x72e2('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x72e2('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x72e2('0x14')](0x9)[_0x72e2('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x72e2('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x72e2('0x14')](0x9)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x72e2('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x72e2('0x14')](0x5)[_0x72e2('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x72e2('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x72e2('0x14')](0x9)[_0x72e2('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x72e2('0x14')](0x5)[_0x72e2('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x72e2('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':0x0,'comment':_0x72e2('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x72e2('0x5')](_0x72e2('0x43'),'ASC'),'defaultValue':_0x72e2('0x43')},'dialQueueProject2':{'type':Sequelize[_0x72e2('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)[_0x72e2('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)[_0x72e2('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x72e2('0x14')](0x3)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x72e2('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x72e2('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x72e2('0x14')](0x5)[_0x72e2('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x72e2('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x72e2('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2e4797){if(!_0x2e4797)this[_0x72e2('0xd')](_0x72e2('0x4d'),null);this[_0x72e2('0xd')](_0x72e2('0x4e'),_0x2e4797);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x72e2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x72e2('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x72e2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x72e2('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index bb85a70..7d60c7c 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(_0x5d655d,_0x43741c){var _0x346c23=function(_0x2684ca){while(--_0x2684ca){_0x5d655d['push'](_0x5d655d['shift']());}};_0x346c23(++_0x43741c);}(_0x55ca,0x126));var _0xa55c=function(_0x23e4b4,_0x132419){_0x23e4b4=_0x23e4b4-0x0;var _0x3bc471=_0x55ca[_0x23e4b4];return _0x3bc471;};'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 _0x34e8=['body','role','user','QueueCampaigns','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','merge','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','where','filter','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userVoiceQueue:remove','spread','push','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','CmListId','ListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','ContactId','cm_contacts','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','map','value','type','UserProfileResource','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','catch','show','keys','filters','model','attributes','intersection','fields','length','create'];(function(_0x32e268,_0x510f00){var _0x5cd714=function(_0x270a5c){while(--_0x270a5c){_0x32e268['push'](_0x32e268['shift']());}};_0x5cd714(++_0x510f00);}(_0x34e8,0x12c));var _0x834e=function(_0xac6c14,_0x238603){_0xac6c14=_0xac6c14-0x0;var _0x4f907b=_0x34e8[_0xac6c14];return _0x4f907b;};'use strict';var moment=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));var squel=require('squel');var Redis=require(_0x834e('0x4'));var qs=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var config=require(_0x834e('0x8'));var db=require(_0x834e('0x9'))['db'];config[_0x834e('0xa')]=_['defaults'](config[_0x834e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x834e('0xb'))(new Redis(config[_0x834e('0xa')]));require(_0x834e('0xc'))[_0x834e('0xd')](socket);function respondWithStatusCode(_0x33ea05,_0x23501c){_0x23501c=_0x23501c||0xcc;return function(_0x363786){if(_0x363786){return _0x33ea05[_0x834e('0xe')](_0x23501c);}return _0x33ea05[_0x834e('0xf')](_0x23501c)[_0x834e('0x10')]();};}function respondWithResult(_0x1e41fe,_0x36e124){_0x36e124=_0x36e124||0xc8;return function(_0x14038b){if(_0x14038b){return _0x1e41fe[_0x834e('0xf')](_0x36e124)[_0x834e('0x11')](_0x14038b);}};}function respondWithFilteredResult(_0x1e00de,_0x2fd95c){return function(_0x538bb3){if(_0x538bb3){var _0x5e5b6d=typeof _0x2fd95c[_0x834e('0x12')]==='undefined'&&typeof _0x2fd95c[_0x834e('0x13')]===_0x834e('0x14');var _0x28e659=_0x538bb3[_0x834e('0x15')];var _0x50e860=_0x5e5b6d?0x0:_0x2fd95c[_0x834e('0x12')];var _0x302cbd=_0x5e5b6d?_0x538bb3['count']:_0x2fd95c[_0x834e('0x12')]+_0x2fd95c['limit'];var _0x38a8cd;if(_0x302cbd>=_0x28e659){_0x302cbd=_0x28e659;_0x38a8cd=0xc8;}else{_0x38a8cd=0xce;}_0x1e00de[_0x834e('0xf')](_0x38a8cd);return _0x1e00de['set'](_0x834e('0x16'),_0x50e860+'-'+_0x302cbd+'/'+_0x28e659)[_0x834e('0x11')](_0x538bb3);}return null;};}function saveUpdates(_0x370fb5){return function(_0x50b3f6){if(_0x50b3f6){return _0x50b3f6[_0x834e('0x17')](_0x370fb5)[_0x834e('0x18')](function(_0x34e41a){return _0x34e41a;});}return null;};}function removeEntity(_0xb993a1){return function(_0x237947){if(_0x237947){return _0x237947[_0x834e('0x19')]()[_0x834e('0x18')](function(){var _0x595515=_0x237947[_0x834e('0x1a')]({'plain':!![]});var _0x1fd2c6=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c'),'ignore':![]},{'name':'QueueCampaigns','value':_0x834e('0x1d'),'ignore':![]}];var _0x62f8f1=_(_0x1fd2c6)['filter'](_0x834e('0x1e'))[_0x834e('0x1f')](_0x834e('0x20'))['value']();if(_['includes'](_0x62f8f1,_0x595515[_0x834e('0x21')])){return;}var _0x34563b=_['find'](_0x1fd2c6,[_0x834e('0x20'),_0x595515[_0x834e('0x21')]])['name'];return db[_0x834e('0x22')][_0x834e('0x19')]({'where':{'type':_0x34563b,'resourceId':_0x595515['id']}})[_0x834e('0x18')](function(){return _0x237947;});})['then'](function(){_0xb993a1[_0x834e('0xf')](0xcc)[_0x834e('0x10')]();});}};}function handleEntityNotFound(_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x5e1cc5[_0x834e('0xe')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x23')](_0x3f1b0b[_0x834e('0x24')]);if(_0x3f1b0b[_0x834e('0x25')]){delete _0x3f1b0b[_0x834e('0x25')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={};var _0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x1f')](db[_0x834e('0x26')][_0x834e('0x27')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x28')],'type':_0x1e026a[_0x834e('0x21')][_0x834e('0x29')]};});_0x567cea=qs[_0x834e('0x2a')](_0x5dacc1,_0x58c1d7);var _0x278db3={'where':_0x567cea['where']};return db[_0x834e('0x26')]['count'](_0x278db3)[_0x834e('0x18')](function(_0x3787b0){_0x106d6a[_0x834e('0x15')]=_0x3787b0;_0x567cea[_0x834e('0x2b')]=qs[_0x834e('0x2b')](_0x58c1d7[_0x834e('0x2c')]);return db[_0x834e('0x26')][_0x834e('0x2d')](_0x567cea);})[_0x834e('0x18')](function(_0x12b2bc){_0x106d6a['rows']=_0x12b2bc;return _0x106d6a;})[_0x834e('0x18')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x2e')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x2f')]=function(_0xaf01f4,_0x595cc0){var _0x3f88ad={'raw':![],'where':{'id':_0xaf01f4['params']['id']}},_0x379d60={};_0x379d60['model']=_['keys'](db[_0x834e('0x26')][_0x834e('0x27')]);_0x379d60[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xaf01f4[_0x834e('0x2c')]);_0x379d60[_0x834e('0x31')]=_['intersection'](_0x379d60[_0x834e('0x32')],_0x379d60['query']);_0x3f88ad[_0x834e('0x33')]=_[_0x834e('0x34')](_0x379d60['model'],qs[_0x834e('0x35')](_0xaf01f4[_0x834e('0x2c')]['fields']));_0x3f88ad['attributes']=_0x3f88ad[_0x834e('0x33')][_0x834e('0x36')]?_0x3f88ad[_0x834e('0x33')]:_0x379d60[_0x834e('0x32')];if(_0xaf01f4[_0x834e('0x2c')]['includeAll']){_0x3f88ad[_0x834e('0x2b')]=[{'all':!![]}];}_0x3f88ad=_['merge']({},_0x3f88ad,_0xaf01f4['options']);return db[_0x834e('0x26')]['find'](_0x3f88ad)[_0x834e('0x18')](handleEntityNotFound(_0x595cc0,null))[_0x834e('0x18')](respondWithResult(_0x595cc0,null))[_0x834e('0x2e')](handleError(_0x595cc0,null));};exports[_0x834e('0x37')]=function(_0x2b7933,_0x574ea8){return db[_0x834e('0x26')][_0x834e('0x37')](_0x2b7933[_0x834e('0x38')],{})['then'](function(_0x35380e){var _0x16ac45=_0x2b7933['user'][_0x834e('0x1a')]({'plain':!![]});if(!_0x16ac45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16ac45[_0x834e('0x39')]===_0x834e('0x3a')){var _0x4a18bb=_0x35380e['get']({'plain':!![]});var _0x22ea21=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c')},{'name':_0x834e('0x3b'),'value':_0x834e('0x1d')}];var _0x23feea=_[_0x834e('0x3c')](_0x22ea21,['value',_0x4a18bb[_0x834e('0x21')]])['name'];return db[_0x834e('0x3d')]['find']({'where':{'name':_0x23feea,'userProfileId':_0x16ac45[_0x834e('0x3e')]},'raw':!![]})['then'](function(_0x361f60){if(_0x361f60&&_0x361f60[_0x834e('0x3f')]===0x0){return db['UserProfileResource'][_0x834e('0x37')]({'name':_0x4a18bb[_0x834e('0x25')],'resourceId':_0x4a18bb['id'],'type':_0x361f60[_0x834e('0x25')],'sectionId':_0x361f60['id']},{})[_0x834e('0x18')](function(){return _0x35380e;});}else{return _0x35380e;}})[_0x834e('0x2e')](function(_0x1a7149){logger[_0x834e('0x23')](_0x834e('0x40'),_0x1a7149);throw _0x1a7149;});}return _0x35380e;})[_0x834e('0x18')](respondWithResult(_0x574ea8,0xc9))[_0x834e('0x2e')](handleError(_0x574ea8,null));};exports['clone']=function(_0x3124be,_0x6fff27){var _0x47a8a9={'where':{'id':_0x3124be[_0x834e('0x41')]['id']}},_0x112306={};_0x112306[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x26')][_0x834e('0x27')]);_0x47a8a9['attributes']=_['intersection'](_0x112306[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3124be[_0x834e('0x2c')][_0x834e('0x35')]));_0x47a8a9[_0x834e('0x33')]=_0x47a8a9[_0x834e('0x33')][_0x834e('0x36')]?_0x47a8a9[_0x834e('0x33')]:_0x112306[_0x834e('0x32')];if(_0x3124be[_0x834e('0x2c')][_0x834e('0x42')]){_0x47a8a9[_0x834e('0x2b')]=[{'all':!![]}];}_0x47a8a9=_[_0x834e('0x43')]({},_0x47a8a9,_0x3124be[_0x834e('0x44')]);return db[_0x834e('0x26')][_0x834e('0x3c')](_0x47a8a9)[_0x834e('0x18')](handleEntityNotFound(_0x6fff27,null))[_0x834e('0x18')](function(_0x420841){if(_0x420841){var _0x1adf86=_0x420841['get']({'plain':!![]});_0x1adf86=qs[_0x834e('0x45')](_0x1adf86,['id',_0x834e('0x46'),'updatedAt']);_0x3124be[_0x834e('0x38')]=_[_0x834e('0x45')](_0x3124be['body'],['id',_0x834e('0x46'),_0x834e('0x47')]);return db[_0x834e('0x26')][_0x834e('0x37')](_[_0x834e('0x43')](_0x1adf86,_0x3124be[_0x834e('0x38')]),{'include':_0x3124be[_0x834e('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x834e('0x18')](function(_0x8bc6c6){var _0x3e0550=_0x3124be[_0x834e('0x3a')][_0x834e('0x1a')]({'plain':!![]});if(!_0x3e0550)throw new Error(_0x834e('0x48'));if(_0x3e0550[_0x834e('0x39')]===_0x834e('0x3a')){var _0x5afa07=_0x8bc6c6[_0x834e('0x1a')]({'plain':!![]});var _0x4dc104=[{'name':_0x834e('0x1b'),'value':'inbound'},{'name':_0x834e('0x3b'),'value':'outbound'}];var _0x527eef=_[_0x834e('0x3c')](_0x4dc104,[_0x834e('0x20'),_0x5afa07['type']])['name'];return db[_0x834e('0x3d')][_0x834e('0x3c')]({'where':{'name':_0x527eef,'userProfileId':_0x3e0550[_0x834e('0x3e')]},'raw':!![]})[_0x834e('0x18')](function(_0x21c417){if(_0x21c417&&_0x21c417[_0x834e('0x3f')]===0x0){return db[_0x834e('0x22')][_0x834e('0x37')]({'name':_0x5afa07['name'],'resourceId':_0x5afa07['id'],'type':_0x21c417[_0x834e('0x25')],'sectionId':_0x21c417['id']},{})[_0x834e('0x18')](function(){return _0x8bc6c6;});}else{return _0x8bc6c6;}})['catch'](function(_0x281342){logger['error'](_0x834e('0x40'),_0x281342);throw _0x281342;});}return _0x8bc6c6;});}})[_0x834e('0x18')](respondWithResult(_0x6fff27,0xc9))['catch'](handleError(_0x6fff27,null));};exports[_0x834e('0x17')]=function(_0x37ee0e,_0x2de29a){if(_0x37ee0e[_0x834e('0x38')]['id']){delete _0x37ee0e['body']['id'];}return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x37ee0e[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2de29a,null))[_0x834e('0x18')](saveUpdates(_0x37ee0e[_0x834e('0x38')],null))[_0x834e('0x18')](respondWithResult(_0x2de29a,null))[_0x834e('0x2e')](handleError(_0x2de29a,null));};exports[_0x834e('0x19')]=function(_0x125f37,_0x3a1426){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x125f37[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x3a1426,null))[_0x834e('0x18')](removeEntity(_0x3a1426,null))[_0x834e('0x2e')](handleError(_0x3a1426,null));};exports[_0x834e('0x49')]=function(_0x460a7a,_0x17b8e3){var _0x297cce={'raw':![],'where':{}};var _0x14ed83={};var _0x193a15={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x460a7a[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x17b8e3,null))[_0x834e('0x18')](function(_0x25d6f4){if(_0x25d6f4){_0x14ed83[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmHopper'][_0x834e('0x27')]);_0x14ed83['query']=_['keys'](_0x460a7a[_0x834e('0x2c')]);_0x14ed83[_0x834e('0x31')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],_0x14ed83[_0x834e('0x2c')]);_0x297cce[_0x834e('0x33')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],qs['fields'](_0x460a7a[_0x834e('0x2c')]['fields']));_0x297cce[_0x834e('0x33')]=_0x297cce[_0x834e('0x33')]['length']?_0x297cce['attributes']:_0x14ed83[_0x834e('0x32')];if(!_0x460a7a[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x297cce[_0x834e('0x13')]=qs['limit'](_0x460a7a[_0x834e('0x2c')][_0x834e('0x13')]);_0x297cce[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x12')]);}_0x297cce[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x4e')]);_0x297cce['where']=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x460a7a[_0x834e('0x2c')],_0x14ed83[_0x834e('0x31')]));_0x297cce['where'][_0x834e('0x50')]=_0x25d6f4['id'];if(_0x460a7a['query']['filter']){_0x297cce['where']=_[_0x834e('0x43')](_0x297cce[_0x834e('0x51')],{'$or':_['map'](_0x297cce[_0x834e('0x33')],function(_0x1b200d){var _0x4d4477={};_0x4d4477[_0x1b200d]={'$like':'%'+_0x460a7a[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4d4477;})});}_0x297cce=_['merge']({},_0x297cce,_0x460a7a['options']);return db[_0x834e('0x53')][_0x834e('0x15')]({'where':_0x297cce[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x1d8e7){_0x193a15['count']=_0x1d8e7;if(_0x460a7a[_0x834e('0x2c')]['includeAll']){_0x297cce[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x53')][_0x834e('0x2d')](_0x297cce);})['then'](function(_0x33a3cd){_0x193a15[_0x834e('0x54')]=_0x33a3cd;return _0x193a15;});}})['then'](respondWithFilteredResult(_0x17b8e3,_0x297cce))[_0x834e('0x2e')](handleError(_0x17b8e3,null));};exports[_0x834e('0x55')]=function(_0xb4e130,_0x50d0a3){var _0x214014={'raw':!![],'where':{}};var _0x1d4e66={};var _0x402692={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0xb4e130[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x50d0a3,null))[_0x834e('0x18')](function(_0xd49002){if(_0xd49002){_0x1d4e66[_0x834e('0x32')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1d4e66[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xb4e130[_0x834e('0x2c')]);_0x1d4e66[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d4e66['model'],_0x1d4e66['query']);_0x214014[_0x834e('0x33')]=_[_0x834e('0x34')](_0x1d4e66[_0x834e('0x32')],qs[_0x834e('0x35')](_0xb4e130[_0x834e('0x2c')]['fields']));_0x214014[_0x834e('0x33')]=_0x214014[_0x834e('0x33')][_0x834e('0x36')]?_0x214014['attributes']:_0x1d4e66[_0x834e('0x32')];if(!_0xb4e130[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x214014[_0x834e('0x13')]=qs['limit'](_0xb4e130['query'][_0x834e('0x13')]);_0x214014[_0x834e('0x12')]=qs['offset'](_0xb4e130[_0x834e('0x2c')]['offset']);}_0x214014[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0xb4e130[_0x834e('0x2c')]['sort']);_0x214014[_0x834e('0x51')]=qs['filters'](_['pick'](_0xb4e130['query'],_0x1d4e66[_0x834e('0x31')]));_0x214014[_0x834e('0x51')][_0x834e('0x50')]=_0xd49002['id'];if(_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]){_0x214014[_0x834e('0x51')]=_[_0x834e('0x43')](_0x214014[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x214014['attributes'],function(_0x2f775a){var _0x54e70d={};_0x54e70d[_0x2f775a]={'$like':'%'+_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x54e70d;})});}_0x214014=_[_0x834e('0x43')]({},_0x214014,_0xb4e130[_0x834e('0x44')]);return db[_0x834e('0x56')][_0x834e('0x15')]({'where':_0x214014['where']})['then'](function(_0xeb096d){_0x402692[_0x834e('0x15')]=_0xeb096d;if(_0xb4e130['query'][_0x834e('0x42')]){_0x214014[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x56')][_0x834e('0x2d')](_0x214014);})[_0x834e('0x18')](function(_0x5a75e3){_0x402692[_0x834e('0x54')]=_0x5a75e3;return _0x402692;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x50d0a3,_0x214014))['catch'](handleError(_0x50d0a3,null));};exports['getHopperFinals']=function(_0x5ede29,_0x1e5252){var _0x1f3e26={'raw':!![],'where':{}};var _0x4f716d={};var _0x23ce49={'count':0x0,'rows':[]};return db[_0x834e('0x26')]['findOne']({'where':{'id':_0x5ede29[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e5252,null))['then'](function(_0x41dfd9){if(_0x41dfd9){_0x4f716d[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x57')]['rawAttributes']);_0x4f716d[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5ede29[_0x834e('0x2c')]);_0x4f716d[_0x834e('0x31')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],_0x4f716d[_0x834e('0x2c')]);_0x1f3e26[_0x834e('0x33')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x35')]));_0x1f3e26[_0x834e('0x33')]=_0x1f3e26[_0x834e('0x33')][_0x834e('0x36')]?_0x1f3e26[_0x834e('0x33')]:_0x4f716d[_0x834e('0x32')];if(!_0x5ede29[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1f3e26[_0x834e('0x13')]=qs['limit'](_0x5ede29[_0x834e('0x2c')][_0x834e('0x13')]);_0x1f3e26[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x12')]);}_0x1f3e26[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5ede29[_0x834e('0x2c')]['sort']);_0x1f3e26['where']=qs['filters'](_[_0x834e('0x4f')](_0x5ede29['query'],_0x4f716d[_0x834e('0x31')]));_0x1f3e26[_0x834e('0x51')][_0x834e('0x50')]=_0x41dfd9['id'];if(_0x5ede29['query'][_0x834e('0x52')]){_0x1f3e26[_0x834e('0x51')]=_[_0x834e('0x43')](_0x1f3e26[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x1f3e26[_0x834e('0x33')],function(_0x528052){var _0x10dd7b={};_0x10dd7b[_0x528052]={'$like':'%'+_0x5ede29[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x10dd7b;})});}_0x1f3e26=_[_0x834e('0x43')]({},_0x1f3e26,_0x5ede29[_0x834e('0x44')]);return db['CmHopperFinal']['count']({'where':_0x1f3e26['where']})['then'](function(_0x1dfa2e){_0x23ce49[_0x834e('0x15')]=_0x1dfa2e;if(_0x5ede29['query'][_0x834e('0x42')]){_0x1f3e26[_0x834e('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x834e('0x2d')](_0x1f3e26);})[_0x834e('0x18')](function(_0xbf7693){_0x23ce49[_0x834e('0x54')]=_0xbf7693;return _0x23ce49;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x1e5252,_0x1f3e26))[_0x834e('0x2e')](handleError(_0x1e5252,null));};exports['getHopperBlacks']=function(_0x5a49fc,_0x43b92f){var _0x30ab20={'raw':!![],'where':{}};var _0x1d2e12={};var _0x58bdd6={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5a49fc['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x43b92f,null))[_0x834e('0x18')](function(_0x216d1f){if(_0x216d1f){_0x1d2e12[_0x834e('0x32')]=_['keys'](db[_0x834e('0x58')]['rawAttributes']);_0x1d2e12['query']=_[_0x834e('0x30')](_0x5a49fc[_0x834e('0x2c')]);_0x1d2e12[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d2e12[_0x834e('0x32')],_0x1d2e12[_0x834e('0x2c')]);_0x30ab20['attributes']=_['intersection'](_0x1d2e12[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x35')]));_0x30ab20[_0x834e('0x33')]=_0x30ab20[_0x834e('0x33')][_0x834e('0x36')]?_0x30ab20['attributes']:_0x1d2e12[_0x834e('0x32')];if(!_0x5a49fc[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x30ab20[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x13')]);_0x30ab20[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x12')]);}_0x30ab20[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x4e')]);_0x30ab20[_0x834e('0x51')]=qs['filters'](_[_0x834e('0x4f')](_0x5a49fc[_0x834e('0x2c')],_0x1d2e12['filters']));_0x30ab20[_0x834e('0x51')]['VoiceQueueId']=_0x216d1f['id'];if(_0x5a49fc[_0x834e('0x2c')]['filter']){_0x30ab20[_0x834e('0x51')]=_['merge'](_0x30ab20[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x30ab20[_0x834e('0x33')],function(_0x1aac37){var _0x57ee25={};_0x57ee25[_0x1aac37]={'$like':'%'+_0x5a49fc[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x57ee25;})});}_0x30ab20=_[_0x834e('0x43')]({},_0x30ab20,_0x5a49fc[_0x834e('0x44')]);return db[_0x834e('0x58')][_0x834e('0x15')]({'where':_0x30ab20[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x2aa430){_0x58bdd6[_0x834e('0x15')]=_0x2aa430;if(_0x5a49fc[_0x834e('0x2c')][_0x834e('0x42')]){_0x30ab20[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x58')][_0x834e('0x2d')](_0x30ab20);})[_0x834e('0x18')](function(_0xe84914){_0x58bdd6['rows']=_0xe84914;return _0x58bdd6;});}})['then'](respondWithFilteredResult(_0x43b92f,_0x30ab20))[_0x834e('0x2e')](handleError(_0x43b92f,null));};exports[_0x834e('0x59')]=function(_0x3f52b9,_0x213303){var _0x3bf1b6={};var _0x31f336={};var _0x22f90d;var _0x40fd40;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x3f52b9[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x213303,null))['then'](function(_0x1bd254){if(_0x1bd254){_0x22f90d=_0x1bd254;_0x31f336['model']=_[_0x834e('0x30')](db[_0x834e('0x5a')][_0x834e('0x27')]);_0x31f336['query']=_[_0x834e('0x30')](_0x3f52b9[_0x834e('0x2c')]);_0x31f336['filters']=_['intersection'](_0x31f336[_0x834e('0x32')],_0x31f336[_0x834e('0x2c')]);_0x3bf1b6['attributes']=_[_0x834e('0x34')](_0x31f336[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x35')]));_0x3bf1b6['attributes']=_0x3bf1b6['attributes'][_0x834e('0x36')]?_0x3bf1b6['attributes']:_0x31f336['model'];_0x3bf1b6['order']=qs[_0x834e('0x4e')](_0x3f52b9[_0x834e('0x2c')]['sort']);_0x3bf1b6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x3f52b9[_0x834e('0x2c')],_0x31f336['filters']));if(_0x3f52b9[_0x834e('0x2c')][_0x834e('0x52')]){_0x3bf1b6[_0x834e('0x51')]=_['merge'](_0x3bf1b6[_0x834e('0x51')],{'$or':_['map'](_0x3bf1b6[_0x834e('0x33')],function(_0x4af2a2){var _0x461420={};_0x461420[_0x4af2a2]={'$like':'%'+_0x3f52b9[_0x834e('0x2c')]['filter']+'%'};return _0x461420;})});}_0x3bf1b6=_[_0x834e('0x43')]({},_0x3bf1b6,_0x3f52b9[_0x834e('0x44')]);return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})[_0x834e('0x18')](function(_0x410895){if(_0x410895){_0x40fd40=_0x410895[_0x834e('0x36')];if(!_0x3f52b9['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x3bf1b6[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x13')]);_0x3bf1b6['offset']=qs[_0x834e('0x12')](_0x3f52b9['query']['offset']);}return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})['then'](function(_0x4c5da4){if(_0x4c5da4){return _0x4c5da4?{'count':_0x40fd40,'rows':_0x4c5da4}:null;}})[_0x834e('0x18')](respondWithResult(_0x213303,null))[_0x834e('0x2e')](handleError(_0x213303,null));};exports[_0x834e('0x5b')]=function(_0x2e5886,_0x38fbc4){var _0x3e0ee6=_0x2e5886[_0x834e('0x38')][_0x834e('0x5c')];var _0x1d3ca9=_[_0x834e('0x1f')](_0x3e0ee6,'id');return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0x1d3ca9},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id','name',_0x834e('0x5f'),'voicePause',_0x834e('0x60')],'raw':!![]}]})[_0x834e('0x18')](function(_0x284412){if(_0x284412){var _0x2cdbe0=_['flatMap'](_0x284412,function(_0x5f558a){var _0x37d8dd=_0x5f558a[_0x834e('0x1a')]({'plain':!![]});_0x37d8dd['Agents'][_0x834e('0x61')](function(_0xfa7b14){_0xfa7b14['penalty']=_[_0x834e('0x3c')](_0x3e0ee6,{'id':_0x37d8dd['id']})[_0x834e('0x62')];});return _0x37d8dd[_0x834e('0x5e')];});return db[_0x834e('0x26')]['find']({'where':{'id':_0x2e5886['params']['id']}})['then'](function(_0x48e14c){return db[_0x834e('0x63')][_0x834e('0x64')](function(_0x47891e){return _0x48e14c[_0x834e('0x5b')](_0x1d3ca9,{'transaction':_0x47891e})['then'](function(){return BPromise[_0x834e('0x65')](_0x3e0ee6,function(_0x13b39a){return db[_0x834e('0x66')][_0x834e('0x67')]({'TeamId':_0x13b39a['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id'],'penalty':_0x13b39a[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){return BPromise['each'](_0x2cdbe0,function(_0x12a0f3){return db[_0x834e('0x68')]['findOrCreate']({'where':{'UserId':_0x12a0f3['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id']},'defaults':{'penalty':_0x12a0f3[_0x834e('0x62')]},'transaction':_0x47891e});});})['then'](function(){return BPromise['each'](_['filter'](_0x2cdbe0,{'online':!![]}),function(_0x3edbbb){return db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x3edbbb['name'],'UserId':_0x3edbbb['id'],'queue_name':_0x48e14c[_0x834e('0x25')],'VoiceQueueId':_0x48e14c['id'],'interface':_[_0x834e('0x6a')](_0x3edbbb[_0x834e('0x60')])?util[_0x834e('0x6b')](_0x834e('0x6c'),_0x3edbbb[_0x834e('0x25')]):_0x3edbbb[_0x834e('0x60')],'paused':_0x3edbbb[_0x834e('0x6d')]||![],'penalty':_0x3edbbb[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){_0x2cdbe0['forEach'](function(_0x5d6b66){socket[_0x834e('0x6e')](_0x834e('0x6f'),{'UserId':_0x5d6b66['id'],'VoiceQueueId':_0x48e14c['id']});});});});});}})[_0x834e('0x18')](respondWithStatusCode(_0x38fbc4,null))[_0x834e('0x2e')](handleError(_0x38fbc4,null));};exports[_0x834e('0x70')]=function(_0xd22e8f,_0x281922){return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x281922,null))[_0x834e('0x18')](function(_0x3b13be){var _0x3f5b2e=_[_0x834e('0x1f')](_0x3b13be,'id');var _0x495697=[];var _0x5943a3=[];var _0x4e7c43=squel[_0x834e('0x72')]();_0x4e7c43[_0x834e('0x73')](_0x834e('0x74'))[_0x834e('0x75')](_0x834e('0x76'),'tq')[_0x834e('0x77')](_0x834e('0x78'),'ut',_0x834e('0x79'))['where']('VoiceQueueId\x20=\x20?',_0xd22e8f['params']['id']);for(var _0x5a5602=0x0;_0x5a5602<_0x3b13be[_0x834e('0x36')];_0x5a5602+=0x1){let _0xd108fa=_0x3b13be[_0x5a5602];for(var _0x37defd=0x0;_0x37defd<_0xd108fa[_0x834e('0x5e')][_0x834e('0x36')];_0x37defd+=0x1){let _0x386e10=_0xd108fa[_0x834e('0x5e')][_0x37defd];var _0x29ef2f=_0x4e7c43[_0x834e('0x7a')]();_0x29ef2f['where']('ut.UserId\x20=\x20?',_0x386e10['id']);_0x5943a3['push'](db['sequelize'][_0x834e('0x2c')](_0x29ef2f[_0x834e('0x7b')](),{'type':db[_0x834e('0x63')][_0x834e('0x7c')][_0x834e('0x7d')]})[_0x834e('0x18')](function(_0x416bea){if(_0x416bea[_0x834e('0x36')]===0x1){return _0x386e10['id'];}else{var _0x86d08c=_[_0x834e('0x7e')](_[_0x834e('0x1f')](_0x416bea,_0x834e('0x7f')),function(_0x1fd72b){return _[_0x834e('0x80')](_0x3f5b2e,_0x1fd72b);});if(_0x86d08c){return _0x386e10['id'];}}}));}}return BPromise[_0x834e('0x81')](_0x5943a3)[_0x834e('0x18')](function(_0x5022f2){_0x495697=_(_0x495697)[_0x834e('0x82')](_0x5022f2)['compact']()[_0x834e('0x20')]();return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0xd22e8f['params']['id']}})[_0x834e('0x18')](function(_0x3d9d85){return db['sequelize']['transaction'](function(_0x1c3b23){return _0x3d9d85[_0x834e('0x70')](_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')],{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){if(!_[_0x834e('0x83')](_0x495697)){return _0x3d9d85[_0x834e('0x84')](_0x495697,{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){return db['UserVoiceQueueRt'][_0x834e('0x19')]({'where':{'VoiceQueueId':_0xd22e8f[_0x834e('0x41')]['id'],'UserId':_0x495697},'transaction':_0x1c3b23});});}})[_0x834e('0x18')](function(){_0x495697[_0x834e('0x61')](function(_0x1912e6){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':_0x1912e6,'VoiceQueueId':_0x3d9d85['id']});});});});});});})['then'](respondWithStatusCode(_0x281922,null))[_0x834e('0x2e')](handleError(_0x281922,null));};exports['addAgents']=function(_0x586fa5,_0x1115b7){var _0x1e0bc9,_0x4b16fa;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x586fa5['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x1115b7,null))[_0x834e('0x18')](function(_0x5d994e){if(_0x5d994e){_0x4b16fa=_0x5d994e;return _0x5d994e['addAgents'](_0x586fa5[_0x834e('0x38')][_0x834e('0x71')],_['omit'](_0x586fa5['body'],[_0x834e('0x71'),'id'])||{})[_0x834e('0x86')](function(_0x5d6f5e){for(var _0x480290=0x0;_0x480290<_0x586fa5['body']['ids'][_0x834e('0x36')];_0x480290+=0x1){socket['emit'](_0x834e('0x6f'),{'UserId':Number(_0x586fa5['body'][_0x834e('0x71')][_0x480290]),'VoiceQueueId':Number(_0x586fa5[_0x834e('0x41')]['id'])});}return _0x5d6f5e;});}})[_0x834e('0x18')](function(_0x3d2569){_0x1e0bc9=_0x3d2569||[];if(_0x4b16fa){return db['User'][_0x834e('0x2d')]({'where':{'id':_0x586fa5[_0x834e('0x38')][_0x834e('0x71')]},'attributes':['id',_0x834e('0x25'),_0x834e('0x5f'),_0x834e('0x6d'),_0x834e('0x60')],'raw':!![]});}})[_0x834e('0x18')](function(_0x464ae6){if(!_[_0x834e('0x83')](_0x464ae6)){var _0x590e52=[];for(var _0x40e12e=0x0;_0x40e12e<_0x464ae6['length'];_0x40e12e++){if(_0x464ae6[_0x40e12e][_0x834e('0x5f')]){_0x590e52[_0x834e('0x87')](db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x464ae6[_0x40e12e][_0x834e('0x25')],'UserId':_0x464ae6[_0x40e12e]['id'],'queue_name':_0x4b16fa['name'],'VoiceQueueId':_0x4b16fa['id'],'interface':_[_0x834e('0x6a')](_0x464ae6[_0x40e12e]['interface'])?util['format'](_0x834e('0x6c'),_0x464ae6[_0x40e12e][_0x834e('0x25')]):_0x464ae6[_0x40e12e][_0x834e('0x60')],'paused':_0x464ae6[_0x40e12e]['voicePause']||![],'penalty':_0x586fa5[_0x834e('0x38')][_0x834e('0x62')]||0x0}));}}return BPromise[_0x834e('0x81')](_0x590e52);}})[_0x834e('0x18')](function(){return _0x1e0bc9;})[_0x834e('0x18')](respondWithResult(_0x1115b7,null))[_0x834e('0x2e')](handleError(_0x1115b7,null));};exports[_0x834e('0x84')]=function(_0x687dab,_0x125787){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x687dab['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x125787,null))[_0x834e('0x18')](function(_0x121d4f){if(_0x121d4f){return _0x121d4f[_0x834e('0x84')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])['then'](function(){if(_[_0x834e('0x88')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])){for(var _0x37dea1=0x0;_0x37dea1<_0x687dab[_0x834e('0x2c')][_0x834e('0x71')][_0x834e('0x36')];_0x37dea1+=0x1){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':Number(_0x687dab[_0x834e('0x2c')]['ids'][_0x37dea1]),'VoiceQueueId':Number(_0x687dab['params']['id'])});}}else{socket[_0x834e('0x6e')]('userVoiceQueue:remove',{'UserId':Number(_0x687dab[_0x834e('0x2c')][_0x834e('0x71')]),'VoiceQueueId':Number(_0x687dab[_0x834e('0x41')]['id'])});}});}})[_0x834e('0x18')](function(_0x1daa58){return db[_0x834e('0x69')]['destroy']({'where':{'VoiceQueueId':_0x687dab[_0x834e('0x41')]['id'],'UserId':_0x687dab['query']['ids']}})['then'](function(){return _0x1daa58;});})[_0x834e('0x18')](respondWithStatusCode(_0x125787,null))[_0x834e('0x2e')](handleError(_0x125787,null));};exports['getAgents']=function(_0x5cb379,_0x494e08){var _0x2515f6={};var _0x45c8e6={};var _0x3512d8;var _0x5e0bfe;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5cb379[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x494e08,null))[_0x834e('0x18')](function(_0x3c1a19){if(_0x3c1a19){_0x3512d8=_0x3c1a19;_0x45c8e6['model']=_['keys'](db['User']['rawAttributes']);_0x45c8e6[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5cb379[_0x834e('0x2c')]);_0x45c8e6[_0x834e('0x31')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],_0x45c8e6[_0x834e('0x2c')]);_0x2515f6[_0x834e('0x33')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x35')]));_0x2515f6[_0x834e('0x33')]=_0x2515f6[_0x834e('0x33')]['length']?_0x2515f6['attributes']:_0x45c8e6[_0x834e('0x32')];_0x2515f6[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5cb379['query'][_0x834e('0x4e')]);_0x2515f6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x5cb379[_0x834e('0x2c')],_0x45c8e6[_0x834e('0x31')]));if(_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]){_0x2515f6[_0x834e('0x51')]=_['merge'](_0x2515f6[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x2515f6[_0x834e('0x33')],function(_0x2f1de8){var _0x4b6834={};_0x4b6834[_0x2f1de8]={'$like':'%'+_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4b6834;})});}_0x2515f6=_[_0x834e('0x43')]({},_0x2515f6,_0x5cb379[_0x834e('0x44')]);return _0x3512d8[_0x834e('0x89')](_0x2515f6);}})[_0x834e('0x18')](function(_0x3f6ead){if(_0x3f6ead){_0x5e0bfe=_0x3f6ead[_0x834e('0x36')];if(!_0x5cb379[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x2515f6['limit']=qs[_0x834e('0x13')](_0x5cb379['query'][_0x834e('0x13')]);_0x2515f6[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x3512d8['getAgents'](_0x2515f6);}})[_0x834e('0x18')](function(_0x29f970){if(_0x29f970){return _0x29f970?{'count':_0x5e0bfe,'rows':_0x29f970}:null;}})['then'](respondWithResult(_0x494e08,null))['catch'](handleError(_0x494e08,null));};exports[_0x834e('0x8a')]=function(_0x4db3c5,_0x4e6a75){var _0x57a989={};var _0x26cb93={};var _0x39bd0c;var _0xbd9400;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x4db3c5[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x4e6a75,null))['then'](function(_0x28825c){if(_0x28825c){_0x39bd0c=_0x28825c;_0x26cb93[_0x834e('0x32')]=_['keys'](db['UserVoiceQueueRt'][_0x834e('0x27')]);_0x26cb93[_0x834e('0x2c')]=_['keys'](_0x4db3c5['query']);_0x26cb93[_0x834e('0x31')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],_0x26cb93['query']);_0x57a989[_0x834e('0x33')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],qs['fields'](_0x4db3c5[_0x834e('0x2c')]['fields']));_0x57a989[_0x834e('0x33')]=_0x57a989[_0x834e('0x33')][_0x834e('0x36')]?_0x57a989[_0x834e('0x33')]:_0x26cb93[_0x834e('0x32')];_0x57a989['order']=qs[_0x834e('0x4e')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x4e')]);_0x57a989[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x4db3c5['query'],_0x26cb93[_0x834e('0x31')]));if(_0x4db3c5[_0x834e('0x2c')][_0x834e('0x52')]){_0x57a989['where']=_[_0x834e('0x43')](_0x57a989[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x57a989[_0x834e('0x33')],function(_0x53faec){var _0x3cc563={};_0x3cc563[_0x53faec]={'$like':'%'+_0x4db3c5[_0x834e('0x2c')]['filter']+'%'};return _0x3cc563;})});}_0x57a989=_[_0x834e('0x43')]({},_0x57a989,_0x4db3c5[_0x834e('0x44')]);return _0x39bd0c[_0x834e('0x8a')](_0x57a989);}})[_0x834e('0x18')](function(_0x4b0246){if(_0x4b0246){_0xbd9400=_0x4b0246[_0x834e('0x36')];if(!_0x4db3c5['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x57a989[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x13')]);_0x57a989['offset']=qs['offset'](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x39bd0c['getMembers'](_0x57a989);}})[_0x834e('0x18')](function(_0x4af796){return _0x4af796?{'count':_0xbd9400,'rows':_0x4af796}:null;})[_0x834e('0x18')](respondWithResult(_0x4e6a75,null))[_0x834e('0x2e')](handleError(_0x4e6a75,null));};exports[_0x834e('0x8b')]=function(_0x151b58,_0x2ec7b0){var _0x1ca24b={};var _0x36836f={};var _0x56ae60;var _0x122b03;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x151b58[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2ec7b0,null))['then'](function(_0x167642){if(_0x167642){_0x56ae60=_0x167642;_0x36836f[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmList']['rawAttributes']);_0x36836f['query']=_[_0x834e('0x30')](_0x151b58[_0x834e('0x2c')]);_0x36836f[_0x834e('0x31')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],_0x36836f[_0x834e('0x2c')]);_0x1ca24b[_0x834e('0x33')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],qs[_0x834e('0x35')](_0x151b58[_0x834e('0x2c')]['fields']));_0x1ca24b[_0x834e('0x33')]=_0x1ca24b[_0x834e('0x33')][_0x834e('0x36')]?_0x1ca24b[_0x834e('0x33')]:_0x36836f[_0x834e('0x32')];_0x1ca24b[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x151b58[_0x834e('0x2c')]['sort']);_0x1ca24b[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x151b58[_0x834e('0x2c')],_0x36836f[_0x834e('0x31')]));if(_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]){_0x1ca24b['where']=_['merge'](_0x1ca24b[_0x834e('0x51')],{'$or':_['map'](_0x1ca24b[_0x834e('0x33')],function(_0x433cb4){var _0x18638d={};_0x18638d[_0x433cb4]={'$like':'%'+_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x18638d;})});}_0x1ca24b=_['merge']({},_0x1ca24b,_0x151b58[_0x834e('0x44')]);return _0x56ae60['getLists'](_0x1ca24b);}})['then'](function(_0x3d8b08){if(_0x3d8b08){_0x122b03=_0x3d8b08[_0x834e('0x36')];if(!_0x151b58[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1ca24b[_0x834e('0x13')]=qs['limit'](_0x151b58[_0x834e('0x2c')][_0x834e('0x13')]);_0x1ca24b['offset']=qs[_0x834e('0x12')](_0x151b58[_0x834e('0x2c')]['offset']);}return _0x56ae60[_0x834e('0x8b')](_0x1ca24b);}})[_0x834e('0x18')](function(_0x47a239){if(_0x47a239){return _0x47a239?{'count':_0x122b03,'rows':_0x47a239}:null;}})[_0x834e('0x18')](respondWithResult(_0x2ec7b0,null))[_0x834e('0x2e')](handleError(_0x2ec7b0,null));};exports[_0x834e('0x8c')]=function(_0x3b658a,_0x34a13d){var _0x29b8fd=moment()[_0x834e('0x6b')](_0x834e('0x8d'));var _0x208bbe,_0xe0b3;return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x3b658a[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x34a13d,null))[_0x834e('0x18')](function(_0x371767){if(_0x371767){_0xe0b3=_0x371767;return _0x371767[_0x834e('0x8c')](_0x3b658a[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x3b658a[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x5af6fc){var _0x2ddbc0;_0x208bbe=_0x5af6fc||[];var _0x1cd122=[];if(_0x5af6fc){for(var _0x49be08=0x0;_0x49be08<_0x5af6fc['length'];_0x49be08+=0x1){var _0x563f20=_0x5af6fc[_0x49be08][_0x834e('0x1a')]({'plain':!![]});_0xe0b3[_0x834e('0x8e')]=_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]?_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]:_0xe0b3[_0x834e('0x8e')];switch(_0xe0b3['dialCheckDuplicateType']){case'always':_0x2ddbc0=squel['insert']()['into'](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt','ContactId','ListId',_0x834e('0x50'),'createdAt','updatedAt'],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','updatedAt')['from']('cm_contacts')['where'](_0x834e('0x95'))[_0x834e('0x51')]('ListId\x20=\x20?',_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x834e('0x75')](_0x834e('0x98'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]()))[_0x834e('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))['from'](_0x834e('0x8f'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;case _0x834e('0x9b'):_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt',_0x834e('0x9e'),'ListId',_0x834e('0x50'),'createdAt',_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')['field'](_0x563f20['CmListId'][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),_0x834e('0x50'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))['field']('\x27'+_0x29b8fd+'\x27','updatedAt')[_0x834e('0x75')](_0x834e('0x9f'))[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))[_0x834e('0x75')](_0x834e('0x8f'))[_0x834e('0x51')]('VoiceQueueId\x20=\x20?',_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;default:_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')](['phone','scheduledAt',_0x834e('0x9e'),'ListId','VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel['select']()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','scheduledAt')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))['from']('cm_contacts')[_0x834e('0x51')](_0x834e('0x95'))['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96')))[_0x834e('0x7b')]();}_0x1cd122[_0x834e('0x87')](db[_0x834e('0x63')]['query'](_0x2ddbc0));}return BPromise['all'](_0x1cd122);}})['then'](function(){var _0xbafedb=[];var _0x1d004f=squel[_0x834e('0x9c')]()['into']('cm_hopper_additional_phones')[_0x834e('0x90')]([_0x834e('0xa1'),_0x834e('0x91'),_0x834e('0xa2'),_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0xa3'))[_0x834e('0x73')](_0x834e('0xa4'))['field'](_0x834e('0xa5'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','createdAt')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))[_0x834e('0x75')](_0x834e('0xa6'),'ci')[_0x834e('0x77')](_0x834e('0x8f'),'h',_0x834e('0xa7'))[_0x834e('0x51')](_0x834e('0xa8'),_0x29b8fd)[_0x834e('0x51')](_0x834e('0xa9'),_0x834e('0xaa')))[_0x834e('0x7b')]();_0xbafedb[_0x834e('0x87')](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d004f));return BPromise[_0x834e('0x81')](_0xbafedb);})[_0x834e('0x18')](function(){return _0x208bbe;})[_0x834e('0x18')](respondWithResult(_0x34a13d,null))[_0x834e('0x2e')](handleError(_0x34a13d,null));};exports[_0x834e('0xab')]=function(_0x239efd,_0x2f7170){return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x239efd[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2f7170,null))[_0x834e('0x18')](function(_0x3fd7a3){if(_0x3fd7a3){return _0x3fd7a3[_0x834e('0xab')](_0x239efd[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x41d0a7){if(_0x41d0a7){return db[_0x834e('0x53')][_0x834e('0x19')]({'where':{'ListId':_0x239efd['query'][_0x834e('0x71')],'VoiceQueueId':_0x239efd[_0x834e('0x41')]['id']}})['then'](function(){return _0x41d0a7;});}})[_0x834e('0x18')](respondWithStatusCode(_0x2f7170,null))[_0x834e('0x2e')](handleError(_0x2f7170,null));};exports['getBlackLists']=function(_0x16a7a9,_0x18b8c7){var _0x576ece={};var _0x51c877={};var _0x54915f;var _0x32d06c;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x16a7a9[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x18b8c7,null))[_0x834e('0x18')](function(_0x132711){if(_0x132711){_0x54915f=_0x132711;_0x51c877[_0x834e('0x32')]=_['keys'](db[_0x834e('0xac')][_0x834e('0x27')]);_0x51c877[_0x834e('0x2c')]=_['keys'](_0x16a7a9[_0x834e('0x2c')]);_0x51c877[_0x834e('0x31')]=_['intersection'](_0x51c877[_0x834e('0x32')],_0x51c877[_0x834e('0x2c')]);_0x576ece['attributes']=_[_0x834e('0x34')](_0x51c877[_0x834e('0x32')],qs[_0x834e('0x35')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x35')]));_0x576ece['attributes']=_0x576ece['attributes'][_0x834e('0x36')]?_0x576ece[_0x834e('0x33')]:_0x51c877[_0x834e('0x32')];_0x576ece['order']=qs[_0x834e('0x4e')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x4e')]);_0x576ece[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x16a7a9['query'],_0x51c877[_0x834e('0x31')]));if(_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]){_0x576ece[_0x834e('0x51')]=_[_0x834e('0x43')](_0x576ece['where'],{'$or':_['map'](_0x576ece[_0x834e('0x33')],function(_0x5eca84){var _0xcb4fe4={};_0xcb4fe4[_0x5eca84]={'$like':'%'+_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0xcb4fe4;})});}_0x576ece=_[_0x834e('0x43')]({},_0x576ece,_0x16a7a9[_0x834e('0x44')]);return _0x54915f[_0x834e('0xad')](_0x576ece);}})[_0x834e('0x18')](function(_0x5b4718){if(_0x5b4718){_0x32d06c=_0x5b4718[_0x834e('0x36')];if(!_0x16a7a9[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x576ece[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x16a7a9['query'][_0x834e('0x13')]);_0x576ece['offset']=qs[_0x834e('0x12')](_0x16a7a9['query'][_0x834e('0x12')]);}return _0x54915f[_0x834e('0xad')](_0x576ece);}})['then'](function(_0x3757bf){if(_0x3757bf){return _0x3757bf?{'count':_0x32d06c,'rows':_0x3757bf}:null;}})['then'](respondWithResult(_0x18b8c7,null))[_0x834e('0x2e')](handleError(_0x18b8c7,null));};exports[_0x834e('0xae')]=function(_0x395b48,_0x5b4208){var _0x4c9b90;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x395b48[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x5b4208,null))[_0x834e('0x18')](function(_0x414ff2){if(_0x414ff2){return _0x414ff2[_0x834e('0xae')](_0x395b48[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x395b48[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x3aeca7){var _0x1d9e00;_0x4c9b90=_0x3aeca7||[];var _0x11db76=[];if(_0x3aeca7){for(var _0x37f058=0x0;_0x37f058<_0x3aeca7[_0x834e('0x36')];_0x37f058+=0x1){var _0x354497=_0x3aeca7[_0x37f058]['get']({'plain':!![]});_0x1d9e00=squel[_0x834e('0x9c')]()['into'](_0x834e('0xaf'))[_0x834e('0x90')]([_0x834e('0x91'),_0x834e('0x9e'),_0x834e('0x94'),'VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x354497[_0x834e('0x93')]['toString'](),'ListId')['field'](_0x395b48['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('NOW()',_0x834e('0x46'))[_0x834e('0x73')](_0x834e('0xb0'),'updatedAt')[_0x834e('0x75')]('cm_contacts')[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')[_0x834e('0x51')]('ListId\x20=\x20?',_0x354497[_0x834e('0x93')][_0x834e('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x11db76['push'](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d9e00));}return BPromise['all'](_0x11db76);}})[_0x834e('0x18')](function(){return _0x4c9b90;})[_0x834e('0x18')](respondWithResult(_0x5b4208,null))[_0x834e('0x2e')](handleError(_0x5b4208,null));};exports['removeBlackLists']=function(_0x5cb260,_0x5b3fda){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x5cb260[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b3fda,null))[_0x834e('0x18')](function(_0x1e5e2a){if(_0x1e5e2a){return _0x1e5e2a[_0x834e('0xb1')](_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x549c2f){if(_0x549c2f){return db['CmHopperBlack'][_0x834e('0x19')]({'where':{'ListId':_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')],'VoiceQueueId':_0x5cb260[_0x834e('0x41')]['id']}})[_0x834e('0x18')](function(){return _0x549c2f;});}})[_0x834e('0x18')](respondWithStatusCode(_0x5b3fda,null))[_0x834e('0x2e')](handleError(_0x5b3fda,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 314dd73..69405af 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 _0x11d8=['VoiceQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2416b2,_0x134439){var _0x159c30=function(_0x2e335c){while(--_0x2e335c){_0x2416b2['push'](_0x2416b2['shift']());}};_0x159c30(++_0x134439);}(_0x11d8,0xce));var _0x811d=function(_0x7d095,_0x1b5d9a){_0x7d095=_0x7d095-0x0;var _0x44baa8=_0x11d8[_0x7d095];return _0x44baa8;};'use strict';var EventEmitter=require(_0x811d('0x0'));var VoiceQueue=require(_0x811d('0x1'))['db'][_0x811d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x811d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x811d('0x4')};function emitEvent(_0x191273){return function(_0x5a2fa7,_0x5d4289,_0x1287cb){VoiceQueueEvents[_0x811d('0x5')](_0x191273+':'+_0x5a2fa7['id'],_0x5a2fa7);VoiceQueueEvents[_0x811d('0x5')](_0x191273,_0x5a2fa7);_0x1287cb(null);};}for(var e in events){if(events[_0x811d('0x6')](e)){var event=events[e];VoiceQueue[_0x811d('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x2599=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x5ef741,_0x4a8ce6){var _0xceffd0=function(_0x47ab38){while(--_0x47ab38){_0x5ef741['push'](_0x5ef741['shift']());}};_0xceffd0(++_0x4a8ce6);}(_0x2599,0x1be));var _0x9259=function(_0x50def4,_0xde3b2a){_0x50def4=_0x50def4-0x0;var _0x36fe80=_0x2599[_0x50def4];return _0x36fe80;};'use strict';var EventEmitter=require(_0x9259('0x0'));var VoiceQueue=require(_0x9259('0x1'))['db'][_0x9259('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9259('0x3')](0x0);var events={'afterCreate':_0x9259('0x4'),'afterUpdate':'update','afterDestroy':_0x9259('0x5')};function emitEvent(_0x4c24ba){return function(_0x143569,_0x5df51f,_0x2b3fd1){VoiceQueueEvents[_0x9259('0x6')](_0x4c24ba+':'+_0x143569['id'],_0x143569);VoiceQueueEvents[_0x9259('0x6')](_0x4c24ba,_0x143569);_0x2b3fd1(null);};}for(var e in events){if(events[_0x9259('0x7')](e)){var event=events[e];VoiceQueue[_0x9259('0x8')](e,emitEvent(event));}}module[_0x9259('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3e1b905..2aa98a7 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x40b91e,_0x3d0dc9){var _0x5b61e8=function(_0x3d3b8f){while(--_0x3d3b8f){_0x40b91e['push'](_0x40b91e['shift']());}};_0x5b61e8(++_0x3d0dc9);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x55ca,0x126));var _0xa55c=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x55ca[_0x2f6233];return _0x1c9c36;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 5a581f8..db2bf75 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 _0x7514=['attributes','include','map','model','then','debug','catch','ShowVoiceQueue','find','raw','where','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options'];(function(_0x27889f,_0x4809b9){var _0x201713=function(_0x5e5c1e){while(--_0x5e5c1e){_0x27889f['push'](_0x27889f['shift']());}};_0x201713(++_0x4809b9);}(_0x7514,0xab));var _0x4751=function(_0x4b3600,_0x3c4086){_0x4b3600=_0x4b3600-0x0;var _0x445d99=_0x7514[_0x4b3600];return _0x445d99;};'use strict';var _=require(_0x4751('0x0'));var util=require(_0x4751('0x1'));var moment=require(_0x4751('0x2'));var BPromise=require(_0x4751('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4751('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4751('0x5'))(_0x4751('0x6'));var config=require(_0x4751('0x7'));var jayson=require(_0x4751('0x8'));var client=jayson[_0x4751('0x9')]['http']({'port':0x232a});config['redis']=_[_0x4751('0xa')](config[_0x4751('0xb')],{'host':_0x4751('0xc'),'port':0x18eb});var socket=require(_0x4751('0xd'))(new Redis(config[_0x4751('0xb')]));require(_0x4751('0xe'))['register'](socket);function respondWithRpcPromise(_0x9275e7,_0x309771,_0x166585){return new BPromise(function(_0x8a34ae,_0x18c18a){return client[_0x4751('0xf')](_0x9275e7,_0x166585)['then'](function(_0x2007f9){logger['info'](_0x4751('0x10'),_0x309771,_0x4751('0x11'));logger['debug'](_0x4751('0x12'),_0x309771,_0x4751('0x11'),JSON[_0x4751('0x13')](_0x2007f9));if(_0x2007f9[_0x4751('0x14')]){if(_0x2007f9[_0x4751('0x14')][_0x4751('0x15')]===0x1f4){logger[_0x4751('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x309771,_0x2007f9[_0x4751('0x14')][_0x4751('0x16')]);return _0x18c18a(_0x2007f9[_0x4751('0x14')][_0x4751('0x16')]);}logger['error'](_0x4751('0x10'),_0x309771,_0x2007f9[_0x4751('0x14')][_0x4751('0x16')]);return _0x8a34ae(_0x2007f9[_0x4751('0x14')][_0x4751('0x16')]);}else{logger[_0x4751('0x17')](_0x4751('0x10'),_0x309771,'request\x20sent');_0x8a34ae(_0x2007f9[_0x4751('0x18')][_0x4751('0x16')]);}})['catch'](function(_0x5f3e40){logger[_0x4751('0x14')](_0x4751('0x10'),_0x309771,_0x5f3e40);_0x18c18a(_0x5f3e40);});});}exports[_0x4751('0x19')]=function(_0x475955){var _0x162a19=this;return new Promise(function(_0x3d7ba9,_0x194851){return db[_0x4751('0x1a')][_0x4751('0x1b')]({'raw':_0x475955[_0x4751('0x1c')]?_0x475955[_0x4751('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x475955[_0x4751('0x1c')]?_0x475955[_0x4751('0x1c')]['where']||null:null,'attributes':_0x475955[_0x4751('0x1c')]?_0x475955[_0x4751('0x1c')][_0x4751('0x1d')]||null:null,'limit':_0x475955[_0x4751('0x1c')]?_0x475955[_0x4751('0x1c')]['limit']||null:null,'include':_0x475955[_0x4751('0x1c')]?_0x475955['options'][_0x4751('0x1e')]?_[_0x4751('0x1f')](_0x475955[_0x4751('0x1c')][_0x4751('0x1e')],function(_0x511016){return{'model':db[_0x511016[_0x4751('0x20')]],'as':_0x511016['as'],'attributes':_0x511016[_0x4751('0x1d')],'include':_0x511016[_0x4751('0x1e')]?_['map'](_0x511016[_0x4751('0x1e')],function(_0x5adeef){return{'model':db[_0x5adeef[_0x4751('0x20')]],'as':_0x5adeef['as'],'attributes':_0x5adeef[_0x4751('0x1d')],'include':_0x5adeef[_0x4751('0x1e')]?_['map'](_0x5adeef[_0x4751('0x1e')],function(_0xc12129){return{'model':db[_0xc12129['model']],'as':_0xc12129['as'],'attributes':_0xc12129[_0x4751('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4751('0x21')](function(_0x25bfe7){logger[_0x4751('0x17')]('GetVoiceQueue',_0x475955);logger[_0x4751('0x22')](_0x4751('0x19'),_0x475955,JSON[_0x4751('0x13')](_0x25bfe7));_0x3d7ba9(_0x25bfe7);})[_0x4751('0x23')](function(_0x2c943b){logger[_0x4751('0x14')](_0x4751('0x19'),_0x2c943b[_0x4751('0x16')],_0x475955);_0x194851(_0x162a19['error'](0x1f4,_0x2c943b[_0x4751('0x16')]));});});};exports[_0x4751('0x24')]=function(_0x52f0b7){var _0x991177=this;return new Promise(function(_0x3a7c03,_0x6c4b80){return db[_0x4751('0x1a')][_0x4751('0x25')]({'raw':_0x52f0b7[_0x4751('0x1c')]?_0x52f0b7['options'][_0x4751('0x26')]===undefined?!![]:![]:!![],'where':_0x52f0b7['options']?_0x52f0b7[_0x4751('0x1c')][_0x4751('0x27')]||null:null,'attributes':_0x52f0b7[_0x4751('0x1c')]?_0x52f0b7[_0x4751('0x1c')][_0x4751('0x1d')]||null:null,'include':_0x52f0b7[_0x4751('0x1c')]?_0x52f0b7[_0x4751('0x1c')][_0x4751('0x1e')]?_['map'](_0x52f0b7[_0x4751('0x1c')][_0x4751('0x1e')],function(_0x584ebf){return{'model':db[_0x584ebf[_0x4751('0x20')]],'as':_0x584ebf['as'],'attributes':_0x584ebf[_0x4751('0x1d')],'include':_0x584ebf[_0x4751('0x1e')]?_[_0x4751('0x1f')](_0x584ebf[_0x4751('0x1e')],function(_0x5db10e){return{'model':db[_0x5db10e[_0x4751('0x20')]],'as':_0x5db10e['as'],'attributes':_0x5db10e[_0x4751('0x1d')],'include':_0x5db10e[_0x4751('0x1e')]?_[_0x4751('0x1f')](_0x5db10e[_0x4751('0x1e')],function(_0x2e0383){return{'model':db[_0x2e0383[_0x4751('0x20')]],'as':_0x2e0383['as'],'attributes':_0x2e0383['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11ed70){logger['info'](_0x4751('0x24'),_0x52f0b7);logger[_0x4751('0x22')](_0x4751('0x24'),_0x52f0b7,JSON[_0x4751('0x13')](_0x11ed70));_0x3a7c03(_0x11ed70);})['catch'](function(_0x59d674){logger['error']('ShowVoiceQueue',_0x59d674['message'],_0x52f0b7);_0x6c4b80(_0x991177['error'](0x1f4,_0x59d674['message']));});});}; \ No newline at end of file +var _0x0dfe=['util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','map','include','model','attributes','debug','ShowVoiceQueue','lodash'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x0dfe,0x11f));var _0xe0df=function(_0x3f0706,_0x38792c){_0x3f0706=_0x3f0706-0x0;var _0x25060f=_0x0dfe[_0x3f0706];return _0x25060f;};'use strict';var _=require(_0xe0df('0x0'));var util=require(_0xe0df('0x1'));var moment=require(_0xe0df('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe0df('0x4'));var logger=require('../../config/logger')(_0xe0df('0x5'));var config=require(_0xe0df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe0df('0x7')][_0xe0df('0x8')]({'port':0x232a});config[_0xe0df('0x9')]=_[_0xe0df('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe0df('0xb'))(new Redis(config[_0xe0df('0x9')]));require(_0xe0df('0xc'))[_0xe0df('0xd')](socket);function respondWithRpcPromise(_0x28a130,_0x98b84b,_0x437e4b){return new BPromise(function(_0x2f542e,_0x5efcfb){return client[_0xe0df('0xe')](_0x28a130,_0x437e4b)[_0xe0df('0xf')](function(_0x223734){logger[_0xe0df('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x98b84b,'request\x20sent');logger['debug'](_0xe0df('0x11'),_0x98b84b,'request\x20sent',JSON[_0xe0df('0x12')](_0x223734));if(_0x223734['error']){if(_0x223734[_0xe0df('0x13')][_0xe0df('0x14')]===0x1f4){logger[_0xe0df('0x13')](_0xe0df('0x15'),_0x98b84b,_0x223734[_0xe0df('0x13')]['message']);return _0x5efcfb(_0x223734['error'][_0xe0df('0x16')]);}logger[_0xe0df('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x98b84b,_0x223734[_0xe0df('0x13')][_0xe0df('0x16')]);return _0x2f542e(_0x223734['error'][_0xe0df('0x16')]);}else{logger[_0xe0df('0x10')](_0xe0df('0x15'),_0x98b84b,'request\x20sent');_0x2f542e(_0x223734[_0xe0df('0x17')][_0xe0df('0x16')]);}})[_0xe0df('0x18')](function(_0x2bd594){logger[_0xe0df('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x98b84b,_0x2bd594);_0x5efcfb(_0x2bd594);});});}exports[_0xe0df('0x19')]=function(_0x69c73){var _0x27ffef=this;return new Promise(function(_0x29c47f,_0x1e5bd2){return db[_0xe0df('0x1a')]['findAll']({'raw':_0x69c73['options']?_0x69c73[_0xe0df('0x1b')][_0xe0df('0x1c')]===undefined?!![]:![]:!![],'where':_0x69c73[_0xe0df('0x1b')]?_0x69c73[_0xe0df('0x1b')][_0xe0df('0x1d')]||null:null,'attributes':_0x69c73[_0xe0df('0x1b')]?_0x69c73[_0xe0df('0x1b')]['attributes']||null:null,'limit':_0x69c73[_0xe0df('0x1b')]?_0x69c73[_0xe0df('0x1b')]['limit']||null:null,'include':_0x69c73[_0xe0df('0x1b')]?_0x69c73['options']['include']?_[_0xe0df('0x1e')](_0x69c73[_0xe0df('0x1b')][_0xe0df('0x1f')],function(_0x1f5695){return{'model':db[_0x1f5695[_0xe0df('0x20')]],'as':_0x1f5695['as'],'attributes':_0x1f5695[_0xe0df('0x21')],'include':_0x1f5695[_0xe0df('0x1f')]?_['map'](_0x1f5695[_0xe0df('0x1f')],function(_0x2c7225){return{'model':db[_0x2c7225[_0xe0df('0x20')]],'as':_0x2c7225['as'],'attributes':_0x2c7225[_0xe0df('0x21')],'include':_0x2c7225['include']?_[_0xe0df('0x1e')](_0x2c7225['include'],function(_0x47be51){return{'model':db[_0x47be51[_0xe0df('0x20')]],'as':_0x47be51['as'],'attributes':_0x47be51['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6de65b){logger['info'](_0xe0df('0x19'),_0x69c73);logger[_0xe0df('0x22')](_0xe0df('0x19'),_0x69c73,JSON[_0xe0df('0x12')](_0x6de65b));_0x29c47f(_0x6de65b);})[_0xe0df('0x18')](function(_0x52d1f4){logger[_0xe0df('0x13')](_0xe0df('0x19'),_0x52d1f4[_0xe0df('0x16')],_0x69c73);_0x1e5bd2(_0x27ffef['error'](0x1f4,_0x52d1f4['message']));});});};exports[_0xe0df('0x23')]=function(_0x5acb60){var _0x3b80e6=this;return new Promise(function(_0x5b5894,_0xba2b3a){return db[_0xe0df('0x1a')]['find']({'raw':_0x5acb60[_0xe0df('0x1b')]?_0x5acb60[_0xe0df('0x1b')][_0xe0df('0x1c')]===undefined?!![]:![]:!![],'where':_0x5acb60[_0xe0df('0x1b')]?_0x5acb60[_0xe0df('0x1b')][_0xe0df('0x1d')]||null:null,'attributes':_0x5acb60[_0xe0df('0x1b')]?_0x5acb60[_0xe0df('0x1b')][_0xe0df('0x21')]||null:null,'include':_0x5acb60['options']?_0x5acb60[_0xe0df('0x1b')]['include']?_[_0xe0df('0x1e')](_0x5acb60[_0xe0df('0x1b')][_0xe0df('0x1f')],function(_0x3268a3){return{'model':db[_0x3268a3[_0xe0df('0x20')]],'as':_0x3268a3['as'],'attributes':_0x3268a3['attributes'],'include':_0x3268a3[_0xe0df('0x1f')]?_[_0xe0df('0x1e')](_0x3268a3[_0xe0df('0x1f')],function(_0x398f37){return{'model':db[_0x398f37[_0xe0df('0x20')]],'as':_0x398f37['as'],'attributes':_0x398f37[_0xe0df('0x21')],'include':_0x398f37['include']?_['map'](_0x398f37[_0xe0df('0x1f')],function(_0x52cd59){return{'model':db[_0x52cd59[_0xe0df('0x20')]],'as':_0x52cd59['as'],'attributes':_0x52cd59[_0xe0df('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1900dc){logger[_0xe0df('0x10')]('ShowVoiceQueue',_0x5acb60);logger[_0xe0df('0x22')](_0xe0df('0x23'),_0x5acb60,JSON[_0xe0df('0x12')](_0x1900dc));_0x5b5894(_0x1900dc);})[_0xe0df('0x18')](function(_0x3f3bf5){logger['error'](_0xe0df('0x23'),_0x3f3bf5['message'],_0x5acb60);_0xba2b3a(_0x3b80e6[_0xe0df('0x13')](0x1f4,_0x3f3bf5[_0xe0df('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a67e72e..0ff3798 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 _0xd36c=['length','voiceQueue:','remove','update','emit','register'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0xd36c,0x13a));var _0xcd36=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xd36c[_0x373dee];return _0x46798f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0xcd36('0x0'),_0xcd36('0x1')];function createListener(_0x3b41d4,_0x49859d){return function(_0x2ff0c4){_0x49859d[_0xcd36('0x2')](_0x3b41d4,_0x2ff0c4);};}function removeListener(_0x7c4160,_0x3b140f){return function(){VoiceQueueEvents['removeListener'](_0x7c4160,_0x3b140f);};}exports[_0xcd36('0x3')]=function(_0x6bdbd5){for(var _0x136868=0x0,_0x110c46=events[_0xcd36('0x4')];_0x136868<_0x110c46;_0x136868++){var _0xbe5c9e=events[_0x136868];var _0x48b438=createListener(_0xcd36('0x5')+_0xbe5c9e,_0x6bdbd5);VoiceQueueEvents['on'](_0xbe5c9e,_0x48b438);}}; \ No newline at end of file +var _0xc928=['register','length','./voiceQueue.events','update'];(function(_0x6cb0bf,_0x490d33){var _0x5e6555=function(_0x24be5d){while(--_0x24be5d){_0x6cb0bf['push'](_0x6cb0bf['shift']());}};_0x5e6555(++_0x490d33);}(_0xc928,0x1ca));var _0x8c92=function(_0x1b3afc,_0x329380){_0x1b3afc=_0x1b3afc-0x0;var _0x392dbb=_0xc928[_0x1b3afc];return _0x392dbb;};'use strict';var VoiceQueueEvents=require(_0x8c92('0x0'));var events=['save','remove',_0x8c92('0x1')];function createListener(_0x1fe9d1,_0x5645bd){return function(_0x280ef2){_0x5645bd['emit'](_0x1fe9d1,_0x280ef2);};}function removeListener(_0x6724e4,_0xd2860c){return function(){VoiceQueueEvents['removeListener'](_0x6724e4,_0xd2860c);};}exports[_0x8c92('0x2')]=function(_0x4bb2d0){for(var _0xdedda6=0x0,_0x39757a=events[_0x8c92('0x3')];_0xdedda6<_0x39757a;_0xdedda6++){var _0x453d8e=events[_0xdedda6];var _0x182952=createListener('voiceQueue:'+_0x453d8e,_0x4bb2d0);VoiceQueueEvents['on'](_0x453d8e,_0x182952);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0459d36..af91a67 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 _0x211e=['isAuthenticated','index','describe','get','/index','getVoiceQueuesReport','/:id','show','create','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller'];(function(_0x417440,_0x1c145f){var _0x589481=function(_0x4504a7){while(--_0x4504a7){_0x417440['push'](_0x417440['shift']());}};_0x589481(++_0x1c145f);}(_0x211e,0x1e6));var _0xe211=function(_0x5aa77b,_0x62a0a1){_0x5aa77b=_0x5aa77b-0x0;var _0x1ffd28=_0x211e[_0x5aa77b];return _0x1ffd28;};'use strict';var multer=require(_0xe211('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe211('0x1'));var express=require(_0xe211('0x2'));var router=express[_0xe211('0x3')]();var fs_extra=require(_0xe211('0x4'));var auth=require(_0xe211('0x5'));var interaction=require(_0xe211('0x6'));var config=require('../../config/environment');var controller=require(_0xe211('0x7'));router['get']('/',auth[_0xe211('0x8')](),controller[_0xe211('0x9')]);router['get']('/describe',auth[_0xe211('0x8')](),controller[_0xe211('0xa')]);router[_0xe211('0xb')](_0xe211('0xc'),auth[_0xe211('0x8')](),controller[_0xe211('0xd')]);router[_0xe211('0xb')](_0xe211('0xe'),auth[_0xe211('0x8')](),controller[_0xe211('0xf')]);router['post']('/',auth[_0xe211('0x8')](),controller[_0xe211('0x10')]);router['put'](_0xe211('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe211('0x11')]);module[_0xe211('0x12')]=router; \ No newline at end of file +var _0xf402=['post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show'];(function(_0x4a070c,_0x1aec05){var _0x1dcbd9=function(_0x439058){while(--_0x439058){_0x4a070c['push'](_0x4a070c['shift']());}};_0x1dcbd9(++_0x1aec05);}(_0xf402,0x19e));var _0x2f40=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf402[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x2f40('0x0'));var util=require(_0x2f40('0x1'));var path=require(_0x2f40('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f40('0x3'));var router=express[_0x2f40('0x4')]();var fs_extra=require(_0x2f40('0x5'));var auth=require(_0x2f40('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f40('0x7'));var controller=require(_0x2f40('0x8'));router[_0x2f40('0x9')]('/',auth[_0x2f40('0xa')](),controller[_0x2f40('0xb')]);router[_0x2f40('0x9')](_0x2f40('0xc'),auth[_0x2f40('0xa')](),controller[_0x2f40('0xd')]);router[_0x2f40('0x9')](_0x2f40('0xe'),auth[_0x2f40('0xa')](),controller[_0x2f40('0xf')]);router[_0x2f40('0x9')](_0x2f40('0x10'),auth[_0x2f40('0xa')](),controller[_0x2f40('0x11')]);router[_0x2f40('0x12')]('/',auth[_0x2f40('0xa')](),controller[_0x2f40('0x13')]);router[_0x2f40('0x14')](_0x2f40('0x10'),auth[_0x2f40('0xa')](),controller[_0x2f40('0x15')]);router[_0x2f40('0x16')]('/:id',auth[_0x2f40('0xa')](),controller[_0x2f40('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d8a057a..8b6c1fa 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 _0x77ed=['sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN'];(function(_0x6e3749,_0xf71e2a){var _0x5059f8=function(_0x15222e){while(--_0x15222e){_0x6e3749['push'](_0x6e3749['shift']());}};_0x5059f8(++_0xf71e2a);}(_0x77ed,0x82));var _0xd77e=function(_0x13bff9,_0x2d8f43){_0x13bff9=_0x13bff9-0x0;var _0x479730=_0x77ed[_0x13bff9];return _0x479730;};'use strict';var Sequelize=require(_0xd77e('0x0'));var moment=require('moment');module[_0xd77e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd77e('0x2')]},'calleridnum':{'type':Sequelize[_0xd77e('0x2')]},'calleridname':{'type':Sequelize[_0xd77e('0x2')]},'queue':{'type':Sequelize[_0xd77e('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xd77e('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xe23a06){var _0x30f24e=moment(_0xe23a06);var _0x14bfea=moment(this[_0xd77e('0x4')](_0xd77e('0x5')))[_0xd77e('0x6')](_0xd77e('0x7'));var _0x400a2d=_0x30f24e[_0xd77e('0x8')](_0x14bfea,'seconds');this[_0xd77e('0x9')](_0xd77e('0xa'),_0xe23a06);this[_0xd77e('0x9')]('holdtime',_0x400a2d||null);}},'position':{'type':Sequelize[_0xd77e('0xb')]},'count':{'type':Sequelize[_0xd77e('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xd77e('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd77e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xd77e('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xd77e('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd77e('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xd77e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd77e('0x2')]},'connectedlinename':{'type':Sequelize[_0xd77e('0x2')]},'accountcode':{'type':Sequelize[_0xd77e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd77e('0x2')]},'priority':{'type':Sequelize[_0xd77e('0x2')]},'holdtime':{'type':Sequelize[_0xd77e('0xb')]},'mohtime':{'type':Sequelize[_0xd77e('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd77e('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd77e('0x2')]},'transfer':{'type':Sequelize[_0xd77e('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd77e('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd77e('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd77e('0x2')]},'disposition':{'type':Sequelize[_0xd77e('0x2')]},'secondDisposition':{'type':Sequelize[_0xd77e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd77e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xd77e('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xd77e('0x2')]}}; \ No newline at end of file +var _0xf68a=['seconds','setDataValue','queuecallerleaveAt','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20b347,_0x4c15a1){var _0x50be8c=function(_0x3ed7f4){while(--_0x3ed7f4){_0x20b347['push'](_0x20b347['shift']());}};_0x50be8c(++_0x4c15a1);}(_0xf68a,0x160));var _0xaf68=function(_0x1c36d4,_0x4bc756){_0x1c36d4=_0x1c36d4-0x0;var _0x161da=_0xf68a[_0x1c36d4];return _0x161da;};'use strict';var Sequelize=require(_0xaf68('0x0'));var moment=require(_0xaf68('0x1'));module[_0xaf68('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaf68('0x3')]},'calleridnum':{'type':Sequelize[_0xaf68('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xaf68('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xaf68('0x4')],'set':function(_0x2444dd){var _0x5a8c5e=moment(_0x2444dd);var _0x2d2a57=moment(this['getDataValue'](_0xaf68('0x5')))[_0xaf68('0x6')](_0xaf68('0x7'));var _0x37ab82=_0x5a8c5e['diff'](_0x2d2a57,_0xaf68('0x8'));this[_0xaf68('0x9')](_0xaf68('0xa'),_0x2444dd);this[_0xaf68('0x9')]('holdtime',_0x37ab82||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xaf68('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xaf68('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xaf68('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xaf68('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xaf68('0xc')},'originalposition':{'type':Sequelize[_0xaf68('0xd')]},'channel':{'type':Sequelize[_0xaf68('0x3')]},'connectedlinenum':{'type':Sequelize[_0xaf68('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xaf68('0x3')]},'priority':{'type':Sequelize[_0xaf68('0x3')]},'holdtime':{'type':Sequelize[_0xaf68('0xd')]},'mohtime':{'type':Sequelize[_0xaf68('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaf68('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaf68('0x3')],'comment':_0xaf68('0xe')},'transferexten':{'type':Sequelize[_0xaf68('0x3')]},'transferuniqueid':{'type':Sequelize[_0xaf68('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaf68('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaf68('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xaf68('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xaf68('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 4e5fceb..6401cd1 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 _0xccc4=['rows','show','params','includeAll','find','catch','create','update','body','describe','fields','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xccc4,0x144));var _0x4ccc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xccc4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ccc('0x0'));var zipdir=require(_0x4ccc('0x1'));var jsonpatch=require(_0x4ccc('0x2'));var rp=require(_0x4ccc('0x3'));var moment=require('moment');var BPromise=require(_0x4ccc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ccc('0x5'));var sox=require(_0x4ccc('0x6'));var csv=require(_0x4ccc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ccc('0x8'));var _=require(_0x4ccc('0x9'));var squel=require(_0x4ccc('0xa'));var crypto=require(_0x4ccc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4ccc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4ccc('0xd'));var Papa=require('papaparse');var Redis=require(_0x4ccc('0xe'));var authService=require(_0x4ccc('0xf'));var qs=require(_0x4ccc('0x10'));var as=require(_0x4ccc('0x11'));var hardwareService=require(_0x4ccc('0x12'));var logger=require(_0x4ccc('0x13'))(_0x4ccc('0x14'));var utils=require(_0x4ccc('0x15'));var config=require(_0x4ccc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ccc('0x17'))['db'];config[_0x4ccc('0x18')]=_['defaults'](config['redis'],{'host':_0x4ccc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ccc('0x18')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x21db63,_0x58cd9b){_0x58cd9b=_0x58cd9b||0xcc;return function(_0x5aec4c){if(_0x5aec4c){return _0x21db63[_0x4ccc('0x1a')](_0x58cd9b);}return _0x21db63[_0x4ccc('0x1b')](_0x58cd9b)[_0x4ccc('0x1c')]();};}function respondWithResult(_0x47fe8c,_0x4fc867){_0x4fc867=_0x4fc867||0xc8;return function(_0x1a92e0){if(_0x1a92e0){return _0x47fe8c[_0x4ccc('0x1b')](_0x4fc867)[_0x4ccc('0x1d')](_0x1a92e0);}};}function respondWithFilteredResult(_0xa2c2bd,_0x34ed07){return function(_0x5a1b33){if(_0x5a1b33){var _0x5296a4=typeof _0x34ed07['offset']==='undefined'&&typeof _0x34ed07[_0x4ccc('0x1e')]===_0x4ccc('0x1f');var _0x178220=_0x5a1b33[_0x4ccc('0x20')];var _0x2584bd=_0x5296a4?0x0:_0x34ed07[_0x4ccc('0x21')];var _0x34f36e=_0x5296a4?_0x5a1b33[_0x4ccc('0x20')]:_0x34ed07[_0x4ccc('0x21')]+_0x34ed07[_0x4ccc('0x1e')];var _0x770b8d;if(_0x34f36e>=_0x178220){_0x34f36e=_0x178220;_0x770b8d=0xc8;}else{_0x770b8d=0xce;}_0xa2c2bd[_0x4ccc('0x1b')](_0x770b8d);return _0xa2c2bd[_0x4ccc('0x22')](_0x4ccc('0x23'),_0x2584bd+'-'+_0x34f36e+'/'+_0x178220)[_0x4ccc('0x1d')](_0x5a1b33);}return null;};}function patchUpdates(_0x5d23b5){return function(_0x304426){try{jsonpatch['apply'](_0x304426,_0x5d23b5,!![]);}catch(_0x57657d){return BPromise[_0x4ccc('0x24')](_0x57657d);}return _0x304426[_0x4ccc('0x25')]();};}function saveUpdates(_0x1e82c8,_0x5e57dc){return function(_0x4f1c79){if(_0x4f1c79){return _0x4f1c79['update'](_0x1e82c8)[_0x4ccc('0x26')](function(_0x32f2dd){return _0x32f2dd;});}return null;};}function removeEntity(_0x48acb5,_0x580757){return function(_0x2ae201){if(_0x2ae201){return _0x2ae201[_0x4ccc('0x27')]()[_0x4ccc('0x26')](function(){_0x48acb5[_0x4ccc('0x1b')](0xcc)[_0x4ccc('0x1c')]();});}};}function handleEntityNotFound(_0x2088b7,_0x3ad67f){return function(_0x289c81){if(!_0x289c81){_0x2088b7[_0x4ccc('0x1a')](0x194);}return _0x289c81;};}function handleError(_0x41f458,_0x3dd210){_0x3dd210=_0x3dd210||0x1f4;return function(_0x3a05c2){logger['error'](_0x3a05c2[_0x4ccc('0x28')]);if(_0x3a05c2[_0x4ccc('0x29')]){delete _0x3a05c2[_0x4ccc('0x29')];}_0x41f458['status'](_0x3dd210)[_0x4ccc('0x2a')](_0x3a05c2);};}exports[_0x4ccc('0x2b')]=function(_0x444b98,_0xf04749){var _0x31e024={},_0x4d34af={},_0x3ff4a0={'count':0x0,'rows':[]};var _0x2460fe=_[_0x4ccc('0x2c')](db[_0x4ccc('0x2d')][_0x4ccc('0x2e')],function(_0x2a04e2){return{'name':_0x2a04e2['fieldName'],'type':_0x2a04e2[_0x4ccc('0x2f')]['key']};});_0x4d34af[_0x4ccc('0x30')]=_[_0x4ccc('0x2c')](_0x2460fe,_0x4ccc('0x29'));_0x4d34af[_0x4ccc('0x31')]=_[_0x4ccc('0x32')](_0x444b98[_0x4ccc('0x31')]);_0x4d34af[_0x4ccc('0x33')]=_['intersection'](_0x4d34af[_0x4ccc('0x30')],_0x4d34af[_0x4ccc('0x31')]);_0x31e024['attributes']=_[_0x4ccc('0x34')](_0x4d34af[_0x4ccc('0x30')],qs['fields'](_0x444b98[_0x4ccc('0x31')]['fields']));_0x31e024['attributes']=_0x31e024[_0x4ccc('0x35')][_0x4ccc('0x36')]?_0x31e024[_0x4ccc('0x35')]:_0x4d34af['model'];if(!_0x444b98[_0x4ccc('0x31')][_0x4ccc('0x37')](_0x4ccc('0x38'))){_0x31e024['limit']=qs['limit'](_0x444b98[_0x4ccc('0x31')][_0x4ccc('0x1e')]);_0x31e024['offset']=qs[_0x4ccc('0x21')](_0x444b98['query'][_0x4ccc('0x21')]);}_0x31e024[_0x4ccc('0x39')]=qs['sort'](_0x444b98['query'][_0x4ccc('0x3a')]);_0x31e024[_0x4ccc('0x3b')]=qs[_0x4ccc('0x33')](_[_0x4ccc('0x3c')](_0x444b98[_0x4ccc('0x31')],_0x4d34af[_0x4ccc('0x33')]),_0x2460fe);if(_0x444b98[_0x4ccc('0x31')][_0x4ccc('0x3d')]){_0x31e024[_0x4ccc('0x3b')]=_['merge'](_0x31e024[_0x4ccc('0x3b')],{'$or':_[_0x4ccc('0x2c')](_0x2460fe,function(_0x5c96ef){if(_0x5c96ef[_0x4ccc('0x2f')]!=='VIRTUAL'){var _0x326812={};_0x326812[_0x5c96ef['name']]={'$like':'%'+_0x444b98[_0x4ccc('0x31')]['filter']+'%'};return _0x326812;}})});}_0x31e024=_[_0x4ccc('0x3e')]({},_0x31e024,_0x444b98[_0x4ccc('0x3f')]);var _0x6ec698={'where':_0x31e024[_0x4ccc('0x3b')]};return db['VoiceQueueReport'][_0x4ccc('0x20')](_0x6ec698)[_0x4ccc('0x26')](function(_0x7cc773){_0x3ff4a0['count']=_0x7cc773;if(_0x444b98[_0x4ccc('0x31')]['includeAll']){_0x31e024[_0x4ccc('0x40')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x4ccc('0x41')](_0x31e024);})['then'](function(_0x541003){_0x3ff4a0[_0x4ccc('0x42')]=_0x541003;return _0x3ff4a0;})[_0x4ccc('0x26')](respondWithFilteredResult(_0xf04749,_0x31e024))['catch'](handleError(_0xf04749,null));};exports[_0x4ccc('0x43')]=function(_0x439522,_0x1a41e3){var _0x12118d={'raw':![],'where':{'id':_0x439522[_0x4ccc('0x44')]['id']}},_0x4736ea={};_0x4736ea[_0x4ccc('0x30')]=_[_0x4ccc('0x32')](db['VoiceQueueReport'][_0x4ccc('0x2e')]);_0x4736ea[_0x4ccc('0x31')]=_[_0x4ccc('0x32')](_0x439522[_0x4ccc('0x31')]);_0x4736ea[_0x4ccc('0x33')]=_[_0x4ccc('0x34')](_0x4736ea[_0x4ccc('0x30')],_0x4736ea['query']);_0x12118d['attributes']=_['intersection'](_0x4736ea[_0x4ccc('0x30')],qs['fields'](_0x439522['query']['fields']));_0x12118d[_0x4ccc('0x35')]=_0x12118d[_0x4ccc('0x35')]['length']?_0x12118d[_0x4ccc('0x35')]:_0x4736ea[_0x4ccc('0x30')];if(_0x439522[_0x4ccc('0x31')][_0x4ccc('0x45')]){_0x12118d[_0x4ccc('0x40')]=[{'all':!![]}];}_0x12118d=_[_0x4ccc('0x3e')]({},_0x12118d,_0x439522['options']);return db[_0x4ccc('0x2d')][_0x4ccc('0x46')](_0x12118d)[_0x4ccc('0x26')](handleEntityNotFound(_0x1a41e3,null))[_0x4ccc('0x26')](respondWithResult(_0x1a41e3,null))[_0x4ccc('0x47')](handleError(_0x1a41e3,null));};exports[_0x4ccc('0x48')]=function(_0x564dc6,_0x2c7452){return db[_0x4ccc('0x2d')][_0x4ccc('0x48')](_0x564dc6['body'],{})[_0x4ccc('0x26')](respondWithResult(_0x2c7452,0xc9))[_0x4ccc('0x47')](handleError(_0x2c7452,null));};exports[_0x4ccc('0x49')]=function(_0x13fd79,_0x3273ca){if(_0x13fd79[_0x4ccc('0x4a')]['id']){delete _0x13fd79[_0x4ccc('0x4a')]['id'];}return db[_0x4ccc('0x2d')][_0x4ccc('0x46')]({'where':{'id':_0x13fd79[_0x4ccc('0x44')]['id']}})['then'](handleEntityNotFound(_0x3273ca,null))['then'](saveUpdates(_0x13fd79[_0x4ccc('0x4a')],null))[_0x4ccc('0x26')](respondWithResult(_0x3273ca,null))[_0x4ccc('0x47')](handleError(_0x3273ca,null));};exports['destroy']=function(_0x1596fb,_0x295399){return db[_0x4ccc('0x2d')][_0x4ccc('0x46')]({'where':{'id':_0x1596fb[_0x4ccc('0x44')]['id']}})[_0x4ccc('0x26')](handleEntityNotFound(_0x295399,null))[_0x4ccc('0x26')](removeEntity(_0x295399,null))[_0x4ccc('0x47')](handleError(_0x295399,null));};exports['describe']=function(_0x3f9af2,_0x5dc26f){return db[_0x4ccc('0x2d')][_0x4ccc('0x4b')]()['then'](respondWithResult(_0x5dc26f,null))[_0x4ccc('0x47')](handleError(_0x5dc26f,null));};exports['getVoiceQueuesReport']=function(_0x1006f4,_0x5a91c8){var _0x4d3ffc={},_0x2fc243={},_0x1c7d88={'count':0x0,'rows':[]};_0x2fc243[_0x4ccc('0x30')]=_[_0x4ccc('0x32')](db['VoiceQueueReport']['rawAttributes']);_0x2fc243[_0x4ccc('0x31')]=_[_0x4ccc('0x32')](_0x1006f4['query']);_0x2fc243[_0x4ccc('0x33')]=_['intersection'](_0x2fc243['model'],_0x2fc243['query']);_0x4d3ffc[_0x4ccc('0x35')]=_[_0x4ccc('0x34')](_0x2fc243[_0x4ccc('0x30')],qs['fields'](_0x1006f4[_0x4ccc('0x31')][_0x4ccc('0x4c')]));_0x4d3ffc[_0x4ccc('0x35')]=_0x4d3ffc[_0x4ccc('0x35')][_0x4ccc('0x36')]?_0x4d3ffc[_0x4ccc('0x35')]:_0x2fc243[_0x4ccc('0x30')];if(!_0x1006f4[_0x4ccc('0x31')][_0x4ccc('0x37')](_0x4ccc('0x38'))){_0x4d3ffc[_0x4ccc('0x1e')]=qs[_0x4ccc('0x1e')](_0x1006f4[_0x4ccc('0x31')][_0x4ccc('0x1e')]);_0x4d3ffc[_0x4ccc('0x21')]=qs['offset'](_0x1006f4[_0x4ccc('0x31')][_0x4ccc('0x21')]);}_0x4d3ffc[_0x4ccc('0x39')]=qs['sort'](_0x1006f4['query'][_0x4ccc('0x3a')]);_0x4d3ffc['where']=qs[_0x4ccc('0x33')](_[_0x4ccc('0x3c')](_0x1006f4[_0x4ccc('0x31')],_0x2fc243['filters']));if(_0x1006f4[_0x4ccc('0x31')][_0x4ccc('0x3d')]){_0x4d3ffc[_0x4ccc('0x3b')]=_[_0x4ccc('0x3e')](_0x4d3ffc[_0x4ccc('0x3b')],{'$or':_[_0x4ccc('0x2c')](_0x4d3ffc[_0x4ccc('0x35')],function(_0x6ccecb){var _0xf01197={};_0xf01197[_0x6ccecb]={'$like':'%'+_0x1006f4['query']['filter']+'%'};return _0xf01197;})});}_0x4d3ffc=_['merge']({},_0x4d3ffc,_0x1006f4['options']);var _0x24903a={'where':_0x4d3ffc['where']};return db['VoiceQueueReport'][_0x4ccc('0x20')](_0x24903a)[_0x4ccc('0x26')](function(_0x3332bc){_0x1c7d88['count']=_0x3332bc;if(_0x1006f4[_0x4ccc('0x31')]['includeAll']){_0x4d3ffc[_0x4ccc('0x40')]=[{'all':!![]}];}return db[_0x4ccc('0x2d')][_0x4ccc('0x41')](_0x4d3ffc);})[_0x4ccc('0x26')](function(_0x2c1199){_0x1c7d88['rows']=_0x2c1199;return _0x1c7d88;})[_0x4ccc('0x26')](respondWithFilteredResult(_0x5a91c8,_0x4d3ffc,_0x4ccc('0x4d')))[_0x4ccc('0x47')](handleError(_0x5a91c8,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x330f=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','then','destroy','error','stack','send','index','map','VoiceQueueReport','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','getVoiceQueuesReport','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x330f,0x12c));var _0xf330=function(_0x1fb7d1,_0x108781){_0x1fb7d1=_0x1fb7d1-0x0;var _0x2480d8=_0x330f[_0x1fb7d1];return _0x2480d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf330('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf330('0x1'));var util=require('util');var path=require(_0xf330('0x2'));var sox=require(_0xf330('0x3'));var csv=require(_0xf330('0x4'));var ejs=require(_0xf330('0x5'));var fs=require('fs');var fs_extra=require(_0xf330('0x6'));var _=require(_0xf330('0x7'));var squel=require(_0xf330('0x8'));var crypto=require(_0xf330('0x9'));var jsforce=require(_0xf330('0xa'));var deskjs=require(_0xf330('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf330('0xc'));var Papa=require(_0xf330('0xd'));var Redis=require('ioredis');var authService=require(_0xf330('0xe'));var qs=require(_0xf330('0xf'));var as=require(_0xf330('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf330('0x11'))('api');var utils=require(_0xf330('0x12'));var config=require(_0xf330('0x13'));var licenseUtil=require(_0xf330('0x14'));var db=require(_0xf330('0x15'))['db'];config[_0xf330('0x16')]=_[_0xf330('0x17')](config[_0xf330('0x16')],{'host':_0xf330('0x18'),'port':0x18eb});var socket=require(_0xf330('0x19'))(new Redis(config['redis']));require(_0xf330('0x1a'))[_0xf330('0x1b')](socket);function respondWithStatusCode(_0x1529e7,_0x3b5112){_0x3b5112=_0x3b5112||0xcc;return function(_0x1d2290){if(_0x1d2290){return _0x1529e7[_0xf330('0x1c')](_0x3b5112);}return _0x1529e7[_0xf330('0x1d')](_0x3b5112)[_0xf330('0x1e')]();};}function respondWithResult(_0x921ec8,_0x3de3d4){_0x3de3d4=_0x3de3d4||0xc8;return function(_0x497c58){if(_0x497c58){return _0x921ec8['status'](_0x3de3d4)[_0xf330('0x1f')](_0x497c58);}};}function respondWithFilteredResult(_0x4d4ded,_0x1f23ef){return function(_0x435559){if(_0x435559){var _0x4708e0=typeof _0x1f23ef['offset']===_0xf330('0x20')&&typeof _0x1f23ef['limit']===_0xf330('0x20');var _0x2f1d90=_0x435559[_0xf330('0x21')];var _0x45ff4e=_0x4708e0?0x0:_0x1f23ef[_0xf330('0x22')];var _0x10b609=_0x4708e0?_0x435559[_0xf330('0x21')]:_0x1f23ef['offset']+_0x1f23ef[_0xf330('0x23')];var _0x40a1d8;if(_0x10b609>=_0x2f1d90){_0x10b609=_0x2f1d90;_0x40a1d8=0xc8;}else{_0x40a1d8=0xce;}_0x4d4ded[_0xf330('0x1d')](_0x40a1d8);return _0x4d4ded['set']('Content-Range',_0x45ff4e+'-'+_0x10b609+'/'+_0x2f1d90)[_0xf330('0x1f')](_0x435559);}return null;};}function patchUpdates(_0x395cf0){return function(_0x2e9a9e){try{jsonpatch[_0xf330('0x24')](_0x2e9a9e,_0x395cf0,!![]);}catch(_0x47d42e){return BPromise[_0xf330('0x25')](_0x47d42e);}return _0x2e9a9e['save']();};}function saveUpdates(_0x311cb7,_0x5c47a0){return function(_0x1b6154){if(_0x1b6154){return _0x1b6154['update'](_0x311cb7)[_0xf330('0x26')](function(_0x38d08){return _0x38d08;});}return null;};}function removeEntity(_0x463ce4,_0x1284b0){return function(_0x361c3e){if(_0x361c3e){return _0x361c3e[_0xf330('0x27')]()['then'](function(){_0x463ce4[_0xf330('0x1d')](0xcc)[_0xf330('0x1e')]();});}};}function handleEntityNotFound(_0x57bba1,_0x56642a){return function(_0x158008){if(!_0x158008){_0x57bba1[_0xf330('0x1c')](0x194);}return _0x158008;};}function handleError(_0x115c3e,_0x443dd4){_0x443dd4=_0x443dd4||0x1f4;return function(_0x437aa5){logger[_0xf330('0x28')](_0x437aa5[_0xf330('0x29')]);if(_0x437aa5['name']){delete _0x437aa5['name'];}_0x115c3e[_0xf330('0x1d')](_0x443dd4)[_0xf330('0x2a')](_0x437aa5);};}exports[_0xf330('0x2b')]=function(_0x17fc9f,_0x6acc7e){var _0xb4dd41={},_0x8e66a2={},_0x2bc24c={'count':0x0,'rows':[]};var _0x1f2a95=_[_0xf330('0x2c')](db[_0xf330('0x2d')]['rawAttributes'],function(_0x548cc5){return{'name':_0x548cc5[_0xf330('0x2e')],'type':_0x548cc5[_0xf330('0x2f')][_0xf330('0x30')]};});_0x8e66a2[_0xf330('0x31')]=_['map'](_0x1f2a95,_0xf330('0x32'));_0x8e66a2[_0xf330('0x33')]=_[_0xf330('0x34')](_0x17fc9f[_0xf330('0x33')]);_0x8e66a2[_0xf330('0x35')]=_['intersection'](_0x8e66a2[_0xf330('0x31')],_0x8e66a2[_0xf330('0x33')]);_0xb4dd41[_0xf330('0x36')]=_[_0xf330('0x37')](_0x8e66a2[_0xf330('0x31')],qs[_0xf330('0x38')](_0x17fc9f[_0xf330('0x33')][_0xf330('0x38')]));_0xb4dd41[_0xf330('0x36')]=_0xb4dd41[_0xf330('0x36')][_0xf330('0x39')]?_0xb4dd41[_0xf330('0x36')]:_0x8e66a2['model'];if(!_0x17fc9f[_0xf330('0x33')][_0xf330('0x3a')](_0xf330('0x3b'))){_0xb4dd41['limit']=qs[_0xf330('0x23')](_0x17fc9f[_0xf330('0x33')][_0xf330('0x23')]);_0xb4dd41['offset']=qs[_0xf330('0x22')](_0x17fc9f[_0xf330('0x33')][_0xf330('0x22')]);}_0xb4dd41[_0xf330('0x3c')]=qs[_0xf330('0x3d')](_0x17fc9f[_0xf330('0x33')][_0xf330('0x3d')]);_0xb4dd41[_0xf330('0x3e')]=qs[_0xf330('0x35')](_[_0xf330('0x3f')](_0x17fc9f[_0xf330('0x33')],_0x8e66a2[_0xf330('0x35')]),_0x1f2a95);if(_0x17fc9f[_0xf330('0x33')]['filter']){_0xb4dd41[_0xf330('0x3e')]=_['merge'](_0xb4dd41[_0xf330('0x3e')],{'$or':_[_0xf330('0x2c')](_0x1f2a95,function(_0x3418c6){if(_0x3418c6['type']!==_0xf330('0x40')){var _0x470934={};_0x470934[_0x3418c6['name']]={'$like':'%'+_0x17fc9f[_0xf330('0x33')][_0xf330('0x41')]+'%'};return _0x470934;}})});}_0xb4dd41=_[_0xf330('0x42')]({},_0xb4dd41,_0x17fc9f[_0xf330('0x43')]);var _0x38b75f={'where':_0xb4dd41['where']};return db[_0xf330('0x2d')]['count'](_0x38b75f)[_0xf330('0x26')](function(_0x3d3e60){_0x2bc24c[_0xf330('0x21')]=_0x3d3e60;if(_0x17fc9f[_0xf330('0x33')][_0xf330('0x44')]){_0xb4dd41[_0xf330('0x45')]=[{'all':!![]}];}return db[_0xf330('0x2d')][_0xf330('0x46')](_0xb4dd41);})['then'](function(_0x26fd6c){_0x2bc24c[_0xf330('0x47')]=_0x26fd6c;return _0x2bc24c;})[_0xf330('0x26')](respondWithFilteredResult(_0x6acc7e,_0xb4dd41))[_0xf330('0x48')](handleError(_0x6acc7e,null));};exports[_0xf330('0x49')]=function(_0x36743b,_0x4a3ba7){var _0x51f7e7={'raw':![],'where':{'id':_0x36743b[_0xf330('0x4a')]['id']}},_0x56b4d5={};_0x56b4d5[_0xf330('0x31')]=_[_0xf330('0x34')](db[_0xf330('0x2d')][_0xf330('0x4b')]);_0x56b4d5[_0xf330('0x33')]=_[_0xf330('0x34')](_0x36743b['query']);_0x56b4d5[_0xf330('0x35')]=_[_0xf330('0x37')](_0x56b4d5['model'],_0x56b4d5[_0xf330('0x33')]);_0x51f7e7[_0xf330('0x36')]=_[_0xf330('0x37')](_0x56b4d5[_0xf330('0x31')],qs[_0xf330('0x38')](_0x36743b[_0xf330('0x33')][_0xf330('0x38')]));_0x51f7e7[_0xf330('0x36')]=_0x51f7e7['attributes']['length']?_0x51f7e7['attributes']:_0x56b4d5[_0xf330('0x31')];if(_0x36743b['query'][_0xf330('0x44')]){_0x51f7e7[_0xf330('0x45')]=[{'all':!![]}];}_0x51f7e7=_[_0xf330('0x42')]({},_0x51f7e7,_0x36743b['options']);return db[_0xf330('0x2d')][_0xf330('0x4c')](_0x51f7e7)['then'](handleEntityNotFound(_0x4a3ba7,null))[_0xf330('0x26')](respondWithResult(_0x4a3ba7,null))[_0xf330('0x48')](handleError(_0x4a3ba7,null));};exports['create']=function(_0x330ecc,_0x485f9a){return db[_0xf330('0x2d')][_0xf330('0x4d')](_0x330ecc[_0xf330('0x4e')],{})['then'](respondWithResult(_0x485f9a,0xc9))[_0xf330('0x48')](handleError(_0x485f9a,null));};exports['update']=function(_0x2f438b,_0x433916){if(_0x2f438b[_0xf330('0x4e')]['id']){delete _0x2f438b[_0xf330('0x4e')]['id'];}return db['VoiceQueueReport'][_0xf330('0x4c')]({'where':{'id':_0x2f438b[_0xf330('0x4a')]['id']}})[_0xf330('0x26')](handleEntityNotFound(_0x433916,null))[_0xf330('0x26')](saveUpdates(_0x2f438b[_0xf330('0x4e')],null))[_0xf330('0x26')](respondWithResult(_0x433916,null))[_0xf330('0x48')](handleError(_0x433916,null));};exports[_0xf330('0x27')]=function(_0x45d4c2,_0x424a34){return db[_0xf330('0x2d')][_0xf330('0x4c')]({'where':{'id':_0x45d4c2[_0xf330('0x4a')]['id']}})[_0xf330('0x26')](handleEntityNotFound(_0x424a34,null))['then'](removeEntity(_0x424a34,null))[_0xf330('0x48')](handleError(_0x424a34,null));};exports['describe']=function(_0x49c2c3,_0x313a1f){return db['VoiceQueueReport'][_0xf330('0x4f')]()[_0xf330('0x26')](respondWithResult(_0x313a1f,null))[_0xf330('0x48')](handleError(_0x313a1f,null));};exports['getVoiceQueuesReport']=function(_0x34e656,_0xedaff5){var _0x9cb08b={},_0x5383f8={},_0x1f83cd={'count':0x0,'rows':[]};_0x5383f8['model']=_['keys'](db['VoiceQueueReport'][_0xf330('0x4b')]);_0x5383f8['query']=_[_0xf330('0x34')](_0x34e656[_0xf330('0x33')]);_0x5383f8[_0xf330('0x35')]=_[_0xf330('0x37')](_0x5383f8[_0xf330('0x31')],_0x5383f8[_0xf330('0x33')]);_0x9cb08b[_0xf330('0x36')]=_[_0xf330('0x37')](_0x5383f8[_0xf330('0x31')],qs[_0xf330('0x38')](_0x34e656[_0xf330('0x33')][_0xf330('0x38')]));_0x9cb08b[_0xf330('0x36')]=_0x9cb08b[_0xf330('0x36')][_0xf330('0x39')]?_0x9cb08b[_0xf330('0x36')]:_0x5383f8[_0xf330('0x31')];if(!_0x34e656[_0xf330('0x33')][_0xf330('0x3a')](_0xf330('0x3b'))){_0x9cb08b[_0xf330('0x23')]=qs[_0xf330('0x23')](_0x34e656[_0xf330('0x33')][_0xf330('0x23')]);_0x9cb08b[_0xf330('0x22')]=qs[_0xf330('0x22')](_0x34e656['query'][_0xf330('0x22')]);}_0x9cb08b[_0xf330('0x3c')]=qs[_0xf330('0x3d')](_0x34e656[_0xf330('0x33')][_0xf330('0x3d')]);_0x9cb08b[_0xf330('0x3e')]=qs[_0xf330('0x35')](_[_0xf330('0x3f')](_0x34e656[_0xf330('0x33')],_0x5383f8[_0xf330('0x35')]));if(_0x34e656[_0xf330('0x33')][_0xf330('0x41')]){_0x9cb08b[_0xf330('0x3e')]=_['merge'](_0x9cb08b[_0xf330('0x3e')],{'$or':_['map'](_0x9cb08b[_0xf330('0x36')],function(_0x107be2){var _0x13f31d={};_0x13f31d[_0x107be2]={'$like':'%'+_0x34e656['query'][_0xf330('0x41')]+'%'};return _0x13f31d;})});}_0x9cb08b=_['merge']({},_0x9cb08b,_0x34e656[_0xf330('0x43')]);var _0x46bae4={'where':_0x9cb08b[_0xf330('0x3e')]};return db['VoiceQueueReport']['count'](_0x46bae4)[_0xf330('0x26')](function(_0x48d7d9){_0x1f83cd[_0xf330('0x21')]=_0x48d7d9;if(_0x34e656[_0xf330('0x33')][_0xf330('0x44')]){_0x9cb08b[_0xf330('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x9cb08b);})[_0xf330('0x26')](function(_0x147a76){_0x1f83cd[_0xf330('0x47')]=_0x147a76;return _0x1f83cd;})[_0xf330('0x26')](respondWithFilteredResult(_0xedaff5,_0x9cb08b,'getVoiceQueuesReport'))[_0xf330('0x48')](handleError(_0xedaff5,null,_0xf330('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 4a1a69c..8b5c1b6 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 _0x0e57=['remove','emit','hasOwnProperty','hook','exports','VoiceQueueReport','save'];(function(_0x361ee1,_0x37fed8){var _0x1fcaad=function(_0xd426bf){while(--_0xd426bf){_0x361ee1['push'](_0x361ee1['shift']());}};_0x1fcaad(++_0x37fed8);}(_0x0e57,0xde));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x70e5('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x70e5('0x1'),'afterUpdate':'update','afterDestroy':_0x70e5('0x2')};function emitEvent(_0x27ffc0){return function(_0x37423b,_0x4898f5,_0x346106){VoiceQueueReportEvents[_0x70e5('0x3')](_0x27ffc0+':'+_0x37423b['id'],_0x37423b);VoiceQueueReportEvents[_0x70e5('0x3')](_0x27ffc0,_0x37423b);_0x346106(null);};}for(var e in events){if(events[_0x70e5('0x4')](e)){var event=events[e];VoiceQueueReport[_0x70e5('0x5')](e,emitEvent(event));}}module[_0x70e5('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6832=['hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x390ca8,_0x500e36){var _0xccf140=function(_0x7eb74e){while(--_0x7eb74e){_0x390ca8['push'](_0x390ca8['shift']());}};_0xccf140(++_0x500e36);}(_0x6832,0xb9));var _0x2683=function(_0x50de3e,_0x4f46d4){_0x50de3e=_0x50de3e-0x0;var _0x1d646d=_0x6832[_0x50de3e];return _0x1d646d;};'use strict';var EventEmitter=require(_0x2683('0x0'));var VoiceQueueReport=require(_0x2683('0x1'))['db'][_0x2683('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2683('0x3')](0x0);var events={'afterCreate':_0x2683('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ae0ce){return function(_0x1ee5c7,_0x4d0113,_0x42dad6){VoiceQueueReportEvents['emit'](_0x5ae0ce+':'+_0x1ee5c7['id'],_0x1ee5c7);VoiceQueueReportEvents[_0x2683('0x5')](_0x5ae0ce,_0x1ee5c7);_0x42dad6(null);};}for(var e in events){if(events[_0x2683('0x6')](e)){var event=events[e];VoiceQueueReport[_0x2683('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e546d80..a6b10a6 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 _0x7613=['uniqueid','calleridnum','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x11bf1b,_0x50581b){var _0x387d1c=function(_0x54e22f){while(--_0x54e22f){_0x11bf1b['push'](_0x11bf1b['shift']());}};_0x387d1c(++_0x50581b);}(_0x7613,0x84));var _0x3761=function(_0x145435,_0x326220){_0x145435=_0x145435-0x0;var _0x55a234=_0x7613[_0x145435];return _0x55a234;};'use strict';var _=require('lodash');var util=require(_0x3761('0x0'));var logger=require(_0x3761('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3761('0x2'));var rp=require(_0x3761('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3761('0x4'));var config=require(_0x3761('0x5'));var attributes=require(_0x3761('0x6'));module[_0x3761('0x7')]=function(_0x2105bb,_0x35f370){return _0x2105bb[_0x3761('0x8')](_0x3761('0x9'),attributes,{'tableName':_0x3761('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3761('0xb')]},{'fields':[_0x3761('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe283=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash'];(function(_0x86268a,_0x87d96a){var _0x20d169=function(_0x11504e){while(--_0x11504e){_0x86268a['push'](_0x86268a['shift']());}};_0x20d169(++_0x87d96a);}(_0xe283,0xdf));var _0x3e28=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0xe283[_0x592df4];return _0x3b4fe4;};'use strict';var _=require(_0x3e28('0x0'));var util=require(_0x3e28('0x1'));var logger=require(_0x3e28('0x2'))(_0x3e28('0x3'));var moment=require(_0x3e28('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e28('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e28('0x6'));var config=require(_0x3e28('0x7'));var attributes=require(_0x3e28('0x8'));module['exports']=function(_0x20fc4d,_0x2780c7){return _0x20fc4d[_0x3e28('0x9')](_0x3e28('0xa'),attributes,{'tableName':_0x3e28('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3e28('0xc')]},{'fields':[_0x3e28('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7604ce7..bf22865 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 _0x1374=['redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x27ce04,_0x404ea4){var _0x19d4ce=function(_0x266854){while(--_0x266854){_0x27ce04['push'](_0x27ce04['shift']());}};_0x19d4ce(++_0x404ea4);}(_0x1374,0x18a));var _0x4137=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x1374[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x4137('0x0'));var moment=require(_0x4137('0x1'));var BPromise=require(_0x4137('0x2'));var rs=require(_0x4137('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4137('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4137('0x5'))(_0x4137('0x6'));var config=require(_0x4137('0x7'));var jayson=require(_0x4137('0x8'));var client=jayson[_0x4137('0x9')][_0x4137('0xa')]({'port':0x232a});config[_0x4137('0xb')]=_[_0x4137('0xc')](config[_0x4137('0xb')],{'host':_0x4137('0xd'),'port':0x18eb});var socket=require(_0x4137('0xe'))(new Redis(config[_0x4137('0xb')]));require(_0x4137('0xf'))[_0x4137('0x10')](socket);function respondWithRpcPromise(_0x3023c6,_0x4bc696,_0xfff420){return new BPromise(function(_0x4a4fea,_0x193fd8){return client[_0x4137('0x11')](_0x3023c6,_0xfff420)[_0x4137('0x12')](function(_0x3b9e5e){logger[_0x4137('0x13')](_0x4137('0x14'),_0x4bc696,_0x4137('0x15'));logger[_0x4137('0x16')](_0x4137('0x17'),_0x4bc696,_0x4137('0x15'),JSON[_0x4137('0x18')](_0x3b9e5e));if(_0x3b9e5e[_0x4137('0x19')]){if(_0x3b9e5e[_0x4137('0x19')][_0x4137('0x1a')]===0x1f4){logger[_0x4137('0x19')](_0x4137('0x14'),_0x4bc696,_0x3b9e5e['error'][_0x4137('0x1b')]);return _0x193fd8(_0x3b9e5e[_0x4137('0x19')][_0x4137('0x1b')]);}logger[_0x4137('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x4bc696,_0x3b9e5e[_0x4137('0x19')][_0x4137('0x1b')]);return _0x4a4fea(_0x3b9e5e['error'][_0x4137('0x1b')]);}else{logger[_0x4137('0x13')](_0x4137('0x14'),_0x4bc696,_0x4137('0x15'));_0x4a4fea(_0x3b9e5e[_0x4137('0x1c')][_0x4137('0x1b')]);}})[_0x4137('0x1d')](function(_0x19460a){logger['error'](_0x4137('0x14'),_0x4bc696,_0x19460a);_0x193fd8(_0x19460a);});});}exports['GetVoiceQueueReport']=function(_0x4b2060){var _0x5eb7c4=this;return new Promise(function(_0x4f3866,_0x122955){return db[_0x4137('0x1e')][_0x4137('0x1f')]({'raw':_0x4b2060[_0x4137('0x20')]?_0x4b2060[_0x4137('0x20')][_0x4137('0x21')]===undefined?!![]:![]:!![],'where':_0x4b2060[_0x4137('0x20')]?_0x4b2060['options']['where']||null:null,'attributes':_0x4b2060[_0x4137('0x20')]?_0x4b2060[_0x4137('0x20')]['attributes']||null:null,'limit':_0x4b2060[_0x4137('0x20')]?_0x4b2060['options']['limit']||null:null,'include':_0x4b2060['options']?_0x4b2060[_0x4137('0x20')][_0x4137('0x22')]?_[_0x4137('0x23')](_0x4b2060[_0x4137('0x20')][_0x4137('0x22')],function(_0x3c091d){return{'model':db[_0x3c091d[_0x4137('0x24')]],'as':_0x3c091d['as'],'attributes':_0x3c091d[_0x4137('0x25')],'include':_0x3c091d[_0x4137('0x22')]?_['map'](_0x3c091d['include'],function(_0x4f3fbf){return{'model':db[_0x4f3fbf['model']],'as':_0x4f3fbf['as'],'attributes':_0x4f3fbf[_0x4137('0x25')],'include':_0x4f3fbf['include']?_[_0x4137('0x23')](_0x4f3fbf['include'],function(_0x1735d0){return{'model':db[_0x1735d0['model']],'as':_0x1735d0['as'],'attributes':_0x1735d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x4137('0x12')](function(_0xbf1563){logger[_0x4137('0x13')](_0x4137('0x26'),_0x4b2060);logger[_0x4137('0x16')](_0x4137('0x26'),_0x4b2060,JSON[_0x4137('0x18')](_0xbf1563));_0x4f3866(_0xbf1563);})[_0x4137('0x1d')](function(_0x2d395b){logger[_0x4137('0x19')](_0x4137('0x26'),_0x2d395b['message'],_0x4b2060);_0x122955(_0x5eb7c4[_0x4137('0x19')](0x1f4,_0x2d395b[_0x4137('0x1b')]));});});};exports[_0x4137('0x27')]=function(_0x16dff1){var _0x14822d=this;return new Promise(function(_0x5db209,_0x459bc4){return db[_0x4137('0x1e')][_0x4137('0x28')](_0x16dff1[_0x4137('0x29')],{'raw':_0x16dff1['options']?_0x16dff1[_0x4137('0x20')][_0x4137('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x454acc){logger[_0x4137('0x13')](_0x4137('0x27'),_0x16dff1);logger[_0x4137('0x16')](_0x4137('0x27'),_0x16dff1,JSON[_0x4137('0x18')](_0x454acc));_0x5db209(_0x454acc);})[_0x4137('0x1d')](function(_0x17a3ba){logger[_0x4137('0x19')](_0x4137('0x27'),_0x17a3ba[_0x4137('0x1b')],_0x16dff1);_0x459bc4(_0x14822d['error'](0x1f4,_0x17a3ba['message']));});});};exports[_0x4137('0x2a')]=function(_0x24e953){var _0x2b4cbd=this;return new Promise(function(_0x2d5167,_0x24708b){return db[_0x4137('0x1e')][_0x4137('0x2b')](_0x24e953['body'],{'raw':_0x24e953['options']?_0x24e953[_0x4137('0x20')][_0x4137('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e953[_0x4137('0x20')]?_0x24e953[_0x4137('0x20')][_0x4137('0x2c')]||null:null,'attributes':_0x24e953[_0x4137('0x20')]?_0x24e953[_0x4137('0x20')]['attributes']||null:null,'limit':_0x24e953[_0x4137('0x20')]?_0x24e953[_0x4137('0x20')]['limit']||null:null})[_0x4137('0x12')](function(_0x116514){logger[_0x4137('0x13')](_0x4137('0x2a'),_0x24e953);logger[_0x4137('0x16')](_0x4137('0x2a'),_0x24e953,JSON['stringify'](_0x116514));_0x2d5167(_0x116514);})[_0x4137('0x1d')](function(_0x4f6cb7){logger[_0x4137('0x19')](_0x4137('0x2a'),_0x4f6cb7['message'],_0x24e953);_0x24708b(_0x2b4cbd[_0x4137('0x19')](0x1f4,_0x4f6cb7['message']));});});}; \ No newline at end of file +var _0x9884=['socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','debug','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','body','catch','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3baac0,_0x240918){var _0x2ec5cd=function(_0x58aa3b){while(--_0x58aa3b){_0x3baac0['push'](_0x3baac0['shift']());}};_0x2ec5cd(++_0x240918);}(_0x9884,0xee));var _0x4988=function(_0x5e2310,_0x21c269){_0x5e2310=_0x5e2310-0x0;var _0x4f78cd=_0x9884[_0x5e2310];return _0x4f78cd;};'use strict';var _=require(_0x4988('0x0'));var util=require(_0x4988('0x1'));var moment=require(_0x4988('0x2'));var BPromise=require(_0x4988('0x3'));var rs=require(_0x4988('0x4'));var fs=require('fs');var Redis=require(_0x4988('0x5'));var db=require(_0x4988('0x6'))['db'];var utils=require(_0x4988('0x7'));var logger=require('../../config/logger')(_0x4988('0x8'));var config=require(_0x4988('0x9'));var jayson=require(_0x4988('0xa'));var client=jayson['client'][_0x4988('0xb')]({'port':0x232a});config[_0x4988('0xc')]=_[_0x4988('0xd')](config[_0x4988('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4988('0xe'))(new Redis(config[_0x4988('0xc')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x5a67bc,_0x4c1ec0,_0x513957){return new BPromise(function(_0x2e3094,_0x992585){return client[_0x4988('0xf')](_0x5a67bc,_0x513957)[_0x4988('0x10')](function(_0x10b3f6){logger[_0x4988('0x11')](_0x4988('0x12'),_0x4c1ec0,_0x4988('0x13'));logger['debug'](_0x4988('0x14'),_0x4c1ec0,_0x4988('0x13'),JSON['stringify'](_0x10b3f6));if(_0x10b3f6[_0x4988('0x15')]){if(_0x10b3f6[_0x4988('0x15')][_0x4988('0x16')]===0x1f4){logger[_0x4988('0x15')](_0x4988('0x12'),_0x4c1ec0,_0x10b3f6['error'][_0x4988('0x17')]);return _0x992585(_0x10b3f6['error'][_0x4988('0x17')]);}logger[_0x4988('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4c1ec0,_0x10b3f6['error'][_0x4988('0x17')]);return _0x2e3094(_0x10b3f6[_0x4988('0x15')][_0x4988('0x17')]);}else{logger['info'](_0x4988('0x12'),_0x4c1ec0,_0x4988('0x13'));_0x2e3094(_0x10b3f6['result'][_0x4988('0x17')]);}})['catch'](function(_0x48a449){logger[_0x4988('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4c1ec0,_0x48a449);_0x992585(_0x48a449);});});}exports[_0x4988('0x18')]=function(_0x38daa0){var _0x606488=this;return new Promise(function(_0x4fd1da,_0x580bf3){return db['VoiceQueueReport'][_0x4988('0x19')]({'raw':_0x38daa0['options']?_0x38daa0[_0x4988('0x1a')][_0x4988('0x1b')]===undefined?!![]:![]:!![],'where':_0x38daa0[_0x4988('0x1a')]?_0x38daa0[_0x4988('0x1a')][_0x4988('0x1c')]||null:null,'attributes':_0x38daa0[_0x4988('0x1a')]?_0x38daa0[_0x4988('0x1a')][_0x4988('0x1d')]||null:null,'limit':_0x38daa0[_0x4988('0x1a')]?_0x38daa0['options'][_0x4988('0x1e')]||null:null,'include':_0x38daa0['options']?_0x38daa0[_0x4988('0x1a')]['include']?_['map'](_0x38daa0[_0x4988('0x1a')][_0x4988('0x1f')],function(_0x1eacae){return{'model':db[_0x1eacae[_0x4988('0x20')]],'as':_0x1eacae['as'],'attributes':_0x1eacae[_0x4988('0x1d')],'include':_0x1eacae[_0x4988('0x1f')]?_['map'](_0x1eacae[_0x4988('0x1f')],function(_0x4884f5){return{'model':db[_0x4884f5['model']],'as':_0x4884f5['as'],'attributes':_0x4884f5[_0x4988('0x1d')],'include':_0x4884f5[_0x4988('0x1f')]?_[_0x4988('0x21')](_0x4884f5[_0x4988('0x1f')],function(_0x17862c){return{'model':db[_0x17862c[_0x4988('0x20')]],'as':_0x17862c['as'],'attributes':_0x17862c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4988('0x10')](function(_0x4e1576){logger[_0x4988('0x11')](_0x4988('0x18'),_0x38daa0);logger[_0x4988('0x22')]('GetVoiceQueueReport',_0x38daa0,JSON[_0x4988('0x23')](_0x4e1576));_0x4fd1da(_0x4e1576);})['catch'](function(_0x3e9752){logger['error'](_0x4988('0x18'),_0x3e9752['message'],_0x38daa0);_0x580bf3(_0x606488['error'](0x1f4,_0x3e9752[_0x4988('0x17')]));});});};exports[_0x4988('0x24')]=function(_0x566b96){var _0x1d5db8=this;return new Promise(function(_0x3b087d,_0x415f05){return db[_0x4988('0x25')][_0x4988('0x26')](_0x566b96[_0x4988('0x27')],{'raw':_0x566b96[_0x4988('0x1a')]?_0x566b96[_0x4988('0x1a')][_0x4988('0x1b')]===undefined?!![]:![]:!![]})[_0x4988('0x10')](function(_0x3f7519){logger[_0x4988('0x11')](_0x4988('0x24'),_0x566b96);logger[_0x4988('0x22')](_0x4988('0x24'),_0x566b96,JSON[_0x4988('0x23')](_0x3f7519));_0x3b087d(_0x3f7519);})[_0x4988('0x28')](function(_0x212ab6){logger['error'](_0x4988('0x24'),_0x212ab6['message'],_0x566b96);_0x415f05(_0x1d5db8['error'](0x1f4,_0x212ab6[_0x4988('0x17')]));});});};exports[_0x4988('0x29')]=function(_0x6c3dfb){var _0x18b2ef=this;return new Promise(function(_0x35360f,_0x2f56dc){return db[_0x4988('0x25')]['update'](_0x6c3dfb['body'],{'raw':_0x6c3dfb[_0x4988('0x1a')]?_0x6c3dfb[_0x4988('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c3dfb['options']?_0x6c3dfb[_0x4988('0x1a')][_0x4988('0x1c')]||null:null,'attributes':_0x6c3dfb['options']?_0x6c3dfb[_0x4988('0x1a')][_0x4988('0x1d')]||null:null,'limit':_0x6c3dfb[_0x4988('0x1a')]?_0x6c3dfb[_0x4988('0x1a')]['limit']||null:null})[_0x4988('0x10')](function(_0x3fc3e0){logger['info'](_0x4988('0x29'),_0x6c3dfb);logger['debug']('UpdateVoiceQueueReport',_0x6c3dfb,JSON[_0x4988('0x23')](_0x3fc3e0));_0x35360f(_0x3fc3e0);})[_0x4988('0x28')](function(_0x1552dc){logger[_0x4988('0x15')](_0x4988('0x29'),_0x1552dc[_0x4988('0x17')],_0x6c3dfb);_0x2f56dc(_0x18b2ef[_0x4988('0x15')](0x1f4,_0x1552dc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0d57ccf..3e9f4e4 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 _0x4c4e=['length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0xe03522,_0x1fa658){var _0x186a45=function(_0x51c5d6){while(--_0x51c5d6){_0xe03522['push'](_0xe03522['shift']());}};_0x186a45(++_0x1fa658);}(_0x4c4e,0x152));var _0xe4c4=function(_0x7b88e7,_0x4505c8){_0x7b88e7=_0x7b88e7-0x0;var _0x5d8fad=_0x4c4e[_0x7b88e7];return _0x5d8fad;};'use strict';var VoiceQueueReportEvents=require(_0xe4c4('0x0'));var events=['save',_0xe4c4('0x1'),_0xe4c4('0x2')];function createListener(_0xe3f2f,_0x58c8f6){return function(_0x1b6c91){_0x58c8f6[_0xe4c4('0x3')](_0xe3f2f,_0x1b6c91);};}function removeListener(_0x1a4483,_0x4cd652){return function(){VoiceQueueReportEvents[_0xe4c4('0x4')](_0x1a4483,_0x4cd652);};}exports['register']=function(_0x177732){for(var _0x1a12a6=0x0,_0x262b64=events[_0xe4c4('0x5')];_0x1a12a6<_0x262b64;_0x1a12a6++){var _0x22085a=events[_0x1a12a6];var _0x329d29=createListener(_0xe4c4('0x6')+_0x22085a,_0x177732);VoiceQueueReportEvents['on'](_0x22085a,_0x329d29);}}; \ No newline at end of file +var _0x96f1=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x4a208f,_0x565d7f){var _0xeb0072=function(_0x5f1a72){while(--_0x5f1a72){_0x4a208f['push'](_0x4a208f['shift']());}};_0xeb0072(++_0x565d7f);}(_0x96f1,0x19c));var _0x196f=function(_0x1d173c,_0x45b9b7){_0x1d173c=_0x1d173c-0x0;var _0x33a0a1=_0x96f1[_0x1d173c];return _0x33a0a1;};'use strict';var VoiceQueueReportEvents=require(_0x196f('0x0'));var events=[_0x196f('0x1'),_0x196f('0x2'),_0x196f('0x3')];function createListener(_0x227254,_0x219e87){return function(_0xe61e26){_0x219e87[_0x196f('0x4')](_0x227254,_0xe61e26);};}function removeListener(_0x5b8eb5,_0x56fc61){return function(){VoiceQueueReportEvents[_0x196f('0x5')](_0x5b8eb5,_0x56fc61);};}exports[_0x196f('0x6')]=function(_0x267906){for(var _0x1f401c=0x0,_0x17f603=events['length'];_0x1f401c<_0x17f603;_0x1f401c++){var _0x427333=events[_0x1f401c];var _0x425e5c=createListener(_0x196f('0x7')+_0x427333,_0x267906);VoiceQueueReportEvents['on'](_0x427333,_0x425e5c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b391c24..cc00e71 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 _0xaa0b=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','show','put','/:id','destroy'];(function(_0x14068f,_0x3551c3){var _0xe2ba9c=function(_0x334f83){while(--_0x334f83){_0x14068f['push'](_0x14068f['shift']());}};_0xe2ba9c(++_0x3551c3);}(_0xaa0b,0x1b1));var _0xbaa0=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xaa0b[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require(_0xbaa0('0x0'));var util=require(_0xbaa0('0x1'));var path=require('path');var timeout=require(_0xbaa0('0x2'));var express=require(_0xbaa0('0x3'));var router=express[_0xbaa0('0x4')]();var fs_extra=require(_0xbaa0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbaa0('0x6'));var config=require(_0xbaa0('0x7'));var controller=require(_0xbaa0('0x8'));router[_0xbaa0('0x9')]('/',auth[_0xbaa0('0xa')](),controller['index']);router[_0xbaa0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbaa0('0xb')]);router['post']('/',auth[_0xbaa0('0xa')](),controller['create']);router[_0xbaa0('0xc')](_0xbaa0('0xd'),auth[_0xbaa0('0xa')](),controller['update']);router['delete']('/:id',auth[_0xbaa0('0xa')](),controller[_0xbaa0('0xe')]);module[_0xbaa0('0xf')]=router; \ No newline at end of file +var _0x5119=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','show','post','create','put','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2547f7,_0x19d480){var _0x1bc01e=function(_0x15aff3){while(--_0x15aff3){_0x2547f7['push'](_0x2547f7['shift']());}};_0x1bc01e(++_0x19d480);}(_0x5119,0xc0));var _0x9511=function(_0x58ae9f,_0xcaa7d7){_0x58ae9f=_0x58ae9f-0x0;var _0x4c966d=_0x5119[_0x58ae9f];return _0x4c966d;};'use strict';var multer=require(_0x9511('0x0'));var util=require('util');var path=require(_0x9511('0x1'));var timeout=require(_0x9511('0x2'));var express=require(_0x9511('0x3'));var router=express[_0x9511('0x4')]();var fs_extra=require(_0x9511('0x5'));var auth=require(_0x9511('0x6'));var interaction=require(_0x9511('0x7'));var config=require(_0x9511('0x8'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9511('0x9')]);router['get']('/:id',auth[_0x9511('0xa')](),controller[_0x9511('0xb')]);router[_0x9511('0xc')]('/',auth[_0x9511('0xa')](),controller[_0x9511('0xd')]);router[_0x9511('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9511('0xf')](_0x9511('0x10'),auth[_0x9511('0xa')](),controller['destroy']);module[_0x9511('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 961a016..23a39ef 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 _0x1083=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE','literal'];(function(_0x54cc03,_0x51b67a){var _0x46edd7=function(_0x5383ff){while(--_0x5383ff){_0x54cc03['push'](_0x54cc03['shift']());}};_0x46edd7(++_0x51b67a);}(_0x1083,0x151));var _0x3108=function(_0x1cf72b,_0x2e6a67){_0x1cf72b=_0x1cf72b-0x0;var _0x5d906a=_0x1083[_0x1cf72b];return _0x5d906a;};'use strict';var Sequelize=require(_0x3108('0x0'));var moment=require(_0x3108('0x1'));module[_0x3108('0x2')]={'time':{'type':Sequelize[_0x3108('0x3')]},'callid':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3108('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3108('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x3108('0x5')](_0x3108('0x6'))}}; \ No newline at end of file +var _0x9b31=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x9b31,0x1d2));var _0x19b3=function(_0x3bcc1e,_0x427914){_0x3bcc1e=_0x3bcc1e-0x0;var _0x126b10=_0x9b31[_0x3bcc1e];return _0x126b10;};'use strict';var Sequelize=require(_0x19b3('0x0'));var moment=require(_0x19b3('0x1'));module[_0x19b3('0x2')]={'time':{'type':Sequelize[_0x19b3('0x3')]},'callid':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x19b3('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x19b3('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x19b3('0x5')](_0x19b3('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 76a3476..e9e6384 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 _0x9a44=['sendStatus','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','then'];(function(_0x193c48,_0x37c5c9){var _0x4da99a=function(_0x115344){while(--_0x115344){_0x193c48['push'](_0x193c48['shift']());}};_0x4da99a(++_0x37c5c9);}(_0x9a44,0x156));var _0x49a4=function(_0x4a7491,_0x3d1408){_0x4a7491=_0x4a7491-0x0;var _0x15880f=_0x9a44[_0x4a7491];return _0x15880f;};'use strict';var emlformat=require(_0x49a4('0x0'));var rimraf=require(_0x49a4('0x1'));var zipdir=require(_0x49a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49a4('0x3'));var moment=require(_0x49a4('0x4'));var BPromise=require(_0x49a4('0x5'));var Mustache=require(_0x49a4('0x6'));var util=require(_0x49a4('0x7'));var path=require(_0x49a4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49a4('0x9'));var _=require(_0x49a4('0xa'));var squel=require(_0x49a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x49a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x49a4('0xd'));var querystring=require(_0x49a4('0xe'));var Papa=require(_0x49a4('0xf'));var Redis=require('ioredis');var authService=require(_0x49a4('0x10'));var qs=require(_0x49a4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49a4('0x12'));var logger=require(_0x49a4('0x13'))('api');var utils=require(_0x49a4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x49a4('0x15'))['db'];function respondWithStatusCode(_0x3a4f45,_0x4ca87b){_0x4ca87b=_0x4ca87b||0xcc;return function(_0x3ea85e){if(_0x3ea85e){return _0x3a4f45['sendStatus'](_0x4ca87b);}return _0x3a4f45[_0x49a4('0x16')](_0x4ca87b)[_0x49a4('0x17')]();};}function respondWithResult(_0x5d534e,_0x3459b2){_0x3459b2=_0x3459b2||0xc8;return function(_0x2e7360){if(_0x2e7360){return _0x5d534e[_0x49a4('0x16')](_0x3459b2)[_0x49a4('0x18')](_0x2e7360);}};}function respondWithFilteredResult(_0x30dfab,_0x13e84b){return function(_0x4d8c96){if(_0x4d8c96){var _0x387257=typeof _0x13e84b['offset']===_0x49a4('0x19')&&typeof _0x13e84b[_0x49a4('0x1a')]===_0x49a4('0x19');var _0x3aeca4=_0x4d8c96['count'];var _0x3adf43=_0x387257?0x0:_0x13e84b['offset'];var _0x98c2fa=_0x387257?_0x4d8c96['count']:_0x13e84b[_0x49a4('0x1b')]+_0x13e84b['limit'];var _0x32aa72;if(_0x98c2fa>=_0x3aeca4){_0x98c2fa=_0x3aeca4;_0x32aa72=0xc8;}else{_0x32aa72=0xce;}_0x30dfab['status'](_0x32aa72);return _0x30dfab[_0x49a4('0x1c')](_0x49a4('0x1d'),_0x3adf43+'-'+_0x98c2fa+'/'+_0x3aeca4)[_0x49a4('0x18')](_0x4d8c96);}return null;};}function patchUpdates(_0x449c73){return function(_0x2f9bc4){try{jsonpatch[_0x49a4('0x1e')](_0x2f9bc4,_0x449c73,!![]);}catch(_0x2dace1){return BPromise['reject'](_0x2dace1);}return _0x2f9bc4[_0x49a4('0x1f')]();};}function saveUpdates(_0x171b5e,_0x6083f2){return function(_0x4134f7){if(_0x4134f7){return _0x4134f7['update'](_0x171b5e)[_0x49a4('0x20')](function(_0x2a823c){return _0x2a823c;});}return null;};}function removeEntity(_0x3e7c41,_0x34b38d){return function(_0x18ff71){if(_0x18ff71){return _0x18ff71['destroy']()['then'](function(){_0x3e7c41[_0x49a4('0x16')](0xcc)[_0x49a4('0x17')]();});}};}function handleEntityNotFound(_0x18d91c,_0x2c8b17){return function(_0x5b96e0){if(!_0x5b96e0){_0x18d91c[_0x49a4('0x21')](0x194);}return _0x5b96e0;};}function handleError(_0x1bf488,_0xeb989b){_0xeb989b=_0xeb989b||0x1f4;return function(_0x4a2020){logger[_0x49a4('0x22')](_0x4a2020['stack']);if(_0x4a2020[_0x49a4('0x23')]){delete _0x4a2020[_0x49a4('0x23')];}_0x1bf488[_0x49a4('0x16')](_0xeb989b)[_0x49a4('0x24')](_0x4a2020);};}exports[_0x49a4('0x25')]=function(_0x5f9cfb,_0x20cd74){var _0x45756b={},_0x5f7cb9={},_0x39d8b0={'count':0x0,'rows':[]};var _0x244556=_[_0x49a4('0x26')](db[_0x49a4('0x27')][_0x49a4('0x28')],function(_0x1717bd){return{'name':_0x1717bd[_0x49a4('0x29')],'type':_0x1717bd[_0x49a4('0x2a')][_0x49a4('0x2b')]};});_0x5f7cb9['model']=_['map'](_0x244556,_0x49a4('0x23'));_0x5f7cb9[_0x49a4('0x2c')]=_[_0x49a4('0x2d')](_0x5f9cfb[_0x49a4('0x2c')]);_0x5f7cb9['filters']=_[_0x49a4('0x2e')](_0x5f7cb9['model'],_0x5f7cb9[_0x49a4('0x2c')]);_0x45756b[_0x49a4('0x2f')]=_[_0x49a4('0x2e')](_0x5f7cb9[_0x49a4('0x30')],qs[_0x49a4('0x31')](_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x31')]));_0x45756b[_0x49a4('0x2f')]=_0x45756b[_0x49a4('0x2f')][_0x49a4('0x32')]?_0x45756b[_0x49a4('0x2f')]:_0x5f7cb9[_0x49a4('0x30')];if(!_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x33')](_0x49a4('0x34'))){_0x45756b[_0x49a4('0x1a')]=qs[_0x49a4('0x1a')](_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x1a')]);_0x45756b['offset']=qs[_0x49a4('0x1b')](_0x5f9cfb['query'][_0x49a4('0x1b')]);}_0x45756b[_0x49a4('0x35')]=qs[_0x49a4('0x36')](_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x36')]);_0x45756b[_0x49a4('0x37')]=qs['filters'](_[_0x49a4('0x38')](_0x5f9cfb[_0x49a4('0x2c')],_0x5f7cb9[_0x49a4('0x39')]),_0x244556);if(_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x3a')]){_0x45756b[_0x49a4('0x37')]=_[_0x49a4('0x3b')](_0x45756b[_0x49a4('0x37')],{'$or':_[_0x49a4('0x26')](_0x244556,function(_0x3f5a20){if(_0x3f5a20[_0x49a4('0x2a')]!==_0x49a4('0x3c')){var _0x1e8a5e={};_0x1e8a5e[_0x3f5a20[_0x49a4('0x23')]]={'$like':'%'+_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x3a')]+'%'};return _0x1e8a5e;}})});}_0x45756b=_[_0x49a4('0x3b')]({},_0x45756b,_0x5f9cfb[_0x49a4('0x3d')]);var _0x1bbcce={'where':_0x45756b['where']};return db[_0x49a4('0x27')]['count'](_0x1bbcce)[_0x49a4('0x20')](function(_0x3098fe){_0x39d8b0[_0x49a4('0x3e')]=_0x3098fe;if(_0x5f9cfb[_0x49a4('0x2c')][_0x49a4('0x3f')]){_0x45756b['include']=[{'all':!![]}];}return db[_0x49a4('0x27')][_0x49a4('0x40')](_0x45756b);})[_0x49a4('0x20')](function(_0x226b96){_0x39d8b0[_0x49a4('0x41')]=_0x226b96;return _0x39d8b0;})[_0x49a4('0x20')](respondWithFilteredResult(_0x20cd74,_0x45756b))[_0x49a4('0x42')](handleError(_0x20cd74,null));};exports[_0x49a4('0x43')]=function(_0xa89340,_0xdff82){var _0x44cec0={'raw':!![],'where':{'id':_0xa89340[_0x49a4('0x44')]['id']}},_0xd9113={};_0xd9113[_0x49a4('0x30')]=_[_0x49a4('0x2d')](db[_0x49a4('0x27')]['rawAttributes']);_0xd9113[_0x49a4('0x2c')]=_[_0x49a4('0x2d')](_0xa89340[_0x49a4('0x2c')]);_0xd9113['filters']=_[_0x49a4('0x2e')](_0xd9113[_0x49a4('0x30')],_0xd9113[_0x49a4('0x2c')]);_0x44cec0[_0x49a4('0x2f')]=_[_0x49a4('0x2e')](_0xd9113['model'],qs['fields'](_0xa89340[_0x49a4('0x2c')][_0x49a4('0x31')]));_0x44cec0[_0x49a4('0x2f')]=_0x44cec0[_0x49a4('0x2f')][_0x49a4('0x32')]?_0x44cec0[_0x49a4('0x2f')]:_0xd9113['model'];if(_0xa89340[_0x49a4('0x2c')][_0x49a4('0x3f')]){_0x44cec0[_0x49a4('0x45')]=[{'all':!![]}];}_0x44cec0=_[_0x49a4('0x3b')]({},_0x44cec0,_0xa89340[_0x49a4('0x3d')]);return db[_0x49a4('0x27')][_0x49a4('0x46')](_0x44cec0)['then'](handleEntityNotFound(_0xdff82,null))['then'](respondWithResult(_0xdff82,null))[_0x49a4('0x42')](handleError(_0xdff82,null));};exports[_0x49a4('0x47')]=function(_0x26e58b,_0x1a205c){return db[_0x49a4('0x27')][_0x49a4('0x47')](_0x26e58b[_0x49a4('0x48')],{})[_0x49a4('0x20')](respondWithResult(_0x1a205c,0xc9))[_0x49a4('0x42')](handleError(_0x1a205c,null));};exports[_0x49a4('0x49')]=function(_0x59feb1,_0x3ae04c){if(_0x59feb1[_0x49a4('0x48')]['id']){delete _0x59feb1[_0x49a4('0x48')]['id'];}return db[_0x49a4('0x27')]['find']({'where':{'id':_0x59feb1[_0x49a4('0x44')]['id']}})[_0x49a4('0x20')](handleEntityNotFound(_0x3ae04c,null))[_0x49a4('0x20')](saveUpdates(_0x59feb1[_0x49a4('0x48')],null))[_0x49a4('0x20')](respondWithResult(_0x3ae04c,null))[_0x49a4('0x42')](handleError(_0x3ae04c,null));};exports[_0x49a4('0x4a')]=function(_0x1a5180,_0x5d47f7){return db['VoiceQueuesLog']['find']({'where':{'id':_0x1a5180[_0x49a4('0x44')]['id']}})[_0x49a4('0x20')](handleEntityNotFound(_0x5d47f7,null))[_0x49a4('0x20')](removeEntity(_0x5d47f7,null))[_0x49a4('0x42')](handleError(_0x5d47f7,null));}; \ No newline at end of file +var _0x4f8c=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f8c,0x1b7));var _0xc4f8=function(_0x396736,_0x10da9b){_0x396736=_0x396736-0x0;var _0x2b0960=_0x4f8c[_0x396736];return _0x2b0960;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4f8('0x0'));var zipdir=require(_0xc4f8('0x1'));var jsonpatch=require(_0xc4f8('0x2'));var rp=require(_0xc4f8('0x3'));var moment=require(_0xc4f8('0x4'));var BPromise=require(_0xc4f8('0x5'));var Mustache=require(_0xc4f8('0x6'));var util=require(_0xc4f8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc4f8('0x8'));var ejs=require(_0xc4f8('0x9'));var fs=require('fs');var fs_extra=require(_0xc4f8('0xa'));var _=require(_0xc4f8('0xb'));var squel=require(_0xc4f8('0xc'));var crypto=require(_0xc4f8('0xd'));var jsforce=require(_0xc4f8('0xe'));var deskjs=require(_0xc4f8('0xf'));var toCsv=require(_0xc4f8('0x8'));var querystring=require('querystring');var Papa=require(_0xc4f8('0x10'));var Redis=require('ioredis');var authService=require(_0xc4f8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc4f8('0x12'));var hardwareService=require(_0xc4f8('0x13'));var logger=require(_0xc4f8('0x14'))(_0xc4f8('0x15'));var utils=require(_0xc4f8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc4f8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226611,_0x160dc0){_0x160dc0=_0x160dc0||0xcc;return function(_0x44a993){if(_0x44a993){return _0x226611[_0xc4f8('0x18')](_0x160dc0);}return _0x226611[_0xc4f8('0x19')](_0x160dc0)[_0xc4f8('0x1a')]();};}function respondWithResult(_0x48e1be,_0x1d0dbe){_0x1d0dbe=_0x1d0dbe||0xc8;return function(_0x3aa69d){if(_0x3aa69d){return _0x48e1be[_0xc4f8('0x19')](_0x1d0dbe)['json'](_0x3aa69d);}};}function respondWithFilteredResult(_0x2e1656,_0x424f2f){return function(_0x48f3c3){if(_0x48f3c3){var _0x226a68=typeof _0x424f2f[_0xc4f8('0x1b')]===_0xc4f8('0x1c')&&typeof _0x424f2f[_0xc4f8('0x1d')]===_0xc4f8('0x1c');var _0x2419c2=_0x48f3c3[_0xc4f8('0x1e')];var _0x28227c=_0x226a68?0x0:_0x424f2f[_0xc4f8('0x1b')];var _0x51b6ef=_0x226a68?_0x48f3c3['count']:_0x424f2f[_0xc4f8('0x1b')]+_0x424f2f[_0xc4f8('0x1d')];var _0x134985;if(_0x51b6ef>=_0x2419c2){_0x51b6ef=_0x2419c2;_0x134985=0xc8;}else{_0x134985=0xce;}_0x2e1656[_0xc4f8('0x19')](_0x134985);return _0x2e1656[_0xc4f8('0x1f')](_0xc4f8('0x20'),_0x28227c+'-'+_0x51b6ef+'/'+_0x2419c2)[_0xc4f8('0x21')](_0x48f3c3);}return null;};}function patchUpdates(_0x3e2aef){return function(_0x4e07ff){try{jsonpatch[_0xc4f8('0x22')](_0x4e07ff,_0x3e2aef,!![]);}catch(_0x251ebf){return BPromise[_0xc4f8('0x23')](_0x251ebf);}return _0x4e07ff['save']();};}function saveUpdates(_0xe45b84,_0x31b147){return function(_0x53a4a9){if(_0x53a4a9){return _0x53a4a9[_0xc4f8('0x24')](_0xe45b84)['then'](function(_0x19c5e4){return _0x19c5e4;});}return null;};}function removeEntity(_0x21b06a,_0x22b4bb){return function(_0x56d72b){if(_0x56d72b){return _0x56d72b[_0xc4f8('0x25')]()[_0xc4f8('0x26')](function(){_0x21b06a[_0xc4f8('0x19')](0xcc)[_0xc4f8('0x1a')]();});}};}function handleEntityNotFound(_0x3b071d,_0x4ca0c2){return function(_0x3ada2e){if(!_0x3ada2e){_0x3b071d['sendStatus'](0x194);}return _0x3ada2e;};}function handleError(_0x3fb92b,_0x52754d){_0x52754d=_0x52754d||0x1f4;return function(_0x4e3356){logger[_0xc4f8('0x27')](_0x4e3356[_0xc4f8('0x28')]);if(_0x4e3356['name']){delete _0x4e3356[_0xc4f8('0x29')];}_0x3fb92b[_0xc4f8('0x19')](_0x52754d)[_0xc4f8('0x2a')](_0x4e3356);};}exports[_0xc4f8('0x2b')]=function(_0x199fee,_0x269db1){var _0x234c30={},_0x313445={},_0x3a9a43={'count':0x0,'rows':[]};var _0x260f80=_['map'](db[_0xc4f8('0x2c')][_0xc4f8('0x2d')],function(_0x3f9ad5){return{'name':_0x3f9ad5[_0xc4f8('0x2e')],'type':_0x3f9ad5['type']['key']};});_0x313445[_0xc4f8('0x2f')]=_[_0xc4f8('0x30')](_0x260f80,_0xc4f8('0x29'));_0x313445[_0xc4f8('0x31')]=_[_0xc4f8('0x32')](_0x199fee[_0xc4f8('0x31')]);_0x313445[_0xc4f8('0x33')]=_['intersection'](_0x313445[_0xc4f8('0x2f')],_0x313445[_0xc4f8('0x31')]);_0x234c30[_0xc4f8('0x34')]=_[_0xc4f8('0x35')](_0x313445[_0xc4f8('0x2f')],qs[_0xc4f8('0x36')](_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x36')]));_0x234c30[_0xc4f8('0x34')]=_0x234c30[_0xc4f8('0x34')][_0xc4f8('0x37')]?_0x234c30[_0xc4f8('0x34')]:_0x313445[_0xc4f8('0x2f')];if(!_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x38')](_0xc4f8('0x39'))){_0x234c30['limit']=qs['limit'](_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x1d')]);_0x234c30['offset']=qs[_0xc4f8('0x1b')](_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x1b')]);}_0x234c30['order']=qs[_0xc4f8('0x3a')](_0x199fee[_0xc4f8('0x31')]['sort']);_0x234c30[_0xc4f8('0x3b')]=qs['filters'](_['pick'](_0x199fee['query'],_0x313445[_0xc4f8('0x33')]),_0x260f80);if(_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x3c')]){_0x234c30[_0xc4f8('0x3b')]=_[_0xc4f8('0x3d')](_0x234c30['where'],{'$or':_['map'](_0x260f80,function(_0x170714){if(_0x170714[_0xc4f8('0x3e')]!==_0xc4f8('0x3f')){var _0x41ff7e={};_0x41ff7e[_0x170714[_0xc4f8('0x29')]]={'$like':'%'+_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x3c')]+'%'};return _0x41ff7e;}})});}_0x234c30=_['merge']({},_0x234c30,_0x199fee[_0xc4f8('0x40')]);var _0x3ca4b1={'where':_0x234c30[_0xc4f8('0x3b')]};return db[_0xc4f8('0x2c')][_0xc4f8('0x1e')](_0x3ca4b1)['then'](function(_0x2dd006){_0x3a9a43[_0xc4f8('0x1e')]=_0x2dd006;if(_0x199fee[_0xc4f8('0x31')][_0xc4f8('0x41')]){_0x234c30[_0xc4f8('0x42')]=[{'all':!![]}];}return db[_0xc4f8('0x2c')][_0xc4f8('0x43')](_0x234c30);})[_0xc4f8('0x26')](function(_0x1a7631){_0x3a9a43[_0xc4f8('0x44')]=_0x1a7631;return _0x3a9a43;})['then'](respondWithFilteredResult(_0x269db1,_0x234c30))[_0xc4f8('0x45')](handleError(_0x269db1,null));};exports[_0xc4f8('0x46')]=function(_0x1d4d5d,_0x4c7be3){var _0x10a03e={'raw':!![],'where':{'id':_0x1d4d5d[_0xc4f8('0x47')]['id']}},_0x1e5d1d={};_0x1e5d1d['model']=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x1e5d1d[_0xc4f8('0x31')]=_[_0xc4f8('0x32')](_0x1d4d5d[_0xc4f8('0x31')]);_0x1e5d1d[_0xc4f8('0x33')]=_['intersection'](_0x1e5d1d['model'],_0x1e5d1d[_0xc4f8('0x31')]);_0x10a03e[_0xc4f8('0x34')]=_[_0xc4f8('0x35')](_0x1e5d1d[_0xc4f8('0x2f')],qs['fields'](_0x1d4d5d['query'][_0xc4f8('0x36')]));_0x10a03e[_0xc4f8('0x34')]=_0x10a03e[_0xc4f8('0x34')][_0xc4f8('0x37')]?_0x10a03e['attributes']:_0x1e5d1d[_0xc4f8('0x2f')];if(_0x1d4d5d[_0xc4f8('0x31')]['includeAll']){_0x10a03e[_0xc4f8('0x42')]=[{'all':!![]}];}_0x10a03e=_[_0xc4f8('0x3d')]({},_0x10a03e,_0x1d4d5d[_0xc4f8('0x40')]);return db[_0xc4f8('0x2c')][_0xc4f8('0x48')](_0x10a03e)[_0xc4f8('0x26')](handleEntityNotFound(_0x4c7be3,null))[_0xc4f8('0x26')](respondWithResult(_0x4c7be3,null))[_0xc4f8('0x45')](handleError(_0x4c7be3,null));};exports[_0xc4f8('0x49')]=function(_0x17e68d,_0x10c51c){return db['VoiceQueuesLog'][_0xc4f8('0x49')](_0x17e68d['body'],{})['then'](respondWithResult(_0x10c51c,0xc9))[_0xc4f8('0x45')](handleError(_0x10c51c,null));};exports[_0xc4f8('0x24')]=function(_0x52e471,_0xe41aa2){if(_0x52e471[_0xc4f8('0x4a')]['id']){delete _0x52e471[_0xc4f8('0x4a')]['id'];}return db['VoiceQueuesLog'][_0xc4f8('0x48')]({'where':{'id':_0x52e471['params']['id']}})['then'](handleEntityNotFound(_0xe41aa2,null))[_0xc4f8('0x26')](saveUpdates(_0x52e471['body'],null))[_0xc4f8('0x26')](respondWithResult(_0xe41aa2,null))[_0xc4f8('0x45')](handleError(_0xe41aa2,null));};exports[_0xc4f8('0x25')]=function(_0x8a3947,_0x2b89cc){return db[_0xc4f8('0x2c')][_0xc4f8('0x48')]({'where':{'id':_0x8a3947['params']['id']}})[_0xc4f8('0x26')](handleEntityNotFound(_0x2b89cc,null))[_0xc4f8('0x26')](removeEntity(_0x2b89cc,null))[_0xc4f8('0x45')](handleError(_0x2b89cc,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7025d4a..7e33589 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 _0x2297=['define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a3d50,_0x516d5f){var _0x41861b=function(_0x1c3cfe){while(--_0x1c3cfe){_0x2a3d50['push'](_0x2a3d50['shift']());}};_0x41861b(++_0x516d5f);}(_0x2297,0x101));var _0x7229=function(_0x25337a,_0x389454){_0x25337a=_0x25337a-0x0;var _0xe3fbd6=_0x2297[_0x25337a];return _0xe3fbd6;};'use strict';var _=require(_0x7229('0x0'));var util=require('util');var logger=require(_0x7229('0x1'))(_0x7229('0x2'));var moment=require(_0x7229('0x3'));var BPromise=require(_0x7229('0x4'));var rp=require(_0x7229('0x5'));var fs=require('fs');var path=require(_0x7229('0x6'));var rimraf=require(_0x7229('0x7'));var config=require(_0x7229('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x40d99c,_0x2c0cc5){return _0x40d99c[_0x7229('0x9')](_0x7229('0xa'),attributes,{'tableName':_0x7229('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x7229('0xc'),_0x7229('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9063=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','event_dtm','event','dtm','lodash','util'];(function(_0x2192ae,_0x197b1e){var _0x5d8404=function(_0x11e731){while(--_0x11e731){_0x2192ae['push'](_0x2192ae['shift']());}};_0x5d8404(++_0x197b1e);}(_0x9063,0x1a2));var _0x3906=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9063[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var logger=require(_0x3906('0x2'))(_0x3906('0x3'));var moment=require(_0x3906('0x4'));var BPromise=require(_0x3906('0x5'));var rp=require(_0x3906('0x6'));var fs=require('fs');var path=require(_0x3906('0x7'));var rimraf=require('rimraf');var config=require(_0x3906('0x8'));var attributes=require(_0x3906('0x9'));module[_0x3906('0xa')]=function(_0x17c286,_0x79d5ae){return _0x17c286['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x3906('0xb'),'fields':[_0x3906('0xc'),_0x3906('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 83c20aa..35ef83c 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 _0x5ce6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x5ce6,0xee));var _0x65ce=function(_0x5224d9,_0x3431c6){_0x5224d9=_0x5224d9-0x0;var _0x421ea3=_0x5ce6[_0x5224d9];return _0x421ea3;};'use strict';var _=require('lodash');var util=require(_0x65ce('0x0'));var moment=require(_0x65ce('0x1'));var BPromise=require(_0x65ce('0x2'));var rs=require(_0x65ce('0x3'));var fs=require('fs');var Redis=require(_0x65ce('0x4'));var db=require(_0x65ce('0x5'))['db'];var utils=require(_0x65ce('0x6'));var logger=require('../../config/logger')(_0x65ce('0x7'));var config=require(_0x65ce('0x8'));var jayson=require(_0x65ce('0x9'));var client=jayson[_0x65ce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6018,_0x1a3021,_0x4b6ab2){return new BPromise(function(_0x49a56b,_0xc99619){return client['request'](_0x1a6018,_0x4b6ab2)[_0x65ce('0xb')](function(_0x40518d){logger['info'](_0x65ce('0xc'),_0x1a3021,'request\x20sent');logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1a3021,_0x65ce('0xd'),JSON[_0x65ce('0xe')](_0x40518d));if(_0x40518d[_0x65ce('0xf')]){if(_0x40518d[_0x65ce('0xf')]['code']===0x1f4){logger[_0x65ce('0xf')](_0x65ce('0xc'),_0x1a3021,_0x40518d[_0x65ce('0xf')][_0x65ce('0x10')]);return _0xc99619(_0x40518d['error'][_0x65ce('0x10')]);}logger[_0x65ce('0xf')](_0x65ce('0xc'),_0x1a3021,_0x40518d['error'][_0x65ce('0x10')]);return _0x49a56b(_0x40518d[_0x65ce('0xf')]['message']);}else{logger[_0x65ce('0x11')](_0x65ce('0xc'),_0x1a3021,_0x65ce('0xd'));_0x49a56b(_0x40518d[_0x65ce('0x12')]['message']);}})[_0x65ce('0x13')](function(_0xd5205b){logger[_0x65ce('0xf')](_0x65ce('0xc'),_0x1a3021,_0xd5205b);_0xc99619(_0xd5205b);});});} \ No newline at end of file +var _0x26bc=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x268a87,_0x3b8736){var _0xa8d093=function(_0x5f0fe9){while(--_0x5f0fe9){_0x268a87['push'](_0x268a87['shift']());}};_0xa8d093(++_0x3b8736);}(_0x26bc,0x162));var _0xc26b=function(_0x49f281,_0x2f106d){_0x49f281=_0x49f281-0x0;var _0x3318da=_0x26bc[_0x49f281];return _0x3318da;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7906b14..a44ae7d 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 _0x072f=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','show','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xda9295,_0x4850b4){var _0xd73c7f=function(_0xf192dd){while(--_0xf192dd){_0xda9295['push'](_0xda9295['shift']());}};_0xd73c7f(++_0x4850b4);}(_0x072f,0x164));var _0xf072=function(_0x59d135,_0x261a80){_0x59d135=_0x59d135-0x0;var _0x59d946=_0x072f[_0x59d135];return _0x59d946;};'use strict';var multer=require(_0xf072('0x0'));var util=require(_0xf072('0x1'));var path=require(_0xf072('0x2'));var timeout=require(_0xf072('0x3'));var express=require(_0xf072('0x4'));var router=express[_0xf072('0x5')]();var fs_extra=require(_0xf072('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf072('0x7'));var config=require(_0xf072('0x8'));var controller=require(_0xf072('0x9'));router[_0xf072('0xa')]('/',auth[_0xf072('0xb')](),controller['index']);router[_0xf072('0xa')]('/describe',auth[_0xf072('0xb')](),controller[_0xf072('0xc')]);router[_0xf072('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf072('0xd')]);router[_0xf072('0xa')]('/:id/download',auth[_0xf072('0xb')](),controller[_0xf072('0xe')]);router[_0xf072('0xa')](_0xf072('0xf'),controller[_0xf072('0x10')]);router[_0xf072('0xa')]('/:id/transcribe',auth[_0xf072('0xb')](),controller[_0xf072('0x11')]);router[_0xf072('0x12')]('/',auth['isAuthenticated'](),controller[_0xf072('0x13')]);router[_0xf072('0x12')](_0xf072('0x14'),auth[_0xf072('0xb')](),controller[_0xf072('0x15')]);router[_0xf072('0x16')](_0xf072('0x17'),auth[_0xf072('0xb')](),controller[_0xf072('0x18')]);router['delete'](_0xf072('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0xf072('0x19')]=router; \ No newline at end of file +var _0x482d=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5db32d,_0x2849c6){var _0x2d4d9d=function(_0x50ff35){while(--_0x50ff35){_0x5db32d['push'](_0x5db32d['shift']());}};_0x2d4d9d(++_0x2849c6);}(_0x482d,0x1b4));var _0xd482=function(_0x416aea,_0x542d9c){_0x416aea=_0x416aea-0x0;var _0x2400b9=_0x482d[_0x416aea];return _0x2400b9;};'use strict';var multer=require('multer');var util=require(_0xd482('0x0'));var path=require(_0xd482('0x1'));var timeout=require('connect-timeout');var express=require(_0xd482('0x2'));var router=express[_0xd482('0x3')]();var fs_extra=require(_0xd482('0x4'));var auth=require(_0xd482('0x5'));var interaction=require(_0xd482('0x6'));var config=require(_0xd482('0x7'));var controller=require(_0xd482('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd482('0x9')]);router[_0xd482('0xa')](_0xd482('0xb'),auth[_0xd482('0xc')](),controller['describe']);router[_0xd482('0xa')](_0xd482('0xd'),auth[_0xd482('0xc')](),controller[_0xd482('0xe')]);router[_0xd482('0xa')](_0xd482('0xf'),auth['isAuthenticated'](),controller[_0xd482('0x10')]);router['get'](_0xd482('0x11'),controller['downloads']);router[_0xd482('0xa')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xd482('0x12')]);router[_0xd482('0x13')]('/',auth[_0xd482('0xc')](),controller[_0xd482('0x14')]);router[_0xd482('0x13')](_0xd482('0x15'),auth[_0xd482('0xc')](),controller['runTranscribe']);router[_0xd482('0x16')](_0xd482('0xd'),auth['isAuthenticated'](),controller[_0xd482('0x17')]);router[_0xd482('0x18')]('/:id',auth[_0xd482('0xc')](),controller[_0xd482('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 03f6092..f0799a9 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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 ec5f4e2..6db8242 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 _0x6545=['transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','reject','save','then','sendStatus','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','update','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','push','$and','existsSync','recording','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Bucket','Location','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x6545,0x1dc));var _0x5654=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6545[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5654('0x0'));var rimraf=require(_0x5654('0x1'));var zipdir=require(_0x5654('0x2'));var jsonpatch=require(_0x5654('0x3'));var rp=require(_0x5654('0x4'));var moment=require('moment');var BPromise=require(_0x5654('0x5'));var Mustache=require(_0x5654('0x6'));var util=require(_0x5654('0x7'));var path=require('path');var sox=require(_0x5654('0x8'));var csv=require(_0x5654('0x9'));var ejs=require(_0x5654('0xa'));var fs=require('fs');var fs_extra=require(_0x5654('0xb'));var _=require('lodash');var squel=require(_0x5654('0xc'));var crypto=require(_0x5654('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5654('0xe'));var toCsv=require(_0x5654('0x9'));var querystring=require(_0x5654('0xf'));var Papa=require(_0x5654('0x10'));var AWS=require(_0x5654('0x11'));var uuidv4=require(_0x5654('0x12'));var Redis=require(_0x5654('0x13'));var authService=require(_0x5654('0x14'));var qs=require(_0x5654('0x15'));var as=require(_0x5654('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5654('0x17'));var utils=require(_0x5654('0x18'));var config=require(_0x5654('0x19'));var licenseUtil=require(_0x5654('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293dda,_0x26df5e){_0x26df5e=_0x26df5e||0xcc;return function(_0x17a0c2){if(_0x17a0c2){return _0x293dda['sendStatus'](_0x26df5e);}return _0x293dda[_0x5654('0x1b')](_0x26df5e)[_0x5654('0x1c')]();};}function respondWithResult(_0x1bca6d,_0x5ef6bc){_0x5ef6bc=_0x5ef6bc||0xc8;return function(_0x486067){if(_0x486067){return _0x1bca6d['status'](_0x5ef6bc)[_0x5654('0x1d')](_0x486067);}};}function respondWithFilteredResult(_0xf3b741,_0x2ec36b){return function(_0x1a7a35){if(_0x1a7a35){var _0x11aa37=typeof _0x2ec36b[_0x5654('0x1e')]===_0x5654('0x1f')&&typeof _0x2ec36b['limit']==='undefined';var _0x5d536b=_0x1a7a35['count'];var _0x48e213=_0x11aa37?0x0:_0x2ec36b[_0x5654('0x1e')];var _0x299b71=_0x11aa37?_0x1a7a35[_0x5654('0x20')]:_0x2ec36b[_0x5654('0x1e')]+_0x2ec36b[_0x5654('0x21')];var _0x4b5133;if(_0x299b71>=_0x5d536b){_0x299b71=_0x5d536b;_0x4b5133=0xc8;}else{_0x4b5133=0xce;}_0xf3b741[_0x5654('0x1b')](_0x4b5133);return _0xf3b741[_0x5654('0x22')]('Content-Range',_0x48e213+'-'+_0x299b71+'/'+_0x5d536b)['json'](_0x1a7a35);}return null;};}function patchUpdates(_0x535054){return function(_0xd3b93d){try{jsonpatch['apply'](_0xd3b93d,_0x535054,!![]);}catch(_0x8c673a){return BPromise[_0x5654('0x23')](_0x8c673a);}return _0xd3b93d[_0x5654('0x24')]();};}function saveUpdates(_0x1f9d92,_0x59fc9d){return function(_0x22de86){if(_0x22de86){return _0x22de86['update'](_0x1f9d92)[_0x5654('0x25')](function(_0x16b2b9){return _0x16b2b9;});}return null;};}function removeEntity(_0x88957f,_0x5cc5a6){return function(_0x1eb7a6){if(_0x1eb7a6){return _0x1eb7a6['destroy']()[_0x5654('0x25')](function(){_0x88957f['status'](0xcc)[_0x5654('0x1c')]();});}};}function handleEntityNotFound(_0x20281b,_0x3c5631){return function(_0x1fa342){if(!_0x1fa342){_0x20281b[_0x5654('0x26')](0x194);}return _0x1fa342;};}function handleError(_0x553e24,_0x1eada9){_0x1eada9=_0x1eada9||0x1f4;return function(_0x44c159){logger[_0x5654('0x27')](_0x44c159[_0x5654('0x28')]);if(_0x44c159[_0x5654('0x29')]){delete _0x44c159[_0x5654('0x29')];}_0x553e24[_0x5654('0x1b')](_0x1eada9)[_0x5654('0x2a')](_0x44c159);};}exports[_0x5654('0x2b')]=function(_0x45fb30,_0x2e3813){var _0x1c0be3={},_0x359494={},_0x1a6d6a={'count':0x0,'rows':[]};var _0x470bb0=_['map'](db[_0x5654('0x2c')][_0x5654('0x2d')],function(_0x5592cc){return{'name':_0x5592cc[_0x5654('0x2e')],'type':_0x5592cc[_0x5654('0x2f')][_0x5654('0x30')]};});_0x359494[_0x5654('0x31')]=_[_0x5654('0x32')](_[_0x5654('0x33')](_0x470bb0,_0x5654('0x29')),['format']);_0x359494[_0x5654('0x34')]=_[_0x5654('0x35')](_0x45fb30['query']);_0x359494[_0x5654('0x36')]=_[_0x5654('0x37')](_0x359494['model'],_0x359494[_0x5654('0x34')]);_0x1c0be3[_0x5654('0x38')]=_[_0x5654('0x37')](_0x359494[_0x5654('0x31')],qs[_0x5654('0x39')](_0x45fb30['query']['fields']));_0x1c0be3['attributes']=_0x1c0be3[_0x5654('0x38')][_0x5654('0x3a')]?_0x1c0be3[_0x5654('0x38')]:_0x359494[_0x5654('0x31')];if(!_0x45fb30[_0x5654('0x34')][_0x5654('0x3b')](_0x5654('0x3c'))){_0x1c0be3[_0x5654('0x21')]=qs[_0x5654('0x21')](_0x45fb30[_0x5654('0x34')]['limit']);_0x1c0be3[_0x5654('0x1e')]=qs[_0x5654('0x1e')](_0x45fb30[_0x5654('0x34')]['offset']);}_0x1c0be3['order']=qs[_0x5654('0x3d')](_0x45fb30[_0x5654('0x34')][_0x5654('0x3d')]);_0x1c0be3['where']=qs[_0x5654('0x36')](_[_0x5654('0x3e')](_0x45fb30[_0x5654('0x34')],_0x359494[_0x5654('0x36')]),_0x470bb0);if(_0x45fb30[_0x5654('0x34')][_0x5654('0x3f')]){_0x1c0be3[_0x5654('0x40')]=_[_0x5654('0x41')](_0x1c0be3[_0x5654('0x40')],{'$or':_[_0x5654('0x33')](_0x470bb0,function(_0x228233){if(_0x228233[_0x5654('0x2f')]!==_0x5654('0x42')){var _0x4e61eb={};_0x4e61eb[_0x228233['name']]={'$like':'%'+_0x45fb30['query']['filter']+'%'};return _0x4e61eb;}})});}_0x1c0be3=_[_0x5654('0x41')]({},_0x1c0be3,_0x45fb30[_0x5654('0x43')]);var _0x1784b8={'where':_0x1c0be3['where']};return db[_0x5654('0x2c')][_0x5654('0x20')](_0x1784b8)['then'](function(_0x3d1595){_0x1a6d6a[_0x5654('0x20')]=_0x3d1595;if(_0x45fb30[_0x5654('0x34')]['includeAll']){_0x1c0be3['include']=[{'all':!![]}];}return db[_0x5654('0x2c')][_0x5654('0x44')](_0x1c0be3);})[_0x5654('0x25')](function(_0x58c6c2){_0x1a6d6a[_0x5654('0x45')]=_0x58c6c2;return _0x1a6d6a;})[_0x5654('0x25')](respondWithFilteredResult(_0x2e3813,_0x1c0be3))[_0x5654('0x46')](handleError(_0x2e3813,null));};exports[_0x5654('0x47')]=function(_0xc1dd69,_0x664cc9){var _0x17381f={'raw':![],'where':{'id':_0xc1dd69[_0x5654('0x48')]['id']}},_0x49005c={};_0x49005c[_0x5654('0x31')]=_[_0x5654('0x35')](db[_0x5654('0x2c')][_0x5654('0x2d')]);_0x49005c[_0x5654('0x34')]=_[_0x5654('0x35')](_0xc1dd69[_0x5654('0x34')]);_0x49005c[_0x5654('0x36')]=_[_0x5654('0x37')](_0x49005c[_0x5654('0x31')],_0x49005c[_0x5654('0x34')]);_0x17381f['attributes']=_[_0x5654('0x37')](_0x49005c['model'],qs[_0x5654('0x39')](_0xc1dd69['query']['fields']));_0x17381f[_0x5654('0x38')]=_0x17381f[_0x5654('0x38')][_0x5654('0x3a')]?_0x17381f[_0x5654('0x38')]:_0x49005c[_0x5654('0x31')];if(_0xc1dd69['query'][_0x5654('0x49')]){_0x17381f[_0x5654('0x4a')]=[{'all':!![]}];}_0x17381f=_[_0x5654('0x41')]({},_0x17381f,_0xc1dd69[_0x5654('0x43')]);return db[_0x5654('0x2c')]['find'](_0x17381f)[_0x5654('0x25')](handleEntityNotFound(_0x664cc9,null))[_0x5654('0x25')](respondWithResult(_0x664cc9,null))['catch'](handleError(_0x664cc9,null));};exports[_0x5654('0x4b')]=function(_0x534945,_0x7bdc25){return db['VoiceRecording'][_0x5654('0x4b')](_0x534945[_0x5654('0x4c')],{})[_0x5654('0x25')](respondWithResult(_0x7bdc25,0xc9))['catch'](handleError(_0x7bdc25,null));};exports[_0x5654('0x4d')]=function(_0x55ad4e,_0x418093){if(_0x55ad4e[_0x5654('0x4c')]['id']){delete _0x55ad4e[_0x5654('0x4c')]['id'];}return db['VoiceRecording'][_0x5654('0x4e')]({'where':{'id':_0x55ad4e[_0x5654('0x48')]['id']}})[_0x5654('0x25')](handleEntityNotFound(_0x418093,null))['then'](saveUpdates(_0x55ad4e[_0x5654('0x4c')],null))['then'](respondWithResult(_0x418093,null))[_0x5654('0x46')](handleError(_0x418093,null));};exports[_0x5654('0x4f')]=function(_0x111b41,_0x5ddd2f){return db[_0x5654('0x2c')][_0x5654('0x4f')]()['then'](respondWithResult(_0x5ddd2f,null))[_0x5654('0x46')](handleError(_0x5ddd2f,null));};exports[_0x5654('0x50')]=function(_0x361f5e,_0x3b6249,_0x114869){var _0x463ada=require(_0x5654('0x51'));var _0x3ca730=![];var _0x445794={};if(_0x361f5e[_0x5654('0x34')][_0x5654('0x2f')]&&_0x361f5e[_0x5654('0x34')][_0x5654('0x2f')]===_0x5654('0x52')){_0x445794[_0x5654('0x52')]=_0x361f5e[_0x5654('0x48')]['id'];}else{_0x445794['id']=_0x361f5e[_0x5654('0x48')]['id'];}return db[_0x5654('0x2c')][_0x5654('0x4e')]({'where':_0x445794,'attributes':['id',_0x5654('0x53')],'raw':!![]})[_0x5654('0x25')](handleEntityNotFound(_0x3b6249,null))[_0x5654('0x25')](function(_0x1f9677){if(_0x1f9677){var _0x56a0f4=_0x1f9677[_0x5654('0x53')];var _0x570ff3=util[_0x5654('0x54')](_0x5654('0x55'),_0x56a0f4);if(fs['existsSync'](_0x570ff3)){_0x3ca730=!![];return _0x463ada[_0x5654('0x56')](_0x570ff3,_0x56a0f4,config[_0x5654('0x57')]['recording'])[_0x5654('0x25')](function(){return _0x1f9677;});}return _0x1f9677;}})[_0x5654('0x25')](function(_0x17155d){if(_0x17155d){var _0x30213f=_0x17155d[_0x5654('0x53')];if(!fs['existsSync'](_0x30213f)){throw new db[(_0x5654('0x58'))][(_0x5654('0x59'))](_0x5654('0x5a'));}if(_0x17155d[_0x5654('0x5b')]){return _0x3b6249[_0x5654('0x50')](_0x30213f,_0x17155d[_0x5654('0x5b')]+path[_0x5654('0x5c')](_0x30213f),function(){if(_0x3ca730){fs[_0x5654('0x5d')](_0x30213f);}});}else{return _0x3b6249[_0x5654('0x50')](_0x30213f,function(_0x52e82d){if(_0x3ca730){fs[_0x5654('0x5d')](_0x30213f);}});}}})[_0x5654('0x46')](function(_0x29095d){if(_0x29095d[_0x5654('0x5e')]===_0x5654('0x5a')){_0x3b6249[_0x5654('0x1b')](0x194)[_0x5654('0x2a')]('Not\x20found');}else{return handleError(_0x3b6249,null);}});};exports[_0x5654('0x5f')]=function(_0x4f2bc3,_0x3033c6,_0xb268d1){var _0x24dd57=require(_0x5654('0x51'));var _0x3641fa=![];var _0x383634={'$and':[db['sequelize']['where'](db[_0x5654('0x60')]['fn'](_0x5654('0x61'),db[_0x5654('0x60')][_0x5654('0x62')](_0x5654('0x52'))),_0x4f2bc3[_0x5654('0x34')][_0x5654('0x63')])]};if(_0x4f2bc3[_0x5654('0x34')]['type']&&_0x4f2bc3[_0x5654('0x34')][_0x5654('0x2f')]===_0x5654('0x52')){_0x383634['$and'][_0x5654('0x64')]({'uniqueid':_0x4f2bc3[_0x5654('0x48')]['id']});}else{_0x383634[_0x5654('0x65')]['push']({'id':_0x4f2bc3[_0x5654('0x48')]['id']});}return db[_0x5654('0x2c')][_0x5654('0x4e')]({'where':_0x383634,'attributes':['id',_0x5654('0x53')],'raw':!![]})[_0x5654('0x25')](handleEntityNotFound(_0x3033c6,null))[_0x5654('0x25')](function(_0x10c733){if(_0x10c733){var _0x21c427=util[_0x5654('0x54')](_0x5654('0x55'),_0x10c733[_0x5654('0x53')]);if(fs[_0x5654('0x66')](_0x21c427)){_0x3641fa=!![];return _0x24dd57[_0x5654('0x56')](_0x21c427,_0x10c733[_0x5654('0x53')],config[_0x5654('0x57')][_0x5654('0x67')])[_0x5654('0x25')](function(){return _0x10c733;});}return _0x10c733;}})[_0x5654('0x25')](function(_0x30e1c3){if(_0x30e1c3){if(!fs[_0x5654('0x66')](_0x30e1c3[_0x5654('0x53')])){throw new db[(_0x5654('0x58'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x30e1c3['filename']){return _0x3033c6[_0x5654('0x50')](_0x30e1c3['value'],_0x30e1c3[_0x5654('0x5b')]+path[_0x5654('0x5c')](_0x30e1c3[_0x5654('0x53')]),function(){if(_0x3641fa){fs[_0x5654('0x5d')](_0x30e1c3[_0x5654('0x53')]);}});}else{return _0x3033c6[_0x5654('0x50')](_0x30e1c3['value'],function(_0x1fb2ae){if(_0x3641fa){fs[_0x5654('0x5d')](_0x30e1c3['value']);}});}}})['catch'](handleError(_0x3033c6,null));};exports[_0x5654('0x68')]=function(_0x2f9961,_0x516a9f){return db[_0x5654('0x2c')]['find']({'where':{'id':_0x2f9961[_0x5654('0x48')]['id']}})['then'](function(_0xa67918){if(_['isNil'](_0xa67918)){throw new ReferenceError(_0x5654('0x69'));}return _0xa67918;})[_0x5654('0x25')](function(_0x4c2160){var _0x99e6d0=_0x4c2160['value'];logger[_0x5654('0x6a')](_0x5654('0x6b'),_0x99e6d0);if(!_['isNil'](_0x4c2160[_0x5654('0x53')])&&fs[_0x5654('0x66')](_0x99e6d0)){logger[_0x5654('0x6a')](_0x5654('0x6c')+_0x99e6d0+_0x5654('0x6d'));fs[_0x5654('0x6e')](_0x99e6d0);}_0x99e6d0=_0x99e6d0+_0x5654('0x6f');if(!_[_0x5654('0x70')](_0x4c2160['value'])&&fs[_0x5654('0x66')](_0x99e6d0)){logger[_0x5654('0x6a')](_0x5654('0x6c')+_0x99e6d0+_0x5654('0x6d'));fs[_0x5654('0x6e')](_0x99e6d0);}return _0x4c2160;})[_0x5654('0x25')](function(_0x544bd2){if(!_0x544bd2)throw new InternalError();return _0x544bd2[_0x5654('0x68')]();})[_0x5654('0x25')](function(){_0x516a9f[_0x5654('0x1b')](0xcc)[_0x5654('0x1c')]();})[_0x5654('0x46')](handleError(_0x516a9f,null));};function getBucketslist(_0x550d20,_0x36cc1f,_0x3b1ef2){return new Promise(function(_0x29591e,_0x5142ff){var _0x2bbc85=new AWS['S3']({'accessKeyId':_0x36cc1f,'secretAccessKey':_0x550d20,'region':_0x3b1ef2});_0x2bbc85[_0x5654('0x71')]({},function(_0x491a6e,_0x3b770d){if(_0x491a6e){return _0x5142ff(_0x491a6e);}else{return _0x29591e(_0x3b770d);}});});}function createBucket(_0x4b41e3,_0xcd2ef5,_0x1aa029,_0x1a146b){return new Promise(function(_0x41e7ed,_0xbc530e){var _0x26292d=new AWS['S3']({'accessKeyId':_0xcd2ef5,'secretAccessKey':_0x4b41e3,'region':_0x1aa029});_0x26292d[_0x5654('0x72')]({'Bucket':_0x1a146b},function(_0xd8c7,_0x1d04eb){if(_0xd8c7){return _0xbc530e(_0xd8c7);}else{return _0x41e7ed(_0x1d04eb);}});});}function uploadFile(_0x216724,_0x40f755,_0x4ceb15,_0x3b82ed,_0x43a496,_0x43546e){return new Promise(function(_0x7b883f,_0x1b2518){var _0x55286b=new AWS['S3']({'accessKeyId':_0x40f755,'secretAccessKey':_0x216724,'region':_0x4ceb15});_0x55286b[_0x5654('0x73')]({'Bucket':_0x3b82ed,'Key':_0x43a496,'Body':_0x43546e},function(_0x10dfa1,_0x37158f){if(_0x10dfa1){return _0x1b2518(_0x10dfa1);}else{return _0x7b883f(_0x37158f);}});});}function startTranscribe(_0x1f5726,_0x279c58,_0x33bef7,_0xf05be0,_0x244a0f,_0x1f6fa6){return new Promise(function(_0x16061e,_0xfd3455){var _0x12fd83=new AWS[(_0x5654('0x74'))]({'accessKeyId':_0x279c58,'secretAccessKey':_0x1f5726,'region':_0x33bef7});_0x12fd83['startTranscriptionJob']({'TranscriptionJobName':_0xf05be0,'LanguageCode':_0x244a0f,'Media':{'MediaFileUri':_0x1f6fa6}},function(_0x44f95e,_0x325c6f){if(_0x44f95e){return _0xfd3455(_0x44f95e);}else{return _0x16061e(_0x325c6f);}});});}function transcribe(_0x56e81e,_0x4f9c24,_0x33775a,_0x6a4839,_0x3d32af,_0x742cb0,_0x23982f){return new Promise(function(_0x58dc77,_0xa8a13e){var _0x539a69={};logger[_0x5654('0x6a')](util[_0x5654('0x54')](_0x5654('0x75'),_0x56e81e,_0x3d32af));return uploadFile(_0x4f9c24,_0x33775a,_0x6a4839,_0x3d32af,path[_0x5654('0x76')](_0x742cb0),fs[_0x5654('0x77')](_0x742cb0))['then'](function(_0x5be878){logger[_0x5654('0x6a')](util[_0x5654('0x54')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x56e81e,_0x3d32af,_0x5be878['Location']));_0x539a69[_0x5654('0x78')]=_0x5be878[_0x5654('0x79')];_0x539a69['location']=_0x5be878[_0x5654('0x7a')];logger[_0x5654('0x6a')](util[_0x5654('0x54')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x56e81e));return startTranscribe(_0x4f9c24,_0x33775a,_0x6a4839,uuidv4(),_0x23982f,_0x5be878[_0x5654('0x7a')]);})[_0x5654('0x25')](function(_0x5d57d7){logger[_0x5654('0x6a')](util[_0x5654('0x54')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x56e81e,_0x5d57d7['TranscriptionJob'][_0x5654('0x7b')]));_0x539a69['transcribeName']=_0x5d57d7[_0x5654('0x7c')][_0x5654('0x7b')];_0x539a69[_0x5654('0x7d')]=_0x5d57d7['TranscriptionJob'][_0x5654('0x7e')];return _0x58dc77(_0x539a69);})['catch'](function(_0x4276ca){return _0xa8a13e(_0x4276ca);});});}exports[_0x5654('0x7f')]=function(_0x192f5,_0x1be61e,_0x3edd94){var _0x31ac4f;var _0x5b9926;var _0x326e29;var _0x110948=require(_0x5654('0x51'));return db['VoiceRecording'][_0x5654('0x80')]({'where':{'id':_0x192f5[_0x5654('0x48')]['id']}})[_0x5654('0x25')](function(_0xe34c6c){if(_0xe34c6c){var _0xb85c7f=util['format'](_0x5654('0x55'),_0xe34c6c[_0x5654('0x53')]);if(fs[_0x5654('0x66')](_0xb85c7f)){cypher=!![];return _0x110948[_0x5654('0x56')](_0xb85c7f,_0xe34c6c['value'],config[_0x5654('0x57')]['recording'])[_0x5654('0x25')](function(){return _0xe34c6c;});}return _0xe34c6c;}})[_0x5654('0x25')](function(_0x4c279d){if(!_0x4c279d){throw new db[(_0x5654('0x58'))]['ValidationError'](_0x5654('0x81'));}_0x5b9926=_0x4c279d;return db[_0x5654('0x82')]['findOne']({'where':{'id':0x1}});})[_0x5654('0x25')](handleEntityNotFound(_0x1be61e,null))[_0x5654('0x25')](function(_0x24e47d){if(_0x24e47d){_0x31ac4f=_0x24e47d;if(!_0x31ac4f['transcribe']||!_0x31ac4f[_0x5654('0x83')]||!_0x31ac4f[_0x5654('0x84')]||!_0x31ac4f[_0x5654('0x85')]||!_0x31ac4f[_0x5654('0x78')]){throw new db[(_0x5654('0x58'))][(_0x5654('0x59'))]('Transcribe\x20not\x20configured');}if(_0x192f5[_0x5654('0x4c')][_0x5654('0x86')]&&(!_0x31ac4f[_0x5654('0x87')]||!_0x31ac4f[_0x5654('0x88')]||!_0x31ac4f[_0x5654('0x89')]||!_0x31ac4f[_0x5654('0x85')]||!_0x31ac4f[_0x5654('0x78')])){throw new db[(_0x5654('0x58'))][(_0x5654('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x31ac4f[_0x5654('0x83')]}});}})['then'](function(_0x26912){if(!_0x26912){throw new db[(_0x5654('0x58'))][(_0x5654('0x59'))](_0x5654('0x8a'));}if(!_0x26912[_0x5654('0x8b')]||!_0x26912[_0x5654('0x8c')]){throw new db['Sequelize'][(_0x5654('0x59'))](_0x5654('0x8d'));}_0x326e29=_0x26912;return getBucketslist(_0x326e29[_0x5654('0x8b')],_0x326e29[_0x5654('0x8c')],_0x31ac4f[_0x5654('0x84')]);})[_0x5654('0x25')](function(_0x3d58cb){if(_0x3d58cb&&_0x3d58cb['Buckets']){var _0x2486b8=_[_0x5654('0x4e')](_0x3d58cb['Buckets'],function(_0x4f0428){return _0x4f0428[_0x5654('0x8e')]===_0x31ac4f[_0x5654('0x78')];});if(!_0x2486b8){logger[_0x5654('0x6a')](util[_0x5654('0x54')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x192f5[_0x5654('0x48')]['id'],_0x31ac4f['bucket']));return createBucket(_0x326e29[_0x5654('0x8b')],_0x326e29['data2'],_0x31ac4f[_0x5654('0x84')],_0x31ac4f[_0x5654('0x78')]);}logger[_0x5654('0x6a')](util[_0x5654('0x54')](_0x5654('0x8f'),_0x192f5[_0x5654('0x48')]['id'],_0x31ac4f[_0x5654('0x78')]));return;}})['then'](function(_0xae5d09){if(_0x5b9926['transcribeStatus']==='NEW'){return transcribe(_0x192f5['params']['id'],_0x326e29['data1'],_0x326e29['data2'],_0x31ac4f[_0x5654('0x84')],_0x31ac4f[_0x5654('0x78')],_0x5b9926[_0x5654('0x53')],_0x31ac4f[_0x5654('0x85')]);}else{logger[_0x5654('0x6a')](util[_0x5654('0x54')](_0x5654('0x90'),_0x192f5[_0x5654('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x5654('0x25')](function(_0x5e0547){if(_0x5e0547){_0x5e0547[_0x5654('0x91')]=_0x192f5[_0x5654('0x4c')][_0x5654('0x86')];return _0x5b9926[_0x5654('0x92')](_0x5e0547);}})['then'](respondWithResult(_0x1be61e,null))[_0x5654('0x46')](handleError(_0x1be61e,null));};function writeFile(_0xd8cfbf,_0x4c7e32){return new Promise(function(_0x2c398b,_0x3e76c7){fs['writeFile'](_0x4c7e32,_0xd8cfbf,function(_0x7a8c9d,_0x5d8f14){if(_0x7a8c9d){return _0x3e76c7(_0x7a8c9d);}else{return _0x2c398b(_0x5d8f14);}});});}exports[_0x5654('0x93')]=function(_0x315fa1,_0x50407d,_0x279745){return db[_0x5654('0x2c')][_0x5654('0x80')]({'where':{'id':_0x315fa1[_0x5654('0x48')]['id']}})[_0x5654('0x25')](handleEntityNotFound(_0x50407d))[_0x5654('0x25')](function(_0xc69244){if(_0xc69244&&_0xc69244[_0x5654('0x94')]){var _0x52e861=_0xc69244[_0x5654('0x94')];var _0x98c23a=config[_0x5654('0x95')]+_0x5654('0x96')+_0xc69244['id']+'.txt';if(fs[_0x5654('0x66')](_0x98c23a)){return _0x98c23a;}return writeFile(_0x52e861,_0x98c23a)[_0x5654('0x25')](function(){return _0x98c23a;});}else{throw new db[(_0x5654('0x58'))]['ValidationError'](_0x5654('0x97'));}})[_0x5654('0x25')](function(_0x30fdcb){return _0x50407d[_0x5654('0x50')](_0x30fdcb);})[_0x5654('0x46')](handleError(_0x50407d));}; \ No newline at end of file +var _0x4a26=['[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','findOne','secrets','Voice\x20Recording\x20not\x20found','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','VoiceRecording','then','includeAll','include','findAll','show','params','length','catch','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','download','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','token','$and','push','format','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync'];(function(_0x59f935,_0x2a4870){var _0x239127=function(_0x301d23){while(--_0x301d23){_0x59f935['push'](_0x59f935['shift']());}};_0x239127(++_0x2a4870);}(_0x4a26,0x1e7));var _0x64a2=function(_0x36f8aa,_0x1d007a){_0x36f8aa=_0x36f8aa-0x0;var _0x2985f9=_0x4a26[_0x36f8aa];return _0x2985f9;};'use strict';var emlformat=require(_0x64a2('0x0'));var rimraf=require(_0x64a2('0x1'));var zipdir=require(_0x64a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64a2('0x3'));var moment=require(_0x64a2('0x4'));var BPromise=require(_0x64a2('0x5'));var Mustache=require(_0x64a2('0x6'));var util=require(_0x64a2('0x7'));var path=require(_0x64a2('0x8'));var sox=require(_0x64a2('0x9'));var csv=require(_0x64a2('0xa'));var ejs=require(_0x64a2('0xb'));var fs=require('fs');var fs_extra=require(_0x64a2('0xc'));var _=require(_0x64a2('0xd'));var squel=require(_0x64a2('0xe'));var crypto=require(_0x64a2('0xf'));var jsforce=require(_0x64a2('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x64a2('0xa'));var querystring=require(_0x64a2('0x11'));var Papa=require(_0x64a2('0x12'));var AWS=require(_0x64a2('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0x64a2('0x14'));var authService=require(_0x64a2('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x64a2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64a2('0x17'))(_0x64a2('0x18'));var utils=require('../../config/utils');var config=require(_0x64a2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x218286,_0x2bb6b7){_0x2bb6b7=_0x2bb6b7||0xcc;return function(_0x406420){if(_0x406420){return _0x218286[_0x64a2('0x1a')](_0x2bb6b7);}return _0x218286[_0x64a2('0x1b')](_0x2bb6b7)[_0x64a2('0x1c')]();};}function respondWithResult(_0x390e55,_0x18dba7){_0x18dba7=_0x18dba7||0xc8;return function(_0x333b76){if(_0x333b76){return _0x390e55[_0x64a2('0x1b')](_0x18dba7)[_0x64a2('0x1d')](_0x333b76);}};}function respondWithFilteredResult(_0x8d8874,_0x185727){return function(_0x131a44){if(_0x131a44){var _0x4f8d95=typeof _0x185727[_0x64a2('0x1e')]==='undefined'&&typeof _0x185727[_0x64a2('0x1f')]===_0x64a2('0x20');var _0x26f42d=_0x131a44[_0x64a2('0x21')];var _0x342c67=_0x4f8d95?0x0:_0x185727[_0x64a2('0x1e')];var _0x31145a=_0x4f8d95?_0x131a44['count']:_0x185727['offset']+_0x185727[_0x64a2('0x1f')];var _0x1a5b9f;if(_0x31145a>=_0x26f42d){_0x31145a=_0x26f42d;_0x1a5b9f=0xc8;}else{_0x1a5b9f=0xce;}_0x8d8874[_0x64a2('0x1b')](_0x1a5b9f);return _0x8d8874[_0x64a2('0x22')](_0x64a2('0x23'),_0x342c67+'-'+_0x31145a+'/'+_0x26f42d)['json'](_0x131a44);}return null;};}function patchUpdates(_0x404039){return function(_0x3f1ea1){try{jsonpatch[_0x64a2('0x24')](_0x3f1ea1,_0x404039,!![]);}catch(_0x1f7983){return BPromise[_0x64a2('0x25')](_0x1f7983);}return _0x3f1ea1[_0x64a2('0x26')]();};}function saveUpdates(_0x2678e5,_0x304cf9){return function(_0x431734){if(_0x431734){return _0x431734[_0x64a2('0x27')](_0x2678e5)['then'](function(_0x3d1c8f){return _0x3d1c8f;});}return null;};}function removeEntity(_0x3c6704,_0x5cfce7){return function(_0x87ef6){if(_0x87ef6){return _0x87ef6[_0x64a2('0x28')]()['then'](function(){_0x3c6704[_0x64a2('0x1b')](0xcc)[_0x64a2('0x1c')]();});}};}function handleEntityNotFound(_0x17cd3d,_0x2a934f){return function(_0x1f6ca7){if(!_0x1f6ca7){_0x17cd3d['sendStatus'](0x194);}return _0x1f6ca7;};}function handleError(_0x522d1e,_0x511144){_0x511144=_0x511144||0x1f4;return function(_0x2e45e9){logger['error'](_0x2e45e9['stack']);if(_0x2e45e9[_0x64a2('0x29')]){delete _0x2e45e9[_0x64a2('0x29')];}_0x522d1e['status'](_0x511144)[_0x64a2('0x2a')](_0x2e45e9);};}exports[_0x64a2('0x2b')]=function(_0xaeb7ae,_0x1b0425){var _0x20046f={},_0x481017={},_0x157f84={'count':0x0,'rows':[]};var _0x1ee6b5=_[_0x64a2('0x2c')](db['VoiceRecording'][_0x64a2('0x2d')],function(_0x7b15eb){return{'name':_0x7b15eb['fieldName'],'type':_0x7b15eb[_0x64a2('0x2e')][_0x64a2('0x2f')]};});_0x481017[_0x64a2('0x30')]=_[_0x64a2('0x31')](_[_0x64a2('0x2c')](_0x1ee6b5,_0x64a2('0x29')),['format']);_0x481017[_0x64a2('0x32')]=_[_0x64a2('0x33')](_0xaeb7ae[_0x64a2('0x32')]);_0x481017[_0x64a2('0x34')]=_['intersection'](_0x481017[_0x64a2('0x30')],_0x481017[_0x64a2('0x32')]);_0x20046f[_0x64a2('0x35')]=_[_0x64a2('0x36')](_0x481017[_0x64a2('0x30')],qs['fields'](_0xaeb7ae[_0x64a2('0x32')][_0x64a2('0x37')]));_0x20046f['attributes']=_0x20046f[_0x64a2('0x35')]['length']?_0x20046f[_0x64a2('0x35')]:_0x481017[_0x64a2('0x30')];if(!_0xaeb7ae[_0x64a2('0x32')][_0x64a2('0x38')](_0x64a2('0x39'))){_0x20046f['limit']=qs[_0x64a2('0x1f')](_0xaeb7ae['query'][_0x64a2('0x1f')]);_0x20046f[_0x64a2('0x1e')]=qs['offset'](_0xaeb7ae['query'][_0x64a2('0x1e')]);}_0x20046f[_0x64a2('0x3a')]=qs['sort'](_0xaeb7ae[_0x64a2('0x32')]['sort']);_0x20046f[_0x64a2('0x3b')]=qs[_0x64a2('0x34')](_['pick'](_0xaeb7ae['query'],_0x481017[_0x64a2('0x34')]),_0x1ee6b5);if(_0xaeb7ae[_0x64a2('0x32')][_0x64a2('0x3c')]){_0x20046f[_0x64a2('0x3b')]=_[_0x64a2('0x3d')](_0x20046f['where'],{'$or':_['map'](_0x1ee6b5,function(_0x444adc){if(_0x444adc[_0x64a2('0x2e')]!==_0x64a2('0x3e')){var _0x36192f={};_0x36192f[_0x444adc[_0x64a2('0x29')]]={'$like':'%'+_0xaeb7ae[_0x64a2('0x32')]['filter']+'%'};return _0x36192f;}})});}_0x20046f=_[_0x64a2('0x3d')]({},_0x20046f,_0xaeb7ae[_0x64a2('0x3f')]);var _0x329b02={'where':_0x20046f[_0x64a2('0x3b')]};return db[_0x64a2('0x40')][_0x64a2('0x21')](_0x329b02)[_0x64a2('0x41')](function(_0x222a5b){_0x157f84[_0x64a2('0x21')]=_0x222a5b;if(_0xaeb7ae[_0x64a2('0x32')][_0x64a2('0x42')]){_0x20046f[_0x64a2('0x43')]=[{'all':!![]}];}return db[_0x64a2('0x40')][_0x64a2('0x44')](_0x20046f);})[_0x64a2('0x41')](function(_0x10c87){_0x157f84['rows']=_0x10c87;return _0x157f84;})[_0x64a2('0x41')](respondWithFilteredResult(_0x1b0425,_0x20046f))['catch'](handleError(_0x1b0425,null));};exports[_0x64a2('0x45')]=function(_0x43dca5,_0x2d313e){var _0x264eb4={'raw':![],'where':{'id':_0x43dca5[_0x64a2('0x46')]['id']}},_0x55cc78={};_0x55cc78[_0x64a2('0x30')]=_['keys'](db['VoiceRecording'][_0x64a2('0x2d')]);_0x55cc78[_0x64a2('0x32')]=_[_0x64a2('0x33')](_0x43dca5[_0x64a2('0x32')]);_0x55cc78[_0x64a2('0x34')]=_[_0x64a2('0x36')](_0x55cc78[_0x64a2('0x30')],_0x55cc78[_0x64a2('0x32')]);_0x264eb4[_0x64a2('0x35')]=_[_0x64a2('0x36')](_0x55cc78[_0x64a2('0x30')],qs[_0x64a2('0x37')](_0x43dca5['query'][_0x64a2('0x37')]));_0x264eb4[_0x64a2('0x35')]=_0x264eb4['attributes'][_0x64a2('0x47')]?_0x264eb4[_0x64a2('0x35')]:_0x55cc78['model'];if(_0x43dca5['query'][_0x64a2('0x42')]){_0x264eb4[_0x64a2('0x43')]=[{'all':!![]}];}_0x264eb4=_[_0x64a2('0x3d')]({},_0x264eb4,_0x43dca5[_0x64a2('0x3f')]);return db[_0x64a2('0x40')]['find'](_0x264eb4)['then'](handleEntityNotFound(_0x2d313e,null))[_0x64a2('0x41')](respondWithResult(_0x2d313e,null))[_0x64a2('0x48')](handleError(_0x2d313e,null));};exports[_0x64a2('0x49')]=function(_0xadee67,_0x2a4ca4){return db[_0x64a2('0x40')][_0x64a2('0x49')](_0xadee67[_0x64a2('0x4a')],{})['then'](respondWithResult(_0x2a4ca4,0xc9))[_0x64a2('0x48')](handleError(_0x2a4ca4,null));};exports[_0x64a2('0x27')]=function(_0x5da8f5,_0x4c7993){if(_0x5da8f5['body']['id']){delete _0x5da8f5[_0x64a2('0x4a')]['id'];}return db[_0x64a2('0x40')][_0x64a2('0x4b')]({'where':{'id':_0x5da8f5[_0x64a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c7993,null))[_0x64a2('0x41')](saveUpdates(_0x5da8f5[_0x64a2('0x4a')],null))['then'](respondWithResult(_0x4c7993,null))['catch'](handleError(_0x4c7993,null));};exports[_0x64a2('0x4c')]=function(_0x5a8136,_0x190599){return db[_0x64a2('0x40')]['describe']()[_0x64a2('0x41')](respondWithResult(_0x190599,null))[_0x64a2('0x48')](handleError(_0x190599,null));};exports['download']=function(_0x5a5574,_0x3835cb,_0x368280){var _0x5bb8db=require(_0x64a2('0x4d'));var _0x117ef5=![];var _0xfc3fc0={};if(_0x5a5574[_0x64a2('0x32')][_0x64a2('0x2e')]&&_0x5a5574[_0x64a2('0x32')][_0x64a2('0x2e')]==='uniqueid'){_0xfc3fc0[_0x64a2('0x4e')]=_0x5a5574[_0x64a2('0x46')]['id'];}else{_0xfc3fc0['id']=_0x5a5574[_0x64a2('0x46')]['id'];}return db[_0x64a2('0x40')][_0x64a2('0x4b')]({'where':_0xfc3fc0,'attributes':['id',_0x64a2('0x4f')],'raw':!![]})[_0x64a2('0x41')](handleEntityNotFound(_0x3835cb,null))[_0x64a2('0x41')](function(_0x737b42){if(_0x737b42){var _0x4826bb=_0x737b42['value'];var _0x19c893=util['format'](_0x64a2('0x50'),_0x4826bb);if(fs['existsSync'](_0x19c893)){_0x117ef5=!![];return _0x5bb8db[_0x64a2('0x51')](_0x19c893,_0x4826bb,config['secrets'][_0x64a2('0x52')])[_0x64a2('0x41')](function(){return _0x737b42;});}return _0x737b42;}})[_0x64a2('0x41')](function(_0x7343fa){if(_0x7343fa){var _0x206797=_0x7343fa['value'];if(!fs[_0x64a2('0x53')](_0x206797)){throw new db[(_0x64a2('0x54'))][(_0x64a2('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x7343fa[_0x64a2('0x56')]){return _0x3835cb['download'](_0x206797,_0x7343fa[_0x64a2('0x56')]+path[_0x64a2('0x57')](_0x206797),function(){if(_0x117ef5){fs[_0x64a2('0x58')](_0x206797);}});}else{return _0x3835cb[_0x64a2('0x59')](_0x206797,function(_0x2990d4){if(_0x117ef5){fs[_0x64a2('0x58')](_0x206797);}});}}})[_0x64a2('0x48')](function(_0x20455b){if(_0x20455b[_0x64a2('0x5a')]===_0x64a2('0x5b')){_0x3835cb[_0x64a2('0x1b')](0x194)[_0x64a2('0x2a')]('Not\x20found');}else{return handleError(_0x3835cb,null);}});};exports[_0x64a2('0x5c')]=function(_0x296716,_0x25a10f,_0xd0fa8c){var _0x168f00=require(_0x64a2('0x4d'));var _0x21c4c3=![];var _0x2f17ba={'$and':[db[_0x64a2('0x5d')][_0x64a2('0x3b')](db[_0x64a2('0x5d')]['fn'](_0x64a2('0x5e'),db[_0x64a2('0x5d')][_0x64a2('0x5f')](_0x64a2('0x4e'))),_0x296716[_0x64a2('0x32')][_0x64a2('0x60')])]};if(_0x296716[_0x64a2('0x32')][_0x64a2('0x2e')]&&_0x296716[_0x64a2('0x32')]['type']==='uniqueid'){_0x2f17ba[_0x64a2('0x61')][_0x64a2('0x62')]({'uniqueid':_0x296716[_0x64a2('0x46')]['id']});}else{_0x2f17ba[_0x64a2('0x61')][_0x64a2('0x62')]({'id':_0x296716[_0x64a2('0x46')]['id']});}return db[_0x64a2('0x40')][_0x64a2('0x4b')]({'where':_0x2f17ba,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x25a10f,null))[_0x64a2('0x41')](function(_0x534464){if(_0x534464){var _0x391434=util[_0x64a2('0x63')]('%s.cypher',_0x534464[_0x64a2('0x4f')]);if(fs['existsSync'](_0x391434)){_0x21c4c3=!![];return _0x168f00[_0x64a2('0x51')](_0x391434,_0x534464[_0x64a2('0x4f')],config['secrets'][_0x64a2('0x52')])[_0x64a2('0x41')](function(){return _0x534464;});}return _0x534464;}})[_0x64a2('0x41')](function(_0x176d22){if(_0x176d22){if(!fs['existsSync'](_0x176d22[_0x64a2('0x4f')])){throw new db[(_0x64a2('0x54'))][(_0x64a2('0x55'))](_0x64a2('0x5b'));}if(_0x176d22[_0x64a2('0x56')]){return _0x25a10f['download'](_0x176d22['value'],_0x176d22[_0x64a2('0x56')]+path[_0x64a2('0x57')](_0x176d22[_0x64a2('0x4f')]),function(){if(_0x21c4c3){fs[_0x64a2('0x58')](_0x176d22['value']);}});}else{return _0x25a10f['download'](_0x176d22[_0x64a2('0x4f')],function(_0x59b8ef){if(_0x21c4c3){fs['unlink'](_0x176d22[_0x64a2('0x4f')]);}});}}})[_0x64a2('0x48')](handleError(_0x25a10f,null));};exports['destroy']=function(_0x4b893c,_0x5babd1){return db['VoiceRecording'][_0x64a2('0x4b')]({'where':{'id':_0x4b893c['params']['id']}})[_0x64a2('0x41')](function(_0x8286ea){if(_['isNil'](_0x8286ea)){throw new ReferenceError(_0x64a2('0x64'));}return _0x8286ea;})[_0x64a2('0x41')](function(_0xe94e39){var _0x43d2e7=_0xe94e39[_0x64a2('0x4f')];logger[_0x64a2('0x65')](_0x64a2('0x66'),_0x43d2e7);if(!_[_0x64a2('0x67')](_0xe94e39[_0x64a2('0x4f')])&&fs[_0x64a2('0x53')](_0x43d2e7)){logger['info']('File:\x20\x22'+_0x43d2e7+_0x64a2('0x68'));fs['unlinkSync'](_0x43d2e7);}_0x43d2e7=_0x43d2e7+_0x64a2('0x69');if(!_[_0x64a2('0x67')](_0xe94e39[_0x64a2('0x4f')])&&fs[_0x64a2('0x53')](_0x43d2e7)){logger[_0x64a2('0x65')](_0x64a2('0x6a')+_0x43d2e7+_0x64a2('0x68'));fs[_0x64a2('0x6b')](_0x43d2e7);}return _0xe94e39;})[_0x64a2('0x41')](function(_0x21ed62){if(!_0x21ed62)throw new InternalError();return _0x21ed62[_0x64a2('0x28')]();})[_0x64a2('0x41')](function(){_0x5babd1['status'](0xcc)[_0x64a2('0x1c')]();})['catch'](handleError(_0x5babd1,null));};function getBucketslist(_0x33500a,_0x407948,_0x5e9676){return new Promise(function(_0x56e3af,_0x3c0950){var _0x10e2c7=new AWS['S3']({'accessKeyId':_0x407948,'secretAccessKey':_0x33500a,'region':_0x5e9676});_0x10e2c7['listBuckets']({},function(_0x207093,_0x4a4c1c){if(_0x207093){return _0x3c0950(_0x207093);}else{return _0x56e3af(_0x4a4c1c);}});});}function createBucket(_0x32a5d4,_0x35553f,_0x510ca8,_0x5f5928){return new Promise(function(_0x2f953d,_0x1f34f4){var _0x58ef04=new AWS['S3']({'accessKeyId':_0x35553f,'secretAccessKey':_0x32a5d4,'region':_0x510ca8});_0x58ef04['createBucket']({'Bucket':_0x5f5928},function(_0x68a4f9,_0x3acf64){if(_0x68a4f9){return _0x1f34f4(_0x68a4f9);}else{return _0x2f953d(_0x3acf64);}});});}function uploadFile(_0x1f8e52,_0x2db765,_0x132b15,_0x4b11bf,_0x2eb28c,_0x40ac41){return new Promise(function(_0x4b168a,_0x2aa353){var _0x18e672=new AWS['S3']({'accessKeyId':_0x2db765,'secretAccessKey':_0x1f8e52,'region':_0x132b15});_0x18e672[_0x64a2('0x6c')]({'Bucket':_0x4b11bf,'Key':_0x2eb28c,'Body':_0x40ac41},function(_0x2010c9,_0x2bc725){if(_0x2010c9){return _0x2aa353(_0x2010c9);}else{return _0x4b168a(_0x2bc725);}});});}function startTranscribe(_0x3c5e14,_0x2783c2,_0x4b8aab,_0x447ef1,_0x1ad899,_0x1e2138){return new Promise(function(_0x42a399,_0x30b0a7){var _0x5d7bdb=new AWS[(_0x64a2('0x6d'))]({'accessKeyId':_0x2783c2,'secretAccessKey':_0x3c5e14,'region':_0x4b8aab});_0x5d7bdb['startTranscriptionJob']({'TranscriptionJobName':_0x447ef1,'LanguageCode':_0x1ad899,'Media':{'MediaFileUri':_0x1e2138}},function(_0x1d15c7,_0x5d1bec){if(_0x1d15c7){return _0x30b0a7(_0x1d15c7);}else{return _0x42a399(_0x5d1bec);}});});}function transcribe(_0x1413d0,_0x5ed97c,_0x154040,_0x36fdb5,_0x246c94,_0x14c54e,_0x2a0095){return new Promise(function(_0x2f49d1,_0xd347e4){var _0x3a543a={};logger['info'](util[_0x64a2('0x63')](_0x64a2('0x6e'),_0x1413d0,_0x246c94));return uploadFile(_0x5ed97c,_0x154040,_0x36fdb5,_0x246c94,path[_0x64a2('0x6f')](_0x14c54e),fs[_0x64a2('0x70')](_0x14c54e))[_0x64a2('0x41')](function(_0x4147c6){logger[_0x64a2('0x65')](util['format'](_0x64a2('0x71'),_0x1413d0,_0x246c94,_0x4147c6[_0x64a2('0x72')]));_0x3a543a[_0x64a2('0x73')]=_0x4147c6['Bucket'];_0x3a543a[_0x64a2('0x74')]=_0x4147c6[_0x64a2('0x72')];logger[_0x64a2('0x65')](util['format'](_0x64a2('0x75'),_0x1413d0));return startTranscribe(_0x5ed97c,_0x154040,_0x36fdb5,uuidv4(),_0x2a0095,_0x4147c6[_0x64a2('0x72')]);})[_0x64a2('0x41')](function(_0x5d4c09){logger[_0x64a2('0x65')](util[_0x64a2('0x63')](_0x64a2('0x76'),_0x1413d0,_0x5d4c09[_0x64a2('0x77')][_0x64a2('0x78')]));_0x3a543a['transcribeName']=_0x5d4c09['TranscriptionJob'][_0x64a2('0x78')];_0x3a543a[_0x64a2('0x79')]=_0x5d4c09['TranscriptionJob']['TranscriptionJobStatus'];return _0x2f49d1(_0x3a543a);})[_0x64a2('0x48')](function(_0x15d85b){return _0xd347e4(_0x15d85b);});});}exports['runTranscribe']=function(_0xfb26d5,_0x162951,_0x344432){var _0x189713;var _0x5d1be9;var _0x510396;var _0xacc2f3=require('../../components/encryptor');return db[_0x64a2('0x40')][_0x64a2('0x7a')]({'where':{'id':_0xfb26d5[_0x64a2('0x46')]['id']}})[_0x64a2('0x41')](function(_0x4d1a9a){if(_0x4d1a9a){var _0x33d893=util[_0x64a2('0x63')](_0x64a2('0x50'),_0x4d1a9a[_0x64a2('0x4f')]);if(fs[_0x64a2('0x53')](_0x33d893)){cypher=!![];return _0xacc2f3['decryptFile'](_0x33d893,_0x4d1a9a[_0x64a2('0x4f')],config[_0x64a2('0x7b')]['recording'])[_0x64a2('0x41')](function(){return _0x4d1a9a;});}return _0x4d1a9a;}})['then'](function(_0xaf36c1){if(!_0xaf36c1){throw new db['Sequelize'][(_0x64a2('0x55'))](_0x64a2('0x7c'));}_0x5d1be9=_0xaf36c1;return db['Setting'][_0x64a2('0x7a')]({'where':{'id':0x1}});})[_0x64a2('0x41')](handleEntityNotFound(_0x162951,null))[_0x64a2('0x41')](function(_0x514da9){if(_0x514da9){_0x189713=_0x514da9;if(!_0x189713[_0x64a2('0x7d')]||!_0x189713['transcribeAccountId']||!_0x189713[_0x64a2('0x7e')]||!_0x189713[_0x64a2('0x7f')]||!_0x189713[_0x64a2('0x73')]){throw new db[(_0x64a2('0x54'))][(_0x64a2('0x55'))](_0x64a2('0x80'));}if(_0xfb26d5[_0x64a2('0x4a')][_0x64a2('0x81')]&&(!_0x189713['sentiment']||!_0x189713[_0x64a2('0x82')]||!_0x189713[_0x64a2('0x83')]||!_0x189713[_0x64a2('0x7f')]||!_0x189713[_0x64a2('0x73')])){throw new db[(_0x64a2('0x54'))][(_0x64a2('0x55'))](_0x64a2('0x84'));}return db[_0x64a2('0x85')][_0x64a2('0x7a')]({'where':{'id':_0x189713[_0x64a2('0x86')]}});}})['then'](function(_0x484098){if(!_0x484098){throw new db[(_0x64a2('0x54'))][(_0x64a2('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x484098[_0x64a2('0x87')]||!_0x484098[_0x64a2('0x88')]){throw new db['Sequelize'][(_0x64a2('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x510396=_0x484098;return getBucketslist(_0x510396[_0x64a2('0x87')],_0x510396['data2'],_0x189713[_0x64a2('0x7e')]);})[_0x64a2('0x41')](function(_0x7b7e7d){if(_0x7b7e7d&&_0x7b7e7d[_0x64a2('0x89')]){var _0x4bf426=_['find'](_0x7b7e7d[_0x64a2('0x89')],function(_0x3fca5d){return _0x3fca5d['Name']===_0x189713[_0x64a2('0x73')];});if(!_0x4bf426){logger['info'](util[_0x64a2('0x63')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0xfb26d5[_0x64a2('0x46')]['id'],_0x189713[_0x64a2('0x73')]));return createBucket(_0x510396[_0x64a2('0x87')],_0x510396[_0x64a2('0x88')],_0x189713['transcribeRegion'],_0x189713[_0x64a2('0x73')]);}logger[_0x64a2('0x65')](util[_0x64a2('0x63')](_0x64a2('0x8a'),_0xfb26d5[_0x64a2('0x46')]['id'],_0x189713[_0x64a2('0x73')]));return;}})[_0x64a2('0x41')](function(_0x542f3e){if(_0x5d1be9[_0x64a2('0x79')]===_0x64a2('0x8b')){return transcribe(_0xfb26d5[_0x64a2('0x46')]['id'],_0x510396['data1'],_0x510396[_0x64a2('0x88')],_0x189713['transcribeRegion'],_0x189713[_0x64a2('0x73')],_0x5d1be9[_0x64a2('0x4f')],_0x189713[_0x64a2('0x7f')]);}else{logger[_0x64a2('0x65')](util[_0x64a2('0x63')](_0x64a2('0x8c'),_0xfb26d5[_0x64a2('0x46')]['id']));return{'transcribeStatus':_0x64a2('0x8d')};}})[_0x64a2('0x41')](function(_0x1231d9){if(_0x1231d9){_0x1231d9['tempSentiment']=_0xfb26d5[_0x64a2('0x4a')][_0x64a2('0x81')];return _0x5d1be9[_0x64a2('0x8e')](_0x1231d9);}})[_0x64a2('0x41')](respondWithResult(_0x162951,null))['catch'](handleError(_0x162951,null));};function writeFile(_0x408434,_0x208d0f){return new Promise(function(_0x52b1d6,_0x1c84b7){fs[_0x64a2('0x8f')](_0x208d0f,_0x408434,function(_0xcbc52,_0x1c56d8){if(_0xcbc52){return _0x1c84b7(_0xcbc52);}else{return _0x52b1d6(_0x1c56d8);}});});}exports[_0x64a2('0x90')]=function(_0x848dfb,_0x3b22d4,_0x394b96){return db[_0x64a2('0x40')][_0x64a2('0x7a')]({'where':{'id':_0x848dfb[_0x64a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b22d4))['then'](function(_0x1bbaa9){if(_0x1bbaa9&&_0x1bbaa9[_0x64a2('0x91')]){var _0x126841=_0x1bbaa9[_0x64a2('0x91')];var _0x3a79a1=config[_0x64a2('0x92')]+_0x64a2('0x93')+_0x1bbaa9['id']+_0x64a2('0x94');if(fs[_0x64a2('0x53')](_0x3a79a1)){return _0x3a79a1;}return writeFile(_0x126841,_0x3a79a1)[_0x64a2('0x41')](function(){return _0x3a79a1;});}else{throw new db[(_0x64a2('0x54'))][(_0x64a2('0x55'))](_0x64a2('0x95'));}})[_0x64a2('0x41')](function(_0x5a6025){return _0x3b22d4['download'](_0x5a6025);})[_0x64a2('0x48')](handleError(_0x3b22d4));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a6215c7..60b1654 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 _0xeb0d=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','uniqueid'];(function(_0x1a4ec0,_0x53fe85){var _0x450490=function(_0xdfcf0a){while(--_0xdfcf0a){_0x1a4ec0['push'](_0x1a4ec0['shift']());}};_0x450490(++_0x53fe85);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x455279,_0xa2a66a){_0x455279=_0x455279-0x0;var _0x103cdf=_0xeb0d[_0x455279];return _0x103cdf;};'use strict';var attributes=require(_0xdeb0('0x0'));module['exports']=function(_0x501863,_0x515f56){return _0x501863[_0xdeb0('0x1')](_0xdeb0('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xdeb0('0x3'),'fields':[_0xdeb0('0x3')]},{'name':_0xdeb0('0x4'),'fields':[_0xdeb0('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6953=['./voiceRecording.attributes','exports','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x379640,_0x5b857b){var _0x4733f5=function(_0x3704a0){while(--_0x3704a0){_0x379640['push'](_0x379640['shift']());}};_0x4733f5(++_0x5b857b);}(_0x6953,0x91));var _0x3695=function(_0x3758a1,_0x3934dc){_0x3758a1=_0x3758a1-0x0;var _0x51306f=_0x6953[_0x3758a1];return _0x51306f;};'use strict';var attributes=require(_0x3695('0x0'));module[_0x3695('0x1')]=function(_0x4f40b5,_0x56a828){return _0x4f40b5['define'](_0x3695('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x3695('0x3'),'fields':[_0x3695('0x3')]},{'name':_0x3695('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index df34f0a..453ddfc 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 _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(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x7bd0,0x111));var _0x07bd=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x7bd0[_0x2aee2f];return _0x19337f;};'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 +var _0x4325=['attributes','CreateVoiceRecording','Setting','findOne','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where'];(function(_0x2b76de,_0x2c174c){var _0x4bbf3e=function(_0x422977){while(--_0x422977){_0x2b76de['push'](_0x2b76de['shift']());}};_0x4bbf3e(++_0x2c174c);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe60['options']?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1d')]||null:null,'attributes':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1e')]||null:null,'limit':_0x32fe60['options']?_0x32fe60['options']['limit']||null:null})[_0x5432('0xb')](function(_0xb900f2){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug']('UpdateVoiceRecording',_0x32fe60,JSON[_0x5432('0x10')](_0xb900f2));_0x5f011f(_0xb900f2);})[_0x5432('0x16')](function(_0x4a40fc){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4a40fc[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x4a40fc[_0x5432('0x13')]));});});};exports[_0x5432('0x1f')]=function(_0xe7eda2){var _0x520da1=this;return new Promise(function(_0x4ab09d,_0x1f2055){var _0x2114b8=require('../../components/encryptor');var _0x1abe73;return db[_0x5432('0x20')][_0x5432('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5432('0xb')](function(_0x5be867){_0x1abe73=_0x5be867;return db['VoiceRecording'][_0x5432('0x22')](_0xe7eda2['body']);})[_0x5432('0xb')](function(_0x578281){if(_0x1abe73['callRecordingEncryption']&&fs[_0x5432('0x23')](_0x578281[_0x5432('0x24')])){var _0x345b51=util['format'](_0x5432('0x25'),_0x578281[_0x5432('0x24')]);return _0x2114b8[_0x5432('0x26')](_0x578281[_0x5432('0x24')],_0x345b51,config[_0x5432('0x27')][_0x5432('0x28')])[_0x5432('0xb')](function(){fs[_0x5432('0x29')](_0x578281[_0x5432('0x24')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x578281;});}return _0x578281;})[_0x5432('0xb')](function(_0x42ab1e){logger[_0x5432('0x14')](_0x5432('0x1f'),_0xe7eda2);logger[_0x5432('0xd')]('CreateVoiceRecording',_0xe7eda2,JSON[_0x5432('0x10')](_0x42ab1e));_0x4ab09d(_0x42ab1e);})['catch'](function(_0x2955e0){logger[_0x5432('0x12')](_0x5432('0x1f'),_0x2955e0[_0x5432('0x13')],_0xe7eda2);_0x1f2055(_0x520da1[_0x5432('0x12')](0x1f4,_0x2955e0[_0x5432('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 3bfa936..abf64e2 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 _0xad9f=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0xad9f,0xb0));var _0xfad9=function(_0x34f942,_0x1deb70){_0x34f942=_0x34f942-0x0;var _0x49f8f4=_0xad9f[_0x34f942];return _0x49f8f4;};'use strict';var multer=require(_0xfad9('0x0'));var util=require(_0xfad9('0x1'));var path=require(_0xfad9('0x2'));var timeout=require(_0xfad9('0x3'));var express=require(_0xfad9('0x4'));var router=express[_0xfad9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfad9('0x6'));var interaction=require(_0xfad9('0x7'));var config=require(_0xfad9('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xfad9('0x9')]('/',auth[_0xfad9('0xa')](),controller['index']);router[_0xfad9('0x9')](_0xfad9('0xb'),auth['isAuthenticated'](),controller[_0xfad9('0xc')]);router[_0xfad9('0x9')](_0xfad9('0xd'),auth[_0xfad9('0xa')](),controller[_0xfad9('0xe')]);router[_0xfad9('0xf')]('/',auth[_0xfad9('0xa')](),controller[_0xfad9('0x10')]);router[_0xfad9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xfad9('0x12')]);router[_0xfad9('0x13')](_0xfad9('0xd'),auth[_0xfad9('0xa')](),controller[_0xfad9('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9cdf=['../../config/environment','index','get','/describe','isAuthenticated','describe','show','post','put','update','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x193d47,_0x272136){var _0x4a5632=function(_0x122e62){while(--_0x122e62){_0x193d47['push'](_0x193d47['shift']());}};_0x4a5632(++_0x272136);}(_0x9cdf,0x117));var _0xf9cd=function(_0x11dce1,_0x47613b){_0x11dce1=_0x11dce1-0x0;var _0x1f2862=_0x9cdf[_0x11dce1];return _0x1f2862;};'use strict';var multer=require(_0xf9cd('0x0'));var util=require('util');var path=require(_0xf9cd('0x1'));var timeout=require('connect-timeout');var express=require(_0xf9cd('0x2'));var router=express[_0xf9cd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf9cd('0x4'));var interaction=require(_0xf9cd('0x5'));var config=require(_0xf9cd('0x6'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf9cd('0x7')]);router[_0xf9cd('0x8')](_0xf9cd('0x9'),auth[_0xf9cd('0xa')](),controller[_0xf9cd('0xb')]);router[_0xf9cd('0x8')]('/:id',auth[_0xf9cd('0xa')](),controller[_0xf9cd('0xc')]);router[_0xf9cd('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf9cd('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf9cd('0xf')]);router['delete'](_0xf9cd('0x10'),auth['isAuthenticated'](),controller[_0xf9cd('0x11')]);module[_0xf9cd('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e071ef9..1532b07 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 _0x5802=['attended','STRING','sequelize','moment','exports','ENUM'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5802,0x116));var _0x2580=function(_0x4a1835,_0xe4a237){_0x4a1835=_0x4a1835-0x0;var _0x203f1b=_0x5802[_0x4a1835];return _0x203f1b;};'use strict';var Sequelize=require(_0x2580('0x0'));var moment=require(_0x2580('0x1'));module[_0x2580('0x2')]={'type':{'type':Sequelize[_0x2580('0x3')]('blind',_0x2580('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x2580('0x5')]},'transferercalleridname':{'type':Sequelize[_0x2580('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2580('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x2580('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x2580('0x5')]},'transferercontext':{'type':Sequelize[_0x2580('0x5')]},'transfererexten':{'type':Sequelize[_0x2580('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2580('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x2580('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x2580('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2580('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2580('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x2580('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x2580('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x2580('0x5')]},'isexternal':{'type':Sequelize[_0x2580('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2580('0x5')]}}; \ No newline at end of file +var _0xfa2c=['Yes','sequelize','moment','exports','ENUM','attended','STRING'];(function(_0x55701e,_0x25167e){var _0x409cf9=function(_0x31f1c4){while(--_0x31f1c4){_0x55701e['push'](_0x55701e['shift']());}};_0x409cf9(++_0x25167e);}(_0xfa2c,0x135));var _0xcfa2=function(_0x380192,_0x2764e5){_0x380192=_0x380192-0x0;var _0x22fae4=_0xfa2c[_0x380192];return _0x22fae4;};'use strict';var Sequelize=require(_0xcfa2('0x0'));var moment=require(_0xcfa2('0x1'));module[_0xcfa2('0x2')]={'type':{'type':Sequelize[_0xcfa2('0x3')]('blind',_0xcfa2('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xcfa2('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xcfa2('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xcfa2('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xcfa2('0x5')]},'transfererexten':{'type':Sequelize[_0xcfa2('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xcfa2('0x5')]},'transfereechannel':{'type':Sequelize[_0xcfa2('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xcfa2('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xcfa2('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xcfa2('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xcfa2('0x5')]},'isexternal':{'type':Sequelize[_0xcfa2('0x3')](_0xcfa2('0x6'),'No')},'context':{'type':Sequelize[_0xcfa2('0x5')]},'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 3da9b70..9832ecd 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 _0x6143=['Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','update','find','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set'];(function(_0x1c5ab4,_0xbc9007){var _0x1f1e56=function(_0x14c306){while(--_0x14c306){_0x1c5ab4['push'](_0x1c5ab4['shift']());}};_0x1f1e56(++_0xbc9007);}(_0x6143,0xc3));var _0x3614=function(_0x59546d,_0x486f1f){_0x59546d=_0x59546d-0x0;var _0x14b001=_0x6143[_0x59546d];return _0x14b001;};'use strict';var emlformat=require(_0x3614('0x0'));var rimraf=require(_0x3614('0x1'));var zipdir=require(_0x3614('0x2'));var jsonpatch=require(_0x3614('0x3'));var rp=require('request-promise');var moment=require(_0x3614('0x4'));var BPromise=require(_0x3614('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3614('0x6'));var sox=require('sox');var csv=require(_0x3614('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3614('0x8'));var _=require(_0x3614('0x9'));var squel=require(_0x3614('0xa'));var crypto=require(_0x3614('0xb'));var jsforce=require(_0x3614('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3614('0x7'));var querystring=require(_0x3614('0xd'));var Papa=require(_0x3614('0xe'));var Redis=require(_0x3614('0xf'));var authService=require(_0x3614('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3614('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3614('0x12'))('api');var utils=require(_0x3614('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3614('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139559,_0x30357c){_0x30357c=_0x30357c||0xcc;return function(_0x19b0b5){if(_0x19b0b5){return _0x139559[_0x3614('0x15')](_0x30357c);}return _0x139559['status'](_0x30357c)[_0x3614('0x16')]();};}function respondWithResult(_0x34c637,_0xd8295e){_0xd8295e=_0xd8295e||0xc8;return function(_0x800ec6){if(_0x800ec6){return _0x34c637[_0x3614('0x17')](_0xd8295e)[_0x3614('0x18')](_0x800ec6);}};}function respondWithFilteredResult(_0x232d76,_0x412a3a){return function(_0x16abab){if(_0x16abab){var _0x309cfd=typeof _0x412a3a['offset']===_0x3614('0x19')&&typeof _0x412a3a['limit']===_0x3614('0x19');var _0x5f5835=_0x16abab[_0x3614('0x1a')];var _0x1f0fa4=_0x309cfd?0x0:_0x412a3a['offset'];var _0x33f63c=_0x309cfd?_0x16abab[_0x3614('0x1a')]:_0x412a3a[_0x3614('0x1b')]+_0x412a3a[_0x3614('0x1c')];var _0x10453c;if(_0x33f63c>=_0x5f5835){_0x33f63c=_0x5f5835;_0x10453c=0xc8;}else{_0x10453c=0xce;}_0x232d76[_0x3614('0x17')](_0x10453c);return _0x232d76[_0x3614('0x1d')](_0x3614('0x1e'),_0x1f0fa4+'-'+_0x33f63c+'/'+_0x5f5835)[_0x3614('0x18')](_0x16abab);}return null;};}function patchUpdates(_0x4aefc5){return function(_0x544e7c){try{jsonpatch[_0x3614('0x1f')](_0x544e7c,_0x4aefc5,!![]);}catch(_0x185cc1){return BPromise[_0x3614('0x20')](_0x185cc1);}return _0x544e7c[_0x3614('0x21')]();};}function saveUpdates(_0x571647,_0x3b62b9){return function(_0xe2552d){if(_0xe2552d){return _0xe2552d['update'](_0x571647)[_0x3614('0x22')](function(_0x424ea8){return _0x424ea8;});}return null;};}function removeEntity(_0x4d690f,_0x1b2f95){return function(_0x23eab0){if(_0x23eab0){return _0x23eab0[_0x3614('0x23')]()[_0x3614('0x22')](function(){_0x4d690f['status'](0xcc)[_0x3614('0x16')]();});}};}function handleEntityNotFound(_0x2d1b9e,_0x3e7b4e){return function(_0x5a1875){if(!_0x5a1875){_0x2d1b9e[_0x3614('0x15')](0x194);}return _0x5a1875;};}function handleError(_0x22da7a,_0x54a59b){_0x54a59b=_0x54a59b||0x1f4;return function(_0x3b4930){logger[_0x3614('0x24')](_0x3b4930[_0x3614('0x25')]);if(_0x3b4930['name']){delete _0x3b4930[_0x3614('0x26')];}_0x22da7a[_0x3614('0x17')](_0x54a59b)[_0x3614('0x27')](_0x3b4930);};}exports[_0x3614('0x28')]=function(_0x1f5d0f,_0x778ba){var _0xe08258={},_0x5ab7bd={},_0x99f91={'count':0x0,'rows':[]};var _0x1871cc=_['map'](db[_0x3614('0x29')][_0x3614('0x2a')],function(_0x13e85b){return{'name':_0x13e85b['fieldName'],'type':_0x13e85b[_0x3614('0x2b')][_0x3614('0x2c')]};});_0x5ab7bd[_0x3614('0x2d')]=_[_0x3614('0x2e')](_0x1871cc,_0x3614('0x26'));_0x5ab7bd[_0x3614('0x2f')]=_[_0x3614('0x30')](_0x1f5d0f['query']);_0x5ab7bd[_0x3614('0x31')]=_[_0x3614('0x32')](_0x5ab7bd[_0x3614('0x2d')],_0x5ab7bd[_0x3614('0x2f')]);_0xe08258[_0x3614('0x33')]=_[_0x3614('0x32')](_0x5ab7bd[_0x3614('0x2d')],qs[_0x3614('0x34')](_0x1f5d0f[_0x3614('0x2f')][_0x3614('0x34')]));_0xe08258[_0x3614('0x33')]=_0xe08258[_0x3614('0x33')][_0x3614('0x35')]?_0xe08258[_0x3614('0x33')]:_0x5ab7bd[_0x3614('0x2d')];if(!_0x1f5d0f[_0x3614('0x2f')][_0x3614('0x36')](_0x3614('0x37'))){_0xe08258[_0x3614('0x1c')]=qs[_0x3614('0x1c')](_0x1f5d0f[_0x3614('0x2f')][_0x3614('0x1c')]);_0xe08258[_0x3614('0x1b')]=qs['offset'](_0x1f5d0f[_0x3614('0x2f')][_0x3614('0x1b')]);}_0xe08258[_0x3614('0x38')]=qs[_0x3614('0x39')](_0x1f5d0f[_0x3614('0x2f')][_0x3614('0x39')]);_0xe08258[_0x3614('0x3a')]=qs[_0x3614('0x31')](_['pick'](_0x1f5d0f[_0x3614('0x2f')],_0x5ab7bd['filters']),_0x1871cc);if(_0x1f5d0f[_0x3614('0x2f')]['filter']){_0xe08258[_0x3614('0x3a')]=_[_0x3614('0x3b')](_0xe08258[_0x3614('0x3a')],{'$or':_[_0x3614('0x2e')](_0x1871cc,function(_0x2e0de){if(_0x2e0de[_0x3614('0x2b')]!==_0x3614('0x3c')){var _0x16b5cd={};_0x16b5cd[_0x2e0de[_0x3614('0x26')]]={'$like':'%'+_0x1f5d0f['query'][_0x3614('0x3d')]+'%'};return _0x16b5cd;}})});}_0xe08258=_[_0x3614('0x3b')]({},_0xe08258,_0x1f5d0f[_0x3614('0x3e')]);var _0x4b6099={'where':_0xe08258['where']};return db[_0x3614('0x29')][_0x3614('0x1a')](_0x4b6099)[_0x3614('0x22')](function(_0x4040f6){_0x99f91[_0x3614('0x1a')]=_0x4040f6;if(_0x1f5d0f[_0x3614('0x2f')][_0x3614('0x3f')]){_0xe08258[_0x3614('0x40')]=[{'all':!![]}];}return db[_0x3614('0x29')][_0x3614('0x41')](_0xe08258);})[_0x3614('0x22')](function(_0x5907c3){_0x99f91[_0x3614('0x42')]=_0x5907c3;return _0x99f91;})[_0x3614('0x22')](respondWithFilteredResult(_0x778ba,_0xe08258))['catch'](handleError(_0x778ba,null));};exports[_0x3614('0x43')]=function(_0x3049cb,_0x86befa){var _0x443685={'raw':!![],'where':{'id':_0x3049cb[_0x3614('0x44')]['id']}},_0x226964={};_0x226964[_0x3614('0x2d')]=_['keys'](db[_0x3614('0x29')]['rawAttributes']);_0x226964[_0x3614('0x2f')]=_[_0x3614('0x30')](_0x3049cb[_0x3614('0x2f')]);_0x226964['filters']=_['intersection'](_0x226964['model'],_0x226964['query']);_0x443685['attributes']=_[_0x3614('0x32')](_0x226964[_0x3614('0x2d')],qs['fields'](_0x3049cb[_0x3614('0x2f')][_0x3614('0x34')]));_0x443685[_0x3614('0x33')]=_0x443685['attributes'][_0x3614('0x35')]?_0x443685[_0x3614('0x33')]:_0x226964[_0x3614('0x2d')];if(_0x3049cb[_0x3614('0x2f')][_0x3614('0x3f')]){_0x443685[_0x3614('0x40')]=[{'all':!![]}];}_0x443685=_['merge']({},_0x443685,_0x3049cb[_0x3614('0x3e')]);return db[_0x3614('0x29')]['find'](_0x443685)[_0x3614('0x22')](handleEntityNotFound(_0x86befa,null))['then'](respondWithResult(_0x86befa,null))['catch'](handleError(_0x86befa,null));};exports['create']=function(_0xb2aafe,_0x2ab025){return db[_0x3614('0x29')][_0x3614('0x45')](_0xb2aafe[_0x3614('0x46')],{})[_0x3614('0x22')](respondWithResult(_0x2ab025,0xc9))['catch'](handleError(_0x2ab025,null));};exports[_0x3614('0x47')]=function(_0x174361,_0x459e91){if(_0x174361['body']['id']){delete _0x174361[_0x3614('0x46')]['id'];}return db[_0x3614('0x29')][_0x3614('0x48')]({'where':{'id':_0x174361[_0x3614('0x44')]['id']}})[_0x3614('0x22')](handleEntityNotFound(_0x459e91,null))['then'](saveUpdates(_0x174361[_0x3614('0x46')],null))[_0x3614('0x22')](respondWithResult(_0x459e91,null))[_0x3614('0x49')](handleError(_0x459e91,null));};exports['destroy']=function(_0x4ecfa6,_0x989403){return db[_0x3614('0x29')]['find']({'where':{'id':_0x4ecfa6[_0x3614('0x44')]['id']}})[_0x3614('0x22')](handleEntityNotFound(_0x989403,null))['then'](removeEntity(_0x989403,null))[_0x3614('0x49')](handleError(_0x989403,null));};exports[_0x3614('0x4a')]=function(_0x5cda3d,_0x1dd82b){return db[_0x3614('0x29')]['describe']()[_0x3614('0x22')](respondWithResult(_0x1dd82b,null))[_0x3614('0x49')](handleError(_0x1dd82b,null));}; \ No newline at end of file +var _0x0a4d=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','VoiceTransferReport','include','findAll','rows','show','params','keys','intersection','includeAll','create','body','catch','find','destroy','describe','rimraf','fast-json-patch','moment','bluebird'];(function(_0x5929e8,_0x5e6795){var _0x2c48f3=function(_0x2e40fc){while(--_0x2e40fc){_0x5929e8['push'](_0x5929e8['shift']());}};_0x2c48f3(++_0x5e6795);}(_0x0a4d,0x138));var _0xd0a4=function(_0x44df86,_0x3a532c){_0x44df86=_0x44df86-0x0;var _0x1f4bf2=_0x0a4d[_0x44df86];return _0x1f4bf2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0a4('0x1'));var rp=require('request-promise');var moment=require(_0xd0a4('0x2'));var BPromise=require(_0xd0a4('0x3'));var Mustache=require(_0xd0a4('0x4'));var util=require(_0xd0a4('0x5'));var path=require(_0xd0a4('0x6'));var sox=require(_0xd0a4('0x7'));var csv=require(_0xd0a4('0x8'));var ejs=require(_0xd0a4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0a4('0xa'));var _=require(_0xd0a4('0xb'));var squel=require(_0xd0a4('0xc'));var crypto=require(_0xd0a4('0xd'));var jsforce=require(_0xd0a4('0xe'));var deskjs=require(_0xd0a4('0xf'));var toCsv=require(_0xd0a4('0x8'));var querystring=require(_0xd0a4('0x10'));var Papa=require(_0xd0a4('0x11'));var Redis=require(_0xd0a4('0x12'));var authService=require(_0xd0a4('0x13'));var qs=require(_0xd0a4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0a4('0x15'));var logger=require(_0xd0a4('0x16'))(_0xd0a4('0x17'));var utils=require(_0xd0a4('0x18'));var config=require(_0xd0a4('0x19'));var licenseUtil=require(_0xd0a4('0x1a'));var db=require(_0xd0a4('0x1b'))['db'];function respondWithStatusCode(_0xe7ad2d,_0x582d10){_0x582d10=_0x582d10||0xcc;return function(_0x1309cd){if(_0x1309cd){return _0xe7ad2d[_0xd0a4('0x1c')](_0x582d10);}return _0xe7ad2d[_0xd0a4('0x1d')](_0x582d10)[_0xd0a4('0x1e')]();};}function respondWithResult(_0x328704,_0x42e679){_0x42e679=_0x42e679||0xc8;return function(_0xd37166){if(_0xd37166){return _0x328704['status'](_0x42e679)[_0xd0a4('0x1f')](_0xd37166);}};}function respondWithFilteredResult(_0x33d519,_0x1c9246){return function(_0x96a05c){if(_0x96a05c){var _0x445e78=typeof _0x1c9246[_0xd0a4('0x20')]===_0xd0a4('0x21')&&typeof _0x1c9246[_0xd0a4('0x22')]===_0xd0a4('0x21');var _0x25d11e=_0x96a05c[_0xd0a4('0x23')];var _0x15f655=_0x445e78?0x0:_0x1c9246['offset'];var _0x2546d9=_0x445e78?_0x96a05c[_0xd0a4('0x23')]:_0x1c9246[_0xd0a4('0x20')]+_0x1c9246[_0xd0a4('0x22')];var _0x7ced3c;if(_0x2546d9>=_0x25d11e){_0x2546d9=_0x25d11e;_0x7ced3c=0xc8;}else{_0x7ced3c=0xce;}_0x33d519[_0xd0a4('0x1d')](_0x7ced3c);return _0x33d519[_0xd0a4('0x24')](_0xd0a4('0x25'),_0x15f655+'-'+_0x2546d9+'/'+_0x25d11e)['json'](_0x96a05c);}return null;};}function patchUpdates(_0x5200ca){return function(_0x3fcb88){try{jsonpatch[_0xd0a4('0x26')](_0x3fcb88,_0x5200ca,!![]);}catch(_0x1cebd6){return BPromise[_0xd0a4('0x27')](_0x1cebd6);}return _0x3fcb88[_0xd0a4('0x28')]();};}function saveUpdates(_0x549002,_0x5b6a19){return function(_0x5b7420){if(_0x5b7420){return _0x5b7420[_0xd0a4('0x29')](_0x549002)[_0xd0a4('0x2a')](function(_0x17b384){return _0x17b384;});}return null;};}function removeEntity(_0x3db7a7,_0x3e5a42){return function(_0x33d6ed){if(_0x33d6ed){return _0x33d6ed['destroy']()[_0xd0a4('0x2a')](function(){_0x3db7a7[_0xd0a4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491b95,_0x44189a){return function(_0x127181){if(!_0x127181){_0x491b95[_0xd0a4('0x1c')](0x194);}return _0x127181;};}function handleError(_0x545f8d,_0x177aea){_0x177aea=_0x177aea||0x1f4;return function(_0x466539){logger['error'](_0x466539[_0xd0a4('0x2b')]);if(_0x466539[_0xd0a4('0x2c')]){delete _0x466539[_0xd0a4('0x2c')];}_0x545f8d[_0xd0a4('0x1d')](_0x177aea)[_0xd0a4('0x2d')](_0x466539);};}exports[_0xd0a4('0x2e')]=function(_0x4f6ffc,_0xffdfab){var _0xf6bac9={},_0x579dd0={},_0x59bb89={'count':0x0,'rows':[]};var _0x50210c=_['map'](db['VoiceTransferReport'][_0xd0a4('0x2f')],function(_0x2df196){return{'name':_0x2df196['fieldName'],'type':_0x2df196[_0xd0a4('0x30')][_0xd0a4('0x31')]};});_0x579dd0[_0xd0a4('0x32')]=_[_0xd0a4('0x33')](_0x50210c,_0xd0a4('0x2c'));_0x579dd0['query']=_['keys'](_0x4f6ffc[_0xd0a4('0x34')]);_0x579dd0[_0xd0a4('0x35')]=_['intersection'](_0x579dd0[_0xd0a4('0x32')],_0x579dd0[_0xd0a4('0x34')]);_0xf6bac9[_0xd0a4('0x36')]=_['intersection'](_0x579dd0[_0xd0a4('0x32')],qs[_0xd0a4('0x37')](_0x4f6ffc[_0xd0a4('0x34')][_0xd0a4('0x37')]));_0xf6bac9[_0xd0a4('0x36')]=_0xf6bac9[_0xd0a4('0x36')][_0xd0a4('0x38')]?_0xf6bac9[_0xd0a4('0x36')]:_0x579dd0[_0xd0a4('0x32')];if(!_0x4f6ffc[_0xd0a4('0x34')]['hasOwnProperty'](_0xd0a4('0x39'))){_0xf6bac9[_0xd0a4('0x22')]=qs['limit'](_0x4f6ffc['query'][_0xd0a4('0x22')]);_0xf6bac9[_0xd0a4('0x20')]=qs['offset'](_0x4f6ffc['query'][_0xd0a4('0x20')]);}_0xf6bac9[_0xd0a4('0x3a')]=qs['sort'](_0x4f6ffc[_0xd0a4('0x34')]['sort']);_0xf6bac9[_0xd0a4('0x3b')]=qs[_0xd0a4('0x35')](_[_0xd0a4('0x3c')](_0x4f6ffc[_0xd0a4('0x34')],_0x579dd0[_0xd0a4('0x35')]),_0x50210c);if(_0x4f6ffc[_0xd0a4('0x34')][_0xd0a4('0x3d')]){_0xf6bac9[_0xd0a4('0x3b')]=_[_0xd0a4('0x3e')](_0xf6bac9[_0xd0a4('0x3b')],{'$or':_[_0xd0a4('0x33')](_0x50210c,function(_0x535fa5){if(_0x535fa5[_0xd0a4('0x30')]!=='VIRTUAL'){var _0x3b1350={};_0x3b1350[_0x535fa5[_0xd0a4('0x2c')]]={'$like':'%'+_0x4f6ffc[_0xd0a4('0x34')][_0xd0a4('0x3d')]+'%'};return _0x3b1350;}})});}_0xf6bac9=_[_0xd0a4('0x3e')]({},_0xf6bac9,_0x4f6ffc[_0xd0a4('0x3f')]);var _0x55395a={'where':_0xf6bac9[_0xd0a4('0x3b')]};return db[_0xd0a4('0x40')][_0xd0a4('0x23')](_0x55395a)['then'](function(_0x192e00){_0x59bb89[_0xd0a4('0x23')]=_0x192e00;if(_0x4f6ffc[_0xd0a4('0x34')]['includeAll']){_0xf6bac9[_0xd0a4('0x41')]=[{'all':!![]}];}return db[_0xd0a4('0x40')][_0xd0a4('0x42')](_0xf6bac9);})['then'](function(_0x199e24){_0x59bb89[_0xd0a4('0x43')]=_0x199e24;return _0x59bb89;})[_0xd0a4('0x2a')](respondWithFilteredResult(_0xffdfab,_0xf6bac9))['catch'](handleError(_0xffdfab,null));};exports[_0xd0a4('0x44')]=function(_0x4a263a,_0x1189aa){var _0x52a766={'raw':!![],'where':{'id':_0x4a263a[_0xd0a4('0x45')]['id']}},_0x3e229b={};_0x3e229b[_0xd0a4('0x32')]=_['keys'](db['VoiceTransferReport'][_0xd0a4('0x2f')]);_0x3e229b['query']=_[_0xd0a4('0x46')](_0x4a263a['query']);_0x3e229b[_0xd0a4('0x35')]=_[_0xd0a4('0x47')](_0x3e229b[_0xd0a4('0x32')],_0x3e229b[_0xd0a4('0x34')]);_0x52a766[_0xd0a4('0x36')]=_[_0xd0a4('0x47')](_0x3e229b['model'],qs[_0xd0a4('0x37')](_0x4a263a[_0xd0a4('0x34')][_0xd0a4('0x37')]));_0x52a766[_0xd0a4('0x36')]=_0x52a766[_0xd0a4('0x36')]['length']?_0x52a766[_0xd0a4('0x36')]:_0x3e229b[_0xd0a4('0x32')];if(_0x4a263a['query'][_0xd0a4('0x48')]){_0x52a766[_0xd0a4('0x41')]=[{'all':!![]}];}_0x52a766=_[_0xd0a4('0x3e')]({},_0x52a766,_0x4a263a['options']);return db[_0xd0a4('0x40')]['find'](_0x52a766)[_0xd0a4('0x2a')](handleEntityNotFound(_0x1189aa,null))['then'](respondWithResult(_0x1189aa,null))['catch'](handleError(_0x1189aa,null));};exports['create']=function(_0x41d078,_0x5d2e09){return db['VoiceTransferReport'][_0xd0a4('0x49')](_0x41d078[_0xd0a4('0x4a')],{})[_0xd0a4('0x2a')](respondWithResult(_0x5d2e09,0xc9))[_0xd0a4('0x4b')](handleError(_0x5d2e09,null));};exports[_0xd0a4('0x29')]=function(_0x420ddd,_0x1fc4c2){if(_0x420ddd[_0xd0a4('0x4a')]['id']){delete _0x420ddd[_0xd0a4('0x4a')]['id'];}return db[_0xd0a4('0x40')][_0xd0a4('0x4c')]({'where':{'id':_0x420ddd['params']['id']}})[_0xd0a4('0x2a')](handleEntityNotFound(_0x1fc4c2,null))[_0xd0a4('0x2a')](saveUpdates(_0x420ddd[_0xd0a4('0x4a')],null))[_0xd0a4('0x2a')](respondWithResult(_0x1fc4c2,null))[_0xd0a4('0x4b')](handleError(_0x1fc4c2,null));};exports[_0xd0a4('0x4d')]=function(_0x5776ed,_0x213347){return db['VoiceTransferReport'][_0xd0a4('0x4c')]({'where':{'id':_0x5776ed[_0xd0a4('0x45')]['id']}})['then'](handleEntityNotFound(_0x213347,null))[_0xd0a4('0x2a')](removeEntity(_0x213347,null))['catch'](handleError(_0x213347,null));};exports[_0xd0a4('0x4e')]=function(_0x212199,_0x3b73f3){return db['VoiceTransferReport'][_0xd0a4('0x4e')]()[_0xd0a4('0x2a')](respondWithResult(_0x3b73f3,null))['catch'](handleError(_0x3b73f3,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1f86647..56b7806 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 _0xea4b=['define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x5a9bbb,_0x2c6cda){var _0x4fb028=function(_0x82745f){while(--_0x82745f){_0x5a9bbb['push'](_0x5a9bbb['shift']());}};_0x4fb028(++_0x2c6cda);}(_0xea4b,0xda));var _0xbea4=function(_0x304655,_0x15b109){_0x304655=_0x304655-0x0;var _0x2fa58a=_0xea4b[_0x304655];return _0x2fa58a;};'use strict';var _=require(_0xbea4('0x0'));var util=require(_0xbea4('0x1'));var logger=require(_0xbea4('0x2'))(_0xbea4('0x3'));var moment=require(_0xbea4('0x4'));var BPromise=require('bluebird');var rp=require(_0xbea4('0x5'));var fs=require('fs');var path=require(_0xbea4('0x6'));var rimraf=require(_0xbea4('0x7'));var config=require(_0xbea4('0x8'));var attributes=require(_0xbea4('0x9'));module['exports']=function(_0x2063b7,_0x288a80){return _0x2063b7[_0xbea4('0xa')](_0xbea4('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x275d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x275d,0x1da));var _0xd275=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x275d[_0x4480b9];return _0x3f0f02;};'use strict';var _=require(_0xd275('0x0'));var util=require(_0xd275('0x1'));var logger=require(_0xd275('0x2'))(_0xd275('0x3'));var moment=require('moment');var BPromise=require(_0xd275('0x4'));var rp=require(_0xd275('0x5'));var fs=require('fs');var path=require(_0xd275('0x6'));var rimraf=require(_0xd275('0x7'));var config=require(_0xd275('0x8'));var attributes=require(_0xd275('0x9'));module[_0xd275('0xa')]=function(_0x1b0338,_0x34c38c){return _0x1b0338[_0xd275('0xb')](_0xd275('0xc'),attributes,{'tableName':_0xd275('0xd'),'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 4ce6ebf..68b5ed5 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 _0x7a55=['client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','code','message','error','catch','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x10283d,_0x3a4257){var _0x496087=function(_0x40c498){while(--_0x40c498){_0x10283d['push'](_0x10283d['shift']());}};_0x496087(++_0x3a4257);}(_0x7a55,0x156));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x57a5('0x0'));var util=require('util');var moment=require(_0x57a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x57a5('0x2'));var fs=require('fs');var Redis=require(_0x57a5('0x3'));var db=require(_0x57a5('0x4'))['db'];var utils=require(_0x57a5('0x5'));var logger=require(_0x57a5('0x6'))(_0x57a5('0x7'));var config=require(_0x57a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x57a5('0x9')][_0x57a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x488244,_0xa89eb9,_0x41fa0e){return new BPromise(function(_0x5a0879,_0x48b32a){return client[_0x57a5('0xb')](_0x488244,_0x41fa0e)[_0x57a5('0xc')](function(_0x162fcb){logger[_0x57a5('0xd')](_0x57a5('0xe'),_0xa89eb9,_0x57a5('0xf'));logger[_0x57a5('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xa89eb9,_0x57a5('0xf'),JSON['stringify'](_0x162fcb));if(_0x162fcb['error']){if(_0x162fcb['error'][_0x57a5('0x11')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xa89eb9,_0x162fcb['error'][_0x57a5('0x12')]);return _0x48b32a(_0x162fcb['error'][_0x57a5('0x12')]);}logger['error'](_0x57a5('0xe'),_0xa89eb9,_0x162fcb[_0x57a5('0x13')][_0x57a5('0x12')]);return _0x5a0879(_0x162fcb[_0x57a5('0x13')][_0x57a5('0x12')]);}else{logger[_0x57a5('0xd')](_0x57a5('0xe'),_0xa89eb9,'request\x20sent');_0x5a0879(_0x162fcb['result'][_0x57a5('0x12')]);}})[_0x57a5('0x14')](function(_0x5bd5f5){logger['error'](_0x57a5('0xe'),_0xa89eb9,_0x5bd5f5);_0x48b32a(_0x5bd5f5);});});}exports['CreateVoiceTransferReport']=function(_0x2f5cc8){var _0x3feb99=this;return new Promise(function(_0x498c93,_0x5a4036){return db[_0x57a5('0x15')][_0x57a5('0x16')](_0x2f5cc8['body'],{'raw':_0x2f5cc8[_0x57a5('0x17')]?_0x2f5cc8[_0x57a5('0x17')][_0x57a5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x53efd){logger['info'](_0x57a5('0x19'),_0x2f5cc8);logger['debug'](_0x57a5('0x19'),_0x2f5cc8,JSON[_0x57a5('0x1a')](_0x53efd));_0x498c93(_0x53efd);})[_0x57a5('0x14')](function(_0x1ac63e){logger[_0x57a5('0x13')](_0x57a5('0x19'),_0x1ac63e[_0x57a5('0x12')],_0x2f5cc8);_0x5a4036(_0x3feb99[_0x57a5('0x13')](0x1f4,_0x1ac63e['message']));});});}; \ No newline at end of file +var _0x2189=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment'];(function(_0x66f73d,_0x2f3c76){var _0x5999d9=function(_0x1818c0){while(--_0x1818c0){_0x66f73d['push'](_0x66f73d['shift']());}};_0x5999d9(++_0x2f3c76);}(_0x2189,0x142));var _0x9218=function(_0x3cfa10,_0x2c0ddb){_0x3cfa10=_0x3cfa10-0x0;var _0x5dc234=_0x2189[_0x3cfa10];return _0x5dc234;};'use strict';var _=require('lodash');var util=require(_0x9218('0x0'));var moment=require(_0x9218('0x1'));var BPromise=require(_0x9218('0x2'));var rs=require(_0x9218('0x3'));var fs=require('fs');var Redis=require(_0x9218('0x4'));var db=require(_0x9218('0x5'))['db'];var utils=require(_0x9218('0x6'));var logger=require(_0x9218('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9218('0x8'));var client=jayson[_0x9218('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301901,_0x5bc984,_0x57b636){return new BPromise(function(_0x7a9176,_0x571c58){return client[_0x9218('0xa')](_0x301901,_0x57b636)[_0x9218('0xb')](function(_0x258ee0){logger[_0x9218('0xc')](_0x9218('0xd'),_0x5bc984,_0x9218('0xe'));logger[_0x9218('0xf')](_0x9218('0x10'),_0x5bc984,_0x9218('0xe'),JSON[_0x9218('0x11')](_0x258ee0));if(_0x258ee0['error']){if(_0x258ee0['error']['code']===0x1f4){logger[_0x9218('0x12')](_0x9218('0xd'),_0x5bc984,_0x258ee0[_0x9218('0x12')]['message']);return _0x571c58(_0x258ee0['error']['message']);}logger[_0x9218('0x12')](_0x9218('0xd'),_0x5bc984,_0x258ee0['error'][_0x9218('0x13')]);return _0x7a9176(_0x258ee0['error']['message']);}else{logger[_0x9218('0xc')](_0x9218('0xd'),_0x5bc984,_0x9218('0xe'));_0x7a9176(_0x258ee0['result'][_0x9218('0x13')]);}})[_0x9218('0x14')](function(_0x298bdf){logger[_0x9218('0x12')](_0x9218('0xd'),_0x5bc984,_0x298bdf);_0x571c58(_0x298bdf);});});}exports[_0x9218('0x15')]=function(_0x167ea9){var _0x2406be=this;return new Promise(function(_0xc23e4a,_0x22bedd){return db[_0x9218('0x16')][_0x9218('0x17')](_0x167ea9[_0x9218('0x18')],{'raw':_0x167ea9[_0x9218('0x19')]?_0x167ea9[_0x9218('0x19')][_0x9218('0x1a')]===undefined?!![]:![]:!![]})[_0x9218('0xb')](function(_0x28176a){logger[_0x9218('0xc')](_0x9218('0x15'),_0x167ea9);logger[_0x9218('0xf')](_0x9218('0x15'),_0x167ea9,JSON[_0x9218('0x11')](_0x28176a));_0xc23e4a(_0x28176a);})['catch'](function(_0x3cb0ea){logger['error']('CreateVoiceTransferReport',_0x3cb0ea['message'],_0x167ea9);_0x22bedd(_0x2406be[_0x9218('0x12')](0x1f4,_0x3cb0ea[_0x9218('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8907531..37e8689 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 _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x25c92b,_0x41b368){var _0xc59d85=function(_0x10b32d){while(--_0x10b32d){_0x25c92b['push'](_0x25c92b['shift']());}};_0xc59d85(++_0x41b368);}(_0x750a,0x140));var _0xa750=function(_0x451d3e,_0x2408c0){_0x451d3e=_0x451d3e-0x0;var _0x19ba69=_0x750a[_0x451d3e];return _0x19ba69;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('0xf')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x2d7116,_0x37bee1){var _0x522d5a=function(_0x34cba3){while(--_0x34cba3){_0x2d7116['push'](_0x2d7116['shift']());}};_0x522d5a(++_0x37bee1);}(_0xe14d,0x1ee));var _0xde14=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe14d[_0xb0f7c3];return _0x28ea68;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1c27e7d..e1cb828 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 _0xcffe=['transfer','transfer\x20fired:','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','catch','User','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','entityFound:','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','all'];(function(_0x50d1e9,_0x4d7f70){var _0x3d410b=function(_0x297f3a){while(--_0x297f3a){_0x50d1e9['push'](_0x50d1e9['shift']());}};_0x3d410b(++_0x4d7f70);}(_0xcffe,0x1a1));var _0xecff=function(_0x239b5a,_0x56199a){_0x239b5a=_0x239b5a-0x0;var _0x5a701c=_0xcffe[_0x239b5a];return _0x5a701c;};'use strict';var path=require(_0xecff('0x0'));var fs=require('fs');var _=require(_0xecff('0x1'));var db=require(_0xecff('0x2'))['db'];var config=require(_0xecff('0x3'));var util=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var jayson=require(_0xecff('0x6'));var amiClient=jayson[_0xecff('0x7')][_0xecff('0x8')]({'port':0x232a});var logger=require(_0xecff('0x9'))('webbarapi');var Redis=require('ioredis');config[_0xecff('0xa')]=_[_0xecff('0xb')](config[_0xecff('0xa')],{'host':_0xecff('0xc'),'port':0x18eb});var io=require(_0xecff('0xd'))(new Redis(config[_0xecff('0xa')]));var Schema=require(_0xecff('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xecff('0xf')]},'callNumber':{'type':_0xecff('0x10'),'required':[!![],_0xecff('0x11')]},'callerId':{'type':_0xecff('0x10')},'callbackUrl':{'type':_0xecff('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':[!![],_0xecff('0x13')]},'transferNumber':{'type':_0xecff('0x10'),'required':[!![],_0xecff('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]}});function emit(_0x3a7623,_0x596b09,_0x52b62f){logger[_0xecff('0x15')](_0x3a7623,_0x596b09,JSON[_0xecff('0x16')](_0x52b62f));io['to'](_0x3a7623)['emit'](_0x596b09,_0x52b62f);}function handleError(_0x42d6c1){return function(_0x3adc81){console[_0xecff('0x17')](_0xecff('0x18'),_0x3adc81,_0x3adc81 instanceof RangeError);logger[_0xecff('0x19')](_0x3adc81[_0xecff('0x1a')]);if(_0x3adc81 instanceof RangeError){if(_0x3adc81['name']){delete _0x3adc81[_0xecff('0x1b')];}_0x42d6c1[_0xecff('0x1c')](0x194)[_0xecff('0x1d')](_0x3adc81);}else{if(_0x3adc81[_0xecff('0x1b')]){delete _0x3adc81['name'];}_0x42d6c1[_0xecff('0x1c')](0x1f4)[_0xecff('0x1d')](_0x3adc81);}};}function checkError(){return function(_0x393acf){if(!_0x393acf){throw new RangeError(_0xecff('0x1e'));}return _0x393acf;};}function respondWithRpcPromise(_0x284458,_0x2402e0){return new BPromise(function(_0x494754,_0x14378d){var _0x520d6d=amiClient;return _0x520d6d['request'](_0x284458,_0x2402e0)[_0xecff('0x1f')](function(_0x4fdc8e){if(_0x4fdc8e[_0xecff('0x19')]){if(_0x4fdc8e['error'][_0xecff('0x20')]===0x1f4){return _0x14378d(_0x4fdc8e['error'][_0xecff('0x21')]);}return _0x494754(_0x4fdc8e[_0xecff('0x19')]['message']);}else{_0x494754(_0x4fdc8e[_0xecff('0x22')]);}})[_0xecff('0x23')](function(_0x393312){_0x14378d(_0x393312);});});}function getAgent(_0x3cadb9){return db[_0xecff('0x24')]['findOne']({'where':{'id':_0x3cadb9,'role':'agent'}})[_0xecff('0x1f')](checkError());}function getAgentCheckSession(_0x484415,_0x1281d8){return new BPromise(function(_0x3ef198,_0x49a224){var _0x1dfeb6=respondWithRpcPromise('VoiceChannels');var _0x4e7afa=getAgent(_0x484415);Promise['all']([_0x1dfeb6,_0x4e7afa])[_0xecff('0x1f')](function(_0xabe5da){var _0x230d04=_0xabe5da[0x0];var _0x1e3175=_0xabe5da[0x1];var _0x5e70f3=_[_0xecff('0x25')](_0x230d04[_0xecff('0x26')],function(_0x1926a5){return _0x1926a5['UserId']==_0x1e3175['id']&&_0x1926a5[_0xecff('0x27')]==_0x1281d8;});if(_0x5e70f3[_0xecff('0x28')]==0x1){_0x3ef198(_0x1e3175);}else{_0x49a224(new RangeError(_0xecff('0x29')+_0x1281d8+_0xecff('0x2a')));}});});}exports['originate']=function(_0x7e7a6c,_0x350297){logger['info'](_0xecff('0x2b'),_0x7e7a6c[_0xecff('0x2c')]);var _0xaa3c9a=originateValidation[_0xecff('0xe')](_0x7e7a6c['body']);if(_0xaa3c9a[_0xecff('0x28')]>0x0){return _0x350297[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0xaa3c9a);}var _0x55c232=_0x7e7a6c[_0xecff('0x2c')][_0xecff('0x2e')];var _0x16ef80=_0x7e7a6c[_0xecff('0x2c')][_0xecff('0x2f')];var _0x20db12=_0x7e7a6c['body']['callerId'];var _0x4dd43c=_0x7e7a6c[_0xecff('0x2c')]['callbackUrl'];return getAgent(_0x55c232)[_0xecff('0x1f')](function(_0x21411b){logger['info'](_0xecff('0x30'),_0x21411b[_0xecff('0x1b')]);emit(util[_0xecff('0x31')]('user:%s',_0x21411b[_0xecff('0x1b')]),_0xecff('0x32'),{'callNumber':_0x16ef80,'callerId':_0x20db12,'callbackUrl':_0x4dd43c});return _0x350297[_0xecff('0x1c')](0xc8)['json']({'error':![],'message':_0xecff('0x33')});})[_0xecff('0x23')](handleError(_0x350297));};exports[_0xecff('0x34')]=function(_0x13a525,_0x317037){logger[_0xecff('0x15')](_0xecff('0x35'),_0x13a525[_0xecff('0x2c')]);var _0x6d3916=hangupValidation[_0xecff('0xe')](_0x13a525[_0xecff('0x2c')]);if(_0x6d3916['length']>0x0){return _0x317037[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x6d3916);}var _0x199019=_0x13a525[_0xecff('0x2c')][_0xecff('0x2e')];var _0x19626e=_0x13a525[_0xecff('0x2c')][_0xecff('0x27')];return getAgent(_0x199019)['then'](function(_0x28141f){logger['info'](_0xecff('0x30'),_0x28141f[_0xecff('0x1b')]);emit(util[_0xecff('0x31')](_0xecff('0x36'),_0x28141f[_0xecff('0x1b')]),_0xecff('0x37'),{'sessionId':_0x19626e});return _0x317037[_0xecff('0x1c')](0xc8)['json']({'error':![],'message':_0xecff('0x38')});})[_0xecff('0x23')](handleError(_0x317037));};exports['answer']=function(_0x4d4c7b,_0x3a7ebc){logger[_0xecff('0x15')](_0xecff('0x39'),_0x4d4c7b[_0xecff('0x2c')]);var _0x47084b=answerValidation[_0xecff('0xe')](_0x4d4c7b['body']);if(_0x47084b[_0xecff('0x28')]>0x0){return _0x3a7ebc[_0xecff('0x1c')](0x190)['json'](_0x47084b);}var _0x8b0f59=_0x4d4c7b[_0xecff('0x2c')][_0xecff('0x2e')];var _0x4402a0=_0x4d4c7b[_0xecff('0x2c')][_0xecff('0x27')];return getAgent(_0x8b0f59)['then'](function(_0x310593){logger[_0xecff('0x15')](_0xecff('0x30'),_0x310593['name']);emit(util[_0xecff('0x31')](_0xecff('0x36'),_0x310593[_0xecff('0x1b')]),_0xecff('0x3a'),{'sessionId':_0x4402a0});return _0x3a7ebc['status'](0xc8)[_0xecff('0x2d')]({'error':![],'message':_0xecff('0x3b')});})['catch'](handleError(_0x3a7ebc));};exports[_0xecff('0x3c')]=function(_0x1d2ac3,_0x4ba9e3){logger[_0xecff('0x15')]('hold\x20fired:',_0x1d2ac3[_0xecff('0x2c')]);var _0x3692c9=holdValidation[_0xecff('0xe')](_0x1d2ac3[_0xecff('0x2c')]);if(_0x3692c9[_0xecff('0x28')]>0x0){return _0x4ba9e3[_0xecff('0x1c')](0x190)['json'](_0x3692c9);}var _0x596eb8=_0x1d2ac3[_0xecff('0x2c')][_0xecff('0x2e')];var _0x1aae95=_0x1d2ac3[_0xecff('0x2c')][_0xecff('0x27')];return getAgent(_0x596eb8)[_0xecff('0x1f')](function(_0x36c50f){logger[_0xecff('0x15')]('entityFound:',_0x36c50f[_0xecff('0x1b')]);emit(util[_0xecff('0x31')]('user:%s',_0x36c50f[_0xecff('0x1b')]),'webbar:hold',{'sessionId':_0x1aae95});return _0x4ba9e3[_0xecff('0x1c')](0xc8)[_0xecff('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0xecff('0x23')](handleError(_0x4ba9e3));};exports[_0xecff('0x3d')]=function(_0x3e79f9,_0x188d08){logger[_0xecff('0x15')]('unhold\x20fired:',_0x3e79f9['body']);var _0x198ad6=unholdValidation[_0xecff('0xe')](_0x3e79f9[_0xecff('0x2c')]);if(_0x198ad6[_0xecff('0x28')]>0x0){return _0x188d08[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x198ad6);}var _0x339d3d=_0x3e79f9[_0xecff('0x2c')][_0xecff('0x2e')];var _0x4f9060=_0x3e79f9[_0xecff('0x2c')]['sessionId'];return getAgent(_0x339d3d)[_0xecff('0x1f')](function(_0x1ae9e3){logger[_0xecff('0x15')]('entityFound:',_0x1ae9e3[_0xecff('0x1b')]);emit(util['format'](_0xecff('0x36'),_0x1ae9e3['name']),'webbar:unhold',{'sessionId':_0x4f9060});return _0x188d08[_0xecff('0x1c')](0xc8)['json']({'error':![],'message':_0xecff('0x3e')});})[_0xecff('0x23')](handleError(_0x188d08));};exports['calls']=function(_0x2d0ed7,_0x3bdf47){logger[_0xecff('0x15')](_0xecff('0x3f'),_0x3bdf47[_0xecff('0x2c')]);var _0x162938=callsValidation[_0xecff('0xe')](_0x2d0ed7[_0xecff('0x2c')]);if(_0x162938['length']>0x0){return _0x3bdf47[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x162938);}var _0x18ead4=_0x2d0ed7[_0xecff('0x2c')][_0xecff('0x2e')];var _0x12d549=respondWithRpcPromise(_0xecff('0x40'));var _0x33bcb1=getAgent(_0x18ead4);return Promise[_0xecff('0x41')]([_0x12d549,_0x33bcb1])[_0xecff('0x1f')](function(_0xa48ffb){var _0x10939a=_0xa48ffb[0x0];var _0x3f8e22=_0xa48ffb[0x1];var _0x88882b=_['filter'](_0x10939a['rows'],function(_0x13ec0f){return _0x13ec0f['UserId']==_0x3f8e22['id'];});return _0x3bdf47['status'](0xc8)[_0xecff('0x2d')]({'count':_0x88882b[_0xecff('0x28')],'rows':_0x88882b});})[_0xecff('0x23')](handleError(_0x3bdf47));};exports['conference']=function(_0x161190,_0x1eabd0){logger[_0xecff('0x15')]('conference\x20fired:',_0x161190[_0xecff('0x2c')]);var _0x56eefb=conferenceValidation['validate'](_0x161190[_0xecff('0x2c')]);if(_0x56eefb[_0xecff('0x28')]>0x0){return _0x1eabd0[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x56eefb);}var _0x303a=_0x161190[_0xecff('0x2c')][_0xecff('0x2e')];return getAgent(_0x303a)[_0xecff('0x1f')](function(_0x345ceb){logger[_0xecff('0x15')](_0xecff('0x30'),_0x345ceb[_0xecff('0x1b')]);emit(util[_0xecff('0x31')](_0xecff('0x36'),_0x345ceb['name']),'webbar:conference');return _0x1eabd0[_0xecff('0x1c')](0xc8)[_0xecff('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0xecff('0x23')](handleError(_0x1eabd0));};exports[_0xecff('0x42')]=function(_0x59857d,_0x148c69){logger[_0xecff('0x15')](_0xecff('0x43'),_0x59857d[_0xecff('0x2c')]);var _0x20e8ab=transferValidation[_0xecff('0xe')](_0x59857d['body']);if(_0x20e8ab[_0xecff('0x28')]>0x0){return _0x148c69[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x20e8ab);}var _0x3c333c=_0x59857d[_0xecff('0x2c')]['userId'];var _0x31cd2d=_0x59857d[_0xecff('0x2c')][_0xecff('0x27')];var _0x3e54b8=_0x59857d['body']['transferNumber'];return getAgent(_0x3c333c)['then'](function(_0x3882cf){logger[_0xecff('0x15')](_0xecff('0x30'),_0x3882cf['name']);emit(util[_0xecff('0x31')]('user:%s',_0x3882cf[_0xecff('0x1b')]),_0xecff('0x44'),{'sessionId':_0x31cd2d,'transferNumber':_0x3e54b8});return _0x148c69[_0xecff('0x1c')](0xc8)[_0xecff('0x2d')]({'error':![],'message':'transfer\x20executed!'});})[_0xecff('0x23')](handleError(_0x148c69));}; \ No newline at end of file +var _0x4746=['VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','path','lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','string','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','catch','User','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','json','userId','callbackUrl','entityFound:','originate\x20executed!','hangup','hangup\x20fired:','format','user:%s','hangup\x20executed!','answer\x20fired:','hold','webbar:hold','hold\x20executed!','webbar:unhold','calls\x20fired:'];(function(_0x5b4c5d,_0x10026d){var _0x194ef4=function(_0x10fbdd){while(--_0x10fbdd){_0x5b4c5d['push'](_0x5b4c5d['shift']());}};_0x194ef4(++_0x10026d);}(_0x4746,0xc6));var _0x6474=function(_0x380a22,_0x5776a2){_0x380a22=_0x380a22-0x0;var _0x364c8c=_0x4746[_0x380a22];return _0x364c8c;};'use strict';var path=require(_0x6474('0x0'));var fs=require('fs');var _=require(_0x6474('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x6474('0x2'));var util=require('util');var BPromise=require(_0x6474('0x3'));var jayson=require(_0x6474('0x4'));var amiClient=jayson[_0x6474('0x5')][_0x6474('0x6')]({'port':0x232a});var logger=require(_0x6474('0x7'))('webbarapi');var Redis=require(_0x6474('0x8'));config[_0x6474('0x9')]=_['defaults'](config[_0x6474('0x9')],{'host':_0x6474('0xa'),'port':0x18eb});var io=require(_0x6474('0xb'))(new Redis(config[_0x6474('0x9')]));var Schema=require(_0x6474('0xc'));var originateValidation=new Schema({'userId':{'type':_0x6474('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x6474('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x6474('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x6474('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6474('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6474('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6474('0xd'),'required':[!![],_0x6474('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x6474('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6474('0xd'),'required':[!![],_0x6474('0xf')]},'sessionId':{'type':_0x6474('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6474('0xd'),'required':[!![],_0x6474('0xf')]},'sessionId':{'type':_0x6474('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6474('0xd'),'required':[!![],_0x6474('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x583afa,_0x205df7,_0x9a7ff1){logger[_0x6474('0x11')](_0x583afa,_0x205df7,JSON[_0x6474('0x12')](_0x9a7ff1));io['to'](_0x583afa)[_0x6474('0x13')](_0x205df7,_0x9a7ff1);}function handleError(_0x502755){return function(_0x1505fc){console[_0x6474('0x14')](_0x6474('0x15'),_0x1505fc,_0x1505fc instanceof RangeError);logger[_0x6474('0x16')](_0x1505fc[_0x6474('0x17')]);if(_0x1505fc instanceof RangeError){if(_0x1505fc[_0x6474('0x18')]){delete _0x1505fc[_0x6474('0x18')];}_0x502755[_0x6474('0x19')](0x194)['send'](_0x1505fc);}else{if(_0x1505fc[_0x6474('0x18')]){delete _0x1505fc['name'];}_0x502755[_0x6474('0x19')](0x1f4)[_0x6474('0x1a')](_0x1505fc);}};}function checkError(){return function(_0x2be8fe){if(!_0x2be8fe){throw new RangeError(_0x6474('0x1b'));}return _0x2be8fe;};}function respondWithRpcPromise(_0x271b12,_0x171fc8){return new BPromise(function(_0x382ebf,_0x5d0e5c){var _0xf3cd65=amiClient;return _0xf3cd65['request'](_0x271b12,_0x171fc8)[_0x6474('0x1c')](function(_0x4dc277){if(_0x4dc277['error']){if(_0x4dc277['error'][_0x6474('0x1d')]===0x1f4){return _0x5d0e5c(_0x4dc277[_0x6474('0x16')][_0x6474('0x1e')]);}return _0x382ebf(_0x4dc277[_0x6474('0x16')][_0x6474('0x1e')]);}else{_0x382ebf(_0x4dc277['result']);}})[_0x6474('0x1f')](function(_0x388d2d){_0x5d0e5c(_0x388d2d);});});}function getAgent(_0x46bf4f){return db[_0x6474('0x20')]['findOne']({'where':{'id':_0x46bf4f,'role':'agent'}})[_0x6474('0x1c')](checkError());}function getAgentCheckSession(_0x12d05f,_0xca66ba){return new BPromise(function(_0x39a591,_0x59c42b){var _0x4dc02b=respondWithRpcPromise('VoiceChannels');var _0x4b81f3=getAgent(_0x12d05f);Promise[_0x6474('0x21')]([_0x4dc02b,_0x4b81f3])[_0x6474('0x1c')](function(_0x1751bc){var _0x2387e9=_0x1751bc[0x0];var _0x52e64b=_0x1751bc[0x1];var _0x13af68=_[_0x6474('0x22')](_0x2387e9[_0x6474('0x23')],function(_0x2e01fa){return _0x2e01fa[_0x6474('0x24')]==_0x52e64b['id']&&_0x2e01fa[_0x6474('0x25')]==_0xca66ba;});if(_0x13af68[_0x6474('0x26')]==0x1){_0x39a591(_0x52e64b);}else{_0x59c42b(new RangeError('sessionId\x20'+_0xca66ba+_0x6474('0x27')));}});});}exports[_0x6474('0x28')]=function(_0x1a1ae7,_0x34fea6){logger['info']('originate\x20fired:',_0x1a1ae7['body']);var _0x6f3d6f=originateValidation[_0x6474('0xc')](_0x1a1ae7[_0x6474('0x29')]);if(_0x6f3d6f['length']>0x0){return _0x34fea6[_0x6474('0x19')](0x190)[_0x6474('0x2a')](_0x6f3d6f);}var _0x16f6ec=_0x1a1ae7['body'][_0x6474('0x2b')];var _0x3dc0ee=_0x1a1ae7[_0x6474('0x29')]['callNumber'];var _0xcdd818=_0x1a1ae7[_0x6474('0x29')]['callerId'];var _0x43f7f1=_0x1a1ae7[_0x6474('0x29')][_0x6474('0x2c')];return getAgent(_0x16f6ec)[_0x6474('0x1c')](function(_0x3a5521){logger['info'](_0x6474('0x2d'),_0x3a5521[_0x6474('0x18')]);emit(util['format']('user:%s',_0x3a5521[_0x6474('0x18')]),'webbar:originate',{'callNumber':_0x3dc0ee,'callerId':_0xcdd818,'callbackUrl':_0x43f7f1});return _0x34fea6[_0x6474('0x19')](0xc8)[_0x6474('0x2a')]({'error':![],'message':_0x6474('0x2e')});})[_0x6474('0x1f')](handleError(_0x34fea6));};exports[_0x6474('0x2f')]=function(_0x551202,_0x5e42f5){logger[_0x6474('0x11')](_0x6474('0x30'),_0x551202[_0x6474('0x29')]);var _0x55cf83=hangupValidation[_0x6474('0xc')](_0x551202['body']);if(_0x55cf83[_0x6474('0x26')]>0x0){return _0x5e42f5['status'](0x190)['json'](_0x55cf83);}var _0x53be2e=_0x551202[_0x6474('0x29')][_0x6474('0x2b')];var _0x2879c7=_0x551202[_0x6474('0x29')][_0x6474('0x25')];return getAgent(_0x53be2e)[_0x6474('0x1c')](function(_0x52497f){logger[_0x6474('0x11')](_0x6474('0x2d'),_0x52497f['name']);emit(util[_0x6474('0x31')](_0x6474('0x32'),_0x52497f[_0x6474('0x18')]),'webbar:hangup',{'sessionId':_0x2879c7});return _0x5e42f5[_0x6474('0x19')](0xc8)[_0x6474('0x2a')]({'error':![],'message':_0x6474('0x33')});})['catch'](handleError(_0x5e42f5));};exports['answer']=function(_0x43f669,_0x254a73){logger['info'](_0x6474('0x34'),_0x43f669[_0x6474('0x29')]);var _0x9bdba5=answerValidation[_0x6474('0xc')](_0x43f669['body']);if(_0x9bdba5['length']>0x0){return _0x254a73[_0x6474('0x19')](0x190)['json'](_0x9bdba5);}var _0x391be9=_0x43f669[_0x6474('0x29')][_0x6474('0x2b')];var _0x54e797=_0x43f669[_0x6474('0x29')][_0x6474('0x25')];return getAgent(_0x391be9)['then'](function(_0x27a232){logger[_0x6474('0x11')](_0x6474('0x2d'),_0x27a232[_0x6474('0x18')]);emit(util[_0x6474('0x31')](_0x6474('0x32'),_0x27a232[_0x6474('0x18')]),'webbar:answer',{'sessionId':_0x54e797});return _0x254a73[_0x6474('0x19')](0xc8)[_0x6474('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0x6474('0x1f')](handleError(_0x254a73));};exports[_0x6474('0x35')]=function(_0x5748d3,_0x550dc2){logger['info']('hold\x20fired:',_0x5748d3[_0x6474('0x29')]);var _0x406246=holdValidation[_0x6474('0xc')](_0x5748d3[_0x6474('0x29')]);if(_0x406246['length']>0x0){return _0x550dc2[_0x6474('0x19')](0x190)[_0x6474('0x2a')](_0x406246);}var _0x1c411e=_0x5748d3[_0x6474('0x29')][_0x6474('0x2b')];var _0x9fe65c=_0x5748d3['body'][_0x6474('0x25')];return getAgent(_0x1c411e)[_0x6474('0x1c')](function(_0x394ff9){logger['info'](_0x6474('0x2d'),_0x394ff9[_0x6474('0x18')]);emit(util['format'](_0x6474('0x32'),_0x394ff9[_0x6474('0x18')]),_0x6474('0x36'),{'sessionId':_0x9fe65c});return _0x550dc2[_0x6474('0x19')](0xc8)[_0x6474('0x2a')]({'error':![],'message':_0x6474('0x37')});})[_0x6474('0x1f')](handleError(_0x550dc2));};exports['unhold']=function(_0x27ebf9,_0x3697a0){logger[_0x6474('0x11')]('unhold\x20fired:',_0x27ebf9[_0x6474('0x29')]);var _0x22181c=unholdValidation[_0x6474('0xc')](_0x27ebf9['body']);if(_0x22181c['length']>0x0){return _0x3697a0[_0x6474('0x19')](0x190)[_0x6474('0x2a')](_0x22181c);}var _0x4ce208=_0x27ebf9['body'][_0x6474('0x2b')];var _0x4e1e3b=_0x27ebf9[_0x6474('0x29')][_0x6474('0x25')];return getAgent(_0x4ce208)[_0x6474('0x1c')](function(_0x26c588){logger[_0x6474('0x11')](_0x6474('0x2d'),_0x26c588[_0x6474('0x18')]);emit(util[_0x6474('0x31')](_0x6474('0x32'),_0x26c588[_0x6474('0x18')]),_0x6474('0x38'),{'sessionId':_0x4e1e3b});return _0x3697a0[_0x6474('0x19')](0xc8)[_0x6474('0x2a')]({'error':![],'message':'unhold\x20executed!'});})[_0x6474('0x1f')](handleError(_0x3697a0));};exports['calls']=function(_0x5a3c6b,_0x1fb309){logger[_0x6474('0x11')](_0x6474('0x39'),_0x1fb309[_0x6474('0x29')]);var _0x5c245d=callsValidation[_0x6474('0xc')](_0x5a3c6b[_0x6474('0x29')]);if(_0x5c245d[_0x6474('0x26')]>0x0){return _0x1fb309[_0x6474('0x19')](0x190)[_0x6474('0x2a')](_0x5c245d);}var _0x671a89=_0x5a3c6b[_0x6474('0x29')][_0x6474('0x2b')];var _0xd59b8c=respondWithRpcPromise(_0x6474('0x3a'));var _0x3d50ac=getAgent(_0x671a89);return Promise[_0x6474('0x21')]([_0xd59b8c,_0x3d50ac])['then'](function(_0x5a4dc5){var _0x1e8a8f=_0x5a4dc5[0x0];var _0x4b4f14=_0x5a4dc5[0x1];var _0x3500bd=_[_0x6474('0x22')](_0x1e8a8f[_0x6474('0x23')],function(_0x68cad9){return _0x68cad9[_0x6474('0x24')]==_0x4b4f14['id'];});return _0x1fb309['status'](0xc8)['json']({'count':_0x3500bd[_0x6474('0x26')],'rows':_0x3500bd});})[_0x6474('0x1f')](handleError(_0x1fb309));};exports[_0x6474('0x3b')]=function(_0x47fb13,_0x3ceaa9){logger[_0x6474('0x11')]('conference\x20fired:',_0x47fb13[_0x6474('0x29')]);var _0x519106=conferenceValidation[_0x6474('0xc')](_0x47fb13[_0x6474('0x29')]);if(_0x519106[_0x6474('0x26')]>0x0){return _0x3ceaa9[_0x6474('0x19')](0x190)['json'](_0x519106);}var _0x3a2a49=_0x47fb13[_0x6474('0x29')][_0x6474('0x2b')];return getAgent(_0x3a2a49)[_0x6474('0x1c')](function(_0x1adc23){logger[_0x6474('0x11')](_0x6474('0x2d'),_0x1adc23[_0x6474('0x18')]);emit(util[_0x6474('0x31')](_0x6474('0x32'),_0x1adc23['name']),_0x6474('0x3c'));return _0x3ceaa9['status'](0xc8)[_0x6474('0x2a')]({'error':![],'message':_0x6474('0x3d')});})[_0x6474('0x1f')](handleError(_0x3ceaa9));};exports[_0x6474('0x3e')]=function(_0xe1844c,_0x2e5a25){logger[_0x6474('0x11')](_0x6474('0x3f'),_0xe1844c['body']);var _0x1cdc62=transferValidation['validate'](_0xe1844c[_0x6474('0x29')]);if(_0x1cdc62[_0x6474('0x26')]>0x0){return _0x2e5a25[_0x6474('0x19')](0x190)['json'](_0x1cdc62);}var _0x5b0ffc=_0xe1844c[_0x6474('0x29')][_0x6474('0x2b')];var _0x45a987=_0xe1844c['body'][_0x6474('0x25')];var _0x53bca1=_0xe1844c[_0x6474('0x29')]['transferNumber'];return getAgent(_0x5b0ffc)['then'](function(_0x53d662){logger[_0x6474('0x11')](_0x6474('0x2d'),_0x53d662[_0x6474('0x18')]);emit(util[_0x6474('0x31')]('user:%s',_0x53d662[_0x6474('0x18')]),'webbar:transfer',{'sessionId':_0x45a987,'transferNumber':_0x53bca1});return _0x2e5a25[_0x6474('0x19')](0xc8)[_0x6474('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x2e5a25));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ef64444..f473352 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 _0xf70a=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','update','destroy','removeDispositions'];(function(_0x3d6e1e,_0x57e708){var _0x3082cf=function(_0x55afde){while(--_0x55afde){_0x3d6e1e['push'](_0x3d6e1e['shift']());}};_0x3082cf(++_0x57e708);}(_0xf70a,0xa6));var _0xaf70=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xf70a[_0x301dab];return _0x2500a2;};'use strict';var multer=require('multer');var util=require(_0xaf70('0x0'));var path=require('path');var timeout=require(_0xaf70('0x1'));var express=require(_0xaf70('0x2'));var router=express[_0xaf70('0x3')]();var fs_extra=require(_0xaf70('0x4'));var auth=require(_0xaf70('0x5'));var interaction=require(_0xaf70('0x6'));var config=require(_0xaf70('0x7'));var controller=require(_0xaf70('0x8'));router[_0xaf70('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf70('0xa')]);router[_0xaf70('0x9')](_0xaf70('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xaf70('0x9')]('/:id',auth[_0xaf70('0xc')](),controller['show']);router[_0xaf70('0x9')](_0xaf70('0xd'),auth[_0xaf70('0xc')](),controller['getDispositions']);router[_0xaf70('0x9')](_0xaf70('0xe'),auth[_0xaf70('0xc')](),controller[_0xaf70('0xf')]);router[_0xaf70('0x9')](_0xaf70('0x10'),auth[_0xaf70('0xc')](),controller[_0xaf70('0x11')]);router['get'](_0xaf70('0x12'),auth[_0xaf70('0xc')](),controller[_0xaf70('0x13')]);router[_0xaf70('0x14')]('/',auth['isAuthenticated'](),controller[_0xaf70('0x15')]);router[_0xaf70('0x14')](_0xaf70('0xd'),auth[_0xaf70('0xc')](),controller[_0xaf70('0x16')]);router[_0xaf70('0x14')]('/:id/canned_answers',auth[_0xaf70('0xc')](),controller[_0xaf70('0x17')]);router['post'](_0xaf70('0x10'),auth[_0xaf70('0xc')](),controller[_0xaf70('0x18')]);router[_0xaf70('0x14')](_0xaf70('0x12'),auth['isAuthenticated'](),controller[_0xaf70('0x19')]);router['post'](_0xaf70('0x1a'),controller['notify']);router[_0xaf70('0x14')](_0xaf70('0x1b'),auth[_0xaf70('0xc')](),controller[_0xaf70('0x1c')]);router['put']('/:id',auth[_0xaf70('0xc')](),controller[_0xaf70('0x1d')]);router['delete']('/:id',auth[_0xaf70('0xc')](),controller[_0xaf70('0x1e')]);router['delete'](_0xaf70('0xd'),auth[_0xaf70('0xc')](),controller[_0xaf70('0x1f')]);router['delete'](_0xaf70('0xe'),auth[_0xaf70('0xc')](),controller['removeAnswers']);router['delete'](_0xaf70('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xaf70('0x20')]=router; \ No newline at end of file +var _0x9345=['get','describe','/:id','isAuthenticated','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/users','/:id/send','send','put','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1189bc,_0x27ada2){var _0x21a762=function(_0x1e7b63){while(--_0x1e7b63){_0x1189bc['push'](_0x1189bc['shift']());}};_0x21a762(++_0x27ada2);}(_0x9345,0x106));var _0x5934=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0x9345[_0x4d934b];return _0xc0338b;};'use strict';var multer=require(_0x5934('0x0'));var util=require(_0x5934('0x1'));var path=require(_0x5934('0x2'));var timeout=require(_0x5934('0x3'));var express=require('express');var router=express[_0x5934('0x4')]();var fs_extra=require(_0x5934('0x5'));var auth=require(_0x5934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5934('0x7'));var controller=require('./whatsappAccount.controller');router[_0x5934('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5934('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5934('0x9')]);router[_0x5934('0x8')](_0x5934('0xa'),auth[_0x5934('0xb')](),controller[_0x5934('0xc')]);router[_0x5934('0x8')]('/:id/dispositions',auth[_0x5934('0xb')](),controller[_0x5934('0xd')]);router[_0x5934('0x8')](_0x5934('0xe'),auth[_0x5934('0xb')](),controller[_0x5934('0xf')]);router[_0x5934('0x8')]('/:id/users',auth[_0x5934('0xb')](),controller['getAgents']);router[_0x5934('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x5934('0x10')]);router[_0x5934('0x11')]('/',auth['isAuthenticated'](),controller[_0x5934('0x12')]);router[_0x5934('0x11')](_0x5934('0x13'),auth['isAuthenticated'](),controller[_0x5934('0x14')]);router[_0x5934('0x11')](_0x5934('0xe'),auth[_0x5934('0xb')](),controller[_0x5934('0x15')]);router[_0x5934('0x11')](_0x5934('0x16'),auth[_0x5934('0xb')](),controller['addAgents']);router[_0x5934('0x11')]('/:id/applications',auth[_0x5934('0xb')](),controller['addApplications']);router['post']('/:id/notify',controller['notify']);router['post'](_0x5934('0x17'),auth['isAuthenticated'](),controller[_0x5934('0x18')]);router[_0x5934('0x19')]('/:id',auth[_0x5934('0xb')](),controller['update']);router['delete'](_0x5934('0xa'),auth[_0x5934('0xb')](),controller['destroy']);router[_0x5934('0x1a')](_0x5934('0x13'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5934('0x1a')](_0x5934('0xe'),auth[_0x5934('0xb')](),controller[_0x5934('0x1b')]);router[_0x5934('0x1a')](_0x5934('0x16'),auth[_0x5934('0xb')](),controller[_0x5934('0x1c')]);module[_0x5934('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f456327..07e37ec 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 _0xdd14=['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','sinch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdd14,0x16f));var _0x4dd1=function(_0x3a6e0f,_0x3671d0){_0x3a6e0f=_0x3a6e0f-0x0;var _0x9efcd5=_0xdd14[_0x3a6e0f];return _0x9efcd5;};'use strict';var Sequelize=require(_0x4dd1('0x0'));var rs=require(_0x4dd1('0x1'));module[_0x4dd1('0x2')]={'name':{'type':Sequelize[_0x4dd1('0x3')],'unique':_0x4dd1('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4dd1('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4dd1('0x3')],'defaultValue':function(){return rs[_0x4dd1('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4dd1('0x6')]('twilio',_0x4dd1('0x7'))},'accountSid':{'type':Sequelize[_0x4dd1('0x3')]},'baseUrl':{'type':Sequelize[_0x4dd1('0x3')]},'authToken':{'type':Sequelize[_0x4dd1('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4dd1('0x8');}},'notificationSound':{'type':Sequelize[_0x4dd1('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4dd1('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4dd1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4dd1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4dd1('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4dd1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4dd1('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4dd1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4dd1('0xa')],'comment':_0x4dd1('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x4dd1('0x9')],'defaultValue':![],'comment':_0x4dd1('0xc'),'set':function(_0x342e06){if(!_0x342e06){this[_0x4dd1('0xd')]('mandatoryDispositionPauseId',null);}this[_0x4dd1('0xd')](_0x4dd1('0xe'),_0x342e06);}},'description':{'type':Sequelize[_0x4dd1('0x3')]}}; \ No newline at end of file +var _0x6645=['exports','STRING','name','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0xa65ffb,_0x53dd5b){var _0x491769=function(_0x237134){while(--_0x237134){_0xa65ffb['push'](_0xa65ffb['shift']());}};_0x491769(++_0x53dd5b);}(_0x6645,0x16c));var _0x5664=function(_0xe2708a,_0x3c4f7a){_0xe2708a=_0xe2708a-0x0;var _0x415d9b=_0x6645[_0xe2708a];return _0x415d9b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5664('0x0')]={'name':{'type':Sequelize[_0x5664('0x1')],'unique':_0x5664('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x5664('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x5664('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x5664('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5664('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5664('0x3'),'sinch')},'accountSid':{'type':Sequelize[_0x5664('0x1')]},'baseUrl':{'type':Sequelize[_0x5664('0x1')]},'authToken':{'type':Sequelize[_0x5664('0x1')]},'notificationTemplate':{'type':Sequelize[_0x5664('0x4')],'defaultValue':function(){return _0x5664('0x5');}},'notificationSound':{'type':Sequelize[_0x5664('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5664('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5664('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5664('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5664('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5664('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5664('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5664('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5664('0x7')],'comment':_0x5664('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5664('0x6')],'defaultValue':![],'comment':_0x5664('0x9'),'set':function(_0x2ee55c){if(!_0x2ee55c){this[_0x5664('0xa')](_0x5664('0xb'),null);}this[_0x5664('0xa')](_0x5664('0xc'),_0x2ee55c);}},'description':{'type':Sequelize[_0x5664('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b4c4e18..c60dcf8 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 _0x048e=['list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','WhatsappAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','VIRTUAL','options','where','includeAll','include','findAll','then','catch','show','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','order','Disposition','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','ids','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','getAgents','User','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC'];(function(_0x3f8611,_0x2eafe9){var _0x57d20e=function(_0x22654b){while(--_0x22654b){_0x3f8611['push'](_0x3f8611['shift']());}};_0x57d20e(++_0x2eafe9);}(_0x048e,0x1aa));var _0xe048=function(_0x79654c,_0x1fdcc2){_0x79654c=_0x79654c-0x0;var _0x4d5811=_0x048e[_0x79654c];return _0x4d5811;};'use strict';var emlformat=require(_0xe048('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe048('0x1'));var jsonpatch=require(_0xe048('0x2'));var rp=require(_0xe048('0x3'));var moment=require(_0xe048('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe048('0x5'));var util=require(_0xe048('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe048('0x7'));var ejs=require(_0xe048('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe048('0x9'));var squel=require('squel');var crypto=require(_0xe048('0xa'));var jsforce=require(_0xe048('0xb'));var deskjs=require(_0xe048('0xc'));var toCsv=require(_0xe048('0x7'));var querystring=require(_0xe048('0xd'));var Papa=require(_0xe048('0xe'));var Redis=require(_0xe048('0xf'));var authService=require(_0xe048('0x10'));var qs=require(_0xe048('0x11'));var as=require(_0xe048('0x12'));var hardwareService=require(_0xe048('0x13'));var logger=require(_0xe048('0x14'))(_0xe048('0x15'));var utils=require('../../config/utils');var config=require(_0xe048('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe048('0x17'))['db'];config[_0xe048('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe048('0x19'))(new Redis(config[_0xe048('0x18')]));require(_0xe048('0x1a'))[_0xe048('0x1b')](socket);var jayson=require(_0xe048('0x1c'));var client=jayson['client'][_0xe048('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x574ddd,_0x38079d,_0x35020c,_0x51a172){return new BPromise(function(_0x1ec5a9,_0x44b51c){var _0x2c3356=_0x51a172||client;return _0x2c3356[_0xe048('0x1e')](_0x574ddd,_0x35020c)['then'](function(_0x2f9eaf){logger[_0xe048('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x38079d,_0xe048('0x20'));logger[_0xe048('0x21')](_0xe048('0x22'),_0x38079d,'request\x20sent',JSON[_0xe048('0x23')](_0x2f9eaf));if(_0x2f9eaf[_0xe048('0x24')]){if(_0x2f9eaf[_0xe048('0x24')][_0xe048('0x25')]===0x1f4){logger['error'](_0xe048('0x26'),_0x38079d,_0x2f9eaf[_0xe048('0x24')][_0xe048('0x27')]);return _0x44b51c(_0x2f9eaf[_0xe048('0x24')][_0xe048('0x27')]);}logger[_0xe048('0x24')](_0xe048('0x26'),_0x38079d,_0x2f9eaf[_0xe048('0x24')][_0xe048('0x27')]);return _0x1ec5a9(_0x2f9eaf['error'][_0xe048('0x27')]);}else{logger[_0xe048('0x1f')](_0xe048('0x26'),_0x38079d,_0xe048('0x20'));_0x1ec5a9(_0x2f9eaf['result'][_0xe048('0x27')]);}})['catch'](function(_0x1b3e5a){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x38079d,_0x1b3e5a);_0x44b51c(_0x1b3e5a);});});}function respondWithStatusCode(_0x253478,_0x4accbc){_0x4accbc=_0x4accbc||0xcc;return function(_0x134e74){if(_0x134e74){return _0x253478[_0xe048('0x28')](_0x4accbc);}return _0x253478[_0xe048('0x29')](_0x4accbc)['end']();};}function respondWithResult(_0x27ec16,_0x5bdd4e){_0x5bdd4e=_0x5bdd4e||0xc8;return function(_0xc95dba){if(_0xc95dba){return _0x27ec16[_0xe048('0x29')](_0x5bdd4e)[_0xe048('0x2a')](_0xc95dba);}};}function respondWithFilteredResult(_0x2ca9d3,_0x45c6eb){return function(_0x115366){if(_0x115366){var _0x105e08=typeof _0x45c6eb[_0xe048('0x2b')]===_0xe048('0x2c')&&typeof _0x45c6eb[_0xe048('0x2d')]===_0xe048('0x2c');var _0x59d18c=_0x115366[_0xe048('0x2e')];var _0x5eb5e2=_0x105e08?0x0:_0x45c6eb['offset'];var _0x2b75a0=_0x105e08?_0x115366[_0xe048('0x2e')]:_0x45c6eb[_0xe048('0x2b')]+_0x45c6eb[_0xe048('0x2d')];var _0x135800;if(_0x2b75a0>=_0x59d18c){_0x2b75a0=_0x59d18c;_0x135800=0xc8;}else{_0x135800=0xce;}_0x2ca9d3[_0xe048('0x29')](_0x135800);return _0x2ca9d3[_0xe048('0x2f')](_0xe048('0x30'),_0x5eb5e2+'-'+_0x2b75a0+'/'+_0x59d18c)[_0xe048('0x2a')](_0x115366);}return null;};}function patchUpdates(_0x4594f9){return function(_0x3ca49a){try{jsonpatch[_0xe048('0x31')](_0x3ca49a,_0x4594f9,!![]);}catch(_0x559dfb){return BPromise[_0xe048('0x32')](_0x559dfb);}return _0x3ca49a['save']();};}function saveUpdates(_0x851b1c,_0x285f74){return function(_0x32791a){if(_0x32791a){return _0x32791a[_0xe048('0x33')](_0x851b1c)['then'](function(_0x20385d){return _0x20385d;});}return null;};}function removeEntity(_0xa6388c,_0x5db3b4){return function(_0x405304){if(_0x405304){return _0x405304[_0xe048('0x34')]()['then'](function(){var _0xd16f54=_0x405304['get']({'plain':!![]});var _0x18c152=_0xe048('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x18c152,'resourceId':_0xd16f54['id']}})['then'](function(){return _0x405304;});})['then'](function(){_0xa6388c['status'](0xcc)[_0xe048('0x36')]();});}};}function handleEntityNotFound(_0x5b4b6d,_0x1091a9){return function(_0x509456){if(!_0x509456){_0x5b4b6d[_0xe048('0x28')](0x194);}return _0x509456;};}function handleError(_0x593379,_0x109345){_0x109345=_0x109345||0x1f4;return function(_0x35df2d){logger[_0xe048('0x24')](_0x35df2d[_0xe048('0x37')]);if(_0x35df2d[_0xe048('0x38')]){delete _0x35df2d[_0xe048('0x38')];}_0x593379[_0xe048('0x29')](_0x109345)[_0xe048('0x39')](_0x35df2d);};}exports[_0xe048('0x3a')]=function(_0x5c81fb,_0x1427c0){var _0x1ea823={'include':[{'model':db[_0xe048('0x3b')],'as':_0xe048('0x3c')}]},_0xb612a8={},_0x38e7ae={'count':0x0,'rows':[]};var _0x39948e=_['map'](db[_0xe048('0x3d')][_0xe048('0x3e')],function(_0x2a70fc){return{'name':_0x2a70fc[_0xe048('0x3f')],'type':_0x2a70fc[_0xe048('0x40')][_0xe048('0x41')]};});_0xb612a8[_0xe048('0x42')]=_[_0xe048('0x43')](_0x39948e,'name');_0xb612a8[_0xe048('0x44')]=_[_0xe048('0x45')](_0x5c81fb[_0xe048('0x44')]);_0xb612a8[_0xe048('0x46')]=_['intersection'](_0xb612a8[_0xe048('0x42')],_0xb612a8[_0xe048('0x44')]);_0x1ea823[_0xe048('0x47')]=_[_0xe048('0x48')](_0xb612a8[_0xe048('0x42')],qs['fields'](_0x5c81fb[_0xe048('0x44')][_0xe048('0x49')]));_0x1ea823[_0xe048('0x47')]=_0x1ea823[_0xe048('0x47')][_0xe048('0x4a')]?_0x1ea823[_0xe048('0x47')]:_0xb612a8[_0xe048('0x42')];if(!_0x5c81fb[_0xe048('0x44')][_0xe048('0x4b')](_0xe048('0x4c'))){_0x1ea823[_0xe048('0x2d')]=qs[_0xe048('0x2d')](_0x5c81fb[_0xe048('0x44')][_0xe048('0x2d')]);_0x1ea823[_0xe048('0x2b')]=qs[_0xe048('0x2b')](_0x5c81fb[_0xe048('0x44')][_0xe048('0x2b')]);}_0x1ea823['order']=qs[_0xe048('0x4d')](_0x5c81fb[_0xe048('0x44')][_0xe048('0x4d')]);_0x1ea823['where']=qs[_0xe048('0x46')](_[_0xe048('0x4e')](_0x5c81fb['query'],_0xb612a8[_0xe048('0x46')]),_0x39948e);if(_0x5c81fb[_0xe048('0x44')][_0xe048('0x4f')]){_0x1ea823['where']=_['merge'](_0x1ea823['where'],{'$or':_[_0xe048('0x43')](_0x39948e,function(_0x206a60){if(_0x206a60[_0xe048('0x40')]!==_0xe048('0x50')){var _0x2bb5fe={};_0x2bb5fe[_0x206a60[_0xe048('0x38')]]={'$like':'%'+_0x5c81fb['query'][_0xe048('0x4f')]+'%'};return _0x2bb5fe;}})});}_0x1ea823=_['merge']({},_0x1ea823,_0x5c81fb[_0xe048('0x51')]);var _0x44a016={'where':_0x1ea823[_0xe048('0x52')]};return db[_0xe048('0x3d')][_0xe048('0x2e')](_0x44a016)['then'](function(_0x4e2801){_0x38e7ae['count']=_0x4e2801;if(_0x5c81fb[_0xe048('0x44')][_0xe048('0x53')]){_0x1ea823[_0xe048('0x54')]=[{'all':!![]}];}return db[_0xe048('0x3d')][_0xe048('0x55')](_0x1ea823);})[_0xe048('0x56')](function(_0x4ddae6){_0x38e7ae['rows']=_0x4ddae6;return _0x38e7ae;})[_0xe048('0x56')](respondWithFilteredResult(_0x1427c0,_0x1ea823))[_0xe048('0x57')](handleError(_0x1427c0,null));};exports[_0xe048('0x58')]=function(_0x13cf64,_0x41feae){var _0x127ce8={'raw':![],'where':{'id':_0x13cf64[_0xe048('0x59')]['id']},'include':[{'model':db[_0xe048('0x3b')],'as':_0xe048('0x3c')}]},_0x1610a3={};_0x1610a3[_0xe048('0x42')]=_[_0xe048('0x45')](db['WhatsappAccount'][_0xe048('0x3e')]);_0x1610a3[_0xe048('0x44')]=_[_0xe048('0x45')](_0x13cf64['query']);_0x1610a3['filters']=_[_0xe048('0x48')](_0x1610a3[_0xe048('0x42')],_0x1610a3['query']);_0x127ce8[_0xe048('0x47')]=_['intersection'](_0x1610a3[_0xe048('0x42')],qs['fields'](_0x13cf64['query']['fields']));_0x127ce8[_0xe048('0x47')]=_0x127ce8['attributes']['length']?_0x127ce8['attributes']:_0x1610a3[_0xe048('0x42')];if(_0x13cf64['query'][_0xe048('0x53')]){_0x127ce8[_0xe048('0x54')]=[{'all':!![]}];}_0x127ce8=_[_0xe048('0x5a')]({},_0x127ce8,_0x13cf64[_0xe048('0x51')]);return db['WhatsappAccount'][_0xe048('0x5b')](_0x127ce8)[_0xe048('0x56')](handleEntityNotFound(_0x41feae,null))[_0xe048('0x56')](respondWithResult(_0x41feae,null))[_0xe048('0x57')](handleError(_0x41feae,null));};exports[_0xe048('0x5c')]=function(_0x94a643,_0x11ffea){return db[_0xe048('0x3d')][_0xe048('0x5c')](_0x94a643[_0xe048('0x5d')],{})['then'](function(_0x5a2d97){var _0x533346=_0x94a643[_0xe048('0x5e')][_0xe048('0x5f')]({'plain':!![]});if(!_0x533346)throw new Error(_0xe048('0x60'));if(_0x533346[_0xe048('0x61')]===_0xe048('0x5e')){var _0x1cd40c=_0x5a2d97[_0xe048('0x5f')]({'plain':!![]});var _0x2cd32f=_0xe048('0x35');return db['UserProfileSection'][_0xe048('0x5b')]({'where':{'name':_0x2cd32f,'userProfileId':_0x533346['userProfileId']},'raw':!![]})[_0xe048('0x56')](function(_0x410884){if(_0x410884&&_0x410884[_0xe048('0x62')]===0x0){return db[_0xe048('0x63')]['create']({'name':_0x1cd40c[_0xe048('0x38')],'resourceId':_0x1cd40c['id'],'type':_0x410884[_0xe048('0x38')],'sectionId':_0x410884['id']},{})[_0xe048('0x56')](function(){return _0x5a2d97;});}else{return _0x5a2d97;}})[_0xe048('0x57')](function(_0x36a9c5){logger[_0xe048('0x24')](_0xe048('0x64'),_0x36a9c5);throw _0x36a9c5;});}return _0x5a2d97;})[_0xe048('0x56')](respondWithResult(_0x11ffea,0xc9))['catch'](handleError(_0x11ffea,null));};exports[_0xe048('0x33')]=function(_0x44ece1,_0x3af404){if(_0x44ece1['body']['id']){delete _0x44ece1[_0xe048('0x5d')]['id'];}return db[_0xe048('0x3d')][_0xe048('0x5b')]({'where':{'id':_0x44ece1[_0xe048('0x59')]['id']},'include':[{'model':db[_0xe048('0x3b')],'as':_0xe048('0x3c')}]})[_0xe048('0x56')](handleEntityNotFound(_0x3af404,null))[_0xe048('0x56')](saveUpdates(_0x44ece1[_0xe048('0x5d')],null))[_0xe048('0x56')](respondWithResult(_0x3af404,null))[_0xe048('0x57')](handleError(_0x3af404,null));};exports[_0xe048('0x34')]=function(_0xe9e540,_0x296348){return db[_0xe048('0x3d')][_0xe048('0x5b')]({'where':{'id':_0xe9e540[_0xe048('0x59')]['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x296348,null))[_0xe048('0x56')](removeEntity(_0x296348,null))[_0xe048('0x57')](handleError(_0x296348,null));};exports[_0xe048('0x65')]=function(_0xc2b8d3,_0x3903cd){return db['WhatsappAccount'][_0xe048('0x65')]()[_0xe048('0x56')](respondWithResult(_0x3903cd,null))[_0xe048('0x57')](handleError(_0x3903cd,null));};exports[_0xe048('0x66')]=function(_0x9147dc,_0x1236ec,_0x22944f){if(_0x9147dc[_0xe048('0x5d')]['id']){delete _0x9147dc['body']['id'];}return db[_0xe048('0x3d')][_0xe048('0x5b')]({'where':{'id':_0x9147dc[_0xe048('0x59')]['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x1236ec,null))['then'](function(_0x1115e6){if(_0x1115e6){_0x9147dc[_0xe048('0x5d')][_0xe048('0x67')]=_0x1115e6['id'];return db['Disposition'][_0xe048('0x5c')](_0x9147dc[_0xe048('0x5d')]);}})[_0xe048('0x56')](respondWithResult(_0x1236ec,null))[_0xe048('0x57')](handleError(_0x1236ec,null));};exports[_0xe048('0x68')]=function(_0x1f88b1,_0x5cd7fa,_0x3de372){var _0xb5cef2={'raw':![],'where':{}};var _0x29421a={};var _0x24bdf0={'count':0x0,'rows':[]};return db[_0xe048('0x3d')][_0xe048('0x69')]({'where':{'id':_0x1f88b1[_0xe048('0x59')]['id']}})['then'](handleEntityNotFound(_0x5cd7fa,null))[_0xe048('0x56')](function(_0x48a610){if(_0x48a610){_0x29421a[_0xe048('0x42')]=_[_0xe048('0x45')](db['Disposition'][_0xe048('0x3e')]);_0x29421a[_0xe048('0x44')]=_[_0xe048('0x45')](_0x1f88b1[_0xe048('0x44')]);_0x29421a['filters']=_[_0xe048('0x48')](_0x29421a[_0xe048('0x42')],_0x29421a['query']);_0xb5cef2[_0xe048('0x47')]=_[_0xe048('0x48')](_0x29421a[_0xe048('0x42')],qs[_0xe048('0x49')](_0x1f88b1[_0xe048('0x44')][_0xe048('0x49')]));_0xb5cef2['attributes']=_0xb5cef2[_0xe048('0x47')][_0xe048('0x4a')]?_0xb5cef2[_0xe048('0x47')]:_0x29421a['model'];if(!_0x1f88b1[_0xe048('0x44')][_0xe048('0x4b')]('nolimit')){_0xb5cef2[_0xe048('0x2d')]=qs[_0xe048('0x2d')](_0x1f88b1[_0xe048('0x44')][_0xe048('0x2d')]);_0xb5cef2[_0xe048('0x2b')]=qs[_0xe048('0x2b')](_0x1f88b1[_0xe048('0x44')][_0xe048('0x2b')]);}_0xb5cef2[_0xe048('0x6a')]=qs['sort'](_0x1f88b1[_0xe048('0x44')]['sort']);_0xb5cef2[_0xe048('0x52')]=qs[_0xe048('0x46')](_['pick'](_0x1f88b1[_0xe048('0x44')],_0x29421a[_0xe048('0x46')]));_0xb5cef2[_0xe048('0x52')][_0xe048('0x67')]=_0x48a610['id'];if(_0x1f88b1[_0xe048('0x44')][_0xe048('0x4f')]){_0xb5cef2[_0xe048('0x52')]=_['merge'](_0xb5cef2[_0xe048('0x52')],{'$or':_[_0xe048('0x43')](_0xb5cef2[_0xe048('0x47')],function(_0x2a96ba){var _0x53cce3={};_0x53cce3[_0x2a96ba]={'$like':'%'+_0x1f88b1[_0xe048('0x44')][_0xe048('0x4f')]+'%'};return _0x53cce3;})});}_0xb5cef2=_[_0xe048('0x5a')]({},_0xb5cef2,_0x1f88b1[_0xe048('0x51')]);return db[_0xe048('0x6b')]['count']({'where':_0xb5cef2[_0xe048('0x52')]})[_0xe048('0x56')](function(_0x27d128){_0x24bdf0[_0xe048('0x2e')]=_0x27d128;if(_0x1f88b1[_0xe048('0x44')]['includeAll']){_0xb5cef2['include']=[{'all':!![]}];}return db[_0xe048('0x6b')][_0xe048('0x55')](_0xb5cef2);})[_0xe048('0x56')](function(_0x4c94df){_0x24bdf0[_0xe048('0x6c')]=_0x4c94df;return _0x24bdf0;});}})[_0xe048('0x56')](respondWithFilteredResult(_0x5cd7fa,_0xb5cef2))[_0xe048('0x57')](handleError(_0x5cd7fa,null));};exports[_0xe048('0x6d')]=function(_0x444ccb,_0x5b8111,_0x4c3bc6){return db[_0xe048('0x3d')][_0xe048('0x5b')]({'where':{'id':_0x444ccb['params']['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x5b8111,null))[_0xe048('0x56')](function(_0x362610){if(_0x362610){return _0x362610[_0xe048('0x6d')](_0x444ccb[_0xe048('0x44')]['ids']);}})[_0xe048('0x56')](respondWithStatusCode(_0x5b8111,null))[_0xe048('0x57')](handleError(_0x5b8111,null));};exports[_0xe048('0x6e')]=function(_0x22b8a3,_0x20a288,_0x5856f6){if(_0x22b8a3['body']['id']){delete _0x22b8a3[_0xe048('0x5d')]['id'];}return db[_0xe048('0x3d')]['find']({'where':{'id':_0x22b8a3['params']['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x20a288,null))[_0xe048('0x56')](function(_0x16bd26){if(_0x16bd26){_0x22b8a3[_0xe048('0x5d')]['WhatsappAccountId']=_0x16bd26['id'];return db[_0xe048('0x6f')][_0xe048('0x5c')](_0x22b8a3[_0xe048('0x5d')]);}})[_0xe048('0x56')](respondWithResult(_0x20a288,null))[_0xe048('0x57')](handleError(_0x20a288,null));};exports[_0xe048('0x70')]=function(_0x53df9a,_0x5af1e9,_0x24a45a){var _0x56e039={'raw':![],'where':{}};var _0x2182ef={};var _0x2532ce={'count':0x0,'rows':[]};return db[_0xe048('0x3d')][_0xe048('0x69')]({'where':{'id':_0x53df9a[_0xe048('0x59')]['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x5af1e9,null))['then'](function(_0xf4f5ce){if(_0xf4f5ce){_0x2182ef[_0xe048('0x42')]=_['keys'](db[_0xe048('0x6f')][_0xe048('0x3e')]);_0x2182ef[_0xe048('0x44')]=_[_0xe048('0x45')](_0x53df9a[_0xe048('0x44')]);_0x2182ef[_0xe048('0x46')]=_[_0xe048('0x48')](_0x2182ef[_0xe048('0x42')],_0x2182ef['query']);_0x56e039[_0xe048('0x47')]=_['intersection'](_0x2182ef[_0xe048('0x42')],qs[_0xe048('0x49')](_0x53df9a[_0xe048('0x44')][_0xe048('0x49')]));_0x56e039[_0xe048('0x47')]=_0x56e039[_0xe048('0x47')][_0xe048('0x4a')]?_0x56e039[_0xe048('0x47')]:_0x2182ef[_0xe048('0x42')];if(!_0x53df9a[_0xe048('0x44')]['hasOwnProperty'](_0xe048('0x4c'))){_0x56e039[_0xe048('0x2d')]=qs[_0xe048('0x2d')](_0x53df9a[_0xe048('0x44')][_0xe048('0x2d')]);_0x56e039[_0xe048('0x2b')]=qs['offset'](_0x53df9a[_0xe048('0x44')]['offset']);}_0x56e039[_0xe048('0x6a')]=qs['sort'](_0x53df9a[_0xe048('0x44')][_0xe048('0x4d')]);_0x56e039[_0xe048('0x52')]=qs['filters'](_[_0xe048('0x4e')](_0x53df9a[_0xe048('0x44')],_0x2182ef[_0xe048('0x46')]));_0x56e039[_0xe048('0x52')][_0xe048('0x67')]=_0xf4f5ce['id'];if(_0x53df9a[_0xe048('0x44')][_0xe048('0x4f')]){_0x56e039[_0xe048('0x52')]=_['merge'](_0x56e039[_0xe048('0x52')],{'$or':_['map'](_0x56e039['attributes'],function(_0x4996ef){var _0x373f3c={};_0x373f3c[_0x4996ef]={'$like':'%'+_0x53df9a[_0xe048('0x44')][_0xe048('0x4f')]+'%'};return _0x373f3c;})});}_0x56e039=_[_0xe048('0x5a')]({},_0x56e039,_0x53df9a[_0xe048('0x51')]);return db[_0xe048('0x6f')][_0xe048('0x2e')]({'where':_0x56e039[_0xe048('0x52')]})[_0xe048('0x56')](function(_0x24804a){_0x2532ce['count']=_0x24804a;if(_0x53df9a[_0xe048('0x44')][_0xe048('0x53')]){_0x56e039[_0xe048('0x54')]=[{'all':!![]}];}return db[_0xe048('0x6f')][_0xe048('0x55')](_0x56e039);})[_0xe048('0x56')](function(_0x71bd26){_0x2532ce[_0xe048('0x6c')]=_0x71bd26;return _0x2532ce;});}})[_0xe048('0x56')](respondWithFilteredResult(_0x5af1e9,_0x56e039))['catch'](handleError(_0x5af1e9,null));};exports[_0xe048('0x71')]=function(_0x328f2a,_0x4a55f0,_0x26086d){return db[_0xe048('0x3d')][_0xe048('0x5b')]({'where':{'id':_0x328f2a[_0xe048('0x59')]['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x4a55f0,null))[_0xe048('0x56')](function(_0x484c67){if(_0x484c67){return _0x484c67[_0xe048('0x71')](_0x328f2a[_0xe048('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x4a55f0,null))['catch'](handleError(_0x4a55f0,null));};exports[_0xe048('0x72')]=function(_0x57269f,_0x2fe3a8,_0x268c95){return db['WhatsappAccount']['find']({'where':{'id':_0x57269f[_0xe048('0x59')]['id']}})['then'](handleEntityNotFound(_0x2fe3a8,null))[_0xe048('0x56')](function(_0x4bedff){if(_0x4bedff){return _0x4bedff['addAgents'](_0x57269f[_0xe048('0x5d')][_0xe048('0x73')],_[_0xe048('0x74')](_0x57269f[_0xe048('0x5d')],['ids','id'])||{})[_0xe048('0x75')](function(_0x350359){for(var _0x35a59e=0x0;_0x35a59e<_0x57269f[_0xe048('0x5d')]['ids'][_0xe048('0x4a')];_0x35a59e+=0x1){socket['emit'](_0xe048('0x76'),{'UserId':Number(_0x57269f[_0xe048('0x5d')][_0xe048('0x73')][_0x35a59e]),'WhatsappAccountId':Number(_0x57269f['params']['id'])});}return _0x350359;});}})['then'](respondWithResult(_0x2fe3a8,null))[_0xe048('0x57')](handleError(_0x2fe3a8,null));};exports[_0xe048('0x77')]=function(_0x4155b2,_0x9d97bd,_0x232e86){return db[_0xe048('0x3d')][_0xe048('0x5b')]({'where':{'id':_0x4155b2['params']['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x9d97bd,null))['then'](function(_0x314184){if(_0x314184){return _0x314184[_0xe048('0x77')](_0x4155b2[_0xe048('0x44')][_0xe048('0x73')])[_0xe048('0x56')](function(){if(_[_0xe048('0x78')](_0x4155b2['query'][_0xe048('0x73')])){for(var _0x41a4ae=0x0;_0x41a4ae<_0x4155b2['query'][_0xe048('0x73')][_0xe048('0x4a')];_0x41a4ae+=0x1){socket[_0xe048('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x4155b2[_0xe048('0x44')][_0xe048('0x73')][_0x41a4ae]),'WhatsappAccountId':Number(_0x4155b2['params']['id'])});}}else{socket[_0xe048('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x4155b2[_0xe048('0x44')][_0xe048('0x73')]),'WhatsappAccountId':Number(_0x4155b2[_0xe048('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x9d97bd,null))[_0xe048('0x57')](handleError(_0x9d97bd,null));};exports[_0xe048('0x7a')]=function(_0x4a7b44,_0x24279b,_0x497dd9){var _0x248cf8={};var _0x41a01d={};var _0x3854b2;var _0x501680;return db[_0xe048('0x3d')]['findOne']({'where':{'id':_0x4a7b44[_0xe048('0x59')]['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x24279b,null))[_0xe048('0x56')](function(_0x390394){if(_0x390394){_0x3854b2=_0x390394;_0x41a01d[_0xe048('0x42')]=_[_0xe048('0x45')](db[_0xe048('0x7b')][_0xe048('0x3e')]);_0x41a01d[_0xe048('0x44')]=_[_0xe048('0x45')](_0x4a7b44[_0xe048('0x44')]);_0x41a01d[_0xe048('0x46')]=_['intersection'](_0x41a01d[_0xe048('0x42')],_0x41a01d[_0xe048('0x44')]);_0x248cf8[_0xe048('0x47')]=_[_0xe048('0x48')](_0x41a01d[_0xe048('0x42')],qs['fields'](_0x4a7b44['query']['fields']));_0x248cf8['attributes']=_0x248cf8[_0xe048('0x47')][_0xe048('0x4a')]?_0x248cf8[_0xe048('0x47')]:_0x41a01d[_0xe048('0x42')];_0x248cf8[_0xe048('0x6a')]=qs[_0xe048('0x4d')](_0x4a7b44[_0xe048('0x44')][_0xe048('0x4d')]);_0x248cf8['where']=qs[_0xe048('0x46')](_[_0xe048('0x4e')](_0x4a7b44['query'],_0x41a01d[_0xe048('0x46')]));if(_0x4a7b44[_0xe048('0x44')][_0xe048('0x4f')]){_0x248cf8[_0xe048('0x52')]=_[_0xe048('0x5a')](_0x248cf8[_0xe048('0x52')],{'$or':_[_0xe048('0x43')](_0x248cf8[_0xe048('0x47')],function(_0x312b60){var _0x36e4ad={};_0x36e4ad[_0x312b60]={'$like':'%'+_0x4a7b44[_0xe048('0x44')]['filter']+'%'};return _0x36e4ad;})});}_0x248cf8=_[_0xe048('0x5a')]({},_0x248cf8,_0x4a7b44['options']);return _0x3854b2[_0xe048('0x7a')](_0x248cf8);}})[_0xe048('0x56')](function(_0x559662){if(_0x559662){_0x501680=_0x559662[_0xe048('0x4a')];if(!_0x4a7b44[_0xe048('0x44')][_0xe048('0x4b')]('nolimit')){_0x248cf8['limit']=qs['limit'](_0x4a7b44['query'][_0xe048('0x2d')]);_0x248cf8['offset']=qs['offset'](_0x4a7b44['query'][_0xe048('0x2b')]);}return _0x3854b2[_0xe048('0x7a')](_0x248cf8);}})['then'](function(_0x4fe67b){if(_0x4fe67b){return _0x4fe67b?{'count':_0x501680,'rows':_0x4fe67b}:null;}})[_0xe048('0x56')](respondWithResult(_0x24279b,null))[_0xe048('0x57')](handleError(_0x24279b,null));};exports['addApplications']=function(_0x44fa9c,_0x40eaff){var _0x35cd8c=_0x44fa9c['params']['id'];var _0x25b02c=_0x44fa9c['body'];var _0x276b91=0xc8;var _0x43ef80=null;return db[_0xe048('0x7c')][_0xe048('0x7d')]({'isolationLevel':db['sequelize'][_0xe048('0x7e')]['ISOLATION_LEVELS'][_0xe048('0x7f')]},function(_0x264a37){return db[_0xe048('0x3d')]['findOne']({'where':{'id':_0x35cd8c},'transaction':_0x264a37})[_0xe048('0x56')](function(_0x2ae8fd){if(_0x2ae8fd){return db[_0xe048('0x80')][_0xe048('0x34')]({'where':{'WhatsappAccountId':_0x35cd8c},'transaction':_0x264a37})[_0xe048('0x56')](function(){var _0x38b070=_[_0xe048('0x43')](_0x25b02c,function(_0x4cd584){_0x4cd584[_0xe048('0x67')]=_0x35cd8c;return _0x4cd584;});return db['WhatsappApplication'][_0xe048('0x81')](_0x38b070,{'transaction':_0x264a37});});}else{_0x276b91=0x194;_0x43ef80=[];}});})[_0xe048('0x56')](function(){if(_0x276b91!==0x194){return db[_0xe048('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x35cd8c},'order':_0xe048('0x82')})[_0xe048('0x56')](function(_0x5dd8e5){_0x43ef80=_0x5dd8e5;});}})[_0xe048('0x57')](function(_0x5ea8ae){_0x276b91=0x1f4;logger[_0xe048('0x24')](_0x5ea8ae['stack']);if(_0x5ea8ae[_0xe048('0x38')]){delete _0x5ea8ae[_0xe048('0x38')];}_0x43ef80=_0x5ea8ae;})['finally'](function(){if(_0x43ef80===null){_0x40eaff[_0xe048('0x28')](_0x276b91);}else{if(_0x276b91===0x1f4){_0x40eaff['status'](_0x276b91)[_0xe048('0x39')](_0x43ef80);}else{_0x40eaff[_0xe048('0x29')](_0x276b91)[_0xe048('0x2a')](_0x43ef80);}}});};exports[_0xe048('0x83')]=function(_0x19df34,_0x323c07,_0x13b7d8){var _0x145de6={};var _0x47808b={};var _0x1a1a94;var _0x43ebd2;return db['WhatsappAccount'][_0xe048('0x69')]({'where':{'id':_0x19df34[_0xe048('0x59')]['id']}})[_0xe048('0x56')](handleEntityNotFound(_0x323c07,null))[_0xe048('0x56')](function(_0x5eda5f){if(_0x5eda5f){_0x1a1a94=_0x5eda5f;_0x47808b[_0xe048('0x42')]=_[_0xe048('0x45')](db[_0xe048('0x80')]['rawAttributes']);_0x47808b[_0xe048('0x44')]=_[_0xe048('0x45')](_0x19df34[_0xe048('0x44')]);_0x47808b[_0xe048('0x46')]=_[_0xe048('0x48')](_0x47808b[_0xe048('0x42')],_0x47808b[_0xe048('0x44')]);_0x145de6['attributes']=_[_0xe048('0x48')](_0x47808b['model'],qs[_0xe048('0x49')](_0x19df34[_0xe048('0x44')][_0xe048('0x49')]));_0x145de6[_0xe048('0x47')]=_0x145de6[_0xe048('0x47')][_0xe048('0x4a')]?_0x145de6['attributes']:_0x47808b[_0xe048('0x42')];_0x145de6[_0xe048('0x6a')]=qs[_0xe048('0x4d')](_0x19df34[_0xe048('0x44')]['sort']);_0x145de6[_0xe048('0x52')]=qs[_0xe048('0x46')](_['pick'](_0x19df34['query'],_0x47808b[_0xe048('0x46')]));if(_0x19df34[_0xe048('0x44')][_0xe048('0x4f')]){_0x145de6[_0xe048('0x52')]=_[_0xe048('0x5a')](_0x145de6[_0xe048('0x52')],{'$or':_['map'](_0x145de6[_0xe048('0x47')],function(_0x434093){var _0x52441c={};_0x52441c[_0x434093]={'$like':'%'+_0x19df34[_0xe048('0x44')][_0xe048('0x4f')]+'%'};return _0x52441c;})});}_0x145de6=_[_0xe048('0x5a')]({},_0x145de6,_0x19df34[_0xe048('0x51')]);return _0x1a1a94[_0xe048('0x83')](_0x145de6);}})[_0xe048('0x56')](function(_0x3f5e2e){if(_0x3f5e2e){_0x43ebd2=_0x3f5e2e[_0xe048('0x4a')];if(!_0x19df34[_0xe048('0x44')]['hasOwnProperty'](_0xe048('0x4c'))){_0x145de6[_0xe048('0x2d')]=qs['limit'](_0x19df34[_0xe048('0x44')]['limit']);_0x145de6[_0xe048('0x2b')]=qs[_0xe048('0x2b')](_0x19df34[_0xe048('0x44')]['offset']);}return _0x1a1a94[_0xe048('0x83')](_0x145de6);}})[_0xe048('0x56')](function(_0x437d8a){if(_0x437d8a){return _0x437d8a?{'count':_0x43ebd2,'rows':_0x437d8a}:null;}})[_0xe048('0x56')](respondWithResult(_0x323c07,null))[_0xe048('0x57')](handleError(_0x323c07,null));};exports[_0xe048('0x84')]=function(_0x473d61,_0x555cd7,_0x44b1d7){var _0x3a2472={'channel':_0xe048('0x85')};var _0x4032c8=[];var _0x51b44a=[];var _0x28c383={};return db['WhatsappAccount'][_0xe048('0x5b')]({'where':{'id':_0x473d61[_0xe048('0x59')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xe048('0x86')}]})[_0xe048('0x56')](handleEntityNotFound(_0x555cd7,null))[_0xe048('0x56')](function(_0x30a756){_0x3a2472[_0xe048('0x87')]=_0x30a756;if(_0x3a2472[_0xe048('0x87')]&&_0x3a2472[_0xe048('0x87')][_0xe048('0x40')]==='sinch'&&_0x473d61[_0xe048('0x5d')][_0xe048('0x88')]){if(_0x473d61['body'][_0xe048('0x88')][_0xe048('0x4a')]===0x0)return;if(_0x473d61['body'][_0xe048('0x88')][0x0][_0xe048('0x89')]!==_0xe048('0x8a'))return;return db[_0xe048('0x8b')]['update']({'read':!![],'readAt':_0x473d61[_0xe048('0x5d')][_0xe048('0x88')][0x0][_0xe048('0x8c')]},{'where':{'messageId':_0x473d61[_0xe048('0x5d')][_0xe048('0x88')][0x0][_0xe048('0x8d')]},'individualHooks':!![]})[_0xe048('0x56')](function(_0x190ac9){return _0x555cd7[_0xe048('0x29')](0xc8)[_0xe048('0x2a')](_0x190ac9);});}_0x3a2472['applications']=_[_0xe048('0x8e')](_0x30a756['Applications'],[_0xe048('0x82')],[_0xe048('0x8f')]);if(_0x3a2472[_0xe048('0x87')][_0xe048('0x86')]){delete _0x3a2472[_0xe048('0x87')]['Applications'];}return db['CmContact']['describe']()[_0xe048('0x56')](function(_0x311474){if(!_0x311474){throw new db[(_0xe048('0x90'))]['ValidationError'](_0xe048('0x91'));}_0x4032c8=_[_0xe048('0x92')](_['keys'](_0x311474),[_0xe048('0x93'),_0xe048('0x94')]);_0x51b44a=_[_0xe048('0x92')](_['keys'](_0x311474),[_0xe048('0x93'),_0xe048('0x94'),_0xe048('0x95'),_0xe048('0x96')]);_0x3a2472['body']={'mapKey':'mobile'};if(_0x3a2472[_0xe048('0x87')]&&_0x3a2472[_0xe048('0x87')][_0xe048('0x40')]===_0xe048('0x97')){_0x3a2472['body'][_0xe048('0x98')]=_0x473d61[_0xe048('0x5d')][_0xe048('0x99')][_0xe048('0x9a')](_0xe048('0x9b'),'');_0x3a2472[_0xe048('0x5d')]['body']=_0x473d61[_0xe048('0x5d')][_0xe048('0x9c')];_0x3a2472[_0xe048('0x5d')][_0xe048('0x9d')]=_0x473d61[_0xe048('0x5d')][_0xe048('0x9e')];}if(_0x3a2472[_0xe048('0x87')]&&_0x3a2472[_0xe048('0x87')]['type']===_0xe048('0x9f')){_0x3a2472['body'][_0xe048('0x98')]=_0x473d61[_0xe048('0x5d')][_0xe048('0xa0')][0x0][_0xe048('0x98')];_0x3a2472['body'][_0xe048('0x5d')]=_0x473d61[_0xe048('0x5d')][_0xe048('0xa0')][0x0][_0xe048('0x27')]['body'];_0x3a2472[_0xe048('0x5d')][_0xe048('0x9d')]=_0x473d61['body'][_0xe048('0xa0')][0x0][_0xe048('0x8d')];}if(_0x3a2472['body']['id']){delete _0x3a2472[_0xe048('0x5d')]['id'];}if(_[_0xe048('0xa1')](_0x3a2472[_0xe048('0x5d')][_0xe048('0x98')])){throw new db['Sequelize'][(_0xe048('0xa2'))](_0xe048('0xa3'));}if(_[_0xe048('0xa1')](_0x3a2472[_0xe048('0x5d')][_0xe048('0x5d')])||_0x3a2472[_0xe048('0x5d')][_0xe048('0x5d')]===''){throw new db[(_0xe048('0x90'))][(_0xe048('0xa2'))](_0xe048('0xa4'));}if(_[_0xe048('0xa1')](_0x3a2472[_0xe048('0x5d')][_0xe048('0xa5')])){throw new db[(_0xe048('0x90'))][(_0xe048('0xa2'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x51b44a);}if(!_[_0xe048('0xa6')](_0x51b44a,_0x3a2472[_0xe048('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0xe048('0xa2'))](_0xe048('0xa7')+_0x51b44a);}_0x28c383[_0x3a2472[_0xe048('0x5d')][_0xe048('0xa5')]]=_0x3a2472[_0xe048('0x5d')]['from'];return db['CmList']['find']({'where':{'id':_0x3a2472[_0xe048('0x87')][_0xe048('0x96')]},'include':[{'model':db[_0xe048('0xa8')],'as':_0xe048('0xa9'),'where':_0x28c383,'limit':0x1,'order':[[_0xe048('0x94'),_0xe048('0xaa')]]}]});})['then'](handleEntityNotFound(_0x555cd7,null))[_0xe048('0x56')](function(_0x208063){if(_0x208063){_0x3a2472[_0xe048('0xab')]=_['omit'](_0x208063,['Contacts']);if(_0x208063['Contacts'][_0xe048('0x4a')]){return _0x208063[_0xe048('0xa9')][0x0];}var _0x48df34=_[_0xe048('0xac')](_0x3a2472[_0xe048('0x5d')],{'firstName':_0x3a2472[_0xe048('0x5d')]['from'],'ListId':_0x208063['id']});_0x48df34[_0x3a2472[_0xe048('0x5d')][_0xe048('0xa5')]]=_0x3a2472[_0xe048('0x5d')][_0xe048('0x98')];return db[_0xe048('0xa8')][_0xe048('0x5c')](_0x48df34,{'fields':_0x4032c8,'raw':!![]});}})[_0xe048('0x56')](handleEntityNotFound(_0x555cd7,null))[_0xe048('0x56')](function(_0x2c7203){if(_0x2c7203){_0x3a2472[_0xe048('0xad')]=_0x2c7203;var _0x4ac4c8={'ContactId':_0x2c7203['id'],'phone':_0x3a2472[_0xe048('0x5d')][_0xe048('0x98')],'WhatsappAccountId':_0x473d61['params']['id']};var _0x28cd34={'ContactId':_0x2c7203['id'],'WhatsappAccountId':_0x473d61[_0xe048('0x59')]['id'],'closed':![]};return db[_0xe048('0xae')][_0xe048('0x5b')]({'where':_0x28cd34})[_0xe048('0x56')](function(_0x29d109){if(_0x29d109){return[_0x29d109,![]];}return db['WhatsappInteraction'][_0xe048('0x5c')](_0x4ac4c8)[_0xe048('0x56')](function(_0x23eceb){return[_0x23eceb,!![]];});});}})[_0xe048('0x75')](function(_0x3dcc72,_0x5ab0d2){_0x3a2472[_0xe048('0xaf')]=_0x3dcc72['get']({'plain':!![]});_0x3a2472['interaction'][_0xe048('0xb0')]=![];if(_0x5ab0d2){if(_0x3a2472[_0xe048('0x87')][_0xe048('0xb1')]){_0x3a2472['applications'][_0xe048('0xb2')]({'id':0x0,'priority':_0x3a2472[_0xe048('0xb3')][_0xe048('0x4a')]+0x1,'app':_0xe048('0xb4'),'appdata':_0xe048('0xb5'),'interval':_0xe048('0xb6')});}_0x3a2472[_0xe048('0xaf')]['created']=!![];}return db[_0xe048('0x8b')][_0xe048('0x5c')]({'phone':_0x3a2472[_0xe048('0x5d')]['from'],'messageId':_0x3a2472[_0xe048('0x5d')][_0xe048('0x9d')],'body':_0x3a2472['body']['body'],'WhatsappAccountId':_0x473d61[_0xe048('0x59')]['id'],'WhatsappInteractionId':_0x3dcc72['id'],'direction':'in','ContactId':_0x3dcc72['ContactId'],'AttachmentId':_0x3a2472['body'][_0xe048('0xb7')]});})[_0xe048('0x56')](function(_0x165c59){_0x3a2472[_0xe048('0x27')]=_0x165c59;if(!_0x3a2472[_0xe048('0xaf')]['UserId'])return;return db[_0xe048('0x7b')][_0xe048('0x5b')]({'attributes':['id',_0xe048('0x38')],'where':{'id':_0x3a2472[_0xe048('0xaf')][_0xe048('0xb8')]}});})['then'](function(_0x48bb1d){if(_0x48bb1d){_0x3a2472[_0xe048('0xb3')][_0xe048('0xb9')]({'id':0x0,'priority':0x0,'app':_0xe048('0xba'),'appdata':_0x48bb1d[_0xe048('0x38')]+','+(_0x3a2472[_0xe048('0x87')][_0xe048('0xbb')]||0xa),'interval':_0xe048('0xb6')});}if(!_0x3a2472['interaction']['queueId'])return;return db[_0xe048('0xbc')][_0xe048('0x5b')]({'attributes':['id',_0xe048('0x38')],'where':{'id':_0x3a2472['interaction']['queueId']}});})[_0xe048('0x56')](function(_0x2d5665){if(_0x2d5665){_0x3a2472['applications'][_0xe048('0xb9')]({'id':0x0,'priority':0x1,'app':_0xe048('0xbd'),'appdata':_0x2d5665[_0xe048('0x38')]+','+(_0x3a2472[_0xe048('0x87')][_0xe048('0xbe')]||0x12c),'interval':_0xe048('0xb6')});}return respondWithRpcPromise(_0xe048('0xbf'),'startRouting',_0x3a2472);})[_0xe048('0x56')](function(_0x5a29d3){if(_0x5a29d3){var _0x45b0f8=0xc8;var _0x11f63f='receiveMessage';logger[_0xe048('0x1f')](_0xe048('0x22'),_0x11f63f,_0x45b0f8,'entity\x20found');logger[_0xe048('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x11f63f,_0x45b0f8,'entity\x20found',JSON[_0xe048('0x23')](_0x5a29d3));if(_0x3a2472[_0xe048('0x87')][_0xe048('0x40')]===_0xe048('0x97')){return _0x555cd7[_0xe048('0x29')](_0x45b0f8)[_0xe048('0x2f')]('Content-Type',_0xe048('0xc0'))[_0xe048('0x39')](_0xe048('0xc1'));}else{return _0x555cd7[_0xe048('0x29')](_0x45b0f8)[_0xe048('0x2a')](_0x5a29d3);}}});})[_0xe048('0x57')](handleError(_0x555cd7,null));};exports[_0xe048('0x39')]=function(_0x568504,_0x20edf2,_0x3f4fa2){var _0x1decb8,_0x1d7996,_0x445d79;if(_['isNil'](_0x568504[_0xe048('0x5d')]['body'])||_0x568504['body'][_0xe048('0x5d')]===''){throw new db[(_0xe048('0x90'))][(_0xe048('0xa2'))](_0xe048('0xa4'));}if(_[_0xe048('0xa1')](_0x568504[_0xe048('0x5d')]['to'])){throw new db[(_0xe048('0x90'))][(_0xe048('0xa2'))](_0xe048('0xc2'));}_0x1decb8=_0x568504[_0xe048('0x5d')]['to'];return db[_0xe048('0x3d')]['find']({'where':{'id':_0x568504[_0xe048('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xe048('0xc3'),'include':[{'model':db['CmContact'],'as':_0xe048('0xa9'),'where':{'mobile':_0x1decb8},'limit':0x1,'order':[[_0xe048('0x94'),_0xe048('0xaa')]]}]}]})[_0xe048('0x56')](handleEntityNotFound(_0x20edf2,null))[_0xe048('0x56')](function(_0x4889b4){if(_0x4889b4&&_0x4889b4[_0xe048('0xc3')]){_0x1d7996=_0x4889b4[_0xe048('0x5f')]({'plain':!![]});if(_0x1d7996[_0xe048('0xc3')]&&_0x1d7996[_0xe048('0xc3')][_0xe048('0xa9')][_0xe048('0x4a')]){return _0x1d7996[_0xe048('0xc3')][_0xe048('0xa9')][0x0];}return db['CmContact']['create'](_['defaults'](_0x568504[_0xe048('0x5d')],{'firstName':_0x1decb8,'mobile':_0x1decb8,'phone':_0x1decb8,'ListId':_0x1d7996[_0xe048('0x96')]}));}})['then'](handleEntityNotFound(_0x20edf2,null))[_0xe048('0x56')](function(_0x312111){if(_0x312111){_0x445d79=_0x312111;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x445d79['id'],'closed':![],'WhatsappAccountId':_0x1d7996['id']}})[_0xe048('0x56')](function(_0x51a1d5){if(_0x51a1d5){return[_0x51a1d5,![]];}return db[_0xe048('0xae')][_0xe048('0x5c')]({'UserId':_0x568504[_0xe048('0x5e')]['id'],'ContactId':_0x445d79['id'],'WhatsappAccountId':_0x1d7996['id'],'phone':_0x1decb8,'firstMsgDirection':_0xe048('0xc4'),'Messages':[_[_0xe048('0x5a')](_0x568504[_0xe048('0x5d')],{'read':![],'body':_0x568504['body'][_0xe048('0x5d')],'phone':_0x1decb8,'WhatsappAccountId':_0x1d7996['id'],'UserId':_0x568504[_0xe048('0x5e')]['id'],'ContactId':_0x445d79['id']})]},{'include':[{'model':db[_0xe048('0x8b')],'as':_0xe048('0xc5')}]})[_0xe048('0x56')](function(_0x3e254a){return[_0x3e254a,!![]];});});}})[_0xe048('0x75')](function(_0xa08b12,_0x151e0b){if(_0x151e0b){return _0xa08b12;}return db[_0xe048('0x8b')]['create'](_[_0xe048('0x5a')](_0x568504[_0xe048('0x5d')],{'read':![],'body':_0x568504[_0xe048('0x5d')][_0xe048('0x5d')],'phone':_0x1decb8,'WhatsappAccountId':_0x1d7996['id'],'WhatsappInteractionId':_0xa08b12['id'],'UserId':_0x568504[_0xe048('0x5e')]['id'],'ContactId':_0x445d79['id']}))[_0xe048('0x56')](function(_0x2d8960){_0xa08b12[_0xe048('0xc6')]['Messages']=[];_0xa08b12[_0xe048('0xc6')]['Messages'][_0xe048('0xb2')](_0x2d8960['dataValues']);return _0xa08b12;});})[_0xe048('0x56')](respondWithResult(_0x20edf2,null))[_0xe048('0x57')](handleError(_0x20edf2,null));}; \ No newline at end of file +var _0xf59f=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','Pause','WhatsappAccount','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','body','describe','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','priority','finally','WhatsappApplication','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','createdAt','updatedAt','difference','ListId','mobile','twilio','from','whatsapp:','messageId','MessageSid','notifications','message_id','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x5232c9,_0x2a86a3){var _0x412830=function(_0x3c7713){while(--_0x3c7713){_0x5232c9['push'](_0x5232c9['shift']());}};_0x412830(++_0x2a86a3);}(_0xf59f,0x182));var _0xff59=function(_0x14507f,_0x30cb23){_0x14507f=_0x14507f-0x0;var _0x25f890=_0xf59f[_0x14507f];return _0x25f890;};'use strict';var emlformat=require(_0xff59('0x0'));var rimraf=require(_0xff59('0x1'));var zipdir=require(_0xff59('0x2'));var jsonpatch=require(_0xff59('0x3'));var rp=require(_0xff59('0x4'));var moment=require(_0xff59('0x5'));var BPromise=require(_0xff59('0x6'));var Mustache=require(_0xff59('0x7'));var util=require(_0xff59('0x8'));var path=require(_0xff59('0x9'));var sox=require('sox');var csv=require(_0xff59('0xa'));var ejs=require(_0xff59('0xb'));var fs=require('fs');var fs_extra=require(_0xff59('0xc'));var _=require(_0xff59('0xd'));var squel=require('squel');var crypto=require(_0xff59('0xe'));var jsforce=require(_0xff59('0xf'));var deskjs=require(_0xff59('0x10'));var toCsv=require(_0xff59('0xa'));var querystring=require(_0xff59('0x11'));var Papa=require(_0xff59('0x12'));var Redis=require('ioredis');var authService=require(_0xff59('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xff59('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff59('0x15'))(_0xff59('0x16'));var utils=require('../../config/utils');var config=require(_0xff59('0x17'));var licenseUtil=require(_0xff59('0x18'));var db=require('../../mysqldb')['db'];config[_0xff59('0x19')]=_[_0xff59('0x1a')](config['redis'],{'host':_0xff59('0x1b'),'port':0x18eb});var socket=require(_0xff59('0x1c'))(new Redis(config['redis']));require(_0xff59('0x1d'))[_0xff59('0x1e')](socket);var jayson=require(_0xff59('0x1f'));var client=jayson[_0xff59('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1cb02c,_0x4a30fe,_0x5c6bab,_0x530e83){return new BPromise(function(_0x13cd4c,_0xfc3f11){var _0x199477=_0x530e83||client;return _0x199477[_0xff59('0x21')](_0x1cb02c,_0x5c6bab)[_0xff59('0x22')](function(_0x3fd88e){logger[_0xff59('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x4a30fe,'request\x20sent');logger[_0xff59('0x24')](_0xff59('0x25'),_0x4a30fe,_0xff59('0x26'),JSON[_0xff59('0x27')](_0x3fd88e));if(_0x3fd88e[_0xff59('0x28')]){if(_0x3fd88e[_0xff59('0x28')][_0xff59('0x29')]===0x1f4){logger[_0xff59('0x28')](_0xff59('0x2a'),_0x4a30fe,_0x3fd88e[_0xff59('0x28')]['message']);return _0xfc3f11(_0x3fd88e[_0xff59('0x28')][_0xff59('0x2b')]);}logger[_0xff59('0x28')](_0xff59('0x2a'),_0x4a30fe,_0x3fd88e[_0xff59('0x28')][_0xff59('0x2b')]);return _0x13cd4c(_0x3fd88e[_0xff59('0x28')][_0xff59('0x2b')]);}else{logger[_0xff59('0x23')](_0xff59('0x2a'),_0x4a30fe,_0xff59('0x26'));_0x13cd4c(_0x3fd88e[_0xff59('0x2c')][_0xff59('0x2b')]);}})[_0xff59('0x2d')](function(_0x55db30){logger['error'](_0xff59('0x2a'),_0x4a30fe,_0x55db30);_0xfc3f11(_0x55db30);});});}function respondWithStatusCode(_0x264003,_0x2244fe){_0x2244fe=_0x2244fe||0xcc;return function(_0x29d967){if(_0x29d967){return _0x264003[_0xff59('0x2e')](_0x2244fe);}return _0x264003[_0xff59('0x2f')](_0x2244fe)[_0xff59('0x30')]();};}function respondWithResult(_0x2a343f,_0x16f52e){_0x16f52e=_0x16f52e||0xc8;return function(_0x44ef1e){if(_0x44ef1e){return _0x2a343f['status'](_0x16f52e)[_0xff59('0x31')](_0x44ef1e);}};}function respondWithFilteredResult(_0x3e626f,_0x394968){return function(_0x48442e){if(_0x48442e){var _0x7b422=typeof _0x394968['offset']==='undefined'&&typeof _0x394968[_0xff59('0x32')]===_0xff59('0x33');var _0x514d79=_0x48442e['count'];var _0x5404be=_0x7b422?0x0:_0x394968[_0xff59('0x34')];var _0x7dbbab=_0x7b422?_0x48442e[_0xff59('0x35')]:_0x394968[_0xff59('0x34')]+_0x394968[_0xff59('0x32')];var _0x43baaa;if(_0x7dbbab>=_0x514d79){_0x7dbbab=_0x514d79;_0x43baaa=0xc8;}else{_0x43baaa=0xce;}_0x3e626f[_0xff59('0x2f')](_0x43baaa);return _0x3e626f['set'](_0xff59('0x36'),_0x5404be+'-'+_0x7dbbab+'/'+_0x514d79)[_0xff59('0x31')](_0x48442e);}return null;};}function patchUpdates(_0x467028){return function(_0x2c881c){try{jsonpatch[_0xff59('0x37')](_0x2c881c,_0x467028,!![]);}catch(_0xc27a97){return BPromise['reject'](_0xc27a97);}return _0x2c881c[_0xff59('0x38')]();};}function saveUpdates(_0x2756f3,_0x4d7e3c){return function(_0x3b180a){if(_0x3b180a){return _0x3b180a['update'](_0x2756f3)[_0xff59('0x22')](function(_0x436321){return _0x436321;});}return null;};}function removeEntity(_0x4db043,_0x2b4be2){return function(_0x54213f){if(_0x54213f){return _0x54213f[_0xff59('0x39')]()[_0xff59('0x22')](function(){var _0xbac893=_0x54213f[_0xff59('0x3a')]({'plain':!![]});var _0x4d4c4d=_0xff59('0x3b');return db[_0xff59('0x3c')][_0xff59('0x39')]({'where':{'type':_0x4d4c4d,'resourceId':_0xbac893['id']}})[_0xff59('0x22')](function(){return _0x54213f;});})[_0xff59('0x22')](function(){_0x4db043['status'](0xcc)[_0xff59('0x30')]();});}};}function handleEntityNotFound(_0x2a94d4,_0x66fb15){return function(_0x2b3544){if(!_0x2b3544){_0x2a94d4[_0xff59('0x2e')](0x194);}return _0x2b3544;};}function handleError(_0x3cc76f,_0x6d7965){_0x6d7965=_0x6d7965||0x1f4;return function(_0x22fd62){logger[_0xff59('0x28')](_0x22fd62[_0xff59('0x3d')]);if(_0x22fd62[_0xff59('0x3e')]){delete _0x22fd62['name'];}_0x3cc76f[_0xff59('0x2f')](_0x6d7965)[_0xff59('0x3f')](_0x22fd62);};}exports[_0xff59('0x40')]=function(_0x38a3e8,_0x31a119){var _0x2298ee={'include':[{'model':db['Pause'],'as':_0xff59('0x41')}]},_0x321701={},_0x50df25={'count':0x0,'rows':[]};var _0x2a3cb0=_[_0xff59('0x42')](db['WhatsappAccount'][_0xff59('0x43')],function(_0x463a33){return{'name':_0x463a33[_0xff59('0x44')],'type':_0x463a33[_0xff59('0x45')][_0xff59('0x46')]};});_0x321701[_0xff59('0x47')]=_['map'](_0x2a3cb0,_0xff59('0x3e'));_0x321701[_0xff59('0x48')]=_[_0xff59('0x49')](_0x38a3e8['query']);_0x321701[_0xff59('0x4a')]=_[_0xff59('0x4b')](_0x321701[_0xff59('0x47')],_0x321701['query']);_0x2298ee[_0xff59('0x4c')]=_['intersection'](_0x321701[_0xff59('0x47')],qs[_0xff59('0x4d')](_0x38a3e8[_0xff59('0x48')][_0xff59('0x4d')]));_0x2298ee[_0xff59('0x4c')]=_0x2298ee[_0xff59('0x4c')][_0xff59('0x4e')]?_0x2298ee[_0xff59('0x4c')]:_0x321701[_0xff59('0x47')];if(!_0x38a3e8[_0xff59('0x48')][_0xff59('0x4f')](_0xff59('0x50'))){_0x2298ee[_0xff59('0x32')]=qs[_0xff59('0x32')](_0x38a3e8[_0xff59('0x48')][_0xff59('0x32')]);_0x2298ee[_0xff59('0x34')]=qs['offset'](_0x38a3e8[_0xff59('0x48')][_0xff59('0x34')]);}_0x2298ee[_0xff59('0x51')]=qs[_0xff59('0x52')](_0x38a3e8[_0xff59('0x48')]['sort']);_0x2298ee[_0xff59('0x53')]=qs['filters'](_[_0xff59('0x54')](_0x38a3e8[_0xff59('0x48')],_0x321701['filters']),_0x2a3cb0);if(_0x38a3e8[_0xff59('0x48')][_0xff59('0x55')]){_0x2298ee[_0xff59('0x53')]=_[_0xff59('0x56')](_0x2298ee[_0xff59('0x53')],{'$or':_[_0xff59('0x42')](_0x2a3cb0,function(_0x475961){if(_0x475961['type']!=='VIRTUAL'){var _0xbb450b={};_0xbb450b[_0x475961[_0xff59('0x3e')]]={'$like':'%'+_0x38a3e8[_0xff59('0x48')][_0xff59('0x55')]+'%'};return _0xbb450b;}})});}_0x2298ee=_[_0xff59('0x56')]({},_0x2298ee,_0x38a3e8[_0xff59('0x57')]);var _0x159fa7={'where':_0x2298ee['where']};return db['WhatsappAccount'][_0xff59('0x35')](_0x159fa7)[_0xff59('0x22')](function(_0x59e1a1){_0x50df25[_0xff59('0x35')]=_0x59e1a1;if(_0x38a3e8['query'][_0xff59('0x58')]){_0x2298ee[_0xff59('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xff59('0x5a')](_0x2298ee);})[_0xff59('0x22')](function(_0x369ca6){_0x50df25[_0xff59('0x5b')]=_0x369ca6;return _0x50df25;})['then'](respondWithFilteredResult(_0x31a119,_0x2298ee))[_0xff59('0x2d')](handleError(_0x31a119,null));};exports['show']=function(_0x1935bd,_0x428be6){var _0xe3358f={'raw':![],'where':{'id':_0x1935bd[_0xff59('0x5c')]['id']},'include':[{'model':db[_0xff59('0x5d')],'as':_0xff59('0x41')}]},_0x23c35b={};_0x23c35b[_0xff59('0x47')]=_[_0xff59('0x49')](db[_0xff59('0x5e')][_0xff59('0x43')]);_0x23c35b['query']=_[_0xff59('0x49')](_0x1935bd[_0xff59('0x48')]);_0x23c35b['filters']=_[_0xff59('0x4b')](_0x23c35b['model'],_0x23c35b['query']);_0xe3358f[_0xff59('0x4c')]=_['intersection'](_0x23c35b[_0xff59('0x47')],qs[_0xff59('0x4d')](_0x1935bd['query']['fields']));_0xe3358f['attributes']=_0xe3358f['attributes'][_0xff59('0x4e')]?_0xe3358f[_0xff59('0x4c')]:_0x23c35b[_0xff59('0x47')];if(_0x1935bd[_0xff59('0x48')][_0xff59('0x58')]){_0xe3358f[_0xff59('0x59')]=[{'all':!![]}];}_0xe3358f=_[_0xff59('0x56')]({},_0xe3358f,_0x1935bd[_0xff59('0x57')]);return db['WhatsappAccount'][_0xff59('0x5f')](_0xe3358f)[_0xff59('0x22')](handleEntityNotFound(_0x428be6,null))[_0xff59('0x22')](respondWithResult(_0x428be6,null))[_0xff59('0x2d')](handleError(_0x428be6,null));};exports[_0xff59('0x60')]=function(_0x92ed7f,_0x4421e1){return db[_0xff59('0x5e')]['create'](_0x92ed7f['body'],{})[_0xff59('0x22')](function(_0x3c8694){var _0x40e31a=_0x92ed7f[_0xff59('0x61')]['get']({'plain':!![]});if(!_0x40e31a)throw new Error(_0xff59('0x62'));if(_0x40e31a['role']===_0xff59('0x61')){var _0x2caeb2=_0x3c8694[_0xff59('0x3a')]({'plain':!![]});var _0xa854e1=_0xff59('0x3b');return db['UserProfileSection'][_0xff59('0x5f')]({'where':{'name':_0xa854e1,'userProfileId':_0x40e31a['userProfileId']},'raw':!![]})[_0xff59('0x22')](function(_0x3cb6d6){if(_0x3cb6d6&&_0x3cb6d6['autoAssociation']===0x0){return db[_0xff59('0x3c')][_0xff59('0x60')]({'name':_0x2caeb2[_0xff59('0x3e')],'resourceId':_0x2caeb2['id'],'type':_0x3cb6d6[_0xff59('0x3e')],'sectionId':_0x3cb6d6['id']},{})['then'](function(){return _0x3c8694;});}else{return _0x3c8694;}})[_0xff59('0x2d')](function(_0x2d11d1){logger[_0xff59('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d11d1);throw _0x2d11d1;});}return _0x3c8694;})[_0xff59('0x22')](respondWithResult(_0x4421e1,0xc9))[_0xff59('0x2d')](handleError(_0x4421e1,null));};exports[_0xff59('0x63')]=function(_0x4c1398,_0xd0d1bb){if(_0x4c1398[_0xff59('0x64')]['id']){delete _0x4c1398[_0xff59('0x64')]['id'];}return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x4c1398[_0xff59('0x5c')]['id']},'include':[{'model':db[_0xff59('0x5d')],'as':_0xff59('0x41')}]})[_0xff59('0x22')](handleEntityNotFound(_0xd0d1bb,null))['then'](saveUpdates(_0x4c1398['body'],null))['then'](respondWithResult(_0xd0d1bb,null))[_0xff59('0x2d')](handleError(_0xd0d1bb,null));};exports[_0xff59('0x39')]=function(_0x2f347d,_0x5221c7){return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x2f347d[_0xff59('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5221c7,null))[_0xff59('0x22')](removeEntity(_0x5221c7,null))['catch'](handleError(_0x5221c7,null));};exports['describe']=function(_0x5249e9,_0x1ecac2){return db[_0xff59('0x5e')][_0xff59('0x65')]()['then'](respondWithResult(_0x1ecac2,null))['catch'](handleError(_0x1ecac2,null));};exports['addDisposition']=function(_0x42bbdc,_0x4a296f,_0x5672fa){if(_0x42bbdc[_0xff59('0x64')]['id']){delete _0x42bbdc[_0xff59('0x64')]['id'];}return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x42bbdc[_0xff59('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a296f,null))[_0xff59('0x22')](function(_0x5e35f4){if(_0x5e35f4){_0x42bbdc[_0xff59('0x64')][_0xff59('0x66')]=_0x5e35f4['id'];return db[_0xff59('0x67')][_0xff59('0x60')](_0x42bbdc['body']);}})[_0xff59('0x22')](respondWithResult(_0x4a296f,null))['catch'](handleError(_0x4a296f,null));};exports[_0xff59('0x68')]=function(_0x16c9b9,_0x2a1132,_0x3c776f){var _0x46038a={'raw':![],'where':{}};var _0x569dfa={};var _0x33705e={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x16c9b9['params']['id']}})['then'](handleEntityNotFound(_0x2a1132,null))['then'](function(_0x57ce4a){if(_0x57ce4a){_0x569dfa[_0xff59('0x47')]=_['keys'](db['Disposition']['rawAttributes']);_0x569dfa[_0xff59('0x48')]=_[_0xff59('0x49')](_0x16c9b9['query']);_0x569dfa[_0xff59('0x4a')]=_[_0xff59('0x4b')](_0x569dfa['model'],_0x569dfa[_0xff59('0x48')]);_0x46038a['attributes']=_[_0xff59('0x4b')](_0x569dfa[_0xff59('0x47')],qs['fields'](_0x16c9b9[_0xff59('0x48')]['fields']));_0x46038a[_0xff59('0x4c')]=_0x46038a[_0xff59('0x4c')][_0xff59('0x4e')]?_0x46038a[_0xff59('0x4c')]:_0x569dfa['model'];if(!_0x16c9b9[_0xff59('0x48')][_0xff59('0x4f')](_0xff59('0x50'))){_0x46038a[_0xff59('0x32')]=qs[_0xff59('0x32')](_0x16c9b9[_0xff59('0x48')][_0xff59('0x32')]);_0x46038a[_0xff59('0x34')]=qs[_0xff59('0x34')](_0x16c9b9[_0xff59('0x48')][_0xff59('0x34')]);}_0x46038a[_0xff59('0x51')]=qs[_0xff59('0x52')](_0x16c9b9[_0xff59('0x48')][_0xff59('0x52')]);_0x46038a[_0xff59('0x53')]=qs[_0xff59('0x4a')](_[_0xff59('0x54')](_0x16c9b9['query'],_0x569dfa['filters']));_0x46038a[_0xff59('0x53')][_0xff59('0x66')]=_0x57ce4a['id'];if(_0x16c9b9[_0xff59('0x48')][_0xff59('0x55')]){_0x46038a[_0xff59('0x53')]=_[_0xff59('0x56')](_0x46038a['where'],{'$or':_[_0xff59('0x42')](_0x46038a[_0xff59('0x4c')],function(_0x5f1a58){var _0x5daa42={};_0x5daa42[_0x5f1a58]={'$like':'%'+_0x16c9b9[_0xff59('0x48')]['filter']+'%'};return _0x5daa42;})});}_0x46038a=_[_0xff59('0x56')]({},_0x46038a,_0x16c9b9['options']);return db[_0xff59('0x67')][_0xff59('0x35')]({'where':_0x46038a['where']})[_0xff59('0x22')](function(_0x59b79e){_0x33705e[_0xff59('0x35')]=_0x59b79e;if(_0x16c9b9[_0xff59('0x48')][_0xff59('0x58')]){_0x46038a[_0xff59('0x59')]=[{'all':!![]}];}return db[_0xff59('0x67')][_0xff59('0x5a')](_0x46038a);})['then'](function(_0x5e6eaf){_0x33705e[_0xff59('0x5b')]=_0x5e6eaf;return _0x33705e;});}})[_0xff59('0x22')](respondWithFilteredResult(_0x2a1132,_0x46038a))[_0xff59('0x2d')](handleError(_0x2a1132,null));};exports[_0xff59('0x69')]=function(_0x5c8cc5,_0x3d9eef,_0x6cf8a9){return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x5c8cc5[_0xff59('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3d9eef,null))[_0xff59('0x22')](function(_0x24684d){if(_0x24684d){return _0x24684d[_0xff59('0x69')](_0x5c8cc5[_0xff59('0x48')][_0xff59('0x6a')]);}})[_0xff59('0x22')](respondWithStatusCode(_0x3d9eef,null))['catch'](handleError(_0x3d9eef,null));};exports[_0xff59('0x6b')]=function(_0x10dfda,_0x12cdd4,_0x583336){if(_0x10dfda[_0xff59('0x64')]['id']){delete _0x10dfda['body']['id'];}return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x10dfda['params']['id']}})['then'](handleEntityNotFound(_0x12cdd4,null))['then'](function(_0x50ccc3){if(_0x50ccc3){_0x10dfda[_0xff59('0x64')][_0xff59('0x66')]=_0x50ccc3['id'];return db['CannedAnswer'][_0xff59('0x60')](_0x10dfda['body']);}})[_0xff59('0x22')](respondWithResult(_0x12cdd4,null))['catch'](handleError(_0x12cdd4,null));};exports[_0xff59('0x6c')]=function(_0x561e43,_0x1fd515,_0x30d8f0){var _0x4badce={'raw':![],'where':{}};var _0x3a97a8={};var _0x1336ac={'count':0x0,'rows':[]};return db[_0xff59('0x5e')][_0xff59('0x6d')]({'where':{'id':_0x561e43[_0xff59('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1fd515,null))[_0xff59('0x22')](function(_0x5dc2bc){if(_0x5dc2bc){_0x3a97a8['model']=_[_0xff59('0x49')](db[_0xff59('0x6e')][_0xff59('0x43')]);_0x3a97a8[_0xff59('0x48')]=_[_0xff59('0x49')](_0x561e43[_0xff59('0x48')]);_0x3a97a8['filters']=_[_0xff59('0x4b')](_0x3a97a8[_0xff59('0x47')],_0x3a97a8['query']);_0x4badce[_0xff59('0x4c')]=_[_0xff59('0x4b')](_0x3a97a8[_0xff59('0x47')],qs[_0xff59('0x4d')](_0x561e43[_0xff59('0x48')][_0xff59('0x4d')]));_0x4badce[_0xff59('0x4c')]=_0x4badce['attributes'][_0xff59('0x4e')]?_0x4badce[_0xff59('0x4c')]:_0x3a97a8[_0xff59('0x47')];if(!_0x561e43[_0xff59('0x48')][_0xff59('0x4f')](_0xff59('0x50'))){_0x4badce[_0xff59('0x32')]=qs[_0xff59('0x32')](_0x561e43[_0xff59('0x48')][_0xff59('0x32')]);_0x4badce['offset']=qs[_0xff59('0x34')](_0x561e43[_0xff59('0x48')][_0xff59('0x34')]);}_0x4badce[_0xff59('0x51')]=qs[_0xff59('0x52')](_0x561e43[_0xff59('0x48')][_0xff59('0x52')]);_0x4badce[_0xff59('0x53')]=qs[_0xff59('0x4a')](_[_0xff59('0x54')](_0x561e43[_0xff59('0x48')],_0x3a97a8[_0xff59('0x4a')]));_0x4badce[_0xff59('0x53')][_0xff59('0x66')]=_0x5dc2bc['id'];if(_0x561e43[_0xff59('0x48')]['filter']){_0x4badce[_0xff59('0x53')]=_[_0xff59('0x56')](_0x4badce[_0xff59('0x53')],{'$or':_[_0xff59('0x42')](_0x4badce[_0xff59('0x4c')],function(_0x4ea65b){var _0x104928={};_0x104928[_0x4ea65b]={'$like':'%'+_0x561e43[_0xff59('0x48')]['filter']+'%'};return _0x104928;})});}_0x4badce=_[_0xff59('0x56')]({},_0x4badce,_0x561e43[_0xff59('0x57')]);return db['CannedAnswer'][_0xff59('0x35')]({'where':_0x4badce[_0xff59('0x53')]})['then'](function(_0x28f49a){_0x1336ac[_0xff59('0x35')]=_0x28f49a;if(_0x561e43['query'][_0xff59('0x58')]){_0x4badce[_0xff59('0x59')]=[{'all':!![]}];}return db[_0xff59('0x6e')][_0xff59('0x5a')](_0x4badce);})['then'](function(_0x2936b9){_0x1336ac[_0xff59('0x5b')]=_0x2936b9;return _0x1336ac;});}})['then'](respondWithFilteredResult(_0x1fd515,_0x4badce))[_0xff59('0x2d')](handleError(_0x1fd515,null));};exports[_0xff59('0x6f')]=function(_0x576f03,_0x3f11fb,_0x46b454){return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x576f03[_0xff59('0x5c')]['id']}})[_0xff59('0x22')](handleEntityNotFound(_0x3f11fb,null))[_0xff59('0x22')](function(_0xe35440){if(_0xe35440){return _0xe35440[_0xff59('0x6f')](_0x576f03['query'][_0xff59('0x6a')]);}})[_0xff59('0x22')](respondWithStatusCode(_0x3f11fb,null))[_0xff59('0x2d')](handleError(_0x3f11fb,null));};exports[_0xff59('0x70')]=function(_0x19e2a6,_0x1901fa,_0x3fb343){return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0x19e2a6['params']['id']}})[_0xff59('0x22')](handleEntityNotFound(_0x1901fa,null))[_0xff59('0x22')](function(_0x509aab){if(_0x509aab){return _0x509aab[_0xff59('0x70')](_0x19e2a6[_0xff59('0x64')][_0xff59('0x6a')],_[_0xff59('0x71')](_0x19e2a6[_0xff59('0x64')],[_0xff59('0x6a'),'id'])||{})[_0xff59('0x72')](function(_0x1a063c){for(var _0x47ea11=0x0;_0x47ea11<_0x19e2a6[_0xff59('0x64')][_0xff59('0x6a')][_0xff59('0x4e')];_0x47ea11+=0x1){socket[_0xff59('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x19e2a6['body'][_0xff59('0x6a')][_0x47ea11]),'WhatsappAccountId':Number(_0x19e2a6['params']['id'])});}return _0x1a063c;});}})[_0xff59('0x22')](respondWithResult(_0x1901fa,null))[_0xff59('0x2d')](handleError(_0x1901fa,null));};exports[_0xff59('0x74')]=function(_0xab4f5a,_0x37f6ee,_0x4c26aa){return db[_0xff59('0x5e')][_0xff59('0x5f')]({'where':{'id':_0xab4f5a[_0xff59('0x5c')]['id']}})['then'](handleEntityNotFound(_0x37f6ee,null))['then'](function(_0x43cb7d){if(_0x43cb7d){return _0x43cb7d[_0xff59('0x74')](_0xab4f5a['query']['ids'])[_0xff59('0x22')](function(){if(_[_0xff59('0x75')](_0xab4f5a[_0xff59('0x48')][_0xff59('0x6a')])){for(var _0x2ce7b1=0x0;_0x2ce7b1<_0xab4f5a[_0xff59('0x48')][_0xff59('0x6a')][_0xff59('0x4e')];_0x2ce7b1+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0xab4f5a['query']['ids'][_0x2ce7b1]),'WhatsappAccountId':Number(_0xab4f5a[_0xff59('0x5c')]['id'])});}}else{socket[_0xff59('0x73')](_0xff59('0x76'),{'UserId':Number(_0xab4f5a[_0xff59('0x48')]['ids']),'WhatsappAccountId':Number(_0xab4f5a[_0xff59('0x5c')]['id'])});}});}})[_0xff59('0x22')](respondWithStatusCode(_0x37f6ee,null))['catch'](handleError(_0x37f6ee,null));};exports[_0xff59('0x77')]=function(_0x81d313,_0x39ecb6,_0x3cc610){var _0x2ca1b0={};var _0x2391e4={};var _0x4f20a3;var _0x3deaca;return db[_0xff59('0x5e')][_0xff59('0x6d')]({'where':{'id':_0x81d313[_0xff59('0x5c')]['id']}})['then'](handleEntityNotFound(_0x39ecb6,null))[_0xff59('0x22')](function(_0xba5e24){if(_0xba5e24){_0x4f20a3=_0xba5e24;_0x2391e4[_0xff59('0x47')]=_[_0xff59('0x49')](db[_0xff59('0x78')][_0xff59('0x43')]);_0x2391e4['query']=_[_0xff59('0x49')](_0x81d313['query']);_0x2391e4['filters']=_[_0xff59('0x4b')](_0x2391e4[_0xff59('0x47')],_0x2391e4[_0xff59('0x48')]);_0x2ca1b0[_0xff59('0x4c')]=_[_0xff59('0x4b')](_0x2391e4['model'],qs[_0xff59('0x4d')](_0x81d313['query']['fields']));_0x2ca1b0[_0xff59('0x4c')]=_0x2ca1b0[_0xff59('0x4c')][_0xff59('0x4e')]?_0x2ca1b0['attributes']:_0x2391e4[_0xff59('0x47')];_0x2ca1b0['order']=qs[_0xff59('0x52')](_0x81d313[_0xff59('0x48')]['sort']);_0x2ca1b0[_0xff59('0x53')]=qs[_0xff59('0x4a')](_[_0xff59('0x54')](_0x81d313[_0xff59('0x48')],_0x2391e4[_0xff59('0x4a')]));if(_0x81d313['query'][_0xff59('0x55')]){_0x2ca1b0[_0xff59('0x53')]=_['merge'](_0x2ca1b0[_0xff59('0x53')],{'$or':_[_0xff59('0x42')](_0x2ca1b0[_0xff59('0x4c')],function(_0x2805c4){var _0x56a27f={};_0x56a27f[_0x2805c4]={'$like':'%'+_0x81d313[_0xff59('0x48')][_0xff59('0x55')]+'%'};return _0x56a27f;})});}_0x2ca1b0=_[_0xff59('0x56')]({},_0x2ca1b0,_0x81d313[_0xff59('0x57')]);return _0x4f20a3[_0xff59('0x77')](_0x2ca1b0);}})[_0xff59('0x22')](function(_0x47e933){if(_0x47e933){_0x3deaca=_0x47e933['length'];if(!_0x81d313[_0xff59('0x48')][_0xff59('0x4f')](_0xff59('0x50'))){_0x2ca1b0['limit']=qs['limit'](_0x81d313[_0xff59('0x48')][_0xff59('0x32')]);_0x2ca1b0[_0xff59('0x34')]=qs[_0xff59('0x34')](_0x81d313[_0xff59('0x48')][_0xff59('0x34')]);}return _0x4f20a3[_0xff59('0x77')](_0x2ca1b0);}})['then'](function(_0x5f06aa){if(_0x5f06aa){return _0x5f06aa?{'count':_0x3deaca,'rows':_0x5f06aa}:null;}})[_0xff59('0x22')](respondWithResult(_0x39ecb6,null))['catch'](handleError(_0x39ecb6,null));};exports['addApplications']=function(_0x26569b,_0x73e28){var _0x27d5ea=_0x26569b[_0xff59('0x5c')]['id'];var _0x552a3b=_0x26569b[_0xff59('0x64')];var _0xa94c34=0xc8;var _0x3b781b=null;return db[_0xff59('0x79')][_0xff59('0x7a')]({'isolationLevel':db[_0xff59('0x79')][_0xff59('0x7b')]['ISOLATION_LEVELS'][_0xff59('0x7c')]},function(_0x3ad70d){return db[_0xff59('0x5e')][_0xff59('0x6d')]({'where':{'id':_0x27d5ea},'transaction':_0x3ad70d})['then'](function(_0x40ae31){if(_0x40ae31){return db['WhatsappApplication'][_0xff59('0x39')]({'where':{'WhatsappAccountId':_0x27d5ea},'transaction':_0x3ad70d})[_0xff59('0x22')](function(){var _0x4f3f64=_[_0xff59('0x42')](_0x552a3b,function(_0xe43556){_0xe43556[_0xff59('0x66')]=_0x27d5ea;return _0xe43556;});return db['WhatsappApplication'][_0xff59('0x7d')](_0x4f3f64,{'transaction':_0x3ad70d});});}else{_0xa94c34=0x194;_0x3b781b=[];}});})[_0xff59('0x22')](function(){if(_0xa94c34!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x27d5ea},'order':_0xff59('0x7e')})[_0xff59('0x22')](function(_0x1a6bac){_0x3b781b=_0x1a6bac;});}})[_0xff59('0x2d')](function(_0x19f992){_0xa94c34=0x1f4;logger[_0xff59('0x28')](_0x19f992[_0xff59('0x3d')]);if(_0x19f992['name']){delete _0x19f992['name'];}_0x3b781b=_0x19f992;})[_0xff59('0x7f')](function(){if(_0x3b781b===null){_0x73e28[_0xff59('0x2e')](_0xa94c34);}else{if(_0xa94c34===0x1f4){_0x73e28[_0xff59('0x2f')](_0xa94c34)[_0xff59('0x3f')](_0x3b781b);}else{_0x73e28[_0xff59('0x2f')](_0xa94c34)[_0xff59('0x31')](_0x3b781b);}}});};exports['getApplications']=function(_0x2b0275,_0x489e84,_0x6dccb6){var _0x1602b1={};var _0x336a4f={};var _0x41d655;var _0x4dbb7b;return db[_0xff59('0x5e')][_0xff59('0x6d')]({'where':{'id':_0x2b0275[_0xff59('0x5c')]['id']}})[_0xff59('0x22')](handleEntityNotFound(_0x489e84,null))[_0xff59('0x22')](function(_0x3dbd6f){if(_0x3dbd6f){_0x41d655=_0x3dbd6f;_0x336a4f[_0xff59('0x47')]=_[_0xff59('0x49')](db[_0xff59('0x80')]['rawAttributes']);_0x336a4f[_0xff59('0x48')]=_[_0xff59('0x49')](_0x2b0275[_0xff59('0x48')]);_0x336a4f[_0xff59('0x4a')]=_[_0xff59('0x4b')](_0x336a4f['model'],_0x336a4f['query']);_0x1602b1[_0xff59('0x4c')]=_['intersection'](_0x336a4f[_0xff59('0x47')],qs[_0xff59('0x4d')](_0x2b0275['query']['fields']));_0x1602b1['attributes']=_0x1602b1['attributes']['length']?_0x1602b1[_0xff59('0x4c')]:_0x336a4f[_0xff59('0x47')];_0x1602b1[_0xff59('0x51')]=qs['sort'](_0x2b0275[_0xff59('0x48')][_0xff59('0x52')]);_0x1602b1[_0xff59('0x53')]=qs['filters'](_[_0xff59('0x54')](_0x2b0275[_0xff59('0x48')],_0x336a4f['filters']));if(_0x2b0275['query'][_0xff59('0x55')]){_0x1602b1[_0xff59('0x53')]=_[_0xff59('0x56')](_0x1602b1[_0xff59('0x53')],{'$or':_[_0xff59('0x42')](_0x1602b1['attributes'],function(_0x3d69dc){var _0x5a5ac1={};_0x5a5ac1[_0x3d69dc]={'$like':'%'+_0x2b0275['query'][_0xff59('0x55')]+'%'};return _0x5a5ac1;})});}_0x1602b1=_[_0xff59('0x56')]({},_0x1602b1,_0x2b0275[_0xff59('0x57')]);return _0x41d655[_0xff59('0x81')](_0x1602b1);}})[_0xff59('0x22')](function(_0x370cd9){if(_0x370cd9){_0x4dbb7b=_0x370cd9[_0xff59('0x4e')];if(!_0x2b0275[_0xff59('0x48')]['hasOwnProperty'](_0xff59('0x50'))){_0x1602b1[_0xff59('0x32')]=qs[_0xff59('0x32')](_0x2b0275[_0xff59('0x48')][_0xff59('0x32')]);_0x1602b1[_0xff59('0x34')]=qs[_0xff59('0x34')](_0x2b0275['query'][_0xff59('0x34')]);}return _0x41d655['getApplications'](_0x1602b1);}})[_0xff59('0x22')](function(_0x42568f){if(_0x42568f){return _0x42568f?{'count':_0x4dbb7b,'rows':_0x42568f}:null;}})[_0xff59('0x22')](respondWithResult(_0x489e84,null))[_0xff59('0x2d')](handleError(_0x489e84,null));};exports[_0xff59('0x82')]=function(_0xc4730f,_0x260e75,_0x2110d0){var _0xc59259={'channel':'whatsapp'};var _0x57c547=[];var _0x9757ca=[];var _0x57c934={};return db['WhatsappAccount'][_0xff59('0x5f')]({'where':{'id':_0xc4730f[_0xff59('0x5c')]['id']},'include':[{'model':db[_0xff59('0x80')],'as':_0xff59('0x83')}]})[_0xff59('0x22')](handleEntityNotFound(_0x260e75,null))[_0xff59('0x22')](function(_0x18935c){_0xc59259[_0xff59('0x84')]=_0x18935c;if(_0xc59259[_0xff59('0x84')]&&_0xc59259['account'][_0xff59('0x45')]===_0xff59('0x85')&&_0xc4730f[_0xff59('0x64')]['statuses']){if(_0xc4730f[_0xff59('0x64')]['statuses'][_0xff59('0x4e')]===0x0)return;if(_0xc4730f[_0xff59('0x64')][_0xff59('0x86')][0x0][_0xff59('0x87')]!==_0xff59('0x88'))return;return db[_0xff59('0x89')][_0xff59('0x63')]({'read':!![],'readAt':_0xc4730f[_0xff59('0x64')][_0xff59('0x86')][0x0][_0xff59('0x8a')]},{'where':{'messageId':_0xc4730f[_0xff59('0x64')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x29d169){return _0x260e75['status'](0xc8)['json'](_0x29d169);});}_0xc59259[_0xff59('0x8b')]=_[_0xff59('0x8c')](_0x18935c[_0xff59('0x83')],[_0xff59('0x7e')],[_0xff59('0x8d')]);if(_0xc59259['account'][_0xff59('0x83')]){delete _0xc59259['account'][_0xff59('0x83')];}return db[_0xff59('0x8e')][_0xff59('0x65')]()[_0xff59('0x22')](function(_0x5c0b66){if(!_0x5c0b66){throw new db[(_0xff59('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x57c547=_['difference'](_[_0xff59('0x49')](_0x5c0b66),[_0xff59('0x90'),_0xff59('0x91')]);_0x9757ca=_[_0xff59('0x92')](_[_0xff59('0x49')](_0x5c0b66),[_0xff59('0x90'),_0xff59('0x91'),'CompanyId',_0xff59('0x93')]);_0xc59259[_0xff59('0x64')]={'mapKey':_0xff59('0x94')};if(_0xc59259[_0xff59('0x84')]&&_0xc59259[_0xff59('0x84')][_0xff59('0x45')]===_0xff59('0x95')){_0xc59259[_0xff59('0x64')][_0xff59('0x96')]=_0xc4730f['body']['From']['replace'](_0xff59('0x97'),'');_0xc59259[_0xff59('0x64')][_0xff59('0x64')]=_0xc4730f[_0xff59('0x64')]['Body'];_0xc59259[_0xff59('0x64')][_0xff59('0x98')]=_0xc4730f[_0xff59('0x64')][_0xff59('0x99')];}if(_0xc59259[_0xff59('0x84')]&&_0xc59259['account']['type']==='sinch'){_0xc59259[_0xff59('0x64')]['from']=_0xc4730f[_0xff59('0x64')][_0xff59('0x9a')][0x0][_0xff59('0x96')];_0xc59259[_0xff59('0x64')][_0xff59('0x64')]=_0xc4730f['body'][_0xff59('0x9a')][0x0][_0xff59('0x2b')][_0xff59('0x64')];_0xc59259[_0xff59('0x64')][_0xff59('0x98')]=_0xc4730f[_0xff59('0x64')][_0xff59('0x9a')][0x0][_0xff59('0x9b')];}if(_0xc59259[_0xff59('0x64')]['id']){delete _0xc59259[_0xff59('0x64')]['id'];}if(_[_0xff59('0x9c')](_0xc59259['body'][_0xff59('0x96')])){throw new db['Sequelize'][(_0xff59('0x9d'))](_0xff59('0x9e'));}if(_[_0xff59('0x9c')](_0xc59259[_0xff59('0x64')][_0xff59('0x64')])||_0xc59259['body'][_0xff59('0x64')]===''){throw new db[(_0xff59('0x8f'))][(_0xff59('0x9d'))](_0xff59('0x9f'));}if(_['isNil'](_0xc59259['body'][_0xff59('0xa0')])){throw new db[(_0xff59('0x8f'))][(_0xff59('0x9d'))](_0xff59('0xa1')+_0x9757ca);}if(!_[_0xff59('0xa2')](_0x9757ca,_0xc59259['body']['mapKey'])){throw new db[(_0xff59('0x8f'))][(_0xff59('0x9d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9757ca);}_0x57c934[_0xc59259[_0xff59('0x64')][_0xff59('0xa0')]]=_0xc59259[_0xff59('0x64')][_0xff59('0x96')];return db[_0xff59('0xa3')]['find']({'where':{'id':_0xc59259[_0xff59('0x84')]['ListId']},'include':[{'model':db[_0xff59('0x8e')],'as':_0xff59('0xa4'),'where':_0x57c934,'limit':0x1,'order':[['updatedAt',_0xff59('0xa5')]]}]});})['then'](handleEntityNotFound(_0x260e75,null))[_0xff59('0x22')](function(_0x29f6c9){if(_0x29f6c9){_0xc59259[_0xff59('0xa6')]=_[_0xff59('0x71')](_0x29f6c9,[_0xff59('0xa4')]);if(_0x29f6c9[_0xff59('0xa4')][_0xff59('0x4e')]){return _0x29f6c9['Contacts'][0x0];}var _0x30cb9d=_['defaults'](_0xc59259['body'],{'firstName':_0xc59259[_0xff59('0x64')][_0xff59('0x96')],'ListId':_0x29f6c9['id']});_0x30cb9d[_0xc59259[_0xff59('0x64')][_0xff59('0xa0')]]=_0xc59259[_0xff59('0x64')]['from'];return db['CmContact'][_0xff59('0x60')](_0x30cb9d,{'fields':_0x57c547,'raw':!![]});}})['then'](handleEntityNotFound(_0x260e75,null))[_0xff59('0x22')](function(_0x22eda2){if(_0x22eda2){_0xc59259[_0xff59('0xa7')]=_0x22eda2;var _0x3d71da={'ContactId':_0x22eda2['id'],'phone':_0xc59259['body'][_0xff59('0x96')],'WhatsappAccountId':_0xc4730f[_0xff59('0x5c')]['id']};var _0x4b8cec={'ContactId':_0x22eda2['id'],'WhatsappAccountId':_0xc4730f['params']['id'],'closed':![]};return db[_0xff59('0xa8')]['find']({'where':_0x4b8cec})[_0xff59('0x22')](function(_0x39e81c){if(_0x39e81c){return[_0x39e81c,![]];}return db[_0xff59('0xa8')][_0xff59('0x60')](_0x3d71da)[_0xff59('0x22')](function(_0x1ccdcd){return[_0x1ccdcd,!![]];});});}})['spread'](function(_0x870db8,_0x257435){_0xc59259['interaction']=_0x870db8[_0xff59('0x3a')]({'plain':!![]});_0xc59259[_0xff59('0xa9')][_0xff59('0xaa')]=![];if(_0x257435){if(_0xc59259['account'][_0xff59('0xab')]){_0xc59259['applications'][_0xff59('0xac')]({'id':0x0,'priority':_0xc59259[_0xff59('0x8b')]['length']+0x1,'app':_0xff59('0xad'),'appdata':'unmanaged','interval':_0xff59('0xae')});}_0xc59259['interaction'][_0xff59('0xaa')]=!![];}return db[_0xff59('0x89')][_0xff59('0x60')]({'phone':_0xc59259[_0xff59('0x64')][_0xff59('0x96')],'messageId':_0xc59259['body'][_0xff59('0x98')],'body':_0xc59259['body'][_0xff59('0x64')],'WhatsappAccountId':_0xc4730f[_0xff59('0x5c')]['id'],'WhatsappInteractionId':_0x870db8['id'],'direction':'in','ContactId':_0x870db8[_0xff59('0xaf')],'AttachmentId':_0xc59259[_0xff59('0x64')][_0xff59('0xb0')]});})['then'](function(_0x6af7f2){_0xc59259[_0xff59('0x2b')]=_0x6af7f2;if(!_0xc59259[_0xff59('0xa9')][_0xff59('0xb1')])return;return db[_0xff59('0x78')][_0xff59('0x5f')]({'attributes':['id',_0xff59('0x3e')],'where':{'id':_0xc59259[_0xff59('0xa9')][_0xff59('0xb1')]}});})[_0xff59('0x22')](function(_0x22aa0a){if(_0x22aa0a){_0xc59259[_0xff59('0x8b')][_0xff59('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x22aa0a[_0xff59('0x3e')]+','+(_0xc59259[_0xff59('0x84')][_0xff59('0xb3')]||0xa),'interval':_0xff59('0xae')});}if(!_0xc59259['interaction'][_0xff59('0xb4')])return;return db['WhatsappQueue'][_0xff59('0x5f')]({'attributes':['id',_0xff59('0x3e')],'where':{'id':_0xc59259[_0xff59('0xa9')][_0xff59('0xb4')]}});})[_0xff59('0x22')](function(_0x191b93){if(_0x191b93){_0xc59259[_0xff59('0x8b')]['unshift']({'id':0x0,'priority':0x1,'app':_0xff59('0xb5'),'appdata':_0x191b93[_0xff59('0x3e')]+','+(_0xc59259[_0xff59('0x84')][_0xff59('0xb6')]||0x12c),'interval':_0xff59('0xae')});}return respondWithRpcPromise('Start',_0xff59('0xb7'),_0xc59259);})['then'](function(_0x1664f3){if(_0x1664f3){var _0x1797ed=0xc8;var _0x2aac16=_0xff59('0xb8');logger[_0xff59('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2aac16,_0x1797ed,_0xff59('0xb9'));logger[_0xff59('0x24')](_0xff59('0xba'),_0x2aac16,_0x1797ed,_0xff59('0xb9'),JSON[_0xff59('0x27')](_0x1664f3));if(_0xc59259[_0xff59('0x84')][_0xff59('0x45')]===_0xff59('0x95')){return _0x260e75[_0xff59('0x2f')](_0x1797ed)['set'](_0xff59('0xbb'),_0xff59('0xbc'))[_0xff59('0x3f')](_0xff59('0xbd'));}else{return _0x260e75[_0xff59('0x2f')](_0x1797ed)['json'](_0x1664f3);}}});})['catch'](handleError(_0x260e75,null));};exports[_0xff59('0x3f')]=function(_0x3d637a,_0x45aa8e,_0xabcbcf){var _0x2b02dc,_0x3839e7,_0x466d76;if(_[_0xff59('0x9c')](_0x3d637a[_0xff59('0x64')][_0xff59('0x64')])||_0x3d637a[_0xff59('0x64')]['body']===''){throw new db['Sequelize'][(_0xff59('0x9d'))](_0xff59('0x9f'));}if(_['isNil'](_0x3d637a[_0xff59('0x64')]['to'])){throw new db[(_0xff59('0x8f'))][(_0xff59('0x9d'))](_0xff59('0xbe'));}_0x2b02dc=_0x3d637a[_0xff59('0x64')]['to'];return db['WhatsappAccount'][_0xff59('0x5f')]({'where':{'id':_0x3d637a['params']['id']},'include':[{'model':db[_0xff59('0xa3')],'as':_0xff59('0xbf'),'include':[{'model':db[_0xff59('0x8e')],'as':_0xff59('0xa4'),'where':{'mobile':_0x2b02dc},'limit':0x1,'order':[[_0xff59('0x91'),_0xff59('0xa5')]]}]}]})[_0xff59('0x22')](handleEntityNotFound(_0x45aa8e,null))[_0xff59('0x22')](function(_0x34ecab){if(_0x34ecab&&_0x34ecab[_0xff59('0xbf')]){_0x3839e7=_0x34ecab[_0xff59('0x3a')]({'plain':!![]});if(_0x3839e7[_0xff59('0xbf')]&&_0x3839e7[_0xff59('0xbf')][_0xff59('0xa4')][_0xff59('0x4e')]){return _0x3839e7[_0xff59('0xbf')][_0xff59('0xa4')][0x0];}return db[_0xff59('0x8e')]['create'](_[_0xff59('0x1a')](_0x3d637a['body'],{'firstName':_0x2b02dc,'mobile':_0x2b02dc,'phone':_0x2b02dc,'ListId':_0x3839e7[_0xff59('0x93')]}));}})[_0xff59('0x22')](handleEntityNotFound(_0x45aa8e,null))[_0xff59('0x22')](function(_0x2d2cce){if(_0x2d2cce){_0x466d76=_0x2d2cce;return db[_0xff59('0xa8')]['find']({'where':{'ContactId':_0x466d76['id'],'closed':![],'WhatsappAccountId':_0x3839e7['id']}})[_0xff59('0x22')](function(_0x2a42ff){if(_0x2a42ff){return[_0x2a42ff,![]];}return db[_0xff59('0xa8')][_0xff59('0x60')]({'UserId':_0x3d637a[_0xff59('0x61')]['id'],'ContactId':_0x466d76['id'],'WhatsappAccountId':_0x3839e7['id'],'phone':_0x2b02dc,'firstMsgDirection':_0xff59('0xc0'),'Messages':[_[_0xff59('0x56')](_0x3d637a[_0xff59('0x64')],{'read':![],'body':_0x3d637a[_0xff59('0x64')][_0xff59('0x64')],'phone':_0x2b02dc,'WhatsappAccountId':_0x3839e7['id'],'UserId':_0x3d637a['user']['id'],'ContactId':_0x466d76['id']})]},{'include':[{'model':db[_0xff59('0x89')],'as':_0xff59('0xc1')}]})[_0xff59('0x22')](function(_0x22e8aa){return[_0x22e8aa,!![]];});});}})[_0xff59('0x72')](function(_0x5b2098,_0x36a568){if(_0x36a568){return _0x5b2098;}return db[_0xff59('0x89')][_0xff59('0x60')](_[_0xff59('0x56')](_0x3d637a[_0xff59('0x64')],{'read':![],'body':_0x3d637a[_0xff59('0x64')][_0xff59('0x64')],'phone':_0x2b02dc,'WhatsappAccountId':_0x3839e7['id'],'WhatsappInteractionId':_0x5b2098['id'],'UserId':_0x3d637a[_0xff59('0x61')]['id'],'ContactId':_0x466d76['id']}))[_0xff59('0x22')](function(_0xa3494a){_0x5b2098['dataValues'][_0xff59('0xc1')]=[];_0x5b2098[_0xff59('0xc2')]['Messages'][_0xff59('0xac')](_0xa3494a['dataValues']);return _0x5b2098;});})[_0xff59('0x22')](respondWithResult(_0x45aa8e,null))[_0xff59('0x2d')](handleError(_0x45aa8e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d691708..32a0e77 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 _0x4368=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x5ce6a8,_0x14ab42){var _0x5a5328=function(_0x5e6dee){while(--_0x5e6dee){_0x5ce6a8['push'](_0x5ce6a8['shift']());}};_0x5a5328(++_0x14ab42);}(_0x4368,0xd6));var _0x8436=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x4368[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require(_0x8436('0x0'));var WhatsappAccount=require(_0x8436('0x1'))['db'][_0x8436('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8436('0x3')](0x0);var events={'afterCreate':_0x8436('0x4'),'afterUpdate':_0x8436('0x5'),'afterDestroy':_0x8436('0x6')};function emitEvent(_0x2bb028){return function(_0x12b8d9,_0x3a57f9,_0x50402c){WhatsappAccountEvents['emit'](_0x2bb028+':'+_0x12b8d9['id'],_0x12b8d9);WhatsappAccountEvents[_0x8436('0x7')](_0x2bb028,_0x12b8d9);_0x50402c(null);};}for(var e in events){if(events[_0x8436('0x8')](e)){var event=events[e];WhatsappAccount[_0x8436('0x9')](e,emitEvent(event));}}module[_0x8436('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6fdc=['hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove'];(function(_0x4bfd95,_0x1c3b3b){var _0x1484cd=function(_0x2c622b){while(--_0x2c622b){_0x4bfd95['push'](_0x4bfd95['shift']());}};_0x1484cd(++_0x1c3b3b);}(_0x6fdc,0xdf));var _0xc6fd=function(_0x3f4f3b,_0x2d7be2){_0x3f4f3b=_0x3f4f3b-0x0;var _0xfc6f02=_0x6fdc[_0x3f4f3b];return _0xfc6f02;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xc6fd('0x0'))['db'][_0xc6fd('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc6fd('0x2')](0x0);var events={'afterCreate':_0xc6fd('0x3'),'afterUpdate':'update','afterDestroy':_0xc6fd('0x4')};function emitEvent(_0x30135d){return function(_0x1631c8,_0x417d48,_0x14f893){WhatsappAccountEvents['emit'](_0x30135d+':'+_0x1631c8['id'],_0x1631c8);WhatsappAccountEvents['emit'](_0x30135d,_0x1631c8);_0x14f893(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xc6fd('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f37d17a..6280262 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 _0x1d42=['bluebird','request-promise','path','rimraf','exports','WhatsappAccount','util','../../config/logger'];(function(_0x28f26f,_0x39ccd1){var _0x545c7d=function(_0xf4abfb){while(--_0xf4abfb){_0x28f26f['push'](_0x28f26f['shift']());}};_0x545c7d(++_0x39ccd1);}(_0x1d42,0x10e));var _0x21d4=function(_0x1a49fc,_0x527071){_0x1a49fc=_0x1a49fc-0x0;var _0x5589fc=_0x1d42[_0x1a49fc];return _0x5589fc;};'use strict';var _=require('lodash');var util=require(_0x21d4('0x0'));var logger=require(_0x21d4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x21d4('0x2'));var rp=require(_0x21d4('0x3'));var fs=require('fs');var path=require(_0x21d4('0x4'));var rimraf=require(_0x21d4('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x21d4('0x6')]=function(_0x3982db,_0x1c6f02){return _0x3982db['define'](_0x21d4('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3283=['moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x513c0d,_0x354bb7){var _0x5f4fc2=function(_0x33be2d){while(--_0x33be2d){_0x513c0d['push'](_0x513c0d['shift']());}};_0x5f4fc2(++_0x354bb7);}(_0x3283,0x184));var _0x3328=function(_0x33e453,_0x3df44e){_0x33e453=_0x33e453-0x0;var _0xea660a=_0x3283[_0x33e453];return _0xea660a;};'use strict';var _=require(_0x3328('0x0'));var util=require(_0x3328('0x1'));var logger=require(_0x3328('0x2'))(_0x3328('0x3'));var moment=require(_0x3328('0x4'));var BPromise=require('bluebird');var rp=require(_0x3328('0x5'));var fs=require('fs');var path=require(_0x3328('0x6'));var rimraf=require(_0x3328('0x7'));var config=require(_0x3328('0x8'));var attributes=require(_0x3328('0x9'));module[_0x3328('0xa')]=function(_0x54f093,_0x2afb24){return _0x54f093[_0x3328('0xb')](_0x3328('0xc'),attributes,{'tableName':_0x3328('0xd'),'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 c2e8cad..fb9b85b 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 _0x9905=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','WhatsappAccount','find','options','raw','attributes','model','map','include','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1551ed,_0x5cc3ce){var _0x499928=function(_0x41b8d5){while(--_0x41b8d5){_0x1551ed['push'](_0x1551ed['shift']());}};_0x499928(++_0x5cc3ce);}(_0x9905,0x130));var _0x5990=function(_0x41723a,_0x4f60ee){_0x41723a=_0x41723a-0x0;var _0x13f078=_0x9905[_0x41723a];return _0x13f078;};'use strict';var _=require(_0x5990('0x0'));var util=require(_0x5990('0x1'));var moment=require(_0x5990('0x2'));var BPromise=require(_0x5990('0x3'));var rs=require(_0x5990('0x4'));var fs=require('fs');var Redis=require(_0x5990('0x5'));var db=require(_0x5990('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5990('0x7'))(_0x5990('0x8'));var config=require(_0x5990('0x9'));var jayson=require(_0x5990('0xa'));var client=jayson[_0x5990('0xb')][_0x5990('0xc')]({'port':0x232a});config[_0x5990('0xd')]=_[_0x5990('0xe')](config[_0x5990('0xd')],{'host':_0x5990('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5990('0x10'))[_0x5990('0x11')](socket);function respondWithRpcPromise(_0x566a66,_0x40561e,_0x179d44){return new BPromise(function(_0x18e840,_0x4abc58){return client[_0x5990('0x12')](_0x566a66,_0x179d44)[_0x5990('0x13')](function(_0x2ce92b){logger['info'](_0x5990('0x14'),_0x40561e,_0x5990('0x15'));logger[_0x5990('0x16')](_0x5990('0x17'),_0x40561e,'request\x20sent',JSON[_0x5990('0x18')](_0x2ce92b));if(_0x2ce92b[_0x5990('0x19')]){if(_0x2ce92b['error']['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x40561e,_0x2ce92b[_0x5990('0x19')][_0x5990('0x1a')]);return _0x4abc58(_0x2ce92b[_0x5990('0x19')][_0x5990('0x1a')]);}logger[_0x5990('0x19')](_0x5990('0x14'),_0x40561e,_0x2ce92b[_0x5990('0x19')][_0x5990('0x1a')]);return _0x18e840(_0x2ce92b['error'][_0x5990('0x1a')]);}else{logger[_0x5990('0x1b')](_0x5990('0x14'),_0x40561e,_0x5990('0x15'));_0x18e840(_0x2ce92b[_0x5990('0x1c')][_0x5990('0x1a')]);}})[_0x5990('0x1d')](function(_0x12cb27){logger[_0x5990('0x19')](_0x5990('0x14'),_0x40561e,_0x12cb27);_0x4abc58(_0x12cb27);});});}exports['ShowWhatsappAccount']=function(_0xe3b24a){var _0x17d48e=this;return new Promise(function(_0x35937d,_0x292084){return db[_0x5990('0x1e')][_0x5990('0x1f')]({'raw':_0xe3b24a['options']?_0xe3b24a[_0x5990('0x20')][_0x5990('0x21')]===undefined?!![]:![]:!![],'where':_0xe3b24a['options']?_0xe3b24a[_0x5990('0x20')]['where']||null:null,'attributes':_0xe3b24a[_0x5990('0x20')]?_0xe3b24a[_0x5990('0x20')][_0x5990('0x22')]||null:null,'include':_0xe3b24a['options']?_0xe3b24a[_0x5990('0x20')]['include']?_['map'](_0xe3b24a[_0x5990('0x20')]['include'],function(_0x435cf1){return{'model':db[_0x435cf1[_0x5990('0x23')]],'as':_0x435cf1['as'],'attributes':_0x435cf1['attributes'],'include':_0x435cf1['include']?_[_0x5990('0x24')](_0x435cf1[_0x5990('0x25')],function(_0x17cc48){return{'model':db[_0x17cc48[_0x5990('0x23')]],'as':_0x17cc48['as'],'attributes':_0x17cc48[_0x5990('0x22')],'include':_0x17cc48[_0x5990('0x25')]?_[_0x5990('0x24')](_0x17cc48['include'],function(_0xddabd9){return{'model':db[_0xddabd9[_0x5990('0x23')]],'as':_0xddabd9['as'],'attributes':_0xddabd9[_0x5990('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5990('0x13')](function(_0x3b1d8e){logger[_0x5990('0x1b')](_0x5990('0x26'),_0xe3b24a);logger['debug'](_0x5990('0x26'),_0xe3b24a,JSON[_0x5990('0x18')](_0x3b1d8e));_0x35937d(_0x3b1d8e);})[_0x5990('0x1d')](function(_0x30c678){logger['error']('ShowWhatsappAccount',_0x30c678[_0x5990('0x1a')],_0xe3b24a);_0x292084(_0x17d48e[_0x5990('0x19')](0x1f4,_0x30c678[_0x5990('0x1a')]));});});}; \ No newline at end of file +var _0x57c2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','model','attributes','map','catch','lodash','util','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x57c2,0x115));var _0x257c=function(_0xb81d62,_0x863f81){_0xb81d62=_0xb81d62-0x0;var _0x9d227=_0x57c2[_0xb81d62];return _0x9d227;};'use strict';var _=require(_0x257c('0x0'));var util=require(_0x257c('0x1'));var moment=require(_0x257c('0x2'));var BPromise=require('bluebird');var rs=require(_0x257c('0x3'));var fs=require('fs');var Redis=require(_0x257c('0x4'));var db=require(_0x257c('0x5'))['db'];var utils=require(_0x257c('0x6'));var logger=require(_0x257c('0x7'))('rpc');var config=require(_0x257c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x257c('0x9')][_0x257c('0xa')]({'port':0x232a});config['redis']=_[_0x257c('0xb')](config[_0x257c('0xc')],{'host':_0x257c('0xd'),'port':0x18eb});var socket=require(_0x257c('0xe'))(new Redis(config['redis']));require(_0x257c('0xf'))[_0x257c('0x10')](socket);function respondWithRpcPromise(_0x2890fd,_0x2b33dc,_0x56fc7b){return new BPromise(function(_0x296bfa,_0x1df4dc){return client[_0x257c('0x11')](_0x2890fd,_0x56fc7b)[_0x257c('0x12')](function(_0x587e46){logger[_0x257c('0x13')](_0x257c('0x14'),_0x2b33dc,_0x257c('0x15'));logger[_0x257c('0x16')](_0x257c('0x17'),_0x2b33dc,_0x257c('0x15'),JSON[_0x257c('0x18')](_0x587e46));if(_0x587e46['error']){if(_0x587e46['error'][_0x257c('0x19')]===0x1f4){logger[_0x257c('0x1a')](_0x257c('0x14'),_0x2b33dc,_0x587e46['error'][_0x257c('0x1b')]);return _0x1df4dc(_0x587e46[_0x257c('0x1a')]['message']);}logger[_0x257c('0x1a')](_0x257c('0x14'),_0x2b33dc,_0x587e46[_0x257c('0x1a')][_0x257c('0x1b')]);return _0x296bfa(_0x587e46[_0x257c('0x1a')][_0x257c('0x1b')]);}else{logger[_0x257c('0x13')](_0x257c('0x14'),_0x2b33dc,'request\x20sent');_0x296bfa(_0x587e46[_0x257c('0x1c')][_0x257c('0x1b')]);}})['catch'](function(_0x46f877){logger['error'](_0x257c('0x14'),_0x2b33dc,_0x46f877);_0x1df4dc(_0x46f877);});});}exports[_0x257c('0x1d')]=function(_0x3bccd8){var _0x4f7cd0=this;return new Promise(function(_0x35362f,_0x3e5c29){return db[_0x257c('0x1e')][_0x257c('0x1f')]({'raw':_0x3bccd8[_0x257c('0x20')]?_0x3bccd8['options'][_0x257c('0x21')]===undefined?!![]:![]:!![],'where':_0x3bccd8[_0x257c('0x20')]?_0x3bccd8[_0x257c('0x20')][_0x257c('0x22')]||null:null,'attributes':_0x3bccd8['options']?_0x3bccd8[_0x257c('0x20')]['attributes']||null:null,'include':_0x3bccd8['options']?_0x3bccd8[_0x257c('0x20')][_0x257c('0x23')]?_['map'](_0x3bccd8[_0x257c('0x20')][_0x257c('0x23')],function(_0x2bb239){return{'model':db[_0x2bb239[_0x257c('0x24')]],'as':_0x2bb239['as'],'attributes':_0x2bb239[_0x257c('0x25')],'include':_0x2bb239[_0x257c('0x23')]?_[_0x257c('0x26')](_0x2bb239[_0x257c('0x23')],function(_0x1723b5){return{'model':db[_0x1723b5[_0x257c('0x24')]],'as':_0x1723b5['as'],'attributes':_0x1723b5[_0x257c('0x25')],'include':_0x1723b5[_0x257c('0x23')]?_[_0x257c('0x26')](_0x1723b5[_0x257c('0x23')],function(_0x189ac5){return{'model':db[_0x189ac5[_0x257c('0x24')]],'as':_0x189ac5['as'],'attributes':_0x189ac5[_0x257c('0x25')]};}):[]};}):[]};}):[]:[]})[_0x257c('0x12')](function(_0x5f4313){logger[_0x257c('0x13')]('ShowWhatsappAccount',_0x3bccd8);logger[_0x257c('0x16')](_0x257c('0x1d'),_0x3bccd8,JSON[_0x257c('0x18')](_0x5f4313));_0x35362f(_0x5f4313);})[_0x257c('0x27')](function(_0x5a7685){logger['error'](_0x257c('0x1d'),_0x5a7685[_0x257c('0x1b')],_0x3bccd8);_0x3e5c29(_0x4f7cd0[_0x257c('0x1a')](0x1f4,_0x5a7685['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e9c4e3d..91c5d26 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 _0x154c=['register','whatsappAccount:','save','remove','update','emit','removeListener'];(function(_0x3ff036,_0x5be445){var _0x1caded=function(_0x9ce6e0){while(--_0x9ce6e0){_0x3ff036['push'](_0x3ff036['shift']());}};_0x1caded(++_0x5be445);}(_0x154c,0x6b));var _0xc154=function(_0x42cfc3,_0x581094){_0x42cfc3=_0x42cfc3-0x0;var _0x506c47=_0x154c[_0x42cfc3];return _0x506c47;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xc154('0x0'),_0xc154('0x1'),_0xc154('0x2')];function createListener(_0x203403,_0x360502){return function(_0x4f63e0){_0x360502[_0xc154('0x3')](_0x203403,_0x4f63e0);};}function removeListener(_0x204bfd,_0x2bc200){return function(){WhatsappAccountEvents[_0xc154('0x4')](_0x204bfd,_0x2bc200);};}exports[_0xc154('0x5')]=function(_0x13aa27){for(var _0xf6dd89=0x0,_0x57e6d5=events['length'];_0xf6dd89<_0x57e6d5;_0xf6dd89++){var _0x7e15b5=events[_0xf6dd89];var _0x35651f=createListener(_0xc154('0x6')+_0x7e15b5,_0x13aa27);WhatsappAccountEvents['on'](_0x7e15b5,_0x35651f);}}; \ No newline at end of file +var _0x31ac=['save','update','removeListener','register','length','whatsappAccount:'];(function(_0x2d43e3,_0x814574){var _0x4b46d9=function(_0xb9ec98){while(--_0xb9ec98){_0x2d43e3['push'](_0x2d43e3['shift']());}};_0x4b46d9(++_0x814574);}(_0x31ac,0x1c8));var _0xc31a=function(_0x2ffcac,_0x13706e){_0x2ffcac=_0x2ffcac-0x0;var _0x1ae5a=_0x31ac[_0x2ffcac];return _0x1ae5a;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xc31a('0x0'),'remove',_0xc31a('0x1')];function createListener(_0x373a13,_0x1d5be3){return function(_0x1ae156){_0x1d5be3['emit'](_0x373a13,_0x1ae156);};}function removeListener(_0x39f941,_0xfbf3c1){return function(){WhatsappAccountEvents[_0xc31a('0x2')](_0x39f941,_0xfbf3c1);};}exports[_0xc31a('0x3')]=function(_0x2a3c8b){for(var _0x5f18a0=0x0,_0x6b5948=events[_0xc31a('0x4')];_0x5f18a0<_0x6b5948;_0x5f18a0++){var _0x32cd40=events[_0x5f18a0];var _0x41d885=createListener(_0xc31a('0x5')+_0x32cd40,_0x2a3c8b);WhatsappAccountEvents['on'](_0x32cd40,_0x41d885);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b816c8d..d9c916a 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 _0x90f9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x90f9,0xb9));var _0x990f=function(_0x4982d3,_0x2803a1){_0x4982d3=_0x4982d3-0x0;var _0xbf09c1=_0x90f9[_0x4982d3];return _0xbf09c1;};'use strict';var multer=require('multer');var util=require(_0x990f('0x0'));var path=require(_0x990f('0x1'));var timeout=require(_0x990f('0x2'));var express=require(_0x990f('0x3'));var router=express[_0x990f('0x4')]();var fs_extra=require(_0x990f('0x5'));var auth=require(_0x990f('0x6'));var interaction=require(_0x990f('0x7'));var config=require(_0x990f('0x8'));var controller=require('./whatsappApplication.controller');router[_0x990f('0x9')]('/',auth[_0x990f('0xa')](),controller[_0x990f('0xb')]);router[_0x990f('0x9')]('/:id',auth[_0x990f('0xa')](),controller[_0x990f('0xc')]);router[_0x990f('0xd')]('/',auth[_0x990f('0xa')](),controller[_0x990f('0xe')]);router[_0x990f('0xf')](_0x990f('0x10'),auth[_0x990f('0xa')](),controller['update']);router['delete'](_0x990f('0x10'),auth[_0x990f('0xa')](),controller[_0x990f('0x11')]);module[_0x990f('0x12')]=router; \ No newline at end of file +var _0x5bc8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update','delete','exports','util','path','connect-timeout'];(function(_0x59b0c5,_0x327501){var _0x20c952=function(_0x5673d0){while(--_0x5673d0){_0x59b0c5['push'](_0x59b0c5['shift']());}};_0x20c952(++_0x327501);}(_0x5bc8,0x7b));var _0x85bc=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x5bc8[_0x25a42a];return _0x1129b1;};'use strict';var multer=require('multer');var util=require(_0x85bc('0x0'));var path=require(_0x85bc('0x1'));var timeout=require(_0x85bc('0x2'));var express=require(_0x85bc('0x3'));var router=express[_0x85bc('0x4')]();var fs_extra=require(_0x85bc('0x5'));var auth=require(_0x85bc('0x6'));var interaction=require(_0x85bc('0x7'));var config=require(_0x85bc('0x8'));var controller=require('./whatsappApplication.controller');router[_0x85bc('0x9')]('/',auth[_0x85bc('0xa')](),controller[_0x85bc('0xb')]);router['get'](_0x85bc('0xc'),auth[_0x85bc('0xa')](),controller['show']);router[_0x85bc('0xd')]('/',auth[_0x85bc('0xa')](),controller[_0x85bc('0xe')]);router['put'](_0x85bc('0xc'),auth[_0x85bc('0xa')](),controller[_0x85bc('0xf')]);router[_0x85bc('0x10')]('/:id',auth[_0x85bc('0xa')](),controller['destroy']);module[_0x85bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 69e363d..ade8943 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 _0xb6fa=['sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xb6fa[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0xab6f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xab6f('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xab6f('0x1')]},'interval':{'type':Sequelize[_0xab6f('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xbf26=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x20c5b1,_0x1e98f5){var _0x856c2e=function(_0x3a00cd){while(--_0x3a00cd){_0x20c5b1['push'](_0x20c5b1['shift']());}};_0x856c2e(++_0x1e98f5);}(_0xbf26,0xcf));var _0x6bf2=function(_0x1a4e65,_0x477f1b){_0x1a4e65=_0x1a4e65-0x0;var _0x3c371e=_0xbf26[_0x1a4e65];return _0x3c371e;};'use strict';var Sequelize=require('sequelize');module[_0x6bf2('0x0')]={'priority':{'type':Sequelize[_0x6bf2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6bf2('0x2')],'allowNull':![],'defaultValue':_0x6bf2('0x3')},'appdata':{'type':Sequelize[_0x6bf2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6bf2('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 98a4f47..fd633ea 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb67=['catch','show','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','name','WhatsappApplication','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows'];(function(_0x465a4a,_0x2f3f63){var _0x11bf22=function(_0x4b569c){while(--_0x4b569c){_0x465a4a['push'](_0x465a4a['shift']());}};_0x11bf22(++_0x2f3f63);}(_0xfb67,0xdd));var _0x7fb6=function(_0x559fba,_0x2811c0){_0x559fba=_0x559fba-0x0;var _0x450c6c=_0xfb67[_0x559fba];return _0x450c6c;};'use strict';var emlformat=require(_0x7fb6('0x0'));var rimraf=require(_0x7fb6('0x1'));var zipdir=require(_0x7fb6('0x2'));var jsonpatch=require(_0x7fb6('0x3'));var rp=require(_0x7fb6('0x4'));var moment=require(_0x7fb6('0x5'));var BPromise=require(_0x7fb6('0x6'));var Mustache=require('mustache');var util=require(_0x7fb6('0x7'));var path=require(_0x7fb6('0x8'));var sox=require(_0x7fb6('0x9'));var csv=require(_0x7fb6('0xa'));var ejs=require(_0x7fb6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fb6('0xc'));var squel=require(_0x7fb6('0xd'));var crypto=require(_0x7fb6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fb6('0xf'));var toCsv=require(_0x7fb6('0xa'));var querystring=require('querystring');var Papa=require(_0x7fb6('0x10'));var Redis=require(_0x7fb6('0x11'));var authService=require(_0x7fb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fb6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb6('0x14'))(_0x7fb6('0x15'));var utils=require(_0x7fb6('0x16'));var config=require(_0x7fb6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fb6('0x18'))['db'];function respondWithStatusCode(_0x1b6ac7,_0x3c594f){_0x3c594f=_0x3c594f||0xcc;return function(_0x549370){if(_0x549370){return _0x1b6ac7['sendStatus'](_0x3c594f);}return _0x1b6ac7['status'](_0x3c594f)['end']();};}function respondWithResult(_0x4fe18e,_0x59287e){_0x59287e=_0x59287e||0xc8;return function(_0x2e8b7c){if(_0x2e8b7c){return _0x4fe18e[_0x7fb6('0x19')](_0x59287e)['json'](_0x2e8b7c);}};}function respondWithFilteredResult(_0x196700,_0x3e4441){return function(_0x5046e2){if(_0x5046e2){var _0xb4c375=typeof _0x3e4441[_0x7fb6('0x1a')]===_0x7fb6('0x1b')&&typeof _0x3e4441[_0x7fb6('0x1c')]===_0x7fb6('0x1b');var _0x26c3ec=_0x5046e2[_0x7fb6('0x1d')];var _0x3ef701=_0xb4c375?0x0:_0x3e4441[_0x7fb6('0x1a')];var _0x5de506=_0xb4c375?_0x5046e2[_0x7fb6('0x1d')]:_0x3e4441[_0x7fb6('0x1a')]+_0x3e4441[_0x7fb6('0x1c')];var _0x169389;if(_0x5de506>=_0x26c3ec){_0x5de506=_0x26c3ec;_0x169389=0xc8;}else{_0x169389=0xce;}_0x196700[_0x7fb6('0x19')](_0x169389);return _0x196700[_0x7fb6('0x1e')](_0x7fb6('0x1f'),_0x3ef701+'-'+_0x5de506+'/'+_0x26c3ec)['json'](_0x5046e2);}return null;};}function patchUpdates(_0x5e6997){return function(_0x1fa63a){try{jsonpatch[_0x7fb6('0x20')](_0x1fa63a,_0x5e6997,!![]);}catch(_0x293c9d){return BPromise[_0x7fb6('0x21')](_0x293c9d);}return _0x1fa63a['save']();};}function saveUpdates(_0xc44cf5,_0x13ad95){return function(_0x490749){if(_0x490749){return _0x490749[_0x7fb6('0x22')](_0xc44cf5)['then'](function(_0x488cd2){return _0x488cd2;});}return null;};}function removeEntity(_0x34a4d1,_0x4b15e5){return function(_0x51ed55){if(_0x51ed55){return _0x51ed55['destroy']()[_0x7fb6('0x23')](function(){_0x34a4d1['status'](0xcc)[_0x7fb6('0x24')]();});}};}function handleEntityNotFound(_0x4a9866,_0x3566a1){return function(_0xc60290){if(!_0xc60290){_0x4a9866[_0x7fb6('0x25')](0x194);}return _0xc60290;};}function handleError(_0x260e8b,_0x253f23){_0x253f23=_0x253f23||0x1f4;return function(_0x4c9b90){logger[_0x7fb6('0x26')](_0x4c9b90['stack']);if(_0x4c9b90[_0x7fb6('0x27')]){delete _0x4c9b90[_0x7fb6('0x27')];}_0x260e8b['status'](_0x253f23)['send'](_0x4c9b90);};}exports['index']=function(_0x25216a,_0x440a04){var _0x35e18f={},_0x3bf606={},_0x7f3844={'count':0x0,'rows':[]};var _0x2bc3b9=_['map'](db[_0x7fb6('0x28')]['rawAttributes'],function(_0x4221c3){return{'name':_0x4221c3[_0x7fb6('0x29')],'type':_0x4221c3[_0x7fb6('0x2a')][_0x7fb6('0x2b')]};});_0x3bf606[_0x7fb6('0x2c')]=_[_0x7fb6('0x2d')](_0x2bc3b9,_0x7fb6('0x27'));_0x3bf606[_0x7fb6('0x2e')]=_[_0x7fb6('0x2f')](_0x25216a['query']);_0x3bf606[_0x7fb6('0x30')]=_[_0x7fb6('0x31')](_0x3bf606[_0x7fb6('0x2c')],_0x3bf606[_0x7fb6('0x2e')]);_0x35e18f[_0x7fb6('0x32')]=_[_0x7fb6('0x31')](_0x3bf606[_0x7fb6('0x2c')],qs[_0x7fb6('0x33')](_0x25216a[_0x7fb6('0x2e')]['fields']));_0x35e18f[_0x7fb6('0x32')]=_0x35e18f[_0x7fb6('0x32')][_0x7fb6('0x34')]?_0x35e18f[_0x7fb6('0x32')]:_0x3bf606['model'];if(!_0x25216a['query'][_0x7fb6('0x35')](_0x7fb6('0x36'))){_0x35e18f[_0x7fb6('0x1c')]=qs[_0x7fb6('0x1c')](_0x25216a[_0x7fb6('0x2e')]['limit']);_0x35e18f[_0x7fb6('0x1a')]=qs[_0x7fb6('0x1a')](_0x25216a[_0x7fb6('0x2e')][_0x7fb6('0x1a')]);}_0x35e18f['order']=qs[_0x7fb6('0x37')](_0x25216a[_0x7fb6('0x2e')]['sort']);_0x35e18f[_0x7fb6('0x38')]=qs['filters'](_[_0x7fb6('0x39')](_0x25216a['query'],_0x3bf606[_0x7fb6('0x30')]),_0x2bc3b9);if(_0x25216a['query'][_0x7fb6('0x3a')]){_0x35e18f[_0x7fb6('0x38')]=_[_0x7fb6('0x3b')](_0x35e18f[_0x7fb6('0x38')],{'$or':_[_0x7fb6('0x2d')](_0x2bc3b9,function(_0x39edfe){if(_0x39edfe['type']!=='VIRTUAL'){var _0x5d237={};_0x5d237[_0x39edfe[_0x7fb6('0x27')]]={'$like':'%'+_0x25216a[_0x7fb6('0x2e')][_0x7fb6('0x3a')]+'%'};return _0x5d237;}})});}_0x35e18f=_['merge']({},_0x35e18f,_0x25216a['options']);var _0x213e6a={'where':_0x35e18f['where']};return db[_0x7fb6('0x28')][_0x7fb6('0x1d')](_0x213e6a)[_0x7fb6('0x23')](function(_0x33828c){_0x7f3844[_0x7fb6('0x1d')]=_0x33828c;if(_0x25216a[_0x7fb6('0x2e')][_0x7fb6('0x3c')]){_0x35e18f[_0x7fb6('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x35e18f);})[_0x7fb6('0x23')](function(_0x543de3){_0x7f3844[_0x7fb6('0x3e')]=_0x543de3;return _0x7f3844;})[_0x7fb6('0x23')](respondWithFilteredResult(_0x440a04,_0x35e18f))[_0x7fb6('0x3f')](handleError(_0x440a04,null));};exports[_0x7fb6('0x40')]=function(_0x6fa286,_0x3b77ba){var _0x1dbfb8={'raw':!![],'where':{'id':_0x6fa286['params']['id']}},_0x661d04={};_0x661d04['model']=_[_0x7fb6('0x2f')](db['WhatsappApplication'][_0x7fb6('0x41')]);_0x661d04['query']=_[_0x7fb6('0x2f')](_0x6fa286[_0x7fb6('0x2e')]);_0x661d04['filters']=_[_0x7fb6('0x31')](_0x661d04[_0x7fb6('0x2c')],_0x661d04[_0x7fb6('0x2e')]);_0x1dbfb8[_0x7fb6('0x32')]=_[_0x7fb6('0x31')](_0x661d04[_0x7fb6('0x2c')],qs[_0x7fb6('0x33')](_0x6fa286[_0x7fb6('0x2e')][_0x7fb6('0x33')]));_0x1dbfb8['attributes']=_0x1dbfb8[_0x7fb6('0x32')]['length']?_0x1dbfb8[_0x7fb6('0x32')]:_0x661d04[_0x7fb6('0x2c')];if(_0x6fa286['query'][_0x7fb6('0x3c')]){_0x1dbfb8[_0x7fb6('0x3d')]=[{'all':!![]}];}_0x1dbfb8=_[_0x7fb6('0x3b')]({},_0x1dbfb8,_0x6fa286['options']);return db[_0x7fb6('0x28')][_0x7fb6('0x42')](_0x1dbfb8)[_0x7fb6('0x23')](handleEntityNotFound(_0x3b77ba,null))[_0x7fb6('0x23')](respondWithResult(_0x3b77ba,null))[_0x7fb6('0x3f')](handleError(_0x3b77ba,null));};exports[_0x7fb6('0x43')]=function(_0x363564,_0x4eac42){return db[_0x7fb6('0x28')][_0x7fb6('0x43')](_0x363564['body'],{})[_0x7fb6('0x23')](respondWithResult(_0x4eac42,0xc9))['catch'](handleError(_0x4eac42,null));};exports[_0x7fb6('0x22')]=function(_0x597eac,_0x2fb8f0){if(_0x597eac['body']['id']){delete _0x597eac[_0x7fb6('0x44')]['id'];}return db[_0x7fb6('0x28')]['find']({'where':{'id':_0x597eac[_0x7fb6('0x45')]['id']}})[_0x7fb6('0x23')](handleEntityNotFound(_0x2fb8f0,null))[_0x7fb6('0x23')](saveUpdates(_0x597eac[_0x7fb6('0x44')],null))[_0x7fb6('0x23')](respondWithResult(_0x2fb8f0,null))[_0x7fb6('0x3f')](handleError(_0x2fb8f0,null));};exports[_0x7fb6('0x46')]=function(_0x164bfd,_0x14993f){return db[_0x7fb6('0x28')][_0x7fb6('0x42')]({'where':{'id':_0x164bfd[_0x7fb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x14993f,null))['then'](removeEntity(_0x14993f,null))[_0x7fb6('0x3f')](handleError(_0x14993f,null));}; \ No newline at end of file +var _0x9b09=['create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','catch','include','find'];(function(_0x4fb14d,_0x40b7ea){var _0x269f6c=function(_0x23ee02){while(--_0x23ee02){_0x4fb14d['push'](_0x4fb14d['shift']());}};_0x269f6c(++_0x40b7ea);}(_0x9b09,0x1ad));var _0x99b0=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0x9b09[_0x3c2666];return _0x10c814;};'use strict';var emlformat=require(_0x99b0('0x0'));var rimraf=require(_0x99b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99b0('0x2'));var rp=require(_0x99b0('0x3'));var moment=require('moment');var BPromise=require(_0x99b0('0x4'));var Mustache=require('mustache');var util=require(_0x99b0('0x5'));var path=require('path');var sox=require(_0x99b0('0x6'));var csv=require(_0x99b0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b0('0x8'));var _=require(_0x99b0('0x9'));var squel=require('squel');var crypto=require(_0x99b0('0xa'));var jsforce=require(_0x99b0('0xb'));var deskjs=require(_0x99b0('0xc'));var toCsv=require(_0x99b0('0x7'));var querystring=require(_0x99b0('0xd'));var Papa=require('papaparse');var Redis=require(_0x99b0('0xe'));var authService=require(_0x99b0('0xf'));var qs=require(_0x99b0('0x10'));var as=require(_0x99b0('0x11'));var hardwareService=require(_0x99b0('0x12'));var logger=require('../../config/logger')(_0x99b0('0x13'));var utils=require(_0x99b0('0x14'));var config=require(_0x99b0('0x15'));var licenseUtil=require(_0x99b0('0x16'));var db=require(_0x99b0('0x17'))['db'];function respondWithStatusCode(_0x42be76,_0x57d64d){_0x57d64d=_0x57d64d||0xcc;return function(_0x256c0b){if(_0x256c0b){return _0x42be76['sendStatus'](_0x57d64d);}return _0x42be76[_0x99b0('0x18')](_0x57d64d)[_0x99b0('0x19')]();};}function respondWithResult(_0x5baf0c,_0x5bba73){_0x5bba73=_0x5bba73||0xc8;return function(_0x27142a){if(_0x27142a){return _0x5baf0c[_0x99b0('0x18')](_0x5bba73)[_0x99b0('0x1a')](_0x27142a);}};}function respondWithFilteredResult(_0x590aa4,_0x4cfd10){return function(_0x4a6b01){if(_0x4a6b01){var _0x2e176f=typeof _0x4cfd10[_0x99b0('0x1b')]==='undefined'&&typeof _0x4cfd10[_0x99b0('0x1c')]===_0x99b0('0x1d');var _0xaa1009=_0x4a6b01[_0x99b0('0x1e')];var _0x1cb302=_0x2e176f?0x0:_0x4cfd10[_0x99b0('0x1b')];var _0x193512=_0x2e176f?_0x4a6b01['count']:_0x4cfd10[_0x99b0('0x1b')]+_0x4cfd10[_0x99b0('0x1c')];var _0x1fb89b;if(_0x193512>=_0xaa1009){_0x193512=_0xaa1009;_0x1fb89b=0xc8;}else{_0x1fb89b=0xce;}_0x590aa4[_0x99b0('0x18')](_0x1fb89b);return _0x590aa4[_0x99b0('0x1f')](_0x99b0('0x20'),_0x1cb302+'-'+_0x193512+'/'+_0xaa1009)[_0x99b0('0x1a')](_0x4a6b01);}return null;};}function patchUpdates(_0x1783ca){return function(_0x310894){try{jsonpatch[_0x99b0('0x21')](_0x310894,_0x1783ca,!![]);}catch(_0x3988c4){return BPromise[_0x99b0('0x22')](_0x3988c4);}return _0x310894[_0x99b0('0x23')]();};}function saveUpdates(_0x1d5f41,_0x462af1){return function(_0x93dcb1){if(_0x93dcb1){return _0x93dcb1[_0x99b0('0x24')](_0x1d5f41)[_0x99b0('0x25')](function(_0x1d7022){return _0x1d7022;});}return null;};}function removeEntity(_0x27b238,_0x35bae9){return function(_0x28f11d){if(_0x28f11d){return _0x28f11d[_0x99b0('0x26')]()[_0x99b0('0x25')](function(){_0x27b238['status'](0xcc)[_0x99b0('0x19')]();});}};}function handleEntityNotFound(_0x4a6c0f,_0x55f4f1){return function(_0x34075a){if(!_0x34075a){_0x4a6c0f[_0x99b0('0x27')](0x194);}return _0x34075a;};}function handleError(_0x123f1b,_0x8df666){_0x8df666=_0x8df666||0x1f4;return function(_0x3ba9c1){logger['error'](_0x3ba9c1[_0x99b0('0x28')]);if(_0x3ba9c1[_0x99b0('0x29')]){delete _0x3ba9c1[_0x99b0('0x29')];}_0x123f1b[_0x99b0('0x18')](_0x8df666)['send'](_0x3ba9c1);};}exports[_0x99b0('0x2a')]=function(_0x2e0850,_0x5429cd){var _0x3421e3={},_0x35ecdb={},_0x27ced8={'count':0x0,'rows':[]};var _0x22a098=_[_0x99b0('0x2b')](db[_0x99b0('0x2c')][_0x99b0('0x2d')],function(_0x398885){return{'name':_0x398885[_0x99b0('0x2e')],'type':_0x398885['type'][_0x99b0('0x2f')]};});_0x35ecdb[_0x99b0('0x30')]=_[_0x99b0('0x2b')](_0x22a098,_0x99b0('0x29'));_0x35ecdb[_0x99b0('0x31')]=_[_0x99b0('0x32')](_0x2e0850['query']);_0x35ecdb[_0x99b0('0x33')]=_[_0x99b0('0x34')](_0x35ecdb[_0x99b0('0x30')],_0x35ecdb[_0x99b0('0x31')]);_0x3421e3[_0x99b0('0x35')]=_[_0x99b0('0x34')](_0x35ecdb[_0x99b0('0x30')],qs[_0x99b0('0x36')](_0x2e0850['query'][_0x99b0('0x36')]));_0x3421e3['attributes']=_0x3421e3[_0x99b0('0x35')][_0x99b0('0x37')]?_0x3421e3['attributes']:_0x35ecdb[_0x99b0('0x30')];if(!_0x2e0850['query']['hasOwnProperty'](_0x99b0('0x38'))){_0x3421e3[_0x99b0('0x1c')]=qs['limit'](_0x2e0850['query'][_0x99b0('0x1c')]);_0x3421e3[_0x99b0('0x1b')]=qs['offset'](_0x2e0850[_0x99b0('0x31')]['offset']);}_0x3421e3[_0x99b0('0x39')]=qs['sort'](_0x2e0850[_0x99b0('0x31')][_0x99b0('0x3a')]);_0x3421e3[_0x99b0('0x3b')]=qs['filters'](_[_0x99b0('0x3c')](_0x2e0850['query'],_0x35ecdb[_0x99b0('0x33')]),_0x22a098);if(_0x2e0850['query'][_0x99b0('0x3d')]){_0x3421e3[_0x99b0('0x3b')]=_[_0x99b0('0x3e')](_0x3421e3[_0x99b0('0x3b')],{'$or':_[_0x99b0('0x2b')](_0x22a098,function(_0x38af80){if(_0x38af80['type']!=='VIRTUAL'){var _0xb9e8a9={};_0xb9e8a9[_0x38af80[_0x99b0('0x29')]]={'$like':'%'+_0x2e0850[_0x99b0('0x31')][_0x99b0('0x3d')]+'%'};return _0xb9e8a9;}})});}_0x3421e3=_[_0x99b0('0x3e')]({},_0x3421e3,_0x2e0850['options']);var _0xace47b={'where':_0x3421e3['where']};return db['WhatsappApplication'][_0x99b0('0x1e')](_0xace47b)[_0x99b0('0x25')](function(_0x42b7b4){_0x27ced8['count']=_0x42b7b4;if(_0x2e0850['query'][_0x99b0('0x3f')]){_0x3421e3['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x3421e3);})['then'](function(_0x1469eb){_0x27ced8[_0x99b0('0x40')]=_0x1469eb;return _0x27ced8;})['then'](respondWithFilteredResult(_0x5429cd,_0x3421e3))[_0x99b0('0x41')](handleError(_0x5429cd,null));};exports['show']=function(_0x68e138,_0x46ae3c){var _0x2911dd={'raw':!![],'where':{'id':_0x68e138['params']['id']}},_0x1ad5be={};_0x1ad5be['model']=_['keys'](db[_0x99b0('0x2c')][_0x99b0('0x2d')]);_0x1ad5be[_0x99b0('0x31')]=_[_0x99b0('0x32')](_0x68e138['query']);_0x1ad5be['filters']=_[_0x99b0('0x34')](_0x1ad5be[_0x99b0('0x30')],_0x1ad5be[_0x99b0('0x31')]);_0x2911dd[_0x99b0('0x35')]=_['intersection'](_0x1ad5be[_0x99b0('0x30')],qs[_0x99b0('0x36')](_0x68e138[_0x99b0('0x31')]['fields']));_0x2911dd[_0x99b0('0x35')]=_0x2911dd[_0x99b0('0x35')]['length']?_0x2911dd['attributes']:_0x1ad5be[_0x99b0('0x30')];if(_0x68e138['query'][_0x99b0('0x3f')]){_0x2911dd[_0x99b0('0x42')]=[{'all':!![]}];}_0x2911dd=_[_0x99b0('0x3e')]({},_0x2911dd,_0x68e138['options']);return db[_0x99b0('0x2c')][_0x99b0('0x43')](_0x2911dd)[_0x99b0('0x25')](handleEntityNotFound(_0x46ae3c,null))[_0x99b0('0x25')](respondWithResult(_0x46ae3c,null))['catch'](handleError(_0x46ae3c,null));};exports['create']=function(_0x57cea0,_0x663789){return db['WhatsappApplication'][_0x99b0('0x44')](_0x57cea0[_0x99b0('0x45')],{})[_0x99b0('0x25')](respondWithResult(_0x663789,0xc9))[_0x99b0('0x41')](handleError(_0x663789,null));};exports[_0x99b0('0x24')]=function(_0x1ddf18,_0x4bcb1d){if(_0x1ddf18['body']['id']){delete _0x1ddf18[_0x99b0('0x45')]['id'];}return db['WhatsappApplication'][_0x99b0('0x43')]({'where':{'id':_0x1ddf18[_0x99b0('0x46')]['id']}})[_0x99b0('0x25')](handleEntityNotFound(_0x4bcb1d,null))[_0x99b0('0x25')](saveUpdates(_0x1ddf18[_0x99b0('0x45')],null))[_0x99b0('0x25')](respondWithResult(_0x4bcb1d,null))[_0x99b0('0x41')](handleError(_0x4bcb1d,null));};exports[_0x99b0('0x26')]=function(_0x2a15dc,_0x5ca074){return db[_0x99b0('0x2c')][_0x99b0('0x43')]({'where':{'id':_0x2a15dc[_0x99b0('0x46')]['id']}})[_0x99b0('0x25')](handleEntityNotFound(_0x5ca074,null))[_0x99b0('0x25')](removeEntity(_0x5ca074,null))[_0x99b0('0x41')](handleError(_0x5ca074,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d02ed98..6ee6960 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 _0x6aa7=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x13c625,_0xc65b8e){var _0x1f2506=function(_0x318ccc){while(--_0x318ccc){_0x13c625['push'](_0x13c625['shift']());}};_0x1f2506(++_0xc65b8e);}(_0x6aa7,0x178));var _0x76aa=function(_0x10a8b3,_0x5210f8){_0x10a8b3=_0x10a8b3-0x0;var _0x5f0c9c=_0x6aa7[_0x10a8b3];return _0x5f0c9c;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x76aa('0xb')});}; \ No newline at end of file +var _0x6bdc=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4fe5ad,_0x4a889e){var _0x182629=function(_0xf43078){while(--_0xf43078){_0x4fe5ad['push'](_0x4fe5ad['shift']());}};_0x182629(++_0x4a889e);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x1432d7,_0x444cbc){_0x1432d7=_0x1432d7-0x0;var _0x2fc0dd=_0x6bdc[_0x1432d7];return _0x2fc0dd;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./whatsappApplication.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc6bd('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f49bc8d..56b552d 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 _0xbd50=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x315003,_0x22db8d){_0x315003=_0x315003-0x0;var _0x7c4b0e=_0xbd50[_0x315003];return _0x7c4b0e;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file +var _0x70e0=['code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1324b5,_0xf25cf7){var _0x22d5a6=function(_0x47b777){while(--_0x47b777){_0x1324b5['push'](_0x1324b5['shift']());}};_0x22d5a6(++_0xf25cf7);}(_0x70e0,0x17b));var _0x070e=function(_0xa734de,_0xfa7ed9){_0xa734de=_0xa734de-0x0;var _0x14f461=_0x70e0[_0xa734de];return _0x14f461;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dbef588..4589983 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 _0xbeea=['whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','update','delete'];(function(_0x33a389,_0x59f55e){var _0x7785db=function(_0xc807f2){while(--_0xc807f2){_0x33a389['push'](_0x33a389['shift']());}};_0x7785db(++_0x59f55e);}(_0xbeea,0xb1));var _0xabee=function(_0x39e23a,_0x17845e){_0x39e23a=_0x39e23a-0x0;var _0x40eda6=_0xbeea[_0x39e23a];return _0x40eda6;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var fs_extra=require(_0xabee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth[_0xabee('0x9')](),controller['index']);router['get'](_0xabee('0xa'),auth[_0xabee('0x9')](),controller['describe']);router[_0xabee('0x8')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xb')]);router[_0xabee('0x8')](_0xabee('0xc'),auth[_0xabee('0x9')](),controller[_0xabee('0xd')]);router['get'](_0xabee('0xe'),auth[_0xabee('0x9')](),controller[_0xabee('0xf')]);router['post']('/',auth[_0xabee('0x9')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x14')),controller[_0xabee('0x15')]);router['put'](_0xabee('0x16'),auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x17')),controller[_0xabee('0x18')]);router[_0xabee('0x19')]('/:id',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x1a')),controller[_0xabee('0x1b')]);router[_0xabee('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xabee('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8958=['destroy','removeTags','util','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','addTags','put','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x27ff13,_0x19e031){var _0x14c083=function(_0x228a55){while(--_0x228a55){_0x27ff13['push'](_0x27ff13['shift']());}};_0x14c083(++_0x19e031);}(_0x8958,0x93));var _0x8895=function(_0x1e37ba,_0x384d1d){_0x1e37ba=_0x1e37ba-0x0;var _0x12a356=_0x8958[_0x1e37ba];return _0x12a356;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get']('/',auth[_0x8895('0x5')](),controller[_0x8895('0x6')]);router[_0x8895('0x7')](_0x8895('0x8'),auth[_0x8895('0x5')](),controller['describe']);router[_0x8895('0x7')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xa')]);router[_0x8895('0x7')](_0x8895('0xb'),auth[_0x8895('0x5')](),controller[_0x8895('0xc')]);router[_0x8895('0x7')](_0x8895('0xd'),auth['isAuthenticated'](),controller[_0x8895('0xe')]);router[_0x8895('0xf')]('/',auth[_0x8895('0x5')](),controller[_0x8895('0x10')]);router[_0x8895('0xf')](_0x8895('0xb'),auth['isAuthenticated'](),controller[_0x8895('0x11')]);router[_0x8895('0xf')](_0x8895('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x8895('0x13'),'whatsappinteraction:addtags'),controller[_0x8895('0x14')]);router[_0x8895('0x15')](_0x8895('0x9'),auth[_0x8895('0x5')](),interaction[_0x8895('0x16')]('whatsapp',_0x8895('0x17')),controller[_0x8895('0x18')]);router[_0x8895('0x19')](_0x8895('0x9'),auth[_0x8895('0x5')](),interaction[_0x8895('0x16')](_0x8895('0x13'),_0x8895('0x1a')),controller[_0x8895('0x1b')]);router[_0x8895('0x19')](_0x8895('0x12'),auth[_0x8895('0x5')](),controller[_0x8895('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c65220a..cc4fa1e 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 _0x94d4=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN'];(function(_0x3844e0,_0x3f573c){var _0x284f14=function(_0x2c8432){while(--_0x2c8432){_0x3844e0['push'](_0x3844e0['shift']());}};_0x284f14(++_0x3f573c);}(_0x94d4,0xa5));var _0x494d=function(_0x4dccf2,_0x5cfcd7){_0x4dccf2=_0x4dccf2-0x0;var _0x12640e=_0x94d4[_0x4dccf2];return _0x12640e;};'use strict';var Sequelize=require(_0x494d('0x0'));var moment=require(_0x494d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x494d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x494d('0x3')]},'disposition':{'type':Sequelize[_0x494d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x494d('0x4')]},'note':{'type':Sequelize[_0x494d('0x4')]},'phone':{'type':Sequelize[_0x494d('0x4')]},'read1stAt':{'type':Sequelize[_0x494d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x494d('0x5')]('in',_0x494d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x494d('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x494d('0x7')]}}; \ No newline at end of file +var _0xb4e2=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x77b0a3,_0xe20ba){var _0x16157b=function(_0x2db8f0){while(--_0x2db8f0){_0x77b0a3['push'](_0x77b0a3['shift']());}};_0x16157b(++_0xe20ba);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x24497d,_0x480367){_0x24497d=_0x24497d-0x0;var _0x5d8cd9=_0xb4e2[_0x24497d];return _0x5d8cd9;};'use strict';var Sequelize=require(_0x2b4e('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x2b4e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2b4e('0x2')]},'note':{'type':Sequelize[_0x2b4e('0x2')]},'phone':{'type':Sequelize[_0x2b4e('0x2')]},'read1stAt':{'type':Sequelize[_0x2b4e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2b4e('0x4')]('in',_0x2b4e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2b4e('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2b4e('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2b4e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2b4e('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index fd49d30..40fb8f1 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 _0x72bc=['name','send','index','WhatsappInteraction','fieldName','type','key','getOptions','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','update','destroy','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','Tag','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','attachments','format','transcript-%d-%s.zip','User','fullname','push','Contact','lastName','Attachment','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','out','firstName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','then','end','sendStatus','error','stack'];(function(_0xc25389,_0x4d62c4){var _0x4c5850=function(_0x1c4792){while(--_0x1c4792){_0xc25389['push'](_0xc25389['shift']());}};_0x4c5850(++_0x4d62c4);}(_0x72bc,0x1d6));var _0xc72b=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x72bc[_0x28947d];return _0x12d2ee;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc72b('0x0'));var moment=require(_0xc72b('0x1'));var BPromise=require(_0xc72b('0x2'));var util=require('util');var path=require(_0xc72b('0x3'));var ejs=require(_0xc72b('0x4'));var fs=require('fs');var _=require(_0xc72b('0x5'));var Redis=require(_0xc72b('0x6'));var interaction=require(_0xc72b('0x7'));var qs=require(_0xc72b('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xc72b('0x9'))(_0xc72b('0xa'));var config=require('../../config/environment');var db=require(_0xc72b('0xb'))['db'];config[_0xc72b('0xc')]=_[_0xc72b('0xd')](config['redis'],{'host':_0xc72b('0xe'),'port':0x18eb});var socket=require(_0xc72b('0xf'))(new Redis(config[_0xc72b('0xc')]));require('./whatsappInteraction.socket')[_0xc72b('0x10')](socket);function respondWithStatusCode(_0x50e576,_0x3b7c2f){_0x3b7c2f=_0x3b7c2f||0xcc;return function(_0x537c0c){if(_0x537c0c){return _0x50e576['sendStatus'](_0x3b7c2f);}return _0x50e576[_0xc72b('0x11')](_0x3b7c2f)['end']();};}function respondWithResult(_0x4bf1b3,_0xf56954){_0xf56954=_0xf56954||0xc8;return function(_0x537fec){if(_0x537fec){return _0x4bf1b3[_0xc72b('0x11')](_0xf56954)[_0xc72b('0x12')](_0x537fec);}};}function respondWithFilteredResult(_0x26eeb9,_0x4e99fd){return function(_0x3e958b){if(_0x3e958b){var _0x34ccb0=typeof _0x4e99fd[_0xc72b('0x13')]===_0xc72b('0x14')&&typeof _0x4e99fd[_0xc72b('0x15')]===_0xc72b('0x14');var _0x3520ed=_0x3e958b['count'];var _0x2ab0b6=_0x34ccb0?0x0:_0x4e99fd[_0xc72b('0x13')];var _0x122496=_0x34ccb0?_0x3e958b[_0xc72b('0x16')]:_0x4e99fd['offset']+_0x4e99fd[_0xc72b('0x15')];var _0x3b56be;if(_0x122496>=_0x3520ed){_0x122496=_0x3520ed;_0x3b56be=0xc8;}else{_0x3b56be=0xce;}_0x26eeb9[_0xc72b('0x11')](_0x3b56be);return _0x26eeb9[_0xc72b('0x17')](_0xc72b('0x18'),_0x2ab0b6+'-'+_0x122496+'/'+_0x3520ed)[_0xc72b('0x12')](_0x3e958b);}return null;};}function saveUpdates(_0x13433e){return function(_0x5789ed){if(_0x5789ed){return _0x5789ed['update'](_0x13433e)[_0xc72b('0x19')](function(_0x1faed9){return _0x1faed9;});}return null;};}function removeEntity(_0x56174b){return function(_0x2a09df){if(_0x2a09df){return _0x2a09df['destroy']()[_0xc72b('0x19')](function(){_0x56174b[_0xc72b('0x11')](0xcc)[_0xc72b('0x1a')]();});}};}function handleEntityNotFound(_0x239369){return function(_0x447711){if(!_0x447711){_0x239369[_0xc72b('0x1b')](0x194);}return _0x447711;};}function handleError(_0x82ec7f,_0xa35399){_0xa35399=_0xa35399||0x1f4;return function(_0x7aa12){logger[_0xc72b('0x1c')](_0x7aa12[_0xc72b('0x1d')]);if(_0x7aa12[_0xc72b('0x1e')]){delete _0x7aa12[_0xc72b('0x1e')];}_0x82ec7f[_0xc72b('0x11')](_0xa35399)[_0xc72b('0x1f')](_0x7aa12);};}exports[_0xc72b('0x20')]=function(_0x2f3a12,_0x55809e){var _0x407e40={};var _0x33e24f=_['map'](db[_0xc72b('0x21')]['rawAttributes'],function(_0x336d0e){return{'name':_0x336d0e[_0xc72b('0x22')],'type':_0x336d0e[_0xc72b('0x23')][_0xc72b('0x24')]};});_0x407e40=qs[_0xc72b('0x25')](_0x33e24f,_0x2f3a12);return interaction['findAll']('whatsapp',_0x2f3a12[_0xc72b('0x26')],_0x2f3a12[_0xc72b('0x27')],_0x407e40,_0x33e24f)[_0xc72b('0x19')](respondWithFilteredResult(_0x55809e,_0x407e40))[_0xc72b('0x28')](handleError(_0x55809e,null));};exports['show']=function(_0x1a04c3,_0x351bdd){var _0x5e9169={'raw':![],'where':{'id':_0x1a04c3[_0xc72b('0x29')]['id']}},_0x22dff4={};_0x22dff4[_0xc72b('0x2a')]=_[_0xc72b('0x2b')](db[_0xc72b('0x21')]['rawAttributes']);_0x22dff4[_0xc72b('0x26')]=_[_0xc72b('0x2b')](_0x1a04c3['query']);_0x22dff4[_0xc72b('0x2c')]=_[_0xc72b('0x2d')](_0x22dff4['model'],_0x22dff4['query']);_0x5e9169[_0xc72b('0x2e')]=_[_0xc72b('0x2d')](_0x22dff4['model'],qs[_0xc72b('0x2f')](_0x1a04c3['query'][_0xc72b('0x2f')]));_0x5e9169[_0xc72b('0x2e')]=_0x5e9169['attributes'][_0xc72b('0x30')]?_0x5e9169['attributes']:_0x22dff4[_0xc72b('0x2a')];if(_0x1a04c3['query']['includeAll']){_0x5e9169[_0xc72b('0x31')]=[{'all':!![]}];}_0x5e9169=_[_0xc72b('0x32')]({},_0x5e9169,_0x1a04c3[_0xc72b('0x33')]);return db['WhatsappInteraction'][_0xc72b('0x34')](_0x5e9169)[_0xc72b('0x19')](handleEntityNotFound(_0x351bdd,null))['then'](respondWithResult(_0x351bdd,null))[_0xc72b('0x28')](handleError(_0x351bdd,null));};exports[_0xc72b('0x35')]=function(_0x40903a,_0x17b9a1){return db[_0xc72b('0x21')][_0xc72b('0x35')](_0x40903a[_0xc72b('0x36')],{})[_0xc72b('0x19')](respondWithResult(_0x17b9a1,0xc9))[_0xc72b('0x28')](handleError(_0x17b9a1,null));};exports[_0xc72b('0x37')]=function(_0x36d397,_0x247d10){if(_0x36d397['body']['id']){delete _0x36d397[_0xc72b('0x36')]['id'];}return db[_0xc72b('0x21')][_0xc72b('0x34')]({'where':{'id':_0x36d397[_0xc72b('0x29')]['id']}})['then'](handleEntityNotFound(_0x247d10,null))[_0xc72b('0x19')](saveUpdates(_0x36d397[_0xc72b('0x36')],null))['then'](respondWithResult(_0x247d10,null))[_0xc72b('0x28')](handleError(_0x247d10,null));};exports[_0xc72b('0x38')]=function(_0x235256,_0x24c39e){return db[_0xc72b('0x21')][_0xc72b('0x34')]({'where':{'id':_0x235256[_0xc72b('0x29')]['id']}})['then'](handleEntityNotFound(_0x24c39e,null))[_0xc72b('0x19')](removeEntity(_0x24c39e,null))[_0xc72b('0x28')](handleError(_0x24c39e,null));};exports[_0xc72b('0x39')]=function(_0x414489,_0x41eb4b){return db[_0xc72b('0x21')][_0xc72b('0x39')]()['then'](respondWithResult(_0x41eb4b,null))[_0xc72b('0x28')](handleError(_0x41eb4b,null));};exports[_0xc72b('0x3a')]=function(_0x43931f,_0xc0875c){return db[_0xc72b('0x3b')][_0xc72b('0x34')]({'where':{'id':_0x43931f[_0xc72b('0x29')]['id']}})[_0xc72b('0x19')](handleEntityNotFound(_0xc0875c,null))[_0xc72b('0x19')](function(_0x9885ea){if(_0x9885ea){return _0x9885ea[_0xc72b('0x3a')](_0x43931f['body'][_0xc72b('0x3c')],_[_0xc72b('0x3d')](_0x43931f['body'],[_0xc72b('0x3c'),'id'])||{});}})[_0xc72b('0x19')](respondWithResult(_0xc0875c,null))[_0xc72b('0x28')](handleError(_0xc0875c,null));};exports['getMessages']=function(_0x76113e,_0x3cab6f){var _0x28932d={'raw':![],'where':{}};var _0x5e6039={};var _0x259e55={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xc72b('0x3e')]({'where':{'id':_0x76113e['params']['id']}})[_0xc72b('0x19')](handleEntityNotFound(_0x3cab6f,null))[_0xc72b('0x19')](function(_0x144616){if(_0x144616){_0x5e6039[_0xc72b('0x2a')]=_['keys'](db[_0xc72b('0x3b')]['rawAttributes']);_0x5e6039[_0xc72b('0x26')]=_[_0xc72b('0x2b')](_0x76113e['query']);_0x5e6039[_0xc72b('0x2c')]=_[_0xc72b('0x2d')](_0x5e6039[_0xc72b('0x2a')],_0x5e6039['query']);_0x28932d[_0xc72b('0x2e')]=_[_0xc72b('0x2d')](_0x5e6039[_0xc72b('0x2a')],qs['fields'](_0x76113e[_0xc72b('0x26')]['fields']));_0x28932d['attributes']=_0x28932d[_0xc72b('0x2e')]['length']?_0x28932d[_0xc72b('0x2e')]:_0x5e6039[_0xc72b('0x2a')];if(!_0x76113e[_0xc72b('0x26')][_0xc72b('0x3f')](_0xc72b('0x40'))){_0x28932d['limit']=qs['limit'](_0x76113e['query'][_0xc72b('0x15')]);_0x28932d[_0xc72b('0x13')]=qs[_0xc72b('0x13')](_0x76113e['query'][_0xc72b('0x13')]);}_0x28932d[_0xc72b('0x41')]=qs[_0xc72b('0x42')](_0x76113e[_0xc72b('0x26')][_0xc72b('0x42')]);_0x28932d[_0xc72b('0x43')]=qs[_0xc72b('0x2c')](_[_0xc72b('0x44')](_0x76113e[_0xc72b('0x26')],_0x5e6039[_0xc72b('0x2c')]));_0x28932d[_0xc72b('0x43')][_0xc72b('0x45')]=_0x144616['id'];if(_0x76113e[_0xc72b('0x26')][_0xc72b('0x46')]){_0x28932d[_0xc72b('0x43')]=_[_0xc72b('0x32')](_0x28932d[_0xc72b('0x43')],{'$or':_[_0xc72b('0x47')](_0x28932d['attributes'],function(_0x110110){var _0x3d2a55={};_0x3d2a55[_0x110110]={'$like':'%'+_0x76113e[_0xc72b('0x26')][_0xc72b('0x46')]+'%'};return _0x3d2a55;})});}if(_0x76113e[_0xc72b('0x26')][_0xc72b('0x48')]){var _0x57063d=_0x76113e[_0xc72b('0x26')][_0xc72b('0x48')][_0xc72b('0x49')](',');var _0x37ebd7={};_0x37ebd7[_0x57063d[0x0]]={'$gte':moment(_0x57063d[0x1])['format'](_0xc72b('0x4a'))};_0x28932d['where']=_['merge'](_0x28932d[_0xc72b('0x43')],_0x37ebd7);}_0x28932d=_['merge']({},_0x28932d,_0x76113e[_0xc72b('0x33')]);return db[_0xc72b('0x3b')][_0xc72b('0x16')]({'where':_0x28932d[_0xc72b('0x43')]})[_0xc72b('0x19')](function(_0x560843){_0x259e55[_0xc72b('0x16')]=_0x560843;if(_0x76113e['query'][_0xc72b('0x4b')]){_0x28932d['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xc72b('0x4c')](_0x28932d);})['then'](function(_0x43a917){_0x259e55[_0xc72b('0x4d')]=_0x43a917;return _0x259e55;});}})['then'](respondWithFilteredResult(_0x3cab6f,_0x28932d))['catch'](handleError(_0x3cab6f,null));};exports[_0xc72b('0x4e')]=function(_0x134bf0,_0x235929){return db[_0xc72b('0x21')][_0xc72b('0x34')]({'where':{'id':_0x134bf0[_0xc72b('0x29')]['id']}})[_0xc72b('0x19')](handleEntityNotFound(_0x235929,null))['then'](function(_0x4f3864){if(_0x4f3864){return _0x4f3864['setTags'](_0x134bf0[_0xc72b('0x36')][_0xc72b('0x3c')],_[_0xc72b('0x3d')](_0x134bf0[_0xc72b('0x36')],['ids','id'])||{})['spread'](function(){return db[_0xc72b('0x4f')][_0xc72b('0x4c')]({'attributes':['id',_0xc72b('0x1e'),'color'],'where':{'id':_0x134bf0[_0xc72b('0x36')]['ids']}});})['then'](function(_0x1df98d){socket[_0xc72b('0x50')](_0xc72b('0x51'),{'id':Number(_0x134bf0[_0xc72b('0x29')]['id']),'tags':_0x1df98d||[]});return{'id':Number(_0x134bf0[_0xc72b('0x29')]['id']),'tags':_0x1df98d||[]};});}})[_0xc72b('0x19')](respondWithResult(_0x235929,null))[_0xc72b('0x28')](handleError(_0x235929,null));};exports[_0xc72b('0x52')]=function(_0x46116d,_0x3b6272){return db[_0xc72b('0x21')][_0xc72b('0x34')]({'where':{'id':_0x46116d[_0xc72b('0x29')]['id']}})['then'](handleEntityNotFound(_0x3b6272,null))[_0xc72b('0x19')](function(_0x585fe1){if(_0x585fe1){return _0x585fe1[_0xc72b('0x52')](_0x46116d[_0xc72b('0x26')][_0xc72b('0x3c')]);}})[_0xc72b('0x19')](respondWithStatusCode(_0x3b6272,null))[_0xc72b('0x28')](handleError(_0x3b6272,null));};exports['download']=function(_0x3d08dc,_0x3daf64){var _0x5b4fe1=moment()[_0xc72b('0x53')]()[_0xc72b('0x54')]();var _0x447e53=path[_0xc72b('0x55')](config[_0xc72b('0x56')],_0xc72b('0x57'),'files','tmp');var _0x596cd0=path[_0xc72b('0x55')](config[_0xc72b('0x56')],_0xc72b('0x57'),'files',_0xc72b('0x58'));var _0x2936b6=path['join'](_0x447e53,_0x5b4fe1);var _0x157f8a=util[_0xc72b('0x59')](_0xc72b('0x5a'),_0x3d08dc[_0xc72b('0x29')]['id'],_0x5b4fe1);var _0x4983ba=path[_0xc72b('0x55')](_0x447e53,_0x157f8a);var _0x540b90=[];_0x540b90['push']({'model':db[_0xc72b('0x5b')],'as':_0xc72b('0x5b'),'attributes':['id',_0xc72b('0x5c')],'raw':!![]});_0x540b90[_0xc72b('0x5d')]({'model':db['CmContact'],'as':_0xc72b('0x5e'),'attributes':['id','firstName',_0xc72b('0x5f')],'raw':!![]});if(_0x3d08dc[_0xc72b('0x26')]['attachments']){_0x540b90['push']({'model':db[_0xc72b('0x60')],'as':_0xc72b('0x60'),'raw':!![]});}var _0x5c2897=[{'model':db[_0xc72b('0x3b')],'as':'Messages','attributes':['id',_0xc72b('0x36'),_0xc72b('0x61'),_0xc72b('0x62'),_0xc72b('0x63'),_0xc72b('0x64')],'include':_0x540b90}];_0x5c2897[_0xc72b('0x5d')]({'model':db['WhatsappAccount'],'as':_0xc72b('0x65'),'attributes':['id',_0xc72b('0x1e')]});_0x5c2897[_0xc72b('0x5d')]({'model':db[_0xc72b('0x5b')],'as':_0xc72b('0x66'),'attributes':['id',_0xc72b('0x5c')]});return db[_0xc72b('0x21')][_0xc72b('0x34')]({'where':{'id':_0x3d08dc[_0xc72b('0x29')]['id']},'include':_0x5c2897})['then'](handleEntityNotFound(_0x3daf64,null))[_0xc72b('0x19')](function(_0x4820ae){if(_0x4820ae){var _0x572056=_0x4820ae[_0xc72b('0x67')]({'plain':!![]});fs[_0xc72b('0x68')](_0x2936b6);var _0x220885={'channel':_0xc72b('0x69'),'account':_0x572056['Account'][_0xc72b('0x1e')],'agent':_0x572056[_0xc72b('0x66')]?_0x572056['Owner']['fullname']:_0xc72b('0x6a'),'createdAt':moment(_0x572056[_0xc72b('0x61')])['format'](_0xc72b('0x4a'))[_0xc72b('0x54')](),'closedAt':_0x572056[_0xc72b('0x6b')]?moment(_0x572056[_0xc72b('0x6c')])[_0xc72b('0x59')](_0xc72b('0x4a'))['toString']():'','disposition':_0x572056[_0xc72b('0x6d')],'messages':_(_0x572056[_0xc72b('0x6e')])[_0xc72b('0x46')]({'secret':![]})[_0xc72b('0x47')](function(_0x581914){if(_0x581914[_0xc72b('0x60')]){var _0x1a663e=path['join'](_0x596cd0,_0x581914[_0xc72b('0x60')][_0xc72b('0x6f')]);if(fs[_0xc72b('0x70')](_0x1a663e)){fs[_0xc72b('0x71')](_0x1a663e)['pipe'](fs[_0xc72b('0x72')](path[_0xc72b('0x55')](_0x2936b6,_0x581914[_0xc72b('0x60')][_0xc72b('0x6f')])));}}return{'date':moment(_0x581914[_0xc72b('0x61')])['format'](_0xc72b('0x4a'))[_0xc72b('0x54')](),'sender':_0x581914['direction']===_0xc72b('0x73')?_0x581914['User']?_0x581914['User']['fullname']:'System':_0x581914[_0xc72b('0x5e')][_0xc72b('0x74')]+(_0x581914[_0xc72b('0x5e')][_0xc72b('0x5f')]?'\x20'+_0x581914[_0xc72b('0x5e')][_0xc72b('0x5f')]:''),'body':_0x581914[_0xc72b('0x60')]?_0x581914[_0xc72b('0x60')][_0xc72b('0x6f')]:_0x581914[_0xc72b('0x36')],'direction':_0x581914['direction']==='out'?'A':'C','secret':_0x581914['secret'],'read':_0x581914['read'],'attachment':_0x581914[_0xc72b('0x60')]};})[_0xc72b('0x75')]()};return ejs[_0xc72b('0x76')](path[_0xc72b('0x55')](config['root'],_0xc72b('0x57'),'views',_0xc72b('0x77')),{'interaction':_0x220885})[_0xc72b('0x19')](function(_0xb631fd){var _0x31ec37=path[_0xc72b('0x55')](_0x2936b6,_0xc72b('0x78')+_0x572056['id']+'-'+_0x5b4fe1+_0xc72b('0x79'));var _0x3cb54a={'path':_0x31ec37,'channel':'Whatsapp','interactionId':_0x572056['id']};return pdf['createPdfFromHTML'](_0xb631fd,_0x3cb54a);})[_0xc72b('0x19')](function(){return new BPromise(function(_0x1289c1,_0x561cf5){zipdir(_0x2936b6,{'saveTo':_0x4983ba},function(_0x2e55e3,_0x226028){if(_0x2e55e3)return _0x561cf5(_0x2e55e3);return _0x1289c1(_0x226028);});})['then'](function(){return new BPromise(function(_0x51a198,_0x3b0d77){rimraf(_0x2936b6,function(_0x90d58e){if(_0x90d58e)_0x3b0d77(_0x90d58e);return _0x51a198();});});})[_0xc72b('0x19')](function(){return _0x3daf64['download'](_0x4983ba,_0x157f8a,function(_0x313c9d){if(_0x313c9d){console[_0xc72b('0x7a')](_0xc72b('0x7b'),_0x313c9d);}else{fs[_0xc72b('0x7c')](_0x4983ba);}});});});}else{return _0x3daf64['sendStatus'](0xc8);}})[_0xc72b('0x28')](handleError(_0x3daf64,null));}; \ No newline at end of file +var _0x1c57=['getOptions','query','catch','show','params','model','keys','filters','intersection','attributes','length','includeAll','include','merge','options','WhatsappInteraction','find','create','body','describe','addMessage','WhatsappMessage','ids','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','rows','addTags','omit','spread','Tag','findAll','whatsappInteractionTags:save','removeTags','download','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','existsSync','createReadStream','out','System','value','renderFile','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','offset','count','limit','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x1c57,0x144));var _0x71c5=function(_0x5043eb,_0x22914b){_0x5043eb=_0x5043eb-0x0;var _0x51f9b0=_0x1c57[_0x5043eb];return _0x51f9b0;};'use strict';var rimraf=require(_0x71c5('0x0'));var zipdir=require(_0x71c5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x71c5('0x2'));var path=require(_0x71c5('0x3'));var ejs=require(_0x71c5('0x4'));var fs=require('fs');var _=require(_0x71c5('0x5'));var Redis=require('ioredis');var interaction=require(_0x71c5('0x6'));var qs=require(_0x71c5('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x71c5('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x71c5('0x9')]=_[_0x71c5('0xa')](config[_0x71c5('0x9')],{'host':_0x71c5('0xb'),'port':0x18eb});var socket=require(_0x71c5('0xc'))(new Redis(config[_0x71c5('0x9')]));require('./whatsappInteraction.socket')[_0x71c5('0xd')](socket);function respondWithStatusCode(_0x3d25fb,_0x2f7218){_0x2f7218=_0x2f7218||0xcc;return function(_0x37b6fc){if(_0x37b6fc){return _0x3d25fb[_0x71c5('0xe')](_0x2f7218);}return _0x3d25fb['status'](_0x2f7218)[_0x71c5('0xf')]();};}function respondWithResult(_0xb35dd4,_0x2a439a){_0x2a439a=_0x2a439a||0xc8;return function(_0x4e8da7){if(_0x4e8da7){return _0xb35dd4[_0x71c5('0x10')](_0x2a439a)[_0x71c5('0x11')](_0x4e8da7);}};}function respondWithFilteredResult(_0x34b704,_0x1779eb){return function(_0x1b3666){if(_0x1b3666){var _0x210e7c=typeof _0x1779eb['offset']===_0x71c5('0x12')&&typeof _0x1779eb['limit']==='undefined';var _0x340a73=_0x1b3666['count'];var _0x1b4efd=_0x210e7c?0x0:_0x1779eb[_0x71c5('0x13')];var _0x3120d3=_0x210e7c?_0x1b3666[_0x71c5('0x14')]:_0x1779eb[_0x71c5('0x13')]+_0x1779eb[_0x71c5('0x15')];var _0x4e32ab;if(_0x3120d3>=_0x340a73){_0x3120d3=_0x340a73;_0x4e32ab=0xc8;}else{_0x4e32ab=0xce;}_0x34b704[_0x71c5('0x10')](_0x4e32ab);return _0x34b704['set']('Content-Range',_0x1b4efd+'-'+_0x3120d3+'/'+_0x340a73)[_0x71c5('0x11')](_0x1b3666);}return null;};}function saveUpdates(_0x78a874){return function(_0x126a78){if(_0x126a78){return _0x126a78[_0x71c5('0x16')](_0x78a874)[_0x71c5('0x17')](function(_0x27e4cb){return _0x27e4cb;});}return null;};}function removeEntity(_0x227f7f){return function(_0x26de19){if(_0x26de19){return _0x26de19[_0x71c5('0x18')]()[_0x71c5('0x17')](function(){_0x227f7f['status'](0xcc)[_0x71c5('0xf')]();});}};}function handleEntityNotFound(_0x693e43){return function(_0x110194){if(!_0x110194){_0x693e43['sendStatus'](0x194);}return _0x110194;};}function handleError(_0x3b2267,_0x508d10){_0x508d10=_0x508d10||0x1f4;return function(_0x43a165){logger[_0x71c5('0x19')](_0x43a165[_0x71c5('0x1a')]);if(_0x43a165[_0x71c5('0x1b')]){delete _0x43a165['name'];}_0x3b2267[_0x71c5('0x10')](_0x508d10)[_0x71c5('0x1c')](_0x43a165);};}exports['index']=function(_0x434633,_0x33f6f6){var _0x59033d={};var _0x2872f0=_[_0x71c5('0x1d')](db['WhatsappInteraction'][_0x71c5('0x1e')],function(_0x507ac1){return{'name':_0x507ac1[_0x71c5('0x1f')],'type':_0x507ac1['type'][_0x71c5('0x20')]};});_0x59033d=qs[_0x71c5('0x21')](_0x2872f0,_0x434633);return interaction['findAll']('whatsapp',_0x434633[_0x71c5('0x22')],_0x434633['user'],_0x59033d,_0x2872f0)[_0x71c5('0x17')](respondWithFilteredResult(_0x33f6f6,_0x59033d))[_0x71c5('0x23')](handleError(_0x33f6f6,null));};exports[_0x71c5('0x24')]=function(_0x2d73f9,_0x18f6cd){var _0x4965d9={'raw':![],'where':{'id':_0x2d73f9[_0x71c5('0x25')]['id']}},_0x57861a={};_0x57861a[_0x71c5('0x26')]=_[_0x71c5('0x27')](db['WhatsappInteraction']['rawAttributes']);_0x57861a[_0x71c5('0x22')]=_[_0x71c5('0x27')](_0x2d73f9['query']);_0x57861a[_0x71c5('0x28')]=_[_0x71c5('0x29')](_0x57861a['model'],_0x57861a[_0x71c5('0x22')]);_0x4965d9[_0x71c5('0x2a')]=_[_0x71c5('0x29')](_0x57861a['model'],qs['fields'](_0x2d73f9[_0x71c5('0x22')]['fields']));_0x4965d9[_0x71c5('0x2a')]=_0x4965d9[_0x71c5('0x2a')][_0x71c5('0x2b')]?_0x4965d9['attributes']:_0x57861a[_0x71c5('0x26')];if(_0x2d73f9[_0x71c5('0x22')][_0x71c5('0x2c')]){_0x4965d9[_0x71c5('0x2d')]=[{'all':!![]}];}_0x4965d9=_[_0x71c5('0x2e')]({},_0x4965d9,_0x2d73f9[_0x71c5('0x2f')]);return db[_0x71c5('0x30')][_0x71c5('0x31')](_0x4965d9)[_0x71c5('0x17')](handleEntityNotFound(_0x18f6cd,null))[_0x71c5('0x17')](respondWithResult(_0x18f6cd,null))[_0x71c5('0x23')](handleError(_0x18f6cd,null));};exports['create']=function(_0x2a7684,_0x5b9e12){return db[_0x71c5('0x30')][_0x71c5('0x32')](_0x2a7684['body'],{})['then'](respondWithResult(_0x5b9e12,0xc9))['catch'](handleError(_0x5b9e12,null));};exports[_0x71c5('0x16')]=function(_0x34e55b,_0x37f5fc){if(_0x34e55b[_0x71c5('0x33')]['id']){delete _0x34e55b[_0x71c5('0x33')]['id'];}return db[_0x71c5('0x30')][_0x71c5('0x31')]({'where':{'id':_0x34e55b[_0x71c5('0x25')]['id']}})[_0x71c5('0x17')](handleEntityNotFound(_0x37f5fc,null))[_0x71c5('0x17')](saveUpdates(_0x34e55b[_0x71c5('0x33')],null))[_0x71c5('0x17')](respondWithResult(_0x37f5fc,null))[_0x71c5('0x23')](handleError(_0x37f5fc,null));};exports[_0x71c5('0x18')]=function(_0x2c8e5a,_0x11ba91){return db[_0x71c5('0x30')][_0x71c5('0x31')]({'where':{'id':_0x2c8e5a['params']['id']}})['then'](handleEntityNotFound(_0x11ba91,null))['then'](removeEntity(_0x11ba91,null))[_0x71c5('0x23')](handleError(_0x11ba91,null));};exports[_0x71c5('0x34')]=function(_0x3dcd8c,_0x3f2c55){return db[_0x71c5('0x30')]['describe']()[_0x71c5('0x17')](respondWithResult(_0x3f2c55,null))[_0x71c5('0x23')](handleError(_0x3f2c55,null));};exports[_0x71c5('0x35')]=function(_0x2b55ec,_0x4cfb75){return db[_0x71c5('0x36')][_0x71c5('0x31')]({'where':{'id':_0x2b55ec[_0x71c5('0x25')]['id']}})['then'](handleEntityNotFound(_0x4cfb75,null))[_0x71c5('0x17')](function(_0x28b208){if(_0x28b208){return _0x28b208[_0x71c5('0x35')](_0x2b55ec['body'][_0x71c5('0x37')],_['omit'](_0x2b55ec[_0x71c5('0x33')],[_0x71c5('0x37'),'id'])||{});}})['then'](respondWithResult(_0x4cfb75,null))[_0x71c5('0x23')](handleError(_0x4cfb75,null));};exports[_0x71c5('0x38')]=function(_0x474ef9,_0x2dd00e){var _0xa859={'raw':![],'where':{}};var _0x54e365={};var _0x349bfd={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x474ef9[_0x71c5('0x25')]['id']}})[_0x71c5('0x17')](handleEntityNotFound(_0x2dd00e,null))[_0x71c5('0x17')](function(_0x43aef0){if(_0x43aef0){_0x54e365[_0x71c5('0x26')]=_[_0x71c5('0x27')](db[_0x71c5('0x36')]['rawAttributes']);_0x54e365['query']=_[_0x71c5('0x27')](_0x474ef9[_0x71c5('0x22')]);_0x54e365[_0x71c5('0x28')]=_['intersection'](_0x54e365[_0x71c5('0x26')],_0x54e365[_0x71c5('0x22')]);_0xa859[_0x71c5('0x2a')]=_['intersection'](_0x54e365['model'],qs['fields'](_0x474ef9['query'][_0x71c5('0x39')]));_0xa859[_0x71c5('0x2a')]=_0xa859[_0x71c5('0x2a')][_0x71c5('0x2b')]?_0xa859[_0x71c5('0x2a')]:_0x54e365['model'];if(!_0x474ef9[_0x71c5('0x22')][_0x71c5('0x3a')](_0x71c5('0x3b'))){_0xa859[_0x71c5('0x15')]=qs['limit'](_0x474ef9[_0x71c5('0x22')][_0x71c5('0x15')]);_0xa859[_0x71c5('0x13')]=qs[_0x71c5('0x13')](_0x474ef9[_0x71c5('0x22')]['offset']);}_0xa859[_0x71c5('0x3c')]=qs[_0x71c5('0x3d')](_0x474ef9['query'][_0x71c5('0x3d')]);_0xa859[_0x71c5('0x3e')]=qs[_0x71c5('0x28')](_[_0x71c5('0x3f')](_0x474ef9[_0x71c5('0x22')],_0x54e365['filters']));_0xa859['where']['WhatsappInteractionId']=_0x43aef0['id'];if(_0x474ef9[_0x71c5('0x22')]['filter']){_0xa859['where']=_['merge'](_0xa859['where'],{'$or':_[_0x71c5('0x1d')](_0xa859['attributes'],function(_0x444d26){var _0x11120c={};_0x11120c[_0x444d26]={'$like':'%'+_0x474ef9[_0x71c5('0x22')][_0x71c5('0x40')]+'%'};return _0x11120c;})});}if(_0x474ef9['query'][_0x71c5('0x41')]){var _0x143f09=_0x474ef9[_0x71c5('0x22')][_0x71c5('0x41')][_0x71c5('0x42')](',');var _0xeb9a37={};_0xeb9a37[_0x143f09[0x0]]={'$gte':moment(_0x143f09[0x1])[_0x71c5('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0xa859['where']=_[_0x71c5('0x2e')](_0xa859[_0x71c5('0x3e')],_0xeb9a37);}_0xa859=_[_0x71c5('0x2e')]({},_0xa859,_0x474ef9['options']);return db['WhatsappMessage'][_0x71c5('0x14')]({'where':_0xa859['where']})['then'](function(_0x2f0c24){_0x349bfd['count']=_0x2f0c24;if(_0x474ef9[_0x71c5('0x22')][_0x71c5('0x2c')]){_0xa859['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0xa859);})['then'](function(_0xc99eba){_0x349bfd[_0x71c5('0x44')]=_0xc99eba;return _0x349bfd;});}})[_0x71c5('0x17')](respondWithFilteredResult(_0x2dd00e,_0xa859))[_0x71c5('0x23')](handleError(_0x2dd00e,null));};exports[_0x71c5('0x45')]=function(_0x5a5f92,_0x5bdfe9){return db[_0x71c5('0x30')][_0x71c5('0x31')]({'where':{'id':_0x5a5f92[_0x71c5('0x25')]['id']}})[_0x71c5('0x17')](handleEntityNotFound(_0x5bdfe9,null))[_0x71c5('0x17')](function(_0x5b91c4){if(_0x5b91c4){return _0x5b91c4['setTags'](_0x5a5f92[_0x71c5('0x33')][_0x71c5('0x37')],_[_0x71c5('0x46')](_0x5a5f92[_0x71c5('0x33')],[_0x71c5('0x37'),'id'])||{})[_0x71c5('0x47')](function(){return db[_0x71c5('0x48')][_0x71c5('0x49')]({'attributes':['id',_0x71c5('0x1b'),'color'],'where':{'id':_0x5a5f92[_0x71c5('0x33')][_0x71c5('0x37')]}});})[_0x71c5('0x17')](function(_0x5ecf0a){socket['emit'](_0x71c5('0x4a'),{'id':Number(_0x5a5f92['params']['id']),'tags':_0x5ecf0a||[]});return{'id':Number(_0x5a5f92[_0x71c5('0x25')]['id']),'tags':_0x5ecf0a||[]};});}})[_0x71c5('0x17')](respondWithResult(_0x5bdfe9,null))[_0x71c5('0x23')](handleError(_0x5bdfe9,null));};exports[_0x71c5('0x4b')]=function(_0x29d18d,_0x1af4f3){return db[_0x71c5('0x30')][_0x71c5('0x31')]({'where':{'id':_0x29d18d[_0x71c5('0x25')]['id']}})[_0x71c5('0x17')](handleEntityNotFound(_0x1af4f3,null))[_0x71c5('0x17')](function(_0x348069){if(_0x348069){return _0x348069[_0x71c5('0x4b')](_0x29d18d['query']['ids']);}})['then'](respondWithStatusCode(_0x1af4f3,null))[_0x71c5('0x23')](handleError(_0x1af4f3,null));};exports[_0x71c5('0x4c')]=function(_0x5ac190,_0x588306){var _0xc64593=moment()['unix']()['toString']();var _0x2c3470=path[_0x71c5('0x4d')](config['root'],_0x71c5('0x4e'),'files',_0x71c5('0x4f'));var _0x196541=path[_0x71c5('0x4d')](config[_0x71c5('0x50')],_0x71c5('0x4e'),_0x71c5('0x51'),_0x71c5('0x52'));var _0x3ce2ca=path[_0x71c5('0x4d')](_0x2c3470,_0xc64593);var _0x567547=util['format'](_0x71c5('0x53'),_0x5ac190[_0x71c5('0x25')]['id'],_0xc64593);var _0x206c04=path[_0x71c5('0x4d')](_0x2c3470,_0x567547);var _0x5a962b=[];_0x5a962b[_0x71c5('0x54')]({'model':db[_0x71c5('0x55')],'as':_0x71c5('0x55'),'attributes':['id',_0x71c5('0x56')],'raw':!![]});_0x5a962b[_0x71c5('0x54')]({'model':db[_0x71c5('0x57')],'as':_0x71c5('0x58'),'attributes':['id',_0x71c5('0x59'),_0x71c5('0x5a')],'raw':!![]});if(_0x5ac190[_0x71c5('0x22')][_0x71c5('0x52')]){_0x5a962b['push']({'model':db[_0x71c5('0x5b')],'as':_0x71c5('0x5b'),'raw':!![]});}var _0x29e32f=[{'model':db[_0x71c5('0x36')],'as':_0x71c5('0x5c'),'attributes':['id',_0x71c5('0x33'),_0x71c5('0x5d'),_0x71c5('0x5e'),_0x71c5('0x5f'),_0x71c5('0x60')],'include':_0x5a962b}];_0x29e32f[_0x71c5('0x54')]({'model':db[_0x71c5('0x61')],'as':_0x71c5('0x62'),'attributes':['id',_0x71c5('0x1b')]});_0x29e32f['push']({'model':db[_0x71c5('0x55')],'as':_0x71c5('0x63'),'attributes':['id',_0x71c5('0x56')]});return db[_0x71c5('0x30')]['find']({'where':{'id':_0x5ac190['params']['id']},'include':_0x29e32f})[_0x71c5('0x17')](handleEntityNotFound(_0x588306,null))['then'](function(_0x31f15d){if(_0x31f15d){var _0x540dec=_0x31f15d[_0x71c5('0x64')]({'plain':!![]});fs['mkdirSync'](_0x3ce2ca);var _0x551eba={'channel':'Whatsapp','account':_0x540dec['Account'][_0x71c5('0x1b')],'agent':_0x540dec[_0x71c5('0x63')]?_0x540dec[_0x71c5('0x63')][_0x71c5('0x56')]:_0x71c5('0x65'),'createdAt':moment(_0x540dec[_0x71c5('0x5d')])[_0x71c5('0x43')](_0x71c5('0x66'))[_0x71c5('0x67')](),'closedAt':_0x540dec[_0x71c5('0x68')]?moment(_0x540dec[_0x71c5('0x69')])[_0x71c5('0x43')](_0x71c5('0x66'))[_0x71c5('0x67')]():'','disposition':_0x540dec[_0x71c5('0x6a')],'messages':_(_0x540dec[_0x71c5('0x5c')])[_0x71c5('0x40')]({'secret':![]})[_0x71c5('0x1d')](function(_0x27e599){if(_0x27e599[_0x71c5('0x5b')]){var _0x115c1d=path[_0x71c5('0x4d')](_0x196541,_0x27e599[_0x71c5('0x5b')]['basename']);if(fs[_0x71c5('0x6b')](_0x115c1d)){fs[_0x71c5('0x6c')](_0x115c1d)['pipe'](fs['createWriteStream'](path[_0x71c5('0x4d')](_0x3ce2ca,_0x27e599[_0x71c5('0x5b')]['basename'])));}}return{'date':moment(_0x27e599['createdAt'])['format'](_0x71c5('0x66'))[_0x71c5('0x67')](),'sender':_0x27e599[_0x71c5('0x5e')]===_0x71c5('0x6d')?_0x27e599['User']?_0x27e599[_0x71c5('0x55')][_0x71c5('0x56')]:_0x71c5('0x6e'):_0x27e599[_0x71c5('0x58')]['firstName']+(_0x27e599['Contact'][_0x71c5('0x5a')]?'\x20'+_0x27e599['Contact'][_0x71c5('0x5a')]:''),'body':_0x27e599['Attachment']?_0x27e599['Attachment']['basename']:_0x27e599[_0x71c5('0x33')],'direction':_0x27e599[_0x71c5('0x5e')]==='out'?'A':'C','secret':_0x27e599[_0x71c5('0x5f')],'read':_0x27e599[_0x71c5('0x60')],'attachment':_0x27e599[_0x71c5('0x5b')]};})[_0x71c5('0x6f')]()};return ejs[_0x71c5('0x70')](path[_0x71c5('0x4d')](config[_0x71c5('0x50')],_0x71c5('0x4e'),'views',_0x71c5('0x71')),{'interaction':_0x551eba})[_0x71c5('0x17')](function(_0x2391c0){var _0x560dd0=path['join'](_0x3ce2ca,_0x71c5('0x72')+_0x540dec['id']+'-'+_0xc64593+'.pdf');var _0x78fb82={'path':_0x560dd0,'channel':_0x71c5('0x73'),'interactionId':_0x540dec['id']};return pdf[_0x71c5('0x74')](_0x2391c0,_0x78fb82);})[_0x71c5('0x17')](function(){return new BPromise(function(_0x193b4f,_0x4ded34){zipdir(_0x3ce2ca,{'saveTo':_0x206c04},function(_0x41802f,_0x41ceb3){if(_0x41802f)return _0x4ded34(_0x41802f);return _0x193b4f(_0x41ceb3);});})[_0x71c5('0x17')](function(){return new BPromise(function(_0xd4c17,_0x158023){rimraf(_0x3ce2ca,function(_0x1b9bf9){if(_0x1b9bf9)_0x158023(_0x1b9bf9);return _0xd4c17();});});})['then'](function(){return _0x588306[_0x71c5('0x4c')](_0x206c04,_0x567547,function(_0x4be2f1){if(_0x4be2f1){console['log'](_0x71c5('0x75'),_0x4be2f1);}else{fs[_0x71c5('0x76')](_0x206c04);}});});});}else{return _0x588306[_0x71c5('0xe')](0xc8);}})['catch'](handleError(_0x588306,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6f5bd58..105492d 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 _0xa788=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x23fd44,_0x3b193b){var _0x41d4d5=function(_0x31f5db){while(--_0x31f5db){_0x23fd44['push'](_0x23fd44['shift']());}};_0x41d4d5(++_0x3b193b);}(_0xa788,0x70));var _0x8a78=function(_0x16cde9,_0x4485ce){_0x16cde9=_0x16cde9-0x0;var _0x15c055=_0xa788[_0x16cde9];return _0x15c055;};'use strict';var EventEmitter=require(_0x8a78('0x0'));var WhatsappInteraction=require(_0x8a78('0x1'))['db'][_0x8a78('0x2')];var WhatsappMessage=require(_0x8a78('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8a78('0x3')](0x0);var events={'afterCreate':_0x8a78('0x4'),'afterUpdate':'update','afterDestroy':_0x8a78('0x5')};function emitEvent(_0x12ce72){return function(_0x5af5af,_0x47be20,_0x506edf){_0x5af5af[_0x8a78('0x6')]({'attributes':['id'],'raw':!![]})[_0x8a78('0x7')](function(_0x539774){_0x5af5af['setDataValue'](_0x8a78('0x8'),_0x539774['map'](function(_0x5e655c){return{'id':_0x5e655c['id']};}));return WhatsappMessage[_0x8a78('0x9')]({'where':{'WhatsappInteractionId':_0x5af5af['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a78('0x7')](function(_0x4e2918){_0x5af5af[_0x8a78('0xa')](_0x8a78('0xb'),_0x4e2918[_0x8a78('0xc')]);WhatsappInteractionEvents[_0x8a78('0xd')](_0x12ce72+':'+_0x5af5af['id'],_0x5af5af);WhatsappInteractionEvents[_0x8a78('0xd')](_0x12ce72,_0x5af5af);_0x506edf(null);})[_0x8a78('0xe')](_0x506edf(null));};}for(var e in events){if(events[_0x8a78('0xf')](e)){var event=events[e];WhatsappInteraction[_0x8a78('0x10')](e,emitEvent(event));}}module[_0x8a78('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1120=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','update'];(function(_0x294f8e,_0x53d51d){var _0x2f3eca=function(_0x18ee67){while(--_0x18ee67){_0x294f8e['push'](_0x294f8e['shift']());}};_0x2f3eca(++_0x53d51d);}(_0x1120,0x140));var _0x0112=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x1120[_0x934425];return _0x31d596;};'use strict';var EventEmitter=require(_0x0112('0x0'));var WhatsappInteraction=require(_0x0112('0x1'))['db'][_0x0112('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0112('0x3'),'afterDestroy':_0x0112('0x4')};function emitEvent(_0x1d9e34){return function(_0xa78633,_0x419307,_0x10fdca){_0xa78633[_0x0112('0x5')]({'attributes':['id'],'raw':!![]})[_0x0112('0x6')](function(_0x31d67a){_0xa78633[_0x0112('0x7')](_0x0112('0x8'),_0x31d67a[_0x0112('0x9')](function(_0x4bf145){return{'id':_0x4bf145['id']};}));return WhatsappMessage[_0x0112('0xa')]({'where':{'WhatsappInteractionId':_0xa78633['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0112('0x6')](function(_0x2f9a7d){_0xa78633[_0x0112('0x7')](_0x0112('0xb'),_0x2f9a7d[_0x0112('0xc')]);WhatsappInteractionEvents[_0x0112('0xd')](_0x1d9e34+':'+_0xa78633['id'],_0xa78633);WhatsappInteractionEvents['emit'](_0x1d9e34,_0xa78633);_0x10fdca(null);})[_0x0112('0xe')](_0x10fdca(null));};}for(var e in events){if(events[_0x0112('0xf')](e)){var event=events[e];WhatsappInteraction[_0x0112('0x10')](e,emitEvent(event));}}module[_0x0112('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ba853cf..692a8c5 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 _0x5527=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','format'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5527,0x111));var _0x7552=function(_0x8d34d4,_0xc6e1cf){_0x8d34d4=_0x8d34d4-0x0;var _0x5ada4a=_0x5527[_0x8d34d4];return _0x5ada4a;};'use strict';var _=require(_0x7552('0x0'));var util=require(_0x7552('0x1'));var logger=require(_0x7552('0x2'))(_0x7552('0x3'));var moment=require(_0x7552('0x4'));var BPromise=require(_0x7552('0x5'));var rp=require(_0x7552('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7552('0x7'));var config=require(_0x7552('0x8'));var attributes=require(_0x7552('0x9'));module[_0x7552('0xa')]=function(_0x1b88ac,_0x5a2349){return _0x1b88ac[_0x7552('0xb')]('WhatsappInteraction',attributes,{'tableName':_0x7552('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42f59f,_0x512ae9,_0x589506){if(_0x42f59f[_0x7552('0xd')](_0x7552('0xe'))){_0x42f59f['closedAt']=moment()[_0x7552('0xf')](_0x7552('0x10'));}_0x589506(null,_0x42f59f);}}});}; \ No newline at end of file +var _0x659c=['exports','define','WhatsappInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise','path','./whatsappInteraction.attributes'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x659c,0x1aa));var _0xc659=function(_0x134de4,_0x49c839){_0x134de4=_0x134de4-0x0;var _0xe97f36=_0x659c[_0x134de4];return _0xe97f36;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc659('0x1'));var moment=require(_0xc659('0x2'));var BPromise=require('bluebird');var rp=require(_0xc659('0x3'));var fs=require('fs');var path=require(_0xc659('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc659('0x5'));module[_0xc659('0x6')]=function(_0x369dc0,_0x312440){return _0x369dc0[_0xc659('0x7')](_0xc659('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51b67f,_0x2cc93d,_0x56885a){if(_0x51b67f['changed']('closed')){_0x51b67f[_0xc659('0x9')]=moment()[_0xc659('0xa')](_0xc659('0xb'));}_0x56885a(null,_0x51b67f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d971a58..1267d62 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 _0xde96=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','body','ids','omit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde96,0x7f));var _0x6de9=function(_0x11c8a7,_0x3d09f2){_0x11c8a7=_0x11c8a7-0x0;var _0x47573d=_0xde96[_0x11c8a7];return _0x47573d;};'use strict';var _=require(_0x6de9('0x0'));var util=require(_0x6de9('0x1'));var moment=require(_0x6de9('0x2'));var BPromise=require(_0x6de9('0x3'));var rs=require(_0x6de9('0x4'));var fs=require('fs');var Redis=require(_0x6de9('0x5'));var db=require(_0x6de9('0x6'))['db'];var utils=require(_0x6de9('0x7'));var logger=require(_0x6de9('0x8'))(_0x6de9('0x9'));var config=require('../../config/environment');var jayson=require(_0x6de9('0xa'));var client=jayson[_0x6de9('0xb')]['http']({'port':0x232a});config['redis']=_[_0x6de9('0xc')](config[_0x6de9('0xd')],{'host':_0x6de9('0xe'),'port':0x18eb});var socket=require(_0x6de9('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3d6bbc,_0xd7aaee,_0x53434b){return new BPromise(function(_0x3fc19e,_0x2f0874){return client[_0x6de9('0x10')](_0x3d6bbc,_0x53434b)[_0x6de9('0x11')](function(_0x19af70){logger[_0x6de9('0x12')](_0x6de9('0x13'),_0xd7aaee,_0x6de9('0x14'));logger['debug'](_0x6de9('0x15'),_0xd7aaee,_0x6de9('0x14'),JSON['stringify'](_0x19af70));if(_0x19af70[_0x6de9('0x16')]){if(_0x19af70['error'][_0x6de9('0x17')]===0x1f4){logger[_0x6de9('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xd7aaee,_0x19af70[_0x6de9('0x16')][_0x6de9('0x18')]);return _0x2f0874(_0x19af70[_0x6de9('0x16')][_0x6de9('0x18')]);}logger[_0x6de9('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xd7aaee,_0x19af70['error'][_0x6de9('0x18')]);return _0x3fc19e(_0x19af70['error'][_0x6de9('0x18')]);}else{logger[_0x6de9('0x12')](_0x6de9('0x13'),_0xd7aaee,_0x6de9('0x14'));_0x3fc19e(_0x19af70[_0x6de9('0x19')][_0x6de9('0x18')]);}})[_0x6de9('0x1a')](function(_0xe5383d){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xd7aaee,_0xe5383d);_0x2f0874(_0xe5383d);});});}exports[_0x6de9('0x1b')]=function(_0x3ca6e9){var _0x4388d5=this;return new Promise(function(_0x584af6,_0x49987c){return db[_0x6de9('0x1c')][_0x6de9('0x1d')](_0x3ca6e9['body'],{'raw':_0x3ca6e9[_0x6de9('0x1e')]?_0x3ca6e9['options'][_0x6de9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ca6e9[_0x6de9('0x1e')]?_0x3ca6e9['options'][_0x6de9('0x20')]||null:null,'attributes':_0x3ca6e9[_0x6de9('0x1e')]?_0x3ca6e9[_0x6de9('0x1e')][_0x6de9('0x21')]||null:null,'limit':_0x3ca6e9[_0x6de9('0x1e')]?_0x3ca6e9[_0x6de9('0x1e')][_0x6de9('0x22')]||null:null})[_0x6de9('0x11')](function(_0x432b02){logger[_0x6de9('0x12')](_0x6de9('0x1b'),_0x3ca6e9);logger['debug'](_0x6de9('0x1b'),_0x3ca6e9,JSON[_0x6de9('0x23')](_0x432b02));_0x584af6(_0x432b02);})['catch'](function(_0x2900fa){logger[_0x6de9('0x16')]('UpdateWhatsappInteraction',_0x2900fa[_0x6de9('0x18')],_0x3ca6e9);_0x49987c(_0x4388d5[_0x6de9('0x16')](0x1f4,_0x2900fa[_0x6de9('0x18')]));});});};exports[_0x6de9('0x24')]=function(_0x41bdb6){return new Promise(function(_0x23e9a5,_0x4e66ee){return db['WhatsappInteraction'][_0x6de9('0x25')]({'where':_0x41bdb6[_0x6de9('0x1e')]?_0x41bdb6[_0x6de9('0x1e')][_0x6de9('0x20')]||null:null})[_0x6de9('0x11')](function(_0x1628a7){if(_0x1628a7){return _0x1628a7['addTags'](_0x41bdb6[_0x6de9('0x26')][_0x6de9('0x27')],_[_0x6de9('0x28')](_0x41bdb6[_0x6de9('0x26')],[_0x6de9('0x27'),'id'])||{});}})['spread'](function(_0x3d1004){logger[_0x6de9('0x12')](_0x6de9('0x29'),_0x41bdb6);logger['debug']('AddTags',_0x41bdb6,JSON[_0x6de9('0x23')](_0x3d1004));_0x23e9a5(_0x3d1004);})[_0x6de9('0x1a')](function(_0x18acb6){logger[_0x6de9('0x16')]('AddTags',_0x18acb6[_0x6de9('0x18')],_0x41bdb6);_0x4e66ee(_this[_0x6de9('0x16')](0x1f4,_0x18acb6[_0x6de9('0x18')]));});});}; \ No newline at end of file +var _0xbd1f=['stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','where','UpdateWhatsappInteraction','find','addTags','ids','omit','AddTags','debug','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x402d22,_0x428cfd){var _0x12a902=function(_0x370afb){while(--_0x370afb){_0x402d22['push'](_0x402d22['shift']());}};_0x12a902(++_0x428cfd);}(_0xbd1f,0x14a));var _0xfbd1=function(_0x4fa3d2,_0x1bb8db){_0x4fa3d2=_0x4fa3d2-0x0;var _0x1ea3fd=_0xbd1f[_0x4fa3d2];return _0x1ea3fd;};'use strict';var _=require(_0xfbd1('0x0'));var util=require('util');var moment=require(_0xfbd1('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbd1('0x2'));var fs=require('fs');var Redis=require(_0xfbd1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbd1('0x4'));var logger=require(_0xfbd1('0x5'))(_0xfbd1('0x6'));var config=require(_0xfbd1('0x7'));var jayson=require(_0xfbd1('0x8'));var client=jayson[_0xfbd1('0x9')][_0xfbd1('0xa')]({'port':0x232a});config[_0xfbd1('0xb')]=_[_0xfbd1('0xc')](config[_0xfbd1('0xb')],{'host':_0xfbd1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xfbd1('0xe')](socket);function respondWithRpcPromise(_0x349300,_0x461c47,_0x5923a9){return new BPromise(function(_0x350236,_0x51d207){return client[_0xfbd1('0xf')](_0x349300,_0x5923a9)[_0xfbd1('0x10')](function(_0x27ee1e){logger[_0xfbd1('0x11')](_0xfbd1('0x12'),_0x461c47,_0xfbd1('0x13'));logger['debug'](_0xfbd1('0x14'),_0x461c47,_0xfbd1('0x13'),JSON[_0xfbd1('0x15')](_0x27ee1e));if(_0x27ee1e[_0xfbd1('0x16')]){if(_0x27ee1e['error'][_0xfbd1('0x17')]===0x1f4){logger[_0xfbd1('0x16')](_0xfbd1('0x12'),_0x461c47,_0x27ee1e[_0xfbd1('0x16')][_0xfbd1('0x18')]);return _0x51d207(_0x27ee1e['error'][_0xfbd1('0x18')]);}logger[_0xfbd1('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x461c47,_0x27ee1e[_0xfbd1('0x16')][_0xfbd1('0x18')]);return _0x350236(_0x27ee1e['error'][_0xfbd1('0x18')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x461c47,_0xfbd1('0x13'));_0x350236(_0x27ee1e[_0xfbd1('0x19')][_0xfbd1('0x18')]);}})[_0xfbd1('0x1a')](function(_0x4bf510){logger[_0xfbd1('0x16')](_0xfbd1('0x12'),_0x461c47,_0x4bf510);_0x51d207(_0x4bf510);});});}exports['UpdateWhatsappInteraction']=function(_0x8aef34){var _0xc1fb3f=this;return new Promise(function(_0x42fcdb,_0x4c11fe){return db[_0xfbd1('0x1b')][_0xfbd1('0x1c')](_0x8aef34[_0xfbd1('0x1d')],{'raw':_0x8aef34[_0xfbd1('0x1e')]?_0x8aef34[_0xfbd1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8aef34[_0xfbd1('0x1e')]?_0x8aef34[_0xfbd1('0x1e')][_0xfbd1('0x1f')]||null:null,'attributes':_0x8aef34['options']?_0x8aef34['options']['attributes']||null:null,'limit':_0x8aef34[_0xfbd1('0x1e')]?_0x8aef34[_0xfbd1('0x1e')]['limit']||null:null})[_0xfbd1('0x10')](function(_0x1bb837){logger[_0xfbd1('0x11')](_0xfbd1('0x20'),_0x8aef34);logger['debug'](_0xfbd1('0x20'),_0x8aef34,JSON[_0xfbd1('0x15')](_0x1bb837));_0x42fcdb(_0x1bb837);})['catch'](function(_0x130213){logger[_0xfbd1('0x16')]('UpdateWhatsappInteraction',_0x130213['message'],_0x8aef34);_0x4c11fe(_0xc1fb3f[_0xfbd1('0x16')](0x1f4,_0x130213['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x22ad7e){return new Promise(function(_0x5c3989,_0x306800){return db['WhatsappInteraction'][_0xfbd1('0x21')]({'where':_0x22ad7e[_0xfbd1('0x1e')]?_0x22ad7e[_0xfbd1('0x1e')][_0xfbd1('0x1f')]||null:null})[_0xfbd1('0x10')](function(_0x2c6819){if(_0x2c6819){return _0x2c6819[_0xfbd1('0x22')](_0x22ad7e[_0xfbd1('0x1d')][_0xfbd1('0x23')],_[_0xfbd1('0x24')](_0x22ad7e[_0xfbd1('0x1d')],['ids','id'])||{});}})['spread'](function(_0x14436b){logger['info'](_0xfbd1('0x25'),_0x22ad7e);logger[_0xfbd1('0x26')](_0xfbd1('0x25'),_0x22ad7e,JSON[_0xfbd1('0x15')](_0x14436b));_0x5c3989(_0x14436b);})[_0xfbd1('0x1a')](function(_0x407599){logger[_0xfbd1('0x16')](_0xfbd1('0x25'),_0x407599[_0xfbd1('0x18')],_0x22ad7e);_0x306800(_this['error'](0x1f4,_0x407599[_0xfbd1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7a28f1e..10d6224 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 _0x3bc7=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','update','emit'];(function(_0x1534ae,_0x30979e){var _0x5d43ed=function(_0x2758de){while(--_0x2758de){_0x1534ae['push'](_0x1534ae['shift']());}};_0x5d43ed(++_0x30979e);}(_0x3bc7,0xb3));var _0x73bc=function(_0x22b62,_0x10b762){_0x22b62=_0x22b62-0x0;var _0xfe42e2=_0x3bc7[_0x22b62];return _0xfe42e2;};'use strict';var WhatsappInteractionEvents=require(_0x73bc('0x0'));var events=['save','remove',_0x73bc('0x1')];function createListener(_0x523289,_0x5d0806){return function(_0x497b62){_0x5d0806[_0x73bc('0x2')](_0x523289,_0x497b62);};}function removeListener(_0x2d7f10,_0x5c21d2){return function(){WhatsappInteractionEvents[_0x73bc('0x3')](_0x2d7f10,_0x5c21d2);};}exports[_0x73bc('0x4')]=function(_0x543519){for(var _0x56f85e=0x0,_0xf55875=events[_0x73bc('0x5')];_0x56f85e<_0xf55875;_0x56f85e++){var _0xe2f280=events[_0x56f85e];var _0x2ba167=createListener(_0x73bc('0x6')+_0xe2f280,_0x543519);WhatsappInteractionEvents['on'](_0xe2f280,_0x2ba167);}}; \ No newline at end of file +var _0xb6c0=['./whatsappInteraction.events','save','remove','emit','removeListener','length','whatsappInteraction:'];(function(_0x4df88c,_0x3585cf){var _0x2312b9=function(_0x44d3b7){while(--_0x44d3b7){_0x4df88c['push'](_0x4df88c['shift']());}};_0x2312b9(++_0x3585cf);}(_0xb6c0,0x7e));var _0x0b6c=function(_0x289d11,_0x2925a5){_0x289d11=_0x289d11-0x0;var _0x13de3f=_0xb6c0[_0x289d11];return _0x13de3f;};'use strict';var WhatsappInteractionEvents=require(_0x0b6c('0x0'));var events=[_0x0b6c('0x1'),_0x0b6c('0x2'),'update'];function createListener(_0x4a3a0f,_0x34b42d){return function(_0x2d0bba){_0x34b42d[_0x0b6c('0x3')](_0x4a3a0f,_0x2d0bba);};}function removeListener(_0x10d58e,_0x15ee10){return function(){WhatsappInteractionEvents[_0x0b6c('0x4')](_0x10d58e,_0x15ee10);};}exports['register']=function(_0x180534){for(var _0x39dfdb=0x0,_0x17291c=events[_0x0b6c('0x5')];_0x39dfdb<_0x17291c;_0x39dfdb++){var _0xca12d9=events[_0x39dfdb];var _0x159b1b=createListener(_0x0b6c('0x6')+_0xca12d9,_0x180534);WhatsappInteractionEvents['on'](_0xca12d9,_0x159b1b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index e4e4de4..d6a93ce 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 _0xf157=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put'];(function(_0x5b1d9c,_0x4acf8c){var _0x2c109f=function(_0x52dd0b){while(--_0x52dd0b){_0x5b1d9c['push'](_0x5b1d9c['shift']());}};_0x2c109f(++_0x4acf8c);}(_0xf157,0x1ec));var _0x7f15=function(_0x5ed01b,_0x4e8cd6){_0x5ed01b=_0x5ed01b-0x0;var _0x1e0b70=_0xf157[_0x5ed01b];return _0x1e0b70;};'use strict';var multer=require(_0x7f15('0x0'));var util=require(_0x7f15('0x1'));var path=require(_0x7f15('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f15('0x3'));var router=express[_0x7f15('0x4')]();var fs_extra=require(_0x7f15('0x5'));var auth=require(_0x7f15('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7f15('0x7'));var controller=require('./whatsappMessage.controller');router[_0x7f15('0x8')]('/',auth[_0x7f15('0x9')](),controller[_0x7f15('0xa')]);router['get'](_0x7f15('0xb'),auth[_0x7f15('0x9')](),controller['describe']);router['get'](_0x7f15('0xc'),auth[_0x7f15('0x9')](),controller['show']);router[_0x7f15('0xd')]('/',auth['isAuthenticated'](),interaction[_0x7f15('0xe')](_0x7f15('0xf'),_0x7f15('0x10')),controller[_0x7f15('0x11')]);router[_0x7f15('0xd')](_0x7f15('0x12'),controller[_0x7f15('0x13')]);router[_0x7f15('0x14')]('/:id',auth[_0x7f15('0x9')](),controller['update']);router['put']('/:id/accept',auth[_0x7f15('0x9')](),controller[_0x7f15('0x15')]);router[_0x7f15('0x14')](_0x7f15('0x16'),auth['isAuthenticated'](),controller[_0x7f15('0x17')]);router[_0x7f15('0x18')]('/:id',auth[_0x7f15('0x9')](),controller[_0x7f15('0x19')]);module[_0x7f15('0x1a')]=router; \ No newline at end of file +var _0xec85=['/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','whatsapp','whatsappmessage:create','create','post'];(function(_0x1453d0,_0x63d4f){var _0x8b9e3b=function(_0x247cdf){while(--_0x247cdf){_0x1453d0['push'](_0x1453d0['shift']());}};_0x8b9e3b(++_0x63d4f);}(_0xec85,0x148));var _0x5ec8=function(_0x3023f2,_0x278d8b){_0x3023f2=_0x3023f2-0x0;var _0x8315d2=_0xec85[_0x3023f2];return _0x8315d2;};'use strict';var multer=require(_0x5ec8('0x0'));var util=require(_0x5ec8('0x1'));var path=require(_0x5ec8('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ec8('0x3'));var router=express[_0x5ec8('0x4')]();var fs_extra=require(_0x5ec8('0x5'));var auth=require(_0x5ec8('0x6'));var interaction=require(_0x5ec8('0x7'));var config=require(_0x5ec8('0x8'));var controller=require('./whatsappMessage.controller');router[_0x5ec8('0x9')]('/',auth[_0x5ec8('0xa')](),controller[_0x5ec8('0xb')]);router['get'](_0x5ec8('0xc'),auth[_0x5ec8('0xa')](),controller[_0x5ec8('0xd')]);router[_0x5ec8('0x9')](_0x5ec8('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x5ec8('0xf')](_0x5ec8('0x10'),_0x5ec8('0x11')),controller[_0x5ec8('0x12')]);router[_0x5ec8('0x13')](_0x5ec8('0x14'),controller['status']);router[_0x5ec8('0x15')](_0x5ec8('0xe'),auth[_0x5ec8('0xa')](),controller[_0x5ec8('0x16')]);router['put'](_0x5ec8('0x17'),auth[_0x5ec8('0xa')](),controller[_0x5ec8('0x18')]);router['put'](_0x5ec8('0x19'),auth[_0x5ec8('0xa')](),controller[_0x5ec8('0x1a')]);router[_0x5ec8('0x1b')](_0x5ec8('0xe'),auth[_0x5ec8('0xa')](),controller['destroy']);module[_0x5ec8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2d12449..317787c 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 _0x6f0d=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x6f0d,0x1e5));var _0xd6f0=function(_0xd85e0d,_0x3de3de){_0xd85e0d=_0xd85e0d-0x0;var _0x3cd371=_0x6f0d[_0xd85e0d];return _0x3cd371;};'use strict';var Sequelize=require(_0xd6f0('0x0'));module['exports']={'body':{'type':Sequelize[_0xd6f0('0x1')](_0xd6f0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd6f0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6f0('0x4')]('in',_0xd6f0('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd6f0('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd6f0('0x6')]},'readAt':{'type':Sequelize[_0xd6f0('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file +var _0x8066=['STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x8066,0x83));var _0x6806=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8066[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6806('0x0'));module[_0x6806('0x1')]={'body':{'type':Sequelize['TEXT'](_0x6806('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6806('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6806('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x6806('0x5')](0xbe)},'phone':{'type':Sequelize[_0x6806('0x5')]},'readAt':{'type':Sequelize[_0x6806('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6806('0x5')]},'providerResponse':{'type':Sequelize[_0x6806('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 72f1a7e..70fa90e 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 _0xadd6=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','end','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','params','keys','create','body','find','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','agent','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','null','rejectMessage','sequelize','QueryTypes','contact','internal','interface','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2b2d9c,_0x53ec41){var _0x18cb78=function(_0x309e44){while(--_0x309e44){_0x2b2d9c['push'](_0x2b2d9c['shift']());}};_0x18cb78(++_0x53ec41);}(_0xadd6,0x77));var _0x6add=function(_0x307df8,_0x5c687c){_0x307df8=_0x307df8-0x0;var _0x2c5855=_0xadd6[_0x307df8];return _0x2c5855;};'use strict';var emlformat=require(_0x6add('0x0'));var rimraf=require(_0x6add('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6add('0x2'));var rp=require(_0x6add('0x3'));var moment=require(_0x6add('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6add('0x5'));var util=require('util');var path=require(_0x6add('0x6'));var sox=require(_0x6add('0x7'));var csv=require(_0x6add('0x8'));var ejs=require(_0x6add('0x9'));var fs=require('fs');var fs_extra=require(_0x6add('0xa'));var _=require(_0x6add('0xb'));var squel=require(_0x6add('0xc'));var crypto=require(_0x6add('0xd'));var jsforce=require(_0x6add('0xe'));var deskjs=require(_0x6add('0xf'));var toCsv=require(_0x6add('0x8'));var querystring=require('querystring');var Papa=require(_0x6add('0x10'));var Redis=require(_0x6add('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6add('0x12'));var as=require(_0x6add('0x13'));var hardwareService=require(_0x6add('0x14'));var logger=require(_0x6add('0x15'))('api');var utils=require(_0x6add('0x16'));var config=require(_0x6add('0x17'));var licenseUtil=require(_0x6add('0x18'));var db=require(_0x6add('0x19'))['db'];config[_0x6add('0x1a')]=_[_0x6add('0x1b')](config[_0x6add('0x1a')],{'host':_0x6add('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6add('0x1a')]));require('./whatsappMessage.socket')[_0x6add('0x1d')](socket);var jayson=require(_0x6add('0x1e'));var client=jayson[_0x6add('0x1f')][_0x6add('0x20')]({'port':0x232c});var client9002=jayson[_0x6add('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd32746,_0x476598,_0x10b18e,_0x297e63){return new BPromise(function(_0x460b7b,_0x5b3d66){var _0x7d77f7=_0x297e63||client;return _0x7d77f7[_0x6add('0x21')](_0xd32746,_0x10b18e)[_0x6add('0x22')](function(_0x26674f){logger['info'](_0x6add('0x23'),_0x476598,_0x6add('0x24'));logger[_0x6add('0x25')](_0x6add('0x26'),_0x476598,_0x6add('0x24'),JSON['stringify'](_0x26674f));if(_0x26674f[_0x6add('0x27')]){if(_0x26674f['error'][_0x6add('0x28')]===0x1f4){logger[_0x6add('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x476598,_0x26674f[_0x6add('0x27')][_0x6add('0x29')]);return _0x5b3d66(_0x26674f['error'][_0x6add('0x29')]);}logger[_0x6add('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x476598,_0x26674f[_0x6add('0x27')]['message']);return _0x460b7b(_0x26674f[_0x6add('0x27')][_0x6add('0x29')]);}else{logger[_0x6add('0x2a')](_0x6add('0x23'),_0x476598,'request\x20sent');_0x460b7b(_0x26674f[_0x6add('0x2b')]['message']);}})[_0x6add('0x2c')](function(_0x36a821){logger[_0x6add('0x27')](_0x6add('0x23'),_0x476598,_0x36a821);_0x5b3d66(_0x36a821);});});}function respondWithStatusCode(_0xcffd3d,_0x47fb5d){_0x47fb5d=_0x47fb5d||0xcc;return function(_0x236ca2){if(_0x236ca2){return _0xcffd3d[_0x6add('0x2d')](_0x47fb5d);}return _0xcffd3d[_0x6add('0x2e')](_0x47fb5d)['end']();};}function respondWithResult(_0x448147,_0x425102){_0x425102=_0x425102||0xc8;return function(_0x228252){if(_0x228252){return _0x448147['status'](_0x425102)[_0x6add('0x2f')](_0x228252);}};}function respondWithFilteredResult(_0x1f1aab,_0x3fbd68){return function(_0x204b29){if(_0x204b29){var _0x5bc735=typeof _0x3fbd68['offset']===_0x6add('0x30')&&typeof _0x3fbd68[_0x6add('0x31')]===_0x6add('0x30');var _0x5870dd=_0x204b29[_0x6add('0x32')];var _0x4b1958=_0x5bc735?0x0:_0x3fbd68[_0x6add('0x33')];var _0x4e4d86=_0x5bc735?_0x204b29[_0x6add('0x32')]:_0x3fbd68['offset']+_0x3fbd68['limit'];var _0x34ad04;if(_0x4e4d86>=_0x5870dd){_0x4e4d86=_0x5870dd;_0x34ad04=0xc8;}else{_0x34ad04=0xce;}_0x1f1aab[_0x6add('0x2e')](_0x34ad04);return _0x1f1aab[_0x6add('0x34')](_0x6add('0x35'),_0x4b1958+'-'+_0x4e4d86+'/'+_0x5870dd)[_0x6add('0x2f')](_0x204b29);}return null;};}function patchUpdates(_0x17614c){return function(_0x199dda){try{jsonpatch['apply'](_0x199dda,_0x17614c,!![]);}catch(_0x3f5921){return BPromise[_0x6add('0x36')](_0x3f5921);}return _0x199dda[_0x6add('0x37')]();};}function saveUpdates(_0x4a0686,_0x174adb){return function(_0x16fc67){if(_0x16fc67){return _0x16fc67[_0x6add('0x38')](_0x4a0686)[_0x6add('0x22')](function(_0x3700d2){return _0x3700d2;});}return null;};}function removeEntity(_0x2a36a9,_0x252cbf){return function(_0x417b3a){if(_0x417b3a){return _0x417b3a[_0x6add('0x39')]()['then'](function(){_0x2a36a9[_0x6add('0x2e')](0xcc)[_0x6add('0x3a')]();});}};}function handleEntityNotFound(_0x2b2231,_0x49fb2c){return function(_0x49bd02){if(!_0x49bd02){_0x2b2231[_0x6add('0x2d')](0x194);}return _0x49bd02;};}function handleError(_0x251934,_0x3b0e60){_0x3b0e60=_0x3b0e60||0x1f4;return function(_0x13ec17){logger[_0x6add('0x27')](_0x13ec17[_0x6add('0x3b')]);if(_0x13ec17[_0x6add('0x3c')]){delete _0x13ec17[_0x6add('0x3c')];}_0x251934[_0x6add('0x2e')](_0x3b0e60)['send'](_0x13ec17);};}exports[_0x6add('0x3d')]=function(_0x5b9e4e,_0x12bc23){var _0x29e146={},_0x13c504={},_0x2768aa={'count':0x0,'rows':[]};var _0x40b636=_[_0x6add('0x3e')](db[_0x6add('0x3f')][_0x6add('0x40')],function(_0x24823c){return{'name':_0x24823c[_0x6add('0x41')],'type':_0x24823c['type'][_0x6add('0x42')]};});_0x13c504['model']=_[_0x6add('0x3e')](_0x40b636,_0x6add('0x3c'));_0x13c504[_0x6add('0x43')]=_['keys'](_0x5b9e4e[_0x6add('0x43')]);_0x13c504[_0x6add('0x44')]=_[_0x6add('0x45')](_0x13c504[_0x6add('0x46')],_0x13c504['query']);_0x29e146[_0x6add('0x47')]=_[_0x6add('0x45')](_0x13c504[_0x6add('0x46')],qs[_0x6add('0x48')](_0x5b9e4e[_0x6add('0x43')][_0x6add('0x48')]));_0x29e146[_0x6add('0x47')]=_0x29e146[_0x6add('0x47')][_0x6add('0x49')]?_0x29e146['attributes']:_0x13c504[_0x6add('0x46')];if(!_0x5b9e4e['query'][_0x6add('0x4a')](_0x6add('0x4b'))){_0x29e146[_0x6add('0x31')]=qs['limit'](_0x5b9e4e[_0x6add('0x43')]['limit']);_0x29e146['offset']=qs[_0x6add('0x33')](_0x5b9e4e['query'][_0x6add('0x33')]);}_0x29e146[_0x6add('0x4c')]=qs['sort'](_0x5b9e4e[_0x6add('0x43')]['sort']);_0x29e146[_0x6add('0x4d')]=qs[_0x6add('0x44')](_[_0x6add('0x4e')](_0x5b9e4e[_0x6add('0x43')],_0x13c504['filters']),_0x40b636);if(_0x5b9e4e[_0x6add('0x43')]['filter']){_0x29e146[_0x6add('0x4d')]=_['merge'](_0x29e146[_0x6add('0x4d')],{'$or':_[_0x6add('0x3e')](_0x40b636,function(_0x3d04ce){if(_0x3d04ce[_0x6add('0x4f')]!=='VIRTUAL'){var _0x23daa6={};_0x23daa6[_0x3d04ce['name']]={'$like':'%'+_0x5b9e4e[_0x6add('0x43')][_0x6add('0x50')]+'%'};return _0x23daa6;}})});}_0x29e146=_[_0x6add('0x51')]({},_0x29e146,_0x5b9e4e[_0x6add('0x52')]);var _0x5a2747={'where':_0x29e146[_0x6add('0x4d')]};return db['WhatsappMessage'][_0x6add('0x32')](_0x5a2747)[_0x6add('0x22')](function(_0x1f8abc){_0x2768aa['count']=_0x1f8abc;if(_0x5b9e4e[_0x6add('0x43')][_0x6add('0x53')]){_0x29e146[_0x6add('0x54')]=[{'all':!![]}];}return db[_0x6add('0x3f')][_0x6add('0x55')](_0x29e146);})[_0x6add('0x22')](function(_0x27e005){_0x2768aa[_0x6add('0x56')]=_0x27e005;return _0x2768aa;})[_0x6add('0x22')](respondWithFilteredResult(_0x12bc23,_0x29e146))['catch'](handleError(_0x12bc23,null));};exports['show']=function(_0x2d12c8,_0x5d61bd){var _0x2b5b74={'raw':!![],'where':{'id':_0x2d12c8[_0x6add('0x57')]['id']}},_0x4a5e7b={};_0x4a5e7b['model']=_[_0x6add('0x58')](db[_0x6add('0x3f')][_0x6add('0x40')]);_0x4a5e7b['query']=_[_0x6add('0x58')](_0x2d12c8[_0x6add('0x43')]);_0x4a5e7b[_0x6add('0x44')]=_[_0x6add('0x45')](_0x4a5e7b[_0x6add('0x46')],_0x4a5e7b['query']);_0x2b5b74[_0x6add('0x47')]=_['intersection'](_0x4a5e7b[_0x6add('0x46')],qs[_0x6add('0x48')](_0x2d12c8[_0x6add('0x43')][_0x6add('0x48')]));_0x2b5b74[_0x6add('0x47')]=_0x2b5b74[_0x6add('0x47')][_0x6add('0x49')]?_0x2b5b74['attributes']:_0x4a5e7b[_0x6add('0x46')];if(_0x2d12c8['query'][_0x6add('0x53')]){_0x2b5b74[_0x6add('0x54')]=[{'all':!![]}];}_0x2b5b74=_[_0x6add('0x51')]({},_0x2b5b74,_0x2d12c8['options']);return db[_0x6add('0x3f')]['find'](_0x2b5b74)['then'](handleEntityNotFound(_0x5d61bd,null))[_0x6add('0x22')](respondWithResult(_0x5d61bd,null))[_0x6add('0x2c')](handleError(_0x5d61bd,null));};exports[_0x6add('0x59')]=function(_0x5da60a,_0x41e941){return db[_0x6add('0x3f')][_0x6add('0x59')](_0x5da60a[_0x6add('0x5a')],{})[_0x6add('0x22')](respondWithResult(_0x41e941,0xc9))[_0x6add('0x2c')](handleError(_0x41e941,null));};exports['update']=function(_0x406879,_0x2d3de1){if(_0x406879[_0x6add('0x5a')]['id']){delete _0x406879[_0x6add('0x5a')]['id'];}return db[_0x6add('0x3f')][_0x6add('0x5b')]({'where':{'id':_0x406879[_0x6add('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d3de1,null))['then'](saveUpdates(_0x406879[_0x6add('0x5a')],null))[_0x6add('0x22')](respondWithResult(_0x2d3de1,null))['catch'](handleError(_0x2d3de1,null));};exports[_0x6add('0x39')]=function(_0x111137,_0x4a8988){return db[_0x6add('0x3f')][_0x6add('0x5b')]({'where':{'id':_0x111137['params']['id']}})[_0x6add('0x22')](handleEntityNotFound(_0x4a8988,null))[_0x6add('0x22')](removeEntity(_0x4a8988,null))[_0x6add('0x2c')](handleError(_0x4a8988,null));};exports['describe']=function(_0x263384,_0x120acf){return db['WhatsappMessage'][_0x6add('0x5c')]()[_0x6add('0x22')](respondWithResult(_0x120acf,null))[_0x6add('0x2c')](handleError(_0x120acf,null));};var interaction_log=require('../../config/logger')(_0x6add('0x5d'));exports['accept']=function(_0x330a84,_0x161563,_0x9bd511){var _0xc3ba7b={'agent':{},'channel':_0x6add('0x5e')};if(_0x330a84['body']['id']){delete _0x330a84[_0x6add('0x5a')]['id'];}_0x330a84[_0x6add('0x5a')]['read']=!![];_0x330a84[_0x6add('0x5a')][_0x6add('0x5f')]=moment()[_0x6add('0x60')](_0x6add('0x61'));_0x330a84['body'][_0x6add('0x62')]=_0x330a84[_0x6add('0x5a')][_0x6add('0x62')]||_0x330a84[_0x6add('0x63')]['id'];_0xc3ba7b['agent']['id']=_0x330a84[_0x6add('0x5a')]['UserId'];return db[_0x6add('0x3f')][_0x6add('0x5b')]({'where':{'id':_0x330a84[_0x6add('0x57')]['id'],'UserId':null}})[_0x6add('0x22')](handleEntityNotFound(_0x161563,null))[_0x6add('0x22')](saveUpdates(_0x330a84[_0x6add('0x5a')],null))['then'](function(_0x5ad182){if(_0x5ad182){_0xc3ba7b[_0x6add('0x29')]=_0x5ad182[_0x6add('0x64')]({'plain':!![]});return db[_0x6add('0x65')][_0x6add('0x5b')]({'where':{'id':_0x5ad182[_0x6add('0x66')]}});}return null;})[_0x6add('0x22')](handleEntityNotFound(_0x161563,null))[_0x6add('0x22')](function(_0x2fc77c){if(_0x2fc77c){return _0x2fc77c[_0x6add('0x38')]({'UserId':_0x330a84[_0x6add('0x5a')]['UserId'],'read1stAt':_[_0x6add('0x67')](_0x2fc77c[_0x6add('0x68')])?moment()[_0x6add('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6add('0x22')](function(_0x42c22a){if(_0x42c22a){_0xc3ba7b[_0x6add('0x69')]=_0x42c22a['get']({'plain':!![]});interaction_log[_0x6add('0x2a')](_0x6add('0x6a'),_0x330a84[_0x6add('0x63')]['id'],_0x330a84[_0x6add('0x63')][_0x6add('0x3c')],_0x330a84[_0x6add('0x63')][_0x6add('0x6b')],_0xc3ba7b[_0x6add('0x69')]['id'],_0x330a84[_0x6add('0x5a')]?JSON[_0x6add('0x6c')](_0x330a84[_0x6add('0x5a')]):'null');return respondWithRpcPromise(_0x6add('0x6d'),_0x6add('0x6e'),_0xc3ba7b);}return null;})[_0x6add('0x22')](function(_0x3b8c7c){var _0x515afc=_0x6add('0x6f')+_0x3b8c7c[_0x6add('0x29')][_0x6add('0x70')];return db['sequelize'][_0x6add('0x43')](_0x515afc,{'type':db[_0x6add('0x71')]['QueryTypes'][_0x6add('0x72')],'raw':!![]})['then'](function(_0xfe4eac){return _0xfe4eac;});})[_0x6add('0x22')](function(_0x2d8a9e){if(_0x2d8a9e){_0xc3ba7b['message']['contact']=_0x2d8a9e[0x0];if(!_0x330a84[_0x6add('0x5a')][_0x6add('0x62')])return;return db['User'][_0x6add('0x5b')]({'where':{'id':_0x330a84['body'][_0x6add('0x62')],'role':_0x6add('0x73')},'attributes':['id',_0x6add('0x3c'),'fullname',_0x6add('0x74'),'internal'],'raw':!![]});}return null;})[_0x6add('0x22')](function(_0x2863a6){if(!_0x2863a6)return null;_0xc3ba7b[_0x6add('0x29')]['agent']=_0x2863a6;return _0xc3ba7b;})[_0x6add('0x22')](function(_0x2b9e7c){if(_0x2b9e7c){if(_0x330a84['body'][_0x6add('0x75')]){_0xc3ba7b[_0x6add('0x29')]['interface']=util['format'](_0x6add('0x76'),_0x330a84[_0x6add('0x63')][_0x6add('0x3c')]);_0xc3ba7b[_0x6add('0x29')]['channel']=_0xc3ba7b[_0x6add('0x77')];_0xc3ba7b[_0x6add('0x29')][_0x6add('0x78')]=_0xc3ba7b[_0x6add('0x77')];_0xc3ba7b['message'][_0x6add('0x79')]='accept';return respondWithRpcPromise('EventManager',_0x6add('0x7a'),{'event':_0x6add('0x7b'),'message':_0xc3ba7b[_0x6add('0x29')]},client9002)['then'](function(){return _0xc3ba7b;});}return _0xc3ba7b;}return null;})[_0x6add('0x22')](respondWithResult(_0x161563,null))[_0x6add('0x2c')](handleError(_0x161563,null));};var interaction_log=require(_0x6add('0x15'))('whatsapp-interactions');exports[_0x6add('0x36')]=function(_0xa09884,_0xaca7a1,_0x31eeeb){var _0x3627c5={'agent':{},'channel':_0x6add('0x5e')};if(_0xa09884['body']['id']){delete _0xa09884['body']['id'];}_0xa09884[_0x6add('0x5a')]['UserId']=_0xa09884[_0x6add('0x5a')][_0x6add('0x62')]||_0xa09884[_0x6add('0x63')]['id'];_0x3627c5['agent']['id']=_0xa09884[_0x6add('0x5a')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0xa09884[_0x6add('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xaca7a1,null))[_0x6add('0x22')](function(_0x2c9022){if(_0x2c9022){_0x3627c5['message']=_0x2c9022['get']({'plain':!![]});return db[_0x6add('0x65')]['find']({'where':{'id':_0x2c9022[_0x6add('0x66')]}});}return null;})[_0x6add('0x22')](handleEntityNotFound(_0xaca7a1,null))['then'](function(_0x23b55a){if(_0x23b55a){_0x3627c5['interaction']=_0x23b55a['get']({'plain':!![]});interaction_log[_0x6add('0x2a')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa09884[_0x6add('0x63')]['id'],_0xa09884[_0x6add('0x63')][_0x6add('0x3c')],_0xa09884[_0x6add('0x63')][_0x6add('0x6b')],_0x3627c5['interaction']['id'],_0xa09884[_0x6add('0x5a')]?JSON[_0x6add('0x6c')](_0xa09884[_0x6add('0x5a')]):_0x6add('0x7c'));return respondWithRpcPromise('RejectMessage',_0x6add('0x7d'),_0x3627c5);}return null;})[_0x6add('0x22')](function(_0xd73b98){var _0x26f1ae=_0x6add('0x6f')+_0xd73b98[_0x6add('0x29')][_0x6add('0x70')];return db[_0x6add('0x7e')][_0x6add('0x43')](_0x26f1ae,{'type':db[_0x6add('0x71')][_0x6add('0x7f')]['SELECT'],'raw':!![]})[_0x6add('0x22')](function(_0x28b8cd){return _0x28b8cd;});})[_0x6add('0x22')](function(_0x296811){if(_0x296811){_0x3627c5[_0x6add('0x29')][_0x6add('0x80')]=_0x296811[0x0];if(!_0xa09884[_0x6add('0x5a')][_0x6add('0x62')])return;return db['User'][_0x6add('0x5b')]({'where':{'id':_0xa09884['body']['UserId'],'role':'agent'},'attributes':['id',_0x6add('0x3c'),'fullname',_0x6add('0x74'),_0x6add('0x81')],'raw':!![]});}return null;})[_0x6add('0x22')](function(_0x234072){if(!_0x234072)return null;_0x3627c5[_0x6add('0x29')][_0x6add('0x73')]=_0x234072;return _0x3627c5;})[_0x6add('0x22')](function(_0xd8f2e8){if(_0xd8f2e8){_0xd8f2e8['message'][_0x6add('0x82')]=util[_0x6add('0x60')]('SIP/%s',_0xa09884[_0x6add('0x63')][_0x6add('0x3c')]);_0xd8f2e8[_0x6add('0x29')][_0x6add('0x77')]=_0x3627c5[_0x6add('0x77')];_0xd8f2e8[_0x6add('0x29')][_0x6add('0x78')]=_0x3627c5[_0x6add('0x77')];_0xd8f2e8[_0x6add('0x29')][_0x6add('0x79')]='reject';respondWithRpcPromise(_0x6add('0x7a'),_0x6add('0x7a'),{'event':_0x6add('0x83'),'message':_0xd8f2e8[_0x6add('0x29')]},client9002);return _0x3627c5;}return null;})[_0x6add('0x22')](respondWithResult(_0xaca7a1,null))[_0x6add('0x2c')](handleError(_0xaca7a1,null));};exports[_0x6add('0x2e')]=function(_0x1bcf76,_0x4d74db,_0x6e48bc){if(_0x1bcf76[_0x6add('0x5a')]['id']){delete _0x1bcf76[_0x6add('0x5a')]['id'];}var _0x1b085e;return db['WhatsappMessage'][_0x6add('0x5b')]({'where':{'id':_0x1bcf76['params']['id']}})[_0x6add('0x22')](handleEntityNotFound(_0x4d74db,null))[_0x6add('0x22')](function(_0x2a8b47){if(_0x2a8b47){_0x1b085e=_0x2a8b47;return db['WhatsappAccount'][_0x6add('0x5b')]({'where':{'id':_0x2a8b47[_0x6add('0x84')]}});}})['then'](handleEntityNotFound(_0x4d74db,null))['then'](function(_0x28cc35){if(_0x28cc35){logger[_0x6add('0x25')](_0x6add('0x85'),_0x6add('0x2e'),'received\x20delivery\x20report\x20from',_0x28cc35[_0x6add('0x4f')],util[_0x6add('0x86')](_0x1bcf76[_0x6add('0x5a')],{'showHidden':![],'depth':null}));switch(_0x28cc35['type']){case _0x6add('0x87'):if(_0x1bcf76['body'][_0x6add('0x88')]&&_0x1bcf76['body'][_0x6add('0x88')]===_0x1b085e[_0x6add('0x89')]&&_0x1bcf76[_0x6add('0x5a')][_0x6add('0x8a')]&&_0x1bcf76[_0x6add('0x5a')][_0x6add('0x8a')]==='read'){return _0x1b085e[_0x6add('0x38')]({'read':!![]});}else{logger[_0x6add('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6add('0x2e'),_0x6add('0x87'),util[_0x6add('0x86')](_0x1bcf76[_0x6add('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x1b085e;}})[_0x6add('0x22')](respondWithResult(_0x4d74db,null))[_0x6add('0x2c')](handleError(_0x4d74db,null));}; \ No newline at end of file +var _0x0ad3=['read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','WhatsappInteraction','WhatsappInteractionId','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','email','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','params','keys','create','body','find','describe','whatsapp-interactions','whatsapp'];(function(_0x9b53a6,_0x4d90f1){var _0x346ba1=function(_0x568507){while(--_0x568507){_0x9b53a6['push'](_0x9b53a6['shift']());}};_0x346ba1(++_0x4d90f1);}(_0x0ad3,0x1ce));var _0x30ad=function(_0x2f624d,_0x221262){_0x2f624d=_0x2f624d-0x0;var _0x56c440=_0x0ad3[_0x2f624d];return _0x56c440;};'use strict';var emlformat=require(_0x30ad('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30ad('0x1'));var rp=require('request-promise');var moment=require(_0x30ad('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x30ad('0x3'));var util=require(_0x30ad('0x4'));var path=require(_0x30ad('0x5'));var sox=require(_0x30ad('0x6'));var csv=require(_0x30ad('0x7'));var ejs=require(_0x30ad('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30ad('0x9'));var squel=require('squel');var crypto=require(_0x30ad('0xa'));var jsforce=require(_0x30ad('0xb'));var deskjs=require(_0x30ad('0xc'));var toCsv=require(_0x30ad('0x7'));var querystring=require(_0x30ad('0xd'));var Papa=require(_0x30ad('0xe'));var Redis=require(_0x30ad('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x30ad('0x10'));var as=require(_0x30ad('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30ad('0x12'))('api');var utils=require(_0x30ad('0x13'));var config=require(_0x30ad('0x14'));var licenseUtil=require(_0x30ad('0x15'));var db=require(_0x30ad('0x16'))['db'];config[_0x30ad('0x17')]=_[_0x30ad('0x18')](config[_0x30ad('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x30ad('0x19'))(new Redis(config[_0x30ad('0x17')]));require('./whatsappMessage.socket')[_0x30ad('0x1a')](socket);var jayson=require(_0x30ad('0x1b'));var client=jayson[_0x30ad('0x1c')][_0x30ad('0x1d')]({'port':0x232c});var client9002=jayson[_0x30ad('0x1c')][_0x30ad('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1c94f6,_0x4e38d1,_0x8b206,_0x4929ad){return new BPromise(function(_0xe38b60,_0x57c5f5){var _0x37b118=_0x4929ad||client;return _0x37b118[_0x30ad('0x1e')](_0x1c94f6,_0x8b206)[_0x30ad('0x1f')](function(_0x240fa1){logger[_0x30ad('0x20')](_0x30ad('0x21'),_0x4e38d1,_0x30ad('0x22'));logger[_0x30ad('0x23')](_0x30ad('0x24'),_0x4e38d1,_0x30ad('0x22'),JSON[_0x30ad('0x25')](_0x240fa1));if(_0x240fa1[_0x30ad('0x26')]){if(_0x240fa1[_0x30ad('0x26')][_0x30ad('0x27')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4e38d1,_0x240fa1[_0x30ad('0x26')][_0x30ad('0x28')]);return _0x57c5f5(_0x240fa1['error'][_0x30ad('0x28')]);}logger['error'](_0x30ad('0x21'),_0x4e38d1,_0x240fa1[_0x30ad('0x26')][_0x30ad('0x28')]);return _0xe38b60(_0x240fa1['error'][_0x30ad('0x28')]);}else{logger[_0x30ad('0x20')](_0x30ad('0x21'),_0x4e38d1,'request\x20sent');_0xe38b60(_0x240fa1['result']['message']);}})[_0x30ad('0x29')](function(_0x4f485c){logger['error'](_0x30ad('0x21'),_0x4e38d1,_0x4f485c);_0x57c5f5(_0x4f485c);});});}function respondWithStatusCode(_0x343cc4,_0xbadb07){_0xbadb07=_0xbadb07||0xcc;return function(_0x1dfadb){if(_0x1dfadb){return _0x343cc4[_0x30ad('0x2a')](_0xbadb07);}return _0x343cc4[_0x30ad('0x2b')](_0xbadb07)[_0x30ad('0x2c')]();};}function respondWithResult(_0x681901,_0x188d9b){_0x188d9b=_0x188d9b||0xc8;return function(_0x209e31){if(_0x209e31){return _0x681901['status'](_0x188d9b)[_0x30ad('0x2d')](_0x209e31);}};}function respondWithFilteredResult(_0x3fcd28,_0x46d77a){return function(_0x1ff077){if(_0x1ff077){var _0x1f3f25=typeof _0x46d77a['offset']===_0x30ad('0x2e')&&typeof _0x46d77a[_0x30ad('0x2f')]===_0x30ad('0x2e');var _0x23a802=_0x1ff077['count'];var _0x4bfe9a=_0x1f3f25?0x0:_0x46d77a[_0x30ad('0x30')];var _0xd55063=_0x1f3f25?_0x1ff077[_0x30ad('0x31')]:_0x46d77a[_0x30ad('0x30')]+_0x46d77a[_0x30ad('0x2f')];var _0x202b12;if(_0xd55063>=_0x23a802){_0xd55063=_0x23a802;_0x202b12=0xc8;}else{_0x202b12=0xce;}_0x3fcd28['status'](_0x202b12);return _0x3fcd28[_0x30ad('0x32')](_0x30ad('0x33'),_0x4bfe9a+'-'+_0xd55063+'/'+_0x23a802)[_0x30ad('0x2d')](_0x1ff077);}return null;};}function patchUpdates(_0x5d471a){return function(_0x15d855){try{jsonpatch[_0x30ad('0x34')](_0x15d855,_0x5d471a,!![]);}catch(_0x15d27b){return BPromise[_0x30ad('0x35')](_0x15d27b);}return _0x15d855[_0x30ad('0x36')]();};}function saveUpdates(_0x44ba11,_0x34912c){return function(_0x570e5a){if(_0x570e5a){return _0x570e5a[_0x30ad('0x37')](_0x44ba11)[_0x30ad('0x1f')](function(_0x4dce94){return _0x4dce94;});}return null;};}function removeEntity(_0x2c7de5,_0x50b8e3){return function(_0x31abad){if(_0x31abad){return _0x31abad[_0x30ad('0x38')]()[_0x30ad('0x1f')](function(){_0x2c7de5[_0x30ad('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c4a6c,_0x5e4546){return function(_0x106051){if(!_0x106051){_0x2c4a6c[_0x30ad('0x2a')](0x194);}return _0x106051;};}function handleError(_0x1c6f22,_0x3bfd8f){_0x3bfd8f=_0x3bfd8f||0x1f4;return function(_0x2eda96){logger[_0x30ad('0x26')](_0x2eda96[_0x30ad('0x39')]);if(_0x2eda96[_0x30ad('0x3a')]){delete _0x2eda96[_0x30ad('0x3a')];}_0x1c6f22[_0x30ad('0x2b')](_0x3bfd8f)['send'](_0x2eda96);};}exports[_0x30ad('0x3b')]=function(_0x433df1,_0x6436dc){var _0x1c78e7={},_0x261fc8={},_0x79efe0={'count':0x0,'rows':[]};var _0x820f5=_[_0x30ad('0x3c')](db['WhatsappMessage'][_0x30ad('0x3d')],function(_0x488f82){return{'name':_0x488f82[_0x30ad('0x3e')],'type':_0x488f82[_0x30ad('0x3f')][_0x30ad('0x40')]};});_0x261fc8[_0x30ad('0x41')]=_[_0x30ad('0x3c')](_0x820f5,_0x30ad('0x3a'));_0x261fc8['query']=_['keys'](_0x433df1[_0x30ad('0x42')]);_0x261fc8[_0x30ad('0x43')]=_[_0x30ad('0x44')](_0x261fc8[_0x30ad('0x41')],_0x261fc8[_0x30ad('0x42')]);_0x1c78e7[_0x30ad('0x45')]=_['intersection'](_0x261fc8[_0x30ad('0x41')],qs[_0x30ad('0x46')](_0x433df1[_0x30ad('0x42')][_0x30ad('0x46')]));_0x1c78e7[_0x30ad('0x45')]=_0x1c78e7[_0x30ad('0x45')][_0x30ad('0x47')]?_0x1c78e7['attributes']:_0x261fc8[_0x30ad('0x41')];if(!_0x433df1[_0x30ad('0x42')]['hasOwnProperty'](_0x30ad('0x48'))){_0x1c78e7['limit']=qs[_0x30ad('0x2f')](_0x433df1[_0x30ad('0x42')][_0x30ad('0x2f')]);_0x1c78e7[_0x30ad('0x30')]=qs['offset'](_0x433df1[_0x30ad('0x42')][_0x30ad('0x30')]);}_0x1c78e7[_0x30ad('0x49')]=qs['sort'](_0x433df1[_0x30ad('0x42')][_0x30ad('0x4a')]);_0x1c78e7[_0x30ad('0x4b')]=qs['filters'](_[_0x30ad('0x4c')](_0x433df1[_0x30ad('0x42')],_0x261fc8['filters']),_0x820f5);if(_0x433df1['query'][_0x30ad('0x4d')]){_0x1c78e7[_0x30ad('0x4b')]=_[_0x30ad('0x4e')](_0x1c78e7[_0x30ad('0x4b')],{'$or':_[_0x30ad('0x3c')](_0x820f5,function(_0x1e68c7){if(_0x1e68c7[_0x30ad('0x3f')]!==_0x30ad('0x4f')){var _0x3b4454={};_0x3b4454[_0x1e68c7[_0x30ad('0x3a')]]={'$like':'%'+_0x433df1[_0x30ad('0x42')][_0x30ad('0x4d')]+'%'};return _0x3b4454;}})});}_0x1c78e7=_[_0x30ad('0x4e')]({},_0x1c78e7,_0x433df1[_0x30ad('0x50')]);var _0x34e3d1={'where':_0x1c78e7[_0x30ad('0x4b')]};return db[_0x30ad('0x51')][_0x30ad('0x31')](_0x34e3d1)[_0x30ad('0x1f')](function(_0x2b6821){_0x79efe0[_0x30ad('0x31')]=_0x2b6821;if(_0x433df1[_0x30ad('0x42')][_0x30ad('0x52')]){_0x1c78e7[_0x30ad('0x53')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x30ad('0x54')](_0x1c78e7);})['then'](function(_0x2fc81d){_0x79efe0[_0x30ad('0x55')]=_0x2fc81d;return _0x79efe0;})['then'](respondWithFilteredResult(_0x6436dc,_0x1c78e7))[_0x30ad('0x29')](handleError(_0x6436dc,null));};exports['show']=function(_0x1ca0dd,_0xdeb9bd){var _0x4c8a23={'raw':!![],'where':{'id':_0x1ca0dd[_0x30ad('0x56')]['id']}},_0x2628b7={};_0x2628b7[_0x30ad('0x41')]=_[_0x30ad('0x57')](db[_0x30ad('0x51')]['rawAttributes']);_0x2628b7[_0x30ad('0x42')]=_[_0x30ad('0x57')](_0x1ca0dd[_0x30ad('0x42')]);_0x2628b7[_0x30ad('0x43')]=_['intersection'](_0x2628b7['model'],_0x2628b7[_0x30ad('0x42')]);_0x4c8a23['attributes']=_[_0x30ad('0x44')](_0x2628b7[_0x30ad('0x41')],qs[_0x30ad('0x46')](_0x1ca0dd['query']['fields']));_0x4c8a23[_0x30ad('0x45')]=_0x4c8a23['attributes'][_0x30ad('0x47')]?_0x4c8a23['attributes']:_0x2628b7[_0x30ad('0x41')];if(_0x1ca0dd['query']['includeAll']){_0x4c8a23['include']=[{'all':!![]}];}_0x4c8a23=_[_0x30ad('0x4e')]({},_0x4c8a23,_0x1ca0dd['options']);return db[_0x30ad('0x51')]['find'](_0x4c8a23)['then'](handleEntityNotFound(_0xdeb9bd,null))[_0x30ad('0x1f')](respondWithResult(_0xdeb9bd,null))[_0x30ad('0x29')](handleError(_0xdeb9bd,null));};exports['create']=function(_0x555cc4,_0x5e16b3){return db[_0x30ad('0x51')][_0x30ad('0x58')](_0x555cc4[_0x30ad('0x59')],{})[_0x30ad('0x1f')](respondWithResult(_0x5e16b3,0xc9))['catch'](handleError(_0x5e16b3,null));};exports['update']=function(_0x289daa,_0x2f491c){if(_0x289daa[_0x30ad('0x59')]['id']){delete _0x289daa['body']['id'];}return db[_0x30ad('0x51')][_0x30ad('0x5a')]({'where':{'id':_0x289daa[_0x30ad('0x56')]['id']}})[_0x30ad('0x1f')](handleEntityNotFound(_0x2f491c,null))[_0x30ad('0x1f')](saveUpdates(_0x289daa[_0x30ad('0x59')],null))['then'](respondWithResult(_0x2f491c,null))[_0x30ad('0x29')](handleError(_0x2f491c,null));};exports[_0x30ad('0x38')]=function(_0x31119b,_0x54f1cb){return db[_0x30ad('0x51')]['find']({'where':{'id':_0x31119b[_0x30ad('0x56')]['id']}})[_0x30ad('0x1f')](handleEntityNotFound(_0x54f1cb,null))[_0x30ad('0x1f')](removeEntity(_0x54f1cb,null))['catch'](handleError(_0x54f1cb,null));};exports[_0x30ad('0x5b')]=function(_0xe496d0,_0xc42f9a){return db['WhatsappMessage'][_0x30ad('0x5b')]()[_0x30ad('0x1f')](respondWithResult(_0xc42f9a,null))[_0x30ad('0x29')](handleError(_0xc42f9a,null));};var interaction_log=require(_0x30ad('0x12'))(_0x30ad('0x5c'));exports['accept']=function(_0x2529c0,_0x3d67cc,_0x14dbe3){var _0x2f0a24={'agent':{},'channel':_0x30ad('0x5d')};if(_0x2529c0[_0x30ad('0x59')]['id']){delete _0x2529c0['body']['id'];}_0x2529c0[_0x30ad('0x59')][_0x30ad('0x5e')]=!![];_0x2529c0['body'][_0x30ad('0x5f')]=moment()[_0x30ad('0x60')](_0x30ad('0x61'));_0x2529c0['body'][_0x30ad('0x62')]=_0x2529c0[_0x30ad('0x59')][_0x30ad('0x62')]||_0x2529c0[_0x30ad('0x63')]['id'];_0x2f0a24[_0x30ad('0x64')]['id']=_0x2529c0[_0x30ad('0x59')]['UserId'];return db[_0x30ad('0x51')][_0x30ad('0x5a')]({'where':{'id':_0x2529c0[_0x30ad('0x56')]['id'],'UserId':null}})[_0x30ad('0x1f')](handleEntityNotFound(_0x3d67cc,null))[_0x30ad('0x1f')](saveUpdates(_0x2529c0['body'],null))[_0x30ad('0x1f')](function(_0x371cce){if(_0x371cce){_0x2f0a24[_0x30ad('0x28')]=_0x371cce[_0x30ad('0x65')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x371cce['WhatsappInteractionId']}});}return null;})[_0x30ad('0x1f')](handleEntityNotFound(_0x3d67cc,null))['then'](function(_0x1b99c5){if(_0x1b99c5){return _0x1b99c5[_0x30ad('0x37')]({'UserId':_0x2529c0['body'][_0x30ad('0x62')],'read1stAt':_[_0x30ad('0x66')](_0x1b99c5[_0x30ad('0x67')])?moment()['format'](_0x30ad('0x61')):undefined});}return null;})['then'](function(_0x5200be){if(_0x5200be){_0x2f0a24[_0x30ad('0x68')]=_0x5200be[_0x30ad('0x65')]({'plain':!![]});interaction_log[_0x30ad('0x20')](_0x30ad('0x69'),_0x2529c0[_0x30ad('0x63')]['id'],_0x2529c0[_0x30ad('0x63')][_0x30ad('0x3a')],_0x2529c0[_0x30ad('0x63')][_0x30ad('0x6a')],_0x2f0a24['interaction']['id'],_0x2529c0[_0x30ad('0x59')]?JSON[_0x30ad('0x25')](_0x2529c0[_0x30ad('0x59')]):_0x30ad('0x6b'));return respondWithRpcPromise(_0x30ad('0x6c'),_0x30ad('0x6d'),_0x2f0a24);}return null;})['then'](function(_0x258a12){var _0x4ef436='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x258a12[_0x30ad('0x28')][_0x30ad('0x6e')];return db[_0x30ad('0x6f')][_0x30ad('0x42')](_0x4ef436,{'type':db['Sequelize'][_0x30ad('0x70')][_0x30ad('0x71')],'raw':!![]})[_0x30ad('0x1f')](function(_0x5a4ab8){return _0x5a4ab8;});})['then'](function(_0x2d17a4){if(_0x2d17a4){_0x2f0a24[_0x30ad('0x28')]['contact']=_0x2d17a4[0x0];if(!_0x2529c0[_0x30ad('0x59')][_0x30ad('0x62')])return;return db[_0x30ad('0x72')][_0x30ad('0x5a')]({'where':{'id':_0x2529c0[_0x30ad('0x59')][_0x30ad('0x62')],'role':_0x30ad('0x64')},'attributes':['id',_0x30ad('0x3a'),_0x30ad('0x73'),'email',_0x30ad('0x74')],'raw':!![]});}return null;})[_0x30ad('0x1f')](function(_0x19a51e){if(!_0x19a51e)return null;_0x2f0a24[_0x30ad('0x28')]['agent']=_0x19a51e;return _0x2f0a24;})[_0x30ad('0x1f')](function(_0x3b3057){if(_0x3b3057){if(_0x2529c0['body'][_0x30ad('0x75')]){_0x2f0a24[_0x30ad('0x28')][_0x30ad('0x76')]=util[_0x30ad('0x60')](_0x30ad('0x77'),_0x2529c0[_0x30ad('0x63')][_0x30ad('0x3a')]);_0x2f0a24[_0x30ad('0x28')][_0x30ad('0x78')]=_0x2f0a24[_0x30ad('0x78')];_0x2f0a24['message'][_0x30ad('0x79')]=_0x2f0a24['channel'];_0x2f0a24[_0x30ad('0x28')][_0x30ad('0x7a')]=_0x30ad('0x7b');return respondWithRpcPromise(_0x30ad('0x7c'),_0x30ad('0x7c'),{'event':_0x30ad('0x7d'),'message':_0x2f0a24[_0x30ad('0x28')]},client9002)[_0x30ad('0x1f')](function(){return _0x2f0a24;});}return _0x2f0a24;}return null;})[_0x30ad('0x1f')](respondWithResult(_0x3d67cc,null))[_0x30ad('0x29')](handleError(_0x3d67cc,null));};var interaction_log=require(_0x30ad('0x12'))(_0x30ad('0x5c'));exports[_0x30ad('0x35')]=function(_0x54ee41,_0x4cdae7,_0x13c7eb){var _0x5be10b={'agent':{},'channel':_0x30ad('0x5d')};if(_0x54ee41[_0x30ad('0x59')]['id']){delete _0x54ee41[_0x30ad('0x59')]['id'];}_0x54ee41['body']['UserId']=_0x54ee41[_0x30ad('0x59')][_0x30ad('0x62')]||_0x54ee41[_0x30ad('0x63')]['id'];_0x5be10b[_0x30ad('0x64')]['id']=_0x54ee41[_0x30ad('0x59')]['UserId'];return db['WhatsappMessage'][_0x30ad('0x5a')]({'where':{'id':_0x54ee41[_0x30ad('0x56')]['id'],'UserId':null}})[_0x30ad('0x1f')](handleEntityNotFound(_0x4cdae7,null))[_0x30ad('0x1f')](function(_0x62ad4a){if(_0x62ad4a){_0x5be10b['message']=_0x62ad4a['get']({'plain':!![]});return db[_0x30ad('0x7e')]['find']({'where':{'id':_0x62ad4a[_0x30ad('0x7f')]}});}return null;})[_0x30ad('0x1f')](handleEntityNotFound(_0x4cdae7,null))[_0x30ad('0x1f')](function(_0x879295){if(_0x879295){_0x5be10b[_0x30ad('0x68')]=_0x879295[_0x30ad('0x65')]({'plain':!![]});interaction_log[_0x30ad('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54ee41[_0x30ad('0x63')]['id'],_0x54ee41[_0x30ad('0x63')][_0x30ad('0x3a')],_0x54ee41['user'][_0x30ad('0x6a')],_0x5be10b[_0x30ad('0x68')]['id'],_0x54ee41[_0x30ad('0x59')]?JSON[_0x30ad('0x25')](_0x54ee41[_0x30ad('0x59')]):_0x30ad('0x6b'));return respondWithRpcPromise(_0x30ad('0x80'),'rejectMessage',_0x5be10b);}return null;})['then'](function(_0x43d4f3){var _0x544e6e=_0x30ad('0x81')+_0x43d4f3[_0x30ad('0x28')]['ContactId'];return db[_0x30ad('0x6f')]['query'](_0x544e6e,{'type':db[_0x30ad('0x82')][_0x30ad('0x70')]['SELECT'],'raw':!![]})[_0x30ad('0x1f')](function(_0xca1ff2){return _0xca1ff2;});})[_0x30ad('0x1f')](function(_0x454e6f){if(_0x454e6f){_0x5be10b[_0x30ad('0x28')]['contact']=_0x454e6f[0x0];if(!_0x54ee41['body'][_0x30ad('0x62')])return;return db[_0x30ad('0x72')][_0x30ad('0x5a')]({'where':{'id':_0x54ee41['body']['UserId'],'role':'agent'},'attributes':['id',_0x30ad('0x3a'),_0x30ad('0x73'),_0x30ad('0x83'),'internal'],'raw':!![]});}return null;})[_0x30ad('0x1f')](function(_0x304c9b){if(!_0x304c9b)return null;_0x5be10b[_0x30ad('0x28')][_0x30ad('0x64')]=_0x304c9b;return _0x5be10b;})[_0x30ad('0x1f')](function(_0x516584){if(_0x516584){_0x516584['message'][_0x30ad('0x76')]=util[_0x30ad('0x60')](_0x30ad('0x77'),_0x54ee41[_0x30ad('0x63')][_0x30ad('0x3a')]);_0x516584[_0x30ad('0x28')][_0x30ad('0x78')]=_0x5be10b[_0x30ad('0x78')];_0x516584[_0x30ad('0x28')][_0x30ad('0x79')]=_0x5be10b['channel'];_0x516584[_0x30ad('0x28')][_0x30ad('0x7a')]=_0x30ad('0x35');respondWithRpcPromise('EventManager',_0x30ad('0x7c'),{'event':'rejectmessage','message':_0x516584['message']},client9002);return _0x5be10b;}return null;})['then'](respondWithResult(_0x4cdae7,null))[_0x30ad('0x29')](handleError(_0x4cdae7,null));};exports['status']=function(_0x77478b,_0x35b161,_0x3ddbd6){if(_0x77478b['body']['id']){delete _0x77478b[_0x30ad('0x59')]['id'];}var _0x5f4676;return db[_0x30ad('0x51')]['find']({'where':{'id':_0x77478b[_0x30ad('0x56')]['id']}})[_0x30ad('0x1f')](handleEntityNotFound(_0x35b161,null))[_0x30ad('0x1f')](function(_0x5463bf){if(_0x5463bf){_0x5f4676=_0x5463bf;return db[_0x30ad('0x84')][_0x30ad('0x5a')]({'where':{'id':_0x5463bf[_0x30ad('0x85')]}});}})[_0x30ad('0x1f')](handleEntityNotFound(_0x35b161,null))['then'](function(_0x5ef3d0){if(_0x5ef3d0){logger[_0x30ad('0x23')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x30ad('0x2b'),'received\x20delivery\x20report\x20from',_0x5ef3d0[_0x30ad('0x3f')],util[_0x30ad('0x86')](_0x77478b[_0x30ad('0x59')],{'showHidden':![],'depth':null}));switch(_0x5ef3d0[_0x30ad('0x3f')]){case _0x30ad('0x87'):if(_0x77478b[_0x30ad('0x59')][_0x30ad('0x88')]&&_0x77478b['body'][_0x30ad('0x88')]===_0x5f4676['messageId']&&_0x77478b[_0x30ad('0x59')]['MessageStatus']&&_0x77478b[_0x30ad('0x59')][_0x30ad('0x89')]===_0x30ad('0x5e')){return _0x5f4676[_0x30ad('0x37')]({'read':!![]});}else{logger[_0x30ad('0x26')](_0x30ad('0x8a'),_0x30ad('0x2b'),_0x30ad('0x87'),util['inspect'](_0x77478b[_0x30ad('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x5f4676;}})['then'](respondWithResult(_0x35b161,null))[_0x30ad('0x29')](handleError(_0x35b161,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 12abde8..c9218ff 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 _0x282b=['save','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x4d4f84,_0x447972){var _0x486c2f=function(_0x17ca34){while(--_0x17ca34){_0x4d4f84['push'](_0x4d4f84['shift']());}};_0x486c2f(++_0x447972);}(_0x282b,0xec));var _0xb282=function(_0x446460,_0x159747){_0x446460=_0x446460-0x0;var _0x259a42=_0x282b[_0x446460];return _0x259a42;};'use strict';var EventEmitter=require(_0xb282('0x0'));var WhatsappMessage=require(_0xb282('0x1'))['db'][_0xb282('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb282('0x3')](0x0);var events={'afterCreate':_0xb282('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25d77d){return function(_0x5cadd7,_0x3fbbaf,_0x175c83){WhatsappMessageEvents[_0xb282('0x5')](_0x25d77d+':'+_0x5cadd7['id'],_0x5cadd7);WhatsappMessageEvents[_0xb282('0x5')](_0x25d77d,_0x5cadd7);_0x175c83(null);};}for(var e in events){if(events[_0xb282('0x6')](e)){var event=events[e];WhatsappMessage[_0xb282('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x2547=['hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0x50abc4,_0x558d64){var _0x5a745d=function(_0x4e835b){while(--_0x4e835b){_0x50abc4['push'](_0x50abc4['shift']());}};_0x5a745d(++_0x558d64);}(_0x2547,0x1cd));var _0x7254=function(_0x117c0f,_0x37948f){_0x117c0f=_0x117c0f-0x0;var _0x25ee86=_0x2547[_0x117c0f];return _0x25ee86;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){WhatsappMessageEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);WhatsappMessageEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c6b2603..e9d8cd4 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 _0x6ff5=['whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','update','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','application/json','message_id','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage'];(function(_0x2987a8,_0x4081f0){var _0x3b9095=function(_0xe5a1fb){while(--_0xe5a1fb){_0x2987a8['push'](_0x2987a8['shift']());}};_0x3b9095(++_0x4081f0);}(_0x6ff5,0xab));var _0x56ff=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6ff5[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x56ff('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56ff('0x1'));var BPromise=require('bluebird');var rp=require(_0x56ff('0x2'));var fetch=require(_0x56ff('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56ff('0x4'));var attributes=require(_0x56ff('0x5'));module[_0x56ff('0x6')]=function(_0x3f06be,_0x1f7c30){return _0x3f06be[_0x56ff('0x7')](_0x56ff('0x8'),attributes,{'tableName':_0x56ff('0x9'),'paranoid':![],'indexes':[{'name':_0x56ff('0xa'),'fields':[_0x56ff('0xa')]},{'name':_0x56ff('0xb'),'fields':[_0x56ff('0xc')],'type':_0x56ff('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x291c5c,_0x12a622,_0x2ea094){var _0x7d3fd0=_0x3f06be[_0x56ff('0xe')];var _0x243a54=_0x291c5c[_0x56ff('0xf')]({'plain':!![]});if(_0x243a54[_0x56ff('0x10')][_0x56ff('0x11')]()==='in'||_0x243a54[_0x56ff('0x10')][_0x56ff('0x11')]()===_0x56ff('0x12')&&!_0x243a54[_0x56ff('0x13')]&&!_[_0x56ff('0x14')](_0x243a54[_0x56ff('0x15')])){_0x7d3fd0[_0x56ff('0x16')][_0x56ff('0x17')]({'where':{'id':_0x243a54[_0x56ff('0x18')]}})[_0x56ff('0x19')](function(_0x135b3b){if(_0x135b3b){_0x135b3b['update']({'lastMsgAt':_0x243a54[_0x56ff('0x1a')],'lastMsgDirection':_0x243a54[_0x56ff('0x10')][_0x56ff('0x11')]()});}})[_0x56ff('0x1b')](function(_0x227d5f){console['error'](_0x227d5f);});}if(_0x243a54['direction']===_0x56ff('0x12')&&!_0x243a54[_0x56ff('0x13')]){var _0x5d5c08;_0x7d3fd0[_0x56ff('0x1c')][_0x56ff('0x1d')]({'where':{'id':_0x243a54[_0x56ff('0x1e')]},'raw':!![]})[_0x56ff('0x19')](function(_0x5c4378){_0x5d5c08=_0x5c4378;if(_0x5d5c08&&_0x5d5c08[_0x56ff('0x1f')]){switch(_0x5d5c08['type']){case _0x56ff('0x20'):var _0x474d8d=require(_0x56ff('0x20'));if(_0x5d5c08['accountSid']&&_0x5d5c08[_0x56ff('0x21')]&&_0x5d5c08[_0x56ff('0x22')]){var _0x133d85=new _0x474d8d(_0x5d5c08[_0x56ff('0x23')],_0x5d5c08[_0x56ff('0x21')]);_0x133d85[_0x56ff('0x24')][_0x56ff('0x25')]({'body':_0x243a54[_0x56ff('0xc')],'to':_0x56ff('0x26')+_0x243a54[_0x56ff('0x22')],'from':_0x56ff('0x26')+_0x5d5c08[_0x56ff('0x22')],'statusCallback':_0x5d5c08[_0x56ff('0x27')]+'/api/whatsapp/messages/'+_0x243a54['id']+_0x56ff('0x28')+_0x5d5c08['token']})['then'](function(_0x494055){if(_0x494055['sid']){return _0x291c5c[_0x56ff('0x29')]({'messageId':_0x494055[_0x56ff('0x2a')]});}})[_0x56ff('0x1b')](function(_0x11f3df){logger[_0x56ff('0x2b')](_0x56ff('0x2c'),'afterCreate',_0x56ff('0x20'),util[_0x56ff('0x2d')](_0x11f3df,{'showHidden':![],'depth':null}));});}else{logger[_0x56ff('0x2b')](_0x56ff('0x2c'),_0x56ff('0x2e'),_0x56ff('0x20'),_0x56ff('0x2f'));}break;case _0x56ff('0x30'):var _0x36429f=_0x5d5c08['accountSid'];var _0x347ea4=_0x5d5c08[_0x56ff('0x21')];var _0x24937e=_0x5d5c08[_0x56ff('0x31')]+_0x56ff('0x32')+_0x36429f+_0x56ff('0x33');var _0x2eb700={'to':[_0x243a54['phone']],'message':{'type':'text','text':_0x243a54['body']}};var _0x5b6bdc={'method':_0x56ff('0x34'),'uri':_0x24937e,'headers':{'Authorization':'Bearer\x20'+_0x347ea4,'Content-Type':_0x56ff('0x35')},'body':_0x2eb700,'json':!![]};rp(_0x5b6bdc)[_0x56ff('0x19')](function(_0x11fbf1){if(_0x11fbf1['statuses'][0x0][_0x56ff('0x36')]){return _0x291c5c[_0x56ff('0x29')]({'messageId':_0x11fbf1[_0x56ff('0x37')][0x0]['message_id']});}})[_0x56ff('0x1b')](function(_0x3144ff){logger['err'](_0x56ff('0x38'),_0x3144ff);});break;}}})[_0x56ff('0x39')](function(){_0x2ea094();});}else{_0x2ea094();}}},'charset':_0x56ff('0x3a'),'collate':_0x56ff('0x3b')});}; \ No newline at end of file +var _0xac0f=['sinch','/whatsapp/v1/','/messages/','POST','application/json','message_id','statuses','finally','utf8mb4','lodash','../../config/logger','api','bluebird','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','catch','error','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x44f939,_0x3f1b5c){var _0x5eb8ab=function(_0x49fa97){while(--_0x49fa97){_0x44f939['push'](_0x44f939['shift']());}};_0x5eb8ab(++_0x3f1b5c);}(_0xac0f,0x147));var _0xfac0=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xac0f[_0x2fff83];return _0xa2a722;};'use strict';var _=require(_0xfac0('0x0'));var util=require('util');var logger=require(_0xfac0('0x1'))(_0xfac0('0x2'));var moment=require('moment');var BPromise=require(_0xfac0('0x3'));var rp=require('request-promise');var fetch=require(_0xfac0('0x4'));var fs=require('fs');var path=require(_0xfac0('0x5'));var rimraf=require('rimraf');var config=require(_0xfac0('0x6'));var attributes=require(_0xfac0('0x7'));module[_0xfac0('0x8')]=function(_0x524d95,_0x2eb625){return _0x524d95['define'](_0xfac0('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xfac0('0xa'),'fields':[_0xfac0('0xa')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xfac0('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b1660,_0x1f6a10,_0x8ae761){var _0x3e1b47=_0x524d95[_0xfac0('0xc')];var _0x353109=_0x4b1660[_0xfac0('0xd')]({'plain':!![]});if(_0x353109[_0xfac0('0xe')]['toLowerCase']()==='in'||_0x353109[_0xfac0('0xe')][_0xfac0('0xf')]()===_0xfac0('0x10')&&!_0x353109[_0xfac0('0x11')]&&!_[_0xfac0('0x12')](_0x353109[_0xfac0('0x13')])){_0x3e1b47[_0xfac0('0x14')][_0xfac0('0x15')]({'where':{'id':_0x353109['WhatsappInteractionId']}})[_0xfac0('0x16')](function(_0x54a82f){if(_0x54a82f){_0x54a82f[_0xfac0('0x17')]({'lastMsgAt':_0x353109['createdAt'],'lastMsgDirection':_0x353109['direction'][_0xfac0('0xf')]()});}})[_0xfac0('0x18')](function(_0x52b259){console[_0xfac0('0x19')](_0x52b259);});}if(_0x353109['direction']===_0xfac0('0x10')&&!_0x353109[_0xfac0('0x11')]){var _0x209e45;_0x3e1b47['WhatsappAccount']['find']({'where':{'id':_0x353109[_0xfac0('0x1a')]},'raw':!![]})[_0xfac0('0x16')](function(_0x20f7e6){_0x209e45=_0x20f7e6;if(_0x209e45&&_0x209e45['type']){switch(_0x209e45[_0xfac0('0x1b')]){case _0xfac0('0x1c'):var _0xd05743=require('twilio');if(_0x209e45[_0xfac0('0x1d')]&&_0x209e45['authToken']&&_0x209e45['phone']){var _0x9695f4=new _0xd05743(_0x209e45[_0xfac0('0x1d')],_0x209e45[_0xfac0('0x1e')]);_0x9695f4[_0xfac0('0x1f')][_0xfac0('0x20')]({'body':_0x353109[_0xfac0('0x21')],'to':_0xfac0('0x22')+_0x353109[_0xfac0('0x23')],'from':_0xfac0('0x22')+_0x209e45[_0xfac0('0x23')],'statusCallback':_0x209e45[_0xfac0('0x24')]+_0xfac0('0x25')+_0x353109['id']+_0xfac0('0x26')+_0x209e45['token']})[_0xfac0('0x16')](function(_0x3c1ba8){if(_0x3c1ba8[_0xfac0('0x27')]){return _0x4b1660[_0xfac0('0x17')]({'messageId':_0x3c1ba8['sid']});}})[_0xfac0('0x18')](function(_0x1c62e8){logger[_0xfac0('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfac0('0x28'),'twilio',util[_0xfac0('0x29')](_0x1c62e8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfac0('0x2a'),_0xfac0('0x28'),_0xfac0('0x1c'),_0xfac0('0x2b'));}break;case _0xfac0('0x2c'):var _0x413fd9=_0x209e45[_0xfac0('0x1d')];var _0x2c2d02=_0x209e45[_0xfac0('0x1e')];var _0x3ff959=_0x209e45['baseUrl']+_0xfac0('0x2d')+_0x413fd9+_0xfac0('0x2e');var _0x137ca9={'to':[_0x353109[_0xfac0('0x23')]],'message':{'type':'text','text':_0x353109['body']}};var _0x4ca5a2={'method':_0xfac0('0x2f'),'uri':_0x3ff959,'headers':{'Authorization':'Bearer\x20'+_0x2c2d02,'Content-Type':_0xfac0('0x30')},'body':_0x137ca9,'json':!![]};rp(_0x4ca5a2)[_0xfac0('0x16')](function(_0x5dddc6){if(_0x5dddc6['statuses'][0x0][_0xfac0('0x31')]){return _0x4b1660[_0xfac0('0x17')]({'messageId':_0x5dddc6[_0xfac0('0x32')][0x0][_0xfac0('0x31')]});}})[_0xfac0('0x18')](function(_0xe44a94){logger['err']('WhatsappMessage,\x20%s',_0xe44a94);});break;}}})[_0xfac0('0x33')](function(){_0x8ae761();});}else{_0x8ae761();}}},'charset':_0xfac0('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 73fe018..c51b939 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 _0x3231=['./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','socket.io-emitter'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x3231,0x1a8));var _0x1323=function(_0x2d4e9a,_0x3634c7){_0x2d4e9a=_0x2d4e9a-0x0;var _0x43f80a=_0x3231[_0x2d4e9a];return _0x43f80a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1323('0x0'));var BPromise=require(_0x1323('0x1'));var rs=require(_0x1323('0x2'));var fs=require('fs');var Redis=require(_0x1323('0x3'));var db=require(_0x1323('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1323('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1323('0x6')][_0x1323('0x7')]({'port':0x232a});config[_0x1323('0x8')]=_[_0x1323('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1323('0xa'))(new Redis(config[_0x1323('0x8')]));require(_0x1323('0xb'))['register'](socket);function respondWithRpcPromise(_0x5de004,_0x4969bb,_0x587883){return new BPromise(function(_0x517697,_0x11ed49){return client['request'](_0x5de004,_0x587883)[_0x1323('0xc')](function(_0x46bd89){logger[_0x1323('0xd')](_0x1323('0xe'),_0x4969bb,'request\x20sent');logger[_0x1323('0xf')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4969bb,'request\x20sent',JSON[_0x1323('0x10')](_0x46bd89));if(_0x46bd89[_0x1323('0x11')]){if(_0x46bd89['error'][_0x1323('0x12')]===0x1f4){logger[_0x1323('0x11')](_0x1323('0xe'),_0x4969bb,_0x46bd89[_0x1323('0x11')][_0x1323('0x13')]);return _0x11ed49(_0x46bd89[_0x1323('0x11')][_0x1323('0x13')]);}logger[_0x1323('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x4969bb,_0x46bd89[_0x1323('0x11')]['message']);return _0x517697(_0x46bd89[_0x1323('0x11')]['message']);}else{logger[_0x1323('0xd')](_0x1323('0xe'),_0x4969bb,_0x1323('0x14'));_0x517697(_0x46bd89[_0x1323('0x15')][_0x1323('0x13')]);}})[_0x1323('0x16')](function(_0x384da3){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4969bb,_0x384da3);_0x11ed49(_0x384da3);});});}exports[_0x1323('0x17')]=function(_0x5eecf4){var _0x2a200e=this;return new Promise(function(_0x394ddf,_0x51b0de){return db[_0x1323('0x18')][_0x1323('0x19')](_0x5eecf4[_0x1323('0x1a')],{'raw':_0x5eecf4['options']?_0x5eecf4[_0x1323('0x1b')][_0x1323('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x50a6f1){logger[_0x1323('0xd')]('CreateWhatsappMessage',_0x5eecf4);logger[_0x1323('0xf')](_0x1323('0x17'),_0x5eecf4,JSON[_0x1323('0x10')](_0x50a6f1));_0x394ddf(_0x50a6f1);})[_0x1323('0x16')](function(_0x48197c){logger[_0x1323('0x11')]('CreateWhatsappMessage',_0x48197c[_0x1323('0x13')],_0x5eecf4);_0x51b0de(_0x2a200e[_0x1323('0x11')](0x1f4,_0x48197c[_0x1323('0x13')]));});});}; \ No newline at end of file +var _0x56a6=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x56a6,0x137));var _0x656a=function(_0x38fb3a,_0x3a7c6b){_0x38fb3a=_0x38fb3a-0x0;var _0x2f5ef0=_0x56a6[_0x38fb3a];return _0x2f5ef0;};'use strict';var _=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var moment=require(_0x656a('0x2'));var BPromise=require('bluebird');var rs=require(_0x656a('0x3'));var fs=require('fs');var Redis=require(_0x656a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x656a('0x5'));var logger=require('../../config/logger')(_0x656a('0x6'));var config=require(_0x656a('0x7'));var jayson=require(_0x656a('0x8'));var client=jayson['client'][_0x656a('0x9')]({'port':0x232a});config[_0x656a('0xa')]=_[_0x656a('0xb')](config[_0x656a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x656a('0xc'))(new Redis(config[_0x656a('0xa')]));require(_0x656a('0xd'))[_0x656a('0xe')](socket);function respondWithRpcPromise(_0x13175b,_0x5bd152,_0x169a26){return new BPromise(function(_0x19b912,_0x51a195){return client[_0x656a('0xf')](_0x13175b,_0x169a26)[_0x656a('0x10')](function(_0x8a9fce){logger[_0x656a('0x11')](_0x656a('0x12'),_0x5bd152,_0x656a('0x13'));logger[_0x656a('0x14')](_0x656a('0x15'),_0x5bd152,_0x656a('0x13'),JSON[_0x656a('0x16')](_0x8a9fce));if(_0x8a9fce[_0x656a('0x17')]){if(_0x8a9fce[_0x656a('0x17')]['code']===0x1f4){logger['error'](_0x656a('0x12'),_0x5bd152,_0x8a9fce['error'][_0x656a('0x18')]);return _0x51a195(_0x8a9fce[_0x656a('0x17')][_0x656a('0x18')]);}logger[_0x656a('0x17')](_0x656a('0x12'),_0x5bd152,_0x8a9fce[_0x656a('0x17')][_0x656a('0x18')]);return _0x19b912(_0x8a9fce[_0x656a('0x17')][_0x656a('0x18')]);}else{logger[_0x656a('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x5bd152,_0x656a('0x13'));_0x19b912(_0x8a9fce[_0x656a('0x19')][_0x656a('0x18')]);}})[_0x656a('0x1a')](function(_0x10d062){logger[_0x656a('0x17')](_0x656a('0x12'),_0x5bd152,_0x10d062);_0x51a195(_0x10d062);});});}exports[_0x656a('0x1b')]=function(_0x3a3d8c){var _0x36b9e7=this;return new Promise(function(_0x4b9e85,_0x524bc0){return db[_0x656a('0x1c')]['create'](_0x3a3d8c[_0x656a('0x1d')],{'raw':_0x3a3d8c['options']?_0x3a3d8c['options']['raw']===undefined?!![]:![]:!![]})[_0x656a('0x10')](function(_0xc9d577){logger['info']('CreateWhatsappMessage',_0x3a3d8c);logger[_0x656a('0x14')](_0x656a('0x1b'),_0x3a3d8c,JSON[_0x656a('0x16')](_0xc9d577));_0x4b9e85(_0xc9d577);})['catch'](function(_0x14ce83){logger[_0x656a('0x17')](_0x656a('0x1b'),_0x14ce83[_0x656a('0x18')],_0x3a3d8c);_0x524bc0(_0x36b9e7[_0x656a('0x17')](0x1f4,_0x14ce83[_0x656a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5ab9af9..a9b0c71 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 _0x5005=['remove','update','emit','removeListener','register','length','./whatsappMessage.events','save'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5005,0x6e));var _0x5500=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x5005[_0xe73080];return _0x12cbc4;};'use strict';var WhatsappMessageEvents=require(_0x5500('0x0'));var events=[_0x5500('0x1'),_0x5500('0x2'),_0x5500('0x3')];function createListener(_0x19602d,_0x2deb43){return function(_0x2a454f){_0x2deb43[_0x5500('0x4')](_0x19602d,_0x2a454f);};}function removeListener(_0x1525f9,_0x32a1e3){return function(){WhatsappMessageEvents[_0x5500('0x5')](_0x1525f9,_0x32a1e3);};}exports[_0x5500('0x6')]=function(_0x2c9175){for(var _0x4c3e84=0x0,_0x215b02=events[_0x5500('0x7')];_0x4c3e84<_0x215b02;_0x4c3e84++){var _0x56e614=events[_0x4c3e84];var _0x5e8bf7=createListener('whatsappMessage:'+_0x56e614,_0x2c9175);WhatsappMessageEvents['on'](_0x56e614,_0x5e8bf7);}}; \ No newline at end of file +var _0xaefd=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','emit'];(function(_0x1d7973,_0x357676){var _0x43190c=function(_0x4dd797){while(--_0x4dd797){_0x1d7973['push'](_0x1d7973['shift']());}};_0x43190c(++_0x357676);}(_0xaefd,0x1b4));var _0xdaef=function(_0x3e7f40,_0x49389b){_0x3e7f40=_0x3e7f40-0x0;var _0x9a9a1f=_0xaefd[_0x3e7f40];return _0x9a9a1f;};'use strict';var WhatsappMessageEvents=require(_0xdaef('0x0'));var events=[_0xdaef('0x1'),_0xdaef('0x2'),'update'];function createListener(_0x2df95c,_0x411342){return function(_0x39be97){_0x411342[_0xdaef('0x3')](_0x2df95c,_0x39be97);};}function removeListener(_0x2a75e9,_0x199b46){return function(){WhatsappMessageEvents[_0xdaef('0x4')](_0x2a75e9,_0x199b46);};}exports[_0xdaef('0x5')]=function(_0x175e5b){for(var _0xc156a5=0x0,_0x10bae5=events[_0xdaef('0x6')];_0xc156a5<_0x10bae5;_0xc156a5++){var _0x5a8771=events[_0xc156a5];var _0x46053d=createListener(_0xdaef('0x7')+_0x5a8771,_0x175e5b);WhatsappMessageEvents['on'](_0x5a8771,_0x46053d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ca9a202..10c947d 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 _0xd065=['index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated'];(function(_0x4371a7,_0x4809b5){var _0x3cc574=function(_0x5e168d){while(--_0x5e168d){_0x4371a7['push'](_0x4371a7['shift']());}};_0x3cc574(++_0x4809b5);}(_0xd065,0xe2));var _0x5d06=function(_0x2be691,_0x52eb65){_0x2be691=_0x2be691-0x0;var _0x3dcdae=_0xd065[_0x2be691];return _0x3dcdae;};'use strict';var multer=require(_0x5d06('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d06('0x1')]();var fs_extra=require(_0x5d06('0x2'));var auth=require(_0x5d06('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5d06('0x4'));var controller=require(_0x5d06('0x5'));router[_0x5d06('0x6')]('/',auth[_0x5d06('0x7')](),controller[_0x5d06('0x8')]);router[_0x5d06('0x6')](_0x5d06('0x9'),auth[_0x5d06('0x7')](),controller['describe']);router[_0x5d06('0x6')](_0x5d06('0xa'),auth[_0x5d06('0x7')](),controller['show']);router['get'](_0x5d06('0xb'),auth[_0x5d06('0x7')](),controller[_0x5d06('0xc')]);router[_0x5d06('0x6')](_0x5d06('0xd'),auth['isAuthenticated'](),controller[_0x5d06('0xe')]);router[_0x5d06('0x6')]('/:id/users',auth[_0x5d06('0x7')](),controller[_0x5d06('0xf')]);router[_0x5d06('0x10')]('/',auth[_0x5d06('0x7')](),controller['create']);router['post'](_0x5d06('0xd'),auth['isAuthenticated'](),controller[_0x5d06('0x11')]);router['post'](_0x5d06('0x12'),auth[_0x5d06('0x7')](),controller[_0x5d06('0x13')]);router[_0x5d06('0x14')](_0x5d06('0xa'),auth[_0x5d06('0x7')](),controller['update']);router[_0x5d06('0x15')](_0x5d06('0xa'),auth[_0x5d06('0x7')](),controller[_0x5d06('0x16')]);router[_0x5d06('0x15')](_0x5d06('0xd'),auth[_0x5d06('0x7')](),controller[_0x5d06('0x17')]);router[_0x5d06('0x15')](_0x5d06('0x12'),auth['isAuthenticated'](),controller[_0x5d06('0x18')]);module[_0x5d06('0x19')]=router; \ No newline at end of file +var _0x530a=['/:id','/:id/members','getTeams','getAgents','post','create','/:id/teams','put','update','destroy','delete','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x530a,0xed));var _0xa530=function(_0x53e09d,_0xc2e39){_0x53e09d=_0x53e09d-0x0;var _0x3111bb=_0x530a[_0x53e09d];return _0x3111bb;};'use strict';var multer=require(_0xa530('0x0'));var util=require(_0xa530('0x1'));var path=require(_0xa530('0x2'));var timeout=require(_0xa530('0x3'));var express=require('express');var router=express[_0xa530('0x4')]();var fs_extra=require(_0xa530('0x5'));var auth=require(_0xa530('0x6'));var interaction=require(_0xa530('0x7'));var config=require(_0xa530('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa530('0x9')]);router['get']('/describe',auth[_0xa530('0xa')](),controller[_0xa530('0xb')]);router[_0xa530('0xc')](_0xa530('0xd'),auth[_0xa530('0xa')](),controller['show']);router[_0xa530('0xc')](_0xa530('0xe'),auth[_0xa530('0xa')](),controller['getMembers']);router[_0xa530('0xc')]('/:id/teams',auth[_0xa530('0xa')](),controller[_0xa530('0xf')]);router[_0xa530('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0xa530('0x10')]);router[_0xa530('0x11')]('/',auth['isAuthenticated'](),controller[_0xa530('0x12')]);router[_0xa530('0x11')](_0xa530('0x13'),auth[_0xa530('0xa')](),controller['addTeams']);router[_0xa530('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xa530('0x14')](_0xa530('0xd'),auth[_0xa530('0xa')](),controller[_0xa530('0x15')]);router['delete']('/:id',auth[_0xa530('0xa')](),controller[_0xa530('0x16')]);router[_0xa530('0x17')](_0xa530('0x13'),auth[_0xa530('0xa')](),controller[_0xa530('0x18')]);router[_0xa530('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index bc37245..ba8875b 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 _0x9bde=['STRING','exports','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x427887,_0x4a37af){var _0x1b4a8b=function(_0x3ccb6d){while(--_0x3ccb6d){_0x427887['push'](_0x427887['shift']());}};_0x1b4a8b(++_0x4a37af);}(_0x9bde,0xe1));var _0xe9bd=function(_0x208a25,_0x37fc04){_0x208a25=_0x208a25-0x0;var _0x1bf66c=_0x9bde[_0x208a25];return _0x1bf66c;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe9bd('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe9bd('0x2')](_0xe9bd('0x3'),_0xe9bd('0x4'),_0xe9bd('0x5'))},'description':{'type':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x76dc=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x76dc,0x1f2));var _0xc76d=function(_0x3b18a1,_0x44053c){_0x3b18a1=_0x3b18a1-0x0;var _0x39079a=_0x76dc[_0x3b18a1];return _0x39079a;};'use strict';var Sequelize=require(_0xc76d('0x0'));module[_0xc76d('0x1')]={'name':{'type':Sequelize[_0xc76d('0x2')],'unique':_0xc76d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc76d('0x4')](_0xc76d('0x5'),'beepall',_0xc76d('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9f1cc1d..de55459 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 _0xc8ea=['ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','limit','undefined','count','Content-Range','json','then','destroy','get','UserProfileResource','end','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','find','create','body','user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','order','sort','filter','UserWhatsappQueue','User','map','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','length','pick','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','transaction','emit','userWhatsappQueue:remove','addAgents','omit','removeAgents','getAgents','nolimit','bluebird','util','lodash','squel'];(function(_0x4df59d,_0x5dad3f){var _0x54a175=function(_0x13eb25){while(--_0x13eb25){_0x4df59d['push'](_0x4df59d['shift']());}};_0x54a175(++_0x5dad3f);}(_0xc8ea,0x15b));var _0xac8e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xc8ea[_0x373dee];return _0x46798f;};'use strict';var BPromise=require(_0xac8e('0x0'));var util=require(_0xac8e('0x1'));var _=require(_0xac8e('0x2'));var squel=require(_0xac8e('0x3'));var Redis=require(_0xac8e('0x4'));var qs=require(_0xac8e('0x5'));var logger=require(_0xac8e('0x6'))('api');var config=require(_0xac8e('0x7'));var db=require('../../mysqldb')['db'];config[_0xac8e('0x8')]=_[_0xac8e('0x9')](config[_0xac8e('0x8')],{'host':_0xac8e('0xa'),'port':0x18eb});var socket=require(_0xac8e('0xb'))(new Redis(config[_0xac8e('0x8')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x5dee8e,_0x2d057d){_0x2d057d=_0x2d057d||0xcc;return function(_0x241526){if(_0x241526){return _0x5dee8e[_0xac8e('0xc')](_0x2d057d);}return _0x5dee8e[_0xac8e('0xd')](_0x2d057d)['end']();};}function respondWithResult(_0x15c7c6,_0x37de79){_0x37de79=_0x37de79||0xc8;return function(_0x50c302){if(_0x50c302){return _0x15c7c6['status'](_0x37de79)['json'](_0x50c302);}};}function respondWithFilteredResult(_0xadbb2c,_0x3c6a24){return function(_0x22e120){if(_0x22e120){var _0x5b7ca2=typeof _0x3c6a24[_0xac8e('0xe')]==='undefined'&&typeof _0x3c6a24[_0xac8e('0xf')]===_0xac8e('0x10');var _0x4fcdd6=_0x22e120['count'];var _0x3bc8aa=_0x5b7ca2?0x0:_0x3c6a24['offset'];var _0xd2e637=_0x5b7ca2?_0x22e120[_0xac8e('0x11')]:_0x3c6a24[_0xac8e('0xe')]+_0x3c6a24[_0xac8e('0xf')];var _0x241529;if(_0xd2e637>=_0x4fcdd6){_0xd2e637=_0x4fcdd6;_0x241529=0xc8;}else{_0x241529=0xce;}_0xadbb2c[_0xac8e('0xd')](_0x241529);return _0xadbb2c['set'](_0xac8e('0x12'),_0x3bc8aa+'-'+_0xd2e637+'/'+_0x4fcdd6)[_0xac8e('0x13')](_0x22e120);}return null;};}function saveUpdates(_0x1e753f){return function(_0x458dcc){if(_0x458dcc){return _0x458dcc['update'](_0x1e753f)[_0xac8e('0x14')](function(_0x3c3412){return _0x3c3412;});}return null;};}function removeEntity(_0x3a479c){return function(_0x2a33c3){if(_0x2a33c3){return _0x2a33c3[_0xac8e('0x15')]()[_0xac8e('0x14')](function(){var _0x33b173=_0x2a33c3[_0xac8e('0x16')]({'plain':!![]});var _0x3b8d1f='WhatsappQueues';return db[_0xac8e('0x17')][_0xac8e('0x15')]({'where':{'type':_0x3b8d1f,'resourceId':_0x33b173['id']}})[_0xac8e('0x14')](function(){return _0x2a33c3;});})[_0xac8e('0x14')](function(){_0x3a479c[_0xac8e('0xd')](0xcc)[_0xac8e('0x18')]();});}};}function handleEntityNotFound(_0x6e91ee){return function(_0x587324){if(!_0x587324){_0x6e91ee[_0xac8e('0xc')](0x194);}return _0x587324;};}function handleError(_0x110073,_0x26ffd8){_0x26ffd8=_0x26ffd8||0x1f4;return function(_0x1c2d3f){logger[_0xac8e('0x19')](_0x1c2d3f['stack']);if(_0x1c2d3f[_0xac8e('0x1a')]){delete _0x1c2d3f[_0xac8e('0x1a')];}_0x110073[_0xac8e('0xd')](_0x26ffd8)[_0xac8e('0x1b')](_0x1c2d3f);};}exports[_0xac8e('0x1c')]=function(_0x15f633,_0x98cd5){var _0x4d0f7c={};var _0x33a5c7={'count':0x0,'rows':[]};var _0x31a054=_['map'](db[_0xac8e('0x1d')][_0xac8e('0x1e')],function(_0x250aa7){return{'name':_0x250aa7[_0xac8e('0x1f')],'type':_0x250aa7[_0xac8e('0x20')][_0xac8e('0x21')]};});_0x4d0f7c=qs[_0xac8e('0x22')](_0x31a054,_0x15f633);var _0x480bc1={'where':_0x4d0f7c[_0xac8e('0x23')]};return db[_0xac8e('0x1d')]['count'](_0x480bc1)['then'](function(_0x1fc606){_0x33a5c7[_0xac8e('0x11')]=_0x1fc606;_0x4d0f7c['include']=qs[_0xac8e('0x24')](_0x15f633[_0xac8e('0x25')]);return db[_0xac8e('0x1d')][_0xac8e('0x26')](_0x4d0f7c);})[_0xac8e('0x14')](function(_0x232bb4){_0x33a5c7[_0xac8e('0x27')]=_0x232bb4;return _0x33a5c7;})[_0xac8e('0x14')](respondWithFilteredResult(_0x98cd5,_0x4d0f7c))[_0xac8e('0x28')](handleError(_0x98cd5,null));};exports[_0xac8e('0x29')]=function(_0x1084dd,_0x216a6f){var _0x2bf640={'raw':!![],'where':{'id':_0x1084dd[_0xac8e('0x2a')]['id']}},_0x266094={};_0x266094['model']=_[_0xac8e('0x2b')](db[_0xac8e('0x1d')][_0xac8e('0x1e')]);_0x266094['query']=_['keys'](_0x1084dd[_0xac8e('0x25')]);_0x266094[_0xac8e('0x2c')]=_[_0xac8e('0x2d')](_0x266094[_0xac8e('0x2e')],_0x266094[_0xac8e('0x25')]);_0x2bf640[_0xac8e('0x2f')]=_[_0xac8e('0x2d')](_0x266094['model'],qs[_0xac8e('0x30')](_0x1084dd[_0xac8e('0x25')][_0xac8e('0x30')]));_0x2bf640['attributes']=_0x2bf640[_0xac8e('0x2f')]['length']?_0x2bf640[_0xac8e('0x2f')]:_0x266094[_0xac8e('0x2e')];if(_0x1084dd[_0xac8e('0x25')][_0xac8e('0x31')]){_0x2bf640[_0xac8e('0x24')]=[{'all':!![]}];}_0x2bf640=_[_0xac8e('0x32')]({},_0x2bf640,_0x1084dd[_0xac8e('0x33')]);return db[_0xac8e('0x1d')][_0xac8e('0x34')](_0x2bf640)[_0xac8e('0x14')](handleEntityNotFound(_0x216a6f,null))[_0xac8e('0x14')](respondWithResult(_0x216a6f,null))[_0xac8e('0x28')](handleError(_0x216a6f,null));};exports['create']=function(_0x290ccb,_0x49e120){return db[_0xac8e('0x1d')][_0xac8e('0x35')](_0x290ccb[_0xac8e('0x36')],{})[_0xac8e('0x14')](function(_0x2e1364){var _0x16a067=_0x290ccb[_0xac8e('0x37')]['get']({'plain':!![]});if(!_0x16a067)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16a067['role']===_0xac8e('0x37')){var _0x46d503=_0x2e1364[_0xac8e('0x16')]({'plain':!![]});var _0x500313=_0xac8e('0x38');return db[_0xac8e('0x39')][_0xac8e('0x34')]({'where':{'name':_0x500313,'userProfileId':_0x16a067[_0xac8e('0x3a')]},'raw':!![]})[_0xac8e('0x14')](function(_0x51f275){if(_0x51f275&&_0x51f275[_0xac8e('0x3b')]===0x0){return db[_0xac8e('0x17')][_0xac8e('0x35')]({'name':_0x46d503[_0xac8e('0x1a')],'resourceId':_0x46d503['id'],'type':_0x51f275[_0xac8e('0x1a')],'sectionId':_0x51f275['id']},{})[_0xac8e('0x14')](function(){return _0x2e1364;});}else{return _0x2e1364;}})[_0xac8e('0x28')](function(_0x178680){logger[_0xac8e('0x19')](_0xac8e('0x3c'),_0x178680);throw _0x178680;});}return _0x2e1364;})[_0xac8e('0x14')](respondWithResult(_0x49e120,0xc9))[_0xac8e('0x28')](handleError(_0x49e120,null));};exports[_0xac8e('0x3d')]=function(_0x23bbf2,_0x3257f7){if(_0x23bbf2['body']['id']){delete _0x23bbf2[_0xac8e('0x36')]['id'];}return db[_0xac8e('0x1d')]['find']({'where':{'id':_0x23bbf2[_0xac8e('0x2a')]['id']}})[_0xac8e('0x14')](handleEntityNotFound(_0x3257f7,null))[_0xac8e('0x14')](saveUpdates(_0x23bbf2[_0xac8e('0x36')],null))[_0xac8e('0x14')](respondWithResult(_0x3257f7,null))[_0xac8e('0x28')](handleError(_0x3257f7,null));};exports[_0xac8e('0x15')]=function(_0x1c6c35,_0x1b8961){return db['WhatsappQueue'][_0xac8e('0x34')]({'where':{'id':_0x1c6c35[_0xac8e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1b8961,null))[_0xac8e('0x14')](removeEntity(_0x1b8961,null))['catch'](handleError(_0x1b8961,null));};exports['describe']=function(_0x398c84,_0x152727){return db[_0xac8e('0x1d')][_0xac8e('0x3e')]()[_0xac8e('0x14')](respondWithResult(_0x152727,null))['catch'](handleError(_0x152727,null));};exports[_0xac8e('0x3f')]=function(_0x5641d1,_0x456130){var _0x59ea3d={'raw':!![],'where':{}},_0x552f5d={},_0x4832e8;return db[_0xac8e('0x1d')][_0xac8e('0x40')]({'where':{'id':_0x5641d1[_0xac8e('0x2a')]['id']}})[_0xac8e('0x14')](handleEntityNotFound(_0x456130,null))[_0xac8e('0x14')](function(_0x2fb7b3){if(_0x2fb7b3){_0x4832e8=_0x2fb7b3[_0xac8e('0x16')]({'plain':!![]});_0x552f5d['model']=_[_0xac8e('0x2b')](db['UserWhatsappQueue'][_0xac8e('0x1e')]);_0x552f5d[_0xac8e('0x25')]=_[_0xac8e('0x2b')](_0x5641d1['query']);_0x552f5d[_0xac8e('0x2c')]=_[_0xac8e('0x2d')](_0x552f5d[_0xac8e('0x2e')],_0x552f5d[_0xac8e('0x25')]);_0x59ea3d[_0xac8e('0x2f')]=_['intersection'](_0x552f5d[_0xac8e('0x2e')],qs[_0xac8e('0x30')](_0x5641d1[_0xac8e('0x25')][_0xac8e('0x30')]));_0x59ea3d['attributes']=_0x59ea3d[_0xac8e('0x2f')]['length']?_0x59ea3d[_0xac8e('0x2f')]:_0x552f5d['model'];if(!_0x5641d1[_0xac8e('0x25')][_0xac8e('0x41')]('nolimit')){_0x59ea3d['limit']=qs[_0xac8e('0xf')](_0x5641d1[_0xac8e('0x25')]['limit']);_0x59ea3d[_0xac8e('0xe')]=qs[_0xac8e('0xe')](_0x5641d1[_0xac8e('0x25')]['offset']);}_0x59ea3d[_0xac8e('0x42')]=qs['sort'](_0x5641d1[_0xac8e('0x25')][_0xac8e('0x43')]);_0x59ea3d['where']=qs['filters'](_['pick'](_0x5641d1[_0xac8e('0x25')],_0x552f5d[_0xac8e('0x2c')]));_0x59ea3d['where']['WhatsappQueueId']=_0x2fb7b3['id'];if(_0x5641d1[_0xac8e('0x25')][_0xac8e('0x44')]){_0x59ea3d[_0xac8e('0x23')]=_['merge'](_0x59ea3d[_0xac8e('0x23')],{'$or':_['map'](_0x59ea3d[_0xac8e('0x2f')],function(_0x1dea14){var _0x17822b={};_0x17822b[_0x1dea14]={'$like':'%'+_0x5641d1[_0xac8e('0x25')][_0xac8e('0x44')]+'%'};return _0x17822b;})});}_0x59ea3d=_[_0xac8e('0x32')]({},_0x59ea3d,_0x5641d1[_0xac8e('0x33')]);return db[_0xac8e('0x45')][_0xac8e('0x26')](_0x59ea3d);}})[_0xac8e('0x14')](function(_0x12f25e){if(_0x12f25e){return db[_0xac8e('0x46')]['findAndCountAll']({'where':{'id':_[_0xac8e('0x47')](_0x12f25e,_0xac8e('0x48')),'role':_0xac8e('0x49')},'attributes':['id',_0xac8e('0x1a'),_0xac8e('0x4a'),_0xac8e('0x4b'),_0xac8e('0x4c')]});}})[_0xac8e('0x14')](function(_0x2b81ee){if(_0x2b81ee){return{'count':_0x2b81ee[_0xac8e('0x11')],'rows':_['map'](_0x2b81ee[_0xac8e('0x27')],function(_0x22a4ba){return{'membername':_0x22a4ba['name'],'UserId':_0x22a4ba['id'],'queue_name':_0x4832e8['name'],'WhatsappQueueId':_0x4832e8['id'],'interface':util[_0xac8e('0x4d')](_0xac8e('0x4e'),'SIP',_0x22a4ba[_0xac8e('0x1a')]),'penalty':0x0,'paused':_0x22a4ba[_0xac8e('0x4a')],'createdAt':_0x22a4ba['createdAt'],'updatedAt':_0x22a4ba[_0xac8e('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xac8e('0x14')](respondWithFilteredResult(_0x456130,_0x59ea3d))[_0xac8e('0x28')](handleError(_0x456130,null));};exports[_0xac8e('0x4f')]=function(_0x1ad507,_0x182fa3){var _0x1d1d4c={};var _0x4fc546={};var _0x4d5e0c;var _0x1cbfb7;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1ad507[_0xac8e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x182fa3,null))[_0xac8e('0x14')](function(_0x45ad27){if(_0x45ad27){_0x4d5e0c=_0x45ad27;_0x4fc546[_0xac8e('0x2e')]=_[_0xac8e('0x2b')](db[_0xac8e('0x50')][_0xac8e('0x1e')]);_0x4fc546[_0xac8e('0x25')]=_[_0xac8e('0x2b')](_0x1ad507[_0xac8e('0x25')]);_0x4fc546[_0xac8e('0x2c')]=_[_0xac8e('0x2d')](_0x4fc546[_0xac8e('0x2e')],_0x4fc546[_0xac8e('0x25')]);_0x1d1d4c[_0xac8e('0x2f')]=_[_0xac8e('0x2d')](_0x4fc546['model'],qs[_0xac8e('0x30')](_0x1ad507['query']['fields']));_0x1d1d4c[_0xac8e('0x2f')]=_0x1d1d4c[_0xac8e('0x2f')][_0xac8e('0x51')]?_0x1d1d4c['attributes']:_0x4fc546[_0xac8e('0x2e')];_0x1d1d4c[_0xac8e('0x42')]=qs[_0xac8e('0x43')](_0x1ad507['query'][_0xac8e('0x43')]);_0x1d1d4c['where']=qs[_0xac8e('0x2c')](_[_0xac8e('0x52')](_0x1ad507[_0xac8e('0x25')],_0x4fc546[_0xac8e('0x2c')]));if(_0x1ad507[_0xac8e('0x25')]['filter']){_0x1d1d4c[_0xac8e('0x23')]=_[_0xac8e('0x32')](_0x1d1d4c[_0xac8e('0x23')],{'$or':_[_0xac8e('0x47')](_0x1d1d4c[_0xac8e('0x2f')],function(_0x33e186){var _0x404a82={};_0x404a82[_0x33e186]={'$like':'%'+_0x1ad507[_0xac8e('0x25')][_0xac8e('0x44')]+'%'};return _0x404a82;})});}_0x1d1d4c=_[_0xac8e('0x32')]({},_0x1d1d4c,_0x1ad507[_0xac8e('0x33')]);return _0x4d5e0c[_0xac8e('0x4f')](_0x1d1d4c);}})[_0xac8e('0x14')](function(_0x58ed7d){if(_0x58ed7d){_0x1cbfb7=_0x58ed7d['length'];if(!_0x1ad507[_0xac8e('0x25')]['hasOwnProperty']('nolimit')){_0x1d1d4c['limit']=qs['limit'](_0x1ad507[_0xac8e('0x25')][_0xac8e('0xf')]);_0x1d1d4c[_0xac8e('0xe')]=qs['offset'](_0x1ad507[_0xac8e('0x25')][_0xac8e('0xe')]);}return _0x4d5e0c[_0xac8e('0x4f')](_0x1d1d4c);}})['then'](function(_0x49e14e){if(_0x49e14e){return _0x49e14e?{'count':_0x1cbfb7,'rows':_0x49e14e}:null;}})[_0xac8e('0x14')](respondWithResult(_0x182fa3,null))['catch'](handleError(_0x182fa3,null));};exports[_0xac8e('0x53')]=function(_0x6a3ddd,_0xe38621){var _0x31e84a=_0x6a3ddd[_0xac8e('0x36')][_0xac8e('0x54')];return db['Team'][_0xac8e('0x26')]({'where':{'id':_0x31e84a},'attributes':['id'],'include':[{'model':db[_0xac8e('0x46')],'as':_0xac8e('0x55'),'attributes':['id',_0xac8e('0x1a'),'online',_0xac8e('0x56'),_0xac8e('0x57')],'raw':!![]}]})[_0xac8e('0x14')](function(_0x131529){if(_0x131529){var _0x3ed16d=_[_0xac8e('0x58')](_0x131529,function(_0x20a706){var _0x702c9f=_0x20a706[_0xac8e('0x16')]({'plain':!![]});return _0x702c9f[_0xac8e('0x55')];});return db[_0xac8e('0x1d')]['find']({'where':{'id':_0x6a3ddd[_0xac8e('0x2a')]['id']}})['then'](function(_0x369430){return db[_0xac8e('0x59')]['transaction'](function(_0x40be45){return _0x369430[_0xac8e('0x53')](_0x31e84a,{'transaction':_0x40be45})[_0xac8e('0x14')](function(){return BPromise['each'](_0x3ed16d,function(_0x5c791e){return db[_0xac8e('0x45')][_0xac8e('0x5a')]({'where':{'UserId':_0x5c791e['id'],'WhatsappQueueId':_0x6a3ddd[_0xac8e('0x2a')]['id']},'transaction':_0x40be45});});})[_0xac8e('0x14')](function(){_0x3ed16d[_0xac8e('0x5b')](function(_0x1afc11){socket['emit'](_0xac8e('0x5c'),{'UserId':_0x1afc11['id'],'WhatsappQueueId':_0x369430['id']});});});});});}})[_0xac8e('0x14')](respondWithStatusCode(_0xe38621,null))[_0xac8e('0x28')](handleError(_0xe38621,null));};exports[_0xac8e('0x5d')]=function(_0x13b1f1,_0x3bc835){return db[_0xac8e('0x50')][_0xac8e('0x26')]({'where':{'id':_0x13b1f1[_0xac8e('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0xac8e('0x46')],'as':_0xac8e('0x55'),'attributes':['id'],'raw':!![]}]})[_0xac8e('0x14')](handleEntityNotFound(_0x3bc835,null))[_0xac8e('0x14')](function(_0x3196f1){var _0x944193=_[_0xac8e('0x47')](_0x3196f1,'id');var _0x28a60e=[];var _0x533332=[];var _0x250103=squel[_0xac8e('0x5e')]();_0x250103['field'](_0xac8e('0x5f'))[_0xac8e('0x60')]('team_has_whatsapp_queues','tq')[_0xac8e('0x61')]('user_has_teams','ut',_0xac8e('0x62'))[_0xac8e('0x23')](_0xac8e('0x63'),_0x13b1f1[_0xac8e('0x2a')]['id']);for(var _0x40f4c6=0x0;_0x40f4c6<_0x3196f1[_0xac8e('0x51')];_0x40f4c6+=0x1){let _0x262004=_0x3196f1[_0x40f4c6];for(var _0xd63fa8=0x0;_0xd63fa8<_0x262004[_0xac8e('0x55')][_0xac8e('0x51')];_0xd63fa8+=0x1){let _0x54effd=_0x262004[_0xac8e('0x55')][_0xd63fa8];var _0x7839f3=_0x250103[_0xac8e('0x64')]();_0x7839f3[_0xac8e('0x23')](_0xac8e('0x65'),_0x54effd['id']);_0x533332[_0xac8e('0x66')](db[_0xac8e('0x59')][_0xac8e('0x25')](_0x7839f3[_0xac8e('0x67')](),{'type':db['sequelize'][_0xac8e('0x68')][_0xac8e('0x69')]})[_0xac8e('0x14')](function(_0x48695c){if(_0x48695c[_0xac8e('0x51')]===0x1){return _0x54effd['id'];}else{var _0x3b7717=_['every'](_[_0xac8e('0x47')](_0x48695c,_0xac8e('0x6a')),function(_0x1e90e9){return _['includes'](_0x944193,_0x1e90e9);});if(_0x3b7717){return _0x54effd['id'];}}}));}}return BPromise[_0xac8e('0x6b')](_0x533332)['then'](function(_0x279322){_0x28a60e=_(_0x28a60e)['union'](_0x279322)[_0xac8e('0x6c')]()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x13b1f1['params']['id']}})[_0xac8e('0x14')](function(_0x207972){return db['sequelize'][_0xac8e('0x6d')](function(_0x15943c){return _0x207972['removeTeams'](_0x13b1f1[_0xac8e('0x25')][_0xac8e('0x54')],{'transaction':_0x15943c})[_0xac8e('0x14')](function(){if(!_['isEmpty'](_0x28a60e)){return _0x207972['removeAgents'](_0x28a60e,{'transaction':_0x15943c});}})[_0xac8e('0x14')](function(){_0x28a60e[_0xac8e('0x5b')](function(_0x161781){socket[_0xac8e('0x6e')](_0xac8e('0x6f'),{'UserId':_0x161781,'WhatsappQueueId':_0x207972['id']});});});});});});})[_0xac8e('0x14')](respondWithStatusCode(_0x3bc835,null))[_0xac8e('0x28')](handleError(_0x3bc835,null));};exports[_0xac8e('0x70')]=function(_0x3790ca,_0x467a17){return db[_0xac8e('0x1d')][_0xac8e('0x34')]({'where':{'id':_0x3790ca[_0xac8e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x467a17,null))['then'](function(_0x1a999c){if(_0x1a999c){return _0x1a999c[_0xac8e('0x70')](_0x3790ca[_0xac8e('0x36')][_0xac8e('0x54')],_[_0xac8e('0x71')](_0x3790ca['body'],[_0xac8e('0x54'),'id'])||{})['spread'](function(_0x57ca19){for(var _0x4851a8=0x0;_0x4851a8<_0x3790ca[_0xac8e('0x36')]['ids'][_0xac8e('0x51')];_0x4851a8+=0x1){socket[_0xac8e('0x6e')](_0xac8e('0x5c'),{'UserId':Number(_0x3790ca[_0xac8e('0x36')][_0xac8e('0x54')][_0x4851a8]),'WhatsappQueueId':Number(_0x3790ca[_0xac8e('0x2a')]['id'])});}return _0x57ca19;});}})[_0xac8e('0x14')](respondWithResult(_0x467a17,null))[_0xac8e('0x28')](handleError(_0x467a17,null));};exports[_0xac8e('0x72')]=function(_0x44834f,_0x5a0940){return db[_0xac8e('0x1d')][_0xac8e('0x34')]({'where':{'id':_0x44834f[_0xac8e('0x2a')]['id']}})[_0xac8e('0x14')](handleEntityNotFound(_0x5a0940,null))[_0xac8e('0x14')](function(_0x1369ac){if(_0x1369ac){return _0x1369ac[_0xac8e('0x72')](_0x44834f[_0xac8e('0x25')][_0xac8e('0x54')])['then'](function(){if(_['isArray'](_0x44834f[_0xac8e('0x25')][_0xac8e('0x54')])){for(var _0x33577d=0x0;_0x33577d<_0x44834f[_0xac8e('0x25')]['ids']['length'];_0x33577d+=0x1){socket[_0xac8e('0x6e')](_0xac8e('0x6f'),{'UserId':Number(_0x44834f['query'][_0xac8e('0x54')][_0x33577d]),'WhatsappQueueId':Number(_0x44834f[_0xac8e('0x2a')]['id'])});}}else{socket['emit'](_0xac8e('0x6f'),{'UserId':Number(_0x44834f[_0xac8e('0x25')][_0xac8e('0x54')]),'WhatsappQueueId':Number(_0x44834f[_0xac8e('0x2a')]['id'])});}});}})[_0xac8e('0x14')](respondWithStatusCode(_0x5a0940,null))[_0xac8e('0x28')](handleError(_0x5a0940,null));};exports[_0xac8e('0x73')]=function(_0x4deb86,_0x2f7f07){var _0xe01da7={};var _0x2f68b6={};var _0x17993e;var _0xbd9e44;return db[_0xac8e('0x1d')]['findOne']({'where':{'id':_0x4deb86[_0xac8e('0x2a')]['id']}})[_0xac8e('0x14')](handleEntityNotFound(_0x2f7f07,null))[_0xac8e('0x14')](function(_0x172caa){if(_0x172caa){_0x17993e=_0x172caa;_0x2f68b6[_0xac8e('0x2e')]=_[_0xac8e('0x2b')](db[_0xac8e('0x46')][_0xac8e('0x1e')]);_0x2f68b6['query']=_[_0xac8e('0x2b')](_0x4deb86[_0xac8e('0x25')]);_0x2f68b6[_0xac8e('0x2c')]=_[_0xac8e('0x2d')](_0x2f68b6[_0xac8e('0x2e')],_0x2f68b6[_0xac8e('0x25')]);_0xe01da7[_0xac8e('0x2f')]=_[_0xac8e('0x2d')](_0x2f68b6[_0xac8e('0x2e')],qs[_0xac8e('0x30')](_0x4deb86['query'][_0xac8e('0x30')]));_0xe01da7[_0xac8e('0x2f')]=_0xe01da7[_0xac8e('0x2f')][_0xac8e('0x51')]?_0xe01da7[_0xac8e('0x2f')]:_0x2f68b6[_0xac8e('0x2e')];_0xe01da7['order']=qs[_0xac8e('0x43')](_0x4deb86[_0xac8e('0x25')][_0xac8e('0x43')]);_0xe01da7['where']=qs[_0xac8e('0x2c')](_[_0xac8e('0x52')](_0x4deb86['query'],_0x2f68b6[_0xac8e('0x2c')]));if(_0x4deb86[_0xac8e('0x25')][_0xac8e('0x44')]){_0xe01da7[_0xac8e('0x23')]=_[_0xac8e('0x32')](_0xe01da7['where'],{'$or':_[_0xac8e('0x47')](_0xe01da7[_0xac8e('0x2f')],function(_0x2bba53){var _0x10ad2c={};_0x10ad2c[_0x2bba53]={'$like':'%'+_0x4deb86[_0xac8e('0x25')]['filter']+'%'};return _0x10ad2c;})});}_0xe01da7=_['merge']({},_0xe01da7,_0x4deb86[_0xac8e('0x33')]);return _0x17993e[_0xac8e('0x73')](_0xe01da7);}})[_0xac8e('0x14')](function(_0x16a4f7){if(_0x16a4f7){_0xbd9e44=_0x16a4f7[_0xac8e('0x51')];if(!_0x4deb86['query'][_0xac8e('0x41')](_0xac8e('0x74'))){_0xe01da7[_0xac8e('0xf')]=qs[_0xac8e('0xf')](_0x4deb86[_0xac8e('0x25')][_0xac8e('0xf')]);_0xe01da7[_0xac8e('0xe')]=qs[_0xac8e('0xe')](_0x4deb86['query'][_0xac8e('0xe')]);}return _0x17993e[_0xac8e('0x73')](_0xe01da7);}})['then'](function(_0x431ab6){if(_0x431ab6){return _0x431ab6?{'count':_0xbd9e44,'rows':_0x431ab6}:null;}})[_0xac8e('0x14')](respondWithResult(_0x2f7f07,null))['catch'](handleError(_0x2f7f07,null));}; \ No newline at end of file +var _0xba76=['redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','destroy','name','index','map','WhatsappQueue','fieldName','key','getOptions','where','include','findAll','catch','show','params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','filters','nolimit','order','sort','WhatsappQueueId','filter','options','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','rows','%s/%s','updatedAt','getTeams','Team','pick','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','compact','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','findOne','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x5b146d,_0x541a46){var _0x85650d=function(_0xdec0ce){while(--_0xdec0ce){_0x5b146d['push'](_0x5b146d['shift']());}};_0x85650d(++_0x541a46);}(_0xba76,0x16c));var _0x6ba7=function(_0x188c60,_0x1d0d8f){_0x188c60=_0x188c60-0x0;var _0x580a07=_0xba76[_0x188c60];return _0x580a07;};'use strict';var BPromise=require(_0x6ba7('0x0'));var util=require(_0x6ba7('0x1'));var _=require(_0x6ba7('0x2'));var squel=require(_0x6ba7('0x3'));var Redis=require('ioredis');var qs=require(_0x6ba7('0x4'));var logger=require(_0x6ba7('0x5'))('api');var config=require(_0x6ba7('0x6'));var db=require(_0x6ba7('0x7'))['db'];config[_0x6ba7('0x8')]=_[_0x6ba7('0x9')](config[_0x6ba7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ba7('0xa'))(new Redis(config['redis']));require(_0x6ba7('0xb'))[_0x6ba7('0xc')](socket);function respondWithStatusCode(_0x469af2,_0x125a73){_0x125a73=_0x125a73||0xcc;return function(_0x5e05ed){if(_0x5e05ed){return _0x469af2[_0x6ba7('0xd')](_0x125a73);}return _0x469af2[_0x6ba7('0xe')](_0x125a73)[_0x6ba7('0xf')]();};}function respondWithResult(_0x944763,_0x4a8380){_0x4a8380=_0x4a8380||0xc8;return function(_0x487f3d){if(_0x487f3d){return _0x944763['status'](_0x4a8380)[_0x6ba7('0x10')](_0x487f3d);}};}function respondWithFilteredResult(_0x18dd55,_0x34e1d6){return function(_0x534998){if(_0x534998){var _0x421b13=typeof _0x34e1d6[_0x6ba7('0x11')]===_0x6ba7('0x12')&&typeof _0x34e1d6[_0x6ba7('0x13')]==='undefined';var _0x3ec9ce=_0x534998['count'];var _0x63afb2=_0x421b13?0x0:_0x34e1d6[_0x6ba7('0x11')];var _0x3ffb63=_0x421b13?_0x534998[_0x6ba7('0x14')]:_0x34e1d6[_0x6ba7('0x11')]+_0x34e1d6['limit'];var _0xd595c1;if(_0x3ffb63>=_0x3ec9ce){_0x3ffb63=_0x3ec9ce;_0xd595c1=0xc8;}else{_0xd595c1=0xce;}_0x18dd55[_0x6ba7('0xe')](_0xd595c1);return _0x18dd55[_0x6ba7('0x15')](_0x6ba7('0x16'),_0x63afb2+'-'+_0x3ffb63+'/'+_0x3ec9ce)[_0x6ba7('0x10')](_0x534998);}return null;};}function saveUpdates(_0x47c71d){return function(_0x2eb9eb){if(_0x2eb9eb){return _0x2eb9eb[_0x6ba7('0x17')](_0x47c71d)['then'](function(_0x28942c){return _0x28942c;});}return null;};}function removeEntity(_0x31dc5f){return function(_0x3c081b){if(_0x3c081b){return _0x3c081b['destroy']()[_0x6ba7('0x18')](function(){var _0x47dd74=_0x3c081b[_0x6ba7('0x19')]({'plain':!![]});var _0x2818c7=_0x6ba7('0x1a');return db[_0x6ba7('0x1b')][_0x6ba7('0x1c')]({'where':{'type':_0x2818c7,'resourceId':_0x47dd74['id']}})[_0x6ba7('0x18')](function(){return _0x3c081b;});})[_0x6ba7('0x18')](function(){_0x31dc5f['status'](0xcc)[_0x6ba7('0xf')]();});}};}function handleEntityNotFound(_0x371ae5){return function(_0x6065e6){if(!_0x6065e6){_0x371ae5[_0x6ba7('0xd')](0x194);}return _0x6065e6;};}function handleError(_0x51e644,_0x20db71){_0x20db71=_0x20db71||0x1f4;return function(_0x113ede){logger['error'](_0x113ede['stack']);if(_0x113ede[_0x6ba7('0x1d')]){delete _0x113ede[_0x6ba7('0x1d')];}_0x51e644[_0x6ba7('0xe')](_0x20db71)['send'](_0x113ede);};}exports[_0x6ba7('0x1e')]=function(_0x4839f8,_0x219529){var _0x227e27={};var _0x366b2a={'count':0x0,'rows':[]};var _0x17a1a2=_[_0x6ba7('0x1f')](db[_0x6ba7('0x20')]['rawAttributes'],function(_0x19ffa6){return{'name':_0x19ffa6[_0x6ba7('0x21')],'type':_0x19ffa6['type'][_0x6ba7('0x22')]};});_0x227e27=qs[_0x6ba7('0x23')](_0x17a1a2,_0x4839f8);var _0x25b1c4={'where':_0x227e27[_0x6ba7('0x24')]};return db[_0x6ba7('0x20')][_0x6ba7('0x14')](_0x25b1c4)['then'](function(_0x779c53){_0x366b2a['count']=_0x779c53;_0x227e27['include']=qs[_0x6ba7('0x25')](_0x4839f8['query']);return db[_0x6ba7('0x20')][_0x6ba7('0x26')](_0x227e27);})[_0x6ba7('0x18')](function(_0x1117a2){_0x366b2a['rows']=_0x1117a2;return _0x366b2a;})['then'](respondWithFilteredResult(_0x219529,_0x227e27))[_0x6ba7('0x27')](handleError(_0x219529,null));};exports[_0x6ba7('0x28')]=function(_0x402369,_0x3b7425){var _0x5eddd2={'raw':!![],'where':{'id':_0x402369[_0x6ba7('0x29')]['id']}},_0xe0a273={};_0xe0a273[_0x6ba7('0x2a')]=_[_0x6ba7('0x2b')](db[_0x6ba7('0x20')][_0x6ba7('0x2c')]);_0xe0a273['query']=_[_0x6ba7('0x2b')](_0x402369[_0x6ba7('0x2d')]);_0xe0a273['filters']=_[_0x6ba7('0x2e')](_0xe0a273['model'],_0xe0a273[_0x6ba7('0x2d')]);_0x5eddd2['attributes']=_['intersection'](_0xe0a273['model'],qs['fields'](_0x402369[_0x6ba7('0x2d')][_0x6ba7('0x2f')]));_0x5eddd2['attributes']=_0x5eddd2[_0x6ba7('0x30')][_0x6ba7('0x31')]?_0x5eddd2[_0x6ba7('0x30')]:_0xe0a273[_0x6ba7('0x2a')];if(_0x402369[_0x6ba7('0x2d')][_0x6ba7('0x32')]){_0x5eddd2[_0x6ba7('0x25')]=[{'all':!![]}];}_0x5eddd2=_[_0x6ba7('0x33')]({},_0x5eddd2,_0x402369['options']);return db[_0x6ba7('0x20')][_0x6ba7('0x34')](_0x5eddd2)[_0x6ba7('0x18')](handleEntityNotFound(_0x3b7425,null))[_0x6ba7('0x18')](respondWithResult(_0x3b7425,null))['catch'](handleError(_0x3b7425,null));};exports[_0x6ba7('0x35')]=function(_0x480c31,_0x5102d7){return db['WhatsappQueue'][_0x6ba7('0x35')](_0x480c31[_0x6ba7('0x36')],{})[_0x6ba7('0x18')](function(_0x1e3bf1){var _0x277721=_0x480c31[_0x6ba7('0x37')]['get']({'plain':!![]});if(!_0x277721)throw new Error(_0x6ba7('0x38'));if(_0x277721[_0x6ba7('0x39')]===_0x6ba7('0x37')){var _0x1ef764=_0x1e3bf1[_0x6ba7('0x19')]({'plain':!![]});var _0x560a76='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x560a76,'userProfileId':_0x277721[_0x6ba7('0x3a')]},'raw':!![]})[_0x6ba7('0x18')](function(_0x2e1a4d){if(_0x2e1a4d&&_0x2e1a4d[_0x6ba7('0x3b')]===0x0){return db['UserProfileResource'][_0x6ba7('0x35')]({'name':_0x1ef764[_0x6ba7('0x1d')],'resourceId':_0x1ef764['id'],'type':_0x2e1a4d[_0x6ba7('0x1d')],'sectionId':_0x2e1a4d['id']},{})[_0x6ba7('0x18')](function(){return _0x1e3bf1;});}else{return _0x1e3bf1;}})[_0x6ba7('0x27')](function(_0x523110){logger[_0x6ba7('0x3c')](_0x6ba7('0x3d'),_0x523110);throw _0x523110;});}return _0x1e3bf1;})[_0x6ba7('0x18')](respondWithResult(_0x5102d7,0xc9))[_0x6ba7('0x27')](handleError(_0x5102d7,null));};exports[_0x6ba7('0x17')]=function(_0xe12536,_0x543589){if(_0xe12536[_0x6ba7('0x36')]['id']){delete _0xe12536[_0x6ba7('0x36')]['id'];}return db[_0x6ba7('0x20')]['find']({'where':{'id':_0xe12536[_0x6ba7('0x29')]['id']}})['then'](handleEntityNotFound(_0x543589,null))[_0x6ba7('0x18')](saveUpdates(_0xe12536[_0x6ba7('0x36')],null))[_0x6ba7('0x18')](respondWithResult(_0x543589,null))['catch'](handleError(_0x543589,null));};exports[_0x6ba7('0x1c')]=function(_0x2b281b,_0x2a487f){return db[_0x6ba7('0x20')][_0x6ba7('0x34')]({'where':{'id':_0x2b281b[_0x6ba7('0x29')]['id']}})[_0x6ba7('0x18')](handleEntityNotFound(_0x2a487f,null))[_0x6ba7('0x18')](removeEntity(_0x2a487f,null))[_0x6ba7('0x27')](handleError(_0x2a487f,null));};exports[_0x6ba7('0x3e')]=function(_0x5499bf,_0x2d12de){return db[_0x6ba7('0x20')][_0x6ba7('0x3e')]()[_0x6ba7('0x18')](respondWithResult(_0x2d12de,null))[_0x6ba7('0x27')](handleError(_0x2d12de,null));};exports[_0x6ba7('0x3f')]=function(_0x40d241,_0x56f6f4){var _0x502c72={'raw':!![],'where':{}},_0x1c16a9={},_0xcbd8db;return db[_0x6ba7('0x20')]['findOne']({'where':{'id':_0x40d241[_0x6ba7('0x29')]['id']}})[_0x6ba7('0x18')](handleEntityNotFound(_0x56f6f4,null))[_0x6ba7('0x18')](function(_0x2e3949){if(_0x2e3949){_0xcbd8db=_0x2e3949[_0x6ba7('0x19')]({'plain':!![]});_0x1c16a9[_0x6ba7('0x2a')]=_[_0x6ba7('0x2b')](db[_0x6ba7('0x40')][_0x6ba7('0x2c')]);_0x1c16a9['query']=_['keys'](_0x40d241[_0x6ba7('0x2d')]);_0x1c16a9[_0x6ba7('0x41')]=_[_0x6ba7('0x2e')](_0x1c16a9[_0x6ba7('0x2a')],_0x1c16a9[_0x6ba7('0x2d')]);_0x502c72[_0x6ba7('0x30')]=_['intersection'](_0x1c16a9[_0x6ba7('0x2a')],qs[_0x6ba7('0x2f')](_0x40d241[_0x6ba7('0x2d')]['fields']));_0x502c72[_0x6ba7('0x30')]=_0x502c72[_0x6ba7('0x30')][_0x6ba7('0x31')]?_0x502c72['attributes']:_0x1c16a9[_0x6ba7('0x2a')];if(!_0x40d241[_0x6ba7('0x2d')]['hasOwnProperty'](_0x6ba7('0x42'))){_0x502c72[_0x6ba7('0x13')]=qs['limit'](_0x40d241['query'][_0x6ba7('0x13')]);_0x502c72[_0x6ba7('0x11')]=qs[_0x6ba7('0x11')](_0x40d241[_0x6ba7('0x2d')][_0x6ba7('0x11')]);}_0x502c72[_0x6ba7('0x43')]=qs[_0x6ba7('0x44')](_0x40d241['query'][_0x6ba7('0x44')]);_0x502c72[_0x6ba7('0x24')]=qs['filters'](_['pick'](_0x40d241[_0x6ba7('0x2d')],_0x1c16a9[_0x6ba7('0x41')]));_0x502c72['where'][_0x6ba7('0x45')]=_0x2e3949['id'];if(_0x40d241['query']['filter']){_0x502c72['where']=_[_0x6ba7('0x33')](_0x502c72['where'],{'$or':_[_0x6ba7('0x1f')](_0x502c72[_0x6ba7('0x30')],function(_0x375542){var _0x3757bc={};_0x3757bc[_0x375542]={'$like':'%'+_0x40d241['query'][_0x6ba7('0x46')]+'%'};return _0x3757bc;})});}_0x502c72=_[_0x6ba7('0x33')]({},_0x502c72,_0x40d241[_0x6ba7('0x47')]);return db['UserWhatsappQueue'][_0x6ba7('0x26')](_0x502c72);}})[_0x6ba7('0x18')](function(_0x57dace){if(_0x57dace){return db[_0x6ba7('0x48')][_0x6ba7('0x49')]({'where':{'id':_['map'](_0x57dace,_0x6ba7('0x4a')),'role':_0x6ba7('0x4b')},'attributes':['id',_0x6ba7('0x1d'),_0x6ba7('0x4c'),'updatedAt',_0x6ba7('0x4d')]});}})['then'](function(_0x2ef114){if(_0x2ef114){return{'count':_0x2ef114[_0x6ba7('0x14')],'rows':_[_0x6ba7('0x1f')](_0x2ef114[_0x6ba7('0x4e')],function(_0x3cc265){return{'membername':_0x3cc265[_0x6ba7('0x1d')],'UserId':_0x3cc265['id'],'queue_name':_0xcbd8db['name'],'WhatsappQueueId':_0xcbd8db['id'],'interface':util['format'](_0x6ba7('0x4f'),'SIP',_0x3cc265[_0x6ba7('0x1d')]),'penalty':0x0,'paused':_0x3cc265['whatsappPause'],'createdAt':_0x3cc265[_0x6ba7('0x4d')],'updatedAt':_0x3cc265[_0x6ba7('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ba7('0x18')](respondWithFilteredResult(_0x56f6f4,_0x502c72))['catch'](handleError(_0x56f6f4,null));};exports[_0x6ba7('0x51')]=function(_0x9a167d,_0x537ffe){var _0x277aff={};var _0xd29fc5={};var _0x1aed50;var _0x2c9f83;return db[_0x6ba7('0x20')]['findOne']({'where':{'id':_0x9a167d['params']['id']}})[_0x6ba7('0x18')](handleEntityNotFound(_0x537ffe,null))[_0x6ba7('0x18')](function(_0x5d21b1){if(_0x5d21b1){_0x1aed50=_0x5d21b1;_0xd29fc5['model']=_[_0x6ba7('0x2b')](db[_0x6ba7('0x52')][_0x6ba7('0x2c')]);_0xd29fc5[_0x6ba7('0x2d')]=_[_0x6ba7('0x2b')](_0x9a167d[_0x6ba7('0x2d')]);_0xd29fc5[_0x6ba7('0x41')]=_['intersection'](_0xd29fc5['model'],_0xd29fc5[_0x6ba7('0x2d')]);_0x277aff[_0x6ba7('0x30')]=_['intersection'](_0xd29fc5[_0x6ba7('0x2a')],qs[_0x6ba7('0x2f')](_0x9a167d[_0x6ba7('0x2d')][_0x6ba7('0x2f')]));_0x277aff[_0x6ba7('0x30')]=_0x277aff[_0x6ba7('0x30')][_0x6ba7('0x31')]?_0x277aff[_0x6ba7('0x30')]:_0xd29fc5[_0x6ba7('0x2a')];_0x277aff[_0x6ba7('0x43')]=qs[_0x6ba7('0x44')](_0x9a167d[_0x6ba7('0x2d')][_0x6ba7('0x44')]);_0x277aff[_0x6ba7('0x24')]=qs[_0x6ba7('0x41')](_[_0x6ba7('0x53')](_0x9a167d[_0x6ba7('0x2d')],_0xd29fc5[_0x6ba7('0x41')]));if(_0x9a167d[_0x6ba7('0x2d')][_0x6ba7('0x46')]){_0x277aff['where']=_[_0x6ba7('0x33')](_0x277aff[_0x6ba7('0x24')],{'$or':_[_0x6ba7('0x1f')](_0x277aff[_0x6ba7('0x30')],function(_0x4d7865){var _0x3ca805={};_0x3ca805[_0x4d7865]={'$like':'%'+_0x9a167d['query'][_0x6ba7('0x46')]+'%'};return _0x3ca805;})});}_0x277aff=_[_0x6ba7('0x33')]({},_0x277aff,_0x9a167d['options']);return _0x1aed50[_0x6ba7('0x51')](_0x277aff);}})[_0x6ba7('0x18')](function(_0x43ea68){if(_0x43ea68){_0x2c9f83=_0x43ea68[_0x6ba7('0x31')];if(!_0x9a167d[_0x6ba7('0x2d')][_0x6ba7('0x54')](_0x6ba7('0x42'))){_0x277aff['limit']=qs[_0x6ba7('0x13')](_0x9a167d['query'][_0x6ba7('0x13')]);_0x277aff[_0x6ba7('0x11')]=qs[_0x6ba7('0x11')](_0x9a167d[_0x6ba7('0x2d')][_0x6ba7('0x11')]);}return _0x1aed50[_0x6ba7('0x51')](_0x277aff);}})[_0x6ba7('0x18')](function(_0x1b1186){if(_0x1b1186){return _0x1b1186?{'count':_0x2c9f83,'rows':_0x1b1186}:null;}})['then'](respondWithResult(_0x537ffe,null))[_0x6ba7('0x27')](handleError(_0x537ffe,null));};exports['addTeams']=function(_0x4c038b,_0x1971ef){var _0x4208d3=_0x4c038b['body'][_0x6ba7('0x55')];return db['Team'][_0x6ba7('0x26')]({'where':{'id':_0x4208d3},'attributes':['id'],'include':[{'model':db[_0x6ba7('0x48')],'as':_0x6ba7('0x56'),'attributes':['id',_0x6ba7('0x1d'),_0x6ba7('0x57'),_0x6ba7('0x58'),_0x6ba7('0x59')],'raw':!![]}]})[_0x6ba7('0x18')](function(_0x63dd3d){if(_0x63dd3d){var _0x47622b=_[_0x6ba7('0x5a')](_0x63dd3d,function(_0x348fad){var _0x252931=_0x348fad[_0x6ba7('0x19')]({'plain':!![]});return _0x252931[_0x6ba7('0x56')];});return db[_0x6ba7('0x20')][_0x6ba7('0x34')]({'where':{'id':_0x4c038b[_0x6ba7('0x29')]['id']}})[_0x6ba7('0x18')](function(_0x5a8e7b){return db['sequelize']['transaction'](function(_0x2f7eaa){return _0x5a8e7b[_0x6ba7('0x5b')](_0x4208d3,{'transaction':_0x2f7eaa})['then'](function(){return BPromise[_0x6ba7('0x5c')](_0x47622b,function(_0x598932){return db[_0x6ba7('0x40')][_0x6ba7('0x5d')]({'where':{'UserId':_0x598932['id'],'WhatsappQueueId':_0x4c038b['params']['id']},'transaction':_0x2f7eaa});});})[_0x6ba7('0x18')](function(){_0x47622b[_0x6ba7('0x5e')](function(_0x279a92){socket[_0x6ba7('0x5f')](_0x6ba7('0x60'),{'UserId':_0x279a92['id'],'WhatsappQueueId':_0x5a8e7b['id']});});});});});}})[_0x6ba7('0x18')](respondWithStatusCode(_0x1971ef,null))[_0x6ba7('0x27')](handleError(_0x1971ef,null));};exports[_0x6ba7('0x61')]=function(_0x4cc0d0,_0x1e82d4){return db['Team']['findAll']({'where':{'id':_0x4cc0d0[_0x6ba7('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6ba7('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6ba7('0x18')](handleEntityNotFound(_0x1e82d4,null))[_0x6ba7('0x18')](function(_0x5b2922){var _0x522677=_['map'](_0x5b2922,'id');var _0x504805=[];var _0x3ad232=[];var _0x4a8850=squel[_0x6ba7('0x62')]();_0x4a8850[_0x6ba7('0x63')](_0x6ba7('0x64'))[_0x6ba7('0x65')](_0x6ba7('0x66'),'tq')[_0x6ba7('0x67')](_0x6ba7('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6ba7('0x24')](_0x6ba7('0x69'),_0x4cc0d0[_0x6ba7('0x29')]['id']);for(var _0x33ef5b=0x0;_0x33ef5b<_0x5b2922[_0x6ba7('0x31')];_0x33ef5b+=0x1){let _0x2401a8=_0x5b2922[_0x33ef5b];for(var _0x12caf5=0x0;_0x12caf5<_0x2401a8[_0x6ba7('0x56')][_0x6ba7('0x31')];_0x12caf5+=0x1){let _0x39b864=_0x2401a8[_0x6ba7('0x56')][_0x12caf5];var _0xdb1ba3=_0x4a8850[_0x6ba7('0x6a')]();_0xdb1ba3[_0x6ba7('0x24')](_0x6ba7('0x6b'),_0x39b864['id']);_0x3ad232[_0x6ba7('0x6c')](db[_0x6ba7('0x6d')][_0x6ba7('0x2d')](_0xdb1ba3['toString'](),{'type':db['sequelize'][_0x6ba7('0x6e')][_0x6ba7('0x6f')]})[_0x6ba7('0x18')](function(_0x2eeebc){if(_0x2eeebc['length']===0x1){return _0x39b864['id'];}else{var _0x3bdd39=_[_0x6ba7('0x70')](_[_0x6ba7('0x1f')](_0x2eeebc,_0x6ba7('0x71')),function(_0x3f1ac4){return _['includes'](_0x522677,_0x3f1ac4);});if(_0x3bdd39){return _0x39b864['id'];}}}));}}return BPromise['all'](_0x3ad232)[_0x6ba7('0x18')](function(_0x1c0d6c){_0x504805=_(_0x504805)['union'](_0x1c0d6c)[_0x6ba7('0x72')]()['value']();return db[_0x6ba7('0x20')][_0x6ba7('0x34')]({'where':{'id':_0x4cc0d0['params']['id']}})['then'](function(_0xd8f0e9){return db[_0x6ba7('0x6d')][_0x6ba7('0x73')](function(_0x45db0d){return _0xd8f0e9['removeTeams'](_0x4cc0d0['query']['ids'],{'transaction':_0x45db0d})[_0x6ba7('0x18')](function(){if(!_[_0x6ba7('0x74')](_0x504805)){return _0xd8f0e9[_0x6ba7('0x75')](_0x504805,{'transaction':_0x45db0d});}})[_0x6ba7('0x18')](function(){_0x504805[_0x6ba7('0x5e')](function(_0x319886){socket[_0x6ba7('0x5f')](_0x6ba7('0x76'),{'UserId':_0x319886,'WhatsappQueueId':_0xd8f0e9['id']});});});});});});})['then'](respondWithStatusCode(_0x1e82d4,null))[_0x6ba7('0x27')](handleError(_0x1e82d4,null));};exports[_0x6ba7('0x77')]=function(_0xb8bdbe,_0x5d1b74){return db[_0x6ba7('0x20')][_0x6ba7('0x34')]({'where':{'id':_0xb8bdbe['params']['id']}})[_0x6ba7('0x18')](handleEntityNotFound(_0x5d1b74,null))[_0x6ba7('0x18')](function(_0x4f1399){if(_0x4f1399){return _0x4f1399['addAgents'](_0xb8bdbe[_0x6ba7('0x36')][_0x6ba7('0x55')],_['omit'](_0xb8bdbe['body'],[_0x6ba7('0x55'),'id'])||{})[_0x6ba7('0x78')](function(_0x134d2a){for(var _0x547953=0x0;_0x547953<_0xb8bdbe[_0x6ba7('0x36')][_0x6ba7('0x55')]['length'];_0x547953+=0x1){socket['emit'](_0x6ba7('0x60'),{'UserId':Number(_0xb8bdbe['body'][_0x6ba7('0x55')][_0x547953]),'WhatsappQueueId':Number(_0xb8bdbe[_0x6ba7('0x29')]['id'])});}return _0x134d2a;});}})[_0x6ba7('0x18')](respondWithResult(_0x5d1b74,null))[_0x6ba7('0x27')](handleError(_0x5d1b74,null));};exports[_0x6ba7('0x75')]=function(_0x507cfa,_0x29d73f){return db['WhatsappQueue'][_0x6ba7('0x34')]({'where':{'id':_0x507cfa[_0x6ba7('0x29')]['id']}})['then'](handleEntityNotFound(_0x29d73f,null))[_0x6ba7('0x18')](function(_0x35dc9c){if(_0x35dc9c){return _0x35dc9c['removeAgents'](_0x507cfa[_0x6ba7('0x2d')]['ids'])[_0x6ba7('0x18')](function(){if(_[_0x6ba7('0x79')](_0x507cfa[_0x6ba7('0x2d')][_0x6ba7('0x55')])){for(var _0x3e53be=0x0;_0x3e53be<_0x507cfa[_0x6ba7('0x2d')][_0x6ba7('0x55')][_0x6ba7('0x31')];_0x3e53be+=0x1){socket[_0x6ba7('0x5f')](_0x6ba7('0x76'),{'UserId':Number(_0x507cfa[_0x6ba7('0x2d')][_0x6ba7('0x55')][_0x3e53be]),'WhatsappQueueId':Number(_0x507cfa[_0x6ba7('0x29')]['id'])});}}else{socket[_0x6ba7('0x5f')]('userWhatsappQueue:remove',{'UserId':Number(_0x507cfa[_0x6ba7('0x2d')]['ids']),'WhatsappQueueId':Number(_0x507cfa[_0x6ba7('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x29d73f,null))[_0x6ba7('0x27')](handleError(_0x29d73f,null));};exports[_0x6ba7('0x7a')]=function(_0x58d4ef,_0x38c7a5){var _0xeed61b={};var _0x5f1857={};var _0x42be3a;var _0x366b3a;return db['WhatsappQueue'][_0x6ba7('0x7b')]({'where':{'id':_0x58d4ef[_0x6ba7('0x29')]['id']}})['then'](handleEntityNotFound(_0x38c7a5,null))[_0x6ba7('0x18')](function(_0x21fcc7){if(_0x21fcc7){_0x42be3a=_0x21fcc7;_0x5f1857['model']=_[_0x6ba7('0x2b')](db[_0x6ba7('0x48')]['rawAttributes']);_0x5f1857[_0x6ba7('0x2d')]=_[_0x6ba7('0x2b')](_0x58d4ef[_0x6ba7('0x2d')]);_0x5f1857['filters']=_[_0x6ba7('0x2e')](_0x5f1857['model'],_0x5f1857[_0x6ba7('0x2d')]);_0xeed61b[_0x6ba7('0x30')]=_[_0x6ba7('0x2e')](_0x5f1857[_0x6ba7('0x2a')],qs['fields'](_0x58d4ef[_0x6ba7('0x2d')][_0x6ba7('0x2f')]));_0xeed61b[_0x6ba7('0x30')]=_0xeed61b[_0x6ba7('0x30')][_0x6ba7('0x31')]?_0xeed61b['attributes']:_0x5f1857[_0x6ba7('0x2a')];_0xeed61b[_0x6ba7('0x43')]=qs[_0x6ba7('0x44')](_0x58d4ef[_0x6ba7('0x2d')][_0x6ba7('0x44')]);_0xeed61b[_0x6ba7('0x24')]=qs[_0x6ba7('0x41')](_[_0x6ba7('0x53')](_0x58d4ef[_0x6ba7('0x2d')],_0x5f1857[_0x6ba7('0x41')]));if(_0x58d4ef['query'][_0x6ba7('0x46')]){_0xeed61b[_0x6ba7('0x24')]=_['merge'](_0xeed61b[_0x6ba7('0x24')],{'$or':_[_0x6ba7('0x1f')](_0xeed61b[_0x6ba7('0x30')],function(_0x1f0af0){var _0x1bc081={};_0x1bc081[_0x1f0af0]={'$like':'%'+_0x58d4ef[_0x6ba7('0x2d')][_0x6ba7('0x46')]+'%'};return _0x1bc081;})});}_0xeed61b=_['merge']({},_0xeed61b,_0x58d4ef[_0x6ba7('0x47')]);return _0x42be3a[_0x6ba7('0x7a')](_0xeed61b);}})['then'](function(_0x2b3bed){if(_0x2b3bed){_0x366b3a=_0x2b3bed[_0x6ba7('0x31')];if(!_0x58d4ef[_0x6ba7('0x2d')]['hasOwnProperty']('nolimit')){_0xeed61b[_0x6ba7('0x13')]=qs[_0x6ba7('0x13')](_0x58d4ef[_0x6ba7('0x2d')][_0x6ba7('0x13')]);_0xeed61b['offset']=qs['offset'](_0x58d4ef[_0x6ba7('0x2d')][_0x6ba7('0x11')]);}return _0x42be3a[_0x6ba7('0x7a')](_0xeed61b);}})[_0x6ba7('0x18')](function(_0x3e21e0){if(_0x3e21e0){return _0x3e21e0?{'count':_0x366b3a,'rows':_0x3e21e0}:null;}})[_0x6ba7('0x18')](respondWithResult(_0x38c7a5,null))[_0x6ba7('0x27')](handleError(_0x38c7a5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 111d6b6..3ee0aef 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 _0x9ad1=['hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1da778,_0x39d34c){var _0x87ed15=function(_0xbb966f){while(--_0xbb966f){_0x1da778['push'](_0x1da778['shift']());}};_0x87ed15(++_0x39d34c);}(_0x9ad1,0x133));var _0x19ad=function(_0x1249df,_0x24ce6d){_0x1249df=_0x1249df-0x0;var _0x556680=_0x9ad1[_0x1249df];return _0x556680;};'use strict';var EventEmitter=require(_0x19ad('0x0'));var WhatsappQueue=require(_0x19ad('0x1'))['db'][_0x19ad('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x19ad('0x3')](0x0);var events={'afterCreate':_0x19ad('0x4'),'afterUpdate':_0x19ad('0x5'),'afterDestroy':'remove'};function emitEvent(_0x325578){return function(_0x1536bc,_0x47a705,_0x28d47e){WhatsappQueueEvents[_0x19ad('0x6')](_0x325578+':'+_0x1536bc['id'],_0x1536bc);WhatsappQueueEvents[_0x19ad('0x6')](_0x325578,_0x1536bc);_0x28d47e(null);};}for(var e in events){if(events[_0x19ad('0x7')](e)){var event=events[e];WhatsappQueue[_0x19ad('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x60c4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove'];(function(_0x293ab9,_0x4d3d62){var _0x55a235=function(_0x10a9fe){while(--_0x10a9fe){_0x293ab9['push'](_0x293ab9['shift']());}};_0x55a235(++_0x4d3d62);}(_0x60c4,0x194));var _0x460c=function(_0x53dc28,_0x7b5ea){_0x53dc28=_0x53dc28-0x0;var _0x12b34e=_0x60c4[_0x53dc28];return _0x12b34e;};'use strict';var EventEmitter=require(_0x460c('0x0'));var WhatsappQueue=require(_0x460c('0x1'))['db'][_0x460c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x460c('0x3')](0x0);var events={'afterCreate':_0x460c('0x4'),'afterUpdate':'update','afterDestroy':_0x460c('0x5')};function emitEvent(_0x26708c){return function(_0x545e95,_0x100c8c,_0x347ea1){WhatsappQueueEvents[_0x460c('0x6')](_0x26708c+':'+_0x545e95['id'],_0x545e95);WhatsappQueueEvents[_0x460c('0x6')](_0x26708c,_0x545e95);_0x347ea1(null);};}for(var e in events){if(events[_0x460c('0x7')](e)){var event=events[e];WhatsappQueue[_0x460c('0x8')](e,emitEvent(event));}}module[_0x460c('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ad7331b..117cd29 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 _0x003a=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x559f28,_0x3d0990){var _0x1618c8=function(_0x46cb34){while(--_0x46cb34){_0x559f28['push'](_0x559f28['shift']());}};_0x1618c8(++_0x3d0990);}(_0x003a,0xc5));var _0xa003=function(_0x330c49,_0x18ea31){_0x330c49=_0x330c49-0x0;var _0x3444d5=_0x003a[_0x330c49];return _0x3444d5;};'use strict';var _=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var logger=require(_0xa003('0x2'))(_0xa003('0x3'));var moment=require(_0xa003('0x4'));var BPromise=require(_0xa003('0x5'));var rp=require(_0xa003('0x6'));var fs=require('fs');var path=require(_0xa003('0x7'));var rimraf=require('rimraf');var config=require(_0xa003('0x8'));var attributes=require(_0xa003('0x9'));module[_0xa003('0xa')]=function(_0x44c48f,_0x3a9c06){return _0x44c48f['define'](_0xa003('0xb'),attributes,{'tableName':_0xa003('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5669=['rimraf','../../config/environment','define','whatsapp_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5669,0x19e));var _0x9566=function(_0x9388c8,_0x2cdf84){_0x9388c8=_0x9388c8-0x0;var _0x6f1d3a=_0x5669[_0x9388c8];return _0x6f1d3a;};'use strict';var _=require(_0x9566('0x0'));var util=require(_0x9566('0x1'));var logger=require(_0x9566('0x2'))('api');var moment=require(_0x9566('0x3'));var BPromise=require('bluebird');var rp=require(_0x9566('0x4'));var fs=require('fs');var path=require(_0x9566('0x5'));var rimraf=require(_0x9566('0x6'));var config=require(_0x9566('0x7'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x383a4e,_0x4bcf7b){return _0x383a4e[_0x9566('0x8')]('WhatsappQueue',attributes,{'tableName':_0x9566('0x9'),'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 af36a57..315f2dd 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 _0x18d8=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','then','info'];(function(_0x2dda4d,_0x46d702){var _0x4580f4=function(_0x2c1989){while(--_0x2c1989){_0x2dda4d['push'](_0x2dda4d['shift']());}};_0x4580f4(++_0x46d702);}(_0x18d8,0x64));var _0x818d=function(_0x35a26d,_0x2134f5){_0x35a26d=_0x35a26d-0x0;var _0x1f97ba=_0x18d8[_0x35a26d];return _0x1f97ba;};'use strict';var _=require(_0x818d('0x0'));var util=require(_0x818d('0x1'));var moment=require('moment');var BPromise=require(_0x818d('0x2'));var rs=require(_0x818d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x818d('0x4'))['db'];var utils=require(_0x818d('0x5'));var logger=require('../../config/logger')(_0x818d('0x6'));var config=require(_0x818d('0x7'));var jayson=require(_0x818d('0x8'));var client=jayson[_0x818d('0x9')][_0x818d('0xa')]({'port':0x232a});config[_0x818d('0xb')]=_[_0x818d('0xc')](config['redis'],{'host':_0x818d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x818d('0xb')]));require(_0x818d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c1e7b,_0x4eb068,_0x5bbb8c){return new BPromise(function(_0x3fd72b,_0x154d90){return client['request'](_0x3c1e7b,_0x5bbb8c)[_0x818d('0xf')](function(_0x288a3c){logger[_0x818d('0x10')](_0x818d('0x11'),_0x4eb068,_0x818d('0x12'));logger[_0x818d('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4eb068,'request\x20sent',JSON[_0x818d('0x14')](_0x288a3c));if(_0x288a3c[_0x818d('0x15')]){if(_0x288a3c[_0x818d('0x15')][_0x818d('0x16')]===0x1f4){logger[_0x818d('0x15')](_0x818d('0x11'),_0x4eb068,_0x288a3c['error'][_0x818d('0x17')]);return _0x154d90(_0x288a3c['error'][_0x818d('0x17')]);}logger['error'](_0x818d('0x11'),_0x4eb068,_0x288a3c['error'][_0x818d('0x17')]);return _0x3fd72b(_0x288a3c[_0x818d('0x15')][_0x818d('0x17')]);}else{logger[_0x818d('0x10')](_0x818d('0x11'),_0x4eb068,_0x818d('0x12'));_0x3fd72b(_0x288a3c[_0x818d('0x18')][_0x818d('0x17')]);}})[_0x818d('0x19')](function(_0x4faad0){logger[_0x818d('0x15')](_0x818d('0x11'),_0x4eb068,_0x4faad0);_0x154d90(_0x4faad0);});});}exports[_0x818d('0x1a')]=function(_0x420dfb){var _0x26676f=this;return new Promise(function(_0x35f8ab,_0x426049){return db[_0x818d('0x1b')][_0x818d('0x1c')]({'raw':_0x420dfb['options']?_0x420dfb[_0x818d('0x1d')][_0x818d('0x1e')]===undefined?!![]:![]:!![],'where':_0x420dfb[_0x818d('0x1d')]?_0x420dfb[_0x818d('0x1d')][_0x818d('0x1f')]||null:null,'attributes':_0x420dfb['options']?_0x420dfb[_0x818d('0x1d')]['attributes']||null:null,'limit':_0x420dfb[_0x818d('0x1d')]?_0x420dfb[_0x818d('0x1d')][_0x818d('0x20')]||null:null,'include':_0x420dfb['options']?_0x420dfb[_0x818d('0x1d')][_0x818d('0x21')]?_[_0x818d('0x22')](_0x420dfb[_0x818d('0x1d')][_0x818d('0x21')],function(_0xad189b){return{'model':db[_0xad189b['model']],'as':_0xad189b['as'],'attributes':_0xad189b['attributes'],'include':_0xad189b[_0x818d('0x21')]?_[_0x818d('0x22')](_0xad189b[_0x818d('0x21')],function(_0x2995a3){return{'model':db[_0x2995a3[_0x818d('0x23')]],'as':_0x2995a3['as'],'attributes':_0x2995a3[_0x818d('0x24')],'include':_0x2995a3[_0x818d('0x21')]?_[_0x818d('0x22')](_0x2995a3[_0x818d('0x21')],function(_0x3c3e59){return{'model':db[_0x3c3e59[_0x818d('0x23')]],'as':_0x3c3e59['as'],'attributes':_0x3c3e59[_0x818d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x818d('0xf')](function(_0x32c8d7){logger['info']('GetWhatsappQueue',_0x420dfb);logger[_0x818d('0x13')](_0x818d('0x1a'),_0x420dfb,JSON['stringify'](_0x32c8d7));_0x35f8ab(_0x32c8d7);})[_0x818d('0x19')](function(_0x2b232b){logger[_0x818d('0x15')](_0x818d('0x1a'),_0x2b232b[_0x818d('0x17')],_0x420dfb);_0x426049(_0x26676f[_0x818d('0x15')](0x1f4,_0x2b232b[_0x818d('0x17')]));});});};exports[_0x818d('0x25')]=function(_0x4fc32d){var _0x2217b3=this;return new Promise(function(_0x36c81c,_0x1a121a){return db['WhatsappQueue'][_0x818d('0x26')]({'raw':_0x4fc32d['options']?_0x4fc32d[_0x818d('0x1d')][_0x818d('0x1e')]===undefined?!![]:![]:!![],'where':_0x4fc32d[_0x818d('0x1d')]?_0x4fc32d[_0x818d('0x1d')][_0x818d('0x1f')]||null:null,'attributes':_0x4fc32d[_0x818d('0x1d')]?_0x4fc32d[_0x818d('0x1d')]['attributes']||null:null,'include':_0x4fc32d['options']?_0x4fc32d[_0x818d('0x1d')][_0x818d('0x21')]?_[_0x818d('0x22')](_0x4fc32d['options'][_0x818d('0x21')],function(_0x10dc97){return{'model':db[_0x10dc97[_0x818d('0x23')]],'as':_0x10dc97['as'],'attributes':_0x10dc97[_0x818d('0x24')],'include':_0x10dc97['include']?_['map'](_0x10dc97['include'],function(_0x23bf09){return{'model':db[_0x23bf09['model']],'as':_0x23bf09['as'],'attributes':_0x23bf09['attributes'],'include':_0x23bf09[_0x818d('0x21')]?_['map'](_0x23bf09[_0x818d('0x21')],function(_0x5ac79a){return{'model':db[_0x5ac79a[_0x818d('0x23')]],'as':_0x5ac79a['as'],'attributes':_0x5ac79a[_0x818d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x818d('0xf')](function(_0x511b1c){logger[_0x818d('0x10')](_0x818d('0x25'),_0x4fc32d);logger['debug'](_0x818d('0x25'),_0x4fc32d,JSON[_0x818d('0x14')](_0x511b1c));_0x36c81c(_0x511b1c);})[_0x818d('0x19')](function(_0x3cdfc1){logger[_0x818d('0x15')]('ShowWhatsappQueue',_0x3cdfc1['message'],_0x4fc32d);_0x1a121a(_0x2217b3[_0x818d('0x15')](0x1f4,_0x3cdfc1[_0x818d('0x17')]));});});}; \ No newline at end of file +var _0x29dd=['model','then','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','where','attributes','limit','include','map'];(function(_0x4258c0,_0x338808){var _0x458113=function(_0x1734c7){while(--_0x1734c7){_0x4258c0['push'](_0x4258c0['shift']());}};_0x458113(++_0x338808);}(_0x29dd,0x1f2));var _0xd29d=function(_0x3ed1b6,_0x21927f){_0x3ed1b6=_0x3ed1b6-0x0;var _0x43f4f1=_0x29dd[_0x3ed1b6];return _0x43f4f1;};'use strict';var _=require('lodash');var util=require(_0xd29d('0x0'));var moment=require(_0xd29d('0x1'));var BPromise=require(_0xd29d('0x2'));var rs=require(_0xd29d('0x3'));var fs=require('fs');var Redis=require(_0xd29d('0x4'));var db=require(_0xd29d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd29d('0x6'))(_0xd29d('0x7'));var config=require('../../config/environment');var jayson=require(_0xd29d('0x8'));var client=jayson[_0xd29d('0x9')]['http']({'port':0x232a});config[_0xd29d('0xa')]=_[_0xd29d('0xb')](config[_0xd29d('0xa')],{'host':_0xd29d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd29d('0xa')]));require(_0xd29d('0xd'))[_0xd29d('0xe')](socket);function respondWithRpcPromise(_0x4ebb0d,_0x3e9be6,_0x2af8c0){return new BPromise(function(_0x1a394d,_0x189623){return client[_0xd29d('0xf')](_0x4ebb0d,_0x2af8c0)['then'](function(_0x308da4){logger[_0xd29d('0x10')](_0xd29d('0x11'),_0x3e9be6,_0xd29d('0x12'));logger[_0xd29d('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3e9be6,_0xd29d('0x12'),JSON[_0xd29d('0x14')](_0x308da4));if(_0x308da4[_0xd29d('0x15')]){if(_0x308da4['error'][_0xd29d('0x16')]===0x1f4){logger[_0xd29d('0x15')](_0xd29d('0x11'),_0x3e9be6,_0x308da4[_0xd29d('0x15')]['message']);return _0x189623(_0x308da4[_0xd29d('0x15')][_0xd29d('0x17')]);}logger[_0xd29d('0x15')](_0xd29d('0x11'),_0x3e9be6,_0x308da4[_0xd29d('0x15')][_0xd29d('0x17')]);return _0x1a394d(_0x308da4[_0xd29d('0x15')]['message']);}else{logger[_0xd29d('0x10')](_0xd29d('0x11'),_0x3e9be6,_0xd29d('0x12'));_0x1a394d(_0x308da4[_0xd29d('0x18')][_0xd29d('0x17')]);}})[_0xd29d('0x19')](function(_0x5c74d9){logger[_0xd29d('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x3e9be6,_0x5c74d9);_0x189623(_0x5c74d9);});});}exports[_0xd29d('0x1a')]=function(_0x14ade0){var _0x19dba3=this;return new Promise(function(_0x436af6,_0x3b5a9f){return db['WhatsappQueue'][_0xd29d('0x1b')]({'raw':_0x14ade0['options']?_0x14ade0[_0xd29d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x14ade0[_0xd29d('0x1c')]?_0x14ade0['options'][_0xd29d('0x1d')]||null:null,'attributes':_0x14ade0[_0xd29d('0x1c')]?_0x14ade0[_0xd29d('0x1c')][_0xd29d('0x1e')]||null:null,'limit':_0x14ade0[_0xd29d('0x1c')]?_0x14ade0['options'][_0xd29d('0x1f')]||null:null,'include':_0x14ade0[_0xd29d('0x1c')]?_0x14ade0[_0xd29d('0x1c')][_0xd29d('0x20')]?_[_0xd29d('0x21')](_0x14ade0['options'][_0xd29d('0x20')],function(_0x2745e3){return{'model':db[_0x2745e3[_0xd29d('0x22')]],'as':_0x2745e3['as'],'attributes':_0x2745e3[_0xd29d('0x1e')],'include':_0x2745e3[_0xd29d('0x20')]?_['map'](_0x2745e3[_0xd29d('0x20')],function(_0x1d455b){return{'model':db[_0x1d455b[_0xd29d('0x22')]],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0xd29d('0x20')]?_[_0xd29d('0x21')](_0x1d455b['include'],function(_0x377b3f){return{'model':db[_0x377b3f[_0xd29d('0x22')]],'as':_0x377b3f['as'],'attributes':_0x377b3f[_0xd29d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd29d('0x23')](function(_0x241369){logger[_0xd29d('0x10')](_0xd29d('0x1a'),_0x14ade0);logger[_0xd29d('0x13')](_0xd29d('0x1a'),_0x14ade0,JSON['stringify'](_0x241369));_0x436af6(_0x241369);})['catch'](function(_0x5d2a06){logger[_0xd29d('0x15')]('GetWhatsappQueue',_0x5d2a06[_0xd29d('0x17')],_0x14ade0);_0x3b5a9f(_0x19dba3['error'](0x1f4,_0x5d2a06['message']));});});};exports[_0xd29d('0x24')]=function(_0x142c86){var _0x240533=this;return new Promise(function(_0x1a7976,_0x3769d6){return db['WhatsappQueue'][_0xd29d('0x25')]({'raw':_0x142c86['options']?_0x142c86[_0xd29d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x142c86[_0xd29d('0x1c')]?_0x142c86[_0xd29d('0x1c')][_0xd29d('0x1d')]||null:null,'attributes':_0x142c86['options']?_0x142c86['options'][_0xd29d('0x1e')]||null:null,'include':_0x142c86[_0xd29d('0x1c')]?_0x142c86[_0xd29d('0x1c')]['include']?_['map'](_0x142c86[_0xd29d('0x1c')][_0xd29d('0x20')],function(_0x5e989c){return{'model':db[_0x5e989c[_0xd29d('0x22')]],'as':_0x5e989c['as'],'attributes':_0x5e989c['attributes'],'include':_0x5e989c[_0xd29d('0x20')]?_['map'](_0x5e989c['include'],function(_0x5337b1){return{'model':db[_0x5337b1[_0xd29d('0x22')]],'as':_0x5337b1['as'],'attributes':_0x5337b1[_0xd29d('0x1e')],'include':_0x5337b1[_0xd29d('0x20')]?_[_0xd29d('0x21')](_0x5337b1[_0xd29d('0x20')],function(_0x5588f6){return{'model':db[_0x5588f6[_0xd29d('0x22')]],'as':_0x5588f6['as'],'attributes':_0x5588f6[_0xd29d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd29d('0x23')](function(_0x245f4d){logger[_0xd29d('0x10')](_0xd29d('0x24'),_0x142c86);logger['debug'](_0xd29d('0x24'),_0x142c86,JSON[_0xd29d('0x14')](_0x245f4d));_0x1a7976(_0x245f4d);})[_0xd29d('0x19')](function(_0xe02ad0){logger['error']('ShowWhatsappQueue',_0xe02ad0['message'],_0x142c86);_0x3769d6(_0x240533[_0xd29d('0x15')](0x1f4,_0xe02ad0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 05f5b65..19bf6b6 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 _0x9b0d=['register','save','remove','update','emit','removeListener'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x9b0d,0x67));var _0xd9b0=function(_0x27aa8b,_0x53cc86){_0x27aa8b=_0x27aa8b-0x0;var _0x24346b=_0x9b0d[_0x27aa8b];return _0x24346b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd9b0('0x0'),_0xd9b0('0x1'),_0xd9b0('0x2')];function createListener(_0x20aefb,_0x350200){return function(_0xc1c506){_0x350200[_0xd9b0('0x3')](_0x20aefb,_0xc1c506);};}function removeListener(_0x58aaba,_0x478e7d){return function(){WhatsappQueueEvents[_0xd9b0('0x4')](_0x58aaba,_0x478e7d);};}exports[_0xd9b0('0x5')]=function(_0xef994c){for(var _0x19b45e=0x0,_0x195730=events['length'];_0x19b45e<_0x195730;_0x19b45e++){var _0xcc92d3=events[_0x19b45e];var _0x322d66=createListener('whatsappQueue:'+_0xcc92d3,_0xef994c);WhatsappQueueEvents['on'](_0xcc92d3,_0x322d66);}}; \ No newline at end of file +var _0xf59f=['length','whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf59f,0xda));var _0xff59=function(_0x1d27ee,_0x43f228){_0x1d27ee=_0x1d27ee-0x0;var _0x4ed9b5=_0xf59f[_0x1d27ee];return _0x4ed9b5;};'use strict';var WhatsappQueueEvents=require(_0xff59('0x0'));var events=[_0xff59('0x1'),'remove',_0xff59('0x2')];function createListener(_0x5bc817,_0x3d802b){return function(_0x4e6e5b){_0x3d802b[_0xff59('0x3')](_0x5bc817,_0x4e6e5b);};}function removeListener(_0x1bc277,_0x566360){return function(){WhatsappQueueEvents[_0xff59('0x4')](_0x1bc277,_0x566360);};}exports[_0xff59('0x5')]=function(_0x22f2d9){for(var _0xdd4aa1=0x0,_0x3103c7=events[_0xff59('0x6')];_0xdd4aa1<_0x3103c7;_0xdd4aa1++){var _0x2a352b=events[_0xdd4aa1];var _0x304991=createListener(_0xff59('0x7')+_0x2a352b,_0x22f2d9);WhatsappQueueEvents['on'](_0x2a352b,_0x304991);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b5903fd..9a7438f 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 _0xc742=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy'];(function(_0x56f7e4,_0x197d40){var _0x10ba7a=function(_0x3b1bb4){while(--_0x3b1bb4){_0x56f7e4['push'](_0x56f7e4['shift']());}};_0x10ba7a(++_0x197d40);}(_0xc742,0x86));var _0x2c74=function(_0x3d8b49,_0x34cbcb){_0x3d8b49=_0x3d8b49-0x0;var _0xf418d8=_0xc742[_0x3d8b49];return _0xf418d8;};'use strict';var multer=require(_0x2c74('0x0'));var util=require(_0x2c74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2c74('0x2'));var router=express[_0x2c74('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c74('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2c74('0x5'));var controller=require(_0x2c74('0x6'));router[_0x2c74('0x7')]('/',auth[_0x2c74('0x8')](),controller[_0x2c74('0x9')]);router[_0x2c74('0x7')](_0x2c74('0xa'),auth[_0x2c74('0x8')](),controller[_0x2c74('0xb')]);router['get'](_0x2c74('0xc'),auth[_0x2c74('0x8')](),controller[_0x2c74('0xd')]);router[_0x2c74('0xe')]('/',auth[_0x2c74('0x8')](),controller['create']);router[_0x2c74('0xf')](_0x2c74('0xc'),auth[_0x2c74('0x8')](),controller['update']);router[_0x2c74('0x10')](_0x2c74('0xc'),auth[_0x2c74('0x8')](),controller[_0x2c74('0x11')]);module[_0x2c74('0x12')]=router; \ No newline at end of file +var _0xce3e=['index','/describe','/:id','isAuthenticated','show','post','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x1a9c88,_0x35de4d){var _0x56329c=function(_0x4affa9){while(--_0x4affa9){_0x1a9c88['push'](_0x1a9c88['shift']());}};_0x56329c(++_0x35de4d);}(_0xce3e,0x13b));var _0xece3=function(_0xbeb0e4,_0x204d46){_0xbeb0e4=_0xbeb0e4-0x0;var _0x3783e5=_0xce3e[_0xbeb0e4];return _0x3783e5;};'use strict';var multer=require(_0xece3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xece3('0x1'));var express=require(_0xece3('0x2'));var router=express[_0xece3('0x3')]();var fs_extra=require(_0xece3('0x4'));var auth=require(_0xece3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xece3('0x6'));var controller=require(_0xece3('0x7'));router[_0xece3('0x8')]('/',auth['isAuthenticated'](),controller[_0xece3('0x9')]);router[_0xece3('0x8')](_0xece3('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xece3('0xb'),auth[_0xece3('0xc')](),controller[_0xece3('0xd')]);router[_0xece3('0xe')]('/',auth[_0xece3('0xc')](),controller['create']);router['put']('/:id',auth[_0xece3('0xc')](),controller[_0xece3('0xf')]);router['delete'](_0xece3('0xb'),auth[_0xece3('0xc')](),controller[_0xece3('0x10')]);module[_0xece3('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 15d07f9..2f84f10 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(_0x306d13,_0x20e3ab){var _0x4700c3=function(_0x2a3cf8){while(--_0x2a3cf8){_0x306d13['push'](_0x306d13['shift']());}};_0x4700c3(++_0x20e3ab);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x6dccb8,_0x3e0466){var _0xe8bb25=function(_0x5a842e){while(--_0x5a842e){_0x6dccb8['push'](_0x6dccb8['shift']());}};_0xe8bb25(++_0x3e0466);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 9c2e351..1f22858 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 _0x34b7=['WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','show','params','includeAll','include','find','catch','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x34b7,0x196));var _0x734b=function(_0x49f509,_0x5c7395){_0x49f509=_0x49f509-0x0;var _0x1250d2=_0x34b7[_0x49f509];return _0x1250d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x26')]();});}};}function handleEntityNotFound(_0x3abbe6,_0x44ffa9){return function(_0x148abe){if(!_0x148abe){_0x3abbe6[_0x734b('0x18')](0x194);}return _0x148abe;};}function handleError(_0x566d55,_0x49732b){_0x49732b=_0x49732b||0x1f4;return function(_0x13cc5a){logger[_0x734b('0x27')](_0x13cc5a['stack']);if(_0x13cc5a[_0x734b('0x28')]){delete _0x13cc5a[_0x734b('0x28')];}_0x566d55[_0x734b('0x19')](_0x49732b)[_0x734b('0x29')](_0x13cc5a);};}exports[_0x734b('0x2a')]=function(_0x1b8295,_0x3ba39c){var _0x5c6c5d={},_0x1f3652={},_0x436efe={'count':0x0,'rows':[]};var _0x42e9ae=_[_0x734b('0x2b')](db[_0x734b('0x2c')][_0x734b('0x2d')],function(_0x1fed72){return{'name':_0x1fed72[_0x734b('0x2e')],'type':_0x1fed72[_0x734b('0x2f')][_0x734b('0x30')]};});_0x1f3652['model']=_[_0x734b('0x2b')](_0x42e9ae,_0x734b('0x28'));_0x1f3652['query']=_[_0x734b('0x31')](_0x1b8295[_0x734b('0x32')]);_0x1f3652[_0x734b('0x33')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],_0x1f3652[_0x734b('0x32')]);_0x5c6c5d[_0x734b('0x36')]=_[_0x734b('0x34')](_0x1f3652[_0x734b('0x35')],qs[_0x734b('0x37')](_0x1b8295[_0x734b('0x32')][_0x734b('0x37')]));_0x5c6c5d[_0x734b('0x36')]=_0x5c6c5d[_0x734b('0x36')][_0x734b('0x38')]?_0x5c6c5d['attributes']:_0x1f3652[_0x734b('0x35')];if(!_0x1b8295['query'][_0x734b('0x39')](_0x734b('0x3a'))){_0x5c6c5d[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x1b8295[_0x734b('0x32')][_0x734b('0x1e')]);_0x5c6c5d['offset']=qs['offset'](_0x1b8295[_0x734b('0x32')]['offset']);}_0x5c6c5d[_0x734b('0x3b')]=qs['sort'](_0x1b8295[_0x734b('0x32')]['sort']);_0x5c6c5d[_0x734b('0x3c')]=qs['filters'](_[_0x734b('0x3d')](_0x1b8295[_0x734b('0x32')],_0x1f3652[_0x734b('0x33')]),_0x42e9ae);if(_0x1b8295[_0x734b('0x32')][_0x734b('0x3e')]){_0x5c6c5d[_0x734b('0x3c')]=_[_0x734b('0x3f')](_0x5c6c5d['where'],{'$or':_[_0x734b('0x2b')](_0x42e9ae,function(_0x317d32){if(_0x317d32['type']!==_0x734b('0x40')){var _0x309b31={};_0x309b31[_0x317d32[_0x734b('0x28')]]={'$like':'%'+_0x1b8295[_0x734b('0x32')]['filter']+'%'};return _0x309b31;}})});}_0x5c6c5d=_[_0x734b('0x3f')]({},_0x5c6c5d,_0x1b8295[_0x734b('0x41')]);var _0x4efb1f={'where':_0x5c6c5d[_0x734b('0x3c')]};return db[_0x734b('0x2c')]['count'](_0x4efb1f)[_0x734b('0x24')](function(_0x2d8f31){_0x436efe[_0x734b('0x1d')]=_0x2d8f31;if(_0x1b8295[_0x734b('0x32')]['includeAll']){_0x5c6c5d['include']=[{'all':!![]}];}return db[_0x734b('0x2c')]['findAll'](_0x5c6c5d);})['then'](function(_0x121a00){_0x436efe['rows']=_0x121a00;return _0x436efe;})[_0x734b('0x24')](respondWithFilteredResult(_0x3ba39c,_0x5c6c5d))['catch'](handleError(_0x3ba39c,null));};exports[_0x734b('0x42')]=function(_0x337106,_0xe4fe38){var _0x4c3fdc={'raw':!![],'where':{'id':_0x337106[_0x734b('0x43')]['id']}},_0x5cf3a0={};_0x5cf3a0['model']=_['keys'](db[_0x734b('0x2c')][_0x734b('0x2d')]);_0x5cf3a0['query']=_[_0x734b('0x31')](_0x337106['query']);_0x5cf3a0[_0x734b('0x33')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],_0x5cf3a0['query']);_0x4c3fdc[_0x734b('0x36')]=_[_0x734b('0x34')](_0x5cf3a0[_0x734b('0x35')],qs[_0x734b('0x37')](_0x337106['query']['fields']));_0x4c3fdc['attributes']=_0x4c3fdc[_0x734b('0x36')]['length']?_0x4c3fdc['attributes']:_0x5cf3a0[_0x734b('0x35')];if(_0x337106['query'][_0x734b('0x44')]){_0x4c3fdc[_0x734b('0x45')]=[{'all':!![]}];}_0x4c3fdc=_[_0x734b('0x3f')]({},_0x4c3fdc,_0x337106[_0x734b('0x41')]);return db['WhatsappQueueReport'][_0x734b('0x46')](_0x4c3fdc)['then'](handleEntityNotFound(_0xe4fe38,null))[_0x734b('0x24')](respondWithResult(_0xe4fe38,null))[_0x734b('0x47')](handleError(_0xe4fe38,null));};exports[_0x734b('0x48')]=function(_0x5cdacb,_0x370326){return db['WhatsappQueueReport'][_0x734b('0x48')](_0x5cdacb[_0x734b('0x49')],{})['then'](respondWithResult(_0x370326,0xc9))[_0x734b('0x47')](handleError(_0x370326,null));};exports[_0x734b('0x4a')]=function(_0x145ced,_0x38125a){if(_0x145ced[_0x734b('0x49')]['id']){delete _0x145ced['body']['id'];}return db[_0x734b('0x2c')]['find']({'where':{'id':_0x145ced[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x38125a,null))[_0x734b('0x24')](saveUpdates(_0x145ced[_0x734b('0x49')],null))[_0x734b('0x24')](respondWithResult(_0x38125a,null))[_0x734b('0x47')](handleError(_0x38125a,null));};exports[_0x734b('0x25')]=function(_0x4b70f2,_0x4c0378){return db['WhatsappQueueReport'][_0x734b('0x46')]({'where':{'id':_0x4b70f2[_0x734b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c0378,null))[_0x734b('0x24')](removeEntity(_0x4c0378,null))[_0x734b('0x47')](handleError(_0x4c0378,null));};exports['describe']=function(_0x167173,_0x3a9749){return db[_0x734b('0x2c')]['describe']()[_0x734b('0x24')](respondWithResult(_0x3a9749,null))[_0x734b('0x47')](handleError(_0x3a9749,null));}; \ No newline at end of file +var _0x9c00=['fields','length','nolimit','offset','order','sort','pick','type','VIRTUAL','filter','options','where','then','include','findAll','rows','catch','show','params','keys','includeAll','merge','create','body','find','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','key','model','query','filters','intersection','attributes'];(function(_0x19ec36,_0x488837){var _0x105202=function(_0x13497e){while(--_0x13497e){_0x19ec36['push'](_0x19ec36['shift']());}};_0x105202(++_0x488837);}(_0x9c00,0x1a0));var _0x09c0=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x9c00[_0x10852d];return _0x13a8d6;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x56d883,_0x2c7202){return function(_0x163a59){if(!_0x163a59){_0x56d883[_0x09c0('0x1b')](0x194);}return _0x163a59;};}function handleError(_0x30c2a1,_0x1f8131){_0x1f8131=_0x1f8131||0x1f4;return function(_0x1d2d9d){logger[_0x09c0('0x27')](_0x1d2d9d[_0x09c0('0x28')]);if(_0x1d2d9d[_0x09c0('0x29')]){delete _0x1d2d9d[_0x09c0('0x29')];}_0x30c2a1[_0x09c0('0x1c')](_0x1f8131)['send'](_0x1d2d9d);};}exports[_0x09c0('0x2a')]=function(_0x1bdde9,_0x53a7b8){var _0x1d09e0={},_0x5aa0b9={},_0x3f5b10={'count':0x0,'rows':[]};var _0x4d6bdc=_[_0x09c0('0x2b')](db[_0x09c0('0x2c')][_0x09c0('0x2d')],function(_0x4159bc){return{'name':_0x4159bc['fieldName'],'type':_0x4159bc['type'][_0x09c0('0x2e')]};});_0x5aa0b9[_0x09c0('0x2f')]=_[_0x09c0('0x2b')](_0x4d6bdc,'name');_0x5aa0b9[_0x09c0('0x30')]=_['keys'](_0x1bdde9[_0x09c0('0x30')]);_0x5aa0b9[_0x09c0('0x31')]=_[_0x09c0('0x32')](_0x5aa0b9['model'],_0x5aa0b9[_0x09c0('0x30')]);_0x1d09e0[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x5aa0b9[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x34')]));_0x1d09e0['attributes']=_0x1d09e0[_0x09c0('0x33')][_0x09c0('0x35')]?_0x1d09e0[_0x09c0('0x33')]:_0x5aa0b9[_0x09c0('0x2f')];if(!_0x1bdde9[_0x09c0('0x30')]['hasOwnProperty'](_0x09c0('0x36'))){_0x1d09e0[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x20')]);_0x1d09e0['offset']=qs[_0x09c0('0x37')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x37')]);}_0x1d09e0[_0x09c0('0x38')]=qs[_0x09c0('0x39')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x39')]);_0x1d09e0['where']=qs[_0x09c0('0x31')](_[_0x09c0('0x3a')](_0x1bdde9[_0x09c0('0x30')],_0x5aa0b9[_0x09c0('0x31')]),_0x4d6bdc);if(_0x1bdde9[_0x09c0('0x30')]['filter']){_0x1d09e0['where']=_['merge'](_0x1d09e0['where'],{'$or':_[_0x09c0('0x2b')](_0x4d6bdc,function(_0x15c631){if(_0x15c631[_0x09c0('0x3b')]!==_0x09c0('0x3c')){var _0x1a8c0c={};_0x1a8c0c[_0x15c631['name']]={'$like':'%'+_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x3d')]+'%'};return _0x1a8c0c;}})});}_0x1d09e0=_['merge']({},_0x1d09e0,_0x1bdde9[_0x09c0('0x3e')]);var _0x5d50b9={'where':_0x1d09e0[_0x09c0('0x3f')]};return db['WhatsappQueueReport'][_0x09c0('0x21')](_0x5d50b9)[_0x09c0('0x40')](function(_0x56a511){_0x3f5b10[_0x09c0('0x21')]=_0x56a511;if(_0x1bdde9[_0x09c0('0x30')]['includeAll']){_0x1d09e0[_0x09c0('0x41')]=[{'all':!![]}];}return db[_0x09c0('0x2c')][_0x09c0('0x42')](_0x1d09e0);})[_0x09c0('0x40')](function(_0xeb8191){_0x3f5b10[_0x09c0('0x43')]=_0xeb8191;return _0x3f5b10;})['then'](respondWithFilteredResult(_0x53a7b8,_0x1d09e0))[_0x09c0('0x44')](handleError(_0x53a7b8,null));};exports[_0x09c0('0x45')]=function(_0x2d6344,_0x57835c){var _0x193ed2={'raw':!![],'where':{'id':_0x2d6344[_0x09c0('0x46')]['id']}},_0x30c0c5={};_0x30c0c5['model']=_[_0x09c0('0x47')](db[_0x09c0('0x2c')]['rawAttributes']);_0x30c0c5['query']=_[_0x09c0('0x47')](_0x2d6344[_0x09c0('0x30')]);_0x30c0c5['filters']=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],_0x30c0c5['query']);_0x193ed2[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x2d6344[_0x09c0('0x30')]['fields']));_0x193ed2[_0x09c0('0x33')]=_0x193ed2['attributes']['length']?_0x193ed2[_0x09c0('0x33')]:_0x30c0c5[_0x09c0('0x2f')];if(_0x2d6344[_0x09c0('0x30')][_0x09c0('0x48')]){_0x193ed2[_0x09c0('0x41')]=[{'all':!![]}];}_0x193ed2=_[_0x09c0('0x49')]({},_0x193ed2,_0x2d6344['options']);return db['WhatsappQueueReport']['find'](_0x193ed2)[_0x09c0('0x40')](handleEntityNotFound(_0x57835c,null))[_0x09c0('0x40')](respondWithResult(_0x57835c,null))[_0x09c0('0x44')](handleError(_0x57835c,null));};exports['create']=function(_0xdf1553,_0xff9650){return db[_0x09c0('0x2c')][_0x09c0('0x4a')](_0xdf1553[_0x09c0('0x4b')],{})[_0x09c0('0x40')](respondWithResult(_0xff9650,0xc9))[_0x09c0('0x44')](handleError(_0xff9650,null));};exports[_0x09c0('0x25')]=function(_0x3f6d14,_0x38085c){if(_0x3f6d14[_0x09c0('0x4b')]['id']){delete _0x3f6d14[_0x09c0('0x4b')]['id'];}return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x3f6d14[_0x09c0('0x46')]['id']}})[_0x09c0('0x40')](handleEntityNotFound(_0x38085c,null))[_0x09c0('0x40')](saveUpdates(_0x3f6d14[_0x09c0('0x4b')],null))[_0x09c0('0x40')](respondWithResult(_0x38085c,null))[_0x09c0('0x44')](handleError(_0x38085c,null));};exports['destroy']=function(_0x4acf54,_0x44befb){return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x4acf54[_0x09c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x44befb,null))[_0x09c0('0x40')](removeEntity(_0x44befb,null))[_0x09c0('0x44')](handleError(_0x44befb,null));};exports[_0x09c0('0x4d')]=function(_0x4a92c0,_0xe0b82a){return db[_0x09c0('0x2c')][_0x09c0('0x4d')]()[_0x09c0('0x40')](respondWithResult(_0xe0b82a,null))[_0x09c0('0x44')](handleError(_0xe0b82a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 5a04b9d..cb45ebe 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 _0x450d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger'];(function(_0x3f0b1f,_0x5554cb){var _0x123659=function(_0x2ee993){while(--_0x2ee993){_0x3f0b1f['push'](_0x3f0b1f['shift']());}};_0x123659(++_0x5554cb);}(_0x450d,0x6b));var _0xd450=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x450d[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd450('0x0'))(_0xd450('0x1'));var moment=require(_0xd450('0x2'));var BPromise=require(_0xd450('0x3'));var rp=require(_0xd450('0x4'));var fs=require('fs');var path=require(_0xd450('0x5'));var rimraf=require(_0xd450('0x6'));var config=require(_0xd450('0x7'));var attributes=require(_0xd450('0x8'));module['exports']=function(_0x2f353f,_0x5df419){return _0x2f353f['define'](_0xd450('0x9'),attributes,{'tableName':_0xd450('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd450('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3993=['request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x4080f3,_0x18eb36){var _0x3314f5=function(_0x58d499){while(--_0x58d499){_0x4080f3['push'](_0x4080f3['shift']());}};_0x3314f5(++_0x18eb36);}(_0x3993,0x1d7));var _0x3399=function(_0x252204,_0x186460){_0x252204=_0x252204-0x0;var _0x1ff50b=_0x3993[_0x252204];return _0x1ff50b;};'use strict';var _=require('lodash');var util=require(_0x3399('0x0'));var logger=require(_0x3399('0x1'))(_0x3399('0x2'));var moment=require(_0x3399('0x3'));var BPromise=require(_0x3399('0x4'));var rp=require(_0x3399('0x5'));var fs=require('fs');var path=require(_0x3399('0x6'));var rimraf=require(_0x3399('0x7'));var config=require('../../config/environment');var attributes=require(_0x3399('0x8'));module[_0x3399('0x9')]=function(_0x46afae,_0x406593){return _0x46afae[_0x3399('0xa')](_0x3399('0xb'),attributes,{'tableName':_0x3399('0xc'),'paranoid':![],'indexes':[{'name':_0x3399('0xd'),'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 51fe827..c476109 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 _0xba36=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','body','options','CreateWhatsappQueueReport','stringify','catch','WhatsappQueueReport','update','where','attributes','UpdateWhatsappQueueReport','lodash','util','moment'];(function(_0x101c18,_0x608208){var _0x16de76=function(_0xb01c58){while(--_0xb01c58){_0x101c18['push'](_0x101c18['shift']());}};_0x16de76(++_0x608208);}(_0xba36,0x17d));var _0x6ba3=function(_0x274151,_0x374a3d){_0x274151=_0x274151-0x0;var _0x570223=_0xba36[_0x274151];return _0x570223;};'use strict';var _=require(_0x6ba3('0x0'));var util=require(_0x6ba3('0x1'));var moment=require(_0x6ba3('0x2'));var BPromise=require(_0x6ba3('0x3'));var rs=require(_0x6ba3('0x4'));var fs=require('fs');var Redis=require(_0x6ba3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ba3('0x6'))(_0x6ba3('0x7'));var config=require(_0x6ba3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ba3('0x9')][_0x6ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101be7,_0x2a8d20,_0x369794){return new BPromise(function(_0x1a29ef,_0x112bf2){return client[_0x6ba3('0xb')](_0x101be7,_0x369794)[_0x6ba3('0xc')](function(_0x329875){logger[_0x6ba3('0xd')](_0x6ba3('0xe'),_0x2a8d20,_0x6ba3('0xf'));logger[_0x6ba3('0x10')](_0x6ba3('0x11'),_0x2a8d20,_0x6ba3('0xf'),JSON['stringify'](_0x329875));if(_0x329875[_0x6ba3('0x12')]){if(_0x329875[_0x6ba3('0x12')][_0x6ba3('0x13')]===0x1f4){logger[_0x6ba3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2a8d20,_0x329875[_0x6ba3('0x12')][_0x6ba3('0x14')]);return _0x112bf2(_0x329875[_0x6ba3('0x12')][_0x6ba3('0x14')]);}logger[_0x6ba3('0x12')](_0x6ba3('0xe'),_0x2a8d20,_0x329875[_0x6ba3('0x12')][_0x6ba3('0x14')]);return _0x1a29ef(_0x329875['error'][_0x6ba3('0x14')]);}else{logger[_0x6ba3('0xd')](_0x6ba3('0xe'),_0x2a8d20,'request\x20sent');_0x1a29ef(_0x329875[_0x6ba3('0x15')][_0x6ba3('0x14')]);}})['catch'](function(_0x49251e){logger[_0x6ba3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2a8d20,_0x49251e);_0x112bf2(_0x49251e);});});}exports['CreateWhatsappQueueReport']=function(_0x592a6f){var _0x298f47=this;return new Promise(function(_0x171349,_0x553e5a){return db['WhatsappQueueReport']['create'](_0x592a6f[_0x6ba3('0x16')],{'raw':_0x592a6f[_0x6ba3('0x17')]?_0x592a6f['options']['raw']===undefined?!![]:![]:!![]})[_0x6ba3('0xc')](function(_0x507891){logger[_0x6ba3('0xd')](_0x6ba3('0x18'),_0x592a6f);logger[_0x6ba3('0x10')](_0x6ba3('0x18'),_0x592a6f,JSON[_0x6ba3('0x19')](_0x507891));_0x171349(_0x507891);})[_0x6ba3('0x1a')](function(_0x4a7bdc){logger[_0x6ba3('0x12')](_0x6ba3('0x18'),_0x4a7bdc[_0x6ba3('0x14')],_0x592a6f);_0x553e5a(_0x298f47[_0x6ba3('0x12')](0x1f4,_0x4a7bdc[_0x6ba3('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x103997){var _0x52203b=this;return new Promise(function(_0x45437a,_0x5db805){return db[_0x6ba3('0x1b')][_0x6ba3('0x1c')](_0x103997['body'],{'raw':_0x103997[_0x6ba3('0x17')]?_0x103997['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x103997[_0x6ba3('0x17')]?_0x103997[_0x6ba3('0x17')][_0x6ba3('0x1d')]||null:null,'attributes':_0x103997[_0x6ba3('0x17')]?_0x103997[_0x6ba3('0x17')][_0x6ba3('0x1e')]||null:null,'limit':_0x103997['options']?_0x103997['options']['limit']||null:null})[_0x6ba3('0xc')](function(_0x519d74){logger[_0x6ba3('0xd')](_0x6ba3('0x1f'),_0x103997);logger[_0x6ba3('0x10')](_0x6ba3('0x1f'),_0x103997,JSON[_0x6ba3('0x19')](_0x519d74));_0x45437a(_0x519d74);})[_0x6ba3('0x1a')](function(_0x332477){logger['error'](_0x6ba3('0x1f'),_0x332477['message'],_0x103997);_0x5db805(_0x52203b[_0x6ba3('0x12')](0x1f4,_0x332477[_0x6ba3('0x14')]));});});}; \ No newline at end of file +var _0x2527=['error','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x26462e,_0x416ff7){var _0x31c3f0=function(_0xd387ea){while(--_0xd387ea){_0x26462e['push'](_0x26462e['shift']());}};_0x31c3f0(++_0x416ff7);}(_0x2527,0xf5));var _0x7252=function(_0xca22ba,_0x201b8c){_0xca22ba=_0xca22ba-0x0;var _0x2ca134=_0x2527[_0xca22ba];return _0x2ca134;};'use strict';var _=require(_0x7252('0x0'));var util=require(_0x7252('0x1'));var moment=require(_0x7252('0x2'));var BPromise=require(_0x7252('0x3'));var rs=require(_0x7252('0x4'));var fs=require('fs');var Redis=require(_0x7252('0x5'));var db=require(_0x7252('0x6'))['db'];var utils=require(_0x7252('0x7'));var logger=require(_0x7252('0x8'))(_0x7252('0x9'));var config=require(_0x7252('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7252('0xb')][_0x7252('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34c51c,_0x4d17e1,_0x29d182){return new BPromise(function(_0x27ffcf,_0x2f218e){return client['request'](_0x34c51c,_0x29d182)[_0x7252('0xd')](function(_0x3c42c9){logger[_0x7252('0xe')](_0x7252('0xf'),_0x4d17e1,_0x7252('0x10'));logger[_0x7252('0x11')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4d17e1,_0x7252('0x10'),JSON[_0x7252('0x12')](_0x3c42c9));if(_0x3c42c9[_0x7252('0x13')]){if(_0x3c42c9['error']['code']===0x1f4){logger[_0x7252('0x13')](_0x7252('0xf'),_0x4d17e1,_0x3c42c9[_0x7252('0x13')][_0x7252('0x14')]);return _0x2f218e(_0x3c42c9['error'][_0x7252('0x14')]);}logger[_0x7252('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d17e1,_0x3c42c9[_0x7252('0x13')][_0x7252('0x14')]);return _0x27ffcf(_0x3c42c9['error'][_0x7252('0x14')]);}else{logger[_0x7252('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d17e1,_0x7252('0x10'));_0x27ffcf(_0x3c42c9[_0x7252('0x15')][_0x7252('0x14')]);}})[_0x7252('0x16')](function(_0x3ba9ca){logger['error'](_0x7252('0xf'),_0x4d17e1,_0x3ba9ca);_0x2f218e(_0x3ba9ca);});});}exports['CreateWhatsappQueueReport']=function(_0x24f4f9){var _0x422a90=this;return new Promise(function(_0x35125b,_0x3a2f01){return db[_0x7252('0x17')][_0x7252('0x18')](_0x24f4f9[_0x7252('0x19')],{'raw':_0x24f4f9[_0x7252('0x1a')]?_0x24f4f9[_0x7252('0x1a')][_0x7252('0x1b')]===undefined?!![]:![]:!![]})[_0x7252('0xd')](function(_0x5a733e){logger[_0x7252('0xe')]('CreateWhatsappQueueReport',_0x24f4f9);logger['debug']('CreateWhatsappQueueReport',_0x24f4f9,JSON[_0x7252('0x12')](_0x5a733e));_0x35125b(_0x5a733e);})[_0x7252('0x16')](function(_0x348916){logger[_0x7252('0x13')](_0x7252('0x1c'),_0x348916[_0x7252('0x14')],_0x24f4f9);_0x3a2f01(_0x422a90['error'](0x1f4,_0x348916[_0x7252('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x92a2f4){var _0x483af1=this;return new Promise(function(_0x5660d8,_0x54afd7){return db[_0x7252('0x17')]['update'](_0x92a2f4[_0x7252('0x19')],{'raw':_0x92a2f4[_0x7252('0x1a')]?_0x92a2f4[_0x7252('0x1a')][_0x7252('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x92a2f4[_0x7252('0x1a')]?_0x92a2f4[_0x7252('0x1a')][_0x7252('0x1d')]||null:null,'attributes':_0x92a2f4[_0x7252('0x1a')]?_0x92a2f4[_0x7252('0x1a')][_0x7252('0x1e')]||null:null,'limit':_0x92a2f4[_0x7252('0x1a')]?_0x92a2f4['options'][_0x7252('0x1f')]||null:null})[_0x7252('0xd')](function(_0x178c4f){logger[_0x7252('0xe')](_0x7252('0x20'),_0x92a2f4);logger[_0x7252('0x11')](_0x7252('0x20'),_0x92a2f4,JSON[_0x7252('0x12')](_0x178c4f));_0x5660d8(_0x178c4f);})[_0x7252('0x16')](function(_0x2ff451){logger[_0x7252('0x13')]('UpdateWhatsappQueueReport',_0x2ff451[_0x7252('0x14')],_0x92a2f4);_0x54afd7(_0x483af1[_0x7252('0x13')](0x1f4,_0x2ff451[_0x7252('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 346a8d3..3c0deaa 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 _0x032d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x4ad16a,_0x689fb4){var _0x276304=function(_0x29530f){while(--_0x29530f){_0x4ad16a['push'](_0x4ad16a['shift']());}};_0x276304(++_0x689fb4);}(_0x032d,0xcc));var _0xd032=function(_0x4c5e9f,_0x195e7d){_0x4c5e9f=_0x4c5e9f-0x0;var _0x38857a=_0x032d[_0x4c5e9f];return _0x38857a;};'use strict';var multer=require(_0xd032('0x0'));var util=require(_0xd032('0x1'));var path=require('path');var timeout=require(_0xd032('0x2'));var express=require(_0xd032('0x3'));var router=express['Router']();var fs_extra=require(_0xd032('0x4'));var auth=require(_0xd032('0x5'));var interaction=require(_0xd032('0x6'));var config=require(_0xd032('0x7'));var controller=require(_0xd032('0x8'));router['get']('/',auth[_0xd032('0x9')](),controller[_0xd032('0xa')]);router[_0xd032('0xb')](_0xd032('0xc'),auth[_0xd032('0x9')](),controller['describe']);router[_0xd032('0xb')](_0xd032('0xd'),auth['isAuthenticated'](),controller[_0xd032('0xe')]);router['post']('/',auth[_0xd032('0x9')](),controller[_0xd032('0xf')]);router[_0xd032('0x10')](_0xd032('0xd'),auth[_0xd032('0x9')](),controller['update']);router[_0xd032('0x11')](_0xd032('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd032('0x12')]=router; \ No newline at end of file +var _0xc11f=['exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x19dd95,_0x3eef82){var _0x5127d9=function(_0x14e6de){while(--_0x14e6de){_0x19dd95['push'](_0x19dd95['shift']());}};_0x5127d9(++_0x3eef82);}(_0xc11f,0x100));var _0xfc11=function(_0x18c7e4,_0x1691a0){_0x18c7e4=_0x18c7e4-0x0;var _0x3d059b=_0xc11f[_0x18c7e4];return _0x3d059b;};'use strict';var multer=require(_0xfc11('0x0'));var util=require('util');var path=require(_0xfc11('0x1'));var timeout=require(_0xfc11('0x2'));var express=require('express');var router=express[_0xfc11('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc11('0x4'));var config=require(_0xfc11('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0xfc11('0x6')]('/',auth[_0xfc11('0x7')](),controller['index']);router[_0xfc11('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xfc11('0x8')]);router[_0xfc11('0x6')](_0xfc11('0x9'),auth[_0xfc11('0x7')](),controller[_0xfc11('0xa')]);router[_0xfc11('0xb')]('/',auth['isAuthenticated'](),controller[_0xfc11('0xc')]);router[_0xfc11('0xd')](_0xfc11('0x9'),auth[_0xfc11('0x7')](),controller['update']);router[_0xfc11('0xe')](_0xfc11('0x9'),auth[_0xfc11('0x7')](),controller[_0xfc11('0xf')]);module[_0xfc11('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 33b46cb..706779f 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 _0xdc15=['queue','sequelize','STRING','ENUM','account','agent'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0xdc15[_0x5aef17];return _0x43f9d0;};'use strict';var Sequelize=require(_0x5dc1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5dc1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dc1('0x2')](_0x5dc1('0x3'),_0x5dc1('0x4'),_0x5dc1('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0972=['exports','ENUM','agent','queue'];(function(_0x33ebf5,_0x156cbc){var _0x34cfb7=function(_0x4b5946){while(--_0x4b5946){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x34cfb7(++_0x156cbc);}(_0x0972,0x64));var _0x2097=function(_0xc2ffb9,_0x18a0a8){_0xc2ffb9=_0xc2ffb9-0x0;var _0x422763=_0x0972[_0xc2ffb9];return _0x422763;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2097('0x1')]('account',_0x2097('0x2'),_0x2097('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f4f3e56..0177bce 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 _0x1198=['json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','send','WhatsappTransferReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x5c0578,_0xef465a){var _0x56d793=function(_0x5acf0e){while(--_0x5acf0e){_0x5c0578['push'](_0x5c0578['shift']());}};_0x56d793(++_0xef465a);}(_0x1198,0x1b4));var _0x8119=function(_0x4755db,_0x37366e){_0x4755db=_0x4755db-0x0;var _0xb0e72b=_0x1198[_0x4755db];return _0xb0e72b;};'use strict';var emlformat=require(_0x8119('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8119('0x1'));var jsonpatch=require(_0x8119('0x2'));var rp=require('request-promise');var moment=require(_0x8119('0x3'));var BPromise=require(_0x8119('0x4'));var Mustache=require(_0x8119('0x5'));var util=require(_0x8119('0x6'));var path=require('path');var sox=require(_0x8119('0x7'));var csv=require(_0x8119('0x8'));var ejs=require(_0x8119('0x9'));var fs=require('fs');var fs_extra=require(_0x8119('0xa'));var _=require(_0x8119('0xb'));var squel=require(_0x8119('0xc'));var crypto=require(_0x8119('0xd'));var jsforce=require(_0x8119('0xe'));var deskjs=require(_0x8119('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8119('0x10'));var Redis=require(_0x8119('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8119('0x12'));var hardwareService=require(_0x8119('0x13'));var logger=require(_0x8119('0x14'))('api');var utils=require(_0x8119('0x15'));var config=require(_0x8119('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8119('0x17'))['db'];function respondWithStatusCode(_0x4d2101,_0x451efc){_0x451efc=_0x451efc||0xcc;return function(_0x37b974){if(_0x37b974){return _0x4d2101[_0x8119('0x18')](_0x451efc);}return _0x4d2101[_0x8119('0x19')](_0x451efc)['end']();};}function respondWithResult(_0x58555d,_0x5de0c5){_0x5de0c5=_0x5de0c5||0xc8;return function(_0x4d9cfd){if(_0x4d9cfd){return _0x58555d[_0x8119('0x19')](_0x5de0c5)[_0x8119('0x1a')](_0x4d9cfd);}};}function respondWithFilteredResult(_0x625a1c,_0x26a140){return function(_0x58af62){if(_0x58af62){var _0x2243e2=typeof _0x26a140['offset']===_0x8119('0x1b')&&typeof _0x26a140[_0x8119('0x1c')]===_0x8119('0x1b');var _0x528d52=_0x58af62[_0x8119('0x1d')];var _0x8d78f0=_0x2243e2?0x0:_0x26a140[_0x8119('0x1e')];var _0x5b9c81=_0x2243e2?_0x58af62['count']:_0x26a140[_0x8119('0x1e')]+_0x26a140[_0x8119('0x1c')];var _0x37ffca;if(_0x5b9c81>=_0x528d52){_0x5b9c81=_0x528d52;_0x37ffca=0xc8;}else{_0x37ffca=0xce;}_0x625a1c[_0x8119('0x19')](_0x37ffca);return _0x625a1c[_0x8119('0x1f')](_0x8119('0x20'),_0x8d78f0+'-'+_0x5b9c81+'/'+_0x528d52)[_0x8119('0x1a')](_0x58af62);}return null;};}function patchUpdates(_0x350b5d){return function(_0x5b6bf4){try{jsonpatch[_0x8119('0x21')](_0x5b6bf4,_0x350b5d,!![]);}catch(_0x446c2e){return BPromise['reject'](_0x446c2e);}return _0x5b6bf4[_0x8119('0x22')]();};}function saveUpdates(_0x4bda7f,_0x2781a1){return function(_0x4bc885){if(_0x4bc885){return _0x4bc885[_0x8119('0x23')](_0x4bda7f)[_0x8119('0x24')](function(_0x2919a6){return _0x2919a6;});}return null;};}function removeEntity(_0x5323e7,_0x1cd8c5){return function(_0x19ec0e){if(_0x19ec0e){return _0x19ec0e['destroy']()[_0x8119('0x24')](function(){_0x5323e7[_0x8119('0x19')](0xcc)[_0x8119('0x25')]();});}};}function handleEntityNotFound(_0x43898c,_0x408c3c){return function(_0x2a1776){if(!_0x2a1776){_0x43898c[_0x8119('0x18')](0x194);}return _0x2a1776;};}function handleError(_0x1cafe5,_0x44baa8){_0x44baa8=_0x44baa8||0x1f4;return function(_0x1b14ae){logger[_0x8119('0x26')](_0x1b14ae[_0x8119('0x27')]);if(_0x1b14ae[_0x8119('0x28')]){delete _0x1b14ae[_0x8119('0x28')];}_0x1cafe5['status'](_0x44baa8)[_0x8119('0x29')](_0x1b14ae);};}exports['index']=function(_0x5aabc8,_0x5186b4){var _0x582998={},_0x4c9532={},_0x789a77={'count':0x0,'rows':[]};var _0x543882=_['map'](db[_0x8119('0x2a')]['rawAttributes'],function(_0x3c5d07){return{'name':_0x3c5d07[_0x8119('0x2b')],'type':_0x3c5d07[_0x8119('0x2c')][_0x8119('0x2d')]};});_0x4c9532[_0x8119('0x2e')]=_[_0x8119('0x2f')](_0x543882,_0x8119('0x28'));_0x4c9532[_0x8119('0x30')]=_[_0x8119('0x31')](_0x5aabc8[_0x8119('0x30')]);_0x4c9532['filters']=_[_0x8119('0x32')](_0x4c9532[_0x8119('0x2e')],_0x4c9532['query']);_0x582998[_0x8119('0x33')]=_['intersection'](_0x4c9532['model'],qs['fields'](_0x5aabc8[_0x8119('0x30')][_0x8119('0x34')]));_0x582998[_0x8119('0x33')]=_0x582998[_0x8119('0x33')]['length']?_0x582998[_0x8119('0x33')]:_0x4c9532['model'];if(!_0x5aabc8[_0x8119('0x30')][_0x8119('0x35')](_0x8119('0x36'))){_0x582998['limit']=qs['limit'](_0x5aabc8['query'][_0x8119('0x1c')]);_0x582998[_0x8119('0x1e')]=qs['offset'](_0x5aabc8[_0x8119('0x30')][_0x8119('0x1e')]);}_0x582998['order']=qs[_0x8119('0x37')](_0x5aabc8[_0x8119('0x30')]['sort']);_0x582998['where']=qs[_0x8119('0x38')](_[_0x8119('0x39')](_0x5aabc8[_0x8119('0x30')],_0x4c9532[_0x8119('0x38')]),_0x543882);if(_0x5aabc8['query'][_0x8119('0x3a')]){_0x582998[_0x8119('0x3b')]=_[_0x8119('0x3c')](_0x582998['where'],{'$or':_[_0x8119('0x2f')](_0x543882,function(_0x343224){if(_0x343224[_0x8119('0x2c')]!==_0x8119('0x3d')){var _0x15de89={};_0x15de89[_0x343224['name']]={'$like':'%'+_0x5aabc8[_0x8119('0x30')][_0x8119('0x3a')]+'%'};return _0x15de89;}})});}_0x582998=_['merge']({},_0x582998,_0x5aabc8['options']);var _0x5e6f1e={'where':_0x582998['where']};return db[_0x8119('0x2a')][_0x8119('0x1d')](_0x5e6f1e)['then'](function(_0x22c283){_0x789a77[_0x8119('0x1d')]=_0x22c283;if(_0x5aabc8['query'][_0x8119('0x3e')]){_0x582998[_0x8119('0x3f')]=[{'all':!![]}];}return db[_0x8119('0x2a')][_0x8119('0x40')](_0x582998);})[_0x8119('0x24')](function(_0x23a0f4){_0x789a77[_0x8119('0x41')]=_0x23a0f4;return _0x789a77;})['then'](respondWithFilteredResult(_0x5186b4,_0x582998))[_0x8119('0x42')](handleError(_0x5186b4,null));};exports[_0x8119('0x43')]=function(_0x55eb9b,_0x1aea63){var _0x9ea270={'raw':!![],'where':{'id':_0x55eb9b[_0x8119('0x44')]['id']}},_0x46c99a={};_0x46c99a[_0x8119('0x2e')]=_[_0x8119('0x31')](db[_0x8119('0x2a')][_0x8119('0x45')]);_0x46c99a[_0x8119('0x30')]=_[_0x8119('0x31')](_0x55eb9b['query']);_0x46c99a['filters']=_[_0x8119('0x32')](_0x46c99a['model'],_0x46c99a['query']);_0x9ea270[_0x8119('0x33')]=_[_0x8119('0x32')](_0x46c99a[_0x8119('0x2e')],qs[_0x8119('0x34')](_0x55eb9b[_0x8119('0x30')][_0x8119('0x34')]));_0x9ea270['attributes']=_0x9ea270[_0x8119('0x33')][_0x8119('0x46')]?_0x9ea270[_0x8119('0x33')]:_0x46c99a[_0x8119('0x2e')];if(_0x55eb9b[_0x8119('0x30')][_0x8119('0x3e')]){_0x9ea270['include']=[{'all':!![]}];}_0x9ea270=_[_0x8119('0x3c')]({},_0x9ea270,_0x55eb9b[_0x8119('0x47')]);return db['WhatsappTransferReport'][_0x8119('0x48')](_0x9ea270)[_0x8119('0x24')](handleEntityNotFound(_0x1aea63,null))['then'](respondWithResult(_0x1aea63,null))['catch'](handleError(_0x1aea63,null));};exports[_0x8119('0x49')]=function(_0x40f025,_0x4191ff){return db[_0x8119('0x2a')][_0x8119('0x49')](_0x40f025[_0x8119('0x4a')],{})[_0x8119('0x24')](respondWithResult(_0x4191ff,0xc9))[_0x8119('0x42')](handleError(_0x4191ff,null));};exports[_0x8119('0x23')]=function(_0x5eccf2,_0x5df646){if(_0x5eccf2[_0x8119('0x4a')]['id']){delete _0x5eccf2[_0x8119('0x4a')]['id'];}return db[_0x8119('0x2a')][_0x8119('0x48')]({'where':{'id':_0x5eccf2[_0x8119('0x44')]['id']}})[_0x8119('0x24')](handleEntityNotFound(_0x5df646,null))[_0x8119('0x24')](saveUpdates(_0x5eccf2[_0x8119('0x4a')],null))[_0x8119('0x24')](respondWithResult(_0x5df646,null))[_0x8119('0x42')](handleError(_0x5df646,null));};exports[_0x8119('0x4b')]=function(_0x1cf740,_0x1401c7){return db[_0x8119('0x2a')][_0x8119('0x48')]({'where':{'id':_0x1cf740[_0x8119('0x44')]['id']}})[_0x8119('0x24')](handleEntityNotFound(_0x1401c7,null))[_0x8119('0x24')](removeEntity(_0x1401c7,null))[_0x8119('0x42')](handleError(_0x1401c7,null));};exports[_0x8119('0x4c')]=function(_0x4110b5,_0x38b681){return db[_0x8119('0x2a')][_0x8119('0x4c')]()[_0x8119('0x24')](respondWithResult(_0x38b681,null))['catch'](handleError(_0x38b681,null));}; \ No newline at end of file +var _0xa7f8=['update','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','merge','where','type','options','WhatsappTransferReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body'];(function(_0x27662b,_0x3f3347){var _0x3d4405=function(_0x443f02){while(--_0x443f02){_0x27662b['push'](_0x27662b['shift']());}};_0x3d4405(++_0x3f3347);}(_0xa7f8,0x160));var _0x8a7f=function(_0x321ccf,_0x2e780d){_0x321ccf=_0x321ccf-0x0;var _0x3a9a2a=_0xa7f8[_0x321ccf];return _0x3a9a2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a7f('0x0'));var zipdir=require(_0x8a7f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a7f('0x2'));var moment=require('moment');var BPromise=require(_0x8a7f('0x3'));var Mustache=require(_0x8a7f('0x4'));var util=require(_0x8a7f('0x5'));var path=require('path');var sox=require(_0x8a7f('0x6'));var csv=require(_0x8a7f('0x7'));var ejs=require(_0x8a7f('0x8'));var fs=require('fs');var fs_extra=require(_0x8a7f('0x9'));var _=require(_0x8a7f('0xa'));var squel=require(_0x8a7f('0xb'));var crypto=require(_0x8a7f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8a7f('0xd'));var toCsv=require(_0x8a7f('0x7'));var querystring=require(_0x8a7f('0xe'));var Papa=require('papaparse');var Redis=require(_0x8a7f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a7f('0x10'));var hardwareService=require(_0x8a7f('0x11'));var logger=require('../../config/logger')(_0x8a7f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a7f('0x13'));var db=require(_0x8a7f('0x14'))['db'];function respondWithStatusCode(_0x2424b8,_0x4ba434){_0x4ba434=_0x4ba434||0xcc;return function(_0x347cac){if(_0x347cac){return _0x2424b8[_0x8a7f('0x15')](_0x4ba434);}return _0x2424b8[_0x8a7f('0x16')](_0x4ba434)[_0x8a7f('0x17')]();};}function respondWithResult(_0x210f43,_0x5d96fe){_0x5d96fe=_0x5d96fe||0xc8;return function(_0x42b6cd){if(_0x42b6cd){return _0x210f43[_0x8a7f('0x16')](_0x5d96fe)['json'](_0x42b6cd);}};}function respondWithFilteredResult(_0x2d8e12,_0x52c38c){return function(_0x5ead6e){if(_0x5ead6e){var _0x9ce1d3=typeof _0x52c38c[_0x8a7f('0x18')]===_0x8a7f('0x19')&&typeof _0x52c38c[_0x8a7f('0x1a')]===_0x8a7f('0x19');var _0x18ad9f=_0x5ead6e[_0x8a7f('0x1b')];var _0x3a0804=_0x9ce1d3?0x0:_0x52c38c[_0x8a7f('0x18')];var _0x42ca11=_0x9ce1d3?_0x5ead6e[_0x8a7f('0x1b')]:_0x52c38c[_0x8a7f('0x18')]+_0x52c38c[_0x8a7f('0x1a')];var _0xb041eb;if(_0x42ca11>=_0x18ad9f){_0x42ca11=_0x18ad9f;_0xb041eb=0xc8;}else{_0xb041eb=0xce;}_0x2d8e12['status'](_0xb041eb);return _0x2d8e12[_0x8a7f('0x1c')](_0x8a7f('0x1d'),_0x3a0804+'-'+_0x42ca11+'/'+_0x18ad9f)[_0x8a7f('0x1e')](_0x5ead6e);}return null;};}function patchUpdates(_0xb31f89){return function(_0x16cca9){try{jsonpatch[_0x8a7f('0x1f')](_0x16cca9,_0xb31f89,!![]);}catch(_0x8e3965){return BPromise['reject'](_0x8e3965);}return _0x16cca9['save']();};}function saveUpdates(_0x32069a,_0x1c6d26){return function(_0x59d203){if(_0x59d203){return _0x59d203['update'](_0x32069a)[_0x8a7f('0x20')](function(_0x215675){return _0x215675;});}return null;};}function removeEntity(_0x91c152,_0x13716b){return function(_0x564bfb){if(_0x564bfb){return _0x564bfb[_0x8a7f('0x21')]()[_0x8a7f('0x20')](function(){_0x91c152[_0x8a7f('0x16')](0xcc)[_0x8a7f('0x17')]();});}};}function handleEntityNotFound(_0x5b628e,_0x3dba81){return function(_0x21a190){if(!_0x21a190){_0x5b628e[_0x8a7f('0x15')](0x194);}return _0x21a190;};}function handleError(_0xfe25fb,_0x47cc58){_0x47cc58=_0x47cc58||0x1f4;return function(_0x14c35e){logger[_0x8a7f('0x22')](_0x14c35e[_0x8a7f('0x23')]);if(_0x14c35e[_0x8a7f('0x24')]){delete _0x14c35e['name'];}_0xfe25fb[_0x8a7f('0x16')](_0x47cc58)['send'](_0x14c35e);};}exports[_0x8a7f('0x25')]=function(_0x4fe0f5,_0xb72ac5){var _0xdacea6={},_0x2416b0={},_0x4cfd96={'count':0x0,'rows':[]};var _0x16fc73=_[_0x8a7f('0x26')](db['WhatsappTransferReport'][_0x8a7f('0x27')],function(_0x344de4){return{'name':_0x344de4[_0x8a7f('0x28')],'type':_0x344de4['type']['key']};});_0x2416b0['model']=_[_0x8a7f('0x26')](_0x16fc73,_0x8a7f('0x24'));_0x2416b0[_0x8a7f('0x29')]=_[_0x8a7f('0x2a')](_0x4fe0f5[_0x8a7f('0x29')]);_0x2416b0[_0x8a7f('0x2b')]=_[_0x8a7f('0x2c')](_0x2416b0['model'],_0x2416b0[_0x8a7f('0x29')]);_0xdacea6[_0x8a7f('0x2d')]=_[_0x8a7f('0x2c')](_0x2416b0[_0x8a7f('0x2e')],qs[_0x8a7f('0x2f')](_0x4fe0f5[_0x8a7f('0x29')][_0x8a7f('0x2f')]));_0xdacea6[_0x8a7f('0x2d')]=_0xdacea6[_0x8a7f('0x2d')]['length']?_0xdacea6[_0x8a7f('0x2d')]:_0x2416b0[_0x8a7f('0x2e')];if(!_0x4fe0f5['query']['hasOwnProperty'](_0x8a7f('0x30'))){_0xdacea6[_0x8a7f('0x1a')]=qs['limit'](_0x4fe0f5[_0x8a7f('0x29')][_0x8a7f('0x1a')]);_0xdacea6[_0x8a7f('0x18')]=qs[_0x8a7f('0x18')](_0x4fe0f5[_0x8a7f('0x29')]['offset']);}_0xdacea6[_0x8a7f('0x31')]=qs[_0x8a7f('0x32')](_0x4fe0f5[_0x8a7f('0x29')]['sort']);_0xdacea6['where']=qs[_0x8a7f('0x2b')](_[_0x8a7f('0x33')](_0x4fe0f5['query'],_0x2416b0[_0x8a7f('0x2b')]),_0x16fc73);if(_0x4fe0f5[_0x8a7f('0x29')]['filter']){_0xdacea6['where']=_[_0x8a7f('0x34')](_0xdacea6[_0x8a7f('0x35')],{'$or':_[_0x8a7f('0x26')](_0x16fc73,function(_0xf3b8de){if(_0xf3b8de[_0x8a7f('0x36')]!=='VIRTUAL'){var _0x1c0bff={};_0x1c0bff[_0xf3b8de['name']]={'$like':'%'+_0x4fe0f5[_0x8a7f('0x29')]['filter']+'%'};return _0x1c0bff;}})});}_0xdacea6=_[_0x8a7f('0x34')]({},_0xdacea6,_0x4fe0f5[_0x8a7f('0x37')]);var _0x1f4a34={'where':_0xdacea6[_0x8a7f('0x35')]};return db[_0x8a7f('0x38')][_0x8a7f('0x1b')](_0x1f4a34)['then'](function(_0x233e72){_0x4cfd96['count']=_0x233e72;if(_0x4fe0f5[_0x8a7f('0x29')][_0x8a7f('0x39')]){_0xdacea6[_0x8a7f('0x3a')]=[{'all':!![]}];}return db[_0x8a7f('0x38')][_0x8a7f('0x3b')](_0xdacea6);})[_0x8a7f('0x20')](function(_0x4b2ff5){_0x4cfd96[_0x8a7f('0x3c')]=_0x4b2ff5;return _0x4cfd96;})[_0x8a7f('0x20')](respondWithFilteredResult(_0xb72ac5,_0xdacea6))['catch'](handleError(_0xb72ac5,null));};exports[_0x8a7f('0x3d')]=function(_0x6721da,_0x27ba3e){var _0x44da99={'raw':!![],'where':{'id':_0x6721da[_0x8a7f('0x3e')]['id']}},_0x870c71={};_0x870c71[_0x8a7f('0x2e')]=_[_0x8a7f('0x2a')](db[_0x8a7f('0x38')]['rawAttributes']);_0x870c71[_0x8a7f('0x29')]=_[_0x8a7f('0x2a')](_0x6721da[_0x8a7f('0x29')]);_0x870c71['filters']=_['intersection'](_0x870c71[_0x8a7f('0x2e')],_0x870c71[_0x8a7f('0x29')]);_0x44da99[_0x8a7f('0x2d')]=_[_0x8a7f('0x2c')](_0x870c71[_0x8a7f('0x2e')],qs[_0x8a7f('0x2f')](_0x6721da['query']['fields']));_0x44da99[_0x8a7f('0x2d')]=_0x44da99['attributes'][_0x8a7f('0x3f')]?_0x44da99['attributes']:_0x870c71[_0x8a7f('0x2e')];if(_0x6721da[_0x8a7f('0x29')][_0x8a7f('0x39')]){_0x44da99[_0x8a7f('0x3a')]=[{'all':!![]}];}_0x44da99=_[_0x8a7f('0x34')]({},_0x44da99,_0x6721da[_0x8a7f('0x37')]);return db[_0x8a7f('0x38')][_0x8a7f('0x40')](_0x44da99)[_0x8a7f('0x20')](handleEntityNotFound(_0x27ba3e,null))[_0x8a7f('0x20')](respondWithResult(_0x27ba3e,null))[_0x8a7f('0x41')](handleError(_0x27ba3e,null));};exports['create']=function(_0x1ba20e,_0x242a53){return db['WhatsappTransferReport'][_0x8a7f('0x42')](_0x1ba20e[_0x8a7f('0x43')],{})[_0x8a7f('0x20')](respondWithResult(_0x242a53,0xc9))[_0x8a7f('0x41')](handleError(_0x242a53,null));};exports[_0x8a7f('0x44')]=function(_0x5714b1,_0x49dbc8){if(_0x5714b1[_0x8a7f('0x43')]['id']){delete _0x5714b1[_0x8a7f('0x43')]['id'];}return db['WhatsappTransferReport'][_0x8a7f('0x40')]({'where':{'id':_0x5714b1[_0x8a7f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x49dbc8,null))['then'](saveUpdates(_0x5714b1['body'],null))[_0x8a7f('0x20')](respondWithResult(_0x49dbc8,null))[_0x8a7f('0x41')](handleError(_0x49dbc8,null));};exports[_0x8a7f('0x21')]=function(_0x5c2ef3,_0x386ab0){return db['WhatsappTransferReport']['find']({'where':{'id':_0x5c2ef3[_0x8a7f('0x3e')]['id']}})[_0x8a7f('0x20')](handleEntityNotFound(_0x386ab0,null))[_0x8a7f('0x20')](removeEntity(_0x386ab0,null))[_0x8a7f('0x41')](handleError(_0x386ab0,null));};exports[_0x8a7f('0x45')]=function(_0x388daf,_0x18f13c){return db[_0x8a7f('0x38')][_0x8a7f('0x45')]()[_0x8a7f('0x20')](respondWithResult(_0x18f13c,null))[_0x8a7f('0x41')](handleError(_0x18f13c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 9271207..d5208df 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 _0x5bf7=['util','api','moment','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x5ec439,_0x4f2761){var _0x212ba2=function(_0x414305){while(--_0x414305){_0x5ec439['push'](_0x5ec439['shift']());}};_0x212ba2(++_0x4f2761);}(_0x5bf7,0x78));var _0x75bf=function(_0x35659c,_0x48a62e){_0x35659c=_0x35659c-0x0;var _0x3837b8=_0x5bf7[_0x35659c];return _0x3837b8;};'use strict';var _=require(_0x75bf('0x0'));var util=require(_0x75bf('0x1'));var logger=require('../../config/logger')(_0x75bf('0x2'));var moment=require(_0x75bf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75bf('0x4'));var rimraf=require(_0x75bf('0x5'));var config=require('../../config/environment');var attributes=require(_0x75bf('0x6'));module[_0x75bf('0x7')]=function(_0xdae5c4,_0x4402a6){return _0xdae5c4[_0x75bf('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0x75bf('0x9'),'paranoid':![],'indexes':[{'name':_0x75bf('0xa'),'fields':[_0x75bf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2db3=['exports','WhatsappTransferReport','report_whatsapp_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x6c0156,_0x5e2948){var _0x35d770=function(_0x588667){while(--_0x588667){_0x6c0156['push'](_0x6c0156['shift']());}};_0x35d770(++_0x5e2948);}(_0x2db3,0x1a7));var _0x32db=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x2db3[_0x15fc3c];return _0x94c5c8;};'use strict';var _=require(_0x32db('0x0'));var util=require('util');var logger=require(_0x32db('0x1'))(_0x32db('0x2'));var moment=require(_0x32db('0x3'));var BPromise=require(_0x32db('0x4'));var rp=require(_0x32db('0x5'));var fs=require('fs');var path=require(_0x32db('0x6'));var rimraf=require('rimraf');var config=require(_0x32db('0x7'));var attributes=require(_0x32db('0x8'));module[_0x32db('0x9')]=function(_0x230b0a,_0x5b896f){return _0x230b0a['define'](_0x32db('0xa'),attributes,{'tableName':_0x32db('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 29c7fd5..9cd8553 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 _0xb45e=['client','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2f3db3,_0x4176cc){var _0x531014=function(_0xb09258){while(--_0xb09258){_0x2f3db3['push'](_0x2f3db3['shift']());}};_0x531014(++_0x4176cc);}(_0xb45e,0x90));var _0xeb45=function(_0xcfcb85,_0x3e81b2){_0xcfcb85=_0xcfcb85-0x0;var _0x3acac1=_0xb45e[_0xcfcb85];return _0x3acac1;};'use strict';var _=require(_0xeb45('0x0'));var util=require('util');var moment=require(_0xeb45('0x1'));var BPromise=require(_0xeb45('0x2'));var rs=require(_0xeb45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb45('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb45('0x5'))(_0xeb45('0x6'));var config=require('../../config/environment');var jayson=require(_0xeb45('0x7'));var client=jayson[_0xeb45('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b73df,_0x1159e9,_0x48ef43){return new BPromise(function(_0x3a7ced,_0x1aec90){return client['request'](_0x3b73df,_0x48ef43)['then'](function(_0x5bb7e5){logger[_0xeb45('0x9')](_0xeb45('0xa'),_0x1159e9,'request\x20sent');logger['debug'](_0xeb45('0xb'),_0x1159e9,_0xeb45('0xc'),JSON[_0xeb45('0xd')](_0x5bb7e5));if(_0x5bb7e5[_0xeb45('0xe')]){if(_0x5bb7e5[_0xeb45('0xe')][_0xeb45('0xf')]===0x1f4){logger['error'](_0xeb45('0xa'),_0x1159e9,_0x5bb7e5['error']['message']);return _0x1aec90(_0x5bb7e5[_0xeb45('0xe')][_0xeb45('0x10')]);}logger['error'](_0xeb45('0xa'),_0x1159e9,_0x5bb7e5[_0xeb45('0xe')][_0xeb45('0x10')]);return _0x3a7ced(_0x5bb7e5[_0xeb45('0xe')][_0xeb45('0x10')]);}else{logger[_0xeb45('0x9')](_0xeb45('0xa'),_0x1159e9,_0xeb45('0xc'));_0x3a7ced(_0x5bb7e5[_0xeb45('0x11')][_0xeb45('0x10')]);}})[_0xeb45('0x12')](function(_0x36bddc){logger[_0xeb45('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1159e9,_0x36bddc);_0x1aec90(_0x36bddc);});});} \ No newline at end of file +var _0x47f5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2c5c41,_0x175953){var _0x307177=function(_0x5a1124){while(--_0x5a1124){_0x2c5c41['push'](_0x2c5c41['shift']());}};_0x307177(++_0x175953);}(_0x47f5,0xa8));var _0x547f=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0x47f5[_0x4f32de];return _0x149821;};'use strict';var _=require(_0x547f('0x0'));var util=require('util');var moment=require(_0x547f('0x1'));var BPromise=require(_0x547f('0x2'));var rs=require(_0x547f('0x3'));var fs=require('fs');var Redis=require(_0x547f('0x4'));var db=require(_0x547f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x547f('0x6'))('rpc');var config=require(_0x547f('0x7'));var jayson=require(_0x547f('0x8'));var client=jayson[_0x547f('0x9')][_0x547f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x571c0d,_0x3cdc4e,_0x486d24){return new BPromise(function(_0x5a2855,_0x200371){return client[_0x547f('0xb')](_0x571c0d,_0x486d24)[_0x547f('0xc')](function(_0xa7fa4c){logger[_0x547f('0xd')](_0x547f('0xe'),_0x3cdc4e,_0x547f('0xf'));logger[_0x547f('0x10')](_0x547f('0x11'),_0x3cdc4e,_0x547f('0xf'),JSON[_0x547f('0x12')](_0xa7fa4c));if(_0xa7fa4c[_0x547f('0x13')]){if(_0xa7fa4c[_0x547f('0x13')][_0x547f('0x14')]===0x1f4){logger[_0x547f('0x13')](_0x547f('0xe'),_0x3cdc4e,_0xa7fa4c[_0x547f('0x13')][_0x547f('0x15')]);return _0x200371(_0xa7fa4c[_0x547f('0x13')][_0x547f('0x15')]);}logger[_0x547f('0x13')](_0x547f('0xe'),_0x3cdc4e,_0xa7fa4c[_0x547f('0x13')][_0x547f('0x15')]);return _0x5a2855(_0xa7fa4c[_0x547f('0x13')][_0x547f('0x15')]);}else{logger[_0x547f('0xd')](_0x547f('0xe'),_0x3cdc4e,_0x547f('0xf'));_0x5a2855(_0xa7fa4c[_0x547f('0x16')]['message']);}})[_0x547f('0x17')](function(_0xc12fc1){logger[_0x547f('0x13')](_0x547f('0xe'),_0x3cdc4e,_0xc12fc1);_0x200371(_0xc12fc1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index de46f32..3a889dd 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c48=['seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','map','join','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then'];(function(_0x5ca0b9,_0x410bd6){var _0x42fe7f=function(_0x450865){while(--_0x450865){_0x5ca0b9['push'](_0x5ca0b9['shift']());}};_0x42fe7f(++_0x410bd6);}(_0x9c48,0xa1));var _0x89c4=function(_0x2c24b8,_0x168e0b){_0x2c24b8=_0x2c24b8-0x0;var _0x563ed6=_0x9c48[_0x2c24b8];return _0x563ed6;};'use strict';var _=require(_0x89c4('0x0'));var db=require(_0x89c4('0x1'))['db'];var seedDb=require(_0x89c4('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x89c4('0x3'));var config=require(_0x89c4('0x4'));var logger=require(_0x89c4('0x5'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x89c4('0x6'));var schedule=require(_0x89c4('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x89c4('0x8'));var transcribe=require(_0x89c4('0x9'));var provider=require(_0x89c4('0xa'));function main(){return db[_0x89c4('0xb')][_0x89c4('0xc')]()[_0x89c4('0xd')](function(){if(config[_0x89c4('0xe')]){return seedDb[_0x89c4('0xf')]();}})[_0x89c4('0xd')](function(){return checkLicense[_0x89c4('0xf')]();})[_0x89c4('0xd')](function(){return rpc[_0x89c4('0x10')]();})[_0x89c4('0xd')](function(_0xd445){logger[_0x89c4('0x11')](_0xd445);return chat[_0x89c4('0x12')]();})[_0x89c4('0xd')](function(){return whatsapp[_0x89c4('0x12')]();})[_0x89c4('0xd')](function(){return schedule[_0x89c4('0x12')]();})['then'](function(){return transcribe['start']();})['then'](function(){return provider[_0x89c4('0x12')]();})[_0x89c4('0xd')](function(_0x256a60){logger[_0x89c4('0x11')](_0x256a60);return pm2[_0x89c4('0x12')](pm2Config);})[_0x89c4('0xd')](function(_0x84b446){var _0x5aca22=_0x84b446[_0x89c4('0x13')](function(_0x2bd1d8){return typeof _0x2bd1d8[_0x89c4('0x14')]===_0x89c4('0x15')&&_0x2bd1d8['exitCode']>=0x0;});if(_0x5aca22[_0x89c4('0x16')]>0x0){throw new Error(_0x5aca22[_0x89c4('0x16')]+_0x89c4('0x17')+_['map'](_0x5aca22,function(_0x41cb06){return'\x22'+_0x41cb06['pm2_env'][_0x89c4('0x18')]+'\x22';}));}logger[_0x89c4('0x11')]('Online\x20apps:',_[_0x89c4('0x19')](_['filter'](_0x84b446,{'status':'online'}),_0x89c4('0x18'))[_0x89c4('0x1a')]());logger[_0x89c4('0x11')]('Offline\x20apps:',_[_0x89c4('0x19')](_['filter'](_0x84b446,function(_0x38e347){return _0x38e347[_0x89c4('0x1b')]!=='online';}),_0x89c4('0x18'))[_0x89c4('0x1a')]()||_0x89c4('0x1c'));console[_0x89c4('0x1d')](_0x89c4('0x1e'));})[_0x89c4('0x1f')](function(_0x5395fc){console[_0x89c4('0x1d')](_0x89c4('0x20'),_0x5395fc);logger['error'](_0x89c4('0x21'),_0x5395fc);process[_0x89c4('0x22')](0x1);});}main(); \ No newline at end of file +var _0x70e9=['./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','seedDB','default','then','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','online','name','join','Offline\x20apps:','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','./mysqldb','./config/seedDB','./rpc','./config/environment','app'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x70e9,0x193));var _0x970e=function(_0x72980a,_0x119bd1){_0x72980a=_0x72980a-0x0;var _0x543cc3=_0x70e9[_0x72980a];return _0x543cc3;};'use strict';var _=require('lodash');var db=require(_0x970e('0x0'))['db'];var seedDb=require(_0x970e('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x970e('0x2'));var config=require(_0x970e('0x3'));var logger=require('./config/logger')(_0x970e('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x970e('0x5'));var schedule=require(_0x970e('0x6'));var chat=require(_0x970e('0x7'));var whatsapp=require(_0x970e('0x8'));var transcribe=require(_0x970e('0x9'));var provider=require(_0x970e('0xa'));function main(){return db[_0x970e('0xb')]['sync']()['then'](function(){if(config[_0x970e('0xc')]){return seedDb[_0x970e('0xd')]();}})['then'](function(){return checkLicense[_0x970e('0xd')]();})[_0x970e('0xe')](function(){return rpc[_0x970e('0xf')]();})['then'](function(_0x17256c){logger[_0x970e('0x10')](_0x17256c);return chat[_0x970e('0x11')]();})[_0x970e('0xe')](function(){return whatsapp[_0x970e('0x11')]();})[_0x970e('0xe')](function(){return schedule['start']();})[_0x970e('0xe')](function(){return transcribe[_0x970e('0x11')]();})[_0x970e('0xe')](function(){return provider[_0x970e('0x11')]();})[_0x970e('0xe')](function(_0x2d7b55){logger[_0x970e('0x10')](_0x2d7b55);return pm2[_0x970e('0x11')](pm2Config);})['then'](function(_0x15576b){var _0x389a08=_0x15576b['filter'](function(_0x270ebe){return typeof _0x270ebe[_0x970e('0x12')]===_0x970e('0x13')&&_0x270ebe[_0x970e('0x12')]>=0x0;});if(_0x389a08['length']>0x0){throw new Error(_0x389a08[_0x970e('0x14')]+_0x970e('0x15')+_[_0x970e('0x16')](_0x389a08,function(_0x4244a2){return'\x22'+_0x4244a2['pm2_env']['name']+'\x22';}));}logger[_0x970e('0x10')](_0x970e('0x17'),_[_0x970e('0x16')](_['filter'](_0x15576b,{'status':_0x970e('0x18')}),_0x970e('0x19'))[_0x970e('0x1a')]());logger[_0x970e('0x10')](_0x970e('0x1b'),_['map'](_['filter'](_0x15576b,function(_0x24a007){return _0x24a007['status']!==_0x970e('0x18');}),_0x970e('0x19'))[_0x970e('0x1a')]()||'None');console['log'](_0x970e('0x1c'));})[_0x970e('0x1d')](function(_0x3b4466){console[_0x970e('0x1e')](_0x970e('0x1f'),_0x3b4466);logger[_0x970e('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3b4466);process[_0x970e('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e5627ed..2782290 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 _0xef0f=['settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','use','user','ChatInteraction','findOne','params','then','closed','status','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','headers','authorization','User','pass','Bearer','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','length','unshift','encryptString','promisify','sign','secret','payload','options','verify','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled'];(function(_0x34da9a,_0xac0dc){var _0x43521e=function(_0x382858){while(--_0x382858){_0x34da9a['push'](_0x34da9a['shift']());}};_0x43521e(++_0xac0dc);}(_0xef0f,0x168));var _0xfef0=function(_0x29098f,_0x395ae2){_0x29098f=_0x29098f-0x0;var _0x1f84ce=_0xef0f[_0x29098f];return _0x1f84ce;};'use strict';var db=require(_0xfef0('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xfef0('0x1'));var licenseUtil=require(_0xfef0('0x2'));var encryptor=require(_0xfef0('0x3'));var _=require('lodash');var jwt=require(_0xfef0('0x4'));var expressJwt=require(_0xfef0('0x5'));var compose=require(_0xfef0('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0xfef0('0x7'));var BPromise=require(_0xfef0('0x8'));var util=require(_0xfef0('0x9'));var moment=require(_0xfef0('0xa'));var validateJwt=expressJwt({'secret':config[_0xfef0('0xb')][_0xfef0('0xc')]});var userAttributes=['id','role',_0xfef0('0xd'),'name',_0xfef0('0xe'),_0xfef0('0xf'),_0xfef0('0x10'),_0xfef0('0x11'),_0xfef0('0x12'),_0xfef0('0x13'),_0xfef0('0x14'),_0xfef0('0x15'),_0xfef0('0x16'),_0xfef0('0x17'),_0xfef0('0x18'),_0xfef0('0x19'),_0xfef0('0x1a'),_0xfef0('0x1b'),'lastPauseAt',_0xfef0('0x1c'),_0xfef0('0x1d'),_0xfef0('0x1e'),_0xfef0('0x1f'),_0xfef0('0x20'),_0xfef0('0x21'),_0xfef0('0x22'),'phoneBarEnableRecording',_0xfef0('0x23'),'phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired',_0xfef0('0x24'),_0xfef0('0x25'),_0xfef0('0x26'),_0xfef0('0x27'),_0xfef0('0x28'),_0xfef0('0x29'),_0xfef0('0x2a'),_0xfef0('0x2b'),'downloadVoiceRecordings',_0xfef0('0x2c'),_0xfef0('0x2d'),_0xfef0('0x2e'),_0xfef0('0x2f'),_0xfef0('0x30'),'chatAutoanswerDelay',_0xfef0('0x31'),'emailAutoanswerDelay',_0xfef0('0x32'),_0xfef0('0x33'),_0xfef0('0x34'),'openchannelAutoanswerDelay',_0xfef0('0x35'),'faxAutoanswerDelay',_0xfef0('0x36'),_0xfef0('0x37'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xfef0('0x38')](function(_0x4faea8,_0x1f9970,_0x46b34a){if(_0x4faea8[_0xfef0('0x39')]){_0x46b34a();}else{return db[_0xfef0('0x3a')][_0xfef0('0x3b')]({'where':{'id':_0x4faea8[_0xfef0('0x3c')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xfef0('0x3d')](function(_0x1ffaa4){if(_0x1ffaa4&&_0x1ffaa4[_0xfef0('0x3e')]){return _0x1f9970[_0xfef0('0x3f')](_0x1ffaa4[_0xfef0('0x40')]===_0xfef0('0x41')?0x195:0x193)[_0xfef0('0x42')]({'message':_0x1ffaa4[_0xfef0('0x40')]===_0xfef0('0x41')?'Unmanaged.':_0xfef0('0x43')});}else{_0x46b34a();}})[_0xfef0('0x44')](function(_0xca0cce){_0x46b34a(_0xca0cce);});}});};exports[_0xfef0('0x45')]=function isAuthenticated(_0x37921f){return compose()[_0xfef0('0x38')](function(_0x3e3c4c,_0x3e026a,_0x26cb9a){var _0x213a91;if(_0x3e3c4c[_0xfef0('0x46')][_0xfef0('0x47')]){if(_['startsWith'](_0x3e3c4c[_0xfef0('0x46')]['authorization'],'Basic')){var _0x7d1692=basicAuth(_0x3e3c4c);db[_0xfef0('0x48')]['find']({'where':{'name':_0x7d1692['name']}})['then'](function(_0x4f65cd){if(!_0x4f65cd||!_0x4f65cd['authenticate'](_0x7d1692[_0xfef0('0x49')])){return _0x3e026a[_0xfef0('0x3f')](0x191)[_0xfef0('0x42')]({'message':'Wrong\x20credentials.'});}_0x3e3c4c['user']={'id':_0x4f65cd['id']};_0x26cb9a();})['catch'](function(_0x1f8110){_0x26cb9a(_0x1f8110);});}else if(_['startsWith'](_0x3e3c4c[_0xfef0('0x46')][_0xfef0('0x47')],_0xfef0('0x4a'))){validateJwt(_0x3e3c4c,_0x3e026a,_0x26cb9a);}else{if(_0x37921f){_0x26cb9a();}else{return _0x3e026a['status'](0x193)[_0xfef0('0x42')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3e3c4c[_0xfef0('0x4b')][_0xfef0('0x4c')]){try{var _0x234d49={'audience':hardwareConf[_0xfef0('0x4d')](),'issuer':hardwareConf[_0xfef0('0x4d')]()};verifyJwt(_0x3e3c4c[_0xfef0('0x4b')][_0xfef0('0x4c')],_0x234d49)[_0xfef0('0x3d')](function(_0x590e37){return db[_0xfef0('0x48')][_0xfef0('0x4e')]({'where':{'id':_0x590e37[_0xfef0('0x4f')]}})[_0xfef0('0x3d')](function(_0xae697){_0x213a91=_0xae697;return db[_0xfef0('0x50')][_0xfef0('0x3b')]({'where':{'id':0x1},'attributes':[_0xfef0('0x51'),_0xfef0('0x52')],'raw':!![]});})[_0xfef0('0x3d')](function(_0x3b668b){if(!_0x213a91||!_[_0xfef0('0x53')](_0x213a91[_0xfef0('0x54')],_0x590e37['nonce'])){return _0x3e026a[_0xfef0('0x3f')](0x191)['json']({'message':_0xfef0('0x55')});}if(_0x213a91[_0xfef0('0x56')]){return _0x3e026a[_0xfef0('0x3f')](0x191)['json']({'message':_0xfef0('0x57')});}if(_0x213a91[_0xfef0('0x58')]){if(_0x3b668b[_0xfef0('0x52')]>0x0){if(moment(_0x213a91['blockedAt'])[_0xfef0('0x59')](_0x3b668b[_0xfef0('0x52')],_0xfef0('0x5a'))>moment()){return _0x3e026a['status'](0x191)[_0xfef0('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3e026a['status'](0x191)[_0xfef0('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3e3c4c['user']={'id':_0x213a91['id']};_0x26cb9a();});})[_0xfef0('0x44')](function(){return _0x3e026a[_0xfef0('0x3f')](0x191)[_0xfef0('0x42')]({'message':_0xfef0('0x57')});});}catch(_0x3a3844){_0x26cb9a(_0x3a3844);}}else if(_0x37921f){_0x26cb9a();}else{return _0x3e026a[_0xfef0('0x3f')](0x193)['json']({'message':_0xfef0('0x5b')});}})[_0xfef0('0x38')](function(_0x5a9ed3,_0x54d5cb,_0x1d554e){if(_0x5a9ed3['user']){db[_0xfef0('0x48')][_0xfef0('0x4e')]({'where':{'id':_0x5a9ed3[_0xfef0('0x39')]['id']},'attributes':userAttributes})[_0xfef0('0x3d')](function(_0x199c57){if(!_0x199c57){return _0x54d5cb[_0xfef0('0x3f')](0x194)[_0xfef0('0x42')]({'message':_0xfef0('0x5c')});}_0x5a9ed3['user']=_0x199c57;_0x1d554e();})[_0xfef0('0x44')](function(_0x50e372){_0x1d554e(_0x50e372);});}else if(_0x37921f){_0x1d554e();}else{return _0x54d5cb['status'](0x194)[_0xfef0('0x42')]({'message':_0xfef0('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xfef0('0x38')](function(_0x5587a9,_0x39df7c,_0x30ef5d){return licenseUtil[_0xfef0('0x5e')]()[_0xfef0('0x3d')](function(_0x544876){if(_0x544876[_0xfef0('0x5f')]){_0x30ef5d();}else{return _0x39df7c[_0xfef0('0x3f')](0x193)['json']({'message':'Forbidden'});}})[_0xfef0('0x44')](function(_0x4f3231){_0x30ef5d(_0x4f3231);});});};exports[_0xfef0('0x60')]=function isWebrtcLicence(){return compose()[_0xfef0('0x38')](function(_0x390247,_0x19acde,_0x1c3e04){return licenseUtil[_0xfef0('0x5e')]()['then'](function(_0xda901e){if(_0xda901e['webrtc']){_0x1c3e04();}else{return _0x19acde['status'](0x193)[_0xfef0('0x42')]({'message':_0xfef0('0x61')});}})[_0xfef0('0x44')](function(_0x5a9750){_0x1c3e04(_0x5a9750);});});};exports[_0xfef0('0x62')]=function(_0x4e1271,_0x5dd26b,_0x51f207){_0x4e1271[_0xfef0('0x62')]=!![];return _0x51f207();};exports[_0xfef0('0x63')]=function signToken(_0x249934){return signJwt(_0x249934);};exports[_0xfef0('0x64')]=function(_0x2712e9,_0xa23cc8){if(!_0x2712e9[_0xfef0('0x39')]){return _0xa23cc8[_0xfef0('0x3f')](0x194)[_0xfef0('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x512f7a={'payload':{'id':_0x2712e9[_0xfef0('0x39')]['id'],'role':_0x2712e9[_0xfef0('0x39')][_0xfef0('0x65')]},'options':{'expiresIn':0x15180}};return signJwt(_0x512f7a)[_0xfef0('0x3d')](function(_0x393fee){_0xa23cc8[_0xfef0('0x66')](_0xfef0('0x67'),_0x393fee);_0xa23cc8[_0xfef0('0x68')]('/dashboards/general');})[_0xfef0('0x44')](function(_0x19e449){return _0xa23cc8[_0xfef0('0x3f')](0x1f4)[_0xfef0('0x69')](_0x19e449);});};exports[_0xfef0('0x6a')]=function(_0x5a00db){if(_['isNil'](_0x5a00db['apiKeyNonce'])||_[_0xfef0('0x6b')](_0x5a00db[_0xfef0('0x6c')])){return null;}else{return createJwt(_0x5a00db);}};exports[_0xfef0('0x6d')]=function(_0x22adf3){_0x22adf3['apiKeyNonce']=generateNonce();_0x22adf3[_0xfef0('0x6c')]=generateIssuedAt();return createJwt(_0x22adf3);};exports[_0xfef0('0x6e')]=function(_0x302908,_0x28b90c){var _0x19dcd3=_0x302908[_0xfef0('0x4b')][_0xfef0('0x4c')];if(_0x19dcd3){var _0x4cd0fd={'nonce':_0x28b90c[_0xfef0('0x54')],'iat':_0x28b90c[_0xfef0('0x6c')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xfef0('0x4d')]()};return verifyJwt(_0x19dcd3,_0x4cd0fd)['then'](function(){return generateApiKey(_0x28b90c);});}else{throw{'message':_0xfef0('0x6f')};}};exports[_0xfef0('0x70')]=function(_0x5cf1fa){var _0x1e1c02=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1e1c02['test'](_0x5cf1fa))throw new db['Sequelize']['ValidationError'](_0xfef0('0x71'));return;};exports[_0xfef0('0x72')]=function(_0x455923,_0x34fda3,_0x16a498){var _0x2d63e8=encryptor['decryptString'](_0x34fda3)[_0xfef0('0x73')](',');for(var _0x4156d5=0x0;_0x4156d5<_0x16a498;_0x4156d5++){if(!_0x2d63e8[_0x4156d5])break;if(_0x455923[_0xfef0('0x74')]()===_0x2d63e8[_0x4156d5][_0xfef0('0x74')]()){var _0x21fd2b=util['format'](_0xfef0('0x75'),_0x16a498);if(_0x16a498===0x1){_0x21fd2b='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xfef0('0x76'))]['ValidationError'](_0x21fd2b);}}return;};exports[_0xfef0('0x77')]=function(_0x851e97,_0xdd1121){var _0x281259=_0xdd1121?encryptor[_0xfef0('0x78')](_0xdd1121)['split'](','):[];if(_0x281259[_0xfef0('0x79')]===0x5){_0x281259['splice'](-0x1,0x1);}_0x281259[_0xfef0('0x7a')](_0x851e97);return encryptor[_0xfef0('0x7b')](_0x281259['join'](','));};function signJwt(_0x3a12c5){var _0x3c5640=BPromise[_0xfef0('0x7c')](jwt[_0xfef0('0x7d')],{'context':jwt});var _0x423ec0=_0x3a12c5[_0xfef0('0x7e')]||config[_0xfef0('0xb')][_0xfef0('0xc')];return new BPromise(function(_0x17a595,_0x7eed0){_0x3c5640(_0x3a12c5[_0xfef0('0x7f')],_0x423ec0,_0x3a12c5[_0xfef0('0x80')])['then'](function(_0xeb5f8d){_0x17a595(_0xeb5f8d);})[_0xfef0('0x44')](function(_0x28cab7){_0x7eed0(_0x28cab7);});});}function verifyJwt(_0x312dcf,_0x16f0a2,_0x49ed54){var _0x12e383=BPromise[_0xfef0('0x7c')](jwt[_0xfef0('0x81')],{'context':jwt});var _0x3c6bb8=_0x49ed54||config[_0xfef0('0xb')][_0xfef0('0xc')];return new BPromise(function(_0xb9693b,_0x103ca3){_0x12e383(_0x312dcf,_0x3c6bb8,_0x16f0a2)[_0xfef0('0x3d')](function(_0x3f26d9){_0xb9693b(_0x3f26d9);})['catch'](function(_0x100c6a){_0x103ca3(_0x100c6a);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xfef0('0x82')](_0xfef0('0x83'));}function generateIssuedAt(){return Math['floor'](Date[_0xfef0('0x84')]()/0x3e8)[_0xfef0('0x82')]();}function createJwt(_0x3de7b1){var _0x6a4d10={'payload':{'iat':_0x3de7b1[_0xfef0('0x6c')],'nonce':_0x3de7b1['apiKeyNonce']},'options':{'algorithm':_0xfef0('0x85'),'subject':_0x3de7b1['id'][_0xfef0('0x82')](),'issuer':hardwareConf[_0xfef0('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x6a4d10)[_0xfef0('0x3d')](function(_0x2ab666){return{'iat':_0x3de7b1[_0xfef0('0x6c')],'nonce':_0x3de7b1[_0xfef0('0x54')],'token':_0x2ab666};});} \ No newline at end of file +var _0x0abf=['ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','disposition','closed','unmanaged','json','Forbidden.','headers','authorization','startsWith','User','then','authenticate','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','add','minutes','Invalid\x20API\x20access\x20key','catch','find','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','test','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\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','payload','session','randomBytes','toString','hex','floor','apiKeyIat','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','userpic','permissions','md5secret','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments'];(function(_0xb54c57,_0x1fc398){var _0x591003=function(_0x54b56e){while(--_0x54b56e){_0xb54c57['push'](_0xb54c57['shift']());}};_0x591003(++_0x1fc398);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var db=require(_0xf0ab('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xf0ab('0x1'));var licenseUtil=require(_0xf0ab('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0xf0ab('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xf0ab('0x4'));var basicAuth=require(_0xf0ab('0x5'));var crypto=require(_0xf0ab('0x6'));var BPromise=require(_0xf0ab('0x7'));var util=require(_0xf0ab('0x8'));var moment=require(_0xf0ab('0x9'));var validateJwt=expressJwt({'secret':config[_0xf0ab('0xa')]['session']});var userAttributes=['id',_0xf0ab('0xb'),_0xf0ab('0xc'),_0xf0ab('0xd'),_0xf0ab('0xe'),'email',_0xf0ab('0xf'),_0xf0ab('0x10'),_0xf0ab('0x11'),'voicePause','chatPause',_0xf0ab('0x12'),'faxPause',_0xf0ab('0x13'),_0xf0ab('0x14'),_0xf0ab('0x15'),_0xf0ab('0x16'),_0xf0ab('0x17'),_0xf0ab('0x18'),_0xf0ab('0x19'),'allowmessenger',_0xf0ab('0x1a'),_0xf0ab('0x1b'),_0xf0ab('0x1c'),_0xf0ab('0x1d'),_0xf0ab('0x1e'),_0xf0ab('0x1f'),_0xf0ab('0x20'),_0xf0ab('0x21'),_0xf0ab('0x22'),_0xf0ab('0x23'),_0xf0ab('0x24'),_0xf0ab('0x25'),_0xf0ab('0x26'),_0xf0ab('0x27'),_0xf0ab('0x28'),'privacyEnabled',_0xf0ab('0x29'),_0xf0ab('0x2a'),_0xf0ab('0x2b'),_0xf0ab('0x2c'),_0xf0ab('0x2d'),_0xf0ab('0x2e'),_0xf0ab('0x2f'),_0xf0ab('0x30'),_0xf0ab('0x31'),_0xf0ab('0x32'),_0xf0ab('0x33'),_0xf0ab('0x34'),_0xf0ab('0x35'),_0xf0ab('0x36'),_0xf0ab('0x37'),_0xf0ab('0x38'),'faxAutoanswerDelay',_0xf0ab('0x39'),_0xf0ab('0x3a'),_0xf0ab('0x3b')];exports[_0xf0ab('0x3c')]=function(){return this[_0xf0ab('0x3d')](!![])[_0xf0ab('0x3e')](function(_0x250317,_0x20140b,_0x36ad01){if(_0x250317[_0xf0ab('0x3f')]){_0x36ad01();}else{return db[_0xf0ab('0x40')]['findOne']({'where':{'id':_0x250317['params']['id']},'attributes':['id','closed',_0xf0ab('0x41')],'raw':!![]})['then'](function(_0x3eca32){if(_0x3eca32&&_0x3eca32[_0xf0ab('0x42')]){return _0x20140b['status'](_0x3eca32[_0xf0ab('0x41')]===_0xf0ab('0x43')?0x195:0x193)[_0xf0ab('0x44')]({'message':_0x3eca32[_0xf0ab('0x41')]===_0xf0ab('0x43')?'Unmanaged.':_0xf0ab('0x45')});}else{_0x36ad01();}})['catch'](function(_0x55d799){_0x36ad01(_0x55d799);});}});};exports[_0xf0ab('0x3d')]=function isAuthenticated(_0x4306c6){return compose()[_0xf0ab('0x3e')](function(_0x445160,_0x43476c,_0x174052){var _0x367302;if(_0x445160[_0xf0ab('0x46')][_0xf0ab('0x47')]){if(_[_0xf0ab('0x48')](_0x445160[_0xf0ab('0x46')][_0xf0ab('0x47')],'Basic')){var _0x1e1ffb=basicAuth(_0x445160);db[_0xf0ab('0x49')]['find']({'where':{'name':_0x1e1ffb['name']}})[_0xf0ab('0x4a')](function(_0x1dc84e){if(!_0x1dc84e||!_0x1dc84e[_0xf0ab('0x4b')](_0x1e1ffb['pass'])){return _0x43476c['status'](0x191)[_0xf0ab('0x44')]({'message':'Wrong\x20credentials.'});}_0x445160[_0xf0ab('0x3f')]={'id':_0x1dc84e['id']};_0x174052();})['catch'](function(_0x3f66fa){_0x174052(_0x3f66fa);});}else if(_[_0xf0ab('0x48')](_0x445160['headers']['authorization'],_0xf0ab('0x4c'))){validateJwt(_0x445160,_0x43476c,_0x174052);}else{if(_0x4306c6){_0x174052();}else{return _0x43476c[_0xf0ab('0x4d')](0x193)[_0xf0ab('0x44')]({'message':_0xf0ab('0x4e')});}}}else if(_0x445160[_0xf0ab('0x4f')][_0xf0ab('0x50')]){try{var _0x17f3b3={'audience':hardwareConf[_0xf0ab('0x51')](),'issuer':hardwareConf[_0xf0ab('0x51')]()};verifyJwt(_0x445160[_0xf0ab('0x4f')][_0xf0ab('0x50')],_0x17f3b3)[_0xf0ab('0x4a')](function(_0x22dcfe){return db[_0xf0ab('0x49')]['find']({'where':{'id':_0x22dcfe[_0xf0ab('0x52')]}})[_0xf0ab('0x4a')](function(_0xc575ed){_0x367302=_0xc575ed;return db['Setting'][_0xf0ab('0x53')]({'where':{'id':0x1},'attributes':[_0xf0ab('0x54'),_0xf0ab('0x55')],'raw':!![]});})['then'](function(_0x396c71){if(!_0x367302||!_['isEqual'](_0x367302[_0xf0ab('0x56')],_0x22dcfe['nonce'])){return _0x43476c[_0xf0ab('0x4d')](0x191)[_0xf0ab('0x44')]({'message':_0xf0ab('0x57')});}if(_0x367302[_0xf0ab('0x58')]){return _0x43476c[_0xf0ab('0x4d')](0x191)[_0xf0ab('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x367302[_0xf0ab('0x59')]){if(_0x396c71[_0xf0ab('0x55')]>0x0){if(moment(_0x367302['blockedAt'])[_0xf0ab('0x5a')](_0x396c71[_0xf0ab('0x55')],_0xf0ab('0x5b'))>moment()){return _0x43476c[_0xf0ab('0x4d')](0x191)[_0xf0ab('0x44')]({'message':_0xf0ab('0x5c')});}}else{return _0x43476c[_0xf0ab('0x4d')](0x191)['json']({'message':_0xf0ab('0x5c')});}}_0x445160[_0xf0ab('0x3f')]={'id':_0x367302['id']};_0x174052();});})[_0xf0ab('0x5d')](function(){return _0x43476c['status'](0x191)[_0xf0ab('0x44')]({'message':_0xf0ab('0x5c')});});}catch(_0x44077b){_0x174052(_0x44077b);}}else if(_0x4306c6){_0x174052();}else{return _0x43476c[_0xf0ab('0x4d')](0x193)[_0xf0ab('0x44')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf0ab('0x3e')](function(_0x39a212,_0x28e7a4,_0x197955){if(_0x39a212[_0xf0ab('0x3f')]){db[_0xf0ab('0x49')][_0xf0ab('0x5e')]({'where':{'id':_0x39a212[_0xf0ab('0x3f')]['id']},'attributes':userAttributes})[_0xf0ab('0x4a')](function(_0x3b214a){if(!_0x3b214a){return _0x28e7a4[_0xf0ab('0x4d')](0x194)[_0xf0ab('0x44')]({'message':_0xf0ab('0x5f')});}_0x39a212['user']=_0x3b214a;_0x197955();})['catch'](function(_0x2fc677){_0x197955(_0x2fc677);});}else if(_0x4306c6){_0x197955();}else{return _0x28e7a4['status'](0x194)[_0xf0ab('0x44')]({'message':_0xf0ab('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xf0ab('0x3e')](function(_0x17ac48,_0x591d37,_0x35051f){return licenseUtil[_0xf0ab('0x61')]()[_0xf0ab('0x4a')](function(_0x1cb47a){if(_0x1cb47a[_0xf0ab('0x62')]){_0x35051f();}else{return _0x591d37[_0xf0ab('0x4d')](0x193)[_0xf0ab('0x44')]({'message':_0xf0ab('0x63')});}})[_0xf0ab('0x5d')](function(_0xe0cabc){_0x35051f(_0xe0cabc);});});};exports[_0xf0ab('0x64')]=function isWebrtcLicence(){return compose()[_0xf0ab('0x3e')](function(_0x13b477,_0x99ce7,_0x58fea3){return licenseUtil['getLicense']()[_0xf0ab('0x4a')](function(_0x4da898){if(_0x4da898['webrtc']){_0x58fea3();}else{return _0x99ce7['status'](0x193)[_0xf0ab('0x44')]({'message':_0xf0ab('0x63')});}})[_0xf0ab('0x5d')](function(_0x2df69a){_0x58fea3(_0x2df69a);});});};exports[_0xf0ab('0x65')]=function(_0x132ada,_0x472c1b,_0x1a0f21){_0x132ada[_0xf0ab('0x65')]=!![];return _0x1a0f21();};exports[_0xf0ab('0x66')]=function signToken(_0x344389){return signJwt(_0x344389);};exports[_0xf0ab('0x67')]=function(_0x4e6c9b,_0x393c9a){if(!_0x4e6c9b[_0xf0ab('0x3f')]){return _0x393c9a[_0xf0ab('0x4d')](0x194)[_0xf0ab('0x44')]({'message':_0xf0ab('0x68')});}var _0x29fb03={'payload':{'id':_0x4e6c9b[_0xf0ab('0x3f')]['id'],'role':_0x4e6c9b[_0xf0ab('0x3f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x29fb03)['then'](function(_0x51b4a9){_0x393c9a[_0xf0ab('0x69')](_0xf0ab('0x6a'),_0x51b4a9);_0x393c9a['redirect'](_0xf0ab('0x6b'));})[_0xf0ab('0x5d')](function(_0x4edb01){return _0x393c9a[_0xf0ab('0x4d')](0x1f4)[_0xf0ab('0x6c')](_0x4edb01);});};exports[_0xf0ab('0x6d')]=function(_0xe4ef6d){if(_[_0xf0ab('0x6e')](_0xe4ef6d[_0xf0ab('0x56')])||_[_0xf0ab('0x6e')](_0xe4ef6d['apiKeyIat'])){return null;}else{return createJwt(_0xe4ef6d);}};exports[_0xf0ab('0x6f')]=function(_0x59e7dd){_0x59e7dd[_0xf0ab('0x56')]=generateNonce();_0x59e7dd['apiKeyIat']=generateIssuedAt();return createJwt(_0x59e7dd);};exports[_0xf0ab('0x70')]=function(_0x5c721a,_0x535274){var _0x1e3b91=_0x5c721a['query'][_0xf0ab('0x50')];if(_0x1e3b91){var _0x54efed={'nonce':_0x535274[_0xf0ab('0x56')],'iat':_0x535274['apiKeyIat'],'audience':hardwareConf[_0xf0ab('0x51')](),'issuer':hardwareConf[_0xf0ab('0x51')]()};return verifyJwt(_0x1e3b91,_0x54efed)[_0xf0ab('0x4a')](function(){return generateApiKey(_0x535274);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x57b05f){var _0x2db43d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2db43d[_0xf0ab('0x71')](_0x57b05f))throw new db['Sequelize']['ValidationError'](_0xf0ab('0x72'));return;};exports[_0xf0ab('0x73')]=function(_0x8df75a,_0x4ead7d,_0x227597){var _0x41ea9d=encryptor[_0xf0ab('0x74')](_0x4ead7d)[_0xf0ab('0x75')](',');for(var _0x1d7616=0x0;_0x1d7616<_0x227597;_0x1d7616++){if(!_0x41ea9d[_0x1d7616])break;if(_0x8df75a[_0xf0ab('0x76')]()===_0x41ea9d[_0x1d7616][_0xf0ab('0x76')]()){var _0x4d80a6=util[_0xf0ab('0x77')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x227597);if(_0x227597===0x1){_0x4d80a6=_0xf0ab('0x78');}throw new db[(_0xf0ab('0x79'))][(_0xf0ab('0x7a'))](_0x4d80a6);}}return;};exports[_0xf0ab('0x7b')]=function(_0x3e1b85,_0x3c168f){var _0x152e80=_0x3c168f?encryptor[_0xf0ab('0x74')](_0x3c168f)[_0xf0ab('0x75')](','):[];if(_0x152e80[_0xf0ab('0x7c')]===0x5){_0x152e80['splice'](-0x1,0x1);}_0x152e80[_0xf0ab('0x7d')](_0x3e1b85);return encryptor[_0xf0ab('0x7e')](_0x152e80[_0xf0ab('0x7f')](','));};function signJwt(_0x1d4a72){var _0x2232eb=BPromise[_0xf0ab('0x80')](jwt[_0xf0ab('0x81')],{'context':jwt});var _0x14f61e=_0x1d4a72[_0xf0ab('0x82')]||config['secrets']['session'];return new BPromise(function(_0x7e0318,_0x5c286d){_0x2232eb(_0x1d4a72[_0xf0ab('0x83')],_0x14f61e,_0x1d4a72['options'])[_0xf0ab('0x4a')](function(_0x1cc702){_0x7e0318(_0x1cc702);})[_0xf0ab('0x5d')](function(_0x5daeda){_0x5c286d(_0x5daeda);});});}function verifyJwt(_0x2c1a44,_0x16522b,_0x3fc57e){var _0x3d333f=BPromise[_0xf0ab('0x80')](jwt['verify'],{'context':jwt});var _0x3f0e11=_0x3fc57e||config[_0xf0ab('0xa')][_0xf0ab('0x84')];return new BPromise(function(_0x4531ae,_0x14cd6f){_0x3d333f(_0x2c1a44,_0x3f0e11,_0x16522b)[_0xf0ab('0x4a')](function(_0xe3fc19){_0x4531ae(_0xe3fc19);})[_0xf0ab('0x5d')](function(_0x2d9194){_0x14cd6f(_0x2d9194);});});}function generateNonce(){return crypto[_0xf0ab('0x85')](0x10)[_0xf0ab('0x86')](_0xf0ab('0x87'));}function generateIssuedAt(){return Math[_0xf0ab('0x88')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x3e1f1e){var _0x1490de={'payload':{'iat':_0x3e1f1e[_0xf0ab('0x89')],'nonce':_0x3e1f1e['apiKeyNonce']},'options':{'algorithm':_0xf0ab('0x8a'),'subject':_0x3e1f1e['id']['toString'](),'issuer':hardwareConf[_0xf0ab('0x51')](),'audience':hardwareConf[_0xf0ab('0x51')]()}};return signJwt(_0x1490de)[_0xf0ab('0x4a')](function(_0x52e201){return{'iat':_0x3e1f1e[_0xf0ab('0x89')],'nonce':_0x3e1f1e['apiKeyNonce'],'token':_0x52e201};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 649210d..e60758d 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 _0x64f2=['where','default','fields','filter','user','clause','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','catch','CmContact','describe','keys','startsWith','map','CmCustomField','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','search','parseQueryParameters','then'];(function(_0x47abbc,_0x5a8c7a){var _0x55a157=function(_0x1e3f32){while(--_0x1e3f32){_0x47abbc['push'](_0x47abbc['shift']());}};_0x55a157(++_0x5a8c7a);}(_0x64f2,0x1a7));var _0x264f=function(_0x1e4642,_0x15a71e){_0x1e4642=_0x1e4642-0x0;var _0x3acc79=_0x64f2[_0x1e4642];return _0x3acc79;};'use strict';var _=require('lodash');var sqlUtils=require(_0x264f('0x0'));var db=require(_0x264f('0x1'))['db'];exports[_0x264f('0x2')]=function(_0x500767,_0x378c45,_0x27caf7,_0x2dd19e){var _0x45870e={'count':0x0,'rows':[]};var _0x5d1ef3=sqlUtils[_0x264f('0x3')](_0x378c45,_0x500767);if(_0x5d1ef3){return Promise['resolve'](_0x45870e);}var _0x3430cc=sqlUtils[_0x264f('0x4')]();var _0x571e78={};var _0x558f40=![];var _0x33b0a8=![];return Promise[_0x264f('0x5')]()['then'](function(){if(_0x500767[_0x264f('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x500767['search'],_0x2dd19e);}else{return sqlUtils[_0x264f('0x7')](_0x500767,_0x2dd19e);}})[_0x264f('0x8')](function(_0xa29db5){_0x3430cc[_0x264f('0x9')](_0xa29db5[_0x264f('0xa')]);_0x3430cc['where'](_0xa29db5[_0x264f('0xb')]);_0x3430cc[_0x264f('0x9')](_0xa29db5[_0x264f('0xc')]);_0x3430cc[_0x264f('0x9')](_0xa29db5[_0x264f('0xd')][_0x264f('0xe')]);_0x571e78=_0xa29db5[_0x264f('0xf')];_0x33b0a8=_0xa29db5[_0x264f('0xd')]['skip'];return sqlUtils[_0x264f('0x10')](_0x378c45,_0x500767,_0x33b0a8);})[_0x264f('0x8')](function(_0x49dde7){_0x3430cc[_0x264f('0x9')](_0x49dde7);var _0x405f22=_0x500767[_0x264f('0x6')]?_0x571e78[_0x264f('0x11')]:_0x500767[_0x264f('0x12')];_0x558f40=_0x405f22?!![]:![];return sqlUtils[_0x264f('0x13')](_0x3430cc,_0x405f22);})[_0x264f('0x8')](function(_0xefe8d8){_0x45870e['count']=_0xefe8d8;if(_0x45870e[_0x264f('0x14')]===0x0){return;}if(_0x500767['User']){_0x33b0a8=!![];}return sqlUtils[_0x264f('0x15')](_0x3430cc,_0x500767[_0x264f('0xb')],_0x27caf7,_0x558f40,_0x571e78[_0x264f('0xe')],_0x33b0a8);})['then'](function(_0x3218a9){if(!_0x3218a9){return[];}return sqlUtils[_0x264f('0x16')](_0x3218a9,_0x500767,_0x27caf7);})[_0x264f('0x8')](function(_0x10f671){_0x45870e['rows']=_0x10f671;return _0x45870e;})[_0x264f('0x17')](function(_0x4ce0e3){throw _0x4ce0e3;});};exports['describe']=function(){var _0x3db9a9={};var _0x30ba52=[];return db[_0x264f('0x18')][_0x264f('0x19')]()[_0x264f('0x8')](function(_0x42ef0b){_0x3db9a9=_0x42ef0b;var _0x570ad9=Object[_0x264f('0x1a')](_0x3db9a9)['filter'](function(_0x3d7d3a){return _[_0x264f('0x1b')](_0x3d7d3a,'cf_')?_0x3d7d3a:undefined;});var _0x4307c9=_0x570ad9[_0x264f('0x1c')](function(_0xc5e1bb){return db[_0x264f('0x1d')][_0x264f('0x1e')]({'where':{'id':_0xc5e1bb[_0x264f('0x1f')](0x3)},'raw':!![]});});return Promise[_0x264f('0x20')](_0x4307c9);})[_0x264f('0x8')](function(_0x4bb371){for(var _0x15739b=0x0;_0x15739b<_0x4bb371[_0x264f('0x21')];_0x15739b++){if(_0x4bb371[_0x15739b]){var _0x28e7ed='cf_'+_0x4bb371[_0x15739b]['id'];_0x3db9a9[_0x28e7ed][_0x264f('0x22')]=_0x4bb371[_0x15739b][_0x264f('0x23')];}}_0x30ba52=_[_0x264f('0x1c')](Object[_0x264f('0x1a')](_0x3db9a9),function(_0x4de6bc){return{'name':_0x4de6bc,'type':_0x3db9a9[_0x4de6bc][_0x264f('0x23')]};});return _0x30ba52;})[_0x264f('0x17')](function(_0x2e3888){throw _0x2e3888;});}; \ No newline at end of file +var _0x6486=['where','default','fields','filter','user','clause','tags','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search'];(function(_0x24759f,_0x138533){var _0x25d89f=function(_0x1b6c61){while(--_0x1b6c61){_0x24759f['push'](_0x24759f['shift']());}};_0x25d89f(++_0x138533);}(_0x6486,0x7d));var _0x6648=function(_0x24c733,_0x525907){_0x24c733=_0x24c733-0x0;var _0x21a2d3=_0x6486[_0x24c733];return _0x21a2d3;};'use strict';var _=require(_0x6648('0x0'));var sqlUtils=require(_0x6648('0x1'));var db=require(_0x6648('0x2'))['db'];exports['findAll']=function(_0x1059ef,_0x9f0440,_0x1be1b4,_0xd9338d){var _0x1da5ea={'count':0x0,'rows':[]};var _0x136d15=sqlUtils[_0x6648('0x3')](_0x9f0440,_0x1059ef);if(_0x136d15){return Promise['resolve'](_0x1da5ea);}var _0x55e814=sqlUtils['getContactsSubquery']();var _0xd7de87={};var _0x400052=![];var _0x5c4003=![];return Promise[_0x6648('0x4')]()[_0x6648('0x5')](function(){if(_0x1059ef[_0x6648('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1059ef[_0x6648('0x6')],_0xd9338d);}else{return sqlUtils['parseQueryParameters'](_0x1059ef,_0xd9338d);}})['then'](function(_0x4bc94c){_0x55e814[_0x6648('0x7')](_0x4bc94c[_0x6648('0x8')]);_0x55e814[_0x6648('0x7')](_0x4bc94c[_0x6648('0x9')]);_0x55e814['where'](_0x4bc94c[_0x6648('0xa')]);_0x55e814['where'](_0x4bc94c[_0x6648('0xb')][_0x6648('0xc')]);_0xd7de87=_0x4bc94c[_0x6648('0xd')];_0x5c4003=_0x4bc94c[_0x6648('0xb')]['skip'];return sqlUtils['checkListsRestrictions'](_0x9f0440,_0x1059ef,_0x5c4003);})['then'](function(_0x341cdf){_0x55e814[_0x6648('0x7')](_0x341cdf);var _0x37899f=_0x1059ef[_0x6648('0x6')]?_0xd7de87['ids']:_0x1059ef[_0x6648('0xe')];_0x400052=_0x37899f?!![]:![];return sqlUtils[_0x6648('0xf')](_0x55e814,_0x37899f);})[_0x6648('0x5')](function(_0x4c94ab){_0x1da5ea[_0x6648('0x10')]=_0x4c94ab;if(_0x1da5ea[_0x6648('0x10')]===0x0){return;}if(_0x1059ef[_0x6648('0x11')]){_0x5c4003=!![];}return sqlUtils[_0x6648('0x12')](_0x55e814,_0x1059ef['fields'],_0x1be1b4,_0x400052,_0xd7de87['clause'],_0x5c4003);})[_0x6648('0x5')](function(_0x570500){if(!_0x570500){return[];}return sqlUtils[_0x6648('0x13')](_0x570500,_0x1059ef,_0x1be1b4);})[_0x6648('0x5')](function(_0x3b0d63){_0x1da5ea['rows']=_0x3b0d63;return _0x1da5ea;})[_0x6648('0x14')](function(_0x17024c){throw _0x17024c;});};exports[_0x6648('0x15')]=function(){var _0x5b6164={};var _0x4e3d17=[];return db[_0x6648('0x16')]['describe']()[_0x6648('0x5')](function(_0x3356b3){_0x5b6164=_0x3356b3;var _0x598770=Object[_0x6648('0x17')](_0x5b6164)['filter'](function(_0x4378f4){return _[_0x6648('0x18')](_0x4378f4,_0x6648('0x19'))?_0x4378f4:undefined;});var _0x1c79c8=_0x598770[_0x6648('0x1a')](function(_0x4cbf08){return db[_0x6648('0x1b')][_0x6648('0x1c')]({'where':{'id':_0x4cbf08[_0x6648('0x1d')](0x3)},'raw':!![]});});return Promise[_0x6648('0x1e')](_0x1c79c8);})['then'](function(_0x270cbe){for(var _0x2f9eb0=0x0;_0x2f9eb0<_0x270cbe[_0x6648('0x1f')];_0x2f9eb0++){if(_0x270cbe[_0x2f9eb0]){var _0x5b26a0=_0x6648('0x19')+_0x270cbe[_0x2f9eb0]['id'];_0x5b6164[_0x5b26a0]['fieldType']=_0x270cbe[_0x2f9eb0][_0x6648('0x20')];}}_0x4e3d17=_[_0x6648('0x1a')](Object[_0x6648('0x17')](_0x5b6164),function(_0x3f979d){return{'name':_0x3f979d,'type':_0x5b6164[_0x3f979d][_0x6648('0x20')]};});return _0x4e3d17;})['catch'](function(_0x119b03){throw _0x119b03;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 0fb03fa..6df467f 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 _0xa666=['ct.CmContactId\x20=\x20','subqry','firstName','phone','mobile','email','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','push','field','expr','getSelectedTags','forEach','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','conditions','find','name','dateOfBirth','fieldType','datetime','buildExpression','type','default','text','value','start','Tag','map','tags','clause','and','ids','User','user','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','subqry.','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/qs','../interaction/utils','role','agent','search','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id'];(function(_0xb2a14f,_0x5b7d9d){var _0x2a7f66=function(_0xabede0){while(--_0xabede0){_0xb2a14f['push'](_0xb2a14f['shift']());}};_0x2a7f66(++_0x5b7d9d);}(_0xa666,0x188));var _0x6a66=function(_0x49df15,_0x5abb73){_0x49df15=_0x49df15-0x0;var _0x42808a=_0xa666[_0x49df15];return _0x42808a;};'use strict';var _=require(_0x6a66('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x6a66('0x1'));var utils=require(_0x6a66('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x272edd,_0x2c490d){var _0x47b5b5=![];if(_0x272edd[_0x6a66('0x3')]===_0x6a66('0x4')&&!_0x2c490d[_0x6a66('0x5')]&&!_0x2c490d['ListId']&&_0x2c490d[_0x6a66('0x6')]!==_0x6a66('0x7')){_0x47b5b5=!![];}return _0x47b5b5;}function getContactsSubquery(){return squel['select']()[_0x6a66('0x8')](_0x6a66('0x9'),'c')[_0x6a66('0xa')](_0x6a66('0xb'));}function applyJoinClauses(_0x46df38,_0x176645){var _0x55c4b4=_0x176645?'c':'subqry';_0x46df38[_0x6a66('0xc')](_0x6a66('0xd'),'uc',_0x6a66('0xe')+_0x55c4b4+_0x6a66('0xf'))['left_join']('cm_contact_has_tags','ct',_0x6a66('0x10')+_0x55c4b4+_0x6a66('0xf'))['left_join']('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x46df38;}function addFieldsToQuery(_0x5a7b79,_0x2f838e,_0x4e1401,_0x4aa7ed,_0x760da1){var _0x4c5f15=_0x760da1?'c':_0x6a66('0x11');if(!_0x2f838e){_0x2f838e=['id',_0x6a66('0x12'),'lastName',_0x6a66('0x13'),_0x6a66('0x14'),'fax',_0x6a66('0x15'),_0x6a66('0x16'),_0x6a66('0x17'),'createdAt',_0x6a66('0x18'),_0x6a66('0x19'),_0x6a66('0x1a')];}else if(!_0x2f838e[_0x6a66('0x1b')]('id')){_0x2f838e[_0x6a66('0x1c')]('id');}var _0x2e506a=_0x4e1401&&_0x760da1||!_0x4e1401&&!_0x760da1;if(_0x4aa7ed){_0x2e506a=_0x4aa7ed&&_0x760da1||!_0x4aa7ed&&!_0x760da1;}_0x2f838e['forEach'](function(_0x5c2cf4){if(_0x5c2cf4==='TagIds'){if(_0x2e506a){_0x5a7b79[_0x6a66('0x1d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5c2cf4);}else if(_0x4e1401||_0x4aa7ed){_0x5a7b79[_0x6a66('0x1d')](_0x4c5f15+'.'+_0x5c2cf4);}}else{_0x5a7b79[_0x6a66('0x1d')](_0x4c5f15+'.'+_0x5c2cf4);}});return _0x5a7b79;}function getSqlClauses(){var _0xe1dbe2={'default':squel[_0x6a66('0x1e')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x6a66('0x1e')](),'ids':null},'user':{'clause':squel[_0x6a66('0x1e')](),'skip':![]}};return _0xe1dbe2;}function parseTagParameter(_0x299d6c){var _0x93e1c4=squel['expr']();if(_0x299d6c){var _0x12ef76=utils[_0x6a66('0x1f')](_0x299d6c);_0x12ef76[_0x6a66('0x20')](function(_0x5beb85){_0x93e1c4['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5beb85+',%');});}return _0x93e1c4;}function parseSearchFilter(_0x126864){var _0x21a6c4=squel[_0x6a66('0x1e')]();if(_0x126864){var _0x1eff6d=_0x126864[_0x6a66('0x21')]('\x5c','\x5c\x5c')[_0x6a66('0x21')](/'/g,'\x27\x27');if(_0x1eff6d[_0x6a66('0x22')]('\x20')[_0x6a66('0x23')]>0x1){_0x21a6c4['or'](_0x6a66('0x24'),qs['getFullTextValue'](_0x1eff6d,!![]),null);}else{if(qs[_0x6a66('0x25')](_0x1eff6d)){_0x21a6c4['or']('c.id\x20LIKE\x20?',_0x1eff6d+'%');_0x21a6c4['or']('c.phone\x20LIKE\x20?',_0x1eff6d+'%');_0x21a6c4['or'](_0x6a66('0x26'),_0x1eff6d+'%');_0x21a6c4['or'](_0x6a66('0x27'),_0x1eff6d+'%');}else if(qs[_0x6a66('0x28')](_0x1eff6d)){_0x21a6c4['or']('c.email\x20LIKE\x20?',_0x1eff6d+'%');}else{_0x21a6c4['or'](_0x6a66('0x29'),'%'+_0x1eff6d+'%');_0x21a6c4['or']('c.lastName\x20LIKE\x20?','%'+_0x1eff6d+'%');_0x21a6c4['or']('c.email\x20LIKE\x20?','%'+_0x1eff6d+'%');}}}return _0x21a6c4;}function parseAdvancedSearchFilter(_0x4915f8,_0x4b1f81){var _0x59a9dd=getSqlClauses();var _0x12ed64=as['parseSearch'](_0x4915f8);var _0x3a73cf=_0x12ed64['sqlOperator'];for(var _0x176203=0x0;_0x176203<_0x12ed64[_0x6a66('0x2a')][_0x6a66('0x23')];_0x176203++){var _0x407cdc=_0x12ed64[_0x6a66('0x2a')][_0x176203];var _0x2aaf38='c';var _0x2f46e4=_[_0x6a66('0x2b')](_0x4b1f81,[_0x6a66('0x2c'),_0x407cdc[_0x6a66('0x1d')]]);if(_0x2f46e4){if(_0x407cdc[_0x6a66('0x1d')]===_0x6a66('0x2d')||_0x2f46e4[_0x6a66('0x2e')]===_0x6a66('0x2f')){_0x407cdc['castTo']='DATE';}var _0x101fc9=as[_0x6a66('0x30')](_0x2aaf38,_0x2f46e4[_0x6a66('0x31')],_0x407cdc);_0x59a9dd[_0x6a66('0x32')][_0x3a73cf](_0x101fc9[_0x6a66('0x33')],_0x101fc9[_0x6a66('0x34')][_0x6a66('0x35')],_0x101fc9[_0x6a66('0x34')]['end']);}else{if(_0x407cdc['field']===_0x6a66('0x36')){var _0x3e3cf3=_0x407cdc[_0x6a66('0x34')][_0x6a66('0x22')](',')[_0x6a66('0x37')](function(_0x27f120){return Number(_0x27f120);});var _0x3148b9=parseTagParameter(_0x3e3cf3);_0x59a9dd[_0x6a66('0x38')][_0x6a66('0x39')][_0x6a66('0x3a')](_0x3148b9);_0x59a9dd[_0x6a66('0x38')][_0x6a66('0x3b')]=_0x3e3cf3;}else if(_0x407cdc[_0x6a66('0x1d')]===_0x6a66('0x3c')){_0x59a9dd[_0x6a66('0x3d')][_0x6a66('0x39')][_0x6a66('0x3a')]('uc.UserId\x20=\x20?',_0x407cdc[_0x6a66('0x34')]);_0x59a9dd[_0x6a66('0x3d')]['skip']=!![];}}}return _0x59a9dd;}function parseModelFields(_0x32250d,_0x475ac2){var _0xce1163=squel[_0x6a66('0x1e')]();var _0x17d217=_(_0x32250d)[_0x6a66('0x3e')]()['map'](function(_0x4143ea){return _[_0x6a66('0x3f')](_0x475ac2,[_0x6a66('0x2c'),_0x4143ea])?_0x4143ea:undefined;})[_0x6a66('0x40')]()[_0x6a66('0x34')]();if(_0x32250d[_0x6a66('0x41')]){_0x17d217['push'](_0x6a66('0x41'));}if(_0x32250d['User']){_0x17d217[_0x6a66('0x1c')](_0x6a66('0x3c'));}if(_0x17d217[_0x6a66('0x23')]>0x0){_0x17d217['forEach'](function(_0x412060){if(_0x412060===_0x6a66('0x16')){_0xce1163['and'](_0x6a66('0x42'),[][_0x6a66('0x43')](_0x32250d[_0x412060]));}else if(_0x412060===_0x6a66('0x41')){var _0x42c688='%'+_0x32250d[_0x412060]+'%';_0xce1163[_0x6a66('0x3a')](_0x6a66('0x44'),_0x42c688);}else if(_0x412060==='User'){_0xce1163[_0x6a66('0x3a')]('uc.UserId\x20=\x20?',_0x32250d[_0x412060]);}else{_0xce1163['and']('c.'+_0x412060+_0x6a66('0x45'),_0x32250d[_0x412060]);}});}return _0xce1163;}function parseQueryParameters(_0x2cdc0e,_0x4ed444){var _0x12c164=getSqlClauses();return Promise[_0x6a66('0x46')]()['then'](function(){return parseModelFields(_0x2cdc0e,_0x4ed444);})[_0x6a66('0x47')](function(_0x20d9f7){_0x12c164[_0x6a66('0x48')][_0x6a66('0x3a')](_0x20d9f7);return parseTagParameter(_0x2cdc0e[_0x6a66('0x49')]);})[_0x6a66('0x47')](function(_0x226c0a){_0x12c164[_0x6a66('0x38')]['clause']['and'](_0x226c0a);return parseSearchFilter(_0x2cdc0e[_0x6a66('0x4a')]);})[_0x6a66('0x47')](function(_0x26e314){_0x12c164[_0x6a66('0x4a')]=_0x26e314;return _0x12c164;});}function checkListsRestrictions(_0x4119f5,_0x17599e,_0x2a3eba){var _0x4ec11b=squel[_0x6a66('0x1e')]();return Promise['resolve']()[_0x6a66('0x47')](function(){if(_0x17599e[_0x6a66('0x5')]&&_0x4119f5[_0x6a66('0x3')]===_0x6a66('0x4')&&!_0x2a3eba){return _0x4119f5[_0x6a66('0x4b')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x83e257){if(_0x83e257){if(_0x83e257['length']===0x0){_0x4ec11b['and'](_0x6a66('0x4c'));}else{_0x4ec11b[_0x6a66('0x3a')](_0x6a66('0x42'),_[_0x6a66('0x37')](_0x83e257,'id'));}}})[_0x6a66('0x47')](function(){return _0x4ec11b;});}function buildContactsQuery(_0x2f9277,_0x56bc1f,_0x5817e6,_0x3ea132,_0x251d69,_0x38c251){if(_0x56bc1f){_0x56bc1f=_0x5817e6[_0x6a66('0x4d')];}_0x2f9277=addFieldsToQuery(_0x2f9277,_0x56bc1f,_0x3ea132,_0x38c251,!![]);var _0x5574f5=squel['select']();_0x5574f5=addFieldsToQuery(_0x5574f5,_0x56bc1f,_0x3ea132,_0x38c251,![]);if(_0x3ea132||_0x38c251){_0x2f9277=applyJoinClauses(_0x2f9277,!![]);_0x2f9277[_0x6a66('0x4e')](_0x6a66('0x4f'));if(_0x5817e6[_0x6a66('0x50')]){_0x5574f5[_0x6a66('0x50')](_0x5817e6['limit']);}if(_0x5817e6['offset']){_0x5574f5[_0x6a66('0x51')](_0x5817e6['offset']);}}else{_0x5574f5=applyJoinClauses(_0x5574f5,![]);_0x5574f5['group']('subqry.id');if(_0x5817e6[_0x6a66('0x50')]){_0x2f9277['limit'](_0x5817e6[_0x6a66('0x50')]);}if(_0x5817e6[_0x6a66('0x51')]){_0x2f9277[_0x6a66('0x51')](_0x5817e6['offset']);}}_0x5574f5[_0x6a66('0x52')](_0x251d69);if(_0x5817e6[_0x6a66('0x53')]){_0x5817e6[_0x6a66('0x53')][_0x6a66('0x20')](function(_0x19b961){_0x2f9277['order']('c.'+_0x19b961[0x0],_0x19b961[0x1]==='DESC'?![]:!![]);_0x5574f5[_0x6a66('0x53')](_0x6a66('0x54')+_0x19b961[0x0],_0x19b961[0x1]===_0x6a66('0x55')?![]:!![]);});}_0x5574f5[_0x6a66('0x8')](_0x2f9277,_0x6a66('0x11'));return _0x5574f5;}function getFilteredContacts(_0x17a67b){var _0x1a87fb=[];return db[_0x6a66('0x36')][_0x6a66('0x56')]({'attributes':['id',_0x6a66('0x2c'),_0x6a66('0x57')],'raw':!![]})[_0x6a66('0x47')](function(_0x213732){_0x1a87fb=_[_0x6a66('0x58')](_0x213732,'id');var _0x3acbec={'type':db[_0x6a66('0x59')][_0x6a66('0x5a')][_0x6a66('0x5b')],'model':db[_0x6a66('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6a66('0x5d')][_0x6a66('0x5e')](_0x17a67b[_0x6a66('0x5f')](),_0x3acbec);})['then'](function(_0x567501){_0x567501[_0x6a66('0x20')](function(_0x21a31e){if(_0x21a31e[_0x6a66('0x1a')]){_0x21a31e[_0x6a66('0x60')]=[];_0x21a31e[_0x6a66('0x1a')][_0x6a66('0x22')](',')[_0x6a66('0x20')](function(_0x1f955b){_0x21a31e[_0x6a66('0x60')]['push'](_0x1a87fb[_0x1f955b]);});}delete _0x21a31e[_0x6a66('0x1a')];});return _0x567501;});}function countFilteredContacts(_0x7be050,_0x54bd61){var _0x45047e=_0x7be050[_0x6a66('0x61')]();_0x45047e[_0x6a66('0x1d')](_0x6a66('0x62'));_0x45047e=applyJoinClauses(_0x45047e,!![]);_0x7be050['group'](_0x6a66('0x4f'));var _0x29928b=utils['getSelectedTags'](_0x54bd61);if(!_[_0x6a66('0x63')](_0x29928b)){_0x45047e[_0x6a66('0xa')](_0x6a66('0x64'),_0x29928b);}var _0x52590d={'type':db[_0x6a66('0x59')][_0x6a66('0x5a')][_0x6a66('0x5b')],'raw':!![]};return db['sequelize'][_0x6a66('0x5e')](_0x45047e[_0x6a66('0x5f')](),_0x52590d)[_0x6a66('0x47')](function(_0x1c971c){return _0x1c971c[0x0]['COUNT(*)'];});}module[_0x6a66('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x0e22=['sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','type','default','start','value','end','map','tags','ids','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','User','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','fields','tag','then','clause','filter','resolve','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','group','c.id','isEmpty','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','firstName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e22,0x115));var _0x20e2=function(_0x409682,_0x370090){_0x409682=_0x409682-0x0;var _0x1ee901=_0x0e22[_0x409682];return _0x1ee901;};'use strict';var _=require('lodash');var squel=require(_0x20e2('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x20e2('0x1'));var utils=require(_0x20e2('0x2'));var db=require(_0x20e2('0x3'))['db'];function skipContactsQuery(_0xca1120,_0x58caca){var _0x1a3190=![];if(_0xca1120[_0x20e2('0x4')]===_0x20e2('0x5')&&!_0x58caca[_0x20e2('0x6')]&&!_0x58caca[_0x20e2('0x7')]&&_0x58caca[_0x20e2('0x8')]!==_0x20e2('0x9')){_0x1a3190=!![];}return _0x1a3190;}function getContactsSubquery(){return squel[_0x20e2('0xa')]()[_0x20e2('0xb')](_0x20e2('0xc'),'c')[_0x20e2('0xd')](_0x20e2('0xe'));}function applyJoinClauses(_0x4c78a9,_0x400121){var _0x513129=_0x400121?'c':_0x20e2('0xf');_0x4c78a9[_0x20e2('0x10')](_0x20e2('0x11'),'uc',_0x20e2('0x12')+_0x513129+_0x20e2('0x13'))[_0x20e2('0x10')]('cm_contact_has_tags','ct',_0x20e2('0x14')+_0x513129+_0x20e2('0x13'))[_0x20e2('0x10')](_0x20e2('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x4c78a9;}function addFieldsToQuery(_0x15369d,_0x451d5b,_0x3eb834,_0x5651df,_0x2c7f2e){var _0x4ddba0=_0x2c7f2e?'c':_0x20e2('0xf');if(!_0x451d5b){_0x451d5b=['id',_0x20e2('0x16'),'lastName',_0x20e2('0x17'),_0x20e2('0x18'),_0x20e2('0x19'),_0x20e2('0x1a'),_0x20e2('0x7'),'CompanyId',_0x20e2('0x1b'),_0x20e2('0x1c'),_0x20e2('0x1d'),'TagIds'];}else if(!_0x451d5b[_0x20e2('0x1e')]('id')){_0x451d5b[_0x20e2('0x1f')]('id');}var _0x28ebcf=_0x3eb834&&_0x2c7f2e||!_0x3eb834&&!_0x2c7f2e;if(_0x5651df){_0x28ebcf=_0x5651df&&_0x2c7f2e||!_0x5651df&&!_0x2c7f2e;}_0x451d5b[_0x20e2('0x20')](function(_0x28ea2a){if(_0x28ea2a===_0x20e2('0x21')){if(_0x28ebcf){_0x15369d[_0x20e2('0x22')](_0x20e2('0x23'),_0x28ea2a);}else if(_0x3eb834||_0x5651df){_0x15369d[_0x20e2('0x22')](_0x4ddba0+'.'+_0x28ea2a);}}else{_0x15369d[_0x20e2('0x22')](_0x4ddba0+'.'+_0x28ea2a);}});return _0x15369d;}function getSqlClauses(){var _0x2863ad={'default':squel[_0x20e2('0x24')](),'fields':squel[_0x20e2('0x24')](),'filter':squel[_0x20e2('0x24')](),'tags':{'clause':squel[_0x20e2('0x24')](),'ids':null},'user':{'clause':squel[_0x20e2('0x24')](),'skip':![]}};return _0x2863ad;}function parseTagParameter(_0x319c44){var _0xc9c17d=squel['expr']();if(_0x319c44){var _0x4bcc45=utils[_0x20e2('0x25')](_0x319c44);_0x4bcc45[_0x20e2('0x20')](function(_0xb3da84){_0xc9c17d['or'](_0x20e2('0x26'),'%,'+_0xb3da84+',%');});}return _0xc9c17d;}function parseSearchFilter(_0x19ec55){var _0x10f4c4=squel['expr']();if(_0x19ec55){var _0x2b2ceb=_0x19ec55[_0x20e2('0x27')]('\x5c','\x5c\x5c')[_0x20e2('0x27')](/'/g,'\x27\x27');if(_0x2b2ceb[_0x20e2('0x28')]('\x20')[_0x20e2('0x29')]>0x1){_0x10f4c4['or'](_0x20e2('0x2a'),qs['getFullTextValue'](_0x2b2ceb,!![]),null);}else{if(qs[_0x20e2('0x2b')](_0x2b2ceb)){_0x10f4c4['or']('c.id\x20LIKE\x20?',_0x2b2ceb+'%');_0x10f4c4['or'](_0x20e2('0x2c'),_0x2b2ceb+'%');_0x10f4c4['or'](_0x20e2('0x2d'),_0x2b2ceb+'%');_0x10f4c4['or']('c.fax\x20LIKE\x20?',_0x2b2ceb+'%');}else if(qs['isEmail'](_0x2b2ceb)){_0x10f4c4['or']('c.email\x20LIKE\x20?',_0x2b2ceb+'%');}else{_0x10f4c4['or'](_0x20e2('0x2e'),'%'+_0x2b2ceb+'%');_0x10f4c4['or'](_0x20e2('0x2f'),'%'+_0x2b2ceb+'%');_0x10f4c4['or'](_0x20e2('0x30'),'%'+_0x2b2ceb+'%');}}}return _0x10f4c4;}function parseAdvancedSearchFilter(_0xeeec92,_0x3cc003){var _0x41ef69=getSqlClauses();var _0x1d9ba0=as[_0x20e2('0x31')](_0xeeec92);var _0x2f59ea=_0x1d9ba0[_0x20e2('0x32')];for(var _0x12d731=0x0;_0x12d731<_0x1d9ba0[_0x20e2('0x33')]['length'];_0x12d731++){var _0x4ed877=_0x1d9ba0[_0x20e2('0x33')][_0x12d731];var _0x50b061='c';var _0x2224cc=_[_0x20e2('0x34')](_0x3cc003,[_0x20e2('0x35'),_0x4ed877['field']]);if(_0x2224cc){if(_0x4ed877[_0x20e2('0x22')]===_0x20e2('0x36')||_0x2224cc[_0x20e2('0x37')]===_0x20e2('0x38')){_0x4ed877['castTo']=_0x20e2('0x39');}var _0x144d6d=as['buildExpression'](_0x50b061,_0x2224cc[_0x20e2('0x3a')],_0x4ed877);_0x41ef69[_0x20e2('0x3b')][_0x2f59ea](_0x144d6d['text'],_0x144d6d['value'][_0x20e2('0x3c')],_0x144d6d[_0x20e2('0x3d')][_0x20e2('0x3e')]);}else{if(_0x4ed877[_0x20e2('0x22')]==='Tag'){var _0x350b34=_0x4ed877[_0x20e2('0x3d')]['split'](',')[_0x20e2('0x3f')](function(_0xe6160){return Number(_0xe6160);});var _0x4c438e=parseTagParameter(_0x350b34);_0x41ef69['tags']['clause']['and'](_0x4c438e);_0x41ef69[_0x20e2('0x40')][_0x20e2('0x41')]=_0x350b34;}else if(_0x4ed877[_0x20e2('0x22')]==='User'){_0x41ef69[_0x20e2('0x42')]['clause']['and'](_0x20e2('0x43'),_0x4ed877[_0x20e2('0x3d')]);_0x41ef69[_0x20e2('0x42')][_0x20e2('0x44')]=!![];}}}return _0x41ef69;}function parseModelFields(_0x1493bf,_0x56415a){var _0x3694e6=squel[_0x20e2('0x24')]();var _0x355f71=_(_0x1493bf)[_0x20e2('0x45')]()[_0x20e2('0x3f')](function(_0x33c433){return _[_0x20e2('0x46')](_0x56415a,[_0x20e2('0x35'),_0x33c433])?_0x33c433:undefined;})[_0x20e2('0x47')]()[_0x20e2('0x3d')]();if(_0x1493bf[_0x20e2('0x48')]){_0x355f71[_0x20e2('0x1f')](_0x20e2('0x48'));}if(_0x1493bf[_0x20e2('0x49')]){_0x355f71[_0x20e2('0x1f')]('User');}if(_0x355f71[_0x20e2('0x29')]>0x0){_0x355f71[_0x20e2('0x20')](function(_0x427a90){if(_0x427a90==='ListId'){_0x3694e6[_0x20e2('0x4a')]('c.ListId\x20IN\x20?',[][_0x20e2('0x4b')](_0x1493bf[_0x427a90]));}else if(_0x427a90===_0x20e2('0x48')){var _0x398da2='%'+_0x1493bf[_0x427a90]+'%';_0x3694e6['and'](_0x20e2('0x4c'),_0x398da2);}else if(_0x427a90===_0x20e2('0x49')){_0x3694e6[_0x20e2('0x4a')](_0x20e2('0x43'),_0x1493bf[_0x427a90]);}else{_0x3694e6[_0x20e2('0x4a')]('c.'+_0x427a90+_0x20e2('0x4d'),_0x1493bf[_0x427a90]);}});}return _0x3694e6;}function parseQueryParameters(_0x4cebfe,_0x18d78a){var _0x1b72e6=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x4cebfe,_0x18d78a);})['then'](function(_0x497137){_0x1b72e6[_0x20e2('0x4e')][_0x20e2('0x4a')](_0x497137);return parseTagParameter(_0x4cebfe[_0x20e2('0x4f')]);})[_0x20e2('0x50')](function(_0x523ee8){_0x1b72e6['tags'][_0x20e2('0x51')][_0x20e2('0x4a')](_0x523ee8);return parseSearchFilter(_0x4cebfe['filter']);})[_0x20e2('0x50')](function(_0x1d6f2b){_0x1b72e6[_0x20e2('0x52')]=_0x1d6f2b;return _0x1b72e6;});}function checkListsRestrictions(_0x213058,_0x4934aa,_0x4fa98e){var _0x2a8529=squel[_0x20e2('0x24')]();return Promise[_0x20e2('0x53')]()[_0x20e2('0x50')](function(){if(_0x4934aa[_0x20e2('0x6')]&&_0x213058[_0x20e2('0x4')]===_0x20e2('0x5')&&!_0x4fa98e){return _0x213058[_0x20e2('0x54')]({'attributes':['id'],'raw':!![]});}})[_0x20e2('0x50')](function(_0xd37f85){if(_0xd37f85){if(_0xd37f85[_0x20e2('0x29')]===0x0){_0x2a8529[_0x20e2('0x4a')](_0x20e2('0x55'));}else{_0x2a8529[_0x20e2('0x4a')](_0x20e2('0x56'),_[_0x20e2('0x3f')](_0xd37f85,'id'));}}})[_0x20e2('0x50')](function(){return _0x2a8529;});}function buildContactsQuery(_0x7abc5c,_0x2bf032,_0x227fe9,_0x51f87b,_0x207cc0,_0x425545){if(_0x2bf032){_0x2bf032=_0x227fe9['attributes'];}_0x7abc5c=addFieldsToQuery(_0x7abc5c,_0x2bf032,_0x51f87b,_0x425545,!![]);var _0x45ee31=squel['select']();_0x45ee31=addFieldsToQuery(_0x45ee31,_0x2bf032,_0x51f87b,_0x425545,![]);if(_0x51f87b||_0x425545){_0x7abc5c=applyJoinClauses(_0x7abc5c,!![]);_0x7abc5c['group']('c.id');if(_0x227fe9[_0x20e2('0x57')]){_0x45ee31[_0x20e2('0x57')](_0x227fe9[_0x20e2('0x57')]);}if(_0x227fe9[_0x20e2('0x58')]){_0x45ee31[_0x20e2('0x58')](_0x227fe9[_0x20e2('0x58')]);}}else{_0x45ee31=applyJoinClauses(_0x45ee31,![]);_0x45ee31['group'](_0x20e2('0x59'));if(_0x227fe9[_0x20e2('0x57')]){_0x7abc5c[_0x20e2('0x57')](_0x227fe9[_0x20e2('0x57')]);}if(_0x227fe9[_0x20e2('0x58')]){_0x7abc5c['offset'](_0x227fe9[_0x20e2('0x58')]);}}_0x45ee31[_0x20e2('0x5a')](_0x207cc0);if(_0x227fe9[_0x20e2('0x5b')]){_0x227fe9[_0x20e2('0x5b')]['forEach'](function(_0x2841e0){_0x7abc5c[_0x20e2('0x5b')]('c.'+_0x2841e0[0x0],_0x2841e0[0x1]===_0x20e2('0x5c')?![]:!![]);_0x45ee31['order'](_0x20e2('0x5d')+_0x2841e0[0x0],_0x2841e0[0x1]===_0x20e2('0x5c')?![]:!![]);});}_0x45ee31['from'](_0x7abc5c,_0x20e2('0xf'));return _0x45ee31;}function getFilteredContacts(_0x1044dd){var _0x2685b8=[];return db['Tag'][_0x20e2('0x5e')]({'attributes':['id',_0x20e2('0x35'),_0x20e2('0x5f')],'raw':!![]})[_0x20e2('0x50')](function(_0x3d2f45){_0x2685b8=_[_0x20e2('0x60')](_0x3d2f45,'id');var _0xe0e7e5={'type':db[_0x20e2('0x61')][_0x20e2('0x62')][_0x20e2('0x63')],'model':db[_0x20e2('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x20e2('0x65')][_0x20e2('0x66')](_0x1044dd['toString'](),_0xe0e7e5);})[_0x20e2('0x50')](function(_0x2e0518){_0x2e0518['forEach'](function(_0x590aea){if(_0x590aea[_0x20e2('0x21')]){_0x590aea[_0x20e2('0x67')]=[];_0x590aea[_0x20e2('0x21')][_0x20e2('0x28')](',')[_0x20e2('0x20')](function(_0x3d0cc1){_0x590aea[_0x20e2('0x67')][_0x20e2('0x1f')](_0x2685b8[_0x3d0cc1]);});}delete _0x590aea[_0x20e2('0x21')];});return _0x2e0518;});}function countFilteredContacts(_0x2c0b37,_0x1bc51b){var _0xf9ce57=_0x2c0b37[_0x20e2('0x68')]();_0xf9ce57['field'](_0x20e2('0x69'));_0xf9ce57=applyJoinClauses(_0xf9ce57,!![]);_0x2c0b37[_0x20e2('0x6a')](_0x20e2('0x6b'));var _0x546f8=utils[_0x20e2('0x25')](_0x1bc51b);if(!_[_0x20e2('0x6c')](_0x546f8)){_0xf9ce57[_0x20e2('0xd')]('t.id\x20IN\x20?',_0x546f8);}var _0x479d07={'type':db[_0x20e2('0x61')][_0x20e2('0x62')][_0x20e2('0x63')],'raw':!![]};return db[_0x20e2('0x65')][_0x20e2('0x66')](_0xf9ce57['toString'](),_0x479d07)['then'](function(_0x1f9610){return _0x1f9610[0x0]['COUNT(*)'];});}module['exports']={'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 3c149ad..b678279 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 _0xf836=['encryptFile','createReadStream','createWriteStream','createCipher','data','write','end','final','binary','decryptFile','update','close','unlink','secret','utf8','base64','decryptString','createDecipher','crypto','../../config/logger','app','secrets','session','aes-256-ctr','aes192','algorithm','encrypt','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x598ab7,_0x99be98){var _0xdc9b35=function(_0x4fd9f1){while(--_0x4fd9f1){_0x598ab7['push'](_0x598ab7['shift']());}};_0xdc9b35(++_0x99be98);}(_0xf836,0xe4));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x6f83('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x6f83('0x1'))(_0x6f83('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6f83('0x3')][_0x6f83('0x4')],'algorithm':_0x6f83('0x5')};const fileOptions={'algorithm':_0x6f83('0x6')};if(config['encrypt']&&config['encrypt'][_0x6f83('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x6f83('0x7')]);if(isSupported){fileOptions[_0x6f83('0x7')]=config[_0x6f83('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6f83('0x9')](',\x20');logger[_0x6f83('0xa')](config[_0x6f83('0x8')][_0x6f83('0x7')],_0x6f83('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x5cacfc){return AES_SUPPORTED_RX[_0x6f83('0xc')](_0x5cacfc);}function getSupportedCiphers(){return crypto[_0x6f83('0xd')]()[_0x6f83('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x50070e){return getSupportedCiphers()[_0x6f83('0xf')](_0x50070e)>-0x1;}function combineOptions(_0x42420f){var _0x3e1888={};for(var _0x22c639 in fileOptions){if(fileOptions[_0x6f83('0x10')](_0x22c639)){_0x3e1888[_0x22c639]=fileOptions[_0x22c639];}}if(_0x42420f){for(var _0x3c5f66 in _0x42420f){if(_0x42420f[_0x6f83('0x10')](_0x3c5f66)){_0x3e1888[_0x3c5f66]=_0x42420f[_0x3c5f66];}}}return _0x3e1888;}exports[_0x6f83('0x11')]=function(_0x54993d,_0x203a48,_0x1b961a,_0x48f5d5){return new BPromise(function(_0x235fbd,_0x7f3787){_0x48f5d5=combineOptions(_0x48f5d5);var _0x50d2ea=new Buffer(_0x1b961a);var _0x463c1e=fs[_0x6f83('0x12')](_0x54993d);var _0x49548c=fs[_0x6f83('0x13')](_0x203a48);var _0xd5e3df=crypto[_0x6f83('0x14')](_0x48f5d5[_0x6f83('0x7')],_0x50d2ea);_0x463c1e['on'](_0x6f83('0x15'),function(_0x2f637c){var _0x3c0b62=new Buffer(_0xd5e3df['update'](_0x2f637c),'binary');_0x49548c[_0x6f83('0x16')](_0x3c0b62);});_0x463c1e['on'](_0x6f83('0x17'),function(){try{var _0x38f6f9=new Buffer(_0xd5e3df[_0x6f83('0x18')](_0x6f83('0x19')),_0x6f83('0x19'));_0x49548c[_0x6f83('0x16')](_0x38f6f9);_0x49548c[_0x6f83('0x17')]();_0x49548c['on']('close',function(){return _0x235fbd(_0x203a48);});}catch(_0x2d29b4){fs['unlink'](_0x203a48);return _0x7f3787(_0x2d29b4);}});});};exports[_0x6f83('0x1a')]=function(_0x1ebc5f,_0xc6c7ca,_0x573b20,_0x21bde3){return new BPromise(function(_0x369904,_0x3e9a2d){_0x21bde3=combineOptions(_0x21bde3);var _0x16c5f=new Buffer(_0x573b20);var _0x4797ad=fs[_0x6f83('0x12')](_0x1ebc5f);var _0x4de763=fs[_0x6f83('0x13')](_0xc6c7ca);var _0x2846bf=crypto['createDecipher'](_0x21bde3[_0x6f83('0x7')],_0x16c5f);_0x4797ad['on'](_0x6f83('0x15'),function(_0x6adc33){var _0x5deb88=new Buffer(_0x2846bf[_0x6f83('0x1b')](_0x6adc33),_0x6f83('0x19'));_0x4de763[_0x6f83('0x16')](_0x5deb88);});_0x4797ad['on'](_0x6f83('0x17'),function(){try{var _0x3a63db=new Buffer(_0x2846bf['final']('binary'),_0x6f83('0x19'));_0x4de763[_0x6f83('0x16')](_0x3a63db);_0x4de763['end']();_0x4de763['on'](_0x6f83('0x1c'),function(){return _0x369904(_0xc6c7ca);});}catch(_0x12977d){fs[_0x6f83('0x1d')](_0xc6c7ca);return _0x3e9a2d(_0x12977d);}});});};exports['encryptString']=function(_0x5f400a,_0x527a2b,_0x22347b){var _0x2c9168=_0x22347b||stringOptions[_0x6f83('0x7')];var _0x5925b6=_0x527a2b||stringOptions[_0x6f83('0x1e')];var _0x2f942b=crypto[_0x6f83('0x14')](_0x2c9168,_0x5925b6);var _0x4e28a1=_0x2f942b[_0x6f83('0x1b')](_0x5f400a,_0x6f83('0x1f'),_0x6f83('0x20'));_0x4e28a1+=_0x2f942b['final'](_0x6f83('0x20'));return _0x4e28a1;};exports[_0x6f83('0x21')]=function(_0x541b46,_0x3abe8f,_0x183f30){var _0xa2ca7e=_0x183f30||stringOptions['algorithm'];var _0x507b5d=_0x3abe8f||stringOptions[_0x6f83('0x1e')];var _0x50d6c5=crypto[_0x6f83('0x22')](_0xa2ca7e,_0x507b5d);var _0x1504ca=_0x50d6c5[_0x6f83('0x1b')](_0x541b46,_0x6f83('0x20'),'utf8');_0x1504ca+=_0x50d6c5[_0x6f83('0x18')]('utf8');return _0x1504ca;}; \ No newline at end of file +var _0x0e7a=['decryptString','crypto','bluebird','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','write','end','close','decryptFile','createReadStream','createDecipher','final','unlink','encryptString','secret','createCipher','utf8','base64'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0e7a,0xef));var _0xa0e7=function(_0x5be431,_0x2cc74f){_0x5be431=_0x5be431-0x0;var _0x18664c=_0x0e7a[_0x5be431];return _0x18664c;};'use strict';var crypto=require(_0xa0e7('0x0'));var fs=require('fs');var BPromise=require(_0xa0e7('0x1'));var _=require('lodash');var config=require(_0xa0e7('0x2'));var logger=require('../../config/logger')(_0xa0e7('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa0e7('0x4')]['session'],'algorithm':_0xa0e7('0x5')};const fileOptions={'algorithm':_0xa0e7('0x6')};if(config[_0xa0e7('0x7')]&&config[_0xa0e7('0x7')][_0xa0e7('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xa0e7('0x8')]);if(isSupported){fileOptions[_0xa0e7('0x8')]=config[_0xa0e7('0x7')][_0xa0e7('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa0e7('0x9')](',\x20');logger['error'](config['encrypt']['algorithm'],_0xa0e7('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x19c0b7){return AES_SUPPORTED_RX[_0xa0e7('0xb')](_0x19c0b7);}function getSupportedCiphers(){return crypto[_0xa0e7('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x52dc32){return getSupportedCiphers()[_0xa0e7('0xd')](_0x52dc32)>-0x1;}function combineOptions(_0x1c0003){var _0x31f6c0={};for(var _0x5c353b in fileOptions){if(fileOptions[_0xa0e7('0xe')](_0x5c353b)){_0x31f6c0[_0x5c353b]=fileOptions[_0x5c353b];}}if(_0x1c0003){for(var _0x415648 in _0x1c0003){if(_0x1c0003[_0xa0e7('0xe')](_0x415648)){_0x31f6c0[_0x415648]=_0x1c0003[_0x415648];}}}return _0x31f6c0;}exports[_0xa0e7('0xf')]=function(_0xe0254,_0x395486,_0x40dbcc,_0x1df154){return new BPromise(function(_0x17b239,_0x2d9423){_0x1df154=combineOptions(_0x1df154);var _0x31b462=new Buffer(_0x40dbcc);var _0x4fc2f5=fs['createReadStream'](_0xe0254);var _0x143b1c=fs[_0xa0e7('0x10')](_0x395486);var _0x55a8be=crypto['createCipher'](_0x1df154[_0xa0e7('0x8')],_0x31b462);_0x4fc2f5['on'](_0xa0e7('0x11'),function(_0x40279c){var _0x1cd4a1=new Buffer(_0x55a8be[_0xa0e7('0x12')](_0x40279c),_0xa0e7('0x13'));_0x143b1c[_0xa0e7('0x14')](_0x1cd4a1);});_0x4fc2f5['on'](_0xa0e7('0x15'),function(){try{var _0x3c23ad=new Buffer(_0x55a8be['final']('binary'),_0xa0e7('0x13'));_0x143b1c[_0xa0e7('0x14')](_0x3c23ad);_0x143b1c[_0xa0e7('0x15')]();_0x143b1c['on'](_0xa0e7('0x16'),function(){return _0x17b239(_0x395486);});}catch(_0x1f6120){fs['unlink'](_0x395486);return _0x2d9423(_0x1f6120);}});});};exports[_0xa0e7('0x17')]=function(_0x4b6e58,_0x47c629,_0x5814eb,_0x1ca0c4){return new BPromise(function(_0x5a7d50,_0x400c58){_0x1ca0c4=combineOptions(_0x1ca0c4);var _0x284698=new Buffer(_0x5814eb);var _0x126734=fs[_0xa0e7('0x18')](_0x4b6e58);var _0x18240f=fs[_0xa0e7('0x10')](_0x47c629);var _0x21e70d=crypto[_0xa0e7('0x19')](_0x1ca0c4['algorithm'],_0x284698);_0x126734['on'](_0xa0e7('0x11'),function(_0x400a6d){var _0x4956d0=new Buffer(_0x21e70d['update'](_0x400a6d),_0xa0e7('0x13'));_0x18240f[_0xa0e7('0x14')](_0x4956d0);});_0x126734['on'](_0xa0e7('0x15'),function(){try{var _0x1ea156=new Buffer(_0x21e70d[_0xa0e7('0x1a')]('binary'),_0xa0e7('0x13'));_0x18240f['write'](_0x1ea156);_0x18240f['end']();_0x18240f['on'](_0xa0e7('0x16'),function(){return _0x5a7d50(_0x47c629);});}catch(_0x3de774){fs[_0xa0e7('0x1b')](_0x47c629);return _0x400c58(_0x3de774);}});});};exports[_0xa0e7('0x1c')]=function(_0x374ba6,_0x2293c1,_0x5de845){var _0x37bfa0=_0x5de845||stringOptions[_0xa0e7('0x8')];var _0x563523=_0x2293c1||stringOptions[_0xa0e7('0x1d')];var _0x40b80e=crypto[_0xa0e7('0x1e')](_0x37bfa0,_0x563523);var _0x2857be=_0x40b80e[_0xa0e7('0x12')](_0x374ba6,_0xa0e7('0x1f'),'base64');_0x2857be+=_0x40b80e['final'](_0xa0e7('0x20'));return _0x2857be;};exports[_0xa0e7('0x21')]=function(_0x1762b3,_0x3da6be,_0x53f67c){var _0x209e3a=_0x53f67c||stringOptions['algorithm'];var _0x9873e0=_0x3da6be||stringOptions[_0xa0e7('0x1d')];var _0x1fe3a9=crypto[_0xa0e7('0x19')](_0x209e3a,_0x9873e0);var _0x516ec8=_0x1fe3a9[_0xa0e7('0x12')](_0x1762b3,_0xa0e7('0x20'),_0xa0e7('0x1f'));_0x516ec8+=_0x1fe3a9['final'](_0xa0e7('0x1f'));return _0x516ec8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index fe2c3c7..c4a271e 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 _0xacea=['existsSync','join','each','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','range','num','isInteger','forEach','query','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xacea,0x1a7));var _0xaace=function(_0x16e7ec,_0x305a28){_0x16e7ec=_0x16e7ec-0x0;var _0x17c25e=_0xacea[_0x16e7ec];return _0x17c25e;};'use strict';var util=require(_0xaace('0x0'));var path=require(_0xaace('0x1'));var _=require(_0xaace('0x2'));var csv=require(_0xaace('0x3'));var fs=require('fs');var BPromise=require(_0xaace('0x4'));var zipdir=require(_0xaace('0x5'));var rimraf=require(_0xaace('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xaace('0x7')];var logger=require(_0xaace('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xaace('0x9')][0x2]);var QUERY=process[_0xaace('0x9')][0x3];var PATH=process[_0xaace('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x440535,_0x4bfcee){var _0x30973f={'status':_0x440535};var _0x555d71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4bfcee){_0x30973f[_0xaace('0xa')]=_0x4bfcee;}return db[_0xaace('0xb')]['update'](_0x30973f,_0x555d71);}function main(){var _0x8b3833=0x1388;var _0x537ad3;logger[_0xaace('0xc')](util[_0xaace('0xd')](_0xaace('0xe'),EXTRACTED_REPORT_ID,_0xaace('0xf')));return db[_0xaace('0x10')][_0xaace('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaace('0x12'),_0xaace('0x13')]})['then'](function(_0x266d96){if(_0x266d96){_0x537ad3=_0x266d96;_0x8b3833=_0x537ad3['splitSizeCsv']||0x1388;}})[_0xaace('0x14')](function(){return dbH[_0xaace('0x15')]['query'](util[_0xaace('0xd')](_0xaace('0x16'),QUERY),{'type':dbH[_0xaace('0x15')]['QueryTypes'][_0xaace('0x17')]});})[_0xaace('0x14')](function(_0x6b7291){if(!_0x6b7291[0x0]['num']){return analyticExtractedReport(_0xaace('0x18'));}var _0x2f9bd3=[];var _0x69eaba=0x0;if(_0x537ad3[_0xaace('0x12')]){if(_0x6b7291&&_0x6b7291[_0xaace('0x19')]){var _0x1f6aab=_[_0xaace('0x1a')](_0x6b7291[0x0][_0xaace('0x1b')]/_0x8b3833);var _0x5aba2d=Number[_0xaace('0x1c')](_0x6b7291[0x0][_0xaace('0x1b')]/_0x8b3833)?_0x6b7291[0x0][_0xaace('0x1b')]%_0x8b3833:0x0;_0x1f6aab[_0xaace('0x1d')](function(_0x311d22){if(_0x311d22>0x0){_0x69eaba+=_0x8b3833;}_0x2f9bd3['push'](dbH[_0xaace('0x15')][_0xaace('0x1e')](util[_0xaace('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x8b3833,_0x69eaba),{'type':dbH[_0xaace('0x15')]['QueryTypes'][_0xaace('0x17')]}));});if(_0x5aba2d>0x0){_0x69eaba+=_0x8b3833;_0x2f9bd3[_0xaace('0x1f')](dbH[_0xaace('0x15')][_0xaace('0x1e')](util[_0xaace('0xd')](_0xaace('0x20'),QUERY,_0x5aba2d,_0x69eaba),{'type':dbH[_0xaace('0x15')][_0xaace('0x21')][_0xaace('0x17')]}));}}}else{_0x2f9bd3[_0xaace('0x1f')](dbH['sequelize'][_0xaace('0x1e')](QUERY,{'type':dbH[_0xaace('0x15')]['QueryTypes'][_0xaace('0x17')]}));}var _0x5c7d53=path[_0xaace('0x22')](PATH);var _0x914375=path[_0xaace('0x23')](PATH,'.csv');var _0x264e78=_0x537ad3[_0xaace('0x12')]&&_0x2f9bd3[_0xaace('0x19')]>0x1;var _0x3a4430=[];if(!fs[_0xaace('0x24')](path['join'](_0x5c7d53,_0x914375))&&_0x264e78){fs['mkdirSync'](path[_0xaace('0x25')](_0x5c7d53,_0x914375));}return BPromise[_0xaace('0x26')](_0x2f9bd3,function(_0x4903c5){_0x3a4430[_0xaace('0x1f')](_0x4903c5);})[_0xaace('0x14')](function(){for(var _0x41d451=0x0;_0x41d451<_0x3a4430[_0xaace('0x19')];_0x41d451+=0x1){var _0x2aed7a;var _0x493408=_0x3a4430[_0x41d451];if(_0x264e78){_0x2aed7a=path[_0xaace('0x25')](_0x5c7d53,_0x914375,util[_0xaace('0xd')](_0xaace('0x27'),_0x914375,_0x41d451,'csv'));}else{_0x2aed7a=path[_0xaace('0x25')](_0x5c7d53,util['format'](_0xaace('0x28'),_0x914375,'csv'));}fs[_0xaace('0x29')](_0x2aed7a,csv(_0x493408));}})[_0xaace('0x14')](function(){if(_0x264e78){return new Promise(function(_0x47981b){zipdir(path[_0xaace('0x25')](_0x5c7d53,_0x914375),{'saveTo':path[_0xaace('0x25')](_0x5c7d53,util[_0xaace('0xd')](_0xaace('0x28'),_0x914375,_0xaace('0x2a')))},function(_0x4cf0af,_0x56e80d){rimraf(path['join'](_0x5c7d53,_0x914375),function(){});_0x47981b(_0xaace('0x2b'));});});}})[_0xaace('0x14')](function(){logger[_0xaace('0xc')](util[_0xaace('0xd')](_0xaace('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xaace('0x2d'),_0x264e78?util[_0xaace('0xd')](_0xaace('0x28'),_0x914375,_0x264e78?_0xaace('0x2a'):_0xaace('0x2e')):null);});})[_0xaace('0x2f')](function(_0x2a0e94){logger[_0xaace('0xc')](util['format'](_0xaace('0x30'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2a0e94,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xaace('0x31'));})[_0xaace('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8147=['Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','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','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT'];(function(_0x4725a4,_0x16d525){var _0x39ffb8=function(_0x42e55f){while(--_0x42e55f){_0x4725a4['push'](_0x4725a4['shift']());}};_0x39ffb8(++_0x16d525);}(_0x8147,0x198));var _0x7814=function(_0x2b8e4b,_0x3a3536){_0x2b8e4b=_0x2b8e4b-0x0;var _0x568288=_0x8147[_0x2b8e4b];return _0x568288;};'use strict';var util=require(_0x7814('0x0'));var path=require(_0x7814('0x1'));var _=require(_0x7814('0x2'));var csv=require(_0x7814('0x3'));var fs=require('fs');var BPromise=require(_0x7814('0x4'));var zipdir=require(_0x7814('0x5'));var rimraf=require(_0x7814('0x6'));var db=require(_0x7814('0x7'))['db'];var dbH=require(_0x7814('0x7'))[_0x7814('0x8')];var logger=require(_0x7814('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x368469,_0x2c6def){var _0x455e81={'status':_0x368469};var _0x348664={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c6def){_0x455e81['savename']=_0x2c6def;}return db[_0x7814('0xa')][_0x7814('0xb')](_0x455e81,_0x348664);}function main(){var _0x49c45a=0x1388;var _0x9f4c70;logger[_0x7814('0xc')](util[_0x7814('0xd')](_0x7814('0xe'),EXTRACTED_REPORT_ID,_0x7814('0xf')));return db['Setting'][_0x7814('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7814('0x11'),_0x7814('0x12')]})[_0x7814('0x13')](function(_0x16c8ec){if(_0x16c8ec){_0x9f4c70=_0x16c8ec;_0x49c45a=_0x9f4c70['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x7814('0x14')][_0x7814('0x15')](util[_0x7814('0xd')](_0x7814('0x16'),QUERY),{'type':dbH[_0x7814('0x14')]['QueryTypes'][_0x7814('0x17')]});})['then'](function(_0x36a585){if(!_0x36a585[0x0]['num']){return analyticExtractedReport(_0x7814('0x18'));}var _0x1c39fa=[];var _0x163fb1=0x0;if(_0x9f4c70[_0x7814('0x11')]){if(_0x36a585&&_0x36a585[_0x7814('0x19')]){var _0x5e60f2=_[_0x7814('0x1a')](_0x36a585[0x0][_0x7814('0x1b')]/_0x49c45a);var _0x5d2637=Number[_0x7814('0x1c')](_0x36a585[0x0][_0x7814('0x1b')]/_0x49c45a)?_0x36a585[0x0][_0x7814('0x1b')]%_0x49c45a:0x0;_0x5e60f2[_0x7814('0x1d')](function(_0x5b82b8){if(_0x5b82b8>0x0){_0x163fb1+=_0x49c45a;}_0x1c39fa[_0x7814('0x1e')](dbH['sequelize']['query'](util['format'](_0x7814('0x1f'),QUERY,_0x49c45a,_0x163fb1),{'type':dbH[_0x7814('0x14')][_0x7814('0x20')][_0x7814('0x17')]}));});if(_0x5d2637>0x0){_0x163fb1+=_0x49c45a;_0x1c39fa[_0x7814('0x1e')](dbH[_0x7814('0x14')][_0x7814('0x15')](util['format'](_0x7814('0x1f'),QUERY,_0x5d2637,_0x163fb1),{'type':dbH[_0x7814('0x14')][_0x7814('0x20')][_0x7814('0x17')]}));}}}else{_0x1c39fa[_0x7814('0x1e')](dbH['sequelize'][_0x7814('0x15')](QUERY,{'type':dbH[_0x7814('0x14')][_0x7814('0x20')][_0x7814('0x17')]}));}var _0x54169a=path[_0x7814('0x21')](PATH);var _0x59d71c=path[_0x7814('0x22')](PATH,_0x7814('0x23'));var _0x5bc720=_0x9f4c70[_0x7814('0x11')]&&_0x1c39fa['length']>0x1;var _0xc41453=[];if(!fs[_0x7814('0x24')](path['join'](_0x54169a,_0x59d71c))&&_0x5bc720){fs['mkdirSync'](path[_0x7814('0x25')](_0x54169a,_0x59d71c));}return BPromise[_0x7814('0x26')](_0x1c39fa,function(_0x5bb655){_0xc41453[_0x7814('0x1e')](_0x5bb655);})[_0x7814('0x13')](function(){for(var _0x1461b3=0x0;_0x1461b3<_0xc41453[_0x7814('0x19')];_0x1461b3+=0x1){var _0xc0d7bd;var _0x3a85e8=_0xc41453[_0x1461b3];if(_0x5bc720){_0xc0d7bd=path[_0x7814('0x25')](_0x54169a,_0x59d71c,util['format'](_0x7814('0x27'),_0x59d71c,_0x1461b3,_0x7814('0x28')));}else{_0xc0d7bd=path[_0x7814('0x25')](_0x54169a,util[_0x7814('0xd')](_0x7814('0x29'),_0x59d71c,_0x7814('0x28')));}fs['writeFileSync'](_0xc0d7bd,csv(_0x3a85e8));}})[_0x7814('0x13')](function(){if(_0x5bc720){return new Promise(function(_0x38f78e){zipdir(path[_0x7814('0x25')](_0x54169a,_0x59d71c),{'saveTo':path[_0x7814('0x25')](_0x54169a,util['format'](_0x7814('0x29'),_0x59d71c,_0x7814('0x2a')))},function(_0x25f98b,_0x1c368f){rimraf(path[_0x7814('0x25')](_0x54169a,_0x59d71c),function(){});_0x38f78e('zip\x20finished');});});}})[_0x7814('0x13')](function(){logger['info'](util[_0x7814('0xd')](_0x7814('0x2b'),EXTRACTED_REPORT_ID,_0x7814('0xf')));return analyticExtractedReport('Completed',_0x5bc720?util[_0x7814('0xd')](_0x7814('0x29'),_0x59d71c,_0x5bc720?_0x7814('0x2a'):'csv'):null);});})[_0x7814('0x2c')](function(_0x6750f1){logger['info'](util['format'](_0x7814('0x2d'),EXTRACTED_REPORT_ID,_0x7814('0xf')),util[_0x7814('0x2e')](_0x6750f1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x7814('0x2f')](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 30a4393..3a3b3e9 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 _0xb57e=['keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','before','margin','landscape','Arial','black','right','Empty','split','splitSizePdf','then','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','zip-dir','rimraf','JSDOM','bluebird','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','toString','value','fill','length','body'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xb57e,0x19e));var _0xeb57=function(_0x44f554,_0x4345d7){_0x44f554=_0x44f554-0x0;var _0x3148a9=_0xb57e[_0x44f554];return _0x3148a9;};'use strict';var _=require(_0xeb57('0x0'));var fs=require('fs');var util=require(_0xeb57('0x1'));var path=require(_0xeb57('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xeb57('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xeb57('0x4'));var rimraf=require(_0xeb57('0x5'));var JSDOM=require('jsdom')[_0xeb57('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0xeb57('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xeb57('0x8')];var logger=require(_0xeb57('0x9'))(_0xeb57('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xeb57('0xb')][0x4];var NAME=process[_0xeb57('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ddc69,_0x4dd276){var _0x5cb64c={'status':_0x1ddc69};var _0x32d732={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4dd276){_0x5cb64c[_0xeb57('0xc')]=_0x4dd276;}return db[_0xeb57('0xd')][_0xeb57('0xe')](_0x5cb64c,_0x32d732);}function getHeaders(_0x26fc74){return _['map'](_0x26fc74,function(_0x3aad03){return{'text':_0x3aad03,'style':'tableHeader'};});}function getRows(_0x3f477f,_0x2037a3){return _['map'](_0x2037a3,function(_0x288374){return _(_0x288374)['pick'](_0x3f477f)[_0xeb57('0xf')](function(_0x2135d8){return _0x2135d8?_[_0xeb57('0x10')](_0x2135d8):'';})[_0xeb57('0x11')]();});}function createTable(_0xc008c1,_0x279e17){var _0x3d8de1={'widths':_[_0xeb57('0x12')](Array(_0xc008c1[_0xeb57('0x13')]),0x91),'heights':function(_0xe8f234){return _0xe8f234===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x54d8de=getHeaders(_0xc008c1);_0x3d8de1[_0xeb57('0x14')]['push'](_0x54d8de);var _0x5bccb5=getRows(_0xc008c1,_0x279e17);_0x3d8de1[_0xeb57('0x14')]=_0x3d8de1['body']['concat'](_0x5bccb5);return _0x3d8de1;}function createTables(_0x568bdf){var _0x3fd2c4=[];var _0x3c570b=_['chunk'](Object[_0xeb57('0x15')](_0x568bdf[0x0]),0x5);_0x3c570b[_0xeb57('0x16')](function(_0x1ebd55){_0x3fd2c4[_0xeb57('0x17')](createTable(_0x1ebd55,_0x568bdf));});return _0x3fd2c4;}function getPDFDocDefinition(_0x8259f9){var _0x407775=util['format'](_0xeb57('0x18'),NAME,EXTRACTED_REPORT[_0xeb57('0x19')],moment(EXTRACTED_REPORT[_0xeb57('0x1a')])[_0xeb57('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xeb57('0x1b')](FORMAT));var _0x7504d0=[];for(var _0x54ec4d=0x0;_0x54ec4d<_0x8259f9[_0xeb57('0x13')];_0x54ec4d++){var _0xcf4f25=[];if(_0x54ec4d===0x0){_0xcf4f25['push']({'text':_0x407775,'style':_0xeb57('0x1c')});}var _0x42acc5={'table':_0x8259f9[_0x54ec4d]};if(_0x54ec4d>0x0){_0x42acc5[_0xeb57('0x1d')]=_0xeb57('0x1e');_0x42acc5[_0xeb57('0x1f')]=[0x0,0x46,0x0,0x0];}_0xcf4f25[_0xeb57('0x17')](_0x42acc5);_0x7504d0[_0xeb57('0x17')](_0xcf4f25);}return{'pageSize':'A4','pageOrientation':_0xeb57('0x20'),'content':_0x7504d0,'footer':function(_0x29ed22,_0x11e4af){return{'text':_0x29ed22[_0xeb57('0x10')]()+'\x20/\x20'+_0x11e4af,'style':'footer'};},'defaultStyle':{'font':_0xeb57('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xeb57('0x22')},'footer':{'alignment':_0xeb57('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xd6be48){var _0x57c947=0x1388;var _0x16850d;if(!_0xd6be48[0x0]['num']){return analyticExtractedReport(_0xeb57('0x24'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeb57('0x25'),_0xeb57('0x26')]})[_0xeb57('0x27')](function(_0x37eb37){if(_0x37eb37){_0x16850d=_0x37eb37;_0x57c947=_0x16850d[_0xeb57('0x26')]||0x3e8;}})[_0xeb57('0x27')](function(){var _0x290d6f=[];var _0x5bc9e1=0x0;if(_0x16850d[_0xeb57('0x25')]){if(_0xd6be48&&_0xd6be48[_0xeb57('0x13')]){var _0x5eb314=_[_0xeb57('0x28')](_0xd6be48[0x0][_0xeb57('0x29')]/_0x57c947);var _0x2816d1=Number[_0xeb57('0x2a')](_0xd6be48[0x0][_0xeb57('0x29')]/_0x57c947)?_0xd6be48[0x0][_0xeb57('0x29')]%_0x57c947:0x0;_0x5eb314[_0xeb57('0x16')](function(_0x4e7359){if(_0x4e7359>0x0){_0x5bc9e1+=_0x57c947;}_0x290d6f[_0xeb57('0x17')](dbH[_0xeb57('0x2b')][_0xeb57('0x2c')](util[_0xeb57('0x1b')](_0xeb57('0x2d'),QUERY,_0x57c947,_0x5bc9e1),{'type':dbH[_0xeb57('0x2b')][_0xeb57('0x2e')][_0xeb57('0x2f')]}));});if(_0x2816d1>0x0){_0x5bc9e1+=_0x57c947;_0x290d6f['push'](dbH['sequelize'][_0xeb57('0x2c')](util[_0xeb57('0x1b')](_0xeb57('0x2d'),QUERY,_0x2816d1,_0x5bc9e1),{'type':dbH[_0xeb57('0x2b')][_0xeb57('0x2e')][_0xeb57('0x2f')]}));}}}else{_0x290d6f[_0xeb57('0x17')](dbH[_0xeb57('0x2b')][_0xeb57('0x2c')](QUERY,{'type':dbH[_0xeb57('0x2b')]['QueryTypes'][_0xeb57('0x2f')]}));}var _0x25cc54=path[_0xeb57('0x30')](PATH);var _0x3bdfce=path[_0xeb57('0x31')](PATH,_0xeb57('0x32'));var _0x28a339=_0x16850d[_0xeb57('0x25')]&&_0x290d6f[_0xeb57('0x13')]>0x1;var _0x30da9b=[];if(!fs['existsSync'](path[_0xeb57('0x33')](_0x25cc54,_0x3bdfce))&&_0x28a339){fs['mkdirSync'](path[_0xeb57('0x33')](_0x25cc54,_0x3bdfce));}return BPromise[_0xeb57('0x34')](_0x290d6f,function(_0x4bfa73){_0x30da9b['push'](_0x4bfa73);})[_0xeb57('0x27')](function(){var _0x399f93=[];for(var _0x1f6ed8=0x0;_0x1f6ed8<_0x30da9b[_0xeb57('0x13')];_0x1f6ed8+=0x1){var _0x16a7a5=_0x30da9b[_0x1f6ed8];var _0x3ea97e=createTables(_[_0xeb57('0x35')](_0x16a7a5));var _0x3be812;var _0x3d8305=getPDFDocDefinition(_0x3ea97e);var _0x232aea=getPDFPrinter();var _0x871fb2=_0x232aea[_0xeb57('0x36')](_0x3d8305);if(_0x28a339){_0x3be812=path[_0xeb57('0x33')](_0x25cc54,_0x3bdfce,util[_0xeb57('0x1b')](_0xeb57('0x37'),_0x3bdfce,_0x1f6ed8,_0xeb57('0x38')));}else{_0x3be812=path['join'](_0x25cc54,util[_0xeb57('0x1b')]('%s.%s',_0x3bdfce,_0xeb57('0x38')));}_0x399f93[_0xeb57('0x17')](writePDFDocument(_0x871fb2,_0x3be812));}return Promise[_0xeb57('0x39')](_0x399f93);})[_0xeb57('0x27')](function(){if(_0x28a339){return new Promise(function(_0x4d8997){zipdir(path['join'](_0x25cc54,_0x3bdfce),{'saveTo':path[_0xeb57('0x33')](_0x25cc54,util[_0xeb57('0x1b')](_0xeb57('0x3a'),_0x3bdfce,_0xeb57('0x3b')))},function(){rimraf(path['join'](_0x25cc54,_0x3bdfce),function(){});_0x4d8997(_0xeb57('0x3c'));});});}})[_0xeb57('0x27')](function(){if(!_0x28a339)return;rimraf(path['join'](_0x25cc54,_0x3bdfce),function(){});})[_0xeb57('0x27')](function(){logger[_0xeb57('0x3d')](util[_0xeb57('0x1b')](_0xeb57('0x3e'),EXTRACTED_REPORT_ID,_0xeb57('0x3f')));return analyticExtractedReport(_0xeb57('0x40'),_0x28a339?util[_0xeb57('0x1b')]('%s.%s',_0x3bdfce,_0x28a339?_0xeb57('0x3b'):_0xeb57('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xeb57('0x3d')](util['format'](_0xeb57('0x41'),EXTRACTED_REPORT_ID,_0xeb57('0x3f')));return db['AnalyticExtractedReport'][_0xeb57('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xeb57('0x27')](function(_0x1f2f08){EXTRACTED_REPORT=_0x1f2f08;return dbH[_0xeb57('0x2b')][_0xeb57('0x2c')](util[_0xeb57('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xeb57('0x2b')]['QueryTypes'][_0xeb57('0x2f')]});})[_0xeb57('0x27')](extractReport)[_0xeb57('0x43')](function(_0x111afc){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeb57('0x3f')),util[_0xeb57('0x44')](_0x111afc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xeb57('0x45')](function(){process[_0xeb57('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5678c3=new PdfPrinter({'Arial':{'normal':__dirname+_0xeb57('0x47'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xeb57('0x48'),'bolditalics':__dirname+_0xeb57('0x49')}});return _0x5678c3;}function getPDFDocDefinitionFromHTML(_0x23f6dd,_0x57e400){var _0x20f909=util[_0xeb57('0x1b')](_0xeb57('0x4a'),_0x57e400[_0xeb57('0x4b')],_0x57e400[_0xeb57('0x4c')]);var _0x49373c=moment()[_0xeb57('0x1b')](_0xeb57('0x4d'))['toString']();var _0x4108ba=htmlToPdfmake(_0x23f6dd,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4108ba],'defaultStyle':{'font':_0xeb57('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xeb57('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xeb57('0x4f'),'style':'header'}];},'footer':function(_0x4e3c1d,_0x3debba){return[{'text':util['format'](_0xeb57('0x50'),_0x20f909,_0x4e3c1d,_0x3debba,_0x49373c),'style':_0xeb57('0x51')}];}};}function writePDFDocument(_0x22e93c,_0x444509){return new Promise(function(_0x18602a,_0x36f137){var _0xfb0fab=_0x22e93c[_0xeb57('0x52')](fs[_0xeb57('0x53')](_0x444509));_0xfb0fab['on'](_0xeb57('0x54'),function(){_0x18602a('finish');});_0xfb0fab['on']('error',function(_0x20bd43){_0x36f137(_0x20bd43);});_0x22e93c[_0xeb57('0x55')]();});}exports[_0xeb57('0x56')]=function(_0x598e76,_0x3231fa){var _0x33299d=getPDFPrinter();var _0x2966c2=getPDFDocDefinitionFromHTML(_0x598e76,_0x3231fa);var _0xf5c52e=_0x33299d[_0xeb57('0x36')](_0x2966c2);return writePDFDocument(_0xf5c52e,_0x3231fa[_0xeb57('0x2')])[_0xeb57('0x43')](function(_0x42eb81){throw _0x42eb81;});}; \ No newline at end of file +var _0x2d3a=['Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','push','body','chunk','keys'];(function(_0x588c36,_0x1146b2){var _0x511c30=function(_0x17c531){while(--_0x17c531){_0x588c36['push'](_0x588c36['shift']());}};_0x511c30(++_0x1146b2);}(_0x2d3a,0x100));var _0xa2d3=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x2d3a[_0x29e0eb];return _0x597d2d;};'use strict';var _=require(_0xa2d3('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xa2d3('0x1'));var moment=require(_0xa2d3('0x2'));var htmlToPdfmake=require(_0xa2d3('0x3'));var PdfPrinter=require(_0xa2d3('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xa2d3('0x5'));var JSDOM=require(_0xa2d3('0x6'))[_0xa2d3('0x7')];var window=new JSDOM('')[_0xa2d3('0x8')];var BPromise=require(_0xa2d3('0x9'));var db=require(_0xa2d3('0xa'))['db'];var dbH=require(_0xa2d3('0xa'))[_0xa2d3('0xb')];var logger=require(_0xa2d3('0xc'))(_0xa2d3('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa2d3('0xe')][0x2]);var QUERY=process[_0xa2d3('0xe')][0x3];var PATH=process[_0xa2d3('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xa2d3('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e4d67,_0x40c511){var _0x173adb={'status':_0x3e4d67};var _0x591e6c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x40c511){_0x173adb[_0xa2d3('0x10')]=_0x40c511;}return db[_0xa2d3('0x11')][_0xa2d3('0x12')](_0x173adb,_0x591e6c);}function getHeaders(_0x15e2ef){return _[_0xa2d3('0x13')](_0x15e2ef,function(_0x250038){return{'text':_0x250038,'style':_0xa2d3('0x14')};});}function getRows(_0x4e519a,_0x2ea16d){return _[_0xa2d3('0x13')](_0x2ea16d,function(_0x5d9e3a){return _(_0x5d9e3a)['pick'](_0x4e519a)[_0xa2d3('0x13')](function(_0x5db37d){return _0x5db37d?_[_0xa2d3('0x15')](_0x5db37d):'';})[_0xa2d3('0x16')]();});}function createTable(_0x17bcca,_0x22a076){var _0x250282={'widths':_[_0xa2d3('0x17')](Array(_0x17bcca[_0xa2d3('0x18')]),0x91),'heights':function(_0x5c257f){return _0x5c257f===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1e498c=getHeaders(_0x17bcca);_0x250282['body'][_0xa2d3('0x19')](_0x1e498c);var _0x2c792f=getRows(_0x17bcca,_0x22a076);_0x250282[_0xa2d3('0x1a')]=_0x250282[_0xa2d3('0x1a')]['concat'](_0x2c792f);return _0x250282;}function createTables(_0x3849f0){var _0x19dbbc=[];var _0x38f844=_[_0xa2d3('0x1b')](Object[_0xa2d3('0x1c')](_0x3849f0[0x0]),0x5);_0x38f844['forEach'](function(_0x11a108){_0x19dbbc['push'](createTable(_0x11a108,_0x3849f0));});return _0x19dbbc;}function getPDFDocDefinition(_0x4d9406){var _0x52bc77=util['format'](_0xa2d3('0x1d'),NAME,EXTRACTED_REPORT[_0xa2d3('0x1e')],moment(EXTRACTED_REPORT[_0xa2d3('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x597528=[];for(var _0x41b051=0x0;_0x41b051<_0x4d9406[_0xa2d3('0x18')];_0x41b051++){var _0x3614b0=[];if(_0x41b051===0x0){_0x3614b0[_0xa2d3('0x19')]({'text':_0x52bc77,'style':_0xa2d3('0x20')});}var _0xa1f6c5={'table':_0x4d9406[_0x41b051]};if(_0x41b051>0x0){_0xa1f6c5[_0xa2d3('0x21')]=_0xa2d3('0x22');_0xa1f6c5[_0xa2d3('0x23')]=[0x0,0x46,0x0,0x0];}_0x3614b0[_0xa2d3('0x19')](_0xa1f6c5);_0x597528['push'](_0x3614b0);}return{'pageSize':'A4','pageOrientation':_0xa2d3('0x24'),'content':_0x597528,'footer':function(_0x35e136,_0x588622){return{'text':_0x35e136['toString']()+_0xa2d3('0x25')+_0x588622,'style':_0xa2d3('0x26')};},'defaultStyle':{'font':_0xa2d3('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa2d3('0x28')},'footer':{'alignment':_0xa2d3('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x240474){var _0x547672=0x1388;var _0x167c66;if(!_0x240474[0x0][_0xa2d3('0x2a')]){return analyticExtractedReport(_0xa2d3('0x2b'));}return db[_0xa2d3('0x2c')][_0xa2d3('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa2d3('0x2e')]})['then'](function(_0x62923){if(_0x62923){_0x167c66=_0x62923;_0x547672=_0x167c66[_0xa2d3('0x2e')]||0x3e8;}})[_0xa2d3('0x2f')](function(){var _0x3f751f=[];var _0x46175c=0x0;if(_0x167c66[_0xa2d3('0x30')]){if(_0x240474&&_0x240474['length']){var _0x3c0e1d=_[_0xa2d3('0x31')](_0x240474[0x0][_0xa2d3('0x2a')]/_0x547672);var _0x47b3a0=Number[_0xa2d3('0x32')](_0x240474[0x0]['num']/_0x547672)?_0x240474[0x0][_0xa2d3('0x2a')]%_0x547672:0x0;_0x3c0e1d['forEach'](function(_0xffa350){if(_0xffa350>0x0){_0x46175c+=_0x547672;}_0x3f751f['push'](dbH[_0xa2d3('0x33')][_0xa2d3('0x34')](util[_0xa2d3('0x35')](_0xa2d3('0x36'),QUERY,_0x547672,_0x46175c),{'type':dbH[_0xa2d3('0x33')]['QueryTypes'][_0xa2d3('0x37')]}));});if(_0x47b3a0>0x0){_0x46175c+=_0x547672;_0x3f751f['push'](dbH[_0xa2d3('0x33')]['query'](util[_0xa2d3('0x35')](_0xa2d3('0x36'),QUERY,_0x47b3a0,_0x46175c),{'type':dbH['sequelize'][_0xa2d3('0x38')]['SELECT']}));}}}else{_0x3f751f[_0xa2d3('0x19')](dbH[_0xa2d3('0x33')][_0xa2d3('0x34')](QUERY,{'type':dbH[_0xa2d3('0x33')][_0xa2d3('0x38')][_0xa2d3('0x37')]}));}var _0x110ed1=path[_0xa2d3('0x39')](PATH);var _0x1f7692=path[_0xa2d3('0x3a')](PATH,_0xa2d3('0x3b'));var _0x1745ce=_0x167c66['split']&&_0x3f751f[_0xa2d3('0x18')]>0x1;var _0x9ad24a=[];if(!fs[_0xa2d3('0x3c')](path[_0xa2d3('0x3d')](_0x110ed1,_0x1f7692))&&_0x1745ce){fs[_0xa2d3('0x3e')](path[_0xa2d3('0x3d')](_0x110ed1,_0x1f7692));}return BPromise[_0xa2d3('0x3f')](_0x3f751f,function(_0x5b9c9e){_0x9ad24a['push'](_0x5b9c9e);})[_0xa2d3('0x2f')](function(){var _0x3e0472=[];for(var _0x6d9d05=0x0;_0x6d9d05<_0x9ad24a['length'];_0x6d9d05+=0x1){var _0x27caba=_0x9ad24a[_0x6d9d05];var _0x41ff5c=createTables(_['flatten'](_0x27caba));var _0x5054a3;var _0x2d2ac0=getPDFDocDefinition(_0x41ff5c);var _0x3e3a70=getPDFPrinter();var _0x5a1321=_0x3e3a70[_0xa2d3('0x40')](_0x2d2ac0);if(_0x1745ce){_0x5054a3=path[_0xa2d3('0x3d')](_0x110ed1,_0x1f7692,util[_0xa2d3('0x35')]('%s%d.%s',_0x1f7692,_0x6d9d05,_0xa2d3('0x41')));}else{_0x5054a3=path[_0xa2d3('0x3d')](_0x110ed1,util[_0xa2d3('0x35')](_0xa2d3('0x42'),_0x1f7692,_0xa2d3('0x41')));}_0x3e0472[_0xa2d3('0x19')](writePDFDocument(_0x5a1321,_0x5054a3));}return Promise[_0xa2d3('0x43')](_0x3e0472);})[_0xa2d3('0x2f')](function(){if(_0x1745ce){return new Promise(function(_0x2bda47){zipdir(path[_0xa2d3('0x3d')](_0x110ed1,_0x1f7692),{'saveTo':path['join'](_0x110ed1,util[_0xa2d3('0x35')]('%s.%s',_0x1f7692,_0xa2d3('0x44')))},function(){rimraf(path[_0xa2d3('0x3d')](_0x110ed1,_0x1f7692),function(){});_0x2bda47(_0xa2d3('0x45'));});});}})[_0xa2d3('0x2f')](function(){if(!_0x1745ce)return;rimraf(path['join'](_0x110ed1,_0x1f7692),function(){});})[_0xa2d3('0x2f')](function(){logger[_0xa2d3('0x46')](util[_0xa2d3('0x35')](_0xa2d3('0x47'),EXTRACTED_REPORT_ID,_0xa2d3('0x48')));return analyticExtractedReport('Completed',_0x1745ce?util[_0xa2d3('0x35')](_0xa2d3('0x42'),_0x1f7692,_0x1745ce?_0xa2d3('0x44'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa2d3('0x46')](util[_0xa2d3('0x35')](_0xa2d3('0x49'),EXTRACTED_REPORT_ID,_0xa2d3('0x48')));return db[_0xa2d3('0x11')][_0xa2d3('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5ab251){EXTRACTED_REPORT=_0x5ab251;return dbH[_0xa2d3('0x33')][_0xa2d3('0x34')](util[_0xa2d3('0x35')](_0xa2d3('0x4b'),QUERY),{'type':dbH[_0xa2d3('0x33')][_0xa2d3('0x38')]['SELECT']});})[_0xa2d3('0x2f')](extractReport)[_0xa2d3('0x4c')](function(_0x2d8f35){logger[_0xa2d3('0x46')](util[_0xa2d3('0x35')](_0xa2d3('0x4d'),EXTRACTED_REPORT_ID,_0xa2d3('0x48')),util[_0xa2d3('0x4e')](_0x2d8f35,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa2d3('0x4f'));})[_0xa2d3('0x50')](function(){process[_0xa2d3('0x51')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x142137=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xa2d3('0x52'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xa2d3('0x53')}});return _0x142137;}function getPDFDocDefinitionFromHTML(_0x2f4352,_0x1bd47e){var _0x4f2605=util[_0xa2d3('0x35')]('%s\x20#%d',_0x1bd47e[_0xa2d3('0x54')],_0x1bd47e[_0xa2d3('0x55')]);var _0x593ca8=moment()['format'](_0xa2d3('0x56'))['toString']();var _0x10f94c=htmlToPdfmake(_0x2f4352,{'window':window,'tableAutoSize':!![]});return{'content':[_0x10f94c],'defaultStyle':{'font':_0xa2d3('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa2d3('0x57'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa2d3('0x57'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa2d3('0x57')}},'header':function(){return[{'text':_0xa2d3('0x58'),'style':'header'}];},'footer':function(_0x223c63,_0xc16e11){return[{'text':util['format'](_0xa2d3('0x59'),_0x4f2605,_0x223c63,_0xc16e11,_0x593ca8),'style':_0xa2d3('0x26')}];}};}function writePDFDocument(_0x3c24f2,_0x7b8365){return new Promise(function(_0x490404,_0x431170){var _0x53847b=_0x3c24f2[_0xa2d3('0x5a')](fs[_0xa2d3('0x5b')](_0x7b8365));_0x53847b['on'](_0xa2d3('0x5c'),function(){_0x490404(_0xa2d3('0x5c'));});_0x53847b['on'](_0xa2d3('0x5d'),function(_0x55d32e){_0x431170(_0x55d32e);});_0x3c24f2['end']();});}exports[_0xa2d3('0x5e')]=function(_0x327a0f,_0x3a12e5){var _0x504592=getPDFPrinter();var _0x4f098f=getPDFDocDefinitionFromHTML(_0x327a0f,_0x3a12e5);var _0x52d364=_0x504592['createPdfKitDocument'](_0x4f098f);return writePDFDocument(_0x52d364,_0x3a12e5[_0xa2d3('0x1')])[_0xa2d3('0x4c')](function(_0x4ecef3){throw _0x4ecef3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 61f9b98..c300766 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 _0x235d=['split','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','num','length','isInteger','forEach','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename'];(function(_0x12404d,_0x1f3b85){var _0xc78ffe=function(_0x3117fe){while(--_0x3117fe){_0x12404d['push'](_0x12404d['shift']());}};_0xc78ffe(++_0x1f3b85);}(_0x235d,0x9d));var _0xd235=function(_0x565fca,_0x5eb049){_0x565fca=_0x565fca-0x0;var _0x53d20d=_0x235d[_0x565fca];return _0x53d20d;};'use strict';var util=require(_0xd235('0x0'));var path=require('path');var _=require(_0xd235('0x1'));var fs=require('fs');var json2xls=require(_0xd235('0x2'));var BPromise=require(_0xd235('0x3'));var zipdir=require(_0xd235('0x4'));var rimraf=require('rimraf');var db=require(_0xd235('0x5'))['db'];var dbH=require(_0xd235('0x5'))[_0xd235('0x6')];var logger=require('../../config/logger')(_0xd235('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xd235('0x8')][0x2]);var QUERY=process[_0xd235('0x8')][0x3];var PATH=process[_0xd235('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4a56e1,_0x13a67f){var _0x279142={'status':_0x4a56e1};var _0x1af298={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x13a67f){_0x279142[_0xd235('0x9')]=_0x13a67f;}return db[_0xd235('0xa')]['update'](_0x279142,_0x1af298);}function main(){var _0x18114b=0x1388;var _0x16bce8;logger[_0xd235('0xb')](util[_0xd235('0xc')](_0xd235('0xd'),EXTRACTED_REPORT_ID,_0xd235('0xe')));return db[_0xd235('0xf')][_0xd235('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd235('0x11')]})[_0xd235('0x12')](function(_0x5c6abc){if(_0x5c6abc){_0x16bce8=_0x5c6abc;_0x18114b=_0x16bce8['splitSizeXlsx']||0x1388;}})[_0xd235('0x12')](function(){return dbH[_0xd235('0x13')][_0xd235('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd235('0x13')]['QueryTypes']['SELECT']});})[_0xd235('0x12')](function(_0x27930a){if(!_0x27930a[0x0][_0xd235('0x15')]){return analyticExtractedReport('Empty');}var _0xaf33df=[];var _0x22e481=0x0;if(_0x16bce8['split']){if(_0x27930a&&_0x27930a[_0xd235('0x16')]){var _0xe570de=_['range'](_0x27930a[0x0][_0xd235('0x15')]/_0x18114b);var _0x1a45a7=Number[_0xd235('0x17')](_0x27930a[0x0][_0xd235('0x15')]/_0x18114b)?_0x27930a[0x0][_0xd235('0x15')]%_0x18114b:0x0;_0xe570de[_0xd235('0x18')](function(_0x481926){if(_0x481926>0x0){_0x22e481+=_0x18114b;}_0xaf33df['push'](dbH[_0xd235('0x13')][_0xd235('0x14')](util[_0xd235('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x18114b,_0x22e481),{'type':dbH[_0xd235('0x13')][_0xd235('0x19')]['SELECT']}));});if(_0x1a45a7>0x0){_0x22e481+=_0x18114b;_0xaf33df[_0xd235('0x1a')](dbH[_0xd235('0x13')]['query'](util[_0xd235('0xc')](_0xd235('0x1b'),QUERY,_0x1a45a7,_0x22e481),{'type':dbH['sequelize'][_0xd235('0x19')]['SELECT']}));}}}else{_0xaf33df['push'](dbH[_0xd235('0x13')][_0xd235('0x14')](QUERY,{'type':dbH[_0xd235('0x13')][_0xd235('0x19')][_0xd235('0x1c')]}));}var _0x4f37b3=path[_0xd235('0x1d')](PATH);var _0x3578f6=path[_0xd235('0x1e')](PATH,'.xlsx');var _0x3baebd=_0x16bce8[_0xd235('0x1f')]&&_0xaf33df[_0xd235('0x16')]>0x1;var _0x5a3193=[];if(!fs[_0xd235('0x20')](path[_0xd235('0x21')](_0x4f37b3,_0x3578f6))&&_0x3baebd){fs[_0xd235('0x22')](path[_0xd235('0x21')](_0x4f37b3,_0x3578f6));}return BPromise[_0xd235('0x23')](_0xaf33df,function(_0x1e2a77){_0x5a3193[_0xd235('0x1a')](_0x1e2a77);})[_0xd235('0x12')](function(){for(var _0x41f24a=0x0;_0x41f24a<_0x5a3193[_0xd235('0x16')];_0x41f24a+=0x1){var _0x50c336;var _0x31754a=_0x5a3193[_0x41f24a];if(_0x3baebd){_0x50c336=path[_0xd235('0x21')](_0x4f37b3,_0x3578f6,util['format'](_0xd235('0x24'),_0x3578f6,_0x41f24a,_0xd235('0x25')));}else{_0x50c336=path[_0xd235('0x21')](_0x4f37b3,util[_0xd235('0xc')](_0xd235('0x26'),_0x3578f6,_0xd235('0x25')));}fs['writeFileSync'](_0x50c336,json2xls(_0x31754a),_0xd235('0x27'));}})[_0xd235('0x12')](function(){if(_0x3baebd){return new Promise(function(_0x3647fd){zipdir(path['join'](_0x4f37b3,_0x3578f6),{'saveTo':path[_0xd235('0x21')](_0x4f37b3,util[_0xd235('0xc')]('%s.%s',_0x3578f6,_0xd235('0x28')))},function(_0x2b82e8,_0xa13851){rimraf(path['join'](_0x4f37b3,_0x3578f6),function(){});_0x3647fd(_0xd235('0x29'));});});}})[_0xd235('0x12')](function(){logger['info'](util['format'](_0xd235('0x2a'),EXTRACTED_REPORT_ID,_0xd235('0xe')));return analyticExtractedReport(_0xd235('0x2b'),_0x3baebd?util['format'](_0xd235('0x26'),_0x3578f6,_0x3baebd?_0xd235('0x28'):_0xd235('0x25')):null);});})[_0xd235('0x2c')](function(_0xefc0e3){logger['info'](util['format'](_0xd235('0x2d'),EXTRACTED_REPORT_ID,_0xd235('0xe')),util['inspect'](_0xefc0e3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd235('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdcde=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','json2xls','bluebird','zip-dir','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x4fad39,_0x57960b){var _0x466e9a=function(_0x3cdce1){while(--_0x3cdce1){_0x4fad39['push'](_0x4fad39['shift']());}};_0x466e9a(++_0x57960b);}(_0xdcde,0x1d0));var _0xedcd=function(_0x5ed73b,_0x314c57){_0x5ed73b=_0x5ed73b-0x0;var _0x667d43=_0xdcde[_0x5ed73b];return _0x667d43;};'use strict';var util=require(_0xedcd('0x0'));var path=require(_0xedcd('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xedcd('0x2'));var BPromise=require(_0xedcd('0x3'));var zipdir=require(_0xedcd('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xedcd('0x5')];var logger=require(_0xedcd('0x6'))(_0xedcd('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xedcd('0x8')][0x3];var PATH=process[_0xedcd('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x106aaa,_0x2d0c81){var _0x50a7df={'status':_0x106aaa};var _0x24e96a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d0c81){_0x50a7df[_0xedcd('0x9')]=_0x2d0c81;}return db[_0xedcd('0xa')][_0xedcd('0xb')](_0x50a7df,_0x24e96a);}function main(){var _0x94fdc8=0x1388;var _0x3712ad;logger[_0xedcd('0xc')](util[_0xedcd('0xd')](_0xedcd('0xe'),EXTRACTED_REPORT_ID,_0xedcd('0xf')));return db[_0xedcd('0x10')][_0xedcd('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xedcd('0x12'),_0xedcd('0x13')]})[_0xedcd('0x14')](function(_0x7f32be){if(_0x7f32be){_0x3712ad=_0x7f32be;_0x94fdc8=_0x3712ad['splitSizeXlsx']||0x1388;}})[_0xedcd('0x14')](function(){return dbH[_0xedcd('0x15')]['query'](util[_0xedcd('0xd')](_0xedcd('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xedcd('0x17')]});})['then'](function(_0x546af9){if(!_0x546af9[0x0][_0xedcd('0x18')]){return analyticExtractedReport(_0xedcd('0x19'));}var _0x48a5f7=[];var _0x543628=0x0;if(_0x3712ad[_0xedcd('0x12')]){if(_0x546af9&&_0x546af9[_0xedcd('0x1a')]){var _0x503bd3=_[_0xedcd('0x1b')](_0x546af9[0x0][_0xedcd('0x18')]/_0x94fdc8);var _0x2e0095=Number[_0xedcd('0x1c')](_0x546af9[0x0]['num']/_0x94fdc8)?_0x546af9[0x0]['num']%_0x94fdc8:0x0;_0x503bd3[_0xedcd('0x1d')](function(_0x23d850){if(_0x23d850>0x0){_0x543628+=_0x94fdc8;}_0x48a5f7[_0xedcd('0x1e')](dbH[_0xedcd('0x15')]['query'](util[_0xedcd('0xd')](_0xedcd('0x1f'),QUERY,_0x94fdc8,_0x543628),{'type':dbH[_0xedcd('0x15')]['QueryTypes'][_0xedcd('0x17')]}));});if(_0x2e0095>0x0){_0x543628+=_0x94fdc8;_0x48a5f7['push'](dbH[_0xedcd('0x15')][_0xedcd('0x20')](util[_0xedcd('0xd')](_0xedcd('0x1f'),QUERY,_0x2e0095,_0x543628),{'type':dbH[_0xedcd('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x48a5f7[_0xedcd('0x1e')](dbH[_0xedcd('0x15')][_0xedcd('0x20')](QUERY,{'type':dbH['sequelize'][_0xedcd('0x21')]['SELECT']}));}var _0x3e5b1d=path[_0xedcd('0x22')](PATH);var _0xa7558e=path[_0xedcd('0x23')](PATH,_0xedcd('0x24'));var _0x574660=_0x3712ad[_0xedcd('0x12')]&&_0x48a5f7['length']>0x1;var _0x246c41=[];if(!fs[_0xedcd('0x25')](path[_0xedcd('0x26')](_0x3e5b1d,_0xa7558e))&&_0x574660){fs[_0xedcd('0x27')](path[_0xedcd('0x26')](_0x3e5b1d,_0xa7558e));}return BPromise[_0xedcd('0x28')](_0x48a5f7,function(_0x3e6aab){_0x246c41[_0xedcd('0x1e')](_0x3e6aab);})[_0xedcd('0x14')](function(){for(var _0x359e1b=0x0;_0x359e1b<_0x246c41[_0xedcd('0x1a')];_0x359e1b+=0x1){var _0x561b14;var _0xd1ec62=_0x246c41[_0x359e1b];if(_0x574660){_0x561b14=path[_0xedcd('0x26')](_0x3e5b1d,_0xa7558e,util[_0xedcd('0xd')]('%s%d.%s',_0xa7558e,_0x359e1b,_0xedcd('0x29')));}else{_0x561b14=path[_0xedcd('0x26')](_0x3e5b1d,util[_0xedcd('0xd')]('%s.%s',_0xa7558e,_0xedcd('0x29')));}fs['writeFileSync'](_0x561b14,json2xls(_0xd1ec62),_0xedcd('0x2a'));}})[_0xedcd('0x14')](function(){if(_0x574660){return new Promise(function(_0x7f79cd){zipdir(path[_0xedcd('0x26')](_0x3e5b1d,_0xa7558e),{'saveTo':path[_0xedcd('0x26')](_0x3e5b1d,util[_0xedcd('0xd')]('%s.%s',_0xa7558e,_0xedcd('0x2b')))},function(_0x17c802,_0x410361){rimraf(path[_0xedcd('0x26')](_0x3e5b1d,_0xa7558e),function(){});_0x7f79cd(_0xedcd('0x2c'));});});}})['then'](function(){logger['info'](util[_0xedcd('0xd')](_0xedcd('0x2d'),EXTRACTED_REPORT_ID,_0xedcd('0xf')));return analyticExtractedReport(_0xedcd('0x2e'),_0x574660?util[_0xedcd('0xd')](_0xedcd('0x2f'),_0xa7558e,_0x574660?_0xedcd('0x2b'):'xlsx'):null);});})[_0xedcd('0x30')](function(_0x147f31){logger['info'](util[_0xedcd('0xd')](_0xedcd('0x31'),EXTRACTED_REPORT_ID,_0xedcd('0xf')),util[_0xedcd('0x32')](_0x147f31,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xedcd('0x33'));})[_0xedcd('0x34')](function(){process[_0xedcd('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 80ee515..c7d3bb7 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 _0xfe27=['transaction','VoiceExtension','bulkCreate','sortBy','catch','rewrite','models','then','intervals','findAll','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup'];(function(_0x38e47a,_0xc032eb){var _0x1b0649=function(_0x392ba2){while(--_0x392ba2){_0x38e47a['push'](_0x38e47a['shift']());}};_0x1b0649(++_0xc032eb);}(_0xfe27,0x8c));var _0x7fe2=function(_0x1f9ceb,_0x352b4e){_0x1f9ceb=_0x1f9ceb-0x0;var _0x537603=_0xfe27[_0x1f9ceb];return _0x537603;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3aa50d,_0x9acbf8){var _0x380907=this;return _0x3aa50d[_0x7fe2('0x0')]['Interval']['findAll']({'raw':!![]})[_0x7fe2('0x1')](function(_0x35473f){_0x380907[_0x7fe2('0x2')]=_0x35473f;return _0x3aa50d[_0x7fe2('0x0')]['VoiceExtension'][_0x7fe2('0x3')]({'where':{'IntervalId':_0x9acbf8['IntervalId']},'raw':!![]});})[_0x7fe2('0x1')](function(_0x5c361a){return _0x3aa50d['models']['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x7fe2('0x4')](_['map'](_0x5c361a,'exten'))}},'order':[{'raw':_0x7fe2('0x5')}],'raw':!![]});})[_0x7fe2('0x1')](function(_0x8dbf8d){var _0x126ec6=_[_0x7fe2('0x6')](_0x8dbf8d,{'priority':'1'});var _0x2eebb5=_[_0x7fe2('0x6')](_0x8dbf8d,{'isApp':0x1});var _0x3b450a=_[_0x7fe2('0x7')](_0x2eebb5,_0x7fe2('0x8'));var _0x122400=[_0x7fe2('0x9'),'playback'];var _0xe34661=[];var _0x32a8d4=[];for(var _0x47967c in _0x3b450a){if(_0x3b450a[_0x7fe2('0xa')](_0x47967c)){_0x380907[_0x7fe2('0xb')]=0x2;_0x380907[_0x7fe2('0xc')]=[];_0x380907[_0x7fe2('0xd')]=_[_0x7fe2('0xe')](_0x126ec6,{'exten':_0x3b450a[_0x47967c][0x0]['exten']});_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':util['format'](_0x7fe2('0x12'),_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')]),'context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0]['VoiceExtensionId']});if(_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')]==='inbound'){_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x14')+_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')],'context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0]['exten'],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});}else if(_0x3b450a[_0x47967c][0x0]['type']===_0x7fe2('0x16')){if(_0x380907['extension']){_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x17')+(_0x380907[_0x7fe2('0xd')][_0x7fe2('0x18')]?_0x7fe2('0x19')+_0x380907[_0x7fe2('0xd')]['cutdigits']+'}':_0x7fe2('0x1a')),'context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});}_0x380907['extensions']['push']({'type':_0x3b450a[_0x47967c][0x0]['type'],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x14')+_0x3b450a[_0x47967c][0x0]['VoiceExtensionId'],'context':_0x3b450a[_0x47967c][0x0]['context'],'exten':_0x3b450a[_0x47967c][0x0]['exten'],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});var _0x49f33e=_0x380907[_0x7fe2('0xb')]++;_0x380907['extensions'][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x1b'),'appdata':_0x7fe2('0x1c')+(_0x49f33e+0x2)+'):Goto('+(_0x49f33e+0x1)+')','context':_0x3b450a[_0x47967c][0x0]['context'],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x49f33e,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});if(_0x380907[_0x7fe2('0xd')]){_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0]['type'],'app':_0x7fe2('0x11'),'appdata':_0x380907[_0x7fe2('0xd')][_0x7fe2('0x18')]?_0x7fe2('0x1d')+_0x380907[_0x7fe2('0xd')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3b450a[_0x47967c][0x0]['context'],'exten':_0x3b450a[_0x47967c][0x0]['exten'],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});}_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x1e')+_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')],'context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});if(_0x380907[_0x7fe2('0xd')]&&_0x380907['extension'][_0x7fe2('0xa')](_0x7fe2('0x1f'))&&_0x380907[_0x7fe2('0xd')][_0x7fe2('0x1f')]!==_0x7fe2('0x20')){_0x380907['extensions'][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x21'),'context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0]['VoiceExtensionId']});_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x380907[_0x7fe2('0xd')]['recordingFormat']||_0x7fe2('0x22'),'context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907['priority']++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});}}_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x13')],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907['priority']++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});_0x380907[_0x7fe2('0xc')][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3b450a[_0x47967c][0x0]['context'],'exten':_0x3b450a[_0x47967c][0x0]['exten'],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});_0x380907['extensions'][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0]['type'],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x23'),'context':_0x3b450a[_0x47967c][0x0]['context'],'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'priority':_0x380907[_0x7fe2('0xb')]++,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});for(var _0x562ca6=0x0,_0x11089a=0x0;_0x562ca6<_0x3b450a[_0x47967c][_0x7fe2('0x24')];_0x562ca6+=0x1,_0x11089a=0x0){var _0x291b8e=_0x3b450a[_0x47967c][_0x562ca6];if(_0x291b8e['type']){_0x291b8e[_0x7fe2('0x10')]=_0x291b8e[_0x7fe2('0x10')]['toLowerCase']();}var _0x700b38=[];var _0x15e5b1=[];delete _0x291b8e['id'];delete _0x291b8e[_0x7fe2('0x25')];delete _0x291b8e[_0x7fe2('0x26')];var _0x28e984=_0x291b8e[_0x7fe2('0x27')]!==_0x7fe2('0x28')?[_0x291b8e[_0x7fe2('0x27')]]:_0x291b8e[_0x7fe2('0x29')]?_[_0x7fe2('0x2a')](_['filter'](_0x380907[_0x7fe2('0x2')],{'IntervalId':_0x291b8e[_0x7fe2('0x29')]}),_0x7fe2('0x27')):[];if(_0x291b8e['hasOwnProperty'](_0x7fe2('0x2b'))){if(_0x291b8e[_0x7fe2('0x2b')]&&_0x291b8e[_0x7fe2('0x2b')]!=='--'){_0x700b38['push']({'type':_0x291b8e[_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':_0x7fe2('0x2c')+_0x291b8e['tag'],'context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984['length']+_0x380907[_0x7fe2('0xb')]+_0x11089a++,'VoiceExtensionId':_0x291b8e[_0x7fe2('0x15')]});}}if(_0x291b8e[_0x7fe2('0x10')]===_0x7fe2('0x16')&&_0x291b8e[_0x7fe2('0xa')](_0x7fe2('0x2d'))){if(_0x291b8e[_0x7fe2('0x2d')]){_0x700b38['push']({'type':_0x291b8e[_0x7fe2('0x10')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x291b8e['callerID']+')','context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984[_0x7fe2('0x24')]+_0x380907[_0x7fe2('0xb')]+_0x11089a++,'VoiceExtensionId':_0x291b8e[_0x7fe2('0x15')]});}else{_0x700b38[_0x7fe2('0xf')]({'type':_0x291b8e['type'],'app':_0x7fe2('0x1b'),'appdata':_0x7fe2('0x2e'),'context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984[_0x7fe2('0x24')]+_0x380907[_0x7fe2('0xb')]+_0x11089a++,'VoiceExtensionId':_0x291b8e['VoiceExtensionId']});}}if(_0x291b8e[_0x7fe2('0xa')](_0x7fe2('0x2f'))){if(_0x122400[_0x7fe2('0x30')](_0x291b8e[_0x7fe2('0x31')][_0x7fe2('0x32')]())>=0x0&&_0x291b8e[_0x7fe2('0x33')]!==_0x7fe2('0x34')){if(_0x291b8e[_0x7fe2('0x2f')]){_0x700b38[_0x7fe2('0xf')]({'type':_0x291b8e['type'],'app':_0x7fe2('0x1b'),'appdata':_0x7fe2('0x35'),'context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984[_0x7fe2('0x24')]+_0x380907[_0x7fe2('0xb')]+_0x11089a++,'VoiceExtensionId':_0x291b8e[_0x7fe2('0x15')]});_0x700b38['push']({'type':_0x291b8e[_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984[_0x7fe2('0x24')]+_0x380907['priority']+_0x11089a++,'VoiceExtensionId':_0x291b8e[_0x7fe2('0x15')]});}else{_0x700b38[_0x7fe2('0xf')]({'type':_0x291b8e[_0x7fe2('0x10')],'app':'ExecIf','appdata':_0x7fe2('0x36'),'context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984['length']+_0x380907['priority']+_0x11089a++,'VoiceExtensionId':_0x291b8e['VoiceExtensionId']});_0x700b38[_0x7fe2('0xf')]({'type':_0x291b8e[_0x7fe2('0x10')],'app':_0x7fe2('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x291b8e[_0x7fe2('0x13')],'exten':_0x291b8e[_0x7fe2('0x8')],'priority':_0x28e984[_0x7fe2('0x24')]+_0x380907['priority']+_0x11089a++,'VoiceExtensionId':_0x291b8e[_0x7fe2('0x15')]});}}}for(var _0xfd4585=0x0;_0xfd4585<_0x28e984[_0x7fe2('0x24')];_0xfd4585+=0x1){var _0x253994=_0x380907[_0x7fe2('0xb')]+_0x28e984[_0x7fe2('0x24')];var _0x45a2fd=_0xfd4585===_0x28e984[_0x7fe2('0x24')]-0x1?_0x380907[_0x7fe2('0xb')]+_0x700b38['length']+_0x15e5b1[_0x7fe2('0x24')]+0x2:_0x380907[_0x7fe2('0xb')]+_0xfd4585+0x1;_0x700b38[_0x7fe2('0x37')](_0xfd4585,0x0,{'type':_0x291b8e[_0x7fe2('0x10')],'app':_0x7fe2('0x38'),'appdata':_0x28e984[_0xfd4585]+'?'+_0x291b8e[_0x7fe2('0x13')]+_0x7fe2('0x39')+_0x253994+':'+_0x291b8e[_0x7fe2('0x13')]+_0x7fe2('0x39')+_0x45a2fd,'exten':_0x291b8e[_0x7fe2('0x8')],'context':_0x291b8e[_0x7fe2('0x13')],'priority':_0x380907[_0x7fe2('0xb')]+_0xfd4585,'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});}_0x291b8e['priority']=_0x700b38[_0x7fe2('0x24')]?_[_0x7fe2('0x3a')](_0x700b38)[_0x7fe2('0xb')]+0x1:_0x380907[_0x7fe2('0xb')];_0x380907[_0x7fe2('0xb')]=(_0x15e5b1['length']?_[_0x7fe2('0x3a')](_0x15e5b1)[_0x7fe2('0xb')]:_0x291b8e[_0x7fe2('0xb')])+0x1;_0x380907[_0x7fe2('0xc')]=_[_0x7fe2('0x3b')](_0x380907[_0x7fe2('0xc')],_0x700b38,[_0x291b8e],_0x15e5b1);}_0x380907['extensions'][_0x7fe2('0xf')]({'type':_0x3b450a[_0x47967c][0x0]['type'],'app':_0x7fe2('0x3c'),'exten':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x8')],'context':_0x3b450a[_0x47967c][0x0]['context'],'priority':_0x380907[_0x7fe2('0xb')],'VoiceExtensionId':_0x3b450a[_0x47967c][0x0][_0x7fe2('0x15')]});_0xe34661[_0x7fe2('0xf')](_0x3b450a[_0x47967c][0x0]['VoiceExtensionId']);_0x32a8d4=_[_0x7fe2('0x3b')](_0x32a8d4,_0x380907[_0x7fe2('0xc')]);}}return _0x3aa50d[_0x7fe2('0x3d')](function(_0x43c197){return _0x3aa50d[_0x7fe2('0x0')][_0x7fe2('0x3e')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xe34661}},'transaction':_0x43c197})[_0x7fe2('0x1')](function(_0x4f6039){return _0x3aa50d['models']['VoiceExtension'][_0x7fe2('0x3f')](_[_0x7fe2('0x40')](_0x32a8d4,_0x7fe2('0xb')),{'transaction':_0x43c197});});});})[_0x7fe2('0x41')](function(_0x13b06e){console['error'](_0x13b06e);});}exports[_0x7fe2('0x42')]=rewrite; \ No newline at end of file +var _0xb5ca=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','CDR(routeid)=','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none'];(function(_0xe0a10c,_0x6a3df2){var _0x42eabe=function(_0x264bb7){while(--_0x264bb7){_0xe0a10c['push'](_0xe0a10c['shift']());}};_0x42eabe(++_0x6a3df2);}(_0xb5ca,0x13e));var _0xab5c=function(_0x47dd26,_0x2600d1){_0x47dd26=_0x47dd26-0x0;var _0x92e102=_0xb5ca[_0x47dd26];return _0x92e102;};'use strict';var _=require(_0xab5c('0x0'));var util=require('util');function rewrite(_0x2c97d8,_0x19f9b9){var _0x3d1482=this;return _0x2c97d8[_0xab5c('0x1')][_0xab5c('0x2')][_0xab5c('0x3')]({'raw':!![]})[_0xab5c('0x4')](function(_0xf407f5){_0x3d1482[_0xab5c('0x5')]=_0xf407f5;return _0x2c97d8[_0xab5c('0x1')][_0xab5c('0x6')][_0xab5c('0x3')]({'where':{'IntervalId':_0x19f9b9[_0xab5c('0x7')]},'raw':!![]});})['then'](function(_0x4ae932){return _0x2c97d8[_0xab5c('0x1')][_0xab5c('0x6')][_0xab5c('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0xab5c('0x8')](_0x4ae932,_0xab5c('0x9')))}},'order':[{'raw':_0xab5c('0xa')}],'raw':!![]});})[_0xab5c('0x4')](function(_0xb3299a){var _0x2a862a=_[_0xab5c('0xb')](_0xb3299a,{'priority':'1'});var _0x36a2f8=_[_0xab5c('0xb')](_0xb3299a,{'isApp':0x1});var _0x4bfb64=_[_0xab5c('0xc')](_0x36a2f8,_0xab5c('0x9'));var _0x5d905b=[_0xab5c('0xd'),_0xab5c('0xe')];var _0x38fd29=[];var _0x1e16af=[];for(var _0x556151 in _0x4bfb64){if(_0x4bfb64[_0xab5c('0xf')](_0x556151)){_0x3d1482[_0xab5c('0x10')]=0x2;_0x3d1482[_0xab5c('0x11')]=[];_0x3d1482[_0xab5c('0x12')]=_[_0xab5c('0x13')](_0x2a862a,{'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')]});_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':util[_0xab5c('0x17')]('CDR(type)=%s',_0x4bfb64[_0x556151][0x0]['type']),'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0]['exten'],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});if(_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')]==='inbound'){_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':'Set','appdata':_0xab5c('0x1a')+_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')],'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0]['exten'],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});}else if(_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')]===_0xab5c('0x1b')){if(_0x3d1482['extension']){_0x3d1482['extensions']['push']({'type':_0x4bfb64[_0x556151][0x0]['type'],'app':_0xab5c('0x16'),'appdata':'CDR(destination)='+(_0x3d1482['extension'][_0xab5c('0x1c')]?_0xab5c('0x1d')+_0x3d1482[_0xab5c('0x12')][_0xab5c('0x1c')]+'}':'${EXTEN}'),'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'priority':_0x3d1482['priority']++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});}_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x1a')+_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')],'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0]['exten'],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});var _0x1a900e=_0x3d1482['priority']++;_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1a900e+0x2)+_0xab5c('0x1f')+(_0x1a900e+0x1)+')','context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'priority':_0x1a900e,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});if(_0x3d1482[_0xab5c('0x12')]){_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':_0x3d1482[_0xab5c('0x12')][_0xab5c('0x1c')]?_0xab5c('0x20')+_0x3d1482[_0xab5c('0x12')][_0xab5c('0x1c')]+'}':_0xab5c('0x21'),'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0]['exten'],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});}_0x3d1482['extensions'][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0]['type'],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x22')+_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')],'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0]['exten'],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});if(_0x3d1482[_0xab5c('0x12')]&&_0x3d1482['extension'][_0xab5c('0xf')](_0xab5c('0x23'))&&_0x3d1482['extension'][_0xab5c('0x23')]!==_0xab5c('0x24')){_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x25'),'context':_0x4bfb64[_0x556151][0x0]['context'],'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0]['type'],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x26')+_0x3d1482[_0xab5c('0x12')][_0xab5c('0x23')]||_0xab5c('0x27'),'context':_0x4bfb64[_0x556151][0x0]['context'],'exten':_0x4bfb64[_0x556151][0x0]['exten'],'priority':_0x3d1482['priority']++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});}}_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'priority':_0x3d1482['priority']++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x28'),'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});_0x3d1482['extensions'][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':'Set','appdata':_0xab5c('0x29'),'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'priority':_0x3d1482[_0xab5c('0x10')]++,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});for(var _0x1d90f3=0x0,_0xb6b68f=0x0;_0x1d90f3<_0x4bfb64[_0x556151][_0xab5c('0x2a')];_0x1d90f3+=0x1,_0xb6b68f=0x0){var _0x517e32=_0x4bfb64[_0x556151][_0x1d90f3];if(_0x517e32[_0xab5c('0x15')]){_0x517e32[_0xab5c('0x15')]=_0x517e32[_0xab5c('0x15')][_0xab5c('0x2b')]();}var _0xdc299b=[];var _0x4b70ea=[];delete _0x517e32['id'];delete _0x517e32['createdAt'];delete _0x517e32[_0xab5c('0x2c')];var _0x5709d7=_0x517e32[_0xab5c('0x2d')]!=='*,*,*,*'?[_0x517e32[_0xab5c('0x2d')]]:_0x517e32[_0xab5c('0x7')]?_[_0xab5c('0x8')](_[_0xab5c('0xb')](_0x3d1482['intervals'],{'IntervalId':_0x517e32['IntervalId']}),_0xab5c('0x2d')):[];if(_0x517e32['hasOwnProperty'](_0xab5c('0x2e'))){if(_0x517e32[_0xab5c('0x2e')]&&_0x517e32[_0xab5c('0x2e')]!=='--'){_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32[_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x2f')+_0x517e32[_0xab5c('0x2e')],'context':_0x517e32[_0xab5c('0x18')],'exten':_0x517e32['exten'],'priority':_0x5709d7[_0xab5c('0x2a')]+_0x3d1482[_0xab5c('0x10')]+_0xb6b68f++,'VoiceExtensionId':_0x517e32[_0xab5c('0x19')]});}}if(_0x517e32[_0xab5c('0x15')]==='outbound'&&_0x517e32[_0xab5c('0xf')]('callerID')){if(_0x517e32[_0xab5c('0x30')]){_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32['type'],'app':_0xab5c('0x1e'),'appdata':_0xab5c('0x31')+_0x517e32[_0xab5c('0x30')]+')','context':_0x517e32['context'],'exten':_0x517e32['exten'],'priority':_0x5709d7[_0xab5c('0x2a')]+_0x3d1482[_0xab5c('0x10')]+_0xb6b68f++,'VoiceExtensionId':_0x517e32[_0xab5c('0x19')]});}else{_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32[_0xab5c('0x15')],'app':_0xab5c('0x1e'),'appdata':_0xab5c('0x32'),'context':_0x517e32['context'],'exten':_0x517e32['exten'],'priority':_0x5709d7[_0xab5c('0x2a')]+_0x3d1482[_0xab5c('0x10')]+_0xb6b68f++,'VoiceExtensionId':_0x517e32[_0xab5c('0x19')]});}}if(_0x517e32[_0xab5c('0xf')]('answer')){if(_0x5d905b[_0xab5c('0x33')](_0x517e32['app']['toLowerCase']())>=0x0&&_0x517e32[_0xab5c('0x34')]!==_0xab5c('0x35')){if(_0x517e32[_0xab5c('0x36')]){_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32[_0xab5c('0x15')],'app':_0xab5c('0x1e'),'appdata':_0xab5c('0x37'),'context':_0x517e32[_0xab5c('0x18')],'exten':_0x517e32[_0xab5c('0x9')],'priority':_0x5709d7[_0xab5c('0x2a')]+_0x3d1482[_0xab5c('0x10')]+_0xb6b68f++,'VoiceExtensionId':_0x517e32[_0xab5c('0x19')]});_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32[_0xab5c('0x15')],'app':'Set','appdata':_0xab5c('0x38'),'context':_0x517e32[_0xab5c('0x18')],'exten':_0x517e32[_0xab5c('0x9')],'priority':_0x5709d7[_0xab5c('0x2a')]+_0x3d1482['priority']+_0xb6b68f++,'VoiceExtensionId':_0x517e32[_0xab5c('0x19')]});}else{_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32['type'],'app':_0xab5c('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x517e32[_0xab5c('0x18')],'exten':_0x517e32[_0xab5c('0x9')],'priority':_0x5709d7['length']+_0x3d1482['priority']+_0xb6b68f++,'VoiceExtensionId':_0x517e32[_0xab5c('0x19')]});_0xdc299b[_0xab5c('0x14')]({'type':_0x517e32[_0xab5c('0x15')],'app':_0xab5c('0x16'),'appdata':_0xab5c('0x39'),'context':_0x517e32[_0xab5c('0x18')],'exten':_0x517e32['exten'],'priority':_0x5709d7[_0xab5c('0x2a')]+_0x3d1482[_0xab5c('0x10')]+_0xb6b68f++,'VoiceExtensionId':_0x517e32['VoiceExtensionId']});}}}for(var _0x2732ef=0x0;_0x2732ef<_0x5709d7[_0xab5c('0x2a')];_0x2732ef+=0x1){var _0x515e0d=_0x3d1482[_0xab5c('0x10')]+_0x5709d7[_0xab5c('0x2a')];var _0x3770ff=_0x2732ef===_0x5709d7[_0xab5c('0x2a')]-0x1?_0x3d1482[_0xab5c('0x10')]+_0xdc299b[_0xab5c('0x2a')]+_0x4b70ea[_0xab5c('0x2a')]+0x2:_0x3d1482[_0xab5c('0x10')]+_0x2732ef+0x1;_0xdc299b[_0xab5c('0x3a')](_0x2732ef,0x0,{'type':_0x517e32[_0xab5c('0x15')],'app':_0xab5c('0x3b'),'appdata':_0x5709d7[_0x2732ef]+'?'+_0x517e32[_0xab5c('0x18')]+_0xab5c('0x3c')+_0x515e0d+':'+_0x517e32['context']+_0xab5c('0x3c')+_0x3770ff,'exten':_0x517e32[_0xab5c('0x9')],'context':_0x517e32[_0xab5c('0x18')],'priority':_0x3d1482[_0xab5c('0x10')]+_0x2732ef,'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});}_0x517e32[_0xab5c('0x10')]=_0xdc299b[_0xab5c('0x2a')]?_[_0xab5c('0x3d')](_0xdc299b)[_0xab5c('0x10')]+0x1:_0x3d1482[_0xab5c('0x10')];_0x3d1482[_0xab5c('0x10')]=(_0x4b70ea['length']?_[_0xab5c('0x3d')](_0x4b70ea)['priority']:_0x517e32['priority'])+0x1;_0x3d1482['extensions']=_[_0xab5c('0x3e')](_0x3d1482[_0xab5c('0x11')],_0xdc299b,[_0x517e32],_0x4b70ea);}_0x3d1482[_0xab5c('0x11')][_0xab5c('0x14')]({'type':_0x4bfb64[_0x556151][0x0][_0xab5c('0x15')],'app':_0xab5c('0x3f'),'exten':_0x4bfb64[_0x556151][0x0][_0xab5c('0x9')],'context':_0x4bfb64[_0x556151][0x0][_0xab5c('0x18')],'priority':_0x3d1482[_0xab5c('0x10')],'VoiceExtensionId':_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]});_0x38fd29[_0xab5c('0x14')](_0x4bfb64[_0x556151][0x0][_0xab5c('0x19')]);_0x1e16af=_[_0xab5c('0x3e')](_0x1e16af,_0x3d1482[_0xab5c('0x11')]);}}return _0x2c97d8[_0xab5c('0x40')](function(_0x258d4c){return _0x2c97d8['models'][_0xab5c('0x6')][_0xab5c('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x38fd29}},'transaction':_0x258d4c})['then'](function(_0x2be613){return _0x2c97d8[_0xab5c('0x1')][_0xab5c('0x6')][_0xab5c('0x42')](_[_0xab5c('0x43')](_0x1e16af,_0xab5c('0x10')),{'transaction':_0x258d4c});});});})[_0xab5c('0x44')](function(_0x2515d3){console[_0xab5c('0x45')](_0x2515d3);});}exports[_0xab5c('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3e49369..2351289 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 _0x3e74=['field','NOW()','toString','createdAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','from','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select'];(function(_0x3731a1,_0x392827){var _0x58e70f=function(_0x42969b){while(--_0x42969b){_0x3731a1['push'](_0x3731a1['shift']());}};_0x58e70f(++_0x392827);}(_0x3e74,0x1ec));var _0x43e7=function(_0x31c29d,_0x253d34){_0x31c29d=_0x31c29d-0x0;var _0x2ed140=_0x3e74[_0x31c29d];return _0x2ed140;};'use strict';var BPromise=require(_0x43e7('0x0'));var util=require(_0x43e7('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x43e7('0x2'));var Papa=require(_0x43e7('0x3'));var Redis=require(_0x43e7('0x4'));var db=require(_0x43e7('0x5'))['db'];var config=require(_0x43e7('0x6'));var logger=require(_0x43e7('0x7'))('api');config[_0x43e7('0x8')]=_[_0x43e7('0x9')](config[_0x43e7('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43e7('0x8')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);try{if(!process[_0x43e7('0xc')][0x2]||process['argv'][0x2]===_0x43e7('0xd')||process['argv'][0x2]==='null'){throw new Error(_0x43e7('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x43e7('0xc')][0x3]||process[_0x43e7('0xc')][0x3]===_0x43e7('0xd')||process[_0x43e7('0xc')][0x3]===_0x43e7('0xf')||!process['argv'][0x4]||process[_0x43e7('0xc')][0x4]===_0x43e7('0xd')||process[_0x43e7('0xc')][0x4]==='null'){throw new Error(_0x43e7('0x10'));}var FIELDS=_['zipObject'](process[_0x43e7('0xc')][0x3][_0x43e7('0x11')](','),process['argv'][0x4][_0x43e7('0x11')](','));if(!process['argv'][0x5]||process[_0x43e7('0xc')][0x5]===_0x43e7('0xd')||process[_0x43e7('0xc')][0x5]===_0x43e7('0xf')){throw new Error(_0x43e7('0x12'));}var LISTID=process[_0x43e7('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x43e7('0xc')][0x6]!=='undefined'&&process[_0x43e7('0xc')][0x6]!==_0x43e7('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x43e7('0xc')][0x7]&&process[_0x43e7('0xc')][0x7]!=='undefined'&&process[_0x43e7('0xc')][0x7]!==_0x43e7('0xf')?process[_0x43e7('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x43e7('0xd')||process[_0x43e7('0xc')][0x8]===_0x43e7('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x43e7('0xc')][0x8];}catch(_0x2486ec){logger[_0x43e7('0x13')](_0x2486ec);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(_0x4a3ce3,_0x586784,_0x411cd1,_0x3845fe){var _0x23ee7b={'message':_0x586784};_0x23ee7b[_0x4a3ce3]=!![];if(_0x411cd1){_0x23ee7b['contact']=_0x411cd1;}if(_0x3845fe){_0x23ee7b[_0x43e7('0x14')]=_0x3845fe;}return _0x23ee7b;}function isEmail(_0x56efeb){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))*$/[_0x43e7('0x15')](_0x56efeb);}function checkRow(_0x4ceb0d,_0x32017e,_0x561c00){return new BPromise(function(_0x515254,_0x4058a0){if(_[_0x43e7('0x16')](_0x4ceb0d)){return _0x4058a0(handleCheckRowError(_0x43e7('0x13'),_0x43e7('0x17'),null,_0x561c00));}if(_0x4ceb0d[_0x43e7('0x18')]&&_0x4ceb0d[_0x43e7('0x18')][_0x43e7('0x19')]){var _0x919377=_[_0x43e7('0x1a')](_0x4ceb0d[_0x43e7('0x18')],_0x43e7('0x1b'))[_0x43e7('0x1c')](';');return _0x4058a0(handleCheckRowError(_0x43e7('0x13'),_0x919377,null,_0x561c00));}var _0x41472a={};for(var _0x434ad2 in FIELDS){if(FIELDS['hasOwnProperty'](_0x434ad2)&&FIELDS[_0x434ad2]){_0x41472a[_0x434ad2]=_0x4ceb0d['data'][0x0][FIELDS[_0x434ad2]]||_0x4ceb0d[_0x43e7('0x1d')][0x0]['\ufeff'+FIELDS[_0x434ad2]];}}if(!_0x41472a['firstName']){return _0x4058a0(handleCheckRowError(_0x43e7('0x13'),_0x43e7('0x1e'),null,_0x561c00));}if(!_0x41472a[_0x43e7('0x1f')]){return _0x4058a0(handleCheckRowError(_0x43e7('0x13'),'phone\x20not\x20specified!',null,_0x561c00));}if(_0x41472a[_0x43e7('0x20')]){var _0xf63802=moment(_0x41472a[_0x43e7('0x20')],'YYYY-MM-DD');if(!_0xf63802[_0x43e7('0x21')]()){return _0x4058a0(handleCheckRowError(_0x43e7('0x13'),_0x43e7('0x22'),null,_0x561c00));}}if(_0x41472a[_0x43e7('0x23')]){if(!isEmail(_0x41472a[_0x43e7('0x23')])){return _0x4058a0(handleCheckRowError('error',_0x43e7('0x24'),null,_0x561c00));}}_0x41472a[_0x43e7('0x25')]=LISTID;_0x41472a[_0x43e7('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x43e7('0x19')]&&_0x32017e){var _0x5c2e97={};for(var _0x155f47=0x0,_0x5312f4=DUPLICATES[_0x43e7('0x19')];_0x155f47<_0x5312f4;_0x155f47+=0x1){_0x5c2e97[DUPLICATES[_0x155f47]]=_0x41472a[DUPLICATES[_0x155f47]];}var _0x4f69a5=_[_0x43e7('0x27')](_0x32017e,_0x5c2e97);if(_0x4f69a5){return _0x4058a0(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x4f69a5,_0x561c00));}}return db['CmContact'][_0x43e7('0x28')](_0x41472a,{'raw':!![],'hooks':![],'fields':_[_0x43e7('0x29')](_0x41472a)})[_0x43e7('0x2a')](function(_0x15c1dc){if(DUPLICATES&&DUPLICATES[_0x43e7('0x19')]&&_0x32017e){_0x32017e[_0x43e7('0x2b')](_[_0x43e7('0x2c')](_0x41472a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15c1dc['id'];return _0x515254();})[_0x43e7('0x2d')](function(_0x4ca285){return _0x4058a0(handleCheckRowError(_0x43e7('0x13'),_0x43e7('0x2e')+(_0x4ca285[_0x43e7('0x1b')]||JSON[_0x43e7('0x2f')](_0x4ca285)),null,_0x561c00));});});}function checkHopper(){function _0x1e979f(){return function(_0x538055){logger[_0x43e7('0x13')](_0x43e7('0x30'),'checkHopper',util[_0x43e7('0x31')](_0x538055,{'showHidden':![],'depth':null}));};}var _0x84a9db=function(_0x3b6756,_0xb480f6){var _0x4f1d7c=squel[_0x43e7('0x32')]()[_0x43e7('0x33')](_0x43e7('0x34'))[_0x43e7('0x35')]([_0x43e7('0x1f'),_0x43e7('0x36'),_0x43e7('0x37'),_0x43e7('0x25'),_0xb480f6,'createdAt',_0x43e7('0x38')],squel[_0x43e7('0x39')]()[_0x43e7('0x3a')]('phone',_0x43e7('0x1f'))[_0x43e7('0x3a')](_0x43e7('0x3b'),_0x43e7('0x36'))['field']('id',_0x43e7('0x37'))['field'](LISTID[_0x43e7('0x3c')](),_0x43e7('0x25'))[_0x43e7('0x3a')](_0x3b6756['id']['toString'](),_0xb480f6)[_0x43e7('0x3a')](_0x43e7('0x3b'),_0x43e7('0x3d'))[_0x43e7('0x3a')](_0x43e7('0x3b'),_0x43e7('0x38'))['from'](_0x43e7('0x3e'))[_0x43e7('0x3f')](_0x43e7('0x40'))[_0x43e7('0x3f')](_0x43e7('0x41'),LISTID['toString']())[_0x43e7('0x3f')](_0x43e7('0x42'))['where'](_0x43e7('0x43'),squel['select']()[_0x43e7('0x3a')](_0x43e7('0x1f'))['from'](_0x43e7('0x34'))['where'](_0xb480f6+_0x43e7('0x44'),_0x3b6756['id'][_0x43e7('0x3c')]())))[_0x43e7('0x3c')]();return _0x4f1d7c;};var _0x2b6ae1=function(_0x19f269,_0x339850){var _0x99619e=squel[_0x43e7('0x32')]()[_0x43e7('0x33')](_0x43e7('0x34'))[_0x43e7('0x35')]([_0x43e7('0x1f'),'scheduledAt','ContactId',_0x43e7('0x25'),_0x339850,_0x43e7('0x3d'),'updatedAt'],squel[_0x43e7('0x39')]()[_0x43e7('0x3a')](_0x43e7('0x1f'),'phone')[_0x43e7('0x3a')](_0x43e7('0x3b'),'scheduledAt')[_0x43e7('0x3a')]('id',_0x43e7('0x37'))[_0x43e7('0x3a')](LISTID[_0x43e7('0x3c')](),_0x43e7('0x25'))[_0x43e7('0x3a')](_0x19f269['id']['toString'](),_0x339850)['field'](_0x43e7('0x3b'),_0x43e7('0x3d'))['field'](_0x43e7('0x3b'),'updatedAt')[_0x43e7('0x45')](_0x43e7('0x3e'))['where'](_0x43e7('0x40'))['where'](_0x43e7('0x41'),LISTID[_0x43e7('0x3c')]())[_0x43e7('0x3f')](_0x43e7('0x46'),squel[_0x43e7('0x47')](hopperContacts))[_0x43e7('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x43e7('0x43'),squel[_0x43e7('0x39')]()[_0x43e7('0x3a')](_0x43e7('0x48'))[_0x43e7('0x45')](_0x43e7('0x49'))[_0x43e7('0x3f')](_0x339850+'\x20=\x20?',_0x19f269['id']['toString']()))['where'](_0x43e7('0x43'),squel[_0x43e7('0x39')]()[_0x43e7('0x3a')](_0x43e7('0x1f'))[_0x43e7('0x45')](_0x43e7('0x34'))[_0x43e7('0x3f')](_0x339850+_0x43e7('0x44'),_0x19f269['id'][_0x43e7('0x3c')]())))['toString']();return _0x99619e;};function _0x2345fe(_0x5a4f14,_0x3478f7){var _0x23f64f=squel['insert']()[_0x43e7('0x33')]('cm_hopper')['fromQuery']([_0x43e7('0x1f'),_0x43e7('0x36'),_0x43e7('0x37'),'ListId',_0x3478f7,_0x43e7('0x3d'),_0x43e7('0x38')],squel[_0x43e7('0x39')]()[_0x43e7('0x3a')](_0x43e7('0x1f'),_0x43e7('0x1f'))[_0x43e7('0x3a')](_0x43e7('0x3b'),_0x43e7('0x36'))[_0x43e7('0x3a')]('id',_0x43e7('0x37'))[_0x43e7('0x3a')](LISTID[_0x43e7('0x3c')](),'ListId')['field'](_0x5a4f14['id'][_0x43e7('0x3c')](),_0x3478f7)[_0x43e7('0x3a')](_0x43e7('0x3b'),_0x43e7('0x3d'))[_0x43e7('0x3a')](_0x43e7('0x3b'),_0x43e7('0x38'))[_0x43e7('0x45')](_0x43e7('0x3e'))['where'](_0x43e7('0x40'))[_0x43e7('0x3f')](_0x43e7('0x41'),LISTID[_0x43e7('0x3c')]())[_0x43e7('0x3f')](_0x43e7('0x46'),squel[_0x43e7('0x47')](hopperContacts))[_0x43e7('0x3f')](_0x43e7('0x42')))['toString']();return _0x23f64f;}function _0x5a0bb6(_0x13a55b,_0x304f15){var _0x468680=squel[_0x43e7('0x32')]()[_0x43e7('0x33')](_0x43e7('0x4a'))[_0x43e7('0x35')](['phone','ContactId',_0x43e7('0x25'),_0x304f15,_0x43e7('0x3d'),_0x43e7('0x38')],squel[_0x43e7('0x39')]()[_0x43e7('0x3a')]('phone',_0x43e7('0x1f'))['field']('id',_0x43e7('0x37'))[_0x43e7('0x3a')](LISTID[_0x43e7('0x3c')](),_0x43e7('0x25'))['field'](_0x13a55b['id'][_0x43e7('0x3c')](),_0x304f15)['field'](_0x43e7('0x3b'),_0x43e7('0x3d'))[_0x43e7('0x3a')]('NOW()',_0x43e7('0x38'))[_0x43e7('0x45')](_0x43e7('0x3e'))[_0x43e7('0x3f')](_0x43e7('0x40'))[_0x43e7('0x3f')]('ListId\x20=\x20?',LISTID[_0x43e7('0x3c')]())[_0x43e7('0x3f')]('id\x20IN\x20?',squel[_0x43e7('0x47')](hopperContacts))['where'](_0x43e7('0x42')))[_0x43e7('0x3c')]();return _0x468680;}return db['VoiceQueue'][_0x43e7('0x4b')]({'where':{'type':_0x43e7('0x4c')},'attributes':['id',_0x43e7('0x4d')],'include':[{'model':db[_0x43e7('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x43e7('0x2a')](function(_0x5936b1){var _0x4afed4=[];if(_0x5936b1){var _0x4427d9;for(var _0x23d2be=0x0,_0x15cbb6;_0x23d2be<_0x5936b1['length'];_0x23d2be+=0x1){_0x15cbb6=_0x5936b1[_0x23d2be][_0x43e7('0x4f')]({'plain':!![]});switch(_0x15cbb6['dialCheckDuplicateType']){case _0x43e7('0x50'):_0x4afed4[_0x43e7('0x2b')](db['sequelize'][_0x43e7('0x51')](_0x2b6ae1(_0x15cbb6,_0x43e7('0x52')))[_0x43e7('0x2a')](function(){})[_0x43e7('0x2d')](_0x1e979f()));break;case _0x43e7('0x53'):_0x4afed4[_0x43e7('0x2b')](db[_0x43e7('0x54')][_0x43e7('0x51')](_0x84a9db(_0x15cbb6,_0x43e7('0x52')))[_0x43e7('0x2a')](function(){})[_0x43e7('0x2d')](_0x1e979f()));break;default:_0x4afed4[_0x43e7('0x2b')](db[_0x43e7('0x54')][_0x43e7('0x51')](_0x2345fe(_0x15cbb6,_0x43e7('0x52')))[_0x43e7('0x2a')](function(){})[_0x43e7('0x2d')](_0x1e979f()));}}}return _0x4afed4;})[_0x43e7('0x55')]()[_0x43e7('0x2a')](function(){return db['VoiceQueue'][_0x43e7('0x4b')]({'where':{'type':_0x43e7('0x4c')},'attributes':['id'],'include':[{'model':db[_0x43e7('0x4e')],'as':_0x43e7('0x56'),'where':{'id':LISTID}}]})[_0x43e7('0x2a')](function(_0x22f92d){var _0x554eff=[];if(_0x22f92d){var _0x532905;for(var _0x3a1928=0x0,_0x35b2fd;_0x3a1928<_0x22f92d[_0x43e7('0x19')];_0x3a1928+=0x1){_0x35b2fd=_0x22f92d[_0x3a1928][_0x43e7('0x4f')]({'plain':!![]});_0x554eff[_0x43e7('0x2b')](db['sequelize'][_0x43e7('0x51')](_0x5a0bb6(_0x35b2fd,'VoiceQueueId'))['then'](function(){})[_0x43e7('0x2d')](_0x1e979f()));}}return _0x554eff;})['all']();})[_0x43e7('0x2a')](function(){return db[_0x43e7('0x57')]['findAll']({'attributes':['id',_0x43e7('0x4d')],'include':[{'model':db[_0x43e7('0x4e')],'as':_0x43e7('0x58'),'where':{'id':LISTID}}]})[_0x43e7('0x2a')](function(_0x21ae18){var _0x21e69c=[];if(_0x21ae18){for(var _0x40c01c=0x0,_0x32a901;_0x40c01c<_0x21ae18[_0x43e7('0x19')];_0x40c01c+=0x1){_0x32a901=_0x21ae18[_0x40c01c][_0x43e7('0x4f')]({'plain':!![]});switch(_0x32a901['dialCheckDuplicateType']){case _0x43e7('0x50'):_0x21e69c['push'](db['sequelize'][_0x43e7('0x51')](_0x2b6ae1(_0x32a901,_0x43e7('0x59')))['then'](function(){})[_0x43e7('0x2d')](_0x1e979f()));break;case _0x43e7('0x53'):_0x21e69c[_0x43e7('0x2b')](db[_0x43e7('0x54')][_0x43e7('0x51')](_0x84a9db(_0x32a901,_0x43e7('0x59')))[_0x43e7('0x2a')](function(){})[_0x43e7('0x2d')](_0x1e979f()));break;default:_0x21e69c[_0x43e7('0x2b')](db[_0x43e7('0x54')][_0x43e7('0x51')](_0x2345fe(_0x32a901,'CampaignId'))['then'](function(){})[_0x43e7('0x2d')](_0x1e979f()));}}}return _0x21e69c;})[_0x43e7('0x55')]();})['then'](function(){return db[_0x43e7('0x57')][_0x43e7('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x43e7('0x4e')],'as':_0x43e7('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x49163d){var _0x11351a=[];if(_0x49163d){for(var _0x3090b4=0x0,_0x2a31d9;_0x3090b4<_0x49163d[_0x43e7('0x19')];_0x3090b4+=0x1){_0x2a31d9=_0x49163d[_0x3090b4][_0x43e7('0x4f')]({'plain':!![]});_0x11351a['push'](db[_0x43e7('0x54')][_0x43e7('0x51')](_0x5a0bb6(_0x2a31d9,_0x43e7('0x59')))[_0x43e7('0x2a')](function(){})['catch'](_0x1e979f()));}}return _0x11351a;})[_0x43e7('0x55')]();})[_0x43e7('0x2d')](function(_0x102d1c){logger['error'](_0x43e7('0x5a'),_0x43e7('0x5b'),_0x102d1c[_0x43e7('0x1b')]);});}var processPromises=function(_0x484432){return BPromise[_0x43e7('0x55')](promises)[_0x43e7('0x2a')](function(_0x35c30d){})['catch'](function(_0x433773){logger['error'](_0x43e7('0x5c'),JSON[_0x43e7('0x2f')](_0x433773));})[_0x43e7('0x5d')](function(){socket[_0x43e7('0x5e')](_0x43e7('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x484432){return _0x484432[_0x43e7('0x60')]();}});};var endCsv=function(){return BPromise[_0x43e7('0x61')]()[_0x43e7('0x2a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x43e7('0x5e')](_0x43e7('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x43e7('0x62')](FILEPATH);}catch(_0x1fbc17){logger['error'](_0x43e7('0x63'),JSON[_0x43e7('0x2f')](_0x1fbc17));}finally{process[_0x43e7('0x64')](0x0);}});};process['on'](_0x43e7('0x65'),function(){logger[_0x43e7('0x66')](_0x43e7('0x67'));endCsv();});function main(){return BPromise[_0x43e7('0x61')]()[_0x43e7('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x43e7('0x11')](',');return db[_0x43e7('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x43e7('0x2a')](function(_0x66e2e2){var _0xe4d40d=fs[_0x43e7('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x43e7('0x6a')](_0xe4d40d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c4d31,_0x7ab789){total+=0x1;var _0x3655d8=total;promises[_0x43e7('0x2b')](checkRow(_0x5c4d31,_0x66e2e2,_0x3655d8)[_0x43e7('0x2a')](function(){success+=0x1;})[_0x43e7('0x2d')](function(_0x394105){if(_0x394105['error']){errors+=0x1;delete _0x394105[_0x43e7('0x13')];}else if(_0x394105[_0x43e7('0x6b')]){duplicates+=0x1;delete _0x394105[_0x43e7('0x6b')];}rows[_0x43e7('0x2b')](_0x394105);}));if(total%0xc8===0x0){_0x7ab789['pause']();return processPromises(_0x7ab789);}},'complete':function(){return processPromises()[_0x43e7('0x2a')](function(){logger['info'](_0x43e7('0x6c'));endCsv();});},'error':function(_0x23397e,_0xdd720){logger['info']('CSV\x20parse\x20error',JSON[_0x43e7('0x2f')](_0x23397e));endCsv();}});})[_0x43e7('0x2d')](function(_0x2b60c1){logger['error'](_0x43e7('0x6d'),JSON['stringify'](_0x2b60c1));});}main(); \ No newline at end of file +var _0x0537=['field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','always','query','onlyIfOpen','sequelize','VoiceQueueId','all','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','localhost','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','Duplicate\x20Contact','CmContact','then','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select'];(function(_0x4a20cd,_0x5de998){var _0x2a218=function(_0x1abb74){while(--_0x1abb74){_0x4a20cd['push'](_0x4a20cd['shift']());}};_0x2a218(++_0x5de998);}(_0x0537,0x93));var _0x7053=function(_0x5d76ad,_0x26158d){_0x5d76ad=_0x5d76ad-0x0;var _0x4f7937=_0x0537[_0x5d76ad];return _0x4f7937;};'use strict';var BPromise=require(_0x7053('0x0'));var util=require(_0x7053('0x1'));var _=require(_0x7053('0x2'));var fs=require('fs');var squel=require(_0x7053('0x3'));var Papa=require(_0x7053('0x4'));var Redis=require(_0x7053('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x7053('0x6'));var logger=require(_0x7053('0x7'))(_0x7053('0x8'));config['redis']=_['defaults'](config[_0x7053('0x9')],{'host':_0x7053('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7053('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x7053('0xb')](socket);try{if(!process[_0x7053('0xc')][0x2]||process['argv'][0x2]===_0x7053('0xd')||process[_0x7053('0xc')][0x2]===_0x7053('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x7053('0xc')][0x2];if(!process[_0x7053('0xc')][0x3]||process[_0x7053('0xc')][0x3]===_0x7053('0xd')||process['argv'][0x3]==='null'||!process[_0x7053('0xc')][0x4]||process[_0x7053('0xc')][0x4]===_0x7053('0xd')||process[_0x7053('0xc')][0x4]==='null'){throw new Error(_0x7053('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x7053('0x10')](','),process[_0x7053('0xc')][0x4][_0x7053('0x10')](','));if(!process[_0x7053('0xc')][0x5]||process[_0x7053('0xc')][0x5]==='undefined'||process['argv'][0x5]===_0x7053('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x7053('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x7053('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x7053('0xe')?process[_0x7053('0xc')][0x6]:null;var DUPLICATES=process[_0x7053('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x7053('0xc')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x7053('0xc')][0x8]||process[_0x7053('0xc')][0x8]===_0x7053('0xd')||process['argv'][0x8]===_0x7053('0xe')){throw new Error(_0x7053('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4e11d9){logger[_0x7053('0x12')](_0x4e11d9);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(_0x48ff24,_0xc4ece5,_0x162107,_0x1604b7){var _0x52bcd2={'message':_0xc4ece5};_0x52bcd2[_0x48ff24]=!![];if(_0x162107){_0x52bcd2[_0x7053('0x13')]=_0x162107;}if(_0x1604b7){_0x52bcd2['index']=_0x1604b7;}return _0x52bcd2;}function isEmail(_0x1822a7){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))*$/[_0x7053('0x14')](_0x1822a7);}function checkRow(_0x542729,_0x1f1172,_0x389d12){return new BPromise(function(_0x3e8851,_0x1bb439){if(_[_0x7053('0x15')](_0x542729)){return _0x1bb439(handleCheckRowError(_0x7053('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x389d12));}if(_0x542729[_0x7053('0x16')]&&_0x542729['errors'][_0x7053('0x17')]){var _0x1745d6=_['map'](_0x542729[_0x7053('0x16')],_0x7053('0x18'))['join'](';');return _0x1bb439(handleCheckRowError(_0x7053('0x12'),_0x1745d6,null,_0x389d12));}var _0x1aa7f1={};for(var _0x406d79 in FIELDS){if(FIELDS[_0x7053('0x19')](_0x406d79)&&FIELDS[_0x406d79]){_0x1aa7f1[_0x406d79]=_0x542729[_0x7053('0x1a')][0x0][FIELDS[_0x406d79]]||_0x542729[_0x7053('0x1a')][0x0]['\ufeff'+FIELDS[_0x406d79]];}}if(!_0x1aa7f1[_0x7053('0x1b')]){return _0x1bb439(handleCheckRowError(_0x7053('0x12'),'firstName\x20not\x20specified!',null,_0x389d12));}if(!_0x1aa7f1[_0x7053('0x1c')]){return _0x1bb439(handleCheckRowError(_0x7053('0x12'),_0x7053('0x1d'),null,_0x389d12));}if(_0x1aa7f1[_0x7053('0x1e')]){var _0x775696=moment(_0x1aa7f1[_0x7053('0x1e')],'YYYY-MM-DD');if(!_0x775696[_0x7053('0x1f')]()){return _0x1bb439(handleCheckRowError(_0x7053('0x12'),_0x7053('0x20'),null,_0x389d12));}}if(_0x1aa7f1['email']){if(!isEmail(_0x1aa7f1['email'])){return _0x1bb439(handleCheckRowError('error',_0x7053('0x21'),null,_0x389d12));}}_0x1aa7f1['ListId']=LISTID;_0x1aa7f1[_0x7053('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7053('0x17')]&&_0x1f1172){var _0x59fb8f={};for(var _0x1611df=0x0,_0x305a85=DUPLICATES['length'];_0x1611df<_0x305a85;_0x1611df+=0x1){_0x59fb8f[DUPLICATES[_0x1611df]]=_0x1aa7f1[DUPLICATES[_0x1611df]];}var _0x2a3997=_['find'](_0x1f1172,_0x59fb8f);if(_0x2a3997){return _0x1bb439(handleCheckRowError(_0x7053('0x23'),_0x7053('0x24'),_0x2a3997,_0x389d12));}}return db[_0x7053('0x25')]['create'](_0x1aa7f1,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1aa7f1)})[_0x7053('0x26')](function(_0x1d152c){if(DUPLICATES&&DUPLICATES[_0x7053('0x17')]&&_0x1f1172){_0x1f1172[_0x7053('0x27')](_['pick'](_0x1aa7f1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1d152c['id'];return _0x3e8851();})[_0x7053('0x28')](function(_0x534f1c){return _0x1bb439(handleCheckRowError(_0x7053('0x12'),_0x7053('0x29')+(_0x534f1c[_0x7053('0x18')]||JSON['stringify'](_0x534f1c)),null,_0x389d12));});});}function checkHopper(){function _0x49af1f(){return function(_0xcc93b4){logger['error'](_0x7053('0x2a'),_0x7053('0x2b'),util[_0x7053('0x2c')](_0xcc93b4,{'showHidden':![],'depth':null}));};}var _0x54e5d0=function(_0x525d5b,_0xf76063){var _0x386c24=squel[_0x7053('0x2d')]()[_0x7053('0x2e')](_0x7053('0x2f'))[_0x7053('0x30')]([_0x7053('0x1c'),_0x7053('0x31'),_0x7053('0x32'),_0x7053('0x33'),_0xf76063,_0x7053('0x34'),_0x7053('0x35')],squel[_0x7053('0x36')]()[_0x7053('0x37')](_0x7053('0x1c'),_0x7053('0x1c'))[_0x7053('0x37')](_0x7053('0x38'),_0x7053('0x31'))[_0x7053('0x37')]('id','ContactId')[_0x7053('0x37')](LISTID[_0x7053('0x39')](),_0x7053('0x33'))[_0x7053('0x37')](_0x525d5b['id'][_0x7053('0x39')](),_0xf76063)[_0x7053('0x37')](_0x7053('0x38'),_0x7053('0x34'))['field'](_0x7053('0x38'),_0x7053('0x35'))['from'](_0x7053('0x3a'))[_0x7053('0x3b')](_0x7053('0x3c'))[_0x7053('0x3b')](_0x7053('0x3d'),LISTID['toString']())[_0x7053('0x3b')](_0x7053('0x3e'))[_0x7053('0x3b')](_0x7053('0x3f'),squel[_0x7053('0x36')]()['field'](_0x7053('0x1c'))[_0x7053('0x40')](_0x7053('0x2f'))[_0x7053('0x3b')](_0xf76063+'\x20=\x20?',_0x525d5b['id'][_0x7053('0x39')]())))['toString']();return _0x386c24;};var _0x157325=function(_0x20fc42,_0x5d19f7){var _0x3e8dce=squel[_0x7053('0x2d')]()['into'](_0x7053('0x2f'))['fromQuery']([_0x7053('0x1c'),_0x7053('0x31'),_0x7053('0x32'),'ListId',_0x5d19f7,_0x7053('0x34'),_0x7053('0x35')],squel[_0x7053('0x36')]()[_0x7053('0x37')](_0x7053('0x1c'),_0x7053('0x1c'))['field'](_0x7053('0x38'),_0x7053('0x31'))[_0x7053('0x37')]('id',_0x7053('0x32'))[_0x7053('0x37')](LISTID[_0x7053('0x39')](),_0x7053('0x33'))[_0x7053('0x37')](_0x20fc42['id']['toString'](),_0x5d19f7)[_0x7053('0x37')](_0x7053('0x38'),'createdAt')[_0x7053('0x37')](_0x7053('0x38'),_0x7053('0x35'))[_0x7053('0x40')](_0x7053('0x3a'))[_0x7053('0x3b')]('deletedAt\x20IS\x20NULL')[_0x7053('0x3b')](_0x7053('0x3d'),LISTID[_0x7053('0x39')]())[_0x7053('0x3b')](_0x7053('0x41'),squel[_0x7053('0x42')](hopperContacts))['where'](_0x7053('0x3e'))[_0x7053('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7053('0x36')]()['field']('calleridnum')['from'](_0x7053('0x43'))['where'](_0x5d19f7+'\x20=\x20?',_0x20fc42['id'][_0x7053('0x39')]()))[_0x7053('0x3b')](_0x7053('0x3f'),squel['select']()[_0x7053('0x37')](_0x7053('0x1c'))[_0x7053('0x40')]('cm_hopper')[_0x7053('0x3b')](_0x5d19f7+_0x7053('0x44'),_0x20fc42['id'][_0x7053('0x39')]())))[_0x7053('0x39')]();return _0x3e8dce;};function _0x43f177(_0x495afb,_0x32990a){var _0x12dd58=squel[_0x7053('0x2d')]()[_0x7053('0x2e')](_0x7053('0x2f'))['fromQuery']([_0x7053('0x1c'),_0x7053('0x31'),_0x7053('0x32'),'ListId',_0x32990a,_0x7053('0x34'),'updatedAt'],squel[_0x7053('0x36')]()[_0x7053('0x37')](_0x7053('0x1c'),_0x7053('0x1c'))[_0x7053('0x37')]('NOW()','scheduledAt')['field']('id',_0x7053('0x32'))[_0x7053('0x37')](LISTID[_0x7053('0x39')](),_0x7053('0x33'))['field'](_0x495afb['id']['toString'](),_0x32990a)[_0x7053('0x37')](_0x7053('0x38'),'createdAt')[_0x7053('0x37')](_0x7053('0x38'),'updatedAt')[_0x7053('0x40')](_0x7053('0x3a'))[_0x7053('0x3b')]('deletedAt\x20IS\x20NULL')[_0x7053('0x3b')](_0x7053('0x3d'),LISTID[_0x7053('0x39')]())['where']('id\x20IN\x20?',squel[_0x7053('0x42')](hopperContacts))[_0x7053('0x3b')](_0x7053('0x3e')))['toString']();return _0x12dd58;}function _0x4214d1(_0x5b928a,_0x256c82){var _0x16826c=squel[_0x7053('0x2d')]()[_0x7053('0x2e')]('cm_hopper_black')[_0x7053('0x30')]([_0x7053('0x1c'),_0x7053('0x32'),_0x7053('0x33'),_0x256c82,'createdAt',_0x7053('0x35')],squel['select']()[_0x7053('0x37')](_0x7053('0x1c'),_0x7053('0x1c'))['field']('id',_0x7053('0x32'))[_0x7053('0x37')](LISTID[_0x7053('0x39')](),_0x7053('0x33'))[_0x7053('0x37')](_0x5b928a['id'][_0x7053('0x39')](),_0x256c82)[_0x7053('0x37')]('NOW()',_0x7053('0x34'))[_0x7053('0x37')](_0x7053('0x38'),'updatedAt')[_0x7053('0x40')](_0x7053('0x3a'))[_0x7053('0x3b')](_0x7053('0x3c'))[_0x7053('0x3b')](_0x7053('0x3d'),LISTID[_0x7053('0x39')]())[_0x7053('0x3b')](_0x7053('0x41'),squel[_0x7053('0x42')](hopperContacts))[_0x7053('0x3b')](_0x7053('0x3e')))[_0x7053('0x39')]();return _0x16826c;}return db[_0x7053('0x45')][_0x7053('0x46')]({'where':{'type':_0x7053('0x47')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x7053('0x48'),'where':{'id':LISTID}}]})['then'](function(_0x125022){var _0x40a8ba=[];if(_0x125022){var _0x351157;for(var _0x29fb7a=0x0,_0x47eacd;_0x29fb7a<_0x125022['length'];_0x29fb7a+=0x1){_0x47eacd=_0x125022[_0x29fb7a][_0x7053('0x49')]({'plain':!![]});switch(_0x47eacd[_0x7053('0x4a')]){case _0x7053('0x4b'):_0x40a8ba[_0x7053('0x27')](db['sequelize'][_0x7053('0x4c')](_0x157325(_0x47eacd,'VoiceQueueId'))[_0x7053('0x26')](function(){})[_0x7053('0x28')](_0x49af1f()));break;case _0x7053('0x4d'):_0x40a8ba['push'](db[_0x7053('0x4e')][_0x7053('0x4c')](_0x54e5d0(_0x47eacd,_0x7053('0x4f')))[_0x7053('0x26')](function(){})[_0x7053('0x28')](_0x49af1f()));break;default:_0x40a8ba[_0x7053('0x27')](db[_0x7053('0x4e')]['query'](_0x43f177(_0x47eacd,_0x7053('0x4f')))['then'](function(){})['catch'](_0x49af1f()));}}}return _0x40a8ba;})[_0x7053('0x50')]()[_0x7053('0x26')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x7053('0x47')},'attributes':['id'],'include':[{'model':db[_0x7053('0x51')],'as':_0x7053('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x5a569b){var _0x1875b0=[];if(_0x5a569b){var _0x4fe6c2;for(var _0x37affc=0x0,_0xbc94f6;_0x37affc<_0x5a569b['length'];_0x37affc+=0x1){_0xbc94f6=_0x5a569b[_0x37affc][_0x7053('0x49')]({'plain':!![]});_0x1875b0[_0x7053('0x27')](db[_0x7053('0x4e')][_0x7053('0x4c')](_0x4214d1(_0xbc94f6,_0x7053('0x4f')))[_0x7053('0x26')](function(){})[_0x7053('0x28')](_0x49af1f()));}}return _0x1875b0;})[_0x7053('0x50')]();})[_0x7053('0x26')](function(){return db[_0x7053('0x53')][_0x7053('0x46')]({'attributes':['id',_0x7053('0x4a')],'include':[{'model':db[_0x7053('0x51')],'as':_0x7053('0x48'),'where':{'id':LISTID}}]})['then'](function(_0x4bf007){var _0x15f0d2=[];if(_0x4bf007){for(var _0x10926b=0x0,_0x2de4e7;_0x10926b<_0x4bf007[_0x7053('0x17')];_0x10926b+=0x1){_0x2de4e7=_0x4bf007[_0x10926b][_0x7053('0x49')]({'plain':!![]});switch(_0x2de4e7['dialCheckDuplicateType']){case _0x7053('0x4b'):_0x15f0d2[_0x7053('0x27')](db[_0x7053('0x4e')][_0x7053('0x4c')](_0x157325(_0x2de4e7,_0x7053('0x54')))[_0x7053('0x26')](function(){})['catch'](_0x49af1f()));break;case'onlyIfOpen':_0x15f0d2[_0x7053('0x27')](db['sequelize'][_0x7053('0x4c')](_0x54e5d0(_0x2de4e7,_0x7053('0x54')))[_0x7053('0x26')](function(){})['catch'](_0x49af1f()));break;default:_0x15f0d2['push'](db[_0x7053('0x4e')]['query'](_0x43f177(_0x2de4e7,_0x7053('0x54')))[_0x7053('0x26')](function(){})[_0x7053('0x28')](_0x49af1f()));}}}return _0x15f0d2;})['all']();})['then'](function(){return db[_0x7053('0x53')][_0x7053('0x46')]({'attributes':['id'],'include':[{'model':db[_0x7053('0x51')],'as':_0x7053('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x27e8b0){var _0x2f12f2=[];if(_0x27e8b0){for(var _0x346907=0x0,_0x33c4d8;_0x346907<_0x27e8b0[_0x7053('0x17')];_0x346907+=0x1){_0x33c4d8=_0x27e8b0[_0x346907]['get']({'plain':!![]});_0x2f12f2['push'](db[_0x7053('0x4e')][_0x7053('0x4c')](_0x4214d1(_0x33c4d8,_0x7053('0x54')))[_0x7053('0x26')](function(){})[_0x7053('0x28')](_0x49af1f()));}}return _0x2f12f2;})[_0x7053('0x50')]();})[_0x7053('0x28')](function(_0x265bdb){logger[_0x7053('0x12')](_0x7053('0x55'),'generalCheckHopper',_0x265bdb[_0x7053('0x18')]);});}var processPromises=function(_0x56b1ec){return BPromise['all'](promises)[_0x7053('0x26')](function(_0x28e460){})[_0x7053('0x28')](function(_0x11e5e3){logger['error'](_0x7053('0x56'),JSON[_0x7053('0x57')](_0x11e5e3));})[_0x7053('0x58')](function(){socket[_0x7053('0x59')](_0x7053('0x5a')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x56b1ec){return _0x56b1ec[_0x7053('0x5b')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x7053('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0x7053('0x26')](function(){socket[_0x7053('0x59')](_0x7053('0x5a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x420c49){logger[_0x7053('0x12')](_0x7053('0x5c'),JSON['stringify'](_0x420c49));}finally{process[_0x7053('0x5d')](0x0);}});};process['on'](_0x7053('0x5e'),function(){logger[_0x7053('0x5f')](_0x7053('0x60'));endCsv();});function main(){return BPromise[_0x7053('0x61')]()[_0x7053('0x26')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7053('0x10')](',');return db[_0x7053('0x25')][_0x7053('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x54c8be){var _0x3ce71a=fs[_0x7053('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3ce71a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x366702,_0x300568){total+=0x1;var _0x4f61c7=total;promises[_0x7053('0x27')](checkRow(_0x366702,_0x54c8be,_0x4f61c7)[_0x7053('0x26')](function(){success+=0x1;})[_0x7053('0x28')](function(_0x60ed9f){if(_0x60ed9f[_0x7053('0x12')]){errors+=0x1;delete _0x60ed9f[_0x7053('0x12')];}else if(_0x60ed9f[_0x7053('0x23')]){duplicates+=0x1;delete _0x60ed9f[_0x7053('0x23')];}rows['push'](_0x60ed9f);}));if(total%0xc8===0x0){_0x300568['pause']();return processPromises(_0x300568);}},'complete':function(){return processPromises()[_0x7053('0x26')](function(){logger['info'](_0x7053('0x63'));endCsv();});},'error':function(_0x1a2247,_0xcd2075){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x1a2247));endCsv();}});})[_0x7053('0x28')](function(_0xabe046){logger['error'](_0x7053('0x64'),JSON[_0x7053('0x57')](_0xabe046));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e3ce59e..f87c33c 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 _0xacb6=['main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','data','rows','find','isNil','hasOwnProperty','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','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()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','join','where','\x20=\x20','CmContact','AdditionalPhones','then','length','push','split','all','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ContactId','ListId','fields','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','priority','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','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','code','message','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone'];(function(_0xe411c,_0xe6621c){var _0x39e413=function(_0x3fa658){while(--_0x3fa658){_0xe411c['push'](_0xe411c['shift']());}};_0x39e413(++_0xe6621c);}(_0xacb6,0x1c8));var _0x6acb=function(_0x219d24,_0x46c8db){_0x219d24=_0x219d24-0x0;var _0x47eda1=_0xacb6[_0x219d24];return _0x47eda1;};'use strict';var fs=require('fs');var path=require(_0x6acb('0x0'));var _=require(_0x6acb('0x1'));var Papa=require(_0x6acb('0x2'));var util=require(_0x6acb('0x3'));var BPromise=require(_0x6acb('0x4'));var moment=require(_0x6acb('0x5'));var squel=require(_0x6acb('0x6'));var Redis=require('ioredis');var db=require(_0x6acb('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x6acb('0x8'));var logger=require('../../../config/logger')('import');config[_0x6acb('0x9')]=_['defaults'](config[_0x6acb('0x9')],{'host':_0x6acb('0xa'),'port':0x18eb});var socket=require(_0x6acb('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6acb('0xc')](_0x6acb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6acb('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x47dc68){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'](_0x47dc68);}function selectNotIn(_0x59ff3c,_0x271ff5,_0x5c372c,_0x39cd2b,_0x522a77){return squel['select']()[_0x6acb('0xe')](_0x6acb('0xf'))[_0x6acb('0x10')](_0x39cd2b)[_0x6acb('0x11')](_0x271ff5,null,_0x271ff5+'.id\x20=\x20'+_0x39cd2b+'.'+_0x5c372c)[_0x6acb('0x12')](_0x39cd2b+'.'+_0x5c372c+_0x6acb('0x13')+_0x59ff3c+'.'+_0x5c372c)[_0x6acb('0x12')](_0x271ff5+'.dialCheckDuplicateType\x20IN\x20('+_0x522a77[_0x6acb('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4877f2,_0x36cdb9){promisesAdditionalPhones=[];return db[_0x6acb('0x14')]['findAll']({'raw':!![],'attributes':['id',_0x6acb('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6acb('0x16')](function(_0x4dc37a){if(_0x4dc37a!==null){var _0x4178f4=[];for(var _0x57d9b5=0x0;_0x57d9b5<_0x4dc37a[_0x6acb('0x17')];_0x57d9b5++){var _0x44f617=_0x4dc37a[_0x57d9b5];_0x4178f4[_0x6acb('0x18')](insertAdditionalPhones(_0x44f617));}}Promise['all'](_0x4178f4)[_0x6acb('0x16')](function(){_0x4877f2({'val':0x1});});});});}function insertAdditionalPhones(_0x407b11){return new Promise(function(_0x305100,_0x482602){var _0x2ca660=_0x407b11[_0x6acb('0x15')];var _0x2b14b3=_0x2ca660[_0x6acb('0x19')](';');var _0xe3b8bc=[];orderBy=0x0;for(var _0x317526=0x0;_0x317526<_0x2b14b3[_0x6acb('0x17')];_0x317526++){_0xe3b8bc['push'](splitAdditionalPhone(_0x407b11['id'],_0x2b14b3[_0x317526]));}Promise[_0x6acb('0x1a')](_0xe3b8bc)[_0x6acb('0x16')](function(){_0x305100({'val':_0x2b14b3[_0x6acb('0x17')]});});});}function splitAdditionalPhone(_0x542ba0,_0x3ca240){return new Promise(function(_0xc975c7,_0x16caae){var _0x4a7d60=_0x3ca240[_0x6acb('0x19')](':');var _0x234c29=_0x4a7d60[0x0];var _0x3db319=_0x4a7d60[0x1];if(!_['isNil'](_0x3db319)){var _0x128e88=_0x3db319[_0x6acb('0x19')]('|');var _0x3f3baf=[];for(var _0x12f7f7=0x0;_0x12f7f7<_0x128e88['length'];_0x12f7f7++){if(_0x128e88[_0x12f7f7]!==''){var _0x34dea1=_['filter'](promisesAdditionalPhones,{'contactId':_0x542ba0,'phone':_0x128e88[_0x12f7f7]});if(_0x34dea1[_0x6acb('0x17')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x542ba0,'contactTypeId':_0x234c29,'phone':_0x128e88[_0x12f7f7],'orderBy':orderBy});}}}_0xc975c7({'ok':0x1});}else _0xc975c7({'res':0x0});});}function createAdditionalPhone(_0x410072,_0x40d17b,_0x1dae83,_0x4c02fa){var _0x29b301='';var _0x5d93c0='';var _0x9e777c=_0x1dae83[_0x6acb('0x19')]('§');_0x29b301=_0x9e777c[0x0];if(_0x9e777c[_0x6acb('0x17')]==0x2)_0x5d93c0=_0x9e777c[0x1];return new Promise(function(_0x5702e8,_0x31148d){return db[_0x6acb('0x1b')][_0x6acb('0x1c')]({'where':{'CmContactId':_0x410072,'item':_0x29b301}})[_0x6acb('0x16')](function(_0x13a044){if(_0x13a044){return db['CmContactHasItem'][_0x6acb('0x1d')]({'ItemTypeId':_0x40d17b,'description':_0x5d93c0,'OrderBy':_0x4c02fa},{'where':{'CmContactId':_0x410072,'item':_0x29b301}})[_0x6acb('0x16')](function(_0x431547){_0x5702e8({'res':'updated'});});}else{return db[_0x6acb('0x1b')][_0x6acb('0x1e')]({'CmContactId':_0x410072,'item':_0x29b301,'description':_0x5d93c0,'ItemTypeId':_0x40d17b,'OrderBy':_0x4c02fa,'ItemClass':_0x6acb('0x1f')})[_0x6acb('0x16')](function(_0x4d7f2c){_0x5702e8({'res':_0x6acb('0x20')});});}});});}function insertCmHopper(_0x2035bd,_0x5f47fc,_0x541cd4,_0xd3fb5b,_0xd6aa74){var _0x70ccc1=[_0x6acb('0x21'),_0x6acb('0x22'),_0x6acb('0x23'),'cm_contacts.ListId',_0x5f47fc+'.'+_0xd3fb5b,_0x6acb('0x24'),_0x6acb('0x25'),'cm_contacts.priority',_0x6acb('0x26'),'\x22'+_0xd6aa74+'\x22'];return squel[_0x6acb('0x27')]()[_0x6acb('0x28')](_0x6acb('0x29'))[_0x6acb('0x2a')]([_0x6acb('0xf'),'scheduledat','ContactId','ListId',_0xd3fb5b,_0x6acb('0x2b'),_0x6acb('0x2c'),'priority',_0x6acb('0x2d'),_0x6acb('0x2e')],squel[_0x6acb('0x2f')]()['fields'](_0x70ccc1)['from'](_0x5f47fc)[_0x6acb('0x11')](_0x6acb('0x30'),null,_0x6acb('0x31')+_0x5f47fc+_0x6acb('0x32'))[_0x6acb('0x11')](_0x541cd4,null,_0x541cd4+'.id\x20=\x20'+_0x5f47fc+'.'+_0xd3fb5b)[_0x6acb('0x12')](_0x5f47fc+_0x6acb('0x33'),_0x2035bd)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6acb('0x12')](_0x6acb('0x34'),selectNotIn(_0x5f47fc,_0x541cd4,_0xd3fb5b,'cm_hopper',[_0x6acb('0x35'),_0x6acb('0x36')]))[_0x6acb('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5f47fc,_0x541cd4,_0xd3fb5b,_0x6acb('0x29'),[_0x6acb('0x35')])))[_0x6acb('0x37')]();}function insertCmHopperBlack(_0x104665,_0x2dfd26,_0xe4e2d,_0x1dfb5e){var _0x24a4b6=[_0x6acb('0x21'),_0x6acb('0x23'),'cm_contacts.ListId',_0x2dfd26+'.'+_0x1dfb5e,'cm_contacts.createdAt',_0x6acb('0x25')];return squel[_0x6acb('0x27')]()['into'](_0x6acb('0x38'))[_0x6acb('0x2a')]([_0x6acb('0xf'),_0x6acb('0x39'),_0x6acb('0x3a'),_0x1dfb5e,_0x6acb('0x2b'),'updatedAt'],squel[_0x6acb('0x2f')]()[_0x6acb('0x3b')](_0x24a4b6)[_0x6acb('0x10')](_0x2dfd26)[_0x6acb('0x11')](_0x6acb('0x30'),null,_0x6acb('0x31')+_0x2dfd26+_0x6acb('0x32'))[_0x6acb('0x11')](_0xe4e2d,null,_0xe4e2d+_0x6acb('0x3c')+_0x2dfd26+'.'+_0x1dfb5e)['where'](_0x2dfd26+_0x6acb('0x33'),_0x104665)[_0x6acb('0x12')](_0x6acb('0x3d'),NOW)[_0x6acb('0x12')](_0x6acb('0x34'),squel[_0x6acb('0x2f')]()[_0x6acb('0xe')](_0x6acb('0xf'))['from'](_0x6acb('0x38'))[_0x6acb('0x12')](_0x6acb('0x3e'),_0x104665)[_0x6acb('0x12')](_0x1dfb5e+'\x20=\x20'+_0x2dfd26+'.'+_0x1dfb5e)))[_0x6acb('0x37')]();}function insertTzCmHopper(_0x158bfa,_0x2bb665,_0x58f96d,_0x10849e,_0x5a9b39,_0x164d64){var _0x472ced=[_0x6acb('0x21'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x164d64+_0x6acb('0x3f'),'cm_contacts.id',_0x6acb('0x40'),_0x2bb665+'.'+_0x10849e,_0x6acb('0x24'),_0x6acb('0x25'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x5a9b39+'\x22'];var _0x4e5eaa=squel[_0x6acb('0x27')]()[_0x6acb('0x28')](_0x6acb('0x29'))[_0x6acb('0x2a')](['phone','scheduledat',_0x6acb('0x39'),'ListId',_0x10849e,'createdAt',_0x6acb('0x2c'),_0x6acb('0x41'),_0x6acb('0x2d'),'recallme'],squel[_0x6acb('0x2f')]()['fields'](_0x472ced)[_0x6acb('0x10')](_0x2bb665)[_0x6acb('0x11')](_0x6acb('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x2bb665+'.CmListId')[_0x6acb('0x11')](_0x58f96d,null,_0x58f96d+_0x6acb('0x3c')+_0x2bb665+'.'+_0x10849e)[_0x6acb('0x11')](_0x164d64,null,_0x164d64+_0x6acb('0x3c')+_0x2bb665+'.'+_0x10849e)[_0x6acb('0x12')](_0x2bb665+_0x6acb('0x33'),_0x158bfa)[_0x6acb('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6acb('0x12')](_0x6acb('0x34'),selectNotIn(_0x2bb665,_0x58f96d,_0x10849e,_0x6acb('0x29'),[_0x6acb('0x35'),_0x6acb('0x36')]))['where'](_0x6acb('0x34'),selectNotIn(_0x2bb665,_0x58f96d,_0x10849e,_0x6acb('0x29'),[_0x6acb('0x35')])))[_0x6acb('0x37')]();return _0x4e5eaa;}function insertTzCmHopperBlack(_0x38419a,_0x3c93d9,_0x1bfbfe,_0xa7eeaa){var _0x3b4549=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x3c93d9+'.'+_0xa7eeaa,_0x6acb('0x24'),'cm_contacts.updatedAt'];return squel['insert']()[_0x6acb('0x28')](_0x6acb('0x38'))['fromQuery'](['phone',_0x6acb('0x39'),_0x6acb('0x3a'),_0xa7eeaa,_0x6acb('0x2b'),'updatedAt'],squel[_0x6acb('0x2f')]()[_0x6acb('0x3b')](_0x3b4549)[_0x6acb('0x10')](_0x3c93d9)['join'](_0x6acb('0x30'),null,_0x6acb('0x31')+_0x3c93d9+_0x6acb('0x32'))[_0x6acb('0x11')](_0x1bfbfe,null,_0x1bfbfe+_0x6acb('0x3c')+_0x3c93d9+'.'+_0xa7eeaa)['where'](_0x3c93d9+'.CmListId\x20=\x20?',_0x38419a)[_0x6acb('0x12')](_0x6acb('0x3d'),NOW)['where'](_0x6acb('0x34'),squel['select']()[_0x6acb('0xe')](_0x6acb('0xf'))['from'](_0x6acb('0x38'))[_0x6acb('0x12')](_0x6acb('0x3e'),_0x38419a)[_0x6acb('0x12')](_0xa7eeaa+_0x6acb('0x13')+_0x3c93d9+'.'+_0xa7eeaa)))[_0x6acb('0x37')]();}function insertCmHopperAdditionalPhones(_0xb28adb){var _0x50b861=['cm_hopper.id',_0x6acb('0x42'),_0x6acb('0x43'),_0x6acb('0x44'),_0x6acb('0x45')];return squel[_0x6acb('0x27')]()[_0x6acb('0x28')](_0x6acb('0x46'))['fromQuery']([_0x6acb('0x47'),'phone',_0x6acb('0x48'),_0x6acb('0x2b'),_0x6acb('0x2c')],squel['select']()[_0x6acb('0x3b')](_0x50b861)[_0x6acb('0x10')](_0x6acb('0x29'))['join']('cm_contacts',null,_0x6acb('0x49'))['join'](_0x6acb('0x4a'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6acb('0x12')](_0x6acb('0x4b'),_0xb28adb)['where'](_0x6acb('0x3d'),NOW))['toString']();}function insertCmContact(_0x5d7a2c,_0x2ef6f7,_0x587afb,_0x1f5997){var _0x379e78=_[_0x6acb('0x4c')](_[_0x6acb('0x4d')](_0x1f5997),['ListId',_0x6acb('0x4e'),_0x6acb('0x2b'),'updatedAt',_0x6acb('0x4f')]);return squel[_0x6acb('0x27')]()[_0x6acb('0x28')](_0x6acb('0x30'))['fromQuery'](_0x379e78,squel[_0x6acb('0x2f')]()[_0x6acb('0x3b')](_0x379e78)[_0x6acb('0x10')](_0x2ef6f7)[_0x6acb('0x12')]('('+_0x587afb['join'](',')+_0x6acb('0x50'),squel[_0x6acb('0x2f')]()[_0x6acb('0x3b')](_0x587afb)[_0x6acb('0x10')](_0x6acb('0x30'))[_0x6acb('0x12')](_0x6acb('0x3e'),_0x5d7a2c)[_0x6acb('0x12')](_0x6acb('0x51')))[_0x6acb('0x12')](_0x6acb('0x52'),squel[_0x6acb('0x2f')]()[_0x6acb('0xe')](_0x6acb('0x53'),_0x6acb('0x54'))[_0x6acb('0x10')](_0x2ef6f7)[_0x6acb('0x55')](_0x587afb['join'](','))))['toString']();}function handleStop(){logger[_0x6acb('0x56')](_0x6acb('0x57'));stopped=!![];}function handleUncaughtException(_0x3b58d6){logger[_0x6acb('0x58')](_0x3b58d6['message']);process[_0x6acb('0x59')](0x1);}function handleError(_0x36a8ca,_0x4b2469){stats[_0x6acb('0x5a')][_0x6acb('0x18')]({'name':_0x4b2469[_0x6acb('0x5b')],'message':_0x4b2469[_0x6acb('0x5c')],'row':_0x36a8ca});}function handleQuery(_0x32c225){logger[_0x6acb('0x56')](_0x32c225);return db[_0x6acb('0x5d')]['query'](_0x32c225)[_0x6acb('0x5e')](function(_0x2d3bbc){results[_0x6acb('0x18')](_0x2d3bbc);})[_0x6acb('0x5f')](function(_0x37ce61){logger[_0x6acb('0x58')](_0x37ce61[_0x6acb('0x5c')]);});}function updateTzCampaigns(_0x2eaca6){return new Promise(function(_0x7be535,_0x9a2d53){var _0x40c013=squel[_0x6acb('0x2f')]()[_0x6acb('0x3b')]([_0x6acb('0x60'),_0x6acb('0x61')])[_0x6acb('0x10')]('campaigns')[_0x6acb('0x11')](_0x6acb('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x6acb('0x12')](_0x6acb('0x63')+_0x2eaca6);db[_0x6acb('0x5d')][_0x6acb('0x64')](_0x40c013[_0x6acb('0x37')]())[_0x6acb('0x5e')](function(_0x428c92){var _0x1a87bf=[];for(var _0x43d97f=0x0;_0x43d97f<_0x428c92[_0x6acb('0x17')];_0x43d97f++){_0x1a87bf[_0x6acb('0x18')](getTimezoneData(_0x428c92[_0x43d97f],tmp_campaigns));}BPromise[_0x6acb('0x1a')](_0x1a87bf)[_0x6acb('0x16')](function(){_0x7be535({'val':0x1});});})[_0x6acb('0x5f')](function(_0x1d73a7){logger[_0x6acb('0x58')](_0x1d73a7[_0x6acb('0x5c')]);_0x7be535({'val':0x0});});});}function updateTzVoiceQueues(_0x5ea153){return new Promise(function(_0x5c4d02,_0x2ad5bd){var _0x10f54f=squel[_0x6acb('0x2f')]()[_0x6acb('0x3b')]([_0x6acb('0x65'),_0x6acb('0x66')])[_0x6acb('0x10')](_0x6acb('0x67'))['join']('voice_queues_has_cm_lists',null,_0x6acb('0x68'))[_0x6acb('0x12')](_0x6acb('0x69')+_0x5ea153);db[_0x6acb('0x5d')][_0x6acb('0x64')](_0x10f54f[_0x6acb('0x37')]())['spread'](function(_0x5e99c7){var _0x2dd20f=[];for(var _0x2bff82=0x0;_0x2bff82<_0x5e99c7[_0x6acb('0x17')];_0x2bff82++){_0x2dd20f['push'](getTimezoneData(_0x5e99c7[_0x2bff82],tmp_voice_queues));}BPromise['all'](_0x2dd20f)[_0x6acb('0x16')](function(){_0x5c4d02({'val':0x1});});})[_0x6acb('0x5f')](function(_0x26d40){logger[_0x6acb('0x58')](_0x26d40[_0x6acb('0x5c')]);_0x5c4d02({'val':0x0});});});}function getTimezoneData(_0x567952,_0x567ce5){return new Promise(function(_0x578c3e,_0xdac5f4){var _0x341262=shared[_0x6acb('0x6a')];var _0x2b89be=_0x341262[_0x567952['dialTimezone']];if(_['isNil'](_0x2b89be)){_0x578c3e({'ret':0x1});}else{var _0x29d55c=_0x2b89be[_0x6acb('0x6b')];var _0x5ca004=squel[_0x6acb('0x27')]()[_0x6acb('0x28')](_0x567ce5)[_0x6acb('0x6c')]('id',_0x567952['id'])['set'](_0x6acb('0x6d'),_0x29d55c)[_0x6acb('0x6c')](_0x6acb('0x6e'),_0x567952[_0x6acb('0x6e')])['toString']();return db[_0x6acb('0x5d')]['query'](_0x5ca004)[_0x6acb('0x5e')](function(_0x568ca2){_0x578c3e({'ret':0x1});})[_0x6acb('0x5f')](function(_0x4000a2){logger['error'](_0x4000a2[_0x6acb('0x5c')]);_0xdac5f4({'ret':0x1});});}});}function handleTZQuery(_0x3a35a8){logger['info'](_0x3a35a8);return db[_0x6acb('0x5d')][_0x6acb('0x64')](_0x3a35a8)['spread'](function(_0x244432){})['catch'](function(_0xf52332){logger['error'](_0xf52332[_0x6acb('0x5c')]);});}function main(_0x274c3e,_0xc04dc0,_0x3182db,_0x46bd31){logger[_0x6acb('0x56')](_0x6acb('0x6f'),_0x274c3e,JSON[_0x6acb('0x70')](_0xc04dc0));process[_0x6acb('0x71')](_0x6acb('0x72'));var _0x52a8d9=_0xc04dc0[_0x6acb('0x73')];var _0x26d099=_[_0x6acb('0x74')](_0x52a8d9);var _0x1ab382=_0xc04dc0[_0x6acb('0x75')];var _0x1f48ef=path['join'](config[_0x6acb('0x76')],_0x6acb('0x77'),_0x1ab382+_0x6acb('0x78'));hasTZ=_[_0x6acb('0x4d')](_0x52a8d9)[_0x6acb('0x79')](_0x6acb('0x6e'));var _0x475dd4=_['keys'](_0x52a8d9)[_0x6acb('0x11')]();logger[_0x6acb('0x56')](_0x6acb('0x7a'),_0x475dd4);db[_0x6acb('0x7b')]['findAll']({'raw':!![],'attributes':['id',_0x6acb('0x7c')]})[_0x6acb('0x16')](function(_0x97a1a8){for(var _0x21fc3b=0x0;_0x21fc3b<_0x97a1a8['length'];_0x21fc3b++){if(_0x97a1a8[_0x21fc3b]['name']in _0x52a8d9){contactItemTypes['push'](_0x97a1a8[_0x21fc3b]);delete _0x26d099[_0x97a1a8[_0x21fc3b][_0x6acb('0x7c')]];hasAdditionalPhones=!![];}for(var _0x4ee1fd in _0x52a8d9){if(_0x97a1a8[_0x21fc3b]['name']+_0x6acb('0x7d')===_0x4ee1fd){phoneDescriptions[_0x6acb('0x18')]({'itemTypeId':_0x97a1a8[_0x21fc3b]['id'],'description':_0x4ee1fd});delete _0x26d099[_0x4ee1fd];}}}if(hasAdditionalPhones)_0x26d099[_0x6acb('0x15')]='';var _0x26a52a=_[_0x6acb('0x4d')](_0x26d099)[_0x6acb('0x11')]();logger['info']('header',_0x26a52a);fs[_0x6acb('0x7e')](_0x1f48ef,_0x26a52a+'\x0a');Papa[_0x6acb('0x7f')](fs['createReadStream'](_0x274c3e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5be292,_0x238779){try{for(var _0xc8b971=0x0,_0x16b73e=[];_0xc8b971<_0x5be292[_0x6acb('0x80')][_0x6acb('0x17')];_0xc8b971++){stats[_0x6acb('0x81')]+=0x1;if(_0x5be292[_0x6acb('0x5a')][_0xc8b971]){handleError(_0x5be292[_0x6acb('0x80')][_0xc8b971],_0x5be292[_0x6acb('0x5a')][_0xc8b971]);}else{var _0x3f4918=[];var _0x47e09d=[];var _0x46a440={};for(var _0x1301ed in _0x52a8d9){let _0xa6d3c8=contactItemTypes[_0x6acb('0x82')](_0x485d09=>_0x485d09[_0x6acb('0x7c')]===_0x1301ed);let _0x5ebda9=contactItemTypes[_0x6acb('0x82')](_0x305a37=>_0x305a37[_0x6acb('0x7c')]+'_description'===_0x1301ed);if(_[_0x6acb('0x83')](_0xa6d3c8)&&_[_0x6acb('0x83')](_0x5ebda9)){if(_0x52a8d9[_0x6acb('0x84')](_0x1301ed)){if(_0x5be292[_0x6acb('0x80')][_0xc8b971][_0x52a8d9[_0x1301ed]]){var _0x397d31=_[_0x6acb('0x85')](_0x5be292[_0x6acb('0x80')][_0xc8b971][_0x52a8d9[_0x1301ed]][_0x6acb('0x86')](/"/g,'\x27'));switch(_0x1301ed){case _0x6acb('0x87'):var _0x33dfb0=moment(_0x397d31,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x33dfb0['isValid']()){_0x16b73e['push']('\x22'+_0x397d31+'\x22');}else{_0x3f4918['push'](_0x6acb('0x88'));}break;case _0x6acb('0x41'):var _0x4ebdba=parseInt(_0x397d31);_0x397d31=_[_0x6acb('0x89')](_0x4ebdba)||_0x4ebdba<0x0||_0x4ebdba>0x4?_0x46bd31?0x3:0x2:_0x4ebdba;_0x16b73e[_0x6acb('0x18')]('\x22'+_0x397d31+'\x22');break;case'UserId':var _0x559ec3=parseInt(_0x397d31);if(_[_0x6acb('0x8a')](_0x559ec3)&&_[_0x6acb('0x79')](_0x3182db,_0x559ec3)){_0x16b73e[_0x6acb('0x18')]('\x22'+_0x559ec3+'\x22');}else{_0x3f4918[_0x6acb('0x18')](_0x6acb('0x8b'));}break;case _0x6acb('0x8c'):if(isEmail(_0x397d31)){_0x16b73e[_0x6acb('0x18')]('\x22'+_0x397d31+'\x22');}else{_0x3f4918[_0x6acb('0x18')](_0x6acb('0x8d'));}break;case _0x6acb('0x8e'):var _0x4380aa=moment(_0x397d31,_0x6acb('0x8f'),!![]);if(_0x4380aa[_0x6acb('0x90')]()){_0x16b73e[_0x6acb('0x18')]('\x22'+_0x397d31+'\x22');}else{_0x3f4918[_0x6acb('0x18')](_0x6acb('0x91'));}break;case _0x6acb('0x6e'):var _0x375b71=shared[_0x6acb('0x6a')];var _0x32c7e8=_0x375b71[_0x397d31];if(!_[_0x6acb('0x83')](_0x32c7e8)){var _0x2d67ce=_0x32c7e8['utcOffset'];_0x16b73e[_0x6acb('0x18')]('\x22'+_0x397d31+'\x22');_0x16b73e[_0x6acb('0x18')]('\x22'+_0x2d67ce+'\x22');}break;default:_0x16b73e[_0x6acb('0x18')]('\x22'+_0x397d31+'\x22');}}else{switch(_0x1301ed){case _0x6acb('0x92'):case _0x6acb('0xf'):_0x3f4918[_0x6acb('0x18')](_0x1301ed+'\x20not\x20specified');break;default:_0x16b73e['push']('\x22\x22');}}}}else{var _0xa6609b='';if(!_[_0x6acb('0x83')](_0xa6d3c8)){if(!_0x46a440[_0x6acb('0x84')](_0xa6d3c8['id'])){if(!_[_0x6acb('0x83')](_0x5be292[_0x6acb('0x80')][_0xc8b971][_0x52a8d9[_0x1301ed]])){var _0x397d31=_[_0x6acb('0x85')](_0x5be292[_0x6acb('0x80')][_0xc8b971][_0x52a8d9[_0x1301ed]][_0x6acb('0x86')](/"/g,'\x27'));var _0x414744=phoneDescriptions[_0x6acb('0x82')](_0x26f0dc=>_0x26f0dc[_0x6acb('0x93')]===_0xa6d3c8['id']);if(!_[_0x6acb('0x83')](_0x414744)){var _0x160879=_[_0x6acb('0x85')](_0x5be292[_0x6acb('0x80')][_0xc8b971][_0x52a8d9[_0x414744['description']]][_0x6acb('0x86')](/"/g,'\x27'));if(!_['isNil'](_0x160879))_0x397d31=_0x397d31+'§'+_0x160879;}if(_0xa6609b=='')_0xa6609b=_0x397d31;else _0xa6609b+='|'+_0x397d31;}_0x47e09d[_0x6acb('0x18')](_0xa6d3c8['id']+':'+_0xa6609b);_0x46a440[_0xa6d3c8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x16b73e[_0x6acb('0x18')]('\x22'+_0x47e09d[_0x6acb('0x11')](';')+'\x22');}if(_0x3f4918[_0x6acb('0x17')]){handleError(_0x5be292[_0x6acb('0x80')][_0xc8b971],{'code':_0x6acb('0x94'),'message':_0x3f4918[_0x6acb('0x11')]()});}else{fs['appendFileSync'](_0x1f48ef,_0x16b73e[_0x6acb('0x11')]()+'\x0a');}_0x16b73e=[];}if(!(stats[_0x6acb('0x81')]%0xc8)){socket[_0x6acb('0x95')](_0x6acb('0x96')+_0x1ab382,stats);stats[_0x6acb('0x5a')]=[];}}if(stopped){logger['info'](_0x6acb('0x97'));_0x238779[_0x6acb('0x98')]();}}catch(_0x4cdef9){handleError(_0x5be292[_0x6acb('0x80')][_0xc8b971],{'code':_0x6acb('0x99'),'message':_0x4cdef9['message']});logger['error']('step',_0x4cdef9[_0x6acb('0x5c')]);}},'complete':function(){try{var _0x27bb28=[];var _0x3f8b7f=[];var _0x1b21df='cm_contacts';if(_0xc04dc0[_0x6acb('0x9a')]&&_0xc04dc0[_0x6acb('0x9a')][_0x6acb('0x17')]){_0x1b21df=_0x6acb('0x9b')+_0x1ab382;_0x27bb28['push'](_0x6acb('0x9c')+_0x1b21df+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x6acb('0x9d')+_0x1ab382;tmp_voice_queues=_0x6acb('0x9e')+_0x1ab382;_0x3f8b7f[_0x6acb('0x18')](_0x6acb('0x9c')+tmp_campaigns+_0x6acb('0x9f'));_0x3f8b7f[_0x6acb('0x18')](_0x6acb('0x9c')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x3f8b7f,handleTZQuery)[_0x6acb('0x16')](function(_0x11cdab){updateTzCampaigns(_0xc04dc0[_0x6acb('0x3a')])[_0x6acb('0x16')](function(_0x4ced01){updateTzVoiceQueues(_0xc04dc0['ListId'])[_0x6acb('0x16')](function(_0x510ab5){if(hasTZ)_0x26a52a=_0x26a52a['replace'](_0x6acb('0x6e'),'dialTimezone,utcOffset');var _0x416351=util[_0x6acb('0xc')](_0x6acb('0xa0'),_0x1f48ef,_0x1b21df,_0x26a52a,_0xc04dc0['ListId'],_0xc04dc0['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x52a8d9[_0x6acb('0x87')])){_0x416351+=_0x6acb('0xa1');}_0x27bb28[_0x6acb('0x18')](_0x416351);if(_0xc04dc0[_0x6acb('0x9a')]&&_0xc04dc0[_0x6acb('0x9a')][_0x6acb('0x17')]){_0x27bb28['push'](insertCmContact(_0xc04dc0[_0x6acb('0x3a')],_0x1b21df,_0xc04dc0['duplicates'],_0x52a8d9));_0x27bb28[_0x6acb('0x18')](_0x6acb('0xa2')+_0x1b21df+';');}BPromise[_0x6acb('0xa3')](_0x27bb28,handleQuery)[_0x6acb('0x16')](function(_0x3bf7cd){BPromise[_0x6acb('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x27bb28=[];for(var _0x5a4672=0x0;_0x5a4672\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0df4,0xac));var _0x40df=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x0df4[_0x4709c0];return _0x13348b;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x40df('0x0'));var Papa=require(_0x40df('0x1'));var util=require(_0x40df('0x2'));var BPromise=require(_0x40df('0x3'));var moment=require(_0x40df('0x4'));var squel=require(_0x40df('0x5'));var Redis=require('ioredis');var db=require(_0x40df('0x6'))['db'];var config=require(_0x40df('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x40df('0x8'))('import');config[_0x40df('0x9')]=_[_0x40df('0xa')](config['redis'],{'host':_0x40df('0xb'),'port':0x18eb});var socket=require(_0x40df('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x40df('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x40df('0xd')](_0x40df('0xe'));function isEmail(_0x2b057d){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))*$/[_0x40df('0xf')](_0x2b057d);}function selectNotIn(_0x51fdaf,_0x58a78d,_0xcd34ae,_0x5e295a,_0x3fd5d9){return squel[_0x40df('0x10')]()[_0x40df('0x11')]('phone')[_0x40df('0x12')](_0x5e295a)['join'](_0x58a78d,null,_0x58a78d+_0x40df('0x13')+_0x5e295a+'.'+_0xcd34ae)[_0x40df('0x14')](_0x5e295a+'.'+_0xcd34ae+_0x40df('0x15')+_0x51fdaf+'.'+_0xcd34ae)[_0x40df('0x14')](_0x58a78d+'.dialCheckDuplicateType\x20IN\x20('+_0x3fd5d9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x581bdc,_0x4703b5){promisesAdditionalPhones=[];return db['CmContact'][_0x40df('0x16')]({'raw':!![],'attributes':['id',_0x40df('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x40df('0x18')](function(_0xf2e3e7){if(_0xf2e3e7!==null){var _0x182c36=[];for(var _0x173a10=0x0;_0x173a10<_0xf2e3e7[_0x40df('0x19')];_0x173a10++){var _0x2af89f=_0xf2e3e7[_0x173a10];_0x182c36[_0x40df('0x1a')](insertAdditionalPhones(_0x2af89f));}}Promise['all'](_0x182c36)[_0x40df('0x18')](function(){_0x581bdc({'val':0x1});});});});}function insertAdditionalPhones(_0x19fbe8){return new Promise(function(_0x4a2df7,_0x188f66){var _0x3a0ceb=_0x19fbe8[_0x40df('0x17')];var _0x50ca58=_0x3a0ceb[_0x40df('0x1b')](';');var _0x1f32e0=[];orderBy=0x0;for(var _0x4d5317=0x0;_0x4d5317<_0x50ca58[_0x40df('0x19')];_0x4d5317++){_0x1f32e0[_0x40df('0x1a')](splitAdditionalPhone(_0x19fbe8['id'],_0x50ca58[_0x4d5317]));}Promise['all'](_0x1f32e0)[_0x40df('0x18')](function(){_0x4a2df7({'val':_0x50ca58[_0x40df('0x19')]});});});}function splitAdditionalPhone(_0x6e6863,_0x16cdaf){return new Promise(function(_0x505208,_0x2f3a7e){var _0xa0b18b=_0x16cdaf[_0x40df('0x1b')](':');var _0x1a0a54=_0xa0b18b[0x0];var _0x18db04=_0xa0b18b[0x1];if(!_['isNil'](_0x18db04)){var _0x4a99e2=_0x18db04[_0x40df('0x1b')]('|');var _0x267679=[];for(var _0x57026d=0x0;_0x57026d<_0x4a99e2['length'];_0x57026d++){if(_0x4a99e2[_0x57026d]!==''){var _0x26c586=_[_0x40df('0x1c')](promisesAdditionalPhones,{'contactId':_0x6e6863,'phone':_0x4a99e2[_0x57026d]});if(_0x26c586[_0x40df('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x40df('0x1a')]({'contactId':_0x6e6863,'contactTypeId':_0x1a0a54,'phone':_0x4a99e2[_0x57026d],'orderBy':orderBy});}}}_0x505208({'ok':0x1});}else _0x505208({'res':0x0});});}function createAdditionalPhone(_0x474448,_0xb7d9e6,_0x1df99d,_0x33a14f){var _0x5e3f71='';var _0x21539c='';var _0x515706=_0x1df99d[_0x40df('0x1b')]('§');_0x5e3f71=_0x515706[0x0];if(_0x515706[_0x40df('0x19')]==0x2)_0x21539c=_0x515706[0x1];return new Promise(function(_0x4bc890,_0x2bf179){return db[_0x40df('0x1d')][_0x40df('0x1e')]({'where':{'CmContactId':_0x474448,'item':_0x5e3f71}})['then'](function(_0x1d049c){if(_0x1d049c){return db[_0x40df('0x1d')][_0x40df('0x1f')]({'ItemTypeId':_0xb7d9e6,'description':_0x21539c,'OrderBy':_0x33a14f},{'where':{'CmContactId':_0x474448,'item':_0x5e3f71}})[_0x40df('0x18')](function(_0x3c2da9){_0x4bc890({'res':_0x40df('0x20')});});}else{return db[_0x40df('0x1d')][_0x40df('0x21')]({'CmContactId':_0x474448,'item':_0x5e3f71,'description':_0x21539c,'ItemTypeId':_0xb7d9e6,'OrderBy':_0x33a14f,'ItemClass':'PHONE'})[_0x40df('0x18')](function(_0x31754c){_0x4bc890({'res':_0x40df('0x22')});});}});});}function insertCmHopper(_0xa2c2e6,_0x37009e,_0x30069a,_0x350319,_0x529dbc){var _0x2fc98a=[_0x40df('0x23'),_0x40df('0x24'),_0x40df('0x25'),_0x40df('0x26'),_0x37009e+'.'+_0x350319,_0x40df('0x27'),_0x40df('0x28'),_0x40df('0x29'),_0x40df('0x2a'),'\x22'+_0x529dbc+'\x22'];return squel['insert']()[_0x40df('0x2b')](_0x40df('0x2c'))[_0x40df('0x2d')](['phone',_0x40df('0x2e'),_0x40df('0x2f'),_0x40df('0x30'),_0x350319,_0x40df('0x31'),_0x40df('0x32'),_0x40df('0x33'),_0x40df('0x34'),_0x40df('0x35')],squel[_0x40df('0x10')]()[_0x40df('0x36')](_0x2fc98a)[_0x40df('0x12')](_0x37009e)[_0x40df('0x37')](_0x40df('0x38'),null,_0x40df('0x39')+_0x37009e+'.CmListId')[_0x40df('0x37')](_0x30069a,null,_0x30069a+'.id\x20=\x20'+_0x37009e+'.'+_0x350319)[_0x40df('0x14')](_0x37009e+_0x40df('0x3a'),_0xa2c2e6)[_0x40df('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x40df('0x14')](_0x40df('0x3b'),selectNotIn(_0x37009e,_0x30069a,_0x350319,_0x40df('0x2c'),[_0x40df('0x3c'),_0x40df('0x3d')]))[_0x40df('0x14')](_0x40df('0x3b'),selectNotIn(_0x37009e,_0x30069a,_0x350319,_0x40df('0x2c'),['\x22always\x22'])))[_0x40df('0x3e')]();}function insertCmHopperBlack(_0x2b307a,_0xf35db6,_0x347afa,_0xd6392f){var _0x1822f7=['cm_contacts.phone','cm_contacts.id',_0x40df('0x26'),_0xf35db6+'.'+_0xd6392f,_0x40df('0x27'),_0x40df('0x28')];return squel[_0x40df('0x3f')]()[_0x40df('0x2b')](_0x40df('0x40'))['fromQuery'](['phone','ContactId','ListId',_0xd6392f,_0x40df('0x31'),'updatedAt'],squel['select']()['fields'](_0x1822f7)['from'](_0xf35db6)['join'](_0x40df('0x38'),null,_0x40df('0x39')+_0xf35db6+_0x40df('0x41'))[_0x40df('0x37')](_0x347afa,null,_0x347afa+_0x40df('0x13')+_0xf35db6+'.'+_0xd6392f)[_0x40df('0x14')](_0xf35db6+_0x40df('0x3a'),_0x2b307a)[_0x40df('0x14')](_0x40df('0x42'),NOW)[_0x40df('0x14')](_0x40df('0x3b'),squel[_0x40df('0x10')]()[_0x40df('0x11')](_0x40df('0x43'))[_0x40df('0x12')]('cm_hopper_black')[_0x40df('0x14')]('ListId\x20=\x20?',_0x2b307a)[_0x40df('0x14')](_0xd6392f+_0x40df('0x15')+_0xf35db6+'.'+_0xd6392f)))[_0x40df('0x3e')]();}function insertTzCmHopper(_0x520356,_0x491b61,_0x5d87d9,_0x5a5264,_0x175b1d,_0xaf771e){var _0x1cecd2=[_0x40df('0x23'),_0x40df('0x44')+_0xaf771e+'.offset-cm_contacts.utcOffset\x20minute)',_0x40df('0x25'),_0x40df('0x26'),_0x491b61+'.'+_0x5a5264,_0x40df('0x27'),_0x40df('0x28'),_0x40df('0x29'),_0x40df('0x2a'),'\x22'+_0x175b1d+'\x22'];var _0x39063b=squel[_0x40df('0x3f')]()[_0x40df('0x2b')](_0x40df('0x2c'))[_0x40df('0x2d')]([_0x40df('0x43'),_0x40df('0x2e'),_0x40df('0x2f'),_0x40df('0x30'),_0x5a5264,_0x40df('0x31'),_0x40df('0x32'),_0x40df('0x33'),_0x40df('0x34'),_0x40df('0x35')],squel[_0x40df('0x10')]()[_0x40df('0x36')](_0x1cecd2)[_0x40df('0x12')](_0x491b61)[_0x40df('0x37')](_0x40df('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x491b61+'.CmListId')[_0x40df('0x37')](_0x5d87d9,null,_0x5d87d9+_0x40df('0x13')+_0x491b61+'.'+_0x5a5264)['join'](_0xaf771e,null,_0xaf771e+_0x40df('0x13')+_0x491b61+'.'+_0x5a5264)[_0x40df('0x14')](_0x491b61+'.CmListId\x20=\x20?',_0x520356)[_0x40df('0x14')](_0x40df('0x42'),NOW)[_0x40df('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x491b61,_0x5d87d9,_0x5a5264,_0x40df('0x2c'),['\x22always\x22',_0x40df('0x3d')]))[_0x40df('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x491b61,_0x5d87d9,_0x5a5264,_0x40df('0x2c'),[_0x40df('0x3c')])))[_0x40df('0x3e')]();return _0x39063b;}function insertTzCmHopperBlack(_0x25a1e0,_0x35d4a3,_0x5e3b89,_0x415a08){var _0x81b51d=[_0x40df('0x23'),_0x40df('0x25'),_0x40df('0x26'),_0x35d4a3+'.'+_0x415a08,_0x40df('0x27'),_0x40df('0x28')];return squel[_0x40df('0x3f')]()[_0x40df('0x2b')](_0x40df('0x40'))[_0x40df('0x2d')]([_0x40df('0x43'),_0x40df('0x2f'),_0x40df('0x30'),_0x415a08,_0x40df('0x31'),_0x40df('0x32')],squel['select']()[_0x40df('0x36')](_0x81b51d)[_0x40df('0x12')](_0x35d4a3)[_0x40df('0x37')](_0x40df('0x38'),null,_0x40df('0x39')+_0x35d4a3+'.CmListId')[_0x40df('0x37')](_0x5e3b89,null,_0x5e3b89+_0x40df('0x13')+_0x35d4a3+'.'+_0x415a08)[_0x40df('0x14')](_0x35d4a3+_0x40df('0x3a'),_0x25a1e0)[_0x40df('0x14')](_0x40df('0x42'),NOW)[_0x40df('0x14')](_0x40df('0x3b'),squel[_0x40df('0x10')]()[_0x40df('0x11')](_0x40df('0x43'))[_0x40df('0x12')](_0x40df('0x40'))[_0x40df('0x14')]('ListId\x20=\x20?',_0x25a1e0)[_0x40df('0x14')](_0x415a08+'\x20=\x20'+_0x35d4a3+'.'+_0x415a08)))['toString']();}function insertCmHopperAdditionalPhones(_0x5a2672){var _0x188c69=[_0x40df('0x45'),_0x40df('0x46'),_0x40df('0x47'),_0x40df('0x48'),_0x40df('0x49')];return squel['insert']()[_0x40df('0x2b')]('cm_hopper_additional_phones')[_0x40df('0x2d')]([_0x40df('0x4a'),_0x40df('0x43'),_0x40df('0x4b'),_0x40df('0x31'),'updatedAt'],squel[_0x40df('0x10')]()[_0x40df('0x36')](_0x188c69)[_0x40df('0x12')](_0x40df('0x2c'))['join'](_0x40df('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x40df('0x37')](_0x40df('0x4c'),null,_0x40df('0x4d'))[_0x40df('0x14')]('cm_hopper.ListId\x20=\x20?',_0x5a2672)['where'](_0x40df('0x42'),NOW))[_0x40df('0x3e')]();}function insertCmContact(_0x1e934b,_0x194fbb,_0x27e2f1,_0x31166f){var _0x330d97=_[_0x40df('0x4e')](_[_0x40df('0x4f')](_0x31166f),['ListId',_0x40df('0x50'),_0x40df('0x31'),_0x40df('0x32'),'scheduledAt']);return squel[_0x40df('0x3f')]()[_0x40df('0x2b')]('cm_contacts')[_0x40df('0x2d')](_0x330d97,squel[_0x40df('0x10')]()['fields'](_0x330d97)[_0x40df('0x12')](_0x194fbb)['where']('('+_0x27e2f1[_0x40df('0x37')](',')+')\x20NOT\x20IN\x20?',squel[_0x40df('0x10')]()['fields'](_0x27e2f1)[_0x40df('0x12')](_0x40df('0x38'))['where'](_0x40df('0x51'),_0x1e934b)[_0x40df('0x14')](_0x40df('0x52')))[_0x40df('0x14')](_0x40df('0x53'),squel[_0x40df('0x10')]()['field'](_0x40df('0x54'),_0x40df('0x55'))['from'](_0x194fbb)[_0x40df('0x56')](_0x27e2f1['join'](','))))[_0x40df('0x3e')]();}function handleStop(){logger[_0x40df('0x57')](_0x40df('0x58'));stopped=!![];}function handleUncaughtException(_0x5b4bd9){logger['error'](_0x5b4bd9[_0x40df('0x59')]);process['exit'](0x1);}function handleError(_0x473fdf,_0xd0138b){stats[_0x40df('0x5a')][_0x40df('0x1a')]({'name':_0xd0138b['code'],'message':_0xd0138b[_0x40df('0x59')],'row':_0x473fdf});}function handleQuery(_0x5c97ba){logger[_0x40df('0x57')](_0x5c97ba);return db[_0x40df('0x5b')][_0x40df('0x5c')](_0x5c97ba)['spread'](function(_0x23ff95){results[_0x40df('0x1a')](_0x23ff95);})[_0x40df('0x5d')](function(_0x1d3751){logger[_0x40df('0x5e')](_0x1d3751['message']);});}function updateTzCampaigns(_0x468494){return new Promise(function(_0x245a3f,_0x176416){var _0x8e2c0f=squel['select']()[_0x40df('0x36')]([_0x40df('0x5f'),_0x40df('0x60')])[_0x40df('0x12')](_0x40df('0x61'))[_0x40df('0x37')](_0x40df('0x62'),null,_0x40df('0x63'))[_0x40df('0x14')](_0x40df('0x64')+_0x468494);db[_0x40df('0x5b')]['query'](_0x8e2c0f[_0x40df('0x3e')]())[_0x40df('0x65')](function(_0x546ab4){var _0x46bd66=[];for(var _0x538e04=0x0;_0x538e04<_0x546ab4[_0x40df('0x19')];_0x538e04++){_0x46bd66[_0x40df('0x1a')](getTimezoneData(_0x546ab4[_0x538e04],tmp_campaigns));}BPromise['all'](_0x46bd66)[_0x40df('0x18')](function(){_0x245a3f({'val':0x1});});})[_0x40df('0x5d')](function(_0x3edbc1){logger[_0x40df('0x5e')](_0x3edbc1[_0x40df('0x59')]);_0x245a3f({'val':0x0});});});}function updateTzVoiceQueues(_0x48896c){return new Promise(function(_0x14f04c,_0x42b2d3){var _0x3d10b5=squel['select']()['fields'](['voice_queues.id',_0x40df('0x66')])[_0x40df('0x12')](_0x40df('0x67'))[_0x40df('0x37')](_0x40df('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x48896c);db[_0x40df('0x5b')][_0x40df('0x5c')](_0x3d10b5[_0x40df('0x3e')]())[_0x40df('0x65')](function(_0x341f2d){var _0x22e52f=[];for(var _0x73eccf=0x0;_0x73eccf<_0x341f2d['length'];_0x73eccf++){_0x22e52f[_0x40df('0x1a')](getTimezoneData(_0x341f2d[_0x73eccf],tmp_voice_queues));}BPromise[_0x40df('0x69')](_0x22e52f)[_0x40df('0x18')](function(){_0x14f04c({'val':0x1});});})['catch'](function(_0x3a511f){logger[_0x40df('0x5e')](_0x3a511f['message']);_0x14f04c({'val':0x0});});});}function getTimezoneData(_0x5f5729,_0x3b89a6){return new Promise(function(_0x255092,_0x4e38d2){var _0x23dd1b=shared[_0x40df('0x6a')];var _0x533cb2=_0x23dd1b[_0x5f5729['dialTimezone']];if(_[_0x40df('0x6b')](_0x533cb2)){_0x255092({'ret':0x1});}else{var _0x2b6cf6=_0x533cb2[_0x40df('0x6c')];var _0x4aa8e3=squel[_0x40df('0x3f')]()[_0x40df('0x2b')](_0x3b89a6)[_0x40df('0x6d')]('id',_0x5f5729['id'])[_0x40df('0x6d')](_0x40df('0x6e'),_0x2b6cf6)[_0x40df('0x6d')](_0x40df('0x6f'),_0x5f5729['dialTimezone'])[_0x40df('0x3e')]();return db[_0x40df('0x5b')][_0x40df('0x5c')](_0x4aa8e3)['spread'](function(_0x26caed){_0x255092({'ret':0x1});})[_0x40df('0x5d')](function(_0x1a1633){logger[_0x40df('0x5e')](_0x1a1633['message']);_0x4e38d2({'ret':0x1});});}});}function handleTZQuery(_0x3e7bcd){logger[_0x40df('0x57')](_0x3e7bcd);return db[_0x40df('0x5b')][_0x40df('0x5c')](_0x3e7bcd)['spread'](function(_0x372cbc){})[_0x40df('0x5d')](function(_0x272265){logger[_0x40df('0x5e')](_0x272265['message']);});}function main(_0x27ac47,_0x29710d,_0x660a6c,_0x2cb5ec){logger[_0x40df('0x57')](_0x40df('0x70'),_0x27ac47,JSON[_0x40df('0x71')](_0x29710d));process['send'](_0x40df('0x72'));var _0x179865=_0x29710d['binding'];var _0x4f34bc=_[_0x40df('0x73')](_0x179865);var _0x1ac31a=_0x29710d[_0x40df('0x74')];var _0x467400=path[_0x40df('0x37')](config[_0x40df('0x75')],_0x40df('0x76'),_0x1ac31a+_0x40df('0x77'));hasTZ=_[_0x40df('0x4f')](_0x179865)[_0x40df('0x78')](_0x40df('0x6f'));var _0x4da5a9=_[_0x40df('0x4f')](_0x179865)[_0x40df('0x37')]();logger['info'](_0x40df('0x79'),_0x4da5a9);db[_0x40df('0x7a')]['findAll']({'raw':!![],'attributes':['id',_0x40df('0x7b')]})[_0x40df('0x18')](function(_0x3656ef){for(var _0x5abaa2=0x0;_0x5abaa2<_0x3656ef[_0x40df('0x19')];_0x5abaa2++){if(_0x3656ef[_0x5abaa2][_0x40df('0x7b')]in _0x179865){contactItemTypes[_0x40df('0x1a')](_0x3656ef[_0x5abaa2]);delete _0x4f34bc[_0x3656ef[_0x5abaa2]['name']];hasAdditionalPhones=!![];}for(var _0x29082e in _0x179865){if(_0x3656ef[_0x5abaa2][_0x40df('0x7b')]+_0x40df('0x7c')===_0x29082e){phoneDescriptions['push']({'itemTypeId':_0x3656ef[_0x5abaa2]['id'],'description':_0x29082e});delete _0x4f34bc[_0x29082e];}}}if(hasAdditionalPhones)_0x4f34bc[_0x40df('0x17')]='';var _0x129b43=_[_0x40df('0x4f')](_0x4f34bc)[_0x40df('0x37')]();logger[_0x40df('0x57')](_0x40df('0x79'),_0x129b43);fs['writeFileSync'](_0x467400,_0x129b43+'\x0a');Papa['parse'](fs[_0x40df('0x7d')](_0x27ac47),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e65f6,_0x17203c){try{for(var _0x33a9b8=0x0,_0xa2cd58=[];_0x33a9b8<_0x2e65f6[_0x40df('0x7e')][_0x40df('0x19')];_0x33a9b8++){stats[_0x40df('0x7f')]+=0x1;if(_0x2e65f6[_0x40df('0x5a')][_0x33a9b8]){handleError(_0x2e65f6['data'][_0x33a9b8],_0x2e65f6[_0x40df('0x5a')][_0x33a9b8]);}else{var _0x60fb4b=[];var _0x1af52c=[];var _0x4b6156={};for(var _0x4d1283 in _0x179865){let _0x4a0de9=contactItemTypes['find'](_0x1f3837=>_0x1f3837[_0x40df('0x7b')]===_0x4d1283);let _0x56d5e5=contactItemTypes[_0x40df('0x80')](_0x23e6db=>_0x23e6db[_0x40df('0x7b')]+_0x40df('0x7c')===_0x4d1283);if(_[_0x40df('0x6b')](_0x4a0de9)&&_[_0x40df('0x6b')](_0x56d5e5)){if(_0x179865[_0x40df('0x81')](_0x4d1283)){if(_0x2e65f6['data'][_0x33a9b8][_0x179865[_0x4d1283]]){var _0x4ae8de=_[_0x40df('0x82')](_0x2e65f6[_0x40df('0x7e')][_0x33a9b8][_0x179865[_0x4d1283]]['replace'](/"/g,'\x27'));switch(_0x4d1283){case _0x40df('0x2e'):var _0x4d1a58=moment(_0x4ae8de,_0x40df('0xe'),!![]);if(_0x4d1a58[_0x40df('0x83')]()){_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x4ae8de+'\x22');}else{_0x60fb4b['push'](_0x40df('0x84'));}break;case _0x40df('0x33'):var _0x21a22b=parseInt(_0x4ae8de);_0x4ae8de=_[_0x40df('0x85')](_0x21a22b)||_0x21a22b<0x0||_0x21a22b>0x4?_0x2cb5ec?0x3:0x2:_0x21a22b;_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x4ae8de+'\x22');break;case _0x40df('0x34'):var _0x1b8a61=parseInt(_0x4ae8de);if(_[_0x40df('0x86')](_0x1b8a61)&&_[_0x40df('0x78')](_0x660a6c,_0x1b8a61)){_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x1b8a61+'\x22');}else{_0x60fb4b[_0x40df('0x1a')](_0x40df('0x87'));}break;case _0x40df('0x88'):if(isEmail(_0x4ae8de)){_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x4ae8de+'\x22');}else{_0x60fb4b[_0x40df('0x1a')](_0x40df('0x89'));}break;case _0x40df('0x8a'):var _0x283779=moment(_0x4ae8de,_0x40df('0x8b'),!![]);if(_0x283779[_0x40df('0x83')]()){_0xa2cd58['push']('\x22'+_0x4ae8de+'\x22');}else{_0x60fb4b['push'](_0x40df('0x8c'));}break;case _0x40df('0x6f'):var _0x8e6163=shared['timezones'];var _0x2fae6f=_0x8e6163[_0x4ae8de];if(!_['isNil'](_0x2fae6f)){var _0x5d5468=_0x2fae6f[_0x40df('0x6c')];_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x4ae8de+'\x22');_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x5d5468+'\x22');}break;default:_0xa2cd58[_0x40df('0x1a')]('\x22'+_0x4ae8de+'\x22');}}else{switch(_0x4d1283){case _0x40df('0x8d'):case _0x40df('0x43'):_0x60fb4b['push'](_0x4d1283+_0x40df('0x8e'));break;default:_0xa2cd58['push']('\x22\x22');}}}}else{var _0x22250a='';if(!_['isNil'](_0x4a0de9)){if(!_0x4b6156[_0x40df('0x81')](_0x4a0de9['id'])){if(!_['isNil'](_0x2e65f6['data'][_0x33a9b8][_0x179865[_0x4d1283]])){var _0x4ae8de=_[_0x40df('0x82')](_0x2e65f6[_0x40df('0x7e')][_0x33a9b8][_0x179865[_0x4d1283]]['replace'](/"/g,'\x27'));var _0x24d4b4=phoneDescriptions[_0x40df('0x80')](_0x3b4d21=>_0x3b4d21[_0x40df('0x8f')]===_0x4a0de9['id']);if(!_[_0x40df('0x6b')](_0x24d4b4)){var _0x4752bf=_[_0x40df('0x82')](_0x2e65f6[_0x40df('0x7e')][_0x33a9b8][_0x179865[_0x24d4b4['description']]][_0x40df('0x90')](/"/g,'\x27'));if(!_['isNil'](_0x4752bf))_0x4ae8de=_0x4ae8de+'§'+_0x4752bf;}if(_0x22250a=='')_0x22250a=_0x4ae8de;else _0x22250a+='|'+_0x4ae8de;}_0x1af52c['push'](_0x4a0de9['id']+':'+_0x22250a);_0x4b6156[_0x4a0de9['id']]=0x1;}}}}if(hasAdditionalPhones){_0xa2cd58['push']('\x22'+_0x1af52c[_0x40df('0x37')](';')+'\x22');}if(_0x60fb4b[_0x40df('0x19')]){handleError(_0x2e65f6[_0x40df('0x7e')][_0x33a9b8],{'code':'SystemRow','message':_0x60fb4b['join']()});}else{fs[_0x40df('0x91')](_0x467400,_0xa2cd58[_0x40df('0x37')]()+'\x0a');}_0xa2cd58=[];}if(!(stats[_0x40df('0x7f')]%0xc8)){socket[_0x40df('0x92')]('contact:import:'+_0x1ac31a,stats);stats[_0x40df('0x5a')]=[];}}if(stopped){logger[_0x40df('0x57')](_0x40df('0x93'));_0x17203c[_0x40df('0x94')]();}}catch(_0x45ab18){handleError(_0x2e65f6[_0x40df('0x7e')][_0x33a9b8],{'code':_0x40df('0x95'),'message':_0x45ab18['message']});logger[_0x40df('0x5e')](_0x40df('0x96'),_0x45ab18[_0x40df('0x59')]);}},'complete':function(){try{var _0x1cb154=[];var _0x3d4d7f=[];var _0x4d2215=_0x40df('0x38');if(_0x29710d[_0x40df('0x97')]&&_0x29710d['duplicates']['length']){_0x4d2215=_0x40df('0x98')+_0x1ac31a;_0x1cb154[_0x40df('0x1a')](_0x40df('0x99')+_0x4d2215+_0x40df('0x9a'));}tmp_campaigns=_0x40df('0x9b')+_0x1ac31a;tmp_voice_queues='voice_queues_'+_0x1ac31a;_0x3d4d7f[_0x40df('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x40df('0x9c'));_0x3d4d7f['push'](_0x40df('0x99')+tmp_voice_queues+_0x40df('0x9c'));BPromise[_0x40df('0x9d')](_0x3d4d7f,handleTZQuery)[_0x40df('0x18')](function(_0x21ecf0){updateTzCampaigns(_0x29710d['ListId'])[_0x40df('0x18')](function(_0x26ea84){updateTzVoiceQueues(_0x29710d['ListId'])[_0x40df('0x18')](function(_0x3f7cac){if(hasTZ)_0x129b43=_0x129b43[_0x40df('0x90')](_0x40df('0x6f'),_0x40df('0x9e'));var _0x40c73b=util[_0x40df('0xd')](_0x40df('0x9f'),_0x467400,_0x4d2215,_0x129b43,_0x29710d[_0x40df('0x30')],_0x29710d[_0x40df('0x50')]||null,NOW,NOW);if(_[_0x40df('0x6b')](_0x179865[_0x40df('0x2e')])){_0x40c73b+=_0x40df('0xa0');}_0x1cb154[_0x40df('0x1a')](_0x40c73b);if(_0x29710d['duplicates']&&_0x29710d[_0x40df('0x97')][_0x40df('0x19')]){_0x1cb154[_0x40df('0x1a')](insertCmContact(_0x29710d['ListId'],_0x4d2215,_0x29710d['duplicates'],_0x179865));_0x1cb154[_0x40df('0x1a')](_0x40df('0xa1')+_0x4d2215+';');}BPromise[_0x40df('0x9d')](_0x1cb154,handleQuery)[_0x40df('0x18')](function(_0x567ee0){BPromise[_0x40df('0x69')]([handleAdditionalPhones()])['then'](function(){_0x1cb154=[];for(var _0x10dc7d=0x0;_0x10dc7d_0x5ee237[_0x0220('0x67')]===_0x530943);let _0x3cd650=contactItemTypes['find'](_0x1dece1=>_0x1dece1['name']+_0x0220('0x68')===_0x530943);if(_[_0x0220('0x1b')](_0xb10347)&&_[_0x0220('0x1b')](_0x3cd650)){if(_0x401a67[_0x0220('0x70')](_0x530943)){if(_0xf17db0['data'][_0x34db87][_0x401a67[_0x530943]]){var _0x2f15cd=_[_0x0220('0x71')](_0xf17db0[_0x0220('0x6d')][_0x34db87][_0x401a67[_0x530943]]['replace'](/"/g,'\x27'));switch(_0x530943){case _0x0220('0x37'):var _0x5d8799=moment(_0x2f15cd,_0x0220('0xd'),!![]);if(_0x5d8799[_0x0220('0x72')]()){_0x146259['push']('\x22'+_0x2f15cd+'\x22');}else{_0x5bc606['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0220('0x3b'):var _0x3d26e6=parseInt(_0x2f15cd);_0x2f15cd=_[_0x0220('0x73')](_0x3d26e6)||_0x3d26e6<0x0||_0x3d26e6>0x4?_0x33cc3f?0x3:0x2:_0x3d26e6;_0x146259['push']('\x22'+_0x2f15cd+'\x22');break;case _0x0220('0x74'):var _0x461397=parseInt(_0x2f15cd);if(_['isNumber'](_0x461397)&&_[_0x0220('0x75')](_0x174df6,_0x461397)){_0x146259[_0x0220('0x1d')]('\x22'+_0x461397+'\x22');}else{_0x5bc606[_0x0220('0x1d')](_0x0220('0x76'));}break;case _0x0220('0x77'):if(isEmail(_0x2f15cd)){_0x146259[_0x0220('0x1d')]('\x22'+_0x2f15cd+'\x22');}else{_0x5bc606[_0x0220('0x1d')](_0x0220('0x78'));}break;case _0x0220('0x79'):var _0x32ddc6=moment(_0x2f15cd,_0x0220('0x7a'),!![]);if(_0x32ddc6['isValid']()){_0x146259['push']('\x22'+_0x2f15cd+'\x22');}else{_0x5bc606[_0x0220('0x1d')](_0x0220('0x7b'));}break;default:_0x146259[_0x0220('0x1d')]('\x22'+_0x2f15cd+'\x22');}}else{switch(_0x530943){case _0x0220('0x7c'):case _0x0220('0x11'):_0x5bc606['push'](_0x530943+_0x0220('0x7d'));break;default:_0x146259[_0x0220('0x1d')]('\x22\x22');}}}}else{var _0x46272e='';if(!_[_0x0220('0x1b')](_0xb10347)){if(!_0x5746bb[_0x0220('0x70')](_0xb10347['id'])){for(var _0x506086=0x0;_0x506086<_0x401a67[_0x530943][_0x0220('0x1a')];_0x506086++){var _0x2f15cd=_[_0x0220('0x71')](_0xf17db0[_0x0220('0x6d')][_0x34db87][_0x401a67[_0x530943][_0x506086]]['replace'](/"/g,'\x27'));var _0xbaf34a=phoneDescriptions[_0x0220('0x6f')](_0x5ed691=>_0x5ed691[_0x0220('0x7e')]===_0xb10347['id']);if(!_[_0x0220('0x1b')](_0xbaf34a)){var _0x27bdb5=_[_0x0220('0x71')](_0xf17db0[_0x0220('0x6d')][_0x34db87][_0x401a67[_0xbaf34a['description']][0x0]][_0x0220('0x7f')](/"/g,'\x27'));if(!_[_0x0220('0x1b')](_0x27bdb5))_0x2f15cd=_0x2f15cd+'§'+_0x27bdb5;}if(_0x46272e=='')_0x46272e=_0x2f15cd;else _0x46272e+='|'+_0x2f15cd;}_0x59ce48[_0x0220('0x1d')](_0xb10347['id']+':'+_0x46272e);_0x5746bb[_0xb10347['id']]=0x1;}}}}if(hasAdditionalPhones){_0x146259[_0x0220('0x1d')]('\x22'+_0x59ce48['join'](';')+'\x22');}if(_0x5bc606['length']){handleError(_0xf17db0[_0x0220('0x6d')][_0x34db87],{'code':_0x0220('0x80'),'message':_0x5bc606[_0x0220('0x15')]()});}else{fs[_0x0220('0x81')](_0x4d8e3a,_0x146259['join']()+'\x0a');}_0x146259=[];}if(!(stats[_0x0220('0x82')]%0xc8)){socket[_0x0220('0x83')](_0x0220('0x84')+_0x10f766,stats);stats[_0x0220('0x6e')]=[];}}if(stopped){logger[_0x0220('0x5d')](_0x0220('0x85'));_0x5209f8[_0x0220('0x86')]();}}catch(_0x4d921a){handleError(_0xf17db0[_0x0220('0x6d')][_0x34db87],{'code':_0x0220('0x87'),'message':_0x4d921a[_0x0220('0x21')]});logger[_0x0220('0x20')](_0x0220('0x88'),_0x4d921a[_0x0220('0x21')]);}},'complete':function(){try{var _0xcf3a6f=[];var _0x380098=tempTableName;_0xcf3a6f[_0x0220('0x1d')](_0x0220('0x89')+_0x380098+_0x0220('0x8a'));logger['info'](_0x0220('0x8b'),contactItemTypes[_0x0220('0x1a')]);var _0x25bc0e=util[_0x0220('0xc')](_0x0220('0x8c'),_0x4d8e3a,_0x380098,_0x105cf8,_0x5db462['ListId'],_0x5db462['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x401a67['scheduledat'])){_0x25bc0e+=',\x20scheduledAt\x20=\x20NOW()';}_0xcf3a6f[_0x0220('0x1d')](_0x25bc0e);BPromise['each'](_0xcf3a6f,handleQuery)[_0x0220('0x22')](function(_0x232503){BPromise[_0x0220('0x1e')]([handleAdditionalPhones()])['then'](function(){_0xcf3a6f=[];for(var _0xe93d7=0x0;_0xe93d7\x20\x20');}var _0xcec24f=path[_0x0220('0x15')](config[_0x0220('0x95')],_0x0220('0x96'),process[_0x0220('0x94')][0x2]);if(!fs[_0x0220('0x97')](_0xcec24f)){throw new Error(_0x0220('0x98'));}var _0x3477f2={};try{_0x3477f2=JSON['parse'](process[_0x0220('0x94')][0x3]);if(!_0x3477f2[_0x0220('0x62')]){throw new Error(_0x0220('0x99'));}var _0x6f88a5=0x0;if(_0x3477f2[_0x0220('0x62')][_0x0220('0x74')]){_0x6f88a5=0x1;}if(!_0x3477f2[_0x0220('0x39')]){throw new Error(_0x0220('0x9a'));}}catch(_0x454705){throw new Error('body\x20id\x20mandatory');}var _0x235eb9=[];try{_0x235eb9=_[_0x0220('0x9b')](JSON[_0x0220('0x6b')](process[_0x0220('0x94')][0x4]),'id');}catch(_0x17da87){logger[_0x0220('0x5d')](_0x0220('0x9c'));}main(_0xcec24f,_0x3477f2,_0x235eb9,_0x6f88a5);}validate();process['on']('SIGINT',handleStop);process['on'](_0x0220('0x9d'),handleUncaughtException); \ No newline at end of file +var _0x61d0=['cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','errors','code','sequelize','send','start','binding','clone','socket_timestamp','root','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','find','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','contactTypeId','orderBy','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','isNil','phone','push','all','catch','error','message','AdditionalPhones','split','length','then','filter','CmContactHasItem','findOne','update','updated','create','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy'];(function(_0x227242,_0x1f77a6){var _0x2711e8=function(_0x4b1d73){while(--_0x4b1d73){_0x227242['push'](_0x227242['shift']());}};_0x2711e8(++_0x1f77a6);}(_0x61d0,0x187));var _0x061d=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x61d0[_0x1ca9e9];return _0x309f3c;};'use strict';var fs=require('fs');var path=require(_0x061d('0x0'));var _=require('lodash');var Papa=require(_0x061d('0x1'));var util=require(_0x061d('0x2'));var BPromise=require('bluebird');var moment=require(_0x061d('0x3'));var squel=require('squel');var Redis=require(_0x061d('0x4'));var db=require(_0x061d('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x061d('0x6'))(_0x061d('0x7'));config[_0x061d('0x8')]=_[_0x061d('0x9')](config[_0x061d('0x8')],{'host':_0x061d('0xa'),'port':0x18eb});var socket=require(_0x061d('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x061d('0xc')+moment()['format'](_0x061d('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x148e76){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'](_0x148e76);}function selectNotIn(_0x295620,_0x1e9b5b,_0x12c87e,_0x30bd01,_0x1ede76){return squel[_0x061d('0xe')]()[_0x061d('0xf')]('phone')[_0x061d('0x10')](_0x30bd01)[_0x061d('0x11')](_0x1e9b5b,null,_0x1e9b5b+_0x061d('0x12')+_0x30bd01+'.'+_0x12c87e)[_0x061d('0x13')](_0x30bd01+'.'+_0x12c87e+_0x061d('0x14')+_0x295620+'.'+_0x12c87e)[_0x061d('0x13')](_0x1e9b5b+_0x061d('0x15')+_0x1ede76[_0x061d('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x46fd62,_0x346aa5){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x061d('0x16')](_0x061d('0x17')+tempTableName)[_0x061d('0x18')](function(_0x4f926b){if(_0x4f926b!==null){var _0x28a1db=[];for(var _0x4fda9e=0x0;_0x4fda9e<_0x4f926b['length'];_0x4fda9e++){var _0x2195fe=_0x4f926b[_0x4fda9e];if(!_[_0x061d('0x19')](_0x2195fe[_0x061d('0x1a')])){if(!_[_0x061d('0x19')](_0x2195fe['AdditionalPhones']))_0x28a1db[_0x061d('0x1b')](insertAdditionalPhones(_0x2195fe));promisesContact[_0x061d('0x1b')]({'contact':_0x2195fe});}}}Promise[_0x061d('0x1c')](_0x28a1db)['then'](function(){_0x46fd62({'val':0x1});});})[_0x061d('0x1d')](function(_0x1ee23c){logger[_0x061d('0x1e')](_0x1ee23c[_0x061d('0x1f')]);});});}function insertAdditionalPhones(_0x4a0615){return new Promise(function(_0x17b8ed,_0x2ffca2){var _0x5be53b=_0x4a0615[_0x061d('0x20')];if(_[_0x061d('0x19')](_0x5be53b))_0x2ffca2({'val':0x0});else{var _0x4b1380=_0x5be53b[_0x061d('0x21')](';');var _0xc3ded6=[];orderBy=0x0;for(var _0x45e2eb=0x0;_0x45e2eb<_0x4b1380[_0x061d('0x22')];_0x45e2eb++){_0xc3ded6[_0x061d('0x1b')](splitAdditionalPhone(_0x4a0615['id'],_0x4b1380[_0x45e2eb]));}Promise['all'](_0xc3ded6)[_0x061d('0x23')](function(){_0x17b8ed({'val':_0x4b1380[_0x061d('0x22')]});});}});}function splitAdditionalPhone(_0x5512f9,_0x40ba43){return new Promise(function(_0x3d5148,_0x5b884a){var _0x5a94bb=_0x40ba43[_0x061d('0x21')](':');var _0x3d9087=_0x5a94bb[0x0];var _0x1f5df7=_0x5a94bb[0x1];if(_0x1f5df7!==''){var _0x2bace6=_0x1f5df7[_0x061d('0x21')]('|');var _0x41e3db=[];for(var _0x5d49d7=0x0;_0x5d49d7<_0x2bace6['length'];_0x5d49d7++){if(_0x2bace6[_0x5d49d7]!==''){var _0x2d189c=_[_0x061d('0x24')](promisesAdditionalPhones,{'contactId':_0x5512f9,'phone':_0x2bace6[_0x5d49d7]});if(_0x2d189c['length']==0x0){orderBy++;promisesAdditionalPhones[_0x061d('0x1b')]({'contactId':_0x5512f9,'contactTypeId':_0x3d9087,'phone':_0x2bace6[_0x5d49d7],'orderBy':orderBy});}}}_0x3d5148({'ok':0x1});}else _0x3d5148({'res':0x0});});}function createAdditionalPhone(_0x4bcb93,_0xed0570,_0x1d3d76,_0x2179d5){var _0x366188='';var _0xc8f0cd='';var _0x30ee72=_0x1d3d76[_0x061d('0x21')]('§');_0x366188=_0x30ee72[0x0];if(_0x30ee72[_0x061d('0x22')]==0x2)_0xc8f0cd=_0x30ee72[0x1];return new Promise(function(_0x429b16,_0x16f00c){return db[_0x061d('0x25')][_0x061d('0x26')]({'where':{'CmContactId':_0x4bcb93,'item':_0x366188}})['then'](function(_0x17fd4a){if(_0x17fd4a){return db[_0x061d('0x25')][_0x061d('0x27')]({'ItemTypeId':_0xed0570,'description':_0xc8f0cd,'OrderBy':_0x2179d5},{'where':{'CmContactId':_0x4bcb93,'item':_0x366188}})[_0x061d('0x23')](function(_0x545d34){_0x429b16({'res':_0x061d('0x28')});});}else{return db['CmContactHasItem'][_0x061d('0x29')]({'CmContactId':_0x4bcb93,'item':_0x366188,'ItemTypeId':_0xed0570,'description':_0xc8f0cd,'OrderBy':_0x2179d5,'ItemClass':'PHONE'})[_0x061d('0x23')](function(_0x3c00c0){_0x429b16({'res':'inserted'});});}});});}function updateContact(_0x3b32e0){return new Promise(function(_0x4a9983,_0x12b4c3){var _0x3376fe=_0x3b32e0['id'];delete _0x3b32e0['id'];return db[_0x061d('0x2a')][_0x061d('0x27')](_0x3b32e0,{'where':{'id':_0x3376fe}})[_0x061d('0x23')](function(_0x5a46a8){updatedRows+=0x1;return db[_0x061d('0x2b')][_0x061d('0x27')]({'phone':_0x3b32e0[_0x061d('0x1a')]},{'where':{'ContactId':_0x3376fe}})[_0x061d('0x23')](function(_0x6f67f7){_0x4a9983({'ret':'OK'});});});});}function insertCmHopper(_0x1db6cf,_0x1a4be3,_0x48838e,_0x3e79d7,_0xcf4749){var _0x4ebdb6=[_0x061d('0x2c'),'cm_contacts.scheduledat',_0x061d('0x2d'),_0x061d('0x2e'),_0x1a4be3+'.'+_0x3e79d7,_0x061d('0x2f'),'cm_contacts.updatedAt',_0x061d('0x30'),_0x061d('0x31'),'\x22'+_0xcf4749+'\x22'];return squel[_0x061d('0x32')]()[_0x061d('0x33')]('cm_hopper')[_0x061d('0x34')]([_0x061d('0x1a'),_0x061d('0x35'),_0x061d('0x36'),_0x061d('0x37'),_0x3e79d7,_0x061d('0x38'),_0x061d('0x39'),_0x061d('0x3a'),_0x061d('0x3b'),'recallme'],squel[_0x061d('0xe')]()['fields'](_0x4ebdb6)[_0x061d('0x10')](_0x1a4be3)['join'](_0x061d('0x3c'),null,_0x061d('0x3d')+_0x1a4be3+'.CmListId')['join'](_0x48838e,null,_0x48838e+'.id\x20=\x20'+_0x1a4be3+'.'+_0x3e79d7)[_0x061d('0x13')](_0x1a4be3+_0x061d('0x3e'),_0x1db6cf)['where'](_0x061d('0x3f'),NOW)[_0x061d('0x13')](_0x061d('0x40'),selectNotIn(_0x1a4be3,_0x48838e,_0x3e79d7,_0x061d('0x41'),[_0x061d('0x42'),_0x061d('0x43')]))[_0x061d('0x13')](_0x061d('0x40'),selectNotIn(_0x1a4be3,_0x48838e,_0x3e79d7,_0x061d('0x41'),['\x22always\x22'])))[_0x061d('0x44')]();}function insertCmHopperBlack(_0x53dbf2,_0x37397b,_0x17daf9,_0xd6ce34){var _0x4f948d=[_0x061d('0x2c'),_0x061d('0x2d'),_0x061d('0x2e'),_0x37397b+'.'+_0xd6ce34,'cm_contacts.createdAt',_0x061d('0x45')];return squel[_0x061d('0x32')]()[_0x061d('0x33')](_0x061d('0x46'))[_0x061d('0x34')]([_0x061d('0x1a'),_0x061d('0x36'),_0x061d('0x37'),_0xd6ce34,_0x061d('0x38'),_0x061d('0x39')],squel[_0x061d('0xe')]()[_0x061d('0x47')](_0x4f948d)[_0x061d('0x10')](_0x37397b)['join']('cm_contacts',null,_0x061d('0x3d')+_0x37397b+'.CmListId')[_0x061d('0x11')](_0x17daf9,null,_0x17daf9+_0x061d('0x12')+_0x37397b+'.'+_0xd6ce34)[_0x061d('0x13')](_0x37397b+_0x061d('0x3e'),_0x53dbf2)[_0x061d('0x13')](_0x061d('0x3f'),NOW)[_0x061d('0x13')](_0x061d('0x40'),squel[_0x061d('0xe')]()['field']('phone')['from'](_0x061d('0x46'))[_0x061d('0x13')](_0x061d('0x48'),_0x53dbf2)[_0x061d('0x13')](_0xd6ce34+_0x061d('0x49'),_0x37397b+'.'+_0xd6ce34)))[_0x061d('0x44')]();}function insertCmHopperAdditionalPhones(_0x3a06bb){var _0x1e3871=['cm_hopper.id',_0x061d('0x4a'),'cm_contact_has_items.OrderBy',_0x061d('0x4b'),_0x061d('0x4c')];return squel[_0x061d('0x32')]()[_0x061d('0x33')](_0x061d('0x4d'))[_0x061d('0x34')]([_0x061d('0x4e'),_0x061d('0x1a'),_0x061d('0x4f'),_0x061d('0x38'),'updatedAt'],squel['select']()[_0x061d('0x47')](_0x1e3871)[_0x061d('0x10')](_0x061d('0x41'))['join']('cm_contacts',null,_0x061d('0x50'))[_0x061d('0x11')](_0x061d('0x51'),null,_0x061d('0x52'))['where']('cm_hopper.ListId\x20=\x20?',_0x3a06bb)[_0x061d('0x13')](_0x061d('0x3f'),NOW))[_0x061d('0x44')]();}function insertCmContact(_0xb3051f,_0x474c08,_0x5d2f11,_0x55358b){var _0x4c785b=_['concat'](_[_0x061d('0x53')](_0x55358b),[_0x061d('0x37'),_0x061d('0x54'),_0x061d('0x38'),_0x061d('0x39')]);return squel[_0x061d('0x32')]()[_0x061d('0x33')]('cm_contacts')[_0x061d('0x34')](_0x4c785b,squel[_0x061d('0xe')]()[_0x061d('0x47')](_0x4c785b)[_0x061d('0x10')](_0x474c08)[_0x061d('0x13')]('('+_0x5d2f11[_0x061d('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x061d('0xe')]()[_0x061d('0x47')](_0x5d2f11)[_0x061d('0x10')](_0x061d('0x3c'))['where'](_0x061d('0x48'),_0xb3051f))['where'](_0x061d('0x55'),squel[_0x061d('0xe')]()[_0x061d('0xf')]('MIN(id)',_0x061d('0x56'))['from'](_0x474c08)[_0x061d('0x57')](_0x5d2f11[_0x061d('0x11')](','))))[_0x061d('0x44')]();}function handleStop(){logger[_0x061d('0x58')](_0x061d('0x59'));stopped=!![];}function handleUncaughtException(_0x41a215){logger[_0x061d('0x1e')](_0x41a215[_0x061d('0x1f')]);process['exit'](0x1);}function handleError(_0x5b34b1,_0x96971e){stats[_0x061d('0x5a')][_0x061d('0x1b')]({'name':_0x96971e[_0x061d('0x5b')],'message':_0x96971e[_0x061d('0x1f')],'row':_0x5b34b1});}function handleQuery(_0x2ca812){logger['info'](_0x2ca812);return db[_0x061d('0x5c')][_0x061d('0x16')](_0x2ca812)['spread'](function(_0x195e04){results[_0x061d('0x1b')](_0x195e04);})['catch'](function(_0x2d2067){logger[_0x061d('0x1e')](_0x2d2067[_0x061d('0x1f')]);});}function main(_0x2a78e9,_0x5839c2,_0x28f5f5,_0x437a8d){logger[_0x061d('0x58')]('main',_0x2a78e9,JSON['stringify'](_0x5839c2));process[_0x061d('0x5d')](_0x061d('0x5e'));var _0x24e924=_0x5839c2[_0x061d('0x5f')];var _0x3c9bfe=_[_0x061d('0x60')](_0x24e924);var _0x3bdb6f=_0x5839c2[_0x061d('0x61')];var _0xc21481=path[_0x061d('0x11')](config[_0x061d('0x62')],'server/files/tmp',_0x3bdb6f+'.csv');logger['info']('body',_0x5839c2);db[_0x061d('0x63')][_0x061d('0x64')]({'raw':!![],'attributes':['id','name']})[_0x061d('0x23')](function(_0xb9e929){for(var _0x5762a9=0x0;_0x5762a9<_0xb9e929[_0x061d('0x22')];_0x5762a9++){if(_0xb9e929[_0x5762a9][_0x061d('0x65')]in _0x24e924){contactItemTypes[_0x061d('0x1b')](_0xb9e929[_0x5762a9]);delete _0x3c9bfe[_0xb9e929[_0x5762a9][_0x061d('0x65')]];hasAdditionalPhones=!![];}for(var _0x27de9b in _0x24e924){if(_0xb9e929[_0x5762a9]['name']+_0x061d('0x66')===_0x27de9b){phoneDescriptions[_0x061d('0x1b')]({'itemTypeId':_0xb9e929[_0x5762a9]['id'],'description':_0x27de9b});delete _0x3c9bfe[_0x27de9b];}}}if(hasAdditionalPhones)_0x3c9bfe['AdditionalPhones']='';var _0x1ff824=_['keys'](_0x3c9bfe)['join']();logger[_0x061d('0x58')]('header',_0x1ff824);fs[_0x061d('0x67')](_0xc21481,_0x1ff824+'\x0a');Papa[_0x061d('0x68')](fs[_0x061d('0x69')](_0x2a78e9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ff255,_0x19ebbe){try{for(var _0x10eef5=0x0,_0x21355f=[];_0x10eef5<_0x3ff255['data'][_0x061d('0x22')];_0x10eef5++){stats[_0x061d('0x6a')]+=0x1;if(_0x3ff255['errors'][_0x10eef5]){handleError(_0x3ff255[_0x061d('0x6b')][_0x10eef5],_0x3ff255['errors'][_0x10eef5]);}else{var _0x50fba5=[];var _0x17acac=[];var _0x578f01={};for(var _0x514710 in _0x24e924){let _0x24d5c9=contactItemTypes['find'](_0x5f2270=>_0x5f2270[_0x061d('0x65')]===_0x514710);let _0x45194c=contactItemTypes['find'](_0x31a4e8=>_0x31a4e8[_0x061d('0x65')]+'_description'===_0x514710);if(_[_0x061d('0x19')](_0x24d5c9)&&_['isNil'](_0x45194c)){if(_0x24e924[_0x061d('0x6c')](_0x514710)){if(_0x3ff255['data'][_0x10eef5][_0x24e924[_0x514710]]){var _0x4aa129=_[_0x061d('0x6d')](_0x3ff255[_0x061d('0x6b')][_0x10eef5][_0x24e924[_0x514710]][_0x061d('0x6e')](/"/g,'\x27'));switch(_0x514710){case _0x061d('0x35'):var _0x3ac594=moment(_0x4aa129,_0x061d('0x6f'),!![]);if(_0x3ac594[_0x061d('0x70')]()){_0x21355f[_0x061d('0x1b')]('\x22'+_0x4aa129+'\x22');}else{_0x50fba5[_0x061d('0x1b')](_0x061d('0x71'));}break;case _0x061d('0x3a'):var _0x3a9637=parseInt(_0x4aa129);_0x4aa129=_[_0x061d('0x72')](_0x3a9637)||_0x3a9637<0x0||_0x3a9637>0x4?_0x437a8d?0x3:0x2:_0x3a9637;_0x21355f[_0x061d('0x1b')]('\x22'+_0x4aa129+'\x22');break;case _0x061d('0x3b'):var _0x11a8fc=parseInt(_0x4aa129);if(_[_0x061d('0x73')](_0x11a8fc)&&_[_0x061d('0x74')](_0x28f5f5,_0x11a8fc)){_0x21355f['push']('\x22'+_0x11a8fc+'\x22');}else{_0x50fba5[_0x061d('0x1b')](_0x061d('0x75'));}break;case _0x061d('0x76'):if(isEmail(_0x4aa129)){_0x21355f[_0x061d('0x1b')]('\x22'+_0x4aa129+'\x22');}else{_0x50fba5[_0x061d('0x1b')]('email\x20wrong\x20format');}break;case _0x061d('0x77'):var _0x4b6a30=moment(_0x4aa129,'YYYY-MM-DD',!![]);if(_0x4b6a30['isValid']()){_0x21355f[_0x061d('0x1b')]('\x22'+_0x4aa129+'\x22');}else{_0x50fba5['push'](_0x061d('0x78'));}break;default:_0x21355f[_0x061d('0x1b')]('\x22'+_0x4aa129+'\x22');}}else{switch(_0x514710){case _0x061d('0x79'):case _0x061d('0x1a'):_0x50fba5[_0x061d('0x1b')](_0x514710+_0x061d('0x7a'));break;default:_0x21355f['push']('\x22\x22');}}}}else{var _0x26367e='';if(!_[_0x061d('0x19')](_0x24d5c9)){if(!_0x578f01[_0x061d('0x6c')](_0x24d5c9['id'])){for(var _0x1f0a6f=0x0;_0x1f0a6f<_0x24e924[_0x514710][_0x061d('0x22')];_0x1f0a6f++){var _0x4aa129=_[_0x061d('0x6d')](_0x3ff255[_0x061d('0x6b')][_0x10eef5][_0x24e924[_0x514710][_0x1f0a6f]][_0x061d('0x6e')](/"/g,'\x27'));var _0x7f6a13=phoneDescriptions[_0x061d('0x7b')](_0x3c867d=>_0x3c867d['itemTypeId']===_0x24d5c9['id']);if(!_['isNil'](_0x7f6a13)){var _0x3b32f9=_['trim'](_0x3ff255[_0x061d('0x6b')][_0x10eef5][_0x24e924[_0x7f6a13[_0x061d('0x7c')]][0x0]][_0x061d('0x6e')](/"/g,'\x27'));if(!_[_0x061d('0x19')](_0x3b32f9))_0x4aa129=_0x4aa129+'§'+_0x3b32f9;}if(_0x26367e=='')_0x26367e=_0x4aa129;else _0x26367e+='|'+_0x4aa129;}_0x17acac[_0x061d('0x1b')](_0x24d5c9['id']+':'+_0x26367e);_0x578f01[_0x24d5c9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x21355f[_0x061d('0x1b')]('\x22'+_0x17acac['join'](';')+'\x22');}if(_0x50fba5[_0x061d('0x22')]){handleError(_0x3ff255['data'][_0x10eef5],{'code':_0x061d('0x7d'),'message':_0x50fba5[_0x061d('0x11')]()});}else{fs[_0x061d('0x7e')](_0xc21481,_0x21355f[_0x061d('0x11')]()+'\x0a');}_0x21355f=[];}if(!(stats[_0x061d('0x6a')]%0xc8)){socket[_0x061d('0x7f')](_0x061d('0x80')+_0x3bdb6f,stats);stats[_0x061d('0x5a')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x19ebbe[_0x061d('0x81')]();}}catch(_0x580b83){handleError(_0x3ff255[_0x061d('0x6b')][_0x10eef5],{'code':_0x061d('0x82'),'message':_0x580b83[_0x061d('0x1f')]});logger['error'](_0x061d('0x83'),_0x580b83[_0x061d('0x1f')]);}},'complete':function(){try{var _0x5d6cef=[];var _0x3f8dae=tempTableName;_0x5d6cef[_0x061d('0x1b')](_0x061d('0x84')+_0x3f8dae+_0x061d('0x85'));logger[_0x061d('0x58')](_0x061d('0x86'),contactItemTypes['length']);var _0x31a572=util['format'](_0x061d('0x87'),_0xc21481,_0x3f8dae,_0x1ff824,_0x5839c2[_0x061d('0x37')],_0x5839c2[_0x061d('0x54')]||null,NOW,NOW);if(_[_0x061d('0x19')](_0x24e924['scheduledat'])){_0x31a572+=_0x061d('0x88');}_0x5d6cef['push'](_0x31a572);BPromise['each'](_0x5d6cef,handleQuery)['then'](function(_0x4372d7){BPromise['all']([handleAdditionalPhones()])[_0x061d('0x23')](function(){_0x5d6cef=[];for(var _0x349f88=0x0;_0x349f88\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne','enableEmailPreview','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','select','field','name','color','tools_tags','user_has_','_interactions','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','getInteractionFK','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?'];(function(_0x4d10b0,_0x2bb650){var _0x422317=function(_0xefd250){while(--_0xefd250){_0x4d10b0['push'](_0x4d10b0['shift']());}};_0x422317(++_0x2bb650);}(_0xc6f0,0x6f));var _0x0c6f=function(_0x9ec581,_0x217234){_0x9ec581=_0x9ec581-0x0;var _0x2ffdcf=_0xc6f0[_0x9ec581];return _0x2ffdcf;};'use strict';var _=require(_0x0c6f('0x0'));var squel=require(_0x0c6f('0x1'));var as=require(_0x0c6f('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x0c6f('0x3'))[_0x0c6f('0x4')];var utils=require(_0x0c6f('0x5'));var db=require(_0x0c6f('0x6'))['db'];function skipInteractionsQuery(_0x152dbb,_0x390117,_0x3066a5){var _0x366ed1=![];var _0x5b2b7c=utils[_0x0c6f('0x7')](_0x152dbb);if(_0x390117[_0x0c6f('0x8')]==='agent'&&!_0x3066a5['search']&&!_0x3066a5[_0x5b2b7c]){_0x366ed1=!![];}return _0x366ed1;}function getTagsQuery(){return squel[_0x0c6f('0x9')]()[_0x0c6f('0xa')]('id')[_0x0c6f('0xa')](_0x0c6f('0xb'))[_0x0c6f('0xa')](_0x0c6f('0xc'))['from'](_0x0c6f('0xd'));}function getUsersQuery(_0x187a93,_0x4f7bf3){var _0x4dddcb=utils['getInteractionFK'](_0x187a93);var _0x5d7258=_0x0c6f('0xe')+_0x187a93+_0x0c6f('0xf');var _0x52c761=squel[_0x0c6f('0x9')]()[_0x0c6f('0xa')]('u.id')[_0x0c6f('0xa')](_0x0c6f('0x10'))['field'](_0x0c6f('0x11')+_0x4dddcb)['from'](_0x5d7258,'ui')[_0x0c6f('0x12')](_0x0c6f('0x13'),'u',_0x0c6f('0x14'));if(_0x4f7bf3[_0x0c6f('0x15')]>0x0){_0x52c761[_0x0c6f('0x16')](_0x0c6f('0x11')+_0x4dddcb+_0x0c6f('0x17'),_['map'](_0x4f7bf3,'id'));}return _0x52c761;}function getInteractionsQuery(_0x57995d){var _0x4ed620=utils[_0x0c6f('0x18')](_0x57995d);var _0x250286=utils[_0x0c6f('0x7')](_0x57995d);var _0x41657f=utils[_0x0c6f('0x19')](_0x57995d);return squel[_0x0c6f('0x9')]()[_0x0c6f('0x1a')](_0x4ed620['interactions'],'i')[_0x0c6f('0x12')](_0x0c6f('0x1b'),'c',_0x0c6f('0x1c'))[_0x0c6f('0x12')]('users','o','o.id\x20=\x20i.UserId')[_0x0c6f('0x12')](_0x4ed620['accounts'],'a','a.id\x20=\x20i.'+_0x250286)[_0x0c6f('0x12')](_0x4ed620[_0x0c6f('0x1d')],'me',_0x0c6f('0x1e')+_0x41657f+_0x0c6f('0x1f'))[_0x0c6f('0x12')](_0x4ed620[_0x0c6f('0x20')],'it','it.'+_0x41657f+_0x0c6f('0x1f'))[_0x0c6f('0x12')]('tools_tags','t',_0x0c6f('0x21'));}function getSqlClauses(){var _0x470832={'body':squel[_0x0c6f('0x22')](),'contact':squel['expr'](),'default':squel[_0x0c6f('0x22')](),'fields':squel['expr'](),'filter':squel[_0x0c6f('0x22')](),'read':squel[_0x0c6f('0x22')](),'tags':{'clause':squel[_0x0c6f('0x22')](),'ids':null},'user':squel['expr']()};return _0x470832;}function parseTagParameter(_0x4c9f27){var _0xde9757=squel[_0x0c6f('0x22')]();if(_0x4c9f27){var _0x3a264a=utils[_0x0c6f('0x23')](_0x4c9f27);_0x3a264a[_0x0c6f('0x24')](function(_0x1f4116){_0xde9757['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f4116+',%');});}return _0xde9757;}function parseReadParameter(_0x16d511){var _0xcca3c3='';if(_0x16d511){_0xcca3c3='unreadMessages\x20{OPERATOR}\x200';if(_0x16d511==='1'){_0xcca3c3=_0xcca3c3[_0x0c6f('0x25')](_0x0c6f('0x26'),'=');}else{_0xcca3c3=_0xcca3c3[_0x0c6f('0x25')](_0x0c6f('0x26'),'>');}}return _0xcca3c3;}function parseSearchFilter(_0x48af4e,_0x2f0146){var _0x2c48ef=squel[_0x0c6f('0x22')]();if(_0x2f0146){var _0x36312f=_0x2f0146[_0x0c6f('0x25')]('\x5c','\x5c\x5c')[_0x0c6f('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x36312f)){_0x2c48ef['or']('i.id\x20LIKE\x20?',_0x36312f+'%');if(['sms',_0x0c6f('0x27')][_0x0c6f('0x28')](_0x48af4e)){_0x2c48ef['or'](_0x0c6f('0x29'),_0x36312f+'%');}else if(_0x48af4e===_0x0c6f('0x2a')){_0x2c48ef['or'](_0x0c6f('0x2b'),_0x36312f+'%');}else if(_0x48af4e===_0x0c6f('0x2c')){_0x2c48ef['or']('i.from\x20LIKE\x20?',_0x36312f+'%');}}else if(_0x48af4e===_0x0c6f('0x2d')&&qs['isEmail'](_0x36312f)){_0x2c48ef['or'](_0x0c6f('0x2e'),_0x36312f+'%');}else{if(_0x48af4e===_0x0c6f('0x2d')){_0x2c48ef['or'](_0x0c6f('0x2f'),qs[_0x0c6f('0x30')](_0x36312f,!![]))['or'](_0x0c6f('0x31'),qs[_0x0c6f('0x30')](_0x36312f));}else if(_0x48af4e!==_0x0c6f('0x2a')){_0x2c48ef['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x36312f));}_0x2c48ef['or'](_0x0c6f('0x32'),qs[_0x0c6f('0x30')](_0x36312f,!![]),null);}}return _0x2c48ef;}function parseAdvancedSearchFilter(_0x295352,_0x4e9325){var _0x1cea71=getSqlClauses();var _0x5b3f7d=as['parseSearch'](_0x295352);var _0x109c90=_0x5b3f7d['sqlOperator'];for(var _0x14812e=0x0;_0x14812e<_0x5b3f7d['conditions']['length'];_0x14812e++){var _0x53e0a=_0x5b3f7d[_0x0c6f('0x33')][_0x14812e];var _0x979607='i';var _0x562935=_['find'](_0x4e9325,[_0x0c6f('0xb'),_0x53e0a[_0x0c6f('0xa')]]);if(_0x562935){var _0x485e80=as[_0x0c6f('0x34')](_0x979607,_0x562935[_0x0c6f('0x35')],_0x53e0a);_0x1cea71['default'][_0x109c90](_0x485e80['text'],_0x485e80[_0x0c6f('0x36')][_0x0c6f('0x37')],_0x485e80[_0x0c6f('0x36')][_0x0c6f('0x38')]);}else{switch(_0x53e0a[_0x0c6f('0xa')]){case _0x0c6f('0x39'):var _0x223b15=parseReadParameter(_0x53e0a[_0x0c6f('0x36')]);_0x1cea71[_0x0c6f('0x3a')]['and'](_0x223b15);break;case'Contact':if(_0x53e0a[_0x0c6f('0x3b')]===_0x0c6f('0x3c')){if(_0x53e0a[_0x0c6f('0x36')][_0x0c6f('0x3d')]('\x20')[_0x0c6f('0x15')]>0x1){_0x1cea71[_0x0c6f('0x3e')][_0x109c90]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0c6f('0x30')](_0x53e0a[_0x0c6f('0x36')],!![]),null);}else{var _0x1a9be6='%'+_0x53e0a[_0x0c6f('0x36')]+'%';_0x1cea71[_0x0c6f('0x3e')][_0x109c90]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1a9be6,_0x1a9be6,_0x1a9be6);}}else{_0x562935=_['find'](_0x4e9325,[_0x0c6f('0xb'),_0x0c6f('0x3f')]);_0x53e0a[_0x0c6f('0xa')]=_0x0c6f('0x3f');_0x485e80=as[_0x0c6f('0x34')](_0x979607,_0x562935[_0x0c6f('0x35')],_0x53e0a);_0x1cea71[_0x0c6f('0x3e')][_0x109c90](_0x485e80[_0x0c6f('0x40')],_0x485e80['value'][_0x0c6f('0x37')],_0x485e80[_0x0c6f('0x36')][_0x0c6f('0x38')]);}break;case _0x0c6f('0x41'):var _0x329caf=_0x53e0a['value']['split'](',')['map'](function(_0x248fb4){return Number(_0x248fb4);});var _0x25a58f=parseTagParameter(_0x329caf);_0x1cea71[_0x0c6f('0x42')][_0x0c6f('0x43')][_0x0c6f('0x44')](_0x25a58f);_0x1cea71[_0x0c6f('0x42')][_0x0c6f('0x45')]=_0x329caf;break;case _0x0c6f('0x46'):if(_0x53e0a[_0x0c6f('0x3b')]===_0x0c6f('0x3c')){_0x1cea71[_0x0c6f('0x47')][_0x109c90](_0x0c6f('0x48'),'%'+_0x53e0a[_0x0c6f('0x36')]+'%',null);}else{_0x562935=_[_0x0c6f('0x49')](_0x4e9325,['name',_0x0c6f('0x4a')]);_0x53e0a['field']=_0x0c6f('0x4a');_0x485e80=as['buildExpression'](_0x979607,_0x562935[_0x0c6f('0x35')],_0x53e0a);_0x1cea71['user'][_0x109c90](_0x485e80[_0x0c6f('0x40')],_0x485e80['value'][_0x0c6f('0x37')],_0x485e80[_0x0c6f('0x36')][_0x0c6f('0x38')]);}break;case _0x0c6f('0x4b'):case _0x0c6f('0x4c'):_0x485e80=as[_0x0c6f('0x34')]('me',null,_0x53e0a);_0x1cea71['body'][_0x109c90](_0x485e80['text'],_0x485e80[_0x0c6f('0x36')][_0x0c6f('0x37')],_0x485e80[_0x0c6f('0x36')][_0x0c6f('0x38')]);break;}}}return _0x1cea71;}function parseModelFields(_0x49fb62,_0x5f0e44,_0x4a140c){var _0x5819ba=utils['getAccountFK'](_0x49fb62);var _0x36c77b=squel[_0x0c6f('0x22')]();var _0x3045ee=_(_0x5f0e44)[_0x0c6f('0x4d')]()[_0x0c6f('0x4e')](function(_0x83f867){return _[_0x0c6f('0x4f')](_0x4a140c,[_0x0c6f('0xb'),_0x83f867])?_0x83f867:undefined;})[_0x0c6f('0x50')]()['value']();if(_0x3045ee[_0x0c6f('0x15')]>0x0){_0x3045ee[_0x0c6f('0x24')](function(_0x58aa97){if(_0x58aa97===_0x5819ba){_0x36c77b[_0x0c6f('0x44')]('i.'+_0x5819ba+_0x0c6f('0x17'),[][_0x0c6f('0x51')](_0x5f0e44[_0x58aa97]));}else if(_0x58aa97===_0x0c6f('0x52')){var _0x1898c4=JSON[_0x0c6f('0x53')](_0x5f0e44[_0x58aa97])[_0x0c6f('0x54')];var _0x531615=JSON[_0x0c6f('0x53')](_0x5f0e44[_0x58aa97])[_0x0c6f('0x55')];_0x36c77b['and'](_0x0c6f('0x56'),_0x1898c4,_0x531615);}else{if(_0x5f0e44[_0x58aa97]===_0x0c6f('0x57')){_0x36c77b[_0x0c6f('0x44')]('i.'+_0x58aa97+_0x0c6f('0x58'));}else{_0x36c77b[_0x0c6f('0x44')]('i.'+_0x58aa97+_0x0c6f('0x59'),_0x5f0e44[_0x58aa97]);}}});}return _0x36c77b;}function parseQueryParameters(_0x3236cb,_0x34a1ed,_0x4b888f){var _0x9c5a81=getSqlClauses();return Promise['resolve']()[_0x0c6f('0x5a')](function(){return parseModelFields(_0x3236cb,_0x34a1ed,_0x4b888f);})['then'](function(_0x28fb77){_0x9c5a81['fields']['and'](_0x28fb77);return parseReadParameter(_0x34a1ed['read']);})[_0x0c6f('0x5a')](function(_0x4c476e){_0x9c5a81[_0x0c6f('0x3a')][_0x0c6f('0x44')](_0x4c476e);return parseTagParameter(_0x34a1ed[_0x0c6f('0x5b')]);})['then'](function(_0x47ff5b){_0x9c5a81[_0x0c6f('0x42')][_0x0c6f('0x43')][_0x0c6f('0x44')](_0x47ff5b);return parseSearchFilter(_0x3236cb,_0x34a1ed[_0x0c6f('0x5c')]);})['then'](function(_0x2c78a4){_0x9c5a81['filter']=_0x2c78a4;return _0x9c5a81;});}function checkAccountsRestrictions(_0x402736,_0x2c7dd4,_0x24ec18){var _0x1f1bfb=utils[_0x0c6f('0x7')](_0x402736);var _0x25fdda=_0x0c6f('0x5d')+_['capitalize'](_0x402736)+(_0x402736==='chat'?'Websites':'Accounts');var _0x1c47de=squel[_0x0c6f('0x22')]();return Promise[_0x0c6f('0x5e')]()[_0x0c6f('0x5a')](function(){if(_0x24ec18[_0x0c6f('0x5f')]&&_0x2c7dd4[_0x0c6f('0x8')]===_0x0c6f('0x60')){return _0x2c7dd4[_0x25fdda]({'attributes':['id'],'raw':!![]});}})[_0x0c6f('0x5a')](function(_0x6b892){if(_0x6b892){if(_0x6b892[_0x0c6f('0x15')]===0x0){_0x1c47de[_0x0c6f('0x44')]('i.'+_0x1f1bfb+_0x0c6f('0x58'));}else{_0x1c47de[_0x0c6f('0x44')]('i.'+_0x1f1bfb+_0x0c6f('0x17'),_['map'](_0x6b892,'id'));}}else if(!_0x24ec18[_0x1f1bfb]){_0x1c47de['and']('i.'+_0x1f1bfb+_0x0c6f('0x61'));}})['then'](function(){return _0x1c47de;});}function getClosedOrderClause(_0x102734,_0x110721){var _0x78d0c='';var _0x8930fc=[_0x0c6f('0x62'),'i.secondDisposition',_0x0c6f('0x63')];if(_0x102734===_0x0c6f('0x2d')){_0x8930fc[_0x0c6f('0x64')]('i.substatus');}if(_0x110721[_0x0c6f('0x65')]==='0'&&_0x102734===_0x0c6f('0x2d')){_0x78d0c='i.substatus';}else{if(_0x110721[_0x0c6f('0x65')]==='1'){_0x8930fc[_0x0c6f('0x66')]();}_0x78d0c=_0x0c6f('0x67')+_0x8930fc[_0x0c6f('0x68')](',\x20')+')';}return _0x78d0c;}function getFilteredInteractions(_0x35b1ea,_0x5a4a44,_0x302a1b,_0x1770bf){var _0x1361d7=utils[_0x0c6f('0x19')](_0x35b1ea);var _0x1012f4=_['capitalize'](_0x35b1ea)+_0x0c6f('0x69');var _0x2c0445=[];var _0x51fb41=getTagsQuery();var _0x5a1201={'type':db[_0x0c6f('0x6a')]['QueryTypes'][_0x0c6f('0x6b')],'raw':!![]};var _0x588742=[];var _0x2b9a08=[];return db[_0x0c6f('0x6c')][_0x0c6f('0x6d')](_0x51fb41[_0x0c6f('0x6e')](),_0x5a1201)['then'](function(_0x15a4c0){_0x2c0445=_[_0x0c6f('0x6f')](_0x15a4c0,'id');_0x5a1201=_[_0x0c6f('0x70')](_0x5a1201,{'model':db[_0x1012f4],'mapToModel':!![],'nest':!![]});if(_0x302a1b['fields']){_0x1770bf[_0x0c6f('0x71')][_0x0c6f('0x24')](function(_0x1fc327){_0x5a4a44[_0x0c6f('0xa')]('i.'+_0x1fc327);});}else{_0x5a4a44[_0x0c6f('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5a4a44[_0x0c6f('0xa')]('a.key','Account.key');_0x5a4a44[_0x0c6f('0xa')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x35b1ea===_0x0c6f('0x2d')){_0x5a4a44['field'](_0x0c6f('0x72'),_0x0c6f('0x73'));_0x5a4a44['field'](_0x0c6f('0x74'),'contactName');_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x75'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x76'));_0x5a4a44[_0x0c6f('0xa')]('i.updatedAt');_0x5a4a44['field'](_0x0c6f('0x77'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x78'));_0x5a4a44['field'](_0x0c6f('0x79'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x7a'));_0x5a4a44['field'](_0x0c6f('0x7b'));_0x5a4a44['field'](_0x0c6f('0x7c'));_0x5a4a44['field'](_0x0c6f('0x63'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x7d'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x62'));_0x5a4a44[_0x0c6f('0xa')]('i.substatus');_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x7e'));_0x5a4a44['field'](_0x0c6f('0x7f'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x80'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x81'));}else if(_0x35b1ea===_0x0c6f('0x2c')){_0x5a4a44['field']('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',_0x0c6f('0x82'));}else{_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x83'),_0x0c6f('0x82'));}if(_0x35b1ea!==_0x0c6f('0x2d')){_0x5a4a44[_0x0c6f('0xa')]('i.*');}_0x5a4a44[_0x0c6f('0xa')]('c.firstName','Contact.firstName');_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x84'),'Contact.lastName');_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x85'),_0x0c6f('0x86'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x87'),_0x0c6f('0x88'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x89'),_0x0c6f('0x8a'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x8b'),'Contact.fax');_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x8c'),_0x0c6f('0x8d'));_0x5a4a44[_0x0c6f('0xa')]('o.internal',_0x0c6f('0x8e'));_0x5a4a44[_0x0c6f('0xa')](_0x0c6f('0x8f'),'TagIds');}if(_0x1770bf[_0x0c6f('0x90')]){_0x5a4a44[_0x0c6f('0x90')](_0x1770bf[_0x0c6f('0x90')]);}if(_0x1770bf[_0x0c6f('0x91')]){_0x5a4a44[_0x0c6f('0x91')](_0x1770bf[_0x0c6f('0x91')]);}return db[_0x0c6f('0x6c')][_0x0c6f('0x6d')](_0x5a4a44['toString'](),_0x5a1201);})[_0x0c6f('0x5a')](function(_0x173787){_0x588742=_0x173787;var _0x440430=getUsersQuery(_0x35b1ea,_0x588742);return db[_0x0c6f('0x6c')][_0x0c6f('0x6d')](_0x440430['toString'](),_0x5a1201);})['then'](function(_0x157ec8){_0x2b9a08=_[_0x0c6f('0x92')](_0x157ec8,_0x1361d7);if(_0x35b1ea==='mail'){return db[_0x0c6f('0x93')][_0x0c6f('0x94')]({'attributes':[_0x0c6f('0x95')],'raw':!![]});}})['then'](function(_0x4974a1){var _0x40ff90=_0x4974a1?_0x4974a1[_0x0c6f('0x95')]:undefined;var _0x4d2d79=_0x588742[_0x0c6f('0x4e')](function(_0x6e5b2f){return updateInteraction(_0x6e5b2f,_0x2c0445,_0x2b9a08,_0x40ff90);});return Promise['all'](_0x4d2d79);});}function countFilteredInteractions(_0x3f4f27,_0x452244){var _0x4f4fb8=_0x3f4f27['clone']();_0x4f4fb8[_0x0c6f('0xa')](_0x0c6f('0x96'));_0x4f4fb8[_0x0c6f('0xa')](_0x0c6f('0x97'),_0x0c6f('0x39'));var _0x3cf2af=utils[_0x0c6f('0x23')](_0x452244);if(!_['isEmpty'](_0x3cf2af)){_0x4f4fb8['where'](_0x0c6f('0x98'),_0x3cf2af);}var _0x4e11b3={'type':db[_0x0c6f('0x6a')][_0x0c6f('0x99')][_0x0c6f('0x6b')],'raw':!![]};return db[_0x0c6f('0x6c')][_0x0c6f('0x6d')](_0x4f4fb8[_0x0c6f('0x6e')](),_0x4e11b3);}module[_0x0c6f('0x9a')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x9723=['tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','read','filter','capitalize','Websites','\x20IS\x20NULL','\x20IN\x20?','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Sequelize','SELECT','sequelize','query','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','a.email','Account.email','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','./update-interaction','updateInteraction','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','map','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','accounts','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','forEach','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','value','start','end','unreadMessages','and','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag'];(function(_0x51aee3,_0x30c7e4){var _0x346280=function(_0x456939){while(--_0x456939){_0x51aee3['push'](_0x51aee3['shift']());}};_0x346280(++_0x30c7e4);}(_0x9723,0x198));var _0x3972=function(_0x5e6cb8,_0x1d1eb5){_0x5e6cb8=_0x5e6cb8-0x0;var _0x41754f=_0x9723[_0x5e6cb8];return _0x41754f;};'use strict';var _=require(_0x3972('0x0'));var squel=require('squel');var as=require(_0x3972('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x3972('0x2'))[_0x3972('0x3')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x5d8acb,_0x10357b,_0x13b02b){var _0x7924cf=![];var _0x46e135=utils[_0x3972('0x4')](_0x5d8acb);if(_0x10357b[_0x3972('0x5')]===_0x3972('0x6')&&!_0x13b02b[_0x3972('0x7')]&&!_0x13b02b[_0x46e135]){_0x7924cf=!![];}return _0x7924cf;}function getTagsQuery(){return squel[_0x3972('0x8')]()[_0x3972('0x9')]('id')[_0x3972('0x9')](_0x3972('0xa'))['field'](_0x3972('0xb'))[_0x3972('0xc')](_0x3972('0xd'));}function getUsersQuery(_0x24628b,_0x7dec01){var _0x5a36ce=utils[_0x3972('0xe')](_0x24628b);var _0x41b43a=_0x3972('0xf')+_0x24628b+_0x3972('0x10');var _0x2e6e97=squel['select']()[_0x3972('0x9')]('u.id')[_0x3972('0x9')](_0x3972('0x11'))[_0x3972('0x9')](_0x3972('0x12')+_0x5a36ce)[_0x3972('0xc')](_0x41b43a,'ui')[_0x3972('0x13')]('users','u',_0x3972('0x14'));if(_0x7dec01[_0x3972('0x15')]>0x0){_0x2e6e97['where'](_0x3972('0x12')+_0x5a36ce+'\x20IN\x20?',_[_0x3972('0x16')](_0x7dec01,'id'));}return _0x2e6e97;}function getInteractionsQuery(_0x592360){var _0x3de7e6=utils['getInteractionsTables'](_0x592360);var _0x399f0a=utils[_0x3972('0x4')](_0x592360);var _0x5ee44e=utils[_0x3972('0xe')](_0x592360);return squel['select']()[_0x3972('0xc')](_0x3de7e6['interactions'],'i')[_0x3972('0x13')]('cm_contacts','c',_0x3972('0x17'))['left_join'](_0x3972('0x18'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x3de7e6[_0x3972('0x19')],'a','a.id\x20=\x20i.'+_0x399f0a)['left_join'](_0x3de7e6[_0x3972('0x1a')],'me',_0x3972('0x1b')+_0x5ee44e+_0x3972('0x1c'))[_0x3972('0x13')](_0x3de7e6['interactionsTags'],'it',_0x3972('0x1d')+_0x5ee44e+_0x3972('0x1c'))[_0x3972('0x13')](_0x3972('0xd'),'t',_0x3972('0x1e'));}function getSqlClauses(){var _0x4b5394={'body':squel[_0x3972('0x1f')](),'contact':squel['expr'](),'default':squel[_0x3972('0x1f')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x3972('0x1f')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x4b5394;}function parseTagParameter(_0x47af5d){var _0x48f151=squel[_0x3972('0x1f')]();if(_0x47af5d){var _0x314783=utils['getSelectedTags'](_0x47af5d);_0x314783[_0x3972('0x20')](function(_0x3e1156){_0x48f151['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e1156+',%');});}return _0x48f151;}function parseReadParameter(_0x5ee668){var _0x3d9e14='';if(_0x5ee668){_0x3d9e14='unreadMessages\x20{OPERATOR}\x200';if(_0x5ee668==='1'){_0x3d9e14=_0x3d9e14[_0x3972('0x21')](_0x3972('0x22'),'=');}else{_0x3d9e14=_0x3d9e14['replace'](_0x3972('0x22'),'>');}}return _0x3d9e14;}function parseSearchFilter(_0x13f1da,_0x37650d){var _0x319a50=squel[_0x3972('0x1f')]();if(_0x37650d){var _0xcc3883=_0x37650d[_0x3972('0x21')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0xcc3883)){_0x319a50['or'](_0x3972('0x23'),_0xcc3883+'%');if([_0x3972('0x24'),_0x3972('0x25')][_0x3972('0x26')](_0x13f1da)){_0x319a50['or'](_0x3972('0x27'),_0xcc3883+'%');}else if(_0x13f1da===_0x3972('0x28')){_0x319a50['or'](_0x3972('0x29'),_0xcc3883+'%');}else if(_0x13f1da===_0x3972('0x2a')){_0x319a50['or'](_0x3972('0x2b'),_0xcc3883+'%');}}else if(_0x13f1da===_0x3972('0x2c')&&qs[_0x3972('0x2d')](_0xcc3883)){_0x319a50['or'](_0x3972('0x2e'),_0xcc3883+'%');}else{if(_0x13f1da==='mail'){_0x319a50['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3972('0x2f')](_0xcc3883,!![]))['or'](_0x3972('0x30'),qs[_0x3972('0x2f')](_0xcc3883));}else if(_0x13f1da!==_0x3972('0x28')){_0x319a50['or'](_0x3972('0x31'),qs[_0x3972('0x2f')](_0xcc3883));}_0x319a50['or'](_0x3972('0x32'),qs[_0x3972('0x2f')](_0xcc3883,!![]),null);}}return _0x319a50;}function parseAdvancedSearchFilter(_0x529972,_0x59e8a0){var _0x2fde9e=getSqlClauses();var _0x2f8c80=as[_0x3972('0x33')](_0x529972);var _0x2cde3f=_0x2f8c80[_0x3972('0x34')];for(var _0x59a840=0x0;_0x59a840<_0x2f8c80[_0x3972('0x35')]['length'];_0x59a840++){var _0xe2365=_0x2f8c80[_0x3972('0x35')][_0x59a840];var _0x4b0a4d='i';var _0x1f40d7=_[_0x3972('0x36')](_0x59e8a0,[_0x3972('0xa'),_0xe2365[_0x3972('0x9')]]);if(_0x1f40d7){var _0x3893ac=as[_0x3972('0x37')](_0x4b0a4d,_0x1f40d7[_0x3972('0x38')],_0xe2365);_0x2fde9e['default'][_0x2cde3f](_0x3893ac[_0x3972('0x39')],_0x3893ac[_0x3972('0x3a')][_0x3972('0x3b')],_0x3893ac['value'][_0x3972('0x3c')]);}else{switch(_0xe2365[_0x3972('0x9')]){case _0x3972('0x3d'):var _0x436014=parseReadParameter(_0xe2365[_0x3972('0x3a')]);_0x2fde9e['read'][_0x3972('0x3e')](_0x436014);break;case'Contact':if(_0xe2365[_0x3972('0x3f')]==='$substring'){if(_0xe2365[_0x3972('0x3a')][_0x3972('0x40')]('\x20')[_0x3972('0x15')]>0x1){_0x2fde9e[_0x3972('0x41')][_0x2cde3f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3972('0x2f')](_0xe2365[_0x3972('0x3a')],!![]),null);}else{var _0x23bee3='%'+_0xe2365['value']+'%';_0x2fde9e[_0x3972('0x41')][_0x2cde3f](_0x3972('0x42'),_0x23bee3,_0x23bee3,_0x23bee3);}}else{_0x1f40d7=_['find'](_0x59e8a0,[_0x3972('0xa'),_0x3972('0x43')]);_0xe2365[_0x3972('0x9')]=_0x3972('0x43');_0x3893ac=as[_0x3972('0x37')](_0x4b0a4d,_0x1f40d7[_0x3972('0x38')],_0xe2365);_0x2fde9e[_0x3972('0x41')][_0x2cde3f](_0x3893ac[_0x3972('0x39')],_0x3893ac['value'][_0x3972('0x3b')],_0x3893ac[_0x3972('0x3a')][_0x3972('0x3c')]);}break;case _0x3972('0x44'):var _0x3d911d=_0xe2365['value'][_0x3972('0x40')](',')[_0x3972('0x16')](function(_0x4982d6){return Number(_0x4982d6);});var _0x2baf2b=parseTagParameter(_0x3d911d);_0x2fde9e[_0x3972('0x45')][_0x3972('0x46')]['and'](_0x2baf2b);_0x2fde9e[_0x3972('0x45')][_0x3972('0x47')]=_0x3d911d;break;case _0x3972('0x48'):if(_0xe2365[_0x3972('0x3f')]==='$substring'){_0x2fde9e[_0x3972('0x49')][_0x2cde3f](_0x3972('0x4a'),'%'+_0xe2365[_0x3972('0x3a')]+'%',null);}else{_0x1f40d7=_[_0x3972('0x36')](_0x59e8a0,[_0x3972('0xa'),_0x3972('0x4b')]);_0xe2365['field']=_0x3972('0x4b');_0x3893ac=as[_0x3972('0x37')](_0x4b0a4d,_0x1f40d7[_0x3972('0x38')],_0xe2365);_0x2fde9e['user'][_0x2cde3f](_0x3893ac[_0x3972('0x39')],_0x3893ac[_0x3972('0x3a')][_0x3972('0x3b')],_0x3893ac[_0x3972('0x3a')][_0x3972('0x3c')]);}break;case'body':case'plainBody':_0x3893ac=as[_0x3972('0x37')]('me',null,_0xe2365);_0x2fde9e[_0x3972('0x4c')][_0x2cde3f](_0x3893ac[_0x3972('0x39')],_0x3893ac[_0x3972('0x3a')][_0x3972('0x3b')],_0x3893ac['value'][_0x3972('0x3c')]);break;}}}return _0x2fde9e;}function parseModelFields(_0x3c493a,_0x1ff93b,_0x13b361){var _0x4f893b=utils[_0x3972('0x4')](_0x3c493a);var _0x8a0cf3=squel[_0x3972('0x1f')]();var _0x55466d=_(_0x1ff93b)[_0x3972('0x4d')]()[_0x3972('0x16')](function(_0x1ad600){return _['some'](_0x13b361,[_0x3972('0xa'),_0x1ad600])?_0x1ad600:undefined;})[_0x3972('0x4e')]()[_0x3972('0x3a')]();if(_0x55466d[_0x3972('0x15')]>0x0){_0x55466d[_0x3972('0x20')](function(_0x58999b){if(_0x58999b===_0x4f893b){_0x8a0cf3['and']('i.'+_0x4f893b+'\x20IN\x20?',[][_0x3972('0x4f')](_0x1ff93b[_0x58999b]));}else if(_0x58999b===_0x3972('0x50')){var _0x486474=JSON[_0x3972('0x51')](_0x1ff93b[_0x58999b])[_0x3972('0x52')];var _0x3647a3=JSON['parse'](_0x1ff93b[_0x58999b])[_0x3972('0x53')];_0x8a0cf3['and'](_0x3972('0x54'),_0x486474,_0x3647a3);}else{if(_0x1ff93b[_0x58999b]===_0x3972('0x55')){_0x8a0cf3['and']('i.'+_0x58999b+'\x20IS\x20NULL');}else{_0x8a0cf3[_0x3972('0x3e')]('i.'+_0x58999b+_0x3972('0x56'),_0x1ff93b[_0x58999b]);}}});}return _0x8a0cf3;}function parseQueryParameters(_0x34798e,_0x122a57,_0x15df92){var _0x126b85=getSqlClauses();return Promise[_0x3972('0x57')]()[_0x3972('0x58')](function(){return parseModelFields(_0x34798e,_0x122a57,_0x15df92);})[_0x3972('0x58')](function(_0x13cb6e){_0x126b85[_0x3972('0x59')]['and'](_0x13cb6e);return parseReadParameter(_0x122a57['read']);})[_0x3972('0x58')](function(_0x39f2c9){_0x126b85[_0x3972('0x5a')]['and'](_0x39f2c9);return parseTagParameter(_0x122a57['tag']);})['then'](function(_0x1d058b){_0x126b85['tags'][_0x3972('0x46')][_0x3972('0x3e')](_0x1d058b);return parseSearchFilter(_0x34798e,_0x122a57[_0x3972('0x5b')]);})['then'](function(_0x5bb789){_0x126b85['filter']=_0x5bb789;return _0x126b85;});}function checkAccountsRestrictions(_0x1ea206,_0x583734,_0x4d73a3){var _0x21cbb5=utils['getAccountFK'](_0x1ea206);var _0x185cb0='get'+_[_0x3972('0x5c')](_0x1ea206)+(_0x1ea206==='chat'?_0x3972('0x5d'):'Accounts');var _0xfa993=squel[_0x3972('0x1f')]();return Promise[_0x3972('0x57')]()[_0x3972('0x58')](function(){if(_0x4d73a3['search']&&_0x583734['role']==='agent'){return _0x583734[_0x185cb0]({'attributes':['id'],'raw':!![]});}})[_0x3972('0x58')](function(_0x403d82){if(_0x403d82){if(_0x403d82[_0x3972('0x15')]===0x0){_0xfa993[_0x3972('0x3e')]('i.'+_0x21cbb5+_0x3972('0x5e'));}else{_0xfa993[_0x3972('0x3e')]('i.'+_0x21cbb5+_0x3972('0x5f'),_[_0x3972('0x16')](_0x403d82,'id'));}}else if(!_0x4d73a3[_0x21cbb5]){_0xfa993[_0x3972('0x3e')]('i.'+_0x21cbb5+_0x3972('0x60'));}})['then'](function(){return _0xfa993;});}function getClosedOrderClause(_0x5ddea9,_0x526f71){var _0x5cad53='';var _0x380d34=['i.thirdDisposition',_0x3972('0x61'),_0x3972('0x62')];if(_0x5ddea9===_0x3972('0x2c')){_0x380d34[_0x3972('0x63')](_0x3972('0x64'));}if(_0x526f71[_0x3972('0x65')]==='0'&&_0x5ddea9===_0x3972('0x2c')){_0x5cad53='i.substatus';}else{if(_0x526f71['closed']==='1'){_0x380d34[_0x3972('0x66')]();}_0x5cad53=_0x3972('0x67')+_0x380d34['join'](',\x20')+')';}return _0x5cad53;}function getFilteredInteractions(_0x9fb426,_0x18b014,_0x8e9ba8,_0x258402){var _0x508ea4=utils['getInteractionFK'](_0x9fb426);var _0x36ad95=_[_0x3972('0x5c')](_0x9fb426)+'Interaction';var _0x119a8e=[];var _0x2271c6=getTagsQuery();var _0x319b98={'type':db[_0x3972('0x68')]['QueryTypes'][_0x3972('0x69')],'raw':!![]};var _0x39c942=[];var _0x10cb86=[];return db[_0x3972('0x6a')][_0x3972('0x6b')](_0x2271c6['toString'](),_0x319b98)['then'](function(_0x364c4b){_0x119a8e=_[_0x3972('0x6c')](_0x364c4b,'id');_0x319b98=_[_0x3972('0x6d')](_0x319b98,{'model':db[_0x36ad95],'mapToModel':!![],'nest':!![]});if(_0x8e9ba8[_0x3972('0x59')]){_0x258402[_0x3972('0x6e')]['forEach'](function(_0x20921f){_0x18b014['field']('i.'+_0x20921f);});}else{_0x18b014[_0x3972('0x9')](_0x3972('0x6f'),_0x3972('0x3d'));_0x18b014['field']('a.key',_0x3972('0x70'));_0x18b014[_0x3972('0x9')](_0x3972('0x71'),'Account.mandatoryDisposition');if(_0x9fb426===_0x3972('0x2c')){_0x18b014[_0x3972('0x9')](_0x3972('0x72'),_0x3972('0x73'));_0x18b014['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x18b014['field']('i.id');_0x18b014[_0x3972('0x9')](_0x3972('0x74'));_0x18b014[_0x3972('0x9')](_0x3972('0x75'));_0x18b014[_0x3972('0x9')](_0x3972('0x76'));_0x18b014['field'](_0x3972('0x77'));_0x18b014['field'](_0x3972('0x78'));_0x18b014[_0x3972('0x9')](_0x3972('0x79'));_0x18b014[_0x3972('0x9')](_0x3972('0x7a'));_0x18b014[_0x3972('0x9')](_0x3972('0x7b'));_0x18b014['field'](_0x3972('0x62'));_0x18b014['field']('i.secondDisposition');_0x18b014[_0x3972('0x9')](_0x3972('0x7c'));_0x18b014[_0x3972('0x9')](_0x3972('0x64'));_0x18b014['field'](_0x3972('0x7d'));_0x18b014[_0x3972('0x9')](_0x3972('0x7e'));_0x18b014[_0x3972('0x9')]('i.MailAccountId');_0x18b014['field']('i.UserId');}else if(_0x9fb426===_0x3972('0x2a')){_0x18b014[_0x3972('0x9')](_0x3972('0x7f'),_0x3972('0x80'));}else{_0x18b014[_0x3972('0x9')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3972('0x80'));}if(_0x9fb426!==_0x3972('0x2c')){_0x18b014['field']('i.*');}_0x18b014[_0x3972('0x9')](_0x3972('0x81'),_0x3972('0x82'));_0x18b014[_0x3972('0x9')](_0x3972('0x83'),_0x3972('0x84'));_0x18b014[_0x3972('0x9')](_0x3972('0x85'),_0x3972('0x86'));_0x18b014[_0x3972('0x9')](_0x3972('0x87'),'Contact.phone');_0x18b014[_0x3972('0x9')](_0x3972('0x88'),'Contact.mobile');_0x18b014[_0x3972('0x9')](_0x3972('0x89'),_0x3972('0x8a'));_0x18b014['field'](_0x3972('0x8b'),_0x3972('0x8c'));_0x18b014['field'](_0x3972('0x8d'),_0x3972('0x8e'));_0x18b014[_0x3972('0x9')](_0x3972('0x8f'),_0x3972('0x90'));}if(_0x258402['limit']){_0x18b014[_0x3972('0x91')](_0x258402[_0x3972('0x91')]);}if(_0x258402['offset']){_0x18b014[_0x3972('0x92')](_0x258402[_0x3972('0x92')]);}return db[_0x3972('0x6a')][_0x3972('0x6b')](_0x18b014[_0x3972('0x93')](),_0x319b98);})[_0x3972('0x58')](function(_0x4c37ad){_0x39c942=_0x4c37ad;var _0x2a6570=getUsersQuery(_0x9fb426,_0x39c942);return db['sequelize'][_0x3972('0x6b')](_0x2a6570[_0x3972('0x93')](),_0x319b98);})[_0x3972('0x58')](function(_0x26c9fc){_0x10cb86=_[_0x3972('0x94')](_0x26c9fc,_0x508ea4);if(_0x9fb426==='mail'){return db[_0x3972('0x95')][_0x3972('0x96')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x56416e){var _0x538f61=_0x56416e?_0x56416e[_0x3972('0x97')]:undefined;var _0x7d9636=_0x39c942[_0x3972('0x16')](function(_0x2528d6){return updateInteraction(_0x2528d6,_0x119a8e,_0x10cb86,_0x538f61);});return Promise[_0x3972('0x98')](_0x7d9636);});}function countFilteredInteractions(_0x323955,_0x568e0a){var _0x3a866a=_0x323955[_0x3972('0x99')]();_0x3a866a[_0x3972('0x9')](_0x3972('0x9a'));_0x3a866a[_0x3972('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x4ae4f5=utils['getSelectedTags'](_0x568e0a);if(!_[_0x3972('0x9b')](_0x4ae4f5)){_0x3a866a[_0x3972('0x9c')](_0x3972('0x9d'),_0x4ae4f5);}var _0x4f57fb={'type':db[_0x3972('0x68')]['QueryTypes'][_0x3972('0x69')],'raw':!![]};return db['sequelize'][_0x3972('0x6b')](_0x3a866a[_0x3972('0x93')](),_0x4f57fb);}module[_0x3972('0x9e')]={'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 c7f2f29..a0ac694 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 _0x1271=['trimStart','catch','TagIds','lodash','../../mysqldb','map','split','forEach','push','waiting','answered','total','disposition','abandoned','talking','UserId','MailMessage','findOne','out','plainBody','then','lastMsgText'];(function(_0x2c15b3,_0x1c29fc){var _0x5808fb=function(_0x3c126c){while(--_0x3c126c){_0x2c15b3['push'](_0x2c15b3['shift']());}};_0x5808fb(++_0x1c29fc);}(_0x1271,0x163));var _0x1127=function(_0x1eb930,_0x18b2cd){_0x1eb930=_0x1eb930-0x0;var _0x27afe9=_0x1271[_0x1eb930];return _0x27afe9;};'use strict';var _=require(_0x1127('0x0'));var db=require(_0x1127('0x1'))['db'];function getInteractionUsers(_0x1a8289,_0x55fc31){return new Promise(function(_0x394255,_0x4375d0){try{var _0x49c7d7=[];if(_0x55fc31[_0x1a8289]){_0x49c7d7=_0x55fc31[_0x1a8289][_0x1127('0x2')](function(_0x51e93d){return{'id':_0x51e93d['id'],'fullname':_0x51e93d['fullname']};});}return _0x394255(_0x49c7d7);}catch(_0x5d1996){_0x4375d0(_0x5d1996);}});}function getInteractionTags(_0x514c47,_0x37ec60){var _0x5bb44e=[];if(_0x514c47){_0x514c47[_0x1127('0x3')](',')[_0x1127('0x4')](function(_0x53577a){_0x5bb44e[_0x1127('0x5')](_0x37ec60[_0x53577a]);});}return _0x5bb44e;}function updateWaitingCounter(_0x6417ad){if(_0x6417ad[_0x1127('0x6')]){_0x6417ad[_0x1127('0x6')]-=0x1;}}function updateInteractionCounters(_0x471be4){_0x471be4[_0x1127('0x6')]=0x0;_0x471be4['talking']=0x0;_0x471be4[_0x1127('0x7')]=0x0;_0x471be4['unmanaged']=0x0;_0x471be4['abandoned']=0x0;_0x471be4[_0x1127('0x8')]=0x0;if(_0x471be4['closed']){if(_0x471be4[_0x1127('0x9')]===_0x1127('0xa')){_0x471be4['abandoned']+=0x1;updateWaitingCounter(_0x471be4);}if(_0x471be4['UserId']){_0x471be4[_0x1127('0x7')]+=0x1;if(_0x471be4['talking']){_0x471be4[_0x1127('0xb')]-=0x1;}}else{if(_0x471be4[_0x1127('0x9')]){_0x471be4['unmanaged']+=0x1;updateWaitingCounter(_0x471be4);}}}else{if(!_0x471be4[_0x1127('0xc')]){_0x471be4[_0x1127('0x6')]+=0x1;}if(_0x471be4[_0x1127('0xc')]){_0x471be4[_0x1127('0xb')]+=0x1;updateWaitingCounter(_0x471be4);}}_0x471be4[_0x1127('0x8')]+=0x1;return _0x471be4;}function getLastMessageText(_0x40daf9){return db[_0x1127('0xd')][_0x1127('0xe')]({'where':{'$and':[{'MailInteractionId':_0x40daf9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1127('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1127('0x10')],'order':'-id','raw':!![]})[_0x1127('0x11')](function(_0xf2a5c1){if(_0xf2a5c1&&_0xf2a5c1[_0x1127('0x10')]){_0x40daf9[_0x1127('0x12')]=_[_0x1127('0x13')](_0xf2a5c1['plainBody']);}return _0x40daf9;})[_0x1127('0x14')](function(_0xcc0560){throw _0xcc0560;});}exports['updateInteraction']=function(_0x357913,_0x205b10,_0x4a890a,_0x39e408){return new Promise(function(_0x13ae4e,_0x569671){return getInteractionUsers(_0x357913['id'],_0x4a890a)[_0x1127('0x11')](function(_0x4e98ea){_0x357913['Users']=_0x4e98ea;return getInteractionTags(_0x357913[_0x1127('0x15')],_0x205b10);})[_0x1127('0x11')](function(_0xa75b89){_0x357913['Tags']=_0xa75b89;delete _0x357913[_0x1127('0x15')];return updateInteractionCounters(_0x357913);})[_0x1127('0x11')](function(_0xa323b5){if(_0x39e408){return getLastMessageText(_0xa323b5);}else{return _0xa323b5;}})[_0x1127('0x11')](function(_0x106a0c){_0x13ae4e(_0x106a0c);})['catch'](function(_0x5d0ae5){_0x569671(_0x5d0ae5);});});}; \ No newline at end of file +var _0xa30d=['../../mysqldb','map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','disposition','UserId','talking','MailMessage','findOne','-id','then','plainBody','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa30d,0x67));var _0xda30=function(_0x5edf2d,_0x36fca4){_0x5edf2d=_0x5edf2d-0x0;var _0x1c3216=_0xa30d[_0x5edf2d];return _0x1c3216;};'use strict';var _=require(_0xda30('0x0'));var db=require(_0xda30('0x1'))['db'];function getInteractionUsers(_0x413486,_0x51b1cb){return new Promise(function(_0x5b3382,_0x3e5d93){try{var _0x442b82=[];if(_0x51b1cb[_0x413486]){_0x442b82=_0x51b1cb[_0x413486][_0xda30('0x2')](function(_0x2d0304){return{'id':_0x2d0304['id'],'fullname':_0x2d0304[_0xda30('0x3')]};});}return _0x5b3382(_0x442b82);}catch(_0x4477d7){_0x3e5d93(_0x4477d7);}});}function getInteractionTags(_0x50665a,_0x53ec0c){var _0x4fdc94=[];if(_0x50665a){_0x50665a[_0xda30('0x4')](',')[_0xda30('0x5')](function(_0xd3d259){_0x4fdc94[_0xda30('0x6')](_0x53ec0c[_0xd3d259]);});}return _0x4fdc94;}function updateWaitingCounter(_0x301389){if(_0x301389[_0xda30('0x7')]){_0x301389[_0xda30('0x7')]-=0x1;}}function updateInteractionCounters(_0x5a7d67){_0x5a7d67[_0xda30('0x7')]=0x0;_0x5a7d67['talking']=0x0;_0x5a7d67[_0xda30('0x8')]=0x0;_0x5a7d67[_0xda30('0x9')]=0x0;_0x5a7d67[_0xda30('0xa')]=0x0;_0x5a7d67[_0xda30('0xb')]=0x0;if(_0x5a7d67['closed']){if(_0x5a7d67[_0xda30('0xc')]===_0xda30('0xa')){_0x5a7d67[_0xda30('0xa')]+=0x1;updateWaitingCounter(_0x5a7d67);}if(_0x5a7d67[_0xda30('0xd')]){_0x5a7d67[_0xda30('0x8')]+=0x1;if(_0x5a7d67[_0xda30('0xe')]){_0x5a7d67['talking']-=0x1;}}else{if(_0x5a7d67['disposition']){_0x5a7d67[_0xda30('0x9')]+=0x1;updateWaitingCounter(_0x5a7d67);}}}else{if(!_0x5a7d67[_0xda30('0xd')]){_0x5a7d67[_0xda30('0x7')]+=0x1;}if(_0x5a7d67[_0xda30('0xd')]){_0x5a7d67[_0xda30('0xe')]+=0x1;updateWaitingCounter(_0x5a7d67);}}_0x5a7d67[_0xda30('0xb')]+=0x1;return _0x5a7d67;}function getLastMessageText(_0xb0a7e7){return db[_0xda30('0xf')][_0xda30('0x10')]({'where':{'$and':[{'MailInteractionId':_0xb0a7e7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xda30('0x11'),'raw':!![]})[_0xda30('0x12')](function(_0x138455){if(_0x138455&&_0x138455[_0xda30('0x13')]){_0xb0a7e7['lastMsgText']=_[_0xda30('0x14')](_0x138455[_0xda30('0x13')]);}return _0xb0a7e7;})[_0xda30('0x15')](function(_0x76d36a){throw _0x76d36a;});}exports[_0xda30('0x16')]=function(_0x5d19b6,_0x5b1c90,_0x1dda76,_0x456b37){return new Promise(function(_0x1343b3,_0x561c1a){return getInteractionUsers(_0x5d19b6['id'],_0x1dda76)['then'](function(_0x18f3ac){_0x5d19b6[_0xda30('0x17')]=_0x18f3ac;return getInteractionTags(_0x5d19b6[_0xda30('0x18')],_0x5b1c90);})[_0xda30('0x12')](function(_0x2c3d50){_0x5d19b6[_0xda30('0x19')]=_0x2c3d50;delete _0x5d19b6[_0xda30('0x18')];return updateInteractionCounters(_0x5d19b6);})[_0xda30('0x12')](function(_0x2d2846){if(_0x456b37){return getLastMessageText(_0x2d2846);}else{return _0x2d2846;}})[_0xda30('0x12')](function(_0x1b2709){_0x1343b3(_0x1b2709);})[_0xda30('0x15')](function(_0x4947c2){_0x561c1a(_0x4947c2);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 028d69a..bc5c009 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 _0x6698=['upperFirst','unknown','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','info','catch','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId'];(function(_0xfdde5f,_0x3d173b){var _0x3c8e77=function(_0x3fc9dd){while(--_0x3fc9dd){_0xfdde5f['push'](_0xfdde5f['shift']());}};_0x3c8e77(++_0x3d173b);}(_0x6698,0x116));var _0x8669=function(_0x23c2f8,_0x1b1a34){_0x23c2f8=_0x23c2f8-0x0;var _0x5045e3=_0x6698[_0x23c2f8];return _0x5045e3;};'use strict';var _=require('lodash');var db=require(_0x8669('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x8669('0x1'))(_0x8669('0x2')),'fax':require('../../config/logger')(_0x8669('0x3')),'sms':require(_0x8669('0x1'))(_0x8669('0x4')),'chat':require('../../config/logger')(_0x8669('0x5')),'whatsapp':require('../../config/logger')(_0x8669('0x6'))};function getAccountFK(_0x340946){return _[_0x8669('0x7')](_0x340946)+(_0x340946===_0x8669('0x8')?_0x8669('0x9'):_0x8669('0xa'))+'Id';}function getInteractionFK(_0x133a62){return _['capitalize'](_0x133a62)+_0x8669('0xb');}function getInteractionId(_0x1d040c,_0x28648c,_0x25c722){if(_0x1d040c&&_0x1d040c[_['upperFirst'](_0x25c722)+'InteractionId']){return _0x1d040c[_[_0x8669('0xc')](_0x25c722)+'InteractionId'];}else if(_0x1d040c&&_0x1d040c['id']){return _0x1d040c['id'];}else if(_0x28648c&&_0x28648c['id']){return _0x28648c['id'];}else{return _0x8669('0xd');}}function getInteractionsTables(_0xd689d0){return{'accounts':_0xd689d0+'_'+(_0xd689d0==='chat'?_0x8669('0xe'):_0x8669('0xf')),'interactions':_0xd689d0+_0x8669('0x10'),'interactionsTags':_0xd689d0+'_interaction_has_tags','messages':_0xd689d0+_0x8669('0x11'),'userInteractions':'user_has_'+_0xd689d0+_0x8669('0x10')};}function getSelectedTags(_0x3a71a3){var _0x522a39=[];if(_0x3a71a3){_0x522a39=Array['isArray'](_0x3a71a3)?_0x3a71a3:[_0x3a71a3];}return _0x522a39;}function log(_0x1a510e,_0x20b620,_0x4b3657,_0x1c6287,_0x459bef,_0x4887a8){loggers[_0x459bef[_0x8669('0x12')]()][_0x1a510e](_0x8669('0x13'),_0x4887a8[_0x8669('0x14')](),_0x20b620?_0x20b620['id']:null,_0x20b620?_0x20b620['name']:null,_0x20b620?_0x20b620['role']:null,getInteractionId(_0x4b3657,_0x1c6287,_0x459bef),_0x4b3657?JSON[_0x8669('0x15')](_0x4b3657):_0x8669('0x16'));}function updateUser(_0x4f9514,_0x18cb14,_0x139c42,_0x3f0881,_0x4957e9){db[_[_0x8669('0xc')](_0x3f0881)+_0x8669('0x17')][_0x8669('0x18')]({'where':{'id':getInteractionId(_0x18cb14,_0x139c42,_0x3f0881)}})['then'](function(_0x14ebab){if(_0x14ebab){return _0x14ebab['update']({'UserId':_0x4f9514?_0x4f9514['id']:null});}})[_0x8669('0x19')](function(_0x485678){if(_0x485678){log(_0x8669('0x1a'),_0x4f9514,_0x18cb14,_0x139c42,_0x3f0881,_0x4957e9);}})[_0x8669('0x1b')](function(){log('error',_0x4f9514,_0x18cb14,_0x139c42,_0x3f0881,_0x4957e9);});}module[_0x8669('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xe126=['accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','Interaction','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','chat-interactions','whatsapp-interactions','chat','capitalize','InteractionId','upperFirst','websites'];(function(_0x5206fc,_0x2eec61){var _0x12acf6=function(_0x21c5aa){while(--_0x21c5aa){_0x5206fc['push'](_0x5206fc['shift']());}};_0x12acf6(++_0x2eec61);}(_0xe126,0x10d));var _0x6e12=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xe126[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x6e12('0x0'));var db=require(_0x6e12('0x1'))['db'];var loggers={'openchannel':require(_0x6e12('0x2'))(_0x6e12('0x3')),'mail':require(_0x6e12('0x2'))('mail-interactions'),'fax':require(_0x6e12('0x2'))('fax-interactions'),'sms':require(_0x6e12('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x6e12('0x4')),'whatsapp':require('../../config/logger')(_0x6e12('0x5'))};function getAccountFK(_0x1515cf){return _['capitalize'](_0x1515cf)+(_0x1515cf===_0x6e12('0x6')?'Website':'Account')+'Id';}function getInteractionFK(_0x1960e7){return _[_0x6e12('0x7')](_0x1960e7)+_0x6e12('0x8');}function getInteractionId(_0x165040,_0x5cec72,_0x1e1bf5){if(_0x165040&&_0x165040[_[_0x6e12('0x9')](_0x1e1bf5)+_0x6e12('0x8')]){return _0x165040[_[_0x6e12('0x9')](_0x1e1bf5)+_0x6e12('0x8')];}else if(_0x165040&&_0x165040['id']){return _0x165040['id'];}else if(_0x5cec72&&_0x5cec72['id']){return _0x5cec72['id'];}else{return'unknown';}}function getInteractionsTables(_0x5bc9f9){return{'accounts':_0x5bc9f9+'_'+(_0x5bc9f9===_0x6e12('0x6')?_0x6e12('0xa'):_0x6e12('0xb')),'interactions':_0x5bc9f9+_0x6e12('0xc'),'interactionsTags':_0x5bc9f9+_0x6e12('0xd'),'messages':_0x5bc9f9+_0x6e12('0xe'),'userInteractions':_0x6e12('0xf')+_0x5bc9f9+'_interactions'};}function getSelectedTags(_0x56df92){var _0x5eb19d=[];if(_0x56df92){_0x5eb19d=Array[_0x6e12('0x10')](_0x56df92)?_0x56df92:[_0x56df92];}return _0x5eb19d;}function log(_0x1e344e,_0x507b37,_0x2d2008,_0x4da1b0,_0x4aebda,_0x315d52){loggers[_0x4aebda[_0x6e12('0x11')]()][_0x1e344e](_0x6e12('0x12'),_0x315d52['toUpperCase'](),_0x507b37?_0x507b37['id']:null,_0x507b37?_0x507b37['name']:null,_0x507b37?_0x507b37[_0x6e12('0x13')]:null,getInteractionId(_0x2d2008,_0x4da1b0,_0x4aebda),_0x2d2008?JSON[_0x6e12('0x14')](_0x2d2008):_0x6e12('0x15'));}function updateUser(_0x17d319,_0x19bc92,_0x525ad4,_0x50a850,_0x762d09){db[_[_0x6e12('0x9')](_0x50a850)+_0x6e12('0x16')]['findOne']({'where':{'id':getInteractionId(_0x19bc92,_0x525ad4,_0x50a850)}})['then'](function(_0x5d5fb4){if(_0x5d5fb4){return _0x5d5fb4[_0x6e12('0x17')]({'UserId':_0x17d319?_0x17d319['id']:null});}})['then'](function(_0x72910d){if(_0x72910d){log(_0x6e12('0x18'),_0x17d319,_0x19bc92,_0x525ad4,_0x50a850,_0x762d09);}})[_0x6e12('0x19')](function(){log(_0x6e12('0x1a'),_0x17d319,_0x19bc92,_0x525ad4,_0x50a850,_0x762d09);});}module[_0x6e12('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 a3d640a..4bc2b55 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 _0xd2bc=['hasOwnProperty','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse'];(function(_0x4e2d12,_0x3d4649){var _0x2c2095=function(_0x21bb5e){while(--_0x21bb5e){_0x4e2d12['push'](_0x4e2d12['shift']());}};_0x2c2095(++_0x3d4649);}(_0xd2bc,0x186));var _0xcd2b=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xd2bc[_0x39d39d];return _0x577ac3;};'use strict';var crypto=require(_0xcd2b('0x0'));var util=require(_0xcd2b('0x1'));var compose=require(_0xcd2b('0x2'));var db=require(_0xcd2b('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1563be,_0x24d931){if(_0x1563be&&_0x24d931){if(_0x24d931['data1']&&_0x24d931[_0xcd2b('0x4')]){var _0x1f017f=_0x24d931['data1'];var _0x1a4f8c=_0x24d931['license'];var _0x4355c5=_0x1f017f[_0xcd2b('0x5')]('-')[0x4];var _0x1f5971=_0x1f017f[_0xcd2b('0x5')]('-')[0x0];var _0x3ce054=crypto[_0xcd2b('0x6')](_0xcd2b('0x7'),util[_0xcd2b('0x8')](_0xcd2b('0x9'),_0x4355c5,_0x1f017f,_0x1f5971));var _0x38619a=_0x3ce054[_0xcd2b('0xa')](_0x1a4f8c,_0xcd2b('0xb'),_0xcd2b('0xc'));_0x38619a+=_0x3ce054[_0xcd2b('0xd')](_0xcd2b('0xc'));var _0x4347ba=JSON[_0xcd2b('0xe')](_0x38619a);return _0x4347ba[_0xcd2b('0xf')](_0x1563be)?_0x4347ba[_0x1563be]:null;}}return null;}function isLimit(_0x28644d,_0x4989f7,_0x281860,_0x4421dd){var _0x10aa79=_0x4989f7;return compose()[_0xcd2b('0x10')](function(_0x211fd1,_0x52fb2b,_0x496883){return db[_0xcd2b('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xcd2b('0x12')](function(_0x3d78bb){var _0x9e0b26=getValueFromLicense(_0x28644d,_0x3d78bb);return _0x9e0b26?_0x9e0b26:_0x10aa79;})[_0xcd2b('0x12')](function(_0x416bb5){_0x10aa79=_0x416bb5;return _0x281860[_0xcd2b('0x13')](_0x4421dd);})[_0xcd2b('0x12')](function(_0xec5270){if(_0xec5270>=_0x10aa79){return _0x52fb2b[_0xcd2b('0x14')](0x193)[_0xcd2b('0x15')]({'message':util[_0xcd2b('0x8')](_0xcd2b('0x16'),_0x28644d)});}_0x496883();})[_0xcd2b('0x17')](function(_0x14b912){_0x496883(_0x14b912);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xcd2b('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0xcd2b('0x19')}]}});}exports[_0xcd2b('0x1a')]=isUserLimit; \ No newline at end of file +var _0xf11a=['%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format'];(function(_0x53957d,_0x2aedce){var _0x52e8f7=function(_0x59fb9f){while(--_0x59fb9f){_0x53957d['push'](_0x53957d['shift']());}};_0x52e8f7(++_0x2aedce);}(_0xf11a,0xf3));var _0xaf11=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xf11a[_0x5093e9];return _0x4c9a22;};'use strict';var crypto=require(_0xaf11('0x0'));var util=require(_0xaf11('0x1'));var compose=require('composable-middleware');var db=require(_0xaf11('0x2'))['db'];var config=require(_0xaf11('0x3'));function getValueFromLicense(_0x1adfd0,_0x489b0b){if(_0x1adfd0&&_0x489b0b){if(_0x489b0b[_0xaf11('0x4')]&&_0x489b0b[_0xaf11('0x5')]){var _0x380703=_0x489b0b[_0xaf11('0x4')];var _0xe6e66f=_0x489b0b[_0xaf11('0x5')];var _0x3103fe=_0x380703[_0xaf11('0x6')]('-')[0x4];var _0x5e5edb=_0x380703[_0xaf11('0x6')]('-')[0x0];var _0x20376b=crypto[_0xaf11('0x7')]('aes-256-ctr',util[_0xaf11('0x8')](_0xaf11('0x9'),_0x3103fe,_0x380703,_0x5e5edb));var _0x4a0829=_0x20376b[_0xaf11('0xa')](_0xe6e66f,_0xaf11('0xb'),_0xaf11('0xc'));_0x4a0829+=_0x20376b[_0xaf11('0xd')]('utf8');var _0xa5c3a=JSON[_0xaf11('0xe')](_0x4a0829);return _0xa5c3a[_0xaf11('0xf')](_0x1adfd0)?_0xa5c3a[_0x1adfd0]:null;}}return null;}function isLimit(_0x46d688,_0x5966d7,_0x5d586c,_0x4ecfaf){var _0x2a7ee8=_0x5966d7;return compose()[_0xaf11('0x10')](function(_0x454c21,_0x7fcb95,_0xf4d3c6){return db[_0xaf11('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xaf11('0x12')](function(_0x4877f5){var _0x47ef18=getValueFromLicense(_0x46d688,_0x4877f5);return _0x47ef18?_0x47ef18:_0x2a7ee8;})[_0xaf11('0x12')](function(_0x55b386){_0x2a7ee8=_0x55b386;return _0x5d586c[_0xaf11('0x13')](_0x4ecfaf);})[_0xaf11('0x12')](function(_0x2c04cc){if(_0x2c04cc>=_0x2a7ee8){return _0x7fcb95[_0xaf11('0x14')](0x193)[_0xaf11('0x15')]({'message':util[_0xaf11('0x8')](_0xaf11('0x16'),_0x46d688)});}_0xf4d3c6();})[_0xaf11('0x17')](function(_0x2cda71){_0xf4d3c6(_0x2cda71);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xaf11('0x18')],{'where':{'$or':[{'role':_0xaf11('0x19')},{'role':_0xaf11('0x1a')}]}});}exports[_0xaf11('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a2c8516..fa98829 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 _0x037b=['lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','split','length','forEach','shift','match','push','buildExpression','DATE','operator','$eq','$between','includes','$gt','value','add','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds'];(function(_0x2c18cd,_0x337bc9){var _0x44f917=function(_0x55beda){while(--_0x55beda){_0x2c18cd['push'](_0x2c18cd['shift']());}};_0x44f917(++_0x337bc9);}(_0x037b,0x198));var _0xb037=function(_0x413310,_0x50883b){_0x413310=_0x413310-0x0;var _0x48c11b=_0x037b[_0x413310];return _0x48c11b;};'use strict';var _=require(_0xb037('0x0'));var moment=require(_0xb037('0x1'));exports[_0xb037('0x2')]=function(_0xa14b34){var _0xbf4caf={'conditions':[]};_0xbf4caf[_0xb037('0x3')]=_[_0xb037('0x4')](_0xa14b34,'[$or]')?'or':'and';var _0x4835a9=_0xa14b34[_0xb037('0x5')](_0xb037('0x6'),'')[_0xb037('0x5')]('[$or]','')[_0xb037('0x7')]('||');for(var _0x215951=0x0;_0x215951<_0x4835a9[_0xb037('0x8')];_0x215951++){var _0x14e6a8=_0x4835a9[_0x215951][_0xb037('0x7')](':=');var _0x55298d=_0x14e6a8[0x0];var _0x36bc64=_0x14e6a8['slice'](0x1);_0x36bc64[_0xb037('0x9')](function(_0x51bd88){var _0x3a87db=_0x51bd88[_0xb037('0x7')]('[')[_0xb037('0xa')]();var _0x236f6b=_0x51bd88[_0xb037('0xb')](/\[(.*?)\]/g);_0x236f6b[_0xb037('0x9')](function(_0xb575eb){var _0x5b37d2=_0xb575eb['split']('[')['filter'](function(_0x1b6cea){return _0x1b6cea['indexOf'](']')>-0x1;})['map'](function(_0x5cf6d3){return _0x5cf6d3[_0xb037('0x7')](']')[0x0];})[0x0];_0xbf4caf['conditions'][_0xb037('0xc')]({'field':_0x55298d,'operator':_0x3a87db,'value':_0x5b37d2});});});}return _0xbf4caf;};exports[_0xb037('0xd')]=function(_0x44d4fb,_0x5399ec,_0x32f9e4){var _0x414ae0={};if(_0x5399ec===_0xb037('0xe')){if(_0x32f9e4[_0xb037('0xf')]===_0xb037('0x10')){_0x32f9e4[_0xb037('0xf')]=_0xb037('0x11');_0x32f9e4['value']+=','+_0x32f9e4['value'];}else if(_[_0xb037('0x12')]([_0xb037('0x13'),'$lte'],_0x32f9e4[_0xb037('0xf')])){_0x32f9e4[_0xb037('0x14')]=moment(_0x32f9e4[_0xb037('0x14')])[_0xb037('0x15')](0x1,_0xb037('0x16'))[_0xb037('0x17')](_0xb037('0x18'));}}if(_0x32f9e4[_0xb037('0x19')]){_0x5399ec=_0x32f9e4[_0xb037('0x19')];_0x414ae0['text']=_0xb037('0x1a')+_0x44d4fb+'.'+_0x32f9e4[_0xb037('0x1b')]+_0xb037('0x1c')+_0x32f9e4[_0xb037('0x19')]+')\x20'+parseOperator(_0x32f9e4['operator']);}else{_0x414ae0[_0xb037('0x1d')]=_0x44d4fb+'.'+_0x32f9e4['field']+'\x20'+parseOperator(_0x32f9e4[_0xb037('0xf')]);}if(_['includes']([_0xb037('0x1e'),_0xb037('0x1f')],_0x32f9e4[_0xb037('0xf')]))_0x414ae0[_0xb037('0x1d')]='('+_0x414ae0[_0xb037('0x1d')]+'\x20OR\x20'+_0x44d4fb+'.'+_0x32f9e4['field']+_0xb037('0x20');_0x414ae0['value']=parseValue(_0x5399ec,_0x32f9e4[_0xb037('0xf')],_0x32f9e4['value']);return _0x414ae0;};function parseOperator(_0x48324b){var _0x559183;switch(_0x48324b){case _0xb037('0x21'):_0x559183='IN\x20?';break;case _0xb037('0x1f'):_0x559183=_0xb037('0x22');break;case _0xb037('0x10'):_0x559183=_0xb037('0x23');break;case _0xb037('0x1e'):_0x559183='<>\x20?';break;case _0xb037('0x24'):case _0xb037('0x25'):case _0xb037('0x26'):_0x559183=_0xb037('0x27');break;case _0xb037('0x28'):_0x559183='<\x20?';break;case _0xb037('0x13'):_0x559183=_0xb037('0x29');break;case _0xb037('0x2a'):_0x559183=_0xb037('0x2b');break;case _0xb037('0x2c'):_0x559183='>=\x20?';break;case _0xb037('0x11'):_0x559183=_0xb037('0x2d');break;}return _0x559183;}function parseValue(_0x4287cf,_0x799dd4,_0x2e5e68){var _0x540e14={'start':undefined,'end':undefined};switch(_0x799dd4){case _0xb037('0x21'):case _0xb037('0x1f'):_0x540e14[_0xb037('0x2e')]=_0x2e5e68[_0xb037('0x7')](',');break;case _0xb037('0x24'):_0x540e14['start']='%'+_0x2e5e68+'%';break;case _0xb037('0x25'):_0x540e14['start']=_0x2e5e68+'%';break;case'$endsWith':_0x540e14['start']='%'+_0x2e5e68;break;case _0xb037('0x11'):var _0x4197d0=_0x2e5e68[_0xb037('0x7')](',');var _0x2e5e68=_0x4197d0[_0xb037('0xa')]();var _0x107ae4=_0x4197d0['pop']();if(_0x4287cf===_0xb037('0xe')){_0x2e5e68=moment(_0x2e5e68)[_0xb037('0x2f')](0x0,!![])[_0xb037('0x17')]();_0x107ae4=moment(_0x107ae4)[_0xb037('0x2f')](0x0,!![])[_0xb037('0x15')](0x17,_0xb037('0x30'))['add'](0x3b,_0xb037('0x31'))['add'](0x3b,_0xb037('0x32'))[_0xb037('0x17')]();}_0x540e14={'start':_0x2e5e68,'end':_0x107ae4};break;default:_0x540e14[_0xb037('0x2e')]=_0x2e5e68;break;}return _0x540e14;} \ No newline at end of file +var _0xb95d=['utcOffset','minutes','seconds','lodash','parseSearch','sqlOperator','and','replace','[$and]','[$or]','split','length','forEach','shift','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','$in','$eq','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','$gt','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','pop'];(function(_0x38b170,_0x14d12b){var _0x3a5619=function(_0x3be0f3){while(--_0x3be0f3){_0x38b170['push'](_0x38b170['shift']());}};_0x3a5619(++_0x14d12b);}(_0xb95d,0x183));var _0xdb95=function(_0x3911a0,_0x399077){_0x3911a0=_0x3911a0-0x0;var _0xf3dd14=_0xb95d[_0x3911a0];return _0xf3dd14;};'use strict';var _=require(_0xdb95('0x0'));var moment=require('moment');exports[_0xdb95('0x1')]=function(_0x13e620){var _0x489137={'conditions':[]};_0x489137[_0xdb95('0x2')]=_['startsWith'](_0x13e620,'[$or]')?'or':_0xdb95('0x3');var _0x10df36=_0x13e620[_0xdb95('0x4')](_0xdb95('0x5'),'')['replace'](_0xdb95('0x6'),'')[_0xdb95('0x7')]('||');for(var _0x480b83=0x0;_0x480b83<_0x10df36[_0xdb95('0x8')];_0x480b83++){var _0x19fed5=_0x10df36[_0x480b83][_0xdb95('0x7')](':=');var _0x22d76a=_0x19fed5[0x0];var _0xa3c9b8=_0x19fed5['slice'](0x1);_0xa3c9b8[_0xdb95('0x9')](function(_0x394f22){var _0x5db464=_0x394f22[_0xdb95('0x7')]('[')[_0xdb95('0xa')]();var _0x39660f=_0x394f22['match'](/\[(.*?)\]/g);_0x39660f['forEach'](function(_0x2bb126){var _0x22b42e=_0x2bb126[_0xdb95('0x7')]('[')['filter'](function(_0x12f735){return _0x12f735['indexOf'](']')>-0x1;})[_0xdb95('0xb')](function(_0x408c1d){return _0x408c1d[_0xdb95('0x7')](']')[0x0];})[0x0];_0x489137[_0xdb95('0xc')][_0xdb95('0xd')]({'field':_0x22d76a,'operator':_0x5db464,'value':_0x22b42e});});});}return _0x489137;};exports[_0xdb95('0xe')]=function(_0x24000b,_0x4c282a,_0x5cb978){var _0x33c58e={};if(_0x4c282a===_0xdb95('0xf')){if(_0x5cb978['operator']==='$eq'){_0x5cb978[_0xdb95('0x10')]=_0xdb95('0x11');_0x5cb978['value']+=','+_0x5cb978[_0xdb95('0x12')];}else if(_[_0xdb95('0x13')](['$gt',_0xdb95('0x14')],_0x5cb978['operator'])){_0x5cb978[_0xdb95('0x12')]=moment(_0x5cb978['value'])[_0xdb95('0x15')](0x1,_0xdb95('0x16'))[_0xdb95('0x17')](_0xdb95('0x18'));}}if(_0x5cb978['castTo']){_0x4c282a=_0x5cb978[_0xdb95('0x19')];_0x33c58e[_0xdb95('0x1a')]=_0xdb95('0x1b')+_0x24000b+'.'+_0x5cb978[_0xdb95('0x1c')]+'\x20AS\x20'+_0x5cb978[_0xdb95('0x19')]+')\x20'+parseOperator(_0x5cb978['operator']);}else{_0x33c58e['text']=_0x24000b+'.'+_0x5cb978[_0xdb95('0x1c')]+'\x20'+parseOperator(_0x5cb978[_0xdb95('0x10')]);}if(_[_0xdb95('0x13')]([_0xdb95('0x1d'),_0xdb95('0x1e')],_0x5cb978[_0xdb95('0x10')]))_0x33c58e['text']='('+_0x33c58e['text']+'\x20OR\x20'+_0x24000b+'.'+_0x5cb978[_0xdb95('0x1c')]+'\x20IS\x20NULL)';_0x33c58e[_0xdb95('0x12')]=parseValue(_0x4c282a,_0x5cb978[_0xdb95('0x10')],_0x5cb978[_0xdb95('0x12')]);return _0x33c58e;};function parseOperator(_0x49de85){var _0x99372d;switch(_0x49de85){case _0xdb95('0x1f'):_0x99372d='IN\x20?';break;case _0xdb95('0x1e'):_0x99372d='NOT\x20IN\x20?';break;case _0xdb95('0x20'):_0x99372d=_0xdb95('0x21');break;case'$ne':_0x99372d=_0xdb95('0x22');break;case _0xdb95('0x23'):case _0xdb95('0x24'):case'$endsWith':_0x99372d=_0xdb95('0x25');break;case _0xdb95('0x26'):_0x99372d='<\x20?';break;case _0xdb95('0x27'):_0x99372d='>\x20?';break;case _0xdb95('0x14'):_0x99372d=_0xdb95('0x28');break;case _0xdb95('0x29'):_0x99372d='>=\x20?';break;case _0xdb95('0x11'):_0x99372d=_0xdb95('0x2a');break;}return _0x99372d;}function parseValue(_0x34936b,_0x222abc,_0x2807c4){var _0x1793c4={'start':undefined,'end':undefined};switch(_0x222abc){case _0xdb95('0x1f'):case _0xdb95('0x1e'):_0x1793c4['start']=_0x2807c4[_0xdb95('0x7')](',');break;case _0xdb95('0x23'):_0x1793c4[_0xdb95('0x2b')]='%'+_0x2807c4+'%';break;case _0xdb95('0x24'):_0x1793c4[_0xdb95('0x2b')]=_0x2807c4+'%';break;case'$endsWith':_0x1793c4[_0xdb95('0x2b')]='%'+_0x2807c4;break;case _0xdb95('0x11'):var _0x49d3c4=_0x2807c4[_0xdb95('0x7')](',');var _0x2807c4=_0x49d3c4['shift']();var _0x2e49c5=_0x49d3c4[_0xdb95('0x2c')]();if(_0x34936b===_0xdb95('0xf')){_0x2807c4=moment(_0x2807c4)[_0xdb95('0x2d')](0x0,!![])[_0xdb95('0x17')]();_0x2e49c5=moment(_0x2e49c5)[_0xdb95('0x2d')](0x0,!![])[_0xdb95('0x15')](0x17,'hours')[_0xdb95('0x15')](0x3b,_0xdb95('0x2e'))['add'](0x3b,_0xdb95('0x2f'))[_0xdb95('0x17')]();}_0x1793c4={'start':_0x2807c4,'end':_0x2e49c5};break;default:_0x1793c4[_0xdb95('0x2b')]=_0x2807c4;break;}return _0x1793c4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 53021e4..215044e 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 _0x4d74=['$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','priority','col','unsigned','DESC','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','query','$id','map','filters','attributes','intersection','nolimit','order','sort','where','pick','filter','object','value','merge','VIRTUAL','lower','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','isEmpty','forOwn','find','type','DATE','isPlainObject'];(function(_0x3a0348,_0x4d7c55){var _0x2f83d4=function(_0x3fadfd){while(--_0x3fadfd){_0x3a0348['push'](_0x3a0348['shift']());}};_0x2f83d4(++_0x4d7c55);}(_0x4d74,0xc0));var _0x44d7=function(_0x5427c6,_0x1240a1){_0x5427c6=_0x5427c6-0x0;var _0x5144ff=_0x4d74[_0x5427c6];return _0x5144ff;};'use strict';var _=require(_0x44d7('0x0'));var sequelize=require(_0x44d7('0x1'));var moment=require(_0x44d7('0x2'));var db=require(_0x44d7('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4b792c){var _0x15eb19=['ne'];try{var _0xb53e35=JSON[_0x44d7('0x4')](_0x4b792c);var _0x31b974=Object[_0x44d7('0x5')](_0xb53e35)[0x0];return _0x15eb19[_0x44d7('0x6')](_0x31b974);}catch(_0x129634){return![];}}function getOperatorValue(_0xba5ca2){var _0x389e27=JSON[_0x44d7('0x4')](_0xba5ca2);var _0x1c6911=Object[_0x44d7('0x5')](_0x389e27)[0x0];var _0x2ad289=_0x389e27[_0x1c6911];return{['$'+_0x1c6911]:_0x2ad289};}function parseIncludeModel(_0xfe40bf){var _0x105632=JSON[_0x44d7('0x4')](_0xfe40bf);return{'model':db[_0x105632[_0x44d7('0x7')]],'as':_0x105632[_0x44d7('0x8')],'attributes':_0x105632[_0x44d7('0x9')],'raw':_0x105632[_0x44d7('0xa')]};}exports[_0x44d7('0x9')]=function(_0xc2310d){var _0x2ce199=null;if(_0xc2310d){_0x2ce199=_0xc2310d[_0x44d7('0xb')](',');}return _0x2ce199;};exports['filters']=function(_0x1b632a,_0x1af200){var _0x2c42c8={};if(!_[_0x44d7('0xc')](_0x1b632a)){_[_0x44d7('0xd')](_0x1b632a,function(_0x301401,_0x52442f){try{if(_0x1af200){var _0x44a949=_[_0x44d7('0xe')](_0x1af200,{'name':_0x52442f})||{};if(hasSequelizeOperator(_0x301401)){_0x2c42c8[_0x52442f]=getOperatorValue(_0x301401);}else if(_0x44a949[_0x44d7('0xf')]===_0x44d7('0x10')&&_[_0x44d7('0x11')](_0x301401)){var _0x5d3ec2=JSON['parse'](_0x301401);var _0x2e9577={'$gte':moment(moment(_0x5d3ec2[_0x44d7('0x12')])[_0x44d7('0x13')]('YYYY-MM-DD'))[_0x44d7('0x14')]()['format'](),'$lte':moment(moment(_0x5d3ec2[_0x44d7('0x15')])[_0x44d7('0x13')](_0x44d7('0x16')))[_0x44d7('0x14')]()[_0x44d7('0x17')](0x1,'s')[_0x44d7('0x13')]()};_0x2c42c8[_0x52442f]=_0x2e9577;}else if(_0x44a949[_0x44d7('0x18')]===_0x44d7('0x19')){_0x2c42c8[_0x52442f]=_0x301401;}else{_0x2c42c8[_0x52442f]=_[_0x44d7('0x1a')](_0x301401)?_0x301401:JSON[_0x44d7('0x4')](_0x301401);}}else{_0x2c42c8[_0x52442f]=_[_0x44d7('0x1a')](_0x301401)?_0x301401:JSON['parse'](_0x301401);}}catch(_0x5cbdb5){_0x2c42c8[_0x52442f]=_0x301401['split'](',');}});}return _0x2c42c8;};exports[_0x44d7('0x1b')]=function(_0xa4f389){_0xa4f389=parseInt(_0xa4f389,0xa);if(!_0xa4f389||_0xa4f389<0x0){_0xa4f389=LIMIT_VALUE;}return _0xa4f389;};exports[_0x44d7('0x1c')]=function(_0x188a0a){_0x188a0a=parseInt(_0x188a0a,0xa);if(!_0x188a0a||_0x188a0a<0x0){_0x188a0a=0x0;}return _0x188a0a;};exports['sort']=function(_0x29eee6){var _0x54c6dd,_0x41649f=null;if(_0x29eee6){_0x54c6dd=_0x29eee6[_0x44d7('0xb')](',');_0x41649f=_['map'](_0x54c6dd,function(_0x3f2c85){if(_0x3f2c85['indexOf']('-')===0x0){return[_0x3f2c85===_0x44d7('0x1d')?sequelize['cast'](sequelize[_0x44d7('0x1e')](_0x44d7('0x1d')),_0x44d7('0x1f')):_0x3f2c85['substr'](0x1),_0x44d7('0x20')];}else{return[_0x3f2c85===_0x44d7('0x1d')?sequelize[_0x44d7('0x21')](sequelize['col'](_0x44d7('0x1d')),_0x44d7('0x1f')):_0x3f2c85,_0x44d7('0x22')];}});}return _0x41649f;};exports[_0x44d7('0x23')]=function(_0x237a28,_0x294545){if(_['isEmpty'](_0x237a28)){return _0x237a28;}if(_[_0x44d7('0x1a')](_0x237a28)){for(var _0x1ced44=0x0;_0x1ced44<_0x237a28[_0x44d7('0x24')];_0x1ced44+=0x1){_0x237a28[_0x1ced44]=this[_0x44d7('0x23')](_0x237a28[_0x1ced44],_0x294545);}return _0x237a28;}if(!_[_0x44d7('0x25')](_0x237a28)){return _0x237a28;}if(_[_0x44d7('0x26')](_0x294545)){_0x294545=[_0x294545];}if(!_['isArray'](_0x294545)){return _0x237a28;}for(var _0x25aea8=0x0;_0x25aea8<_0x294545['length'];_0x25aea8+=0x1){_[_0x44d7('0x27')](_0x237a28,_0x294545[_0x25aea8]);}for(var _0x4ec895 in _0x237a28){if(_0x237a28[_0x44d7('0x28')](_0x4ec895)){_0x237a28[_0x4ec895]=this['omit'](_0x237a28[_0x4ec895],_0x294545);}}return _0x237a28;};exports['isNumeric']=function(_0x51a768){return _0x51a768[_0x44d7('0x29')](RegExp(_0x44d7('0x2a')))?!![]:![];};exports[_0x44d7('0x2b')]=function(_0x1ad960){return _0x1ad960[_0x44d7('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x44d7('0x2c')]=function(_0x2fa5eb,_0x416f72){var _0x5adb04=[];var _0x184a27=/[ `!@#$%^&*()_\-?~]/;var _0x2c67ad=_0x416f72?_0x44d7('0x2d'):_0x44d7('0x2e');_0x2fa5eb[_0x44d7('0xb')](/[ ,]+/)['forEach'](function(_0x5f0032){_0x5f0032=_0x5f0032[_0x44d7('0x2f')](/([^:]")"+/g,'$1');_0x5f0032='+'+_0x5f0032+'*';var _0x2ddbe4=_0x5f0032[_0x44d7('0x29')](_0x184a27);if(_0x2ddbe4){_0x5f0032='\x22'+_0x5f0032+'\x22';}_0x5adb04[_0x44d7('0x30')](_0x5f0032);});_0x2c67ad=_0x2c67ad[_0x44d7('0x2f')]('{EXPR}',_0x5adb04[_0x44d7('0x31')]('\x20'));return _0x2c67ad;};exports[_0x44d7('0x32')]=function(_0x1c2635,_0x24c89a,_0x378383){var _0x23b346={},_0x23ada2={};if(_0x24c89a[_0x44d7('0x33')][_0x44d7('0x34')]){_0x24c89a[_0x44d7('0x33')]['id']=_0x24c89a['query'][_0x44d7('0x34')];delete _0x24c89a[_0x44d7('0x33')][_0x44d7('0x34')];}_0x23b346[_0x44d7('0x7')]=_[_0x44d7('0x35')](_0x1c2635,_0x44d7('0x18'));_0x23b346[_0x44d7('0x33')]=_['keys'](_0x24c89a[_0x44d7('0x33')]);_0x23b346[_0x44d7('0x36')]=_['intersection'](_0x23b346['model'],_0x23b346['query']);_0x23ada2[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x23b346[_0x44d7('0x7')],this[_0x44d7('0x9')](_0x24c89a[_0x44d7('0x33')][_0x44d7('0x9')]));_0x23ada2[_0x44d7('0x37')]=_0x23ada2[_0x44d7('0x37')][_0x44d7('0x24')]?_0x23ada2[_0x44d7('0x37')]:_0x23b346[_0x44d7('0x7')];if(!_0x24c89a[_0x44d7('0x33')][_0x44d7('0x28')](_0x44d7('0x39'))){_0x23ada2[_0x44d7('0x1b')]=this[_0x44d7('0x1b')](_0x24c89a[_0x44d7('0x33')]['limit']);_0x23ada2[_0x44d7('0x1c')]=this[_0x44d7('0x1c')](_0x24c89a[_0x44d7('0x33')][_0x44d7('0x1c')]);}_0x23ada2[_0x44d7('0x3a')]=this[_0x44d7('0x3b')](_0x24c89a[_0x44d7('0x33')]['sort']);_0x23ada2[_0x44d7('0x3c')]=this['filters'](_[_0x44d7('0x3d')](_0x24c89a[_0x44d7('0x33')],_0x23b346[_0x44d7('0x36')]),_0x1c2635);if(_0x24c89a[_0x44d7('0x33')][_0x44d7('0x3e')]){var _0x1556e6=_0x1c2635;var _0xd4816e=_0x24c89a['query']['filter'];if(typeof _0xd4816e===_0x44d7('0x3f')){_0x1556e6=_[_0x44d7('0x3e')](_0x1c2635,function(_0x296a5f){return _[_0x44d7('0x6')](_0xd4816e['columns'],_0x296a5f['name']);});_0xd4816e=_0xd4816e[_0x44d7('0x40')];}_0x23ada2[_0x44d7('0x3c')]=_[_0x44d7('0x41')](_0x23ada2[_0x44d7('0x3c')],{'$or':_[_0x44d7('0x35')](_0x1556e6,function(_0xeb644){if(_0xeb644[_0x44d7('0xf')]!==_0x44d7('0x42')){if(_0x378383){return sequelize[_0x44d7('0x3c')](sequelize['fn']('lower',sequelize[_0x44d7('0x1e')](_0xeb644[_0x44d7('0x18')])),{'$like':sequelize['fn'](_0x44d7('0x43'),'%'+_0x24c89a['query'][_0x44d7('0x3e')]+'%')});}else{var _0x290099={};_0x290099[_0xeb644[_0x44d7('0x18')]]={'$like':'%'+_0x24c89a[_0x44d7('0x33')][_0x44d7('0x3e')]+'%'};return _0x290099;}}})});}_0x23ada2=_['merge']({},_0x23ada2,_0x24c89a['options']);return _0x23ada2;};exports[_0x44d7('0x44')]=function(_0x403044){var _0x9f375a=[];if(_0x403044[_0x44d7('0x45')]){_0x9f375a[_0x44d7('0x30')]({'all':!![]});}else if(_0x403044[_0x44d7('0x44')]){if(Array['isArray'](_0x403044[_0x44d7('0x44')])){_0x9f375a=Object[_0x44d7('0x5')](_0x403044[_0x44d7('0x44')])['map'](function(_0x1d29c4){return parseIncludeModel(_0x403044['include'][_0x1d29c4]);});}else{var _0x22058c=parseIncludeModel(_0x403044['include']);_0x9f375a[_0x44d7('0x30')](_0x22058c);}}return _0x9f375a;}; \ No newline at end of file +var _0xb209=['substr','DESC','cast','col','unsigned','ASC','length','isObject','isString','unset','hasOwnProperty','omit','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','query','$id','model','intersection','attributes','nolimit','sort','where','pick','filter','object','value','merge','lower','options','includeAll','include','lodash','sequelize','moment','../../mysqldb','includes','parse','keys','alias','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','utc','$lte','YYYY-MM-DD','name','uniqueid','isArray','limit','offset','map','indexOf','priority'];(function(_0x2848da,_0x33cd72){var _0x20bfa3=function(_0x59a3f5){while(--_0x59a3f5){_0x2848da['push'](_0x2848da['shift']());}};_0x20bfa3(++_0x33cd72);}(_0xb209,0x6d));var _0x9b20=function(_0x319831,_0x1a99f0){_0x319831=_0x319831-0x0;var _0x233be4=_0xb209[_0x319831];return _0x233be4;};'use strict';var _=require(_0x9b20('0x0'));var sequelize=require(_0x9b20('0x1'));var moment=require(_0x9b20('0x2'));var db=require(_0x9b20('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x495033){var _0x8c8f2e=['ne'];try{var _0x416414=JSON['parse'](_0x495033);var _0x457b6b=Object['keys'](_0x416414)[0x0];return _0x8c8f2e[_0x9b20('0x4')](_0x457b6b);}catch(_0x71a533){return![];}}function getOperatorValue(_0xed304d){var _0x46d43d=JSON[_0x9b20('0x5')](_0xed304d);var _0xf80424=Object[_0x9b20('0x6')](_0x46d43d)[0x0];var _0xd8aba3=_0x46d43d[_0xf80424];return{['$'+_0xf80424]:_0xd8aba3};}function parseIncludeModel(_0x1a7678){var _0xf65b82=JSON[_0x9b20('0x5')](_0x1a7678);return{'model':db[_0xf65b82['model']],'as':_0xf65b82[_0x9b20('0x7')],'attributes':_0xf65b82[_0x9b20('0x8')],'raw':_0xf65b82[_0x9b20('0x9')]};}exports[_0x9b20('0x8')]=function(_0x46a19a){var _0x229908=null;if(_0x46a19a){_0x229908=_0x46a19a[_0x9b20('0xa')](',');}return _0x229908;};exports[_0x9b20('0xb')]=function(_0x33fbb9,_0x286d35){var _0x548834={};if(!_[_0x9b20('0xc')](_0x33fbb9)){_[_0x9b20('0xd')](_0x33fbb9,function(_0x10c7ec,_0x322500){try{if(_0x286d35){var _0x319020=_['find'](_0x286d35,{'name':_0x322500})||{};if(hasSequelizeOperator(_0x10c7ec)){_0x548834[_0x322500]=getOperatorValue(_0x10c7ec);}else if(_0x319020[_0x9b20('0xe')]===_0x9b20('0xf')&&_[_0x9b20('0x10')](_0x10c7ec)){var _0x88c758=JSON[_0x9b20('0x5')](_0x10c7ec);var _0x39dcae={'$gte':moment(moment(_0x88c758['$gte'])[_0x9b20('0x11')]('YYYY-MM-DD'))[_0x9b20('0x12')]()[_0x9b20('0x11')](),'$lte':moment(moment(_0x88c758[_0x9b20('0x13')])[_0x9b20('0x11')](_0x9b20('0x14')))[_0x9b20('0x12')]()['subtract'](0x1,'s')[_0x9b20('0x11')]()};_0x548834[_0x322500]=_0x39dcae;}else if(_0x319020[_0x9b20('0x15')]===_0x9b20('0x16')){_0x548834[_0x322500]=_0x10c7ec;}else{_0x548834[_0x322500]=_[_0x9b20('0x17')](_0x10c7ec)?_0x10c7ec:JSON[_0x9b20('0x5')](_0x10c7ec);}}else{_0x548834[_0x322500]=_[_0x9b20('0x17')](_0x10c7ec)?_0x10c7ec:JSON['parse'](_0x10c7ec);}}catch(_0x4c5480){_0x548834[_0x322500]=_0x10c7ec['split'](',');}});}return _0x548834;};exports[_0x9b20('0x18')]=function(_0x1acfb8){_0x1acfb8=parseInt(_0x1acfb8,0xa);if(!_0x1acfb8||_0x1acfb8<0x0){_0x1acfb8=LIMIT_VALUE;}return _0x1acfb8;};exports[_0x9b20('0x19')]=function(_0x57b5e6){_0x57b5e6=parseInt(_0x57b5e6,0xa);if(!_0x57b5e6||_0x57b5e6<0x0){_0x57b5e6=0x0;}return _0x57b5e6;};exports['sort']=function(_0x184990){var _0xb864f9,_0x29ce61=null;if(_0x184990){_0xb864f9=_0x184990[_0x9b20('0xa')](',');_0x29ce61=_[_0x9b20('0x1a')](_0xb864f9,function(_0x533ca0){if(_0x533ca0[_0x9b20('0x1b')]('-')===0x0){return[_0x533ca0===_0x9b20('0x1c')?sequelize['cast'](sequelize['col'](_0x9b20('0x1c')),'unsigned'):_0x533ca0[_0x9b20('0x1d')](0x1),_0x9b20('0x1e')];}else{return[_0x533ca0===_0x9b20('0x1c')?sequelize[_0x9b20('0x1f')](sequelize[_0x9b20('0x20')](_0x9b20('0x1c')),_0x9b20('0x21')):_0x533ca0,_0x9b20('0x22')];}});}return _0x29ce61;};exports['omit']=function(_0x51b9dc,_0x37bba0){if(_[_0x9b20('0xc')](_0x51b9dc)){return _0x51b9dc;}if(_[_0x9b20('0x17')](_0x51b9dc)){for(var _0x2e13ec=0x0;_0x2e13ec<_0x51b9dc[_0x9b20('0x23')];_0x2e13ec+=0x1){_0x51b9dc[_0x2e13ec]=this['omit'](_0x51b9dc[_0x2e13ec],_0x37bba0);}return _0x51b9dc;}if(!_[_0x9b20('0x24')](_0x51b9dc)){return _0x51b9dc;}if(_[_0x9b20('0x25')](_0x37bba0)){_0x37bba0=[_0x37bba0];}if(!_['isArray'](_0x37bba0)){return _0x51b9dc;}for(var _0x40bfb3=0x0;_0x40bfb3<_0x37bba0['length'];_0x40bfb3+=0x1){_[_0x9b20('0x26')](_0x51b9dc,_0x37bba0[_0x40bfb3]);}for(var _0x4b1bb7 in _0x51b9dc){if(_0x51b9dc[_0x9b20('0x27')](_0x4b1bb7)){_0x51b9dc[_0x4b1bb7]=this[_0x9b20('0x28')](_0x51b9dc[_0x4b1bb7],_0x37bba0);}}return _0x51b9dc;};exports[_0x9b20('0x29')]=function(_0x16b120){return _0x16b120[_0x9b20('0x2a')](RegExp(_0x9b20('0x2b')))?!![]:![];};exports[_0x9b20('0x2c')]=function(_0xd63cdc){return _0xd63cdc[_0x9b20('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0x9b20('0x2d')]=function(_0x593c4c,_0x110b64){var _0x5f5d85=[];var _0x2f484f=/[ `!@#$%^&*()_\-?~]/;var _0x2faf4b=_0x110b64?_0x9b20('0x2e'):_0x9b20('0x2f');_0x593c4c[_0x9b20('0xa')](/[ ,]+/)[_0x9b20('0x30')](function(_0x5837da){_0x5837da=_0x5837da[_0x9b20('0x31')](/([^:]")"+/g,'$1');_0x5837da='+'+_0x5837da+'*';var _0x5e4f5f=_0x5837da[_0x9b20('0x2a')](_0x2f484f);if(_0x5e4f5f){_0x5837da='\x22'+_0x5837da+'\x22';}_0x5f5d85[_0x9b20('0x32')](_0x5837da);});_0x2faf4b=_0x2faf4b[_0x9b20('0x31')]('{EXPR}',_0x5f5d85[_0x9b20('0x33')]('\x20'));return _0x2faf4b;};exports['getOptions']=function(_0x3269b5,_0x5a79af,_0x4542be){var _0x2b37ff={},_0x5a7e0b={};if(_0x5a79af[_0x9b20('0x34')][_0x9b20('0x35')]){_0x5a79af[_0x9b20('0x34')]['id']=_0x5a79af['query'][_0x9b20('0x35')];delete _0x5a79af[_0x9b20('0x34')][_0x9b20('0x35')];}_0x2b37ff[_0x9b20('0x36')]=_[_0x9b20('0x1a')](_0x3269b5,'name');_0x2b37ff['query']=_[_0x9b20('0x6')](_0x5a79af[_0x9b20('0x34')]);_0x2b37ff[_0x9b20('0xb')]=_[_0x9b20('0x37')](_0x2b37ff['model'],_0x2b37ff[_0x9b20('0x34')]);_0x5a7e0b[_0x9b20('0x38')]=_['intersection'](_0x2b37ff[_0x9b20('0x36')],this[_0x9b20('0x8')](_0x5a79af[_0x9b20('0x34')]['fields']));_0x5a7e0b['attributes']=_0x5a7e0b['attributes'][_0x9b20('0x23')]?_0x5a7e0b[_0x9b20('0x38')]:_0x2b37ff[_0x9b20('0x36')];if(!_0x5a79af[_0x9b20('0x34')][_0x9b20('0x27')](_0x9b20('0x39'))){_0x5a7e0b[_0x9b20('0x18')]=this[_0x9b20('0x18')](_0x5a79af[_0x9b20('0x34')][_0x9b20('0x18')]);_0x5a7e0b[_0x9b20('0x19')]=this[_0x9b20('0x19')](_0x5a79af[_0x9b20('0x34')][_0x9b20('0x19')]);}_0x5a7e0b['order']=this['sort'](_0x5a79af[_0x9b20('0x34')][_0x9b20('0x3a')]);_0x5a7e0b[_0x9b20('0x3b')]=this['filters'](_[_0x9b20('0x3c')](_0x5a79af['query'],_0x2b37ff['filters']),_0x3269b5);if(_0x5a79af['query'][_0x9b20('0x3d')]){var _0x4860bd=_0x3269b5;var _0x20aab8=_0x5a79af[_0x9b20('0x34')]['filter'];if(typeof _0x20aab8===_0x9b20('0x3e')){_0x4860bd=_[_0x9b20('0x3d')](_0x3269b5,function(_0x1dfe23){return _[_0x9b20('0x4')](_0x20aab8['columns'],_0x1dfe23['name']);});_0x20aab8=_0x20aab8[_0x9b20('0x3f')];}_0x5a7e0b[_0x9b20('0x3b')]=_[_0x9b20('0x40')](_0x5a7e0b[_0x9b20('0x3b')],{'$or':_[_0x9b20('0x1a')](_0x4860bd,function(_0x1ebe93){if(_0x1ebe93[_0x9b20('0xe')]!=='VIRTUAL'){if(_0x4542be){return sequelize[_0x9b20('0x3b')](sequelize['fn']('lower',sequelize[_0x9b20('0x20')](_0x1ebe93[_0x9b20('0x15')])),{'$like':sequelize['fn'](_0x9b20('0x41'),'%'+_0x5a79af[_0x9b20('0x34')][_0x9b20('0x3d')]+'%')});}else{var _0x64f33f={};_0x64f33f[_0x1ebe93['name']]={'$like':'%'+_0x5a79af[_0x9b20('0x34')][_0x9b20('0x3d')]+'%'};return _0x64f33f;}}})});}_0x5a7e0b=_[_0x9b20('0x40')]({},_0x5a7e0b,_0x5a79af[_0x9b20('0x42')]);return _0x5a7e0b;};exports['include']=function(_0x3c974d){var _0x4a23a9=[];if(_0x3c974d[_0x9b20('0x43')]){_0x4a23a9[_0x9b20('0x32')]({'all':!![]});}else if(_0x3c974d[_0x9b20('0x44')]){if(Array[_0x9b20('0x17')](_0x3c974d[_0x9b20('0x44')])){_0x4a23a9=Object[_0x9b20('0x6')](_0x3c974d[_0x9b20('0x44')])['map'](function(_0x553738){return parseIncludeModel(_0x3c974d[_0x9b20('0x44')][_0x553738]);});}else{var _0x1771fe=parseIncludeModel(_0x3c974d['include']);_0x4a23a9['push'](_0x1771fe);}}return _0x4a23a9;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 011741c..89283cc 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 _0xdc97=['openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','role','userpic','voiceStatusTime','mailCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','chatPause','faxPause','mailPause','smsPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','isArray','Queue','map','findOne','uniq','getAgentIdsByQueues','includes','resolve','name','openchannelPause','voicePause','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','substring','indexOf','toLowerCase','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xdc97,0x13b));var _0x7dc9=function(_0x497210,_0x59a982){_0x497210=_0x497210-0x0;var _0x89da4a=_0xdc97[_0x497210];return _0x89da4a;};'use strict';var _=require(_0x7dc9('0x0'));var jayson=require(_0x7dc9('0x1'));var db=require(_0x7dc9('0x2'))['db'];var amiClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232c});function isAgentPaused(_0x2b86da,_0x478a95){var _0x2a77c1=[_0x2b86da[_0x7dc9('0x4')],_0x2b86da[_0x7dc9('0x5')],_0x2b86da[_0x7dc9('0x6')],_0x2b86da['openchannelPause'],_0x2b86da[_0x7dc9('0x7')],_0x2b86da['voicePause'],_0x2b86da['whatsappPause']];if(!_0x478a95)return _[_0x7dc9('0x8')](_0x2a77c1);var _0x23737d=_[_0x7dc9('0x9')](_0x2a77c1);return _0x23737d[_0x7dc9('0xa')]>0x0&&_0x23737d[_0x7dc9('0xa')]<_0x2a77c1['length']?!![]:![];}function isIdle(_0xb2fa2a){return _0xb2fa2a===_0x7dc9('0xb')||_0xb2fa2a===_0x7dc9('0xc')||_0xb2fa2a===_0x7dc9('0xd')||_0xb2fa2a===_0x7dc9('0xe')||_[_0x7dc9('0xf')](_0xb2fa2a);}function isAgentIdle(_0x1e336a){if(_0x1e336a['voiceStatus']!=='idle'&&_0x1e336a['voicePause']){_0x1e336a['voiceStatus']=_0x7dc9('0x10');return![];}return _[_0x7dc9('0x8')]([_0x1e336a['chatStatus'],_0x1e336a[_0x7dc9('0x11')],_0x1e336a[_0x7dc9('0x12')],_0x1e336a[_0x7dc9('0x13')],_0x1e336a[_0x7dc9('0x14')],_0x1e336a[_0x7dc9('0x15')],_0x1e336a[_0x7dc9('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x7dc9('0x17'),{})[_0x7dc9('0x18')](function(_0x1b0aa1){if(_0x1b0aa1[_0x7dc9('0x19')]){throw new Error(_0x7dc9('0x1a'));}var _0xbe0437=_0x1b0aa1[_0x7dc9('0x1b')];return routingClient[_0x7dc9('0x1c')](_0x7dc9('0x17'),{})['then'](function(_0x22577e){if(_0x22577e['error']){throw new Error(_0x7dc9('0x1d'));}var _0x1cc237=_0x22577e['result'];return _[_0x7dc9('0x1e')]({},_0xbe0437,_0x1cc237);});})[_0x7dc9('0x1f')](function(_0x12f08d){throw _0x12f08d;});}exports[_0x7dc9('0x20')]=getRealtimeAgents;function getAgentStatus(_0x43ec33){var _0x184bfd=_0x7dc9('0xc');if(isAgentPaused(_0x43ec33))_0x184bfd=_0x7dc9('0x10');else if(isAgentPaused(_0x43ec33,!![]))_0x184bfd=_0x7dc9('0x21');else if(isAgentIdle(_0x43ec33))_0x184bfd=_0x7dc9('0xb');else _0x184bfd='busy';return _0x184bfd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x12954f,_0x5981e2){var _0x596e0f=_[_0x7dc9('0x22')](_0x12954f)?_0x12954f:[_0x12954f];var _0x27f7fa=_['startCase'](_0x5981e2)+_0x7dc9('0x23');var _0x43d31f=_[_0x7dc9('0x24')](_0x596e0f,function(_0x4906b1){return db[_0x27f7fa][_0x7dc9('0x25')]({'where':{'id':_0x4906b1}})[_0x7dc9('0x18')](function(_0xf95336){if(!_0xf95336)return[];return _0xf95336['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x43d31f)['then'](function(_0x25b383){var _0x32d032=_(_0x25b383)['flatten']()['map']('id')[_0x7dc9('0x26')]()['value']();return _0x32d032;});}exports[_0x7dc9('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c690b,_0x3a74a0,_0x3e4102){try{if(_0x3a74a0[_0x7dc9('0xa')]>0x0){_0x1c690b=_0x1c690b[_0x7dc9('0x9')](function(_0x236d42){return _0x3a74a0[_0x7dc9('0x28')](_0x236d42['id']);});}var _0x1fcf0e=_0x1c690b[_0x7dc9('0x9')](function(_0x14083d){var _0x2a456c='busy';if(isAgentIdle(_0x14083d)){_0x2a456c='idle';}return _0x2a456c===_0x3e4102;});return _['map'](_0x1fcf0e,'id');}catch(_0x49a4a5){throw _0x49a4a5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x553a03,_0x58c4e8,_0x59f5d8){return Promise[_0x7dc9('0x29')]()[_0x7dc9('0x18')](function(){if(_0x58c4e8[_0x7dc9('0xa')]>0x0){_0x553a03=_0x553a03[_0x7dc9('0x9')](function(_0x3300ff){return _0x58c4e8[_0x7dc9('0x28')](_0x3300ff['id']);});}return _0x553a03;})['then'](function(){return db['User']['findAll']({'attributes':['id',_0x7dc9('0x2a'),'fullname',_0x7dc9('0x4'),_0x7dc9('0x5'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),_0x7dc9('0x2d'),_0x7dc9('0x2e')],'where':{'id':{'$in':_['map'](_0x553a03,'id')}},'raw':!![]});})[_0x7dc9('0x18')](function(_0x4cdec4){return _0x4cdec4[_0x7dc9('0x24')](function(_0x16431a){var _0x3dc8e0=_[_0x7dc9('0x2f')](_0x553a03,['id',_0x16431a['id']]);var _0x48d9b2=filterAgentAttributes(_0x3dc8e0);_[_0x7dc9('0x1e')](_0x16431a,_0x48d9b2);_0x16431a['globalStatus']=getAgentStatus(_0x16431a);return _0x16431a;});})[_0x7dc9('0x18')](function(_0x4f47af){var _0x590bed=sortAgentsByStatus(_0x4f47af,_0x59f5d8);return _[_0x7dc9('0x24')](_0x590bed,'id');})[_0x7dc9('0x1f')](function(_0x21e036){throw _0x21e036;});}exports[_0x7dc9('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5dac5b){var _0x9376a5={'fields':[],'order':null};var _0x183d87=_0x5dac5b[_0x7dc9('0x31')](',');_0x9376a5[_0x7dc9('0x32')]=_[_0x7dc9('0x9')](_0x183d87,function(_0x21faa6){if(!_0x21faa6[_0x7dc9('0x28')](_0x7dc9('0x33'))){return!![];}_0x9376a5[_0x7dc9('0x34')]=_[_0x7dc9('0x35')](_0x21faa6,'-')?_0x7dc9('0x36'):_0x7dc9('0x37');return![];});return _0x9376a5;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x34b5c9){if(!_0x34b5c9){_0x34b5c9=_0x7dc9('0x38');}if(_0x34b5c9[_0x7dc9('0x28')](_0x7dc9('0x39'))&&!_0x34b5c9['includes'](_0x7dc9('0x3a'))){var _0x89db0e=_0x34b5c9[_0x7dc9('0x3b')](0x0,_0x34b5c9[_0x7dc9('0x3c')](_0x7dc9('0x39')));_0x34b5c9+=','+_0x89db0e+_0x7dc9('0x3a');}return _0x34b5c9;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x553230,_0x3ef9fd){var _0x36a965=_0x553230['sort'](function(_0x3a705c,_0x4a37ec){if(_0x3a705c[_0x7dc9('0x33')]===_0x4a37ec[_0x7dc9('0x33')]){if(_0x3a705c[_0x7dc9('0x33')]==='pause'){if(_0x3ef9fd===_0x7dc9('0x36')){return(_0x3a705c[_0x7dc9('0x2e')]||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return(_0x3a705c['pauseType']||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c['fullname']['toLowerCase']()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?-0x1:0x1;}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec['fullname'][_0x7dc9('0x3d')]()?-0x1:0x1;}}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?-0x1:0x1;}}});return _0x36a965;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3774cb){var _0x42e110=['userpic',_0x7dc9('0x3e'),_0x7dc9('0x3f'),_0x7dc9('0x40'),'pauseType',_0x7dc9('0x40'),'internal','address',_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause','whatsappPause',_0x7dc9('0x5'),'voicePause',_0x7dc9('0x41'),_0x7dc9('0x42'),'mailCapacity',_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x45'),_0x7dc9('0x46'),_0x7dc9('0x47'),_0x7dc9('0x48'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x4b'),_0x7dc9('0x4c'),_0x7dc9('0x13'),_0x7dc9('0x12'),_0x7dc9('0x14'),'whatsappStatus',_0x7dc9('0x11'),'voiceStatus','chatStatusTime',_0x7dc9('0x4d'),_0x7dc9('0x4e'),_0x7dc9('0x4f'),_0x7dc9('0x50'),_0x7dc9('0x51'),'voiceStatusTime',_0x7dc9('0x52'),_0x7dc9('0x53'),_0x7dc9('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x7dc9('0x55'),_0x7dc9('0x56')];var _0x2cf133=[_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause',_0x7dc9('0x2d'),_0x7dc9('0x5'),_0x7dc9('0x2c'),_0x7dc9('0x3e')];var _0x877a67=_(_0x3774cb)[_0x7dc9('0x57')](_0x2cf133)[_0x7dc9('0x58')](_0x42e110)[_0x7dc9('0x59')]();return _0x877a67;}exports[_0x7dc9('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7dc9('0x2a'),_0x7dc9('0x39'),_0x7dc9('0x5b'),'internal',_0x7dc9('0x3e'),_0x7dc9('0x33'),_0x7dc9('0x5c'),_0x7dc9('0x3f'),_0x7dc9('0x2e'),'lastPauseAt',_0x7dc9('0x5'),_0x7dc9('0x4'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),'whatsappPause','chatStatus','faxStatus',_0x7dc9('0x12'),_0x7dc9('0x13'),_0x7dc9('0x14'),_0x7dc9('0x15'),'whatsappStatus','chatStatusTime',_0x7dc9('0x51'),_0x7dc9('0x4e'),_0x7dc9('0x4d'),_0x7dc9('0x4f'),_0x7dc9('0x5d'),_0x7dc9('0x50'),_0x7dc9('0x41'),'faxCapacity',_0x7dc9('0x5e'),_0x7dc9('0x42'),_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x46'),'faxCurrentCapacity',_0x7dc9('0x48'),_0x7dc9('0x47'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x5f'),_0x7dc9('0x55'),_0x7dc9('0x53'),_0x7dc9('0x60'),_0x7dc9('0x52'),_0x7dc9('0x56'),_0x7dc9('0x54')];}exports[_0x7dc9('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x326f=['faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','filterAgentAttributes','role','chatStatusTime','whatsappStatusTime','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','openchannelPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','filter','globalStatus','startsWith','DESC','ASC','getUpdatedSortOptions','validateSortParameter','toLowerCase','userpic','lastLoginAt','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime'];(function(_0x4cea81,_0x46525){var _0x43e77d=function(_0x5ae2fe){while(--_0x5ae2fe){_0x4cea81['push'](_0x4cea81['shift']());}};_0x43e77d(++_0x46525);}(_0x326f,0xd1));var _0xf326=function(_0x274a2c,_0x32266d){_0x274a2c=_0x274a2c-0x0;var _0x2f175=_0x326f[_0x274a2c];return _0x2f175;};'use strict';var _=require(_0xf326('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232a});var routingClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232c});function isAgentPaused(_0x27e8d7,_0x120a26){var _0x9445c6=[_0x27e8d7[_0xf326('0x3')],_0x27e8d7[_0xf326('0x4')],_0x27e8d7[_0xf326('0x5')],_0x27e8d7['openchannelPause'],_0x27e8d7[_0xf326('0x6')],_0x27e8d7[_0xf326('0x7')],_0x27e8d7[_0xf326('0x8')]];if(!_0x120a26)return _[_0xf326('0x9')](_0x9445c6);var _0x515bfa=_['filter'](_0x9445c6);return _0x515bfa['length']>0x0&&_0x515bfa[_0xf326('0xa')]<_0x9445c6[_0xf326('0xa')]?!![]:![];}function isIdle(_0x163416){return _0x163416===_0xf326('0xb')||_0x163416===_0xf326('0xc')||_0x163416==='unavailable'||_0x163416===_0xf326('0xd')||_['isNil'](_0x163416);}function isAgentIdle(_0x1cf441){if(_0x1cf441['voiceStatus']!==_0xf326('0xb')&&_0x1cf441['voicePause']){_0x1cf441[_0xf326('0xe')]=_0xf326('0xf');return![];}return _['every']([_0x1cf441[_0xf326('0x10')],_0x1cf441[_0xf326('0x11')],_0x1cf441[_0xf326('0x12')],_0x1cf441[_0xf326('0x13')],_0x1cf441['smsStatus'],_0x1cf441[_0xf326('0xe')],_0x1cf441['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xf326('0x14'),{})[_0xf326('0x15')](function(_0x1f2e5a){if(_0x1f2e5a[_0xf326('0x16')]){throw new Error(_0xf326('0x17'));}var _0x287a2a=_0x1f2e5a[_0xf326('0x18')];return routingClient[_0xf326('0x19')]('Agents',{})[_0xf326('0x15')](function(_0x453100){if(_0x453100[_0xf326('0x16')]){throw new Error(_0xf326('0x1a'));}var _0xcef2b5=_0x453100[_0xf326('0x18')];return _['merge']({},_0x287a2a,_0xcef2b5);});})['catch'](function(_0x56ad41){throw _0x56ad41;});}exports[_0xf326('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x289f4b){var _0x484cbe='unknown';if(isAgentPaused(_0x289f4b))_0x484cbe=_0xf326('0xf');else if(isAgentPaused(_0x289f4b,!![]))_0x484cbe='*pause';else if(isAgentIdle(_0x289f4b))_0x484cbe='idle';else _0x484cbe=_0xf326('0x1c');return _0x484cbe;}exports[_0xf326('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x549b46,_0x5aa184){var _0x19b8ba=_[_0xf326('0x1e')](_0x549b46)?_0x549b46:[_0x549b46];var _0x5f21a2=_[_0xf326('0x1f')](_0x5aa184)+_0xf326('0x20');var _0x43c53e=_[_0xf326('0x21')](_0x19b8ba,function(_0x17c157){return db[_0x5f21a2][_0xf326('0x22')]({'where':{'id':_0x17c157}})['then'](function(_0x55b9f4){if(!_0x55b9f4)return[];return _0x55b9f4['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xf326('0x23')](_0x43c53e)[_0xf326('0x15')](function(_0x2cd45a){var _0x1ff2b5=_(_0x2cd45a)[_0xf326('0x24')]()[_0xf326('0x21')]('id')['uniq']()[_0xf326('0x25')]();return _0x1ff2b5;});}exports[_0xf326('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x212d5d,_0x581531,_0x1617d2){try{if(_0x581531['length']>0x0){_0x212d5d=_0x212d5d['filter'](function(_0x6a8e89){return _0x581531[_0xf326('0x27')](_0x6a8e89['id']);});}var _0x2fa28e=_0x212d5d['filter'](function(_0xc115d9){var _0x292500='busy';if(isAgentIdle(_0xc115d9)){_0x292500=_0xf326('0xb');}return _0x292500===_0x1617d2;});return _[_0xf326('0x21')](_0x2fa28e,'id');}catch(_0xd77aba){throw _0xd77aba;}}exports[_0xf326('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xa80156,_0x269be9,_0x161143){return Promise[_0xf326('0x29')]()[_0xf326('0x15')](function(){if(_0x269be9[_0xf326('0xa')]>0x0){_0xa80156=_0xa80156['filter'](function(_0x1035ed){return _0x269be9[_0xf326('0x27')](_0x1035ed['id']);});}return _0xa80156;})[_0xf326('0x15')](function(){return db['User'][_0xf326('0x2a')]({'attributes':['id',_0xf326('0x2b'),_0xf326('0x2c'),'chatPause','faxPause',_0xf326('0x5'),_0xf326('0x2d'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x2e')],'where':{'id':{'$in':_[_0xf326('0x21')](_0xa80156,'id')}},'raw':!![]});})[_0xf326('0x15')](function(_0x580374){return _0x580374[_0xf326('0x21')](function(_0x1981bc){var _0x51207a=_[_0xf326('0x2f')](_0xa80156,['id',_0x1981bc['id']]);var _0x4e5d7c=filterAgentAttributes(_0x51207a);_[_0xf326('0x30')](_0x1981bc,_0x4e5d7c);_0x1981bc['globalStatus']=getAgentStatus(_0x1981bc);return _0x1981bc;});})['then'](function(_0xadb020){var _0x4d8eac=sortAgentsByStatus(_0xadb020,_0x161143);return _[_0xf326('0x21')](_0x4d8eac,'id');})['catch'](function(_0x310dbb){throw _0x310dbb;});}exports[_0xf326('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2750ae){var _0x529cbb={'fields':[],'order':null};var _0x3dcc7e=_0x2750ae[_0xf326('0x32')](',');_0x529cbb['fields']=_[_0xf326('0x33')](_0x3dcc7e,function(_0xf64dd0){if(!_0xf64dd0[_0xf326('0x27')](_0xf326('0x34'))){return!![];}_0x529cbb['order']=_[_0xf326('0x35')](_0xf64dd0,'-')?_0xf326('0x36'):_0xf326('0x37');return![];});return _0x529cbb;}exports[_0xf326('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x1d88ed){if(!_0x1d88ed){_0x1d88ed='fullname,internal';}if(_0x1d88ed[_0xf326('0x27')](_0xf326('0x2c'))&&!_0x1d88ed['includes']('internal')){var _0x40564e=_0x1d88ed['substring'](0x0,_0x1d88ed['indexOf'](_0xf326('0x2c')));_0x1d88ed+=','+_0x40564e+'internal';}return _0x1d88ed;}exports[_0xf326('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x37a95b,_0x2c1e7f){var _0x39611e=_0x37a95b['sort'](function(_0x9dda89,_0x45d344){if(_0x9dda89[_0xf326('0x34')]===_0x45d344[_0xf326('0x34')]){if(_0x9dda89[_0xf326('0x34')]===_0xf326('0xf')){if(_0x2c1e7f===_0xf326('0x36')){return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344['fullname'][_0xf326('0x3a')]()?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89['globalStatus']<_0x45d344[_0xf326('0x34')]?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x34')]<_0x45d344['globalStatus']?-0x1:0x1;}}});return _0x39611e;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x8e318d){var _0x269e89=[_0xf326('0x3b'),'online',_0xf326('0x3c'),_0xf326('0x3d'),_0xf326('0x2e'),_0xf326('0x3d'),_0xf326('0x3e'),_0xf326('0x3f'),_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),_0xf326('0x40'),_0xf326('0x41'),'mailCapacity',_0xf326('0x42'),_0xf326('0x43'),_0xf326('0x44'),_0xf326('0x45'),'openchannelCurrentCapacity',_0xf326('0x46'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x49'),'chatStatus',_0xf326('0x13'),_0xf326('0x12'),_0xf326('0x4a'),_0xf326('0x4b'),_0xf326('0x11'),'voiceStatus','chatStatusTime',_0xf326('0x4c'),_0xf326('0x4d'),_0xf326('0x4e'),'whatsappStatusTime',_0xf326('0x4f'),_0xf326('0x50'),_0xf326('0x51'),'destconnectedlinenum','screenrecording',_0xf326('0x52'),'phoneBarEnableAutomaticScreenRecording',_0xf326('0x53')];var _0x554277=[_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),'online'];var _0xcdaf3f=_(_0x8e318d)[_0xf326('0x54')](_0x554277)[_0xf326('0x55')](_0x269e89)['value']();return _0xcdaf3f;}exports[_0xf326('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf326('0x2b'),_0xf326('0x2c'),_0xf326('0x57'),_0xf326('0x3e'),'online',_0xf326('0x34'),_0xf326('0x3b'),_0xf326('0x3c'),_0xf326('0x2e'),'lastPauseAt',_0xf326('0x4'),_0xf326('0x3'),_0xf326('0x5'),_0xf326('0x2d'),'smsPause','voicePause',_0xf326('0x8'),_0xf326('0x10'),'faxStatus',_0xf326('0x12'),_0xf326('0x13'),_0xf326('0x4a'),_0xf326('0xe'),'whatsappStatus',_0xf326('0x58'),'faxStatusTime','mailStatusTime',_0xf326('0x4c'),'smsStatusTime',_0xf326('0x50'),_0xf326('0x59'),_0xf326('0x40'),'faxCapacity','mailCapacity',_0xf326('0x41'),_0xf326('0x42'),_0xf326('0x43'),'chatCurrentCapacity',_0xf326('0x49'),'mailCurrentCapacity',_0xf326('0x5a'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x52'),_0xf326('0x5b'),_0xf326('0x5c'),_0xf326('0x5d'),_0xf326('0x51'),_0xf326('0x53'),_0xf326('0x5e')];}exports[_0xf326('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 805823f..f9fbb82 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 _0xe3a9=['Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','find','pick','initializeQueues','jayson/promise','util','http','client','available','paused','busy','inUse','invalid','loggedInDb','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase'];(function(_0x581e9b,_0xba21e6){var _0x22190c=function(_0x5b90a6){while(--_0x5b90a6){_0x581e9b['push'](_0x581e9b['shift']());}};_0x22190c(++_0xba21e6);}(_0xe3a9,0x1c9));var _0x9e3a=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0xe3a9[_0xd8a8af];return _0x5b7278;};'use strict';var _=require('lodash');var jayson=require(_0x9e3a('0x0'));var util=require(_0x9e3a('0x1'));var amiClient=jayson['client'][_0x9e3a('0x2')]({'port':0x232a});var routingClient=jayson[_0x9e3a('0x3')][_0x9e3a('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9e3a('0x4'),'loggedIn',_0x9e3a('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x9e3a('0x6'),_0x9e3a('0x7'),_0x9e3a('0x8'),_0x9e3a('0x9'),'notInUse',_0x9e3a('0xa'),_0x9e3a('0xb'),'ringInUse',_0x9e3a('0xc'),_0x9e3a('0xd'),_0x9e3a('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9e3a('0xf'),_0x9e3a('0x10'),_0x9e3a('0x11'),_0x9e3a('0x12'),_0x9e3a('0x13'),_0x9e3a('0x14'),_0x9e3a('0x15'),_0x9e3a('0x16'),_0x9e3a('0x17'),'erlangCalls',_0x9e3a('0x18'),_0x9e3a('0x19'),_0x9e3a('0x1a'),_0x9e3a('0x1b'),_0x9e3a('0x1c'),'dialPredictiveIntervalMinThreshold',_0x9e3a('0x1d'),_0x9e3a('0x1e'),_0x9e3a('0x1f'),_0x9e3a('0x20'),_0x9e3a('0x21'),'predictiveIntervalAvgHoldtime',_0x9e3a('0x22')];function getRealtimeQueues(_0x354fa3,_0x19e985){var _0x14cebf=_0x19e985===_0x9e3a('0x23')?amiClient:routingClient;return _0x14cebf[_0x9e3a('0x24')](_[_0x9e3a('0x25')](_0x19e985)+_0x9e3a('0x26'),_0x354fa3)[_0x9e3a('0x27')](function(_0x32d6cc){if(_0x32d6cc[_0x9e3a('0x28')])throw new Error(util[_0x9e3a('0x29')](_0x9e3a('0x2a'),_0x19e985));return _0x32d6cc[_0x9e3a('0x2b')];})[_0x9e3a('0x2c')](function(_0x419202){throw _0x419202;});}exports[_0x9e3a('0x2d')]=getRealtimeQueues;function initializeQueues(_0xbf28b2,_0xf97dbc,_0x3f758b,_0x5e3bfe){var _0x559fba=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f758b===_0x9e3a('0x23')){if(_0x5e3bfe===_0x9e3a('0x2e')){_0x559fba=_0x559fba[_0x9e3a('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5e3bfe===_0x9e3a('0x30')){_0x559fba=_0x559fba[_0x9e3a('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xbf28b2[_0x9e3a('0x31')](function(_0x4d7af3){var _0x376b82=_0x4d7af3[_0x9e3a('0x32')]({'plain':!![]});_0x376b82[_0x9e3a('0x5')]=0x0;_0x376b82[_0x9e3a('0x9')]=0x0;_0x376b82[_0x9e3a('0x33')]=0x0;_0x376b82['available']=0x0;_0x376b82['waiting']=0x0;if(_0x3f758b==='voice'){_0x376b82[_0x9e3a('0xc')]=0x0;_0x376b82[_0x9e3a('0x6')]=0x0;if(_0x5e3bfe===_0x9e3a('0x30')){_0x376b82[_0x9e3a('0xf')]=0x0;_0x376b82[_0x9e3a('0x10')]=0x0;}}var _0x2bad4e=_[_0x9e3a('0x34')](_0xf97dbc,['id',_0x376b82['id']]);if(_0x2bad4e){_['merge'](_0x376b82,_[_0x9e3a('0x35')](_0x2bad4e,_0x559fba));}return _0x376b82;});}exports[_0x9e3a('0x36')]=initializeQueues; \ No newline at end of file +var _0xf511=['dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','concat','outbound','map','get','waiting','merge','initializeQueues','lodash','client','http','available','loggedIn','paused','busy','loggedInDb','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xf511,0x160));var _0x1f51=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xf511[_0x4ed1d4];return _0x28e363;};'use strict';var _=require(_0x1f51('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson[_0x1f51('0x1')][_0x1f51('0x2')]({'port':0x232a});var routingClient=jayson[_0x1f51('0x1')][_0x1f51('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x1f51('0x3'),_0x1f51('0x4'),_0x1f51('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x1f51('0x6'),'inUse','invalid',_0x1f51('0x7'),'notInUse','onHold','ringing',_0x1f51('0x8'),_0x1f51('0x9'),_0x1f51('0xa'),_0x1f51('0xb')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1f51('0xc'),_0x1f51('0xd'),_0x1f51('0xe'),_0x1f51('0xf'),_0x1f51('0x10'),_0x1f51('0x11'),_0x1f51('0x12'),_0x1f51('0x13'),_0x1f51('0x14'),_0x1f51('0x15'),_0x1f51('0x16'),_0x1f51('0x17'),'erlangBusyFactor',_0x1f51('0x18'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x1f51('0x19'),_0x1f51('0x1a'),_0x1f51('0x1b'),_0x1f51('0x1c'),_0x1f51('0x1d'),_0x1f51('0x1e')];function getRealtimeQueues(_0x1a51f8,_0x2e032e){var _0x3612ac=_0x2e032e===_0x1f51('0x1f')?amiClient:routingClient;return _0x3612ac[_0x1f51('0x20')](_['startCase'](_0x2e032e)+_0x1f51('0x21'),_0x1a51f8)['then'](function(_0xfc96a4){if(_0xfc96a4[_0x1f51('0x22')])throw new Error(util[_0x1f51('0x23')](_0x1f51('0x24'),_0x2e032e));return _0xfc96a4[_0x1f51('0x25')];})[_0x1f51('0x26')](function(_0x55327a){throw _0x55327a;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x54f7c6,_0x1f63c2,_0x172df5,_0x33ca0f){var _0x1dd995=DEFAULT_QUEUE_ATTRIBUTES;if(_0x172df5==='voice'){if(_0x33ca0f==='inbound'){_0x1dd995=_0x1dd995[_0x1f51('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x33ca0f===_0x1f51('0x28')){_0x1dd995=_0x1dd995[_0x1f51('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x54f7c6[_0x1f51('0x29')](function(_0x3fb559){var _0x246c83=_0x3fb559[_0x1f51('0x2a')]({'plain':!![]});_0x246c83[_0x1f51('0x5')]=0x0;_0x246c83[_0x1f51('0x7')]=0x0;_0x246c83[_0x1f51('0x4')]=0x0;_0x246c83[_0x1f51('0x3')]=0x0;_0x246c83[_0x1f51('0x2b')]=0x0;if(_0x172df5==='voice'){_0x246c83[_0x1f51('0x9')]=0x0;_0x246c83['busy']=0x0;if(_0x33ca0f===_0x1f51('0x28')){_0x246c83[_0x1f51('0xc')]=0x0;_0x246c83[_0x1f51('0xd')]=0x0;}}var _0x16d11a=_['find'](_0x1f63c2,['id',_0x246c83['id']]);if(_0x16d11a){_[_0x1f51('0x2c')](_0x246c83,_['pick'](_0x16d11a,_0x1dd995));}return _0x246c83;});}exports[_0x1f51('0x2d')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 884d1c9..a98ea3b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2bf1d6,_0x410efd){var _0x1be08a=function(_0x39c3a2){while(--_0x39c3a2){_0x2bf1d6['push'](_0x2bf1d6['shift']());}};_0x1be08a(++_0x410efd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0e755b6..700e51a 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 _0xf3ba=['md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','crypto','child_process','orderBy','keys','length','filter','IPv4','internal','concat','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash'];(function(_0x450bd1,_0x440954){var _0x36bbf3=function(_0x43c277){while(--_0x43c277){_0x450bd1['push'](_0x450bd1['shift']());}};_0x36bbf3(++_0x440954);}(_0xf3ba,0x76));var _0xaf3b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf3ba[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaf3b('0x0'));var os=require('os');var crypto=require(_0xaf3b('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xaf3b('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x4916e7=[];var _0x236a72=os['networkInterfaces']();var _0x51cf8b=_[_0xaf3b('0x3')](_[_0xaf3b('0x4')](_0x236a72));for(var _0x264b9d=0x0;_0x264b9d<_0x51cf8b[_0xaf3b('0x5')];_0x264b9d++){var _0x558ad4=_0x236a72[_0x51cf8b[_0x264b9d]][_0xaf3b('0x6')](function(_0x5deba7){return _0x5deba7['family']===_0xaf3b('0x7')&&_0x5deba7[_0xaf3b('0x8')]===![];});_0x4916e7=_0x4916e7[_0xaf3b('0x9')](_0x558ad4);}return _0x4916e7;}function getFirstInterface(){var _0x3f0750=_['head'](getInterfaces());return{'macAddress':_0x3f0750&&_0x3f0750['mac']?_0x3f0750['mac']:_0xaf3b('0xa'),'ipAddress':_0x3f0750&&_0x3f0750[_0xaf3b('0xb')]?_0x3f0750[_0xaf3b('0xb')]:_0xaf3b('0xc')};}exports[_0xaf3b('0xd')]=getFirstInterface;function getCPUhash(){var _0x3cc146=_[_0xaf3b('0x3')](os[_0xaf3b('0xe')]()['map'](function(_0x5b7538){return _0x5b7538[_0xaf3b('0xf')];}))[_0xaf3b('0x10')](':');return crypto[_0xaf3b('0x11')](_0xaf3b('0x12'))[_0xaf3b('0x13')](_0x3cc146)['digest'](_0xaf3b('0x14'));}exports[_0xaf3b('0x15')]=function(){var _0x2731c3=os[_0xaf3b('0x16')]();var _0x343482=/[0-9a-f-]{36}/;if(config[_0xaf3b('0x17')]&&_0x343482[_0xaf3b('0x18')](config[_0xaf3b('0x17')])){return config[_0xaf3b('0x17')];}else if(_0x2731c3===_0xaf3b('0x19')){return exec(_0xaf3b('0x1a'),{'encoding':_0xaf3b('0x1b')})[_0xaf3b('0x1c')]('\x0d\x0a','');}else{var _0x528eb0=getFirstInterface();var _0x3b9438=getCPUhash();var _0x1be40b=_0x3b9438+'|'+os[_0xaf3b('0x1d')]()+'|'+_0x528eb0[_0xaf3b('0x1e')]+'|'+_0x528eb0[_0xaf3b('0x1f')];var _0x2ba811=crypto[_0xaf3b('0x11')]('md5')['update'](_0x1be40b)[_0xaf3b('0x20')](_0xaf3b('0x14'));return _0x2ba811[_0xaf3b('0x21')](0x0,0x8)+'-'+_0x2ba811[_0xaf3b('0x21')](0x8,0xc)+'-'+_0x2ba811['substring'](0xc,0x10)+'-'+_0x2ba811[_0xaf3b('0x21')](0x10,0x14)+'-'+_0x2ba811[_0xaf3b('0x21')](0x14);}}; \ No newline at end of file +var _0xcd6b=['execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x270ca1,_0x5a24ef){var _0x29fbb7=function(_0x17b339){while(--_0x17b339){_0x270ca1['push'](_0x270ca1['shift']());}};_0x29fbb7(++_0x5a24ef);}(_0xcd6b,0x1eb));var _0xbcd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbcd6('0x0'));var os=require('os');var crypto=require(_0xbcd6('0x1'));var machine=require(_0xbcd6('0x2'));var exec=require('child_process')[_0xbcd6('0x3')];var config=require('../environment');function getInterfaces(){var _0x540165=[];var _0x4a71e3=os[_0xbcd6('0x4')]();var _0x2221c5=_[_0xbcd6('0x5')](_[_0xbcd6('0x6')](_0x4a71e3));for(var _0x55c59b=0x0;_0x55c59b<_0x2221c5[_0xbcd6('0x7')];_0x55c59b++){var _0x217e32=_0x4a71e3[_0x2221c5[_0x55c59b]][_0xbcd6('0x8')](function(_0x4ace58){return _0x4ace58[_0xbcd6('0x9')]===_0xbcd6('0xa')&&_0x4ace58[_0xbcd6('0xb')]===![];});_0x540165=_0x540165[_0xbcd6('0xc')](_0x217e32);}return _0x540165;}function getFirstInterface(){var _0xfdf160=_[_0xbcd6('0xd')](getInterfaces());return{'macAddress':_0xfdf160&&_0xfdf160['mac']?_0xfdf160[_0xbcd6('0xe')]:_0xbcd6('0xf'),'ipAddress':_0xfdf160&&_0xfdf160[_0xbcd6('0x10')]?_0xfdf160[_0xbcd6('0x10')]:_0xbcd6('0x11')};}exports[_0xbcd6('0x12')]=getFirstInterface;function getCPUhash(){var _0x18f08f=_[_0xbcd6('0x5')](os[_0xbcd6('0x13')]()[_0xbcd6('0x14')](function(_0x202a7b){return _0x202a7b[_0xbcd6('0x15')];}))['join'](':');return crypto[_0xbcd6('0x16')](_0xbcd6('0x17'))[_0xbcd6('0x18')](_0x18f08f)[_0xbcd6('0x19')](_0xbcd6('0x1a'));}exports[_0xbcd6('0x1b')]=function(){var _0x1847a4=os['platform']();var _0x12c27f=/[0-9a-f-]{36}/;if(config[_0xbcd6('0x1c')]&&_0x12c27f[_0xbcd6('0x1d')](config[_0xbcd6('0x1c')])){return config['licenseToken'];}else if(_0x1847a4===_0xbcd6('0x1e')){return exec(_0xbcd6('0x1f'),{'encoding':_0xbcd6('0x20')})[_0xbcd6('0x21')]('\x0d\x0a','');}else{var _0xfb21a8=getFirstInterface();var _0x166d59=getCPUhash();var _0x591327=_0x166d59+'|'+os[_0xbcd6('0x22')]()+'|'+_0xfb21a8[_0xbcd6('0x23')]+'|'+_0xfb21a8[_0xbcd6('0x24')];var _0x2de5bd=crypto[_0xbcd6('0x16')]('md5')['update'](_0x591327)[_0xbcd6('0x19')]('hex');return _0x2de5bd[_0xbcd6('0x25')](0x0,0x8)+'-'+_0x2de5bd[_0xbcd6('0x25')](0x8,0xc)+'-'+_0x2de5bd['substring'](0xc,0x10)+'-'+_0x2de5bd[_0xbcd6('0x25')](0x10,0x14)+'-'+_0x2de5bd['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1b160ef..e663063 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 _0x1f44=['GET','then','get','data2','data1','active','license','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1f44,0x183));var _0x41f4=function(_0x284ed0,_0x4f3cda){_0x284ed0=_0x284ed0-0x0;var _0x3a8497=_0x1f44[_0x284ed0];return _0x3a8497;};'use strict';var util=require(_0x41f4('0x0'));var moment=require(_0x41f4('0x1'));var rp=require(_0x41f4('0x2'));var BPromise=require(_0x41f4('0x3'));var pkginfo=require('pkginfo')(module,_0x41f4('0x4'));var db=require(_0x41f4('0x5'))['db'];var encryptor=require(_0x41f4('0x6'));var hardware=require(_0x41f4('0x7'));var logger=require(_0x41f4('0x8'))('license');var HOST=_0x41f4('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x509126){return new BPromise(function(_0x3b8cd3,_0x11edac){var _0x724e2c=util[_0x41f4('0xa')](_0x41f4('0xb'),HOST,_0x509126,module['exports']['version']);if(oldToken){_0x724e2c=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x509126,module[_0x41f4('0xc')][_0x41f4('0x4')],oldToken);}var _0x3305f6={'uri':_0x724e2c,'method':_0x41f4('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3305f6)[_0x41f4('0xe')](function(_0x2b5141){_0x3b8cd3(_0x2b5141);})['catch'](function(_0x14c65e){_0x11edac(_0x14c65e);});});}function manageLicense(_0x2b6ccc,_0xcdefcf){var _0x258af2=_0xcdefcf[_0x41f4('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x258af2['data1']!==_0x2b6ccc&&!_0x258af2[_0x41f4('0x10')]){oldToken=_0x258af2[_0x41f4('0x11')];}httpRequest(_0x2b6ccc)[_0x41f4('0xe')](function(_0x4f2a8e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4f2a8e[_0x41f4('0x12')]){isOldTokenSent=![];if(!_0x258af2[_0x41f4('0x13')]&&_0x258af2[_0x41f4('0x13')]!=_0x4f2a8e[_0x41f4('0x13')]||_0x258af2[_0x41f4('0x13')]&&_0x258af2[_0x41f4('0x10')]){logger[_0x41f4('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x258af2['license']&&!_0x258af2[_0x41f4('0x10')]&&_0x258af2[_0x41f4('0x13')]!=_0x4f2a8e[_0x41f4('0x13')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x258af2[_0x41f4('0x13')]&&!_0x258af2[_0x41f4('0x10')]&&_0x258af2[_0x41f4('0x13')]==_0x4f2a8e[_0x41f4('0x13')]){return _0xcdefcf;}return _0xcdefcf[_0x41f4('0x15')]({'data1':_0x2b6ccc,'data2':null,'license':_0x4f2a8e['license']});}else{if(_0x4f2a8e['license']||_0x258af2[_0x41f4('0x13')]){if(!_0x258af2[_0x41f4('0x10')]){if(_0x258af2[_0x41f4('0x11')]==_0x2b6ccc){GRAY_PERIOD_REASON=_0x41f4('0x16');logger[_0x41f4('0x14')](_0x41f4('0x17'));}else{GRAY_PERIOD_REASON=_0x41f4('0x18');logger[_0x41f4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x258af2[_0x41f4('0x11')],_0x2b6ccc);}logger[_0x41f4('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x41f4('0xa')](_0x41f4('0x19')));return _0xcdefcf[_0x41f4('0x15')]({'data2':encryptor[_0x41f4('0x1a')](moment()['format'](_0x41f4('0x19')))});}else{if(moment()[_0x41f4('0x1b')](encryptor[_0x41f4('0x1c')](_0x258af2['data2']),_0x41f4('0x1d'))>DAYS){logger[_0x41f4('0x14')](_0x41f4('0x1e'),moment()[_0x41f4('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xcdefcf[_0x41f4('0x15')]({'data1':_0x2b6ccc,'data2':null,'license':null});}}}else{if(_0x258af2[_0x41f4('0x11')]!=_0x2b6ccc){logger[_0x41f4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x258af2[_0x41f4('0x11')],_0x2b6ccc);return _0xcdefcf[_0x41f4('0x15')]({'data1':_0x2b6ccc,'data2':null,'license':null});}}}return _0xcdefcf;})['then'](function(_0x531c89){_0xcdefcf=_0x531c89;})['catch'](function(_0x3be771){logger[_0x41f4('0x1f')](_0x3be771[_0x41f4('0x20')]);})[_0x41f4('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x41f4('0x22')](),_0xcdefcf);},TIME);});}function defaultLicense(){var _0x3f21de=hardware[_0x41f4('0x22')]();if(_0x3f21de){return db['License'][_0x41f4('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3f21de}})[_0x41f4('0x24')](function(_0x3dd248,_0x1dd842){logger[_0x41f4('0x14')](_0x41f4('0x25'),_0x3f21de);manageLicense(_0x3f21de,_0x3dd248);})[_0x41f4('0x26')](function(_0x392fab){logger[_0x41f4('0x1f')](_0x392fab[_0x41f4('0x20')]);});}}exports[_0x41f4('0x27')]=defaultLicense; \ No newline at end of file +var _0x7a79=['message','default','util','moment','request-promise','pkginfo','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','error','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x2ca993,_0x5837f2){var _0x3e146f=function(_0x4a6155){while(--_0x4a6155){_0x2ca993['push'](_0x2ca993['shift']());}};_0x3e146f(++_0x5837f2);}(_0x7a79,0x13a));var _0x97a7=function(_0x17a9a4,_0x103238){_0x17a9a4=_0x17a9a4-0x0;var _0x148d98=_0x7a79[_0x17a9a4];return _0x148d98;};'use strict';var util=require(_0x97a7('0x0'));var moment=require(_0x97a7('0x1'));var rp=require(_0x97a7('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x97a7('0x3'))(module,'version');var db=require(_0x97a7('0x4'))['db'];var encryptor=require(_0x97a7('0x5'));var hardware=require('./hardware');var logger=require(_0x97a7('0x6'))(_0x97a7('0x7'));var HOST=_0x97a7('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x108902){return new BPromise(function(_0x2bda75,_0x76a05b){var _0x2e6e36=util[_0x97a7('0x9')](_0x97a7('0xa'),HOST,_0x108902,module[_0x97a7('0xb')]['version']);if(oldToken){_0x2e6e36=util[_0x97a7('0x9')](_0x97a7('0xc'),HOST,_0x108902,module[_0x97a7('0xb')]['version'],oldToken);}var _0x5222d1={'uri':_0x2e6e36,'method':_0x97a7('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5222d1)[_0x97a7('0xe')](function(_0x2d3cff){_0x2bda75(_0x2d3cff);})[_0x97a7('0xf')](function(_0x2937b1){_0x76a05b(_0x2937b1);});});}function manageLicense(_0x969d10,_0x44700a){var _0x15a998=_0x44700a[_0x97a7('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x15a998['data1']!==_0x969d10&&!_0x15a998[_0x97a7('0x11')]){oldToken=_0x15a998[_0x97a7('0x12')];}httpRequest(_0x969d10)[_0x97a7('0xe')](function(_0x49e0ac){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x49e0ac['active']){isOldTokenSent=![];if(!_0x15a998[_0x97a7('0x7')]&&_0x15a998[_0x97a7('0x7')]!=_0x49e0ac[_0x97a7('0x7')]||_0x15a998[_0x97a7('0x7')]&&_0x15a998[_0x97a7('0x11')]){logger[_0x97a7('0x13')](_0x97a7('0x14'));}if(_0x15a998[_0x97a7('0x7')]&&!_0x15a998[_0x97a7('0x11')]&&_0x15a998[_0x97a7('0x7')]!=_0x49e0ac['license']){logger['info'](_0x97a7('0x15'));}if(_0x15a998[_0x97a7('0x7')]&&!_0x15a998[_0x97a7('0x11')]&&_0x15a998[_0x97a7('0x7')]==_0x49e0ac[_0x97a7('0x7')]){return _0x44700a;}return _0x44700a[_0x97a7('0x16')]({'data1':_0x969d10,'data2':null,'license':_0x49e0ac['license']});}else{if(_0x49e0ac['license']||_0x15a998['license']){if(!_0x15a998['data2']){if(_0x15a998[_0x97a7('0x12')]==_0x969d10){GRAY_PERIOD_REASON=_0x97a7('0x17');logger[_0x97a7('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x97a7('0x18');logger[_0x97a7('0x13')](_0x97a7('0x19'),_0x15a998['data1'],_0x969d10);}logger[_0x97a7('0x13')](_0x97a7('0x1a'),GRAY_PERIOD_REASON[_0x97a7('0x1b')](),moment()[_0x97a7('0x9')](_0x97a7('0x1c')));return _0x44700a['update']({'data2':encryptor[_0x97a7('0x1d')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x97a7('0x1e')](_0x15a998[_0x97a7('0x11')]),_0x97a7('0x1f'))>DAYS){logger[_0x97a7('0x13')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x97a7('0x1c')));isOldTokenSent=![];return _0x44700a['update']({'data1':_0x969d10,'data2':null,'license':null});}}}else{if(_0x15a998[_0x97a7('0x12')]!=_0x969d10){logger[_0x97a7('0x13')](_0x97a7('0x19'),_0x15a998['data1'],_0x969d10);return _0x44700a['update']({'data1':_0x969d10,'data2':null,'license':null});}}}return _0x44700a;})[_0x97a7('0xe')](function(_0x29a44c){_0x44700a=_0x29a44c;})[_0x97a7('0xf')](function(_0x1d0d09){logger[_0x97a7('0x20')](_0x1d0d09['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x97a7('0x21')](),_0x44700a);},TIME);});}function defaultLicense(){var _0x2f40ac=hardware[_0x97a7('0x21')]();if(_0x2f40ac){return db[_0x97a7('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2f40ac}})[_0x97a7('0x23')](function(_0x4d8737,_0x30479e){logger[_0x97a7('0x13')](_0x97a7('0x24'),_0x2f40ac);manageLicense(_0x2f40ac,_0x4d8737);})['catch'](function(_0x1b1027){logger[_0x97a7('0x20')](_0x1b1027[_0x97a7('0x25')]);});}}exports[_0x97a7('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 92fb785..b607142 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 _0xc971=['gray','format','grayReason','changed','message','User','role','sequelize','COUNT','col','count','admin','user','telephone','users','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid'];(function(_0x4bf565,_0x420d33){var _0x30e15f=function(_0x91a47f){while(--_0x91a47f){_0x4bf565['push'](_0x4bf565['shift']());}};_0x30e15f(++_0x420d33);}(_0xc971,0x1b7));var _0x1c97=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xc971[_0x164eca];return _0x2ce562;};'use strict';var util=require(_0x1c97('0x0'));var _=require('lodash');var moment=require(_0x1c97('0x1'));var BPromise=require(_0x1c97('0x2'));var hardware=require(_0x1c97('0x3'));var encryptor=require(_0x1c97('0x4'));var db=require(_0x1c97('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1c97('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1c97('0x7'),'machineUuid':hardware[_0x1c97('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1c97('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1f42aa){return new BPromise(function(_0x3d711a,_0x3886ce){return db['License']['find'](_['defaults'](_0x1f42aa,{'raw':!![],'where':{'id':0x1}}))[_0x1c97('0x9')](function(_0x55f04c){return checkLicense(_0x55f04c,null);})[_0x1c97('0x9')](function(_0x371521){_0x3d711a(_0x371521);return;})[_0x1c97('0xa')](function(_0x41dcdf){_0x3886ce(_0x41dcdf);});});}function checkLicense(_0x5804b1,_0x3efbc8){if(!_0x5804b1){demoLicense[_0x1c97('0xb')]=_0x5804b1[_0x1c97('0xc')];return demoLicense;}try{var _0x7fc97b=_0x3efbc8||_0x5804b1[_0x1c97('0xd')];if(_[_0x1c97('0xe')](_0x7fc97b)){throw new Error(_0x1c97('0xf'));}var _0x1a05e3=_0x5804b1['data1'];var _0x16ead5=_0x5804b1[_0x1c97('0x10')];var _0x13b089=_0x1a05e3['split']('-')[0x4];var _0x369f89=_0x1a05e3[_0x1c97('0x11')]('-')[0x0];var _0x4a2d6c=encryptor[_0x1c97('0x12')](_0x7fc97b,util['format'](_0x1c97('0x13'),_0x13b089,_0x1a05e3,_0x369f89));var _0x4a34d8=JSON[_0x1c97('0x14')](_0x4a2d6c);_0x4a34d8[_0x1c97('0x15')]=![];_0x4a34d8[_0x1c97('0xb')]=_0x1a05e3;_0x4a34d8[_0x1c97('0x16')]=hardware[_0x1c97('0x8')]();if(_0x16ead5){var _0xe46338=encryptor['decryptString'](_0x16ead5);_0x4a34d8[_0x1c97('0x17')]=_0xe46338;_0x4a34d8['deadline']=moment(_0xe46338)['add'](0x7,'days')[_0x1c97('0x18')]();_0x4a34d8[_0x1c97('0x19')]=_0x4a34d8[_0x1c97('0xb')]!=_0x4a34d8[_0x1c97('0x16')]?_0x1c97('0x1a'):'disabled';}return _0x4a34d8;}catch(_0x8a68cb){breakingLicense[_0x1c97('0xb')]=_0x5804b1[_0x1c97('0xc')];breakingLicense[_0x1c97('0x1b')]=_0x8a68cb['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x49f4d5,_0x37bd8e){getLicense()[_0x1c97('0x9')](function(_0x2a97e7){return db[_0x1c97('0x1c')]['findAll']({'attributes':[_0x1c97('0x1d'),[db[_0x1c97('0x1e')]['fn'](_0x1c97('0x1f'),db[_0x1c97('0x1e')][_0x1c97('0x20')]('role')),_0x1c97('0x21')]],'group':_0x1c97('0x1d'),'where':{'role':{'$or':[_0x1c97('0x22'),_0x1c97('0x23'),_0x1c97('0x24')]}},'raw':!![]})['then'](function(_0x28d34f){var _0x317aaf={'user':_0x2a97e7[_0x1c97('0x25')]||0x0,'telephone':_0x2a97e7['telephones']||0x0};_0x28d34f[_0x1c97('0x26')](function(_0x482944){var _0x57c4e7=_0x482944[_0x1c97('0x1d')]===_0x1c97('0x22')?_0x1c97('0x23'):_0x482944[_0x1c97('0x1d')];_0x317aaf[_0x57c4e7]-=_0x482944[_0x1c97('0x21')];if(_0x317aaf[_0x57c4e7]<0x0)_0x317aaf[_0x57c4e7]=0x0;});_0x49f4d5(_0x317aaf);return;});})[_0x1c97('0xa')](function(_0x5327d5){_0x37bd8e(_0x5327d5);});});}function checkUserLimits(_0x413542){return new BPromise(function(_0x14e45b,_0x568786){getLimits()['then'](function(_0x30837a){var _0x37d0d3=_['pick'](_[_0x1c97('0x27')](_0x413542,_0x1c97('0x1d')),[_0x1c97('0x22'),_0x1c97('0x23'),_0x1c97('0x24')]);var _0x50b1de=(_0x37d0d3[_0x1c97('0x22')]||0x0)+(_0x37d0d3[_0x1c97('0x23')]||0x0);var _0x1b1b3a=_0x37d0d3['telephone']||0x0;if(_0x50b1de>_0x30837a[_0x1c97('0x23')])return _0x568786(_0x1c97('0x28'));if(_0x1b1b3a>_0x30837a['telephone'])return _0x568786(_0x1c97('0x29'));return _0x14e45b();})[_0x1c97('0xa')](function(_0x28c101){_0x568786(_0x28c101);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xd183=['decryptString','%s:%s:%s','parse','demo','gray','deadline','days','format','grayReason','machineUuid','disabled','message','User','findAll','role','sequelize','col','admin','user','telephones','forEach','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split'];(function(_0x4c0121,_0x451888){var _0x205464=function(_0x2a999d){while(--_0x2a999d){_0x4c0121['push'](_0x4c0121['shift']());}};_0x205464(++_0x451888);}(_0xd183,0x156));var _0x3d18=function(_0x86883c,_0x54d699){_0x86883c=_0x86883c-0x0;var _0x231dc3=_0xd183[_0x86883c];return _0x231dc3;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var BPromise=require(_0x3d18('0x0'));var hardware=require('./hardware');var encryptor=require(_0x3d18('0x1'));var db=require(_0x3d18('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3d18('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x3d18('0x4')](),'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':_0x3d18('0x5'),'machineUuid':hardware[_0x3d18('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5d6585){return new BPromise(function(_0x45740d,_0x23caa3){return db[_0x3d18('0x6')][_0x3d18('0x7')](_[_0x3d18('0x8')](_0x5d6585,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xe78b68){return checkLicense(_0xe78b68,null);})[_0x3d18('0x9')](function(_0x2d0735){_0x45740d(_0x2d0735);return;})[_0x3d18('0xa')](function(_0x20ebe3){_0x23caa3(_0x20ebe3);});});}function checkLicense(_0x4587a5,_0x44fa29){if(!_0x4587a5){demoLicense[_0x3d18('0xb')]=_0x4587a5[_0x3d18('0xc')];return demoLicense;}try{var _0x3f60df=_0x44fa29||_0x4587a5[_0x3d18('0xd')];if(_[_0x3d18('0xe')](_0x3f60df)){throw new Error(_0x3d18('0xf'));}var _0x43c1bd=_0x4587a5[_0x3d18('0xc')];var _0x22021c=_0x4587a5[_0x3d18('0x10')];var _0x5394aa=_0x43c1bd['split']('-')[0x4];var _0x106579=_0x43c1bd[_0x3d18('0x11')]('-')[0x0];var _0x4d3da8=encryptor[_0x3d18('0x12')](_0x3f60df,util['format'](_0x3d18('0x13'),_0x5394aa,_0x43c1bd,_0x106579));var _0x1a8bcf=JSON[_0x3d18('0x14')](_0x4d3da8);_0x1a8bcf[_0x3d18('0x15')]=![];_0x1a8bcf[_0x3d18('0xb')]=_0x43c1bd;_0x1a8bcf['machineUuid']=hardware[_0x3d18('0x4')]();if(_0x22021c){var _0x115de7=encryptor['decryptString'](_0x22021c);_0x1a8bcf[_0x3d18('0x16')]=_0x115de7;_0x1a8bcf[_0x3d18('0x17')]=moment(_0x115de7)['add'](0x7,_0x3d18('0x18'))[_0x3d18('0x19')]();_0x1a8bcf[_0x3d18('0x1a')]=_0x1a8bcf[_0x3d18('0xb')]!=_0x1a8bcf[_0x3d18('0x1b')]?'changed':_0x3d18('0x1c');}return _0x1a8bcf;}catch(_0x32406d){breakingLicense['uuid']=_0x4587a5[_0x3d18('0xc')];breakingLicense['message']=_0x32406d[_0x3d18('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3f71e1,_0x142898){getLicense()[_0x3d18('0x9')](function(_0x307b27){return db[_0x3d18('0x1e')][_0x3d18('0x1f')]({'attributes':[_0x3d18('0x20'),[db[_0x3d18('0x21')]['fn']('COUNT',db[_0x3d18('0x21')][_0x3d18('0x22')](_0x3d18('0x20'))),'count']],'group':_0x3d18('0x20'),'where':{'role':{'$or':[_0x3d18('0x23'),_0x3d18('0x24'),'telephone']}},'raw':!![]})[_0x3d18('0x9')](function(_0x5d81d9){var _0x4edd78={'user':_0x307b27['users']||0x0,'telephone':_0x307b27[_0x3d18('0x25')]||0x0};_0x5d81d9[_0x3d18('0x26')](function(_0x5df50e){var _0x3eb28c=_0x5df50e[_0x3d18('0x20')]===_0x3d18('0x23')?_0x3d18('0x24'):_0x5df50e['role'];_0x4edd78[_0x3eb28c]-=_0x5df50e[_0x3d18('0x27')];if(_0x4edd78[_0x3eb28c]<0x0)_0x4edd78[_0x3eb28c]=0x0;});_0x3f71e1(_0x4edd78);return;});})[_0x3d18('0xa')](function(_0x4a1f44){_0x142898(_0x4a1f44);});});}function checkUserLimits(_0x4596c0){return new BPromise(function(_0x58c4fb,_0x4f52f9){getLimits()[_0x3d18('0x9')](function(_0x42046f){var _0x2d9cce=_[_0x3d18('0x28')](_[_0x3d18('0x29')](_0x4596c0,_0x3d18('0x20')),[_0x3d18('0x23'),_0x3d18('0x24'),_0x3d18('0x2a')]);var _0x37aab3=(_0x2d9cce[_0x3d18('0x23')]||0x0)+(_0x2d9cce[_0x3d18('0x24')]||0x0);var _0x30a26f=_0x2d9cce[_0x3d18('0x2a')]||0x0;if(_0x37aab3>_0x42046f[_0x3d18('0x24')])return _0x4f52f9('License\x20limit\x20reached\x20for\x20users');if(_0x30a26f>_0x42046f[_0x3d18('0x2a')])return _0x4f52f9(_0x3d18('0x2b'));return _0x58c4fb();})[_0x3d18('0xa')](function(_0x2efcf0){_0x4f52f9(_0x2efcf0);});});}module[_0x3d18('0x2c')]={'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 f4699a4..ae18022 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 _0x5fdc=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x29e6fb,_0x45cac0){var _0x322c48=function(_0x456ed6){while(--_0x456ed6){_0x29e6fb['push'](_0x29e6fb['shift']());}};_0x322c48(++_0x45cac0);}(_0x5fdc,0x127));var _0xc5fd=function(_0x5e068c,_0x4b9102){_0x5e068c=_0x5e068c-0x0;var _0x2fe82d=_0x5fdc[_0x5e068c];return _0x2fe82d;};'use strict';module[_0xc5fd('0x0')]={'DOMAIN':_0xc5fd('0x1'),'SESSION_SECRET':_0xc5fd('0x2'),'GOOGLE_ID':_0xc5fd('0x3'),'GOOGLE_SECRET':_0xc5fd('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x4b17=['secret','exports','myappanuglar-secret'];(function(_0x2a99a1,_0x89652a){var _0x59a31e=function(_0x4604c1){while(--_0x4604c1){_0x2a99a1['push'](_0x2a99a1['shift']());}};_0x59a31e(++_0x89652a);}(_0x4b17,0x10f));var _0x74b1=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0x4b17[_0x305b20];return _0x26d64a;};'use strict';module[_0x74b1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x74b1('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x74b1('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index bd331ae..d033dbf 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4bb=['../utils/loggers','exports'];(function(_0x1d7d07,_0x6447fe){var _0x38c15c=function(_0x12200a){while(--_0x12200a){_0x1d7d07['push'](_0x1d7d07['shift']());}};_0x38c15c(++_0x6447fe);}(_0xf4bb,0x178));var _0xbf4b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xf4bb[_0x4fc9e6];return _0x551d28;};'use strict';var fileLogger=require(_0xbf4b('0x0'))['fileLogger'];module[_0xbf4b('0x1')]=fileLogger; \ No newline at end of file +var _0xb504=['exports','../utils/loggers','fileLogger'];(function(_0x52355b,_0x89404e){var _0xf86f90=function(_0x146a84){while(--_0x146a84){_0x52355b['push'](_0x52355b['shift']());}};_0xf86f90(++_0x89404e);}(_0xb504,0x1cf));var _0x4b50=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb504[_0x1facfa];return _0x9ec701;};'use strict';var fileLogger=require(_0x4b50('0x0'))[_0x4b50('0x1')];module[_0x4b50('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d9658c6..0dddd6d 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 _0xccb5=['resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','xdr','exports','path','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xccb5,0xce));var _0x5ccb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xccb5[_0x2641f9];return _0x585741;};'use strict';var path=require(_0x5ccb('0x0'));var cfg=require(_0x5ccb('0x1'));var env={'NODE_PATH':path[_0x5ccb('0x2')](path[_0x5ccb('0x3')](cfg[_0x5ccb('0x4')],_0x5ccb('0x5')))};var pm2config={'apps':[{'name':_0x5ccb('0x6'),'script':path[_0x5ccb('0x3')](__dirname,_0x5ccb('0x7')),'env':env},{'name':_0x5ccb('0x8'),'script':path[_0x5ccb('0x3')](__dirname,_0x5ccb('0x9')),'env':env},{'name':_0x5ccb('0xa'),'script':path['join'](__dirname,_0x5ccb('0xb')),'env':env},{'name':'email','script':path[_0x5ccb('0x3')](__dirname,_0x5ccb('0xc')),'env':env},{'name':_0x5ccb('0xd'),'script':path[_0x5ccb('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x5ccb('0xe'),'script':path[_0x5ccb('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x5ccb('0xf')]=pm2config; \ No newline at end of file +var _0xc731=['agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','resolve','root','legacy-libs','express','../../services/express/index.js','ami','join','../../services/ami/index.js'];(function(_0x3597a8,_0x21ed84){var _0x5dacc7=function(_0x1bc00b){while(--_0x1bc00b){_0x3597a8['push'](_0x3597a8['shift']());}};_0x5dacc7(++_0x21ed84);}(_0xc731,0x98));var _0x1c73=function(_0x3b9496,_0x4f538a){_0x3b9496=_0x3b9496-0x0;var _0x5b9202=_0xc731[_0x3b9496];return _0x5b9202;};'use strict';var path=require(_0x1c73('0x0'));var cfg=require(_0x1c73('0x1'));var env={'NODE_PATH':path[_0x1c73('0x2')](path['join'](cfg[_0x1c73('0x3')],_0x1c73('0x4')))};var pm2config={'apps':[{'name':_0x1c73('0x5'),'script':path['join'](__dirname,_0x1c73('0x6')),'env':env},{'name':_0x1c73('0x7'),'script':path[_0x1c73('0x8')](__dirname,_0x1c73('0x9')),'env':env},{'name':_0x1c73('0xa'),'script':path[_0x1c73('0x8')](__dirname,_0x1c73('0xb')),'env':env},{'name':_0x1c73('0xc'),'script':path['join'](__dirname,_0x1c73('0xd')),'env':env},{'name':_0x1c73('0xe'),'script':path[_0x1c73('0x8')](__dirname,_0x1c73('0xf')),'env':env},{'name':_0x1c73('0x10'),'script':path[_0x1c73('0x8')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x1c73('0x11')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5c2d158..fddf01d 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 _0x4a11=['disconnect','restart','list','delete','dump','saved','pm2','bluebird','connect','connected','start','then'];(function(_0x392f9c,_0x25d116){var _0x57805a=function(_0x4b0892){while(--_0x4b0892){_0x392f9c['push'](_0x392f9c['shift']());}};_0x57805a(++_0x25d116);}(_0x4a11,0x17a));var _0x14a1=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x4a11[_0x21b36c];return _0x236627;};'use strict';var pm2=require(_0x14a1('0x0'));var BPromise=require(_0x14a1('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x55a5b6,_0x6cb42a){return pm2[_0x14a1('0x2')](function(_0x82601c){if(_0x82601c){return _0x6cb42a(_0x82601c);}return _0x55a5b6(_0x14a1('0x3'));});});};exports[_0x14a1('0x4')]=function(_0x1f9b0d){return connect()[_0x14a1('0x5')](function(){return new BPromise(function(_0x4f0b91,_0xa98fe5){return pm2[_0x14a1('0x4')](_0x1f9b0d,function(_0x4d71a0,_0x3dae18){if(_0x4d71a0){return _0xa98fe5(_0x4d71a0);}pm2[_0x14a1('0x6')]();return _0x4f0b91(_0x3dae18);});});});};exports['stop']=function(_0x4e3de1){return connect()[_0x14a1('0x5')](function(){return new BPromise(function(_0x446c3f,_0x27a5a4){return pm2['stop'](_0x4e3de1,function(_0x4fa841,_0x5a6abd){if(_0x4fa841){return _0x27a5a4(_0x4fa841);}pm2[_0x14a1('0x6')]();return _0x446c3f(_0x5a6abd);});});});};exports[_0x14a1('0x7')]=function(_0x2b4cd4){return connect()[_0x14a1('0x5')](function(){return new BPromise(function(_0xee3b9a,_0x2b75cd){return pm2[_0x14a1('0x7')](_0x2b4cd4,function(_0x35d2e0,_0x2f6e93){if(_0x35d2e0){return _0x2b75cd(_0x35d2e0);}pm2[_0x14a1('0x6')]();return _0xee3b9a(_0x2f6e93);});});});};exports[_0x14a1('0x8')]=function(){return connect()[_0x14a1('0x5')](function(){return new BPromise(function(_0xc163cd,_0x3a7294){return pm2['list'](function(_0x482415,_0x17a6cf){if(_0x482415){return _0x3a7294(_0x482415);}pm2[_0x14a1('0x6')]();return _0xc163cd(_0x17a6cf);});});});};exports['describe']=function(_0x260331){return connect()['then'](function(){return new BPromise(function(_0x2c0673,_0x5e9dad){return pm2['describe'](_0x260331,function(_0x5439af,_0xf18335){if(_0x5439af){return _0x5e9dad(_0x5439af);}pm2['disconnect']();return _0x2c0673(_0xf18335);});});});};exports[_0x14a1('0x9')]=function(_0x389bd6){return connect()[_0x14a1('0x5')](function(){return new BPromise(function(_0x2db64c,_0x1ddcf9){return pm2['delete'](_0x389bd6,function(_0x427cd7,_0xa5f7a6){if(_0x427cd7){return _0x1ddcf9(_0x427cd7);}pm2[_0x14a1('0x6')]();return _0x2db64c(_0xa5f7a6);});});});};exports[_0x14a1('0xa')]=function(){return connect()[_0x14a1('0x5')](function(){return new BPromise(function(_0x5e8aa4,_0x581186){return pm2[_0x14a1('0xa')](function(_0x3a9338){if(_0x3a9338){return _0x581186(_0x3a9338);}return _0x5e8aa4(_0x14a1('0xb'));});});});}; \ No newline at end of file +var _0xb9fa=['saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','describe','delete','dump'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xb9fa,0xb7));var _0xab9f=function(_0x48edf1,_0x342345){_0x48edf1=_0x48edf1-0x0;var _0x34894b=_0xb9fa[_0x48edf1];return _0x34894b;};'use strict';var pm2=require(_0xab9f('0x0'));var BPromise=require(_0xab9f('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5ddb6f,_0x244489){return pm2[_0xab9f('0x2')](function(_0x3188cf){if(_0x3188cf){return _0x244489(_0x3188cf);}return _0x5ddb6f(_0xab9f('0x3'));});});};exports[_0xab9f('0x4')]=function(_0x41c1cd){return connect()[_0xab9f('0x5')](function(){return new BPromise(function(_0x195e0a,_0x2a0dc7){return pm2['start'](_0x41c1cd,function(_0x35229f,_0x36d59c){if(_0x35229f){return _0x2a0dc7(_0x35229f);}pm2[_0xab9f('0x6')]();return _0x195e0a(_0x36d59c);});});});};exports[_0xab9f('0x7')]=function(_0x387192){return connect()[_0xab9f('0x5')](function(){return new BPromise(function(_0x415b12,_0x22e01f){return pm2[_0xab9f('0x7')](_0x387192,function(_0x26c4b6,_0x1965b3){if(_0x26c4b6){return _0x22e01f(_0x26c4b6);}pm2[_0xab9f('0x6')]();return _0x415b12(_0x1965b3);});});});};exports['restart']=function(_0x2db208){return connect()[_0xab9f('0x5')](function(){return new BPromise(function(_0x17ff39,_0x1a3681){return pm2[_0xab9f('0x8')](_0x2db208,function(_0x5ccb80,_0x37e141){if(_0x5ccb80){return _0x1a3681(_0x5ccb80);}pm2[_0xab9f('0x6')]();return _0x17ff39(_0x37e141);});});});};exports['list']=function(){return connect()[_0xab9f('0x5')](function(){return new BPromise(function(_0x4c0dc2,_0x47836b){return pm2['list'](function(_0x2c598d,_0x224d2b){if(_0x2c598d){return _0x47836b(_0x2c598d);}pm2['disconnect']();return _0x4c0dc2(_0x224d2b);});});});};exports['describe']=function(_0x3f48fe){return connect()[_0xab9f('0x5')](function(){return new BPromise(function(_0xe9e4b,_0x49b94d){return pm2[_0xab9f('0x9')](_0x3f48fe,function(_0x48649a,_0x2051c1){if(_0x48649a){return _0x49b94d(_0x48649a);}pm2[_0xab9f('0x6')]();return _0xe9e4b(_0x2051c1);});});});};exports[_0xab9f('0xa')]=function(_0xa070bc){return connect()['then'](function(){return new BPromise(function(_0x1756c8,_0x3cda44){return pm2[_0xab9f('0xa')](_0xa070bc,function(_0x1922da,_0x1da3f5){if(_0x1922da){return _0x3cda44(_0x1922da);}pm2[_0xab9f('0x6')]();return _0x1756c8(_0x1da3f5);});});});};exports[_0xab9f('0xb')]=function(){return connect()[_0xab9f('0x5')](function(){return new BPromise(function(_0x2581ff,_0x4e0499){return pm2['dump'](function(_0xef56a9){if(_0xef56a9){return _0x4e0499(_0xef56a9);}return _0x2581ff(_0xab9f('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d44639d..c2f5c0e 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 _0xa726=['join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0xa726,0x161));var _0x6a72=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xa726[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x6a72('0x0'));var moment=require(_0x6a72('0x1'));var Redis=require(_0x6a72('0x2'));var util=require('util');var config=require(_0x6a72('0x3'));var db=require(_0x6a72('0x4'))['db'];var logger=require(_0x6a72('0x5'))(_0x6a72('0x6'));config[_0x6a72('0x7')]=_['defaults'](config[_0x6a72('0x7')],{'host':_0x6a72('0x8'),'port':0x18eb});var io=require(_0x6a72('0x9'))(new Redis(config[_0x6a72('0x7')]));function closeInteractions(){var _0x5d5de6=0x0;var _0x128877=[];return db[_0x6a72('0xa')][_0x6a72('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x6a72('0xc')](function(_0x39cff1){_0x5d5de6=_0x39cff1[_0x6a72('0xd')];if(_0x5d5de6){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6a72('0xe')](_0x39cff1['chatTimeout'],'minutes')}}});}else{return[];}})[_0x6a72('0xc')](function(_0x5db295){if(_0x5db295&&_0x5db295[_0x6a72('0xf')]){_0x128877=_[_0x6a72('0x10')](_0x5db295||[],'id');logger[_0x6a72('0x11')](_0x6a72('0x12'),_0x128877[_0x6a72('0x13')]());return db['ChatInteraction'][_0x6a72('0x14')]({'closeReason':'system','disposition':_0x6a72('0x15'),'closed':!![],'closedAt':moment()[_0x6a72('0x16')](_0x6a72('0x17'))},{'where':{'id':_0x128877}});}})[_0x6a72('0xc')](function(){if(_0x128877&&_0x128877['length']){logger[_0x6a72('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x128877[_0x6a72('0x13')]());for(var _0x2c1e53=0x0;_0x2c1e53<_0x128877[_0x6a72('0xf')];_0x2c1e53++){io[_0x6a72('0x18')](_0x6a72('0x19'),{'id':_0x128877[_0x2c1e53],'closed':!![]});}}})[_0x6a72('0x1a')](function(_0x2a6994){logger[_0x6a72('0x1b')](_0x6a72('0x1c'),_0x2a6994?util[_0x6a72('0x1d')](_0x2a6994,{'showHidden':![],'depth':null}):'');});}exports[_0x6a72('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3733=['then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','lodash','moment','util','../../config/environment','../logger','schedule','defaults','redis','localhost','Setting','chatTimeout'];(function(_0x406d5c,_0x467738){var _0x2e4af6=function(_0x5529d2){while(--_0x5529d2){_0x406d5c['push'](_0x406d5c['shift']());}};_0x2e4af6(++_0x467738);}(_0x3733,0x1c6));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3373('0x0'));var moment=require(_0x3373('0x1'));var Redis=require('ioredis');var util=require(_0x3373('0x2'));var config=require(_0x3373('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x3373('0x4'))(_0x3373('0x5'));config['redis']=_[_0x3373('0x6')](config[_0x3373('0x7')],{'host':_0x3373('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3373('0x7')]));function closeInteractions(){var _0x22d1b3=0x0;var _0xae733d=[];return db[_0x3373('0x9')]['find']({'raw':!![],'attributes':['id',_0x3373('0xa')],'where':{'id':0x1}})[_0x3373('0xb')](function(_0x571322){_0x22d1b3=_0x571322[_0x3373('0xa')];if(_0x22d1b3){return db[_0x3373('0xc')][_0x3373('0xd')]({'raw':!![],'attributes':['id',_0x3373('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3373('0xf')](_0x571322['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0xb88684){if(_0xb88684&&_0xb88684[_0x3373('0x10')]){_0xae733d=_[_0x3373('0x11')](_0xb88684||[],'id');logger[_0x3373('0x12')](_0x3373('0x13'),_0xae733d[_0x3373('0x14')]());return db[_0x3373('0xc')]['update']({'closeReason':_0x3373('0x15'),'disposition':_0x3373('0x16'),'closed':!![],'closedAt':moment()[_0x3373('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xae733d}});}})['then'](function(){if(_0xae733d&&_0xae733d[_0x3373('0x10')]){logger[_0x3373('0x12')](_0x3373('0x18'),_0xae733d['join']());for(var _0x405725=0x0;_0x405725<_0xae733d[_0x3373('0x10')];_0x405725++){io[_0x3373('0x19')](_0x3373('0x1a'),{'id':_0xae733d[_0x405725],'closed':!![]});}}})[_0x3373('0x1b')](function(_0x4519f1){logger[_0x3373('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4519f1?util[_0x3373('0x1d')](_0x4519f1,{'showHidden':![],'depth':null}):'');});}exports[_0x3373('0x1e')]=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 f422d1a..b780677 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 _0xdee7=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x315eea,_0x1b0d52){var _0x20a0a5=function(_0x207f3e){while(--_0x207f3e){_0x315eea['push'](_0x315eea['shift']());}};_0x20a0a5(++_0x1b0d52);}(_0xdee7,0xc5));var _0x7dee=function(_0x1c4641,_0x317d67){_0x1c4641=_0x1c4641-0x0;var _0x2fc9ee=_0xdee7[_0x1c4641];return _0x2fc9ee;};'use strict';function start(){var _0x2641a0=require(_0x7dee('0x0'));return _0x2641a0[_0x7dee('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x3c56=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x474476,_0x53ec8c){var _0x4abd6c=function(_0x1df20f){while(--_0x1df20f){_0x474476['push'](_0x474476['shift']());}};_0x4abd6c(++_0x53ec8c);}(_0x3c56,0xea));var _0x63c5=function(_0x41f747,_0x4ebc43){_0x41f747=_0x41f747-0x0;var _0x5dcf17=_0x3c56[_0x41f747];return _0x5dcf17;};'use strict';function start(){var _0x4991b6=require(_0x63c5('0x0'));return _0x4991b6['startAllRefreshIntervals']();}module[_0x63c5('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9a75da1..a2b3e33 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 _0x2fc7=['exists','deleteJob','delete\x20cron','toRun','index','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop','stop\x20cron','startAt','update\x20cron','run','lodash','moment','cron-job-manager','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','MailAccount','name','user','bcc','format','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','Sent','text','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length'];(function(_0x1489f8,_0x25b766){var _0x3c7f99=function(_0x1809b9){while(--_0x1809b9){_0x1489f8['push'](_0x1489f8['shift']());}};_0x3c7f99(++_0x25b766);}(_0x2fc7,0x1a2));var _0x72fc=function(_0x1b8729,_0x13dcd0){_0x1b8729=_0x1b8729-0x0;var _0x581199=_0x2fc7[_0x1b8729];return _0x581199;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x72fc('0x0'));var moment=require(_0x72fc('0x1'));var CronJobManager=require(_0x72fc('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x72fc('0x3'))(_0x72fc('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x72fc('0x5'));var analyticDefaultReportController=require(_0x72fc('0x6'));var client=jayson[_0x72fc('0x7')][_0x72fc('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x24ccce,_0x5b7cb6){return function(){logger['info'](_0x72fc('0x9'),_0x24ccce[_0x72fc('0xa')]);var _0x38b6dd=!![];var _0x4d9c61=_0x24ccce['MailAccount'][_0x72fc('0xb')]();var _0x550290={'account':_0x4d9c61,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x24ccce[_0x72fc('0xc')][_0x72fc('0xd')],_0x24ccce['MailAccount'][_0x72fc('0xa')]||_0x24ccce[_0x72fc('0xc')]['Smtp'][_0x72fc('0xe')]),'to':_0x24ccce[_0x72fc('0xa')],'cc':_0x24ccce['cc'],'bcc':_0x24ccce[_0x72fc('0xf')],'subject':util[_0x72fc('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x5b7cb6[_0x72fc('0xd')],_0x24ccce[_0x72fc('0x11')],_0x24ccce[_0x72fc('0x12')])}};var _0x1494af=path[_0x72fc('0x13')](__dirname,'../../files/reports');var _0x3a8114=_0x5b7cb6[_0x72fc('0x14')];var _0x4b2f90=util['format'](_0x72fc('0x15'),path[_0x72fc('0x16')](_0x5b7cb6['savename'],path[_0x72fc('0x17')](_0x5b7cb6[_0x72fc('0x14')])),_0x72fc('0x18'));var _0xe9ff41=path[_0x72fc('0x13')](_0x1494af,_0x3a8114);var _0x1a2ccb=path[_0x72fc('0x13')](_0x1494af,_0x4b2f90);if(fs[_0x72fc('0x19')](_0xe9ff41)){_0x5b7cb6[_0x72fc('0x1a')]='Sent';_0x550290[_0x72fc('0x1b')][_0x72fc('0x1c')]=[{'filename':_0x3a8114,'path':_0xe9ff41}];_0x550290['message']['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x5b7cb6,null,0x2));}else if(fs['existsSync'](_0x1a2ccb)){_0x5b7cb6[_0x72fc('0x1a')]=_0x72fc('0x1d');_0x550290[_0x72fc('0x1b')][_0x72fc('0x1c')]=[{'filename':_0x4b2f90,'path':_0x1a2ccb}];}else{_0x550290[_0x72fc('0x1b')][_0x72fc('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x24ccce[_0x72fc('0x1f')]){_0x38b6dd=![];logger[_0x72fc('0x20')](_0x72fc('0x21'));}}if(_0x38b6dd){return client['request'](_0x72fc('0x22'),_0x550290)[_0x72fc('0x23')](function(_0x13f6ff){if(_0x13f6ff[_0x72fc('0x24')]){return logger[_0x72fc('0x24')](_0x72fc('0x25'),JSON[_0x72fc('0x26')](_0x13f6ff));}return logger[_0x72fc('0x20')](_0x72fc('0x27'));})[_0x72fc('0x28')](function(_0x389c62){return logger[_0x72fc('0x24')]('error\x20mail',JSON['stringify'](_0x389c62));});}};}function handleError(){return function(_0x56ace1){return logger[_0x72fc('0x24')](JSON[_0x72fc('0x26')](_0x56ace1));};}function handleResult(_0x356419){return function(_0x155d29){logger['info']('data',JSON[_0x72fc('0x26')](_0x155d29));if(_0x356419[_0x72fc('0xc')]&&_0x356419[_0x72fc('0xc')][_0x72fc('0x29')]&&!_[_0x72fc('0x2a')](_0x356419[_0x72fc('0xa')])){setTimeout(handleSendEmail(_0x356419,_0x155d29),0x3c*0x3e8);}};}function handleJob(_0x43abec){return function(){try{if(_[_0x72fc('0x2a')](_0x43abec[_0x72fc('0x11')])){return logger[_0x72fc('0x20')](_0x72fc('0x2b'));}if(_[_0x72fc('0x2a')](_0x43abec[_0x72fc('0x12')])){return logger[_0x72fc('0x20')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3d8ff9={'startDate':moment()['subtract'](_0x43abec['subtractNumber'],_0x43abec[_0x72fc('0x12')])['format'](_0x72fc('0x2c')),'endDate':moment()['format'](_0x72fc('0x2c')),'type':'scheduled','output':_0x43abec[_0x72fc('0x2d')],'name':_0x43abec[_0x72fc('0xd')]};if(!_['isNil'](_0x43abec[_0x72fc('0x2e')])){logger[_0x72fc('0x20')](_0x72fc('0x2f'),_0x43abec[_0x72fc('0x2e')]);return analyticDefaultReportController[_0x72fc('0x30')]({'id':_0x43abec[_0x72fc('0x2e')]},_0x3d8ff9)[_0x72fc('0x23')](handleResult(_0x43abec))['catch'](handleError());}if(!_[_0x72fc('0x2a')](_0x43abec[_0x72fc('0x31')])){logger['info'](_0x72fc('0x32'),_0x43abec[_0x72fc('0x31')]);return analyticCustomReportController['runReport']({'id':_0x43abec[_0x72fc('0x31')]},_0x3d8ff9)[_0x72fc('0x23')](handleResult(_0x43abec))['catch'](handleError());}}catch(_0x3ca949){logger[_0x72fc('0x24')](JSON[_0x72fc('0x26')](_0x3ca949));}return logger[_0x72fc('0x20')](_0x72fc('0x33'));};}function getJobs(_0xde1a75){var _0x65dddc={};if(_0xde1a75){_0x65dddc['id']=_0xde1a75;}return db['Schedule'][_0x72fc('0x34')]({'where':_0x65dddc,'include':[{'model':db[_0x72fc('0xc')],'attributes':['id',_0x72fc('0xd'),_0x72fc('0xa')],'include':[{'model':db['MailServerOut'],'as':_0x72fc('0x29'),'include':[{'model':db[_0x72fc('0x35')],'as':'CloudProvider'}]}]}]})[_0x72fc('0x23')](function(_0x31feaa){var _0x4f7559=_[_0x72fc('0x36')](manager[_0x72fc('0x37')]);var _0x4dac99=_[_0x72fc('0x38')](_0x31feaa,function(_0x435238){return _0x435238['id'][_0x72fc('0x39')]();});var _0x3ffd5c=_[_0x72fc('0x3a')](_0x31feaa,function(_0x5c6bdf){return _0x5c6bdf['id'][_0x72fc('0x39')]();});var _0x3c151f=_0xde1a75?_0x4dac99:_[_0x72fc('0x3b')](_0x4dac99,_0x4f7559);var _0x209819=_[_0x72fc('0x3c')](_0x4dac99,_0x4f7559);var _0x1516c5=_['difference'](_0x4f7559,_0x4dac99);var _0x5b8d82;var _0x1e2c84;for(_0x5b8d82=0x0;_0x5b8d82<_0x1516c5[_0x72fc('0x3d')]&&!_0xde1a75;_0x5b8d82+=0x1){_0x1e2c84=_0x1516c5[_0x5b8d82][_0x72fc('0x39')]();if(manager[_0x72fc('0x3e')](_0x1e2c84)){manager['stop'](_0x1e2c84);manager[_0x72fc('0x3f')](_0x1e2c84);logger[_0x72fc('0x20')](_0x72fc('0x40'),_0x1e2c84);}}logger['info'](_0x72fc('0x41'),JSON[_0x72fc('0x26')](_0x3c151f));for(_0x5b8d82=0x0;_0x5b8d82<_0x3c151f[_0x72fc('0x3d')];_0x5b8d82+=0x1){_0x1e2c84=_0x3c151f[_0x5b8d82]['toString']();logger[_0x72fc('0x20')](_0x72fc('0x42'),_0x1e2c84);if(_0xde1a75){logger['info']('my\x20id',_0xde1a75);logger[_0x72fc('0x20')](JSON[_0x72fc('0x26')](_0x3ffd5c[_0x1e2c84]));BPromise['resolve']()[_0x72fc('0x23')](handleJob(_0x3ffd5c[_0x1e2c84]));logger[_0x72fc('0x20')](_0x72fc('0x43'),_0x3ffd5c[_0x1e2c84][_0x72fc('0xd')],_0x3ffd5c[_0x1e2c84]['cron']);}else if(_0x3ffd5c[_0x1e2c84][_0x72fc('0x44')]&&_0x3ffd5c[_0x1e2c84][_0x72fc('0x45')]&&moment()[_0x72fc('0x46')](_0x3ffd5c[_0x1e2c84]['startAt'],_0x3ffd5c[_0x1e2c84][_0x72fc('0x47')])){manager[_0x72fc('0x48')](_0x1e2c84,_0x3ffd5c[_0x1e2c84]['cron'],handleJob(_0x3ffd5c[_0x1e2c84]));manager[_0x72fc('0x49')](_0x1e2c84);logger[_0x72fc('0x20')](_0x72fc('0x4a'),_0x3ffd5c[_0x1e2c84][_0x72fc('0xd')],_0x3ffd5c[_0x1e2c84][_0x72fc('0x44')]);}else if(manager[_0x72fc('0x3e')](_0x1e2c84)){manager[_0x72fc('0x4b')](_0x1e2c84);manager['deleteJob'](_0x1e2c84);logger[_0x72fc('0x20')](_0x72fc('0x4c'),_0x3ffd5c[_0x1e2c84][_0x72fc('0xd')],_0x3ffd5c[_0x1e2c84]['cron']);}}for(_0x5b8d82=0x0,_0x1e2c84;_0x5b8d82<_0x209819['length']&&!_0xde1a75;_0x5b8d82+=0x1){_0x1e2c84=_0x209819[_0x5b8d82][_0x72fc('0x39')]();if(manager['exists'](_0x1e2c84)){if(_0x3ffd5c[_0x1e2c84]['cron']&&_0x3ffd5c[_0x1e2c84][_0x72fc('0x45')]&&moment()[_0x72fc('0x46')](_0x3ffd5c[_0x1e2c84][_0x72fc('0x4d')],_0x3ffd5c[_0x1e2c84][_0x72fc('0x47')])){manager['update'](_0x1e2c84,_0x3ffd5c[_0x1e2c84][_0x72fc('0x44')],handleJob(_0x3ffd5c[_0x1e2c84]));logger[_0x72fc('0x20')](_0x72fc('0x4e'),_0x3ffd5c[_0x1e2c84][_0x72fc('0xd')],_0x3ffd5c[_0x1e2c84]['cron']);}else{manager[_0x72fc('0x4b')](_0x1e2c84);manager['deleteJob'](_0x1e2c84);logger['info'](_0x72fc('0x4c'),_0x3ffd5c[_0x1e2c84][_0x72fc('0xd')],_0x3ffd5c[_0x1e2c84]['cron']);}}}})[_0x72fc('0x28')](function(_0x1b7842){logger[_0x72fc('0x24')](JSON[_0x72fc('0x26')](_0x1b7842));});}exports[_0x72fc('0x4f')]=function(_0x1fa542){return getJobs(_0x1fa542);};exports[_0x72fc('0x49')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0d93=['../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','zip','status','Sent','message','text','stringify','existsSync','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','then','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','start','deleteJob','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller'];(function(_0x578131,_0x15425f){var _0x3f1b45=function(_0x53b32e){while(--_0x53b32e){_0x578131['push'](_0x578131['shift']());}};_0x3f1b45(++_0x15425f);}(_0x0d93,0xa4));var _0x30d9=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x0d93[_0x571c1d];return _0x33c609;};'use strict';var fs=require('fs');var util=require(_0x30d9('0x0'));var path=require(_0x30d9('0x1'));var _=require(_0x30d9('0x2'));var moment=require(_0x30d9('0x3'));var CronJobManager=require(_0x30d9('0x4'));var jayson=require(_0x30d9('0x5'));var BPromise=require(_0x30d9('0x6'));var logger=require(_0x30d9('0x7'))(_0x30d9('0x8'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x30d9('0x9'));var analyticDefaultReportController=require(_0x30d9('0xa'));var client=jayson[_0x30d9('0xb')][_0x30d9('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x47a88d,_0x1edd0a){return function(){logger[_0x30d9('0xd')](_0x30d9('0xe'),_0x47a88d[_0x30d9('0xf')]);var _0x38db2f=!![];var _0xce3749=_0x47a88d[_0x30d9('0x10')][_0x30d9('0x11')]();var _0x29b6a3={'account':_0xce3749,'message':{'from':util[_0x30d9('0x12')](_0x30d9('0x13'),_0x47a88d[_0x30d9('0x10')][_0x30d9('0x14')],_0x47a88d[_0x30d9('0x10')][_0x30d9('0xf')]||_0x47a88d[_0x30d9('0x10')][_0x30d9('0x15')][_0x30d9('0x16')]),'to':_0x47a88d[_0x30d9('0xf')],'cc':_0x47a88d['cc'],'bcc':_0x47a88d['bcc'],'subject':util['format'](_0x30d9('0x17'),_0x1edd0a['name'],_0x47a88d['subtractNumber'],_0x47a88d[_0x30d9('0x18')])}};var _0x43dc35=path[_0x30d9('0x19')](__dirname,_0x30d9('0x1a'));var _0x19f47a=_0x1edd0a[_0x30d9('0x1b')];var _0x5d1b43=util['format'](_0x30d9('0x1c'),path['basename'](_0x1edd0a['savename'],path['extname'](_0x1edd0a[_0x30d9('0x1b')])),_0x30d9('0x1d'));var _0x5d4f41=path['join'](_0x43dc35,_0x19f47a);var _0x53cc07=path[_0x30d9('0x19')](_0x43dc35,_0x5d1b43);if(fs['existsSync'](_0x5d4f41)){_0x1edd0a[_0x30d9('0x1e')]=_0x30d9('0x1f');_0x29b6a3[_0x30d9('0x20')]['attachments']=[{'filename':_0x19f47a,'path':_0x5d4f41}];_0x29b6a3[_0x30d9('0x20')][_0x30d9('0x21')]=util[_0x30d9('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x30d9('0x22')](_0x1edd0a,null,0x2));}else if(fs[_0x30d9('0x23')](_0x53cc07)){_0x1edd0a[_0x30d9('0x1e')]=_0x30d9('0x1f');_0x29b6a3[_0x30d9('0x20')][_0x30d9('0x24')]=[{'filename':_0x5d1b43,'path':_0x53cc07}];}else{_0x29b6a3[_0x30d9('0x20')][_0x30d9('0x21')]=_0x30d9('0x25');if(!_0x47a88d[_0x30d9('0x26')]){_0x38db2f=![];logger[_0x30d9('0xd')](_0x30d9('0x27'));}}if(_0x38db2f){return client[_0x30d9('0x28')]('SendMail',_0x29b6a3)['then'](function(_0x2a68a0){if(_0x2a68a0[_0x30d9('0x29')]){return logger[_0x30d9('0x29')](_0x30d9('0x2a'),JSON[_0x30d9('0x22')](_0x2a68a0));}return logger[_0x30d9('0xd')](_0x30d9('0x2b'));})[_0x30d9('0x2c')](function(_0x3b82cf){return logger[_0x30d9('0x29')](_0x30d9('0x2a'),JSON[_0x30d9('0x22')](_0x3b82cf));});}};}function handleError(){return function(_0x2bd9b8){return logger['error'](JSON[_0x30d9('0x22')](_0x2bd9b8));};}function handleResult(_0x14075e){return function(_0xdf8b67){logger[_0x30d9('0xd')]('data',JSON['stringify'](_0xdf8b67));if(_0x14075e[_0x30d9('0x10')]&&_0x14075e[_0x30d9('0x10')][_0x30d9('0x15')]&&!_[_0x30d9('0x2d')](_0x14075e['email'])){setTimeout(handleSendEmail(_0x14075e,_0xdf8b67),0x3c*0x3e8);}};}function handleJob(_0x4e93c9){return function(){try{if(_['isNil'](_0x4e93c9[_0x30d9('0x2e')])){return logger[_0x30d9('0xd')](_0x30d9('0x2f'));}if(_[_0x30d9('0x2d')](_0x4e93c9[_0x30d9('0x18')])){return logger[_0x30d9('0xd')]('subtractUnit\x20null\x20or\x20undefined');}var _0x447808={'startDate':moment()[_0x30d9('0x30')](_0x4e93c9[_0x30d9('0x2e')],_0x4e93c9[_0x30d9('0x18')])[_0x30d9('0x12')](_0x30d9('0x31')),'endDate':moment()[_0x30d9('0x12')](_0x30d9('0x31')),'type':_0x30d9('0x32'),'output':_0x4e93c9[_0x30d9('0x33')],'name':_0x4e93c9[_0x30d9('0x14')]};if(!_[_0x30d9('0x2d')](_0x4e93c9[_0x30d9('0x34')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4e93c9[_0x30d9('0x34')]);return analyticDefaultReportController['runReport']({'id':_0x4e93c9[_0x30d9('0x34')]},_0x447808)[_0x30d9('0x35')](handleResult(_0x4e93c9))['catch'](handleError());}if(!_['isNil'](_0x4e93c9[_0x30d9('0x36')])){logger[_0x30d9('0xd')]('exec\x20custom\x20report\x20id:%s',_0x4e93c9['CustomReportId']);return analyticCustomReportController[_0x30d9('0x37')]({'id':_0x4e93c9[_0x30d9('0x36')]},_0x447808)[_0x30d9('0x35')](handleResult(_0x4e93c9))[_0x30d9('0x2c')](handleError());}}catch(_0x365b63){logger[_0x30d9('0x29')](JSON[_0x30d9('0x22')](_0x365b63));}return logger[_0x30d9('0xd')](_0x30d9('0x38'));};}function getJobs(_0x3e9366){var _0x2cd6da={};if(_0x3e9366){_0x2cd6da['id']=_0x3e9366;}return db[_0x30d9('0x39')][_0x30d9('0x3a')]({'where':_0x2cd6da,'include':[{'model':db[_0x30d9('0x10')],'attributes':['id','name',_0x30d9('0xf')],'include':[{'model':db[_0x30d9('0x3b')],'as':_0x30d9('0x15'),'include':[{'model':db['CloudProvider'],'as':_0x30d9('0x3c')}]}]}]})[_0x30d9('0x35')](function(_0x4f77dd){var _0x5a3e01=_[_0x30d9('0x3d')](manager[_0x30d9('0x3e')]);var _0x21fca6=_[_0x30d9('0x3f')](_0x4f77dd,function(_0x9a7136){return _0x9a7136['id'][_0x30d9('0x40')]();});var _0x535145=_[_0x30d9('0x41')](_0x4f77dd,function(_0x1163cc){return _0x1163cc['id'][_0x30d9('0x40')]();});var _0x4118bc=_0x3e9366?_0x21fca6:_[_0x30d9('0x42')](_0x21fca6,_0x5a3e01);var _0x57334a=_[_0x30d9('0x43')](_0x21fca6,_0x5a3e01);var _0x1b7b20=_[_0x30d9('0x42')](_0x5a3e01,_0x21fca6);var _0x5edc69;var _0x3d19a7;for(_0x5edc69=0x0;_0x5edc69<_0x1b7b20[_0x30d9('0x44')]&&!_0x3e9366;_0x5edc69+=0x1){_0x3d19a7=_0x1b7b20[_0x5edc69][_0x30d9('0x40')]();if(manager[_0x30d9('0x45')](_0x3d19a7)){manager[_0x30d9('0x46')](_0x3d19a7);manager['deleteJob'](_0x3d19a7);logger[_0x30d9('0xd')](_0x30d9('0x47'),_0x3d19a7);}}logger[_0x30d9('0xd')](_0x30d9('0x48'),JSON[_0x30d9('0x22')](_0x4118bc));for(_0x5edc69=0x0;_0x5edc69<_0x4118bc[_0x30d9('0x44')];_0x5edc69+=0x1){_0x3d19a7=_0x4118bc[_0x5edc69][_0x30d9('0x40')]();logger[_0x30d9('0xd')](_0x30d9('0x49'),_0x3d19a7);if(_0x3e9366){logger[_0x30d9('0xd')](_0x30d9('0x4a'),_0x3e9366);logger[_0x30d9('0xd')](JSON[_0x30d9('0x22')](_0x535145[_0x3d19a7]));BPromise[_0x30d9('0x4b')]()[_0x30d9('0x35')](handleJob(_0x535145[_0x3d19a7]));logger[_0x30d9('0xd')](_0x30d9('0x4c'),_0x535145[_0x3d19a7][_0x30d9('0x14')],_0x535145[_0x3d19a7][_0x30d9('0x4d')]);}else if(_0x535145[_0x3d19a7][_0x30d9('0x4d')]&&_0x535145[_0x3d19a7]['active']&&moment()[_0x30d9('0x4e')](_0x535145[_0x3d19a7][_0x30d9('0x4f')],_0x535145[_0x3d19a7][_0x30d9('0x50')])){manager['add'](_0x3d19a7,_0x535145[_0x3d19a7][_0x30d9('0x4d')],handleJob(_0x535145[_0x3d19a7]));manager[_0x30d9('0x51')](_0x3d19a7);logger[_0x30d9('0xd')]('add\x20cron',_0x535145[_0x3d19a7][_0x30d9('0x14')],_0x535145[_0x3d19a7]['cron']);}else if(manager['exists'](_0x3d19a7)){manager[_0x30d9('0x46')](_0x3d19a7);manager[_0x30d9('0x52')](_0x3d19a7);logger['info']('stop\x20cron',_0x535145[_0x3d19a7][_0x30d9('0x14')],_0x535145[_0x3d19a7]['cron']);}}for(_0x5edc69=0x0,_0x3d19a7;_0x5edc69<_0x57334a[_0x30d9('0x44')]&&!_0x3e9366;_0x5edc69+=0x1){_0x3d19a7=_0x57334a[_0x5edc69]['toString']();if(manager['exists'](_0x3d19a7)){if(_0x535145[_0x3d19a7][_0x30d9('0x4d')]&&_0x535145[_0x3d19a7]['active']&&moment()[_0x30d9('0x4e')](_0x535145[_0x3d19a7]['startAt'],_0x535145[_0x3d19a7]['endAt'])){manager[_0x30d9('0x53')](_0x3d19a7,_0x535145[_0x3d19a7][_0x30d9('0x4d')],handleJob(_0x535145[_0x3d19a7]));logger[_0x30d9('0xd')](_0x30d9('0x54'),_0x535145[_0x3d19a7][_0x30d9('0x14')],_0x535145[_0x3d19a7][_0x30d9('0x4d')]);}else{manager[_0x30d9('0x46')](_0x3d19a7);manager[_0x30d9('0x52')](_0x3d19a7);logger['info'](_0x30d9('0x55'),_0x535145[_0x3d19a7]['name'],_0x535145[_0x3d19a7][_0x30d9('0x4d')]);}}}})[_0x30d9('0x2c')](function(_0x59814d){logger['error'](JSON[_0x30d9('0x22')](_0x59814d));});}exports[_0x30d9('0x56')]=function(_0x233e21){return getJobs(_0x233e21);};exports[_0x30d9('0x51')]=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 d65cc80..b836ec9 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 _0xf089=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xf089,0xba));var _0x9f08=function(_0x98312c,_0x57bf24){_0x98312c=_0x98312c-0x0;var _0x2bc5ef=_0xf089[_0x98312c];return _0x2bc5ef;};var _=require('lodash');var AWS=require(_0x9f08('0x0'));var rp=require(_0x9f08('0x1'));var util=require('util');var BPromise=require(_0x9f08('0x2'));var db=require(_0x9f08('0x3'))['db'];var logger=require(_0x9f08('0x4'))(_0x9f08('0x5'));function getTranscriptionJob(_0x48bf89,_0x11d64c,_0x1dced2,_0x352879){return new Promise(function(_0x13768c,_0x38c9ea){var _0x39abe2=new AWS['TranscribeService']({'accessKeyId':_0x11d64c,'secretAccessKey':_0x48bf89,'region':_0x1dced2});_0x39abe2[_0x9f08('0x6')]({'TranscriptionJobName':_0x352879},function(_0x4b37fc,_0x39e238){if(_0x4b37fc){return _0x38c9ea(_0x4b37fc);}else{return _0x13768c(_0x39e238);}});});}function sentiment(_0x4ce5b6,_0x4358e7,_0x286809,_0x3868b6,_0x4dc012){return new Promise(function(_0x2ae155,_0x3e5d2b){var _0x447a85=new AWS['Comprehend']({'accessKeyId':_0x4358e7,'secretAccessKey':_0x4ce5b6,'region':_0x286809});_0x447a85['detectSentiment']({'Text':_0x3868b6,'LanguageCode':_0x4dc012[_0x9f08('0x7')](0x0,0x2)},function(_0x1e6f42,_0x52ab70){if(_0x1e6f42){return _0x3e5d2b(_0x1e6f42);}else{return _0x2ae155(_0x52ab70);}});});}function checkTranscribeJob(_0x2b7e6f,_0x2b32c7,_0x251b84){var _0x597ae8;return new BPromise(function(_0x582be0,_0x9cd154){logger[_0x9f08('0x8')](util[_0x9f08('0x9')](_0x9f08('0xa'),_0x2b7e6f['id'],_0x2b7e6f['transcribeName']));return getTranscriptionJob(_0x251b84[_0x9f08('0xb')],_0x251b84[_0x9f08('0xc')],_0x2b32c7[_0x9f08('0xd')],_0x2b7e6f[_0x9f08('0xe')])[_0x9f08('0xf')](function(_0x4cec58){logger[_0x9f08('0x8')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2b7e6f['id'],_0x2b7e6f[_0x9f08('0xe')],_0x4cec58[_0x9f08('0x10')][_0x9f08('0x11')]));if(!_0x2b7e6f[_0x9f08('0x12')]){switch(_0x4cec58[_0x9f08('0x10')][_0x9f08('0x11')]){case _0x9f08('0x13'):var _0x20163c={'transcribeStatus':_0x4cec58[_0x9f08('0x10')][_0x9f08('0x11')],'fileUri':_0x4cec58[_0x9f08('0x10')][_0x9f08('0x14')][_0x9f08('0x15')]};logger[_0x9f08('0x8')](util[_0x9f08('0x9')](_0x9f08('0x16'),_0x2b7e6f['id']));return rp({'uri':_0x4cec58['TranscriptionJob'][_0x9f08('0x14')][_0x9f08('0x15')],'json':!![]})[_0x9f08('0xf')](function(_0x3d4574){logger[_0x9f08('0x8')](util[_0x9f08('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2b7e6f['id']));if(_0x3d4574&&_0x3d4574[_0x9f08('0x17')]&&_0x3d4574[_0x9f08('0x17')][_0x9f08('0x18')]&&_0x3d4574[_0x9f08('0x17')][_0x9f08('0x18')][_0x9f08('0x19')]){_0x20163c[_0x9f08('0x12')]='';for(var _0x4a2f0b=0x0;_0x4a2f0b<_0x3d4574['results'][_0x9f08('0x18')][_0x9f08('0x19')];_0x4a2f0b++){_0x20163c[_0x9f08('0x12')]+=_0x3d4574[_0x9f08('0x17')][_0x9f08('0x18')][_0x4a2f0b][_0x9f08('0x1a')]+'';}}return _0x2b7e6f[_0x9f08('0x1b')](_0x20163c);})[_0x9f08('0xf')](function(){logger['info'](util[_0x9f08('0x9')](_0x9f08('0x1c'),_0x2b7e6f['id']));if(!_0x2b7e6f[_0x9f08('0x1d')]){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x20'));}if(!_0x2b32c7[_0x9f08('0x21')]||!_0x2b32c7[_0x9f08('0x22')]||!_0x2b32c7['sentimentRegion']||!_0x2b32c7[_0x9f08('0x23')]||!_0x2b32c7['bucket']){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x24'));}if(!_0x20163c[_0x9f08('0x12')]){throw new Error(_0x9f08('0x25'));}if(_0x2b32c7['sentimentAccountId']===_0x251b84['id']){return _0x251b84;}else{return db[_0x9f08('0x26')][_0x9f08('0x27')]({'where':{'id':_settings[_0x9f08('0x22')]}});}})[_0x9f08('0xf')](function(_0x55417){if(!_0x55417){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x28'));}if(!_0x55417[_0x9f08('0xb')]||!_0x55417['data2']){throw new db[(_0x9f08('0x1e'))]['ValidationError'](_0x9f08('0x29'));}_0x597ae8=_0x55417;logger[_0x9f08('0x8')](util[_0x9f08('0x9')](_0x9f08('0x2a'),_0x2b7e6f['id']));return sentiment(_0x597ae8[_0x9f08('0xb')],_0x597ae8[_0x9f08('0xc')],_0x2b32c7['sentimentRegion'],_0x20163c[_0x9f08('0x12')],_0x2b32c7[_0x9f08('0x23')]);})[_0x9f08('0xf')](function(_0x46cb57){logger[_0x9f08('0x8')](util[_0x9f08('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2b7e6f['id']));return _0x2b7e6f[_0x9f08('0x1b')]({'sentiment':_0x46cb57['Sentiment'],'sPositive':_0x46cb57[_0x9f08('0x2b')][_0x9f08('0x2c')],'sNegative':_0x46cb57[_0x9f08('0x2b')][_0x9f08('0x2d')],'sMixed':_0x46cb57[_0x9f08('0x2b')]['Mixed'],'sNeutral':_0x46cb57[_0x9f08('0x2b')][_0x9f08('0x2e')]});})[_0x9f08('0xf')](function(){logger['info'](util[_0x9f08('0x9')](_0x9f08('0x1c'),_0x2b7e6f['id']));_0x582be0();});case _0x9f08('0x2f'):return _0x2b7e6f[_0x9f08('0x1b')]({'transcribeStatus':_0x9f08('0x2f'),'failureReason':_0x4cec58['TranscriptionJob'][_0x9f08('0x30')]})[_0x9f08('0xf')](function(){logger[_0x9f08('0x8')](util[_0x9f08('0x9')](_0x9f08('0x1c'),_0x2b7e6f['id']));_0x582be0();});default:logger[_0x9f08('0x8')](util[_0x9f08('0x9')](_0x9f08('0x31'),_0x2b7e6f['id']));break;}}else{return BPromise[_0x9f08('0x32')]()[_0x9f08('0xf')](function(){if(!_0x2b7e6f[_0x9f08('0x1d')]){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2b32c7[_0x9f08('0x21')]||!_0x2b32c7[_0x9f08('0x22')]||!_0x2b32c7['sentimentRegion']||!_0x2b32c7[_0x9f08('0x23')]||!_0x2b32c7[_0x9f08('0x33')]){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2b7e6f[_0x9f08('0x12')]){throw new Error(_0x9f08('0x25'));}if(_0x2b32c7[_0x9f08('0x22')]===_0x251b84['id']){return _0x251b84;}else{return db[_0x9f08('0x26')][_0x9f08('0x27')]({'where':{'id':_settings[_0x9f08('0x22')]}});}})['then'](function(_0x23c43f){if(!_0x23c43f){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x23c43f[_0x9f08('0xb')]||!_0x23c43f['data2']){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x29'));}_0x597ae8=_0x23c43f;logger['info'](util[_0x9f08('0x9')](_0x9f08('0x2a'),_0x2b7e6f['id']));return sentiment(_0x597ae8[_0x9f08('0xb')],_0x597ae8[_0x9f08('0xc')],_0x2b32c7[_0x9f08('0x34')],_0x2b7e6f[_0x9f08('0x12')],_0x2b32c7['language']);})[_0x9f08('0xf')](function(_0x5ef1fa){logger[_0x9f08('0x8')](util[_0x9f08('0x9')](_0x9f08('0x35'),_0x2b7e6f['id']));return _0x2b7e6f[_0x9f08('0x1b')]({'sentiment':_0x5ef1fa[_0x9f08('0x36')],'sPositive':_0x5ef1fa[_0x9f08('0x2b')][_0x9f08('0x2c')],'sNegative':_0x5ef1fa['SentimentScore']['Negative'],'sMixed':_0x5ef1fa['SentimentScore']['Mixed'],'sNeutral':_0x5ef1fa['SentimentScore'][_0x9f08('0x2e')],'transcribeStatus':_0x9f08('0x13')});})['then'](function(){logger[_0x9f08('0x8')](util['format'](_0x9f08('0x1c'),_0x2b7e6f['id']));_0x582be0();});}})[_0x9f08('0x37')](function(_0x16756b){if(_0x16756b){if(!_0x16756b[_0x9f08('0x38')]||_0x16756b['name']!==_0x9f08('0x39')){logger[_0x9f08('0x3a')](util[_0x9f08('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2b7e6f['id']),util[_0x9f08('0x3b')](_0x16756b,{'showHidden':![],'depth':null}));}}_0x582be0();});});}function checkTranscribe(){var _0x585c14;var _0x55d98d;var _0x4b7c5f;return db[_0x9f08('0x3c')][_0x9f08('0x3d')]({'where':{'transcribeStatus':_0x9f08('0x3e')}})[_0x9f08('0xf')](function(_0x14a6b6){if(!_0x14a6b6||!_0x14a6b6['length']){throw new db['Sequelize'][(_0x9f08('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x585c14=_0x14a6b6;return db[_0x9f08('0x3f')][_0x9f08('0x27')]({'where':{'id':0x1}});})['then'](function(_0x3fb332){if(!_0x3fb332){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x40'));}_0x55d98d=_0x3fb332;if(!_0x55d98d['transcribe']||!_0x55d98d[_0x9f08('0x41')]||!_0x55d98d[_0x9f08('0xd')]||!_0x55d98d['language']||!_0x55d98d['bucket']){throw new db[(_0x9f08('0x1e'))]['ValidationError'](_0x9f08('0x42'));}return db[_0x9f08('0x26')][_0x9f08('0x27')]({'where':{'id':_0x55d98d['transcribeAccountId']}});})[_0x9f08('0xf')](function(_0x22e513){if(!_0x22e513){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x28'));}if(!_0x22e513[_0x9f08('0xb')]||!_0x22e513[_0x9f08('0xc')]){throw new db[(_0x9f08('0x1e'))][(_0x9f08('0x1f'))](_0x9f08('0x29'));}_0x4b7c5f=_0x22e513;var _0x2c9231=[];_0x585c14[_0x9f08('0x43')](function(_0x21ddd9){_0x2c9231[_0x9f08('0x44')](checkTranscribeJob(_0x21ddd9,_0x55d98d,_0x4b7c5f));});return BPromise[_0x9f08('0x45')](_0x2c9231);})[_0x9f08('0x37')](function(_0x5ebc5e){if(_0x5ebc5e){if(!_0x5ebc5e[_0x9f08('0x38')]||_0x5ebc5e[_0x9f08('0x38')]!=='SequelizeValidationError'){logger[_0x9f08('0x3a')](util[_0x9f08('0x3b')](_0x5ebc5e,{'showHidden':![],'depth':null}));}}});}exports[_0x9f08('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x85de=['aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Sentiment','Positive','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','error','start','lodash'];(function(_0x2df0bf,_0x13990c){var _0x5c46a3=function(_0x5716ea){while(--_0x5716ea){_0x2df0bf['push'](_0x2df0bf['shift']());}};_0x5c46a3(++_0x13990c);}(_0x85de,0x1f0));var _0xe85d=function(_0x3de62d,_0x53b2f){_0x3de62d=_0x3de62d-0x0;var _0x10b7e9=_0x85de[_0x3de62d];return _0x10b7e9;};var _=require(_0xe85d('0x0'));var AWS=require(_0xe85d('0x1'));var rp=require(_0xe85d('0x2'));var util=require(_0xe85d('0x3'));var BPromise=require(_0xe85d('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xe85d('0x5'))('transcribe');function getTranscriptionJob(_0x4d2fcf,_0x46f08a,_0x2a28a9,_0x514fc9){return new Promise(function(_0x1e9dea,_0xb70e1d){var _0x220e10=new AWS[(_0xe85d('0x6'))]({'accessKeyId':_0x46f08a,'secretAccessKey':_0x4d2fcf,'region':_0x2a28a9});_0x220e10[_0xe85d('0x7')]({'TranscriptionJobName':_0x514fc9},function(_0x888738,_0xc86467){if(_0x888738){return _0xb70e1d(_0x888738);}else{return _0x1e9dea(_0xc86467);}});});}function sentiment(_0x1cd2db,_0x4b6cfb,_0x4128d5,_0x1e4093,_0x4562be){return new Promise(function(_0x6a51f6,_0x1a769e){var _0x574d34=new AWS[(_0xe85d('0x8'))]({'accessKeyId':_0x4b6cfb,'secretAccessKey':_0x1cd2db,'region':_0x4128d5});_0x574d34['detectSentiment']({'Text':_0x1e4093,'LanguageCode':_0x4562be[_0xe85d('0x9')](0x0,0x2)},function(_0x47fb6d,_0x399e91){if(_0x47fb6d){return _0x1a769e(_0x47fb6d);}else{return _0x6a51f6(_0x399e91);}});});}function checkTranscribeJob(_0x548209,_0x3ec59a,_0x1fc972){var _0x10dd73;return new BPromise(function(_0x3544e9,_0x324972){logger[_0xe85d('0xa')](util[_0xe85d('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x548209['id'],_0x548209[_0xe85d('0xc')]));return getTranscriptionJob(_0x1fc972[_0xe85d('0xd')],_0x1fc972['data2'],_0x3ec59a[_0xe85d('0xe')],_0x548209[_0xe85d('0xc')])[_0xe85d('0xf')](function(_0x1e56c5){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x10'),_0x548209['id'],_0x548209[_0xe85d('0xc')],_0x1e56c5[_0xe85d('0x11')]['TranscriptionJobStatus']));if(!_0x548209[_0xe85d('0x12')]){switch(_0x1e56c5['TranscriptionJob'][_0xe85d('0x13')]){case'COMPLETED':var _0x511b92={'transcribeStatus':_0x1e56c5['TranscriptionJob'][_0xe85d('0x13')],'fileUri':_0x1e56c5[_0xe85d('0x11')][_0xe85d('0x14')]['TranscriptFileUri']};logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x15'),_0x548209['id']));return rp({'uri':_0x1e56c5[_0xe85d('0x11')][_0xe85d('0x14')][_0xe85d('0x16')],'json':!![]})[_0xe85d('0xf')](function(_0x2f77d8){logger['info'](util[_0xe85d('0xb')](_0xe85d('0x17'),_0x548209['id']));if(_0x2f77d8&&_0x2f77d8[_0xe85d('0x18')]&&_0x2f77d8[_0xe85d('0x18')][_0xe85d('0x19')]&&_0x2f77d8['results'][_0xe85d('0x19')][_0xe85d('0x1a')]){_0x511b92['fileText']='';for(var _0x44a48c=0x0;_0x44a48c<_0x2f77d8[_0xe85d('0x18')][_0xe85d('0x19')][_0xe85d('0x1a')];_0x44a48c++){_0x511b92[_0xe85d('0x12')]+=_0x2f77d8[_0xe85d('0x18')][_0xe85d('0x19')][_0x44a48c][_0xe85d('0x1b')]+'';}}return _0x548209['update'](_0x511b92);})[_0xe85d('0xf')](function(){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));if(!_0x548209[_0xe85d('0x1d')]){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x20'));}if(!_0x3ec59a['sentiment']||!_0x3ec59a[_0xe85d('0x21')]||!_0x3ec59a[_0xe85d('0x22')]||!_0x3ec59a[_0xe85d('0x23')]||!_0x3ec59a[_0xe85d('0x24')]){throw new db['Sequelize'][(_0xe85d('0x1f'))](_0xe85d('0x25'));}if(!_0x511b92[_0xe85d('0x12')]){throw new Error(_0xe85d('0x26'));}if(_0x3ec59a[_0xe85d('0x21')]===_0x1fc972['id']){return _0x1fc972;}else{return db[_0xe85d('0x27')][_0xe85d('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3d2ffb){if(!_0x3d2ffb){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x29'));}if(!_0x3d2ffb[_0xe85d('0xd')]||!_0x3d2ffb['data2']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x2a'));}_0x10dd73=_0x3d2ffb;logger[_0xe85d('0xa')](util['format'](_0xe85d('0x2b'),_0x548209['id']));return sentiment(_0x10dd73[_0xe85d('0xd')],_0x10dd73[_0xe85d('0x2c')],_0x3ec59a['sentimentRegion'],_0x511b92[_0xe85d('0x12')],_0x3ec59a['language']);})[_0xe85d('0xf')](function(_0x268b19){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x2d'),_0x548209['id']));return _0x548209[_0xe85d('0x2e')]({'sentiment':_0x268b19['Sentiment'],'sPositive':_0x268b19[_0xe85d('0x2f')]['Positive'],'sNegative':_0x268b19[_0xe85d('0x2f')][_0xe85d('0x30')],'sMixed':_0x268b19[_0xe85d('0x2f')]['Mixed'],'sNeutral':_0x268b19[_0xe85d('0x2f')][_0xe85d('0x31')]});})['then'](function(){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));_0x3544e9();});case _0xe85d('0x32'):return _0x548209[_0xe85d('0x2e')]({'transcribeStatus':_0xe85d('0x32'),'failureReason':_0x1e56c5['TranscriptionJob']['FailureReason']})[_0xe85d('0xf')](function(){logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));_0x3544e9();});default:logger[_0xe85d('0xa')](util['format'](_0xe85d('0x33'),_0x548209['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x548209['tempSentiment']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3ec59a[_0xe85d('0x34')]||!_0x3ec59a[_0xe85d('0x21')]||!_0x3ec59a[_0xe85d('0x22')]||!_0x3ec59a[_0xe85d('0x23')]||!_0x3ec59a[_0xe85d('0x24')]){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x25'));}if(!_0x548209[_0xe85d('0x12')]){throw new Error(_0xe85d('0x26'));}if(_0x3ec59a['sentimentAccountId']===_0x1fc972['id']){return _0x1fc972;}else{return db[_0xe85d('0x27')][_0xe85d('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xe85d('0xf')](function(_0x2086f8){if(!_0x2086f8){throw new db[(_0xe85d('0x1e'))]['ValidationError'](_0xe85d('0x29'));}if(!_0x2086f8['data1']||!_0x2086f8[_0xe85d('0x2c')]){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x10dd73=_0x2086f8;logger[_0xe85d('0xa')](util[_0xe85d('0xb')](_0xe85d('0x2b'),_0x548209['id']));return sentiment(_0x10dd73['data1'],_0x10dd73[_0xe85d('0x2c')],_0x3ec59a[_0xe85d('0x22')],_0x548209[_0xe85d('0x12')],_0x3ec59a[_0xe85d('0x23')]);})['then'](function(_0x26400b){logger[_0xe85d('0xa')](util['format'](_0xe85d('0x2d'),_0x548209['id']));return _0x548209['update']({'sentiment':_0x26400b[_0xe85d('0x35')],'sPositive':_0x26400b[_0xe85d('0x2f')][_0xe85d('0x36')],'sNegative':_0x26400b[_0xe85d('0x2f')][_0xe85d('0x30')],'sMixed':_0x26400b[_0xe85d('0x2f')]['Mixed'],'sNeutral':_0x26400b[_0xe85d('0x2f')][_0xe85d('0x31')],'transcribeStatus':'COMPLETED'});})[_0xe85d('0xf')](function(){logger['info'](util[_0xe85d('0xb')](_0xe85d('0x1c'),_0x548209['id']));_0x3544e9();});}})[_0xe85d('0x37')](function(_0x2b20a3){if(_0x2b20a3){if(!_0x2b20a3['name']||_0x2b20a3[_0xe85d('0x38')]!==_0xe85d('0x39')){logger['error'](util[_0xe85d('0xb')](_0xe85d('0x3a'),_0x548209['id']),util[_0xe85d('0x3b')](_0x2b20a3,{'showHidden':![],'depth':null}));}}_0x3544e9();});});}function checkTranscribe(){var _0x5a0489;var _0x2637ce;var _0x5e9641;return db[_0xe85d('0x3c')][_0xe85d('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xe85d('0xf')](function(_0x3c9d14){if(!_0x3c9d14||!_0x3c9d14['length']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5a0489=_0x3c9d14;return db[_0xe85d('0x3e')][_0xe85d('0x28')]({'where':{'id':0x1}});})['then'](function(_0x340790){if(!_0x340790){throw new db[(_0xe85d('0x1e'))]['ValidationError'](_0xe85d('0x3f'));}_0x2637ce=_0x340790;if(!_0x2637ce[_0xe85d('0x40')]||!_0x2637ce[_0xe85d('0x41')]||!_0x2637ce[_0xe85d('0xe')]||!_0x2637ce['language']||!_0x2637ce[_0xe85d('0x24')]){throw new db['Sequelize'][(_0xe85d('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0xe85d('0x27')][_0xe85d('0x28')]({'where':{'id':_0x2637ce[_0xe85d('0x41')]}});})[_0xe85d('0xf')](function(_0x43ead1){if(!_0x43ead1){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x29'));}if(!_0x43ead1[_0xe85d('0xd')]||!_0x43ead1['data2']){throw new db[(_0xe85d('0x1e'))][(_0xe85d('0x1f'))](_0xe85d('0x2a'));}_0x5e9641=_0x43ead1;var _0x22e667=[];_0x5a0489[_0xe85d('0x42')](function(_0x4336b7){_0x22e667[_0xe85d('0x43')](checkTranscribeJob(_0x4336b7,_0x2637ce,_0x5e9641));});return BPromise[_0xe85d('0x44')](_0x22e667);})['catch'](function(_0xcfc5b){if(_0xcfc5b){if(!_0xcfc5b['name']||_0xcfc5b[_0xe85d('0x38')]!==_0xe85d('0x39')){logger[_0xe85d('0x45')](util['inspect'](_0xcfc5b,{'showHidden':![],'depth':null}));}}});}exports[_0xe85d('0x46')]=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 1ecfa01..38b25af 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 _0xe40b=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe40b,0x189));var _0xbe40=function(_0x560c7d,_0x3bbeb8){_0x560c7d=_0x560c7d-0x0;var _0x27503f=_0xe40b[_0x560c7d];return _0x27503f;};'use strict';var _=require('lodash');var moment=require(_0xbe40('0x0'));var Redis=require(_0xbe40('0x1'));var util=require(_0xbe40('0x2'));var config=require(_0xbe40('0x3'));var db=require(_0xbe40('0x4'))['db'];var logger=require(_0xbe40('0x5'))('schedule');config[_0xbe40('0x6')]=_[_0xbe40('0x7')](config[_0xbe40('0x6')],{'host':_0xbe40('0x8'),'port':0x18eb});var io=require(_0xbe40('0x9'))(new Redis(config[_0xbe40('0x6')]));function closeInteractions(){var _0x1622ab=[];return db[_0xbe40('0xa')][_0xbe40('0xb')]({'raw':!![],'attributes':['id',_0xbe40('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbe40('0xd')](0x18,_0xbe40('0xe'))}}})[_0xbe40('0xf')](function(_0x2c48c2){if(_0x2c48c2&&_0x2c48c2[_0xbe40('0x10')]){_0x1622ab=_[_0xbe40('0x11')](_0x2c48c2||[],'id');logger[_0xbe40('0x12')](_0xbe40('0x13'),_0x1622ab[_0xbe40('0x14')]());return db[_0xbe40('0xa')][_0xbe40('0x15')]({'closeReason':_0xbe40('0x16'),'disposition':_0xbe40('0x17'),'closed':!![],'closedAt':moment()[_0xbe40('0x18')](_0xbe40('0x19'))},{'where':{'id':_0x1622ab}});}})[_0xbe40('0xf')](function(){if(_0x1622ab&&_0x1622ab[_0xbe40('0x10')]){logger[_0xbe40('0x12')](_0xbe40('0x1a'),_0x1622ab[_0xbe40('0x14')]());for(var _0x3637d7=0x0;_0x3637d7<_0x1622ab[_0xbe40('0x10')];_0x3637d7++){io[_0xbe40('0x1b')]('whatsappInteraction:update',{'id':_0x1622ab[_0x3637d7],'closed':!![]});}}})[_0xbe40('0x1c')](function(_0x4ec935){logger[_0xbe40('0x1d')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4ec935?util[_0xbe40('0x1e')](_0x4ec935,{'showHidden':![],'depth':null}):'');});}exports[_0xbe40('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8d92=['redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','catch','error','inspect','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule'];(function(_0x1bdd6a,_0x364b61){var _0xbb9f31=function(_0x3a84fa){while(--_0x3a84fa){_0x1bdd6a['push'](_0x1bdd6a['shift']());}};_0xbb9f31(++_0x364b61);}(_0x8d92,0x1c9));var _0x28d9=function(_0x21f7c2,_0x1b2426){_0x21f7c2=_0x21f7c2-0x0;var _0x3f3279=_0x8d92[_0x21f7c2];return _0x3f3279;};'use strict';var _=require(_0x28d9('0x0'));var moment=require(_0x28d9('0x1'));var Redis=require(_0x28d9('0x2'));var util=require(_0x28d9('0x3'));var config=require('../../config/environment');var db=require(_0x28d9('0x4'))['db'];var logger=require(_0x28d9('0x5'))(_0x28d9('0x6'));config[_0x28d9('0x7')]=_['defaults'](config[_0x28d9('0x7')],{'host':_0x28d9('0x8'),'port':0x18eb});var io=require(_0x28d9('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x4726a9=[];return db[_0x28d9('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x28d9('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x28d9('0xc')](0x18,_0x28d9('0xd'))}}})[_0x28d9('0xe')](function(_0x56b87f){if(_0x56b87f&&_0x56b87f[_0x28d9('0xf')]){_0x4726a9=_[_0x28d9('0x10')](_0x56b87f||[],'id');logger[_0x28d9('0x11')](_0x28d9('0x12'),_0x4726a9[_0x28d9('0x13')]());return db[_0x28d9('0xa')][_0x28d9('0x14')]({'closeReason':_0x28d9('0x15'),'disposition':_0x28d9('0x16'),'closed':!![],'closedAt':moment()[_0x28d9('0x17')](_0x28d9('0x18'))},{'where':{'id':_0x4726a9}});}})[_0x28d9('0xe')](function(){if(_0x4726a9&&_0x4726a9[_0x28d9('0xf')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4726a9[_0x28d9('0x13')]());for(var _0x15deea=0x0;_0x15deea<_0x4726a9[_0x28d9('0xf')];_0x15deea++){io[_0x28d9('0x19')]('whatsappInteraction:update',{'id':_0x4726a9[_0x15deea],'closed':!![]});}}})[_0x28d9('0x1a')](function(_0xab55c6){logger[_0x28d9('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xab55c6?util[_0x28d9('0x1c')](_0xab55c6,{'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 e612a83..dccaf0e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe09f=['util','push','Innocenzo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2'];(function(_0x33cf98,_0x58616e){var _0x425b08=function(_0x1bc032){while(--_0x1bc032){_0x33cf98['push'](_0x33cf98['shift']());}};_0x425b08(++_0x58616e);}(_0xe09f,0x66));var _0xfe09=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe09f[_0x4cf98e];return _0x1623ac;};'use strict';var util=require(_0xfe09('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xfe09('0x1')]({'id':i,'firstName':_0xfe09('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xfe09('0x3')+i+_0xfe09('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfe09('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xfe09('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xfe09('0x1')]({'id':i,'firstName':_0xfe09('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xfe09('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfe09('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xfe09('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0xfe09('0x6')][_0xfe09('0x7')]({'where':{}})['then'](function(){return db[_0xfe09('0x6')][_0xfe09('0x8')](contacts);})[_0xfe09('0x9')](function(){console['log'](_0xfe09('0xa'),_0xfe09('0xb'));return db[_0xfe09('0xc')][_0xfe09('0x7')]({'where':{}});})['then'](function(){return db[_0xfe09('0xc')][_0xfe09('0x8')](hopper);})['then'](function(){console[_0xfe09('0xd')](_0xfe09('0xa'),_0xfe09('0xe'));return db[_0xfe09('0x6')]['bulkCreate'](contacts2);})[_0xfe09('0x9')](function(){console['log'](_0xfe09('0xa'),_0xfe09('0xf'));return db[_0xfe09('0xc')][_0xfe09('0x8')](hopper2);})['then'](function(){console[_0xfe09('0xd')](_0xfe09('0xa'),_0xfe09('0x10'));})['catch'](function(_0x195eda){console[_0xfe09('0xd')](_0x195eda);}); \ No newline at end of file +var _0xd2da=['@xcally.com','CmContact','destroy','then','bulkCreate','contacts1','log','finished\x20populating','hopper1','contacts2','CmHopper','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now'];(function(_0x181eb4,_0x237405){var _0x1bbcbd=function(_0x26c4cc){while(--_0x26c4cc){_0x181eb4['push'](_0x181eb4['shift']());}};_0x1bbcbd(++_0x237405);}(_0xd2da,0xca));var _0xad2d=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xd2da[_0x35a140];return _0x30ab82;};'use strict';var util=require(_0xad2d('0x0'));var db=require(_0xad2d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xad2d('0x2')]({'id':i,'firstName':_0xad2d('0x3')+i,'lastName':_0xad2d('0x4')+i,'phone':0xf879fb460+i,'email':_0xad2d('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xad2d('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xad2d('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xad2d('0x2')]({'id':i,'firstName':_0xad2d('0x3')+i,'lastName':_0xad2d('0x4')+i,'phone':0xf879fb460+i,'email':_0xad2d('0x5')+i+_0xad2d('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xad2d('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xad2d('0x6')](),'updatedAt':Date[_0xad2d('0x6')]()});}db[_0xad2d('0x8')][_0xad2d('0x9')]({'where':{}})[_0xad2d('0xa')](function(){return db['CmContact'][_0xad2d('0xb')](contacts);})['then'](function(){console['log']('finished\x20populating',_0xad2d('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0xad2d('0xa')](function(){return db['CmHopper'][_0xad2d('0xb')](hopper);})[_0xad2d('0xa')](function(){console[_0xad2d('0xd')](_0xad2d('0xe'),_0xad2d('0xf'));return db[_0xad2d('0x8')][_0xad2d('0xb')](contacts2);})['then'](function(){console['log'](_0xad2d('0xe'),_0xad2d('0x10'));return db[_0xad2d('0x11')][_0xad2d('0xb')](hopper2);})[_0xad2d('0xa')](function(){console[_0xad2d('0xd')]('finished\x20populating',_0xad2d('0x12'));})['catch'](function(_0x56e126){console[_0xad2d('0xd')](_0x56e126);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3f33809..9fd49f0 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe76c=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','add\x20user','catch','util','../mysqldb','%s%s','format','%s%s@xcally.com','agent','password','friend','udp','wss','all','ulaw'];(function(_0x48f827,_0x269e8d){var _0xc763f7=function(_0x19769a){while(--_0x19769a){_0x48f827['push'](_0x48f827['shift']());}};_0xc763f7(++_0x269e8d);}(_0xe76c,0x183));var _0xce76=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe76c[_0x164eca];return _0x2ce562;};'use strict';var util=require(_0xce76('0x0'));var db=require(_0xce76('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xce76('0x2'),'agent',i),'fullname':util[_0xce76('0x3')](_0xce76('0x2'),'agent',i),'email':util['format'](_0xce76('0x4'),_0xce76('0x5'),i),'role':_0xce76('0x5'),'password':_0xce76('0x6'),'internal':0xfa0+i,'type':_0xce76('0x7'),'transport':[_0xce76('0x8'),'ws',_0xce76('0x9')],'disallow':[_0xce76('0xa')],'allow':[_0xce76('0xb')],'defaultuser':util[_0xce76('0x3')](_0xce76('0x2'),_0xce76('0x5'),i),'encryption':_0xce76('0xc'),'avpf':'yes','force_avp':_0xce76('0xc'),'icesupport':_0xce76('0xc'),'dtlsenable':_0xce76('0xc'),'dtlsverify':'no','dtlscertfile':_0xce76('0xd'),'dtlsprivatekey':_0xce76('0xe'),'dtlssetup':_0xce76('0xf'),'callerid':util[_0xce76('0x3')](_0xce76('0x10'),util[_0xce76('0x3')](_0xce76('0x2'),_0xce76('0x5'),i),0xfa0+i)});}db[_0xce76('0x11')]['bulkCreate'](users)['then'](function(){console[_0xce76('0x12')](_0xce76('0x13'));})[_0xce76('0x14')](function(_0x3f29d5){console[_0xce76('0x12')](_0x3f29d5);}); \ No newline at end of file +var _0x5bda=['\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5bda,0x9e));var _0xa5bd=function(_0x302a84,_0xfaf37c){_0x302a84=_0x302a84-0x0;var _0x28ef60=_0x5bda[_0x302a84];return _0x28ef60;};'use strict';var util=require(_0xa5bd('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa5bd('0x1')]({'name':util[_0xa5bd('0x2')](_0xa5bd('0x3'),_0xa5bd('0x4'),i),'fullname':util['format']('%s%s',_0xa5bd('0x4'),i),'email':util[_0xa5bd('0x2')](_0xa5bd('0x5'),_0xa5bd('0x4'),i),'role':_0xa5bd('0x4'),'password':'password','internal':0xfa0+i,'type':_0xa5bd('0x6'),'transport':[_0xa5bd('0x7'),'ws',_0xa5bd('0x8')],'disallow':['all'],'allow':[_0xa5bd('0x9')],'defaultuser':util[_0xa5bd('0x2')]('%s%s',_0xa5bd('0x4'),i),'encryption':'yes','avpf':_0xa5bd('0xa'),'force_avp':_0xa5bd('0xa'),'icesupport':_0xa5bd('0xa'),'dtlsenable':_0xa5bd('0xa'),'dtlsverify':'no','dtlscertfile':_0xa5bd('0xb'),'dtlsprivatekey':_0xa5bd('0xc'),'dtlssetup':'actpass','callerid':util[_0xa5bd('0x2')](_0xa5bd('0xd'),util[_0xa5bd('0x2')](_0xa5bd('0x3'),_0xa5bd('0x4'),i),0xfa0+i)});}db[_0xa5bd('0xe')][_0xa5bd('0xf')](users)['then'](function(){console[_0xa5bd('0x10')](_0xa5bd('0x11'));})[_0xa5bd('0x12')](function(_0x5347f3){console[_0xa5bd('0x10')](_0x5347f3);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0230f50..ef57cd4 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7f7=['catch','log','join','connection','address','request','remoteAddress','remotePort','SocketIO\x20','DISCONNECTED','lodash','util','bluebird','../mysqldb','Agents','User','name','role','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','userProfileId','SmsQueues','MailQueues','WhatsappQueue','Trunks','agent','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0xf7f7,0x192));var _0x7f7f=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xf7f7[_0x1d558c];return _0x15767d;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var BPromise=require(_0x7f7f('0x2'));var db=require(_0x7f7f('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x7f7f('0x4'),'model':db[_0x7f7f('0x5')],'attributes':['id',_0x7f7f('0x6'),_0x7f7f('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7f7f('0x6')],'where':{'role':_0x7f7f('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7f7f('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x7f7f('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7f7f('0x6'),'type'],'where':{'type':_0x7f7f('0x9')}};function getAssociatedResources(_0x4d5f64,_0x4c4be0,_0x4e5cc7){return db[_0x7f7f('0xa')][_0x7f7f('0xb')]({'where':{'name':_0x4d5f64,'userProfileId':_0x4c4be0},'raw':!![]})[_0x7f7f('0xc')](function(_0x478b9e){if(_0x478b9e){if(_0x478b9e[_0x7f7f('0xd')]){switch(_0x4d5f64){case _0x7f7f('0xe'):case _0x7f7f('0xf'):case'FaxQueues':case'SmsQueues':case'MailQueues':case _0x7f7f('0x10'):case _0x7f7f('0x11'):return db[_0x4e5cc7][_0x7f7f('0x12')](queryQueues);case _0x7f7f('0x13'):return db[_0x4e5cc7]['findAll'](queryTelephones);case'Trunks':return db[_0x4e5cc7][_0x7f7f('0x12')](queryTrunks);case _0x7f7f('0x14'):return db[_0x4e5cc7][_0x7f7f('0x12')](queryCampaigns);}}else{return db[_0x7f7f('0x15')][_0x7f7f('0x12')]({'attributes':[_0x7f7f('0x16')],'where':{'sectionId':_0x478b9e['id']},'raw':!![]})[_0x7f7f('0xc')](function(_0x15d3a6){if(_0x15d3a6){var _0x329e81={'where':{'id':_[_0x7f7f('0x17')](_0x15d3a6,_0x7f7f('0x16'))},'raw':!![]};switch(_0x4e5cc7){case _0x7f7f('0x5'):_0x329e81[_0x7f7f('0x18')][_0x7f7f('0x7')]=_0x7f7f('0x8');break;case _0x7f7f('0x19'):_0x329e81[_0x7f7f('0x18')][_0x7f7f('0x1a')]=_0x7f7f('0x9');break;}return db[_0x4e5cc7][_0x7f7f('0x12')](_0x329e81);}else{return[];}});}}else{return[];}})[_0x7f7f('0xc')](function(_0x525a0e){return _0x525a0e;});}function joinOrLeaveQueues(_0x3ccec6,_0x1d419d,_0x2ce161,_0x5a8f11){_0x3ccec6[_0x1d419d](util[_0x7f7f('0x1b')]('%s:queue:%s',_0x2ce161,_0x5a8f11[_0x7f7f('0x6')]));if(_0x5a8f11[_0x7f7f('0x4')]){for(var _0x45c12b=0x0;_0x45c12b<_0x5a8f11[_0x7f7f('0x4')]['length'];_0x45c12b+=0x1){_0x3ccec6[_0x1d419d](util[_0x7f7f('0x1b')](_0x7f7f('0x1c'),_0x5a8f11[_0x7f7f('0x4')][_0x45c12b]['name']));}}}function joinOrLeave(_0x2db644,_0x4b879d,_0x47a262){var _0x597be6;if(_0x2db644[_0x7f7f('0x1d')]['query']['id']){db[_0x7f7f('0x5')]['find']({'attributes':['id',_0x7f7f('0x6'),_0x7f7f('0x7'),'userProfileId'],'where':{'id':_0x2db644[_0x7f7f('0x1d')][_0x7f7f('0x1e')]['id']},'include':[{'model':db[_0x7f7f('0x1f')],'as':_0x7f7f('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f7f('0x21')],'as':_0x7f7f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f7f('0x23')],'as':_0x7f7f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f7f('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x7f7f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f7f('0x27')],'as':_0x7f7f('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x702b2){if(_0x702b2){_0x597be6=_0x702b2;_0x2db644[_0x4b879d](util[_0x7f7f('0x1b')](_0x7f7f('0x1c'),_0x702b2['name']));var _0x508650=[];switch(_0x702b2['role']){case _0x7f7f('0x29'):_0x2db644[_0x4b879d](_0x7f7f('0x2a'));_0x2db644[_0x4b879d](_0x7f7f('0x2b'));if(queryQueues[_0x7f7f('0x2c')](_0x7f7f('0x2d'))){delete queryQueues[_0x7f7f('0x2d')];}_0x508650[_0x7f7f('0x2e')](db[_0x7f7f('0x2f')][_0x7f7f('0x12')](queryQueues));_0x508650[_0x7f7f('0x2e')](db[_0x7f7f('0x30')][_0x7f7f('0x12')](queryQueues));_0x508650[_0x7f7f('0x2e')](db[_0x7f7f('0x31')][_0x7f7f('0x12')](queryQueues));_0x508650['push'](db[_0x7f7f('0x32')]['findAll'](queryQueues));_0x508650[_0x7f7f('0x2e')](db[_0x7f7f('0x33')][_0x7f7f('0x12')](queryQueues));_0x508650[_0x7f7f('0x2e')](db[_0x7f7f('0x34')]['findAll'](queryQueues));_0x508650[_0x7f7f('0x2e')](db['WhatsappQueue'][_0x7f7f('0x12')](queryQueues));_0x508650['push'](db[_0x7f7f('0x5')]['findAll'](queryTelephones));_0x508650[_0x7f7f('0x2e')](db['Trunk'][_0x7f7f('0x12')](queryTrunks));_0x508650['push'](db['Campaign'][_0x7f7f('0x12')](queryCampaigns));_0x508650['push'](db['User'][_0x7f7f('0x12')](queryAgents));break;case _0x7f7f('0x35'):_0x2db644[_0x4b879d](_0x7f7f('0x2a'));_0x2db644[_0x4b879d]('voice:outbound');_0x508650[_0x7f7f('0x2e')](getAssociatedResources(_0x7f7f('0xe'),_0x702b2[_0x7f7f('0x36')],_0x7f7f('0x2f')));_0x508650[_0x7f7f('0x2e')](getAssociatedResources('ChatQueues',_0x702b2['userProfileId'],_0x7f7f('0x30')));_0x508650['push'](getAssociatedResources('FaxQueues',_0x702b2[_0x7f7f('0x36')],_0x7f7f('0x31')));_0x508650[_0x7f7f('0x2e')](getAssociatedResources(_0x7f7f('0x37'),_0x702b2['userProfileId'],_0x7f7f('0x32')));_0x508650[_0x7f7f('0x2e')](getAssociatedResources(_0x7f7f('0x38'),_0x702b2[_0x7f7f('0x36')],'MailQueue'));_0x508650[_0x7f7f('0x2e')](getAssociatedResources('OpenchannelQueues',_0x702b2['userProfileId'],'OpenchannelQueue'));_0x508650[_0x7f7f('0x2e')](getAssociatedResources(_0x7f7f('0x11'),_0x702b2[_0x7f7f('0x36')],_0x7f7f('0x39')));_0x508650['push'](getAssociatedResources('Telephones',_0x702b2[_0x7f7f('0x36')],'User'));_0x508650[_0x7f7f('0x2e')](getAssociatedResources(_0x7f7f('0x3a'),_0x702b2[_0x7f7f('0x36')],'Trunk'));_0x508650[_0x7f7f('0x2e')](getAssociatedResources('IvrCampaigns',_0x702b2['userProfileId'],_0x7f7f('0x19')));_0x508650['push'](db['User'][_0x7f7f('0x12')](queryAgents));break;case _0x7f7f('0x3b'):_0x2db644[_0x4b879d](_0x7f7f('0x2a'));_0x2db644[_0x4b879d](_0x7f7f('0x2b'));_0x508650['push'](_0x702b2[_0x7f7f('0x3c')]({'attributes':['id','name']}));_0x508650[_0x7f7f('0x2e')](_0x702b2[_0x7f7f('0x3d')]({'attributes':['id',_0x7f7f('0x6')]}));_0x508650[_0x7f7f('0x2e')](_0x702b2[_0x7f7f('0x3e')]({'attributes':['id',_0x7f7f('0x6')]}));_0x508650[_0x7f7f('0x2e')](_0x702b2[_0x7f7f('0x3f')]({'attributes':['id',_0x7f7f('0x6')]}));_0x508650['push'](_0x702b2[_0x7f7f('0x40')]({'attributes':['id',_0x7f7f('0x6')]}));_0x508650['push'](_0x702b2['getOpenchannelQueues']({'attributes':['id','name']}));_0x508650[_0x7f7f('0x2e')](_0x702b2[_0x7f7f('0x41')]({'attributes':['id',_0x7f7f('0x6')]}));break;}return BPromise[_0x7f7f('0x42')](_0x508650);}})['then'](function(_0x3cc955){if(_0x3cc955&&_0x3cc955[_0x7f7f('0x43')]){for(var _0x5b5276=0x0;_0x5b5276<_0x3cc955[_0x7f7f('0x43')];_0x5b5276+=0x1){for(var _0x3d41ea=0x0;_0x3d41ea<_0x3cc955[_0x5b5276]['length'];_0x3d41ea+=0x1){switch(_0x5b5276){case 0x0:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x44'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x1:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x45'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x2:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x46'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x3:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x47'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x4:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x48'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x5:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x49'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x6:joinOrLeaveQueues(_0x2db644,_0x4b879d,_0x7f7f('0x4a'),_0x3cc955[_0x5b5276][_0x3d41ea]);break;case 0x7:if(_0x597be6[_0x7f7f('0x7')]!==_0x7f7f('0x3b'))_0x2db644[_0x4b879d](util[_0x7f7f('0x1b')]('telephone:%s',_0x3cc955[_0x5b5276][_0x3d41ea]['name']));break;case 0x8:if(_0x597be6['role']!==_0x7f7f('0x3b'))_0x2db644[_0x4b879d](util[_0x7f7f('0x1b')](_0x7f7f('0x4b'),_0x3cc955[_0x5b5276][_0x3d41ea][_0x7f7f('0x6')]));break;case 0x9:if(_0x597be6[_0x7f7f('0x7')]!=='agent')_0x2db644[_0x4b879d](util[_0x7f7f('0x1b')](_0x7f7f('0x4c'),_0x3cc955[_0x5b5276][_0x3d41ea][_0x7f7f('0x1a')],_0x3cc955[_0x5b5276][_0x3d41ea][_0x7f7f('0x6')]));break;case 0xa:_0x2db644[_0x4b879d](util['format'](_0x7f7f('0x1c'),_0x3cc955[_0x5b5276][_0x3d41ea][_0x7f7f('0x6')]));break;}}}}})[_0x7f7f('0xc')](function(){if(_0x4b879d===_0x7f7f('0x4d')){var _0x3a352f=_['map'](_0x597be6[_0x7f7f('0x20')],'id');return _0x597be6['removeChatInteractions'](_0x3a352f)[_0x7f7f('0xc')](function(){for(var _0x4ea214=0x0;_0x4ea214<_0x3a352f[_0x7f7f('0x43')];_0x4ea214+=0x1){_0x47a262['emit'](_0x7f7f('0x4e'),{'ChatInteractionId':Number(_0x3a352f[_0x4ea214]),'UserId':Number(_0x597be6['id'])});}});}})[_0x7f7f('0xc')](function(){if(_0x4b879d==='leave'){var _0x4e4b25=_[_0x7f7f('0x17')](_0x597be6['MailInteractions'],'id');return _0x597be6[_0x7f7f('0x4f')](_0x4e4b25)[_0x7f7f('0xc')](function(){for(var _0x4aee62=0x0;_0x4aee62<_0x4e4b25[_0x7f7f('0x43')];_0x4aee62+=0x1){_0x47a262[_0x7f7f('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4e4b25[_0x4aee62]),'UserId':Number(_0x597be6['id'])});}});}})[_0x7f7f('0xc')](function(){if(_0x4b879d===_0x7f7f('0x4d')){var _0x22fc6b=_[_0x7f7f('0x17')](_0x597be6['FaxInteractions'],'id');return _0x597be6['removeFaxInteractions'](_0x22fc6b)[_0x7f7f('0xc')](function(){for(var _0x11a4b2=0x0;_0x11a4b2<_0x22fc6b['length'];_0x11a4b2+=0x1){_0x47a262[_0x7f7f('0x50')](_0x7f7f('0x51'),{'FaxInteractionId':Number(_0x22fc6b[_0x11a4b2]),'UserId':Number(_0x597be6['id'])});}});}})['then'](function(){if(_0x4b879d===_0x7f7f('0x4d')){var _0x6cd0ae=_[_0x7f7f('0x17')](_0x597be6[_0x7f7f('0x52')],'id');return _0x597be6[_0x7f7f('0x53')](_0x6cd0ae)[_0x7f7f('0xc')](function(){for(var _0x22da98=0x0;_0x22da98<_0x6cd0ae[_0x7f7f('0x43')];_0x22da98+=0x1){_0x47a262[_0x7f7f('0x50')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x6cd0ae[_0x22da98]),'UserId':Number(_0x597be6['id'])});}});}})[_0x7f7f('0xc')](function(){if(_0x4b879d===_0x7f7f('0x4d')){var _0xd2b9c6=_[_0x7f7f('0x17')](_0x597be6[_0x7f7f('0x26')],'id');return _0x597be6[_0x7f7f('0x54')](_0xd2b9c6)['then'](function(){for(var _0x2ad47d=0x0;_0x2ad47d<_0xd2b9c6[_0x7f7f('0x43')];_0x2ad47d+=0x1){_0x47a262[_0x7f7f('0x50')](_0x7f7f('0x55'),{'OpenchannelInteractionId':Number(_0xd2b9c6[_0x2ad47d]),'UserId':Number(_0x597be6['id'])});}});}})[_0x7f7f('0xc')](function(){if(_0x4b879d==='leave'){var _0x26373e=_[_0x7f7f('0x17')](_0x597be6[_0x7f7f('0x28')],'id');return _0x597be6[_0x7f7f('0x56')](_0x26373e)[_0x7f7f('0xc')](function(){for(var _0x14faf6=0x0;_0x14faf6<_0x26373e[_0x7f7f('0x43')];_0x14faf6+=0x1){_0x47a262[_0x7f7f('0x50')](_0x7f7f('0x57'),{'WhatsappInteractionId':Number(_0x26373e[_0x14faf6]),'UserId':Number(_0x597be6['id'])});}});}})[_0x7f7f('0x58')](function(_0x217936){_0x2db644[_0x7f7f('0x59')](_0x217936);});}}function onDisconnect(_0x370ad5,_0x216883){joinOrLeave(_0x370ad5,_0x7f7f('0x4d'),_0x216883);}function onConnect(_0xd576d0){joinOrLeave(_0xd576d0,_0x7f7f('0x5a'));}exports['default']=function(_0x515ee2){_0x515ee2['on'](_0x7f7f('0x5b'),function(_0x13b54f){_0x13b54f['setMaxListeners'](0x0);_0x13b54f[_0x7f7f('0x5c')]=_0x13b54f[_0x7f7f('0x5d')][_0x7f7f('0x5b')][_0x7f7f('0x5e')]+':'+_0x13b54f[_0x7f7f('0x5d')][_0x7f7f('0x5b')][_0x7f7f('0x5f')];_0x13b54f['connectedAt']=new Date();_0x13b54f[_0x7f7f('0x59')]=function(_0x524e70){console[_0x7f7f('0x59')](_0x7f7f('0x60')+_0x13b54f['nsp'][_0x7f7f('0x6')]+'['+_0x13b54f['address']+']',_0x524e70);};_0x13b54f['on']('disconnect',function(){onDisconnect(_0x13b54f,_0x515ee2);_0x13b54f[_0x7f7f('0x59')](_0x7f7f('0x61'));});onConnect(_0x13b54f);_0x13b54f[_0x7f7f('0x59')]('CONNECTED');});}; \ No newline at end of file +var _0x2eba=['bluebird','../mysqldb','./environment','User','role','agent','name','telephone','ivr','findOne','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','Agents','user:%s','handshake','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','ChatQueue','FaxQueue','push','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueues','OpenchannelQueue','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','all','length','voice','sms','mail','whatsapp','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util'];(function(_0x276fed,_0x22bb9e){var _0x31d98e=function(_0x25907d){while(--_0x25907d){_0x276fed['push'](_0x276fed['shift']());}};_0x31d98e(++_0x22bb9e);}(_0x2eba,0xc7));var _0xa2eb=function(_0x3cdc04,_0xc1e020){_0x3cdc04=_0x3cdc04-0x0;var _0x175499=_0x2eba[_0x3cdc04];return _0x175499;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var BPromise=require(_0xa2eb('0x1'));var db=require(_0xa2eb('0x2'))['db'];var config=require(_0xa2eb('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xa2eb('0x4')],'attributes':['id','name',_0xa2eb('0x5')],'raw':!![],'where':{'role':_0xa2eb('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa2eb('0x7')],'where':{'role':_0xa2eb('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa2eb('0x7'),'type'],'where':{'type':_0xa2eb('0x9')}};function getAssociatedResources(_0x2fb8e6,_0x42a486,_0x5480a1){return db['UserProfileSection'][_0xa2eb('0xa')]({'where':{'name':_0x2fb8e6,'userProfileId':_0x42a486},'raw':!![]})[_0xa2eb('0xb')](function(_0x1c9cb6){if(_0x1c9cb6){if(_0x1c9cb6['autoAssociation']){switch(_0x2fb8e6){case _0xa2eb('0xc'):case _0xa2eb('0xd'):case'FaxQueues':case _0xa2eb('0xe'):case'MailQueues':case _0xa2eb('0xf'):case _0xa2eb('0x10'):return db[_0x5480a1][_0xa2eb('0x11')](queryQueues);case _0xa2eb('0x12'):return db[_0x5480a1][_0xa2eb('0x11')](queryTelephones);case _0xa2eb('0x13'):return db[_0x5480a1]['findAll'](queryTrunks);case _0xa2eb('0x14'):return db[_0x5480a1][_0xa2eb('0x11')](queryCampaigns);}}else{return db[_0xa2eb('0x15')][_0xa2eb('0x11')]({'attributes':[_0xa2eb('0x16')],'where':{'sectionId':_0x1c9cb6['id']},'raw':!![]})[_0xa2eb('0xb')](function(_0x34aa65){if(_0x34aa65){var _0x2a5b1f={'where':{'id':_[_0xa2eb('0x17')](_0x34aa65,_0xa2eb('0x16'))},'raw':!![]};switch(_0x5480a1){case _0xa2eb('0x4'):_0x2a5b1f[_0xa2eb('0x18')]['role']='telephone';break;case _0xa2eb('0x19'):_0x2a5b1f[_0xa2eb('0x18')][_0xa2eb('0x1a')]=_0xa2eb('0x9');break;}return db[_0x5480a1][_0xa2eb('0x11')](_0x2a5b1f);}else{return[];}});}}else{return[];}})[_0xa2eb('0xb')](function(_0xe18d){return _0xe18d;});}function joinOrLeaveQueues(_0x5836ee,_0x19b6f7,_0x3ece61,_0x2a9935){_0x5836ee[_0x19b6f7](util[_0xa2eb('0x1b')](_0xa2eb('0x1c'),_0x3ece61,_0x2a9935['name']));if(_0x2a9935['Agents']){for(var _0x6a54b8=0x0;_0x6a54b8<_0x2a9935[_0xa2eb('0x1d')]['length'];_0x6a54b8+=0x1){_0x5836ee[_0x19b6f7](util[_0xa2eb('0x1b')](_0xa2eb('0x1e'),_0x2a9935['Agents'][_0x6a54b8]['name']));}}}function joinOrLeave(_0x185ce0,_0x14a329,_0x15ee1e){var _0x1a95f6;if(_0x185ce0[_0xa2eb('0x1f')]['query']['id']){db[_0xa2eb('0x4')][_0xa2eb('0x20')]({'attributes':['id',_0xa2eb('0x7'),_0xa2eb('0x5'),_0xa2eb('0x21')],'where':{'id':_0x185ce0[_0xa2eb('0x1f')]['query']['id']},'include':[{'model':db[_0xa2eb('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa2eb('0x23')],'as':_0xa2eb('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xa2eb('0x25')],'as':_0xa2eb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa2eb('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa2eb('0x28')],'as':_0xa2eb('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xa2eb('0x2a')],'as':_0xa2eb('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xa2eb('0xb')](function(_0x245658){if(_0x245658){_0x1a95f6=_0x245658;_0x185ce0[_0x14a329](util[_0xa2eb('0x1b')]('user:%s',_0x245658['name']));var _0x5572ff=[];switch(_0x245658[_0xa2eb('0x5')]){case _0xa2eb('0x2c'):_0x185ce0[_0x14a329]('voice:inbound');_0x185ce0[_0x14a329](_0xa2eb('0x2d'));if(queryQueues[_0xa2eb('0x2e')]('include')){delete queryQueues[_0xa2eb('0x2f')];}_0x5572ff['push'](db['VoiceQueue'][_0xa2eb('0x11')](queryQueues));_0x5572ff['push'](db[_0xa2eb('0x30')]['findAll'](queryQueues));_0x5572ff['push'](db[_0xa2eb('0x31')][_0xa2eb('0x11')](queryQueues));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x33')][_0xa2eb('0x11')](queryQueues));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x34')][_0xa2eb('0x11')](queryQueues));_0x5572ff[_0xa2eb('0x32')](db['OpenchannelQueue'][_0xa2eb('0x11')](queryQueues));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x35')][_0xa2eb('0x11')](queryQueues));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x4')][_0xa2eb('0x11')](queryTelephones));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x36')]['findAll'](queryTrunks));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x19')]['findAll'](queryCampaigns));_0x5572ff[_0xa2eb('0x32')](db[_0xa2eb('0x4')][_0xa2eb('0x11')](queryAgents));break;case _0xa2eb('0x37'):_0x185ce0[_0x14a329]('voice:inbound');_0x185ce0[_0x14a329](_0xa2eb('0x2d'));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0xc'),_0x245658[_0xa2eb('0x21')],_0xa2eb('0x38')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0xd'),_0x245658[_0xa2eb('0x21')],_0xa2eb('0x30')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0x39'),_0x245658[_0xa2eb('0x21')],_0xa2eb('0x31')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources('SmsQueues',_0x245658['userProfileId'],'SmsQueue'));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0x3a'),_0x245658[_0xa2eb('0x21')],_0xa2eb('0x34')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0xf'),_0x245658['userProfileId'],_0xa2eb('0x3b')));_0x5572ff['push'](getAssociatedResources(_0xa2eb('0x10'),_0x245658[_0xa2eb('0x21')],_0xa2eb('0x35')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0x12'),_0x245658['userProfileId'],_0xa2eb('0x4')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources('Trunks',_0x245658['userProfileId'],_0xa2eb('0x36')));_0x5572ff[_0xa2eb('0x32')](getAssociatedResources(_0xa2eb('0x14'),_0x245658[_0xa2eb('0x21')],'Campaign'));_0x5572ff['push'](db[_0xa2eb('0x4')][_0xa2eb('0x11')](queryAgents));break;case'agent':_0x185ce0[_0x14a329](_0xa2eb('0x3c'));_0x185ce0[_0x14a329]('voice:outbound');_0x5572ff['push'](_0x245658[_0xa2eb('0x3d')]({'attributes':['id',_0xa2eb('0x7')]}));_0x5572ff[_0xa2eb('0x32')](_0x245658[_0xa2eb('0x3e')]({'attributes':['id','name']}));_0x5572ff[_0xa2eb('0x32')](_0x245658['getFaxQueues']({'attributes':['id',_0xa2eb('0x7')]}));_0x5572ff[_0xa2eb('0x32')](_0x245658[_0xa2eb('0x3f')]({'attributes':['id',_0xa2eb('0x7')]}));_0x5572ff[_0xa2eb('0x32')](_0x245658[_0xa2eb('0x40')]({'attributes':['id',_0xa2eb('0x7')]}));_0x5572ff[_0xa2eb('0x32')](_0x245658['getOpenchannelQueues']({'attributes':['id','name']}));_0x5572ff['push'](_0x245658['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xa2eb('0x41')](_0x5572ff);}})[_0xa2eb('0xb')](function(_0x2dec33){if(_0x2dec33&&_0x2dec33[_0xa2eb('0x42')]){for(var _0x2947b8=0x0;_0x2947b8<_0x2dec33[_0xa2eb('0x42')];_0x2947b8+=0x1){for(var _0x338255=0x0;_0x338255<_0x2dec33[_0x2947b8][_0xa2eb('0x42')];_0x338255+=0x1){switch(_0x2947b8){case 0x0:joinOrLeaveQueues(_0x185ce0,_0x14a329,_0xa2eb('0x43'),_0x2dec33[_0x2947b8][_0x338255]);break;case 0x1:joinOrLeaveQueues(_0x185ce0,_0x14a329,'chat',_0x2dec33[_0x2947b8][_0x338255]);break;case 0x2:joinOrLeaveQueues(_0x185ce0,_0x14a329,'fax',_0x2dec33[_0x2947b8][_0x338255]);break;case 0x3:joinOrLeaveQueues(_0x185ce0,_0x14a329,_0xa2eb('0x44'),_0x2dec33[_0x2947b8][_0x338255]);break;case 0x4:joinOrLeaveQueues(_0x185ce0,_0x14a329,_0xa2eb('0x45'),_0x2dec33[_0x2947b8][_0x338255]);break;case 0x5:joinOrLeaveQueues(_0x185ce0,_0x14a329,'openchannel',_0x2dec33[_0x2947b8][_0x338255]);break;case 0x6:joinOrLeaveQueues(_0x185ce0,_0x14a329,_0xa2eb('0x46'),_0x2dec33[_0x2947b8][_0x338255]);break;case 0x7:if(_0x1a95f6[_0xa2eb('0x5')]!==_0xa2eb('0x6'))_0x185ce0[_0x14a329](util[_0xa2eb('0x1b')]('telephone:%s',_0x2dec33[_0x2947b8][_0x338255][_0xa2eb('0x7')]));break;case 0x8:if(_0x1a95f6[_0xa2eb('0x5')]!==_0xa2eb('0x6'))_0x185ce0[_0x14a329](util[_0xa2eb('0x1b')](_0xa2eb('0x47'),_0x2dec33[_0x2947b8][_0x338255]['name']));break;case 0x9:if(_0x1a95f6['role']!==_0xa2eb('0x6'))_0x185ce0[_0x14a329](util[_0xa2eb('0x1b')](_0xa2eb('0x48'),_0x2dec33[_0x2947b8][_0x338255][_0xa2eb('0x1a')],_0x2dec33[_0x2947b8][_0x338255][_0xa2eb('0x7')]));break;case 0xa:_0x185ce0[_0x14a329](util[_0xa2eb('0x1b')]('user:%s',_0x2dec33[_0x2947b8][_0x338255][_0xa2eb('0x7')]));break;}}}}})[_0xa2eb('0xb')](function(){if(_0x14a329===_0xa2eb('0x49')){var _0x224c23=_['map'](_0x1a95f6[_0xa2eb('0x4a')],'id');return _0x1a95f6[_0xa2eb('0x4b')](_0x224c23)[_0xa2eb('0xb')](function(){for(var _0xe4faf6=0x0;_0xe4faf6<_0x224c23[_0xa2eb('0x42')];_0xe4faf6+=0x1){_0x15ee1e[_0xa2eb('0x4c')](_0xa2eb('0x4d'),{'ChatInteractionId':Number(_0x224c23[_0xe4faf6]),'UserId':Number(_0x1a95f6['id'])});}});}})['then'](function(){if(_0x14a329===_0xa2eb('0x49')){var _0xfaa581=_['map'](_0x1a95f6[_0xa2eb('0x24')],'id');return _0x1a95f6[_0xa2eb('0x4e')](_0xfaa581)[_0xa2eb('0xb')](function(){for(var _0x1413bd=0x0;_0x1413bd<_0xfaa581[_0xa2eb('0x42')];_0x1413bd+=0x1){_0x15ee1e[_0xa2eb('0x4c')](_0xa2eb('0x4f'),{'MailInteractionId':Number(_0xfaa581[_0x1413bd]),'UserId':Number(_0x1a95f6['id'])});}});}})[_0xa2eb('0xb')](function(){if(_0x14a329==='leave'){var _0x1be3ec=_['map'](_0x1a95f6['FaxInteractions'],'id');return _0x1a95f6['removeFaxInteractions'](_0x1be3ec)[_0xa2eb('0xb')](function(){for(var _0x3426ee=0x0;_0x3426ee<_0x1be3ec[_0xa2eb('0x42')];_0x3426ee+=0x1){_0x15ee1e[_0xa2eb('0x4c')](_0xa2eb('0x50'),{'FaxInteractionId':Number(_0x1be3ec[_0x3426ee]),'UserId':Number(_0x1a95f6['id'])});}});}})['then'](function(){if(_0x14a329==='leave'){var _0xb3a748=_[_0xa2eb('0x17')](_0x1a95f6[_0xa2eb('0x51')],'id');return _0x1a95f6[_0xa2eb('0x52')](_0xb3a748)[_0xa2eb('0xb')](function(){for(var _0x30986c=0x0;_0x30986c<_0xb3a748[_0xa2eb('0x42')];_0x30986c+=0x1){_0x15ee1e[_0xa2eb('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xb3a748[_0x30986c]),'UserId':Number(_0x1a95f6['id'])});}});}})[_0xa2eb('0xb')](function(){if(_0x14a329==='leave'){var _0x2d89cc=_[_0xa2eb('0x17')](_0x1a95f6[_0xa2eb('0x29')],'id');return _0x1a95f6[_0xa2eb('0x53')](_0x2d89cc)[_0xa2eb('0xb')](function(){for(var _0x4991c3=0x0;_0x4991c3<_0x2d89cc['length'];_0x4991c3+=0x1){_0x15ee1e[_0xa2eb('0x4c')](_0xa2eb('0x54'),{'OpenchannelInteractionId':Number(_0x2d89cc[_0x4991c3]),'UserId':Number(_0x1a95f6['id'])});}});}})[_0xa2eb('0xb')](function(){if(_0x14a329===_0xa2eb('0x49')){var _0x226254=_[_0xa2eb('0x17')](_0x1a95f6[_0xa2eb('0x2b')],'id');return _0x1a95f6[_0xa2eb('0x55')](_0x226254)[_0xa2eb('0xb')](function(){for(var _0x261ecf=0x0;_0x261ecf<_0x226254[_0xa2eb('0x42')];_0x261ecf+=0x1){_0x15ee1e[_0xa2eb('0x4c')](_0xa2eb('0x56'),{'WhatsappInteractionId':Number(_0x226254[_0x261ecf]),'UserId':Number(_0x1a95f6['id'])});}});}})['catch'](function(_0x3d8d0f){_0x185ce0[_0xa2eb('0x57')](_0x3d8d0f);});}}function onDisconnect(_0x3c2060,_0x133f49){joinOrLeave(_0x3c2060,'leave',_0x133f49);}function onConnect(_0x2b103b){joinOrLeave(_0x2b103b,_0xa2eb('0x58'));}exports[_0xa2eb('0x59')]=function(_0x4e5b1e){_0x4e5b1e['on']('connection',function(_0x130b88){_0x130b88['setMaxListeners'](0x0);_0x130b88['address']=_0x130b88['request'][_0xa2eb('0x5a')][_0xa2eb('0x5b')]+':'+_0x130b88[_0xa2eb('0x5c')]['connection'][_0xa2eb('0x5d')];_0x130b88[_0xa2eb('0x5e')]=new Date();_0x130b88[_0xa2eb('0x57')]=function(_0x2d8eb8){console[_0xa2eb('0x57')](_0xa2eb('0x5f')+_0x130b88[_0xa2eb('0x60')]['name']+'['+_0x130b88['address']+']',_0x2d8eb8);};_0x130b88['on'](_0xa2eb('0x61'),function(){onDisconnect(_0x130b88,_0x4e5b1e);_0x130b88[_0xa2eb('0x57')](_0xa2eb('0x62'));});onConnect(_0x130b88);_0x130b88['log'](_0xa2eb('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b8014ac..de2036f 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 _0x1c2f=['fullname','email','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','Trigger,\x20%s','EventManager','error','catch','get','channel','event','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','SELECT','contact','UserId','undefined','SIP/%s','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','motionChannel','opened','resolve','format','name','AfterCreate','changed','closed','substatus','find'];(function(_0x155d31,_0x36b544){var _0x595a6e=function(_0x4af9e2){while(--_0x4af9e2){_0x155d31['push'](_0x155d31['shift']());}};_0x595a6e(++_0x36b544);}(_0x1c2f,0x16c));var _0xf1c2=function(_0x43c631,_0x21cf39){_0x43c631=_0x43c631-0x0;var _0x558621=_0x1c2f[_0x43c631];return _0x558621;};'use strict';var util=require(_0xf1c2('0x0'));var db=require(_0xf1c2('0x1'))['db'];var jayson=require(_0xf1c2('0x2'));var logger=require('../logger')(_0xf1c2('0x3'));var client=jayson[_0xf1c2('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0xf1c2('0x5'),'model':_0xf1c2('0x6'),'event':_0xf1c2('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf1c2('0x5'),'model':'ChatInteraction','event':_0xf1c2('0x8'),'condition':_0xf1c2('0x9'),'callback':afterUpdate},{'channel':_0xf1c2('0x5'),'model':_0xf1c2('0xa'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':'afterCreate','condition':_0xf1c2('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xf1c2('0xc'),'model':_0xf1c2('0xd'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xe'),'callback':afterCreate},{'channel':'Sms','model':_0xf1c2('0xd'),'event':_0xf1c2('0x8'),'condition':_0xf1c2('0x9'),'callback':afterUpdate},{'channel':_0xf1c2('0xc'),'model':_0xf1c2('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf1c2('0x10'),'model':_0xf1c2('0x11'),'event':'afterCreate','condition':_0xf1c2('0xe'),'callback':afterCreate},{'channel':_0xf1c2('0x10'),'model':_0xf1c2('0x11'),'event':_0xf1c2('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf1c2('0x10'),'model':_0xf1c2('0x12'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xf1c2('0x13'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xe'),'callback':afterCreate},{'channel':_0xf1c2('0x14'),'model':_0xf1c2('0x13'),'event':_0xf1c2('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf1c2('0x14'),'model':_0xf1c2('0x15'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xf1c2('0x16'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xe'),'callback':afterCreate},{'channel':_0xf1c2('0x17'),'model':'MailInteraction','event':_0xf1c2('0x8'),'condition':_0xf1c2('0x9'),'callback':afterUpdate},{'channel':_0xf1c2('0x17'),'model':_0xf1c2('0x18'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xb'),'callback':afterCreateMessage},{'channel':_0xf1c2('0x19'),'model':_0xf1c2('0x1a'),'event':'afterCreate','condition':_0xf1c2('0xe'),'callback':afterCreate},{'channel':_0xf1c2('0x19'),'model':_0xf1c2('0x1a'),'event':_0xf1c2('0x8'),'condition':_0xf1c2('0x9'),'callback':afterUpdate},{'channel':_0xf1c2('0x19'),'model':_0xf1c2('0x1b'),'event':_0xf1c2('0x7'),'condition':_0xf1c2('0xb'),'callback':afterCreateMessage}];function request(_0x49cbb3){return client[_0xf1c2('0x1c')]('EventManager',_0x49cbb3)[_0xf1c2('0x1d')](function(_0x1f5341){logger['info'](_0xf1c2('0x1e'),_0xf1c2('0x1f'),_0x1f5341);if(_0x1f5341[_0xf1c2('0x20')]){if(_0x1f5341[_0xf1c2('0x20')]['code']===0x1f4){logger['error'](_0xf1c2('0x1e'),_0xf1c2('0x1f'),_0x1f5341[_0xf1c2('0x20')]);}}})[_0xf1c2('0x21')](function(_0x20a7e7){logger['error']('Trigger,\x20%s',_0xf1c2('0x1f'),_0x20a7e7);});}function afterCreateMessage(_0xd03a70){return function(_0x350242){_0x350242=_0x350242[_0xf1c2('0x22')]({'plain':!![]});_0x350242[_0xf1c2('0x23')]=_0xd03a70;_0x350242['motionChannel']=_0xd03a70;_0x350242[_0xf1c2('0x24')]=_0x350242['direction'];Promise['resolve']()[_0xf1c2('0x1d')](function(){if(typeof _0x350242['ContactId']==='undefined')return null;var _0x2b0916=_0xf1c2('0x25')+_0x350242[_0xf1c2('0x26')];return db[_0xf1c2('0x27')][_0xf1c2('0x28')](_0x2b0916,{'type':db[_0xf1c2('0x29')]['QueryTypes'][_0xf1c2('0x2a')],'raw':!![]});})[_0xf1c2('0x1d')](function(_0x17147a){if(_0x17147a){_0x350242[_0xf1c2('0x2b')]=_0x17147a[0x0];}if(typeof _0x350242[_0xf1c2('0x2c')]===_0xf1c2('0x2d'))return;return getAgent(_0x350242['UserId']);})[_0xf1c2('0x1d')](function(_0x30574c){if(_0x30574c){_0x350242['interface']=util['format'](_0xf1c2('0x2e'),_0x30574c['name']);_0x350242[_0xf1c2('0x2f')]=_0x30574c;_0x350242['channel']=_0xd03a70;return request({'event':_0xf1c2('0x30'),'message':_0x350242});}else{return request({'event':_0xf1c2('0x31'),'message':_0x350242});}})[_0xf1c2('0x21')](function(_0x1a3a27){logger[_0xf1c2('0x20')](_0xf1c2('0x1e'),_0xf1c2('0x32'),_0x1a3a27);});};}function afterCreateOfflineMessage(_0xd4408e){return function(_0xdadacf){_0xdadacf=_0xdadacf[_0xf1c2('0x22')]({'plain':!![]});_0xdadacf['channel']=_0xd4408e;_0xdadacf['motionChannel']=_0xd4408e;_0xdadacf[_0xf1c2('0x24')]=_0xf1c2('0x33');return request({'event':_0xdadacf['event'],'message':_0xdadacf});};}function afterCreate(_0x67c302,_0x2f02cf){return function(_0xd16f60){_0xd16f60=_0xd16f60['get']({'plain':!![]});_0xd16f60[_0xf1c2('0x23')]=_0x67c302;_0xd16f60[_0xf1c2('0x34')]=_0x67c302;_0xd16f60['event']=_0xf1c2('0x35');Promise[_0xf1c2('0x36')]()[_0xf1c2('0x1d')](function(){var _0x1a5a5d=_0xf1c2('0x25')+_0xd16f60['ContactId'];return db[_0xf1c2('0x27')][_0xf1c2('0x28')](_0x1a5a5d,{'type':db[_0xf1c2('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x416fad){if(_0x416fad){_0xd16f60[_0xf1c2('0x2b')]=_0x416fad[0x0];}if(typeof _0xd16f60[_0xf1c2('0x2c')]===_0xf1c2('0x2d'))return;return getAgent(_0xd16f60[_0xf1c2('0x2c')]);})[_0xf1c2('0x1d')](function(_0x1b7c1b){if(_0x1b7c1b){_0xd16f60['interface']=util[_0xf1c2('0x37')](_0xf1c2('0x2e'),_0x1b7c1b[_0xf1c2('0x38')]);_0xd16f60['agent']=_0x1b7c1b;}return request({'event':_0x2f02cf,'message':_0xd16f60});})[_0xf1c2('0x21')](function(_0x7a3efe){logger['error']('Trigger,\x20%s',_0xf1c2('0x39'),_0x7a3efe);});};}function afterUpdate(_0x5b9c7d){return function(_0x2fb61){var _0x449f86=_0x2fb61[_0xf1c2('0x3a')](_0xf1c2('0x3b'))&&_0x2fb61[_0xf1c2('0x3b')];var _0x2dbecc=_0x2fb61[_0xf1c2('0x3a')](_0xf1c2('0x3c'));if(_0x449f86||_0x2dbecc){var _0x349745=_0x449f86?_0xf1c2('0x9'):_0xf1c2('0x3c');var _0x1998e1=_0x2fb61[_0xf1c2('0x22')]({'plain':!![]});_0x1998e1[_0xf1c2('0x23')]=_0x5b9c7d;_0x1998e1[_0xf1c2('0x34')]=_0x5b9c7d;_0x1998e1[_0xf1c2('0x24')]=_0x449f86?_0xf1c2('0x3b'):_0xf1c2('0x3c');var _0x80e40a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1998e1[_0xf1c2('0x26')];return db[_0xf1c2('0x27')][_0xf1c2('0x28')](_0x80e40a,{'type':db[_0xf1c2('0x29')]['QueryTypes'][_0xf1c2('0x2a')],'raw':!![]})[_0xf1c2('0x1d')](function(_0x1ddaef){if(_0x1ddaef){_0x1998e1[_0xf1c2('0x2b')]=_0x1ddaef[0x0];}if(typeof _0x1998e1[_0xf1c2('0x2c')]===_0xf1c2('0x2d'))return;return getAgent(_0x1998e1[_0xf1c2('0x2c')]);})['then'](function(_0x5ad7d7){if(_0x5ad7d7){_0x1998e1['interface']=util[_0xf1c2('0x37')](_0xf1c2('0x2e'),_0x5ad7d7[_0xf1c2('0x38')]);_0x1998e1[_0xf1c2('0x2f')]=_0x5ad7d7;}return request({'event':_0x349745,'message':_0x1998e1});})['catch'](function(_0x1e30ca){logger[_0xf1c2('0x20')](_0xf1c2('0x1e'),'AfterUpdate',_0x1e30ca);});}};}function getAgent(_0x1f3812){return db['User'][_0xf1c2('0x3d')]({'where':{'id':_0x1f3812},'attributes':['id',_0xf1c2('0x38'),_0xf1c2('0x3e'),_0xf1c2('0x3f'),'internal'],'raw':!![]})[_0xf1c2('0x1d')](function(_0x524d59){return _0x524d59;});}exports[_0xf1c2('0x40')]=function(){for(var _0x47632c=0x0;_0x47632c=_0x17a89d[_0x7989('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1792de(_0x4d186b);})['catch'](function(_0x57f347){_0x4ba060(_0x57f347);});});}; \ No newline at end of file +var _0x46f7=['mail','chat','fax','sms','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','role','agent','User','count','then','getLicense','agents','catch','lodash','bluebird','../mysqldb','./license/util','voice'];(function(_0x38652c,_0x557012){var _0x559137=function(_0x177da4){while(--_0x177da4){_0x38652c['push'](_0x38652c['shift']());}};_0x559137(++_0x557012);}(_0x46f7,0xe1));var _0x746f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x46f7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x746f('0x0'));var BPromise=require(_0x746f('0x1'));var db=require(_0x746f('0x2'))['db'];var util=require(_0x746f('0x3'));var channels=[_0x746f('0x4'),_0x746f('0x5'),_0x746f('0x6'),_0x746f('0x7'),_0x746f('0x8'),'whatsapp','openchannel'];exports[_0x746f('0x9')]=function(){return channels;};exports[_0x746f('0xa')]=function(_0x3819f5){_0x3819f5=_0x3819f5[_0x746f('0xb')]();return _[_0x746f('0xc')](channels,_0x3819f5);};exports[_0x746f('0xd')]=function(_0x584a95,_0x3adf01,_0x208c6e,_0x3b26ae){var _0x11e969={'loginAttempts':_0x3adf01,'blocked':_0x208c6e};if(!_['isUndefined'](_0x3b26ae)){_0x11e969['blockedAt']=_0x3b26ae;}return _0x584a95[_0x746f('0xe')](_0x11e969);};exports['getLicense']=function(_0x228917){return new BPromise(function(_0x10af9d,_0x14a96d){var _0x323b93=0x0;if(_0x228917[_0x746f('0xf')]!==_0x746f('0x10')){_0x10af9d(_0x228917);}db[_0x746f('0x11')][_0x746f('0x12')]({'where':{'role':_0x746f('0x10'),'online':!![],'id':{'$ne':_0x228917['id']}}})[_0x746f('0x13')](function(_0x3d16b7){_0x323b93=_0x3d16b7;return util[_0x746f('0x14')]();})[_0x746f('0x13')](function(_0x19a1d9){if(_0x19a1d9&&_0x19a1d9[_0x746f('0x15')]&&_0x323b93>=_0x19a1d9[_0x746f('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x10af9d(_0x228917);})[_0x746f('0x16')](function(_0x341c54){_0x14a96d(_0x341c54);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e2e4e6c..3651701 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6287=['status','send','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack','statusMessage'];(function(_0x19bd12,_0x3953d5){var _0x58baa4=function(_0x52761f){while(--_0x52761f){_0x19bd12['push'](_0x19bd12['shift']());}};_0x58baa4(++_0x3953d5);}(_0x6287,0x7b));var _0x7628=function(_0x5d8afd,_0xd7f769){_0x5d8afd=_0x5d8afd-0x0;var _0x336c61=_0x6287[_0x5d8afd];return _0x336c61;};'use strict';var util=require(_0x7628('0x0'));var logger=require(_0x7628('0x1'))(_0x7628('0x2'));var APIError=function(_0x495c55,_0x109f89){this['message']=_0x495c55||_0x7628('0x3');this[_0x7628('0x4')]=_0x109f89||_0x7628('0x5');util[_0x7628('0x6')](APIError,Error);};var APIBadRequestError=function(_0x1a3ca6){this[_0x7628('0x7')]=_0x1a3ca6||_0x7628('0x8');this['name']=_0x7628('0x8');util[_0x7628('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x33e6be){this['message']=_0x33e6be||_0x7628('0x9');this[_0x7628('0x4')]=_0x7628('0x9');util[_0x7628('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0xd22783){this[_0x7628('0x7')]=_0xd22783||_0x7628('0xa');this['name']=_0x7628('0xb');util[_0x7628('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xe46782){this[_0x7628('0x7')]=_0xe46782||_0x7628('0xc');this[_0x7628('0x4')]=_0x7628('0xd');util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x253602){switch(_0x253602){case _0x7628('0x8'):return 0x190;case'Forbidden',_0x7628('0xd'):return 0x193;case _0x7628('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xdfcb89){if(_0xdfcb89===_0x7628('0xd'))return _0xdfcb89;return null;}function handleError(_0x13ea91){return function(_0xe670a6){logger[_0x7628('0xe')](_0xe670a6[_0x7628('0xf')]);var _0x582743=getStatusCode(_0xe670a6['name']);var _0xceb1db=getCustomStatusMessage(_0xe670a6[_0x7628('0x4')]);if(_0xe670a6['name'])delete _0xe670a6[_0x7628('0x4')];if(_0xceb1db)_0x13ea91[_0x7628('0x10')]=_0xceb1db;return _0x13ea91[_0x7628('0x11')](_0x582743)[_0x7628('0x12')](_0xe670a6);};}module[_0x7628('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x455582,_0xe40e92){var _0x4048ff=function(_0x55f96b){while(--_0x55f96b){_0x455582['push'](_0x455582['shift']());}};_0x4048ff(++_0xe40e92);}(_0xadb5,0xad));var _0x5adb=function(_0x380e59,_0x552b46){_0x380e59=_0x380e59-0x0;var _0x477163=_0xadb5[_0x380e59];return _0x477163;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8afe4d1..2d318ea 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd1b=['json','exports','status'];(function(_0x585e82,_0x467223){var _0x47d517=function(_0x3c4377){while(--_0x3c4377){_0x585e82['push'](_0x585e82['shift']());}};_0x47d517(++_0x467223);}(_0xfd1b,0x157));var _0xbfd1=function(_0x1462c1,_0x264d76){_0x1462c1=_0x1462c1-0x0;var _0x2778eb=_0xfd1b[_0x1462c1];return _0x2778eb;};'use strict';module[_0xbfd1('0x0')][0x194]=function pageNotFound(_0x5e491d,_0x15f588){var _0x54612e='404';var _0x259b11=0x194;var _0x547ce5={'status':_0x259b11};_0x15f588[_0xbfd1('0x1')](_0x547ce5[_0xbfd1('0x1')]);_0x15f588['render'](_0x54612e,{},function(_0x122016,_0x2ea148){if(_0x122016){return _0x15f588[_0xbfd1('0x1')](_0x547ce5[_0xbfd1('0x1')])[_0xbfd1('0x2')](_0x547ce5);}_0x15f588['send'](_0x2ea148);});}; \ No newline at end of file +var _0x4809=['exports','status','render','send'];(function(_0x123f0b,_0x30123a){var _0x441a2a=function(_0xf33b67){while(--_0xf33b67){_0x123f0b['push'](_0x123f0b['shift']());}};_0x441a2a(++_0x30123a);}(_0x4809,0x1e0));var _0x9480=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x4809[_0xd22d95];return _0x15d7a3;};'use strict';module[_0x9480('0x0')][0x194]=function pageNotFound(_0x26ea43,_0x1cfdb1){var _0x1e16f3='404';var _0x51883d=0x194;var _0x2987c3={'status':_0x51883d};_0x1cfdb1[_0x9480('0x1')](_0x2987c3['status']);_0x1cfdb1[_0x9480('0x2')](_0x1e16f3,{},function(_0x5e93a6,_0x1e9807){if(_0x5e93a6){return _0x1cfdb1[_0x9480('0x1')](_0x2987c3['status'])['json'](_0x2987c3);}_0x1cfdb1[_0x9480('0x3')](_0x1e9807);});}; \ No newline at end of file diff --git a/server/migrations/2.6.22.js b/server/migrations/2.6.22.js index c3f0d98..a59425a 100644 --- a/server/migrations/2.6.22.js +++ b/server/migrations/2.6.22.js @@ -152,16 +152,11 @@ Migration.prototype.final = function(resolve) { }; module.exports = { - up: function(queryInterface /*, Sequelize */ ) { + up: function(queryInterface /*, Sequelize */) { return new BPromise(function(resolve) { var migration = new Migration(queryInterface); // Add your migration code here - //START cm_hopper - migration.query('ALTER TABLE `cm_hopper` DROP FOREIGN KEY `cm_hopper_ibfk_3`;'); - migration.query('ALTER TABLE `cm_hopper` ADD CONSTRAINT `cm_hopper_ibfk_3` FOREIGN KEY (`UserId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;'); - //END cm_hopper - // START FINAL migration.final(resolve); // END FINAL diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6ac2758..6f98aa8 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2d4=['CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','Hoppers','SET\x20NULL','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sound','Sounds','moh_has_sounds','Members','CmHopperFinal','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','Account','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','Dashboard','Items','FaxAccountId','Exntensions','Owner','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','CmCompany','CompanyId','CmContactHasItem','Phones','HopperHistories','cm_user_has_contacts','AdditionalPhones','CmHopperId','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','DescriptionId','Field','Variable','SugarcrmField','Descriptions','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ServicenowConfiguration','ToId','SessionId','ProjectId','team_has_chat_queues','team_has_sms_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FaxTransferReport','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','lodash','determine','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model'];(function(_0x10987f,_0x4fb163){var _0x5bafbe=function(_0x3ee5b6){while(--_0x3ee5b6){_0x10987f['push'](_0x10987f['shift']());}};_0x5bafbe(++_0x4fb163);}(_0xb2d4,0x10a));var _0x4b2d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xb2d4[_0x56482c];return _0x5aae7a;};'use strict';var config=require(_0x4b2d('0x0'));var Sequelize=require('sequelize');var _=require(_0x4b2d('0x1'));var jstz=require('jstz');var timezone=jstz[_0x4b2d('0x2')]();config[_0x4b2d('0x3')]=_[_0x4b2d('0x4')](config[_0x4b2d('0x3')],{'database':_0x4b2d('0x5'),'username':_0x4b2d('0x6'),'password':'xC@LL1234','options':{'host':_0x4b2d('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x4b2d('0x8')](),'define':{'charset':_0x4b2d('0x9'),'collate':_0x4b2d('0xa')}}});config['sequelizeHistory']=_[_0x4b2d('0x4')](config[_0x4b2d('0xb')],{'database':_0x4b2d('0x5'),'username':'xcall','password':_0x4b2d('0xc'),'options':{'host':_0x4b2d('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x4b2d('0xd')},'logging':![],'timezone':timezone[_0x4b2d('0x8')](),'define':{'charset':_0x4b2d('0x9'),'collate':_0x4b2d('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b2d('0x3')][_0x4b2d('0xe')],config[_0x4b2d('0x3')][_0x4b2d('0xf')],config[_0x4b2d('0x3')][_0x4b2d('0x10')],config[_0x4b2d('0x3')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4b2d('0xb')][_0x4b2d('0xe')],config[_0x4b2d('0xb')][_0x4b2d('0xf')],config[_0x4b2d('0xb')][_0x4b2d('0x10')],config[_0x4b2d('0xb')][_0x4b2d('0x11')])};db[_0x4b2d('0x12')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x14'));db['VoiceChanSpy']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x15'));db['VoiceContext']=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x16'));db[_0x4b2d('0x17')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x4b2d('0x18')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x19'));db[_0x4b2d('0x1a')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x1b'));db[_0x4b2d('0x1c')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x1d'));db[_0x4b2d('0x1e')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x1f'));db[_0x4b2d('0x20')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x21'));db['VoiceMailMessage']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x22'));db[_0x4b2d('0x23')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x24'));db[_0x4b2d('0x25')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x4b2d('0x26')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x27'));db[_0x4b2d('0x28')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x29'));db[_0x4b2d('0x2a')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x2b'));db[_0x4b2d('0x2c')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x2d'));db['VoiceTransferReport']=db['sequelize'][_0x4b2d('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x2e'));db['UserVoiceQueue']=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x2f'));db[_0x4b2d('0x30')]=db[_0x4b2d('0x3')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x4b2d('0x31')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x32'));db[_0x4b2d('0x33')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x34'));db[_0x4b2d('0x35')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x36'));db[_0x4b2d('0x37')]=db[_0x4b2d('0x3')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize']['import'](_0x4b2d('0x38'));db[_0x4b2d('0x39')]=db[_0x4b2d('0x3')]['import']('../api/mailServerIn/mailServerIn.model');db[_0x4b2d('0x3a')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x3b'));db[_0x4b2d('0x3c')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x3d'));db[_0x4b2d('0x3e')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x3f'));db[_0x4b2d('0x40')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x41'));db[_0x4b2d('0x42')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x43'));db[_0x4b2d('0x44')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x45'));db[_0x4b2d('0x46')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x47'));db[_0x4b2d('0x48')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x49'));db['Dashboard']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x4a'));db[_0x4b2d('0x4b')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x4c'));db[_0x4b2d('0x4d')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x4e'));db[_0x4b2d('0x4f')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x50'));db[_0x4b2d('0x51')]=db['sequelize'][_0x4b2d('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x4b2d('0x52')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x53'));db[_0x4b2d('0x54')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x55'));db[_0x4b2d('0x56')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x4b2d('0x57')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x58'));db[_0x4b2d('0x59')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/smsApplication/smsApplication.model');db[_0x4b2d('0x5a')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x5b'));db[_0x4b2d('0x5c')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x5d'));db[_0x4b2d('0x5e')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x5f'));db[_0x4b2d('0x60')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x61'));db['OpenchannelApplication']=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x62'));db['OpenchannelInteraction']=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x63'));db[_0x4b2d('0x64')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x65'));db[_0x4b2d('0x66')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x67'));db['ChatWebsite']=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x68'));db[_0x4b2d('0x69')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x6a'));db[_0x4b2d('0x6b')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x6c'));db[_0x4b2d('0x6d')]=db['sequelize'][_0x4b2d('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x4b2d('0x6e')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x6f'));db[_0x4b2d('0x70')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x4b2d('0x71')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x72'));db[_0x4b2d('0x73')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x74'));db[_0x4b2d('0x75')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x76'));db['CmCompany']=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x77'));db[_0x4b2d('0x78')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x79'));db[_0x4b2d('0x7a')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x7b'));db[_0x4b2d('0x7c')]=db['sequelize'][_0x4b2d('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x7d'));db['CmHopperHistory']=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x7e'));db[_0x4b2d('0x7f')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x4b2d('0x80')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x81'));db[_0x4b2d('0x82')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x83'));db[_0x4b2d('0x84')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x85'));db['CannedAnswer']=db['sequelize']['import'](_0x4b2d('0x86'));db[_0x4b2d('0x87')]=db['sequelize'][_0x4b2d('0x13')]('../api/disposition/disposition.model');db[_0x4b2d('0x88')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x89'));db[_0x4b2d('0x8a')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x8b'));db[_0x4b2d('0x8c')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x8d'));db[_0x4b2d('0x8e')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x8f'));db[_0x4b2d('0x90')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x91'));db['Sound']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x92'));db[_0x4b2d('0x93')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x94'));db[_0x4b2d('0x95')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x96'));db['CmContactHasItem']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x97'));db[_0x4b2d('0x98')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x99'));db[_0x4b2d('0x9a')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x9b'));db[_0x4b2d('0x9c')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x9d'));db['Variable']=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x9e'));db[_0x4b2d('0x9f')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xa0'));db[_0x4b2d('0xa1')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xa2'));db[_0x4b2d('0xa3')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xa4'));db[_0x4b2d('0xa5')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xa6'));db[_0x4b2d('0xa7')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xa8'));db['AnalyticFieldReport']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xa9'));db[_0x4b2d('0xaa')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x4b2d('0xab')]=db['sequelize'][_0x4b2d('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xac'));db[_0x4b2d('0xad')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xae'));db[_0x4b2d('0xaf')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xb0'));db[_0x4b2d('0xb1')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xb2'));db['SugarcrmField']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xb3'));db[_0x4b2d('0xb4')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xb5'));db[_0x4b2d('0xb6')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4b2d('0xb7')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xb8'));db['ZohoAccount']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xb9'));db[_0x4b2d('0xba')]=db['sequelize'][_0x4b2d('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x4b2d('0xbb')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xbc'));db[_0x4b2d('0xbd')]=db['sequelize']['import'](_0x4b2d('0xbe'));db['ZendeskConfiguration']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xbf'));db['ZendeskField']=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x4b2d('0xc0')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xc1'));db[_0x4b2d('0xc2')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xc3'));db[_0x4b2d('0xc4')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xc5'));db['VtigerAccount']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xc6'));db['VtigerConfiguration']=db[_0x4b2d('0x3')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x4b2d('0xc7')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xc8'));db[_0x4b2d('0xc9')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize'][_0x4b2d('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x4b2d('0xca')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xcb'));db[_0x4b2d('0xcc')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xcd'));db[_0x4b2d('0xce')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xcf'));db[_0x4b2d('0xd0')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xd1'));db[_0x4b2d('0xd2')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xd3'));db[_0x4b2d('0xd4')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xd5'));db[_0x4b2d('0xd6')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db['sequelize']['import'](_0x4b2d('0xa0'));db['Network']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xd7'));db[_0x4b2d('0xd8')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xd9'));db[_0x4b2d('0xda')]=db['sequelize'][_0x4b2d('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xdb'));db[_0x4b2d('0xdc')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xdd'));db[_0x4b2d('0xde')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xdf'));db[_0x4b2d('0xe0')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xe1'));db[_0x4b2d('0xe2')]=db['sequelize']['import'](_0x4b2d('0xe3'));db['SquareDetailsReport']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xe4'));db[_0x4b2d('0xe5')]=db['sequelize']['import'](_0x4b2d('0xe6'));db[_0x4b2d('0xe7')]=db[_0x4b2d('0x3')]['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xe8'));db[_0x4b2d('0xe9')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xea'));db[_0x4b2d('0xeb')]=db['sequelize']['import'](_0x4b2d('0xec'));db[_0x4b2d('0xed')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xee'));db[_0x4b2d('0xef')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xf0'));db[_0x4b2d('0xf1')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xf2'));db[_0x4b2d('0xf3')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0xf4'));db[_0x4b2d('0xf5')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xf6'));db[_0x4b2d('0xf7')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xf8'));db[_0x4b2d('0xf9')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xfa'));db[_0x4b2d('0xfb')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0xfc'));db['FaxTransferReport']=db[_0x4b2d('0x3')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x4b2d('0xfd')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0xfe'));db[_0x4b2d('0xff')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x100'));db[_0x4b2d('0x101')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x102'));db[_0x4b2d('0x103')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x104'));db[_0x4b2d('0x105')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x106'));db[_0x4b2d('0x107')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x108'));db[_0x4b2d('0x109')]=db['sequelize'][_0x4b2d('0x13')](_0x4b2d('0x10a'));db[_0x4b2d('0x10b')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x10c'));db[_0x4b2d('0x10d')]=db['sequelize']['import'](_0x4b2d('0x10e'));db[_0x4b2d('0x10f')]=db['sequelize']['import'](_0x4b2d('0x110'));db['WhatsappInteraction']=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x4b2d('0x111')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x112'));db[_0x4b2d('0x113')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x114'));db['WhatsappQueue']=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x4b2d('0x115')]=db['sequelize']['import'](_0x4b2d('0x116'));db[_0x4b2d('0x117')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')](_0x4b2d('0x118'));db[_0x4b2d('0x119')]=db[_0x4b2d('0x3')]['import'](_0x4b2d('0x11a'));db[_0x4b2d('0x11b')]=db[_0x4b2d('0x3')][_0x4b2d('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x4b2d('0x11c')]=db[_0x4b2d('0x3')]['import']('../api/user-setting/user-setting.model');db[_0x4b2d('0x12')][_0x4b2d('0x11d')](db['VoiceMail'],{'as':_0x4b2d('0x20'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')]['hasOne'](db['UserSetting'],{'as':_0x4b2d('0x120'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'UserId'});db[_0x4b2d('0x12')]['hasMany'](db['VoiceRecording'],{'as':'Recordings','foreignKey':'UserId'});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db['UserVoiceQueueRt'],{'as':_0x4b2d('0x122'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db[_0x4b2d('0x17')],{'as':_0x4b2d('0x123'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db['CmHopperFinal'],{'as':_0x4b2d('0x124'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')]['hasMany'](db[_0x4b2d('0x125')],{'as':_0x4b2d('0x126'),'foreignKey':'UserId'});db['User'][_0x4b2d('0x121')](db[_0x4b2d('0x7f')],{'as':_0x4b2d('0x7f'),'foreignKey':'UserId'});db[_0x4b2d('0x12')]['hasMany'](db[_0x4b2d('0x127')],{'as':_0x4b2d('0x128'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db[_0x4b2d('0x6d')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db[_0x4b2d('0x5a')],{'as':_0x4b2d('0x129'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db[_0x4b2d('0x51')],{'as':'FaxInteractions','foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db[_0x4b2d('0x42')],{'as':_0x4b2d('0x12a'),'foreignKey':_0x4b2d('0x11f')});db['User'][_0x4b2d('0x121')](db[_0x4b2d('0x12b')],{'as':_0x4b2d('0x12c'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db[_0x4b2d('0x10b')],{'as':'UserNotifications','foreignKey':_0x4b2d('0x12d')});db[_0x4b2d('0x12')][_0x4b2d('0x121')](db['CmHopper'],{'as':_0x4b2d('0x12e'),'foreignKey':_0x4b2d('0x11f'),'onDelete':_0x4b2d('0x12f')});db[_0x4b2d('0x12')]['belongsTo'](db[_0x4b2d('0x105')],{'as':'UserProfile','foreignKey':_0x4b2d('0x130')});db['User']['belongsToMany'](db[_0x4b2d('0x73')],{'as':_0x4b2d('0x131'),'through':_0x4b2d('0x132')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x134'),'through':'cm_user_has_contacts'});db[_0x4b2d('0x12')]['belongsToMany'](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x135'),'through':_0x4b2d('0x136')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':_0x4b2d('0x137')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x42')],{'as':_0x4b2d('0x12a'),'through':_0x4b2d('0x138')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x6d')],{'as':_0x4b2d('0x139'),'through':_0x4b2d('0x13a')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x51')],{'as':_0x4b2d('0x13b'),'through':'user_has_fax_interactions'});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x5a')],{'as':_0x4b2d('0x129'),'through':_0x4b2d('0x13c')});db[_0x4b2d('0x12')]['belongsToMany'](db[_0x4b2d('0x127')],{'as':_0x4b2d('0x128'),'through':_0x4b2d('0x13d')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db['WhatsappInteraction'],{'as':_0x4b2d('0x12c'),'through':_0x4b2d('0x13e')});db[_0x4b2d('0x12')]['belongsToMany'](db['VoiceQueue'],{'as':_0x4b2d('0x13f'),'through':_0x4b2d('0x140'),'required':![]});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x103')],{'as':_0x4b2d('0x141'),'through':_0x4b2d('0x11b'),'required':![]});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x3e')],{'as':_0x4b2d('0x142'),'through':_0x4b2d('0x31'),'required':![]});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x71')],{'as':'ChatQueues','through':_0x4b2d('0x30'),'required':![],'hooks':!![]});db[_0x4b2d('0x12')]['belongsToMany'](db[_0x4b2d('0x54')],{'as':'FaxQueues','through':_0x4b2d('0x33'),'required':![]});db[_0x4b2d('0x12')]['belongsToMany'](db[_0x4b2d('0x5e')],{'as':_0x4b2d('0x143'),'through':_0x4b2d('0x35'),'required':![]});db['User']['belongsToMany'](db[_0x4b2d('0x66')],{'as':_0x4b2d('0x144'),'through':_0x4b2d('0x37'),'required':![]});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x145')],{'as':_0x4b2d('0x146'),'through':_0x4b2d('0x147'),'required':![]});db['User'][_0x4b2d('0x133')](db['CmList'],{'through':_0x4b2d('0x136')});db['User'][_0x4b2d('0x133')](db[_0x4b2d('0x148')],{'as':_0x4b2d('0x149'),'through':_0x4b2d('0x14a')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x4d')],{'as':_0x4b2d('0x14b'),'through':_0x4b2d('0x14c')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x3c')],{'as':_0x4b2d('0x14d'),'through':_0x4b2d('0x14e')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x60')],{'as':'OpenchannelAccounts','through':_0x4b2d('0x14f')});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x57')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x4b2d('0x12')][_0x4b2d('0x133')](db[_0x4b2d('0x10d')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x4b2d('0x150')][_0x4b2d('0x121')](db[_0x4b2d('0x17')],{'as':_0x4b2d('0x151'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x152')});db[_0x4b2d('0x153')][_0x4b2d('0x121')](db[_0x4b2d('0x17')],{'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x17')][_0x4b2d('0x121')](db[_0x4b2d('0x17')],{'as':_0x4b2d('0x154'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x18')][_0x4b2d('0x133')](db[_0x4b2d('0x155')],{'as':_0x4b2d('0x156'),'through':_0x4b2d('0x157')});db[_0x4b2d('0x1a')][_0x4b2d('0x121')](db['UserVoiceQueueRt'],{'as':_0x4b2d('0x158'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':_0x4b2d('0x12e'),'foreignKey':'VoiceQueueId'});db[_0x4b2d('0x1a')][_0x4b2d('0x121')](db[_0x4b2d('0x159')],{'as':_0x4b2d('0x124'),'foreignKey':_0x4b2d('0x15a')});db[_0x4b2d('0x1a')][_0x4b2d('0x121')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x4b2d('0x15a')});db['VoiceQueue'][_0x4b2d('0x121')](db['ReportAgentPreview'],{'as':_0x4b2d('0x7f'),'foreignKey':_0x4b2d('0x15a')});db[_0x4b2d('0x1a')][_0x4b2d('0x121')](db['CmHopperBlack'],{'as':_0x4b2d('0x15b'),'foreignKey':_0x4b2d('0x15a')});db[_0x4b2d('0x1a')]['hasMany'](db['JscriptySessionReport'],{'as':_0x4b2d('0x15c'),'foreignKey':_0x4b2d('0x15a')});db['VoiceQueue']['belongsTo'](db[_0x4b2d('0x2c')],{'as':_0x4b2d('0x2c'),'foreignKey':_0x4b2d('0x15d')});db['VoiceQueue'][_0x4b2d('0x15e')](db[_0x4b2d('0x2c')],{'as':_0x4b2d('0x15f'),'foreignKey':'TrunkBackupId'});db[_0x4b2d('0x1a')]['belongsTo'](db[_0x4b2d('0x8a')],{'as':'Interval','foreignKey':_0x4b2d('0x160')});db[_0x4b2d('0x1a')][_0x4b2d('0x15e')](db[_0x4b2d('0x8c')],{'as':_0x4b2d('0x161'),'foreignKey':_0x4b2d('0x162')});db[_0x4b2d('0x1a')][_0x4b2d('0x133')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x135'),'through':_0x4b2d('0x163')});db[_0x4b2d('0x1a')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x4b2d('0x140')});db[_0x4b2d('0x1a')]['belongsToMany'](db[_0x4b2d('0xef')],{'as':_0x4b2d('0x164'),'through':_0x4b2d('0x117')});db['VoiceQueue'][_0x4b2d('0x133')](db[_0x4b2d('0x101')],{'as':'BlackLists','through':_0x4b2d('0x165')});db[_0x4b2d('0x1c')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x12'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x1e')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x12'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x20')][_0x4b2d('0x121')](db[_0x4b2d('0x166')],{'as':_0x4b2d('0x167'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x168'),'sourceKey':_0x4b2d('0x169')});db[_0x4b2d('0x166')]['belongsTo'](db[_0x4b2d('0x20')],{'foreignKey':_0x4b2d('0x168'),'targetKey':_0x4b2d('0x169')});db[_0x4b2d('0x23')]['hasMany'](db[_0x4b2d('0x28')],{'as':_0x4b2d('0x16a'),'foreignKey':_0x4b2d('0x16b'),'constraints':![]});db[_0x4b2d('0x23')][_0x4b2d('0x121')](db[_0x4b2d('0x26')],{'as':_0x4b2d('0x16c'),'foreignKey':_0x4b2d('0x16b'),'constraints':![]});db[_0x4b2d('0x23')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x12'),'foreignKey':'UserId'});db[_0x4b2d('0x23')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':'ContactId'});db['MailServerIn'][_0x4b2d('0x15e')](db['MailAccount'],{'as':_0x4b2d('0x3c'),'foreignKey':_0x4b2d('0x16e')});db['MailServerIn'][_0x4b2d('0x15e')](db[_0x4b2d('0x115')],{'as':_0x4b2d('0x115'),'foreignKey':'CloudProviderId','onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x3a')]['belongsTo'](db[_0x4b2d('0x3c')],{'as':_0x4b2d('0x3c'),'foreignKey':_0x4b2d('0x16e')});db[_0x4b2d('0x3a')][_0x4b2d('0x15e')](db[_0x4b2d('0x115')],{'as':_0x4b2d('0x115'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x4b2d('0x3c')]['hasOne'](db[_0x4b2d('0x39')],{'as':_0x4b2d('0x170'),'onDelete':'cascade'});db[_0x4b2d('0x3c')][_0x4b2d('0x11d')](db[_0x4b2d('0x3a')],{'as':_0x4b2d('0x171'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x3c')]['hasMany'](db[_0x4b2d('0x87')],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x16e'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x3c')][_0x4b2d('0x121')](db[_0x4b2d('0x173')],{'as':_0x4b2d('0x174'),'foreignKey':_0x4b2d('0x16e')});db['MailAccount'][_0x4b2d('0x121')](db['MailMessage'],{'as':_0x4b2d('0x167'),'foreignKey':'MailAccountId'});db[_0x4b2d('0x3c')][_0x4b2d('0x121')](db[_0x4b2d('0x42')],{'as':_0x4b2d('0x175')});db[_0x4b2d('0x3c')][_0x4b2d('0x121')](db[_0x4b2d('0x46')],{'as':'Applications','foreignKey':_0x4b2d('0x16e'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x3c')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177')});db['MailAccount'][_0x4b2d('0x15e')](db[_0x4b2d('0x9a')],{'as':_0x4b2d('0x9a'),'foreignKey':_0x4b2d('0x178')});db[_0x4b2d('0x3c')][_0x4b2d('0x15e')](db[_0x4b2d('0x8c')],{'as':_0x4b2d('0x161'),'foreignKey':_0x4b2d('0x162')});db[_0x4b2d('0x3c')]['belongsToMany'](db[_0x4b2d('0x12')],{'as':'Agents','through':_0x4b2d('0x14e')});db[_0x4b2d('0x3e')][_0x4b2d('0x133')](db['User'],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x31')});db[_0x4b2d('0x3e')][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':_0x4b2d('0x17a'),'as':_0x4b2d('0x164')});db[_0x4b2d('0x42')][_0x4b2d('0x121')](db[_0x4b2d('0x44')],{'as':_0x4b2d('0x167'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'MailInteractionId'});db[_0x4b2d('0x42')][_0x4b2d('0x15e')](db[_0x4b2d('0x3c')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x16e')});db[_0x4b2d('0x42')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x17c')});db['MailInteraction'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0x4b2d('0x42')][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x17d'),'as':_0x4b2d('0x17e')});db['MailInteraction'][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x17d'),'as':_0x4b2d('0x17f')});db[_0x4b2d('0x42')][_0x4b2d('0x133')](db['User'],{'as':_0x4b2d('0x180'),'through':_0x4b2d('0x138'),'foreignKey':_0x4b2d('0x181')});db[_0x4b2d('0x44')][_0x4b2d('0x121')](db[_0x4b2d('0x182')],{'as':_0x4b2d('0x183'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x44')][_0x4b2d('0x15e')](db['User'],{'as':_0x4b2d('0x12')});db[_0x4b2d('0x44')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'onDelete':_0x4b2d('0x11e'),'as':_0x4b2d('0x16d')});db[_0x4b2d('0x44')][_0x4b2d('0x15e')](db[_0x4b2d('0x42')],{'as':_0x4b2d('0x184'),'foreignKey':'MailInteractionId'});db[_0x4b2d('0x44')][_0x4b2d('0x15e')](db[_0x4b2d('0x3c')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x16e')});db[_0x4b2d('0x44')]['belongsTo'](db[_0x4b2d('0x148')],{'as':_0x4b2d('0x148'),'foreignKey':_0x4b2d('0x185')});db[_0x4b2d('0x44')][_0x4b2d('0x15e')](db['ChatOfflineMessage'],{'as':_0x4b2d('0x70'),'foreignKey':_0x4b2d('0x186')});db[_0x4b2d('0x46')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':'restrict'});db[_0x4b2d('0x46')]['belongsTo'](db['MailQueue'],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x46')]['belongsTo'](db[_0x4b2d('0x3c')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x46')][_0x4b2d('0x15e')](db[_0x4b2d('0x8a')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':'IntervalId'});db['MailApplication'][_0x4b2d('0x15e')](db[_0x4b2d('0x93')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':_0x4b2d('0x187')});db[_0x4b2d('0x48')][_0x4b2d('0x15e')](db[_0x4b2d('0x3c')],{});db['MailQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177')});db['MailQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x48')][_0x4b2d('0x15e')](db[_0x4b2d('0x42')],{});db[_0x4b2d('0x48')][_0x4b2d('0x15e')](db[_0x4b2d('0x44')],{});db['MailQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{});db[_0x4b2d('0x48')][_0x4b2d('0x15e')](db['MailQueue'],{});db[_0x4b2d('0x188')][_0x4b2d('0x121')](db['DashboardItem'],{'as':_0x4b2d('0x189'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x4d')][_0x4b2d('0x121')](db[_0x4b2d('0x87')],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x18a'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0x4b2d('0x173')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x4b2d('0x4d')]['hasMany'](db[_0x4b2d('0x51')],{'as':_0x4b2d('0x175')});db['FaxAccount']['hasMany'](db['FaxApplication'],{'as':_0x4b2d('0x154'),'foreignKey':_0x4b2d('0x18a'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x4d')][_0x4b2d('0x121')](db[_0x4b2d('0x17')],{'as':_0x4b2d('0x18b'),'onDelete':_0x4b2d('0x11e')});db['FaxAccount'][_0x4b2d('0x121')](db[_0x4b2d('0x52')],{'as':_0x4b2d('0x167')});db['FaxAccount'][_0x4b2d('0x15e')](db[_0x4b2d('0x2c')],{'as':'Trunk'});db[_0x4b2d('0x4d')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':'ListId'});db[_0x4b2d('0x4d')]['belongsTo'](db[_0x4b2d('0x8c')],{'as':_0x4b2d('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4b2d('0x4d')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x14c')});db[_0x4b2d('0x4f')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':_0x4b2d('0x16f')});db['FaxApplication'][_0x4b2d('0x15e')](db[_0x4b2d('0x54')],{'onDelete':_0x4b2d('0x16f')});db['FaxApplication'][_0x4b2d('0x15e')](db[_0x4b2d('0x4d')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x4f')][_0x4b2d('0x15e')](db[_0x4b2d('0x93')],{'onDelete':'restrict','foreignKey':_0x4b2d('0x187')});db['FaxInteraction'][_0x4b2d('0x121')](db[_0x4b2d('0x52')],{'as':_0x4b2d('0x167'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x4b2d('0x15e')](db[_0x4b2d('0x4d')],{'as':'Account','foreignKey':_0x4b2d('0x18a')});db[_0x4b2d('0x51')]['belongsTo'](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c')});db['FaxInteraction'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x18c'),'foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x51')]['belongsToMany'](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x18d'),'as':_0x4b2d('0x17e')});db[_0x4b2d('0x51')][_0x4b2d('0x133')](db['Tag'],{'through':_0x4b2d('0x18d'),'as':_0x4b2d('0x17f')});db[_0x4b2d('0x51')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'through':_0x4b2d('0x18e'),'foreignKey':'FaxInteractionId'});db[_0x4b2d('0x52')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':_0x4b2d('0x11e'),'as':'User'});db[_0x4b2d('0x52')]['belongsTo'](db[_0x4b2d('0x51')],{'as':_0x4b2d('0x184'),'foreignKey':_0x4b2d('0x18f')});db[_0x4b2d('0x52')][_0x4b2d('0x15e')](db['CmContact'],{'onDelete':_0x4b2d('0x11e'),'as':_0x4b2d('0x16d')});db[_0x4b2d('0x52')][_0x4b2d('0x15e')](db[_0x4b2d('0x182')],{'as':_0x4b2d('0x182'),'foreignKey':_0x4b2d('0x190')});db[_0x4b2d('0x52')][_0x4b2d('0x15e')](db[_0x4b2d('0x4d')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x18a')});db[_0x4b2d('0x54')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x179'),'through':'UserFaxQueue'});db[_0x4b2d('0x54')]['belongsToMany'](db[_0x4b2d('0xef')],{'through':_0x4b2d('0x191'),'as':'Teams'});db[_0x4b2d('0x56')][_0x4b2d('0x15e')](db[_0x4b2d('0x4d')],{});db['FaxQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':'ListId'});db[_0x4b2d('0x56')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x56')]['belongsTo'](db[_0x4b2d('0x51')],{});db[_0x4b2d('0x56')][_0x4b2d('0x15e')](db[_0x4b2d('0x52')],{});db[_0x4b2d('0x56')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{});db[_0x4b2d('0x56')][_0x4b2d('0x15e')](db[_0x4b2d('0x54')],{});db[_0x4b2d('0x57')][_0x4b2d('0x121')](db[_0x4b2d('0x87')],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x192'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x57')][_0x4b2d('0x121')](db[_0x4b2d('0x173')],{'as':'Answers','foreignKey':_0x4b2d('0x192')});db[_0x4b2d('0x57')][_0x4b2d('0x121')](db[_0x4b2d('0x5c')],{'as':'Messages','foreignKey':_0x4b2d('0x192')});db[_0x4b2d('0x57')][_0x4b2d('0x121')](db[_0x4b2d('0x5a')],{'as':_0x4b2d('0x175')});db[_0x4b2d('0x57')]['hasMany'](db[_0x4b2d('0x59')],{'as':'Applications','foreignKey':_0x4b2d('0x192'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x57')][_0x4b2d('0x15e')](db['CmList'],{'as':'List','foreignKey':_0x4b2d('0x177')});db[_0x4b2d('0x57')][_0x4b2d('0x15e')](db[_0x4b2d('0x8c')],{'as':_0x4b2d('0x161'),'foreignKey':_0x4b2d('0x162')});db[_0x4b2d('0x57')]['belongsToMany'](db['User'],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x193')});db['SmsApplication'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x59')][_0x4b2d('0x15e')](db[_0x4b2d('0x5e')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x59')][_0x4b2d('0x15e')](db[_0x4b2d('0x57')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x59')][_0x4b2d('0x15e')](db[_0x4b2d('0x8a')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':_0x4b2d('0x160')});db[_0x4b2d('0x59')][_0x4b2d('0x15e')](db[_0x4b2d('0x93')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':_0x4b2d('0x187')});db[_0x4b2d('0x5a')][_0x4b2d('0x121')](db[_0x4b2d('0x5c')],{'as':'Messages','onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x194')});db[_0x4b2d('0x5a')][_0x4b2d('0x15e')](db[_0x4b2d('0x57')],{'as':_0x4b2d('0x17b'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x5a')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':'Owner','foreignKey':_0x4b2d('0x11f')});db[_0x4b2d('0x5a')][_0x4b2d('0x133')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x4b2d('0x17e')});db[_0x4b2d('0x5a')][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x195'),'as':_0x4b2d('0x17f')});db[_0x4b2d('0x5a')]['belongsToMany'](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'through':_0x4b2d('0x13c'),'foreignKey':_0x4b2d('0x194')});db['SmsMessage']['belongsTo'](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x12')});db[_0x4b2d('0x5c')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x4b2d('0x16d')});db[_0x4b2d('0x5c')]['belongsTo'](db[_0x4b2d('0x5a')],{'onDelete':_0x4b2d('0x11e'),'as':'Interaction','foreignKey':_0x4b2d('0x194')});db[_0x4b2d('0x5c')][_0x4b2d('0x15e')](db[_0x4b2d('0x57')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x192')});db['SmsQueue'][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':'Agents','through':_0x4b2d('0x35'),'foreignKey':_0x4b2d('0x196')});db['SmsQueue'][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':'team_has_sms_queues','as':_0x4b2d('0x164')});db['OpenchannelAccount'][_0x4b2d('0x121')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x4b2d('0x197'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x60')]['hasMany'](db[_0x4b2d('0x173')],{'as':_0x4b2d('0x174'),'foreignKey':_0x4b2d('0x197')});db[_0x4b2d('0x60')]['hasMany'](db[_0x4b2d('0x127')],{'as':'Interactions','foreignKey':_0x4b2d('0x197')});db[_0x4b2d('0x60')][_0x4b2d('0x121')](db['OpenchannelMessage'],{'as':_0x4b2d('0x167'),'foreignKey':_0x4b2d('0x197')});db[_0x4b2d('0x60')][_0x4b2d('0x121')](db['OpenchannelApplication'],{'as':_0x4b2d('0x154'),'foreignKey':_0x4b2d('0x197'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x60')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177')});db[_0x4b2d('0x60')]['belongsTo'](db[_0x4b2d('0x8c')],{'as':_0x4b2d('0x161'),'foreignKey':_0x4b2d('0x162')});db['OpenchannelAccount'][_0x4b2d('0x133')](db['User'],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x14f')});db['OpenchannelApplication']['belongsTo'](db[_0x4b2d('0x12')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x198')][_0x4b2d('0x15e')](db[_0x4b2d('0x66')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':'OpenchannelQueueId'});db[_0x4b2d('0x198')][_0x4b2d('0x15e')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x4b2d('0x197')});db[_0x4b2d('0x198')]['belongsTo'](db[_0x4b2d('0x8a')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':'IntervalId'});db[_0x4b2d('0x198')]['belongsTo'](db[_0x4b2d('0x93')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':_0x4b2d('0x187')});db['OpenchannelInteraction']['hasMany'](db['OpenchannelMessage'],{'as':_0x4b2d('0x167'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x199')});db['OpenchannelInteraction'][_0x4b2d('0x15e')](db[_0x4b2d('0x60')],{'as':'Account','foreignKey':_0x4b2d('0x197')});db[_0x4b2d('0x127')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x127')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x18c'),'foreignKey':'UserId'});db[_0x4b2d('0x127')][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db['OpenchannelInteraction'][_0x4b2d('0x133')](db['Tag'],{'through':_0x4b2d('0x19a'),'as':_0x4b2d('0x17f')});db[_0x4b2d('0x127')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'through':_0x4b2d('0x13d'),'foreignKey':_0x4b2d('0x199')});db[_0x4b2d('0x64')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':'cascade','as':_0x4b2d('0x12')});db[_0x4b2d('0x64')]['belongsTo'](db[_0x4b2d('0x78')],{'onDelete':_0x4b2d('0x11e'),'as':_0x4b2d('0x16d')});db[_0x4b2d('0x64')][_0x4b2d('0x15e')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x4b2d('0x184'),'foreignKey':_0x4b2d('0x199')});db['OpenchannelMessage'][_0x4b2d('0x15e')](db[_0x4b2d('0x182')],{'as':'Attachment','foreignKey':_0x4b2d('0x190')});db[_0x4b2d('0x64')][_0x4b2d('0x15e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x4b2d('0x197')});db[_0x4b2d('0x66')]['belongsToMany'](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x37'),'foreignKey':_0x4b2d('0x19b')});db[_0x4b2d('0x66')][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':_0x4b2d('0x19c'),'as':_0x4b2d('0x164')});db[_0x4b2d('0x148')]['hasMany'](db[_0x4b2d('0x87')],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x185'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x148')][_0x4b2d('0x121')](db[_0x4b2d('0x173')],{'as':_0x4b2d('0x174'),'foreignKey':_0x4b2d('0x185')});db[_0x4b2d('0x148')][_0x4b2d('0x121')](db[_0x4b2d('0x75')],{'as':_0x4b2d('0x19d')});db[_0x4b2d('0x148')][_0x4b2d('0x121')](db[_0x4b2d('0x6d')],{'as':_0x4b2d('0x175')});db[_0x4b2d('0x148')][_0x4b2d('0x121')](db[_0x4b2d('0x6b')],{'as':_0x4b2d('0x154'),'foreignKey':_0x4b2d('0x185'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x148')][_0x4b2d('0x121')](db[_0x4b2d('0x6e')],{'as':_0x4b2d('0x167')});db[_0x4b2d('0x148')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177')});db[_0x4b2d('0x148')][_0x4b2d('0x15e')](db[_0x4b2d('0x8a')],{'as':_0x4b2d('0x8a'),'foreignKey':'IntervalId'});db[_0x4b2d('0x148')][_0x4b2d('0x15e')](db['MailAccount'],{'as':_0x4b2d('0x3c'),'foreignKey':_0x4b2d('0x16e')});db[_0x4b2d('0x148')][_0x4b2d('0x15e')](db[_0x4b2d('0x8c')],{'as':_0x4b2d('0x161'),'foreignKey':_0x4b2d('0x162')});db['ChatWebsite'][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x14a')});db['OpenchannelQueueReport'][_0x4b2d('0x15e')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177')});db[_0x4b2d('0x69')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x69')][_0x4b2d('0x15e')](db[_0x4b2d('0x127')],{});db[_0x4b2d('0x69')][_0x4b2d('0x15e')](db['OpenchannelMessage'],{});db[_0x4b2d('0x69')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{});db[_0x4b2d('0x69')]['belongsTo'](db[_0x4b2d('0x66')],{});db[_0x4b2d('0x6b')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x19e'),'foreignKey':_0x4b2d('0x11f'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x6b')]['belongsTo'](db['ChatQueue'],{'as':_0x4b2d('0x19f'),'foreignKey':_0x4b2d('0x1a0'),'onDelete':_0x4b2d('0x16f')});db['ChatApplication'][_0x4b2d('0x15e')](db[_0x4b2d('0x148')],{'as':_0x4b2d('0x1a1'),'foreignKey':_0x4b2d('0x185'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x6b')][_0x4b2d('0x15e')](db[_0x4b2d('0x93')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':'TagId'});db[_0x4b2d('0x6d')]['hasMany'](db[_0x4b2d('0x6e')],{'as':_0x4b2d('0x167'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'ChatInteractionId'});db[_0x4b2d('0x6d')][_0x4b2d('0x15e')](db[_0x4b2d('0x148')],{'as':_0x4b2d('0x17b'),'foreignKey':'ChatWebsiteId'});db[_0x4b2d('0x6d')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x6d')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x18c'),'foreignKey':'UserId'});db[_0x4b2d('0x6d')][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':'chat_interaction_has_tags','as':'Tags'});db['ChatInteraction'][_0x4b2d('0x133')](db['Tag'],{'through':_0x4b2d('0x1a2'),'as':_0x4b2d('0x17f')});db[_0x4b2d('0x6d')]['belongsToMany'](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'through':'user_has_chat_interactions','foreignKey':_0x4b2d('0x1a3')});db[_0x4b2d('0x6e')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':'cascade','as':_0x4b2d('0x12')});db['ChatMessage'][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'onDelete':_0x4b2d('0x11e'),'as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x6e')][_0x4b2d('0x15e')](db[_0x4b2d('0x6d')],{'onDelete':_0x4b2d('0x11e'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x4b2d('0x6e')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x4b2d('0x6e')][_0x4b2d('0x15e')](db['ChatWebsite'],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x185')});db[_0x4b2d('0x70')]['hasMany'](db[_0x4b2d('0x182')],{'as':_0x4b2d('0x183'),'foreignKey':_0x4b2d('0x186'),'onDelete':'cascade','hooks':!![]});db[_0x4b2d('0x70')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x70')]['belongsTo'](db[_0x4b2d('0x148')],{'as':_0x4b2d('0x17b'),'foreignKey':'ChatWebsiteId'});db[_0x4b2d('0x71')][_0x4b2d('0x133')](db['User'],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x30'),'hooks':!![]});db[_0x4b2d('0x71')][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':'team_has_chat_queues','as':_0x4b2d('0x164')});db['ChatGroup'][_0x4b2d('0x121')](db[_0x4b2d('0xda')],{'as':_0x4b2d('0x167'),'foreignKey':_0x4b2d('0x1a4'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x73')][_0x4b2d('0x133')](db['User'],{'as':_0x4b2d('0x158'),'through':'chat_group_has_users'});db[_0x4b2d('0x75')][_0x4b2d('0x15e')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x4b2d('0x1a5')][_0x4b2d('0x121')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x134'),'foreignKey':_0x4b2d('0x1a6')});db[_0x4b2d('0x78')][_0x4b2d('0x121')](db[_0x4b2d('0x1a7')],{'as':_0x4b2d('0x1a8'),'foreignKey':'CmContactId'});db[_0x4b2d('0x78')][_0x4b2d('0x121')](db[_0x4b2d('0x7a')],{'as':_0x4b2d('0x12e'),'foreignKey':_0x4b2d('0x17c')});db['CmContact']['hasMany'](db[_0x4b2d('0x159')],{'as':_0x4b2d('0x124'),'foreignKey':'ContactId'});db['CmContact'][_0x4b2d('0x121')](db['CmHopperHistory'],{'as':_0x4b2d('0x1a9'),'foreignKey':'ContactId'});db[_0x4b2d('0x78')]['hasMany'](db[_0x4b2d('0x7f')],{'as':'ReportAgentPreview','foreignKey':_0x4b2d('0x17c')});db['CmContact'][_0x4b2d('0x121')](db['JscriptySessionReport'],{'as':_0x4b2d('0x15c'),'foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x78')][_0x4b2d('0x121')](db[_0x4b2d('0x127')],{'as':_0x4b2d('0x128'),'foreignKey':_0x4b2d('0x17c'),'onDelete':_0x4b2d('0x16f')});db['CmContact'][_0x4b2d('0x121')](db[_0x4b2d('0x6d')],{'as':_0x4b2d('0x139'),'foreignKey':_0x4b2d('0x17c'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x78')][_0x4b2d('0x121')](db[_0x4b2d('0x5a')],{'as':_0x4b2d('0x129'),'foreignKey':_0x4b2d('0x17c'),'onDelete':'restrict'});db[_0x4b2d('0x78')][_0x4b2d('0x121')](db[_0x4b2d('0x51')],{'as':_0x4b2d('0x13b'),'foreignKey':'ContactId','onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x78')][_0x4b2d('0x121')](db[_0x4b2d('0x42')],{'as':'MailInteractions','foreignKey':_0x4b2d('0x17c'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x78')][_0x4b2d('0x15e')](db[_0x4b2d('0x1a5')],{'as':'Company','foreignKey':'CompanyId'});db[_0x4b2d('0x78')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':'List','foreignKey':_0x4b2d('0x177'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x78')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'through':_0x4b2d('0x1aa')});db[_0x4b2d('0x78')][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x4b2d('0x78')]['belongsToMany'](db[_0x4b2d('0x93')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x4b2d('0x1ab'),'foreignKey':_0x4b2d('0x1ac')});db['CmHopper'][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x17c'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x7a')]['belongsTo'](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x7a')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x19e'),'foreignKey':'UserId'});db[_0x4b2d('0x7a')][_0x4b2d('0x15e')](db['VoiceQueue'],{'as':_0x4b2d('0x19f'),'foreignKey':_0x4b2d('0x15a'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x7a')][_0x4b2d('0x15e')](db[_0x4b2d('0xf3')],{'as':_0x4b2d('0xf3'),'foreignKey':_0x4b2d('0x1ad'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x7a')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x18c'),'foreignKey':_0x4b2d('0x1ae')});db[_0x4b2d('0x7c')]['belongsTo'](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c'),'onDelete':'cascade'});db[_0x4b2d('0x7c')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0x4b2d('0x7c')][_0x4b2d('0x15e')](db['VoiceQueue'],{'as':_0x4b2d('0x19f'),'foreignKey':_0x4b2d('0x15a'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x7c')][_0x4b2d('0x15e')](db['Campaign'],{'as':'Campaign','foreignKey':_0x4b2d('0x1ad'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x84')][_0x4b2d('0x121')](db[_0x4b2d('0x88')],{'as':{'plural':'All','singular':_0x4b2d('0x1af')},'foreignKey':_0x4b2d('0x1b0'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db[_0x4b2d('0x84')][_0x4b2d('0x121')](db[_0x4b2d('0x88')],{'as':{'plural':'Any','singular':_0x4b2d('0x1b1')},'foreignKey':_0x4b2d('0x1b2'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db[_0x4b2d('0x84')][_0x4b2d('0x121')](db[_0x4b2d('0x82')],{'as':_0x4b2d('0x1b3'),'foreignKey':_0x4b2d('0x1b4'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db['Disposition'][_0x4b2d('0x121')](db['Disposition'],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x1b5'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x8a')][_0x4b2d('0x121')](db[_0x4b2d('0x8a')],{'as':_0x4b2d('0x1b6'),'foreignKey':_0x4b2d('0x160'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x4b2d('0x8a')][_0x4b2d('0x121')](db[_0x4b2d('0x17')],{'as':'Extensions','foreignKey':_0x4b2d('0x160'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x8a')][_0x4b2d('0x121')](db[_0x4b2d('0x46')],{'as':_0x4b2d('0x1b7'),'foreignKey':_0x4b2d('0x160')});db[_0x4b2d('0x8a')][_0x4b2d('0x121')](db[_0x4b2d('0x6b')],{'as':_0x4b2d('0x1b8'),'foreignKey':_0x4b2d('0x160')});db['Interval'][_0x4b2d('0x121')](db['FaxApplication'],{'as':_0x4b2d('0x1b9'),'foreignKey':_0x4b2d('0x160')});db[_0x4b2d('0x8a')]['hasMany'](db[_0x4b2d('0x59')],{'as':_0x4b2d('0x1ba'),'foreignKey':_0x4b2d('0x160')});db[_0x4b2d('0x90')]['belongsTo'](db['MailAccount'],{});db['Schedule'][_0x4b2d('0x15e')](db[_0x4b2d('0xa3')],{'foreignKey':_0x4b2d('0x1bb')});db['Schedule'][_0x4b2d('0x15e')](db[_0x4b2d('0x1bc')],{'foreignKey':_0x4b2d('0x1bd')});db[_0x4b2d('0x155')][_0x4b2d('0x133')](db[_0x4b2d('0x18')],{'as':_0x4b2d('0x1be'),'through':_0x4b2d('0x157'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x93')][_0x4b2d('0x133')](db[_0x4b2d('0x78')],{'through':'cm_contact_has_tags'});db[_0x4b2d('0x93')][_0x4b2d('0x133')](db['ChatInteraction'],{'through':_0x4b2d('0x1a2')});db[_0x4b2d('0x93')]['belongsToMany'](db[_0x4b2d('0x42')],{'through':_0x4b2d('0x17d')});db[_0x4b2d('0x93')][_0x4b2d('0x133')](db[_0x4b2d('0x5a')],{'through':_0x4b2d('0x195')});db[_0x4b2d('0x93')][_0x4b2d('0x133')](db[_0x4b2d('0x51')],{'through':_0x4b2d('0x18d')});db[_0x4b2d('0x93')]['belongsToMany'](db[_0x4b2d('0x127')],{'through':_0x4b2d('0x19a')});db[_0x4b2d('0x93')][_0x4b2d('0x133')](db[_0x4b2d('0x12b')],{'through':_0x4b2d('0x1bf')});db[_0x4b2d('0x1a7')]['belongsTo'](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x4b2d('0x1c0')});db[_0x4b2d('0x98')][_0x4b2d('0x15e')](db[_0x4b2d('0x7a')],{'as':_0x4b2d('0x1c1'),'foreignKey':_0x4b2d('0x1ac')});db['CmContactHasItem'][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x1c2')});db[_0x4b2d('0x9c')][_0x4b2d('0x121')](db[_0x4b2d('0x88')],{'as':{'plural':_0x4b2d('0x1c3'),'singular':_0x4b2d('0x1c4')},'foreignKey':_0x4b2d('0x1c5'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db['Trigger'][_0x4b2d('0x121')](db[_0x4b2d('0x88')],{'as':{'plural':_0x4b2d('0x1c6'),'singular':_0x4b2d('0x1c7')},'foreignKey':_0x4b2d('0x1c8'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db[_0x4b2d('0x9c')][_0x4b2d('0x121')](db[_0x4b2d('0x82')],{'as':_0x4b2d('0x1b3'),'foreignKey':_0x4b2d('0x1c9'),'onDelete':_0x4b2d('0x11e'),'hooks':!![]});db['AnalyticCustomReport'][_0x4b2d('0x121')](db[_0x4b2d('0x1ca')],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1bd'),'hooks':!![]});db[_0x4b2d('0xa3')]['hasMany'](db[_0x4b2d('0x1ca')],{'as':'Fields','onDelete':_0x4b2d('0x11e'),'foreignKey':'DefaultReportId'});db[_0x4b2d('0xa7')][_0x4b2d('0x121')](db[_0x4b2d('0x1ca')],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1cc')});db[_0x4b2d('0x1ca')][_0x4b2d('0x15e')](db[_0x4b2d('0xa7')],{'foreignKey':_0x4b2d('0x1cc')});db[_0x4b2d('0xab')][_0x4b2d('0x121')](db[_0x4b2d('0x1cd')],{'as':_0x4b2d('0x1ce'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0x1cd')][_0x4b2d('0x121')](db[_0x4b2d('0xad')],{'as':_0x4b2d('0x1d0'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0x1cd')][_0x4b2d('0x121')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x4b2d('0x1cd')][_0x4b2d('0x121')](db['SalesforceField'],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0x1cd')][_0x4b2d('0x15e')](db[_0x4b2d('0xab')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0xad')][_0x4b2d('0x121')](db[_0x4b2d('0xad')],{'as':_0x4b2d('0x1d3'),'foreignKey':'SubjectId'});db[_0x4b2d('0xad')][_0x4b2d('0x121')](db[_0x4b2d('0xad')],{'as':_0x4b2d('0x1d4'),'foreignKey':_0x4b2d('0x1d5')});db['SalesforceField'][_0x4b2d('0x121')](db[_0x4b2d('0xad')],{'as':_0x4b2d('0x1d6'),'foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0xad')][_0x4b2d('0x15e')](db[_0x4b2d('0x1d7')],{'as':_0x4b2d('0x1d7'),'foreignKey':'VariableId'});db[_0x4b2d('0xaf')]['hasMany'](db[_0x4b2d('0xb1')],{'as':'Configurations','onDelete':_0x4b2d('0x11e'),'foreignKey':'AccountId'});db[_0x4b2d('0xb1')]['hasMany'](db[_0x4b2d('0x1d8')],{'as':_0x4b2d('0x1d0'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0xb1')][_0x4b2d('0x121')](db['SugarcrmField'],{'as':_0x4b2d('0x1d9'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'DescriptionId'});db[_0x4b2d('0xb1')][_0x4b2d('0x121')](db['SugarcrmField'],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'FieldId'});db[_0x4b2d('0xb1')][_0x4b2d('0x15e')](db[_0x4b2d('0xaf')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0x1d8')][_0x4b2d('0x121')](db['SugarcrmField'],{'as':_0x4b2d('0x1d3'),'foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0x1d8')]['hasMany'](db[_0x4b2d('0x1d8')],{'as':_0x4b2d('0x1d4'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0x1d8')][_0x4b2d('0x121')](db['SugarcrmField'],{'as':_0x4b2d('0x1d6'),'foreignKey':'FieldId'});db[_0x4b2d('0x1d8')][_0x4b2d('0x15e')](db[_0x4b2d('0x1d7')],{'as':_0x4b2d('0x1d7'),'foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0xb4')][_0x4b2d('0x121')](db[_0x4b2d('0xb6')],{'as':_0x4b2d('0x1ce'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1cf')});db['DeskConfiguration'][_0x4b2d('0x121')](db['DeskField'],{'as':_0x4b2d('0x1d0'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0xb6')][_0x4b2d('0x121')](db[_0x4b2d('0xb7')],{'as':'Descriptions','onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d5')});db['DeskConfiguration'][_0x4b2d('0x121')](db['DeskField'],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d2')});db['DeskConfiguration'][_0x4b2d('0x15e')](db['DeskAccount'],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x1cf')});db['DeskConfiguration']['belongsToMany'](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x1db')});db[_0x4b2d('0xb7')][_0x4b2d('0x121')](db[_0x4b2d('0xb7')],{'as':_0x4b2d('0x1d3'),'foreignKey':_0x4b2d('0x1d1')});db['DeskField'][_0x4b2d('0x121')](db[_0x4b2d('0xb7')],{'as':_0x4b2d('0x1d4'),'foreignKey':'DescriptionId'});db[_0x4b2d('0xb7')][_0x4b2d('0x121')](db[_0x4b2d('0xb7')],{'as':_0x4b2d('0x1d6'),'foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0xb7')]['belongsTo'](db[_0x4b2d('0x1d7')],{'as':_0x4b2d('0x1d7'),'foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0x1dc')]['hasMany'](db['ZohoConfiguration'],{'as':_0x4b2d('0x1ce'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0xba')][_0x4b2d('0x121')](db['ZohoField'],{'as':_0x4b2d('0x1d0'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d1')});db['ZohoConfiguration']['hasMany'](db[_0x4b2d('0xbb')],{'as':_0x4b2d('0x1d9'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'FieldId'});db[_0x4b2d('0xba')][_0x4b2d('0x15e')](db[_0x4b2d('0x1dc')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0xbb')][_0x4b2d('0x121')](db[_0x4b2d('0xbb')],{'as':_0x4b2d('0x1d3'),'foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0xbb')][_0x4b2d('0x121')](db['ZohoField'],{'as':_0x4b2d('0x1d4'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0xbb')][_0x4b2d('0x121')](db['ZohoField'],{'as':_0x4b2d('0x1d6'),'foreignKey':'FieldId'});db[_0x4b2d('0xbb')][_0x4b2d('0x15e')](db[_0x4b2d('0x1d7')],{'as':'Variable','foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0xbd')][_0x4b2d('0x121')](db[_0x4b2d('0x1dd')],{'as':_0x4b2d('0x1ce'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x4b2d('0x121')](db[_0x4b2d('0x1de')],{'as':_0x4b2d('0x1d0'),'foreignKey':_0x4b2d('0x1d1')});db['ZendeskConfiguration'][_0x4b2d('0x121')](db['ZendeskField'],{'as':_0x4b2d('0x1d9'),'foreignKey':_0x4b2d('0x1d5')});db['ZendeskConfiguration']['hasMany'](db[_0x4b2d('0x1de')],{'as':'Fields','foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0x1dd')]['belongsTo'](db[_0x4b2d('0xbd')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x1cf')});db['ZendeskConfiguration'][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x1df')});db[_0x4b2d('0x1de')][_0x4b2d('0x121')](db[_0x4b2d('0x1de')],{'as':_0x4b2d('0x1d3'),'foreignKey':_0x4b2d('0x1d1')});db['ZendeskField'][_0x4b2d('0x121')](db['ZendeskField'],{'as':_0x4b2d('0x1d4'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x4b2d('0x121')](db['ZendeskField'],{'as':'Field','foreignKey':_0x4b2d('0x1d2')});db['ZendeskField'][_0x4b2d('0x15e')](db['Variable'],{'as':_0x4b2d('0x1d7'),'foreignKey':_0x4b2d('0x1da')});db['FreshdeskAccount'][_0x4b2d('0x121')](db[_0x4b2d('0xc2')],{'as':_0x4b2d('0x1ce'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0xc2')][_0x4b2d('0x121')](db[_0x4b2d('0xc4')],{'as':_0x4b2d('0x1d0'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0xc2')][_0x4b2d('0x121')](db['FreshdeskField'],{'as':_0x4b2d('0x1d9'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0xc2')][_0x4b2d('0x121')](db['FreshdeskField'],{'as':_0x4b2d('0x1cb'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0xc2')]['belongsTo'](db[_0x4b2d('0xc0')],{'as':'Account','foreignKey':'AccountId'});db[_0x4b2d('0xc2')][_0x4b2d('0x133')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x4b2d('0xc4')]['hasMany'](db[_0x4b2d('0xc4')],{'as':_0x4b2d('0x1d3'),'foreignKey':_0x4b2d('0x1d1')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x4b2d('0x1d4'),'foreignKey':'DescriptionId'});db[_0x4b2d('0xc4')][_0x4b2d('0x121')](db['FreshdeskField'],{'as':_0x4b2d('0x1d6'),'foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0xc4')]['belongsTo'](db[_0x4b2d('0x1d7')],{'as':'Variable','foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0x1e0')][_0x4b2d('0x121')](db['VtigerConfiguration'],{'as':_0x4b2d('0x1ce'),'onDelete':'cascade','foreignKey':_0x4b2d('0x1cf')});db[_0x4b2d('0x1e1')][_0x4b2d('0x121')](db[_0x4b2d('0xc7')],{'as':_0x4b2d('0x1d0'),'foreignKey':_0x4b2d('0x1d1')});db['VtigerConfiguration'][_0x4b2d('0x121')](db[_0x4b2d('0xc7')],{'as':_0x4b2d('0x1d9'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0x1e1')][_0x4b2d('0x121')](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db['VtigerConfiguration'][_0x4b2d('0x15e')](db[_0x4b2d('0x1e0')],{'as':_0x4b2d('0x17b'),'foreignKey':'AccountId'});db[_0x4b2d('0xc7')][_0x4b2d('0x121')](db[_0x4b2d('0xc7')],{'as':'Subject','foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0xc7')]['hasMany'](db[_0x4b2d('0xc7')],{'as':_0x4b2d('0x1d4'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0xc7')]['hasMany'](db['VtigerField'],{'as':_0x4b2d('0x1d6'),'foreignKey':'FieldId'});db[_0x4b2d('0xc7')]['belongsTo'](db['Variable'],{'as':_0x4b2d('0x1d7'),'foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0xc9')]['hasMany'](db[_0x4b2d('0x1e2')],{'as':_0x4b2d('0x1ce'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'AccountId'});db[_0x4b2d('0x1e2')]['hasMany'](db[_0x4b2d('0xca')],{'as':_0x4b2d('0x1d0'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x4b2d('0x121')](db['ServicenowField'],{'as':_0x4b2d('0x1d9'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0x1e2')][_0x4b2d('0x121')](db['ServicenowField'],{'as':_0x4b2d('0x1cb'),'foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0x1e2')][_0x4b2d('0x15e')](db[_0x4b2d('0xc9')],{'as':_0x4b2d('0x17b'),'foreignKey':'AccountId'});db[_0x4b2d('0xca')][_0x4b2d('0x121')](db[_0x4b2d('0xca')],{'as':_0x4b2d('0x1d3'),'foreignKey':'SubjectId'});db[_0x4b2d('0xca')][_0x4b2d('0x121')](db[_0x4b2d('0xca')],{'as':_0x4b2d('0x1d4'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0xca')][_0x4b2d('0x121')](db[_0x4b2d('0xca')],{'as':_0x4b2d('0x1d6'),'foreignKey':'FieldId'});db[_0x4b2d('0xca')][_0x4b2d('0x15e')](db['Variable'],{'as':_0x4b2d('0x1d7'),'foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0xcc')][_0x4b2d('0x121')](db[_0x4b2d('0xce')],{'as':_0x4b2d('0x1ce'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x4b2d('0xcc')][_0x4b2d('0x15e')](db[_0x4b2d('0x115')],{'as':_0x4b2d('0x115'),'foreignKey':'CloudProviderId'});db[_0x4b2d('0xce')]['hasMany'](db[_0x4b2d('0xd0')],{'as':_0x4b2d('0x1d0'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'SubjectId'});db[_0x4b2d('0xce')][_0x4b2d('0x121')](db[_0x4b2d('0xd0')],{'as':_0x4b2d('0x1d9'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'DescriptionId'});db[_0x4b2d('0xce')]['hasMany'](db[_0x4b2d('0xd0')],{'as':_0x4b2d('0x1cb'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1d2')});db['Dynamics365Configuration'][_0x4b2d('0x15e')](db[_0x4b2d('0xcc')],{'as':_0x4b2d('0x17b'),'foreignKey':'AccountId'});db[_0x4b2d('0xd0')][_0x4b2d('0x121')](db[_0x4b2d('0xd0')],{'as':_0x4b2d('0x1d3'),'foreignKey':'SubjectId'});db[_0x4b2d('0xd0')]['hasMany'](db[_0x4b2d('0xd0')],{'as':_0x4b2d('0x1d4'),'foreignKey':_0x4b2d('0x1d5')});db[_0x4b2d('0xd0')][_0x4b2d('0x121')](db[_0x4b2d('0xd0')],{'as':_0x4b2d('0x1d6'),'foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0xd0')][_0x4b2d('0x15e')](db['Variable'],{'as':'Variable','foreignKey':_0x4b2d('0x1da')});db['FreshsalesAccount'][_0x4b2d('0x121')](db[_0x4b2d('0xd4')],{'as':_0x4b2d('0x1ce'),'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1cf')});db['FreshsalesConfiguration'][_0x4b2d('0x121')](db[_0x4b2d('0xd6')],{'as':_0x4b2d('0x1d0'),'foreignKey':_0x4b2d('0x1d1')});db[_0x4b2d('0xd4')][_0x4b2d('0x121')](db[_0x4b2d('0xd6')],{'as':_0x4b2d('0x1d9'),'foreignKey':'DescriptionId'});db[_0x4b2d('0xd4')]['hasMany'](db[_0x4b2d('0xd6')],{'as':'Fields','foreignKey':_0x4b2d('0x1d2')});db[_0x4b2d('0xd4')]['belongsTo'](db[_0x4b2d('0xd2')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x1cf')});db['FreshsalesField'][_0x4b2d('0x121')](db[_0x4b2d('0xd6')],{'as':'Subject','foreignKey':_0x4b2d('0x1d1')});db['FreshsalesField'][_0x4b2d('0x121')](db[_0x4b2d('0xd6')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x4b2d('0xd6')]['hasMany'](db[_0x4b2d('0xd6')],{'as':_0x4b2d('0x1d6'),'foreignKey':_0x4b2d('0x1d2')});db['FreshsalesField'][_0x4b2d('0x15e')](db['Variable'],{'as':_0x4b2d('0x1d7'),'foreignKey':_0x4b2d('0x1da')});db[_0x4b2d('0xd8')][_0x4b2d('0x15e')](db['ChatWebsite'],{});db[_0x4b2d('0xd8')][_0x4b2d('0x15e')](db['CmList'],{'as':_0x4b2d('0x176'),'foreignKey':_0x4b2d('0x177')});db['ChatQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':_0x4b2d('0x16d'),'foreignKey':'ContactId'});db[_0x4b2d('0xd8')][_0x4b2d('0x15e')](db[_0x4b2d('0x6d')],{});db[_0x4b2d('0xd8')][_0x4b2d('0x15e')](db[_0x4b2d('0x6e')],{});db[_0x4b2d('0xd8')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{});db['ChatQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x71')],{});db[_0x4b2d('0xda')]['belongsTo'](db['User'],{'onDelete':_0x4b2d('0x11e'),'foreignKey':'FromId'});db[_0x4b2d('0xda')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'onDelete':_0x4b2d('0x11e'),'foreignKey':_0x4b2d('0x1e3')});db[_0x4b2d('0xde')][_0x4b2d('0x121')](db[_0x4b2d('0xdc')],{'foreignKey':_0x4b2d('0x1e4'),'onDelete':'cascade'});db[_0x4b2d('0xde')][_0x4b2d('0x121')](db['JscriptyAnswerReport'],{'foreignKey':_0x4b2d('0x1e4'),'onDelete':'cascade'});db[_0x4b2d('0xe0')][_0x4b2d('0x15e')](db[_0x4b2d('0x57')],{});db[_0x4b2d('0xe0')][_0x4b2d('0x15e')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x4b2d('0xe0')][_0x4b2d('0x15e')](db['CmContact'],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x17c')});db['SmsQueueReport']['belongsTo'](db[_0x4b2d('0x5a')],{});db['SmsQueueReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x5c')],{});db[_0x4b2d('0xe0')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{});db[_0x4b2d('0xe0')][_0x4b2d('0x15e')](db[_0x4b2d('0x5e')],{});db[_0x4b2d('0xe5')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x4b2d('0x1e5')});db[_0x4b2d('0xe5')][_0x4b2d('0x121')](db['JscriptyQuestionReport'],{'foreignKey':_0x4b2d('0x1e5')});db[_0x4b2d('0xe5')][_0x4b2d('0x121')](db['JscriptyAnswerReport'],{'foreignKey':_0x4b2d('0x1e5')});db[_0x4b2d('0xef')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':'Agents','through':_0x4b2d('0x137')});db[_0x4b2d('0xef')]['belongsToMany'](db[_0x4b2d('0x1a')],{'through':'TeamVoiceQueue','as':_0x4b2d('0x13f')});db['Team'][_0x4b2d('0x133')](db[_0x4b2d('0x3e')],{'through':'team_has_mail_queues','as':_0x4b2d('0x142')});db[_0x4b2d('0xef')][_0x4b2d('0x133')](db[_0x4b2d('0x71')],{'through':_0x4b2d('0x1e6'),'as':'ChatQueues'});db['Team'][_0x4b2d('0x133')](db[_0x4b2d('0x54')],{'through':_0x4b2d('0x191'),'as':'FaxQueues'});db[_0x4b2d('0xef')][_0x4b2d('0x133')](db[_0x4b2d('0x5e')],{'through':_0x4b2d('0x1e7'),'as':_0x4b2d('0x143')});db[_0x4b2d('0xef')][_0x4b2d('0x133')](db[_0x4b2d('0x66')],{'through':_0x4b2d('0x19c'),'as':'OpenchannelQueues'});db[_0x4b2d('0xef')][_0x4b2d('0x133')](db[_0x4b2d('0x145')],{'through':'team_has_whatsapp_queues','as':_0x4b2d('0x146')});db['Team'][_0x4b2d('0x133')](db[_0x4b2d('0x103')],{'through':_0x4b2d('0x119'),'as':'VoicePrefixes'});db[_0x4b2d('0xf3')][_0x4b2d('0x121')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x4b2d('0x1ad')});db[_0x4b2d('0xf3')]['hasMany'](db[_0x4b2d('0x159')],{'as':_0x4b2d('0x124'),'foreignKey':_0x4b2d('0x1ad')});db[_0x4b2d('0xf3')][_0x4b2d('0x121')](db[_0x4b2d('0x125')],{'as':_0x4b2d('0x1a9'),'foreignKey':_0x4b2d('0x1ad')});db[_0x4b2d('0xf3')][_0x4b2d('0x121')](db[_0x4b2d('0x7c')],{'as':_0x4b2d('0x15b'),'foreignKey':_0x4b2d('0x1ad')});db[_0x4b2d('0xf3')][_0x4b2d('0x15e')](db['Trunk'],{'as':_0x4b2d('0x2c'),'foreignKey':_0x4b2d('0x15d')});db[_0x4b2d('0xf3')][_0x4b2d('0x15e')](db['Trunk'],{'as':_0x4b2d('0x15f'),'foreignKey':_0x4b2d('0x1e8')});db['Campaign'][_0x4b2d('0x15e')](db[_0x4b2d('0x8a')],{'as':_0x4b2d('0x8a'),'foreignKey':_0x4b2d('0x160')});db[_0x4b2d('0xf3')][_0x4b2d('0x15e')](db[_0x4b2d('0xe9')],{'as':'SquareProject','foreignKey':_0x4b2d('0x1e9')});db[_0x4b2d('0xf3')][_0x4b2d('0x133')](db[_0x4b2d('0x101')],{'as':_0x4b2d('0x135'),'through':_0x4b2d('0x1ea')});db[_0x4b2d('0xf3')][_0x4b2d('0x133')](db[_0x4b2d('0x101')],{'as':'BlackLists','through':_0x4b2d('0x1eb')});db[_0x4b2d('0x182')]['belongsTo'](db[_0x4b2d('0x70')],{'as':_0x4b2d('0x70'),'foreignKey':_0x4b2d('0x186')});db[_0x4b2d('0xf9')]['belongsTo'](db[_0x4b2d('0x44')],{});db[_0x4b2d('0xf9')][_0x4b2d('0x15e')](db['MailInteraction'],{});db[_0x4b2d('0xf9')]['belongsTo'](db[_0x4b2d('0x3c')],{'foreignKey':'FromMailAccountId','as':_0x4b2d('0x1ec')});db['MailTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ed'),'as':_0x4b2d('0x1ee')});db[_0x4b2d('0xf9')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ef'),'as':_0x4b2d('0x1f0')});db['MailTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x3e')],{'foreignKey':_0x4b2d('0x1f1'),'as':_0x4b2d('0x1f2')});db['MailTransferReport']['belongsTo'](db[_0x4b2d('0x3c')],{'foreignKey':_0x4b2d('0x1f3'),'as':_0x4b2d('0x1f4')});db[_0x4b2d('0xfb')][_0x4b2d('0x15e')](db[_0x4b2d('0x6e')],{});db[_0x4b2d('0xfb')][_0x4b2d('0x15e')](db[_0x4b2d('0x6d')],{});db[_0x4b2d('0xfb')][_0x4b2d('0x15e')](db[_0x4b2d('0x148')],{'foreignKey':_0x4b2d('0x1f5'),'as':_0x4b2d('0x1ec')});db[_0x4b2d('0xfb')]['belongsTo'](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ed'),'as':_0x4b2d('0x1ee')});db['ChatTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ef'),'as':'ToAgent'});db[_0x4b2d('0xfb')]['belongsTo'](db[_0x4b2d('0x71')],{'foreignKey':_0x4b2d('0x1f6'),'as':_0x4b2d('0x1f2')});db['ChatTransferReport']['belongsTo'](db[_0x4b2d('0x148')],{'foreignKey':'ToChatWebsiteId','as':_0x4b2d('0x1f4')});db[_0x4b2d('0x1f7')][_0x4b2d('0x15e')](db[_0x4b2d('0x52')],{});db['FaxTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x51')],{});db[_0x4b2d('0x1f7')][_0x4b2d('0x15e')](db[_0x4b2d('0x4d')],{'foreignKey':'FromFaxAccountId','as':_0x4b2d('0x1ec')});db[_0x4b2d('0x1f7')]['belongsTo'](db[_0x4b2d('0x12')],{'foreignKey':'FromUserId','as':_0x4b2d('0x1ee')});db['FaxTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ef'),'as':'ToAgent'});db[_0x4b2d('0x1f7')][_0x4b2d('0x15e')](db[_0x4b2d('0x54')],{'foreignKey':_0x4b2d('0x1f8'),'as':_0x4b2d('0x1f2')});db[_0x4b2d('0x1f7')][_0x4b2d('0x15e')](db[_0x4b2d('0x4d')],{'foreignKey':'ToFaxAccountId','as':_0x4b2d('0x1f4')});db[_0x4b2d('0xfd')][_0x4b2d('0x15e')](db[_0x4b2d('0x64')],{});db[_0x4b2d('0xfd')][_0x4b2d('0x15e')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x4b2d('0x15e')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x4b2d('0x1ec')});db['OpenchannelTransferReport'][_0x4b2d('0x15e')](db['User'],{'foreignKey':_0x4b2d('0x1ed'),'as':_0x4b2d('0x1ee')});db[_0x4b2d('0xfd')]['belongsTo'](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ef'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x66')],{'foreignKey':_0x4b2d('0x1f9'),'as':_0x4b2d('0x1f2')});db['OpenchannelTransferReport']['belongsTo'](db[_0x4b2d('0x60')],{'foreignKey':_0x4b2d('0x1fa'),'as':_0x4b2d('0x1f4')});db[_0x4b2d('0xff')][_0x4b2d('0x15e')](db[_0x4b2d('0x5c')],{});db[_0x4b2d('0xff')]['belongsTo'](db[_0x4b2d('0x5a')],{});db[_0x4b2d('0xff')][_0x4b2d('0x15e')](db[_0x4b2d('0x57')],{'foreignKey':'FromSmsAccountId','as':_0x4b2d('0x1ec')});db[_0x4b2d('0xff')]['belongsTo'](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ed'),'as':_0x4b2d('0x1ee')});db[_0x4b2d('0xff')][_0x4b2d('0x15e')](db['User'],{'foreignKey':_0x4b2d('0x1ef'),'as':_0x4b2d('0x1f0')});db[_0x4b2d('0xff')][_0x4b2d('0x15e')](db[_0x4b2d('0x5e')],{'foreignKey':_0x4b2d('0x1fb'),'as':_0x4b2d('0x1f2')});db[_0x4b2d('0xff')][_0x4b2d('0x15e')](db[_0x4b2d('0x57')],{'foreignKey':_0x4b2d('0x1fc'),'as':_0x4b2d('0x1f4')});db[_0x4b2d('0x101')]['hasMany'](db[_0x4b2d('0x87')],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x177'),'onDelete':_0x4b2d('0x11e')});db[_0x4b2d('0x101')][_0x4b2d('0x121')](db[_0x4b2d('0x80')],{'as':_0x4b2d('0x1fd'),'foreignKey':_0x4b2d('0x177')});db[_0x4b2d('0x101')][_0x4b2d('0x121')](db['CmContact'],{'as':_0x4b2d('0x134'),'onDelete':_0x4b2d('0x11e'),'foreignKey':'ListId'});db[_0x4b2d('0x101')][_0x4b2d('0x121')](db[_0x4b2d('0x159')],{'as':_0x4b2d('0x124'),'foreignKey':_0x4b2d('0x177')});db['CmList'][_0x4b2d('0x121')](db[_0x4b2d('0x125')],{'as':_0x4b2d('0x126'),'foreignKey':_0x4b2d('0x177')});db[_0x4b2d('0x101')]['hasMany'](db[_0x4b2d('0x7f')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x4b2d('0x101')][_0x4b2d('0x133')](db[_0x4b2d('0x1a')],{'as':_0x4b2d('0x1fe'),'through':_0x4b2d('0x163')});db[_0x4b2d('0x101')][_0x4b2d('0x133')](db['User'],{'as':_0x4b2d('0x179'),'through':_0x4b2d('0x136')});db[_0x4b2d('0x103')]['hasMany'](db[_0x4b2d('0x17')],{'as':_0x4b2d('0x123'),'onDelete':'cascade'});db[_0x4b2d('0x103')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x4b2d('0x103')][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':'TeamVoicePrefix','as':_0x4b2d('0x164')});db[_0x4b2d('0x105')][_0x4b2d('0x121')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'foreignKey':_0x4b2d('0x130')});db['UserProfile'][_0x4b2d('0x121')](db['UserProfileSection'],{'as':_0x4b2d('0x1ff'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0x4b2d('0x107')][_0x4b2d('0x121')](db[_0x4b2d('0x109')],{'as':'Resources','foreignKey':_0x4b2d('0x200'),'onDelete':'cascade'});db[_0x4b2d('0x10d')][_0x4b2d('0x121')](db[_0x4b2d('0x87')],{'as':_0x4b2d('0x172'),'foreignKey':_0x4b2d('0x201'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0x4b2d('0x173')],{'as':_0x4b2d('0x174'),'foreignKey':_0x4b2d('0x201')});db[_0x4b2d('0x10d')][_0x4b2d('0x121')](db[_0x4b2d('0x111')],{'as':_0x4b2d('0x167'),'foreignKey':'WhatsappAccountId'});db[_0x4b2d('0x10d')]['hasMany'](db[_0x4b2d('0x12b')],{'as':_0x4b2d('0x175')});db[_0x4b2d('0x10d')][_0x4b2d('0x121')](db['WhatsappApplication'],{'as':_0x4b2d('0x154'),'foreignKey':_0x4b2d('0x201'),'onDelete':'cascade'});db[_0x4b2d('0x10d')][_0x4b2d('0x15e')](db[_0x4b2d('0x101')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0x4b2d('0x15e')](db[_0x4b2d('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x4b2d('0x162')});db[_0x4b2d('0x10d')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':'Agents','through':_0x4b2d('0x202')});db[_0x4b2d('0x10f')][_0x4b2d('0x15e')](db['User'],{'onDelete':'restrict'});db[_0x4b2d('0x10f')][_0x4b2d('0x15e')](db[_0x4b2d('0x145')],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x10f')][_0x4b2d('0x15e')](db['WhatsappAccount'],{'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x10f')][_0x4b2d('0x15e')](db['Interval'],{'onDelete':_0x4b2d('0x16f'),'foreignKey':_0x4b2d('0x160')});db['WhatsappApplication']['belongsTo'](db[_0x4b2d('0x93')],{'onDelete':_0x4b2d('0x16f'),'foreignKey':'TagId'});db[_0x4b2d('0x12b')][_0x4b2d('0x121')](db['WhatsappMessage'],{'as':_0x4b2d('0x167'),'onDelete':'cascade','foreignKey':_0x4b2d('0x203')});db[_0x4b2d('0x12b')]['belongsTo'](db[_0x4b2d('0x10d')],{'as':_0x4b2d('0x17b'),'foreignKey':'WhatsappAccountId'});db[_0x4b2d('0x12b')]['belongsTo'](db['CmContact'],{'as':_0x4b2d('0x16d'),'foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x12b')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x18c'),'foreignKey':_0x4b2d('0x11f')});db['WhatsappInteraction'][_0x4b2d('0x133')](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x1bf'),'as':'Tags'});db[_0x4b2d('0x12b')]['belongsToMany'](db[_0x4b2d('0x93')],{'through':_0x4b2d('0x1bf'),'as':_0x4b2d('0x17f')});db[_0x4b2d('0x12b')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x180'),'through':_0x4b2d('0x13e'),'foreignKey':_0x4b2d('0x203')});db['WhatsappMessage']['belongsTo'](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x12')});db[_0x4b2d('0x111')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'onDelete':_0x4b2d('0x11e'),'as':'Contact'});db[_0x4b2d('0x111')][_0x4b2d('0x15e')](db[_0x4b2d('0x12b')],{'onDelete':_0x4b2d('0x11e'),'as':'Interaction','foreignKey':_0x4b2d('0x203')});db[_0x4b2d('0x111')][_0x4b2d('0x15e')](db[_0x4b2d('0x10d')],{'as':_0x4b2d('0x17b'),'foreignKey':_0x4b2d('0x201')});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db[_0x4b2d('0x10d')],{});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db['CmList'],{'as':_0x4b2d('0x176'),'foreignKey':'ListId'});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db[_0x4b2d('0x78')],{'as':'Contact','foreignKey':_0x4b2d('0x17c')});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db[_0x4b2d('0x12b')],{});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db[_0x4b2d('0x145')],{});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db[_0x4b2d('0x111')],{});db[_0x4b2d('0x204')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{});db['WhatsappTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x111')],{});db[_0x4b2d('0x113')]['belongsTo'](db[_0x4b2d('0x12b')],{});db[_0x4b2d('0x113')]['belongsTo'](db[_0x4b2d('0x10d')],{'foreignKey':_0x4b2d('0x205'),'as':_0x4b2d('0x1ec')});db['WhatsappTransferReport']['belongsTo'](db[_0x4b2d('0x10d')],{'foreignKey':'ToWhatsappAccountId','as':_0x4b2d('0x1f4')});db['WhatsappTransferReport'][_0x4b2d('0x15e')](db[_0x4b2d('0x145')],{'foreignKey':_0x4b2d('0x206'),'as':_0x4b2d('0x1f2')});db[_0x4b2d('0x113')][_0x4b2d('0x15e')](db['User'],{'foreignKey':_0x4b2d('0x1ed'),'as':_0x4b2d('0x1ee')});db[_0x4b2d('0x113')][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'foreignKey':_0x4b2d('0x1ef'),'as':_0x4b2d('0x1f0')});db[_0x4b2d('0x145')][_0x4b2d('0x133')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x179'),'through':'UserWhatsappQueue','foreignKey':_0x4b2d('0x207')});db[_0x4b2d('0x145')][_0x4b2d('0x133')](db[_0x4b2d('0xef')],{'through':_0x4b2d('0x208'),'as':'Teams'});db['UserSetting'][_0x4b2d('0x15e')](db[_0x4b2d('0x12')],{'as':_0x4b2d('0x209'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x4b2d('0x115')][_0x4b2d('0x11d')](db['Dynamics365Account'],{'as':_0x4b2d('0xcc'),'onDelete':_0x4b2d('0x16f')});db[_0x4b2d('0x115')]['hasOne'](db[_0x4b2d('0x39')],{'as':_0x4b2d('0x170'),'onDelete':_0x4b2d('0x16f')});db['CloudProvider'][_0x4b2d('0x11d')](db['MailServerOut'],{'as':'Smtp','onDelete':'restrict'});module[_0x4b2d('0x20a')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 550ad87..8f22520 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x192f=['./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./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/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./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/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication'];(function(_0x29e80d,_0x43df7a){var _0x2ef9fd=function(_0x1dc423){while(--_0x1dc423){_0x29e80d['push'](_0x29e80d['shift']());}};_0x2ef9fd(++_0x43df7a);}(_0x192f,0xd6));var _0xf192=function(_0x3dcf41,_0x3d6e95){_0x3dcf41=_0x3dcf41-0x0;var _0x43c5fa=_0x192f[_0x3dcf41];return _0x43c5fa;};'use strict';var path=require(_0xf192('0x0'));var express=require('express');var errors=require(_0xf192('0x1'));var config=require('./config/environment');var setupLoggers=require(_0xf192('0x2'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0xf192('0x3')]=function(_0x3b704f){return setupLoggers(_0x3b704f)[_0xf192('0x4')](function(){_0x3b704f[_0xf192('0x5')](_0xf192('0x6'),require(_0xf192('0x7')));_0x3b704f['use'](_0xf192('0x8'),require(_0xf192('0x9')));_0x3b704f['use'](_0xf192('0xa'),require(_0xf192('0xb')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc'),require(_0xf192('0xd')));_0x3b704f['use']('/api/voice/mohs',require(_0xf192('0xe')));_0x3b704f[_0xf192('0x5')](_0xf192('0xf'),require(_0xf192('0x10')));_0x3b704f[_0xf192('0x5')](_0xf192('0x11'),require(_0xf192('0x12')));_0x3b704f[_0xf192('0x5')]('/api/screen/recordings',require(_0xf192('0x13')));_0x3b704f[_0xf192('0x5')](_0xf192('0x14'),require(_0xf192('0x15')));_0x3b704f[_0xf192('0x5')](_0xf192('0x16'),require(_0xf192('0x17')));_0x3b704f[_0xf192('0x5')](_0xf192('0x18'),require(_0xf192('0x19')));_0x3b704f[_0xf192('0x5')](_0xf192('0x1a'),require('./api/voiceDialReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x1b'),require('./api/voiceAgentReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x1c'),require(_0xf192('0x1d')));_0x3b704f[_0xf192('0x5')](_0xf192('0x1e'),require(_0xf192('0x1f')));_0x3b704f[_0xf192('0x5')](_0xf192('0x20'),require(_0xf192('0x21')));_0x3b704f[_0xf192('0x5')](_0xf192('0x22'),require(_0xf192('0x23')));_0x3b704f['use'](_0xf192('0x24'),require(_0xf192('0x25')));_0x3b704f[_0xf192('0x5')](_0xf192('0x26'),require(_0xf192('0x27')));_0x3b704f[_0xf192('0x5')](_0xf192('0x28'),require(_0xf192('0x29')));_0x3b704f['use'](_0xf192('0x2a'),require(_0xf192('0x2b')));_0x3b704f[_0xf192('0x5')](_0xf192('0x2c'),require('./api/mailInteraction'));_0x3b704f[_0xf192('0x5')]('/api/mail/messages',require(_0xf192('0x2d')));_0x3b704f['use'](_0xf192('0x2e'),require(_0xf192('0x2f')));_0x3b704f[_0xf192('0x5')](_0xf192('0x30'),require(_0xf192('0x31')));_0x3b704f[_0xf192('0x5')](_0xf192('0x32'),require(_0xf192('0x33')));_0x3b704f['use'](_0xf192('0x34'),require(_0xf192('0x35')));_0x3b704f[_0xf192('0x5')]('/api/fax/accounts',require('./api/faxAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0x36'),require(_0xf192('0x37')));_0x3b704f[_0xf192('0x5')]('/api/fax/interactions',require(_0xf192('0x38')));_0x3b704f['use'](_0xf192('0x39'),require('./api/faxMessage'));_0x3b704f['use'](_0xf192('0x3a'),require(_0xf192('0x3b')));_0x3b704f['use']('/api/fax/reports/queue',require(_0xf192('0x3c')));_0x3b704f[_0xf192('0x5')](_0xf192('0x3d'),require('./api/smsAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0x3e'),require(_0xf192('0x3f')));_0x3b704f[_0xf192('0x5')]('/api/sms/interactions',require(_0xf192('0x40')));_0x3b704f[_0xf192('0x5')](_0xf192('0x41'),require('./api/smsMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0x42'),require(_0xf192('0x43')));_0x3b704f[_0xf192('0x5')](_0xf192('0x44'),require(_0xf192('0x45')));_0x3b704f[_0xf192('0x5')]('/api/openchannel/applications',require(_0xf192('0x46')));_0x3b704f[_0xf192('0x5')](_0xf192('0x47'),require('./api/openchannelInteraction'));_0x3b704f[_0xf192('0x5')](_0xf192('0x48'),require(_0xf192('0x49')));_0x3b704f[_0xf192('0x5')](_0xf192('0x4a'),require('./api/openchannelQueue'));_0x3b704f[_0xf192('0x5')](_0xf192('0x4b'),require(_0xf192('0x4c')));_0x3b704f['use'](_0xf192('0x4d'),require(_0xf192('0x4e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x4f'),require(_0xf192('0x50')));_0x3b704f[_0xf192('0x5')](_0xf192('0x51'),require('./api/chatInteraction'));_0x3b704f[_0xf192('0x5')]('/api/chat/messages',require('./api/chatMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0x52'),require(_0xf192('0x53')));_0x3b704f[_0xf192('0x5')](_0xf192('0x54'),require(_0xf192('0x55')));_0x3b704f[_0xf192('0x5')](_0xf192('0x56'),require(_0xf192('0x57')));_0x3b704f[_0xf192('0x5')](_0xf192('0x58'),require(_0xf192('0x59')));_0x3b704f['use']('/api/cm/companies',require('./api/cmCompany'));_0x3b704f['use'](_0xf192('0x5a'),require(_0xf192('0x5b')));_0x3b704f[_0xf192('0x5')](_0xf192('0x5c'),require(_0xf192('0x5d')));_0x3b704f[_0xf192('0x5')](_0xf192('0x5e'),require(_0xf192('0x5f')));_0x3b704f['use']('/api/cm/hopper_final',require(_0xf192('0x60')));_0x3b704f[_0xf192('0x5')](_0xf192('0x61'),require(_0xf192('0x62')));_0x3b704f['use'](_0xf192('0x63'),require(_0xf192('0x64')));_0x3b704f[_0xf192('0x5')](_0xf192('0x65'),require(_0xf192('0x66')));_0x3b704f[_0xf192('0x5')]('/api/automations',require('./api/automation'));_0x3b704f[_0xf192('0x5')](_0xf192('0x67'),require(_0xf192('0x68')));_0x3b704f['use'](_0xf192('0x69'),require(_0xf192('0x6a')));_0x3b704f[_0xf192('0x5')](_0xf192('0x6b'),require(_0xf192('0x6c')));_0x3b704f[_0xf192('0x5')](_0xf192('0x6d'),require(_0xf192('0x6e')));_0x3b704f['use'](_0xf192('0x6f'),require('./api/pause'));_0x3b704f[_0xf192('0x5')](_0xf192('0x70'),require(_0xf192('0x71')));_0x3b704f[_0xf192('0x5')](_0xf192('0x72'),require(_0xf192('0x73')));_0x3b704f[_0xf192('0x5')](_0xf192('0x74'),require(_0xf192('0x75')));_0x3b704f[_0xf192('0x5')]('/api/sounds',require(_0xf192('0x76')));_0x3b704f[_0xf192('0x5')](_0xf192('0x77'),require(_0xf192('0x78')));_0x3b704f['use'](_0xf192('0x79'),require('./api/contactItemType'));_0x3b704f[_0xf192('0x5')](_0xf192('0x7a'),require('./api/cmContactHasItem'));_0x3b704f[_0xf192('0x5')](_0xf192('0x7b'),require(_0xf192('0x7c')));_0x3b704f['use'](_0xf192('0x7d'),require(_0xf192('0x7e')));_0x3b704f['use'](_0xf192('0x7f'),require(_0xf192('0x80')));_0x3b704f[_0xf192('0x5')]('/api/variables',require(_0xf192('0x81')));_0x3b704f[_0xf192('0x5')](_0xf192('0x82'),require(_0xf192('0x83')));_0x3b704f['use'](_0xf192('0x84'),require(_0xf192('0x85')));_0x3b704f['use'](_0xf192('0x86'),require(_0xf192('0x87')));_0x3b704f[_0xf192('0x5')](_0xf192('0x88'),require(_0xf192('0x89')));_0x3b704f[_0xf192('0x5')](_0xf192('0x8a'),require('./api/analyticExtractedReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x8b'),require(_0xf192('0x8c')));_0x3b704f['use'](_0xf192('0x8d'),require(_0xf192('0x8e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x8f'),require(_0xf192('0x90')));_0x3b704f[_0xf192('0x5')](_0xf192('0x91'),require(_0xf192('0x92')));_0x3b704f['use'](_0xf192('0x93'),require(_0xf192('0x94')));_0x3b704f[_0xf192('0x5')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x95'),require(_0xf192('0x96')));_0x3b704f[_0xf192('0x5')]('/api/integrations/sugarcrm/configurations',require(_0xf192('0x97')));_0x3b704f[_0xf192('0x5')](_0xf192('0x98'),require('./api/intSugarcrmField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x99'),require('./api/intDeskAccount'));_0x3b704f['use']('/api/integrations/desk/configurations',require(_0xf192('0x9a')));_0x3b704f[_0xf192('0x5')](_0xf192('0x9b'),require('./api/intDeskField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x9c'),require(_0xf192('0x9d')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zoho/configurations',require(_0xf192('0x9e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x9f'),require(_0xf192('0xa0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa1'),require(_0xf192('0xa2')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zendesk/configurations',require(_0xf192('0xa3')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zendesk/fields',require(_0xf192('0xa4')));_0x3b704f[_0xf192('0x5')]('/api/integrations/freshdesk/accounts',require(_0xf192('0xa5')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa6'),require(_0xf192('0xa7')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa8'),require(_0xf192('0xa9')));_0x3b704f[_0xf192('0x5')]('/api/integrations/vtiger/accounts',require(_0xf192('0xaa')));_0x3b704f[_0xf192('0x5')](_0xf192('0xab'),require(_0xf192('0xac')));_0x3b704f['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3b704f[_0xf192('0x5')](_0xf192('0xad'),require('./api/intServicenowAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0xae'),require(_0xf192('0xaf')));_0x3b704f['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3b704f[_0xf192('0x5')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x3b704f[_0xf192('0x5')](_0xf192('0xb0'),require(_0xf192('0xb1')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb2'),require(_0xf192('0xb3')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb4'),require(_0xf192('0xb5')));_0x3b704f['use'](_0xf192('0xb6'),require(_0xf192('0xb7')));_0x3b704f['use']('/api/integrations/freshsales/fields',require(_0xf192('0xb8')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb9'),require(_0xf192('0xba')));_0x3b704f[_0xf192('0x5')]('/api/chat/reports/queue',require(_0xf192('0xbb')));_0x3b704f[_0xf192('0x5')](_0xf192('0xbc'),require(_0xf192('0xbd')));_0x3b704f[_0xf192('0x5')](_0xf192('0xbe'),require('./api/jscriptyAnswerReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0xbf'),require(_0xf192('0xc0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc1'),require(_0xf192('0xc2')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc3'),require(_0xf192('0xc4')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc5'),require('./api/squareReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc6'),require('./api/squareReportDetail'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc7'),require(_0xf192('0xc8')));_0x3b704f['use']('/api/settings',require('./api/setting'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc9'),require('./api/squareOdbc'));_0x3b704f[_0xf192('0x5')](_0xf192('0xca'),require('./api/squareProject'));_0x3b704f[_0xf192('0x5')](_0xf192('0xcb'),require(_0xf192('0xcc')));_0x3b704f[_0xf192('0x5')](_0xf192('0xcd'),require('./api/squareMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0xce'),require(_0xf192('0xcf')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd0'),require(_0xf192('0xd1')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd2'),require(_0xf192('0xd3')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd4'),require(_0xf192('0xd5')));_0x3b704f[_0xf192('0x5')]('/api/attachments',require('./api/attachment'));_0x3b704f[_0xf192('0x5')](_0xf192('0xd6'),require(_0xf192('0xd7')));_0x3b704f['use'](_0xf192('0xd8'),require(_0xf192('0xd9')));_0x3b704f[_0xf192('0x5')]('/api/chat/reports/transfer',require(_0xf192('0xda')));_0x3b704f[_0xf192('0x5')](_0xf192('0xdb'),require(_0xf192('0xdc')));_0x3b704f[_0xf192('0x5')](_0xf192('0xdd'),require(_0xf192('0xde')));_0x3b704f['use'](_0xf192('0xdf'),require(_0xf192('0xe0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe1'),require(_0xf192('0xe2')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe3'),require(_0xf192('0xe4')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe5'),require('./api/userProfile'));_0x3b704f[_0xf192('0x5')](_0xf192('0xe6'),require(_0xf192('0xe7')));_0x3b704f[_0xf192('0x5')]('/api/userProfile/resources',require(_0xf192('0xe8')));_0x3b704f['use'](_0xf192('0xe9'),require(_0xf192('0xea')));_0x3b704f[_0xf192('0x5')](_0xf192('0xeb'),require(_0xf192('0xec')));_0x3b704f[_0xf192('0x5')](_0xf192('0xed'),require(_0xf192('0xee')));_0x3b704f[_0xf192('0x5')](_0xf192('0xef'),require('./api/whatsappInteraction'));_0x3b704f[_0xf192('0x5')](_0xf192('0xf0'),require('./api/whatsappMessage'));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/reports/queue',require(_0xf192('0xf1')));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/reports/transfer',require(_0xf192('0xf2')));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/queues',require(_0xf192('0xf3')));_0x3b704f['use'](_0xf192('0xf4'),require(_0xf192('0xf5')));_0x3b704f['use']('/api/realtime',require('./api/realtime'));_0x3b704f['use'](_0xf192('0xf6'),require(_0xf192('0xf7')));_0x3b704f[_0xf192('0x5')](_0xf192('0xf8'),require(_0xf192('0xf9')));_0x3b704f[_0xf192('0x5')](_0xf192('0xfa'),require(_0xf192('0xfb')));_0x3b704f['use'](_0xf192('0xfc'),require(_0xf192('0xfd')));_0x3b704f[_0xf192('0x5')](_0xf192('0xfe'),require(_0xf192('0xff')));_0x3b704f[_0xf192('0x5')](_0xf192('0x100'),require(_0xf192('0x101')));_0x3b704f[_0xf192('0x5')]('/api/version',require(_0xf192('0x102')));_0x3b704f[_0xf192('0x5')](_0xf192('0x103'),require(_0xf192('0x104')));_0x3b704f[_0xf192('0x5')]('/api/pm2',require('./api/pm2'));_0x3b704f[_0xf192('0x5')](_0xf192('0x105'),require(_0xf192('0x106')));_0x3b704f[_0xf192('0x5')]('/api/logs',clientSideLogs);_0x3b704f[_0xf192('0x5')](_0xf192('0x107'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x107'))));_0x3b704f[_0xf192('0x5')](_0xf192('0x10b'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x10b'))));_0x3b704f[_0xf192('0x5')](_0xf192('0x10c'),express[_0xf192('0x108')](path['join'](config['root'],'/demo')));_0x3b704f[_0xf192('0x5')](_0xf192('0x10d'),express['static'](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x10e'),'3.5.0')));_0x3b704f[_0xf192('0x5')](_0xf192('0x10f'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x110'))));_0x3b704f[_0xf192('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xf192('0x112')](errors[0x194]);_0x3b704f[_0xf192('0x111')]('/*')[_0xf192('0x112')](function(_0x56af80,_0x3479e2){_0x3479e2['sendFile'](path[_0xf192('0x113')](_0x3b704f['get'](_0xf192('0x114'))+_0xf192('0x115')));});return _0x3b704f;});}; \ No newline at end of file +var _0x22fb=['/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfile/sections','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','/snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x22fb,0x192));var _0xb22f=function(_0x4d6eaf,_0x291ed7){_0x4d6eaf=_0x4d6eaf-0x0;var _0x4fbf1a=_0x22fb[_0x4d6eaf];return _0x4fbf1a;};'use strict';var path=require('path');var express=require('express');var errors=require(_0xb22f('0x0'));var config=require('./config/environment');var setupLoggers=require(_0xb22f('0x1'))[_0xb22f('0x2')];var clientSideLogs=require(_0xb22f('0x3'));exports[_0xb22f('0x4')]=function(_0x201512){return setupLoggers(_0x201512)['then'](function(){_0x201512[_0xb22f('0x5')](_0xb22f('0x6'),require(_0xb22f('0x7')));_0x201512[_0xb22f('0x5')](_0xb22f('0x8'),require(_0xb22f('0x9')));_0x201512['use'](_0xb22f('0xa'),require(_0xb22f('0xb')));_0x201512[_0xb22f('0x5')](_0xb22f('0xc'),require(_0xb22f('0xd')));_0x201512[_0xb22f('0x5')](_0xb22f('0xe'),require(_0xb22f('0xf')));_0x201512[_0xb22f('0x5')](_0xb22f('0x10'),require(_0xb22f('0x11')));_0x201512['use']('/api/voice/recordings',require('./api/voiceRecording'));_0x201512[_0xb22f('0x5')]('/api/screen/recordings',require('./api/screenRecording'));_0x201512['use'](_0xb22f('0x12'),require(_0xb22f('0x13')));_0x201512[_0xb22f('0x5')](_0xb22f('0x14'),require(_0xb22f('0x15')));_0x201512[_0xb22f('0x5')]('/api/voice/calls/reports',require(_0xb22f('0x16')));_0x201512['use'](_0xb22f('0x17'),require('./api/voiceDialReport'));_0x201512[_0xb22f('0x5')](_0xb22f('0x18'),require(_0xb22f('0x19')));_0x201512[_0xb22f('0x5')](_0xb22f('0x1a'),require('./api/voiceQueueReport'));_0x201512[_0xb22f('0x5')]('/api/members/reports',require(_0xb22f('0x1b')));_0x201512[_0xb22f('0x5')](_0xb22f('0x1c'),require(_0xb22f('0x1d')));_0x201512[_0xb22f('0x5')](_0xb22f('0x1e'),require('./api/voiceTransferReport'));_0x201512[_0xb22f('0x5')]('/api/mail/out_servers',require(_0xb22f('0x1f')));_0x201512[_0xb22f('0x5')](_0xb22f('0x20'),require(_0xb22f('0x21')));_0x201512[_0xb22f('0x5')]('/api/mail/queues',require('./api/mailQueue'));_0x201512[_0xb22f('0x5')](_0xb22f('0x22'),require(_0xb22f('0x23')));_0x201512[_0xb22f('0x5')](_0xb22f('0x24'),require(_0xb22f('0x25')));_0x201512[_0xb22f('0x5')](_0xb22f('0x26'),require('./api/mailMessage'));_0x201512['use'](_0xb22f('0x27'),require(_0xb22f('0x28')));_0x201512['use'](_0xb22f('0x29'),require(_0xb22f('0x2a')));_0x201512['use'](_0xb22f('0x2b'),require(_0xb22f('0x2c')));_0x201512['use'](_0xb22f('0x2d'),require(_0xb22f('0x2e')));_0x201512[_0xb22f('0x5')](_0xb22f('0x2f'),require(_0xb22f('0x30')));_0x201512[_0xb22f('0x5')](_0xb22f('0x31'),require(_0xb22f('0x32')));_0x201512['use']('/api/fax/interactions',require('./api/faxInteraction'));_0x201512[_0xb22f('0x5')]('/api/fax/messages',require(_0xb22f('0x33')));_0x201512[_0xb22f('0x5')](_0xb22f('0x34'),require(_0xb22f('0x35')));_0x201512[_0xb22f('0x5')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x201512[_0xb22f('0x5')](_0xb22f('0x36'),require(_0xb22f('0x37')));_0x201512[_0xb22f('0x5')]('/api/sms/applications',require(_0xb22f('0x38')));_0x201512[_0xb22f('0x5')]('/api/sms/interactions',require(_0xb22f('0x39')));_0x201512[_0xb22f('0x5')](_0xb22f('0x3a'),require(_0xb22f('0x3b')));_0x201512[_0xb22f('0x5')]('/api/sms/queues',require('./api/smsQueue'));_0x201512[_0xb22f('0x5')](_0xb22f('0x3c'),require(_0xb22f('0x3d')));_0x201512[_0xb22f('0x5')](_0xb22f('0x3e'),require(_0xb22f('0x3f')));_0x201512[_0xb22f('0x5')](_0xb22f('0x40'),require(_0xb22f('0x41')));_0x201512['use'](_0xb22f('0x42'),require('./api/openchannelMessage'));_0x201512['use'](_0xb22f('0x43'),require(_0xb22f('0x44')));_0x201512[_0xb22f('0x5')](_0xb22f('0x45'),require(_0xb22f('0x46')));_0x201512[_0xb22f('0x5')](_0xb22f('0x47'),require(_0xb22f('0x48')));_0x201512[_0xb22f('0x5')](_0xb22f('0x49'),require(_0xb22f('0x4a')));_0x201512[_0xb22f('0x5')](_0xb22f('0x4b'),require('./api/chatInteraction'));_0x201512['use'](_0xb22f('0x4c'),require(_0xb22f('0x4d')));_0x201512[_0xb22f('0x5')]('/api/chat/offline_messages',require(_0xb22f('0x4e')));_0x201512[_0xb22f('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0x201512[_0xb22f('0x5')]('/api/chat/groups',require(_0xb22f('0x4f')));_0x201512['use'](_0xb22f('0x50'),require(_0xb22f('0x51')));_0x201512[_0xb22f('0x5')]('/api/cm/companies',require(_0xb22f('0x52')));_0x201512[_0xb22f('0x5')](_0xb22f('0x53'),require('./api/cmContact'));_0x201512[_0xb22f('0x5')](_0xb22f('0x54'),require(_0xb22f('0x55')));_0x201512[_0xb22f('0x5')](_0xb22f('0x56'),require(_0xb22f('0x57')));_0x201512[_0xb22f('0x5')](_0xb22f('0x58'),require(_0xb22f('0x59')));_0x201512[_0xb22f('0x5')]('/api/cm/hopper_history',require(_0xb22f('0x5a')));_0x201512[_0xb22f('0x5')]('/api/cm/custom_fields',require(_0xb22f('0x5b')));_0x201512['use']('/api/actions',require(_0xb22f('0x5c')));_0x201512[_0xb22f('0x5')](_0xb22f('0x5d'),require(_0xb22f('0x5e')));_0x201512['use'](_0xb22f('0x5f'),require('./api/cannedAnswer'));_0x201512[_0xb22f('0x5')](_0xb22f('0x60'),require(_0xb22f('0x61')));_0x201512[_0xb22f('0x5')](_0xb22f('0x62'),require(_0xb22f('0x63')));_0x201512['use'](_0xb22f('0x64'),require('./api/interval'));_0x201512[_0xb22f('0x5')](_0xb22f('0x65'),require('./api/pause'));_0x201512[_0xb22f('0x5')](_0xb22f('0x66'),require('./api/cdr'));_0x201512['use'](_0xb22f('0x67'),require('./api/voiceQueuesLog'));_0x201512[_0xb22f('0x5')](_0xb22f('0x68'),require(_0xb22f('0x69')));_0x201512[_0xb22f('0x5')]('/api/sounds',require(_0xb22f('0x6a')));_0x201512[_0xb22f('0x5')]('/api/tags',require(_0xb22f('0x6b')));_0x201512[_0xb22f('0x5')](_0xb22f('0x6c'),require(_0xb22f('0x6d')));_0x201512[_0xb22f('0x5')]('/api/cm_contact_has_items',require(_0xb22f('0x6e')));_0x201512['use']('/api/cm_hopper_additional_phones',require(_0xb22f('0x6f')));_0x201512[_0xb22f('0x5')](_0xb22f('0x70'),require(_0xb22f('0x71')));_0x201512[_0xb22f('0x5')]('/api/triggers',require(_0xb22f('0x72')));_0x201512['use'](_0xb22f('0x73'),require('./api/variable'));_0x201512[_0xb22f('0x5')](_0xb22f('0x74'),require(_0xb22f('0x75')));_0x201512['use'](_0xb22f('0x76'),require(_0xb22f('0x77')));_0x201512['use'](_0xb22f('0x78'),require(_0xb22f('0x79')));_0x201512['use']('/api/analytics/default_reports',require(_0xb22f('0x7a')));_0x201512[_0xb22f('0x5')]('/api/analytics/extracted_reports',require(_0xb22f('0x7b')));_0x201512[_0xb22f('0x5')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x201512[_0xb22f('0x5')](_0xb22f('0x7c'),require('./api/analyticFieldReport'));_0x201512[_0xb22f('0x5')](_0xb22f('0x7d'),require(_0xb22f('0x7e')));_0x201512[_0xb22f('0x5')]('/api/integrations/salesforce/accounts',require(_0xb22f('0x7f')));_0x201512[_0xb22f('0x5')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x201512[_0xb22f('0x5')](_0xb22f('0x80'),require(_0xb22f('0x81')));_0x201512[_0xb22f('0x5')]('/api/integrations/sugarcrm/accounts',require(_0xb22f('0x82')));_0x201512[_0xb22f('0x5')]('/api/integrations/sugarcrm/configurations',require(_0xb22f('0x83')));_0x201512[_0xb22f('0x5')](_0xb22f('0x84'),require(_0xb22f('0x85')));_0x201512[_0xb22f('0x5')](_0xb22f('0x86'),require(_0xb22f('0x87')));_0x201512['use'](_0xb22f('0x88'),require(_0xb22f('0x89')));_0x201512[_0xb22f('0x5')](_0xb22f('0x8a'),require(_0xb22f('0x8b')));_0x201512['use']('/api/integrations/zoho/accounts',require(_0xb22f('0x8c')));_0x201512[_0xb22f('0x5')](_0xb22f('0x8d'),require('./api/intZohoConfiguration'));_0x201512[_0xb22f('0x5')](_0xb22f('0x8e'),require(_0xb22f('0x8f')));_0x201512[_0xb22f('0x5')](_0xb22f('0x90'),require(_0xb22f('0x91')));_0x201512[_0xb22f('0x5')](_0xb22f('0x92'),require('./api/intZendeskConfiguration'));_0x201512['use'](_0xb22f('0x93'),require(_0xb22f('0x94')));_0x201512['use']('/api/integrations/freshdesk/accounts',require(_0xb22f('0x95')));_0x201512[_0xb22f('0x5')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x201512[_0xb22f('0x5')]('/api/integrations/freshdesk/fields',require(_0xb22f('0x96')));_0x201512[_0xb22f('0x5')](_0xb22f('0x97'),require('./api/intVtigerAccount'));_0x201512['use'](_0xb22f('0x98'),require('./api/intVtigerConfiguration'));_0x201512[_0xb22f('0x5')](_0xb22f('0x99'),require(_0xb22f('0x9a')));_0x201512['use']('/api/integrations/servicenow/accounts',require(_0xb22f('0x9b')));_0x201512['use'](_0xb22f('0x9c'),require(_0xb22f('0x9d')));_0x201512[_0xb22f('0x5')]('/api/integrations/servicenow/fields',require(_0xb22f('0x9e')));_0x201512['use'](_0xb22f('0x9f'),require(_0xb22f('0xa0')));_0x201512[_0xb22f('0x5')](_0xb22f('0xa1'),require(_0xb22f('0xa2')));_0x201512[_0xb22f('0x5')](_0xb22f('0xa3'),require(_0xb22f('0xa4')));_0x201512[_0xb22f('0x5')]('/api/integrations/freshsales/accounts',require(_0xb22f('0xa5')));_0x201512[_0xb22f('0x5')](_0xb22f('0xa6'),require('./api/intFreshsalesConfiguration'));_0x201512[_0xb22f('0x5')](_0xb22f('0xa7'),require(_0xb22f('0xa8')));_0x201512[_0xb22f('0x5')]('/api/networks',require('./api/network'));_0x201512[_0xb22f('0x5')]('/api/chat/reports/queue',require(_0xb22f('0xa9')));_0x201512[_0xb22f('0x5')](_0xb22f('0xaa'),require(_0xb22f('0xab')));_0x201512[_0xb22f('0x5')](_0xb22f('0xac'),require(_0xb22f('0xad')));_0x201512[_0xb22f('0x5')](_0xb22f('0xae'),require(_0xb22f('0xaf')));_0x201512[_0xb22f('0x5')](_0xb22f('0xb0'),require(_0xb22f('0xb1')));_0x201512['use'](_0xb22f('0xb2'),require(_0xb22f('0xb3')));_0x201512[_0xb22f('0x5')](_0xb22f('0xb4'),require(_0xb22f('0xb5')));_0x201512[_0xb22f('0x5')](_0xb22f('0xb6'),require(_0xb22f('0xb7')));_0x201512[_0xb22f('0x5')](_0xb22f('0xb8'),require(_0xb22f('0xb9')));_0x201512[_0xb22f('0x5')]('/api/settings',require('./api/setting'));_0x201512['use'](_0xb22f('0xba'),require(_0xb22f('0xbb')));_0x201512['use'](_0xb22f('0xbc'),require(_0xb22f('0xbd')));_0x201512['use'](_0xb22f('0xbe'),require(_0xb22f('0xbf')));_0x201512[_0xb22f('0x5')](_0xb22f('0xc0'),require(_0xb22f('0xc1')));_0x201512['use']('/api/teams',require('./api/team'));_0x201512[_0xb22f('0x5')](_0xb22f('0xc2'),require(_0xb22f('0xc3')));_0x201512['use'](_0xb22f('0xc4'),require(_0xb22f('0xc5')));_0x201512['use'](_0xb22f('0xc6'),require(_0xb22f('0xc7')));_0x201512[_0xb22f('0x5')](_0xb22f('0xc8'),require(_0xb22f('0xc9')));_0x201512[_0xb22f('0x5')](_0xb22f('0xca'),require(_0xb22f('0xcb')));_0x201512[_0xb22f('0x5')](_0xb22f('0xcc'),require('./api/mailTransferReport'));_0x201512[_0xb22f('0x5')](_0xb22f('0xcd'),require(_0xb22f('0xce')));_0x201512[_0xb22f('0x5')](_0xb22f('0xcf'),require(_0xb22f('0xd0')));_0x201512[_0xb22f('0x5')]('/api/openchannel/reports/transfer',require(_0xb22f('0xd1')));_0x201512[_0xb22f('0x5')](_0xb22f('0xd2'),require(_0xb22f('0xd3')));_0x201512[_0xb22f('0x5')](_0xb22f('0xd4'),require('./api/cmList'));_0x201512[_0xb22f('0x5')](_0xb22f('0xd5'),require('./api/voicePrefix'));_0x201512[_0xb22f('0x5')]('/api/userProfiles',require('./api/userProfile'));_0x201512['use'](_0xb22f('0xd6'),require('./api/userProfileSection'));_0x201512[_0xb22f('0x5')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x201512[_0xb22f('0x5')](_0xb22f('0xd7'),require('./api/userNotification'));_0x201512['use'](_0xb22f('0xd8'),require(_0xb22f('0xd9')));_0x201512['use'](_0xb22f('0xda'),require('./api/whatsappApplication'));_0x201512['use'](_0xb22f('0xdb'),require(_0xb22f('0xdc')));_0x201512[_0xb22f('0x5')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x201512['use'](_0xb22f('0xdd'),require(_0xb22f('0xde')));_0x201512[_0xb22f('0x5')](_0xb22f('0xdf'),require('./api/whatsappTransferReport'));_0x201512[_0xb22f('0x5')](_0xb22f('0xe0'),require(_0xb22f('0xe1')));_0x201512[_0xb22f('0x5')](_0xb22f('0xe2'),require('./api/cloudProvider'));_0x201512[_0xb22f('0x5')]('/api/realtime',require('./api/realtime'));_0x201512[_0xb22f('0x5')](_0xb22f('0xe3'),require(_0xb22f('0xe4')));_0x201512['use'](_0xb22f('0xe5'),require(_0xb22f('0xe6')));_0x201512[_0xb22f('0x5')](_0xb22f('0xe7'),require(_0xb22f('0xe8')));_0x201512[_0xb22f('0x5')](_0xb22f('0xe9'),require(_0xb22f('0xea')));_0x201512[_0xb22f('0x5')](_0xb22f('0xeb'),require(_0xb22f('0xec')));_0x201512['use']('/api/rpc',require(_0xb22f('0xed')));_0x201512[_0xb22f('0x5')]('/api/version',require(_0xb22f('0xee')));_0x201512[_0xb22f('0x5')](_0xb22f('0xef'),require(_0xb22f('0xf0')));_0x201512[_0xb22f('0x5')](_0xb22f('0xf1'),require(_0xb22f('0xf2')));_0x201512[_0xb22f('0x5')]('/api/webbar',require(_0xb22f('0xf3')));_0x201512[_0xb22f('0x5')](_0xb22f('0xf4'),clientSideLogs);_0x201512['use'](_0xb22f('0xf5'),express[_0xb22f('0xf6')](path[_0xb22f('0xf7')](config['root'],_0xb22f('0xf5'))));_0x201512['use'](_0xb22f('0xf8'),express[_0xb22f('0xf6')](path[_0xb22f('0xf7')](config[_0xb22f('0xf9')],_0xb22f('0xf8'))));_0x201512[_0xb22f('0x5')](_0xb22f('0xfa'),express[_0xb22f('0xf6')](path[_0xb22f('0xf7')](config['root'],_0xb22f('0xfa'))));_0x201512[_0xb22f('0x5')](_0xb22f('0xfb'),express['static'](path[_0xb22f('0xf7')](config['root'],'snippet','3.5.0')));_0x201512[_0xb22f('0x5')](_0xb22f('0xfc'),express[_0xb22f('0xf6')](path[_0xb22f('0xf7')](config[_0xb22f('0xf9')],_0xb22f('0xfd'))));_0x201512[_0xb22f('0xfe')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xb22f('0xff')](errors[0x194]);_0x201512[_0xb22f('0xfe')]('/*')[_0xb22f('0xff')](function(_0x1fa410,_0x141fa4){_0x141fa4[_0xb22f('0x100')](path[_0xb22f('0x101')](_0x201512[_0xb22f('0xff')]('appPath')+_0xb22f('0x102')));});return _0x201512;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 95e081f..e3fd475 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe225=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/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/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','server','port','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0x53cd59,_0x33c319){var _0x19fa73=function(_0x33cd75){while(--_0x33cd75){_0x53cd59['push'](_0x53cd59['shift']());}};_0x19fa73(++_0x33c319);}(_0xe225,0x1bd));var _0x5e22=function(_0x554de9,_0x4b1bd2){_0x554de9=_0x554de9-0x0;var _0x2bcb4f=_0xe225[_0x554de9];return _0x2bcb4f;};'use strict';var jayson=require('jayson/promise');var _=require(_0x5e22('0x0'));var config=require(_0x5e22('0x1'));exports['listen']=function(){return new Promise(function(_0x503eba,_0x4c55ed){var _0x39f972={};_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x2')));_0x39f972=_['merge'](_0x39f972,require('../api/voiceExtension/voiceExtension.rpc'));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x3')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x5')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x6')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x7')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x8')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x9')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/memberReport/memberReport.rpc'));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/trunk/trunk.rpc'));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0xa')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0xb')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0xc')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0xd')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0xe')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0xf')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x10')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x11')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x12')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x13')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x14')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x15')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x16')));_0x39f972=_['merge'](_0x39f972,require('../api/faxQueue/faxQueue.rpc'));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x17')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x18')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x19')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x1a')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x1b')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x1c')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x1d')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x1e')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x1f')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x20')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x21')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x22')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x23')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x24')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x25')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x26')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x27')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/interval/interval.rpc'));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x28')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x29')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x2a')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x2b')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x2c')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x2d')));_0x39f972=_['merge'](_0x39f972,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x2e')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x2f')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x30')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x31')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x32')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x33')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x34')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x35')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x36')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x37')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x38')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x39')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x3a')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x3b')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x3c')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x3d')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x3e')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x3f')));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x40')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/attachment/attachment.rpc'));_0x39f972=_['merge'](_0x39f972,require(_0x5e22('0x41')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x42')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require(_0x5e22('0x43')));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x39f972=_['merge'](_0x39f972,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x39f972=_[_0x5e22('0x4')](_0x39f972,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x33b83a=jayson[_0x5e22('0x44')](_0x39f972)['http']();var _0x1ce5b0=config['rpc'][_0x5e22('0x45')]||config[_0x5e22('0x45')]+0x1;var _0x4d1970=config[_0x5e22('0x46')]['ip']||_0x5e22('0x47');_0x33b83a['on'](_0x5e22('0x48'),function(_0x30a88f){return _0x4c55ed(_0x30a88f);});_0x33b83a['listen'](_0x1ce5b0,_0x4d1970,function(){console['log'](_0x5e22('0x49'),_0x4d1970,_0x1ce5b0);require(_0x5e22('0x4a'))[_0x5e22('0x4b')]();return _0x503eba('RPC\x20listening\x20on\x20'+_0x4d1970+':'+_0x1ce5b0);});});}; \ No newline at end of file +var _0x0821=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.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'];(function(_0x2dd92e,_0x5fb8e4){var _0x1c75e8=function(_0x229437){while(--_0x229437){_0x2dd92e['push'](_0x2dd92e['shift']());}};_0x1c75e8(++_0x5fb8e4);}(_0x0821,0x186));var _0x1082=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x0821[_0xbb091];return _0x467a04;};'use strict';var jayson=require(_0x1082('0x0'));var _=require('lodash');var config=require(_0x1082('0x1'));exports[_0x1082('0x2')]=function(){return new Promise(function(_0x2ee75a,_0x163c0d){var _0x5bcf8e={};_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/user/user.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x4')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/voiceQueue/voiceQueue.rpc'));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x5')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x6')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x7')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5bcf8e=_['merge'](_0x5bcf8e,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x8')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x9')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0xa')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0xb')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/mailServerIn/mailServerIn.rpc'));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0xc')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0xd')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0xe')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/mailMessage/mailMessage.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0xf')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x10')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x11')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x12')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/faxInteraction/faxInteraction.rpc'));_0x5bcf8e=_['merge'](_0x5bcf8e,require('../api/faxMessage/faxMessage.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x13')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x14')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x15')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x16')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x17')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x18')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x19')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x1a')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x1b')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x1c')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x1d')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x1e')));_0x5bcf8e=_['merge'](_0x5bcf8e,require('../api/chatMessage/chatMessage.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x1f')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x20')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x21')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x22')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x23')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x24')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x25')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x26')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x27')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x28')));_0x5bcf8e=_['merge'](_0x5bcf8e,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x29')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x2a')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x2b')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x2c')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x2d')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x2e')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x2f')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x30')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x31')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x32')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x33')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x34')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x35')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x36')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x37')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x38')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x39')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x3a')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x3b')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require('../api/attachment/attachment.rpc'));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x3c')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x3d')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x3e')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x3f')));_0x5bcf8e=_[_0x1082('0x3')](_0x5bcf8e,require(_0x1082('0x40')));_0x5bcf8e=_['merge'](_0x5bcf8e,require(_0x1082('0x41')));var _0x29c08b=jayson[_0x1082('0x42')](_0x5bcf8e)[_0x1082('0x43')]();var _0x30f483=config[_0x1082('0x44')]['port']||config['port']+0x1;var _0x237f6b=config[_0x1082('0x44')]['ip']||_0x1082('0x45');_0x29c08b['on'](_0x1082('0x46'),function(_0x516dd1){return _0x163c0d(_0x516dd1);});_0x29c08b[_0x1082('0x2')](_0x30f483,_0x237f6b,function(){console['log'](_0x1082('0x47'),_0x237f6b,_0x30f483);require('../config/triggers')['default']();return _0x2ee75a(_0x1082('0x48')+_0x237f6b+':'+_0x30f483);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e6ac765..577ff74 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 _0x1f2d=['search','function','no\x20code','result=','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','sync','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid'];(function(_0x14158a,_0x193248){var _0x45ee29=function(_0xf57ff1){while(--_0xf57ff1){_0x14158a['push'](_0x14158a['shift']());}};_0x45ee29(++_0x193248);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x1f2d[_0x53b53e];return _0xbb6179;};'use strict';var util=require(_0xd1f2('0x0'));var _=require(_0xd1f2('0x1'));var EventEmitter=require(_0xd1f2('0x2'))[_0xd1f2('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xd1f2('0x4'));function AGIChannel(_0xd7780e){var _0x13626e=this,_0xd4f928=new AGIReply(),_0x21f154=![],_0x194b49={};EventEmitter[_0xd1f2('0x5')](_0x13626e);_0xd7780e[_0xd1f2('0x6')](_0xd1f2('0x7'));_0xd7780e[_0xd1f2('0x8')](0x8*0x3c*0x3c*0x3e8);_0xd4f928[_0xd1f2('0x6')](_0xd1f2('0x7'));_0xd4f928['on'](_0xd1f2('0x9'),function(_0x30a60f){for(var _0x2097cf in _0x30a60f){_0x13626e[_0x2097cf]=_0x30a60f[_0x2097cf];}_0x13626e[_0xd1f2('0xa')](_0xd1f2('0xb'));});_0xd4f928['on']('line',function(_0x309e6a){if(_0x309e6a[_0xd1f2('0xc')]()==_0xd1f2('0xd')){_0x13626e[_0xd1f2('0xa')]('hangup');return;}if(_0x309e6a[_0xd1f2('0xe')](0x0,0xb)==_0xd1f2('0xf')){_0x21f154=!![];}if(_0x21f154){_0x194b49['rx']+=_0x309e6a+'\x0a';if(_0x309e6a[_0xd1f2('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x21f154=![];}}else{_0x194b49['rx']=_0x309e6a;}if(_0x21f154){return;}if(typeof _0x194b49['cb']==_0xd1f2('0x11')){var _0x347eba=_0x194b49['rx'][_0xd1f2('0xe')](0x0,0x3),_0x2ef331=null,_0x1d09f6=null;_0x347eba=parseInt(_0x347eba);if(isNaN(_0x347eba)){_0x194b49['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd1f2('0x12')});return;}if(_0x347eba!=0xc8){_0x194b49['cb'](null,{'code':_0x347eba,'result':-0x1,'extra':'KO'});return;}_0x2ef331=_0x194b49['rx'][_0xd1f2('0xe')](0x4)['replace'](_0xd1f2('0x13'),'');if(_0x2ef331['indexOf']('\x20')!=-0x1){_0x2ef331=_0x2ef331['substr'](0x0,_0x2ef331['indexOf']('\x20'));}if(_[_0xd1f2('0x14')](_0x2ef331,'-1')){_0x2ef331=parseInt(_0x2ef331);}_0x1d09f6=_0x194b49['rx'][_0xd1f2('0x15')]('\x20');if(_0x1d09f6[_0xd1f2('0x16')]==0x3){_0x1d09f6=_0x1d09f6[0x2][_0xd1f2('0xe')](0x1,_0x1d09f6[0x2][_0xd1f2('0x16')]-0x1);}else if(_0x1d09f6[_0xd1f2('0x16')]>0x3){var _0x1f100c=/\((.+)\)/;var _0x59433d=_0x194b49['rx'][_0xd1f2('0x17')](_0x1f100c);if(_0x59433d){_0x1d09f6=_0x59433d[0x1];}else{_0x1d09f6=null;}}else{_0x1d09f6=null;}_0x194b49['cb'](null,{'code':_0x347eba,'result':_0x2ef331,'extra':_0x1d09f6});}});_0xd7780e['on'](_0xd1f2('0x18'),function(_0x2cd4fa){_0x13626e[_0xd1f2('0xa')](_0xd1f2('0x18'),new AGIError(_0xd1f2('0x19'),_0x2cd4fa[_0xd1f2('0x1a')]));});_0xd7780e['on']('close',function(){_0x13626e[_0xd1f2('0xa')](_0xd1f2('0x1b'),new AGIError(_0xd1f2('0x1c')));});_0xd7780e['on'](_0xd1f2('0x1d'),function(){_0x13626e[_0xd1f2('0xa')](_0xd1f2('0x1d'),new AGIError(_0xd1f2('0x1e')));_0xd7780e[_0xd1f2('0x1f')]();});_0xd7780e[_0xd1f2('0x20')](_0xd4f928);this[_0xd1f2('0x21')]=function(_0x8c7385,_0x4b74ff){var _0x8c7385=_0x8c7385||'',_0x4b74ff=typeof _0x4b74ff=='function'?_0x4b74ff:new Function();_0x194b49={'tx':_0x8c7385,'rx':'','cb':_0x4b74ff};_0xd7780e['write'](_0x8c7385+'\x0a');},this[_0xd1f2('0x1b')]=function(){_0xd7780e[_0xd1f2('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x559243){return this['command'][_0xd1f2('0x22')](this,_0x559243);};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x24')]=function(){return this[_0xd1f2('0x25')](_0xd1f2('0x26'));};AGIChannel['prototype'][_0xd1f2('0x27')]=function(_0x3a99b2,_0x215a8b,_0x464b1f){_0x3a99b2=_0x3a99b2===undefined?_0xd1f2('0x28'):_0x3a99b2;_0x215a8b=_0x215a8b===undefined?'5':_0x215a8b;_0x464b1f=_0x464b1f===undefined?'1':_0x464b1f;return this[_0xd1f2('0x25')](util[_0xd1f2('0x29')](_0xd1f2('0x2a'),_0x3a99b2,_0x215a8b*0x3e8,_0x464b1f));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x2b')]=function(_0x3e5e6c){_0x3e5e6c=_0x3e5e6c||'NO\x20MESSAGE';return this['sendRequest'](util[_0xd1f2('0x29')](_0xd1f2('0x2c'),_0x3e5e6c));};AGIChannel['prototype'][_0xd1f2('0x2d')]=function(_0x4ce6cd,_0x1b9c0f){if(_[_0xd1f2('0x2e')](_0x1b9c0f)){return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x2f'),_0x4ce6cd,_0x1b9c0f['join'](',')));}return this['sendRequest'](util[_0xd1f2('0x29')](_0xd1f2('0x2f'),_0x4ce6cd,_0x1b9c0f));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x30')]=function(_0x4b8600){return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x31'),_0x4b8600));};AGIChannel[_0xd1f2('0x23')]['setExtension']=function(_0xa04d7a){return this['sendRequest'](util[_0xd1f2('0x29')](_0xd1f2('0x32'),_0xa04d7a));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x33')]=function(_0x24e585){return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x34'),_0x24e585));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0xd')]=function(){return this[_0xd1f2('0x25')](_0xd1f2('0x35'));};AGIChannel['prototype'][_0xd1f2('0x36')]=function(_0x341099,_0x492094){var _0x33cb1c=_['isBoolean'](_0x492094)||_[_0xd1f2('0x37')](_0x492094)?_0x492094[_0xd1f2('0x38')]():_0x492094;return this[_0xd1f2('0x25')](util[_0xd1f2('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x341099,_0x33cb1c?_0x33cb1c[_0xd1f2('0x38')]()[_0xd1f2('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x3a')]=function(_0x1c2f02,_0x3d6782){return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x3b'),_0x1c2f02,_0x3d6782));};AGIChannel['prototype'][_0xd1f2('0x3c')]=function(_0x1706e8,_0x1edc3d){return this['sendRequest'](util[_0xd1f2('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x1706e8,_0x1edc3d));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x3d')]=function(_0x3c4cc1,_0x79861c){return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x3e'),_0x3c4cc1,_0x79861c));};AGIChannel[_0xd1f2('0x23')]['continueAt']=function(_0x419881,_0x4c16de,_0xbd1c11){_0x4c16de=_0x4c16de||this[_0xd1f2('0x3f')];_0xbd1c11=_0xbd1c11||0x1;this[_0xd1f2('0x30')](_0x419881);this['setExtension'](_0x4c16de);this[_0xd1f2('0x33')](_0xbd1c11);return this['noop'](util[_0xd1f2('0x29')](_0xd1f2('0x40'),_0x419881,_0x4c16de,_0xbd1c11));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x41')]=function(_0x4256b6){return this[_0xd1f2('0x25')](util[_0xd1f2('0x29')](_0xd1f2('0x42'),_0x4256b6));};AGIChannel['prototype'][_0xd1f2('0x43')]=function(_0x5fa73c,_0x29a7b2,_0x19d1fd,_0x110711,_0x2cf8aa,_0x4a9810){_0x29a7b2=_0x29a7b2||_0xd1f2('0x44');_0x19d1fd=_0x19d1fd||'';_0x110711=_0x110711===undefined?-0x1:_0x110711==='-1'?-0x1:_0x110711*0x3e8;_0x2cf8aa=_0x2cf8aa===undefined?'':'s='+_0x2cf8aa;_0x4a9810=_0x4a9810?_0xd1f2('0x45'):'';return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x46'),_0x5fa73c,_0x29a7b2,_0x19d1fd,_0x110711,_0x4a9810,_0x2cf8aa));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x47')]=function(_0x1d3edf,_0xe6d2b1){_0xe6d2b1=_0xe6d2b1||'';return this[_0xd1f2('0x25')](util['format'](_0xd1f2('0x48'),_0x1d3edf,_0xe6d2b1));};AGIChannel[_0xd1f2('0x23')][_0xd1f2('0x49')]=function(_0x2756a0){return this['exec'](_0xd1f2('0x4a'),_0x2756a0);};AGIChannel[_0xd1f2('0x23')]['wait']=function(_0x21638d){return this['exec'](_0xd1f2('0x4b'),_0x21638d);};AGIChannel['prototype'][_0xd1f2('0x18')]=function(_0x3c26ac,_0x45b0c6){this[_0xd1f2('0x2b')](util[_0xd1f2('0x29')](_0xd1f2('0x4c'),_0x3c26ac['id'],_0x3c26ac['label'],_0x45b0c6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xd1f2('0x4d')]=AGIChannel; \ No newline at end of file +var _0xc4af=['emit','ready','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','sync','answer','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers'];(function(_0x1f5250,_0x39ae00){var _0x53666c=function(_0x2ac949){while(--_0x2ac949){_0x1f5250['push'](_0x1f5250['shift']());}};_0x53666c(++_0x39ae00);}(_0xc4af,0x88));var _0xfc4a=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xc4af[_0x47b58b];return _0x46bebe;};'use strict';var util=require(_0xfc4a('0x0'));var _=require('lodash');var EventEmitter=require(_0xfc4a('0x1'))[_0xfc4a('0x2')];var AGIReply=require(_0xfc4a('0x3'));var AGIError=require(_0xfc4a('0x4'));function AGIChannel(_0x3589b9){var _0x52daf8=this,_0x19487f=new AGIReply(),_0x147436=![],_0xc930f0={};EventEmitter[_0xfc4a('0x5')](_0x52daf8);_0x3589b9[_0xfc4a('0x6')](_0xfc4a('0x7'));_0x3589b9[_0xfc4a('0x8')](0x8*0x3c*0x3c*0x3e8);_0x19487f[_0xfc4a('0x6')](_0xfc4a('0x7'));_0x19487f['on'](_0xfc4a('0x9'),function(_0x1979f5){for(var _0x18f5f3 in _0x1979f5){_0x52daf8[_0x18f5f3]=_0x1979f5[_0x18f5f3];}_0x52daf8[_0xfc4a('0xa')](_0xfc4a('0xb'));});_0x19487f['on'](_0xfc4a('0xc'),function(_0x28f7e3){if(_0x28f7e3[_0xfc4a('0xd')]()==_0xfc4a('0xe')){_0x52daf8[_0xfc4a('0xa')]('hangup');return;}if(_0x28f7e3[_0xfc4a('0xf')](0x0,0xb)=='520-Invalid'){_0x147436=!![];}if(_0x147436){_0xc930f0['rx']+=_0x28f7e3+'\x0a';if(_0x28f7e3['search'](_0xfc4a('0x10'))!=-0x1){_0x147436=![];}}else{_0xc930f0['rx']=_0x28f7e3;}if(_0x147436){return;}if(typeof _0xc930f0['cb']==_0xfc4a('0x11')){var _0x2c6538=_0xc930f0['rx'][_0xfc4a('0xf')](0x0,0x3),_0x58cddf=null,_0x241d50=null;_0x2c6538=parseInt(_0x2c6538);if(isNaN(_0x2c6538)){_0xc930f0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xfc4a('0x12')});return;}if(_0x2c6538!=0xc8){_0xc930f0['cb'](null,{'code':_0x2c6538,'result':-0x1,'extra':'KO'});return;}_0x58cddf=_0xc930f0['rx'][_0xfc4a('0xf')](0x4)[_0xfc4a('0x13')]('result=','');if(_0x58cddf[_0xfc4a('0x14')]('\x20')!=-0x1){_0x58cddf=_0x58cddf[_0xfc4a('0x15')](0x0,_0x58cddf[_0xfc4a('0x14')]('\x20'));}if(_[_0xfc4a('0x16')](_0x58cddf,'-1')){_0x58cddf=parseInt(_0x58cddf);}_0x241d50=_0xc930f0['rx'][_0xfc4a('0x17')]('\x20');if(_0x241d50['length']==0x3){_0x241d50=_0x241d50[0x2]['substring'](0x1,_0x241d50[0x2]['length']-0x1);}else if(_0x241d50[_0xfc4a('0x18')]>0x3){var _0x25fcee=/\((.+)\)/;var _0x351106=_0xc930f0['rx'][_0xfc4a('0x19')](_0x25fcee);if(_0x351106){_0x241d50=_0x351106[0x1];}else{_0x241d50=null;}}else{_0x241d50=null;}_0xc930f0['cb'](null,{'code':_0x2c6538,'result':_0x58cddf,'extra':_0x241d50});}});_0x3589b9['on'](_0xfc4a('0x1a'),function(_0x2fa963){_0x52daf8[_0xfc4a('0xa')](_0xfc4a('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x2fa963[_0xfc4a('0x1b')]));});_0x3589b9['on'](_0xfc4a('0x1c'),function(){_0x52daf8['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3589b9['on'](_0xfc4a('0x1d'),function(){_0x52daf8[_0xfc4a('0xa')]('timeout',new AGIError(_0xfc4a('0x1e')));_0x3589b9[_0xfc4a('0x1f')]();});_0x3589b9['pipe'](_0x19487f);this[_0xfc4a('0x20')]=function(_0x149f24,_0x178d7c){var _0x149f24=_0x149f24||'',_0x178d7c=typeof _0x178d7c==_0xfc4a('0x11')?_0x178d7c:new Function();_0xc930f0={'tx':_0x149f24,'rx':'','cb':_0x178d7c};_0x3589b9[_0xfc4a('0x21')](_0x149f24+'\x0a');},this[_0xfc4a('0x1c')]=function(){_0x3589b9[_0xfc4a('0x1f')]();};}util[_0xfc4a('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x24')]=function(_0x4c1045){return this['command'][_0xfc4a('0x25')](this,_0x4c1045);};AGIChannel['prototype'][_0xfc4a('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel['prototype']['getData']=function(_0x45a04b,_0x547945,_0x3c446b){_0x45a04b=_0x45a04b===undefined?_0xfc4a('0x27'):_0x45a04b;_0x547945=_0x547945===undefined?'5':_0x547945;_0x3c446b=_0x3c446b===undefined?'1':_0x3c446b;return this['sendRequest'](util[_0xfc4a('0x28')](_0xfc4a('0x29'),_0x45a04b,_0x547945*0x3e8,_0x3c446b));};AGIChannel[_0xfc4a('0x23')]['noop']=function(_0xf0c25){_0xf0c25=_0xf0c25||_0xfc4a('0x2a');return this['sendRequest'](util['format'](_0xfc4a('0x2b'),_0xf0c25));};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x2c')]=function(_0x5023fd,_0x407190){if(_[_0xfc4a('0x2d')](_0x407190)){return this[_0xfc4a('0x24')](util['format'](_0xfc4a('0x2e'),_0x5023fd,_0x407190[_0xfc4a('0x2f')](',')));}return this['sendRequest'](util['format'](_0xfc4a('0x2e'),_0x5023fd,_0x407190));};AGIChannel['prototype'][_0xfc4a('0x30')]=function(_0x384ffc){return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')](_0xfc4a('0x31'),_0x384ffc));};AGIChannel[_0xfc4a('0x23')]['setExtension']=function(_0x17a3dc){return this['sendRequest'](util[_0xfc4a('0x28')]('SET\x20EXTENSION\x20%s',_0x17a3dc));};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x32')]=function(_0x568b05){return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')](_0xfc4a('0x33'),_0x568b05));};AGIChannel['prototype'][_0xfc4a('0xe')]=function(){return this[_0xfc4a('0x24')](_0xfc4a('0x34'));};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x35')]=function(_0x1f683b,_0x4bf201){var _0x32f668=_[_0xfc4a('0x36')](_0x4bf201)||_['isNumber'](_0x4bf201)?_0x4bf201['toString']():_0x4bf201;return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1f683b,_0x32f668?_0x32f668['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x37')]=function(_0x1115d9,_0x5357b9){return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')](_0xfc4a('0x38'),_0x1115d9,_0x5357b9));};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x39')]=function(_0x43e2c5,_0x5ba34a){return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')](_0xfc4a('0x3a'),_0x43e2c5,_0x5ba34a));};AGIChannel[_0xfc4a('0x23')]['sayPhonetic']=function(_0x448fa9,_0x1bc98e){return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x448fa9,_0x1bc98e));};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x3b')]=function(_0x5895aa,_0x5a0c65,_0x5123b3){_0x5a0c65=_0x5a0c65||this['extension'];_0x5123b3=_0x5123b3||0x1;this[_0xfc4a('0x30')](_0x5895aa);this['setExtension'](_0x5a0c65);this['setPriority'](_0x5123b3);return this['noop'](util[_0xfc4a('0x28')](_0xfc4a('0x3c'),_0x5895aa,_0x5a0c65,_0x5123b3));};AGIChannel['prototype'][_0xfc4a('0x3d')]=function(_0x36fa1f){return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x36fa1f));};AGIChannel['prototype'][_0xfc4a('0x3e')]=function(_0x3b3493,_0x49f4e3,_0x58951e,_0x4cecb1,_0x3ed297,_0x5e8bef){_0x49f4e3=_0x49f4e3||_0xfc4a('0x3f');_0x58951e=_0x58951e||'';_0x4cecb1=_0x4cecb1===undefined?-0x1:_0x4cecb1==='-1'?-0x1:_0x4cecb1*0x3e8;_0x3ed297=_0x3ed297===undefined?'':'s='+_0x3ed297;_0x5e8bef=_0x5e8bef?_0xfc4a('0x40'):'';return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')](_0xfc4a('0x41'),_0x3b3493,_0x49f4e3,_0x58951e,_0x4cecb1,_0x5e8bef,_0x3ed297));};AGIChannel['prototype'][_0xfc4a('0x42')]=function(_0x29fd51,_0x13085e){_0x13085e=_0x13085e||'';return this[_0xfc4a('0x24')](util[_0xfc4a('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x29fd51,_0x13085e));};AGIChannel[_0xfc4a('0x23')]['agi']=function(_0x15b90f){return this[_0xfc4a('0x2c')](_0xfc4a('0x43'),_0x15b90f);};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x44')]=function(_0x5678e){return this[_0xfc4a('0x2c')](_0xfc4a('0x45'),_0x5678e);};AGIChannel[_0xfc4a('0x23')][_0xfc4a('0x1a')]=function(_0xb634aa,_0x512d7b){this['noop'](util[_0xfc4a('0x28')](_0xfc4a('0x46'),_0xb634aa['id'],_0xb634aa[_0xfc4a('0x47')],_0x512d7b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfc4a('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7042bad..39cd86c 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 _0x3e28=['E_AGI_UNDEFINED','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x536a45,_0x746b23){var _0x25fede=function(_0x42aa93){while(--_0x42aa93){_0x536a45['push'](_0x536a45['shift']());}};_0x25fede(++_0x746b23);}(_0x3e28,0x66));var _0x83e2=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x3e28[_0x2064e5];return _0x21a233;};'use strict';var util=require(_0x83e2('0x0'));var error={'E_AGI_UNDEFINED':_0x83e2('0x1'),'E_AGI_ARGUMENT_PORT':_0x83e2('0x2'),'E_AGI_SERVER_ERROR':_0x83e2('0x3'),'E_AGI_SERVER_CLOSE':_0x83e2('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x83e2('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':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x56dcda){var _0x56dcda=_0x56dcda||null,_0x42a285=_0x42a285||[],_0x56e3f2=0x1,_0x545949='';if(!error[_0x56dcda]){_0x56dcda=_0x83e2('0x6');}_0x42a285[_0x83e2('0x7')](error[_0x56dcda]);while(arguments[_0x56e3f2]){_0x42a285[_0x83e2('0x7')](arguments[_0x56e3f2]);_0x56e3f2++;}_0x545949=util[_0x83e2('0x8')][_0x83e2('0x9')](util,_0x42a285);this[_0x83e2('0xa')]=_0x545949;this[_0x83e2('0xb')]=_0x56dcda;}module['exports']=AGIError; \ No newline at end of file +var _0x46c6=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x32f3d3,_0x598398){var _0x543e6b=function(_0x6ba448){while(--_0x6ba448){_0x32f3d3['push'](_0x32f3d3['shift']());}};_0x543e6b(++_0x598398);}(_0x46c6,0x86));var _0x646c=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x46c6[_0x4fbfd9];return _0x31dc94;};'use strict';var util=require(_0x646c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x646c('0x1'),'E_AGI_SERVER_ERROR':_0x646c('0x2'),'E_AGI_SERVER_CLOSE':_0x646c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x646c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x646c('0x5'),'E_AGI_SOCKET_ERROR':_0x646c('0x6'),'E_AGI_SOCKET_CLOSE':_0x646c('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x646c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x646c('0x9'),'E_AGI_IVR_ENTRY':_0x646c('0xa')};function AGIError(_0xa230e7){var _0xa230e7=_0xa230e7||null,_0x197b2b=_0x197b2b||[],_0x2862ce=0x1,_0x4cdf88='';if(!error[_0xa230e7]){_0xa230e7=_0x646c('0xb');}_0x197b2b[_0x646c('0xc')](error[_0xa230e7]);while(arguments[_0x2862ce]){_0x197b2b['push'](arguments[_0x2862ce]);_0x2862ce++;}_0x4cdf88=util['format'][_0x646c('0xd')](util,_0x197b2b);this[_0x646c('0xe')]=_0x4cdf88;this[_0x646c('0xf')]=_0xa230e7;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8b445d0..693f3a8 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 _0xfe78=['defaults','redis','localhost','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','events','ioredis','../../config/environment'];(function(_0x31edd7,_0x540292){var _0x304c97=function(_0x36e67f){while(--_0x36e67f){_0x31edd7['push'](_0x31edd7['shift']());}};_0x304c97(++_0x540292);}(_0xfe78,0x1cb));var _0x8fe7=function(_0x2cab33,_0x31aabc){_0x2cab33=_0x2cab33-0x0;var _0x2b0dba=_0xfe78[_0x2cab33];return _0x2b0dba;};'use strict';var _=require('lodash');var EventEmitter=require(_0x8fe7('0x0'))['EventEmitter'];var Redis=require(_0x8fe7('0x1'));var AGIError=require('./error');var config=require(_0x8fe7('0x2'));config['redis']=_[_0x8fe7('0x3')](config[_0x8fe7('0x4')],{'host':_0x8fe7('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x8fe7('0x4')]);sub['subscribe'](_0x8fe7('0x6'),function(_0x1e9e6e){if(_0x1e9e6e)return eventEmitter[_0x8fe7('0x7')]('error',new AGIError(_0x8fe7('0x8'),_0x1e9e6e));});sub['on'](_0x8fe7('0x9'),function(_0x2b2536,_0x7f4381){if(_0x2b2536!==_0x8fe7('0x6'))return;try{var _0x378d66=JSON[_0x8fe7('0xa')](_0x7f4381);eventEmitter[_0x8fe7('0x7')](_0x8fe7('0xb'),_0x378d66);}catch(_0x3c6dbc){eventEmitter[_0x8fe7('0x7')](_0x8fe7('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x3c6dbc));}});module[_0x8fe7('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8a38=['E_AGI_SERVER_ERROR','exports','events','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','message','parse'];(function(_0x5c8761,_0x4ad0b9){var _0x5047a8=function(_0x5a5779){while(--_0x5a5779){_0x5c8761['push'](_0x5c8761['shift']());}};_0x5047a8(++_0x4ad0b9);}(_0x8a38,0x160));var _0x88a3=function(_0xe3b7bb,_0x263836){_0xe3b7bb=_0xe3b7bb-0x0;var _0x2df486=_0x8a38[_0xe3b7bb];return _0x2df486;};'use strict';var _=require('lodash');var EventEmitter=require(_0x88a3('0x0'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x88a3('0x1'));var config=require(_0x88a3('0x2'));config[_0x88a3('0x3')]=_[_0x88a3('0x4')](config[_0x88a3('0x3')],{'host':_0x88a3('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x88a3('0x6')](_0x88a3('0x7'),function(_0x68c14b){if(_0x68c14b)return eventEmitter[_0x88a3('0x8')](_0x88a3('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x68c14b));});sub['on'](_0x88a3('0xa'),function(_0x3adbab,_0x5d6467){if(_0x3adbab!==_0x88a3('0x7'))return;try{var _0x3ffcb1=JSON[_0x88a3('0xb')](_0x5d6467);eventEmitter[_0x88a3('0x8')]('projectUpdate',_0x3ffcb1);}catch(_0x4c39be){eventEmitter[_0x88a3('0x8')](_0x88a3('0x9'),new AGIError(_0x88a3('0xc'),_0x4c39be));}});module[_0x88a3('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 88c16e3..4e1e9f4 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 _0xa87d=['../../../config/logger','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','push','size','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','invalid','agicommand','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xa87d,0x104));var _0xda87=function(_0x5dee75,_0xf9fa2f){_0x5dee75=_0x5dee75-0x0;var _0x1cee6f=_0xa87d[_0x5dee75];return _0x1cee6f;};'use strict';var _=require(_0xda87('0x0'));var logger=require(_0xda87('0x1'))('agi');var verticesWithRetry=[_0xda87('0x2'),_0xda87('0x3'),_0xda87('0x4')];var Graph=function(){this[_0xda87('0x5')]={};this['edges']={};this[_0xda87('0x6')]=0x0;};Graph[_0xda87('0x7')][_0xda87('0x8')]=function(_0x2a44fd){this[_0xda87('0x5')][_0x2a44fd['id']]=_0x2a44fd;this[_0xda87('0x9')][_0x2a44fd['id']]=[];};Graph[_0xda87('0x7')]['addEdge']=function(_0x4826a8,_0x3128e5,_0x206912){this[_0xda87('0x9')][_0x4826a8][_0xda87('0xa')]({'target':_0x3128e5,'condition':_0x206912});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xda87('0xb')]=function(){return _[_0xda87('0xb')](this['vertices']);};Graph[_0xda87('0x7')][_0xda87('0xc')]=function(){return this[_0xda87('0x6')];};Graph[_0xda87('0x7')]['getVertex']=function(_0x403a70){return this[_0xda87('0x5')][_0x403a70];};Graph[_0xda87('0x7')][_0xda87('0xd')]=function(_0x18b06a,_0x14d978){if(!this['vertices'][_0x18b06a]){return logger[_0xda87('0xe')](_0xda87('0xf'));}var _0x1b3176=_0x14d978(this['vertices'][_0x18b06a]);if(!_0x1b3176){return logger[_0xda87('0xe')](_0xda87('0x10'));}if(this[_0xda87('0x9')][_0x18b06a][_0xda87('0x11')]===0x0){return logger[_0xda87('0xe')](_0xda87('0x12'));}for(var _0x21ec43=0x0,_0x3a6de8=[],_0x3de6b2=![];_0x21ec43\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[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','arg_1','uniqueid','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll'];(function(_0x3370db,_0x4cef12){var _0x260360=function(_0x4639d9){while(--_0x4639d9){_0x3370db['push'](_0x3370db['shift']());}};_0x260360(++_0x4cef12);}(_0x137d,0x13b));var _0xd137=function(_0xc80b2b,_0x5a12e9){_0xc80b2b=_0xc80b2b-0x0;var _0x22af6f=_0x137d[_0xc80b2b];return _0x22af6f;};'use strict';var _=require(_0xd137('0x0'));var syncho=require('syncho');var util=require(_0xd137('0x1'));var config=require(_0xd137('0x2'));var logger=require(_0xd137('0x3'))(_0xd137('0x4'));var utilLicense=require(_0xd137('0x5'));var rpc=require(_0xd137('0x6'));var Project=require(_0xd137('0x7'));var AGIEmitter=require(_0xd137('0x8'))[_0xd137('0x9')];var projects=[];config['agi']=_['defaults'](config[_0xd137('0x4')],{'ip':_0xd137('0xa'),'port':0x11dd});AGIEmitter['on'](_0xd137('0xb'),projectUpdateHandler);function connectionHandler(_0x16cd87){process[_0xd137('0xc')](function(){syncho(function(){try{setChannelVariables(_0x16cd87);agiHandler(_0x16cd87);}catch(_0x308adb){logger['error'](_0x308adb[_0xd137('0xd')]);}});});}function projectUpdateHandler(_0x26d0c9){try{var _0x1ae45d=_[_0xd137('0xe')](projects,['id',_0x26d0c9['id']]);if(_0x1ae45d>-0x1){if(_0x26d0c9[_0xd137('0xf')]===!![]){projects[_0xd137('0x10')](_0x1ae45d,0x1);}else{projects[_0x1ae45d]=_0x26d0c9;}}else{projects['push'](_0x26d0c9);}}catch(_0x4e90b7){logger[_0xd137('0x11')](_0x4e90b7['stack']);}}function listeningHandler(){console[_0xd137('0x12')](_0xd137('0x13'),config['agi'][_0xd137('0x14')]);logger[_0xd137('0x15')](util[_0xd137('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xd137('0x4')]['ip'],config[_0xd137('0x4')][_0xd137('0x14')]));}function errorHandler(_0x555608){if(_0x555608&&_0x555608[_0xd137('0x17')]&&_0x555608[_0xd137('0x18')]){logger['error'](util['format'](_0xd137('0x19'),_0x555608[_0xd137('0x17')],_0x555608[_0xd137('0x18')]));}else{logger['error'](util[_0xd137('0x16')](_0xd137('0x1a'),_0x555608[_0xd137('0xd')]));}}function closeHandler(){logger[_0xd137('0x15')](util[_0xd137('0x16')](_0xd137('0x1b'),this['arg_1'],this[_0xd137('0x1c')],this[_0xd137('0x1d')],this[_0xd137('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x4ed10c){logger[_0xd137('0x11')](_0x4ed10c['stack']);}}function timeoutHandler(){logger[_0xd137('0x15')](util[_0xd137('0x16')](_0xd137('0x1f'),this['arg_1'],this[_0xd137('0x1c')],this[_0xd137('0x1d')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xd137('0x15')](util[_0xd137('0x16')](_0xd137('0x20'),this[_0xd137('0x21')],this[_0xd137('0x1c')],this['callerid'],this[_0xd137('0x1e')],this[_0xd137('0x22')]));this['evtHangup']=!![];}function createSquareReport(_0x3a6388,_0x55a1f6){rpc['createSquareReport'](_0x3a6388)[_0xd137('0x23')](function(_0x4ddadd){if(_0x55a1f6){_0x55a1f6(null,_0x4ddadd);}})[_0xd137('0x24')](function(_0x5b10b9){if(_0x55a1f6){_0x55a1f6(null,_0x5b10b9);}});}function setChannelVariables(_0x17e6f4){for(var _0x2c576a in _0x17e6f4){if(_0x17e6f4[_0xd137('0x25')](_0x2c576a)){if(_0x2c576a[_0xd137('0x26')](_0xd137('0x27'))===0x0){_0x17e6f4[_0x2c576a[_0xd137('0x28')](0x4)]=_0x17e6f4[_0x2c576a];delete _0x17e6f4[_0x2c576a];}}}}function agiHandler(_0x1b8aa6){logger['debug'](_0xd137('0x29'),JSON[_0xd137('0x2a')](_0x1b8aa6,null,0x2));logger[_0xd137('0x15')](util[_0xd137('0x16')](_0xd137('0x2b'),_0x1b8aa6[_0xd137('0x21')],_0x1b8aa6['calleridname'],_0x1b8aa6[_0xd137('0x1d')],_0x1b8aa6[_0xd137('0x1e')],_0x1b8aa6[_0xd137('0x22')]));_0x1b8aa6['on'](_0xd137('0x11'),errorHandler);_0x1b8aa6['on']('close',closeHandler);_0x1b8aa6['on'](_0xd137('0x2c'),timeoutHandler);_0x1b8aa6['evtHangup']=![];_0x1b8aa6['on'](_0xd137('0x2d'),hangupHandler);var _0x423d27=_[_0xd137('0x2e')](projects,[_0xd137('0x17'),_0x1b8aa6[_0xd137('0x21')]]);if(!_0x423d27)return Project['handleNotFound'](_0x1b8aa6);if(!_0x423d27[_0xd137('0x2f')])return Project[_0xd137('0x30')](_0x1b8aa6);return Project[_0xd137('0x31')](_0x423d27,_0x1b8aa6);}function main(){var _0x23ef2c;return utilLicense[_0xd137('0x32')]()['then'](function(_0xa27bb9){if(!_0xa27bb9)return;if(_0xa27bb9[_0xd137('0x33')]){if(_0xa27bb9['callysquare']&&_0xa27bb9[_0xd137('0x34')]>0x0){logger['info'](util[_0xd137('0x16')](_0xd137('0x35'),_0xa27bb9[_0xd137('0x34')]));_0x23ef2c=_0xa27bb9[_0xd137('0x34')];}else{logger[_0xd137('0x15')](_0xd137('0x36'));}}else{logger[_0xd137('0x15')](_0xd137('0x37'));_0x23ef2c=-0x1;}})['then'](function(){return Project[_0xd137('0x38')]();})[_0xd137('0x23')](function(_0xd9d418){projects=_0xd9d418;return;})[_0xd137('0x24')](function(_0x5a52a9){logger[_0xd137('0x11')](_0xd137('0x39'),_0x5a52a9['stack']);})[_0xd137('0x3a')](function(){var _0x406ee6=require(_0xd137('0x3b'))(config[_0xd137('0x4')][_0xd137('0x14')],config[_0xd137('0x4')]['ip'],_0x23ef2c);_0x406ee6['on'](_0xd137('0x11'),errorHandler);_0x406ee6['on']('listening',listeningHandler);_0x406ee6['on'](_0xd137('0x3c'),connectionHandler);_0x406ee6['on'](_0xd137('0x3d'),closeHandler);});}main(); \ No newline at end of file +var _0x7f37=['nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','message','[%s]\x20%s','name','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','handleNotFound','production','handleUnpublished','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','./project','EventEmitter','defaults','projectUpdate'];(function(_0x1fec86,_0x422ed7){var _0x55e897=function(_0x5750ca){while(--_0x5750ca){_0x1fec86['push'](_0x1fec86['shift']());}};_0x55e897(++_0x422ed7);}(_0x7f37,0xde));var _0x77f3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7f37[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x77f3('0x0'));var syncho=require(_0x77f3('0x1'));var util=require(_0x77f3('0x2'));var config=require(_0x77f3('0x3'));var logger=require(_0x77f3('0x4'))(_0x77f3('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x77f3('0x6'));var AGIEmitter=require('./events')[_0x77f3('0x7')];var projects=[];config[_0x77f3('0x5')]=_[_0x77f3('0x8')](config[_0x77f3('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x77f3('0x9'),projectUpdateHandler);function connectionHandler(_0x2cf355){process[_0x77f3('0xa')](function(){syncho(function(){try{setChannelVariables(_0x2cf355);agiHandler(_0x2cf355);}catch(_0x1e7a83){logger[_0x77f3('0xb')](_0x1e7a83[_0x77f3('0xc')]);}});});}function projectUpdateHandler(_0x5b5cb3){try{var _0x2079a9=_[_0x77f3('0xd')](projects,['id',_0x5b5cb3['id']]);if(_0x2079a9>-0x1){if(_0x5b5cb3[_0x77f3('0xe')]===!![]){projects[_0x77f3('0xf')](_0x2079a9,0x1);}else{projects[_0x2079a9]=_0x5b5cb3;}}else{projects[_0x77f3('0x10')](_0x5b5cb3);}}catch(_0x2e9088){logger[_0x77f3('0xb')](_0x2e9088['stack']);}}function listeningHandler(){console[_0x77f3('0x11')](_0x77f3('0x12'),config[_0x77f3('0x5')][_0x77f3('0x13')]);logger['info'](util[_0x77f3('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x77f3('0x5')]['ip'],config[_0x77f3('0x5')][_0x77f3('0x13')]));}function errorHandler(_0x5819a2){if(_0x5819a2&&_0x5819a2['name']&&_0x5819a2[_0x77f3('0x15')]){logger['error'](util['format'](_0x77f3('0x16'),_0x5819a2[_0x77f3('0x17')],_0x5819a2['message']));}else{logger[_0x77f3('0xb')](util[_0x77f3('0x14')](_0x77f3('0x18'),_0x5819a2[_0x77f3('0xc')]));}}function closeHandler(){logger[_0x77f3('0x19')](util['format'](_0x77f3('0x1a'),this['arg_1'],this[_0x77f3('0x1b')],this[_0x77f3('0x1c')],this[_0x77f3('0x1d')],this[_0x77f3('0x1e')]));try{createSquareReport(this);}catch(_0x875217){logger['error'](_0x875217[_0x77f3('0xc')]);}}function timeoutHandler(){logger[_0x77f3('0x19')](util['format'](_0x77f3('0x1f'),this['arg_1'],this[_0x77f3('0x1b')],this[_0x77f3('0x1c')],this[_0x77f3('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x77f3('0x19')](util[_0x77f3('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x77f3('0x1b')],this[_0x77f3('0x1c')],this[_0x77f3('0x1d')],this[_0x77f3('0x1e')]));this[_0x77f3('0x20')]=!![];}function createSquareReport(_0x141306,_0x53545e){rpc[_0x77f3('0x21')](_0x141306)['then'](function(_0xbc9c86){if(_0x53545e){_0x53545e(null,_0xbc9c86);}})[_0x77f3('0x22')](function(_0x209b29){if(_0x53545e){_0x53545e(null,_0x209b29);}});}function setChannelVariables(_0x752bae){for(var _0x251631 in _0x752bae){if(_0x752bae[_0x77f3('0x23')](_0x251631)){if(_0x251631[_0x77f3('0x24')](_0x77f3('0x25'))===0x0){_0x752bae[_0x251631[_0x77f3('0x26')](0x4)]=_0x752bae[_0x251631];delete _0x752bae[_0x251631];}}}}function agiHandler(_0x218b11){logger['debug'](_0x77f3('0x27'),JSON[_0x77f3('0x28')](_0x218b11,null,0x2));logger[_0x77f3('0x19')](util[_0x77f3('0x14')](_0x77f3('0x29'),_0x218b11['arg_1'],_0x218b11['calleridname'],_0x218b11[_0x77f3('0x1c')],_0x218b11[_0x77f3('0x1d')],_0x218b11['uniqueid']));_0x218b11['on']('error',errorHandler);_0x218b11['on'](_0x77f3('0x2a'),closeHandler);_0x218b11['on']('timeout',timeoutHandler);_0x218b11[_0x77f3('0x20')]=![];_0x218b11['on'](_0x77f3('0x2b'),hangupHandler);var _0x56c5bf=_['find'](projects,['name',_0x218b11['arg_1']]);if(!_0x56c5bf)return Project[_0x77f3('0x2c')](_0x218b11);if(!_0x56c5bf[_0x77f3('0x2d')])return Project[_0x77f3('0x2e')](_0x218b11);return Project['initialize'](_0x56c5bf,_0x218b11);}function main(){var _0x141ae4;return utilLicense[_0x77f3('0x2f')]()[_0x77f3('0x30')](function(_0x4c37b0){if(!_0x4c37b0)return;if(_0x4c37b0[_0x77f3('0x31')]){if(_0x4c37b0[_0x77f3('0x32')]&&_0x4c37b0[_0x77f3('0x32')]>0x0){logger[_0x77f3('0x19')](util[_0x77f3('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4c37b0[_0x77f3('0x32')]));_0x141ae4=_0x4c37b0[_0x77f3('0x32')];}else{logger[_0x77f3('0x19')](_0x77f3('0x33'));}}else{logger[_0x77f3('0x19')](_0x77f3('0x34'));_0x141ae4=-0x1;}})['then'](function(){return Project['getAll']();})[_0x77f3('0x30')](function(_0x339924){projects=_0x339924;return;})[_0x77f3('0x22')](function(_0x1743a1){logger[_0x77f3('0xb')](_0x77f3('0x35'),_0x1743a1['stack']);})[_0x77f3('0x36')](function(){var _0x3d8cdd=require(_0x77f3('0x37'))(config[_0x77f3('0x5')]['port'],config[_0x77f3('0x5')]['ip'],_0x141ae4);_0x3d8cdd['on'](_0x77f3('0xb'),errorHandler);_0x3d8cdd['on'](_0x77f3('0x38'),listeningHandler);_0x3d8cdd['on'](_0x77f3('0x39'),connectionHandler);_0x3d8cdd['on'](_0x77f3('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 2853018..c00c7c1 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 _0xa4d4=['request','error','message','result','catch','sendMailMessage','SendMail','http'];(function(_0x47d060,_0x4a2b1d){var _0xb2d051=function(_0x3434e7){while(--_0x3434e7){_0x47d060['push'](_0x47d060['shift']());}};_0xb2d051(++_0x4a2b1d);}(_0xa4d4,0x1df));var _0x4a4d=function(_0x3d38b1,_0xa516ca){_0x3d38b1=_0x3d38b1-0x0;var _0x3219ab=_0xa4d4[_0x3d38b1];return _0x3219ab;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0x4a4d('0x0')]({'port':0x232b});function request(_0x54e29b,_0x312d4f){return new BPromise(function(_0x27e4a3,_0x514e23){return client[_0x4a4d('0x1')](_0x54e29b,_0x312d4f)['then'](function(_0x556555){if(_0x556555[_0x4a4d('0x2')]){return _0x514e23(_0x556555['error'][_0x4a4d('0x3')]);}else{return _0x27e4a3(_0x556555[_0x4a4d('0x4')]);}})[_0x4a4d('0x5')](function(_0x3d893b){return _0x514e23(_0x3d893b);});});}exports[_0x4a4d('0x6')]=function(_0x519d30,_0x4a9ab9){return request(_0x4a4d('0x7'),{'account':_0x519d30,'message':_0x4a9ab9});}; \ No newline at end of file +var _0xb0bb=['SendMail','bluebird','jayson/promise','client','request','then','error','message','result','catch','sendMailMessage'];(function(_0x160814,_0x57b5c6){var _0x427a69=function(_0x3f1485){while(--_0x3f1485){_0x160814['push'](_0x160814['shift']());}};_0x427a69(++_0x57b5c6);}(_0xb0bb,0x1e5));var _0xbb0b=function(_0x2446bd,_0x3d3c72){_0x2446bd=_0x2446bd-0x0;var _0x2c16a5=_0xb0bb[_0x2446bd];return _0x2c16a5;};'use strict';var BPromise=require(_0xbb0b('0x0'));var jayson=require(_0xbb0b('0x1'));var client=jayson[_0xbb0b('0x2')]['http']({'port':0x232b});function request(_0x41224d,_0x265285){return new BPromise(function(_0x289360,_0x1afebf){return client[_0xbb0b('0x3')](_0x41224d,_0x265285)[_0xbb0b('0x4')](function(_0x1eeed3){if(_0x1eeed3[_0xbb0b('0x5')]){return _0x1afebf(_0x1eeed3['error'][_0xbb0b('0x6')]);}else{return _0x289360(_0x1eeed3[_0xbb0b('0x7')]);}})[_0xbb0b('0x8')](function(_0x5ac742){return _0x1afebf(_0x5ac742);});});}exports[_0xbb0b('0x9')]=function(_0x4e0720,_0x419597){return request(_0xbb0b('0xa'),{'account':_0x4e0720,'message':_0x419597});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 1c6a749..5408ed4 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 _0x1b82=['vertex','isUndefined','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','exports','lodash','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','isArray','length','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','format','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1'];(function(_0x21b75e,_0x80026a){var _0x4bf785=function(_0x1aad97){while(--_0x1aad97){_0x21b75e['push'](_0x21b75e['shift']());}};_0x4bf785(++_0x80026a);}(_0x1b82,0xc0));var _0x21b8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1b82[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x21b8('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0x21b8('0x1'))('agi');var rpc=require(_0x21b8('0x2'));var mailRpc=require(_0x21b8('0x3'));var Graph=require(_0x21b8('0x4'));var Vertices=require(_0x21b8('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x21b8('0x6')]()[_0x21b8('0x7')](function(_0x17439c){logger[_0x21b8('0x8')](_0x21b8('0x9'),_0x17439c[_0x21b8('0xa')]);return[];});}function addVertex(_0x433c65,_0x2319cd,_0xa13cf6){_0x2319cd[_0x21b8('0xb')]=_0xa13cf6;if(_0x2319cd[_0x21b8('0xc')]('retry')){_0x2319cd['maxRetry']=parseInt(_0x2319cd[_0x21b8('0xd')],0xa);}_0x433c65['addVertex'](_[_0x21b8('0xe')](_0x2319cd,'mxCell'));}function initGraph(_0x14f448,_0xf290f2){var _0x2f2acf=new Graph();for(var _0x221c1a in _0x14f448){if(_0x14f448['hasOwnProperty'](_0x221c1a)){if(_[_0x21b8('0xf')](_0x14f448[_0x221c1a])){for(var _0x52b398=0x0;_0x52b398<_0x14f448[_0x221c1a][_0x21b8('0x10')];_0x52b398+=0x1){addVertex(_0x2f2acf,_0x14f448[_0x221c1a][_0x52b398],_0x221c1a);}}else{addVertex(_0x2f2acf,_0x14f448[_0x221c1a],_0x221c1a);}}}for(var _0x21d6a1=0x0;_0x21d6a1<_0xf290f2[_0x21b8('0x10')];_0x21d6a1+=0x1){if(_0xf290f2[_0x21d6a1]['source']&&_0xf290f2[_0x21d6a1][_0x21b8('0x11')]){_0x2f2acf[_0x21b8('0x12')](_0xf290f2[_0x21d6a1]['source'],_0xf290f2[_0x21d6a1]['target'],_0xf290f2[_0x21d6a1][_0x21b8('0x13')]);}}return _0x2f2acf;}function getRoot(_0x55984b){return parser[_0x21b8('0x14')](_0x55984b,{'object':!![]})[_0x21b8('0x15')][_0x21b8('0x16')];}function inspect(_0x44ae97){return util[_0x21b8('0x17')](_0x44ae97,{'showHidden':![],'depth':null});}function initialize(_0x3b684b,_0x23972f){var _0x21dcd3=getRoot(_0x3b684b[_0x21b8('0x18')]);if(!_0x21dcd3||!_0x21dcd3[_0x21b8('0x19')])return;var _0x312359,_0x5c0792,_0x4eb0e6;logger[_0x21b8('0x1a')](_0x21b8('0x16'),JSON[_0x21b8('0x1b')](_0x21dcd3,null,0x2));_0x23972f[_0x21b8('0x1c')]=moment()['format'](_0x21b8('0x1d'));_0x312359=initGraph(_[_0x21b8('0xe')](_0x21dcd3,_0x21b8('0x1e')),_0x21dcd3[_0x21b8('0x1e')]);_0x5c0792=new Vertices(_0x23972f,rpc,mailRpc);logger[_0x21b8('0x1f')](util[_0x21b8('0x20')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x23972f['arg_1'],_0x23972f[_0x21b8('0x21')],_0x23972f[_0x21b8('0x22')],_0x23972f[_0x21b8('0x23')],_0x23972f[_0x21b8('0x24')]));_0x312359[_0x21b8('0x25')](_0x21dcd3['start']['id'],function(_0x1519d5){try{_0x1519d5=_0x5c0792[_0x21b8('0x26')](_0x1519d5);logger['debug']('vertex',JSON[_0x21b8('0x1b')](_0x1519d5,null,0x2));if(_0x1519d5[_0x21b8('0xb')]===_0x21b8('0x27')){logger[_0x21b8('0x1f')](_0x21b8('0x28'));_0x23972f['context']=_0x1519d5[_0x21b8('0x29')]||_0x23972f[_0x21b8('0x29')];_0x23972f[_0x21b8('0x2a')]=_0x1519d5[_0x21b8('0x2a')];_0x23972f['priority']=_0x1519d5[_0x21b8('0x2b')]?_0x1519d5[_0x21b8('0x2b')]-0x1:0x1;return null;}else if(_0x1519d5&&_0x5c0792[_0x1519d5[_0x21b8('0xb')]]){_0x4eb0e6=_0x5c0792[_0x1519d5[_0x21b8('0xb')]](_0x1519d5);logger['info'](_0x21b8('0x2c'),JSON[_0x21b8('0x1b')](_0x4eb0e6,null,0x2));if(_0x4eb0e6&&_0x4eb0e6[_0x21b8('0x2d')]===AGI_CODE_SUCCESS&&_0x4eb0e6[_0x21b8('0x2e')]!==AGI_RESULT_ERROR&&!_0x23972f[_0x21b8('0x2f')]){logger[_0x21b8('0x1a')](_0x21b8('0x2c'),inspect(_0x4eb0e6));return _['isUndefined'](_0x4eb0e6[_0x21b8('0x2e')])?null:_0x4eb0e6['result']['toString']();}else{logger[_0x21b8('0x8')](_0x21b8('0x2c'),inspect(_0x4eb0e6));return null;}}else{logger[_0x21b8('0x8')](_0x21b8('0x30'));return null;}}catch(_0x2a4d35){logger[_0x21b8('0x8')](_0x2a4d35['stack']);return null;}});if(_0x21dcd3[_0x21b8('0x31')]){logger['info'](util[_0x21b8('0x20')](_0x21b8('0x32'),_0x23972f[_0x21b8('0x33')],_0x23972f[_0x21b8('0x21')],_0x23972f[_0x21b8('0x22')],_0x23972f[_0x21b8('0x23')],_0x23972f[_0x21b8('0x24')]));_0x312359[_0x21b8('0x25')](_0x21dcd3[_0x21b8('0x31')]['id'],function(_0xeb7e4f){try{_0xeb7e4f=_0x5c0792['clear'](_0xeb7e4f);logger[_0x21b8('0x1a')](_0x21b8('0x34'),JSON[_0x21b8('0x1b')](_0xeb7e4f,null,0x2));if(_0xeb7e4f&&_0x5c0792[_0xeb7e4f['agicommand']]){_0x4eb0e6=_0x5c0792[_0xeb7e4f[_0x21b8('0xb')]](_0xeb7e4f);if(_0x4eb0e6){logger['debug'](_0x21b8('0x2c'),inspect(_0x4eb0e6));return _[_0x21b8('0x35')](_0x4eb0e6[_0x21b8('0x2e')])?null:_0x4eb0e6['result'][_0x21b8('0x36')]();}else{logger['error'](_0x21b8('0x2c'),inspect(_0x4eb0e6));return null;}}else{logger['error'](_0x21b8('0x30'));return null;}}catch(_0x35f79d){logger[_0x21b8('0x8')](_0x35f79d[_0x21b8('0xa')]);return null;}});}logger[_0x21b8('0x1f')](util['format'](_0x21b8('0x37'),_0x23972f[_0x21b8('0x33')],_0x23972f[_0x21b8('0x21')],_0x23972f[_0x21b8('0x22')],_0x23972f['dnid'],_0x23972f[_0x21b8('0x24')]));logger[_0x21b8('0x1f')](util[_0x21b8('0x20')](_0x21b8('0x38'),_0x23972f['context'],_0x23972f['extension'],parseInt(_0x23972f[_0x21b8('0x2b')],0xa)+0x1));_0x23972f['continueAt'](_0x23972f[_0x21b8('0x29')],_0x23972f[_0x21b8('0x2a')],parseInt(_0x23972f[_0x21b8('0x2b')],0xa)+0x1);_0x23972f[_0x21b8('0x39')]();}function handleNotFound(_0x14ee28){logger['error'](util[_0x21b8('0x20')](_0x21b8('0x3a'),_0x14ee28[_0x21b8('0x33')]));_0x14ee28[_0x21b8('0x3b')](_0x14ee28[_0x21b8('0x29')],_0x14ee28['extension'],parseInt(_0x14ee28[_0x21b8('0x2b')],0xa)+0x1);_0x14ee28[_0x21b8('0x39')]();}function handleUnpublished(_0x1c1dff){logger[_0x21b8('0x8')](util[_0x21b8('0x20')]('Project\x20%s\x20not\x20published',_0x1c1dff[_0x21b8('0x33')]));_0x1c1dff[_0x21b8('0x3b')](_0x1c1dff[_0x21b8('0x29')],_0x1c1dff[_0x21b8('0x2a')],parseInt(_0x1c1dff[_0x21b8('0x2b')],0xa)+0x1);_0x1c1dff[_0x21b8('0x39')]();}module[_0x21b8('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xaf73=['traverseBFS','start','clear','debug','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','toJson','root','production','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid'];(function(_0x300870,_0x21ecba){var _0x21bad2=function(_0x55d124){while(--_0x55d124){_0x300870['push'](_0x300870['shift']());}};_0x21bad2(++_0x21ecba);}(_0xaf73,0x113));var _0x3af7=function(_0xb39895,_0x2d22d4){_0xb39895=_0xb39895-0x0;var _0x286310=_0xaf73[_0xb39895];return _0x286310;};'use strict';var _=require(_0x3af7('0x0'));var moment=require(_0x3af7('0x1'));var parser=require('xml2json');var util=require(_0x3af7('0x2'));var logger=require('../../config/logger')(_0x3af7('0x3'));var rpc=require(_0x3af7('0x4'));var mailRpc=require(_0x3af7('0x5'));var Graph=require(_0x3af7('0x6'));var Vertices=require(_0x3af7('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3af7('0x8')]()[_0x3af7('0x9')](function(_0x829c0e){logger[_0x3af7('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x829c0e[_0x3af7('0xb')]);return[];});}function addVertex(_0x26318a,_0x20b02e,_0x770d81){_0x20b02e['agicommand']=_0x770d81;if(_0x20b02e[_0x3af7('0xc')](_0x3af7('0xd'))){_0x20b02e[_0x3af7('0xe')]=parseInt(_0x20b02e[_0x3af7('0xd')],0xa);}_0x26318a[_0x3af7('0xf')](_[_0x3af7('0x10')](_0x20b02e,'mxCell'));}function initGraph(_0x3e32a7,_0x20f513){var _0x440799=new Graph();for(var _0x4202c1 in _0x3e32a7){if(_0x3e32a7[_0x3af7('0xc')](_0x4202c1)){if(_[_0x3af7('0x11')](_0x3e32a7[_0x4202c1])){for(var _0x408de8=0x0;_0x408de8<_0x3e32a7[_0x4202c1]['length'];_0x408de8+=0x1){addVertex(_0x440799,_0x3e32a7[_0x4202c1][_0x408de8],_0x4202c1);}}else{addVertex(_0x440799,_0x3e32a7[_0x4202c1],_0x4202c1);}}}for(var _0x1d7f93=0x0;_0x1d7f93<_0x20f513[_0x3af7('0x12')];_0x1d7f93+=0x1){if(_0x20f513[_0x1d7f93][_0x3af7('0x13')]&&_0x20f513[_0x1d7f93][_0x3af7('0x14')]){_0x440799['addEdge'](_0x20f513[_0x1d7f93][_0x3af7('0x13')],_0x20f513[_0x1d7f93][_0x3af7('0x14')],_0x20f513[_0x1d7f93]['value']);}}return _0x440799;}function getRoot(_0x5a8cb6){return parser[_0x3af7('0x15')](_0x5a8cb6,{'object':!![]})['mxGraphModel'][_0x3af7('0x16')];}function inspect(_0xe71685){return util['inspect'](_0xe71685,{'showHidden':![],'depth':null});}function initialize(_0x120661,_0x4d6ad8){var _0x574ef7=getRoot(_0x120661[_0x3af7('0x17')]);if(!_0x574ef7||!_0x574ef7['start'])return;var _0x41d074,_0x4f48a9,_0xc00fe5;logger['debug'](_0x3af7('0x16'),JSON[_0x3af7('0x18')](_0x574ef7,null,0x2));_0x4d6ad8[_0x3af7('0x19')]=moment()[_0x3af7('0x1a')](_0x3af7('0x1b'));_0x41d074=initGraph(_[_0x3af7('0x10')](_0x574ef7,_0x3af7('0x1c')),_0x574ef7['mxCell']);_0x4f48a9=new Vertices(_0x4d6ad8,rpc,mailRpc);logger[_0x3af7('0x1d')](util[_0x3af7('0x1a')](_0x3af7('0x1e'),_0x4d6ad8[_0x3af7('0x1f')],_0x4d6ad8[_0x3af7('0x20')],_0x4d6ad8['callerid'],_0x4d6ad8[_0x3af7('0x21')],_0x4d6ad8[_0x3af7('0x22')]));_0x41d074[_0x3af7('0x23')](_0x574ef7[_0x3af7('0x24')]['id'],function(_0xa835fa){try{_0xa835fa=_0x4f48a9[_0x3af7('0x25')](_0xa835fa);logger[_0x3af7('0x26')]('vertex',JSON['stringify'](_0xa835fa,null,0x2));if(_0xa835fa[_0x3af7('0x27')]===_0x3af7('0x28')){logger[_0x3af7('0x1d')](_0x3af7('0x29'));_0x4d6ad8[_0x3af7('0x2a')]=_0xa835fa['context']||_0x4d6ad8[_0x3af7('0x2a')];_0x4d6ad8[_0x3af7('0x2b')]=_0xa835fa[_0x3af7('0x2b')];_0x4d6ad8[_0x3af7('0x2c')]=_0xa835fa[_0x3af7('0x2c')]?_0xa835fa[_0x3af7('0x2c')]-0x1:0x1;return null;}else if(_0xa835fa&&_0x4f48a9[_0xa835fa[_0x3af7('0x27')]]){_0xc00fe5=_0x4f48a9[_0xa835fa[_0x3af7('0x27')]](_0xa835fa);logger[_0x3af7('0x1d')](_0x3af7('0x2d'),JSON[_0x3af7('0x18')](_0xc00fe5,null,0x2));if(_0xc00fe5&&_0xc00fe5['code']===AGI_CODE_SUCCESS&&_0xc00fe5[_0x3af7('0x2e')]!==AGI_RESULT_ERROR&&!_0x4d6ad8[_0x3af7('0x2f')]){logger[_0x3af7('0x26')](_0x3af7('0x2d'),inspect(_0xc00fe5));return _[_0x3af7('0x30')](_0xc00fe5[_0x3af7('0x2e')])?null:_0xc00fe5['result'][_0x3af7('0x31')]();}else{logger[_0x3af7('0xa')](_0x3af7('0x2d'),inspect(_0xc00fe5));return null;}}else{logger[_0x3af7('0xa')](_0x3af7('0x32'));return null;}}catch(_0x5c1d17){logger['error'](_0x5c1d17[_0x3af7('0xb')]);return null;}});if(_0x574ef7[_0x3af7('0x33')]){logger[_0x3af7('0x1d')](util[_0x3af7('0x1a')](_0x3af7('0x34'),_0x4d6ad8['arg_1'],_0x4d6ad8[_0x3af7('0x20')],_0x4d6ad8[_0x3af7('0x35')],_0x4d6ad8[_0x3af7('0x21')],_0x4d6ad8[_0x3af7('0x22')]));_0x41d074['traverseBFS'](_0x574ef7[_0x3af7('0x33')]['id'],function(_0x264f3d){try{_0x264f3d=_0x4f48a9[_0x3af7('0x25')](_0x264f3d);logger[_0x3af7('0x26')](_0x3af7('0x36'),JSON[_0x3af7('0x18')](_0x264f3d,null,0x2));if(_0x264f3d&&_0x4f48a9[_0x264f3d[_0x3af7('0x27')]]){_0xc00fe5=_0x4f48a9[_0x264f3d[_0x3af7('0x27')]](_0x264f3d);if(_0xc00fe5){logger[_0x3af7('0x26')]('response',inspect(_0xc00fe5));return _[_0x3af7('0x30')](_0xc00fe5[_0x3af7('0x2e')])?null:_0xc00fe5[_0x3af7('0x2e')][_0x3af7('0x31')]();}else{logger[_0x3af7('0xa')](_0x3af7('0x2d'),inspect(_0xc00fe5));return null;}}else{logger[_0x3af7('0xa')](_0x3af7('0x32'));return null;}}catch(_0x337a31){logger['error'](_0x337a31[_0x3af7('0xb')]);return null;}});}logger[_0x3af7('0x1d')](util['format'](_0x3af7('0x37'),_0x4d6ad8['arg_1'],_0x4d6ad8[_0x3af7('0x20')],_0x4d6ad8['callerid'],_0x4d6ad8[_0x3af7('0x21')],_0x4d6ad8[_0x3af7('0x22')]));logger[_0x3af7('0x1d')](util[_0x3af7('0x1a')](_0x3af7('0x38'),_0x4d6ad8['context'],_0x4d6ad8[_0x3af7('0x2b')],parseInt(_0x4d6ad8[_0x3af7('0x2c')],0xa)+0x1));_0x4d6ad8['continueAt'](_0x4d6ad8['context'],_0x4d6ad8[_0x3af7('0x2b')],parseInt(_0x4d6ad8['priority'],0xa)+0x1);_0x4d6ad8[_0x3af7('0x39')]();}function handleNotFound(_0x466e50){logger[_0x3af7('0xa')](util['format'](_0x3af7('0x3a'),_0x466e50['arg_1']));_0x466e50[_0x3af7('0x3b')](_0x466e50[_0x3af7('0x2a')],_0x466e50[_0x3af7('0x2b')],parseInt(_0x466e50['priority'],0xa)+0x1);_0x466e50[_0x3af7('0x39')]();}function handleUnpublished(_0xef51fe){logger['error'](util['format'](_0x3af7('0x3c'),_0xef51fe[_0x3af7('0x1f')]));_0xef51fe['continueAt'](_0xef51fe['context'],_0xef51fe[_0x3af7('0x2b')],parseInt(_0xef51fe['priority'],0xa)+0x1);_0xef51fe[_0x3af7('0x39')]();}module[_0x3af7('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b619f5c..57462b4 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 _0x5668=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','emit','headers','line','exports','util','stream','Transform','call','_localBuffer'];(function(_0x5223dd,_0x46cf50){var _0x4b4077=function(_0x17e3d6){while(--_0x17e3d6){_0x5223dd['push'](_0x5223dd['shift']());}};_0x4b4077(++_0x46cf50);}(_0x5668,0x8b));var _0x8566=function(_0x5e52d4,_0x5eb25e){_0x5e52d4=_0x5e52d4-0x0;var _0x440ea9=_0x5668[_0x5e52d4];return _0x440ea9;};'use strict';var util=require(_0x8566('0x0'));var Transform=require(_0x8566('0x1'))[_0x8566('0x2')];function AGIReply(_0x3297a3){Transform[_0x8566('0x3')](this,_0x3297a3);this[_0x8566('0x4')]='';this[_0x8566('0x5')]=![];}util[_0x8566('0x6')](AGIReply,Transform);AGIReply[_0x8566('0x7')][_0x8566('0x8')]=function(_0x174099,_0x1a25d0,_0x2f958c){var _0x4885d6='\x0a',_0x355fce=['\x0a\x0a',_0x8566('0x9')],_0x2ffec4=-0x1,_0x49f55a=-0x1,_0x4aaf3f='',_0x4045ed=0x0,_0x4cbf90='',_0x555ffa='';this['_localBuffer']+=_0x174099[_0x8566('0xa')]();_0x4cbf90=this[_0x8566('0x4')];if(!this[_0x8566('0x5')]){_0x4045ed=0x0;while(_0x355fce[_0x4045ed]){while((_0x49f55a=_0x4cbf90['indexOf'](_0x355fce[_0x4045ed]))!=-0x1){_0x4aaf3f=_0x355fce[_0x4045ed];_0x555ffa=_0x4cbf90[_0x8566('0xb')](0x0,_0x49f55a);_0x4cbf90=_0x4cbf90[_0x8566('0xb')](_0x49f55a+_0x4aaf3f['length']);var _0x4ca241=_0x555ffa[_0x8566('0xc')](_0x4885d6),_0x51c3ba=0x0,_0x522618={},_0x11e0a5='',_0x3318a3='',_0x2025a2=-0x1;while(_0x4ca241[_0x51c3ba]){_0x2025a2=_0x4ca241[_0x51c3ba][_0x8566('0xd')](':');if(_0x2025a2!=-0x1){_0x11e0a5=_0x4ca241[_0x51c3ba]['slice'](0x0,_0x2025a2)['trim']();_0x3318a3=_0x4ca241[_0x51c3ba]['slice'](_0x2025a2+0x1)['trim']();if(_0x11e0a5['length']>0x0){_0x522618[_0x11e0a5]=_0x3318a3;}}else{}_0x51c3ba++;}this[_0x8566('0xe')](_0x8566('0xf'),_0x522618);this[_0x8566('0x5')]=!![];}_0x4045ed++;}this[_0x8566('0x4')]=_0x4cbf90;}else{while((_0x2ffec4=_0x4cbf90[_0x8566('0xd')](_0x4885d6))!=-0x1){_0x555ffa=_0x4cbf90['substring'](0x0,_0x2ffec4);this[_0x8566('0xe')](_0x8566('0x10'),_0x555ffa);_0x4cbf90=_0x4cbf90[_0x8566('0xb')](_0x2ffec4+_0x4885d6['length']);}this[_0x8566('0x4')]=_0x4cbf90;}_0x2f958c();};module[_0x8566('0x11')]=AGIReply; \ No newline at end of file +var _0xb226=['stream','Transform','call','_inBody','inherits','prototype','_transform','_localBuffer','substring','length','split','indexOf','slice','trim','headers','emit','line','exports','util'];(function(_0x4fcc05,_0x531262){var _0x38a9eb=function(_0x565d6b){while(--_0x565d6b){_0x4fcc05['push'](_0x4fcc05['shift']());}};_0x38a9eb(++_0x531262);}(_0xb226,0x11c));var _0x6b22=function(_0x435193,_0x24b26b){_0x435193=_0x435193-0x0;var _0x429c61=_0xb226[_0x435193];return _0x429c61;};'use strict';var util=require(_0x6b22('0x0'));var Transform=require(_0x6b22('0x1'))[_0x6b22('0x2')];function AGIReply(_0x51edf6){Transform[_0x6b22('0x3')](this,_0x51edf6);this['_localBuffer']='';this[_0x6b22('0x4')]=![];}util[_0x6b22('0x5')](AGIReply,Transform);AGIReply[_0x6b22('0x6')][_0x6b22('0x7')]=function(_0x501ed5,_0x3e8fb7,_0x1a7574){var _0x3edcd0='\x0a',_0x38fd1f=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x412fa4=-0x1,_0x221f3f=-0x1,_0x1bc8a7='',_0x255010=0x0,_0x219a88='',_0x7c5fa4='';this[_0x6b22('0x8')]+=_0x501ed5['toString']();_0x219a88=this[_0x6b22('0x8')];if(!this[_0x6b22('0x4')]){_0x255010=0x0;while(_0x38fd1f[_0x255010]){while((_0x221f3f=_0x219a88['indexOf'](_0x38fd1f[_0x255010]))!=-0x1){_0x1bc8a7=_0x38fd1f[_0x255010];_0x7c5fa4=_0x219a88[_0x6b22('0x9')](0x0,_0x221f3f);_0x219a88=_0x219a88['substring'](_0x221f3f+_0x1bc8a7[_0x6b22('0xa')]);var _0x121148=_0x7c5fa4[_0x6b22('0xb')](_0x3edcd0),_0x427fbb=0x0,_0x3e69db={},_0x1d3e25='',_0x2ad007='',_0xe26e19=-0x1;while(_0x121148[_0x427fbb]){_0xe26e19=_0x121148[_0x427fbb][_0x6b22('0xc')](':');if(_0xe26e19!=-0x1){_0x1d3e25=_0x121148[_0x427fbb][_0x6b22('0xd')](0x0,_0xe26e19)[_0x6b22('0xe')]();_0x2ad007=_0x121148[_0x427fbb]['slice'](_0xe26e19+0x1)[_0x6b22('0xe')]();if(_0x1d3e25[_0x6b22('0xa')]>0x0){_0x3e69db[_0x1d3e25]=_0x2ad007;}}else{}_0x427fbb++;}this['emit'](_0x6b22('0xf'),_0x3e69db);this['_inBody']=!![];}_0x255010++;}this['_localBuffer']=_0x219a88;}else{while((_0x412fa4=_0x219a88['indexOf'](_0x3edcd0))!=-0x1){_0x7c5fa4=_0x219a88[_0x6b22('0x9')](0x0,_0x412fa4);this[_0x6b22('0x10')](_0x6b22('0x11'),_0x7c5fa4);_0x219a88=_0x219a88[_0x6b22('0x9')](_0x412fa4+_0x3edcd0['length']);}this[_0x6b22('0x8')]=_0x219a88;}_0x1a7574();};module[_0x6b22('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 8340f85..3898fab 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 _0xf874=['CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','then','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x3ce478,_0x3ef794){var _0x4280dd=function(_0x1140c0){while(--_0x1140c0){_0x3ce478['push'](_0x3ce478['shift']());}};_0x4280dd(++_0x3ef794);}(_0xf874,0x177));var _0x4f87=function(_0xa89bfe,_0x4b6ea2){_0xa89bfe=_0xa89bfe-0x0;var _0x42fba2=_0xf874[_0xa89bfe];return _0x42fba2;};'use strict';var _=require(_0x4f87('0x0'));var moment=require('moment');var jayson=require(_0x4f87('0x1'));var client=jayson[_0x4f87('0x2')][_0x4f87('0x3')]({'port':0x2329});function request(_0xe07d73,_0x18fe31){return new Promise(function(_0xe4464e,_0x87123d){return client['request'](_0xe07d73,_0x18fe31)[_0x4f87('0x4')](function(_0xe6e413){if(_0xe6e413['error']){return _0x87123d(_0xe6e413['error']['message']);}else{return _0xe4464e(_0xe6e413['result']);}})['catch'](function(_0x2aeac4){return _0x87123d(_0x2aeac4);});});}exports['getSquareProjects']=function(){return request(_0x4f87('0x5'),{'options':{'raw':![],'attributes':['id',_0x4f87('0x6'),_0x4f87('0x7')]}});};exports[_0x4f87('0x8')]=function(_0x4dfb28){return request(_0x4f87('0x9'),{'options':{'raw':![],'where':{'name':_0x4dfb28},'attributes':[_0x4f87('0x7')]}});};exports[_0x4f87('0xa')]=function(_0x1777bb){return request(_0x4f87('0xb'),{'options':{'raw':![],'where':{'id':_0x1777bb},'include':[{'model':_0x4f87('0xc'),'as':_0x4f87('0xd'),'include':[{'model':_0x4f87('0xe'),'as':_0x4f87('0xe')}]}],'attributes':['id',_0x4f87('0x6'),_0x4f87('0xf')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2ccfda){return request(_0x4f87('0x9'),{'options':{'where':{'id':_0x2ccfda},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x1dcbf9){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1dcbf9},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x10')]=function(_0x24ac31){return request(_0x4f87('0x11'),{'options':{'where':{'id':_0x24ac31},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x12')]=function(_0x3c327b){return request(_0x4f87('0x13'),{'options':{'where':{'id':_0x3c327b},'attributes':[_0x4f87('0x14')]}});};exports[_0x4f87('0x15')]=function(_0x3ffd7b){return request(_0x4f87('0x16'),{'options':{'where':{'id':_0x3ffd7b},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x17')]=function(_0x8b401b){return request(_0x4f87('0x18'),{'options':{'where':{'phone':_0x8b401b[_0x4f87('0x19')]},'attributes':['id']}});};exports[_0x4f87('0x1a')]=function(_0x135f44){return request('ShowTrunk',{'options':{'where':{'id':_0x135f44},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x1b')]=function(_0x4f1934){return request(_0x4f87('0x1c'),{'options':{'where':{'id':_0x4f1934},'attributes':[_0x4f87('0x1d')]}});};exports['getIntervalById']=function(_0x26ac97){return request(_0x4f87('0x1e'),{'options':{'raw':![],'where':{'id':_0x26ac97},'include':[{'model':_0x4f87('0x1f'),'as':_0x4f87('0x20')}]}});};exports['getSmsAccountById']=function(_0x2eded4){return request(_0x4f87('0x21'),{'options':{'where':{'id':_0x2eded4},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x345622){return request(_0x4f87('0x22'),{'body':_0x345622});};exports[_0x4f87('0x23')]=function(_0x1179eb){return request(_0x4f87('0x24'),{'body':_0x1179eb});};exports[_0x4f87('0x25')]=function(_0x23ce03){return request(_0x4f87('0x26'),{'body':_['merge'](_0x23ce03,{'project_name':_0x23ce03[_0x4f87('0x27')],'prev_project_name':_0x23ce03[_0x4f87('0x28')]||'','is_subproject':_0x23ce03[_0x4f87('0x28')]?!![]:![],'leaveAt':moment()[_0x4f87('0x29')](_0x4f87('0x2a'))})});};exports[_0x4f87('0x2b')]=function(_0x24d2bb){return request(_0x4f87('0x2c'),{'body':_0x24d2bb});};exports[_0x4f87('0x2d')]=function(_0x1d7421){return request(_0x4f87('0x2e'),{'body':_0x1d7421});};exports[_0x4f87('0x2f')]=function(_0x3c2b61){return request(_0x4f87('0x30'),{'options':{'raw':![],'where':{'phone':_0x3c2b61[_0x4f87('0x19')],'ListId':_0x3c2b61[_0x4f87('0x31')]}}})[_0x4f87('0x4')](function(_0x214a96){if(_0x214a96){return _0x214a96;}return request(_0x4f87('0x32'),{'body':_0x3c2b61});});};exports['getPauseById']=function(_0x3c8c8c){return request(_0x4f87('0x33'),{'options':{'where':{'id':_0x3c8c8c},'attributes':['name']}});};exports[_0x4f87('0x34')]=function(_0x331c52,_0x3a0046){return request(_0x4f87('0x35'),{'body':{'interface':_0x3a0046},'options':{'where':_0x331c52}});};exports[_0x4f87('0x36')]=function(_0x4bc337,_0x1c8e17,_0x370b0f){return request(_0x4f87('0x37'),{'body':{'type':_0x1c8e17,'uniqueid':_0x370b0f},'options':{'where':_0x4bc337}});};exports['agentUnpause']=function(_0x8df7f9){return request(_0x4f87('0x38'),{'body':{},'options':{'where':_0x8df7f9}});};exports[_0x4f87('0x39')]=function(_0x396e17){return request(_0x4f87('0x3a'),{'body':{},'options':{'where':_0x396e17}});}; \ No newline at end of file +var _0xbe02=['getPauseById','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','request','then','error','message','result','getSquareProjects','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','name','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact'];(function(_0x1aab33,_0x327f92){var _0x4bf0df=function(_0x278ffa){while(--_0x278ffa){_0x1aab33['push'](_0x1aab33['shift']());}};_0x4bf0df(++_0x327f92);}(_0xbe02,0x124));var _0x2be0=function(_0x50d6be,_0x41fb7b){_0x50d6be=_0x50d6be-0x0;var _0x590b47=_0xbe02[_0x50d6be];return _0x590b47;};'use strict';var _=require('lodash');var moment=require(_0x2be0('0x0'));var jayson=require(_0x2be0('0x1'));var client=jayson[_0x2be0('0x2')]['http']({'port':0x2329});function request(_0x499c2b,_0x1d7a85){return new Promise(function(_0x248e93,_0x506aad){return client[_0x2be0('0x3')](_0x499c2b,_0x1d7a85)[_0x2be0('0x4')](function(_0x443ace){if(_0x443ace[_0x2be0('0x5')]){return _0x506aad(_0x443ace[_0x2be0('0x5')][_0x2be0('0x6')]);}else{return _0x248e93(_0x443ace[_0x2be0('0x7')]);}})['catch'](function(_0xdf1605){return _0x506aad(_0xdf1605);});});}exports[_0x2be0('0x8')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x2be0('0x9')]}});};exports['getSquareProject']=function(_0xebe843){return request(_0x2be0('0xa'),{'options':{'raw':![],'where':{'name':_0xebe843},'attributes':[_0x2be0('0x9')]}});};exports[_0x2be0('0xb')]=function(_0x104667){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x104667},'include':[{'model':_0x2be0('0xc'),'as':_0x2be0('0xd'),'include':[{'model':_0x2be0('0xe'),'as':_0x2be0('0xe')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x2be0('0xf')]=function(_0x3baa57){return request(_0x2be0('0xa'),{'options':{'where':{'id':_0x3baa57},'attributes':[_0x2be0('0x10')]}});};exports['getVoiceQueueById']=function(_0x44d709){return request(_0x2be0('0x11'),{'options':{'where':{'id':_0x44d709},'attributes':[_0x2be0('0x10')]}});};exports[_0x2be0('0x12')]=function(_0x818f20){return request('ShowVariable',{'options':{'where':{'id':_0x818f20},'attributes':[_0x2be0('0x10')]}});};exports['getSquareOdbcById']=function(_0x698b89){return request(_0x2be0('0x13'),{'options':{'where':{'id':_0x698b89},'attributes':[_0x2be0('0x14')]}});};exports[_0x2be0('0x15')]=function(_0x3c247e){return request('ShowUser',{'options':{'where':{'id':_0x3c247e},'attributes':[_0x2be0('0x10')]}});};exports['getContactByPhone']=function(_0x473c97){return request(_0x2be0('0x16'),{'options':{'where':{'phone':_0x473c97[_0x2be0('0x17')]},'attributes':['id']}});};exports[_0x2be0('0x18')]=function(_0xc3b92a){return request(_0x2be0('0x19'),{'options':{'where':{'id':_0xc3b92a},'attributes':[_0x2be0('0x10')]}});};exports[_0x2be0('0x1a')]=function(_0x98bad6){return request('ShowSound',{'options':{'where':{'id':_0x98bad6},'attributes':[_0x2be0('0x1b')]}});};exports[_0x2be0('0x1c')]=function(_0x2cba28){return request(_0x2be0('0x1d'),{'options':{'raw':![],'where':{'id':_0x2cba28},'include':[{'model':'Interval','as':_0x2be0('0x1e')}]}});};exports[_0x2be0('0x1f')]=function(_0x55ea94){return request('ShowSmsAccount',{'options':{'where':{'id':_0x55ea94},'attributes':['id',_0x2be0('0x10')]}});};exports['createSmsMessage']=function(_0x20eb86){return request(_0x2be0('0x20'),{'body':_0x20eb86});};exports[_0x2be0('0x21')]=function(_0x4e6e4c){return request(_0x2be0('0x22'),{'body':_0x4e6e4c});};exports[_0x2be0('0x23')]=function(_0xab3a77){return request(_0x2be0('0x24'),{'body':_[_0x2be0('0x25')](_0xab3a77,{'project_name':_0xab3a77[_0x2be0('0x26')],'prev_project_name':_0xab3a77['arg_2']||'','is_subproject':_0xab3a77[_0x2be0('0x27')]?!![]:![],'leaveAt':moment()[_0x2be0('0x28')](_0x2be0('0x29'))})});};exports[_0x2be0('0x2a')]=function(_0x4686ca){return request(_0x2be0('0x2b'),{'body':_0x4686ca});};exports[_0x2be0('0x2c')]=function(_0xb83ebf){return request(_0x2be0('0x2d'),{'body':_0xb83ebf});};exports[_0x2be0('0x2e')]=function(_0x131dfb){return request(_0x2be0('0x2f'),{'options':{'raw':![],'where':{'phone':_0x131dfb[_0x2be0('0x17')],'ListId':_0x131dfb[_0x2be0('0x30')]}}})[_0x2be0('0x4')](function(_0x273df5){if(_0x273df5){return _0x273df5;}return request(_0x2be0('0x31'),{'body':_0x131dfb});});};exports[_0x2be0('0x32')]=function(_0x36d7c7){return request('ShowPause',{'options':{'where':{'id':_0x36d7c7},'attributes':['name']}});};exports[_0x2be0('0x33')]=function(_0x263479,_0x2745b9){return request('LoginUser',{'body':{'interface':_0x2745b9},'options':{'where':_0x263479}});};exports['agentPause']=function(_0x41ad52,_0x53020e,_0x316d9f){return request(_0x2be0('0x34'),{'body':{'type':_0x53020e,'uniqueid':_0x316d9f},'options':{'where':_0x41ad52}});};exports[_0x2be0('0x35')]=function(_0x229d7d){return request(_0x2be0('0x36'),{'body':{},'options':{'where':_0x229d7d}});};exports[_0x2be0('0x37')]=function(_0x44e36b){return request(_0x2be0('0x38'),{'body':{},'options':{'where':_0x44e36b}});}; \ 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 e7b0df4..6761691 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 _0x13c5=['./polly'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x13c5,0x7a));var _0x513c=function(_0x235f70,_0x3dae19){_0x235f70=_0x235f70-0x0;var _0x5be25a=_0x13c5[_0x235f70];return _0x5be25a;};var polly=require(_0x513c('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4300=['./polly'];(function(_0x4232dc,_0x55876d){var _0x4c758c=function(_0x4797b2){while(--_0x4797b2){_0x4232dc['push'](_0x4232dc['shift']());}};_0x4c758c(++_0x55876d);}(_0x4300,0x1a6));var _0x0430=function(_0x5e103f,_0x5111e4){_0x5e103f=_0x5e103f-0x0;var _0x1b439c=_0x4300[_0x5e103f];return _0x1b439c;};var polly=require(_0x0430('0x0'));var lex=require('./lex');module['exports']={'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 1273693..efee299 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ No newline at end of file +var _0x6f7a=['./lib/api','exports'];(function(_0x5084f4,_0x446901){var _0x3c0d8d=function(_0x5a4d00){while(--_0x5a4d00){_0x5084f4['push'](_0x5084f4['shift']());}};_0x3c0d8d(++_0x446901);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1b3790,_0x2621dc){_0x1b3790=_0x1b3790-0x0;var _0x4821c2=_0x6f7a[_0x1b3790];return _0x4821c2;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ 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 4c6c004..8ace1d6 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(_0x45b5f0,_0x58f06e){var _0x33721b=function(_0x1345da){while(--_0x1345da){_0x45b5f0['push'](_0x45b5f0['shift']());}};_0x33721b(++_0x58f06e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0xaecb2b,_0x1a4fab){var _0x38c762=function(_0x5f0e30){while(--_0x5f0e30){_0xaecb2b['push'](_0xaecb2b['shift']());}};_0x38c762(++_0x1a4fab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 913b083..7d6f260 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 _0x9d72=['exports','./lib/api'];(function(_0x44ff4c,_0xe7fd1c){var _0x2615d5=function(_0xe9392e){while(--_0xe9392e){_0x44ff4c['push'](_0x44ff4c['shift']());}};_0x2615d5(++_0xe7fd1c);}(_0x9d72,0x6b));var _0x29d7=function(_0x243223,_0x3bee50){_0x243223=_0x243223-0x0;var _0x3b5c86=_0x9d72[_0x243223];return _0x3b5c86;};'use strict';var polly=require(_0x29d7('0x0'));module[_0x29d7('0x1')]=function(_0x32a7cc,_0xf6b80,_0xd42cc3,_0x3b6b57,_0x145584,_0x58e097,_0x43ee9a){return polly(_0x32a7cc,_0xf6b80,_0xd42cc3,_0x3b6b57,_0x145584,_0x58e097,_0x43ee9a);}; \ No newline at end of file +var _0x848d=['./lib/api','exports'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x848d,0x64));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0xd848('0x0'));module[_0xd848('0x1')]=function(_0x508595,_0x43dc31,_0x3dbd47,_0x3494e0,_0x4a6952,_0x5786d6,_0x3e8217){return polly(_0x508595,_0x43dc31,_0x3dbd47,_0x3494e0,_0x4a6952,_0x5786d6,_0x3e8217);}; \ 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 31dc432..148be2b 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 _0x3425=['exports','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x3425,0x189));var _0x5342=function(_0x423d0d,_0x149aac){_0x423d0d=_0x423d0d-0x0;var _0x59830d=_0x3425[_0x423d0d];return _0x59830d;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5342('0x0'));var rs=require(_0x5342('0x1'));var AWS=require(_0x5342('0x2'));function pollyResult(_0x1961e4,_0x551e34,_0x3661a5){return new BPromise(function(_0x1947dd,_0x4f9a43){_0x1961e4[_0x5342('0x3')](_0x551e34,function(_0x5d060f,_0x57ceeb){if(_0x5d060f){_0x4f9a43(_0x5d060f);}else if(_0x57ceeb){if(_0x57ceeb['AudioStream']instanceof Buffer){fs[_0x5342('0x4')](_0x3661a5,_0x57ceeb['AudioStream'],function(_0xc45c7d){if(_0xc45c7d){_0x4f9a43(_0xc45c7d);}else{_0x1947dd();}});}else{_0x4f9a43(new Error(_0x5342('0x5')));}}else{_0x4f9a43(new Error(_0x5342('0x6')));}});});}module[_0x5342('0x7')]=function(_0x26fde6,_0x5d2cb2,_0x5c58e4,_0x1ecc91,_0xa03647,_0x5ad7e5,_0x16282c){var _0xa2e450=new AWS['Polly']({'accessKeyId':_0x26fde6,'secretAccessKey':_0x5d2cb2,'region':_0x5c58e4});var _0x16d111={'Text':_0xa03647,'TextType':_0x5ad7e5||'text','OutputFormat':'mp3','VoiceId':_0x1ecc91};return pollyResult(_0xa2e450,_0x16d111,_0x16282c);}; \ No newline at end of file +var _0x111b=['path','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x111b,0xfa));var _0xb111=function(_0xfce093,_0x4e9dab){_0xfce093=_0xfce093-0x0;var _0x582743=_0x111b[_0xfce093];return _0x582743;};'use strict';var fs=require('fs');var path=require(_0xb111('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0xb111('0x1'));function pollyResult(_0x4a6a75,_0x1b66f5,_0x103b0a){return new BPromise(function(_0x148a45,_0x1a9fb7){_0x4a6a75[_0xb111('0x2')](_0x1b66f5,function(_0x3c0ee2,_0x27d4e2){if(_0x3c0ee2){_0x1a9fb7(_0x3c0ee2);}else if(_0x27d4e2){if(_0x27d4e2['AudioStream']instanceof Buffer){fs[_0xb111('0x3')](_0x103b0a,_0x27d4e2[_0xb111('0x4')],function(_0x4d9a31){if(_0x4d9a31){_0x1a9fb7(_0x4d9a31);}else{_0x148a45();}});}else{_0x1a9fb7(new Error(_0xb111('0x5')));}}else{_0x1a9fb7(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xb111('0x6')]=function(_0x2173b9,_0x4f886d,_0x4e09c1,_0x152407,_0x492fcf,_0x45a2a2,_0x16a728){var _0x55bf3c=new AWS[(_0xb111('0x7'))]({'accessKeyId':_0x2173b9,'secretAccessKey':_0x4f886d,'region':_0x4e09c1});var _0x26a059={'Text':_0x492fcf,'TextType':_0x45a2a2||_0xb111('0x8'),'OutputFormat':_0xb111('0x9'),'VoiceId':_0x152407};return pollyResult(_0x55bf3c,_0x26a059,_0x16a728);}; \ 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 1ad2584..f556588 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 _0xf82c=['./lib/api','exports'];(function(_0x2c26eb,_0x1cd7b6){var _0x55f8c6=function(_0x4c1d08){while(--_0x4c1d08){_0x2c26eb['push'](_0x2c26eb['shift']());}};_0x55f8c6(++_0x1cd7b6);}(_0xf82c,0x1a8));var _0xcf82=function(_0x2219a9,_0x194656){_0x2219a9=_0x2219a9-0x0;var _0x727d4d=_0xf82c[_0x2219a9];return _0x727d4d;};'use strict';var asr=require(_0xcf82('0x0'));module[_0xcf82('0x1')]=function(_0x571a63,_0x61e442,_0x3adf95,_0x53251a){return asr(_0x571a63,_0x61e442,_0x3adf95);}; \ No newline at end of file +var _0x10fc=['./lib/api','exports'];(function(_0x179d07,_0x29431a){var _0xbcbe0b=function(_0xaefa24){while(--_0xaefa24){_0x179d07['push'](_0x179d07['shift']());}};_0xbcbe0b(++_0x29431a);}(_0x10fc,0x64));var _0xc10f=function(_0x44bb2d,_0x250ab5){_0x44bb2d=_0x44bb2d-0x0;var _0x47c1fa=_0x10fc[_0x44bb2d];return _0x47c1fa;};'use strict';var asr=require(_0xc10f('0x0'));module[_0xc10f('0x1')]=function(_0x11007f,_0x14d8de,_0x804977,_0x14d29d){return asr(_0x11007f,_0x14d8de,_0x804977);}; \ 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 0e4c770..fb41b22 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 _0x0884=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0x4088('0x0'));var BPromise=require(_0x4088('0x1'));var fs=require('fs');var host=_0x4088('0x2');module[_0x4088('0x3')]=function(_0x39e7de,_0x1e9e1d,_0x300c58){return new BPromise(function(_0x556d34,_0x3c15b9){var _0x634f6f;if(typeof _0x39e7de!==_0x4088('0x4')||_0x39e7de[_0x4088('0x5')]===0x0){return _0x3c15b9(_0x4088('0x6'));}if(typeof _0x1e9e1d!=='string'||_0x1e9e1d['length']===0x0){return _0x3c15b9(_0x4088('0x7'));}if(typeof _0x300c58!=='undefined'&&(typeof _0x300c58!==_0x4088('0x4')||_0x300c58[_0x4088('0x5')]===0x0)){return _0x3c15b9(_0x4088('0x8'));}try{_0x634f6f=fs[_0x4088('0x9')](_0x39e7de)[_0x4088('0xa')](_0x4088('0xb'));}catch(_0x1cc7fa){return _0x3c15b9(_0x1cc7fa);}return _0x556d34({'method':_0x4088('0xc'),'uri':host+_0x4088('0xd')+_0x1e9e1d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x4088('0xe'),'languageCode':_0x300c58},'audio':{'content':_0x634f6f}},'json':!![]});});}; \ No newline at end of file +var _0xbd3b=['POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0xca04ff,_0xcb449f){_0xca04ff=_0xca04ff-0x0;var _0x6b547=_0xbd3b[_0xca04ff];return _0x6b547;};'use strict';var url=require(_0xbbd3('0x0'));var BPromise=require(_0xbbd3('0x1'));var fs=require('fs');var host=_0xbbd3('0x2');module['exports']=function(_0x5e9577,_0xe94b7b,_0x1cf5ef){return new BPromise(function(_0x13b296,_0x4e911b){var _0x173684;if(typeof _0x5e9577!==_0xbbd3('0x3')||_0x5e9577['length']===0x0){return _0x4e911b(_0xbbd3('0x4'));}if(typeof _0xe94b7b!=='string'||_0xe94b7b[_0xbbd3('0x5')]===0x0){return _0x4e911b(_0xbbd3('0x6'));}if(typeof _0x1cf5ef!==_0xbbd3('0x7')&&(typeof _0x1cf5ef!=='string'||_0x1cf5ef[_0xbbd3('0x5')]===0x0)){return _0x4e911b(_0xbbd3('0x8'));}try{_0x173684=fs[_0xbbd3('0x9')](_0x5e9577)[_0xbbd3('0xa')]('base64');}catch(_0xeade3a){return _0x4e911b(_0xeade3a);}return _0x13b296({'method':_0xbbd3('0xb'),'uri':host+_0xbbd3('0xc')+_0xe94b7b,'body':{'config':{'encoding':_0xbbd3('0xd'),'sampleRateHertz':'8000','languageCode':_0x1cf5ef},'audio':{'content':_0x173684}},'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 7fa165f..0b36e59 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 _0xf9d4=['exports','./asr'];(function(_0x1b0bfe,_0x589135){var _0x14bb4c=function(_0x143a4d){while(--_0x143a4d){_0x1b0bfe['push'](_0x1b0bfe['shift']());}};_0x14bb4c(++_0x589135);}(_0xf9d4,0x14f));var _0x4f9d=function(_0x14b92d,_0x199505){_0x14b92d=_0x14b92d-0x0;var _0x5444fc=_0xf9d4[_0x14b92d];return _0x5444fc;};var asr=require(_0x4f9d('0x0'));module[_0x4f9d('0x1')]={'asr':asr}; \ No newline at end of file +var _0x61b7=['exports','./asr'];(function(_0x1f09fa,_0x3265ca){var _0x197c8d=function(_0x91c3b){while(--_0x91c3b){_0x1f09fa['push'](_0x1f09fa['shift']());}};_0x197c8d(++_0x3265ca);}(_0x61b7,0x1d1));var _0x761b=function(_0x18aed6,_0x490395){_0x18aed6=_0x18aed6-0x0;var _0x52195e=_0x61b7[_0x18aed6];return _0x52195e;};var asr=require(_0x761b('0x0'));module[_0x761b('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 100d31d..91a7eed 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 _0xd4c9=['textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','status','code','endConversation','metadata','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','model=%s','parse','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','./aws','./google','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','request\x20to\x20','transcode','wav','error\x20convert','finish\x20to\x20convert','start','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','tmp','from','audioContent','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','.wav','goggleTTS\x20path','googleASR','asr','info','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','message'];(function(_0x56f51c,_0x3ca248){var _0x1fe122=function(_0x15b541){while(--_0x15b541){_0x56f51c['push'](_0x56f51c['shift']());}};_0x1fe122(++_0x3ca248);}(_0xd4c9,0xb4));var _0x9d4c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd4c9[_0x6131cd];return _0x47e916;};'use strict';var apiai=require(_0x9d4c('0x0'));var BPromise=require(_0x9d4c('0x1'));var dialogflow=require(_0x9d4c('0x2'));var fs=require('fs');var http=require(_0x9d4c('0x3'));var https=require(_0x9d4c('0x4'));var md5=require(_0x9d4c('0x5'));var path=require(_0x9d4c('0x6'));var querystring=require(_0x9d4c('0x7'));var rp=require('request-promise');var rs=require(_0x9d4c('0x8'));var sox=require(_0x9d4c('0x9'));var tts=require(_0x9d4c('0xa'));var urlParse=require(_0x9d4c('0xb'))['parse'];var util=require('util');var aws=require(_0x9d4c('0xc'));var google=require(_0x9d4c('0xd'));var sestek=require('./sestek');var tilde=require(_0x9d4c('0xe'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x9d4c('0xf');function downloadFile(_0x35a337,_0x27096c){return new BPromise(function(_0x3ae7b0,_0x1ba17b){var _0x23a3a4=urlParse(_0x35a337);var _0x522056=_0x23a3a4[_0x9d4c('0x10')]===_0x9d4c('0x11')?https:http;var _0x347a2b={'host':_0x23a3a4[_0x9d4c('0x12')],'path':_0x23a3a4[_0x9d4c('0x6')],'headers':{'user-agent':_0x9d4c('0x13')}};_0x522056[_0x9d4c('0x14')](_0x347a2b,function(_0x2ebb75){if(_0x2ebb75[_0x9d4c('0x15')]!==0xc8){logger['error']('request\x20to\x20'+_0x35a337+_0x9d4c('0x16')+_0x2ebb75[_0x9d4c('0x15')]+'\x20('+_0x2ebb75[_0x9d4c('0x17')]+')');_0x1ba17b(new Error('request\x20to\x20'+_0x35a337+_0x9d4c('0x16')+_0x2ebb75[_0x9d4c('0x15')]+'\x20('+_0x2ebb75['statusMessage']+')'));return;}var _0x2d8631=fs['createWriteStream'](_0x27096c);_0x2d8631['on'](_0x9d4c('0x18'),function(){logger['info'](_0x9d4c('0x19'));_0x2d8631[_0x9d4c('0x1a')](_0x3ae7b0);});_0x2d8631['on'](_0x9d4c('0x1b'),function(_0x327b52){fs[_0x9d4c('0x1c')](_0x27096c);logger[_0x9d4c('0x1b')](_0x9d4c('0x1d'),_0x327b52);_0x1ba17b(_0x327b52);});_0x2ebb75[_0x9d4c('0x1e')](_0x2d8631);})['on'](_0x9d4c('0x1b'),function(_0x16aab2){logger[_0x9d4c('0x1b')](_0x16aab2);_0x1ba17b(_0x16aab2);})[_0x9d4c('0x1f')]();});}function uploadFile(_0x34e64e){return new BPromise(function(_0xe91605,_0x5b9164){var _0x48480b=urlParse(_0x34e64e);var _0x413f82=_0x48480b[_0x9d4c('0x10')]==='https:'?https:http;var _0x1cbf84={'host':_0x48480b[_0x9d4c('0x12')],'path':_0x48480b[_0x9d4c('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x413f82[_0x9d4c('0x14')](_0x1cbf84,function(_0x465c8d){if(_0x465c8d[_0x9d4c('0x15')]!==0xc8){_0x5b9164(new Error(_0x9d4c('0x20')+_0x34e64e+_0x9d4c('0x16')+_0x465c8d['statusCode']+'\x20('+_0x465c8d[_0x9d4c('0x17')]+')'));return;}var _0x278c6b='';_0x465c8d['on']('data',function(_0x248187){_0x278c6b+=_0x248187;});_0x465c8d['on'](_0x9d4c('0x1f'),function(){_0xe91605(_0x278c6b);});})['on'](_0x9d4c('0x1b'),function(_0x2b8191){_0x5b9164(_0x2b8191);})[_0x9d4c('0x1f')]();});}function convertFile(_0x5095cd,_0x1951ad){return new BPromise(function(_0x325b49,_0x212641){var _0x572356=sox[_0x9d4c('0x21')](_0x5095cd,_0x1951ad,{'sampleRate':0x1f40,'format':_0x9d4c('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x572356['on'](_0x9d4c('0x1b'),function(_0x198a38){logger[_0x9d4c('0x1b')](_0x9d4c('0x23'),_0x198a38);_0x212641(_0x198a38);});_0x572356['on'](_0x9d4c('0x1f'),function(){logger['info'](_0x9d4c('0x24'));_0x325b49();});_0x572356[_0x9d4c('0x25')]();});}function base64Decode(_0x48a98a,_0x4601a2){var _0x1bc0a1=path['resolve'](__dirname,'tmp',rs[_0x9d4c('0x26')](0x4)+'.wav');fs[_0x9d4c('0x27')](_0x1bc0a1,_0x48a98a,_0x9d4c('0x28'));return convertFile(_0x1bc0a1,_0x4601a2)[_0x9d4c('0x29')](function(){try{fs['unlink'](_0x1bc0a1);fs[_0x9d4c('0x2a')](_0x4601a2,_0x9d4c('0x2b'));}catch(_0x46391f){logger[_0x9d4c('0x1b')](_0x46391f);}return _0x4601a2[_0x9d4c('0x2c')]('.')[0x0];});}function base64Encode(_0x37eb5f){var _0x3b7b9c=fs[_0x9d4c('0x2d')](_0x37eb5f);return new Buffer(_0x3b7b9c)[_0x9d4c('0x2e')]('base64');}exports[_0x9d4c('0x2f')]=function(_0x2959ce,_0x3b6b5d,_0x2c5402,_0x270629,_0x56803f,_0x538d1d){var _0x5d1584,_0x29ef94;var _0x985066=_0x9d4c('0x30');var _0x4af296=_0x9d4c('0x31')+_0x2959ce;var _0x13cc8f={};if(_0x3b6b5d===_0x9d4c('0x32')){_0x13cc8f[_0x9d4c('0x33')]={'ssml':_0x2c5402};}else{_0x13cc8f[_0x9d4c('0x33')]={'text':_0x2c5402};};_0x13cc8f[_0x9d4c('0x34')]={'languageCode':_0x270629,'ssmlGender':_0x56803f};_0x13cc8f[_0x9d4c('0x35')]={'audioEncoding':_0x9d4c('0x36'),'sampleRateHertz':0x1f40};var _0x2ddd15={'url':_0x985066+_0x9d4c('0x37')+_0x4af296,'method':_0x9d4c('0x38'),'json':!![],'body':_0x13cc8f};return rp(_0x2ddd15)['then'](function(_0x5cd9e6){return new BPromise(function(_0x135fbb,_0x702278){_0x5d1584=path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs[_0x9d4c('0x26')](0x4)+'.mp3');var _0x5506ec=Buffer[_0x9d4c('0x3b')](_0x5cd9e6[_0x9d4c('0x3c')],_0x9d4c('0x28'));return fs['writeFile'](_0x5d1584,_0x5506ec,function(_0x1c32b2){_0x702278(_0x1c32b2);},function(_0x43149a){fs[_0x9d4c('0x2a')](_0x5d1584,_0x9d4c('0x2b'));_0x135fbb(_0x43149a);});});})[_0x9d4c('0x29')](function(_0x4f2be4){_0x29ef94=path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs[_0x9d4c('0x26')](0x4)+'.wav');return convertFile(_0x5d1584,_0x29ef94);})[_0x9d4c('0x29')](function(){try{fs[_0x9d4c('0x1c')](_0x5d1584);fs[_0x9d4c('0x2a')](_0x29ef94,_0x9d4c('0x2b'));}catch(_0x35a159){logger['error'](_0x35a159);}logger['info']('googleCloudTTS\x20path',_0x29ef94[_0x9d4c('0x2c')]('.')[0x0]);return _0x29ef94[_0x9d4c('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x4944c9,_0x2aeae2){var _0x54a146=_0x9d4c('0x3d');var _0x5df5b4,_0x4ae1ad;var _0x1ebff2;var _0x46adfb={'encoding':_0x9d4c('0x3e'),'method':_0x9d4c('0x38'),'timeout':0x2710,'url':_0x54a146,'headers':{'Content-Type':_0x9d4c('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0x9d4c('0x40')]([[[_0x9d4c('0x41'),JSON[_0x9d4c('0x40')]([_0x4944c9,_0x2aeae2||'en',![],_0x9d4c('0x42')]),null,'generic']]]))};return rp(_0x46adfb)[_0x9d4c('0x29')](function(_0x21587b){try{_0x1ebff2=eval(_0x21587b[_0x9d4c('0x43')](0x5))[0x0][0x2];}catch(_0x5bda0a){throw new Error(_0x9d4c('0x44')+_0x21587b[_0x9d4c('0x45')]);}if(!_0x1ebff2){if(_0x4944c9[_0x9d4c('0x46')]>0xc8){throw new Error(_0x9d4c('0x47'));}else{throw new Error(_0x9d4c('0x48')+_0x2aeae2+_0x9d4c('0x49'));}}try{_0x1ebff2=eval(_0x1ebff2)[0x0];}catch(_0x5c9dad){throw new Error(_0x9d4c('0x44')+res[_0x9d4c('0x45')]);}const _0x2efa0f=_0x1ebff2;_0x5df5b4=path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs[_0x9d4c('0x26')](0x4)+_0x9d4c('0x4a'));fs['writeFileSync'](_0x5df5b4,_0x1ebff2,{'encoding':'base64'});_0x4ae1ad=path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs[_0x9d4c('0x26')](0x4)+_0x9d4c('0x4b'));return convertFile(_0x5df5b4,_0x4ae1ad);})['then'](function(){try{fs[_0x9d4c('0x1c')](_0x5df5b4);fs[_0x9d4c('0x2a')](_0x4ae1ad,_0x9d4c('0x2b'));}catch(_0x5b0bea){logger[_0x9d4c('0x1b')](_0x5b0bea);}logger['info'](_0x9d4c('0x4c'),_0x4ae1ad[_0x9d4c('0x2c')]('.')[0x0]);return _0x4ae1ad['split']('.')[0x0];});};exports[_0x9d4c('0x4d')]=function(_0x392a4e,_0x4d8aea,_0x15d4a6){return google[_0x9d4c('0x4e')](_0x392a4e,_0x4d8aea,_0x15d4a6)[_0x9d4c('0x29')](function(_0x8e8e7b){logger[_0x9d4c('0x4f')](_0x8e8e7b[_0x9d4c('0x50')]);return rp(_0x8e8e7b);})[_0x9d4c('0x29')](function(_0x11224f){var _0x1714ee='';var _0x4a83cf=0x0;try{fs[_0x9d4c('0x1c')](_0x392a4e);}catch(_0x2ac470){logger[_0x9d4c('0x1b')](_0x2ac470);}if(_0x11224f&&_0x11224f[_0x9d4c('0x51')]){_0x1714ee=_0x11224f['results'][_0x9d4c('0x52')](function(_0x31d99a){return _0x31d99a&&_0x31d99a[_0x9d4c('0x53')][0x0]&&_0x31d99a['alternatives'][0x0][_0x9d4c('0x54')]?_0x31d99a['alternatives'][0x0][_0x9d4c('0x54')]:'';})['join']('\x0a');_0x4a83cf=_0x11224f[_0x9d4c('0x51')][_0x9d4c('0x52')](function(_0x1599cb){return _0x1599cb&&_0x1599cb[_0x9d4c('0x53')][0x0]&&_0x1599cb[_0x9d4c('0x53')][0x0][_0x9d4c('0x55')]?_0x1599cb[_0x9d4c('0x53')][0x0][_0x9d4c('0x55')]:0x0;})[_0x9d4c('0x56')]('\x0a');}logger[_0x9d4c('0x4f')](_0x9d4c('0x57'),_0x1714ee);logger[_0x9d4c('0x4f')](_0x9d4c('0x58'),_0x4a83cf);return{'transcript':_0x1714ee,'confidence':_0x4a83cf};})[_0x9d4c('0x59')](function(_0x2db572){logger[_0x9d4c('0x1b')]('[%s]\x20%s:%s',_0x2db572[_0x9d4c('0x15')],_0x2db572[_0x9d4c('0x5a')],_0x2db572[_0x9d4c('0x5b')]);});};exports['googleDialogflow']=function(_0x43521c,_0x223ba9,_0x5eca7f,_0x1b772f){var _0x3fbb7b=apiai(_0x223ba9,{'language':_0x1b772f||'en'});return _0x3fbb7b[_0x9d4c('0x5c')](_0x5eca7f,{'sessionId':md5(_0x43521c)})[_0x9d4c('0x29')](function(_0x1613be){logger[_0x9d4c('0x4f')](JSON['stringify'](_0x1613be));return{'source':_0x1613be[_0x9d4c('0x5d')][_0x9d4c('0x5e')],'resolvedQuery':_0x1613be[_0x9d4c('0x5d')][_0x9d4c('0x5f')],'action':_0x1613be[_0x9d4c('0x5d')][_0x9d4c('0x60')],'actionIncomplete':_0x1613be[_0x9d4c('0x5d')][_0x9d4c('0x61')],'speech':_0x1613be['result'][_0x9d4c('0x62')]['speech'],'score':_0x1613be[_0x9d4c('0x5d')]['score'],'statusCode':_0x1613be[_0x9d4c('0x63')][_0x9d4c('0x64')],'endConversation':_0x1613be[_0x9d4c('0x5d')]['metadata'][_0x9d4c('0x65')]||![],'isFallbackIntent':_0x1613be[_0x9d4c('0x5d')][_0x9d4c('0x66')]['isFallbackIntent']};});};exports[_0x9d4c('0x67')]=function(_0x1c1f40,_0x4cc0c8,_0x4d2dea,_0x363f84,_0x2be3a3,_0x596468){var _0x44b109=_0x363f84['replace'](/\\n/g,'\x0a');var _0x10b0d1={'credentials':{'private_key':_0x44b109,'client_email':_0x4d2dea}};var _0x5dd743=new dialogflow[(_0x9d4c('0x68'))](_0x10b0d1);var _0x4f277a=_0x5dd743[_0x9d4c('0x69')](_0x4cc0c8,md5(_0x1c1f40));var _0x3c104e={'session':_0x4f277a,'queryInput':{'text':{'text':_0x2be3a3,'languageCode':_0x596468}}};return _0x5dd743['detectIntent'](_0x3c104e)[_0x9d4c('0x29')](function(_0x5dc055){if(_0x5dc055&&_0x5dc055[_0x9d4c('0x46')]){logger['info'](_0x9d4c('0x6a'),JSON[_0x9d4c('0x40')](_0x5dc055));var _0x468a81=_0x5dc055[0x0];if(_0x468a81){var _0x13451c={'action':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x60')],'allRequiredParamsPresent':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x6c')],'endConversation':_0x468a81['queryResult']['diagnosticInfo']&&_0x468a81['queryResult'][_0x9d4c('0x6d')][_0x9d4c('0x6e')]?_0x468a81[_0x9d4c('0x6b')]['diagnosticInfo'][_0x9d4c('0x6e')][_0x9d4c('0x6f')][_0x9d4c('0x70')]:![],'fulfillmentText':_0x468a81['queryResult'][_0x9d4c('0x71')],'intentName':_0x468a81['queryResult'][_0x9d4c('0x72')][_0x9d4c('0x5a')],'intentDisplayName':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x72')][_0x9d4c('0x73')],'isFallbackIntent':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x72')][_0x9d4c('0x74')],'languageCode':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x75')],'queryText':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x76')],'responseId':_0x468a81[_0x9d4c('0x77')],'score':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x78')],'speech':_0x468a81[_0x9d4c('0x6b')][_0x9d4c('0x71')],'providerResponse':JSON[_0x9d4c('0x40')](_0x5dc055)};return _0x13451c;}}});};exports['tildeASR']=function(_0x539215,_0x495d9a,_0x683a40,_0x399ba0){return tilde['asr'](_0x539215,_0x495d9a,_0x683a40,_0x399ba0)[_0x9d4c('0x29')](function(_0x46b33d){try{fs[_0x9d4c('0x1c')](_0x539215);}catch(_0x5298fe){logger[_0x9d4c('0x1b')](_0x5298fe);}logger[_0x9d4c('0x4f')]('Tilde\x20ASR\x20transcription',_0x46b33d[_0x9d4c('0x54')]);logger['info'](_0x9d4c('0x79'),_0x46b33d['confidence']);return _0x46b33d;});};exports[_0x9d4c('0x7a')]=function(_0x2da709,_0x4c2439,_0x566e73,_0x162847,_0x4605f5,_0x2e265c){var _0xdaa6de=path['resolve'](__dirname,_0x9d4c('0x3a'),rs[_0x9d4c('0x26')](0x4)+_0x9d4c('0x4a'));var _0x3d396c;return aws[_0x9d4c('0x7b')](_0x2da709,_0x4c2439,_0x566e73,_0x162847,_0x4605f5,_0x2e265c,_0xdaa6de)[_0x9d4c('0x29')](function(){_0x3d396c=path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs['generate'](0x4)+_0x9d4c('0x4b'));return convertFile(_0xdaa6de,_0x3d396c);})[_0x9d4c('0x29')](function(){try{fs[_0x9d4c('0x1c')](_0xdaa6de);fs[_0x9d4c('0x2a')](_0x3d396c,_0x9d4c('0x2b'));}catch(_0x2dac7c){logger[_0x9d4c('0x1b')](_0x2dac7c);}return _0x3d396c[_0x9d4c('0x2c')]('.')[0x0];});};exports[_0x9d4c('0x7c')]=function(_0x99d525,_0x36ae0f,_0x16e254,_0x5c6d8b,_0x2c18af,_0xadaa4e){return aws[_0x9d4c('0x7d')](_0x99d525,_0x36ae0f,_0x16e254,_0x5c6d8b,_0x2c18af,_0xadaa4e)['then'](function(_0x1c957b){logger[_0x9d4c('0x4f')](JSON['stringify'](_0x1c957b));return _0x1c957b;});};exports[_0x9d4c('0x7e')]=function(_0x18ce11,_0x5e44e2,_0x34b46f,_0x10fc9d){var _0x33509d=util[_0x9d4c('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x18ce11,encodeURIComponent(_0x5e44e2),_0x34b46f,_0x10fc9d);var _0x29cb82=path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs['generate'](0x4)+'.mp3');var _0x394a47;return downloadFile(_0x33509d,_0x29cb82)[_0x9d4c('0x29')](function(){_0x394a47=path[_0x9d4c('0x39')](__dirname,'tmp',rs[_0x9d4c('0x26')](0x4)+_0x9d4c('0x4b'));return convertFile(_0x29cb82,_0x394a47);})[_0x9d4c('0x29')](function(){try{fs['unlink'](_0x29cb82);fs[_0x9d4c('0x2a')](_0x394a47,_0x9d4c('0x2b'));}catch(_0xc360f2){logger[_0x9d4c('0x1b')](_0xc360f2);}return _0x394a47[_0x9d4c('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x2258f1,_0x485d69,_0xc698,_0x26b905){var _0x5c37e2=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x485d69,_0xc698,base64Encode(_0x2258f1),_0x26b905?util[_0x9d4c('0x7f')](_0x9d4c('0x80'),encodeURIComponent(_0x26b905)):'freeform=3');return uploadFile(_0x5c37e2)[_0x9d4c('0x29')](function(_0x357fb5){return querystring[_0x9d4c('0x81')](_0x357fb5);});};exports[_0x9d4c('0x82')]=function(_0xa57e35,_0x1c13a8){return sestek['nda'](_0xa57e35,_0x1c13a8)[_0x9d4c('0x29')](function(_0x5f3777){logger[_0x9d4c('0x4f')](JSON[_0x9d4c('0x40')](_0x5f3777));var _0x1ae566={'speech':_0x5f3777['text'],'action':_0x5f3777[_0x9d4c('0x83')]?_0x5f3777['channelData'][_0x9d4c('0x84')]:undefined,'actiondata':_0x5f3777['channelData']?_0x5f3777['channelData'][_0x9d4c('0x85')]:undefined};if(_0x5f3777[_0x9d4c('0x83')]&&_0x5f3777['channelData'][_0x9d4c('0x86')]){return base64Decode(_0x5f3777[_0x9d4c('0x83')][_0x9d4c('0x86')]['Data'],path[_0x9d4c('0x39')](__dirname,_0x9d4c('0x3a'),rs[_0x9d4c('0x26')](0x4)+_0x9d4c('0x4b')))[_0x9d4c('0x29')](function(_0x195990){_0x1ae566['audiofile']=_0x195990;return _0x1ae566;});}return _0x1ae566;});};exports[_0x9d4c('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x7669=['freeform=3','parse','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','http','md5','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https:','host','path','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','\x20failed,\x20status\x20code\x20=\x20','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','then','chmodSync','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','writeFile','777','resolve','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s'];(function(_0x5e4ebb,_0x3deec1){var _0x51c7a7=function(_0x2e7112){while(--_0x2e7112){_0x5e4ebb['push'](_0x5e4ebb['shift']());}};_0x51c7a7(++_0x3deec1);}(_0x7669,0x99));var _0x9766=function(_0x5d6d41,_0x4eb737){_0x5d6d41=_0x5d6d41-0x0;var _0x429a8c=_0x7669[_0x5d6d41];return _0x429a8c;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x9766('0x0'));var https=require('https');var md5=require(_0x9766('0x1'));var path=require('path');var querystring=require('querystring');var rp=require(_0x9766('0x2'));var rs=require(_0x9766('0x3'));var sox=require(_0x9766('0x4'));var tts=require(_0x9766('0x5'));var urlParse=require(_0x9766('0x6'))['parse'];var util=require(_0x9766('0x7'));var aws=require(_0x9766('0x8'));var google=require(_0x9766('0x9'));var sestek=require(_0x9766('0xa'));var tilde=require(_0x9766('0xb'));var logger=require(_0x9766('0xc'))(_0x9766('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x22bdc0,_0x5b8c6c){return new BPromise(function(_0x1ab903,_0x2fd8ae){var _0x3db975=urlParse(_0x22bdc0);var _0x2486aa=_0x3db975['protocol']===_0x9766('0xe')?https:http;var _0x55ee0d={'host':_0x3db975[_0x9766('0xf')],'path':_0x3db975[_0x9766('0x10')],'headers':{'user-agent':_0x9766('0x11')}};_0x2486aa[_0x9766('0x12')](_0x55ee0d,function(_0x421ef1){if(_0x421ef1[_0x9766('0x13')]!==0xc8){logger[_0x9766('0x14')]('request\x20to\x20'+_0x22bdc0+'\x20failed,\x20status\x20code\x20=\x20'+_0x421ef1[_0x9766('0x13')]+'\x20('+_0x421ef1[_0x9766('0x15')]+')');_0x2fd8ae(new Error(_0x9766('0x16')+_0x22bdc0+'\x20failed,\x20status\x20code\x20=\x20'+_0x421ef1[_0x9766('0x13')]+'\x20('+_0x421ef1[_0x9766('0x15')]+')'));return;}var _0x346a90=fs[_0x9766('0x17')](_0x5b8c6c);_0x346a90['on']('finish',function(){logger[_0x9766('0x18')](_0x9766('0x19'));_0x346a90[_0x9766('0x1a')](_0x1ab903);});_0x346a90['on'](_0x9766('0x14'),function(_0x51bc3e){fs[_0x9766('0x1b')](_0x5b8c6c);logger[_0x9766('0x14')](_0x9766('0x1c'),_0x51bc3e);_0x2fd8ae(_0x51bc3e);});_0x421ef1[_0x9766('0x1d')](_0x346a90);})['on'](_0x9766('0x14'),function(_0x4c9e39){logger[_0x9766('0x14')](_0x4c9e39);_0x2fd8ae(_0x4c9e39);})[_0x9766('0x1e')]();});}function uploadFile(_0x1f464f){return new BPromise(function(_0x60b70b,_0x1294b6){var _0x3cce23=urlParse(_0x1f464f);var _0x17d4dd=_0x3cce23[_0x9766('0x1f')]===_0x9766('0xe')?https:http;var _0x30be01={'host':_0x3cce23[_0x9766('0xf')],'path':_0x3cce23['path'],'headers':{'user-agent':_0x9766('0x11')}};_0x17d4dd[_0x9766('0x12')](_0x30be01,function(_0x50c02e){if(_0x50c02e[_0x9766('0x13')]!==0xc8){_0x1294b6(new Error(_0x9766('0x16')+_0x1f464f+_0x9766('0x20')+_0x50c02e['statusCode']+'\x20('+_0x50c02e[_0x9766('0x15')]+')'));return;}var _0x1f6a30='';_0x50c02e['on']('data',function(_0x383ff4){_0x1f6a30+=_0x383ff4;});_0x50c02e['on'](_0x9766('0x1e'),function(){_0x60b70b(_0x1f6a30);});})['on'](_0x9766('0x14'),function(_0x22ab15){_0x1294b6(_0x22ab15);})[_0x9766('0x1e')]();});}function convertFile(_0x5bd22d,_0x3f169f){return new BPromise(function(_0x52662b,_0x593e01){var _0x3d7cea=sox['transcode'](_0x5bd22d,_0x3f169f,{'sampleRate':0x1f40,'format':_0x9766('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d7cea['on'](_0x9766('0x14'),function(_0x1fe21a){logger[_0x9766('0x14')](_0x9766('0x22'),_0x1fe21a);_0x593e01(_0x1fe21a);});_0x3d7cea['on']('end',function(){logger[_0x9766('0x18')](_0x9766('0x23'));_0x52662b();});_0x3d7cea[_0x9766('0x24')]();});}function base64Decode(_0x1704ed,_0x105cc2){var _0x421fba=path['resolve'](__dirname,_0x9766('0x25'),rs[_0x9766('0x26')](0x4)+_0x9766('0x27'));fs[_0x9766('0x28')](_0x421fba,_0x1704ed,'base64');return convertFile(_0x421fba,_0x105cc2)[_0x9766('0x29')](function(){try{fs[_0x9766('0x1b')](_0x421fba);fs[_0x9766('0x2a')](_0x105cc2,'777');}catch(_0x52f4be){logger[_0x9766('0x14')](_0x52f4be);}return _0x105cc2[_0x9766('0x2b')]('.')[0x0];});}function base64Encode(_0x59c322){var _0x365129=fs[_0x9766('0x2c')](_0x59c322);return new Buffer(_0x365129)[_0x9766('0x2d')](_0x9766('0x2e'));}exports[_0x9766('0x2f')]=function(_0x28ee4a,_0x11cf69,_0x16d2b8,_0x586f3,_0x3fdee6,_0x551205){var _0x4123c5,_0x47cda5;var _0x17218e=_0x9766('0x30');var _0xcb4807=_0x9766('0x31')+_0x28ee4a;var _0x2768ac={};if(_0x11cf69===_0x9766('0x32')){_0x2768ac[_0x9766('0x33')]={'ssml':_0x16d2b8};}else{_0x2768ac[_0x9766('0x33')]={'text':_0x16d2b8};};_0x2768ac[_0x9766('0x34')]={'languageCode':_0x586f3,'ssmlGender':_0x3fdee6};_0x2768ac[_0x9766('0x35')]={'audioEncoding':_0x9766('0x36'),'sampleRateHertz':0x1f40};var _0xac0323={'url':_0x17218e+_0x9766('0x37')+_0xcb4807,'method':'POST','json':!![],'body':_0x2768ac};return rp(_0xac0323)[_0x9766('0x29')](function(_0x352a30){return new BPromise(function(_0x3fadc5,_0x3f744b){_0x4123c5=path['resolve'](__dirname,'tmp',rs[_0x9766('0x26')](0x4)+_0x9766('0x38'));var _0x4e422d=Buffer[_0x9766('0x39')](_0x352a30[_0x9766('0x3a')],_0x9766('0x2e'));return fs[_0x9766('0x3b')](_0x4123c5,_0x4e422d,function(_0x2af9a3){_0x3f744b(_0x2af9a3);},function(_0x404b80){fs[_0x9766('0x2a')](_0x4123c5,_0x9766('0x3c'));_0x3fadc5(_0x404b80);});});})[_0x9766('0x29')](function(_0x160435){_0x47cda5=path[_0x9766('0x3d')](__dirname,_0x9766('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x4123c5,_0x47cda5);})[_0x9766('0x29')](function(){try{fs['unlink'](_0x4123c5);fs['chmodSync'](_0x47cda5,_0x9766('0x3c'));}catch(_0x52844c){logger[_0x9766('0x14')](_0x52844c);}logger[_0x9766('0x18')]('googleCloudTTS\x20path',_0x47cda5['split']('.')[0x0]);return _0x47cda5[_0x9766('0x2b')]('.')[0x0];});};exports[_0x9766('0x3e')]=function(_0x1b14a8,_0x4031ad){var _0x2a50d1=_0x9766('0x3f');var _0x59c7cc,_0x192064;var _0x7a765b;var _0x2ffc9a={'encoding':_0x9766('0x40'),'method':_0x9766('0x41'),'timeout':0x2710,'url':_0x2a50d1,'headers':{'Content-Type':_0x9766('0x42')},'body':_0x9766('0x43')+encodeURIComponent(JSON[_0x9766('0x44')]([[[_0x9766('0x45'),JSON[_0x9766('0x44')]([_0x1b14a8,_0x4031ad||'en',![],_0x9766('0x46')]),null,_0x9766('0x47')]]]))};return rp(_0x2ffc9a)['then'](function(_0xa769c2){try{_0x7a765b=eval(_0xa769c2[_0x9766('0x48')](0x5))[0x0][0x2];}catch(_0x184f0b){throw new Error(_0x9766('0x49')+_0xa769c2[_0x9766('0x4a')]);}if(!_0x7a765b){if(_0x1b14a8[_0x9766('0x4b')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9766('0x4c')+_0x4031ad+_0x9766('0x4d'));}}try{_0x7a765b=eval(_0x7a765b)[0x0];}catch(_0x46f913){throw new Error(_0x9766('0x49')+res[_0x9766('0x4a')]);}const _0x54a973=_0x7a765b;_0x59c7cc=path[_0x9766('0x3d')](__dirname,_0x9766('0x25'),rs['generate'](0x4)+_0x9766('0x38'));fs['writeFileSync'](_0x59c7cc,_0x7a765b,{'encoding':_0x9766('0x2e')});_0x192064=path[_0x9766('0x3d')](__dirname,'tmp',rs[_0x9766('0x26')](0x4)+_0x9766('0x27'));return convertFile(_0x59c7cc,_0x192064);})[_0x9766('0x29')](function(){try{fs['unlink'](_0x59c7cc);fs['chmodSync'](_0x192064,_0x9766('0x3c'));}catch(_0x51a010){logger[_0x9766('0x14')](_0x51a010);}logger['info'](_0x9766('0x4e'),_0x192064[_0x9766('0x2b')]('.')[0x0]);return _0x192064['split']('.')[0x0];});};exports['googleASR']=function(_0x1b054b,_0x6b5323,_0x26a406){return google['asr'](_0x1b054b,_0x6b5323,_0x26a406)[_0x9766('0x29')](function(_0x5e70f3){logger[_0x9766('0x18')](_0x5e70f3[_0x9766('0x4f')]);return rp(_0x5e70f3);})[_0x9766('0x29')](function(_0x4b02ab){var _0x552941='';var _0x4ea901=0x0;try{fs[_0x9766('0x1b')](_0x1b054b);}catch(_0x3d5af5){logger['error'](_0x3d5af5);}if(_0x4b02ab&&_0x4b02ab[_0x9766('0x50')]){_0x552941=_0x4b02ab[_0x9766('0x50')][_0x9766('0x51')](function(_0x3e07d8){return _0x3e07d8&&_0x3e07d8[_0x9766('0x52')][0x0]&&_0x3e07d8[_0x9766('0x52')][0x0][_0x9766('0x53')]?_0x3e07d8[_0x9766('0x52')][0x0][_0x9766('0x53')]:'';})[_0x9766('0x54')]('\x0a');_0x4ea901=_0x4b02ab[_0x9766('0x50')][_0x9766('0x51')](function(_0x1c98c5){return _0x1c98c5&&_0x1c98c5[_0x9766('0x52')][0x0]&&_0x1c98c5[_0x9766('0x52')][0x0]['confidence']?_0x1c98c5['alternatives'][0x0]['confidence']:0x0;})[_0x9766('0x54')]('\x0a');}logger['info'](_0x9766('0x55'),_0x552941);logger[_0x9766('0x18')](_0x9766('0x56'),_0x4ea901);return{'transcript':_0x552941,'confidence':_0x4ea901};})[_0x9766('0x57')](function(_0x195bbb){logger[_0x9766('0x14')](_0x9766('0x58'),_0x195bbb[_0x9766('0x13')],_0x195bbb[_0x9766('0x59')],_0x195bbb[_0x9766('0x5a')]);});};exports[_0x9766('0x5b')]=function(_0x327c8f,_0x4be491,_0x1a198d,_0x3aeee3){var _0xd3ac58=apiai(_0x4be491,{'language':_0x3aeee3||'en'});return _0xd3ac58[_0x9766('0x5c')](_0x1a198d,{'sessionId':md5(_0x327c8f)})[_0x9766('0x29')](function(_0x147eba){logger[_0x9766('0x18')](JSON[_0x9766('0x44')](_0x147eba));return{'source':_0x147eba[_0x9766('0x5d')][_0x9766('0x5e')],'resolvedQuery':_0x147eba[_0x9766('0x5d')][_0x9766('0x5f')],'action':_0x147eba[_0x9766('0x5d')][_0x9766('0x60')],'actionIncomplete':_0x147eba[_0x9766('0x5d')][_0x9766('0x61')],'speech':_0x147eba[_0x9766('0x5d')][_0x9766('0x62')][_0x9766('0x63')],'score':_0x147eba[_0x9766('0x5d')][_0x9766('0x64')],'statusCode':_0x147eba[_0x9766('0x65')][_0x9766('0x66')],'endConversation':_0x147eba[_0x9766('0x5d')][_0x9766('0x67')][_0x9766('0x68')]||![],'isFallbackIntent':_0x147eba[_0x9766('0x5d')]['metadata'][_0x9766('0x69')]};});};exports[_0x9766('0x6a')]=function(_0x2c3ab1,_0x3a85af,_0x58ca7f,_0xc4a006,_0x21154c,_0x360cae){var _0x863ae5=_0xc4a006[_0x9766('0x6b')](/\\n/g,'\x0a');var _0x392d2f={'credentials':{'private_key':_0x863ae5,'client_email':_0x58ca7f}};var _0x34695f=new dialogflow[(_0x9766('0x6c'))](_0x392d2f);var _0x440544=_0x34695f[_0x9766('0x6d')](_0x3a85af,md5(_0x2c3ab1));var _0x11a00d={'session':_0x440544,'queryInput':{'text':{'text':_0x21154c,'languageCode':_0x360cae}}};return _0x34695f['detectIntent'](_0x11a00d)[_0x9766('0x29')](function(_0x1d6daf){if(_0x1d6daf&&_0x1d6daf['length']){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x9766('0x44')](_0x1d6daf));var _0x543ec6=_0x1d6daf[0x0];if(_0x543ec6){var _0x5ee724={'action':_0x543ec6[_0x9766('0x6e')][_0x9766('0x60')],'allRequiredParamsPresent':_0x543ec6[_0x9766('0x6e')][_0x9766('0x6f')],'endConversation':_0x543ec6[_0x9766('0x6e')][_0x9766('0x70')]&&_0x543ec6[_0x9766('0x6e')][_0x9766('0x70')][_0x9766('0x71')]?_0x543ec6[_0x9766('0x6e')][_0x9766('0x70')][_0x9766('0x71')][_0x9766('0x72')]['boolValue']:![],'fulfillmentText':_0x543ec6[_0x9766('0x6e')][_0x9766('0x73')],'intentName':_0x543ec6[_0x9766('0x6e')][_0x9766('0x74')]['name'],'intentDisplayName':_0x543ec6[_0x9766('0x6e')][_0x9766('0x74')][_0x9766('0x75')],'isFallbackIntent':_0x543ec6[_0x9766('0x6e')][_0x9766('0x74')][_0x9766('0x76')],'languageCode':_0x543ec6[_0x9766('0x6e')][_0x9766('0x77')],'queryText':_0x543ec6[_0x9766('0x6e')][_0x9766('0x78')],'responseId':_0x543ec6[_0x9766('0x79')],'score':_0x543ec6['queryResult'][_0x9766('0x7a')],'speech':_0x543ec6[_0x9766('0x6e')][_0x9766('0x73')],'providerResponse':JSON['stringify'](_0x1d6daf)};return _0x5ee724;}}});};exports[_0x9766('0x7b')]=function(_0x364e80,_0x156de7,_0x5d17f4,_0x28e480){return tilde[_0x9766('0x7c')](_0x364e80,_0x156de7,_0x5d17f4,_0x28e480)['then'](function(_0x2e4107){try{fs[_0x9766('0x1b')](_0x364e80);}catch(_0x1b36d1){logger['error'](_0x1b36d1);}logger[_0x9766('0x18')](_0x9766('0x7d'),_0x2e4107[_0x9766('0x53')]);logger[_0x9766('0x18')](_0x9766('0x7e'),_0x2e4107[_0x9766('0x7f')]);return _0x2e4107;});};exports['awsPolly']=function(_0x36292b,_0x5b164d,_0x20928c,_0x995dbb,_0x13837e,_0x31a68a){var _0x3f9118=path['resolve'](__dirname,'tmp',rs[_0x9766('0x26')](0x4)+_0x9766('0x38'));var _0x570668;return aws[_0x9766('0x80')](_0x36292b,_0x5b164d,_0x20928c,_0x995dbb,_0x13837e,_0x31a68a,_0x3f9118)['then'](function(){_0x570668=path[_0x9766('0x3d')](__dirname,_0x9766('0x25'),rs[_0x9766('0x26')](0x4)+'.wav');return convertFile(_0x3f9118,_0x570668);})[_0x9766('0x29')](function(){try{fs[_0x9766('0x1b')](_0x3f9118);fs[_0x9766('0x2a')](_0x570668,_0x9766('0x3c'));}catch(_0x78ec14){logger[_0x9766('0x14')](_0x78ec14);}return _0x570668[_0x9766('0x2b')]('.')[0x0];});};exports[_0x9766('0x81')]=function(_0x45a9af,_0x564261,_0x122033,_0x44bc79,_0x1a0807,_0x4c4613){return aws['lex'](_0x45a9af,_0x564261,_0x122033,_0x44bc79,_0x1a0807,_0x4c4613)[_0x9766('0x29')](function(_0x280d81){logger[_0x9766('0x18')](JSON[_0x9766('0x44')](_0x280d81));return _0x280d81;});};exports['ispeechTTS']=function(_0x2b2df1,_0x2e9e40,_0x3293e7,_0x2f11a4){var _0xa79b93=util[_0x9766('0x82')](_0x9766('0x83'),ISPEECH_API,_0x2b2df1,encodeURIComponent(_0x2e9e40),_0x3293e7,_0x2f11a4);var _0x28d25d=path[_0x9766('0x3d')](__dirname,_0x9766('0x25'),rs[_0x9766('0x26')](0x4)+_0x9766('0x38'));var _0x4350c3;return downloadFile(_0xa79b93,_0x28d25d)[_0x9766('0x29')](function(){_0x4350c3=path[_0x9766('0x3d')](__dirname,_0x9766('0x25'),rs['generate'](0x4)+_0x9766('0x27'));return convertFile(_0x28d25d,_0x4350c3);})[_0x9766('0x29')](function(){try{fs[_0x9766('0x1b')](_0x28d25d);fs[_0x9766('0x2a')](_0x4350c3,_0x9766('0x3c'));}catch(_0x9d0ac8){logger['error'](_0x9d0ac8);}return _0x4350c3[_0x9766('0x2b')]('.')[0x0];});};exports[_0x9766('0x84')]=function(_0x258446,_0x39c7f4,_0x3ca720,_0xeef9c3){var _0x31b1b9=util['format'](_0x9766('0x85'),ISPEECH_API,_0x39c7f4,_0x3ca720,base64Encode(_0x258446),_0xeef9c3?util[_0x9766('0x82')](_0x9766('0x86'),encodeURIComponent(_0xeef9c3)):_0x9766('0x87'));return uploadFile(_0x31b1b9)['then'](function(_0x57dc98){return querystring[_0x9766('0x88')](_0x57dc98);});};exports[_0x9766('0x89')]=function(_0x117877,_0x393a11){return sestek['nda'](_0x117877,_0x393a11)[_0x9766('0x29')](function(_0x3ddc18){logger[_0x9766('0x18')](JSON[_0x9766('0x44')](_0x3ddc18));var _0xf6fd9b={'speech':_0x3ddc18['text'],'action':_0x3ddc18[_0x9766('0x8a')]?_0x3ddc18[_0x9766('0x8a')][_0x9766('0x8b')]:undefined,'actiondata':_0x3ddc18[_0x9766('0x8a')]?_0x3ddc18[_0x9766('0x8a')][_0x9766('0x8c')]:undefined};if(_0x3ddc18[_0x9766('0x8a')]&&_0x3ddc18[_0x9766('0x8a')][_0x9766('0x8d')]){return base64Decode(_0x3ddc18['channelData'][_0x9766('0x8d')][_0x9766('0x8e')],path['resolve'](__dirname,'tmp',rs[_0x9766('0x26')](0x4)+_0x9766('0x27')))['then'](function(_0x5cd115){_0xf6fd9b[_0x9766('0x8f')]=_0x5cd115;return _0xf6fd9b;});}return _0xf6fd9b;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 2bab876..dc26df6 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 _0xe59a=['./nda','exports'];(function(_0x531a18,_0x28759b){var _0x1d18bb=function(_0x28e28f){while(--_0x28e28f){_0x531a18['push'](_0x531a18['shift']());}};_0x1d18bb(++_0x28759b);}(_0xe59a,0xe8));var _0xae59=function(_0x1bf838,_0x3a6288){_0x1bf838=_0x1bf838-0x0;var _0x2d6b79=_0xe59a[_0x1bf838];return _0x2d6b79;};var nda=require(_0xae59('0x0'));module[_0xae59('0x1')]={'nda':nda}; \ No newline at end of file +var _0x554e=['exports','./nda'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x554e,0x67));var _0xe554=function(_0x14064a,_0xdc7bf0){_0x14064a=_0x14064a-0x0;var _0x4f993e=_0x554e[_0x14064a];return _0x4f993e;};var nda=require(_0xe554('0x0'));module[_0xe554('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 c5f29bd..966f885 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 _0x12fd=['ndauth_url','/token','username','then','ndassistant_url','ndaactivity_type','callerid','calleridname','access_token','body','channelData','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x12fd,0x199));var _0xd12f=function(_0x289f59,_0x7febfc){_0x289f59=_0x289f59-0x0;var _0xacad9=_0x12fd[_0x289f59];return _0xacad9;};'use strict';var rp=require(_0xd12f('0x0'));var url=require(_0xd12f('0x1'));var logger=require(_0xd12f('0x2'))(_0xd12f('0x3'));module[_0xd12f('0x4')]=function(_0x48fb45,_0x1e72a3){var _0x37f6b4={'method':_0xd12f('0x5'),'uri':url[_0xd12f('0x6')](_0x1e72a3[_0xd12f('0x7')],_0xd12f('0x8')),'form':{'grant_type':'password','username':_0x1e72a3[_0xd12f('0x9')],'password':_0x1e72a3['password']},'json':!![]};return rp(_0x37f6b4)[_0xd12f('0xa')](function(_0x193e89){var _0x62de68={'method':_0xd12f('0x5'),'uri':url['resolve'](_0x1e72a3[_0xd12f('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1e72a3[_0xd12f('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x48fb45['uniqueid']},'from':{'id':_0x48fb45[_0xd12f('0xd')],'name':_0x48fb45[_0xd12f('0xe')]},'recipient':{'id':_0x48fb45['dnid'],'name':_0x48fb45['extension']},'text':_0x1e72a3['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x193e89[_0xd12f('0xf')]},'json':!![]};if(_0x1e72a3['project']){_0x62de68[_0xd12f('0x10')][_0xd12f('0x11')]['ProjectName']=_0x1e72a3[_0xd12f('0x12')];}if(_0x1e72a3[_0xd12f('0x13')]=='1'){_0x62de68['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd12f('0x14')};}if(_0x1e72a3[_0xd12f('0x15')]){_0x62de68[_0xd12f('0x10')][_0xd12f('0x11')][_0xd12f('0x16')]=_0x1e72a3[_0xd12f('0x15')];if(_0x1e72a3[_0xd12f('0x17')]){_0x62de68[_0xd12f('0x10')][_0xd12f('0x11')]['CustomActionData']=_0x1e72a3['custom_action_data'];}}logger[_0xd12f('0x18')](JSON[_0xd12f('0x19')](_0x62de68));return rp(_0x62de68);});}; \ No newline at end of file +var _0xfbac=['resolve','ndauth_url','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xfbac,0x167));var _0xcfba=function(_0x4d229a,_0x4e359f){_0x4d229a=_0x4d229a-0x0;var _0x3c544f=_0xfbac[_0x4d229a];return _0x3c544f;};'use strict';var rp=require('request-promise');var url=require(_0xcfba('0x0'));var logger=require(_0xcfba('0x1'))(_0xcfba('0x2'));module[_0xcfba('0x3')]=function(_0x9aacde,_0x59384a){var _0x54c2c5={'method':'POST','uri':url[_0xcfba('0x4')](_0x59384a[_0xcfba('0x5')],'/token'),'form':{'grant_type':'password','username':_0x59384a[_0xcfba('0x6')],'password':_0x59384a['password']},'json':!![]};return rp(_0x54c2c5)[_0xcfba('0x7')](function(_0x5b7669){var _0x15e8d6={'method':_0xcfba('0x8'),'uri':url['resolve'](_0x59384a[_0xcfba('0x9')],_0xcfba('0xa')),'body':{'type':_0x59384a[_0xcfba('0xb')]||_0xcfba('0xc'),'channelId':_0xcfba('0xd'),'conversation':{'id':_0x9aacde[_0xcfba('0xe')]},'from':{'id':_0x9aacde[_0xcfba('0xf')],'name':_0x9aacde[_0xcfba('0x10')]},'recipient':{'id':_0x9aacde[_0xcfba('0x11')],'name':_0x9aacde[_0xcfba('0x12')]},'text':_0x59384a[_0xcfba('0x13')],'channelData':{}},'headers':{'Authorization':_0xcfba('0x14')+_0x5b7669['access_token']},'json':!![]};if(_0x59384a['project']){_0x15e8d6[_0xcfba('0x15')][_0xcfba('0x16')]['ProjectName']=_0x59384a[_0xcfba('0x17')];}if(_0x59384a[_0xcfba('0x18')]=='1'){_0x15e8d6[_0xcfba('0x15')][_0xcfba('0x16')][_0xcfba('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcfba('0x1a')};}if(_0x59384a[_0xcfba('0x1b')]){_0x15e8d6[_0xcfba('0x15')][_0xcfba('0x16')][_0xcfba('0x1c')]=_0x59384a[_0xcfba('0x1b')];if(_0x59384a[_0xcfba('0x1d')]){_0x15e8d6[_0xcfba('0x15')]['channelData'][_0xcfba('0x1e')]=_0x59384a[_0xcfba('0x1d')];}}logger[_0xcfba('0x1f')](JSON[_0xcfba('0x20')](_0x15e8d6));return rp(_0x15e8d6);});}; \ 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 d4ed6f6..797a062 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x1ae110,_0x19f8fc,_0x4b8417,_0x9af0a2){return asr(_0x1ae110,_0x19f8fc,_0x4b8417,_0x9af0a2);}; \ No newline at end of file +var _0xd3f0=['./lib/api','exports'];(function(_0x57a25d,_0x406e57){var _0x7d9159=function(_0x347ad3){while(--_0x347ad3){_0x57a25d['push'](_0x57a25d['shift']());}};_0x7d9159(++_0x406e57);}(_0xd3f0,0x17e));var _0x0d3f=function(_0x16369d,_0x41408d){_0x16369d=_0x16369d-0x0;var _0x51a9fa=_0xd3f0[_0x16369d];return _0x51a9fa;};'use strict';var asr=require(_0x0d3f('0x0'));module[_0x0d3f('0x1')]=function(_0x4a8843,_0x14c9d6,_0x456a3f,_0x55d36b){return asr(_0x4a8843,_0x14c9d6,_0x456a3f,_0x55d36b);}; \ 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 4b55ba7..35c3824 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 _0xab57=['update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xab57,0x1e1));var _0x7ab5=function(_0x14796e,_0x5b4d29){_0x14796e=_0x14796e-0x0;var _0x527280=_0xab57[_0x14796e];return _0x527280;};'use strict';var BPromise=require(_0x7ab5('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7ab5('0x1'));var crypto=require(_0x7ab5('0x2'));var logger=require(_0x7ab5('0x3'))(_0x7ab5('0x4'));module[_0x7ab5('0x5')]=function(_0x5674ef,_0xeac5dc,_0x5a3bcf,_0x4e6788){return new BPromise(function(_0x18fa8d,_0x2b0970){logger[_0x7ab5('0x6')](_0x7ab5('0x7'),_0x4e6788||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5ae49c=new WebSocket(_0x4e6788||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1c1563='';var _0x5b0782='0';var _0x3d6af8='1';var _0x556775=_0x7ab5('0x8');function _0x3fc3a2(_0x49992d){var _0x2f566e=crypto[_0x7ab5('0x9')](_0x7ab5('0xa'));_0x2f566e[_0x7ab5('0xb')](_0x49992d);return _0x2f566e[_0x7ab5('0xc')](_0x7ab5('0xd'));}function _0x2e72b6(){try{logger['info'](_0x7ab5('0xe'));var _0x5bb551=moment()[_0x7ab5('0xf')]();var _0x3b4ce9=_0x3fc3a2(_0x5bb551+_0xeac5dc+_0x5a3bcf);_0x5ae49c[_0x7ab5('0x10')](JSON[_0x7ab5('0x11')]({'appID':_0xeac5dc,'timestamp':_0x5bb551,'appKey':_0x3b4ce9}));var _0x50c786=fs[_0x7ab5('0x12')](_0x5674ef);_0x50c786['on'](_0x7ab5('0x13'),function(_0x4be35c){_0x5ae49c[_0x7ab5('0x10')](_0x4be35c);});_0x50c786['on'](_0x7ab5('0x14'),function(){_0x5ae49c[_0x7ab5('0x10')]('EOS');});}catch(_0x331856){logger[_0x7ab5('0x15')](_0x7ab5('0x16'),JSON[_0x7ab5('0x11')](_0x331856));_0x5ae49c[_0x7ab5('0x17')]();}}function _0x970931(_0x3aa03f){try{if(_0x3aa03f){var _0x66595a=JSON['parse'](_0x3aa03f);switch(_0x66595a[_0x7ab5('0x18')]){case 0x0:if(_0x66595a['result']){if(_0x66595a[_0x7ab5('0x19')][_0x7ab5('0x1a')]){logger[_0x7ab5('0x6')](_0x7ab5('0x1b'),JSON['stringify'](_0x66595a[_0x7ab5('0x19')][_0x7ab5('0x1c')]));_0x1c1563=_0x66595a['result'][_0x7ab5('0x1c')][0x0][_0x7ab5('0x1d')];_0x5b0782=_0x66595a[_0x7ab5('0x19')][_0x7ab5('0x1c')][0x0][_0x7ab5('0x1e')];_0x3d6af8='0';_0x556775='Success.';_0x5ae49c[_0x7ab5('0x17')]();}}break;case 0x1:logger['info'](_0x7ab5('0x8'));_0x3d6af8='1';_0x556775='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x7ab5('0x6')](_0x7ab5('0x1f'));_0x3d6af8='2';_0x556775=_0x7ab5('0x1f');break;case 0x9:logger[_0x7ab5('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3d6af8='9';_0x556775=_0x7ab5('0x20');break;case 0xa:logger['info'](_0x7ab5('0x21'));_0x3d6af8='10';_0x556775='Authentication\x20failed.';break;case 0xb:logger[_0x7ab5('0x6')](_0x7ab5('0x22'));_0x3d6af8='11';_0x556775='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x53dc69){logger[_0x7ab5('0x15')](_0x7ab5('0x23'),JSON[_0x7ab5('0x11')](_0x53dc69));_0x5ae49c[_0x7ab5('0x17')]();}}function _0x3fad2a(){logger['info'](_0x7ab5('0x24'));_0x18fa8d({'transcript':_0x1c1563,'confidence':_0x5b0782,'status':_0x3d6af8,'status_message':_0x556775});}function _0x5758a2(_0x4e91f2){logger[_0x7ab5('0x15')](_0x7ab5('0x25'));if(!_['isNil'](_0x4e91f2)){logger[_0x7ab5('0x15')](_[_0x7ab5('0x26')](_0x4e91f2)?JSON[_0x7ab5('0x11')](_0x4e91f2):_0x4e91f2);}}_0x5ae49c['on'](_0x7ab5('0x27'),_0x2e72b6);_0x5ae49c['on'](_0x7ab5('0x28'),_0x970931);_0x5ae49c['on'](_0x7ab5('0x14'),_0x3fad2a);_0x5ae49c['on'](_0x7ab5('0x15'),_0x5758a2);});}; \ No newline at end of file +var _0x5238=['data','close','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify'];(function(_0x152fd1,_0xafde11){var _0x1f196e=function(_0x3a8f94){while(--_0x3a8f94){_0x152fd1['push'](_0x152fd1['shift']());}};_0x1f196e(++_0xafde11);}(_0x5238,0x75));var _0x8523=function(_0xae8d69,_0x5ba612){_0xae8d69=_0xae8d69-0x0;var _0x13b0f8=_0x5238[_0xae8d69];return _0x13b0f8;};'use strict';var BPromise=require(_0x8523('0x0'));var _=require(_0x8523('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8523('0x2'));var crypto=require(_0x8523('0x3'));var logger=require(_0x8523('0x4'))('agi');module[_0x8523('0x5')]=function(_0x4ba6ee,_0x407db7,_0x7771f5,_0x4ab20c){return new BPromise(function(_0x239230,_0x3b0943){logger[_0x8523('0x6')]('Tilde\x20URI',_0x4ab20c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x495355=new WebSocket(_0x4ab20c||_0x8523('0x7'),{'perMessageDeflate':![]});var _0xc0cdf6='';var _0x457f90='0';var _0x5c9346='1';var _0x4952aa=_0x8523('0x8');function _0x1dae4b(_0x375bb6){var _0x1f8763=crypto['createHash'](_0x8523('0x9'));_0x1f8763['update'](_0x375bb6);return _0x1f8763[_0x8523('0xa')](_0x8523('0xb'));}function _0x1c441b(){try{logger[_0x8523('0x6')](_0x8523('0xc'));var _0x1eec4f=moment()['unix']();var _0x18360f=_0x1dae4b(_0x1eec4f+_0x407db7+_0x7771f5);_0x495355[_0x8523('0xd')](JSON[_0x8523('0xe')]({'appID':_0x407db7,'timestamp':_0x1eec4f,'appKey':_0x18360f}));var _0x109adf=fs['createReadStream'](_0x4ba6ee);_0x109adf['on'](_0x8523('0xf'),function(_0x293875){_0x495355[_0x8523('0xd')](_0x293875);});_0x109adf['on'](_0x8523('0x10'),function(){_0x495355[_0x8523('0xd')]('EOS');});}catch(_0x4d948e){logger[_0x8523('0x11')](_0x8523('0x12'),JSON[_0x8523('0xe')](_0x4d948e));_0x495355[_0x8523('0x13')]();}}function _0x29d93a(_0x34ff82){try{if(_0x34ff82){var _0x293315=JSON['parse'](_0x34ff82);switch(_0x293315['status']){case 0x0:if(_0x293315[_0x8523('0x14')]){if(_0x293315[_0x8523('0x14')][_0x8523('0x15')]){logger[_0x8523('0x6')](_0x8523('0x16'),JSON[_0x8523('0xe')](_0x293315[_0x8523('0x14')][_0x8523('0x17')]));_0xc0cdf6=_0x293315[_0x8523('0x14')]['hypotheses'][0x0][_0x8523('0x18')];_0x457f90=_0x293315['result'][_0x8523('0x17')][0x0][_0x8523('0x19')];_0x5c9346='0';_0x4952aa='Success.';_0x495355['terminate']();}}break;case 0x1:logger[_0x8523('0x6')](_0x8523('0x8'));_0x5c9346='1';_0x4952aa=_0x8523('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x5c9346='2';_0x4952aa=_0x8523('0x1a');break;case 0x9:logger[_0x8523('0x6')](_0x8523('0x1b'));_0x5c9346='9';_0x4952aa='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x8523('0x6')]('Authentication\x20failed.');_0x5c9346='10';_0x4952aa=_0x8523('0x1c');break;case 0xb:logger[_0x8523('0x6')](_0x8523('0x1d'));_0x5c9346='11';_0x4952aa=_0x8523('0x1d');}}}catch(_0x4abb46){logger[_0x8523('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x8523('0xe')](_0x4abb46));_0x495355[_0x8523('0x13')]();}}function _0x57d4e9(){logger[_0x8523('0x6')](_0x8523('0x1e'));_0x239230({'transcript':_0xc0cdf6,'confidence':_0x457f90,'status':_0x5c9346,'status_message':_0x4952aa});}function _0xfee767(_0x16d68f){logger[_0x8523('0x11')](_0x8523('0x1f'));if(!_[_0x8523('0x20')](_0x16d68f)){logger[_0x8523('0x11')](_['isObject'](_0x16d68f)?JSON[_0x8523('0xe')](_0x16d68f):_0x16d68f);}}_0x495355['on']('open',_0x1c441b);_0x495355['on']('message',_0x29d93a);_0x495355['on'](_0x8523('0x10'),_0x57d4e9);_0x495355['on'](_0x8523('0x11'),_0xfee767);});}; \ 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 a0bbb13..f165eef 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 _0x6434=['exports','./asr'];(function(_0x507a87,_0x2f44ab){var _0x288450=function(_0x2fd032){while(--_0x2fd032){_0x507a87['push'](_0x507a87['shift']());}};_0x288450(++_0x2f44ab);}(_0x6434,0x77));var _0x4643=function(_0x283b8a,_0x299b22){_0x283b8a=_0x283b8a-0x0;var _0x31bd0f=_0x6434[_0x283b8a];return _0x31bd0f;};var asr=require(_0x4643('0x0'));module[_0x4643('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd933=['exports','./asr'];(function(_0x1bf1ab,_0x272b0d){var _0x433fb0=function(_0x51cd2a){while(--_0x51cd2a){_0x1bf1ab['push'](_0x1bf1ab['shift']());}};_0x433fb0(++_0x272b0d);}(_0xd933,0x12d));var _0x3d93=function(_0x38060f,_0x31ce58){_0x38060f=_0x38060f-0x0;var _0x17441b=_0xd933[_0x38060f];return _0x17441b;};var asr=require(_0x3d93('0x0'));module[_0x3d93('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b533b4b..f1f4a75 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0xe706,0xa3));var _0x6e70=function(_0x4bdab6,_0xe86f11){_0x4bdab6=_0x4bdab6-0x0;var _0x5e1c1a=_0xe706[_0x4bdab6];return _0x5e1c1a;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xe706,0xa3));var _0x6e70=function(_0x111692,_0x19f8a9){_0x111692=_0x111692-0x0;var _0x11836f=_0xe706[_0x111692];return _0x11836f;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0b9660e..2a8c533 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 _0x5089=['getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','createSquareMessage','createCmContact','isEmpty','callback_','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentLogout','internal','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','POST','PUT','method','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','stringify','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','replaceAllVariables','getAndSetVariable','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','result','noop','Executed\x20command\x20MRCPSynth\x20%s','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','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','no\x20key\x20configured','.wav','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','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','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','channel','mailRpc','prototype'];(function(_0x1b7edd,_0x57456c){var _0x495876=function(_0xf9aa40){while(--_0xf9aa40){_0x1b7edd['push'](_0x1b7edd['shift']());}};_0x495876(++_0x57456c);}(_0x5089,0x1bb));var _0x9508=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x5089[_0x11ce46];return _0x368a1e;};'use strict';var fs=require('fs');var util=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));var sh=require('shelljs');var odbc=require(_0x9508('0x2'))();var rs=require(_0x9508('0x3'));var moment=require(_0x9508('0x4'));var Mustache=require(_0x9508('0x5'));var rp=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var scripts=require(_0x9508('0x8'));var FILES_PATH=_0x9508('0x9');var recursiveMapAttributes=[_0x9508('0xa'),'rawBody'];var verticesWithRetry=[_0x9508('0xb'),_0x9508('0xc'),'getsecretdigits'];var AGIVertices=function(_0x14dae7,_0x338897,_0x4f6720){this[_0x9508('0xd')]=_0x14dae7;this['rpc']=_0x338897;this[_0x9508('0xe')]=_0x4f6720;};AGIVertices[_0x9508('0xf')][_0x9508('0x10')]=function(_0x21f8c1,_0x839509){this[_0x9508('0x11')]['getVariableById'](_0x21f8c1)[_0x9508('0x12')](function(_0x507887){_0x839509(null,_0x507887?_0x507887[_0x9508('0x13')]:![]);})[_0x9508('0x14')](function(_0x554c90){_0x839509(_0x554c90);});};AGIVertices[_0x9508('0xf')][_0x9508('0x15')]=function(_0x10ceef,_0x4701de){this['rpc'][_0x9508('0x16')](_0x10ceef)[_0x9508('0x12')](function(_0x51c80b){_0x4701de(null,_0x51c80b?_0x51c80b[_0x9508('0x13')]:![]);})['catch'](function(_0x25d4d6){_0x4701de(_0x25d4d6);});};AGIVertices[_0x9508('0xf')][_0x9508('0x17')]=function(_0x255a03,_0x127340){this[_0x9508('0x11')][_0x9508('0x18')](_0x255a03)[_0x9508('0x12')](function(_0x5a303c){_0x127340(null,_0x5a303c?_0x5a303c[_0x9508('0x13')]:![]);})[_0x9508('0x14')](function(_0xfcc29d){_0x127340(_0xfcc29d);});};AGIVertices[_0x9508('0xf')][_0x9508('0x19')]=function(_0x22a9fe,_0x52e3c4){this['rpc'][_0x9508('0x1a')](_0x22a9fe)['then'](function(_0x2272e2){_0x52e3c4(null,_0x2272e2?_0x2272e2['dsn']:![]);})[_0x9508('0x14')](function(_0x22ff69){_0x52e3c4(_0x22ff69);});};AGIVertices[_0x9508('0xf')][_0x9508('0x1b')]=function(_0x1edf1b,_0x2f8106){this[_0x9508('0x11')]['getUserById'](_0x1edf1b)['then'](function(_0xd7b601){_0x2f8106(null,_0xd7b601?_0xd7b601[_0x9508('0x13')]:![]);})[_0x9508('0x14')](function(_0xf70830){_0x2f8106(_0xf70830);});};AGIVertices[_0x9508('0xf')][_0x9508('0x1c')]=function(_0x4b68e9,_0x5e9a80){this[_0x9508('0x11')]['getTrunkById'](_0x4b68e9)['then'](function(_0x1d4500){_0x5e9a80(null,_0x1d4500?_0x1d4500['name']:![]);})['catch'](function(_0x1c9b3e){_0x5e9a80(_0x1c9b3e);});};AGIVertices[_0x9508('0xf')]['getSound']=function(_0x49246b,_0x32b0dd){var _0x22b2e2=this;this[_0x9508('0x11')][_0x9508('0x1d')](_0x49246b)[_0x9508('0x12')](function(_0x15c32e){_0x32b0dd(null,_0x15c32e?_0x22b2e2[_0x9508('0x1e')](_0x15c32e[_0x9508('0x1f')]):![]);})[_0x9508('0x14')](function(_0x19a984){_0x32b0dd(_0x19a984);});};AGIVertices['prototype'][_0x9508('0x20')]=function(_0x3b894b,_0x2b3738){this['rpc'][_0x9508('0x21')](_0x3b894b)[_0x9508('0x12')](function(_0x5e1d31){_0x2b3738(null,_0x5e1d31?_0x5e1d31:![]);})[_0x9508('0x14')](function(_0x226645){_0x2b3738(_0x226645);});};AGIVertices['prototype'][_0x9508('0x22')]=function(_0x2fd00e,_0xb06b10,_0x36de9f){this['mailRpc']['sendMailMessage'](_0x2fd00e,_0xb06b10)[_0x9508('0x12')](function(){_0x36de9f(null);})[_0x9508('0x14')](function(_0x2677d6){_0x36de9f(_0x2677d6);});};AGIVertices['prototype']['getIntervals']=function(_0x301dd0,_0x14be59){this[_0x9508('0x11')][_0x9508('0x23')](_0x301dd0)[_0x9508('0x12')](function(_0x3f86d4){if(_0x3f86d4){if(_0x3f86d4[_0x9508('0x24')]){_0x14be59(null,[_0x3f86d4[_0x9508('0x25')]]);}else{_0x14be59(null,_[_0x9508('0x26')](_0x3f86d4[_0x9508('0x27')],'interval'));}}else{_0x14be59(null,![]);}})[_0x9508('0x14')](function(_0x27e248){_0x14be59(_0x27e248);});};AGIVertices['prototype'][_0x9508('0x1e')]=function(_0x42c23c){return util[_0x9508('0x28')](_0x9508('0x29'),FILES_PATH,_0x42c23c);};AGIVertices[_0x9508('0xf')][_0x9508('0x2a')]=function(_0x33e17c,_0x3700f1,_0xfb6676){odbc[_0x9508('0x2b')](_0x33e17c,function(_0x2a5d1b){if(_0x2a5d1b){logger['error'](_0x9508('0x2c'),_0x2a5d1b);_0xfb6676(_0x2a5d1b);}else{logger['info'](_0x9508('0x2d'));odbc[_0x9508('0x2e')](_0x3700f1,function(_0x23a8b6,_0x5644b6){if(_0x23a8b6){logger['info'](_0x9508('0x2f'),_0x3700f1);_0xfb6676(_0x23a8b6);}else{logger[_0x9508('0x30')](_0x9508('0x31'),_0x3700f1);odbc[_0x9508('0x32')](function(_0x4eb600){if(_0x4eb600){logger[_0x9508('0x33')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x4eb600);}_0xfb6676(null,_0x5644b6);});}});}});};AGIVertices[_0x9508('0xf')][_0x9508('0x34')]=function(_0x5205f8,_0x33e412){this[_0x9508('0x11')]['getSmsAccountById'](_0x5205f8)[_0x9508('0x12')](function(_0x1e6851){_0x33e412(null,_0x1e6851?_0x1e6851:![]);})[_0x9508('0x14')](function(_0x12fdc6){_0x33e412(_0x12fdc6);});};AGIVertices['prototype']['createSmsMessage']=function(_0xaf138f,_0x4ff354){this[_0x9508('0x11')][_0x9508('0x35')](_0xaf138f)[_0x9508('0x12')](function(_0x4215e9){_0x4ff354(null,_0x4215e9);})['catch'](function(_0x47e3a6){_0x4ff354(_0x47e3a6);});};AGIVertices['prototype'][_0x9508('0x36')]=function(_0x5e7fe3,_0x3f2fc1,_0x54e4bf){this[_0x9508('0x11')][_0x9508('0x36')]({'uniqueid':this[_0x9508('0xd')][_0x9508('0x37')],'node':_0x5e7fe3['label'],'application':_0x5e7fe3[_0x9508('0x38')],'data':_0x3f2fc1||null,'project_name':this[_0x9508('0xd')][_0x9508('0x39')],'callerid':this['channel'][_0x9508('0x3a')]})[_0x9508('0x12')](function(_0x560b9c){if(_0x54e4bf){_0x54e4bf(null,_0x560b9c);}})[_0x9508('0x14')](function(_0x50a4ba){if(_0x54e4bf){_0x54e4bf(_0x50a4ba);}});};AGIVertices[_0x9508('0xf')]['createSquareRecording']=function(_0x5b4888,_0x4194be,_0x168afb,_0x1936c8){this[_0x9508('0x11')][_0x9508('0x3b')]({'uniqueid':this[_0x9508('0xd')]['uniqueid'],'callerid':this[_0x9508('0xd')][_0x9508('0x3a')],'calleridname':this[_0x9508('0xd')]['calleridname'],'context':this[_0x9508('0xd')][_0x9508('0x3c')],'extension':this[_0x9508('0xd')][_0x9508('0x3d')],'priority':this['channel'][_0x9508('0x3e')],'accountcode':this['channel'][_0x9508('0x3f')],'dnid':this[_0x9508('0xd')]['dnid'],'projectName':this[_0x9508('0xd')][_0x9508('0x39')],'saveName':_0x4194be,'filename':_0x5b4888['file']||_0x4194be,'savePath':_0x168afb})[_0x9508('0x12')](function(_0x22306e){_0x1936c8(null,_0x22306e);})['catch'](function(_0x39215b){_0x1936c8(_0x39215b);});};AGIVertices['prototype'][_0x9508('0x40')]=function(_0x50df5e,_0x1e6c8c,_0x55a023,_0x49ac4f,_0x55a158){this['rpc'][_0x9508('0x40')]({'uniqueid':this[_0x9508('0xd')][_0x9508('0x37')],'body':_0x50df5e,'direction':_0x1e6c8c,'providerName':_0x55a023,'providerResponse':_0x49ac4f})[_0x9508('0x12')](function(_0x40e385){if(_0x55a158){_0x55a158(null,_0x40e385);}})[_0x9508('0x14')](function(_0x2b9854){if(_0x55a158){_0x55a158(_0x2b9854);}});};AGIVertices[_0x9508('0xf')][_0x9508('0x41')]=function(_0x5e4992,_0x3398d2){this[_0x9508('0x11')][_0x9508('0x41')]({'firstName':_[_0x9508('0x42')](_0x5e4992[_0x9508('0x13')])||_['isNil'](_0x5e4992['name'])?_0x9508('0x43')+Math['random']():_0x5e4992[_0x9508('0x13')],'lastName':_[_0x9508('0x42')](_0x5e4992['lastName'])||_[_0x9508('0x44')](_0x5e4992['lastName'])?null:_0x5e4992['lastName'],'phone':_0x5e4992[_0x9508('0x45')],'ListId':_0x5e4992[_0x9508('0x46')],'scheduledat':_0x5e4992['scheduledAt'],'callbackUniqueid':this[_0x9508('0xd')][_0x9508('0x37')],'tags':_0x9508('0x47'),'description':_0x9508('0x48')+_0x5e4992[_0x9508('0x49')][_0x9508('0x4a')](),'priority':_0x5e4992[_0x9508('0x4b')]})[_0x9508('0x12')](function(_0x367da4){_0x3398d2(null,_0x367da4);})[_0x9508('0x14')](function(_0x122934){_0x3398d2(_0x122934);});};AGIVertices[_0x9508('0xf')][_0x9508('0x4c')]=function(_0x2005f0,_0x4c7b6b){this[_0x9508('0x11')][_0x9508('0x4d')](_0x2005f0)['then'](function(_0x2573d1){_0x4c7b6b(null,_0x2573d1?_0x2573d1['name']:![]);})['catch'](function(_0x237cf9){_0x4c7b6b(_0x237cf9);});};AGIVertices[_0x9508('0xf')]['agentPause']=function(_0x199c2e,_0x198389,_0x553e6b){var _0x2d22dc={'role':_0x9508('0x4e')};_0x2d22dc[_0x199c2e]=this[_0x9508('0xd')]['callerid'];this[_0x9508('0x11')][_0x9508('0x4f')](_0x2d22dc,_0x198389,this[_0x9508('0xd')][_0x9508('0x37')])[_0x9508('0x12')](function(_0x34a4c5){_0x553e6b(null,_['isNil'](_0x34a4c5)?![]:!![]);})[_0x9508('0x14')](function(_0x460780){logger[_0x9508('0x33')](_0x460780);_0x553e6b(null,![]);});};AGIVertices[_0x9508('0xf')]['agentUnpause']=function(_0x2ff0bb,_0x5e2dab){var _0x314a07={'role':_0x9508('0x4e')};_0x314a07[_0x2ff0bb]=this['channel'][_0x9508('0x3a')];this[_0x9508('0x11')]['agentUnpause'](_0x314a07)[_0x9508('0x12')](function(_0x132e3f){_0x5e2dab(null,_[_0x9508('0x44')](_0x132e3f)?![]:!![]);})[_0x9508('0x14')](function(_0x5aa42b){logger[_0x9508('0x33')](_0x5aa42b);_0x5e2dab(null,![]);});};AGIVertices[_0x9508('0xf')][_0x9508('0x50')]=function(_0x468375,_0x27bae4){var _0x9a59f7={'role':_0x9508('0x4e')};_0x9a59f7[_0x468375]=this[_0x9508('0xd')]['callerid'];this[_0x9508('0x11')][_0x9508('0x50')](_0x9a59f7)[_0x9508('0x12')](function(_0x4fd9af){_0x27bae4(null,_[_0x9508('0x44')](_0x4fd9af)?![]:!![]);})['catch'](function(_0x3256e9){logger['error'](_0x3256e9);_0x27bae4(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x2c2cd8,_0x195be7){var _0x22c0c9={'role':'agent'};_0x22c0c9[_0x2c2cd8]=this[_0x9508('0xd')][_0x9508('0x3a')];var _0x3a092a=_0x2c2cd8!=_0x9508('0x51')?util[_0x9508('0x28')]('%s/%s@from-sip/n','LOCAL',this[_0x9508('0xd')][_0x9508('0x3a')]):undefined;this[_0x9508('0x11')][_0x9508('0x52')](_0x22c0c9,_0x3a092a)[_0x9508('0x12')](function(_0x3ec6b7){_0x195be7(null,_[_0x9508('0x44')](_0x3ec6b7)?![]:!![]);})[_0x9508('0x14')](function(_0x3e60d0){logger[_0x9508('0x33')](_0x3e60d0);_0x195be7(null,![]);});};AGIVertices[_0x9508('0xf')][_0x9508('0x53')]=function(_0x57e389,_0x520f72){sh[_0x9508('0x54')](_['trim'](_0x57e389),function(_0x3847ad,_0x47d7ff){var _0x4c89d2=_0x47d7ff[_0x9508('0x55')](/(\r\n|\n|\r)/gm,'');_0x520f72(null,_0x4c89d2);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x32da5f,_0x5f67d7){scripts[_0x9508('0x56')](_0x32da5f[_0x9508('0x57')],_0x32da5f[_0x9508('0x58')]||_0x9508('0x59'),_0x32da5f[_0x9508('0x59')],_0x32da5f[_0x9508('0x5a')]||_0x9508('0x5b'),_0x32da5f[_0x9508('0x5c')]||_0x9508('0x5d'),_0x32da5f[_0x9508('0x5e')]||_0x9508('0x5f'))[_0x9508('0x12')](function(_0x456828){_0x5f67d7(null,_0x456828);})['catch'](function(_0x2dc584){_0x5f67d7(_0x2dc584);});};AGIVertices['prototype'][_0x9508('0x60')]=function(_0x39618d,_0x42ab8e){scripts[_0x9508('0x60')](_0x39618d[_0x9508('0x59')],_0x39618d[_0x9508('0x61')]||'en',0x1)[_0x9508('0x12')](function(_0x2658e1){_0x42ab8e(null,_0x2658e1);})[_0x9508('0x14')](function(_0x18b441){_0x42ab8e(_0x18b441);});};AGIVertices[_0x9508('0xf')][_0x9508('0x62')]=function(_0x5d0d94,_0x2db0af){var _0x2020bd={'uri':_0x5d0d94[_0x9508('0x63')],'method':_0x5d0d94['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5d0d94['timeout'])===_0x9508('0x64')&&parseInt(_0x5d0d94[_0x9508('0x65')])>=0x1?parseInt(_0x5d0d94[_0x9508('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x9508('0x66')]([_0x9508('0x67'),_0x9508('0x68')],_0x2020bd[_0x9508('0x69')]['toUpperCase']())){try{_0x2020bd[_0x9508('0x6a')]=_0x5d0d94['rawBody']?JSON['parse'](_0x5d0d94[_0x9508('0x6b')]):{};}catch(_0x5b576a){logger[_0x9508('0x33')](_0x9508('0x6c'),_0x5b576a);}}try{_0x2020bd['headers']=_0x5d0d94[_0x9508('0xa')]?JSON['parse'](_0x5d0d94[_0x9508('0xa')]):{};}catch(_0x5d9dd2){logger[_0x9508('0x33')](_0x9508('0x6d'),_0x5d9dd2);}if(_0x5d0d94[_0x9508('0x6e')]){try{var _0x21c1b7=require(_0x5d0d94[_0x9508('0x6e')])[_0x9508('0x6f')](this,_0x2020bd);_0x2020bd[_0x9508('0x70')]=Mustache[_0x9508('0x71')](_0x5d0d94[_0x9508('0x63')],_0x21c1b7,{},['$$','$$']);if(_0x2020bd[_0x9508('0x72')]){_0x2020bd['headers']=JSON[_0x9508('0x73')](Mustache[_0x9508('0x71')](JSON[_0x9508('0x74')](_0x2020bd[_0x9508('0x72')]),_0x21c1b7,{},['$$','$$']));}if(_0x2020bd[_0x9508('0x6a')]){_0x2020bd[_0x9508('0x6a')]=JSON['parse'](Mustache['render'](JSON[_0x9508('0x74')](_0x2020bd[_0x9508('0x6a')]),_0x21c1b7,{},['$$','$$']));}}catch(_0x1ad750){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1ad750);}}rp(_0x2020bd)[_0x9508('0x12')](function(_0x525ce2){var _0x287a1b={'statusCode':_0x525ce2[_0x9508('0x75')]||0xc8,'statusMessage':_0x525ce2[_0x9508('0x76')]||'OK','headers':_0x525ce2['headers']||{},'body':_0x525ce2[_0x9508('0x6a')]||{}};_0x2db0af(null,_0x287a1b);})[_0x9508('0x14')](function(_0x212d04){var _0x3ea6e0={'statusCode':_0x212d04[_0x9508('0x75')]||0x1f4,'statusMessage':_0x212d04[_0x9508('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x212d04['options'][_0x9508('0x72')]||{},'body':_0x212d04[_0x9508('0x78')]['body']||{}};_0x2db0af(null,_0x3ea6e0);});};AGIVertices[_0x9508('0xf')][_0x9508('0x79')]=function(_0xdf4171,_0x4959a6){scripts['googleDialogflow'](this[_0x9508('0xd')]['uniqueid'],_0xdf4171[_0x9508('0x7a')],_0xdf4171[_0x9508('0x59')],_0xdf4171[_0x9508('0x7b')]||'en')[_0x9508('0x12')](function(_0x5af5e4){_0x4959a6(null,_0x5af5e4);})[_0x9508('0x14')](function(_0x178b03){_0x4959a6(_0x178b03);});};AGIVertices['prototype'][_0x9508('0x7c')]=function(_0x146d98,_0xa89fca){scripts['googleDialogflowV2'](this[_0x9508('0xd')]['uniqueid'],_0x146d98[_0x9508('0x7d')],_0x146d98[_0x9508('0x7e')],_0x146d98[_0x9508('0x7f')],_0x146d98[_0x9508('0x59')],_0x146d98[_0x9508('0x80')]||'en')[_0x9508('0x12')](function(_0x2f9f8d){_0xa89fca(null,_0x2f9f8d);})[_0x9508('0x14')](function(_0x234b3e){_0xa89fca(_0x234b3e);});};AGIVertices[_0x9508('0xf')][_0x9508('0x81')]=function(_0x2c271e,_0x33ff9c){scripts[_0x9508('0x81')](this[_0x9508('0xd')],_0x2c271e)[_0x9508('0x12')](function(_0x482b07){_0x33ff9c(null,_0x482b07);})[_0x9508('0x14')](function(_0x47cccc){_0x33ff9c(_0x47cccc);});};AGIVertices['prototype'][_0x9508('0x82')]=function(_0x3bb289,_0x1fa1e8){scripts['ispeechTTS'](_0x3bb289[_0x9508('0x7a')],_0x3bb289[_0x9508('0x59')],_0x3bb289[_0x9508('0x83')]||_0x9508('0x5b'),_0x3bb289[_0x9508('0x84')])[_0x9508('0x12')](function(_0x303d50){_0x1fa1e8(null,_0x303d50);})['catch'](function(_0x1368d2){_0x1fa1e8(_0x1368d2);});};AGIVertices['prototype'][_0x9508('0x85')]=function(_0x2db5ed,_0x1db47b,_0x3cfd6b){scripts[_0x9508('0x85')](_0x1db47b,_0x2db5ed[_0x9508('0x7a')],_0x2db5ed[_0x9508('0x86')]||_0x9508('0x5b'),this[_0x9508('0x87')](_0x2db5ed['model'])?_0x2db5ed[_0x9508('0x88')]:undefined)['then'](function(_0x55900d){_0x3cfd6b(null,_0x55900d);})[_0x9508('0x14')](function(_0x2851ba){_0x3cfd6b(_0x2851ba);});};AGIVertices[_0x9508('0xf')][_0x9508('0x89')]=function(_0x5e3e7a,_0x54e7e8){scripts[_0x9508('0x89')](_0x5e3e7a[_0x9508('0x8a')],_0x5e3e7a[_0x9508('0x8b')],_0x5e3e7a['aws_polly_region'],_0x5e3e7a[_0x9508('0x8c')]||'Amy',_0x5e3e7a['text'],_0x5e3e7a[_0x9508('0x8d')]||'text')[_0x9508('0x12')](function(_0x1d6547){_0x54e7e8(null,_0x1d6547);})[_0x9508('0x14')](function(_0x1d443a){_0x54e7e8(_0x1d443a);});};AGIVertices[_0x9508('0xf')][_0x9508('0x8e')]=function(_0x50ce8b,_0x4566ff){scripts[_0x9508('0x8e')](this['channel'][_0x9508('0x37')],_0x50ce8b['aws_access_key_id'],_0x50ce8b['aws_secret_access_key'],_0x50ce8b[_0x9508('0x8f')],_0x50ce8b[_0x9508('0x59')],_0x50ce8b[_0x9508('0x90')])[_0x9508('0x12')](function(_0x4c8bab){_0x4566ff(null,_0x4c8bab);})[_0x9508('0x14')](function(_0x3ae1a5){_0x4566ff(_0x3ae1a5);});};AGIVertices[_0x9508('0xf')][_0x9508('0x91')]=function(_0x5eeed0,_0x510ba6,_0x4ebc98){scripts[_0x9508('0x91')](_0x510ba6,_0x5eeed0[_0x9508('0x7a')],_0x5eeed0[_0x9508('0x92')]||_0x9508('0x5b'))[_0x9508('0x12')](function(_0x291240){_0x4ebc98(null,_0x291240);})[_0x9508('0x14')](function(_0x1ac4e2){_0x4ebc98(_0x1ac4e2);});};AGIVertices[_0x9508('0xf')][_0x9508('0x93')]=function(_0x21c8c9,_0x1d31e5,_0x721116){scripts[_0x9508('0x93')](_0x1d31e5,_0x21c8c9['appid'],_0x21c8c9[_0x9508('0x94')],_0x21c8c9['uri'])[_0x9508('0x12')](function(_0x4b7ba4){_0x721116(null,_0x4b7ba4);})[_0x9508('0x14')](function(_0x4477ee){_0x721116(_0x4477ee);});};AGIVertices[_0x9508('0xf')][_0x9508('0x95')]=function(_0x155d6d){var _0x25a599=_[_0x9508('0x66')](verticesWithRetry,_0x155d6d[_0x9508('0x38')])?_0x155d6d:_[_0x9508('0x96')](_0x155d6d);for(var _0x46bd70 in _0x25a599){if(_0x25a599[_0x9508('0x97')](_0x46bd70)){if(_0x25a599[_0x46bd70]&&_['isString'](_0x25a599[_0x46bd70])){if(_[_0x9508('0x66')](recursiveMapAttributes,_0x46bd70)){_0x25a599[_0x46bd70]=this[_0x9508('0x98')](_0x25a599[_0x46bd70]);}else{_0x25a599[_0x46bd70]=this['replaceAllVariables'](_0x25a599[_0x46bd70]);}}}}return _0x25a599;};AGIVertices[_0x9508('0xf')]['recursiveNodeIndex']=function(_0x41bcd9){for(var _0x1a0901 in _0x41bcd9){if(_0x41bcd9[_0x9508('0x97')](_0x1a0901)){if(_[_0x9508('0x99')](_0x41bcd9[_0x1a0901])){this[_0x9508('0x9a')](_0x41bcd9[_0x1a0901]);}else if(_[_0x9508('0x9b')](_0x41bcd9[_0x1a0901])){for(var _0x5293da=0x0;_0x5293da<_0x41bcd9[_0x1a0901][_0x9508('0x9c')];_0x5293da++){this['recursiveNodeIndex'](_0x41bcd9[_0x1a0901][_0x5293da]);}}else if(_[_0x9508('0x9d')](_0x41bcd9[_0x1a0901])){_0x41bcd9[_0x1a0901]=this['replaceAllVariables'](_0x41bcd9[_0x1a0901]);}}}};AGIVertices[_0x9508('0xf')][_0x9508('0x9e')]=function(_0x40cc62,_0xbeee60){for(var _0x2e2eb2 in _0x40cc62){if(_0x40cc62[_0x9508('0x97')](_0x2e2eb2)){if(_[_0x9508('0x99')](_0x40cc62[_0x2e2eb2])){if(!_[_0x9508('0x42')](_0x40cc62[_0x2e2eb2])){this[_0x9508('0x9e')](_0x40cc62[_0x2e2eb2],util[_0x9508('0x28')](_0x9508('0x9f'),_0xbeee60,_0x2e2eb2));}}else if(_[_0x9508('0x9b')](_0x40cc62[_0x2e2eb2])){for(var _0x3e8b0a=0x0;_0x3e8b0a<_0x40cc62[_0x2e2eb2]['length'];_0x3e8b0a++){this['saveRestApiResult'](_0x40cc62[_0x2e2eb2][_0x3e8b0a],util[_0x9508('0x28')]('%s.%s',_0xbeee60,_0x2e2eb2+'['+_0x3e8b0a+']'));}}else{if(!_['isNil'](_0x40cc62[_0x2e2eb2])){this['channel'][_0x9508('0xa0')](util[_0x9508('0x28')]('%s.%s',_0xbeee60,_0x2e2eb2),_0x40cc62[_0x2e2eb2]);}}}}};AGIVertices['prototype'][_0x9508('0x98')]=function(_0x230a76){try{var _0x58edee=JSON[_0x9508('0x73')](_0x230a76);this['recursiveNodeIndex'](_0x58edee);return JSON[_0x9508('0x74')](_0x58edee);}catch(_0x1127db){return this['replaceAllVariables'](_0x230a76);}};AGIVertices[_0x9508('0xf')]['replaceAllVariables']=function(_0x249476){var _0x979665=_0x249476[_0x9508('0xa1')]('{');for(var _0x3e35b8=0x1;_0x3e35b8<_0x979665['length'];_0x3e35b8+=0x1){var _0x380f11=_0x979665[_0x3e35b8]['split']('}');if(_0x380f11[_0x9508('0x9c')]>0x1){_0x249476=_0x249476[_0x9508('0xa2')]('{'+_0x380f11[0x0]+'}',this[_0x9508('0xd')][_0x9508('0x10')](_0x380f11[0x0])[_0x9508('0xa3')]||_0x380f11[0x0]);}}if(_0x979665[_0x9508('0x9c')]===0x1){return _0x249476[_0x9508('0x4a')]();}return this[_0x9508('0xa4')](_0x249476);};AGIVertices[_0x9508('0xf')][_0x9508('0xa5')]=function(_0x51b44c,_0x5ede0e){var _0x28cefb=this[_0x9508('0xd')][_0x9508('0x10')](_0x51b44c);if(_0x28cefb['result']===-0x1){return _0x28cefb;}logger[_0x9508('0x30')](util[_0x9508('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5ede0e,_0x28cefb[_0x9508('0xa3')]));return this[_0x9508('0xd')][_0x9508('0xa0')](_0x5ede0e,_0x28cefb[_0x9508('0xa3')]);};AGIVertices['prototype'][_0x9508('0x87')]=function(_0x4a2646){return _0x4a2646&&_0x4a2646!=='0'&&_0x4a2646!=='-1'&&_0x4a2646!=='';};AGIVertices['prototype']['maxRetry']=function(_0x106251){this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x106251,'-');_0x106251[_0x9508('0xa6')]=_0x106251[_0x9508('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9508('0xf')]['mrcpsynth']=function(_0x2802b4){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xa8'),_0x2802b4[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x2802b4['text'])){return this[_0x9508('0xd')]['noop'](_0x9508('0xaa'));}var _0xb79d84='\x22'+_0x2802b4[_0x9508('0x59')]+'\x22';if(this['isConfigured'](_0x2802b4[_0x9508('0x78')])){_0xb79d84+=','+_0x2802b4['options'];}var _0x5a4db4=this[_0x9508('0xd')][_0x9508('0x54')]('MRCPSynth',_0xb79d84);if(_0x5a4db4[_0x9508('0xab')]===-0x1){return _0x5a4db4;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xad'),_0xb79d84));};AGIVertices[_0x9508('0xf')][_0x9508('0xae')]=function(_0x119c3a){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xaf'),_0x119c3a[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x119c3a[_0x9508('0xb0')])){return this['channel'][_0x9508('0xac')](_0x9508('0xb1'));}var _0x3fd814=_0x119c3a[_0x9508('0xb0')];if(this['isConfigured'](_0x119c3a[_0x9508('0x78')])){_0x3fd814+=','+_0x119c3a[_0x9508('0x78')];}var _0x14314b=this[_0x9508('0xd')][_0x9508('0x54')](_0x9508('0xb2'),_0x3fd814);if(_0x14314b['result']===-0x1){return _0x14314b;}var _0x1fdf50=this[_0x9508('0xa5')](_0x9508('0xb3'),_0x9508('0xb4'));if(_0x1fdf50[_0x9508('0xab')]===-0x1){return _0x1fdf50;}var _0x49dbc6=this['getAndSetVariable'](_0x9508('0xb5'),_0x9508('0xb6'));if(_0x49dbc6[_0x9508('0xab')]===-0x1){return _0x49dbc6;}var _0xe77013=this[_0x9508('0xa5')](_0x9508('0xb7'),_0x9508('0xb8'));if(_0xe77013['result']===-0x1){return _0xe77013;}return this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3fd814));};AGIVertices[_0x9508('0xf')][_0x9508('0x7')]=function(_0x10beb2){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xb9'),_0x10beb2[_0x9508('0xa9')]));return this['channel'][_0x9508('0x7')]([_0x10beb2[_0x9508('0xba')],_0x10beb2['args']]);};AGIVertices[_0x9508('0xf')][_0x9508('0xbb')]=function(_0x19d8dd){logger['info'](util['format'](_0x9508('0xbc'),_0x19d8dd[_0x9508('0xa9')]));if(this[_0x9508('0x87')](_0x19d8dd['timeout'])){logger['info'](util[_0x9508('0x28')](_0x9508('0xbd'),_0x19d8dd[_0x9508('0x65')]));var _0x3ef7e3=this[_0x9508('0xd')][_0x9508('0xbe')](_0x19d8dd[_0x9508('0x65')]);if(_0x3ef7e3[_0x9508('0xab')]===-0x1){return _0x3ef7e3;}}return this[_0x9508('0xd')][_0x9508('0xbb')]();};AGIVertices[_0x9508('0xf')][_0x9508('0x47')]=function(_0xd931a4){logger['info'](util[_0x9508('0x28')](_0x9508('0xbf'),_0xd931a4['label']));if(!this[_0x9508('0x87')](_0xd931a4[_0x9508('0x46')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0xd931a4,'no\x20list\x20selected');}_0xd931a4[_0x9508('0x49')]=moment();if(this[_0x9508('0x87')](_0xd931a4['delay'])){_0xd931a4[_0x9508('0x49')]=moment()['add'](_0xd931a4[_0x9508('0xc0')],'minutes');}if(!this[_0x9508('0x87')](_0xd931a4[_0x9508('0x4b')])){_0xd931a4[_0x9508('0x4b')]=0x2;}this[_0x9508('0x41')][_0x9508('0x6f')](this,_0xd931a4);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xc1'),_0xd931a4[_0x9508('0x45')],_0xd931a4[_0x9508('0x46')],_0xd931a4[_0x9508('0x49')]));};AGIVertices['prototype'][_0x9508('0xc2')]=function(_0x1c19ef){logger[_0x9508('0x30')](util['format'](_0x9508('0xc3'),_0x1c19ef[_0x9508('0xa9')]));var _0x1d0e4c=this[_0x9508('0xd')][_0x9508('0x54')](_0x1c19ef['application'],_0x1c19ef[_0x9508('0x78')]);if(_0x1d0e4c[_0x9508('0xab')]===-0x1){return _0x1d0e4c;}return this[_0x9508('0xd')]['noop'](util['format'](_0x9508('0xc4'),_0x1c19ef[_0x9508('0xc5')],_0x1c19ef['options']));};AGIVertices[_0x9508('0xf')][_0x9508('0xc6')]=function(_0x24cfcd){logger['info'](util[_0x9508('0x28')](_0x9508('0xc7'),_0x24cfcd[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x24cfcd['text'])){return this['channel']['noop']('no\x20text\x20configured');}var _0x1a3a7d='\x22'+_0x24cfcd['text']+'\x22';if(this[_0x9508('0x87')](_0x24cfcd[_0x9508('0x78')])){_0x1a3a7d+=','+_0x24cfcd[_0x9508('0x78')];}var _0x423786=this[_0x9508('0xd')][_0x9508('0x54')]('MRCPSynth',_0x1a3a7d);if(_0x423786[_0x9508('0xab')]===-0x1){return _0x423786;}return this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xad'),_0x1a3a7d));};AGIVertices['prototype']['sestektts']=function(_0x36ece0){logger[_0x9508('0x30')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x36ece0[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x36ece0[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20text\x20configured');}var _0x1fb57c='\x22'+_0x36ece0[_0x9508('0x59')]+'\x22';if(this[_0x9508('0x87')](_0x36ece0[_0x9508('0x78')])){_0x1fb57c+=','+_0x36ece0['options'];}var _0x3a066f=this['channel'][_0x9508('0x54')](_0x9508('0xc8'),_0x1fb57c);if(_0x3a066f['result']===-0x1){return _0x3a066f;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xad'),_0x1fb57c));};AGIVertices[_0x9508('0xf')][_0x9508('0xc9')]=function(_0x1ea1b5){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1ea1b5['label']));if(!this[_0x9508('0x87')](_0x1ea1b5[_0x9508('0xb0')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x1fa662=_0x1ea1b5[_0x9508('0xb0')];if(this[_0x9508('0x87')](_0x1ea1b5[_0x9508('0x78')])){_0x1fa662+=','+_0x1ea1b5[_0x9508('0x78')];}var _0x230fdf=this['channel'][_0x9508('0x54')](_0x9508('0xb2'),_0x1fa662);if(_0x230fdf['result']===-0x1){return _0x230fdf;}var _0x1f9e4c=this['getAndSetVariable'](_0x9508('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1f9e4c[_0x9508('0xab')]===-0x1){return _0x1f9e4c;}var _0x3ca7b4=this[_0x9508('0xa5')](_0x9508('0xb5'),_0x9508('0xca'));if(_0x3ca7b4[_0x9508('0xab')]===-0x1){return _0x3ca7b4;}var _0x2ad943=this['getAndSetVariable'](_0x9508('0xb7'),_0x9508('0xcb'));if(_0x2ad943[_0x9508('0xab')]===-0x1){return _0x2ad943;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xcc'),_0x1fa662));};AGIVertices[_0x9508('0xf')]['sestekasr']=function(_0xfb0e8e){logger['info'](util['format'](_0x9508('0xcd'),_0xfb0e8e[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0xfb0e8e[_0x9508('0xb0')])){return this['channel'][_0x9508('0xac')](_0x9508('0xb1'));}var _0x3e1a1b=_0xfb0e8e[_0x9508('0xb0')];if(this[_0x9508('0x87')](_0xfb0e8e[_0x9508('0x78')])){_0x3e1a1b+=','+_0xfb0e8e[_0x9508('0x78')];}var _0x4aaca8=this['channel'][_0x9508('0x54')]('MRCPRecog',_0x3e1a1b);if(_0x4aaca8[_0x9508('0xab')]===-0x1){return _0x4aaca8;}var _0x4153b8=this[_0x9508('0xa5')](_0x9508('0xb3'),_0x9508('0xce'));if(_0x4153b8[_0x9508('0xab')]===-0x1){return _0x4153b8;}var _0x57ebdb=this[_0x9508('0xa5')](_0x9508('0xb5'),_0x9508('0xcf'));if(_0x57ebdb[_0x9508('0xab')]===-0x1){return _0x57ebdb;}var _0x318779=this[_0x9508('0xa5')](_0x9508('0xb7'),'SESTEK_ASR_INSTANCE');if(_0x318779[_0x9508('0xab')]===-0x1){return _0x318779;}return this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3e1a1b));};AGIVertices[_0x9508('0xf')]['database']=function(_0x6f2407){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xd0'),_0x6f2407[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x6f2407[_0x9508('0xd1')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x6f2407,_0x9508('0xd2'));}var _0x30884b=this[_0x9508('0x19')][_0x9508('0x6f')](this,_0x6f2407['odbc_id']);if(!_0x30884b){return this['channel']['error'](_0x6f2407,_0x9508('0xd3'));}if(!this[_0x9508('0x87')](_0x6f2407['query'])){return this[_0x9508('0xd')]['error'](_0x6f2407,'no\x20query\x20configured');}var _0x514173=_0x6f2407['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0xd4'),_0x514173));var _0x37043b=this['getQueryOdbc']['sync'](this,_0x30884b,_0x514173);this[_0x9508('0x36')]['sync'](this,_0x6f2407,_0x514173);if(!this[_0x9508('0x87')](_0x6f2407['variable_id'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xd5'));}var _0x178218=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x6f2407[_0x9508('0xd6')]);if(!_0x178218){return this[_0x9508('0xd')]['error'](_0x6f2407,'no\x20variable\x20found');}var _0x58c83b=this;_0x37043b[_0x9508('0xd7')](function(_0x5e0fe1,_0x25c003){Object[_0x9508('0xd8')](_0x5e0fe1)[_0x9508('0xd7')](function(_0x2264e7){_0x58c83b[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0xd9'),_0x178218,_0x25c003,_0x2264e7),_0x5e0fe1[_0x2264e7]);});});this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0xda'),_0x178218),_0x37043b[_0x9508('0x9c')]);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xdb'),_0x178218));};AGIVertices[_0x9508('0xf')][_0x9508('0xdc')]=function(_0x18f2cc){logger['debug'](util[_0x9508('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x18f2cc['label']));if(!this[_0x9508('0x87')](_0x18f2cc[_0x9508('0xdd')])){return this['channel'][_0x9508('0x33')](_0x18f2cc,_0x9508('0xde'));}var _0x336272=this[_0x9508('0x1b')][_0x9508('0x6f')](this,_0x18f2cc['sip_id']);if(!_0x336272){return this[_0x9508('0xd')]['error'](_0x18f2cc,_0x9508('0xdf'));}var _0x5e3e51=this[_0x9508('0xd')][_0x9508('0x54')]('DIAL',[util[_0x9508('0x28')](_0x9508('0xe0'),_0x336272),_0x18f2cc['timeout'],_0x18f2cc[_0x9508('0xe1')],_0x18f2cc['url']]);if(_0x5e3e51['result']===-0x1){return _0x5e3e51;}return this['channel'][_0x9508('0xac')](util[_0x9508('0x28')]('Executed\x20command\x20%s',_0x9508('0xe2')));};AGIVertices['prototype'][_0x9508('0xe3')]=function(_0x27562c){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0xe4'),_0x27562c[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x27562c['key'])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20key\x20configured');}if(!this[_0x9508('0x87')](_0x27562c['text'])){return this[_0x9508('0xd')]['noop']('no\x20text\x20configured');}this[_0x9508('0xd')]['bot']=!![];this[_0x9508('0x36')](_0x27562c);this[_0x9508('0x40')](_0x27562c[_0x9508('0x59')],'in','','');this['channel']['noop'](util[_0x9508('0x28')]('Trying\x20Dialogflow:\x20%s',_0x27562c[_0x9508('0x59')]));var _0x1a9606=this[_0x9508('0x79')][_0x9508('0x6f')](this,_0x27562c);if(_0x1a9606){for(var _0x4c6d79 in _0x1a9606){if(_0x1a9606[_0x9508('0x97')](_0x4c6d79)){this['channel']['setVariable'](util['format'](_0x9508('0xe5'),_0x4c6d79[_0x9508('0xe6')]()),_0x1a9606[_0x4c6d79]);}}this['createSquareMessage'](_0x1a9606[_0x9508('0xe7')],'out',_0x9508('0xe3'),'');return this['channel']['noop'](util[_0x9508('0x28')](_0x9508('0xe8'),_0x1a9606[_0x9508('0xe7')]));}return this[_0x9508('0xd')][_0x9508('0x33')](_0x27562c,_0x9508('0xe9'));};AGIVertices[_0x9508('0xf')][_0x9508('0xea')]=function(_0x58d201){logger['info'](util[_0x9508('0x28')](_0x9508('0xeb'),_0x58d201[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x7d')])){return this[_0x9508('0xd')]['noop'](_0x9508('0xec'));}if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x7e')])){return this['channel'][_0x9508('0xac')](_0x9508('0xed'));}if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x7f')])){return this[_0x9508('0xd')]['noop'](_0x9508('0xee'));}if(!this['isConfigured'](_0x58d201[_0x9508('0x80')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xef'));}if(!this[_0x9508('0x87')](_0x58d201[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xf0')]=!![];this[_0x9508('0x36')](_0x58d201);this[_0x9508('0x40')](_0x58d201[_0x9508('0x59')],'in','','');this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x58d201['text']));var _0x4fd315=this[_0x9508('0x7c')][_0x9508('0x6f')](this,_0x58d201);if(_0x4fd315){for(var _0xa0cf80 in _0x4fd315){if(_0x4fd315[_0x9508('0x97')](_0xa0cf80)){if(_0xa0cf80!=='providerResponse'){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('DIALOGFLOW_%s',_0xa0cf80[_0x9508('0xe6')]()),_0x4fd315[_0xa0cf80]);}}}this['createSquareMessage'](_0x4fd315[_0x9508('0xe7')],_0x9508('0xf1'),'dialogflowV2',_0x4fd315[_0x9508('0xf2')]);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xf3'),_0x4fd315['speech']));}return this[_0x9508('0xd')]['error'](_0x58d201,_0x9508('0xf4'));};AGIVertices['prototype'][_0x9508('0xf5')]=function(_0x18b597){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x18b597[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x18b597[_0x9508('0xf6')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xf7'));}if(!this['isConfigured'](_0x18b597[_0x9508('0xf8')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xf9'));}if(!this[_0x9508('0x87')](_0x18b597[_0x9508('0xfa')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xfb'));}if(!this[_0x9508('0x87')](_0x18b597[_0x9508('0xfc')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xf0')]=!![];this[_0x9508('0x36')](_0x18b597);this['createSquareMessage'](_0x18b597['text'],'in','','');this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xfd'),_0x18b597[_0x9508('0x59')]));var _0x13b61e=this[_0x9508('0x81')][_0x9508('0x6f')](this,_0x18b597);if(_0x13b61e){for(var _0x43cc15 in _0x13b61e){if(_0x13b61e[_0x9508('0x97')](_0x43cc15)){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('SESTEK_NDA_%s',_0x43cc15[_0x9508('0xe6')]()),_0x13b61e[_0x43cc15]);}}this[_0x9508('0x40')](_0x13b61e[_0x9508('0xe7')],_0x9508('0xf1'),_0x9508('0xf5'),'');if(_0x13b61e[_0x9508('0xfe')]){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x13b61e[_0x9508('0xfe')]));var _0x1e4ad2=this[_0x9508('0xd')][_0x9508('0xff')](_0x13b61e[_0x9508('0xfe')]);try{fs[_0x9508('0x100')](_0x13b61e[_0x9508('0xfe')]+'.wav');}catch(_0x2ba82a){logger[_0x9508('0x33')](_0x2ba82a);}return _0x1e4ad2;}else{return this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x101'),_0x13b61e['speech']));}}return this['channel'][_0x9508('0x33')](_0x18b597,_0x9508('0x102'));};AGIVertices[_0x9508('0xf')][_0x9508('0x103')]=function(_0x16498b){logger[_0x9508('0x30')](util['format'](_0x9508('0x104'),_0x16498b[_0x9508('0xa9')]));return this['channel']['noop'](_0x9508('0x103'));};AGIVertices[_0x9508('0xf')][_0x9508('0x105')]=function(_0x327ecd){logger['info'](util[_0x9508('0x28')](_0x9508('0x106'),_0x327ecd[_0x9508('0xa9')]));var _0x59a048='';if(_0x327ecd[_0x9508('0x107')]){if(!this[_0x9508('0x87')](_0x327ecd[_0x9508('0x107')])){return this[_0x9508('0xd')]['error'](_0x327ecd,'no\x20trunk\x20selected');}else{var _0x1af797=parseInt(_0x327ecd[_0x9508('0x107')],0xa);if(isNaN(_0x1af797)){_0x59a048=_0x327ecd[_0x9508('0x107')];}else{_0x59a048=this[_0x9508('0x1c')]['sync'](this,_0x327ecd[_0x9508('0x107')]);if(!_0x59a048){return this[_0x9508('0xd')][_0x9508('0x33')](_0x327ecd,_0x9508('0x108'));}}}}else if(_0x327ecd[_0x9508('0x109')]){_0x59a048=_0x327ecd[_0x9508('0x109')];}else{return this[_0x9508('0xd')]['error'](_0x327ecd,_0x9508('0x10a'));}var _0x315832=this[_0x9508('0xd')]['exec']('DIAL',[util[_0x9508('0x28')](_0x9508('0x10b'),_0x59a048,_0x327ecd['phone']),_0x327ecd[_0x9508('0x65')],_0x327ecd['opts'],_0x327ecd[_0x9508('0x63')]]);if(_0x315832[_0x9508('0xab')]===-0x1){return _0x315832;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x10c'),_0x9508('0xe2')));};AGIVertices[_0x9508('0xf')]['finally']=function(_0xfaa587){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x10d'),_0xfaa587[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x10e'));};AGIVertices[_0x9508('0xf')]['getdigits']=function(_0x4f0416){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4f0416['label']));if(_0x4f0416[_0x9508('0xa6')]===0x0){return this[_0x9508('0xa7')](_0x4f0416);}_0x4f0416['retry']-=0x1;if(!this['isConfigured'](_0x4f0416[_0x9508('0x10f')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4f0416,_0x9508('0x110'));}var _0x22861c=this['getSound'][_0x9508('0x6f')](this,_0x4f0416[_0x9508('0x10f')]);if(!_0x22861c){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4f0416,_0x9508('0x111'));}if(!this[_0x9508('0x87')](_0x4f0416['variable_id'])){return this[_0x9508('0xd')][_0x9508('0x33')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x12d9b1=this['channel'][_0x9508('0x112')](_0x22861c,_0x4f0416['response'],_0x4f0416[_0x9508('0x113')]);var _0x517c68=_0x12d9b1['result']?_0x12d9b1['result'][_0x9508('0x4a')]():'';logger[_0x9508('0x30')]('test',JSON[_0x9508('0x74')](_0x12d9b1));if(_0x12d9b1['result']===-0x1){this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f0416,_0x517c68);return _0x12d9b1;}else if(_0x12d9b1[_0x9508('0xa3')]==='timeout'){_0x12d9b1[_0x9508('0xab')]=_0x517c68['length']>=parseInt(_0x4f0416['mindigit'])?'x':'i';}else{_0x12d9b1[_0x9508('0xab')]=_0x517c68[_0x9508('0x9c')]>=parseInt(_0x4f0416[_0x9508('0x114')])&&_0x517c68[_0x9508('0x9c')]<=parseInt(_0x4f0416[_0x9508('0x113')])?'x':'i';}var _0x5871b9=this['getVariable'][_0x9508('0x6f')](this,_0x4f0416[_0x9508('0xd6')]);if(!_0x5871b9){return this['channel'][_0x9508('0x33')](_0x4f0416,_0x9508('0x115'));}this[_0x9508('0xd')]['setVariable'](_0x5871b9,_0x517c68);if(this[_0x9508('0x87')](_0x4f0416[_0x9508('0x116')])){var _0x4e9dc4=parseInt(_0x4f0416[_0x9508('0x116')],0xa);var _0x4059cb=rs[_0x9508('0x117')]({'charset':'*','length':_0x4e9dc4});var _0x30a70f=_0x517c68[_0x9508('0x9c')];if(_0x30a70f>0x0){if(_0x30a70f>_0x4e9dc4){this['createSquareDetailsReport']['sync'](this,_0x4f0416,_0x4f0416[_0x9508('0x118')]===_0x9508('0x119')?_0x4059cb+_0x517c68[_0x9508('0x11a')](_0x4e9dc4):_0x517c68[_0x9508('0x11a')](0x0,_0x30a70f-_0x4e9dc4)+_0x4059cb);}else{this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f0416,rs['generate']({'charset':'*','length':_0x30a70f}));}}else{this[_0x9508('0x36')]['sync'](this,_0x4f0416,'');}}else{this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f0416,_0x517c68);}return _0x12d9b1;};AGIVertices[_0x9508('0xf')][_0x9508('0x11b')]=function(_0x58cf1c){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x58cf1c['label']));return this[_0x9508('0xc')](_0x58cf1c);};AGIVertices[_0x9508('0xf')][_0x9508('0x11c')]=function(_0x48d589){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x11d'),_0x48d589[_0x9508('0xa9')]));this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x48d589,_0x48d589['goalname']);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('GOAL\x20%s',_0x48d589['goalname']));};AGIVertices[_0x9508('0xf')][_0x9508('0x11e')]=function(_0x211f7e){logger[_0x9508('0x30')](util[_0x9508('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x211f7e['label']));if(!this[_0x9508('0x87')](_0x211f7e[_0x9508('0x8a')])||!this[_0x9508('0x87')](_0x211f7e['aws_secret_access_key'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x11f'));}if(!this['isConfigured'](_0x211f7e[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this['channel'][_0x9508('0xac')](util['format'](_0x9508('0x120'),_0x211f7e[_0x9508('0x59')]));var _0xf7cad5=this[_0x9508('0x89')][_0x9508('0x6f')](this,_0x211f7e);if(_0xf7cad5){this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x121'),_0xf7cad5));var _0x1d3059=this[_0x9508('0xd')][_0x9508('0xff')](_0xf7cad5);try{fs['unlink'](_0xf7cad5+'.wav');}catch(_0x5db5e6){logger[_0x9508('0x33')](_0x5db5e6);}return _0x1d3059;}return this[_0x9508('0xd')][_0x9508('0x33')](_0x211f7e,_0x9508('0x122'));};AGIVertices['prototype'][_0x9508('0x123')]=function(_0x2a5e13){logger['info'](util[_0x9508('0x28')](_0x9508('0x124'),_0x2a5e13['label']));if(!this[_0x9508('0x87')](_0x2a5e13['aws_access_key_id'])||!this[_0x9508('0x87')](_0x2a5e13[_0x9508('0x8b')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x11f'));}if(!this['isConfigured'](_0x2a5e13[_0x9508('0x90')])){return this[_0x9508('0xd')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x9508('0x87')](_0x2a5e13[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20text\x20configured');}this[_0x9508('0xd')][_0x9508('0xf0')]=!![];this[_0x9508('0x36')](_0x2a5e13);this[_0x9508('0x40')](_0x2a5e13[_0x9508('0x59')],'in','','');this['channel']['noop'](util[_0x9508('0x28')](_0x9508('0x125'),_0x2a5e13['text']));var _0x46620f=this[_0x9508('0x8e')][_0x9508('0x6f')](this,_0x2a5e13);if(_0x46620f){for(var _0x4f5418 in _0x46620f){if(_0x46620f[_0x9508('0x97')](_0x4f5418)&&_[_0x9508('0x9d')](_0x46620f[_0x4f5418])){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('AWS_LEX_%s',_0x4f5418['toUpperCase']()),_0x46620f[_0x4f5418]);}}if(_['isNil'](_0x46620f[_0x9508('0x77')])){return this['channel'][_0x9508('0xac')](_0x9508('0x126'));}else{this[_0x9508('0x40')](_0x46620f[_0x9508('0x77')],_0x9508('0xf1'),_0x9508('0x127'),'');return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x128'),_0x46620f[_0x9508('0x77')]));}}return this[_0x9508('0xd')][_0x9508('0x33')](_0x2a5e13,_0x9508('0x129'));};AGIVertices['prototype'][_0x9508('0x12a')]=function(_0x3f3715){logger[_0x9508('0x30')](util['format'](_0x9508('0x12b'),_0x3f3715['label'],_0x3f3715[_0x9508('0x65')]));if(!this[_0x9508('0x87')](_0x3f3715[_0x9508('0x7a')])){return this['channel'][_0x9508('0xac')]('no\x20key\x20configured');}var _0x91599b=_0x9508('0x12c');var _0x3e9ecf=util[_0x9508('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x9508('0x117')](0x4));var _0x180387=util[_0x9508('0x28')]('%s.%s',_0x3e9ecf,_0x91599b);var _0x514933=!![];if(_0x3f3715[_0x9508('0x12d')]==='NOBEEP'){_0x514933=![];}var _0x3e1b3b=this[_0x9508('0xd')][_0x9508('0x12e')](_0x3e9ecf,_0x91599b,_0x3f3715[_0x9508('0x12f')],_0x3f3715[_0x9508('0x65')],undefined,_0x514933);if(_0x3e1b3b[_0x9508('0xab')]!==-0x1){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x130'),_0x180387));var _0x66a2ec=this[_0x9508('0x91')][_0x9508('0x6f')](this,_0x3f3715,_0x180387);if(_0x66a2ec){for(var _0x6c43be in _0x66a2ec){if(_0x66a2ec[_0x9508('0x97')](_0x6c43be)){this['channel'][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x131'),_0x6c43be[_0x9508('0xe6')]()),_0x66a2ec[_0x6c43be]);}}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x9508('0x74')](_0x66a2ec)));}}return _0x3e1b3b;};AGIVertices[_0x9508('0xf')][_0x9508('0x132')]=function(_0x124303){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x124303[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x124303['appid'])){return this[_0x9508('0xd')][_0x9508('0xac')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x124303[_0x9508('0x94')])){return this[_0x9508('0xd')]['noop'](_0x9508('0x133'));}var _0x220e1f='wav';var _0x946f0f=util[_0x9508('0x28')](_0x9508('0x134'),FILES_PATH,rs['generate'](0x4));var _0x4c620c=util[_0x9508('0x28')](_0x9508('0x9f'),_0x946f0f,_0x220e1f);var _0x60c722=!![];if(_0x124303[_0x9508('0x12d')]===_0x9508('0x135')){_0x60c722=![];}var _0x4a1f78=this[_0x9508('0xd')][_0x9508('0x12e')](_0x946f0f,_0x220e1f,_0x124303[_0x9508('0x12f')],_0x124303[_0x9508('0x65')],undefined,_0x60c722);if(_0x4a1f78[_0x9508('0xab')]!==-0x1){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x136'),_0x4c620c));var _0xa8ae21=this['tildeASR']['sync'](this,_0x124303,_0x4c620c);if(_0xa8ae21){for(var _0x541372 in _0xa8ae21){if(_0xa8ae21['hasOwnProperty'](_0x541372)){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x137'),_0x541372[_0x9508('0xe6')]()),_0xa8ae21[_0x541372]);}}return this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x138'),JSON['stringify'](_0xa8ae21)));}}return _0x4a1f78;};AGIVertices['prototype'][_0x9508('0x139')]=function(_0x36afbb){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x13a'),_0x36afbb['label']));return this[_0x9508('0xd')]['continueAt'](_0x36afbb['context'],_0x36afbb[_0x9508('0x3d')],_0x36afbb[_0x9508('0x3e')]);};AGIVertices['prototype'][_0x9508('0x13b')]=function(_0x18404e){logger[_0x9508('0x30')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x18404e[_0x9508('0xa9')]));if(!this['isConfigured'](_0x18404e[_0x9508('0x13c')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x18404e,_0x9508('0x13d'));}try{var _0x32acf7=eval(_0x18404e[_0x9508('0x13c')])?_0x9508('0x13e'):_0x9508('0x13f');this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x140'),_0x18404e['condition'],_0x32acf7));return{'code':0xc8,'result':_0x32acf7};}catch(_0x4bc03d){return{'code':0xc8,'result':_0x9508('0x13f')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x141')]=function(_0x4b9806){logger['info'](util[_0x9508('0x28')](_0x9508('0x142'),_0x4b9806[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x4b9806[_0x9508('0x143')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4b9806,_0x9508('0x144'));}var _0x5e14d2=this[_0x9508('0x145')][_0x9508('0x6f')](this,_0x4b9806['interval_id']);if(!_0x5e14d2){return this[_0x9508('0xd')][_0x9508('0x33')](_0x4b9806,'no\x20intervals\x20found');}for(var _0x786bdf=0x0;_0x786bdf<_0x5e14d2[_0x9508('0x9c')];_0x786bdf+=0x1){var _0x7db152=this[_0x9508('0xd')][_0x9508('0x10')](util[_0x9508('0x28')](_0x9508('0x146'),_0x5e14d2[_0x786bdf]));if(_0x7db152[_0x9508('0xab')]===-0x1){return _0x7db152;}logger[_0x9508('0x30')](util[_0x9508('0x28')]('IFTIME\x20%s\x20%s',_0x5e14d2[_0x786bdf],_0x7db152[_0x9508('0xa3')]));if(_0x7db152[_0x9508('0xa3')]===_0x9508('0x13e')){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x147'),_0x5e14d2[_0x786bdf],'true'));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x147'),_0x5e14d2[_0x786bdf],_0x9508('0x13e')));return{'code':0xc8,'result':_0x9508('0x13e')};}else{logger['info'](util['format'](_0x9508('0x147'),_0x5e14d2[_0x786bdf],_0x9508('0x13f')));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x147'),_0x5e14d2[_0x786bdf],_0x9508('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x9508('0x148')]=function(_0x455508){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x149'),_0x455508['label']));return this[_0x9508('0xd')]['hangup']();};AGIVertices['prototype'][_0x9508('0x14a')]=function(_0x1ca3e5){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x14b'),_0x1ca3e5[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x1ca3e5[_0x9508('0x7a')])){return this['channel'][_0x9508('0xac')]('no\x20key\x20configured');}var _0x15b8d0='wav';var _0x42e701=util[_0x9508('0x28')](_0x9508('0x134'),FILES_PATH,rs[_0x9508('0x117')](0x4));var _0x8cdc4a=util[_0x9508('0x28')]('%s.%s',_0x42e701,_0x15b8d0);var _0x21a922=!![];if(_0x1ca3e5[_0x9508('0x12d')]===_0x9508('0x135')){_0x21a922=![];}var _0x38d7ec=this[_0x9508('0xd')][_0x9508('0x12e')](_0x42e701,_0x15b8d0,_0x1ca3e5['intKey'],_0x1ca3e5[_0x9508('0x65')],undefined,_0x21a922);if(_0x38d7ec[_0x9508('0xab')]!==-0x1){this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x14c'),_0x8cdc4a));var _0x3770ca=this[_0x9508('0x85')][_0x9508('0x6f')](this,_0x1ca3e5,_0x8cdc4a);if(_0x3770ca){for(var _0x6584b9 in _0x3770ca){if(_0x3770ca[_0x9508('0x97')](_0x6584b9)){this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x14d'),_0x6584b9[_0x9508('0xe6')]()),_0x3770ca[_0x6584b9]);}}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x9508('0x74')](_0x3770ca)));}}return _0x38d7ec;};AGIVertices[_0x9508('0xf')][_0x9508('0x14e')]=function(_0x16bd55){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x14f'),_0x16bd55['label']));if(!this[_0x9508('0x87')](_0x16bd55[_0x9508('0x7a')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x150'));}if(!this[_0x9508('0x87')](_0x16bd55['text'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x16bd55[_0x9508('0x59')]));var _0x189dac=this['ispeechTTS'][_0x9508('0x6f')](this,_0x16bd55);if(_0x189dac){this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x14c'),_0x189dac));var _0x4ab60e=this['channel'][_0x9508('0xff')](_0x189dac,_0x16bd55[_0x9508('0x12f')]);try{fs[_0x9508('0x100')](_0x189dac+_0x9508('0x151'));}catch(_0x4698ea){logger[_0x9508('0x33')](_0x4698ea);}return _0x4ab60e;}return this[_0x9508('0xd')][_0x9508('0x33')](_0x16bd55,_0x9508('0x152'));};AGIVertices[_0x9508('0xf')][_0x9508('0x153')]=function(_0x3b9af2){logger[_0x9508('0x30')](util['format'](_0x9508('0x154'),_0x3b9af2[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x3b9af2[_0x9508('0x155')])){return this[_0x9508('0xd')]['error'](_0x3b9af2,_0x9508('0x156'));}logger[_0x9508('0x30')](util[_0x9508('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9508('0xd')]['callerid'],_0x3b9af2[_0x9508('0x155')]));var _0x546c68=this[_0x9508('0x52')]['sync'](this,_0x3b9af2['findBy']);if(_0x546c68){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')]['callerid'],_0x3b9af2['findBy']));this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')]['callerid'],_0x3b9af2['findBy']));return{'code':0xc8,'result':_0x9508('0x158')};}else{logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x159'),this['channel']['callerid'],_0x3b9af2[_0x9508('0x155')]));this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0x159'),this['channel'][_0x9508('0x3a')],_0x3b9af2['findBy']));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x15b')]=function(_0x1fa941){logger['info'](util[_0x9508('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1fa941[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x1fa941[_0x9508('0x155')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x1fa941,'no\x20find\x20by\x20configured');}logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x15c'),this[_0x9508('0xd')]['callerid'],_0x1fa941[_0x9508('0x155')]));var _0x5e6175=this[_0x9508('0x50')][_0x9508('0x6f')](this,_0x1fa941['findBy']);if(_0x5e6175){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x157'),this['channel']['callerid'],_0x1fa941['findBy']));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')]['callerid'],_0x1fa941[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x158')};}else{logger[_0x9508('0x30')](util['format'](_0x9508('0x159'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x1fa941[_0x9508('0x155')]));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x159'),this['channel'][_0x9508('0x3a')],_0x1fa941['findBy']));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices['prototype'][_0x9508('0x15d')]=function(_0x54250d){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x15e'),_0x54250d['label']));if(!this[_0x9508('0x87')](_0x54250d['operation'])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x54250d,_0x9508('0x15f'));}this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x160'),_0x54250d[_0x9508('0x161')]));var _0x3e7a4a=eval(_0x54250d['operation']);if(!this[_0x9508('0x87')](_0x54250d['variable_id'])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xd5'));}var _0x2db146=this['getVariable'][_0x9508('0x6f')](this,_0x54250d['variable_id']);if(!_0x2db146){return this[_0x9508('0xd')]['error'](_0x54250d,_0x9508('0x115'));}if(_[_0x9508('0x9b')](_0x3e7a4a)){var _0x36ae5a=this;_0x3e7a4a['forEach'](function(_0x3dc2bf,_0x1a24f8){_0x36ae5a['channel'][_0x9508('0xa0')](util[_0x9508('0x28')]('%s[%s]',_0x2db146,_0x1a24f8),_0x3dc2bf);});return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x162'),_0x2db146));}else{return this['channel']['setVariable'](_0x2db146,_0x3e7a4a);}};AGIVertices['prototype'][_0x9508('0xb')]=function(_0x3639a8){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x163'),_0x3639a8[_0x9508('0xa9')]));if(_0x3639a8[_0x9508('0xa6')]===0x0){return this['maxRetry'](_0x3639a8);}_0x3639a8[_0x9508('0xa6')]-=0x1;if(!this['isConfigured'](_0x3639a8['file_id'])){return this[_0x9508('0xd')]['error'](_0x3639a8,_0x9508('0x110'));}var _0x5925ed=this[_0x9508('0x164')]['sync'](this,_0x3639a8['file_id']);if(!_0x5925ed){return this[_0x9508('0xd')][_0x9508('0x33')](_0x3639a8,_0x9508('0x111'));}var _0x449173=this[_0x9508('0xd')][_0x9508('0x112')](_0x5925ed,_0x3639a8[_0x9508('0x165')],_0x3639a8[_0x9508('0x166')]);var _0x36b5db=_0x449173[_0x9508('0xab')];if(_0x449173[_0x9508('0xab')]===-0x1){this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x3639a8,'-1');return _0x449173;}else if(_0x449173[_0x9508('0xa3')]==='timeout'){_0x449173['result']=_0x449173[_0x9508('0xab')][_0x9508('0x9c')]>0x0?_0x449173[_0x9508('0xab')]:'t';}else if(_[_0x9508('0x42')](_0x449173[_0x9508('0xab')])){_0x449173[_0x9508('0xab')]='#';_0x36b5db='#';}if(!this[_0x9508('0x87')](_0x3639a8[_0x9508('0xd6')])){this['channel'][_0x9508('0xac')](_0x9508('0xd5'));}else{var _0xacb7bd=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x3639a8[_0x9508('0xd6')]);if(!_0xacb7bd){return this[_0x9508('0xd')][_0x9508('0x33')](_0x3639a8,_0x9508('0x115'));}this['channel'][_0x9508('0xa0')](_0xacb7bd,_0x36b5db);}this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x3639a8,_0x36b5db);return _0x449173;};AGIVertices['prototype'][_0x9508('0xac')]=function(_0x4487f6){logger[_0x9508('0x30')](util['format'](_0x9508('0x167'),_0x4487f6['label']));return this[_0x9508('0xd')][_0x9508('0xac')](_0x4487f6['output']||_0x4487f6[_0x9508('0xa9')]);};AGIVertices[_0x9508('0xf')]['pause']=function(_0x5580ea){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x168'),_0x5580ea[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x5580ea[_0x9508('0x155')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x5580ea,_0x9508('0x156'));}logger['info'](util['format'](_0x9508('0x15c'),this[_0x9508('0xd')]['callerid'],_0x5580ea['findBy']));var _0xebf2ed=this[_0x9508('0x4c')][_0x9508('0x6f')](this,_0x5580ea['pause_id']);var _0x3235c1=this[_0x9508('0x4f')]['sync'](this,_0x5580ea[_0x9508('0x155')],_0xebf2ed);if(_0x3235c1){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x5580ea[_0x9508('0x155')]));this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x5580ea[_0x9508('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x9508('0x159'),this[_0x9508('0xd')]['callerid'],_0x5580ea['findBy']));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x5580ea[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x169')]=function(_0x155f5e){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x16a'),_0x155f5e[_0x9508('0xa9')]));if(!this['isConfigured'](_0x155f5e[_0x9508('0x10f')])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x155f5e,_0x9508('0x110'));}var _0x4a8ef8=this[_0x9508('0x164')][_0x9508('0x6f')](this,_0x155f5e[_0x9508('0x10f')]);if(!_0x4a8ef8){return this[_0x9508('0xd')][_0x9508('0x33')](_0x155f5e,'no\x20file\x20audio\x20found');}var _0x1c7b32=this[_0x9508('0xd')][_0x9508('0x54')]('PLAYBACK',[_0x4a8ef8,_0x155f5e[_0x9508('0xe1')]]);if(_0x1c7b32[_0x9508('0xab')]===-0x1){return _0x1c7b32;}return this['channel'][_0x9508('0xac')](util['format']('Executed\x20command\x20%s\x20%s',_0x9508('0x16b'),_0x4a8ef8));};AGIVertices[_0x9508('0xf')][_0x9508('0x16c')]=function(_0x33c3ff){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x33c3ff[_0x9508('0xa9')]));if(!this['isConfigured'](_0x33c3ff['queue_id'])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x33c3ff,'no\x20queue\x20selected');}var _0x1a8c8e='';var _0x4b582f=parseInt(_0x33c3ff[_0x9508('0x16d')],0xa);if(isNaN(_0x4b582f)){_0x1a8c8e=_0x33c3ff[_0x9508('0x16d')];}else{_0x1a8c8e=this[_0x9508('0x15')][_0x9508('0x6f')](this,_0x33c3ff[_0x9508('0x16d')]);if(!_0x1a8c8e){return this['channel']['error'](_0x33c3ff,_0x9508('0x16e'));}}var _0x2351e0='';if(this[_0x9508('0x87')](_0x33c3ff[_0x9508('0x10f')])){var _0x402567=this[_0x9508('0x164')]['sync'](this,_0x33c3ff[_0x9508('0x10f')]);if(_0x402567){_0x2351e0=_0x402567;}}this[_0x9508('0x36')]['sync'](this,_0x33c3ff,_0x1a8c8e);if(_0x33c3ff[_0x9508('0xe1')][_0x9508('0x16f')]('x')<0x0){_0x33c3ff[_0x9508('0xe1')]+='x';}if(_0x33c3ff[_0x9508('0xe1')]['indexOf']('X')<0x0){_0x33c3ff[_0x9508('0xe1')]+='X';}this[_0x9508('0xd')]['setVariable'](_0x9508('0x170'),_0x1a8c8e?_0x1a8c8e[_0x9508('0x171')]():'');var _0x40b50c=this[_0x9508('0xd')][_0x9508('0x54')](_0x9508('0x172'),[_0x1a8c8e,_0x33c3ff[_0x9508('0xe1')],_0x33c3ff[_0x9508('0x63')],_0x2351e0,_0x33c3ff[_0x9508('0x65')],_0x33c3ff[_0x9508('0x7')],_0x33c3ff[_0x9508('0x173')],_0x33c3ff[_0x9508('0x174')],'',_0x33c3ff[_0x9508('0x175')]]);if(_0x40b50c['result']===-0x1){return _0x40b50c;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xc4'),_0x9508('0x172'),_0x1a8c8e));};AGIVertices[_0x9508('0xf')][_0x9508('0x176')]=function(_0x59afdf){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x177'),_0x59afdf['label']));var _0x38c7ff=_0x59afdf['recordingFormat']||_0x9508('0x12c');var _0x230200=util[_0x9508('0x28')](_0x9508('0x178'),this[_0x9508('0xd')][_0x9508('0x37')],rs[_0x9508('0x117')](0x5));var _0x2ea77c=util[_0x9508('0x28')](_0x9508('0x179'),FILES_PATH,_0x230200,_0x38c7ff);var _0x7ef314=util['format'](_0x9508('0x134'),FILES_PATH,_0x230200);this['createSquareRecording']['sync'](this,_0x59afdf,_0x230200,_0x2ea77c);this['channel'][_0x9508('0xa0')](_0x9508('0x17a'),_0x230200);logger['info'](_0x9508('0x17b'),_0x7ef314,_0x38c7ff,_0x59afdf[_0x9508('0x17c')],_0x59afdf[_0x9508('0x65')]);return this['channel'][_0x9508('0x12e')](_0x7ef314,_0x38c7ff,_0x59afdf[_0x9508('0x17c')],_0x59afdf[_0x9508('0x65')],undefined,!![]);};AGIVertices['prototype'][_0x9508('0x17d')]=function(_0x354fb3){logger[_0x9508('0x30')](util[_0x9508('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x354fb3[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x354fb3[_0x9508('0x63')])){return this['channel'][_0x9508('0xac')](_0x9508('0x17e'));}var _0x39deef=this[_0x9508('0x62')][_0x9508('0x6f')](this,_0x354fb3);logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x17f'),util['inspect'](_0x39deef,{'showHidden':![],'depth':null})));if(!this[_0x9508('0x87')](_0x354fb3[_0x9508('0xd6')])){return this[_0x9508('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x500406=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x354fb3[_0x9508('0xd6')]);if(!_0x500406){return this[_0x9508('0xd')][_0x9508('0x33')](_0x354fb3,_0x9508('0x115'));}this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')](_0x9508('0x180'),_0x500406),_0x39deef[_0x9508('0x75')]?_0x39deef[_0x9508('0x75')]:_0x9508('0x181'));this[_0x9508('0xd')][_0x9508('0xa0')](util[_0x9508('0x28')]('%s_STATUS_MESSAGE',_0x500406),_0x39deef[_0x9508('0x76')]?_0x39deef['statusMessage']:'OK');if(_0x39deef[_0x9508('0x6a')]){try{this['saveRestApiResult'](_0x39deef[_0x9508('0x6a')],_0x500406);}catch(_0x1da6be){logger[_0x9508('0x33')](util['format'](_0x9508('0x182'),_0x500406));}}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0xdb'),_0x500406));};AGIVertices[_0x9508('0xf')][_0x9508('0x183')]=function(_0x2c2f09){logger[_0x9508('0x30')](util['format'](_0x9508('0x184'),_0x2c2f09[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0x185')](_0x2c2f09[_0x9508('0x186')][_0x9508('0x55')](/\s+/g,''),_0x2c2f09[_0x9508('0x17c')]);};AGIVertices[_0x9508('0xf')][_0x9508('0x187')]=function(_0x3efeeb){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x188'),_0x3efeeb[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0x189')](_0x3efeeb['number'][_0x9508('0x55')](/\s+/g,''),_0x3efeeb[_0x9508('0x17c')]);};AGIVertices[_0x9508('0xf')][_0x9508('0x18a')]=function(_0x3d6c3e){logger[_0x9508('0x30')](util['format'](_0x9508('0x18b'),_0x3d6c3e[_0x9508('0xa9')]));return this[_0x9508('0xd')][_0x9508('0x18c')](_0x3d6c3e[_0x9508('0x59')],_0x3d6c3e['escape_digits']);};AGIVertices[_0x9508('0xf')][_0x9508('0x18d')]=function(_0x2e0a23){logger['info'](util[_0x9508('0x28')](_0x9508('0x18e'),_0x2e0a23['label']));if(!this[_0x9508('0x87')](_0x2e0a23[_0x9508('0x18f')])){return this['channel'][_0x9508('0xac')]('no\x20mail\x20account\x20configured');}var _0x35d344=this[_0x9508('0x20')][_0x9508('0x6f')](this,_0x2e0a23['account_id']);if(!_0x35d344||!_0x35d344[_0x9508('0x190')]){return this['channel'][_0x9508('0x33')](_0x2e0a23,_0x9508('0x191'));}var _0x325e75={'from':util[_0x9508('0x28')](_0x9508('0x192'),_0x35d344['name'],_0x35d344[_0x9508('0x193')]||_0x35d344[_0x9508('0x190')][_0x9508('0x194')]),'to':_0x2e0a23['to']||'','cc':_0x2e0a23['cc']||'','bcc':_0x2e0a23['bcc']||'','subject':_0x2e0a23[_0x9508('0x195')],'html':_0x2e0a23[_0x9508('0x59')],'text':_0x2e0a23[_0x9508('0x59')]};if(this[_0x9508('0x87')](_0x2e0a23['template_id'])){}logger['debug'](_0x9508('0x196'),JSON[_0x9508('0x74')](_0x325e75));this['createSquareDetailsReport']['sync'](this,_0x2e0a23,_0x2e0a23[_0x9508('0x18f')]);this['channel'][_0x9508('0xac')](util[_0x9508('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x35d344['name']));this[_0x9508('0x22')]['sync'](this,_0x35d344[_0x9508('0x197')],_0x325e75);return this['channel'][_0x9508('0xac')](_0x9508('0x198'));};AGIVertices[_0x9508('0xf')][_0x9508('0x199')]=function(_0x511b55){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x19a'),_0x511b55['label']));return this[_0x9508('0xd')]['noop'](_0x9508('0x19b'));};AGIVertices[_0x9508('0xf')][_0x9508('0x19c')]=function(_0x49e69f){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x19d'),_0x49e69f[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x49e69f[_0x9508('0x19e')])){return this['channel'][_0x9508('0xac')](_0x9508('0x19f'));}var _0x2d6b6d=this[_0x9508('0x34')][_0x9508('0x6f')](this,_0x49e69f[_0x9508('0x19e')]);if(!_0x2d6b6d){return this[_0x9508('0xd')][_0x9508('0x33')](_0x49e69f,_0x9508('0x1a0'));}var _0x4aa0a7={'body':_0x49e69f[_0x9508('0x1a1')],'phone':_0x49e69f['to']||'','SmsAccountId':_0x2d6b6d['id']};logger['debug'](_0x9508('0x1a2'),JSON['stringify'](_0x4aa0a7));this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x49e69f,_0x49e69f[_0x9508('0x19e')]);this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1a3'),_0x2d6b6d[_0x9508('0x13')]));this[_0x9508('0x35')][_0x9508('0x6f')](this,_0x4aa0a7);return this[_0x9508('0xd')][_0x9508('0xac')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x9508('0x1a4')]=function(_0x5a45fd){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1a5'),_0x5a45fd[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x5a45fd[_0x9508('0xd6')])){return this['channel'][_0x9508('0x33')](_0x5a45fd,'no\x20variable\x20selected');}var _0x45d9fc=this[_0x9508('0x10')][_0x9508('0x6f')](this,_0x5a45fd[_0x9508('0xd6')]);if(!_0x45d9fc){return this[_0x9508('0xd')][_0x9508('0x33')](_0x5a45fd,'no\x20variable\x20found');}return this[_0x9508('0xd')][_0x9508('0xa0')](_0x45d9fc,_0x5a45fd[_0x9508('0x1a6')]);};AGIVertices[_0x9508('0xf')][_0x9508('0x1a7')]=function(_0x557984){logger[_0x9508('0x30')](util['format'](_0x9508('0x1a8'),_0x557984[_0x9508('0xa9')]));this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x1a9'));var _0x5ec6ff=this[_0x9508('0xd')][_0x9508('0x10')](_0x9508('0x1aa'));if(!_['isEmpty'](_0x5ec6ff['extra'])){this[_0x9508('0xd')][_0x9508('0x37')]=_0x5ec6ff[_0x9508('0xa3')];}if(_0x557984[_0x9508('0xbb')]===_0x9508('0x1ab')){this['channel'][_0x9508('0xac')](_0x9508('0x1ac'));return this[_0x9508('0xd')][_0x9508('0xbb')]();}return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x1ad'));};AGIVertices[_0x9508('0xf')][_0x9508('0x1ae')]=function(_0x378ba7){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1af'),_0x378ba7[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x378ba7['project_id'])){return this[_0x9508('0xd')][_0x9508('0x33')](_0x378ba7,'no\x20subproject\x20selected');}var _0x4c372d=this[_0x9508('0x17')]['sync'](this,_0x378ba7[_0x9508('0x1b0')]);if(!this[_0x9508('0x87')](_0x4c372d)){return this[_0x9508('0xd')]['error'](_0x378ba7,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x378ba7[_0x9508('0x1b0')]));}if(_0x4c372d===this[_0x9508('0xd')][_0x9508('0x39')]){return this[_0x9508('0xd')][_0x9508('0x33')](_0x378ba7,_0x9508('0x1b1'));}this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x378ba7,_0x4c372d);var _0x2924b8=this['channel']['exec']('AGI',util[_0x9508('0x28')](_0x9508('0x1b2'),config[_0x9508('0x7')][_0x9508('0x1b3')]||_0x9508('0x1b4'),_0x4c372d,this[_0x9508('0xd')][_0x9508('0x39')]));if(_0x2924b8['result']===-0x1){return _0x2924b8;}return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x4c372d));};AGIVertices[_0x9508('0xf')][_0x9508('0x1b5')]=function(_0x4f8b44){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4f8b44[_0x9508('0xa9')]));var _0x27f03c=this[_0x9508('0x53')][_0x9508('0x6f')](this,_0x4f8b44['command']);this[_0x9508('0x36')][_0x9508('0x6f')](this,_0x4f8b44,_0x4f8b44[_0x9508('0xba')]);if(this['isConfigured'](_0x4f8b44['variable_id'])){var _0x8d34e=this[_0x9508('0x10')]['sync'](this,_0x4f8b44[_0x9508('0xd6')]);if(_0x8d34e){this[_0x9508('0xd')]['setVariable'](_0x8d34e,_0x27f03c);return this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4f8b44['command'],_0x8d34e));}}return this[_0x9508('0xd')][_0x9508('0xac')](util['format'](_0x9508('0x1b6'),_0x4f8b44[_0x9508('0xba')]));};AGIVertices[_0x9508('0xf')][_0x9508('0x1b7')]=function(_0x420550){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1b8'),_0x420550[_0x9508('0xa9')]));_0x420550[_0x9508('0x59')]=_0x420550['text'][_0x9508('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x420550[_0x9508('0x57')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0x1b9'));}if(!this[_0x9508('0x87')](_0x420550[_0x9508('0x59')])){return this['channel'][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1ba'),_0x420550['text']));var _0x250d2e=this[_0x9508('0x56')][_0x9508('0x6f')](this,_0x420550);if(_0x250d2e){this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1bb'),_0x250d2e));var _0xf486a1=this['channel']['streamFile'](_0x250d2e);try{fs[_0x9508('0x100')](_0x250d2e+_0x9508('0x151'));}catch(_0x181408){logger['error'](_0x181408);}return _0xf486a1;}return this[_0x9508('0xd')]['error'](_0x420550,_0x9508('0x1bc'));};AGIVertices[_0x9508('0xf')][_0x9508('0x1bd')]=function(_0x1c6a40){logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x1be'),_0x1c6a40[_0x9508('0xa9')]));_0x1c6a40['text']=_0x1c6a40[_0x9508('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9508('0x87')](_0x1c6a40[_0x9508('0x59')])){return this[_0x9508('0xd')][_0x9508('0xac')](_0x9508('0xaa'));}this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x1c6a40[_0x9508('0x59')]));var _0x357dab=this[_0x9508('0x60')][_0x9508('0x6f')](this,_0x1c6a40);if(_0x357dab){this['channel'][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x1bf'),_0x357dab));var _0x3d43b8=this['channel']['streamFile'](_0x357dab);try{fs[_0x9508('0x100')](_0x357dab+_0x9508('0x151'));}catch(_0x22fba6){logger['error'](_0x22fba6);}return _0x3d43b8;}return this['channel'][_0x9508('0x33')](_0x1c6a40,_0x9508('0x1c0'));};AGIVertices[_0x9508('0xf')][_0x9508('0x1c1')]=function(_0x2c9dc6){logger['info'](util[_0x9508('0x28')](_0x9508('0x1c2'),_0x2c9dc6[_0x9508('0xa9')]));if(!this[_0x9508('0x87')](_0x2c9dc6[_0x9508('0x155')])){return this[_0x9508('0xd')]['error'](_0x2c9dc6,_0x9508('0x156'));}logger[_0x9508('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));var _0xc8432f=this[_0x9508('0x1c3')]['sync'](this,_0x2c9dc6[_0x9508('0x155')]);if(_0xc8432f){logger['info'](util[_0x9508('0x28')](_0x9508('0x157'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));this[_0x9508('0xd')][_0x9508('0xac')](util[_0x9508('0x28')](_0x9508('0x157'),this['channel']['callerid'],_0x2c9dc6[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x158')};}else{logger[_0x9508('0x30')](util[_0x9508('0x28')](_0x9508('0x159'),this['channel'][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0x159'),this[_0x9508('0xd')][_0x9508('0x3a')],_0x2c9dc6[_0x9508('0x155')]));return{'code':0xc8,'result':_0x9508('0x15a')};}};AGIVertices[_0x9508('0xf')][_0x9508('0x1c4')]=function(_0x141dc0){logger[_0x9508('0x30')](util['format'](_0x9508('0x1c5'),_0x141dc0[_0x9508('0xa9')]));var _0x3436fd=this[_0x9508('0xd')][_0x9508('0x54')](_0x9508('0x1c6'),[_0x141dc0[_0x9508('0x1c7')],_0x141dc0['options']]);if(_0x3436fd[_0x9508('0xab')]===-0x1){return _0x3436fd;}return this[_0x9508('0xd')]['noop'](util[_0x9508('0x28')](_0x9508('0xc4'),_0x9508('0x1c6'),_0x141dc0[_0x9508('0x1c7')]));};AGIVertices['prototype']['vswitch']=function(_0x887c22){logger['info'](util[_0x9508('0x28')](_0x9508('0x1c8'),_0x887c22[_0x9508('0xa9')]));if(!this['isConfigured'](_0x887c22['variable_id'])){return this['channel'][_0x9508('0x33')](_0x887c22,_0x9508('0x1c9'));}var _0x1b246b=this['getVariable']['sync'](this,_0x887c22['variable_id']);if(!_0x1b246b){return this['channel']['error'](_0x887c22,_0x9508('0x115'));}var _0x5daf6a=this[_0x9508('0xd')][_0x9508('0x10')](_0x1b246b);return{'code':0xc8,'result':_0x5daf6a[_0x9508('0xa3')]?_0x5daf6a[_0x9508('0xa3')]:'-'};};String[_0x9508('0xf')][_0x9508('0xa2')]=function(_0x3d08e2,_0x2d73d0){return this[_0x9508('0xa1')](_0x3d08e2)[_0x9508('0x1ca')](_0x2d73d0);};module['exports']=AGIVertices; \ No newline at end of file +var _0xb07f=['no\x20list\x20selected','delay','add','minutes','sync','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','appsecret','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','unlink','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','AGENT\x20%s\x20NOT\x20FOUND\x20BY','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','body','statusCode','statusMessage','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','getVariable','getAndSetVariable','result','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block'];(function(_0x423c1b,_0xd06dbf){var _0x427080=function(_0x3a28e6){while(--_0x3a28e6){_0x423c1b['push'](_0x423c1b['shift']());}};_0x427080(++_0xd06dbf);}(_0xb07f,0x109));var _0xfb07=function(_0x26018c,_0x3c0903){_0x26018c=_0x26018c-0x0;var _0x1efc45=_0xb07f[_0x26018c];return _0x1efc45;};'use strict';var fs=require('fs');var util=require(_0xfb07('0x0'));var _=require(_0xfb07('0x1'));var sh=require(_0xfb07('0x2'));var odbc=require(_0xfb07('0x3'))();var rs=require(_0xfb07('0x4'));var moment=require(_0xfb07('0x5'));var Mustache=require(_0xfb07('0x6'));var rp=require(_0xfb07('0x7'));var logger=require(_0xfb07('0x8'))(_0xfb07('0x9'));var config=require(_0xfb07('0xa'));var scripts=require('./scripts');var FILES_PATH=_0xfb07('0xb');var recursiveMapAttributes=[_0xfb07('0xc'),_0xfb07('0xd')];var verticesWithRetry=[_0xfb07('0xe'),_0xfb07('0xf'),_0xfb07('0x10')];var AGIVertices=function(_0x2b5000,_0x42aaea,_0x22d0f8){this[_0xfb07('0x11')]=_0x2b5000;this[_0xfb07('0x12')]=_0x42aaea;this[_0xfb07('0x13')]=_0x22d0f8;};AGIVertices['prototype']['getVariable']=function(_0x575c96,_0x3d91db){this[_0xfb07('0x12')]['getVariableById'](_0x575c96)[_0xfb07('0x14')](function(_0x18f5f4){_0x3d91db(null,_0x18f5f4?_0x18f5f4[_0xfb07('0x15')]:![]);})[_0xfb07('0x16')](function(_0x2ad2cf){_0x3d91db(_0x2ad2cf);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x18')]=function(_0x528550,_0x5780f8){this[_0xfb07('0x12')][_0xfb07('0x19')](_0x528550)[_0xfb07('0x14')](function(_0x2423f2){_0x5780f8(null,_0x2423f2?_0x2423f2[_0xfb07('0x15')]:![]);})[_0xfb07('0x16')](function(_0x228e2a){_0x5780f8(_0x228e2a);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x1a')]=function(_0x3dde76,_0x1cfc43){this[_0xfb07('0x12')][_0xfb07('0x1b')](_0x3dde76)['then'](function(_0x57fc39){_0x1cfc43(null,_0x57fc39?_0x57fc39[_0xfb07('0x15')]:![]);})[_0xfb07('0x16')](function(_0x197f12){_0x1cfc43(_0x197f12);});};AGIVertices['prototype'][_0xfb07('0x1c')]=function(_0x3a88d9,_0x527c4e){this['rpc'][_0xfb07('0x1d')](_0x3a88d9)[_0xfb07('0x14')](function(_0x2d2d33){_0x527c4e(null,_0x2d2d33?_0x2d2d33[_0xfb07('0x1e')]:![]);})[_0xfb07('0x16')](function(_0x323bec){_0x527c4e(_0x323bec);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x1f')]=function(_0x19ad99,_0x578bb2){this[_0xfb07('0x12')]['getUserById'](_0x19ad99)[_0xfb07('0x14')](function(_0x14c771){_0x578bb2(null,_0x14c771?_0x14c771[_0xfb07('0x15')]:![]);})[_0xfb07('0x16')](function(_0xb2063a){_0x578bb2(_0xb2063a);});};AGIVertices['prototype'][_0xfb07('0x20')]=function(_0x451cd8,_0x10835a){this[_0xfb07('0x12')][_0xfb07('0x21')](_0x451cd8)[_0xfb07('0x14')](function(_0x531346){_0x10835a(null,_0x531346?_0x531346[_0xfb07('0x15')]:![]);})[_0xfb07('0x16')](function(_0x581508){_0x10835a(_0x581508);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x22')]=function(_0xe813a7,_0x149ac0){var _0x46927a=this;this[_0xfb07('0x12')][_0xfb07('0x23')](_0xe813a7)[_0xfb07('0x14')](function(_0x95f1d){_0x149ac0(null,_0x95f1d?_0x46927a[_0xfb07('0x24')](_0x95f1d[_0xfb07('0x25')]):![]);})['catch'](function(_0x217932){_0x149ac0(_0x217932);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x26')]=function(_0x11569f,_0x5dd4c9){this[_0xfb07('0x12')][_0xfb07('0x27')](_0x11569f)['then'](function(_0x36da2a){_0x5dd4c9(null,_0x36da2a?_0x36da2a:![]);})['catch'](function(_0x328d2e){_0x5dd4c9(_0x328d2e);});};AGIVertices['prototype'][_0xfb07('0x28')]=function(_0x4a8d4c,_0xf33bd0,_0x3a6e9a){this[_0xfb07('0x13')][_0xfb07('0x28')](_0x4a8d4c,_0xf33bd0)[_0xfb07('0x14')](function(){_0x3a6e9a(null);})[_0xfb07('0x16')](function(_0x586c15){_0x3a6e9a(_0x586c15);});};AGIVertices['prototype'][_0xfb07('0x29')]=function(_0x1cccdd,_0x394e67){this[_0xfb07('0x12')]['getIntervalById'](_0x1cccdd)['then'](function(_0x22ef8c){if(_0x22ef8c){if(_0x22ef8c[_0xfb07('0x2a')]){_0x394e67(null,[_0x22ef8c[_0xfb07('0x2b')]]);}else{_0x394e67(null,_[_0xfb07('0x2c')](_0x22ef8c[_0xfb07('0x2d')],_0xfb07('0x2b')));}}else{_0x394e67(null,![]);}})['catch'](function(_0x4b285d){_0x394e67(_0x4b285d);});};AGIVertices['prototype'][_0xfb07('0x24')]=function(_0x3daa5a){return util[_0xfb07('0x2e')](_0xfb07('0x2f'),FILES_PATH,_0x3daa5a);};AGIVertices['prototype']['getQueryOdbc']=function(_0x9b59fc,_0x1d0132,_0x59c27d){odbc['open'](_0x9b59fc,function(_0x5e9933){if(_0x5e9933){logger[_0xfb07('0x30')](_0xfb07('0x31'),_0x5e9933);_0x59c27d(_0x5e9933);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xfb07('0x32')](_0x1d0132,function(_0xfe26cc,_0x18c41f){if(_0xfe26cc){logger[_0xfb07('0x33')](_0xfb07('0x34'),_0x1d0132);_0x59c27d(_0xfe26cc);}else{logger['info'](_0xfb07('0x35'),_0x1d0132);odbc[_0xfb07('0x36')](function(_0xac769b){if(_0xac769b){logger[_0xfb07('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xac769b);}_0x59c27d(null,_0x18c41f);});}});}});};AGIVertices['prototype'][_0xfb07('0x37')]=function(_0x7a274c,_0x1d55bd){this[_0xfb07('0x12')][_0xfb07('0x38')](_0x7a274c)[_0xfb07('0x14')](function(_0x244aed){_0x1d55bd(null,_0x244aed?_0x244aed:![]);})['catch'](function(_0x5c59d1){_0x1d55bd(_0x5c59d1);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x39')]=function(_0x4e5127,_0x5df46c){this[_0xfb07('0x12')][_0xfb07('0x39')](_0x4e5127)[_0xfb07('0x14')](function(_0x48c179){_0x5df46c(null,_0x48c179);})['catch'](function(_0x14fcc2){_0x5df46c(_0x14fcc2);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x3a')]=function(_0x123e3d,_0xb87b68,_0x3e8a51){this[_0xfb07('0x12')][_0xfb07('0x3a')]({'uniqueid':this[_0xfb07('0x11')]['uniqueid'],'node':_0x123e3d[_0xfb07('0x3b')],'application':_0x123e3d[_0xfb07('0x3c')],'data':_0xb87b68||null,'project_name':this[_0xfb07('0x11')][_0xfb07('0x3d')],'callerid':this[_0xfb07('0x11')][_0xfb07('0x3e')]})[_0xfb07('0x14')](function(_0x34c4bf){if(_0x3e8a51){_0x3e8a51(null,_0x34c4bf);}})[_0xfb07('0x16')](function(_0x26e1c3){if(_0x3e8a51){_0x3e8a51(_0x26e1c3);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x256967,_0x2d1d4d,_0x4b7404,_0x3f56c6){this[_0xfb07('0x12')][_0xfb07('0x3f')]({'uniqueid':this[_0xfb07('0x11')][_0xfb07('0x40')],'callerid':this['channel']['callerid'],'calleridname':this[_0xfb07('0x11')][_0xfb07('0x41')],'context':this[_0xfb07('0x11')][_0xfb07('0x42')],'extension':this[_0xfb07('0x11')][_0xfb07('0x43')],'priority':this[_0xfb07('0x11')][_0xfb07('0x44')],'accountcode':this[_0xfb07('0x11')][_0xfb07('0x45')],'dnid':this['channel']['dnid'],'projectName':this['channel'][_0xfb07('0x3d')],'saveName':_0x2d1d4d,'filename':_0x256967['file']||_0x2d1d4d,'savePath':_0x4b7404})[_0xfb07('0x14')](function(_0x31cca8){_0x3f56c6(null,_0x31cca8);})[_0xfb07('0x16')](function(_0x11ec85){_0x3f56c6(_0x11ec85);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x46')]=function(_0x4d464e,_0x3b2cce,_0x9f553c,_0x2d4a4d,_0x2231d3){this[_0xfb07('0x12')]['createSquareMessage']({'uniqueid':this[_0xfb07('0x11')][_0xfb07('0x40')],'body':_0x4d464e,'direction':_0x3b2cce,'providerName':_0x9f553c,'providerResponse':_0x2d4a4d})[_0xfb07('0x14')](function(_0x443b3d){if(_0x2231d3){_0x2231d3(null,_0x443b3d);}})[_0xfb07('0x16')](function(_0x5179c2){if(_0x2231d3){_0x2231d3(_0x5179c2);}});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x47')]=function(_0x38b30e,_0x3b84a0){this[_0xfb07('0x12')]['createCmContact']({'firstName':_[_0xfb07('0x48')](_0x38b30e[_0xfb07('0x15')])||_[_0xfb07('0x49')](_0x38b30e[_0xfb07('0x15')])?'callback_'+Math[_0xfb07('0x4a')]():_0x38b30e[_0xfb07('0x15')],'lastName':_[_0xfb07('0x48')](_0x38b30e[_0xfb07('0x4b')])||_[_0xfb07('0x49')](_0x38b30e[_0xfb07('0x4b')])?null:_0x38b30e[_0xfb07('0x4b')],'phone':_0x38b30e[_0xfb07('0x4c')],'ListId':_0x38b30e[_0xfb07('0x4d')],'scheduledat':_0x38b30e[_0xfb07('0x4e')],'callbackUniqueid':this['channel'][_0xfb07('0x40')],'tags':'callback','description':_0xfb07('0x4f')+_0x38b30e[_0xfb07('0x4e')][_0xfb07('0x50')](),'priority':_0x38b30e[_0xfb07('0x51')]})[_0xfb07('0x14')](function(_0x7746bb){_0x3b84a0(null,_0x7746bb);})[_0xfb07('0x16')](function(_0x4cc860){_0x3b84a0(_0x4cc860);});};AGIVertices['prototype']['getPause']=function(_0x395d99,_0x19db07){this[_0xfb07('0x12')]['getPauseById'](_0x395d99)[_0xfb07('0x14')](function(_0x4ef1a4){_0x19db07(null,_0x4ef1a4?_0x4ef1a4[_0xfb07('0x15')]:![]);})[_0xfb07('0x16')](function(_0x4be871){_0x19db07(_0x4be871);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x52')]=function(_0x18d0de,_0xc122ae,_0x294dc8){var _0x474711={'role':_0xfb07('0x53')};_0x474711[_0x18d0de]=this[_0xfb07('0x11')][_0xfb07('0x3e')];this[_0xfb07('0x12')][_0xfb07('0x52')](_0x474711,_0xc122ae,this[_0xfb07('0x11')][_0xfb07('0x40')])[_0xfb07('0x14')](function(_0x5387ce){_0x294dc8(null,_[_0xfb07('0x49')](_0x5387ce)?![]:!![]);})[_0xfb07('0x16')](function(_0x56fb6c){logger['error'](_0x56fb6c);_0x294dc8(null,![]);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x54')]=function(_0x168d64,_0x491925){var _0x440887={'role':'agent'};_0x440887[_0x168d64]=this['channel']['callerid'];this['rpc'][_0xfb07('0x54')](_0x440887)[_0xfb07('0x14')](function(_0x22863b){_0x491925(null,_[_0xfb07('0x49')](_0x22863b)?![]:!![]);})[_0xfb07('0x16')](function(_0x11ceba){logger[_0xfb07('0x30')](_0x11ceba);_0x491925(null,![]);});};AGIVertices['prototype'][_0xfb07('0x55')]=function(_0x45a88f,_0x280903){var _0x37267d={'role':_0xfb07('0x53')};_0x37267d[_0x45a88f]=this[_0xfb07('0x11')][_0xfb07('0x3e')];this[_0xfb07('0x12')]['agentLogout'](_0x37267d)[_0xfb07('0x14')](function(_0x3eea5f){_0x280903(null,_[_0xfb07('0x49')](_0x3eea5f)?![]:!![]);})[_0xfb07('0x16')](function(_0x2678d2){logger['error'](_0x2678d2);_0x280903(null,![]);});};AGIVertices['prototype'][_0xfb07('0x56')]=function(_0x231247,_0x5ddd00){var _0x18ccd6={'role':_0xfb07('0x53')};_0x18ccd6[_0x231247]=this[_0xfb07('0x11')][_0xfb07('0x3e')];var _0x127392=_0x231247!=_0xfb07('0x57')?util[_0xfb07('0x2e')]('%s/%s@from-sip/n','LOCAL',this[_0xfb07('0x11')]['callerid']):undefined;this[_0xfb07('0x12')][_0xfb07('0x56')](_0x18ccd6,_0x127392)[_0xfb07('0x14')](function(_0x393a61){_0x5ddd00(null,_[_0xfb07('0x49')](_0x393a61)?![]:!![]);})[_0xfb07('0x16')](function(_0x40892d){logger[_0xfb07('0x30')](_0x40892d);_0x5ddd00(null,![]);});};AGIVertices[_0xfb07('0x17')]['shellCommand']=function(_0x1827d0,_0x3e013c){sh[_0xfb07('0x58')](_[_0xfb07('0x59')](_0x1827d0),function(_0x3d1b8c,_0x5e0399){var _0x1e63aa=_0x5e0399[_0xfb07('0x5a')](/(\r\n|\n|\r)/gm,'');_0x3e013c(null,_0x1e63aa);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x5b')]=function(_0x572afa,_0xc64fd3){scripts['googleCloudTTS'](_0x572afa['apiKey'],_0x572afa[_0xfb07('0x5c')]||_0xfb07('0x5d'),_0x572afa[_0xfb07('0x5d')],_0x572afa[_0xfb07('0x5e')]||_0xfb07('0x5f'),_0x572afa[_0xfb07('0x60')]||'MALE',_0x572afa[_0xfb07('0x61')]||_0xfb07('0x62'))[_0xfb07('0x14')](function(_0x47742d){_0xc64fd3(null,_0x47742d);})[_0xfb07('0x16')](function(_0x1533d7){_0xc64fd3(_0x1533d7);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x63')]=function(_0x31f85e,_0x354c53){scripts[_0xfb07('0x63')](_0x31f85e[_0xfb07('0x5d')],_0x31f85e[_0xfb07('0x64')]||'en',0x1)[_0xfb07('0x14')](function(_0x194193){_0x354c53(null,_0x194193);})[_0xfb07('0x16')](function(_0x5e2e34){_0x354c53(_0x5e2e34);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x65')]=function(_0x3d5466,_0x2a3dd1){var _0x3a45af={'uri':_0x3d5466[_0xfb07('0x66')],'method':_0x3d5466[_0xfb07('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3d5466[_0xfb07('0x68')])===_0xfb07('0x69')&&parseInt(_0x3d5466[_0xfb07('0x68')])>=0x1?parseInt(_0x3d5466[_0xfb07('0x68')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xfb07('0x6a')],_0x3a45af[_0xfb07('0x67')][_0xfb07('0x6b')]())){try{_0x3a45af['body']=_0x3d5466[_0xfb07('0xd')]?JSON[_0xfb07('0x6c')](_0x3d5466[_0xfb07('0xd')]):{};}catch(_0x4c661f){logger[_0xfb07('0x30')](_0xfb07('0x6d'),_0x4c661f);}}try{_0x3a45af[_0xfb07('0x6e')]=_0x3d5466[_0xfb07('0xc')]?JSON['parse'](_0x3d5466[_0xfb07('0xc')]):{};}catch(_0x317146){logger[_0xfb07('0x30')](_0xfb07('0x6f'),_0x317146);}if(_0x3d5466['computedVariables']){try{var _0x3f0842=require(_0x3d5466[_0xfb07('0x70')])['sync'](this,_0x3a45af);_0x3a45af['uri']=Mustache[_0xfb07('0x71')](_0x3d5466[_0xfb07('0x66')],_0x3f0842,{},['$$','$$']);if(_0x3a45af['headers']){_0x3a45af['headers']=JSON[_0xfb07('0x6c')](Mustache[_0xfb07('0x71')](JSON[_0xfb07('0x72')](_0x3a45af['headers']),_0x3f0842,{},['$$','$$']));}if(_0x3a45af[_0xfb07('0x73')]){_0x3a45af['body']=JSON[_0xfb07('0x6c')](Mustache[_0xfb07('0x71')](JSON[_0xfb07('0x72')](_0x3a45af[_0xfb07('0x73')]),_0x3f0842,{},['$$','$$']));}}catch(_0x3d4bc7){logger[_0xfb07('0x30')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d4bc7);}}rp(_0x3a45af)['then'](function(_0x27e5d4){var _0x3c7319={'statusCode':_0x27e5d4[_0xfb07('0x74')]||0xc8,'statusMessage':_0x27e5d4[_0xfb07('0x75')]||'OK','headers':_0x27e5d4['headers']||{},'body':_0x27e5d4[_0xfb07('0x73')]||{}};_0x2a3dd1(null,_0x3c7319);})[_0xfb07('0x16')](function(_0x8868d3){var _0x1a1edf={'statusCode':_0x8868d3[_0xfb07('0x74')]||0x1f4,'statusMessage':_0x8868d3[_0xfb07('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x8868d3[_0xfb07('0x77')][_0xfb07('0x6e')]||{},'body':_0x8868d3[_0xfb07('0x77')][_0xfb07('0x73')]||{}};_0x2a3dd1(null,_0x1a1edf);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x78')]=function(_0x473d67,_0x2b5319){scripts[_0xfb07('0x78')](this['channel'][_0xfb07('0x40')],_0x473d67[_0xfb07('0x79')],_0x473d67[_0xfb07('0x5d')],_0x473d67['dialogflow_language']||'en')[_0xfb07('0x14')](function(_0x39670c){_0x2b5319(null,_0x39670c);})['catch'](function(_0x43231e){_0x2b5319(_0x43231e);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x7a')]=function(_0x406f02,_0x516b97){scripts[_0xfb07('0x7a')](this[_0xfb07('0x11')][_0xfb07('0x40')],_0x406f02[_0xfb07('0x7b')],_0x406f02[_0xfb07('0x7c')],_0x406f02['private_key'],_0x406f02[_0xfb07('0x5d')],_0x406f02['dialogflowV2_language']||'en')[_0xfb07('0x14')](function(_0x566137){_0x516b97(null,_0x566137);})[_0xfb07('0x16')](function(_0x3f36f0){_0x516b97(_0x3f36f0);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x7d')]=function(_0xe18422,_0x2b8fc8){scripts[_0xfb07('0x7d')](this[_0xfb07('0x11')],_0xe18422)[_0xfb07('0x14')](function(_0x1fcee4){_0x2b8fc8(null,_0x1fcee4);})[_0xfb07('0x16')](function(_0x13010a){_0x2b8fc8(_0x13010a);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x7e')]=function(_0x5c9890,_0xfa4aa6){scripts['ispeechTTS'](_0x5c9890[_0xfb07('0x79')],_0x5c9890[_0xfb07('0x5d')],_0x5c9890[_0xfb07('0x7f')]||_0xfb07('0x5f'),_0x5c9890['speed'])[_0xfb07('0x14')](function(_0x15f8b3){_0xfa4aa6(null,_0x15f8b3);})[_0xfb07('0x16')](function(_0x81c3a0){_0xfa4aa6(_0x81c3a0);});};AGIVertices['prototype'][_0xfb07('0x80')]=function(_0x5d0b6b,_0x235032,_0x1714b5){scripts[_0xfb07('0x80')](_0x235032,_0x5d0b6b[_0xfb07('0x79')],_0x5d0b6b[_0xfb07('0x81')]||_0xfb07('0x5f'),this[_0xfb07('0x82')](_0x5d0b6b[_0xfb07('0x83')])?_0x5d0b6b[_0xfb07('0x83')]:undefined)[_0xfb07('0x14')](function(_0x4d90af){_0x1714b5(null,_0x4d90af);})[_0xfb07('0x16')](function(_0x36f304){_0x1714b5(_0x36f304);});};AGIVertices['prototype'][_0xfb07('0x84')]=function(_0x21dc41,_0x36f6ab){scripts['awsPolly'](_0x21dc41[_0xfb07('0x85')],_0x21dc41['aws_secret_access_key'],_0x21dc41[_0xfb07('0x86')],_0x21dc41[_0xfb07('0x87')]||_0xfb07('0x88'),_0x21dc41[_0xfb07('0x5d')],_0x21dc41[_0xfb07('0x89')]||_0xfb07('0x5d'))['then'](function(_0x24dff2){_0x36f6ab(null,_0x24dff2);})[_0xfb07('0x16')](function(_0x4fdd58){_0x36f6ab(_0x4fdd58);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x8a')]=function(_0xfc42be,_0x759be3){scripts[_0xfb07('0x8a')](this[_0xfb07('0x11')]['uniqueid'],_0xfc42be[_0xfb07('0x85')],_0xfc42be[_0xfb07('0x8b')],_0xfc42be['aws_lex_region'],_0xfc42be[_0xfb07('0x5d')],_0xfc42be[_0xfb07('0x8c')])[_0xfb07('0x14')](function(_0x1f4163){_0x759be3(null,_0x1f4163);})[_0xfb07('0x16')](function(_0x72ae3){_0x759be3(_0x72ae3);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x8d')]=function(_0x2a7d25,_0x3a6fde,_0x368058){scripts[_0xfb07('0x8d')](_0x3a6fde,_0x2a7d25[_0xfb07('0x79')],_0x2a7d25[_0xfb07('0x8e')]||_0xfb07('0x5f'))[_0xfb07('0x14')](function(_0x32d9cb){_0x368058(null,_0x32d9cb);})[_0xfb07('0x16')](function(_0x4477d0){_0x368058(_0x4477d0);});};AGIVertices[_0xfb07('0x17')][_0xfb07('0x8f')]=function(_0x115f41,_0x2ded6f,_0xa3a9ea){scripts[_0xfb07('0x8f')](_0x2ded6f,_0x115f41[_0xfb07('0x90')],_0x115f41['appsecret'],_0x115f41[_0xfb07('0x91')])[_0xfb07('0x14')](function(_0x129af1){_0xa3a9ea(null,_0x129af1);})[_0xfb07('0x16')](function(_0x1e9bc9){_0xa3a9ea(_0x1e9bc9);});};AGIVertices['prototype'][_0xfb07('0x92')]=function(_0x9f79da){var _0xec7d03=_[_0xfb07('0x93')](verticesWithRetry,_0x9f79da[_0xfb07('0x3c')])?_0x9f79da:_[_0xfb07('0x94')](_0x9f79da);for(var _0x3bf1d9 in _0xec7d03){if(_0xec7d03[_0xfb07('0x95')](_0x3bf1d9)){if(_0xec7d03[_0x3bf1d9]&&_[_0xfb07('0x96')](_0xec7d03[_0x3bf1d9])){if(_[_0xfb07('0x93')](recursiveMapAttributes,_0x3bf1d9)){_0xec7d03[_0x3bf1d9]=this[_0xfb07('0x97')](_0xec7d03[_0x3bf1d9]);}else{_0xec7d03[_0x3bf1d9]=this[_0xfb07('0x98')](_0xec7d03[_0x3bf1d9]);}}}}return _0xec7d03;};AGIVertices[_0xfb07('0x17')]['recursiveNodeIndex']=function(_0x3e326c){for(var _0x19bdd3 in _0x3e326c){if(_0x3e326c[_0xfb07('0x95')](_0x19bdd3)){if(_[_0xfb07('0x99')](_0x3e326c[_0x19bdd3])){this[_0xfb07('0x9a')](_0x3e326c[_0x19bdd3]);}else if(_[_0xfb07('0x9b')](_0x3e326c[_0x19bdd3])){for(var _0x3140f9=0x0;_0x3140f9<_0x3e326c[_0x19bdd3][_0xfb07('0x9c')];_0x3140f9++){this[_0xfb07('0x9a')](_0x3e326c[_0x19bdd3][_0x3140f9]);}}else if(_['isString'](_0x3e326c[_0x19bdd3])){_0x3e326c[_0x19bdd3]=this['replaceAllVariables'](_0x3e326c[_0x19bdd3]);}}}};AGIVertices[_0xfb07('0x17')][_0xfb07('0x9d')]=function(_0x2bf666,_0x5109f0){for(var _0x5de899 in _0x2bf666){if(_0x2bf666[_0xfb07('0x95')](_0x5de899)){if(_['isPlainObject'](_0x2bf666[_0x5de899])){if(!_[_0xfb07('0x48')](_0x2bf666[_0x5de899])){this['saveRestApiResult'](_0x2bf666[_0x5de899],util[_0xfb07('0x2e')]('%s.%s',_0x5109f0,_0x5de899));}}else if(_['isArray'](_0x2bf666[_0x5de899])){for(var _0x175f6e=0x0;_0x175f6e<_0x2bf666[_0x5de899][_0xfb07('0x9c')];_0x175f6e++){this[_0xfb07('0x9d')](_0x2bf666[_0x5de899][_0x175f6e],util[_0xfb07('0x2e')](_0xfb07('0x9e'),_0x5109f0,_0x5de899+'['+_0x175f6e+']'));}}else{if(!_[_0xfb07('0x49')](_0x2bf666[_0x5de899])){this[_0xfb07('0x11')][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0x9e'),_0x5109f0,_0x5de899),_0x2bf666[_0x5de899]);}}}}};AGIVertices['prototype'][_0xfb07('0x97')]=function(_0x2c3793){try{var _0x466479=JSON['parse'](_0x2c3793);this[_0xfb07('0x9a')](_0x466479);return JSON[_0xfb07('0x72')](_0x466479);}catch(_0x5d19b8){return this[_0xfb07('0x98')](_0x2c3793);}};AGIVertices[_0xfb07('0x17')][_0xfb07('0x98')]=function(_0x3b87c4){var _0x4bc25f=_0x3b87c4[_0xfb07('0xa0')]('{');for(var _0x59c128=0x1;_0x59c128<_0x4bc25f[_0xfb07('0x9c')];_0x59c128+=0x1){var _0x4fa751=_0x4bc25f[_0x59c128][_0xfb07('0xa0')]('}');if(_0x4fa751[_0xfb07('0x9c')]>0x1){_0x3b87c4=_0x3b87c4['replaceAll']('{'+_0x4fa751[0x0]+'}',this['channel'][_0xfb07('0xa1')](_0x4fa751[0x0])['extra']||_0x4fa751[0x0]);}}if(_0x4bc25f[_0xfb07('0x9c')]===0x1){return _0x3b87c4['toString']();}return this[_0xfb07('0x98')](_0x3b87c4);};AGIVertices[_0xfb07('0x17')][_0xfb07('0xa2')]=function(_0x15fb06,_0x3ac69f){var _0x50d699=this['channel'][_0xfb07('0xa1')](_0x15fb06);if(_0x50d699[_0xfb07('0xa3')]===-0x1){return _0x50d699;}logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3ac69f,_0x50d699['extra']));return this[_0xfb07('0x11')][_0xfb07('0x9f')](_0x3ac69f,_0x50d699[_0xfb07('0xa4')]);};AGIVertices[_0xfb07('0x17')]['isConfigured']=function(_0x69b967){return _0x69b967&&_0x69b967!=='0'&&_0x69b967!=='-1'&&_0x69b967!=='';};AGIVertices[_0xfb07('0x17')][_0xfb07('0xa5')]=function(_0x491445){this[_0xfb07('0x3a')]['sync'](this,_0x491445,'-');_0x491445[_0xfb07('0xa6')]=_0x491445['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xfb07('0xa7')]=function(_0xe76d86){logger[_0xfb07('0x33')](util['format'](_0xfb07('0xa8'),_0xe76d86[_0xfb07('0x3b')]));if(!this['isConfigured'](_0xe76d86[_0xfb07('0x5d')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xaa'));}var _0x36442f='\x22'+_0xe76d86['text']+'\x22';if(this[_0xfb07('0x82')](_0xe76d86[_0xfb07('0x77')])){_0x36442f+=','+_0xe76d86[_0xfb07('0x77')];}var _0x1f4a9d=this[_0xfb07('0x11')]['exec'](_0xfb07('0xab'),_0x36442f);if(_0x1f4a9d[_0xfb07('0xa3')]===-0x1){return _0x1f4a9d;}return this['channel']['noop'](util[_0xfb07('0x2e')](_0xfb07('0xac'),_0x36442f));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xad')]=function(_0x1f2968){logger['info'](util['format'](_0xfb07('0xae'),_0x1f2968[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x1f2968[_0xfb07('0xaf')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xb0'));}var _0x3da3a8=_0x1f2968[_0xfb07('0xaf')];if(this[_0xfb07('0x82')](_0x1f2968['options'])){_0x3da3a8+=','+_0x1f2968[_0xfb07('0x77')];}var _0x4c83ba=this[_0xfb07('0x11')][_0xfb07('0x58')](_0xfb07('0xb1'),_0x3da3a8);if(_0x4c83ba['result']===-0x1){return _0x4c83ba;}var _0x322317=this[_0xfb07('0xa2')](_0xfb07('0xb2'),_0xfb07('0xb3'));if(_0x322317[_0xfb07('0xa3')]===-0x1){return _0x322317;}var _0xa089f6=this[_0xfb07('0xa2')](_0xfb07('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0xa089f6[_0xfb07('0xa3')]===-0x1){return _0xa089f6;}var _0x580b50=this[_0xfb07('0xa2')](_0xfb07('0xb5'),'MRCP_RECOG_INSTANCE');if(_0x580b50[_0xfb07('0xa3')]===-0x1){return _0x580b50;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0xb6'),_0x3da3a8));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x9')]=function(_0x536ccd){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0xb7'),_0x536ccd[_0xfb07('0x3b')]));return this[_0xfb07('0x11')][_0xfb07('0x9')]([_0x536ccd[_0xfb07('0xb8')],_0x536ccd[_0xfb07('0xb9')]]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0xba')]=function(_0x21618a){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x21618a[_0xfb07('0x3b')]));if(this['isConfigured'](_0x21618a[_0xfb07('0x68')])){logger[_0xfb07('0x33')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x21618a[_0xfb07('0x68')]));var _0x5e5512=this[_0xfb07('0x11')]['wait'](_0x21618a[_0xfb07('0x68')]);if(_0x5e5512[_0xfb07('0xa3')]===-0x1){return _0x5e5512;}}return this['channel']['answer']();};AGIVertices[_0xfb07('0x17')][_0xfb07('0xbb')]=function(_0x51c2e6){logger['info'](util['format'](_0xfb07('0xbc'),_0x51c2e6[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x51c2e6[_0xfb07('0x4d')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x51c2e6,_0xfb07('0xbd'));}_0x51c2e6['scheduledAt']=moment();if(this[_0xfb07('0x82')](_0x51c2e6[_0xfb07('0xbe')])){_0x51c2e6[_0xfb07('0x4e')]=moment()[_0xfb07('0xbf')](_0x51c2e6['delay'],_0xfb07('0xc0'));}if(!this['isConfigured'](_0x51c2e6[_0xfb07('0x51')])){_0x51c2e6[_0xfb07('0x51')]=0x2;}this[_0xfb07('0x47')][_0xfb07('0xc1')](this,_0x51c2e6);return this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x51c2e6['phone'],_0x51c2e6[_0xfb07('0x4d')],_0x51c2e6['scheduledAt']));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xc2')]=function(_0x385752){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0xc3'),_0x385752[_0xfb07('0x3b')]));var _0x31578f=this[_0xfb07('0x11')][_0xfb07('0x58')](_0x385752[_0xfb07('0xc4')],_0x385752['options']);if(_0x31578f[_0xfb07('0xa3')]===-0x1){return _0x31578f;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0xc5'),_0x385752['application'],_0x385752[_0xfb07('0x77')]));};AGIVertices[_0xfb07('0x17')]['lumenvoxtts']=function(_0x55d973){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0xc6'),_0x55d973[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x55d973[_0xfb07('0x5d')])){return this[_0xfb07('0x11')]['noop']('no\x20text\x20configured');}var _0x57ecc8='\x22'+_0x55d973[_0xfb07('0x5d')]+'\x22';if(this[_0xfb07('0x82')](_0x55d973['options'])){_0x57ecc8+=','+_0x55d973['options'];}var _0x45ea8d=this[_0xfb07('0x11')][_0xfb07('0x58')](_0xfb07('0xab'),_0x57ecc8);if(_0x45ea8d['result']===-0x1){return _0x45ea8d;}return this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xac'),_0x57ecc8));};AGIVertices[_0xfb07('0x17')]['sestektts']=function(_0xe4e1fb){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0xc7'),_0xe4e1fb['label']));if(!this[_0xfb07('0x82')](_0xe4e1fb[_0xfb07('0x5d')])){return this['channel'][_0xfb07('0xa9')](_0xfb07('0xaa'));}var _0x5b6b98='\x22'+_0xe4e1fb[_0xfb07('0x5d')]+'\x22';if(this['isConfigured'](_0xe4e1fb['options'])){_0x5b6b98+=','+_0xe4e1fb['options'];}var _0x657ccf=this['channel']['exec'](_0xfb07('0xab'),_0x5b6b98);if(_0x657ccf['result']===-0x1){return _0x657ccf;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0xac'),_0x5b6b98));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xc8')]=function(_0xd61b5c){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0xc9'),_0xd61b5c[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0xd61b5c['grammar'])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xb0'));}var _0x426b83=_0xd61b5c[_0xfb07('0xaf')];if(this['isConfigured'](_0xd61b5c[_0xfb07('0x77')])){_0x426b83+=','+_0xd61b5c['options'];}var _0x3589f8=this[_0xfb07('0x11')]['exec']('MRCPRecog',_0x426b83);if(_0x3589f8['result']===-0x1){return _0x3589f8;}var _0x169795=this[_0xfb07('0xa2')](_0xfb07('0xb2'),_0xfb07('0xca'));if(_0x169795['result']===-0x1){return _0x169795;}var _0x1c7e0b=this['getAndSetVariable'](_0xfb07('0xb4'),_0xfb07('0xcb'));if(_0x1c7e0b['result']===-0x1){return _0x1c7e0b;}var _0xf71267=this['getAndSetVariable'](_0xfb07('0xb5'),_0xfb07('0xcc'));if(_0xf71267[_0xfb07('0xa3')]===-0x1){return _0xf71267;}return this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xb6'),_0x426b83));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xcd')]=function(_0x449634){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0xce'),_0x449634[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x449634[_0xfb07('0xaf')])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0xb0'));}var _0x27daa6=_0x449634['grammar'];if(this[_0xfb07('0x82')](_0x449634[_0xfb07('0x77')])){_0x27daa6+=','+_0x449634[_0xfb07('0x77')];}var _0x3512df=this[_0xfb07('0x11')]['exec'](_0xfb07('0xb1'),_0x27daa6);if(_0x3512df[_0xfb07('0xa3')]===-0x1){return _0x3512df;}var _0x3a74e1=this[_0xfb07('0xa2')](_0xfb07('0xb2'),_0xfb07('0xcf'));if(_0x3a74e1[_0xfb07('0xa3')]===-0x1){return _0x3a74e1;}var _0x305b01=this[_0xfb07('0xa2')](_0xfb07('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x305b01[_0xfb07('0xa3')]===-0x1){return _0x305b01;}var _0x5548bb=this[_0xfb07('0xa2')]('RECOG_INSTANCE()',_0xfb07('0xd0'));if(_0x5548bb['result']===-0x1){return _0x5548bb;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xb6'),_0x27daa6));};AGIVertices[_0xfb07('0x17')]['database']=function(_0x2d3e62){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0xd1'),_0x2d3e62[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x2d3e62[_0xfb07('0xd2')])){return this['channel'][_0xfb07('0x30')](_0x2d3e62,_0xfb07('0xd3'));}var _0x4c4c42=this[_0xfb07('0x1c')]['sync'](this,_0x2d3e62[_0xfb07('0xd2')]);if(!_0x4c4c42){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x2d3e62,_0xfb07('0xd4'));}if(!this[_0xfb07('0x82')](_0x2d3e62[_0xfb07('0x32')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x2d3e62,_0xfb07('0xd5'));}var _0x5ce2d5=_0x2d3e62[_0xfb07('0x32')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xfb07('0x11')]['noop'](util[_0xfb07('0x2e')]('query:\x20%s',_0x5ce2d5));var _0x1fe864=this['getQueryOdbc'][_0xfb07('0xc1')](this,_0x4c4c42,_0x5ce2d5);this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x2d3e62,_0x5ce2d5);if(!this[_0xfb07('0x82')](_0x2d3e62['variable_id'])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xd6'));}var _0x2172e8=this['getVariable']['sync'](this,_0x2d3e62['variable_id']);if(!_0x2172e8){return this['channel'][_0xfb07('0x30')](_0x2d3e62,_0xfb07('0xd7'));}var _0x3843de=this;_0x1fe864[_0xfb07('0xd8')](function(_0x15051d,_0x28d685){Object[_0xfb07('0xd9')](_0x15051d)[_0xfb07('0xd8')](function(_0x2054aa){_0x3843de['channel'][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0xda'),_0x2172e8,_0x28d685,_0x2054aa),_0x15051d[_0x2054aa]);});});this[_0xfb07('0x11')][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0xdb'),_0x2172e8),_0x1fe864[_0xfb07('0x9c')]);return this['channel'][_0xfb07('0xa9')](util['format']('variable\x20%s\x20set',_0x2172e8));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xdc')]=function(_0x293892){logger[_0xfb07('0xdd')](util[_0xfb07('0x2e')](_0xfb07('0xde'),_0x293892[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x293892[_0xfb07('0xdf')])){return this[_0xfb07('0x11')]['error'](_0x293892,_0xfb07('0xe0'));}var _0x3d62bf=this[_0xfb07('0x1f')]['sync'](this,_0x293892[_0xfb07('0xdf')]);if(!_0x3d62bf){return this['channel'][_0xfb07('0x30')](_0x293892,_0xfb07('0xe1'));}var _0x341c7a=this[_0xfb07('0x11')][_0xfb07('0x58')]('DIAL',[util[_0xfb07('0x2e')]('SIP/%s',_0x3d62bf),_0x293892[_0xfb07('0x68')],_0x293892['opts'],_0x293892[_0xfb07('0x66')]]);if(_0x341c7a['result']===-0x1){return _0x341c7a;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xe2'),_0xfb07('0xe3')));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xe4')]=function(_0x241a45){logger['info'](util[_0xfb07('0x2e')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x241a45[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x241a45[_0xfb07('0x79')])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0xe5'));}if(!this['isConfigured'](_0x241a45[_0xfb07('0x5d')])){return this['channel'][_0xfb07('0xa9')](_0xfb07('0xaa'));}this[_0xfb07('0x11')][_0xfb07('0xe6')]=!![];this[_0xfb07('0x3a')](_0x241a45);this['createSquareMessage'](_0x241a45[_0xfb07('0x5d')],'in','','');this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0xe7'),_0x241a45[_0xfb07('0x5d')]));var _0x3f568d=this[_0xfb07('0x78')][_0xfb07('0xc1')](this,_0x241a45);if(_0x3f568d){for(var _0x3cbd94 in _0x3f568d){if(_0x3f568d[_0xfb07('0x95')](_0x3cbd94)){this['channel'][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0xe8'),_0x3cbd94[_0xfb07('0x6b')]()),_0x3f568d[_0x3cbd94]);}}this[_0xfb07('0x46')](_0x3f568d[_0xfb07('0xe9')],_0xfb07('0xea'),'dialogflow','');return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xeb'),_0x3f568d[_0xfb07('0xe9')]));}return this['channel']['error'](_0x241a45,_0xfb07('0xec'));};AGIVertices[_0xfb07('0x17')][_0xfb07('0xed')]=function(_0x9f07da){logger[_0xfb07('0x33')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x9f07da[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x9f07da[_0xfb07('0x7b')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xee'));}if(!this[_0xfb07('0x82')](_0x9f07da[_0xfb07('0x7c')])){return this['channel'][_0xfb07('0xa9')]('no\x20client_email\x20configured');}if(!this[_0xfb07('0x82')](_0x9f07da[_0xfb07('0xef')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xf0'));}if(!this[_0xfb07('0x82')](_0x9f07da['dialogflowV2_language'])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xf1'));}if(!this[_0xfb07('0x82')](_0x9f07da[_0xfb07('0x5d')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xaa'));}this[_0xfb07('0x11')][_0xfb07('0xe6')]=!![];this[_0xfb07('0x3a')](_0x9f07da);this[_0xfb07('0x46')](_0x9f07da[_0xfb07('0x5d')],'in','','');this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xf2'),_0x9f07da['text']));var _0x39eadd=this[_0xfb07('0x7a')][_0xfb07('0xc1')](this,_0x9f07da);if(_0x39eadd){for(var _0x49ee1a in _0x39eadd){if(_0x39eadd['hasOwnProperty'](_0x49ee1a)){if(_0x49ee1a!=='providerResponse'){this[_0xfb07('0x11')]['setVariable'](util[_0xfb07('0x2e')]('DIALOGFLOW_%s',_0x49ee1a[_0xfb07('0x6b')]()),_0x39eadd[_0x49ee1a]);}}}this[_0xfb07('0x46')](_0x39eadd['speech'],_0xfb07('0xea'),'dialogflowV2',_0x39eadd[_0xfb07('0xf3')]);return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0xf4'),_0x39eadd[_0xfb07('0xe9')]));}return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x9f07da,_0xfb07('0xf5'));};AGIVertices[_0xfb07('0x17')]['sesteknda']=function(_0x1b323f){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0xf6'),_0x1b323f['label']));if(!this['isConfigured'](_0x1b323f[_0xfb07('0xf7')])){return this['channel'][_0xfb07('0xa9')](_0xfb07('0xf8'));}if(!this[_0xfb07('0x82')](_0x1b323f['username'])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xf9'));}if(!this[_0xfb07('0x82')](_0x1b323f[_0xfb07('0xfa')])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0xfb07('0x82')](_0x1b323f['ndassistant_url'])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0xaa'));}this[_0xfb07('0x11')][_0xfb07('0xe6')]=!![];this[_0xfb07('0x3a')](_0x1b323f);this['createSquareMessage'](_0x1b323f[_0xfb07('0x5d')],'in','','');this['channel']['noop'](util[_0xfb07('0x2e')](_0xfb07('0xfb'),_0x1b323f[_0xfb07('0x5d')]));var _0x303c0c=this[_0xfb07('0x7d')][_0xfb07('0xc1')](this,_0x1b323f);if(_0x303c0c){for(var _0x42d6c2 in _0x303c0c){if(_0x303c0c[_0xfb07('0x95')](_0x42d6c2)){this[_0xfb07('0x11')][_0xfb07('0x9f')](util[_0xfb07('0x2e')]('SESTEK_NDA_%s',_0x42d6c2[_0xfb07('0x6b')]()),_0x303c0c[_0x42d6c2]);}}this[_0xfb07('0x46')](_0x303c0c[_0xfb07('0xe9')],_0xfb07('0xea'),_0xfb07('0xfc'),'');if(_0x303c0c[_0xfb07('0xfd')]){this['channel']['noop'](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x303c0c[_0xfb07('0xfd')]));var _0x5f2e80=this[_0xfb07('0x11')]['streamFile'](_0x303c0c[_0xfb07('0xfd')]);try{fs['unlink'](_0x303c0c['audiofile']+_0xfb07('0xfe'));}catch(_0x2e0bb0){logger[_0xfb07('0x30')](_0x2e0bb0);}return _0x5f2e80;}else{return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xff'),_0x303c0c[_0xfb07('0xe9')]));}}return this['channel']['error'](_0x1b323f,_0xfb07('0x100'));};AGIVertices['prototype'][_0xfb07('0x101')]=function(_0x5e1f58){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x102'),_0x5e1f58[_0xfb07('0x3b')]));return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x101'));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x103')]=function(_0x29873a){logger['info'](util[_0xfb07('0x2e')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x29873a[_0xfb07('0x3b')]));var _0x5df908='';if(_0x29873a[_0xfb07('0x104')]){if(!this[_0xfb07('0x82')](_0x29873a['trunk_id'])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x29873a,_0xfb07('0x105'));}else{var _0x3db3d9=parseInt(_0x29873a['trunk_id'],0xa);if(isNaN(_0x3db3d9)){_0x5df908=_0x29873a[_0xfb07('0x104')];}else{_0x5df908=this[_0xfb07('0x20')][_0xfb07('0xc1')](this,_0x29873a[_0xfb07('0x104')]);if(!_0x5df908){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x29873a,'no\x20trunk\x20found');}}}}else if(_0x29873a[_0xfb07('0x106')]){_0x5df908=_0x29873a[_0xfb07('0x106')];}else{return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x29873a,_0xfb07('0x105'));}var _0x4b8039=this[_0xfb07('0x11')]['exec'](_0xfb07('0xe3'),[util[_0xfb07('0x2e')](_0xfb07('0x107'),_0x5df908,_0x29873a['phone']),_0x29873a[_0xfb07('0x68')],_0x29873a[_0xfb07('0x108')],_0x29873a[_0xfb07('0x66')]]);if(_0x4b8039[_0xfb07('0xa3')]===-0x1){return _0x4b8039;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xe2'),'DIAL'));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x109')]=function(_0x54a7a6){logger[_0xfb07('0x33')](util['format'](_0xfb07('0x10a'),_0x54a7a6[_0xfb07('0x3b')]));return this[_0xfb07('0x11')]['noop']('finally');};AGIVertices[_0xfb07('0x17')]['getdigits']=function(_0x22f1db){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x10b'),_0x22f1db[_0xfb07('0x3b')]));if(_0x22f1db[_0xfb07('0xa6')]===0x0){return this[_0xfb07('0xa5')](_0x22f1db);}_0x22f1db['retry']-=0x1;if(!this['isConfigured'](_0x22f1db['file_id'])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x22f1db,_0xfb07('0x10c'));}var _0x25ce7f=this['getSound'][_0xfb07('0xc1')](this,_0x22f1db['file_id']);if(!_0x25ce7f){return this['channel'][_0xfb07('0x30')](_0x22f1db,_0xfb07('0x10d'));}if(!this[_0xfb07('0x82')](_0x22f1db[_0xfb07('0x10e')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0xfb07('0xd6'));}var _0x1b27be=this[_0xfb07('0x11')][_0xfb07('0x10f')](_0x25ce7f,_0x22f1db[_0xfb07('0x110')],_0x22f1db[_0xfb07('0x111')]);var _0x1076d1=_0x1b27be[_0xfb07('0xa3')]?_0x1b27be[_0xfb07('0xa3')][_0xfb07('0x50')]():'';logger['info'](_0xfb07('0x112'),JSON[_0xfb07('0x72')](_0x1b27be));if(_0x1b27be[_0xfb07('0xa3')]===-0x1){this[_0xfb07('0x3a')]['sync'](this,_0x22f1db,_0x1076d1);return _0x1b27be;}else if(_0x1b27be[_0xfb07('0xa4')]==='timeout'){_0x1b27be[_0xfb07('0xa3')]=_0x1076d1['length']>=parseInt(_0x22f1db['mindigit'])?'x':'i';}else{_0x1b27be[_0xfb07('0xa3')]=_0x1076d1[_0xfb07('0x9c')]>=parseInt(_0x22f1db[_0xfb07('0x113')])&&_0x1076d1[_0xfb07('0x9c')]<=parseInt(_0x22f1db[_0xfb07('0x111')])?'x':'i';}var _0x293313=this[_0xfb07('0xa1')][_0xfb07('0xc1')](this,_0x22f1db[_0xfb07('0x10e')]);if(!_0x293313){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x22f1db,_0xfb07('0xd7'));}this['channel'][_0xfb07('0x9f')](_0x293313,_0x1076d1);if(this['isConfigured'](_0x22f1db['hiddendigitsnum'])){var _0x1db0d1=parseInt(_0x22f1db[_0xfb07('0x114')],0xa);var _0x35f7d4=rs[_0xfb07('0x115')]({'charset':'*','length':_0x1db0d1});var _0x557475=_0x1076d1[_0xfb07('0x9c')];if(_0x557475>0x0){if(_0x557475>_0x1db0d1){this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x22f1db,_0x22f1db[_0xfb07('0x116')]===_0xfb07('0x117')?_0x35f7d4+_0x1076d1[_0xfb07('0x118')](_0x1db0d1):_0x1076d1['substr'](0x0,_0x557475-_0x1db0d1)+_0x35f7d4);}else{this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x22f1db,rs[_0xfb07('0x115')]({'charset':'*','length':_0x557475}));}}else{this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x22f1db,'');}}else{this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x22f1db,_0x1076d1);}return _0x1b27be;};AGIVertices['prototype'][_0xfb07('0x10')]=function(_0x921ef6){logger[_0xfb07('0x33')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x921ef6['label']));return this[_0xfb07('0xf')](_0x921ef6);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x119')]=function(_0x1ece11){logger[_0xfb07('0x33')](util['format'](_0xfb07('0x11a'),_0x1ece11[_0xfb07('0x3b')]));this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x1ece11,_0x1ece11[_0xfb07('0x11b')]);return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0x11c'),_0x1ece11[_0xfb07('0x11b')]));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x11d')]=function(_0x244713){logger[_0xfb07('0x33')](util['format'](_0xfb07('0x11e'),_0x244713[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x244713['aws_access_key_id'])||!this[_0xfb07('0x82')](_0x244713[_0xfb07('0x8b')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x11f'));}if(!this[_0xfb07('0x82')](_0x244713[_0xfb07('0x5d')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xaa'));}this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x120'),_0x244713[_0xfb07('0x5d')]));var _0x5e16cd=this['awsPolly']['sync'](this,_0x244713);if(_0x5e16cd){this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x121'),_0x5e16cd));var _0x3b9b69=this[_0xfb07('0x11')][_0xfb07('0x122')](_0x5e16cd);try{fs['unlink'](_0x5e16cd+_0xfb07('0xfe'));}catch(_0x23979e){logger[_0xfb07('0x30')](_0x23979e);}return _0x3b9b69;}return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x244713,_0xfb07('0x123'));};AGIVertices['prototype'][_0xfb07('0x124')]=function(_0x515e16){logger['info'](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x515e16['label']));if(!this[_0xfb07('0x82')](_0x515e16[_0xfb07('0x85')])||!this[_0xfb07('0x82')](_0x515e16[_0xfb07('0x8b')])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0x11f'));}if(!this[_0xfb07('0x82')](_0x515e16[_0xfb07('0x8c')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x125'));}if(!this[_0xfb07('0x82')](_0x515e16['text'])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0xaa'));}this[_0xfb07('0x11')]['bot']=!![];this[_0xfb07('0x3a')](_0x515e16);this[_0xfb07('0x46')](_0x515e16['text'],'in','','');this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')]('Trying\x20Amazon\x20Lex:\x20%s',_0x515e16[_0xfb07('0x5d')]));var _0x317603=this[_0xfb07('0x8a')][_0xfb07('0xc1')](this,_0x515e16);if(_0x317603){for(var _0x411ae3 in _0x317603){if(_0x317603[_0xfb07('0x95')](_0x411ae3)&&_[_0xfb07('0x96')](_0x317603[_0x411ae3])){this[_0xfb07('0x11')][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0x126'),_0x411ae3[_0xfb07('0x6b')]()),_0x317603[_0x411ae3]);}}if(_['isNil'](_0x317603[_0xfb07('0x76')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x127'));}else{this[_0xfb07('0x46')](_0x317603['message'],_0xfb07('0xea'),_0xfb07('0x128'),'');return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x129'),_0x317603[_0xfb07('0x76')]));}}return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x515e16,_0xfb07('0x12a'));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x12b')]=function(_0x220e85){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x12c'),_0x220e85[_0xfb07('0x3b')],_0x220e85[_0xfb07('0x68')]));if(!this[_0xfb07('0x82')](_0x220e85[_0xfb07('0x79')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0xe5'));}var _0x589c4a='wav';var _0x3e032d=util[_0xfb07('0x2e')](_0xfb07('0x12d'),FILES_PATH,rs[_0xfb07('0x115')](0x4));var _0x176c59=util[_0xfb07('0x2e')](_0xfb07('0x9e'),_0x3e032d,_0x589c4a);var _0x59c1b5=!![];if(_0x220e85[_0xfb07('0x12e')]===_0xfb07('0x12f')){_0x59c1b5=![];}var _0x31bf1a=this[_0xfb07('0x11')][_0xfb07('0x130')](_0x3e032d,_0x589c4a,_0x220e85[_0xfb07('0x131')],_0x220e85[_0xfb07('0x68')],undefined,_0x59c1b5);if(_0x31bf1a[_0xfb07('0xa3')]!==-0x1){this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x132'),_0x176c59));var _0x1084f3=this[_0xfb07('0x8d')][_0xfb07('0xc1')](this,_0x220e85,_0x176c59);if(_0x1084f3){for(var _0x1a945c in _0x1084f3){if(_0x1084f3[_0xfb07('0x95')](_0x1a945c)){this[_0xfb07('0x11')][_0xfb07('0x9f')](util[_0xfb07('0x2e')]('GOOGLE_ASR_%s',_0x1a945c[_0xfb07('0x6b')]()),_0x1084f3[_0x1a945c]);}}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x133'),JSON[_0xfb07('0x72')](_0x1084f3)));}}return _0x31bf1a;};AGIVertices[_0xfb07('0x17')][_0xfb07('0x134')]=function(_0x4db8a0){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4db8a0[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x4db8a0[_0xfb07('0x90')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x4db8a0[_0xfb07('0x135')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x136'));}var _0x74bd61=_0xfb07('0x137');var _0x3c8f2e=util[_0xfb07('0x2e')](_0xfb07('0x12d'),FILES_PATH,rs[_0xfb07('0x115')](0x4));var _0xa45d78=util[_0xfb07('0x2e')]('%s.%s',_0x3c8f2e,_0x74bd61);var _0x4b0cac=!![];if(_0x4db8a0[_0xfb07('0x12e')]===_0xfb07('0x12f')){_0x4b0cac=![];}var _0x3c3e22=this[_0xfb07('0x11')][_0xfb07('0x130')](_0x3c8f2e,_0x74bd61,_0x4db8a0[_0xfb07('0x131')],_0x4db8a0[_0xfb07('0x68')],undefined,_0x4b0cac);if(_0x3c3e22[_0xfb07('0xa3')]!==-0x1){this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0x138'),_0xa45d78));var _0x54691d=this[_0xfb07('0x8f')][_0xfb07('0xc1')](this,_0x4db8a0,_0xa45d78);if(_0x54691d){for(var _0x592f1f in _0x54691d){if(_0x54691d[_0xfb07('0x95')](_0x592f1f)){this['channel'][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0x139'),_0x592f1f['toUpperCase']()),_0x54691d[_0x592f1f]);}}return this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x13a'),JSON['stringify'](_0x54691d)));}}return _0x3c3e22;};AGIVertices[_0xfb07('0x17')][_0xfb07('0x13b')]=function(_0x55c0ed){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x55c0ed[_0xfb07('0x3b')]));return this[_0xfb07('0x11')][_0xfb07('0x13c')](_0x55c0ed[_0xfb07('0x42')],_0x55c0ed['extension'],_0x55c0ed['priority']);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x13d')]=function(_0x17fdab){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x13e'),_0x17fdab[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x17fdab[_0xfb07('0x13f')])){return this[_0xfb07('0x11')]['error'](_0x17fdab,_0xfb07('0x140'));}try{var _0xdfbc9f=eval(_0x17fdab[_0xfb07('0x13f')])?_0xfb07('0x141'):_0xfb07('0x142');this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0x143'),_0x17fdab[_0xfb07('0x13f')],_0xdfbc9f));return{'code':0xc8,'result':_0xdfbc9f};}catch(_0x4f863a){return{'code':0xc8,'result':_0xfb07('0x142')};}};AGIVertices['prototype'][_0xfb07('0x144')]=function(_0x25dce9){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x145'),_0x25dce9[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x25dce9[_0xfb07('0x146')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x25dce9,'no\x20interval\x20configured');}var _0x3b1e98=this[_0xfb07('0x29')][_0xfb07('0xc1')](this,_0x25dce9[_0xfb07('0x146')]);if(!_0x3b1e98){return this['channel'][_0xfb07('0x30')](_0x25dce9,'no\x20intervals\x20found');}for(var _0x47fc5e=0x0;_0x47fc5e<_0x3b1e98['length'];_0x47fc5e+=0x1){var _0x131ba2=this[_0xfb07('0x11')]['getVariable'](util[_0xfb07('0x2e')]('IFTIME(%s?true:false)',_0x3b1e98[_0x47fc5e]));if(_0x131ba2[_0xfb07('0xa3')]===-0x1){return _0x131ba2;}logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x147'),_0x3b1e98[_0x47fc5e],_0x131ba2[_0xfb07('0xa4')]));if(_0x131ba2['extra']===_0xfb07('0x141')){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x147'),_0x3b1e98[_0x47fc5e],_0xfb07('0x141')));this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x147'),_0x3b1e98[_0x47fc5e],'true'));return{'code':0xc8,'result':_0xfb07('0x141')};}else{logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x147'),_0x3b1e98[_0x47fc5e],_0xfb07('0x142')));this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0x147'),_0x3b1e98[_0x47fc5e],_0xfb07('0x142')));}}return{'code':0xc8,'result':_0xfb07('0x142')};};AGIVertices[_0xfb07('0x17')][_0xfb07('0x148')]=function(_0x5d1a95){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x149'),_0x5d1a95[_0xfb07('0x3b')]));return this[_0xfb07('0x11')][_0xfb07('0x148')]();};AGIVertices['prototype']['ispeechasr']=function(_0x3a6b5d){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x14a'),_0x3a6b5d[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x3a6b5d['key'])){return this[_0xfb07('0x11')][_0xfb07('0xa9')]('no\x20key\x20configured');}var _0x3fafb2='wav';var _0x392a3b=util[_0xfb07('0x2e')]('%s/recordings/%s',FILES_PATH,rs[_0xfb07('0x115')](0x4));var _0xa87515=util[_0xfb07('0x2e')](_0xfb07('0x9e'),_0x392a3b,_0x3fafb2);var _0x11eb2a=!![];if(_0x3a6b5d[_0xfb07('0x12e')]==='NOBEEP'){_0x11eb2a=![];}var _0x20a6d5=this[_0xfb07('0x11')][_0xfb07('0x130')](_0x392a3b,_0x3fafb2,_0x3a6b5d['intKey'],_0x3a6b5d['timeout'],undefined,_0x11eb2a);if(_0x20a6d5[_0xfb07('0xa3')]!==-0x1){this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x14b'),_0xa87515));var _0x57ff9a=this[_0xfb07('0x80')][_0xfb07('0xc1')](this,_0x3a6b5d,_0xa87515);if(_0x57ff9a){for(var _0x22cd8d in _0x57ff9a){if(_0x57ff9a[_0xfb07('0x95')](_0x22cd8d)){this[_0xfb07('0x11')][_0xfb07('0x9f')](util['format'](_0xfb07('0x14c'),_0x22cd8d[_0xfb07('0x6b')]()),_0x57ff9a[_0x22cd8d]);}}return this['channel']['noop'](util[_0xfb07('0x2e')](_0xfb07('0x14d'),JSON[_0xfb07('0x72')](_0x57ff9a)));}}return _0x20a6d5;};AGIVertices[_0xfb07('0x17')][_0xfb07('0x14e')]=function(_0x289df9){logger['info'](util[_0xfb07('0x2e')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x289df9[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x289df9['key'])){return this['channel'][_0xfb07('0xa9')](_0xfb07('0xe5'));}if(!this['isConfigured'](_0x289df9[_0xfb07('0x5d')])){return this['channel']['noop'](_0xfb07('0xaa'));}this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0x14f'),_0x289df9[_0xfb07('0x5d')]));var _0x4c1200=this['ispeechTTS'][_0xfb07('0xc1')](this,_0x289df9);if(_0x4c1200){this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0x14b'),_0x4c1200));var _0x5eb188=this[_0xfb07('0x11')]['streamFile'](_0x4c1200,_0x289df9[_0xfb07('0x131')]);try{fs[_0xfb07('0x150')](_0x4c1200+_0xfb07('0xfe'));}catch(_0x19a2d6){logger[_0xfb07('0x30')](_0x19a2d6);}return _0x5eb188;}return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x289df9,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfb07('0x17')]['login']=function(_0x37ca2f){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x151'),_0x37ca2f[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x37ca2f[_0xfb07('0x152')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x37ca2f,_0xfb07('0x153'));}logger[_0xfb07('0x33')](util['format'](_0xfb07('0x154'),this['channel'][_0xfb07('0x3e')],_0x37ca2f['findBy']));var _0x3cdf9b=this[_0xfb07('0x56')][_0xfb07('0xc1')](this,_0x37ca2f[_0xfb07('0x152')]);if(_0x3cdf9b){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x155'),this['channel']['callerid'],_0x37ca2f[_0xfb07('0x152')]));this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x155'),this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x37ca2f[_0xfb07('0x152')]));return{'code':0xc8,'result':_0xfb07('0x156')};}else{logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x37ca2f[_0xfb07('0x152')]));this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x37ca2f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xfb07('0x17')][_0xfb07('0x157')]=function(_0x4b53d1){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x158'),_0x4b53d1[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x4b53d1[_0xfb07('0x152')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x4b53d1,_0xfb07('0x153'));}logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x4b53d1[_0xfb07('0x152')]));var _0x59349e=this[_0xfb07('0x55')][_0xfb07('0xc1')](this,_0x4b53d1[_0xfb07('0x152')]);if(_0x59349e){logger['info'](util[_0xfb07('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x4b53d1[_0xfb07('0x152')]));this[_0xfb07('0x11')]['noop'](util[_0xfb07('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x4b53d1[_0xfb07('0x152')]));return{'code':0xc8,'result':_0xfb07('0x156')};}else{logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfb07('0x3e')],_0x4b53d1['findBy']));this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x4b53d1[_0xfb07('0x152')]));return{'code':0xc8,'result':_0xfb07('0x159')};}};AGIVertices[_0xfb07('0x17')]['math']=function(_0x102f4c){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x15a'),_0x102f4c[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x102f4c[_0xfb07('0x15b')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x102f4c,_0xfb07('0x15c'));}this[_0xfb07('0x11')]['noop'](util['format'](_0xfb07('0x15d'),_0x102f4c['operation']));var _0x82e4fe=eval(_0x102f4c['operation']);if(!this[_0xfb07('0x82')](_0x102f4c[_0xfb07('0x10e')])){return this[_0xfb07('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x85bf54=this['getVariable'][_0xfb07('0xc1')](this,_0x102f4c[_0xfb07('0x10e')]);if(!_0x85bf54){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x102f4c,_0xfb07('0xd7'));}if(_[_0xfb07('0x9b')](_0x82e4fe)){var _0x17ace8=this;_0x82e4fe[_0xfb07('0xd8')](function(_0x2c7956,_0x25e30f){_0x17ace8['channel'][_0xfb07('0x9f')](util[_0xfb07('0x2e')](_0xfb07('0x15e'),_0x85bf54,_0x25e30f),_0x2c7956);});return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0x15f'),_0x85bf54));}else{return this[_0xfb07('0x11')]['setVariable'](_0x85bf54,_0x82e4fe);}};AGIVertices[_0xfb07('0x17')][_0xfb07('0xe')]=function(_0x32a9bc){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x160'),_0x32a9bc[_0xfb07('0x3b')]));if(_0x32a9bc[_0xfb07('0xa6')]===0x0){return this[_0xfb07('0xa5')](_0x32a9bc);}_0x32a9bc[_0xfb07('0xa6')]-=0x1;if(!this[_0xfb07('0x82')](_0x32a9bc[_0xfb07('0x161')])){return this[_0xfb07('0x11')]['error'](_0x32a9bc,_0xfb07('0x10c'));}var _0x41657d=this[_0xfb07('0x22')][_0xfb07('0xc1')](this,_0x32a9bc[_0xfb07('0x161')]);if(!_0x41657d){return this[_0xfb07('0x11')]['error'](_0x32a9bc,_0xfb07('0x10d'));}var _0x3e6679=this[_0xfb07('0x11')][_0xfb07('0x10f')](_0x41657d,_0x32a9bc[_0xfb07('0x110')],_0x32a9bc[_0xfb07('0x162')]);var _0x51cbe1=_0x3e6679[_0xfb07('0xa3')];if(_0x3e6679[_0xfb07('0xa3')]===-0x1){this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x32a9bc,'-1');return _0x3e6679;}else if(_0x3e6679['extra']===_0xfb07('0x68')){_0x3e6679['result']=_0x3e6679[_0xfb07('0xa3')][_0xfb07('0x9c')]>0x0?_0x3e6679[_0xfb07('0xa3')]:'t';}else if(_[_0xfb07('0x48')](_0x3e6679['result'])){_0x3e6679[_0xfb07('0xa3')]='#';_0x51cbe1='#';}if(!this[_0xfb07('0x82')](_0x32a9bc[_0xfb07('0x10e')])){this[_0xfb07('0x11')]['noop'](_0xfb07('0xd6'));}else{var _0x3a09d2=this[_0xfb07('0xa1')]['sync'](this,_0x32a9bc['variable_id']);if(!_0x3a09d2){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x32a9bc,_0xfb07('0xd7'));}this['channel'][_0xfb07('0x9f')](_0x3a09d2,_0x51cbe1);}this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x32a9bc,_0x51cbe1);return _0x3e6679;};AGIVertices[_0xfb07('0x17')][_0xfb07('0xa9')]=function(_0x218950){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x163'),_0x218950[_0xfb07('0x3b')]));return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0x218950['output']||_0x218950[_0xfb07('0x3b')]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x164')]=function(_0x1a2a78){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x165'),_0x1a2a78[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x1a2a78[_0xfb07('0x152')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x1a2a78,_0xfb07('0x153'));}logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x1a2a78['findBy']));var _0x19f84b=this[_0xfb07('0x166')]['sync'](this,_0x1a2a78[_0xfb07('0x167')]);var _0x22f6c4=this[_0xfb07('0x52')][_0xfb07('0xc1')](this,_0x1a2a78[_0xfb07('0x152')],_0x19f84b);if(_0x22f6c4){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x155'),this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x1a2a78[_0xfb07('0x152')]));this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format'](_0xfb07('0x155'),this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x1a2a78[_0xfb07('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfb07('0x33')](util['format'](_0xfb07('0x168'),this[_0xfb07('0x11')]['callerid'],_0x1a2a78['findBy']));this[_0xfb07('0x11')]['noop'](util[_0xfb07('0x2e')](_0xfb07('0x155'),this['channel']['callerid'],_0x1a2a78[_0xfb07('0x152')]));return{'code':0xc8,'result':_0xfb07('0x159')};}};AGIVertices[_0xfb07('0x17')][_0xfb07('0x169')]=function(_0x4950a1){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x16a'),_0x4950a1[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x4950a1[_0xfb07('0x161')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x4950a1,_0xfb07('0x10c'));}var _0x377d82=this['getSound'][_0xfb07('0xc1')](this,_0x4950a1['file_id']);if(!_0x377d82){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x4950a1,_0xfb07('0x10d'));}var _0x175d2b=this[_0xfb07('0x11')]['exec']('PLAYBACK',[_0x377d82,_0x4950a1[_0xfb07('0x108')]]);if(_0x175d2b[_0xfb07('0xa3')]===-0x1){return _0x175d2b;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')]('Executed\x20command\x20%s\x20%s',_0xfb07('0x16b'),_0x377d82));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x16c')]=function(_0x59e64e){logger[_0xfb07('0x33')](util['format'](_0xfb07('0x16d'),_0x59e64e[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x59e64e[_0xfb07('0x16e')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x59e64e,_0xfb07('0x16f'));}var _0x3c5b72='';var _0x2027b6=parseInt(_0x59e64e[_0xfb07('0x16e')],0xa);if(isNaN(_0x2027b6)){_0x3c5b72=_0x59e64e[_0xfb07('0x16e')];}else{_0x3c5b72=this[_0xfb07('0x18')][_0xfb07('0xc1')](this,_0x59e64e[_0xfb07('0x16e')]);if(!_0x3c5b72){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x59e64e,_0xfb07('0x170'));}}var _0x3d8a81='';if(this[_0xfb07('0x82')](_0x59e64e[_0xfb07('0x161')])){var _0x31fcc9=this[_0xfb07('0x22')][_0xfb07('0xc1')](this,_0x59e64e['file_id']);if(_0x31fcc9){_0x3d8a81=_0x31fcc9;}}this['createSquareDetailsReport'][_0xfb07('0xc1')](this,_0x59e64e,_0x3c5b72);if(_0x59e64e[_0xfb07('0x108')][_0xfb07('0x171')]('x')<0x0){_0x59e64e[_0xfb07('0x108')]+='x';}if(_0x59e64e[_0xfb07('0x108')][_0xfb07('0x171')]('X')<0x0){_0x59e64e[_0xfb07('0x108')]+='X';}this[_0xfb07('0x11')][_0xfb07('0x9f')]('XMCS-QUEUE',_0x3c5b72?_0x3c5b72['toLowerCase']():'');var _0xa2a0ef=this['channel'][_0xfb07('0x58')](_0xfb07('0x172'),[_0x3c5b72,_0x59e64e[_0xfb07('0x108')],_0x59e64e[_0xfb07('0x66')],_0x3d8a81,_0x59e64e[_0xfb07('0x68')],_0x59e64e[_0xfb07('0x9')],_0x59e64e[_0xfb07('0x173')],_0x59e64e[_0xfb07('0x174')],'',_0x59e64e[_0xfb07('0x175')]]);if(_0xa2a0ef['result']===-0x1){return _0xa2a0ef;}return this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0xc5'),_0xfb07('0x172'),_0x3c5b72));};AGIVertices[_0xfb07('0x17')]['record']=function(_0x5e55b3){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x176'),_0x5e55b3[_0xfb07('0x3b')]));var _0x5b2d8a=_0x5e55b3[_0xfb07('0x177')]||_0xfb07('0x137');var _0x47ec53=util[_0xfb07('0x2e')]('%s_%s',this['channel']['uniqueid'],rs[_0xfb07('0x115')](0x5));var _0x4ec761=util[_0xfb07('0x2e')]('%s/recordings/%s.%s',FILES_PATH,_0x47ec53,_0x5b2d8a);var _0x515ff1=util[_0xfb07('0x2e')](_0xfb07('0x12d'),FILES_PATH,_0x47ec53);this['createSquareRecording'][_0xfb07('0xc1')](this,_0x5e55b3,_0x47ec53,_0x4ec761);this[_0xfb07('0x11')][_0xfb07('0x9f')](_0xfb07('0x178'),_0x47ec53);logger[_0xfb07('0x33')](_0xfb07('0x179'),_0x515ff1,_0x5b2d8a,_0x5e55b3['escape_digits'],_0x5e55b3[_0xfb07('0x68')]);return this[_0xfb07('0x11')][_0xfb07('0x130')](_0x515ff1,_0x5b2d8a,_0x5e55b3[_0xfb07('0x17a')],_0x5e55b3['timeout'],undefined,!![]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x17b')]=function(_0x326769){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x326769[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x326769[_0xfb07('0x66')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x17c'));}var _0x830e80=this[_0xfb07('0x65')]['sync'](this,_0x326769);logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x17d'),util[_0xfb07('0x17e')](_0x830e80,{'showHidden':![],'depth':null})));if(!this[_0xfb07('0x82')](_0x326769[_0xfb07('0x10e')])){return this[_0xfb07('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x569a54=this[_0xfb07('0xa1')][_0xfb07('0xc1')](this,_0x326769[_0xfb07('0x10e')]);if(!_0x569a54){return this['channel'][_0xfb07('0x30')](_0x326769,_0xfb07('0xd7'));}this[_0xfb07('0x11')]['setVariable'](util[_0xfb07('0x2e')](_0xfb07('0x17f'),_0x569a54),_0x830e80[_0xfb07('0x74')]?_0x830e80[_0xfb07('0x74')]:_0xfb07('0x180'));this['channel'][_0xfb07('0x9f')](util['format']('%s_STATUS_MESSAGE',_0x569a54),_0x830e80[_0xfb07('0x75')]?_0x830e80[_0xfb07('0x75')]:'OK');if(_0x830e80[_0xfb07('0x73')]){try{this[_0xfb07('0x9d')](_0x830e80['body'],_0x569a54);}catch(_0x77dc4){logger[_0xfb07('0x30')](util[_0xfb07('0x2e')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x569a54));}}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x181'),_0x569a54));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x182')]=function(_0x31d340){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x183'),_0x31d340[_0xfb07('0x3b')]));return this[_0xfb07('0x11')][_0xfb07('0x184')](_0x31d340[_0xfb07('0x185')][_0xfb07('0x5a')](/\s+/g,''),_0x31d340[_0xfb07('0x17a')]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x186')]=function(_0x29539a){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x29539a[_0xfb07('0x3b')]));return this['channel'][_0xfb07('0x187')](_0x29539a['number'][_0xfb07('0x5a')](/\s+/g,''),_0x29539a[_0xfb07('0x17a')]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x188')]=function(_0x1eda46){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x189'),_0x1eda46['label']));return this['channel'][_0xfb07('0x18a')](_0x1eda46[_0xfb07('0x5d')],_0x1eda46[_0xfb07('0x17a')]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x18b')]=function(_0x2c7883){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x18c'),_0x2c7883['label']));if(!this[_0xfb07('0x82')](_0x2c7883[_0xfb07('0x18d')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x18e'));}var _0x82274c=this['getMailAccount']['sync'](this,_0x2c7883[_0xfb07('0x18d')]);if(!_0x82274c||!_0x82274c[_0xfb07('0x18f')]){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x2c7883,_0xfb07('0x190'));}var _0x13189b={'from':util['format']('\x22%s\x22\x20<%s>',_0x82274c[_0xfb07('0x15')],_0x82274c[_0xfb07('0x191')]||_0x82274c['Smtp']['user']),'to':_0x2c7883['to']||'','cc':_0x2c7883['cc']||'','bcc':_0x2c7883['bcc']||'','subject':_0x2c7883[_0xfb07('0x192')],'html':_0x2c7883['text'],'text':_0x2c7883[_0xfb07('0x5d')]};if(this[_0xfb07('0x82')](_0x2c7883[_0xfb07('0x193')])){}logger['debug']('sendMail\x20message',JSON[_0xfb07('0x72')](_0x13189b));this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x2c7883,_0x2c7883[_0xfb07('0x18d')]);this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x194'),_0x82274c['name']));this[_0xfb07('0x28')][_0xfb07('0xc1')](this,_0x82274c[_0xfb07('0x195')],_0x13189b);return this['channel'][_0xfb07('0xa9')](_0xfb07('0x196'));};AGIVertices[_0xfb07('0x17')]['sendFax']=function(_0x275d09){logger['info'](util['format'](_0xfb07('0x197'),_0x275d09['label']));return this[_0xfb07('0x11')][_0xfb07('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xfb07('0x17')][_0xfb07('0x198')]=function(_0x2974c4){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x199'),_0x2974c4[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x2974c4[_0xfb07('0x19a')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x19b'));}var _0x17de96=this['getSmsAccount'][_0xfb07('0xc1')](this,_0x2974c4[_0xfb07('0x19a')]);if(!_0x17de96){return this[_0xfb07('0x11')]['error'](_0x2974c4,'no\x20sms\x20account\x20found');}var _0x1d999b={'body':_0x2974c4[_0xfb07('0x19c')],'phone':_0x2974c4['to']||'','SmsAccountId':_0x17de96['id']};logger[_0xfb07('0xdd')](_0xfb07('0x19d'),JSON[_0xfb07('0x72')](_0x1d999b));this['createSquareDetailsReport']['sync'](this,_0x2974c4,_0x2974c4[_0xfb07('0x19a')]);this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0x19e'),_0x17de96['name']));this[_0xfb07('0x39')][_0xfb07('0xc1')](this,_0x1d999b);return this['channel'][_0xfb07('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xfb07('0x19f')]=function(_0x4ab800){logger[_0xfb07('0x33')](util['format'](_0xfb07('0x1a0'),_0x4ab800[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x4ab800[_0xfb07('0x10e')])){return this[_0xfb07('0x11')]['error'](_0x4ab800,'no\x20variable\x20selected');}var _0x47bfa3=this['getVariable'][_0xfb07('0xc1')](this,_0x4ab800['variable_id']);if(!_0x47bfa3){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x4ab800,'no\x20variable\x20found');}return this['channel'][_0xfb07('0x9f')](_0x47bfa3,_0x4ab800[_0xfb07('0x1a1')]);};AGIVertices[_0xfb07('0x17')][_0xfb07('0x1a2')]=function(_0x3aeb20){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x1a3'),_0x3aeb20[_0xfb07('0x3b')]));this[_0xfb07('0x11')][_0xfb07('0xa9')]('START\x20CALLY\x20SQUARE');var _0x5cf866=this[_0xfb07('0x11')][_0xfb07('0xa1')](_0xfb07('0x1a4'));if(!_[_0xfb07('0x48')](_0x5cf866[_0xfb07('0xa4')])){this['channel'][_0xfb07('0x40')]=_0x5cf866['extra'];}if(_0x3aeb20[_0xfb07('0xba')]===_0xfb07('0x1a5')){this[_0xfb07('0x11')][_0xfb07('0xa9')](_0xfb07('0x1a6'));return this[_0xfb07('0x11')][_0xfb07('0xba')]();}return this[_0xfb07('0x11')][_0xfb07('0xa9')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xfb07('0x1a7')]=function(_0x49f385){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x1a8'),_0x49f385[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x49f385[_0xfb07('0x1a9')])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x49f385,'no\x20subproject\x20selected');}var _0x5cca0e=this[_0xfb07('0x1a')][_0xfb07('0xc1')](this,_0x49f385[_0xfb07('0x1a9')]);if(!this[_0xfb07('0x82')](_0x5cca0e)){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x49f385,util[_0xfb07('0x2e')](_0xfb07('0x1aa'),_0x49f385['project_id']));}if(_0x5cca0e===this[_0xfb07('0x11')][_0xfb07('0x3d')]){return this[_0xfb07('0x11')]['error'](_0x49f385,_0xfb07('0x1ab'));}this[_0xfb07('0x3a')]['sync'](this,_0x49f385,_0x5cca0e);var _0x3dda0d=this['channel'][_0xfb07('0x58')](_0xfb07('0x1ac'),util['format'](_0xfb07('0x1ad'),config[_0xfb07('0x9')][_0xfb07('0x1ae')]||'127.0.0.1',_0x5cca0e,this[_0xfb07('0x11')][_0xfb07('0x3d')]));if(_0x3dda0d['result']===-0x1){return _0x3dda0d;}return this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0xc5'),_0xfb07('0x1ac'),_0x5cca0e));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x1af')]=function(_0x2d4eba){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x1b0'),_0x2d4eba['label']));var _0x365fc5=this[_0xfb07('0x1b1')][_0xfb07('0xc1')](this,_0x2d4eba['command']);this[_0xfb07('0x3a')][_0xfb07('0xc1')](this,_0x2d4eba,_0x2d4eba[_0xfb07('0xb8')]);if(this['isConfigured'](_0x2d4eba[_0xfb07('0x10e')])){var _0x1caca6=this[_0xfb07('0xa1')][_0xfb07('0xc1')](this,_0x2d4eba[_0xfb07('0x10e')]);if(_0x1caca6){this['channel']['setVariable'](_0x1caca6,_0x365fc5);return this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2d4eba[_0xfb07('0xb8')],_0x1caca6));}}return this[_0xfb07('0x11')]['noop'](util[_0xfb07('0x2e')](_0xfb07('0x1b2'),_0x2d4eba[_0xfb07('0xb8')]));};AGIVertices[_0xfb07('0x17')]['google_cloud_tts']=function(_0xd25194){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xd25194['label']));_0xd25194[_0xfb07('0x5d')]=_0xd25194[_0xfb07('0x5d')][_0xfb07('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xd25194[_0xfb07('0x1b3')])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0x1b4'));}if(!this[_0xfb07('0x82')](_0xd25194[_0xfb07('0x5d')])){return this[_0xfb07('0x11')]['noop'](_0xfb07('0xaa'));}this['channel'][_0xfb07('0xa9')](util[_0xfb07('0x2e')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0xd25194[_0xfb07('0x5d')]));var _0x3e8edb=this[_0xfb07('0x5b')]['sync'](this,_0xd25194);if(_0x3e8edb){this[_0xfb07('0x11')]['noop'](util[_0xfb07('0x2e')](_0xfb07('0x1b5'),_0x3e8edb));var _0x2aabd8=this['channel'][_0xfb07('0x122')](_0x3e8edb);try{fs[_0xfb07('0x150')](_0x3e8edb+'.wav');}catch(_0x3d5759){logger['error'](_0x3d5759);}return _0x2aabd8;}return this[_0xfb07('0x11')][_0xfb07('0x30')](_0xd25194,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfb07('0x17')][_0xfb07('0x1b6')]=function(_0x3dccce){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x1b7'),_0x3dccce[_0xfb07('0x3b')]));_0x3dccce['text']=_0x3dccce[_0xfb07('0x5d')][_0xfb07('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3dccce[_0xfb07('0x5d')])){return this[_0xfb07('0x11')][_0xfb07('0xa9')]('no\x20text\x20configured');}this['channel'][_0xfb07('0xa9')](util['format'](_0xfb07('0x1b8'),_0x3dccce[_0xfb07('0x5d')]));var _0x18f975=this[_0xfb07('0x63')][_0xfb07('0xc1')](this,_0x3dccce);if(_0x18f975){this['channel']['noop'](util[_0xfb07('0x2e')](_0xfb07('0x1b9'),_0x18f975));var _0x1e6260=this[_0xfb07('0x11')][_0xfb07('0x122')](_0x18f975);try{fs[_0xfb07('0x150')](_0x18f975+_0xfb07('0xfe'));}catch(_0x581621){logger['error'](_0x581621);}return _0x1e6260;}return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x3dccce,_0xfb07('0x1ba'));};AGIVertices[_0xfb07('0x17')][_0xfb07('0x1bb')]=function(_0x45387c){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x1bc'),_0x45387c[_0xfb07('0x3b')]));if(!this['isConfigured'](_0x45387c['findBy'])){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x45387c,_0xfb07('0x153'));}logger['info'](util['format'](_0xfb07('0x154'),this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x45387c[_0xfb07('0x152')]));var _0x99ac9c=this['agentUnpause'][_0xfb07('0xc1')](this,_0x45387c[_0xfb07('0x152')]);if(_0x99ac9c){logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x155'),this['channel'][_0xfb07('0x3e')],_0x45387c['findBy']));this['channel'][_0xfb07('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xfb07('0x11')][_0xfb07('0x3e')],_0x45387c[_0xfb07('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfb07('0x33')](util[_0xfb07('0x2e')](_0xfb07('0x168'),this['channel'][_0xfb07('0x3e')],_0x45387c[_0xfb07('0x152')]));this[_0xfb07('0x11')][_0xfb07('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfb07('0x3e')],_0x45387c[_0xfb07('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xfb07('0x1bd')]=function(_0x24a5ca){logger['info'](util['format'](_0xfb07('0x1be'),_0x24a5ca[_0xfb07('0x3b')]));var _0x1dbc9d=this[_0xfb07('0x11')][_0xfb07('0x58')](_0xfb07('0x1bf'),[_0x24a5ca[_0xfb07('0x1c0')],_0x24a5ca[_0xfb07('0x77')]]);if(_0x1dbc9d['result']===-0x1){return _0x1dbc9d;}return this[_0xfb07('0x11')][_0xfb07('0xa9')](util[_0xfb07('0x2e')](_0xfb07('0xc5'),_0xfb07('0x1bf'),_0x24a5ca['mailbox']));};AGIVertices['prototype'][_0xfb07('0x1c1')]=function(_0x52137f){logger['info'](util[_0xfb07('0x2e')](_0xfb07('0x1c2'),_0x52137f[_0xfb07('0x3b')]));if(!this[_0xfb07('0x82')](_0x52137f[_0xfb07('0x10e')])){return this['channel'][_0xfb07('0x30')](_0x52137f,'no\x20variable\x20selected');}var _0x199b6d=this['getVariable']['sync'](this,_0x52137f[_0xfb07('0x10e')]);if(!_0x199b6d){return this[_0xfb07('0x11')][_0xfb07('0x30')](_0x52137f,_0xfb07('0xd7'));}var _0x2cc9ed=this[_0xfb07('0x11')]['getVariable'](_0x199b6d);return{'code':0xc8,'result':_0x2cc9ed[_0xfb07('0xa4')]?_0x2cc9ed[_0xfb07('0xa4')]:'-'};};String[_0xfb07('0x17')][_0xfb07('0x1c3')]=function(_0x507d96,_0x8a42ad){return this['split'](_0x507d96)[_0xfb07('0x1c4')](_0x8a42ad);};module[_0xfb07('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d0a58df..6899731 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 _0x208d=['../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','catch','error','finally','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','message','stopAcw','getAgent','pauseType','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','acw','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment'];(function(_0x156e84,_0x337a89){var _0x322d5d=function(_0x2cc16b){while(--_0x2cc16b){_0x156e84['push'](_0x156e84['shift']());}};_0x322d5d(++_0x337a89);}(_0x208d,0xa4));var _0xd208=function(_0x438075,_0x59ca9e){_0x438075=_0x438075-0x0;var _0x3c2ff0=_0x208d[_0x438075];return _0x3c2ff0;};'use strict';var _=require(_0xd208('0x0'));var moment=require(_0xd208('0x1'));var ami=require(_0xd208('0x2'));var logger=require(_0xd208('0x3'))('acw');var RpcUser=require(_0xd208('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1c2598){this[_0xd208('0x5')]=_0x1c2598[_0xd208('0x5')];this[_0xd208('0x6')]=_0x1c2598[_0xd208('0x6')];this['timers']=_0x1c2598[_0xd208('0x7')];this[_0xd208('0x8')]={};ami['on'](_0xd208('0x9'),this['syncAgentConnect'][_0xd208('0xa')](this));ami['on'](_0xd208('0xb'),this['syncHangupRequest'][_0xd208('0xa')](this));ami['on'](_0xd208('0xc'),this['syncHangup'][_0xd208('0xa')](this));ami['on'](_0xd208('0xd'),this[_0xd208('0xe')][_0xd208('0xa')](this));ami['on']('attendedtransfer',this[_0xd208('0xf')][_0xd208('0xa')](this));ami['on']('blindtransfer',this[_0xd208('0x10')][_0xd208('0xa')](this));ami['on'](_0xd208('0x11'),this[_0xd208('0x12')][_0xd208('0xa')](this));}function getDiff(_0x38db76){var _0x3137d0=moment()['milliseconds'](0x0);var _0x5b9631=moment(_0x38db76)[_0xd208('0x13')](0x0);return _0x3137d0[_0xd208('0x14')](_0x5b9631,_0xd208('0x15'));}Acw[_0xd208('0x16')][_0xd208('0x17')]=function(_0x14e6c5,_0x48caac){var _0x21a27b=this;var _0x3d057a=getDiff(_0x21a27b['timers'][_0x14e6c5][_0xd208('0x18')]);clearTimeout(_0x21a27b['timers'][_0x14e6c5][_0xd208('0x19')]);_0x21a27b[_0xd208('0x7')][_0x14e6c5][_0xd208('0x19')]=![];return RpcVoiceAgentReport[_0xd208('0x1a')]({'acwtime':_0x3d057a},_0x21a27b[_0xd208('0x7')][_0x14e6c5][_0xd208('0x1b')],_0x14e6c5)[_0xd208('0x1c')](function(_0x292baa){logger[_0xd208('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x48caac,_0x3d057a,_0x292baa);})[_0xd208('0x1e')](function(_0x5f234e){logger[_0xd208('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x48caac,_0x5f234e);})[_0xd208('0x20')](function(){delete _0x21a27b[_0xd208('0x7')][_0x14e6c5];});};Acw[_0xd208('0x16')][_0xd208('0x21')]=function(_0x43f3a7){try{var _0x487a3b=this;var _0x4e2928=this[_0xd208('0x8')][_0x43f3a7]['interface'];var _0x2fca0b=this[_0xd208('0x8')][_0x43f3a7][_0xd208('0x22')];var _0x363e08=this[_0xd208('0x5')][_0x2fca0b];var _0x174297=![];var _0x514bb5=_0xd208('0x23');if(_0x363e08[_0xd208('0x24')]&&_0x363e08[_0xd208('0x25')][_0xd208('0x26')]){_0x174297=!![];_0x514bb5=_0x363e08[_0xd208('0x25')][_0xd208('0x26')];}if(!_0x487a3b['agents'][_0x4e2928]){return Promise['resolve']();}return RpcUser['getAgent'](_0x487a3b['agents'][_0x4e2928]['id'])[_0xd208('0x1c')](function(_0x4b29c0){if(!_0x4b29c0||_0x4b29c0['voicePause']){logger['info'](_0xd208('0x27'),_0x43f3a7,_0x4e2928,_0x2fca0b);return;}logger[_0xd208('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x43f3a7,_0x4e2928,_0x2fca0b);var _0x40b576=_0x487a3b['channels'][_0x43f3a7][_0xd208('0x28')]&&_0x487a3b[_0xd208('0x8')][_0x43f3a7][_0xd208('0x29')]?_0x487a3b[_0xd208('0x8')][_0x43f3a7][_0xd208('0x29')]:_0x43f3a7;return RpcUser[_0xd208('0x2a')](_0x487a3b[_0xd208('0x6')][_0x4e2928],_0x514bb5,_0x40b576);})[_0xd208('0x1c')](function(_0x290eec){if(_0x174297||!_0x290eec){return;}_0x487a3b['timers'][_0x4e2928]={};logger[_0xd208('0x1d')](_0xd208('0x2b'),_0x43f3a7,_0x487a3b[_0xd208('0x5')][_0x2fca0b]['acwTimeout'],_0x4e2928,_0x2fca0b);_0x487a3b[_0xd208('0x7')][_0x4e2928][_0xd208('0x19')]=setTimeout(_0x487a3b['stopAcw']['bind'](_0x487a3b,_0x4e2928),_0x487a3b[_0xd208('0x5')][_0x2fca0b][_0xd208('0x2c')]*0x3e8);_0x487a3b[_0xd208('0x7')][_0x4e2928]['lastPauseAt']=moment()[_0xd208('0x2d')](_0xd208('0x2e'));_0x487a3b[_0xd208('0x7')][_0x4e2928][_0xd208('0x1b')]=_0x43f3a7;_0x487a3b[_0xd208('0x7')][_0x4e2928]['queue']=_0x2fca0b;_0x487a3b['timers'][_0x4e2928][_0xd208('0x17')]=_0x487a3b[_0xd208('0x17')][_0xd208('0xa')](_0x487a3b,_0x4e2928,_0x43f3a7);})[_0xd208('0x1e')](function(){logger[_0xd208('0x1f')](_0xd208('0x2b'),_0x43f3a7,_0x487a3b[_0xd208('0x5')][_0x2fca0b][_0xd208('0x2c')],_0x4e2928,_0x2fca0b);})[_0xd208('0x20')](function(){delete _0x487a3b[_0xd208('0x8')][_0x43f3a7];});}catch(_0x19ab59){logger[_0xd208('0x1f')]('[ACW][START]\x20%s',_0x19ab59[_0xd208('0x2f')]);}};Acw[_0xd208('0x16')][_0xd208('0x30')]=function(_0xad319e){try{var _0x388128=this;if(_0x388128[_0xd208('0x7')][_0xad319e]){_0x388128[_0xd208('0x7')][_0xad319e][_0xd208('0x19')]=![];var _0x4617b4=_0x388128[_0xd208('0x7')][_0xad319e][_0xd208('0x1b')];var _0x5c0646=_0x388128[_0xd208('0x7')][_0xad319e][_0xd208('0x22')];var _0x208469=_0x388128['voiceQueues'][_0x5c0646]['acwTimeout'];logger[_0xd208('0x1d')]('[%s][TIMER][STOP][AGENT:%s]',_0x4617b4,_0xad319e);RpcUser[_0xd208('0x31')](this[_0xd208('0x6')][_0xad319e]['id'])[_0xd208('0x1c')](function(_0x104bf4){if(_0x104bf4[_0xd208('0x32')]===_0xd208('0x23')){return RpcUser['saveUnpause'](_0x388128[_0xd208('0x6')][_0xad319e]);}});RpcVoiceAgentReport[_0xd208('0x1a')]({'acwtime':_0x208469,'agentacw':!![]},_0x4617b4,_0xad319e)[_0xd208('0x1c')](function(_0x3d0c32){logger[_0xd208('0x1d')](_0xd208('0x33'),_0x4617b4,_0x208469,_0x3d0c32);})['catch'](function(_0x4df5eb){logger[_0xd208('0x1f')](_0xd208('0x34'),_0x4617b4,_0x4df5eb);});}else{logger[_0xd208('0x1f')](_0xd208('0x35'),_0xad319e);if(_0x388128[_0xd208('0x7')]){logger[_0xd208('0x1d')]('[ACW][TIMERS]',JSON[_0xd208('0x36')](_0x388128[_0xd208('0x7')]));}}}catch(_0x340f75){logger[_0xd208('0x1f')]('[ACW][STOP]\x20%s',_0x340f75[_0xd208('0x2f')]);}};Acw[_0xd208('0x16')][_0xd208('0x37')]=function(_0x5e05ad){try{if(this['voiceQueues'][_0x5e05ad[_0xd208('0x22')]]&&(this[_0xd208('0x5')][_0x5e05ad['queue']]['acw']||this[_0xd208('0x5')][_0x5e05ad[_0xd208('0x22')]]['mandatoryDisposition'])){if(this[_0xd208('0x6')][_0x5e05ad[_0xd208('0x38')]]){this['channels'][_0x5e05ad[_0xd208('0x1b')]]={'queue':_0x5e05ad['queue'],'interface':_0x5e05ad[_0xd208('0x38')],'destlinkedid':_0x5e05ad['destlinkedid']};}}}catch(_0x34febd){logger[_0xd208('0x1f')](_0xd208('0x39'),_0x34febd[_0xd208('0x2f')]);}};Acw[_0xd208('0x16')][_0xd208('0x12')]=function(_0x3bd269){try{if(this[_0xd208('0x5')][_0x3bd269[_0xd208('0x22')]]&&(this[_0xd208('0x5')][_0x3bd269[_0xd208('0x22')]][_0xd208('0x3a')]||this['voiceQueues'][_0x3bd269['queue']][_0xd208('0x24')])){if(this['agents'][_0x3bd269['interface']]){this['channels'][_0x3bd269[_0xd208('0x1b')]]={'queue':_0x3bd269[_0xd208('0x22')],'interface':_0x3bd269[_0xd208('0x38')]};}}}catch(_0x599f51){logger[_0xd208('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x599f51[_0xd208('0x2f')]);}};Acw[_0xd208('0x16')]['syncHangupRequest']=function(_0x1eea14){try{if(this[_0xd208('0x8')][_0x1eea14[_0xd208('0x1b')]]&&_[_0xd208('0x3b')](this[_0xd208('0x8')][_0x1eea14['uniqueid']]['attended'])){logger[_0xd208('0x1d')](_0xd208('0x3c'),_0x1eea14[_0xd208('0x1b')]);this[_0xd208('0x21')](_0x1eea14[_0xd208('0x1b')]);}else if(this[_0xd208('0x8')][_0x1eea14[_0xd208('0x3d')]]&&_['isUndefined'](this[_0xd208('0x8')][_0x1eea14[_0xd208('0x3d')]]['attended'])){logger[_0xd208('0x1d')](_0xd208('0x3e'),_0x1eea14['linkedid']);this[_0xd208('0x21')](_0x1eea14[_0xd208('0x3d')]);}}catch(_0x29a72b){logger[_0xd208('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x29a72b['message']);}};Acw[_0xd208('0x16')][_0xd208('0x3f')]=function(_0x34b5d8){try{if(this['channels'][_0x34b5d8[_0xd208('0x1b')]]&&this[_0xd208('0x8')][_0x34b5d8[_0xd208('0x1b')]][_0xd208('0x28')]){logger[_0xd208('0x1d')](_0xd208('0x40'),_0x34b5d8[_0xd208('0x1b')]);this[_0xd208('0x21')](_0x34b5d8[_0xd208('0x1b')]);}else if(this[_0xd208('0x8')][_0x34b5d8[_0xd208('0x3d')]]&&this[_0xd208('0x8')][_0x34b5d8[_0xd208('0x3d')]][_0xd208('0x28')]){logger[_0xd208('0x1d')](_0xd208('0x41'),_0x34b5d8[_0xd208('0x3d')]);this[_0xd208('0x21')](_0x34b5d8[_0xd208('0x3d')]);}}catch(_0x25780d){logger[_0xd208('0x1f')](_0xd208('0x42'),_0x25780d[_0xd208('0x2f')]);}};Acw['prototype'][_0xd208('0xf')]=function(_0x56472a){try{if(!_[_0xd208('0x43')](this[_0xd208('0x8')][_0x56472a[_0xd208('0x44')]])){this['startAcw'](_0x56472a[_0xd208('0x44')]);if(this['channels'][_0x56472a[_0xd208('0x45')]]){this[_0xd208('0x8')][_0x56472a['secondtransfereruniqueid']]['attended']=!![];this[_0xd208('0x8')][_0x56472a['transfertargetuniqueid']]=this[_0xd208('0x8')][_0x56472a[_0xd208('0x45')]];delete this['channels'][_0x56472a[_0xd208('0x45')]];}}else if(!_[_0xd208('0x43')](this[_0xd208('0x8')][_0x56472a['transfertargetuniqueid']])){this[_0xd208('0x21')](_0x56472a[_0xd208('0x46')]);if(this[_0xd208('0x8')][_0x56472a[_0xd208('0x47')]]){this['channels'][_0x56472a[_0xd208('0x47')]]['attended']=!![];this['channels'][_0x56472a[_0xd208('0x44')]]=this[_0xd208('0x8')][_0x56472a['origtransfereruniqueid']];delete this['channels'][_0x56472a['origtransfereruniqueid']];}}}catch(_0x1e4fb3){logger[_0xd208('0x1f')](_0xd208('0x48'),_0x1e4fb3[_0xd208('0x2f')]);}};Acw[_0xd208('0x16')]['syncBlindTransfer']=function(_0x564add){try{if(this[_0xd208('0x8')][_0x564add[_0xd208('0x49')]]){logger[_0xd208('0x1d')](_0xd208('0x4a'),JSON[_0xd208('0x36')](_0x564add[_0xd208('0x49')]));this['startAcw'](_0x564add['transfereruniqueid']);}else if(this['channels'][_0x564add[_0xd208('0x4b')]]){logger[_0xd208('0x1d')](_0xd208('0x4c'),JSON[_0xd208('0x36')](_0x564add[_0xd208('0x4b')]));this[_0xd208('0x21')](_0x564add[_0xd208('0x4b')]);}}catch(_0x2de67f){logger[_0xd208('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x2de67f[_0xd208('0x2f')]);}};Acw['prototype'][_0xd208('0xe')]=function(_0x255b2d){try{if(this[_0xd208('0x5')][_0x255b2d[_0xd208('0x22')]]&&this['voiceQueues'][_0x255b2d['queue']][_0xd208('0x4d')]===_0xd208('0x4e')){if(this[_0xd208('0x6')][_0x255b2d['interface']]){logger[_0xd208('0x1d')](_0xd208('0x4f'),_0x255b2d['uniqueid'],_0x255b2d[_0xd208('0x38')],_0x255b2d[_0xd208('0x22')]);return RpcUser[_0xd208('0x2a')](this['agents'][_0x255b2d['interface']],_0xd208('0x50'),_0x255b2d[_0xd208('0x1b')]);}}}catch(_0x4751b0){logger[_0xd208('0x1f')](_0xd208('0x51'),_0x4751b0[_0xd208('0x2f')]);}};module[_0xd208('0x52')]=Acw; \ No newline at end of file +var _0x85b0=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','then','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','ACW','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer'];(function(_0x28fb5d,_0x1d622c){var _0x423b88=function(_0x2a807d){while(--_0x2a807d){_0x28fb5d['push'](_0x28fb5d['shift']());}};_0x423b88(++_0x1d622c);}(_0x85b0,0x1ba));var _0x085b=function(_0x51990b,_0x3ea2c9){_0x51990b=_0x51990b-0x0;var _0xbdb9e7=_0x85b0[_0x51990b];return _0xbdb9e7;};'use strict';var _=require(_0x085b('0x0'));var moment=require(_0x085b('0x1'));var ami=require(_0x085b('0x2'));var logger=require(_0x085b('0x3'))(_0x085b('0x4'));var RpcUser=require(_0x085b('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x155762){this['voiceQueues']=_0x155762[_0x085b('0x6')];this['agents']=_0x155762[_0x085b('0x7')];this[_0x085b('0x8')]=_0x155762[_0x085b('0x8')];this['channels']={};ami['on'](_0x085b('0x9'),this[_0x085b('0xa')][_0x085b('0xb')](this));ami['on'](_0x085b('0xc'),this['syncHangupRequest'][_0x085b('0xb')](this));ami['on'](_0x085b('0xd'),this[_0x085b('0xe')][_0x085b('0xb')](this));ami['on'](_0x085b('0xf'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x085b('0x10'),this[_0x085b('0x11')][_0x085b('0xb')](this));ami['on'](_0x085b('0x12'),this[_0x085b('0x13')][_0x085b('0xb')](this));ami['on'](_0x085b('0x14'),this[_0x085b('0x15')][_0x085b('0xb')](this));}function getDiff(_0x58fc6e){var _0x5dea14=moment()[_0x085b('0x16')](0x0);var _0x2ba218=moment(_0x58fc6e)['milliseconds'](0x0);return _0x5dea14[_0x085b('0x17')](_0x2ba218,'seconds');}Acw[_0x085b('0x18')][_0x085b('0x19')]=function(_0x287656,_0x1159e9){var _0x3ba82b=this;var _0x9a3332=getDiff(_0x3ba82b[_0x085b('0x8')][_0x287656]['lastPauseAt']);clearTimeout(_0x3ba82b[_0x085b('0x8')][_0x287656]['timer']);_0x3ba82b[_0x085b('0x8')][_0x287656][_0x085b('0x1a')]=![];return RpcVoiceAgentReport[_0x085b('0x1b')]({'acwtime':_0x9a3332},_0x3ba82b[_0x085b('0x8')][_0x287656][_0x085b('0x1c')],_0x287656)['then'](function(_0x3dbd3a){logger['info'](_0x085b('0x1d'),_0x1159e9,_0x9a3332,_0x3dbd3a);})[_0x085b('0x1e')](function(_0x3ccceb){logger[_0x085b('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x1159e9,_0x3ccceb);})['finally'](function(){delete _0x3ba82b[_0x085b('0x8')][_0x287656];});};Acw[_0x085b('0x18')]['startAcw']=function(_0x5694c6){try{var _0xecacc=this;var _0x56d924=this[_0x085b('0x20')][_0x5694c6][_0x085b('0x21')];var _0x2fc8c9=this[_0x085b('0x20')][_0x5694c6][_0x085b('0x22')];var _0x26c914=this[_0x085b('0x6')][_0x2fc8c9];var _0xd15f5e=![];var _0x14f4b5='ACW';if(_0x26c914[_0x085b('0x23')]&&_0x26c914[_0x085b('0x24')]['name']){_0xd15f5e=!![];_0x14f4b5=_0x26c914[_0x085b('0x24')][_0x085b('0x25')];}if(!_0xecacc[_0x085b('0x7')][_0x56d924]){return Promise['resolve']();}return RpcUser[_0x085b('0x26')](_0xecacc[_0x085b('0x7')][_0x56d924]['id'])[_0x085b('0x27')](function(_0x4e44fa){if(!_0x4e44fa||_0x4e44fa[_0x085b('0x28')]){logger[_0x085b('0x29')](_0x085b('0x2a'),_0x5694c6,_0x56d924,_0x2fc8c9);return;}logger[_0x085b('0x29')](_0x085b('0x2b'),_0x5694c6,_0x56d924,_0x2fc8c9);var _0x33f9d7=_0xecacc[_0x085b('0x20')][_0x5694c6][_0x085b('0x2c')]&&_0xecacc[_0x085b('0x20')][_0x5694c6][_0x085b('0x2d')]?_0xecacc[_0x085b('0x20')][_0x5694c6][_0x085b('0x2d')]:_0x5694c6;return RpcUser[_0x085b('0x2e')](_0xecacc['agents'][_0x56d924],_0x14f4b5,_0x33f9d7)[_0x085b('0x27')](function(){_0xecacc[_0x085b('0x6')][_0x2fc8c9][_0x085b('0x2f')]-=0x1;_0xecacc[_0x085b('0x6')][_0x2fc8c9]['paused']+=0x1;});})[_0x085b('0x27')](function(_0x3f7e91){if(_0xd15f5e||!_0x3f7e91){return;}_0xecacc[_0x085b('0x8')][_0x56d924]={};logger[_0x085b('0x29')](_0x085b('0x30'),_0x5694c6,_0xecacc['voiceQueues'][_0x2fc8c9][_0x085b('0x31')],_0x56d924,_0x2fc8c9);_0xecacc[_0x085b('0x8')][_0x56d924][_0x085b('0x1a')]=setTimeout(_0xecacc[_0x085b('0x32')][_0x085b('0xb')](_0xecacc,_0x56d924),_0xecacc[_0x085b('0x6')][_0x2fc8c9][_0x085b('0x31')]*0x3e8);_0xecacc['timers'][_0x56d924][_0x085b('0x33')]=moment()[_0x085b('0x34')](_0x085b('0x35'));_0xecacc[_0x085b('0x8')][_0x56d924]['uniqueid']=_0x5694c6;_0xecacc[_0x085b('0x8')][_0x56d924][_0x085b('0x22')]=_0x2fc8c9;_0xecacc[_0x085b('0x8')][_0x56d924][_0x085b('0x19')]=_0xecacc['updateAcw'][_0x085b('0xb')](_0xecacc,_0x56d924,_0x5694c6);})[_0x085b('0x1e')](function(){logger['error'](_0x085b('0x30'),_0x5694c6,_0xecacc[_0x085b('0x6')][_0x2fc8c9][_0x085b('0x31')],_0x56d924,_0x2fc8c9);})[_0x085b('0x36')](function(){delete _0xecacc[_0x085b('0x20')][_0x5694c6];});}catch(_0x563292){logger[_0x085b('0x1f')](_0x085b('0x37'),_0x563292[_0x085b('0x38')]);}};Acw['prototype']['stopAcw']=function(_0x430314){try{var _0x2f4b21=this;if(_0x2f4b21[_0x085b('0x8')][_0x430314]){_0x2f4b21[_0x085b('0x8')][_0x430314][_0x085b('0x1a')]=![];var _0x58af43=_0x2f4b21[_0x085b('0x8')][_0x430314][_0x085b('0x1c')];var _0x1b8765=_0x2f4b21['timers'][_0x430314][_0x085b('0x22')];var _0x3a8e2d=_0x2f4b21[_0x085b('0x6')][_0x1b8765][_0x085b('0x31')];logger[_0x085b('0x29')](_0x085b('0x39'),_0x58af43,_0x430314);RpcUser[_0x085b('0x26')](this[_0x085b('0x7')][_0x430314]['id'])[_0x085b('0x27')](function(_0x4a2153){if(_0x4a2153[_0x085b('0x3a')]===_0x085b('0x3b')){return RpcUser[_0x085b('0x3c')](_0x2f4b21[_0x085b('0x7')][_0x430314]);}});RpcVoiceAgentReport[_0x085b('0x1b')]({'acwtime':_0x3a8e2d,'agentacw':!![]},_0x58af43,_0x430314)['then'](function(_0x30e810){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x58af43,_0x3a8e2d,_0x30e810);})['catch'](function(_0x4c0fcc){logger[_0x085b('0x1f')](_0x085b('0x3d'),_0x58af43,_0x4c0fcc);});}else{logger[_0x085b('0x1f')](_0x085b('0x3e'),_0x430314);if(_0x2f4b21[_0x085b('0x8')]){logger[_0x085b('0x29')](_0x085b('0x3f'),JSON[_0x085b('0x40')](_0x2f4b21[_0x085b('0x8')]));}}}catch(_0x19b78d){logger[_0x085b('0x1f')]('[ACW][STOP]\x20%s',_0x19b78d[_0x085b('0x38')]);}};Acw[_0x085b('0x18')][_0x085b('0xa')]=function(_0x1ce44a){try{if(this[_0x085b('0x6')][_0x1ce44a['queue']]&&(this[_0x085b('0x6')][_0x1ce44a[_0x085b('0x22')]][_0x085b('0x4')]||this[_0x085b('0x6')][_0x1ce44a[_0x085b('0x22')]][_0x085b('0x23')])){if(this[_0x085b('0x7')][_0x1ce44a[_0x085b('0x21')]]){this[_0x085b('0x20')][_0x1ce44a[_0x085b('0x1c')]]={'queue':_0x1ce44a['queue'],'interface':_0x1ce44a['interface'],'destlinkedid':_0x1ce44a['destlinkedid']};}}}catch(_0x4d04ce){logger['error'](_0x085b('0x41'),_0x4d04ce[_0x085b('0x38')]);}};Acw[_0x085b('0x18')][_0x085b('0x15')]=function(_0x2170ac){try{if(this['voiceQueues'][_0x2170ac[_0x085b('0x22')]]&&(this[_0x085b('0x6')][_0x2170ac[_0x085b('0x22')]][_0x085b('0x4')]||this['voiceQueues'][_0x2170ac['queue']][_0x085b('0x23')])){if(this['agents'][_0x2170ac['interface']]){this[_0x085b('0x20')][_0x2170ac[_0x085b('0x1c')]]={'queue':_0x2170ac[_0x085b('0x22')],'interface':_0x2170ac[_0x085b('0x21')]};}}}catch(_0x5248a5){logger[_0x085b('0x1f')](_0x085b('0x42'),_0x5248a5[_0x085b('0x38')]);}};Acw['prototype'][_0x085b('0x43')]=function(_0x2b49ce){try{if(this['channels'][_0x2b49ce[_0x085b('0x1c')]]&&_[_0x085b('0x44')](this[_0x085b('0x20')][_0x2b49ce[_0x085b('0x1c')]][_0x085b('0x2c')])){logger[_0x085b('0x29')]('[%s][HANGUP:UNIQUEID]',_0x2b49ce[_0x085b('0x1c')]);this[_0x085b('0x45')](_0x2b49ce[_0x085b('0x1c')]);}else if(this[_0x085b('0x20')][_0x2b49ce[_0x085b('0x46')]]&&_[_0x085b('0x44')](this['channels'][_0x2b49ce['linkedid']][_0x085b('0x2c')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x2b49ce[_0x085b('0x46')]);this[_0x085b('0x45')](_0x2b49ce['linkedid']);}}catch(_0x133ba8){logger['error'](_0x085b('0x47'),_0x133ba8['message']);}};Acw['prototype']['syncHangup']=function(_0x5df4a1){try{if(this[_0x085b('0x20')][_0x5df4a1[_0x085b('0x1c')]]&&this[_0x085b('0x20')][_0x5df4a1['uniqueid']][_0x085b('0x2c')]){logger['info'](_0x085b('0x48'),_0x5df4a1['uniqueid']);this[_0x085b('0x45')](_0x5df4a1[_0x085b('0x1c')]);}else if(this[_0x085b('0x20')][_0x5df4a1['linkedid']]&&this[_0x085b('0x20')][_0x5df4a1[_0x085b('0x46')]][_0x085b('0x2c')]){logger[_0x085b('0x29')](_0x085b('0x49'),_0x5df4a1[_0x085b('0x46')]);this[_0x085b('0x45')](_0x5df4a1[_0x085b('0x46')]);}}catch(_0x5e5264){logger[_0x085b('0x1f')](_0x085b('0x4a'),_0x5e5264[_0x085b('0x38')]);}};Acw['prototype'][_0x085b('0x11')]=function(_0x2ae844){try{if(!_[_0x085b('0x4b')](this[_0x085b('0x20')][_0x2ae844['transfereeuniqueid']])){this['startAcw'](_0x2ae844['transfereeuniqueid']);if(this[_0x085b('0x20')][_0x2ae844[_0x085b('0x4c')]]){this[_0x085b('0x20')][_0x2ae844['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x2ae844[_0x085b('0x4d')]]=this[_0x085b('0x20')][_0x2ae844[_0x085b('0x4c')]];delete this[_0x085b('0x20')][_0x2ae844[_0x085b('0x4c')]];}}else if(!_[_0x085b('0x4b')](this[_0x085b('0x20')][_0x2ae844[_0x085b('0x4d')]])){this[_0x085b('0x45')](_0x2ae844[_0x085b('0x4d')]);if(this['channels'][_0x2ae844['origtransfereruniqueid']]){this[_0x085b('0x20')][_0x2ae844[_0x085b('0x4e')]][_0x085b('0x2c')]=!![];this['channels'][_0x2ae844[_0x085b('0x4f')]]=this[_0x085b('0x20')][_0x2ae844[_0x085b('0x4e')]];delete this[_0x085b('0x20')][_0x2ae844['origtransfereruniqueid']];}}}catch(_0x13009f){logger['error'](_0x085b('0x50'),_0x13009f[_0x085b('0x38')]);}};Acw[_0x085b('0x18')][_0x085b('0x13')]=function(_0x41f2a5){try{if(this[_0x085b('0x20')][_0x41f2a5[_0x085b('0x51')]]){logger[_0x085b('0x29')](_0x085b('0x52'),JSON[_0x085b('0x40')](_0x41f2a5[_0x085b('0x51')]));this['startAcw'](_0x41f2a5['transfereruniqueid']);}else if(this[_0x085b('0x20')][_0x41f2a5['transfererlinkedid']]){logger[_0x085b('0x29')](_0x085b('0x53'),JSON[_0x085b('0x40')](_0x41f2a5[_0x085b('0x54')]));this[_0x085b('0x45')](_0x41f2a5[_0x085b('0x54')]);}}catch(_0x3cc993){logger[_0x085b('0x1f')](_0x085b('0x55'),_0x3cc993[_0x085b('0x38')]);}};Acw[_0x085b('0x18')][_0x085b('0x56')]=function(_0x2e64ac){try{if(this[_0x085b('0x6')][_0x2e64ac[_0x085b('0x22')]]&&this['voiceQueues'][_0x2e64ac[_0x085b('0x22')]][_0x085b('0x57')]===_0x085b('0x58')){if(this[_0x085b('0x7')][_0x2e64ac[_0x085b('0x21')]]){logger[_0x085b('0x29')](_0x085b('0x59'),_0x2e64ac[_0x085b('0x1c')],_0x2e64ac[_0x085b('0x21')],_0x2e64ac['queue']);return RpcUser[_0x085b('0x2e')](this[_0x085b('0x7')][_0x2e64ac['interface']],_0x085b('0x5a'),_0x2e64ac['uniqueid']);}}}catch(_0x4b01f5){logger[_0x085b('0x1f')](_0x085b('0x5b'),_0x4b01f5[_0x085b('0x38')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index dbdbf21..13c52fb 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 _0xdfd7=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','format','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary'];(function(_0x57c5fb,_0x323a28){var _0x48b094=function(_0x502523){while(--_0x502523){_0x57c5fb['push'](_0x57c5fb['shift']());}};_0x48b094(++_0x323a28);}(_0xdfd7,0xed));var _0x7dfd=function(_0x25bee6,_0x5089d2){_0x25bee6=_0x25bee6-0x0;var _0x47d51e=_0xdfd7[_0x25bee6];return _0x47d51e;};'use strict';var Manager=require(_0x7dfd('0x0'));var BPromise=require(_0x7dfd('0x1'));var util=require(_0x7dfd('0x2'));var logger=require('../../config/logger')(_0x7dfd('0x3'));var config=require(_0x7dfd('0x4'));var ami=new Manager(config[_0x7dfd('0x5')][_0x7dfd('0x6')],config['asterisk']['ip'],config[_0x7dfd('0x5')]['username'],config[_0x7dfd('0x5')][_0x7dfd('0x7')],!![]);ami[_0x7dfd('0x8')]();ami[_0x7dfd('0x9')]=BPromise[_0x7dfd('0xa')](ami[_0x7dfd('0xb')]);function error(_0xb2148){logger[_0x7dfd('0xc')](util['format'](_0x7dfd('0xd'),config[_0x7dfd('0x5')][_0x7dfd('0xe')],config[_0x7dfd('0x5')]['ip'],config[_0x7dfd('0x5')]['port'],util['inspect'](_0xb2148,![],null)));}function close(){logger['error'](util[_0x7dfd('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x7dfd('0x5')][_0x7dfd('0xe')],config['asterisk']['ip'],config[_0x7dfd('0x5')][_0x7dfd('0x6')]));}ami[_0x7dfd('0x10')]=function(){return function(){return ami[_0x7dfd('0x9')]({'action':_0x7dfd('0x11')});};};ami[_0x7dfd('0x12')]=function(){return function(){return ami[_0x7dfd('0x9')]({'action':'devicestatelist'});};};ami[_0x7dfd('0x13')]=function(){return function(){return ami[_0x7dfd('0x9')]({'action':'sippeerstatus'});};};ami[_0x7dfd('0x14')]=function(){return function(){return ami['Action']({'action':_0x7dfd('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x7dfd('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0x7dfd('0x16')](util[_0x7dfd('0xf')](_0x7dfd('0x17'),config['asterisk'][_0x7dfd('0xe')],config[_0x7dfd('0x5')]['ip'],config['asterisk'][_0x7dfd('0x6')]));ami[_0x7dfd('0x18')]('error',error);ami[_0x7dfd('0x18')](_0x7dfd('0x19'),close);}ami['on'](_0x7dfd('0x1a'),connect);ami['on']('shutdown',function(_0xad3fd0){logger[_0x7dfd('0x16')](util[_0x7dfd('0xf')](_0x7dfd('0x1b'),config[_0x7dfd('0x5')]['username'],config[_0x7dfd('0x5')]['ip'],config[_0x7dfd('0x5')][_0x7dfd('0x6')],util[_0x7dfd('0x1c')](_0xad3fd0,![],null)));});ami['on'](_0x7dfd('0x1d'),function(){logger[_0x7dfd('0x16')](util[_0x7dfd('0xf')](_0x7dfd('0x1e'),config['asterisk'][_0x7dfd('0xe')],config['asterisk']['ip'],config[_0x7dfd('0x5')][_0x7dfd('0x6')]));return Promise[_0x7dfd('0x1f')]()[_0x7dfd('0x20')](ami[_0x7dfd('0x10')]())[_0x7dfd('0x20')](ami[_0x7dfd('0x12')]())['then'](ami[_0x7dfd('0x13')]())[_0x7dfd('0x20')](ami[_0x7dfd('0x14')]())[_0x7dfd('0x20')](ami[_0x7dfd('0x21')]())[_0x7dfd('0x22')](function(_0x47f02c){logger[_0x7dfd('0xc')](_0x7dfd('0x23'),util[_0x7dfd('0x1c')](_0x47f02c,{'showHidden':![],'depth':null}));});});ami[_0x7dfd('0x18')](_0x7dfd('0xc'),error);ami[_0x7dfd('0x18')](_0x7dfd('0x19'),close);module[_0x7dfd('0x24')]=ami; \ No newline at end of file +var _0x2de8=['actionCoreShowChannels','coreshowchannels','info','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionQueueSummary','catch','[ami.js][fullybooted]','close','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','port','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x2de8,0x15f));var _0x82de=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x2de8[_0x82129b];return _0x2ae5dc;};'use strict';var Manager=require(_0x82de('0x0'));var BPromise=require(_0x82de('0x1'));var util=require(_0x82de('0x2'));var logger=require(_0x82de('0x3'))('ami');var config=require(_0x82de('0x4'));var ami=new Manager(config['asterisk']['port'],config[_0x82de('0x5')]['ip'],config[_0x82de('0x5')]['username'],config[_0x82de('0x5')][_0x82de('0x6')],!![]);ami[_0x82de('0x7')]();ami[_0x82de('0x8')]=BPromise[_0x82de('0x9')](ami[_0x82de('0xa')]);function error(_0x43ef84){logger[_0x82de('0xb')](util[_0x82de('0xc')](_0x82de('0xd'),config[_0x82de('0x5')]['username'],config[_0x82de('0x5')]['ip'],config['asterisk']['port'],util[_0x82de('0xe')](_0x43ef84,![],null)));}function close(){logger[_0x82de('0xb')](util[_0x82de('0xc')](_0x82de('0xf'),config['asterisk'][_0x82de('0x10')],config[_0x82de('0x5')]['ip'],config[_0x82de('0x5')][_0x82de('0x11')]));}ami[_0x82de('0x12')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x82de('0x13')]=function(){return function(){return ami['Action']({'action':_0x82de('0x14')});};};ami[_0x82de('0x15')]=function(){return function(){return ami['Action']({'action':_0x82de('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x82de('0x8')]({'action':'queuesummary'});};};ami[_0x82de('0x17')]=function(){return function(){return ami[_0x82de('0x8')]({'action':_0x82de('0x18')});};};function connect(){logger[_0x82de('0x19')](util[_0x82de('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x82de('0x5')][_0x82de('0x10')],config[_0x82de('0x5')]['ip'],config[_0x82de('0x5')][_0x82de('0x11')]));ami[_0x82de('0x1a')](_0x82de('0xb'),error);ami[_0x82de('0x1a')]('close',close);}ami['on']('connect',connect);ami['on'](_0x82de('0x1b'),function(_0x12ed96){logger[_0x82de('0x19')](util[_0x82de('0xc')](_0x82de('0x1c'),config['asterisk'][_0x82de('0x10')],config[_0x82de('0x5')]['ip'],config[_0x82de('0x5')][_0x82de('0x11')],util[_0x82de('0xe')](_0x12ed96,![],null)));});ami['on']('fullybooted',function(){logger[_0x82de('0x19')](util[_0x82de('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x82de('0x5')][_0x82de('0x10')],config[_0x82de('0x5')]['ip'],config['asterisk'][_0x82de('0x11')]));return Promise['resolve']()[_0x82de('0x1d')](ami[_0x82de('0x12')]())[_0x82de('0x1d')](ami[_0x82de('0x13')]())[_0x82de('0x1d')](ami[_0x82de('0x15')]())[_0x82de('0x1d')](ami[_0x82de('0x1e')]())[_0x82de('0x1d')](ami[_0x82de('0x17')]())[_0x82de('0x1f')](function(_0x21f23f){logger['error'](_0x82de('0x20'),util[_0x82de('0xe')](_0x21f23f,{'showHidden':![],'depth':null}));});});ami[_0x82de('0x1a')](_0x82de('0xb'),error);ami['once'](_0x82de('0x21'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 813af07..85ffef2 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x31f8f3,_0x39bee7){var _0x3f88ce=function(_0x1a5b3d){while(--_0x1a5b3d){_0x31f8f3['push'](_0x31f8f3['shift']());}};_0x3f88ce(++_0x39bee7);}(_0xaa88,0x137));var _0x8aa8=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xaa88[_0x28b0a4];return _0x105ce6;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x128a73,_0x26c676){var _0x210caa=function(_0x47ac0f){while(--_0x47ac0f){_0x128a73['push'](_0x128a73['shift']());}};_0x210caa(++_0x26c676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 52a7515..d96a54d 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 _0x3885=['syncCampaigns','undefined','resolve','checkIfTime','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','predictive','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','agiafterat','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','add','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','preview','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','emit','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','reason19\x20machine....','createStateFinal','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','queueSummaryCountersUpdated','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','user:%s','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','actionOriginate','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','object','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','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','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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]','Umin\x20=\x20','exports','uuid','moment','ioredis','./utils/hopper','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/hangup','127.0.0.1','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','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','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','then','content','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls'];(function(_0x133e1f,_0x4cd91e){var _0x4e5847=function(_0x4b8c62){while(--_0x4b8c62){_0x133e1f['push'](_0x133e1f['shift']());}};_0x4e5847(++_0x4cd91e);}(_0x3885,0x17f));var _0x5388=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3885[_0x4a9fb1];return _0x348672;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x5388('0x0'));var moment=require(_0x5388('0x1'));var rr=require('rr');var Redis=require(_0x5388('0x2'));var utils=require('./utils');var hopperUtils=require(_0x5388('0x3'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x5388('0x4'))('dialer');var loggerBooked=require(_0x5388('0x4'))(_0x5388('0x5'));var loggerPredictive=require(_0x5388('0x4'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x5388('0x6'));var loggerSyncQueueSummary=require(_0x5388('0x4'))(_0x5388('0x7'));var ami=require(_0x5388('0x8'));config[_0x5388('0x9')]=_[_0x5388('0xa')](config[_0x5388('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x5388('0xb'))(new Redis(config[_0x5388('0x9')]));var cmHopper=require(_0x5388('0xc'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x5388('0xd'));var Interval=require(_0x5388('0xe'));var Action=require(_0x5388('0xf'));var History=require(_0x5388('0x10'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x5388('0x11'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x5388('0x12');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5388('0x13')][_0x5388('0x14')]=function(_0x497589){this[_0x5388('0x15')]=this[_0x5388('0x15')]?this[_0x5388('0x15')]['finally'](_0x497589):_0x497589();};function Dialer(_0x4e45e5,_0x92667f){this[_0x5388('0x16')]=new Sequence();this['preview']=_0x92667f;this[_0x5388('0x17')]=_0x4e45e5[_0x5388('0x17')];this[_0x5388('0x18')]=_0x4e45e5[_0x5388('0x18')];this[_0x5388('0x19')]=_0x4e45e5[_0x5388('0x19')];this['trunks']=_0x4e45e5[_0x5388('0x1a')];this[_0x5388('0x1b')]=config[_0x5388('0x1b')]||0x2;this[_0x5388('0x1c')]={};this[_0x5388('0x1d')]={};this[_0x5388('0x1e')]={};this[_0x5388('0x1f')]={};this['optionPredictive']={};this[_0x5388('0x20')]={};this[_0x5388('0x21')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x5388('0x22')]={};this[_0x5388('0x23')]={};ami['on'](_0x5388('0x24'),this['syncAgentConnect'][_0x5388('0x25')](this));ami['on'](_0x5388('0x26'),this[_0x5388('0x27')][_0x5388('0x25')](this));ami['on'](_0x5388('0x28'),this[_0x5388('0x29')][_0x5388('0x25')](this));ami['on'](_0x5388('0x2a'),this[_0x5388('0x2b')][_0x5388('0x25')](this));ami['on']('custom:queuesummary',this[_0x5388('0x7')][_0x5388('0x25')](this));ami['on'](_0x5388('0x2c'),this[_0x5388('0x2d')][_0x5388('0x25')](this));ami['on'](_0x5388('0x2e'),this[_0x5388('0x2f')][_0x5388('0x25')](this));ami['on']('newexten',this[_0x5388('0x30')][_0x5388('0x25')](this));ami['on'](_0x5388('0x31'),this[_0x5388('0x32')]['bind'](this));ami['on']('queuemember',this[_0x5388('0x33')][_0x5388('0x25')](this));ami['on'](_0x5388('0x34'),this[_0x5388('0x35')]['bind'](this));this['loopCampaigns']();this[_0x5388('0x36')]();RpcSetting[_0x5388('0x37')]()['then'](function(_0x2688fa){previewRecallmeReminderInterval=_0x2688fa['previewRecallmeReminderInterval'];});}function isNotNull(_0x3a06ea){return _0x3a06ea!==null&&!_[_0x5388('0x38')](_0x3a06ea);}function msgResponse(_0x510c10,_0x4eda94,_0x1806da){return{'action':_0x510c10,'response':_0x4eda94,'message':_0x1806da,'stack':_0x1806da};}function emit(_0x2741a3,_0x4f2f6f,_0x5709d1){io['to'](_0x2741a3)['emit'](_0x4f2f6f,_0x5709d1);}function emitOutboundVoiceQueueSummary(_0x1c5f09){if(_0x1c5f09[_0x5388('0x39')]===_0x5388('0x3a')){logger[_0x5388('0x3b')](_0x5388('0x3c'),util[_0x5388('0x3d')](_0x1c5f09,{'showHidden':![],'depth':null}));emit(util[_0x5388('0x3e')](_0x5388('0x3f'),_0x1c5f09['name']),_0x5388('0x40'),_0x1c5f09);}}function checkGetDataPredictive(_0x14584a){if(isNotNull(_0x14584a)&&!_[_0x5388('0x41')](_0x14584a)){loggerPredictive[_0x5388('0x42')](_0x5388('0x43'));loggerPredictive[_0x5388('0x42')](_0x5388('0x44'),_0x14584a['predictiveIntervalTotalCalls']);loggerPredictive[_0x5388('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14584a[_0x5388('0x45')]);loggerPredictive[_0x5388('0x42')](_0x5388('0x46'),_0x14584a[_0x5388('0x47')]);loggerPredictive['info'](_0x5388('0x48'),_0x14584a['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5388('0x42')](_0x5388('0x49'),_0x14584a[_0x5388('0x4a')]);loggerPredictive['info'](_0x5388('0x4b'),_0x14584a[_0x5388('0x4c')]);loggerPredictive[_0x5388('0x42')](_0x5388('0x4d'));if(_0x14584a[_0x5388('0x4e')]>0x0){if(!_['isUndefined'](_0x14584a[_0x5388('0x4c')])&&_0x14584a['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x5388('0x42')](_0x5388('0x4f'));if(!_[_0x5388('0x38')](_0x14584a[_0x5388('0x4a')])&&_0x14584a[_0x5388('0x4a')]>0x0){return!![];}loggerPredictive[_0x5388('0x42')](_0x5388('0x50'));}else{loggerPredictive['info'](_0x5388('0x51'));}}else{loggerPredictive[_0x5388('0x42')](_0x5388('0x52'));}return![];}function mergeDataErlangB(_0x2e44db){return function(_0x43cf08){loggerPredictive['info'](_0x5388('0x53'));loggerPredictive[_0x5388('0x42')](_0x5388('0x54'),_0x43cf08[_0x5388('0x55')]);loggerPredictive[_0x5388('0x42')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43cf08[_0x5388('0x56')]);loggerPredictive[_0x5388('0x42')](_0x5388('0x57'),_0x43cf08[_0x5388('0x58')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43cf08[_0x5388('0x59')]);loggerPredictive[_0x5388('0x42')](_0x5388('0x57'),_0x43cf08[_0x5388('0x58')]);loggerPredictive[_0x5388('0x42')](_0x5388('0x4d'));_[_0x5388('0x5a')](_0x2e44db,_0x43cf08);};}function ifInterval(_0x534b5f,_0x5ad1de){if(_[_0x5388('0x38')](_0x5ad1de)){return![];}return utils[_0x5388('0x5b')](undefined,_0x5ad1de)<_0x534b5f*0x3c;}function clearPredictiveAttributes(_0x122f11){if(_0x122f11['startProgressive']){_0x122f11[_0x5388('0x21')]=undefined;loggerPredictive['debug'](_0x122f11[_0x5388('0x5c')],_0x5388('0x5d'));}if(_0x122f11[_0x5388('0x20')]){_0x122f11[_0x5388('0x20')]=undefined;loggerPredictive[_0x5388('0x3b')](_0x122f11['name'],_0x5388('0x5e'));}if(_0x122f11[_0x5388('0x5f')]){clearInterval(_0x122f11['handlePredictive']);_0x122f11[_0x5388('0x5f')]=undefined;loggerPredictive[_0x5388('0x3b')](_0x122f11['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x96d44c,_0x2da4dd){return function(_0x37e0ab){loggerPredictive['error'](_0x2da4dd[_0x5388('0x5c')],_0x96d44c);loggerPredictive[_0x5388('0x60')](_0x37e0ab[_0x5388('0x61')]);clearPredictiveAttributes(_0x2da4dd);};}function loggerCatch(_0x41d83b){return function(_0x7f9095){logger['error'](_0x41d83b,util[_0x5388('0x3d')](_0x7f9095,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x107fc5,_0x542e90,_0x1ab22d){return function(_0x30a865){utils[_0x5388('0x62')](_0x542e90,_0x1ab22d,0x0);_0x542e90[_0x5388('0x63')]=0x0;logger[_0x5388('0x60')](_0x107fc5,util[_0x5388('0x3d')](_0x30a865,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3b3e35){return function(_0x5c049f){if(isNotNull(_0x5c049f)&&isNotNull(_0x5c049f[0x0])){if(_0x5c049f[0x0]['contactsRescheduled']>0x0){_0x3b3e35[_0x5388('0x64')]=utils[_0x5388('0x65')]['CONTACTS_RESCHEDULED'];logger[_0x5388('0x42')](_0x5388('0x66')+_0x3b3e35[_0x5388('0x5c')],_0x5c049f[0x0][_0x5388('0x67')],'contacts');}else{_0x3b3e35['message']=utils['CAMPAIGN_STATUS'][_0x5388('0x68')];logger[_0x5388('0x42')](_0x5388('0x69')+_0x3b3e35[_0x5388('0x5c')]);}}};}function createObjHistory(_0x19fc4f,_0x24f6b2,_0x35004f,_0x19ef24,_0xadfa13){_0x19fc4f[_0x5388('0x64')]=_0x35004f;var _0x1e7c64=new Action(_0x19fc4f,_0x24f6b2);var _0x13b0a3=new History(_0x1e7c64);_0x13b0a3[_0x5388('0x6a')]=_0x19ef24;_0x13b0a3[_0x5388('0x6b')]=_0xadfa13;_0x13b0a3[_0x5388('0x6c')]=_0x1e7c64[_0x5388('0x6d')];return _0x13b0a3;}function unlockQueueStatus(_0x42fa29,_0x3345d7){setTimeout(function(){if(_[_0x5388('0x38')](_0x42fa29[_0x5388('0x6e')])){loggerBooked['error'](_0x5388('0x6f'),_0x3345d7);}_0x42fa29[_0x5388('0x6e')]=!![];loggerBooked[_0x5388('0x42')](_0x5388('0x70'),_0x3345d7,JSON[_0x5388('0x71')](_[_0x5388('0x72')](_0x42fa29,[_0x5388('0x5c'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4d1cf9){return function(){if(!isNotNull(_0x4d1cf9[_0x5388('0x73')])){_0x4d1cf9[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x74')];throw _0x4d1cf9[_0x5388('0x5c')]+_0x5388('0x75');}if(!isNotNull(_0x4d1cf9[_0x5388('0x73')]['Intervals'])){_0x4d1cf9['message']=utils['CAMPAIGN_STATUS'][_0x5388('0x74')];throw _0x4d1cf9[_0x5388('0x5c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x5388('0x41')](_0x4d1cf9[_0x5388('0x73')][_0x5388('0x76')]))){_0x4d1cf9[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x74')];throw _0x4d1cf9[_0x5388('0x5c')]+_0x5388('0x75');}};}function checkIsIVRCampaignActive(_0x5c395f){return function(){if(!utils['isIVRCampaignActive'](_0x5c395f)){_0x5c395f[_0x5388('0x64')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x5c395f[_0x5388('0x5c')]+_0x5388('0x77');}};}function emitCampaignSummary(_0x105633){if(utils[_0x5388('0x78')](_0x105633)){emit(util[_0x5388('0x3e')](_0x5388('0x79'),_0x105633[_0x5388('0x5c')]),_0x5388('0x7a'),_0x105633);}}function loggerCatchQueueSummary(_0x181397,_0x5b7b29){return function(_0x46eb6b){clearPredictiveAttributes(_0x5b7b29);emitCampaignSummary(_0x5b7b29);loggerSyncQueueSummary['debug'](_0x181397,util['inspect'](_0x46eb6b,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1b8a81){if(_0x1b8a81[_0x5388('0x7b')]){if(_0x1b8a81[_0x5388('0x7c')]===0x0){_0x1b8a81[_0x5388('0x7b')]=![];_0x1b8a81['message']=utils[_0x5388('0x65')][_0x5388('0x7d')];loggerSyncQueueSummary[_0x5388('0x3b')](_0x5388('0x7e'),_0x1b8a81['name'],'is\x20not\x20active');}else{_0x1b8a81[_0x5388('0x64')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x5388('0x3b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1b8a81[_0x5388('0x5c')],_0x5388('0x7f'));}emitCampaignSummary(_0x1b8a81);}}function myreject(_0x392473){return function(_0x1a8576){return _0x392473(msgResponse(_0x5388('0x80'),_0x5388('0x81'),JSON['stringify'](_0x1a8576)));};}Dialer[_0x5388('0x13')][_0x5388('0x82')]=function(_0x530b5){return!_[_0x5388('0x38')](_0x530b5)&&_0x530b5&&!_[_0x5388('0x38')](_0x530b5['name'])&&!_[_0x5388('0x38')](_0x530b5[_0x5388('0x83')])&&_0x530b5[_0x5388('0x83')]&&(this[_0x5388('0x1a')][util[_0x5388('0x3e')](_0x5388('0x84'),_0x530b5[_0x5388('0x5c')])]['status']===_0x5388('0x85')||this[_0x5388('0x1a')][util['format'](_0x5388('0x84'),_0x530b5[_0x5388('0x5c')])][_0x5388('0x86')]===_0x5388('0x87'));};Dialer[_0x5388('0x13')][_0x5388('0x88')]=function(_0x1ef4ab){var _0x29d48a=this;return function(){if(!_0x29d48a[_0x5388('0x82')](_0x1ef4ab[_0x5388('0x89')])){if(!_0x29d48a['isTrunkReachable'](_0x1ef4ab[_0x5388('0x8a')])){_0x1ef4ab[_0x5388('0x64')]=utils[_0x5388('0x65')]['TRUNK_NOT_REACHABLE'];throw _0x1ef4ab[_0x5388('0x5c')]+_0x5388('0x8b');}}};};Dialer[_0x5388('0x13')]['checkIfTime']=function(_0x2f70e3,_0x500cd2,_0x4a1478,_0x474335){var _0x36330e=this;return function(){var _0x1da15a=!![];return _0x36330e[_0x5388('0x8c')](_0x2f70e3,_0x500cd2,_0x4a1478,_0x474335,_0x1da15a);};};Dialer[_0x5388('0x13')][_0x5388('0x8d')]=function(_0x359b31,_0x26d292,_0xb5a0b1,_0x18b245){var _0x1cb52e=this;return function(){var _0x4a9d3a=![];return _0x1cb52e[_0x5388('0x8c')](_0x359b31[_0x5388('0x76')],_0x26d292,_0xb5a0b1,_0x18b245,_0x4a9d3a);};};Dialer['prototype'][_0x5388('0x8c')]=function(_0x1f6b7e,_0x33822,_0x3f8e45,_0x1e0b6f,_0x26709e){var _0x4ff9ef=[];return new Promise(function(_0x55fee1,_0x1a08d0){if(!isNotNull(_0x1f6b7e)){_0x1e0b6f[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x74')];return _0x1a08d0(msgResponse('ifTime',_0x5388('0x8e'),_0x3f8e45+_0x5388('0x8f')));}if(_[_0x5388('0x41')](_0x1f6b7e)){_0x1e0b6f[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x90')];return _0x1a08d0(msgResponse(_0x5388('0x91'),_0x5388('0x8e'),_0x3f8e45+_0x5388('0x92')));}if(_0x33822&&_[_0x5388('0x38')](config[_0x5388('0x93')][_0x33822])){_0x1e0b6f[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x94')];return _0x1a08d0(msgResponse(_0x5388('0x91'),_0x5388('0x8e'),_0x3f8e45+_0x5388('0x95')+_0x33822));}if(_[_0x5388('0x96')](_0x1f6b7e)){for(var _0x5d5358=0x0;_0x5d5358<_0x1f6b7e['length'];_0x5d5358+=0x1){_0x4ff9ef['push'](ami[_0x5388('0x97')]({'action':_0x5388('0x98'),'command':util[_0x5388('0x3e')](_0x5388('0x99'),_0x1f6b7e[_0x5d5358][_0x5388('0x9a')],!_[_0x5388('0x38')](config['timezones'][_0x33822])?_0x33822:'')})['then'](function(_0xe35cc7){return _0xe35cc7['content'][_0x5388('0x9b')](_0x5388('0x9c'))>=0x0;})[_0x5388('0x9d')](myreject(_0x1a08d0)));}}else{_0x4ff9ef['push'](ami[_0x5388('0x97')]({'action':_0x5388('0x98'),'command':util[_0x5388('0x3e')](_0x5388('0x99'),_0x1f6b7e,!_['isUndefined'](config[_0x5388('0x93')][_0x33822])?_0x33822:'')})[_0x5388('0x9e')](function(_0x2c6cec){return _0x2c6cec[_0x5388('0x9f')]['indexOf'](_0x5388('0x9c'))>=0x0;})[_0x5388('0x9d')](myreject(_0x1a08d0)));}Promise['all'](_0x4ff9ef)[_0x5388('0x9e')](function(_0x5308e0){var _0x976f15=_[_0x5388('0xa0')](_0x5308e0);if(_0x976f15){return _0x55fee1(_0x976f15);}else{_0x1e0b6f[_0x5388('0x64')]=_0x26709e?utils[_0x5388('0x65')][_0x5388('0xa1')]:utils['CAMPAIGN_STATUS'][_0x5388('0xa2')];return _0x1a08d0(msgResponse(_0x5388('0xa3'),_0x5388('0x8e'),_0x5388('0xa4')+_0x26709e+'\x20'+_0x3f8e45+_0x5388('0xa5')+util[_0x5388('0x3d')](_0x1f6b7e,{'showHidden':![],'depth':null})+_0x5388('0xa6')+_0x33822));}})[_0x5388('0x9d')](function(_0x37c61f){return _0x1a08d0(msgResponse(_0x5388('0x91'),'Failure',JSON[_0x5388('0x71')](_0x37c61f)));});});};Dialer[_0x5388('0x13')][_0x5388('0xa7')]=function(){var _0x301c1b=this;return cmHopper[_0x5388('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x5388('0x9e')](function(){setInterval(function(){_0x301c1b['syncCampaigns']();},0x3e8);});};Dialer[_0x5388('0x13')][_0x5388('0xa9')]=function(){var _0x37c0b9=this;var _0x21739b;for(var _0x283cc9 in this[_0x5388('0x18')]){if(typeof this[_0x5388('0x18')][_0x283cc9]!==_0x5388('0xaa')){_0x21739b=this['campaigns'][_0x283cc9];if(utils[_0x5388('0x78')](_0x21739b)&&utils['isIVRCampaignActive'](_0x21739b)){_0x21739b[_0x5388('0x7b')]=!![];Promise[_0x5388('0xab')]()[_0x5388('0x9e')](checkIsIVRCampaignActive(_0x21739b))[_0x5388('0x9e')](checkInterval(_0x21739b))['then'](_0x37c0b9[_0x5388('0x88')](_0x21739b))[_0x5388('0x9e')](_0x37c0b9[_0x5388('0xac')](_0x21739b[_0x5388('0xad')],_0x21739b['dialTimezone'],_0x21739b[_0x5388('0x5c')],_0x21739b))[_0x5388('0x9e')](_0x37c0b9[_0x5388('0x8d')](_0x21739b[_0x5388('0x73')],_0x21739b[_0x5388('0xae')],_0x21739b[_0x5388('0x5c')],_0x21739b))[_0x5388('0x9e')](_0x37c0b9['launchHandleIvr'](_0x21739b))['catch'](loggerCatchQueueSummary(_0x5388('0xaf'),_0x21739b));}else{notSendMessagesCampaign(_0x21739b);}}}};Dialer[_0x5388('0x13')][_0x5388('0xb0')]=function(_0x5cdbcb){if(_0x5cdbcb['dialMethod']!==_0x5388('0xb1')){clearPredictiveAttributes(_0x5cdbcb);}switch(_0x5cdbcb[_0x5388('0xb2')]){case _0x5388('0xb3'):this[_0x5388('0xb4')](_0x5cdbcb,0x1);break;case _0x5388('0xb5'):this['handlePower'](_0x5cdbcb,_0x5cdbcb[_0x5388('0xb6')]);break;case _0x5388('0xb1'):this[_0x5388('0xb1')](_0x5cdbcb);break;case _0x5388('0x5'):this[_0x5388('0xb4')](_0x5cdbcb,0x1);break;default:logger[_0x5388('0x60')](_0x5388('0xb7'),_0x5cdbcb[_0x5388('0x5c')],_0x5388('0xb8'));}};Dialer[_0x5388('0x13')]['ifTime']=function(_0x58bb50,_0x21af3e){var _0x4682e4=_0x58bb50[_0x5388('0xae')];var _0x1ba6d8=_0x21af3e?_0x58bb50[_0x5388('0xad')]:_0x58bb50[_0x5388('0x73')]['Intervals'];logger['silly'](_0x5388('0xb9'),_0x1ba6d8,_0x4682e4,_0x58bb50[_0x5388('0x5c')],util[_0x5388('0x3e')](_0x5388('0xba'),_0x58bb50[_0x5388('0x5c')],_0x58bb50['id']));var _0x223499=null;return Interval[_0x5388('0xbb')](_0x1ba6d8,_0x4682e4)[_0x5388('0x9e')](function(_0xc063b5){if(_0xc063b5===!![]){return _0xc063b5;}else{_0x58bb50[_0x5388('0x64')]=_0x21af3e?utils[_0x5388('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x5388('0x65')][_0x5388('0xa2')];_0x223499=msgResponse(_0x5388('0xa3'),_0x5388('0x8e'),_0x5388('0xa4')+_0x21af3e+'\x20'+_0x58bb50[_0x5388('0x5c')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1ba6d8,{'showHidden':![],'depth':null})+_0x5388('0xa6')+_0x4682e4);}if(_0x223499!==null){logger['silly'](_0x5388('0xbc'),_0x223499);_0x223499[_0x5388('0xbd')]=_0x21af3e;throw _0x223499;}})[_0x5388('0x9d')](function(_0x3b6bdd){logger['error'](_0x5388('0xbe'),_0x3b6bdd);throw msgResponse(_0x5388('0x80'),_0x5388('0x81'),util[_0x5388('0x3d')](_0x3b6bdd,{'showHidden':![],'depth':null}));});};Dialer[_0x5388('0x13')]['syncAgentConnect']=function(_0x798b5c){if(this[_0x5388('0x17')][_0x798b5c[_0x5388('0xbf')]]){if(this[_0x5388('0x1f')][_0x798b5c[_0x5388('0xc0')]]&&this[_0x5388('0x1f')][_0x798b5c[_0x5388('0xc0')]][_0x5388('0x39')]!=='ivr'){this['updateOriginated'](this[_0x5388('0x17')][_0x798b5c['queue']]);this[_0x5388('0x1f')][_0x798b5c[_0x5388('0xc0')]][_0x5388('0xc1')]=moment()[_0x5388('0x3e')](_0x5388('0xc2'));}}};Dialer[_0x5388('0x13')]['syncAgentComplete']=function(_0x9c565b){var _0x56757f=this[_0x5388('0x1f')][_0x9c565b['uniqueid']];if(this[_0x5388('0x17')][_0x9c565b[_0x5388('0xbf')]]){if(_0x56757f&&_0x56757f[_0x5388('0x39')]!==_0x5388('0xc3')){delete this[_0x5388('0x1f')][_0x9c565b[_0x5388('0xc0')]];this[_0x5388('0x17')][_0x9c565b[_0x5388('0xbf')]][_0x5388('0xc4')]+=0x1;var _0x256a8a=new AgentComplete(_0x56757f,_0x9c565b);if(_0x9c565b[_0x5388('0xc5')]==='agent'){_0x256a8a['agiafterat']=this['voiceQueues'][_0x9c565b[_0x5388('0xbf')]][_0x5388('0xc6')]&&this[_0x5388('0x17')][_0x9c565b[_0x5388('0xbf')]][_0x5388('0xc7')]?moment()[_0x5388('0x3e')](_0x5388('0xc2')):undefined;}hopperUtils[_0x5388('0xc8')](_0x256a8a)[_0x5388('0x9d')](loggerCatch(_0x5388('0xc9')));hopperUtils[_0x5388('0xca')](_0x256a8a)['catch'](loggerCatch(_0x5388('0xcb')));}}};Dialer[_0x5388('0x13')]['syncQueueCallerAbandon']=function(_0x5414d6){var _0x149514=this['uniqueId'][_0x5414d6[_0x5388('0xc0')]];var _0x2acdc8=this;var _0x1bdcfe=![];var _0x52e794;var _0x511a74;if(this[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]]){if(_0x149514&&_0x149514[_0x5388('0x39')]!==_0x5388('0xc3')){delete this[_0x5388('0x1f')][_0x5414d6[_0x5388('0xc0')]];this[_0x5388('0xcc')](this['voiceQueues'][_0x5414d6['queue']]);_0x149514[_0x5388('0xcd')]=moment()[_0x5388('0x3e')](_0x5388('0xc2'));var _0x14175d=new QueueCallerAbandon(_0x149514,_0x5414d6);if(utils[_0x5388('0x5b')](_0x149514[_0x5388('0xcd')],_0x149514[_0x5388('0xce')])>=_0x149514[_0x5388('0xcf')]){this['voiceQueues'][_0x5414d6['queue']][_0x5388('0x47')]+=0x1;this[_0x5388('0x17')][_0x5414d6['queue']][_0x5388('0xd0')]+=0x1;this[_0x5388('0x17')][_0x5414d6['queue']][_0x5388('0xd1')]+=0x1;_0x14175d[_0x5388('0x6a')]=0xa;_0x14175d[_0x5388('0x6b')]=_0x5388('0xd2');_0x14175d[_0x5388('0xd3')]='TIMEOUT';_0x14175d[_0x5388('0xd4')]=this[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]]['dialQueueProject2']?moment()['format'](_0x5388('0xc2')):undefined;_0x14175d[_0x5388('0xd5')]+=0x1;_0x14175d[_0x5388('0xd6')]+=0x1;_0x52e794=this['voiceQueues'][_0x5414d6[_0x5388('0xbf')]]['dialDropRetryFrequency'];_0x511a74=this[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xd7')];hopperUtils[_0x5388('0xd8')](_0x14175d,_0x14175d[_0x5388('0x6a')],_0x149514[_0x5388('0xd9')])['then'](function(_0x26745d){_0x1bdcfe=_0x26745d[_0x5388('0xda')]==0x1;if(_0x14175d[_0x5388('0xd5')]>=_0x2acdc8[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xdb')]){_0x2acdc8[_0x5388('0xdc')](_0x14175d,_0x26745d[_0x5388('0xda')]);}else{hopperUtils[_0x5388('0xdd')]({'active':![],'countdropretry':_0x14175d[_0x5388('0xd5')],'scheduledat':moment()['add'](_0x2acdc8[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xde')],_0x5388('0xdf'))[_0x5388('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x149514['ContactId'],'ListId':_0x149514[_0x5388('0xe0')],'VoiceQueueId':_0x149514[_0x5388('0xe1')]||undefined,'CampaignId':_0x149514[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0xe3')));var _0x5c8c26=new History(_0x14175d);_0x5c8c26[_0x5388('0x6a')]=0xa;_0x5c8c26[_0x5388('0x6b')]=_0x5388('0xd2');_0x5c8c26[_0x5388('0x6d')]=moment()[_0x5388('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c8c26[_0x5388('0x6c')]=_0x5c8c26[_0x5388('0x6d')];_0x5c8c26[_0x5388('0xe4')]=_0x14175d['calleridname'];_0x5c8c26[_0x5388('0xe5')]=_0x14175d['calleridnum'];hopperUtils[_0x5388('0xc8')](_0x5c8c26)[_0x5388('0x9d')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x5388('0x9e')](function(){if(_0x1bdcfe)hopperUtils['swapAdditionalPhones'](_0x14175d,_0x52e794,_0x511a74)[_0x5388('0x9e')](function(){return 0x1;});});}else{this[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xe6')]+=0x1;this[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xe7')]+=0x1;_0x14175d[_0x5388('0x6a')]=0xb;_0x14175d[_0x5388('0x6b')]=_0x5388('0xe8');_0x14175d[_0x5388('0xd3')]=_0x5388('0xe9');_0x14175d['countabandonedretry']+=0x1;_0x14175d[_0x5388('0xd6')]+=0x1;_0x52e794=this[_0x5388('0x17')][_0x5414d6['queue']][_0x5388('0xea')];_0x511a74=this['voiceQueues'][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xd7')];hopperUtils[_0x5388('0xd8')](_0x14175d,_0x14175d['state'],_0x149514[_0x5388('0xd9')])['then'](function(_0x589f33){if(_0x14175d[_0x5388('0xeb')]>=_0x2acdc8[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]]['dialAbandonedMaxRetry']){_0x2acdc8['queueCallerAbandonCreateState'](_0x14175d,_0x589f33[_0x5388('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x14175d[_0x5388('0xeb')],'scheduledat':moment()[_0x5388('0xec')](_0x2acdc8[_0x5388('0x17')][_0x5414d6[_0x5388('0xbf')]][_0x5388('0xea')],'minutes')[_0x5388('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x149514[_0x5388('0xed')],'ListId':_0x149514[_0x5388('0xe0')],'VoiceQueueId':_0x149514[_0x5388('0xe1')]||undefined,'CampaignId':_0x149514[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0xee')));var _0x2461df=new History(_0x14175d);_0x2461df[_0x5388('0x6a')]=0xb;_0x2461df[_0x5388('0x6b')]=_0x5388('0xe8');_0x2461df['starttime']=moment()[_0x5388('0x3e')](_0x5388('0xc2'));_0x2461df['endtime']=_0x2461df['starttime'];_0x2461df[_0x5388('0xe4')]=_0x14175d[_0x5388('0xe4')];_0x2461df[_0x5388('0xe5')]=_0x14175d[_0x5388('0xe5')];hopperUtils[_0x5388('0xc8')](_0x2461df)['catch'](loggerCatch(_0x5388('0xef')));}})[_0x5388('0x9e')](function(){if(_0x1bdcfe)hopperUtils['swapAdditionalPhones'](_0x14175d,_0x52e794,_0x511a74)[_0x5388('0x9e')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x4ca2a9){if(this[_0x5388('0x1d')][_0x4ca2a9[_0x5388('0xc0')]]){this['actions'][_0x4ca2a9[_0x5388('0xc0')]]['channel']=_0x4ca2a9[_0x5388('0xf0')];}if(this['uniqueId'][_0x4ca2a9[_0x5388('0xc0')]]){this[_0x5388('0x1f')][_0x4ca2a9[_0x5388('0xc0')]]['channel']=_0x4ca2a9[_0x5388('0xf0')];}};Dialer[_0x5388('0x13')][_0x5388('0x33')]=function(_0x152cc5){if(!this[_0x5388('0x1d')][_0x152cc5['actionid']]){return;}var _0x4d8209=this[_0x5388('0x17')][this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xbf')]][_0x5388('0xf2')]||'rrmemory';if(_0x4d8209===_0x5388('0xf3')){if(this['actions'][_0x152cc5[_0x5388('0xf1')]]&&_[_0x5388('0xf4')](this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xf5')])&&_0x152cc5[_0x5388('0x86')]==='1'&&_0x152cc5[_0x5388('0xf6')]==='0'){if(this['agents'][_0x152cc5['stateinterface']]){if(!this['agents'][_0x152cc5['stateinterface']][_0x5388('0xf5')]){this['agents'][_0x152cc5[_0x5388('0xf7')]][_0x5388('0xf5')]=!![];this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xf5')]=!![];this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]]['stateinterface']=_0x152cc5[_0x5388('0xf7')];}}}}else if(_0x4d8209===_0x5388('0xf8')){if(this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]]){if(this['agents'][_0x152cc5['stateinterface']]){this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xf7')]=_0x152cc5[_0x5388('0xf7')];if(_[_0x5388('0xf4')](this[_0x5388('0xf9')][this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xbf')]])){this[_0x5388('0xf9')][this[_0x5388('0x1d')][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xbf')]]=[];}this['queueBooked'][this['actions'][_0x152cc5[_0x5388('0xf1')]][_0x5388('0xbf')]][_0x5388('0xfa')](_[_0x5388('0x5a')](_[_0x5388('0x72')](this['actions'][_0x152cc5['actionid']],[_0x5388('0xfb'),'stateinterface']),{'status':_0x152cc5['status'],'paused':_0x152cc5[_0x5388('0xf6')]}));}}}};Dialer[_0x5388('0x13')]['syncQueueStatusComplete']=function(_0x3dfdff){if(!this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]]){return;}var _0x213f4c=this;var _0x40c2ca=this[_0x5388('0x17')][this['actions'][_0x3dfdff[_0x5388('0xf1')]]['queue']];var _0x734cd9=_0x40c2ca[_0x5388('0xf2')]||_0x5388('0xf8');if(_0x734cd9==='roundrobin'){if(this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]]&&this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xf7')]){this['preview'][_0x5388('0xfc')](this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xfb')],this[_0x5388('0x1d')][_0x3dfdff['actionid']][_0x5388('0xf7')])[_0x5388('0x9d')](function(_0x3c294b){logger[_0x5388('0x60')](_0x5388('0xfd'),util[_0x5388('0x3d')](_0x3c294b,{'showHidden':![],'depth':null}));})[_0x5388('0xfe')](function(){_0x213f4c[_0x5388('0xcc')](_0x213f4c[_0x5388('0x17')][_0x213f4c[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]]);_0x213f4c['agents'][_0x213f4c[_0x5388('0x1d')][_0x3dfdff['actionid']][_0x5388('0xf7')]][_0x5388('0xf5')]=![];delete _0x213f4c[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]];unlockQueueStatus(_0x40c2ca);});}else{this[_0x5388('0xcc')](this[_0x5388('0x17')][this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]]);hopperUtils[_0x5388('0xdd')]({'active':![],'ContactId':this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xed')],'ListId':this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xe0')],'VoiceQueueId':this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0xff')));delete this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]];unlockQueueStatus(_0x40c2ca);}}else if(_0x734cd9==='rrmemory'){var _0x4d6f0a;if(this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]]&&!_[_0x5388('0x41')](this['queueBooked'][this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]])){if(this[_0x5388('0x22')][_0x213f4c[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]]['queue']]){this[_0x5388('0x22')][_0x213f4c[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]]=this[_0x5388('0x22')][this['actions'][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]]?this['queueBookedRR'][this['actions'][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]]:this[_0x5388('0xf9')][this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]]?this[_0x5388('0xf9')][this[_0x5388('0x1d')][_0x3dfdff['actionid']][_0x5388('0xbf')]][_0x5388('0x100')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x3dfdff['actionid']][_0x5388('0xbf')]][_0x5388('0x100')]=this[_0x5388('0x22')][this[_0x5388('0x1d')][_0x3dfdff[_0x5388('0xf1')]][_0x5388('0xbf')]];for(var _0x120795=0x0;_0x120795=_0x1818ae[_0x5388('0x125')]){_0x2e3bd2[_0x5388('0x126')](_0x478393,_0x39cfd2,_0x5aa072,'reason19\x20machine....');}else{if(_0x478393[_0x5388('0x123')]>=_0x1818ae[_0x5388('0x127')]){_0x2e3bd2['createStateFinal'](_0x478393,_0x39cfd2,_0x5aa072,_0x5388('0x128'));}else{hopperUtils[_0x5388('0xdd')]({'active':![],'countmachineretry':_0x478393['countmachineretry'],'scheduledat':moment()[_0x5388('0xec')](_0x1818ae[_0x5388('0x129')],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x478393[_0x5388('0xed')],'ListId':_0x478393['ListId'],'VoiceQueueId':_0x478393[_0x5388('0xe1')]||undefined,'CampaignId':_0x478393[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0x12a')));_0x39cfd2({'reschedule':0x1});}}});}if(_0x326b3a[_0x5388('0x39')]===_0x5388('0xc3')&&this[_0x5388('0x18')][_0x326b3a[_0x5388('0xbf')]]['dialAMDActive']&&_0x59efe2[_0x5388('0x114')]===_0x5388('0x115')){delete this['uniqueId'][_0x59efe2['uniqueid']];this[_0x5388('0xcc')](this[_0x5388('0x18')][_0x326b3a[_0x5388('0xbf')]]);_0x371d9f=new Hangup(_0x326b3a,_0x59efe2);_0x371d9f[_0x5388('0x6a')]=0x12;_0x371d9f[_0x5388('0x6b')]=_0x5388('0x12b');_0x371d9f[_0x5388('0x117')]=_0x5388('0x118');ami[_0x5388('0x119')](_0x5388('0x11a'),ut[_0x5388('0x11b')](_0x371d9f,_0x5388('0x12c')));this[_0x5388('0x11c')](_0x371d9f,_0x5388('0x12d'),_0x5388('0x12e'));}if(_0x326b3a['type']==='ivr'&&this[_0x5388('0x18')][_0x326b3a['queue']][_0x5388('0x113')]&&_0x59efe2['value']===_0x5388('0x11f')){return new Promise(function(_0xaf0d9f,_0x1cbdbe){delete _0x2e3bd2[_0x5388('0x1f')][_0x59efe2['uniqueid']];_0x2e3bd2[_0x5388('0xcc')](_0x2e3bd2[_0x5388('0x18')][_0x326b3a['queue']]);_0x2e3bd2[_0x5388('0x18')][_0x326b3a[_0x5388('0xbf')]]['outboundAnswerCallsDay']+=0x1;_0x2e3bd2['campaigns'][_0x326b3a['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5cb63a=_0x2e3bd2[_0x5388('0x18')][_0x326b3a['queue']];var _0x50d889=new Hangup(_0x326b3a,_0x59efe2);_0x50d889[_0x5388('0x6a')]=0x13;_0x50d889[_0x5388('0x6b')]=_0x5388('0x12f');_0x50d889[_0x5388('0x117')]=_0x5388('0x118');_0x50d889[_0x5388('0x123')]+=0x1;_0x50d889[_0x5388('0xd6')]+=0x1;_0x50d889[_0x5388('0x12c')]=!![];ami[_0x5388('0x119')](_0x5388('0x11a'),ut[_0x5388('0x11b')](_0x50d889,'amd'));hopperUtils[_0x5388('0xc8')](_0x50d889)[_0x5388('0x9d')](loggerCatch(_0x5388('0x130')));if(_0x50d889[_0x5388('0x131')]+_0x50d889[_0x5388('0x120')]+_0x50d889[_0x5388('0x121')]+_0x50d889['countnosuchnumberretry']+_0x50d889[_0x5388('0xd5')]+_0x50d889[_0x5388('0xeb')]+_0x50d889[_0x5388('0x123')]+_0x50d889[_0x5388('0x124')]>=_0x5cb63a['dialGlobalMaxRetry']){_0x2e3bd2['stateGlobal'](_0x50d889,_0xaf0d9f,_0x1cbdbe,_0x5388('0x132'));}else{if(_0x50d889[_0x5388('0x123')]>=_0x5cb63a[_0x5388('0x127')]){_0x2e3bd2[_0x5388('0x133')](_0x50d889,_0xaf0d9f,_0x1cbdbe,_0x5388('0x128'));}else{hopperUtils[_0x5388('0xdd')]({'active':![],'countmachineretry':_0x50d889[_0x5388('0x123')],'scheduledat':moment()['add'](_0x5cb63a[_0x5388('0x129')],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x50d889[_0x5388('0xed')],'ListId':_0x50d889[_0x5388('0xe0')],'VoiceQueueId':_0x50d889[_0x5388('0xe1')]||undefined,'CampaignId':_0x50d889[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch('[rescheduleContact][Machine]'));_0xaf0d9f({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x5388('0x2f')]=function(_0x4620d1){var _0x5097de=this[_0x5388('0x1f')][_0x4620d1[_0x5388('0xc0')]];var _0x52b4ab;if(_0x5097de&&_0x5097de[_0x5388('0x39')]===_0x5388('0xc3')){delete this[_0x5388('0x1f')][_0x4620d1[_0x5388('0xc0')]];this[_0x5388('0xcc')](this[_0x5388('0x18')][_0x5097de['queue']]);this[_0x5388('0x18')][_0x5097de['queue']]['ivrAnswerCallsDay']+=0x1;_0x52b4ab=new Hangup(_0x5097de,_0x4620d1);hopperUtils[_0x5388('0xc8')](_0x52b4ab)['catch'](loggerCatch(_0x5388('0x134')));hopperUtils[_0x5388('0xca')](_0x52b4ab)[_0x5388('0x9d')](loggerCatch(_0x5388('0x135')));}if(_0x5097de&&_0x5097de[_0x5388('0x39')]!==_0x5388('0xc3')&&isNotNull(this[_0x5388('0x17')][_0x5097de[_0x5388('0xbf')]][_0x5388('0x136')])){delete this[_0x5388('0x1f')][_0x4620d1[_0x5388('0xc0')]];this[_0x5388('0xcc')](this['voiceQueues'][_0x5097de[_0x5388('0xbf')]]);this[_0x5388('0x17')][_0x5097de['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x5097de[_0x5388('0xbf')]][_0x5388('0x116')]+=0x1;_0x52b4ab=new Hangup(_0x5097de,_0x4620d1);_0x52b4ab[_0x5388('0x6a')]=0x10;_0x52b4ab[_0x5388('0x6b')]='AnswerAGI';_0x52b4ab[_0x5388('0x117')]=_0x5388('0x137');hopperUtils[_0x5388('0xc8')](_0x52b4ab)[_0x5388('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x5388('0xca')](_0x52b4ab)[_0x5388('0x9d')](loggerCatch(_0x5388('0x135')));}if(_0x5097de&&_0x5097de[_0x5388('0x39')]!==_0x5388('0xc3')&&!isNotNull(this[_0x5388('0x17')][_0x5097de[_0x5388('0xbf')]]['dialQueueProject'])){delete this[_0x5388('0x1f')][_0x4620d1['uniqueid']];this[_0x5388('0xcc')](this[_0x5388('0x17')][_0x5097de[_0x5388('0xbf')]]);this['voiceQueues'][_0x5097de['queue']][_0x5388('0x138')]+=0x1;_0x52b4ab=new Hangup(_0x5097de,_0x4620d1);_0x52b4ab[_0x5388('0x6a')]=0xc;_0x52b4ab[_0x5388('0x6b')]=_0x4620d1[_0x5388('0x139')];_0x52b4ab['membername']='Unknow';hopperUtils[_0x5388('0xc8')](_0x52b4ab)['catch'](loggerCatch(_0x5388('0x134')));hopperUtils[_0x5388('0xca')](_0x52b4ab)[_0x5388('0x9d')](loggerCatch(_0x5388('0x135')));}};Dialer[_0x5388('0x13')]['syncQueueSummary']=function(_0x40513f){var _0x3a6bcd=this;if(!_0x3a6bcd['queuesSummary'][_0x40513f[_0x5388('0x5c')]]){_0x3a6bcd[_0x5388('0x23')][_0x40513f[_0x5388('0x5c')]]={'running':![]};}else if(_0x3a6bcd[_0x5388('0x23')][_0x40513f[_0x5388('0x5c')]][_0x5388('0x13a')]===!![]){return;}else if(_0x3a6bcd['queuesSummary'][_0x40513f['name']][_0x5388('0x13a')]===![]){_0x3a6bcd['queuesSummary'][_0x40513f[_0x5388('0x5c')]][_0x5388('0x13a')]=!![];}var _0x5b1864=_0x3a6bcd[_0x5388('0x17')][_0x40513f[_0x5388('0x5c')]];var _0x21d54e=_0x5b1864[_0x5388('0x64')]!==utils['CAMPAIGN_STATUS'][_0x5388('0x7d')];var _0x91ff7a=utils[_0x5388('0x13b')](_0x5b1864);_0x5b1864[_0x5388('0x13c')]=utils['getQueueCampaignStatusMessage'](_0x5b1864,_0x3a6bcd['trunks']);Promise['resolve']()[_0x5388('0x9e')](function(){if(_0x5b1864[_0x5388('0x13c')]===utils[_0x5388('0x65')][_0x5388('0x7d')]){if(_0x21d54e){clearPredictiveAttributes(_0x5b1864);_0x40513f[_0x5388('0x20')]=undefined;_0x40513f[_0x5388('0x21')]=undefined;}if(_0x5b1864[_0x5388('0x13c')]===utils['CAMPAIGN_STATUS'][_0x5388('0x7d')]){_0x40513f[_0x5388('0x13d')]=0x0;_0x40513f[_0x5388('0xf6')]=0x0;_0x40513f[_0x5388('0x13e')]=0x0;_0x40513f[_0x5388('0x13f')]=0x0;_0x40513f[_0x5388('0x140')]=0x0;}}else if(_0x5b1864['statusMessage']===utils[_0x5388('0x65')]['ACTIVE']&&!_0x91ff7a){return _0x3a6bcd[_0x5388('0x91')](_0x5b1864,!![])['then'](function(){return _0x3a6bcd[_0x5388('0x91')](_0x5b1864,![]);})[_0x5388('0x9e')](function(){return _0x3a6bcd[_0x5388('0xb0')](_0x5b1864);})[_0x5388('0x9d')](function(_0x4c090e){loggerSyncQueueSummary[_0x5388('0x3b')]('[syncQueueSummary]',util[_0x5388('0x3d')](_0x4c090e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5b1864);});}else{clearPredictiveAttributes(_0x5b1864);}})[_0x5388('0x9e')](function(){var _0x43d0ba=_0x40513f['compareToOutboundQueue'](_0x5b1864);if(_0x43d0ba||_0x5b1864[_0x5388('0x141')]){_0x5b1864[_0x5388('0x141')]=![];_0x40513f['updateReportFromOutboundQueue'](_0x5b1864);Object['assign'](_0x5b1864,_0x40513f);emitOutboundVoiceQueueSummary(_0x40513f);}_0x3a6bcd['queuesSummary'][_0x5b1864['name']]['running']=![];})[_0x5388('0x9d')](function(_0x275d1e){logger[_0x5388('0x60')]('[syncQueueSummary]',util[_0x5388('0x3d')](_0x275d1e,{'showHidden':![],'depth':null}));_0x3a6bcd[_0x5388('0x23')][_0x5b1864['name']][_0x5388('0x13a')]=![];});};Dialer['prototype'][_0x5388('0x2d')]=_[_0x5388('0x142')](function(){var _0x32c221=_['filter'](this[_0x5388('0x17')],function(_0x349094){return _0x349094[_0x5388('0x143')];});var _0x5e19b0=_[_0x5388('0x144')](this[_0x5388('0x19')],function(_0x2189e8){return _0x2189e8[_0x5388('0x145')]&&_0x2189e8[_0x5388('0x86')]==='reachable';});if(_0x32c221[_0x5388('0x101')]>0x0&&_0x5e19b0[_0x5388('0x101')]>0x0){return Promise[_0x5388('0xab')]()[_0x5388('0x9e')](cmHopper[_0x5388('0x146')](_[_0x5388('0x147')](_0x32c221,'id'),previewRecallmeReminderInterval,_[_0x5388('0x147')](_0x5e19b0,'id')))['then'](function(_0x27446b){for(var _0x343e99=0x0;_0x343e99<_0x27446b[_0x5388('0x101')];_0x343e99++){var _0x2e3e0d=_0x27446b[_0x343e99]['Agent'][_0x5388('0x5c')];if(_0x2e3e0d)io['to'](util[_0x5388('0x3e')](_0x5388('0x148'),_0x2e3e0d))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x27446b[_0x343e99]});}})[_0x5388('0x9d')](function(_0x46e54b){logger['error'](_0x5388('0x149'),_0x46e54b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5388('0x13')][_0x5388('0x36')]=function(){var _0xe6139d=this;setInterval(function(){_0xe6139d['clearZombieChannels'](_0xe6139d[_0x5388('0x1f')],_0x5388('0x14a'));_0xe6139d[_0x5388('0x14b')](_0xe6139d['actions'],'[actions]');},0x32c8);};Dialer[_0x5388('0x13')]['clearZombieChannels']=function(_0x1ce32a,_0x15f178){var _0x126cfd=this;for(var _0x5f026c in _0x1ce32a){if(typeof _0x1ce32a[_0x5f026c]!==_0x5388('0xaa')){this[_0x5388('0x16')]['enqueue'](function(){if(!_[_0x5388('0xf4')](_0x1ce32a[_0x5f026c])){return ami[_0x5388('0x97')]({'action':_0x5388('0x86'),'channel':_0x1ce32a[_0x5f026c][_0x5388('0xf0')]})[_0x5388('0x9d')](function(_0x4e1c5a){if(_0x4e1c5a['message']===_0x5388('0x14c')){setTimeout(function(){if(_0x1ce32a[_0x5f026c]&&_0x1ce32a[_0x5f026c][_0x5388('0x39')]!==_0x5388('0xc3')){_0x126cfd[_0x5388('0xcc')](_0x126cfd[_0x5388('0x17')][_0x1ce32a[_0x5f026c][_0x5388('0xbf')]]);logger[_0x5388('0x60')](_0x5388('0x14d'),_0x15f178,_0x5f026c,_0x1ce32a[_0x5f026c][_0x5388('0xbf')]);delete _0x1ce32a[_0x5f026c];}if(_0x1ce32a[_0x5f026c]&&_0x1ce32a[_0x5f026c][_0x5388('0x39')]===_0x5388('0xc3')){_0x126cfd[_0x5388('0xcc')](_0x126cfd[_0x5388('0x18')][_0x1ce32a[_0x5f026c][_0x5388('0xbf')]]);logger['error'](_0x5388('0x14e'),_0x15f178,_0x5f026c,_0x1ce32a[_0x5f026c][_0x5388('0xbf')]);delete _0x1ce32a[_0x5f026c];}},0x2328);}});}});}}};Dialer['prototype'][_0x5388('0x14f')]=function(_0x4ad45b){return Promise[_0x5388('0xab')]()[_0x5388('0x9e')](voiceQueueRt[_0x5388('0x14f')](_0x4ad45b))[_0x5388('0x9d')](loggerCatch(_0x5388('0x150')));};Dialer[_0x5388('0x13')][_0x5388('0xcc')]=function(_0x3dba16){if(!_[_0x5388('0x38')](_0x3dba16)&&_0x3dba16!==null){if(typeof _0x3dba16[_0x5388('0x7c')]!==_0x5388('0xaa')){if(_0x3dba16[_0x5388('0x7c')]>0x0){_0x3dba16['originated']-=0x1;}else{logger[_0x5388('0x60')](_0x5388('0x151'));}}}else{logger[_0x5388('0x60')](_0x5388('0x152'));}};Dialer['prototype'][_0x5388('0x153')]=function(_0x195909,_0x4f2bd3){var _0x3dd30c=this;return function(_0x8db37){_0x3dd30c[_0x5388('0xcc')](_0x4f2bd3);logger[_0x5388('0x60')](_0x195909,util['inspect'](_0x8db37,{'showHidden':![],'depth':null}));};};Dialer[_0x5388('0x13')]['emptyContact']=function(_0x8f95ea,_0x43898f,_0x751064){var _0x23364d={'state':0x19,'statedesc':_0x5388('0x154')};this[_0x5388('0xcc')](_0x43898f);this[_0x5388('0x11c')](_[_0x5388('0x5a')](_0x23364d,_[_0x5388('0x72')](_0x751064,[_0x5388('0xed'),_0x5388('0xe0'),_0x5388('0x155'),_0x5388('0xe1'),_0x5388('0xe2')])),_0x5388('0x156'),_0x5388('0x157'));logger[_0x5388('0x60')](_0x8f95ea);};Dialer[_0x5388('0x13')]['saveInDb']=function(_0x2ceb27,_0x4c76f5,_0x3e10f3){hopperUtils['createHistory'](_0x2ceb27)[_0x5388('0x9d')](loggerCatch(_0x4c76f5));hopperUtils[_0x5388('0xca')](_0x2ceb27)[_0x5388('0x9d')](loggerCatch(_0x3e10f3));};Dialer[_0x5388('0x13')][_0x5388('0xdc')]=function(_0x3f8f73,_0x30565f){hopperUtils[_0x5388('0xc8')](_0x3f8f73)[_0x5388('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x30565f==0x0){hopperUtils[_0x5388('0xca')](_0x3f8f73)[_0x5388('0x9d')](loggerCatch(_0x5388('0x158')));}};Dialer[_0x5388('0x13')][_0x5388('0x149')]=function(_0x172cf6){return Promise['resolve']()['then'](cmHopper[_0x5388('0x146')](_0x172cf6['id'],previewRecallmeReminderInterval))[_0x5388('0x9e')](function(_0x4a43a0){for(var _0x358bf4=0x0;_0x358bf4<_0x4a43a0[_0x5388('0x101')];_0x358bf4++){var _0x479388=_0x4a43a0[_0x358bf4]['Agent'][_0x5388('0x5c')];if(_0x479388)io['to'](util['format']('user:%s',_0x479388))[_0x5388('0x119')](_0x5388('0x159'),{'hopper':_0x4a43a0[_0x358bf4]});}})[_0x5388('0x9d')](function(){});};Dialer[_0x5388('0x13')][_0x5388('0x15a')]=function(_0x4e3355){var _0x328e24=this;return function(){_0x328e24[_0x5388('0x15b')](_0x4e3355);};};Dialer[_0x5388('0x13')][_0x5388('0x15c')]=function(_0x3164cc,_0x24895c){var _0x43364b=this;var _0x173af6=uuid['v4']();this['actions'][_0x173af6]=new Action(_0x3164cc,_0x24895c,_0x173af6);return new Promise(function(_0x51b4ef,_0x37f355){if(_[_0x5388('0x38')](_0x3164cc)&&typeof _0x3164cc!=='object'){return _0x37f355(msgResponse('originate',_0x5388('0x8e'),_0x5388('0x15d')));}if(_[_0x5388('0x38')](_0x24895c[_0x5388('0x15e')])||_0x24895c[_0x5388('0x15e')]===null){return _0x37f355(msgResponse(_0x5388('0x15f'),_0x5388('0x8e'),_0x5388('0x160')));}var _0x1efd57={'XMD-CALLERID':_0x43364b[_0x5388('0x1d')][_0x173af6]['getCaller'](),'XMD-AGI':_0x3164cc[_0x5388('0x136')]?util[_0x5388('0x3e')](_0x5388('0x161'),ipAgi,_0x3164cc[_0x5388('0x136')]):_0x5388('0x162'),'XMD-AGIAFTER':_0x3164cc[_0x5388('0xc6')]?util[_0x5388('0x3e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3164cc[_0x5388('0xc6')]):'NONE','XMD-QUEUE':utils[_0x5388('0x163')](_0x3164cc)?util[_0x5388('0x3e')](_0x5388('0x164'),_0x3164cc['name'],_0x3164cc[_0x5388('0x165')]||'',_0x3164cc[_0x5388('0xc7')]?'c':'',_0x3164cc[_0x5388('0xcf')]||0x3):'NONE','XMD-CONTACTID':_0x24895c[_0x5388('0xed')],'XMD-CDRTYPE':_0x5388('0x166'),'CALLERID(all)':_0x43364b[_0x5388('0x1d')][_0x173af6][_0x5388('0x167')](),'XMD-AMD':_0x3164cc['dialAMDActive']?_0x5388('0x168'):_0x5388('0x162'),'XMD-DESTINATION':_0x5388('0x112')};if(_0x3164cc[_0x5388('0x113')]){_0x1efd57[_0x5388('0x169')]=_0x3164cc[_0x5388('0x16a')]||0x9c4;_0x1efd57[_0x5388('0x16b')]=_0x3164cc['dialAMDGreeting']||0x5dc;_0x1efd57[_0x5388('0x16c')]=_0x3164cc[_0x5388('0x16d')]||0x320;_0x1efd57['XMD-AMDTOTALANALYSISTIME']=_0x3164cc['dialAMDTotalAnalysisTime']||0x1388;_0x1efd57[_0x5388('0x16e')]=_0x3164cc[_0x5388('0x16f')]||0x64;_0x1efd57[_0x5388('0x170')]=_0x3164cc[_0x5388('0x171')]||0x32;_0x1efd57[_0x5388('0x172')]=_0x3164cc[_0x5388('0x173')]||0x3;_0x1efd57[_0x5388('0x174')]=_0x3164cc[_0x5388('0x175')]||0x100;_0x1efd57[_0x5388('0x176')]=_0x3164cc[_0x5388('0x177')]||0x1388;}if(utils[_0x5388('0x163')](_0x3164cc)){_0x1efd57[_0x5388('0x178')]=_0x24895c[_0x5388('0xe1')];}else{_0x1efd57['XMD-CAMPAIGNID']=_0x24895c[_0x5388('0xe2')];}var _0x3490c7=utils[_0x5388('0x179')](_0x24895c['Contact']);Object['assign'](_0x1efd57,_0x3490c7);var _0xa1f3c8=_0x43364b['isTrunkReachable'](_0x3164cc[_0x5388('0x89')])?utils[_0x5388('0x17a')](_0x3164cc[_0x5388('0x89')][_0x5388('0x17b')],_0x3164cc[_0x5388('0x17c')],_0x3164cc[_0x5388('0x17d')]>0x0?utils[_0x5388('0x17e')](_0x3164cc[_0x5388('0x17f')],_0x3164cc[_0x5388('0x17d')]):_0x3164cc[_0x5388('0x17f')]):utils[_0x5388('0x17a')](_[_0x5388('0xf4')](_0x3164cc[_0x5388('0x8a')])?_0x3164cc[_0x5388('0x89')][_0x5388('0x17b')]:_0x3164cc['TrunkBackup'][_0x5388('0x17b')],_0x3164cc[_0x5388('0x17c')],_0x3164cc['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5388('0x17e')](_0x3164cc[_0x5388('0x17f')],_0x3164cc[_0x5388('0x17d')]):_0x3164cc[_0x5388('0x17f')]);if(_0xa1f3c8){_0x1efd57[_0x5388('0x180')]=_0x43364b[_0x5388('0x1d')][_0x173af6]['originatecalleridname']=utils[_0x5388('0x181')](_0xa1f3c8);_0x1efd57[_0x5388('0x182')]=_0x24895c[_0x5388('0x15e')];}_0x3164cc[_0x5388('0x183')]=_0x1efd57;return ami[_0x5388('0x97')]({'actionid':_0x173af6,'action':_0x5388('0x15f'),'channel':_0x43364b['isTrunkReachable'](_0x3164cc['Trunk'])?util['format']('SIP/%s/%s%s',_0x3164cc[_0x5388('0x89')]['name'],isNotNull(_0x3164cc[_0x5388('0x184')])?_0x3164cc[_0x5388('0x184')][_0x5388('0x185')]()||'':'',_0x3164cc[_0x5388('0x186')]>0x0?_0x24895c[_0x5388('0x15e')][_0x5388('0x187')](_0x3164cc[_0x5388('0x186')]):_0x24895c['phone']):util[_0x5388('0x3e')](_0x5388('0x188'),_['isNil'](_0x3164cc[_0x5388('0x8a')])?_0x3164cc[_0x5388('0x89')][_0x5388('0x5c')]:_0x3164cc[_0x5388('0x8a')][_0x5388('0x5c')],isNotNull(_0x3164cc[_0x5388('0x184')])?_0x3164cc['dialPrefix'][_0x5388('0x185')]()||'':'',_0x3164cc[_0x5388('0x186')]>0x0?_0x24895c[_0x5388('0x15e')]['substring'](_0x3164cc[_0x5388('0x186')]):_0x24895c[_0x5388('0x15e')]),'callerid':_0xa1f3c8,'Exten':_0x5388('0x112'),'Context':_0x5388('0x189'),'Priority':'1','variable':_0x1efd57,'timeout':(_0x3164cc[_0x5388('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x173af6})['then'](function(_0x17382c){return _0x51b4ef(_0x17382c);})[_0x5388('0x9d')](function(_0x4e7770){_0x3164cc[_0x5388('0x18b')]+=0x1;var _0x286826=new History(_0x43364b[_0x5388('0x1d')][_0x173af6]);logger[_0x5388('0x60')](util['format'](_0x5388('0x18c'),JSON['stringify'](_0x4e7770)));_0x286826[_0x5388('0x6a')]=0xe;_0x286826[_0x5388('0x6b')]=_0x5388('0x18d');_0x286826[_0x5388('0x6d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x286826[_0x5388('0x6c')]=_0x286826['starttime'];hopperUtils[_0x5388('0xc8')](_0x286826)[_0x5388('0x9d')](loggerCatch(_0x5388('0x18e')));_0x43364b[_0x5388('0xca')](_0x286826)['catch'](loggerCatch(_0x5388('0x18e')))[_0x5388('0xfe')](function(){delete _0x43364b[_0x5388('0x1d')][_0x173af6];return _0x37f355(msgResponse(_0x5388('0x15f'),_0x5388('0x81'),_0x5388('0x18f')));});});});};Dialer[_0x5388('0x13')][_0x5388('0x190')]=function(_0x40d21e,_0x2c94a1,_0x23545a){var _0x4dd0b0=new History(_0x2c94a1);if(_0x4dd0b0[_0x5388('0x131')]+_0x4dd0b0['countcongestionretry']+_0x4dd0b0[_0x5388('0x121')]+_0x4dd0b0[_0x5388('0x122')]+_0x4dd0b0[_0x5388('0xd5')]+_0x4dd0b0[_0x5388('0xeb')]+_0x4dd0b0[_0x5388('0x123')]+_0x4dd0b0[_0x5388('0x124')]>=_0x23545a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x40d21e){case 0x3:if(_0x4dd0b0['countnoanswerretry']>=_0x23545a[_0x5388('0x191')]-0x1){return!![];}hopperUtils[_0x5388('0xdd')]({'active':![],'countnoanswerretry':_0x4dd0b0[_0x5388('0x121')]+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a['dialNoAnswerRetryFrequency'],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x4dd0b0[_0x5388('0xed')],'ListId':_0x4dd0b0[_0x5388('0xe0')],'VoiceQueueId':_0x4dd0b0[_0x5388('0xe1')]||undefined,'CampaignId':_0x4dd0b0[_0x5388('0xe2')]||undefined})['catch'](loggerCatch(_0x5388('0x192')));break;case 0x5:if(_0x4dd0b0[_0x5388('0x131')]>=_0x23545a[_0x5388('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x4dd0b0['countbusyretry']+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a[_0x5388('0x194')],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x4dd0b0[_0x5388('0xed')],'ListId':_0x4dd0b0[_0x5388('0xe0')],'VoiceQueueId':_0x4dd0b0['VoiceQueueId']||undefined,'CampaignId':_0x4dd0b0['CampaignId']||undefined})['catch'](loggerCatch(_0x5388('0x195')));break;case 0x8:if(_0x4dd0b0[_0x5388('0x120')]>=_0x23545a[_0x5388('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x4dd0b0[_0x5388('0x120')]+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a[_0x5388('0x197')],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x4dd0b0[_0x5388('0xed')],'ListId':_0x4dd0b0[_0x5388('0xe0')],'VoiceQueueId':_0x4dd0b0['VoiceQueueId']||undefined,'CampaignId':_0x4dd0b0[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4dd0b0[_0x5388('0x122')]>=_0x23545a['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x5388('0xdd')]({'active':![],'countnosuchnumberretry':_0x4dd0b0[_0x5388('0x122')]+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a[_0x5388('0x198')],_0x5388('0xdf'))[_0x5388('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dd0b0[_0x5388('0xed')],'ListId':_0x4dd0b0[_0x5388('0xe0')],'VoiceQueueId':_0x4dd0b0['VoiceQueueId']||undefined,'CampaignId':_0x4dd0b0['CampaignId']||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0x199')));}break;case 0xa:if(_0x4dd0b0['countdropretry']>=_0x23545a[_0x5388('0xdb')]-0x1){return!![];}hopperUtils[_0x5388('0xdd')]({'active':![],'countdropretry':_0x4dd0b0[_0x5388('0xd5')]+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a[_0x5388('0xde')],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x4dd0b0['ContactId'],'ListId':_0x4dd0b0[_0x5388('0xe0')],'VoiceQueueId':_0x4dd0b0[_0x5388('0xe1')]||undefined,'CampaignId':_0x4dd0b0[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0xe3')));break;case 0xb:if(_0x4dd0b0['countabandonedretry']>=_0x23545a['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x4dd0b0[_0x5388('0xeb')]+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a['dialAbandonedRetryFrequency'],_0x5388('0xdf'))[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x4dd0b0[_0x5388('0xed')],'ListId':_0x4dd0b0[_0x5388('0xe0')],'VoiceQueueId':_0x4dd0b0['VoiceQueueId']||undefined,'CampaignId':_0x4dd0b0['CampaignId']||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0xee')));break;case 0x13:if(_0x4dd0b0['countmachineretry']>=_0x23545a['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4dd0b0['countmachineretry']+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a[_0x5388('0x129')],'minutes')[_0x5388('0x3e')](_0x5388('0xc2')),'ContactId':_0x4dd0b0['ContactId'],'ListId':_0x4dd0b0['ListId'],'VoiceQueueId':_0x4dd0b0[_0x5388('0xe1')]||undefined,'CampaignId':_0x4dd0b0[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0x12a')));break;case 0x14:if(_0x4dd0b0[_0x5388('0x124')]>=_0x23545a['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x5388('0xdd')]({'active':![],'countagentrejectretry':_0x4dd0b0[_0x5388('0x124')]+=0x1,'scheduledat':moment()[_0x5388('0xec')](_0x23545a[_0x5388('0x19a')],'minutes')['format'](_0x5388('0xc2')),'ContactId':_0x4dd0b0[_0x5388('0xed')],'ListId':_0x4dd0b0['ListId'],'VoiceQueueId':_0x4dd0b0[_0x5388('0xe1')]||undefined,'CampaignId':_0x4dd0b0[_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0x19b')));break;default:return!![];}};Dialer[_0x5388('0x13')][_0x5388('0x19c')]=function(_0x8b307,_0x36d6df,_0x3f1d37){var _0x34bb59=this;var _0x39f9b9=new History(_0x8b307);var _0x43af55=![];var _0x4b7d87;var _0x37ac26;return new Promise(function(_0x448a0d,_0x22269d){if(_[_0x5388('0x38')](_0x36d6df)&&typeof _0x36d6df!=='object'){return _0x22269d(msgResponse('[callProgressDetecting]',_0x5388('0x8e'),_0x5388('0x19d')));}if(_[_0x5388('0x38')](_0x3f1d37)&&typeof _0x3f1d37!==_0x5388('0x19e')){return _0x22269d(msgResponse(_0x5388('0x19f'),_0x5388('0x8e'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x39f9b9,_0x3f1d37['reason'],_0x36d6df)[_0x5388('0x9e')](function(_0x1f3c09){if(_0x1f3c09[_0x5388('0xda')]==0x1)_0x43af55=!![];switch(_0x3f1d37[_0x5388('0xc5')]){case'0':_0x36d6df[_0x5388('0x1a0')]+=0x1;_0x39f9b9[_0x5388('0x6a')]=0x0;_0x39f9b9[_0x5388('0x6b')]=_0x5388('0x1a1');_0x39f9b9['countnosuchnumberretry']+=0x1;_0x39f9b9[_0x5388('0xd6')]+=0x1;ami['emit'](_0x5388('0x1a2'),ut[_0x5388('0x11b')](_0x8b307,_0x5388('0x1a3')));_0x4b7d87=_0x36d6df[_0x5388('0x198')];_0x37ac26=_0x36d6df['callAdditionalPhoneAfterMin'];hopperUtils[_0x5388('0xc8')](_0x39f9b9)[_0x5388('0x9d')](loggerCatch(_0x5388('0x130')));if(_0x34bb59[_0x5388('0x190')](0x0,_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9['countnosuchnumberretry']>=_0x36d6df[_0x5388('0x1a4')]){_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1a5'));}else{_0x34bb59[_0x5388('0x126')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1a5'));}}break;case'3':_0x36d6df['outboundNoAnswerCallsDay']+=0x1;_0x39f9b9['state']=0x3;_0x39f9b9[_0x5388('0x6b')]=_0x5388('0x1a6');_0x39f9b9[_0x5388('0x121')]+=0x1;_0x39f9b9[_0x5388('0xd6')]+=0x1;var _0x1819ba=ut['buildNoAnswerEventPayload'](_0x8b307,_0x36d6df);ami[_0x5388('0x119')](_0x5388('0x1a7'),_0x1819ba);_0x4b7d87=_0x36d6df[_0x5388('0x1a8')];_0x37ac26=_0x36d6df['callAdditionalPhoneAfterMin'];hopperUtils[_0x5388('0xc8')](_0x39f9b9)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x34bb59['checkRetriveMax'](0x3,_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9[_0x5388('0x121')]>=_0x36d6df[_0x5388('0x191')]){_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1a9'));}else{_0x34bb59[_0x5388('0x126')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1a9'));}}break;case'5':_0x36d6df[_0x5388('0x1aa')]+=0x1;_0x39f9b9[_0x5388('0x6a')]=0x5;_0x39f9b9[_0x5388('0x6b')]='Busy';_0x39f9b9['countbusyretry']+=0x1;_0x39f9b9[_0x5388('0xd6')]+=0x1;ami[_0x5388('0x119')](_0x5388('0x1ab'),ut[_0x5388('0x11b')](_0x8b307,_0x5388('0x1ac')));_0x4b7d87=_0x36d6df[_0x5388('0x194')];_0x37ac26=_0x36d6df[_0x5388('0xd7')];hopperUtils[_0x5388('0xc8')](_0x39f9b9)[_0x5388('0x9d')](loggerCatch(_0x5388('0x1ad')));if(_0x34bb59[_0x5388('0x190')](0x5,_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9[_0x5388('0x131')]>=_0x36d6df[_0x5388('0x193')]){_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1ae'));}else{_0x34bb59['stateGlobal'](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1ae'));}}break;case'8':_0x36d6df[_0x5388('0x1af')]+=0x1;_0x39f9b9[_0x5388('0x6a')]=0x8;_0x39f9b9[_0x5388('0x6b')]=_0x5388('0x1b0');_0x39f9b9[_0x5388('0x120')]+=0x1;_0x39f9b9[_0x5388('0xd6')]+=0x1;_0x4b7d87=_0x36d6df[_0x5388('0x197')];_0x37ac26=_0x36d6df[_0x5388('0xd7')];ami[_0x5388('0x119')]('custom:agentcongestion',ut['buildObj'](_0x8b307,_0x5388('0x1b1')));hopperUtils['createHistory'](_0x39f9b9)[_0x5388('0x9d')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x34bb59['checkRetriveMax'](0x8,_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9['countcongestionretry']>=_0x36d6df[_0x5388('0x196')]){_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1b2'));}else{_0x34bb59['stateGlobal'](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1b2'));}}break;case'11':_0x36d6df[_0x5388('0x1b3')]+=0x1;_0x39f9b9['state']=0xb;_0x39f9b9['statedesc']=_0x5388('0xe8');_0x39f9b9['countabandonedretry']+=0x1;_0x39f9b9[_0x5388('0xd6')]+=0x1;_0x4b7d87=_0x36d6df[_0x5388('0xea')];_0x37ac26=_0x36d6df[_0x5388('0xd7')];hopperUtils[_0x5388('0xc8')](_0x39f9b9)['catch'](loggerCatch(_0x5388('0xef')));if(_0x34bb59[_0x5388('0x190')](0xb,_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9[_0x5388('0xeb')]>=_0x36d6df[_0x5388('0x1b4')]){_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1b5'));}else{_0x34bb59[_0x5388('0x126')](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1b5'));}}break;case'20':_0x36d6df[_0x5388('0x1b6')]+=0x1;_0x39f9b9['state']=0x14;_0x39f9b9[_0x5388('0x6b')]=_0x5388('0x1b7');_0x39f9b9['countagentrejectretry']+=0x1;_0x39f9b9[_0x5388('0xd6')]+=0x1;_0x4b7d87=_0x36d6df['dialAgentRejectRetryFrequency'];_0x37ac26=_0x36d6df[_0x5388('0xd7')];ami['emit'](_0x5388('0x1b8'),ut[_0x5388('0x11b')](_0x8b307,_0x5388('0x1b9')));hopperUtils[_0x5388('0xc8')](_0x39f9b9)[_0x5388('0x9d')](loggerCatch(_0x5388('0x1ba')));if(_0x34bb59['checkRetriveMax'](0x14,_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9[_0x5388('0x124')]>=_0x36d6df[_0x5388('0x1bb')]){_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,'reason\x2020\x20agentreject');}else{_0x34bb59['stateGlobal'](_0x39f9b9,_0x448a0d,_0x22269d,_0x5388('0x1bc'));}}break;default:_0x36d6df[_0x5388('0x138')]+=0x1;_0x39f9b9[_0x5388('0x6a')]=0xc;_0x39f9b9[_0x5388('0x6b')]=_0x3f1d37['reason'];_0x4b7d87=_0x36d6df[_0x5388('0x19a')];_0x37ac26=_0x36d6df[_0x5388('0xd7')];hopperUtils[_0x5388('0xc8')](_0x39f9b9)['catch'](loggerCatch(_0x5388('0x1bd')));if(_0x34bb59[_0x5388('0x190')](_0x3f1d37[_0x5388('0xc5')],_0x8b307,_0x36d6df)&&!_0x43af55){if(_0x39f9b9['countbusyretry']+_0x39f9b9[_0x5388('0x120')]+_0x39f9b9['countnoanswerretry']+_0x39f9b9['countnosuchnumberretry']+_0x39f9b9['countdropretry']+_0x39f9b9[_0x5388('0xeb')]+_0x39f9b9['countmachineretry']+_0x39f9b9[_0x5388('0x124')]>=_0x36d6df['dialGlobalMaxRetry']){_0x34bb59['stateGlobal'](_0x39f9b9,_0x448a0d,_0x22269d,_0x3f1d37[_0x5388('0xc5')]);}else{_0x34bb59[_0x5388('0x133')](_0x39f9b9,_0x448a0d,_0x22269d,_0x3f1d37[_0x5388('0xc5')]);}}}})[_0x5388('0x9e')](function(){if(_0x43af55){hopperUtils['swapAdditionalPhones'](_0x39f9b9,_0x4b7d87,_0x37ac26)[_0x5388('0x9e')](function(){return _0x448a0d(0x1);});}});});};Dialer['prototype'][_0x5388('0x126')]=function(_0x1d08d5,_0x59dcf0,_0x369966,_0x5e5e46){var _0x308e29=new Final(_0x1d08d5);_0x308e29[_0x5388('0x6a')]=0xf;_0x308e29['statedesc']=_0x5388('0x1be');this[_0x5388('0x133')](_0x308e29,_0x59dcf0,_0x369966,_0x5e5e46);};Dialer['prototype'][_0x5388('0x133')]=function(_0x1c1f39,_0x56151e,_0xddd9b,_0x201b31){hopperUtils[_0x5388('0xca')](_0x1c1f39)['then'](function(){return _0x56151e(msgResponse(_0x5388('0x19f'),_0x5388('0x10d'),_0x201b31));})[_0x5388('0x9d')](function(){return _0xddd9b(msgResponse('[moveContactManagedDialer][0]',_0x5388('0x8e'),_0x5388('0x1bf')));});};Dialer[_0x5388('0x13')][_0x5388('0xb1')]=function(_0x49281f){var _0x1c77d4=_0x49281f[_0x5388('0x1c0')]/0x64;var _0x1dd544=_0x49281f[_0x5388('0xd0')]/(_0x49281f[_0x5388('0xd0')]+_0x49281f['outboundAnswerCallsDay']);var _0x2c105f=Math[_0x5388('0x1c1')](_0x49281f[_0x5388('0x1c2')]*(_0x49281f[_0x5388('0x1c3')]/0x64));var _0x46c8ad=Math[_0x5388('0x1c1')](_0x49281f[_0x5388('0x1c2')]*(_0x49281f[_0x5388('0x1c4')]/0x64));var _0x16a51b=_0x49281f[_0x5388('0x13d')]+_0x49281f[_0x5388('0x13f')];var _0x4ae1b6=Math['floor'](_0x49281f[_0x5388('0x55')]*_0x49281f[_0x5388('0x58')]*_0x49281f[_0x5388('0x1c5')]*_0x49281f[_0x5388('0x1c6')]);if(_[_0x5388('0x38')](_0x49281f[_0x5388('0x21')])){if(!_[_0x5388('0x38')](_0x49281f[_0x5388('0x20')])){_0x49281f[_0x5388('0x20')]=undefined;loggerPredictive[_0x5388('0x60')](_0x5388('0x1c7'),_0x5388('0x1c8'));}if(!_[_0x5388('0x38')](_0x49281f['handlePredictive'])){loggerPredictive[_0x5388('0x60')](_0x5388('0x1c7'),_0x5388('0x1c9'));clearInterval(_0x49281f['handlePredictive']);_0x49281f[_0x5388('0x5f')]=undefined;}_0x49281f['startProgressive']=moment()[_0x5388('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5388('0x42')](_0x49281f[_0x5388('0x5c')],_0x5388('0x1ca'),_0x49281f[_0x5388('0x21')]);this[_0x5388('0xb4')](_0x49281f,0x1);}else if(ifInterval(_0x49281f[_0x5388('0x1cb')],_0x49281f[_0x5388('0x21')])){this['handlePower'](_0x49281f,0x1);loggerPredictiveCalls[_0x5388('0x42')](_0x5388('0x1cc'),_0x49281f[_0x5388('0x21')],_0x49281f['name']);_0x49281f[_0x5388('0x55')]=0x0;_0x49281f[_0x5388('0xd1')]=0x0;}else if(_0x1c77d4<_0x1dd544&&_0x49281f[_0x5388('0x1cd')]===_0x5388('0x1ce')){clearPredictiveAttributes(_0x49281f);loggerPredictive[_0x5388('0x42')](_0x5388('0x1cf'),_0x5388('0x1d0'),_0x1dd544,'startProgressive',_0x49281f[_0x5388('0x5c')]);}else if(_0x4ae1b6<_0x49281f[_0x5388('0xd1')]&&_0x49281f[_0x5388('0x1cd')]===_0x5388('0x1ce')){clearPredictiveAttributes(_0x49281f);loggerPredictive[_0x5388('0x42')](_0x5388('0x1d1'),'Max\x20Drop\x20',_0x4ae1b6,'Drop\x20in\x20this\x20interval',_0x49281f['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x49281f[_0x5388('0x5c')]);}else if(!ifInterval(_0x49281f['dialPredictiveInterval'],_0x49281f[_0x5388('0x21')])&&_[_0x5388('0x38')](_0x49281f[_0x5388('0x20')])&&!_[_0x5388('0x38')](_0x49281f[_0x5388('0x21')])){_0x49281f[_0x5388('0x20')]=moment()[_0x5388('0x3e')](_0x5388('0xc2'));loggerPredictive[_0x5388('0x42')](_0x49281f[_0x5388('0x5c')],_0x5388('0x1d2'),_0x49281f[_0x5388('0x20')]);hopperUtils[_0x5388('0x1d3')](_0x49281f[_0x5388('0x1cb')])[_0x5388('0x9e')](this[_0x5388('0x1d4')](_0x49281f))[_0x5388('0x9e')](mergeDataErlangB(_0x49281f))[_0x5388('0x9e')](this[_0x5388('0x1d5')](_0x49281f))[_0x5388('0x9d')](loggerCatchPredictive(_0x5388('0x1d6'),_0x49281f));}else if(!ifInterval(_0x49281f[_0x5388('0x1cb')],_0x49281f[_0x5388('0x20')])){_0x49281f[_0x5388('0xd1')]=0x0;_0x49281f[_0x5388('0x20')]=moment()[_0x5388('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5388('0x42')](_0x49281f['name'],_0x5388('0x1d7'),_0x49281f[_0x5388('0x20')]);clearInterval(_0x49281f['handlePredictive']);_0x49281f[_0x5388('0x5f')]=undefined;hopperUtils[_0x5388('0x1d3')](_0x49281f[_0x5388('0x1cb')])[_0x5388('0x9e')](this[_0x5388('0x1d4')](_0x49281f))[_0x5388('0x9e')](mergeDataErlangB(_0x49281f))[_0x5388('0x9e')](this[_0x5388('0x1d5')](_0x49281f))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x49281f));}else if(_0x49281f[_0x5388('0x1c2')]&&_0x16a51b<_0x49281f[_0x5388('0x1c2')]-_0x46c8ad){clearPredictiveAttributes(_0x49281f);loggerPredictive['info'](_0x49281f[_0x5388('0x5c')],_0x5388('0x1d8'),_0x16a51b,_0x5388('0x1d9'),_0x49281f[_0x5388('0x1c2')],'-',_0x46c8ad,'=',_0x49281f[_0x5388('0x1c2')]-_0x46c8ad,')');}else if(_0x49281f[_0x5388('0x1c2')]&&_0x16a51b>_0x49281f['predictiveIntervalAvailable']+_0x2c105f){clearPredictiveAttributes(_0x49281f);loggerPredictive['info'](_0x49281f[_0x5388('0x5c')],_0x5388('0x1d8'),_0x16a51b,_0x5388('0x1da'),_0x49281f[_0x5388('0x1c2')],'+',_0x2c105f,'=',_0x49281f[_0x5388('0x1c2')]+_0x2c105f,')');}};Dialer[_0x5388('0x13')]['getDataPredictive']=function(_0x277077){var _0x46e247=this;return function(_0x599d8f){return new Promise(function(_0x5311ec,_0x4adc3f){_[_0x5388('0x5a')](_0x277077,_0x599d8f[0x0]);if(checkGetDataPredictive(_0x599d8f[0x0])){var _0x1de6e8=_0x277077[_0x5388('0x1c2')]=_0x277077[_0x5388('0x13f')]+_0x277077[_0x5388('0x13d')];var _0x1cd149=_0x277077[_0x5388('0x1cb')]*0x3c;var _0x3da154=_0x599d8f[0x0][_0x5388('0x4c')]+_0x599d8f[0x0][_0x5388('0x4a')];var _0xe822dc=(_0x599d8f[0x0][_0x5388('0x45')]+_0x599d8f[0x0][_0x5388('0x47')]+_0x599d8f[0x0][_0x5388('0xe6')])/_0x599d8f[0x0][_0x5388('0x4e')];_0x277077[_0x5388('0x1c5')]=_0xe822dc>0x0?_0xe822dc:0x1;switch(_0x277077[_0x5388('0x1cd')]){case _0x5388('0x1ce'):var _0x105833=_0x277077[_0x5388('0x1c0')]/0x64;return _0x46e247[_0x5388('0x1db')](_0x1de6e8,_0x1cd149,_0x3da154,_0xe822dc,_0x105833)[_0x5388('0x9e')](function(_0x2e0fd1){return _0x5311ec(_0x2e0fd1);});case _0x5388('0x1dc'):var _0x1c47c1=_0x277077[_0x5388('0x1c0')]/0x64;return _0x46e247[_0x5388('0x1dd')](_0x1de6e8,_0x1cd149,_0x3da154,_0xe822dc,_0x1c47c1)[_0x5388('0x9e')](function(_0x154117){return _0x5311ec(_0x154117);});default:return _0x4adc3f(msgResponse(_0x5388('0x1de'),_0x5388('0x8e'),_0x5388('0x1df')));}}else{return _0x4adc3f(msgResponse(_0x5388('0x1de'),_0x5388('0x8e'),_0x5388('0x1e0')));}});};};Dialer[_0x5388('0x13')][_0x5388('0x1e1')]=function(_0x19f43b){var _0x2cec03=this;return function(_0x266e16){return new Promise(function(_0x54f741,_0x24b557){_[_0x5388('0x5a')](_0x19f43b,_0x266e16[0x0]);if(checkGetDataPredictive(_0x266e16[0x0])){loggerPredictive['info'](JSON[_0x5388('0x71')](_0x266e16[0x0]));if(_0x19f43b[_0x5388('0x1cd')]===_0x5388('0x1ce')){return _0x2cec03[_0x5388('0x14f')](_0x19f43b['id'])['then'](function(_0x598666){var _0x21ddb2=_0x19f43b[_0x5388('0x1e2')]-_0x598666[0x0][_0x5388('0x1e3')];var _0x53a96b=_0x19f43b[_0x5388('0x1cb')]*0x3c;var _0x16f5e6=_0x266e16[0x0]['predictiveIntervalAvgTalktime']+_0x266e16[0x0][_0x5388('0x4a')];var _0x3c541a=(_0x266e16[0x0][_0x5388('0x45')]+_0x266e16[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x266e16[0x0][_0x5388('0xe6')])/_0x266e16[0x0][_0x5388('0x4e')];var _0x3bd1bc=_0x19f43b['dialPredictiveOptimizationPercentage']/0x64;_0x19f43b[_0x5388('0x1e4')]=_0x598666[0x0]['outboundQueuePauses']||0x0;_0x19f43b[_0x5388('0x1c5')]=_0x3c541a>0x0?_0x3c541a:0x1;return _0x2cec03[_0x5388('0x1db')](_0x21ddb2,_0x53a96b,_0x16f5e6,_0x3c541a,_0x3bd1bc);})['then'](function(_0x14dcc7){return _0x54f741(_0x14dcc7);})[_0x5388('0x9d')](function(_0x3e6947){return _0x24b557(msgResponse(_0x5388('0x1e5'),_0x5388('0x8e'),JSON[_0x5388('0x71')](_0x3e6947)));});}if(_0x19f43b[_0x5388('0x1cd')]==='agentBusyFactor'){return _0x2cec03[_0x5388('0x14f')](_0x19f43b['id'])[_0x5388('0x9e')](function(_0x5e451f){var _0x3073fd=_0x19f43b[_0x5388('0x1e2')]-_0x5e451f[0x0][_0x5388('0x1e3')];var _0x558669=_0x19f43b[_0x5388('0x1cb')]*0x3c;var _0x34c38f=_0x266e16[0x0][_0x5388('0x4c')]+_0x266e16[0x0][_0x5388('0x4a')];var _0x436973=(_0x266e16[0x0][_0x5388('0x45')]+_0x266e16[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x266e16[0x0][_0x5388('0xe6')])/_0x266e16[0x0][_0x5388('0x4e')];var _0x86115d=_0x19f43b[_0x5388('0x1c0')]/0x64;_0x19f43b[_0x5388('0x1e4')]=_0x5e451f[0x0][_0x5388('0x1e3')]||0x0;_0x19f43b[_0x5388('0x1c5')]=_0x436973>0x0?_0x436973:0x1;return _0x2cec03['busyFactor'](_0x3073fd,_0x558669,_0x34c38f,_0x436973,_0x86115d);})[_0x5388('0x9e')](function(_0x35dde3){return _0x54f741(_0x35dde3);})[_0x5388('0x9d')](function(_0x5925e3){return _0x24b557(msgResponse('[CatchErlangB]','Failure',JSON[_0x5388('0x71')](_0x5925e3)));});}}else{return _0x24b557(msgResponse(_0x5388('0x1de'),_0x5388('0x8e'),_0x5388('0x1e0')));}});};};Dialer[_0x5388('0x13')][_0x5388('0x1d5')]=function(_0x4772cf){var _0x3b814a=this;return function(){var _0x5f56d5=0x0;var _0x199163=Math[_0x5388('0x1e6')](_0x4772cf['erlangCallToSecond']*0x3e8);if(_0x199163>0x0){_0x199163=_0x199163<0x64?0x64:_0x199163;loggerPredictive[_0x5388('0x42')](_0x4772cf[_0x5388('0x5c')],_0x5388('0x1e7'),_0x199163,_0x5388('0x1e8'));_0x4772cf['handlePredictive']=setInterval(function(){_0x3b814a[_0x5388('0x5f')](_0x4772cf);loggerPredictiveCalls[_0x5388('0x42')](_0x5388('0x1e9'),_0x5f56d5+=0x1);},_0x199163);}else{loggerPredictive[_0x5388('0x42')](_0x4772cf['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x5388('0x13')]['checkContactBlack']=function(_0x34afba,_0x5a53df){var _0x6fabe7=this;return function(_0x552050){if(_[_0x5388('0x41')](_0x552050)){if(_[_0x5388('0xf4')](_0x5a53df[_0x5388('0x155')])||!_0x5a53df[_0x5388('0x1ea')]){if(_0x34afba[_0x5388('0xb2')]==='booked'){_0x34afba['queueStatusComplete']=_[_0x5388('0x38')](_0x34afba[_0x5388('0x6e')])?!![]:_0x34afba[_0x5388('0x6e')];var _0x803db4=uuid['v4']();_0x6fabe7[_0x5388('0x1d')][_0x803db4]=new Action(_0x34afba,_0x5a53df,_0x803db4);loggerBooked[_0x5388('0x42')](_0x5388('0x1eb'),_0x803db4,_0x5388('0x1ec'),JSON[_0x5388('0x71')](_0x34afba[_0x5388('0x6e')]),_0x5388('0x1ed'),_0x34afba[_0x5388('0x5c')]);if(_0x34afba['queueStatusComplete']){_0x34afba[_0x5388('0x6e')]=![];_0x6fabe7['queueBooked'][_0x6fabe7[_0x5388('0x1d')][_0x803db4][_0x5388('0xbf')]]=[];ami[_0x5388('0x97')]({'actionid':_0x803db4,'action':_0x5388('0x1ee'),'queue':_0x34afba[_0x5388('0x5c')]})['catch'](function(){_0x6fabe7[_0x5388('0xcc')](_0x34afba);hopperUtils[_0x5388('0xdd')]({'active':![],'ContactId':_0x6fabe7[_0x5388('0x1d')][_0x803db4][_0x5388('0xed')],'ListId':_0x6fabe7['actions'][_0x803db4][_0x5388('0xe0')],'VoiceQueueId':_0x6fabe7[_0x5388('0x1d')][_0x803db4]['VoiceQueueId']||undefined,'CampaignId':_0x6fabe7['actions'][_0x803db4][_0x5388('0xe2')]||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0x1ef')));delete _0x6fabe7['actions'][_0x803db4];});}else{loggerBooked['info'](_0x5388('0x1f0'),JSON[_0x5388('0x71')](_0x34afba['queueStatusComplete']),_0x5388('0x1ed'),_0x34afba['name']);_0x6fabe7[_0x5388('0xcc')](_0x34afba);hopperUtils[_0x5388('0xdd')]({'active':![],'ContactId':_0x6fabe7[_0x5388('0x1d')][_0x803db4][_0x5388('0xed')],'ListId':_0x6fabe7['actions'][_0x803db4][_0x5388('0xe0')],'VoiceQueueId':_0x6fabe7[_0x5388('0x1d')][_0x803db4][_0x5388('0xe1')]||undefined,'CampaignId':_0x6fabe7['actions'][_0x803db4]['CampaignId']||undefined})[_0x5388('0x9d')](loggerCatch(_0x5388('0x1ef')));delete _0x6fabe7[_0x5388('0x1d')][_0x803db4];}}else{return _0x6fabe7[_0x5388('0x15c')](_0x34afba,_0x5a53df);}}else{if(utils[_0x5388('0x5b')](undefined,_0x5a53df[_0x5388('0x1f1')])<_0x34afba[_0x5388('0x1f2')]*0x3c){if(_0x5a53df[_0x5388('0x1f3')]&&!_0x5a53df[_0x5388('0x1f3')][_0x5388('0x1f4')]){_0x6fabe7[_0x5388('0x105')][_0x5388('0xfc')](_0x5a53df['id'])[_0x5388('0xfe')](function(){_0x6fabe7['updateOriginated'](_0x34afba);});}else{hopperUtils['unlockContact']({'active':![]},_0x5a53df['id'],0x1)[_0x5388('0xfe')](function(){_0x6fabe7[_0x5388('0xcc')](_0x34afba);});}}else{_0x34afba[_0x5388('0x1f5')]+=0x1;_0x6fabe7[_0x5388('0xcc')](_0x34afba);if(_0x34afba['dialRecallInQueue']){hopperUtils[_0x5388('0xdd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a53df['ContactId'],'ListId':_0x5a53df['ListId'],'VoiceQueueId':_0x5a53df['VoiceQueueId']||undefined,'CampaignId':_0x5a53df[_0x5388('0xe2')]||undefined})['catch'](loggerCatch(_0x5388('0x1f6')));hopperUtils[_0x5388('0xc8')](createObjHistory(_0x34afba,_0x5a53df,utils[_0x5388('0x65')][_0x5388('0x1f7')],0x17,'RecallInQueue'))[_0x5388('0x9d')](loggerCatch(_0x5388('0x1f8')));}else{_0x6fabe7[_0x5388('0x11c')](createObjHistory(_0x34afba,_0x5a53df,utils[_0x5388('0x65')][_0x5388('0x1f9')],0x16,_0x5388('0x1fa')),_0x5388('0x1fb'),_0x5388('0x1fc'));}}}}else{_0x34afba[_0x5388('0x1fd')]+=0x1;_0x6fabe7[_0x5388('0x11c')](createObjHistory(_0x34afba,_0x5a53df,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x5388('0x1fe'));throw _0x5388('0x1ff');}};};Dialer['prototype'][_0x5388('0x15b')]=function(_0x3d38c2){var _0x130549=this;var _0xe36dd6=_0x3d38c2[_0x5388('0x200')]-_0x3d38c2[_0x5388('0x7c')];emitCampaignSummary(_0x3d38c2);if(_0xe36dd6>0x0&&_0x3d38c2[_0x5388('0x63')]==0x0){if(_0xe36dd6>this[_0x5388('0x1b')]){_0xe36dd6=this[_0x5388('0x1b')];}_0x3d38c2['temp']=0x1;hopperUtils[_0x5388('0x201')](_0x3d38c2,_0xe36dd6)['then'](function(_0x218fc0){_0x3d38c2[_0x5388('0x63')]=0x0;if(_0x218fc0){if(!utils[_0x5388('0x202')](_0x218fc0)){_0x3d38c2[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x68')];logger[_0x5388('0x42')](_0x5388('0x203')+_0x3d38c2['name']);}else{_0x3d38c2[_0x5388('0x7c')]+=_0x218fc0[_0x5388('0x101')];_0x3d38c2['message']=utils[_0x5388('0x65')][_0x5388('0x204')];for(var _0x2dea3b=0x0;_0x2dea3b<_0x218fc0[_0x5388('0x101')];_0x2dea3b+=0x1){_0x3d38c2[_0x5388('0x205')]+=0x1;if(_[_0x5388('0xf4')](_0x218fc0[_0x2dea3b])||_[_0x5388('0xf4')](_0x218fc0[_0x2dea3b][_0x5388('0x206')])||_[_0x5388('0xf4')](_0x218fc0[_0x2dea3b][_0x5388('0x15e')])){_0x130549[_0x5388('0x207')](_0x5388('0x208'),_0x3d38c2,_0x218fc0[_0x2dea3b]);}else{hopperUtils[_0x5388('0x209')](_['pick'](_0x218fc0[_0x2dea3b],[_0x5388('0xe2'),'phone']))[_0x5388('0x9e')](_0x130549[_0x5388('0x20a')](_0x3d38c2,_0x218fc0[_0x2dea3b]))[_0x5388('0x9d')](_0x130549[_0x5388('0x153')](_0x5388('0x20b'),_0x3d38c2));}}}}})[_0x5388('0x9d')](loggerGetContactDialer('[getContactCampaign2]',_0x3d38c2,_0xe36dd6));}};Dialer[_0x5388('0x13')][_0x5388('0xb4')]=function(_0x53f541,_0x2469c2){var _0x39f817=this;var _0xb0e43c=[];if(_0x2469c2<0x1||_0x53f541['dialMethod']===_0x5388('0x5')){_0x2469c2=0x1;}var _0x326388=Math[_0x5388('0x1e6')](_0x53f541['available']*_0x2469c2)-_0x53f541[_0x5388('0x7c')];if(_0x53f541['dialLimitQueue']>0x0){var _0x5cce8c=_0x53f541[_0x5388('0x20c')]-_0x53f541[_0x5388('0x7c')]-_0x53f541[_0x5388('0x13f')]-_0x53f541[_0x5388('0x140')];if(_0x326388>_0x5cce8c){_0x326388=_0x5cce8c;}}if(_0x326388>0x0&&_0x53f541[_0x5388('0x63')]==0x0){if(_0x53f541[_0x5388('0xb2')]===_0x5388('0x5')){_0x326388=0x1;}if(_0x326388>this['maxNumberOriginate']){_0x326388=this['maxNumberOriginate'];}for(var _0x2a8bb8 in this['agents']){if(typeof this[_0x5388('0x19')][_0x2a8bb8]!==_0x5388('0xaa')){if(this['agents'][_0x2a8bb8][_0x5388('0x6a')]===_0x5388('0x20d')&&this[_0x5388('0x19')][_0x2a8bb8][_0x5388('0x86')]===_0x5388('0x85')){_0xb0e43c['push'](this[_0x5388('0x19')][_0x2a8bb8]['id']);}}}_0x53f541[_0x5388('0x63')]=0x1;hopperUtils[_0x5388('0x20e')](_0x53f541,_0xb0e43c,_0x326388)[_0x5388('0x9e')](function(_0x772764){_0x53f541['temp']=0x0;if(_0x772764){if(!utils[_0x5388('0x202')](_0x772764)){hopperUtils[_0x5388('0x20f')](_0x53f541)[_0x5388('0x9e')](sendMessageReschedule(_0x53f541))[_0x5388('0x9d')](loggerCatch(_0x5388('0x210')));}else{_0x53f541[_0x5388('0x7c')]+=_0x772764[_0x5388('0x101')];_0x53f541[_0x5388('0x64')]=_0x53f541['dialMethod']===_0x5388('0x5')?utils[_0x5388('0x65')][_0x5388('0x168')]:utils[_0x5388('0x65')]['RUNNING'];for(var _0x17f0b4=0x0;_0x17f0b4<_0x772764[_0x5388('0x101')];_0x17f0b4+=0x1){if(_['isNil'](_0x772764[_0x17f0b4])||_[_0x5388('0xf4')](_0x772764[_0x17f0b4][_0x5388('0x206')])||_[_0x5388('0xf4')](_0x772764[_0x17f0b4][_0x5388('0x15e')])){_0x39f817[_0x5388('0x207')](_0x5388('0x208'),_0x53f541,_0x772764[_0x17f0b4]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x772764[_0x17f0b4],[_0x5388('0xe1'),'phone']))[_0x5388('0x9e')](_0x39f817[_0x5388('0x20a')](_0x53f541,_0x772764[_0x17f0b4]))[_0x5388('0x9d')](_0x39f817['loggerHandler'](_0x5388('0x208'),_0x53f541));}}}}})['catch'](loggerGetContactDialer(_0x5388('0x211'),_0x53f541,_0x326388));}};Dialer[_0x5388('0x13')][_0x5388('0x5f')]=function(_0x5089b5){if(_0x5089b5[_0x5388('0x20c')]>0x0){var _0x23301f=_0x5089b5[_0x5388('0x20c')]-_0x5089b5['originated']-_0x5089b5['talking'];if(_0x23301f>0x0&&_0x5089b5[_0x5388('0x63')]==0x0){this['tryOriginatePredictive'](_0x5089b5);}else{loggerPredictiveCalls['info'](_0x5388('0x212'));}}else{this['tryOriginatePredictive'](_0x5089b5);}};Dialer[_0x5388('0x13')][_0x5388('0x213')]=function(_0x334b7d){var _0x1cd028=this;var _0x63280=[];_0x334b7d[_0x5388('0x7c')]+=0x1;for(var _0x361203 in this[_0x5388('0x19')]){if(typeof this[_0x5388('0x19')][_0x361203]!==_0x5388('0xaa')){if(this[_0x5388('0x19')][_0x361203][_0x5388('0x6a')]==='not_inuse'&&this['agents'][_0x361203]['status']===_0x5388('0x85')){_0x63280[_0x5388('0xfa')](this[_0x5388('0x19')][_0x361203]['id']);}}}_0x334b7d[_0x5388('0x63')]=0x1;return this['getContactDialer'](_0x334b7d['id'],_0x63280,0x1,_0x334b7d['dialOrderByScheduledAt'],_0x334b7d)[_0x5388('0x9e')](function(_0x490e3f){_0x334b7d[_0x5388('0x63')]=0x1;if(_0x490e3f){if(!utils[_0x5388('0x202')](_0x490e3f)){utils[_0x5388('0x62')](_0x334b7d,0x1,0x0);return hopperUtils[_0x5388('0x20f')](_0x334b7d)[_0x5388('0x9e')](sendMessageReschedule(_0x334b7d))[_0x5388('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x334b7d[_0x5388('0x64')]=utils[_0x5388('0x65')][_0x5388('0x204')];if(_[_0x5388('0xf4')](_0x490e3f[0x0])||_[_0x5388('0xf4')](_0x490e3f[0x0]['Contact'])||_['isNil'](_0x490e3f[0x0]['phone'])){_0x1cd028[_0x5388('0x207')](_0x5388('0x208'),_0x334b7d,_0x490e3f[0x0]);}else{return hopperUtils[_0x5388('0x214')](_[_0x5388('0x72')](_0x490e3f[0x0],[_0x5388('0xe1'),_0x5388('0x15e')]))[_0x5388('0x9e')](_0x1cd028['checkContactBlack'](_0x334b7d,_0x490e3f[0x0]))['catch'](_0x1cd028[_0x5388('0x153')](_0x5388('0x215'),_0x334b7d));}}}})[_0x5388('0x9d')](loggerGetContactDialer(_0x5388('0x216'),_0x334b7d,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x27c577,_0x3c7fb6,_0x11ded4,_0x57f714,_0x20e7d7,_0x11f7be){loggerPredictive[_0x5388('0x42')](_0x5388('0x217'));loggerPredictive[_0x5388('0x42')](_0x5388('0x218'),_0x27c577);loggerPredictive[_0x5388('0x42')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c7fb6);loggerPredictive[_0x5388('0x42')](_0x5388('0x219'),_0x11ded4);loggerPredictive[_0x5388('0x42')]('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',_0x57f714);loggerPredictive[_0x5388('0x42')](_0x5388('0x21a'),_0x20e7d7);loggerPredictive[_0x5388('0x42')](_0x5388('0x4d'));return new Promise(function(_0x2d27de,_0x516049){if(_0x27c577<=0x0||isNaN(_0x27c577)){return _0x516049(msgResponse(_0x5388('0x21b'),_0x5388('0x81'),_0x5388('0x21c')+_0x27c577));}if(_0x11ded4<=0x0||isNaN(_0x11ded4)){return _0x516049(msgResponse(_0x5388('0x21b'),_0x5388('0x81'),_0x5388('0x21d')+_0x11ded4));}if(_0x57f714<=0x0||isNaN(_0x57f714)){return _0x516049(msgResponse('[abandonmentRate]','Error',_0x5388('0x21e')+_0x57f714));}if(_0x3c7fb6<=0x0||isNaN(_0x3c7fb6)){return _0x516049(msgResponse(_0x5388('0x21b'),'Error',_0x5388('0x21f')+_0x3c7fb6));}if(_0x20e7d7<=0x0||isNaN(_0x20e7d7)){return _0x516049(msgResponse(_0x5388('0x21b'),'Error',_0x5388('0x220')+_0x20e7d7));}_0x11f7be=_0x11f7be||0x0;var _0x1bd62c=0x1/_0x11ded4;var _0x16409d=0x0;var _0x583559=0x0;var _0x3af7dc=0x0;var _0x4efb98=0x0;for(var _0x1c1eba=0x0;_0x3af7dc<_0x20e7d7;_0x1c1eba+=0x1){_0x583559=_0x1c1eba/_0x3c7fb6;_0x16409d=(_0x57f714*_0x583559+_0x11f7be)/_0x1bd62c;_0x3af7dc=utils[_0x5388('0x221')](_0x16409d,_0x27c577);_0x4efb98=_0x16409d/_0x27c577*(0x1-utils['erlangb'](_0x16409d,_0x27c577));}return _0x2d27de({'erlangCalls':_0x1c1eba,'erlangCallToSecond':_0x3c7fb6/_0x1c1eba,'erlangAbandonmentRate':_0x3af7dc,'erlangBusyFactor':_0x4efb98});});};Dialer['prototype'][_0x5388('0x1dd')]=function(_0x1ccdbc,_0x3340a5,_0x52e4d4,_0x1b1d9f,_0x5a082e,_0xb8cc09){loggerPredictive[_0x5388('0x42')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x5388('0x42')](_0x5388('0x218'),_0x1ccdbc);loggerPredictive['info'](_0x5388('0x222'),_0x3340a5);loggerPredictive[_0x5388('0x42')]('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',_0x52e4d4);loggerPredictive[_0x5388('0x42')](_0x5388('0x223'),_0x1b1d9f);loggerPredictive[_0x5388('0x42')](_0x5388('0x224'),_0x5a082e);loggerPredictive['info']('---------------------------');return new Promise(function(_0x387460,_0x3fada8){if(_0x1ccdbc<=0x0||isNaN(_0x1ccdbc)){return _0x3fada8(msgResponse(_0x5388('0x225'),_0x5388('0x81'),'m\x20=\x20'+_0x1ccdbc));}if(_0x52e4d4<=0x0||isNaN(_0x52e4d4)){return _0x3fada8(msgResponse(_0x5388('0x225'),'Error',_0x5388('0x21d')+_0x52e4d4));}if(_0x1b1d9f<=0x0||isNaN(_0x1b1d9f)){return _0x3fada8(msgResponse('[busyFactor]',_0x5388('0x81'),_0x5388('0x21e')+_0x1b1d9f));}if(_0x3340a5<=0x0||isNaN(_0x3340a5)){return _0x3fada8(msgResponse(_0x5388('0x225'),'Error',_0x5388('0x21f')+_0x3340a5));}if(_0x5a082e<=0x0||isNaN(_0x5a082e)){return _0x3fada8(msgResponse(_0x5388('0x225'),'Error',_0x5388('0x226')+_0x5a082e));}_0xb8cc09=_0xb8cc09||0x0;var _0x373b83=0x1/_0x52e4d4;var _0x65db8d=0x0;var _0x5144eb=0x0;var _0x3a4c21=0x0;var _0x1016e3=0x0;for(var _0x1f42c1=0x0;_0x1016e3<_0x5a082e;_0x1f42c1+=0x1){_0x5144eb=_0x1f42c1/_0x3340a5;_0x65db8d=(_0x1b1d9f*_0x5144eb+_0xb8cc09)/_0x373b83;_0x3a4c21=utils['erlangb'](_0x65db8d,_0x1ccdbc);_0x1016e3=_0x65db8d/_0x1ccdbc*(0x1-utils['erlangb'](_0x65db8d,_0x1ccdbc));}return _0x387460({'erlangCalls':_0x1f42c1,'erlangCallToSecond':_0x3340a5/_0x1f42c1,'erlangAbandonmentRate':_0x3a4c21,'erlangBusyFactor':_0x1016e3});});};module[_0x5388('0x227')]=Dialer; \ No newline at end of file +var _0x4673=['originated','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','prototype','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','push','Action','format','iftime\x20%s,%s','content','indexOf','catch','command','true','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueId','uniqueid','ivr','updateOriginated','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','dialDropRetryFrequency','minutes','ListId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','countabandonedretry','ContactId','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','locked','paused','stateinterface','strategy','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','getQueue','response','Success','callProgressDetecting','variable','amdstatus','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','countbusyretry','countcongestionretry','countnosuchnumberretry','stateGlobal','reason19\x20machine....','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','assign','filter','dialPreviewRecallmeReminder','online','length','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','saveInDb','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimization','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','util','lodash','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','isUndefined','emit','type','outbound','debug','inspect','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x4673,0x199));var _0x3467=function(_0x1cf913,_0x2e9e0){_0x1cf913=_0x1cf913-0x0;var _0xeb972f=_0x4673[_0x1cf913];return _0xeb972f;};'use strict';var util=require(_0x3467('0x0'));var _=require(_0x3467('0x1'));var uuid=require('uuid');var moment=require(_0x3467('0x2'));var rr=require('rr');var Redis=require(_0x3467('0x3'));var utils=require(_0x3467('0x4'));var hopperUtils=require(_0x3467('0x5'));var ut=require('../preview/util/util');var config=require(_0x3467('0x6'));var logger=require(_0x3467('0x7'))(_0x3467('0x8'));var loggerBooked=require(_0x3467('0x7'))(_0x3467('0x9'));var loggerPredictive=require(_0x3467('0x7'))(_0x3467('0xa'));var loggerPredictiveCalls=require(_0x3467('0x7'))(_0x3467('0xb'));var loggerSyncQueueSummary=require(_0x3467('0x7'))(_0x3467('0xc'));var ami=require(_0x3467('0xd'));config[_0x3467('0xe')]=_[_0x3467('0xf')](config[_0x3467('0xe')],{'host':_0x3467('0x10'),'port':0x18eb});var io=require(_0x3467('0x11'))(new Redis(config[_0x3467('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x3467('0x12'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x3467('0x13'));var AgentComplete=require(_0x3467('0x14'));var QueueCallerAbandon=require(_0x3467('0x15'));var Hangup=require(_0x3467('0x16'));var ipAgi=process[_0x3467('0x17')][_0x3467('0x18')]||_0x3467('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x3467('0x1a')]=function(_0xb4fcab){this[_0x3467('0x1b')]=this['tail']?this[_0x3467('0x1b')]['finally'](_0xb4fcab):_0xb4fcab();};function Dialer(_0x2be7d9,_0x322e9a){this[_0x3467('0x1c')]=new Sequence();this[_0x3467('0x1d')]=_0x322e9a;this[_0x3467('0x1e')]=_0x2be7d9['voiceQueues'];this[_0x3467('0x1f')]=_0x2be7d9['campaigns'];this[_0x3467('0x20')]=_0x2be7d9[_0x3467('0x20')];this[_0x3467('0x21')]=_0x2be7d9[_0x3467('0x21')];this[_0x3467('0x22')]=config[_0x3467('0x22')]||0x2;this[_0x3467('0x23')]={};this[_0x3467('0x24')]={};this[_0x3467('0x25')]={};this['uniqueId']={};this[_0x3467('0x26')]={};this[_0x3467('0x27')]={};this[_0x3467('0x28')]={};this[_0x3467('0x29')]={};this[_0x3467('0x2a')]={};this[_0x3467('0x2b')]={};this[_0x3467('0x2c')]={};ami['on']('agentconnect',this[_0x3467('0x2d')][_0x3467('0x2e')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x3467('0x2e')](this));ami['on'](_0x3467('0x2f'),this['syncOriginateResponse'][_0x3467('0x2e')](this));ami['on'](_0x3467('0x30'),this[_0x3467('0x31')][_0x3467('0x2e')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x3467('0x2e')](this));ami['on'](_0x3467('0x32'),this[_0x3467('0x33')]['bind'](this));ami['on'](_0x3467('0x34'),this[_0x3467('0x35')]['bind'](this));ami['on'](_0x3467('0x36'),this[_0x3467('0x37')][_0x3467('0x2e')](this));ami['on'](_0x3467('0x38'),this[_0x3467('0x39')][_0x3467('0x2e')](this));ami['on'](_0x3467('0x3a'),this[_0x3467('0x3b')][_0x3467('0x2e')](this));ami['on'](_0x3467('0x3c'),this[_0x3467('0x3d')][_0x3467('0x2e')](this));this['loopCampaigns']();this[_0x3467('0x3e')]();RpcSetting[_0x3467('0x3f')]()[_0x3467('0x40')](function(_0x5a598c){previewRecallmeReminderInterval=_0x5a598c['previewRecallmeReminderInterval'];});}function isNotNull(_0x8a6c0e){return _0x8a6c0e!==null&&!_[_0x3467('0x41')](_0x8a6c0e);}function msgResponse(_0x1e41d7,_0x30dc4b,_0x36785a){return{'action':_0x1e41d7,'response':_0x30dc4b,'message':_0x36785a,'stack':_0x36785a};}function emit(_0x4154d2,_0x36e618,_0xa35127){io['to'](_0x4154d2)[_0x3467('0x42')](_0x36e618,_0xa35127);}function emitOutboundVoiceQueueSummary(_0x2f9f50){if(_0x2f9f50[_0x3467('0x43')]===_0x3467('0x44')){logger[_0x3467('0x45')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x3467('0x46')](_0x2f9f50,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x2f9f50['name']),_0x3467('0x47'),_0x2f9f50);}}function checkGetDataPredictive(_0x201fb3){if(isNotNull(_0x201fb3)&&!_[_0x3467('0x48')](_0x201fb3)){loggerPredictive['info'](_0x3467('0x49'));loggerPredictive[_0x3467('0x4a')](_0x3467('0x4b'),_0x201fb3[_0x3467('0x4c')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x4d'),_0x201fb3['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x3467('0x4a')](_0x3467('0x4e'),_0x201fb3[_0x3467('0x4f')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x50'),_0x201fb3[_0x3467('0x51')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x52'),_0x201fb3['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3467('0x4a')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x201fb3[_0x3467('0x53')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x54'));if(_0x201fb3['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3467('0x41')](_0x201fb3[_0x3467('0x53')])&&_0x201fb3['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x3467('0x41')](_0x201fb3[_0x3467('0x55')])&&_0x201fb3[_0x3467('0x55')]>0x0){return!![];}loggerPredictive[_0x3467('0x4a')](_0x3467('0x56'));}else{loggerPredictive[_0x3467('0x4a')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x3467('0x4a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3e285f){return function(_0x2862be){loggerPredictive['info'](_0x3467('0x57'));loggerPredictive[_0x3467('0x4a')](_0x3467('0x58'),_0x2862be[_0x3467('0x59')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x5a'),_0x2862be['erlangCallToSecond']);loggerPredictive[_0x3467('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2862be[_0x3467('0x5b')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x5c'),_0x2862be[_0x3467('0x5d')]);loggerPredictive[_0x3467('0x4a')](_0x3467('0x5e'),_0x2862be['erlangAbandonmentRate']);loggerPredictive[_0x3467('0x4a')](_0x3467('0x54'));_[_0x3467('0x5f')](_0x3e285f,_0x2862be);};}function ifInterval(_0x4e0293,_0x553a75){if(_[_0x3467('0x41')](_0x553a75)){return![];}return utils[_0x3467('0x60')](undefined,_0x553a75)<_0x4e0293*0x3c;}function clearPredictiveAttributes(_0xc5f6f8){if(_0xc5f6f8[_0x3467('0x28')]){_0xc5f6f8[_0x3467('0x28')]=undefined;loggerPredictive['debug'](_0xc5f6f8[_0x3467('0x61')],_0x3467('0x62'));}if(_0xc5f6f8[_0x3467('0x27')]){_0xc5f6f8[_0x3467('0x27')]=undefined;loggerPredictive[_0x3467('0x45')](_0xc5f6f8[_0x3467('0x61')],_0x3467('0x63'));}if(_0xc5f6f8[_0x3467('0x64')]){clearInterval(_0xc5f6f8[_0x3467('0x64')]);_0xc5f6f8['handlePredictive']=undefined;loggerPredictive[_0x3467('0x45')](_0xc5f6f8[_0x3467('0x61')],_0x3467('0x65'));}}function loggerCatchPredictive(_0x17e98b,_0x345d78){return function(_0x47bee1){loggerPredictive[_0x3467('0x66')](_0x345d78['name'],_0x17e98b);loggerPredictive['error'](_0x47bee1['stack']);clearPredictiveAttributes(_0x345d78);};}function loggerCatch(_0x1a0f13){return function(_0x46d248){logger[_0x3467('0x66')](_0x1a0f13,util[_0x3467('0x46')](_0x46d248,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x459f72,_0xcd9ccd,_0xaa436f){return function(_0x2ec50e){utils[_0x3467('0x67')](_0xcd9ccd,_0xaa436f,0x0);_0xcd9ccd[_0x3467('0x68')]=0x0;logger['error'](_0x459f72,util[_0x3467('0x46')](_0x2ec50e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x23e396){return function(_0x5653a3){if(isNotNull(_0x5653a3)&&isNotNull(_0x5653a3[0x0])){if(_0x5653a3[0x0]['contactsRescheduled']>0x0){_0x23e396[_0x3467('0x69')]=utils[_0x3467('0x6a')]['CONTACTS_RESCHEDULED'];logger[_0x3467('0x4a')](_0x3467('0x6b')+_0x23e396[_0x3467('0x61')],_0x5653a3[0x0][_0x3467('0x6c')],_0x3467('0x6d'));}else{_0x23e396[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x6e')];logger[_0x3467('0x4a')](_0x3467('0x6f')+_0x23e396[_0x3467('0x61')]);}}};}function createObjHistory(_0x4de2e7,_0x52eee2,_0x1458ae,_0x39b17a,_0x13790a){_0x4de2e7[_0x3467('0x69')]=_0x1458ae;var _0x31a2ab=new Action(_0x4de2e7,_0x52eee2);var _0x2d9cf0=new History(_0x31a2ab);_0x2d9cf0[_0x3467('0x70')]=_0x39b17a;_0x2d9cf0[_0x3467('0x71')]=_0x13790a;_0x2d9cf0[_0x3467('0x72')]=_0x31a2ab['starttime'];return _0x2d9cf0;}function unlockQueueStatus(_0x4ab353,_0x556d12){setTimeout(function(){if(_[_0x3467('0x41')](_0x4ab353[_0x3467('0x73')])){loggerBooked[_0x3467('0x66')](_0x3467('0x74'),_0x556d12);}_0x4ab353[_0x3467('0x73')]=!![];loggerBooked[_0x3467('0x4a')](_0x3467('0x75'),_0x556d12,JSON['stringify'](_[_0x3467('0x76')](_0x4ab353,[_0x3467('0x61'),_0x3467('0x73')])));},0x1f3);}function checkInterval(_0x47a6dc){return function(){if(!isNotNull(_0x47a6dc[_0x3467('0x77')])){_0x47a6dc[_0x3467('0x69')]=utils['CAMPAIGN_STATUS'][_0x3467('0x78')];throw _0x47a6dc[_0x3467('0x61')]+_0x3467('0x79');}if(!isNotNull(_0x47a6dc['Interval'][_0x3467('0x7a')])){_0x47a6dc[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x78')];throw _0x47a6dc['name']+_0x3467('0x79');}if(!isNotNull(_[_0x3467('0x48')](_0x47a6dc[_0x3467('0x77')]['Intervals']))){_0x47a6dc['message']=utils['CAMPAIGN_STATUS'][_0x3467('0x78')];throw _0x47a6dc[_0x3467('0x61')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x2a4c3f){return function(){if(!utils[_0x3467('0x7b')](_0x2a4c3f)){_0x2a4c3f['message']=utils[_0x3467('0x6a')][_0x3467('0x7c')];throw _0x2a4c3f['name']+_0x3467('0x7d');}};}function emitCampaignSummary(_0x303b45){if(utils['isIVRCampaign'](_0x303b45)){emit(util['format'](_0x3467('0x7e'),_0x303b45[_0x3467('0x61')]),_0x3467('0x7f'),_0x303b45);}}function loggerCatchQueueSummary(_0x28d7d8,_0xe6e4c7){return function(_0x1f24ef){clearPredictiveAttributes(_0xe6e4c7);emitCampaignSummary(_0xe6e4c7);loggerSyncQueueSummary[_0x3467('0x45')](_0x28d7d8,util[_0x3467('0x46')](_0x1f24ef,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4ea53b){if(_0x4ea53b[_0x3467('0x80')]){if(_0x4ea53b[_0x3467('0x81')]===0x0){_0x4ea53b[_0x3467('0x80')]=![];_0x4ea53b[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x7c')];loggerSyncQueueSummary[_0x3467('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4ea53b[_0x3467('0x61')],'is\x20not\x20active');}else{_0x4ea53b[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x82')];loggerSyncQueueSummary[_0x3467('0x45')](_0x3467('0x83'),_0x4ea53b[_0x3467('0x61')],_0x3467('0x84'));}emitCampaignSummary(_0x4ea53b);}}function myreject(_0x3d15ab){return function(_0x176702){return _0x3d15ab(msgResponse(_0x3467('0x85'),_0x3467('0x86'),JSON[_0x3467('0x87')](_0x176702)));};}Dialer['prototype'][_0x3467('0x88')]=function(_0x486625){return!_['isUndefined'](_0x486625)&&_0x486625&&!_[_0x3467('0x41')](_0x486625[_0x3467('0x61')])&&!_[_0x3467('0x41')](_0x486625[_0x3467('0x89')])&&_0x486625[_0x3467('0x89')]&&(this['trunks'][util['format'](_0x3467('0x8a'),_0x486625['name'])][_0x3467('0x8b')]===_0x3467('0x8c')||this[_0x3467('0x21')][util['format'](_0x3467('0x8a'),_0x486625[_0x3467('0x61')])]['status']===_0x3467('0x8d'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x364e6d){var _0x33966e=this;return function(){if(!_0x33966e[_0x3467('0x88')](_0x364e6d[_0x3467('0x8e')])){if(!_0x33966e['isTrunkReachable'](_0x364e6d['TrunkBackup'])){_0x364e6d[_0x3467('0x69')]=utils[_0x3467('0x6a')]['TRUNK_NOT_REACHABLE'];throw _0x364e6d[_0x3467('0x61')]+_0x3467('0x8f');}}};};Dialer['prototype'][_0x3467('0x90')]=function(_0x418eb3,_0x3b3824,_0x176d9c,_0x3976d9){var _0x5786aa=this;return function(){var _0x354a56=!![];return _0x5786aa[_0x3467('0x91')](_0x418eb3,_0x3b3824,_0x176d9c,_0x3976d9,_0x354a56);};};Dialer[_0x3467('0x92')][_0x3467('0x93')]=function(_0x10967b,_0x58600e,_0x400e8d,_0x23ede3){var _0x276ad2=this;return function(){var _0x12bb11=![];return _0x276ad2['ifTimeIvr'](_0x10967b[_0x3467('0x7a')],_0x58600e,_0x400e8d,_0x23ede3,_0x12bb11);};};Dialer[_0x3467('0x92')]['ifTimeIvr']=function(_0xe24476,_0x32d311,_0x2a6cfe,_0x39794c,_0x3632c0){var _0x103ab6=[];return new Promise(function(_0x8b9e4f,_0x3816a2){if(!isNotNull(_0xe24476)){_0x39794c[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x78')];return _0x3816a2(msgResponse(_0x3467('0x94'),'Failure',_0x2a6cfe+_0x3467('0x95')));}if(_[_0x3467('0x48')](_0xe24476)){_0x39794c[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x96')];return _0x3816a2(msgResponse(_0x3467('0x94'),'Failure',_0x2a6cfe+_0x3467('0x97')));}if(_0x32d311&&_[_0x3467('0x41')](config[_0x3467('0x98')][_0x32d311])){_0x39794c[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x99')];return _0x3816a2(msgResponse('ifTime',_0x3467('0x9a'),_0x2a6cfe+_0x3467('0x9b')+_0x32d311));}if(_[_0x3467('0x9c')](_0xe24476)){for(var _0x34bc3b=0x0;_0x34bc3b<_0xe24476['length'];_0x34bc3b+=0x1){_0x103ab6[_0x3467('0x9d')](ami[_0x3467('0x9e')]({'action':'command','command':util[_0x3467('0x9f')](_0x3467('0xa0'),_0xe24476[_0x34bc3b]['interval'],!_['isUndefined'](config['timezones'][_0x32d311])?_0x32d311:'')})[_0x3467('0x40')](function(_0x18f963){return _0x18f963[_0x3467('0xa1')][_0x3467('0xa2')]('true')>=0x0;})[_0x3467('0xa3')](myreject(_0x3816a2)));}}else{_0x103ab6[_0x3467('0x9d')](ami[_0x3467('0x9e')]({'action':_0x3467('0xa4'),'command':util[_0x3467('0x9f')]('iftime\x20%s,%s',_0xe24476,!_[_0x3467('0x41')](config['timezones'][_0x32d311])?_0x32d311:'')})[_0x3467('0x40')](function(_0x53e864){return _0x53e864['content'][_0x3467('0xa2')](_0x3467('0xa5'))>=0x0;})[_0x3467('0xa3')](myreject(_0x3816a2)));}Promise[_0x3467('0xa6')](_0x103ab6)[_0x3467('0x40')](function(_0x30dfcc){var _0x2a7e26=_[_0x3467('0xa7')](_0x30dfcc);if(_0x2a7e26){return _0x8b9e4f(_0x2a7e26);}else{_0x39794c[_0x3467('0x69')]=_0x3632c0?utils[_0x3467('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3467('0x6a')][_0x3467('0xa8')];return _0x3816a2(msgResponse(_0x3467('0xa9'),_0x3467('0x9a'),_0x3467('0xaa')+_0x3632c0+'\x20'+_0x2a6cfe+_0x3467('0xab')+util['inspect'](_0xe24476,{'showHidden':![],'depth':null})+_0x3467('0xac')+_0x32d311));}})[_0x3467('0xa3')](function(_0x398f16){return _0x3816a2(msgResponse(_0x3467('0x94'),'Failure',JSON[_0x3467('0x87')](_0x398f16)));});});};Dialer[_0x3467('0x92')][_0x3467('0xad')]=function(){var _0x374206=this;return cmHopper[_0x3467('0xae')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x374206[_0x3467('0xaf')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0xab2cef=this;var _0x2ba1d0;for(var _0x419496 in this[_0x3467('0x1f')]){if(typeof this[_0x3467('0x1f')][_0x419496]!==_0x3467('0xb0')){_0x2ba1d0=this['campaigns'][_0x419496];if(utils[_0x3467('0xb1')](_0x2ba1d0)&&utils[_0x3467('0x7b')](_0x2ba1d0)){_0x2ba1d0[_0x3467('0x80')]=!![];Promise[_0x3467('0xb2')]()[_0x3467('0x40')](checkIsIVRCampaignActive(_0x2ba1d0))['then'](checkInterval(_0x2ba1d0))['then'](_0xab2cef[_0x3467('0xb3')](_0x2ba1d0))[_0x3467('0x40')](_0xab2cef[_0x3467('0x90')](_0x2ba1d0[_0x3467('0xb4')],_0x2ba1d0[_0x3467('0xb5')],_0x2ba1d0[_0x3467('0x61')],_0x2ba1d0))[_0x3467('0x40')](_0xab2cef[_0x3467('0x93')](_0x2ba1d0[_0x3467('0x77')],_0x2ba1d0[_0x3467('0xb5')],_0x2ba1d0[_0x3467('0x61')],_0x2ba1d0))[_0x3467('0x40')](_0xab2cef[_0x3467('0xb6')](_0x2ba1d0))[_0x3467('0xa3')](loggerCatchQueueSummary('[syncCampaigns]',_0x2ba1d0));}else{notSendMessagesCampaign(_0x2ba1d0);}}}};Dialer[_0x3467('0x92')][_0x3467('0xb7')]=function(_0x5c02f1){if(_0x5c02f1[_0x3467('0xb8')]!==_0x3467('0xa')){clearPredictiveAttributes(_0x5c02f1);}switch(_0x5c02f1['dialMethod']){case _0x3467('0xb9'):this[_0x3467('0xba')](_0x5c02f1,0x1);break;case _0x3467('0xbb'):this[_0x3467('0xba')](_0x5c02f1,_0x5c02f1[_0x3467('0xbc')]);break;case _0x3467('0xa'):this[_0x3467('0xa')](_0x5c02f1);break;case _0x3467('0x9'):this[_0x3467('0xba')](_0x5c02f1,0x1);break;default:logger[_0x3467('0x66')](_0x3467('0xbd'),_0x5c02f1[_0x3467('0x61')],_0x3467('0xbe'));}};Dialer['prototype']['ifTime']=function(_0x2e3161,_0x29cc33){var _0x2738fd=_0x2e3161[_0x3467('0xb5')];var _0x31905a=_0x29cc33?_0x2e3161[_0x3467('0xb4')]:_0x2e3161[_0x3467('0x77')]['Intervals'];logger[_0x3467('0xbf')]('Dialer::ifTime()',_0x31905a,_0x2738fd,_0x2e3161[_0x3467('0x61')],util['format'](_0x3467('0xc0'),_0x2e3161['name'],_0x2e3161['id']));var _0x452ec4=null;return Interval[_0x3467('0xc1')](_0x31905a,_0x2738fd)['then'](function(_0xb498a4){if(_0xb498a4===!![]){return _0xb498a4;}else{_0x2e3161[_0x3467('0x69')]=_0x29cc33?utils[_0x3467('0x6a')][_0x3467('0xc2')]:utils[_0x3467('0x6a')]['OVERTIME_INTERVAL'];_0x452ec4=msgResponse(_0x3467('0xa9'),_0x3467('0x9a'),'Global:\x20'+_0x29cc33+'\x20'+_0x2e3161[_0x3467('0x61')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3467('0x46')](_0x31905a,{'showHidden':![],'depth':null})+_0x3467('0xac')+_0x2738fd);}if(_0x452ec4!==null){logger[_0x3467('0xbf')](_0x3467('0xc3'),_0x452ec4);_0x452ec4['isGlobal']=_0x29cc33;throw _0x452ec4;}})[_0x3467('0xa3')](function(_0x5c76b7){logger[_0x3467('0x66')](_0x3467('0xc4'),_0x5c76b7);throw msgResponse(_0x3467('0x85'),_0x3467('0x86'),util[_0x3467('0x46')](_0x5c76b7,{'showHidden':![],'depth':null}));});};Dialer[_0x3467('0x92')][_0x3467('0x2d')]=function(_0x8d19e4){if(this[_0x3467('0x1e')][_0x8d19e4[_0x3467('0xc5')]]){if(this[_0x3467('0xc6')][_0x8d19e4[_0x3467('0xc7')]]&&this['uniqueId'][_0x8d19e4['uniqueid']][_0x3467('0x43')]!==_0x3467('0xc8')){this[_0x3467('0xc9')](this[_0x3467('0x1e')][_0x8d19e4[_0x3467('0xc5')]]);this[_0x3467('0xc6')][_0x8d19e4[_0x3467('0xc7')]][_0x3467('0xca')]=moment()[_0x3467('0x9f')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x3467('0x92')][_0x3467('0x31')]=function(_0x1ad5e3){var _0x35c16a=this['uniqueId'][_0x1ad5e3[_0x3467('0xc7')]];if(this[_0x3467('0x1e')][_0x1ad5e3[_0x3467('0xc5')]]){if(_0x35c16a&&_0x35c16a[_0x3467('0x43')]!==_0x3467('0xc8')){delete this[_0x3467('0xc6')][_0x1ad5e3[_0x3467('0xc7')]];this['voiceQueues'][_0x1ad5e3['queue']][_0x3467('0xcb')]+=0x1;var _0x44fd44=new AgentComplete(_0x35c16a,_0x1ad5e3);if(_0x1ad5e3[_0x3467('0xcc')]===_0x3467('0xcd')){_0x44fd44[_0x3467('0xce')]=this[_0x3467('0x1e')][_0x1ad5e3['queue']][_0x3467('0xcf')]&&this[_0x3467('0x1e')][_0x1ad5e3['queue']][_0x3467('0xd0')]?moment()[_0x3467('0x9f')](_0x3467('0xd1')):undefined;}hopperUtils['createHistory'](_0x44fd44)['catch'](loggerCatch(_0x3467('0xd2')));hopperUtils['moveContactManagedDialer'](_0x44fd44)[_0x3467('0xa3')](loggerCatch(_0x3467('0xd3')));}}};Dialer[_0x3467('0x92')][_0x3467('0xd4')]=function(_0x30a8ca){var _0x12d36f=this['uniqueId'][_0x30a8ca[_0x3467('0xc7')]];var _0x9fa646=this;var _0x59ff3e=![];var _0x1519f9;var _0x27aa47;if(this[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]]){if(_0x12d36f&&_0x12d36f['type']!==_0x3467('0xc8')){delete this['uniqueId'][_0x30a8ca['uniqueid']];this[_0x3467('0xc9')](this[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]]);_0x12d36f[_0x3467('0xd5')]=moment()[_0x3467('0x9f')](_0x3467('0xd1'));var _0x169f2d=new QueueCallerAbandon(_0x12d36f,_0x30a8ca);if(utils[_0x3467('0x60')](_0x12d36f[_0x3467('0xd5')],_0x12d36f['responsetime'])>=_0x12d36f[_0x3467('0xd6')]){this[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]][_0x3467('0x4f')]+=0x1;this[_0x3467('0x1e')][_0x30a8ca['queue']][_0x3467('0xd7')]+=0x1;this['voiceQueues'][_0x30a8ca['queue']][_0x3467('0xd8')]+=0x1;_0x169f2d[_0x3467('0x70')]=0xa;_0x169f2d[_0x3467('0x71')]=_0x3467('0xd9');_0x169f2d[_0x3467('0xda')]=_0x3467('0xdb');_0x169f2d[_0x3467('0xce')]=this[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]][_0x3467('0xcf')]?moment()[_0x3467('0x9f')](_0x3467('0xd1')):undefined;_0x169f2d[_0x3467('0xdc')]+=0x1;_0x169f2d[_0x3467('0xdd')]+=0x1;_0x1519f9=this['voiceQueues'][_0x30a8ca[_0x3467('0xc5')]]['dialDropRetryFrequency'];_0x27aa47=this[_0x3467('0x1e')][_0x30a8ca['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3467('0xde')](_0x169f2d,_0x169f2d[_0x3467('0x70')],_0x12d36f[_0x3467('0xdf')])['then'](function(_0x52c8a8){_0x59ff3e=_0x52c8a8[_0x3467('0xe0')]==0x1;if(_0x169f2d[_0x3467('0xdc')]>=_0x9fa646[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]][_0x3467('0xe1')]){_0x9fa646['queueCallerAbandonCreateState'](_0x169f2d,_0x52c8a8[_0x3467('0xe0')]);}else{hopperUtils[_0x3467('0xe2')]({'active':![],'countdropretry':_0x169f2d[_0x3467('0xdc')],'scheduledat':moment()[_0x3467('0xe3')](_0x9fa646[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]][_0x3467('0xe4')],_0x3467('0xe5'))[_0x3467('0x9f')](_0x3467('0xd1')),'ContactId':_0x12d36f['ContactId'],'ListId':_0x12d36f[_0x3467('0xe6')],'VoiceQueueId':_0x12d36f['VoiceQueueId']||undefined,'CampaignId':_0x12d36f[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0xe8')));var _0xf1aa37=new History(_0x169f2d);_0xf1aa37[_0x3467('0x70')]=0xa;_0xf1aa37['statedesc']='Drop';_0xf1aa37[_0x3467('0xe9')]=moment()['format'](_0x3467('0xd1'));_0xf1aa37[_0x3467('0x72')]=_0xf1aa37['starttime'];_0xf1aa37[_0x3467('0xea')]=_0x169f2d[_0x3467('0xea')];_0xf1aa37[_0x3467('0xeb')]=_0x169f2d[_0x3467('0xeb')];hopperUtils[_0x3467('0xec')](_0xf1aa37)[_0x3467('0xa3')](loggerCatch(_0x3467('0xed')));}})[_0x3467('0x40')](function(){if(_0x59ff3e)hopperUtils[_0x3467('0xee')](_0x169f2d,_0x1519f9,_0x27aa47)[_0x3467('0x40')](function(){return 0x1;});});}else{this[_0x3467('0x1e')][_0x30a8ca['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x30a8ca['queue']][_0x3467('0xef')]+=0x1;_0x169f2d['state']=0xb;_0x169f2d[_0x3467('0x71')]=_0x3467('0xf0');_0x169f2d[_0x3467('0xda')]=_0x3467('0xf1');_0x169f2d['countabandonedretry']+=0x1;_0x169f2d[_0x3467('0xdd')]+=0x1;_0x1519f9=this['voiceQueues'][_0x30a8ca[_0x3467('0xc5')]][_0x3467('0xf2')];_0x27aa47=this[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3467('0xde')](_0x169f2d,_0x169f2d[_0x3467('0x70')],_0x12d36f[_0x3467('0xdf')])[_0x3467('0x40')](function(_0x285f2d){if(_0x169f2d['countabandonedretry']>=_0x9fa646[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]][_0x3467('0xf3')]){_0x9fa646[_0x3467('0xf4')](_0x169f2d,_0x285f2d[_0x3467('0xe0')]);}else{hopperUtils[_0x3467('0xe2')]({'active':![],'countabandonedretry':_0x169f2d[_0x3467('0xf5')],'scheduledat':moment()['add'](_0x9fa646[_0x3467('0x1e')][_0x30a8ca[_0x3467('0xc5')]]['dialAbandonedRetryFrequency'],_0x3467('0xe5'))[_0x3467('0x9f')](_0x3467('0xd1')),'ContactId':_0x12d36f[_0x3467('0xf6')],'ListId':_0x12d36f[_0x3467('0xe6')],'VoiceQueueId':_0x12d36f[_0x3467('0xf7')]||undefined,'CampaignId':_0x12d36f[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0xf8')));var _0x2ca3e0=new History(_0x169f2d);_0x2ca3e0[_0x3467('0x70')]=0xb;_0x2ca3e0[_0x3467('0x71')]=_0x3467('0xf0');_0x2ca3e0[_0x3467('0xe9')]=moment()[_0x3467('0x9f')](_0x3467('0xd1'));_0x2ca3e0[_0x3467('0x72')]=_0x2ca3e0[_0x3467('0xe9')];_0x2ca3e0[_0x3467('0xea')]=_0x169f2d[_0x3467('0xea')];_0x2ca3e0[_0x3467('0xeb')]=_0x169f2d[_0x3467('0xeb')];hopperUtils[_0x3467('0xec')](_0x2ca3e0)[_0x3467('0xa3')](loggerCatch(_0x3467('0xf9')));}})[_0x3467('0x40')](function(){if(_0x59ff3e)hopperUtils[_0x3467('0xee')](_0x169f2d,_0x1519f9,_0x27aa47)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x3467('0x37')]=function(_0x2d436f){if(this[_0x3467('0x24')][_0x2d436f['uniqueid']]){this[_0x3467('0x24')][_0x2d436f[_0x3467('0xc7')]][_0x3467('0xfa')]=_0x2d436f[_0x3467('0xfa')];}if(this[_0x3467('0xc6')][_0x2d436f[_0x3467('0xc7')]]){this[_0x3467('0xc6')][_0x2d436f['uniqueid']]['channel']=_0x2d436f[_0x3467('0xfa')];}};Dialer['prototype'][_0x3467('0x3b')]=function(_0x1de3db){if(!this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]]){return;}var _0xeeda19=this['voiceQueues'][this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]]['queue']]['strategy']||_0x3467('0xfc');if(_0xeeda19==='roundrobin'){if(this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]]&&_[_0x3467('0xfd')](this['actions'][_0x1de3db[_0x3467('0xfb')]][_0x3467('0xfe')])&&_0x1de3db[_0x3467('0x8b')]==='1'&&_0x1de3db[_0x3467('0xff')]==='0'){if(this[_0x3467('0x20')][_0x1de3db[_0x3467('0x100')]]){if(!this['agents'][_0x1de3db['stateinterface']][_0x3467('0xfe')]){this['agents'][_0x1de3db['stateinterface']][_0x3467('0xfe')]=!![];this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]][_0x3467('0xfe')]=!![];this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]][_0x3467('0x100')]=_0x1de3db[_0x3467('0x100')];}}}}else if(_0xeeda19===_0x3467('0xfc')){if(this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]]){if(this['agents'][_0x1de3db['stateinterface']]){this[_0x3467('0x24')][_0x1de3db['actionid']][_0x3467('0x100')]=_0x1de3db['stateinterface'];if(_[_0x3467('0xfd')](this[_0x3467('0x2a')][this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]][_0x3467('0xc5')]])){this['queueBooked'][this['actions'][_0x1de3db[_0x3467('0xfb')]][_0x3467('0xc5')]]=[];}this[_0x3467('0x2a')][this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]][_0x3467('0xc5')]][_0x3467('0x9d')](_['merge'](_['pick'](this[_0x3467('0x24')][_0x1de3db[_0x3467('0xfb')]],['idHopper',_0x3467('0x100')]),{'status':_0x1de3db[_0x3467('0x8b')],'paused':_0x1de3db[_0x3467('0xff')]}));}}}};Dialer[_0x3467('0x92')][_0x3467('0x3d')]=function(_0x549ca1){if(!this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]]){return;}var _0xf541fc=this;var _0x414739=this['voiceQueues'][this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]];var _0x2b7b25=_0x414739[_0x3467('0x101')]||_0x3467('0xfc');if(_0x2b7b25===_0x3467('0x102')){if(this[_0x3467('0x24')][_0x549ca1['actionid']]&&this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0x100')]){this[_0x3467('0x1d')][_0x3467('0x103')](this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0x104')],this['actions'][_0x549ca1[_0x3467('0xfb')]][_0x3467('0x100')])[_0x3467('0xa3')](function(_0xa41f7b){logger['error'](_0x3467('0x105'),util['inspect'](_0xa41f7b,{'showHidden':![],'depth':null}));})['finally'](function(){_0xf541fc[_0x3467('0xc9')](_0xf541fc[_0x3467('0x1e')][_0xf541fc[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]]);_0xf541fc[_0x3467('0x20')][_0xf541fc[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0x100')]]['locked']=![];delete _0xf541fc[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]];unlockQueueStatus(_0x414739);});}else{this[_0x3467('0xc9')](this[_0x3467('0x1e')][this['actions'][_0x549ca1['actionid']][_0x3467('0xc5')]]);hopperUtils[_0x3467('0xe2')]({'active':![],'ContactId':this['actions'][_0x549ca1['actionid']]['ContactId'],'ListId':this['actions'][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xe6')],'VoiceQueueId':this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xf7')]||undefined,'CampaignId':this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0x106')));delete this['actions'][_0x549ca1['actionid']];unlockQueueStatus(_0x414739);}}else if(_0x2b7b25==='rrmemory'){var _0x4a3f67;if(this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]]&&!_['isEmpty'](this[_0x3467('0x2a')][this['actions'][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]])){if(this[_0x3467('0x2b')][_0xf541fc['actions'][_0x549ca1[_0x3467('0xfb')]]['queue']]){this[_0x3467('0x2b')][_0xf541fc[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]]=this[_0x3467('0x2b')][this['actions'][_0x549ca1['actionid']][_0x3467('0xc5')]]?this[_0x3467('0x2b')][this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]]:this[_0x3467('0x2a')][this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]]?this[_0x3467('0x2a')][this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]][_0x3467('0x107')]||0x0:0x0;}this[_0x3467('0x2a')][this['actions'][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]]['_rr']=this[_0x3467('0x2b')][this[_0x3467('0x24')][_0x549ca1[_0x3467('0xfb')]][_0x3467('0xc5')]];for(var _0x34c3e1=0x0;_0x34c3e1=_0x1c0cf8[_0x3467('0x12a')]){_0x3b05d5['stateGlobal'](_0x64e05,_0x4dd76b,_0xef80a6,'reason19\x20machine....');}else{if(_0x64e05['countmachineretry']>=_0x1c0cf8[_0x3467('0x12b')]){_0x3b05d5[_0x3467('0x12c')](_0x64e05,_0x4dd76b,_0xef80a6,_0x3467('0x12d'));}else{hopperUtils[_0x3467('0xe2')]({'active':![],'countmachineretry':_0x64e05[_0x3467('0x125')],'scheduledat':moment()[_0x3467('0xe3')](_0x1c0cf8[_0x3467('0x12e')],_0x3467('0xe5'))['format'](_0x3467('0xd1')),'ContactId':_0x64e05[_0x3467('0xf6')],'ListId':_0x64e05[_0x3467('0xe6')],'VoiceQueueId':_0x64e05[_0x3467('0xf7')]||undefined,'CampaignId':_0x64e05[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x4dd76b({'reschedule':0x1});}}});}if(_0x15e0cd[_0x3467('0x43')]===_0x3467('0xc8')&&this[_0x3467('0x1f')][_0x15e0cd[_0x3467('0xc5')]]['dialAMDActive']&&_0x5ab980[_0x3467('0x119')]==='HANGUP'){delete this[_0x3467('0xc6')][_0x5ab980[_0x3467('0xc7')]];this[_0x3467('0xc9')](this[_0x3467('0x1f')][_0x15e0cd[_0x3467('0xc5')]]);_0x27051e=new Hangup(_0x15e0cd,_0x5ab980);_0x27051e[_0x3467('0x70')]=0x12;_0x27051e[_0x3467('0x71')]=_0x3467('0x11c');_0x27051e[_0x3467('0x11d')]=_0x3467('0x11e');ami[_0x3467('0x42')](_0x3467('0x126'),ut[_0x3467('0x11f')](_0x27051e,_0x3467('0x120')));this['saveInDb'](_0x27051e,_0x3467('0x12f'),'[syncHangupInAMDIvr]');}if(_0x15e0cd[_0x3467('0x43')]===_0x3467('0xc8')&&this[_0x3467('0x1f')][_0x15e0cd[_0x3467('0xc5')]][_0x3467('0x118')]&&_0x5ab980['value']===_0x3467('0x123')){return new Promise(function(_0x3dab6c,_0x547886){delete _0x3b05d5[_0x3467('0xc6')][_0x5ab980['uniqueid']];_0x3b05d5[_0x3467('0xc9')](_0x3b05d5[_0x3467('0x1f')][_0x15e0cd[_0x3467('0xc5')]]);_0x3b05d5[_0x3467('0x1f')][_0x15e0cd['queue']][_0x3467('0xcb')]+=0x1;_0x3b05d5[_0x3467('0x1f')][_0x15e0cd[_0x3467('0xc5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x56a95b=_0x3b05d5[_0x3467('0x1f')][_0x15e0cd['queue']];var _0x2c1267=new Hangup(_0x15e0cd,_0x5ab980);_0x2c1267['state']=0x13;_0x2c1267[_0x3467('0x71')]=_0x3467('0x124');_0x2c1267['membername']=_0x3467('0x11e');_0x2c1267[_0x3467('0x125')]+=0x1;_0x2c1267['countglobal']+=0x1;_0x2c1267[_0x3467('0x120')]=!![];ami['emit'](_0x3467('0x126'),ut[_0x3467('0x11f')](_0x2c1267,_0x3467('0x120')));hopperUtils[_0x3467('0xec')](_0x2c1267)[_0x3467('0xa3')](loggerCatch(_0x3467('0x127')));if(_0x2c1267[_0x3467('0x130')]+_0x2c1267[_0x3467('0x131')]+_0x2c1267[_0x3467('0x128')]+_0x2c1267[_0x3467('0x132')]+_0x2c1267[_0x3467('0xdc')]+_0x2c1267[_0x3467('0xf5')]+_0x2c1267[_0x3467('0x125')]+_0x2c1267[_0x3467('0x129')]>=_0x56a95b[_0x3467('0x12a')]){_0x3b05d5[_0x3467('0x133')](_0x2c1267,_0x3dab6c,_0x547886,_0x3467('0x134'));}else{if(_0x2c1267[_0x3467('0x125')]>=_0x56a95b[_0x3467('0x12b')]){_0x3b05d5[_0x3467('0x12c')](_0x2c1267,_0x3dab6c,_0x547886,_0x3467('0x12d'));}else{hopperUtils[_0x3467('0xe2')]({'active':![],'countmachineretry':_0x2c1267['countmachineretry'],'scheduledat':moment()[_0x3467('0xe3')](_0x56a95b[_0x3467('0x12e')],_0x3467('0xe5'))[_0x3467('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c1267[_0x3467('0xf6')],'ListId':_0x2c1267[_0x3467('0xe6')],'VoiceQueueId':_0x2c1267[_0x3467('0xf7')]||undefined,'CampaignId':_0x2c1267[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0x135')));_0x3dab6c({'reschedule':0x1});}}});}}};Dialer[_0x3467('0x92')][_0x3467('0x35')]=function(_0x1c5a82){var _0x5b537a=this[_0x3467('0xc6')][_0x1c5a82[_0x3467('0xc7')]];var _0x471748;if(_0x5b537a&&_0x5b537a['type']==='ivr'){delete this[_0x3467('0xc6')][_0x1c5a82[_0x3467('0xc7')]];this['updateOriginated'](this[_0x3467('0x1f')][_0x5b537a[_0x3467('0xc5')]]);this[_0x3467('0x1f')][_0x5b537a[_0x3467('0xc5')]]['ivrAnswerCallsDay']+=0x1;_0x471748=new Hangup(_0x5b537a,_0x1c5a82);hopperUtils[_0x3467('0xec')](_0x471748)['catch'](loggerCatch(_0x3467('0x136')));hopperUtils[_0x3467('0x137')](_0x471748)[_0x3467('0xa3')](loggerCatch(_0x3467('0x138')));}if(_0x5b537a&&_0x5b537a[_0x3467('0x43')]!==_0x3467('0xc8')&&isNotNull(this[_0x3467('0x1e')][_0x5b537a['queue']][_0x3467('0x139')])){delete this[_0x3467('0xc6')][_0x1c5a82['uniqueid']];this[_0x3467('0xc9')](this['voiceQueues'][_0x5b537a['queue']]);this[_0x3467('0x1e')][_0x5b537a['queue']][_0x3467('0xcb')]+=0x1;this[_0x3467('0x1e')][_0x5b537a['queue']][_0x3467('0x11b')]+=0x1;_0x471748=new Hangup(_0x5b537a,_0x1c5a82);_0x471748[_0x3467('0x70')]=0x10;_0x471748[_0x3467('0x71')]='AnswerAGI';_0x471748['membername']='AGI';hopperUtils[_0x3467('0xec')](_0x471748)[_0x3467('0xa3')](loggerCatch(_0x3467('0x136')));hopperUtils[_0x3467('0x137')](_0x471748)[_0x3467('0xa3')](loggerCatch(_0x3467('0x138')));}if(_0x5b537a&&_0x5b537a[_0x3467('0x43')]!=='ivr'&&!isNotNull(this[_0x3467('0x1e')][_0x5b537a[_0x3467('0xc5')]][_0x3467('0x139')])){delete this['uniqueId'][_0x1c5a82[_0x3467('0xc7')]];this['updateOriginated'](this[_0x3467('0x1e')][_0x5b537a[_0x3467('0xc5')]]);this[_0x3467('0x1e')][_0x5b537a['queue']][_0x3467('0x13a')]+=0x1;_0x471748=new Hangup(_0x5b537a,_0x1c5a82);_0x471748[_0x3467('0x70')]=0xc;_0x471748['statedesc']=_0x1c5a82['cause-txt'];_0x471748[_0x3467('0x11d')]=_0x3467('0x13b');hopperUtils[_0x3467('0xec')](_0x471748)[_0x3467('0xa3')](loggerCatch(_0x3467('0x136')));hopperUtils[_0x3467('0x137')](_0x471748)['catch'](loggerCatch(_0x3467('0x138')));}};Dialer[_0x3467('0x92')]['syncQueueSummary']=function(_0x5b9c68){var _0x5f3249=this;if(!_0x5f3249[_0x3467('0x2c')][_0x5b9c68[_0x3467('0x61')]]){_0x5f3249['queuesSummary'][_0x5b9c68[_0x3467('0x61')]]={'running':![]};}else if(_0x5f3249[_0x3467('0x2c')][_0x5b9c68[_0x3467('0x61')]][_0x3467('0x13c')]===!![]){return;}else if(_0x5f3249[_0x3467('0x2c')][_0x5b9c68[_0x3467('0x61')]][_0x3467('0x13c')]===![]){_0x5f3249[_0x3467('0x2c')][_0x5b9c68[_0x3467('0x61')]][_0x3467('0x13c')]=!![];}var _0x343f20=_0x5f3249['voiceQueues'][_0x5b9c68['name']];var _0x8f6a55=_0x343f20[_0x3467('0x69')]!==utils['CAMPAIGN_STATUS'][_0x3467('0x7c')];var _0x39cfec=utils[_0x3467('0x13d')](_0x343f20);_0x343f20[_0x3467('0x13e')]=utils[_0x3467('0x13f')](_0x343f20,_0x5f3249[_0x3467('0x21')]);Promise[_0x3467('0xb2')]()[_0x3467('0x40')](function(){if(_0x343f20['statusMessage']===utils[_0x3467('0x6a')][_0x3467('0x7c')]){if(_0x8f6a55){clearPredictiveAttributes(_0x343f20);_0x5b9c68[_0x3467('0x27')]=undefined;_0x5b9c68['startProgressive']=undefined;}if(_0x343f20[_0x3467('0x13e')]===utils[_0x3467('0x6a')][_0x3467('0x7c')]){_0x5b9c68['available']=0x0;_0x5b9c68[_0x3467('0xff')]=0x0;_0x5b9c68['inUse']=0x0;_0x5b9c68[_0x3467('0x140')]=0x0;_0x5b9c68[_0x3467('0x141')]=0x0;}}else if(_0x343f20[_0x3467('0x13e')]===utils[_0x3467('0x6a')][_0x3467('0x142')]&&!_0x39cfec){return _0x5f3249[_0x3467('0x94')](_0x343f20,!![])[_0x3467('0x40')](function(){return _0x5f3249['ifTime'](_0x343f20,![]);})[_0x3467('0x40')](function(){return _0x5f3249[_0x3467('0xb7')](_0x343f20);})[_0x3467('0xa3')](function(_0x51a9c3){loggerSyncQueueSummary[_0x3467('0x45')](_0x3467('0x143'),util[_0x3467('0x46')](_0x51a9c3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x343f20);});}else{clearPredictiveAttributes(_0x343f20);}})['then'](function(){var _0x4f9a9a=_0x5b9c68['compareToOutboundQueue'](_0x343f20);if(_0x4f9a9a||_0x343f20[_0x3467('0x144')]){_0x343f20['queueSummaryCountersUpdated']=![];_0x5b9c68['updateReportFromOutboundQueue'](_0x343f20);Object[_0x3467('0x145')](_0x343f20,_0x5b9c68);emitOutboundVoiceQueueSummary(_0x5b9c68);}_0x5f3249[_0x3467('0x2c')][_0x343f20[_0x3467('0x61')]][_0x3467('0x13c')]=![];})['catch'](function(_0x1f2e8e){logger[_0x3467('0x66')](_0x3467('0x143'),util[_0x3467('0x46')](_0x1f2e8e,{'showHidden':![],'depth':null}));_0x5f3249[_0x3467('0x2c')][_0x343f20[_0x3467('0x61')]][_0x3467('0x13c')]=![];});};Dialer[_0x3467('0x92')][_0x3467('0x33')]=_['throttle'](function(){var _0x3fda8a=_[_0x3467('0x146')](this['voiceQueues'],function(_0x3665bf){return _0x3665bf[_0x3467('0x147')];});var _0x3778d5=_['filter'](this[_0x3467('0x20')],function(_0x1b90de){return _0x1b90de[_0x3467('0x148')]&&_0x1b90de[_0x3467('0x8b')]===_0x3467('0x8c');});if(_0x3fda8a[_0x3467('0x149')]>0x0&&_0x3778d5[_0x3467('0x149')]>0x0){return Promise[_0x3467('0xb2')]()[_0x3467('0x40')](cmHopper[_0x3467('0x14a')](_[_0x3467('0x14b')](_0x3fda8a,'id'),previewRecallmeReminderInterval,_['map'](_0x3778d5,'id')))['then'](function(_0x4893fe){for(var _0x44af42=0x0;_0x44af42<_0x4893fe[_0x3467('0x149')];_0x44af42++){var _0x2c4847=_0x4893fe[_0x44af42][_0x3467('0x14c')][_0x3467('0x61')];if(_0x2c4847)io['to'](util[_0x3467('0x9f')]('user:%s',_0x2c4847))[_0x3467('0x42')](_0x3467('0x14d'),{'hopper':_0x4893fe[_0x44af42]});}})['catch'](function(_0x59b3b6){logger[_0x3467('0x66')](_0x3467('0x14e'),_0x59b3b6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3467('0x92')][_0x3467('0x3e')]=function(){var _0x31fce8=this;setInterval(function(){_0x31fce8[_0x3467('0x14f')](_0x31fce8[_0x3467('0xc6')],_0x3467('0x150'));_0x31fce8[_0x3467('0x14f')](_0x31fce8[_0x3467('0x24')],_0x3467('0x151'));},0x32c8);};Dialer[_0x3467('0x92')][_0x3467('0x14f')]=function(_0x119cac,_0x20cb7d){var _0x9cd90e=this;for(var _0x232be9 in _0x119cac){if(typeof _0x119cac[_0x232be9]!==_0x3467('0xb0')){this['sequence'][_0x3467('0x1a')](function(){if(!_[_0x3467('0xfd')](_0x119cac[_0x232be9])){return ami['Action']({'action':_0x3467('0x8b'),'channel':_0x119cac[_0x232be9]['channel']})[_0x3467('0xa3')](function(_0x55f348){if(_0x55f348[_0x3467('0x69')]===_0x3467('0x152')){setTimeout(function(){if(_0x119cac[_0x232be9]&&_0x119cac[_0x232be9]['type']!==_0x3467('0xc8')){_0x9cd90e['updateOriginated'](_0x9cd90e[_0x3467('0x1e')][_0x119cac[_0x232be9][_0x3467('0xc5')]]);logger[_0x3467('0x66')](_0x3467('0x153'),_0x20cb7d,_0x232be9,_0x119cac[_0x232be9][_0x3467('0xc5')]);delete _0x119cac[_0x232be9];}if(_0x119cac[_0x232be9]&&_0x119cac[_0x232be9][_0x3467('0x43')]===_0x3467('0xc8')){_0x9cd90e[_0x3467('0xc9')](_0x9cd90e[_0x3467('0x1f')][_0x119cac[_0x232be9]['queue']]);logger[_0x3467('0x66')](_0x3467('0x154'),_0x20cb7d,_0x232be9,_0x119cac[_0x232be9][_0x3467('0xc5')]);delete _0x119cac[_0x232be9];}},0x2328);}});}});}}};Dialer[_0x3467('0x92')][_0x3467('0x155')]=function(_0x9fd38d){return Promise[_0x3467('0xb2')]()[_0x3467('0x40')](voiceQueueRt[_0x3467('0x155')](_0x9fd38d))['catch'](loggerCatch(_0x3467('0x156')));};Dialer['prototype'][_0x3467('0xc9')]=function(_0x32b44b){if(!_[_0x3467('0x41')](_0x32b44b)&&_0x32b44b!==null){if(typeof _0x32b44b[_0x3467('0x81')]!==_0x3467('0xb0')){if(_0x32b44b['originated']>0x0){_0x32b44b[_0x3467('0x81')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3467('0x66')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3467('0x92')]['loggerHandler']=function(_0x1794d1,_0x2c1320){var _0x3c07fd=this;return function(_0x45a7fa){_0x3c07fd[_0x3467('0xc9')](_0x2c1320);logger[_0x3467('0x66')](_0x1794d1,util[_0x3467('0x46')](_0x45a7fa,{'showHidden':![],'depth':null}));};};Dialer[_0x3467('0x92')][_0x3467('0x157')]=function(_0x2bf9f6,_0x45d592,_0x407307){var _0x18839d={'state':0x19,'statedesc':_0x3467('0x158')};this[_0x3467('0xc9')](_0x45d592);this[_0x3467('0x159')](_[_0x3467('0x5f')](_0x18839d,_[_0x3467('0x76')](_0x407307,[_0x3467('0xf6'),_0x3467('0xe6'),'UserId',_0x3467('0xf7'),_0x3467('0xe7')])),_0x3467('0x15a'),_0x3467('0x15b'));logger[_0x3467('0x66')](_0x2bf9f6);};Dialer[_0x3467('0x92')][_0x3467('0x159')]=function(_0xea5543,_0x577341,_0xa780b2){hopperUtils[_0x3467('0xec')](_0xea5543)[_0x3467('0xa3')](loggerCatch(_0x577341));hopperUtils[_0x3467('0x137')](_0xea5543)['catch'](loggerCatch(_0xa780b2));};Dialer[_0x3467('0x92')][_0x3467('0xf4')]=function(_0xcb2779,_0x1ab190){hopperUtils[_0x3467('0xec')](_0xcb2779)[_0x3467('0xa3')](loggerCatch(_0x3467('0xd2')));if(_0x1ab190==0x0){hopperUtils['moveContactManagedDialer'](_0xcb2779)[_0x3467('0xa3')](loggerCatch(_0x3467('0x15c')));}};Dialer[_0x3467('0x92')][_0x3467('0x14e')]=function(_0xbd758){return Promise['resolve']()[_0x3467('0x40')](cmHopper[_0x3467('0x14a')](_0xbd758['id'],previewRecallmeReminderInterval))['then'](function(_0x5ed62c){for(var _0xa8f2a=0x0;_0xa8f2a<_0x5ed62c['length'];_0xa8f2a++){var _0x250225=_0x5ed62c[_0xa8f2a][_0x3467('0x14c')][_0x3467('0x61')];if(_0x250225)io['to'](util['format']('user:%s',_0x250225))[_0x3467('0x42')]('user:dialPreviewRecallReminder',{'hopper':_0x5ed62c[_0xa8f2a]});}})[_0x3467('0xa3')](function(){});};Dialer[_0x3467('0x92')][_0x3467('0xb6')]=function(_0x18a692){var _0x20b2ae=this;return function(){_0x20b2ae[_0x3467('0x15d')](_0x18a692);};};Dialer[_0x3467('0x92')]['actionOriginate']=function(_0x256db4,_0x21322d){var _0xb45cb0=this;var _0x204d70=uuid['v4']();this['actions'][_0x204d70]=new Action(_0x256db4,_0x21322d,_0x204d70);return new Promise(function(_0x13c37a,_0x4e7dfd){if(_[_0x3467('0x41')](_0x256db4)&&typeof _0x256db4!==_0x3467('0x15e')){return _0x4e7dfd(msgResponse(_0x3467('0x15f'),'Failure',_0x3467('0x160')));}if(_[_0x3467('0x41')](_0x21322d[_0x3467('0x161')])||_0x21322d[_0x3467('0x161')]===null){return _0x4e7dfd(msgResponse(_0x3467('0x15f'),'Failure',_0x3467('0x162')));}var _0x1084ac={'XMD-CALLERID':_0xb45cb0[_0x3467('0x24')][_0x204d70]['getCaller'](),'XMD-AGI':_0x256db4[_0x3467('0x139')]?util[_0x3467('0x9f')](_0x3467('0x163'),ipAgi,_0x256db4[_0x3467('0x139')]):_0x3467('0x164'),'XMD-AGIAFTER':_0x256db4['dialQueueProject2']?util['format'](_0x3467('0x163'),ipAgi,_0x256db4[_0x3467('0xcf')]):_0x3467('0x164'),'XMD-QUEUE':utils[_0x3467('0x165')](_0x256db4)?util[_0x3467('0x9f')](_0x3467('0x166'),_0x256db4['name'],_0x256db4[_0x3467('0x167')]||'',_0x256db4['dialAgiAfterHangupAgent']?'c':'',_0x256db4[_0x3467('0xd6')]||0x3):_0x3467('0x164'),'XMD-CONTACTID':_0x21322d[_0x3467('0xf6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xb45cb0[_0x3467('0x24')][_0x204d70][_0x3467('0x168')](),'XMD-AMD':_0x256db4[_0x3467('0x118')]?_0x3467('0x142'):_0x3467('0x164'),'XMD-DESTINATION':_0x3467('0x169')};if(_0x256db4['dialAMDActive']){_0x1084ac[_0x3467('0x16a')]=_0x256db4[_0x3467('0x16b')]||0x9c4;_0x1084ac['XMD-AMDGREETING']=_0x256db4[_0x3467('0x16c')]||0x5dc;_0x1084ac[_0x3467('0x16d')]=_0x256db4[_0x3467('0x16e')]||0x320;_0x1084ac[_0x3467('0x16f')]=_0x256db4[_0x3467('0x170')]||0x1388;_0x1084ac['XMD-AMDMINWORDLENGTH']=_0x256db4['dialAMDMinWordLength']||0x64;_0x1084ac[_0x3467('0x171')]=_0x256db4[_0x3467('0x172')]||0x32;_0x1084ac['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x256db4[_0x3467('0x173')]||0x3;_0x1084ac['XMD-AMDSILENCETHRESHOLD']=_0x256db4[_0x3467('0x174')]||0x100;_0x1084ac[_0x3467('0x175')]=_0x256db4['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x256db4)){_0x1084ac[_0x3467('0x176')]=_0x21322d[_0x3467('0xf7')];}else{_0x1084ac[_0x3467('0x177')]=_0x21322d[_0x3467('0xe7')];}var _0x2a9391=utils[_0x3467('0x178')](_0x21322d[_0x3467('0x179')]);Object[_0x3467('0x145')](_0x1084ac,_0x2a9391);var _0xf2dd85=_0xb45cb0[_0x3467('0x88')](_0x256db4['Trunk'])?utils['getCallerId'](_0x256db4[_0x3467('0x8e')][_0x3467('0x17a')],_0x256db4[_0x3467('0x17b')],_0x256db4[_0x3467('0x17c')]>0x0?utils[_0x3467('0x17d')](_0x256db4[_0x3467('0x17e')],_0x256db4[_0x3467('0x17c')]):_0x256db4[_0x3467('0x17e')]):utils[_0x3467('0x17f')](_['isNil'](_0x256db4['TrunkBackup'])?_0x256db4[_0x3467('0x8e')][_0x3467('0x17a')]:_0x256db4[_0x3467('0x180')][_0x3467('0x17a')],_0x256db4[_0x3467('0x17b')],_0x256db4[_0x3467('0x17c')]>0x0?utils[_0x3467('0x17d')](_0x256db4[_0x3467('0x17e')],_0x256db4[_0x3467('0x17c')]):_0x256db4[_0x3467('0x17e')]);if(_0xf2dd85){_0x1084ac[_0x3467('0x181')]=_0xb45cb0[_0x3467('0x24')][_0x204d70][_0x3467('0x182')]=utils[_0x3467('0x183')](_0xf2dd85);_0x1084ac[_0x3467('0x184')]=_0x21322d[_0x3467('0x161')];}_0x256db4[_0x3467('0x185')]=_0x1084ac;return ami[_0x3467('0x9e')]({'actionid':_0x204d70,'action':_0x3467('0x15f'),'channel':_0xb45cb0['isTrunkReachable'](_0x256db4[_0x3467('0x8e')])?util['format'](_0x3467('0x186'),_0x256db4[_0x3467('0x8e')][_0x3467('0x61')],isNotNull(_0x256db4['dialPrefix'])?_0x256db4[_0x3467('0x187')]['trim']()||'':'',_0x256db4[_0x3467('0x188')]>0x0?_0x21322d[_0x3467('0x161')][_0x3467('0x189')](_0x256db4[_0x3467('0x188')]):_0x21322d[_0x3467('0x161')]):util[_0x3467('0x9f')](_0x3467('0x186'),_[_0x3467('0xfd')](_0x256db4['TrunkBackup'])?_0x256db4['Trunk'][_0x3467('0x61')]:_0x256db4[_0x3467('0x180')][_0x3467('0x61')],isNotNull(_0x256db4[_0x3467('0x187')])?_0x256db4[_0x3467('0x187')][_0x3467('0x18a')]()||'':'',_0x256db4[_0x3467('0x188')]>0x0?_0x21322d[_0x3467('0x161')]['substring'](_0x256db4[_0x3467('0x188')]):_0x21322d[_0x3467('0x161')]),'callerid':_0xf2dd85,'Exten':_0x3467('0x169'),'Context':_0x3467('0x18b'),'Priority':'1','variable':_0x1084ac,'timeout':(_0x256db4[_0x3467('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x204d70})[_0x3467('0x40')](function(_0x15e7aa){return _0x13c37a(_0x15e7aa);})['catch'](function(_0xc4cf89){_0x256db4[_0x3467('0x18d')]+=0x1;var _0x3afa45=new History(_0xb45cb0['actions'][_0x204d70]);logger['error'](util[_0x3467('0x9f')](_0x3467('0x18e'),JSON[_0x3467('0x87')](_0xc4cf89)));_0x3afa45[_0x3467('0x70')]=0xe;_0x3afa45['statedesc']=_0x3467('0x18f');_0x3afa45[_0x3467('0xe9')]=moment()[_0x3467('0x9f')](_0x3467('0xd1'));_0x3afa45['endtime']=_0x3afa45[_0x3467('0xe9')];hopperUtils[_0x3467('0xec')](_0x3afa45)['catch'](loggerCatch(_0x3467('0x190')));_0xb45cb0[_0x3467('0x137')](_0x3afa45)[_0x3467('0xa3')](loggerCatch(_0x3467('0x190')))['finally'](function(){delete _0xb45cb0[_0x3467('0x24')][_0x204d70];return _0x4e7dfd(msgResponse('originate','Error',_0x3467('0x191')));});});});};Dialer[_0x3467('0x92')]['checkRetriveMax']=function(_0x3f6c6c,_0x2bb879,_0x224ce7){var _0x4f53c0=new History(_0x2bb879);if(_0x4f53c0[_0x3467('0x130')]+_0x4f53c0[_0x3467('0x131')]+_0x4f53c0['countnoanswerretry']+_0x4f53c0[_0x3467('0x132')]+_0x4f53c0[_0x3467('0xdc')]+_0x4f53c0['countabandonedretry']+_0x4f53c0['countmachineretry']+_0x4f53c0['countagentrejectretry']>=_0x224ce7[_0x3467('0x12a')]-0x1){return!![];}switch(_0x3f6c6c){case 0x3:if(_0x4f53c0[_0x3467('0x128')]>=_0x224ce7[_0x3467('0x192')]-0x1){return!![];}hopperUtils[_0x3467('0xe2')]({'active':![],'countnoanswerretry':_0x4f53c0[_0x3467('0x128')]+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7['dialNoAnswerRetryFrequency'],_0x3467('0xe5'))[_0x3467('0x9f')](_0x3467('0xd1')),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0[_0x3467('0xe6')],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x4f53c0['countbusyretry']>=_0x224ce7[_0x3467('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x4f53c0[_0x3467('0x130')]+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7[_0x3467('0x194')],'minutes')['format'](_0x3467('0xd1')),'ContactId':_0x4f53c0['ContactId'],'ListId':_0x4f53c0[_0x3467('0xe6')],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0['CampaignId']||undefined})['catch'](loggerCatch(_0x3467('0x195')));break;case 0x8:if(_0x4f53c0['countcongestionretry']>=_0x224ce7['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x3467('0xe2')]({'active':![],'countcongestionretry':_0x4f53c0[_0x3467('0x131')]+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7[_0x3467('0x196')],'minutes')['format'](_0x3467('0xd1')),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0['ListId'],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0x197')));break;case 0x0:if(_0x4f53c0[_0x3467('0x132')]>=_0x224ce7['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x3467('0xe2')]({'active':![],'countnosuchnumberretry':_0x4f53c0[_0x3467('0x132')]+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7['dialNoSuchNumberRetryFrequency'],'minutes')[_0x3467('0x9f')](_0x3467('0xd1')),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0[_0x3467('0xe6')],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4f53c0['countdropretry']>=_0x224ce7['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x3467('0xe2')]({'active':![],'countdropretry':_0x4f53c0['countdropretry']+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7[_0x3467('0xe4')],'minutes')['format'](_0x3467('0xd1')),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0[_0x3467('0xe6')],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0['CampaignId']||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0xe8')));break;case 0xb:if(_0x4f53c0[_0x3467('0xf5')]>=_0x224ce7[_0x3467('0xf3')]-0x1){return!![];}hopperUtils[_0x3467('0xe2')]({'active':![],'countabandonedretry':_0x4f53c0[_0x3467('0xf5')]+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7[_0x3467('0xf2')],_0x3467('0xe5'))[_0x3467('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0[_0x3467('0xe6')],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0xf8')));break;case 0x13:if(_0x4f53c0[_0x3467('0x125')]>=_0x224ce7[_0x3467('0x12b')]-0x1){return!![];}hopperUtils[_0x3467('0xe2')]({'active':![],'countmachineretry':_0x4f53c0[_0x3467('0x125')]+=0x1,'scheduledat':moment()['add'](_0x224ce7[_0x3467('0x12e')],'minutes')[_0x3467('0x9f')](_0x3467('0xd1')),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0['ListId'],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0[_0x3467('0xe7')]||undefined})['catch'](loggerCatch(_0x3467('0x135')));break;case 0x14:if(_0x4f53c0['countagentrejectretry']>=_0x224ce7['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x3467('0xe2')]({'active':![],'countagentrejectretry':_0x4f53c0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x3467('0xe3')](_0x224ce7[_0x3467('0x198')],_0x3467('0xe5'))[_0x3467('0x9f')](_0x3467('0xd1')),'ContactId':_0x4f53c0[_0x3467('0xf6')],'ListId':_0x4f53c0[_0x3467('0xe6')],'VoiceQueueId':_0x4f53c0[_0x3467('0xf7')]||undefined,'CampaignId':_0x4f53c0[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3467('0x92')][_0x3467('0x115')]=function(_0x463f3c,_0x3a3176,_0x303654){var _0x560c87=this;var _0x4d9a62=new History(_0x463f3c);var _0x4d2b39=![];var _0x324ae2;var _0x5709af;return new Promise(function(_0x75c31,_0x55f999){if(_[_0x3467('0x41')](_0x3a3176)&&typeof _0x3a3176!==_0x3467('0x15e')){return _0x55f999(msgResponse(_0x3467('0x199'),'Failure',_0x3467('0x19a')));}if(_[_0x3467('0x41')](_0x303654)&&typeof _0x303654!==_0x3467('0x15e')){return _0x55f999(msgResponse(_0x3467('0x199'),_0x3467('0x9a'),_0x3467('0x19b')));}hopperUtils[_0x3467('0xde')](_0x4d9a62,_0x303654['reason'],_0x3a3176)['then'](function(_0x482c75){if(_0x482c75['additional']==0x1)_0x4d2b39=!![];switch(_0x303654[_0x3467('0xcc')]){case'0':_0x3a3176['outboundNoSuchCallsDay']+=0x1;_0x4d9a62[_0x3467('0x70')]=0x0;_0x4d9a62[_0x3467('0x71')]='NoSuchNumber';_0x4d9a62['countnosuchnumberretry']+=0x1;_0x4d9a62[_0x3467('0xdd')]+=0x1;ami[_0x3467('0x42')](_0x3467('0x19c'),ut[_0x3467('0x11f')](_0x463f3c,'nosuchnumber'));_0x324ae2=_0x3a3176[_0x3467('0x19d')];_0x5709af=_0x3a3176[_0x3467('0x19e')];hopperUtils[_0x3467('0xec')](_0x4d9a62)[_0x3467('0xa3')](loggerCatch(_0x3467('0x127')));if(_0x560c87[_0x3467('0x19f')](0x0,_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0x132')]>=_0x3a3176[_0x3467('0x1a0')]){_0x560c87[_0x3467('0x12c')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1a1'));}else{_0x560c87[_0x3467('0x133')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1a1'));}}break;case'3':_0x3a3176['outboundNoAnswerCallsDay']+=0x1;_0x4d9a62[_0x3467('0x70')]=0x3;_0x4d9a62[_0x3467('0x71')]=_0x3467('0x1a2');_0x4d9a62[_0x3467('0x128')]+=0x1;_0x4d9a62['countglobal']+=0x1;var _0x557b08=ut[_0x3467('0x1a3')](_0x463f3c,_0x3a3176);ami[_0x3467('0x42')](_0x3467('0x1a4'),_0x557b08);_0x324ae2=_0x3a3176[_0x3467('0x1a5')];_0x5709af=_0x3a3176[_0x3467('0x19e')];hopperUtils[_0x3467('0xec')](_0x4d9a62)[_0x3467('0xa3')](loggerCatch(_0x3467('0x1a6')));if(_0x560c87[_0x3467('0x19f')](0x3,_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0x128')]>=_0x3a3176[_0x3467('0x192')]){_0x560c87['createStateFinal'](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1a7'));}else{_0x560c87['stateGlobal'](_0x4d9a62,_0x75c31,_0x55f999,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3a3176[_0x3467('0x1a8')]+=0x1;_0x4d9a62[_0x3467('0x70')]=0x5;_0x4d9a62[_0x3467('0x71')]='Busy';_0x4d9a62[_0x3467('0x130')]+=0x1;_0x4d9a62[_0x3467('0xdd')]+=0x1;ami['emit'](_0x3467('0x1a9'),ut['buildObj'](_0x463f3c,_0x3467('0x1aa')));_0x324ae2=_0x3a3176[_0x3467('0x194')];_0x5709af=_0x3a3176[_0x3467('0x19e')];hopperUtils['createHistory'](_0x4d9a62)[_0x3467('0xa3')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x560c87[_0x3467('0x19f')](0x5,_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0x130')]>=_0x3a3176[_0x3467('0x193')]){_0x560c87[_0x3467('0x12c')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1ab'));}else{_0x560c87[_0x3467('0x133')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1ab'));}}break;case'8':_0x3a3176[_0x3467('0x1ac')]+=0x1;_0x4d9a62[_0x3467('0x70')]=0x8;_0x4d9a62[_0x3467('0x71')]='Congestion';_0x4d9a62[_0x3467('0x131')]+=0x1;_0x4d9a62[_0x3467('0xdd')]+=0x1;_0x324ae2=_0x3a3176['dialCongestionRetryFrequency'];_0x5709af=_0x3a3176['callAdditionalPhoneAfterMin'];ami[_0x3467('0x42')]('custom:agentcongestion',ut[_0x3467('0x11f')](_0x463f3c,_0x3467('0x1ad')));hopperUtils[_0x3467('0xec')](_0x4d9a62)[_0x3467('0xa3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x560c87[_0x3467('0x19f')](0x8,_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0x131')]>=_0x3a3176[_0x3467('0x1ae')]){_0x560c87[_0x3467('0x12c')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1af'));}else{_0x560c87[_0x3467('0x133')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1af'));}}break;case'11':_0x3a3176['outboundAbandonedCallsDay']+=0x1;_0x4d9a62[_0x3467('0x70')]=0xb;_0x4d9a62[_0x3467('0x71')]=_0x3467('0xf0');_0x4d9a62[_0x3467('0xf5')]+=0x1;_0x4d9a62[_0x3467('0xdd')]+=0x1;_0x324ae2=_0x3a3176[_0x3467('0xf2')];_0x5709af=_0x3a3176[_0x3467('0x19e')];hopperUtils[_0x3467('0xec')](_0x4d9a62)[_0x3467('0xa3')](loggerCatch(_0x3467('0xf9')));if(_0x560c87[_0x3467('0x19f')](0xb,_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0xf5')]>=_0x3a3176[_0x3467('0xf3')]){_0x560c87[_0x3467('0x12c')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1b0'));}else{_0x560c87[_0x3467('0x133')](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1b0'));}}break;case'20':_0x3a3176[_0x3467('0x1b1')]+=0x1;_0x4d9a62['state']=0x14;_0x4d9a62[_0x3467('0x71')]=_0x3467('0x1b2');_0x4d9a62[_0x3467('0x129')]+=0x1;_0x4d9a62[_0x3467('0xdd')]+=0x1;_0x324ae2=_0x3a3176['dialAgentRejectRetryFrequency'];_0x5709af=_0x3a3176['callAdditionalPhoneAfterMin'];ami[_0x3467('0x42')](_0x3467('0x1b3'),ut['buildObj'](_0x463f3c,_0x3467('0x1b4')));hopperUtils[_0x3467('0xec')](_0x4d9a62)[_0x3467('0xa3')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x560c87['checkRetriveMax'](0x14,_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0x129')]>=_0x3a3176['dialAgentRejectMaxRetry']){_0x560c87['createStateFinal'](_0x4d9a62,_0x75c31,_0x55f999,_0x3467('0x1b5'));}else{_0x560c87[_0x3467('0x133')](_0x4d9a62,_0x75c31,_0x55f999,'reason\x2020\x20agentreject');}}break;default:_0x3a3176[_0x3467('0x13a')]+=0x1;_0x4d9a62[_0x3467('0x70')]=0xc;_0x4d9a62['statedesc']=_0x303654[_0x3467('0xcc')];_0x324ae2=_0x3a3176['dialAgentRejectRetryFrequency'];_0x5709af=_0x3a3176['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x4d9a62)[_0x3467('0xa3')](loggerCatch(_0x3467('0x1b6')));if(_0x560c87['checkRetriveMax'](_0x303654[_0x3467('0xcc')],_0x463f3c,_0x3a3176)&&!_0x4d2b39){if(_0x4d9a62[_0x3467('0x130')]+_0x4d9a62[_0x3467('0x131')]+_0x4d9a62['countnoanswerretry']+_0x4d9a62[_0x3467('0x132')]+_0x4d9a62['countdropretry']+_0x4d9a62[_0x3467('0xf5')]+_0x4d9a62['countmachineretry']+_0x4d9a62[_0x3467('0x129')]>=_0x3a3176[_0x3467('0x12a')]){_0x560c87[_0x3467('0x133')](_0x4d9a62,_0x75c31,_0x55f999,_0x303654[_0x3467('0xcc')]);}else{_0x560c87[_0x3467('0x12c')](_0x4d9a62,_0x75c31,_0x55f999,_0x303654['reason']);}}}})[_0x3467('0x40')](function(){if(_0x4d2b39){hopperUtils[_0x3467('0xee')](_0x4d9a62,_0x324ae2,_0x5709af)[_0x3467('0x40')](function(){return _0x75c31(0x1);});}});});};Dialer[_0x3467('0x92')][_0x3467('0x133')]=function(_0x179112,_0x4b5a7e,_0x75950d,_0x53e305){var _0x2e0446=new Final(_0x179112);_0x2e0446[_0x3467('0x70')]=0xf;_0x2e0446[_0x3467('0x71')]=_0x3467('0x1b7');this[_0x3467('0x12c')](_0x2e0446,_0x4b5a7e,_0x75950d,_0x53e305);};Dialer[_0x3467('0x92')][_0x3467('0x12c')]=function(_0x3ecd98,_0x5ea9d0,_0x55ec56,_0x5a968b){hopperUtils[_0x3467('0x137')](_0x3ecd98)[_0x3467('0x40')](function(){return _0x5ea9d0(msgResponse(_0x3467('0x199'),_0x3467('0x114'),_0x5a968b));})[_0x3467('0xa3')](function(){return _0x55ec56(msgResponse(_0x3467('0x1b8'),_0x3467('0x9a'),_0x3467('0x1b9')));});};Dialer[_0x3467('0x92')][_0x3467('0xa')]=function(_0x157840){var _0x534f21=_0x157840[_0x3467('0x1ba')]/0x64;var _0x205a06=_0x157840['outboundDropCallsDayTimeout']/(_0x157840[_0x3467('0xd7')]+_0x157840['outboundAnswerCallsDay']);var _0x587d96=Math[_0x3467('0x1bb')](_0x157840[_0x3467('0x1bc')]*(_0x157840['predictiveIntervalMaxThreshold']/0x64));var _0xe4cbbb=Math[_0x3467('0x1bb')](_0x157840[_0x3467('0x1bc')]*(_0x157840[_0x3467('0x1bd')]/0x64));var _0x545d19=_0x157840[_0x3467('0x1be')]+_0x157840[_0x3467('0x140')];var _0x5f34da=Math['floor'](_0x157840['erlangCalls']*_0x157840[_0x3467('0x5b')]*_0x157840[_0x3467('0x1bf')]*_0x157840[_0x3467('0x1c0')]);if(_[_0x3467('0x41')](_0x157840[_0x3467('0x28')])){if(!_[_0x3467('0x41')](_0x157840[_0x3467('0x27')])){_0x157840[_0x3467('0x27')]=undefined;loggerPredictive[_0x3467('0x66')](_0x3467('0x1c1'),_0x3467('0x1c2'));}if(!_['isUndefined'](_0x157840[_0x3467('0x64')])){loggerPredictive[_0x3467('0x66')](_0x3467('0x1c1'),_0x3467('0x1c3'));clearInterval(_0x157840[_0x3467('0x64')]);_0x157840[_0x3467('0x64')]=undefined;}_0x157840[_0x3467('0x28')]=moment()[_0x3467('0x9f')](_0x3467('0xd1'));loggerPredictive[_0x3467('0x4a')](_0x157840[_0x3467('0x61')],_0x3467('0x1c4'),_0x157840['startProgressive']);this[_0x3467('0xba')](_0x157840,0x1);}else if(ifInterval(_0x157840['dialPredictiveInterval'],_0x157840['startProgressive'])){this['handlePower'](_0x157840,0x1);loggerPredictiveCalls[_0x3467('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x157840[_0x3467('0x28')],_0x157840[_0x3467('0x61')]);_0x157840[_0x3467('0x59')]=0x0;_0x157840[_0x3467('0xd8')]=0x0;}else if(_0x534f21<_0x205a06&&_0x157840['dialPredictiveOptimization']===_0x3467('0x1c5')){clearPredictiveAttributes(_0x157840);loggerPredictive[_0x3467('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x3467('0x1c6'),_0x205a06,_0x3467('0x28'),_0x157840[_0x3467('0x61')]);}else if(_0x5f34da<_0x157840[_0x3467('0xd8')]&&_0x157840['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x157840);loggerPredictive[_0x3467('0x4a')](_0x3467('0x1c7'),'Max\x20Drop\x20',_0x5f34da,_0x3467('0x1c8'),_0x157840[_0x3467('0xd8')],_0x3467('0x28'),_0x157840[_0x3467('0x61')]);}else if(!ifInterval(_0x157840[_0x3467('0x1c9')],_0x157840[_0x3467('0x28')])&&_[_0x3467('0x41')](_0x157840[_0x3467('0x27')])&&!_['isUndefined'](_0x157840[_0x3467('0x28')])){_0x157840[_0x3467('0x27')]=moment()[_0x3467('0x9f')](_0x3467('0xd1'));loggerPredictive['info'](_0x157840[_0x3467('0x61')],_0x3467('0x1ca'),_0x157840[_0x3467('0x27')]);hopperUtils['avgHandleTime'](_0x157840[_0x3467('0x1c9')])[_0x3467('0x40')](this['getDataPredictive'](_0x157840))[_0x3467('0x40')](mergeDataErlangB(_0x157840))[_0x3467('0x40')](this['startMethodPredictive'](_0x157840))[_0x3467('0xa3')](loggerCatchPredictive(_0x3467('0x1cb'),_0x157840));}else if(!ifInterval(_0x157840[_0x3467('0x1c9')],_0x157840['startPredictive'])){_0x157840[_0x3467('0xd8')]=0x0;_0x157840['startPredictive']=moment()[_0x3467('0x9f')](_0x3467('0xd1'));loggerPredictive[_0x3467('0x4a')](_0x157840[_0x3467('0x61')],'recalculate\x20predictive\x20at',_0x157840[_0x3467('0x27')]);clearInterval(_0x157840[_0x3467('0x64')]);_0x157840[_0x3467('0x64')]=undefined;hopperUtils[_0x3467('0x1cc')](_0x157840[_0x3467('0x1c9')])['then'](this[_0x3467('0x1cd')](_0x157840))['then'](mergeDataErlangB(_0x157840))[_0x3467('0x40')](this[_0x3467('0x1ce')](_0x157840))[_0x3467('0xa3')](loggerCatchPredictive(_0x3467('0x1cf'),_0x157840));}else if(_0x157840['predictiveIntervalAvailable']&&_0x545d19<_0x157840[_0x3467('0x1bc')]-_0xe4cbbb){clearPredictiveAttributes(_0x157840);loggerPredictive[_0x3467('0x4a')](_0x157840['name'],_0x3467('0x1d0'),_0x545d19,_0x3467('0x1d1'),_0x157840['predictiveIntervalAvailable'],'-',_0xe4cbbb,'=',_0x157840[_0x3467('0x1bc')]-_0xe4cbbb,')');}else if(_0x157840[_0x3467('0x1bc')]&&_0x545d19>_0x157840[_0x3467('0x1bc')]+_0x587d96){clearPredictiveAttributes(_0x157840);loggerPredictive[_0x3467('0x4a')](_0x157840[_0x3467('0x61')],_0x3467('0x1d0'),_0x545d19,')\x20are\x20more\x20than\x20threshold\x20(',_0x157840['predictiveIntervalAvailable'],'+',_0x587d96,'=',_0x157840['predictiveIntervalAvailable']+_0x587d96,')');}};Dialer[_0x3467('0x92')][_0x3467('0x1cd')]=function(_0x55e189){var _0x3d28dd=this;return function(_0x2e40fb){return new Promise(function(_0x2eb012,_0x39f911){_[_0x3467('0x5f')](_0x55e189,_0x2e40fb[0x0]);if(checkGetDataPredictive(_0x2e40fb[0x0])){var _0x588287=_0x55e189[_0x3467('0x1bc')]=_0x55e189[_0x3467('0x140')]+_0x55e189[_0x3467('0x1be')];var _0x23cf59=_0x55e189[_0x3467('0x1c9')]*0x3c;var _0x30d137=_0x2e40fb[0x0]['predictiveIntervalAvgTalktime']+_0x2e40fb[0x0][_0x3467('0x55')];var _0x1b0c2f=(_0x2e40fb[0x0][_0x3467('0x1d2')]+_0x2e40fb[0x0][_0x3467('0x4f')]+_0x2e40fb[0x0][_0x3467('0x51')])/_0x2e40fb[0x0]['predictiveIntervalTotalCalls'];_0x55e189[_0x3467('0x1bf')]=_0x1b0c2f>0x0?_0x1b0c2f:0x1;switch(_0x55e189[_0x3467('0x1d3')]){case _0x3467('0x1c5'):var _0x57ddb5=_0x55e189[_0x3467('0x1ba')]/0x64;return _0x3d28dd[_0x3467('0x1d4')](_0x588287,_0x23cf59,_0x30d137,_0x1b0c2f,_0x57ddb5)['then'](function(_0x40b961){return _0x2eb012(_0x40b961);});case'agentBusyFactor':var _0x383643=_0x55e189[_0x3467('0x1ba')]/0x64;return _0x3d28dd[_0x3467('0x1d5')](_0x588287,_0x23cf59,_0x30d137,_0x1b0c2f,_0x383643)['then'](function(_0x3b2dd1){return _0x2eb012(_0x3b2dd1);});default:return _0x39f911(msgResponse(_0x3467('0x1d6'),'Failure','Unknown\x20Predictive'));}}else{return _0x39f911(msgResponse(_0x3467('0x1d6'),_0x3467('0x9a'),_0x3467('0x1d7')));}});};};Dialer[_0x3467('0x92')]['getDataPredictiveOld']=function(_0x984147){var _0x553fbc=this;return function(_0x521d75){return new Promise(function(_0x196f41,_0x502de0){_[_0x3467('0x5f')](_0x984147,_0x521d75[0x0]);if(checkGetDataPredictive(_0x521d75[0x0])){loggerPredictive[_0x3467('0x4a')](JSON[_0x3467('0x87')](_0x521d75[0x0]));if(_0x984147['dialPredictiveOptimization']===_0x3467('0x1c5')){return _0x553fbc[_0x3467('0x155')](_0x984147['id'])[_0x3467('0x40')](function(_0x5d6085){var _0x162dfa=_0x984147[_0x3467('0x1d8')]-_0x5d6085[0x0][_0x3467('0x1d9')];var _0xa57a46=_0x984147[_0x3467('0x1c9')]*0x3c;var _0x21fd94=_0x521d75[0x0][_0x3467('0x53')]+_0x521d75[0x0]['predictiveIntervalAvgHoldtime'];var _0x238570=(_0x521d75[0x0][_0x3467('0x1d2')]+_0x521d75[0x0][_0x3467('0x4f')]+_0x521d75[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x521d75[0x0][_0x3467('0x4c')];var _0x166c02=_0x984147[_0x3467('0x1ba')]/0x64;_0x984147[_0x3467('0x1da')]=_0x5d6085[0x0]['outboundQueuePauses']||0x0;_0x984147['predictiveIntervalHitRate']=_0x238570>0x0?_0x238570:0x1;return _0x553fbc['abandonmentRate'](_0x162dfa,_0xa57a46,_0x21fd94,_0x238570,_0x166c02);})[_0x3467('0x40')](function(_0x513669){return _0x196f41(_0x513669);})[_0x3467('0xa3')](function(_0x4769cf){return _0x502de0(msgResponse(_0x3467('0x1db'),'Failure',JSON[_0x3467('0x87')](_0x4769cf)));});}if(_0x984147[_0x3467('0x1d3')]===_0x3467('0x1dc')){return _0x553fbc[_0x3467('0x155')](_0x984147['id'])[_0x3467('0x40')](function(_0x3c22e7){var _0x22c7b6=_0x984147[_0x3467('0x1d8')]-_0x3c22e7[0x0][_0x3467('0x1d9')];var _0x197f5e=_0x984147[_0x3467('0x1c9')]*0x3c;var _0x21d9da=_0x521d75[0x0][_0x3467('0x53')]+_0x521d75[0x0][_0x3467('0x55')];var _0x7a993f=(_0x521d75[0x0][_0x3467('0x1d2')]+_0x521d75[0x0][_0x3467('0x4f')]+_0x521d75[0x0][_0x3467('0x51')])/_0x521d75[0x0][_0x3467('0x4c')];var _0x3a5b12=_0x984147[_0x3467('0x1ba')]/0x64;_0x984147[_0x3467('0x1da')]=_0x3c22e7[0x0][_0x3467('0x1d9')]||0x0;_0x984147[_0x3467('0x1bf')]=_0x7a993f>0x0?_0x7a993f:0x1;return _0x553fbc[_0x3467('0x1d5')](_0x22c7b6,_0x197f5e,_0x21d9da,_0x7a993f,_0x3a5b12);})[_0x3467('0x40')](function(_0x3ba3cd){return _0x196f41(_0x3ba3cd);})[_0x3467('0xa3')](function(_0x3f7c8f){return _0x502de0(msgResponse(_0x3467('0x1db'),_0x3467('0x9a'),JSON[_0x3467('0x87')](_0x3f7c8f)));});}}else{return _0x502de0(msgResponse(_0x3467('0x1d6'),_0x3467('0x9a'),_0x3467('0x1d7')));}});};};Dialer[_0x3467('0x92')][_0x3467('0x1ce')]=function(_0x18d13a){var _0x6f633d=this;return function(){var _0x127acb=0x0;var _0xc7ac30=Math['floor'](_0x18d13a[_0x3467('0x1dd')]*0x3e8);if(_0xc7ac30>0x0){_0xc7ac30=_0xc7ac30<0x64?0x64:_0xc7ac30;loggerPredictive[_0x3467('0x4a')](_0x18d13a['name'],'one\x20call\x20every:',_0xc7ac30,_0x3467('0x1de'));_0x18d13a['handlePredictive']=setInterval(function(){_0x6f633d['handlePredictive'](_0x18d13a);loggerPredictiveCalls[_0x3467('0x4a')](_0x3467('0x1df'),_0x127acb+=0x1);},_0xc7ac30);}else{loggerPredictive[_0x3467('0x4a')](_0x18d13a[_0x3467('0x61')],_0x3467('0x1e0'));}};};Dialer['prototype']['checkContactBlack']=function(_0x2bbdf1,_0x484416){var _0x39e0a8=this;return function(_0x44f5b0){if(_['isEmpty'](_0x44f5b0)){if(_[_0x3467('0xfd')](_0x484416['UserId'])||!_0x484416[_0x3467('0x1e1')]){if(_0x2bbdf1['dialMethod']===_0x3467('0x9')){_0x2bbdf1['queueStatusComplete']=_[_0x3467('0x41')](_0x2bbdf1[_0x3467('0x73')])?!![]:_0x2bbdf1[_0x3467('0x73')];var _0x296f99=uuid['v4']();_0x39e0a8[_0x3467('0x24')][_0x296f99]=new Action(_0x2bbdf1,_0x484416,_0x296f99);loggerBooked[_0x3467('0x4a')](_0x3467('0x1e2'),_0x296f99,_0x3467('0x1e3'),JSON[_0x3467('0x87')](_0x2bbdf1['queueStatusComplete']),_0x3467('0x1e4'),_0x2bbdf1[_0x3467('0x61')]);if(_0x2bbdf1[_0x3467('0x73')]){_0x2bbdf1[_0x3467('0x73')]=![];_0x39e0a8['queueBooked'][_0x39e0a8[_0x3467('0x24')][_0x296f99][_0x3467('0xc5')]]=[];ami['Action']({'actionid':_0x296f99,'action':_0x3467('0x1e5'),'queue':_0x2bbdf1[_0x3467('0x61')]})[_0x3467('0xa3')](function(){_0x39e0a8[_0x3467('0xc9')](_0x2bbdf1);hopperUtils[_0x3467('0xe2')]({'active':![],'ContactId':_0x39e0a8[_0x3467('0x24')][_0x296f99][_0x3467('0xf6')],'ListId':_0x39e0a8[_0x3467('0x24')][_0x296f99][_0x3467('0xe6')],'VoiceQueueId':_0x39e0a8[_0x3467('0x24')][_0x296f99][_0x3467('0xf7')]||undefined,'CampaignId':_0x39e0a8[_0x3467('0x24')][_0x296f99][_0x3467('0xe7')]||undefined})['catch'](loggerCatch(_0x3467('0x1e6')));delete _0x39e0a8[_0x3467('0x24')][_0x296f99];});}else{loggerBooked[_0x3467('0x4a')]('[booked][checkContactBlack][else]',JSON[_0x3467('0x87')](_0x2bbdf1[_0x3467('0x73')]),_0x3467('0x1e4'),_0x2bbdf1['name']);_0x39e0a8[_0x3467('0xc9')](_0x2bbdf1);hopperUtils[_0x3467('0xe2')]({'active':![],'ContactId':_0x39e0a8['actions'][_0x296f99][_0x3467('0xf6')],'ListId':_0x39e0a8[_0x3467('0x24')][_0x296f99][_0x3467('0xe6')],'VoiceQueueId':_0x39e0a8[_0x3467('0x24')][_0x296f99]['VoiceQueueId']||undefined,'CampaignId':_0x39e0a8[_0x3467('0x24')][_0x296f99]['CampaignId']||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0x1e6')));delete _0x39e0a8['actions'][_0x296f99];}}else{return _0x39e0a8[_0x3467('0x1e7')](_0x2bbdf1,_0x484416);}}else{if(utils[_0x3467('0x60')](undefined,_0x484416['scheduledat'])<_0x2bbdf1[_0x3467('0x1e8')]*0x3c){if(_0x484416[_0x3467('0x14c')]&&!_0x484416[_0x3467('0x14c')][_0x3467('0x1e9')]){_0x39e0a8[_0x3467('0x1d')][_0x3467('0x103')](_0x484416['id'])['finally'](function(){_0x39e0a8[_0x3467('0xc9')](_0x2bbdf1);});}else{hopperUtils[_0x3467('0x1ea')]({'active':![]},_0x484416['id'],0x1)[_0x3467('0x10c')](function(){_0x39e0a8[_0x3467('0xc9')](_0x2bbdf1);});}}else{_0x2bbdf1['outboundReCallsDay']+=0x1;_0x39e0a8['updateOriginated'](_0x2bbdf1);if(_0x2bbdf1[_0x3467('0x1eb')]){hopperUtils[_0x3467('0xe2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x484416[_0x3467('0xf6')],'ListId':_0x484416['ListId'],'VoiceQueueId':_0x484416[_0x3467('0xf7')]||undefined,'CampaignId':_0x484416[_0x3467('0xe7')]||undefined})[_0x3467('0xa3')](loggerCatch(_0x3467('0x1ec')));hopperUtils['createHistory'](createObjHistory(_0x2bbdf1,_0x484416,utils[_0x3467('0x6a')][_0x3467('0x1ed')],0x17,_0x3467('0x1ee')))[_0x3467('0xa3')](loggerCatch(_0x3467('0x1ef')));}else{_0x39e0a8[_0x3467('0x159')](createObjHistory(_0x2bbdf1,_0x484416,utils[_0x3467('0x6a')]['RECALL_TIMEOUT'],0x16,_0x3467('0x1f0')),_0x3467('0x1f1'),_0x3467('0x1f2'));}}}}else{_0x2bbdf1[_0x3467('0x1f3')]+=0x1;_0x39e0a8[_0x3467('0x159')](createObjHistory(_0x2bbdf1,_0x484416,utils[_0x3467('0x6a')][_0x3467('0x1f4')],0xd,_0x3467('0x1f5')),_0x3467('0x1f6'),_0x3467('0x1f7'));throw'inBlackList';}};};Dialer[_0x3467('0x92')][_0x3467('0x15d')]=function(_0x2769fc){var _0xa959d4=this;var _0x582042=_0x2769fc['limitCalls']-_0x2769fc['originated'];emitCampaignSummary(_0x2769fc);if(_0x582042>0x0&&_0x2769fc[_0x3467('0x68')]==0x0){if(_0x582042>this[_0x3467('0x22')]){_0x582042=this['maxNumberOriginate'];}_0x2769fc[_0x3467('0x68')]=0x1;hopperUtils['getContactDialerIvr'](_0x2769fc,_0x582042)['then'](function(_0x3bf88b){_0x2769fc[_0x3467('0x68')]=0x0;if(_0x3bf88b){if(!utils[_0x3467('0x1f8')](_0x3bf88b)){_0x2769fc[_0x3467('0x69')]=utils[_0x3467('0x6a')][_0x3467('0x6e')];logger[_0x3467('0x4a')]('[getContactCampaign2][Empty]'+_0x2769fc['name']);}else{_0x2769fc[_0x3467('0x81')]+=_0x3bf88b[_0x3467('0x149')];_0x2769fc['message']=utils[_0x3467('0x6a')][_0x3467('0x1f9')];for(var _0x553071=0x0;_0x553071<_0x3bf88b[_0x3467('0x149')];_0x553071+=0x1){_0x2769fc[_0x3467('0x1fa')]+=0x1;if(_[_0x3467('0xfd')](_0x3bf88b[_0x553071])||_[_0x3467('0xfd')](_0x3bf88b[_0x553071][_0x3467('0x179')])||_[_0x3467('0xfd')](_0x3bf88b[_0x553071][_0x3467('0x161')])){_0xa959d4[_0x3467('0x157')](_0x3467('0x1fb'),_0x2769fc,_0x3bf88b[_0x553071]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x3467('0x76')](_0x3bf88b[_0x553071],[_0x3467('0xe7'),'phone']))[_0x3467('0x40')](_0xa959d4[_0x3467('0x1fc')](_0x2769fc,_0x3bf88b[_0x553071]))['catch'](_0xa959d4['loggerHandler']('[actionOriginateIvr]\x20',_0x2769fc));}}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x2769fc,_0x582042));}};Dialer['prototype']['handlePower']=function(_0x500f73,_0x314562){var _0x5877fb=this;var _0x447c4d=[];if(_0x314562<0x1||_0x500f73[_0x3467('0xb8')]===_0x3467('0x9')){_0x314562=0x1;}var _0x58ff20=Math['floor'](_0x500f73[_0x3467('0x1be')]*_0x314562)-_0x500f73[_0x3467('0x81')];if(_0x500f73[_0x3467('0x1fd')]>0x0){var _0x513fa=_0x500f73['dialLimitQueue']-_0x500f73[_0x3467('0x81')]-_0x500f73[_0x3467('0x140')]-_0x500f73[_0x3467('0x141')];if(_0x58ff20>_0x513fa){_0x58ff20=_0x513fa;}}if(_0x58ff20>0x0&&_0x500f73[_0x3467('0x68')]==0x0){if(_0x500f73[_0x3467('0xb8')]===_0x3467('0x9')){_0x58ff20=0x1;}if(_0x58ff20>this['maxNumberOriginate']){_0x58ff20=this['maxNumberOriginate'];}for(var _0x1ef025 in this['agents']){if(typeof this[_0x3467('0x20')][_0x1ef025]!==_0x3467('0xb0')){if(this[_0x3467('0x20')][_0x1ef025][_0x3467('0x70')]===_0x3467('0x1fe')&&this[_0x3467('0x20')][_0x1ef025][_0x3467('0x8b')]===_0x3467('0x8c')){_0x447c4d[_0x3467('0x9d')](this[_0x3467('0x20')][_0x1ef025]['id']);}}}_0x500f73[_0x3467('0x68')]=0x1;hopperUtils['getContactDialer'](_0x500f73,_0x447c4d,_0x58ff20)['then'](function(_0x553362){_0x500f73[_0x3467('0x68')]=0x0;if(_0x553362){if(!utils[_0x3467('0x1f8')](_0x553362)){hopperUtils[_0x3467('0x1ff')](_0x500f73)['then'](sendMessageReschedule(_0x500f73))['catch'](loggerCatch(_0x3467('0x200')));}else{_0x500f73[_0x3467('0x81')]+=_0x553362[_0x3467('0x149')];_0x500f73['message']=_0x500f73[_0x3467('0xb8')]==='booked'?utils[_0x3467('0x6a')][_0x3467('0x142')]:utils[_0x3467('0x6a')][_0x3467('0x1f9')];for(var _0x290cb3=0x0;_0x290cb3<_0x553362['length'];_0x290cb3+=0x1){if(_[_0x3467('0xfd')](_0x553362[_0x290cb3])||_['isNil'](_0x553362[_0x290cb3][_0x3467('0x179')])||_[_0x3467('0xfd')](_0x553362[_0x290cb3][_0x3467('0x161')])){_0x5877fb[_0x3467('0x157')](_0x3467('0x1fb'),_0x500f73,_0x553362[_0x290cb3]);}else{hopperUtils[_0x3467('0x201')](_['pick'](_0x553362[_0x290cb3],[_0x3467('0xf7'),_0x3467('0x161')]))['then'](_0x5877fb[_0x3467('0x1fc')](_0x500f73,_0x553362[_0x290cb3]))[_0x3467('0xa3')](_0x5877fb[_0x3467('0x202')]('[actionOriginate]\x20',_0x500f73));}}}}})[_0x3467('0xa3')](loggerGetContactDialer(_0x3467('0x203'),_0x500f73,_0x58ff20));}};Dialer['prototype'][_0x3467('0x64')]=function(_0x28d1ce){if(_0x28d1ce['dialLimitQueue']>0x0){var _0x2ec0c3=_0x28d1ce['dialLimitQueue']-_0x28d1ce[_0x3467('0x81')]-_0x28d1ce[_0x3467('0x140')];if(_0x2ec0c3>0x0&&_0x28d1ce[_0x3467('0x68')]==0x0){this[_0x3467('0x204')](_0x28d1ce);}else{loggerPredictiveCalls['info'](_0x3467('0x205'));}}else{this['tryOriginatePredictive'](_0x28d1ce);}};Dialer[_0x3467('0x92')]['tryOriginatePredictive']=function(_0x5bf70c){var _0x2460cb=this;var _0x5326c2=[];_0x5bf70c[_0x3467('0x81')]+=0x1;for(var _0x437e20 in this[_0x3467('0x20')]){if(typeof this['agents'][_0x437e20]!==_0x3467('0xb0')){if(this[_0x3467('0x20')][_0x437e20][_0x3467('0x70')]===_0x3467('0x1fe')&&this['agents'][_0x437e20]['status']===_0x3467('0x8c')){_0x5326c2[_0x3467('0x9d')](this[_0x3467('0x20')][_0x437e20]['id']);}}}_0x5bf70c[_0x3467('0x68')]=0x1;return this[_0x3467('0x206')](_0x5bf70c['id'],_0x5326c2,0x1,_0x5bf70c[_0x3467('0x207')],_0x5bf70c)[_0x3467('0x40')](function(_0x111617){_0x5bf70c['temp']=0x1;if(_0x111617){if(!utils['checkContactEmpty'](_0x111617)){utils['checkContactLowerLimitOriginate'](_0x5bf70c,0x1,0x0);return hopperUtils['countReScheduled'](_0x5bf70c)['then'](sendMessageReschedule(_0x5bf70c))[_0x3467('0xa3')](loggerCatch(_0x3467('0x200')));}else{_0x5bf70c[_0x3467('0x69')]=utils[_0x3467('0x6a')]['RUNNING'];if(_['isNil'](_0x111617[0x0])||_[_0x3467('0xfd')](_0x111617[0x0][_0x3467('0x179')])||_[_0x3467('0xfd')](_0x111617[0x0][_0x3467('0x161')])){_0x2460cb['emptyContact'](_0x3467('0x1fb'),_0x5bf70c,_0x111617[0x0]);}else{return hopperUtils[_0x3467('0x201')](_['pick'](_0x111617[0x0],['VoiceQueueId',_0x3467('0x161')]))[_0x3467('0x40')](_0x2460cb[_0x3467('0x1fc')](_0x5bf70c,_0x111617[0x0]))[_0x3467('0xa3')](_0x2460cb[_0x3467('0x202')](_0x3467('0x208'),_0x5bf70c));}}}})['catch'](loggerGetContactDialer(_0x3467('0x209'),_0x5bf70c,0x1));};Dialer['prototype'][_0x3467('0x1d4')]=function(_0x31186e,_0x398b71,_0x3d62d4,_0x48631e,_0x4b1624,_0x4fb602){loggerPredictive[_0x3467('0x4a')](_0x3467('0x20a'));loggerPredictive[_0x3467('0x4a')](_0x3467('0x20b'),_0x31186e);loggerPredictive[_0x3467('0x4a')](_0x3467('0x20c'),_0x398b71);loggerPredictive[_0x3467('0x4a')](_0x3467('0x20d'),_0x3d62d4);loggerPredictive[_0x3467('0x4a')](_0x3467('0x20e'),_0x48631e);loggerPredictive['info'](_0x3467('0x20f'),_0x4b1624);loggerPredictive[_0x3467('0x4a')]('---------------------------');return new Promise(function(_0x3005e0,_0x520ed1){if(_0x31186e<=0x0||isNaN(_0x31186e)){return _0x520ed1(msgResponse(_0x3467('0x210'),_0x3467('0x86'),_0x3467('0x211')+_0x31186e));}if(_0x3d62d4<=0x0||isNaN(_0x3d62d4)){return _0x520ed1(msgResponse(_0x3467('0x210'),_0x3467('0x86'),_0x3467('0x212')+_0x3d62d4));}if(_0x48631e<=0x0||isNaN(_0x48631e)){return _0x520ed1(msgResponse(_0x3467('0x210'),_0x3467('0x86'),_0x3467('0x213')+_0x48631e));}if(_0x398b71<=0x0||isNaN(_0x398b71)){return _0x520ed1(msgResponse(_0x3467('0x210'),_0x3467('0x86'),'interval\x20=\x20'+_0x398b71));}if(_0x4b1624<=0x0||isNaN(_0x4b1624)){return _0x520ed1(msgResponse(_0x3467('0x210'),'Error',_0x3467('0x214')+_0x4b1624));}_0x4fb602=_0x4fb602||0x0;var _0x4e0f7b=0x1/_0x3d62d4;var _0x1c442c=0x0;var _0x39994a=0x0;var _0x375ad3=0x0;var _0x1110b5=0x0;for(var _0x24373b=0x0;_0x375ad3<_0x4b1624;_0x24373b+=0x1){_0x39994a=_0x24373b/_0x398b71;_0x1c442c=(_0x48631e*_0x39994a+_0x4fb602)/_0x4e0f7b;_0x375ad3=utils[_0x3467('0x215')](_0x1c442c,_0x31186e);_0x1110b5=_0x1c442c/_0x31186e*(0x1-utils['erlangb'](_0x1c442c,_0x31186e));}return _0x3005e0({'erlangCalls':_0x24373b,'erlangCallToSecond':_0x398b71/_0x24373b,'erlangAbandonmentRate':_0x375ad3,'erlangBusyFactor':_0x1110b5});});};Dialer[_0x3467('0x92')][_0x3467('0x1d5')]=function(_0x252018,_0x2147c4,_0xf3b94a,_0xa6584d,_0x8cf1dd,_0x59ecb6){loggerPredictive[_0x3467('0x4a')](_0x3467('0x216'));loggerPredictive[_0x3467('0x4a')](_0x3467('0x20b'),_0x252018);loggerPredictive[_0x3467('0x4a')](_0x3467('0x20c'),_0x2147c4);loggerPredictive['info'](_0x3467('0x20d'),_0xf3b94a);loggerPredictive[_0x3467('0x4a')](_0x3467('0x20e'),_0xa6584d);loggerPredictive[_0x3467('0x4a')](_0x3467('0x217'),_0x8cf1dd);loggerPredictive[_0x3467('0x4a')](_0x3467('0x54'));return new Promise(function(_0x59ae7,_0x56506b){if(_0x252018<=0x0||isNaN(_0x252018)){return _0x56506b(msgResponse(_0x3467('0x218'),'Error','m\x20=\x20'+_0x252018));}if(_0xf3b94a<=0x0||isNaN(_0xf3b94a)){return _0x56506b(msgResponse(_0x3467('0x218'),'Error','Ts\x20=\x20'+_0xf3b94a));}if(_0xa6584d<=0x0||isNaN(_0xa6584d)){return _0x56506b(msgResponse(_0x3467('0x218'),'Error',_0x3467('0x213')+_0xa6584d));}if(_0x2147c4<=0x0||isNaN(_0x2147c4)){return _0x56506b(msgResponse('[busyFactor]',_0x3467('0x86'),_0x3467('0x219')+_0x2147c4));}if(_0x8cf1dd<=0x0||isNaN(_0x8cf1dd)){return _0x56506b(msgResponse(_0x3467('0x218'),_0x3467('0x86'),'Umin\x20=\x20'+_0x8cf1dd));}_0x59ecb6=_0x59ecb6||0x0;var _0x1718a4=0x1/_0xf3b94a;var _0x11fc4f=0x0;var _0x33cbfc=0x0;var _0x3acd02=0x0;var _0x515e7a=0x0;for(var _0x237d1e=0x0;_0x515e7a<_0x8cf1dd;_0x237d1e+=0x1){_0x33cbfc=_0x237d1e/_0x2147c4;_0x11fc4f=(_0xa6584d*_0x33cbfc+_0x59ecb6)/_0x1718a4;_0x3acd02=utils[_0x3467('0x215')](_0x11fc4f,_0x252018);_0x515e7a=_0x11fc4f/_0x252018*(0x1-utils[_0x3467('0x215')](_0x11fc4f,_0x252018));}return _0x59ae7({'erlangCalls':_0x237d1e,'erlangCallToSecond':_0x2147c4/_0x237d1e,'erlangAbandonmentRate':_0x3acd02,'erlangBusyFactor':_0x515e7a});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 1dcdcdd..8381a84 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 _0x83e9=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x49a7ba,_0x3370d5){var _0x465eab=function(_0x300a8f){while(--_0x300a8f){_0x49a7ba['push'](_0x49a7ba['shift']());}};_0x465eab(++_0x3370d5);}(_0x83e9,0x129));var _0x983e=function(_0x59a294,_0x17dde5){_0x59a294=_0x59a294-0x0;var _0x175f9b=_0x83e9[_0x59a294];return _0x175f9b;};'use strict';var util=require(_0x983e('0x0'));var _=require(_0x983e('0x1'));var moment=require(_0x983e('0x2'));function checkNameSurname(_0x300b20,_0x9848ae,_0x139e9b){var _0x2d3b7e='';if(!_['isNil'](_0x9848ae)&&_0x983e('0x3')===typeof _0x9848ae){_0x2d3b7e+=_0x9848ae;}if(!_[_0x983e('0x4')](_0x139e9b)&&_0x983e('0x3')===typeof _0x139e9b){_0x2d3b7e+='\x20'+_0x139e9b;}if(_0x2d3b7e!==''){return _0x2d3b7e;}return _0x300b20;}function Action(_0x5c30a9,_0x6a1621,_0x25ec68){this[_0x983e('0x5')]=_0x5c30a9;this[_0x983e('0x6')]=_0x25ec68||undefined;this[_0x983e('0x7')]=checkNameSurname(_0x6a1621['Contact'][_0x983e('0x8')],_0x6a1621[_0x983e('0x9')][_0x983e('0xa')],_0x6a1621['Contact'][_0x983e('0xb')]);this[_0x983e('0xc')]=_0x6a1621['phone'];this[_0x983e('0xd')]=_0x5c30a9[_0x983e('0x7')];this[_0x983e('0xe')]=_0x6a1621['active']||![];this[_0x983e('0xf')]=_0x5c30a9['type'];this[_0x983e('0x10')]=_0x5c30a9[_0x983e('0x10')]||0x3;this[_0x983e('0x11')]=_0x6a1621['scheduledat'];this[_0x983e('0x12')]=_0x6a1621[_0x983e('0x12')];this['countcongestionretry']=_0x6a1621[_0x983e('0x13')];this[_0x983e('0x14')]=_0x6a1621[_0x983e('0x14')];this[_0x983e('0x15')]=_0x6a1621[_0x983e('0x15')];this['countdropretry']=_0x6a1621['countdropretry'];this['countabandonedretry']=_0x6a1621[_0x983e('0x16')];this[_0x983e('0x17')]=_0x6a1621[_0x983e('0x17')];this[_0x983e('0x18')]=_0x6a1621[_0x983e('0x18')];this[_0x983e('0x19')]=_0x6a1621['ContactId'];this[_0x983e('0x1a')]=_0x6a1621[_0x983e('0x1a')];this[_0x983e('0x1b')]=_0x6a1621['UserId'];this[_0x983e('0x1c')]=_0x6a1621[_0x983e('0x1c')];this[_0x983e('0x1d')]=_0x6a1621[_0x983e('0x1d')];this['idHopper']=_0x6a1621['id'];this[_0x983e('0x1e')]=_0x6a1621['Contact']['firstName']||'';this[_0x983e('0x1f')]=moment()[_0x983e('0x20')](_0x983e('0x21'));this[_0x983e('0x22')]=_0x6a1621[_0x983e('0x22')];this[_0x983e('0x23')]=_0x6a1621[_0x983e('0x23')];this[_0x983e('0x24')]=_0x6a1621['callbackat'];this[_0x983e('0x25')]=_0x6a1621[_0x983e('0x25')];this[_0x983e('0x26')]='';this[_0x983e('0x27')]='';}Action[_0x983e('0x28')][_0x983e('0x29')]=function(){return util[_0x983e('0x20')](_0x983e('0x2a'),this[_0x983e('0x7')],this[_0x983e('0x5')]['dialCutDigit']>0x0?this[_0x983e('0xc')][_0x983e('0x2b')](this[_0x983e('0x5')][_0x983e('0x2c')]):this[_0x983e('0xc')]);};Action[_0x983e('0x28')][_0x983e('0x2d')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x544e=['getQueue','queue','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype'];(function(_0x3f6932,_0x863654){var _0x2c9f50=function(_0x424d3b){while(--_0x424d3b){_0x3f6932['push'](_0x3f6932['shift']());}};_0x2c9f50(++_0x863654);}(_0x544e,0x1c5));var _0xe544=function(_0x3602ce,_0x21518c){_0x3602ce=_0x3602ce-0x0;var _0x57720a=_0x544e[_0x3602ce];return _0x57720a;};'use strict';var util=require('util');var _=require(_0xe544('0x0'));var moment=require(_0xe544('0x1'));function checkNameSurname(_0x2e9640,_0x27180b,_0x3b649c){var _0x2ef586='';if(!_[_0xe544('0x2')](_0x27180b)&&_0xe544('0x3')===typeof _0x27180b){_0x2ef586+=_0x27180b;}if(!_['isNil'](_0x3b649c)&&'string'===typeof _0x3b649c){_0x2ef586+='\x20'+_0x3b649c;}if(_0x2ef586!==''){return _0x2ef586;}return _0x2e9640;}function Action(_0x114a57,_0x11262e,_0x4d729d){this[_0xe544('0x4')]=_0x114a57;this[_0xe544('0x5')]=_0x4d729d||undefined;this[_0xe544('0x6')]=checkNameSurname(_0x11262e[_0xe544('0x7')][_0xe544('0x8')],_0x11262e[_0xe544('0x7')][_0xe544('0x9')],_0x11262e[_0xe544('0x7')]['lastName']);this[_0xe544('0xa')]=_0x11262e[_0xe544('0x8')];this['queue']=_0x114a57[_0xe544('0x6')];this[_0xe544('0xb')]=_0x11262e['active']||![];this[_0xe544('0xc')]=_0x114a57[_0xe544('0xc')];this[_0xe544('0xd')]=_0x114a57[_0xe544('0xd')]||0x3;this['scheduledat']=_0x11262e[_0xe544('0xe')];this['countbusyretry']=_0x11262e[_0xe544('0xf')];this[_0xe544('0x10')]=_0x11262e[_0xe544('0x10')];this[_0xe544('0x11')]=_0x11262e[_0xe544('0x11')];this['countnosuchnumberretry']=_0x11262e[_0xe544('0x12')];this['countdropretry']=_0x11262e[_0xe544('0x13')];this['countabandonedretry']=_0x11262e['countabandonedretry'];this['countmachineretry']=_0x11262e[_0xe544('0x14')];this['countagentrejectretry']=_0x11262e[_0xe544('0x15')];this[_0xe544('0x16')]=_0x11262e['ContactId'];this[_0xe544('0x17')]=_0x11262e[_0xe544('0x17')];this['UserId']=_0x11262e['UserId'];this[_0xe544('0x18')]=_0x11262e['VoiceQueueId'];this[_0xe544('0x19')]=_0x11262e['CampaignId'];this['idHopper']=_0x11262e['id'];this[_0xe544('0x1a')]=_0x11262e[_0xe544('0x7')][_0xe544('0x9')]||'';this['starttime']=moment()[_0xe544('0x1b')](_0xe544('0x1c'));this['callback']=_0x11262e[_0xe544('0x1d')];this['callbackuniqueid']=_0x11262e[_0xe544('0x1e')];this['callbackat']=_0x11262e['callbackat'];this[_0xe544('0x1f')]=_0x11262e[_0xe544('0x1f')];this[_0xe544('0x20')]='';this[_0xe544('0x21')]='';}Action['prototype'][_0xe544('0x22')]=function(){return util[_0xe544('0x1b')](_0xe544('0x23'),this['name'],this[_0xe544('0x4')][_0xe544('0x24')]>0x0?this['number'][_0xe544('0x25')](this[_0xe544('0x4')][_0xe544('0x24')]):this[_0xe544('0xa')]);};Action[_0xe544('0x26')][_0xe544('0x27')]=function(){return this[_0xe544('0x28')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 9048d86..8742aa4 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 _0xd75e=['holdtime','talktime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xd75e,0x1c8));var _0xed75=function(_0x3a77b9,_0x26ee2d){_0x3a77b9=_0x3a77b9-0x0;var _0x38fd17=_0xd75e[_0x3a77b9];return _0x38fd17;};'use strict';var moment=require(_0xed75('0x0'));var utils=require(_0xed75('0x1'));function AgentComplete(_0x122716,_0x10dedb){this[_0xed75('0x2')]=0x4;this[_0xed75('0x3')]=_0xed75('0x4');this['scheduledat']=_0x122716[_0xed75('0x5')];this[_0xed75('0x6')]=_0x122716['type'];this[_0xed75('0x7')]=_0x122716[_0xed75('0x6')]===_0xed75('0x8')?_0xed75('0x9'):_0x122716[_0xed75('0x6')];this[_0xed75('0xa')]=_0x122716[_0xed75('0xa')];this['countcongestionretry']=_0x122716[_0xed75('0xb')];this[_0xed75('0xc')]=_0x122716[_0xed75('0xc')];this['countglobal']=_0x122716[_0xed75('0xa')]+_0x122716[_0xed75('0xb')]+_0x122716[_0xed75('0xc')]+_0x122716['countnosuchnumberretry']+_0x122716[_0xed75('0xd')]+_0x122716[_0xed75('0xe')]+_0x122716[_0xed75('0xf')]+_0x122716[_0xed75('0x10')];this['countnosuchnumberretry']=_0x122716[_0xed75('0x11')];this[_0xed75('0xd')]=_0x122716[_0xed75('0xd')];this['countabandonedretry']=_0x122716['countabandonedretry'];this[_0xed75('0xf')]=_0x122716[_0xed75('0xf')];this[_0xed75('0x10')]=_0x122716[_0xed75('0x10')];this[_0xed75('0x12')]=_0x10dedb[_0xed75('0x12')];this[_0xed75('0x13')]=_0x122716['name'];this[_0xed75('0x14')]=_0x122716[_0xed75('0x15')];this['starttime']=_0x122716[_0xed75('0x16')];this[_0xed75('0x17')]=_0x122716['responsetime'];this[_0xed75('0x18')]=_0x122716[_0xed75('0x18')];this[_0xed75('0x19')]=moment()['format'](_0xed75('0x1a'));this[_0xed75('0x1b')]=utils['getSeconds'](_0x122716[_0xed75('0x17')],_0x122716[_0xed75('0x16')]);this[_0xed75('0x1c')]=utils['getSeconds'](_0x122716['answertime'],_0x122716[_0xed75('0x17')]);this[_0xed75('0x1d')]=utils[_0xed75('0x1e')](this[_0xed75('0x19')],_0x122716[_0xed75('0x18')]);this['queue']=_0x10dedb[_0xed75('0x9')];this[_0xed75('0x1f')]=_0x10dedb[_0xed75('0x1f')];this[_0xed75('0x20')]=_0x10dedb[_0xed75('0x20')];this[_0xed75('0x21')]=_0x122716[_0xed75('0x21')];this[_0xed75('0x22')]=_0x122716[_0xed75('0x22')];this[_0xed75('0x23')]=_0x122716[_0xed75('0x23')];this[_0xed75('0x24')]=_0x122716['recallme'];this['ContactId']=_0x122716['ContactId'];this[_0xed75('0x25')]=_0x122716[_0xed75('0x25')];this[_0xed75('0x26')]=_0x122716[_0xed75('0x26')];this['VoiceQueueId']=_0x122716['VoiceQueueId'];this[_0xed75('0x27')]=_0x122716[_0xed75('0x27')];this[_0xed75('0x28')]=_0x122716['originatecalleridnum']||'';this[_0xed75('0x29')]=_0x122716[_0xed75('0x29')]||'';this['agiafterat']=_0x122716[_0xed75('0x2a')];}module[_0xed75('0x2b')]=AgentComplete; \ No newline at end of file +var _0x1f09=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x2b78da,_0x20351e){var _0x3159c4=function(_0x12655a){while(--_0x12655a){_0x2b78da['push'](_0x2b78da['shift']());}};_0x3159c4(++_0x20351e);}(_0x1f09,0x131));var _0x91f0=function(_0x517165,_0x2b6517){_0x517165=_0x517165-0x0;var _0x5648cf=_0x1f09[_0x517165];return _0x5648cf;};'use strict';var moment=require(_0x91f0('0x0'));var utils=require(_0x91f0('0x1'));function AgentComplete(_0x28b3e4,_0x816718){this[_0x91f0('0x2')]=0x4;this[_0x91f0('0x3')]=_0x91f0('0x4');this[_0x91f0('0x5')]=_0x28b3e4[_0x91f0('0x5')];this[_0x91f0('0x6')]=_0x28b3e4[_0x91f0('0x6')];this[_0x91f0('0x7')]=_0x28b3e4['type']===_0x91f0('0x8')?_0x91f0('0x9'):_0x28b3e4[_0x91f0('0x6')];this[_0x91f0('0xa')]=_0x28b3e4[_0x91f0('0xa')];this[_0x91f0('0xb')]=_0x28b3e4[_0x91f0('0xb')];this['countnoanswerretry']=_0x28b3e4[_0x91f0('0xc')];this[_0x91f0('0xd')]=_0x28b3e4[_0x91f0('0xa')]+_0x28b3e4[_0x91f0('0xb')]+_0x28b3e4[_0x91f0('0xc')]+_0x28b3e4['countnosuchnumberretry']+_0x28b3e4[_0x91f0('0xe')]+_0x28b3e4[_0x91f0('0xf')]+_0x28b3e4[_0x91f0('0x10')]+_0x28b3e4['countagentrejectretry'];this['countnosuchnumberretry']=_0x28b3e4[_0x91f0('0x11')];this[_0x91f0('0xe')]=_0x28b3e4[_0x91f0('0xe')];this[_0x91f0('0xf')]=_0x28b3e4[_0x91f0('0xf')];this['countmachineretry']=_0x28b3e4[_0x91f0('0x10')];this[_0x91f0('0x12')]=_0x28b3e4[_0x91f0('0x12')];this[_0x91f0('0x13')]=_0x816718[_0x91f0('0x13')];this[_0x91f0('0x14')]=_0x28b3e4[_0x91f0('0x15')];this[_0x91f0('0x16')]=_0x28b3e4['number'];this[_0x91f0('0x17')]=_0x28b3e4[_0x91f0('0x17')];this['responsetime']=_0x28b3e4[_0x91f0('0x18')];this[_0x91f0('0x19')]=_0x28b3e4[_0x91f0('0x19')];this[_0x91f0('0x1a')]=moment()[_0x91f0('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x91f0('0x1c')]=utils[_0x91f0('0x1d')](_0x28b3e4[_0x91f0('0x18')],_0x28b3e4[_0x91f0('0x17')]);this['holdtime']=utils[_0x91f0('0x1d')](_0x28b3e4[_0x91f0('0x19')],_0x28b3e4[_0x91f0('0x18')]);this[_0x91f0('0x1e')]=utils[_0x91f0('0x1d')](this[_0x91f0('0x1a')],_0x28b3e4[_0x91f0('0x19')]);this[_0x91f0('0x9')]=_0x816718[_0x91f0('0x9')];this[_0x91f0('0x1f')]=_0x816718[_0x91f0('0x1f')];this[_0x91f0('0x20')]=_0x816718[_0x91f0('0x20')];this[_0x91f0('0x21')]=_0x28b3e4['callback'];this['callbackuniqueid']=_0x28b3e4['callbackuniqueid'];this[_0x91f0('0x22')]=_0x28b3e4[_0x91f0('0x22')];this[_0x91f0('0x23')]=_0x28b3e4[_0x91f0('0x23')];this[_0x91f0('0x24')]=_0x28b3e4['ContactId'];this['ListId']=_0x28b3e4[_0x91f0('0x25')];this['UserId']=_0x28b3e4[_0x91f0('0x26')];this['VoiceQueueId']=_0x28b3e4[_0x91f0('0x27')];this[_0x91f0('0x28')]=_0x28b3e4[_0x91f0('0x28')];this['originatecalleridnum']=_0x28b3e4[_0x91f0('0x29')]||'';this['originatecalleridname']=_0x28b3e4[_0x91f0('0x2a')]||'';this[_0x91f0('0x2b')]=_0x28b3e4['agiafterat'];}module[_0x91f0('0x2c')]=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 0b8348e..6daf8c4 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 _0x177c=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5f1f9d,_0x5a046f){var _0x16f062=function(_0x5424b3){while(--_0x5424b3){_0x5f1f9d['push'](_0x5f1f9d['shift']());}};_0x16f062(++_0x5a046f);}(_0x177c,0x11e));var _0xc177=function(_0x53d5ef,_0xbfefae){_0x53d5ef=_0x53d5ef-0x0;var _0x6721ef=_0x177c[_0x53d5ef];return _0x6721ef;};'use strict';function Final(_0x5174f3){this[_0xc177('0x0')]=_0x5174f3[_0xc177('0x0')];this[_0xc177('0x1')]=_0x5174f3[_0xc177('0x1')];this['type']=_0x5174f3[_0xc177('0x2')];this[_0xc177('0x3')]=_0x5174f3[_0xc177('0x2')]===_0xc177('0x4')?_0xc177('0x5'):_0x5174f3[_0xc177('0x2')];this['countbusyretry']=_0x5174f3[_0xc177('0x6')];this[_0xc177('0x7')]=_0x5174f3[_0xc177('0x7')];this[_0xc177('0x8')]=_0x5174f3['countnoanswerretry'];this[_0xc177('0x9')]=_0x5174f3[_0xc177('0x6')]+_0x5174f3[_0xc177('0x7')]+_0x5174f3[_0xc177('0x8')]+_0x5174f3[_0xc177('0xa')]+_0x5174f3[_0xc177('0xb')]+_0x5174f3[_0xc177('0xc')]+_0x5174f3[_0xc177('0xd')]+_0x5174f3[_0xc177('0xe')];this[_0xc177('0xa')]=_0x5174f3[_0xc177('0xa')];this[_0xc177('0xb')]=_0x5174f3['countdropretry'];this[_0xc177('0xc')]=_0x5174f3[_0xc177('0xc')];this[_0xc177('0xd')]=_0x5174f3[_0xc177('0xd')];this['countagentrejectretry']=_0x5174f3[_0xc177('0xe')];this[_0xc177('0x5')]=_0x5174f3[_0xc177('0x5')];this[_0xc177('0xf')]=_0x5174f3[_0xc177('0xf')];this[_0xc177('0x10')]=_0x5174f3[_0xc177('0x10')];this['starttime']=_0x5174f3[_0xc177('0x11')];this['responsetime']=_0x5174f3[_0xc177('0x12')];this['endtime']=_0x5174f3['responsetime'];this[_0xc177('0x13')]=_0x5174f3[_0xc177('0x13')]||0x0;this[_0xc177('0x14')]=_0x5174f3[_0xc177('0x14')]||0x0;this[_0xc177('0x15')]=_0x5174f3[_0xc177('0x15')]||0x0;this[_0xc177('0x16')]=_0x5174f3['callback'];this[_0xc177('0x17')]=_0x5174f3[_0xc177('0x17')];this[_0xc177('0x18')]=_0x5174f3[_0xc177('0x18')];this['recallme']=_0x5174f3['recallme'];this[_0xc177('0x19')]=_0x5174f3[_0xc177('0x19')];this[_0xc177('0x1a')]=_0x5174f3[_0xc177('0x1a')];this[_0xc177('0x1b')]=_0x5174f3[_0xc177('0x1b')];this[_0xc177('0x1c')]=_0x5174f3[_0xc177('0x1c')];this[_0xc177('0x1d')]=_0x5174f3[_0xc177('0x1d')];this[_0xc177('0x1e')]=_0x5174f3[_0xc177('0x1e')]||'';this[_0xc177('0x1f')]=_0x5174f3[_0xc177('0x1f')]||'';this[_0xc177('0x20')]=_0x5174f3[_0xc177('0x20')];this[_0xc177('0x21')]=_0x5174f3['statedesc'];}module[_0xc177('0x22')]=Final; \ No newline at end of file +var _0x6206=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0xc4966b,_0x6cd5e0){var _0x1802bb=function(_0x12f623){while(--_0x12f623){_0xc4966b['push'](_0xc4966b['shift']());}};_0x1802bb(++_0x6cd5e0);}(_0x6206,0x184));var _0x6620=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x6206[_0x119d5a];return _0x15bff4;};'use strict';function Final(_0x12b91c){this['uniqueid']=_0x12b91c[_0x6620('0x0')];this['scheduledat']=_0x12b91c[_0x6620('0x1')];this[_0x6620('0x2')]=_0x12b91c[_0x6620('0x2')];this[_0x6620('0x3')]=_0x12b91c['type']===_0x6620('0x4')?_0x6620('0x5'):_0x12b91c[_0x6620('0x2')];this[_0x6620('0x6')]=_0x12b91c['countbusyretry'];this[_0x6620('0x7')]=_0x12b91c[_0x6620('0x7')];this[_0x6620('0x8')]=_0x12b91c[_0x6620('0x8')];this[_0x6620('0x9')]=_0x12b91c['countbusyretry']+_0x12b91c[_0x6620('0x7')]+_0x12b91c[_0x6620('0x8')]+_0x12b91c[_0x6620('0xa')]+_0x12b91c[_0x6620('0xb')]+_0x12b91c[_0x6620('0xc')]+_0x12b91c[_0x6620('0xd')]+_0x12b91c[_0x6620('0xe')];this[_0x6620('0xa')]=_0x12b91c[_0x6620('0xa')];this[_0x6620('0xb')]=_0x12b91c[_0x6620('0xb')];this[_0x6620('0xc')]=_0x12b91c[_0x6620('0xc')];this[_0x6620('0xd')]=_0x12b91c[_0x6620('0xd')];this[_0x6620('0xe')]=_0x12b91c[_0x6620('0xe')];this['queue']=_0x12b91c[_0x6620('0x5')];this[_0x6620('0xf')]=_0x12b91c[_0x6620('0xf')];this[_0x6620('0x10')]=_0x12b91c[_0x6620('0x10')];this[_0x6620('0x11')]=_0x12b91c['starttime'];this['responsetime']=_0x12b91c[_0x6620('0x12')];this[_0x6620('0x13')]=_0x12b91c[_0x6620('0x12')];this[_0x6620('0x14')]=_0x12b91c['ringtime']||0x0;this['holdtime']=_0x12b91c[_0x6620('0x15')]||0x0;this['talktime']=_0x12b91c[_0x6620('0x16')]||0x0;this[_0x6620('0x17')]=_0x12b91c['callback'];this[_0x6620('0x18')]=_0x12b91c[_0x6620('0x18')];this[_0x6620('0x19')]=_0x12b91c[_0x6620('0x19')];this[_0x6620('0x1a')]=_0x12b91c[_0x6620('0x1a')];this[_0x6620('0x1b')]=_0x12b91c[_0x6620('0x1b')];this['ListId']=_0x12b91c['ListId'];this[_0x6620('0x1c')]=_0x12b91c[_0x6620('0x1c')];this[_0x6620('0x1d')]=_0x12b91c[_0x6620('0x1d')];this[_0x6620('0x1e')]=_0x12b91c['CampaignId'];this['originatecalleridnum']=_0x12b91c[_0x6620('0x1f')]||'';this[_0x6620('0x20')]=_0x12b91c[_0x6620('0x20')]||'';this[_0x6620('0x21')]=_0x12b91c['state'];this[_0x6620('0x22')]=_0x12b91c[_0x6620('0x22')];}module[_0x6620('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 acb7e5a..5535d23 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 _0x4088=['VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId'];(function(_0x257630,_0x59cf38){var _0x5abdfd=function(_0x5a10d4){while(--_0x5a10d4){_0x257630['push'](_0x257630['shift']());}};_0x5abdfd(++_0x59cf38);}(_0x4088,0x1b0));var _0x8408=function(_0x3ba938,_0x27414d){_0x3ba938=_0x3ba938-0x0;var _0x2aabff=_0x4088[_0x3ba938];return _0x2aabff;};'use strict';var moment=require(_0x8408('0x0'));var utils=require('../utils');function Hangup(_0x252081,_0x8302d9){this[_0x8408('0x1')]=0x4;this[_0x8408('0x2')]=_0x8408('0x3');this[_0x8408('0x4')]=_0x252081[_0x8408('0x4')];this[_0x8408('0x5')]=_0x252081[_0x8408('0x5')];this[_0x8408('0x6')]=_0x252081[_0x8408('0x5')]===_0x8408('0x7')?_0x8408('0x8'):_0x252081[_0x8408('0x5')];this[_0x8408('0x9')]=_0x252081[_0x8408('0x9')]||![];this[_0x8408('0xa')]=_0x252081['countbusyretry'];this[_0x8408('0xb')]=_0x252081[_0x8408('0xb')];this[_0x8408('0xc')]=_0x252081[_0x8408('0xc')];this[_0x8408('0xd')]=_0x252081[_0x8408('0xa')]+_0x252081[_0x8408('0xb')]+_0x252081['countnoanswerretry']+_0x252081[_0x8408('0xe')]+_0x252081[_0x8408('0xf')]+_0x252081[_0x8408('0x10')]+_0x252081[_0x8408('0x11')]+_0x252081[_0x8408('0x12')];this[_0x8408('0xe')]=_0x252081[_0x8408('0xe')];this['countdropretry']=_0x252081['countdropretry'];this[_0x8408('0x10')]=_0x252081[_0x8408('0x10')];this[_0x8408('0x11')]=_0x252081[_0x8408('0x11')];this[_0x8408('0x12')]=_0x252081[_0x8408('0x12')];this['uniqueid']=_0x8302d9[_0x8408('0x13')];this[_0x8408('0x14')]=_0x252081['name'];this['calleridnum']=_0x252081['number'];this[_0x8408('0x15')]=_0x252081[_0x8408('0x15')];this[_0x8408('0x16')]=_0x252081['responsetime'];this[_0x8408('0x17')]=moment()[_0x8408('0x18')](_0x8408('0x19'));this['ringtime']=utils[_0x8408('0x1a')](_0x252081[_0x8408('0x16')],_0x252081[_0x8408('0x15')]);this[_0x8408('0x1b')]=0x0;this['talktime']=utils['getSeconds'](this[_0x8408('0x17')],_0x252081[_0x8408('0x16')]);this[_0x8408('0x8')]=_0x252081[_0x8408('0x8')];this['membername']='IVR';this[_0x8408('0x1c')]=_0x8302d9[_0x8408('0x1d')];this['callback']=_0x252081[_0x8408('0x1e')];this[_0x8408('0x1f')]=_0x252081[_0x8408('0x1f')];this['callbackat']=_0x252081[_0x8408('0x20')];this['recallme']=_0x252081['recallme'];this[_0x8408('0x21')]=_0x252081[_0x8408('0x21')];this[_0x8408('0x22')]=_0x252081[_0x8408('0x22')];this[_0x8408('0x23')]=_0x252081[_0x8408('0x23')];this[_0x8408('0x24')]=_0x252081[_0x8408('0x24')];this[_0x8408('0x25')]=_0x252081['CampaignId'];}module[_0x8408('0x26')]=Hangup; \ No newline at end of file +var _0x9362=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','starttime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','number','responsetime'];(function(_0x13e8a1,_0x539097){var _0x247998=function(_0x3f715f){while(--_0x3f715f){_0x13e8a1['push'](_0x13e8a1['shift']());}};_0x247998(++_0x539097);}(_0x9362,0xbb));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x2936('0x0'));var utils=require(_0x2936('0x1'));function Hangup(_0x1a2e53,_0x352fb7){this[_0x2936('0x2')]=0x4;this[_0x2936('0x3')]='Answer';this[_0x2936('0x4')]=_0x1a2e53[_0x2936('0x4')];this[_0x2936('0x5')]=_0x1a2e53[_0x2936('0x5')];this[_0x2936('0x6')]=_0x1a2e53['type']===_0x2936('0x7')?_0x2936('0x8'):_0x1a2e53[_0x2936('0x5')];this[_0x2936('0x9')]=_0x1a2e53[_0x2936('0x9')]||![];this[_0x2936('0xa')]=_0x1a2e53[_0x2936('0xa')];this['countcongestionretry']=_0x1a2e53[_0x2936('0xb')];this[_0x2936('0xc')]=_0x1a2e53['countnoanswerretry'];this['countglobal']=_0x1a2e53[_0x2936('0xa')]+_0x1a2e53[_0x2936('0xb')]+_0x1a2e53[_0x2936('0xc')]+_0x1a2e53['countnosuchnumberretry']+_0x1a2e53[_0x2936('0xd')]+_0x1a2e53['countabandonedretry']+_0x1a2e53[_0x2936('0xe')]+_0x1a2e53[_0x2936('0xf')];this['countnosuchnumberretry']=_0x1a2e53[_0x2936('0x10')];this[_0x2936('0xd')]=_0x1a2e53[_0x2936('0xd')];this[_0x2936('0x11')]=_0x1a2e53[_0x2936('0x11')];this[_0x2936('0xe')]=_0x1a2e53[_0x2936('0xe')];this[_0x2936('0xf')]=_0x1a2e53['countagentrejectretry'];this[_0x2936('0x12')]=_0x352fb7[_0x2936('0x12')];this['calleridname']=_0x1a2e53[_0x2936('0x13')];this[_0x2936('0x14')]=_0x1a2e53[_0x2936('0x15')];this['starttime']=_0x1a2e53['starttime'];this[_0x2936('0x16')]=_0x1a2e53[_0x2936('0x16')];this[_0x2936('0x17')]=moment()[_0x2936('0x18')](_0x2936('0x19'));this['ringtime']=utils[_0x2936('0x1a')](_0x1a2e53['responsetime'],_0x1a2e53[_0x2936('0x1b')]);this[_0x2936('0x1c')]=0x0;this[_0x2936('0x1d')]=utils['getSeconds'](this[_0x2936('0x17')],_0x1a2e53[_0x2936('0x16')]);this[_0x2936('0x8')]=_0x1a2e53[_0x2936('0x8')];this['membername']=_0x2936('0x1e');this[_0x2936('0x1f')]=_0x352fb7[_0x2936('0x20')];this[_0x2936('0x21')]=_0x1a2e53[_0x2936('0x21')];this[_0x2936('0x22')]=_0x1a2e53[_0x2936('0x22')];this[_0x2936('0x23')]=_0x1a2e53['callbackat'];this['recallme']=_0x1a2e53['recallme'];this[_0x2936('0x24')]=_0x1a2e53['ContactId'];this[_0x2936('0x25')]=_0x1a2e53[_0x2936('0x25')];this[_0x2936('0x26')]=_0x1a2e53['UserId'];this[_0x2936('0x27')]=_0x1a2e53[_0x2936('0x27')];this[_0x2936('0x28')]=_0x1a2e53[_0x2936('0x28')];}module[_0x2936('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 2436029..6e2541b 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 _0xcc06=['campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','name','starttime','responsetime','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat','type'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xcc06,0x1ea));var _0x6cc0=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xcc06[_0x4243a3];return _0x1b2a33;};'use strict';var utils=require(_0x6cc0('0x0'));function History(_0x313965){this['uniqueid']=_0x313965['uniqueid'];this[_0x6cc0('0x1')]=_0x313965[_0x6cc0('0x1')]||undefined;this[_0x6cc0('0x2')]=_0x313965[_0x6cc0('0x2')];this[_0x6cc0('0x3')]=_0x313965[_0x6cc0('0x2')]==='outbound'?_0x6cc0('0x4'):_0x313965[_0x6cc0('0x2')];this[_0x6cc0('0x5')]=_0x313965['countbusyretry'];this['countcongestionretry']=_0x313965[_0x6cc0('0x6')];this['countnoanswerretry']=_0x313965['countnoanswerretry'];this[_0x6cc0('0x7')]=_0x313965[_0x6cc0('0x5')]+_0x313965[_0x6cc0('0x6')]+_0x313965[_0x6cc0('0x8')]+_0x313965[_0x6cc0('0x9')]+_0x313965[_0x6cc0('0xa')]+_0x313965['countabandonedretry']+_0x313965[_0x6cc0('0xb')]+_0x313965[_0x6cc0('0xc')];this[_0x6cc0('0x9')]=_0x313965[_0x6cc0('0x9')];this[_0x6cc0('0xa')]=_0x313965[_0x6cc0('0xa')];this[_0x6cc0('0xd')]=_0x313965[_0x6cc0('0xd')];this[_0x6cc0('0xb')]=_0x313965[_0x6cc0('0xb')];this[_0x6cc0('0xc')]=_0x313965[_0x6cc0('0xc')];this[_0x6cc0('0x4')]=_0x313965[_0x6cc0('0x4')];this['calleridname']=_0x313965[_0x6cc0('0xe')];this['calleridnum']=_0x313965['number'];this['starttime']=_0x313965[_0x6cc0('0xf')];this[_0x6cc0('0x10')]=_0x313965['responsetime'];this['endtime']=_0x313965[_0x6cc0('0x10')];this['ringtime']=utils['getSeconds'](_0x313965[_0x6cc0('0x10')],_0x313965[_0x6cc0('0xf')]);this[_0x6cc0('0x11')]=0x0;this['talktime']=0x0;this[_0x6cc0('0x12')]=_0x313965[_0x6cc0('0x12')];this[_0x6cc0('0x13')]=_0x313965[_0x6cc0('0x13')];this['callbackat']=_0x313965['callbackat'];this[_0x6cc0('0x14')]=_0x313965['recallme'];this[_0x6cc0('0x15')]=_0x313965['ContactId'];this[_0x6cc0('0x16')]=_0x313965[_0x6cc0('0x16')];this[_0x6cc0('0x17')]=_0x313965[_0x6cc0('0x17')];this[_0x6cc0('0x18')]=_0x313965[_0x6cc0('0x18')];this['CampaignId']=_0x313965['CampaignId'];this[_0x6cc0('0x19')]=_0x313965[_0x6cc0('0x19')]||'';this['originatecalleridname']=_0x313965[_0x6cc0('0x1a')]||'';this[_0x6cc0('0x1b')]=_0x313965[_0x6cc0('0x1b')];this[_0x6cc0('0x1c')]=_0x313965['statedesc'];}module['exports']=History; \ No newline at end of file +var _0x6432=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','countbusyretry'];(function(_0x720f58,_0x51ad3d){var _0x4a7755=function(_0x21db74){while(--_0x21db74){_0x720f58['push'](_0x720f58['shift']());}};_0x4a7755(++_0x51ad3d);}(_0x6432,0x1d8));var _0x2643=function(_0x8a0d92,_0x2d9477){_0x8a0d92=_0x8a0d92-0x0;var _0x4e515e=_0x6432[_0x8a0d92];return _0x4e515e;};'use strict';var utils=require('../utils');function History(_0x53b503){this[_0x2643('0x0')]=_0x53b503[_0x2643('0x0')];this[_0x2643('0x1')]=_0x53b503[_0x2643('0x1')]||undefined;this['type']=_0x53b503[_0x2643('0x2')];this['campaigntype']=_0x53b503[_0x2643('0x2')]==='outbound'?'queue':_0x53b503[_0x2643('0x2')];this['countbusyretry']=_0x53b503[_0x2643('0x3')];this[_0x2643('0x4')]=_0x53b503[_0x2643('0x4')];this[_0x2643('0x5')]=_0x53b503[_0x2643('0x5')];this[_0x2643('0x6')]=_0x53b503[_0x2643('0x3')]+_0x53b503[_0x2643('0x4')]+_0x53b503[_0x2643('0x5')]+_0x53b503[_0x2643('0x7')]+_0x53b503[_0x2643('0x8')]+_0x53b503[_0x2643('0x9')]+_0x53b503[_0x2643('0xa')]+_0x53b503[_0x2643('0xb')];this[_0x2643('0x7')]=_0x53b503[_0x2643('0x7')];this[_0x2643('0x8')]=_0x53b503[_0x2643('0x8')];this['countabandonedretry']=_0x53b503[_0x2643('0x9')];this['countmachineretry']=_0x53b503[_0x2643('0xa')];this[_0x2643('0xb')]=_0x53b503[_0x2643('0xb')];this[_0x2643('0xc')]=_0x53b503['queue'];this[_0x2643('0xd')]=_0x53b503['name'];this['calleridnum']=_0x53b503[_0x2643('0xe')];this[_0x2643('0xf')]=_0x53b503['starttime'];this[_0x2643('0x10')]=_0x53b503[_0x2643('0x10')];this[_0x2643('0x11')]=_0x53b503[_0x2643('0x10')];this[_0x2643('0x12')]=utils[_0x2643('0x13')](_0x53b503['responsetime'],_0x53b503[_0x2643('0xf')]);this[_0x2643('0x14')]=0x0;this[_0x2643('0x15')]=0x0;this[_0x2643('0x16')]=_0x53b503[_0x2643('0x16')];this[_0x2643('0x17')]=_0x53b503[_0x2643('0x17')];this['callbackat']=_0x53b503['callbackat'];this[_0x2643('0x18')]=_0x53b503[_0x2643('0x18')];this[_0x2643('0x19')]=_0x53b503['ContactId'];this[_0x2643('0x1a')]=_0x53b503['ListId'];this[_0x2643('0x1b')]=_0x53b503[_0x2643('0x1b')];this['VoiceQueueId']=_0x53b503[_0x2643('0x1c')];this[_0x2643('0x1d')]=_0x53b503[_0x2643('0x1d')];this[_0x2643('0x1e')]=_0x53b503['originatecalleridnum']||'';this[_0x2643('0x1f')]=_0x53b503[_0x2643('0x1f')]||'';this[_0x2643('0x20')]=_0x53b503[_0x2643('0x20')];this[_0x2643('0x21')]=_0x53b503[_0x2643('0x21')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index bac8119..1966d86 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 _0xd515=['../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports'];(function(_0x2be0ad,_0x47deb6){var _0x368a73=function(_0x45356e){while(--_0x45356e){_0x2be0ad['push'](_0x2be0ad['shift']());}};_0x368a73(++_0x47deb6);}(_0xd515,0x12d));var _0x5d51=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd515[_0x122ef9];return _0x42fba0;};'use strict';var utils=require(_0x5d51('0x0'));function QueueCallerAbandon(_0x195573,_0x6eeb56){this[_0x5d51('0x1')]=_0x195573[_0x5d51('0x1')];this[_0x5d51('0x2')]=_0x195573[_0x5d51('0x2')];this[_0x5d51('0x3')]=_0x195573[_0x5d51('0x2')]===_0x5d51('0x4')?_0x5d51('0x5'):_0x195573[_0x5d51('0x2')];this[_0x5d51('0x6')]=_0x195573[_0x5d51('0x6')];this[_0x5d51('0x7')]=_0x195573['countcongestionretry'];this['countnoanswerretry']=_0x195573[_0x5d51('0x8')];this['countglobal']=_0x195573[_0x5d51('0x6')]+_0x195573[_0x5d51('0x7')]+_0x195573[_0x5d51('0x8')]+_0x195573['countnosuchnumberretry']+_0x195573[_0x5d51('0x9')]+_0x195573['countabandonedretry']+_0x195573[_0x5d51('0xa')]+_0x195573[_0x5d51('0xb')];this['countnosuchnumberretry']=_0x195573['countnosuchnumberretry'];this[_0x5d51('0x9')]=_0x195573['countdropretry'];this[_0x5d51('0xc')]=_0x195573[_0x5d51('0xc')];this[_0x5d51('0xa')]=_0x195573[_0x5d51('0xa')];this[_0x5d51('0xb')]=_0x195573[_0x5d51('0xb')];this[_0x5d51('0xd')]=_0x6eeb56[_0x5d51('0xd')];this[_0x5d51('0xe')]=_0x195573[_0x5d51('0xf')];this[_0x5d51('0x10')]=_0x195573[_0x5d51('0x11')];this['starttime']=_0x195573[_0x5d51('0x12')];this[_0x5d51('0x13')]=_0x195573[_0x5d51('0x13')];this[_0x5d51('0x14')]=_0x195573['droptime'];this[_0x5d51('0x15')]=_0x195573[_0x5d51('0x15')];this[_0x5d51('0x16')]=this['droptime'];this[_0x5d51('0x17')]=utils[_0x5d51('0x18')](_0x195573['responsetime'],_0x195573['starttime']);this['holdtime']=utils[_0x5d51('0x18')](this[_0x5d51('0x14')],_0x195573[_0x5d51('0x13')]);this[_0x5d51('0x19')]=0x0;this[_0x5d51('0x5')]=_0x6eeb56[_0x5d51('0x5')];this[_0x5d51('0x1a')]=_0x6eeb56[_0x5d51('0x1b')];this[_0x5d51('0x1c')]=_0x6eeb56[_0x5d51('0x1c')];this[_0x5d51('0x1d')]=_0x195573['callback'];this['callbackuniqueid']=_0x195573['callbackuniqueid'];this[_0x5d51('0x1e')]=_0x195573['callbackat'];this[_0x5d51('0x1f')]=_0x195573[_0x5d51('0x1f')];this[_0x5d51('0x20')]=_0x195573[_0x5d51('0x20')];this[_0x5d51('0x21')]=_0x195573[_0x5d51('0x21')];this[_0x5d51('0x22')]=_0x195573[_0x5d51('0x22')];this[_0x5d51('0x23')]=_0x195573[_0x5d51('0x23')];this[_0x5d51('0x24')]=_0x195573[_0x5d51('0x24')];this[_0x5d51('0x25')]=_0x195573[_0x5d51('0x25')]||'';this['originatecalleridname']=_0x195573[_0x5d51('0x26')]||'';this[_0x5d51('0x27')]=_0x195573[_0x5d51('0x27')];this[_0x5d51('0x28')]=_0x195573[_0x5d51('0x28')];this[_0x5d51('0x29')]=_0x195573[_0x5d51('0x29')];}module[_0x5d51('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x749c=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x451c21,_0x5db01d){var _0x31f101=function(_0x219242){while(--_0x219242){_0x451c21['push'](_0x451c21['shift']());}};_0x31f101(++_0x5db01d);}(_0x749c,0xc6));var _0xc749=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x749c[_0x5d80de];return _0x1c7556;};'use strict';var utils=require(_0xc749('0x0'));function QueueCallerAbandon(_0x28924d,_0x289447){this[_0xc749('0x1')]=_0x28924d[_0xc749('0x1')];this[_0xc749('0x2')]=_0x28924d[_0xc749('0x2')];this['campaigntype']=_0x28924d[_0xc749('0x2')]===_0xc749('0x3')?_0xc749('0x4'):_0x28924d['type'];this[_0xc749('0x5')]=_0x28924d[_0xc749('0x5')];this['countcongestionretry']=_0x28924d[_0xc749('0x6')];this[_0xc749('0x7')]=_0x28924d[_0xc749('0x7')];this['countglobal']=_0x28924d[_0xc749('0x5')]+_0x28924d[_0xc749('0x6')]+_0x28924d[_0xc749('0x7')]+_0x28924d[_0xc749('0x8')]+_0x28924d[_0xc749('0x9')]+_0x28924d[_0xc749('0xa')]+_0x28924d[_0xc749('0xb')]+_0x28924d[_0xc749('0xc')];this['countnosuchnumberretry']=_0x28924d[_0xc749('0x8')];this[_0xc749('0x9')]=_0x28924d[_0xc749('0x9')];this[_0xc749('0xa')]=_0x28924d[_0xc749('0xa')];this[_0xc749('0xb')]=_0x28924d[_0xc749('0xb')];this[_0xc749('0xc')]=_0x28924d['countagentrejectretry'];this[_0xc749('0xd')]=_0x289447[_0xc749('0xd')];this[_0xc749('0xe')]=_0x28924d[_0xc749('0xf')];this[_0xc749('0x10')]=_0x28924d[_0xc749('0x11')];this[_0xc749('0x12')]=_0x28924d[_0xc749('0x12')];this['responsetime']=_0x28924d[_0xc749('0x13')];this[_0xc749('0x14')]=_0x28924d[_0xc749('0x14')];this['dropreason']=_0x28924d[_0xc749('0x15')];this[_0xc749('0x16')]=this[_0xc749('0x14')];this['ringtime']=utils[_0xc749('0x17')](_0x28924d['responsetime'],_0x28924d[_0xc749('0x12')]);this[_0xc749('0x18')]=utils['getSeconds'](this[_0xc749('0x14')],_0x28924d['responsetime']);this[_0xc749('0x19')]=0x0;this[_0xc749('0x4')]=_0x289447['queue'];this[_0xc749('0x1a')]=_0x289447['connectedlinename'];this[_0xc749('0x1b')]=_0x289447[_0xc749('0x1b')];this[_0xc749('0x1c')]=_0x28924d['callback'];this[_0xc749('0x1d')]=_0x28924d[_0xc749('0x1d')];this[_0xc749('0x1e')]=_0x28924d['callbackat'];this[_0xc749('0x1f')]=_0x28924d[_0xc749('0x1f')];this[_0xc749('0x20')]=_0x28924d[_0xc749('0x20')];this[_0xc749('0x21')]=_0x28924d[_0xc749('0x21')];this[_0xc749('0x22')]=_0x28924d[_0xc749('0x22')];this[_0xc749('0x23')]=_0x28924d['VoiceQueueId'];this[_0xc749('0x24')]=_0x28924d[_0xc749('0x24')];this[_0xc749('0x25')]=_0x28924d[_0xc749('0x25')]||'';this[_0xc749('0x26')]=_0x28924d['originatecalleridname']||'';this[_0xc749('0x27')]=_0x28924d[_0xc749('0x27')];this['state']=_0x28924d[_0xc749('0x28')];this[_0xc749('0x29')]=_0x28924d[_0xc749('0x29')];}module['exports']=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 9bcd025..b96cd88 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 _0xafb9=['[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xafb9,0x68));var _0x9afb=function(_0x189cdb,_0x31ec15){_0x189cdb=_0x189cdb-0x0;var _0x2aba87=_0xafb9[_0x189cdb];return _0x2aba87;};'use strict';var util=require(_0x9afb('0x0'));var logger=require(_0x9afb('0x1'))(_0x9afb('0x2'));var cmHopper=require(_0x9afb('0x3'));var cmHopperAdditionalPhone=require(_0x9afb('0x4'));var cmHopperBlack=require(_0x9afb('0x5'));var cmHopperHistory=require(_0x9afb('0x6'));function inspectError(_0x44892f){return util[_0x9afb('0x7')](_0x44892f,{'showHidden':![],'depth':null});}function getContactDialer(_0x4e983d,_0x498463,_0x91ffa0){return cmHopper['getContactDialer'](_0x4e983d['id'],_0x498463,_0x91ffa0,_0x4e983d[_0x9afb('0x8')])['catch'](function(_0x556880){_0x4e983d[_0x9afb('0x9')]=0x0;logger[_0x9afb('0xa')](_0x9afb('0xb'),inspectError(_0x556880));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x3ef362,_0x3e0264){return cmHopper[_0x9afb('0xc')](_0x3ef362['id'],_0x3e0264,_0x3ef362[_0x9afb('0x8')])[_0x9afb('0xd')](function(_0x56f477){_0x3ef362['temp']=0x0;logger[_0x9afb('0xa')](_0x9afb('0xe'),inspectError(_0x56f477));});}exports[_0x9afb('0xc')]=getContactDialerIvr;function countReScheduled(_0x31b574){return cmHopper[_0x9afb('0xf')](_0x31b574)[_0x9afb('0xd')](function(_0x374094){logger[_0x9afb('0xa')](_0x9afb('0x10'),inspectError(_0x374094));});}exports[_0x9afb('0xf')]=countReScheduled;function rescheduleContact(_0x47a804){return cmHopper[_0x9afb('0x11')](_0x47a804)['catch'](function(_0x59fd82){logger[_0x9afb('0xa')](_0x9afb('0x12'),inspectError(_0x59fd82));});}exports[_0x9afb('0x11')]=rescheduleContact;function unlockContact(_0x2d664d,_0x46b16f,_0x39cdf1){return cmHopper[_0x9afb('0x13')](_0x2d664d,_0x46b16f,_0x39cdf1)['catch'](function(_0x18505a){logger[_0x9afb('0xa')](_0x9afb('0x14'),inspectError(_0x18505a));});}exports[_0x9afb('0x13')]=unlockContact;function moveContactManagedDialer(_0x223aef){return cmHopper['moveContactManagedDialer'](_0x223aef)[_0x9afb('0xd')](function(_0x50a7e4){logger[_0x9afb('0xa')](_0x9afb('0x15'),inspectError(_0x50a7e4));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4a1c74){return cmHopperBlack[_0x9afb('0x16')](_0x4a1c74)[_0x9afb('0xd')](function(_0x3d8450){logger[_0x9afb('0xa')](_0x9afb('0x17'),inspectError(_0x3d8450));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x105253){return cmHopperBlack['checkIsBlackListIvr'](_0x105253)['catch'](function(_0x3fb534){logger[_0x9afb('0xa')](_0x9afb('0x18'),inspectError(_0x3fb534));});}exports[_0x9afb('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x50c835,_0x1e6f9c,_0x725a04){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x50c835,_0x1e6f9c,_0x725a04)['catch'](function(_0x5b5dab){logger[_0x9afb('0xa')]('[verifyAdditionalPhone]',inspectError(_0x5b5dab));});}exports[_0x9afb('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x123510,_0x50a919,_0x324293){return cmHopperAdditionalPhone[_0x9afb('0x1b')](_0x123510,_0x50a919,_0x324293)[_0x9afb('0xd')](function(_0x337d81){logger['error'](_0x9afb('0x1c'),inspectError(_0x337d81));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x29e092){return cmHopperHistory['avgHandleTime'](_0x29e092)['catch'](function(_0x1e6100){logger[_0x9afb('0xa')](_0x9afb('0x1d'),inspectError(_0x1e6100));});}exports[_0x9afb('0x1e')]=avgHandleTime;function createHistory(_0x119e04){return cmHopperHistory[_0x9afb('0x1f')](_0x119e04)[_0x9afb('0xd')](function(_0x5aabd5){logger['error'](_0x9afb('0x20'),inspectError(_0x5aabd5));});}exports[_0x9afb('0x1f')]=createHistory; \ No newline at end of file +var _0x6050=['getContactDialer','catch','temp','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt','error','[getContactDialer]'];(function(_0x142d3e,_0x353e86){var _0x493084=function(_0x14aa15){while(--_0x14aa15){_0x142d3e['push'](_0x142d3e['shift']());}};_0x493084(++_0x353e86);}(_0x6050,0x196));var _0x0605=function(_0x3c05d8,_0x35ae53){_0x3c05d8=_0x3c05d8-0x0;var _0x189e51=_0x6050[_0x3c05d8];return _0x189e51;};'use strict';var util=require(_0x0605('0x0'));var logger=require(_0x0605('0x1'))(_0x0605('0x2'));var cmHopper=require(_0x0605('0x3'));var cmHopperAdditionalPhone=require(_0x0605('0x4'));var cmHopperBlack=require(_0x0605('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x22d595){return util[_0x0605('0x6')](_0x22d595,{'showHidden':![],'depth':null});}function getContactDialer(_0x43403d,_0x5797b0,_0x533b6d){return cmHopper['getContactDialer'](_0x43403d['id'],_0x5797b0,_0x533b6d,_0x43403d[_0x0605('0x7')])['catch'](function(_0x58f7d2){_0x43403d['temp']=0x0;logger[_0x0605('0x8')](_0x0605('0x9'),inspectError(_0x58f7d2));});}exports[_0x0605('0xa')]=getContactDialer;function getContactDialerIvr(_0x5bb96,_0x44fdd3){return cmHopper['getContactDialerIvr'](_0x5bb96['id'],_0x44fdd3,_0x5bb96[_0x0605('0x7')])[_0x0605('0xb')](function(_0xe54b22){_0x5bb96[_0x0605('0xc')]=0x0;logger[_0x0605('0x8')](_0x0605('0xd'),inspectError(_0xe54b22));});}exports[_0x0605('0xe')]=getContactDialerIvr;function countReScheduled(_0x4af103){return cmHopper[_0x0605('0xf')](_0x4af103)[_0x0605('0xb')](function(_0xd22e35){logger[_0x0605('0x8')](_0x0605('0x10'),inspectError(_0xd22e35));});}exports[_0x0605('0xf')]=countReScheduled;function rescheduleContact(_0x22c011){return cmHopper[_0x0605('0x11')](_0x22c011)[_0x0605('0xb')](function(_0x65a20b){logger[_0x0605('0x8')]('[rescheduleContact]',inspectError(_0x65a20b));});}exports[_0x0605('0x11')]=rescheduleContact;function unlockContact(_0x1a802b,_0x4993ab,_0x5ce56a){return cmHopper['unlockContact'](_0x1a802b,_0x4993ab,_0x5ce56a)[_0x0605('0xb')](function(_0xd0996d){logger[_0x0605('0x8')](_0x0605('0x12'),inspectError(_0xd0996d));});}exports[_0x0605('0x13')]=unlockContact;function moveContactManagedDialer(_0x351dbd){return cmHopper[_0x0605('0x14')](_0x351dbd)[_0x0605('0xb')](function(_0x193520){logger[_0x0605('0x8')](_0x0605('0x15'),inspectError(_0x193520));});}exports[_0x0605('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x2e2204){return cmHopperBlack[_0x0605('0x16')](_0x2e2204)['catch'](function(_0x254020){logger[_0x0605('0x8')](_0x0605('0x17'),inspectError(_0x254020));});}exports[_0x0605('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1e8c6d){return cmHopperBlack[_0x0605('0x18')](_0x1e8c6d)[_0x0605('0xb')](function(_0x2c90ed){logger[_0x0605('0x8')]('[checkIsBlackListIvr]',inspectError(_0x2c90ed));});}exports[_0x0605('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x4fe293,_0x3efc38,_0x118e9c){return cmHopperAdditionalPhone[_0x0605('0x19')](_0x4fe293,_0x3efc38,_0x118e9c)[_0x0605('0xb')](function(_0x10c575){logger[_0x0605('0x8')](_0x0605('0x1a'),inspectError(_0x10c575));});}exports[_0x0605('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x234231,_0x2896d7,_0x9f2833){return cmHopperAdditionalPhone[_0x0605('0x1b')](_0x234231,_0x2896d7,_0x9f2833)['catch'](function(_0x6bc204){logger[_0x0605('0x8')]('[swapAdditionalPhone]',inspectError(_0x6bc204));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x55ebd8){return cmHopperHistory[_0x0605('0x1c')](_0x55ebd8)[_0x0605('0xb')](function(_0x4163cd){logger[_0x0605('0x8')](_0x0605('0x1d'),inspectError(_0x4163cd));});}exports[_0x0605('0x1c')]=avgHandleTime;function createHistory(_0x4e32ef){return cmHopperHistory[_0x0605('0x1e')](_0x4e32ef)['catch'](function(_0xa836f2){logger[_0x0605('0x8')](_0x0605('0x1f'),inspectError(_0xa836f2));});}exports[_0x0605('0x1e')]=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 eb4531a..754eed0 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 _0x9c13=['\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','includes','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','preview','type','ivr','isOutboundQueue','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','dialMethod','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format'];(function(_0x4cbdad,_0x1ec8f){var _0x5dff07=function(_0x2bef2c){while(--_0x2bef2c){_0x4cbdad['push'](_0x4cbdad['shift']());}};_0x5dff07(++_0x1ec8f);}(_0x9c13,0x1d9));var _0x39c1=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x9c13[_0x1895b7];return _0x1aecdc;};'use strict';var _=require(_0x39c1('0x0'));var moment=require('moment');var util=require(_0x39c1('0x1'));var logger=require(_0x39c1('0x2'))(_0x39c1('0x3'));var timezones=require('../../../../config/environment/shared')[_0x39c1('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x39c1('0x5'),'BLACKLIST':_0x39c1('0x6'),'CONTACTS_RESCHEDULED':_0x39c1('0x7'),'DEACTIVATED':_0x39c1('0x8'),'DISACTIVED':_0x39c1('0x9'),'EMPTY_INTERVAL':_0x39c1('0xa'),'INACTIVE':_0x39c1('0xb'),'NO_AGENTS_LOGGED':_0x39c1('0xc'),'NO_AVAILABLE_CONTACTS':_0x39c1('0xd'),'NULL_INTERVAL':_0x39c1('0xe'),'OVERTIME_INTERVAL':_0x39c1('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x39c1('0x10'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x39c1('0x11'),'RUNNING':_0x39c1('0x12'),'UNKNOWN_TIMEZONE':_0x39c1('0x13'),'UNREACHABLE_TRUNK':_0x39c1('0x14')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2c51c4){return _0x2c51c4['dialMethod']===_0x39c1('0x15');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x547d82){return _0x547d82[_0x39c1('0x16')]===_0x39c1('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x3b764c){return _0x3b764c['type']==='outbound';}exports[_0x39c1('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x153f28){return _0x153f28['dialActive'];}exports[_0x39c1('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0xcdd912){return _0xcdd912['active'];}exports[_0x39c1('0x1a')]=isIVRCampaignActive;function getSeconds(_0x4de51b,_0x2eff85){var _0x5e2e8c=moment(_0x4de51b)[_0x39c1('0x1b')](0x0);var _0x5b1299=moment(_0x2eff85)['milliseconds'](0x0);return _0x5e2e8c[_0x39c1('0x1c')](_0x5b1299,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x1b55a0,_0x3629ce){var _0x4fd4ba=![];var _0x348181=_0x1b55a0['dialMethod']!==_0x3629ce[_0x39c1('0x1d')]||_0x1b55a0[_0x39c1('0x1e')]!==_0x3629ce[_0x39c1('0x1e')]||_0x1b55a0[_0x39c1('0x1f')]!==_0x3629ce[_0x39c1('0x1f')];var _0x2c4587=_0x1b55a0[_0x39c1('0x20')]!==_0x3629ce['available']||_0x1b55a0[_0x39c1('0x21')]!==_0x3629ce[_0x39c1('0x21')]||_0x1b55a0[_0x39c1('0x22')]!==_0x3629ce[_0x39c1('0x22')]||_0x1b55a0[_0x39c1('0x23')]!==_0x3629ce[_0x39c1('0x23')]||_0x1b55a0[_0x39c1('0x24')]!==_0x3629ce[_0x39c1('0x24')]||_0x1b55a0['pTalking']!==_0x3629ce[_0x39c1('0x25')]||_0x1b55a0[_0x39c1('0x26')]!==_0x3629ce[_0x39c1('0x26')]||_0x1b55a0[_0x39c1('0x27')]!==_0x3629ce[_0x39c1('0x27')]||_0x1b55a0[_0x39c1('0x28')]!==_0x3629ce[_0x39c1('0x28')];if(_0x1b55a0[_0x39c1('0x29')]&&_0x3629ce[_0x39c1('0x29')]){_0x4fd4ba=_0x1b55a0[_0x39c1('0x29')][_0x39c1('0x2a')]!==_0x3629ce[_0x39c1('0x29')][_0x39c1('0x2a')]||_0x1b55a0[_0x39c1('0x29')][_0x39c1('0x2b')]!==_0x3629ce[_0x39c1('0x29')][_0x39c1('0x2b')];}return _0x348181||_0x2c4587||_0x4fd4ba;}exports[_0x39c1('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2f321b){var _0x8ca39a=null;var _0x56742b=_0x2f321b[_0x39c1('0x2d')];if(_[_0x39c1('0x2e')](_0x2f321b[_0x39c1('0x2f')])||_[_0x39c1('0x2e')](_0x2f321b['Interval'])||_[_0x39c1('0x2e')](_0x2f321b[_0x39c1('0x30')]['Intervals'])){_0x8ca39a=CAMPAIGN_STATUS[_0x39c1('0x31')];}else if(_['isEmpty'](_0x2f321b[_0x39c1('0x2f')])||_[_0x39c1('0x32')](_0x2f321b[_0x39c1('0x30')][_0x39c1('0x33')])){_0x8ca39a=CAMPAIGN_STATUS[_0x39c1('0x34')];}else if(_0x56742b&&!timezones[_0x56742b]){_0x8ca39a=CAMPAIGN_STATUS[_0x39c1('0x35')];}return _0x8ca39a;}function checkAnyValidTrunk(_0x476320,_0x346e1d){var _0x482e5f=null;var _0x1266cc=_0x39c1('0x36');var _0x3c3d9b=['reachable',_0x39c1('0x37')];var _0x1140ec=!![];if(_0x476320[_0x39c1('0x29')]&&_0x476320['Trunk'][_0x39c1('0x2b')]){_0x1266cc+=_0x476320[_0x39c1('0x29')][_0x39c1('0x2a')];_0x482e5f=_0x346e1d[_0x1266cc];_0x1140ec=_0x3c3d9b['includes'](_0x482e5f['status']);}else if(_0x476320['TrunkBackup']&&_0x476320[_0x39c1('0x38')]['active']){_0x1266cc+=_0x476320[_0x39c1('0x38')][_0x39c1('0x2a')];_0x482e5f=_0x346e1d[_0x1266cc];_0x1140ec=_0x3c3d9b['includes'](_0x482e5f[_0x39c1('0x39')]);}return _0x1140ec;}function getQueueCampaignStatusMessage(_0x50df8e,_0x183fea){var _0x50f4f6=CAMPAIGN_STATUS['ACTIVE'];var _0x3be992=isPreviewCampaign(_0x50df8e);if(!isQueueCampaignActive(_0x50df8e)){if(_0x3be992){_0x50f4f6=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x50df8e['originated']===0x0&&_0x50df8e[_0x39c1('0x24')]===0x0&&_0x50df8e[_0x39c1('0x26')]===0x0&&(_0x50df8e[_0x39c1('0x25')]||0x0)===0x0){_0x50f4f6=CAMPAIGN_STATUS[_0x39c1('0x3a')];}else{_0x50f4f6=CAMPAIGN_STATUS[_0x39c1('0x3b')];}}}else if(_0x50df8e[_0x39c1('0x21')]===0x0){_0x50f4f6=CAMPAIGN_STATUS[_0x39c1('0x3c')];}else if(!checkAnyValidTrunk(_0x50df8e,_0x183fea)){_0x50f4f6=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x50df8e)){var _0x5ceb74=checkAnyValidQueueCampaignInterval(_0x50df8e);if(_0x5ceb74){_0x50f4f6=_0x5ceb74;}}return _0x50f4f6;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x52f9be){var _0x1e9250=CAMPAIGN_STATUS['DISACTIVED'];if(_0x52f9be['originated']===0x0&&_0x52f9be[_0x39c1('0x24')]===0x0&&_0x52f9be[_0x39c1('0x26')]===0x0&&(_0x52f9be[_0x39c1('0x25')]||0x0)===0x0){_0x1e9250=CAMPAIGN_STATUS[_0x39c1('0x3a')];}return _0x1e9250;}exports[_0x39c1('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x19a928){var _0x4ca9c2=_0x19a928[_0x39c1('0x3e')](/"(.*?)"/);return _0x4ca9c2?_0x4ca9c2[0x1]:_0x19a928;}exports[_0x39c1('0x3f')]=extractCalleridName;function getCallerId(_0x4def16,_0x529ce5,_0x519ff9){if(!_['isUndefined'](_0x519ff9)&&typeof _0x519ff9===_0x39c1('0x40')&&!_[_0x39c1('0x32')](_0x519ff9)){if(!_[_0x39c1('0x41')](_0x529ce5)&&typeof _0x529ce5===_0x39c1('0x40')&&!_[_0x39c1('0x32')](_0x529ce5)){return util[_0x39c1('0x42')](_0x39c1('0x43'),_0x529ce5,_0x519ff9);}return util[_0x39c1('0x42')]('\x22%s\x22\x20<%s>',_0x519ff9,_0x519ff9);}if(!_[_0x39c1('0x41')](_0x4def16)&&typeof _0x4def16==='string'&&!_[_0x39c1('0x32')](_0x4def16)){return _0x4def16;}return _0x39c1('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x18f511,_0xef36e0){var _0x5280a2;var _0x2cf767;var _0x539aac;if(_0xef36e0<=0x0){_0xef36e0=0x1;}_0x5280a2=new RegExp(_0x39c1('0x45')+_0xef36e0+'}$');_0x2cf767=Math[_0x39c1('0x46')](0xa,_0xef36e0-0x1);_0x539aac=Math[_0x39c1('0x46')](0xa,_0xef36e0)-0x1;return util[_0x39c1('0x42')]('%s',_[_0x39c1('0x47')](_0x18f511,_0x5280a2,_[_0x39c1('0x48')](_0x2cf767,_0x539aac)[_0x39c1('0x49')]()));}exports[_0x39c1('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x48f555){if(_0x48f555['originated']&&_0x48f555[_0x39c1('0x28')]>0x0){_0x48f555[_0x39c1('0x28')]-=0x1;}else{logger[_0x39c1('0x4b')](_0x39c1('0x4c'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x1627bd){return _0x1627bd&&_0x1627bd['length']>0x0;}exports[_0x39c1('0x4d')]=checkContactEmpty;function erlangb(_0x282762,_0x5b9d4c){if(_0x5b9d4c===0x0){return 0x0;}var _0x1f9036=0x1;for(var _0x182667=0x1;_0x182667<=_0x5b9d4c;_0x182667+=0x1){_0x1f9036=0x1+_0x1f9036*_0x182667/_0x282762;}return 0x1/_0x1f9036;}exports[_0x39c1('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x4d07b4,_0x415321,_0x5034c3){if(_0x415321>_0x5034c3){for(var _0x2b3bb2=0x0;_0x2b3bb2<_0x415321-_0x5034c3;_0x2b3bb2+=0x1){decrementOriginate(_0x4d07b4);}}}exports[_0x39c1('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1d9b50){var _0x324c50={};var _0x3f55e7=['id',_0x39c1('0x50'),_0x39c1('0x51'),_0x39c1('0x52'),_0x39c1('0x53')];if(_0x1d9b50){for(var _0x54f0e2 in _0x1d9b50){if(typeof _0x1d9b50[_0x54f0e2]!==_0x39c1('0x54')){if(!_[_0x39c1('0x2e')](_0x1d9b50[_0x54f0e2])&&!_0x3f55e7[_0x39c1('0x55')](_0x54f0e2)){_0x324c50[util[_0x39c1('0x42')](_0x39c1('0x56'),_0x39c1('0x57'),_0x54f0e2[_0x39c1('0x58')]())]=_0x1d9b50[_0x54f0e2];}}}}return _0x324c50;}exports[_0x39c1('0x59')]=setXMDContactVariables; \ No newline at end of file +var _0x7743=['getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','getCallerId','pow','replace','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','%s%s','XMD-','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','preview','type','ivr','isIVRCampaign','outbound','dialActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','active','dialGlobalInterval','isNil','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','name','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage'];(function(_0x155cd2,_0x94dd79){var _0x4cab3c=function(_0x2fac27){while(--_0x2fac27){_0x155cd2['push'](_0x155cd2['shift']());}};_0x4cab3c(++_0x94dd79);}(_0x7743,0x175));var _0x3774=function(_0x5e0cf5,_0x2f19e9){_0x5e0cf5=_0x5e0cf5-0x0;var _0x3ed110=_0x7743[_0x5e0cf5];return _0x3ed110;};'use strict';var _=require(_0x3774('0x0'));var moment=require('moment');var util=require(_0x3774('0x1'));var logger=require(_0x3774('0x2'))(_0x3774('0x3'));var timezones=require('../../../../config/environment/shared')[_0x3774('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x3774('0x5'),'BLACKLIST':_0x3774('0x6'),'CONTACTS_RESCHEDULED':_0x3774('0x7'),'DEACTIVATED':_0x3774('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x3774('0x9'),'INACTIVE':_0x3774('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x3774('0xb'),'NULL_INTERVAL':_0x3774('0xc'),'OVERTIME_INTERVAL':_0x3774('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x3774('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x3774('0xf'),'RUNNING':_0x3774('0x10'),'UNKNOWN_TIMEZONE':_0x3774('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x3774('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x315e6){return _0x315e6['dialMethod']===_0x3774('0x13');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x445532){return _0x445532[_0x3774('0x14')]===_0x3774('0x15');}exports[_0x3774('0x16')]=isIVRCampaign;function isOutboundQueue(_0x17f075){return _0x17f075[_0x3774('0x14')]===_0x3774('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x4e9f0a){return _0x4e9f0a[_0x3774('0x18')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x52cff8){return _0x52cff8['active'];}exports[_0x3774('0x19')]=isIVRCampaignActive;function getSeconds(_0x1346c6,_0x25fed1){var _0x5b2683=moment(_0x1346c6)[_0x3774('0x1a')](0x0);var _0x4b361d=moment(_0x25fed1)[_0x3774('0x1a')](0x0);return _0x5b2683[_0x3774('0x1b')](_0x4b361d,_0x3774('0x1c'));}exports[_0x3774('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x2e455c,_0x3f65c4){var _0x1c285d=![];var _0x121158=_0x2e455c[_0x3774('0x1e')]!==_0x3f65c4[_0x3774('0x1e')]||_0x2e455c[_0x3774('0x18')]!==_0x3f65c4['dialActive']||_0x2e455c[_0x3774('0x1f')]!==_0x3f65c4[_0x3774('0x1f')];var _0x1484e5=_0x2e455c['available']!==_0x3f65c4[_0x3774('0x20')]||_0x2e455c[_0x3774('0x21')]!==_0x3f65c4[_0x3774('0x21')]||_0x2e455c[_0x3774('0x22')]!==_0x3f65c4['loggedInDb']||_0x2e455c[_0x3774('0x23')]!==_0x3f65c4['paused']||_0x2e455c[_0x3774('0x24')]!==_0x3f65c4[_0x3774('0x24')]||_0x2e455c[_0x3774('0x25')]!==_0x3f65c4[_0x3774('0x25')]||_0x2e455c[_0x3774('0x26')]!==_0x3f65c4['waiting']||_0x2e455c[_0x3774('0x27')]!==_0x3f65c4[_0x3774('0x27')]||_0x2e455c['originated']!==_0x3f65c4[_0x3774('0x28')];if(_0x2e455c[_0x3774('0x29')]&&_0x3f65c4[_0x3774('0x29')]){_0x1c285d=_0x2e455c[_0x3774('0x29')]['name']!==_0x3f65c4['Trunk']['name']||_0x2e455c[_0x3774('0x29')][_0x3774('0x2a')]!==_0x3f65c4[_0x3774('0x29')][_0x3774('0x2a')];}return _0x121158||_0x1484e5||_0x1c285d;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5cfec5){var _0x1e92d9=null;var _0x298201=_0x5cfec5['dialTimezone'];if(_['isNil'](_0x5cfec5[_0x3774('0x2b')])||_[_0x3774('0x2c')](_0x5cfec5[_0x3774('0x2d')])||_['isNil'](_0x5cfec5[_0x3774('0x2d')][_0x3774('0x2e')])){_0x1e92d9=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x3774('0x2f')](_0x5cfec5[_0x3774('0x2b')])||_[_0x3774('0x2f')](_0x5cfec5[_0x3774('0x2d')][_0x3774('0x2e')])){_0x1e92d9=CAMPAIGN_STATUS[_0x3774('0x30')];}else if(_0x298201&&!timezones[_0x298201]){_0x1e92d9=CAMPAIGN_STATUS[_0x3774('0x31')];}return _0x1e92d9;}function checkAnyValidTrunk(_0x1a04a3,_0x5f3a46){var _0x4a85d2=null;var _0x22171a=_0x3774('0x32');var _0x57fdb4=[_0x3774('0x33'),_0x3774('0x34')];var _0x1e36ac=!![];if(_0x1a04a3[_0x3774('0x29')]&&_0x1a04a3[_0x3774('0x29')][_0x3774('0x2a')]){_0x22171a+=_0x1a04a3[_0x3774('0x29')][_0x3774('0x35')];_0x4a85d2=_0x5f3a46[_0x22171a];_0x1e36ac=_0x57fdb4['includes'](_0x4a85d2[_0x3774('0x36')]);}else if(_0x1a04a3[_0x3774('0x37')]&&_0x1a04a3[_0x3774('0x37')][_0x3774('0x2a')]){_0x22171a+=_0x1a04a3['TrunkBackup']['name'];_0x4a85d2=_0x5f3a46[_0x22171a];_0x1e36ac=_0x57fdb4[_0x3774('0x38')](_0x4a85d2['status']);}return _0x1e36ac;}function getQueueCampaignStatusMessage(_0x18866d,_0xc26ea6){var _0x20fb22=CAMPAIGN_STATUS[_0x3774('0x5')];var _0x309488=isPreviewCampaign(_0x18866d);if(!isQueueCampaignActive(_0x18866d)){if(_0x309488){_0x20fb22=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x18866d[_0x3774('0x28')]===0x0&&_0x18866d['talking']===0x0&&_0x18866d[_0x3774('0x26')]===0x0&&(_0x18866d[_0x3774('0x25')]||0x0)===0x0){_0x20fb22=CAMPAIGN_STATUS[_0x3774('0x39')];}else{_0x20fb22=CAMPAIGN_STATUS[_0x3774('0x3a')];}}}else if(_0x18866d[_0x3774('0x21')]===0x0){_0x20fb22=CAMPAIGN_STATUS[_0x3774('0x3b')];}else if(!checkAnyValidTrunk(_0x18866d,_0xc26ea6)){_0x20fb22=CAMPAIGN_STATUS[_0x3774('0x3c')];}else if(!isPreviewCampaign(_0x18866d)){var _0x399237=checkAnyValidQueueCampaignInterval(_0x18866d);if(_0x399237){_0x20fb22=_0x399237;}}return _0x20fb22;}exports[_0x3774('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3ccbbc){var _0x2e1b53=CAMPAIGN_STATUS[_0x3774('0x3a')];if(_0x3ccbbc[_0x3774('0x28')]===0x0&&_0x3ccbbc['talking']===0x0&&_0x3ccbbc[_0x3774('0x26')]===0x0&&(_0x3ccbbc[_0x3774('0x25')]||0x0)===0x0){_0x2e1b53=CAMPAIGN_STATUS[_0x3774('0x39')];}return _0x2e1b53;}exports[_0x3774('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x35814f){var _0x5e29ed=_0x35814f[_0x3774('0x3f')](/"(.*?)"/);return _0x5e29ed?_0x5e29ed[0x1]:_0x35814f;}exports[_0x3774('0x40')]=extractCalleridName;function getCallerId(_0x5326c7,_0xd0590d,_0x4c3988){if(!_[_0x3774('0x41')](_0x4c3988)&&typeof _0x4c3988===_0x3774('0x42')&&!_[_0x3774('0x2f')](_0x4c3988)){if(!_['isUndefined'](_0xd0590d)&&typeof _0xd0590d===_0x3774('0x42')&&!_['isEmpty'](_0xd0590d)){return util['format'](_0x3774('0x43'),_0xd0590d,_0x4c3988);}return util[_0x3774('0x44')](_0x3774('0x43'),_0x4c3988,_0x4c3988);}if(!_['isUndefined'](_0x5326c7)&&typeof _0x5326c7===_0x3774('0x42')&&!_[_0x3774('0x2f')](_0x5326c7)){return _0x5326c7;}return'\x22\x22\x20<>';}exports[_0x3774('0x45')]=getCallerId;function getCallerIdRandom(_0x2e92bb,_0x5018e6){var _0x9a3604;var _0x384cb7;var _0x28c1fc;if(_0x5018e6<=0x0){_0x5018e6=0x1;}_0x9a3604=new RegExp('\x5cw{0,'+_0x5018e6+'}$');_0x384cb7=Math['pow'](0xa,_0x5018e6-0x1);_0x28c1fc=Math[_0x3774('0x46')](0xa,_0x5018e6)-0x1;return util[_0x3774('0x44')]('%s',_[_0x3774('0x47')](_0x2e92bb,_0x9a3604,_['random'](_0x384cb7,_0x28c1fc)['toString']()));}exports[_0x3774('0x48')]=getCallerIdRandom;function decrementOriginate(_0x5939ca){if(_0x5939ca[_0x3774('0x28')]&&_0x5939ca[_0x3774('0x28')]>0x0){_0x5939ca[_0x3774('0x28')]-=0x1;}else{logger[_0x3774('0x49')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x3774('0x4a')]=decrementOriginate;function checkContactEmpty(_0x1adc00){return _0x1adc00&&_0x1adc00[_0x3774('0x4b')]>0x0;}exports[_0x3774('0x4c')]=checkContactEmpty;function erlangb(_0x5ae119,_0x3d5415){if(_0x3d5415===0x0){return 0x0;}var _0x447412=0x1;for(var _0x139b4f=0x1;_0x139b4f<=_0x3d5415;_0x139b4f+=0x1){_0x447412=0x1+_0x447412*_0x139b4f/_0x5ae119;}return 0x1/_0x447412;}exports[_0x3774('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x27a5ab,_0x3b6d16,_0x4db547){if(_0x3b6d16>_0x4db547){for(var _0x498c90=0x0;_0x498c90<_0x3b6d16-_0x4db547;_0x498c90+=0x1){decrementOriginate(_0x27a5ab);}}}exports[_0x3774('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x30155c){var _0xef41c7={};var _0x6aa443=['id',_0x3774('0x4f'),_0x3774('0x50'),_0x3774('0x51'),_0x3774('0x52')];if(_0x30155c){for(var _0x11f394 in _0x30155c){if(typeof _0x30155c[_0x11f394]!==_0x3774('0x53')){if(!_['isNil'](_0x30155c[_0x11f394])&&!_0x6aa443[_0x3774('0x38')](_0x11f394)){_0xef41c7[util['format'](_0x3774('0x54'),_0x3774('0x55'),_0x11f394['toUpperCase']())]=_0x30155c[_0x11f394];}}}}return _0xef41c7;}exports[_0x3774('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f18d30f..4b0d54f 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(_0x44ed23,_0x10932f){var _0x4db9f5=function(_0x5ba480){while(--_0x5ba480){_0x44ed23['push'](_0x44ed23['shift']());}};_0x4db9f5(++_0x10932f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x59e590,_0x2381b5){var _0x133a2c=function(_0x29aeec){while(--_0x29aeec){_0x59e590['push'](_0x59e590['shift']());}};_0x133a2c(++_0x2381b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 edc190b..c52fda4 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 _0x8c80=['Fax\x20failed','checkAfterSend','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','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channels','channel','info','\x20syncNewchannel\x20','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]'];(function(_0xb2d5e0,_0x376535){var _0x244aab=function(_0xd632ef){while(--_0xd632ef){_0xb2d5e0['push'](_0xb2d5e0['shift']());}};_0x244aab(++_0x376535);}(_0x8c80,0x97));var _0x08c8=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0x8c80[_0x3816c2];return _0x144669;};'use strict';var util=require(_0x08c8('0x0'));var _=require('lodash');var BPromise=require(_0x08c8('0x1'));var uuid=require(_0x08c8('0x2'));var moment=require(_0x08c8('0x3'));var path=require('path');var tiff2pdf=require(_0x08c8('0x4'));var gs=require(_0x08c8('0x5'));var logger=require(_0x08c8('0x6'))(_0x08c8('0x7'));var ami=require(_0x08c8('0x8'));var rpcDb=require(_0x08c8('0x9'));var Channel=require(_0x08c8('0xa'));var ut=require(_0x08c8('0xb'));var Action=require(_0x08c8('0xc'));var faxAccount=require(_0x08c8('0xd'));var attachment=require(_0x08c8('0xe'));var faxMessage=require(_0x08c8('0xf'));function Fax(_0x42d8c9){this['channels']={};this[_0x08c8('0x10')]=_0x42d8c9['faxAccounts'];this[_0x08c8('0x11')]=_0x42d8c9['trunks'];this[_0x08c8('0x12')]={};ami['on'](_0x08c8('0x13'),this[_0x08c8('0x14')]['bind'](this));ami['on'](_0x08c8('0x15'),this[_0x08c8('0x16')][_0x08c8('0x17')](this));ami['on'](_0x08c8('0x18'),this['syncNewState'][_0x08c8('0x17')](this));ami['on']('newexten',this[_0x08c8('0x19')]['bind'](this));ami['on'](_0x08c8('0x1a'),this[_0x08c8('0x1b')][_0x08c8('0x17')](this));ami['on'](_0x08c8('0x1c'),this[_0x08c8('0x1d')][_0x08c8('0x17')](this));ami['on'](_0x08c8('0x1e'),this[_0x08c8('0x1f')][_0x08c8('0x17')](this));ami['on']('originateresponse',this[_0x08c8('0x20')][_0x08c8('0x17')](this));}Fax[_0x08c8('0x21')][_0x08c8('0x14')]=function(_0x20402a){if(_0x20402a[_0x08c8('0x22')]===_0x08c8('0x23')){for(var _0x4c86c5 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x4c86c5)){if(_0x20402a[_0x08c8('0x24')]===this[_0x08c8('0x10')][_0x4c86c5][_0x08c8('0x25')]){this['channels'][_0x20402a[_0x08c8('0x26')]]={};this[_0x08c8('0x27')][_0x20402a['uniqueid']]['channel']=_0x20402a[_0x08c8('0x28')];this[_0x08c8('0x27')][_0x20402a[_0x08c8('0x26')]]['id']=this['faxAccounts'][_0x4c86c5]['id'];this[_0x08c8('0x27')][_0x20402a[_0x08c8('0x26')]]['name']=this[_0x08c8('0x10')][_0x4c86c5]['name'];logger[_0x08c8('0x29')](_0x20402a[_0x08c8('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x08c8('0x12')][_0x20402a[_0x08c8('0x26')]]){this[_0x08c8('0x27')][_0x20402a[_0x08c8('0x26')]]={};this[_0x08c8('0x27')][_0x20402a[_0x08c8('0x26')]][_0x08c8('0x28')]=_0x20402a[_0x08c8('0x28')];logger[_0x08c8('0x29')](_0x20402a[_0x08c8('0x26')],_0x08c8('0x2a'));}};Fax[_0x08c8('0x21')][_0x08c8('0x16')]=function(_0x3556c7){if(this['channels'][_0x3556c7[_0x08c8('0x26')]]){for(var _0x3bad6a in _0x3556c7[_0x08c8('0x2b')]){if(_0x3556c7[_0x08c8('0x2b')][_0x08c8('0x2c')](_0x3bad6a)){this['channels'][_0x3556c7[_0x08c8('0x26')]][_0x3bad6a]=_0x3556c7['value'];}}}};Fax['prototype'][_0x08c8('0x2d')]=function(_0x5f1f34){if(this[_0x08c8('0x27')][_0x5f1f34[_0x08c8('0x26')]]){this['channels'][_0x5f1f34['uniqueid']][_0x08c8('0x2e')]=_0x5f1f34[_0x08c8('0x2e')];this[_0x08c8('0x27')][_0x5f1f34[_0x08c8('0x26')]][_0x08c8('0x2f')]=_0x5f1f34[_0x08c8('0x2f')];}};Fax[_0x08c8('0x21')][_0x08c8('0x19')]=function(_0x3fe395){if(this[_0x08c8('0x27')][_0x3fe395['uniqueid']]){for(var _0x1b5f5f in _0x3fe395[_0x08c8('0x2b')]){if(_0x3fe395['variable'][_0x08c8('0x2c')](_0x1b5f5f)){this[_0x08c8('0x27')][_0x3fe395[_0x08c8('0x26')]][_0x1b5f5f]=_0x3fe395[_0x08c8('0x30')];}}}};Fax[_0x08c8('0x21')][_0x08c8('0x1b')]=function(_0x39a6bb){if(this['channels'][_0x39a6bb[_0x08c8('0x26')]]){this[_0x08c8('0x27')][_0x39a6bb[_0x08c8('0x26')]][_0x08c8('0x31')]=_0x39a6bb[_0x08c8('0x31')];this['channels'][_0x39a6bb['uniqueid']][_0x08c8('0x32')]=_0x39a6bb['status'];this['channels'][_0x39a6bb[_0x08c8('0x26')]]['localstationid']=_0x39a6bb[_0x08c8('0x25')];this['channels'][_0x39a6bb[_0x08c8('0x26')]][_0x08c8('0x33')]=_0x39a6bb[_0x08c8('0x33')];logger['info'](_0x39a6bb[_0x08c8('0x26')],_0x08c8('0x34'));}};Fax['prototype'][_0x08c8('0x1d')]=function(_0x51a039){var _0x10048e=this;if(this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]]){var _0x1bbc80=this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]]['id'];this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]][_0x08c8('0x35')]=_0x51a039[_0x08c8('0x35')];this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]][_0x08c8('0x36')]=_0x51a039[_0x08c8('0x36')];this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]]['localstationid']=_0x51a039[_0x08c8('0x25')];this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]][_0x08c8('0x37')]=_0x51a039[_0x08c8('0x37')];this['channels'][_0x51a039[_0x08c8('0x26')]][_0x08c8('0x38')]=_0x51a039[_0x08c8('0x38')];this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]][_0x08c8('0x33')]=_0x51a039[_0x08c8('0x33')];this[_0x08c8('0x27')][_0x51a039[_0x08c8('0x26')]][_0x08c8('0x39')]=_0x51a039[_0x08c8('0x39')];if(this['channels'][_0x51a039[_0x08c8('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x51a039[_0x08c8('0x33')],_0x08c8('0x3a'),function(_0x352352){logger[_0x08c8('0x29')](_0x51a039['uniqueid'],_0x08c8('0x3b'),_0x352352[_0x08c8('0x3c')]);attachment[_0x08c8('0x3d')]({'name':path[_0x08c8('0x3e')](_0x51a039['filename'])[_0x08c8('0x3f')],'basename':path[_0x08c8('0x3e')](_0x51a039[_0x08c8('0x33')])[_0x08c8('0x3f')]+_0x08c8('0x40'),'type':_0x08c8('0x41')})[_0x08c8('0x42')](function(_0x3eca48){faxAccount[_0x08c8('0x43')](_0x1bbc80,{'from':_0x51a039[_0x08c8('0x39')],'mapKey':'fax','body':path[_0x08c8('0x3e')](_0x51a039[_0x08c8('0x33')])[_0x08c8('0x3f')]+'.pdf','AttachmentId':_0x3eca48['id']})[_0x08c8('0x44')](function(_0x1510f1){logger['error'](_0x51a039[_0x08c8('0x26')],_0x08c8('0x45'),JSON[_0x08c8('0x46')](_0x1510f1));});})[_0x08c8('0x44')](function(_0x4ebc44){logger[_0x08c8('0x47')](_0x51a039[_0x08c8('0x26')],_0x08c8('0x48'),JSON['stringify'](_0x4ebc44));});});}logger['info'](_0x51a039[_0x08c8('0x26')],_0x08c8('0x48'));}};Fax[_0x08c8('0x21')]['syncOriginateResponse']=function(_0xce7517){if(this[_0x08c8('0x12')][_0xce7517['uniqueid']]){_[_0x08c8('0x49')](this[_0x08c8('0x27')][_0xce7517['uniqueid']],_[_0x08c8('0x4a')](_0xce7517,['response',_0x08c8('0x4b')]));}};function updateStatus(_0x384f1a){if(_0x384f1a[_0x08c8('0x4c')]){faxMessage['update'](_0x384f1a[_0x08c8('0x4c')],{'failMessage':_0x08c8('0x4d')})[_0x08c8('0x42')](function(_0x187562){ut['logger'](_0x08c8('0x4e'),_0x187562);})[_0x08c8('0x44')](function(_0x53aad2){ut['logger'](_0x08c8('0x4f'),_0x53aad2);});}else{ut[_0x08c8('0x50')](_0x08c8('0x51'));}}Fax['prototype'][_0x08c8('0x52')]=function(_0xaef7d2,_0x12b097,_0x43c145){var _0x4d2156=this;var _0x298867={};if(_0x12b097){_0x298867={'read':_0x12b097};}else{_0x298867={'failMessage':_0x43c145};}if(this[_0x08c8('0x12')][_0xaef7d2][_0x08c8('0x4c')]){faxMessage[_0x08c8('0x53')](this[_0x08c8('0x12')][_0xaef7d2][_0x08c8('0x4c')],_0x298867)[_0x08c8('0x42')](function(_0x2fccf8){ut[_0x08c8('0x50')](_0x08c8('0x54'),_0x2fccf8);})[_0x08c8('0x44')](function(_0x13364b){ut[_0x08c8('0x50')](_0x08c8('0x55'),_0x13364b);})[_0x08c8('0x56')](function(){delete _0x4d2156[_0x08c8('0x27')][_0xaef7d2];delete _0x4d2156[_0x08c8('0x12')][_0xaef7d2];});}else{ut['logger'](_0x08c8('0x57'));delete this[_0x08c8('0x27')][_0xaef7d2];delete this[_0x08c8('0x12')][_0xaef7d2];}};Fax[_0x08c8('0x21')][_0x08c8('0x1f')]=function(_0x541451){var _0xf478ae=this;if(this[_0x08c8('0x27')][_0x541451[_0x08c8('0x26')]]){if(this['actions'][_0x541451['uniqueid']]){this['channels'][_0x541451[_0x08c8('0x26')]]['id']=this[_0x08c8('0x12')][_0x541451[_0x08c8('0x26')]]['id'];this[_0x08c8('0x27')][_0x541451[_0x08c8('0x26')]][_0x08c8('0x3f')]=this[_0x08c8('0x12')][_0x541451[_0x08c8('0x26')]]['name'];}logger[_0x08c8('0x29')](_0x541451[_0x08c8('0x26')],this['actions'][_0x541451[_0x08c8('0x26')]]?_0x08c8('0x58'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x08c8('0x27')][_0x541451[_0x08c8('0x26')]]));if(this[_0x08c8('0x12')][_0x541451[_0x08c8('0x26')]]){if(this['channels'][_0x541451['uniqueid']]['faxpages']>0x0&&this[_0x08c8('0x27')][_0x541451[_0x08c8('0x26')]]['faxstatus']===_0x08c8('0x59')){this[_0x08c8('0x52')](_0x541451[_0x08c8('0x26')],!![]);}else{this[_0x08c8('0x52')](_0x541451[_0x08c8('0x26')],![],this[_0x08c8('0x27')][_0x541451[_0x08c8('0x26')]][_0x08c8('0x5a')]?_0x08c8('0x5b')+this['channels'][_0x541451[_0x08c8('0x26')]][_0x08c8('0x5a')]:_0x08c8('0x5c'));}}}};Fax['prototype'][_0x08c8('0x5d')]=function(_0x5b2d5c){var _0x13e26d=this;return new BPromise(function(_0x586996,_0x3b359e){_0x13e26d[_0x08c8('0x5e')](_0x5b2d5c,_0x13e26d[_0x08c8('0x10')][_0x5b2d5c[_0x08c8('0x5f')]])['then'](function(_0x4fbe3e){ut[_0x08c8('0x50')](_0x08c8('0x60'),_0x4fbe3e);_0x586996(ut[_0x08c8('0x3c')](_0x08c8('0x61')));})['catch'](function(_0x459a42){ut['logger'](_0x08c8('0x62'),_0x459a42);updateStatus(_0x5b2d5c);_0x3b359e(ut[_0x08c8('0x3c')](_0x08c8('0x63')));});});};Fax[_0x08c8('0x21')][_0x08c8('0x64')]=function(_0x35c83c){var _0x3c1761=this;return new BPromise(function(_0x344410,_0x151001){var _0x48d704=_0x3c1761[_0x08c8('0x65')](_0x3c1761[_0x08c8('0x10')][_0x35c83c[_0x08c8('0x5f')]]['Trunk'],_0x35c83c);if(_0x48d704[_0x08c8('0x66')]){_0x344410(ut['message'](_0x08c8('0x67')));}else{_0x151001(ut[_0x08c8('0x3c')](_0x48d704[_0x08c8('0x3c')]));}});};function originate(_0x330edd,_0x311a81,_0x38baf3){return new BPromise(function(_0x81957,_0x32f259){if(_0x38baf3){var _0x1d2841=util[_0x08c8('0x68')](_0x08c8('0x69'),path[_0x08c8('0x3e')](_0x330edd['path'])[_0x08c8('0x3f')],_0x330edd[_0x08c8('0x6a')]);gs[_0x08c8('0x6b')](_0x1d2841)[_0x08c8('0x42')](function(){_0x330edd[_0x08c8('0x6a')]=util[_0x08c8('0x68')](_0x08c8('0x6c'),path[_0x08c8('0x3e')](_0x330edd[_0x08c8('0x6a')])[_0x08c8('0x6d')],path[_0x08c8('0x3e')](_0x330edd['path'])[_0x08c8('0x3f')]);_0x311a81[_0x08c8('0x6e')]=_0x330edd[_0x08c8('0x6a')];ut[_0x08c8('0x50')]('Convert\x20pdf\x20to\x20tif','');ami[_0x08c8('0x6f')](ut[_0x08c8('0x70')](_0x330edd,_0x311a81))[_0x08c8('0x42')](function(_0x538a7b){_0x81957(_0x538a7b);})[_0x08c8('0x44')](function(_0x1afffc){_0x32f259(_0x1afffc);});})[_0x08c8('0x44')](function(_0xc6b772){_0x32f259(_0xc6b772);});}else{ami[_0x08c8('0x6f')](ut[_0x08c8('0x70')](_0x330edd,_0x311a81))[_0x08c8('0x42')](function(_0x496daa){_0x81957(_0x496daa);})['catch'](function(_0x4dc153){_0x32f259(_0x4dc153);});}});}Fax['prototype'][_0x08c8('0x5e')]=function(_0x29a543,_0x314d63){var _0xe94f17=this;return new BPromise(function(_0x310853,_0x508ab1){var _0x5c73f9=uuid['v4']();var _0x37e3e2=ut[_0x08c8('0x71')](_0x29a543,_0x314d63);_0xe94f17['actions'][_0x5c73f9]=new Action(_0x5c73f9,_0x314d63,_0x29a543);var _0x3e7018=_0xe94f17[_0x08c8('0x12')][_0x5c73f9];if(path[_0x08c8('0x3e')](_0x29a543['path'])[_0x08c8('0x72')]===_0x08c8('0x40')){originate(_0x3e7018,_0x37e3e2,!![])[_0x08c8('0x42')](function(_0x59907b){_0x310853(_0x59907b);})['catch'](function(_0x53e68c){_0x508ab1(_0x53e68c);});}else{originate(_0x3e7018,_0x37e3e2,![])[_0x08c8('0x42')](function(_0x73695){_0x310853(_0x73695);})['catch'](function(_0x3cb35d){_0x508ab1(_0x3cb35d);});}});};Fax[_0x08c8('0x21')]['isTrunkReachable']=function(_0x4df124){return!_[_0x08c8('0x73')](_0x4df124)&&!_[_0x08c8('0x73')](_0x4df124[_0x08c8('0x3f')])&&!_['isNil'](_0x4df124['active'])&&_0x4df124[_0x08c8('0x74')]&&!_['isNil'](this[_0x08c8('0x11')][util[_0x08c8('0x68')](_0x08c8('0x75'),_0x4df124[_0x08c8('0x3f')])])&&!_['isNil'](this['trunks'][util[_0x08c8('0x68')]('SIP/%s',_0x4df124[_0x08c8('0x3f')])][_0x08c8('0x32')])&&(this[_0x08c8('0x11')][util['format'](_0x08c8('0x75'),_0x4df124[_0x08c8('0x3f')])][_0x08c8('0x32')]===_0x08c8('0x76')||this['trunks'][util[_0x08c8('0x68')]('SIP/%s',_0x4df124[_0x08c8('0x3f')])][_0x08c8('0x32')]==='unmonitored');};Fax['prototype'][_0x08c8('0x65')]=function(_0x39a538,_0x47fc48){if(!this[_0x08c8('0x77')](_0x39a538)){ut[_0x08c8('0x50')](_0x08c8('0x78'),_[_0x08c8('0x73')](_0x39a538)?'':_0x39a538[_0x08c8('0x3f')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x08c8('0x79')};}if(_[_0x08c8('0x73')](_0x47fc48[_0x08c8('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x47fc48));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x08c8('0x73')](_0x47fc48[_0x08c8('0x6a')])){ut['logger'](_0x08c8('0x7a'),JSON[_0x08c8('0x46')](_0x47fc48));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x08c8('0x7b')};};module[_0x08c8('0x7c')]=Fax; \ No newline at end of file +var _0xba54=['newexten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','fax','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','uuid','path','./util/gs','../ami','./channel','./util/util','./action','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState'];(function(_0x27a7a9,_0x3ff625){var _0x415b63=function(_0x448cb0){while(--_0x448cb0){_0x27a7a9['push'](_0x27a7a9['shift']());}};_0x415b63(++_0x3ff625);}(_0xba54,0xcb));var _0x4ba5=function(_0x59a9a3,_0x3eec0f){_0x59a9a3=_0x59a9a3-0x0;var _0x5e7662=_0xba54[_0x59a9a3];return _0x5e7662;};'use strict';var util=require('util');var _=require(_0x4ba5('0x0'));var BPromise=require(_0x4ba5('0x1'));var uuid=require(_0x4ba5('0x2'));var moment=require('moment');var path=require(_0x4ba5('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x4ba5('0x4'));var logger=require('../../../config/logger')('fax');var ami=require(_0x4ba5('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0x4ba5('0x6'));var ut=require(_0x4ba5('0x7'));var Action=require(_0x4ba5('0x8'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x4ba5('0x9'));function Fax(_0x8fe8b7){this['channels']={};this[_0x4ba5('0xa')]=_0x8fe8b7[_0x4ba5('0xa')];this[_0x4ba5('0xb')]=_0x8fe8b7[_0x4ba5('0xb')];this[_0x4ba5('0xc')]={};ami['on'](_0x4ba5('0xd'),this['syncNewchannel'][_0x4ba5('0xe')](this));ami['on'](_0x4ba5('0xf'),this[_0x4ba5('0x10')][_0x4ba5('0xe')](this));ami['on'](_0x4ba5('0x11'),this[_0x4ba5('0x12')]['bind'](this));ami['on'](_0x4ba5('0x13'),this['syncNewExten'][_0x4ba5('0xe')](this));ami['on'](_0x4ba5('0x14'),this[_0x4ba5('0x15')][_0x4ba5('0xe')](this));ami['on']('receivefax',this[_0x4ba5('0x16')][_0x4ba5('0xe')](this));ami['on']('hangup',this[_0x4ba5('0x17')][_0x4ba5('0xe')](this));ami['on'](_0x4ba5('0x18'),this[_0x4ba5('0x19')]['bind'](this));}Fax[_0x4ba5('0x1a')]['syncNewchannel']=function(_0x2d4e8a){if(_0x2d4e8a[_0x4ba5('0x1b')]===_0x4ba5('0x1c')){for(var _0x321c51 in this[_0x4ba5('0xa')]){if(this['faxAccounts'][_0x4ba5('0x1d')](_0x321c51)){if(_0x2d4e8a[_0x4ba5('0x1e')]===this[_0x4ba5('0xa')][_0x321c51]['localstationid']){this[_0x4ba5('0x1f')][_0x2d4e8a[_0x4ba5('0x20')]]={};this[_0x4ba5('0x1f')][_0x2d4e8a[_0x4ba5('0x20')]][_0x4ba5('0x21')]=_0x2d4e8a[_0x4ba5('0x21')];this[_0x4ba5('0x1f')][_0x2d4e8a[_0x4ba5('0x20')]]['id']=this['faxAccounts'][_0x321c51]['id'];this[_0x4ba5('0x1f')][_0x2d4e8a[_0x4ba5('0x20')]][_0x4ba5('0x22')]=this[_0x4ba5('0xa')][_0x321c51][_0x4ba5('0x22')];logger[_0x4ba5('0x23')](_0x2d4e8a[_0x4ba5('0x20')],_0x4ba5('0x24'));}}}}if(this['actions'][_0x2d4e8a[_0x4ba5('0x20')]]){this[_0x4ba5('0x1f')][_0x2d4e8a['uniqueid']]={};this[_0x4ba5('0x1f')][_0x2d4e8a[_0x4ba5('0x20')]][_0x4ba5('0x21')]=_0x2d4e8a[_0x4ba5('0x21')];logger[_0x4ba5('0x23')](_0x2d4e8a[_0x4ba5('0x20')],_0x4ba5('0x24'));}};Fax['prototype'][_0x4ba5('0x10')]=function(_0x5b3d29){if(this[_0x4ba5('0x1f')][_0x5b3d29[_0x4ba5('0x20')]]){for(var _0x3282fd in _0x5b3d29[_0x4ba5('0x25')]){if(_0x5b3d29[_0x4ba5('0x25')][_0x4ba5('0x1d')](_0x3282fd)){this[_0x4ba5('0x1f')][_0x5b3d29[_0x4ba5('0x20')]][_0x3282fd]=_0x5b3d29[_0x4ba5('0x26')];}}}};Fax['prototype'][_0x4ba5('0x12')]=function(_0x427d0a){if(this[_0x4ba5('0x1f')][_0x427d0a[_0x4ba5('0x20')]]){this['channels'][_0x427d0a['uniqueid']]['channelstate']=_0x427d0a['channelstate'];this[_0x4ba5('0x1f')][_0x427d0a[_0x4ba5('0x20')]][_0x4ba5('0x27')]=_0x427d0a['channelstatedesc'];}};Fax[_0x4ba5('0x1a')][_0x4ba5('0x28')]=function(_0x2d3c2e){if(this[_0x4ba5('0x1f')][_0x2d3c2e[_0x4ba5('0x20')]]){for(var _0x3944f2 in _0x2d3c2e[_0x4ba5('0x25')]){if(_0x2d3c2e[_0x4ba5('0x25')][_0x4ba5('0x1d')](_0x3944f2)){this['channels'][_0x2d3c2e[_0x4ba5('0x20')]][_0x3944f2]=_0x2d3c2e['value'];}}}};Fax['prototype']['syncFaxStatus']=function(_0x1cd8b8){if(this[_0x4ba5('0x1f')][_0x1cd8b8[_0x4ba5('0x20')]]){this[_0x4ba5('0x1f')][_0x1cd8b8[_0x4ba5('0x20')]][_0x4ba5('0x29')]=_0x1cd8b8[_0x4ba5('0x29')];this[_0x4ba5('0x1f')][_0x1cd8b8[_0x4ba5('0x20')]][_0x4ba5('0x2a')]=_0x1cd8b8['status'];this[_0x4ba5('0x1f')][_0x1cd8b8['uniqueid']][_0x4ba5('0x2b')]=_0x1cd8b8['localstationid'];this['channels'][_0x1cd8b8[_0x4ba5('0x20')]][_0x4ba5('0x2c')]=_0x1cd8b8['filename'];logger[_0x4ba5('0x23')](_0x1cd8b8[_0x4ba5('0x20')],_0x4ba5('0x2d'));}};Fax[_0x4ba5('0x1a')][_0x4ba5('0x16')]=function(_0x57be32){var _0x77177f=this;if(this[_0x4ba5('0x1f')][_0x57be32[_0x4ba5('0x20')]]){var _0x5d3fc9=this['channels'][_0x57be32['uniqueid']]['id'];this[_0x4ba5('0x1f')][_0x57be32['uniqueid']]['remotestationid']=_0x57be32[_0x4ba5('0x2e')];this['channels'][_0x57be32[_0x4ba5('0x20')]][_0x4ba5('0x2f')]=_0x57be32['pagestransferred'];this[_0x4ba5('0x1f')][_0x57be32[_0x4ba5('0x20')]][_0x4ba5('0x2b')]=_0x57be32['localstationid'];this['channels'][_0x57be32[_0x4ba5('0x20')]]['resolution']=_0x57be32['resolution'];this['channels'][_0x57be32[_0x4ba5('0x20')]]['transferrate']=_0x57be32[_0x4ba5('0x30')];this[_0x4ba5('0x1f')][_0x57be32['uniqueid']]['filename']=_0x57be32['filename'];this['channels'][_0x57be32['uniqueid']][_0x4ba5('0x31')]=_0x57be32['calleridnum'];if(this[_0x4ba5('0x1f')][_0x57be32[_0x4ba5('0x20')]][_0x4ba5('0x2f')]>0x0){tiff2pdf(_0x57be32[_0x4ba5('0x2c')],_0x4ba5('0x32'),function(_0x450a08){logger[_0x4ba5('0x23')](_0x57be32[_0x4ba5('0x20')],_0x4ba5('0x33'),_0x450a08['message']);attachment['create']({'name':path[_0x4ba5('0x34')](_0x57be32[_0x4ba5('0x2c')])[_0x4ba5('0x22')],'basename':path[_0x4ba5('0x34')](_0x57be32[_0x4ba5('0x2c')])['name']+_0x4ba5('0x35'),'type':_0x4ba5('0x36')})[_0x4ba5('0x37')](function(_0x47c4a3){faxAccount[_0x4ba5('0x38')](_0x5d3fc9,{'from':_0x57be32[_0x4ba5('0x31')],'mapKey':'fax','body':path[_0x4ba5('0x34')](_0x57be32[_0x4ba5('0x2c')])['name']+_0x4ba5('0x35'),'AttachmentId':_0x47c4a3['id']})[_0x4ba5('0x39')](function(_0x3ea65b){logger[_0x4ba5('0x3a')](_0x57be32[_0x4ba5('0x20')],_0x4ba5('0x3b'),JSON['stringify'](_0x3ea65b));});})['catch'](function(_0xb591a0){logger[_0x4ba5('0x3a')](_0x57be32[_0x4ba5('0x20')],'\x20receiveFax\x20',JSON[_0x4ba5('0x3c')](_0xb591a0));});});}logger[_0x4ba5('0x23')](_0x57be32[_0x4ba5('0x20')],_0x4ba5('0x3d'));}};Fax['prototype'][_0x4ba5('0x19')]=function(_0x313745){if(this[_0x4ba5('0xc')][_0x313745[_0x4ba5('0x20')]]){_[_0x4ba5('0x3e')](this['channels'][_0x313745[_0x4ba5('0x20')]],_['pick'](_0x313745,['response',_0x4ba5('0x3f')]));}};function updateStatus(_0x4ffd3a){if(_0x4ffd3a[_0x4ba5('0x40')]){faxMessage[_0x4ba5('0x41')](_0x4ffd3a['AttachmentId'],{'failMessage':_0x4ba5('0x42')})[_0x4ba5('0x37')](function(_0x2ccb09){ut[_0x4ba5('0x43')](_0x4ba5('0x44'),_0x2ccb09);})[_0x4ba5('0x39')](function(_0x1e2c0e){ut['logger'](_0x4ba5('0x45'),_0x1e2c0e);});}else{ut[_0x4ba5('0x43')](_0x4ba5('0x46'));}}Fax[_0x4ba5('0x1a')][_0x4ba5('0x47')]=function(_0x3f9901,_0x2447bb,_0x55b209){var _0x4451de=this;var _0x45d066={};if(_0x2447bb){_0x45d066={'read':_0x2447bb};}else{_0x45d066={'failMessage':_0x55b209};}if(this[_0x4ba5('0xc')][_0x3f9901][_0x4ba5('0x40')]){faxMessage[_0x4ba5('0x41')](this['actions'][_0x3f9901][_0x4ba5('0x40')],_0x45d066)[_0x4ba5('0x37')](function(_0xcb2705){ut['logger'](_0x4ba5('0x48'),_0xcb2705);})[_0x4ba5('0x39')](function(_0x76d791){ut[_0x4ba5('0x43')](_0x4ba5('0x49'),_0x76d791);})[_0x4ba5('0x4a')](function(){delete _0x4451de[_0x4ba5('0x1f')][_0x3f9901];delete _0x4451de[_0x4ba5('0xc')][_0x3f9901];});}else{ut[_0x4ba5('0x43')](_0x4ba5('0x4b'));delete this[_0x4ba5('0x1f')][_0x3f9901];delete this[_0x4ba5('0xc')][_0x3f9901];}};Fax[_0x4ba5('0x1a')][_0x4ba5('0x17')]=function(_0x2c89f3){var _0x415a34=this;if(this[_0x4ba5('0x1f')][_0x2c89f3[_0x4ba5('0x20')]]){if(this['actions'][_0x2c89f3['uniqueid']]){this[_0x4ba5('0x1f')][_0x2c89f3['uniqueid']]['id']=this['actions'][_0x2c89f3[_0x4ba5('0x20')]]['id'];this[_0x4ba5('0x1f')][_0x2c89f3[_0x4ba5('0x20')]][_0x4ba5('0x22')]=this[_0x4ba5('0xc')][_0x2c89f3[_0x4ba5('0x20')]][_0x4ba5('0x22')];}logger[_0x4ba5('0x23')](_0x2c89f3[_0x4ba5('0x20')],this[_0x4ba5('0xc')][_0x2c89f3[_0x4ba5('0x20')]]?_0x4ba5('0x4c'):_0x4ba5('0x4d'),JSON[_0x4ba5('0x3c')](this[_0x4ba5('0x1f')][_0x2c89f3[_0x4ba5('0x20')]]));if(this[_0x4ba5('0xc')][_0x2c89f3[_0x4ba5('0x20')]]){if(this[_0x4ba5('0x1f')][_0x2c89f3['uniqueid']][_0x4ba5('0x4e')]>0x0&&this[_0x4ba5('0x1f')][_0x2c89f3[_0x4ba5('0x20')]][_0x4ba5('0x14')]==='SUCCESS'){this[_0x4ba5('0x47')](_0x2c89f3[_0x4ba5('0x20')],!![]);}else{this[_0x4ba5('0x47')](_0x2c89f3[_0x4ba5('0x20')],![],this[_0x4ba5('0x1f')][_0x2c89f3[_0x4ba5('0x20')]][_0x4ba5('0x4f')]?_0x4ba5('0x50')+this[_0x4ba5('0x1f')][_0x2c89f3['uniqueid']][_0x4ba5('0x4f')]:_0x4ba5('0x51'));}}}};Fax['prototype'][_0x4ba5('0x52')]=function(_0x3e981a){var _0x3f65cb=this;return new BPromise(function(_0x1ebdf4,_0x6035f2){_0x3f65cb[_0x4ba5('0x53')](_0x3e981a,_0x3f65cb[_0x4ba5('0xa')][_0x3e981a[_0x4ba5('0x54')]])['then'](function(_0x5aaa13){ut[_0x4ba5('0x43')](_0x4ba5('0x55'),_0x5aaa13);_0x1ebdf4(ut['message'](_0x4ba5('0x56')));})[_0x4ba5('0x39')](function(_0x28552d){ut['logger'](_0x4ba5('0x57'),_0x28552d);updateStatus(_0x3e981a);_0x6035f2(ut['message']('Fax\x20failed'));});});};Fax[_0x4ba5('0x1a')][_0x4ba5('0x58')]=function(_0x2b1758){var _0xd42c58=this;return new BPromise(function(_0x32dd79,_0x4eb0e3){var _0x1f980a=_0xd42c58['checkTrunk'](_0xd42c58[_0x4ba5('0xa')][_0x2b1758[_0x4ba5('0x54')]]['Trunk'],_0x2b1758);if(_0x1f980a[_0x4ba5('0x59')]){_0x32dd79(ut['message']('Trunk\x20Reachable'));}else{_0x4eb0e3(ut['message'](_0x1f980a['message']));}});};function originate(_0x2ab046,_0x3f9eb3,_0x37c4b6){return new BPromise(function(_0x48b12a,_0x210918){if(_0x37c4b6){var _0x59d5cb=util[_0x4ba5('0x5a')](_0x4ba5('0x5b'),path['parse'](_0x2ab046[_0x4ba5('0x3')])['name'],_0x2ab046['path']);gs[_0x4ba5('0x5c')](_0x59d5cb)[_0x4ba5('0x37')](function(){_0x2ab046[_0x4ba5('0x3')]=util[_0x4ba5('0x5a')]('%s/%s.tif',path['parse'](_0x2ab046[_0x4ba5('0x3')])[_0x4ba5('0x5d')],path[_0x4ba5('0x34')](_0x2ab046[_0x4ba5('0x3')])[_0x4ba5('0x22')]);_0x3f9eb3[_0x4ba5('0x5e')]=_0x2ab046[_0x4ba5('0x3')];ut['logger'](_0x4ba5('0x5f'),'');ami[_0x4ba5('0x60')](ut[_0x4ba5('0x61')](_0x2ab046,_0x3f9eb3))[_0x4ba5('0x37')](function(_0x56c438){_0x48b12a(_0x56c438);})['catch'](function(_0x342627){_0x210918(_0x342627);});})[_0x4ba5('0x39')](function(_0x1b7d63){_0x210918(_0x1b7d63);});}else{ami['Action'](ut['variablesAction'](_0x2ab046,_0x3f9eb3))[_0x4ba5('0x37')](function(_0x4d1ae0){_0x48b12a(_0x4d1ae0);})['catch'](function(_0x291568){_0x210918(_0x291568);});}});}Fax[_0x4ba5('0x1a')][_0x4ba5('0x53')]=function(_0x2f3e3a,_0x1f6352){var _0xd06c43=this;return new BPromise(function(_0x17dfae,_0x2defd5){var _0x122db9=uuid['v4']();var _0x26e3db=ut['addVariables'](_0x2f3e3a,_0x1f6352);_0xd06c43['actions'][_0x122db9]=new Action(_0x122db9,_0x1f6352,_0x2f3e3a);var _0x583972=_0xd06c43['actions'][_0x122db9];if(path['parse'](_0x2f3e3a[_0x4ba5('0x3')])['ext']==='.pdf'){originate(_0x583972,_0x26e3db,!![])[_0x4ba5('0x37')](function(_0x7d927a){_0x17dfae(_0x7d927a);})['catch'](function(_0x28f722){_0x2defd5(_0x28f722);});}else{originate(_0x583972,_0x26e3db,![])[_0x4ba5('0x37')](function(_0x3e32da){_0x17dfae(_0x3e32da);})['catch'](function(_0x5b590d){_0x2defd5(_0x5b590d);});}});};Fax[_0x4ba5('0x1a')][_0x4ba5('0x62')]=function(_0x55fd8a){return!_[_0x4ba5('0x63')](_0x55fd8a)&&!_['isNil'](_0x55fd8a['name'])&&!_[_0x4ba5('0x63')](_0x55fd8a['active'])&&_0x55fd8a[_0x4ba5('0x64')]&&!_['isNil'](this[_0x4ba5('0xb')][util[_0x4ba5('0x5a')](_0x4ba5('0x65'),_0x55fd8a[_0x4ba5('0x22')])])&&!_[_0x4ba5('0x63')](this[_0x4ba5('0xb')][util['format']('SIP/%s',_0x55fd8a[_0x4ba5('0x22')])][_0x4ba5('0x2a')])&&(this['trunks'][util[_0x4ba5('0x5a')](_0x4ba5('0x65'),_0x55fd8a['name'])][_0x4ba5('0x2a')]===_0x4ba5('0x66')||this['trunks'][util['format'](_0x4ba5('0x65'),_0x55fd8a[_0x4ba5('0x22')])][_0x4ba5('0x2a')]==='unmonitored');};Fax['prototype'][_0x4ba5('0x67')]=function(_0x5673b5,_0x2645cb){if(!this[_0x4ba5('0x62')](_0x5673b5)){ut[_0x4ba5('0x43')](_0x4ba5('0x68'),_['isNil'](_0x5673b5)?'':_0x5673b5['name']+_0x4ba5('0x69'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x4ba5('0x63')](_0x2645cb[_0x4ba5('0x6a')])){ut[_0x4ba5('0x43')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4ba5('0x3c')](_0x2645cb));return{'isValid':![],'message':_0x4ba5('0x6b')};}if(_[_0x4ba5('0x63')](_0x2645cb['path'])){ut[_0x4ba5('0x43')](_0x4ba5('0x6c'),JSON[_0x4ba5('0x3c')](_0x2645cb));return{'isValid':![],'message':_0x4ba5('0x6d')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x4ba5('0x6e')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index aedce8d..91c5c3c 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 _0x9e03=['[Notify]\x20','util','bluebird','../../../config/logger','preview','error','resolve','then','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e03,0x1a8));var _0x39e0=function(_0x565709,_0x432554){_0x565709=_0x565709-0x0;var _0x41b2f6=_0x9e03[_0x565709];return _0x41b2f6;};'use strict';var util=require(_0x39e0('0x0'));var BPromise=require(_0x39e0('0x1'));var logger=require(_0x39e0('0x2'))(_0x39e0('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x587dd1){return function(_0x4b4bee){logger[_0x39e0('0x4')](_0x587dd1,util['inspect'](_0x4b4bee,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x53c914,_0x4f8263){return BPromise[_0x39e0('0x5')]()[_0x39e0('0x6')](faxAccount[_0x39e0('0x7')](_0x53c914,_0x4f8263))['catch'](loggerCatch(_0x39e0('0x8')));}; \ No newline at end of file +var _0xd8d8=['resolve','then','catch','util','bluebird','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x1a19f5,_0x3065f3){var _0xd78eb4=function(_0x1279ee){while(--_0x1279ee){_0x1a19f5['push'](_0x1a19f5['shift']());}};_0xd78eb4(++_0x3065f3);}(_0xd8d8,0xf3));var _0x8d8d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd8d8[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x8d8d('0x0'));var BPromise=require(_0x8d8d('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x8d8d('0x2'));var faxAccount=require(_0x8d8d('0x3'));function loggerCatch(_0x2caee2){return function(_0xf27684){logger[_0x8d8d('0x4')](_0x2caee2,util[_0x8d8d('0x5')](_0xf27684,{'showHidden':![],'depth':null}));};}exports[_0x8d8d('0x6')]=function(_0x8fabf9,_0x4c8197){return BPromise[_0x8d8d('0x7')]()[_0x8d8d('0x8')](faxAccount['notify'](_0x8fabf9,_0x4c8197))[_0x8d8d('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 d39cd00..4600161 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 _0xdf42=['info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','execute'];(function(_0x4f6009,_0x292385){var _0x391fdd=function(_0x4b52ef){while(--_0x4b52ef){_0x4f6009['push'](_0x4f6009['shift']());}};_0x391fdd(++_0x292385);}(_0xdf42,0xcc));var _0x2df4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xdf42[_0x126558];return _0x1f6d14;};'use strict';var util=require(_0x2df4('0x0'));var logger=require('../../../../config/logger')(_0x2df4('0x1'));var BPromise=require(_0x2df4('0x2'));var exec=require('child_process')['exec'];exports[_0x2df4('0x3')]=function(_0x14ae8d){return new BPromise(function(_0x23b062,_0x790d7e){exec(_0x14ae8d,function(_0x3e8ee9,_0x4aa376,_0x115459){logger[_0x2df4('0x4')](_0x2df4('0x5'),_0x4aa376);if(_0x3e8ee9){logger[_0x2df4('0x4')](_0x2df4('0x5'),_0x2df4('0x6'),util[_0x2df4('0x7')](_0x3e8ee9,{'showHidden':![],'depth':null}),_0x4aa376,_0x115459);_0x790d7e(_0x3e8ee9);}_0x23b062(_0x4aa376);});});}; \ No newline at end of file +var _0x6dbd=['util','../../../../config/logger','fax','exec','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x4f103e,_0x284aaf){var _0x474b4d=function(_0x1448ae){while(--_0x1448ae){_0x4f103e['push'](_0x4f103e['shift']());}};_0x474b4d(++_0x284aaf);}(_0x6dbd,0xa0));var _0xd6db=function(_0x5da792,_0x2d44b4){_0x5da792=_0x5da792-0x0;var _0x49ae6d=_0x6dbd[_0x5da792];return _0x49ae6d;};'use strict';var util=require(_0xd6db('0x0'));var logger=require(_0xd6db('0x1'))(_0xd6db('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xd6db('0x3')];exports['execute']=function(_0x2841d){return new BPromise(function(_0x361312,_0x1b6285){exec(_0x2841d,function(_0x48692a,_0x298dc4,_0x2634f7){logger[_0xd6db('0x4')](_0xd6db('0x5'),_0x298dc4);if(_0x48692a){logger[_0xd6db('0x4')](_0xd6db('0x5'),_0xd6db('0x6'),util[_0xd6db('0x7')](_0x48692a,{'showHidden':![],'depth':null}),_0x298dc4,_0x2634f7);_0x1b6285(_0x48692a);}_0x361312(_0x298dc4);});});}; \ 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 d8aec15..c245084 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 _0x1e05=['gateway','path','variablesAction','uniqueid','format','localstationid','util','lodash','moment','fax','message','logger','info','inspect','ecm','headerinfo','minrate','modem'];(function(_0x5476af,_0x432ad6){var _0x5f0ee0=function(_0x2d5686){while(--_0x2d5686){_0x5476af['push'](_0x5476af['shift']());}};_0x5f0ee0(++_0x432ad6);}(_0x1e05,0x72));var _0x51e0=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0x1e05[_0x1a12c8];return _0x305109;};'use strict';var util=require(_0x51e0('0x0'));var _=require(_0x51e0('0x1'));var moment=require(_0x51e0('0x2'));var logger=require('../../../../config/logger')(_0x51e0('0x3'));exports[_0x51e0('0x4')]=function(_0x54faaa){return{'message':_0x54faaa};};exports[_0x51e0('0x5')]=function(_0x3c41a4,_0x288a25){logger[_0x51e0('0x6')](_0x3c41a4,util[_0x51e0('0x7')](_0x288a25,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1a038b,_0x2b4545){var _0x54c4d7={'XMF-ECM':_0x2b4545[_0x51e0('0x8')],'XMF-HEADERINFO':_0x2b4545[_0x51e0('0x9')],'XMF-MINRATE':_0x2b4545[_0x51e0('0xa')],'XMF-MAXRATE':_0x2b4545['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x2b4545[_0x51e0('0xb')]),'XMF-GATEWAY':_0x2b4545[_0x51e0('0xc')],'XMF-FAXDETECT':_0x2b4545['faxdetect'],'XMF-T38TIMEOUT':_0x2b4545['t38timeout'],'XMF-LOCALSTATIONID':_0x2b4545['localstationid'],'XMF-PATH':_0x1a038b[_0x51e0('0xd')]};return _0x54c4d7;};exports[_0x51e0('0xe')]=function(_0x2113f2,_0x579b26){return{'actionid':_0x2113f2[_0x51e0('0xf')],'action':'originate','channel':_0x2113f2['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x51e0('0x10')]('\x22%s\x22\x20<%s>',_0x2113f2[_0x51e0('0x9')]?_0x2113f2['headerinfo']:'',_0x2113f2[_0x51e0('0x11')]),'variable':_0x579b26,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2113f2['uniqueid']};}; \ No newline at end of file +var _0x9f27=['t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','maxrate','format','\x22%s\x22','gateway','faxdetect'];(function(_0x179c89,_0x3a69b2){var _0x4b87e5=function(_0xbdf6f2){while(--_0xbdf6f2){_0x179c89['push'](_0x179c89['shift']());}};_0x4b87e5(++_0x3a69b2);}(_0x9f27,0x1cc));var _0x79f2=function(_0x5d75ff,_0x5bc7ac){_0x5d75ff=_0x5d75ff-0x0;var _0x1c1894=_0x9f27[_0x5d75ff];return _0x1c1894;};'use strict';var util=require('util');var _=require(_0x79f2('0x0'));var moment=require(_0x79f2('0x1'));var logger=require(_0x79f2('0x2'))(_0x79f2('0x3'));exports[_0x79f2('0x4')]=function(_0x286b14){return{'message':_0x286b14};};exports[_0x79f2('0x5')]=function(_0x3912eb,_0x104541){logger[_0x79f2('0x6')](_0x3912eb,util[_0x79f2('0x7')](_0x104541,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x456b25,_0x299793){var _0x3a779b={'XMF-ECM':_0x299793[_0x79f2('0x8')],'XMF-HEADERINFO':_0x299793[_0x79f2('0x9')],'XMF-MINRATE':_0x299793['minrate'],'XMF-MAXRATE':_0x299793[_0x79f2('0xa')],'XMF-MODEM':util[_0x79f2('0xb')](_0x79f2('0xc'),_0x299793['modem']),'XMF-GATEWAY':_0x299793[_0x79f2('0xd')],'XMF-FAXDETECT':_0x299793[_0x79f2('0xe')],'XMF-T38TIMEOUT':_0x299793[_0x79f2('0xf')],'XMF-LOCALSTATIONID':_0x299793[_0x79f2('0x10')],'XMF-PATH':_0x456b25[_0x79f2('0x11')]};return _0x3a779b;};exports[_0x79f2('0x12')]=function(_0x2f45d1,_0x4ad26b){return{'actionid':_0x2f45d1[_0x79f2('0x13')],'action':_0x79f2('0x14'),'channel':_0x2f45d1[_0x79f2('0x15')],'Exten':_0x79f2('0x16'),'Context':_0x79f2('0x17'),'Priority':'1','callerid':util[_0x79f2('0xb')](_0x79f2('0x18'),_0x2f45d1[_0x79f2('0x9')]?_0x2f45d1[_0x79f2('0x9')]:'',_0x2f45d1[_0x79f2('0x10')]),'variable':_0x4ad26b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2f45d1['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index df049a3..5e57dd0 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 _0x252a=['getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./report','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x252a,0x86));var _0xa252=function(_0x2b7647,_0x2e6683){_0x2b7647=_0x2b7647-0x0;var _0x373dda=_0x252a[_0x2b7647];return _0x373dda;};'use strict';var util=require(_0xa252('0x0'));var moment=require(_0xa252('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xa252('0x2'));var Acw=require('./acw');var Trigger=require(_0xa252('0x3'));var Dialer=require('./dialer');var Preview=require(_0xa252('0x4'));var Fax=require(_0xa252('0x5'));var user=require(_0xa252('0x6'));var voiceQueue=require(_0xa252('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xa252('0x8'));var trigger=require(_0xa252('0x9'));var template=require(_0xa252('0xa'));var cmHopperHistory=require(_0xa252('0xb'));var campaign=require(_0xa252('0xc'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xa252('0xd'));var zendesk=require(_0xa252('0xe'));var salesforce=require(_0xa252('0xf'));var sugarcrm=require(_0xa252('0x10'));var freshdesk=require(_0xa252('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa252('0x12'));var servicenow=require(_0xa252('0x13'));var dynamics365=require(_0xa252('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xa252('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa252('0x16')](_0xa252('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xa252('0x18')]()[_0xa252('0x19')](user[_0xa252('0x1a')]())[_0xa252('0x19')](realtime['initAgents']())[_0xa252('0x19')](user['getTelephones']())[_0xa252('0x19')](realtime[_0xa252('0x1b')]())[_0xa252('0x19')](trunk['getTrunks']())[_0xa252('0x19')](realtime[_0xa252('0x1c')]())[_0xa252('0x19')](voiceQueue[_0xa252('0x1d')]())[_0xa252('0x19')](realtime['initVoiceQueues']())[_0xa252('0x19')](trigger[_0xa252('0x1e')]())[_0xa252('0x19')](realtime[_0xa252('0x1f')]())[_0xa252('0x19')](template[_0xa252('0x20')]())[_0xa252('0x19')](realtime['initTemplates']())[_0xa252('0x19')](zendesk[_0xa252('0x21')]())[_0xa252('0x19')](realtime['initZendeskAccounts']())[_0xa252('0x19')](salesforce['getSalesforceAccounts']())[_0xa252('0x19')](realtime[_0xa252('0x22')]())[_0xa252('0x19')](sugarcrm[_0xa252('0x23')]())[_0xa252('0x19')](realtime[_0xa252('0x24')]())[_0xa252('0x19')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0xa252('0x19')](desk[_0xa252('0x25')]())[_0xa252('0x19')](realtime[_0xa252('0x26')]())[_0xa252('0x19')](zoho[_0xa252('0x27')]())['then'](realtime[_0xa252('0x28')]())['then'](vtiger['getVtigerAccounts']())[_0xa252('0x19')](realtime['initVtigerAccounts']())[_0xa252('0x19')](freshsales['getFreshsalesAccounts']())[_0xa252('0x19')](realtime['initFreshsalesAccounts']())[_0xa252('0x19')](servicenow[_0xa252('0x29')]())[_0xa252('0x19')](realtime[_0xa252('0x2a')]())[_0xa252('0x19')](dynamics365[_0xa252('0x2b')]())[_0xa252('0x19')](realtime[_0xa252('0x2c')]())[_0xa252('0x19')](campaign[_0xa252('0x2d')]())[_0xa252('0x19')](realtime[_0xa252('0x2e')]())[_0xa252('0x19')](voiceExtension[_0xa252('0x2f')]())[_0xa252('0x19')](realtime[_0xa252('0x30')]())[_0xa252('0x19')](faxAccount['getFaxAccounts']())[_0xa252('0x19')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0xa252('0x18')]()['then'](voiceQueueReport[_0xa252('0x31')]())[_0xa252('0x19')](realtime[_0xa252('0x32')]())[_0xa252('0x19')](cmHopperHistory[_0xa252('0x33')]())[_0xa252('0x19')](realtime[_0xa252('0x34')]())[_0xa252('0x19')](cmHopperHistory[_0xa252('0x35')]())[_0xa252('0x19')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xa252('0x36')]())[_0xa252('0x19')](realtime['initVoiceCallReports']())['catch'](function(_0x9e7647){logger[_0xa252('0x37')](_0xa252('0x38'),util[_0xa252('0x39')](_0x9e7647,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa252('0x3a')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xa252('0x3b')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x478fc0){logger[_0xa252('0x37')](_0xa252('0x3c'),util[_0xa252('0x39')](_0x478fc0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x00c8=['ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','listen','catch','util','./realtime','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x00c8,0xe2));var _0x800c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x00c8[_0x2aea9e];return _0x430b92;};'use strict';var util=require(_0x800c('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x800c('0x1'));var Report=require(_0x800c('0x2'));var Acw=require(_0x800c('0x3'));var Trigger=require(_0x800c('0x4'));var Dialer=require(_0x800c('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x800c('0x6'));var voiceQueue=require(_0x800c('0x7'));var voiceQueueReport=require(_0x800c('0x8'));var voiceCallReport=require(_0x800c('0x9'));var trunk=require(_0x800c('0xa'));var trigger=require(_0x800c('0xb'));var template=require(_0x800c('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x800c('0xd'));var salesforce=require(_0x800c('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x800c('0xf'));var desk=require(_0x800c('0x10'));var zoho=require(_0x800c('0x11'));var vtiger=require(_0x800c('0x12'));var freshsales=require(_0x800c('0x13'));var servicenow=require(_0x800c('0x14'));var dynamics365=require(_0x800c('0x15'));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')(_0x800c('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x800c('0x17')](_0x800c('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x800c('0x17')](_0x800c('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x800c('0x19')]()[_0x800c('0x1a')](user[_0x800c('0x1b')]())[_0x800c('0x1a')](realtime[_0x800c('0x1c')]())[_0x800c('0x1a')](user['getTelephones']())[_0x800c('0x1a')](realtime[_0x800c('0x1d')]())[_0x800c('0x1a')](trunk[_0x800c('0x1e')]())[_0x800c('0x1a')](realtime[_0x800c('0x1f')]())['then'](voiceQueue['getVoiceQueues']())[_0x800c('0x1a')](realtime[_0x800c('0x20')]())['then'](trigger[_0x800c('0x21')]())[_0x800c('0x1a')](realtime[_0x800c('0x22')]())[_0x800c('0x1a')](template[_0x800c('0x23')]())[_0x800c('0x1a')](realtime['initTemplates']())[_0x800c('0x1a')](zendesk[_0x800c('0x24')]())[_0x800c('0x1a')](realtime['initZendeskAccounts']())[_0x800c('0x1a')](salesforce[_0x800c('0x25')]())['then'](realtime[_0x800c('0x26')]())['then'](sugarcrm[_0x800c('0x27')]())[_0x800c('0x1a')](realtime[_0x800c('0x28')]())[_0x800c('0x1a')](freshdesk[_0x800c('0x29')]())[_0x800c('0x1a')](realtime[_0x800c('0x2a')]())[_0x800c('0x1a')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x800c('0x1a')](zoho['getZohoAccounts']())[_0x800c('0x1a')](realtime[_0x800c('0x2b')]())[_0x800c('0x1a')](vtiger[_0x800c('0x2c')]())[_0x800c('0x1a')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0x800c('0x1a')](realtime['initFreshsalesAccounts']())[_0x800c('0x1a')](servicenow[_0x800c('0x2d')]())[_0x800c('0x1a')](realtime['initServicenowAccounts']())[_0x800c('0x1a')](dynamics365['getDynamics365Accounts']())[_0x800c('0x1a')](realtime[_0x800c('0x2e')]())[_0x800c('0x1a')](campaign[_0x800c('0x2f')]())[_0x800c('0x1a')](realtime[_0x800c('0x30')]())[_0x800c('0x1a')](voiceExtension[_0x800c('0x31')]())[_0x800c('0x1a')](realtime[_0x800c('0x32')]())[_0x800c('0x1a')](faxAccount['getFaxAccounts']())['then'](realtime[_0x800c('0x33')]())[_0x800c('0x1a')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x800c('0x1a')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x800c('0x34')]())[_0x800c('0x1a')](cmHopperHistory[_0x800c('0x35')]())[_0x800c('0x1a')](realtime[_0x800c('0x36')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x800c('0x1a')](realtime[_0x800c('0x37')]())['then'](voiceCallReport[_0x800c('0x38')]())[_0x800c('0x1a')](realtime[_0x800c('0x39')]())['catch'](function(_0x286022){logger[_0x800c('0x3a')]('[index.js][initParams]',util[_0x800c('0x3b')](_0x286022,{'showHidden':![],'depth':null}));});}function main(){return server[_0x800c('0x3c')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x800c('0x1a')](function(){return initParams();})[_0x800c('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x800c('0x3d')](function(_0x1c2b43){logger[_0x800c('0x3a')]('[index.js][main]',util[_0x800c('0x3b')](_0x1c2b43,{'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 126e7fc..3370506 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 _0xe47c=['state','toLowerCase','not_inuse','inuse','talking','statePause','format','accountcode','stringify','user:%s','emit','user:ami:update','user:presence','exports','util','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','fullname','unknown','stateTime','status','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime'];(function(_0x48b62f,_0x4c0c1b){var _0x390ee5=function(_0x27806a){while(--_0x27806a){_0x48b62f['push'](_0x48b62f['shift']());}};_0x390ee5(++_0x4c0c1b);}(_0xe47c,0x1ef));var _0xce47=function(_0xcc562c,_0x4203fe){_0xcc562c=_0xcc562c-0x0;var _0x4fa1f8=_0xe47c[_0xcc562c];return _0x4fa1f8;};'use strict';var _=require('lodash');var util=require(_0xce47('0x0'));var moment=require('moment');var md5=require(_0xce47('0x1'));var Redis=require(_0xce47('0x2'));var config=require(_0xce47('0x3'));config['redis']=_[_0xce47('0x4')](config[_0xce47('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xce47('0x6'))(new Redis(config[_0xce47('0x5')]));function Agent(_0x19d726){this['id']=_0x19d726['id']||0x0;this['name']=_0x19d726[_0xce47('0x7')]||'';this[_0xce47('0x8')]=_0x19d726[_0xce47('0x8')]||'';this['accountcode']=_0x19d726['accountcode']||'';this[_0xce47('0x9')]=_0x19d726[_0xce47('0x9')]||'';this['state']=_0xce47('0xa');this[_0xce47('0xb')]=0x0;this[_0xce47('0xc')]=_0xce47('0xa');this['address']='';this[_0xce47('0xd')]='';this['mobile']='';this[_0xce47('0xe')]='';this[_0xce47('0xf')]=_0x19d726[_0xce47('0xf')]||![];this[_0xce47('0x10')]=_0xce47('0xa');this[_0xce47('0x11')]=0x0;this[_0xce47('0x12')]='';this[_0xce47('0x13')]='';this['onhold']=![];this[_0xce47('0x14')]=![];this[_0xce47('0x1')]='';}Agent[_0xce47('0x15')][_0xce47('0x16')]=function(_0x57e36f){var _0x2f39ba;if(_0x57e36f&&_0x57e36f[_0xce47('0x17')]){_0x2f39ba=_0x57e36f[_0xce47('0x17')][_0xce47('0x18')]();switch(_0x2f39ba){case _0xce47('0x19'):_0x2f39ba='idle';break;case _0xce47('0x1a'):_0x2f39ba=_0xce47('0x1b');break;}}if(_0x2f39ba&&this['voiceStatus']!==_0x2f39ba||_0x57e36f[_0xce47('0x1c')]){this['voiceStatusTime']=_['toNumber'](moment()[_0xce47('0x1d')]('x'));}if(_0x2f39ba){this[_0xce47('0x10')]=_0x2f39ba;}var _0x1fc482={'id':this['id'],'name':this['name'],'email':this[_0xce47('0x8')],'accountcode':this[_0xce47('0x1e')],'fullname':this[_0xce47('0x9')],'state':this['state'],'stateTime':this[_0xce47('0xb')],'status':this[_0xce47('0xc')],'address':this['address'],'online':this[_0xce47('0xf')],'voiceStatus':this[_0xce47('0x10')],'voiceStatusTime':this[_0xce47('0x11')],'voiceStatusCallerIdNumber':this[_0xce47('0x12')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xce47('0xe')],'onhold':this['onhold']};var _0x24bfdb=md5(JSON[_0xce47('0x1f')](_0x1fc482));if(this[_0xce47('0x1')]!==_0x24bfdb){this['md5']=_0x24bfdb;io['to'](util[_0xce47('0x1d')](_0xce47('0x20'),_0x1fc482[_0xce47('0x7')]))[_0xce47('0x21')](_0xce47('0x22'),_['omit'](_0x1fc482,['online']));io[_0xce47('0x21')](_0xce47('0x23'),_0x1fc482);}};module[_0xce47('0x24')]=Agent; \ No newline at end of file +var _0x29aa=['status','unknown','address','mobile','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','accountcode','stateTime','name','emit','omit','user:presence','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','email','fullname','state'];(function(_0x46ab02,_0x46f430){var _0x39d9a4=function(_0x6ec26a){while(--_0x6ec26a){_0x46ab02['push'](_0x46ab02['shift']());}};_0x39d9a4(++_0x46f430);}(_0x29aa,0xb3));var _0xa29a=function(_0x3da3fb,_0x3b8934){_0x3da3fb=_0x3da3fb-0x0;var _0x54979c=_0x29aa[_0x3da3fb];return _0x54979c;};'use strict';var _=require(_0xa29a('0x0'));var util=require('util');var moment=require(_0xa29a('0x1'));var md5=require(_0xa29a('0x2'));var Redis=require(_0xa29a('0x3'));var config=require('../../../config/environment');config[_0xa29a('0x4')]=_[_0xa29a('0x5')](config[_0xa29a('0x4')],{'host':_0xa29a('0x6'),'port':0x18eb});var io=require(_0xa29a('0x7'))(new Redis(config[_0xa29a('0x4')]));function Agent(_0x385b65){this['id']=_0x385b65['id']||0x0;this['name']=_0x385b65['name']||'';this[_0xa29a('0x8')]=_0x385b65['email']||'';this['accountcode']=_0x385b65['accountcode']||'';this[_0xa29a('0x9')]=_0x385b65[_0xa29a('0x9')]||'';this[_0xa29a('0xa')]='unknown';this['stateTime']=0x0;this[_0xa29a('0xb')]=_0xa29a('0xc');this[_0xa29a('0xd')]='';this['phone']='';this[_0xa29a('0xe')]='';this[_0xa29a('0xf')]='';this['online']=_0x385b65[_0xa29a('0x10')]||![];this['voiceStatus']='unknown';this['voiceStatusTime']=0x0;this[_0xa29a('0x11')]='';this[_0xa29a('0x12')]='';this[_0xa29a('0x13')]=![];this[_0xa29a('0x14')]=![];this['md5']='';}Agent[_0xa29a('0x15')][_0xa29a('0x16')]=function(_0xafbf5d){var _0x1d0b91;if(_0xafbf5d&&_0xafbf5d[_0xa29a('0xa')]){_0x1d0b91=_0xafbf5d[_0xa29a('0xa')]['toLowerCase']();switch(_0x1d0b91){case _0xa29a('0x17'):_0x1d0b91=_0xa29a('0x18');break;case _0xa29a('0x19'):_0x1d0b91=_0xa29a('0x1a');break;}}if(_0x1d0b91&&this[_0xa29a('0x1b')]!==_0x1d0b91||_0xafbf5d[_0xa29a('0x1c')]){this[_0xa29a('0x1d')]=_[_0xa29a('0x1e')](moment()[_0xa29a('0x1f')]('x'));}if(_0x1d0b91){this['voiceStatus']=_0x1d0b91;}var _0x11a698={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xa29a('0x20')],'fullname':this[_0xa29a('0x9')],'state':this[_0xa29a('0xa')],'stateTime':this[_0xa29a('0x21')],'status':this[_0xa29a('0xb')],'address':this[_0xa29a('0xd')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xa29a('0x1d')],'voiceStatusCallerIdNumber':this[_0xa29a('0x11')],'voiceStatusQueue':this[_0xa29a('0x12')],'interface':this[_0xa29a('0xf')],'onhold':this[_0xa29a('0x13')]};var _0xe8752e=md5(JSON['stringify'](_0x11a698));if(this['md5']!==_0xe8752e){this['md5']=_0xe8752e;io['to'](util[_0xa29a('0x1f')]('user:%s',_0x11a698[_0xa29a('0x22')]))[_0xa29a('0x23')]('user:ami:update',_[_0xa29a('0x24')](_0x11a698,[_0xa29a('0x10')]));io['emit'](_0xa29a('0x25'),_0x11a698);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6d462f9..c729162 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 _0x2262=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x2262,0xbd));var _0x2226=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2262[_0x20a584];return _0x4b41a8;};'use strict';function Campaign(_0xd1fdce){this['id']=_0xd1fdce['id']||0x0;this[_0x2226('0x0')]=_0xd1fdce['name']||'';this['type']=_0xd1fdce['type']||_0x2226('0x1');this[_0x2226('0x2')]=0x0;this[_0x2226('0x3')]=0x0;this[_0x2226('0x4')]=0x0;this[_0x2226('0x5')]=0x0;this['message']='';this[_0x2226('0x6')]=!![];this[_0x2226('0x7')]=_0xd1fdce[_0x2226('0x7')];this['limitCalls']=_0xd1fdce[_0x2226('0x8')];this[_0x2226('0x9')]=_0xd1fdce[_0x2226('0x9')]||null;this[_0x2226('0xa')]=_0xd1fdce[_0x2226('0xa')]?_0xd1fdce['dialGlobalInterval']:null;this[_0x2226('0xb')]=_0xd1fdce['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0xd1fdce[_0x2226('0xc')];this['dialOriginateTimeout']=_0xd1fdce[_0x2226('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0xd1fdce['dialCongestionMaxRetry'];this[_0x2226('0xe')]=_0xd1fdce[_0x2226('0xe')];this[_0x2226('0xf')]=_0xd1fdce[_0x2226('0xf')];this[_0x2226('0x10')]=_0xd1fdce['dialBusyRetryFrequency'];this[_0x2226('0x11')]=_0xd1fdce[_0x2226('0x11')];this[_0x2226('0x12')]=_0xd1fdce[_0x2226('0x12')];this[_0x2226('0x13')]=_0xd1fdce['dialGlobalMaxRetry'];this[_0x2226('0x14')]=_0xd1fdce[_0x2226('0x14')]||0x3;this[_0x2226('0x15')]=_0xd1fdce[_0x2226('0x15')]||0x96;this[_0x2226('0x16')]=_0xd1fdce['dialDropMaxRetry']||0x3;this[_0x2226('0x17')]=_0xd1fdce[_0x2226('0x17')]||0x96;this[_0x2226('0x18')]=_0xd1fdce[_0x2226('0x18')]||0x3;this[_0x2226('0x19')]=_0xd1fdce[_0x2226('0x19')]||0x96;this[_0x2226('0x1a')]=_0xd1fdce[_0x2226('0x1a')]||0x3;this[_0x2226('0x1b')]=_0xd1fdce[_0x2226('0x1b')]||0x96;this[_0x2226('0x1c')]=_0xd1fdce[_0x2226('0x1c')]||0x3;this[_0x2226('0x1d')]=_0xd1fdce['dialAgentRejectRetryFrequency']||0x96;this[_0x2226('0x1e')]=_0xd1fdce['dialOrderByScheduledAt']||_0x2226('0x1f');this[_0x2226('0x20')]=_0xd1fdce[_0x2226('0x20')]||undefined;this[_0x2226('0x21')]=_0xd1fdce[_0x2226('0x21')]||undefined;this[_0x2226('0x22')]=_0xd1fdce[_0x2226('0x22')]||undefined;this['TrunkBackup']=_0xd1fdce[_0x2226('0x23')]?_0xd1fdce[_0x2226('0x23')]:undefined;this[_0x2226('0x24')]=_0xd1fdce['Trunk']?_0xd1fdce[_0x2226('0x24')]:undefined;this[_0x2226('0x25')]=_0xd1fdce[_0x2226('0x25')]?_0xd1fdce['Interval']:undefined;this[_0x2226('0x26')]=_0xd1fdce[_0x2226('0x26')]?_0xd1fdce['SquareProject']:undefined;this[_0x2226('0x27')]=_0xd1fdce['SquareProject']?_0xd1fdce['SquareProject'][_0x2226('0x0')]:undefined;this[_0x2226('0x28')]=_0xd1fdce['dialAMDActive']||![];this['dialAMDInitialSilence']=_0xd1fdce[_0x2226('0x29')];this['dialAMDGreeting']=_0xd1fdce[_0x2226('0x2a')];this['dialAMDAfterGreetingSilence']=_0xd1fdce[_0x2226('0x2b')];this['dialAMDTotalAnalysisTime']=_0xd1fdce[_0x2226('0x2c')];this[_0x2226('0x2d')]=_0xd1fdce[_0x2226('0x2d')];this[_0x2226('0x2e')]=_0xd1fdce[_0x2226('0x2e')];this[_0x2226('0x2f')]=_0xd1fdce[_0x2226('0x2f')];this[_0x2226('0x30')]=_0xd1fdce[_0x2226('0x30')];this[_0x2226('0x31')]=_0xd1fdce[_0x2226('0x31')];}module['exports']=Campaign; \ No newline at end of file +var _0xc79b=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x1fe337,_0x3a509c){var _0x1e5f6c=function(_0x569d93){while(--_0x569d93){_0x1fe337['push'](_0x1fe337['shift']());}};_0x1e5f6c(++_0x3a509c);}(_0xc79b,0x1d1));var _0xbc79=function(_0x364aab,_0x23ee0d){_0x364aab=_0x364aab-0x0;var _0x174e4c=_0xc79b[_0x364aab];return _0x174e4c;};'use strict';function Campaign(_0x548b24){this['id']=_0x548b24['id']||0x0;this['name']=_0x548b24[_0xbc79('0x0')]||'';this[_0xbc79('0x1')]=_0x548b24[_0xbc79('0x1')]||_0xbc79('0x2');this['originated']=0x0;this[_0xbc79('0x3')]=0x0;this[_0xbc79('0x4')]=0x0;this[_0xbc79('0x5')]=0x0;this['message']='';this[_0xbc79('0x6')]=!![];this['active']=_0x548b24[_0xbc79('0x7')];this[_0xbc79('0x8')]=_0x548b24[_0xbc79('0x8')];this['dialTimezone']=_0x548b24[_0xbc79('0x9')]||null;this[_0xbc79('0xa')]=_0x548b24[_0xbc79('0xa')]?_0x548b24['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x548b24[_0xbc79('0xb')];this['dialOriginateCallerIdNumber']=_0x548b24[_0xbc79('0xc')];this[_0xbc79('0xd')]=_0x548b24[_0xbc79('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x548b24[_0xbc79('0xe')];this[_0xbc79('0xf')]=_0x548b24[_0xbc79('0xf')];this[_0xbc79('0x10')]=_0x548b24[_0xbc79('0x10')];this[_0xbc79('0x11')]=_0x548b24[_0xbc79('0x11')];this[_0xbc79('0x12')]=_0x548b24[_0xbc79('0x12')];this[_0xbc79('0x13')]=_0x548b24[_0xbc79('0x13')];this[_0xbc79('0x14')]=_0x548b24['dialGlobalMaxRetry'];this[_0xbc79('0x15')]=_0x548b24['dialNoSuchNumberMaxRetry']||0x3;this[_0xbc79('0x16')]=_0x548b24['dialNoSuchNumberRetryFrequency']||0x96;this[_0xbc79('0x17')]=_0x548b24[_0xbc79('0x17')]||0x3;this[_0xbc79('0x18')]=_0x548b24[_0xbc79('0x18')]||0x96;this[_0xbc79('0x19')]=_0x548b24['dialAbandonedMaxRetry']||0x3;this[_0xbc79('0x1a')]=_0x548b24[_0xbc79('0x1a')]||0x96;this[_0xbc79('0x1b')]=_0x548b24[_0xbc79('0x1b')]||0x3;this[_0xbc79('0x1c')]=_0x548b24[_0xbc79('0x1c')]||0x96;this[_0xbc79('0x1d')]=_0x548b24['dialAgentRejectMaxRetry']||0x3;this[_0xbc79('0x1e')]=_0x548b24['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x548b24[_0xbc79('0x1f')]||_0xbc79('0x20');this[_0xbc79('0x21')]=_0x548b24['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x548b24['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xbc79('0x22')]=_0x548b24[_0xbc79('0x22')]||undefined;this[_0xbc79('0x23')]=_0x548b24[_0xbc79('0x23')]?_0x548b24[_0xbc79('0x23')]:undefined;this[_0xbc79('0x24')]=_0x548b24[_0xbc79('0x24')]?_0x548b24['Trunk']:undefined;this['Interval']=_0x548b24[_0xbc79('0x25')]?_0x548b24[_0xbc79('0x25')]:undefined;this[_0xbc79('0x26')]=_0x548b24['SquareProject']?_0x548b24['SquareProject']:undefined;this['dialQueueProject']=_0x548b24[_0xbc79('0x26')]?_0x548b24['SquareProject'][_0xbc79('0x0')]:undefined;this['dialAMDActive']=_0x548b24[_0xbc79('0x27')]||![];this[_0xbc79('0x28')]=_0x548b24[_0xbc79('0x28')];this[_0xbc79('0x29')]=_0x548b24[_0xbc79('0x29')];this['dialAMDAfterGreetingSilence']=_0x548b24['dialAMDAfterGreetingSilence'];this[_0xbc79('0x2a')]=_0x548b24[_0xbc79('0x2a')];this[_0xbc79('0x2b')]=_0x548b24['dialAMDMinWordLength'];this[_0xbc79('0x2c')]=_0x548b24[_0xbc79('0x2c')];this[_0xbc79('0x2d')]=_0x548b24[_0xbc79('0x2d')];this[_0xbc79('0x2e')]=_0x548b24[_0xbc79('0x2e')];this[_0xbc79('0x2f')]=_0x548b24['dialAMDMaximumWordLength'];}module[_0xbc79('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index bffba3a..054821b 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 _0x65ec=['starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports'];(function(_0x312c40,_0x2acc55){var _0x3f40bb=function(_0x5c6d4d){while(--_0x5c6d4d){_0x312c40['push'](_0x312c40['shift']());}};_0x3f40bb(++_0x2acc55);}(_0x65ec,0x16c));var _0xc65e=function(_0x28695b,_0x25350b){_0x28695b=_0x28695b-0x0;var _0x2fc3cc=_0x65ec[_0x28695b];return _0x2fc3cc;};'use strict';function Channel(){this[_0xc65e('0x0')]=null;this[_0xc65e('0x1')]='';this[_0xc65e('0x2')]='';this['calleridnum']=0x0;this[_0xc65e('0x3')]='';this['connectedlinenum']=undefined;this[_0xc65e('0x4')]=undefined;this[_0xc65e('0x5')]=0x0;this[_0xc65e('0x6')]='';this[_0xc65e('0x7')]=0x0;this[_0xc65e('0x8')]=0x0;this[_0xc65e('0x9')]=0x0;this[_0xc65e('0xa')]=![];this[_0xc65e('0xb')]=null;this[_0xc65e('0xc')]=null;this['unmanaged']=![];this[_0xc65e('0xd')]=![];this[_0xc65e('0xe')]='';this[_0xc65e('0xf')]='';this[_0xc65e('0x10')]=0x0;this[_0xc65e('0x11')]=0x0;this[_0xc65e('0x12')]=0x0;this[_0xc65e('0x13')]=null;this['tag']=null;this[_0xc65e('0x14')]=null;this[_0xc65e('0x15')]=![];this[_0xc65e('0x16')]=null;this['queue']=null;this[_0xc65e('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xc65e('0x18')]=undefined;this[_0xc65e('0x19')]=undefined;this[_0xc65e('0x1a')]=0x0;}module[_0xc65e('0x1b')]=Channel; \ No newline at end of file +var _0xaf60=['queue','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','connectedlinenum','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','duration','billableseconds','holdtime','monitor'];(function(_0x4e6e72,_0x74bc7){var _0x33c203=function(_0x2169ea){while(--_0x2169ea){_0x4e6e72['push'](_0x4e6e72['shift']());}};_0x33c203(++_0x74bc7);}(_0xaf60,0x82));var _0x0af6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xaf60[_0xbca1b1];return _0x4e1686;};'use strict';function Channel(){this[_0x0af6('0x0')]=null;this[_0x0af6('0x1')]='';this[_0x0af6('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x0af6('0x3')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x0af6('0x4')]='';this[_0x0af6('0x5')]=0x0;this[_0x0af6('0x6')]=0x0;this[_0x0af6('0x7')]=0x0;this[_0x0af6('0x8')]=![];this[_0x0af6('0x9')]=null;this[_0x0af6('0xa')]=null;this['unmanaged']=![];this[_0x0af6('0xb')]=![];this[_0x0af6('0xc')]='';this['lastdata']='';this[_0x0af6('0xd')]=0x0;this[_0x0af6('0xe')]=0x0;this[_0x0af6('0xf')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0x0af6('0x10')]=![];this['monitorFilename']=null;this[_0x0af6('0x11')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x0af6('0x12')]=undefined;this[_0x0af6('0x13')]=undefined;this[_0x0af6('0x14')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4330adf..b4090d9 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 _0x209b=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','authType'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x209b,0xbd));var _0xb209=function(_0x221a3d,_0x2b9912){_0x221a3d=_0x221a3d-0x0;var _0x30566f=_0x209b[_0x221a3d];return _0x30566f;};'use strict';function DeskAccount(_0x1e8b2f){this['id']=_0x1e8b2f['id']||0x0;this[_0xb209('0x0')]=_0x1e8b2f[_0xb209('0x0')]||'';this[_0xb209('0x1')]=_0x1e8b2f[_0xb209('0x1')]||'';this['remoteUri']=_0x1e8b2f['remoteUri']||'';this['authType']=_0x1e8b2f[_0xb209('0x2')]||'';this[_0xb209('0x3')]=_0x1e8b2f[_0xb209('0x3')]||'';this[_0xb209('0x4')]=_0x1e8b2f[_0xb209('0x4')]||'';this['consumerSecret']=_0x1e8b2f[_0xb209('0x5')]||'';this[_0xb209('0x6')]=_0x1e8b2f[_0xb209('0x6')]||'';this[_0xb209('0x7')]=_0x1e8b2f[_0xb209('0x7')]||'';this[_0xb209('0x8')]=_0x1e8b2f[_0xb209('0x8')]||'';this[_0xb209('0x9')]=_0x1e8b2f[_0xb209('0x9')]||'';this[_0xb209('0xa')]=_0x1e8b2f[_0xb209('0xa')]||{};}module[_0xb209('0xb')]=DeskAccount; \ No newline at end of file +var _0xe642=['authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4315f1,_0x3923ab){var _0x246e32=function(_0x3c0739){while(--_0x3c0739){_0x4315f1['push'](_0x4315f1['shift']());}};_0x246e32(++_0x3923ab);}(_0xe642,0x81));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x5cf93a){this['id']=_0x5cf93a['id']||0x0;this[_0x2e64('0x0')]=_0x5cf93a[_0x2e64('0x0')]||'';this[_0x2e64('0x1')]=_0x5cf93a[_0x2e64('0x1')]||'';this[_0x2e64('0x2')]=_0x5cf93a[_0x2e64('0x2')]||'';this[_0x2e64('0x3')]=_0x5cf93a[_0x2e64('0x3')]||'';this[_0x2e64('0x4')]=_0x5cf93a[_0x2e64('0x4')]||'';this[_0x2e64('0x5')]=_0x5cf93a[_0x2e64('0x5')]||'';this[_0x2e64('0x6')]=_0x5cf93a[_0x2e64('0x6')]||'';this[_0x2e64('0x7')]=_0x5cf93a[_0x2e64('0x7')]||'';this[_0x2e64('0x8')]=_0x5cf93a[_0x2e64('0x8')]||'';this['type']=_0x5cf93a['type']||'';this[_0x2e64('0x9')]=_0x5cf93a['serverUrl']||'';this['Configurations']=_0x5cf93a[_0x2e64('0xa')]||{};}module[_0x2e64('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7a5068f..c484bed 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 _0x7d4d=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId'];(function(_0xc1bf3c,_0x5eadb0){var _0x2a3135=function(_0x963415){while(--_0x963415){_0xc1bf3c['push'](_0xc1bf3c['shift']());}};_0x2a3135(++_0x5eadb0);}(_0x7d4d,0x1b3));var _0xd7d4=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x7d4d[_0x5df61d];return _0x24cc4c;};'use strict';function Dynamics365Account(_0x42a0f8){this['id']=_0x42a0f8['id']||0x0;this['name']=_0x42a0f8[_0xd7d4('0x0')]||'';this[_0xd7d4('0x1')]=_0x42a0f8[_0xd7d4('0x1')]||'';this[_0xd7d4('0x2')]=_0x42a0f8[_0xd7d4('0x2')]||'';this[_0xd7d4('0x3')]=_0x42a0f8[_0xd7d4('0x3')]||'';this[_0xd7d4('0x4')]=_0x42a0f8['tenantId']||'';this[_0xd7d4('0x5')]=_0x42a0f8[_0xd7d4('0x5')]||'';this[_0xd7d4('0x6')]=_0x42a0f8[_0xd7d4('0x6')]||{};this['serverUrl']=_0x42a0f8[_0xd7d4('0x7')]||'';this[_0xd7d4('0x8')]=_0x42a0f8[_0xd7d4('0x8')]||![];this[_0xd7d4('0x9')]=_0x42a0f8[_0xd7d4('0x9')]||{};this[_0xd7d4('0xa')]=_0x42a0f8[_0xd7d4('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x49ff=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x399a7a,_0x320a23){var _0xc13f40=function(_0x25fb99){while(--_0x25fb99){_0x399a7a['push'](_0x399a7a['shift']());}};_0xc13f40(++_0x320a23);}(_0x49ff,0xe5));var _0xf49f=function(_0x4af3e7,_0x526823){_0x4af3e7=_0x4af3e7-0x0;var _0x544823=_0x49ff[_0x4af3e7];return _0x544823;};'use strict';function Dynamics365Account(_0x2a64f7){this['id']=_0x2a64f7['id']||0x0;this[_0xf49f('0x0')]=_0x2a64f7[_0xf49f('0x0')]||'';this[_0xf49f('0x1')]=_0x2a64f7[_0xf49f('0x1')]||'';this[_0xf49f('0x2')]=_0x2a64f7['password']||'';this[_0xf49f('0x3')]=_0x2a64f7[_0xf49f('0x3')]||'';this[_0xf49f('0x4')]=_0x2a64f7[_0xf49f('0x4')]||'';this['clientId']=_0x2a64f7[_0xf49f('0x5')]||'';this['clientSecret']=_0x2a64f7[_0xf49f('0x6')]||{};this['serverUrl']=_0x2a64f7[_0xf49f('0x7')]||'';this[_0xf49f('0x8')]=_0x2a64f7[_0xf49f('0x8')]||![];this[_0xf49f('0x9')]=_0x2a64f7['Configurations']||{};this[_0xf49f('0xa')]=_0x2a64f7['CloudProvider']||{};}module[_0xf49f('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 73a7c42..ca01f32 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 _0x0471=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x27097a,_0x1b7f8b){var _0x26378b=function(_0x39f8f8){while(--_0x39f8f8){_0x27097a['push'](_0x27097a['shift']());}};_0x26378b(++_0x1b7f8b);}(_0x0471,0x192));var _0x1047=function(_0x36984a,_0x3f07cd){_0x36984a=_0x36984a-0x0;var _0x519713=_0x0471[_0x36984a];return _0x519713;};'use strict';function FaxAccount(_0x5f4a94){this['id']=_0x5f4a94['id']||0x0;this[_0x1047('0x0')]=_0x5f4a94[_0x1047('0x0')]||'';this[_0x1047('0x1')]=_0x5f4a94['description'];this[_0x1047('0x2')]=_0x5f4a94[_0x1047('0x2')];this[_0x1047('0x3')]=_0x5f4a94['headerinfo'];this[_0x1047('0x4')]=_0x5f4a94[_0x1047('0x4')];this[_0x1047('0x5')]=_0x5f4a94[_0x1047('0x5')]||0x960;this[_0x1047('0x6')]=_0x5f4a94[_0x1047('0x6')]||0x3840;this[_0x1047('0x7')]=_0x5f4a94[_0x1047('0x7')]||_0x1047('0x8');this[_0x1047('0x9')]=_0x5f4a94[_0x1047('0x9')]||'no';this[_0x1047('0xa')]=_0x5f4a94[_0x1047('0xa')]||'no';this[_0x1047('0xb')]=_0x5f4a94[_0x1047('0xb')]||0x1388;this[_0x1047('0xc')]=_0x5f4a94[_0x1047('0xc')]||_0x1047('0xd');this[_0x1047('0xe')]=_0x5f4a94['Trunk']?_0x5f4a94[_0x1047('0xe')]:undefined;this['ListId']=_0x5f4a94['ListId'];this[_0x1047('0xf')]=_0x5f4a94[_0x1047('0xf')];}module[_0x1047('0x10')]=FaxAccount; \ No newline at end of file +var _0x8748=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8748,0x176));var _0x8874=function(_0x47c910,_0x9db31c){_0x47c910=_0x47c910-0x0;var _0x55805f=_0x8748[_0x47c910];return _0x55805f;};'use strict';function FaxAccount(_0x1e6d3c){this['id']=_0x1e6d3c['id']||0x0;this[_0x8874('0x0')]=_0x1e6d3c[_0x8874('0x0')]||'';this[_0x8874('0x1')]=_0x1e6d3c[_0x8874('0x1')];this['ecm']=_0x1e6d3c[_0x8874('0x2')];this['headerinfo']=_0x1e6d3c[_0x8874('0x3')];this[_0x8874('0x4')]=_0x1e6d3c[_0x8874('0x4')];this[_0x8874('0x5')]=_0x1e6d3c[_0x8874('0x5')]||0x960;this[_0x8874('0x6')]=_0x1e6d3c[_0x8874('0x6')]||0x3840;this[_0x8874('0x7')]=_0x1e6d3c[_0x8874('0x7')]||_0x8874('0x8');this['gateway']=_0x1e6d3c['gateway']||'no';this[_0x8874('0x9')]=_0x1e6d3c[_0x8874('0x9')]||'no';this[_0x8874('0xa')]=_0x1e6d3c[_0x8874('0xa')]||0x1388;this[_0x8874('0xb')]=_0x1e6d3c[_0x8874('0xb')]||_0x8874('0xc');this[_0x8874('0xd')]=_0x1e6d3c[_0x8874('0xd')]?_0x1e6d3c[_0x8874('0xd')]:undefined;this[_0x8874('0xe')]=_0x1e6d3c[_0x8874('0xe')];this[_0x8874('0xf')]=_0x1e6d3c[_0x8874('0xf')];}module[_0x8874('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 0923744..011898e 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 _0xca7c=['apiKey','serverUrl','Configurations','name','username'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xca7c,0x8a));var _0xcca7=function(_0x215865,_0x2d6890){_0x215865=_0x215865-0x0;var _0x5e6494=_0xca7c[_0x215865];return _0x5e6494;};'use strict';function FreshdeskAccount(_0x1b173b){this['id']=_0x1b173b['id']||0x0;this[_0xcca7('0x0')]=_0x1b173b[_0xcca7('0x0')]||'';this['username']=_0x1b173b[_0xcca7('0x1')]||'';this[_0xcca7('0x2')]=_0x1b173b['token']||'';this['remoteUri']=_0x1b173b['remoteUri']||'';this[_0xcca7('0x3')]=_0x1b173b[_0xcca7('0x3')]||'';this['Configurations']=_0x1b173b[_0xcca7('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x20ed=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x35ca47,_0x3602c2){var _0x3b670c=function(_0x4bf47a){while(--_0x4bf47a){_0x35ca47['push'](_0x35ca47['shift']());}};_0x3b670c(++_0x3602c2);}(_0x20ed,0x9f));var _0xd20e=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x20ed[_0x220f3f];return _0x1f170e;};'use strict';function FreshdeskAccount(_0x44627c){this['id']=_0x44627c['id']||0x0;this[_0xd20e('0x0')]=_0x44627c[_0xd20e('0x0')]||'';this[_0xd20e('0x1')]=_0x44627c[_0xd20e('0x1')]||'';this[_0xd20e('0x2')]=_0x44627c[_0xd20e('0x3')]||'';this[_0xd20e('0x4')]=_0x44627c[_0xd20e('0x4')]||'';this[_0xd20e('0x5')]=_0x44627c[_0xd20e('0x5')]||'';this[_0xd20e('0x6')]=_0x44627c['Configurations']||{};}module[_0xd20e('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 6643c8b..722bed9 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 _0xf360=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xf360,0x9e));var _0x0f36=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf360[_0x3e5086];return _0xfeb102;};'use strict';function FreshsalesAccount(_0x18c229){this['id']=_0x18c229['id']||0x0;this[_0x0f36('0x0')]=_0x18c229[_0x0f36('0x0')]||'';this['username']=_0x18c229[_0x0f36('0x1')]||'';this['apiKey']=_0x18c229[_0x0f36('0x2')]||'';this[_0x0f36('0x3')]=_0x18c229[_0x0f36('0x3')]||'';this['serverUrl']=_0x18c229[_0x0f36('0x4')]||'';this[_0x0f36('0x5')]=_0x18c229[_0x0f36('0x5')]||{};}module[_0x0f36('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x4fb4=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x67c161,_0x5286c5){var _0x23ef2f=function(_0x4d7c7c){while(--_0x4d7c7c){_0x67c161['push'](_0x67c161['shift']());}};_0x23ef2f(++_0x5286c5);}(_0x4fb4,0x190));var _0x44fb=function(_0x99c4d0,_0x7006fe){_0x99c4d0=_0x99c4d0-0x0;var _0x4f8cda=_0x4fb4[_0x99c4d0];return _0x4f8cda;};'use strict';function FreshsalesAccount(_0x2983b0){this['id']=_0x2983b0['id']||0x0;this[_0x44fb('0x0')]=_0x2983b0[_0x44fb('0x0')]||'';this[_0x44fb('0x1')]=_0x2983b0[_0x44fb('0x1')]||'';this[_0x44fb('0x2')]=_0x2983b0[_0x44fb('0x3')]||'';this['remoteUri']=_0x2983b0[_0x44fb('0x4')]||'';this[_0x44fb('0x5')]=_0x2983b0[_0x44fb('0x5')]||'';this[_0x44fb('0x6')]=_0x2983b0[_0x44fb('0x6')]||{};}module[_0x44fb('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 08188ab..786280e 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 _0xfbb2=['priority','holdtime','lastAssignedTo','voice','routealias','mohtime','variables','type','inbound','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinenum','connectedlinename','accountcode','exten'];(function(_0x590655,_0x5bfb70){var _0x3ee1cb=function(_0x346514){while(--_0x346514){_0x590655['push'](_0x590655['shift']());}};_0x3ee1cb(++_0x5bfb70);}(_0xfbb2,0x1b7));var _0x2fbb=function(_0x2f9eeb,_0x53b0b6){_0x2f9eeb=_0x2f9eeb-0x0;var _0xcf83bc=_0xfbb2[_0x2f9eeb];return _0xcf83bc;};'use strict';function QueueReport(){this[_0x2fbb('0x0')]=_0x2fbb('0x1');this[_0x2fbb('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0x2fbb('0x3')]='';this[_0x2fbb('0x4')]=null;this[_0x2fbb('0x5')]=null;this[_0x2fbb('0x6')]=0x1;this[_0x2fbb('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x2fbb('0x8')]=null;this[_0x2fbb('0x9')]=![];this[_0x2fbb('0xa')]=null;this[_0x2fbb('0xb')]=![];this['queuecallerexitAt']=null;this[_0x2fbb('0xc')]=0x1;this['channel']='';this[_0x2fbb('0xd')]='';this[_0x2fbb('0xe')]='';this[_0x2fbb('0xf')]='';this['context']='';this[_0x2fbb('0x10')]='';this[_0x2fbb('0x11')]='';this[_0x2fbb('0x12')]=0x0;this['assigned']=![];this[_0x2fbb('0x13')]='';this['motionChannel']=_0x2fbb('0x14');this[_0x2fbb('0x15')]=null;this[_0x2fbb('0x16')]=0x0;this[_0x2fbb('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x4366=['channel','connectedlinenum','connectedlinename','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x1266f9,_0xbba76f){var _0x282acb=function(_0x3237f9){while(--_0x3237f9){_0x1266f9['push'](_0x1266f9['shift']());}};_0x282acb(++_0xbba76f);}(_0x4366,0x1b7));var _0x6436=function(_0x5f4c66,_0x497ab3){_0x5f4c66=_0x5f4c66-0x0;var _0x14129b=_0x4366[_0x5f4c66];return _0x14129b;};'use strict';function QueueReport(){this[_0x6436('0x0')]=_0x6436('0x1');this[_0x6436('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0x6436('0x3')]='';this[_0x6436('0x4')]=null;this[_0x6436('0x5')]=null;this['position']=0x1;this[_0x6436('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x6436('0x7')]=null;this['queuecallercomplete']=![];this[_0x6436('0x8')]=null;this[_0x6436('0x9')]=![];this[_0x6436('0xa')]=null;this['originalposition']=0x1;this[_0x6436('0xb')]='';this[_0x6436('0xc')]='';this[_0x6436('0xd')]='';this['accountcode']='';this['context']='';this[_0x6436('0xe')]='';this[_0x6436('0xf')]='';this[_0x6436('0x10')]=0x0;this[_0x6436('0x11')]=![];this[_0x6436('0x12')]='';this[_0x6436('0x13')]=_0x6436('0x14');this[_0x6436('0x15')]=null;this[_0x6436('0x16')]=0x0;this[_0x6436('0x17')]={};}module[_0x6436('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 0782ec9..bfa330a 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 _0x9a37=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x5ab52c,_0x430083){var _0x31f443=function(_0x2d5383){while(--_0x2d5383){_0x5ab52c['push'](_0x5ab52c['shift']());}};_0x31f443(++_0x430083);}(_0x9a37,0x7e));var _0x79a3=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x9a37[_0x360739];return _0x3e23a1;};'use strict';function SalesforceAccount(_0x3ad78b){this['id']=_0x3ad78b['id']||0x0;this[_0x79a3('0x0')]=_0x3ad78b[_0x79a3('0x0')]||'';this[_0x79a3('0x1')]=_0x3ad78b[_0x79a3('0x1')]||'';this[_0x79a3('0x2')]=_0x3ad78b[_0x79a3('0x2')]||'';this[_0x79a3('0x3')]=_0x3ad78b['password']||'';this[_0x79a3('0x4')]=_0x3ad78b[_0x79a3('0x4')]||'';this[_0x79a3('0x5')]=_0x3ad78b[_0x79a3('0x5')]||'';this[_0x79a3('0x6')]=_0x3ad78b['securityToken']||'';this[_0x79a3('0x7')]=_0x3ad78b[_0x79a3('0x7')]||_0x79a3('0x8');this['serverUrl']=_0x3ad78b[_0x79a3('0x9')]||'';this['Configurations']=_0x3ad78b[_0x79a3('0xa')]||{};}module[_0x79a3('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x7a2f=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x22fcb8,_0x469168){var _0xddc292=function(_0x175949){while(--_0x175949){_0x22fcb8['push'](_0x22fcb8['shift']());}};_0xddc292(++_0x469168);}(_0x7a2f,0x1c2));var _0xf7a2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7a2f[_0x17d9e3];return _0x14192d;};'use strict';function SalesforceAccount(_0x5c0b74){this['id']=_0x5c0b74['id']||0x0;this[_0xf7a2('0x0')]=_0x5c0b74['name']||'';this[_0xf7a2('0x1')]=_0x5c0b74[_0xf7a2('0x1')]||'';this['remoteUri']=_0x5c0b74[_0xf7a2('0x2')]||'';this[_0xf7a2('0x3')]=_0x5c0b74[_0xf7a2('0x3')]||'';this['clientId']=_0x5c0b74[_0xf7a2('0x4')]||'';this[_0xf7a2('0x5')]=_0x5c0b74[_0xf7a2('0x5')]||'';this[_0xf7a2('0x6')]=_0x5c0b74[_0xf7a2('0x6')]||'';this[_0xf7a2('0x7')]=_0x5c0b74['type']||_0xf7a2('0x8');this[_0xf7a2('0x9')]=_0x5c0b74[_0xf7a2('0x9')]||'';this[_0xf7a2('0xa')]=_0x5c0b74[_0xf7a2('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index de6b908..c992d93 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 _0xe259=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xa4f74a,_0x383426){var _0x13b6b2=function(_0x2ef37e){while(--_0x2ef37e){_0xa4f74a['push'](_0xa4f74a['shift']());}};_0x13b6b2(++_0x383426);}(_0xe259,0x177));var _0x9e25=function(_0x504f23,_0x48127e){_0x504f23=_0x504f23-0x0;var _0x35f6ea=_0xe259[_0x504f23];return _0x35f6ea;};'use strict';function ServicenowAccount(_0x5c1b96){this['id']=_0x5c1b96['id']||0x0;this['name']=_0x5c1b96[_0x9e25('0x0')]||'';this[_0x9e25('0x1')]=_0x5c1b96[_0x9e25('0x1')]||'';this[_0x9e25('0x2')]=_0x5c1b96[_0x9e25('0x2')]||'';this[_0x9e25('0x3')]=_0x5c1b96[_0x9e25('0x3')]||'';this[_0x9e25('0x4')]=_0x5c1b96['serverUrl']||'';this['Configurations']=_0x5c1b96[_0x9e25('0x5')]||{};}module[_0x9e25('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xe51f=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5c1ac6,_0x20a614){var _0x472bbf=function(_0xea0d8){while(--_0xea0d8){_0x5c1ac6['push'](_0x5c1ac6['shift']());}};_0x472bbf(++_0x20a614);}(_0xe51f,0xbb));var _0xfe51=function(_0x3a1a27,_0x378bef){_0x3a1a27=_0x3a1a27-0x0;var _0x33f1fd=_0xe51f[_0x3a1a27];return _0x33f1fd;};'use strict';function ServicenowAccount(_0x59aa15){this['id']=_0x59aa15['id']||0x0;this[_0xfe51('0x0')]=_0x59aa15[_0xfe51('0x0')]||'';this[_0xfe51('0x1')]=_0x59aa15[_0xfe51('0x1')]||'';this[_0xfe51('0x2')]=_0x59aa15[_0xfe51('0x2')]||'';this[_0xfe51('0x3')]=_0x59aa15[_0xfe51('0x3')]||'';this[_0xfe51('0x4')]=_0x59aa15[_0xfe51('0x4')]||'';this[_0xfe51('0x5')]=_0x59aa15['Configurations']||{};}module[_0xfe51('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 f09108f..f6c583f 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 _0x5814=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3b5a36,_0x5b726f){var _0x260706=function(_0x5cd474){while(--_0x5cd474){_0x3b5a36['push'](_0x3b5a36['shift']());}};_0x260706(++_0x5b726f);}(_0x5814,0x6f));var _0x4581=function(_0x30f94d,_0x1f83c9){_0x30f94d=_0x30f94d-0x0;var _0x24a9cd=_0x5814[_0x30f94d];return _0x24a9cd;};'use strict';function SugarcrmAccount(_0x1c2803){this['id']=_0x1c2803['id']||0x0;this['name']=_0x1c2803[_0x4581('0x0')]||'';this['username']=_0x1c2803[_0x4581('0x1')]||'';this[_0x4581('0x2')]=_0x1c2803['password']||'';this[_0x4581('0x3')]=_0x1c2803[_0x4581('0x3')]||'';this[_0x4581('0x4')]=_0x1c2803['serverUrl']||'';this['Configurations']=_0x1c2803[_0x4581('0x5')]||{};}module[_0x4581('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xaea8=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xaea8,0x71));var _0x8aea=function(_0x2bd7bf,_0x655792){_0x2bd7bf=_0x2bd7bf-0x0;var _0xb96d6b=_0xaea8[_0x2bd7bf];return _0xb96d6b;};'use strict';function SugarcrmAccount(_0xf37e2d){this['id']=_0xf37e2d['id']||0x0;this[_0x8aea('0x0')]=_0xf37e2d['name']||'';this[_0x8aea('0x1')]=_0xf37e2d[_0x8aea('0x1')]||'';this[_0x8aea('0x2')]=_0xf37e2d['password']||'';this[_0x8aea('0x3')]=_0xf37e2d['remoteUri']||'';this['serverUrl']=_0xf37e2d[_0x8aea('0x4')]||'';this[_0x8aea('0x5')]=_0xf37e2d[_0x8aea('0x5')]||{};}module[_0x8aea('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index b40c76f..5846a4f 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 _0x1808=['address','exports','name','accountcode','stateTime','status','unknown'];(function(_0x48ebe8,_0x300832){var _0x5c65fb=function(_0x55a95b){while(--_0x55a95b){_0x48ebe8['push'](_0x48ebe8['shift']());}};_0x5c65fb(++_0x300832);}(_0x1808,0xe2));var _0x8180=function(_0x5b11e0,_0x48afdf){_0x5b11e0=_0x5b11e0-0x0;var _0x40256b=_0x1808[_0x5b11e0];return _0x40256b;};'use strict';function Telephone(_0x5df3c7){this['id']=_0x5df3c7['id']||0x0;this[_0x8180('0x0')]=_0x5df3c7['name']||'';this[_0x8180('0x1')]=_0x5df3c7[_0x8180('0x1')]||'';this['state']='unknown';this[_0x8180('0x2')]=0x0;this[_0x8180('0x3')]=_0x8180('0x4');this[_0x8180('0x5')]='';}module[_0x8180('0x6')]=Telephone; \ No newline at end of file +var _0x4fad=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x4fad,0xcb));var _0xd4fa=function(_0x5a0cb2,_0x43a6e4){_0x5a0cb2=_0x5a0cb2-0x0;var _0x32b526=_0x4fad[_0x5a0cb2];return _0x32b526;};'use strict';function Telephone(_0x2e71db){this['id']=_0x2e71db['id']||0x0;this[_0xd4fa('0x0')]=_0x2e71db[_0xd4fa('0x0')]||'';this['accountcode']=_0x2e71db[_0xd4fa('0x1')]||'';this[_0xd4fa('0x2')]=_0xd4fa('0x3');this[_0xd4fa('0x4')]=0x0;this[_0xd4fa('0x5')]=_0xd4fa('0x3');this[_0xd4fa('0x6')]='';}module[_0xd4fa('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b04e294..cdfa7be 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 _0xa9e0=['exports','name'];(function(_0x220a05,_0x1ac2c0){var _0x4fed98=function(_0x446dad){while(--_0x446dad){_0x220a05['push'](_0x220a05['shift']());}};_0x4fed98(++_0x1ac2c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x274b1b,_0x5acf07){var _0x5c9676=function(_0x34864a){while(--_0x34864a){_0x274b1b['push'](_0x274b1b['shift']());}};_0x5c9676(++_0x5acf07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index ca85ffb..f523ea1 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 _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1a85,0x178));var _0x51a8=function(_0x528b92,_0x2a3971){_0x528b92=_0x528b92-0x0;var _0x171eba=_0x1a85[_0x528b92];return _0x171eba;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1a85,0x178));var _0x51a8=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0x1a85[_0x79ebc5];return _0x3813b6;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d506725..b656ae8 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 _0x7fc0=['status','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x7fc0,0x1a4));var _0x07fc=function(_0x482fcc,_0x448923){_0x482fcc=_0x482fcc-0x0;var _0x16ab21=_0x7fc0[_0x482fcc];return _0x16ab21;};'use strict';function Trunk(_0x1b889f){this['id']=_0x1b889f['id']||0x0;this['active']=_0x1b889f[_0x07fc('0x0')]||![];this[_0x07fc('0x1')]=_0x1b889f['name']||'';this[_0x07fc('0x2')]=_0x07fc('0x3');this[_0x07fc('0x4')]=0x0;this[_0x07fc('0x5')]=_0x07fc('0x3');this[_0x07fc('0x6')]=_0x1b889f['registry']&&_0x1b889f[_0x07fc('0x6')]['indexOf'](':')?_0x1b889f[_0x07fc('0x6')][_0x07fc('0x7')](':')[0x0]:'';this[_0x07fc('0x8')]='';this[_0x07fc('0x9')]='';this[_0x07fc('0xa')]='';this[_0x07fc('0xb')]='';this[_0x07fc('0xc')]='';this[_0x07fc('0xd')]=_0x07fc('0x3');this[_0x07fc('0xe')]='';this[_0x07fc('0xf')]='';this[_0x07fc('0x10')]=_0x1b889f[_0x07fc('0x10')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x6901=['name','state','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','address','defaultuser','active'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x6901,0xb5));var _0x1690=function(_0x168c28,_0x19b5d6){_0x168c28=_0x168c28-0x0;var _0x41f9bd=_0x6901[_0x168c28];return _0x41f9bd;};'use strict';function Trunk(_0x20b9db){this['id']=_0x20b9db['id']||0x0;this[_0x1690('0x0')]=_0x20b9db[_0x1690('0x0')]||![];this[_0x1690('0x1')]=_0x20b9db['name']||'';this[_0x1690('0x2')]=_0x1690('0x3');this['stateTime']=0x0;this['status']=_0x1690('0x3');this[_0x1690('0x4')]=_0x20b9db[_0x1690('0x4')]&&_0x20b9db[_0x1690('0x4')][_0x1690('0x5')](':')?_0x20b9db[_0x1690('0x4')][_0x1690('0x6')](':')[0x0]:'';this[_0x1690('0x7')]='';this[_0x1690('0x8')]='';this[_0x1690('0x9')]='';this[_0x1690('0xa')]='';this[_0x1690('0xb')]='';this['stateRegistry']=_0x1690('0x3');this['registrationtime']='';this[_0x1690('0xc')]='';this[_0x1690('0xd')]=_0x20b9db[_0x1690('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 66899ed..6cce05d 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 _0xe960=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x29fb8f,_0xeeeb0b){var _0x25dc93=function(_0x594e49){while(--_0x594e49){_0x29fb8f['push'](_0x29fb8f['shift']());}};_0x25dc93(++_0xeeeb0b);}(_0xe960,0x1a4));var _0x0e96=function(_0x453fd1,_0x4149ba){_0x453fd1=_0x453fd1-0x0;var _0x20d9d1=_0xe960[_0x453fd1];return _0x20d9d1;};'use strict';function voiceExtension(_0x3720b8){this['id']=_0x3720b8['id']||0x0;this[_0x0e96('0x0')]=_0x3720b8[_0x0e96('0x0')]||'';this['recordingFormat']=_0x3720b8[_0x0e96('0x1')]||_0x0e96('0x2');this[_0x0e96('0x3')]=_0x3720b8[_0x0e96('0x3')]||![];}module[_0x0e96('0x4')]=voiceExtension; \ No newline at end of file +var _0xb996=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb996,0x179));var _0x6b99=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb996[_0x5037ab];return _0x512adb;};'use strict';function voiceExtension(_0x26f947){this['id']=_0x26f947['id']||0x0;this[_0x6b99('0x0')]=_0x26f947[_0x6b99('0x0')]||'';this['recordingFormat']=_0x26f947[_0x6b99('0x1')]||_0x6b99('0x2');this[_0x6b99('0x3')]=_0x26f947[_0x6b99('0x3')]||![];}module[_0x6b99('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ab160b1..e561552 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 _0xfdfc=['invalid','loggedIn','onHold','paused','ringing','ringInUse','talking','unavailable','acwTimeout','autopause','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','inUse'];(function(_0x3c1282,_0x189948){var _0x426489=function(_0x1c04ce){while(--_0x1c04ce){_0x3c1282['push'](_0x3c1282['shift']());}};_0x426489(++_0x189948);}(_0xfdfc,0x6c));var _0xcfdf=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xfdfc[_0x5f0089];return _0x193892;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0xcfdf('0x0'),'leastrecent':_0xcfdf('0x1'),'linear':_0xcfdf('0x2'),'random':_0xcfdf('0x3'),'ringall':_0xcfdf('0x4'),'rr':'roundrobin','rrmemory':_0xcfdf('0x5'),'rrordered':_0xcfdf('0x6'),'wrandom':_0xcfdf('0x7')};function VoiceQueue(_0x4ca5c8){this['id']=_0x4ca5c8['id']||0x0;this[_0xcfdf('0x8')]=_0x4ca5c8[_0xcfdf('0x8')]||'';this[_0xcfdf('0x9')]=_0x4ca5c8[_0xcfdf('0x9')]||'';this[_0xcfdf('0xa')]=_0x4ca5c8[_0xcfdf('0xa')]||_0xcfdf('0xb');this[_0xcfdf('0xc')]=0x0;this['total']=0x0;this[_0xcfdf('0xd')]=0x0;this[_0xcfdf('0xe')]=0x0;this[_0xcfdf('0xf')]=0x0;this[_0xcfdf('0x10')]=0x0;this[_0xcfdf('0x11')]=0x0;this['abandoned']=0x0;this[_0xcfdf('0x12')]=0x0;this[_0xcfdf('0x13')]=0x0;this[_0xcfdf('0x14')]=0x0;this[_0xcfdf('0x15')]=0x0;this[_0xcfdf('0x16')]=0x0;this['notInUse']=0x0;this[_0xcfdf('0x17')]=0x0;this[_0xcfdf('0x18')]=0x0;this[_0xcfdf('0x19')]=0x0;this[_0xcfdf('0x1a')]=0x0;this[_0xcfdf('0x1b')]=0x0;this[_0xcfdf('0x1c')]=0x0;this['unknown']=0x0;this['acw']=_0x4ca5c8['acw']||![];this[_0xcfdf('0x1d')]=_0x4ca5c8[_0xcfdf('0x1d')]||0xa;this[_0xcfdf('0x1e')]=_0x4ca5c8[_0xcfdf('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0xcfdf('0x1f')]='';this[_0xcfdf('0x20')]='';this[_0xcfdf('0x21')]=0x0;this['temp']=0x0;this[_0xcfdf('0x22')]=_0x4ca5c8['dialTimezone']||null;this[_0xcfdf('0x23')]=_0x4ca5c8['dialGlobalInterval']?_0x4ca5c8[_0xcfdf('0x23')]:null;this[_0xcfdf('0x24')]=_0x4ca5c8[_0xcfdf('0x24')];this[_0xcfdf('0x25')]=_0x4ca5c8[_0xcfdf('0x25')]||'progressive';this[_0xcfdf('0x26')]=_0x4ca5c8[_0xcfdf('0x26')]||0x0;this['dialLimitQueue']=_0x4ca5c8[_0xcfdf('0x27')]||0x0;this['dialPowerLevel']=_0x4ca5c8['dialPowerLevel']||0x1;this[_0xcfdf('0x28')]=_0x4ca5c8[_0xcfdf('0x28')]||'dropRate';this[_0xcfdf('0x29')]=_0x4ca5c8[_0xcfdf('0x29')]||0.03;this[_0xcfdf('0x2a')]=_0x4ca5c8[_0xcfdf('0x2a')]||0x258;this['dialOriginateCallerIdName']=_0x4ca5c8['dialOriginateCallerIdName']||_0xcfdf('0x2b');this['dialOriginateCallerIdNumber']=_0x4ca5c8[_0xcfdf('0x2c')]||_0xcfdf('0x2b');this[_0xcfdf('0x2d')]=_0x4ca5c8[_0xcfdf('0x2d')]||0x1e;this[_0xcfdf('0x2e')]=_0x4ca5c8[_0xcfdf('0x2e')]||_0xcfdf('0x2f');this[_0xcfdf('0x30')]=_0x4ca5c8[_0xcfdf('0x30')]||0x3;this[_0xcfdf('0x31')]=_0x4ca5c8['dialQueueProject']||undefined;this[_0xcfdf('0x32')]=_0x4ca5c8['dialCongestionMaxRetry']||0x3;this[_0xcfdf('0x33')]=_0x4ca5c8['dialCongestionRetryFrequency']||0x96;this[_0xcfdf('0x34')]=_0x4ca5c8['dialBusyMaxRetry']||0x3;this[_0xcfdf('0x35')]=_0x4ca5c8[_0xcfdf('0x35')]||0x96;this[_0xcfdf('0x36')]=_0x4ca5c8[_0xcfdf('0x36')]||0x3;this[_0xcfdf('0x37')]=_0x4ca5c8['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4ca5c8[_0xcfdf('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4ca5c8['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcfdf('0x39')]=_0x4ca5c8[_0xcfdf('0x39')]||0x3;this['dialDropRetryFrequency']=_0x4ca5c8[_0xcfdf('0x3a')]||0x96;this[_0xcfdf('0x3b')]=_0x4ca5c8[_0xcfdf('0x3b')]||0x3;this[_0xcfdf('0x3c')]=_0x4ca5c8[_0xcfdf('0x3c')]||0x96;this[_0xcfdf('0x3d')]=_0x4ca5c8['dialMachineMaxRetry']||0x3;this[_0xcfdf('0x3e')]=_0x4ca5c8['dialMachineRetryFrequency']||0x96;this[_0xcfdf('0x3f')]=_0x4ca5c8[_0xcfdf('0x3f')]||0x3;this[_0xcfdf('0x40')]=_0x4ca5c8['dialAgentRejectRetryFrequency']||0x96;this[_0xcfdf('0x41')]=_0x4ca5c8[_0xcfdf('0x41')]||0x3;this[_0xcfdf('0x42')]=_0x4ca5c8[_0xcfdf('0x42')]||0x4;this['Trunk']=_0x4ca5c8[_0xcfdf('0x43')]?_0x4ca5c8[_0xcfdf('0x43')]:undefined;this[_0xcfdf('0x44')]=_0x4ca5c8[_0xcfdf('0x44')]?_0x4ca5c8[_0xcfdf('0x44')]:undefined;this[_0xcfdf('0x45')]=_0x4ca5c8[_0xcfdf('0x45')]||undefined;this['Interval']=_0x4ca5c8[_0xcfdf('0x46')]?_0x4ca5c8[_0xcfdf('0x46')]:undefined;this[_0xcfdf('0x47')]=_0x4ca5c8[_0xcfdf('0x47')]||_0xcfdf('0x48');this[_0xcfdf('0x49')]=_0x4ca5c8['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x4ca5c8[_0xcfdf('0x4a')]||undefined;this[_0xcfdf('0x4b')]=strategy[_0x4ca5c8['strategy']];this[_0xcfdf('0x4c')]=!![];this[_0xcfdf('0x4d')]=_0x4ca5c8[_0xcfdf('0x4d')]||![];this[_0xcfdf('0x4e')]=_0x4ca5c8[_0xcfdf('0x4e')];this[_0xcfdf('0x4f')]=_0x4ca5c8[_0xcfdf('0x4f')];this[_0xcfdf('0x50')]=_0x4ca5c8[_0xcfdf('0x50')];this[_0xcfdf('0x51')]=_0x4ca5c8[_0xcfdf('0x51')];this[_0xcfdf('0x52')]=_0x4ca5c8['dialAMDMinWordLength'];this[_0xcfdf('0x53')]=_0x4ca5c8[_0xcfdf('0x53')];this[_0xcfdf('0x54')]=_0x4ca5c8[_0xcfdf('0x54')];this[_0xcfdf('0x55')]=_0x4ca5c8[_0xcfdf('0x55')];this[_0xcfdf('0x56')]=_0x4ca5c8['dialAMDMaximumWordLength'];this[_0xcfdf('0x57')]=0x0;this['pTalking']=0x0;this[_0xcfdf('0x58')]=_0x4ca5c8[_0xcfdf('0x58')];this[_0xcfdf('0x59')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xcfdf('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xcfdf('0x5b')]=0x0;this[_0xcfdf('0x5c')]=0x0;this[_0xcfdf('0x5d')]=0x0;this[_0xcfdf('0x5e')]=0x0;this[_0xcfdf('0x5f')]=0x0;this[_0xcfdf('0x60')]=0x0;this[_0xcfdf('0x61')]=0x0;this[_0xcfdf('0x62')]=0x0;this[_0xcfdf('0x63')]=0x0;this[_0xcfdf('0x64')]=0x0;this['startProgressive']=undefined;this[_0xcfdf('0x65')]=undefined;this[_0xcfdf('0x66')]=undefined;this[_0xcfdf('0x67')]=1.05;this[_0xcfdf('0x68')]=0x0;this[_0xcfdf('0x69')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xcfdf('0x6a')]=0x0;this[_0xcfdf('0x6b')]=0x0;this[_0xcfdf('0x6c')]=0x0;this[_0xcfdf('0x6d')]=0x0;this[_0xcfdf('0x6e')]=0x0;this[_0xcfdf('0x6f')]=_0x4ca5c8[_0xcfdf('0x70')]||0x14;this['predictiveIntervalMinThreshold']=_0x4ca5c8[_0xcfdf('0x70')]||0xa;this[_0xcfdf('0x71')]=0x0;this[_0xcfdf('0x72')]=0x0;this[_0xcfdf('0x73')]=0x1;this['erlangCalls']=0x0;this[_0xcfdf('0x74')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xcfdf('0x75')]=0x0;this[_0xcfdf('0x76')]=_0x4ca5c8[_0xcfdf('0x76')]||0x1e;this[_0xcfdf('0x77')]=_0x4ca5c8[_0xcfdf('0x77')]||![];this[_0xcfdf('0x78')]=!!_0x4ca5c8['dialPreviewAutoRecallMe']||![];this[_0xcfdf('0x79')]=!!_0x4ca5c8['dialPreviewRecallmeReminder']||![];this[_0xcfdf('0x7a')]=_0x4ca5c8[_0xcfdf('0x7a')]||undefined;this[_0xcfdf('0x7b')]=_0x4ca5c8['dialAgiAfterHangupClient']||![];this[_0xcfdf('0x7c')]=_0x4ca5c8[_0xcfdf('0x7c')]||![];this[_0xcfdf('0x9')]=monitorFormat[_0x4ca5c8[_0xcfdf('0x9')]]?monitorFormat[_0x4ca5c8[_0xcfdf('0x9')]]:undefined;this[_0xcfdf('0x7d')]=_0x4ca5c8[_0xcfdf('0x7d')]||![];this[_0xcfdf('0x7e')]=_0x4ca5c8['mandatoryDispositionPause']?_0x4ca5c8[_0xcfdf('0x7e')]:undefined;this[_0xcfdf('0x7f')]=![];}module[_0xcfdf('0x80')]=VoiceQueue; \ No newline at end of file +var _0x42f0=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','total','sumDuration','unmanaged','abandoned','available','invalid','onHold','paused','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete'];(function(_0x2b948f,_0x398e62){var _0x1237bc=function(_0x3c1843){while(--_0x3c1843){_0x2b948f['push'](_0x2b948f['shift']());}};_0x1237bc(++_0x398e62);}(_0x42f0,0x1b4));var _0x042f=function(_0x48120f,_0x1da1b8){_0x48120f=_0x48120f-0x0;var _0x39a62e=_0x42f0[_0x48120f];return _0x39a62e;};'use strict';var monitorFormat={'wav':_0x042f('0x0'),'wav49':_0x042f('0x1'),'gsm':_0x042f('0x2')};var strategy={'fewestcalls':_0x042f('0x3'),'leastrecent':_0x042f('0x4'),'linear':_0x042f('0x5'),'random':_0x042f('0x6'),'ringall':_0x042f('0x7'),'rr':'roundrobin','rrmemory':_0x042f('0x8'),'rrordered':_0x042f('0x9'),'wrandom':_0x042f('0xa')};function VoiceQueue(_0x225e13){this['id']=_0x225e13['id']||0x0;this[_0x042f('0xb')]=_0x225e13[_0x042f('0xb')]||'';this[_0x042f('0xc')]=_0x225e13['monitor_format']||'';this[_0x042f('0xd')]=_0x225e13[_0x042f('0xd')]||'inbound';this['waiting']=0x0;this[_0x042f('0xe')]=0x0;this['answered']=0x0;this[_0x042f('0xf')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x042f('0x10')]=0x0;this[_0x042f('0x11')]=0x0;this[_0x042f('0x12')]=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0x042f('0x13')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0x042f('0x14')]=0x0;this[_0x042f('0x15')]=0x0;this[_0x042f('0x16')]=0x0;this[_0x042f('0x17')]=0x0;this[_0x042f('0x18')]=0x0;this['unavailable']=0x0;this[_0x042f('0x19')]=0x0;this[_0x042f('0x1a')]=_0x225e13[_0x042f('0x1a')]||![];this['acwTimeout']=_0x225e13[_0x042f('0x1b')]||0xa;this['autopause']=_0x225e13[_0x042f('0x1c')]||'no';this[_0x042f('0x1d')]=!![];this[_0x042f('0x1e')]='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this[_0x042f('0x1f')]=_0x225e13[_0x042f('0x1f')]||null;this[_0x042f('0x20')]=_0x225e13[_0x042f('0x20')]?_0x225e13[_0x042f('0x20')]:null;this[_0x042f('0x21')]=_0x225e13[_0x042f('0x21')];this[_0x042f('0x22')]=_0x225e13[_0x042f('0x22')]||_0x042f('0x23');this['dialLimitChannel']=_0x225e13['dialLimitChannel']||0x0;this[_0x042f('0x24')]=_0x225e13['dialLimitQueue']||0x0;this[_0x042f('0x25')]=_0x225e13[_0x042f('0x25')]||0x1;this[_0x042f('0x26')]=_0x225e13[_0x042f('0x26')]||_0x042f('0x27');this[_0x042f('0x28')]=_0x225e13[_0x042f('0x28')]||0.03;this['dialPredictiveInterval']=_0x225e13[_0x042f('0x29')]||0x258;this[_0x042f('0x2a')]=_0x225e13[_0x042f('0x2a')]||_0x042f('0x2b');this['dialOriginateCallerIdNumber']=_0x225e13[_0x042f('0x2c')]||_0x042f('0x2b');this[_0x042f('0x2d')]=_0x225e13[_0x042f('0x2d')]||0x1e;this['dialQueueOptions']=_0x225e13[_0x042f('0x2e')]||_0x042f('0x2f');this['dialQueueTimeout']=_0x225e13[_0x042f('0x30')]||0x3;this['dialQueueProject']=_0x225e13[_0x042f('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x225e13['dialCongestionMaxRetry']||0x3;this[_0x042f('0x32')]=_0x225e13[_0x042f('0x32')]||0x96;this[_0x042f('0x33')]=_0x225e13['dialBusyMaxRetry']||0x3;this[_0x042f('0x34')]=_0x225e13[_0x042f('0x34')]||0x96;this[_0x042f('0x35')]=_0x225e13['dialNoAnswerMaxRetry']||0x3;this[_0x042f('0x36')]=_0x225e13[_0x042f('0x36')]||0x96;this[_0x042f('0x37')]=_0x225e13[_0x042f('0x37')]||0x3;this[_0x042f('0x38')]=_0x225e13[_0x042f('0x38')]||0x96;this['dialDropMaxRetry']=_0x225e13[_0x042f('0x39')]||0x3;this[_0x042f('0x3a')]=_0x225e13[_0x042f('0x3a')]||0x96;this[_0x042f('0x3b')]=_0x225e13['dialAbandonedMaxRetry']||0x3;this[_0x042f('0x3c')]=_0x225e13[_0x042f('0x3c')]||0x96;this['dialMachineMaxRetry']=_0x225e13[_0x042f('0x3d')]||0x3;this[_0x042f('0x3e')]=_0x225e13[_0x042f('0x3e')]||0x96;this[_0x042f('0x3f')]=_0x225e13[_0x042f('0x3f')]||0x3;this[_0x042f('0x40')]=_0x225e13[_0x042f('0x40')]||0x96;this['callAdditionalPhoneAfterMin']=_0x225e13[_0x042f('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x225e13[_0x042f('0x42')]||0x4;this[_0x042f('0x43')]=_0x225e13[_0x042f('0x43')]?_0x225e13[_0x042f('0x43')]:undefined;this['TrunkBackup']=_0x225e13[_0x042f('0x44')]?_0x225e13[_0x042f('0x44')]:undefined;this[_0x042f('0x45')]=_0x225e13[_0x042f('0x45')]||undefined;this['Interval']=_0x225e13[_0x042f('0x46')]?_0x225e13[_0x042f('0x46')]:undefined;this[_0x042f('0x47')]=_0x225e13[_0x042f('0x47')]||_0x042f('0x48');this[_0x042f('0x49')]=_0x225e13[_0x042f('0x49')]||undefined;this[_0x042f('0x4a')]=_0x225e13[_0x042f('0x4a')]||undefined;this['strategy']=strategy[_0x225e13['strategy']];this[_0x042f('0x4b')]=!![];this['dialAMDActive']=_0x225e13[_0x042f('0x4c')]||![];this['dialAMDInitialSilence']=_0x225e13[_0x042f('0x4d')];this['dialAMDGreeting']=_0x225e13[_0x042f('0x4e')];this[_0x042f('0x4f')]=_0x225e13[_0x042f('0x4f')];this[_0x042f('0x50')]=_0x225e13['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x225e13[_0x042f('0x51')];this[_0x042f('0x52')]=_0x225e13[_0x042f('0x52')];this[_0x042f('0x53')]=_0x225e13[_0x042f('0x53')];this[_0x042f('0x54')]=_0x225e13[_0x042f('0x54')];this[_0x042f('0x55')]=_0x225e13[_0x042f('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x042f('0x56')]=0x0;this[_0x042f('0x57')]=_0x225e13['timeout'];this[_0x042f('0x58')]=0x0;this[_0x042f('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x042f('0x5a')]=0x0;this[_0x042f('0x5b')]=0x0;this[_0x042f('0x5c')]=0x0;this[_0x042f('0x5d')]=0x0;this[_0x042f('0x5e')]=0x0;this[_0x042f('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x042f('0x60')]=0x0;this[_0x042f('0x61')]=0x0;this[_0x042f('0x62')]=0x0;this[_0x042f('0x63')]=0x0;this[_0x042f('0x64')]=undefined;this['startPredictive']=undefined;this[_0x042f('0x65')]=undefined;this[_0x042f('0x66')]=1.05;this[_0x042f('0x67')]=0x0;this[_0x042f('0x68')]=0x0;this[_0x042f('0x69')]=0x0;this[_0x042f('0x6a')]=0x0;this[_0x042f('0x6b')]=0x0;this[_0x042f('0x6c')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x042f('0x6d')]=0x0;this[_0x042f('0x6e')]=_0x225e13['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x042f('0x6f')]=_0x225e13['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x042f('0x70')]=0x0;this[_0x042f('0x71')]=0x0;this[_0x042f('0x72')]=0x1;this[_0x042f('0x73')]=0x0;this['erlangCallToSecond']=0x0;this[_0x042f('0x74')]=0x0;this[_0x042f('0x75')]=0x0;this[_0x042f('0x76')]=_0x225e13['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x225e13[_0x042f('0x77')]||![];this[_0x042f('0x78')]=!!_0x225e13[_0x042f('0x78')]||![];this[_0x042f('0x79')]=!!_0x225e13[_0x042f('0x79')]||![];this[_0x042f('0x7a')]=_0x225e13['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x225e13[_0x042f('0x7b')]||![];this[_0x042f('0x7c')]=_0x225e13[_0x042f('0x7c')]||![];this[_0x042f('0xc')]=monitorFormat[_0x225e13[_0x042f('0xc')]]?monitorFormat[_0x225e13[_0x042f('0xc')]]:undefined;this['mandatoryDisposition']=_0x225e13[_0x042f('0x7d')]||![];this[_0x042f('0x7e')]=_0x225e13['mandatoryDispositionPause']?_0x225e13[_0x042f('0x7e')]:undefined;this[_0x042f('0x7f')]=![];}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 edc9f8e..90e66f5 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 _0xc7a3=['Trunk','callerid','callers','length','SIP/','online','incall','status','keys','queue','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','active','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage'];(function(_0x39fc84,_0x3a0de1){var _0x1f63c1=function(_0x2dec07){while(--_0x2dec07){_0x39fc84['push'](_0x39fc84['shift']());}};_0x1f63c1(++_0x3a0de1);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x4a06cd,_0x4fe30a){_0x4a06cd=_0x4a06cd-0x0;var _0x123359=_0xc7a3[_0x4a06cd];return _0x123359;};'use strict';var INBOUND_COUNTERS=['available',_0x3c7a('0x0'),_0x3c7a('0x1'),_0x3c7a('0x2'),_0x3c7a('0x3'),_0x3c7a('0x4'),_0x3c7a('0x5')];var OUTBOUND_COUNTERS=['available',_0x3c7a('0x6'),_0x3c7a('0x7'),'loggedIn',_0x3c7a('0x1'),_0x3c7a('0x8'),_0x3c7a('0x9'),'outboundAnswerCallsDay',_0x3c7a('0xa'),'outboundBusyCallsDay',_0x3c7a('0xb'),'outboundNoAnswerCallsDay',_0x3c7a('0xc'),_0x3c7a('0xd'),_0x3c7a('0xe'),'outboundUnknownCallsDay',_0x3c7a('0x2'),_0x3c7a('0xf'),'talking',_0x3c7a('0x10'),'sumDuration',_0x3c7a('0x11'),'waiting'];function VoiceQueueSummary(_0xfd069f){this['id']=_0xfd069f['id'];this[_0x3c7a('0x12')]=_0xfd069f[_0x3c7a('0x12')];this[_0x3c7a('0x13')]=_0xfd069f[_0x3c7a('0x13')];this['abandoned']=_0xfd069f[_0x3c7a('0x14')]||0x0;this[_0x3c7a('0x6')]=_0xfd069f[_0x3c7a('0x6')]||0x0;this[_0x3c7a('0x15')]=_0xfd069f[_0x3c7a('0x15')]||0x0;this['busy']=_0xfd069f[_0x3c7a('0x16')]||0x0;this[_0x3c7a('0x7')]=_0xfd069f['inUse']||0x0;this['invalid']=_0xfd069f[_0x3c7a('0x17')]||0x0;this[_0x3c7a('0x0')]=_0xfd069f[_0x3c7a('0x0')]||0x0;this['loggedInDb']=_0xfd069f[_0x3c7a('0x1')]||0x0;this['onHold']=_0xfd069f[_0x3c7a('0x18')]||0x0;this[_0x3c7a('0x19')]=_0xfd069f[_0x3c7a('0x19')]||0x0;this[_0x3c7a('0x2')]=_0xfd069f[_0x3c7a('0x2')]||0x0;this[_0x3c7a('0x3')]=_0xfd069f['ringing']||0x0;this[_0x3c7a('0x1a')]=_0xfd069f[_0x3c7a('0x1a')];this[_0x3c7a('0x10')]=_0xfd069f[_0x3c7a('0x10')];this[_0x3c7a('0x1b')]=_0xfd069f[_0x3c7a('0x1b')];this[_0x3c7a('0x1c')]=_0xfd069f[_0x3c7a('0x1c')]||0x0;this[_0x3c7a('0x4')]=_0xfd069f['talking']||0x0;this[_0x3c7a('0x11')]=_0xfd069f['total']||0x0;this[_0x3c7a('0x1d')]=_0xfd069f['type'];this[_0x3c7a('0x1e')]=_0xfd069f[_0x3c7a('0x1e')]||0x0;this[_0x3c7a('0x1f')]=_0xfd069f[_0x3c7a('0x1f')]||0x0;this[_0x3c7a('0x20')]=_0xfd069f[_0x3c7a('0x20')]||0x0;this[_0x3c7a('0x5')]=_0xfd069f[_0x3c7a('0x5')]||0x0;if(_0xfd069f[_0x3c7a('0x1d')]===_0x3c7a('0x21')){this[_0x3c7a('0xf')]=_0xfd069f[_0x3c7a('0xf')]||0x0;this['dialActive']=_0xfd069f[_0x3c7a('0x22')];this[_0x3c7a('0x23')]=_0xfd069f[_0x3c7a('0x23')];this[_0x3c7a('0x24')]=_0xfd069f[_0x3c7a('0x24')];this[_0x3c7a('0x25')]=_0xfd069f[_0x3c7a('0x25')];this[_0x3c7a('0x26')]=_0xfd069f['dialOriginateTimeout'];this[_0x3c7a('0x27')]=_0xfd069f[_0x3c7a('0x27')];this[_0x3c7a('0x28')]=_0xfd069f[_0x3c7a('0x28')];this[_0x3c7a('0x29')]=_0xfd069f[_0x3c7a('0x29')];this[_0x3c7a('0x2a')]=_0xfd069f[_0x3c7a('0x2a')];this[_0x3c7a('0xa')]=_0xfd069f[_0x3c7a('0xa')];this[_0x3c7a('0x2b')]=_0xfd069f[_0x3c7a('0x2b')];this[_0x3c7a('0xb')]=_0xfd069f[_0x3c7a('0xb')];this[_0x3c7a('0x2c')]=_0xfd069f[_0x3c7a('0x2c')];this[_0x3c7a('0x2d')]=_0xfd069f[_0x3c7a('0x2d')];this[_0x3c7a('0x2e')]=_0xfd069f[_0x3c7a('0x2e')];this[_0x3c7a('0x2f')]=_0xfd069f[_0x3c7a('0x2f')];this['outboundNoSuchCallsDay']=_0xfd069f['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0xfd069f['outboundOriginateFailureCallsDay'];this[_0x3c7a('0xd')]=_0xfd069f[_0x3c7a('0xd')];this[_0x3c7a('0xe')]=_0xfd069f[_0x3c7a('0xe')];this[_0x3c7a('0x30')]=_0xfd069f[_0x3c7a('0x30')];this[_0x3c7a('0x31')]=_0xfd069f[_0x3c7a('0x31')];this[_0x3c7a('0x32')]=_0xfd069f[_0x3c7a('0x32')];this[_0x3c7a('0x33')]=_0xfd069f[_0x3c7a('0x33')];this[_0x3c7a('0x34')]=_0xfd069f[_0x3c7a('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0xfd069f[_0x3c7a('0x35')];this[_0x3c7a('0x36')]=_0xfd069f['predictiveIntervalErlangCalls'];this[_0x3c7a('0x37')]=_0xfd069f['predictiveIntervalErlangCallsDroppedCalls'];this[_0x3c7a('0x38')]=_0xfd069f[_0x3c7a('0x38')];this['predictiveIntervalMultiplicativeFactor']=_0xfd069f[_0x3c7a('0x39')];this[_0x3c7a('0x3a')]=_0xfd069f[_0x3c7a('0x3a')];this[_0x3c7a('0x3b')]=_0xfd069f[_0x3c7a('0x3b')];this[_0x3c7a('0x3c')]=_0xfd069f[_0x3c7a('0x3c')];this[_0x3c7a('0x8')]=_0xfd069f[_0x3c7a('0x8')];this[_0x3c7a('0x3d')]=_0xfd069f['erlangCalls'];this[_0x3c7a('0x3e')]=_0xfd069f[_0x3c7a('0x3e')];this[_0x3c7a('0x3f')]=_0xfd069f[_0x3c7a('0x3f')];this[_0x3c7a('0x40')]=_0xfd069f[_0x3c7a('0x40')];this[_0x3c7a('0x41')]=_0xfd069f[_0x3c7a('0x41')];this['startProgressive']=_0xfd069f[_0x3c7a('0x42')];this[_0x3c7a('0x43')]=_0xfd069f['message'];this[_0x3c7a('0x44')]=_0xfd069f['statusMessage'];}if(_0xfd069f['Trunk']){this['Trunk']={'id':_0xfd069f['Trunk']['id'],'name':_0xfd069f[_0x3c7a('0x45')][_0x3c7a('0x12')],'active':_0xfd069f[_0x3c7a('0x45')]['active'],'callerid':_0xfd069f[_0x3c7a('0x45')][_0x3c7a('0x46')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0x491335,_0x2a68d5,_0x15d7fe,_0x22c7c7){this[_0x3c7a('0x1')]=0x0;this[_0x3c7a('0x4')]=0x0;this[_0x3c7a('0x2')]=0x0;this[_0x3c7a('0x1f')]=0x0;this[_0x3c7a('0x19')]=0x0;this[_0x3c7a('0x7')]=0x0;this[_0x3c7a('0x16')]=0x0;this[_0x3c7a('0x17')]=0x0;this[_0x3c7a('0x1e')]=0x0;this[_0x3c7a('0x3')]=0x0;this[_0x3c7a('0x1a')]=0x0;this[_0x3c7a('0x18')]=0x0;if(_0x15d7fe){if(_0x15d7fe['available']){this[_0x3c7a('0x15')]=Number(_0x15d7fe[_0x3c7a('0x15')]);}if(_0x15d7fe['loggedin']){this['loggedIn']=Number(_0x15d7fe['loggedin']);}if(_0x15d7fe[_0x3c7a('0x47')]){this[_0x3c7a('0x5')]=Number(_0x15d7fe[_0x3c7a('0x47')]);}}for(var _0x84e2b5=0x0;_0x84e2b5<_0x491335[_0x3c7a('0x48')];_0x84e2b5++){var _0x321b1b=_0x2a68d5[_0x3c7a('0x49')+_0x491335[_0x84e2b5][_0x3c7a('0x12')]];if(_0x321b1b&&_0x321b1b[_0x3c7a('0x4a')]){this[_0x3c7a('0x1')]+=0x1;}if(_0x491335[_0x84e2b5][_0x3c7a('0x4b')]==='1'){this['talking']+=0x1;}if(_0x491335[_0x84e2b5]['paused']==='1'&&!['2','7','8']['includes'](_0x491335[_0x84e2b5][_0x3c7a('0x4c')])){this[_0x3c7a('0x2')]+=0x1;}switch(_0x491335[_0x84e2b5][_0x3c7a('0x4c')]){case'0':this[_0x3c7a('0x1f')]+=0x1;break;case'1':this[_0x3c7a('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x3c7a('0x16')]+=0x1;break;case'4':this[_0x3c7a('0x17')]+=0x1;break;case'5':this[_0x3c7a('0x1e')]+=0x1;break;case'6':this[_0x3c7a('0x3')]+=0x1;break;case'7':this[_0x3c7a('0x1a')]+=0x1;break;case'8':this[_0x3c7a('0x18')]+=0x1;break;}}if(this[_0x3c7a('0x23')]==='booked'){var _0x519831=Object[_0x3c7a('0x4d')](_0x22c7c7);for(var _0x350ea7=0x0;_0x350ea7<_0x519831[_0x3c7a('0x48')];_0x350ea7++){var _0xf57f2=_0x519831[_0x350ea7];var _0xf607f3=_0x22c7c7[_0xf57f2];if(_0xf607f3[_0x3c7a('0x4e')]===this['name']&&_0xf607f3[_0x3c7a('0x1d')]==='dialer'&&_0xf607f3['exten']===_0x3c7a('0x4f')){this[_0x3c7a('0x4')]+=0x1;}}if(this[_0x3c7a('0x4')]>this['inUse']){this['talking']=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x3c7a('0x50')][_0x3c7a('0x51')]=function(_0x3c22c6){var _0x1a26ed=![];if(_0x3c22c6){_0x1a26ed=INBOUND_COUNTERS[_0x3c7a('0x52')](function(_0x11f7ee){return this[_0x11f7ee]!==_0x3c22c6[_0x11f7ee];},this);}return _0x1a26ed;};VoiceQueueSummary[_0x3c7a('0x50')][_0x3c7a('0x53')]=function(_0x3f5656){var _0x118c9c=![];var _0x46360d=![];var _0x433cca=![];if(_0x3f5656){_0x118c9c=this[_0x3c7a('0x23')]!==_0x3f5656[_0x3c7a('0x23')]||this[_0x3c7a('0x22')]!==_0x3f5656['dialActive']||this['message']!==_0x3f5656['message']||this['statusMessage']!==_0x3f5656['statusMessage'];_0x46360d=OUTBOUND_COUNTERS[_0x3c7a('0x52')](function(_0x4e4995){return this[_0x4e4995]!==_0x3f5656[_0x4e4995];},this);if(this[_0x3c7a('0x45')]&&_0x3f5656[_0x3c7a('0x45')]){_0x433cca=this['Trunk'][_0x3c7a('0x12')]!==_0x3f5656['Trunk']['name']||this[_0x3c7a('0x45')][_0x3c7a('0x54')]!==_0x3f5656[_0x3c7a('0x45')]['active'];}}return _0x118c9c||_0x46360d||_0x433cca;};VoiceQueueSummary[_0x3c7a('0x50')]['updateReportFromOutboundQueue']=function(_0x1e29e0){this['answered']=_0x1e29e0[_0x3c7a('0x6')];this[_0x3c7a('0x43')]=_0x1e29e0['message'];this[_0x3c7a('0x44')]=_0x1e29e0[_0x3c7a('0x44')];this[_0x3c7a('0x8')]=_0x1e29e0[_0x3c7a('0x8')];this[_0x3c7a('0x9')]=_0x1e29e0[_0x3c7a('0x9')];this[_0x3c7a('0x2a')]=_0x1e29e0['outboundAnswerCallsDay'];this[_0x3c7a('0xa')]=_0x1e29e0[_0x3c7a('0xa')];this['outboundBusyCallsDay']=_0x1e29e0[_0x3c7a('0x2b')];this['outboundCongestionCallsDay']=_0x1e29e0[_0x3c7a('0xb')];this[_0x3c7a('0x2f')]=_0x1e29e0['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x1e29e0[_0x3c7a('0xc')];this[_0x3c7a('0xd')]=_0x1e29e0['outboundReCallsDay'];this[_0x3c7a('0xe')]=_0x1e29e0[_0x3c7a('0xe')];this[_0x3c7a('0x30')]=_0x1e29e0[_0x3c7a('0x30')];this['sumBillable']=_0x1e29e0[_0x3c7a('0x10')];this['sumDuration']=_0x1e29e0[_0x3c7a('0x1b')];this[_0x3c7a('0x11')]=_0x1e29e0['total'];if(this['dialMethod']==='preview'){this[_0x3c7a('0xf')]=_0x1e29e0[_0x3c7a('0xf')];}};module[_0x3c7a('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0xac21=['available','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','talking','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','booked','keys','queue','some','compareToOutboundQueue','active','outboundNoAnswerCallsDay','preview','exports','loggedIn','loggedInDb','ringing','waiting'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xac21,0x1af));var _0x1ac2=function(_0x123892,_0x2ae90b){_0x123892=_0x123892-0x0;var _0x5d47db=_0xac21[_0x123892];return _0x5d47db;};'use strict';var INBOUND_COUNTERS=['available',_0x1ac2('0x0'),_0x1ac2('0x1'),'paused',_0x1ac2('0x2'),'talking',_0x1ac2('0x3')];var OUTBOUND_COUNTERS=[_0x1ac2('0x4'),'answered',_0x1ac2('0x5'),'loggedIn',_0x1ac2('0x1'),_0x1ac2('0x6'),_0x1ac2('0x7'),_0x1ac2('0x8'),_0x1ac2('0x9'),_0x1ac2('0xa'),_0x1ac2('0xb'),'outboundNoAnswerCallsDay',_0x1ac2('0xc'),_0x1ac2('0xd'),_0x1ac2('0xe'),_0x1ac2('0xf'),_0x1ac2('0x10'),_0x1ac2('0x11'),'talking',_0x1ac2('0x12'),_0x1ac2('0x13'),_0x1ac2('0x14'),_0x1ac2('0x3')];function VoiceQueueSummary(_0x405ca6){this['id']=_0x405ca6['id'];this[_0x1ac2('0x15')]=_0x405ca6['name'];this[_0x1ac2('0x16')]=_0x405ca6[_0x1ac2('0x16')];this[_0x1ac2('0x17')]=_0x405ca6[_0x1ac2('0x17')]||0x0;this[_0x1ac2('0x18')]=_0x405ca6[_0x1ac2('0x18')]||0x0;this[_0x1ac2('0x4')]=_0x405ca6[_0x1ac2('0x4')]||0x0;this[_0x1ac2('0x19')]=_0x405ca6['busy']||0x0;this[_0x1ac2('0x5')]=_0x405ca6[_0x1ac2('0x5')]||0x0;this[_0x1ac2('0x1a')]=_0x405ca6[_0x1ac2('0x1a')]||0x0;this[_0x1ac2('0x0')]=_0x405ca6[_0x1ac2('0x0')]||0x0;this[_0x1ac2('0x1')]=_0x405ca6[_0x1ac2('0x1')]||0x0;this['onHold']=_0x405ca6[_0x1ac2('0x1b')]||0x0;this[_0x1ac2('0x1c')]=_0x405ca6['notInUse']||0x0;this[_0x1ac2('0x10')]=_0x405ca6[_0x1ac2('0x10')]||0x0;this['ringing']=_0x405ca6[_0x1ac2('0x2')]||0x0;this['ringInUse']=_0x405ca6[_0x1ac2('0x1d')];this[_0x1ac2('0x12')]=_0x405ca6['sumBillable'];this[_0x1ac2('0x13')]=_0x405ca6[_0x1ac2('0x13')];this[_0x1ac2('0x1e')]=_0x405ca6[_0x1ac2('0x1e')]||0x0;this[_0x1ac2('0x1f')]=_0x405ca6[_0x1ac2('0x1f')]||0x0;this[_0x1ac2('0x14')]=_0x405ca6[_0x1ac2('0x14')]||0x0;this[_0x1ac2('0x20')]=_0x405ca6[_0x1ac2('0x20')];this[_0x1ac2('0x21')]=_0x405ca6['unavailable']||0x0;this[_0x1ac2('0x22')]=_0x405ca6[_0x1ac2('0x22')]||0x0;this[_0x1ac2('0x23')]=_0x405ca6[_0x1ac2('0x23')]||0x0;this[_0x1ac2('0x3')]=_0x405ca6[_0x1ac2('0x3')]||0x0;if(_0x405ca6['type']===_0x1ac2('0x24')){this[_0x1ac2('0x11')]=_0x405ca6[_0x1ac2('0x11')]||0x0;this[_0x1ac2('0x25')]=_0x405ca6[_0x1ac2('0x25')];this['dialMethod']=_0x405ca6[_0x1ac2('0x26')];this[_0x1ac2('0x27')]=_0x405ca6[_0x1ac2('0x27')];this[_0x1ac2('0x28')]=_0x405ca6[_0x1ac2('0x28')];this['dialOriginateTimeout']=_0x405ca6[_0x1ac2('0x29')];this[_0x1ac2('0x2a')]=_0x405ca6['dialPrefix'];this[_0x1ac2('0x2b')]=_0x405ca6['temp'];this[_0x1ac2('0x2c')]=_0x405ca6[_0x1ac2('0x2c')];this[_0x1ac2('0x8')]=_0x405ca6['outboundAnswerCallsDay'];this[_0x1ac2('0x9')]=_0x405ca6['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x405ca6[_0x1ac2('0xa')];this[_0x1ac2('0xb')]=_0x405ca6[_0x1ac2('0xb')];this[_0x1ac2('0x2d')]=_0x405ca6[_0x1ac2('0x2d')];this[_0x1ac2('0x2e')]=_0x405ca6[_0x1ac2('0x2e')];this['outboundDropCallsDayTimeout']=_0x405ca6['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x405ca6['outboundNoAnswerCallsDay'];this[_0x1ac2('0xc')]=_0x405ca6[_0x1ac2('0xc')];this[_0x1ac2('0x2f')]=_0x405ca6['outboundOriginateFailureCallsDay'];this[_0x1ac2('0xd')]=_0x405ca6[_0x1ac2('0xd')];this['outboundRejectCallsDay']=_0x405ca6[_0x1ac2('0xe')];this[_0x1ac2('0xf')]=_0x405ca6['outboundUnknownCallsDay'];this[_0x1ac2('0x30')]=_0x405ca6[_0x1ac2('0x30')];this[_0x1ac2('0x31')]=_0x405ca6[_0x1ac2('0x31')];this[_0x1ac2('0x32')]=_0x405ca6['predictiveIntervalAvgTalktime'];this[_0x1ac2('0x33')]=_0x405ca6[_0x1ac2('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x405ca6[_0x1ac2('0x34')];this[_0x1ac2('0x35')]=_0x405ca6[_0x1ac2('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x405ca6[_0x1ac2('0x36')];this[_0x1ac2('0x37')]=_0x405ca6[_0x1ac2('0x37')];this[_0x1ac2('0x38')]=_0x405ca6[_0x1ac2('0x38')];this[_0x1ac2('0x39')]=_0x405ca6[_0x1ac2('0x39')];this[_0x1ac2('0x3a')]=_0x405ca6['predictiveIntervalAvailable'];this[_0x1ac2('0x3b')]=_0x405ca6[_0x1ac2('0x3b')];this['originated']=_0x405ca6[_0x1ac2('0x6')];this[_0x1ac2('0x3c')]=_0x405ca6[_0x1ac2('0x3c')];this[_0x1ac2('0x3d')]=_0x405ca6[_0x1ac2('0x3d')];this[_0x1ac2('0x3e')]=_0x405ca6[_0x1ac2('0x3e')];this[_0x1ac2('0x3f')]=_0x405ca6[_0x1ac2('0x3f')];this[_0x1ac2('0x40')]=_0x405ca6[_0x1ac2('0x40')];this[_0x1ac2('0x41')]=_0x405ca6['startProgressive'];this['message']=_0x405ca6[_0x1ac2('0x42')];this[_0x1ac2('0x43')]=_0x405ca6[_0x1ac2('0x43')];}if(_0x405ca6['Trunk']){this['Trunk']={'id':_0x405ca6[_0x1ac2('0x44')]['id'],'name':_0x405ca6[_0x1ac2('0x44')]['name'],'active':_0x405ca6['Trunk']['active'],'callerid':_0x405ca6[_0x1ac2('0x44')]['callerid']};}}VoiceQueueSummary[_0x1ac2('0x45')][_0x1ac2('0x46')]=function(_0x3c2538,_0x374419,_0x82b44,_0x36b42f){this['loggedInDb']=0x0;this[_0x1ac2('0x1f')]=0x0;this['paused']=0x0;this[_0x1ac2('0x22')]=0x0;this[_0x1ac2('0x1c')]=0x0;this[_0x1ac2('0x5')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x1ac2('0x21')]=0x0;this['ringing']=0x0;this[_0x1ac2('0x1d')]=0x0;this[_0x1ac2('0x1b')]=0x0;if(_0x82b44){if(_0x82b44['available']){this[_0x1ac2('0x4')]=Number(_0x82b44['available']);}if(_0x82b44[_0x1ac2('0x47')]){this['loggedIn']=Number(_0x82b44['loggedin']);}if(_0x82b44[_0x1ac2('0x48')]){this['waiting']=Number(_0x82b44[_0x1ac2('0x48')]);}}for(var _0x4df450=0x0;_0x4df450<_0x3c2538[_0x1ac2('0x49')];_0x4df450++){var _0x297a0c=_0x374419[_0x1ac2('0x4a')+_0x3c2538[_0x4df450][_0x1ac2('0x15')]];if(_0x297a0c&&_0x297a0c[_0x1ac2('0x4b')]){this[_0x1ac2('0x1')]+=0x1;}if(_0x3c2538[_0x4df450]['incall']==='1'){this[_0x1ac2('0x1f')]+=0x1;}if(_0x3c2538[_0x4df450][_0x1ac2('0x10')]==='1'&&!['2','7','8'][_0x1ac2('0x4c')](_0x3c2538[_0x4df450]['status'])){this[_0x1ac2('0x10')]+=0x1;}switch(_0x3c2538[_0x4df450][_0x1ac2('0x4d')]){case'0':this[_0x1ac2('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x1ac2('0x5')]+=0x1;break;case'3':this[_0x1ac2('0x19')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x1ac2('0x2')]+=0x1;break;case'7':this[_0x1ac2('0x1d')]+=0x1;break;case'8':this[_0x1ac2('0x1b')]+=0x1;break;}}if(this['dialMethod']===_0x1ac2('0x4e')){var _0x318d98=Object[_0x1ac2('0x4f')](_0x36b42f);for(var _0x39129d=0x0;_0x39129d<_0x318d98[_0x1ac2('0x49')];_0x39129d++){var _0x3e06e2=_0x318d98[_0x39129d];var _0x29527e=_0x36b42f[_0x3e06e2];if(_0x29527e[_0x1ac2('0x50')]===this[_0x1ac2('0x15')]&&_0x29527e[_0x1ac2('0x20')]==='dialer'&&_0x29527e['exten']==='xcally-motion-preview'){this[_0x1ac2('0x1f')]+=0x1;}}if(this[_0x1ac2('0x1f')]>this[_0x1ac2('0x5')]){this[_0x1ac2('0x1f')]=this[_0x1ac2('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x2acf50){var _0x1879ae=![];if(_0x2acf50){_0x1879ae=INBOUND_COUNTERS[_0x1ac2('0x51')](function(_0x1f153c){return this[_0x1f153c]!==_0x2acf50[_0x1f153c];},this);}return _0x1879ae;};VoiceQueueSummary['prototype'][_0x1ac2('0x52')]=function(_0x14d04a){var _0x56d721=![];var _0x411ab3=![];var _0x404be5=![];if(_0x14d04a){_0x56d721=this[_0x1ac2('0x26')]!==_0x14d04a[_0x1ac2('0x26')]||this['dialActive']!==_0x14d04a[_0x1ac2('0x25')]||this['message']!==_0x14d04a[_0x1ac2('0x42')]||this[_0x1ac2('0x43')]!==_0x14d04a['statusMessage'];_0x411ab3=OUTBOUND_COUNTERS[_0x1ac2('0x51')](function(_0x230e0e){return this[_0x230e0e]!==_0x14d04a[_0x230e0e];},this);if(this[_0x1ac2('0x44')]&&_0x14d04a[_0x1ac2('0x44')]){_0x404be5=this[_0x1ac2('0x44')][_0x1ac2('0x15')]!==_0x14d04a[_0x1ac2('0x44')][_0x1ac2('0x15')]||this[_0x1ac2('0x44')][_0x1ac2('0x53')]!==_0x14d04a['Trunk']['active'];}}return _0x56d721||_0x411ab3||_0x404be5;};VoiceQueueSummary[_0x1ac2('0x45')]['updateReportFromOutboundQueue']=function(_0x5ab826){this[_0x1ac2('0x18')]=_0x5ab826[_0x1ac2('0x18')];this[_0x1ac2('0x42')]=_0x5ab826[_0x1ac2('0x42')];this[_0x1ac2('0x43')]=_0x5ab826['statusMessage'];this[_0x1ac2('0x6')]=_0x5ab826[_0x1ac2('0x6')];this[_0x1ac2('0x7')]=_0x5ab826[_0x1ac2('0x7')];this[_0x1ac2('0x8')]=_0x5ab826[_0x1ac2('0x8')];this['outboundBlacklistCallsDay']=_0x5ab826[_0x1ac2('0x9')];this['outboundBusyCallsDay']=_0x5ab826['outboundBusyCallsDay'];this[_0x1ac2('0xb')]=_0x5ab826['outboundCongestionCallsDay'];this[_0x1ac2('0x54')]=_0x5ab826[_0x1ac2('0x54')];this['outboundNoSuchCallsDay']=_0x5ab826['outboundNoSuchCallsDay'];this[_0x1ac2('0xd')]=_0x5ab826[_0x1ac2('0xd')];this[_0x1ac2('0xe')]=_0x5ab826[_0x1ac2('0xe')];this[_0x1ac2('0xf')]=_0x5ab826[_0x1ac2('0xf')];this[_0x1ac2('0x12')]=_0x5ab826[_0x1ac2('0x12')];this[_0x1ac2('0x13')]=_0x5ab826['sumDuration'];this['total']=_0x5ab826[_0x1ac2('0x14')];if(this[_0x1ac2('0x26')]===_0x1ac2('0x55')){this[_0x1ac2('0x11')]=_0x5ab826[_0x1ac2('0x11')];}};module[_0x1ac2('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ff47880..d4ca014 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 _0x5033=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x323b64,_0x1df9f4){var _0x4a1135=function(_0x379338){while(--_0x379338){_0x323b64['push'](_0x323b64['shift']());}};_0x4a1135(++_0x1df9f4);}(_0x5033,0xa5));var _0x3503=function(_0x1c9bff,_0x276bcd){_0x1c9bff=_0x1c9bff-0x0;var _0x218e83=_0x5033[_0x1c9bff];return _0x218e83;};'use strict';function VtigerAccount(_0x3557f7){this['id']=_0x3557f7['id']||0x0;this[_0x3503('0x0')]=_0x3557f7[_0x3503('0x0')]||'';this['username']=_0x3557f7[_0x3503('0x1')]||'';this['accessKey']=_0x3557f7[_0x3503('0x2')]||'';this[_0x3503('0x3')]=_0x3557f7[_0x3503('0x3')]||'';this[_0x3503('0x4')]=_0x3557f7[_0x3503('0x4')]||'';this['Configurations']=_0x3557f7[_0x3503('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xd890=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x90b372,_0xd01696){var _0x4a5f5e=function(_0x9550e4){while(--_0x9550e4){_0x90b372['push'](_0x90b372['shift']());}};_0x4a5f5e(++_0xd01696);}(_0xd890,0x190));var _0x0d89=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xd890[_0x4c9380];return _0x49a523;};'use strict';function VtigerAccount(_0x3393a0){this['id']=_0x3393a0['id']||0x0;this['name']=_0x3393a0[_0x0d89('0x0')]||'';this[_0x0d89('0x1')]=_0x3393a0['username']||'';this[_0x0d89('0x2')]=_0x3393a0[_0x0d89('0x2')]||'';this[_0x0d89('0x3')]=_0x3393a0[_0x0d89('0x3')]||'';this['serverUrl']=_0x3393a0[_0x0d89('0x4')]||'';this[_0x0d89('0x5')]=_0x3393a0[_0x0d89('0x5')]||{};}module[_0x0d89('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 113fc7f..76b9ec5 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 _0xfe7b=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x9ea8db,_0x3fe379){var _0x3507e8=function(_0xa98679){while(--_0xa98679){_0x9ea8db['push'](_0x9ea8db['shift']());}};_0x3507e8(++_0x3fe379);}(_0xfe7b,0xb0));var _0xbfe7=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0xfe7b[_0x544072];return _0x590bf6;};'use strict';function ZendeskAccount(_0x558816){this['id']=_0x558816['id']||0x0;this[_0xbfe7('0x0')]=_0x558816[_0xbfe7('0x0')]||'';this[_0xbfe7('0x1')]=_0x558816[_0xbfe7('0x1')]||'';this['password']=_0x558816[_0xbfe7('0x2')]||'';this[_0xbfe7('0x3')]=_0x558816[_0xbfe7('0x3')]||'';this[_0xbfe7('0x4')]=_0x558816[_0xbfe7('0x4')]||'';this[_0xbfe7('0x5')]=_0x558816['authType']||'';this[_0xbfe7('0x6')]=_0x558816[_0xbfe7('0x6')]||_0xbfe7('0x7');this[_0xbfe7('0x8')]=_0x558816[_0xbfe7('0x8')]||'';this[_0xbfe7('0x9')]=_0x558816['Configurations']||{};}module[_0xbfe7('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xb96c=['authType','type','integrationTab','Configurations','exports','name','username','password','remoteUri'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0xb96c,0xf8));var _0xcb96=function(_0x18dd84,_0x5f2ba0){_0x18dd84=_0x18dd84-0x0;var _0x5e740c=_0xb96c[_0x18dd84];return _0x5e740c;};'use strict';function ZendeskAccount(_0x46295b){this['id']=_0x46295b['id']||0x0;this[_0xcb96('0x0')]=_0x46295b['name']||'';this[_0xcb96('0x1')]=_0x46295b['username']||'';this['password']=_0x46295b[_0xcb96('0x2')]||'';this['token']=_0x46295b['token']||'';this[_0xcb96('0x3')]=_0x46295b[_0xcb96('0x3')]||'';this['authType']=_0x46295b[_0xcb96('0x4')]||'';this[_0xcb96('0x5')]=_0x46295b[_0xcb96('0x5')]||_0xcb96('0x6');this['serverUrl']=_0x46295b['serverUrl']||'';this[_0xcb96('0x7')]=_0x46295b[_0xcb96('0x7')]||{};}module[_0xcb96('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 caa1f7a..4d8e37f 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 _0xb45d=['serverUrl','Configurations','name','description','zone','clientId','clientSecret'];(function(_0x269fb6,_0x551e65){var _0x5816f8=function(_0xbe7880){while(--_0xbe7880){_0x269fb6['push'](_0x269fb6['shift']());}};_0x5816f8(++_0x551e65);}(_0xb45d,0xa3));var _0xdb45=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0xb45d[_0xb6e43];return _0x47c40f;};'use strict';function ZohoAccount(_0x2b1908){this['id']=_0x2b1908['id']||0x0;this[_0xdb45('0x0')]=_0x2b1908[_0xdb45('0x0')]||'';this['description']=_0x2b1908[_0xdb45('0x1')]||'';this['host']=_0x2b1908['host']||'';this['zone']=_0x2b1908[_0xdb45('0x2')]||'';this['clientId']=_0x2b1908[_0xdb45('0x3')]||'';this['clientSecret']=_0x2b1908[_0xdb45('0x4')]||'';this[_0xdb45('0x5')]=_0x2b1908[_0xdb45('0x5')]||'';this['code']=_0x2b1908['code']||'';this['refreshToken']=_0x2b1908['refreshToken']||'';this[_0xdb45('0x6')]=_0x2b1908[_0xdb45('0x6')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x30f9=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x30f9,0x7e));var _0x930f=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0x30f9[_0x31b31b];return _0x2c8fc2;};'use strict';function ZohoAccount(_0x2ac04b){this['id']=_0x2ac04b['id']||0x0;this[_0x930f('0x0')]=_0x2ac04b['name']||'';this[_0x930f('0x1')]=_0x2ac04b[_0x930f('0x1')]||'';this[_0x930f('0x2')]=_0x2ac04b[_0x930f('0x2')]||'';this[_0x930f('0x3')]=_0x2ac04b['zone']||'';this[_0x930f('0x4')]=_0x2ac04b['clientId']||'';this[_0x930f('0x5')]=_0x2ac04b[_0x930f('0x5')]||'';this[_0x930f('0x6')]=_0x2ac04b[_0x930f('0x6')]||'';this[_0x930f('0x7')]=_0x2ac04b['code']||'';this['refreshToken']=_0x2ac04b[_0x930f('0x8')]||'';this['Configurations']=_0x2ac04b[_0x930f('0x9')]||{};}module[_0x930f('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 fe48743..3092b38 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 _0x8603=['prototype','getCaller','number','exports','lodash','moment','isNil','string','uniqueid','type','queue','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x5d299f,_0x165fa2){var _0x29e13f=function(_0x2c575d){while(--_0x2c575d){_0x5d299f['push'](_0x5d299f['shift']());}};_0x29e13f(++_0x165fa2);}(_0x8603,0x190));var _0x3860=function(_0xbf56e5,_0xc085e9){_0xbf56e5=_0xbf56e5-0x0;var _0x579e15=_0x8603[_0xbf56e5];return _0x579e15;};'use strict';var util=require('util');var _=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));function checkNameSurname(_0x96d2bc,_0x51bfda,_0x4961d6){var _0x2ebe8b='';if(!_[_0x3860('0x2')](_0x51bfda)&&_0x3860('0x3')===typeof _0x51bfda){_0x2ebe8b+=_0x51bfda;}if(!_['isNil'](_0x4961d6)&&_0x3860('0x3')===typeof _0x4961d6){_0x2ebe8b+='\x20'+_0x4961d6;}if(_0x2ebe8b!==''){return _0x2ebe8b;}return _0x96d2bc;}function Action(_0x56f8c5,_0xb0fc24,_0x40739b,_0x1eca44,_0xd3ce26){this[_0x3860('0x4')]=_0x40739b||undefined;this['idContact']=_0x56f8c5['id'];this['queue']=_0xb0fc24['name'];this[_0x3860('0x5')]=_0xb0fc24[_0x3860('0x5')];this['campaigntype']=_0x3860('0x6');this[_0x3860('0x7')]=![];this['membername']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?undefined:_0x56f8c5['Agent'][_0x3860('0x9')];this[_0x3860('0xa')]=this['membername']?util[_0x3860('0xb')](_0x3860('0xc'),this[_0x3860('0xd')]):_0x1eca44||undefined;this[_0x3860('0xe')]=checkNameSurname(_0x56f8c5[_0x3860('0xf')][_0x3860('0x10')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x11')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x12')]);this['active']=_0x56f8c5[_0x3860('0x13')]||![];this[_0x3860('0x14')]=_0x56f8c5[_0x3860('0x10')];this[_0x3860('0x15')]=_0x56f8c5[_0x3860('0x15')];this[_0x3860('0x16')]=_0x56f8c5[_0x3860('0x16')]||0x0;this[_0x3860('0x17')]=_0x56f8c5[_0x3860('0x17')]||0x0;this[_0x3860('0x18')]=_0x56f8c5[_0x3860('0x18')]||0x0;this[_0x3860('0x19')]=(_0x56f8c5['countbusyretry']||0x0)+(_0x56f8c5['countcongestionretry']||0x0)+(_0x56f8c5[_0x3860('0x18')]||0x0)+(_0x56f8c5[_0x3860('0x1a')]||0x0)+(_0x56f8c5[_0x3860('0x1b')]||0x0)+(_0x56f8c5['countabandonedretry']||0x0)+(_0x56f8c5[_0x3860('0x1c')]||0x0)+(_0x56f8c5[_0x3860('0x1d')]||0x0);this[_0x3860('0x1a')]=_0x56f8c5[_0x3860('0x1a')]||0x0;this[_0x3860('0x1b')]=_0x56f8c5[_0x3860('0x1b')]||0x0;this[_0x3860('0x1e')]=_0x56f8c5[_0x3860('0x1e')]||0x0;this[_0x3860('0x1c')]=_0x56f8c5[_0x3860('0x1c')]||0x0;this[_0x3860('0x1d')]=_0x56f8c5[_0x3860('0x1d')]||0x0;this[_0x3860('0x1f')]=_0x56f8c5[_0x3860('0x1f')];this[_0x3860('0x20')]=_0x56f8c5['callbackuniqueid'];this[_0x3860('0x21')]=_0x56f8c5[_0x3860('0x21')];this[_0x3860('0x22')]=_0x56f8c5[_0x3860('0x22')];this[_0x3860('0x23')]=_0x56f8c5['ContactId'];this[_0x3860('0x24')]=_0x56f8c5['ListId'];this['UserId']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?_0x56f8c5['UserId']:_0x56f8c5['Agent']['id'];this['VoiceQueueId']=_0x56f8c5[_0x3860('0x25')];this[_0x3860('0x26')]='';this[_0x3860('0x27')]='';}Action[_0x3860('0x28')][_0x3860('0x29')]=function(){return util[_0x3860('0xb')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x3860('0x2a')]);};module[_0x3860('0x2b')]=Action; \ No newline at end of file +var _0x5f66=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','lodash','isNil','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var util=require('util');var _=require(_0x65f6('0x0'));var moment=require('moment');function checkNameSurname(_0x2d5fd9,_0x2f06ae,_0x3461cd){var _0xbce843='';if(!_[_0x65f6('0x1')](_0x2f06ae)&&'string'===typeof _0x2f06ae){_0xbce843+=_0x2f06ae;}if(!_[_0x65f6('0x1')](_0x3461cd)&&'string'===typeof _0x3461cd){_0xbce843+='\x20'+_0x3461cd;}if(_0xbce843!==''){return _0xbce843;}return _0x2d5fd9;}function Action(_0x1c9f5b,_0x22b017,_0x4ec221,_0x4ed98f,_0x1c0e12){this[_0x65f6('0x2')]=_0x4ec221||undefined;this[_0x65f6('0x3')]=_0x1c9f5b['id'];this[_0x65f6('0x4')]=_0x22b017[_0x65f6('0x5')];this[_0x65f6('0x6')]=_0x22b017['type'];this['campaigntype']=_0x65f6('0x4');this[_0x65f6('0x7')]=![];this[_0x65f6('0x8')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?undefined:_0x1c9f5b[_0x65f6('0x9')]['name'];this['channelAgent']=this[_0x65f6('0x8')]?util['format'](_0x65f6('0xa'),this['membername']):_0x4ed98f||undefined;this[_0x65f6('0xb')]=checkNameSurname(_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xd')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xe')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xf')]);this[_0x65f6('0x10')]=_0x1c9f5b[_0x65f6('0x10')]||![];this[_0x65f6('0x11')]=_0x1c9f5b['phone'];this[_0x65f6('0x12')]=_0x1c9f5b['scheduledat'];this['countbusyretry']=_0x1c9f5b[_0x65f6('0x13')]||0x0;this[_0x65f6('0x14')]=_0x1c9f5b[_0x65f6('0x14')]||0x0;this[_0x65f6('0x15')]=_0x1c9f5b[_0x65f6('0x15')]||0x0;this[_0x65f6('0x16')]=(_0x1c9f5b[_0x65f6('0x13')]||0x0)+(_0x1c9f5b[_0x65f6('0x14')]||0x0)+(_0x1c9f5b['countnoanswerretry']||0x0)+(_0x1c9f5b['countnosuchnumberretry']||0x0)+(_0x1c9f5b[_0x65f6('0x17')]||0x0)+(_0x1c9f5b['countabandonedretry']||0x0)+(_0x1c9f5b['countmachineretry']||0x0)+(_0x1c9f5b['countagentrejectretry']||0x0);this[_0x65f6('0x18')]=_0x1c9f5b[_0x65f6('0x18')]||0x0;this['countdropretry']=_0x1c9f5b[_0x65f6('0x17')]||0x0;this[_0x65f6('0x19')]=_0x1c9f5b[_0x65f6('0x19')]||0x0;this[_0x65f6('0x1a')]=_0x1c9f5b[_0x65f6('0x1a')]||0x0;this[_0x65f6('0x1b')]=_0x1c9f5b['countagentrejectretry']||0x0;this[_0x65f6('0x1c')]=_0x1c9f5b['callback'];this['callbackuniqueid']=_0x1c9f5b[_0x65f6('0x1d')];this[_0x65f6('0x1e')]=_0x1c9f5b['callbackat'];this[_0x65f6('0x1f')]=_0x1c9f5b[_0x65f6('0x1f')];this[_0x65f6('0x20')]=_0x1c9f5b[_0x65f6('0x20')];this['ListId']=_0x1c9f5b[_0x65f6('0x21')];this[_0x65f6('0x22')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?_0x1c9f5b['UserId']:_0x1c9f5b['Agent']['id'];this[_0x65f6('0x23')]=_0x1c9f5b[_0x65f6('0x23')];this['originatecalleridnum']='';this[_0x65f6('0x24')]='';}Action[_0x65f6('0x25')]['getCaller']=function(){return util[_0x65f6('0x26')](_0x65f6('0x27'),this[_0x65f6('0xb')],this['number']);};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 8e47138..1a6f9cc 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x90025e,_0x1d05e4){var _0x4f9858=function(_0x36b521){while(--_0x36b521){_0x90025e['push'](_0x90025e['shift']());}};_0x4f9858(++_0x1d05e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4caf6c,_0x3ae883){var _0x51630e=function(_0x4f843f){while(--_0x4f843f){_0x4caf6c['push'](_0x4caf6c['shift']());}};_0x51630e(++_0x3ae883);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0d1086a..047e43a 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 _0x9347=['../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x9347,0x160));var _0x7934=function(_0x3521f6,_0x2676da){_0x3521f6=_0x3521f6-0x0;var _0x73d85c=_0x9347[_0x3521f6];return _0x73d85c;};'use strict';var util=require(_0x7934('0x0'));var BPromise=require('bluebird');var logger=require(_0x7934('0x1'))(_0x7934('0x2'));var cmHopper=require(_0x7934('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7934('0x4'));var agentReportPreview=require(_0x7934('0x5'));var voiceQueueReport=require(_0x7934('0x6'));function loggerCatch(_0x41cfa7){return function(_0xdf38d2){logger['error'](_0x41cfa7,util[_0x7934('0x7')](_0xdf38d2,{'showHidden':![],'depth':null}));};}function create(_0x94d84c){return cmHopperHistory[_0x7934('0x8')](_0x94d84c)[_0x7934('0x9')](loggerCatch(_0x7934('0xa')));}function createAgent(_0x2803ce){return BPromise['resolve']()[_0x7934('0xb')](agentReportPreview[_0x7934('0x8')](_0x2803ce))[_0x7934('0x9')](loggerCatch(_0x7934('0xa')));}function moveContact(_0x227156){return cmHopper[_0x7934('0xc')](_0x227156,!![])['catch'](loggerCatch(_0x7934('0xd')));}exports[_0x7934('0xe')]=function(_0xe93f15){return cmHopperBlack[_0x7934('0xe')](_0xe93f15)[_0x7934('0x9')](loggerCatch(_0x7934('0xf')));};exports[_0x7934('0x10')]=function(_0x4a9334){return BPromise[_0x7934('0x11')]()[_0x7934('0xb')](cmHopper[_0x7934('0x10')](_0x4a9334))[_0x7934('0x9')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x592af4,_0x40dbc1){create(_0x592af4)[_0x7934('0x9')](loggerCatch(_0x40dbc1));moveContact(_0x592af4)['catch'](loggerCatch(_0x40dbc1));};exports['createAgentHistory']=function(_0x465321,_0x12083d){createAgent(_0x465321)[_0x7934('0x9')](loggerCatch(_0x12083d));};exports['createCustomerHistory']=function(_0x327613,_0x1d67e9){create(_0x327613)[_0x7934('0x9')](loggerCatch(_0x1d67e9));};exports[_0x7934('0x12')]=function(_0x2e6bf4,_0x4787dc){moveContact(_0x2e6bf4)[_0x7934('0x9')](loggerCatch(_0x4787dc));};exports['rescheduleContact']=function(_0x3fb98e,_0x31cc86,_0xc2a535){if(_0x31cc86){_0x3fb98e['UserId']=null;}if(_0xc2a535){_0x3fb98e[_0x7934('0x13')]=![];}return cmHopper[_0x7934('0x14')](_0x3fb98e)['catch'](loggerCatch(_0x7934('0x15')));};exports[_0x7934('0x16')]=function(_0x54ff0f){return cmHopper['countReScheduled'](_0x54ff0f)[_0x7934('0x9')](loggerCatch(_0x7934('0x17')));};exports[_0x7934('0x18')]=function(_0x8c448){return cmHopper[_0x7934('0x18')]({'UserId':null},_0x8c448,0x1)['catch'](loggerCatch(_0x7934('0x19')));};exports[_0x7934('0x1a')]=function(_0x25ef2e){return cmHopper[_0x7934('0x18')]({'active':![]},_0x25ef2e,0x1)[_0x7934('0x9')](loggerCatch(_0x7934('0x1b')));};exports[_0x7934('0x1c')]=function(_0x394321){var _0x365e9a={};_0x365e9a[_0x7934('0x1d')]=_0x394321[_0x7934('0x1d')];_0x365e9a[_0x7934('0x1e')]=_0x394321['uniqueid'];_0x365e9a[_0x7934('0x1f')]=_0x394321[_0x7934('0x1f')];_0x365e9a[_0x7934('0x20')]=_0x394321['calleridname'];_0x365e9a[_0x7934('0x21')]=_0x394321['queue'];_0x365e9a[_0x7934('0x22')]=_0x394321[_0x7934('0x23')];_0x365e9a[_0x7934('0x24')]=_0x394321['answertime'];_0x365e9a[_0x7934('0x25')]=0x1;_0x365e9a[_0x7934('0x26')]=_0x394321[_0x7934('0x27')];_0x365e9a[_0x7934('0x28')]=_0x394321[_0x7934('0x29')];_0x365e9a['context']=_0x7934('0x2a');_0x365e9a[_0x7934('0x2b')]=_0x7934('0x2c');_0x365e9a['holdtime']=0x0;_0x365e9a[_0x7934('0x2d')]=0x1;_0x365e9a['lastAssignedTo']=_0x394321['membername'];_0x365e9a[_0x7934('0x2e')]=_0x7934('0x2f');return BPromise[_0x7934('0x11')]()[_0x7934('0xb')](voiceQueueReport['create'](_0x365e9a))[_0x7934('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x7934('0x30')]=function(_0x4d9d8b,_0x29f536){return BPromise[_0x7934('0x11')]()[_0x7934('0xb')](cmHopper[_0x7934('0x30')](_0x4d9d8b,_0x29f536))[_0x7934('0x9')](loggerCatch(_0x7934('0x31')));};exports[_0x7934('0x32')]=function(_0x279c9f){return cmHopper['rescheduleContact'](_0x279c9f,!![],!![])[_0x7934('0x9')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x59d0=['getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','then','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','error','catch','resolve','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20'];(function(_0x339767,_0x336f75){var _0x2e484e=function(_0x28451c){while(--_0x28451c){_0x339767['push'](_0x339767['shift']());}};_0x2e484e(++_0x336f75);}(_0x59d0,0x1ac));var _0x059d=function(_0x2ab00f,_0x42b2b3){_0x2ab00f=_0x2ab00f-0x0;var _0x3ea466=_0x59d0[_0x2ab00f];return _0x3ea466;};'use strict';var util=require(_0x059d('0x0'));var BPromise=require(_0x059d('0x1'));var logger=require('../../../config/logger')(_0x059d('0x2'));var cmHopper=require(_0x059d('0x3'));var cmHopperHistory=require(_0x059d('0x4'));var cmHopperBlack=require(_0x059d('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xcf8d3){return function(_0x779d4e){logger[_0x059d('0x6')](_0xcf8d3,util['inspect'](_0x779d4e,{'showHidden':![],'depth':null}));};}function create(_0x3aa567){return cmHopperHistory['createHistory'](_0x3aa567)[_0x059d('0x7')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x352ffc){return BPromise[_0x059d('0x8')]()['then'](agentReportPreview['createHistory'](_0x352ffc))['catch'](loggerCatch(_0x059d('0x9')));}function moveContact(_0x25483d){return cmHopper[_0x059d('0xa')](_0x25483d,!![])['catch'](loggerCatch(_0x059d('0xb')));}exports['checkIsBlackList']=function(_0x531990){return cmHopperBlack['checkIsBlackList'](_0x531990)['catch'](loggerCatch(_0x059d('0xc')));};exports[_0x059d('0xd')]=function(_0x2c0829){return BPromise[_0x059d('0x8')]()['then'](cmHopper['getContactPreview'](_0x2c0829))[_0x059d('0x7')](loggerCatch('[getContactPreview]\x20'));};exports[_0x059d('0xe')]=function(_0x33afde,_0x954b42){create(_0x33afde)[_0x059d('0x7')](loggerCatch(_0x954b42));moveContact(_0x33afde)[_0x059d('0x7')](loggerCatch(_0x954b42));};exports[_0x059d('0xf')]=function(_0x587711,_0x1290ca){createAgent(_0x587711)['catch'](loggerCatch(_0x1290ca));};exports[_0x059d('0x10')]=function(_0x50d9d8,_0x36d4d4){create(_0x50d9d8)[_0x059d('0x7')](loggerCatch(_0x36d4d4));};exports[_0x059d('0x11')]=function(_0x4fb972,_0x5b201d){moveContact(_0x4fb972)[_0x059d('0x7')](loggerCatch(_0x5b201d));};exports[_0x059d('0x12')]=function(_0xb3eab1,_0x50e392,_0x6f3b29){if(_0x50e392){_0xb3eab1['UserId']=null;}if(_0x6f3b29){_0xb3eab1[_0x059d('0x13')]=![];}return cmHopper[_0x059d('0x12')](_0xb3eab1)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x3fcafe){return cmHopper[_0x059d('0x14')](_0x3fcafe)[_0x059d('0x7')](loggerCatch(_0x059d('0x15')));};exports[_0x059d('0x16')]=function(_0x473758){return cmHopper['unlockContact']({'UserId':null},_0x473758,0x1)[_0x059d('0x7')](loggerCatch(_0x059d('0x17')));};exports[_0x059d('0x18')]=function(_0x47249f){return cmHopper['unlockContact']({'active':![]},_0x47249f,0x1)[_0x059d('0x7')](loggerCatch(_0x059d('0x19')));};exports['crateCustomerReportQueue']=function(_0x47b988){var _0x1f80fd={};_0x1f80fd[_0x059d('0x1a')]=_0x47b988[_0x059d('0x1a')];_0x1f80fd[_0x059d('0x1b')]=_0x47b988[_0x059d('0x1b')];_0x1f80fd[_0x059d('0x1c')]=_0x47b988[_0x059d('0x1c')];_0x1f80fd['calleridname']=_0x47b988['calleridname'];_0x1f80fd[_0x059d('0x1d')]=_0x47b988['queue'];_0x1f80fd[_0x059d('0x1e')]=_0x47b988[_0x059d('0x1f')];_0x1f80fd[_0x059d('0x20')]=_0x47b988['answertime'];_0x1f80fd[_0x059d('0x21')]=0x1;_0x1f80fd[_0x059d('0x22')]=_0x47b988[_0x059d('0x23')];_0x1f80fd['connectedlinename']=_0x47b988[_0x059d('0x24')];_0x1f80fd[_0x059d('0x25')]=_0x059d('0x26');_0x1f80fd[_0x059d('0x27')]='xcally-motion-preview';_0x1f80fd[_0x059d('0x28')]=0x0;_0x1f80fd[_0x059d('0x29')]=0x1;_0x1f80fd[_0x059d('0x2a')]=_0x47b988[_0x059d('0x24')];_0x1f80fd['queuecallerexitreason']=_0x059d('0x2b');return BPromise[_0x059d('0x8')]()['then'](voiceQueueReport[_0x059d('0x2c')](_0x1f80fd))[_0x059d('0x7')](loggerCatch(_0x059d('0x2d')));};exports['getContactRecallMe']=function(_0x57c1e9,_0x400bf0){return BPromise['resolve']()[_0x059d('0x2e')](cmHopper[_0x059d('0x2f')](_0x57c1e9,_0x400bf0))[_0x059d('0x7')](loggerCatch(_0x059d('0x30')));};exports['rescheduleContactInQueue']=function(_0x373f76){return cmHopper['rescheduleContact'](_0x373f76,!![],!![])[_0x059d('0x7')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 192725b..42cc2a1 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 _0xdbad=['moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','UserId','logCustomer','talktime','answertime','Failure','variablesAction','BOOKED','channelAgent','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ContactId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','buildObj','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','createBody','ListId','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash'];(function(_0x3e289b,_0x10e9a2){var _0x316c5d=function(_0x1c7d06){while(--_0x1c7d06){_0x3e289b['push'](_0x3e289b['shift']());}};_0x316c5d(++_0x10e9a2);}(_0xdbad,0x8f));var _0xddba=function(_0x234f79,_0x4302c9){_0x234f79=_0x234f79-0x0;var _0x4d3bb6=_0xdbad[_0x234f79];return _0x4d3bb6;};'use strict';var util=require(_0xddba('0x0'));var _=require(_0xddba('0x1'));var moment=require(_0xddba('0x2'));var logger=require(_0xddba('0x3'))(_0xddba('0x4'));var ipAgi=process[_0xddba('0x5')][_0xddba('0x6')]||_0xddba('0x7');var utils=require(_0xddba('0x8'));exports[_0xddba('0x9')]=function(_0x45b439){return function(_0x3c62ee){logger[_0xddba('0xa')](_0x45b439,util[_0xddba('0xb')](_0x3c62ee,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x23d48f,_0x2e30d9){logger[_0xddba('0xc')](_0x23d48f,util[_0xddba('0xb')](_0x2e30d9,{'showHidden':![],'depth':null}));};exports[_0xddba('0xd')]=function(_0x3083d4,_0x2bcc4a){logger['error'](_0x3083d4,util[_0xddba('0xb')](_0x2bcc4a,{'showHidden':![],'depth':null}));};exports[_0xddba('0xe')]=function(_0x233c4c){return function(_0x5d5c81){logger['info'](_0x233c4c,util[_0xddba('0xb')](_0x5d5c81,{'showHidden':![],'depth':null}));};};exports[_0xddba('0xf')]=function(_0x4a2eb0,_0x2eace0,_0x212351){return{'message':_0x4a2eb0,'unlock':_0x2eace0,'active':_0x212351};};exports['getCallerId']=function(_0x1c78b5,_0x3074f1,_0x53ef1d){if(!_[_0xddba('0x10')](_0x53ef1d)&&_0xddba('0x11')===typeof _0x53ef1d&&!_[_0xddba('0x12')](_0x53ef1d)){if(!_[_0xddba('0x10')](_0x3074f1)&&_0xddba('0x11')===typeof _0x3074f1&&!_[_0xddba('0x12')](_0x3074f1)){return util[_0xddba('0x13')](_0xddba('0x14'),_0x3074f1,_0x53ef1d);}return util['format'](_0xddba('0x14'),_0x53ef1d,_0x53ef1d);}if(!_['isUndefined'](_0x1c78b5)&&_0xddba('0x11')===typeof _0x1c78b5&&!_[_0xddba('0x12')](_0x1c78b5)){return _0x1c78b5;}return _0xddba('0x15');};exports['isActive']=function(_0x42de33){if(_[_0xddba('0x16')](_0x42de33)){return![];}return _0x42de33;};exports['addVariables']=function(_0x5232d5,_0x475944,_0x30a811,_0x16bbe4,_0x11c659,_0x1d3d07){var _0x121adb={'XMD-QUEUE':_0x475944[_0xddba('0x17')]?_0x475944['Queue'][_0xddba('0x18')]:'','XMD-CALLERID':_0x16bbe4,'XMD-CALLERID-PREVIEW':_0x1d3d07?util[_0xddba('0x13')]('\x22%s\x22\x20<%s>',_0x1d3d07[_0xddba('0x19')],_0x1d3d07[_0xddba('0x1a')]):_0x16bbe4,'XMD-DIALID':_0x11c659,'XMD-CONTACTID':_0x475944['ContactId'],'XMD-CDRTYPE':_0xddba('0x1b'),'CALLERID(all)':_0x16bbe4,'XMD-VOICEQUEUEID':_0x475944[_0xddba('0x1c')],'XMD-DIALCHANNEL':_0x30a811,'XMD-DIALTIMEOUT':_0x5232d5[_0xddba('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xddba('0x13')](_0xddba('0x1e'),_0x5232d5['dialQueueProject2']?'g':'',_[_0xddba('0x12')](_0x5232d5[_0xddba('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5232d5['dialPreviewUrl']||'','XMD-AGI':_0x5232d5[_0xddba('0x20')]?util[_0xddba('0x13')](_0xddba('0x21'),ipAgi,_0x5232d5[_0xddba('0x20')]):_0xddba('0x22'),'XMD-AGIAFTER':_0x5232d5['dialQueueProject2']?util[_0xddba('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5232d5[_0xddba('0x23')]):_0xddba('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1d3d07?_0x1d3d07[_0xddba('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1d3d07?_0x1d3d07[_0xddba('0x25')]:'','XMD-DESTINATION':_0xddba('0x26'),'SIPADDHEADER':_0xddba('0x27')};if(!_[_0xddba('0x12')](_0x5232d5[_0xddba('0x1f')])){_0x121adb[util[_0xddba('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5232d5[_0xddba('0x1f')];_0x121adb[util[_0xddba('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x11c659;}return _0x121adb;};exports[_0xddba('0x28')]=function(_0x26281d){var _0x4c8592={};for(var _0x247a1d in _0x26281d){if(_0x26281d[_0xddba('0x29')](_0x247a1d)){_0x4c8592[util['format']('%s',_[_0xddba('0x2a')](_0x247a1d))]=_0x26281d[_0x247a1d];}}return{'variables':_0x4c8592};};exports[_0xddba('0x2b')]=function(_0x464a9c,_0x28e24e){if(!_[_0xddba('0x16')](_0x464a9c)){if(_0x464a9c[_0xddba('0x29')](_0xddba('0x2c'))){if(_0x464a9c['originated']>0x0){_0x464a9c[_0xddba('0x2c')]-=0x1;}else{logger[_0xddba('0xa')](_0xddba('0x2d'),_0x28e24e);}}}else{logger[_0xddba('0xa')](_0xddba('0x2e'),_0x28e24e);}};exports[_0xddba('0x2f')]=function(_0x56304b){var _0x11c974=moment()['format'](_0xddba('0x30'));_0x56304b['state']=0xd;_0x56304b[_0xddba('0x31')]=_0xddba('0x32');_0x56304b[_0xddba('0x33')]=_0x11c974;_0x56304b[_0xddba('0x34')]=_0x11c974;_0x56304b[_0xddba('0x35')]=_0x11c974;};exports[_0xddba('0x36')]=function(_0x4c37cc,_0xf508b7,_0x169c01){var _0x53a2c1=moment()[_0xddba('0x13')](_0xddba('0x30'));_0x4c37cc[_0xddba('0x37')]=_0xf508b7;_0x4c37cc[_0xddba('0x31')]=_0x169c01;_0x4c37cc[_0xddba('0x34')]=_0x53a2c1;_0x4c37cc[_0xddba('0x38')]=utils[_0xddba('0x39')](_0x4c37cc[_0xddba('0x34')],_0x4c37cc[_0xddba('0x33')]);};exports[_0xddba('0x3a')]=function(_0xf2aab8,_0x1271d3,_0x447a68){_0xf2aab8['membername']=_0x1271d3;_0xf2aab8[_0xddba('0x3b')]=_0x447a68;};exports[_0xddba('0x3c')]=function(_0x4afea3,_0x5a0ae9,_0x15193b){var _0x279f61=moment()[_0xddba('0x13')](_0xddba('0x30'));_0x4afea3[_0xddba('0x37')]=_0x5a0ae9;_0x4afea3['statedesc']=_0x15193b;_0x4afea3['responsetime']=_0x4afea3[_0xddba('0x34')]?_0x4afea3[_0xddba('0x34')]:_0x279f61;_0x4afea3[_0xddba('0x35')]=_0x4afea3[_0xddba('0x35')]?_0x4afea3['endtime']:_0x279f61;_0x4afea3[_0xddba('0x38')]=utils['getSeconds'](_0x4afea3['responsetime']||0x0,_0x4afea3[_0xddba('0x33')]||0x0);_0x4afea3[_0xddba('0x3d')]=_0x4afea3[_0xddba('0x3e')]?utils[_0xddba('0x39')](_0x4afea3[_0xddba('0x35')],_0x4afea3[_0xddba('0x3e')]):0x0;};exports['isFailure']=function(_0x41f791){return _0x41f791===_0xddba('0x3f');};exports[_0xddba('0x40')]=function(_0x85a59b,_0x3748c3,_0x29e3bc,_0x391317,_0x484592){var _0x40cd05=_0x391317?'RECALL':_0x85a59b[_0xddba('0x19')];_0x40cd05=_0x484592?_0xddba('0x41'):_0x40cd05;return{'actionid':_0x85a59b['uniqueid'],'action':'originate','channel':_0x85a59b[_0xddba('0x42')],'callerid':util[_0xddba('0x13')](_0xddba('0x14'),_0x40cd05,_0x85a59b[_0xddba('0x1a')]),'Exten':_0xddba('0x26'),'Context':'from-sip','Priority':'1','variable':_0x29e3bc,'timeout':(_0x3748c3[_0xddba('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x85a59b[_0xddba('0x44')]};};exports['totalGlobal']=function(_0x3c62d4){return _0x3c62d4[_0xddba('0x45')]+_0x3c62d4[_0xddba('0x46')]+_0x3c62d4[_0xddba('0x47')]+_0x3c62d4[_0xddba('0x48')]+_0x3c62d4[_0xddba('0x49')];};exports[_0xddba('0x4a')]=function(_0x494a1d){var _0x2ceef2=_[_0xddba('0x4b')](_0x494a1d);_0x2ceef2['state']=0xf;_0x2ceef2[_0xddba('0x31')]=_0xddba('0x4c');return _0x2ceef2;};exports[_0xddba('0x4d')]=function(_0x246045,_0x1f4861,_0x1555d5){var _0x4c9d4b={};_0x4c9d4b[_0x1f4861]=_0x246045[_0x1f4861];_0x4c9d4b['active']=![];_0x4c9d4b[_0xddba('0x4e')]=moment()[_0xddba('0x4f')](_0x1555d5,_0xddba('0x50'))[_0xddba('0x13')](_0xddba('0x30'));_0x4c9d4b[_0xddba('0x51')]=_0x246045[_0xddba('0x51')];_0x4c9d4b['ListId']=_0x246045['ListId'];_0x4c9d4b[_0xddba('0x1c')]=_0x246045[_0xddba('0x1c')]||undefined;return _0x4c9d4b;};exports['decrementTalkink']=function(_0x5c49d5,_0xd18409){if(!_['isNil'](_0x5c49d5)){if(_0x5c49d5[_0xddba('0x52')]>0x0){_0x5c49d5[_0xddba('0x52')]-=0x1;}else{logger['error'](_0xd18409,_0xddba('0x53'));}}else{logger['error'](_0xd18409,_0xddba('0x54'));}};exports[_0xddba('0x55')]=function(_0x1c11b2){if(_0x1c11b2<=0x0){return!![];}return![];};function buildObj(_0x56d0c8,_0x465b95,_0x5d36d1){_0x56d0c8[_0xddba('0x56')]=_0x465b95;_0x56d0c8[_0xddba('0x18')]=_0x56d0c8[_0xddba('0x57')];_0x56d0c8[_0xddba('0x58')]=_0x56d0c8[_0xddba('0x42')];_0x56d0c8[_0xddba('0x59')]=_0xddba('0x5a');if(_0x5d36d1){_0x56d0c8['mandatoryDisposition']=_0x5d36d1['mandatoryDisposition'];}return _0x56d0c8;}exports[_0xddba('0x5b')]=buildObj;exports[_0xddba('0x5c')]=function(_0x504076){var _0x20b605=[];for(var _0x329ecc in _0x504076){if(_0x504076['hasOwnProperty'](_0x329ecc)){if(!_['isNil'](_0x504076[_0x329ecc])&&_0x504076[_0x329ecc][_0xddba('0x37')]===_0xddba('0x5d')&&_0x504076[_0x329ecc][_0xddba('0x5e')]===_0xddba('0x5f')){_0x20b605['push'](_0x504076[_0x329ecc]['id']);}}}return _0x20b605;};exports[_0xddba('0x60')]=function(_0x4a1284){var _0x187351=moment()[_0xddba('0x61')](0x0);var _0x3719be=moment(_0x4a1284)['milliseconds'](0x0);return _0x187351['diff'](_0x3719be,'seconds');};exports[_0xddba('0x62')]=function(_0x2f5990){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2f5990[_0xddba('0x51')],'ListId':_0x2f5990[_0xddba('0x63')],'VoiceQueueId':_0x2f5990['VoiceQueueId']||undefined,'CampaignId':_0x2f5990[_0xddba('0x64')]||undefined};};exports[_0xddba('0x65')]=function(_0x2322aa){if(_0x2322aa===_0xddba('0x44')||_0x2322aa===_0xddba('0x66')||_0x2322aa===_0xddba('0x57')||_0x2322aa===_0xddba('0x67')||_0x2322aa===_0xddba('0x68')||_0x2322aa===_0xddba('0x69')||_0x2322aa==='membername'||_0x2322aa==='channelAgent'||_0x2322aa===_0xddba('0x19')||_0x2322aa===_0xddba('0x6a')||_0x2322aa===_0xddba('0x1a')||_0x2322aa===_0xddba('0x4e')||_0x2322aa===_0xddba('0x45')||_0x2322aa==='countcongestionretry'||_0x2322aa===_0xddba('0x47')||_0x2322aa==='countglobal'||_0x2322aa===_0xddba('0x6b')||_0x2322aa==='callbackuniqueid'||_0x2322aa===_0xddba('0x6c')||_0x2322aa===_0xddba('0x6d')||_0x2322aa==='ContactId'||_0x2322aa===_0xddba('0x63')||_0x2322aa==='UserId'||_0x2322aa==='VoiceQueueId'||_0x2322aa===_0xddba('0x6e')||_0x2322aa===_0xddba('0x6f')||_0x2322aa===_0xddba('0x70')||_0x2322aa===_0xddba('0x71')||_0x2322aa==='xmd-listid'||_0x2322aa===_0xddba('0x72')||_0x2322aa==='xmd-dialtimeout'||_0x2322aa===_0xddba('0x73')||_0x2322aa==='xmd-dialid'||_0x2322aa==='xmd-dialchannel'||_0x2322aa===_0xddba('0x74')||_0x2322aa===_0xddba('0x75')||_0x2322aa===_0xddba('0x76')||_0x2322aa===_0xddba('0x77')||_0x2322aa===_0xddba('0x78')||_0x2322aa===_0xddba('0x79')||_0x2322aa===_0xddba('0x7a')||_0x2322aa===_0xddba('0x7b')||_0x2322aa===_0xddba('0x7c')||_0x2322aa===_0xddba('0x7d')||_0x2322aa==='rtpaudioqoslossbridged'||_0x2322aa===_0xddba('0x7e')||_0x2322aa===_0xddba('0x7f')||_0x2322aa===_0xddba('0x79')||_0x2322aa===_0xddba('0x7a')||_0x2322aa==='rtpaudioqosjitter'||_0x2322aa==='rtpaudioqosjitterbridged'||_0x2322aa===_0xddba('0x7d')||_0x2322aa===_0xddba('0x80')||_0x2322aa===_0xddba('0x7e')||_0x2322aa===_0xddba('0x7f')||_0x2322aa===_0xddba('0x81')||_0x2322aa===_0xddba('0x82')||_0x2322aa===_0xddba('0x37')||_0x2322aa===_0xddba('0x31')){return![];}return!![];};exports[_0xddba('0x83')]=function(_0x34bee6,_0x1488aa){var _0x556f65,_0x52acbb,_0x1bf131;if(_0x1488aa<=0x0){_0x1488aa=0x1;}_0x556f65=new RegExp(_0xddba('0x84')+_0x1488aa+'}$');_0x52acbb=Math['pow'](0xa,_0x1488aa-0x1);_0x1bf131=Math[_0xddba('0x85')](0xa,_0x1488aa)-0x1;return util[_0xddba('0x13')]('%s',_[_0xddba('0x86')](_0x34bee6,_0x556f65,_[_0xddba('0x87')](_0x52acbb,_0x1bf131)));};exports[_0xddba('0x88')]=function(_0x1ce9d2){var _0x2fd947=_0x1ce9d2[_0xddba('0x89')](/"(.*?)"/);return _0x2fd947?_0x2fd947[0x1]:_0x1ce9d2;};exports[_0xddba('0x8a')]=function(_0x1a7c16){var _0x270de3=_0x1a7c16[_0xddba('0x89')](/<(.*?)>/);return _0x270de3?_0x270de3[0x1]:_0x1a7c16;};function buildNoAnswerEventPayload(_0x49544c,_0x23061a){var _0x4f7561=buildObj(_0x49544c,_0xddba('0x8b'));if(!_['isEmpty'](_0x23061a[_0xddba('0x8c')])){Object[_0xddba('0x8d')](_0x23061a[_0xddba('0x8c')])[_0xddba('0x8e')](function(_0x99c62f){_0x4f7561[_0x99c62f[_0xddba('0x8f')]()]=_0x23061a[_0xddba('0x8c')][_0x99c62f];});}return _0x4f7561;}exports[_0xddba('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x0734=['Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','channelAgent','voice','mandatoryDisposition','buildObj','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','answertime','getSeconds','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone'];(function(_0x383601,_0x249364){var _0x2f095f=function(_0x2abb94){while(--_0x2abb94){_0x383601['push'](_0x383601['shift']());}};_0x2f095f(++_0x249364);}(_0x0734,0xd4));var _0x4073=function(_0x21f6c2,_0xfdc48f){_0x21f6c2=_0x21f6c2-0x0;var _0x2f4df6=_0x0734[_0x21f6c2];return _0x2f4df6;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0x4073('0x0'));var ipAgi=process[_0x4073('0x1')][_0x4073('0x2')]||_0x4073('0x3');var utils=require(_0x4073('0x4'));exports['loggerCatch']=function(_0x20e0f0){return function(_0x4e437e){logger[_0x4073('0x5')](_0x20e0f0,util[_0x4073('0x6')](_0x4e437e,{'showHidden':![],'depth':null}));};};exports[_0x4073('0x7')]=function(_0x55f7f6,_0x321a82){logger[_0x4073('0x8')](_0x55f7f6,util['inspect'](_0x321a82,{'showHidden':![],'depth':null}));};exports[_0x4073('0x9')]=function(_0x2d4693,_0x41888b){logger[_0x4073('0x5')](_0x2d4693,util[_0x4073('0x6')](_0x41888b,{'showHidden':![],'depth':null}));};exports[_0x4073('0xa')]=function(_0x5b59bc){return function(_0x4f936e){logger['info'](_0x5b59bc,util[_0x4073('0x6')](_0x4f936e,{'showHidden':![],'depth':null}));};};exports[_0x4073('0xb')]=function(_0x3a4501,_0x15c01b,_0x505c53){return{'message':_0x3a4501,'unlock':_0x15c01b,'active':_0x505c53};};exports['getCallerId']=function(_0x567397,_0x3a639b,_0x437742){if(!_[_0x4073('0xc')](_0x437742)&&_0x4073('0xd')===typeof _0x437742&&!_[_0x4073('0xe')](_0x437742)){if(!_[_0x4073('0xc')](_0x3a639b)&&_0x4073('0xd')===typeof _0x3a639b&&!_['isEmpty'](_0x3a639b)){return util[_0x4073('0xf')]('\x22%s\x22\x20<%s>',_0x3a639b,_0x437742);}return util[_0x4073('0xf')]('\x22%s\x22\x20<%s>',_0x437742,_0x437742);}if(!_[_0x4073('0xc')](_0x567397)&&'string'===typeof _0x567397&&!_[_0x4073('0xe')](_0x567397)){return _0x567397;}return _0x4073('0x10');};exports['isActive']=function(_0x405576){if(_[_0x4073('0x11')](_0x405576)){return![];}return _0x405576;};exports[_0x4073('0x12')]=function(_0x53132a,_0x699439,_0x282f9,_0x22a8b6,_0x5b8c19,_0x4bbebc){var _0x551e64={'XMD-QUEUE':_0x699439[_0x4073('0x13')]?_0x699439[_0x4073('0x13')][_0x4073('0x14')]:'','XMD-CALLERID':_0x22a8b6,'XMD-CALLERID-PREVIEW':_0x4bbebc?util[_0x4073('0xf')](_0x4073('0x15'),_0x4bbebc[_0x4073('0x16')],_0x4bbebc[_0x4073('0x17')]):_0x22a8b6,'XMD-DIALID':_0x5b8c19,'XMD-CONTACTID':_0x699439[_0x4073('0x18')],'XMD-CDRTYPE':_0x4073('0x19'),'CALLERID(all)':_0x22a8b6,'XMD-VOICEQUEUEID':_0x699439[_0x4073('0x1a')],'XMD-DIALCHANNEL':_0x282f9,'XMD-DIALTIMEOUT':_0x53132a[_0x4073('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x4073('0xf')](_0x4073('0x1c'),_0x53132a[_0x4073('0x1d')]?'g':'',_[_0x4073('0xe')](_0x53132a[_0x4073('0x1e')])?'':_0x4073('0x1f')),'XMD-DIALURL':_0x53132a[_0x4073('0x20')]||'','XMD-AGI':_0x53132a[_0x4073('0x21')]?util[_0x4073('0xf')](_0x4073('0x22'),ipAgi,_0x53132a['dialQueueProject']):_0x4073('0x23'),'XMD-AGIAFTER':_0x53132a[_0x4073('0x1d')]?util[_0x4073('0xf')](_0x4073('0x22'),ipAgi,_0x53132a[_0x4073('0x1d')]):_0x4073('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x4bbebc?_0x4bbebc[_0x4073('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x4bbebc?_0x4bbebc[_0x4073('0x25')]:'','XMD-DESTINATION':_0x4073('0x26'),'SIPADDHEADER':_0x4073('0x27')};if(!_[_0x4073('0xe')](_0x53132a[_0x4073('0x1e')])){_0x551e64[util[_0x4073('0xf')]('%s',_0x4073('0x28'))]=_0x53132a['monitor_format'];_0x551e64[util[_0x4073('0xf')]('%s',_0x4073('0x29'))]=_0x5b8c19;}return _0x551e64;};exports[_0x4073('0x2a')]=function(_0x4171cc){var _0x3ffc4f={};for(var _0x59fb15 in _0x4171cc){if(_0x4171cc[_0x4073('0x2b')](_0x59fb15)){_0x3ffc4f[util[_0x4073('0xf')]('%s',_[_0x4073('0x2c')](_0x59fb15))]=_0x4171cc[_0x59fb15];}}return{'variables':_0x3ffc4f};};exports[_0x4073('0x2d')]=function(_0x322ab4,_0x30f3fd){if(!_[_0x4073('0x11')](_0x322ab4)){if(_0x322ab4[_0x4073('0x2b')](_0x4073('0x2e'))){if(_0x322ab4[_0x4073('0x2e')]>0x0){_0x322ab4['originated']-=0x1;}else{logger[_0x4073('0x5')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x30f3fd);}}}else{logger['error'](_0x4073('0x2f'),_0x30f3fd);}};exports[_0x4073('0x30')]=function(_0xb31467){var _0x1d378a=moment()['format'](_0x4073('0x31'));_0xb31467[_0x4073('0x32')]=0xd;_0xb31467['statedesc']='Blacklist';_0xb31467[_0x4073('0x33')]=_0x1d378a;_0xb31467[_0x4073('0x34')]=_0x1d378a;_0xb31467['endtime']=_0x1d378a;};exports[_0x4073('0x35')]=function(_0x57bf2e,_0x29dd0d,_0x52b20e){var _0x2965c9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x57bf2e[_0x4073('0x32')]=_0x29dd0d;_0x57bf2e[_0x4073('0x36')]=_0x52b20e;_0x57bf2e[_0x4073('0x34')]=_0x2965c9;_0x57bf2e[_0x4073('0x37')]=utils['getSeconds'](_0x57bf2e['responsetime'],_0x57bf2e['starttime']);};exports[_0x4073('0x38')]=function(_0x12827c,_0x4622f2,_0x4bff6d){_0x12827c[_0x4073('0x39')]=_0x4622f2;_0x12827c[_0x4073('0x3a')]=_0x4bff6d;};exports[_0x4073('0x3b')]=function(_0x2c9f40,_0x481401,_0xb8c5e9){var _0x192c3d=moment()[_0x4073('0xf')](_0x4073('0x31'));_0x2c9f40[_0x4073('0x32')]=_0x481401;_0x2c9f40[_0x4073('0x36')]=_0xb8c5e9;_0x2c9f40[_0x4073('0x34')]=_0x2c9f40[_0x4073('0x34')]?_0x2c9f40[_0x4073('0x34')]:_0x192c3d;_0x2c9f40[_0x4073('0x3c')]=_0x2c9f40[_0x4073('0x3c')]?_0x2c9f40[_0x4073('0x3c')]:_0x192c3d;_0x2c9f40[_0x4073('0x37')]=utils['getSeconds'](_0x2c9f40[_0x4073('0x34')]||0x0,_0x2c9f40['starttime']||0x0);_0x2c9f40['talktime']=_0x2c9f40[_0x4073('0x3d')]?utils[_0x4073('0x3e')](_0x2c9f40[_0x4073('0x3c')],_0x2c9f40[_0x4073('0x3d')]):0x0;};exports[_0x4073('0x3f')]=function(_0x5e1dc1){return _0x5e1dc1==='Failure';};exports[_0x4073('0x40')]=function(_0x3381c9,_0x4cf882,_0x52b4e5,_0x26e082,_0x47f390){var _0x39452e=_0x26e082?_0x4073('0x41'):_0x3381c9[_0x4073('0x16')];_0x39452e=_0x47f390?_0x4073('0x42'):_0x39452e;return{'actionid':_0x3381c9[_0x4073('0x43')],'action':_0x4073('0x44'),'channel':_0x3381c9['channelAgent'],'callerid':util[_0x4073('0xf')](_0x4073('0x15'),_0x39452e,_0x3381c9[_0x4073('0x17')]),'Exten':_0x4073('0x26'),'Context':_0x4073('0x45'),'Priority':'1','variable':_0x52b4e5,'timeout':(_0x4cf882[_0x4073('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3381c9[_0x4073('0x43')]};};exports['totalGlobal']=function(_0x13b9a4){return _0x13b9a4[_0x4073('0x47')]+_0x13b9a4[_0x4073('0x48')]+_0x13b9a4[_0x4073('0x49')]+_0x13b9a4[_0x4073('0x4a')]+_0x13b9a4[_0x4073('0x4b')];};exports[_0x4073('0x4c')]=function(_0xd0f652){var _0x1b9cd1=_[_0x4073('0x4d')](_0xd0f652);_0x1b9cd1[_0x4073('0x32')]=0xf;_0x1b9cd1[_0x4073('0x36')]=_0x4073('0x4e');return _0x1b9cd1;};exports[_0x4073('0x4f')]=function(_0x43d4be,_0x11c179,_0x4e4f65){var _0xa830d4={};_0xa830d4[_0x11c179]=_0x43d4be[_0x11c179];_0xa830d4[_0x4073('0x50')]=![];_0xa830d4[_0x4073('0x51')]=moment()[_0x4073('0x52')](_0x4e4f65,_0x4073('0x53'))[_0x4073('0xf')](_0x4073('0x31'));_0xa830d4[_0x4073('0x18')]=_0x43d4be['ContactId'];_0xa830d4[_0x4073('0x54')]=_0x43d4be[_0x4073('0x54')];_0xa830d4['VoiceQueueId']=_0x43d4be['VoiceQueueId']||undefined;return _0xa830d4;};exports[_0x4073('0x55')]=function(_0x2a7382,_0x128175){if(!_['isNil'](_0x2a7382)){if(_0x2a7382[_0x4073('0x56')]>0x0){_0x2a7382[_0x4073('0x56')]-=0x1;}else{logger[_0x4073('0x5')](_0x128175,_0x4073('0x57'));}}else{logger['error'](_0x128175,_0x4073('0x58'));}};exports['IsNotLoggedIn']=function(_0x33c7d4){if(_0x33c7d4<=0x0){return!![];}return![];};function buildObj(_0x3d3f24,_0x576c3e,_0x3d43d7){_0x3d3f24[_0x4073('0x59')]=_0x576c3e;_0x3d3f24[_0x4073('0x14')]=_0x3d3f24[_0x4073('0x5a')];_0x3d3f24[_0x4073('0x5b')]=_0x3d3f24[_0x4073('0x5c')];_0x3d3f24['motionChannel']=_0x4073('0x5d');if(_0x3d43d7){_0x3d3f24[_0x4073('0x5e')]=_0x3d43d7['mandatoryDisposition'];}return _0x3d3f24;}exports[_0x4073('0x5f')]=buildObj;exports['agentReadyId']=function(_0x275335){var _0x5e6a00=[];for(var _0x37ed2c in _0x275335){if(_0x275335[_0x4073('0x2b')](_0x37ed2c)){if(!_['isNil'](_0x275335[_0x37ed2c])&&_0x275335[_0x37ed2c]['state']===_0x4073('0x60')&&_0x275335[_0x37ed2c][_0x4073('0x61')]===_0x4073('0x62')){_0x5e6a00[_0x4073('0x63')](_0x275335[_0x37ed2c]['id']);}}}return _0x5e6a00;};exports[_0x4073('0x64')]=function(_0x4cdb7a){var _0x4e56ea=moment()[_0x4073('0x65')](0x0);var _0x4fa3ed=moment(_0x4cdb7a)['milliseconds'](0x0);return _0x4e56ea[_0x4073('0x66')](_0x4fa3ed,_0x4073('0x67'));};exports[_0x4073('0x68')]=function(_0x40935b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x40935b[_0x4073('0x18')],'ListId':_0x40935b[_0x4073('0x54')],'VoiceQueueId':_0x40935b[_0x4073('0x1a')]||undefined,'CampaignId':_0x40935b[_0x4073('0x69')]||undefined};};exports[_0x4073('0x6a')]=function(_0x1e54cc){if(_0x1e54cc===_0x4073('0x43')||_0x1e54cc==='idContact'||_0x1e54cc===_0x4073('0x5a')||_0x1e54cc===_0x4073('0x6b')||_0x1e54cc===_0x4073('0x6c')||_0x1e54cc===_0x4073('0x6d')||_0x1e54cc===_0x4073('0x39')||_0x1e54cc==='channelAgent'||_0x1e54cc===_0x4073('0x16')||_0x1e54cc==='active'||_0x1e54cc===_0x4073('0x17')||_0x1e54cc==='scheduledat'||_0x1e54cc==='countbusyretry'||_0x1e54cc==='countcongestionretry'||_0x1e54cc===_0x4073('0x49')||_0x1e54cc===_0x4073('0x6e')||_0x1e54cc===_0x4073('0x6f')||_0x1e54cc===_0x4073('0x70')||_0x1e54cc===_0x4073('0x71')||_0x1e54cc===_0x4073('0x72')||_0x1e54cc===_0x4073('0x18')||_0x1e54cc==='ListId'||_0x1e54cc===_0x4073('0x3a')||_0x1e54cc===_0x4073('0x1a')||_0x1e54cc==='sipcallid'||_0x1e54cc===_0x4073('0x73')||_0x1e54cc===_0x4073('0x74')||_0x1e54cc===_0x4073('0x75')||_0x1e54cc===_0x4073('0x76')||_0x1e54cc==='xmd-dialurl'||_0x1e54cc===_0x4073('0x77')||_0x1e54cc===_0x4073('0x78')||_0x1e54cc===_0x4073('0x79')||_0x1e54cc==='xmd-dialchannel'||_0x1e54cc==='xmd-contactid'||_0x1e54cc==='xmd-cdrtype'||_0x1e54cc==='xmd-callerid'||_0x1e54cc===_0x4073('0x7a')||_0x1e54cc===_0x4073('0x7b')||_0x1e54cc===_0x4073('0x7c')||_0x1e54cc===_0x4073('0x7d')||_0x1e54cc===_0x4073('0x7e')||_0x1e54cc===_0x4073('0x7f')||_0x1e54cc==='rtpaudioqosloss'||_0x1e54cc==='rtpaudioqoslossbridged'||_0x1e54cc===_0x4073('0x80')||_0x1e54cc===_0x4073('0x81')||_0x1e54cc===_0x4073('0x7c')||_0x1e54cc===_0x4073('0x7d')||_0x1e54cc===_0x4073('0x7e')||_0x1e54cc===_0x4073('0x7f')||_0x1e54cc===_0x4073('0x82')||_0x1e54cc===_0x4073('0x83')||_0x1e54cc==='rtpaudioqosrtt'||_0x1e54cc===_0x4073('0x81')||_0x1e54cc===_0x4073('0x84')||_0x1e54cc==='bridgepvtcallid'||_0x1e54cc===_0x4073('0x32')||_0x1e54cc===_0x4073('0x36')){return![];}return!![];};exports[_0x4073('0x85')]=function(_0x381f43,_0x5ac9c6){var _0x1dab23,_0x396550,_0x424621;if(_0x5ac9c6<=0x0){_0x5ac9c6=0x1;}_0x1dab23=new RegExp(_0x4073('0x86')+_0x5ac9c6+'}$');_0x396550=Math[_0x4073('0x87')](0xa,_0x5ac9c6-0x1);_0x424621=Math['pow'](0xa,_0x5ac9c6)-0x1;return util[_0x4073('0xf')]('%s',_[_0x4073('0x88')](_0x381f43,_0x1dab23,_['random'](_0x396550,_0x424621)));};exports[_0x4073('0x89')]=function(_0x30da9f){var _0x216708=_0x30da9f[_0x4073('0x8a')](/"(.*?)"/);return _0x216708?_0x216708[0x1]:_0x30da9f;};exports[_0x4073('0x8b')]=function(_0x428657){var _0x22dc35=_0x428657[_0x4073('0x8a')](/<(.*?)>/);return _0x22dc35?_0x22dc35[0x1]:_0x428657;};function buildNoAnswerEventPayload(_0x1f51d0,_0x31c72a){var _0xeceb03=buildObj(_0x1f51d0,_0x4073('0x8c'));if(!_[_0x4073('0xe')](_0x31c72a['variables'])){Object['keys'](_0x31c72a[_0x4073('0x8d')])[_0x4073('0x8e')](function(_0x29f4be){_0xeceb03[_0x29f4be[_0x4073('0x8f')]()]=_0x31c72a[_0x4073('0x8d')][_0x29f4be];});}return _0xeceb03;}exports[_0x4073('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 485fa74..06b3da5 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 _0xf10d=['queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x4314c9,_0x1a6d36){var _0x1f8798=function(_0x27858f){while(--_0x27858f){_0x4314c9['push'](_0x4314c9['shift']());}};_0x1f8798(++_0x1a6d36);}(_0xf10d,0x132));var _0xdf10=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf10d[_0x255d5b];return _0x3e141a;};'use strict';exports[_0xdf10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xdf10('0x1'),'required':!![]},'membername':{'type':_0xdf10('0x1'),'required':!![]},'penalty':{'type':_0xdf10('0x2'),'required':![]},'paused':{'type':_0xdf10('0x3'),'required':![]}};exports[_0xdf10('0x4')]={'queue':{'type':_0xdf10('0x1'),'required':!![]},'interface':{'type':_0xdf10('0x1'),'required':!![]}};exports[_0xdf10('0x5')]={'interface':{'type':_0xdf10('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xdf10('0x1'),'required':![]}};exports[_0xdf10('0x6')]={'module':{'type':_0xdf10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0xdf10('0x7')]={'uniqueid':{'type':_0xdf10('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xdf10('0x1')}};exports[_0xdf10('0x8')]={'uniqueid':{'type':_0xdf10('0x1'),'required':!![]}};exports[_0xdf10('0x9')]={'uniqueid':{'type':_0xdf10('0x1'),'required':!![]},'exten':{'type':_0xdf10('0x1'),'required':!![]},'context':{'type':_0xdf10('0x1')}}; \ No newline at end of file +var _0x982a=['boolean','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x982a,0xff));var _0xa982=function(_0x27d95b,_0x468d53){_0x27d95b=_0x27d95b-0x0;var _0xb9e8a7=_0x982a[_0x27d95b];return _0xb9e8a7;};'use strict';exports[_0xa982('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xa982('0x1'),'required':!![]},'penalty':{'type':_0xa982('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xa982('0x3')]={'queue':{'type':_0xa982('0x1'),'required':!![]},'interface':{'type':_0xa982('0x1'),'required':!![]}};exports[_0xa982('0x4')]={'interface':{'type':_0xa982('0x1'),'required':!![]},'paused':{'type':_0xa982('0x5')},'reason':{'type':'string','required':![]}};exports[_0xa982('0x6')]={'module':{'type':_0xa982('0x1'),'required':![]}};exports[_0xa982('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xa982('0x1'),'required':!![]},'filename':{'type':_0xa982('0x1')},'format':{'type':_0xa982('0x1')},'mixmonitorid':{'type':_0xa982('0x1')}};exports[_0xa982('0x8')]={'uniqueid':{'type':_0xa982('0x1'),'required':!![]}};exports[_0xa982('0x9')]={'uniqueid':{'type':_0xa982('0x1'),'required':!![]},'exten':{'type':_0xa982('0x1'),'required':!![]},'context':{'type':_0xa982('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index df9bc40..e982acf 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32358b,_0x5c7c35){_0x32358b=_0x32358b-0x0;var _0x58c21d=_0x0b0e[_0x32358b];return _0x58c21d;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x361d82,_0x2367f7){var _0x2bd70f=function(_0x1821d1){while(--_0x1821d1){_0x361d82['push'](_0x361d82['shift']());}};_0x2bd70f(++_0x2367f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5bdfb2,_0x5eeb10){_0x5bdfb2=_0x5bdfb2-0x0;var _0x5f5240=_0xb10b[_0x5bdfb2];return _0x5f5240;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 23b1f8a..32f23ab 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 _0x48ac=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x2d6df9,_0x45da50){var _0x429b18=function(_0x5b3c09){while(--_0x5b3c09){_0x2d6df9['push'](_0x2d6df9['shift']());}};_0x429b18(++_0x45da50);}(_0x48ac,0x171));var _0xc48a=function(_0xc83a81,_0x51b682){_0xc83a81=_0xc83a81-0x0;var _0x28337c=_0x48ac[_0xc83a81];return _0x28337c;};'use strict';function mergeDBDataToRealtime(_0x3a0d1a,_0x28a6eb){var _0x499203=Object[_0xc48a('0x0')]({},_0x3a0d1a);for(var _0x15962f in _0x28a6eb){if(_0x499203[_0xc48a('0x1')](_0x15962f)){_0x499203[_0x15962f]=_0x28a6eb[_0x15962f];}}return _0x499203;}exports[_0xc48a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xb4f6=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x62914d,_0x182791){var _0x4ce45c=function(_0xdd9a9){while(--_0xdd9a9){_0x62914d['push'](_0x62914d['shift']());}};_0x4ce45c(++_0x182791);}(_0xb4f6,0xbe));var _0x6b4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4f6[_0x321bb2];return _0x9c12ed;};'use strict';function mergeDBDataToRealtime(_0x148b6c,_0x438a7d){var _0x25146c=Object[_0x6b4f('0x0')]({},_0x148b6c);for(var _0x1a0b09 in _0x438a7d){if(_0x25146c[_0x6b4f('0x1')](_0x1a0b09)){_0x25146c[_0x1a0b09]=_0x438a7d[_0x1a0b09];}}return _0x25146c;}exports[_0x6b4f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 81e0310..3bd7a97 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 _0x70e1=['connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','length','connectedlinenum','assigned','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','lastdata','queue','from-voip-provider','context','from-sip','xcally-motion-preview','originatecalleridnum','calleridpreview','ANSWERED','callerid','transfers','linkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt'];(function(_0x1745c5,_0x192a4f){var _0x53f57a=function(_0x22a7e3){while(--_0x22a7e3){_0x1745c5['push'](_0x1745c5['shift']());}};_0x53f57a(++_0x192a4f);}(_0x70e1,0x1d8));var _0x170e=function(_0x510b08,_0x16cd04){_0x510b08=_0x510b08-0x0;var _0xbf9488=_0x70e1[_0x510b08];return _0xbf9488;};'use strict';var _=require('lodash');var moment=require(_0x170e('0x0'));var util=require(_0x170e('0x1'));var config=require(_0x170e('0x2'));var ami=require(_0x170e('0x3'));var RpcVoiceAgentReport=require(_0x170e('0x4'));var RpcVoiceCallReport=require(_0x170e('0x5'));var RpcVoiceDialReport=require(_0x170e('0x6'));var RpcMemberReport=require(_0x170e('0x7'));var RpcVoiceQueueReport=require(_0x170e('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x170e('0x9'));var VoiceQueueReport=require(_0x170e('0xa'));var VoiceCallReport=require(_0x170e('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x170e('0xc'));function Report(_0x51b644){this[_0x170e('0xd')]=_0x51b644;this[_0x170e('0xe')]=_0x51b644[_0x170e('0xe')];this[_0x170e('0xf')]=_0x51b644['telephones'];}Report[_0x170e('0x10')][_0x170e('0x11')]=function(_0x13759e){var _0x41be01=new VoiceQueueReport(this['realtime']);var _0x5caa54=new VoiceAgentReport(this[_0x170e('0xd')]);var _0xb951d8=new VoiceDialReport(this[_0x170e('0xd')]);var _0x4f11d7=new VoiceCallReport(this[_0x170e('0xd')]);var _0x49f1c3=new UserReport(this[_0x170e('0xd')]);if(config[_0x170e('0x12')]&&config[_0x170e('0x12')][_0x170e('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x170e('0x14')][_0x170e('0x15')](this));ami['on'](_0x170e('0x16'),this[_0x170e('0x17')][_0x170e('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x170e('0x18')]['bind'](this));ami['on'](_0x170e('0x19'),this['voiceDialReport'][_0x170e('0x15')](this));ami['on'](_0x170e('0x1a'),this[_0x170e('0x1b')][_0x170e('0x15')](this));ami['on'](_0x170e('0x1c'),this[_0x170e('0x1d')][_0x170e('0x15')](this));}};Report[_0x170e('0x10')][_0x170e('0x1e')]=function(_0x9bcd12){var _0x1cf0b2;_0x1cf0b2=_[_0x170e('0x1f')](this[_0x170e('0xe')],function(_0x7fd3e1){return _0x7fd3e1[_0x170e('0x20')]==_0x9bcd12||_0x7fd3e1[_0x170e('0x21')]==_0x9bcd12;});if(_[_0x170e('0x22')](_0x1cf0b2)){var _0x2cdd2=_[_0x170e('0x1f')](this[_0x170e('0xf')],function(_0x4da369){return _0x4da369[_0x170e('0x20')]==_0x9bcd12||_0x4da369[_0x170e('0x21')]==_0x9bcd12;});if(_0x2cdd2){_0x1cf0b2=_[_0x170e('0x1f')](this[_0x170e('0xe')],function(_0x238cd1){return _0x238cd1['interface']==util[_0x170e('0x23')]('SIP/%s',_0x2cdd2[_0x170e('0x21')]);});}}return _0x1cf0b2;};Report['prototype'][_0x170e('0x14')]=function(_0x2186e6){for(var _0x34de8b=0x0;_0x34de8b<_0x2186e6[_0x170e('0x24')];_0x34de8b+=0x1){var _0x251fc0=this[_0x170e('0x1e')](_0x2186e6[_0x34de8b][_0x170e('0x25')]);if(_0x251fc0){_0x2186e6[_0x34de8b][_0x170e('0x20')]=_0x251fc0[_0x170e('0x20')];_0x2186e6[_0x34de8b][_0x170e('0x26')]=!![];_0x2186e6[_0x34de8b]['lastAssignedTo']=_0x251fc0[_0x170e('0x21')];_0x2186e6[_0x34de8b][_0x170e('0x27')]=_['isNil'](_0x251fc0['interface'])?util[_0x170e('0x23')](_0x170e('0x28'),_0x251fc0[_0x170e('0x21')]):_0x251fc0['interface'];if(_0x2186e6[_0x34de8b][_0x170e('0x29')]){_0x2186e6[_0x34de8b][_0x170e('0x2a')]=moment()[_0x170e('0x23')](_0x170e('0x2b'));}if(_0x2186e6[_0x34de8b][_0x170e('0x2c')]){_0x2186e6[_0x34de8b]['queuecallerexitAt']=moment()[_0x170e('0x23')](_0x170e('0x2b'));}RpcMemberReport[_0x170e('0x14')](_0x2186e6[_0x34de8b]);}RpcVoiceQueueReport[_0x170e('0x2d')](_0x2186e6[_0x34de8b]);}};function extractCalleridNumber(_0x1a6a95){var _0x183ce3=_0x1a6a95[_0x170e('0x2e')](/<(.*?)>/);return _0x183ce3?_0x183ce3[0x1]:_0x1a6a95;}Report[_0x170e('0x10')][_0x170e('0x2f')]=function(_0x1df948){for(var _0xd89d81=0x0;_0xd89d81',_0x4bc834['calleridname'],_0x4bc834[_0x170e('0x34')]);}if(RpcVoiceTransferReport[_0x170e('0x46')][_0x4bc834['linkedid']]){var _0x317af9=RpcVoiceTransferReport[_0x170e('0x46')][_0x4bc834[_0x170e('0x47')]];_0x317af9['transfereelinkedid']=_0x4bc834[_0x170e('0x48')];RpcVoiceTransferReport[_0x170e('0x1b')](_0x317af9);delete RpcVoiceTransferReport[_0x170e('0x46')][_0x4bc834[_0x170e('0x47')]];}if(_[_0x170e('0x22')](_0x4bc834[_0x170e('0x39')])){_0x4bc834[_0x170e('0x39')]=this['getCallType'](_0x4bc834);}if(_[_0x170e('0x22')](_0x4bc834[_0x170e('0x49')])){var _0x1d7b26=_0x4bc834['channel']['split']('-')[0x0];var _0x5cace7=this[_0x170e('0xe')][_0x1d7b26];if(!_0x5cace7)_0x5cace7=this[_0x170e('0x2f')](_0x4bc834[_0x170e('0x20')]);if(_0x5cace7){_0x4bc834[_0x170e('0x49')]=_0x5cace7['id'];_0x4bc834[_0x170e('0x4a')]=_0x5cace7[_0x170e('0x21')];}}RpcVoiceCallReport[_0x170e('0x2d')](_0x4bc834);if(_0x4bc834[_0x170e('0x4b')]){for(var _0x360fba=0x0;_0x360fba<_0x4bc834[_0x170e('0x4c')][_0x170e('0x24')];_0x360fba+=0x1){_0x4bc834[_0x170e('0x4d')]=_0x4bc834[_0x170e('0x4c')][_0x360fba][_0x170e('0x4e')];_0x4bc834['createdAt']=_0x4bc834[_0x170e('0x4c')][_0x360fba][_0x170e('0x4f')];if(_0x4bc834[_0x170e('0x38')]==_0x170e('0x41')){_0x4bc834[_0x170e('0x34')]=_0x4bc834['connectedlinenum'];_0x4bc834['calleridname']=_0x4bc834[_0x170e('0x50')];_0x4bc834['connectedlinenum']=_0x4bc834[_0x170e('0x20')];_0x4bc834[_0x170e('0x50')]=_0x4bc834[_0x170e('0x4a')];_0x4bc834[_0x170e('0x38')]=_0x4bc834[_0x170e('0x42')];}else if(_0x4bc834[_0x170e('0x38')]==_0x170e('0x51')){_0x4bc834[_0x170e('0x34')]=_0x4bc834[_0x170e('0x37')];_0x4bc834[_0x170e('0x38')]=_0x4bc834['originatecalleridnum'];}RpcVoiceRecording[_0x170e('0x2d')](_0x4bc834);}}};Report[_0x170e('0x10')][_0x170e('0x18')]=function(_0x4b05d6){if(_['isArray'](_0x4b05d6)){_0x4b05d6[_0x170e('0x52')](function(_0x17a552){RpcVoiceAgentReport[_0x170e('0x2d')](_0x17a552);});}else{RpcVoiceAgentReport[_0x170e('0x2d')](_0x4b05d6);}};Report['prototype'][_0x170e('0x53')]=function(_0x7a7bf4){RpcVoiceDialReport[_0x170e('0x2d')](_0x7a7bf4);var _0x9e1c01;var _0x514a75;var _0x35dbdb=_0x7a7bf4['channel'];if(_[_0x170e('0x54')](_0x35dbdb,'Local')){_0x514a75=_0x35dbdb[_0x170e('0x55')](_0x35dbdb[_0x170e('0x56')]('/')+0x1,_0x35dbdb[_0x170e('0x56')]('@'));_0x9e1c01=_[_0x170e('0x1f')](this[_0x170e('0xe')],function(_0x59b566){return _0x59b566[_0x170e('0x57')]==_0x514a75||_0x59b566[_0x170e('0x58')]==_0x514a75||_0x59b566[_0x170e('0x20')]==_0x514a75;});}else{_0x514a75=_0x35dbdb[_0x170e('0x55')](_0x35dbdb[_0x170e('0x56')]('/')+0x1,_0x35dbdb[_0x170e('0x59')]('-'));_0x9e1c01=this[_0x170e('0x1e')](_0x514a75);}if(_0x9e1c01){_0x7a7bf4['interface']=_[_0x170e('0x22')](_0x9e1c01[_0x170e('0x27')])?util[_0x170e('0x23')](_0x170e('0x28'),_0x9e1c01[_0x170e('0x21')]):_0x9e1c01['interface'];_0x7a7bf4['membername']=_0x9e1c01[_0x170e('0x21')];_0x7a7bf4[_0x170e('0x20')]=_0x9e1c01[_0x170e('0x20')];RpcMemberReport[_0x170e('0x53')](_0x7a7bf4);}};Report['prototype'][_0x170e('0x1b')]=function(_0x1b6620){RpcVoiceTransferReport[_0x170e('0x46')][_0x1b6620[_0x170e('0x5a')]]=_0x1b6620;};Report[_0x170e('0x10')][_0x170e('0x1d')]=function(_0x739b82){RpcVoiceTransferReport[_0x170e('0x1d')](_0x739b82);};module[_0x170e('0x5b')]=Report; \ No newline at end of file +var _0x96fa=['disabled','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','name','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','internal','voiceCallReport','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','destination','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','create','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr'];(function(_0x4aba33,_0x56b41e){var _0x5086ed=function(_0x590cfa){while(--_0x590cfa){_0x4aba33['push'](_0x4aba33['shift']());}};_0x5086ed(++_0x56b41e);}(_0x96fa,0x1ed));var _0xa96f=function(_0x2f63c5,_0x1a5083){_0x2f63c5=_0x2f63c5-0x0;var _0x78a415=_0x96fa[_0x2f63c5];return _0x78a415;};'use strict';var _=require(_0xa96f('0x0'));var moment=require(_0xa96f('0x1'));var util=require(_0xa96f('0x2'));var config=require(_0xa96f('0x3'));var ami=require(_0xa96f('0x4'));var RpcVoiceAgentReport=require(_0xa96f('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xa96f('0x6'));var RpcVoiceTransferReport=require(_0xa96f('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xa96f('0x8'));var VoiceAgentReport=require(_0xa96f('0x9'));var VoiceDialReport=require(_0xa96f('0xa'));var UserReport=require('./userReport');function Report(_0x31bea1){this[_0xa96f('0xb')]=_0x31bea1;this[_0xa96f('0xc')]=_0x31bea1[_0xa96f('0xc')];this[_0xa96f('0xd')]=_0x31bea1[_0xa96f('0xd')];}Report[_0xa96f('0xe')][_0xa96f('0xf')]=function(_0x4e0e51){var _0x52689a=new VoiceQueueReport(this[_0xa96f('0xb')]);var _0x4abb16=new VoiceAgentReport(this[_0xa96f('0xb')]);var _0x32903f=new VoiceDialReport(this[_0xa96f('0xb')]);var _0x379c23=new VoiceCallReport(this[_0xa96f('0xb')]);var _0x33c617=new UserReport(this[_0xa96f('0xb')]);if(config[_0xa96f('0x10')]&&config[_0xa96f('0x10')][_0xa96f('0x11')]){ami['on']('custom:voiceQueueReport',this[_0xa96f('0x12')][_0xa96f('0x13')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xa96f('0x13')](this));ami['on'](_0xa96f('0x14'),this[_0xa96f('0x15')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0xa96f('0x16')][_0xa96f('0x13')](this));ami['on'](_0xa96f('0x17'),this['blindTransfer'][_0xa96f('0x13')](this));ami['on'](_0xa96f('0x18'),this[_0xa96f('0x19')]['bind'](this));}};Report[_0xa96f('0xe')][_0xa96f('0x1a')]=function(_0x2135e6){var _0x926580;_0x926580=_[_0xa96f('0x1b')](this['agents'],function(_0x2e1208){return _0x2e1208['accountcode']==_0x2135e6||_0x2e1208['name']==_0x2135e6;});if(_[_0xa96f('0x1c')](_0x926580)){var _0x17ea3a=_[_0xa96f('0x1b')](this[_0xa96f('0xd')],function(_0x40c05c){return _0x40c05c[_0xa96f('0x1d')]==_0x2135e6||_0x40c05c[_0xa96f('0x1e')]==_0x2135e6;});if(_0x17ea3a){_0x926580=_[_0xa96f('0x1b')](this[_0xa96f('0xc')],function(_0x3f4166){return _0x3f4166['interface']==util[_0xa96f('0x1f')](_0xa96f('0x20'),_0x17ea3a[_0xa96f('0x1e')]);});}}return _0x926580;};Report[_0xa96f('0xe')][_0xa96f('0x12')]=function(_0x3b4611){for(var _0x396e76=0x0;_0x396e76<_0x3b4611[_0xa96f('0x21')];_0x396e76+=0x1){var _0x13b113=this[_0xa96f('0x1a')](_0x3b4611[_0x396e76][_0xa96f('0x22')]);if(_0x13b113){_0x3b4611[_0x396e76][_0xa96f('0x1d')]=_0x13b113[_0xa96f('0x1d')];_0x3b4611[_0x396e76]['assigned']=!![];_0x3b4611[_0x396e76][_0xa96f('0x23')]=_0x13b113[_0xa96f('0x1e')];_0x3b4611[_0x396e76]['interface']=_[_0xa96f('0x1c')](_0x13b113[_0xa96f('0x24')])?util[_0xa96f('0x1f')](_0xa96f('0x20'),_0x13b113['name']):_0x13b113[_0xa96f('0x24')];if(_0x3b4611[_0x396e76]['queuecallercomplete']){_0x3b4611[_0x396e76][_0xa96f('0x25')]=moment()[_0xa96f('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3b4611[_0x396e76]['queuecallerexit']){_0x3b4611[_0x396e76][_0xa96f('0x26')]=moment()[_0xa96f('0x1f')](_0xa96f('0x27'));}RpcMemberReport[_0xa96f('0x12')](_0x3b4611[_0x396e76]);}RpcVoiceQueueReport['create'](_0x3b4611[_0x396e76]);}};function extractCalleridNumber(_0xc0b856){var _0x478460=_0xc0b856[_0xa96f('0x28')](/<(.*?)>/);return _0x478460?_0x478460[0x1]:_0xc0b856;}Report[_0xa96f('0xe')][_0xa96f('0x29')]=function(_0x6be399){for(var _0x16f4d2=0x0;_0x16f4d20x0?!![]:![];if(!_0x3e3e90){return this['syncQueueSummaryComplete'](this['summary'][_0xd8d6('0x67')]);}};VoiceQueueReport[_0xd8d6('0xa')]['syncQueueMember']=function(_0x7562c2){var _0x220378=this[_0xd8d6('0x15')]['id'];if(this[_0xd8d6('0x15')][_0xd8d6('0x5e')][_0x220378]&&this[_0xd8d6('0x15')][_0xd8d6('0x5e')][_0x220378][_0x7562c2[_0xd8d6('0x5d')]]){this[_0xd8d6('0x15')][_0xd8d6('0x5e')][_0x220378][_0x7562c2[_0xd8d6('0x5d')]]['agents']['push'](_0x7562c2);}};VoiceQueueReport[_0xd8d6('0xa')]['syncQueueSummary']=function(_0x188816){var _0x5e8fd2=this;try{if(this[_0xd8d6('0x68')](_0x188816)&&this['isNotNull'](_0x188816[_0xd8d6('0x4d')])){logger[_0xd8d6('0x48')](_0xd8d6('0x69'),util[_0xd8d6('0x3f')](_0x188816,{'showHidden':![],'depth':null}));var _0x3f8db8=this[_0xd8d6('0x13')][_0x188816[_0xd8d6('0x4d')]];if(_0x3f8db8){logger[_0xd8d6('0x48')](_0xd8d6('0x6a'),_0x3f8db8[_0xd8d6('0x56')]);this[_0xd8d6('0x15')][_0xd8d6('0x58')][_0x3f8db8[_0xd8d6('0x56')]]={'summaryEvent':_0x188816};this[_0xd8d6('0x15')][_0xd8d6('0x6b')]+=0x1;return ami[_0xd8d6('0x39')]({'action':_0xd8d6('0x5e'),'queue':_0x3f8db8['name']})[_0xd8d6('0x5c')](function(_0x28fb37){if(!_0x5e8fd2['summary']['queuestatus'][_0x188816[_0xd8d6('0x5d')]]){_0x5e8fd2[_0xd8d6('0x15')][_0xd8d6('0x5e')][_0x188816[_0xd8d6('0x5d')]]={};}_0x5e8fd2['summary'][_0xd8d6('0x5e')][_0x188816[_0xd8d6('0x5d')]][_0x28fb37[_0xd8d6('0x5d')]]={'queue':_0x3f8db8[_0xd8d6('0x56')],'agents':[]};})[_0xd8d6('0x3c')](function(_0x2a70b4){throw _0x2a70b4;});}}}catch(_0x4a0db5){logger[_0xd8d6('0x40')](_0xd8d6('0x5f'),util['inspect'](_0x4a0db5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd8d6('0xa')][_0xd8d6('0x1a')]=function(_0x464863){if(this['summary']['statusRequests']>0x0){this[_0xd8d6('0x15')][_0xd8d6('0x67')]=_0x464863;return;}logger[_0xd8d6('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xd8d6('0x3f')](_0x464863,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xd8d6('0x46')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xd8d6('0xa')]['syncQueueCallerJoin']=function(_0x1f4e50){try{if(this[_0xd8d6('0x68')](_0x1f4e50)){logger[_0xd8d6('0x48')](_0xd8d6('0x6c'),_0x1f4e50['uniqueid'],util[_0xd8d6('0x3f')](_0x1f4e50,{'showHidden':![],'depth':null}));if(_[_0xd8d6('0x6d')](this[_0xd8d6('0xe')][_0x1f4e50[_0xd8d6('0x4a')]])){this[_0xd8d6('0xe')][_0x1f4e50[_0xd8d6('0x4a')]]=[];}if(_[_0xd8d6('0x6d')](this[_0xd8d6('0x11')][_0x1f4e50[_0xd8d6('0x4a')]])){this[_0xd8d6('0x11')][_0x1f4e50[_0xd8d6('0x4a')]]={};}var _0x75e45c=new QueueReport();_0x75e45c[_0xd8d6('0x4d')]=_0x1f4e50[_0xd8d6('0x4d')];_0x75e45c[_0xd8d6('0x53')]=this['voiceQueues'][_0x75e45c[_0xd8d6('0x4d')]]&&this['voiceQueues'][_0x75e45c[_0xd8d6('0x4d')]][_0xd8d6('0x53')]?this[_0xd8d6('0x13')][_0x75e45c['queue']][_0xd8d6('0x53')]||'inbound':_0xd8d6('0x54');_0x75e45c[_0xd8d6('0x6e')]=moment()[_0xd8d6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x75e45c[_0xd8d6('0x6f')]=_0x1f4e50['position'];_0x75e45c[_0xd8d6('0x70')]=_0x1f4e50[_0xd8d6('0x70')];_0x75e45c[_0xd8d6('0x4a')]=_0x1f4e50['uniqueid'];_0x75e45c[_0xd8d6('0x71')]=this['channels'][_0x1f4e50['uniqueid']][_0xd8d6('0x71')];logger['info'](_0xd8d6('0x72'),_0x75e45c['queue'],_0x75e45c[_0xd8d6('0x53')]);Object[_0xd8d6('0x73')](_0x75e45c,_[_0xd8d6('0x74')](_0x1f4e50,_[_0xd8d6('0x75')](_0x75e45c)));this[_0xd8d6('0xe')][_0x1f4e50[_0xd8d6('0x4a')]][_0xd8d6('0x76')](_0x75e45c);this[_0xd8d6('0x11')][_0x1f4e50['uniqueid']]=_0x75e45c;this[_0xd8d6('0x47')](_0x75e45c,_0xd8d6('0x1e'));}}catch(_0x54c89a){logger[_0xd8d6('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1f4e50[_0xd8d6('0x4a')],util[_0xd8d6('0x3f')](_0x54c89a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd8d6('0xa')][_0xd8d6('0x77')]=function(_0x506f20){try{if(this[_0xd8d6('0x68')](_0x506f20)){logger[_0xd8d6('0x48')](_0xd8d6('0x78'),_0x506f20['uniqueid'],util[_0xd8d6('0x3f')](_0x506f20,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x506f20[_0xd8d6('0x4a')]]){var _0x4486a0=_[_0xd8d6('0x79')](this[_0xd8d6('0xe')][_0x506f20[_0xd8d6('0x4a')]]);_0x4486a0[_0xd8d6('0x36')]=![];_0x4486a0[_0xd8d6('0x7a')]=null;_0x4486a0[_0xd8d6('0x7b')]=_0x506f20[_0xd8d6('0x7b')];_0x4486a0[_0xd8d6('0x7c')]=_0x506f20[_0xd8d6('0x7c')];_0x4486a0[_0xd8d6('0x1f')]=!![];_0x4486a0['queuecallerabandonAt']=moment()['format'](_0xd8d6('0x7d'));_0x4486a0[_0xd8d6('0x7e')]=_0xd8d6('0x7f');_0x4486a0[_0xd8d6('0x80')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4486a0[_0xd8d6('0x4d')],_0x4486a0['type']);this['channels'][_0x506f20['uniqueid']]=_0x4486a0;this['emitVoiceQueueChannelRemove'](_0x4486a0,_0xd8d6('0x1f'));}}}catch(_0x19d11b){logger['error'](_0xd8d6('0x78'),_0x506f20['uniqueid'],util[_0xd8d6('0x3f')](_0x19d11b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd8d6('0xa')][_0xd8d6('0x81')]=function(_0x5dfa26){try{if(this['isNotNull'](_0x5dfa26)){logger['debug'](_0xd8d6('0x82'),_0x5dfa26[_0xd8d6('0x4a')],util[_0xd8d6('0x3f')](_0x5dfa26,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5dfa26[_0xd8d6('0x4a')]]){var _0x58a88b=_[_0xd8d6('0x79')](this[_0xd8d6('0xe')][_0x5dfa26[_0xd8d6('0x4a')]]);_0x58a88b[_0xd8d6('0x83')]=moment()[_0xd8d6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x58a88b['connectedlinenum']=_0x5dfa26[_0xd8d6('0x84')];_0x58a88b[_0xd8d6('0x85')]=_0x5dfa26[_0xd8d6('0x85')];logger[_0xd8d6('0x86')](_0xd8d6('0x87'),_0x58a88b['queue'],_0x58a88b['type'],_0x5dfa26[_0xd8d6('0x84')],_0x5dfa26[_0xd8d6('0x85')]);this[_0xd8d6('0x11')][_0x5dfa26[_0xd8d6('0x4a')]]=_0x58a88b;this[_0xd8d6('0x47')](_0x58a88b,_0xd8d6('0x20'));}}}catch(_0x14e146){logger[_0xd8d6('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x5dfa26[_0xd8d6('0x4a')],util[_0xd8d6('0x3f')](_0x14e146,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd8d6('0xa')][_0xd8d6('0x88')]=function(_0x268a97){try{if(this[_0xd8d6('0x68')](_0x268a97)){logger[_0xd8d6('0x48')](_0xd8d6('0x89'),_0x268a97['uniqueid'],util[_0xd8d6('0x3f')](_0x268a97,{'showHidden':![],'depth':null}));if(this[_0xd8d6('0xe')][_0x268a97[_0xd8d6('0x4a')]]){var _0x23c182=_[_0xd8d6('0x79')](this[_0xd8d6('0xe')][_0x268a97[_0xd8d6('0x4a')]]);_0x23c182['queuecallercomplete']=!![];_0x23c182[_0xd8d6('0x7e')]=_0xd8d6('0x8a');logger[_0xd8d6('0x86')](_0xd8d6('0x8b'),_0x23c182[_0xd8d6('0x4d')],_0x23c182['type']);}}}catch(_0xbbf04c){logger[_0xd8d6('0x40')](_0xd8d6('0x89'),_0x268a97[_0xd8d6('0x4a')],util[_0xd8d6('0x3f')](_0xbbf04c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd8d6('0xa')]['syncAgentComplete']=function(_0x400b1b){try{if(this['isNotNull'](_0x400b1b)){logger[_0xd8d6('0x48')](_0xd8d6('0x8c'),_0x400b1b[_0xd8d6('0x4a')],util[_0xd8d6('0x3f')](_0x400b1b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x400b1b[_0xd8d6('0x4a')]]){var _0x52f69c=_[_0xd8d6('0x79')](this[_0xd8d6('0xe')][_0x400b1b[_0xd8d6('0x4a')]]);_0x52f69c[_0xd8d6('0x1f')]=![];_0x52f69c[_0xd8d6('0x8d')]=null;_0x52f69c[_0xd8d6('0x8e')]=!![];_0x52f69c[_0xd8d6('0x80')]=_0x400b1b['membername'];_0x52f69c['holdtime']=_0x400b1b['holdtime'];_0x52f69c[_0xd8d6('0x36')]=!![];_0x52f69c['queuecallerexit']=![];_0x52f69c['queuecallerexitAt']=null;if(!_0x52f69c[_0xd8d6('0x8f')]){if(_0x400b1b[_0xd8d6('0x90')]==_0xd8d6('0x8f')){_0x52f69c[_0xd8d6('0x7e')]=_0xd8d6('0x91');logger[_0xd8d6('0x86')](_0xd8d6('0x92'),_0x52f69c[_0xd8d6('0x4d')],_0x52f69c[_0xd8d6('0x53')]);}else{if(_[_0xd8d6('0x93')](_0x400b1b[_0xd8d6('0x3b')]['toLowerCase'](),_0xd8d6('0x94'))){if(this['queueReports'][_0x400b1b['linkedid']]){var _0x3e0db2=_[_0xd8d6('0x79')](this[_0xd8d6('0xe')][_0x400b1b['linkedid']]);_0x3e0db2[_0xd8d6('0x36')]=![];_0x3e0db2[_0xd8d6('0x35')]=!![];_0x3e0db2[_0xd8d6('0x95')]=moment(_0x52f69c[_0xd8d6('0x6e')])[_0xd8d6('0x96')](_0x400b1b[_0xd8d6('0x7b')],_0xd8d6('0x97'))[_0xd8d6('0x4b')](_0xd8d6('0x7d'));_0x3e0db2[_0xd8d6('0x7e')]=_0xd8d6('0x98');_0x3e0db2['transfer']=!![];_0x3e0db2['transfertype']=_0xd8d6('0x99');_0x3e0db2[_0xd8d6('0x9a')]=_0x400b1b[_0xd8d6('0x9b')];_0x3e0db2[_0xd8d6('0x9c')]=_0x400b1b['uniqueid'];logger[_0xd8d6('0x86')](_0xd8d6('0x9d'),_0x3e0db2['queue'],_0x3e0db2[_0xd8d6('0x53')]);var _0x5b9be8=this['queueReports'][_0x400b1b['linkedid']];this[_0xd8d6('0xe')][_0x400b1b[_0xd8d6('0x9e')]]=this[_0xd8d6('0xe')][_0x400b1b[_0xd8d6('0x4a')]];this[_0xd8d6('0xe')][_0x400b1b[_0xd8d6('0x4a')]]=_0x5b9be8;}}else{_0x52f69c[_0xd8d6('0x7e')]=_0xd8d6('0x9f')+_0x400b1b['reason']['toUpperCase']();logger[_0xd8d6('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x52f69c[_0xd8d6('0x4d')],_0x52f69c[_0xd8d6('0x53')],_0x52f69c[_0xd8d6('0x7e')]);}}}this[_0xd8d6('0x11')][_0x400b1b['uniqueid']]=_0x52f69c;}}}catch(_0x372dde){logger[_0xd8d6('0x40')](_0xd8d6('0x8c'),_0x400b1b[_0xd8d6('0x4a')],util['inspect'](_0x372dde,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd8d6('0xa0')]=function(_0xb47a94){try{if(this['isNotNull'](_0xb47a94)){logger[_0xd8d6('0x48')]('[%s][voiceQueueReport][varset]',_0xb47a94[_0xd8d6('0x4a')],util[_0xd8d6('0x3f')](_0xb47a94,{'showHidden':![],'depth':null}));this[_0xd8d6('0xa1')](_0xb47a94[_0xd8d6('0x4a')],_[_0xd8d6('0x75')](_0xb47a94['variable'])[0x0],_0xb47a94[_0xd8d6('0xa2')]);if(this[_0xd8d6('0xe')][_0xb47a94[_0xd8d6('0x4a')]]){var _0x4763a8=_[_0xd8d6('0x79')](this[_0xd8d6('0xe')][_0xb47a94[_0xd8d6('0x4a')]]);if(_0x4763a8){if(this[_0xd8d6('0x68')](_0xb47a94['variable'])&&this[_0xd8d6('0x68')](_0xb47a94[_0xd8d6('0xa3')][_0xd8d6('0x5e')])){switch(_0xb47a94['value']){case _0xd8d6('0xa4'):_0x4763a8[_0xd8d6('0x35')]=![];_0x4763a8[_0xd8d6('0x95')]=null;break;case'TIMEOUT':_0x4763a8[_0xd8d6('0xa5')]=_0xd8d6('0xa6');_0x4763a8[_0xd8d6('0x35')]=!![];_0x4763a8['queuecallerexitAt']=moment()[_0xd8d6('0x4b')](_0xd8d6('0x7d'));_0x4763a8['queuecallerleaveAt']=moment()['format'](_0xd8d6('0x7d'));logger[_0xd8d6('0x48')](_0xd8d6('0xa7'),_0xb47a94[_0xd8d6('0x4a')],util['inspect'](_0x4763a8,{'showHidden':![],'depth':null}));ami[_0xd8d6('0x46')]('custom:timeout',_0x4763a8);break;default:_0x4763a8['queuecallerexit']=!![];_0x4763a8[_0xd8d6('0x95')]=moment()[_0xd8d6('0x4b')](_0xd8d6('0x7d'));_0x4763a8[_0xd8d6('0x83')]=moment()[_0xd8d6('0x4b')](_0xd8d6('0x7d'));}_0x4763a8['queuecallerabandon']=![];_0x4763a8[_0xd8d6('0x8d')]=null;_0x4763a8[_0xd8d6('0x7e')]=_0xb47a94[_0xd8d6('0xa2')];this[_0xd8d6('0x11')][_0xb47a94[_0xd8d6('0x4a')]]=_0x4763a8;this[_0xd8d6('0x44')](_0x4763a8,_0xd8d6('0xa8'));}else if(this['isNotNull'](_0xb47a94[_0xd8d6('0xa3')])&&this['isNotNull'](_0xb47a94[_0xd8d6('0xa3')][_0xd8d6('0xa9')])){if(!_0x4763a8['queuecallerabandon']){_0x4763a8[_0xd8d6('0x35')]=!![];_0x4763a8[_0xd8d6('0x95')]=moment()[_0xd8d6('0x4b')](_0xd8d6('0x7d'));_0x4763a8[_0xd8d6('0x7e')]=_0xd8d6('0xaa');_0x4763a8[_0xd8d6('0x83')]=moment()[_0xd8d6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd8d6('0x11')][_0xb47a94['uniqueid']]=_0x4763a8;}}logger['info'](_0xd8d6('0xab'),_0xb47a94['uniqueid'],_0x4763a8['queue'],_0x4763a8[_0xd8d6('0x53')],_[_0xd8d6('0x75')](_0xb47a94[_0xd8d6('0xa3')])[0x0],_0xb47a94[_0xd8d6('0xa2')]);_0x4763a8['variables']=this[_0xd8d6('0x16')][_0xb47a94['uniqueid']];}}}}catch(_0x37ebe6){logger[_0xd8d6('0x40')](_0xd8d6('0xac'),_0xb47a94['uniqueid'],util['inspect'](_0x37ebe6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd8d6('0xa')][_0xd8d6('0xa1')]=function(_0x13fa84,_0x5b9afd,_0x123226){var _0x36a10f=['rtpaudioqos',_0xd8d6('0xad'),'rtpaudioqosjitter',_0xd8d6('0xae'),_0xd8d6('0xaf'),_0xd8d6('0xb0'),_0xd8d6('0xb1'),_0xd8d6('0xb2'),_0xd8d6('0xb3'),_0xd8d6('0xb4'),_0xd8d6('0xb5'),'bridgepvtcallid',_0xd8d6('0xb6'),_0xd8d6('0xb7'),_0xd8d6('0xb8'),_0xd8d6('0xb9'),_0xd8d6('0xba'),_0xd8d6('0xbb'),_0xd8d6('0xbc')];if(!_[_0xd8d6('0x38')](_0x5b9afd)&&!_['includes'](_0x36a10f,_0x5b9afd)){if(_[_0xd8d6('0x6d')](this[_0xd8d6('0x16')][_0x13fa84])){this[_0xd8d6('0x16')][_0x13fa84]={};}this[_0xd8d6('0x16')][_0x13fa84][_0x5b9afd]=_0x123226;}};VoiceQueueReport[_0xd8d6('0xa')][_0xd8d6('0xbd')]=function(_0x3fd91d,_0x1068da,_0x52a448){try{var _0x5c3009={};if(this[_0xd8d6('0xe')][_0x3fd91d]){for(var _0x1d176a=0x0;_0x1d176a0x0?!![]:![];if(!_0x48dd5f){return this[_0x3f14('0x1a')](this[_0x3f14('0x15')][_0x3f14('0x6c')]);}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0x1c')]=function(_0x46e484){var _0x4e4ae7=this[_0x3f14('0x15')]['id'];if(this[_0x3f14('0x15')][_0x3f14('0x62')][_0x4e4ae7]&&this[_0x3f14('0x15')][_0x3f14('0x62')][_0x4e4ae7][_0x46e484[_0x3f14('0x60')]]){this[_0x3f14('0x15')][_0x3f14('0x62')][_0x4e4ae7][_0x46e484[_0x3f14('0x60')]]['agents'][_0x3f14('0x6d')](_0x46e484);}};VoiceQueueReport['prototype'][_0x3f14('0x6e')]=function(_0x14b7c6){var _0xe33a27=this;try{if(this['isNotNull'](_0x14b7c6)&&this[_0x3f14('0x6f')](_0x14b7c6[_0x3f14('0x55')])){logger[_0x3f14('0x4a')](_0x3f14('0x70'),util[_0x3f14('0x41')](_0x14b7c6,{'showHidden':![],'depth':null}));var _0x2489cb=this[_0x3f14('0x47')][_0x14b7c6[_0x3f14('0x55')]];if(_0x2489cb){logger['debug'](_0x3f14('0x71'),_0x2489cb['name']);this[_0x3f14('0x15')][_0x3f14('0x5d')][_0x2489cb[_0x3f14('0x59')]]={'summaryEvent':_0x14b7c6};this['summary'][_0x3f14('0x6b')]+=0x1;return ami[_0x3f14('0x5c')]({'action':_0x3f14('0x62'),'queue':_0x2489cb['name']})[_0x3f14('0x5f')](function(_0x37de06){if(!_0xe33a27[_0x3f14('0x15')][_0x3f14('0x62')][_0x14b7c6[_0x3f14('0x60')]]){_0xe33a27[_0x3f14('0x15')][_0x3f14('0x62')][_0x14b7c6[_0x3f14('0x60')]]={};}_0xe33a27[_0x3f14('0x15')][_0x3f14('0x62')][_0x14b7c6[_0x3f14('0x60')]][_0x37de06[_0x3f14('0x60')]]={'queue':_0x2489cb['name'],'agents':[]};})['catch'](function(_0x339154){throw _0x339154;});}}}catch(_0x2446e3){logger[_0x3f14('0x3f')](_0x3f14('0x64'),util[_0x3f14('0x41')](_0x2446e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0x1a')]=function(_0x176c58){if(this[_0x3f14('0x15')]['statusRequests']>0x0){this[_0x3f14('0x15')][_0x3f14('0x6c')]=_0x176c58;return;}logger['debug'](_0x3f14('0x72'),util['inspect'](_0x176c58,{'showHidden':![],'depth':null}));this[_0x3f14('0x15')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0x3f14('0x73')]=function(_0x3b25ad){try{if(this['isNotNull'](_0x3b25ad)){logger[_0x3f14('0x4a')](_0x3f14('0x74'),_0x3b25ad[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x3b25ad,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3f14('0x10')][_0x3b25ad[_0x3f14('0x52')]])){this[_0x3f14('0x10')][_0x3b25ad[_0x3f14('0x52')]]=[];}if(_[_0x3f14('0x5b')](this[_0x3f14('0x13')][_0x3b25ad[_0x3f14('0x52')]])){this['channels'][_0x3b25ad[_0x3f14('0x52')]]={};}var _0x4fc9cf=new QueueReport();_0x4fc9cf[_0x3f14('0x55')]=_0x3b25ad[_0x3f14('0x55')];_0x4fc9cf[_0x3f14('0x69')]=this[_0x3f14('0x47')][_0x4fc9cf[_0x3f14('0x55')]]&&this[_0x3f14('0x47')][_0x4fc9cf[_0x3f14('0x55')]][_0x3f14('0x69')]?this[_0x3f14('0x47')][_0x4fc9cf[_0x3f14('0x55')]][_0x3f14('0x69')]||_0x3f14('0x58'):_0x3f14('0x58');_0x4fc9cf[_0x3f14('0x75')]=moment()['format'](_0x3f14('0x76'));_0x4fc9cf[_0x3f14('0x77')]=_0x3b25ad[_0x3f14('0x77')];_0x4fc9cf[_0x3f14('0x78')]=_0x3b25ad[_0x3f14('0x78')];_0x4fc9cf[_0x3f14('0x52')]=_0x3b25ad['uniqueid'];_0x4fc9cf[_0x3f14('0x79')]=this[_0x3f14('0x13')][_0x3b25ad[_0x3f14('0x52')]][_0x3f14('0x79')];logger[_0x3f14('0x7a')](_0x3f14('0x7b'),_0x4fc9cf[_0x3f14('0x55')],_0x4fc9cf[_0x3f14('0x69')]);Object['assign'](_0x4fc9cf,_['pick'](_0x3b25ad,_['keys'](_0x4fc9cf)));this[_0x3f14('0x10')][_0x3b25ad[_0x3f14('0x52')]]['push'](_0x4fc9cf);this[_0x3f14('0x13')][_0x3b25ad['uniqueid']]=_0x4fc9cf;this[_0x3f14('0x7c')](_0x4fc9cf,_0x3f14('0x1f'));}}catch(_0x237708){logger[_0x3f14('0x3f')](_0x3f14('0x74'),_0x3b25ad[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x237708,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x5afd5a){try{if(this[_0x3f14('0x6f')](_0x5afd5a)){logger['debug'](_0x3f14('0x7d'),_0x5afd5a[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x5afd5a,{'showHidden':![],'depth':null}));if(this[_0x3f14('0x10')][_0x5afd5a['uniqueid']]){var _0x2f218a=_[_0x3f14('0x7e')](this[_0x3f14('0x10')][_0x5afd5a[_0x3f14('0x52')]]);_0x2f218a[_0x3f14('0x37')]=![];_0x2f218a[_0x3f14('0x7f')]=null;_0x2f218a[_0x3f14('0x80')]=_0x5afd5a['holdtime'];_0x2f218a[_0x3f14('0x81')]=_0x5afd5a[_0x3f14('0x81')];_0x2f218a[_0x3f14('0x20')]=!![];_0x2f218a[_0x3f14('0x82')]=moment()[_0x3f14('0x4e')](_0x3f14('0x76'));_0x2f218a[_0x3f14('0x53')]='ABANDONED';_0x2f218a[_0x3f14('0x83')]=null;logger[_0x3f14('0x7a')](_0x3f14('0x84'),_0x2f218a['queue'],_0x2f218a[_0x3f14('0x69')]);this[_0x3f14('0x13')][_0x5afd5a['uniqueid']]=_0x2f218a;this[_0x3f14('0x48')](_0x2f218a,'queuecallerabandon');}}}catch(_0x5310fc){logger[_0x3f14('0x3f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5afd5a[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x5310fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0x22')]=function(_0x5445b2){try{if(this[_0x3f14('0x6f')](_0x5445b2)){logger[_0x3f14('0x4a')]('[%s][voiceQueueReport][queuecallerleave]',_0x5445b2[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x5445b2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5445b2[_0x3f14('0x52')]]){var _0x1e48e2=_['last'](this[_0x3f14('0x10')][_0x5445b2[_0x3f14('0x52')]]);_0x1e48e2[_0x3f14('0x85')]=moment()[_0x3f14('0x4e')](_0x3f14('0x76'));_0x1e48e2['connectedlinenum']=_0x5445b2['connectedlinenum'];_0x1e48e2[_0x3f14('0x86')]=_0x5445b2[_0x3f14('0x86')];logger[_0x3f14('0x7a')](_0x3f14('0x87'),_0x1e48e2[_0x3f14('0x55')],_0x1e48e2[_0x3f14('0x69')],_0x5445b2[_0x3f14('0x88')],_0x5445b2[_0x3f14('0x86')]);this[_0x3f14('0x13')][_0x5445b2['uniqueid']]=_0x1e48e2;this[_0x3f14('0x7c')](_0x1e48e2,_0x3f14('0x21'));}}}catch(_0x3af252){logger['error'](_0x3f14('0x89'),_0x5445b2['uniqueid'],util[_0x3f14('0x41')](_0x3af252,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0x8a')]=function(_0x3a74ff){try{if(this['isNotNull'](_0x3a74ff)){logger[_0x3f14('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x3a74ff[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x3a74ff,{'showHidden':![],'depth':null}));if(this[_0x3f14('0x10')][_0x3a74ff[_0x3f14('0x52')]]){var _0x6e7c65=_[_0x3f14('0x7e')](this[_0x3f14('0x10')][_0x3a74ff[_0x3f14('0x52')]]);_0x6e7c65[_0x3f14('0x37')]=!![];_0x6e7c65[_0x3f14('0x53')]=_0x3f14('0x8b');logger['info'](_0x3f14('0x8c'),_0x6e7c65[_0x3f14('0x55')],_0x6e7c65[_0x3f14('0x69')]);}}}catch(_0x1c1582){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x3a74ff[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x1c1582,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f14('0x38')]['syncAgentComplete']=function(_0xaf06de){try{if(this[_0x3f14('0x6f')](_0xaf06de)){logger[_0x3f14('0x4a')](_0x3f14('0x8d'),_0xaf06de[_0x3f14('0x52')],util[_0x3f14('0x41')](_0xaf06de,{'showHidden':![],'depth':null}));if(this[_0x3f14('0x10')][_0xaf06de[_0x3f14('0x52')]]){var _0xa132f=_['last'](this[_0x3f14('0x10')][_0xaf06de[_0x3f14('0x52')]]);_0xa132f['queuecallerabandon']=![];_0xa132f[_0x3f14('0x82')]=null;_0xa132f[_0x3f14('0x8e')]=!![];_0xa132f[_0x3f14('0x83')]=_0xaf06de[_0x3f14('0x8f')];_0xa132f[_0x3f14('0x80')]=_0xaf06de[_0x3f14('0x80')];_0xa132f[_0x3f14('0x37')]=!![];_0xa132f[_0x3f14('0x36')]=![];_0xa132f[_0x3f14('0x90')]=null;if(!_0xa132f[_0x3f14('0x91')]){if(_0xaf06de['reason']==_0x3f14('0x91')){_0xa132f[_0x3f14('0x53')]='COMPLETED';logger[_0x3f14('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xa132f[_0x3f14('0x55')],_0xa132f[_0x3f14('0x69')]);}else{if(_[_0x3f14('0x92')](_0xaf06de[_0x3f14('0x3c')][_0x3f14('0x93')](),_0x3f14('0x94'))){if(this[_0x3f14('0x10')][_0xaf06de[_0x3f14('0x95')]]){var _0x342f98=_[_0x3f14('0x7e')](this['queueReports'][_0xaf06de[_0x3f14('0x95')]]);_0x342f98[_0x3f14('0x37')]=![];_0x342f98['queuecallerexit']=!![];_0x342f98['queuecallerexitAt']=moment(_0xa132f[_0x3f14('0x75')])[_0x3f14('0x96')](_0xaf06de[_0x3f14('0x80')],_0x3f14('0x97'))[_0x3f14('0x4e')](_0x3f14('0x76'));_0x342f98[_0x3f14('0x53')]=_0x3f14('0x98');_0x342f98[_0x3f14('0x91')]=!![];_0x342f98['transfertype']=_0x3f14('0x99');_0x342f98[_0x3f14('0x9a')]=_0xaf06de['destexten'];_0x342f98['transferuniqueid']=_0xaf06de[_0x3f14('0x52')];logger['info'](_0x3f14('0x9b'),_0x342f98[_0x3f14('0x55')],_0x342f98[_0x3f14('0x69')]);var _0xdc09c9=this['queueReports'][_0xaf06de['linkedid']];this[_0x3f14('0x10')][_0xaf06de['linkedid']]=this[_0x3f14('0x10')][_0xaf06de['uniqueid']];this[_0x3f14('0x10')][_0xaf06de['uniqueid']]=_0xdc09c9;}}else{_0xa132f['queuecallerexitreason']=_0x3f14('0x9c')+_0xaf06de[_0x3f14('0x9d')][_0x3f14('0x9e')]();logger[_0x3f14('0x7a')](_0x3f14('0x9f'),_0xa132f[_0x3f14('0x55')],_0xa132f[_0x3f14('0x69')],_0xa132f[_0x3f14('0x53')]);}}}this[_0x3f14('0x13')][_0xaf06de[_0x3f14('0x52')]]=_0xa132f;}}}catch(_0x4a51de){logger[_0x3f14('0x3f')](_0x3f14('0x8d'),_0xaf06de[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x4a51de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0x24')]=function(_0x191bc8){try{if(this['isNotNull'](_0x191bc8)){logger[_0x3f14('0x4a')]('[%s][voiceQueueReport][varset]',_0x191bc8[_0x3f14('0x52')],util['inspect'](_0x191bc8,{'showHidden':![],'depth':null}));this[_0x3f14('0xa0')](_0x191bc8['uniqueid'],_[_0x3f14('0xa1')](_0x191bc8[_0x3f14('0xa2')])[0x0],_0x191bc8['value']);if(this['queueReports'][_0x191bc8[_0x3f14('0x52')]]){var _0x42792b=_[_0x3f14('0x7e')](this['queueReports'][_0x191bc8[_0x3f14('0x52')]]);if(_0x42792b){if(this['isNotNull'](_0x191bc8[_0x3f14('0xa2')])&&this['isNotNull'](_0x191bc8[_0x3f14('0xa2')]['queuestatus'])){switch(_0x191bc8[_0x3f14('0xa3')]){case _0x3f14('0xa4'):_0x42792b[_0x3f14('0x36')]=![];_0x42792b[_0x3f14('0x90')]=null;break;case _0x3f14('0xa5'):_0x42792b[_0x3f14('0xa6')]=_0x3f14('0xa7');_0x42792b[_0x3f14('0x36')]=!![];_0x42792b[_0x3f14('0x90')]=moment()['format'](_0x3f14('0x76'));_0x42792b['queuecallerleaveAt']=moment()[_0x3f14('0x4e')](_0x3f14('0x76'));logger[_0x3f14('0x4a')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x191bc8[_0x3f14('0x52')],util[_0x3f14('0x41')](_0x42792b,{'showHidden':![],'depth':null}));ami[_0x3f14('0x4d')]('custom:timeout',_0x42792b);break;default:_0x42792b[_0x3f14('0x36')]=!![];_0x42792b[_0x3f14('0x90')]=moment()[_0x3f14('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x42792b[_0x3f14('0x85')]=moment()[_0x3f14('0x4e')](_0x3f14('0x76'));}_0x42792b[_0x3f14('0x20')]=![];_0x42792b[_0x3f14('0x82')]=null;_0x42792b[_0x3f14('0x53')]=_0x191bc8['value'];this['channels'][_0x191bc8[_0x3f14('0x52')]]=_0x42792b;this[_0x3f14('0x48')](_0x42792b,'varset');}else if(this['isNotNull'](_0x191bc8[_0x3f14('0xa2')])&&this[_0x3f14('0x6f')](_0x191bc8[_0x3f14('0xa2')][_0x3f14('0xa8')])){if(!_0x42792b[_0x3f14('0x20')]){_0x42792b[_0x3f14('0x36')]=!![];_0x42792b[_0x3f14('0x90')]=moment()[_0x3f14('0x4e')](_0x3f14('0x76'));_0x42792b['queuecallerexitreason']=_0x3f14('0xa9');_0x42792b[_0x3f14('0x85')]=moment()['format'](_0x3f14('0x76'));this['channels'][_0x191bc8['uniqueid']]=_0x42792b;}}logger[_0x3f14('0x7a')](_0x3f14('0xaa'),_0x191bc8['uniqueid'],_0x42792b[_0x3f14('0x55')],_0x42792b[_0x3f14('0x69')],_['keys'](_0x191bc8['variable'])[0x0],_0x191bc8[_0x3f14('0xa3')]);_0x42792b[_0x3f14('0x16')]=this[_0x3f14('0x16')][_0x191bc8[_0x3f14('0x52')]];}}}}catch(_0x50c362){logger[_0x3f14('0x3f')](_0x3f14('0xab'),_0x191bc8[_0x3f14('0x52')],util['inspect'](_0x50c362,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0xa0')]=function(_0x26035d,_0x2cec67,_0xaeaac7){var _0x4e3584=[_0x3f14('0xac'),_0x3f14('0xad'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x3f14('0xae'),_0x3f14('0xaf'),'rtpaudioqosrtt',_0x3f14('0xb0'),_0x3f14('0xb1'),_0x3f14('0xb2'),_0x3f14('0xb3'),'bridgepvtcallid',_0x3f14('0xb4'),_0x3f14('0xb5'),_0x3f14('0xb6'),_0x3f14('0xb7'),_0x3f14('0x8f'),_0x3f14('0xb8'),_0x3f14('0xb9')];if(!_[_0x3f14('0xba')](_0x2cec67)&&!_['includes'](_0x4e3584,_0x2cec67)){if(_[_0x3f14('0x5b')](this[_0x3f14('0x16')][_0x26035d])){this[_0x3f14('0x16')][_0x26035d]={};}this[_0x3f14('0x16')][_0x26035d][_0x2cec67]=_0xaeaac7;}};VoiceQueueReport[_0x3f14('0x38')][_0x3f14('0xbb')]=function(_0x337118,_0x22b7ad,_0x52237b){try{var _0x44f56e={};if(this[_0x3f14('0x10')][_0x337118]){for(var _0x1bcafa=0x0;_0x1bcafa=0x0?moment(_0x5777ea[_0x8202('0x19')])['diff'](_0x5777ea[_0x8202('0x18')],'seconds'):null,'data1':_0x8202('0x1a'),'data2':_0x5777ea['accountcode'],'data3':_0x5777ea[_0x8202('0x11')],'data4':_0x5777ea[_0x8202('0x1b')]||null,'role':_0x8202('0x13'),'internal':_0x5777ea['accountcode']?_[_0x8202('0x15')](_0x5777ea[_0x8202('0x14')]):undefined,'uniqueid':_0x5777ea[_0x8202('0x1c')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xdd1d=['SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voice','starttime','endtime','dialstring','toNumber','moment','lodash','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','isNil','interface'];(function(_0x13975f,_0xd8c5ce){var _0x4ce763=function(_0x5d5861){while(--_0x5d5861){_0x13975f['push'](_0x13975f['shift']());}};_0x4ce763(++_0xd8c5ce);}(_0xdd1d,0x1a7));var _0xddd1=function(_0x4c32f5,_0x3dbbf1){_0x4c32f5=_0x4c32f5-0x0;var _0x19cae9=_0xdd1d[_0x4c32f5];return _0x19cae9;};'use strict';var moment=require(_0xddd1('0x0'));var _=require(_0xddd1('0x1'));var util=require('util');var client=require(_0xddd1('0x2'));exports['voiceQueueReport']=function(_0x361aa3){var _0x1a1b02=_0x361aa3[_0xddd1('0x3')]||_0x361aa3[_0xddd1('0x4')];return client[_0xddd1('0x5')](_0xddd1('0x6'),{'body':{'channel':'voice','membername':_0x361aa3['lastAssignedTo'],'interface':_[_0xddd1('0x7')](_0x361aa3[_0xddd1('0x8')])?util['format'](_0xddd1('0x9'),_0x361aa3[_0xddd1('0xa')]):_0x361aa3[_0xddd1('0x8')],'type':_0xddd1('0xb'),'enterAt':_0x361aa3[_0xddd1('0xc')],'exitAt':_0x1a1b02,'duration':moment(_0x1a1b02)[_0xddd1('0xd')](_0x361aa3[_0xddd1('0xc')],_0xddd1('0xe')),'data1':_0xddd1('0xf'),'data2':_0x361aa3[_0xddd1('0x10')],'data3':_0x361aa3[_0xddd1('0x11')],'data4':null,'data5':_0x361aa3[_0xddd1('0x12')],'role':_0xddd1('0x13'),'internal':_0x361aa3[_0xddd1('0x14')]?_['toNumber'](_0x361aa3[_0xddd1('0x14')]):undefined,'uniqueid':_0x361aa3[_0xddd1('0x15')]},'log':_0xddd1('0x6')});};exports['voiceDialReport']=function(_0x7a74e8){return client['Request'](_0xddd1('0x6'),{'body':{'channel':_0xddd1('0x16'),'membername':_0x7a74e8['membername'],'interface':_0x7a74e8[_0xddd1('0x8')],'type':_0xddd1('0xb'),'enterAt':_0x7a74e8[_0xddd1('0x17')],'exitAt':_0x7a74e8[_0xddd1('0x18')],'duration':moment(_0x7a74e8[_0xddd1('0x18')])['diff'](_0x7a74e8[_0xddd1('0x17')],_0xddd1('0xe'))>=0x0?moment(_0x7a74e8[_0xddd1('0x18')])[_0xddd1('0xd')](_0x7a74e8[_0xddd1('0x17')],'seconds'):null,'data1':'outbound','data2':_0x7a74e8[_0xddd1('0x14')],'data3':_0x7a74e8[_0xddd1('0x11')],'data4':_0x7a74e8[_0xddd1('0x19')]||null,'role':_0xddd1('0x13'),'internal':_0x7a74e8['accountcode']?_[_0xddd1('0x1a')](_0x7a74e8[_0xddd1('0x14')]):undefined,'uniqueid':_0x7a74e8[_0xddd1('0x15')]},'log':_0xddd1('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e0aba61..d2c3d9e 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 _0x13ae=['stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x13ae,0xe6));var _0xe13a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x13ae[_0x4565bf];return _0x5610ba;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe13a('0x0'),_0xe13a('0x1')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xa195=['getSettings','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0xa195,0x1b2));var _0x5a19=function(_0x564d9d,_0x5bfd1f){_0x564d9d=_0x564d9d-0x0;var _0x1f76c2=_0xa195[_0x564d9d];return _0x1f76c2;};'use strict';var client=require(_0x5a19('0x0'));exports[_0x5a19('0x1')]=function(){return client['Request'](_0x5a19('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5a19('0x3'),'previewRecallmeReminderInterval']},'log':_0x5a19('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 05bbdcb..512edb3 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 _0x1677=['GetTemplate','name','html','getTemplates'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1677,0x18f));var _0x7167=function(_0x55cf52,_0x2cf5c8){_0x55cf52=_0x55cf52-0x0;var _0x3a56de=_0x1677[_0x55cf52];return _0x3a56de;};'use strict';var client=require('../client');exports[_0x7167('0x0')]=function(_0x4c05f0){return function(_0xedabe0){return client['Request'](_0x7167('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7167('0x2'),_0x7167('0x3')]},'log':_0x7167('0x1')});};}; \ No newline at end of file +var _0x883e=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x597fbd,_0x148bc8){var _0xf5b6ed=function(_0x1738e2){while(--_0x1738e2){_0x597fbd['push'](_0x597fbd['shift']());}};_0xf5b6ed(++_0x148bc8);}(_0x883e,0xd0));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe883('0x0'));exports[_0xe883('0x1')]=function(_0xe29d12){return function(_0x53bba4){return client[_0xe883('0x2')](_0xe883('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe883('0x4'),_0xe883('0x5')]},'log':_0xe883('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c21050c..28e4783 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 _0x1552=['data3','data4','data7','Request','GetTrigger','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','action','data1'];(function(_0x593327,_0x438272){var _0x46b5d2=function(_0x524f8f){while(--_0x524f8f){_0x593327['push'](_0x593327['shift']());}};_0x46b5d2(++_0x438272);}(_0x1552,0xd5));var _0x2155=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x1552[_0x3430aa];return _0x2ac5c;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x1d8056){return function(_0x2a6713){return client[_0x2155('0x0')](_0x2155('0x1'),{'options':{'raw':![],'attributes':['id','name','channel',_0x2155('0x2')],'include':[{'model':_0x2155('0x3'),'as':_0x2155('0x4'),'attributes':['id',_0x2155('0x5'),_0x2155('0x6'),'value']},{'model':_0x2155('0x3'),'as':_0x2155('0x7'),'attributes':['id',_0x2155('0x5'),_0x2155('0x6'),_0x2155('0x8')]},{'model':_0x2155('0x9'),'as':'Actions','attributes':['id',_0x2155('0xa'),_0x2155('0xb'),'data2',_0x2155('0xc'),_0x2155('0xd'),'data5','data6',_0x2155('0xe')]}]},'log':_0x2155('0x1')});};}; \ No newline at end of file +var _0xdb34=['../client','getTriggers','channel','status','Condition','AllConditions','field','operator','AnyConditions','Actions','action','data1','data2','data3','data4','data5','data7','GetTrigger'];(function(_0x3ac0ca,_0x5697e7){var _0xa17da2=function(_0x5b1a11){while(--_0x5b1a11){_0x3ac0ca['push'](_0x3ac0ca['shift']());}};_0xa17da2(++_0x5697e7);}(_0xdb34,0x120));var _0x4db3=function(_0x7dbf2d,_0x48b480){_0x7dbf2d=_0x7dbf2d-0x0;var _0x42998d=_0xdb34[_0x7dbf2d];return _0x42998d;};'use strict';var client=require(_0x4db3('0x0'));exports[_0x4db3('0x1')]=function(_0x2543cb){return function(_0x4ae1a0){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x4db3('0x2'),_0x4db3('0x3')],'include':[{'model':_0x4db3('0x4'),'as':_0x4db3('0x5'),'attributes':['id',_0x4db3('0x6'),_0x4db3('0x7'),'value']},{'model':'Condition','as':_0x4db3('0x8'),'attributes':['id',_0x4db3('0x6'),'operator','value']},{'model':'Action','as':_0x4db3('0x9'),'attributes':['id',_0x4db3('0xa'),_0x4db3('0xb'),_0x4db3('0xc'),_0x4db3('0xd'),_0x4db3('0xe'),_0x4db3('0xf'),'data6',_0x4db3('0x10')]}]},'log':_0x4db3('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f9614e7..60824db 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 _0xa25a=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x1115df,_0x121e5a){var _0x3283d7=function(_0x1c9da7){while(--_0x1c9da7){_0x1115df['push'](_0x1115df['shift']());}};_0x3283d7(++_0x121e5a);}(_0xa25a,0x160));var _0xaa25=function(_0xacef71,_0x2e58c2){_0xacef71=_0xacef71-0x0;var _0x4df6de=_0xa25a[_0xacef71];return _0x4df6de;};'use strict';var client=require(_0xaa25('0x0'));exports[_0xaa25('0x1')]=function(_0x212df1){return function(_0x22c967){return client[_0xaa25('0x2')](_0xaa25('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaa25('0x4'),_0xaa25('0x5'),_0xaa25('0x6')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x5183=['../client','getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x5183,0x13e));var _0x3518=function(_0x384437,_0x5a1178){_0x384437=_0x384437-0x0;var _0x1c8dea=_0x5183[_0x384437];return _0x1c8dea;};'use strict';var client=require(_0x3518('0x0'));exports[_0x3518('0x1')]=function(_0x3fc620){return function(_0x4de025){return client['Request'](_0x3518('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3518('0x3'),_0x3518('0x4'),_0x3518('0x5')]},'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 e8f4fb6..8c107d3 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x4e01bf,_0x2748ec){var _0x42857e=function(_0x1f5df9){while(--_0x1f5df9){_0x4e01bf['push'](_0x4e01bf['shift']());}};_0x42857e(++_0x2748ec);}(_0x70e0,0x17b));var _0x070e=function(_0xda9310,_0x265fb3){_0xda9310=_0xda9310-0x0;var _0x337d94=_0x70e0[_0xda9310];return _0x337d94;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x53435d,_0x19a791){var _0x4c1ee6=function(_0x120dde){while(--_0x120dde){_0x53435d['push'](_0x53435d['shift']());}};_0x4c1ee6(++_0x19a791);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index dc6ffdb..7604d97 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 _0x0998=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x157907,_0x3a9ea3){var _0x37bada=function(_0x27f09e){while(--_0x27f09e){_0x157907['push'](_0x157907['shift']());}};_0x37bada(++_0x3a9ea3);}(_0x0998,0xe5));var _0x8099=function(_0x1485cf,_0x3eff35){_0x1485cf=_0x1485cf-0x0;var _0x7a0e54=_0x0998[_0x1485cf];return _0x7a0e54;};'use strict';var client=require(_0x8099('0x0'));exports[_0x8099('0x1')]=function(_0x3c7951){return client[_0x8099('0x2')](_0x8099('0x3'),{'body':_0x3c7951,'log':_0x8099('0x3')});};exports[_0x8099('0x4')]=function(_0x3d7d58,_0x1a49c6,_0x2e040b){return client[_0x8099('0x2')](_0x8099('0x5'),{'body':_0x3d7d58,'options':{'where':{'uniqueid':_0x1a49c6,'interface':_0x2e040b,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xc7c2=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x512bb9,_0x254b3d){var _0x3695b3=function(_0x20729f){while(--_0x20729f){_0x512bb9['push'](_0x512bb9['shift']());}};_0x3695b3(++_0x254b3d);}(_0xc7c2,0x190));var _0x2c7c=function(_0x7dcf99,_0x36284c){_0x7dcf99=_0x7dcf99-0x0;var _0x3c18c3=_0xc7c2[_0x7dcf99];return _0x3c18c3;};'use strict';var client=require('../client');exports['create']=function(_0x72df96){return client[_0x2c7c('0x0')](_0x2c7c('0x1'),{'body':_0x72df96,'log':_0x2c7c('0x1')});};exports[_0x2c7c('0x2')]=function(_0x2d58a5,_0x3b0b4e,_0x4513b5){return client[_0x2c7c('0x0')](_0x2c7c('0x3'),{'body':_0x2d58a5,'options':{'where':{'uniqueid':_0x3b0b4e,'interface':_0x4513b5,'agentcomplete':!![]}},'log':_0x2c7c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index de1f008..0b3252d 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 _0xb426=['util','../client','create','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment'];(function(_0x11dcf0,_0x4eb137){var _0x4f9831=function(_0x2d278e){while(--_0x2d278e){_0x11dcf0['push'](_0x11dcf0['shift']());}};_0x4f9831(++_0x4eb137);}(_0xb426,0xef));var _0x6b42=function(_0x593e71,_0x31ba76){_0x593e71=_0x593e71-0x0;var _0x4f73b5=_0xb426[_0x593e71];return _0x4f73b5;};'use strict';var moment=require(_0x6b42('0x0'));var util=require(_0x6b42('0x1'));var _=require('lodash');var client=require(_0x6b42('0x2'));exports[_0x6b42('0x3')]=function(_0x2b421b){return client['Request']('CreateVoiceCallReport',{'body':_[_0x6b42('0x4')](_0x2b421b,{'source':_0x2b421b['calleridnum'],'destinationcontext':_0x2b421b[_0x6b42('0x5')],'callerid':_0x2b421b[_0x6b42('0x6')],'amaflags':_0x6b42('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x6b42('0x8')]=function(){return function(){return client[_0x6b42('0x9')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x6b42('0xa')],'createdAt':{'$between':[moment()[_0x6b42('0xb')](_0x6b42('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x6b42('0xd')](_0x6b42('0xc'))[_0x6b42('0xe')](_0x6b42('0xf'))]}},'attributes':[_0x6b42('0x10'),'disposition',_0x6b42('0x11'),_0x6b42('0x12')]},'log':_0x6b42('0x13')});};}; \ No newline at end of file +var _0xa6ea=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','util','lodash','create','Request','merge','calleridnum','context','callerid','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x20fb8b,_0xfe0c4f){var _0x3b1d17=function(_0x508517){while(--_0x508517){_0x20fb8b['push'](_0x20fb8b['shift']());}};_0x3b1d17(++_0xfe0c4f);}(_0xa6ea,0x10c));var _0xaa6e=function(_0x42bcdf,_0x4c88ec){_0x42bcdf=_0x42bcdf-0x0;var _0x4cf062=_0xa6ea[_0x42bcdf];return _0x4cf062;};'use strict';var moment=require('moment');var util=require(_0xaa6e('0x0'));var _=require(_0xaa6e('0x1'));var client=require('../client');exports[_0xaa6e('0x2')]=function(_0x2149b3){return client[_0xaa6e('0x3')]('CreateVoiceCallReport',{'body':_[_0xaa6e('0x4')](_0x2149b3,{'source':_0x2149b3[_0xaa6e('0x5')],'destinationcontext':_0x2149b3[_0xaa6e('0x6')],'callerid':_0x2149b3[_0xaa6e('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0xaa6e('0x8')});};exports[_0xaa6e('0x9')]=function(){return function(){return client[_0xaa6e('0x3')](_0xaa6e('0xa'),{'options':{'where':{'type':[_0xaa6e('0xb')],'createdAt':{'$between':[moment()[_0xaa6e('0xc')](_0xaa6e('0xd'))[_0xaa6e('0xe')](_0xaa6e('0xf')),moment()[_0xaa6e('0x10')](_0xaa6e('0xd'))[_0xaa6e('0xe')](_0xaa6e('0xf'))]}},'attributes':[_0xaa6e('0x11'),_0xaa6e('0x12'),_0xaa6e('0x13'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 260fe19..172d7ef 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 _0x03d7=['Request','CreateVoiceDialReport','../client','create'];(function(_0x33c534,_0x50a3ce){var _0x1eb737=function(_0x5142d6){while(--_0x5142d6){_0x33c534['push'](_0x33c534['shift']());}};_0x1eb737(++_0x50a3ce);}(_0x03d7,0x1ce));var _0x703d=function(_0x56dbf6,_0x262a10){_0x56dbf6=_0x56dbf6-0x0;var _0x3dd600=_0x03d7[_0x56dbf6];return _0x3dd600;};'use strict';var client=require(_0x703d('0x0'));exports[_0x703d('0x1')]=function(_0x14012){return client[_0x703d('0x2')]('CreateVoiceDialReport',{'body':_0x14012,'log':_0x703d('0x3')});}; \ No newline at end of file +var _0xb068=['../client','create','Request','CreateVoiceDialReport'];(function(_0x594e94,_0x439af6){var _0x295e87=function(_0x54b008){while(--_0x54b008){_0x594e94['push'](_0x594e94['shift']());}};_0x295e87(++_0x439af6);}(_0xb068,0x1a4));var _0x8b06=function(_0x1e70fa,_0x2311f9){_0x1e70fa=_0x1e70fa-0x0;var _0x286083=_0xb068[_0x1e70fa];return _0x286083;};'use strict';var client=require(_0x8b06('0x0'));exports[_0x8b06('0x1')]=function(_0x1bd68c){return client[_0x8b06('0x2')]('CreateVoiceDialReport',{'body':_0x1bd68c,'log':_0x8b06('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c9e63a0..e7d0279 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 _0x0102=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x3e06b1,_0x5c0dc4){var _0x239e70=function(_0x277bb3){while(--_0x277bb3){_0x3e06b1['push'](_0x3e06b1['shift']());}};_0x239e70(++_0x5c0dc4);}(_0x0102,0x186));var _0x2010=function(_0x3694f,_0x25c74c){_0x3694f=_0x3694f-0x0;var _0x537422=_0x0102[_0x3694f];return _0x537422;};'use strict';var client=require('../client');exports[_0x2010('0x0')]=function(){return function(){return client[_0x2010('0x1')](_0x2010('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2010('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xf6fb=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xf6fb,0x111));var _0xbf6f=function(_0x3bffc7,_0x3cd860){_0x3bffc7=_0x3bffc7-0x0;var _0x297421=_0xf6fb[_0x3bffc7];return _0x297421;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xbf6f('0x0')](_0xbf6f('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0xbf6f('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xbf6f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index f03a245..52e4886 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 _0x6c48=['mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause'];(function(_0x596129,_0x34b27f){var _0x447bf5=function(_0x1a5296){while(--_0x1a5296){_0x596129['push'](_0x596129['shift']());}};_0x447bf5(++_0x34b27f);}(_0x6c48,0x7f));var _0x86c4=function(_0x1a4362,_0x2b98d8){_0x1a4362=_0x1a4362-0x0;var _0x57f069=_0x6c48[_0x1a4362];return _0x57f069;};'use strict';var client=require(_0x86c4('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x86c4('0x1')](_0x86c4('0x2'),{'options':{'raw':![],'attributes':['id',_0x86c4('0x3'),_0x86c4('0x4'),_0x86c4('0x5'),_0x86c4('0x6'),_0x86c4('0x7'),'type',_0x86c4('0x8'),'dialMethod',_0x86c4('0x9'),_0x86c4('0xa'),_0x86c4('0xb'),_0x86c4('0xc'),_0x86c4('0xd'),_0x86c4('0xe'),_0x86c4('0xf'),_0x86c4('0x10'),_0x86c4('0x11'),_0x86c4('0x12'),'dialQueueTimeout',_0x86c4('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x86c4('0x14'),'dialNoAnswerMaxRetry',_0x86c4('0x15'),_0x86c4('0x16'),'dialTimezone','dialGlobalInterval',_0x86c4('0x17'),'dialCheckDuplicateType',_0x86c4('0x18'),_0x86c4('0x19'),_0x86c4('0x1a'),_0x86c4('0x1b'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x86c4('0x1c'),'dialAMDMaximumNumberOfWords',_0x86c4('0x1d'),_0x86c4('0x1e'),_0x86c4('0x1f'),_0x86c4('0x20'),_0x86c4('0x21'),_0x86c4('0x22'),'dialAgiAfterHangupAgent',_0x86c4('0x23'),'dialQueueProject2',_0x86c4('0x7'),_0x86c4('0x24'),_0x86c4('0x25'),_0x86c4('0x26'),_0x86c4('0x27'),_0x86c4('0x28'),_0x86c4('0x29'),_0x86c4('0x2a'),_0x86c4('0x2b'),_0x86c4('0x2c'),_0x86c4('0x2d'),_0x86c4('0x2e'),_0x86c4('0x2f'),_0x86c4('0x30'),'mandatoryDisposition',_0x86c4('0x31'),_0x86c4('0x32'),'dialPreviewAutoRecallMe',_0x86c4('0x33')],'include':[{'model':'Trunk','as':_0x86c4('0x34'),'attributes':['id',_0x86c4('0x3'),_0x86c4('0x35'),_0x86c4('0x36')]},{'model':_0x86c4('0x37'),'as':_0x86c4('0x38'),'attributes':['id',_0x86c4('0x3')]},{'model':_0x86c4('0x34'),'as':_0x86c4('0x39'),'attributes':['id',_0x86c4('0x3'),_0x86c4('0x35'),_0x86c4('0x36')]},{'model':_0x86c4('0x3a'),'as':_0x86c4('0x3a'),'attributes':['id',_0x86c4('0x3')],'include':[{'model':_0x86c4('0x3a'),'as':_0x86c4('0x3b'),'attributes':['id','name',_0x86c4('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xb14a=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x4d45f1,_0xe45462){var _0x467097=function(_0x3bf0c6){while(--_0x3bf0c6){_0x4d45f1['push'](_0x4d45f1['shift']());}};_0x467097(++_0xe45462);}(_0xb14a,0xfc));var _0xab14=function(_0x18beb6,_0x7d0629){_0x18beb6=_0x18beb6-0x0;var _0x5c62fb=_0xb14a[_0x18beb6];return _0x5c62fb;};'use strict';var client=require(_0xab14('0x0'));exports[_0xab14('0x1')]=function(){return function(){return client[_0xab14('0x2')](_0xab14('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0xab14('0x4'),'autopause',_0xab14('0x5'),_0xab14('0x6'),'dialActive',_0xab14('0x7'),_0xab14('0x8'),_0xab14('0x9'),_0xab14('0xa'),_0xab14('0xb'),_0xab14('0xc'),_0xab14('0xd'),_0xab14('0xe'),_0xab14('0xf'),_0xab14('0x10'),'dialQueueOptions',_0xab14('0x11'),_0xab14('0x12'),_0xab14('0x13'),_0xab14('0x14'),_0xab14('0x15'),_0xab14('0x16'),_0xab14('0x17'),_0xab14('0x18'),_0xab14('0x19'),_0xab14('0x1a'),_0xab14('0x1b'),_0xab14('0x1c'),'dialCheckDuplicateType',_0xab14('0x1d'),_0xab14('0x1e'),_0xab14('0x1f'),_0xab14('0x20'),_0xab14('0x21'),_0xab14('0x22'),_0xab14('0x23'),'dialAMDMaximumNumberOfWords',_0xab14('0x24'),_0xab14('0x25'),_0xab14('0x26'),_0xab14('0x27'),_0xab14('0x28'),_0xab14('0x29'),_0xab14('0x2a'),_0xab14('0x2b'),'dialQueueProject2',_0xab14('0x5'),_0xab14('0x2c'),_0xab14('0x2d'),'dialCutDigit',_0xab14('0x2e'),'dialNoSuchNumberRetryFrequency',_0xab14('0x2f'),_0xab14('0x30'),'dialAbandonedMaxRetry',_0xab14('0x31'),'dialMachineMaxRetry',_0xab14('0x32'),_0xab14('0x33'),_0xab14('0x34'),_0xab14('0x35'),_0xab14('0x36'),_0xab14('0x37'),_0xab14('0x38'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xab14('0x39'),'as':_0xab14('0x39'),'attributes':['id',_0xab14('0x3a'),_0xab14('0x3b'),_0xab14('0x3c')]},{'model':_0xab14('0x3d'),'as':_0xab14('0x3e'),'attributes':['id',_0xab14('0x3a')]},{'model':_0xab14('0x39'),'as':_0xab14('0x3f'),'attributes':['id',_0xab14('0x3a'),_0xab14('0x3b'),'active']},{'model':_0xab14('0x40'),'as':_0xab14('0x40'),'attributes':['id',_0xab14('0x3a')],'include':[{'model':_0xab14('0x40'),'as':'Intervals','attributes':['id','name',_0xab14('0x41')]}]}]},'log':_0xab14('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f706996..4f7364f 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(_0x446438,_0x771136){var _0x58cfcc=function(_0x460868){while(--_0x460868){_0x446438['push'](_0x446438['shift']());}};_0x58cfcc(++_0x771136);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x2e2c48,_0x1abed5){var _0x482876=function(_0x5da24a){while(--_0x5da24a){_0x2e2c48['push'](_0x2e2c48['shift']());}};_0x482876(++_0x1abed5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 7f5ea1a..962df66 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 _0xc125=['getVoiceQueueRtPauses'];(function(_0x176830,_0x5a4fc3){var _0x2e96d8=function(_0x3ed4ac){while(--_0x3ed4ac){_0x176830['push'](_0x176830['shift']());}};_0x2e96d8(++_0x5a4fc3);}(_0xc125,0xca));var _0x5c12=function(_0x5ed5ad,_0x490098){_0x5ed5ad=_0x5ed5ad-0x0;var _0x56e88c=_0xc125[_0x5ed5ad];return _0x56e88c;};'use strict';var client=require('../client');exports[_0x5c12('0x0')]=function(_0x4aafc0){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4aafc0,'paused':!![]},'raw':!![]},'log':_0x5c12('0x0')});};}; \ No newline at end of file +var _0x12f7=['Request','getVoiceQueueRtPauses'];(function(_0x13032f,_0x350a6b){var _0x6be26e=function(_0x1972ec){while(--_0x1972ec){_0x13032f['push'](_0x13032f['shift']());}};_0x6be26e(++_0x350a6b);}(_0x12f7,0x137));var _0x712f=function(_0x461d7a,_0xeb2674){_0x461d7a=_0x461d7a-0x0;var _0x468349=_0x12f7[_0x461d7a];return _0x468349;};'use strict';var client=require('../client');exports[_0x712f('0x0')]=function(_0x57b824){return function(){return client[_0x712f('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x57b824,'paused':!![]},'raw':!![]},'log':_0x712f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6804f28..82c26a0 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x21e62e,_0x1f56d5){var _0x34bb9f=function(_0x12c391){while(--_0x12c391){_0x21e62e['push'](_0x21e62e['shift']());}};_0x34bb9f(++_0x1f56d5);}(_0x7a54,0x106));var _0x47a5=function(_0x419e7a,_0x5bd4ac){_0x419e7a=_0x419e7a-0x0;var _0x175fae=_0x7a54[_0x419e7a];return _0x175fae;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3b940d,_0x4e31f6){var _0x5d21f1=function(_0x5df9b6){while(--_0x5df9b6){_0x3b940d['push'](_0x3b940d['shift']());}};_0x5d21f1(++_0x4e31f6);}(_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 c1d37c0..272e17e 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 _0xa2c3=['secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereelinkedid','isexternal','context','CreateVoiceTransferReport','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0xa2c3,0xa2));var _0x3a2c=function(_0x5da4d8,_0x31cca6){_0x5da4d8=_0x5da4d8-0x0;var _0x354518=_0xa2c3[_0x5da4d8];return _0x354518;};'use strict';var client=require(_0x3a2c('0x0'));exports[_0x3a2c('0x1')]={};exports[_0x3a2c('0x2')]=function(_0x1e23d4){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x1e23d4[_0x3a2c('0x3')],'transfererchannel':_0x1e23d4[_0x3a2c('0x4')],'transferercalleridnum':_0x1e23d4[_0x3a2c('0x5')],'transferercalleridname':_0x1e23d4[_0x3a2c('0x6')],'transfererconnectedlinenum':_0x1e23d4['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1e23d4['transfererconnectedlinename'],'transfereraccountcode':_0x1e23d4[_0x3a2c('0x7')],'transferercontext':_0x1e23d4[_0x3a2c('0x8')],'transfererexten':_0x1e23d4[_0x3a2c('0x9')],'transfererlinkedid':_0x1e23d4[_0x3a2c('0xa')],'transfereechannel':_0x1e23d4['transfereechannel'],'transfereecalleridnum':_0x1e23d4['transfereecalleridnum'],'transfereecalleridname':_0x1e23d4[_0x3a2c('0xb')],'transfereeconnectedlinenum':_0x1e23d4[_0x3a2c('0xc')],'transfereeconnectedlinename':_0x1e23d4['transfereeconnectedlinename'],'transfereeaccountcode':_0x1e23d4[_0x3a2c('0xd')],'transfereecontext':_0x1e23d4['transfereecontext'],'transfereeexten':_0x1e23d4['transfereeexten'],'transfereelinkedid':_0x1e23d4[_0x3a2c('0xe')],'isexternal':_0x1e23d4[_0x3a2c('0xf')],'context':_0x1e23d4[_0x3a2c('0x10')],'extension':_0x1e23d4['extension'],'type':'blind'},'log':_0x3a2c('0x11')});};exports[_0x3a2c('0x12')]=function(_0x1eb674){return client[_0x3a2c('0x13')](_0x3a2c('0x11'),{'body':{'result':_0x1eb674[_0x3a2c('0x3')],'transfererchannel':_0x1eb674['origtransfererchannel'],'transferercalleridnum':_0x1eb674[_0x3a2c('0x14')],'transferercalleridname':_0x1eb674[_0x3a2c('0x15')],'transfererconnectedlinenum':_0x1eb674[_0x3a2c('0x16')],'transfererconnectedlinename':_0x1eb674['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1eb674['origtransfereraccountcode'],'transferercontext':_0x1eb674[_0x3a2c('0x17')],'transfererexten':_0x1eb674['secondtransfererexten'],'transfererlinkedid':_0x1eb674[_0x3a2c('0x18')],'transfereechannel':_0x1eb674[_0x3a2c('0x19')],'transfereecalleridnum':_0x1eb674[_0x3a2c('0x1a')],'transfereecalleridname':_0x1eb674[_0x3a2c('0x1b')],'transfereeconnectedlinenum':_0x1eb674[_0x3a2c('0x1c')],'transfereeconnectedlinename':_0x1eb674[_0x3a2c('0x1d')],'transfereeaccountcode':_0x1eb674[_0x3a2c('0x1e')],'transfereecontext':_0x1eb674[_0x3a2c('0x1f')],'transfereeexten':_0x1eb674[_0x3a2c('0x20')],'transfereelinkedid':_0x1eb674[_0x3a2c('0x21')],'isexternal':_0x1eb674['isexternal'],'context':_0x1eb674[_0x3a2c('0x22')],'extension':_0x1eb674[_0x3a2c('0x23')],'type':_0x3a2c('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xa1e8=['attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0xa1e8,0x82));var _0x8a1e=function(_0x58ff8c,_0x49a369){_0x58ff8c=_0x58ff8c-0x0;var _0x5a703a=_0xa1e8[_0x58ff8c];return _0x5a703a;};'use strict';var client=require(_0x8a1e('0x0'));exports[_0x8a1e('0x1')]={};exports[_0x8a1e('0x2')]=function(_0x7d9ce9){return client[_0x8a1e('0x3')](_0x8a1e('0x4'),{'body':{'result':_0x7d9ce9[_0x8a1e('0x5')],'transfererchannel':_0x7d9ce9[_0x8a1e('0x6')],'transferercalleridnum':_0x7d9ce9[_0x8a1e('0x7')],'transferercalleridname':_0x7d9ce9[_0x8a1e('0x8')],'transfererconnectedlinenum':_0x7d9ce9[_0x8a1e('0x9')],'transfererconnectedlinename':_0x7d9ce9[_0x8a1e('0xa')],'transfereraccountcode':_0x7d9ce9[_0x8a1e('0xb')],'transferercontext':_0x7d9ce9[_0x8a1e('0xc')],'transfererexten':_0x7d9ce9['transfererexten'],'transfererlinkedid':_0x7d9ce9[_0x8a1e('0xd')],'transfereechannel':_0x7d9ce9[_0x8a1e('0xe')],'transfereecalleridnum':_0x7d9ce9[_0x8a1e('0xf')],'transfereecalleridname':_0x7d9ce9[_0x8a1e('0x10')],'transfereeconnectedlinenum':_0x7d9ce9[_0x8a1e('0x11')],'transfereeconnectedlinename':_0x7d9ce9[_0x8a1e('0x12')],'transfereeaccountcode':_0x7d9ce9['transfereeaccountcode'],'transfereecontext':_0x7d9ce9[_0x8a1e('0x13')],'transfereeexten':_0x7d9ce9[_0x8a1e('0x14')],'transfereelinkedid':_0x7d9ce9[_0x8a1e('0x15')],'isexternal':_0x7d9ce9['isexternal'],'context':_0x7d9ce9[_0x8a1e('0x16')],'extension':_0x7d9ce9[_0x8a1e('0x17')],'type':_0x8a1e('0x18')},'log':_0x8a1e('0x4')});};exports[_0x8a1e('0x19')]=function(_0x7274c7){return client['Request'](_0x8a1e('0x4'),{'body':{'result':_0x7274c7['result'],'transfererchannel':_0x7274c7[_0x8a1e('0x1a')],'transferercalleridnum':_0x7274c7['origtransferercalleridnum'],'transferercalleridname':_0x7274c7[_0x8a1e('0x1b')],'transfererconnectedlinenum':_0x7274c7[_0x8a1e('0x1c')],'transfererconnectedlinename':_0x7274c7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x7274c7[_0x8a1e('0x1d')],'transferercontext':_0x7274c7[_0x8a1e('0x1e')],'transfererexten':_0x7274c7['secondtransfererexten'],'transfererlinkedid':_0x7274c7[_0x8a1e('0x1f')],'transfereechannel':_0x7274c7['transfertargetchannel'],'transfereecalleridnum':_0x7274c7[_0x8a1e('0x20')],'transfereecalleridname':_0x7274c7[_0x8a1e('0x21')],'transfereeconnectedlinenum':_0x7274c7[_0x8a1e('0x22')],'transfereeconnectedlinename':_0x7274c7[_0x8a1e('0x23')],'transfereeaccountcode':_0x7274c7[_0x8a1e('0x24')],'transfereecontext':_0x7274c7[_0x8a1e('0x25')],'transfereeexten':_0x7274c7[_0x8a1e('0x26')],'transfereelinkedid':_0x7274c7[_0x8a1e('0x27')],'isexternal':_0x7274c7[_0x8a1e('0x28')],'context':_0x7274c7[_0x8a1e('0x29')],'extension':_0x7274c7['origtransfererexten'],'type':_0x8a1e('0x2a')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fc53f1e..b228a77 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(_0x5c8caa,_0x2e13b6){var _0xfe4ab7=function(_0x2aa883){while(--_0x2aa883){_0x5c8caa['push'](_0x5c8caa['shift']());}};_0xfe4ab7(++_0x2e13b6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4843cf,_0x480cb5){_0x4843cf=_0x4843cf-0x0;var _0x52ad78=_0xb10b[_0x4843cf];return _0x52ad78;};'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(_0x3cb1a7,_0x47c577){var _0x265411=function(_0x15ad89){while(--_0x15ad89){_0x3cb1a7['push'](_0x3cb1a7['shift']());}};_0x265411(++_0x47c577);}(_0xb10b,0x12a));var _0xbb10=function(_0x3af480,_0x455eff){_0x3af480=_0x3af480-0x0;var _0x3f317a=_0xb10b[_0x3af480];return _0x3f317a;};'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 0d64c3d..4a50d7d 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 _0x9d2e=['ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','calleridnum','lastName','phone','mobile','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','firstName','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','merge','lodash','bluebird'];(function(_0x35a058,_0x162209){var _0x4255c1=function(_0x57f24f){while(--_0x57f24f){_0x35a058['push'](_0x35a058['shift']());}};_0x4255c1(++_0x162209);}(_0x9d2e,0x97));var _0xe9d2=function(_0x4096d7,_0x4543dd){_0x4096d7=_0x4096d7-0x0;var _0x2a8cdc=_0x9d2e[_0x4096d7];return _0x2a8cdc;};'use strict';var _=require(_0xe9d2('0x0'));var BPromise=require(_0xe9d2('0x1'));var Redis=require(_0xe9d2('0x2'));var util=require(_0xe9d2('0x3'));var config=require(_0xe9d2('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xe9d2('0x5'));config[_0xe9d2('0x6')]=_[_0xe9d2('0x7')](config[_0xe9d2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xe9d2('0x8'))(new Redis(config[_0xe9d2('0x6')]));function emit(_0xbe8751,_0x3e8565,_0xcee70b,_0x1c46a9,_0xcbc011){logger[_0xe9d2('0x9')](_0xe9d2('0xa'),_0xbe8751,_0x3e8565['id'],_0xcee70b,_0x1c46a9,JSON['stringify'](_0xcbc011));io['to'](_0xcee70b)['emit'](_0x1c46a9,_0xcbc011);}exports[_0xe9d2('0xb')]=function(_0x3a6930,_0x48bc83,_0x982287,_0x1441ad){var _0x41cf94,_0x4c0ef4;var _0x592063={};var _0x1c944e;var _0x407983=Number(_0x982287[_0xe9d2('0xc')]);var _0x281037=_0x982287[_0xe9d2('0xd')]?Boolean(Number(_0x982287[_0xe9d2('0xd')])):![];var _0x132a4c;var _0x35c915=![];if(!_[_0xe9d2('0xe')](_0x982287['data5'])){if(_0x982287[_0xe9d2('0xf')]=='1')_0x35c915=!![];}if(!_0x35c915){if(_0x1441ad[_0xe9d2('0x10')]){_0x592063['id']=_0x1441ad[_0xe9d2('0x10')];}}if(!_0x592063['id']){_0x592063[_0xe9d2('0x11')]=_0x407983;_0x132a4c=_0x982287[_0xe9d2('0x12')]&&_0x982287[_0xe9d2('0x12')]!=='0'?_0x982287[_0xe9d2('0x12')]['split'](','):['phone'];_0x592063[_0xe9d2('0x13')]=_[_0xe9d2('0x14')](_0x132a4c,function(_0x4bc2a4){var _0x391ddf={};_0x391ddf[_0x4bc2a4]=_0x1441ad[_0xe9d2('0x15')]?_0x1441ad[_0xe9d2('0x16')]:_0x1441ad['calleridnum'];return _0x391ddf;});_0x1c944e=_0x1441ad[_0xe9d2('0x15')]?_0x1441ad[_0xe9d2('0x16')]:_0x1441ad[_0xe9d2('0x17')];}var _0x5148e3=['id','firstName',_0xe9d2('0x18'),_0xe9d2('0x19'),_0xe9d2('0x1a'),'fax',_0xe9d2('0x11'),_0xe9d2('0x1b'),'scheduledAt',_0xe9d2('0x1c')];var _0x5daa3c=_[_0xe9d2('0x1d')](_0x5148e3,_0x132a4c);BPromise[_0xe9d2('0x1e')]()[_0xe9d2('0x1f')](cmContactRpc[_0xe9d2('0x20')]({'attributes':_0x5daa3c,'where':_0x592063,'phone':_0x1c944e}))[_0xe9d2('0x1f')](function(_0x370258){_0x4c0ef4=_0x370258;if(!_[_0xe9d2('0x21')](_0x4c0ef4)){if(_0x4c0ef4['length']===0x1){_0x41cf94=_0x4c0ef4[0x0];logger[_0xe9d2('0x9')](_0xe9d2('0x22'),_0x1441ad[_0xe9d2('0x23')],_0x48bc83['id'],_0x41cf94['id']);}else{logger[_0xe9d2('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1441ad[_0xe9d2('0x23')],_0x48bc83['id'],_[_0xe9d2('0x14')](_0x4c0ef4,'id')[_0xe9d2('0x24')](','));}return;}else{logger[_0xe9d2('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1441ad[_0xe9d2('0x23')],_0x48bc83['id']);var _0x699f72={'ListId':_0x407983};var _0x41a6ad=_0x982287[_0xe9d2('0x25')]&&_0x982287[_0xe9d2('0x25')]!=='0'?_0x982287['data4']:_0xe9d2('0x19');if(_0x281037){logger[_0xe9d2('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1441ad[_0xe9d2('0x23')],_0x48bc83['id']);_0x699f72[_0x41a6ad]=_['isNil'](_0x1441ad[_0xe9d2('0x15')])?_0x1441ad['calleridnum']:_0x1441ad['destcalleridnum'];if(_[_0xe9d2('0xe')](_0x1441ad[_0xe9d2('0x15')])){_0x699f72[_0xe9d2('0x26')]=_0x1441ad[_0xe9d2('0x27')]&&_0x1441ad['calleridname']!==_0xe9d2('0x28')?_0x1441ad[_0xe9d2('0x27')]:'Unknown';}else{_0x699f72['firstName']=_0x1441ad['destcalleridname']&&_0x1441ad[_0xe9d2('0x29')]!==_0xe9d2('0x28')?_0x1441ad[_0xe9d2('0x29')]:_0xe9d2('0x2a');}return BPromise[_0xe9d2('0x1e')]()[_0xe9d2('0x1f')](cmContactRpc['createContact'](_0x699f72))['then'](function(_0x1ef08d){_0x41cf94=_0x1ef08d;_0x4c0ef4[_0xe9d2('0x2b')](_0x1ef08d);if(_0x41cf94){logger[_0xe9d2('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1441ad[_0xe9d2('0x23')],_0x48bc83['id'],_0x41cf94['id']);}return;});}else{logger[_0xe9d2('0x9')](_0xe9d2('0x2c'),_0x1441ad[_0xe9d2('0x23')],_0x48bc83['id']);_0x699f72[_0x41a6ad]=_[_0xe9d2('0xe')](_0x1441ad[_0xe9d2('0x15')])?_0x1441ad[_0xe9d2('0x17')]:_0x1441ad['destcalleridnum'];if(_[_0xe9d2('0xe')](_0x1441ad[_0xe9d2('0x15')])){_0x699f72[_0xe9d2('0x26')]=_0x1441ad[_0xe9d2('0x27')]&&_0x1441ad[_0xe9d2('0x27')]!==''?_0x1441ad['calleridname']:_0xe9d2('0x2a');}else{_0x699f72[_0xe9d2('0x26')]=_0x1441ad[_0xe9d2('0x29')]&&_0x1441ad[_0xe9d2('0x29')]!==''?_0x1441ad['destcalleridname']:'Unknown';}_0x41cf94=_0x699f72;_0x4c0ef4[_0xe9d2('0x2b')](_0x699f72);return;}}})[_0xe9d2('0x1f')](function(){if(_0x3a6930){emit(_0x1441ad['uniqueid'],_0x48bc83,util[_0xe9d2('0x2d')](_0xe9d2('0x2e'),_0x3a6930[_0xe9d2('0x2f')]),util['format'](_0xe9d2('0x30'),_0x982287[_0xe9d2('0x31')]['toLowerCase']()),{'evt':_[_0xe9d2('0x32')](_0x1441ad,{'autoCreate':_0x281037}),'contact':_0x41cf94===undefined?{}:_0x41cf94,'contacts':_0x4c0ef4['length']===0x0?undefined:_0x4c0ef4});}});}; \ No newline at end of file +var _0xe2b6=['format','user:%s','trigger:%s','action','toLowerCase','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','then','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push'];(function(_0x314e22,_0x891517){var _0x4ac0f5=function(_0x43aa65){while(--_0x43aa65){_0x314e22['push'](_0x314e22['shift']());}};_0x4ac0f5(++_0x891517);}(_0xe2b6,0x11d));var _0x6e2b=function(_0x3559b6,_0x41e427){_0x3559b6=_0x3559b6-0x0;var _0x5bedcf=_0xe2b6[_0x3559b6];return _0x5bedcf;};'use strict';var _=require('lodash');var BPromise=require(_0x6e2b('0x0'));var Redis=require(_0x6e2b('0x1'));var util=require(_0x6e2b('0x2'));var config=require(_0x6e2b('0x3'));var logger=require(_0x6e2b('0x4'))(_0x6e2b('0x5'));var cmContactRpc=require(_0x6e2b('0x6'));config[_0x6e2b('0x7')]=_[_0x6e2b('0x8')](config[_0x6e2b('0x7')],{'host':_0x6e2b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6e2b('0x7')]));function emit(_0x4e43c4,_0x1fc32d,_0xc65820,_0x1fe4f5,_0x19f41c){logger[_0x6e2b('0xa')]('[CM][%s][%s]',_0x4e43c4,_0x1fc32d['id'],_0xc65820,_0x1fe4f5,JSON[_0x6e2b('0xb')](_0x19f41c));io['to'](_0xc65820)[_0x6e2b('0xc')](_0x1fe4f5,_0x19f41c);}exports[_0x6e2b('0xd')]=function(_0x8b4fce,_0x536490,_0xd3ec70,_0x359e5b){var _0x4be257,_0x11b3fd;var _0x21a56d={};var _0x554b59;var _0x417e89=Number(_0xd3ec70[_0x6e2b('0xe')]);var _0x4c924c=_0xd3ec70[_0x6e2b('0xf')]?Boolean(Number(_0xd3ec70['data2'])):![];var _0x10baf8;var _0x5387c1=![];if(!_[_0x6e2b('0x10')](_0xd3ec70[_0x6e2b('0x11')])){if(_0xd3ec70[_0x6e2b('0x11')]=='1')_0x5387c1=!![];}if(!_0x5387c1){if(_0x359e5b['xmd-contactid']){_0x21a56d['id']=_0x359e5b[_0x6e2b('0x12')];}}if(!_0x21a56d['id']){_0x21a56d[_0x6e2b('0x13')]=_0x417e89;_0x10baf8=_0xd3ec70['data3']&&_0xd3ec70[_0x6e2b('0x14')]!=='0'?_0xd3ec70[_0x6e2b('0x14')][_0x6e2b('0x15')](','):['phone'];_0x21a56d['$or']=_[_0x6e2b('0x16')](_0x10baf8,function(_0x5e40f1){var _0x26b3a5={};_0x26b3a5[_0x5e40f1]=_0x359e5b[_0x6e2b('0x17')]?_0x359e5b[_0x6e2b('0x18')]:_0x359e5b[_0x6e2b('0x19')];return _0x26b3a5;});_0x554b59=_0x359e5b['routeId']?_0x359e5b['destcalleridnum']:_0x359e5b[_0x6e2b('0x19')];}var _0x5d646d=['id',_0x6e2b('0x1a'),_0x6e2b('0x1b'),_0x6e2b('0x1c'),'mobile',_0x6e2b('0x1d'),_0x6e2b('0x13'),_0x6e2b('0x1e'),_0x6e2b('0x1f'),_0x6e2b('0x20')];var _0x3440c8=_[_0x6e2b('0x21')](_0x5d646d,_0x10baf8);BPromise[_0x6e2b('0x22')]()['then'](cmContactRpc[_0x6e2b('0x23')]({'attributes':_0x3440c8,'where':_0x21a56d,'phone':_0x554b59}))['then'](function(_0x42d3ab){_0x11b3fd=_0x42d3ab;if(!_[_0x6e2b('0x24')](_0x11b3fd)){if(_0x11b3fd[_0x6e2b('0x25')]===0x1){_0x4be257=_0x11b3fd[0x0];logger[_0x6e2b('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x359e5b[_0x6e2b('0x26')],_0x536490['id'],_0x4be257['id']);}else{logger[_0x6e2b('0xa')](_0x6e2b('0x27'),_0x359e5b[_0x6e2b('0x26')],_0x536490['id'],_[_0x6e2b('0x16')](_0x11b3fd,'id')['join'](','));}return;}else{logger[_0x6e2b('0xa')](_0x6e2b('0x28'),_0x359e5b[_0x6e2b('0x26')],_0x536490['id']);var _0x11a73d={'ListId':_0x417e89};var _0x52eb82=_0xd3ec70[_0x6e2b('0x29')]&&_0xd3ec70[_0x6e2b('0x29')]!=='0'?_0xd3ec70[_0x6e2b('0x29')]:_0x6e2b('0x1c');if(_0x4c924c){logger[_0x6e2b('0xa')](_0x6e2b('0x2a'),_0x359e5b[_0x6e2b('0x26')],_0x536490['id']);_0x11a73d[_0x52eb82]=_[_0x6e2b('0x10')](_0x359e5b[_0x6e2b('0x17')])?_0x359e5b[_0x6e2b('0x19')]:_0x359e5b[_0x6e2b('0x18')];if(_[_0x6e2b('0x10')](_0x359e5b[_0x6e2b('0x17')])){_0x11a73d[_0x6e2b('0x1a')]=_0x359e5b[_0x6e2b('0x2b')]&&_0x359e5b['calleridname']!==_0x6e2b('0x2c')?_0x359e5b[_0x6e2b('0x2b')]:_0x6e2b('0x2d');}else{_0x11a73d['firstName']=_0x359e5b['destcalleridname']&&_0x359e5b[_0x6e2b('0x2e')]!==''?_0x359e5b['destcalleridname']:'Unknown';}return BPromise[_0x6e2b('0x22')]()[_0x6e2b('0x2f')](cmContactRpc['createContact'](_0x11a73d))[_0x6e2b('0x2f')](function(_0x23b3a7){_0x4be257=_0x23b3a7;_0x11b3fd['push'](_0x23b3a7);if(_0x4be257){logger[_0x6e2b('0xa')](_0x6e2b('0x30'),_0x359e5b['uniqueid'],_0x536490['id'],_0x4be257['id']);}return;});}else{logger[_0x6e2b('0xa')](_0x6e2b('0x31'),_0x359e5b['uniqueid'],_0x536490['id']);_0x11a73d[_0x52eb82]=_[_0x6e2b('0x10')](_0x359e5b[_0x6e2b('0x17')])?_0x359e5b[_0x6e2b('0x19')]:_0x359e5b[_0x6e2b('0x18')];if(_['isNil'](_0x359e5b['routeId'])){_0x11a73d[_0x6e2b('0x1a')]=_0x359e5b[_0x6e2b('0x2b')]&&_0x359e5b[_0x6e2b('0x2b')]!==''?_0x359e5b[_0x6e2b('0x2b')]:_0x6e2b('0x2d');}else{_0x11a73d[_0x6e2b('0x1a')]=_0x359e5b[_0x6e2b('0x2e')]&&_0x359e5b['destcalleridname']!==_0x6e2b('0x2c')?_0x359e5b[_0x6e2b('0x2e')]:_0x6e2b('0x2d');}_0x4be257=_0x11a73d;_0x11b3fd[_0x6e2b('0x32')](_0x11a73d);return;}}})['then'](function(){if(_0x8b4fce){emit(_0x359e5b[_0x6e2b('0x26')],_0x536490,util[_0x6e2b('0x33')](_0x6e2b('0x34'),_0x8b4fce['name']),util[_0x6e2b('0x33')](_0x6e2b('0x35'),_0xd3ec70[_0x6e2b('0x36')][_0x6e2b('0x37')]()),{'evt':_['merge'](_0x359e5b,{'autoCreate':_0x4c924c}),'contact':_0x4be257===undefined?{}:_0x4be257,'contacts':_0x11b3fd[_0x6e2b('0x25')]===0x0?undefined:_0x11b3fd});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 36517d4..85ee5ea 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 _0x9c46=['custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','stringify','emit','prototype','clone','undefined','motionChannel','debug','inspect','checkTriggers','interface','status','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','popup','data2','html','render','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','windowHeight','600','data6','winApplication','winArguments','format','user:%s','name','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','checkTrigger','channel','AllConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','exports','util','lodash','mustache','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9c46,0x1e1));var _0x69c4=function(_0x47368f,_0x1f10fe){_0x47368f=_0x47368f-0x0;var _0x49838f=_0x9c46[_0x47368f];return _0x49838f;};'use strict';var util=require(_0x69c4('0x0'));var _=require(_0x69c4('0x1'));var url=require('url');var Mustache=require(_0x69c4('0x2'));var Redis=require('ioredis');var urlforward=require(_0x69c4('0x3'));var integration=require(_0x69c4('0x4'));var cmContact=require(_0x69c4('0x5'));var script=require('./script');var config=require(_0x69c4('0x6'));var logger=require(_0x69c4('0x7'))(_0x69c4('0x8'));var ami=require(_0x69c4('0x9'));config[_0x69c4('0xa')]=_['defaults'](config[_0x69c4('0xa')],{'host':_0x69c4('0xb'),'port':0x18eb});var io=require(_0x69c4('0xc'))(new Redis(config[_0x69c4('0xa')]));var operators={'equals':function(_0x1e6425,_0xecc90e){return _0x1e6425==_0xecc90e;},'not_equals':function(_0x2e50c9,_0x136840){return _0x2e50c9!=_0x136840;}};var barAndWebActions=['popup',_0x69c4('0xd'),_0x69c4('0xe')];function Trigger(_0x479766){this[_0x69c4('0xf')]=_0x479766[_0x69c4('0xf')];this[_0x69c4('0x10')]=_0x479766['agents'];this[_0x69c4('0x11')]=_0x479766[_0x69c4('0x11')];this[_0x69c4('0x12')]=_0x479766[_0x69c4('0x12')];this[_0x69c4('0x13')]=_0x479766['voiceExtensions'];this[_0x69c4('0x14')]=_0x479766['zendeskAccounts'];this['freshdeskAccounts']=_0x479766[_0x69c4('0x15')];this[_0x69c4('0x16')]=_0x479766[_0x69c4('0x16')];this[_0x69c4('0x17')]=_0x479766['sugarcrmAccounts'];this[_0x69c4('0x18')]=_0x479766['zohoAccounts'];this[_0x69c4('0x19')]=_0x479766[_0x69c4('0x19')];this[_0x69c4('0x1a')]=_0x479766['vtigerAccounts'];this[_0x69c4('0x1b')]=_0x479766[_0x69c4('0x1b')];this[_0x69c4('0x1c')]=_0x479766[_0x69c4('0x1c')];this[_0x69c4('0x1d')]=_0x479766[_0x69c4('0x1d')];this[_0x69c4('0x1e')]={'zendesk':this[_0x69c4('0x14')],'salesforce':this[_0x69c4('0x16')],'freshdesk':this[_0x69c4('0x15')],'sugarcrm':this[_0x69c4('0x17')],'zoho':this[_0x69c4('0x18')],'desk':this[_0x69c4('0x19')],'vtiger':this[_0x69c4('0x1a')],'dynamics365':this[_0x69c4('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x69c4('0x1b')]};ami['on'](_0x69c4('0x1f'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x22'),this[_0x69c4('0x20')]['bind'](this));ami['on'](_0x69c4('0x23'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x24'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x25'),this['syncCustomEvent'][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x26'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on']('custom:agentbusy',this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on']('custom:agentcongestion',this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on']('custom:agentreject',this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x27'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x28'),this[_0x69c4('0x20')]['bind'](this));ami['on'](_0x69c4('0x29'),this['syncCustomEvent'][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x2a'),this[_0x69c4('0x2b')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x2c'),this[_0x69c4('0x2b')][_0x69c4('0x21')](this));ami['on']('custom:dialend',this[_0x69c4('0x2b')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x2d'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on']('custom:closedinteraction',this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x2e'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x2f'),this['syncCustomEvent'][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x30'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on']('custom:acceptmessage',this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x31'),this[_0x69c4('0x20')][_0x69c4('0x21')](this));ami['on'](_0x69c4('0x32'),this[_0x69c4('0x20')]['bind'](this));}Trigger['prototype']['emit']=function(_0x37c48d,_0x2c5e1d,_0x434d91){logger['info'](_0x37c48d,_0x2c5e1d,JSON[_0x69c4('0x33')](_0x434d91));io['to'](_0x37c48d)[_0x69c4('0x34')](_0x2c5e1d,_0x434d91);};Trigger[_0x69c4('0x35')]['syncCustomEvent']=function(_0x4e419a){var _0x4f04d9=_[_0x69c4('0x36')](_0x4e419a);if(typeof _0x4f04d9['motionChannel']===_0x69c4('0x37')){_0x4f04d9[_0x69c4('0x38')]='voice';}logger[_0x69c4('0x39')](_0x69c4('0x20'),util[_0x69c4('0x3a')](_0x4f04d9,{'showHidden':!![],'depth':null}));this[_0x69c4('0x3b')](_0x4f04d9);};Trigger[_0x69c4('0x35')][_0x69c4('0x2b')]=function(_0x1c2bf7){if(this['agents'][_0x1c2bf7[_0x69c4('0x3c')]]){this['syncCustomEvent'](_0x1c2bf7);}};Trigger[_0x69c4('0x35')][_0x69c4('0x3b')]=function(_0x38ba20){var _0x49136a;for(var _0x378b17 in this['triggers']){if(this['triggers']['hasOwnProperty'](_0x378b17)){if(this[_0x69c4('0xf')][_0x378b17][_0x69c4('0x3d')]){_0x49136a=this['checkTrigger'](this[_0x69c4('0xf')][_0x378b17],_0x38ba20);if(_0x49136a){_[_0x69c4('0x3e')](_0x38ba20,_0x38ba20[_0x69c4('0x3f')]);for(var _0x3c88ac=0x0,_0x96764,_0x4031c7,_0x3efffb;_0x3c88ac0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x38bad0,_0x3c5de2){var _0x20970f=function(_0x433227){while(--_0x433227){_0x38bad0['push'](_0x38bad0['shift']());}};_0x20970f(++_0x3c5de2);}(_0x3e74,0x175));var _0x43e7=function(_0x166223,_0x4d1b52){_0x166223=_0x166223-0x0;var _0x19abdc=_0x3e74[_0x166223];return _0x19abdc;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 66b6b81..0742be0 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 _0xae1e=['recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','data7','tenantId','CloudProvider','data2','resolve','data5','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','value','isNil','validateEmail','email','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','lastIndexOf','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','length','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','nameField','customField','indexOf','substring','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','enduserId','queue','callDirection','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xae1e,0x165));var _0xeae1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xae1e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeae1('0x0'));var rp=require(_0xeae1('0x1'));var util=require('util');var intUtil=require(_0xeae1('0x2'));var md5=require(_0xeae1('0x3'));var Redis=require(_0xeae1('0x4'));var logger=require(_0xeae1('0x5'))(_0xeae1('0x6'));var config=require(_0xeae1('0x7'));config[_0xeae1('0x8')]=_['defaults'](config[_0xeae1('0x8')],{'host':_0xeae1('0x9'),'port':0x18eb});var io=require(_0xeae1('0xa'))(new Redis(config[_0xeae1('0x8')]));function getAuthToken(_0x5da60f,_0x126ff4,_0x4d6f1e){if(_0x5da60f[_0xeae1('0xb')]){_0x5da60f['remoteUri']=_0x5da60f['CloudProvider'][_0xeae1('0xc')];_0x5da60f[_0xeae1('0xd')]=_0x5da60f[_0xeae1('0xe')][_0xeae1('0xf')];return Promise[_0xeae1('0x10')](_0x5da60f['CloudProvider'][_0xeae1('0x11')]);}var _0x474f65={'method':_0xeae1('0x12'),'uri':_0x126ff4,'form':{'client_id':_0x5da60f[_0xeae1('0x13')],'resource':_0x5da60f[_0xeae1('0x14')],'username':_0x5da60f['username'],'password':_0x5da60f[_0xeae1('0x15')],'grant_type':_0xeae1('0x15'),'client_secret':_0x5da60f[_0xeae1('0x16')]},'json':!![]};return rp(_0x474f65)[_0xeae1('0x17')](function(_0x429e51){return _0x429e51[_0xeae1('0x18')];})[_0xeae1('0x19')](function(_0x475469){logger[_0xeae1('0x1a')]('['+[_0x4d6f1e['toUpperCase']()]+_0xeae1('0x1b'));return _0x475469[_0xeae1('0x1c')];});}function getUser(_0x18391b,_0x1c1a88,_0x1605aa,_0x10de0c,_0x5be7b5,_0x199afc){return new Promise(function(_0x3b0d28,_0x4590b5){return getAuthToken(_0x1c1a88,_0x10de0c,_0x199afc)['then'](function(_0x1ada97){var _0x6cc435={'method':_0xeae1('0x1d'),'uri':_0x5be7b5+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xeae1('0x1e')+_0x1ada97,'OData-Version':'4.0'},'json':!![]};return rp(_0x6cc435);})[_0xeae1('0x17')](function(_0x417d12){var _0x228776=_0x417d12[_0xeae1('0x1f')];var _0x5c0fab=![];var _0x482682=null;if(!_[_0xeae1('0x20')](_0x1605aa)){if(intUtil[_0xeae1('0x21')](_0x1605aa[_0xeae1('0x22')])){_0x18391b['userEmail']=_0x1605aa[_0xeae1('0x22')];for(_0x482682=0x0;_0x482682<_0x228776['length'];_0x482682++){if(_0x228776[_0x482682][_0xeae1('0x23')]===_0x1605aa[_0xeae1('0x22')]&&!_0x228776[_0x482682]['isdisabled']){_0x5c0fab=!![];logger[_0xeae1('0x24')]('['+[_0x199afc[_0xeae1('0x25')]()]+_0xeae1('0x26')+_0x228776[_0x482682][_0xeae1('0x27')]+'!');_0x18391b['userId']=_0x228776[_0x482682][_0xeae1('0x27')];}}}}if(!_0x5c0fab){logger[_0xeae1('0x24')]('['+[_0x199afc[_0xeae1('0x25')]()]+_0xeae1('0x28'));_0x18391b[_0xeae1('0x29')]=_0x1c1a88['username'];for(_0x482682=0x0;_0x482682<_0x228776['length'];_0x482682++){if(_0x228776[_0x482682][_0xeae1('0x23')]===_0x1c1a88[_0xeae1('0x2a')]){_0x18391b[_0xeae1('0x2b')]=_0x228776[_0x482682][_0xeae1('0x27')];}}}_0x3b0d28(_0x18391b);})[_0xeae1('0x19')](function(_0x15a681){_0x4590b5(_0x15a681[_0xeae1('0x1c')]);});});}function createEndUser(_0x5383e8,_0x5503fc,_0x4a7117,_0x1bb4f9,_0x292a10,_0x1fa5ba,_0x56723e){return new Promise(function(_0x54143d,_0x1e3f6f){return getAuthToken(_0x5503fc,_0x4a7117,_0x1fa5ba)[_0xeae1('0x17')](function(_0x31fc8e){var _0x421d33=_0x1fa5ba[_0xeae1('0x2c')]()===_0xeae1('0x2d')?_0x292a10[_0xeae1('0x2e')]:_0x292a10[_0xeae1('0x2f')];var _0x264b80={'method':_0xeae1('0x12'),'uri':_0x1bb4f9+_0xeae1('0x30'),'body':{'fullname':_0x421d33,'firstname':_0x421d33,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xeae1('0x31')+_0x5383e8[_0xeae1('0x2b')]+')'},'headers':{'Authorization':_0xeae1('0x1e')+_0x31fc8e,'OData-Version':_0xeae1('0x32')},'json':!![],'resolveWithFullResponse':!![]};_0x264b80[_0xeae1('0x33')][_0x56723e]=_0x421d33;return rp(_0x264b80);})['then'](function(_0x1787ee){var _0x583f36=_0x1787ee[_0xeae1('0x34')][_0xeae1('0x35')];var _0x399c53=_0x583f36['substring'](_0x583f36[_0xeae1('0x36')]('(')+0x1,_0x583f36[_0xeae1('0x36')](')'));_0x5383e8['enduserId']=_0x399c53;_0x54143d(_0x5383e8);})[_0xeae1('0x19')](function(_0x344c51){_0x1e3f6f(_0x344c51[_0xeae1('0x1c')]);});});}function getEndUser(_0x2113af,_0x1235f3,_0x1abc90,_0x223a98,_0x2b02bd,_0x547e69,_0x28bcbe,_0xe395b4){var _0x1d4083=_0x547e69[_0xeae1('0x2c')]()===_0xeae1('0x2d')?_0x2b02bd[_0xeae1('0x2e')]:_0x2b02bd[_0xeae1('0x2f')];return getAuthToken(_0x1235f3,_0x1abc90,_0x547e69)[_0xeae1('0x17')](function(_0x4e9311){_0xe395b4=_0xe395b4?_0xe395b4:_0xeae1('0x37');var _0x3dea54={'method':_0xeae1('0x1d'),'uri':_0x223a98+_0xeae1('0x38')+_0xe395b4+_0xeae1('0x39')+_0xe395b4+_0xeae1('0x3a')+_0x1d4083[_0xeae1('0x3b')]('+',_0xeae1('0x3c'))+'\x27','headers':{'Authorization':_0xeae1('0x1e')+_0x4e9311,'If-None-Match':null,'OData-Version':_0xeae1('0x32')},'json':!![]};return rp(_0x3dea54);})[_0xeae1('0x17')](function(_0x240811){var _0x54c351=![];if(!_0x240811)return _0x54c351;var _0x5f1d1b=_0x240811[_0xeae1('0x1f')];for(var _0x44b11b=0x0;_0x44b11b<_0x5f1d1b[_0xeae1('0x3d')];_0x44b11b++){if(_0x5f1d1b[_0x44b11b][_0xe395b4]===_0x1d4083){_0x54c351=!![];_0x2113af['enduserId']=_0x5f1d1b[_0x44b11b][_0xeae1('0x3e')];}}return _0x54c351;})[_0xeae1('0x17')](function(_0x4c3afd){if(_0x4c3afd)return _0x2113af;if(_0x28bcbe===_0xeae1('0x3f')){logger[_0xeae1('0x24')]('['+[_0x547e69['toUpperCase']()]+_0xeae1('0x40'));return _0x2113af;}return createEndUser(_0x2113af,_0x1235f3,_0x1abc90,_0x223a98,_0x2b02bd,_0x547e69,_0xe395b4)['then'](function(_0x3b242a){logger[_0xeae1('0x24')]('['+[_0x547e69[_0xeae1('0x25')]()]+']\x20Enduser\x20created!',_0x3b242a['enduserId']);return _0x3b242a;});});}function getCustomFields(_0x34b4e8,_0x4d7ee5,_0x3df3fd){var _0x552d8b={};if(_0x34b4e8['length']>0x0){_['forEach'](_0x34b4e8,function(_0x490495){if(_[_0xeae1('0x41')]([_0xeae1('0x42'),_0xeae1('0x43')],_0x490495['type'])&&_0x490495[_0xeae1('0x44')]&&!_0x490495[_0xeae1('0x45')]){var _0x354a2c=_0x490495['idField']['toLowerCase']();var _0x367cef=_0x354a2c['substring'](0x0,_0x354a2c[_0xeae1('0x46')]('_'));var _0x25649e=_0x354a2c[_0xeae1('0x47')](_0x354a2c['indexOf']('_')+0x1);if(_0x367cef===_0x3df3fd){_0x552d8b[_0x25649e]=_0x490495[_0xeae1('0x48')];}}});}return _0x552d8b;}function getTicket(_0x68aa38,_0x5b5fa8,_0x511da7,_0x1304b2,_0x66e17c,_0x25cf7d,_0x2acb8b){return new Promise(function(_0x192e20,_0x5a812d){var _0x7c7b;return getAuthToken(_0x5b5fa8,_0x511da7,_0x2acb8b)[_0xeae1('0x17')](function(_0x156a4b){if(_0x25cf7d[_0xeae1('0x49')]===_0xeae1('0x4a')){_0x7c7b={'method':_0xeae1('0x12'),'uri':_0x1304b2+_0xeae1('0x4b'),'body':Object[_0xeae1('0x4c')]({},{'title':intUtil[_0xeae1('0x4d')](_0x25cf7d['Subjects'],_0x66e17c,'\x20'),'description':intUtil['getString'](_0x25cf7d[_0xeae1('0x4e')],_0x66e17c,'\x0a'),'customerid_contact@odata.bind':_0x68aa38['enduserId']?_0xeae1('0x4f')+_0x68aa38['enduserId']+')':undefined,'ownerid@odata.bind':_0xeae1('0x31')+_0x68aa38[_0xeae1('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x25cf7d[_0xeae1('0x50')],_0x66e17c,_0x25cf7d['ticketType'])),'headers':{'Authorization':_0xeae1('0x1e')+_0x156a4b,'OData-Version':_0xeae1('0x32')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x25cf7d[_0xeae1('0x49')]===_0xeae1('0x51')){var _0x32a019=_0x68aa38[_0xeae1('0x52')]?[{'partyid_systemuser@odata.bind':_0xeae1('0x31')+_0x68aa38[_0xeae1('0x2b')]+')','participationtypemask':_0x68aa38['callDirection']===_0xeae1('0x53')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x68aa38[_0xeae1('0x52')]+')','participationtypemask':_0x68aa38['callDirection']===_0xeae1('0x53')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xeae1('0x31')+_0x68aa38['userId']+')','participationtypemask':_0x68aa38[_0xeae1('0x54')]===_0xeae1('0x53')?0x2:0x1}];_0x7c7b={'method':_0xeae1('0x12'),'uri':_0x1304b2+'phonecalls','body':Object[_0xeae1('0x4c')]({},{'subject':intUtil['getString'](_0x25cf7d[_0xeae1('0x55')],_0x66e17c,'\x20'),'phonenumber':String(_0x66e17c['calleridnum']),'description':intUtil[_0xeae1('0x4d')](_0x25cf7d[_0xeae1('0x4e')],_0x66e17c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x68aa38['enduserId']?'/contacts('+_0x68aa38['enduserId']+')':undefined,'ownerid@odata.bind':_0xeae1('0x31')+_0x68aa38[_0xeae1('0x2b')]+')','directioncode':_0x68aa38[_0xeae1('0x54')]===_0xeae1('0x53')?![]:!![],'phonecall_activity_parties':_0x32a019},getCustomFields(_0x25cf7d['Fields'],_0x66e17c,_0x25cf7d[_0xeae1('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x156a4b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x7c7b);})[_0xeae1('0x17')](function(_0x49585b){var _0x5d1ea2=_0x49585b[_0xeae1('0x34')]['odata-entityid'];var _0x18c8d0=_0x5d1ea2[_0xeae1('0x47')](_0x5d1ea2[_0xeae1('0x36')]('(')+0x1,_0x5d1ea2[_0xeae1('0x36')](')'));_0x68aa38[_0xeae1('0x56')]=_0x18c8d0;_0x192e20(_0x68aa38);})[_0xeae1('0x19')](function(_0x3b49cc){_0x5a812d(_0x3b49cc[_0xeae1('0x1c')]);});});}function emit(_0x72a912,_0x5212b9,_0x7f9c04,_0x1a0ff0){var _0x24ab19={'uri':util[_0xeae1('0x57')](_0xeae1('0x58'),_0x72a912,_0x7f9c04,_0x1a0ff0)};io['to'](util[_0xeae1('0x57')]('user:%s',_0x5212b9))[_0xeae1('0x59')]('trigger:browser:url',_0x24ab19);}exports['cs']=function(_0x596f9f,_0x5ec1fb,_0x5e21fe,_0x2fee21,_0x6a9774,_0x13ecf0,_0x4c0206,_0x928c){var _0x1512d0={};_0x13ecf0[_0xeae1('0x14')]=_0x13ecf0[_0xeae1('0xb')]?intUtil[_0xeae1('0x5a')](_0x13ecf0[_0xeae1('0xe')][_0xeae1('0xc')]):intUtil[_0xeae1('0x5a')](_0x13ecf0[_0xeae1('0x14')]);_0x13ecf0[_0xeae1('0x5b')]=intUtil[_0xeae1('0x5a')](_0x13ecf0[_0xeae1('0x5b')]);_0x1512d0['callDirection']=_0x928c===_0xeae1('0x53')||_0x928c===_0xeae1('0x5c')?_0xeae1('0x53'):'outbound';var _0x270d1e=_0x13ecf0[_0xeae1('0xb')]?util['format'](_0xeae1('0x5d'),_0x13ecf0[_0xeae1('0xe')]['data7']):util['format'](_0xeae1('0x5d'),_0x13ecf0[_0xeae1('0x14')]);var _0x72045b=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x13ecf0['tenantId']);var _0x40340f=util['format'](_0xeae1('0x5e'),_0x13ecf0[_0xeae1('0x5b')],_0x5ec1fb[_0xeae1('0x5f')],md5(_0x5ec1fb[_0xeae1('0x5f')]));if(_0x6a9774&&_0x6a9774[_0xeae1('0x60')]){logger[_0xeae1('0x24')](_0xeae1('0x61'),_0xeae1('0x62'));_0x5ec1fb['recordingURL']=_0x40340f;}else if(_0x4c0206&&_0x4c0206[_0xeae1('0x63')]&&_0x4c0206[_0xeae1('0x63')]!==_0xeae1('0x64')){logger['info'](_0xeae1('0x65'),'Recording\x20is\x20enabled!');_0x5ec1fb[_0xeae1('0x66')]=_0x40340f;}else{_0x5ec1fb[_0xeae1('0x66')]='';}return getUser(_0x1512d0,_0x13ecf0,_0x2fee21,_0x72045b,_0x270d1e,_0x928c)[_0xeae1('0x17')](function(_0x54c42b){logger[_0xeae1('0x24')]('['+_0x928c[_0xeae1('0x25')]()+_0xeae1('0x67'),_0x54c42b['userId']);logger[_0xeae1('0x24')]('['+_0x928c['toUpperCase']()+_0xeae1('0x68'),_0x54c42b[_0xeae1('0x29')]);return getEndUser(_0x54c42b,_0x13ecf0,_0x72045b,_0x270d1e,_0x5ec1fb,_0x928c,_0x5e21fe[_0xeae1('0x69')],_0x5e21fe[_0xeae1('0x6a')]);})[_0xeae1('0x17')](function(_0x448233){logger[_0xeae1('0x24')]('['+_0x928c[_0xeae1('0x25')]()+_0xeae1('0x6b'),_0x448233[_0xeae1('0x52')]);logger[_0xeae1('0x24')]('['+_0x928c[_0xeae1('0x25')]()+_0xeae1('0x6c'),_0x5ec1fb[_0xeae1('0x2f')]);return getTicket(_0x448233,_0x13ecf0,_0x72045b,_0x270d1e,_0x5ec1fb,_0x5e21fe,_0x928c);})[_0xeae1('0x17')](function(_0x333afe){logger[_0xeae1('0x24')](util[_0xeae1('0x57')]('['+_0x928c[_0xeae1('0x25')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5e21fe[_0xeae1('0x49')],_0x333afe['ticketId']));logger[_0xeae1('0x24')](util['format']('['+_0x928c[_0xeae1('0x25')]()+_0xeae1('0x6d'),_0x928c));if(_0x928c!==_0xeae1('0x5c')&&_0x5e21fe[_0xeae1('0x6e')]){logger[_0xeae1('0x24')]('['+_0x928c['toUpperCase']()+']',_0xeae1('0x6f'));emit(_0x13ecf0['remoteUri'],_0x2fee21[_0xeae1('0x70')],_0x5e21fe[_0xeae1('0x49')],_0x333afe[_0xeae1('0x56')]);}})[_0xeae1('0x19')](function(_0x43418b){logger[_0xeae1('0x1a')]('['+_0x928c['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x43418b[_0xeae1('0x1c')]);console['error'](_0xeae1('0x71'),_0x43418b);});}; \ No newline at end of file +var _0xbf43=['remoteUri','CloudProvider','data7','tenantId','data2','data5','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','GET','\x20eq\x20\x27','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','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','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbf43,0x13a));var _0x3bf4=function(_0x3c7561,_0xc165b7){_0x3c7561=_0x3c7561-0x0;var _0x1ab4f7=_0xbf43[_0x3c7561];return _0x1ab4f7;};'use strict';var _=require(_0x3bf4('0x0'));var rp=require(_0x3bf4('0x1'));var util=require(_0x3bf4('0x2'));var intUtil=require('./util');var md5=require(_0x3bf4('0x3'));var Redis=require(_0x3bf4('0x4'));var logger=require('../../../../config/logger')(_0x3bf4('0x5'));var config=require(_0x3bf4('0x6'));config[_0x3bf4('0x7')]=_['defaults'](config[_0x3bf4('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3bf4('0x8'))(new Redis(config[_0x3bf4('0x7')]));function getAuthToken(_0x16fb6d,_0x45c487,_0xaeadaa){if(_0x16fb6d[_0x3bf4('0x9')]){_0x16fb6d[_0x3bf4('0xa')]=_0x16fb6d[_0x3bf4('0xb')][_0x3bf4('0xc')];_0x16fb6d[_0x3bf4('0xd')]=_0x16fb6d[_0x3bf4('0xb')][_0x3bf4('0xe')];return Promise['resolve'](_0x16fb6d[_0x3bf4('0xb')][_0x3bf4('0xf')]);}var _0x5c9f89={'method':'POST','uri':_0x45c487,'form':{'client_id':_0x16fb6d[_0x3bf4('0x10')],'resource':_0x16fb6d[_0x3bf4('0xa')],'username':_0x16fb6d[_0x3bf4('0x11')],'password':_0x16fb6d[_0x3bf4('0x12')],'grant_type':_0x3bf4('0x12'),'client_secret':_0x16fb6d['clientSecret']},'json':!![]};return rp(_0x5c9f89)[_0x3bf4('0x13')](function(_0xf89823){return _0xf89823[_0x3bf4('0x14')];})['catch'](function(_0x407783){logger[_0x3bf4('0x15')]('['+[_0xaeadaa[_0x3bf4('0x16')]()]+_0x3bf4('0x17'));return _0x407783[_0x3bf4('0x18')];});}function getUser(_0x3827c3,_0x1854aa,_0xa7fb95,_0x425937,_0x2c5a0b,_0x4bfe0d){return new Promise(function(_0x84b0b1,_0xb4d331){return getAuthToken(_0x1854aa,_0x425937,_0x4bfe0d)[_0x3bf4('0x13')](function(_0x2a06ba){var _0x1ac1b2={'method':'GET','uri':_0x2c5a0b+_0x3bf4('0x19'),'headers':{'Authorization':_0x3bf4('0x1a')+_0x2a06ba,'OData-Version':_0x3bf4('0x1b')},'json':!![]};return rp(_0x1ac1b2);})[_0x3bf4('0x13')](function(_0x4dab6b){var _0x59e11b=_0x4dab6b['value'];var _0x5d436a=![];var _0x3be409=null;if(!_['isNil'](_0xa7fb95)){if(intUtil[_0x3bf4('0x1c')](_0xa7fb95[_0x3bf4('0x1d')])){_0x3827c3[_0x3bf4('0x1e')]=_0xa7fb95[_0x3bf4('0x1d')];for(_0x3be409=0x0;_0x3be409<_0x59e11b[_0x3bf4('0x1f')];_0x3be409++){if(_0x59e11b[_0x3be409][_0x3bf4('0x20')]===_0xa7fb95['email']&&!_0x59e11b[_0x3be409][_0x3bf4('0x21')]){_0x5d436a=!![];logger[_0x3bf4('0x22')]('['+[_0x4bfe0d[_0x3bf4('0x16')]()]+_0x3bf4('0x23')+_0x59e11b[_0x3be409][_0x3bf4('0x24')]+'!');_0x3827c3[_0x3bf4('0x25')]=_0x59e11b[_0x3be409][_0x3bf4('0x24')];}}}}if(!_0x5d436a){logger[_0x3bf4('0x22')]('['+[_0x4bfe0d[_0x3bf4('0x16')]()]+_0x3bf4('0x26'));_0x3827c3[_0x3bf4('0x1e')]=_0x1854aa['username'];for(_0x3be409=0x0;_0x3be409<_0x59e11b[_0x3bf4('0x1f')];_0x3be409++){if(_0x59e11b[_0x3be409][_0x3bf4('0x20')]===_0x1854aa['username']){_0x3827c3[_0x3bf4('0x25')]=_0x59e11b[_0x3be409][_0x3bf4('0x24')];}}}_0x84b0b1(_0x3827c3);})[_0x3bf4('0x27')](function(_0x460720){_0xb4d331(_0x460720[_0x3bf4('0x18')]);});});}function createEndUser(_0x182dea,_0x4395a6,_0x441373,_0x251be1,_0x1835f0,_0x2ba09e,_0x4370b7){return new Promise(function(_0x5eeca2,_0x559ef5){return getAuthToken(_0x4395a6,_0x441373,_0x2ba09e)['then'](function(_0x5c1369){var _0x5aa874=_0x2ba09e[_0x3bf4('0x28')]()===_0x3bf4('0x29')?_0x1835f0[_0x3bf4('0x2a')]:_0x1835f0[_0x3bf4('0x2b')];var _0x3b2bd7={'method':'POST','uri':_0x251be1+'contacts','body':{'fullname':_0x5aa874,'firstname':_0x5aa874,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x182dea[_0x3bf4('0x25')]+')'},'headers':{'Authorization':_0x3bf4('0x1a')+_0x5c1369,'OData-Version':_0x3bf4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x3b2bd7['body'][_0x4370b7]=_0x5aa874;return rp(_0x3b2bd7);})[_0x3bf4('0x13')](function(_0x18401d){var _0x348dca=_0x18401d[_0x3bf4('0x2c')][_0x3bf4('0x2d')];var _0x13b2a4=_0x348dca[_0x3bf4('0x2e')](_0x348dca[_0x3bf4('0x2f')]('(')+0x1,_0x348dca[_0x3bf4('0x2f')](')'));_0x182dea[_0x3bf4('0x30')]=_0x13b2a4;_0x5eeca2(_0x182dea);})[_0x3bf4('0x27')](function(_0x33a2c6){_0x559ef5(_0x33a2c6[_0x3bf4('0x18')]);});});}function getEndUser(_0x2d0ed9,_0x5c70b7,_0x3ade20,_0x4a7ada,_0x26efb7,_0x5bcf19,_0x8dbe85,_0xd76489){var _0x5ae22f=_0x5bcf19[_0x3bf4('0x28')]()===_0x3bf4('0x29')?_0x26efb7['destcalleridnum']:_0x26efb7[_0x3bf4('0x2b')];return getAuthToken(_0x5c70b7,_0x3ade20,_0x5bcf19)[_0x3bf4('0x13')](function(_0x12c0ff){_0xd76489=_0xd76489?_0xd76489:_0x3bf4('0x31');var _0x175ab6={'method':_0x3bf4('0x32'),'uri':_0x4a7ada+'contacts?$select='+_0xd76489+'&$filter='+_0xd76489+_0x3bf4('0x33')+_0x5ae22f['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x3bf4('0x1a')+_0x12c0ff,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x175ab6);})[_0x3bf4('0x13')](function(_0x1e7ff5){var _0x4f4b77=![];if(!_0x1e7ff5)return _0x4f4b77;var _0x3b045d=_0x1e7ff5[_0x3bf4('0x34')];for(var _0x84fb75=0x0;_0x84fb75<_0x3b045d[_0x3bf4('0x1f')];_0x84fb75++){if(_0x3b045d[_0x84fb75][_0xd76489]===_0x5ae22f){_0x4f4b77=!![];_0x2d0ed9['enduserId']=_0x3b045d[_0x84fb75][_0x3bf4('0x35')];}}return _0x4f4b77;})['then'](function(_0x166bd0){if(_0x166bd0)return _0x2d0ed9;if(_0x8dbe85===_0x3bf4('0x36')){logger[_0x3bf4('0x22')]('['+[_0x5bcf19[_0x3bf4('0x16')]()]+_0x3bf4('0x37'));return _0x2d0ed9;}return createEndUser(_0x2d0ed9,_0x5c70b7,_0x3ade20,_0x4a7ada,_0x26efb7,_0x5bcf19,_0xd76489)[_0x3bf4('0x13')](function(_0x3dc31f){logger['info']('['+[_0x5bcf19[_0x3bf4('0x16')]()]+']\x20Enduser\x20created!',_0x3dc31f[_0x3bf4('0x30')]);return _0x3dc31f;});});}function getCustomFields(_0x154768,_0x2d3a7c,_0x2859f7){var _0x43caa4={};if(_0x154768['length']>0x0){_[_0x3bf4('0x38')](_0x154768,function(_0x39b1b3){if(_[_0x3bf4('0x39')]([_0x3bf4('0x3a'),_0x3bf4('0x3b')],_0x39b1b3[_0x3bf4('0x3c')])&&_0x39b1b3[_0x3bf4('0x3d')]&&!_0x39b1b3[_0x3bf4('0x3e')]){var _0x1efa1d=_0x39b1b3[_0x3bf4('0x3f')][_0x3bf4('0x28')]();var _0xbaa9d0=_0x1efa1d[_0x3bf4('0x2e')](0x0,_0x1efa1d['indexOf']('_'));var _0x125e46=_0x1efa1d['substring'](_0x1efa1d[_0x3bf4('0x40')]('_')+0x1);if(_0xbaa9d0===_0x2859f7){_0x43caa4[_0x125e46]=_0x39b1b3['content'];}}});}return _0x43caa4;}function getTicket(_0x2b11a1,_0x2e46fc,_0x2972b1,_0x2e8889,_0x149cb0,_0x2cfcc0,_0x2e85ec){return new Promise(function(_0x7117d0,_0x19c8a9){var _0xc68859;return getAuthToken(_0x2e46fc,_0x2972b1,_0x2e85ec)[_0x3bf4('0x13')](function(_0x3e28dc){if(_0x2cfcc0[_0x3bf4('0x41')]==='incident'){_0xc68859={'method':_0x3bf4('0x42'),'uri':_0x2e8889+_0x3bf4('0x43'),'body':Object[_0x3bf4('0x44')]({},{'title':intUtil[_0x3bf4('0x45')](_0x2cfcc0[_0x3bf4('0x46')],_0x149cb0,'\x20'),'description':intUtil[_0x3bf4('0x45')](_0x2cfcc0[_0x3bf4('0x47')],_0x149cb0,'\x0a'),'customerid_contact@odata.bind':_0x2b11a1[_0x3bf4('0x30')]?_0x3bf4('0x48')+_0x2b11a1['enduserId']+')':undefined,'ownerid@odata.bind':_0x3bf4('0x49')+_0x2b11a1[_0x3bf4('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2cfcc0[_0x3bf4('0x4a')],_0x149cb0,_0x2cfcc0[_0x3bf4('0x41')])),'headers':{'Authorization':_0x3bf4('0x1a')+_0x3e28dc,'OData-Version':_0x3bf4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2cfcc0[_0x3bf4('0x41')]===_0x3bf4('0x4b')){var _0x13e2cd=_0x2b11a1['enduserId']?[{'partyid_systemuser@odata.bind':_0x3bf4('0x49')+_0x2b11a1[_0x3bf4('0x25')]+')','participationtypemask':_0x2b11a1[_0x3bf4('0x4c')]===_0x3bf4('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x3bf4('0x48')+_0x2b11a1['enduserId']+')','participationtypemask':_0x2b11a1['callDirection']===_0x3bf4('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3bf4('0x49')+_0x2b11a1[_0x3bf4('0x25')]+')','participationtypemask':_0x2b11a1[_0x3bf4('0x4c')]===_0x3bf4('0x4d')?0x2:0x1}];_0xc68859={'method':'POST','uri':_0x2e8889+_0x3bf4('0x4e'),'body':Object[_0x3bf4('0x44')]({},{'subject':intUtil[_0x3bf4('0x45')](_0x2cfcc0['Subjects'],_0x149cb0,'\x20'),'phonenumber':String(_0x149cb0[_0x3bf4('0x2b')]),'description':intUtil[_0x3bf4('0x45')](_0x2cfcc0[_0x3bf4('0x47')],_0x149cb0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2b11a1[_0x3bf4('0x30')]?_0x3bf4('0x48')+_0x2b11a1[_0x3bf4('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2b11a1[_0x3bf4('0x25')]+')','directioncode':_0x2b11a1[_0x3bf4('0x4c')]===_0x3bf4('0x4d')?![]:!![],'phonecall_activity_parties':_0x13e2cd},getCustomFields(_0x2cfcc0[_0x3bf4('0x4a')],_0x149cb0,_0x2cfcc0[_0x3bf4('0x41')])),'headers':{'Authorization':_0x3bf4('0x1a')+_0x3e28dc,'OData-Version':_0x3bf4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xc68859);})['then'](function(_0x13e000){var _0x193ea1=_0x13e000[_0x3bf4('0x2c')][_0x3bf4('0x2d')];var _0x4c0494=_0x193ea1[_0x3bf4('0x2e')](_0x193ea1[_0x3bf4('0x2f')]('(')+0x1,_0x193ea1[_0x3bf4('0x2f')](')'));_0x2b11a1[_0x3bf4('0x4f')]=_0x4c0494;_0x7117d0(_0x2b11a1);})[_0x3bf4('0x27')](function(_0x39dae7){_0x19c8a9(_0x39dae7['message']);});});}function emit(_0x5a4206,_0x2ee699,_0x2a3bd7,_0x214e32){var _0x1853f9={'uri':util[_0x3bf4('0x50')](_0x3bf4('0x51'),_0x5a4206,_0x2a3bd7,_0x214e32)};io['to'](util['format'](_0x3bf4('0x52'),_0x2ee699))[_0x3bf4('0x53')]('trigger:browser:url',_0x1853f9);}exports['cs']=function(_0x52fa36,_0x48e55a,_0x4949ce,_0x1fc573,_0x270674,_0xf16be7,_0x1795a5,_0x43773f){var _0xc3e6a2={};_0xf16be7[_0x3bf4('0xa')]=_0xf16be7[_0x3bf4('0x9')]?intUtil[_0x3bf4('0x54')](_0xf16be7[_0x3bf4('0xb')][_0x3bf4('0xc')]):intUtil[_0x3bf4('0x54')](_0xf16be7['remoteUri']);_0xf16be7[_0x3bf4('0x55')]=intUtil[_0x3bf4('0x54')](_0xf16be7[_0x3bf4('0x55')]);_0xc3e6a2[_0x3bf4('0x4c')]=_0x43773f==='queue'||_0x43773f===_0x3bf4('0x56')?_0x3bf4('0x4d'):_0x3bf4('0x29');var _0x5c4cb8=_0xf16be7[_0x3bf4('0x9')]?util['format']('%s/api/data/v9.0/',_0xf16be7[_0x3bf4('0xb')][_0x3bf4('0xc')]):util[_0x3bf4('0x50')](_0x3bf4('0x57'),_0xf16be7[_0x3bf4('0xa')]);var _0x22a0de=util['format'](_0x3bf4('0x58'),_0xf16be7[_0x3bf4('0xd')]);var _0x370952=util[_0x3bf4('0x50')](_0x3bf4('0x59'),_0xf16be7[_0x3bf4('0x55')],_0x48e55a['uniqueid'],md5(_0x48e55a[_0x3bf4('0x5a')]));if(_0x270674&&_0x270674[_0x3bf4('0x5b')]){logger[_0x3bf4('0x22')](_0x3bf4('0x5c'),_0x3bf4('0x5d'));_0x48e55a[_0x3bf4('0x5e')]=_0x370952;}else if(_0x1795a5&&_0x1795a5[_0x3bf4('0x5f')]&&_0x1795a5[_0x3bf4('0x5f')]!==_0x3bf4('0x60')){logger[_0x3bf4('0x22')](_0x3bf4('0x61'),_0x3bf4('0x5d'));_0x48e55a[_0x3bf4('0x5e')]=_0x370952;}else{_0x48e55a['recordingURL']='';}return getUser(_0xc3e6a2,_0xf16be7,_0x1fc573,_0x22a0de,_0x5c4cb8,_0x43773f)[_0x3bf4('0x13')](function(_0x9b791f){logger['info']('['+_0x43773f['toUpperCase']()+_0x3bf4('0x62'),_0x9b791f[_0x3bf4('0x25')]);logger[_0x3bf4('0x22')]('['+_0x43773f[_0x3bf4('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x9b791f['userEmail']);return getEndUser(_0x9b791f,_0xf16be7,_0x22a0de,_0x5c4cb8,_0x48e55a,_0x43773f,_0x4949ce['moduleCreate'],_0x4949ce[_0x3bf4('0x63')]);})[_0x3bf4('0x13')](function(_0x2e9a6f){logger['info']('['+_0x43773f[_0x3bf4('0x16')]()+_0x3bf4('0x64'),_0x2e9a6f[_0x3bf4('0x30')]);logger[_0x3bf4('0x22')]('['+_0x43773f[_0x3bf4('0x16')]()+_0x3bf4('0x65'),_0x48e55a[_0x3bf4('0x2b')]);return getTicket(_0x2e9a6f,_0xf16be7,_0x22a0de,_0x5c4cb8,_0x48e55a,_0x4949ce,_0x43773f);})[_0x3bf4('0x13')](function(_0xdd3a61){logger['info'](util[_0x3bf4('0x50')]('['+_0x43773f['toUpperCase']()+_0x3bf4('0x66'),_0x4949ce[_0x3bf4('0x41')],_0xdd3a61[_0x3bf4('0x4f')]));logger[_0x3bf4('0x22')](util[_0x3bf4('0x50')]('['+_0x43773f[_0x3bf4('0x16')]()+_0x3bf4('0x67'),_0x43773f));if(_0x43773f!==_0x3bf4('0x56')&&_0x4949ce[_0x3bf4('0x68')]){logger[_0x3bf4('0x22')]('['+_0x43773f[_0x3bf4('0x16')]()+']',_0x3bf4('0x69'));emit(_0xf16be7[_0x3bf4('0xa')],_0x1fc573['name'],_0x4949ce[_0x3bf4('0x41')],_0xdd3a61['ticketId']);}})[_0x3bf4('0x27')](function(_0xce4c4e){logger[_0x3bf4('0x15')]('['+_0x43773f[_0x3bf4('0x16')]()+_0x3bf4('0x6a'),_0xce4c4e[_0x3bf4('0x18')]);console['error'](_0x3bf4('0x6b'),_0xce4c4e);});}; \ 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 bf3aba0..439ccae 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 _0xeb64=['unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','freshdesk','redis','localhost','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','defaults','GET','map','forEach','includes','string','picklist','type','customField','nameField','content','push','variable','idField','customVariable','Variable','toLowerCase','toString','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','user:%s','catch','error'];(function(_0x269fb2,_0x55bf32){var _0x507215=function(_0x3ae37d){while(--_0x3ae37d){_0x269fb2['push'](_0x269fb2['shift']());}};_0x507215(++_0x55bf32);}(_0xeb64,0xbf));var _0x4eb6=function(_0x3273f0,_0x4d6f5c){_0x3273f0=_0x3273f0-0x0;var _0x4ea89d=_0xeb64[_0x3273f0];return _0x4ea89d;};'use strict';var _=require(_0x4eb6('0x0'));var rp=require(_0x4eb6('0x1'));var md5=require(_0x4eb6('0x2'));var util=require('util');var Redis=require(_0x4eb6('0x3'));var intUtil=require(_0x4eb6('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4eb6('0x5'));config[_0x4eb6('0x6')]=_['defaults'](config[_0x4eb6('0x6')],{'host':_0x4eb6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4eb6('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x2c68d2,_0xfa720b,_0x567aa7){io['to'](_0x2c68d2)[_0x4eb6('0x8')](_0xfa720b,_0x567aa7);}function getTicket(_0x22d970,_0x4a18fc,_0x5f3fa5,_0x3f9bc5,_0x10fc69){logger[_0x4eb6('0x9')](_0x4eb6('0xa'));var _0x4a7bb6=_[_0x4eb6('0xb')]({'responder_id':_0x4a18fc['id'],'requester_id':_0x5f3fa5['id'],'name':util[_0x4eb6('0xc')](_0x4eb6('0xd'),_0x10fc69[_0x4eb6('0xe')]),'phone':_0x10fc69[_0x4eb6('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3f9bc5[_0x4eb6('0x10')],_0x10fc69,'\x20'),'description':intUtil[_0x4eb6('0x11')](_0x3f9bc5[_0x4eb6('0x12')],_0x10fc69,'
'),'tags':getTags(_0x3f9bc5['Tags'],_0x4eb6('0x13'))},getCustomFields(_0x3f9bc5[_0x4eb6('0x14')],_0x10fc69));_0x4a7bb6[_0x4eb6('0x15')]=_[_0x4eb6('0x16')](_[_0x4eb6('0x17')](_0x4a7bb6[_0x4eb6('0x15')],'id'),_0x4eb6('0x18'));return request({'uri':util[_0x4eb6('0xc')](_0x4eb6('0x19'),_0x22d970['remoteUri']),'method':_0x4eb6('0x1a'),'body':_0x4a7bb6})[_0x4eb6('0x1b')](function(_0x34f0c6){logger[_0x4eb6('0x9')](_0x4eb6('0x1c'));return _0x34f0c6;});}function getUser(_0xc5fc0f,_0x548b26){if(intUtil[_0x4eb6('0x1d')](_0x548b26)){return request({'uri':util[_0x4eb6('0xc')](_0x4eb6('0x1e'),_0xc5fc0f[_0x4eb6('0x1f')]),'qs':{'email':_0x548b26}})[_0x4eb6('0x1b')](function(_0x413797){if(_0x413797[_0x4eb6('0x20')]){logger[_0x4eb6('0x9')](_0x4eb6('0x21'));return _[_0x4eb6('0x22')](_0x413797,function(_0x3d5ecd){return _0x3d5ecd['contact'][_0x4eb6('0x23')]===_0x548b26;});}else{logger['info'](_0x4eb6('0x24'));return request({'uri':util[_0x4eb6('0xc')](_0x4eb6('0x25'),_0xc5fc0f[_0x4eb6('0x1f')])})[_0x4eb6('0x1b')](function(_0x563c0e){logger[_0x4eb6('0x9')](_0x4eb6('0x26'));return _0x563c0e;});}});}else{logger[_0x4eb6('0x9')](_0x4eb6('0x27'));return request({'uri':util[_0x4eb6('0xc')]('%s/api/v2/agents/me',_0xc5fc0f['remoteUri'])})[_0x4eb6('0x1b')](function(_0x129921){logger['info'](_0x4eb6('0x26'));return _0x129921;});}}function getEndUser(_0x4784c5,_0x4af592,_0x328e94){logger['info'](_0x4eb6('0x28'),_0x328e94);return request({'uri':util[_0x4eb6('0xc')](_0x4eb6('0x29'),_0x4784c5[_0x4eb6('0x1f')]),'qs':{'phone':_0x328e94}})['then'](function(_0x27f46f){if(_0x27f46f['length']){logger[_0x4eb6('0x9')](_0x4eb6('0x2a'));return _[_0x4eb6('0x22')](_0x27f46f,{'phone':_0x328e94});}else{logger['info'](_0x4eb6('0x2b'));return request({'uri':util[_0x4eb6('0xc')](_0x4eb6('0x29'),_0x4784c5[_0x4eb6('0x1f')]),'method':_0x4eb6('0x1a'),'body':{'name':_0x4af592,'phone':_0x328e94}})[_0x4eb6('0x1b')](function(_0x371708){logger[_0x4eb6('0x9')](_0x4eb6('0x2c'));return _0x371708;});}});}function getAuth(_0x1b56cf){return util['format'](_0x4eb6('0x2d'),new Buffer(_0x1b56cf[_0x4eb6('0x2e')]+':X')['toString'](_0x4eb6('0x2f')));}function request(_0x317213){logger[_0x4eb6('0x30')](_0x4eb6('0x31'),JSON['stringify'](_0x317213));return rp(_[_0x4eb6('0x32')](_0x317213,{'method':_0x4eb6('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x578988,_0x176544){var _0x3e9b75=[];if(_0x578988&&_0x578988['length']>0x0){_0x3e9b75=_[_0x4eb6('0x34')](_0x578988,_0x176544);}return _0x3e9b75;}function getCustomFields(_0x3c5648,_0x20ddbc){var _0x141773=[];var _0x202ec1={'custom_fields':[]};if(_0x3c5648[_0x4eb6('0x20')]>0x0){_[_0x4eb6('0x35')](_0x3c5648,function(_0x2fc42b){if(_[_0x4eb6('0x36')]([_0x4eb6('0x37'),_0x4eb6('0x38')],_0x2fc42b[_0x4eb6('0x39')])&&_0x2fc42b['nameField']&&!_0x2fc42b[_0x4eb6('0x3a')]){_0x202ec1[_0x2fc42b[_0x4eb6('0x3b')]['toLowerCase']()]=_0x2fc42b[_0x4eb6('0x3c')]['toString']();}else if(_[_0x4eb6('0x36')]([_0x4eb6('0x37'),_0x4eb6('0x38')],_0x2fc42b['type'])&&_0x2fc42b['idField']&&_0x2fc42b[_0x4eb6('0x3a')]){_0x202ec1[_0x4eb6('0x15')][_0x4eb6('0x3d')]({'id':_0x2fc42b['idField'],'value':_0x2fc42b['content']['toString']()});}else if(_0x2fc42b[_0x4eb6('0x39')]===_0x4eb6('0x3e')&&_0x2fc42b['variableName']&&_0x2fc42b[_0x4eb6('0x3f')]&&_0x2fc42b[_0x4eb6('0x3a')]){_0x20ddbc[_0x2fc42b['variableName']]&&_0x202ec1['custom_fields'][_0x4eb6('0x3d')]({'id':_0x2fc42b['idField'],'value':_0x20ddbc[_0x2fc42b['variableName']]['toString']()});}else if(_0x2fc42b[_0x4eb6('0x39')]===_0x4eb6('0x40')&&_0x2fc42b[_0x4eb6('0x41')]&&_0x2fc42b[_0x4eb6('0x41')][_0x4eb6('0x13')]&&_0x2fc42b['idField']&&_0x2fc42b[_0x4eb6('0x3a')]){_0x20ddbc[_0x2fc42b[_0x4eb6('0x41')][_0x4eb6('0x13')][_0x4eb6('0x42')]()]&&_0x202ec1['custom_fields'][_0x4eb6('0x3d')]({'id':_0x2fc42b[_0x4eb6('0x3f')],'value':_0x20ddbc[_0x2fc42b['Variable'][_0x4eb6('0x13')][_0x4eb6('0x42')]()][_0x4eb6('0x43')]()});}});}return _0x202ec1;}exports['queue']=function(_0x16456b,_0x3979bd,_0x1c7a85,_0x1cb424,_0x2ab356,_0x1a03f8){var _0x468032,_0x129c8e;_0x1a03f8[_0x4eb6('0x1f')]=intUtil[_0x4eb6('0x44')](_0x1a03f8[_0x4eb6('0x1f')]);_0x1a03f8[_0x4eb6('0x45')]=intUtil[_0x4eb6('0x44')](_0x1a03f8['serverUrl']);if(_0x2ab356&&_0x2ab356[_0x4eb6('0x46')]){logger[_0x4eb6('0x9')](_0x4eb6('0x47'),_0x4eb6('0x48'));_0x3979bd[_0x4eb6('0x49')]=util[_0x4eb6('0xc')](_0x4eb6('0x4a'),_0x1a03f8['serverUrl'],_0x3979bd[_0x4eb6('0x4b')],md5(_0x3979bd[_0x4eb6('0x4b')]));}else{_0x3979bd['recordingURL']='';}headers[_0x4eb6('0x4c')]=getAuth(_0x1a03f8);return getUser(_0x1a03f8,_0x1cb424[_0x4eb6('0x23')])[_0x4eb6('0x1b')](function(_0x1090e7){_0x468032=_0x1090e7;logger['info'](_0x4eb6('0x4d'),_0x468032['id']);return getEndUser(_0x1a03f8,_0x3979bd[_0x4eb6('0xe')],_0x3979bd[_0x4eb6('0xf')]);})[_0x4eb6('0x1b')](function(_0x52df10){_0x129c8e=_0x52df10;logger['info']('The\x20Enduser\x20ID\x20is:',_0x129c8e['id']);return getTicket(_0x1a03f8,_0x468032,_0x129c8e,_0x1c7a85,_0x3979bd);})[_0x4eb6('0x1b')](function(_0x253cf1){if(_0x253cf1&&_0x253cf1['id']){logger[_0x4eb6('0x9')](_0x4eb6('0x1c'));logger['info'](_0x4eb6('0x4e'),_0x253cf1['id']);logger[_0x4eb6('0x9')](_0x4eb6('0x47'),_0x4eb6('0x4f'));emit(util[_0x4eb6('0xc')]('user:%s',_0x1cb424[_0x4eb6('0x13')]),_0x4eb6('0x50'),{'uri':util[_0x4eb6('0xc')](_0x4eb6('0x51'),_0x1a03f8['remoteUri'],_0x253cf1['id'])});}})['catch'](function(_0x4b9097){logger['error'](_0x4eb6('0x47'),JSON[_0x4eb6('0x52')](_0x4b9097));});};exports[_0x4eb6('0x53')]=function(_0x2ecd77,_0x491af7,_0x2d31a2,_0x4d87c7,_0x118795,_0x194d92,_0x5d5800){var _0x161612,_0x2b4672;_0x194d92[_0x4eb6('0x1f')]=intUtil[_0x4eb6('0x44')](_0x194d92[_0x4eb6('0x1f')]);_0x194d92[_0x4eb6('0x45')]=intUtil[_0x4eb6('0x44')](_0x194d92[_0x4eb6('0x45')]);if(_0x5d5800&&_0x5d5800[_0x4eb6('0x54')]&&_0x5d5800[_0x4eb6('0x54')]!=='none'){logger['info'](_0x4eb6('0x55'),_0x4eb6('0x48'));_0x491af7[_0x4eb6('0x49')]=util[_0x4eb6('0xc')](_0x4eb6('0x4a'),_0x194d92[_0x4eb6('0x45')],_0x491af7[_0x4eb6('0x4b')],md5(_0x491af7['uniqueid']));}headers['Authorization']=getAuth(_0x194d92);return getUser(_0x194d92,_0x4d87c7[_0x4eb6('0x23')])[_0x4eb6('0x1b')](function(_0x1dacb9){_0x161612=_0x1dacb9;logger[_0x4eb6('0x9')](_0x4eb6('0x4d'),_0x161612['id']);return getEndUser(_0x194d92,_0x491af7[_0x4eb6('0x56')],_0x491af7['destcalleridnum']);})['then'](function(_0x1df449){_0x2b4672=_0x1df449;logger[_0x4eb6('0x9')](_0x4eb6('0x57'),_0x2b4672['id']);return getTicket(_0x194d92,_0x161612,_0x2b4672,_0x2d31a2,_0x491af7);})['then'](function(_0x53890d){if(_0x53890d&&_0x53890d['id']){logger[_0x4eb6('0x9')](_0x4eb6('0x1c'));logger[_0x4eb6('0x9')](_0x4eb6('0x4e'),_0x53890d['id']);logger[_0x4eb6('0x9')](_0x4eb6('0x55'),_0x4eb6('0x4f'));emit(util[_0x4eb6('0xc')](_0x4eb6('0x58'),_0x4d87c7['name']),_0x4eb6('0x50'),{'uri':util[_0x4eb6('0xc')](_0x4eb6('0x51'),_0x194d92[_0x4eb6('0x1f')],_0x53890d['id'])});}})[_0x4eb6('0x59')](function(_0x4a3e72){logger[_0x4eb6('0x5a')](_0x4eb6('0x55'),JSON[_0x4eb6('0x52')](_0x4a3e72));});};exports[_0x4eb6('0x5b')]=function(_0x4bda59,_0x2f106b,_0x7769b2,_0x1356c3,_0x20134b,_0x30dd2f){var _0x554e9a,_0x5e73eb;_0x30dd2f[_0x4eb6('0x1f')]=intUtil[_0x4eb6('0x44')](_0x30dd2f[_0x4eb6('0x1f')]);_0x30dd2f['serverUrl']=intUtil[_0x4eb6('0x44')](_0x30dd2f['serverUrl']);if(_0x20134b&&_0x20134b[_0x4eb6('0x46')]){logger[_0x4eb6('0x9')]('['+_0x2f106b[_0x4eb6('0x5c')][_0x4eb6('0x5d')]()+']',_0x4eb6('0x48'));_0x2f106b[_0x4eb6('0x49')]=util[_0x4eb6('0xc')](_0x4eb6('0x4a'),_0x30dd2f[_0x4eb6('0x45')],_0x2f106b[_0x4eb6('0x4b')],md5(_0x2f106b[_0x4eb6('0x4b')]));}else{_0x2f106b[_0x4eb6('0x49')]='';}headers[_0x4eb6('0x4c')]=getAuth(_0x30dd2f);return getUser(_0x30dd2f,'')[_0x4eb6('0x1b')](function(_0x165fb1){_0x554e9a=_0x165fb1;logger['info'](_0x4eb6('0x4d'),_0x554e9a['id']);return getEndUser(_0x30dd2f,_0x2f106b[_0x4eb6('0xe')],_0x2f106b[_0x4eb6('0xf')]);})[_0x4eb6('0x1b')](function(_0x518399){_0x5e73eb=_0x518399;logger[_0x4eb6('0x9')]('The\x20Enduser\x20ID\x20is:',_0x5e73eb['id']);return getTicket(_0x30dd2f,_0x554e9a,_0x5e73eb,_0x7769b2,_0x2f106b);})[_0x4eb6('0x1b')](function(_0x51662a){if(_0x51662a){logger[_0x4eb6('0x9')](_0x4eb6('0x1c'));logger[_0x4eb6('0x9')]('The\x20Ticket\x20ID\x20is:',_0x51662a['id']);}})[_0x4eb6('0x59')](function(_0x296de8){logger[_0x4eb6('0x5a')]('['+_0x2f106b[_0x4eb6('0x5c')][_0x4eb6('0x5d')]()+']',JSON['stringify'](_0x296de8));});}; \ No newline at end of file +var _0xa827=['base64','debug','stringify','GET','forEach','includes','string','type','nameField','toLowerCase','content','idField','customField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridname','destcalleridnum','catch','monitor_format','lastevent','toUpperCase','error','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridname','getString','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString'];(function(_0x5b89a0,_0x315a2a){var _0x44d81a=function(_0x2529f4){while(--_0x2529f4){_0x5b89a0['push'](_0x5b89a0['shift']());}};_0x44d81a(++_0x315a2a);}(_0xa827,0xe3));var _0x7a82=function(_0x59e39e,_0xe0bff8){_0x59e39e=_0x59e39e-0x0;var _0x25fb72=_0xa827[_0x59e39e];return _0x25fb72;};'use strict';var _=require(_0x7a82('0x0'));var rp=require('request-promise');var md5=require(_0x7a82('0x1'));var util=require(_0x7a82('0x2'));var Redis=require(_0x7a82('0x3'));var intUtil=require(_0x7a82('0x4'));var config=require(_0x7a82('0x5'));var logger=require(_0x7a82('0x6'))(_0x7a82('0x7'));config['redis']=_[_0x7a82('0x8')](config[_0x7a82('0x9')],{'host':_0x7a82('0xa'),'port':0x18eb});var io=require(_0x7a82('0xb'))(new Redis(config[_0x7a82('0x9')]));var headers={'Content-Type':_0x7a82('0xc'),'Accept':_0x7a82('0xc')};function emit(_0x2610bd,_0x4bbd35,_0x29623f){io['to'](_0x2610bd)['emit'](_0x4bbd35,_0x29623f);}function getTicket(_0x308723,_0x442770,_0x28e302,_0x4cf80c,_0x2d0ce2){logger['info'](_0x7a82('0xd'));var _0x5ab030=_[_0x7a82('0xe')]({'responder_id':_0x442770['id'],'requester_id':_0x28e302['id'],'name':util[_0x7a82('0xf')]('Caller\x20-\x20%s',_0x2d0ce2[_0x7a82('0x10')]),'phone':_0x2d0ce2['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7a82('0x11')](_0x4cf80c['Subjects'],_0x2d0ce2,'\x20'),'description':intUtil['getString'](_0x4cf80c[_0x7a82('0x12')],_0x2d0ce2,_0x7a82('0x13')),'tags':getTags(_0x4cf80c[_0x7a82('0x14')],_0x7a82('0x15'))},getCustomFields(_0x4cf80c['Fields'],_0x2d0ce2));_0x5ab030[_0x7a82('0x16')]=_[_0x7a82('0x17')](_[_0x7a82('0x18')](_0x5ab030[_0x7a82('0x16')],'id'),_0x7a82('0x19'));return request({'uri':util[_0x7a82('0xf')](_0x7a82('0x1a'),_0x308723[_0x7a82('0x1b')]),'method':_0x7a82('0x1c'),'body':_0x5ab030})[_0x7a82('0x1d')](function(_0x20a68f){logger[_0x7a82('0x1e')](_0x7a82('0x1f'));return _0x20a68f;});}function getUser(_0x3e7b3c,_0x4f8ae6){if(intUtil[_0x7a82('0x20')](_0x4f8ae6)){return request({'uri':util['format'](_0x7a82('0x21'),_0x3e7b3c['remoteUri']),'qs':{'email':_0x4f8ae6}})[_0x7a82('0x1d')](function(_0x39c084){if(_0x39c084[_0x7a82('0x22')]){logger['info'](_0x7a82('0x23'));return _['find'](_0x39c084,function(_0x32afda){return _0x32afda[_0x7a82('0x24')][_0x7a82('0x25')]===_0x4f8ae6;});}else{logger[_0x7a82('0x1e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7a82('0xf')](_0x7a82('0x26'),_0x3e7b3c[_0x7a82('0x1b')])})['then'](function(_0x4b64f1){logger[_0x7a82('0x1e')](_0x7a82('0x27'));return _0x4b64f1;});}});}else{logger[_0x7a82('0x1e')](_0x7a82('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x3e7b3c[_0x7a82('0x1b')])})[_0x7a82('0x1d')](function(_0x31308c){logger[_0x7a82('0x1e')](_0x7a82('0x27'));return _0x31308c;});}}function getEndUser(_0x2df98e,_0x503374,_0x2658d4){logger[_0x7a82('0x1e')]('Searching\x20enduser\x20with\x20phone',_0x2658d4);return request({'uri':util['format'](_0x7a82('0x29'),_0x2df98e[_0x7a82('0x1b')]),'qs':{'phone':_0x2658d4}})[_0x7a82('0x1d')](function(_0x1fd493){if(_0x1fd493[_0x7a82('0x22')]){logger[_0x7a82('0x1e')]('Enduser\x20found!');return _[_0x7a82('0x2a')](_0x1fd493,{'phone':_0x2658d4});}else{logger[_0x7a82('0x1e')](_0x7a82('0x2b'));return request({'uri':util[_0x7a82('0xf')](_0x7a82('0x29'),_0x2df98e[_0x7a82('0x1b')]),'method':_0x7a82('0x1c'),'body':{'name':_0x503374,'phone':_0x2658d4}})['then'](function(_0x3d6213){logger[_0x7a82('0x1e')]('Enduser\x20created.');return _0x3d6213;});}});}function getAuth(_0x4df652){return util['format'](_0x7a82('0x2c'),new Buffer(_0x4df652['apiKey']+':X')[_0x7a82('0x2d')](_0x7a82('0x2e')));}function request(_0x2caaa2){logger[_0x7a82('0x2f')]('[HTTP]',JSON[_0x7a82('0x30')](_0x2caaa2));return rp(_[_0x7a82('0x8')](_0x2caaa2,{'method':_0x7a82('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1af906,_0x2a67d5){var _0x1cad1a=[];if(_0x1af906&&_0x1af906[_0x7a82('0x22')]>0x0){_0x1cad1a=_['map'](_0x1af906,_0x2a67d5);}return _0x1cad1a;}function getCustomFields(_0x35789f,_0x1cf0f5){var _0x5e1af5=[];var _0xabfad7={'custom_fields':[]};if(_0x35789f[_0x7a82('0x22')]>0x0){_[_0x7a82('0x32')](_0x35789f,function(_0x3fe7d2){if(_[_0x7a82('0x33')]([_0x7a82('0x34'),'picklist'],_0x3fe7d2[_0x7a82('0x35')])&&_0x3fe7d2[_0x7a82('0x36')]&&!_0x3fe7d2['customField']){_0xabfad7[_0x3fe7d2[_0x7a82('0x36')][_0x7a82('0x37')]()]=_0x3fe7d2[_0x7a82('0x38')][_0x7a82('0x2d')]();}else if(_['includes']([_0x7a82('0x34'),'picklist'],_0x3fe7d2[_0x7a82('0x35')])&&_0x3fe7d2[_0x7a82('0x39')]&&_0x3fe7d2[_0x7a82('0x3a')]){_0xabfad7[_0x7a82('0x16')][_0x7a82('0x3b')]({'id':_0x3fe7d2[_0x7a82('0x39')],'value':_0x3fe7d2[_0x7a82('0x38')][_0x7a82('0x2d')]()});}else if(_0x3fe7d2[_0x7a82('0x35')]===_0x7a82('0x3c')&&_0x3fe7d2[_0x7a82('0x3d')]&&_0x3fe7d2['idField']&&_0x3fe7d2[_0x7a82('0x3a')]){_0x1cf0f5[_0x3fe7d2[_0x7a82('0x3d')]]&&_0xabfad7[_0x7a82('0x16')][_0x7a82('0x3b')]({'id':_0x3fe7d2['idField'],'value':_0x1cf0f5[_0x3fe7d2[_0x7a82('0x3d')]][_0x7a82('0x2d')]()});}else if(_0x3fe7d2[_0x7a82('0x35')]==='customVariable'&&_0x3fe7d2[_0x7a82('0x3e')]&&_0x3fe7d2[_0x7a82('0x3e')][_0x7a82('0x15')]&&_0x3fe7d2['idField']&&_0x3fe7d2[_0x7a82('0x3a')]){_0x1cf0f5[_0x3fe7d2['Variable'][_0x7a82('0x15')][_0x7a82('0x37')]()]&&_0xabfad7[_0x7a82('0x16')][_0x7a82('0x3b')]({'id':_0x3fe7d2[_0x7a82('0x39')],'value':_0x1cf0f5[_0x3fe7d2[_0x7a82('0x3e')]['name'][_0x7a82('0x37')]()]['toString']()});}});}return _0xabfad7;}exports[_0x7a82('0x3f')]=function(_0x532b2b,_0x35125c,_0x2110f5,_0x55ce37,_0x4febb4,_0x7be149){var _0x3e8eb2,_0x30de1a;_0x7be149[_0x7a82('0x1b')]=intUtil[_0x7a82('0x40')](_0x7be149[_0x7a82('0x1b')]);_0x7be149[_0x7a82('0x41')]=intUtil[_0x7a82('0x40')](_0x7be149[_0x7a82('0x41')]);if(_0x4febb4&&_0x4febb4['monitor_format']){logger[_0x7a82('0x1e')](_0x7a82('0x42'),'Recording\x20is\x20enabled!');_0x35125c[_0x7a82('0x43')]=util[_0x7a82('0xf')](_0x7a82('0x44'),_0x7be149[_0x7a82('0x41')],_0x35125c[_0x7a82('0x45')],md5(_0x35125c[_0x7a82('0x45')]));}else{_0x35125c[_0x7a82('0x43')]='';}headers['Authorization']=getAuth(_0x7be149);return getUser(_0x7be149,_0x55ce37[_0x7a82('0x25')])[_0x7a82('0x1d')](function(_0x2c1649){_0x3e8eb2=_0x2c1649;logger[_0x7a82('0x1e')](_0x7a82('0x46'),_0x3e8eb2['id']);return getEndUser(_0x7be149,_0x35125c[_0x7a82('0x10')],_0x35125c[_0x7a82('0x47')]);})[_0x7a82('0x1d')](function(_0x1e26c1){_0x30de1a=_0x1e26c1;logger['info'](_0x7a82('0x48'),_0x30de1a['id']);return getTicket(_0x7be149,_0x3e8eb2,_0x30de1a,_0x2110f5,_0x35125c);})[_0x7a82('0x1d')](function(_0x358202){if(_0x358202&&_0x358202['id']){logger['info'](_0x7a82('0x1f'));logger['info'](_0x7a82('0x49'),_0x358202['id']);logger[_0x7a82('0x1e')](_0x7a82('0x42'),_0x7a82('0x4a'));emit(util[_0x7a82('0xf')](_0x7a82('0x4b'),_0x55ce37[_0x7a82('0x15')]),_0x7a82('0x4c'),{'uri':util['format'](_0x7a82('0x4d'),_0x7be149[_0x7a82('0x1b')],_0x358202['id'])});}})['catch'](function(_0x7e5917){logger['error'](_0x7a82('0x42'),JSON[_0x7a82('0x30')](_0x7e5917));});};exports[_0x7a82('0x4e')]=function(_0x10223c,_0x1d14aa,_0x5acc3b,_0x215a65,_0x48089e,_0x5f1ff3,_0x3b86d2){var _0x561f99,_0x3ec4bd;_0x5f1ff3['remoteUri']=intUtil['stripTrailingSlash'](_0x5f1ff3[_0x7a82('0x1b')]);_0x5f1ff3[_0x7a82('0x41')]=intUtil['stripTrailingSlash'](_0x5f1ff3[_0x7a82('0x41')]);if(_0x3b86d2&&_0x3b86d2[_0x7a82('0x4f')]&&_0x3b86d2[_0x7a82('0x4f')]!==_0x7a82('0x50')){logger['info'](_0x7a82('0x51'),_0x7a82('0x52'));_0x1d14aa[_0x7a82('0x43')]=util[_0x7a82('0xf')](_0x7a82('0x44'),_0x5f1ff3[_0x7a82('0x41')],_0x1d14aa[_0x7a82('0x45')],md5(_0x1d14aa[_0x7a82('0x45')]));}headers[_0x7a82('0x53')]=getAuth(_0x5f1ff3);return getUser(_0x5f1ff3,_0x215a65[_0x7a82('0x25')])[_0x7a82('0x1d')](function(_0x4aec18){_0x561f99=_0x4aec18;logger[_0x7a82('0x1e')](_0x7a82('0x46'),_0x561f99['id']);return getEndUser(_0x5f1ff3,_0x1d14aa[_0x7a82('0x54')],_0x1d14aa[_0x7a82('0x55')]);})[_0x7a82('0x1d')](function(_0x3ae948){_0x3ec4bd=_0x3ae948;logger[_0x7a82('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x3ec4bd['id']);return getTicket(_0x5f1ff3,_0x561f99,_0x3ec4bd,_0x5acc3b,_0x1d14aa);})[_0x7a82('0x1d')](function(_0xaf7074){if(_0xaf7074&&_0xaf7074['id']){logger[_0x7a82('0x1e')](_0x7a82('0x1f'));logger['info'](_0x7a82('0x49'),_0xaf7074['id']);logger[_0x7a82('0x1e')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7a82('0xf')](_0x7a82('0x4b'),_0x215a65[_0x7a82('0x15')]),_0x7a82('0x4c'),{'uri':util[_0x7a82('0xf')]('%s/helpdesk/tickets/%d',_0x5f1ff3[_0x7a82('0x1b')],_0xaf7074['id'])});}})[_0x7a82('0x56')](function(_0x2ede41){logger['error'](_0x7a82('0x51'),JSON[_0x7a82('0x30')](_0x2ede41));});};exports['unmanaged']=function(_0x3bba89,_0x22311d,_0x122cdf,_0x1a9868,_0x1af4a6,_0x532026){var _0x200058,_0x593d07;_0x532026['remoteUri']=intUtil[_0x7a82('0x40')](_0x532026[_0x7a82('0x1b')]);_0x532026[_0x7a82('0x41')]=intUtil['stripTrailingSlash'](_0x532026[_0x7a82('0x41')]);if(_0x1af4a6&&_0x1af4a6[_0x7a82('0x57')]){logger[_0x7a82('0x1e')]('['+_0x22311d[_0x7a82('0x58')][_0x7a82('0x59')]()+']',_0x7a82('0x52'));_0x22311d[_0x7a82('0x43')]=util[_0x7a82('0xf')](_0x7a82('0x44'),_0x532026['serverUrl'],_0x22311d[_0x7a82('0x45')],md5(_0x22311d[_0x7a82('0x45')]));}else{_0x22311d[_0x7a82('0x43')]='';}headers[_0x7a82('0x53')]=getAuth(_0x532026);return getUser(_0x532026,'')[_0x7a82('0x1d')](function(_0x4736b0){_0x200058=_0x4736b0;logger[_0x7a82('0x1e')](_0x7a82('0x46'),_0x200058['id']);return getEndUser(_0x532026,_0x22311d[_0x7a82('0x10')],_0x22311d[_0x7a82('0x47')]);})['then'](function(_0x4107e9){_0x593d07=_0x4107e9;logger['info'](_0x7a82('0x48'),_0x593d07['id']);return getTicket(_0x532026,_0x200058,_0x593d07,_0x122cdf,_0x22311d);})[_0x7a82('0x1d')](function(_0x38dd86){if(_0x38dd86){logger[_0x7a82('0x1e')]('Ticket\x20created!');logger['info'](_0x7a82('0x49'),_0x38dd86['id']);}})[_0x7a82('0x56')](function(_0x2abbd6){logger[_0x7a82('0x5a')]('['+_0x22311d[_0x7a82('0x58')][_0x7a82('0x59')]()+']',JSON[_0x7a82('0x30')](_0x2abbd6));});}; \ 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 6a08bf7..bf3ce2c 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 _0xfe8b=['freshsales','redis','defaults','localhost','socket.io-emitter','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','serverUrl','remoteUri','username','calleridnum','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','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger'];(function(_0x454fa1,_0xa4117a){var _0x3dc462=function(_0x132778){while(--_0x132778){_0x454fa1['push'](_0x454fa1['shift']());}};_0x3dc462(++_0xa4117a);}(_0xfe8b,0x154));var _0xbfe8=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xfe8b[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var rp=require(_0xbfe8('0x0'));var md5=require(_0xbfe8('0x1'));var util=require(_0xbfe8('0x2'));var moment=require(_0xbfe8('0x3'));var Promise=require(_0xbfe8('0x4'));var Redis=require('ioredis');var intUtil=require(_0xbfe8('0x5'));var config=require(_0xbfe8('0x6'));var logger=require(_0xbfe8('0x7'))(_0xbfe8('0x8'));config[_0xbfe8('0x9')]=_[_0xbfe8('0xa')](config[_0xbfe8('0x9')],{'host':_0xbfe8('0xb'),'port':0x18eb});var io=require(_0xbfe8('0xc'))(new Redis(config[_0xbfe8('0x9')]));function getAdminId(_0x5deb63,_0x17b0d9,_0x2cd02d,_0x2a2893){return new Promise(function(_0x1b98a1,_0x2b0915){var _0x288a19=![];var _0x4d1bb5={'method':'GET','uri':_0x2a2893+'/api/selector/owners','json':!![]};_0x4d1bb5[_0xbfe8('0xd')]=_0x2cd02d;logger[_0xbfe8('0xe')](_0xbfe8('0xf'));return rp(_0x4d1bb5)[_0xbfe8('0x10')](function(_0x478be8){if(_0x478be8){var _0x4edc01=_0x478be8[_0xbfe8('0x11')];var _0x18b2f7=null;for(_0x18b2f7=0x0;_0x18b2f7<_0x4edc01[_0xbfe8('0x12')];_0x18b2f7++){if(_0x4edc01[_0x18b2f7][_0xbfe8('0x13')]===_0x5deb63[_0xbfe8('0x14')]){_0x5deb63[_0xbfe8('0x15')]=_0x4edc01[_0x18b2f7]['id'];_0x288a19=!![];}}if(_0x288a19){logger[_0xbfe8('0xe')](_0xbfe8('0x16'),_0x5deb63[_0xbfe8('0x15')]);_0x1b98a1(_0x5deb63);}else{_0x2b0915({'statusCode':0x194,'message':_0xbfe8('0x17')});}}else{_0x2b0915({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbfe8('0x18')](function(_0x33acfe){logger[_0xbfe8('0x19')]('['+[_0x17b0d9[_0xbfe8('0x1a')]()]+']',_0x33acfe[_0xbfe8('0x1b')]);_0x2b0915(_0x33acfe);});});}function getUser(_0x5d6d4d,_0x4c4ce1,_0x438ede){return function(_0x4ab892){return new Promise(function(_0x874bb,_0x17fd99){var _0x52e2b7={'method':_0xbfe8('0x1c'),'uri':_0x438ede+_0xbfe8('0x1d'),'json':!![]};_0x52e2b7['headers']=_0x4c4ce1;logger[_0xbfe8('0xe')](_0xbfe8('0x1e'));return rp(_0x52e2b7)[_0xbfe8('0x10')](function(_0x4c4edd){if(_0x4c4edd){var _0x168bdc=_0x4c4edd[_0xbfe8('0x11')];var _0x1e58b9=![];var _0xcd4aa=null;if(_0x4ab892['agentEmail']!==null){logger[_0xbfe8('0xe')](_0xbfe8('0x1f'),_0x4ab892[_0xbfe8('0x20')]);_0x4ab892[_0xbfe8('0x21')]=_0x4ab892[_0xbfe8('0x20')];for(_0xcd4aa=0x0;_0xcd4aa<_0x168bdc[_0xbfe8('0x12')];_0xcd4aa++){if(_0x168bdc[_0xcd4aa]['email']===_0x4ab892[_0xbfe8('0x20')]){_0x1e58b9=!![];_0x4ab892[_0xbfe8('0x22')]=_0x168bdc[_0xcd4aa]['id'];logger[_0xbfe8('0xe')](_0xbfe8('0x23'),_0x4ab892[_0xbfe8('0x22')]);}}}if(!_0x1e58b9){logger[_0xbfe8('0xe')](_0xbfe8('0x24'));_0x4ab892[_0xbfe8('0x21')]=_0x4ab892[_0xbfe8('0x14')];_0x4ab892['userId']=_0x4ab892[_0xbfe8('0x15')];_0x1e58b9=!![];}if(_0x1e58b9){_0x874bb(_0x4ab892);}else{_0x17fd99({'statusCode':0x194,'message':_0xbfe8('0x17')});}}else{_0x17fd99({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbfe8('0x18')](function(_0x5c8163){logger[_0xbfe8('0x19')]('['+[_0x5d6d4d[_0xbfe8('0x1a')]()]+']',_0x5c8163['message']);_0x17fd99(_0x5c8163);});});};}function searchContact(_0x579ea7,_0x26f180,_0x41ac05,_0x3ea564){return new Promise(function(_0x4f9219,_0x25e7d0){var _0x115cdb={'method':_0xbfe8('0x1c'),'headers':_0x26f180,'uri':_0x579ea7+_0xbfe8('0x25')+_0x3ea564+_0xbfe8('0x26')+_0x41ac05+_0xbfe8('0x27'),'json':!![]};rp(_0x115cdb)[_0xbfe8('0x10')](function(_0x243f51){var _0x2791ca=_[_0xbfe8('0x28')](_0x243f51[_0xbfe8('0x29')][_0xbfe8('0x29')],[_0x41ac05,_0x3ea564]);_0x4f9219(_0x2791ca);})['catch'](function(_0xf42f51){_0x25e7d0(_0xf42f51);});});}function getEndUser(_0x50d04d,_0x3207d0,_0x1e10bf){return function(_0x57e2eb){return new Promise(function(_0x31d1cc,_0x13f4a1){logger[_0xbfe8('0xe')](util[_0xbfe8('0x2a')](_0xbfe8('0x2b'),_0x57e2eb[_0xbfe8('0x2c')]));searchContact(_0x1e10bf,_0x3207d0,_0xbfe8('0x2d'),_0x57e2eb[_0xbfe8('0x2c')])[_0xbfe8('0x10')](function(_0x13cc95){if(_0x13cc95){_0x57e2eb[_0xbfe8('0x2e')]=_0x13cc95['id'];logger[_0xbfe8('0xe')]('Contact\x20found\x20mobile_number:',_0x57e2eb[_0xbfe8('0x2e')]);return _0x31d1cc(_0x57e2eb);}searchContact(_0x1e10bf,_0x3207d0,_0xbfe8('0x2f'),_0x57e2eb[_0xbfe8('0x2c')])[_0xbfe8('0x10')](function(_0x937a82){if(_0x937a82){_0x57e2eb[_0xbfe8('0x2e')]=_0x937a82['id'];logger[_0xbfe8('0xe')](_0xbfe8('0x30'),_0x57e2eb[_0xbfe8('0x2e')]);return _0x31d1cc(_0x57e2eb);}createEndUser(_0x57e2eb,_0x50d04d,_0x3207d0,_0x1e10bf)[_0xbfe8('0x10')](function(_0x2731eb){logger['info'](_0xbfe8('0x31'),_0x2731eb[_0xbfe8('0x2e')]);return _0x31d1cc(_0x2731eb);});});})[_0xbfe8('0x18')](function(_0x567a92){_0x13f4a1(_0x567a92);});});};}function createEndUser(_0x457195,_0x5d217f,_0x52edaf,_0x31bbf1){return new Promise(function(_0x5ac0fa,_0x212948){var _0x984b52=moment();var _0x5c6d7f={'method':'POST','uri':_0x31bbf1+_0xbfe8('0x32'),'body':{'contact':{'last_name':_0x457195['contactNumber'],'work_number':_0x457195['contactNumber'],'mobile_number':_0x457195[_0xbfe8('0x2c')],'owner_id':_0x457195[_0xbfe8('0x22')],'created_at':_0x984b52[_0xbfe8('0x2a')](_0xbfe8('0x33'))}},'json':!![]};_0x5c6d7f['headers']=_0x52edaf;logger[_0xbfe8('0xe')](_0xbfe8('0x34'));return rp(_0x5c6d7f)['then'](function(_0x131bbb){_0x457195['endUserId']=_0x131bbb['contact']['id'];_0x5ac0fa(_0x457195);})[_0xbfe8('0x18')](function(_0x227b71){logger[_0xbfe8('0x19')]('['+[_0x5d217f[_0xbfe8('0x1a')]()]+']',_0x227b71[_0xbfe8('0x1b')]);_0x212948(_0x227b71[_0xbfe8('0x1b')]);});});}function getTicket(_0x51ede3,_0x3f8f7e,_0xb74af9,_0x448726,_0x419c3d){return function(_0x155d07){logger['info'](_0xbfe8('0x35'));return new Promise(function(_0x2335ca,_0x5808fb){var _0x2fd2dc=moment();var _0x43b22f={'method':_0xbfe8('0x36'),'uri':_0xb74af9+_0xbfe8('0x37'),'body':{'title':intUtil['getString'](_0x448726[_0xbfe8('0x38')],_0x419c3d,'\x20'),'description':intUtil[_0xbfe8('0x39')](_0x448726[_0xbfe8('0x3a')],_0x419c3d,'\x0a'),'owner_id':_0x155d07[_0xbfe8('0x22')],'creater_id':_0x155d07[_0xbfe8('0x15')],'targetable_id':_0x155d07[_0xbfe8('0x2e')],'targetable_type':_0xbfe8('0x3b'),'created_at':_0x2fd2dc[_0xbfe8('0x2a')](_0xbfe8('0x33')),'due_date':_0x2fd2dc['add'](0x1e,'m')['format'](_0xbfe8('0x33'))},'json':!![]};_0x43b22f[_0xbfe8('0xd')]=_0x3f8f7e;return rp(_0x43b22f)['then'](function(_0x410c23){_0x155d07[_0xbfe8('0x3c')]=_0x410c23['task']['id'];logger['info'](_0xbfe8('0x3d'),_0x155d07[_0xbfe8('0x3c')]);_0x2335ca(_0x155d07);})['catch'](function(_0xcf639a){logger[_0xbfe8('0x19')]('['+[_0x51ede3[_0xbfe8('0x1a')]()]+']',_0xcf639a[_0xbfe8('0x1b')]);_0x5808fb(_0xcf639a[_0xbfe8('0x1b')]);});});};}function emit(_0x22d168,_0x2dff68,_0x2be7f0){var _0x2eb47b={'uri':_0x22d168+_0xbfe8('0x3e')+_0x2be7f0};io['to'](util[_0xbfe8('0x2a')](_0xbfe8('0x3f'),_0x2dff68))[_0xbfe8('0x40')](_0xbfe8('0x41'),_0x2eb47b);}exports['cs']=function(_0x26f742,_0xd2cf36,_0x5d863c,_0x2d9a09,_0x3c273b,_0x3ac6d2,_0xe33e79,_0x179df1){var _0x2c3906={};var _0x11a500={'Authorization':_0xbfe8('0x42')+_0x3ac6d2['apiKey']};_0x3ac6d2['remoteUri']=intUtil[_0xbfe8('0x43')](_0x3ac6d2['remoteUri']);_0x3ac6d2['serverUrl']=intUtil[_0xbfe8('0x43')](_0x3ac6d2[_0xbfe8('0x44')]);var _0x105eec=_0x3ac6d2[_0xbfe8('0x45')];_0x2c3906[_0xbfe8('0x14')]=_0x3ac6d2[_0xbfe8('0x46')];_0x2c3906[_0xbfe8('0x2c')]=_0x179df1['toLowerCase']()==='outbound'?_0xd2cf36['destcalleridnum']:_0xd2cf36[_0xbfe8('0x47')];_0x2c3906['callDirection']=_0x179df1===_0xbfe8('0x48')||_0x179df1===_0xbfe8('0x49')?'queue':'outbound';if(_0x2d9a09){_0x2c3906[_0xbfe8('0x20')]=_0x2d9a09[_0xbfe8('0x13')];}var _0x4ea1e0=util[_0xbfe8('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d2['serverUrl'],_0xd2cf36[_0xbfe8('0x4a')],md5(_0xd2cf36['uniqueid']));if(_0x3c273b&&_0x3c273b[_0xbfe8('0x4b')]){logger[_0xbfe8('0xe')](_0xbfe8('0x4c'),_0xbfe8('0x4d'));_0xd2cf36[_0xbfe8('0x4e')]=_0x4ea1e0;}else if(_0xe33e79&&_0xe33e79[_0xbfe8('0x4f')]&&_0xe33e79[_0xbfe8('0x4f')]!==_0xbfe8('0x50')){logger['info'](_0xbfe8('0x51'),_0xbfe8('0x4d'));_0xd2cf36[_0xbfe8('0x4e')]=_0x4ea1e0;}else{_0xd2cf36['recordingURL']='';}return getAdminId(_0x2c3906,_0x179df1,_0x11a500,_0x105eec)[_0xbfe8('0x10')](getUser(_0x179df1,_0x11a500,_0x105eec))['then'](getEndUser(_0x179df1,_0x11a500,_0x105eec))[_0xbfe8('0x10')](getTicket(_0x179df1,_0x11a500,_0x105eec,_0x5d863c,_0xd2cf36))[_0xbfe8('0x10')](function(_0x2d2f1f){logger['info'](util[_0xbfe8('0x2a')](_0xbfe8('0x52'),_0x2d2f1f['ticketId']));if(_0x179df1!==_0xbfe8('0x49')){logger['info']('['+[_0x179df1[_0xbfe8('0x1a')]()]+']',_0xbfe8('0x53'));emit(_0x105eec,_0x2d9a09[_0xbfe8('0x54')],_0x2d2f1f[_0xbfe8('0x2e')]);}})[_0xbfe8('0x18')](function(_0x442454){logger['error']('['+[_0x179df1[_0xbfe8('0x1a')]()]+_0xbfe8('0x55'),util[_0xbfe8('0x56')](_0x442454,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xee3a=['ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','users','adminId','catch','error','toUpperCase','message','info','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','Admin\x20selected','adminEmail','Requested\x20Resource\x20not\x20Found','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add'];(function(_0x2b12b9,_0x43e58e){var _0x45e03a=function(_0x1a2478){while(--_0x1a2478){_0x2b12b9['push'](_0x2b12b9['shift']());}};_0x45e03a(++_0x43e58e);}(_0xee3a,0x181));var _0xaee3=function(_0x5f3819,_0x46307c){_0x5f3819=_0x5f3819-0x0;var _0x171bb0=_0xee3a[_0x5f3819];return _0x171bb0;};'use strict';var _=require(_0xaee3('0x0'));var rp=require(_0xaee3('0x1'));var md5=require('md5');var util=require(_0xaee3('0x2'));var moment=require(_0xaee3('0x3'));var Promise=require('bluebird');var Redis=require(_0xaee3('0x4'));var intUtil=require(_0xaee3('0x5'));var config=require(_0xaee3('0x6'));var logger=require(_0xaee3('0x7'))(_0xaee3('0x8'));config[_0xaee3('0x9')]=_[_0xaee3('0xa')](config[_0xaee3('0x9')],{'host':_0xaee3('0xb'),'port':0x18eb});var io=require(_0xaee3('0xc'))(new Redis(config[_0xaee3('0x9')]));function getAdminId(_0x7d28cf,_0x8a919a,_0x387823,_0x295616){return new Promise(function(_0x526c1d,_0x19f8db){var _0x45e7b3=![];var _0x126d63={'method':_0xaee3('0xd'),'uri':_0x295616+_0xaee3('0xe'),'json':!![]};_0x126d63[_0xaee3('0xf')]=_0x387823;logger['info'](_0xaee3('0x10'));return rp(_0x126d63)['then'](function(_0x50dac7){if(_0x50dac7){var _0x37cf32=_0x50dac7[_0xaee3('0x11')];var _0x3e7d96=null;for(_0x3e7d96=0x0;_0x3e7d96<_0x37cf32['length'];_0x3e7d96++){if(_0x37cf32[_0x3e7d96]['email']===_0x7d28cf['adminEmail']){_0x7d28cf[_0xaee3('0x12')]=_0x37cf32[_0x3e7d96]['id'];_0x45e7b3=!![];}}if(_0x45e7b3){logger['info']('Admin\x20found:',_0x7d28cf[_0xaee3('0x12')]);_0x526c1d(_0x7d28cf);}else{_0x19f8db({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x19f8db({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xaee3('0x13')](function(_0x3ecbe7){logger[_0xaee3('0x14')]('['+[_0x8a919a[_0xaee3('0x15')]()]+']',_0x3ecbe7[_0xaee3('0x16')]);_0x19f8db(_0x3ecbe7);});});}function getUser(_0xcd84fc,_0x1a7dc6,_0x10ecff){return function(_0x330776){return new Promise(function(_0x5ca852,_0x2bb784){var _0x12a0b2={'method':_0xaee3('0xd'),'uri':_0x10ecff+'/api/selector/owners','json':!![]};_0x12a0b2['headers']=_0x1a7dc6;logger[_0xaee3('0x17')](_0xaee3('0x18'));return rp(_0x12a0b2)[_0xaee3('0x19')](function(_0x4152dc){if(_0x4152dc){var _0x4181d3=_0x4152dc[_0xaee3('0x11')];var _0x1308b2=![];var _0x1a3568=null;if(_0x330776[_0xaee3('0x1a')]!==null){logger[_0xaee3('0x17')](_0xaee3('0x1b'),_0x330776['agentEmail']);_0x330776[_0xaee3('0x1c')]=_0x330776[_0xaee3('0x1a')];for(_0x1a3568=0x0;_0x1a3568<_0x4181d3['length'];_0x1a3568++){if(_0x4181d3[_0x1a3568][_0xaee3('0x1d')]===_0x330776['agentEmail']){_0x1308b2=!![];_0x330776['userId']=_0x4181d3[_0x1a3568]['id'];logger['info'](_0xaee3('0x1e'),_0x330776[_0xaee3('0x1f')]);}}}if(!_0x1308b2){logger[_0xaee3('0x17')](_0xaee3('0x20'));_0x330776[_0xaee3('0x1c')]=_0x330776[_0xaee3('0x21')];_0x330776[_0xaee3('0x1f')]=_0x330776[_0xaee3('0x12')];_0x1308b2=!![];}if(_0x1308b2){_0x5ca852(_0x330776);}else{_0x2bb784({'statusCode':0x194,'message':_0xaee3('0x22')});}}else{_0x2bb784({'statusCode':0x194,'message':_0xaee3('0x22')});}})[_0xaee3('0x13')](function(_0x33c67a){logger[_0xaee3('0x14')]('['+[_0xcd84fc[_0xaee3('0x15')]()]+']',_0x33c67a[_0xaee3('0x16')]);_0x2bb784(_0x33c67a);});});};}function searchContact(_0x4db864,_0x159fb7,_0x9f5e1e,_0x470d77){return new Promise(function(_0xa863f7,_0x462994){var _0x41684b={'method':'GET','headers':_0x159fb7,'uri':_0x4db864+'/api/lookup?q='+_0x470d77+_0xaee3('0x23')+_0x9f5e1e+_0xaee3('0x24'),'json':!![]};rp(_0x41684b)[_0xaee3('0x19')](function(_0xf516c8){var _0x5dc076=_[_0xaee3('0x25')](_0xf516c8[_0xaee3('0x26')][_0xaee3('0x26')],[_0x9f5e1e,_0x470d77]);_0xa863f7(_0x5dc076);})[_0xaee3('0x13')](function(_0x5b0e5a){_0x462994(_0x5b0e5a);});});}function getEndUser(_0x5078c8,_0x3ef7ff,_0x5f561a){return function(_0x268f93){return new Promise(function(_0x30b5e9,_0x110593){logger[_0xaee3('0x17')](util[_0xaee3('0x27')](_0xaee3('0x28'),_0x268f93['contactNumber']));searchContact(_0x5f561a,_0x3ef7ff,_0xaee3('0x29'),_0x268f93[_0xaee3('0x2a')])[_0xaee3('0x19')](function(_0x5d85dc){if(_0x5d85dc){_0x268f93['endUserId']=_0x5d85dc['id'];logger[_0xaee3('0x17')](_0xaee3('0x2b'),_0x268f93[_0xaee3('0x2c')]);return _0x30b5e9(_0x268f93);}searchContact(_0x5f561a,_0x3ef7ff,_0xaee3('0x2d'),_0x268f93[_0xaee3('0x2a')])[_0xaee3('0x19')](function(_0x27de8d){if(_0x27de8d){_0x268f93[_0xaee3('0x2c')]=_0x27de8d['id'];logger['info'](_0xaee3('0x2e'),_0x268f93['endUserId']);return _0x30b5e9(_0x268f93);}createEndUser(_0x268f93,_0x5078c8,_0x3ef7ff,_0x5f561a)[_0xaee3('0x19')](function(_0x423a7a){logger['info'](_0xaee3('0x2f'),_0x423a7a[_0xaee3('0x2c')]);return _0x30b5e9(_0x423a7a);});});})[_0xaee3('0x13')](function(_0xf4c7b1){_0x110593(_0xf4c7b1);});});};}function createEndUser(_0x44b109,_0x21dbd8,_0x3463a9,_0x5de17e){return new Promise(function(_0x4cc86e,_0x78ce01){var _0x30b7f5=moment();var _0x485895={'method':_0xaee3('0x30'),'uri':_0x5de17e+_0xaee3('0x31'),'body':{'contact':{'last_name':_0x44b109[_0xaee3('0x2a')],'work_number':_0x44b109[_0xaee3('0x2a')],'mobile_number':_0x44b109[_0xaee3('0x2a')],'owner_id':_0x44b109['userId'],'created_at':_0x30b7f5[_0xaee3('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x485895[_0xaee3('0xf')]=_0x3463a9;logger[_0xaee3('0x17')](_0xaee3('0x32'));return rp(_0x485895)[_0xaee3('0x19')](function(_0x5c22e8){_0x44b109[_0xaee3('0x2c')]=_0x5c22e8[_0xaee3('0x33')]['id'];_0x4cc86e(_0x44b109);})[_0xaee3('0x13')](function(_0x19b462){logger[_0xaee3('0x14')]('['+[_0x21dbd8[_0xaee3('0x15')]()]+']',_0x19b462['message']);_0x78ce01(_0x19b462[_0xaee3('0x16')]);});});}function getTicket(_0x4c3af0,_0x2d4b57,_0x492aa1,_0x128d6f,_0x351ee6){return function(_0x221bb0){logger[_0xaee3('0x17')](_0xaee3('0x34'));return new Promise(function(_0x4e2aba,_0x391a69){var _0x517f57=moment();var _0x53ffc3={'method':'POST','uri':_0x492aa1+_0xaee3('0x35'),'body':{'title':intUtil[_0xaee3('0x36')](_0x128d6f[_0xaee3('0x37')],_0x351ee6,'\x20'),'description':intUtil[_0xaee3('0x36')](_0x128d6f[_0xaee3('0x38')],_0x351ee6,'\x0a'),'owner_id':_0x221bb0[_0xaee3('0x1f')],'creater_id':_0x221bb0[_0xaee3('0x12')],'targetable_id':_0x221bb0[_0xaee3('0x2c')],'targetable_type':_0xaee3('0x39'),'created_at':_0x517f57[_0xaee3('0x27')](_0xaee3('0x3a')),'due_date':_0x517f57[_0xaee3('0x3b')](0x1e,'m')[_0xaee3('0x27')](_0xaee3('0x3a'))},'json':!![]};_0x53ffc3['headers']=_0x2d4b57;return rp(_0x53ffc3)[_0xaee3('0x19')](function(_0x6fd218){_0x221bb0[_0xaee3('0x3c')]=_0x6fd218[_0xaee3('0x3d')]['id'];logger[_0xaee3('0x17')](_0xaee3('0x3e'),_0x221bb0[_0xaee3('0x3c')]);_0x4e2aba(_0x221bb0);})[_0xaee3('0x13')](function(_0x3653b6){logger['error']('['+[_0x4c3af0[_0xaee3('0x15')]()]+']',_0x3653b6[_0xaee3('0x16')]);_0x391a69(_0x3653b6[_0xaee3('0x16')]);});});};}function emit(_0x361ef8,_0x17d034,_0x39048d){var _0x4b216a={'uri':_0x361ef8+_0xaee3('0x3f')+_0x39048d};io['to'](util[_0xaee3('0x27')]('user:%s',_0x17d034))[_0xaee3('0x40')](_0xaee3('0x41'),_0x4b216a);}exports['cs']=function(_0x5eaccd,_0x450abb,_0x5c960f,_0x295c7b,_0x527f6d,_0x46b186,_0x13e71f,_0x30c34e){var _0x5d09f0={};var _0x1034c3={'Authorization':_0xaee3('0x42')+_0x46b186[_0xaee3('0x43')]};_0x46b186[_0xaee3('0x44')]=intUtil[_0xaee3('0x45')](_0x46b186['remoteUri']);_0x46b186[_0xaee3('0x46')]=intUtil['stripTrailingSlash'](_0x46b186['serverUrl']);var _0x2fee1b=_0x46b186[_0xaee3('0x44')];_0x5d09f0[_0xaee3('0x21')]=_0x46b186['username'];_0x5d09f0[_0xaee3('0x2a')]=_0x30c34e[_0xaee3('0x47')]()===_0xaee3('0x48')?_0x450abb[_0xaee3('0x49')]:_0x450abb[_0xaee3('0x4a')];_0x5d09f0['callDirection']=_0x30c34e===_0xaee3('0x4b')||_0x30c34e===_0xaee3('0x4c')?_0xaee3('0x4b'):_0xaee3('0x48');if(_0x295c7b){_0x5d09f0[_0xaee3('0x1a')]=_0x295c7b[_0xaee3('0x1d')];}var _0x3dae2e=util[_0xaee3('0x27')](_0xaee3('0x4d'),_0x46b186[_0xaee3('0x46')],_0x450abb[_0xaee3('0x4e')],md5(_0x450abb[_0xaee3('0x4e')]));if(_0x527f6d&&_0x527f6d[_0xaee3('0x4f')]){logger['info'](_0xaee3('0x50'),_0xaee3('0x51'));_0x450abb[_0xaee3('0x52')]=_0x3dae2e;}else if(_0x13e71f&&_0x13e71f['recordingFormat']&&_0x13e71f[_0xaee3('0x53')]!=='none'){logger[_0xaee3('0x17')](_0xaee3('0x54'),_0xaee3('0x51'));_0x450abb['recordingURL']=_0x3dae2e;}else{_0x450abb[_0xaee3('0x52')]='';}return getAdminId(_0x5d09f0,_0x30c34e,_0x1034c3,_0x2fee1b)[_0xaee3('0x19')](getUser(_0x30c34e,_0x1034c3,_0x2fee1b))[_0xaee3('0x19')](getEndUser(_0x30c34e,_0x1034c3,_0x2fee1b))[_0xaee3('0x19')](getTicket(_0x30c34e,_0x1034c3,_0x2fee1b,_0x5c960f,_0x450abb))[_0xaee3('0x19')](function(_0x31b3d2){logger[_0xaee3('0x17')](util[_0xaee3('0x27')](_0xaee3('0x55'),_0x31b3d2[_0xaee3('0x3c')]));if(_0x30c34e!=='unmanaged'){logger[_0xaee3('0x17')]('['+[_0x30c34e[_0xaee3('0x15')]()]+']',_0xaee3('0x56'));emit(_0x2fee1b,_0x295c7b[_0xaee3('0x57')],_0x31b3d2[_0xaee3('0x2c')]);}})[_0xaee3('0x13')](function(_0x58a911){logger['error']('['+[_0x30c34e['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xaee3('0x58')](_0x58a911,{'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 59f142d..204adca 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 _0x2570=['../../../../config/logger','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','log','EVENT\x20UNKNOWN','unmanaged','salesforce','dynamics365','unknown\x20integration'];(function(_0x182fe1,_0x2f1227){var _0x468935=function(_0x179544){while(--_0x179544){_0x182fe1['push'](_0x182fe1['shift']());}};_0x468935(++_0x2f1227);}(_0x2570,0xea));var _0x0257=function(_0x8d244d,_0x49c04a){_0x8d244d=_0x8d244d-0x0;var _0x30fcd2=_0x2570[_0x8d244d];return _0x30fcd2;};'use strict';var _=require('lodash');var util=require(_0x0257('0x0'));var zendesk=require(_0x0257('0x1'));var salesforce=require(_0x0257('0x2'));var sugarcrm=require(_0x0257('0x3'));var freshdesk=require(_0x0257('0x4'));var zoho=require(_0x0257('0x5'));var desk=require(_0x0257('0x6'));var vtiger=require(_0x0257('0x7'));var servicenow=require(_0x0257('0x8'));var dynamics365=require(_0x0257('0x9'));var freshsales=require(_0x0257('0xa'));var integrations=[_0x0257('0xb'),'salesforce',_0x0257('0xc'),_0x0257('0xd'),_0x0257('0xe'),'desk',_0x0257('0xf'),'dynamics365',_0x0257('0x10'),_0x0257('0x11')];exports['exec']=function(_0x12d4f0,_0x1f71c7,_0x18338e,_0xa0ceac,_0x24a38b,_0x3d3a01){if(_0x18338e){if(_[_0x0257('0x12')](integrations,_0x12d4f0[_0x0257('0x13')][_0x0257('0x14')]())){try{var _0xe293ef=null;var _0x5da7d0='';var _0x37be6c=_0x18338e[_0x12d4f0[_0x0257('0x13')][_0x0257('0x14')]()];if(_0x37be6c){var _0xba724f=_0x37be6c[_0x12d4f0[_0x0257('0x15')]];if(_0xba724f){var _0x28dcf6=_[_0x0257('0x16')](_0xba724f[_0x0257('0x17')],{'id':parseInt(_0x12d4f0[_0x0257('0x18')],0xa)});if(_0x28dcf6){if(_0xa0ceac){if(_0x24a38b&&_0x1f71c7[_0x0257('0x19')]){_0x5da7d0=_0x0257('0x19');}else if(_0x1f71c7['routeId']){_0x5da7d0='outbound';}else{console[_0x0257('0x1a')](_0x0257('0x1b'),_0x1f71c7);}}else{_0x5da7d0=_0x0257('0x1c');}switch(_0x12d4f0[_0x0257('0x13')][_0x0257('0x14')]()){case _0x0257('0xb'):zendesk[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case _0x0257('0x1d'):salesforce[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case'sugarcrm':sugarcrm[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case _0x0257('0xd'):freshdesk[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case'zoho':zoho[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case'desk':desk[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case'vtiger':vtiger[_0x5da7d0](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01);break;case _0x0257('0x10'):freshsales['cs'](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01,_0x5da7d0);break;case _0x0257('0x11'):servicenow['cs'](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01,_0x5da7d0);break;case _0x0257('0x1e'):dynamics365['cs'](_0x12d4f0,_0x1f71c7,_0x28dcf6,_0xa0ceac,_0x24a38b,_0xba724f,_0x3d3a01,_0x5da7d0);break;default:console[_0x0257('0x1a')](_0x0257('0x1f'));}}else{_0xe293ef=require(_0x0257('0x20'))(_0x12d4f0[_0x0257('0x13')]['toLowerCase']());_0xe293ef['error']('[EXEC]',util['format'](_0x0257('0x21'),_0x12d4f0['data1'][_0x0257('0x14')](),_0x12d4f0[_0x0257('0x18')]));}}else{_0xe293ef=require(_0x0257('0x20'))(_0x12d4f0[_0x0257('0x13')][_0x0257('0x14')]());_0xe293ef[_0x0257('0x22')](_0x0257('0x23'),util[_0x0257('0x24')](_0x0257('0x25'),_0x12d4f0[_0x0257('0x13')]['toLowerCase'](),_0x12d4f0[_0x0257('0x15')]));}}else{}}catch(_0x5a8075){console['error'](_0x5a8075);}}}}; \ No newline at end of file +var _0x5944=['unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','vtiger'];(function(_0x162498,_0x88e129){var _0x2cddf2=function(_0x49f9ee){while(--_0x49f9ee){_0x162498['push'](_0x162498['shift']());}};_0x2cddf2(++_0x88e129);}(_0x5944,0x18d));var _0x4594=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5944[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x4594('0x0'));var util=require(_0x4594('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4594('0x2'));var sugarcrm=require(_0x4594('0x3'));var freshdesk=require(_0x4594('0x4'));var zoho=require(_0x4594('0x5'));var desk=require(_0x4594('0x6'));var vtiger=require(_0x4594('0x7'));var servicenow=require(_0x4594('0x8'));var dynamics365=require(_0x4594('0x9'));var freshsales=require(_0x4594('0xa'));var integrations=[_0x4594('0xb'),_0x4594('0xc'),_0x4594('0xd'),_0x4594('0xe'),_0x4594('0xf'),_0x4594('0x10'),'vtiger',_0x4594('0x11'),_0x4594('0x12'),_0x4594('0x13')];exports['exec']=function(_0x1c963e,_0x2542b8,_0x4c49cf,_0x42772c,_0x1119df,_0x69326c){if(_0x4c49cf){if(_[_0x4594('0x14')](integrations,_0x1c963e[_0x4594('0x15')][_0x4594('0x16')]())){try{var _0x4f364a=null;var _0x3e1994='';var _0x433790=_0x4c49cf[_0x1c963e[_0x4594('0x15')][_0x4594('0x16')]()];if(_0x433790){var _0x21e486=_0x433790[_0x1c963e[_0x4594('0x17')]];if(_0x21e486){var _0x2ff938=_['find'](_0x21e486[_0x4594('0x18')],{'id':parseInt(_0x1c963e['data3'],0xa)});if(_0x2ff938){if(_0x42772c){if(_0x1119df&&_0x2542b8[_0x4594('0x19')]){_0x3e1994=_0x4594('0x19');}else if(_0x2542b8[_0x4594('0x1a')]){_0x3e1994=_0x4594('0x1b');}else{console[_0x4594('0x1c')](_0x4594('0x1d'),_0x2542b8);}}else{_0x3e1994=_0x4594('0x1e');}switch(_0x1c963e[_0x4594('0x15')]['toLowerCase']()){case _0x4594('0xb'):zendesk[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case'salesforce':salesforce[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case _0x4594('0xd'):sugarcrm[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case _0x4594('0xe'):freshdesk[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case _0x4594('0xf'):zoho[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case _0x4594('0x10'):desk[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case _0x4594('0x1f'):vtiger[_0x3e1994](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c);break;case _0x4594('0x12'):freshsales['cs'](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c,_0x3e1994);break;case _0x4594('0x13'):servicenow['cs'](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c,_0x3e1994);break;case'dynamics365':dynamics365['cs'](_0x1c963e,_0x2542b8,_0x2ff938,_0x42772c,_0x1119df,_0x21e486,_0x69326c,_0x3e1994);break;default:console[_0x4594('0x1c')](_0x4594('0x20'));}}else{_0x4f364a=require('../../../../config/logger')(_0x1c963e[_0x4594('0x15')]['toLowerCase']());_0x4f364a[_0x4594('0x21')](_0x4594('0x22'),util[_0x4594('0x23')](_0x4594('0x24'),_0x1c963e[_0x4594('0x15')]['toLowerCase'](),_0x1c963e['data3']));}}else{_0x4f364a=require(_0x4594('0x25'))(_0x1c963e['data1'][_0x4594('0x16')]());_0x4f364a[_0x4594('0x21')](_0x4594('0x22'),util[_0x4594('0x23')](_0x4594('0x26'),_0x1c963e['data1']['toLowerCase'](),_0x1c963e[_0x4594('0x17')]));}}else{}}catch(_0x817c77){console[_0x4594('0x21')](_0x817c77);}}}}; \ 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 f89295d..55ae838 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 _0xbedc=['Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','$or','Contact','execute','length','cloneDeep','additionalSearchLead','account_contact_lead','additionalSearchAccount','merge','Account','additionalSearchContact','Lead','first','Phone','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Subjects','getString','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','lead','WhoId','endUserType','account','WhatId','Case','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','User','find','then','Email','info','Name'];(function(_0x922956,_0x1fe605){var _0x3a4d5f=function(_0x26835a){while(--_0x26835a){_0x922956['push'](_0x922956['shift']());}};_0x3a4d5f(++_0x1fe605);}(_0xbedc,0x15f));var _0xcbed=function(_0x256e87,_0x489c85){_0x256e87=_0x256e87-0x0;var _0x2e0861=_0xbedc[_0x256e87];return _0x2e0861;};'use strict';var _=require(_0xcbed('0x0'));var rp=require(_0xcbed('0x1'));var moment=require(_0xcbed('0x2'));var BPromise=require(_0xcbed('0x3'));var md5=require(_0xcbed('0x4'));var jsforce=require(_0xcbed('0x5'));var util=require(_0xcbed('0x6'));var Redis=require('ioredis');var intUtil=require(_0xcbed('0x7'));var config=require(_0xcbed('0x8'));var logger=require(_0xcbed('0x9'))(_0xcbed('0xa'));config[_0xcbed('0xb')]=_[_0xcbed('0xc')](config[_0xcbed('0xb')],{'host':_0xcbed('0xd'),'port':0x18eb});var io=require(_0xcbed('0xe'))(new Redis(config['redis']));function emit(_0x5b4a8b,_0x1e9641,_0x19ce77){io['to'](_0x5b4a8b)[_0xcbed('0xf')](_0x1e9641,_0x19ce77);}function getTicket(_0x1de97a,_0x2e1f3c,_0x561cf8,_0x3427a9,_0x334cc6,_0x5e94cc,_0x1d5e14,_0x211f0c){var _0x158b31=Object['assign']({},{'OwnerId':_0x2e1f3c['id'],'Subject':intUtil['getString'](_0x3427a9[_0xcbed('0x10')],_0x334cc6,'\x20'),'Description':intUtil[_0xcbed('0x11')](_0x3427a9['Descriptions'],_0x334cc6,'\x0a')},getCustomFields(_0x5e94cc,_0x334cc6));if(_0x561cf8){if(_0x3427a9[_0xcbed('0x12')]===_0xcbed('0x13')){_0x158b31[_0xcbed('0x14')]=moment[_0xcbed('0x15')]();_0x158b31[_0xcbed('0x16')]=![];_0x158b31[_0xcbed('0x17')]=![];if(_0x561cf8['endUserType']===_0xcbed('0x18')||_0x561cf8['endUserType']===_0xcbed('0x19')){_0x158b31[_0xcbed('0x1a')]=_0x561cf8['id'];}else if(_0x561cf8[_0xcbed('0x1b')]===_0xcbed('0x1c')){_0x158b31[_0xcbed('0x1d')]=_0x561cf8['id'];}}else if(_0x3427a9[_0xcbed('0x12')]===_0xcbed('0x1e')){if(_0x561cf8['endUserType']===_0xcbed('0x18')){_0x158b31['ContactId']=_0x561cf8['id'];}else if(_0x561cf8[_0xcbed('0x1b')]===_0xcbed('0x1c')){_0x158b31['AccountId']=_0x561cf8['id'];}else if(_0x561cf8[_0xcbed('0x1b')]==='lead'&&_0x3427a9['leadId']){_0x158b31[_0x3427a9[_0xcbed('0x1f')]]=_0x561cf8['id'];}else{logger['info'](_0xcbed('0x20'));}}}return _0x1d5e14['sobject'](_0x3427a9['ticketType'])[_0xcbed('0x21')](_0x158b31);}function getUser(_0x4b61bf,_0x4afab2,_0x580bcf){if(!_[_0xcbed('0x22')](_0x4afab2)&&intUtil['validateEmail'](_0x4afab2)){var _0x2df128={'Email':_0x4afab2};var _0x195c6a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x580bcf[_0xcbed('0x23')](_0xcbed('0x24'))[_0xcbed('0x25')](_0x2df128,_0x195c6a)['execute']()[_0xcbed('0x26')](function(_0x4b12a3){if(_0x4b12a3['length']){var _0x23be7f=_[_0xcbed('0x25')](_0x4b12a3,function(_0x4208dc){return _0x4208dc[_0xcbed('0x27')]===_0x4afab2;});if(_0x23be7f){logger[_0xcbed('0x28')]('Agent\x20%s\x20found.',_0x4afab2);return BPromise['resolve']({'id':_0x23be7f['Id'],'name':_0x23be7f[_0xcbed('0x29')]});}}else{logger['info'](_0xcbed('0x2a'),_0x4afab2);return _0x580bcf['identity']()[_0xcbed('0x26')](function(_0x3d31e9){return BPromise[_0xcbed('0x2b')]({'id':_0x3d31e9[_0xcbed('0x2c')],'name':_0x3d31e9[_0xcbed('0x2d')]});});}});}else{logger[_0xcbed('0x28')](_0xcbed('0x2a'),_0x4afab2);return _0x580bcf[_0xcbed('0x2e')]()[_0xcbed('0x26')](function(_0x6e8225){return BPromise['resolve']({'id':_0x6e8225[_0xcbed('0x2c')],'name':_0x6e8225['display_name']});});}}function getEndUser(_0x1d80bf,_0x231806,_0x98b92a,_0x26a87f,_0x36df21){var _0xa1418a={'$or':{'Phone':_0x26a87f}};var _0x536166={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xcbed('0x2b')]()['then'](function(){logger[_0xcbed('0x28')](_0xcbed('0x2f'),_0x26a87f,_0x231806[_0xcbed('0x30')]);switch(_0x231806[_0xcbed('0x30')]){case _0xcbed('0x31'):var _0x38d49a=_['cloneDeep'](_0xa1418a);if(_0x231806['additionalSearchContact']){var _0x240957={};_0x240957[_0x231806['additionalSearchContact']]=_0x26a87f;_['merge'](_0x38d49a[_0xcbed('0x32')],_0x240957);}return _0x36df21[_0xcbed('0x23')](_0xcbed('0x33'))[_0xcbed('0x25')](_0x38d49a,_0x536166)[_0xcbed('0x34')]()[_0xcbed('0x26')](function(_0x8f3d02){if(_0x8f3d02&&_0x8f3d02[_0xcbed('0x35')]){return _0x8f3d02;}else{var _0x4866a4=_[_0xcbed('0x36')](_0xa1418a);if(_0x231806[_0xcbed('0x37')]){var _0x244045={};_0x244045[_0x231806[_0xcbed('0x37')]]=_0x26a87f;_['merge'](_0x4866a4[_0xcbed('0x32')],_0x244045);}return _0x36df21[_0xcbed('0x23')]('Lead')[_0xcbed('0x25')](_0x4866a4,_0x536166);}});case _0xcbed('0x38'):var _0x2ee41f=_[_0xcbed('0x36')](_0xa1418a);if(_0x231806[_0xcbed('0x39')]){var _0x240957={};_0x240957[_0x231806[_0xcbed('0x39')]]=_0x26a87f;_[_0xcbed('0x3a')](_0x2ee41f[_0xcbed('0x32')],_0x240957);}return _0x36df21['sobject'](_0xcbed('0x3b'))[_0xcbed('0x25')](_0x2ee41f,_0x536166)[_0xcbed('0x34')]()['then'](function(_0x1392a7){if(_0x1392a7&&_0x1392a7[_0xcbed('0x35')]){return _0x1392a7;}else{var _0xe817f3=_[_0xcbed('0x36')](_0xa1418a);if(_0x231806[_0xcbed('0x3c')]){var _0x350adf={};_0x350adf[_0x231806[_0xcbed('0x3c')]]=_0x26a87f;_[_0xcbed('0x3a')](_0xe817f3[_0xcbed('0x32')],_0x350adf);}return _0x36df21['sobject'](_0xcbed('0x33'))[_0xcbed('0x25')](_0xe817f3,_0x536166)['then'](function(_0x13cc5b){if(_0x13cc5b&&_0x13cc5b[_0xcbed('0x35')]){return _0x13cc5b;}else{var _0x3e298c=_[_0xcbed('0x36')](_0xa1418a);if(_0x231806[_0xcbed('0x37')]){var _0x4e9d9e={};_0x4e9d9e[_0x231806[_0xcbed('0x37')]]=_0x26a87f;_[_0xcbed('0x3a')](_0x3e298c[_0xcbed('0x32')],_0x4e9d9e);}return _0x36df21[_0xcbed('0x23')](_0xcbed('0x3d'))[_0xcbed('0x25')](_0x3e298c,_0x536166);}});}});case _0xcbed('0x18'):var _0x38d49a=_[_0xcbed('0x36')](_0xa1418a);if(_0x231806[_0xcbed('0x3c')]){var _0x240957={};_0x240957[_0x231806[_0xcbed('0x3c')]]=_0x26a87f;_[_0xcbed('0x3a')](_0x38d49a[_0xcbed('0x32')],_0x240957);}return _0x36df21[_0xcbed('0x23')](_0xcbed('0x33'))[_0xcbed('0x25')](_0x38d49a,_0x536166)['execute']();case _0xcbed('0x19'):var _0x53142e=_['cloneDeep'](_0xa1418a);if(_0x231806[_0xcbed('0x37')]){var _0x240957={};_0x240957[_0x231806[_0xcbed('0x37')]]=_0x26a87f;_[_0xcbed('0x3a')](_0x53142e[_0xcbed('0x32')],_0x240957);}return _0x36df21['sobject'](_0xcbed('0x3d'))['find'](_0x53142e,_0x536166);case _0xcbed('0x1c'):var _0x2ee41f=_['cloneDeep'](_0xa1418a);if(_0x231806['additionalSearchAccount']){var _0x240957={};_0x240957[_0x231806['additionalSearchAccount']]=_0x26a87f;_['merge'](_0x2ee41f[_0xcbed('0x32')],_0x240957);}return _0x36df21[_0xcbed('0x23')]('Account')[_0xcbed('0x25')](_0x2ee41f,_0x536166);default:return null;}})['then'](function(_0x51868c){if(_0x51868c&&_0x51868c[_0xcbed('0x35')]){var _0x161808=_[_0xcbed('0x3e')](_0x51868c);if(_0x161808){return BPromise[_0xcbed('0x2b')]({'id':_0x161808['Id'],'name':_0x161808[_0xcbed('0x29')],'phone':_0x161808[_0xcbed('0x3f')],'endUserType':_0x161808['attributes'][_0xcbed('0x40')][_0xcbed('0x41')]()});}}})[_0xcbed('0x26')](function(_0x3fe836){if(_0x3fe836){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3fe836[_0xcbed('0x1b')],_0x26a87f);return BPromise[_0xcbed('0x2b')](_0x3fe836);}else{logger[_0xcbed('0x28')](_0xcbed('0x42'),_0x26a87f);var _0x991a66={'Phone':_0x26a87f};if(_0x231806[_0xcbed('0x43')]){if(_0x231806['moduleCreate']===_0xcbed('0x18')){logger['info'](_0xcbed('0x44'),_0x26a87f,_0x231806[_0xcbed('0x43')]);_0x991a66[_0xcbed('0x45')]=_0x98b92a!==_0xcbed('0x46')?_0x98b92a:util[_0xcbed('0x47')](_0xcbed('0x48'),_0x26a87f);}else if(_0x231806[_0xcbed('0x43')]==='lead'){logger[_0xcbed('0x28')](_0xcbed('0x44'),_0x26a87f,_0x231806[_0xcbed('0x43')]);_0x991a66[_0xcbed('0x45')]=_0x98b92a!==''?_0x98b92a:util[_0xcbed('0x47')](_0xcbed('0x48'),_0x26a87f);_0x991a66['Company']=_0xcbed('0x49');}else if(_0x231806[_0xcbed('0x43')]==='account'){logger[_0xcbed('0x28')](_0xcbed('0x44'),_0x26a87f,_0x231806['moduleCreate']);_0x991a66[_0xcbed('0x29')]=_0x98b92a!==_0xcbed('0x46')?_0x98b92a:util[_0xcbed('0x47')](_0xcbed('0x48'),_0x26a87f);}else{return null;}}return _0x36df21[_0xcbed('0x23')](_['upperFirst'](_0x231806[_0xcbed('0x43')]))[_0xcbed('0x21')](_0x991a66)[_0xcbed('0x26')](function(_0x4c644d){return BPromise[_0xcbed('0x2b')]({'id':_0x4c644d['id'],'endUserType':_0x231806[_0xcbed('0x43')]});});}});}function getCustomFields(_0x5b363b,_0x46ed64){var _0x5d943c={};if(_0x5b363b[_0xcbed('0x35')]>0x0){_[_0xcbed('0x4a')](_0x5b363b,function(_0x488692){if(_[_0xcbed('0x4b')]([_0xcbed('0x4c'),_0xcbed('0x4d')],_0x488692[_0xcbed('0x40')])&&_0x488692[_0xcbed('0x4e')]){_0x5d943c[_0x488692['idField']]=_0x488692[_0xcbed('0x4f')][_0xcbed('0x50')]();}else if(_0x488692[_0xcbed('0x40')]===_0xcbed('0x51')&&_0x488692[_0xcbed('0x52')]&&_0x488692[_0xcbed('0x4e')]){_0x46ed64[_0x488692['variableName']]&&(_0x5d943c[_0x488692[_0xcbed('0x4e')]]=_0x46ed64[_0x488692[_0xcbed('0x52')]]['toString']());}else if(_0x488692[_0xcbed('0x40')]===_0xcbed('0x53')&&_0x488692[_0xcbed('0x54')]&&_0x488692[_0xcbed('0x54')][_0xcbed('0x55')]&&_0x488692[_0xcbed('0x4e')]){_0x46ed64[_0x488692[_0xcbed('0x54')][_0xcbed('0x55')][_0xcbed('0x41')]()]&&(_0x5d943c[_0x488692[_0xcbed('0x4e')]]=_0x46ed64[_0x488692[_0xcbed('0x54')][_0xcbed('0x55')][_0xcbed('0x41')]()][_0xcbed('0x50')]());}});}return _0x5d943c;}function getConnection(_0xeffb31){var _0x504fe7=_0xeffb31['password']['concat'](_0xeffb31[_0xcbed('0x56')]);var _0x46871e=new jsforce[(_0xcbed('0x57'))]({'oauth2':{'loginUrl':_0xeffb31[_0xcbed('0x58')]||_0xcbed('0x59'),'clientId':_0xeffb31[_0xcbed('0x5a')],'clientSecret':_0xeffb31['clientSecret']}});return _0x46871e[_0xcbed('0x5b')](_0xeffb31[_0xcbed('0x5c')],_0x504fe7)[_0xcbed('0x26')](function(){logger[_0xcbed('0x28')](_0xcbed('0x5d'));return _0x46871e;});}exports[_0xcbed('0x5e')]=function(_0x5d3d2d,_0x1e5254,_0x8fb797,_0x30c760,_0x50d9aa,_0x1b5993){var _0x475632,_0x50d3b0,_0x41f639,_0x33e2cb;_0x1b5993['serverUrl']=intUtil[_0xcbed('0x5f')](_0x1b5993[_0xcbed('0x60')]);_0x1b5993[_0xcbed('0x58')]=intUtil[_0xcbed('0x5f')](_0x1b5993[_0xcbed('0x58')]);if(_0x50d9aa&&_0x50d9aa['monitor_format']){logger['info'](_0xcbed('0x61'),_0xcbed('0x62'));_0x1e5254['recordingURL']=util[_0xcbed('0x47')](_0xcbed('0x63'),_0x1b5993[_0xcbed('0x60')],_0x1e5254['uniqueid'],md5(_0x1e5254[_0xcbed('0x64')]));}else{_0x1e5254[_0xcbed('0x65')]='';}return getConnection(_0x1b5993)['then'](function(_0x5112b1){_0x33e2cb=_0x5112b1;return getUser(_0x1b5993,_0x30c760['email'],_0x33e2cb);})['then'](function(_0x5ee5fc){_0x475632=_0x5ee5fc;return getEndUser(_0x1b5993,_0x8fb797,_0x1e5254[_0xcbed('0x66')],_0x1e5254['calleridnum'],_0x33e2cb);})[_0xcbed('0x26')](function(_0x196ee0){_0x50d3b0=_0x196ee0;return getTicket(_0x1b5993,_0x475632,_0x50d3b0,_0x8fb797,_0x1e5254,_0x8fb797[_0xcbed('0x67')],_0x33e2cb,_0xcbed('0x5e'));})['then'](function(_0x214e6a){_0x41f639=_0x214e6a;logger[_0xcbed('0x28')](_0xcbed('0x68'),_0x41f639['id']);logger[_0xcbed('0x28')](_0xcbed('0x69'),_0x41f639['id'],_0x30c760[_0xcbed('0x55')],_0x1b5993[_0xcbed('0x40')]);switch(_0x1b5993['type']){case _0xcbed('0x6a'):emit(util[_0xcbed('0x47')]('user:%s',_0x30c760['name']),_0xcbed('0x6b'),{'recordId':_0x41f639['id']});break;case'newTab':emit(util[_0xcbed('0x47')](_0xcbed('0x6c'),_0x30c760[_0xcbed('0x55')]),_0xcbed('0x6d'),{'uri':util['format'](_0xcbed('0x6e'),_0x33e2cb[_0xcbed('0x6f')],_0x41f639['id'])});break;default:logger[_0xcbed('0x70')](_0xcbed('0x71'));}})[_0xcbed('0x72')](function(_0x2d82d6){logger[_0xcbed('0x70')](_0xcbed('0x61'),_0x2d82d6);});};exports['outbound']=function(_0x218a89,_0xe0f916,_0x1b7a9f,_0x73cc2c,_0x49ab9b,_0x35e91c,_0x5297e0){var _0x414e07,_0x43c03b,_0x19425e,_0x42abb3;_0x35e91c[_0xcbed('0x60')]=intUtil[_0xcbed('0x5f')](_0x35e91c[_0xcbed('0x60')]);_0x35e91c['remoteUri']=intUtil[_0xcbed('0x5f')](_0x35e91c[_0xcbed('0x58')]);if(_0x5297e0&&_0x5297e0[_0xcbed('0x73')]&&_0x5297e0[_0xcbed('0x73')]!==_0xcbed('0x74')){logger['info'](_0xcbed('0x75'),_0xcbed('0x62'));_0xe0f916['recordingURL']=util[_0xcbed('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35e91c[_0xcbed('0x60')],_0xe0f916[_0xcbed('0x64')],md5(_0xe0f916[_0xcbed('0x64')]));}return getConnection(_0x35e91c)[_0xcbed('0x26')](function(_0x252168){_0x42abb3=_0x252168;return getUser(_0x35e91c,_0x73cc2c[_0xcbed('0x76')],_0x42abb3);})[_0xcbed('0x26')](function(_0x137d73){_0x414e07=_0x137d73;return getEndUser(_0x35e91c,_0x1b7a9f,_0xe0f916[_0xcbed('0x77')],_0xe0f916[_0xcbed('0x78')],_0x42abb3);})[_0xcbed('0x26')](function(_0x358e41){_0x43c03b=_0x358e41;return getTicket(_0x35e91c,_0x414e07,_0x43c03b,_0x1b7a9f,_0xe0f916,_0x1b7a9f[_0xcbed('0x67')],_0x42abb3,_0xcbed('0x79'));})[_0xcbed('0x26')](function(_0x132bed){_0x19425e=_0x132bed;logger[_0xcbed('0x28')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x19425e['id']);logger[_0xcbed('0x28')](_0xcbed('0x7a'),_0x19425e['id'],_0x73cc2c['name'],_0x35e91c[_0xcbed('0x40')]);switch(_0x35e91c['type']){case _0xcbed('0x6a'):emit(util[_0xcbed('0x47')](_0xcbed('0x6c'),_0x73cc2c['name']),_0xcbed('0x6b'),{'recordId':_0x19425e['id']});break;case _0xcbed('0x7b'):emit(util[_0xcbed('0x47')](_0xcbed('0x6c'),_0x73cc2c['name']),_0xcbed('0x6d'),{'uri':util[_0xcbed('0x47')](_0xcbed('0x6e'),_0x42abb3[_0xcbed('0x6f')],_0x19425e['id'])});break;default:logger[_0xcbed('0x70')](_0xcbed('0x75'),_0xcbed('0x7c'));}})['catch'](function(_0x310353){logger[_0xcbed('0x70')](_0xcbed('0x75'),_0x310353);});};exports[_0xcbed('0x7d')]=function(_0x1932ea,_0x3e8a7b,_0x57e66e,_0x5e9190,_0x27d53f,_0xd14c08){var _0x53f789,_0x3d4883,_0x2287af,_0x296ec7;_0xd14c08[_0xcbed('0x60')]=intUtil[_0xcbed('0x5f')](_0xd14c08[_0xcbed('0x60')]);_0xd14c08[_0xcbed('0x58')]=intUtil['stripTrailingSlash'](_0xd14c08[_0xcbed('0x58')]);if(_0x27d53f&&_0x27d53f['monitor_format']){logger[_0xcbed('0x28')]('['+_0x3e8a7b[_0xcbed('0x7e')][_0xcbed('0x7f')]()+']','Recording\x20is\x20enabled!');_0x3e8a7b[_0xcbed('0x65')]=util[_0xcbed('0x47')](_0xcbed('0x63'),_0xd14c08[_0xcbed('0x60')],_0x3e8a7b['uniqueid'],md5(_0x3e8a7b[_0xcbed('0x64')]));}else{_0x3e8a7b['recordingURL']='';}return getConnection(_0xd14c08)[_0xcbed('0x26')](function(_0x2565d3){_0x296ec7=_0x2565d3;if(!_[_0xcbed('0x22')](_0x5e9190)){return getUser(_0xd14c08,_0x5e9190[_0xcbed('0x55')],_0x296ec7);}else{return getUser(_0xd14c08,null,_0x296ec7);}})[_0xcbed('0x26')](function(_0x513318){_0x53f789=_0x513318;return getEndUser(_0xd14c08,_0x57e66e,_0x3e8a7b[_0xcbed('0x66')],_0x3e8a7b[_0xcbed('0x80')],_0x296ec7);})['then'](function(_0x50a46c){_0x3d4883=_0x50a46c;return getTicket(_0xd14c08,_0x53f789,_0x3d4883,_0x57e66e,_0x3e8a7b,_0x57e66e[_0xcbed('0x67')],_0x296ec7);})['then'](function(_0x1442c8){_0x2287af=_0x1442c8;logger[_0xcbed('0x28')]('['+_0x3e8a7b[_0xcbed('0x7e')]['toUpperCase']()+_0xcbed('0x81'),_0x2287af['id']);logger[_0xcbed('0x28')]('['+_0x3e8a7b[_0xcbed('0x7e')][_0xcbed('0x7f')]()+_0xcbed('0x82'),_0xd14c08[_0xcbed('0x40')]);})['catch'](function(_0x2db2b7){logger[_0xcbed('0x70')]('['+_0x3e8a7b[_0xcbed('0x7e')]['toUpperCase']()+']',_0x2db2b7);});}; \ No newline at end of file +var _0xd698=['lodash','request-promise','moment','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','find','length','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','string','picklist','content','toString','variable','idField','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','username','Connection\x20established.','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stripTrailingSlash','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x1e7c87,_0x4fe3a9){var _0x2d5779=function(_0x4f5c65){while(--_0x4f5c65){_0x1e7c87['push'](_0x1e7c87['shift']());}};_0x2d5779(++_0x4fe3a9);}(_0xd698,0x1ec));var _0x8d69=function(_0x4708eb,_0x1d3404){_0x4708eb=_0x4708eb-0x0;var _0x5b8f04=_0xd698[_0x4708eb];return _0x5b8f04;};'use strict';var _=require(_0x8d69('0x0'));var rp=require(_0x8d69('0x1'));var moment=require(_0x8d69('0x2'));var BPromise=require('bluebird');var md5=require(_0x8d69('0x3'));var jsforce=require(_0x8d69('0x4'));var util=require(_0x8d69('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8d69('0x6'));var logger=require(_0x8d69('0x7'))(_0x8d69('0x8'));config[_0x8d69('0x9')]=_['defaults'](config[_0x8d69('0x9')],{'host':_0x8d69('0xa'),'port':0x18eb});var io=require(_0x8d69('0xb'))(new Redis(config[_0x8d69('0x9')]));function emit(_0x1def93,_0x540370,_0xfba56f){io['to'](_0x1def93)[_0x8d69('0xc')](_0x540370,_0xfba56f);}function getTicket(_0x310827,_0x2c8af3,_0x2b45cd,_0x459e0,_0x3d5c7b,_0x15ad3a,_0x5c7dc9,_0x467ea0){var _0x4fbf0e=Object[_0x8d69('0xd')]({},{'OwnerId':_0x2c8af3['id'],'Subject':intUtil[_0x8d69('0xe')](_0x459e0['Subjects'],_0x3d5c7b,'\x20'),'Description':intUtil[_0x8d69('0xe')](_0x459e0[_0x8d69('0xf')],_0x3d5c7b,'\x0a')},getCustomFields(_0x15ad3a,_0x3d5c7b));if(_0x2b45cd){if(_0x459e0[_0x8d69('0x10')]===_0x8d69('0x11')){_0x4fbf0e[_0x8d69('0x12')]=moment[_0x8d69('0x13')]();_0x4fbf0e['IsReminderSet']=![];_0x4fbf0e[_0x8d69('0x14')]=![];if(_0x2b45cd[_0x8d69('0x15')]===_0x8d69('0x16')||_0x2b45cd[_0x8d69('0x15')]===_0x8d69('0x17')){_0x4fbf0e[_0x8d69('0x18')]=_0x2b45cd['id'];}else if(_0x2b45cd[_0x8d69('0x15')]===_0x8d69('0x19')){_0x4fbf0e[_0x8d69('0x1a')]=_0x2b45cd['id'];}}else if(_0x459e0['ticketType']==='Case'){if(_0x2b45cd[_0x8d69('0x15')]===_0x8d69('0x16')){_0x4fbf0e[_0x8d69('0x1b')]=_0x2b45cd['id'];}else if(_0x2b45cd[_0x8d69('0x15')]===_0x8d69('0x19')){_0x4fbf0e[_0x8d69('0x1c')]=_0x2b45cd['id'];}else if(_0x2b45cd[_0x8d69('0x15')]==='lead'&&_0x459e0[_0x8d69('0x1d')]){_0x4fbf0e[_0x459e0[_0x8d69('0x1d')]]=_0x2b45cd['id'];}else{logger[_0x8d69('0x1e')](_0x8d69('0x1f'));}}}return _0x5c7dc9[_0x8d69('0x20')](_0x459e0['ticketType'])[_0x8d69('0x21')](_0x4fbf0e);}function getUser(_0x3ffcff,_0x173128,_0x265aac){if(!_[_0x8d69('0x22')](_0x173128)&&intUtil[_0x8d69('0x23')](_0x173128)){var _0x20775e={'Email':_0x173128};var _0x17287e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x265aac[_0x8d69('0x20')](_0x8d69('0x24'))['find'](_0x20775e,_0x17287e)[_0x8d69('0x25')]()[_0x8d69('0x26')](function(_0x538a9e){if(_0x538a9e['length']){var _0x1f3f2e=_['find'](_0x538a9e,function(_0x1b5b5a){return _0x1b5b5a[_0x8d69('0x27')]===_0x173128;});if(_0x1f3f2e){logger[_0x8d69('0x1e')](_0x8d69('0x28'),_0x173128);return BPromise[_0x8d69('0x29')]({'id':_0x1f3f2e['Id'],'name':_0x1f3f2e[_0x8d69('0x2a')]});}}else{logger[_0x8d69('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x173128);return _0x265aac['identity']()[_0x8d69('0x26')](function(_0x3c8c4a){return BPromise[_0x8d69('0x29')]({'id':_0x3c8c4a[_0x8d69('0x2b')],'name':_0x3c8c4a[_0x8d69('0x2c')]});});}});}else{logger[_0x8d69('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x173128);return _0x265aac['identity']()[_0x8d69('0x26')](function(_0x581d1){return BPromise['resolve']({'id':_0x581d1[_0x8d69('0x2b')],'name':_0x581d1[_0x8d69('0x2c')]});});}}function getEndUser(_0x1b1536,_0x2601ec,_0x5e3e7c,_0x22c09b,_0x13b98c){var _0x1dae6d={'$or':{'Phone':_0x22c09b}};var _0x305da5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x8d69('0x26')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x22c09b,_0x2601ec[_0x8d69('0x2d')]);switch(_0x2601ec[_0x8d69('0x2d')]){case _0x8d69('0x2e'):var _0x12e910=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec[_0x8d69('0x30')]){var _0x4c8b16={};_0x4c8b16[_0x2601ec[_0x8d69('0x30')]]=_0x22c09b;_['merge'](_0x12e910[_0x8d69('0x31')],_0x4c8b16);}return _0x13b98c[_0x8d69('0x20')](_0x8d69('0x32'))[_0x8d69('0x33')](_0x12e910,_0x305da5)[_0x8d69('0x25')]()[_0x8d69('0x26')](function(_0x4404d0){if(_0x4404d0&&_0x4404d0[_0x8d69('0x34')]){return _0x4404d0;}else{var _0x1bf8e3=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec[_0x8d69('0x35')]){var _0x611132={};_0x611132[_0x2601ec['additionalSearchLead']]=_0x22c09b;_[_0x8d69('0x36')](_0x1bf8e3[_0x8d69('0x31')],_0x611132);}return _0x13b98c[_0x8d69('0x20')](_0x8d69('0x37'))[_0x8d69('0x33')](_0x1bf8e3,_0x305da5);}});case _0x8d69('0x38'):var _0x2e3cbc=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec['additionalSearchAccount']){var _0x4c8b16={};_0x4c8b16[_0x2601ec[_0x8d69('0x39')]]=_0x22c09b;_[_0x8d69('0x36')](_0x2e3cbc[_0x8d69('0x31')],_0x4c8b16);}return _0x13b98c[_0x8d69('0x20')](_0x8d69('0x3a'))[_0x8d69('0x33')](_0x2e3cbc,_0x305da5)['execute']()['then'](function(_0x17be70){if(_0x17be70&&_0x17be70[_0x8d69('0x34')]){return _0x17be70;}else{var _0x359b93=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec['additionalSearchContact']){var _0x5441f2={};_0x5441f2[_0x2601ec['additionalSearchContact']]=_0x22c09b;_[_0x8d69('0x36')](_0x359b93[_0x8d69('0x31')],_0x5441f2);}return _0x13b98c['sobject'](_0x8d69('0x32'))[_0x8d69('0x33')](_0x359b93,_0x305da5)[_0x8d69('0x26')](function(_0x5bc2fe){if(_0x5bc2fe&&_0x5bc2fe[_0x8d69('0x34')]){return _0x5bc2fe;}else{var _0x30f774=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec[_0x8d69('0x35')]){var _0x1d58bf={};_0x1d58bf[_0x2601ec[_0x8d69('0x35')]]=_0x22c09b;_[_0x8d69('0x36')](_0x30f774[_0x8d69('0x31')],_0x1d58bf);}return _0x13b98c[_0x8d69('0x20')](_0x8d69('0x37'))[_0x8d69('0x33')](_0x30f774,_0x305da5);}});}});case _0x8d69('0x16'):var _0x12e910=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec[_0x8d69('0x30')]){var _0x4c8b16={};_0x4c8b16[_0x2601ec[_0x8d69('0x30')]]=_0x22c09b;_[_0x8d69('0x36')](_0x12e910[_0x8d69('0x31')],_0x4c8b16);}return _0x13b98c['sobject'](_0x8d69('0x32'))[_0x8d69('0x33')](_0x12e910,_0x305da5)[_0x8d69('0x25')]();case _0x8d69('0x17'):var _0x5040c3=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec['additionalSearchLead']){var _0x4c8b16={};_0x4c8b16[_0x2601ec[_0x8d69('0x35')]]=_0x22c09b;_[_0x8d69('0x36')](_0x5040c3[_0x8d69('0x31')],_0x4c8b16);}return _0x13b98c['sobject'](_0x8d69('0x37'))[_0x8d69('0x33')](_0x5040c3,_0x305da5);case'account':var _0x2e3cbc=_[_0x8d69('0x2f')](_0x1dae6d);if(_0x2601ec['additionalSearchAccount']){var _0x4c8b16={};_0x4c8b16[_0x2601ec[_0x8d69('0x39')]]=_0x22c09b;_[_0x8d69('0x36')](_0x2e3cbc[_0x8d69('0x31')],_0x4c8b16);}return _0x13b98c[_0x8d69('0x20')](_0x8d69('0x3a'))['find'](_0x2e3cbc,_0x305da5);default:return null;}})['then'](function(_0x5a90b6){if(_0x5a90b6&&_0x5a90b6[_0x8d69('0x34')]){var _0x12d996=_[_0x8d69('0x3b')](_0x5a90b6);if(_0x12d996){return BPromise['resolve']({'id':_0x12d996['Id'],'name':_0x12d996[_0x8d69('0x2a')],'phone':_0x12d996['Phone'],'endUserType':_0x12d996[_0x8d69('0x3c')][_0x8d69('0x3d')][_0x8d69('0x3e')]()});}}})[_0x8d69('0x26')](function(_0x286868){if(_0x286868){logger[_0x8d69('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x286868['endUserType'],_0x22c09b);return BPromise['resolve'](_0x286868);}else{logger[_0x8d69('0x1e')](_0x8d69('0x3f'),_0x22c09b);var _0x56b240={'Phone':_0x22c09b};if(_0x2601ec[_0x8d69('0x40')]){if(_0x2601ec[_0x8d69('0x40')]===_0x8d69('0x16')){logger[_0x8d69('0x1e')](_0x8d69('0x41'),_0x22c09b,_0x2601ec[_0x8d69('0x40')]);_0x56b240[_0x8d69('0x42')]=_0x5e3e7c!==_0x8d69('0x43')?_0x5e3e7c:util[_0x8d69('0x44')](_0x8d69('0x45'),_0x22c09b);}else if(_0x2601ec[_0x8d69('0x40')]==='lead'){logger['info'](_0x8d69('0x41'),_0x22c09b,_0x2601ec['moduleCreate']);_0x56b240[_0x8d69('0x42')]=_0x5e3e7c!==_0x8d69('0x43')?_0x5e3e7c:util[_0x8d69('0x44')](_0x8d69('0x45'),_0x22c09b);_0x56b240[_0x8d69('0x46')]='No\x20Company';}else if(_0x2601ec[_0x8d69('0x40')]==='account'){logger[_0x8d69('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x22c09b,_0x2601ec[_0x8d69('0x40')]);_0x56b240[_0x8d69('0x2a')]=_0x5e3e7c!==_0x8d69('0x43')?_0x5e3e7c:util['format'](_0x8d69('0x45'),_0x22c09b);}else{return null;}}return _0x13b98c[_0x8d69('0x20')](_['upperFirst'](_0x2601ec[_0x8d69('0x40')]))[_0x8d69('0x21')](_0x56b240)['then'](function(_0x5f450b){return BPromise['resolve']({'id':_0x5f450b['id'],'endUserType':_0x2601ec[_0x8d69('0x40')]});});}});}function getCustomFields(_0x37dd24,_0x2d9105){var _0x555195={};if(_0x37dd24['length']>0x0){_['forEach'](_0x37dd24,function(_0x2bbaf5){if(_['includes']([_0x8d69('0x47'),_0x8d69('0x48')],_0x2bbaf5['type'])&&_0x2bbaf5['idField']){_0x555195[_0x2bbaf5['idField']]=_0x2bbaf5[_0x8d69('0x49')][_0x8d69('0x4a')]();}else if(_0x2bbaf5['type']===_0x8d69('0x4b')&&_0x2bbaf5['variableName']&&_0x2bbaf5[_0x8d69('0x4c')]){_0x2d9105[_0x2bbaf5[_0x8d69('0x4d')]]&&(_0x555195[_0x2bbaf5[_0x8d69('0x4c')]]=_0x2d9105[_0x2bbaf5[_0x8d69('0x4d')]][_0x8d69('0x4a')]());}else if(_0x2bbaf5[_0x8d69('0x3d')]===_0x8d69('0x4e')&&_0x2bbaf5[_0x8d69('0x4f')]&&_0x2bbaf5['Variable'][_0x8d69('0x50')]&&_0x2bbaf5[_0x8d69('0x4c')]){_0x2d9105[_0x2bbaf5[_0x8d69('0x4f')][_0x8d69('0x50')][_0x8d69('0x3e')]()]&&(_0x555195[_0x2bbaf5['idField']]=_0x2d9105[_0x2bbaf5[_0x8d69('0x4f')][_0x8d69('0x50')][_0x8d69('0x3e')]()][_0x8d69('0x4a')]());}});}return _0x555195;}function getConnection(_0x5f51da){var _0x20d7c0=_0x5f51da['password'][_0x8d69('0x51')](_0x5f51da[_0x8d69('0x52')]);var _0x32f2a3=new jsforce[(_0x8d69('0x53'))]({'oauth2':{'loginUrl':_0x5f51da['remoteUri']||_0x8d69('0x54'),'clientId':_0x5f51da[_0x8d69('0x55')],'clientSecret':_0x5f51da['clientSecret']}});return _0x32f2a3['login'](_0x5f51da[_0x8d69('0x56')],_0x20d7c0)[_0x8d69('0x26')](function(){logger['info'](_0x8d69('0x57'));return _0x32f2a3;});}exports['queue']=function(_0x43d562,_0x55c200,_0x53c8a1,_0x4d996e,_0x293caf,_0x2a17e5){var _0x10ee66,_0xdf26ce,_0x2c2731,_0x18b2b5;_0x2a17e5[_0x8d69('0x58')]=intUtil['stripTrailingSlash'](_0x2a17e5['serverUrl']);_0x2a17e5[_0x8d69('0x59')]=intUtil['stripTrailingSlash'](_0x2a17e5[_0x8d69('0x59')]);if(_0x293caf&&_0x293caf[_0x8d69('0x5a')]){logger['info'](_0x8d69('0x5b'),_0x8d69('0x5c'));_0x55c200['recordingURL']=util[_0x8d69('0x44')](_0x8d69('0x5d'),_0x2a17e5['serverUrl'],_0x55c200[_0x8d69('0x5e')],md5(_0x55c200[_0x8d69('0x5e')]));}else{_0x55c200['recordingURL']='';}return getConnection(_0x2a17e5)[_0x8d69('0x26')](function(_0x45f732){_0x18b2b5=_0x45f732;return getUser(_0x2a17e5,_0x4d996e[_0x8d69('0x5f')],_0x18b2b5);})[_0x8d69('0x26')](function(_0x5acbd2){_0x10ee66=_0x5acbd2;return getEndUser(_0x2a17e5,_0x53c8a1,_0x55c200[_0x8d69('0x60')],_0x55c200[_0x8d69('0x61')],_0x18b2b5);})[_0x8d69('0x26')](function(_0x6749d8){_0xdf26ce=_0x6749d8;return getTicket(_0x2a17e5,_0x10ee66,_0xdf26ce,_0x53c8a1,_0x55c200,_0x53c8a1[_0x8d69('0x62')],_0x18b2b5,_0x8d69('0x63'));})[_0x8d69('0x26')](function(_0x4e4808){_0x2c2731=_0x4e4808;logger['info'](_0x8d69('0x64'),_0x2c2731['id']);logger[_0x8d69('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2c2731['id'],_0x4d996e['name'],_0x2a17e5[_0x8d69('0x3d')]);switch(_0x2a17e5[_0x8d69('0x3d')]){case _0x8d69('0x65'):emit(util[_0x8d69('0x44')]('user:%s',_0x4d996e['name']),_0x8d69('0x66'),{'recordId':_0x2c2731['id']});break;case _0x8d69('0x67'):emit(util[_0x8d69('0x44')](_0x8d69('0x68'),_0x4d996e[_0x8d69('0x50')]),_0x8d69('0x69'),{'uri':util[_0x8d69('0x44')](_0x8d69('0x6a'),_0x18b2b5['instanceUrl'],_0x2c2731['id'])});break;default:logger[_0x8d69('0x6b')](_0x8d69('0x6c'));}})[_0x8d69('0x6d')](function(_0x2c2c23){logger[_0x8d69('0x6b')](_0x8d69('0x5b'),_0x2c2c23);});};exports['outbound']=function(_0x4bfd8b,_0x235fb4,_0x4230d7,_0xd2bf90,_0x142295,_0x269f59,_0x49dd0e){var _0x38837c,_0x4a48d9,_0x508c13,_0x47d6b3;_0x269f59[_0x8d69('0x58')]=intUtil[_0x8d69('0x6e')](_0x269f59[_0x8d69('0x58')]);_0x269f59[_0x8d69('0x59')]=intUtil[_0x8d69('0x6e')](_0x269f59[_0x8d69('0x59')]);if(_0x49dd0e&&_0x49dd0e[_0x8d69('0x6f')]&&_0x49dd0e['recordingFormat']!=='none'){logger['info'](_0x8d69('0x70'),_0x8d69('0x5c'));_0x235fb4[_0x8d69('0x71')]=util[_0x8d69('0x44')](_0x8d69('0x5d'),_0x269f59['serverUrl'],_0x235fb4[_0x8d69('0x5e')],md5(_0x235fb4[_0x8d69('0x5e')]));}return getConnection(_0x269f59)[_0x8d69('0x26')](function(_0x4b7f64){_0x47d6b3=_0x4b7f64;return getUser(_0x269f59,_0xd2bf90['email'],_0x47d6b3);})[_0x8d69('0x26')](function(_0x68ea84){_0x38837c=_0x68ea84;return getEndUser(_0x269f59,_0x4230d7,_0x235fb4[_0x8d69('0x72')],_0x235fb4[_0x8d69('0x73')],_0x47d6b3);})[_0x8d69('0x26')](function(_0x50b8ff){_0x4a48d9=_0x50b8ff;return getTicket(_0x269f59,_0x38837c,_0x4a48d9,_0x4230d7,_0x235fb4,_0x4230d7[_0x8d69('0x62')],_0x47d6b3,_0x8d69('0x74'));})[_0x8d69('0x26')](function(_0x52ce45){_0x508c13=_0x52ce45;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x508c13['id']);logger[_0x8d69('0x1e')](_0x8d69('0x75'),_0x508c13['id'],_0xd2bf90[_0x8d69('0x50')],_0x269f59[_0x8d69('0x3d')]);switch(_0x269f59[_0x8d69('0x3d')]){case _0x8d69('0x65'):emit(util['format'](_0x8d69('0x68'),_0xd2bf90['name']),_0x8d69('0x66'),{'recordId':_0x508c13['id']});break;case _0x8d69('0x67'):emit(util[_0x8d69('0x44')](_0x8d69('0x68'),_0xd2bf90[_0x8d69('0x50')]),'trigger:browser:url',{'uri':util[_0x8d69('0x44')](_0x8d69('0x6a'),_0x47d6b3['instanceUrl'],_0x508c13['id'])});break;default:logger[_0x8d69('0x6b')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x8d69('0x6d')](function(_0x391e7d){logger['error'](_0x8d69('0x70'),_0x391e7d);});};exports[_0x8d69('0x76')]=function(_0x2f6073,_0x6ba98e,_0x32d9b1,_0x5d2ee9,_0x27b737,_0x2b7c2a){var _0x19d1c2,_0x30f9ad,_0x434565,_0x680f47;_0x2b7c2a[_0x8d69('0x58')]=intUtil[_0x8d69('0x6e')](_0x2b7c2a[_0x8d69('0x58')]);_0x2b7c2a[_0x8d69('0x59')]=intUtil[_0x8d69('0x6e')](_0x2b7c2a[_0x8d69('0x59')]);if(_0x27b737&&_0x27b737[_0x8d69('0x5a')]){logger[_0x8d69('0x1e')]('['+_0x6ba98e[_0x8d69('0x77')][_0x8d69('0x78')]()+']',_0x8d69('0x5c'));_0x6ba98e[_0x8d69('0x71')]=util[_0x8d69('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b7c2a[_0x8d69('0x58')],_0x6ba98e[_0x8d69('0x5e')],md5(_0x6ba98e[_0x8d69('0x5e')]));}else{_0x6ba98e['recordingURL']='';}return getConnection(_0x2b7c2a)[_0x8d69('0x26')](function(_0x3ab113){_0x680f47=_0x3ab113;if(!_[_0x8d69('0x22')](_0x5d2ee9)){return getUser(_0x2b7c2a,_0x5d2ee9[_0x8d69('0x50')],_0x680f47);}else{return getUser(_0x2b7c2a,null,_0x680f47);}})[_0x8d69('0x26')](function(_0x5e29c4){_0x19d1c2=_0x5e29c4;return getEndUser(_0x2b7c2a,_0x32d9b1,_0x6ba98e[_0x8d69('0x60')],_0x6ba98e['calleridnum'],_0x680f47);})[_0x8d69('0x26')](function(_0x5c388b){_0x30f9ad=_0x5c388b;return getTicket(_0x2b7c2a,_0x19d1c2,_0x30f9ad,_0x32d9b1,_0x6ba98e,_0x32d9b1[_0x8d69('0x62')],_0x680f47);})[_0x8d69('0x26')](function(_0xb71ce){_0x434565=_0xb71ce;logger['info']('['+_0x6ba98e['lastevent']['toUpperCase']()+_0x8d69('0x79'),_0x434565['id']);logger['info']('['+_0x6ba98e[_0x8d69('0x77')][_0x8d69('0x78')]()+_0x8d69('0x7a'),_0x2b7c2a[_0x8d69('0x3d')]);})['catch'](function(_0x4a74ff){logger[_0x8d69('0x6b')]('['+_0x6ba98e[_0x8d69('0x77')]['toUpperCase']()+']',_0x4a74ff);});}; \ 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 47f8dba..4c0e2df 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 _0xa58a=['content','toString','picklist','idField','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_limit=1','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','md5','./util','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','type','nameField','customField','toLowerCase'];(function(_0x58587a,_0x6cc3bf){var _0x4b5357=function(_0x2fcbcf){while(--_0x2fcbcf){_0x58587a['push'](_0x58587a['shift']());}};_0x4b5357(++_0x6cc3bf);}(_0xa58a,0x1d2));var _0xaa58=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xa58a[_0x1d50f2];return _0x3769b8;};'use strict';var _=require('lodash');var Promise=require(_0xaa58('0x0'));var rp=require('request-promise');var util=require('util');var md5=require(_0xaa58('0x1'));var Redis=require('ioredis');var intUtil=require(_0xaa58('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xaa58('0x3'));config[_0xaa58('0x4')]=_[_0xaa58('0x5')](config[_0xaa58('0x4')],{'host':_0xaa58('0x6'),'port':0x18eb});var io=require(_0xaa58('0x7'))(new Redis(config['redis']));function getAdminUser(_0x4839fd,_0x4c5482,_0x82e2dc,_0x2dc564,_0x344858,_0x2db71f){return new Promise(function(_0x16d4ff,_0x2288f1){var _0x3c160c={'method':'GET','uri':_0x2dc564+_0xaa58('0x8')+'&'+_0x344858+'&'+_0x2db71f,'auth':_0x4c5482,'json':!![]};return rp(_0x3c160c)[_0xaa58('0x9')](function(_0x33bf3a){if(_0x33bf3a[_0xaa58('0xa')][_0xaa58('0xb')]>0x0){_0x82e2dc[_0xaa58('0xc')]=_0x33bf3a[_0xaa58('0xa')][0x0][_0xaa58('0xd')];}logger[_0xaa58('0xe')]('['+[_0x4839fd[_0xaa58('0xf')]()]+'],\x20getAdminUser\x20crm',_0x82e2dc);_0x16d4ff(_0x82e2dc);})[_0xaa58('0x10')](function(_0x412703){logger['error']('['+[_0x4839fd[_0xaa58('0xf')]()]+']',_0x412703[_0xaa58('0x11')]);_0x2288f1(_0x412703[_0xaa58('0x11')]);});});}function getUser(_0x4df7f6,_0x1fa99e,_0xc3e64f,_0x24a30e,_0x433629){return function(_0x5d097a){logger['info']('['+[_0x4df7f6[_0xaa58('0xf')]()]+_0xaa58('0x12'),_0x5d097a);return new Promise(function(_0x10772f,_0x4d7dd2){if(intUtil[_0xaa58('0x13')](_0x5d097a[_0xaa58('0x14')])){var _0x3d8466={'method':_0xaa58('0x15'),'uri':_0xc3e64f+'sys_user?sysparm_query=email%3D'+_0x5d097a[_0xaa58('0x14')]+'&'+_0x24a30e+'&'+_0x433629,'auth':_0x1fa99e,'json':!![]};logger[_0xaa58('0xe')]('['+[_0x4df7f6[_0xaa58('0xf')]()]+'],\x20getUser\x20rp\x20obj',_0x3d8466);return rp(_0x3d8466)['then'](function(_0x3eb129){logger[_0xaa58('0xe')]('['+[_0x4df7f6[_0xaa58('0xf')]()]+_0xaa58('0x16'),_0x3eb129);if(_0x3eb129[_0xaa58('0xa')][_0xaa58('0xb')]>0x0&&String(_0x3eb129[_0xaa58('0xa')][0x0]['active'])==='true'){_0x5d097a[_0xaa58('0x17')]=_0x3eb129[_0xaa58('0xa')][0x0]['sys_id'];}else{_0x5d097a[_0xaa58('0x17')]=_0x5d097a[_0xaa58('0xc')];_0x5d097a['userEmail']=_0x5d097a[_0xaa58('0x18')];}logger['info']('['+[_0x4df7f6['toUpperCase']()]+_0xaa58('0x19'),_0x5d097a);_0x10772f(_0x5d097a);})[_0xaa58('0x10')](function(_0x5b0598){logger[_0xaa58('0x1a')]('['+[_0x4df7f6[_0xaa58('0xf')]()]+']',_0x5b0598['message']);_0x4d7dd2(_0x5b0598[_0xaa58('0x11')]);});}else{logger['info']('['+[_0x4df7f6[_0xaa58('0xf')]()]+_0xaa58('0x1b'));_0x5d097a[_0xaa58('0x17')]=_0x5d097a[_0xaa58('0xc')];_0x5d097a[_0xaa58('0x14')]=_0x5d097a[_0xaa58('0x18')];_0x10772f(_0x5d097a);}});};}function createEndUser(_0xefb55e,_0x2c4de7,_0xd0b24f,_0x3bbec4,_0x1c321d){logger[_0xaa58('0xe')]('['+[_0xefb55e[_0xaa58('0xf')]()]+_0xaa58('0x1c'),_0xd0b24f);return new Promise(function(_0x506b0c,_0xc3158d){var _0x4e3410={'method':_0xaa58('0x1d'),'uri':_0x3bbec4+_0xaa58('0x1e')+_0x1c321d,'body':{'user_name':_0xd0b24f[_0xaa58('0x1f')],'roles':'user','first_name':_0xd0b24f[_0xaa58('0x1f')],'active':_0xaa58('0x20'),'date_format':'System','phone':_0xd0b24f[_0xaa58('0x1f')]},'auth':_0x2c4de7,'json':!![]};return rp(_0x4e3410)[_0xaa58('0x9')](function(_0x1f1392){logger['info']('['+[_0xefb55e['toUpperCase']()]+_0xaa58('0x21'),_0x1f1392[_0xaa58('0xa')]);_0xd0b24f[_0xaa58('0x22')]=_0x1f1392[_0xaa58('0xa')]['sys_id'];_0x506b0c(_0xd0b24f);})[_0xaa58('0x10')](function(_0x1f9ed2){logger[_0xaa58('0x1a')]('['+[_0xefb55e[_0xaa58('0xf')]()]+']',_0x1f9ed2[_0xaa58('0x11')]);_0xc3158d(_0x1f9ed2[_0xaa58('0x11')]);});});}function getEndUser(_0x2c6ab6,_0x428b72,_0x548731,_0x103429,_0x1ede08){return function(_0x4e74c7){logger['info']('['+[_0x2c6ab6['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x4e74c7);return new Promise(function(_0x2b935e,_0x27ac10){var _0x1eb3d5={'method':_0xaa58('0x15'),'uri':_0x548731+_0xaa58('0x23')+_0x4e74c7[_0xaa58('0x1f')]+'&'+_0x103429+'&'+_0x1ede08,'auth':_0x428b72,'json':!![]};return rp(_0x1eb3d5)[_0xaa58('0x9')](function(_0x476e39){if(_0x476e39[_0xaa58('0xa')]['length']>0x0){_0x4e74c7[_0xaa58('0x22')]=_0x476e39['result'][0x0][_0xaa58('0xd')];logger[_0xaa58('0xe')]('['+[_0x2c6ab6[_0xaa58('0xf')]()]+_0xaa58('0x24'),_0x4e74c7);_0x2b935e(_0x4e74c7);}else{return createEndUser(_0x2c6ab6,_0x428b72,_0x4e74c7,_0x548731,_0x103429)[_0xaa58('0x9')](function(_0x4649d5){logger[_0xaa58('0xe')]('['+[_0x2c6ab6[_0xaa58('0xf')]()]+_0xaa58('0x25'),_0x4649d5);_0x2b935e(_0x4649d5);});}})[_0xaa58('0x10')](function(_0x2cc11c){logger[_0xaa58('0x1a')]('['+[_0x2c6ab6[_0xaa58('0xf')]()]+']',_0x2cc11c[_0xaa58('0x11')]);_0x27ac10(_0x2cc11c[_0xaa58('0x11')]);});});};}function getCustomFields(_0x1722c8,_0x5f359e){var _0x20d833={};if(_0x1722c8[_0xaa58('0xb')]>0x0){_['forEach'](_0x1722c8,function(_0x248032){if(_[_0xaa58('0x26')]([_0xaa58('0x27'),'picklist'],_0x248032[_0xaa58('0x28')])&&_0x248032[_0xaa58('0x29')]&&!_0x248032[_0xaa58('0x2a')]){_0x20d833[_0x248032[_0xaa58('0x29')][_0xaa58('0x2b')]()]=_0x248032[_0xaa58('0x2c')][_0xaa58('0x2d')]();}else if(_[_0xaa58('0x26')]([_0xaa58('0x27'),_0xaa58('0x2e')],_0x248032[_0xaa58('0x28')])&&_0x248032[_0xaa58('0x2f')]&&_0x248032['customField']){_0x20d833[_0x248032[_0xaa58('0x2f')][_0xaa58('0x2b')]()]=_0x248032[_0xaa58('0x2c')]['toString']();}else if(_0x248032[_0xaa58('0x28')]==='variable'&&_0x248032[_0xaa58('0x30')]&&_0x248032[_0xaa58('0x2f')]&&_0x248032[_0xaa58('0x2a')]){_0x20d833[_0x248032[_0xaa58('0x2f')]['toLowerCase']()]=_0x5f359e[_0x248032[_0xaa58('0x30')]][_0xaa58('0x2d')]();}else if(_0x248032[_0xaa58('0x28')]==='customVariable'&&_0x248032[_0xaa58('0x31')]&&_0x248032[_0xaa58('0x31')]['name']&&_0x248032[_0xaa58('0x2f')]&&_0x248032[_0xaa58('0x2a')]){_0x20d833[_0x248032['idField'][_0xaa58('0x2b')]()]=_0x5f359e[_0x248032[_0xaa58('0x31')]['name'][_0xaa58('0x2b')]()][_0xaa58('0x2d')]();}});}return _0x20d833;}function getTicket(_0x56ec2,_0x528d3b,_0x27c811,_0x560673,_0xac751a,_0x580119){return function(_0x3a8155){logger['info']('['+[_0x56ec2['toUpperCase']()]+_0xaa58('0x32'),_0x3a8155);return new Promise(function(_0x58f562,_0x34b5a5){var _0x4153e1=_0x56ec2[_0xaa58('0x2b')]()===_0xaa58('0x33')?_0x3a8155[_0xaa58('0x17')]:_0x3a8155[_0xaa58('0x22')];var _0x1df315={'method':_0xaa58('0x1d'),'uri':_0x27c811+_0xaa58('0x34')+'?'+_0x580119,'body':Object[_0xaa58('0x35')]({},{'active':_0xaa58('0x20'),'caller_id':_0x4153e1,'assigned_to':_0x3a8155[_0xaa58('0x17')],'short_description':intUtil[_0xaa58('0x36')](_0x560673[_0xaa58('0x37')],_0xac751a,'\x20'),'description':intUtil[_0xaa58('0x36')](_0x560673[_0xaa58('0x38')],_0xac751a,'\x0a')},getCustomFields(_0x560673[_0xaa58('0x39')],_0xac751a)),'auth':_0x528d3b,'json':!![]};return rp(_0x1df315)[_0xaa58('0x9')](function(_0x3c2d5e){logger['info']('['+[_0x56ec2[_0xaa58('0xf')]()]+_0xaa58('0x3a'),_0x3c2d5e[_0xaa58('0xa')]);_0x3a8155[_0xaa58('0x3b')]=_0x3c2d5e[_0xaa58('0xa')][_0xaa58('0xd')];_0x3a8155[_0xaa58('0x3c')]=_0x3c2d5e['result'][_0xaa58('0x3d')];logger['info']('['+[_0x56ec2[_0xaa58('0xf')]()]+']\x20getTicket\x20crm',_0x3a8155);_0x58f562(_0x3a8155);})[_0xaa58('0x10')](function(_0x25f6e3){logger[_0xaa58('0x1a')]('['+[_0x56ec2[_0xaa58('0xf')]()]+']',_0x25f6e3['message']);_0x34b5a5(_0x25f6e3[_0xaa58('0x11')]);});});};}function createRemoteTag(_0x4391d3,_0xf885a2,_0x422964,_0x1d5722){return new Promise(function(_0x4c692c,_0x2ef60d){var _0x581dbe={'method':'POST','uri':_0x422964+_0xaa58('0x3e')+'?'+_0x1d5722,'body':{'short_description':_0x4391d3,'global':!![],'active':!![],'name':_0x4391d3},'auth':_0xf885a2,'json':!![]};return rp(_0x581dbe)[_0xaa58('0x9')](function(_0x1f475b){var _0x410c2b=_0x1f475b[_0xaa58('0xa')][_0xaa58('0xd')];_0x4c692c(_0x410c2b);});});}function getRemoteTag(_0x5d6203,_0x21253d,_0x92188c,_0x2e8863,_0xb02835){return new Promise(function(_0x30f6d4,_0x51c73e){var _0x3390fc={'method':'GET','uri':_0x92188c+_0xaa58('0x3e')+_0xaa58('0x3f')+_0x5d6203+'&'+_0x2e8863,'auth':_0x21253d,'json':!![]};return rp(_0x3390fc)[_0xaa58('0x9')](function(_0x12e286){if(_0x12e286['result'][_0xaa58('0xb')]>0x0){var _0xcde87f=_0x12e286['result'][0x0][_0xaa58('0xd')];_0x30f6d4(_0xcde87f);}else{return createRemoteTag(_0x5d6203,_0x21253d,_0x92188c,_0x2e8863)[_0xaa58('0x9')](function(_0x32bf13){_0x30f6d4(_0x32bf13);});}});});}function assignTagToIncident(_0xa56dbc,_0x171ded,_0x4af54a,_0x220d70,_0x23be02){return new Promise(function(_0x38d2cc,_0x1d22b1){var _0x4ba939={'method':_0xaa58('0x1d'),'uri':_0x4af54a+_0xaa58('0x40')+'?'+_0x23be02,'body':{'label':_0xa56dbc,'table':_0xaa58('0x34'),'id_type':_0xaa58('0x41'),'table_key':_0x220d70[_0xaa58('0x3b')],'title':_0xaa58('0x42')+_0x220d70[_0xaa58('0x3c')],'id_display':_0x220d70['ticketNumber']},'auth':_0x171ded,'json':!![]};return rp(_0x4ba939)['then'](function(_0x3df1a5){_0x38d2cc();})[_0xaa58('0x10')](function(){_0x38d2cc();});});}function manageTags(_0x901594,_0x582ba1,_0xa5769,_0x377321,_0x17c731,_0x39df05,_0x37dd4b){return new Promise(function(_0x156c18,_0x267fbf){var _0xeb141f=[];_0x582ba1['forEach'](function(_0x3261d6){_0xeb141f[_0xaa58('0x43')](getRemoteTag(_0x3261d6,_0xa5769,_0x377321,_0x39df05,_0x37dd4b));});return Promise[_0xaa58('0x44')](_0xeb141f)['then'](function(_0x10a116){if(_0x10a116[_0xaa58('0xb')]){logger[_0xaa58('0xe')]('['+[_0x901594[_0xaa58('0xf')]()]+_0xaa58('0x45'),_0x10a116);var _0x414030=[];_0x10a116[_0xaa58('0x46')](function(_0x45ef54){_0x414030[_0xaa58('0x43')](assignTagToIncident(_0x45ef54,_0xa5769,_0x377321,_0x17c731,_0x39df05));});return Promise[_0xaa58('0x44')](_0x414030)[_0xaa58('0x9')](function(){_0x156c18();})['catch'](function(){_0x156c18();});}else{_0x156c18();}});});}function getTags(_0x17b326,_0x4679bb,_0xfe585b,_0x53f737,_0x33f14e,_0x1843df){return function(_0x42e602){return new Promise(function(_0x1f7627,_0x4d4473){var _0x438943=[];var _0x3a3ff5=_0x53f737[_0xaa58('0x47')];if(_0x3a3ff5&&_0x3a3ff5[_0xaa58('0xb')]>0x0){_0x438943=_[_0xaa58('0x48')](_0x3a3ff5,_0xaa58('0x49'));}if(_0x438943[_0xaa58('0xb')]>0x0){return manageTags(_0x17b326,_0x438943,_0x4679bb,_0xfe585b,_0x42e602,_0x33f14e,_0x1843df)[_0xaa58('0x9')](function(){_0x1f7627(_0x42e602);});}else{_0x1f7627(_0x42e602);}});};}function emit(_0x3c7e54,_0x1d48ad,_0x2d7c5a){var _0x53042d=_0xaa58('0x4a')+_0xaa58('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xaa58('0x4c');var _0xac385f={'uri':_0x3c7e54+_0xaa58('0x4d')+_0x2d7c5a+_0x53042d};io['to'](util[_0xaa58('0x4e')]('user:%s',_0x1d48ad))[_0xaa58('0x4f')]('trigger:browser:url',_0xac385f);}exports['cs']=function(_0xd70776,_0x2b4170,_0x1450c6,_0x132acb,_0xb3a005,_0x4ecb5d,_0x5b87c5,_0x7f0937){var _0x52d8e3={};var _0x123969={'user':_0x4ecb5d[_0xaa58('0x50')],'pass':_0x4ecb5d[_0xaa58('0x51')]};var _0xf9f20b=_0xaa58('0x52');var _0x1134bd='sysparm_display_value=true';_0x4ecb5d['remoteUri']=intUtil[_0xaa58('0x53')](_0x4ecb5d[_0xaa58('0x54')]);_0x4ecb5d[_0xaa58('0x55')]=intUtil[_0xaa58('0x53')](_0x4ecb5d['serverUrl']);var _0x3ad679=util[_0xaa58('0x4e')](_0xaa58('0x56'),_0x4ecb5d[_0xaa58('0x54')]);_0x52d8e3[_0xaa58('0x14')]=!_[_0xaa58('0x57')](_0x132acb)?_0x132acb[_0xaa58('0x58')]:null;_0x52d8e3['adminEmail']=_0x4ecb5d[_0xaa58('0x58')];_0x52d8e3[_0xaa58('0x1f')]=_0x7f0937['toLowerCase']()==='outbound'?_0x2b4170['destcalleridnum']:_0x2b4170['calleridnum'];_0x52d8e3['callDirection']=_0x7f0937===_0xaa58('0x59')||_0x7f0937==='unmanaged'?_0xaa58('0x59'):'outbound';var _0x9e5361=util[_0xaa58('0x4e')](_0xaa58('0x5a'),_0x4ecb5d[_0xaa58('0x55')],_0x2b4170[_0xaa58('0x5b')],md5(_0x2b4170['uniqueid']));if(_0xb3a005&&_0xb3a005[_0xaa58('0x5c')]){logger[_0xaa58('0xe')](_0xaa58('0x5d'),_0xaa58('0x5e'));_0x2b4170[_0xaa58('0x5f')]=_0x9e5361;}else if(_0x5b87c5&&_0x5b87c5[_0xaa58('0x60')]&&_0x5b87c5[_0xaa58('0x60')]!=='none'){logger[_0xaa58('0xe')](_0xaa58('0x61'),_0xaa58('0x5e'));_0x2b4170[_0xaa58('0x5f')]=_0x9e5361;}else{_0x2b4170[_0xaa58('0x5f')]='';}return getAdminUser(_0x7f0937,_0x123969,_0x52d8e3,_0x3ad679,_0x1134bd,_0xf9f20b)[_0xaa58('0x9')](getUser(_0x7f0937,_0x123969,_0x3ad679,_0x1134bd,_0xf9f20b))['then'](getEndUser(_0x7f0937,_0x123969,_0x3ad679,_0x1134bd,_0xf9f20b))[_0xaa58('0x9')](getTicket(_0x7f0937,_0x123969,_0x3ad679,_0x1450c6,_0x2b4170,_0x1134bd))[_0xaa58('0x9')](function(_0x19f1e8){logger[_0xaa58('0xe')](util[_0xaa58('0x4e')](_0xaa58('0x62'),_0x19f1e8[_0xaa58('0x3b')]));logger['info'](util[_0xaa58('0x4e')](_0xaa58('0x63'),_0x7f0937));if(_0x7f0937!=='unmanaged'){logger['info']('['+[_0x7f0937['toUpperCase']()]+']',_0xaa58('0x64'));emit(_0x4ecb5d[_0xaa58('0x54')],_0x132acb[_0xaa58('0x49')],_0x19f1e8[_0xaa58('0x3b')]);}})['catch'](function(_0x2c0d0b){logger[_0xaa58('0x1a')]('['+[_0x7f0937[_0xaa58('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xaa58('0x65')](_0x2c0d0b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x51ff=['bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','System','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string','picklist','nameField','customField','content','toString','type','idField','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields','number','GET','Incident\x20-\x20','ticketNumber','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','sysparm_limit=1','stripTrailingSlash','serverUrl','remoteUri','isNil','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x51ff,0x65));var _0xf51f=function(_0x57809d,_0x4736db){_0x57809d=_0x57809d-0x0;var _0x5c4d48=_0x51ff[_0x57809d];return _0x5c4d48;};'use strict';var _=require('lodash');var Promise=require(_0xf51f('0x0'));var rp=require('request-promise');var util=require(_0xf51f('0x1'));var md5=require('md5');var Redis=require(_0xf51f('0x2'));var intUtil=require(_0xf51f('0x3'));var config=require(_0xf51f('0x4'));var logger=require(_0xf51f('0x5'))(_0xf51f('0x6'));config[_0xf51f('0x7')]=_[_0xf51f('0x8')](config[_0xf51f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf51f('0x9'))(new Redis(config[_0xf51f('0x7')]));function getAdminUser(_0xdcf751,_0x3b3e03,_0x3d9f1f,_0x195354,_0x184d0a,_0x20d91d){return new Promise(function(_0x42b514,_0x367f12){var _0x26c4c4={'method':'GET','uri':_0x195354+_0xf51f('0xa')+'&'+_0x184d0a+'&'+_0x20d91d,'auth':_0x3b3e03,'json':!![]};return rp(_0x26c4c4)[_0xf51f('0xb')](function(_0x1bc3eb){if(_0x1bc3eb[_0xf51f('0xc')][_0xf51f('0xd')]>0x0){_0x3d9f1f['adminId']=_0x1bc3eb[_0xf51f('0xc')][0x0]['sys_id'];}logger[_0xf51f('0xe')]('['+[_0xdcf751['toUpperCase']()]+_0xf51f('0xf'),_0x3d9f1f);_0x42b514(_0x3d9f1f);})[_0xf51f('0x10')](function(_0x4fe801){logger[_0xf51f('0x11')]('['+[_0xdcf751['toUpperCase']()]+']',_0x4fe801[_0xf51f('0x12')]);_0x367f12(_0x4fe801[_0xf51f('0x12')]);});});}function getUser(_0x559eef,_0x426f05,_0xd28c27,_0x1440a6,_0xa39a32){return function(_0x413d60){logger['info']('['+[_0x559eef[_0xf51f('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x413d60);return new Promise(function(_0x48c00a,_0x5f0142){if(intUtil[_0xf51f('0x14')](_0x413d60[_0xf51f('0x15')])){var _0x56f8d4={'method':'GET','uri':_0xd28c27+'sys_user?sysparm_query=email%3D'+_0x413d60[_0xf51f('0x15')]+'&'+_0x1440a6+'&'+_0xa39a32,'auth':_0x426f05,'json':!![]};logger[_0xf51f('0xe')]('['+[_0x559eef[_0xf51f('0x13')]()]+_0xf51f('0x16'),_0x56f8d4);return rp(_0x56f8d4)[_0xf51f('0xb')](function(_0x21d85a){logger[_0xf51f('0xe')]('['+[_0x559eef[_0xf51f('0x13')]()]+_0xf51f('0x17'),_0x21d85a);if(_0x21d85a[_0xf51f('0xc')][_0xf51f('0xd')]>0x0&&String(_0x21d85a[_0xf51f('0xc')][0x0][_0xf51f('0x18')])===_0xf51f('0x19')){_0x413d60[_0xf51f('0x1a')]=_0x21d85a[_0xf51f('0xc')][0x0]['sys_id'];}else{_0x413d60[_0xf51f('0x1a')]=_0x413d60[_0xf51f('0x1b')];_0x413d60['userEmail']=_0x413d60[_0xf51f('0x1c')];}logger['info']('['+[_0x559eef[_0xf51f('0x13')]()]+_0xf51f('0x1d'),_0x413d60);_0x48c00a(_0x413d60);})[_0xf51f('0x10')](function(_0x250564){logger[_0xf51f('0x11')]('['+[_0x559eef[_0xf51f('0x13')]()]+']',_0x250564[_0xf51f('0x12')]);_0x5f0142(_0x250564['message']);});}else{logger[_0xf51f('0xe')]('['+[_0x559eef[_0xf51f('0x13')]()]+_0xf51f('0x1e'));_0x413d60['userId']=_0x413d60[_0xf51f('0x1b')];_0x413d60[_0xf51f('0x15')]=_0x413d60['adminEmail'];_0x48c00a(_0x413d60);}});};}function createEndUser(_0x38c662,_0x246933,_0x5870af,_0x240919,_0x1a193a){logger['info']('['+[_0x38c662[_0xf51f('0x13')]()]+_0xf51f('0x1f'),_0x5870af);return new Promise(function(_0x2219f5,_0x539478){var _0x1e73b1={'method':_0xf51f('0x20'),'uri':_0x240919+'sys_user?'+_0x1a193a,'body':{'user_name':_0x5870af['endUserNumber'],'roles':_0xf51f('0x21'),'first_name':_0x5870af[_0xf51f('0x22')],'active':'true','date_format':_0xf51f('0x23'),'phone':_0x5870af[_0xf51f('0x22')]},'auth':_0x246933,'json':!![]};return rp(_0x1e73b1)[_0xf51f('0xb')](function(_0x5ef111){logger[_0xf51f('0xe')]('['+[_0x38c662['toUpperCase']()]+'],\x20EndUser\x20schema',_0x5ef111[_0xf51f('0xc')]);_0x5870af[_0xf51f('0x24')]=_0x5ef111[_0xf51f('0xc')][_0xf51f('0x25')];_0x2219f5(_0x5870af);})[_0xf51f('0x10')](function(_0x33dc96){logger[_0xf51f('0x11')]('['+[_0x38c662[_0xf51f('0x13')]()]+']',_0x33dc96[_0xf51f('0x12')]);_0x539478(_0x33dc96[_0xf51f('0x12')]);});});}function getEndUser(_0x59e356,_0x4afe02,_0x4468dd,_0x597b93,_0x33f8a7){return function(_0x42b0e4){logger[_0xf51f('0xe')]('['+[_0x59e356[_0xf51f('0x13')]()]+_0xf51f('0x26'),_0x42b0e4);return new Promise(function(_0x5cd073,_0x4e6201){var _0x4c416a={'method':'GET','uri':_0x4468dd+_0xf51f('0x27')+_0x42b0e4['endUserNumber']+'&'+_0x597b93+'&'+_0x33f8a7,'auth':_0x4afe02,'json':!![]};return rp(_0x4c416a)[_0xf51f('0xb')](function(_0x41f15a){if(_0x41f15a[_0xf51f('0xc')][_0xf51f('0xd')]>0x0){_0x42b0e4[_0xf51f('0x24')]=_0x41f15a[_0xf51f('0xc')][0x0][_0xf51f('0x25')];logger[_0xf51f('0xe')]('['+[_0x59e356[_0xf51f('0x13')]()]+'],\x20getEndUser\x20crm',_0x42b0e4);_0x5cd073(_0x42b0e4);}else{return createEndUser(_0x59e356,_0x4afe02,_0x42b0e4,_0x4468dd,_0x597b93)[_0xf51f('0xb')](function(_0x5e0916){logger[_0xf51f('0xe')]('['+[_0x59e356['toUpperCase']()]+_0xf51f('0x28'),_0x5e0916);_0x5cd073(_0x5e0916);});}})[_0xf51f('0x10')](function(_0x407627){logger[_0xf51f('0x11')]('['+[_0x59e356['toUpperCase']()]+']',_0x407627[_0xf51f('0x12')]);_0x4e6201(_0x407627['message']);});});};}function getCustomFields(_0x51408a,_0x4bb07f){var _0x52412d={};if(_0x51408a[_0xf51f('0xd')]>0x0){_['forEach'](_0x51408a,function(_0x517d7e){if(_[_0xf51f('0x29')]([_0xf51f('0x2a'),_0xf51f('0x2b')],_0x517d7e['type'])&&_0x517d7e[_0xf51f('0x2c')]&&!_0x517d7e[_0xf51f('0x2d')]){_0x52412d[_0x517d7e['nameField']['toLowerCase']()]=_0x517d7e[_0xf51f('0x2e')][_0xf51f('0x2f')]();}else if(_['includes'](['string',_0xf51f('0x2b')],_0x517d7e[_0xf51f('0x30')])&&_0x517d7e[_0xf51f('0x31')]&&_0x517d7e[_0xf51f('0x2d')]){_0x52412d[_0x517d7e[_0xf51f('0x31')][_0xf51f('0x32')]()]=_0x517d7e[_0xf51f('0x2e')][_0xf51f('0x2f')]();}else if(_0x517d7e[_0xf51f('0x30')]===_0xf51f('0x33')&&_0x517d7e['variableName']&&_0x517d7e[_0xf51f('0x31')]&&_0x517d7e[_0xf51f('0x2d')]){_0x52412d[_0x517d7e['idField'][_0xf51f('0x32')]()]=_0x4bb07f[_0x517d7e[_0xf51f('0x34')]]['toString']();}else if(_0x517d7e[_0xf51f('0x30')]==='customVariable'&&_0x517d7e[_0xf51f('0x35')]&&_0x517d7e[_0xf51f('0x35')]['name']&&_0x517d7e[_0xf51f('0x31')]&&_0x517d7e['customField']){_0x52412d[_0x517d7e[_0xf51f('0x31')]['toLowerCase']()]=_0x4bb07f[_0x517d7e[_0xf51f('0x35')][_0xf51f('0x36')][_0xf51f('0x32')]()][_0xf51f('0x2f')]();}});}return _0x52412d;}function getTicket(_0x2175bb,_0x2012cf,_0x1218a9,_0x2cf41b,_0x403438,_0x57af29){return function(_0x5847e4){logger['info']('['+[_0x2175bb[_0xf51f('0x13')]()]+_0xf51f('0x37'),_0x5847e4);return new Promise(function(_0x3041c0,_0x4d3e16){var _0x3a75d7=_0x2175bb[_0xf51f('0x32')]()==='outbound'?_0x5847e4[_0xf51f('0x1a')]:_0x5847e4[_0xf51f('0x24')];var _0x119e10={'method':'POST','uri':_0x1218a9+_0xf51f('0x38')+'?'+_0x57af29,'body':Object[_0xf51f('0x39')]({},{'active':'true','caller_id':_0x3a75d7,'assigned_to':_0x5847e4[_0xf51f('0x1a')],'short_description':intUtil[_0xf51f('0x3a')](_0x2cf41b['Subjects'],_0x403438,'\x20'),'description':intUtil[_0xf51f('0x3a')](_0x2cf41b[_0xf51f('0x3b')],_0x403438,'\x0a')},getCustomFields(_0x2cf41b[_0xf51f('0x3c')],_0x403438)),'auth':_0x2012cf,'json':!![]};return rp(_0x119e10)[_0xf51f('0xb')](function(_0x426176){logger[_0xf51f('0xe')]('['+[_0x2175bb['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x426176['result']);_0x5847e4['ticketId']=_0x426176[_0xf51f('0xc')][_0xf51f('0x25')];_0x5847e4['ticketNumber']=_0x426176[_0xf51f('0xc')][_0xf51f('0x3d')];logger[_0xf51f('0xe')]('['+[_0x2175bb['toUpperCase']()]+']\x20getTicket\x20crm',_0x5847e4);_0x3041c0(_0x5847e4);})[_0xf51f('0x10')](function(_0x1fa05a){logger[_0xf51f('0x11')]('['+[_0x2175bb[_0xf51f('0x13')]()]+']',_0x1fa05a[_0xf51f('0x12')]);_0x4d3e16(_0x1fa05a['message']);});});};}function createRemoteTag(_0x48e2d6,_0x4ed795,_0x32ecfd,_0x5031a5){return new Promise(function(_0x42ceb8,_0x1180c6){var _0x536374={'method':_0xf51f('0x20'),'uri':_0x32ecfd+'label'+'?'+_0x5031a5,'body':{'short_description':_0x48e2d6,'global':!![],'active':!![],'name':_0x48e2d6},'auth':_0x4ed795,'json':!![]};return rp(_0x536374)['then'](function(_0x49e5a2){var _0x3b6e58=_0x49e5a2['result']['sys_id'];_0x42ceb8(_0x3b6e58);});});}function getRemoteTag(_0x2771ea,_0x6a7d98,_0x4a1d33,_0xf255ff,_0xb1700e){return new Promise(function(_0x36fd2a,_0x1a24c2){var _0x4a9fa0={'method':_0xf51f('0x3e'),'uri':_0x4a1d33+'label'+'?sysparm_query=name%3D'+_0x2771ea+'&'+_0xf255ff,'auth':_0x6a7d98,'json':!![]};return rp(_0x4a9fa0)[_0xf51f('0xb')](function(_0x319cc9){if(_0x319cc9['result']['length']>0x0){var _0x460906=_0x319cc9['result'][0x0][_0xf51f('0x25')];_0x36fd2a(_0x460906);}else{return createRemoteTag(_0x2771ea,_0x6a7d98,_0x4a1d33,_0xf255ff)['then'](function(_0x54050b){_0x36fd2a(_0x54050b);});}});});}function assignTagToIncident(_0x2e7041,_0x4a2975,_0x366692,_0x3c6c5f,_0x44c064){return new Promise(function(_0x3dd123,_0x13d0fd){var _0x527298={'method':'POST','uri':_0x366692+'label_entry'+'?'+_0x44c064,'body':{'label':_0x2e7041,'table':_0xf51f('0x38'),'id_type':'Incident','table_key':_0x3c6c5f['ticketId'],'title':_0xf51f('0x3f')+_0x3c6c5f['ticketNumber'],'id_display':_0x3c6c5f[_0xf51f('0x40')]},'auth':_0x4a2975,'json':!![]};return rp(_0x527298)['then'](function(_0x2dcaee){_0x3dd123();})[_0xf51f('0x10')](function(){_0x3dd123();});});}function manageTags(_0x10c7ba,_0x3ba6fc,_0x3d951b,_0x3ca1ba,_0x2c1c28,_0x4d32f9,_0x3f9182){return new Promise(function(_0x591ae9,_0x3eaebe){var _0x55cb50=[];_0x3ba6fc[_0xf51f('0x41')](function(_0x52b555){_0x55cb50['push'](getRemoteTag(_0x52b555,_0x3d951b,_0x3ca1ba,_0x4d32f9,_0x3f9182));});return Promise['all'](_0x55cb50)['then'](function(_0x5152bb){if(_0x5152bb[_0xf51f('0xd')]){logger['info']('['+[_0x10c7ba[_0xf51f('0x13')]()]+_0xf51f('0x42'),_0x5152bb);var _0x3118b7=[];_0x5152bb['forEach'](function(_0x4ca308){_0x3118b7[_0xf51f('0x43')](assignTagToIncident(_0x4ca308,_0x3d951b,_0x3ca1ba,_0x2c1c28,_0x4d32f9));});return Promise[_0xf51f('0x44')](_0x3118b7)[_0xf51f('0xb')](function(){_0x591ae9();})['catch'](function(){_0x591ae9();});}else{_0x591ae9();}});});}function getTags(_0x2d16e6,_0xd2546e,_0x4b56b5,_0x57ee65,_0xfa839f,_0x5f4728){return function(_0x229038){return new Promise(function(_0x2b5da4,_0x2a05b7){var _0x569af9=[];var _0x506244=_0x57ee65[_0xf51f('0x45')];if(_0x506244&&_0x506244['length']>0x0){_0x569af9=_[_0xf51f('0x46')](_0x506244,'name');}if(_0x569af9[_0xf51f('0xd')]>0x0){return manageTags(_0x2d16e6,_0x569af9,_0xd2546e,_0x4b56b5,_0x229038,_0xfa839f,_0x5f4728)[_0xf51f('0xb')](function(){_0x2b5da4(_0x229038);});}else{_0x2b5da4(_0x229038);}});};}function emit(_0x3f5b0f,_0x3b7a89,_0x158edc){var _0x10429b=_0xf51f('0x47')+_0xf51f('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x22a7bb={'uri':_0x3f5b0f+_0xf51f('0x49')+_0x158edc+_0x10429b};io['to'](util[_0xf51f('0x4a')](_0xf51f('0x4b'),_0x3b7a89))['emit'](_0xf51f('0x4c'),_0x22a7bb);}exports['cs']=function(_0x182ba9,_0x2fb484,_0x24d431,_0x4c85e9,_0x3b843e,_0x4e686d,_0x171766,_0x3d1870){var _0x17e375={};var _0x4627f9={'user':_0x4e686d['username'],'pass':_0x4e686d['password']};var _0x171d2c=_0xf51f('0x4d');var _0x3fb7a4='sysparm_display_value=true';_0x4e686d['remoteUri']=intUtil[_0xf51f('0x4e')](_0x4e686d['remoteUri']);_0x4e686d[_0xf51f('0x4f')]=intUtil[_0xf51f('0x4e')](_0x4e686d[_0xf51f('0x4f')]);var _0x27a049=util[_0xf51f('0x4a')]('%s/api/now/table/',_0x4e686d[_0xf51f('0x50')]);_0x17e375['userEmail']=!_[_0xf51f('0x51')](_0x4c85e9)?_0x4c85e9['email']:null;_0x17e375[_0xf51f('0x1c')]=_0x4e686d['email'];_0x17e375[_0xf51f('0x22')]=_0x3d1870[_0xf51f('0x32')]()===_0xf51f('0x52')?_0x2fb484[_0xf51f('0x53')]:_0x2fb484[_0xf51f('0x54')];_0x17e375[_0xf51f('0x55')]=_0x3d1870===_0xf51f('0x56')||_0x3d1870===_0xf51f('0x57')?'queue':'outbound';var _0xe8cb2a=util['format'](_0xf51f('0x58'),_0x4e686d[_0xf51f('0x4f')],_0x2fb484[_0xf51f('0x59')],md5(_0x2fb484[_0xf51f('0x59')]));if(_0x3b843e&&_0x3b843e['monitor_format']){logger['info'](_0xf51f('0x5a'),_0xf51f('0x5b'));_0x2fb484[_0xf51f('0x5c')]=_0xe8cb2a;}else if(_0x171766&&_0x171766[_0xf51f('0x5d')]&&_0x171766['recordingFormat']!==_0xf51f('0x5e')){logger[_0xf51f('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2fb484[_0xf51f('0x5c')]=_0xe8cb2a;}else{_0x2fb484['recordingURL']='';}return getAdminUser(_0x3d1870,_0x4627f9,_0x17e375,_0x27a049,_0x3fb7a4,_0x171d2c)[_0xf51f('0xb')](getUser(_0x3d1870,_0x4627f9,_0x27a049,_0x3fb7a4,_0x171d2c))[_0xf51f('0xb')](getEndUser(_0x3d1870,_0x4627f9,_0x27a049,_0x3fb7a4,_0x171d2c))['then'](getTicket(_0x3d1870,_0x4627f9,_0x27a049,_0x24d431,_0x2fb484,_0x3fb7a4))[_0xf51f('0xb')](function(_0x42f24b){logger[_0xf51f('0xe')](util[_0xf51f('0x4a')](_0xf51f('0x5f'),_0x42f24b[_0xf51f('0x60')]));logger['info'](util[_0xf51f('0x4a')](_0xf51f('0x61'),_0x3d1870));if(_0x3d1870!==_0xf51f('0x57')){logger[_0xf51f('0xe')]('['+[_0x3d1870[_0xf51f('0x13')]()]+']',_0xf51f('0x62'));emit(_0x4e686d[_0xf51f('0x50')],_0x4c85e9[_0xf51f('0x36')],_0x42f24b[_0xf51f('0x60')]);}})[_0xf51f('0x10')](function(_0x17cc66){logger[_0xf51f('0x11')]('['+[_0x3d1870[_0xf51f('0x13')]()]+_0xf51f('0x63'),util[_0xf51f('0x64')](_0x17cc66,{'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 c57cf29..3ebb11c 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 _0x3650=['parent_type','parent_name','direction','forEach','variableName','idField','JSON','Calls','format','Basic\x20%s','apiKey','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','name_value_list','user_name','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','first_name','','Enduser\x20created.','phone_home','debug','[HTTP]','map','string','nameField','customField','toLowerCase','toString','type','custom_fields','push','content','variable','customVariable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','users','contacts','charAt','catch','unmanaged','toUpperCase','calleridnum','Inbound','lastevent','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x3650,0xde));var _0x0365=function(_0x35eeee,_0x35794d){_0x35eeee=_0x35eeee-0x0;var _0x5ca4fd=_0x3650[_0x35eeee];return _0x5ca4fd;};'use strict';var _=require(_0x0365('0x0'));var rp=require(_0x0365('0x1'));var BPromise=require('bluebird');var md5=require(_0x0365('0x2'));var util=require('util');var Redis=require(_0x0365('0x3'));var intUtil=require(_0x0365('0x4'));var config=require(_0x0365('0x5'));var logger=require(_0x0365('0x6'))('sugarcrm');config[_0x0365('0x7')]=_['defaults'](config['redis'],{'host':_0x0365('0x8'),'port':0x18eb});var io=require(_0x0365('0x9'))(new Redis(config['redis']));var def={'method':_0x0365('0xa'),'json':!![]};function emit(_0xfa6772,_0x3a6d60,_0x14686b){io['to'](_0xfa6772)[_0x0365('0xb')](_0x3a6d60,_0x14686b);}function getTicket(_0x52c9a0,_0x3548d0,_0x38a33f,_0x43025b,_0x29bfe2,_0x395f7a,_0x5695b2,_0x42190d){logger['info'](_0x0365('0xc'));var _0x18c4b9=new Date();var _0x24540f=[{'name':_0x0365('0xd'),'value':intUtil['getString'](_0x43025b['Subjects'],_0x29bfe2,'\x20')},{'name':_0x0365('0xe'),'value':_0x3548d0['id']},{'name':_0x0365('0xf'),'value':_0x3548d0['id']},{'name':_0x0365('0x10'),'value':intUtil[_0x0365('0x11')](_0x43025b[_0x0365('0x12')],_0x29bfe2,'\x0a')},{'name':_0x0365('0x13'),'value':_0x18c4b9[_0x0365('0x14')]()[_0x0365('0x15')](0x0,0x13)[_0x0365('0x16')]('T','\x20')},{'name':_0x0365('0x17'),'value':'0'},{'name':_0x0365('0x18'),'value':'15'},{'name':_0x0365('0x19'),'value':_0x38a33f['id']},{'name':_0x0365('0x1a'),'value':'Contacts'},{'name':_0x0365('0x1b'),'value':_0x38a33f[_0x0365('0xd')]},{'name':_0x0365('0x1c'),'value':_0x42190d}];if(_0x395f7a['length']){_[_0x0365('0x1d')](_0x395f7a,function(_0x3a2b48){if(_0x29bfe2[_0x3a2b48[_0x0365('0x1e')]]){_0x24540f['push']({'name':_0x3a2b48[_0x0365('0x1f')],'value':_0x29bfe2[_0x3a2b48[_0x0365('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x0365('0x20'),'rest_data':JSON['stringify']({'session':_0x5695b2['id'],'module_name':_0x0365('0x21'),'name_value_list':_0x24540f})}});}function getAuth(_0x1f2302){return util[_0x0365('0x22')](_0x0365('0x23'),new Buffer(_0x1f2302[_0x0365('0x24')]+':X')['toString']('base64'));}function getServerInfo(_0x49414d){return request({'form':{'method':_0x0365('0x25'),'input_type':_0x0365('0x20'),'response_type':'JSON','rest_data':JSON[_0x0365('0x26')]({'session':_0x49414d['id']})}});}function getUser(_0x4d0c7d,_0x47c04c,_0x3d6bc7){if(!_[_0x0365('0x27')](_0x47c04c)){logger['info'](_0x0365('0x28'),_0x47c04c);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0365('0x26')]({'session':_0x3d6bc7['id'],'module_name':_0x0365('0x29'),'query':util['format'](_0x0365('0x2a'),_0x47c04c),'order_by':'','offset':'0','select_fields':['id',_0x0365('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0365('0x2b')](function(_0x26c525){if(_0x26c525[_0x0365('0x2c')][_0x0365('0x2d')]){var _0x2de5e1=_['find'](_0x26c525['entry_list'],function(_0x2d33e8){return _0x2d33e8[_0x0365('0x2e')][_0x0365('0x2f')][_0x0365('0x30')]===_0x47c04c;});if(_0x2de5e1){logger[_0x0365('0x31')](_0x0365('0x32'));return BPromise[_0x0365('0x33')]({'id':_0x2de5e1['name_value_list']['id'][_0x0365('0x30')],'name':_0x2de5e1[_0x0365('0x2e')][_0x0365('0xd')][_0x0365('0x30')]});}}logger[_0x0365('0x31')](_0x0365('0x34'));return BPromise[_0x0365('0x33')]({'id':_0x3d6bc7['name_value_list'][_0x0365('0x35')][_0x0365('0x30')],'name':_0x3d6bc7[_0x0365('0x2e')][_0x0365('0x2f')][_0x0365('0x30')]});});}else{logger[_0x0365('0x31')](_0x0365('0x36'));return BPromise[_0x0365('0x33')]({'id':_0x3d6bc7[_0x0365('0x2e')][_0x0365('0x35')]['value'],'name':_0x3d6bc7['name_value_list'][_0x0365('0x2f')][_0x0365('0x30')]});}}function getEndUser(_0x4fe1ad,_0x31202e,_0x8b2830,_0x4915a6){logger[_0x0365('0x31')](_0x0365('0x37'),_0x8b2830);return request({'form':{'method':'get_entry_list','input_type':_0x0365('0x20'),'response_type':_0x0365('0x20'),'rest_data':JSON[_0x0365('0x26')]({'session':_0x4915a6['id'],'module_name':_0x0365('0x38'),'query':util[_0x0365('0x22')](_0x0365('0x39'),_0x8b2830),'order_by':'','offset':'0','select_fields':['id',_0x0365('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0365('0x2b')](function(_0x1c7c51){if(_0x1c7c51['entry_list'][_0x0365('0x2d')]){var _0x9829c4=_[_0x0365('0x3a')](_0x1c7c51[_0x0365('0x2c')],function(_0xe399fa){return _0xe399fa[_0x0365('0x2e')]['phone_home'][_0x0365('0x30')]===_0x8b2830;});if(_0x9829c4){logger[_0x0365('0x31')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x9829c4[_0x0365('0x2e')]['id'][_0x0365('0x30')],'name':_0x9829c4[_0x0365('0x2e')][_0x0365('0xd')][_0x0365('0x30')],'phone':_0x9829c4[_0x0365('0x2e')]['phone_home'][_0x0365('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x0365('0x20'),'rest_data':JSON['stringify']({'session':_0x4915a6['id'],'module_name':_0x0365('0x38'),'name_value_list':[{'name':_0x0365('0x3b'),'value':_0x31202e!==_0x0365('0x3c')?_0x31202e:util[_0x0365('0x22')]('Caller\x20-\x20%s',_0x8b2830)},{'name':'phone_home','value':_0x8b2830}]})}})[_0x0365('0x2b')](function(_0x5702a5){logger[_0x0365('0x31')](_0x0365('0x3d'));return BPromise[_0x0365('0x33')]({'id':_0x5702a5['id'],'name':_0x5702a5['entry_list'][_0x0365('0x3b')][_0x0365('0x30')],'phone':_0x5702a5[_0x0365('0x2c')][_0x0365('0x3e')]['value']});});}});}function request(_0x1d00cd){logger[_0x0365('0x3f')](_0x0365('0x40'),JSON['stringify'](_0x1d00cd));return rp(_['merge'](def,_0x1d00cd));}function getTags(_0x36e23d,_0x10a390){var _0x382ecd=[];if(_0x36e23d&&_0x36e23d['length']>0x0){_0x382ecd=_[_0x0365('0x41')](_0x36e23d,_0x10a390);}return _0x382ecd;}function getCustomFields(_0x328039,_0x61c8e9){var _0x1bcc8d=[];var _0x5f28ee={'custom_fields':[]};if(_0x328039[_0x0365('0x2d')]>0x0){_[_0x0365('0x1d')](_0x328039,function(_0x3eca0f){if(_0x3eca0f['type']===_0x0365('0x42')&&_0x3eca0f[_0x0365('0x43')]&&!_0x3eca0f[_0x0365('0x44')]){_0x5f28ee[_0x3eca0f[_0x0365('0x43')][_0x0365('0x45')]()]=_0x3eca0f['content'][_0x0365('0x46')]();}else if(_0x3eca0f[_0x0365('0x47')]===_0x0365('0x42')&&_0x3eca0f['idField']&&_0x3eca0f[_0x0365('0x44')]){_0x5f28ee[_0x0365('0x48')][_0x0365('0x49')]({'id':_0x3eca0f[_0x0365('0x1f')],'value':_0x3eca0f[_0x0365('0x4a')][_0x0365('0x46')]()});}else if(_0x3eca0f['type']===_0x0365('0x4b')&&_0x3eca0f['variableName']&&_0x3eca0f['idField']&&_0x3eca0f[_0x0365('0x44')]){_0x61c8e9[_0x3eca0f['variableName']]&&_0x5f28ee[_0x0365('0x48')][_0x0365('0x49')]({'id':_0x3eca0f[_0x0365('0x1f')],'value':_0x61c8e9[_0x3eca0f[_0x0365('0x1e')]]['toString']()});}else if(_0x3eca0f[_0x0365('0x47')]===_0x0365('0x4c')&&_0x3eca0f[_0x0365('0x4d')]&&_0x3eca0f[_0x0365('0x4d')][_0x0365('0xd')]&&_0x3eca0f[_0x0365('0x1f')]&&_0x3eca0f[_0x0365('0x44')]){_0x61c8e9[_0x3eca0f[_0x0365('0x4d')][_0x0365('0xd')][_0x0365('0x45')]()]&&_0x5f28ee['custom_fields'][_0x0365('0x49')]({'id':_0x3eca0f['idField'],'value':_0x61c8e9[_0x3eca0f['Variable'][_0x0365('0xd')][_0x0365('0x45')]()][_0x0365('0x46')]()});}});}return _0x5f28ee;}function getConnection(_0x44acc5){return request({'method':_0x0365('0xa'),'form':{'method':_0x0365('0x4e'),'input_type':_0x0365('0x20'),'response_type':_0x0365('0x20'),'rest_data':JSON[_0x0365('0x26')]({'user_auth':{'user_name':_0x44acc5['username'],'password':_0x44acc5['password'],'encryption':_0x0365('0x4f')},'application':_0x0365('0x50')})}})['then'](function(_0x219291){var _0x2a071a=_0x219291;if(_0x2a071a['id']){def[_0x0365('0x51')]=_0x2a071a['id'];return BPromise['resolve'](_0x2a071a);}else{throw new Error(util[_0x0365('0x22')](_0x0365('0x52'),_0x44acc5['id']));}});}function setRelationship(_0xc1571c,_0x667748,_0x59b0f0,_0x21db6c){return request({'form':{'method':_0x0365('0x53'),'input_type':'JSON','response_type':_0x0365('0x20'),'rest_data':JSON[_0x0365('0x26')]({'session':_0xc1571c['id'],'module_name':'Calls','module_id':_0x59b0f0['id'],'link_field_name':_0x21db6c,'related_ids':[_0x667748['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0365('0x54')]=function(_0x17a78b,_0x2bff91,_0x4a5592,_0xb76bd1,_0xc2266a,_0x333ccc){var _0x2b5482,_0x152dd9,_0x59a855,_0x2755ab;_0x333ccc[_0x0365('0x55')]=intUtil[_0x0365('0x56')](_0x333ccc[_0x0365('0x55')]);_0x333ccc[_0x0365('0x57')]=intUtil[_0x0365('0x56')](_0x333ccc['serverUrl']);def['uri']=util['format'](_0x0365('0x58'),_0x333ccc[_0x0365('0x55')]);if(_0xc2266a&&_0xc2266a[_0x0365('0x59')]){logger['info'](_0x0365('0x5a'),'Recording\x20is\x20enabled!');_0x2bff91[_0x0365('0x5b')]=util[_0x0365('0x22')](_0x0365('0x5c'),_0x333ccc[_0x0365('0x57')],_0x2bff91[_0x0365('0x5d')],md5(_0x2bff91[_0x0365('0x5d')]));}else{_0x2bff91[_0x0365('0x5b')]='';}return getConnection(_0x333ccc)[_0x0365('0x2b')](function(_0x3f2271){_0x2755ab=_0x3f2271;return getUser(_0x333ccc,_0xb76bd1[_0x0365('0xd')],_0x2755ab);})[_0x0365('0x2b')](function(_0x31860b){_0x2b5482=_0x31860b;logger[_0x0365('0x31')](_0x0365('0x5e'),_0x2b5482['id']);return getEndUser(_0x333ccc,_0x2bff91[_0x0365('0x5f')],_0x2bff91['calleridnum'],_0x2755ab);})['then'](function(_0x545dba){_0x152dd9=_0x545dba;logger[_0x0365('0x31')](_0x0365('0x60'),_0x152dd9['id']);return getTicket(_0x333ccc,_0x2b5482,_0x152dd9,_0x4a5592,_0x2bff91,_0x4a5592['Fields'],_0x2755ab,'Inbound');})[_0x0365('0x2b')](function(_0x149af2){_0x59a855=_0x149af2;logger[_0x0365('0x31')]('Ticket\x20created!');logger[_0x0365('0x31')](_0x0365('0x61'),_0x59a855['id']);return setRelationship(_0x2755ab,_0x2b5482,_0x59a855,'users');})[_0x0365('0x2b')](function(){return setRelationship(_0x2755ab,_0x152dd9,_0x59a855,'contacts');})[_0x0365('0x2b')](function(){return getServerInfo(_0x2755ab);})['then'](function(_0x44f3cd){var _0x4dda1a=parseInt(_0x44f3cd[_0x0365('0x62')]['charAt'](0x0));var _0x48248c=util[_0x0365('0x22')](_0x0365('0x63'),_0x333ccc[_0x0365('0x55')],_0x59a855['id']);if(_0x4dda1a>0x6){_0x48248c=util['format'](_0x0365('0x64'),_0x333ccc['remoteUri'],_0x59a855['id']);}logger['info'](_0x0365('0x5a'),_0x0365('0x65'));emit(util[_0x0365('0x22')](_0x0365('0x66'),_0xb76bd1[_0x0365('0xd')]),_0x0365('0x67'),{'uri':_0x48248c});})['catch'](function(_0x1e3803){logger[_0x0365('0x68')](_0x0365('0x5a'),JSON[_0x0365('0x26')](_0x1e3803));});};exports[_0x0365('0x69')]=function(_0x49e46f,_0x1c8743,_0x118889,_0xff6b00,_0x3d1404,_0x4eea8b,_0x2a3630){var _0x145afd,_0x27e449,_0x5bfceb,_0x1a22c6;_0x4eea8b[_0x0365('0x55')]=intUtil[_0x0365('0x56')](_0x4eea8b[_0x0365('0x55')]);_0x4eea8b['serverUrl']=intUtil[_0x0365('0x56')](_0x4eea8b[_0x0365('0x57')]);def[_0x0365('0x6a')]=util[_0x0365('0x22')](_0x0365('0x58'),_0x4eea8b[_0x0365('0x55')]);if(_0x2a3630&&_0x2a3630['recordingFormat']&&_0x2a3630['recordingFormat']!==_0x0365('0x6b')){logger['info'](_0x0365('0x6c'),_0x0365('0x6d'));_0x1c8743[_0x0365('0x5b')]=util[_0x0365('0x22')](_0x0365('0x5c'),_0x4eea8b[_0x0365('0x57')],_0x1c8743[_0x0365('0x5d')],md5(_0x1c8743[_0x0365('0x5d')]));}return getConnection(_0x4eea8b)[_0x0365('0x2b')](function(_0x5135f7){_0x1a22c6=_0x5135f7;return getUser(_0x4eea8b,_0xff6b00[_0x0365('0xd')],_0x1a22c6);})['then'](function(_0x4f67b8){_0x145afd=_0x4f67b8;logger['info'](_0x0365('0x5e'),_0x145afd['id']);return getEndUser(_0x4eea8b,_0x1c8743[_0x0365('0x6e')],_0x1c8743[_0x0365('0x6f')],_0x1a22c6);})['then'](function(_0x364668){_0x27e449=_0x364668;logger[_0x0365('0x31')](_0x0365('0x60'),_0x27e449['id']);return getTicket(_0x4eea8b,_0x145afd,_0x27e449,_0x118889,_0x1c8743,_0x118889[_0x0365('0x70')],_0x1a22c6,_0x0365('0x71'));})['then'](function(_0x144c3d){_0x5bfceb=_0x144c3d;logger[_0x0365('0x31')](_0x0365('0x72'));logger[_0x0365('0x31')]('The\x20Ticket\x20ID\x20is:',_0x5bfceb['id']);return setRelationship(_0x1a22c6,_0x145afd,_0x5bfceb,_0x0365('0x73'));})[_0x0365('0x2b')](function(){return setRelationship(_0x1a22c6,_0x27e449,_0x5bfceb,_0x0365('0x74'));})[_0x0365('0x2b')](function(){return getServerInfo(_0x1a22c6);})['then'](function(_0x182753){var _0x38c1bc=parseInt(_0x182753[_0x0365('0x62')][_0x0365('0x75')](0x0));var _0x15cee2=util[_0x0365('0x22')](_0x0365('0x63'),_0x4eea8b[_0x0365('0x55')],_0x5bfceb['id']);if(_0x38c1bc>0x6){_0x15cee2=util[_0x0365('0x22')](_0x0365('0x64'),_0x4eea8b[_0x0365('0x55')],_0x5bfceb['id']);}logger['info']('[OUTBOUND]',_0x0365('0x65'));emit(util[_0x0365('0x22')](_0x0365('0x66'),_0xff6b00[_0x0365('0xd')]),_0x0365('0x67'),{'uri':_0x15cee2});})[_0x0365('0x76')](function(_0x4ee5a6){logger[_0x0365('0x68')](_0x0365('0x6c'),JSON[_0x0365('0x26')](_0x4ee5a6));});};exports[_0x0365('0x77')]=function(_0x3d3896,_0x69fbc6,_0x2fa4d5,_0x518b9e,_0x50586b,_0x97066e){var _0x1391a6,_0x196fa3,_0x23a15c,_0x1049b9;_0x97066e['remoteUri']=intUtil[_0x0365('0x56')](_0x97066e[_0x0365('0x55')]);_0x97066e[_0x0365('0x57')]=intUtil[_0x0365('0x56')](_0x97066e[_0x0365('0x57')]);def[_0x0365('0x6a')]=util[_0x0365('0x22')]('%s/service/v4_1/rest.php',_0x97066e[_0x0365('0x55')]);if(_0x50586b&&_0x50586b[_0x0365('0x59')]){logger['info']('['+_0x69fbc6['lastevent'][_0x0365('0x78')]()+']',_0x0365('0x6d'));_0x69fbc6[_0x0365('0x5b')]=util[_0x0365('0x22')](_0x0365('0x5c'),_0x97066e['serverUrl'],_0x69fbc6['uniqueid'],md5(_0x69fbc6[_0x0365('0x5d')]));}else{_0x69fbc6['recordingURL']='';}return getConnection(_0x97066e)[_0x0365('0x2b')](function(_0x530aa0){_0x1049b9=_0x530aa0;if(!_[_0x0365('0x27')](_0x518b9e)){return getUser(_0x97066e,_0x518b9e[_0x0365('0xd')],_0x1049b9);}else{return getUser(_0x97066e,null,_0x1049b9);}})[_0x0365('0x2b')](function(_0x2fd138){_0x1391a6=_0x2fd138;logger[_0x0365('0x31')](_0x0365('0x5e'),_0x1391a6['id']);return getEndUser(_0x97066e,_0x69fbc6[_0x0365('0x5f')],_0x69fbc6[_0x0365('0x79')],_0x1049b9);})[_0x0365('0x2b')](function(_0x39921c){_0x196fa3=_0x39921c;logger[_0x0365('0x31')](_0x0365('0x60'),_0x196fa3['id']);return getTicket(_0x97066e,_0x1391a6,_0x196fa3,_0x2fa4d5,_0x69fbc6,_0x2fa4d5[_0x0365('0x70')],_0x1049b9,_0x0365('0x7a'));})[_0x0365('0x2b')](function(_0x33fc4d){_0x23a15c=_0x33fc4d;logger[_0x0365('0x31')]('Ticket\x20created!');logger[_0x0365('0x31')](_0x0365('0x61'),_0x23a15c['id']);return setRelationship(_0x1049b9,_0x1391a6,_0x23a15c,'users');})[_0x0365('0x2b')](function(){return setRelationship(_0x1049b9,_0x196fa3,_0x23a15c,_0x0365('0x74'));})['then'](function(){return getServerInfo(_0x1049b9);})['catch'](function(_0xd80652){logger['error']('['+_0x69fbc6[_0x0365('0x7b')]['toUpperCase']()+']',JSON['stringify'](_0xd80652));});}; \ No newline at end of file +var _0xbbc3=['[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','unmanaged','lastevent','calleridnum','users','contacts','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','info','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','forEach','variableName','idField','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xbbc3,0x89));var _0x3bbc=function(_0x4920d4,_0x368e31){_0x4920d4=_0x4920d4-0x0;var _0x349df6=_0xbbc3[_0x4920d4];return _0x349df6;};'use strict';var _=require(_0x3bbc('0x0'));var rp=require('request-promise');var BPromise=require(_0x3bbc('0x1'));var md5=require(_0x3bbc('0x2'));var util=require(_0x3bbc('0x3'));var Redis=require(_0x3bbc('0x4'));var intUtil=require(_0x3bbc('0x5'));var config=require(_0x3bbc('0x6'));var logger=require('../../../../config/logger')(_0x3bbc('0x7'));config[_0x3bbc('0x8')]=_['defaults'](config['redis'],{'host':_0x3bbc('0x9'),'port':0x18eb});var io=require(_0x3bbc('0xa'))(new Redis(config['redis']));var def={'method':_0x3bbc('0xb'),'json':!![]};function emit(_0x2d2192,_0x5edff7,_0x1a8ada){io['to'](_0x2d2192)['emit'](_0x5edff7,_0x1a8ada);}function getTicket(_0x556cae,_0x180bc4,_0x502aec,_0x1f5a82,_0x556f7c,_0x52790b,_0x5e21c1,_0x126bfc){logger[_0x3bbc('0xc')]('Creating\x20new\x20ticket...');var _0x5d0f63=new Date();var _0x2c08ca=[{'name':'name','value':intUtil['getString'](_0x1f5a82[_0x3bbc('0xd')],_0x556f7c,'\x20')},{'name':_0x3bbc('0xe'),'value':_0x180bc4['id']},{'name':_0x3bbc('0xf'),'value':_0x180bc4['id']},{'name':_0x3bbc('0x10'),'value':intUtil[_0x3bbc('0x11')](_0x1f5a82[_0x3bbc('0x12')],_0x556f7c,'\x0a')},{'name':_0x3bbc('0x13'),'value':_0x5d0f63[_0x3bbc('0x14')]()[_0x3bbc('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x3bbc('0x16'),'value':'0'},{'name':_0x3bbc('0x17'),'value':'15'},{'name':_0x3bbc('0x18'),'value':_0x502aec['id']},{'name':_0x3bbc('0x19'),'value':_0x3bbc('0x1a')},{'name':_0x3bbc('0x1b'),'value':_0x502aec[_0x3bbc('0x1c')]},{'name':_0x3bbc('0x1d'),'value':_0x126bfc}];if(_0x52790b['length']){_[_0x3bbc('0x1e')](_0x52790b,function(_0x40a818){if(_0x556f7c[_0x40a818[_0x3bbc('0x1f')]]){_0x2c08ca['push']({'name':_0x40a818[_0x3bbc('0x20')],'value':_0x556f7c[_0x40a818[_0x3bbc('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3bbc('0x21')]({'session':_0x5e21c1['id'],'module_name':_0x3bbc('0x22'),'name_value_list':_0x2c08ca})}});}function getAuth(_0x13f590){return util[_0x3bbc('0x23')](_0x3bbc('0x24'),new Buffer(_0x13f590[_0x3bbc('0x25')]+':X')[_0x3bbc('0x26')](_0x3bbc('0x27')));}function getServerInfo(_0xc705a2){return request({'form':{'method':_0x3bbc('0x28'),'input_type':_0x3bbc('0x29'),'response_type':_0x3bbc('0x29'),'rest_data':JSON['stringify']({'session':_0xc705a2['id']})}});}function getUser(_0x17aa8e,_0x268d4f,_0x535293){if(!_[_0x3bbc('0x2a')](_0x268d4f)){logger[_0x3bbc('0xc')](_0x3bbc('0x2b'),_0x268d4f);return request({'form':{'method':_0x3bbc('0x2c'),'input_type':_0x3bbc('0x29'),'response_type':'JSON','rest_data':JSON[_0x3bbc('0x21')]({'session':_0x535293['id'],'module_name':_0x3bbc('0x2d'),'query':util[_0x3bbc('0x23')](_0x3bbc('0x2e'),_0x268d4f),'order_by':'','offset':'0','select_fields':['id','name',_0x3bbc('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x510f9f){if(_0x510f9f[_0x3bbc('0x30')][_0x3bbc('0x31')]){var _0x2196a0=_[_0x3bbc('0x32')](_0x510f9f[_0x3bbc('0x30')],function(_0x1bd918){return _0x1bd918[_0x3bbc('0x33')][_0x3bbc('0x2f')][_0x3bbc('0x34')]===_0x268d4f;});if(_0x2196a0){logger[_0x3bbc('0xc')]('Agent\x20found!');return BPromise[_0x3bbc('0x35')]({'id':_0x2196a0[_0x3bbc('0x33')]['id'][_0x3bbc('0x34')],'name':_0x2196a0[_0x3bbc('0x33')][_0x3bbc('0x1c')][_0x3bbc('0x34')]});}}logger[_0x3bbc('0xc')](_0x3bbc('0x36'));return BPromise['resolve']({'id':_0x535293[_0x3bbc('0x33')][_0x3bbc('0x37')]['value'],'name':_0x535293['name_value_list'][_0x3bbc('0x2f')][_0x3bbc('0x34')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3bbc('0x35')]({'id':_0x535293['name_value_list'][_0x3bbc('0x37')]['value'],'name':_0x535293[_0x3bbc('0x33')][_0x3bbc('0x2f')][_0x3bbc('0x34')]});}}function getEndUser(_0x3d82db,_0x209e06,_0xcef230,_0x4a1488){logger['info'](_0x3bbc('0x38'),_0xcef230);return request({'form':{'method':_0x3bbc('0x2c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3bbc('0x21')]({'session':_0x4a1488['id'],'module_name':_0x3bbc('0x1a'),'query':util[_0x3bbc('0x23')](_0x3bbc('0x39'),_0xcef230),'order_by':'','offset':'0','select_fields':['id','name',_0x3bbc('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3bbc('0x3b')](function(_0x55eb3e){if(_0x55eb3e['entry_list'][_0x3bbc('0x31')]){var _0x401f28=_['find'](_0x55eb3e['entry_list'],function(_0x239bf4){return _0x239bf4[_0x3bbc('0x33')][_0x3bbc('0x3a')]['value']===_0xcef230;});if(_0x401f28){logger[_0x3bbc('0xc')](_0x3bbc('0x3c'));return BPromise[_0x3bbc('0x35')]({'id':_0x401f28[_0x3bbc('0x33')]['id'][_0x3bbc('0x34')],'name':_0x401f28[_0x3bbc('0x33')][_0x3bbc('0x1c')]['value'],'phone':_0x401f28[_0x3bbc('0x33')][_0x3bbc('0x3a')][_0x3bbc('0x34')]});}}else{logger['info'](_0x3bbc('0x3d'));return request({'form':{'method':'set_entry','input_type':_0x3bbc('0x29'),'response_type':_0x3bbc('0x29'),'rest_data':JSON[_0x3bbc('0x21')]({'session':_0x4a1488['id'],'module_name':'Contacts','name_value_list':[{'name':_0x3bbc('0x3e'),'value':_0x209e06!==''?_0x209e06:util['format']('Caller\x20-\x20%s',_0xcef230)},{'name':_0x3bbc('0x3a'),'value':_0xcef230}]})}})[_0x3bbc('0x3b')](function(_0x2a8f1e){logger[_0x3bbc('0xc')](_0x3bbc('0x3f'));return BPromise[_0x3bbc('0x35')]({'id':_0x2a8f1e['id'],'name':_0x2a8f1e['entry_list'][_0x3bbc('0x3e')][_0x3bbc('0x34')],'phone':_0x2a8f1e[_0x3bbc('0x30')][_0x3bbc('0x3a')][_0x3bbc('0x34')]});});}});}function request(_0x400067){logger[_0x3bbc('0x40')](_0x3bbc('0x41'),JSON['stringify'](_0x400067));return rp(_[_0x3bbc('0x42')](def,_0x400067));}function getTags(_0x1ac23e,_0x3384d2){var _0x3509f5=[];if(_0x1ac23e&&_0x1ac23e['length']>0x0){_0x3509f5=_[_0x3bbc('0x43')](_0x1ac23e,_0x3384d2);}return _0x3509f5;}function getCustomFields(_0x331926,_0x246db7){var _0x57072a=[];var _0x307f60={'custom_fields':[]};if(_0x331926[_0x3bbc('0x31')]>0x0){_['forEach'](_0x331926,function(_0x3e3580){if(_0x3e3580[_0x3bbc('0x44')]===_0x3bbc('0x45')&&_0x3e3580[_0x3bbc('0x46')]&&!_0x3e3580[_0x3bbc('0x47')]){_0x307f60[_0x3e3580[_0x3bbc('0x46')][_0x3bbc('0x48')]()]=_0x3e3580[_0x3bbc('0x49')]['toString']();}else if(_0x3e3580[_0x3bbc('0x44')]===_0x3bbc('0x45')&&_0x3e3580[_0x3bbc('0x20')]&&_0x3e3580[_0x3bbc('0x47')]){_0x307f60[_0x3bbc('0x4a')][_0x3bbc('0x4b')]({'id':_0x3e3580[_0x3bbc('0x20')],'value':_0x3e3580['content'][_0x3bbc('0x26')]()});}else if(_0x3e3580['type']===_0x3bbc('0x4c')&&_0x3e3580[_0x3bbc('0x1f')]&&_0x3e3580[_0x3bbc('0x20')]&&_0x3e3580[_0x3bbc('0x47')]){_0x246db7[_0x3e3580[_0x3bbc('0x1f')]]&&_0x307f60['custom_fields'][_0x3bbc('0x4b')]({'id':_0x3e3580[_0x3bbc('0x20')],'value':_0x246db7[_0x3e3580[_0x3bbc('0x1f')]][_0x3bbc('0x26')]()});}else if(_0x3e3580[_0x3bbc('0x44')]===_0x3bbc('0x4d')&&_0x3e3580['Variable']&&_0x3e3580[_0x3bbc('0x4e')][_0x3bbc('0x1c')]&&_0x3e3580[_0x3bbc('0x20')]&&_0x3e3580[_0x3bbc('0x47')]){_0x246db7[_0x3e3580[_0x3bbc('0x4e')][_0x3bbc('0x1c')][_0x3bbc('0x48')]()]&&_0x307f60[_0x3bbc('0x4a')][_0x3bbc('0x4b')]({'id':_0x3e3580['idField'],'value':_0x246db7[_0x3e3580[_0x3bbc('0x4e')][_0x3bbc('0x1c')][_0x3bbc('0x48')]()]['toString']()});}});}return _0x307f60;}function getConnection(_0x5af633){return request({'method':_0x3bbc('0xb'),'form':{'method':_0x3bbc('0x4f'),'input_type':_0x3bbc('0x29'),'response_type':'JSON','rest_data':JSON[_0x3bbc('0x21')]({'user_auth':{'user_name':_0x5af633[_0x3bbc('0x50')],'password':_0x5af633[_0x3bbc('0x51')],'encryption':'PLAIN'},'application':_0x3bbc('0x52')})}})[_0x3bbc('0x3b')](function(_0x43ec26){var _0x24ea9d=_0x43ec26;if(_0x24ea9d['id']){def[_0x3bbc('0x53')]=_0x24ea9d['id'];return BPromise[_0x3bbc('0x35')](_0x24ea9d);}else{throw new Error(util[_0x3bbc('0x23')](_0x3bbc('0x54'),_0x5af633['id']));}});}function setRelationship(_0xb2fe2,_0xd40621,_0xb5dd57,_0x3cf88a){return request({'form':{'method':_0x3bbc('0x55'),'input_type':_0x3bbc('0x29'),'response_type':'JSON','rest_data':JSON[_0x3bbc('0x21')]({'session':_0xb2fe2['id'],'module_name':_0x3bbc('0x22'),'module_id':_0xb5dd57['id'],'link_field_name':_0x3cf88a,'related_ids':[_0xd40621['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3bbc('0x56')]=function(_0x29e363,_0x86fd62,_0x3e5f22,_0x4f168b,_0x5e038e,_0x6acdd1){var _0x289f62,_0x4f3692,_0x5845cc,_0x1a8a58;_0x6acdd1[_0x3bbc('0x57')]=intUtil['stripTrailingSlash'](_0x6acdd1[_0x3bbc('0x57')]);_0x6acdd1['serverUrl']=intUtil['stripTrailingSlash'](_0x6acdd1[_0x3bbc('0x58')]);def[_0x3bbc('0x59')]=util[_0x3bbc('0x23')]('%s/service/v4_1/rest.php',_0x6acdd1[_0x3bbc('0x57')]);if(_0x5e038e&&_0x5e038e[_0x3bbc('0x5a')]){logger['info'](_0x3bbc('0x5b'),_0x3bbc('0x5c'));_0x86fd62[_0x3bbc('0x5d')]=util[_0x3bbc('0x23')](_0x3bbc('0x5e'),_0x6acdd1[_0x3bbc('0x58')],_0x86fd62[_0x3bbc('0x5f')],md5(_0x86fd62[_0x3bbc('0x5f')]));}else{_0x86fd62[_0x3bbc('0x5d')]='';}return getConnection(_0x6acdd1)[_0x3bbc('0x3b')](function(_0x346558){_0x1a8a58=_0x346558;return getUser(_0x6acdd1,_0x4f168b[_0x3bbc('0x1c')],_0x1a8a58);})[_0x3bbc('0x3b')](function(_0x45e848){_0x289f62=_0x45e848;logger['info'](_0x3bbc('0x60'),_0x289f62['id']);return getEndUser(_0x6acdd1,_0x86fd62[_0x3bbc('0x61')],_0x86fd62['calleridnum'],_0x1a8a58);})['then'](function(_0x5ecdc7){_0x4f3692=_0x5ecdc7;logger['info'](_0x3bbc('0x62'),_0x4f3692['id']);return getTicket(_0x6acdd1,_0x289f62,_0x4f3692,_0x3e5f22,_0x86fd62,_0x3e5f22[_0x3bbc('0x63')],_0x1a8a58,_0x3bbc('0x64'));})[_0x3bbc('0x3b')](function(_0x441b82){_0x5845cc=_0x441b82;logger[_0x3bbc('0xc')](_0x3bbc('0x65'));logger['info'](_0x3bbc('0x66'),_0x5845cc['id']);return setRelationship(_0x1a8a58,_0x289f62,_0x5845cc,'users');})['then'](function(){return setRelationship(_0x1a8a58,_0x4f3692,_0x5845cc,'contacts');})[_0x3bbc('0x3b')](function(){return getServerInfo(_0x1a8a58);})[_0x3bbc('0x3b')](function(_0x4d724a){var _0x50c184=parseInt(_0x4d724a[_0x3bbc('0x67')][_0x3bbc('0x68')](0x0));var _0x5bd014=util[_0x3bbc('0x23')](_0x3bbc('0x69'),_0x6acdd1[_0x3bbc('0x57')],_0x5845cc['id']);if(_0x50c184>0x6){_0x5bd014=util[_0x3bbc('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x6acdd1[_0x3bbc('0x57')],_0x5845cc['id']);}logger['info'](_0x3bbc('0x5b'),_0x3bbc('0x6a'));emit(util[_0x3bbc('0x23')](_0x3bbc('0x6b'),_0x4f168b['name']),'trigger:browser:url',{'uri':_0x5bd014});})[_0x3bbc('0x6c')](function(_0x13d988){logger[_0x3bbc('0x6d')](_0x3bbc('0x5b'),JSON[_0x3bbc('0x21')](_0x13d988));});};exports[_0x3bbc('0x6e')]=function(_0xf32f41,_0x27a304,_0xcc29d9,_0xee5ae,_0x572d47,_0x175b61,_0x3e8cea){var _0x421772,_0x1b502f,_0x377fef,_0x4d6570;_0x175b61[_0x3bbc('0x57')]=intUtil[_0x3bbc('0x6f')](_0x175b61['remoteUri']);_0x175b61[_0x3bbc('0x58')]=intUtil[_0x3bbc('0x6f')](_0x175b61[_0x3bbc('0x58')]);def[_0x3bbc('0x59')]=util[_0x3bbc('0x23')](_0x3bbc('0x70'),_0x175b61[_0x3bbc('0x57')]);if(_0x3e8cea&&_0x3e8cea[_0x3bbc('0x71')]&&_0x3e8cea['recordingFormat']!==_0x3bbc('0x72')){logger[_0x3bbc('0xc')](_0x3bbc('0x73'),_0x3bbc('0x5c'));_0x27a304[_0x3bbc('0x5d')]=util['format'](_0x3bbc('0x5e'),_0x175b61[_0x3bbc('0x58')],_0x27a304['uniqueid'],md5(_0x27a304[_0x3bbc('0x5f')]));}return getConnection(_0x175b61)['then'](function(_0x1ab64c){_0x4d6570=_0x1ab64c;return getUser(_0x175b61,_0xee5ae['name'],_0x4d6570);})[_0x3bbc('0x3b')](function(_0x509139){_0x421772=_0x509139;logger[_0x3bbc('0xc')]('The\x20User\x20ID\x20is:',_0x421772['id']);return getEndUser(_0x175b61,_0x27a304[_0x3bbc('0x74')],_0x27a304[_0x3bbc('0x75')],_0x4d6570);})[_0x3bbc('0x3b')](function(_0x2008a2){_0x1b502f=_0x2008a2;logger[_0x3bbc('0xc')](_0x3bbc('0x62'),_0x1b502f['id']);return getTicket(_0x175b61,_0x421772,_0x1b502f,_0xcc29d9,_0x27a304,_0xcc29d9[_0x3bbc('0x63')],_0x4d6570,_0x3bbc('0x76'));})[_0x3bbc('0x3b')](function(_0x2d3f65){_0x377fef=_0x2d3f65;logger['info'](_0x3bbc('0x65'));logger['info'](_0x3bbc('0x66'),_0x377fef['id']);return setRelationship(_0x4d6570,_0x421772,_0x377fef,'users');})['then'](function(){return setRelationship(_0x4d6570,_0x1b502f,_0x377fef,'contacts');})[_0x3bbc('0x3b')](function(){return getServerInfo(_0x4d6570);})['then'](function(_0x1d989e){var _0x4163dd=parseInt(_0x1d989e[_0x3bbc('0x67')][_0x3bbc('0x68')](0x0));var _0x5044cc=util[_0x3bbc('0x23')](_0x3bbc('0x69'),_0x175b61[_0x3bbc('0x57')],_0x377fef['id']);if(_0x4163dd>0x6){_0x5044cc=util[_0x3bbc('0x23')](_0x3bbc('0x77'),_0x175b61[_0x3bbc('0x57')],_0x377fef['id']);}logger[_0x3bbc('0xc')](_0x3bbc('0x73'),_0x3bbc('0x6a'));emit(util[_0x3bbc('0x23')](_0x3bbc('0x6b'),_0xee5ae[_0x3bbc('0x1c')]),_0x3bbc('0x78'),{'uri':_0x5044cc});})[_0x3bbc('0x6c')](function(_0x243b51){logger[_0x3bbc('0x6d')](_0x3bbc('0x73'),JSON['stringify'](_0x243b51));});};exports[_0x3bbc('0x79')]=function(_0x4ca1b7,_0xfc19d3,_0x32fae6,_0x11b4bc,_0x6e457,_0x56154e){var _0x2342ca,_0x634404,_0x19937e,_0x4b20c6;_0x56154e[_0x3bbc('0x57')]=intUtil[_0x3bbc('0x6f')](_0x56154e[_0x3bbc('0x57')]);_0x56154e[_0x3bbc('0x58')]=intUtil['stripTrailingSlash'](_0x56154e[_0x3bbc('0x58')]);def[_0x3bbc('0x59')]=util[_0x3bbc('0x23')](_0x3bbc('0x70'),_0x56154e[_0x3bbc('0x57')]);if(_0x6e457&&_0x6e457['monitor_format']){logger[_0x3bbc('0xc')]('['+_0xfc19d3[_0x3bbc('0x7a')]['toUpperCase']()+']',_0x3bbc('0x5c'));_0xfc19d3['recordingURL']=util[_0x3bbc('0x23')](_0x3bbc('0x5e'),_0x56154e[_0x3bbc('0x58')],_0xfc19d3[_0x3bbc('0x5f')],md5(_0xfc19d3[_0x3bbc('0x5f')]));}else{_0xfc19d3['recordingURL']='';}return getConnection(_0x56154e)[_0x3bbc('0x3b')](function(_0x36044f){_0x4b20c6=_0x36044f;if(!_[_0x3bbc('0x2a')](_0x11b4bc)){return getUser(_0x56154e,_0x11b4bc[_0x3bbc('0x1c')],_0x4b20c6);}else{return getUser(_0x56154e,null,_0x4b20c6);}})['then'](function(_0x5ae704){_0x2342ca=_0x5ae704;logger[_0x3bbc('0xc')]('The\x20User\x20ID\x20is:',_0x2342ca['id']);return getEndUser(_0x56154e,_0xfc19d3[_0x3bbc('0x61')],_0xfc19d3[_0x3bbc('0x7b')],_0x4b20c6);})[_0x3bbc('0x3b')](function(_0x1a2214){_0x634404=_0x1a2214;logger[_0x3bbc('0xc')](_0x3bbc('0x62'),_0x634404['id']);return getTicket(_0x56154e,_0x2342ca,_0x634404,_0x32fae6,_0xfc19d3,_0x32fae6[_0x3bbc('0x63')],_0x4b20c6,_0x3bbc('0x64'));})[_0x3bbc('0x3b')](function(_0x1b7732){_0x19937e=_0x1b7732;logger[_0x3bbc('0xc')](_0x3bbc('0x65'));logger[_0x3bbc('0xc')]('The\x20Ticket\x20ID\x20is:',_0x19937e['id']);return setRelationship(_0x4b20c6,_0x2342ca,_0x19937e,_0x3bbc('0x7c'));})[_0x3bbc('0x3b')](function(){return setRelationship(_0x4b20c6,_0x634404,_0x19937e,_0x3bbc('0x7d'));})[_0x3bbc('0x3b')](function(){return getServerInfo(_0x4b20c6);})[_0x3bbc('0x6c')](function(_0x445ca4){logger[_0x3bbc('0x6d')]('['+_0xfc19d3['lastevent']['toUpperCase']()+']',JSON[_0x3bbc('0x21')](_0x445ca4));});}; \ 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 956403b..c4ba452 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 _0xfc3c=['variable','variableName','push','toString','type','customVariable','Variable','name','keyValue','keyType','key','%s:\x20%s','keyContent','format','toLowerCase','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','sortBy','length','string'];(function(_0xe3d29f,_0x4b6ae1){var _0x126bae=function(_0x1fae2e){while(--_0x1fae2e){_0xe3d29f['push'](_0xe3d29f['shift']());}};_0x126bae(++_0x4b6ae1);}(_0xfc3c,0x11a));var _0xcfc3=function(_0x37be36,_0x18fe03){_0x37be36=_0x37be36-0x0;var _0x47108e=_0xfc3c[_0x37be36];return _0x47108e;};'use strict';var _=require(_0xcfc3('0x0'));var util=require('util');exports['getString']=function(_0x1d156e,_0x5d0311,_0x900b4a){var _0x5bb2fd=[];if(_0x1d156e['length']>0x0){var _0x1bb626=_[_0xcfc3('0x1')](_0x1d156e,['id']);for(var _0x4dae04=0x0;_0x4dae04<_0x1bb626[_0xcfc3('0x2')];_0x4dae04++){var _0x5bd100=_0x1bb626[_0x4dae04];if(_0x5bd100['type']===_0xcfc3('0x3')){_0x5bb2fd['push'](_0x5bd100['content']);}else if(_0x5bd100['type']===_0xcfc3('0x4')&&_0x5bd100[_0xcfc3('0x5')]){_0x5d0311[_0x5bd100['variableName']]&&_0x5bb2fd[_0xcfc3('0x6')](_0x5d0311[_0x5bd100[_0xcfc3('0x5')]][_0xcfc3('0x7')]());}else if(_0x5bd100[_0xcfc3('0x8')]===_0xcfc3('0x9')&&_0x5bd100[_0xcfc3('0xa')]&&_0x5bd100[_0xcfc3('0xa')][_0xcfc3('0xb')]){_0x5d0311[_0x5bd100[_0xcfc3('0xa')][_0xcfc3('0xb')]['toLowerCase']()]&&_0x5bb2fd[_0xcfc3('0x6')](_0x5d0311[_0x5bd100[_0xcfc3('0xa')][_0xcfc3('0xb')]['toLowerCase']()][_0xcfc3('0x7')]());}else if(_0x5bd100['type']===_0xcfc3('0xc')){if(_0x5bd100[_0xcfc3('0xd')]===_0xcfc3('0x3')&&_0x5bd100[_0xcfc3('0xe')]){_0x5bb2fd['push'](util['format'](_0xcfc3('0xf'),_0x5bd100[_0xcfc3('0xe')],_0x5bd100[_0xcfc3('0x10')]));}else if(_0x5bd100[_0xcfc3('0xd')]==='variable'&&_0x5bd100['variableName']&&_0x5bd100['key']){_0x5d0311[_0x5bd100[_0xcfc3('0x5')]]&&_0x5bb2fd['push'](util[_0xcfc3('0x11')](_0xcfc3('0xf'),_0x5bd100[_0xcfc3('0xe')],_0x5d0311[_0x5bd100[_0xcfc3('0x5')]]));}else if(_0x5bd100[_0xcfc3('0xd')]===_0xcfc3('0x9')&&_0x5bd100[_0xcfc3('0xa')]&&_0x5bd100[_0xcfc3('0xa')][_0xcfc3('0xb')]&&_0x5bd100['key']){_0x5d0311[_0x5bd100[_0xcfc3('0xa')][_0xcfc3('0xb')][_0xcfc3('0x12')]()]&&_0x5bb2fd[_0xcfc3('0x6')](util[_0xcfc3('0x11')]('%s:\x20%s',_0x5bd100[_0xcfc3('0xe')],_0x5d0311[_0x5bd100[_0xcfc3('0xa')]['name'][_0xcfc3('0x12')]()]));}}}}return _0x5bb2fd[_0xcfc3('0x13')](_0x900b4a);};exports[_0xcfc3('0x14')]=function(_0x5bbd47){var _0x17cfe5=_0x5bbd47[_0xcfc3('0x15')](-0x1);if(_0x17cfe5==='/'){_0x5bbd47=_0x5bbd47[_0xcfc3('0x16')](0x0,_0x5bbd47['lastIndexOf'](_0x17cfe5));}return _0x5bbd47;};exports[_0xcfc3('0x17')]=function(_0x4e29e5){if(!_[_0xcfc3('0x18')](_0x4e29e5)&&_0x4e29e5!==''){var _0x3d948e=/^(([^<>()\[\]\\.,;:\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 _0x3d948e[_0xcfc3('0x19')](String(_0x4e29e5)[_0xcfc3('0x12')]());}else{return![];}}; \ No newline at end of file +var _0x2268=['name','Variable','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','string','type','variableName','push','customVariable'];(function(_0x5898d1,_0x1a2393){var _0x3d8a34=function(_0x288024){while(--_0x288024){_0x5898d1['push'](_0x5898d1['shift']());}};_0x3d8a34(++_0x1a2393);}(_0x2268,0x1b1));var _0x8226=function(_0x2e0cc3,_0x2efba3){_0x2e0cc3=_0x2e0cc3-0x0;var _0x1c7068=_0x2268[_0x2e0cc3];return _0x1c7068;};'use strict';var _=require(_0x8226('0x0'));var util=require(_0x8226('0x1'));exports['getString']=function(_0x13530e,_0x2a387d,_0x11c066){var _0x389aa5=[];if(_0x13530e['length']>0x0){var _0x2b541e=_[_0x8226('0x2')](_0x13530e,['id']);for(var _0xa134dd=0x0;_0xa134dd<_0x2b541e[_0x8226('0x3')];_0xa134dd++){var _0x5d1520=_0x2b541e[_0xa134dd];if(_0x5d1520['type']===_0x8226('0x4')){_0x389aa5['push'](_0x5d1520['content']);}else if(_0x5d1520[_0x8226('0x5')]==='variable'&&_0x5d1520['variableName']){_0x2a387d[_0x5d1520[_0x8226('0x6')]]&&_0x389aa5[_0x8226('0x7')](_0x2a387d[_0x5d1520['variableName']]['toString']());}else if(_0x5d1520['type']===_0x8226('0x8')&&_0x5d1520['Variable']&&_0x5d1520['Variable'][_0x8226('0x9')]){_0x2a387d[_0x5d1520[_0x8226('0xa')]['name'][_0x8226('0xb')]()]&&_0x389aa5[_0x8226('0x7')](_0x2a387d[_0x5d1520[_0x8226('0xa')]['name'][_0x8226('0xb')]()]['toString']());}else if(_0x5d1520['type']===_0x8226('0xc')){if(_0x5d1520[_0x8226('0xd')]==='string'&&_0x5d1520[_0x8226('0xe')]){_0x389aa5[_0x8226('0x7')](util[_0x8226('0xf')]('%s:\x20%s',_0x5d1520[_0x8226('0xe')],_0x5d1520[_0x8226('0x10')]));}else if(_0x5d1520[_0x8226('0xd')]===_0x8226('0x11')&&_0x5d1520['variableName']&&_0x5d1520[_0x8226('0xe')]){_0x2a387d[_0x5d1520['variableName']]&&_0x389aa5[_0x8226('0x7')](util[_0x8226('0xf')](_0x8226('0x12'),_0x5d1520[_0x8226('0xe')],_0x2a387d[_0x5d1520['variableName']]));}else if(_0x5d1520[_0x8226('0xd')]===_0x8226('0x8')&&_0x5d1520['Variable']&&_0x5d1520[_0x8226('0xa')]['name']&&_0x5d1520[_0x8226('0xe')]){_0x2a387d[_0x5d1520['Variable'][_0x8226('0x9')][_0x8226('0xb')]()]&&_0x389aa5[_0x8226('0x7')](util[_0x8226('0xf')](_0x8226('0x12'),_0x5d1520[_0x8226('0xe')],_0x2a387d[_0x5d1520[_0x8226('0xa')][_0x8226('0x9')][_0x8226('0xb')]()]));}}}}return _0x389aa5[_0x8226('0x13')](_0x11c066);};exports[_0x8226('0x14')]=function(_0x11c4c7){var _0x45d9a4=_0x11c4c7[_0x8226('0x15')](-0x1);if(_0x45d9a4==='/'){_0x11c4c7=_0x11c4c7['substring'](0x0,_0x11c4c7[_0x8226('0x16')](_0x45d9a4));}return _0x11c4c7;};exports[_0x8226('0x17')]=function(_0x14b1cb){if(!_[_0x8226('0x18')](_0x14b1cb)&&_0x14b1cb!==''){var _0x290e73=/^(([^<>()\[\]\\.,;:\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 _0x290e73[_0x8226('0x19')](String(_0x14b1cb)[_0x8226('0xb')]());}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 9b45480..1434414 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2c67af,_0x367db4){var _0x56bb38=function(_0x4eb5c7){while(--_0x4eb5c7){_0x2c67af['push'](_0x2c67af['shift']());}};_0x56bb38(++_0x367db4);}(_0xe706,0xa3));var _0x6e70=function(_0x2a4a99,_0x64b4a){_0x2a4a99=_0x2a4a99-0x0;var _0x1cef2f=_0xe706[_0x2a4a99];return _0x1cef2f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 33db915..f52f573 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 _0x4198=['authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','content','type','custom_fields','push','idField','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[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:','The\x20Ticket\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','../../../../config/environment','zendesk','redis','defaults','socket.io-emitter','emit','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s'];(function(_0x281bc0,_0x1ec14c){var _0x23b92e=function(_0x3cd46c){while(--_0x3cd46c){_0x281bc0['push'](_0x281bc0['shift']());}};_0x23b92e(++_0x1ec14c);}(_0x4198,0xb1));var _0x8419=function(_0x237bf0,_0x1d149b){_0x237bf0=_0x237bf0-0x0;var _0x374241=_0x4198[_0x237bf0];return _0x374241;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8419('0x0'));var util=require(_0x8419('0x1'));var Redis=require(_0x8419('0x2'));var intUtil=require('./util');var config=require(_0x8419('0x3'));var logger=require('../../../../config/logger')(_0x8419('0x4'));config[_0x8419('0x5')]=_[_0x8419('0x6')](config[_0x8419('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8419('0x7'))(new Redis(config[_0x8419('0x5')]));function emit(_0x54d393,_0x293afa,_0x271e76){io['to'](_0x54d393)[_0x8419('0x8')](_0x293afa,_0x271e76);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0xb53667,_0xca7371,_0x409624,_0x5b16bf,_0x517da9){logger['info'](_0x8419('0x9'));return request({'uri':util[_0x8419('0xa')](_0x8419('0xb'),_0xb53667[_0x8419('0xc')]),'method':_0x8419('0xd'),'body':{'ticket':_[_0x8419('0xe')]({'requester_id':_0x409624['id'],'submitter_id':_0xca7371?_0xca7371['id']:undefined,'assignee_id':_0xca7371?_0xca7371['id']:undefined,'tags':getTags(_0x5b16bf[_0x8419('0xf')],_0x8419('0x10')),'subject':intUtil[_0x8419('0x11')](_0x5b16bf[_0x8419('0x12')],_0x517da9,'\x20'),'description':intUtil[_0x8419('0x11')](_0x5b16bf[_0x8419('0x13')],_0x517da9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8419('0x11')](_0x5b16bf[_0x8419('0x13')],_0x517da9,'\x0a')}},getCustomFields(_0x5b16bf[_0x8419('0x14')],_0x517da9))}})[_0x8419('0x15')](function(_0x2e7a47){logger[_0x8419('0x16')](_0x8419('0x17'));return _0x2e7a47[_0x8419('0x18')];});}function getUser(_0x10a139,_0x354179){if(intUtil[_0x8419('0x19')](_0x354179)){logger['info'](_0x8419('0x1a'),_0x354179);return request({'uri':util[_0x8419('0xa')](_0x8419('0x1b'),_0x10a139['remoteUri']),'qs':{'query':util['format'](_0x8419('0x1c'),_0x354179)}})[_0x8419('0x15')](function(_0x1ba56b){if(_0x1ba56b[_0x8419('0x1d')]){logger['info']('Agent\x20found!');return _['find'](_0x1ba56b[_0x8419('0x1e')],{'email':_0x354179,'role':_0x8419('0x1f')});}else{logger['info'](_0x8419('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x10a139[_0x8419('0xc')])})['then'](function(_0xc564ff){logger['info'](_0x8419('0x21'));return _0xc564ff['user'];});}});}else{logger[_0x8419('0x16')](_0x8419('0x20'));return request({'uri':util[_0x8419('0xa')](_0x8419('0x22'),_0x10a139[_0x8419('0xc')])})[_0x8419('0x15')](function(_0x2aa5d6){logger[_0x8419('0x16')]('Admin\x20account\x20selected.');return _0x2aa5d6[_0x8419('0x23')];});}}function getEndUser(_0x503764,_0x4337fd,_0x45700c){logger[_0x8419('0x16')](_0x8419('0x24'),_0x45700c);return request({'uri':util['format'](_0x8419('0x1b'),_0x503764[_0x8419('0xc')]),'qs':{'query':util[_0x8419('0xa')](_0x8419('0x25'),_0x45700c)}})[_0x8419('0x15')](function(_0x3baf4f){var _0x4e8d95;if(_0x3baf4f[_0x8419('0x1e')][_0x8419('0x26')]){_0x3baf4f[_0x8419('0x1e')]=_[_0x8419('0x27')](_0x3baf4f[_0x8419('0x1e')],{'suspended':![],'role':_0x8419('0x28')});if(_0x3baf4f['results']['length']){_0x4e8d95=_[_0x8419('0x29')](_0x3baf4f['results']);}}if(_0x4e8d95){logger['info'](_0x8419('0x2a'));return _0x4e8d95;}else{logger['info'](_0x8419('0x2b'));return request({'uri':util[_0x8419('0xa')]('%s/users.json',_0x503764['remoteUri']),'method':_0x8419('0xd'),'body':{'user':{'role':'end-user','name':util[_0x8419('0xa')](_0x8419('0x2c'),_0x4337fd||_0x45700c),'phone':_0x45700c}}})[_0x8419('0x15')](function(_0xc67e9a){logger['info']('Enduser\x20created.');return _0xc67e9a[_0x8419('0x23')];});}});}function getAuth(_0x2a2787){var _0x1906ba;if(_0x2a2787[_0x8419('0x2d')]===_0x8419('0x2e')){_0x1906ba=util['format'](_0x8419('0x2f'),_0x2a2787[_0x8419('0x30')],_0x2a2787[_0x8419('0x2e')]);}else if(_0x2a2787[_0x8419('0x2d')]===_0x8419('0x31')){_0x1906ba=util['format'](_0x8419('0x32'),_0x2a2787[_0x8419('0x30')],_0x2a2787[_0x8419('0x31')]);}return util['format']('Basic\x20%s',new Buffer(_0x1906ba)[_0x8419('0x33')](_0x8419('0x34')));}function request(_0x5d683c){logger[_0x8419('0x35')]('[HTTP]',JSON[_0x8419('0x36')](_0x5d683c));return rp(_[_0x8419('0x6')](_0x5d683c,{'method':_0x8419('0x37'),'headers':headers,'json':!![]}));}function getTags(_0xabb322,_0x114428){var _0x53af5d=[];if(_0xabb322&&_0xabb322[_0x8419('0x26')]>0x0){_0x53af5d=_[_0x8419('0x38')](_0xabb322,_0x114428);}return _0x53af5d;}function getCustomFields(_0xf58284,_0x3bb342){var _0x3708d6=[];var _0x4af0cb={'custom_fields':[]};if(_0xf58284[_0x8419('0x26')]>0x0){_[_0x8419('0x39')](_0xf58284,function(_0x23fdc7){if(_[_0x8419('0x3a')]([_0x8419('0x3b'),_0x8419('0x3c')],_0x23fdc7['type'])&&_0x23fdc7[_0x8419('0x3d')]&&!_0x23fdc7[_0x8419('0x3e')]){_0x4af0cb[_0x23fdc7[_0x8419('0x3d')]['toLowerCase']()]=_0x23fdc7[_0x8419('0x3f')][_0x8419('0x33')]();}else if(_[_0x8419('0x3a')]([_0x8419('0x3b'),_0x8419('0x3c')],_0x23fdc7[_0x8419('0x40')])&&_0x23fdc7['idField']&&_0x23fdc7[_0x8419('0x3e')]){_0x4af0cb[_0x8419('0x41')][_0x8419('0x42')]({'id':_0x23fdc7[_0x8419('0x43')],'value':_0x23fdc7['content']['toString']()});}else if(_0x23fdc7[_0x8419('0x40')]===_0x8419('0x44')&&_0x23fdc7[_0x8419('0x45')]&&_0x23fdc7[_0x8419('0x43')]&&_0x23fdc7['customField']){_0x3bb342[_0x23fdc7[_0x8419('0x45')]]&&_0x4af0cb[_0x8419('0x41')][_0x8419('0x42')]({'id':_0x23fdc7['idField'],'value':_0x3bb342[_0x23fdc7['variableName']][_0x8419('0x33')]()});}else if(_0x23fdc7[_0x8419('0x40')]==='customVariable'&&_0x23fdc7[_0x8419('0x46')]&&_0x23fdc7['Variable']['name']&&_0x23fdc7[_0x8419('0x43')]&&_0x23fdc7[_0x8419('0x3e')]){_0x3bb342[_0x23fdc7['Variable']['name'][_0x8419('0x47')]()]&&_0x4af0cb[_0x8419('0x41')][_0x8419('0x42')]({'id':_0x23fdc7[_0x8419('0x43')],'value':_0x3bb342[_0x23fdc7[_0x8419('0x46')]['name'][_0x8419('0x47')]()]['toString']()});}});}return _0x4af0cb;}exports[_0x8419('0x48')]=function(_0x516b32,_0x401094,_0x483e85,_0x58d122,_0x1f16a7,_0x4e6df3){var _0x33b578,_0xc6946a;_0x4e6df3[_0x8419('0xc')]=intUtil[_0x8419('0x49')](_0x4e6df3[_0x8419('0xc')]);_0x4e6df3[_0x8419('0x4a')]=intUtil[_0x8419('0x49')](_0x4e6df3[_0x8419('0x4a')]);if(_0x1f16a7&&_0x1f16a7[_0x8419('0x4b')]){logger[_0x8419('0x16')](_0x8419('0x4c'),'Recording\x20is\x20enabled!');_0x401094[_0x8419('0x4d')]=util[_0x8419('0xa')](_0x8419('0x4e'),_0x4e6df3[_0x8419('0x4a')],_0x401094[_0x8419('0x4f')],md5(_0x401094[_0x8419('0x4f')]));}else{_0x401094[_0x8419('0x4d')]='';}headers[_0x8419('0x50')]=getAuth(_0x4e6df3);return getUser(_0x4e6df3,_0x58d122[_0x8419('0x51')])['then'](function(_0x27b2a8){_0x33b578=_0x27b2a8;logger[_0x8419('0x16')](_0x8419('0x52'),_0x33b578['id']);return getEndUser(_0x4e6df3,_0x401094[_0x8419('0x53')],_0x401094[_0x8419('0x54')]);})['then'](function(_0x3bd924){_0xc6946a=_0x3bd924;logger['info'](_0x8419('0x55'),_0xc6946a['id']);return getTicket(_0x4e6df3,_0x33b578,_0xc6946a,_0x483e85,_0x401094);})[_0x8419('0x15')](function(_0x2fde18){if(_0x2fde18){logger[_0x8419('0x16')](_0x8419('0x56'),_0x2fde18['id']);switch(_0x4e6df3[_0x8419('0x40')]){case'integrationTab':logger[_0x8419('0x16')](_0x8419('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8419('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4e6df3[_0x8419('0xc')],_0x33b578['id'],_0x2fde18['id']),'method':_0x8419('0xd')});case _0x8419('0x57'):logger[_0x8419('0x16')](_0x8419('0x4c'),_0x8419('0x58'));emit(util['format'](_0x8419('0x59'),_0x58d122[_0x8419('0x10')]),_0x8419('0x5a'),{'uri':util['format'](_0x8419('0x5b'),_0x4e6df3[_0x8419('0xc')][_0x8419('0x5c')]('/api/v2',''),_0x2fde18['id'])});break;default:logger[_0x8419('0x5d')](_0x8419('0x4c'),_0x8419('0x5e'));}}})[_0x8419('0x5f')](function(_0x27ae48){logger[_0x8419('0x5d')](_0x8419('0x60'),util[_0x8419('0x61')](_0x27ae48,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x28579f,_0x3cc9c9,_0x5c676a,_0x17f8a1,_0x33f005,_0x1e1c1f,_0x34a055){var _0x306685,_0x5cafcd;_0x1e1c1f[_0x8419('0xc')]=intUtil[_0x8419('0x49')](_0x1e1c1f[_0x8419('0xc')]);_0x1e1c1f[_0x8419('0x4a')]=intUtil['stripTrailingSlash'](_0x1e1c1f[_0x8419('0x4a')]);if(_0x34a055&&_0x34a055[_0x8419('0x62')]&&_0x34a055['recordingFormat']!==_0x8419('0x63')){logger['info']('[OUTBOUND]',_0x8419('0x64'));_0x3cc9c9['recordingURL']=util[_0x8419('0xa')](_0x8419('0x4e'),_0x1e1c1f[_0x8419('0x4a')],_0x3cc9c9['uniqueid'],md5(_0x3cc9c9[_0x8419('0x4f')]));}headers[_0x8419('0x50')]=getAuth(_0x1e1c1f);return getUser(_0x1e1c1f,_0x17f8a1[_0x8419('0x51')])[_0x8419('0x15')](function(_0x39f426){_0x306685=_0x39f426;logger[_0x8419('0x16')](_0x8419('0x52'),_0x306685['id']);return getEndUser(_0x1e1c1f,_0x3cc9c9[_0x8419('0x65')],_0x3cc9c9[_0x8419('0x66')]);})[_0x8419('0x15')](function(_0x3059e4){_0x5cafcd=_0x3059e4;logger[_0x8419('0x16')](_0x8419('0x55'),_0x5cafcd['id']);return getTicket(_0x1e1c1f,_0x306685,_0x5cafcd,_0x5c676a,_0x3cc9c9);})[_0x8419('0x15')](function(_0xe79e6c){if(_0xe79e6c){logger['info'](_0x8419('0x56'),_0xe79e6c['id']);switch(_0x1e1c1f[_0x8419('0x40')]){case'integrationTab':logger['info'](_0x8419('0x67'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8419('0xa')](_0x8419('0x68'),_0x1e1c1f[_0x8419('0xc')],_0x306685['id'],_0xe79e6c['id']),'method':_0x8419('0xd')});case'newTab':logger[_0x8419('0x16')]('[OUTBOUND]',_0x8419('0x58'));emit(util[_0x8419('0xa')](_0x8419('0x59'),_0x17f8a1[_0x8419('0x10')]),_0x8419('0x5a'),{'uri':util[_0x8419('0xa')](_0x8419('0x5b'),_0x1e1c1f[_0x8419('0xc')][_0x8419('0x5c')](_0x8419('0x69'),''),_0xe79e6c['id'])});break;default:logger[_0x8419('0x5d')](_0x8419('0x67'),_0x8419('0x5e'));}}})['catch'](function(_0x496f19){logger[_0x8419('0x5d')](_0x8419('0x6a'),util['inspect'](_0x496f19,{'showHidden':!![],'depth':null}));});};exports[_0x8419('0x6b')]=function(_0x20e14b,_0x1e441e,_0x1f7ea1,_0x40b89a,_0x34ff7c,_0x2ed2de){var _0x4a3113,_0x1ac816;_0x2ed2de[_0x8419('0xc')]=intUtil[_0x8419('0x49')](_0x2ed2de[_0x8419('0xc')]);_0x2ed2de[_0x8419('0x4a')]=intUtil[_0x8419('0x49')](_0x2ed2de[_0x8419('0x4a')]);if(_0x34ff7c&&_0x34ff7c['monitor_format']){logger[_0x8419('0x16')]('['+_0x1e441e[_0x8419('0x6c')][_0x8419('0x6d')]()+']',_0x8419('0x64'));_0x1e441e['recordingURL']=util[_0x8419('0xa')](_0x8419('0x4e'),_0x2ed2de[_0x8419('0x4a')],_0x1e441e[_0x8419('0x4f')],md5(_0x1e441e[_0x8419('0x4f')]));}else{_0x1e441e[_0x8419('0x4d')]='';}headers[_0x8419('0x50')]=getAuth(_0x2ed2de);return getUser(_0x2ed2de)[_0x8419('0x15')](function(_0x19db54){_0x4a3113=_0x19db54;logger[_0x8419('0x16')]('The\x20User\x20ID\x20is:',_0x4a3113['id']);return getEndUser(_0x2ed2de,_0x1e441e[_0x8419('0x53')],_0x1e441e['calleridnum']);})[_0x8419('0x15')](function(_0x1a9fa7){_0x1ac816=_0x1a9fa7;logger['info'](_0x8419('0x55'),_0x1ac816['id']);return getTicket(_0x2ed2de,_0x4a3113,_0x1ac816,_0x1f7ea1,_0x1e441e);})[_0x8419('0x15')](function(_0x3b20ea){if(_0x3b20ea){logger[_0x8419('0x16')](_0x8419('0x56'),_0x3b20ea['id']);}})['catch'](function(_0x2c823b){logger[_0x8419('0x5d')]('['+_0x1e441e['lastevent'][_0x8419('0x6d')]()+']'+_0x8419('0x6e'),util[_0x8419('0x61')](_0x2c823b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbe4a=['string','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','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','%s:%s','username','token','%s/token:%s','toString','debug','[HTTP]','stringify','GET','forEach','picklist','customField','content','includes'];(function(_0x439a03,_0x45a6f4){var _0x30c51a=function(_0x34c13d){while(--_0x34c13d){_0x439a03['push'](_0x439a03['shift']());}};_0x30c51a(++_0x45a6f4);}(_0xbe4a,0x119));var _0xabe4=function(_0x58321f,_0x5730b9){_0x58321f=_0x58321f-0x0;var _0x3728ea=_0xbe4a[_0x58321f];return _0x3728ea;};'use strict';var _=require(_0xabe4('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xabe4('0x1'));var Redis=require(_0xabe4('0x2'));var intUtil=require('./util');var config=require(_0xabe4('0x3'));var logger=require(_0xabe4('0x4'))(_0xabe4('0x5'));config[_0xabe4('0x6')]=_[_0xabe4('0x7')](config[_0xabe4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xabe4('0x8'))(new Redis(config[_0xabe4('0x6')]));function emit(_0x4ff581,_0x589937,_0x4a70bb){io['to'](_0x4ff581)[_0xabe4('0x9')](_0x589937,_0x4a70bb);}var headers={'Content-Type':'application/json','Accept':_0xabe4('0xa')};function getTicket(_0x216809,_0x22b310,_0x3848f6,_0x386620,_0x2bf194){logger[_0xabe4('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xabe4('0xc')](_0xabe4('0xd'),_0x216809[_0xabe4('0xe')]),'method':_0xabe4('0xf'),'body':{'ticket':_[_0xabe4('0x10')]({'requester_id':_0x3848f6['id'],'submitter_id':_0x22b310?_0x22b310['id']:undefined,'assignee_id':_0x22b310?_0x22b310['id']:undefined,'tags':getTags(_0x386620[_0xabe4('0x11')],_0xabe4('0x12')),'subject':intUtil['getString'](_0x386620[_0xabe4('0x13')],_0x2bf194,'\x20'),'description':intUtil[_0xabe4('0x14')](_0x386620['Descriptions'],_0x2bf194,'\x0a'),'comment':{'public':![],'body':intUtil[_0xabe4('0x14')](_0x386620[_0xabe4('0x15')],_0x2bf194,'\x0a')}},getCustomFields(_0x386620[_0xabe4('0x16')],_0x2bf194))}})[_0xabe4('0x17')](function(_0x43eded){logger[_0xabe4('0xb')](_0xabe4('0x18'));return _0x43eded[_0xabe4('0x19')];});}function getUser(_0x37c90c,_0x329edd){if(intUtil[_0xabe4('0x1a')](_0x329edd)){logger['info'](_0xabe4('0x1b'),_0x329edd);return request({'uri':util[_0xabe4('0xc')](_0xabe4('0x1c'),_0x37c90c[_0xabe4('0xe')]),'qs':{'query':util[_0xabe4('0xc')](_0xabe4('0x1d'),_0x329edd)}})['then'](function(_0x4e7e9f){if(_0x4e7e9f[_0xabe4('0x1e')]){logger[_0xabe4('0xb')](_0xabe4('0x1f'));return _[_0xabe4('0x20')](_0x4e7e9f[_0xabe4('0x21')],{'email':_0x329edd,'role':_0xabe4('0x22')});}else{logger[_0xabe4('0xb')](_0xabe4('0x23'));return request({'uri':util[_0xabe4('0xc')]('%s/users/me.json',_0x37c90c[_0xabe4('0xe')])})['then'](function(_0x470ec4){logger[_0xabe4('0xb')](_0xabe4('0x24'));return _0x470ec4[_0xabe4('0x25')];});}});}else{logger[_0xabe4('0xb')](_0xabe4('0x23'));return request({'uri':util[_0xabe4('0xc')]('%s/users/me.json',_0x37c90c[_0xabe4('0xe')])})['then'](function(_0x146007){logger[_0xabe4('0xb')]('Admin\x20account\x20selected.');return _0x146007[_0xabe4('0x25')];});}}function getEndUser(_0x3b7c7a,_0x4eba80,_0xc3467){logger[_0xabe4('0xb')](_0xabe4('0x26'),_0xc3467);return request({'uri':util['format'](_0xabe4('0x1c'),_0x3b7c7a['remoteUri']),'qs':{'query':util['format'](_0xabe4('0x27'),_0xc3467)}})['then'](function(_0x4e0aa2){var _0x38f3d7;if(_0x4e0aa2['results']['length']){_0x4e0aa2[_0xabe4('0x21')]=_[_0xabe4('0x28')](_0x4e0aa2[_0xabe4('0x21')],{'suspended':![],'role':_0xabe4('0x29')});if(_0x4e0aa2[_0xabe4('0x21')][_0xabe4('0x2a')]){_0x38f3d7=_[_0xabe4('0x2b')](_0x4e0aa2[_0xabe4('0x21')]);}}if(_0x38f3d7){logger[_0xabe4('0xb')](_0xabe4('0x2c'));return _0x38f3d7;}else{logger[_0xabe4('0xb')](_0xabe4('0x2d'));return request({'uri':util[_0xabe4('0xc')]('%s/users.json',_0x3b7c7a[_0xabe4('0xe')]),'method':_0xabe4('0xf'),'body':{'user':{'role':'end-user','name':util[_0xabe4('0xc')](_0xabe4('0x2e'),_0x4eba80||_0xc3467),'phone':_0xc3467}}})[_0xabe4('0x17')](function(_0x54d8b4){logger[_0xabe4('0xb')](_0xabe4('0x2f'));return _0x54d8b4['user'];});}});}function getAuth(_0x1ce277){var _0x63306b;if(_0x1ce277[_0xabe4('0x30')]===_0xabe4('0x31')){_0x63306b=util[_0xabe4('0xc')](_0xabe4('0x32'),_0x1ce277[_0xabe4('0x33')],_0x1ce277[_0xabe4('0x31')]);}else if(_0x1ce277[_0xabe4('0x30')]===_0xabe4('0x34')){_0x63306b=util[_0xabe4('0xc')](_0xabe4('0x35'),_0x1ce277[_0xabe4('0x33')],_0x1ce277[_0xabe4('0x34')]);}return util[_0xabe4('0xc')]('Basic\x20%s',new Buffer(_0x63306b)[_0xabe4('0x36')]('base64'));}function request(_0x350417){logger[_0xabe4('0x37')](_0xabe4('0x38'),JSON[_0xabe4('0x39')](_0x350417));return rp(_[_0xabe4('0x7')](_0x350417,{'method':_0xabe4('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x361cad,_0x1cc42e){var _0x15f96a=[];if(_0x361cad&&_0x361cad[_0xabe4('0x2a')]>0x0){_0x15f96a=_['map'](_0x361cad,_0x1cc42e);}return _0x15f96a;}function getCustomFields(_0x265fea,_0x4fac2c){var _0x541731=[];var _0x3dfc8b={'custom_fields':[]};if(_0x265fea[_0xabe4('0x2a')]>0x0){_[_0xabe4('0x3b')](_0x265fea,function(_0x42b4be){if(_['includes'](['string',_0xabe4('0x3c')],_0x42b4be['type'])&&_0x42b4be['nameField']&&!_0x42b4be[_0xabe4('0x3d')]){_0x3dfc8b[_0x42b4be['nameField']['toLowerCase']()]=_0x42b4be[_0xabe4('0x3e')][_0xabe4('0x36')]();}else if(_[_0xabe4('0x3f')]([_0xabe4('0x40'),_0xabe4('0x3c')],_0x42b4be[_0xabe4('0x41')])&&_0x42b4be[_0xabe4('0x42')]&&_0x42b4be[_0xabe4('0x3d')]){_0x3dfc8b[_0xabe4('0x43')][_0xabe4('0x44')]({'id':_0x42b4be[_0xabe4('0x42')],'value':_0x42b4be[_0xabe4('0x3e')]['toString']()});}else if(_0x42b4be[_0xabe4('0x41')]===_0xabe4('0x45')&&_0x42b4be['variableName']&&_0x42b4be[_0xabe4('0x42')]&&_0x42b4be[_0xabe4('0x3d')]){_0x4fac2c[_0x42b4be['variableName']]&&_0x3dfc8b[_0xabe4('0x43')][_0xabe4('0x44')]({'id':_0x42b4be[_0xabe4('0x42')],'value':_0x4fac2c[_0x42b4be[_0xabe4('0x46')]][_0xabe4('0x36')]()});}else if(_0x42b4be[_0xabe4('0x41')]===_0xabe4('0x47')&&_0x42b4be['Variable']&&_0x42b4be[_0xabe4('0x48')]['name']&&_0x42b4be[_0xabe4('0x42')]&&_0x42b4be['customField']){_0x4fac2c[_0x42b4be[_0xabe4('0x48')]['name'][_0xabe4('0x49')]()]&&_0x3dfc8b[_0xabe4('0x43')]['push']({'id':_0x42b4be[_0xabe4('0x42')],'value':_0x4fac2c[_0x42b4be[_0xabe4('0x48')][_0xabe4('0x12')][_0xabe4('0x49')]()][_0xabe4('0x36')]()});}});}return _0x3dfc8b;}exports['queue']=function(_0xb0007b,_0x11d2ce,_0x4e66f0,_0xfb1c50,_0x390fe6,_0x1d8bf1){var _0x1140ef,_0x5e48bf;_0x1d8bf1[_0xabe4('0xe')]=intUtil[_0xabe4('0x4a')](_0x1d8bf1[_0xabe4('0xe')]);_0x1d8bf1['serverUrl']=intUtil['stripTrailingSlash'](_0x1d8bf1['serverUrl']);if(_0x390fe6&&_0x390fe6[_0xabe4('0x4b')]){logger[_0xabe4('0xb')]('[QUEUE]',_0xabe4('0x4c'));_0x11d2ce[_0xabe4('0x4d')]=util[_0xabe4('0xc')](_0xabe4('0x4e'),_0x1d8bf1[_0xabe4('0x4f')],_0x11d2ce[_0xabe4('0x50')],md5(_0x11d2ce[_0xabe4('0x50')]));}else{_0x11d2ce[_0xabe4('0x4d')]='';}headers[_0xabe4('0x51')]=getAuth(_0x1d8bf1);return getUser(_0x1d8bf1,_0xfb1c50['email'])[_0xabe4('0x17')](function(_0x682975){_0x1140ef=_0x682975;logger[_0xabe4('0xb')](_0xabe4('0x52'),_0x1140ef['id']);return getEndUser(_0x1d8bf1,_0x11d2ce[_0xabe4('0x53')],_0x11d2ce[_0xabe4('0x54')]);})['then'](function(_0x4994e7){_0x5e48bf=_0x4994e7;logger[_0xabe4('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5e48bf['id']);return getTicket(_0x1d8bf1,_0x1140ef,_0x5e48bf,_0x4e66f0,_0x11d2ce);})['then'](function(_0x2957c1){if(_0x2957c1){logger['info'](_0xabe4('0x55'),_0x2957c1['id']);switch(_0x1d8bf1[_0xabe4('0x41')]){case _0xabe4('0x56'):logger[_0xabe4('0xb')](_0xabe4('0x57'),_0xabe4('0x58'));return request({'uri':util[_0xabe4('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1d8bf1[_0xabe4('0xe')],_0x1140ef['id'],_0x2957c1['id']),'method':_0xabe4('0xf')});case _0xabe4('0x59'):logger['info'](_0xabe4('0x57'),_0xabe4('0x5a'));emit(util[_0xabe4('0xc')](_0xabe4('0x5b'),_0xfb1c50[_0xabe4('0x12')]),_0xabe4('0x5c'),{'uri':util['format'](_0xabe4('0x5d'),_0x1d8bf1[_0xabe4('0xe')][_0xabe4('0x5e')](_0xabe4('0x5f'),''),_0x2957c1['id'])});break;default:logger[_0xabe4('0x60')](_0xabe4('0x57'),_0xabe4('0x61'));}}})['catch'](function(_0xa4aef7){logger[_0xabe4('0x60')](_0xabe4('0x62'),util[_0xabe4('0x63')](_0xa4aef7,{'showHidden':!![],'depth':null}));});};exports[_0xabe4('0x64')]=function(_0x544f47,_0x5691e5,_0x409394,_0x4e25a4,_0x298bf4,_0x4c2f14,_0x2d0aea){var _0x44fc05,_0x3149ff;_0x4c2f14['remoteUri']=intUtil['stripTrailingSlash'](_0x4c2f14[_0xabe4('0xe')]);_0x4c2f14[_0xabe4('0x4f')]=intUtil[_0xabe4('0x4a')](_0x4c2f14[_0xabe4('0x4f')]);if(_0x2d0aea&&_0x2d0aea['recordingFormat']&&_0x2d0aea[_0xabe4('0x65')]!==_0xabe4('0x66')){logger[_0xabe4('0xb')](_0xabe4('0x67'),_0xabe4('0x4c'));_0x5691e5['recordingURL']=util[_0xabe4('0xc')](_0xabe4('0x4e'),_0x4c2f14[_0xabe4('0x4f')],_0x5691e5[_0xabe4('0x50')],md5(_0x5691e5[_0xabe4('0x50')]));}headers['Authorization']=getAuth(_0x4c2f14);return getUser(_0x4c2f14,_0x4e25a4[_0xabe4('0x68')])['then'](function(_0x2d857e){_0x44fc05=_0x2d857e;logger[_0xabe4('0xb')](_0xabe4('0x52'),_0x44fc05['id']);return getEndUser(_0x4c2f14,_0x5691e5[_0xabe4('0x69')],_0x5691e5[_0xabe4('0x6a')]);})[_0xabe4('0x17')](function(_0x545e36){_0x3149ff=_0x545e36;logger[_0xabe4('0xb')](_0xabe4('0x6b'),_0x3149ff['id']);return getTicket(_0x4c2f14,_0x44fc05,_0x3149ff,_0x409394,_0x5691e5);})[_0xabe4('0x17')](function(_0x2a1dea){if(_0x2a1dea){logger['info'](_0xabe4('0x55'),_0x2a1dea['id']);switch(_0x4c2f14[_0xabe4('0x41')]){case _0xabe4('0x56'):logger['info'](_0xabe4('0x67'),_0xabe4('0x58'));return request({'uri':util[_0xabe4('0xc')](_0xabe4('0x6c'),_0x4c2f14[_0xabe4('0xe')],_0x44fc05['id'],_0x2a1dea['id']),'method':_0xabe4('0xf')});case'newTab':logger[_0xabe4('0xb')](_0xabe4('0x67'),_0xabe4('0x5a'));emit(util[_0xabe4('0xc')]('user:%s',_0x4e25a4[_0xabe4('0x12')]),_0xabe4('0x5c'),{'uri':util[_0xabe4('0xc')](_0xabe4('0x5d'),_0x4c2f14['remoteUri']['replace']('/api/v2',''),_0x2a1dea['id'])});break;default:logger[_0xabe4('0x60')](_0xabe4('0x67'),_0xabe4('0x61'));}}})[_0xabe4('0x6d')](function(_0x46f453){logger[_0xabe4('0x60')](_0xabe4('0x6e'),util['inspect'](_0x46f453,{'showHidden':!![],'depth':null}));});};exports[_0xabe4('0x6f')]=function(_0x1935af,_0x3aaecf,_0x380a13,_0x3cd79c,_0x434c49,_0x25bb6a){var _0x5da6ee,_0x2e5590;_0x25bb6a[_0xabe4('0xe')]=intUtil[_0xabe4('0x4a')](_0x25bb6a[_0xabe4('0xe')]);_0x25bb6a[_0xabe4('0x4f')]=intUtil[_0xabe4('0x4a')](_0x25bb6a[_0xabe4('0x4f')]);if(_0x434c49&&_0x434c49[_0xabe4('0x4b')]){logger[_0xabe4('0xb')]('['+_0x3aaecf[_0xabe4('0x70')][_0xabe4('0x71')]()+']',_0xabe4('0x4c'));_0x3aaecf[_0xabe4('0x4d')]=util[_0xabe4('0xc')](_0xabe4('0x4e'),_0x25bb6a[_0xabe4('0x4f')],_0x3aaecf[_0xabe4('0x50')],md5(_0x3aaecf[_0xabe4('0x50')]));}else{_0x3aaecf[_0xabe4('0x4d')]='';}headers[_0xabe4('0x51')]=getAuth(_0x25bb6a);return getUser(_0x25bb6a)[_0xabe4('0x17')](function(_0x527812){_0x5da6ee=_0x527812;logger['info']('The\x20User\x20ID\x20is:',_0x5da6ee['id']);return getEndUser(_0x25bb6a,_0x3aaecf[_0xabe4('0x53')],_0x3aaecf[_0xabe4('0x54')]);})['then'](function(_0x29a312){_0x2e5590=_0x29a312;logger[_0xabe4('0xb')](_0xabe4('0x6b'),_0x2e5590['id']);return getTicket(_0x25bb6a,_0x5da6ee,_0x2e5590,_0x380a13,_0x3aaecf);})[_0xabe4('0x17')](function(_0xe92cf8){if(_0xe92cf8){logger[_0xabe4('0xb')](_0xabe4('0x55'),_0xe92cf8['id']);}})[_0xabe4('0x6d')](function(_0x1e0536){logger[_0xabe4('0x60')]('['+_0x3aaecf[_0xabe4('0x70')][_0xabe4('0x71')]()+']'+_0xabe4('0x72'),util[_0xabe4('0x63')](_0x1e0536,{'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 6c5bd78..b2ca8fa 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 _0x8f94=['First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','unmanaged','monitor_format','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','redis','localhost','emit','debug','stringify','length','forEach','includes','string','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','Agent\x20found!','profile','user','Administrator','Using\x20the\x20admin\x20account!','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x8f94,0xd7));var _0x48f9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8f94[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x48f9('0x0'));var rp=require(_0x48f9('0x1'));var md5=require(_0x48f9('0x2'));var util=require(_0x48f9('0x3'));var intUtil=require(_0x48f9('0x4'));var moment=require('moment');var Redis=require(_0x48f9('0x5'));var BPromise=require(_0x48f9('0x6'));var config=require('../../../../config/environment');var logger=require(_0x48f9('0x7'))('zoho');config[_0x48f9('0x8')]=_['defaults'](config[_0x48f9('0x8')],{'host':_0x48f9('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x48f9('0x8')]));function emit(_0x28704d,_0x24bc0f,_0x1fde15){io['to'](_0x28704d)[_0x48f9('0xa')](_0x24bc0f,_0x1fde15);}function request(_0x5b0b86){logger[_0x48f9('0xb')]('[HTTP]',JSON[_0x48f9('0xc')](_0x5b0b86));return rp(_0x5b0b86);}function getCustomFields(_0x26345e,_0x2edf0b){var _0x5d9d1b={};if(_0x26345e[_0x48f9('0xd')]>0x0){_[_0x48f9('0xe')](_0x26345e,function(_0x4839ad){if(_[_0x48f9('0xf')]([_0x48f9('0x10'),_0x48f9('0x11')],_0x4839ad['type'])&&_0x4839ad[_0x48f9('0x12')]){_0x5d9d1b[_0x4839ad[_0x48f9('0x12')]]=_0x4839ad['content'][_0x48f9('0x13')]();}else if(_0x4839ad[_0x48f9('0x14')]===_0x48f9('0x15')&&_0x4839ad['variableName']&&_0x4839ad[_0x48f9('0x12')]&&_0x2edf0b[_0x4839ad['variableName']]){_0x5d9d1b[_0x4839ad[_0x48f9('0x12')]]=_0x2edf0b[_0x4839ad[_0x48f9('0x16')]][_0x48f9('0x13')]();}else if(_0x4839ad[_0x48f9('0x14')]===_0x48f9('0x17')&&_0x4839ad[_0x48f9('0x18')]&&_0x4839ad[_0x48f9('0x18')][_0x48f9('0x19')]&&_0x4839ad[_0x48f9('0x12')]&&_0x2edf0b[_0x4839ad['Variable']['name'][_0x48f9('0x1a')]()]){_0x5d9d1b[_0x4839ad[_0x48f9('0x12')]]=_0x2edf0b[_0x4839ad[_0x48f9('0x18')][_0x48f9('0x19')][_0x48f9('0x1a')]()][_0x48f9('0x13')]();}});}return _0x5d9d1b;}function getName(_0x2802a0){if(_0x2802a0[_0x48f9('0x1b')]('\x20')>0x0){var _0x284bc3=_0x2802a0['split'](/ (.+)/);if(_0x284bc3[0x1]){return _0x284bc3;}}return[_0x2802a0,_0x2802a0];}var accountsTokens={};function getAccessToken(_0x1fc14a){return new Promise(function(_0x2591ec,_0x545671){if(!_[_0x48f9('0x1c')](accountsTokens[_0x1fc14a['id']])&&!_[_0x48f9('0x1c')](accountsTokens[_0x1fc14a['id']][_0x48f9('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x1fc14a['id']][_0x48f9('0x1e')])){_0x2591ec(accountsTokens[_0x1fc14a['id']][_0x48f9('0x1d')]);}}var _0x1201e1;switch(_0x1fc14a[_0x48f9('0x1f')]){case'US':_0x1201e1=_0x48f9('0x20');break;case'AU':_0x1201e1=_0x48f9('0x21');break;case'EU':_0x1201e1=_0x48f9('0x22');break;case'IN':_0x1201e1=_0x48f9('0x23');break;case'CN':_0x1201e1=_0x48f9('0x24');break;default:_0x1201e1='https://accounts.zoho.eu';break;}var _0x2a90f2={'method':_0x48f9('0x25'),'uri':_0x1201e1+_0x48f9('0x26'),'qs':{'refresh_token':_0x1fc14a[_0x48f9('0x27')],'client_id':_0x1fc14a[_0x48f9('0x28')],'client_secret':_0x1fc14a[_0x48f9('0x29')],'grant_type':_0x48f9('0x2a')},'json':!![]};return rp(_0x2a90f2)[_0x48f9('0x2b')](function(_0x75c557){accountsTokens[_0x1fc14a['id']]={'access_token':_0x75c557[_0x48f9('0x1d')],'expires_in':moment()['add'](_0x75c557['expires_in'],_0x48f9('0x2c'))};_0x2591ec(_0x75c557[_0x48f9('0x1d')]);})[_0x48f9('0x2d')](function(_0x5b76bd){logger[_0x48f9('0x2e')](_0x48f9('0x2f'),_0x5b76bd[_0x48f9('0x30')]);_0x545671(_0x5b76bd);});});}function getUser(_0x2f6d62,_0x1f6e24,_0x30d436,_0x3e7ad8){logger[_0x48f9('0x31')](_0x48f9('0x32'));return request({'method':_0x48f9('0x33'),'uri':util[_0x48f9('0x34')](_0x48f9('0x35'),_0x1f6e24),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x48f9('0x36')+_0x2f6d62},'json':!![]})[_0x48f9('0x2b')](function(_0x3094e5){if(_0x3094e5['users']){var _0x5df606=-0x1;if(_[_0x48f9('0x37')](_0x3094e5['users'])){if(!_[_0x48f9('0x1c')](_0x3e7ad8)){_0x5df606=_[_0x48f9('0x38')](_0x3094e5[_0x48f9('0x39')],function(_0x18ff02){return _0x18ff02['email']===_0x3e7ad8;});}if(_0x5df606>=0x0){logger['info'](_0x48f9('0x3a'));}else{logger[_0x48f9('0x31')]('Using\x20the\x20admin\x20account!');_0x5df606=_[_0x48f9('0x38')](_0x3094e5[_0x48f9('0x39')],function(_0x1c9d80){return _0x1c9d80[_0x48f9('0x3b')][_0x48f9('0x19')]==='Administrator';});}return _0x3094e5['users'][_0x5df606];}else{if(_0x3094e5[_0x48f9('0x3c')][_0x48f9('0x3b')][_0x48f9('0x19')]===_0x48f9('0x3d')){logger[_0x48f9('0x31')](_0x48f9('0x3e'));user=_0x3094e5[_0x48f9('0x3c')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x3094e5));throw new Error(_0x48f9('0x3f')+JSON['stringify'](_0x3094e5));}}}else{logger[_0x48f9('0x2e')](_0x48f9('0x40'),JSON['stringify'](_0x3094e5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x48f9('0xc')](_0x3094e5));}})['catch'](function(_0x4bdb63){console[_0x48f9('0x2e')](_0x4bdb63);});}function getZohoUser(_0x582bfd,_0x4e08db){return new BPromise(function(_0x219211,_0x4c33ea){request(_0x582bfd)['then'](function(_0x3f1d06){var _0x3ba6af=null;if(_0x3f1d06){_0x3ba6af=_0x3f1d06[_0x48f9('0x41')][0x0];_0x3ba6af[_0x48f9('0x42')]=_0x4e08db;}_0x219211(_0x3ba6af);})[_0x48f9('0x2d')](function(_0x1f96e0){_0x4c33ea(_0x1f96e0);});});}function createEndUser(_0x47b883,_0x244780,_0x14f883,_0x2f9316,_0xa27ca5,_0x5df138){var _0x14f883=getName(_0x14f883);return request({'method':_0x48f9('0x25'),'uri':_0x48f9('0x43')+_0x244780+_0x48f9('0x44')+_['startCase'](_0x5df138[_0x48f9('0x45')])+'s','body':{'data':[{'Last_Name':_0x14f883[0x1],'First_Name':_0x14f883[0x0],'Phone':_0x2f9316,'Owner':{'name':!_[_0x48f9('0x1c')](_0xa27ca5['role'][_0x48f9('0x19')])?_0xa27ca5[_0x48f9('0x46')][_0x48f9('0x19')]:!_[_0x48f9('0x1c')](_0xa27ca5['first_name'])?_0xa27ca5['first_name']+'\x20'+_0xa27ca5[_0x48f9('0x47')]:_0xa27ca5['last_name'],'id':_0xa27ca5['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47b883},'json':!![]})[_0x48f9('0x2b')](function(_0x5161e6){if(_0x5161e6&&_0x5161e6[_0x48f9('0x41')][0x0]['code']===_0x48f9('0x48')){var _0x12b99e=_0x5161e6[_0x48f9('0x41')][0x0][_0x48f9('0x49')];_0x12b99e[_0x48f9('0x42')]=_['startCase'](_0x5df138[_0x48f9('0x45')])+'s';return _0x12b99e;}logger['error'](_0x48f9('0x40'),JSON[_0x48f9('0xc')](data));throw new Error(_0x48f9('0x4a')+JSON[_0x48f9('0xc')](data));})[_0x48f9('0x2d')](function(_0x23ff98){console[_0x48f9('0x4b')](_0x48f9('0x4c'),_0x23ff98);});}function getEndUser(_0x52e8ab,_0x3f587c,_0xad01e6,_0x2eebf8,_0x4ba861,_0x3f938d,_0x1d20de){var _0x81c800={'method':_0x48f9('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x52e8ab},'json':!![]};switch(_0x1d20de[_0x48f9('0x4d')]){case'contact_lead':_0x81c800[_0x48f9('0x4e')]=_0x48f9('0x43')+_0x3f587c+_0x48f9('0x4f')+_0x4ba861+'))';return getZohoUser(_0x81c800,'Contacts')[_0x48f9('0x2b')](function(_0x454af4){if(_0x454af4)return _0x454af4;_0x81c800['uri']=_0x48f9('0x43')+_0x3f587c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4ba861+'))';return getZohoUser(_0x81c800,_0x48f9('0x50'))[_0x48f9('0x2b')](function(_0x22f3fd){if(_0x22f3fd)return _0x22f3fd;if(_0x1d20de['moduleCreate']!=_0x48f9('0x51')){return createEndUser(_0x52e8ab,_0x3f587c,_0x2eebf8,_0x4ba861,_0x3f938d,_0x1d20de);}else{return{};}});});break;case _0x48f9('0x52'):_0x81c800[_0x48f9('0x4e')]=_0x48f9('0x43')+_0x3f587c+_0x48f9('0x4f')+_0x4ba861+'))';return getZohoUser(_0x81c800,_0x48f9('0x53'))[_0x48f9('0x2b')](function(_0x51ea39){if(_0x51ea39)return _0x51ea39;if(_0x1d20de[_0x48f9('0x45')]!=_0x48f9('0x51')){return createEndUser(_0x52e8ab,_0x3f587c,_0x2eebf8,_0x4ba861,_0x3f938d,_0x1d20de);}else{return{};}});break;case'lead':_0x81c800[_0x48f9('0x4e')]='https://www.zohoapis.'+_0x3f587c+_0x48f9('0x54')+_0x4ba861+'))';return getZohoUser(_0x81c800,_0x48f9('0x50'))[_0x48f9('0x2b')](function(_0x35bd3a){if(_0x35bd3a)return _0x35bd3a;if(_0x1d20de[_0x48f9('0x45')]!=_0x48f9('0x51')){return createEndUser(_0x52e8ab,_0x3f587c,_0x2eebf8,_0x4ba861,_0x3f938d,_0x1d20de);}else{return{};}});break;}}function getCall(_0x232acc,_0x3b5862,_0x45ec71,_0x5d345d,_0x387e09,_0x3b64af,_0x271eaa,_0x3b364a){logger[_0x48f9('0x31')](_0x48f9('0x55'));var _0x3e3015={};_0x3e3015[_0x48f9('0x56')]={'name':!_[_0x48f9('0x1c')](_0x5d345d[_0x48f9('0x46')][_0x48f9('0x19')])&&!_[_0x48f9('0x1c')](_0x5d345d[_0x48f9('0x3b')][_0x48f9('0x19')])&&_0x5d345d[_0x48f9('0x3b')][_0x48f9('0x19')]===_0x48f9('0x57')?_0x5d345d[_0x48f9('0x46')][_0x48f9('0x19')]:!_[_0x48f9('0x1c')](_0x5d345d[_0x48f9('0x58')])?_0x5d345d[_0x48f9('0x58')]+'\x20'+_0x5d345d['last_name']:_0x5d345d[_0x48f9('0x47')],'id':_0x5d345d['id']};_0x3e3015[_0x48f9('0x59')]=intUtil[_0x48f9('0x5a')](_0x3b64af[_0x48f9('0x5b')],_0x271eaa,'\x20');_0x3e3015['Description']=intUtil['getString'](_0x3b64af[_0x48f9('0x5c')],_0x271eaa,'\x0a');if(_0x387e09[_0x48f9('0x42')]===_0x48f9('0x53')){_0x3e3015[_0x48f9('0x5d')]={'name':!_[_0x48f9('0x1c')](_0x387e09[_0x48f9('0x5e')])?_0x387e09[_0x48f9('0x5e')]:!_[_0x48f9('0x1c')](_0x387e09[_0x48f9('0x5f')])?_0x387e09[_0x48f9('0x5f')]+'\x20'+_0x387e09['Last_Name']:_0x387e09[_0x48f9('0x60')],'id':_0x387e09['id']};}if(_0x387e09[_0x48f9('0x42')]==='Leads'){_0x3e3015[_0x48f9('0x61')]={'name':!_[_0x48f9('0x1c')](_0x387e09[_0x48f9('0x5e')])?_0x387e09[_0x48f9('0x5e')]:!_[_0x48f9('0x1c')](_0x387e09['First_Name'])?_0x387e09[_0x48f9('0x5f')]+'\x20'+_0x387e09[_0x48f9('0x60')]:_0x387e09[_0x48f9('0x60')],'id':_0x387e09['id']};_0x3e3015[_0x48f9('0x62')]=_['startCase'](_0x387e09[_0x48f9('0x42')]);}if(_0x271eaa[_0x48f9('0x63')]){_0x3e3015[_0x48f9('0x64')]=moment[_0x48f9('0x65')](parseInt(_0x271eaa[_0x48f9('0x63')])*0x3e8)['format'](_0x48f9('0x66'));}else if(_0x271eaa[_0x48f9('0x67')]&&_0x271eaa[_0x48f9('0x68')]){_0x3e3015['Call_Duration']=moment[_0x48f9('0x65')](moment(_0x271eaa['endtime'],_0x48f9('0x69'))[_0x48f9('0x6a')](moment(_0x271eaa[_0x48f9('0x6b')],_0x48f9('0x69'))))['format'](_0x48f9('0x66'));}switch(_0x271eaa[_0x48f9('0x6c')]){case'called':_0x3e3015[_0x48f9('0x6d')]=_0x48f9('0x6e');break;case _0x48f9('0x6f'):case _0x48f9('0x70'):_0x3e3015[_0x48f9('0x6d')]='Answered';break;case _0x48f9('0x71'):_0x3e3015['Call_Result']=_0x48f9('0x72');break;case _0x48f9('0x73'):_0x3e3015['Call_Result']=_0x48f9('0x74');break;case _0x48f9('0x75'):_0x3e3015['Call_Result']='Timeout';default:}_0x3e3015[_0x48f9('0x76')]=(_0x3b364a==='outbound'?moment(_0x271eaa['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x271eaa[_0x48f9('0x77')])[_0x48f9('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x48f9('0x34')]('YYYY-MM-DDTHH:mm:ss');_0x3e3015[_0x48f9('0x78')]=_0x3b364a||_0x48f9('0x79');_0x3e3015=_['merge'](_0x3e3015,getCustomFields(_0x3b64af[_0x48f9('0x7a')],_0x271eaa));return request({'method':'POST','uri':_0x48f9('0x43')+_0x3b5862+'/crm/v2/Calls','headers':{'Authorization':_0x48f9('0x36')+_0x232acc},'body':{'data':[_0x3e3015]},'json':!![]})[_0x48f9('0x2b')](function(_0x3fe3b2){if(_0x3fe3b2&&_0x3fe3b2[_0x48f9('0x41')][0x0]['code']===_0x48f9('0x48')){logger[_0x48f9('0x31')](_0x48f9('0x7b'));return{'id':_0x3fe3b2['data'][0x0]['details']['id']};}})['catch'](function(_0x1cb52a){logger['info']('err',_0x1cb52a[_0x48f9('0x30')]);console[_0x48f9('0x4b')](_0x48f9('0x7c'),_0x1cb52a);});}exports[_0x48f9('0x7d')]=function(_0x1cff9b,_0x4b6bef,_0x5e1278,_0x478674,_0x4349de,_0x2e1540){var _0x52e835,_0xf0a4f9,_0x5283d9;_0x2e1540[_0x48f9('0x7e')]=intUtil[_0x48f9('0x7f')](_0x2e1540[_0x48f9('0x7e')]);_0x2e1540[_0x48f9('0x80')]=intUtil[_0x48f9('0x7f')](_0x2e1540[_0x48f9('0x80')]);if(_0x4349de&&_0x4349de['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4b6bef['recordingURL']=_0x2e1540[_0x48f9('0x80')]+_0x48f9('0x81')+_0x4b6bef[_0x48f9('0x82')]+_0x48f9('0x83')+md5(_0x4b6bef['uniqueid']);}else{_0x4b6bef['recordingURL']='';}var _0xbff956=_0x2e1540[_0x48f9('0x7e')]===_0x48f9('0x84')?'eu':_0x48f9('0x85');return getAccessToken(_0x2e1540)[_0x48f9('0x2b')](function(_0x536190){_0x5283d9=_0x536190;return getUser(_0x5283d9,_0xbff956,_0x2e1540,_0x478674['email']);})[_0x48f9('0x2b')](function(_0x55e1cc){_0x52e835=_0x55e1cc;logger[_0x48f9('0x31')]('The\x20User\x20ID\x20is:',_0x52e835['id']);return getEndUser(_0x5283d9,_0xbff956,_0x2e1540,_0x4b6bef[_0x48f9('0x86')],_0x4b6bef[_0x48f9('0x87')],_0x52e835,_0x5e1278);})[_0x48f9('0x2b')](function(_0x1bb486){_0xf0a4f9=_0x1bb486;return getCall(_0x5283d9,_0xbff956,_0x2e1540,_0x52e835,_0xf0a4f9,_0x5e1278,_0x4b6bef,_0x48f9('0x79'));})['then'](function(_0x2b2f12){if(_0x2b2f12){logger[_0x48f9('0x31')](_0x48f9('0x88'),_0x2b2f12['id']);logger[_0x48f9('0x31')](_0x48f9('0x89'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x48f9('0x34')]('user:%s',_0x478674[_0x48f9('0x19')]),_0x48f9('0x8a'),{'uri':'https://crm.'+_0x2e1540[_0x48f9('0x7e')]+_0x48f9('0x8b')+_0x2b2f12['id']});}})['catch'](function(_0x1fd6a7){logger[_0x48f9('0x2e')](_0x48f9('0x89'),JSON[_0x48f9('0xc')](_0x1fd6a7));});};exports['outbound']=function(_0x5e9481,_0x486579,_0x18fb9b,_0x38e473,_0x221497,_0x163e98,_0x2db652){var _0x4de4ad,_0x4a1ae4,_0x528fd9;_0x163e98['host']=intUtil[_0x48f9('0x7f')](_0x163e98[_0x48f9('0x7e')]);_0x163e98[_0x48f9('0x80')]=intUtil[_0x48f9('0x7f')](_0x163e98[_0x48f9('0x80')]);if(_0x2db652&&_0x2db652['recordingFormat']&&_0x2db652[_0x48f9('0x8c')]!==_0x48f9('0x8d')){logger[_0x48f9('0x31')]('[OUTBOUND]',_0x48f9('0x8e'));_0x486579[_0x48f9('0x8f')]=_0x163e98[_0x48f9('0x80')]+_0x48f9('0x81')+_0x486579['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x486579[_0x48f9('0x82')]);}var _0x25f502=_0x163e98['host']===_0x48f9('0x84')?'eu':_0x48f9('0x85');return getAccessToken(_0x163e98)['then'](function(_0x2f7de1){_0x528fd9=_0x2f7de1;return getUser(_0x528fd9,_0x25f502,_0x163e98,_0x38e473['email']);})[_0x48f9('0x2b')](function(_0x38f679){_0x4de4ad=_0x38f679;logger[_0x48f9('0x31')]('The\x20User\x20ID\x20is:',_0x4de4ad['id']);return getEndUser(_0x528fd9,_0x25f502,_0x163e98,_0x486579[_0x48f9('0x90')],_0x486579[_0x48f9('0x91')],_0x4de4ad,_0x18fb9b);})[_0x48f9('0x2b')](function(_0x2d6a41){_0x4a1ae4=_0x2d6a41;return getCall(_0x528fd9,_0x25f502,_0x163e98,_0x4de4ad,_0x4a1ae4,_0x18fb9b,_0x486579,_0x48f9('0x92'));})[_0x48f9('0x2b')](function(_0x4f294f){if(_0x4f294f){logger[_0x48f9('0x31')](_0x48f9('0x88'),_0x4f294f['id']);logger['info'](_0x48f9('0x93'),_0x48f9('0x94'));emit(util['format'](_0x48f9('0x95'),_0x38e473[_0x48f9('0x19')]),_0x48f9('0x8a'),{'uri':_0x48f9('0x96')+_0x163e98[_0x48f9('0x7e')]+_0x48f9('0x8b')+_0x4f294f['id']});}})[_0x48f9('0x2d')](function(_0x2c1e37){logger[_0x48f9('0x2e')](_0x48f9('0x93'),JSON[_0x48f9('0xc')](_0x2c1e37));});};exports[_0x48f9('0x97')]=function(_0xff610f,_0x31e2b4,_0x119a2e,_0x57f716,_0x5daa9e,_0x13f288){var _0x128ae3,_0x2eb4db,_0x4a9c82;_0x13f288[_0x48f9('0x7e')]=intUtil[_0x48f9('0x7f')](_0x13f288['host']);_0x13f288[_0x48f9('0x80')]=intUtil[_0x48f9('0x7f')](_0x13f288['serverUrl']);if(_0x5daa9e&&_0x5daa9e[_0x48f9('0x98')]){logger['info']('['+_0x31e2b4['lastevent'][_0x48f9('0x99')]()+']','Recording\x20is\x20enabled!');_0x31e2b4[_0x48f9('0x8f')]=_0x13f288[_0x48f9('0x80')]+_0x48f9('0x81')+_0x31e2b4[_0x48f9('0x82')]+_0x48f9('0x83')+md5(_0x31e2b4[_0x48f9('0x82')]);}else{_0x31e2b4[_0x48f9('0x8f')]='';}var _0x5dc6b4=_0x13f288['host']===_0x48f9('0x84')?'eu':_0x48f9('0x85');return getAccessToken(_0x13f288)[_0x48f9('0x2b')](function(_0x3bc1c2){_0x4a9c82=_0x3bc1c2;return getUser(_0x4a9c82,_0x5dc6b4,_0x13f288);})['then'](function(_0x38cd0a){_0x128ae3=_0x38cd0a;logger[_0x48f9('0x31')](_0x48f9('0x9a'),_0x128ae3['id']);return getEndUser(_0x4a9c82,_0x5dc6b4,_0x13f288,_0x31e2b4[_0x48f9('0x86')],_0x31e2b4['calleridnum'],_0x128ae3,_0x119a2e);})[_0x48f9('0x2b')](function(_0x34d786){_0x2eb4db=_0x34d786;return getCall(_0x4a9c82,_0x5dc6b4,_0x13f288,_0x128ae3,_0x2eb4db,_0x119a2e,_0x31e2b4,_0x48f9('0x79'));})[_0x48f9('0x2b')](function(_0x290be8){if(_0x290be8){logger[_0x48f9('0x31')](_0x48f9('0x88'),_0x290be8['id']);}})[_0x48f9('0x2d')](function(_0x46bd93){logger[_0x48f9('0x2e')]('['+_0x31e2b4[_0x48f9('0x6c')][_0x48f9('0x99')]()+']',JSON['stringify'](_0x46bd93));});}; \ No newline at end of file +var _0x53d0=['Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','Error:\x20','catch','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Timeout','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','recordingURL','/api/voice/recordings/','destcalleridname','Outbound','[OUTBOUND]','toUpperCase','request-promise','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds'];(function(_0x3a9a0a,_0x2b53e9){var _0x473b8d=function(_0x518e67){while(--_0x518e67){_0x3a9a0a['push'](_0x3a9a0a['shift']());}};_0x473b8d(++_0x2b53e9);}(_0x53d0,0x6c));var _0x053d=function(_0x1dddda,_0x5946f4){_0x1dddda=_0x1dddda-0x0;var _0x5311a3=_0x53d0[_0x1dddda];return _0x5311a3;};'use strict';var _=require('lodash');var rp=require(_0x053d('0x0'));var md5=require(_0x053d('0x1'));var util=require('util');var intUtil=require(_0x053d('0x2'));var moment=require('moment');var Redis=require(_0x053d('0x3'));var BPromise=require(_0x053d('0x4'));var config=require(_0x053d('0x5'));var logger=require(_0x053d('0x6'))(_0x053d('0x7'));config[_0x053d('0x8')]=_['defaults'](config['redis'],{'host':_0x053d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4484be,_0x236113,_0x4b8758){io['to'](_0x4484be)['emit'](_0x236113,_0x4b8758);}function request(_0x60994c){logger[_0x053d('0xa')](_0x053d('0xb'),JSON[_0x053d('0xc')](_0x60994c));return rp(_0x60994c);}function getCustomFields(_0x104b81,_0x2fcab6){var _0xe51676={};if(_0x104b81[_0x053d('0xd')]>0x0){_[_0x053d('0xe')](_0x104b81,function(_0x415b73){if(_[_0x053d('0xf')]([_0x053d('0x10'),_0x053d('0x11')],_0x415b73[_0x053d('0x12')])&&_0x415b73[_0x053d('0x13')]){_0xe51676[_0x415b73['idField']]=_0x415b73[_0x053d('0x14')][_0x053d('0x15')]();}else if(_0x415b73[_0x053d('0x12')]==='variable'&&_0x415b73[_0x053d('0x16')]&&_0x415b73[_0x053d('0x13')]&&_0x2fcab6[_0x415b73[_0x053d('0x16')]]){_0xe51676[_0x415b73[_0x053d('0x13')]]=_0x2fcab6[_0x415b73['variableName']][_0x053d('0x15')]();}else if(_0x415b73[_0x053d('0x12')]===_0x053d('0x17')&&_0x415b73[_0x053d('0x18')]&&_0x415b73['Variable'][_0x053d('0x19')]&&_0x415b73[_0x053d('0x13')]&&_0x2fcab6[_0x415b73[_0x053d('0x18')][_0x053d('0x19')][_0x053d('0x1a')]()]){_0xe51676[_0x415b73[_0x053d('0x13')]]=_0x2fcab6[_0x415b73[_0x053d('0x18')][_0x053d('0x19')][_0x053d('0x1a')]()]['toString']();}});}return _0xe51676;}function getName(_0x539d4d){if(_0x539d4d[_0x053d('0x1b')]('\x20')>0x0){var _0x29c8fa=_0x539d4d['split'](/ (.+)/);if(_0x29c8fa[0x1]){return _0x29c8fa;}}return[_0x539d4d,_0x539d4d];}var accountsTokens={};function getAccessToken(_0x2c3d40){return new Promise(function(_0x67bc8f,_0x4abccc){if(!_[_0x053d('0x1c')](accountsTokens[_0x2c3d40['id']])&&!_[_0x053d('0x1c')](accountsTokens[_0x2c3d40['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2c3d40['id']]['expires_in'])){_0x67bc8f(accountsTokens[_0x2c3d40['id']][_0x053d('0x1d')]);}}var _0x42d84b;switch(_0x2c3d40['zone']){case'US':_0x42d84b='https://accounts.zoho.com';break;case'AU':_0x42d84b=_0x053d('0x1e');break;case'EU':_0x42d84b=_0x053d('0x1f');break;case'IN':_0x42d84b=_0x053d('0x20');break;case'CN':_0x42d84b=_0x053d('0x21');break;default:_0x42d84b=_0x053d('0x1f');break;}var _0x5657e3={'method':'POST','uri':_0x42d84b+_0x053d('0x22'),'qs':{'refresh_token':_0x2c3d40['refreshToken'],'client_id':_0x2c3d40[_0x053d('0x23')],'client_secret':_0x2c3d40[_0x053d('0x24')],'grant_type':_0x053d('0x25')},'json':!![]};return rp(_0x5657e3)[_0x053d('0x26')](function(_0x28475d){accountsTokens[_0x2c3d40['id']]={'access_token':_0x28475d[_0x053d('0x1d')],'expires_in':moment()[_0x053d('0x27')](_0x28475d['expires_in'],_0x053d('0x28'))};_0x67bc8f(_0x28475d[_0x053d('0x1d')]);})['catch'](function(_0x50c287){logger['error'](_0x053d('0x29'),_0x50c287[_0x053d('0x2a')]);_0x4abccc(_0x50c287);});});}function getUser(_0x269929,_0x4013e7,_0x5cc41b,_0x221b96){logger['info'](_0x053d('0x2b'));return request({'method':_0x053d('0x2c'),'uri':util[_0x053d('0x2d')](_0x053d('0x2e'),_0x4013e7),'qs':{'type':_0x053d('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x269929},'json':!![]})[_0x053d('0x26')](function(_0x452b22){if(_0x452b22[_0x053d('0x30')]){var _0x1f4156=-0x1;if(_[_0x053d('0x31')](_0x452b22[_0x053d('0x30')])){if(!_[_0x053d('0x1c')](_0x221b96)){_0x1f4156=_[_0x053d('0x32')](_0x452b22[_0x053d('0x30')],function(_0x163181){return _0x163181['email']===_0x221b96;});}if(_0x1f4156>=0x0){logger['info'](_0x053d('0x33'));}else{logger[_0x053d('0x34')](_0x053d('0x35'));_0x1f4156=_[_0x053d('0x32')](_0x452b22[_0x053d('0x30')],function(_0xf1cf50){return _0xf1cf50[_0x053d('0x36')][_0x053d('0x19')]===_0x053d('0x37');});}return _0x452b22[_0x053d('0x30')][_0x1f4156];}else{if(_0x452b22[_0x053d('0x38')][_0x053d('0x36')][_0x053d('0x19')]===_0x053d('0x37')){logger[_0x053d('0x34')](_0x053d('0x35'));user=_0x452b22[_0x053d('0x38')];return user;}else{logger[_0x053d('0x39')](_0x053d('0x3a'),JSON[_0x053d('0xc')](_0x452b22));throw new Error(_0x053d('0x3b')+JSON[_0x053d('0xc')](_0x452b22));}}}else{logger[_0x053d('0x39')](_0x053d('0x3a'),JSON[_0x053d('0xc')](_0x452b22));throw new Error(_0x053d('0x3b')+JSON[_0x053d('0xc')](_0x452b22));}})['catch'](function(_0x12b348){console[_0x053d('0x39')](_0x12b348);});}function getZohoUser(_0x14db67,_0x2040cc){return new BPromise(function(_0x1813af,_0x11a538){request(_0x14db67)[_0x053d('0x26')](function(_0x21ae64){var _0x3c0cf5=null;if(_0x21ae64){_0x3c0cf5=_0x21ae64[_0x053d('0x3c')][0x0];_0x3c0cf5[_0x053d('0x3d')]=_0x2040cc;}_0x1813af(_0x3c0cf5);})['catch'](function(_0x180b8b){_0x11a538(_0x180b8b);});});}function createEndUser(_0xb54b73,_0x4c970f,_0x3668d9,_0x595273,_0x35bc34,_0x5306d1){var _0x3668d9=getName(_0x3668d9);return request({'method':_0x053d('0x3e'),'uri':_0x053d('0x3f')+_0x4c970f+_0x053d('0x40')+_[_0x053d('0x41')](_0x5306d1[_0x053d('0x42')])+'s','body':{'data':[{'Last_Name':_0x3668d9[0x1],'First_Name':_0x3668d9[0x0],'Phone':_0x595273,'Owner':{'name':!_[_0x053d('0x1c')](_0x35bc34[_0x053d('0x43')][_0x053d('0x19')])?_0x35bc34[_0x053d('0x43')][_0x053d('0x19')]:!_[_0x053d('0x1c')](_0x35bc34['first_name'])?_0x35bc34[_0x053d('0x44')]+'\x20'+_0x35bc34['last_name']:_0x35bc34[_0x053d('0x45')],'id':_0x35bc34['id']}}]},'headers':{'Authorization':_0x053d('0x46')+_0xb54b73},'json':!![]})['then'](function(_0x162c42){if(_0x162c42&&_0x162c42['data'][0x0][_0x053d('0x47')]===_0x053d('0x48')){var _0xc30a2e=_0x162c42[_0x053d('0x3c')][0x0]['details'];_0xc30a2e[_0x053d('0x3d')]=_['startCase'](_0x5306d1[_0x053d('0x42')])+'s';return _0xc30a2e;}logger[_0x053d('0x39')](_0x053d('0x3a'),JSON[_0x053d('0xc')](data));throw new Error(_0x053d('0x49')+JSON[_0x053d('0xc')](data));})[_0x053d('0x4a')](function(_0x5ae8e4){console[_0x053d('0x4b')]('CREATE\x20ERROR',_0x5ae8e4);});}function getEndUser(_0x3b2f51,_0x5707a6,_0x4c3fdb,_0x1c366d,_0x2f242,_0xb726fc,_0x3e55be){var _0x4306c9={'method':_0x053d('0x2c'),'uri':'','headers':{'Authorization':_0x053d('0x46')+_0x3b2f51},'json':!![]};switch(_0x3e55be[_0x053d('0x4c')]){case'contact_lead':_0x4306c9[_0x053d('0x4d')]='https://www.zohoapis.'+_0x5707a6+_0x053d('0x4e')+_0x2f242+'))';return getZohoUser(_0x4306c9,_0x053d('0x4f'))[_0x053d('0x26')](function(_0x195d81){if(_0x195d81)return _0x195d81;_0x4306c9[_0x053d('0x4d')]='https://www.zohoapis.'+_0x5707a6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2f242+'))';return getZohoUser(_0x4306c9,_0x053d('0x50'))[_0x053d('0x26')](function(_0x2fc5da){if(_0x2fc5da)return _0x2fc5da;if(_0x3e55be[_0x053d('0x42')]!=_0x053d('0x51')){return createEndUser(_0x3b2f51,_0x5707a6,_0x1c366d,_0x2f242,_0xb726fc,_0x3e55be);}else{return{};}});});break;case _0x053d('0x52'):_0x4306c9['uri']=_0x053d('0x3f')+_0x5707a6+_0x053d('0x4e')+_0x2f242+'))';return getZohoUser(_0x4306c9,_0x053d('0x4f'))[_0x053d('0x26')](function(_0x3442cc){if(_0x3442cc)return _0x3442cc;if(_0x3e55be['moduleCreate']!='nothing'){return createEndUser(_0x3b2f51,_0x5707a6,_0x1c366d,_0x2f242,_0xb726fc,_0x3e55be);}else{return{};}});break;case _0x053d('0x53'):_0x4306c9['uri']='https://www.zohoapis.'+_0x5707a6+_0x053d('0x54')+_0x2f242+'))';return getZohoUser(_0x4306c9,_0x053d('0x50'))['then'](function(_0x2c70cf){if(_0x2c70cf)return _0x2c70cf;if(_0x3e55be[_0x053d('0x42')]!='nothing'){return createEndUser(_0x3b2f51,_0x5707a6,_0x1c366d,_0x2f242,_0xb726fc,_0x3e55be);}else{return{};}});break;}}function getCall(_0xbae551,_0x3da159,_0x24ed21,_0x8c5682,_0x4425f8,_0x4a490c,_0x40f04b,_0xe8ba76){logger[_0x053d('0x34')](_0x053d('0x55'));var _0x5ada26={};_0x5ada26[_0x053d('0x56')]={'name':!_[_0x053d('0x1c')](_0x8c5682[_0x053d('0x43')][_0x053d('0x19')])&&!_[_0x053d('0x1c')](_0x8c5682['profile'][_0x053d('0x19')])&&_0x8c5682[_0x053d('0x36')]['name']==='administrator'?_0x8c5682[_0x053d('0x43')][_0x053d('0x19')]:!_[_0x053d('0x1c')](_0x8c5682[_0x053d('0x44')])?_0x8c5682[_0x053d('0x44')]+'\x20'+_0x8c5682[_0x053d('0x45')]:_0x8c5682['last_name'],'id':_0x8c5682['id']};_0x5ada26[_0x053d('0x57')]=intUtil[_0x053d('0x58')](_0x4a490c[_0x053d('0x59')],_0x40f04b,'\x20');_0x5ada26['Description']=intUtil['getString'](_0x4a490c[_0x053d('0x5a')],_0x40f04b,'\x0a');if(_0x4425f8[_0x053d('0x3d')]==='Contacts'){_0x5ada26['Who_Id']={'name':!_['isNil'](_0x4425f8[_0x053d('0x5b')])?_0x4425f8[_0x053d('0x5b')]:!_['isNil'](_0x4425f8[_0x053d('0x5c')])?_0x4425f8[_0x053d('0x5c')]+'\x20'+_0x4425f8[_0x053d('0x5d')]:_0x4425f8['Last_Name'],'id':_0x4425f8['id']};}if(_0x4425f8['enduserType']===_0x053d('0x50')){_0x5ada26[_0x053d('0x5e')]={'name':!_[_0x053d('0x1c')](_0x4425f8['Full_Name'])?_0x4425f8[_0x053d('0x5b')]:!_[_0x053d('0x1c')](_0x4425f8['First_Name'])?_0x4425f8['First_Name']+'\x20'+_0x4425f8[_0x053d('0x5d')]:_0x4425f8[_0x053d('0x5d')],'id':_0x4425f8['id']};_0x5ada26[_0x053d('0x5f')]=_['startCase'](_0x4425f8[_0x053d('0x3d')]);}if(_0x40f04b[_0x053d('0x60')]){_0x5ada26['Call_Duration']=moment[_0x053d('0x61')](parseInt(_0x40f04b[_0x053d('0x60')])*0x3e8)[_0x053d('0x2d')]('mm:ss');}else if(_0x40f04b[_0x053d('0x62')]&&_0x40f04b[_0x053d('0x63')]){_0x5ada26['Call_Duration']=moment[_0x053d('0x61')](moment(_0x40f04b[_0x053d('0x63')],_0x053d('0x64'))[_0x053d('0x65')](moment(_0x40f04b[_0x053d('0x66')],_0x053d('0x64'))))['format'](_0x053d('0x67'));}switch(_0x40f04b[_0x053d('0x68')]){case _0x053d('0x69'):_0x5ada26[_0x053d('0x6a')]=_0x053d('0x6b');break;case _0x053d('0x6c'):case _0x053d('0x6d'):_0x5ada26['Call_Result']=_0x053d('0x6e');break;case _0x053d('0x6f'):_0x5ada26[_0x053d('0x6a')]=_0x053d('0x70');break;case'abandoned':_0x5ada26[_0x053d('0x6a')]='Abandoned';break;case'timeout':_0x5ada26[_0x053d('0x6a')]=_0x053d('0x71');default:}_0x5ada26['Call_Start_Time']=(_0xe8ba76===_0x053d('0x72')?moment(_0x40f04b[_0x053d('0x66')])[_0x053d('0x2d')](_0x053d('0x64')):moment(_0x40f04b['agentcalledAt'])[_0x053d('0x2d')](_0x053d('0x64')))||moment()[_0x053d('0x2d')]('YYYY-MM-DDTHH:mm:ss');_0x5ada26[_0x053d('0x73')]=_0xe8ba76||_0x053d('0x74');_0x5ada26=_[_0x053d('0x75')](_0x5ada26,getCustomFields(_0x4a490c[_0x053d('0x76')],_0x40f04b));return request({'method':_0x053d('0x3e'),'uri':_0x053d('0x3f')+_0x3da159+_0x053d('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xbae551},'body':{'data':[_0x5ada26]},'json':!![]})['then'](function(_0x53bb46){if(_0x53bb46&&_0x53bb46[_0x053d('0x3c')][0x0]['code']===_0x053d('0x48')){logger[_0x053d('0x34')](_0x053d('0x78'));return{'id':_0x53bb46[_0x053d('0x3c')][0x0][_0x053d('0x79')]['id']};}})[_0x053d('0x4a')](function(_0x398937){logger[_0x053d('0x34')](_0x053d('0x7a'),_0x398937['stack']);console[_0x053d('0x4b')](_0x053d('0x7a'),_0x398937);});}exports['queue']=function(_0x5b3838,_0x36ee24,_0x361b34,_0x5d8009,_0x155286,_0x2ae738){var _0xdc54a2,_0x3d57a6,_0x3057c4;_0x2ae738[_0x053d('0x7b')]=intUtil[_0x053d('0x7c')](_0x2ae738[_0x053d('0x7b')]);_0x2ae738[_0x053d('0x7d')]=intUtil[_0x053d('0x7c')](_0x2ae738[_0x053d('0x7d')]);if(_0x155286&&_0x155286[_0x053d('0x7e')]){logger[_0x053d('0x34')](_0x053d('0x7f'),_0x053d('0x80'));_0x36ee24['recordingURL']=_0x2ae738[_0x053d('0x7d')]+'/api/voice/recordings/'+_0x36ee24[_0x053d('0x81')]+_0x053d('0x82')+md5(_0x36ee24[_0x053d('0x81')]);}else{_0x36ee24['recordingURL']='';}var _0x390fee=_0x2ae738[_0x053d('0x7b')]===_0x053d('0x83')?'eu':_0x053d('0x84');return getAccessToken(_0x2ae738)[_0x053d('0x26')](function(_0x246c4f){_0x3057c4=_0x246c4f;return getUser(_0x3057c4,_0x390fee,_0x2ae738,_0x5d8009[_0x053d('0x85')]);})[_0x053d('0x26')](function(_0x45bf3d){_0xdc54a2=_0x45bf3d;logger['info'](_0x053d('0x86'),_0xdc54a2['id']);return getEndUser(_0x3057c4,_0x390fee,_0x2ae738,_0x36ee24[_0x053d('0x87')],_0x36ee24[_0x053d('0x88')],_0xdc54a2,_0x361b34);})[_0x053d('0x26')](function(_0x30ff6b){_0x3d57a6=_0x30ff6b;return getCall(_0x3057c4,_0x390fee,_0x2ae738,_0xdc54a2,_0x3d57a6,_0x361b34,_0x36ee24,_0x053d('0x74'));})['then'](function(_0x196060){if(_0x196060){logger[_0x053d('0x34')](_0x053d('0x89'),_0x196060['id']);logger[_0x053d('0x34')]('[QUEUE]',_0x053d('0x8a'));emit(util['format'](_0x053d('0x8b'),_0x5d8009[_0x053d('0x19')]),'trigger:browser:url',{'uri':_0x053d('0x8c')+_0x2ae738[_0x053d('0x7b')]+_0x053d('0x8d')+_0x196060['id']});}})[_0x053d('0x4a')](function(_0x28b4a7){logger[_0x053d('0x39')](_0x053d('0x7f'),JSON[_0x053d('0xc')](_0x28b4a7));});};exports[_0x053d('0x72')]=function(_0x102a33,_0x20b1be,_0x49a0e2,_0x15bdd3,_0x2bce7b,_0x105ca5,_0x5b2155){var _0x17a00c,_0x2b867a,_0xde56d7;_0x105ca5[_0x053d('0x7b')]=intUtil[_0x053d('0x7c')](_0x105ca5[_0x053d('0x7b')]);_0x105ca5[_0x053d('0x7d')]=intUtil[_0x053d('0x7c')](_0x105ca5['serverUrl']);if(_0x5b2155&&_0x5b2155[_0x053d('0x8e')]&&_0x5b2155['recordingFormat']!=='none'){logger[_0x053d('0x34')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x20b1be[_0x053d('0x8f')]=_0x105ca5[_0x053d('0x7d')]+_0x053d('0x90')+_0x20b1be[_0x053d('0x81')]+_0x053d('0x82')+md5(_0x20b1be['uniqueid']);}var _0x2ca38c=_0x105ca5[_0x053d('0x7b')]===_0x053d('0x83')?'eu':_0x053d('0x84');return getAccessToken(_0x105ca5)[_0x053d('0x26')](function(_0x24d860){_0xde56d7=_0x24d860;return getUser(_0xde56d7,_0x2ca38c,_0x105ca5,_0x15bdd3[_0x053d('0x85')]);})[_0x053d('0x26')](function(_0xae3f14){_0x17a00c=_0xae3f14;logger[_0x053d('0x34')](_0x053d('0x86'),_0x17a00c['id']);return getEndUser(_0xde56d7,_0x2ca38c,_0x105ca5,_0x20b1be[_0x053d('0x91')],_0x20b1be['destcalleridnum'],_0x17a00c,_0x49a0e2);})[_0x053d('0x26')](function(_0x446c5e){_0x2b867a=_0x446c5e;return getCall(_0xde56d7,_0x2ca38c,_0x105ca5,_0x17a00c,_0x2b867a,_0x49a0e2,_0x20b1be,_0x053d('0x92'));})[_0x053d('0x26')](function(_0x1da6c3){if(_0x1da6c3){logger['info'](_0x053d('0x89'),_0x1da6c3['id']);logger[_0x053d('0x34')](_0x053d('0x93'),_0x053d('0x8a'));emit(util[_0x053d('0x2d')](_0x053d('0x8b'),_0x15bdd3[_0x053d('0x19')]),'trigger:browser:url',{'uri':_0x053d('0x8c')+_0x105ca5[_0x053d('0x7b')]+_0x053d('0x8d')+_0x1da6c3['id']});}})[_0x053d('0x4a')](function(_0x172bc9){logger['error']('[OUTBOUND]',JSON['stringify'](_0x172bc9));});};exports['unmanaged']=function(_0x5c35d5,_0x19d228,_0x1927d1,_0x17bc14,_0x14cc7c,_0x1f6017){var _0x5cddb2,_0x1d834d,_0x53774f;_0x1f6017[_0x053d('0x7b')]=intUtil[_0x053d('0x7c')](_0x1f6017['host']);_0x1f6017[_0x053d('0x7d')]=intUtil['stripTrailingSlash'](_0x1f6017[_0x053d('0x7d')]);if(_0x14cc7c&&_0x14cc7c[_0x053d('0x7e')]){logger[_0x053d('0x34')]('['+_0x19d228[_0x053d('0x68')][_0x053d('0x94')]()+']','Recording\x20is\x20enabled!');_0x19d228['recordingURL']=_0x1f6017[_0x053d('0x7d')]+_0x053d('0x90')+_0x19d228[_0x053d('0x81')]+_0x053d('0x82')+md5(_0x19d228[_0x053d('0x81')]);}else{_0x19d228[_0x053d('0x8f')]='';}var _0x4fcb8c=_0x1f6017[_0x053d('0x7b')]==='zoho.eu'?'eu':_0x053d('0x84');return getAccessToken(_0x1f6017)['then'](function(_0x3854ff){_0x53774f=_0x3854ff;return getUser(_0x53774f,_0x4fcb8c,_0x1f6017);})['then'](function(_0x321249){_0x5cddb2=_0x321249;logger[_0x053d('0x34')](_0x053d('0x86'),_0x5cddb2['id']);return getEndUser(_0x53774f,_0x4fcb8c,_0x1f6017,_0x19d228[_0x053d('0x87')],_0x19d228[_0x053d('0x88')],_0x5cddb2,_0x1927d1);})[_0x053d('0x26')](function(_0x5aa7c4){_0x1d834d=_0x5aa7c4;return getCall(_0x53774f,_0x4fcb8c,_0x1f6017,_0x5cddb2,_0x1d834d,_0x1927d1,_0x19d228,'Inbound');})[_0x053d('0x26')](function(_0x2aafd4){if(_0x2aafd4){logger[_0x053d('0x34')](_0x053d('0x89'),_0x2aafd4['id']);}})[_0x053d('0x4a')](function(_0x4754fb){logger['error']('['+_0x19d228[_0x053d('0x68')][_0x053d('0x94')]()+']',JSON[_0x053d('0xc')](_0x4754fb));});}; \ 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 35ea408..646ece2 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 _0xb6c8=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','util','shelljs'];(function(_0x544685,_0x31e2de){var _0x3433a0=function(_0x5b129d){while(--_0x5b129d){_0x544685['push'](_0x544685['shift']());}};_0x3433a0(++_0x31e2de);}(_0xb6c8,0x1ea));var _0x8b6c=function(_0x2ebbed,_0x4fd78a){_0x2ebbed=_0x2ebbed-0x0;var _0xa56196=_0xb6c8[_0x2ebbed];return _0xa56196;};'use strict';var util=require(_0x8b6c('0x0'));var sh=require(_0x8b6c('0x1'));var Mustache=require(_0x8b6c('0x2'));var logger=require(_0x8b6c('0x3'))(_0x8b6c('0x4'));exports[_0x8b6c('0x5')]=function(_0x172ff0,_0x567042){var _0x2b8886=_0x172ff0[_0x8b6c('0x6')]?_0x172ff0[_0x8b6c('0x6')]:_0x8b6c('0x7');var _0x263efc=_0x172ff0[_0x8b6c('0x8')]?Mustache[_0x8b6c('0x9')](_0x172ff0[_0x8b6c('0x8')],_0x567042):_0x567042;sh[_0x8b6c('0x5')](_0x263efc,function(_0x63f978,_0x5f2446,_0x18b006){if(_0x63f978!==0x0){logger[_0x8b6c('0xa')](util[_0x8b6c('0xb')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2b8886,_0x263efc,_0x63f978,_0x18b006));}else{logger['info'](util[_0x8b6c('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2b8886,_0x263efc,_0x5f2446));}});}; \ No newline at end of file +var _0xe581=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x1958ea,_0x365704){var _0x2e707f=function(_0x57ab41){while(--_0x57ab41){_0x1958ea['push'](_0x1958ea['shift']());}};_0x2e707f(++_0x365704);}(_0xe581,0xc5));var _0x1e58=function(_0x4709dc,_0x7cf466){_0x4709dc=_0x4709dc-0x0;var _0x1cedc3=_0xe581[_0x4709dc];return _0x1cedc3;};'use strict';var util=require('util');var sh=require(_0x1e58('0x0'));var Mustache=require('mustache');var logger=require(_0x1e58('0x1'))(_0x1e58('0x2'));exports[_0x1e58('0x3')]=function(_0x1b48e6,_0x24ff1f){var _0x298624=_0x1b48e6[_0x1e58('0x4')]?_0x1b48e6['data2']:_0x1e58('0x5');var _0x4e9d7f=_0x1b48e6[_0x1e58('0x6')]?Mustache[_0x1e58('0x7')](_0x1b48e6[_0x1e58('0x6')],_0x24ff1f):_0x24ff1f;sh[_0x1e58('0x3')](_0x4e9d7f,function(_0x1d62b0,_0x4f0bc4,_0x225efa){if(_0x1d62b0!==0x0){logger[_0x1e58('0x8')](util['format'](_0x1e58('0x9'),_0x298624,_0x4e9d7f,_0x1d62b0,_0x225efa));}else{logger[_0x1e58('0xa')](util[_0x1e58('0xb')](_0x1e58('0xc'),_0x298624,_0x4e9d7f,_0x4f0bc4));}});}; \ 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 49bfad8..38985ad 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 _0x64af=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','%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','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','headers','data6','error','stack','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format'];(function(_0x25f334,_0x44aab9){var _0x11fb6e=function(_0x15a527){while(--_0x15a527){_0x25f334['push'](_0x25f334['shift']());}};_0x11fb6e(++_0x44aab9);}(_0x64af,0x6e));var _0xf64a=function(_0x1889d2,_0x340dfc){_0x1889d2=_0x1889d2-0x0;var _0x43d542=_0x64af[_0x1889d2];return _0x43d542;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xf64a('0x0'));var Mustache=require(_0xf64a('0x1'));var logger=require(_0xf64a('0x2'))('trigger');exports[_0xf64a('0x3')]=function(_0x3a5337,_0x42e525){var _0x1199ff,_0x454413;var _0x12c225={'method':_0x3a5337[_0xf64a('0x4')][_0xf64a('0x5')](),'uri':Mustache[_0xf64a('0x6')](_0x3a5337[_0xf64a('0x7')],_0x42e525),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3a5337[_0xf64a('0x8')])==='number'&&parseInt(_0x3a5337[_0xf64a('0x8')])>=0x1&&parseInt(_0x3a5337['data5'])<=0xa?parseInt(_0x3a5337[_0xf64a('0x8')])*0x3e8:0x5*0x3e8};try{_0x12c225[_0xf64a('0x9')]=_0x3a5337[_0xf64a('0xa')]?JSON['parse'](Mustache[_0xf64a('0x6')](_0x3a5337['data6'],_0x42e525)):{};}catch(_0x366c58){logger[_0xf64a('0xb')](_0x366c58[_0xf64a('0xc')]);}switch(_0x3a5337['data1']['toUpperCase']()){case _0xf64a('0xd'):case _0xf64a('0xe'):_0x1199ff=null;_0x12c225['qs']=_0x42e525;break;case _0xf64a('0xf'):case _0xf64a('0x10'):if(_0x3a5337[_0xf64a('0x11')]){try{_0x1199ff=JSON['parse'](Mustache['render'](_0x3a5337['data7'],_0x42e525));_0x12c225['body']=_0x1199ff;}catch(_0x6c668a){logger['error'](_0x6c668a['stack']);logger['error'](_0xf64a('0x12'));}}else{_0x1199ff=_0x42e525;_0x12c225[_0xf64a('0x13')]=_0x1199ff;}break;}logger[_0xf64a('0x14')](util[_0xf64a('0x15')](_0xf64a('0x16'),_0x3a5337['data1'],_0x3a5337['data2'],JSON[_0xf64a('0x17')](_0x12c225)));rp(_0x12c225)['then'](function(_0x4ba0cc){_0x1199ff=!_[_0xf64a('0x18')](_0x1199ff)?_0xf64a('0x19')+_0x1199ff:'';_0x454413=typeof _0x4ba0cc[_0xf64a('0x13')]===_0xf64a('0x1a')?JSON[_0xf64a('0x17')](_0x4ba0cc['body']):_0x4ba0cc[_0xf64a('0x13')];logger['info'](util[_0xf64a('0x15')](_0xf64a('0x1b'),_0x3a5337['data1'],_0x3a5337[_0xf64a('0x7')],_0x4ba0cc[_0xf64a('0x1c')],_0x454413));})[_0xf64a('0x1d')](function(_0x250124){logger[_0xf64a('0xb')](util[_0xf64a('0x15')](_0xf64a('0x1e'),_0x3a5337[_0xf64a('0x4')],_0x3a5337[_0xf64a('0x7')],_0x250124[_0xf64a('0x1c')],_0x250124[_0xf64a('0x1f')],_0x250124[_0xf64a('0x20')]));});}; \ No newline at end of file +var _0x5fc6=['number','data5','headers','data6','parse','error','stack','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','statusCode','catch','name','message','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render'];(function(_0x19cceb,_0x11de4d){var _0x190121=function(_0x55593d){while(--_0x55593d){_0x19cceb['push'](_0x19cceb['shift']());}};_0x190121(++_0x11de4d);}(_0x5fc6,0x12f));var _0x65fc=function(_0x893fb5,_0x3072a2){_0x893fb5=_0x893fb5-0x0;var _0x12f70e=_0x5fc6[_0x893fb5];return _0x12f70e;};'use strict';var rp=require('request-promise');var util=require(_0x65fc('0x0'));var _=require(_0x65fc('0x1'));var Mustache=require('mustache');var logger=require(_0x65fc('0x2'))('trigger');exports[_0x65fc('0x3')]=function(_0x39486b,_0x5c20bc){var _0x26bf18,_0x4f5abf;var _0x38896e={'method':_0x39486b[_0x65fc('0x4')][_0x65fc('0x5')](),'uri':Mustache[_0x65fc('0x6')](_0x39486b['data2'],_0x5c20bc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x39486b['data5'])===_0x65fc('0x7')&&parseInt(_0x39486b['data5'])>=0x1&&parseInt(_0x39486b[_0x65fc('0x8')])<=0xa?parseInt(_0x39486b['data5'])*0x3e8:0x5*0x3e8};try{_0x38896e[_0x65fc('0x9')]=_0x39486b[_0x65fc('0xa')]?JSON[_0x65fc('0xb')](Mustache[_0x65fc('0x6')](_0x39486b[_0x65fc('0xa')],_0x5c20bc)):{};}catch(_0x429730){logger[_0x65fc('0xc')](_0x429730[_0x65fc('0xd')]);}switch(_0x39486b[_0x65fc('0x4')][_0x65fc('0x5')]()){case _0x65fc('0xe'):case'DELETE':_0x26bf18=null;_0x38896e['qs']=_0x5c20bc;break;case _0x65fc('0xf'):case _0x65fc('0x10'):if(_0x39486b['data7']){try{_0x26bf18=JSON[_0x65fc('0xb')](Mustache[_0x65fc('0x6')](_0x39486b[_0x65fc('0x11')],_0x5c20bc));_0x38896e[_0x65fc('0x12')]=_0x26bf18;}catch(_0x2866e8){logger['error'](_0x2866e8[_0x65fc('0xd')]);logger['error'](_0x65fc('0x13'));}}else{_0x26bf18=_0x5c20bc;_0x38896e[_0x65fc('0x12')]=_0x26bf18;}break;}logger[_0x65fc('0x14')](util[_0x65fc('0x15')](_0x65fc('0x16'),_0x39486b['data1'],_0x39486b['data2'],JSON[_0x65fc('0x17')](_0x38896e)));rp(_0x38896e)['then'](function(_0x439727){_0x26bf18=!_[_0x65fc('0x18')](_0x26bf18)?',\x20request\x20body:\x20'+_0x26bf18:'';_0x4f5abf=typeof _0x439727[_0x65fc('0x12')]==='object'?JSON['stringify'](_0x439727[_0x65fc('0x12')]):_0x439727[_0x65fc('0x12')];logger['info'](util['format'](_0x65fc('0x19'),_0x39486b[_0x65fc('0x4')],_0x39486b[_0x65fc('0x1a')],_0x439727[_0x65fc('0x1b')],_0x4f5abf));})[_0x65fc('0x1c')](function(_0x44e631){logger['error'](util[_0x65fc('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x39486b[_0x65fc('0x4')],_0x39486b['data2'],_0x44e631[_0x65fc('0x1b')],_0x44e631[_0x65fc('0x1d')],_0x44e631[_0x65fc('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 769268b..0468622 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 _0xdedd=['result','exports','jayson/promise','bluebird','routing','http','Request','request','then','rpc','error','message'];(function(_0x319b7c,_0x49bf97){var _0x2a30b7=function(_0xaae0f2){while(--_0xaae0f2){_0x319b7c['push'](_0x319b7c['shift']());}};_0x2a30b7(++_0x49bf97);}(_0xdedd,0xc2));var _0xdded=function(_0x21c88a,_0x4e6931){_0x21c88a=_0x21c88a-0x0;var _0x380963=_0xdedd[_0x21c88a];return _0x380963;};'use strict';var jayson=require(_0xdded('0x0'));var BPromise=require(_0xdded('0x1'));var logger=require('../../config/logger')(_0xdded('0x2'));var client=jayson['client'][_0xdded('0x3')]({'port':0x2329});client[_0xdded('0x4')]=function(_0x42633c,_0x386231){return new BPromise(function(_0xc1d78a,_0x19f5b1){return client[_0xdded('0x5')](_0x42633c,_0x386231)[_0xdded('0x6')](function(_0x25f3e8){logger['debug'](_0xdded('0x7'),_0xdded('0x2'),_0x42633c,_0x386231,_0x25f3e8);if(_0x25f3e8['error']){logger[_0xdded('0x8')](_0xdded('0x7'),'routing',_0x42633c,_0x25f3e8[_0xdded('0x8')][_0xdded('0x9')],_0x386231);return _0x19f5b1(_0x25f3e8[_0xdded('0x8')]['message']);}else{return _0xc1d78a(_0x25f3e8[_0xdded('0xa')]);}})['catch'](function(_0x1751f9){logger['error'](_0xdded('0x7'),'routing',_0x42633c,_0x1751f9,_0x386231);return _0x19f5b1(_0x1751f9);});});};module[_0xdded('0xb')]=client; \ No newline at end of file +var _0x44a0=['then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request'];(function(_0x90d6e5,_0x475f34){var _0x41112e=function(_0x325b8b){while(--_0x325b8b){_0x90d6e5['push'](_0x90d6e5['shift']());}};_0x41112e(++_0x475f34);}(_0x44a0,0x149));var _0x044a=function(_0x14ce25,_0x317b59){_0x14ce25=_0x14ce25-0x0;var _0x5971f3=_0x44a0[_0x14ce25];return _0x5971f3;};'use strict';var jayson=require(_0x044a('0x0'));var BPromise=require(_0x044a('0x1'));var logger=require(_0x044a('0x2'))(_0x044a('0x3'));var client=jayson[_0x044a('0x4')]['http']({'port':0x2329});client[_0x044a('0x5')]=function(_0x5e395a,_0xc7856c){return new BPromise(function(_0x54bc33,_0x2f384b){return client[_0x044a('0x6')](_0x5e395a,_0xc7856c)[_0x044a('0x7')](function(_0x3453c0){logger['debug'](_0x044a('0x8'),_0x044a('0x3'),_0x5e395a,_0xc7856c,_0x3453c0);if(_0x3453c0[_0x044a('0x9')]){logger[_0x044a('0x9')](_0x044a('0x8'),'routing',_0x5e395a,_0x3453c0[_0x044a('0x9')]['message'],_0xc7856c);return _0x2f384b(_0x3453c0['error'][_0x044a('0xa')]);}else{return _0x54bc33(_0x3453c0[_0x044a('0xb')]);}})[_0x044a('0xc')](function(_0xb14e92){logger[_0x044a('0x9')](_0x044a('0x8'),_0x044a('0x3'),_0x5e395a,_0xb14e92,_0xc7856c);return _0x2f384b(_0xb14e92);});});};module[_0x044a('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4b65f76..c7e9218 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 _0xdf32=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server'];(function(_0x578682,_0x2341e2){var _0x3d35a0=function(_0x56820b){while(--_0x56820b){_0x578682['push'](_0x578682['shift']());}};_0x3d35a0(++_0x2341e2);}(_0xdf32,0x14f));var _0x2df3=function(_0x218aab,_0x1c25e3){_0x218aab=_0x218aab-0x0;var _0x18171c=_0xdf32[_0x218aab];return _0x18171c;};'use strict';var server=require(_0x2df3('0x0'));var Realtime=require(_0x2df3('0x1'));var EmailChannel=require(_0x2df3('0x2'));var mailAccount=require(_0x2df3('0x3'));var setting=require(_0x2df3('0x4'));var logger=require(_0x2df3('0x5'))(_0x2df3('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2df3('0x7')]()[_0x2df3('0x8')](mailAccount[_0x2df3('0x9')]())['then'](realtime[_0x2df3('0xa')]())['then'](function(){email[_0x2df3('0xb')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x2df3('0x8')](function(){return initRealtime();})[_0x2df3('0x8')](function(){return setting[_0x2df3('0xc')]();})['then'](function(_0x477719){return setInterval(initRealtime,_0x477719[_0x2df3('0xd')]*0x3e8);})['catch'](function(_0x44888f){logger[_0x2df3('0xe')](_0x2df3('0xf'),_0x44888f);});}main(); \ No newline at end of file +var _0x0f77=['../../config/logger','email','resolve','then','getMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0x0f77,0x74));var _0x70f7=function(_0x4b69ae,_0x207c9b){_0x4b69ae=_0x4b69ae-0x0;var _0x28bdd3=_0x0f77[_0x4b69ae];return _0x28bdd3;};'use strict';var server=require(_0x70f7('0x0'));var Realtime=require(_0x70f7('0x1'));var EmailChannel=require(_0x70f7('0x2'));var mailAccount=require(_0x70f7('0x3'));var setting=require('./rpc/setting');var logger=require(_0x70f7('0x4'))(_0x70f7('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x70f7('0x6')]()[_0x70f7('0x7')](mailAccount[_0x70f7('0x8')]())[_0x70f7('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0x70f7('0x9')](realtime[_0x70f7('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x70f7('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x70f7('0xb')]();})[_0x70f7('0x7')](function(_0x3634d7){return setInterval(initRealtime,_0x3634d7[_0x70f7('0xc')]*0x3e8);})['catch'](function(_0x4301f9){logger[_0x70f7('0xd')](_0x70f7('0xe'),_0x4301f9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index feb7217..fb893c2 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 _0x2817=['active','Imap','isNil','stringify','emit','mailAccount:update','hasOwnProperty','service','provider','custom','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','status','disabled','messageStatus','connected','name','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','send','Smtp','lastSync','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','key'];(function(_0x3d89ce,_0x5d5e4b){var _0x494a2e=function(_0x1222b8){while(--_0x1222b8){_0x3d89ce['push'](_0x3d89ce['shift']());}};_0x494a2e(++_0x5d5e4b);}(_0x2817,0x95));var _0x7281=function(_0x28902f,_0x2a8dbf){_0x28902f=_0x28902f-0x0;var _0x4a4f6d=_0x2817[_0x28902f];return _0x4a4f6d;};'use strict';var _=require('lodash');var moment=require(_0x7281('0x0'));var BPromise=require(_0x7281('0x1'));var md5=require(_0x7281('0x2'));var Redis=require(_0x7281('0x3'));var config=require(_0x7281('0x4'));var logger=require(_0x7281('0x5'))(_0x7281('0x6'));config[_0x7281('0x7')]=_[_0x7281('0x8')](config[_0x7281('0x7')],{'host':_0x7281('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7281('0x7')]));var EmailImap=require(_0x7281('0xa'));var EmailSmtp=require(_0x7281('0xb'));var mailAccount=require(_0x7281('0xc'));var md5Accounts={};function EmailChannel(_0x5e06e2){logger[_0x7281('0xd')]('start\x20email\x20channel');this[_0x7281('0xe')]=_0x5e06e2[_0x7281('0xe')];this[_0x7281('0xf')]={};this[_0x7281('0x10')]=new EmailSmtp();}EmailChannel[_0x7281('0x11')]['emit']=function(_0x4ced00){var _0x3a87df=this[_0x7281('0xe')][_0x4ced00];var _0x339c83={'id':_0x3a87df['id'],'name':_0x3a87df['name'],'key':_0x3a87df[_0x7281('0x12')],'active':_0x3a87df[_0x7281('0x13')],'Imap':{'status':_0x3a87df[_0x7281('0x14')]['status'],'messageStatus':_0x3a87df[_0x7281('0x14')]['messageStatus'],'total':_0x3a87df[_0x7281('0x14')]['total']}};if(_[_0x7281('0x15')](md5Accounts[_0x4ced00])){md5Accounts[_0x4ced00]={};}var _0x58bd3e=md5(JSON[_0x7281('0x16')](_0x339c83));if(md5Accounts[_0x4ced00][_0x7281('0x2')]!==_0x58bd3e){md5Accounts[_0x4ced00][_0x7281('0x2')]=_0x58bd3e;io[_0x7281('0x17')](_0x7281('0x18'),_0x339c83);}};EmailChannel[_0x7281('0x11')]['refresh']=function(_0x36b951){for(var _0x1b8544 in _0x36b951){if(_0x36b951[_0x7281('0x19')](_0x1b8544)){if(_0x36b951[_0x1b8544][_0x7281('0x14')]&&_0x36b951[_0x1b8544][_0x7281('0x13')]){var _0x5bb8c2=_0x36b951[_0x1b8544]['Imap'];if(!_0x5bb8c2[_0x7281('0x1a')]&&_0x36b951[_0x1b8544][_0x7281('0x1b')]!==_0x7281('0x1c'))_0x5bb8c2['service']=_0x36b951[_0x1b8544][_0x7281('0x1b')];if(!this['imapAccounts']['hasOwnProperty'](_0x5bb8c2['id'])){this[_0x7281('0xf')][_0x5bb8c2['id']]=new EmailImap(_0x5bb8c2,_0x36b951[_0x1b8544][_0x7281('0x6')]);this[_0x7281('0xf')][_0x5bb8c2['id']]['on']('box',this[_0x7281('0x1d')][_0x7281('0x1e')](this,_0x1b8544));this[_0x7281('0xf')][_0x5bb8c2['id']]['on'](_0x7281('0x6'),this[_0x7281('0x1f')][_0x7281('0x1e')](this,_0x1b8544));this['imapAccounts'][_0x5bb8c2['id']]['on'](_0x7281('0x20'),this[_0x7281('0x21')][_0x7281('0x1e')](this,_0x1b8544));this['imapAccounts'][_0x5bb8c2['id']]['on'](_0x7281('0x22'),this['handleImapError'][_0x7281('0x1e')](this,_0x1b8544));}}else{if(_[_0x7281('0x15')](this['mailAccounts'][_0x1b8544]['Imap'])){this[_0x7281('0xe')][_0x1b8544][_0x7281('0x14')]={};}this[_0x7281('0xe')][_0x1b8544][_0x7281('0x14')][_0x7281('0x23')]=_0x7281('0x24');this[_0x7281('0xe')][_0x1b8544]['Imap'][_0x7281('0x25')]='';this[_0x7281('0x17')](_0x1b8544);}}}};EmailChannel[_0x7281('0x11')][_0x7281('0x1d')]=function(_0x46f698,_0x46939f){if(this[_0x7281('0xe')][_0x46f698]){this[_0x7281('0xe')][_0x46f698][_0x7281('0x14')][_0x7281('0x23')]=_0x7281('0x26');this['mailAccounts'][_0x46f698][_0x7281('0x14')][_0x7281('0x25')]=_0x46939f[_0x7281('0x27')];if(_0x46939f[_0x7281('0x28')]){this[_0x7281('0xe')][_0x46f698]['Imap'][_0x7281('0x29')]=_0x46939f[_0x7281('0x28')][_0x7281('0x29')];}return this['emit'](_0x46f698);}};EmailChannel[_0x7281('0x11')][_0x7281('0x1f')]=function(_0x5f1521,_0x5dd5c7){logger['info'](_0x7281('0x2a'),_0x5dd5c7['firstName'],_0x5dd5c7[_0x7281('0x2b')],_0x5dd5c7['from'],_0x5f1521);if(this['mailAccounts'][_0x5f1521]){return mailAccount[_0x7281('0x2c')](_0x5f1521,_0x5dd5c7)[_0x7281('0x2d')](function(_0x1aab30){if(_0x1aab30){logger['info'](_0x7281('0x2e'));}})[_0x7281('0x2f')](function(_0x47c7a8){logger['error'](_0x7281('0x30'),JSON[_0x7281('0x16')](_0x47c7a8));});}};EmailChannel['prototype']['handleImapEnd']=function(_0xf49891){if(this['mailAccounts'][_0xf49891]&&this[_0x7281('0xe')][_0xf49891][_0x7281('0x14')]){if(this[_0x7281('0xf')][this[_0x7281('0xe')][_0xf49891][_0x7281('0x14')]['id']]){delete this[_0x7281('0xf')][this[_0x7281('0xe')][_0xf49891][_0x7281('0x14')]['id']];}this['mailAccounts'][_0xf49891][_0x7281('0x14')]['lastSync']=moment();this[_0x7281('0x17')](_0xf49891);}};EmailChannel[_0x7281('0x11')][_0x7281('0x31')]=function(_0xdbf65a,_0x9f6942){if(this[_0x7281('0xe')][_0xdbf65a]){this[_0x7281('0xe')][_0xdbf65a]['Imap'][_0x7281('0x23')]='error';this[_0x7281('0xe')][_0xdbf65a]['Imap'][_0x7281('0x25')]=_0x9f6942;return this[_0x7281('0x17')](_0xdbf65a);}};EmailChannel[_0x7281('0x11')][_0x7281('0x32')]=function(_0x2f761e,_0x1a2d56){return this['smtp'][_0x7281('0x33')](_0x2f761e,_0x1a2d56);};EmailChannel['prototype']['verifySmtp']=function(_0x39edb8){var _0x2c91a2=this;if(this[_0x7281('0xe')][_0x39edb8['id']]){if(_['isNil'](this[_0x7281('0xe')][_0x39edb8['id']][_0x7281('0x34')])){this[_0x7281('0xe')][_0x39edb8['id']][_0x7281('0x34')]={};}this[_0x7281('0xe')][_0x39edb8['id']]['Smtp'][_0x7281('0x35')]=moment();return new BPromise(function(_0x21a156,_0x29a9fc){return _0x2c91a2[_0x7281('0x10')]['verify'](_0x39edb8)['then'](function(_0x3348b4){_0x2c91a2[_0x7281('0xe')][_0x39edb8['id']]['Smtp'][_0x7281('0x23')]=_0x7281('0x36');_0x2c91a2['mailAccounts'][_0x39edb8['id']][_0x7281('0x34')][_0x7281('0x25')]='';_0x2c91a2['emit'](_0x39edb8['id']);_0x21a156(_0x3348b4);})[_0x7281('0x2f')](function(_0x5283b4){_0x2c91a2['mailAccounts'][_0x39edb8['id']][_0x7281('0x34')][_0x7281('0x23')]=_0x7281('0x22');_0x2c91a2[_0x7281('0xe')][_0x39edb8['id']][_0x7281('0x34')][_0x7281('0x25')]=_0x5283b4;_0x2c91a2['emit'](_0x39edb8['id']);_0x29a9fc(_0x5283b4);});});}return this[_0x7281('0x10')]['verify'](_0x39edb8);};module[_0x7281('0x37')]=EmailChannel; \ No newline at end of file +var _0x31e2=['lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x31e2,0x81));var _0x231e=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x31e2[_0x26b8b5];return _0x2150a9;};'use strict';var _=require(_0x231e('0x0'));var moment=require(_0x231e('0x1'));var BPromise=require(_0x231e('0x2'));var md5=require(_0x231e('0x3'));var Redis=require(_0x231e('0x4'));var config=require(_0x231e('0x5'));var logger=require(_0x231e('0x6'))(_0x231e('0x7'));config[_0x231e('0x8')]=_[_0x231e('0x9')](config[_0x231e('0x8')],{'host':_0x231e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x231e('0x8')]));var EmailImap=require(_0x231e('0xb'));var EmailSmtp=require(_0x231e('0xc'));var mailAccount=require(_0x231e('0xd'));var md5Accounts={};function EmailChannel(_0xdcbfa5){logger[_0x231e('0xe')]('start\x20email\x20channel');this[_0x231e('0xf')]=_0xdcbfa5[_0x231e('0xf')];this[_0x231e('0x10')]={};this[_0x231e('0x11')]=new EmailSmtp();}EmailChannel[_0x231e('0x12')][_0x231e('0x13')]=function(_0x5bb487){var _0x531e39=this[_0x231e('0xf')][_0x5bb487];var _0x542f82={'id':_0x531e39['id'],'name':_0x531e39[_0x231e('0x14')],'key':_0x531e39[_0x231e('0x15')],'active':_0x531e39[_0x231e('0x16')],'Imap':{'status':_0x531e39['Imap'][_0x231e('0x17')],'messageStatus':_0x531e39[_0x231e('0x18')][_0x231e('0x19')],'total':_0x531e39[_0x231e('0x18')][_0x231e('0x1a')]}};if(_[_0x231e('0x1b')](md5Accounts[_0x5bb487])){md5Accounts[_0x5bb487]={};}var _0x25a870=md5(JSON[_0x231e('0x1c')](_0x542f82));if(md5Accounts[_0x5bb487][_0x231e('0x3')]!==_0x25a870){md5Accounts[_0x5bb487][_0x231e('0x3')]=_0x25a870;io[_0x231e('0x13')](_0x231e('0x1d'),_0x542f82);}};EmailChannel[_0x231e('0x12')][_0x231e('0x1e')]=function(_0x1b9751){for(var _0x33abef in _0x1b9751){if(_0x1b9751[_0x231e('0x1f')](_0x33abef)){if(_0x1b9751[_0x33abef]['Imap']&&_0x1b9751[_0x33abef]['active']){var _0x31a26b=_0x1b9751[_0x33abef][_0x231e('0x18')];if(!_0x31a26b[_0x231e('0x20')]&&_0x1b9751[_0x33abef][_0x231e('0x21')]!==_0x231e('0x22'))_0x31a26b[_0x231e('0x20')]=_0x1b9751[_0x33abef][_0x231e('0x21')];if(!this[_0x231e('0x10')]['hasOwnProperty'](_0x31a26b['id'])){this[_0x231e('0x10')][_0x31a26b['id']]=new EmailImap(_0x31a26b,_0x1b9751[_0x33abef][_0x231e('0x7')]);this[_0x231e('0x10')][_0x31a26b['id']]['on'](_0x231e('0x23'),this[_0x231e('0x24')][_0x231e('0x25')](this,_0x33abef));this[_0x231e('0x10')][_0x31a26b['id']]['on'](_0x231e('0x7'),this[_0x231e('0x26')][_0x231e('0x25')](this,_0x33abef));this[_0x231e('0x10')][_0x31a26b['id']]['on'](_0x231e('0x27'),this['handleImapEnd'][_0x231e('0x25')](this,_0x33abef));this['imapAccounts'][_0x31a26b['id']]['on'](_0x231e('0x28'),this[_0x231e('0x29')][_0x231e('0x25')](this,_0x33abef));}}else{if(_[_0x231e('0x1b')](this[_0x231e('0xf')][_0x33abef]['Imap'])){this[_0x231e('0xf')][_0x33abef][_0x231e('0x18')]={};}this[_0x231e('0xf')][_0x33abef][_0x231e('0x18')][_0x231e('0x17')]=_0x231e('0x2a');this[_0x231e('0xf')][_0x33abef][_0x231e('0x18')][_0x231e('0x19')]='';this[_0x231e('0x13')](_0x33abef);}}}};EmailChannel[_0x231e('0x12')][_0x231e('0x24')]=function(_0x4f47fe,_0x45fead){if(this['mailAccounts'][_0x4f47fe]){this['mailAccounts'][_0x4f47fe][_0x231e('0x18')][_0x231e('0x17')]=_0x231e('0x2b');this[_0x231e('0xf')][_0x4f47fe][_0x231e('0x18')][_0x231e('0x19')]=_0x45fead[_0x231e('0x14')];if(_0x45fead[_0x231e('0x2c')]){this['mailAccounts'][_0x4f47fe][_0x231e('0x18')][_0x231e('0x1a')]=_0x45fead[_0x231e('0x2c')]['total'];}return this[_0x231e('0x13')](_0x4f47fe);}};EmailChannel[_0x231e('0x12')][_0x231e('0x26')]=function(_0x43807,_0x531c22){logger['info'](_0x231e('0x2d'),_0x531c22[_0x231e('0x2e')],_0x531c22[_0x231e('0x2f')],_0x531c22[_0x231e('0x30')],_0x43807);if(this[_0x231e('0xf')][_0x43807]){return mailAccount['notify'](_0x43807,_0x531c22)[_0x231e('0x31')](function(_0x2be4a3){if(_0x2be4a3){logger['info'](_0x231e('0x32'));}})[_0x231e('0x33')](function(_0x2be2ff){logger[_0x231e('0x28')](_0x231e('0x34'),JSON['stringify'](_0x2be2ff));});}};EmailChannel['prototype'][_0x231e('0x35')]=function(_0x295a6a){if(this['mailAccounts'][_0x295a6a]&&this['mailAccounts'][_0x295a6a][_0x231e('0x18')]){if(this[_0x231e('0x10')][this[_0x231e('0xf')][_0x295a6a][_0x231e('0x18')]['id']]){delete this[_0x231e('0x10')][this[_0x231e('0xf')][_0x295a6a][_0x231e('0x18')]['id']];}this[_0x231e('0xf')][_0x295a6a][_0x231e('0x18')][_0x231e('0x36')]=moment();this['emit'](_0x295a6a);}};EmailChannel[_0x231e('0x12')]['handleImapError']=function(_0x4d02c5,_0x32d4f3){if(this['mailAccounts'][_0x4d02c5]){this['mailAccounts'][_0x4d02c5]['Imap'][_0x231e('0x17')]=_0x231e('0x28');this[_0x231e('0xf')][_0x4d02c5]['Imap'][_0x231e('0x19')]=_0x32d4f3;return this[_0x231e('0x13')](_0x4d02c5);}};EmailChannel[_0x231e('0x12')][_0x231e('0x37')]=function(_0x4be036,_0x766bfb){return this[_0x231e('0x11')]['send'](_0x4be036,_0x766bfb);};EmailChannel[_0x231e('0x12')][_0x231e('0x38')]=function(_0x8cd31c){var _0x494bb3=this;if(this[_0x231e('0xf')][_0x8cd31c['id']]){if(_[_0x231e('0x1b')](this[_0x231e('0xf')][_0x8cd31c['id']]['Smtp'])){this[_0x231e('0xf')][_0x8cd31c['id']][_0x231e('0x39')]={};}this[_0x231e('0xf')][_0x8cd31c['id']][_0x231e('0x39')]['lastSync']=moment();return new BPromise(function(_0x1aadb0,_0x385adf){return _0x494bb3[_0x231e('0x11')][_0x231e('0x3a')](_0x8cd31c)['then'](function(_0x589f34){_0x494bb3[_0x231e('0xf')][_0x8cd31c['id']]['Smtp'][_0x231e('0x17')]=_0x231e('0x3b');_0x494bb3['mailAccounts'][_0x8cd31c['id']][_0x231e('0x39')][_0x231e('0x19')]='';_0x494bb3[_0x231e('0x13')](_0x8cd31c['id']);_0x1aadb0(_0x589f34);})[_0x231e('0x33')](function(_0x51eff4){_0x494bb3[_0x231e('0xf')][_0x8cd31c['id']][_0x231e('0x39')][_0x231e('0x17')]=_0x231e('0x28');_0x494bb3[_0x231e('0xf')][_0x8cd31c['id']][_0x231e('0x39')][_0x231e('0x19')]=_0x51eff4;_0x494bb3[_0x231e('0x13')](_0x8cd31c['id']);_0x385adf(_0x51eff4);});});}return this[_0x231e('0x11')][_0x231e('0x3a')](_0x8cd31c);};module[_0x231e('0x3c')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 11d09c2..2a6459a 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 _0x1224=['handleFetchMessage','error','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','account','handleFetchError','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','imap','once','handleReady','end','handleError','bind','connect','inherits','prototype','getAccount','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message'];(function(_0x44ca9c,_0xb2050){var _0x463a7f=function(_0x539b87){while(--_0x539b87){_0x44ca9c['push'](_0x44ca9c['shift']());}};_0x463a7f(++_0xb2050);}(_0x1224,0x92));var _0x4122=function(_0x2e1591,_0x1f0cfc){_0x2e1591=_0x2e1591-0x0;var _0x43c542=_0x1224[_0x2e1591];return _0x43c542;};'use strict';var _=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x4122('0x2'))[_0x4122('0x3')];var EventEmitter=require(_0x4122('0x4'))[_0x4122('0x5')];var utils=require(_0x4122('0x6'));var logger=require(_0x4122('0x7'))('email');function EmailImap(_0x47ac65,_0x4d804c){this[_0x4122('0x8')]=_0x47ac65[_0x4122('0x8')];this['account']=this['getAccount'](_0x47ac65,_0x4d804c);this[_0x4122('0x9')]=new Imap(this['account']);this['imap'][_0x4122('0xa')]('ready',this[_0x4122('0xb')]['bind'](this));this[_0x4122('0x9')][_0x4122('0xa')](_0x4122('0xc'),this['handleEnd']['bind'](this));this[_0x4122('0x9')]['on']('error',this[_0x4122('0xd')][_0x4122('0xe')](this));this[_0x4122('0x9')][_0x4122('0xf')]();}util[_0x4122('0x10')](EmailImap,EventEmitter);EmailImap[_0x4122('0x11')][_0x4122('0x12')]=function(_0x412375,_0x26cdbb){var _0x57d677={'connTimeout':_0x412375['connTimeout']?_0x412375[_0x4122('0x13')]*0x3e8:0x2710,'authTimeout':_0x412375[_0x4122('0x14')]?_0x412375['authTimeout']*0x3e8:0x1388};if(_0x412375['service']){_0x57d677[_0x4122('0x15')]=_0x412375[_0x4122('0x15')];if(_0x412375[_0x4122('0x16')]){_0x57d677[_0x4122('0x17')]=utils[_0x4122('0x18')](_0x412375[_0x4122('0x19')][_0x4122('0x1a')],_0x412375[_0x4122('0x15')]);}else{_0x57d677[_0x4122('0x1b')]=_0x412375[_0x4122('0x1b')];}}else{if(_0x412375[_0x4122('0x1c')]){_0x57d677[_0x4122('0x15')]=_0x412375[_0x4122('0x15')];_0x57d677['password']=_0x412375[_0x4122('0x1b')];}}_0x57d677[_0x4122('0x1d')]=_0x26cdbb||_0x412375['user']||_0x4122('0x1e');_0x57d677[_0x4122('0x1f')]=_0x412375[_0x4122('0x1f')];_0x57d677[_0x4122('0x20')]=_0x412375[_0x4122('0x20')]||0x3e1;if(_0x412375[_0x4122('0x21')]){_0x57d677[_0x4122('0x21')]=!![];}else{_0x57d677[_0x4122('0x21')]=![];_0x57d677[_0x4122('0x22')]='required';}return _0x57d677;};EmailImap[_0x4122('0x11')]['handleReady']=function(){this['imap'][_0x4122('0x23')](this[_0x4122('0x8')],![],this[_0x4122('0x24')][_0x4122('0xe')](this));};EmailImap[_0x4122('0x11')][_0x4122('0x24')]=function(_0x22ea3d,_0x250e7f){if(_0x22ea3d){this[_0x4122('0xd')](_0x22ea3d,!![]);}else{this[_0x4122('0x25')]('box',_0x250e7f);this[_0x4122('0x26')]();}};EmailImap[_0x4122('0x11')][_0x4122('0x27')]=function(_0xdd6e3){if(_0xdd6e3){this[_0x4122('0xd')](_0xdd6e3,!![]);}else{this[_0x4122('0x9')][_0x4122('0xc')]();}};EmailImap['prototype'][_0x4122('0x26')]=function(){this[_0x4122('0x9')][_0x4122('0x28')]([_0x4122('0x29')],this[_0x4122('0x2a')][_0x4122('0xe')](this));};EmailImap[_0x4122('0x11')]['handleReadUnseen']=function(_0x50becd,_0x1b32cc){if(_0x50becd){this[_0x4122('0xd')](_0x50becd,!![]);}else{if(_0x1b32cc[_0x4122('0x2b')]){try{var _0x1036e3=this[_0x4122('0x9')][_0x4122('0x2c')](_0x1b32cc,{'bodies':'','markSeen':!![]});_0x1036e3['on'](_0x4122('0x2d'),this[_0x4122('0x2e')][_0x4122('0xe')](this));_0x1036e3[_0x4122('0xa')](_0x4122('0x2f'),this['handleFetchError']['bind'](this));_0x1036e3[_0x4122('0xa')](_0x4122('0xc'),this[_0x4122('0x30')][_0x4122('0xe')](this));}catch(_0x55f40b){logger['error'](_0x55f40b);}}else{this[_0x4122('0x9')][_0x4122('0x31')](!![],this[_0x4122('0x27')][_0x4122('0xe')](this));}}};EmailImap[_0x4122('0x11')][_0x4122('0x2e')]=function(_0x12bfd1){_0x12bfd1['on'](_0x4122('0x32'),this[_0x4122('0x33')][_0x4122('0xe')](this));_0x12bfd1[_0x4122('0xa')](_0x4122('0x34'),this[_0x4122('0x35')][_0x4122('0xe')](this));_0x12bfd1[_0x4122('0xa')]('end',this['handleMessageEnd'][_0x4122('0xe')](this));};EmailImap['prototype'][_0x4122('0x33')]=function(_0x23d969){simpleParser(_0x23d969,{'Iconv':Iconv},this['handleSimpleParser'][_0x4122('0xe')](this));};EmailImap[_0x4122('0x11')][_0x4122('0x35')]=function(){};EmailImap[_0x4122('0x11')]['handleMessageEnd']=function(){};EmailImap[_0x4122('0x11')][_0x4122('0x36')]=function(_0x2cb723,_0x3af8ae){if(_0x2cb723){logger[_0x4122('0x2f')](_0x2cb723);}else{var _0x544505=this;utils[_0x4122('0x37')](this[_0x4122('0x38')],_0x3af8ae,function(_0x5925dc){_0x544505[_0x4122('0x25')](_0x4122('0x1d'),_0x5925dc);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x4122('0x9')][_0x4122('0x31')](!![],this[_0x4122('0x27')][_0x4122('0xe')](this));};EmailImap[_0x4122('0x11')][_0x4122('0x39')]=function(_0x56a024){this['handleError'](_0x56a024);this['imap'][_0x4122('0x31')](!![],this['handleCloseBox'][_0x4122('0xe')](this));};EmailImap[_0x4122('0x11')][_0x4122('0x3a')]=function(){this[_0x4122('0x25')](_0x4122('0xc'));};EmailImap[_0x4122('0x11')][_0x4122('0xd')]=function(_0x2457a8,_0x1a9810){logger[_0x4122('0x2f')](_0x4122('0xd'),this['account'][_0x4122('0x1d')],JSON[_0x4122('0x3b')](_0x2457a8));var _0x3665a1='';if(_0x2457a8){if(_0x2457a8[_0x4122('0x3c')]){_0x3665a1=_0x2457a8['textCode'];}else{for(var _0x3e0576 in _0x2457a8){if(_0x2457a8[_0x4122('0x3d')](_0x3e0576)){_0x3665a1+=_[_0x4122('0x3e')](_0x3e0576)+':\x20'+_0x2457a8[_0x3e0576]+'\x0a';}}}}if(_0x1a9810){this[_0x4122('0x9')][_0x4122('0xc')]();}else{this[_0x4122('0x25')](_0x4122('0x2f'),_0x3665a1);this[_0x4122('0x25')](_0x4122('0xc'));}};module[_0x4122('0x3f')]=EmailImap; \ No newline at end of file +var _0x4409=['xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','handleFetchMessage','once','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','textCode','hasOwnProperty','upperFirst','exports','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','end','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user'];(function(_0x4abe74,_0x5f0c0){var _0x1653f5=function(_0x35de5d){while(--_0x35de5d){_0x4abe74['push'](_0x4abe74['shift']());}};_0x1653f5(++_0x5f0c0);}(_0x4409,0xa0));var _0x9440=function(_0x740a0f,_0x271871){_0x740a0f=_0x740a0f-0x0;var _0x299fa6=_0x4409[_0x740a0f];return _0x299fa6;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0x9440('0x0'));var simpleParser=require(_0x9440('0x1'))['simpleParser'];var Iconv=require(_0x9440('0x2'))[_0x9440('0x3')];var EventEmitter=require(_0x9440('0x4'))[_0x9440('0x5')];var utils=require(_0x9440('0x6'));var logger=require('../../../config/logger')(_0x9440('0x7'));function EmailImap(_0x556b2f,_0x57b03a){this[_0x9440('0x8')]=_0x556b2f[_0x9440('0x8')];this[_0x9440('0x9')]=this[_0x9440('0xa')](_0x556b2f,_0x57b03a);this[_0x9440('0x0')]=new Imap(this[_0x9440('0x9')]);this[_0x9440('0x0')]['once'](_0x9440('0xb'),this[_0x9440('0xc')][_0x9440('0xd')](this));this[_0x9440('0x0')]['once'](_0x9440('0xe'),this['handleEnd'][_0x9440('0xd')](this));this[_0x9440('0x0')]['on'](_0x9440('0xf'),this[_0x9440('0x10')][_0x9440('0xd')](this));this[_0x9440('0x0')][_0x9440('0x11')]();}util[_0x9440('0x12')](EmailImap,EventEmitter);EmailImap[_0x9440('0x13')][_0x9440('0xa')]=function(_0xe197b7,_0x54f76b){var _0x3523fa={'connTimeout':_0xe197b7[_0x9440('0x14')]?_0xe197b7[_0x9440('0x14')]*0x3e8:0x2710,'authTimeout':_0xe197b7['authTimeout']?_0xe197b7[_0x9440('0x15')]*0x3e8:0x1388};if(_0xe197b7['service']){_0x3523fa[_0x9440('0x16')]=_0xe197b7['user'];if(_0xe197b7['modernAuthentication']){_0x3523fa[_0x9440('0x17')]=utils[_0x9440('0x18')](_0xe197b7[_0x9440('0x19')][_0x9440('0x1a')],_0xe197b7[_0x9440('0x16')]);}else{_0x3523fa[_0x9440('0x1b')]=_0xe197b7[_0x9440('0x1b')];}}else{if(_0xe197b7[_0x9440('0x1c')]){_0x3523fa[_0x9440('0x16')]=_0xe197b7[_0x9440('0x16')];_0x3523fa[_0x9440('0x1b')]=_0xe197b7['password'];}}_0x3523fa[_0x9440('0x7')]=_0x54f76b||_0xe197b7['user']||'anonymous@xcally.com';_0x3523fa[_0x9440('0x1d')]=_0xe197b7[_0x9440('0x1d')];_0x3523fa[_0x9440('0x1e')]=_0xe197b7[_0x9440('0x1e')]||0x3e1;if(_0xe197b7[_0x9440('0x1f')]){_0x3523fa[_0x9440('0x1f')]=!![];}else{_0x3523fa[_0x9440('0x1f')]=![];_0x3523fa[_0x9440('0x20')]=_0x9440('0x21');}return _0x3523fa;};EmailImap[_0x9440('0x13')][_0x9440('0xc')]=function(){this[_0x9440('0x0')][_0x9440('0x22')](this[_0x9440('0x8')],![],this[_0x9440('0x23')][_0x9440('0xd')](this));};EmailImap[_0x9440('0x13')][_0x9440('0x23')]=function(_0x1fbed3,_0x310b5f){if(_0x1fbed3){this['handleError'](_0x1fbed3,!![]);}else{this[_0x9440('0x24')](_0x9440('0x25'),_0x310b5f);this[_0x9440('0x26')]();}};EmailImap['prototype'][_0x9440('0x27')]=function(_0x2ba1fb){if(_0x2ba1fb){this['handleError'](_0x2ba1fb,!![]);}else{this[_0x9440('0x0')][_0x9440('0xe')]();}};EmailImap['prototype'][_0x9440('0x26')]=function(){this[_0x9440('0x0')][_0x9440('0x28')]([_0x9440('0x29')],this[_0x9440('0x2a')][_0x9440('0xd')](this));};EmailImap[_0x9440('0x13')][_0x9440('0x2a')]=function(_0x5bfe17,_0x4c7f33){if(_0x5bfe17){this['handleError'](_0x5bfe17,!![]);}else{if(_0x4c7f33[_0x9440('0x2b')]){try{var _0x40a739=this[_0x9440('0x0')]['fetch'](_0x4c7f33,{'bodies':'','markSeen':!![]});_0x40a739['on']('message',this[_0x9440('0x2c')][_0x9440('0xd')](this));_0x40a739[_0x9440('0x2d')]('error',this[_0x9440('0x2e')][_0x9440('0xd')](this));_0x40a739[_0x9440('0x2d')](_0x9440('0xe'),this[_0x9440('0x2f')]['bind'](this));}catch(_0x204c09){logger[_0x9440('0xf')](_0x204c09);}}else{this['imap'][_0x9440('0x30')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x9440('0x13')]['handleFetchMessage']=function(_0x346bb5){_0x346bb5['on'](_0x9440('0x31'),this[_0x9440('0x32')][_0x9440('0xd')](this));_0x346bb5[_0x9440('0x2d')](_0x9440('0x33'),this[_0x9440('0x34')][_0x9440('0xd')](this));_0x346bb5[_0x9440('0x2d')](_0x9440('0xe'),this[_0x9440('0x35')][_0x9440('0xd')](this));};EmailImap[_0x9440('0x13')]['handleMessageBody']=function(_0x355bcd){simpleParser(_0x355bcd,{'Iconv':Iconv},this[_0x9440('0x36')][_0x9440('0xd')](this));};EmailImap[_0x9440('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x9440('0x13')][_0x9440('0x35')]=function(){};EmailImap['prototype'][_0x9440('0x36')]=function(_0x968da0,_0x1fad20){if(_0x968da0){logger['error'](_0x968da0);}else{var _0x28a6bf=this;utils[_0x9440('0x37')](this[_0x9440('0x9')],_0x1fad20,function(_0x13daa7){_0x28a6bf['emit'](_0x9440('0x7'),_0x13daa7);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x9440('0x0')][_0x9440('0x30')](!![],this[_0x9440('0x27')][_0x9440('0xd')](this));};EmailImap[_0x9440('0x13')]['handleFetchError']=function(_0x10500c){this[_0x9440('0x10')](_0x10500c);this[_0x9440('0x0')][_0x9440('0x30')](!![],this[_0x9440('0x27')][_0x9440('0xd')](this));};EmailImap[_0x9440('0x13')][_0x9440('0x38')]=function(){this[_0x9440('0x24')]('end');};EmailImap[_0x9440('0x13')][_0x9440('0x10')]=function(_0x32dcb8,_0x4edf67){logger[_0x9440('0xf')]('handleError',this[_0x9440('0x9')][_0x9440('0x7')],JSON['stringify'](_0x32dcb8));var _0x2b50ab='';if(_0x32dcb8){if(_0x32dcb8[_0x9440('0x39')]){_0x2b50ab=_0x32dcb8[_0x9440('0x39')];}else{for(var _0x491c34 in _0x32dcb8){if(_0x32dcb8[_0x9440('0x3a')](_0x491c34)){_0x2b50ab+=_[_0x9440('0x3b')](_0x491c34)+':\x20'+_0x32dcb8[_0x491c34]+'\x0a';}}}}if(_0x4edf67){this[_0x9440('0x0')][_0x9440('0xe')]();}else{this['emit']('error',_0x2b50ab);this[_0x9440('0x24')]('end');}};module[_0x9440('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 76b54df..fbf534b 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 _0xcc9c=['exports','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xcc9c,0x119));var _0xccc9=function(_0x3912f5,_0x47c54a){_0x3912f5=_0x3912f5-0x0;var _0x53453f=_0xcc9c[_0x3912f5];return _0x53453f;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xccc9('0x0'));function EmailSmtp(){}EmailSmtp[_0xccc9('0x1')]['send']=function(_0x2d7342,_0x2c3ece){return new Promise(function(_0xeae830,_0x2fb33e){var _0xf7869f=nodemailer[_0xccc9('0x2')](_0x2d7342);_0xf7869f[_0xccc9('0x3')](_0xccc9('0x4'),inlineBase64());_0xf7869f[_0xccc9('0x5')](_0x2c3ece,function(_0x413417,_0x216c7d){if(_0x413417){_0x2fb33e(_0x413417[_0xccc9('0x6')]());}else{_0xeae830(_0x216c7d);}});});};EmailSmtp[_0xccc9('0x1')][_0xccc9('0x7')]=function(_0x617960){return new Promise(function(_0x1c594c,_0x2fae88){var _0x25c5c8=nodemailer[_0xccc9('0x2')](_0x617960);_0x25c5c8['verify'](function(_0x4e3f37,_0x12ac80){if(_0x4e3f37){_0x2fae88(_0x4e3f37[_0xccc9('0x6')]());}else{if(_0x12ac80){_0x1c594c(_0x12ac80);}else{_0x2fae88(_0xccc9('0x8'));}}});});};module[_0xccc9('0x9')]=EmailSmtp; \ No newline at end of file +var _0x0781=['send','use','compile','sendMail','toString','createTransport','Not\x20verifired','exports','nodemailer'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0781,0x7d));var _0x1078=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0781[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0x1078('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0x1078('0x1')]=function(_0x4920b5,_0x2865e7){return new Promise(function(_0x11c25c,_0x52e653){var _0x2f31cb=nodemailer['createTransport'](_0x4920b5);_0x2f31cb[_0x1078('0x2')](_0x1078('0x3'),inlineBase64());_0x2f31cb[_0x1078('0x4')](_0x2865e7,function(_0x38c536,_0x5cd320){if(_0x38c536){_0x52e653(_0x38c536[_0x1078('0x5')]());}else{_0x11c25c(_0x5cd320);}});});};EmailSmtp['prototype']['verify']=function(_0x1adf76){return new Promise(function(_0x560b90,_0x2497b5){var _0x32270b=nodemailer[_0x1078('0x6')](_0x1adf76);_0x32270b['verify'](function(_0xe76bee,_0x1e29f1){if(_0xe76bee){_0x2497b5(_0xe76bee[_0x1078('0x5')]());}else{if(_0x1e29f1){_0x560b90(_0x1e29f1);}else{_0x2497b5(_0x1078('0x7'));}}});});};module[_0x1078('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d11fd2b..0006e06 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 _0x5821=['bcc','type','attachment','filename','attachment-','format','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','Title','from','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','address','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','generate','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x25bc8c[_0x1582('0xf')](0x0,-0x1)[_0x1582('0x10')]('\x20'):_0x5746fd['name'];}return _0x1582('0x11');}function getLastName(_0xb4728d){var _0xa774a=_['head'](_0xb4728d[_0x1582('0x9')]);if(_0xa774a&&_0xa774a['name']){var _0x2e7ce0=_0xa774a['name'][_0x1582('0xd')](/\s+/);return _0x2e7ce0[_0x1582('0xe')]>0x1?_0x2e7ce0[_0x1582('0x12')]():'';}return'';}function getMails(_0x12fe2d,_0x538cfd){var _0x17bbb8='';for(var _0x365d96=0x0;_0x365d96<_0x538cfd[_0x1582('0x9')][_0x1582('0xe')];_0x365d96+=0x1){if(_0x538cfd[_0x1582('0x9')][_0x365d96][_0x1582('0x7')]!==_0x12fe2d){if(!_[_0x1582('0x13')](_0x17bbb8)){_0x17bbb8+=',';}_0x17bbb8+=_0x538cfd[_0x1582('0x9')][_0x365d96][_0x1582('0xa')]||_0x538cfd['value'][_0x365d96]['address']||'';_0x17bbb8+='\x20<';_0x17bbb8+=_0x538cfd['value'][_0x365d96]['address']?_0x538cfd[_0x1582('0x9')][_0x365d96]['address']:_0x1582('0x14')+random[_0x1582('0x15')](0x6)+_0x1582('0x8');_0x17bbb8+='>';}}return _0x17bbb8;}function parseEmail(_0x570bbb,_0x2f4d4c,_0x2fc7c9){if(_0x2f4d4c[_0x1582('0x16')]){var _0xeeeabb=/)<[^<]*)*<\/script>/gi;while(_0xeeeabb[_0x1582('0x17')](_0x2f4d4c[_0x1582('0x16')])){_0x2f4d4c[_0x1582('0x16')]=_0x2f4d4c['html'][_0x1582('0x18')](_0xeeeabb,'');}if(_0x2f4d4c['html'][_0x1582('0x19')](_0x1582('0x1a'))){var _0x365d05=[];_0x2f4d4c[_0x1582('0x1b')][_0x1582('0x1c')](_0x1d1617=>{_0x365d05[_0x1582('0x1d')](_0x1d1617['filename']);});var _0x45c116=/]+>/g;var _0x5986da=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4d20a3=_0x2f4d4c[_0x1582('0x16')][_0x1582('0x18')](_0x5986da,_0x1582('0x1e'));var _0x352725=_0x4d20a3[_0x1582('0x18')](_0x45c116,'_IMG');for(let _0x5cdef5=0x0;_0x5cdef5<_0x365d05[_0x1582('0xe')];_0x5cdef5++){var _0x2e77a6=_0x352725[_0x1582('0x18')](_0x1582('0x1f'),_0x1582('0x20')+_0x365d05[_0x5cdef5]+'\x20]');_0x352725=_0x2e77a6;}_0x2f4d4c[_0x1582('0x16')]=_0x352725;}_0x2fc7c9[_0x1582('0x21')]=_0x2f4d4c[_0x1582('0x16')];}else{_0x2fc7c9['body']=_0x2f4d4c[_0x1582('0x22')];}if(_0x2fc7c9[_0x1582('0x21')]){_0x2fc7c9[_0x1582('0x21')]=_0x2fc7c9[_0x1582('0x21')][_0x1582('0x18')](/0x0){var _0x2aeaad=[_0x1582('0x34'),_0x1582('0x35'),_0x1582('0x36')];for(var _0x602f7a=0x0;_0x602f7a<_0x2f4d4c['headerLines'][_0x1582('0xe')];_0x602f7a++){var _0x5e8282=_[_0x1582('0xc')](_0x2aeaad,_0x2f4d4c[_0x1582('0x33')][_0x602f7a]['line']);if(_0x5e8282>=0x0){_0x2fc7c9[_0x1582('0x37')]=!![];}}}return _0x2fc7c9;}exports['parser']=function(_0x2b025a,_0x22cdae,_0x1068de){var _0x582bcc={'from':getAddress(_0x22cdae['from']),'firstName':getFirstName(_0x22cdae['from']),'lastName':getLastName(_0x22cdae['from']),'mapKey':'email','message':{'from':getMails(_0x2b025a['email'],_0x22cdae['from']),'to':_0x2b025a['email'],'cc':'','subject':_0x22cdae['subject']||'','messageId':_0x22cdae[_0x1582('0x38')],'inReplyTo':_0x22cdae['inReplyTo'],'sentAt':moment(_0x22cdae[_0x1582('0x39')])[_0x1582('0x2c')](_0x1582('0x3a')),'attach':![],'attachments':[]}};if(!_0x22cdae['html']&&!_0x22cdae['textAsHtml']){var _0x3633ac=_[_0x1582('0x3b')](_0x22cdae[_0x1582('0x1b')],{'contentType':_0x1582('0x3c')});if(_0x3633ac[_0x1582('0xe')]){logger[_0x1582('0x3d')](util['format'](_0x1582('0x3e'),_0x22cdae['messageId']));tnef[_0x1582('0x3f')](_[_0x1582('0x40')](_0x3633ac)[_0x1582('0x31')],function(_0x227cc3,_0x29350d){if(_0x29350d){_0x22cdae[_0x1582('0x16')]=_0x29350d['BodyHTML']||_0x1582('0x41');if(_0x29350d[_0x1582('0x42')]){for(var _0x1416b6=0x0;_0x1416b6<_0x29350d[_0x1582('0x42')][_0x1582('0xe')];_0x1416b6++){var _0x4037db=_0x29350d[_0x1582('0x42')][_0x1416b6];_0x582bcc[_0x1582('0x25')][_0x1582('0x1b')][_0x1582('0x1d')]({'filename':_0x4037db[_0x1582('0x43')],'content':Buffer[_0x1582('0x44')](_0x4037db[_0x1582('0x45')])});}}}_0x1068de(parseEmail(_0x2b025a,_0x22cdae,_0x582bcc));});}else{_0x22cdae[_0x1582('0x16')]=_0x1582('0x41');_0x1068de(parseEmail(_0x2b025a,_0x22cdae,_0x582bcc));}}else{_0x1068de(parseEmail(_0x2b025a,_0x22cdae,_0x582bcc));}};exports[_0x1582('0x46')]=function(_0x587d01,_0x585d7c){var _0x3f8577=[_0x1582('0x47')+(_0x585d7c||''),_0x1582('0x48')+_0x587d01,'',''];return Buffer[_0x1582('0x44')](_0x3f8577[_0x1582('0x10')](''),'utf-8')[_0x1582('0x49')](_0x1582('0x4a'));}; \ No newline at end of file +var _0xd4f4=['BodyHTML','

Empty\x20message

','Attachments','push','Title','Data','generateXOAuth2Token','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x3735e8[_0x4d4f('0x13')](0x0,-0x1)[_0x4d4f('0x14')]('\x20'):_0x752bed['name'];}return _0x4d4f('0x15');}function getLastName(_0x4460bd){var _0x4dae0a=_['head'](_0x4460bd[_0x4d4f('0x9')]);if(_0x4dae0a&&_0x4dae0a['name']){var _0x500b7d=_0x4dae0a[_0x4d4f('0xe')]['split'](/\s+/);return _0x500b7d['length']>0x1?_0x500b7d['pop']():'';}return'';}function getMails(_0x2b7448,_0x1d51b2){var _0x3581cb='';for(var _0x42f504=0x0;_0x42f504<_0x1d51b2[_0x4d4f('0x9')][_0x4d4f('0x12')];_0x42f504+=0x1){if(_0x1d51b2[_0x4d4f('0x9')][_0x42f504][_0x4d4f('0xa')]!==_0x2b7448){if(!_['isEmpty'](_0x3581cb)){_0x3581cb+=',';}_0x3581cb+=_0x1d51b2[_0x4d4f('0x9')][_0x42f504][_0x4d4f('0xe')]||_0x1d51b2[_0x4d4f('0x9')][_0x42f504][_0x4d4f('0xa')]||'';_0x3581cb+='\x20<';_0x3581cb+=_0x1d51b2[_0x4d4f('0x9')][_0x42f504][_0x4d4f('0xa')]?_0x1d51b2[_0x4d4f('0x9')][_0x42f504][_0x4d4f('0xa')]:_0x4d4f('0xb')+random[_0x4d4f('0xc')](0x6)+_0x4d4f('0xd');_0x3581cb+='>';}}return _0x3581cb;}function parseEmail(_0x2010f1,_0x341e1b,_0x35bbf9){if(_0x341e1b[_0x4d4f('0x16')]){var _0x361ad9=/)<[^<]*)*<\/script>/gi;while(_0x361ad9['test'](_0x341e1b[_0x4d4f('0x16')])){_0x341e1b[_0x4d4f('0x16')]=_0x341e1b[_0x4d4f('0x16')][_0x4d4f('0x17')](_0x361ad9,'');}if(_0x341e1b['html'][_0x4d4f('0x18')](_0x4d4f('0x19'))){var _0x545f9a=[];_0x341e1b[_0x4d4f('0x1a')][_0x4d4f('0x1b')](_0x2d142c=>{_0x545f9a['push'](_0x2d142c['filename']);});var _0x3fe630=/]+>/g;var _0xfa42df=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x791f99=_0x341e1b[_0x4d4f('0x16')][_0x4d4f('0x17')](_0xfa42df,'_SRC');var _0x4b6994=_0x791f99[_0x4d4f('0x17')](_0x3fe630,'_IMG');for(let _0x38fd1d=0x0;_0x38fd1d<_0x545f9a[_0x4d4f('0x12')];_0x38fd1d++){var _0x15964d=_0x4b6994['replace'](_0x4d4f('0x1c'),_0x4d4f('0x1d')+_0x545f9a[_0x38fd1d]+'\x20]');_0x4b6994=_0x15964d;}_0x341e1b[_0x4d4f('0x16')]=_0x4b6994;}_0x35bbf9[_0x4d4f('0x1e')]=_0x341e1b[_0x4d4f('0x16')];}else{_0x35bbf9[_0x4d4f('0x1e')]=_0x341e1b[_0x4d4f('0x1f')];}if(_0x35bbf9[_0x4d4f('0x1e')]){_0x35bbf9[_0x4d4f('0x1e')]=_0x35bbf9[_0x4d4f('0x1e')]['replace'](/0x0){var _0x4cf74f=['Auto-Submitted:\x20auto-replied',_0x4d4f('0x2e'),_0x4d4f('0x2f')];for(var _0x362caf=0x0;_0x362caf<_0x341e1b['headerLines']['length'];_0x362caf++){var _0x14b524=_['indexOf'](_0x4cf74f,_0x341e1b[_0x4d4f('0x2d')][_0x362caf][_0x4d4f('0x30')]);if(_0x14b524>=0x0){_0x35bbf9[_0x4d4f('0x31')]=!![];}}}return _0x35bbf9;}exports[_0x4d4f('0x32')]=function(_0x219812,_0x17af1f,_0x5e20ec){var _0x564901={'from':getAddress(_0x17af1f[_0x4d4f('0x33')]),'firstName':getFirstName(_0x17af1f[_0x4d4f('0x33')]),'lastName':getLastName(_0x17af1f['from']),'mapKey':_0x4d4f('0x6'),'message':{'from':getMails(_0x219812[_0x4d4f('0x6')],_0x17af1f[_0x4d4f('0x33')]),'to':_0x219812['email'],'cc':'','subject':_0x17af1f[_0x4d4f('0x34')]||'','messageId':_0x17af1f[_0x4d4f('0x35')],'inReplyTo':_0x17af1f[_0x4d4f('0x36')],'sentAt':moment(_0x17af1f[_0x4d4f('0x37')])['format'](_0x4d4f('0x38')),'attach':![],'attachments':[]}};if(!_0x17af1f[_0x4d4f('0x16')]&&!_0x17af1f[_0x4d4f('0x1f')]){var _0x278c75=_[_0x4d4f('0x39')](_0x17af1f[_0x4d4f('0x1a')],{'contentType':_0x4d4f('0x3a')});if(_0x278c75[_0x4d4f('0x12')]){logger[_0x4d4f('0x3b')](util['format'](_0x4d4f('0x3c'),_0x17af1f['messageId']));tnef['parseBuffer'](_[_0x4d4f('0x3d')](_0x278c75)[_0x4d4f('0x2b')],function(_0x232310,_0x3e92c4){if(_0x3e92c4){_0x17af1f[_0x4d4f('0x16')]=_0x3e92c4[_0x4d4f('0x3e')]||_0x4d4f('0x3f');if(_0x3e92c4[_0x4d4f('0x40')]){for(var _0x39002f=0x0;_0x39002f<_0x3e92c4['Attachments'][_0x4d4f('0x12')];_0x39002f++){var _0x394235=_0x3e92c4[_0x4d4f('0x40')][_0x39002f];_0x564901['message']['attachments'][_0x4d4f('0x41')]({'filename':_0x394235[_0x4d4f('0x42')],'content':Buffer[_0x4d4f('0x33')](_0x394235[_0x4d4f('0x43')])});}}}_0x5e20ec(parseEmail(_0x219812,_0x17af1f,_0x564901));});}else{_0x17af1f['html']='

Empty\x20message

';_0x5e20ec(parseEmail(_0x219812,_0x17af1f,_0x564901));}}else{_0x5e20ec(parseEmail(_0x219812,_0x17af1f,_0x564901));}};exports[_0x4d4f('0x44')]=function(_0x4c5702,_0x3f73af){var _0xd754da=['user='+(_0x3f73af||''),_0x4d4f('0x45')+_0x4c5702,'',''];return Buffer[_0x4d4f('0x33')](_0xd754da[_0x4d4f('0x14')](''),'utf-8')[_0x4d4f('0x46')](_0x4d4f('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 7bdb11b..67e5134 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 _0x9f34=['active','Imap','Smtp','exports','Service','key'];(function(_0x434d75,_0x221cfb){var _0x249f74=function(_0x4d5944){while(--_0x4d5944){_0x434d75['push'](_0x434d75['shift']());}};_0x249f74(++_0x221cfb);}(_0x9f34,0xac));var _0x49f3=function(_0x11003f,_0x2f2e95){_0x11003f=_0x11003f-0x0;var _0x15be81=_0x9f34[_0x11003f];return _0x15be81;};'use strict';var _=require('lodash');function MailAccount(_0x27f852){this['id']=_0x27f852['id']||0x0;this['name']=_0x27f852['name']||_0x49f3('0x0');this[_0x49f3('0x1')]=_0x27f852[_0x49f3('0x1')]||'SERV';this['active']=_0x27f852[_0x49f3('0x2')]||![];this['Imap']=_0x27f852[_0x49f3('0x3')]||[];this[_0x49f3('0x4')]=_0x27f852[_0x49f3('0x4')]||[];}module[_0x49f3('0x5')]=MailAccount; \ No newline at end of file +var _0x1cce=['Smtp','exports','lodash','Service','key','SERV','active'];(function(_0x520a59,_0xca1fb3){var _0x5c97c8=function(_0x71c78){while(--_0x71c78){_0x520a59['push'](_0x520a59['shift']());}};_0x5c97c8(++_0xca1fb3);}(_0x1cce,0x1f3));var _0xe1cc=function(_0x271a95,_0x4d2a07){_0x271a95=_0x271a95-0x0;var _0x3fa489=_0x1cce[_0x271a95];return _0x3fa489;};'use strict';var _=require(_0xe1cc('0x0'));function MailAccount(_0x3762b2){this['id']=_0x3762b2['id']||0x0;this['name']=_0x3762b2['name']||_0xe1cc('0x1');this[_0xe1cc('0x2')]=_0x3762b2['key']||_0xe1cc('0x3');this[_0xe1cc('0x4')]=_0x3762b2[_0xe1cc('0x4')]||![];this['Imap']=_0x3762b2['Imap']||[];this['Smtp']=_0x3762b2[_0xe1cc('0x5')]||[];}module[_0xe1cc('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 6b7b57c..30b5fdf 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 _0x2413=['length','isUndefined','merge','exports','mapKeys','hasOwnProperty','prototype','mailAccounts'];(function(_0x107f31,_0x1bcd53){var _0x10560c=function(_0x5e1fc4){while(--_0x5e1fc4){_0x107f31['push'](_0x107f31['shift']());}};_0x10560c(++_0x1bcd53);}(_0x2413,0xd4));var _0x3241=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2413[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x26e217,_0x3038c9,_0x4d982d){var _0xe886bd=_[_0x3241('0x0')](_0x26e217,function(_0x5d8d4e,_0x57323a){return _0x5d8d4e[_0x4d982d];});for(var _0xf9265b in _0x3038c9){if(_0x3038c9[_0x3241('0x1')](_0xf9265b)){if(!_0xe886bd[_0xf9265b]){delete _0x3038c9[_0xf9265b];}}}}Realtime[_0x3241('0x2')]['mergeFromDatabase']=function(_0x5e6756,_0x95c14a){for(var _0x4a9346 in _0x95c14a){if(_0x5e6756['hasOwnProperty'](_0x4a9346)){_0x5e6756[_0x4a9346]=_0x95c14a[_0x4a9346];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x3dc149=this;return function(_0xedfc42){if(_0xedfc42){freeIsNotKey(_0xedfc42,_0x3dc149[_0x3241('0x3')],'id');for(var _0x4de33a=0x0,_0x4fce06={},_0x92058={};_0x4de33a<_0xedfc42[_0x3241('0x4')];_0x4de33a+=0x1){_0x4fce06=_0xedfc42[_0x4de33a];if(_[_0x3241('0x5')](_0x3dc149['mailAccounts'][_0x4fce06['id']])){_0x3dc149[_0x3241('0x3')][_0x4fce06['id']]=new MailAccount(_0x4fce06);}else{_[_0x3241('0x6')](_0x3dc149['mailAccounts'][_0x4fce06['id']],_0x4fce06);}}}return _0x3dc149[_0x3241('0x3')];};};module[_0x3241('0x7')]=Realtime; \ No newline at end of file +var _0xb1c7=['hasOwnProperty','prototype','initMailAccounts','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x5be1ae,_0x4d8d2d){var _0x5e073f=function(_0x903c5c){while(--_0x903c5c){_0x5be1ae['push'](_0x5be1ae['shift']());}};_0x5e073f(++_0x4d8d2d);}(_0xb1c7,0x84));var _0x7b1c=function(_0x5c1930,_0x1b15e7){_0x5c1930=_0x5c1930-0x0;var _0x163a34=_0xb1c7[_0x5c1930];return _0x163a34;};'use strict';var _=require('lodash');var MailAccount=require(_0x7b1c('0x0'));var Realtime=function(){this[_0x7b1c('0x1')]={};};function freeIsNotKey(_0x1b830d,_0x3ae796,_0x363015){var _0x53ad68=_[_0x7b1c('0x2')](_0x1b830d,function(_0x487f30,_0x115abf){return _0x487f30[_0x363015];});for(var _0x59ac83 in _0x3ae796){if(_0x3ae796[_0x7b1c('0x3')](_0x59ac83)){if(!_0x53ad68[_0x59ac83]){delete _0x3ae796[_0x59ac83];}}}}Realtime[_0x7b1c('0x4')]['mergeFromDatabase']=function(_0x377b52,_0x1fc85c){for(var _0x571962 in _0x1fc85c){if(_0x377b52[_0x7b1c('0x3')](_0x571962)){_0x377b52[_0x571962]=_0x1fc85c[_0x571962];}}};Realtime['prototype'][_0x7b1c('0x5')]=function(){var _0x3f60c8=this;return function(_0x197465){if(_0x197465){freeIsNotKey(_0x197465,_0x3f60c8[_0x7b1c('0x1')],'id');for(var _0x236c6f=0x0,_0x311f8b={},_0x390af0={};_0x236c6f<_0x197465['length'];_0x236c6f+=0x1){_0x311f8b=_0x197465[_0x236c6f];if(_[_0x7b1c('0x6')](_0x3f60c8[_0x7b1c('0x1')][_0x311f8b['id']])){_0x3f60c8[_0x7b1c('0x1')][_0x311f8b['id']]=new MailAccount(_0x311f8b);}else{_[_0x7b1c('0x7')](_0x3f60c8[_0x7b1c('0x1')][_0x311f8b['id']],_0x311f8b);}}}return _0x3f60c8[_0x7b1c('0x1')];};};module[_0x7b1c('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9940b76..b647245 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 _0xf435=['ListId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','provider','email','active','key'];(function(_0x18df02,_0xb60a75){var _0x590b06=function(_0x4dc0d1){while(--_0x4dc0d1){_0x18df02['push'](_0x18df02['shift']());}};_0x590b06(++_0xb60a75);}(_0xf435,0x174));var _0x5f43=function(_0x30b57b,_0x4726ff){_0x30b57b=_0x30b57b-0x0;var _0x8fd3d6=_0xf435[_0x30b57b];return _0x8fd3d6;};'use strict';var client=require('../client');exports[_0x5f43('0x0')]=function(){return function(){return client[_0x5f43('0x1')](_0x5f43('0x2'),{'options':{'attributes':['id',_0x5f43('0x3'),_0x5f43('0x4'),'service',_0x5f43('0x5'),_0x5f43('0x6'),_0x5f43('0x7'),_0x5f43('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x5f43('0x9'),'as':_0x5f43('0xa'),'include':[{'model':_0x5f43('0xb'),'attributes':['id','name',_0x5f43('0xc'),_0x5f43('0xd'),_0x5f43('0xe')],'as':_0x5f43('0xb')}]},{'model':_0x5f43('0xf'),'as':_0x5f43('0x10'),'include':[{'model':_0x5f43('0xb'),'attributes':['id',_0x5f43('0x3'),_0x5f43('0xc'),_0x5f43('0xd'),_0x5f43('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x5f43('0x11')]=function(_0x43627f,_0x46a927){return client[_0x5f43('0x1')](_0x5f43('0x12'),{'account':{'id':_0x43627f},'body':_0x46a927,'log':_0x5f43('0x12')});}; \ No newline at end of file +var _0xaaee=['notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','getMailAccount'];(function(_0x100070,_0x253ebf){var _0x21fe1a=function(_0x5de018){while(--_0x5de018){_0x100070['push'](_0x100070['shift']());}};_0x21fe1a(++_0x253ebf);}(_0xaaee,0x132));var _0xeaae=function(_0x482ae3,_0xaeb145){_0x482ae3=_0x482ae3-0x0;var _0x44878a=_0xaaee[_0x482ae3];return _0x44878a;};'use strict';var client=require(_0xeaae('0x0'));exports[_0xeaae('0x1')]=function(){return function(){return client[_0xeaae('0x2')](_0xeaae('0x3'),{'options':{'attributes':['id',_0xeaae('0x4'),'provider',_0xeaae('0x5'),_0xeaae('0x6'),_0xeaae('0x7'),_0xeaae('0x8'),_0xeaae('0x9'),_0xeaae('0xa')],'raw':![],'include':[{'model':_0xeaae('0xb'),'as':_0xeaae('0xc'),'include':[{'model':_0xeaae('0xd'),'attributes':['id',_0xeaae('0x4'),_0xeaae('0x5'),_0xeaae('0xe'),'data5'],'as':_0xeaae('0xd')}]},{'model':_0xeaae('0xf'),'as':'Smtp','include':[{'model':_0xeaae('0xd'),'attributes':['id',_0xeaae('0x4'),_0xeaae('0x5'),_0xeaae('0xe'),'data5'],'as':'CloudProvider'}]}]},'log':_0xeaae('0x10')});};};exports[_0xeaae('0x11')]=function(_0x59f71d,_0x11f698){return client[_0xeaae('0x2')](_0xeaae('0x12'),{'account':{'id':_0x59f71d},'body':_0x11f698,'log':_0xeaae('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index d689a23..c3c2d3d 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 _0x3725=['Request','ShowSetting','loginMailFrequency','getSettings'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x3725,0x173));var _0x5372=function(_0x14e469,_0x20bbce){_0x14e469=_0x14e469-0x0;var _0x2ab3f4=_0x3725[_0x14e469];return _0x2ab3f4;};'use strict';var client=require('../client');exports[_0x5372('0x0')]=function(){return client[_0x5372('0x1')](_0x5372('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5372('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x5e06=['Request','GetSettings'];(function(_0x1d7750,_0x5e7f5d){var _0x7591ea=function(_0xe40d24){while(--_0xe40d24){_0x1d7750['push'](_0x1d7750['shift']());}};_0x7591ea(++_0x5e7f5d);}(_0x5e06,0x1ce));var _0x65e0=function(_0x5a4377,_0x568be3){_0x5a4377=_0x5a4377-0x0;var _0x307cd3=_0x5e06[_0x5a4377];return _0x307cd3;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x65e0('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x65e0('0x1')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 83b87ba..6e01017 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 1501047..94623b4 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 _0x14a9=['websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','../../config/environment','createServer','timeout','port'];(function(_0x196d29,_0x3c9273){var _0x3f43e0=function(_0x229f50){while(--_0x229f50){_0x196d29['push'](_0x196d29['shift']());}};_0x3f43e0(++_0x3c9273);}(_0x14a9,0x162));var _0x914a=function(_0x36426d,_0x4d62fe){_0x36426d=_0x36426d-0x0;var _0x40bd33=_0x14a9[_0x36426d];return _0x40bd33;};'use strict';var _=require(_0x914a('0x0'));var http=require(_0x914a('0x1'));var express=require('express');var sticky=require(_0x914a('0x2'));var Redis=require('ioredis');var config=require(_0x914a('0x3'));var app=express();var server=http[_0x914a('0x4')](app);server[_0x914a('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x914a('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x914a('0x7'),'polling']});config[_0x914a('0x8')]=_[_0x914a('0x9')](config['redis'],{'host':_0x914a('0xa'),'port':0x18eb});socketio[_0x914a('0xb')](require(_0x914a('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x914a('0x8')])}));require(_0x914a('0xd'))[_0x914a('0xe')]();require(_0x914a('0xf'))[_0x914a('0xe')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x914a('0xe')](app);}else{server['once'](_0x914a('0x10'),function(){console['log'](_0x914a('0x11'),config[_0x914a('0x6')]);});}exports=module[_0x914a('0x12')]=app; \ No newline at end of file +var _0x07c3=['once','log','lodash','http','express','ioredis','../../config/environment','createServer','port','localhost','adapter','socket.io-redis','redis','../../config/triggers','../../config/socketio','default','../../config/express'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x07c3,0x1bc));var _0x307c=function(_0x44e50a,_0x1cc4a2){_0x44e50a=_0x44e50a-0x0;var _0x1b5994=_0x07c3[_0x44e50a];return _0x1b5994;};'use strict';var _=require(_0x307c('0x0'));var http=require(_0x307c('0x1'));var express=require(_0x307c('0x2'));var sticky=require('sticky-session');var Redis=require(_0x307c('0x3'));var config=require(_0x307c('0x4'));var app=express();var server=http[_0x307c('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x307c('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config['redis']=_['defaults'](config['redis'],{'host':_0x307c('0x7'),'port':0x18eb});socketio[_0x307c('0x8')](require(_0x307c('0x9'))({'pubClient':new Redis(config[_0x307c('0xa')]),'subClient':new Redis(config[_0x307c('0xa')])}));require(_0x307c('0xb'))['default']();require(_0x307c('0xc'))[_0x307c('0xd')](socketio);require(_0x307c('0xe'))[_0x307c('0xd')](app);require('../../routes')[_0x307c('0xd')](app);}else{server[_0x307c('0xf')]('listening',function(){console[_0x307c('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x307c('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d59e1e0..173bef9 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 _0xcf53=['http','request','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client'];(function(_0x50fa47,_0x239f87){var _0x1e72a0=function(_0x54c75e){while(--_0x54c75e){_0x50fa47['push'](_0x50fa47['shift']());}};_0x1e72a0(++_0x239f87);}(_0xcf53,0x106));var _0x3cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf53[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x3cf5('0x0'));var BPromise=require(_0x3cf5('0x1'));var logger=require(_0x3cf5('0x2'))('routing');var client=jayson[_0x3cf5('0x3')][_0x3cf5('0x4')]({'port':0x2329});client['Request']=function(_0x153739,_0x4e9127){return new BPromise(function(_0xa923d7,_0x1dc603){return client[_0x3cf5('0x5')](_0x153739,_0x4e9127)['then'](function(_0x569bbc){logger[_0x3cf5('0x6')](_0x3cf5('0x7'),_0x3cf5('0x8'),_0x153739,_0x4e9127,_0x569bbc);if(_0x569bbc[_0x3cf5('0x9')]){logger[_0x3cf5('0x9')](_0x3cf5('0x7'),_0x3cf5('0x8'),_0x153739,_0x569bbc[_0x3cf5('0x9')][_0x3cf5('0xa')],_0x4e9127);return _0x1dc603(_0x569bbc[_0x3cf5('0x9')][_0x3cf5('0xa')]);}else{return _0xa923d7(_0x569bbc[_0x3cf5('0xb')]);}})[_0x3cf5('0xc')](function(_0x27bf1b){logger[_0x3cf5('0x9')]('rpc',_0x3cf5('0x8'),_0x153739,_0x27bf1b,_0x4e9127);return _0x1dc603(_0x27bf1b);});});};module[_0x3cf5('0xd')]=client; \ No newline at end of file +var _0x5db1=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5db1,0x17f));var _0x15db=function(_0x3e6301,_0x4fad31){_0x3e6301=_0x3e6301-0x0;var _0x2bb0c4=_0x5db1[_0x3e6301];return _0x2bb0c4;};'use strict';var jayson=require(_0x15db('0x0'));var BPromise=require(_0x15db('0x1'));var logger=require(_0x15db('0x2'))(_0x15db('0x3'));var client=jayson[_0x15db('0x4')][_0x15db('0x5')]({'port':0x2329});client[_0x15db('0x6')]=function(_0x562362,_0x57d3c2){return new BPromise(function(_0x3e0ee7,_0x3c70b8){return client[_0x15db('0x7')](_0x562362,_0x57d3c2)[_0x15db('0x8')](function(_0xa1cdcb){logger[_0x15db('0x9')]('rpc',_0x15db('0x3'),_0x562362,_0x57d3c2,_0xa1cdcb);if(_0xa1cdcb[_0x15db('0xa')]){logger[_0x15db('0xa')](_0x15db('0xb'),_0x15db('0x3'),_0x562362,_0xa1cdcb['error'][_0x15db('0xc')],_0x57d3c2);return _0x3c70b8(_0xa1cdcb['error'][_0x15db('0xc')]);}else{return _0x3e0ee7(_0xa1cdcb[_0x15db('0xd')]);}})[_0x15db('0xe')](function(_0x583f9f){logger[_0x15db('0xa')](_0x15db('0xb'),'routing',_0x562362,_0x583f9f,_0x57d3c2);return _0x3c70b8(_0x583f9f);});});};module[_0x15db('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 3349783..95f75f6 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 _0x6f56=['getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals'];(function(_0xbc65dc,_0x379208){var _0xafb4=function(_0x3655a9){while(--_0x3655a9){_0xbc65dc['push'](_0xbc65dc['shift']());}};_0xafb4(++_0x379208);}(_0x6f56,0x14f));var _0x66f5=function(_0x27d9a7,_0x3635bd){_0x27d9a7=_0x27d9a7-0x0;var _0x420495=_0x6f56[_0x27d9a7];return _0x420495;};'use strict';var BPromise=require(_0x66f5('0x0'));var server=require(_0x66f5('0x1'));var Realtime=require(_0x66f5('0x2'));var user=require(_0x66f5('0x3'));var interval=require(_0x66f5('0x4'));var openchannelQueue=require(_0x66f5('0x5'));var chatQueue=require(_0x66f5('0x6'));var smsQueue=require(_0x66f5('0x7'));var mailQueue=require(_0x66f5('0x8'));var faxQueue=require(_0x66f5('0x9'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x66f5('0xa')]()[_0x66f5('0xb')](user[_0x66f5('0xc')]())[_0x66f5('0xb')](realtime[_0x66f5('0xd')]())[_0x66f5('0xb')](interval[_0x66f5('0xe')]())['then'](realtime[_0x66f5('0xf')]())['then'](openchannelQueue[_0x66f5('0x10')]())[_0x66f5('0xb')](realtime[_0x66f5('0x11')]())[_0x66f5('0xb')](chatQueue['getChatQueues']())[_0x66f5('0xb')](realtime[_0x66f5('0x12')]())[_0x66f5('0xb')](smsQueue[_0x66f5('0x13')]())[_0x66f5('0xb')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())[_0x66f5('0xb')](realtime[_0x66f5('0x14')]())['then'](faxQueue[_0x66f5('0x15')]())['then'](realtime[_0x66f5('0x16')]())['then'](whatsappQueue[_0x66f5('0x17')]())[_0x66f5('0xb')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x66f5('0x18')](realtime)[_0x66f5('0xb')](function(_0x535566){return initRealtime();})[_0x66f5('0xb')](function(_0x8286d){return setInterval(initRealtime,0x1388);})[_0x66f5('0x19')](function(_0x5caf04){console[_0x66f5('0x1a')](_0x5caf04);});}main(); \ No newline at end of file +var _0x92d4=['./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x14022a,_0x4ca101){var _0x12b439=function(_0x9f5f11){while(--_0x9f5f11){_0x14022a['push'](_0x14022a['shift']());}};_0x12b439(++_0x4ca101);}(_0x92d4,0x161));var _0x492d=function(_0x3c522e,_0x1a4b05){_0x3c522e=_0x3c522e-0x0;var _0x27cb32=_0x92d4[_0x3c522e];return _0x27cb32;};'use strict';var BPromise=require(_0x492d('0x0'));var server=require(_0x492d('0x1'));var Realtime=require(_0x492d('0x2'));var user=require(_0x492d('0x3'));var interval=require(_0x492d('0x4'));var openchannelQueue=require(_0x492d('0x5'));var chatQueue=require(_0x492d('0x6'));var smsQueue=require(_0x492d('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x492d('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x492d('0x9')]()[_0x492d('0xa')](user[_0x492d('0xb')]())[_0x492d('0xa')](realtime[_0x492d('0xc')]())['then'](interval['getIntervals']())[_0x492d('0xa')](realtime[_0x492d('0xd')]())['then'](openchannelQueue[_0x492d('0xe')]())[_0x492d('0xa')](realtime[_0x492d('0xf')]())[_0x492d('0xa')](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())['then'](smsQueue[_0x492d('0x10')]())[_0x492d('0xa')](realtime[_0x492d('0x11')]())[_0x492d('0xa')](mailQueue['getMailQueues']())[_0x492d('0xa')](realtime['initMailQueues']())[_0x492d('0xa')](faxQueue[_0x492d('0x12')]())[_0x492d('0xa')](realtime[_0x492d('0x13')]())['then'](whatsappQueue[_0x492d('0x14')]())[_0x492d('0xa')](realtime['initWhatsappQueues']())[_0x492d('0xa')](function(){return realtime;});}function main(){return server[_0x492d('0x15')](realtime)[_0x492d('0xa')](function(_0x55fe29){return initRealtime();})['then'](function(_0x508a04){return setInterval(initRealtime,0x1388);})[_0x492d('0x16')](function(_0x3c6712){console[_0x492d('0x17')](_0x3c6712);});}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 6e8ee2a..cf7f01a 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x14f925,_0x32cf82){var _0x132539=function(_0xbc7154){while(--_0xbc7154){_0x14f925['push'](_0x14f925['shift']());}};_0x132539(++_0x32cf82);}(_0x2ef3,0xba));var _0x32ef=function(_0x138eb1,_0xe58cd5){_0x138eb1=_0x138eb1-0x0;var _0xed95b5=_0x2ef3[_0x138eb1];return _0xed95b5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x32ee50,_0x564493){_0x32ee50=_0x32ee50-0x0;var _0x12a1b3=_0x1261[_0x32ee50];return _0x12a1b3;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index f9ca9c4..6c4a49d 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 _0xa264=['client','http','request','error','message','sendMailMessage','SendMail','bluebird'];(function(_0x1dbf6f,_0x59d8c3){var _0x3639cf=function(_0x59d6f6){while(--_0x59d6f6){_0x1dbf6f['push'](_0x1dbf6f['shift']());}};_0x3639cf(++_0x59d8c3);}(_0xa264,0x1d7));var _0x4a26=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa264[_0x12fc8d];return _0x3f9d04;};'use strict';var BPromise=require(_0x4a26('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x4a26('0x1')][_0x4a26('0x2')]({'port':0x232b});function request(_0x3efd5f,_0x331207){return new BPromise(function(_0xdf9dc2,_0x3ccc84){return client[_0x4a26('0x3')](_0x3efd5f,_0x331207)['then'](function(_0x5e6e4e){if(_0x5e6e4e[_0x4a26('0x4')]){return _0x3ccc84(_0x5e6e4e[_0x4a26('0x4')][_0x4a26('0x5')]);}else{return _0xdf9dc2(_0x5e6e4e['result']);}})['catch'](function(_0x4c1467){return _0x3ccc84(_0x4c1467);});});}exports[_0x4a26('0x6')]=function(_0x49e721,_0xaae23d){return request(_0x4a26('0x7'),{'account':_0x49e721,'message':_0xaae23d});}; \ No newline at end of file +var _0xa92b=['message','catch','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x2fb3be,_0x1b2e64){var _0x25e47b=function(_0x672ad3){while(--_0x672ad3){_0x2fb3be['push'](_0x2fb3be['shift']());}};_0x25e47b(++_0x1b2e64);}(_0xa92b,0x19d));var _0xba92=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0xa92b[_0x91384];return _0x44daa0;};'use strict';var BPromise=require(_0xba92('0x0'));var jayson=require(_0xba92('0x1'));var client=jayson[_0xba92('0x2')][_0xba92('0x3')]({'port':0x232b});function request(_0x5d02b0,_0x18c76b){return new BPromise(function(_0x1e33c2,_0x1234fc){return client[_0xba92('0x4')](_0x5d02b0,_0x18c76b)[_0xba92('0x5')](function(_0x2ff9e1){if(_0x2ff9e1[_0xba92('0x6')]){return _0x1234fc(_0x2ff9e1['error'][_0xba92('0x7')]);}else{return _0x1e33c2(_0x2ff9e1['result']);}})[_0xba92('0x8')](function(_0x29140e){return _0x1234fc(_0x29140e);});});}exports['sendMailMessage']=function(_0x2179f4,_0x195e1d){return request(_0xba92('0x9'),{'account':_0x2179f4,'message':_0x195e1d});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 6dd0594..b7e9e70 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 _0x32b6=['format','faxPause','mailStatusTime','faxStatus','busy','chatWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime'];(function(_0x28e5ef,_0x4e406f){var _0x128683=function(_0x189fe8){while(--_0x189fe8){_0x28e5ef['push'](_0x28e5ef['shift']());}};_0x128683(++_0x4e406f);}(_0x32b6,0x1d1));var _0x632b=function(_0x1fb4dc,_0x213d96){_0x1fb4dc=_0x1fb4dc-0x0;var _0x26a9c8=_0x32b6[_0x1fb4dc];return _0x26a9c8;};'use strict';var _=require(_0x632b('0x0'));var md5=require(_0x632b('0x1'));var moment=require('moment');var Redis=require(_0x632b('0x2'));var config=require(_0x632b('0x3'));config['redis']=_['defaults'](config[_0x632b('0x4')],{'host':_0x632b('0x5'),'port':0x18eb});var io=require(_0x632b('0x6'))(new Redis(config[_0x632b('0x4')]));function Agent(_0x1adfe6){this['id']=_0x1adfe6['id']||0x0;this[_0x632b('0x7')]=_0x1adfe6[_0x632b('0x7')]||'';this[_0x632b('0x8')]=_0x1adfe6[_0x632b('0x8')]||!![];this[_0x632b('0x9')]=_0x1adfe6['voicePause']||![];this[_0x632b('0xa')]=_0x1adfe6[_0x632b('0xa')]||![];this[_0x632b('0xb')]=_0x1adfe6[_0x632b('0xb')]||![];this['faxPause']=_0x1adfe6['faxPause']||![];this['smsPause']=_0x1adfe6[_0x632b('0xc')]||![];this['openchannelPause']=_0x1adfe6[_0x632b('0xd')]||![];this[_0x632b('0xe')]=_0x632b('0xf');this[_0x632b('0x10')]=0x0;this[_0x632b('0x11')]=_0x1adfe6[_0x632b('0x11')]||0x0;this[_0x632b('0x12')]=0x0;this[_0x632b('0x13')]=_0x632b('0xf');this['mailStatusTime']=0x0;this[_0x632b('0x14')]=_0x1adfe6[_0x632b('0x14')]||0x0;this[_0x632b('0x15')]=0x0;this['faxStatus']=_0x632b('0xf');this[_0x632b('0x16')]=0x0;this[_0x632b('0x17')]=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=0x0;this[_0x632b('0x19')]='unknown';this[_0x632b('0x1a')]=0x0;this['smsCapacity']=_0x1adfe6['smsCapacity']||0x0;this[_0x632b('0x1b')]=0x0;this['whatsappStatus']=_0x632b('0xf');this[_0x632b('0x1c')]=0x0;this[_0x632b('0x1d')]=_0x1adfe6['whatsappCapacity']||0x0;this[_0x632b('0x1e')]=0x0;this[_0x632b('0x1f')]=_0x632b('0xf');this[_0x632b('0x20')]=0x0;this['openchannelCapacity']=_0x1adfe6[_0x632b('0x21')]||0x0;this[_0x632b('0x22')]=0x0;this['busy']=![];this[_0x632b('0x23')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x632b('0x24')]={};this['mailWaitingInteractions']={};this[_0x632b('0x25')]={};this[_0x632b('0x26')]={};this[_0x632b('0x27')]={};this['updateRealtime']();}Agent[_0x632b('0x28')][_0x632b('0x29')]=function(_0x59d83a){if(this[_0x59d83a+_0x632b('0x2a')]>0x0){if(this[_0x59d83a+_0x632b('0x2b')]>0x0&&this[_0x59d83a+_0x632b('0x2a')]>=this[_0x59d83a+_0x632b('0x2b')]){return _0x632b('0x2c');}else{return _0x632b('0x2d');}}else{return'idle';}};Agent['prototype'][_0x632b('0x2e')]=function(){var _0x4d3a70=[_0x632b('0x2f'),_0x632b('0x30'),'openchannel',_0x632b('0x31'),_0x632b('0x32'),_0x632b('0x33')];for(var _0x18dc8c=0x0;_0x18dc8c<_0x4d3a70[_0x632b('0x34')];_0x18dc8c+=0x1){var _0x515d74=this[_0x632b('0x29')](_0x4d3a70[_0x18dc8c]);if(this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]!==_0x515d74){this[_0x4d3a70[_0x18dc8c]+_0x632b('0x36')]=_['toNumber'](moment()[_0x632b('0x37')]('x'));}this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]=_0x515d74;}var _0x1819fa={'id':this['id'],'name':this[_0x632b('0x7')],'online':this[_0x632b('0x8')],'voicePause':this[_0x632b('0x9')],'chatPause':this[_0x632b('0xa')],'mailPause':this[_0x632b('0xb')],'smsPause':this[_0x632b('0xc')],'faxPause':this[_0x632b('0x38')],'openchannelPause':this[_0x632b('0xd')],'chatStatus':this[_0x632b('0xe')],'chatStatusTime':this[_0x632b('0x10')],'chatCapacity':this[_0x632b('0x11')],'chatCurrentCapacity':this[_0x632b('0x12')],'mailStatus':this[_0x632b('0x13')],'mailStatusTime':this[_0x632b('0x39')],'mailCapacity':this[_0x632b('0x14')],'mailCurrentCapacity':this[_0x632b('0x15')],'faxStatus':this[_0x632b('0x3a')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x632b('0x17')],'faxCurrentCapacity':this[_0x632b('0x18')],'smsStatus':this[_0x632b('0x19')],'smsStatusTime':this[_0x632b('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x632b('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x632b('0x1c')],'whatsappCapacity':this[_0x632b('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x632b('0x1f')],'openchannelStatusTime':this[_0x632b('0x20')],'openchannelCapacity':this[_0x632b('0x21')],'openchannelCurrentCapacity':this[_0x632b('0x22')],'busy':this[_0x632b('0x3b')],'busyQueue':this[_0x632b('0x23')],'chatWaitingInteractions':this[_0x632b('0x3c')],'faxWaitingInteractions':this[_0x632b('0x24')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x632b('0x26')],'whatsappWaitingInteractions':this[_0x632b('0x27')]};var _0x52872a=md5(JSON[_0x632b('0x3d')](_0x1819fa));if(this[_0x632b('0x1')]!==_0x52872a){this[_0x632b('0x1')]=_0x52872a;io[_0x632b('0x3e')](_0x632b('0x3f'),_['omit'](_0x1819fa,['online']));}};module[_0x632b('0x40')]=Agent; \ No newline at end of file +var _0x1967=['chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','openchannel','fax','sms','length','StatusTime','format','smsPause','faxStatusTime','whatsappCurrentCapacity','openchannelCurrentCapacity','faxWaitingInteractions','mailWaitingInteractions','stringify','emit','user:routing:update','omit','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0x253cbd,_0x273747){var _0x4502a4=function(_0x3a48f5){while(--_0x3a48f5){_0x253cbd['push'](_0x253cbd['shift']());}};_0x4502a4(++_0x273747);}(_0x1967,0x173));var _0x7196=function(_0x1a2b68,_0x324233){_0x1a2b68=_0x1a2b68-0x0;var _0x186fbe=_0x1967[_0x1a2b68];return _0x186fbe;};'use strict';var _=require('lodash');var md5=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var Redis=require(_0x7196('0x2'));var config=require(_0x7196('0x3'));config[_0x7196('0x4')]=_[_0x7196('0x5')](config[_0x7196('0x4')],{'host':_0x7196('0x6'),'port':0x18eb});var io=require(_0x7196('0x7'))(new Redis(config[_0x7196('0x4')]));function Agent(_0x5c128f){this['id']=_0x5c128f['id']||0x0;this[_0x7196('0x8')]=_0x5c128f[_0x7196('0x8')]||'';this[_0x7196('0x9')]=_0x5c128f[_0x7196('0x9')]||!![];this[_0x7196('0xa')]=_0x5c128f[_0x7196('0xa')]||![];this['chatPause']=_0x5c128f[_0x7196('0xb')]||![];this[_0x7196('0xc')]=_0x5c128f[_0x7196('0xc')]||![];this[_0x7196('0xd')]=_0x5c128f[_0x7196('0xd')]||![];this['smsPause']=_0x5c128f['smsPause']||![];this[_0x7196('0xe')]=_0x5c128f[_0x7196('0xe')]||![];this[_0x7196('0xf')]=_0x7196('0x10');this[_0x7196('0x11')]=0x0;this[_0x7196('0x12')]=_0x5c128f[_0x7196('0x12')]||0x0;this[_0x7196('0x13')]=0x0;this[_0x7196('0x14')]=_0x7196('0x10');this[_0x7196('0x15')]=0x0;this['mailCapacity']=_0x5c128f[_0x7196('0x16')]||0x0;this[_0x7196('0x17')]=0x0;this[_0x7196('0x18')]=_0x7196('0x10');this['faxStatusTime']=0x0;this[_0x7196('0x19')]=_0x5c128f['faxCapacity']||0x0;this[_0x7196('0x1a')]=0x0;this[_0x7196('0x1b')]=_0x7196('0x10');this[_0x7196('0x1c')]=0x0;this[_0x7196('0x1d')]=_0x5c128f[_0x7196('0x1d')]||0x0;this[_0x7196('0x1e')]=0x0;this[_0x7196('0x1f')]=_0x7196('0x10');this[_0x7196('0x20')]=0x0;this[_0x7196('0x21')]=_0x5c128f['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x7196('0x22')]=_0x7196('0x10');this[_0x7196('0x23')]=0x0;this['openchannelCapacity']=_0x5c128f[_0x7196('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x7196('0x25')]=undefined;this[_0x7196('0x0')]='';this[_0x7196('0x26')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this[_0x7196('0x27')]={};this[_0x7196('0x28')]={};this['whatsappWaitingInteractions']={};this[_0x7196('0x29')]();}Agent[_0x7196('0x2a')][_0x7196('0x2b')]=function(_0x18d389){if(this[_0x18d389+_0x7196('0x2c')]>0x0){if(this[_0x18d389+'Capacity']>0x0&&this[_0x18d389+_0x7196('0x2c')]>=this[_0x18d389+'Capacity']){return _0x7196('0x2d');}else{return _0x7196('0x2e');}}else{return _0x7196('0x2f');}};Agent[_0x7196('0x2a')][_0x7196('0x29')]=function(){var _0x43f6a2=['mail','chat',_0x7196('0x30'),_0x7196('0x31'),_0x7196('0x32'),'whatsapp'];for(var _0x5aa538=0x0;_0x5aa538<_0x43f6a2[_0x7196('0x33')];_0x5aa538+=0x1){var _0x162cfc=this[_0x7196('0x2b')](_0x43f6a2[_0x5aa538]);if(this[_0x43f6a2[_0x5aa538]+'Status']!==_0x162cfc){this[_0x43f6a2[_0x5aa538]+_0x7196('0x34')]=_['toNumber'](moment()[_0x7196('0x35')]('x'));}this[_0x43f6a2[_0x5aa538]+'Status']=_0x162cfc;}var _0x30151f={'id':this['id'],'name':this[_0x7196('0x8')],'online':this[_0x7196('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x7196('0xb')],'mailPause':this[_0x7196('0xc')],'smsPause':this[_0x7196('0x36')],'faxPause':this[_0x7196('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x7196('0xf')],'chatStatusTime':this[_0x7196('0x11')],'chatCapacity':this[_0x7196('0x12')],'chatCurrentCapacity':this[_0x7196('0x13')],'mailStatus':this[_0x7196('0x14')],'mailStatusTime':this[_0x7196('0x15')],'mailCapacity':this[_0x7196('0x16')],'mailCurrentCapacity':this[_0x7196('0x17')],'faxStatus':this[_0x7196('0x18')],'faxStatusTime':this[_0x7196('0x37')],'faxCapacity':this[_0x7196('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7196('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x7196('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x7196('0x1f')],'whatsappStatusTime':this[_0x7196('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7196('0x38')],'openchannelStatus':this[_0x7196('0x22')],'openchannelStatusTime':this[_0x7196('0x23')],'openchannelCapacity':this[_0x7196('0x24')],'openchannelCurrentCapacity':this[_0x7196('0x39')],'busy':this['busy'],'busyQueue':this[_0x7196('0x25')],'chatWaitingInteractions':this[_0x7196('0x26')],'faxWaitingInteractions':this[_0x7196('0x3a')],'mailWaitingInteractions':this[_0x7196('0x3b')],'openchannelWaitingInteractions':this[_0x7196('0x27')],'smsWaitingInteractions':this[_0x7196('0x28')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x23d7aa=md5(JSON[_0x7196('0x3c')](_0x30151f));if(this[_0x7196('0x0')]!==_0x23d7aa){this['md5']=_0x23d7aa;io[_0x7196('0x3d')](_0x7196('0x3e'),_[_0x7196('0x3f')](_0x30151f,[_0x7196('0x9')]));}};module[_0x7196('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a40d2f9..95c0e98 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 _0x95c0=['available','waiting','stringify','format','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','map','updateRealtime','loggedIn','online','chatPause','paused'];(function(_0x253899,_0x1bc443){var _0x34e6ee=function(_0xed2e2e){while(--_0xed2e2e){_0x253899['push'](_0x253899['shift']());}};_0x34e6ee(++_0x1bc443);}(_0x95c0,0xae));var _0x095c=function(_0x1275cb,_0x39c04c){_0x1275cb=_0x1275cb-0x0;var _0x2e4270=_0x95c0[_0x1275cb];return _0x2e4270;};'use strict';var _=require(_0x095c('0x0'));var md5=require(_0x095c('0x1'));var util=require('util');var Redis=require(_0x095c('0x2'));var config=require(_0x095c('0x3'));config[_0x095c('0x4')]=_[_0x095c('0x5')](config[_0x095c('0x4')],{'host':_0x095c('0x6'),'port':0x18eb});var io=require(_0x095c('0x7'))(new Redis(config[_0x095c('0x4')]));function ChatQueue(_0x20fe9b){this['id']=_0x20fe9b['id']||0x0;this[_0x095c('0x8')]=_0x20fe9b['name']||'';this['timeout']=_0x20fe9b[_0x095c('0x9')]||0xa;this[_0x095c('0xa')]=_0x20fe9b[_0x095c('0xa')]||_0x095c('0xb');this[_0x095c('0xc')]=_0x20fe9b[_0x095c('0xc')];this[_0x095c('0xd')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x095c('0xe')][_0x095c('0xf')]=function(){var _0x347863=this[_0x095c('0xd')]['_rr'];this[_0x095c('0xd')]=_[_0x095c('0x10')](this['Agents'],'id');this[_0x095c('0xd')]['_rr']=_0x347863;};ChatQueue[_0x095c('0xe')][_0x095c('0x11')]=function(){this[_0x095c('0x12')]=0x0;this['paused']=0x0;for(var _0x1f8a80=0x0;_0x1f8a80=0x0?this['available']:0x0;var _0x4cba23={'id':this['id'],'available':this[_0x095c('0x16')],'loggedIn':this[_0x095c('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x095c('0x17')]};var _0x4fc4a9=md5(JSON[_0x095c('0x18')](_0x4cba23));if(this[_0x095c('0x1')]!==_0x4fc4a9){this['md5']=_0x4fc4a9;io['to'](util[_0x095c('0x19')]('chat:queue:%s',_0x4cba23[_0x095c('0x8')]))[_0x095c('0x1a')]('chat_queue:save',_0x4cba23);}};module[_0x095c('0x1b')]=ChatQueue; \ No newline at end of file +var _0x7636=['emit','chat_queue:save','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','available','stringify','format'];(function(_0x4c6714,_0x2bbb93){var _0x5672bf=function(_0x82141d){while(--_0x82141d){_0x4c6714['push'](_0x4c6714['shift']());}};_0x5672bf(++_0x2bbb93);}(_0x7636,0x192));var _0x6763=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x7636[_0xb6e2ea];return _0x2a57bb;};'use strict';var _=require('lodash');var md5=require(_0x6763('0x0'));var util=require(_0x6763('0x1'));var Redis=require(_0x6763('0x2'));var config=require(_0x6763('0x3'));config['redis']=_[_0x6763('0x4')](config[_0x6763('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6763('0x6'))(new Redis(config[_0x6763('0x5')]));function ChatQueue(_0x240d14){this['id']=_0x240d14['id']||0x0;this[_0x6763('0x7')]=_0x240d14[_0x6763('0x7')]||'';this['timeout']=_0x240d14[_0x6763('0x8')]||0xa;this['strategy']=_0x240d14['strategy']||'beepall';this[_0x6763('0x9')]=_0x240d14['Agents'];this[_0x6763('0xa')]={};this[_0x6763('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x6763('0xc')][_0x6763('0xd')]=function(){var _0x5a7346=this[_0x6763('0xa')][_0x6763('0xe')];this[_0x6763('0xa')]=_['map'](this['Agents'],'id');this[_0x6763('0xa')][_0x6763('0xe')]=_0x5a7346;};ChatQueue[_0x6763('0xc')][_0x6763('0xf')]=function(){this[_0x6763('0x10')]=0x0;this[_0x6763('0x11')]=0x0;for(var _0xcee55c=0x0;_0xcee55c=0x0?this['available']:0x0;var _0x37a1fe={'id':this['id'],'available':this[_0x6763('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x6763('0x7')],'paused':this[_0x6763('0x11')],'waiting':this[_0x6763('0xb')]};var _0x2c0e9e=md5(JSON[_0x6763('0x15')](_0x37a1fe));if(this[_0x6763('0x0')]!==_0x2c0e9e){this[_0x6763('0x0')]=_0x2c0e9e;io['to'](util[_0x6763('0x16')]('chat:queue:%s',_0x37a1fe['name']))[_0x6763('0x17')](_0x6763('0x18'),_0x37a1fe);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1457a20..622f6ae 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 _0xa798=['lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','_rr','map','Agents','prototype','paused','length','online','faxPause','available','loggedIn','format','fax:queue:%s','fax_queue:save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa798,0x1b0));var _0x8a79=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xa798[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x8a79('0x0'));var md5=require(_0x8a79('0x1'));var util=require(_0x8a79('0x2'));var Redis=require('ioredis');var config=require(_0x8a79('0x3'));config[_0x8a79('0x4')]=_[_0x8a79('0x5')](config[_0x8a79('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8a79('0x6'))(new Redis(config[_0x8a79('0x4')]));function FaxQueue(_0x32323a){this['id']=_0x32323a['id']||0x0;this[_0x8a79('0x7')]=_0x32323a[_0x8a79('0x7')]||'';this[_0x8a79('0x8')]=_0x32323a[_0x8a79('0x8')]||0xa;this[_0x8a79('0x9')]=_0x32323a[_0x8a79('0x9')]||_0x8a79('0xa');this['Agents']=_0x32323a['Agents'];this[_0x8a79('0xb')]={};this[_0x8a79('0xc')]=0x0;this[_0x8a79('0x1')]='';this[_0x8a79('0xd')]();this['updateRealtime']();}FaxQueue['prototype'][_0x8a79('0xd')]=function(){var _0x439edf=this[_0x8a79('0xb')][_0x8a79('0xe')];this[_0x8a79('0xb')]=_[_0x8a79('0xf')](this[_0x8a79('0x10')],'id');this['mapAgentsId']['_rr']=_0x439edf;};FaxQueue[_0x8a79('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8a79('0x12')]=0x0;for(var _0x13c52f=0x0;_0x13c52f=0x0?this[_0x8a79('0x16')]:0x0;var _0x2c96f9={'id':this['id'],'available':this[_0x8a79('0x16')],'loggedIn':this[_0x8a79('0x17')],'name':this[_0x8a79('0x7')],'paused':this[_0x8a79('0x12')],'waiting':this[_0x8a79('0xc')]};var _0x2fe5ac=md5(JSON['stringify'](_0x2c96f9));if(this[_0x8a79('0x1')]!==_0x2fe5ac){this[_0x8a79('0x1')]=_0x2fe5ac;io['to'](util[_0x8a79('0x18')](_0x8a79('0x19'),_0x2c96f9['name']))['emit'](_0x8a79('0x1a'),_0x2c96f9);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xa040=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x4dea03,_0x8c81cb){var _0x5c21f2=function(_0x24a98c){while(--_0x24a98c){_0x4dea03['push'](_0x4dea03['shift']());}};_0x5c21f2(++_0x8c81cb);}(_0xa040,0x17c));var _0x0a04=function(_0xc763db,_0x49ec33){_0xc763db=_0xc763db-0x0;var _0x3d487c=_0xa040[_0xc763db];return _0x3d487c;};'use strict';var _=require(_0x0a04('0x0'));var md5=require(_0x0a04('0x1'));var util=require(_0x0a04('0x2'));var Redis=require('ioredis');var config=require(_0x0a04('0x3'));config[_0x0a04('0x4')]=_[_0x0a04('0x5')](config[_0x0a04('0x4')],{'host':_0x0a04('0x6'),'port':0x18eb});var io=require(_0x0a04('0x7'))(new Redis(config[_0x0a04('0x4')]));function FaxQueue(_0x5e7bce){this['id']=_0x5e7bce['id']||0x0;this[_0x0a04('0x8')]=_0x5e7bce[_0x0a04('0x8')]||'';this['timeout']=_0x5e7bce[_0x0a04('0x9')]||0xa;this[_0x0a04('0xa')]=_0x5e7bce[_0x0a04('0xa')]||_0x0a04('0xb');this[_0x0a04('0xc')]=_0x5e7bce[_0x0a04('0xc')];this[_0x0a04('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0x0a04('0xe')]();this[_0x0a04('0xf')]();}FaxQueue[_0x0a04('0x10')][_0x0a04('0xe')]=function(){var _0x3029b3=this[_0x0a04('0xd')][_0x0a04('0x11')];this[_0x0a04('0xd')]=_[_0x0a04('0x12')](this[_0x0a04('0xc')],'id');this[_0x0a04('0xd')][_0x0a04('0x11')]=_0x3029b3;};FaxQueue[_0x0a04('0x10')][_0x0a04('0xf')]=function(){this[_0x0a04('0x13')]=0x0;this[_0x0a04('0x14')]=0x0;for(var _0x1f3f92=0x0;_0x1f3f92=0x0?this[_0x0a04('0x16')]:0x0;var _0x12ca50={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x0a04('0x8')],'paused':this[_0x0a04('0x14')],'waiting':this[_0x0a04('0x17')]};var _0x3df03d=md5(JSON[_0x0a04('0x18')](_0x12ca50));if(this[_0x0a04('0x1')]!==_0x3df03d){this[_0x0a04('0x1')]=_0x3df03d;io['to'](util[_0x0a04('0x19')](_0x0a04('0x1a'),_0x12ca50['name']))[_0x0a04('0x1b')](_0x0a04('0x1c'),_0x12ca50);}};module[_0x0a04('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index aad38a4..e736099 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 _0x2ef3=['name','Intervals','exports'];(function(_0x5f17d5,_0x1cfa09){var _0x513005=function(_0x317d86){while(--_0x317d86){_0x5f17d5['push'](_0x5f17d5['shift']());}};_0x513005(++_0x1cfa09);}(_0x2ef3,0x198));var _0x32ef=function(_0x510bdf,_0x202f47){_0x510bdf=_0x510bdf-0x0;var _0x2c0c35=_0x2ef3[_0x510bdf];return _0x2c0c35;};'use strict';function Interval(_0x3a7456){this['id']=_0x3a7456['id']||0x0;this[_0x32ef('0x0')]=_0x3a7456[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x3a7456[_0x32ef('0x1')]||{};}module[_0x32ef('0x2')]=Interval; \ No newline at end of file +var _0x91d6=['exports','name','Intervals'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x91d6,0x103));var _0x691d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x91d6[_0x16d10f];return _0x50c823;};'use strict';function Interval(_0x5cec16){this['id']=_0x5cec16['id']||0x0;this[_0x691d('0x0')]=_0x5cec16[_0x691d('0x0')]||'';this[_0x691d('0x1')]=_0x5cec16[_0x691d('0x1')]||{};}module[_0x691d('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 05812b5..d3f0257 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 _0x9222=['mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x248f6b,_0x401324){var _0x54b829=function(_0x51ad90){while(--_0x51ad90){_0x248f6b['push'](_0x248f6b['shift']());}};_0x54b829(++_0x401324);}(_0x9222,0x15d));var _0x2922=function(_0x4204f3,_0x46c923){_0x4204f3=_0x4204f3-0x0;var _0x3de0e6=_0x9222[_0x4204f3];return _0x3de0e6;};'use strict';var _=require(_0x2922('0x0'));var md5=require('md5');var util=require(_0x2922('0x1'));var Redis=require(_0x2922('0x2'));var config=require(_0x2922('0x3'));config[_0x2922('0x4')]=_[_0x2922('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2922('0x6'))(new Redis(config[_0x2922('0x4')]));function MailQueue(_0x28f46b){this['id']=_0x28f46b['id']||0x0;this[_0x2922('0x7')]=_0x28f46b[_0x2922('0x7')]||'';this[_0x2922('0x8')]=_0x28f46b[_0x2922('0x8')]||0xa;this[_0x2922('0x9')]=_0x28f46b[_0x2922('0x9')]||'beepall';this[_0x2922('0xa')]=_0x28f46b[_0x2922('0xa')];this[_0x2922('0xb')]={};this['waiting']=0x0;this[_0x2922('0xc')]='';this[_0x2922('0xd')]();this[_0x2922('0xe')]();}MailQueue[_0x2922('0xf')][_0x2922('0xd')]=function(){var _0x374442=this[_0x2922('0xb')][_0x2922('0x10')];this[_0x2922('0xb')]=_[_0x2922('0x11')](this[_0x2922('0xa')],'id');this[_0x2922('0xb')]['_rr']=_0x374442;};MailQueue[_0x2922('0xf')][_0x2922('0xe')]=function(){this[_0x2922('0x12')]=0x0;this[_0x2922('0x13')]=0x0;for(var _0x231844=0x0;_0x231844=0x0?this[_0x2922('0x16')]:0x0;var _0x32ea09={'id':this['id'],'available':this[_0x2922('0x16')],'loggedIn':this[_0x2922('0x12')],'name':this[_0x2922('0x7')],'paused':this[_0x2922('0x13')],'waiting':this[_0x2922('0x17')]};var _0x5282e5=md5(JSON[_0x2922('0x18')](_0x32ea09));if(this[_0x2922('0xc')]!==_0x5282e5){this[_0x2922('0xc')]=_0x5282e5;io['to'](util[_0x2922('0x19')](_0x2922('0x1a'),_0x32ea09[_0x2922('0x7')]))[_0x2922('0x1b')](_0x2922('0x1c'),_0x32ea09);}};module[_0x2922('0x1d')]=MailQueue; \ No newline at end of file +var _0x39f4=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39f4,0x185));var _0x439f=function(_0x382d32,_0x2414bc){_0x382d32=_0x382d32-0x0;var _0x1fb3f8=_0x39f4[_0x382d32];return _0x1fb3f8;};'use strict';var _=require('lodash');var md5=require(_0x439f('0x0'));var util=require(_0x439f('0x1'));var Redis=require(_0x439f('0x2'));var config=require(_0x439f('0x3'));config['redis']=_['defaults'](config[_0x439f('0x4')],{'host':_0x439f('0x5'),'port':0x18eb});var io=require(_0x439f('0x6'))(new Redis(config[_0x439f('0x4')]));function MailQueue(_0x2008bb){this['id']=_0x2008bb['id']||0x0;this[_0x439f('0x7')]=_0x2008bb[_0x439f('0x7')]||'';this[_0x439f('0x8')]=_0x2008bb[_0x439f('0x8')]||0xa;this[_0x439f('0x9')]=_0x2008bb[_0x439f('0x9')]||_0x439f('0xa');this['Agents']=_0x2008bb[_0x439f('0xb')];this[_0x439f('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x439f('0xd')]();this[_0x439f('0xe')]();}MailQueue[_0x439f('0xf')][_0x439f('0xd')]=function(){var _0x288bfc=this['mapAgentsId'][_0x439f('0x10')];this['mapAgentsId']=_[_0x439f('0x11')](this['Agents'],'id');this[_0x439f('0xc')]['_rr']=_0x288bfc;};MailQueue[_0x439f('0xf')][_0x439f('0xe')]=function(){this[_0x439f('0x12')]=0x0;this[_0x439f('0x13')]=0x0;for(var _0x4a81c1=0x0;_0x4a81c1=0x0?this[_0x439f('0x17')]:0x0;var _0x51b5d5={'id':this['id'],'available':this[_0x439f('0x17')],'loggedIn':this[_0x439f('0x12')],'name':this[_0x439f('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3fdbc3=md5(JSON[_0x439f('0x18')](_0x51b5d5));if(this[_0x439f('0x0')]!==_0x3fdbc3){this['md5']=_0x3fdbc3;io['to'](util[_0x439f('0x19')](_0x439f('0x1a'),_0x51b5d5[_0x439f('0x7')]))[_0x439f('0x1b')](_0x439f('0x1c'),_0x51b5d5);}};module[_0x439f('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index eba5974..76dc933 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x1261,0x144));var _0x1126=function(_0x17dd1d,_0x31f1b5){_0x17dd1d=_0x17dd1d-0x0;var _0x5e9d0c=_0x1261[_0x17dd1d];return _0x5e9d0c;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +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(_0x5ca82d,_0x7d11a0){var _0x397661=function(_0x4ce955){while(--_0x4ce955){_0x5ca82d['push'](_0x5ca82d['shift']());}};_0x397661(++_0x7d11a0);}(_0xadb5,0xad));var _0x5adb=function(_0x31f675,_0x27e338){_0x31f675=_0x31f675-0x0;var _0x274525=_0xadb5[_0x31f675];return _0x274525;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 678f1eb..d7ce698 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 _0x17ba=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','smsPause','paused','available','waiting','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x37c468,_0xa00257){var _0x28382d=function(_0x2f5c32){while(--_0x2f5c32){_0x37c468['push'](_0x37c468['shift']());}};_0x28382d(++_0xa00257);}(_0x17ba,0xab));var _0xa17b=function(_0xb1636e,_0x47afdf){_0xb1636e=_0xb1636e-0x0;var _0x509d68=_0x17ba[_0xb1636e];return _0x509d68;};'use strict';var _=require(_0xa17b('0x0'));var md5=require(_0xa17b('0x1'));var util=require('util');var Redis=require(_0xa17b('0x2'));var config=require(_0xa17b('0x3'));config[_0xa17b('0x4')]=_[_0xa17b('0x5')](config[_0xa17b('0x4')],{'host':_0xa17b('0x6'),'port':0x18eb});var io=require(_0xa17b('0x7'))(new Redis(config[_0xa17b('0x4')]));function SmsQueue(_0x1dc353){this['id']=_0x1dc353['id']||0x0;this[_0xa17b('0x8')]=_0x1dc353[_0xa17b('0x8')]||'';this[_0xa17b('0x9')]=_0x1dc353[_0xa17b('0x9')]||0xa;this[_0xa17b('0xa')]=_0x1dc353[_0xa17b('0xa')]||_0xa17b('0xb');this[_0xa17b('0xc')]=_0x1dc353[_0xa17b('0xc')];this[_0xa17b('0xd')]={};this['waiting']=0x0;this[_0xa17b('0x1')]='';this[_0xa17b('0xe')]();this[_0xa17b('0xf')]();}SmsQueue[_0xa17b('0x10')][_0xa17b('0xe')]=function(){var _0x4382df=this[_0xa17b('0xd')]['_rr'];this[_0xa17b('0xd')]=_[_0xa17b('0x11')](this[_0xa17b('0xc')],'id');this['mapAgentsId'][_0xa17b('0x12')]=_0x4382df;};SmsQueue[_0xa17b('0x10')][_0xa17b('0xf')]=function(){this[_0xa17b('0x13')]=0x0;this['paused']=0x0;for(var _0x117ad9=0x0;_0x117ad9=0x0?this[_0xa17b('0x17')]:0x0;var _0x197237={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa17b('0x13')],'name':this[_0xa17b('0x8')],'paused':this[_0xa17b('0x16')],'waiting':this[_0xa17b('0x18')]};var _0x2a340d=md5(JSON[_0xa17b('0x19')](_0x197237));if(this[_0xa17b('0x1')]!==_0x2a340d){this['md5']=_0x2a340d;io['to'](util[_0xa17b('0x1a')](_0xa17b('0x1b'),_0x197237[_0xa17b('0x8')]))['emit'](_0xa17b('0x1c'),_0x197237);}};module[_0xa17b('0x1d')]=SmsQueue; \ No newline at end of file +var _0x55e0=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','loggedIn','smsPause','available','name','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents'];(function(_0x34dadf,_0x21dfb8){var _0x2dc59b=function(_0x335b01){while(--_0x335b01){_0x34dadf['push'](_0x34dadf['shift']());}};_0x2dc59b(++_0x21dfb8);}(_0x55e0,0xdc));var _0x055e=function(_0x436641,_0x4afca2){_0x436641=_0x436641-0x0;var _0x29e38f=_0x55e0[_0x436641];return _0x29e38f;};'use strict';var _=require(_0x055e('0x0'));var md5=require(_0x055e('0x1'));var util=require(_0x055e('0x2'));var Redis=require(_0x055e('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x055e('0x4')](config[_0x055e('0x5')],{'host':_0x055e('0x6'),'port':0x18eb});var io=require(_0x055e('0x7'))(new Redis(config[_0x055e('0x5')]));function SmsQueue(_0x196394){this['id']=_0x196394['id']||0x0;this['name']=_0x196394['name']||'';this[_0x055e('0x8')]=_0x196394['timeout']||0xa;this[_0x055e('0x9')]=_0x196394[_0x055e('0x9')]||_0x055e('0xa');this[_0x055e('0xb')]=_0x196394[_0x055e('0xb')];this['mapAgentsId']={};this[_0x055e('0xc')]=0x0;this[_0x055e('0x1')]='';this[_0x055e('0xd')]();this[_0x055e('0xe')]();}SmsQueue[_0x055e('0xf')]['updateRouting']=function(){var _0x56c78a=this[_0x055e('0x10')]['_rr'];this[_0x055e('0x10')]=_[_0x055e('0x11')](this[_0x055e('0xb')],'id');this[_0x055e('0x10')][_0x055e('0x12')]=_0x56c78a;};SmsQueue[_0x055e('0xf')][_0x055e('0xe')]=function(){this['loggedIn']=0x0;this[_0x055e('0x13')]=0x0;for(var _0xb80d83=0x0;_0xb80d83=0x0?this['available']:0x0;var _0x36ef10={'id':this['id'],'available':this[_0x055e('0x17')],'loggedIn':this[_0x055e('0x15')],'name':this[_0x055e('0x18')],'paused':this['paused'],'waiting':this[_0x055e('0xc')]};var _0x3cdd68=md5(JSON['stringify'](_0x36ef10));if(this[_0x055e('0x1')]!==_0x3cdd68){this[_0x055e('0x1')]=_0x3cdd68;io['to'](util[_0x055e('0x19')](_0x055e('0x1a'),_0x36ef10[_0x055e('0x18')]))[_0x055e('0x1b')]('sms_queue:save',_0x36ef10);}};module[_0x055e('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 6393084..2da66ed 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 _0x0bbe=['mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','whatsappPause','paused','available','format','whatsapp:queue:%s','emit','exports','ioredis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents'];(function(_0x39650f,_0x591e64){var _0x529282=function(_0xdcc474){while(--_0xdcc474){_0x39650f['push'](_0x39650f['shift']());}};_0x529282(++_0x591e64);}(_0x0bbe,0xf2));var _0xe0bb=function(_0x1b48dc,_0x4aa730){_0x1b48dc=_0x1b48dc-0x0;var _0x4c8b42=_0x0bbe[_0x1b48dc];return _0x4c8b42;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xe0bb('0x0'));var config=require('../../../config/environment');config['redis']=_[_0xe0bb('0x1')](config['redis'],{'host':_0xe0bb('0x2'),'port':0x18eb});var io=require(_0xe0bb('0x3'))(new Redis(config['redis']));function WhatsappQueue(_0x2795ea){this['id']=_0x2795ea['id']||0x0;this['name']=_0x2795ea[_0xe0bb('0x4')]||'';this['timeout']=_0x2795ea['timeout']||0xa;this[_0xe0bb('0x5')]=_0x2795ea['strategy']||_0xe0bb('0x6');this[_0xe0bb('0x7')]=_0x2795ea[_0xe0bb('0x7')];this[_0xe0bb('0x8')]={};this[_0xe0bb('0x9')]=0x0;this[_0xe0bb('0xa')]='';this['updateRouting']();this[_0xe0bb('0xb')]();}WhatsappQueue[_0xe0bb('0xc')][_0xe0bb('0xd')]=function(){var _0x2f83aa=this[_0xe0bb('0x8')]['_rr'];this[_0xe0bb('0x8')]=_[_0xe0bb('0xe')](this['Agents'],'id');this['mapAgentsId'][_0xe0bb('0xf')]=_0x2f83aa;};WhatsappQueue[_0xe0bb('0xc')][_0xe0bb('0xb')]=function(){this[_0xe0bb('0x10')]=0x0;this['paused']=0x0;for(var _0x5236e1=0x0;_0x5236e1=0x0?this[_0xe0bb('0x14')]:0x0;var _0x268a8d={'id':this['id'],'available':this[_0xe0bb('0x14')],'loggedIn':this[_0xe0bb('0x10')],'name':this['name'],'paused':this[_0xe0bb('0x13')],'waiting':this[_0xe0bb('0x9')]};var _0x541b27=md5(JSON['stringify'](_0x268a8d));if(this[_0xe0bb('0xa')]!==_0x541b27){this[_0xe0bb('0xa')]=_0x541b27;io['to'](util[_0xe0bb('0x15')](_0xe0bb('0x16'),_0x268a8d['name']))[_0xe0bb('0x17')]('whatsapp_queue:save',_0x268a8d);}};module[_0xe0bb('0x18')]=WhatsappQueue; \ No newline at end of file +var _0xb734=['available','name','stringify','format','whatsapp:queue:%s','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','updateRealtime','loggedIn','length','online','whatsappPause','paused'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb734,0x165));var _0x4b73=function(_0x2c753c,_0x3378e7){_0x2c753c=_0x2c753c-0x0;var _0x23ba20=_0xb734[_0x2c753c];return _0x23ba20;};'use strict';var _=require('lodash');var md5=require(_0x4b73('0x0'));var util=require(_0x4b73('0x1'));var Redis=require(_0x4b73('0x2'));var config=require(_0x4b73('0x3'));config[_0x4b73('0x4')]=_[_0x4b73('0x5')](config[_0x4b73('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4b73('0x6'))(new Redis(config[_0x4b73('0x4')]));function WhatsappQueue(_0x50d4ee){this['id']=_0x50d4ee['id']||0x0;this['name']=_0x50d4ee['name']||'';this[_0x4b73('0x7')]=_0x50d4ee[_0x4b73('0x7')]||0xa;this[_0x4b73('0x8')]=_0x50d4ee[_0x4b73('0x8')]||_0x4b73('0x9');this['Agents']=_0x50d4ee[_0x4b73('0xa')];this[_0x4b73('0xb')]={};this[_0x4b73('0xc')]=0x0;this[_0x4b73('0x0')]='';this[_0x4b73('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x2938f1=this[_0x4b73('0xb')]['_rr'];this[_0x4b73('0xb')]=_['map'](this[_0x4b73('0xa')],'id');this[_0x4b73('0xb')][_0x4b73('0xe')]=_0x2938f1;};WhatsappQueue['prototype'][_0x4b73('0xf')]=function(){this[_0x4b73('0x10')]=0x0;this['paused']=0x0;for(var _0x4d3447=0x0;_0x4d3447=0x0?this['available']:0x0;var _0xe6e36f={'id':this['id'],'available':this[_0x4b73('0x15')],'loggedIn':this[_0x4b73('0x10')],'name':this[_0x4b73('0x16')],'paused':this[_0x4b73('0x14')],'waiting':this[_0x4b73('0xc')]};var _0x2ebc98=md5(JSON[_0x4b73('0x17')](_0xe6e36f));if(this[_0x4b73('0x0')]!==_0x2ebc98){this[_0x4b73('0x0')]=_0x2ebc98;io['to'](util[_0x4b73('0x18')](_0x4b73('0x19'),_0xe6e36f['name']))['emit']('whatsapp_queue:save',_0xe6e36f);}};module[_0x4b73('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 49a74b8..ce069c5 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x4d708f,_0x27bb02){var _0x3983e8=function(_0x58dc8f){while(--_0x58dc8f){_0x4d708f['push'](_0x4d708f['shift']());}};_0x3983e8(++_0x27bb02);}(_0xb10b,0x12a));var _0xbb10=function(_0x56c7c0,_0x463d97){_0x56c7c0=_0x56c7c0-0x0;var _0x666b9a=_0xb10b[_0x56c7c0];return _0x666b9a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d9147b7..2bd5a88 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 _0x2d30=['../client','update','Request','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0xd12f88,_0x441890){var _0x1db5b0=function(_0xd0263){while(--_0xd0263){_0xd12f88['push'](_0xd12f88['shift']());}};_0x1db5b0(++_0x441890);}(_0x2d30,0x174));var _0x02d3=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x2d30[_0x4a6156];return _0x12c1f6;};'use strict';var client=require(_0x02d3('0x0'));exports[_0x02d3('0x1')]=function(_0x2ef42d,_0x16bddd){return client[_0x02d3('0x2')]('UpdateChatInteraction',{'body':_0x16bddd,'options':{'where':{'id':_0x2ef42d}},'log':_0x02d3('0x3')});};exports[_0x02d3('0x4')]=function(_0x195149,_0x43bb42){return client[_0x02d3('0x2')]('AddTagsToChatInteraction',{'body':_0x43bb42,'options':{'where':{'id':_0x195149}},'log':_0x02d3('0x5')});}; \ No newline at end of file +var _0x6d14=['updateChatInteraction','addTags','../client','update','Request','UpdateChatInteraction'];(function(_0x90c02,_0x8df543){var _0x3a3c05=function(_0x6ad79e){while(--_0x6ad79e){_0x90c02['push'](_0x90c02['shift']());}};_0x3a3c05(++_0x8df543);}(_0x6d14,0xce));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x46d1('0x0'));exports[_0x46d1('0x1')]=function(_0x1e1d3d,_0x36cc49){return client[_0x46d1('0x2')](_0x46d1('0x3'),{'body':_0x36cc49,'options':{'where':{'id':_0x1e1d3d}},'log':_0x46d1('0x4')});};exports[_0x46d1('0x5')]=function(_0x3430c5,_0x4c87d0){return client[_0x46d1('0x2')]('AddTagsToChatInteraction',{'body':_0x4c87d0,'options':{'where':{'id':_0x3430c5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 136f397..204986f 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 _0x156a=['Request','createChatMessage','../client','create'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x156a,0x82));var _0xa156=function(_0x403f87,_0xcb6f55){_0x403f87=_0x403f87-0x0;var _0x499961=_0x156a[_0x403f87];return _0x499961;};'use strict';var client=require(_0xa156('0x0'));exports[_0xa156('0x1')]=function(_0x55b62e){return client[_0xa156('0x2')]('CreateChatMessage',{'body':_0x55b62e,'log':_0xa156('0x3')});}; \ No newline at end of file +var _0x1d70=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x510b08,_0x2c7671){var _0x2cde91=function(_0xc0702a){while(--_0xc0702a){_0x510b08['push'](_0x510b08['shift']());}};_0x2cde91(++_0x2c7671);}(_0x1d70,0x1de));var _0x01d7=function(_0xd2c45d,_0x4f303b){_0xd2c45d=_0xd2c45d-0x0;var _0x2fb10c=_0x1d70[_0xd2c45d];return _0x2fb10c;};'use strict';var client=require(_0x01d7('0x0'));exports[_0x01d7('0x1')]=function(_0x482a28){return client[_0x01d7('0x2')](_0x01d7('0x3'),{'body':_0x482a28,'log':_0x01d7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 24c22d2..73071fe 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 _0x6075=['timeout','strategy','User','Agents','chatPause','getChatQueues','Request','GetChatQueue','name'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x6075,0x191));var _0x5607=function(_0x321f1e,_0x28b6e1){_0x321f1e=_0x321f1e-0x0;var _0x1a3fd8=_0x6075[_0x321f1e];return _0x1a3fd8;};'use strict';var client=require('../client');exports[_0x5607('0x0')]=function(){return function(){return client[_0x5607('0x1')](_0x5607('0x2'),{'options':{'raw':![],'attributes':['id',_0x5607('0x3'),_0x5607('0x4'),_0x5607('0x5')],'include':[{'model':_0x5607('0x6'),'as':_0x5607('0x7'),'attributes':['id',_0x5607('0x3'),'online',_0x5607('0x8')]}]},'log':_0x5607('0x0')});};}; \ No newline at end of file +var _0xea44=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','name','online'];(function(_0x1d70b9,_0x39fd1b){var _0xfc3e9f=function(_0x37c32d){while(--_0x37c32d){_0x1d70b9['push'](_0x1d70b9['shift']());}};_0xfc3e9f(++_0x39fd1b);}(_0xea44,0x1a5));var _0x4ea4=function(_0xb64fb5,_0x196555){_0xb64fb5=_0xb64fb5-0x0;var _0x55dbd5=_0xea44[_0xb64fb5];return _0x55dbd5;};'use strict';var client=require(_0x4ea4('0x0'));exports[_0x4ea4('0x1')]=function(){return function(){return client[_0x4ea4('0x2')](_0x4ea4('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4ea4('0x4'),_0x4ea4('0x5')],'include':[{'model':'User','as':_0x4ea4('0x6'),'attributes':['id',_0x4ea4('0x7'),_0x4ea4('0x8'),_0x4ea4('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9cb815d..86710e6 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 _0xb717=['update','Request','UpdateChatQueueReport','DESC','../client','CreateChatQueueReport'];(function(_0x3d8fe3,_0x4ae668){var _0x24fbd1=function(_0x1d8715){while(--_0x1d8715){_0x3d8fe3['push'](_0x3d8fe3['shift']());}};_0x24fbd1(++_0x4ae668);}(_0xb717,0x1b4));var _0x7b71=function(_0x59f860,_0x24716c){_0x59f860=_0x59f860-0x0;var _0x2d558a=_0xb717[_0x59f860];return _0x2d558a;};'use strict';var client=require(_0x7b71('0x0'));exports['create']=function(_0x161237){return client['Request'](_0x7b71('0x1'),{'body':_0x161237,'log':_0x7b71('0x1')});};exports[_0x7b71('0x2')]=function(_0x52c5dd,_0x238319){return client[_0x7b71('0x3')](_0x7b71('0x4'),{'body':_0x238319,'options':{'where':{'uniqueid':_0x52c5dd},'order':[['id',_0x7b71('0x5')]],'limit':0x1},'log':_0x7b71('0x4')});}; \ No newline at end of file +var _0xe062=['Request','CreateChatQueueReport','UpdateChatQueueReport','../client','create'];(function(_0xd745e9,_0x537598){var _0x5f02a2=function(_0x475271){while(--_0x475271){_0xd745e9['push'](_0xd745e9['shift']());}};_0x5f02a2(++_0x537598);}(_0xe062,0xd5));var _0x2e06=function(_0x4a250c,_0x19110d){_0x4a250c=_0x4a250c-0x0;var _0x276a2f=_0xe062[_0x4a250c];return _0x276a2f;};'use strict';var client=require(_0x2e06('0x0'));exports[_0x2e06('0x1')]=function(_0x4827bc){return client[_0x2e06('0x2')](_0x2e06('0x3'),{'body':_0x4827bc,'log':_0x2e06('0x3')});};exports['update']=function(_0x4d80de,_0x1a9d7d){return client[_0x2e06('0x2')]('UpdateChatQueueReport',{'body':_0x1a9d7d,'options':{'where':{'uniqueid':_0x4d80de},'order':[['id','DESC']],'limit':0x1},'log':_0x2e06('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c9f1733..b0aab0e 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(_0xb8281f,_0xd0171f){var _0xac2377=function(_0x3f3f3c){while(--_0x3f3f3c){_0xb8281f['push'](_0xb8281f['shift']());}};_0xac2377(++_0xd0171f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0x7a54,0x106));var _0x47a5=function(_0x27c6de,_0x3d7bf9){_0x27c6de=_0x27c6de-0x0;var _0x3c8bf2=_0x7a54[_0x27c6de];return _0x3c8bf2;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ca1979f..c9d55cb 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 _0x70a9=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x56a893,_0x450ad1){var _0x4984b4=function(_0x733bde){while(--_0x733bde){_0x56a893['push'](_0x56a893['shift']());}};_0x4984b4(++_0x450ad1);}(_0x70a9,0xb5));var _0x970a=function(_0x5b6e1e,_0x453a0b){_0x5b6e1e=_0x5b6e1e-0x0;var _0x564edd=_0x70a9[_0x5b6e1e];return _0x564edd;};'use strict';var client=require(_0x970a('0x0'));exports['create']=function(_0x958b88){return client[_0x970a('0x1')](_0x970a('0x2'),{'body':_0x958b88,'log':_0x970a('0x3')});}; \ No newline at end of file +var _0xee99=['../client','Request','createFaxMessage'];(function(_0x4cfc9e,_0x319ad4){var _0x3618c9=function(_0x31b17f){while(--_0x31b17f){_0x4cfc9e['push'](_0x4cfc9e['shift']());}};_0x3618c9(++_0x319ad4);}(_0xee99,0x9c));var _0x9ee9=function(_0x52e3f5,_0x1cfd3b){_0x52e3f5=_0x52e3f5-0x0;var _0x55f48e=_0xee99[_0x52e3f5];return _0x55f48e;};'use strict';var client=require(_0x9ee9('0x0'));exports['create']=function(_0x4f5f5c){return client[_0x9ee9('0x1')]('CreateFaxMessage',{'body':_0x4f5f5c,'log':_0x9ee9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index cfe646b..82daa29 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 _0x6584=['GetFaxQueue','name','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues','Request'];(function(_0x3ef74c,_0x31030b){var _0xe05b2e=function(_0x14ef85){while(--_0x14ef85){_0x3ef74c['push'](_0x3ef74c['shift']());}};_0xe05b2e(++_0x31030b);}(_0x6584,0x15b));var _0x4658=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x6584[_0xa9a245];return _0x2d0eaa;};'use strict';var client=require(_0x4658('0x0'));exports[_0x4658('0x1')]=function(){return function(){return client[_0x4658('0x2')](_0x4658('0x3'),{'options':{'raw':![],'attributes':['id',_0x4658('0x4'),_0x4658('0x5'),_0x4658('0x6')],'include':[{'model':'User','as':_0x4658('0x7'),'attributes':['id',_0x4658('0x4'),_0x4658('0x8'),_0x4658('0x9')]}]},'log':_0x4658('0x1')});};}; \ No newline at end of file +var _0x1e6a=['name','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x4f35a4,_0x3137e2){var _0x167f59=function(_0x2f7e9c){while(--_0x2f7e9c){_0x4f35a4['push'](_0x4f35a4['shift']());}};_0x167f59(++_0x3137e2);}(_0x1e6a,0x10a));var _0xa1e6=function(_0x439b5c,_0x103291){_0x439b5c=_0x439b5c-0x0;var _0x1ec477=_0x1e6a[_0x439b5c];return _0x1ec477;};'use strict';var client=require(_0xa1e6('0x0'));exports[_0xa1e6('0x1')]=function(){return function(){return client[_0xa1e6('0x2')](_0xa1e6('0x3'),{'options':{'raw':![],'attributes':['id',_0xa1e6('0x4'),'timeout',_0xa1e6('0x5')],'include':[{'model':_0xa1e6('0x6'),'as':_0xa1e6('0x7'),'attributes':['id',_0xa1e6('0x4'),_0xa1e6('0x8'),_0xa1e6('0x9')]}]},'log':_0xa1e6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 94f2add..287e538 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 _0xca5c=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x42ea4e,_0x52167b){var _0x1a8899=function(_0x56c2fc){while(--_0x56c2fc){_0x42ea4e['push'](_0x42ea4e['shift']());}};_0x1a8899(++_0x52167b);}(_0xca5c,0xb6));var _0xcca5=function(_0x592cbc,_0x5ec030){_0x592cbc=_0x592cbc-0x0;var _0x39b8d9=_0xca5c[_0x592cbc];return _0x39b8d9;};'use strict';var client=require(_0xcca5('0x0'));exports[_0xcca5('0x1')]=function(_0x21dd18){return client[_0xcca5('0x2')](_0xcca5('0x3'),{'body':_0x21dd18,'log':_0xcca5('0x3')});};exports[_0xcca5('0x4')]=function(_0x58eca1,_0xcf07b0){return client[_0xcca5('0x2')](_0xcca5('0x5'),{'body':_0xcf07b0,'options':{'where':{'uniqueid':_0x58eca1},'order':[['id',_0xcca5('0x6')]],'limit':0x1},'log':_0xcca5('0x5')});}; \ No newline at end of file +var _0x3805=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x5b9168,_0x203c8a){var _0x1c8403=function(_0x59b381){while(--_0x59b381){_0x5b9168['push'](_0x5b9168['shift']());}};_0x1c8403(++_0x203c8a);}(_0x3805,0x111));var _0x5380=function(_0x369a41,_0x5ed95c){_0x369a41=_0x369a41-0x0;var _0x16807d=_0x3805[_0x369a41];return _0x16807d;};'use strict';var client=require(_0x5380('0x0'));exports[_0x5380('0x1')]=function(_0x40e601){return client[_0x5380('0x2')](_0x5380('0x3'),{'body':_0x40e601,'log':_0x5380('0x3')});};exports[_0x5380('0x4')]=function(_0x1b7979,_0x1a44c1){return client[_0x5380('0x2')](_0x5380('0x5'),{'body':_0x1a44c1,'options':{'where':{'uniqueid':_0x1b7979},'order':[['id','DESC']],'limit':0x1},'log':_0x5380('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2d4106e..c582ad7 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 _0xc0b8=['GetInterval','name','Interval','Intervals','interval','getIntervals','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0b8,0x1ae));var _0x8c0b=function(_0x128015,_0x118364){_0x128015=_0x128015-0x0;var _0x1c593b=_0xc0b8[_0x128015];return _0x1c593b;};'use strict';var client=require(_0x8c0b('0x0'));exports['getIntervals']=function(){return function(){return client[_0x8c0b('0x1')](_0x8c0b('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8c0b('0x3')],'include':[{'model':_0x8c0b('0x4'),'as':_0x8c0b('0x5'),'attributes':['id','name',_0x8c0b('0x6')]}]},'log':_0x8c0b('0x7')});};}; \ No newline at end of file +var _0xbc9a=['name','Interval','Intervals','interval','../client'];(function(_0x2d55ac,_0x45314d){var _0xef654a=function(_0x47a3d3){while(--_0x47a3d3){_0x2d55ac['push'](_0x2d55ac['shift']());}};_0xef654a(++_0x45314d);}(_0xbc9a,0xf4));var _0xabc9=function(_0x20dda3,_0xfcb775){_0x20dda3=_0x20dda3-0x0;var _0x547b71=_0xbc9a[_0x20dda3];return _0x547b71;};'use strict';var client=require(_0xabc9('0x0'));exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xabc9('0x1')],'include':[{'model':_0xabc9('0x2'),'as':_0xabc9('0x3'),'attributes':['id',_0xabc9('0x1'),_0xabc9('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 35e84d2..badc49b 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 _0xa456=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x2bc9e2,_0x1f4772){var _0x598e41=function(_0x5c8005){while(--_0x5c8005){_0x2bc9e2['push'](_0x2bc9e2['shift']());}};_0x598e41(++_0x1f4772);}(_0xa456,0x142));var _0x6a45=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xa456[_0x26f702];return _0x11417d;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(_0x56dfe8,_0xd5464e){return client['Request'](_0x6a45('0x2'),{'body':_0xd5464e,'options':{'where':{'id':_0x56dfe8}},'log':_0x6a45('0x3')});};exports[_0x6a45('0x4')]=function(_0x500c72,_0x1f0701){return client[_0x6a45('0x5')](_0x6a45('0x6'),{'body':_0x1f0701,'options':{'where':{'id':_0x500c72}},'log':_0x6a45('0x7')});}; \ No newline at end of file +var _0xd943=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x572011,_0xe8a4){var _0x133169=function(_0xa67968){while(--_0xa67968){_0x572011['push'](_0x572011['shift']());}};_0x133169(++_0xe8a4);}(_0xd943,0x15d));var _0x3d94=function(_0x47b5c7,_0x16c96c){_0x47b5c7=_0x47b5c7-0x0;var _0xa283f8=_0xd943[_0x47b5c7];return _0xa283f8;};'use strict';var client=require(_0x3d94('0x0'));exports[_0x3d94('0x1')]=function(_0x55353d,_0x440dd8){return client['Request'](_0x3d94('0x2'),{'body':_0x440dd8,'options':{'where':{'id':_0x55353d}},'log':_0x3d94('0x3')});};exports[_0x3d94('0x4')]=function(_0xc13b61,_0xaf8962){return client['Request']('AddTagsToMailInteraction',{'body':_0xaf8962,'options':{'where':{'id':_0xc13b61}},'log':_0x3d94('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ec4c24f..c3b33c4 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 _0xa87a=['create','CreateMailMessage','../client'];(function(_0x2a958d,_0x4e71f5){var _0x5856e4=function(_0x398747){while(--_0x398747){_0x2a958d['push'](_0x2a958d['shift']());}};_0x5856e4(++_0x4e71f5);}(_0xa87a,0x19a));var _0xaa87=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0xa87a[_0x2f9467];return _0x39894c;};'use strict';var client=require(_0xaa87('0x0'));exports[_0xaa87('0x1')]=function(_0x246568){return client['Request'](_0xaa87('0x2'),{'body':_0x246568,'log':'createMailMessage'});}; \ No newline at end of file +var _0xac2e=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xac2e,0xb0));var _0xeac2=function(_0x32825e,_0x5981c1){_0x32825e=_0x32825e-0x0;var _0x119578=_0xac2e[_0x32825e];return _0x119578;};'use strict';var client=require(_0xeac2('0x0'));exports[_0xeac2('0x1')]=function(_0x2f478b){return client['Request'](_0xeac2('0x2'),{'body':_0x2f478b,'log':_0xeac2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e0a9245..e614b38 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 _0x1e17=['strategy','online','mailPause','../client','getMailQueues','GetMailQueue','name','timeout'];(function(_0x513457,_0x597aef){var _0x24ef56=function(_0x5ee731){while(--_0x5ee731){_0x513457['push'](_0x513457['shift']());}};_0x24ef56(++_0x597aef);}(_0x1e17,0x133));var _0x71e1=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x1e17[_0xf79bae];return _0x5d2cb7;};'use strict';var client=require(_0x71e1('0x0'));exports[_0x71e1('0x1')]=function(){return function(){return client['Request'](_0x71e1('0x2'),{'options':{'raw':![],'attributes':['id',_0x71e1('0x3'),_0x71e1('0x4'),_0x71e1('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x71e1('0x3'),_0x71e1('0x6'),_0x71e1('0x7')]}]},'log':_0x71e1('0x1')});};}; \ No newline at end of file +var _0x9ba5=['Request','name','strategy','User','Agents','online','mailPause','../client','getMailQueues'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x9ba5,0x139));var _0x59ba=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9ba5[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x59ba('0x0'));exports[_0x59ba('0x1')]=function(){return function(){return client[_0x59ba('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x59ba('0x3'),'timeout',_0x59ba('0x4')],'include':[{'model':_0x59ba('0x5'),'as':_0x59ba('0x6'),'attributes':['id',_0x59ba('0x3'),_0x59ba('0x7'),_0x59ba('0x8')]}]},'log':_0x59ba('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index af6ec5a..b72f84e 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 _0x3f5a=['update','UpdateMailQueueReport','create','Request','CreateMailQueueReport'];(function(_0x2340c4,_0xafe8bf){var _0x1f66da=function(_0x440ba9){while(--_0x440ba9){_0x2340c4['push'](_0x2340c4['shift']());}};_0x1f66da(++_0xafe8bf);}(_0x3f5a,0x183));var _0xa3f5=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x3f5a[_0x492af5];return _0x59f529;};'use strict';var client=require('../client');exports[_0xa3f5('0x0')]=function(_0x19f6f1){return client[_0xa3f5('0x1')](_0xa3f5('0x2'),{'body':_0x19f6f1,'log':_0xa3f5('0x2')});};exports[_0xa3f5('0x3')]=function(_0x3987eb,_0xe25662){return client[_0xa3f5('0x1')](_0xa3f5('0x4'),{'body':_0xe25662,'options':{'where':{'uniqueid':_0x3987eb},'order':[['id','DESC']],'limit':0x1},'log':_0xa3f5('0x4')});}; \ No newline at end of file +var _0x5a2a=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','update'];(function(_0x3fe0fc,_0x17b426){var _0x2c2d40=function(_0x5b214f){while(--_0x5b214f){_0x3fe0fc['push'](_0x3fe0fc['shift']());}};_0x2c2d40(++_0x17b426);}(_0x5a2a,0x67));var _0xa5a2=function(_0x5b4b29,_0x4faa7c){_0x5b4b29=_0x5b4b29-0x0;var _0x3cc869=_0x5a2a[_0x5b4b29];return _0x3cc869;};'use strict';var client=require(_0xa5a2('0x0'));exports[_0xa5a2('0x1')]=function(_0x496b02){return client[_0xa5a2('0x2')](_0xa5a2('0x3'),{'body':_0x496b02,'log':'CreateMailQueueReport'});};exports[_0xa5a2('0x4')]=function(_0x1624b2,_0x349c18){return client[_0xa5a2('0x2')](_0xa5a2('0x5'),{'body':_0x349c18,'options':{'where':{'uniqueid':_0x1624b2},'order':[['id','DESC']],'limit':0x1},'log':_0xa5a2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0292830..a2bd6b5 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 _0x7137=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0xfc6bc0,_0x233766){var _0xdf70c4=function(_0x471951){while(--_0x471951){_0xfc6bc0['push'](_0xfc6bc0['shift']());}};_0xdf70c4(++_0x233766);}(_0x7137,0x115));var _0x7713=function(_0x1bc12f,_0x2f498a){_0x1bc12f=_0x1bc12f-0x0;var _0x362186=_0x7137[_0x1bc12f];return _0x362186;};'use strict';var client=require(_0x7713('0x0'));exports[_0x7713('0x1')]=function(_0x581e67,_0x37077f){return client[_0x7713('0x2')](_0x7713('0x3'),{'body':_0x37077f,'options':{'where':{'id':_0x581e67}},'log':_0x7713('0x4')});};exports[_0x7713('0x5')]=function(_0x545b15,_0x38c863){return client[_0x7713('0x2')](_0x7713('0x6'),{'body':_0x38c863,'options':{'where':{'id':_0x545b15}},'log':_0x7713('0x7')});}; \ No newline at end of file +var _0x5c0a=['update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x6c973d,_0xbcd1e5){var _0x2e9fea=function(_0x93282f){while(--_0x93282f){_0x6c973d['push'](_0x6c973d['shift']());}};_0x2e9fea(++_0xbcd1e5);}(_0x5c0a,0x1e9));var _0xa5c0=function(_0x549d16,_0x4d069a){_0x549d16=_0x549d16-0x0;var _0x344ccc=_0x5c0a[_0x549d16];return _0x344ccc;};'use strict';var client=require(_0xa5c0('0x0'));exports[_0xa5c0('0x1')]=function(_0x591dde,_0x192955){return client[_0xa5c0('0x2')](_0xa5c0('0x3'),{'body':_0x192955,'options':{'where':{'id':_0x591dde}},'log':'updateOpenchannelInteraction'});};exports[_0xa5c0('0x4')]=function(_0x4f14b2,_0x44c9df){return client[_0xa5c0('0x2')](_0xa5c0('0x5'),{'body':_0x44c9df,'options':{'where':{'id':_0x4f14b2}},'log':_0xa5c0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2be8df0..84683b6 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 _0x05e5=['createOpenchannelMessage','../client','Request'];(function(_0x303617,_0x5a7c5){var _0x2131ac=function(_0xcf3846){while(--_0xcf3846){_0x303617['push'](_0x303617['shift']());}};_0x2131ac(++_0x5a7c5);}(_0x05e5,0x6d));var _0x505e=function(_0x2616a5,_0x16564c){_0x2616a5=_0x2616a5-0x0;var _0x594e2b=_0x05e5[_0x2616a5];return _0x594e2b;};'use strict';var client=require(_0x505e('0x0'));exports['create']=function(_0x1f590c){return client[_0x505e('0x1')]('CreateOpenchannelMessage',{'body':_0x1f590c,'log':_0x505e('0x2')});}; \ No newline at end of file +var _0xaf80=['create','Request','createOpenchannelMessage','../client'];(function(_0xa6e519,_0x3f267b){var _0x540c5d=function(_0x1d6317){while(--_0x1d6317){_0xa6e519['push'](_0xa6e519['shift']());}};_0x540c5d(++_0x3f267b);}(_0xaf80,0x127));var _0x0af8=function(_0x2ffdcf,_0xef57a6){_0x2ffdcf=_0x2ffdcf-0x0;var _0x38d3b1=_0xaf80[_0x2ffdcf];return _0x38d3b1;};'use strict';var client=require(_0x0af8('0x0'));exports[_0x0af8('0x1')]=function(_0x2e7f6b){return client[_0x0af8('0x2')]('CreateOpenchannelMessage',{'body':_0x2e7f6b,'log':_0x0af8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d504719..28623d8 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 _0x19cf=['name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x4e0d45,_0x55f937){var _0xb25758=function(_0x18d517){while(--_0x18d517){_0x4e0d45['push'](_0x4e0d45['shift']());}};_0xb25758(++_0x55f937);}(_0x19cf,0x197));var _0xf19c=function(_0x2478c2,_0x418956){_0x2478c2=_0x2478c2-0x0;var _0x246f1e=_0x19cf[_0x2478c2];return _0x246f1e;};'use strict';var client=require(_0xf19c('0x0'));exports[_0xf19c('0x1')]=function(){return function(){return client['Request'](_0xf19c('0x2'),{'options':{'raw':![],'attributes':['id',_0xf19c('0x3'),_0xf19c('0x4'),_0xf19c('0x5')],'include':[{'model':_0xf19c('0x6'),'as':_0xf19c('0x7'),'attributes':['id',_0xf19c('0x3'),_0xf19c('0x8'),_0xf19c('0x9')]}]},'log':_0xf19c('0x1')});};}; \ No newline at end of file +var _0xce38=['User','Agents','online','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','strategy'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0xce38,0x163));var _0x8ce3=function(_0x194acc,_0x16a88a){_0x194acc=_0x194acc-0x0;var _0x2b7aab=_0xce38[_0x194acc];return _0x2b7aab;};'use strict';var client=require(_0x8ce3('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x8ce3('0x1')](_0x8ce3('0x2'),{'options':{'raw':![],'attributes':['id',_0x8ce3('0x3'),'timeout',_0x8ce3('0x4')],'include':[{'model':_0x8ce3('0x5'),'as':_0x8ce3('0x6'),'attributes':['id','name',_0x8ce3('0x7'),'openchannelPause']}]},'log':_0x8ce3('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5393dd2..12545fb 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 _0xc0d8=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xc0d8,0x6e));var _0x8c0d=function(_0x23c514,_0x13043a){_0x23c514=_0x23c514-0x0;var _0x6813b6=_0xc0d8[_0x23c514];return _0x6813b6;};'use strict';var client=require(_0x8c0d('0x0'));exports[_0x8c0d('0x1')]=function(_0x36ba0f){return client[_0x8c0d('0x2')]('CreateOpenchannelQueueReport',{'body':_0x36ba0f,'log':_0x8c0d('0x3')});};exports[_0x8c0d('0x4')]=function(_0x4d9e58,_0x4296e3){return client[_0x8c0d('0x2')](_0x8c0d('0x5'),{'body':_0x4296e3,'options':{'where':{'uniqueid':_0x4d9e58},'order':[['id',_0x8c0d('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xc1d8=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc1d8,0xec));var _0x8c1d=function(_0x3079a6,_0x4c0bf2){_0x3079a6=_0x3079a6-0x0;var _0x55cc26=_0xc1d8[_0x3079a6];return _0x55cc26;};'use strict';var client=require(_0x8c1d('0x0'));exports[_0x8c1d('0x1')]=function(_0x5d1851){return client[_0x8c1d('0x2')](_0x8c1d('0x3'),{'body':_0x5d1851,'log':_0x8c1d('0x3')});};exports['update']=function(_0x58e86f,_0x1b72ef){return client[_0x8c1d('0x2')](_0x8c1d('0x4'),{'body':_0x1b72ef,'options':{'where':{'uniqueid':_0x58e86f},'order':[['id',_0x8c1d('0x5')]],'limit':0x1},'log':_0x8c1d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index da79f30..6134c29 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 _0x7d86=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x5c7b9b,_0x47b8ca){var _0x4699fd=function(_0x3dba75){while(--_0x3dba75){_0x5c7b9b['push'](_0x5c7b9b['shift']());}};_0x4699fd(++_0x47b8ca);}(_0x7d86,0x86));var _0x67d8=function(_0x254ee7,_0x2cb964){_0x254ee7=_0x254ee7-0x0;var _0x1510b4=_0x7d86[_0x254ee7];return _0x1510b4;};'use strict';var client=require(_0x67d8('0x0'));exports['update']=function(_0xff82a6,_0x8af490){return client[_0x67d8('0x1')](_0x67d8('0x2'),{'body':_0x8af490,'options':{'where':{'id':_0xff82a6}},'log':_0x67d8('0x3')});};exports[_0x67d8('0x4')]=function(_0x3f58a1,_0x517caf){return client[_0x67d8('0x1')](_0x67d8('0x5'),{'body':_0x517caf,'options':{'where':{'id':_0x3f58a1}},'log':_0x67d8('0x6')});}; \ No newline at end of file +var _0x66fa=['../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x5d1718,_0x3c0926){var _0x1cd8ff=function(_0xd52d24){while(--_0xd52d24){_0x5d1718['push'](_0x5d1718['shift']());}};_0x1cd8ff(++_0x3c0926);}(_0x66fa,0x168));var _0xa66f=function(_0x2df231,_0x130ec1){_0x2df231=_0x2df231-0x0;var _0x21f126=_0x66fa[_0x2df231];return _0x21f126;};'use strict';var client=require(_0xa66f('0x0'));exports[_0xa66f('0x1')]=function(_0xab19a,_0x4d9703){return client['Request'](_0xa66f('0x2'),{'body':_0x4d9703,'options':{'where':{'id':_0xab19a}},'log':_0xa66f('0x3')});};exports[_0xa66f('0x4')]=function(_0x2e663b,_0x2143e6){return client[_0xa66f('0x5')](_0xa66f('0x6'),{'body':_0x2143e6,'options':{'where':{'id':_0x2e663b}},'log':_0xa66f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e31d202..023c85d 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 _0xd024=['create','Request','CreateSmsMessage'];(function(_0x78df4a,_0x133438){var _0x57a8f7=function(_0x48ea5f){while(--_0x48ea5f){_0x78df4a['push'](_0x78df4a['shift']());}};_0x57a8f7(++_0x133438);}(_0xd024,0x16b));var _0x4d02=function(_0x30aff4,_0x146e72){_0x30aff4=_0x30aff4-0x0;var _0xd95966=_0xd024[_0x30aff4];return _0xd95966;};'use strict';var client=require('../client');exports[_0x4d02('0x0')]=function(_0x44cdf7){return client[_0x4d02('0x1')](_0x4d02('0x2'),{'body':_0x44cdf7,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x9512=['create','Request','CreateSmsMessage','../client'];(function(_0x459219,_0x1cb666){var _0x36d8e1=function(_0x26ed06){while(--_0x26ed06){_0x459219['push'](_0x459219['shift']());}};_0x36d8e1(++_0x1cb666);}(_0x9512,0x17b));var _0x2951=function(_0x20a590,_0x1e8a6d){_0x20a590=_0x20a590-0x0;var _0x2e1b41=_0x9512[_0x20a590];return _0x2e1b41;};'use strict';var client=require(_0x2951('0x0'));exports[_0x2951('0x1')]=function(_0x26aa65){return client[_0x2951('0x2')](_0x2951('0x3'),{'body':_0x26aa65,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 87cf44b..34902ce 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x12170d,_0x25c5f2){var _0x27143b=function(_0x5e9856){while(--_0x5e9856){_0x12170d['push'](_0x12170d['shift']());}};_0x27143b(++_0x25c5f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x18e9ef,_0x2943ec){var _0x1b9dde=function(_0x3531d9){while(--_0x3531d9){_0x18e9ef['push'](_0x18e9ef['shift']());}};_0x1b9dde(++_0x2943ec);}(_0x70e0,0x17b));var _0x070e=function(_0x3b5e37,_0x2b4955){_0x3b5e37=_0x3b5e37-0x0;var _0x4da470=_0x70e0[_0x3b5e37];return _0x4da470;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index cd28a92..c85643c 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x460ede,_0x185eb5){var _0x31944e=function(_0xcfe7e1){while(--_0xcfe7e1){_0x460ede['push'](_0x460ede['shift']());}};_0x31944e(++_0x185eb5);}(_0x008c,0x188));var _0xc008=function(_0x345de7,_0x1de531){_0x345de7=_0x345de7-0x0;var _0x26ffc7=_0x008c[_0x345de7];return _0x26ffc7;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x134e6f,_0x58c616){var _0x519a52=function(_0xbaad8a){while(--_0xbaad8a){_0x134e6f['push'](_0x134e6f['shift']());}};_0x519a52(++_0x58c616);}(_0x70e0,0x17b));var _0x070e=function(_0xcea36,_0x4f217b){_0xcea36=_0xcea36-0x0;var _0x4fec7f=_0x70e0[_0xcea36];return _0x4fec7f;};'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 710e12e..eaaba4d 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(_0x59ce11,_0x3a0de5){var _0x4181a0=function(_0x1b7730){while(--_0x1b7730){_0x59ce11['push'](_0x59ce11['shift']());}};_0x4181a0(++_0x3a0de5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x5e906f,_0x35ad10){var _0x3d09af=function(_0x79babf){while(--_0x79babf){_0x5e906f['push'](_0x5e906f['shift']());}};_0x3d09af(++_0x35ad10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 b1c0678..32ffa8d 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 _0xb511=['../client','update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x1b618,_0x8addce){var _0x191120=function(_0x2f8c97){while(--_0x2f8c97){_0x1b618['push'](_0x1b618['shift']());}};_0x191120(++_0x8addce);}(_0xb511,0x165));var _0x1b51=function(_0x37e423,_0x44cd78){_0x37e423=_0x37e423-0x0;var _0x57a395=_0xb511[_0x37e423];return _0x57a395;};'use strict';var client=require(_0x1b51('0x0'));exports[_0x1b51('0x1')]=function(_0x15178f,_0x56baac){return client[_0x1b51('0x2')](_0x1b51('0x3'),{'body':_0x56baac,'options':{'where':{'id':_0x15178f}},'log':'updateWhatsappInteraction'});};exports[_0x1b51('0x4')]=function(_0x439eca,_0x110e7f){return client['Request'](_0x1b51('0x5'),{'body':_0x110e7f,'options':{'where':{'id':_0x439eca}},'log':_0x1b51('0x6')});}; \ No newline at end of file +var _0x0272=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x24e8ad,_0x5d151b){var _0x3b24ff=function(_0x2bd170){while(--_0x2bd170){_0x24e8ad['push'](_0x24e8ad['shift']());}};_0x3b24ff(++_0x5d151b);}(_0x0272,0x15a));var _0x2027=function(_0x5765aa,_0xaed402){_0x5765aa=_0x5765aa-0x0;var _0x258991=_0x0272[_0x5765aa];return _0x258991;};'use strict';var client=require(_0x2027('0x0'));exports[_0x2027('0x1')]=function(_0x574903,_0x434431){return client[_0x2027('0x2')](_0x2027('0x3'),{'body':_0x434431,'options':{'where':{'id':_0x574903}},'log':_0x2027('0x4')});};exports[_0x2027('0x5')]=function(_0x2ec914,_0x5844b7){return client['Request'](_0x2027('0x6'),{'body':_0x5844b7,'options':{'where':{'id':_0x2ec914}},'log':_0x2027('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5e0b1f2..a0142bb 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 _0xaeb3=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xaeb3,0x14f));var _0x3aeb=function(_0x27ba9b,_0x570bb6){_0x27ba9b=_0x27ba9b-0x0;var _0x32b62c=_0xaeb3[_0x27ba9b];return _0x32b62c;};'use strict';var client=require(_0x3aeb('0x0'));exports[_0x3aeb('0x1')]=function(_0x46be83){return client[_0x3aeb('0x2')](_0x3aeb('0x3'),{'body':_0x46be83,'log':_0x3aeb('0x4')});}; \ No newline at end of file +var _0x9443=['create','CreateWhatsappMessage','../client'];(function(_0x51f4d0,_0x323851){var _0x100df5=function(_0x33453b){while(--_0x33453b){_0x51f4d0['push'](_0x51f4d0['shift']());}};_0x100df5(++_0x323851);}(_0x9443,0x65));var _0x3944=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x9443[_0x487496];return _0x539dc8;};'use strict';var client=require(_0x3944('0x0'));exports[_0x3944('0x1')]=function(_0x37e114){return client['Request'](_0x3944('0x2'),{'body':_0x37e114,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ecba4eb..8e13139 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 _0xa500=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x90b1b1,_0x3c996d){var _0x2f23dc=function(_0x34646e){while(--_0x34646e){_0x90b1b1['push'](_0x90b1b1['shift']());}};_0x2f23dc(++_0x3c996d);}(_0xa500,0xe5));var _0x0a50=function(_0x44c868,_0xd93c33){_0x44c868=_0x44c868-0x0;var _0x368eb1=_0xa500[_0x44c868];return _0x368eb1;};'use strict';var client=require(_0x0a50('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x0a50('0x1')](_0x0a50('0x2'),{'options':{'raw':![],'attributes':['id',_0x0a50('0x3'),_0x0a50('0x4'),_0x0a50('0x5')],'include':[{'model':_0x0a50('0x6'),'as':_0x0a50('0x7'),'attributes':['id',_0x0a50('0x3'),_0x0a50('0x8'),_0x0a50('0x9')]}]},'log':_0x0a50('0xa')});};}; \ No newline at end of file +var _0x8cd5=['strategy','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x91e24e,_0x2eddb3){var _0x642ebd=function(_0x4b53c7){while(--_0x4b53c7){_0x91e24e['push'](_0x91e24e['shift']());}};_0x642ebd(++_0x2eddb3);}(_0x8cd5,0x192));var _0x58cd=function(_0x177c63,_0x3118a5){_0x177c63=_0x177c63-0x0;var _0x1e64bb=_0x8cd5[_0x177c63];return _0x1e64bb;};'use strict';var client=require(_0x58cd('0x0'));exports[_0x58cd('0x1')]=function(){return function(){return client[_0x58cd('0x2')](_0x58cd('0x3'),{'options':{'raw':![],'attributes':['id',_0x58cd('0x4'),_0x58cd('0x5'),_0x58cd('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x58cd('0x4'),'online',_0x58cd('0x7')]}]},'log':_0x58cd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a28c748..4f967aa 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 _0x89ba=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x491020,_0x597b55){var _0x503b44=function(_0x3aa5de){while(--_0x3aa5de){_0x491020['push'](_0x491020['shift']());}};_0x503b44(++_0x597b55);}(_0x89ba,0xc4));var _0xa89b=function(_0x26a169,_0x54f908){_0x26a169=_0x26a169-0x0;var _0x1f07a1=_0x89ba[_0x26a169];return _0x1f07a1;};'use strict';var client=require(_0xa89b('0x0'));exports[_0xa89b('0x1')]=function(_0x11459f){return client[_0xa89b('0x2')](_0xa89b('0x3'),{'body':_0x11459f,'log':'CreateWhatsappQueueReport'});};exports[_0xa89b('0x4')]=function(_0x35c8e2,_0x5712ab){return client[_0xa89b('0x2')]('UpdateWhatsappQueueReport',{'body':_0x5712ab,'options':{'where':{'uniqueid':_0x35c8e2},'order':[['id','DESC']],'limit':0x1},'log':_0xa89b('0x5')});}; \ No newline at end of file +var _0x9d5c=['update','Request','UpdateWhatsappQueueReport','../client','CreateWhatsappQueueReport'];(function(_0x3264b2,_0x372562){var _0x2e9256=function(_0xe39a6f){while(--_0xe39a6f){_0x3264b2['push'](_0x3264b2['shift']());}};_0x2e9256(++_0x372562);}(_0x9d5c,0x157));var _0xc9d5=function(_0x53eea7,_0x31fea8){_0x53eea7=_0x53eea7-0x0;var _0x1c2cb9=_0x9d5c[_0x53eea7];return _0x1c2cb9;};'use strict';var client=require(_0xc9d5('0x0'));exports['create']=function(_0x27daee){return client['Request'](_0xc9d5('0x1'),{'body':_0x27daee,'log':_0xc9d5('0x1')});};exports[_0xc9d5('0x2')]=function(_0x2740a0,_0x4547c7){return client[_0xc9d5('0x3')](_0xc9d5('0x4'),{'body':_0x4547c7,'options':{'where':{'uniqueid':_0x2740a0},'order':[['id','DESC']],'limit':0x1},'log':_0xc9d5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c13123d..53c2c26 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 _0x7916=['./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','error','[%s][AGENT]\x20%s','map','message','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash'];(function(_0x146d45,_0x4a5867){var _0xcee738=function(_0x3e9bc2){while(--_0x3e9bc2){_0x146d45['push'](_0x146d45['shift']());}};_0xcee738(++_0x4a5867);}(_0x7916,0x9a));var _0x6791=function(_0x148aa9,_0x421ae3){_0x148aa9=_0x148aa9-0x0;var _0x530a22=_0x7916[_0x148aa9];return _0x530a22;};'use strict';var schema=require('validate');var _=require(_0x6791('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x6791('0x1'));var queue=schema({'name':{'type':_0x6791('0x2'),'required':!![],'message':_0x6791('0x3')},'timeout':{'type':'number','message':_0x6791('0x4')}});function writeLog(_0x50c624,_0x304941,_0x1b1822){return logger[_0x6791('0x5')](util[_0x6791('0x6')](_0x6791('0x7'),_0x50c624,_0x304941[_0x6791('0x8')],_0x1b1822));}function handleFindAgent(_0xc60bbf){return function(_0x34ebff){return _0x34ebff['name']['toLowerCase']()===_0xc60bbf['toLowerCase']();};}exports[_0x6791('0x9')]=function(_0x16ec2a,_0xd5f6a0,_0x3b8e00,_0x46515c){return function(_0x529465){try{var _0x2c0033={'name':_0xd5f6a0[0x0],'timeout':_0xd5f6a0[0x1]};var _0x2996e6=queue['validate'](_0x2c0033,{'typecast':!![]});if(_0x2996e6['length']){logger[_0x6791('0xa')](_0x6791('0xb'),_0x16ec2a,_[_0x6791('0xc')](_0x2996e6,_0x6791('0xd'))['join'](',\x20'));_0x529465['stop']();}else{var _0x1ad3e5=_[_0x6791('0xe')](_0x3b8e00[_0x6791('0xf')],handleFindAgent(_0x2c0033[_0x6791('0x8')]));if(_0x1ad3e5){var _0x1644b6=(_0x2c0033[_0x6791('0x10')]||0xa)*0x3e8;var _0x377418,_0x5e22a5;var _0x233268=seqqueue[_0x6791('0x11')](_0x1644b6);_0x233268['id']=_0x16ec2a;_0x233268[_0x6791('0x12')]=_0x1644b6;_0x233268[_0x6791('0x13')]=_0x46515c[_0x6791('0x13')];writeLog(_0x16ec2a,_0x1ad3e5,util[_0x6791('0x6')](_0x6791('0x14'),_0x1644b6));_0x3b8e00[_0x6791('0x15')][_0x16ec2a]['on'](_0x6791('0x16'),function(){logger['info'](_0x6791('0x17'),_0x16ec2a);clearTimeout(_0x5e22a5);_0x5e22a5=undefined;_0x233268[_0x6791('0x18')]();if(_0x3b8e00[_0x6791('0x15')][_0x16ec2a]){delete _0x3b8e00[_0x6791('0x15')][_0x16ec2a];}_0x529465['stop']();});_0x3b8e00[_0x6791('0x15')][_0x16ec2a]['on'](_0x6791('0x19'),function(){if(_0x3b8e00[_0x6791('0x15')][_0x16ec2a]){delete _0x3b8e00[_0x6791('0x15')][_0x16ec2a];}});_0x5e22a5=setTimeout(function(){logger[_0x6791('0x5')](_0x6791('0x1a'),_0x16ec2a);clearTimeout(_0x5e22a5);_0x233268[_0x6791('0x18')]();_0x529465['next']();},_0x1644b6);strategy[_0x6791('0x1b')](_0x233268,_0x1ad3e5,_0x3b8e00,_0x46515c);}else{logger[_0x6791('0xa')](_0x6791('0x1c'),_0x16ec2a,_0x2c0033[_0x6791('0x8')]);_0x529465['stop']();}}}catch(_0x2c385c){console['log'](_0x2c385c);logger[_0x6791('0xa')](_0x6791('0x1d'),_0x16ec2a,_0x2c385c[_0x6791('0x1e')]);_0x529465['stop']();}};}; \ No newline at end of file +var _0x141d=['rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','message','find','timeout','atimeout','channel','START:%s'];(function(_0x3c60fc,_0xfede9){var _0x31a404=function(_0x103a82){while(--_0x103a82){_0x3c60fc['push'](_0x3c60fc['shift']());}};_0x31a404(++_0xfede9);}(_0x141d,0x12b));var _0xd141=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x141d[_0x5b78e8];return _0xf2c321;};'use strict';var schema=require(_0xd141('0x0'));var _=require(_0xd141('0x1'));var util=require(_0xd141('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xd141('0x3'));var strategy=require(_0xd141('0x4'));var queue=schema({'name':{'type':_0xd141('0x5'),'required':!![],'message':_0xd141('0x6')},'timeout':{'type':'number','message':_0xd141('0x7')}});function writeLog(_0x1c40ed,_0x430eba,_0x1e6b5c){return logger[_0xd141('0x8')](util[_0xd141('0x9')](_0xd141('0xa'),_0x1c40ed,_0x430eba['name'],_0x1e6b5c));}function handleFindAgent(_0x2dbbee){return function(_0x6de035){return _0x6de035[_0xd141('0xb')]['toLowerCase']()===_0x2dbbee[_0xd141('0xc')]();};}exports['consequence']=function(_0x578e20,_0x45b7c0,_0x2134c1,_0x45cec2){return function(_0x485679){try{var _0x2dd174={'name':_0x45b7c0[0x0],'timeout':_0x45b7c0[0x1]};var _0x3f1467=queue[_0xd141('0x0')](_0x2dd174,{'typecast':!![]});if(_0x3f1467['length']){logger[_0xd141('0xd')](_0xd141('0xe'),_0x578e20,_['map'](_0x3f1467,_0xd141('0xf'))['join'](',\x20'));_0x485679['stop']();}else{var _0xbe990b=_[_0xd141('0x10')](_0x2134c1['agents'],handleFindAgent(_0x2dd174[_0xd141('0xb')]));if(_0xbe990b){var _0x920c7e=(_0x2dd174[_0xd141('0x11')]||0xa)*0x3e8;var _0x4c41ce,_0x445d88;var _0x625662=seqqueue['createQueue'](_0x920c7e);_0x625662['id']=_0x578e20;_0x625662[_0xd141('0x12')]=_0x920c7e;_0x625662['channel']=_0x45cec2[_0xd141('0x13')];writeLog(_0x578e20,_0xbe990b,util[_0xd141('0x9')](_0xd141('0x14'),_0x920c7e));_0x2134c1[_0xd141('0x15')][_0x578e20]['on'](_0xd141('0x16'),function(){logger['info'](_0xd141('0x17'),_0x578e20);clearTimeout(_0x445d88);_0x445d88=undefined;_0x625662[_0xd141('0x18')]();if(_0x2134c1[_0xd141('0x15')][_0x578e20]){delete _0x2134c1[_0xd141('0x15')][_0x578e20];}_0x485679[_0xd141('0x19')]();});_0x2134c1['rules'][_0x578e20]['on'](_0xd141('0x1a'),function(){if(_0x2134c1['rules'][_0x578e20]){delete _0x2134c1['rules'][_0x578e20];}});_0x445d88=setTimeout(function(){logger[_0xd141('0x8')](_0xd141('0x1b'),_0x578e20);clearTimeout(_0x445d88);_0x625662[_0xd141('0x18')]();_0x485679[_0xd141('0x1c')]();},_0x920c7e);strategy[_0xd141('0x1d')](_0x625662,_0xbe990b,_0x2134c1,_0x45cec2);}else{logger['error'](_0xd141('0x1e'),_0x578e20,_0x2dd174['name']);_0x485679['stop']();}}}catch(_0x5f1448){console['log'](_0x5f1448);logger['error'](_0xd141('0x1f'),_0x578e20,_0x5f1448['stack']);_0x485679['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 0e057fe..00e2a64 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 _0xdfb2=['lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','error','amazonlex','dialogState','Failed','catch'];(function(_0x4b2083,_0x1140bf){var _0xc48cfe=function(_0x29a594){while(--_0x29a594){_0x4b2083['push'](_0x4b2083['shift']());}};_0xc48cfe(++_0x1140bf);}(_0xdfb2,0x149));var _0x2dfb=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xdfb2[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x2dfb('0x0'));var moment=require(_0x2dfb('0x1'));var AWS=require(_0x2dfb('0x2'));var utils=require('./utils');var logger=require(_0x2dfb('0x3'))(_0x2dfb('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2dfb('0x5')),'mailMessage':require(_0x2dfb('0x6')),'smsMessage':require(_0x2dfb('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2dfb('0x8'))};exports['consequence']=function(_0x4cf64f,_0x115278){return function(_0x50c9db){try{if(!_[_0x2dfb('0x9')](this[_0x2dfb('0xa')][_0x2dfb('0xb')])){logger[_0x2dfb('0xc')](_0x2dfb('0xd'),_0x4cf64f,_0x2dfb('0xe'));return _0x50c9db[_0x2dfb('0xf')]();}var _0x5a4449={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2dfb('0x10')](_0x2dfb('0x11')),'direction':'out'};if(this['channel']===_0x2dfb('0x12')||this[_0x2dfb('0x13')]===_0x2dfb('0x14')){_0x5a4449[_0x2dfb('0x15')]=this[_0x2dfb('0xa')][_0x2dfb('0x15')];}var _0x263187=this[_0x2dfb('0x13')];if(_0x263187===_0x2dfb('0x16')){_0x5a4449[_0x2dfb('0x17')]=this[_0x2dfb('0x18')]['id'];}else{_0x5a4449[_[_0x2dfb('0x19')](_0x263187)+_0x2dfb('0x1a')]=this[_0x2dfb('0x18')]['id'];}_0x5a4449[_[_0x2dfb('0x19')](_0x263187)+_0x2dfb('0x1b')]=this[_0x2dfb('0xa')]['id'];if(this[_0x2dfb('0xa')][_0x2dfb('0x1c')]){var _0x217a02=_0x115278[0x4];if(!_[_0x2dfb('0x1d')](_0x217a02)){_0x5a4449[_0x2dfb('0x1e')]=utils[_0x2dfb('0x1f')](_0x217a02,this);return rpc[_0x263187+_0x2dfb('0x20')][_0x2dfb('0x21')](_0x5a4449)[_0x2dfb('0x22')](function(_0x6f5b78){logger[_0x2dfb('0xc')](_0x2dfb('0xd'),_0x4cf64f,_0x5a4449[_0x2dfb('0x1e')]);})['catch'](function(_0x4e073e){logger['error'](_0x2dfb('0xd'),_0x4cf64f,JSON[_0x2dfb('0x23')](_0x4e073e));})['finally'](function(){logger[_0x2dfb('0xc')](_0x2dfb('0x24'),_0x4cf64f);_0x50c9db[_0x2dfb('0x25')]();});}else{logger[_0x2dfb('0xc')](_0x2dfb('0x26'),_0x4cf64f);_0x50c9db[_0x2dfb('0x25')]();}}else{var _0x462933=this;var _0x4ebb36=new AWS[(_0x2dfb('0x27'))]({'accessKeyId':_0x115278[0x0],'secretAccessKey':_0x115278[0x1],'region':_0x115278[0x2]});var _0x15e023={'botAlias':_0x2dfb('0x28'),'botName':_0x115278[0x3],'inputText':this[_0x2dfb('0x29')]['body'],'userId':this[_0x2dfb('0x13')]+':'+this[_0x2dfb('0xa')]['id']['toString']()};_0x4ebb36['postText'](_0x15e023,function(_0x959855,_0x43449b){if(_0x959855){logger[_0x2dfb('0x2a')](_0x2dfb('0xd'),_0x4cf64f,_0x959855[_0x2dfb('0x29')]);_0x50c9db['next']();}else if(_0x43449b&&_0x43449b[_0x2dfb('0x29')]){_0x462933[_0x2dfb('0x1e')]['amazonlex']=_0x43449b;_0x5a4449['body']=_0x43449b[_0x2dfb('0x29')];_0x5a4449['providerName']=_0x2dfb('0x2b');_0x5a4449['providerResponse']=JSON[_0x2dfb('0x23')](_0x43449b);return rpc[_0x263187+_0x2dfb('0x20')][_0x2dfb('0x21')](_0x5a4449)[_0x2dfb('0x22')](function(_0x28a612){logger[_0x2dfb('0xc')](_0x2dfb('0xd'),_0x4cf64f,_0x5a4449[_0x2dfb('0x1e')]);if(_0x43449b[_0x2dfb('0x2c')]==_0x2dfb('0x2d')){_0x50c9db[_0x2dfb('0xf')]();}else{_0x50c9db[_0x2dfb('0x25')]();}})[_0x2dfb('0x2e')](function(_0x2661c6){logger[_0x2dfb('0x2a')](_0x2dfb('0xd'),_0x4cf64f,JSON[_0x2dfb('0x23')](_0x2661c6));_0x50c9db[_0x2dfb('0xf')]();});}else{_0x50c9db[_0x2dfb('0xf')]();}});}}catch(_0x397095){logger[_0x2dfb('0x2a')](_0x2dfb('0xd'),_0x4cf64f,JSON[_0x2dfb('0x23')](_0x397095));_0x50c9db[_0x2dfb('0x25')]();}};}; \ No newline at end of file +var _0xd31e=['getMustacheRender','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','providerName','amazonlex','Message','Failed','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','isEmpty'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xd31e,0x169));var _0xed31=function(_0x364e40,_0x5bec99){_0x364e40=_0x364e40-0x0;var _0x3afd0f=_0xd31e[_0x364e40];return _0x3afd0f;};'use strict';var _=require(_0xed31('0x0'));var moment=require('moment');var AWS=require(_0xed31('0x1'));var utils=require('./utils');var logger=require(_0xed31('0x2'))(_0xed31('0x3'));var rpc={'chatMessage':require(_0xed31('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xed31('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xed31('0x6')),'whatsappMessage':require(_0xed31('0x7'))};exports['consequence']=function(_0x35cf18,_0xa3a4d0){return function(_0x13ff6c){try{if(!_['isNil'](this[_0xed31('0x8')]['UserId'])){logger[_0xed31('0x9')](_0xed31('0xa'),_0x35cf18,_0xed31('0xb'));return _0x13ff6c[_0xed31('0xc')]();}var _0x6f7c71={'ContactId':this[_0xed31('0xd')]['id'],'sentAt':moment()[_0xed31('0xe')](_0xed31('0xf')),'direction':_0xed31('0x10')};if(this[_0xed31('0x11')]===_0xed31('0x12')||this['channel']===_0xed31('0x13')){_0x6f7c71[_0xed31('0x14')]=this[_0xed31('0x8')][_0xed31('0x14')];}var _0x23adc1=this['channel'];if(_0x23adc1===_0xed31('0x15')){_0x6f7c71['ChatWebsiteId']=this['account']['id'];}else{_0x6f7c71[_[_0xed31('0x16')](_0x23adc1)+_0xed31('0x17')]=this[_0xed31('0x18')]['id'];}_0x6f7c71[_[_0xed31('0x16')](_0x23adc1)+'InteractionId']=this['interaction']['id'];if(this[_0xed31('0x8')]['created']){var _0x10f44a=_0xa3a4d0[0x4];if(!_[_0xed31('0x19')](_0x10f44a)){_0x6f7c71['body']=utils[_0xed31('0x1a')](_0x10f44a,this);return rpc[_0x23adc1+'Message'][_0xed31('0x1b')](_0x6f7c71)[_0xed31('0x1c')](function(_0x430bd9){logger[_0xed31('0x9')](_0xed31('0xa'),_0x35cf18,_0x6f7c71[_0xed31('0x1d')]);})[_0xed31('0x1e')](function(_0x4bcec7){logger[_0xed31('0x1f')](_0xed31('0xa'),_0x35cf18,JSON[_0xed31('0x20')](_0x4bcec7));})[_0xed31('0x21')](function(){logger[_0xed31('0x9')](_0xed31('0x22'),_0x35cf18);_0x13ff6c[_0xed31('0x23')]();});}else{logger[_0xed31('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x35cf18);_0x13ff6c['stop']();}}else{var _0x4e194f=this;var _0x28589a=new AWS[(_0xed31('0x24'))]({'accessKeyId':_0xa3a4d0[0x0],'secretAccessKey':_0xa3a4d0[0x1],'region':_0xa3a4d0[0x2]});var _0x1fe76f={'botAlias':_0xed31('0x25'),'botName':_0xa3a4d0[0x3],'inputText':this[_0xed31('0x26')]['body'],'userId':this[_0xed31('0x11')]+':'+this['interaction']['id']['toString']()};_0x28589a['postText'](_0x1fe76f,function(_0x377ba1,_0x41d5e8){if(_0x377ba1){logger[_0xed31('0x1f')](_0xed31('0xa'),_0x35cf18,_0x377ba1['message']);_0x13ff6c[_0xed31('0xc')]();}else if(_0x41d5e8&&_0x41d5e8['message']){_0x4e194f['body']['amazonlex']=_0x41d5e8;_0x6f7c71[_0xed31('0x1d')]=_0x41d5e8['message'];_0x6f7c71[_0xed31('0x27')]=_0xed31('0x28');_0x6f7c71['providerResponse']=JSON['stringify'](_0x41d5e8);return rpc[_0x23adc1+_0xed31('0x29')][_0xed31('0x1b')](_0x6f7c71)['then'](function(_0x3c0646){logger[_0xed31('0x9')]('[%s][AMAZONLEX]\x20%s',_0x35cf18,_0x6f7c71[_0xed31('0x1d')]);if(_0x41d5e8['dialogState']==_0xed31('0x2a')){_0x13ff6c[_0xed31('0xc')]();}else{_0x13ff6c['stop']();}})[_0xed31('0x1e')](function(_0x5430e0){logger[_0xed31('0x1f')](_0xed31('0xa'),_0x35cf18,JSON[_0xed31('0x20')](_0x5430e0));_0x13ff6c['next']();});}else{_0x13ff6c[_0xed31('0xc')]();}});}}catch(_0x49a591){logger[_0xed31('0x1f')](_0xed31('0xa'),_0x35cf18,JSON['stringify'](_0x49a591));_0x13ff6c[_0xed31('0x23')]();}};}; \ 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 c4fbf3a..40e6c9f 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 _0x1737=['AccountId','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','catch','error','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','Interaction','stop','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','channel','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x1737,0xa0));var _0x7173=function(_0x5e4b78,_0xf3825f){_0x5e4b78=_0x5e4b78-0x0;var _0xec812c=_0x1737[_0x5e4b78];return _0xec812c;};'use strict';var _=require(_0x7173('0x0'));var moment=require(_0x7173('0x1'));var utils=require('./utils');var logger=require(_0x7173('0x2'))('routing');var rpc={'chatMessage':require(_0x7173('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7173('0x4')),'faxMessage':require(_0x7173('0x5')),'whatsappMessage':require(_0x7173('0x6')),'chatInteraction':require(_0x7173('0x7')),'openchannelInteraction':require(_0x7173('0x8')),'mailInteraction':require(_0x7173('0x9')),'smsInteraction':require(_0x7173('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7173('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x7173('0xc')]=function(_0x285af0,_0x383847,_0x2035cd,_0x112e22){return function(_0x54753b){try{var _0x4d2628=this[_0x7173('0xd')];if(_0x4d2628==='mail'&&_0x112e22[_0x7173('0xe')][_0x7173('0xf')]){logger['info'](_0x7173('0x10'),_0x285af0,_0x7173('0x11'));return _0x54753b[_0x7173('0x12')]();}if(_0x383847[0x0]==='1'&&(_[_0x7173('0x13')](this[_0x7173('0x14')]['created'])||!this[_0x7173('0x14')][_0x7173('0x15')])){logger[_0x7173('0x16')](_0x7173('0x10'),_0x285af0,'Autoreply\x20already\x20sent');return _0x54753b[_0x7173('0x12')]();}if(_0x383847[0x0]==='2'&&this['interaction'][_0x7173('0x17')]){logger[_0x7173('0x16')](_0x7173('0x18'),_0x285af0,'One\x20Time\x20already\x20sent');return _0x54753b[_0x7173('0x12')]();}var _0x54c69d={'ContactId':this[_0x7173('0x19')]['id'],'sentAt':moment()['format'](_0x7173('0x1a')),'direction':_0x7173('0x1b')};if(this['channel']===_0x7173('0x1c')){_0x54c69d[_0x7173('0xe')]=utils[_0x7173('0x1d')](_0x383847[0x2],this);}else{_0x54c69d[_0x7173('0xe')]=utils['getMustacheRender'](_0x383847[0x1],this);}if(this[_0x7173('0x1e')]){_0x54c69d['to']=this['message'][_0x7173('0x1f')]||'';if(this[_0x7173('0xd')]==='mail'&&_0x383847[0x1]==='1'){_0x54c69d['cc']=this[_0x7173('0x1e')]['cc']||'';}_0x54c69d[_0x7173('0x1f')]=this[_0x7173('0x1e')]['to']||'';_0x54c69d['phone']=this[_0x7173('0x1e')][_0x7173('0x20')]||'';_0x54c69d['read']=!![];if(this[_0x7173('0x1e')][_0x7173('0x21')]){_0x54c69d['subject']='';_0x54c69d[_0x7173('0x21')]+=_[_0x7173('0x22')](this[_0x7173('0x1e')][_0x7173('0x21')],_0x7173('0x23'))?'':_0x7173('0x24');_0x54c69d[_0x7173('0x21')]+=this[_0x7173('0x1e')][_0x7173('0x21')];}}if(this['channel']===_0x7173('0x25')){_0x54c69d[_0x7173('0x26')]=this[_0x7173('0x27')]['id'];}else{_0x54c69d[_[_0x7173('0x28')](this['channel'])+_0x7173('0x29')]=this['account']['id'];}_0x54c69d[_['upperFirst'](this['channel'])+'InteractionId']=this['interaction']['id'];var _0x10a527=this[_0x7173('0x14')];if(rpc[this[_0x7173('0xd')]+'Message']){if(this[_0x7173('0xd')]==='mail'){_0x54c69d[_0x7173('0x2a')]=this['message'][_0x7173('0x2b')];_0x54c69d['html']=_0x7173('0x2c')+_[_0x7173('0x2d')](_0x54c69d[_0x7173('0xe')],_0x7173('0x2e'),_0x7173('0x2f'))+_0x7173('0x30');_0x54c69d[_0x7173('0x31')]={'Auto-Submitted':_0x7173('0x32'),'X-Auto-Response-Suppress':_0x7173('0x33'),'Precedence':_0x7173('0x34')};return mailRpc[_0x7173('0x35')](this[_0x7173('0x27')][_0x7173('0x36')],_0x54c69d)[_0x7173('0x37')](function(_0x4b8ed7){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x285af0);_0x54c69d[_0x7173('0x2b')]=_0x4b8ed7['message'][_0x7173('0x2b')];return rpc[_0x4d2628+'Message'][_0x7173('0x38')](_0x54c69d);})[_0x7173('0x37')](function(_0x32f1b2){logger['info'](_0x7173('0x10'),_0x285af0,JSON[_0x7173('0x39')](_0x32f1b2));})[_0x7173('0x3a')](function(_0xd26a){logger[_0x7173('0x3b')]('[RPC][%s][AUTOREPLY]\x20%s',_0x285af0,JSON[_0x7173('0x39')](_0xd26a));})[_0x7173('0x3c')](function(){Promise[_0x7173('0x3d')]()[_0x7173('0x37')](function(){if(_0x383847[0x0]!=='2'||_0x10a527[_0x7173('0x17')])return;return rpc[_0x4d2628+'Interaction'][_0x7173('0x3e')](_0x10a527['id'],{'autoreplyExecuted':!![]})['then'](function(_0x50fc97){logger[_0x7173('0x16')](_0x7173('0x18'),_0x285af0,JSON['stringify'](_0x50fc97));})[_0x7173('0x3a')](function(_0x12797c){logger[_0x7173('0x3b')](_0x7173('0x3f'),_0x285af0,JSON[_0x7173('0x39')](_0x12797c));});})[_0x7173('0x37')](function(){_0x54753b[_0x7173('0x12')]();});});}else{return rpc[this[_0x7173('0xd')]+_0x7173('0x40')][_0x7173('0x38')](_0x54c69d)[_0x7173('0x37')](function(){logger[_0x7173('0x16')](_0x7173('0x10'),_0x285af0,_0x54c69d[_0x7173('0xe')]);})[_0x7173('0x3a')](function(_0x58395f){logger['error']('[%s][AUTOREPLY]\x20%s',_0x285af0,JSON[_0x7173('0x39')](_0x58395f));})[_0x7173('0x3c')](function(){Promise[_0x7173('0x3d')]()[_0x7173('0x37')](function(){if(_0x383847[0x0]!=='2'||_0x10a527['autoreplyExecuted'])return;return rpc[_0x4d2628+_0x7173('0x41')][_0x7173('0x3e')](_0x10a527['id'],{'autoreplyExecuted':!![]})[_0x7173('0x37')](function(_0x2b83bf){logger[_0x7173('0x16')](_0x7173('0x18'),_0x285af0,JSON['stringify'](_0x2b83bf));})[_0x7173('0x3a')](function(_0x8c8ec6){logger[_0x7173('0x3b')](_0x7173('0x3f'),_0x285af0,JSON[_0x7173('0x39')](_0x8c8ec6));});})[_0x7173('0x37')](function(){_0x54753b[_0x7173('0x12')]();});});}}}catch(_0x330963){logger[_0x7173('0x3b')](_0x7173('0x10'),_0x285af0,JSON['stringify'](_0x330963));_0x54753b[_0x7173('0x42')]();}};}; \ No newline at end of file +var _0x35f4=['create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x35f4,0x124));var _0x435f=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x35f4[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require(_0x435f('0x0'));var moment=require(_0x435f('0x1'));var utils=require(_0x435f('0x2'));var logger=require(_0x435f('0x3'))(_0x435f('0x4'));var rpc={'chatMessage':require(_0x435f('0x5')),'openchannelMessage':require(_0x435f('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x435f('0x7')),'faxMessage':require(_0x435f('0x8')),'whatsappMessage':require(_0x435f('0x9')),'chatInteraction':require(_0x435f('0xa')),'openchannelInteraction':require(_0x435f('0xb')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x435f('0xc')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x435f('0xd'))};var mailRpc=require(_0x435f('0xe'));exports['consequence']=function(_0x970b26,_0x5bc21d,_0x15eec3,_0x567795){return function(_0x3d2d2c){try{var _0x4c8331=this[_0x435f('0xf')];if(_0x4c8331===_0x435f('0x10')&&_0x567795[_0x435f('0x11')][_0x435f('0x12')]){logger[_0x435f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x970b26,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x3d2d2c[_0x435f('0x14')]();}if(_0x5bc21d[0x0]==='1'&&(_[_0x435f('0x15')](this['interaction'][_0x435f('0x16')])||!this[_0x435f('0x17')][_0x435f('0x16')])){logger[_0x435f('0x13')](_0x435f('0x18'),_0x970b26,_0x435f('0x19'));return _0x3d2d2c[_0x435f('0x14')]();}if(_0x5bc21d[0x0]==='2'&&this[_0x435f('0x17')]['autoreplyExecuted']){logger[_0x435f('0x13')](_0x435f('0x1a'),_0x970b26,_0x435f('0x1b'));return _0x3d2d2c[_0x435f('0x14')]();}var _0x31918c={'ContactId':this['contact']['id'],'sentAt':moment()[_0x435f('0x1c')](_0x435f('0x1d')),'direction':_0x435f('0x1e')};if(this[_0x435f('0xf')]===_0x435f('0x10')){_0x31918c[_0x435f('0x11')]=utils[_0x435f('0x1f')](_0x5bc21d[0x2],this);}else{_0x31918c[_0x435f('0x11')]=utils[_0x435f('0x1f')](_0x5bc21d[0x1],this);}if(this['message']){_0x31918c['to']=this[_0x435f('0x20')][_0x435f('0x21')]||'';if(this['channel']==='mail'&&_0x5bc21d[0x1]==='1'){_0x31918c['cc']=this[_0x435f('0x20')]['cc']||'';}_0x31918c[_0x435f('0x21')]=this['message']['to']||'';_0x31918c['phone']=this['message'][_0x435f('0x22')]||'';_0x31918c[_0x435f('0x23')]=!![];if(this['message'][_0x435f('0x24')]){_0x31918c[_0x435f('0x24')]='';_0x31918c[_0x435f('0x24')]+=_['startsWith'](this[_0x435f('0x20')]['subject'],'Re:')?'':_0x435f('0x25');_0x31918c[_0x435f('0x24')]+=this[_0x435f('0x20')][_0x435f('0x24')];}}if(this['channel']===_0x435f('0x26')){_0x31918c[_0x435f('0x27')]=this['account']['id'];}else{_0x31918c[_[_0x435f('0x28')](this['channel'])+'AccountId']=this[_0x435f('0x29')]['id'];}_0x31918c[_[_0x435f('0x28')](this[_0x435f('0xf')])+_0x435f('0x2a')]=this['interaction']['id'];var _0x250253=this[_0x435f('0x17')];if(rpc[this[_0x435f('0xf')]+_0x435f('0x2b')]){if(this[_0x435f('0xf')]===_0x435f('0x10')){_0x31918c[_0x435f('0x2c')]=this[_0x435f('0x20')][_0x435f('0x2d')];_0x31918c[_0x435f('0x2e')]=_0x435f('0x2f')+_[_0x435f('0x30')](_0x31918c[_0x435f('0x11')],_0x435f('0x31'),_0x435f('0x32'))+_0x435f('0x33');_0x31918c[_0x435f('0x34')]={'Auto-Submitted':_0x435f('0x35'),'X-Auto-Response-Suppress':_0x435f('0x36'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x435f('0x29')][_0x435f('0x37')],_0x31918c)[_0x435f('0x38')](function(_0xe5fa7e){logger[_0x435f('0x13')](_0x435f('0x39'),_0x970b26);_0x31918c[_0x435f('0x2d')]=_0xe5fa7e['message']['messageId'];return rpc[_0x4c8331+_0x435f('0x2b')][_0x435f('0x3a')](_0x31918c);})[_0x435f('0x38')](function(_0x4b9052){logger[_0x435f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x970b26,JSON[_0x435f('0x3b')](_0x4b9052));})[_0x435f('0x3c')](function(_0x5e7288){logger[_0x435f('0x3d')](_0x435f('0x3e'),_0x970b26,JSON[_0x435f('0x3b')](_0x5e7288));})[_0x435f('0x3f')](function(){Promise[_0x435f('0x40')]()[_0x435f('0x38')](function(){if(_0x5bc21d[0x0]!=='2'||_0x250253[_0x435f('0x41')])return;return rpc[_0x4c8331+_0x435f('0x42')][_0x435f('0x43')](_0x250253['id'],{'autoreplyExecuted':!![]})[_0x435f('0x38')](function(_0x539e2f){logger[_0x435f('0x13')](_0x435f('0x1a'),_0x970b26,JSON[_0x435f('0x3b')](_0x539e2f));})[_0x435f('0x3c')](function(_0xf72695){logger['error'](_0x435f('0x44'),_0x970b26,JSON['stringify'](_0xf72695));});})[_0x435f('0x38')](function(){_0x3d2d2c['next']();});});}else{return rpc[this[_0x435f('0xf')]+_0x435f('0x2b')]['create'](_0x31918c)[_0x435f('0x38')](function(){logger[_0x435f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x970b26,_0x31918c['body']);})[_0x435f('0x3c')](function(_0x1df2dd){logger[_0x435f('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x970b26,JSON['stringify'](_0x1df2dd));})[_0x435f('0x3f')](function(){Promise[_0x435f('0x40')]()[_0x435f('0x38')](function(){if(_0x5bc21d[0x0]!=='2'||_0x250253[_0x435f('0x41')])return;return rpc[_0x4c8331+_0x435f('0x42')][_0x435f('0x43')](_0x250253['id'],{'autoreplyExecuted':!![]})['then'](function(_0x9d40f9){logger['info'](_0x435f('0x1a'),_0x970b26,JSON[_0x435f('0x3b')](_0x9d40f9));})[_0x435f('0x3c')](function(_0x3d7813){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x970b26,JSON[_0x435f('0x3b')](_0x3d7813));});})[_0x435f('0x38')](function(){_0x3d2d2c['next']();});});}}}catch(_0x3bdf68){logger[_0x435f('0x3d')](_0x435f('0x18'),_0x970b26,JSON[_0x435f('0x3b')](_0x3bdf68));_0x3d2d2c[_0x435f('0x45')]();}};}; \ 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 8f17b71..1465c63 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 _0xa4df=['info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence'];(function(_0x193d09,_0x2d5922){var _0x1ec751=function(_0x23126f){while(--_0x23126f){_0x193d09['push'](_0x193d09['shift']());}};_0x1ec751(++_0x2d5922);}(_0xa4df,0x185));var _0xfa4d=function(_0x3a5de2,_0x4bb9a4){_0x3a5de2=_0x3a5de2-0x0;var _0x3f2b1c=_0xa4df[_0x3a5de2];return _0x3f2b1c;};'use strict';var moment=require(_0xfa4d('0x0'));var logger=require(_0xfa4d('0x1'))(_0xfa4d('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xfa4d('0x3')),'smsInteraction':require(_0xfa4d('0x4')),'mailInteraction':require(_0xfa4d('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xfa4d('0x6')]=function(_0x1e8f22,_0x5105cd,_0x28a57e,_0x41b8ab){return function(_0x632b94){try{logger[_0xfa4d('0x7')](_0xfa4d('0x8'),_0x1e8f22,_0x5105cd[0x0]);var _0x7db3cc={'closed':0x1,'closedAt':moment()[_0xfa4d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xfa4d('0xa'),'disposition':_0x5105cd[0x0]};if(rpc[_0x41b8ab[_0xfa4d('0xb')]+'Interaction']){rpc[_0x41b8ab[_0xfa4d('0xb')]+'Interaction'][_0xfa4d('0xc')](_0x41b8ab['interaction']['id'],_0x7db3cc)[_0xfa4d('0xd')](function(_0x395281){logger[_0xfa4d('0x7')](_0xfa4d('0xe'),_0x1e8f22,_0x41b8ab['interaction']['id']);})['catch'](function(_0xe5adbc){logger[_0xfa4d('0xf')](_0xfa4d('0x10'),_0x1e8f22,JSON['stringify'](_0xe5adbc));})['finally'](function(){_0x632b94[_0xfa4d('0x11')]();});}}catch(_0x5e39f3){logger[_0xfa4d('0xf')]('[%s][CLOSE]\x20%s',_0x1e8f22,JSON['stringify'](_0x5e39f3));_0x632b94[_0xfa4d('0x11')]();}};}; \ No newline at end of file +var _0xdd19=['interaction','catch','[%s][CLOSE]\x20%s','error','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x366ff0,_0x38675b){var _0x53d665=function(_0x3cd2da){while(--_0x3cd2da){_0x366ff0['push'](_0x366ff0['shift']());}};_0x53d665(++_0x38675b);}(_0xdd19,0xf6));var _0x9dd1=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdd19[_0x1d1779];return _0x2377e9;};'use strict';var moment=require(_0x9dd1('0x0'));var logger=require('../../../../config/logger')(_0x9dd1('0x1'));var rpc={'chatInteraction':require(_0x9dd1('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9dd1('0x3')),'mailInteraction':require(_0x9dd1('0x4')),'faxInteraction':require(_0x9dd1('0x5')),'whatsappInteraction':require(_0x9dd1('0x6'))};exports[_0x9dd1('0x7')]=function(_0x4a1366,_0x3ad70f,_0x3c1c4a,_0x3af25d){return function(_0x364dc4){try{logger[_0x9dd1('0x8')](_0x9dd1('0x9'),_0x4a1366,_0x3ad70f[0x0]);var _0x2f3a5d={'closed':0x1,'closedAt':moment()[_0x9dd1('0xa')](_0x9dd1('0xb')),'closeReason':_0x9dd1('0xc'),'disposition':_0x3ad70f[0x0]};if(rpc[_0x3af25d[_0x9dd1('0xd')]+_0x9dd1('0xe')]){rpc[_0x3af25d[_0x9dd1('0xd')]+_0x9dd1('0xe')][_0x9dd1('0xf')](_0x3af25d['interaction']['id'],_0x2f3a5d)[_0x9dd1('0x10')](function(_0x543add){logger['info'](_0x9dd1('0x11'),_0x4a1366,_0x3af25d[_0x9dd1('0x12')]['id']);})[_0x9dd1('0x13')](function(_0x1e4246){logger['error'](_0x9dd1('0x14'),_0x4a1366,JSON['stringify'](_0x1e4246));})['finally'](function(){_0x364dc4['stop']();});}}catch(_0x2c7044){logger[_0x9dd1('0x15')](_0x9dd1('0x14'),_0x4a1366,JSON[_0x9dd1('0x16')](_0x2c7044));_0x364dc4[_0x9dd1('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 0790413..0f31696 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 _0xbdb9=['phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','dialogflow','result','fulfillment','providerName','providerResponse','stringify','metadata','endConversation','catch','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xbdb9,0xac));var _0x9bdb=function(_0x5899ab,_0x445a13){_0x5899ab=_0x5899ab-0x0;var _0x341eab=_0xbdb9[_0x5899ab];return _0x341eab;};'use strict';var _=require(_0x9bdb('0x0'));var moment=require(_0x9bdb('0x1'));var apiai=require(_0x9bdb('0x2'));var md5=require(_0x9bdb('0x3'));var utils=require(_0x9bdb('0x4'));var logger=require('../../../../config/logger')(_0x9bdb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9bdb('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9bdb('0x7')]=function(_0x4e9c54,_0x369e4a){return function(_0x27cdd8){try{if(!_[_0x9bdb('0x8')](this[_0x9bdb('0x9')][_0x9bdb('0xa')])){logger[_0x9bdb('0xb')](_0x9bdb('0xc'),_0x4e9c54,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x27cdd8[_0x9bdb('0xd')]();}var _0x355bad={'ContactId':this[_0x9bdb('0xe')]['id'],'sentAt':moment()[_0x9bdb('0xf')](_0x9bdb('0x10')),'direction':'out'};if(this['channel']===_0x9bdb('0x11')||this[_0x9bdb('0x12')]===_0x9bdb('0x13')){_0x355bad[_0x9bdb('0x14')]=this[_0x9bdb('0x9')][_0x9bdb('0x14')];}var _0x5d626d=this[_0x9bdb('0x12')];if(_0x5d626d===_0x9bdb('0x15')){_0x355bad[_0x9bdb('0x16')]=this[_0x9bdb('0x17')]['id'];}else{_0x355bad[_[_0x9bdb('0x18')](_0x5d626d)+'AccountId']=this[_0x9bdb('0x17')]['id'];}_0x355bad[_[_0x9bdb('0x18')](_0x5d626d)+_0x9bdb('0x19')]=this['interaction']['id'];if(this[_0x9bdb('0x9')][_0x9bdb('0x1a')]){var _0x1cb06d=_0x369e4a[0x2];if(!_[_0x9bdb('0x1b')](_0x1cb06d)){_0x355bad[_0x9bdb('0x1c')]=utils[_0x9bdb('0x1d')](_0x1cb06d,this);return rpc[_0x5d626d+_0x9bdb('0x1e')][_0x9bdb('0x1f')](_0x355bad)[_0x9bdb('0x20')](function(_0x38b812){logger['info'](_0x9bdb('0xc'),_0x4e9c54,_0x355bad[_0x9bdb('0x1c')]);})['catch'](function(_0x119c69){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON['stringify'](_0x119c69));})[_0x9bdb('0x22')](function(){logger[_0x9bdb('0xb')](_0x9bdb('0x23'),_0x4e9c54);_0x27cdd8['stop']();});}else{logger[_0x9bdb('0xb')](_0x9bdb('0x24'),_0x4e9c54);_0x27cdd8[_0x9bdb('0x25')]();}}else{var _0x2150da=this;var _0x41a213=apiai(_0x369e4a[0x0],{'language':_0x369e4a[0x1]||'en'});return _0x41a213[_0x9bdb('0x26')](this['message']['body'],{'sessionId':md5(this[_0x9bdb('0x9')]['id'])})[_0x9bdb('0x20')](function(_0x1bba44){_0x2150da['body'][_0x9bdb('0x27')]=_0x1bba44;_0x355bad[_0x9bdb('0x1c')]=_0x1bba44[_0x9bdb('0x28')][_0x9bdb('0x29')]['speech'];_0x355bad[_0x9bdb('0x2a')]='dialogflow';_0x355bad[_0x9bdb('0x2b')]=JSON[_0x9bdb('0x2c')](_0x1bba44);return rpc[_0x5d626d+_0x9bdb('0x1e')]['create'](_0x355bad)[_0x9bdb('0x20')](function(_0xab83c9){logger[_0x9bdb('0xb')](_0x9bdb('0xc'),_0x4e9c54,_0x355bad[_0x9bdb('0x1c')]);if(_0x1bba44[_0x9bdb('0x28')][_0x9bdb('0x2d')][_0x9bdb('0x2e')]){_0x27cdd8[_0x9bdb('0xd')]();}else{_0x27cdd8[_0x9bdb('0x25')]();}})['catch'](function(_0x3af112){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON[_0x9bdb('0x2c')](_0x3af112));_0x27cdd8[_0x9bdb('0xd')]();});})[_0x9bdb('0x2f')](function(_0x106160){logger['error'](_0x9bdb('0xc'),_0x4e9c54,_0x106160['message']);_0x27cdd8[_0x9bdb('0xd')]();});}}catch(_0xed0f41){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON[_0x9bdb('0x2c')](_0xed0f41));_0x27cdd8[_0x9bdb('0x25')]();}};}; \ No newline at end of file +var _0xbdb9=['phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','dialogflow','result','fulfillment','providerName','providerResponse','stringify','metadata','endConversation','catch','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xbdb9,0xac));var _0x9bdb=function(_0x4869b9,_0x16e73d){_0x4869b9=_0x4869b9-0x0;var _0x441ef0=_0xbdb9[_0x4869b9];return _0x441ef0;};'use strict';var _=require(_0x9bdb('0x0'));var moment=require(_0x9bdb('0x1'));var apiai=require(_0x9bdb('0x2'));var md5=require(_0x9bdb('0x3'));var utils=require(_0x9bdb('0x4'));var logger=require('../../../../config/logger')(_0x9bdb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9bdb('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9bdb('0x7')]=function(_0x4e9c54,_0x369e4a){return function(_0x27cdd8){try{if(!_[_0x9bdb('0x8')](this[_0x9bdb('0x9')][_0x9bdb('0xa')])){logger[_0x9bdb('0xb')](_0x9bdb('0xc'),_0x4e9c54,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x27cdd8[_0x9bdb('0xd')]();}var _0x355bad={'ContactId':this[_0x9bdb('0xe')]['id'],'sentAt':moment()[_0x9bdb('0xf')](_0x9bdb('0x10')),'direction':'out'};if(this['channel']===_0x9bdb('0x11')||this[_0x9bdb('0x12')]===_0x9bdb('0x13')){_0x355bad[_0x9bdb('0x14')]=this[_0x9bdb('0x9')][_0x9bdb('0x14')];}var _0x5d626d=this[_0x9bdb('0x12')];if(_0x5d626d===_0x9bdb('0x15')){_0x355bad[_0x9bdb('0x16')]=this[_0x9bdb('0x17')]['id'];}else{_0x355bad[_[_0x9bdb('0x18')](_0x5d626d)+'AccountId']=this[_0x9bdb('0x17')]['id'];}_0x355bad[_[_0x9bdb('0x18')](_0x5d626d)+_0x9bdb('0x19')]=this['interaction']['id'];if(this[_0x9bdb('0x9')][_0x9bdb('0x1a')]){var _0x1cb06d=_0x369e4a[0x2];if(!_[_0x9bdb('0x1b')](_0x1cb06d)){_0x355bad[_0x9bdb('0x1c')]=utils[_0x9bdb('0x1d')](_0x1cb06d,this);return rpc[_0x5d626d+_0x9bdb('0x1e')][_0x9bdb('0x1f')](_0x355bad)[_0x9bdb('0x20')](function(_0x38b812){logger['info'](_0x9bdb('0xc'),_0x4e9c54,_0x355bad[_0x9bdb('0x1c')]);})['catch'](function(_0x119c69){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON['stringify'](_0x119c69));})[_0x9bdb('0x22')](function(){logger[_0x9bdb('0xb')](_0x9bdb('0x23'),_0x4e9c54);_0x27cdd8['stop']();});}else{logger[_0x9bdb('0xb')](_0x9bdb('0x24'),_0x4e9c54);_0x27cdd8[_0x9bdb('0x25')]();}}else{var _0x2150da=this;var _0x41a213=apiai(_0x369e4a[0x0],{'language':_0x369e4a[0x1]||'en'});return _0x41a213[_0x9bdb('0x26')](this['message']['body'],{'sessionId':md5(this[_0x9bdb('0x9')]['id'])})[_0x9bdb('0x20')](function(_0x1bba44){_0x2150da['body'][_0x9bdb('0x27')]=_0x1bba44;_0x355bad[_0x9bdb('0x1c')]=_0x1bba44[_0x9bdb('0x28')][_0x9bdb('0x29')]['speech'];_0x355bad[_0x9bdb('0x2a')]='dialogflow';_0x355bad[_0x9bdb('0x2b')]=JSON[_0x9bdb('0x2c')](_0x1bba44);return rpc[_0x5d626d+_0x9bdb('0x1e')]['create'](_0x355bad)[_0x9bdb('0x20')](function(_0xab83c9){logger[_0x9bdb('0xb')](_0x9bdb('0xc'),_0x4e9c54,_0x355bad[_0x9bdb('0x1c')]);if(_0x1bba44[_0x9bdb('0x28')][_0x9bdb('0x2d')][_0x9bdb('0x2e')]){_0x27cdd8[_0x9bdb('0xd')]();}else{_0x27cdd8[_0x9bdb('0x25')]();}})['catch'](function(_0x3af112){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON[_0x9bdb('0x2c')](_0x3af112));_0x27cdd8[_0x9bdb('0xd')]();});})[_0x9bdb('0x2f')](function(_0x106160){logger['error'](_0x9bdb('0xc'),_0x4e9c54,_0x106160['message']);_0x27cdd8[_0x9bdb('0xd')]();});}}catch(_0xed0f41){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON[_0x9bdb('0x2c')](_0xed0f41));_0x27cdd8[_0x9bdb('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index b51c559..ee6cfd5 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 _0x1312=['end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','providerResponse','fulfillmentText','push','all','lodash','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','then','catch','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields'];(function(_0x4a97f8,_0x19f15b){var _0x34b7fe=function(_0x5a2858){while(--_0x5a2858){_0x4a97f8['push'](_0x4a97f8['shift']());}};_0x34b7fe(++_0x19f15b);}(_0x1312,0x9d));var _0x2131=function(_0x356005,_0x411466){_0x356005=_0x356005-0x0;var _0x2bb35b=_0x1312[_0x356005];return _0x2bb35b;};'use strict';var _=require(_0x2131('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x2131('0x1'));var Promise=require('bluebird');var logger=require(_0x2131('0x2'))(_0x2131('0x3'));var utils=require(_0x2131('0x4'));var rpc={'chatMessage':require(_0x2131('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2131('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2131('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x3d6912,_0x27b71c,_0x3a521e,_0x15088f){return new Promise(function(_0xc8b77f,_0x42e6b1){var _0x5826b7=_['clone'](_0x3a521e);_0x5826b7[_0x2131('0x8')]=_0x15088f;return rpc[_0x27b71c+_0x2131('0x9')][_0x2131('0xa')](_0x5826b7)['then'](function(){logger[_0x2131('0xb')](_0x2131('0xc'),_0x3d6912,_0x5826b7[_0x2131('0x8')]);_0xc8b77f();})['catch'](function(_0x423d09){logger[_0x2131('0xd')](_0x2131('0xc'),_0x3d6912,JSON[_0x2131('0xe')](_0x423d09));_0x42e6b1(_0x423d09);});});}exports[_0x2131('0xf')]=function(_0x4fa011,_0x45bfd4){return function(_0x576de4){try{if(!_[_0x2131('0x10')](this[_0x2131('0x11')][_0x2131('0x12')])){logger['info'](_0x2131('0xc'),_0x4fa011,_0x2131('0x13'));return _0x576de4[_0x2131('0x14')]();}var _0x5d3728={'ContactId':this[_0x2131('0x15')]['id'],'sentAt':moment()[_0x2131('0x16')](_0x2131('0x17')),'direction':'out'};if(this['channel']==='sms'||this[_0x2131('0x18')]===_0x2131('0x19')){_0x5d3728[_0x2131('0x1a')]=this[_0x2131('0x11')][_0x2131('0x1a')];}var _0x437b4f=this[_0x2131('0x18')];if(_0x437b4f===_0x2131('0x1b')){_0x5d3728[_0x2131('0x1c')]=this[_0x2131('0x1d')]['id'];}else{_0x5d3728[_[_0x2131('0x1e')](_0x437b4f)+_0x2131('0x1f')]=this[_0x2131('0x1d')]['id'];}_0x5d3728[_['upperFirst'](_0x437b4f)+_0x2131('0x20')]=this[_0x2131('0x11')]['id'];if(this[_0x2131('0x11')][_0x2131('0x21')]){var _0x14c085=_0x45bfd4[0x4];if(!_[_0x2131('0x22')](_0x14c085)){_0x5d3728[_0x2131('0x8')]=utils[_0x2131('0x23')](_0x14c085,this);return rpc[_0x437b4f+_0x2131('0x9')][_0x2131('0xa')](_0x5d3728)[_0x2131('0x24')](function(_0x2194e9){logger[_0x2131('0xb')](_0x2131('0xc'),_0x4fa011,_0x5d3728['body']);})[_0x2131('0x25')](function(_0x4f81c7){logger[_0x2131('0xd')](_0x2131('0xc'),_0x4fa011,JSON['stringify'](_0x4f81c7));})['finally'](function(){logger[_0x2131('0xb')](_0x2131('0x26'),_0x4fa011);_0x576de4[_0x2131('0x27')]();});}else{logger[_0x2131('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4fa011);_0x576de4['stop']();}}else{var _0xd32952=this;var _0x358632=_0x45bfd4[0x2][_0x2131('0x28')](/\\n/g,'\x0a');var _0x4b4d71={'credentials':{'private_key':_0x358632,'client_email':_0x45bfd4[0x1]}};var _0x33622d=new dialogflow[(_0x2131('0x29'))](_0x4b4d71);var _0x264ddf=_0x33622d[_0x2131('0x2a')](_0x45bfd4[0x0],md5(_0xd32952['interaction']['id']));var _0x1c4518={'session':_0x264ddf,'queryInput':{'text':{'text':_0xd32952[_0x2131('0x2b')][_0x2131('0x8')],'languageCode':_0x45bfd4[0x3]||'en'}}};return _0x33622d[_0x2131('0x2c')](_0x1c4518)[_0x2131('0x24')](function(_0x1dda6c){if(_0x1dda6c&&_0x1dda6c[_0x2131('0x2d')]){_0xd32952[_0x2131('0x8')][_0x2131('0x2e')]=_0x1dda6c;var _0x3cd6d1=_0x1dda6c[0x0];var _0x52d235=_0x3cd6d1[_0x2131('0x2f')]['diagnosticInfo']&&_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x30')][_0x2131('0x31')]?_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x30')][_0x2131('0x31')][_0x2131('0x32')][_0x2131('0x33')]:![];_0xd32952['body']['DIALOGFLOWV2_ACTION']=_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x34')];_0xd32952[_0x2131('0x8')][_0x2131('0x35')]=_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x36')];_0xd32952[_0x2131('0x8')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x30')]&&_0x3cd6d1[_0x2131('0x2f')]['diagnosticInfo'][_0x2131('0x31')]?_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x30')][_0x2131('0x31')][_0x2131('0x32')]['boolValue']:![];_0xd32952[_0x2131('0x8')][_0x2131('0x37')]=_0x3cd6d1['queryResult']['intent'][_0x2131('0x38')];_0xd32952[_0x2131('0x8')][_0x2131('0x39')]=_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x3a')][_0x2131('0x3b')];_0xd32952[_0x2131('0x8')][_0x2131('0x3c')]=_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x3a')][_0x2131('0x3d')];_0xd32952[_0x2131('0x8')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3cd6d1['queryResult'][_0x2131('0x3e')];_0xd32952['body'][_0x2131('0x3f')]=_0x3cd6d1[_0x2131('0x2f')][_0x2131('0x40')];_0xd32952['body']['DIALOGFLOWV2_SCORE']=_0x3cd6d1[_0x2131('0x2f')]['intentDetectionConfidence'];_0x5d3728['providerName']=_0x2131('0x2e');_0x5d3728[_0x2131('0x41')]=JSON[_0x2131('0xe')](_0x1dda6c);var _0x10ec6=[];for(var _0x45928c=0x0;_0x45928c<_0x1dda6c[_0x2131('0x2d')];_0x45928c++){var _0x3204fb=_0x1dda6c[_0x45928c];if(_0x3204fb&&_0x3204fb[_0x2131('0x2f')]&&_0x3204fb[_0x2131('0x2f')][_0x2131('0x42')]){_0x10ec6[_0x2131('0x43')](createMessage(_0x4fa011,_0x437b4f,_0x5d3728,_0x3204fb[_0x2131('0x2f')][_0x2131('0x42')]));}}return Promise[_0x2131('0x44')](_0x10ec6)[_0x2131('0x24')](function(){if(_0x52d235){_0x576de4[_0x2131('0x14')]();}else{_0x576de4[_0x2131('0x27')]();}})[_0x2131('0x25')](function(_0x10a4d2){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4fa011,JSON[_0x2131('0xe')](_0x10a4d2));_0x576de4[_0x2131('0x14')]();});}})[_0x2131('0x25')](function(_0x38a56e){logger[_0x2131('0xd')](_0x2131('0xc'),_0x4fa011,_0x38a56e[_0x2131('0x2b')],_0x38a56e['stack']);_0x576de4[_0x2131('0x14')]();});}}catch(_0x9e29b6){logger[_0x2131('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x4fa011,JSON[_0x2131('0xe')](_0x9e29b6));_0x576de4[_0x2131('0x27')]();}};}; \ No newline at end of file +var _0x89b8=['boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','catch','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','queryResult','diagnosticInfo','fields','end_conversation'];(function(_0x129e96,_0x409fde){var _0x5b9588=function(_0x3b01ec){while(--_0x3b01ec){_0x129e96['push'](_0x129e96['shift']());}};_0x5b9588(++_0x409fde);}(_0x89b8,0xe6));var _0x889b=function(_0x345ada,_0x28ec54){_0x345ada=_0x345ada-0x0;var _0xaa7dcf=_0x89b8[_0x345ada];return _0xaa7dcf;};'use strict';var _=require(_0x889b('0x0'));var dialogflow=require(_0x889b('0x1'));var md5=require(_0x889b('0x2'));var moment=require(_0x889b('0x3'));var Promise=require(_0x889b('0x4'));var logger=require(_0x889b('0x5'))(_0x889b('0x6'));var utils=require(_0x889b('0x7'));var rpc={'chatMessage':require(_0x889b('0x8')),'openchannelMessage':require(_0x889b('0x9')),'mailMessage':require(_0x889b('0xa')),'smsMessage':require(_0x889b('0xb')),'faxMessage':require(_0x889b('0xc')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2cacf3,_0x435366,_0x2d1f9a,_0x41b5ab){return new Promise(function(_0x1c12d1,_0x162dd2){var _0x3bd131=_[_0x889b('0xd')](_0x2d1f9a);_0x3bd131[_0x889b('0xe')]=_0x41b5ab;return rpc[_0x435366+_0x889b('0xf')][_0x889b('0x10')](_0x3bd131)[_0x889b('0x11')](function(){logger[_0x889b('0x12')](_0x889b('0x13'),_0x2cacf3,_0x3bd131[_0x889b('0xe')]);_0x1c12d1();})['catch'](function(_0x387db1){logger[_0x889b('0x14')](_0x889b('0x13'),_0x2cacf3,JSON['stringify'](_0x387db1));_0x162dd2(_0x387db1);});});}exports[_0x889b('0x15')]=function(_0x47bb20,_0x8e4018){return function(_0x5081b4){try{if(!_['isNil'](this[_0x889b('0x16')][_0x889b('0x17')])){logger[_0x889b('0x12')](_0x889b('0x13'),_0x47bb20,_0x889b('0x18'));return _0x5081b4[_0x889b('0x19')]();}var _0x193f48={'ContactId':this[_0x889b('0x1a')]['id'],'sentAt':moment()[_0x889b('0x1b')](_0x889b('0x1c')),'direction':'out'};if(this[_0x889b('0x1d')]===_0x889b('0x1e')||this[_0x889b('0x1d')]===_0x889b('0x1f')){_0x193f48['phone']=this['interaction']['phone'];}var _0x2faeca=this[_0x889b('0x1d')];if(_0x2faeca===_0x889b('0x20')){_0x193f48[_0x889b('0x21')]=this[_0x889b('0x22')]['id'];}else{_0x193f48[_[_0x889b('0x23')](_0x2faeca)+_0x889b('0x24')]=this[_0x889b('0x22')]['id'];}_0x193f48[_[_0x889b('0x23')](_0x2faeca)+_0x889b('0x25')]=this[_0x889b('0x16')]['id'];if(this[_0x889b('0x16')][_0x889b('0x26')]){var _0x1217b9=_0x8e4018[0x4];if(!_[_0x889b('0x27')](_0x1217b9)){_0x193f48['body']=utils['getMustacheRender'](_0x1217b9,this);return rpc[_0x2faeca+_0x889b('0xf')]['create'](_0x193f48)['then'](function(_0xeaab){logger['info'](_0x889b('0x13'),_0x47bb20,_0x193f48[_0x889b('0xe')]);})[_0x889b('0x28')](function(_0x47e8a9){logger[_0x889b('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x47bb20,JSON[_0x889b('0x29')](_0x47e8a9));})[_0x889b('0x2a')](function(){logger[_0x889b('0x12')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x47bb20);_0x5081b4[_0x889b('0x2b')]();});}else{logger[_0x889b('0x12')](_0x889b('0x2c'),_0x47bb20);_0x5081b4[_0x889b('0x2b')]();}}else{var _0x5a03bb=this;var _0x4cba37=_0x8e4018[0x2][_0x889b('0x2d')](/\\n/g,'\x0a');var _0x50dd6c={'credentials':{'private_key':_0x4cba37,'client_email':_0x8e4018[0x1]}};var _0x35356e=new dialogflow[(_0x889b('0x2e'))](_0x50dd6c);var _0x31c943=_0x35356e[_0x889b('0x2f')](_0x8e4018[0x0],md5(_0x5a03bb[_0x889b('0x16')]['id']));var _0x231b65={'session':_0x31c943,'queryInput':{'text':{'text':_0x5a03bb[_0x889b('0x30')]['body'],'languageCode':_0x8e4018[0x3]||'en'}}};return _0x35356e['detectIntent'](_0x231b65)[_0x889b('0x11')](function(_0x30c5be){if(_0x30c5be&&_0x30c5be[_0x889b('0x31')]){_0x5a03bb[_0x889b('0xe')]['dialogflowV2']=_0x30c5be;var _0xd83003=_0x30c5be[0x0];var _0x5cddee=_0xd83003[_0x889b('0x32')][_0x889b('0x33')]&&_0xd83003[_0x889b('0x32')][_0x889b('0x33')]['fields']?_0xd83003[_0x889b('0x32')][_0x889b('0x33')][_0x889b('0x34')][_0x889b('0x35')][_0x889b('0x36')]:![];_0x5a03bb[_0x889b('0xe')]['DIALOGFLOWV2_ACTION']=_0xd83003['queryResult'][_0x889b('0x37')];_0x5a03bb[_0x889b('0xe')][_0x889b('0x38')]=_0xd83003['queryResult']['allRequiredParamsPresent'];_0x5a03bb[_0x889b('0xe')][_0x889b('0x39')]=_0xd83003[_0x889b('0x32')][_0x889b('0x33')]&&_0xd83003[_0x889b('0x32')][_0x889b('0x33')]['fields']?_0xd83003['queryResult']['diagnosticInfo'][_0x889b('0x34')][_0x889b('0x35')][_0x889b('0x36')]:![];_0x5a03bb[_0x889b('0xe')]['DIALOGFLOWV2_INTENTNAME']=_0xd83003['queryResult']['intent']['name'];_0x5a03bb['body'][_0x889b('0x3a')]=_0xd83003[_0x889b('0x32')][_0x889b('0x3b')]['displayName'];_0x5a03bb['body'][_0x889b('0x3c')]=_0xd83003[_0x889b('0x32')][_0x889b('0x3b')][_0x889b('0x3d')];_0x5a03bb[_0x889b('0xe')][_0x889b('0x3e')]=_0xd83003[_0x889b('0x32')][_0x889b('0x3f')];_0x5a03bb[_0x889b('0xe')]['DIALOGFLOWV2_QUERYTEXT']=_0xd83003[_0x889b('0x32')][_0x889b('0x40')];_0x5a03bb[_0x889b('0xe')][_0x889b('0x41')]=_0xd83003[_0x889b('0x32')][_0x889b('0x42')];_0x193f48[_0x889b('0x43')]='dialogflowV2';_0x193f48['providerResponse']=JSON[_0x889b('0x29')](_0x30c5be);var _0x21629a=[];for(var _0xd6c9b0=0x0;_0xd6c9b0<_0x30c5be[_0x889b('0x31')];_0xd6c9b0++){var _0x59db75=_0x30c5be[_0xd6c9b0];if(_0x59db75&&_0x59db75['queryResult']&&_0x59db75[_0x889b('0x32')][_0x889b('0x44')]){_0x21629a[_0x889b('0x45')](createMessage(_0x47bb20,_0x2faeca,_0x193f48,_0x59db75[_0x889b('0x32')][_0x889b('0x44')]));}}return Promise[_0x889b('0x46')](_0x21629a)[_0x889b('0x11')](function(){if(_0x5cddee){_0x5081b4[_0x889b('0x19')]();}else{_0x5081b4[_0x889b('0x2b')]();}})['catch'](function(_0x4b826f){logger[_0x889b('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x47bb20,JSON[_0x889b('0x29')](_0x4b826f));_0x5081b4[_0x889b('0x19')]();});}})[_0x889b('0x28')](function(_0x5bf9da){logger[_0x889b('0x14')](_0x889b('0x13'),_0x47bb20,_0x5bf9da[_0x889b('0x30')],_0x5bf9da['stack']);_0x5081b4[_0x889b('0x19')]();});}}catch(_0x5d6a69){logger['error'](_0x889b('0x13'),_0x47bb20,JSON[_0x889b('0x29')](_0x5d6a69));_0x5081b4['stop']();}};}; \ 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 5a139a2..49012ea 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 _0x56a5=['priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','./utils','../../../../config/logger','routing','string','number'];(function(_0x44f7e4,_0xafecef){var _0x204ed3=function(_0x38ffc5){while(--_0x38ffc5){_0x44f7e4['push'](_0x44f7e4['shift']());}};_0x204ed3(++_0xafecef);}(_0x56a5,0x1f2));var _0x556a=function(_0x1dba7c,_0x1b4722){_0x1dba7c=_0x1dba7c-0x0;var _0x12c849=_0x56a5[_0x1dba7c];return _0x12c849;};'use strict';var schema=require(_0x556a('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x556a('0x1'));var logger=require(_0x556a('0x2'))(_0x556a('0x3'));var gotoif=schema({'condition':{'type':_0x556a('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x556a('0x5'),'message':_0x556a('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x556a('0x7')]=function(_0x45f8bb,_0xc6b02d){return function(_0xf5d9a){try{var _0x1891bf={'condition':htmlToText['fromString'](utils[_0x556a('0x8')](_0xc6b02d[0x0],this),{'wordwrap':![]})[_0x556a('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xc6b02d[0x1],'priorityFalse':_0xc6b02d[0x2]};var _0x459ec6=gotoif[_0x556a('0x0')](_0x1891bf,{'typecast':!![]});if(_0x459ec6[_0x556a('0xa')]){logger['error'](_0x556a('0xb'),_0x45f8bb,_[_0x556a('0xc')](_0x459ec6,_0x556a('0xd'))['join'](',\x20'));_0xf5d9a[_0x556a('0xe')]();}else{try{var _0x32d61c=eval('('+_0x1891bf[_0x556a('0xf')]+')');var _0x4873a1=_0x32d61c?_0x1891bf[_0x556a('0x10')]:_0x1891bf[_0x556a('0x11')];logger[_0x556a('0x12')](_0x556a('0x13'),_0x45f8bb,_0x1891bf[_0x556a('0xf')],_0x32d61c,_0x4873a1||_0x556a('0x14'));if(_0x4873a1){var _0xa3bf73=_[_0x556a('0x15')](_0xf5d9a[_0x556a('0x16')](),{'p':_0x4873a1});if(_0xa3bf73>=0x0){logger[_0x556a('0x12')](_0x556a('0x17'),_0x45f8bb,_0x4873a1||_0x556a('0x14'),_0xa3bf73);_0xf5d9a[_0x556a('0x14')](_0xa3bf73);}else{logger[_0x556a('0x12')](_0x556a('0x18'),_0x45f8bb,_0x4873a1||_0x556a('0x14'));_0xf5d9a[_0x556a('0xe')]();}}else{_0xf5d9a['next']();}}catch(_0x278878){logger[_0x556a('0x19')](_0x556a('0x1a'),_0x45f8bb,_0x278878[_0x556a('0xd')]);_0xf5d9a[_0x556a('0xe')]();}}}catch(_0x5260d8){logger['error'](_0x556a('0xb'),_0x45f8bb,JSON[_0x556a('0x1b')](_0x5260d8));_0xf5d9a[_0x556a('0xe')]();}};}; \ No newline at end of file +var _0xe9fb=['[%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','stop','stringify','validate','lodash','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info'];(function(_0x18dd3a,_0x4bbf78){var _0x33cc5d=function(_0x2a71bf){while(--_0x2a71bf){_0x18dd3a['push'](_0x18dd3a['shift']());}};_0x33cc5d(++_0x4bbf78);}(_0xe9fb,0x19f));var _0xbe9f=function(_0x173f8d,_0x55c168){_0x173f8d=_0x173f8d-0x0;var _0x34774d=_0xe9fb[_0x173f8d];return _0x34774d;};'use strict';var schema=require(_0xbe9f('0x0'));var _=require(_0xbe9f('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xbe9f('0x2'))(_0xbe9f('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xbe9f('0x4')},'priorityTrue':{'type':_0xbe9f('0x5'),'message':_0xbe9f('0x6')},'priorityFalse':{'type':_0xbe9f('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xbe9f('0x7')]=function(_0x160f07,_0x1847be){return function(_0x2438a6){try{var _0x46c8be={'condition':htmlToText[_0xbe9f('0x8')](utils[_0xbe9f('0x9')](_0x1847be[0x0],this),{'wordwrap':![]})[_0xbe9f('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1847be[0x1],'priorityFalse':_0x1847be[0x2]};var _0x1a38df=gotoif[_0xbe9f('0x0')](_0x46c8be,{'typecast':!![]});if(_0x1a38df[_0xbe9f('0xb')]){logger[_0xbe9f('0xc')](_0xbe9f('0xd'),_0x160f07,_[_0xbe9f('0xe')](_0x1a38df,_0xbe9f('0xf'))[_0xbe9f('0x10')](',\x20'));_0x2438a6['stop']();}else{try{var _0x5ca0d9=eval('('+_0x46c8be['condition']+')');var _0x1dba41=_0x5ca0d9?_0x46c8be[_0xbe9f('0x11')]:_0x46c8be[_0xbe9f('0x12')];logger[_0xbe9f('0x13')](_0xbe9f('0x14'),_0x160f07,_0x46c8be[_0xbe9f('0x15')],_0x5ca0d9,_0x1dba41||_0xbe9f('0x16'));if(_0x1dba41){var _0x420ddc=_[_0xbe9f('0x17')](_0x2438a6[_0xbe9f('0x18')](),{'p':_0x1dba41});if(_0x420ddc>=0x0){logger[_0xbe9f('0x13')](_0xbe9f('0x19'),_0x160f07,_0x1dba41||'next',_0x420ddc);_0x2438a6[_0xbe9f('0x16')](_0x420ddc);}else{logger['info'](_0xbe9f('0x1a'),_0x160f07,_0x1dba41||_0xbe9f('0x16'));_0x2438a6[_0xbe9f('0x1b')]();}}else{_0x2438a6['next']();}}catch(_0x3c3b4b){logger[_0xbe9f('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x160f07,_0x3c3b4b['message']);_0x2438a6['stop']();}}}catch(_0xafff51){logger[_0xbe9f('0xc')](_0xbe9f('0xd'),_0x160f07,JSON[_0xbe9f('0x1c')](_0xafff51));_0x2438a6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index facb604..2e1d912 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 _0xcfe6=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x41bc3a,_0x39021f){var _0x965f4a=function(_0x52ad92){while(--_0x52ad92){_0x41bc3a['push'](_0x41bc3a['shift']());}};_0x965f4a(++_0x39021f);}(_0xcfe6,0x9f));var _0x6cfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcfe6[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x6cfe('0x0'));var _=require(_0x6cfe('0x1'));var logger=require(_0x6cfe('0x2'))(_0x6cfe('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x6cfe('0x4')]=function(_0x1b8f88,_0x268aff){return function(_0x2b6a07){try{var _0x3aa00d={'priority':_0x268aff[0x0]};var _0x30fe69=gotop[_0x6cfe('0x0')](_0x3aa00d,{'typecast':!![]});if(_0x30fe69['length']){logger[_0x6cfe('0x5')](_0x6cfe('0x6'),_0x1b8f88,_[_0x6cfe('0x7')](_0x30fe69,_0x6cfe('0x8'))['join'](',\x20'));_0x2b6a07[_0x6cfe('0x9')]();}else{logger['info'](_0x6cfe('0xa'),_0x1b8f88,_0x3aa00d[_0x6cfe('0xb')]);if(_0x3aa00d[_0x6cfe('0xb')]){var _0x2d1911=_[_0x6cfe('0xc')](_0x2b6a07[_0x6cfe('0xd')](),{'p':_0x3aa00d[_0x6cfe('0xb')]});if(_0x2d1911>=0x0){logger['info'](_0x6cfe('0xe'),_0x1b8f88,_0x3aa00d[_0x6cfe('0xb')]||_0x6cfe('0xf'),_0x2d1911);_0x2b6a07['next'](_0x2d1911);}else{logger[_0x6cfe('0x10')](_0x6cfe('0x11'),_0x1b8f88,_0x3aa00d[_0x6cfe('0xb')]||_0x6cfe('0xf'));_0x2b6a07['stop']();}}else{_0x2b6a07['next']();}}}catch(_0x489f8e){logger[_0x6cfe('0x5')](_0x6cfe('0x6'),_0x1b8f88,JSON[_0x6cfe('0x12')](_0x489f8e));_0x2b6a07['stop']();}};}; \ No newline at end of file +var _0xc0e8=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','join','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','validate','../../../../config/logger','routing','number'];(function(_0x2f331b,_0x199244){var _0x556f55=function(_0x4822af){while(--_0x4822af){_0x2f331b['push'](_0x2f331b['shift']());}};_0x556f55(++_0x199244);}(_0xc0e8,0xdc));var _0x8c0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc0e8[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0x8c0e('0x0'));var _=require('lodash');var logger=require(_0x8c0e('0x1'))(_0x8c0e('0x2'));var gotop=schema({'priority':{'type':_0x8c0e('0x3'),'required':!![],'message':_0x8c0e('0x4')}});exports['consequence']=function(_0x2a9660,_0x2a34ac){return function(_0x41d452){try{var _0x19686b={'priority':_0x2a34ac[0x0]};var _0x313e3a=gotop[_0x8c0e('0x0')](_0x19686b,{'typecast':!![]});if(_0x313e3a['length']){logger[_0x8c0e('0x5')](_0x8c0e('0x6'),_0x2a9660,_['map'](_0x313e3a,'message')[_0x8c0e('0x7')](',\x20'));_0x41d452['stop']();}else{logger[_0x8c0e('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x2a9660,_0x19686b[_0x8c0e('0x9')]);if(_0x19686b[_0x8c0e('0x9')]){var _0x47ea36=_['findIndex'](_0x41d452[_0x8c0e('0xa')](),{'p':_0x19686b[_0x8c0e('0x9')]});if(_0x47ea36>=0x0){logger[_0x8c0e('0x8')](_0x8c0e('0xb'),_0x2a9660,_0x19686b[_0x8c0e('0x9')]||_0x8c0e('0xc'),_0x47ea36);_0x41d452[_0x8c0e('0xc')](_0x47ea36);}else{logger[_0x8c0e('0x8')](_0x8c0e('0xd'),_0x2a9660,_0x19686b['priority']||_0x8c0e('0xc'));_0x41d452['stop']();}}else{_0x41d452['next']();}}}catch(_0x4849c5){logger[_0x8c0e('0x5')](_0x8c0e('0x6'),_0x2a9660,JSON[_0x8c0e('0xe')](_0x4849c5));_0x41d452[_0x8c0e('0xf')]();}};}; \ 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 a8b3166..3b009a1 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 _0x1060=['getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x112080,_0x1f2b71){var _0x4b46ef=function(_0x2d69a2){while(--_0x2d69a2){_0x112080['push'](_0x112080['shift']());}};_0x4b46ef(++_0x1f2b71);}(_0x1060,0x147));var _0x0106=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1060[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x0106('0x0'));var utils=require(_0x0106('0x1'));var logger=require(_0x0106('0x2'))(_0x0106('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0106('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0106('0x5')),'faxMessage':require(_0x0106('0x6')),'whatsappMessage':require(_0x0106('0x7'))};exports[_0x0106('0x8')]=function(_0x5946ad,_0x260c50){return function(_0xa8504f){try{var _0x848c04={'body':utils[_0x0106('0x9')](_0x260c50[0x0],this),'ContactId':this[_0x0106('0xa')]['id']};if(this[_0x0106('0xb')]===_0x0106('0xc')){_0x848c04[_0x0106('0xd')]=this[_0x0106('0xe')]['id'];}else{_0x848c04[_[_0x0106('0xf')](this['channel'])+_0x0106('0x10')]=this[_0x0106('0xe')]['id'];}_0x848c04[_['upperFirst'](this[_0x0106('0xb')])+_0x0106('0x11')]=this[_0x0106('0x12')]['id'];if(rpc[this[_0x0106('0xb')]+'Message']){return rpc[this[_0x0106('0xb')]+_0x0106('0x13')]['create'](_0x848c04)['then'](function(_0x56f982){logger[_0x0106('0x14')](_0x0106('0x15'),_0x5946ad,_0x848c04[_0x0106('0x16')]);_0xa8504f[_0x0106('0x17')]();})[_0x0106('0x18')](function(_0x576d5d){logger[_0x0106('0x19')](_0x0106('0x15'),_0x5946ad,JSON['stringify'](_0x576d5d));_0xa8504f[_0x0106('0x1a')]();});}}catch(_0x12f256){logger[_0x0106('0x19')](_0x0106('0x15'),_0x5946ad,JSON[_0x0106('0x1b')](_0x12f256));_0xa8504f[_0x0106('0x1a')]();}};}; \ No newline at end of file +var _0xb9f4=['../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','create','then','info','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x97a9ac,_0x38d2cc){var _0x58de49=function(_0x358ba0){while(--_0x358ba0){_0x97a9ac['push'](_0x97a9ac['shift']());}};_0x58de49(++_0x38d2cc);}(_0xb9f4,0x101));var _0x4b9f=function(_0x552bf7,_0x1eefc4){_0x552bf7=_0x552bf7-0x0;var _0x3c6acc=_0xb9f4[_0x552bf7];return _0x3c6acc;};'use strict';var _=require(_0x4b9f('0x0'));var utils=require('./utils');var logger=require(_0x4b9f('0x1'))(_0x4b9f('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4b9f('0x3')),'mailMessage':require(_0x4b9f('0x4')),'smsMessage':require(_0x4b9f('0x5')),'faxMessage':require(_0x4b9f('0x6')),'whatsappMessage':require(_0x4b9f('0x7'))};exports[_0x4b9f('0x8')]=function(_0x560892,_0x58cdf4){return function(_0x3162fd){try{var _0x10d15e={'body':utils[_0x4b9f('0x9')](_0x58cdf4[0x0],this),'ContactId':this[_0x4b9f('0xa')]['id']};if(this[_0x4b9f('0xb')]==='chat'){_0x10d15e[_0x4b9f('0xc')]=this[_0x4b9f('0xd')]['id'];}else{_0x10d15e[_[_0x4b9f('0xe')](this[_0x4b9f('0xb')])+_0x4b9f('0xf')]=this[_0x4b9f('0xd')]['id'];}_0x10d15e[_['upperFirst'](this[_0x4b9f('0xb')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+'Message'][_0x4b9f('0x10')](_0x10d15e)[_0x4b9f('0x11')](function(_0x865851){logger[_0x4b9f('0x12')](_0x4b9f('0x13'),_0x560892,_0x10d15e['body']);_0x3162fd['next']();})[_0x4b9f('0x14')](function(_0x310be2){logger[_0x4b9f('0x15')]('[%s][MESSAGE]\x20%s',_0x560892,JSON[_0x4b9f('0x16')](_0x310be2));_0x3162fd[_0x4b9f('0x17')]();});}}catch(_0x2ee988){logger['error']('[%s][MESSAGE]\x20%s',_0x560892,JSON[_0x4b9f('0x16')](_0x2ee988));_0x3162fd[_0x4b9f('0x17')]();}};}; \ 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 5f5e63b..486e85b 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 _0xcef5=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils'];(function(_0x4d9f43,_0x37e651){var _0x158bfd=function(_0x2990ea){while(--_0x2990ea){_0x4d9f43['push'](_0x4d9f43['shift']());}};_0x158bfd(++_0x37e651);}(_0xcef5,0x86));var _0x5cef=function(_0x60da0b,_0x396627){_0x60da0b=_0x60da0b-0x0;var _0x3c6d42=_0xcef5[_0x60da0b];return _0x3c6d42;};'use strict';var utils=require(_0x5cef('0x0'));var logger=require('../../../../config/logger')(_0x5cef('0x1'));exports['consequence']=function(_0x17cd5d,_0x571132){return function(_0xdb98db){try{logger[_0x5cef('0x2')](_0x5cef('0x3'),_0x17cd5d,utils[_0x5cef('0x4')](_0x571132[0x0],this));_0xdb98db[_0x5cef('0x5')]();}catch(_0xf783fc){logger[_0x5cef('0x6')](_0x5cef('0x3'),_0x17cd5d,JSON[_0x5cef('0x7')](_0xf783fc));_0xdb98db[_0x5cef('0x8')]();}};}; \ No newline at end of file +var _0x7a3a=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0x7a3a,0x1c2));var _0xa7a3=function(_0xb16fe4,_0x4dd5b0){_0xb16fe4=_0xb16fe4-0x0;var _0x1149e2=_0x7a3a[_0xb16fe4];return _0x1149e2;};'use strict';var utils=require('./utils');var logger=require(_0xa7a3('0x0'))(_0xa7a3('0x1'));exports[_0xa7a3('0x2')]=function(_0x34cd91,_0x5cba24){return function(_0x2c6912){try{logger[_0xa7a3('0x3')](_0xa7a3('0x4'),_0x34cd91,utils['getMustacheRender'](_0x5cba24[0x0],this));_0x2c6912[_0xa7a3('0x5')]();}catch(_0x1eceac){logger[_0xa7a3('0x6')](_0xa7a3('0x4'),_0x34cd91,JSON[_0xa7a3('0x7')](_0x1eceac));_0x2c6912[_0xa7a3('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e6e3d46..019f855 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 _0x8e8a=['ioredis','../../../../config/environment','routing','defaults','redis','localhost','socket.io-emitter','account','from','joinAt','emit','clone','queue_id','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','toLowerCase','consequence','length','map','find','Queues','timeout','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment'];(function(_0x17f11c,_0x43931f){var _0x75347f=function(_0x55cf96){while(--_0x55cf96){_0x17f11c['push'](_0x17f11c['shift']());}};_0x75347f(++_0x43931f);}(_0x8e8a,0xa4));var _0xa8e8=function(_0x17c22c,_0x2de553){_0x17c22c=_0x17c22c-0x0;var _0x4ca47a=_0x8e8a[_0x17c22c];return _0x4ca47a;};'use strict';var schema=require('validate');var _=require(_0xa8e8('0x0'));var util=require(_0xa8e8('0x1'));var seqqueue=require(_0xa8e8('0x2'));var moment=require(_0xa8e8('0x3'));var Redis=require(_0xa8e8('0x4'));var config=require(_0xa8e8('0x5'));var logger=require('../../../../config/logger')(_0xa8e8('0x6'));var strategy=require('./strategy');config['redis']=_[_0xa8e8('0x7')](config[_0xa8e8('0x8')],{'host':_0xa8e8('0x9'),'port':0x18eb});var io=require(_0xa8e8('0xa'))(new Redis(config[_0xa8e8('0x8')]));var attributes=['id','queue_id',_0xa8e8('0xb'),'queue',_0xa8e8('0xc'),_0xa8e8('0xd')];function emit(_0x511f34,_0x5d815c,_0x43c479){io['to'](_0x511f34)[_0xa8e8('0xe')](_0x5d815c,_0x43c479);}function emitChannelQueueInteraction(_0x2ebf52,_0x158f44,_0x5627f6,_0x4b5a39,_0x3a8882,_0x87d0c3,_0x4b5f3f,_0xa3a0eb){var _0x32479d=_[_0xa8e8('0xf')](_0x5627f6);_0x32479d[_0xa8e8('0x10')]=_0xa3a0eb;_0x32479d[_0xa8e8('0x11')]=_0x158f44;_0x32479d[_0xa8e8('0xb')]=_0x4b5a39;_0x32479d['id']=_0x3a8882;if(_0x87d0c3){attributes[_0xa8e8('0x12')](_[_0xa8e8('0x13')](_0x2ebf52)+_0xa8e8('0x14'));_0x4b5f3f[util[_0xa8e8('0x15')](_0xa8e8('0x16'),_0x2ebf52)][_0x3a8882]=_['pick'](_0x32479d,attributes);}else{delete _0x4b5f3f[util[_0xa8e8('0x15')](_0xa8e8('0x16'),_0x2ebf52)][_0x3a8882];}emit(util[_0xa8e8('0x15')]('%s:queue:%s',_0x2ebf52,_0x158f44),util[_0xa8e8('0x15')](_0xa8e8('0x17'),_0x2ebf52,_0x87d0c3?'save':'remove'),_[_0xa8e8('0x18')](_0x32479d,attributes));}var rpc={'openchannelQueueReport':require(_0xa8e8('0x19')),'mailQueueReport':require(_0xa8e8('0x1a')),'chatQueueReport':require(_0xa8e8('0x1b')),'smsQueueReport':require(_0xa8e8('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa8e8('0x1d')),'chatInteraction':require(_0xa8e8('0x1e')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0xa8e8('0x1f')),'smsInteraction':require(_0xa8e8('0x20')),'whatsappInteraction':require(_0xa8e8('0x21'))};var queue=schema({'name':{'type':_0xa8e8('0x22'),'required':!![],'message':_0xa8e8('0x23')},'timeout':{'type':_0xa8e8('0x24'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x469ac7,_0x57b334,_0x5de392,_0x199f14){if(_0x469ac7&&_0x57b334&&_0x5de392){_0x57b334[_0xa8e8('0x25')]+=0x1;var _0x37e66c={'uniqueid':_0x469ac7,'from':_0x5de392[_0xa8e8('0x26')]?_0x5de392[_0xa8e8('0x26')][_0xa8e8('0xc')]:'','joinAt':moment()[_0xa8e8('0x15')](_0xa8e8('0x27')),'ContactId':_0x5de392['contact']?_0x5de392[_0xa8e8('0x28')]['id']:null,'ListId':_0x5de392['list']?_0x5de392[_0xa8e8('0x29')]['id']:null};_0x37e66c[_['upperFirst'](_0x5de392[_0xa8e8('0x2a')])+'QueueId']=_0x57b334['id']||null;_0x37e66c[_[_0xa8e8('0x2b')](_0x5de392[_0xa8e8('0x2a')])+_0xa8e8('0x14')]=_0x5de392['interaction']?_0x5de392[_0xa8e8('0x2c')]['id']:null;_0x37e66c[_['upperFirst'](_0x5de392[_0xa8e8('0x2a')])+'MessageId']=_0x5de392[_0xa8e8('0x2d')]?_0x5de392['message']['id']:null;_0x37e66c[_['upperFirst'](_0x5de392[_0xa8e8('0x2a')])+(_0x5de392[_0xa8e8('0x2a')]!==_0xa8e8('0x2e')?_0xa8e8('0x2f'):_0xa8e8('0x30'))]=_0x5de392[_0xa8e8('0xb')]?_0x5de392[_0xa8e8('0xb')]['id']:null;logger[_0xa8e8('0x31')](util['format'](_0xa8e8('0x32'),_0x469ac7,_0x57b334[_0xa8e8('0x33')]));emitChannelQueueInteraction(_0x5de392[_0xa8e8('0x2a')],_0x57b334[_0xa8e8('0x33')],_0x37e66c,_0x5de392['account'][_0xa8e8('0x33')],_0x5de392['message']['id'],!![],_0x199f14,_0x57b334['id']);if(rpc[_0x5de392[_0xa8e8('0x2a')]+_0xa8e8('0x34')]){return rpc[_0x5de392['channel']+_0xa8e8('0x34')][_0xa8e8('0x35')](_0x37e66c)[_0xa8e8('0x36')](function(_0x87f935){logger[_0xa8e8('0x37')](_0xa8e8('0x38'),_0x87f935);});}}}function stopRouting(_0x38140b,_0x443df3,_0x16da2d,_0x3a1a4d){if(_0x38140b&&_0x443df3){_0x443df3[_0xa8e8('0x25')]-=0x1;var _0x52c3c2={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xa8e8('0x27')),'reason':_0xa8e8('0x39')};logger[_0xa8e8('0x31')](util[_0xa8e8('0x15')](_0xa8e8('0x3a'),_0x38140b,_0x443df3[_0xa8e8('0x33')]));emitChannelQueueInteraction(_0x16da2d[_0xa8e8('0x2a')],_0x443df3[_0xa8e8('0x33')],_0x16da2d[_0xa8e8('0x26')],_0x16da2d[_0xa8e8('0xb')]['name'],_0x16da2d['message']['id'],![],_0x3a1a4d,_0x443df3['id']);return rpc[_0x16da2d[_0xa8e8('0x2a')]+_0xa8e8('0x3b')][_0xa8e8('0x3c')](_0x16da2d[_0xa8e8('0x2c')]['id'],{'queueId':_0x443df3['id']})[_0xa8e8('0x3d')](function(){if(rpc[_0x16da2d[_0xa8e8('0x2a')]+_0xa8e8('0x34')]){return rpc[_0x16da2d['channel']+_0xa8e8('0x34')][_0xa8e8('0x3c')](_0x38140b,_0x52c3c2)['catch'](function(_0x3de9a6){logger['error'](_0xa8e8('0x3e'),_0x3de9a6);});}});}}function endRouting(_0x263083,_0x3cdf23,_0x21c861,_0x3fe029){if(_0x263083&&_0x3cdf23){_0x3cdf23[_0xa8e8('0x25')]-=0x1;var _0xee9f21={'leaveAt':moment()['format'](_0xa8e8('0x27')),'exitAt':moment()['format'](_0xa8e8('0x27')),'reason':'timeout'};logger[_0xa8e8('0x31')](util[_0xa8e8('0x15')]('[%s][END:QUEUE][NAME:%s]',_0x263083,_0x3cdf23[_0xa8e8('0x33')]));emitChannelQueueInteraction(_0x21c861[_0xa8e8('0x2a')],_0x3cdf23[_0xa8e8('0x33')],_0x21c861[_0xa8e8('0x26')],_0x21c861[_0xa8e8('0xb')][_0xa8e8('0x33')],_0x21c861[_0xa8e8('0x2d')]['id'],![],_0x3fe029);if(rpc[_0x21c861[_0xa8e8('0x2a')]+_0xa8e8('0x34')]){return rpc[_0x21c861['channel']+_0xa8e8('0x34')][_0xa8e8('0x3c')](_0x263083,_0xee9f21)[_0xa8e8('0x36')](function(_0xf5db8b){logger[_0xa8e8('0x37')](_0xa8e8('0x3e'),_0xf5db8b);});}}}function handleFindQueue(_0x683fe9){return function(_0x301fb2){return _0x301fb2[_0xa8e8('0x33')][_0xa8e8('0x3f')]()===_0x683fe9['toLowerCase']();};}exports[_0xa8e8('0x40')]=function(_0x1706d0,_0x254e06,_0x32f2bb,_0x49cc0a){return function(_0x1e139a){try{var _0x591d2f={'name':_0x254e06[0x0],'timeout':_0x254e06[0x1]};var _0x283c9b=queue['validate'](_0x591d2f,{'typecast':!![]});if(_0x283c9b[_0xa8e8('0x41')]){logger[_0xa8e8('0x37')]('[%s][QUEUE]\x20%s',_0x1706d0,_[_0xa8e8('0x42')](_0x283c9b,_0xa8e8('0x2d'))['join'](',\x20'));_0x1e139a['stop']();}else{var _0x1e26a6=_[_0xa8e8('0x43')](_0x32f2bb[_0x49cc0a[_0xa8e8('0x2a')]+_0xa8e8('0x44')],handleFindQueue(_0x591d2f[_0xa8e8('0x33')]));if(_0x1e26a6){startRouting(_0x1706d0,_0x1e26a6,_0x49cc0a,_0x32f2bb);var _0x46b507=(_0x1e26a6[_0xa8e8('0x45')]||0xa)*0x3e8;var _0x4dd24e=(_0x591d2f[_0xa8e8('0x45')]||0x14)*0x3e8;var _0x2f80da;if(_0x46b507>_0x4dd24e){_0x4dd24e=_0x46b507;}var _0x1166c0=seqqueue['createQueue'](_0x46b507);_0x1166c0['id']=_0x1706d0;_0x1166c0[_0xa8e8('0x46')]=_0x46b507;_0x1166c0[_0xa8e8('0x47')]=_0x4dd24e;_0x1166c0['channel']=_0x49cc0a[_0xa8e8('0x2a')];_0x32f2bb[_0xa8e8('0x48')][_0x1706d0]['on'](_0xa8e8('0x49'),function(){logger[_0xa8e8('0x31')](_0xa8e8('0x4a'),_0x1706d0);stopRouting(_0x1706d0,_0x1e26a6,_0x49cc0a,_0x32f2bb);clearTimeout(_0x2f80da);_0x2f80da=undefined;_0x1166c0[_0xa8e8('0x4b')](!![]);if(_0x32f2bb[_0xa8e8('0x48')][_0x1706d0]){delete _0x32f2bb[_0xa8e8('0x48')][_0x1706d0];}_0x1e139a[_0xa8e8('0x4c')]();});_0x32f2bb[_0xa8e8('0x48')][_0x1706d0]['on'](_0xa8e8('0x4d'),function(){if(_0x32f2bb['rules'][_0x1706d0]){delete _0x32f2bb[_0xa8e8('0x48')][_0x1706d0];}});_0x2f80da=setTimeout(function(){logger[_0xa8e8('0x31')](_0xa8e8('0x4e'),_0x1706d0);endRouting(_0x1706d0,_0x1e26a6,_0x49cc0a,_0x32f2bb);clearTimeout(_0x2f80da);_0x1166c0[_0xa8e8('0x4b')](!![]);_0x1e139a['next']();},_0x4dd24e);switch(_0x1e26a6[_0xa8e8('0x4f')]){case _0xa8e8('0x50'):strategy[_0xa8e8('0x50')](_0x1166c0,_0x1e26a6,_0x32f2bb,_0x49cc0a);break;default:strategy[_0xa8e8('0x51')](_0x1166c0,_0x1e26a6,_0x32f2bb,_0x49cc0a);}}else{logger[_0xa8e8('0x37')](_0xa8e8('0x52'),_0x1706d0,_0x591d2f['name']);_0x1e139a['stop']();}}}catch(_0x54bfad){logger['error']('[%s][QUEUE]\x20%s',_0x1706d0,_0x54bfad[_0xa8e8('0x53')]);_0x1e139a['stop']();}};}; \ No newline at end of file +var _0x96c4=['atimeout','qtimeout','rules','end','close','complete','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','InteractionId','pick','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','accepted','Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96c4,0x15b));var _0x496c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x96c4[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0x496c('0x0'));var _=require(_0x496c('0x1'));var util=require(_0x496c('0x2'));var seqqueue=require(_0x496c('0x3'));var moment=require(_0x496c('0x4'));var Redis=require(_0x496c('0x5'));var config=require(_0x496c('0x6'));var logger=require(_0x496c('0x7'))('routing');var strategy=require('./strategy');config[_0x496c('0x8')]=_['defaults'](config[_0x496c('0x8')],{'host':_0x496c('0x9'),'port':0x18eb});var io=require(_0x496c('0xa'))(new Redis(config[_0x496c('0x8')]));var attributes=['id',_0x496c('0xb'),_0x496c('0xc'),_0x496c('0xd'),_0x496c('0xe'),_0x496c('0xf')];function emit(_0x39daba,_0x564181,_0xd3c6a7){io['to'](_0x39daba)[_0x496c('0x10')](_0x564181,_0xd3c6a7);}function emitChannelQueueInteraction(_0x31a819,_0x50c00c,_0x3df710,_0x49b122,_0x41a35c,_0x458da4,_0x3e69df,_0x1f8d45){var _0x2b05fd=_[_0x496c('0x11')](_0x3df710);_0x2b05fd[_0x496c('0xb')]=_0x1f8d45;_0x2b05fd[_0x496c('0xd')]=_0x50c00c;_0x2b05fd[_0x496c('0xc')]=_0x49b122;_0x2b05fd['id']=_0x41a35c;if(_0x458da4){attributes[_0x496c('0x12')](_['capitalize'](_0x31a819)+_0x496c('0x13'));_0x3e69df[util['format']('%sQueuesWaitingInteractions',_0x31a819)][_0x41a35c]=_[_0x496c('0x14')](_0x2b05fd,attributes);}else{delete _0x3e69df[util[_0x496c('0x15')](_0x496c('0x16'),_0x31a819)][_0x41a35c];}emit(util[_0x496c('0x15')]('%s:queue:%s',_0x31a819,_0x50c00c),util['format'](_0x496c('0x17'),_0x31a819,_0x458da4?_0x496c('0x18'):'remove'),_['pick'](_0x2b05fd,attributes));}var rpc={'openchannelQueueReport':require(_0x496c('0x19')),'mailQueueReport':require(_0x496c('0x1a')),'chatQueueReport':require(_0x496c('0x1b')),'smsQueueReport':require(_0x496c('0x1c')),'faxQueueReport':require(_0x496c('0x1d')),'whatsappQueueReport':require(_0x496c('0x1e')),'chatInteraction':require(_0x496c('0x1f')),'faxInteraction':require(_0x496c('0x20')),'mailInteraction':require(_0x496c('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x496c('0x22'),'required':!![],'message':_0x496c('0x23')},'timeout':{'type':'number','message':_0x496c('0x24')}});function startRouting(_0x5546a0,_0x42bed8,_0x2cfb17,_0x5e8984){if(_0x5546a0&&_0x42bed8&&_0x2cfb17){_0x42bed8[_0x496c('0x25')]+=0x1;var _0x2c525f={'uniqueid':_0x5546a0,'from':_0x2cfb17[_0x496c('0x26')]?_0x2cfb17['body'][_0x496c('0xe')]:'','joinAt':moment()[_0x496c('0x15')](_0x496c('0x27')),'ContactId':_0x2cfb17[_0x496c('0x28')]?_0x2cfb17[_0x496c('0x28')]['id']:null,'ListId':_0x2cfb17[_0x496c('0x29')]?_0x2cfb17[_0x496c('0x29')]['id']:null};_0x2c525f[_['upperFirst'](_0x2cfb17[_0x496c('0x2a')])+_0x496c('0x2b')]=_0x42bed8['id']||null;_0x2c525f[_[_0x496c('0x2c')](_0x2cfb17[_0x496c('0x2a')])+'InteractionId']=_0x2cfb17['interaction']?_0x2cfb17[_0x496c('0x2d')]['id']:null;_0x2c525f[_[_0x496c('0x2c')](_0x2cfb17['channel'])+_0x496c('0x2e')]=_0x2cfb17[_0x496c('0x2f')]?_0x2cfb17[_0x496c('0x2f')]['id']:null;_0x2c525f[_[_0x496c('0x2c')](_0x2cfb17[_0x496c('0x2a')])+(_0x2cfb17[_0x496c('0x2a')]!==_0x496c('0x30')?_0x496c('0x31'):_0x496c('0x32'))]=_0x2cfb17[_0x496c('0xc')]?_0x2cfb17[_0x496c('0xc')]['id']:null;logger[_0x496c('0x33')](util[_0x496c('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x5546a0,_0x42bed8[_0x496c('0x34')]));emitChannelQueueInteraction(_0x2cfb17[_0x496c('0x2a')],_0x42bed8[_0x496c('0x34')],_0x2c525f,_0x2cfb17['account'][_0x496c('0x34')],_0x2cfb17[_0x496c('0x2f')]['id'],!![],_0x5e8984,_0x42bed8['id']);if(rpc[_0x2cfb17[_0x496c('0x2a')]+'QueueReport']){return rpc[_0x2cfb17['channel']+_0x496c('0x35')]['create'](_0x2c525f)[_0x496c('0x36')](function(_0x528457){logger[_0x496c('0x37')](_0x496c('0x38'),_0x528457);});}}}function stopRouting(_0x5408db,_0x44187e,_0xb16e16,_0x2e08b2){if(_0x5408db&&_0x44187e){_0x44187e['waiting']-=0x1;var _0x211537={'leaveAt':moment()[_0x496c('0x15')](_0x496c('0x27')),'acceptAt':moment()[_0x496c('0x15')](_0x496c('0x27')),'reason':_0x496c('0x39')};logger[_0x496c('0x33')](util[_0x496c('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x5408db,_0x44187e[_0x496c('0x34')]));emitChannelQueueInteraction(_0xb16e16[_0x496c('0x2a')],_0x44187e[_0x496c('0x34')],_0xb16e16[_0x496c('0x26')],_0xb16e16[_0x496c('0xc')]['name'],_0xb16e16[_0x496c('0x2f')]['id'],![],_0x2e08b2,_0x44187e['id']);return rpc[_0xb16e16[_0x496c('0x2a')]+_0x496c('0x3a')][_0x496c('0x3b')](_0xb16e16['interaction']['id'],{'queueId':_0x44187e['id']})[_0x496c('0x3c')](function(){if(rpc[_0xb16e16[_0x496c('0x2a')]+_0x496c('0x35')]){return rpc[_0xb16e16[_0x496c('0x2a')]+_0x496c('0x35')][_0x496c('0x3b')](_0x5408db,_0x211537)[_0x496c('0x36')](function(_0x3d35db){logger[_0x496c('0x37')]('update\x20queue\x20report',_0x3d35db);});}});}}function endRouting(_0x5153bb,_0x15c4c3,_0xef51e2,_0xfb8a79){if(_0x5153bb&&_0x15c4c3){_0x15c4c3[_0x496c('0x25')]-=0x1;var _0x5d5c86={'leaveAt':moment()['format'](_0x496c('0x27')),'exitAt':moment()[_0x496c('0x15')](_0x496c('0x27')),'reason':_0x496c('0x3d')};logger[_0x496c('0x33')](util[_0x496c('0x15')](_0x496c('0x3e'),_0x5153bb,_0x15c4c3['name']));emitChannelQueueInteraction(_0xef51e2['channel'],_0x15c4c3[_0x496c('0x34')],_0xef51e2[_0x496c('0x26')],_0xef51e2['account'][_0x496c('0x34')],_0xef51e2[_0x496c('0x2f')]['id'],![],_0xfb8a79);if(rpc[_0xef51e2[_0x496c('0x2a')]+_0x496c('0x35')]){return rpc[_0xef51e2['channel']+_0x496c('0x35')]['update'](_0x5153bb,_0x5d5c86)[_0x496c('0x36')](function(_0xf84ff9){logger[_0x496c('0x37')](_0x496c('0x3f'),_0xf84ff9);});}}}function handleFindQueue(_0x1a10b3){return function(_0x34e31a){return _0x34e31a[_0x496c('0x34')]['toLowerCase']()===_0x1a10b3[_0x496c('0x40')]();};}exports[_0x496c('0x41')]=function(_0x2f291f,_0x5f0880,_0x37846f,_0x2e9e13){return function(_0xc746ff){try{var _0x43b69b={'name':_0x5f0880[0x0],'timeout':_0x5f0880[0x1]};var _0xa634c4=queue['validate'](_0x43b69b,{'typecast':!![]});if(_0xa634c4[_0x496c('0x42')]){logger[_0x496c('0x37')](_0x496c('0x43'),_0x2f291f,_['map'](_0xa634c4,'message')[_0x496c('0x44')](',\x20'));_0xc746ff[_0x496c('0x45')]();}else{var _0x49f378=_[_0x496c('0x46')](_0x37846f[_0x2e9e13['channel']+_0x496c('0x47')],handleFindQueue(_0x43b69b['name']));if(_0x49f378){startRouting(_0x2f291f,_0x49f378,_0x2e9e13,_0x37846f);var _0x449db3=(_0x49f378[_0x496c('0x3d')]||0xa)*0x3e8;var _0xd3925f=(_0x43b69b[_0x496c('0x3d')]||0x14)*0x3e8;var _0x22b3a4;if(_0x449db3>_0xd3925f){_0xd3925f=_0x449db3;}var _0x16905a=seqqueue[_0x496c('0x48')](_0x449db3);_0x16905a['id']=_0x2f291f;_0x16905a[_0x496c('0x49')]=_0x449db3;_0x16905a[_0x496c('0x4a')]=_0xd3925f;_0x16905a[_0x496c('0x2a')]=_0x2e9e13['channel'];_0x37846f[_0x496c('0x4b')][_0x2f291f]['on'](_0x496c('0x4c'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2f291f);stopRouting(_0x2f291f,_0x49f378,_0x2e9e13,_0x37846f);clearTimeout(_0x22b3a4);_0x22b3a4=undefined;_0x16905a[_0x496c('0x4d')](!![]);if(_0x37846f['rules'][_0x2f291f]){delete _0x37846f[_0x496c('0x4b')][_0x2f291f];}_0xc746ff[_0x496c('0x45')]();});_0x37846f[_0x496c('0x4b')][_0x2f291f]['on'](_0x496c('0x4e'),function(){if(_0x37846f[_0x496c('0x4b')][_0x2f291f]){delete _0x37846f[_0x496c('0x4b')][_0x2f291f];}});_0x22b3a4=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x2f291f);endRouting(_0x2f291f,_0x49f378,_0x2e9e13,_0x37846f);clearTimeout(_0x22b3a4);_0x16905a[_0x496c('0x4d')](!![]);_0xc746ff[_0x496c('0x4f')]();},_0xd3925f);switch(_0x49f378[_0x496c('0x50')]){case _0x496c('0x51'):strategy[_0x496c('0x51')](_0x16905a,_0x49f378,_0x37846f,_0x2e9e13);break;default:strategy['beepall'](_0x16905a,_0x49f378,_0x37846f,_0x2e9e13);}}else{logger[_0x496c('0x37')](_0x496c('0x52'),_0x2f291f,_0x43b69b[_0x496c('0x34')]);_0xc746ff[_0x496c('0x45')]();}}}catch(_0x8fd7ee){logger[_0x496c('0x37')]('[%s][QUEUE]\x20%s',_0x2f291f,_0x8fd7ee[_0x496c('0x53')]);_0xc746ff[_0x496c('0x45')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 7cc0893..614e9f9 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 _0x9f62=['../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','saveWaitingNotification','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','uuid'];(function(_0x4365df,_0x422f02){var _0x4198ed=function(_0x211180){while(--_0x211180){_0x4365df['push'](_0x4365df['shift']());}};_0x4198ed(++_0x422f02);}(_0x9f62,0x154));var _0x29f6=function(_0x4365e4,_0x246141){_0x4365e4=_0x4365e4-0x0;var _0x203caf=_0x9f62[_0x4365e4];return _0x203caf;};'use strict';var _=require('lodash');var uuid=require(_0x29f6('0x0'));var util=require('./util');var logger=require(_0x29f6('0x1'))(_0x29f6('0x2'));var Agent=function(_0x548050,_0x5618b7,_0x54d164,_0x258ddd){this[_0x29f6('0x3')]=uuid['v4']();this[_0x29f6('0x4')]=_0x548050;this[_0x29f6('0x5')]=_0x5618b7;this['realtime']=_0x54d164;this[_0x29f6('0x2')]=_0x258ddd;this[_0x29f6('0x4')][_0x29f6('0x6')](this[_0x29f6('0x7')][_0x29f6('0x8')](this),this['handleTimeout']['bind'](this));this['squeue']['on']('timeout',this[_0x29f6('0x9')][_0x29f6('0x8')](this));this['squeue']['on']('drained',this[_0x29f6('0xa')][_0x29f6('0x8')](this));};Agent['prototype'][_0x29f6('0x6')]=function(){this[_0x29f6('0x4')]['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0x29f6('0x8')](this));};Agent[_0x29f6('0xb')][_0x29f6('0xa')]=function(){this[_0x29f6('0x9')](!![]);};Agent[_0x29f6('0xb')][_0x29f6('0x7')]=function(){logger[_0x29f6('0xc')](_0x29f6('0xd'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);if(_[_0x29f6('0xe')](this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']])){logger[_0x29f6('0xc')](_0x29f6('0x11'),this[_0x29f6('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x29f6('0x8')](this),0x3e8);}else{if(this[_0x29f6('0x2')][_0x29f6('0x12')]||util['isAgentAvailable'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this[_0x29f6('0x5')]['id']],this[_0x29f6('0x4')][_0x29f6('0x13')],![])){this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']]['busy']=!![];this[_0x29f6('0xf')]['agents'][this['agent']['id']][_0x29f6('0x14')]=undefined;util[_0x29f6('0x15')](this[_0x29f6('0xf')],this[_0x29f6('0x2')],this['agent'],this[_0x29f6('0x4')]['channel']);util[_0x29f6('0x16')](this[_0x29f6('0x3')],this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this[_0x29f6('0x5')]['id']],null,this[_0x29f6('0x2')]);util['writeLog'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']],_0x29f6('0x17')+(this[_0x29f6('0x2')][_0x29f6('0x12')]?':FORCED':''));}else{logger[_0x29f6('0xc')](_0x29f6('0x18'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);setTimeout(this[_0x29f6('0x6')][_0x29f6('0x8')](this),0x3e8);}}};Agent[_0x29f6('0xb')][_0x29f6('0x9')]=function(_0x3d88db){if(_[_0x29f6('0xe')](this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']])){return logger[_0x29f6('0xc')](_0x29f6('0x11'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x29f6('0x4')]['id'],this['agent']['id']);util[_0x29f6('0x19')](this[_0x29f6('0x3')],this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this['agent']['id']],null,this[_0x29f6('0x2')]);this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']][_0x29f6('0x1a')]=![];this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']][_0x29f6('0x14')]=undefined;util[_0x29f6('0x1b')](this[_0x29f6('0xf')],this[_0x29f6('0x2')],this[_0x29f6('0x5')],this[_0x29f6('0x4')]['channel']);util['writeLog'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')][_0x29f6('0x10')][this['agent']['id']],_0x3d88db?_0x29f6('0x1c'):_0x29f6('0x1d'));}if(!_0x3d88db){setTimeout(this[_0x29f6('0x6')][_0x29f6('0x8')](this),0x3e8);}};function agent(_0x1d2b3c,_0x48fbd1,_0x7695ee,_0x2ad06f){return new Agent(_0x1d2b3c,_0x48fbd1,_0x7695ee,_0x2ad06f);}module[_0x29f6('0x1e')]=agent; \ No newline at end of file +var _0xb903=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','handleRun','bind','handleTimeout','handleDrained','push','debug','isNil','realtime','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING',':FORCED'];(function(_0xea82b0,_0x592681){var _0x1ee530=function(_0x37f85b){while(--_0x37f85b){_0xea82b0['push'](_0xea82b0['shift']());}};_0x1ee530(++_0x592681);}(_0xb903,0x185));var _0x3b90=function(_0x1277f8,_0x19db4c){_0x1277f8=_0x1277f8-0x0;var _0x37cd0e=_0xb903[_0x1277f8];return _0x37cd0e;};'use strict';var _=require(_0x3b90('0x0'));var uuid=require(_0x3b90('0x1'));var util=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('routing');var Agent=function(_0x3312ca,_0xf414f4,_0x3b024a,_0x1cd5d8){this[_0x3b90('0x4')]=uuid['v4']();this[_0x3b90('0x5')]=_0x3312ca;this[_0x3b90('0x6')]=_0xf414f4;this['realtime']=_0x3b024a;this[_0x3b90('0x7')]=_0x1cd5d8;this['squeue']['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')][_0x3b90('0x9')](this));this['squeue']['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0x3b90('0xb')][_0x3b90('0x9')](this));};Agent['prototype'][_0x3b90('0xc')]=function(){this[_0x3b90('0x5')]['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')]['bind'](this));};Agent['prototype'][_0x3b90('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x3b90('0x8')]=function(){logger[_0x3b90('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x3b90('0x6')]['id']);if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}else{if(this[_0x3b90('0x7')][_0x3b90('0x11')]||util[_0x3b90('0x12')](this['squeue']['id'],this[_0x3b90('0xf')]['agents'][this[_0x3b90('0x6')]['id']],this[_0x3b90('0x5')]['channel'],![])){this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=!![];this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util[_0x3b90('0x15')](this[_0x3b90('0xf')],this['routing'],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util[_0x3b90('0x17')](this[_0x3b90('0x4')],this[_0x3b90('0x5')]['id'],this['realtime']['agents'][this[_0x3b90('0x6')]['id']],null,this[_0x3b90('0x7')]);util[_0x3b90('0x18')](this[_0x3b90('0x5')]['id'],this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']],_0x3b90('0x19')+(this['routing'][_0x3b90('0x11')]?_0x3b90('0x1a'):''));}else{logger[_0x3b90('0xd')](_0x3b90('0x1b'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}}};Agent['prototype'][_0x3b90('0xa')]=function(_0x9891e4){if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){return logger[_0x3b90('0xd')](_0x3b90('0x1c'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x3b90('0xd')](_0x3b90('0x1d'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x3b90('0x5')]['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],null,this[_0x3b90('0x7')]);this['realtime']['agents'][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=![];this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x3b90('0x7')],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util['writeLog'](this['squeue']['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],_0x9891e4?'STOP':_0x3b90('0x1e'));}if(!_0x9891e4){setTimeout(this[_0x3b90('0xc')][_0x3b90('0x9')](this),0x3e8);}};function agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842){return new Agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842);}module[_0x3b90('0x1f')]=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 7cb5c04..7d12745 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 _0x6bdf=['length','agents','isAgentAvailable','RINGING','busy','busyQueue','name','saveWaitingNotification','channel','debug','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','drained','prototype','isNil','Agents'];(function(_0x45b3db,_0x23fe89){var _0x5375f4=function(_0x3d242c){while(--_0x3d242c){_0x45b3db['push'](_0x45b3db['shift']());}};_0x5375f4(++_0x23fe89);}(_0x6bdf,0x19c));var _0xf6bd=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x6bdf[_0x5b6cf1];return _0x46278c;};'use strict';var _=require(_0xf6bd('0x0'));var uuid=require(_0xf6bd('0x1'));var util=require(_0xf6bd('0x2'));var logger=require(_0xf6bd('0x3'))(_0xf6bd('0x4'));var Beepall=function(_0x99709,_0x35092d,_0x4d2046,_0x49d921){this[_0xf6bd('0x5')]=uuid['v4']();this[_0xf6bd('0x6')]=_0x99709;this[_0xf6bd('0x7')]=_0x35092d;this[_0xf6bd('0x8')]=_0x4d2046;this[_0xf6bd('0x4')]=_0x49d921;this[_0xf6bd('0x6')][_0xf6bd('0x9')](this[_0xf6bd('0xa')]['bind'](this),this[_0xf6bd('0xb')]['bind'](this));this[_0xf6bd('0x6')]['on']('timeout',this[_0xf6bd('0xb')][_0xf6bd('0xc')](this));this[_0xf6bd('0x6')]['on'](_0xf6bd('0xd'),this['handleDrained']['bind'](this));};Beepall[_0xf6bd('0xe')][_0xf6bd('0x9')]=function(){this[_0xf6bd('0x6')][_0xf6bd('0x9')](this['handleRun'][_0xf6bd('0xc')](this),this[_0xf6bd('0xb')][_0xf6bd('0xc')](this));};Beepall['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0xf6bd('0xa')]=function(){var _0x12e72f=!![];if(!_[_0xf6bd('0xf')](this[_0xf6bd('0x7')])&&!_[_0xf6bd('0xf')](this[_0xf6bd('0x7')][_0xf6bd('0x10')])&&this['queue'][_0xf6bd('0x10')][_0xf6bd('0x11')]>0x0){for(var _0x2a1331=0x0,_0x5b61f4;_0x2a13310x0){for(var _0x13a647=0x0,_0x68edd5;_0x13a6470x0&&_0x21ad5a[_0x1d9fd2+_0xc8a2('0x22')]>=_0x21ad5a[_0x1d9fd2+_0xc8a2('0x20')]){writeLog(_0x5e5ddf,_0x21ad5a,_0x1d9fd2['toUpperCase']()+_0xc8a2('0x23'));return![];}}return!![];};exports[_0xc8a2('0x24')]=function(_0x422495,_0x22cdac,_0x5b840e,_0x388e92,_0x3507ac){return sendNotification(!![],_0x422495,_0x22cdac,_0x5b840e,_0x388e92,_0x3507ac);};exports[_0xc8a2('0x25')]=function(_0x153767,_0x42bf4d,_0x29a31f,_0x9aa559,_0x45bfe0){return sendNotification(![],_0x153767,_0x42bf4d,_0x29a31f,_0x9aa559,_0x45bfe0);};exports[_0xc8a2('0x26')]=function(_0x295ebe,_0x53d611,_0x14b191){var _0x818077=_0x53d611[_0xc8a2('0x27')][_0xc8a2('0x28')];if(!_0x818077&&_0x14b191){_0x818077=_0x14b191['id'];}var _0xbba0c1=_[_0xc8a2('0x29')](_0x295ebe[_0x53d611[_0xc8a2('0x2a')]+'QueuesWaitingInteractions'],function(_0x138356){var _0x3ee245=_[_0xc8a2('0x2b')](_0x53d611[_0xc8a2('0x2a')])+_0xc8a2('0x2c');return _0x138356[_0x3ee245]===_0x53d611[_0xc8a2('0x27')]['id'];});if(!_0xbba0c1&&_0x818077&&_0x295ebe[_0xc8a2('0x2d')][_0x818077]){_0xbba0c1=_[_0xc8a2('0x29')](_0x295ebe[_0xc8a2('0x2d')][_0x818077][_0x53d611[_0xc8a2('0x2a')]+_0xc8a2('0x2e')],function(_0x8eb749){return _0x8eb749['id']===_0x53d611['interaction']['id'];});}return _0xbba0c1;};exports[_0xc8a2('0x2f')]=function(_0x4c040a,_0x4f9725,_0x390cfb,_0x13262a){if(_0x390cfb&&_0x390cfb['id']&&_0x4c040a[_0xc8a2('0x2d')]&&_0x4c040a[_0xc8a2('0x2d')][_0x390cfb['id']]){_0x4c040a[_0xc8a2('0x2d')][_0x390cfb['id']][_0x13262a+_0xc8a2('0x2e')][_0x4f9725[_0xc8a2('0x11')]['id']]={'id':_0x4f9725['interaction']['id']};}};exports[_0xc8a2('0x30')]=function(_0x4369d4,_0xa5c7ce,_0x5e04e8,_0x294ef8){if(_0x5e04e8&&_0x5e04e8['id']&&_0x4369d4[_0xc8a2('0x2d')]&&_0x4369d4[_0xc8a2('0x2d')][_0x5e04e8['id']]){delete _0x4369d4[_0xc8a2('0x2d')][_0x5e04e8['id']][_0x294ef8+_0xc8a2('0x2e')][_0xa5c7ce[_0xc8a2('0x11')]['id']];}};exports[_0xc8a2('0x31')]=writeLog; \ No newline at end of file +var _0xdb2b=['\x20MAXCAPACITY','hideNotification','checkWaitingNotifications','interaction','UserId','capitalize','channel','InteractionId','agents','WaitingInteractions','removeWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','name','notificationSound','account','body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','save','remove','debug','isAgentAvailable','busy','online','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase'];(function(_0x847d95,_0x1acd5e){var _0x4bbc88=function(_0x2d3722){while(--_0x2d3722){_0x847d95['push'](_0x847d95['shift']());}};_0x4bbc88(++_0x1acd5e);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x51fb3c,_0x28a763){_0x51fb3c=_0x51fb3c-0x0;var _0x941d96=_0xdb2b[_0x51fb3c];return _0x941d96;};'use strict';var _=require(_0xbdb2('0x0'));var util=require('util');var utils=require(_0xbdb2('0x1'));var Redis=require(_0xbdb2('0x2'));var config=require(_0xbdb2('0x3'));var logger=require(_0xbdb2('0x4'))(_0xbdb2('0x5'));config[_0xbdb2('0x6')]=_[_0xbdb2('0x7')](config[_0xbdb2('0x6')],{'host':_0xbdb2('0x8'),'port':0x18eb});var io=require(_0xbdb2('0x9'))(new Redis(config[_0xbdb2('0x6')]));function sendNotification(_0xdabd3c,_0x5a4c37,_0x51fc95,_0x762443,_0x40717f,_0x29898c){var _0x1fa152=_0x29898c||{};var _0x352f74=_0x51fc95[_0xbdb2('0xa')]('.');var _0x4cbf3b={'uniqueid':_0x5a4c37,'channel':_0x352f74[0x0],'id':_0x352f74[0x1],'title':_0x352f74[0x0]+_0xbdb2('0xb'),'interactionId':_0x352f74[0x2],'queue':_0x40717f?_0x40717f[_0xbdb2('0xc')]:null,'sound':_0x1fa152['account'][_0xbdb2('0xd')],'shake':_0x1fa152[_0xbdb2('0xe')]['notificationShake']};try{if(!_0x1fa152[_0xbdb2('0xf')]){_0x1fa152[_0xbdb2('0xf')]={};}if(_0x40717f){_0x1fa152[_0xbdb2('0xf')]['queue']=_0x40717f;}else if(_0x1fa152[_0xbdb2('0xf')][_0xbdb2('0x10')]){delete _0x1fa152[_0xbdb2('0xf')][_0xbdb2('0x10')];}_0x4cbf3b['msg']=utils[_0xbdb2('0x11')](_0x1fa152[_0xbdb2('0xe')]['notificationTemplate'],_0x1fa152);}catch(_0x5a6acf){_0x4cbf3b[_0xbdb2('0x12')]=_0xbdb2('0x13');logger[_0xbdb2('0x14')](util[_0xbdb2('0x15')](_0xbdb2('0x16'),_0x5a4c37,_0x5a6acf[_0xbdb2('0x17')]));}io['to'](util[_0xbdb2('0x15')](_0xbdb2('0x18'),_0x762443['name']))[_0xbdb2('0x19')](util['format'](_0xbdb2('0x1a'),_0xdabd3c?_0xbdb2('0x1b'):_0xbdb2('0x1c')),_0x4cbf3b);}function writeLog(_0x4856fe,_0x51ca65,_0xd912eb){return logger[_0xbdb2('0x1d')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4856fe,_0x51ca65['name'],_0xd912eb));}exports[_0xbdb2('0x1e')]=function(_0x20a754,_0x3a9629,_0x228881,_0x4062d7){if(_0x3a9629[_0xbdb2('0x1f')]){writeLog(_0x20a754,_0x3a9629,'BUSY');return![];}if(!_0x3a9629[_0xbdb2('0x20')]){writeLog(_0x20a754,_0x3a9629,'OFFLINE');return![];}if(_0x3a9629[_0x228881+_0xbdb2('0x21')]){writeLog(_0x20a754,_0x3a9629,'PAUSE');return![];}if(_0x4062d7&&_0x3a9629[_0xbdb2('0x22')](_0x228881+_0xbdb2('0x23'))&&_0x3a9629['hasOwnProperty'](_0x228881+_0xbdb2('0x24'))){if(_0x3a9629[_0x228881+_0xbdb2('0x23')]>0x0&&_0x3a9629[_0x228881+'CurrentCapacity']>=_0x3a9629[_0x228881+_0xbdb2('0x23')]){writeLog(_0x20a754,_0x3a9629,_0x228881[_0xbdb2('0x25')]()+_0xbdb2('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x560feb,_0x13fca9,_0x386af6,_0x47b560,_0x3ce8aa){return sendNotification(!![],_0x560feb,_0x13fca9,_0x386af6,_0x47b560,_0x3ce8aa);};exports[_0xbdb2('0x27')]=function(_0x4fd945,_0x4ce2e9,_0x4bb221,_0x50d69b,_0x596704){return sendNotification(![],_0x4fd945,_0x4ce2e9,_0x4bb221,_0x50d69b,_0x596704);};exports[_0xbdb2('0x28')]=function(_0x442b94,_0x121312,_0x49aace){var _0x424bdc=_0x121312[_0xbdb2('0x29')][_0xbdb2('0x2a')];if(!_0x424bdc&&_0x49aace){_0x424bdc=_0x49aace['id'];}var _0x3c3bae=_['some'](_0x442b94[_0x121312['channel']+'QueuesWaitingInteractions'],function(_0x5709b0){var _0x1405c5=_[_0xbdb2('0x2b')](_0x121312[_0xbdb2('0x2c')])+_0xbdb2('0x2d');return _0x5709b0[_0x1405c5]===_0x121312[_0xbdb2('0x29')]['id'];});if(!_0x3c3bae&&_0x424bdc&&_0x442b94[_0xbdb2('0x2e')][_0x424bdc]){_0x3c3bae=_['some'](_0x442b94['agents'][_0x424bdc][_0x121312[_0xbdb2('0x2c')]+_0xbdb2('0x2f')],function(_0x41c264){return _0x41c264['id']===_0x121312[_0xbdb2('0x29')]['id'];});}return _0x3c3bae;};exports['saveWaitingNotification']=function(_0x3353a0,_0x158858,_0x19a9a9,_0x248193){if(_0x19a9a9&&_0x19a9a9['id']&&_0x3353a0['agents']&&_0x3353a0[_0xbdb2('0x2e')][_0x19a9a9['id']]){_0x3353a0[_0xbdb2('0x2e')][_0x19a9a9['id']][_0x248193+_0xbdb2('0x2f')][_0x158858[_0xbdb2('0x17')]['id']]={'id':_0x158858[_0xbdb2('0x29')]['id']};}};exports[_0xbdb2('0x30')]=function(_0xfb65d9,_0x532226,_0x2e3982,_0x56beff){if(_0x2e3982&&_0x2e3982['id']&&_0xfb65d9[_0xbdb2('0x2e')]&&_0xfb65d9[_0xbdb2('0x2e')][_0x2e3982['id']]){delete _0xfb65d9[_0xbdb2('0x2e')][_0x2e3982['id']][_0x56beff+_0xbdb2('0x2f')][_0x532226[_0xbdb2('0x17')]['id']];}};exports[_0xbdb2('0x31')]=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 33abb92..ad19fe1 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 _0x3a60=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','string','consequence','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x54af6e,_0x44cd8f){var _0x38dc27=function(_0xbe1d4e){while(--_0xbe1d4e){_0x54af6e['push'](_0x54af6e['shift']());}};_0x38dc27(++_0x44cd8f);}(_0x3a60,0x135));var _0x03a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a60[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x03a6('0x0'));var sh=require(_0x03a6('0x1'));var _=require(_0x03a6('0x2'));var utils=require(_0x03a6('0x3'));var logger=require(_0x03a6('0x4'))('routing');var system=schema({'command':{'type':_0x03a6('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x03a6('0x6')]=function(_0x4dc8ad,_0x3a87df){return function(_0x3cebae){try{var _0x441249={'command':_0x3a87df[0x0]};var _0x5a4e2d=system[_0x03a6('0x0')](_0x441249,{'typecast':!![]});if(_0x5a4e2d['length']){logger[_0x03a6('0x7')](_0x03a6('0x8'),_0x4dc8ad,_['map'](_0x5a4e2d,_0x03a6('0x9'))[_0x03a6('0xa')](',\x20'));logger[_0x03a6('0xb')](_0x03a6('0xc'),_0x4dc8ad);_0x3cebae[_0x03a6('0xd')]();}else{var _0x4c4db1=this;var _0x5151b6=utils[_0x03a6('0xe')](_0x3a87df[0x0],this);logger[_0x03a6('0xb')](_0x03a6('0xf'),_0x4dc8ad,_0x5151b6);sh[_0x03a6('0x10')](_[_0x03a6('0x11')](_0x5151b6),function(_0x6c9d07,_0x57019e){logger[_0x03a6('0xb')](_0x03a6('0x12'),_0x4dc8ad,_0x6c9d07);if(_0x6c9d07==0x0){var _0x5f4a65=_0x57019e[_0x03a6('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3a87df[0x1])||_[_0x03a6('0x14')](_0x3a87df[0x1])){logger[_0x03a6('0xb')](_0x03a6('0x15'),_0x4dc8ad);_0x4c4db1[_0x03a6('0x16')][_0x3a87df[0x1]]=_0x5f4a65;}else{logger['info'](_0x03a6('0x17'),_0x4dc8ad,_0x3a87df[0x1],_0x5f4a65);_0x4c4db1['body'][_0x3a87df[0x1]]=_0x5f4a65;}}_0x3cebae[_0x03a6('0xd')]();});}}catch(_0x4394fb){logger[_0x03a6('0x7')](_0x03a6('0x8'),_0x4dc8ad,_[_0x03a6('0x18')](_0x4394fb)?JSON['stringify'](_0x4394fb):_0x4394fb);logger[_0x03a6('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4dc8ad);_0x3cebae[_0x03a6('0xd')]();}};}; \ No newline at end of file +var _0xe1fe=['validate','routing','string','consequence','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xe1fe,0x114));var _0xee1f=function(_0x122a8e,_0x49c307){_0x122a8e=_0x122a8e-0x0;var _0x56fc0d=_0xe1fe[_0x122a8e];return _0x56fc0d;};'use strict';var schema=require(_0xee1f('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xee1f('0x1'));var system=schema({'command':{'type':_0xee1f('0x2'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xee1f('0x3')]=function(_0x3d1f42,_0x5de093){return function(_0x276b41){try{var _0x8c07f2={'command':_0x5de093[0x0]};var _0x3fa2fa=system[_0xee1f('0x0')](_0x8c07f2,{'typecast':!![]});if(_0x3fa2fa[_0xee1f('0x4')]){logger['error'](_0xee1f('0x5'),_0x3d1f42,_[_0xee1f('0x6')](_0x3fa2fa,'message')[_0xee1f('0x7')](',\x20'));logger[_0xee1f('0x8')](_0xee1f('0x9'),_0x3d1f42);_0x276b41[_0xee1f('0xa')]();}else{var _0xf70675=this;var _0x254d3b=utils['getMustacheRender'](_0x5de093[0x0],this);logger[_0xee1f('0x8')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x3d1f42,_0x254d3b);sh[_0xee1f('0xb')](_[_0xee1f('0xc')](_0x254d3b),function(_0x1373dd,_0x46ed5e){logger['info'](_0xee1f('0xd'),_0x3d1f42,_0x1373dd);if(_0x1373dd==0x0){var _0x28934e=_0x46ed5e[_0xee1f('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xee1f('0xf')](_0x5de093[0x1])||_[_0xee1f('0x10')](_0x5de093[0x1])){logger[_0xee1f('0x8')](_0xee1f('0x11'),_0x3d1f42);_0xf70675[_0xee1f('0x12')][_0x5de093[0x1]]=_0x28934e;}else{logger[_0xee1f('0x8')](_0xee1f('0x13'),_0x3d1f42,_0x5de093[0x1],_0x28934e);_0xf70675[_0xee1f('0x12')][_0x5de093[0x1]]=_0x28934e;}}_0x276b41['next']();});}}catch(_0x44c61c){logger[_0xee1f('0x14')](_0xee1f('0x5'),_0x3d1f42,_[_0xee1f('0x15')](_0x44c61c)?JSON[_0xee1f('0x16')](_0x44c61c):_0x44c61c);logger[_0xee1f('0x8')](_0xee1f('0x9'),_0x3d1f42);_0x276b41[_0xee1f('0xa')]();}};}; \ 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 301adc0..17b732e 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 _0x207b=['../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x207b,0x19b));var _0xb207=function(_0x370281,_0x50b615){_0x370281=_0x370281-0x0;var _0x33a7ae=_0x207b[_0x370281];return _0x33a7ae;};'use strict';var schema=require(_0xb207('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb207('0x1')),'smsInteraction':require(_0xb207('0x2')),'mailInteraction':require(_0xb207('0x3')),'faxInteraction':require(_0xb207('0x4')),'whatsappInteraction':require(_0xb207('0x5'))};var logger=require(_0xb207('0x6'))('routing');var tag=schema({'tag':{'type':_0xb207('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xb207('0x8')]=function(_0x5de88f,_0x20f4bc,_0x29c3be,_0x201afa){return function(_0x426033){try{var _0x1808d1={'tag':_0x20f4bc[0x0]};var _0x21d6a6=tag['validate'](_0x1808d1,{'typecast':!![]});if(_0x21d6a6[_0xb207('0x9')]){logger[_0xb207('0xa')](_0xb207('0xb'),_0x5de88f,_[_0xb207('0xc')](_0x21d6a6,_0xb207('0xd'))[_0xb207('0xe')](',\x20'));logger[_0xb207('0xf')](_0xb207('0x10'),_0x5de88f);_0x426033[_0xb207('0x11')]();}else{var _0x2a4bfa={'ids':[_0x20f4bc[0x0]]};if(rpc[_0x201afa[_0xb207('0x12')]+'Interaction']){rpc[_0x201afa[_0xb207('0x12')]+_0xb207('0x13')][_0xb207('0x14')](_0x201afa[_0xb207('0x15')]['id'],_0x2a4bfa)['then'](function(_0x3167b9){logger[_0xb207('0xf')](_0xb207('0x16'),_0x5de88f,_0x20f4bc[0x1],_0x201afa[_0xb207('0x12')],_0x201afa['interaction']['id']);})['catch'](function(_0x521b03){logger[_0xb207('0xa')](_0xb207('0xb'),_0x5de88f,JSON[_0xb207('0x17')](_0x521b03));logger[_0xb207('0xf')](_0xb207('0x10'),_0x5de88f);})[_0xb207('0x18')](function(){_0x426033[_0xb207('0x11')]();});}}}catch(_0x4fdaf4){logger['error'](_0xb207('0xb'),_0x5de88f,_[_0xb207('0x19')](_0x4fdaf4)?JSON['stringify'](_0x4fdaf4):_0x4fdaf4);logger['info'](_0xb207('0x10'),_0x5de88f);_0x426033[_0xb207('0x11')]();}};}; \ No newline at end of file +var _0x5439=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','interaction','catch','stringify','info','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5439,0xec));var _0x9543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5439[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x9543('0x0'));var _=require(_0x9543('0x1'));var rpc={'chatInteraction':require(_0x9543('0x2')),'openchannelInteraction':require(_0x9543('0x3')),'smsInteraction':require(_0x9543('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x9543('0x5')),'whatsappInteraction':require(_0x9543('0x6'))};var logger=require(_0x9543('0x7'))(_0x9543('0x8'));var tag=schema({'tag':{'type':_0x9543('0x9'),'required':!![],'message':_0x9543('0xa')}});exports[_0x9543('0xb')]=function(_0x10b487,_0x36f412,_0x36d379,_0x2736e0){return function(_0x2a7587){try{var _0x1ded14={'tag':_0x36f412[0x0]};var _0x284950=tag[_0x9543('0x0')](_0x1ded14,{'typecast':!![]});if(_0x284950[_0x9543('0xc')]){logger[_0x9543('0xd')](_0x9543('0xe'),_0x10b487,_[_0x9543('0xf')](_0x284950,'message')['join'](',\x20'));logger['info'](_0x9543('0x10'),_0x10b487);_0x2a7587[_0x9543('0x11')]();}else{var _0x59bc5e={'ids':[_0x36f412[0x0]]};if(rpc[_0x2736e0['channel']+_0x9543('0x12')]){rpc[_0x2736e0['channel']+'Interaction']['addTags'](_0x2736e0['interaction']['id'],_0x59bc5e)[_0x9543('0x13')](function(_0x2c25d1){logger['info'](_0x9543('0x14'),_0x10b487,_0x36f412[0x1],_0x2736e0[_0x9543('0x15')],_0x2736e0[_0x9543('0x16')]['id']);})[_0x9543('0x17')](function(_0x5d7b16){logger[_0x9543('0xd')]('[%s][TAG]\x20%s',_0x10b487,JSON[_0x9543('0x18')](_0x5d7b16));logger[_0x9543('0x19')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x10b487);})[_0x9543('0x1a')](function(){_0x2a7587[_0x9543('0x11')]();});}}}catch(_0x13cb3f){logger[_0x9543('0xd')](_0x9543('0xe'),_0x10b487,_[_0x9543('0x1b')](_0x13cb3f)?JSON[_0x9543('0x18')](_0x13cb3f):_0x13cb3f);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x10b487);_0x2a7587[_0x9543('0x11')]();}};}; \ 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 f5f90f5..6eafeb1 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 _0x5e9d=['&serviceId=','&sessionId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','method','utf8','application/json-rpc','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId='];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5e9d,0x64));var _0xd5e9=function(_0x3e10b0,_0x4544e3){_0x3e10b0=_0x3e10b0-0x0;var _0x14b94d=_0x5e9d[_0x3e10b0];return _0x14b94d;};'use strict';var rp=require('request-promise');var logger=require(_0xd5e9('0x0'))(_0xd5e9('0x1'));var _=require('lodash');var arr=[];exports[_0xd5e9('0x2')]=function(_0x49151c,_0xbdcc0d){return function(_0x218315){var _0x3a1961=_0xbdcc0d[0xa];var _0x1d0a3b=_0xbdcc0d[0xb];var _0x16fe30=_0xbdcc0d[0xc];var _0x62b0f1=_0xbdcc0d[0xd];var _0x379551=_0xbdcc0d[0xe];var _0x1afa8b=_0xbdcc0d[0xf][_0xd5e9('0x3')](/\n/g,'\x20-\x20');var _0x3c88c4=_0xbdcc0d[0x10][_0xd5e9('0x3')](/\n/g,'\x20');if(!arr[_0xd5e9('0x4')](_0x1d0a3b)){arr[_0xd5e9('0x5')](_0x1d0a3b);var _0x3cb6e6=_0xbdcc0d[0x3];var _0x22758e=_0xbdcc0d[0x4];var _0x17703b=_0xbdcc0d[0x1];var _0xd06bb4=_0xbdcc0d[0x0];var _0x111ae7={};_0x111ae7[_0xd5e9('0x6')]=_0xbdcc0d[0x8]+_0xd5e9('0x7')+_0x16fe30+'|'+_0x3a1961+'|'+_0x62b0f1+'|'+_0x1d0a3b+'|'+_0x379551;_0x111ae7[_0xd5e9('0x8')]=_0xbdcc0d[0x7]+_0xd5e9('0x7')+_0x16fe30+'|'+_0x3a1961+'|'+_0x62b0f1+'|'+_0x1d0a3b+'|'+_0x379551+'|'+_0x1afa8b+'|'+_0x3c88c4;_0x111ae7['title']=_0xbdcc0d[0x9];var _0x11d06e={};_0x11d06e[_0xd5e9('0x9')]='2.0';_0x11d06e[_0xd5e9('0xa')]='login';var _0x23599b=[];_0x23599b[_0xd5e9('0x5')](_0xbdcc0d[0x2]);_0x23599b[_0xd5e9('0x5')](_0xbdcc0d[0x5]);_0x23599b[_0xd5e9('0x5')](_0xbdcc0d[0x6]);_0x11d06e['params']=_0x23599b;_0x11d06e['id']=0x1;var _0x13b395=JSON['stringify'](_0x11d06e);var _0x27ca43={'encoding':_0xd5e9('0xb'),'method':'POST','timeout':0x2710,'url':_0x3cb6e6,'headers':{'Content-Type':_0xd5e9('0xc')},'body':_0x13b395};return rp(_0x27ca43)['then'](function(_0x4c4ab1){const _0x1eab16=JSON[_0xd5e9('0xd')](_0x4c4ab1);if(!_0x1eab16['result']['logged']){throw new Error(_0xd5e9('0xe'));}var _0x23b560=_0x1d0a3b;var _0x40691a=_0xd5e9('0xf')+_0x17703b+_0xd5e9('0x10')+_0xd06bb4+_0xd5e9('0x11')+_0x23b560+_0xd5e9('0x12')+JSON[_0xd5e9('0x13')](_0x111ae7);var _0xfc9d07=_0x22758e+'?'+_0x40691a;return rp(_0xfc9d07);})[_0xd5e9('0x14')](function(_0x4fb796){logger[_0xd5e9('0x15')](_0xd5e9('0x16'),_0x49151c,_0x4fb796);_0x218315[_0xd5e9('0x17')]();})[_0xd5e9('0x18')](function(_0x3b3af0){logger[_0xd5e9('0x19')]('[%s][TVOX]\x20%s',_0x49151c,_[_0xd5e9('0x1a')](_0x3b3af0)?JSON[_0xd5e9('0x13')](_0x3b3af0):_0x3b3af0);_0x218315['stop']();});}else{logger[_0xd5e9('0x15')](_0xd5e9('0x1b'),_0x49151c);_0x218315[_0xd5e9('0x1c')]();}};}; \ No newline at end of file +var _0xe619=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','../../../../config/logger','routing','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result'];(function(_0x4df787,_0x337596){var _0x20fe58=function(_0x177bf2){while(--_0x177bf2){_0x4df787['push'](_0x4df787['shift']());}};_0x20fe58(++_0x337596);}(_0xe619,0xf3));var _0x9e61=function(_0x552041,_0xc34ee7){_0x552041=_0x552041-0x0;var _0x198a1a=_0xe619[_0x552041];return _0x198a1a;};'use strict';var rp=require('request-promise');var logger=require(_0x9e61('0x0'))(_0x9e61('0x1'));var _=require('lodash');var arr=[];exports['consequence']=function(_0xd923fc,_0x4745ff){return function(_0x52dc67){var _0x1192d5=_0x4745ff[0xa];var _0x4db029=_0x4745ff[0xb];var _0x552552=_0x4745ff[0xc];var _0x4f18cb=_0x4745ff[0xd];var _0x584734=_0x4745ff[0xe];var _0x317e2a=_0x4745ff[0xf][_0x9e61('0x2')](/\n/g,_0x9e61('0x3'));var _0x22a682=_0x4745ff[0x10][_0x9e61('0x2')](/\n/g,'\x20');if(!arr[_0x9e61('0x4')](_0x4db029)){arr[_0x9e61('0x5')](_0x4db029);var _0x27453a=_0x4745ff[0x3];var _0x348d21=_0x4745ff[0x4];var _0x1d1fd4=_0x4745ff[0x1];var _0x5f112b=_0x4745ff[0x0];var _0x54f4c4={};_0x54f4c4[_0x9e61('0x6')]=_0x4745ff[0x8]+_0x9e61('0x7')+_0x552552+'|'+_0x1192d5+'|'+_0x4f18cb+'|'+_0x4db029+'|'+_0x584734;_0x54f4c4[_0x9e61('0x8')]=_0x4745ff[0x7]+_0x9e61('0x7')+_0x552552+'|'+_0x1192d5+'|'+_0x4f18cb+'|'+_0x4db029+'|'+_0x584734+'|'+_0x317e2a+'|'+_0x22a682;_0x54f4c4[_0x9e61('0x9')]=_0x4745ff[0x9];var _0x95625e={};_0x95625e[_0x9e61('0xa')]='2.0';_0x95625e[_0x9e61('0xb')]=_0x9e61('0xc');var _0xd4912e=[];_0xd4912e[_0x9e61('0x5')](_0x4745ff[0x2]);_0xd4912e['push'](_0x4745ff[0x5]);_0xd4912e['push'](_0x4745ff[0x6]);_0x95625e[_0x9e61('0xd')]=_0xd4912e;_0x95625e['id']=0x1;var _0x5042eb=JSON[_0x9e61('0xe')](_0x95625e);var _0x39f814={'encoding':_0x9e61('0xf'),'method':_0x9e61('0x10'),'timeout':0x2710,'url':_0x27453a,'headers':{'Content-Type':_0x9e61('0x11')},'body':_0x5042eb};return rp(_0x39f814)[_0x9e61('0x12')](function(_0x4d49f6){const _0x37a2c2=JSON[_0x9e61('0x13')](_0x4d49f6);if(!_0x37a2c2[_0x9e61('0x14')][_0x9e61('0x15')]){throw new Error(_0x9e61('0x16'));}var _0x5d3d3c=_0x4db029;var _0x3f67c3=_0x9e61('0x17')+_0x1d1fd4+'&serviceId='+_0x5f112b+_0x9e61('0x18')+_0x5d3d3c+_0x9e61('0x19')+JSON['stringify'](_0x54f4c4);var _0xc8525f=_0x348d21+'?'+_0x3f67c3;return rp(_0xc8525f);})['then'](function(_0x2137bb){logger[_0x9e61('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0xd923fc,_0x2137bb);_0x52dc67[_0x9e61('0x1b')]();})[_0x9e61('0x1c')](function(_0x505e80){logger[_0x9e61('0x1d')](_0x9e61('0x1e'),_0xd923fc,_[_0x9e61('0x1f')](_0x505e80)?JSON[_0x9e61('0xe')](_0x505e80):_0x505e80);_0x52dc67[_0x9e61('0x1b')]();});}else{logger[_0x9e61('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xd923fc);_0x52dc67[_0x9e61('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index cb1c5f0..19db98c 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1ac309,_0x55a94b){var _0x5c1ee3=function(_0x5c2882){while(--_0x5c2882){_0x1ac309['push'](_0x1ac309['shift']());}};_0x5c1ee3(++_0x55a94b);}(_0xe706,0xa3));var _0x6e70=function(_0x5d491a,_0x46fe1b){_0x5d491a=_0x5d491a-0x0;var _0x31b402=_0xe706[_0x5d491a];return _0x31b402;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x18344c,_0x212c4e){var _0x316af3=function(_0x1ccb7f){while(--_0x1ccb7f){_0x18344c['push'](_0x18344c['shift']());}};_0x316af3(++_0x212c4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3a7deff..bebfc45 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 _0x5430=['tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','app','.js','toLowerCase','split','mail','push','slice','join','dialogflow','appdata'];(function(_0x41d643,_0x47e321){var _0x2aa9fc=function(_0x5e4e7e){while(--_0x5e4e7e){_0x41d643['push'](_0x41d643['shift']());}};_0x2aa9fc(++_0x47e321);}(_0x5430,0x10c));var _0x0543=function(_0x3a1e12,_0x70989a){_0x3a1e12=_0x3a1e12-0x0;var _0x1ff5b0=_0x5430[_0x3a1e12];return _0x1ff5b0;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var fs=require('fs');var jayson=require(_0x0543('0x3'));var BPromise=require(_0x0543('0x4'));var utils=require(_0x0543('0x5'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0x0543('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0543('0x7')),'smsQueueReport':require(_0x0543('0x8')),'faxQueueReport':require(_0x0543('0x9')),'whatsappQueueReport':require(_0x0543('0xa'))};var RuleEngine=require(_0x0543('0xb'));function getId(_0x5ac352,_0x372974,_0x7b8280){return util[_0x0543('0xc')](_0x0543('0xd'),_0x5ac352,_0x372974||0x0,_0x7b8280||0x0);}function getIntervals(_0x2fb723,_0x94b9e7){var _0x56003c=[];if(!_[_0x0543('0xe')](_0x94b9e7[_0x0543('0xf')])&&!_['isNil'](_0x2fb723[_0x94b9e7[_0x0543('0xf')]])&&!_[_0x0543('0xe')](_0x2fb723[_0x94b9e7[_0x0543('0xf')]][_0x0543('0x10')])){_0x56003c=_[_0x0543('0x11')](_0x2fb723[_0x94b9e7[_0x0543('0xf')]][_0x0543('0x10')],_0x0543('0x12'));}else if(!_[_0x0543('0xe')](_0x94b9e7[_0x0543('0x12')])){_0x56003c=[_0x94b9e7[_0x0543('0x12')]];}return _0x56003c;}exports[_0x0543('0x13')]=function(_0x552980){_0x552980[_0x0543('0x14')]={};return new BPromise(function(_0x21e9ac,_0x4d2a27){var _0x4c4763={'Start':function(_0xcb09df){var _0x40fb03=this;return new Promise(function(_0x1dff7d,_0x1cfadf){if(_0xcb09df){try{var _0x38a32e=[];var _0x50d504=getId(_0xcb09df[_0x0543('0x15')],_0xcb09df[_0x0543('0x16')]?_0xcb09df[_0x0543('0x16')]['id']:0x0,_0xcb09df[_0x0543('0x17')]?_0xcb09df[_0x0543('0x17')]['id']:0x0);var _0x285080=sUtils[_0x0543('0x18')](_0x552980,_0xcb09df);if(_0xcb09df['transfer']||!_0x285080&&_0xcb09df[_0x0543('0x19')]&&_['isArray'](_0xcb09df['applications'])&&_0xcb09df[_0x0543('0x19')][_0x0543('0x1a')]){for(var _0x1aece5=0x0;_0x1aece5<_0xcb09df['applications'][_0x0543('0x1a')];_0x1aece5+=0x1){var _0x51c271=_0xcb09df[_0x0543('0x19')][_0x1aece5];if(fs[_0x0543('0x1b')](path['join'](__dirname,_0x0543('0x19'),_0x51c271[_0x0543('0x1c')]+_0x0543('0x1d')))){var _0x110060=[];switch(_0x51c271[_0x0543('0x1c')][_0x0543('0x1e')]()){case'autoreply':var _0x5979d2=_0x51c271['appdata'][_0x0543('0x1f')](',');if(_0xcb09df[_0x0543('0x15')]===_0x0543('0x20')){_0x110060[_0x0543('0x21')](_0x5979d2[0x0]);_0x110060[_0x0543('0x21')](_0x5979d2[0x1]);_0x110060[_0x0543('0x21')](_0x5979d2[_0x0543('0x22')](0x2,_0x5979d2[_0x0543('0x1a')])[_0x0543('0x23')](','));}else{_0x110060[_0x0543('0x21')](_0x5979d2[0x0]);_0x110060[_0x0543('0x21')](_0x5979d2[_0x0543('0x22')](0x1,_0x5979d2['length'])[_0x0543('0x23')](','));}break;case _0x0543('0x24'):var _0x30ad9e=_0x51c271['appdata'][_0x0543('0x1f')](',');_0x110060[_0x0543('0x21')](_0x30ad9e[0x0]);_0x110060[_0x0543('0x21')](_0x30ad9e[0x1]);_0x110060[_0x0543('0x21')](_0x30ad9e['slice'](0x2,_0x30ad9e[_0x0543('0x1a')])[_0x0543('0x23')](','));break;case'dialogflowv2':var _0x576084=_0x51c271[_0x0543('0x25')][_0x0543('0x1f')](',');_0x110060['push'](_0x576084[0x0]);_0x110060[_0x0543('0x21')](_0x576084[0x1]);_0x110060[_0x0543('0x21')](_0x576084[0x2]);_0x110060[_0x0543('0x21')](_0x576084[0x3]);_0x110060[_0x0543('0x21')](_0x576084[_0x0543('0x22')](0x4,_0x576084[_0x0543('0x1a')])[_0x0543('0x23')](','));break;case'amazonlex':var _0x45ac71=_0x51c271['appdata'][_0x0543('0x1f')](',');_0x110060[_0x0543('0x21')](_0x45ac71[0x0]);_0x110060[_0x0543('0x21')](_0x45ac71[0x1]);_0x110060[_0x0543('0x21')](_0x45ac71[0x2]);_0x110060[_0x0543('0x21')](_0x45ac71[0x3]);_0x110060['push'](_0x45ac71[_0x0543('0x22')](0x4,_0x45ac71['length'])[_0x0543('0x23')](','));break;case _0x0543('0x16'):_0x110060[_0x0543('0x21')](_0x51c271[_0x0543('0x25')]);break;case'tag':_0x110060[_0x0543('0x21')](_0x51c271['TagId']);_0x110060[_0x0543('0x21')](_0x51c271[_0x0543('0x25')]);break;case _0x0543('0x26'):var _0x316c6f=utils[_0x0543('0x27')](_0xcb09df[_0x0543('0x28')][_0x0543('0x29')],_0xcb09df);var _0x44c771=_0x51c271[_0x0543('0x25')][_0x0543('0x1f')](',');_0x110060['push'](_0x44c771[0x0]);_0x110060[_0x0543('0x21')](_0x44c771[0x1]);_0x110060[_0x0543('0x21')](_0x44c771[0x2]);_0x110060['push'](_0x44c771[0x3]);_0x110060[_0x0543('0x21')](_0x44c771[0x4]);_0x110060['push'](_0x44c771[0x5]);_0x110060[_0x0543('0x21')](_0x44c771[0x6]);_0x110060[_0x0543('0x21')](_0x44c771[0x7]);_0x110060['push'](_0x44c771[0x8]);_0x110060['push'](_0x44c771[0x9]);_0x110060[_0x0543('0x21')](_0x44c771[0xa]);_0x110060[_0x0543('0x21')](_0xcb09df['interaction']['id']);_0x110060[_0x0543('0x21')](_0xcb09df[_0x0543('0x16')]['id']);_0x110060['push'](_0x51c271[_0x0543('0x2a')]);_0x110060[_0x0543('0x21')](_0xcb09df[_0x0543('0x17')][_0x0543('0x2b')]);_0x110060[_0x0543('0x21')](_0xcb09df['body']['body']);_0x110060['push'](_0x316c6f);break;default:_0x110060=_[_0x0543('0xe')](_0x51c271[_0x0543('0x25')])?[]:_0x51c271[_0x0543('0x25')][_0x0543('0x1f')](',');}var _0x529ee0={'id':util[_0x0543('0xc')](_0x0543('0x2c'),_0x50d504,_0x51c271['id'],_0x51c271[_0x0543('0x1c')]),'condition':require(_0x0543('0x2d'))[_0x0543('0x2e')](_0x50d504,getIntervals(_0x552980[_0x0543('0x2f')],_0x51c271),_0x552980),'consequence':require(_0x0543('0x30')+_0x51c271['app'])[_0x0543('0x31')](_0x50d504,_0x110060,_0x552980,_0xcb09df),'p':_0x51c271[_0x0543('0x32')]||0x0};logger[_0x0543('0x33')](_0x0543('0x34'),_0x529ee0['id'],_0x0543('0x35'),getIntervals(_0x552980[_0x0543('0x2f')],_0x51c271)['join']('\x20|\x20'));_0x38a32e[_0x0543('0x21')](_0x529ee0);}else{logger[_0x0543('0x36')](_0x0543('0x37'),path[_0x0543('0x23')](__dirname,_0x0543('0x19'),_0x51c271[_0x0543('0x1c')]+_0x0543('0x1d')));}}_0x552980[_0x0543('0x14')][_0x50d504]=new RuleEngine(_0x38a32e);_0x552980[_0x0543('0x14')][_0x50d504]['execute'](_0xcb09df,function(_0x4c99f0){logger[_0x0543('0x33')](_0x0543('0x38'),JSON['stringify'](_0x4c99f0['matchPath']));if(_0x552980[_0x0543('0x14')][_0x50d504]){_0x552980[_0x0543('0x14')][_0x50d504]['emit'](_0x0543('0x39'));}});return _0x1dff7d({'code':0xc8,'message':_0xcb09df});}else{if(_0x285080){logger['info'](util[_0x0543('0xc')](_0x0543('0x3a'),_0x50d504));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x1dff7d({'code':0xc8,'message':_0xcb09df});}}catch(_0xd95442){logger['error'](_0xd95442[_0x0543('0x3b')]);return _0x1cfadf(_0x40fb03[_0x0543('0x36')](0x1f4,_0xd95442));}}return _0x1cfadf(_0x0543('0x3c'));});},'AcceptMessage':function(_0x270ce0){var _0x158536=this;return new Promise(function(_0x310da4,_0x5a28a3){if(_0x270ce0[_0x0543('0x3d')]&&_0x270ce0[_0x0543('0x3d')]['id']){if(_0x552980[_0x0543('0x3e')][_0x270ce0[_0x0543('0x3d')]['id']]){_0x552980[_0x0543('0x3e')][_0x270ce0['agent']['id']][_0x0543('0x3f')]=![];_0x552980['agents'][_0x270ce0[_0x0543('0x3d')]['id']][_0x0543('0x40')]=undefined;}}if(_0x270ce0[_0x0543('0x16')]&&_0x270ce0[_0x0543('0x16')]['id']){try{var _0x32e4e6=getId(_0x270ce0[_0x0543('0x15')],_0x270ce0['message']?_0x270ce0['message']['id']:0x0,_0x270ce0['interaction']?_0x270ce0[_0x0543('0x17')]['id']:0x0);if(_0x552980[_0x0543('0x14')][_0x32e4e6]){_0x552980['rules'][_0x32e4e6][_0x0543('0x41')](_0x0543('0x42'));if(rpc[_0x270ce0[_0x0543('0x15')]+_0x0543('0x43')]){rpc[_0x270ce0[_0x0543('0x15')]+_0x0543('0x43')]['update'](_0x32e4e6,{'UserId':_0x270ce0[_0x0543('0x16')][_0x0543('0x44')]})[_0x0543('0x45')](function(){logger[_0x0543('0x36')](_0x0543('0x46'));});}}return _0x310da4({'code':0xc8,'message':_0x270ce0});}catch(_0x449150){logger[_0x0543('0x36')](_0x449150[_0x0543('0x3b')]);return _0x5a28a3(_0x158536[_0x0543('0x36')](0x1f4,_0x449150));}}logger[_0x0543('0x36')](_0x0543('0x47'));return _0x5a28a3(_0x158536[_0x0543('0x36')](0x1f4,_0x0543('0x47')));});},'RejectMessage':function(_0x95e296){var _0x5805f7=this;return new Promise(function(_0x14358d,_0x3c5acc){if(_0x95e296[_0x0543('0x3d')]&&_0x95e296[_0x0543('0x3d')]['id']){try{if(_0x552980[_0x0543('0x3e')][_0x95e296[_0x0543('0x3d')]['id']]){_0x552980[_0x0543('0x3e')][_0x95e296[_0x0543('0x3d')]['id']][_0x0543('0x3f')]=![];_0x552980[_0x0543('0x3e')][_0x95e296[_0x0543('0x3d')]['id']][_0x0543('0x40')]=undefined;}return _0x14358d({'code':0xc8,'message':_0x95e296});}catch(_0x8e8ac9){logger[_0x0543('0x36')](_0x8e8ac9[_0x0543('0x3b')]);return _0x3c5acc(_0x5805f7['error'](0x1f4,_0x8e8ac9));}}logger[_0x0543('0x36')](_0x0543('0x47'));return _0x3c5acc(_0x5805f7['error'](0x1f4,_0x0543('0x47')));});},'AbandonInteraction':function(_0xcd4d5){var _0x38d66f=this;return new Promise(function(_0x51df8d,_0x190e43){if(_0xcd4d5['channel']&&_0xcd4d5[_0x0543('0x17')]&&_0xcd4d5['interaction']['id']){try{var _0x31aea7=getId(_0xcd4d5['channel'],_0xcd4d5[_0x0543('0x16')]?_0xcd4d5[_0x0543('0x16')]['id']:0x0,_0xcd4d5[_0x0543('0x17')]?_0xcd4d5['interaction']['id']:0x0);if(_0x552980[_0x0543('0x14')][_0x31aea7]){_0x552980[_0x0543('0x14')][_0x31aea7][_0x0543('0x41')](_0x0543('0x42'));}return _0x51df8d({'code':0xc8,'message':_0xcd4d5});}catch(_0x313937){logger[_0x0543('0x36')](_0x313937[_0x0543('0x3b')]);return _0x190e43(_0x38d66f[_0x0543('0x36')](0x1f4,_0x313937));}}logger[_0x0543('0x36')](_0x0543('0x47'));return _0x190e43(_0x38d66f[_0x0543('0x36')](0x1f4,_0x0543('0x47')));});},'AgentCapacity':function(_0x378566){var _0x21504b=this;return new Promise(function(_0x2fc5f4,_0x48cb2c){if(_0x552980['agents'][_0x0543('0x48')](_0x378566['id'])){for(var _0x685f15 in _0x378566[_0x0543('0x49')]){if(_0x378566[_0x0543('0x49')][_0x0543('0x48')](_0x685f15)){if(_0x552980[_0x0543('0x3e')][_0x378566['id']][_0x0543('0x48')](_0x685f15+_0x0543('0x4a'))){_0x552980[_0x0543('0x3e')][_0x378566['id']][_0x685f15+'CurrentCapacity']=parseInt(_0x378566[_0x0543('0x49')][_0x685f15],0xa);}}}_0x552980[_0x0543('0x3e')][_0x378566['id']][_0x0543('0x4b')]();return _0x2fc5f4({'code':0xc8,'message':_0x552980[_0x0543('0x3e')][_0x378566['id']]});}else{return _0x48cb2c(_0x21504b['error'](0x1f4,_0x0543('0x4c')));}});},'Agents':function(_0x1cbb25){return new Promise(function(_0x1bd8d3){var _0x5f08ce=_['values'](_0x552980[_0x0543('0x3e')]);if(_0x1cbb25&&_0x1cbb25['id']){var _0x280fbd=_[_0x0543('0x4d')](_0x5f08ce,function(_0x5311b7){return _0x5311b7['id']===_0x1cbb25['id'];});_0x1bd8d3(_0x280fbd);}else{_0x1bd8d3({'count':_0x5f08ce[_0x0543('0x1a')],'rows':_0x5f08ce});}});},'ChatQueues':function(){return new Promise(function(_0x1dfdd7){var _0x29b72c=[];for(var _0x537b72 in _0x552980[_0x0543('0x4e')]){if(_0x552980[_0x0543('0x4e')][_0x0543('0x48')](_0x537b72)){var _0x183b8f=_0x552980[_0x0543('0x4e')][_0x537b72];var _0x1e694e={'id':_0x183b8f['id'],'available':_0x183b8f[_0x0543('0x4f')],'loggedIn':_0x183b8f[_0x0543('0x50')],'name':_0x183b8f[_0x0543('0x51')],'paused':_0x183b8f[_0x0543('0x52')],'waiting':_0x183b8f[_0x0543('0x53')]};_0x29b72c[_0x0543('0x21')](_0x1e694e);}}_0x1dfdd7({'count':_0x29b72c[_0x0543('0x1a')],'rows':_0x29b72c});});},'MailQueues':function(){return new Promise(function(_0x2b16ef){var _0x4fe411=[];for(var _0x50abbb in _0x552980[_0x0543('0x54')]){if(_0x552980[_0x0543('0x54')][_0x0543('0x48')](_0x50abbb)){var _0x2ee541=_0x552980['mailQueues'][_0x50abbb];var _0xcf969f={'id':_0x2ee541['id'],'available':_0x2ee541['available'],'loggedIn':_0x2ee541[_0x0543('0x50')],'name':_0x2ee541[_0x0543('0x51')],'paused':_0x2ee541[_0x0543('0x52')],'waiting':_0x2ee541['waiting']};_0x4fe411['push'](_0xcf969f);}}_0x2b16ef({'count':_0x4fe411[_0x0543('0x1a')],'rows':_0x4fe411});});},'OpenchannelQueues':function(){return new Promise(function(_0x537b7d){var _0x4a10e8=[];for(var _0x30ee35 in _0x552980[_0x0543('0x55')]){if(_0x552980[_0x0543('0x55')][_0x0543('0x48')](_0x30ee35)){var _0x338c62=_0x552980[_0x0543('0x55')][_0x30ee35];var _0x90fd4a={'id':_0x338c62['id'],'available':_0x338c62[_0x0543('0x4f')],'loggedIn':_0x338c62[_0x0543('0x50')],'name':_0x338c62['name'],'paused':_0x338c62[_0x0543('0x52')],'waiting':_0x338c62[_0x0543('0x53')]};_0x4a10e8[_0x0543('0x21')](_0x90fd4a);}}_0x537b7d({'count':_0x4a10e8[_0x0543('0x1a')],'rows':_0x4a10e8});});},'SmsQueues':function(){return new Promise(function(_0x3d918d){var _0x53f0f3=[];for(var _0x3feaba in _0x552980['smsQueues']){if(_0x552980[_0x0543('0x56')][_0x0543('0x48')](_0x3feaba)){var _0x2b33fd=_0x552980[_0x0543('0x56')][_0x3feaba];var _0x5b4d15={'id':_0x2b33fd['id'],'available':_0x2b33fd[_0x0543('0x4f')],'loggedIn':_0x2b33fd[_0x0543('0x50')],'name':_0x2b33fd[_0x0543('0x51')],'paused':_0x2b33fd['paused'],'waiting':_0x2b33fd[_0x0543('0x53')]};_0x53f0f3['push'](_0x5b4d15);}}_0x3d918d({'count':_0x53f0f3[_0x0543('0x1a')],'rows':_0x53f0f3});});},'FaxQueues':function(){return new Promise(function(_0x3f8fb5){var _0x174dae=[];for(var _0x916a51 in _0x552980[_0x0543('0x57')]){if(_0x552980[_0x0543('0x57')]['hasOwnProperty'](_0x916a51)){var _0x59f214=_0x552980['faxQueues'][_0x916a51];var _0x387334={'id':_0x59f214['id'],'available':_0x59f214[_0x0543('0x4f')],'loggedIn':_0x59f214[_0x0543('0x50')],'name':_0x59f214[_0x0543('0x51')],'paused':_0x59f214[_0x0543('0x52')],'waiting':_0x59f214[_0x0543('0x53')]};_0x174dae[_0x0543('0x21')](_0x387334);}}_0x3f8fb5({'count':_0x174dae[_0x0543('0x1a')],'rows':_0x174dae});});},'WhatsappQueues':function(){return new Promise(function(_0x47ae34){var _0x530b87=[];for(var _0x30390b in _0x552980[_0x0543('0x58')]){if(_0x552980['whatsappQueues'][_0x0543('0x48')](_0x30390b)){var _0x5f5d72=_0x552980[_0x0543('0x58')][_0x30390b];var _0x130901={'id':_0x5f5d72['id'],'available':_0x5f5d72[_0x0543('0x4f')],'loggedIn':_0x5f5d72[_0x0543('0x50')],'name':_0x5f5d72[_0x0543('0x51')],'paused':_0x5f5d72['paused'],'waiting':_0x5f5d72[_0x0543('0x53')]};_0x530b87[_0x0543('0x21')](_0x130901);}}_0x47ae34({'count':_0x530b87['length'],'rows':_0x530b87});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x30992a){var _0x3520e8=_[_0x0543('0x59')](_0x552980['chatQueuesWaitingInteractions']);_0x30992a({'count':_0x3520e8[_0x0543('0x1a')],'rows':_0x3520e8});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x328825){var _0x44d480=_['values'](_0x552980[_0x0543('0x5a')]);_0x328825({'count':_0x44d480[_0x0543('0x1a')],'rows':_0x44d480});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x339b0b){var _0x2e96ce=_['values'](_0x552980[_0x0543('0x5b')]);_0x339b0b({'count':_0x2e96ce[_0x0543('0x1a')],'rows':_0x2e96ce});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xdf249b){var _0x53d3ab=_[_0x0543('0x59')](_0x552980[_0x0543('0x5c')]);_0xdf249b({'count':_0x53d3ab[_0x0543('0x1a')],'rows':_0x53d3ab});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x11bdee){var _0x420b02=_[_0x0543('0x59')](_0x552980[_0x0543('0x5d')]);_0x11bdee({'count':_0x420b02[_0x0543('0x1a')],'rows':_0x420b02});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x18a84d){var _0x20df70=_[_0x0543('0x59')](_0x552980[_0x0543('0x5e')]);_0x18a84d({'count':_0x20df70[_0x0543('0x1a')],'rows':_0x20df70});});}};var _0x59c2af=jayson[_0x0543('0x5f')](_0x4c4763)[_0x0543('0x60')]();_0x59c2af['on'](_0x0543('0x36'),function(_0x41e88a){logger[_0x0543('0x36')](JSON[_0x0543('0x61')](_0x41e88a));return _0x4d2a27(_0x41e88a);});_0x59c2af[_0x0543('0x13')](0x232c,_0x0543('0x62'),function(){console[_0x0543('0x63')](_0x0543('0x64'),0x232c);return _0x21e9ac(_0x0543('0x65')+0x232c);});});}; \ No newline at end of file +var _0x3cae=['checkWaitingNotifications','transfer','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','amazonlex','TagId','tvox','account','notificationTemplate','ContactId','body','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','execute','Applications\x20executed','stringify','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','channel','message','interaction'];(function(_0x271ba2,_0x54a752){var _0x4e760e=function(_0x5324ca){while(--_0x5324ca){_0x271ba2['push'](_0x271ba2['shift']());}};_0x4e760e(++_0x54a752);}(_0x3cae,0x117));var _0xe3ca=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x3cae[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var path=require(_0xe3ca('0x2'));var fs=require('fs');var jayson=require(_0xe3ca('0x3'));var BPromise=require(_0xe3ca('0x4'));var utils=require(_0xe3ca('0x5'));var sUtils=require(_0xe3ca('0x6'));var logger=require('../../../config/logger')(_0xe3ca('0x7'));var rpc={'openchannelQueueReport':require(_0xe3ca('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xe3ca('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe3ca('0xa')),'whatsappQueueReport':require(_0xe3ca('0xb'))};var RuleEngine=require(_0xe3ca('0xc'));function getId(_0x578178,_0x2c4863,_0x100c20){return util[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x578178,_0x2c4863||0x0,_0x100c20||0x0);}function getIntervals(_0x1ae7bf,_0x1785c5){var _0x423bba=[];if(!_['isNil'](_0x1785c5[_0xe3ca('0xf')])&&!_['isNil'](_0x1ae7bf[_0x1785c5[_0xe3ca('0xf')]])&&!_[_0xe3ca('0x10')](_0x1ae7bf[_0x1785c5[_0xe3ca('0xf')]][_0xe3ca('0x11')])){_0x423bba=_[_0xe3ca('0x12')](_0x1ae7bf[_0x1785c5['IntervalId']]['Intervals'],_0xe3ca('0x13'));}else if(!_['isNil'](_0x1785c5[_0xe3ca('0x13')])){_0x423bba=[_0x1785c5[_0xe3ca('0x13')]];}return _0x423bba;}exports['listen']=function(_0x3d62e2){_0x3d62e2[_0xe3ca('0x14')]={};return new BPromise(function(_0x210c69,_0x6a8907){var _0x9ef773={'Start':function(_0x292251){var _0x884795=this;return new Promise(function(_0x337b6c,_0x5f2e2d){if(_0x292251){try{var _0x479977=[];var _0xca43ee=getId(_0x292251[_0xe3ca('0x15')],_0x292251[_0xe3ca('0x16')]?_0x292251[_0xe3ca('0x16')]['id']:0x0,_0x292251[_0xe3ca('0x17')]?_0x292251[_0xe3ca('0x17')]['id']:0x0);var _0x5bb8d8=sUtils[_0xe3ca('0x18')](_0x3d62e2,_0x292251);if(_0x292251[_0xe3ca('0x19')]||!_0x5bb8d8&&_0x292251[_0xe3ca('0x1a')]&&_['isArray'](_0x292251['applications'])&&_0x292251['applications'][_0xe3ca('0x1b')]){for(var _0x593fd1=0x0;_0x593fd1<_0x292251['applications'][_0xe3ca('0x1b')];_0x593fd1+=0x1){var _0x1822e4=_0x292251[_0xe3ca('0x1a')][_0x593fd1];if(fs[_0xe3ca('0x1c')](path[_0xe3ca('0x1d')](__dirname,'applications',_0x1822e4[_0xe3ca('0x1e')]+_0xe3ca('0x1f')))){var _0x5bc481=[];switch(_0x1822e4[_0xe3ca('0x1e')][_0xe3ca('0x20')]()){case _0xe3ca('0x21'):var _0xd681a7=_0x1822e4[_0xe3ca('0x22')][_0xe3ca('0x23')](',');if(_0x292251[_0xe3ca('0x15')]===_0xe3ca('0x24')){_0x5bc481[_0xe3ca('0x25')](_0xd681a7[0x0]);_0x5bc481[_0xe3ca('0x25')](_0xd681a7[0x1]);_0x5bc481[_0xe3ca('0x25')](_0xd681a7['slice'](0x2,_0xd681a7[_0xe3ca('0x1b')])['join'](','));}else{_0x5bc481[_0xe3ca('0x25')](_0xd681a7[0x0]);_0x5bc481[_0xe3ca('0x25')](_0xd681a7[_0xe3ca('0x26')](0x1,_0xd681a7[_0xe3ca('0x1b')])['join'](','));}break;case'dialogflow':var _0x2e1636=_0x1822e4[_0xe3ca('0x22')][_0xe3ca('0x23')](',');_0x5bc481['push'](_0x2e1636[0x0]);_0x5bc481[_0xe3ca('0x25')](_0x2e1636[0x1]);_0x5bc481[_0xe3ca('0x25')](_0x2e1636[_0xe3ca('0x26')](0x2,_0x2e1636[_0xe3ca('0x1b')])['join'](','));break;case'dialogflowv2':var _0xf90c19=_0x1822e4['appdata'][_0xe3ca('0x23')](',');_0x5bc481['push'](_0xf90c19[0x0]);_0x5bc481['push'](_0xf90c19[0x1]);_0x5bc481[_0xe3ca('0x25')](_0xf90c19[0x2]);_0x5bc481[_0xe3ca('0x25')](_0xf90c19[0x3]);_0x5bc481[_0xe3ca('0x25')](_0xf90c19[_0xe3ca('0x26')](0x4,_0xf90c19[_0xe3ca('0x1b')])['join'](','));break;case _0xe3ca('0x27'):var _0x50f226=_0x1822e4['appdata'][_0xe3ca('0x23')](',');_0x5bc481[_0xe3ca('0x25')](_0x50f226[0x0]);_0x5bc481[_0xe3ca('0x25')](_0x50f226[0x1]);_0x5bc481[_0xe3ca('0x25')](_0x50f226[0x2]);_0x5bc481[_0xe3ca('0x25')](_0x50f226[0x3]);_0x5bc481[_0xe3ca('0x25')](_0x50f226[_0xe3ca('0x26')](0x4,_0x50f226[_0xe3ca('0x1b')])[_0xe3ca('0x1d')](','));break;case _0xe3ca('0x16'):_0x5bc481[_0xe3ca('0x25')](_0x1822e4[_0xe3ca('0x22')]);break;case'tag':_0x5bc481[_0xe3ca('0x25')](_0x1822e4[_0xe3ca('0x28')]);_0x5bc481[_0xe3ca('0x25')](_0x1822e4[_0xe3ca('0x22')]);break;case _0xe3ca('0x29'):var _0x3aeba2=utils['getMustacheRender'](_0x292251[_0xe3ca('0x2a')][_0xe3ca('0x2b')],_0x292251);var _0x343234=_0x1822e4[_0xe3ca('0x22')][_0xe3ca('0x23')](',');_0x5bc481[_0xe3ca('0x25')](_0x343234[0x0]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x1]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x2]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x3]);_0x5bc481['push'](_0x343234[0x4]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x5]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x6]);_0x5bc481['push'](_0x343234[0x7]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x8]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0x9]);_0x5bc481[_0xe3ca('0x25')](_0x343234[0xa]);_0x5bc481['push'](_0x292251[_0xe3ca('0x17')]['id']);_0x5bc481[_0xe3ca('0x25')](_0x292251['message']['id']);_0x5bc481[_0xe3ca('0x25')](_0x1822e4['ChatWebsiteId']);_0x5bc481['push'](_0x292251[_0xe3ca('0x17')][_0xe3ca('0x2c')]);_0x5bc481['push'](_0x292251[_0xe3ca('0x2d')][_0xe3ca('0x2d')]);_0x5bc481[_0xe3ca('0x25')](_0x3aeba2);break;default:_0x5bc481=_[_0xe3ca('0x10')](_0x1822e4[_0xe3ca('0x22')])?[]:_0x1822e4[_0xe3ca('0x22')][_0xe3ca('0x23')](',');}var _0xafaf2a={'id':util[_0xe3ca('0xd')]('%s:%s:%s',_0xca43ee,_0x1822e4['id'],_0x1822e4[_0xe3ca('0x1e')]),'condition':require(_0xe3ca('0x2e'))[_0xe3ca('0x2f')](_0xca43ee,getIntervals(_0x3d62e2[_0xe3ca('0x30')],_0x1822e4),_0x3d62e2),'consequence':require(_0xe3ca('0x31')+_0x1822e4[_0xe3ca('0x1e')])[_0xe3ca('0x32')](_0xca43ee,_0x5bc481,_0x3d62e2,_0x292251),'p':_0x1822e4[_0xe3ca('0x33')]||0x0};logger[_0xe3ca('0x34')](_0xe3ca('0x35'),_0xafaf2a['id'],_0xe3ca('0x36'),getIntervals(_0x3d62e2[_0xe3ca('0x30')],_0x1822e4)[_0xe3ca('0x1d')]('\x20|\x20'));_0x479977[_0xe3ca('0x25')](_0xafaf2a);}else{logger[_0xe3ca('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe3ca('0x1d')](__dirname,_0xe3ca('0x1a'),_0x1822e4[_0xe3ca('0x1e')]+_0xe3ca('0x1f')));}}_0x3d62e2[_0xe3ca('0x14')][_0xca43ee]=new RuleEngine(_0x479977);_0x3d62e2[_0xe3ca('0x14')][_0xca43ee][_0xe3ca('0x38')](_0x292251,function(_0x210e45){logger[_0xe3ca('0x34')](_0xe3ca('0x39'),JSON[_0xe3ca('0x3a')](_0x210e45['matchPath']));if(_0x3d62e2[_0xe3ca('0x14')][_0xca43ee]){_0x3d62e2[_0xe3ca('0x14')][_0xca43ee]['emit']('complete');}});return _0x337b6c({'code':0xc8,'message':_0x292251});}else{if(_0x5bb8d8){logger[_0xe3ca('0x34')](util[_0xe3ca('0xd')]('Skipped\x20routing\x20for\x20%s',_0xca43ee));}else{logger[_0xe3ca('0x34')](_0xe3ca('0x3b'));}return _0x337b6c({'code':0xc8,'message':_0x292251});}}catch(_0x525ead){logger['error'](_0x525ead[_0xe3ca('0x3c')]);return _0x5f2e2d(_0x884795[_0xe3ca('0x37')](0x1f4,_0x525ead));}}return _0x5f2e2d(_0xe3ca('0x3d'));});},'AcceptMessage':function(_0x409c60){var _0x139c91=this;return new Promise(function(_0x5242f6,_0xfd2d9f){if(_0x409c60[_0xe3ca('0x3e')]&&_0x409c60[_0xe3ca('0x3e')]['id']){if(_0x3d62e2[_0xe3ca('0x3f')][_0x409c60[_0xe3ca('0x3e')]['id']]){_0x3d62e2[_0xe3ca('0x3f')][_0x409c60[_0xe3ca('0x3e')]['id']][_0xe3ca('0x40')]=![];_0x3d62e2[_0xe3ca('0x3f')][_0x409c60['agent']['id']]['busyQueue']=undefined;}}if(_0x409c60['message']&&_0x409c60[_0xe3ca('0x16')]['id']){try{var _0x40a1ad=getId(_0x409c60[_0xe3ca('0x15')],_0x409c60['message']?_0x409c60['message']['id']:0x0,_0x409c60[_0xe3ca('0x17')]?_0x409c60[_0xe3ca('0x17')]['id']:0x0);if(_0x3d62e2[_0xe3ca('0x14')][_0x40a1ad]){_0x3d62e2['rules'][_0x40a1ad]['emit'](_0xe3ca('0x41'));if(rpc[_0x409c60['channel']+_0xe3ca('0x42')]){rpc[_0x409c60[_0xe3ca('0x15')]+_0xe3ca('0x42')][_0xe3ca('0x43')](_0x40a1ad,{'UserId':_0x409c60[_0xe3ca('0x16')][_0xe3ca('0x44')]})[_0xe3ca('0x45')](function(){logger[_0xe3ca('0x37')](_0xe3ca('0x46'));});}}return _0x5242f6({'code':0xc8,'message':_0x409c60});}catch(_0x7cf9dd){logger[_0xe3ca('0x37')](_0x7cf9dd['stack']);return _0xfd2d9f(_0x139c91[_0xe3ca('0x37')](0x1f4,_0x7cf9dd));}}logger[_0xe3ca('0x37')]('message\x20is\x20empty');return _0xfd2d9f(_0x139c91[_0xe3ca('0x37')](0x1f4,_0xe3ca('0x47')));});},'RejectMessage':function(_0x68b9fb){var _0x2bc5a7=this;return new Promise(function(_0x594cb7,_0x4d9e69){if(_0x68b9fb[_0xe3ca('0x3e')]&&_0x68b9fb[_0xe3ca('0x3e')]['id']){try{if(_0x3d62e2[_0xe3ca('0x3f')][_0x68b9fb['agent']['id']]){_0x3d62e2[_0xe3ca('0x3f')][_0x68b9fb[_0xe3ca('0x3e')]['id']][_0xe3ca('0x40')]=![];_0x3d62e2['agents'][_0x68b9fb[_0xe3ca('0x3e')]['id']][_0xe3ca('0x48')]=undefined;}return _0x594cb7({'code':0xc8,'message':_0x68b9fb});}catch(_0x27cef9){logger[_0xe3ca('0x37')](_0x27cef9[_0xe3ca('0x3c')]);return _0x4d9e69(_0x2bc5a7[_0xe3ca('0x37')](0x1f4,_0x27cef9));}}logger[_0xe3ca('0x37')](_0xe3ca('0x47'));return _0x4d9e69(_0x2bc5a7[_0xe3ca('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2aca0d){var _0x84df0d=this;return new Promise(function(_0x2ede90,_0x3d3186){if(_0x2aca0d[_0xe3ca('0x15')]&&_0x2aca0d[_0xe3ca('0x17')]&&_0x2aca0d[_0xe3ca('0x17')]['id']){try{var _0x56ab94=getId(_0x2aca0d[_0xe3ca('0x15')],_0x2aca0d[_0xe3ca('0x16')]?_0x2aca0d['message']['id']:0x0,_0x2aca0d[_0xe3ca('0x17')]?_0x2aca0d[_0xe3ca('0x17')]['id']:0x0);if(_0x3d62e2['rules'][_0x56ab94]){_0x3d62e2['rules'][_0x56ab94][_0xe3ca('0x49')](_0xe3ca('0x41'));}return _0x2ede90({'code':0xc8,'message':_0x2aca0d});}catch(_0xec2366){logger['error'](_0xec2366['stack']);return _0x3d3186(_0x84df0d[_0xe3ca('0x37')](0x1f4,_0xec2366));}}logger['error'](_0xe3ca('0x47'));return _0x3d3186(_0x84df0d[_0xe3ca('0x37')](0x1f4,_0xe3ca('0x47')));});},'AgentCapacity':function(_0x45984c){var _0x309ce0=this;return new Promise(function(_0x821d5c,_0x2b8673){if(_0x3d62e2[_0xe3ca('0x3f')][_0xe3ca('0x4a')](_0x45984c['id'])){for(var _0x706d5a in _0x45984c['capacity']){if(_0x45984c[_0xe3ca('0x4b')][_0xe3ca('0x4a')](_0x706d5a)){if(_0x3d62e2[_0xe3ca('0x3f')][_0x45984c['id']][_0xe3ca('0x4a')](_0x706d5a+_0xe3ca('0x4c'))){_0x3d62e2['agents'][_0x45984c['id']][_0x706d5a+_0xe3ca('0x4c')]=parseInt(_0x45984c[_0xe3ca('0x4b')][_0x706d5a],0xa);}}}_0x3d62e2[_0xe3ca('0x3f')][_0x45984c['id']][_0xe3ca('0x4d')]();return _0x821d5c({'code':0xc8,'message':_0x3d62e2[_0xe3ca('0x3f')][_0x45984c['id']]});}else{return _0x2b8673(_0x309ce0[_0xe3ca('0x37')](0x1f4,_0xe3ca('0x4e')));}});},'Agents':function(_0x1a1421){return new Promise(function(_0x3939a3){var _0x3c4ffa=_[_0xe3ca('0x4f')](_0x3d62e2['agents']);if(_0x1a1421&&_0x1a1421['id']){var _0x560b64=_[_0xe3ca('0x50')](_0x3c4ffa,function(_0x4c3def){return _0x4c3def['id']===_0x1a1421['id'];});_0x3939a3(_0x560b64);}else{_0x3939a3({'count':_0x3c4ffa[_0xe3ca('0x1b')],'rows':_0x3c4ffa});}});},'ChatQueues':function(){return new Promise(function(_0x138285){var _0x225fbf=[];for(var _0x2f3ddc in _0x3d62e2['chatQueues']){if(_0x3d62e2[_0xe3ca('0x51')][_0xe3ca('0x4a')](_0x2f3ddc)){var _0x5b1ccc=_0x3d62e2['chatQueues'][_0x2f3ddc];var _0xa33757={'id':_0x5b1ccc['id'],'available':_0x5b1ccc[_0xe3ca('0x52')],'loggedIn':_0x5b1ccc[_0xe3ca('0x53')],'name':_0x5b1ccc[_0xe3ca('0x54')],'paused':_0x5b1ccc[_0xe3ca('0x55')],'waiting':_0x5b1ccc[_0xe3ca('0x56')]};_0x225fbf[_0xe3ca('0x25')](_0xa33757);}}_0x138285({'count':_0x225fbf['length'],'rows':_0x225fbf});});},'MailQueues':function(){return new Promise(function(_0x1082e2){var _0x38b797=[];for(var _0x451505 in _0x3d62e2[_0xe3ca('0x57')]){if(_0x3d62e2['mailQueues']['hasOwnProperty'](_0x451505)){var _0x11a69b=_0x3d62e2[_0xe3ca('0x57')][_0x451505];var _0x89caeb={'id':_0x11a69b['id'],'available':_0x11a69b[_0xe3ca('0x52')],'loggedIn':_0x11a69b[_0xe3ca('0x53')],'name':_0x11a69b['name'],'paused':_0x11a69b[_0xe3ca('0x55')],'waiting':_0x11a69b[_0xe3ca('0x56')]};_0x38b797[_0xe3ca('0x25')](_0x89caeb);}}_0x1082e2({'count':_0x38b797[_0xe3ca('0x1b')],'rows':_0x38b797});});},'OpenchannelQueues':function(){return new Promise(function(_0x43208a){var _0x395b3b=[];for(var _0x2fa297 in _0x3d62e2[_0xe3ca('0x58')]){if(_0x3d62e2['openchannelQueues'][_0xe3ca('0x4a')](_0x2fa297)){var _0x141ea9=_0x3d62e2[_0xe3ca('0x58')][_0x2fa297];var _0x330216={'id':_0x141ea9['id'],'available':_0x141ea9[_0xe3ca('0x52')],'loggedIn':_0x141ea9[_0xe3ca('0x53')],'name':_0x141ea9['name'],'paused':_0x141ea9[_0xe3ca('0x55')],'waiting':_0x141ea9[_0xe3ca('0x56')]};_0x395b3b[_0xe3ca('0x25')](_0x330216);}}_0x43208a({'count':_0x395b3b['length'],'rows':_0x395b3b});});},'SmsQueues':function(){return new Promise(function(_0x1e309b){var _0x1a37f7=[];for(var _0x51f012 in _0x3d62e2[_0xe3ca('0x59')]){if(_0x3d62e2[_0xe3ca('0x59')][_0xe3ca('0x4a')](_0x51f012)){var _0xf48d34=_0x3d62e2[_0xe3ca('0x59')][_0x51f012];var _0x4b4462={'id':_0xf48d34['id'],'available':_0xf48d34[_0xe3ca('0x52')],'loggedIn':_0xf48d34[_0xe3ca('0x53')],'name':_0xf48d34['name'],'paused':_0xf48d34[_0xe3ca('0x55')],'waiting':_0xf48d34[_0xe3ca('0x56')]};_0x1a37f7['push'](_0x4b4462);}}_0x1e309b({'count':_0x1a37f7[_0xe3ca('0x1b')],'rows':_0x1a37f7});});},'FaxQueues':function(){return new Promise(function(_0x39675a){var _0x524200=[];for(var _0x379255 in _0x3d62e2[_0xe3ca('0x5a')]){if(_0x3d62e2[_0xe3ca('0x5a')][_0xe3ca('0x4a')](_0x379255)){var _0x385975=_0x3d62e2[_0xe3ca('0x5a')][_0x379255];var _0x18f212={'id':_0x385975['id'],'available':_0x385975['available'],'loggedIn':_0x385975['loggedIn'],'name':_0x385975[_0xe3ca('0x54')],'paused':_0x385975[_0xe3ca('0x55')],'waiting':_0x385975[_0xe3ca('0x56')]};_0x524200[_0xe3ca('0x25')](_0x18f212);}}_0x39675a({'count':_0x524200['length'],'rows':_0x524200});});},'WhatsappQueues':function(){return new Promise(function(_0x177fb2){var _0x4c01ae=[];for(var _0x375dfe in _0x3d62e2[_0xe3ca('0x5b')]){if(_0x3d62e2[_0xe3ca('0x5b')][_0xe3ca('0x4a')](_0x375dfe)){var _0x22f04c=_0x3d62e2[_0xe3ca('0x5b')][_0x375dfe];var _0xc605d7={'id':_0x22f04c['id'],'available':_0x22f04c[_0xe3ca('0x52')],'loggedIn':_0x22f04c[_0xe3ca('0x53')],'name':_0x22f04c['name'],'paused':_0x22f04c['paused'],'waiting':_0x22f04c['waiting']};_0x4c01ae[_0xe3ca('0x25')](_0xc605d7);}}_0x177fb2({'count':_0x4c01ae['length'],'rows':_0x4c01ae});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x338ede){var _0x5e3ae6=_[_0xe3ca('0x4f')](_0x3d62e2['chatQueuesWaitingInteractions']);_0x338ede({'count':_0x5e3ae6[_0xe3ca('0x1b')],'rows':_0x5e3ae6});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3ab369){var _0x2de501=_[_0xe3ca('0x4f')](_0x3d62e2['mailQueuesWaitingInteractions']);_0x3ab369({'count':_0x2de501['length'],'rows':_0x2de501});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x275571){var _0x17499b=_[_0xe3ca('0x4f')](_0x3d62e2[_0xe3ca('0x5c')]);_0x275571({'count':_0x17499b[_0xe3ca('0x1b')],'rows':_0x17499b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x19cae9){var _0x2a5c81=_[_0xe3ca('0x4f')](_0x3d62e2[_0xe3ca('0x5d')]);_0x19cae9({'count':_0x2a5c81[_0xe3ca('0x1b')],'rows':_0x2a5c81});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4d1906){var _0x999f20=_[_0xe3ca('0x4f')](_0x3d62e2[_0xe3ca('0x5e')]);_0x4d1906({'count':_0x999f20[_0xe3ca('0x1b')],'rows':_0x999f20});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x7aad69){var _0x5df0ab=_[_0xe3ca('0x4f')](_0x3d62e2[_0xe3ca('0x5f')]);_0x7aad69({'count':_0x5df0ab[_0xe3ca('0x1b')],'rows':_0x5df0ab});});}};var _0x3f8709=jayson[_0xe3ca('0x60')](_0x9ef773)['http']();_0x3f8709['on']('error',function(_0x102169){logger[_0xe3ca('0x37')](JSON[_0xe3ca('0x3a')](_0x102169));return _0x6a8907(_0x102169);});_0x3f8709[_0xe3ca('0x61')](0x232c,_0xe3ca('0x62'),function(){console['log'](_0xe3ca('0x63'),0x232c);return _0x210c69(_0xe3ca('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 49f7101..146f723 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 _0x0cef=['[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','iftime','../../../config/logger','routing','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20'];(function(_0x4e08c2,_0x4e1e0e){var _0x16e612=function(_0x3d1a9e){while(--_0x3d1a9e){_0x4e08c2['push'](_0x4e08c2['shift']());}};_0x16e612(++_0x4e1e0e);}(_0x0cef,0x15f));var _0xf0ce=function(_0x5168e3,_0x4b9c51){_0x5168e3=_0x5168e3-0x0;var _0x3112c3=_0x0cef[_0x5168e3];return _0x3112c3;};'use strict';var _=require(_0xf0ce('0x0'));var iftime=require(_0xf0ce('0x1'))[_0xf0ce('0x2')];var logger=require(_0xf0ce('0x3'))(_0xf0ce('0x4'));exports[_0xf0ce('0x5')]=function(_0x517235,_0x24d23c,_0xd78d04){return function(_0x37346d){if(_0xd78d04['rules']&&!_0xd78d04['rules'][_0x517235]){logger[_0xf0ce('0x6')](_0xf0ce('0x7'),_0x517235);return _0x37346d[_0xf0ce('0x8')]();}var _0x1e7f1=_0x24d23c[_0xf0ce('0x9')](function(_0xf1d1ed){return iftime(_0xf1d1ed);});var _0x478f91=_['some'](_0x1e7f1);if(_0x478f91){logger[_0xf0ce('0x6')](_0xf0ce('0xa'),_0x517235,_0x24d23c[_0xf0ce('0xb')](_0xf0ce('0xc')),_0x478f91);_0x37346d['when'](_0x478f91);}else{logger[_0xf0ce('0x6')](_0xf0ce('0xd'),_0x517235,_0x24d23c['join'](_0xf0ce('0xc')));_0x37346d[_0xf0ce('0x8')]();}};}; \ No newline at end of file +var _0xbdb8=['map','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','iftime','../../../config/logger','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x4d4ac4,_0x34a899){var _0x37f972=function(_0x35fb1f){while(--_0x35fb1f){_0x4d4ac4['push'](_0x4d4ac4['shift']());}};_0x37f972(++_0x34a899);}(_0xbdb8,0x89));var _0x8bdb=function(_0x187dfb,_0x33bfce){_0x187dfb=_0x187dfb-0x0;var _0x1116df=_0xbdb8[_0x187dfb];return _0x1116df;};'use strict';var _=require('lodash');var iftime=require('../../../utils/iftime')[_0x8bdb('0x0')];var logger=require(_0x8bdb('0x1'))('routing');exports[_0x8bdb('0x2')]=function(_0xf896a4,_0x24d6b1,_0x2fabbc){return function(_0x5c6654){if(_0x2fabbc[_0x8bdb('0x3')]&&!_0x2fabbc[_0x8bdb('0x3')][_0xf896a4]){logger[_0x8bdb('0x4')](_0x8bdb('0x5'),_0xf896a4);return _0x5c6654[_0x8bdb('0x6')]();}var _0x461f30=_0x24d6b1[_0x8bdb('0x7')](function(_0x160429){return iftime(_0x160429);});var _0xe89163=_['some'](_0x461f30);if(_0xe89163){logger[_0x8bdb('0x4')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0xf896a4,_0x24d6b1['join'](_0x8bdb('0x8')),_0xe89163);_0x5c6654[_0x8bdb('0x9')](_0xe89163);}else{logger[_0x8bdb('0x4')](_0x8bdb('0xa'),_0xf896a4,_0x24d6b1[_0x8bdb('0xb')](_0x8bdb('0x8')));_0x5c6654[_0x8bdb('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 841903f..b9e9c05 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 _0xae60=['transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x19c808,_0x2f77a5){var _0x58cc66=function(_0x1dd2e0){while(--_0x1dd2e0){_0x19c808['push'](_0x19c808['shift']());}};_0x58cc66(++_0x2f77a5);}(_0xae60,0x1c7));var _0x0ae6=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xae60[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var utils=require(_0x0ae6('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52d7cd,_0x267ad6){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52d7cd[_0x0ae6('0x5')],_0x52d7cd[_0x0ae6('0x6')],_0x52d7cd['queue'],_0x52d7cd[_0x0ae6('0x7')],_0x52d7cd[_0x0ae6('0x8')],_0x52d7cd[_0x0ae6('0x9')],_0x52d7cd[_0x0ae6('0xa')],_0x52d7cd[_0x0ae6('0xb')]));if(_0x52d7cd[_0x0ae6('0xc')]){utils[_0x0ae6('0xd')](_0x52d7cd[_0x0ae6('0xc')])['then'](function(_0x3b3fc3){if(_0x3b3fc3){_0x52d7cd[_0x0ae6('0xe')]=_0x3b3fc3[_0x0ae6('0xe')];_0x52d7cd[_0x0ae6('0xf')]=_0x52d7cd['agentcomplete']?_0x3b3fc3[_0x0ae6('0x10')]:![];_0x52d7cd[_0x0ae6('0x11')]=_0x52d7cd[_0x0ae6('0xf')]?_0x3b3fc3[_0x0ae6('0x12')]:0x0;}utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);});}else{utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);}if(_0x267ad6){delete transfers[_0x52d7cd[_0x0ae6('0x5')]];}else{delete agents[_0x52d7cd[_0x0ae6('0x15')]];}}exports[_0x0ae6('0x16')]=function(_0xf86cad){try{utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0xf86cad);agents[_0xf86cad[_0x0ae6('0x15')]]=_0xf86cad;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x18')]=utils[_0x0ae6('0x19')]();agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xb')]=_0x0ae6('0x1a');agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xa')]=null;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x1b')]=null;utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x1c'),_0xf86cad[_0x0ae6('0x5')],agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x7')],_0xf86cad[_0x0ae6('0x15')]));}catch(_0x9e2c46){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0x9e2c46);}};exports[_0x0ae6('0x1e')]=function(_0x140a3b){try{if(!_[_0x0ae6('0x1f')](agents[_0x140a3b[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b['uniqueid']),_0x140a3b);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x21'),_0x140a3b[_0x0ae6('0x5')],agents[_0x140a3b[_0x0ae6('0x15')]]['membername'],_0x140a3b[_0x0ae6('0x15')]));agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x1e')]=!![];agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();agents[_0x140a3b['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x23');agents[_0x140a3b['destuniqueid']]['reason']=_0x0ae6('0x23');agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x24')]=_0x140a3b['ringtime']?parseInt(_0x140a3b[_0x0ae6('0x25')])/0x3e8:0x0;agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x26')]=0x0;unanswered['push'](_0x140a3b[_0x0ae6('0x15')]);}}catch(_0x29fef3){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b[_0x0ae6('0x5')]),_0x29fef3);}};exports['queuecallerabandon']=function(_0x5b2ad6){try{_[_0x0ae6('0x27')](agents,function(_0x419384,_0x4e6df8){if(_0x419384['uniqueid']==_0x5b2ad6[_0x0ae6('0x5')]&&!_[_0x0ae6('0x28')](unanswered,_0x419384[_0x0ae6('0x15')])){utils[_0x0ae6('0x17')](util['format'](_0x0ae6('0x29'),_0x5b2ad6[_0x0ae6('0x5')]),_0x5b2ad6);utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x2a'),_0x5b2ad6[_0x0ae6('0x5')],_0x419384[_0x0ae6('0x7')],_0x419384[_0x0ae6('0x15')]));_0x419384[_0x0ae6('0x1e')]=!![];_0x419384[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x419384[_0x0ae6('0xb')]=_0x0ae6('0x2b');_0x419384[_0x0ae6('0x2c')]='abandoned';_0x419384[_0x0ae6('0x24')]=_0x5b2ad6[_0x0ae6('0x24')];_0x419384['talktime']=0x0;writeDB(_0x419384);}});}catch(_0x3264d5){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][queuecallerabandon]',_0x5b2ad6[_0x0ae6('0x5')]),_0x3264d5);}};exports['agentconnect']=function(_0x59e388){try{if(agents[_0x59e388[_0x0ae6('0x15')]]){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x59e388);utils['info'](util['format'](_0x0ae6('0x2e'),_0x59e388['uniqueid'],agents[_0x59e388[_0x0ae6('0x15')]]['membername'],_0x59e388[_0x0ae6('0x15')]));agents[_0x59e388['destuniqueid']][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();agents[_0x59e388[_0x0ae6('0x15')]][_0x0ae6('0xa')]=_0x59e388['connectedlinenum'];agents[_0x59e388['destuniqueid']][_0x0ae6('0x1b')]=_0x59e388[_0x0ae6('0x1b')];agents[_0x59e388[_0x0ae6('0x15')]]['holdtime']=_0x59e388[_0x0ae6('0x25')];agents[_0x59e388['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x30');_[_0x0ae6('0x27')](agents,function(_0x19403c,_0x450f00){if(_0x19403c[_0x0ae6('0x15')]!=_0x59e388['destuniqueid']&&_0x19403c[_0x0ae6('0x5')]==_0x59e388[_0x0ae6('0x5')]){_0x19403c[_0x0ae6('0x26')]=0x0;_0x19403c[_0x0ae6('0x24')]=_0x59e388[_0x0ae6('0x25')];_0x19403c[_0x0ae6('0x1e')]=!![];_0x19403c[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x19403c['lastevent']=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x2c')]=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x32')]=_0x59e388[_0x0ae6('0x15')];_0x19403c[_0x0ae6('0x33')]=_0x59e388[_0x0ae6('0x7')];writeDB(_0x19403c);}});}}catch(_0x21431e){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x21431e);}};exports[_0x0ae6('0x34')]=function(_0x85d9ce){try{if(!_[_0x0ae6('0x1f')](agents[_0x85d9ce[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x85d9ce);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x35'),_0x85d9ce[_0x0ae6('0x5')],agents[_0x85d9ce[_0x0ae6('0x15')]]['membername'],_0x85d9ce[_0x0ae6('0x15')]));agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x34')]=!![];agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt'],agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x2f')]);agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x2c')]=_0x85d9ce[_0x0ae6('0x2c')];agents[_0x85d9ce['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x37');writeDB(agents[_0x85d9ce['destuniqueid']]);}}catch(_0x76e561){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x76e561);}};exports[_0x0ae6('0x38')]=function(_0x46075a){try{if(!_[_0x0ae6('0x1f')](agents[_0x46075a[_0x0ae6('0x39')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][blindtransfer]',_0x46075a['uniqueid']),_0x46075a);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x3a'),_0x46075a['uniqueid'],agents[_0x46075a[_0x0ae6('0x39')]]['membername'],agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x5')]));agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3b')]=!![];agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x3c')]=_0x0ae6('0x3d');agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3e')]=_0x46075a[_0x0ae6('0x3f')];agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x40')]=agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x5')];}}catch(_0x117d24){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x41'),_0x46075a[_0x0ae6('0x5')]),_0x117d24);}};exports[_0x0ae6('0x42')]=function(_0x5c4785){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x5c4785);if(_0x5c4785[_0x0ae6('0x44')]==_0x5c4785[_0x0ae6('0x45')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785[_0x0ae6('0x46')]])){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3c')]=_0x0ae6('0x48');agents[_0x5c4785['secondtransfereruniqueid']][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x49')];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x40')]=_0x5c4785[_0x0ae6('0x44')];}if(_0x5c4785[_0x0ae6('0x4a')]&&agents[_0x5c4785[_0x0ae6('0x4a')]]){agents[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4a')]]=_['clone'](agents[_0x5c4785[_0x0ae6('0x4a')]]);transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x4c')];transfers[_0x5c4785['transfereeuniqueid']]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4a')]]['agentconnectAt']=utils['now']();transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x2;}}else if(_0x5c4785[_0x0ae6('0x46')]==_0x5c4785[_0x0ae6('0x4d')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785['origtransfereruniqueid']])){utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x3c')]='ATTENDED';agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x4e')];agents[_0x5c4785[_0x0ae6('0x44')]]['transferuniqueid']=_0x5c4785['secondtransfereruniqueid'];}if(_0x5c4785[_0x0ae6('0x4f')]&&agents[_0x5c4785[_0x0ae6('0x4f')]]){agents[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4f')]]=_[_0x0ae6('0x50')](agents[_0x5c4785['transfertargetuniqueid']]);transfers[_0x5c4785['transfertargetuniqueid']][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x4c')];transfers[_0x5c4785[_0x0ae6('0x4f')]]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x35068d){utils[_0x0ae6('0x1d')](util['format'](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x35068d);}};exports[_0x0ae6('0x51')]=function(_0x37ad9b){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x37ad9b);if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')]===_0x0ae6('0x23')){if(_0x37ad9b[_0x0ae6('0x53')]==='21'){agents[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]=_0x0ae6('0x54');agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x54');}utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b[_0x0ae6('0x5')]]);var _0x346d19=unanswered[_0x0ae6('0x56')](_0x37ad9b[_0x0ae6('0x5')]);if(_0x346d19>-0x1){unanswered[_0x0ae6('0x57')](_0x346d19,0x1);}}if(transfers[_0x37ad9b[_0x0ae6('0x5')]]){transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x34')]=!![];transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2f')]);transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]='agent';transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],transfers[_0x37ad9b['uniqueid']]['membername'],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(transfers[_0x37ad9b['uniqueid']],!![]);}if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]]['agentconnectAt']){agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x34')]=!![];agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();agents[_0x37ad9b[_0x0ae6('0x5')]]['talktime']=utils['diffTime'](agents[_0x37ad9b['uniqueid']][_0x0ae6('0x58')],agents[_0x37ad9b['uniqueid']]['agentconnectAt']);agents[_0x37ad9b['uniqueid']]['reason']=agents[_0x37ad9b[_0x0ae6('0x5')]]['transfer']?_0x0ae6('0x3b'):'agent';agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b['uniqueid']]);}}catch(_0x435707){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x435707);}}; \ No newline at end of file +var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x3c4fb1,_0x1e1136){var _0x4629b8=function(_0x4136e2){while(--_0x4136e2){_0x3c4fb1['push'](_0x3c4fb1['shift']());}};_0x4629b8(++_0x1e1136);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b1d0665..6dc0f11 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 _0xbf39=['xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','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','lastapplication','Queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','includes','noop','set','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','channel','now','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xbf39,0x100));var _0x9bf3=function(_0x221e42,_0x763508){_0x221e42=_0x221e42-0x0;var _0x599586=_0xbf39[_0x221e42];return _0x599586;};'use strict';var _=require(_0x9bf3('0x0'));var util=require(_0x9bf3('0x1'));var utils=require('./utils');var dispositions=[_0x9bf3('0x2'),_0x9bf3('0x3'),_0x9bf3('0x3'),_0x9bf3('0x2'),_0x9bf3('0x2'),_0x9bf3('0x2'),_0x9bf3('0x4'),_0x9bf3('0x5'),_0x9bf3('0x3'),_0x9bf3('0x3'),_0x9bf3('0x3')];var channels={};function writeDB(_0x977cbe){utils['info'](util[_0x9bf3('0x6')](_0x9bf3('0x7'),_0x977cbe[_0x9bf3('0x8')],_0x977cbe['channel'],_0x977cbe[_0x9bf3('0x9')],_0x977cbe[_0x9bf3('0xa')],_0x977cbe[_0x9bf3('0xb')],_0x977cbe['calleridnum'],_0x977cbe[_0x9bf3('0xc')],_0x977cbe[_0x9bf3('0xd')]));if(_0x977cbe['accountcode']){utils[_0x9bf3('0xe')](_0x977cbe[_0x9bf3('0xf')])[_0x9bf3('0x10')](function(_0x17d461){if(_0x17d461){_0x977cbe['UserId']=_0x17d461['id'];}utils[_0x9bf3('0x11')](_0x9bf3('0x12'),_0x977cbe);});}else{utils[_0x9bf3('0x11')](_0x9bf3('0x12'),_0x977cbe);}if(channels[_0x977cbe[_0x9bf3('0x8')]]){delete channels[_0x977cbe['uniqueid']];}}exports['newchannel']=function(_0x447bcd){try{utils['debug'](util[_0x9bf3('0x6')](_0x9bf3('0x13'),_0x447bcd[_0x9bf3('0x8')]),_0x447bcd);if(_0x447bcd['uniqueid']==_0x447bcd[_0x9bf3('0x14')]&&_0x447bcd['channel']!=_0x9bf3('0x15')){utils[_0x9bf3('0x16')](util['format'](_0x9bf3('0x17'),_0x447bcd[_0x9bf3('0x8')],_0x447bcd[_0x9bf3('0x18')],_0x447bcd[_0x9bf3('0x19')]));channels[_0x447bcd[_0x9bf3('0x8')]]={'uniqueid':_0x447bcd['uniqueid'],'accountcode':_0x447bcd[_0x9bf3('0xf')],'source':_0x447bcd[_0x9bf3('0x1a')],'destination':_0x447bcd['exten'],'destinationcontext':_0x447bcd[_0x9bf3('0x18')],'channel':_0x447bcd[_0x9bf3('0x1b')],'starttime':utils[_0x9bf3('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9bf3('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x43fcf7){utils[_0x9bf3('0x1d')](util[_0x9bf3('0x6')]('[%s][calls][newchannel]',_0x447bcd[_0x9bf3('0x8')]),_0x43fcf7);}};exports[_0x9bf3('0x1e')]=function(_0x4c332a){try{utils[_0x9bf3('0x1f')](util['format'](_0x9bf3('0x20'),_0x4c332a[_0x9bf3('0x8')]),_0x4c332a);if(!_[_0x9bf3('0x21')](channels[_0x4c332a[_0x9bf3('0x8')]])&&_0x4c332a[_0x9bf3('0x22')]==0x6){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x23'),_0x4c332a[_0x9bf3('0x8')],_0x4c332a['context'],_0x4c332a['channel']));if(_[_0x9bf3('0x21')](channels[_0x4c332a['uniqueid']][_0x9bf3('0x24')])){channels[_0x4c332a[_0x9bf3('0x8')]][_0x9bf3('0x24')]=utils['now']();}}else if(!_[_0x9bf3('0x21')](channels[_0x4c332a[_0x9bf3('0x14')]])&&_0x4c332a[_0x9bf3('0x22')]==0x6&&_0x4c332a[_0x9bf3('0x18')]!=_0x9bf3('0x25')){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x26'),_0x4c332a['uniqueid'],_0x4c332a['linkedid'],_0x4c332a[_0x9bf3('0x18')],_0x4c332a[_0x9bf3('0x1b')]));channels[_0x4c332a[_0x9bf3('0x14')]][_0x9bf3('0xf')]=_0x4c332a['accountcode'];channels[_0x4c332a[_0x9bf3('0x14')]][_0x9bf3('0x27')]=_0x4c332a[_0x9bf3('0x1b')];if(_[_0x9bf3('0x21')](channels[_0x4c332a[_0x9bf3('0x14')]][_0x9bf3('0x28')])){channels[_0x4c332a[_0x9bf3('0x14')]][_0x9bf3('0x28')]=utils[_0x9bf3('0x1c')]();}channels[_0x4c332a[_0x9bf3('0x14')]][_0x9bf3('0x29')]=dispositions[_[_0x9bf3('0x2a')](_0x4c332a['channelstate'])]||_0x9bf3('0x4');}}catch(_0x43f214){utils[_0x9bf3('0x1d')](util[_0x9bf3('0x6')](_0x9bf3('0x20'),_0x4c332a[_0x9bf3('0x8')]),_0x43f214);}};exports[_0x9bf3('0x2b')]=function(_0x421f6d){try{if(!_['isNil'](channels[_0x421f6d[_0x9bf3('0x8')]])){utils[_0x9bf3('0x1f')](util[_0x9bf3('0x6')](_0x9bf3('0x2c'),_0x421f6d[_0x9bf3('0x8')]),_0x421f6d);if(_[_0x9bf3('0x21')](channels[_0x421f6d['uniqueid']]['callerid'])){channels[_0x421f6d[_0x9bf3('0x8')]][_0x9bf3('0x2d')]=_0x421f6d['calleridname']+'\x20<'+_0x421f6d['calleridnum']+'>';}utils[_0x9bf3('0x16')](util['format'](_0x9bf3('0x2e'),_0x421f6d[_0x9bf3('0x8')],channels[_0x421f6d['uniqueid']][_0x9bf3('0x2d')],_0x421f6d[_0x9bf3('0x2f')]));channels[_0x421f6d['uniqueid']][_0x9bf3('0x30')]=utils[_0x9bf3('0x1c')]();channels[_0x421f6d[_0x9bf3('0x8')]]['duration']=utils['diffTime'](channels[_0x421f6d[_0x9bf3('0x8')]][_0x9bf3('0x30')],channels[_0x421f6d['uniqueid']][_0x9bf3('0x31')]);channels[_0x421f6d[_0x9bf3('0x8')]][_0x9bf3('0x32')]=channels[_0x421f6d[_0x9bf3('0x8')]]['answertime']?utils[_0x9bf3('0x33')](channels[_0x421f6d['uniqueid']][_0x9bf3('0x30')],channels[_0x421f6d[_0x9bf3('0x8')]][_0x9bf3('0x28')]):0x0;writeDB(channels[_0x421f6d['uniqueid']]);}}catch(_0x103442){utils[_0x9bf3('0x1d')](util[_0x9bf3('0x6')](_0x9bf3('0x2c'),_0x421f6d[_0x9bf3('0x8')]),_0x103442);}};exports[_0x9bf3('0x34')]=function(_0x43fc69){try{if(!_[_0x9bf3('0x21')](channels[_0x43fc69[_0x9bf3('0x35')]])){utils[_0x9bf3('0x1f')](util[_0x9bf3('0x6')](_0x9bf3('0x36'),_0x43fc69[_0x9bf3('0x37')]),_0x43fc69);if(channels[_0x43fc69['localtwolinkedid']][_0x9bf3('0x1b')]==_0x43fc69['transfereechannel']){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x38'),_0x43fc69[_0x9bf3('0x37')],_0x43fc69['localtwolinkedid'],_0x43fc69[_0x9bf3('0x39')]));channels[_0x43fc69[_0x9bf3('0x35')]][_0x9bf3('0x27')]=_0x43fc69[_0x9bf3('0x39')];channels[_0x43fc69[_0x9bf3('0x35')]][_0x9bf3('0x3a')]=_0x9bf3('0x3b');}else if(channels[_0x43fc69[_0x9bf3('0x35')]][_0x9bf3('0x1b')]=_0x43fc69[_0x9bf3('0x3c')]){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x38'),_0x43fc69[_0x9bf3('0x37')],_0x43fc69[_0x9bf3('0x35')],_0x43fc69[_0x9bf3('0x3d')]));channels[_0x43fc69[_0x9bf3('0x35')]][_0x9bf3('0x27')]=_0x43fc69[_0x9bf3('0x3d')];channels[_0x43fc69[_0x9bf3('0x35')]][_0x9bf3('0x3a')]=_0x9bf3('0x3b');}}}catch(_0x33618d){utils[_0x9bf3('0x1d')](util['format'](_0x9bf3('0x36'),_0x43fc69[_0x9bf3('0x37')]),_0x33618d);}};exports[_0x9bf3('0x3e')]=function(_0x58f2e4){try{if(!_[_0x9bf3('0x21')](channels[_0x58f2e4[_0x9bf3('0x8')]])){utils[_0x9bf3('0x1f')](util[_0x9bf3('0x6')]('[%s][calls][musiconholdstart]',_0x58f2e4[_0x9bf3('0x8')]),_0x58f2e4);channels[_0x58f2e4[_0x9bf3('0x8')]][_0x9bf3('0x3f')]=utils[_0x9bf3('0x1c')]();utils['info'](util[_0x9bf3('0x6')](_0x9bf3('0x40'),_0x58f2e4[_0x9bf3('0x8')],channels[_0x58f2e4[_0x9bf3('0x8')]]['musiconholdstartAt']));}}catch(_0x5b7949){utils[_0x9bf3('0x1d')](util[_0x9bf3('0x6')](_0x9bf3('0x41'),_0x58f2e4[_0x9bf3('0x8')]),_0x5b7949);}};exports[_0x9bf3('0x42')]=function(_0x3b72c1){try{if(!_['isNil'](channels[_0x3b72c1['uniqueid']])){utils['debug'](util['format'](_0x9bf3('0x43'),_0x3b72c1[_0x9bf3('0x8')]),_0x3b72c1);if(!_['isNil'](channels[_0x3b72c1[_0x9bf3('0x8')]][_0x9bf3('0x3f')])){channels[_0x3b72c1[_0x9bf3('0x8')]][_0x9bf3('0x44')]+=utils[_0x9bf3('0x33')](utils[_0x9bf3('0x1c')](),channels[_0x3b72c1[_0x9bf3('0x8')]][_0x9bf3('0x3f')]);utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x45'),_0x3b72c1[_0x9bf3('0x8')],channels[_0x3b72c1[_0x9bf3('0x8')]][_0x9bf3('0x44')]));delete channels[_0x3b72c1[_0x9bf3('0x8')]]['musiconholdstartAt'];}}}catch(_0x4cc3c1){utils['error'](util[_0x9bf3('0x6')](_0x9bf3('0x43'),_0x3b72c1[_0x9bf3('0x8')]),_0x4cc3c1);}};exports['varset']=function(_0x21eb12){try{if(!_[_0x9bf3('0x21')](channels[_0x21eb12[_0x9bf3('0x8')]])){utils[_0x9bf3('0x1f')](util[_0x9bf3('0x6')]('[%s][calls][varset]',_0x21eb12[_0x9bf3('0x8')]),_0x21eb12);if(!_['isNil'](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x47')])){utils['info'](util[_0x9bf3('0x6')](_0x9bf3('0x48'),_0x21eb12[_0x9bf3('0x8')],_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]]['source']=_0x21eb12[_0x9bf3('0x49')];}if(!_[_0x9bf3('0x21')](_0x21eb12['variable'][_0x9bf3('0x4a')])){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x4b'),_0x21eb12['uniqueid'],_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x4c')]=_0x21eb12['value'];channels[_0x21eb12['uniqueid']][_0x9bf3('0x2d')]='\x22'+_0x21eb12[_0x9bf3('0x49')]+_0x9bf3('0x4d')+_0x21eb12[_0x9bf3('0x49')]+'>';}if(!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')]['xmd-callerid-preview'])||!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x4e')])){utils['info'](util[_0x9bf3('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x21eb12[_0x9bf3('0x8')],!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x4f')])?_0x9bf3('0x4f'):_0x9bf3('0x4e'),_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]]['callerid']=_0x21eb12[_0x9bf3('0x49')];}if(!_[_0x9bf3('0x21')](_0x21eb12['variable'][_0x9bf3('0x50')])||!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')]['xmcs-queue'])){utils['info'](util[_0x9bf3('0x6')](_0x9bf3('0x51'),_0x21eb12[_0x9bf3('0x8')],!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x50')])?_0x9bf3('0x50'):'xmcs-queue',_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x52')]=_0x9bf3('0x53');channels[_0x21eb12['uniqueid']]['lastdata']=_0x21eb12[_0x9bf3('0x49')];channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x9')]=!![];}if(!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x54')])){utils['info'](util[_0x9bf3('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x21eb12[_0x9bf3('0x8')],_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x55')]=_0x21eb12['value'];}if(!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x56')])){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x57'),_0x21eb12[_0x9bf3('0x8')],_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x58')]=_0x21eb12[_0x9bf3('0x49')];}if(!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x59')])){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x5a'),_0x21eb12[_0x9bf3('0x8')],_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x5b')]=_0x21eb12[_0x9bf3('0x49')];}if(!_[_0x9bf3('0x21')](_0x21eb12[_0x9bf3('0x46')][_0x9bf3('0x5c')])){utils[_0x9bf3('0x16')](util[_0x9bf3('0x6')](_0x9bf3('0x5d'),_0x21eb12[_0x9bf3('0x8')],_0x21eb12[_0x9bf3('0x49')]));channels[_0x21eb12[_0x9bf3('0x8')]][_0x9bf3('0x5c')]=_0x21eb12['value'];}}}catch(_0xf49a29){utils[_0x9bf3('0x1d')](util[_0x9bf3('0x6')](_0x9bf3('0x5e'),_0x21eb12[_0x9bf3('0x8')]),_0xf49a29);}};exports[_0x9bf3('0x5f')]=function(_0x5059e1){try{if(!_[_0x9bf3('0x21')](channels[_0x5059e1[_0x9bf3('0x8')]])){utils[_0x9bf3('0x1f')](util[_0x9bf3('0x6')]('[%s][calls][newexten]',_0x5059e1[_0x9bf3('0x8')]),_0x5059e1);utils[_0x9bf3('0x16')](util['format'](_0x9bf3('0x60'),_0x5059e1[_0x9bf3('0x8')],_0x5059e1[_0x9bf3('0x61')],_0x5059e1[_0x9bf3('0x62')]));if(_0x5059e1[_0x9bf3('0x61')][_0x9bf3('0x63')]()=='set'&&_[_0x9bf3('0x64')](_0x5059e1['appdata'][_0x9bf3('0x63')](),_0x9bf3('0x65'))){var _0x4fc6b0=_0x5059e1['appdata']['split']('=');var _0x1b1d91=_0x4fc6b0[0x0][_0x9bf3('0x66')](_0x4fc6b0[0x0][_0x9bf3('0x67')]('(')+0x1,_0x4fc6b0[0x0][_0x9bf3('0x67')](')'));var _0x2df9c6=_0x4fc6b0[0x1];channels[_0x5059e1['uniqueid']][_0x1b1d91]=_0x2df9c6;}if(!_[_0x9bf3('0x68')](['hangup',_0x9bf3('0x69'),'execif',_0x9bf3('0x6a'),_0x9bf3('0x6b')],_0x5059e1['application'][_0x9bf3('0x63')]())){channels[_0x5059e1[_0x9bf3('0x8')]][_0x9bf3('0x52')]=_0x5059e1[_0x9bf3('0x61')];channels[_0x5059e1[_0x9bf3('0x8')]]['lastdata']=_0x5059e1['appdata'];}}}catch(_0x4e5f4d){utils[_0x9bf3('0x1d')](util['format'](_0x9bf3('0x6c'),_0x5059e1[_0x9bf3('0x8')]),_0x4e5f4d);}}; \ No newline at end of file +var _0x0239=['includes','noop','execif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr','split','substring','lastIndexOf'];(function(_0x4144c0,_0x253e2b){var _0x424d45=function(_0x5f1644){while(--_0x5f1644){_0x4144c0['push'](_0x4144c0['shift']());}};_0x424d45(++_0x253e2b);}(_0x0239,0x141));var _0x9023=function(_0x4a34a9,_0x4a24c2){_0x4a34a9=_0x4a34a9-0x0;var _0x42d05d=_0x0239[_0x4a34a9];return _0x42d05d;};'use strict';var _=require('lodash');var util=require(_0x9023('0x0'));var utils=require(_0x9023('0x1'));var dispositions=[_0x9023('0x2'),_0x9023('0x3'),_0x9023('0x3'),'NO\x20ANSWER',_0x9023('0x2'),_0x9023('0x2'),_0x9023('0x4'),_0x9023('0x5'),_0x9023('0x3'),_0x9023('0x3'),_0x9023('0x3')];var channels={};function writeDB(_0x499690){utils[_0x9023('0x6')](util[_0x9023('0x7')](_0x9023('0x8'),_0x499690[_0x9023('0x9')],_0x499690[_0x9023('0xa')],_0x499690['queue'],_0x499690[_0x9023('0xb')],_0x499690[_0x9023('0xc')],_0x499690[_0x9023('0xd')],_0x499690['connectedlinenum'],_0x499690[_0x9023('0xe')]));if(_0x499690[_0x9023('0xf')]){utils[_0x9023('0x10')](_0x499690[_0x9023('0xf')])[_0x9023('0x11')](function(_0x18335e){if(_0x18335e){_0x499690[_0x9023('0x12')]=_0x18335e['id'];}utils['request'](_0x9023('0x13'),_0x499690);});}else{utils[_0x9023('0x14')](_0x9023('0x13'),_0x499690);}if(channels[_0x499690[_0x9023('0x9')]]){delete channels[_0x499690[_0x9023('0x9')]];}}exports[_0x9023('0x15')]=function(_0x54d182){try{utils[_0x9023('0x16')](util[_0x9023('0x7')](_0x9023('0x17'),_0x54d182[_0x9023('0x9')]),_0x54d182);if(_0x54d182['uniqueid']==_0x54d182[_0x9023('0x18')]&&_0x54d182[_0x9023('0xa')]!='OutgoingSpoolFailed'){utils[_0x9023('0x6')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x54d182[_0x9023('0x9')],_0x54d182[_0x9023('0x19')],_0x54d182[_0x9023('0x1a')]));channels[_0x54d182[_0x9023('0x9')]]={'uniqueid':_0x54d182[_0x9023('0x9')],'accountcode':_0x54d182[_0x9023('0xf')],'source':_0x54d182[_0x9023('0xd')],'destination':_0x54d182[_0x9023('0x1a')],'destinationcontext':_0x54d182['context'],'channel':_0x54d182[_0x9023('0xa')],'starttime':utils[_0x9023('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9023('0x2'),'amaflags':_0x9023('0x1c')};}}catch(_0x30c726){utils[_0x9023('0x1d')](util[_0x9023('0x7')](_0x9023('0x17'),_0x54d182['uniqueid']),_0x30c726);}};exports['newstate']=function(_0x31fa04){try{utils[_0x9023('0x16')](util['format'](_0x9023('0x1e'),_0x31fa04[_0x9023('0x9')]),_0x31fa04);if(!_[_0x9023('0x1f')](channels[_0x31fa04[_0x9023('0x9')]])&&_0x31fa04[_0x9023('0x20')]==0x6){utils[_0x9023('0x6')](util[_0x9023('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x31fa04[_0x9023('0x9')],_0x31fa04[_0x9023('0x19')],_0x31fa04[_0x9023('0xa')]));if(_[_0x9023('0x1f')](channels[_0x31fa04[_0x9023('0x9')]][_0x9023('0x21')])){channels[_0x31fa04[_0x9023('0x9')]][_0x9023('0x21')]=utils['now']();}}else if(!_['isNil'](channels[_0x31fa04[_0x9023('0x18')]])&&_0x31fa04[_0x9023('0x20')]==0x6&&_0x31fa04[_0x9023('0x19')]!=_0x9023('0x22')){utils['info'](util[_0x9023('0x7')](_0x9023('0x23'),_0x31fa04[_0x9023('0x9')],_0x31fa04['linkedid'],_0x31fa04[_0x9023('0x19')],_0x31fa04['channel']));channels[_0x31fa04['linkedid']]['accountcode']=_0x31fa04['accountcode'];channels[_0x31fa04[_0x9023('0x18')]][_0x9023('0x24')]=_0x31fa04[_0x9023('0xa')];if(_[_0x9023('0x1f')](channels[_0x31fa04[_0x9023('0x18')]][_0x9023('0x25')])){channels[_0x31fa04['linkedid']]['answertime']=utils[_0x9023('0x1b')]();}channels[_0x31fa04['linkedid']]['disposition']=dispositions[_[_0x9023('0x26')](_0x31fa04[_0x9023('0x20')])]||_0x9023('0x4');}}catch(_0x35fb31){utils['error'](util[_0x9023('0x7')](_0x9023('0x1e'),_0x31fa04[_0x9023('0x9')]),_0x35fb31);}};exports[_0x9023('0x27')]=function(_0x577c71){try{if(!_[_0x9023('0x1f')](channels[_0x577c71['uniqueid']])){utils[_0x9023('0x16')](util['format'](_0x9023('0x28'),_0x577c71[_0x9023('0x9')]),_0x577c71);if(_[_0x9023('0x1f')](channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x29')])){channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x29')]=_0x577c71['calleridname']+'\x20<'+_0x577c71[_0x9023('0xd')]+'>';}utils[_0x9023('0x6')](util['format'](_0x9023('0x2a'),_0x577c71[_0x9023('0x9')],channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x29')],_0x577c71[_0x9023('0x2b')]));channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x2c')]=utils[_0x9023('0x1b')]();channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x2d')]=utils[_0x9023('0x2e')](channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x2c')],channels[_0x577c71[_0x9023('0x9')]]['starttime']);channels[_0x577c71['uniqueid']]['billableseconds']=channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x25')]?utils[_0x9023('0x2e')](channels[_0x577c71['uniqueid']]['endtime'],channels[_0x577c71[_0x9023('0x9')]][_0x9023('0x25')]):0x0;writeDB(channels[_0x577c71[_0x9023('0x9')]]);}}catch(_0x1829f6){utils['error'](util[_0x9023('0x7')](_0x9023('0x28'),_0x577c71[_0x9023('0x9')]),_0x1829f6);}};exports[_0x9023('0x2f')]=function(_0x40e83f){try{if(!_['isNil'](channels[_0x40e83f[_0x9023('0x30')]])){utils[_0x9023('0x16')](util[_0x9023('0x7')](_0x9023('0x31'),_0x40e83f[_0x9023('0x32')]),_0x40e83f);if(channels[_0x40e83f[_0x9023('0x30')]][_0x9023('0xa')]==_0x40e83f[_0x9023('0x33')]){utils[_0x9023('0x6')](util[_0x9023('0x7')](_0x9023('0x34'),_0x40e83f['origtransfereruniqueid'],_0x40e83f[_0x9023('0x30')],_0x40e83f[_0x9023('0x35')]));channels[_0x40e83f[_0x9023('0x30')]][_0x9023('0x24')]=_0x40e83f[_0x9023('0x35')];channels[_0x40e83f[_0x9023('0x30')]][_0x9023('0x36')]=_0x9023('0x37');}else if(channels[_0x40e83f[_0x9023('0x30')]]['channel']=_0x40e83f[_0x9023('0x38')]){utils['info'](util[_0x9023('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x40e83f[_0x9023('0x32')],_0x40e83f[_0x9023('0x30')],_0x40e83f[_0x9023('0x39')]));channels[_0x40e83f[_0x9023('0x30')]][_0x9023('0x24')]=_0x40e83f[_0x9023('0x39')];channels[_0x40e83f[_0x9023('0x30')]][_0x9023('0x36')]=_0x9023('0x37');}}}catch(_0x11c436){utils[_0x9023('0x1d')](util[_0x9023('0x7')](_0x9023('0x31'),_0x40e83f['origtransfereruniqueid']),_0x11c436);}};exports[_0x9023('0x3a')]=function(_0x39790b){try{if(!_[_0x9023('0x1f')](channels[_0x39790b['uniqueid']])){utils['debug'](util[_0x9023('0x7')]('[%s][calls][musiconholdstart]',_0x39790b['uniqueid']),_0x39790b);channels[_0x39790b[_0x9023('0x9')]][_0x9023('0x3b')]=utils[_0x9023('0x1b')]();utils[_0x9023('0x6')](util['format'](_0x9023('0x3c'),_0x39790b['uniqueid'],channels[_0x39790b[_0x9023('0x9')]][_0x9023('0x3b')]));}}catch(_0x18e3a5){utils[_0x9023('0x1d')](util[_0x9023('0x7')](_0x9023('0x3d'),_0x39790b['uniqueid']),_0x18e3a5);}};exports['musiconholdstop']=function(_0x575e19){try{if(!_[_0x9023('0x1f')](channels[_0x575e19[_0x9023('0x9')]])){utils[_0x9023('0x16')](util['format'](_0x9023('0x3e'),_0x575e19[_0x9023('0x9')]),_0x575e19);if(!_['isNil'](channels[_0x575e19[_0x9023('0x9')]][_0x9023('0x3b')])){channels[_0x575e19[_0x9023('0x9')]][_0x9023('0x3f')]+=utils[_0x9023('0x2e')](utils['now'](),channels[_0x575e19[_0x9023('0x9')]]['musiconholdstartAt']);utils[_0x9023('0x6')](util[_0x9023('0x7')](_0x9023('0x40'),_0x575e19[_0x9023('0x9')],channels[_0x575e19['uniqueid']]['mohtime']));delete channels[_0x575e19[_0x9023('0x9')]][_0x9023('0x3b')];}}}catch(_0x54cee7){utils[_0x9023('0x1d')](util[_0x9023('0x7')](_0x9023('0x3e'),_0x575e19[_0x9023('0x9')]),_0x54cee7);}};exports[_0x9023('0x41')]=function(_0xb7d27d){try{if(!_[_0x9023('0x1f')](channels[_0xb7d27d[_0x9023('0x9')]])){utils[_0x9023('0x16')](util['format'](_0x9023('0x42'),_0xb7d27d['uniqueid']),_0xb7d27d);if(!_[_0x9023('0x1f')](_0xb7d27d[_0x9023('0x43')][_0x9023('0x44')])){utils[_0x9023('0x6')](util['format'](_0x9023('0x45'),_0xb7d27d[_0x9023('0x9')],_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x47')]=_0xb7d27d['value'];}if(!_[_0x9023('0x1f')](_0xb7d27d[_0x9023('0x43')]['xmd-phone'])){utils['info'](util['format'](_0x9023('0x48'),_0xb7d27d['uniqueid'],_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d['uniqueid']]['destination']=_0xb7d27d[_0x9023('0x46')];channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x29')]='\x22'+_0xb7d27d[_0x9023('0x46')]+_0x9023('0x49')+_0xb7d27d[_0x9023('0x46')]+'>';}if(!_[_0x9023('0x1f')](_0xb7d27d[_0x9023('0x43')][_0x9023('0x4a')])||!_['isNil'](_0xb7d27d[_0x9023('0x43')][_0x9023('0x4b')])){utils[_0x9023('0x6')](util[_0x9023('0x7')](_0x9023('0x4c'),_0xb7d27d['uniqueid'],!_['isNil'](_0xb7d27d[_0x9023('0x43')][_0x9023('0x4a')])?_0x9023('0x4a'):'xmd-callerid',_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x29')]=_0xb7d27d['value'];}if(!_['isNil'](_0xb7d27d[_0x9023('0x43')]['xmd-queue'])||!_[_0x9023('0x1f')](_0xb7d27d['variable']['xmcs-queue'])){utils['info'](util[_0x9023('0x7')](_0x9023('0x4c'),_0xb7d27d[_0x9023('0x9')],!_[_0x9023('0x1f')](_0xb7d27d[_0x9023('0x43')][_0x9023('0x4d')])?_0x9023('0x4d'):'xmcs-queue',_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x4e')]=_0x9023('0x4f');channels[_0xb7d27d['uniqueid']][_0x9023('0x50')]=_0xb7d27d[_0x9023('0x46')];channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x51')]=!![];}if(!_[_0x9023('0x1f')](_0xb7d27d[_0x9023('0x43')][_0x9023('0x52')])){utils[_0x9023('0x6')](util[_0x9023('0x7')](_0x9023('0x53'),_0xb7d27d[_0x9023('0x9')],_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x54')]=_0xb7d27d[_0x9023('0x46')];}if(!_['isNil'](_0xb7d27d[_0x9023('0x43')][_0x9023('0x55')])){utils[_0x9023('0x6')](util['format'](_0x9023('0x56'),_0xb7d27d['uniqueid'],_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x57')]=_0xb7d27d['value'];}if(!_[_0x9023('0x1f')](_0xb7d27d[_0x9023('0x43')][_0x9023('0x58')])){utils[_0x9023('0x6')](util[_0x9023('0x7')](_0x9023('0x59'),_0xb7d27d[_0x9023('0x9')],_0xb7d27d['value']));channels[_0xb7d27d['uniqueid']][_0x9023('0x5a')]=_0xb7d27d[_0x9023('0x46')];}if(!_[_0x9023('0x1f')](_0xb7d27d['variable'][_0x9023('0x5b')])){utils[_0x9023('0x6')](util[_0x9023('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xb7d27d[_0x9023('0x9')],_0xb7d27d[_0x9023('0x46')]));channels[_0xb7d27d[_0x9023('0x9')]][_0x9023('0x5b')]=_0xb7d27d[_0x9023('0x46')];}}}catch(_0x4ee10d){utils[_0x9023('0x1d')](util[_0x9023('0x7')](_0x9023('0x42'),_0xb7d27d['uniqueid']),_0x4ee10d);}};exports[_0x9023('0x5c')]=function(_0x4445b8){try{if(!_['isNil'](channels[_0x4445b8[_0x9023('0x9')]])){utils[_0x9023('0x16')](util[_0x9023('0x7')](_0x9023('0x5d'),_0x4445b8[_0x9023('0x9')]),_0x4445b8);utils[_0x9023('0x6')](util['format'](_0x9023('0x5e'),_0x4445b8[_0x9023('0x9')],_0x4445b8[_0x9023('0x5f')],_0x4445b8['appdata']));if(_0x4445b8[_0x9023('0x5f')][_0x9023('0x60')]()==_0x9023('0x61')&&_['startsWith'](_0x4445b8[_0x9023('0x62')][_0x9023('0x60')](),_0x9023('0x63'))){var _0x4d1145=_0x4445b8[_0x9023('0x62')][_0x9023('0x64')]('=');var _0x353b4d=_0x4d1145[0x0][_0x9023('0x65')](_0x4d1145[0x0]['lastIndexOf']('(')+0x1,_0x4d1145[0x0][_0x9023('0x66')](')'));var _0xe9010f=_0x4d1145[0x1];channels[_0x4445b8[_0x9023('0x9')]][_0x353b4d]=_0xe9010f;}if(!_[_0x9023('0x67')]([_0x9023('0x27'),_0x9023('0x68'),_0x9023('0x69'),_0x9023('0x61'),'gotoif'],_0x4445b8[_0x9023('0x5f')][_0x9023('0x60')]())){channels[_0x4445b8[_0x9023('0x9')]][_0x9023('0x4e')]=_0x4445b8[_0x9023('0x5f')];channels[_0x4445b8[_0x9023('0x9')]][_0x9023('0x50')]=_0x4445b8[_0x9023('0x62')];}}}catch(_0x3fea6e){utils[_0x9023('0x1d')](util[_0x9023('0x7')](_0x9023('0x5d'),_0x4445b8[_0x9023('0x9')]),_0x3fea6e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 06b85d2..d8178cf 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 _0xc35e=['[core]\x20close','managerevent','./utils','connect','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','info'];(function(_0x561ab2,_0x5dd79d){var _0x34147e=function(_0x554db1){while(--_0x554db1){_0x561ab2['push'](_0x561ab2['shift']());}};_0x34147e(++_0x5dd79d);}(_0xc35e,0x9e));var _0xec35=function(_0x8739f5,_0x55a924){_0x8739f5=_0x8739f5-0x0;var _0x403a42=_0xc35e[_0x8739f5];return _0x403a42;};'use strict';var utils=require(_0xec35('0x0'));exports[_0xec35('0x1')]=function(){utils['info'](_0xec35('0x2'));};exports[_0xec35('0x3')]=function(){utils['info'](_0xec35('0x4'));};exports[_0xec35('0x5')]=function(){utils['info'](_0xec35('0x6'));};exports['error']=function(_0x16d853){utils['error'](_0xec35('0x7'),_0x16d853);};exports[_0xec35('0x8')]=function(){utils[_0xec35('0x9')](_0xec35('0xa'));};exports[_0xec35('0xb')]=function(_0x31a597){}; \ No newline at end of file +var _0xdc06=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x2dfb31,_0x1f19fe){var _0x38c6e5=function(_0x149f2d){while(--_0x149f2d){_0x2dfb31['push'](_0x2dfb31['shift']());}};_0x38c6e5(++_0x1f19fe);}(_0xdc06,0x15e));var _0x6dc0=function(_0x10b46e,_0x1139cb){_0x10b46e=_0x10b46e-0x0;var _0x3a15ea=_0xdc06[_0x10b46e];return _0x3a15ea;};'use strict';var utils=require(_0x6dc0('0x0'));exports[_0x6dc0('0x1')]=function(){utils[_0x6dc0('0x2')](_0x6dc0('0x3'));};exports[_0x6dc0('0x4')]=function(){utils[_0x6dc0('0x2')](_0x6dc0('0x5'));};exports['fullybooted']=function(){utils[_0x6dc0('0x2')](_0x6dc0('0x6'));};exports[_0x6dc0('0x7')]=function(_0x2f706b){utils['error'](_0x6dc0('0x8'),_0x2f706b);};exports[_0x6dc0('0x9')]=function(){utils['info'](_0x6dc0('0xa'));};exports[_0x6dc0('0xb')]=function(_0x3b9310){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 8c63b3a..d407ce8 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 _0x2ee8=['[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','diffTime','endtime','lodash','util','./utils','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','info','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','varset'];(function(_0x44cd28,_0x1502d9){var _0x39356e=function(_0x4dfe82){while(--_0x4dfe82){_0x44cd28['push'](_0x44cd28['shift']());}};_0x39356e(++_0x1502d9);}(_0x2ee8,0x178));var _0x82ee=function(_0x5ec636,_0x43c345){_0x5ec636=_0x5ec636-0x0;var _0x1fc247=_0x2ee8[_0x5ec636];return _0x1fc247;};'use strict';var _=require(_0x82ee('0x0'));var util=require(_0x82ee('0x1'));var utils=require(_0x82ee('0x2'));var dials={};function writeDB(_0x1d6155){utils['info'](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1d6155[_0x82ee('0x3')],_0x1d6155[_0x82ee('0x4')],_0x1d6155[_0x82ee('0x5')],_0x1d6155[_0x82ee('0x6')],_0x1d6155[_0x82ee('0x7')],_0x1d6155[_0x82ee('0x8')]));utils[_0x82ee('0x9')](_0x82ee('0xa'),_0x1d6155);delete dials[_0x1d6155[_0x82ee('0x3')]];}exports[_0x82ee('0xb')]=function(_0x326f30){try{utils[_0x82ee('0xc')](util[_0x82ee('0xd')](_0x82ee('0xe'),_0x326f30[_0x82ee('0x3')]),_0x326f30);utils[_0x82ee('0xf')](util[_0x82ee('0xd')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x326f30[_0x82ee('0x3')],_0x326f30[_0x82ee('0x10')],_0x326f30['appdata']));if(_0x326f30[_0x82ee('0x10')][_0x82ee('0x11')]()==_0x82ee('0x12')&&_[_0x82ee('0x13')](_0x326f30[_0x82ee('0x14')][_0x82ee('0x11')](),_0x82ee('0x15'))){var _0x5814a1=_0x326f30[_0x82ee('0x14')]['split']('=');dials[_0x326f30[_0x82ee('0x3')]]={'routeId':_0x5814a1[0x1]};}}catch(_0x1a621c){utils[_0x82ee('0x16')](util['format'](_0x82ee('0xe'),_0x326f30['uniqueid']),_0x1a621c);}};exports[_0x82ee('0x17')]=function(_0x4a3d52){try{utils[_0x82ee('0xc')](util[_0x82ee('0xd')](_0x82ee('0x18'),_0x4a3d52[_0x82ee('0x3')]),_0x4a3d52);if(!_[_0x82ee('0x19')](_0x4a3d52[_0x82ee('0x1a')][_0x82ee('0x1b')])){utils[_0x82ee('0xf')](util[_0x82ee('0xd')](_0x82ee('0x1c'),_0x4a3d52[_0x82ee('0x3')],_0x4a3d52[_0x82ee('0x1d')]));dials[_0x4a3d52[_0x82ee('0x3')]]={'routeId':_0x4a3d52['value']};}}catch(_0x4d6a0c){utils[_0x82ee('0x16')](util[_0x82ee('0xd')](_0x82ee('0x18'),_0x4a3d52[_0x82ee('0x3')]),_0x4d6a0c);}};exports[_0x82ee('0x1e')]=function(_0x3313ae){try{if(!_[_0x82ee('0x19')](dials[_0x3313ae[_0x82ee('0x3')]])){utils[_0x82ee('0xc')](util[_0x82ee('0xd')](_0x82ee('0x1f'),_0x3313ae[_0x82ee('0x3')]),_0x3313ae);dials[_0x3313ae[_0x82ee('0x3')]]=_[_0x82ee('0x20')](dials[_0x3313ae['uniqueid']],_0x3313ae);dials[_0x3313ae[_0x82ee('0x3')]][_0x82ee('0x21')]=utils[_0x82ee('0x22')]();dials[_0x3313ae['uniqueid']][_0x82ee('0x23')]='called';utils[_0x82ee('0xf')](util[_0x82ee('0xd')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3313ae[_0x82ee('0x3')],dials[_0x3313ae[_0x82ee('0x3')]]['starttime']));}}catch(_0x140186){utils[_0x82ee('0x16')](util[_0x82ee('0xd')](_0x82ee('0x1f'),_0x3313ae['uniqueid']),_0x140186);}};exports[_0x82ee('0x24')]=function(_0x49de28){try{if(!_[_0x82ee('0x19')](dials[_0x49de28[_0x82ee('0x3')]])){utils[_0x82ee('0xc')](util[_0x82ee('0xd')](_0x82ee('0x25'),_0x49de28[_0x82ee('0x3')]),_0x49de28);dials[_0x49de28[_0x82ee('0x3')]][_0x82ee('0x8')]=_0x49de28[_0x82ee('0x8')];if(_0x49de28[_0x82ee('0x8')]==_0x82ee('0x26')){dials[_0x49de28[_0x82ee('0x3')]]=_[_0x82ee('0x20')](dials[_0x49de28['uniqueid']],_0x49de28);dials[_0x49de28[_0x82ee('0x3')]][_0x82ee('0x27')]=utils[_0x82ee('0x22')]();dials[_0x49de28[_0x82ee('0x3')]]['lastevent']=_0x82ee('0x28');utils[_0x82ee('0xf')](util['format'](_0x82ee('0x29'),_0x49de28[_0x82ee('0x3')],_0x49de28[_0x82ee('0x8')],dials[_0x49de28[_0x82ee('0x3')]][_0x82ee('0x27')]));}else{utils[_0x82ee('0xf')](util[_0x82ee('0xd')](_0x82ee('0x2a'),_0x49de28['uniqueid'],_0x49de28['dialstatus']));}}}catch(_0x222f59){utils[_0x82ee('0x16')](util[_0x82ee('0xd')](_0x82ee('0x25'),_0x49de28[_0x82ee('0x3')]),_0x222f59);}};exports[_0x82ee('0x2b')]=function(_0x4952f0){try{if(!_[_0x82ee('0x19')](dials[_0x4952f0[_0x82ee('0x3')]])){utils[_0x82ee('0xc')](util[_0x82ee('0xd')](_0x82ee('0x2c'),_0x4952f0[_0x82ee('0x3')]),_0x4952f0);utils[_0x82ee('0xf')](util[_0x82ee('0xd')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4952f0[_0x82ee('0x3')],_0x4952f0[_0x82ee('0x6')],_0x4952f0[_0x82ee('0x2d')],_0x4952f0[_0x82ee('0x2e')]));dials[_0x4952f0[_0x82ee('0x3')]]=_[_0x82ee('0x20')](dials[_0x4952f0[_0x82ee('0x3')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x4952f0[_0x82ee('0x3')]][_0x82ee('0x2f')]=utils[_0x82ee('0x30')](dials[_0x4952f0['uniqueid']]['endtime'],dials[_0x4952f0['uniqueid']][_0x82ee('0x21')]);dials[_0x4952f0[_0x82ee('0x3')]]['holdtime']=utils[_0x82ee('0x30')](dials[_0x4952f0[_0x82ee('0x3')]]['answertime']||dials[_0x4952f0[_0x82ee('0x3')]][_0x82ee('0x31')],dials[_0x4952f0[_0x82ee('0x3')]][_0x82ee('0x21')]);dials[_0x4952f0[_0x82ee('0x3')]]['billableseconds']=dials[_0x4952f0[_0x82ee('0x3')]][_0x82ee('0x27')]?utils[_0x82ee('0x30')](dials[_0x4952f0[_0x82ee('0x3')]]['endtime'],dials[_0x4952f0[_0x82ee('0x3')]]['answertime']):0x0;writeDB(dials[_0x4952f0['uniqueid']]);}}catch(_0x18936a){utils[_0x82ee('0x16')](util[_0x82ee('0xd')](_0x82ee('0x2c'),_0x4952f0[_0x82ee('0x3')]),_0x18936a);}}; \ No newline at end of file +var _0xd3fa=['cause-txt','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','dialstatus','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0xd3fa,0x1d2));var _0xad3f=function(_0x5b1d57,_0x23b9b9){_0x5b1d57=_0x5b1d57-0x0;var _0x3f4f78=_0xd3fa[_0x5b1d57];return _0x3f4f78;};'use strict';var _=require(_0xad3f('0x0'));var util=require(_0xad3f('0x1'));var utils=require(_0xad3f('0x2'));var dials={};function writeDB(_0x4e2fdd){utils[_0xad3f('0x3')](util[_0xad3f('0x4')](_0xad3f('0x5'),_0x4e2fdd[_0xad3f('0x6')],_0x4e2fdd['channel'],_0x4e2fdd['dialstring'],_0x4e2fdd[_0xad3f('0x7')],_0x4e2fdd['connectedlinenum'],_0x4e2fdd['dialstatus']));utils[_0xad3f('0x8')](_0xad3f('0x9'),_0x4e2fdd);delete dials[_0x4e2fdd[_0xad3f('0x6')]];}exports[_0xad3f('0xa')]=function(_0x2dd36a){try{utils[_0xad3f('0xb')](util[_0xad3f('0x4')](_0xad3f('0xc'),_0x2dd36a[_0xad3f('0x6')]),_0x2dd36a);utils[_0xad3f('0x3')](util[_0xad3f('0x4')](_0xad3f('0xd'),_0x2dd36a['uniqueid'],_0x2dd36a[_0xad3f('0xe')],_0x2dd36a[_0xad3f('0xf')]));if(_0x2dd36a['application'][_0xad3f('0x10')]()==_0xad3f('0x11')&&_['startsWith'](_0x2dd36a[_0xad3f('0xf')][_0xad3f('0x10')](),_0xad3f('0x12'))){var _0x33b0f8=_0x2dd36a['appdata']['split']('=');dials[_0x2dd36a[_0xad3f('0x6')]]={'routeId':_0x33b0f8[0x1]};}}catch(_0x9d1cd8){utils[_0xad3f('0x13')](util['format'](_0xad3f('0xc'),_0x2dd36a[_0xad3f('0x6')]),_0x9d1cd8);}};exports[_0xad3f('0x14')]=function(_0x16b69a){try{utils[_0xad3f('0xb')](util['format']('[%s][dials][varset]',_0x16b69a[_0xad3f('0x6')]),_0x16b69a);if(!_[_0xad3f('0x15')](_0x16b69a[_0xad3f('0x16')][_0xad3f('0x17')])){utils[_0xad3f('0x3')](util[_0xad3f('0x4')](_0xad3f('0x18'),_0x16b69a[_0xad3f('0x6')],_0x16b69a['value']));dials[_0x16b69a[_0xad3f('0x6')]]={'routeId':_0x16b69a[_0xad3f('0x19')]};}}catch(_0x448410){utils[_0xad3f('0x13')](util['format']('[%s][dials][varset]',_0x16b69a[_0xad3f('0x6')]),_0x448410);}};exports[_0xad3f('0x1a')]=function(_0x596319){try{if(!_[_0xad3f('0x15')](dials[_0x596319[_0xad3f('0x6')]])){utils['debug'](util[_0xad3f('0x4')]('[%s][dials][dialbegin]',_0x596319[_0xad3f('0x6')]),_0x596319);dials[_0x596319[_0xad3f('0x6')]]=_[_0xad3f('0x1b')](dials[_0x596319[_0xad3f('0x6')]],_0x596319);dials[_0x596319[_0xad3f('0x6')]][_0xad3f('0x1c')]=utils['now']();dials[_0x596319[_0xad3f('0x6')]]['lastevent']=_0xad3f('0x1d');utils[_0xad3f('0x3')](util[_0xad3f('0x4')](_0xad3f('0x1e'),_0x596319[_0xad3f('0x6')],dials[_0x596319[_0xad3f('0x6')]][_0xad3f('0x1c')]));}}catch(_0x18d23b){utils['error'](util[_0xad3f('0x4')](_0xad3f('0x1f'),_0x596319[_0xad3f('0x6')]),_0x18d23b);}};exports[_0xad3f('0x20')]=function(_0x3c5464){try{if(!_[_0xad3f('0x15')](dials[_0x3c5464[_0xad3f('0x6')]])){utils[_0xad3f('0xb')](util[_0xad3f('0x4')]('[%s][dials][dialend]',_0x3c5464[_0xad3f('0x6')]),_0x3c5464);dials[_0x3c5464[_0xad3f('0x6')]][_0xad3f('0x21')]=_0x3c5464[_0xad3f('0x21')];if(_0x3c5464[_0xad3f('0x21')]==_0xad3f('0x22')){dials[_0x3c5464[_0xad3f('0x6')]]=_[_0xad3f('0x1b')](dials[_0x3c5464['uniqueid']],_0x3c5464);dials[_0x3c5464['uniqueid']]['answertime']=utils['now']();dials[_0x3c5464[_0xad3f('0x6')]][_0xad3f('0x23')]=_0xad3f('0x24');utils['info'](util[_0xad3f('0x4')](_0xad3f('0x25'),_0x3c5464[_0xad3f('0x6')],_0x3c5464[_0xad3f('0x21')],dials[_0x3c5464['uniqueid']][_0xad3f('0x26')]));}else{utils['info'](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x3c5464[_0xad3f('0x6')],_0x3c5464['dialstatus']));}}}catch(_0x3388af){utils[_0xad3f('0x13')](util[_0xad3f('0x4')](_0xad3f('0x27'),_0x3c5464[_0xad3f('0x6')]),_0x3388af);}};exports[_0xad3f('0x28')]=function(_0x807576){try{if(!_['isNil'](dials[_0x807576[_0xad3f('0x6')]])){utils[_0xad3f('0xb')](util['format'](_0xad3f('0x29'),_0x807576['uniqueid']),_0x807576);utils[_0xad3f('0x3')](util['format'](_0xad3f('0x2a'),_0x807576['uniqueid'],_0x807576['calleridnum'],_0x807576[_0xad3f('0x2b')],_0x807576[_0xad3f('0x2c')]));dials[_0x807576[_0xad3f('0x6')]]=_[_0xad3f('0x1b')](dials[_0x807576[_0xad3f('0x6')]],{'endtime':utils['now'](),'lastevent':_0xad3f('0x2d')});dials[_0x807576['uniqueid']][_0xad3f('0x2e')]=utils[_0xad3f('0x2f')](dials[_0x807576[_0xad3f('0x6')]]['endtime'],dials[_0x807576[_0xad3f('0x6')]][_0xad3f('0x1c')]);dials[_0x807576['uniqueid']][_0xad3f('0x30')]=utils[_0xad3f('0x2f')](dials[_0x807576['uniqueid']][_0xad3f('0x26')]||dials[_0x807576[_0xad3f('0x6')]][_0xad3f('0x31')],dials[_0x807576[_0xad3f('0x6')]]['starttime']);dials[_0x807576[_0xad3f('0x6')]][_0xad3f('0x32')]=dials[_0x807576['uniqueid']]['answertime']?utils['diffTime'](dials[_0x807576[_0xad3f('0x6')]][_0xad3f('0x31')],dials[_0x807576['uniqueid']]['answertime']):0x0;writeDB(dials[_0x807576[_0xad3f('0x6')]]);}}catch(_0x9ac5e6){utils[_0xad3f('0x13')](util[_0xad3f('0x4')](_0xad3f('0x29'),_0x807576[_0xad3f('0x6')]),_0x9ac5e6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8f7c578..8f480d1 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 _0xe746=['queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','util','xdr','env','production','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','agentcalled','format','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x5b11f8,_0x11dbd1){var _0x2a9d9b=function(_0x75faea){while(--_0x75faea){_0x5b11f8['push'](_0x5b11f8['shift']());}};_0x2a9d9b(++_0x11dbd1);}(_0xe746,0x1e4));var _0x6e74=function(_0x3fffff,_0x29ea80){_0x3fffff=_0x3fffff-0x0;var _0x2b57ff=_0xe746[_0x3fffff];return _0x2b57ff;};var AsteriskManager=require(_0x6e74('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x6e74('0x1'));var isXDREnabled=config[_0x6e74('0x2')]&&config[_0x6e74('0x2')]['disabled']?!config['xdr']['disabled']:!![];var isProduction=config[_0x6e74('0x3')]===_0x6e74('0x4')||![];var isLocalAsterisk=config[_0x6e74('0x2')]&&config[_0x6e74('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x6e74('0x5')][_0x6e74('0x6')],config[_0x6e74('0x5')]['ip'],config[_0x6e74('0x5')]['username'],config[_0x6e74('0x5')][_0x6e74('0x7')],!![]);ami[_0x6e74('0x8')]();if(!isXDREnabled){utils[_0x6e74('0x9')](_0x6e74('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x6e74('0xb'));}else{var agents=require(_0x6e74('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x6e74('0xd'));var members=require(_0x6e74('0xe'));var dials=require(_0x6e74('0xf'));var transfers=require(_0x6e74('0x10'));var core=require(_0x6e74('0x11'));ami['on'](_0x6e74('0x12'),core[_0x6e74('0x12')]);ami['on'](_0x6e74('0x13'),core['shutdown']);ami['on']('fullybooted',core[_0x6e74('0x14')]);ami['on'](_0x6e74('0x15'),core['error']);ami['on']('close',core[_0x6e74('0x16')]);ami['on'](_0x6e74('0x17'),core[_0x6e74('0x17')]);ami['on'](_0x6e74('0x18'),function(_0x29faf0){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x1a'),_0x29faf0['device']),_0x29faf0);members[_0x6e74('0x18')](_0x29faf0);}catch(_0xdf36e1){utils[_0x6e74('0x15')](util['format']('[%s][index][devicestatechange]',_0x29faf0['device']),_0xdf36e1);}});ami['on'](_0x6e74('0x1b'),function(_0x145d20){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')]('[%s][index][agentcalled]',_0x145d20['uniqueid']),_0x145d20);agents[_0x6e74('0x1b')](_0x145d20);}catch(_0x85fd9d){utils['error'](util[_0x6e74('0x1c')]('[%s][index][agentcalled]',_0x145d20[_0x6e74('0x1d')]),_0x85fd9d);}});ami['on'](_0x6e74('0x1e'),function(_0x2aede9){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x1f'),_0x2aede9[_0x6e74('0x1d')]),_0x2aede9);agents[_0x6e74('0x1e')](_0x2aede9);}catch(_0x5bf517){utils[_0x6e74('0x15')](util['format'](_0x6e74('0x1f'),_0x2aede9[_0x6e74('0x1d')]),_0x5bf517);}});ami['on'](_0x6e74('0x20'),function(_0x19f8a7){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x21'),_0x19f8a7[_0x6e74('0x1d')]),_0x19f8a7);agents[_0x6e74('0x20')](_0x19f8a7);queues['agentconnect'](_0x19f8a7);}catch(_0x58e8d7){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')](_0x6e74('0x21'),_0x19f8a7['uniqueid']),_0x58e8d7);}});ami['on'](_0x6e74('0x22'),function(_0x144cee){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x23'),_0x144cee[_0x6e74('0x1d')]),_0x144cee);agents['agentcomplete'](_0x144cee);queues[_0x6e74('0x22')](_0x144cee);members[_0x6e74('0x22')](_0x144cee);}catch(_0x1d5c79){utils['error'](util[_0x6e74('0x1c')]('[%s][index][agentcomplete]',_0x144cee[_0x6e74('0x1d')]),_0x1d5c79);}});ami['on'](_0x6e74('0x24'),function(_0x5325e7){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')]('[%s][index][queuecallerabandon]',_0x5325e7[_0x6e74('0x1d')]),_0x5325e7);agents['queuecallerabandon'](_0x5325e7);queues[_0x6e74('0x24')](_0x5325e7);}catch(_0x4ede2d){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')](_0x6e74('0x25'),_0x5325e7[_0x6e74('0x1d')]),_0x4ede2d);}});ami['on']('queuecallerjoin',function(_0x239d2e){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x26'),_0x239d2e[_0x6e74('0x1d')]),_0x239d2e);queues[_0x6e74('0x27')](_0x239d2e);recordings[_0x6e74('0x27')](_0x239d2e);}catch(_0x357d4c){utils['error'](util[_0x6e74('0x1c')](_0x6e74('0x26'),_0x239d2e[_0x6e74('0x1d')]),_0x357d4c);}});ami['on']('queuecallerleave',function(_0x5ab82f){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x28'),_0x5ab82f[_0x6e74('0x1d')]),_0x5ab82f);queues['queuecallerleave'](_0x5ab82f);}catch(_0x477975){utils['error'](util['format'](_0x6e74('0x28'),_0x5ab82f[_0x6e74('0x1d')]),_0x477975);}});ami['on'](_0x6e74('0x29'),function(_0x35afc3){try{utils['debug'](util[_0x6e74('0x1c')](_0x6e74('0x2a'),_0x35afc3[_0x6e74('0x1d')]),_0x35afc3);queues[_0x6e74('0x29')](_0x35afc3);calls[_0x6e74('0x29')](_0x35afc3);}catch(_0x26a7e2){utils['error'](util['format'](_0x6e74('0x2a'),_0x35afc3[_0x6e74('0x1d')]),_0x26a7e2);}});ami['on'](_0x6e74('0x2b'),function(_0x34a46d){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x2c'),_0x34a46d[_0x6e74('0x1d')]),_0x34a46d);queues[_0x6e74('0x2b')](_0x34a46d);calls[_0x6e74('0x2b')](_0x34a46d);}catch(_0x116a79){utils['error'](util['format'](_0x6e74('0x2c'),_0x34a46d[_0x6e74('0x1d')]),_0x116a79);}});ami['on'](_0x6e74('0x2d'),function(_0x124adc){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')](_0x6e74('0x2e'),_0x124adc[_0x6e74('0x1d')]),_0x124adc);calls[_0x6e74('0x2d')](_0x124adc);recordings[_0x6e74('0x2d')](_0x124adc);}catch(_0x26e5f9){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')]('[%s][index][newstate]',_0x124adc[_0x6e74('0x1d')]),_0x26e5f9);}});ami['on'](_0x6e74('0x2f'),function(_0x2c14f1){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')](_0x6e74('0x30'),_0x2c14f1[_0x6e74('0x1d')]),_0x2c14f1);calls[_0x6e74('0x2f')](_0x2c14f1);recordings[_0x6e74('0x2f')](_0x2c14f1);dials['hangup'](_0x2c14f1);agents['hangup'](_0x2c14f1);queues[_0x6e74('0x2f')](_0x2c14f1);}catch(_0x407a84){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')](_0x6e74('0x30'),_0x2c14f1['uniqueid']),_0x407a84);}});ami['on'](_0x6e74('0x31'),function(_0x40eaac){try{utils['debug'](util[_0x6e74('0x1c')](_0x6e74('0x32'),_0x40eaac['uniqueid']),_0x40eaac);members[_0x6e74('0x31')](_0x40eaac);}catch(_0x14636c){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')](_0x6e74('0x32'),_0x40eaac[_0x6e74('0x1d')]),_0x14636c);}});ami['on']('blindtransfer',function(_0x418719){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')](_0x6e74('0x33'),_0x418719[_0x6e74('0x1d')]),_0x418719);queues[_0x6e74('0x34')](_0x418719);agents['blindtransfer'](_0x418719);transfers[_0x6e74('0x34')](_0x418719);}catch(_0x496434){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')](_0x6e74('0x33'),_0x418719[_0x6e74('0x1d')]),_0x496434);}});ami['on'](_0x6e74('0x35'),function(_0x111854){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')]('[%s][index][attendedtransfer]',_0x111854['origtransfereruniqueid']),_0x111854);queues[_0x6e74('0x35')](_0x111854);transfers[_0x6e74('0x35')](_0x111854);agents[_0x6e74('0x35')](_0x111854);calls['attendedtransfer'](_0x111854);}catch(_0xecbc82){utils['error'](util[_0x6e74('0x1c')]('[%s][index][attendedtransfer]',_0x111854[_0x6e74('0x36')]),_0xecbc82);}});ami['on']('varset',function(_0x29feeb){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')](_0x6e74('0x37'),_0x29feeb[_0x6e74('0x1d')]),_0x29feeb);queues[_0x6e74('0x38')](_0x29feeb);recordings[_0x6e74('0x38')](_0x29feeb);calls[_0x6e74('0x38')](_0x29feeb);dials['varset'](_0x29feeb);}catch(_0x4ae03c){utils['error'](util[_0x6e74('0x1c')](_0x6e74('0x37'),_0x29feeb['uniqueid']),_0x4ae03c);}});ami['on'](_0x6e74('0x39'),function(_0x431de5){try{utils[_0x6e74('0x19')](util['format']('[%s][index][newexten]',_0x431de5[_0x6e74('0x1d')]),_0x431de5);calls[_0x6e74('0x39')](_0x431de5);recordings[_0x6e74('0x39')](_0x431de5);dials[_0x6e74('0x39')](_0x431de5);}catch(_0x358656){utils[_0x6e74('0x15')](util['format'](_0x6e74('0x3a'),_0x431de5[_0x6e74('0x1d')]),_0x358656);}});ami['on'](_0x6e74('0x3b'),function(_0x1e6fa2){try{utils[_0x6e74('0x19')](util['format']('[%s][index][newchannel]',_0x1e6fa2[_0x6e74('0x1d')]),_0x1e6fa2);calls[_0x6e74('0x3b')](_0x1e6fa2);recordings[_0x6e74('0x3b')](_0x1e6fa2);}catch(_0x166386){utils['error'](util[_0x6e74('0x1c')]('[%s][index][newchannel]',_0x1e6fa2[_0x6e74('0x1d')]),_0x166386);}});ami['on']('dialbegin',function(_0x854dab){try{utils[_0x6e74('0x19')](util['format'](_0x6e74('0x3c'),_0x854dab[_0x6e74('0x1d')]),_0x854dab);dials[_0x6e74('0x3d')](_0x854dab);}catch(_0x365cda){utils[_0x6e74('0x15')](util[_0x6e74('0x1c')](_0x6e74('0x3e'),_0x854dab[_0x6e74('0x1d')]),_0x365cda);}});ami['on']('dialend',function(_0x498596){try{utils[_0x6e74('0x19')](util[_0x6e74('0x1c')](_0x6e74('0x3f'),_0x498596[_0x6e74('0x1d')]),_0x498596);dials[_0x6e74('0x40')](_0x498596);}catch(_0xb30014){utils[_0x6e74('0x15')](util['format'](_0x6e74('0x3f'),_0x498596[_0x6e74('0x1d')]),_0xb30014);}});} \ No newline at end of file +var _0x9ddb=['error','close','managerevent','format','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','util','xdr','disabled','env','production','asterisk','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted'];(function(_0x43d06c,_0x3b92ff){var _0x21c9dc=function(_0x171551){while(--_0x171551){_0x43d06c['push'](_0x43d06c['shift']());}};_0x21c9dc(++_0x3b92ff);}(_0x9ddb,0x6b));var _0xb9dd=function(_0x3fd174,_0x53926c){_0x3fd174=_0x3fd174-0x0;var _0x9d2bf2=_0x9ddb[_0x3fd174];return _0x9d2bf2;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xb9dd('0x0'));var isXDREnabled=config[_0xb9dd('0x1')]&&config[_0xb9dd('0x1')][_0xb9dd('0x2')]?!config['xdr'][_0xb9dd('0x2')]:!![];var isProduction=config[_0xb9dd('0x3')]===_0xb9dd('0x4')||![];var isLocalAsterisk=config[_0xb9dd('0x1')]&&config[_0xb9dd('0x1')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xb9dd('0x5')]['port'],config[_0xb9dd('0x5')]['ip'],config[_0xb9dd('0x5')]['username'],config[_0xb9dd('0x5')][_0xb9dd('0x6')],!![]);ami[_0xb9dd('0x7')]();if(!isXDREnabled){utils['info'](_0xb9dd('0x8'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xb9dd('0x9')](_0xb9dd('0xa'));}else{var agents=require(_0xb9dd('0xb'));var calls=require('./calls.controller');var queues=require(_0xb9dd('0xc'));var recordings=require('./recordings.controller');var members=require(_0xb9dd('0xd'));var dials=require(_0xb9dd('0xe'));var transfers=require('./transfers.controller');var core=require(_0xb9dd('0xf'));ami['on'](_0xb9dd('0x10'),core['connect']);ami['on'](_0xb9dd('0x11'),core['shutdown']);ami['on'](_0xb9dd('0x12'),core['fullybooted']);ami['on'](_0xb9dd('0x13'),core['error']);ami['on'](_0xb9dd('0x14'),core[_0xb9dd('0x14')]);ami['on'](_0xb9dd('0x15'),core[_0xb9dd('0x15')]);ami['on']('devicestatechange',function(_0x36f678){try{utils['debug'](util[_0xb9dd('0x16')]('[%s][index][devicestatechange]',_0x36f678[_0xb9dd('0x17')]),_0x36f678);members['devicestatechange'](_0x36f678);}catch(_0x1849d9){utils['error'](util['format']('[%s][index][devicestatechange]',_0x36f678[_0xb9dd('0x17')]),_0x1849d9);}});ami['on']('agentcalled',function(_0x21ed73){try{utils['debug'](util[_0xb9dd('0x16')](_0xb9dd('0x18'),_0x21ed73[_0xb9dd('0x19')]),_0x21ed73);agents[_0xb9dd('0x1a')](_0x21ed73);}catch(_0x10c504){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x18'),_0x21ed73[_0xb9dd('0x19')]),_0x10c504);}});ami['on'](_0xb9dd('0x1b'),function(_0x1ba060){try{utils['debug'](util[_0xb9dd('0x16')](_0xb9dd('0x1c'),_0x1ba060[_0xb9dd('0x19')]),_0x1ba060);agents[_0xb9dd('0x1b')](_0x1ba060);}catch(_0x5ce17a){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x1c'),_0x1ba060[_0xb9dd('0x19')]),_0x5ce17a);}});ami['on'](_0xb9dd('0x1d'),function(_0x58bca4){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')]('[%s][index][agentconnect]',_0x58bca4['uniqueid']),_0x58bca4);agents[_0xb9dd('0x1d')](_0x58bca4);queues['agentconnect'](_0x58bca4);}catch(_0x50d87f){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x1f'),_0x58bca4[_0xb9dd('0x19')]),_0x50d87f);}});ami['on'](_0xb9dd('0x20'),function(_0x11b8db){try{utils['debug'](util['format'](_0xb9dd('0x21'),_0x11b8db['uniqueid']),_0x11b8db);agents['agentcomplete'](_0x11b8db);queues[_0xb9dd('0x20')](_0x11b8db);members[_0xb9dd('0x20')](_0x11b8db);}catch(_0x4ef9dc){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x21'),_0x11b8db[_0xb9dd('0x19')]),_0x4ef9dc);}});ami['on']('queuecallerabandon',function(_0x42ee0e){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x22'),_0x42ee0e['uniqueid']),_0x42ee0e);agents['queuecallerabandon'](_0x42ee0e);queues[_0xb9dd('0x23')](_0x42ee0e);}catch(_0x37c005){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x22'),_0x42ee0e[_0xb9dd('0x19')]),_0x37c005);}});ami['on']('queuecallerjoin',function(_0x4420d8){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x24'),_0x4420d8[_0xb9dd('0x19')]),_0x4420d8);queues[_0xb9dd('0x25')](_0x4420d8);recordings[_0xb9dd('0x25')](_0x4420d8);}catch(_0xb5106f){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x24'),_0x4420d8[_0xb9dd('0x19')]),_0xb5106f);}});ami['on'](_0xb9dd('0x26'),function(_0x5340b2){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x27'),_0x5340b2[_0xb9dd('0x19')]),_0x5340b2);queues['queuecallerleave'](_0x5340b2);}catch(_0x18ca45){utils['error'](util['format'](_0xb9dd('0x27'),_0x5340b2[_0xb9dd('0x19')]),_0x18ca45);}});ami['on'](_0xb9dd('0x28'),function(_0x2ea30a){try{utils['debug'](util[_0xb9dd('0x16')]('[%s][index][musiconholdstart]',_0x2ea30a['uniqueid']),_0x2ea30a);queues[_0xb9dd('0x28')](_0x2ea30a);calls[_0xb9dd('0x28')](_0x2ea30a);}catch(_0x5d56c6){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x29'),_0x2ea30a['uniqueid']),_0x5d56c6);}});ami['on'](_0xb9dd('0x2a'),function(_0x3f60f8){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x2b'),_0x3f60f8['uniqueid']),_0x3f60f8);queues[_0xb9dd('0x2a')](_0x3f60f8);calls[_0xb9dd('0x2a')](_0x3f60f8);}catch(_0x51b96e){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')]('[%s][index][musiconholdstop]',_0x3f60f8[_0xb9dd('0x19')]),_0x51b96e);}});ami['on'](_0xb9dd('0x2c'),function(_0x59b98c){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')]('[%s][index][newstate]',_0x59b98c['uniqueid']),_0x59b98c);calls['newstate'](_0x59b98c);recordings['newstate'](_0x59b98c);}catch(_0x176592){utils['error'](util['format']('[%s][index][newstate]',_0x59b98c[_0xb9dd('0x19')]),_0x176592);}});ami['on'](_0xb9dd('0x2d'),function(_0x283105){try{utils[_0xb9dd('0x1e')](util['format'](_0xb9dd('0x2e'),_0x283105[_0xb9dd('0x19')]),_0x283105);calls['hangup'](_0x283105);recordings['hangup'](_0x283105);dials[_0xb9dd('0x2d')](_0x283105);agents[_0xb9dd('0x2d')](_0x283105);queues[_0xb9dd('0x2d')](_0x283105);}catch(_0x387d90){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')]('[%s][index][hangup]',_0x283105[_0xb9dd('0x19')]),_0x387d90);}});ami['on']('cdr',function(_0x41394f){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x2f'),_0x41394f[_0xb9dd('0x19')]),_0x41394f);members[_0xb9dd('0x30')](_0x41394f);}catch(_0x6472fd){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x2f'),_0x41394f[_0xb9dd('0x19')]),_0x6472fd);}});ami['on'](_0xb9dd('0x31'),function(_0x5f4cba){try{utils[_0xb9dd('0x1e')](util['format'](_0xb9dd('0x32'),_0x5f4cba[_0xb9dd('0x19')]),_0x5f4cba);queues[_0xb9dd('0x31')](_0x5f4cba);agents[_0xb9dd('0x31')](_0x5f4cba);transfers['blindtransfer'](_0x5f4cba);}catch(_0x14319b){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x32'),_0x5f4cba['uniqueid']),_0x14319b);}});ami['on'](_0xb9dd('0x33'),function(_0x2b9424){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x34'),_0x2b9424[_0xb9dd('0x35')]),_0x2b9424);queues['attendedtransfer'](_0x2b9424);transfers[_0xb9dd('0x33')](_0x2b9424);agents[_0xb9dd('0x33')](_0x2b9424);calls[_0xb9dd('0x33')](_0x2b9424);}catch(_0x22497f){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')]('[%s][index][attendedtransfer]',_0x2b9424['origtransfereruniqueid']),_0x22497f);}});ami['on']('varset',function(_0x11c194){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')]('[%s][index][varset]',_0x11c194[_0xb9dd('0x19')]),_0x11c194);queues[_0xb9dd('0x36')](_0x11c194);recordings[_0xb9dd('0x36')](_0x11c194);calls[_0xb9dd('0x36')](_0x11c194);dials['varset'](_0x11c194);}catch(_0x159a86){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')]('[%s][index][varset]',_0x11c194[_0xb9dd('0x19')]),_0x159a86);}});ami['on']('newexten',function(_0x578ccf){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')]('[%s][index][newexten]',_0x578ccf['uniqueid']),_0x578ccf);calls[_0xb9dd('0x37')](_0x578ccf);recordings[_0xb9dd('0x37')](_0x578ccf);dials['newexten'](_0x578ccf);}catch(_0x38300c){utils['error'](util[_0xb9dd('0x16')]('[%s][index][newexten]',_0x578ccf[_0xb9dd('0x19')]),_0x38300c);}});ami['on'](_0xb9dd('0x38'),function(_0x1974b8){try{utils[_0xb9dd('0x1e')](util[_0xb9dd('0x16')](_0xb9dd('0x39'),_0x1974b8['uniqueid']),_0x1974b8);calls[_0xb9dd('0x38')](_0x1974b8);recordings[_0xb9dd('0x38')](_0x1974b8);}catch(_0x463707){utils['error'](util[_0xb9dd('0x16')](_0xb9dd('0x39'),_0x1974b8[_0xb9dd('0x19')]),_0x463707);}});ami['on'](_0xb9dd('0x3a'),function(_0x2644c2){try{utils['debug'](util[_0xb9dd('0x16')](_0xb9dd('0x3b'),_0x2644c2['uniqueid']),_0x2644c2);dials['dialbegin'](_0x2644c2);}catch(_0x304214){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x3c'),_0x2644c2[_0xb9dd('0x19')]),_0x304214);}});ami['on'](_0xb9dd('0x3d'),function(_0x3148cc){try{utils[_0xb9dd('0x1e')](util['format'](_0xb9dd('0x3e'),_0x3148cc['uniqueid']),_0x3148cc);dials[_0xb9dd('0x3d')](_0x3148cc);}catch(_0x1b9a1b){utils[_0xb9dd('0x13')](util[_0xb9dd('0x16')](_0xb9dd('0x3e'),_0x3148cc['uniqueid']),_0x1b9a1b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a4b69a0..543b9f1 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 _0xb2ff=['destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Local/_attended@transfer','format','uniqueid','interface','channel','data2','then','membername','internal','request','getUserByName','split','name','CreateMemberReport','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','assign','data1','type','data3'];(function(_0x2d7e3e,_0x3f7fcb){var _0x15a11e=function(_0x47161a){while(--_0x47161a){_0x2d7e3e['push'](_0x2d7e3e['shift']());}};_0x15a11e(++_0x3f7fcb);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2ff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var utils=require('./utils');var members={};var exclude=[_0xfb2f('0x2'),'Queue:'];function writeDB(_0x584330){utils['info'](util[_0xfb2f('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x584330[_0xfb2f('0x4')],_0x584330[_0xfb2f('0x5')],_0x584330[_0xfb2f('0x6')],_0x584330[_0xfb2f('0x7')],_0x584330['membername'],_0x584330['type']));if(_0x584330[_0xfb2f('0x5')]){utils['getUserByInterface'](_0x584330[_0xfb2f('0x5')])[_0xfb2f('0x8')](function(_0x29e9e4){if(_0x29e9e4){_0x584330[_0xfb2f('0x9')]=_0x29e9e4['name'];_0x584330[_0xfb2f('0xa')]=_0x29e9e4['internal'];utils[_0xfb2f('0xb')]('CreateMemberReport',_0x584330);}else{utils[_0xfb2f('0xc')](_0x584330[_0xfb2f('0x5')][_0xfb2f('0xd')]('/')[0x1])[_0xfb2f('0x8')](function(_0xef9376){if(_0xef9376){_0x584330['membername']=_0xef9376[_0xfb2f('0xe')];_0x584330[_0xfb2f('0xa')]=_0xef9376[_0xfb2f('0xa')];utils[_0xfb2f('0xb')](_0xfb2f('0xf'),_0x584330);}});}})[_0xfb2f('0x10')](function(_0x36562f){utils[_0xfb2f('0x11')](util['format'](_0xfb2f('0x12'),_0x584330[_0xfb2f('0x4')]),_0x36562f);});}delete members[_0x584330[_0xfb2f('0x5')]];}function startsWith(_0xbfd8c2,_0x34a57f){return _['some'](_0xbfd8c2,function(_0xb6177a){return _[_0xfb2f('0x13')](_0x34a57f,_0xb6177a);});}exports[_0xfb2f('0x14')]=function(_0x240b79){try{utils[_0xfb2f('0x15')](util[_0xfb2f('0x3')]('[%s][members][devicestatechange]',members[_0x240b79[_0xfb2f('0x16')]]?members[_0x240b79[_0xfb2f('0x16')]]['uniqueid']:_0x240b79[_0xfb2f('0x16')]),_0x240b79);utils[_0xfb2f('0x17')](util[_0xfb2f('0x3')](_0xfb2f('0x18'),members[_0x240b79[_0xfb2f('0x16')]]?members[_0x240b79['device']]['uniqueid']:_0x240b79[_0xfb2f('0x16')],_0x240b79['state'],_0x240b79[_0xfb2f('0x16')]));switch(_0x240b79['state']){case'INUSE':case _0xfb2f('0x19'):if(!startsWith(exclude,_0x240b79[_0xfb2f('0x16')])){members[_0x240b79['device']]={'channel':_0xfb2f('0x1a'),'interface':_0x240b79[_0xfb2f('0x16')],'type':_0xfb2f('0x1b'),'enterAt':utils[_0xfb2f('0x1c')](),'role':_0xfb2f('0x1d')};}break;case'NOT_INUSE':if(!_[_0xfb2f('0x1e')](members[_0x240b79[_0xfb2f('0x16')]])){members[_0x240b79['device']][_0xfb2f('0x1f')]=utils['now']();members[_0x240b79[_0xfb2f('0x16')]][_0xfb2f('0x20')]=utils[_0xfb2f('0x21')](members[_0x240b79[_0xfb2f('0x16')]][_0xfb2f('0x1f')],members[_0x240b79['device']][_0xfb2f('0x22')]);if(members[_0x240b79[_0xfb2f('0x16')]][_0xfb2f('0x4')]){writeDB(members[_0x240b79[_0xfb2f('0x16')]]);}}break;default:break;}}catch(_0x464909){utils[_0xfb2f('0x11')](util['format'](_0xfb2f('0x23'),members[_0x240b79[_0xfb2f('0x16')]]?members[_0x240b79[_0xfb2f('0x16')]][_0xfb2f('0x4')]:_0x240b79['device']),_0x464909);}};exports['agentcomplete']=function(_0xef637a){try{if(!_[_0xfb2f('0x1e')](members[_0xef637a[_0xfb2f('0x5')]])){utils['debug'](util[_0xfb2f('0x3')]('[%s][members][agentcomplete]',_0xef637a['uniqueid']),_0xef637a);utils[_0xfb2f('0x17')](util['format'](_0xfb2f('0x24'),_0xef637a[_0xfb2f('0x4')],_0xef637a[_0xfb2f('0x5')],_0xef637a[_0xfb2f('0x25')]));members[_0xef637a[_0xfb2f('0x5')]]=_['assign'](members[_0xef637a[_0xfb2f('0x5')]],{'data4':_0xef637a[_0xfb2f('0x25')],'uniqueid':_0xef637a['uniqueid']});}}catch(_0x5de0ff){utils['error'](util[_0xfb2f('0x3')](_0xfb2f('0x26'),_0xef637a[_0xfb2f('0x4')]),_0x5de0ff);}};exports[_0xfb2f('0x27')]=function(_0x2421f8){try{utils[_0xfb2f('0x15')](util[_0xfb2f('0x3')](_0xfb2f('0x28'),_0x2421f8[_0xfb2f('0x4')]),_0x2421f8);if(_0x2421f8[_0xfb2f('0x6')]){var _0x351412=_0x2421f8[_0xfb2f('0x6')][_0xfb2f('0xd')]('-')[0x0];if(!_['isNil'](members[_0x351412])){members[_0x351412]=_[_0xfb2f('0x29')](members[_0x351412],{'data1':members[_0x351412][_0xfb2f('0x2a')]||_0x2421f8[_0xfb2f('0x2b')],'data2':members[_0x351412][_0xfb2f('0x7')]||_0x2421f8['source'],'data3':members[_0x351412][_0xfb2f('0x2c')]||_0x2421f8[_0xfb2f('0x2d')],'uniqueid':members[_0x351412][_0xfb2f('0x4')]||_0x2421f8[_0xfb2f('0x4')]});utils[_0xfb2f('0x17')](util['format'](_0xfb2f('0x2e'),_0x2421f8[_0xfb2f('0x4')],members[_0x351412][_0xfb2f('0x2a')],members[_0x351412][_0xfb2f('0x7')],members[_0x351412]['data3']));if(members[_0x351412][_0xfb2f('0x1f')]){writeDB(members[_0x351412]);}}}if(_0x2421f8[_0xfb2f('0x2f')]){var _0x12d2aa=_0x2421f8[_0xfb2f('0x2f')]['split']('-')[0x0];if(!_[_0xfb2f('0x1e')](members[_0x12d2aa])){members[_0x12d2aa]=_[_0xfb2f('0x29')](members[_0x12d2aa],{'data1':members[_0x12d2aa][_0xfb2f('0x2a')]||_0x2421f8['type'],'data2':members[_0x12d2aa]['data2']||_0x2421f8['source'],'data3':members[_0x12d2aa]['data3']||_0x2421f8['destination'],'uniqueid':members[_0x12d2aa][_0xfb2f('0x4')]||_0x2421f8[_0xfb2f('0x4')]});utils[_0xfb2f('0x17')](util['format'](_0xfb2f('0x2e'),_0x2421f8[_0xfb2f('0x4')],members[_0x12d2aa][_0xfb2f('0x2a')],members[_0x12d2aa][_0xfb2f('0x7')],members[_0x12d2aa][_0xfb2f('0x2c')]));if(members[_0x12d2aa][_0xfb2f('0x1f')]){writeDB(members[_0x12d2aa]);}}}}catch(_0x229311){utils[_0xfb2f('0x11')](util[_0xfb2f('0x3')]('[%s][members][cdr]',_0x2421f8[_0xfb2f('0x4')]),_0x229311);}}; \ No newline at end of file +var _0xbb53=['split','CreateMemberReport','catch','error','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','duration','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','membername','type','interface','getUserByInterface','name','internal','request'];(function(_0x7b0b53,_0x4d6b7c){var _0x2bd38f=function(_0x381b39){while(--_0x381b39){_0x7b0b53['push'](_0x7b0b53['shift']());}};_0x2bd38f(++_0x4d6b7c);}(_0xbb53,0x121));var _0x3bb5=function(_0x401531,_0x582a70){_0x401531=_0x401531-0x0;var _0x51b83c=_0xbb53[_0x401531];return _0x51b83c;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var utils=require(_0x3bb5('0x2'));var members={};var exclude=[_0x3bb5('0x3'),_0x3bb5('0x4')];function writeDB(_0x226d39){utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x7'),_0x226d39[_0x3bb5('0x8')],_0x226d39['interface'],_0x226d39['channel'],_0x226d39[_0x3bb5('0x9')],_0x226d39[_0x3bb5('0xa')],_0x226d39[_0x3bb5('0xb')]));if(_0x226d39[_0x3bb5('0xc')]){utils[_0x3bb5('0xd')](_0x226d39['interface'])['then'](function(_0x4cfdd7){if(_0x4cfdd7){_0x226d39[_0x3bb5('0xa')]=_0x4cfdd7[_0x3bb5('0xe')];_0x226d39[_0x3bb5('0xf')]=_0x4cfdd7['internal'];utils[_0x3bb5('0x10')]('CreateMemberReport',_0x226d39);}else{utils['getUserByName'](_0x226d39[_0x3bb5('0xc')][_0x3bb5('0x11')]('/')[0x1])['then'](function(_0xe00ace){if(_0xe00ace){_0x226d39['membername']=_0xe00ace[_0x3bb5('0xe')];_0x226d39['internal']=_0xe00ace['internal'];utils[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x226d39);}});}})[_0x3bb5('0x13')](function(_0x512be4){utils[_0x3bb5('0x14')](util[_0x3bb5('0x6')]('[%s][members][writeDB]',_0x226d39[_0x3bb5('0x8')]),_0x512be4);});}delete members[_0x226d39[_0x3bb5('0xc')]];}function startsWith(_0x5cec77,_0x5ca99f){return _['some'](_0x5cec77,function(_0x42ef1b){return _[_0x3bb5('0x15')](_0x5ca99f,_0x42ef1b);});}exports['devicestatechange']=function(_0x25d774){try{utils[_0x3bb5('0x16')](util[_0x3bb5('0x6')](_0x3bb5('0x17'),members[_0x25d774['device']]?members[_0x25d774[_0x3bb5('0x18')]][_0x3bb5('0x8')]:_0x25d774[_0x3bb5('0x18')]),_0x25d774);utils['info'](util['format'](_0x3bb5('0x19'),members[_0x25d774[_0x3bb5('0x18')]]?members[_0x25d774[_0x3bb5('0x18')]]['uniqueid']:_0x25d774[_0x3bb5('0x18')],_0x25d774[_0x3bb5('0x1a')],_0x25d774[_0x3bb5('0x18')]));switch(_0x25d774[_0x3bb5('0x1a')]){case _0x3bb5('0x1b'):case _0x3bb5('0x1c'):if(!startsWith(exclude,_0x25d774['device'])){members[_0x25d774[_0x3bb5('0x18')]]={'channel':_0x3bb5('0x1d'),'interface':_0x25d774[_0x3bb5('0x18')],'type':_0x3bb5('0x1e'),'enterAt':utils[_0x3bb5('0x1f')](),'role':_0x3bb5('0x20')};}break;case _0x3bb5('0x21'):if(!_['isNil'](members[_0x25d774[_0x3bb5('0x18')]])){members[_0x25d774[_0x3bb5('0x18')]]['exitAt']=utils['now']();members[_0x25d774[_0x3bb5('0x18')]][_0x3bb5('0x22')]=utils['diffTime'](members[_0x25d774['device']][_0x3bb5('0x23')],members[_0x25d774[_0x3bb5('0x18')]][_0x3bb5('0x24')]);if(members[_0x25d774[_0x3bb5('0x18')]]['uniqueid']){writeDB(members[_0x25d774['device']]);}}break;default:break;}}catch(_0x33e943){utils['error'](util[_0x3bb5('0x6')](_0x3bb5('0x17'),members[_0x25d774[_0x3bb5('0x18')]]?members[_0x25d774['device']]['uniqueid']:_0x25d774[_0x3bb5('0x18')]),_0x33e943);}};exports[_0x3bb5('0x25')]=function(_0x17ada7){try{if(!_[_0x3bb5('0x26')](members[_0x17ada7[_0x3bb5('0xc')]])){utils[_0x3bb5('0x16')](util[_0x3bb5('0x6')]('[%s][members][agentcomplete]',_0x17ada7[_0x3bb5('0x8')]),_0x17ada7);utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x27'),_0x17ada7[_0x3bb5('0x8')],_0x17ada7[_0x3bb5('0xc')],_0x17ada7[_0x3bb5('0x28')]));members[_0x17ada7['interface']]=_[_0x3bb5('0x29')](members[_0x17ada7[_0x3bb5('0xc')]],{'data4':_0x17ada7['queue'],'uniqueid':_0x17ada7[_0x3bb5('0x8')]});}}catch(_0x1fa29d){utils[_0x3bb5('0x14')](util[_0x3bb5('0x6')](_0x3bb5('0x2a'),_0x17ada7['uniqueid']),_0x1fa29d);}};exports[_0x3bb5('0x2b')]=function(_0x1df4c6){try{utils[_0x3bb5('0x16')](util[_0x3bb5('0x6')]('[%s][members][cdr]',_0x1df4c6['uniqueid']),_0x1df4c6);if(_0x1df4c6[_0x3bb5('0x2c')]){var _0xeeb452=_0x1df4c6[_0x3bb5('0x2c')][_0x3bb5('0x11')]('-')[0x0];if(!_[_0x3bb5('0x26')](members[_0xeeb452])){members[_0xeeb452]=_[_0x3bb5('0x29')](members[_0xeeb452],{'data1':members[_0xeeb452][_0x3bb5('0x2d')]||_0x1df4c6[_0x3bb5('0xb')],'data2':members[_0xeeb452][_0x3bb5('0x9')]||_0x1df4c6['source'],'data3':members[_0xeeb452][_0x3bb5('0x2e')]||_0x1df4c6[_0x3bb5('0x2f')],'uniqueid':members[_0xeeb452]['uniqueid']||_0x1df4c6['uniqueid']});utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x30'),_0x1df4c6[_0x3bb5('0x8')],members[_0xeeb452]['data1'],members[_0xeeb452]['data2'],members[_0xeeb452][_0x3bb5('0x2e')]));if(members[_0xeeb452]['exitAt']){writeDB(members[_0xeeb452]);}}}if(_0x1df4c6[_0x3bb5('0x31')]){var _0x5772e4=_0x1df4c6['destinationchannel'][_0x3bb5('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5772e4])){members[_0x5772e4]=_['assign'](members[_0x5772e4],{'data1':members[_0x5772e4][_0x3bb5('0x2d')]||_0x1df4c6[_0x3bb5('0xb')],'data2':members[_0x5772e4][_0x3bb5('0x9')]||_0x1df4c6['source'],'data3':members[_0x5772e4][_0x3bb5('0x2e')]||_0x1df4c6['destination'],'uniqueid':members[_0x5772e4][_0x3bb5('0x8')]||_0x1df4c6['uniqueid']});utils[_0x3bb5('0x5')](util[_0x3bb5('0x6')](_0x3bb5('0x30'),_0x1df4c6[_0x3bb5('0x8')],members[_0x5772e4][_0x3bb5('0x2d')],members[_0x5772e4][_0x3bb5('0x9')],members[_0x5772e4]['data3']));if(members[_0x5772e4][_0x3bb5('0x23')]){writeDB(members[_0x5772e4]);}}}}catch(_0x7c1b7b){utils['error'](util[_0x3bb5('0x6')](_0x3bb5('0x32'),_0x1df4c6[_0x3bb5('0x8')]),_0x7c1b7b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 209ee5e..791dc27 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 _0x046d=['assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','accountcode','destaccountcode','membername','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%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]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','info','position'];(function(_0x433ced,_0x224f23){var _0x248cf7=function(_0x419d02){while(--_0x419d02){_0x433ced['push'](_0x433ced['shift']());}};_0x248cf7(++_0x224f23);}(_0x046d,0x11e));var _0xd046=function(_0x59ecf9,_0x9a29d){_0x59ecf9=_0x59ecf9-0x0;var _0x3c68c1=_0x046d[_0x59ecf9];return _0x3c68c1;};'use strict';var _=require(_0xd046('0x0'));var util=require(_0xd046('0x1'));var utils=require(_0xd046('0x2'));var queues={};function writeDB(_0x37379b){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x37379b[_0xd046('0x3')],_0x37379b[_0xd046('0x4')],_0x37379b[_0xd046('0x5')],_0x37379b[_0xd046('0x6')],_0x37379b[_0xd046('0x7')],_0x37379b['accountcode'],_0x37379b[_0xd046('0x8')]));if(_0x37379b['queue']){utils[_0xd046('0x9')](_0x37379b[_0xd046('0x5')])[_0xd046('0xa')](function(_0x4df0bf){if(_0x4df0bf){_0x37379b[_0xd046('0xb')]=_0x4df0bf['type'];}utils[_0xd046('0xc')](_0xd046('0xd'),_0x37379b);});}else{utils[_0xd046('0xc')](_0xd046('0xd'),_0x37379b);}if(_0x37379b[_0xd046('0xe')]){delete queues[_0x37379b[_0xd046('0xe')]];}else{delete queues[_0x37379b['uniqueid']];}}exports[_0xd046('0xf')]=function(_0x32ec22){try{utils[_0xd046('0x10')](util[_0xd046('0x11')]('[%s][queues][queuecallerjoin]',_0x32ec22[_0xd046('0x3')]),_0x32ec22);utils[_0xd046('0x12')](util[_0xd046('0x11')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x32ec22[_0xd046('0x3')],_0x32ec22['queue'],_0x32ec22[_0xd046('0x13')]));queues[_0x32ec22['uniqueid']]=_[_0xd046('0x14')](_0x32ec22,{'originalposition':_0x32ec22[_0xd046('0x13')],'queuecallerjoinAt':utils[_0xd046('0x15')](),'mohtime':0x0});}catch(_0xd6e4aa){utils[_0xd046('0x16')](util[_0xd046('0x11')]('[%s][queues][queuecallerjoin]',_0x32ec22[_0xd046('0x3')]),_0xd6e4aa);}};exports[_0xd046('0x17')]=function(_0x8522e9){try{if(!_[_0xd046('0x18')](queues[_0x8522e9[_0xd046('0x3')]])){utils[_0xd046('0x10')](util[_0xd046('0x11')](_0xd046('0x19'),_0x8522e9[_0xd046('0x3')]),_0x8522e9);if(queues[_0x8522e9['uniqueid']][_0xd046('0x1a')]){if(!queues[_0x8522e9[_0xd046('0x3')]]['queuecallerabandon']&&!queues[_0x8522e9['uniqueid']][_0xd046('0x1b')]){queues[_0x8522e9[_0xd046('0x3')]][_0xd046('0x1c')]=!![];queues[_0x8522e9[_0xd046('0x3')]][_0xd046('0x1d')]=utils[_0xd046('0x15')]();queues[_0x8522e9['uniqueid']][_0xd046('0x8')]=_0xd046('0x1e');}utils[_0xd046('0x12')](util[_0xd046('0x11')](_0xd046('0x1f'),_0x8522e9[_0xd046('0x3')],queues[_0x8522e9['uniqueid']][_0xd046('0x20')],queues[_0x8522e9['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x8522e9[_0xd046('0x3')]]);}else if(queues[_0x8522e9[_0xd046('0x3')]][_0xd046('0xe')]){utils['info'](util[_0xd046('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x8522e9[_0xd046('0x3')],queues[_0x8522e9[_0xd046('0x3')]][_0xd046('0x20')],queues[_0x8522e9['uniqueid']][_0xd046('0xe')]));queues[queues[_0x8522e9[_0xd046('0x3')]][_0xd046('0xe')]]=queues[_0x8522e9[_0xd046('0x3')]];queues[queues[_0x8522e9[_0xd046('0x3')]][_0xd046('0xe')]][_0xd046('0x21')]=0x2;delete queues[_0x8522e9[_0xd046('0x3')]];}}}catch(_0xba6ce1){utils[_0xd046('0x16')](util[_0xd046('0x11')](_0xd046('0x19'),_0x8522e9['uniqueid']),_0xba6ce1);}};exports['varset']=function(_0x4cccce){try{utils[_0xd046('0x10')](util[_0xd046('0x11')]('[%s][queues][varset]',_0x4cccce[_0xd046('0x3')]),_0x4cccce);if(!_[_0xd046('0x18')](_0x4cccce[_0xd046('0x22')][_0xd046('0x23')])&&_0x4cccce[_0xd046('0x24')][_0xd046('0x25')]()!==_0xd046('0x26')){if(!_[_0xd046('0x18')](queues[_0x4cccce[_0xd046('0x3')]])){queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x27')]=![];queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x28')]=null;queues[_0x4cccce[_0xd046('0x3')]]['queuecallerexit']=!![];queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x29')]=utils['now']();queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x8')]=_0x4cccce[_0xd046('0x24')][_0xd046('0x25')]();utils[_0xd046('0x12')](util[_0xd046('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4cccce[_0xd046('0x3')],queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x20')],_0x4cccce[_0xd046('0x24')],queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x8')]));writeDB(queues[_0x4cccce[_0xd046('0x3')]]);}}else if(!_[_0xd046('0x18')](_0x4cccce['variable'][_0xd046('0x2a')])){if(!_[_0xd046('0x18')](queues[_0x4cccce[_0xd046('0x3')]])&&!queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x27')]){queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x27')]=![];queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x28')]=null;queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x1b')]=!![];queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x29')]=utils[_0xd046('0x15')]();queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x8')]=_0xd046('0x2b');utils[_0xd046('0x12')](util[_0xd046('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4cccce[_0xd046('0x3')],queues[_0x4cccce[_0xd046('0x3')]][_0xd046('0x20')],_0x4cccce['value'],queues[_0x4cccce['uniqueid']]['queuecallerexitreason']));}}}catch(_0x4f8ad0){utils[_0xd046('0x16')](util['format'](_0xd046('0x2c'),_0x4cccce[_0xd046('0x3')]),_0x4f8ad0);}};exports[_0xd046('0x27')]=function(_0x2c27b4){try{if(!_[_0xd046('0x18')](queues[_0x2c27b4[_0xd046('0x3')]])){utils['debug'](util[_0xd046('0x11')](_0xd046('0x2d'),_0x2c27b4[_0xd046('0x3')]),_0x2c27b4);queues[_0x2c27b4['uniqueid']][_0xd046('0x1b')]=![];queues[_0x2c27b4[_0xd046('0x3')]][_0xd046('0x29')]=null;queues[_0x2c27b4[_0xd046('0x3')]][_0xd046('0x27')]=!![];queues[_0x2c27b4['uniqueid']]['queuecallerabandonAt']=utils[_0xd046('0x15')]();queues[_0x2c27b4[_0xd046('0x3')]][_0xd046('0x8')]=_0xd046('0x2e');utils[_0xd046('0x12')](util[_0xd046('0x11')](_0xd046('0x2f'),_0x2c27b4[_0xd046('0x3')],queues[_0x2c27b4[_0xd046('0x3')]]['name'],queues[_0x2c27b4['uniqueid']][_0xd046('0x8')]));}}catch(_0x227ed1){utils[_0xd046('0x16')](util[_0xd046('0x11')](_0xd046('0x2d'),_0x2c27b4['uniqueid']),_0x227ed1);}};exports[_0xd046('0x30')]=function(_0x22a422){try{if(!_[_0xd046('0x18')](queues[_0x22a422['uniqueid']])){utils[_0xd046('0x10')](util[_0xd046('0x11')](_0xd046('0x31'),_0x22a422['uniqueid']),_0x22a422);utils[_0xd046('0x12')](util[_0xd046('0x11')](_0xd046('0x32'),_0x22a422[_0xd046('0x3')],queues[_0x22a422['uniqueid']][_0xd046('0x20')],_0x22a422[_0xd046('0x33')],_0x22a422[_0xd046('0x34')]));queues[_0x22a422['uniqueid']][_0xd046('0x30')]=!![];queues[_0x22a422[_0xd046('0x3')]][_0xd046('0x1a')]=utils[_0xd046('0x15')]();queues[_0x22a422[_0xd046('0x3')]][_0xd046('0x35')]=utils[_0xd046('0x36')](queues[_0x22a422[_0xd046('0x3')]]['queuecallerleaveAt'],queues[_0x22a422[_0xd046('0x3')]][_0xd046('0x37')]);queues[_0x22a422['uniqueid']][_0xd046('0x13')]=_0x22a422[_0xd046('0x13')];queues[_0x22a422[_0xd046('0x3')]][_0xd046('0x38')]=_0x22a422['count'];queues[_0x22a422[_0xd046('0x3')]][_0xd046('0x33')]=_0x22a422[_0xd046('0x33')];queues[_0x22a422[_0xd046('0x3')]][_0xd046('0x34')]=_0x22a422[_0xd046('0x34')];}}catch(_0x25e3ee){utils['error'](util[_0xd046('0x11')]('[%s][queues][queuecallerleave]',_0x22a422[_0xd046('0x3')]),_0x25e3ee);}};exports['agentconnect']=function(_0x28a7c2){try{if(!_[_0xd046('0x18')](queues[_0x28a7c2[_0xd046('0x3')]])){utils['debug'](util[_0xd046('0x11')](_0xd046('0x39'),_0x28a7c2[_0xd046('0x3')]),_0x28a7c2);utils[_0xd046('0x12')](util[_0xd046('0x11')](_0xd046('0x3a'),_0x28a7c2[_0xd046('0x3')],queues[_0x28a7c2['uniqueid']]['name'],_0x28a7c2['membername'],_0x28a7c2['destaccountcode']));queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x27')]=![];queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x27')]=![];queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x28')]=null;queues[_0x28a7c2['uniqueid']][_0xd046('0x1b')]=![];queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x8')]=null;queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x29')]=null;queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x3b')]=!![];queues[_0x28a7c2['uniqueid']][_0xd046('0x3c')]=_0x28a7c2[_0xd046('0x3d')];queues[_0x28a7c2[_0xd046('0x3')]][_0xd046('0x6')]=_0x28a7c2[_0xd046('0x3e')];}}catch(_0x88f341){utils[_0xd046('0x16')](util[_0xd046('0x11')](_0xd046('0x39'),_0x28a7c2[_0xd046('0x3')]),_0x88f341);}};exports['agentcomplete']=function(_0x5e7d3b){try{if(!_[_0xd046('0x18')](queues[_0x5e7d3b['uniqueid']])){if(queues[_0x5e7d3b[_0xd046('0x3')]]['queuecallerleaveAt']){utils[_0xd046('0x10')](util[_0xd046('0x11')](_0xd046('0x3f'),_0x5e7d3b[_0xd046('0x3')]),_0x5e7d3b);queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x27')]=![];queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x27')]=![];queues[_0x5e7d3b['uniqueid']][_0xd046('0x28')]=null;queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x1b')]=![];queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x29')]=null;queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x3b')]=!![];queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x6')]=_0x5e7d3b[_0xd046('0x3e')];queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x1c')]=!![];queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x1d')]=utils[_0xd046('0x15')]();if(_0x5e7d3b['reason']==_0xd046('0x40')){if(!queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x40')]){queues[_0x5e7d3b[_0xd046('0x3')]]['queuecallerexitreason']=_0xd046('0x41');}}else{queues[_0x5e7d3b[_0xd046('0x3')]][_0xd046('0x8')]=_0xd046('0x42')+_0x5e7d3b['reason']['toUpperCase']();}utils['info'](util[_0xd046('0x11')](_0xd046('0x43'),_0x5e7d3b[_0xd046('0x3')],queues[_0x5e7d3b[_0xd046('0x3')]]['name'],_0x5e7d3b['membername'],queues[_0x5e7d3b['uniqueid']][_0xd046('0x8')]));writeDB(queues[_0x5e7d3b['uniqueid']]);}}}catch(_0xefc722){utils[_0xd046('0x16')](util[_0xd046('0x11')](_0xd046('0x3f'),_0x5e7d3b[_0xd046('0x3')]),_0xefc722);}};exports[_0xd046('0x44')]=function(_0x322e39){try{if(!_[_0xd046('0x18')](queues[_0x322e39[_0xd046('0x45')]])){utils['debug'](util[_0xd046('0x11')](_0xd046('0x46'),_0x322e39[_0xd046('0x3')]),_0x322e39);queues[_0x322e39[_0xd046('0x45')]]['transfer']=!![];queues[_0x322e39['transfereeuniqueid']][_0xd046('0x47')]='BLIND';queues[_0x322e39[_0xd046('0x45')]][_0xd046('0x48')]=_0x322e39[_0xd046('0x49')];queues[_0x322e39[_0xd046('0x45')]][_0xd046('0x4a')]=_0x322e39[_0xd046('0x45')];queues[_0x322e39[_0xd046('0x45')]][_0xd046('0x8')]=_0xd046('0x4b');utils['info'](util['format'](_0xd046('0x4c'),_0x322e39[_0xd046('0x3')],queues[_0x322e39[_0xd046('0x45')]][_0xd046('0x20')],_0x322e39['transfereeuniqueid'],_0x322e39['extension']));}}catch(_0x2d65dd){utils[_0xd046('0x16')](util[_0xd046('0x11')]('[%s][queues][blindtransfer]',_0x322e39[_0xd046('0x3')]),_0x2d65dd);}};exports[_0xd046('0x4d')]=function(_0x55dca4){try{utils[_0xd046('0x10')](util[_0xd046('0x11')]('[%s][queues][attendedtransfer]',_0x55dca4[_0xd046('0x4e')]),_0x55dca4);if(_0x55dca4[_0xd046('0x4e')]==_0x55dca4[_0xd046('0x4f')]){if(!_[_0xd046('0x18')](queues[_0x55dca4[_0xd046('0x50')]])){utils['info'](util[_0xd046('0x11')](_0xd046('0x51'),_0x55dca4[_0xd046('0x4e')],queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x20')],_0x55dca4['origtransfererexten']));queues[_0x55dca4[_0xd046('0x50')]]['transfer']=!![];queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x47')]=_0xd046('0x52');queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x48')]=_0x55dca4[_0xd046('0x53')];queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x4a')]=_0x55dca4[_0xd046('0x4e')];queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xd046('0x18')](queues[_0x55dca4[_0xd046('0x4f')]])){if(_0x55dca4[_0xd046('0x54')]&&queues[_0x55dca4[_0xd046('0x54')]]){queues[_0x55dca4['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x55dca4[_0xd046('0x45')]]=_[_0xd046('0x55')](queues[_0x55dca4[_0xd046('0x54')]]);queues[_0x55dca4[_0xd046('0x45')]][_0xd046('0xe')]=_0x55dca4[_0xd046('0x56')];queues[_0x55dca4['transfereeuniqueid']][_0xd046('0x21')]=0x2;queues[_0x55dca4[_0xd046('0x45')]][_0xd046('0x7')]=queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x7')];queues[_0x55dca4['transfereeuniqueid']][_0xd046('0x57')]=queues[_0x55dca4[_0xd046('0x50')]][_0xd046('0x57')];queues[_0x55dca4[_0xd046('0x45')]][_0xd046('0x37')]=utils['now']();queues[_0x55dca4['transfereeuniqueid']][_0xd046('0x1a')]=utils[_0xd046('0x15')]();queues[_0x55dca4[_0xd046('0x45')]][_0xd046('0x35')]=0x0;queues[_0x55dca4['transfereeuniqueid']]['mohtime']=0x0;utils[_0xd046('0x12')](util[_0xd046('0x11')](_0xd046('0x58'),_0x55dca4[_0xd046('0x4e')],queues[_0x55dca4[_0xd046('0x45')]][_0xd046('0x20')],queues[_0x55dca4['transfereeuniqueid']][_0xd046('0x7')],queues[_0x55dca4[_0xd046('0x45')]][_0xd046('0x57')]));}else{utils[_0xd046('0x12')](util[_0xd046('0x11')](_0xd046('0x59'),_0x55dca4[_0xd046('0x4e')],queues[_0x55dca4[_0xd046('0x4f')]][_0xd046('0x20')],_0x55dca4[_0xd046('0x50')]));queues[_0x55dca4['origtransfererlinkedid']]['transfereduniqueid']=_0x55dca4['secondtransfererlinkedid'];}}}else if(_0x55dca4[_0xd046('0x5a')]==_0x55dca4[_0xd046('0x50')]){if(!_[_0xd046('0x18')](queues[_0x55dca4[_0xd046('0x4f')]])){utils[_0xd046('0x12')](util[_0xd046('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x55dca4['origtransfereruniqueid'],queues[_0x55dca4[_0xd046('0x4f')]][_0xd046('0x20')],_0x55dca4[_0xd046('0x5a')],_0x55dca4[_0xd046('0x5b')]));queues[_0x55dca4[_0xd046('0x4f')]][_0xd046('0x40')]=!![];queues[_0x55dca4[_0xd046('0x4f')]][_0xd046('0x47')]=_0xd046('0x52');queues[_0x55dca4['origtransfererlinkedid']]['transferexten']=_0x55dca4[_0xd046('0x5b')];queues[_0x55dca4['origtransfererlinkedid']]['transferuniqueid']=_0x55dca4['secondtransfereruniqueid'];queues[_0x55dca4[_0xd046('0x4f')]][_0xd046('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xd046('0x18')](queues[_0x55dca4['secondtransfererlinkedid']])){if(_0x55dca4['transfertargetlinkedid']&&queues[_0x55dca4[_0xd046('0x5c')]]){queues[_0x55dca4[_0xd046('0x5c')]][_0xd046('0x21')]=0x1;queues[_0x55dca4[_0xd046('0x56')]]=_[_0xd046('0x55')](queues[_0x55dca4[_0xd046('0x5c')]]);queues[_0x55dca4[_0xd046('0x56')]][_0xd046('0xe')]=_0x55dca4[_0xd046('0x56')];queues[_0x55dca4[_0xd046('0x56')]]['queuecallerenterreason']=0x2;queues[_0x55dca4[_0xd046('0x56')]][_0xd046('0x7')]=queues[_0x55dca4[_0xd046('0x4f')]][_0xd046('0x7')];queues[_0x55dca4[_0xd046('0x56')]]['calleridname']=queues[_0x55dca4['origtransfererlinkedid']][_0xd046('0x57')];queues[_0x55dca4[_0xd046('0x56')]][_0xd046('0x37')]=utils['now']();queues[_0x55dca4[_0xd046('0x56')]][_0xd046('0x1a')]=utils[_0xd046('0x15')]();queues[_0x55dca4['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x55dca4[_0xd046('0x56')]]['mohtime']=0x0;utils['info'](util[_0xd046('0x11')](_0xd046('0x5d'),_0x55dca4[_0xd046('0x4e')],queues[_0x55dca4[_0xd046('0x56')]]['name'],queues[_0x55dca4[_0xd046('0x56')]][_0xd046('0xe')],queues[_0x55dca4[_0xd046('0x56')]]['calleridnum'],queues[_0x55dca4[_0xd046('0x56')]]['calleridname']));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x55dca4['origtransfereruniqueid'],queues[_0x55dca4[_0xd046('0x50')]]['name'],_0x55dca4[_0xd046('0x4f')]));queues[_0x55dca4['secondtransfererlinkedid']][_0xd046('0xe')]=_0x55dca4[_0xd046('0x4f')];}}}}catch(_0x1969e9){utils['error'](util[_0xd046('0x11')]('[%s][queues][attendedtransfer]',_0x55dca4['origtransfereruniqueid']),_0x1969e9);}};exports[_0xd046('0x5e')]=function(_0x2c91c5){try{if(!_['isNil'](queues[_0x2c91c5['uniqueid']])){utils[_0xd046('0x10')](util[_0xd046('0x11')](_0xd046('0x5f'),_0x2c91c5['uniqueid']),_0x2c91c5);queues[_0x2c91c5['uniqueid']][_0xd046('0x60')]=utils['now']();utils['info'](util[_0xd046('0x11')](_0xd046('0x61'),_0x2c91c5[_0xd046('0x3')],queues[_0x2c91c5[_0xd046('0x3')]]['name'],queues[_0x2c91c5[_0xd046('0x3')]][_0xd046('0x60')]));}}catch(_0x3aac6f){utils[_0xd046('0x16')](util[_0xd046('0x11')](_0xd046('0x5f'),_0x2c91c5['uniqueid']),_0x3aac6f);}};exports[_0xd046('0x62')]=function(_0x4eb018){try{if(!_[_0xd046('0x18')](queues[_0x4eb018[_0xd046('0x3')]])){if(!_[_0xd046('0x18')](queues[_0x4eb018[_0xd046('0x3')]][_0xd046('0x60')])){utils[_0xd046('0x10')](util['format'](_0xd046('0x63'),_0x4eb018['uniqueid']),_0x4eb018);queues[_0x4eb018[_0xd046('0x3')]][_0xd046('0x64')]+=utils[_0xd046('0x36')](utils[_0xd046('0x15')](),queues[_0x4eb018[_0xd046('0x3')]]['musiconholdstartAt']);utils['info'](util[_0xd046('0x11')](_0xd046('0x65'),_0x4eb018[_0xd046('0x3')],queues[_0x4eb018[_0xd046('0x3')]][_0xd046('0x20')],queues[_0x4eb018[_0xd046('0x3')]][_0xd046('0x64')]));delete queues[_0x4eb018['uniqueid']]['musiconholdstartAt'];}}}catch(_0x51eff5){utils[_0xd046('0x16')](util[_0xd046('0x11')]('[%s][queues][musiconholdstop]',_0x4eb018['uniqueid']),_0x51eff5);}}; \ No newline at end of file +var _0xa8fe=['queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','origtransfererlinkedid','secondtransfereruniqueid','origtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','info','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x3cffda,_0x49abcc){var _0x117924=function(_0x4f2d57){while(--_0x4f2d57){_0x3cffda['push'](_0x3cffda['shift']());}};_0x117924(++_0x49abcc);}(_0xa8fe,0x9f));var _0xea8f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa8fe[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xea8f('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x4fb916){utils['info'](util['format'](_0xea8f('0x1'),_0x4fb916[_0xea8f('0x2')],_0x4fb916[_0xea8f('0x3')],_0x4fb916[_0xea8f('0x4')],_0x4fb916[_0xea8f('0x5')],_0x4fb916['calleridnum'],_0x4fb916[_0xea8f('0x6')],_0x4fb916[_0xea8f('0x7')]));if(_0x4fb916[_0xea8f('0x4')]){utils[_0xea8f('0x8')](_0x4fb916[_0xea8f('0x4')])['then'](function(_0x2b13ef){if(_0x2b13ef){_0x4fb916['type']=_0x2b13ef[_0xea8f('0x9')];}utils[_0xea8f('0xa')](_0xea8f('0xb'),_0x4fb916);});}else{utils[_0xea8f('0xa')](_0xea8f('0xb'),_0x4fb916);}if(_0x4fb916['transfereduniqueid']){delete queues[_0x4fb916[_0xea8f('0xc')]];}else{delete queues[_0x4fb916[_0xea8f('0x2')]];}}exports[_0xea8f('0xd')]=function(_0x4c8df2){try{utils['debug'](util[_0xea8f('0xe')](_0xea8f('0xf'),_0x4c8df2[_0xea8f('0x2')]),_0x4c8df2);utils[_0xea8f('0x10')](util[_0xea8f('0xe')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x4c8df2[_0xea8f('0x2')],_0x4c8df2['queue'],_0x4c8df2[_0xea8f('0x11')]));queues[_0x4c8df2[_0xea8f('0x2')]]=_[_0xea8f('0x12')](_0x4c8df2,{'originalposition':_0x4c8df2[_0xea8f('0x11')],'queuecallerjoinAt':utils[_0xea8f('0x13')](),'mohtime':0x0});}catch(_0x2a7af7){utils[_0xea8f('0x14')](util[_0xea8f('0xe')]('[%s][queues][queuecallerjoin]',_0x4c8df2[_0xea8f('0x2')]),_0x2a7af7);}};exports[_0xea8f('0x15')]=function(_0x5759ed){try{if(!_[_0xea8f('0x16')](queues[_0x5759ed['uniqueid']])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')](_0xea8f('0x18'),_0x5759ed[_0xea8f('0x2')]),_0x5759ed);if(queues[_0x5759ed['uniqueid']][_0xea8f('0x19')]){if(!queues[_0x5759ed[_0xea8f('0x2')]]['queuecallerabandon']&&!queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0x1a')]){queues[_0x5759ed['uniqueid']][_0xea8f('0x1b')]=!![];queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0x1c')]=utils['now']();queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0x7')]=_0xea8f('0x1d');}utils[_0xea8f('0x10')](util[_0xea8f('0xe')](_0xea8f('0x1e'),_0x5759ed[_0xea8f('0x2')],queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0x1f')],queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0x7')]));writeDB(queues[_0x5759ed[_0xea8f('0x2')]]);}else if(queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0xc')]){utils['info'](util[_0xea8f('0xe')](_0xea8f('0x20'),_0x5759ed[_0xea8f('0x2')],queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0x1f')],queues[_0x5759ed[_0xea8f('0x2')]][_0xea8f('0xc')]));queues[queues[_0x5759ed[_0xea8f('0x2')]]['transfereduniqueid']]=queues[_0x5759ed['uniqueid']];queues[queues[_0x5759ed['uniqueid']][_0xea8f('0xc')]][_0xea8f('0x21')]=0x2;delete queues[_0x5759ed[_0xea8f('0x2')]];}}}catch(_0x1cd5f7){utils[_0xea8f('0x14')](util[_0xea8f('0xe')](_0xea8f('0x18'),_0x5759ed['uniqueid']),_0x1cd5f7);}};exports[_0xea8f('0x22')]=function(_0x17df62){try{utils[_0xea8f('0x17')](util['format'](_0xea8f('0x23'),_0x17df62[_0xea8f('0x2')]),_0x17df62);if(!_['isNil'](_0x17df62[_0xea8f('0x24')][_0xea8f('0x25')])&&_0x17df62[_0xea8f('0x26')][_0xea8f('0x27')]()!=='CONTINUE'){if(!_[_0xea8f('0x16')](queues[_0x17df62[_0xea8f('0x2')]])){queues[_0x17df62['uniqueid']]['queuecallerabandon']=![];queues[_0x17df62['uniqueid']][_0xea8f('0x28')]=null;queues[_0x17df62[_0xea8f('0x2')]][_0xea8f('0x1a')]=!![];queues[_0x17df62['uniqueid']][_0xea8f('0x29')]=utils[_0xea8f('0x13')]();queues[_0x17df62[_0xea8f('0x2')]][_0xea8f('0x7')]=_0x17df62[_0xea8f('0x26')][_0xea8f('0x27')]();utils[_0xea8f('0x10')](util['format'](_0xea8f('0x2a'),_0x17df62[_0xea8f('0x2')],queues[_0x17df62[_0xea8f('0x2')]][_0xea8f('0x1f')],_0x17df62['value'],queues[_0x17df62[_0xea8f('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x17df62[_0xea8f('0x2')]]);}}else if(!_[_0xea8f('0x16')](_0x17df62[_0xea8f('0x24')]['queueposition'])){if(!_[_0xea8f('0x16')](queues[_0x17df62[_0xea8f('0x2')]])&&!queues[_0x17df62[_0xea8f('0x2')]][_0xea8f('0x2b')]){queues[_0x17df62[_0xea8f('0x2')]][_0xea8f('0x2b')]=![];queues[_0x17df62[_0xea8f('0x2')]]['queuecallerabandonAt']=null;queues[_0x17df62['uniqueid']][_0xea8f('0x1a')]=!![];queues[_0x17df62['uniqueid']][_0xea8f('0x29')]=utils[_0xea8f('0x13')]();queues[_0x17df62[_0xea8f('0x2')]][_0xea8f('0x7')]=_0xea8f('0x2c');utils['info'](util[_0xea8f('0xe')](_0xea8f('0x2d'),_0x17df62[_0xea8f('0x2')],queues[_0x17df62['uniqueid']][_0xea8f('0x1f')],_0x17df62[_0xea8f('0x26')],queues[_0x17df62[_0xea8f('0x2')]]['queuecallerexitreason']));}}}catch(_0x45a5dc){utils[_0xea8f('0x14')](util[_0xea8f('0xe')](_0xea8f('0x23'),_0x17df62[_0xea8f('0x2')]),_0x45a5dc);}};exports['queuecallerabandon']=function(_0x39bbd6){try{if(!_['isNil'](queues[_0x39bbd6[_0xea8f('0x2')]])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')]('[%s][queues][queuecallerabandon]',_0x39bbd6[_0xea8f('0x2')]),_0x39bbd6);queues[_0x39bbd6['uniqueid']][_0xea8f('0x1a')]=![];queues[_0x39bbd6['uniqueid']]['queuecallerexitAt']=null;queues[_0x39bbd6['uniqueid']][_0xea8f('0x2b')]=!![];queues[_0x39bbd6[_0xea8f('0x2')]][_0xea8f('0x28')]=utils['now']();queues[_0x39bbd6['uniqueid']]['queuecallerexitreason']='ABANDONED';utils[_0xea8f('0x10')](util[_0xea8f('0xe')](_0xea8f('0x2e'),_0x39bbd6[_0xea8f('0x2')],queues[_0x39bbd6[_0xea8f('0x2')]]['name'],queues[_0x39bbd6[_0xea8f('0x2')]][_0xea8f('0x7')]));}}catch(_0x2e09dc){utils[_0xea8f('0x14')](util[_0xea8f('0xe')]('[%s][queues][queuecallerabandon]',_0x39bbd6[_0xea8f('0x2')]),_0x2e09dc);}};exports[_0xea8f('0x2f')]=function(_0x508a33){try{if(!_[_0xea8f('0x16')](queues[_0x508a33[_0xea8f('0x2')]])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')](_0xea8f('0x30'),_0x508a33['uniqueid']),_0x508a33);utils[_0xea8f('0x10')](util[_0xea8f('0xe')](_0xea8f('0x31'),_0x508a33['uniqueid'],queues[_0x508a33['uniqueid']][_0xea8f('0x1f')],_0x508a33['connectedlinenum'],_0x508a33['connectedlinename']));queues[_0x508a33[_0xea8f('0x2')]]['queuecallerleave']=!![];queues[_0x508a33['uniqueid']][_0xea8f('0x19')]=utils[_0xea8f('0x13')]();queues[_0x508a33[_0xea8f('0x2')]]['holdtime']=utils[_0xea8f('0x32')](queues[_0x508a33['uniqueid']]['queuecallerleaveAt'],queues[_0x508a33[_0xea8f('0x2')]][_0xea8f('0x33')]);queues[_0x508a33[_0xea8f('0x2')]]['position']=_0x508a33[_0xea8f('0x11')];queues[_0x508a33[_0xea8f('0x2')]]['count']=_0x508a33[_0xea8f('0x34')];queues[_0x508a33[_0xea8f('0x2')]][_0xea8f('0x35')]=_0x508a33[_0xea8f('0x35')];queues[_0x508a33[_0xea8f('0x2')]][_0xea8f('0x36')]=_0x508a33['connectedlinename'];}}catch(_0x190849){utils[_0xea8f('0x14')](util[_0xea8f('0xe')](_0xea8f('0x30'),_0x508a33[_0xea8f('0x2')]),_0x190849);}};exports[_0xea8f('0x37')]=function(_0xd4cd91){try{if(!_[_0xea8f('0x16')](queues[_0xd4cd91[_0xea8f('0x2')]])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')](_0xea8f('0x38'),_0xd4cd91[_0xea8f('0x2')]),_0xd4cd91);utils[_0xea8f('0x10')](util[_0xea8f('0xe')](_0xea8f('0x39'),_0xd4cd91[_0xea8f('0x2')],queues[_0xd4cd91['uniqueid']]['name'],_0xd4cd91[_0xea8f('0x3a')],_0xd4cd91['destaccountcode']));queues[_0xd4cd91[_0xea8f('0x2')]]['queuecallerabandon']=![];queues[_0xd4cd91[_0xea8f('0x2')]][_0xea8f('0x2b')]=![];queues[_0xd4cd91[_0xea8f('0x2')]][_0xea8f('0x28')]=null;queues[_0xd4cd91[_0xea8f('0x2')]][_0xea8f('0x1a')]=![];queues[_0xd4cd91['uniqueid']][_0xea8f('0x7')]=null;queues[_0xd4cd91[_0xea8f('0x2')]][_0xea8f('0x29')]=null;queues[_0xd4cd91['uniqueid']][_0xea8f('0x3b')]=!![];queues[_0xd4cd91[_0xea8f('0x2')]][_0xea8f('0x6')]=_0xd4cd91[_0xea8f('0x3c')];queues[_0xd4cd91['uniqueid']][_0xea8f('0x5')]=_0xd4cd91[_0xea8f('0x3a')];}}catch(_0x334991){utils[_0xea8f('0x14')](util[_0xea8f('0xe')](_0xea8f('0x38'),_0xd4cd91[_0xea8f('0x2')]),_0x334991);}};exports[_0xea8f('0x3d')]=function(_0x3f2d0a){try{if(!_[_0xea8f('0x16')](queues[_0x3f2d0a[_0xea8f('0x2')]])){if(queues[_0x3f2d0a[_0xea8f('0x2')]]['queuecallerleaveAt']){utils['debug'](util[_0xea8f('0xe')](_0xea8f('0x3e'),_0x3f2d0a[_0xea8f('0x2')]),_0x3f2d0a);queues[_0x3f2d0a[_0xea8f('0x2')]]['queuecallerabandon']=![];queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x2b')]=![];queues[_0x3f2d0a[_0xea8f('0x2')]]['queuecallerabandonAt']=null;queues[_0x3f2d0a[_0xea8f('0x2')]]['queuecallerexit']=![];queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x29')]=null;queues[_0x3f2d0a[_0xea8f('0x2')]]['assigned']=!![];queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x5')]=_0x3f2d0a[_0xea8f('0x3a')];queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x1b')]=!![];queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x1c')]=utils['now']();if(_0x3f2d0a[_0xea8f('0x3f')]==_0xea8f('0x40')){if(!queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x40')]){queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x7')]='TRANSFER';}}else{queues[_0x3f2d0a[_0xea8f('0x2')]]['queuecallerexitreason']=_0xea8f('0x41')+_0x3f2d0a[_0xea8f('0x3f')][_0xea8f('0x27')]();}utils['info'](util[_0xea8f('0xe')](_0xea8f('0x42'),_0x3f2d0a['uniqueid'],queues[_0x3f2d0a[_0xea8f('0x2')]]['name'],_0x3f2d0a[_0xea8f('0x3a')],queues[_0x3f2d0a[_0xea8f('0x2')]][_0xea8f('0x7')]));writeDB(queues[_0x3f2d0a[_0xea8f('0x2')]]);}}}catch(_0x48d22d){utils[_0xea8f('0x14')](util[_0xea8f('0xe')](_0xea8f('0x3e'),_0x3f2d0a[_0xea8f('0x2')]),_0x48d22d);}};exports[_0xea8f('0x43')]=function(_0x389bbf){try{if(!_[_0xea8f('0x16')](queues[_0x389bbf[_0xea8f('0x44')]])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')](_0xea8f('0x45'),_0x389bbf[_0xea8f('0x2')]),_0x389bbf);queues[_0x389bbf[_0xea8f('0x44')]][_0xea8f('0x40')]=!![];queues[_0x389bbf[_0xea8f('0x44')]][_0xea8f('0x46')]=_0xea8f('0x47');queues[_0x389bbf[_0xea8f('0x44')]]['transferexten']=_0x389bbf[_0xea8f('0x48')];queues[_0x389bbf[_0xea8f('0x44')]][_0xea8f('0x49')]=_0x389bbf[_0xea8f('0x44')];queues[_0x389bbf[_0xea8f('0x44')]]['queuecallerexitreason']=_0xea8f('0x4a');utils['info'](util['format'](_0xea8f('0x4b'),_0x389bbf[_0xea8f('0x2')],queues[_0x389bbf[_0xea8f('0x44')]][_0xea8f('0x1f')],_0x389bbf['transfereeuniqueid'],_0x389bbf[_0xea8f('0x48')]));}}catch(_0xa405c0){utils['error'](util[_0xea8f('0xe')](_0xea8f('0x45'),_0x389bbf[_0xea8f('0x2')]),_0xa405c0);}};exports[_0xea8f('0x4c')]=function(_0x422e5b){try{utils[_0xea8f('0x17')](util[_0xea8f('0xe')](_0xea8f('0x4d'),_0x422e5b['origtransfereruniqueid']),_0x422e5b);if(_0x422e5b['origtransfereruniqueid']==_0x422e5b['origtransfererlinkedid']){if(!_['isNil'](queues[_0x422e5b[_0xea8f('0x4e')]])){utils[_0xea8f('0x10')](util[_0xea8f('0xe')](_0xea8f('0x4f'),_0x422e5b['origtransfereruniqueid'],queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x1f')],_0x422e5b[_0xea8f('0x50')]));queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x40')]=!![];queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x46')]=_0xea8f('0x51');queues[_0x422e5b['secondtransfererlinkedid']][_0xea8f('0x52')]=_0x422e5b['origtransfererexten'];queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x49')]=_0x422e5b['origtransfereruniqueid'];queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x7')]=_0xea8f('0x53');}if(!_[_0xea8f('0x16')](queues[_0x422e5b['origtransfererlinkedid']])){if(_0x422e5b['transfereelinkedid']&&queues[_0x422e5b[_0xea8f('0x54')]]){queues[_0x422e5b[_0xea8f('0x54')]][_0xea8f('0x21')]=0x1;queues[_0x422e5b['transfereeuniqueid']]=_['clone'](queues[_0x422e5b['transfereelinkedid']]);queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0xc')]=_0x422e5b[_0xea8f('0x55')];queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0x21')]=0x2;queues[_0x422e5b[_0xea8f('0x44')]]['calleridnum']=queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x56')];queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0x57')]=queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x57')];queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0x33')]=utils[_0xea8f('0x13')]();queues[_0x422e5b['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xea8f('0x13')]();queues[_0x422e5b[_0xea8f('0x44')]]['holdtime']=0x0;queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0x58')]=0x0;utils[_0xea8f('0x10')](util[_0xea8f('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x422e5b['origtransfereruniqueid'],queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0x1f')],queues[_0x422e5b[_0xea8f('0x44')]][_0xea8f('0x56')],queues[_0x422e5b['transfereeuniqueid']][_0xea8f('0x57')]));}else{utils[_0xea8f('0x10')](util[_0xea8f('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x422e5b['origtransfereruniqueid'],queues[_0x422e5b[_0xea8f('0x59')]][_0xea8f('0x1f')],_0x422e5b[_0xea8f('0x4e')]));queues[_0x422e5b[_0xea8f('0x59')]]['transfereduniqueid']=_0x422e5b[_0xea8f('0x4e')];}}}else if(_0x422e5b[_0xea8f('0x5a')]==_0x422e5b[_0xea8f('0x4e')]){if(!_[_0xea8f('0x16')](queues[_0x422e5b['origtransfererlinkedid']])){utils[_0xea8f('0x10')](util[_0xea8f('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x422e5b[_0xea8f('0x5b')],queues[_0x422e5b[_0xea8f('0x59')]][_0xea8f('0x1f')],_0x422e5b[_0xea8f('0x5a')],_0x422e5b[_0xea8f('0x5c')]));queues[_0x422e5b['origtransfererlinkedid']][_0xea8f('0x40')]=!![];queues[_0x422e5b[_0xea8f('0x59')]][_0xea8f('0x46')]=_0xea8f('0x51');queues[_0x422e5b[_0xea8f('0x59')]][_0xea8f('0x52')]=_0x422e5b[_0xea8f('0x5c')];queues[_0x422e5b[_0xea8f('0x59')]][_0xea8f('0x49')]=_0x422e5b['secondtransfereruniqueid'];queues[_0x422e5b[_0xea8f('0x59')]][_0xea8f('0x7')]='ATTENDEDTRANSFER';}if(!_[_0xea8f('0x16')](queues[_0x422e5b[_0xea8f('0x4e')]])){if(_0x422e5b[_0xea8f('0x5d')]&&queues[_0x422e5b['transfertargetlinkedid']]){queues[_0x422e5b['transfertargetlinkedid']][_0xea8f('0x21')]=0x1;queues[_0x422e5b[_0xea8f('0x55')]]=_[_0xea8f('0x5e')](queues[_0x422e5b[_0xea8f('0x5d')]]);queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0xc')]=_0x422e5b[_0xea8f('0x55')];queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x21')]=0x2;queues[_0x422e5b['transfertargetuniqueid']][_0xea8f('0x56')]=queues[_0x422e5b['origtransfererlinkedid']][_0xea8f('0x56')];queues[_0x422e5b['transfertargetuniqueid']]['calleridname']=queues[_0x422e5b[_0xea8f('0x59')]]['calleridname'];queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x33')]=utils[_0xea8f('0x13')]();queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x19')]=utils['now']();queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x5f')]=0x0;queues[_0x422e5b[_0xea8f('0x55')]]['mohtime']=0x0;utils[_0xea8f('0x10')](util[_0xea8f('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x422e5b[_0xea8f('0x5b')],queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x1f')],queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0xc')],queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x56')],queues[_0x422e5b[_0xea8f('0x55')]][_0xea8f('0x57')]));}else{utils[_0xea8f('0x10')](util[_0xea8f('0xe')](_0xea8f('0x60'),_0x422e5b[_0xea8f('0x5b')],queues[_0x422e5b[_0xea8f('0x4e')]][_0xea8f('0x1f')],_0x422e5b[_0xea8f('0x59')]));queues[_0x422e5b['secondtransfererlinkedid']][_0xea8f('0xc')]=_0x422e5b[_0xea8f('0x59')];}}}}catch(_0x4345e3){utils['error'](util[_0xea8f('0xe')](_0xea8f('0x4d'),_0x422e5b[_0xea8f('0x5b')]),_0x4345e3);}};exports['musiconholdstart']=function(_0x45b10e){try{if(!_['isNil'](queues[_0x45b10e[_0xea8f('0x2')]])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')](_0xea8f('0x61'),_0x45b10e[_0xea8f('0x2')]),_0x45b10e);queues[_0x45b10e[_0xea8f('0x2')]]['musiconholdstartAt']=utils[_0xea8f('0x13')]();utils[_0xea8f('0x10')](util['format'](_0xea8f('0x62'),_0x45b10e['uniqueid'],queues[_0x45b10e['uniqueid']][_0xea8f('0x1f')],queues[_0x45b10e[_0xea8f('0x2')]][_0xea8f('0x63')]));}}catch(_0x43e151){utils['error'](util['format'](_0xea8f('0x61'),_0x45b10e[_0xea8f('0x2')]),_0x43e151);}};exports[_0xea8f('0x64')]=function(_0x1c0412){try{if(!_[_0xea8f('0x16')](queues[_0x1c0412['uniqueid']])){if(!_[_0xea8f('0x16')](queues[_0x1c0412[_0xea8f('0x2')]][_0xea8f('0x63')])){utils[_0xea8f('0x17')](util[_0xea8f('0xe')]('[%s][queues][musiconholdstop]',_0x1c0412[_0xea8f('0x2')]),_0x1c0412);queues[_0x1c0412[_0xea8f('0x2')]][_0xea8f('0x58')]+=utils[_0xea8f('0x32')](utils['now'](),queues[_0x1c0412[_0xea8f('0x2')]][_0xea8f('0x63')]);utils[_0xea8f('0x10')](util['format'](_0xea8f('0x65'),_0x1c0412[_0xea8f('0x2')],queues[_0x1c0412['uniqueid']][_0xea8f('0x1f')],queues[_0x1c0412[_0xea8f('0x2')]]['mohtime']));delete queues[_0x1c0412[_0xea8f('0x2')]][_0xea8f('0x63')];}}}catch(_0x27f5de){utils[_0xea8f('0x14')](util[_0xea8f('0xe')](_0xea8f('0x66'),_0x1c0412[_0xea8f('0x2')]),_0x27f5de);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7413a90..e337250 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 _0xc599=['.wav49','replace','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value'];(function(_0x13c595,_0x2c2465){var _0x179028=function(_0x53a403){while(--_0x53a403){_0x13c595['push'](_0x13c595['shift']());}};_0x179028(++_0x2c2465);}(_0xc599,0x10e));var _0x9c59=function(_0x448a56,_0x3cd4d1){_0x448a56=_0x448a56-0x0;var _0x1ba466=_0xc599[_0x448a56];return _0x1ba466;};'use strict';var _=require('lodash');var util=require(_0x9c59('0x0'));var utils=require(_0x9c59('0x1'));var recordings={};function writeDB(_0x58eba0){utils[_0x9c59('0x2')](util[_0x9c59('0x3')](_0x9c59('0x4'),_0x58eba0[_0x9c59('0x5')]));if(_0x58eba0[_0x9c59('0x6')]){utils[_0x9c59('0x7')](_0x58eba0[_0x9c59('0x6')])[_0x9c59('0x8')](function(_0x1a0e0d){if(_0x1a0e0d){_0x58eba0[_0x9c59('0x9')]=_0x1a0e0d[_0x9c59('0xa')];_0x58eba0[_0x9c59('0xb')]=_0x1a0e0d['id'];}utils['request'](_0x9c59('0xc'),_0x58eba0);});}else{utils[_0x9c59('0xd')](_0x9c59('0xc'),_0x58eba0);}}exports[_0x9c59('0xe')]=function(_0x22c05e){try{utils[_0x9c59('0xf')](util[_0x9c59('0x3')](_0x9c59('0x10'),_0x22c05e[_0x9c59('0x5')]),_0x22c05e);if(_0x22c05e[_0x9c59('0x5')]==_0x22c05e[_0x9c59('0x11')]){utils[_0x9c59('0x2')](util['format'](_0x9c59('0x12'),_0x22c05e[_0x9c59('0x5')],_0x22c05e[_0x9c59('0x13')],_0x22c05e[_0x9c59('0x14')]));recordings[_0x22c05e['uniqueid']]={'uniqueid':_0x22c05e[_0x9c59('0x5')],'accountcode':_0x22c05e['accountcode'],'exten':_0x22c05e[_0x9c59('0x14')],'context':_0x22c05e['context'],'channel':_0x22c05e[_0x9c59('0x15')],'monitors':[]};}}catch(_0x587b9e){utils[_0x9c59('0x16')](util[_0x9c59('0x3')]('[%s][recordings][newchannel]',_0x22c05e[_0x9c59('0x5')]),_0x587b9e);}};exports[_0x9c59('0x17')]=function(_0x49b36b){try{utils[_0x9c59('0xf')](util['format'](_0x9c59('0x18'),_0x49b36b['uniqueid']),_0x49b36b);if(!_[_0x9c59('0x19')](recordings[_0x49b36b[_0x9c59('0x5')]])&&_0x49b36b[_0x9c59('0x1a')]==0x6){utils[_0x9c59('0x2')](util[_0x9c59('0x3')](_0x9c59('0x1b'),_0x49b36b[_0x9c59('0x5')],_0x49b36b[_0x9c59('0x13')],_0x49b36b[_0x9c59('0x15')]));}else if(!_[_0x9c59('0x19')](recordings[_0x49b36b['linkedid']])&&_0x49b36b[_0x9c59('0x1a')]==0x6&&_0x49b36b['context']!=_0x9c59('0x1c')){utils[_0x9c59('0x2')](util[_0x9c59('0x3')](_0x9c59('0x1d'),_0x49b36b[_0x9c59('0x5')],_0x49b36b['linkedid'],_0x49b36b['context'],_0x49b36b['channel']));recordings[_0x49b36b[_0x9c59('0x11')]][_0x9c59('0x6')]=_0x49b36b[_0x9c59('0x6')];}}catch(_0x40365d){utils[_0x9c59('0x16')](util['format'](_0x9c59('0x18'),_0x49b36b[_0x9c59('0x5')]),_0x40365d);}};exports[_0x9c59('0x1e')]=function(_0x42f75d){try{if(!_[_0x9c59('0x19')](_0x42f75d[_0x9c59('0x1f')])&&!_[_0x9c59('0x19')](_0x42f75d[_0x9c59('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0x9c59('0x3')](_0x9c59('0x20'),_0x42f75d[_0x9c59('0x5')]),_0x42f75d);utils[_0x9c59('0x2')](util[_0x9c59('0x3')](_0x9c59('0x21'),_0x42f75d[_0x9c59('0x5')],_0x42f75d[_0x9c59('0x1f')],_0x42f75d[_0x9c59('0x22')]));if(_['endsWith'](_0x42f75d[_0x9c59('0x22')],_0x9c59('0x23'))){_0x42f75d[_0x9c59('0x22')]=_0x42f75d[_0x9c59('0x22')][_0x9c59('0x24')](_0x9c59('0x23'),'.WAV');}if(recordings[_0x42f75d[_0x9c59('0x11')]]){var _0x202e50=_[_0x9c59('0x25')](recordings[_0x42f75d[_0x9c59('0x11')]][_0x9c59('0x26')],{'value':_0x42f75d['value']});if(_[_0x9c59('0x19')](_0x202e50)){recordings[_0x42f75d['linkedid']]['monitors'][_0x9c59('0x27')]({'value':_0x42f75d[_0x9c59('0x22')]});}}}}catch(_0x58b381){utils['error'](util['format'](_0x9c59('0x20'),_0x42f75d['uniqueid']),_0x58b381);}};exports['hangup']=function(_0x4c9ead){try{if(!_[_0x9c59('0x19')](recordings[_0x4c9ead['uniqueid']])){utils[_0x9c59('0xf')](util[_0x9c59('0x3')](_0x9c59('0x28'),_0x4c9ead[_0x9c59('0x5')]),_0x4c9ead);utils[_0x9c59('0x2')](util[_0x9c59('0x3')](_0x9c59('0x29'),_0x4c9ead[_0x9c59('0x5')],_0x4c9ead[_0x9c59('0x2a')],_0x4c9ead[_0x9c59('0x2b')],_0x4c9ead[_0x9c59('0x2c')]));recordings[_0x4c9ead['uniqueid']][_0x9c59('0x2a')]=_0x4c9ead[_0x9c59('0x2a')];recordings[_0x4c9ead[_0x9c59('0x5')]][_0x9c59('0x2b')]=_0x4c9ead[_0x9c59('0x2b')];recordings[_0x4c9ead[_0x9c59('0x5')]][_0x9c59('0x2d')]=_0x4c9ead['connectedlinenum'];recordings[_0x4c9ead[_0x9c59('0x5')]]['connectedlinename']=_0x4c9ead[_0x9c59('0x2e')];if(recordings[_0x4c9ead[_0x9c59('0x5')]][_0x9c59('0x2f')]=='outbound'&&recordings[_0x4c9ead[_0x9c59('0x5')]][_0x9c59('0x6')]){recordings[_0x4c9ead[_0x9c59('0x5')]][_0x9c59('0x2d')]=recordings[_0x4c9ead[_0x9c59('0x5')]][_0x9c59('0x6')];recordings[_0x4c9ead['uniqueid']][_0x9c59('0x2e')]='';}recordings[_0x4c9ead['uniqueid']][_0x9c59('0x26')][_0x9c59('0x30')](function(_0x4b64a8){var _0x32e5db=_[_0x9c59('0x31')](recordings[_0x4c9ead[_0x9c59('0x5')]]);_0x32e5db[_0x9c59('0x22')]=_0x4b64a8[_0x9c59('0x22')];writeDB(_0x32e5db);});delete recordings[_0x4c9ead[_0x9c59('0x5')]];}}catch(_0x28b5a5){utils[_0x9c59('0x16')](util['format']('[%s][recordings][hangup]',_0x4c9ead[_0x9c59('0x5')]),_0x28b5a5);}};exports['newexten']=function(_0x2b349e){try{if(!_[_0x9c59('0x19')](recordings[_0x2b349e[_0x9c59('0x5')]])){utils[_0x9c59('0xf')](util[_0x9c59('0x3')]('[%s][recordings][newexten]',_0x2b349e[_0x9c59('0x5')]),_0x2b349e);utils['info'](util[_0x9c59('0x3')](_0x9c59('0x32'),_0x2b349e[_0x9c59('0x5')],_0x2b349e[_0x9c59('0x33')],_0x2b349e[_0x9c59('0x34')]));if(_0x2b349e[_0x9c59('0x33')][_0x9c59('0x35')]()=='set'&&_['startsWith'](_0x2b349e[_0x9c59('0x34')][_0x9c59('0x35')](),_0x9c59('0x36'))){var _0x342333=_0x2b349e[_0x9c59('0x34')]['split']('=');var _0x713a86=_0x342333[0x0][_0x9c59('0x37')](_0x342333[0x0]['lastIndexOf']('(')+0x1,_0x342333[0x0][_0x9c59('0x38')](')'));var _0x58a08c=_0x342333[0x1];recordings[_0x2b349e[_0x9c59('0x5')]][_0x713a86]=_0x58a08c;}}}catch(_0xcb2af5){utils[_0x9c59('0x16')](util[_0x9c59('0x3')]('[%s][recordings][newexten]',_0x2b349e[_0x9c59('0x5')]),_0xcb2af5);}};exports[_0x9c59('0x39')]=function(_0x6d9985){try{if(!_[_0x9c59('0x19')](recordings[_0x6d9985[_0x9c59('0x5')]])){utils[_0x9c59('0xf')](util[_0x9c59('0x3')](_0x9c59('0x3a'),_0x6d9985['uniqueid']),_0x6d9985);utils[_0x9c59('0x2')](util['format'](_0x9c59('0x3b'),_0x6d9985['uniqueid'],_0x6d9985[_0x9c59('0x3c')]));recordings[_0x6d9985[_0x9c59('0x5')]][_0x9c59('0x3c')]=_0x6d9985[_0x9c59('0x3c')];}}catch(_0x71a771){utils[_0x9c59('0x16')](util['format'](_0x9c59('0x3a'),_0x6d9985['uniqueid']),_0x71a771);}}; \ No newline at end of file +var _0x77f0=['[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','debug','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','endsWith','value','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x77f0,0x198));var _0x077f=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x77f0[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x077f('0x0'));var util=require(_0x077f('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x2c15ad){utils[_0x077f('0x2')](util[_0x077f('0x3')](_0x077f('0x4'),_0x2c15ad[_0x077f('0x5')]));if(_0x2c15ad['accountcode']){utils[_0x077f('0x6')](_0x2c15ad[_0x077f('0x7')])[_0x077f('0x8')](function(_0x322c43){if(_0x322c43){_0x2c15ad[_0x077f('0x9')]=_0x322c43[_0x077f('0xa')];_0x2c15ad[_0x077f('0xb')]=_0x322c43['id'];}utils[_0x077f('0xc')](_0x077f('0xd'),_0x2c15ad);});}else{utils[_0x077f('0xc')](_0x077f('0xd'),_0x2c15ad);}}exports['newchannel']=function(_0x31a224){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x31a224['uniqueid']),_0x31a224);if(_0x31a224[_0x077f('0x5')]==_0x31a224[_0x077f('0xe')]){utils['info'](util[_0x077f('0x3')](_0x077f('0xf'),_0x31a224[_0x077f('0x5')],_0x31a224['context'],_0x31a224[_0x077f('0x10')]));recordings[_0x31a224[_0x077f('0x5')]]={'uniqueid':_0x31a224[_0x077f('0x5')],'accountcode':_0x31a224['accountcode'],'exten':_0x31a224[_0x077f('0x10')],'context':_0x31a224[_0x077f('0x11')],'channel':_0x31a224[_0x077f('0x12')],'monitors':[]};}}catch(_0x7deb73){utils[_0x077f('0x13')](util[_0x077f('0x3')]('[%s][recordings][newchannel]',_0x31a224[_0x077f('0x5')]),_0x7deb73);}};exports[_0x077f('0x14')]=function(_0x11514b){try{utils[_0x077f('0x15')](util[_0x077f('0x3')]('[%s][recordings][newstate]',_0x11514b[_0x077f('0x5')]),_0x11514b);if(!_[_0x077f('0x16')](recordings[_0x11514b['uniqueid']])&&_0x11514b[_0x077f('0x17')]==0x6){utils[_0x077f('0x2')](util[_0x077f('0x3')](_0x077f('0x18'),_0x11514b['uniqueid'],_0x11514b[_0x077f('0x11')],_0x11514b[_0x077f('0x12')]));}else if(!_['isNil'](recordings[_0x11514b[_0x077f('0xe')]])&&_0x11514b[_0x077f('0x17')]==0x6&&_0x11514b['context']!=_0x077f('0x19')){utils[_0x077f('0x2')](util[_0x077f('0x3')](_0x077f('0x1a'),_0x11514b['uniqueid'],_0x11514b[_0x077f('0xe')],_0x11514b[_0x077f('0x11')],_0x11514b[_0x077f('0x12')]));recordings[_0x11514b['linkedid']][_0x077f('0x7')]=_0x11514b[_0x077f('0x7')];}}catch(_0x3465ba){utils[_0x077f('0x13')](util[_0x077f('0x3')](_0x077f('0x1b'),_0x11514b[_0x077f('0x5')]),_0x3465ba);}};exports[_0x077f('0x1c')]=function(_0x3f9f17){try{if(!_[_0x077f('0x16')](_0x3f9f17['variable'])&&!_[_0x077f('0x16')](_0x3f9f17[_0x077f('0x1d')][_0x077f('0x1e')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x3f9f17['uniqueid']),_0x3f9f17);utils[_0x077f('0x2')](util[_0x077f('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3f9f17['uniqueid'],_0x3f9f17[_0x077f('0x1d')],_0x3f9f17['value']));if(_[_0x077f('0x1f')](_0x3f9f17[_0x077f('0x20')],'.wav49')){_0x3f9f17[_0x077f('0x20')]=_0x3f9f17[_0x077f('0x20')][_0x077f('0x21')]('.wav49','.WAV');}if(recordings[_0x3f9f17['linkedid']]){var _0x5d90ae=_[_0x077f('0x22')](recordings[_0x3f9f17['linkedid']][_0x077f('0x23')],{'value':_0x3f9f17[_0x077f('0x20')]});if(_[_0x077f('0x16')](_0x5d90ae)){recordings[_0x3f9f17[_0x077f('0xe')]][_0x077f('0x23')][_0x077f('0x24')]({'value':_0x3f9f17[_0x077f('0x20')]});}}}}catch(_0x2a4ac0){utils['error'](util[_0x077f('0x3')](_0x077f('0x25'),_0x3f9f17['uniqueid']),_0x2a4ac0);}};exports[_0x077f('0x26')]=function(_0x442496){try{if(!_[_0x077f('0x16')](recordings[_0x442496['uniqueid']])){utils[_0x077f('0x15')](util[_0x077f('0x3')](_0x077f('0x27'),_0x442496[_0x077f('0x5')]),_0x442496);utils[_0x077f('0x2')](util['format'](_0x077f('0x28'),_0x442496[_0x077f('0x5')],_0x442496[_0x077f('0x29')],_0x442496['calleridname'],_0x442496[_0x077f('0x2a')]));recordings[_0x442496[_0x077f('0x5')]][_0x077f('0x29')]=_0x442496[_0x077f('0x29')];recordings[_0x442496[_0x077f('0x5')]][_0x077f('0x2b')]=_0x442496[_0x077f('0x2b')];recordings[_0x442496[_0x077f('0x5')]][_0x077f('0x2c')]=_0x442496['connectedlinenum'];recordings[_0x442496[_0x077f('0x5')]][_0x077f('0x2d')]=_0x442496['connectedlinename'];if(recordings[_0x442496[_0x077f('0x5')]][_0x077f('0x2e')]=='outbound'&&recordings[_0x442496[_0x077f('0x5')]]['accountcode']){recordings[_0x442496[_0x077f('0x5')]]['connectedlinenum']=recordings[_0x442496[_0x077f('0x5')]]['accountcode'];recordings[_0x442496[_0x077f('0x5')]][_0x077f('0x2d')]='';}recordings[_0x442496[_0x077f('0x5')]]['monitors'][_0x077f('0x2f')](function(_0xb2f4ae){var _0x311f88=_[_0x077f('0x30')](recordings[_0x442496['uniqueid']]);_0x311f88[_0x077f('0x20')]=_0xb2f4ae[_0x077f('0x20')];writeDB(_0x311f88);});delete recordings[_0x442496[_0x077f('0x5')]];}}catch(_0x559953){utils[_0x077f('0x13')](util['format'](_0x077f('0x27'),_0x442496[_0x077f('0x5')]),_0x559953);}};exports[_0x077f('0x31')]=function(_0x1aa367){try{if(!_['isNil'](recordings[_0x1aa367[_0x077f('0x5')]])){utils['debug'](util[_0x077f('0x3')](_0x077f('0x32'),_0x1aa367[_0x077f('0x5')]),_0x1aa367);utils['info'](util[_0x077f('0x3')](_0x077f('0x33'),_0x1aa367[_0x077f('0x5')],_0x1aa367[_0x077f('0x34')],_0x1aa367[_0x077f('0x35')]));if(_0x1aa367[_0x077f('0x34')]['toLowerCase']()=='set'&&_[_0x077f('0x36')](_0x1aa367['appdata'][_0x077f('0x37')](),_0x077f('0x38'))){var _0x34008c=_0x1aa367[_0x077f('0x35')][_0x077f('0x39')]('=');var _0x18fbae=_0x34008c[0x0][_0x077f('0x3a')](_0x34008c[0x0][_0x077f('0x3b')]('(')+0x1,_0x34008c[0x0][_0x077f('0x3b')](')'));var _0x2dc545=_0x34008c[0x1];recordings[_0x1aa367['uniqueid']][_0x18fbae]=_0x2dc545;}}}catch(_0x226bfa){utils[_0x077f('0x13')](util[_0x077f('0x3')](_0x077f('0x32'),_0x1aa367['uniqueid']),_0x226bfa);}};exports[_0x077f('0x3c')]=function(_0x357b86){try{if(!_['isNil'](recordings[_0x357b86[_0x077f('0x5')]])){utils[_0x077f('0x15')](util[_0x077f('0x3')](_0x077f('0x3d'),_0x357b86[_0x077f('0x5')]),_0x357b86);utils[_0x077f('0x2')](util[_0x077f('0x3')](_0x077f('0x3e'),_0x357b86[_0x077f('0x5')],_0x357b86[_0x077f('0x3f')]));recordings[_0x357b86[_0x077f('0x5')]][_0x077f('0x3f')]=_0x357b86[_0x077f('0x3f')];}}catch(_0x31735e){utils[_0x077f('0x13')](util['format']('[%s][recordings][queuecallerjoin]',_0x357b86[_0x077f('0x5')]),_0x31735e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 19ea571..e6cd4b6 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 _0x466f=['info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','request','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils'];(function(_0x3bf4c5,_0x553fdf){var _0x5a1c2c=function(_0x46cf9f){while(--_0x46cf9f){_0x3bf4c5['push'](_0x3bf4c5['shift']());}};_0x5a1c2c(++_0x553fdf);}(_0x466f,0x76));var _0xf466=function(_0x5d5737,_0x4f56a4){_0x5d5737=_0x5d5737-0x0;var _0x1dd268=_0x466f[_0x5d5737];return _0x1dd268;};'use strict';var _=require(_0xf466('0x0'));var util=require('util');var utils=require(_0xf466('0x1'));function writeDB(_0x3a3c33){utils[_0xf466('0x2')](util['format'](_0xf466('0x3'),_0x3a3c33['type']===_0xf466('0x4')?_0x3a3c33['origtransfereruniqueid']:_0x3a3c33[_0xf466('0x5')],_0x3a3c33[_0xf466('0x6')]));utils[_0xf466('0x7')]('CreateVoiceTransferReport',_0x3a3c33);}exports[_0xf466('0x8')]=function(_0x4b7ae1){try{utils[_0xf466('0x9')](util[_0xf466('0xa')](_0xf466('0xb'),_0x4b7ae1[_0xf466('0x5')]),_0x4b7ae1);utils[_0xf466('0x2')](util[_0xf466('0xa')](_0xf466('0xc'),_0x4b7ae1[_0xf466('0x5')],_0x4b7ae1['transferercalleridnum'],_0x4b7ae1[_0xf466('0xd')],_0x4b7ae1[_0xf466('0xe')],_0x4b7ae1[_0xf466('0xf')]));_0x4b7ae1[_0xf466('0x6')]='blind';writeDB(_0x4b7ae1);}catch(_0x18782e){utils[_0xf466('0x10')](util['format'](_0xf466('0xb'),_0x4b7ae1[_0xf466('0x5')]),_0x18782e);}};exports[_0xf466('0x11')]=function(_0x442b2b){try{utils[_0xf466('0x9')](util[_0xf466('0xa')](_0xf466('0x12'),_0x442b2b[_0xf466('0x13')]),_0x442b2b);utils[_0xf466('0x2')](util[_0xf466('0xa')](_0xf466('0x14'),_0x442b2b[_0xf466('0x13')],_0x442b2b['origtransferercalleridnum'],_0x442b2b['origtransferercalleridname'],_0x442b2b[_0xf466('0x15')],_0x442b2b[_0xf466('0x16')]));_0x442b2b=_[_0xf466('0x17')](_0x442b2b,{'transfererchannel':_0x442b2b[_0xf466('0x18')],'transferercalleridnum':_0x442b2b['origtransferercalleridnum'],'transferercalleridname':_0x442b2b['origtransferercalleridname'],'transfererconnectedlinenum':_0x442b2b[_0xf466('0x19')],'transfererconnectedlinename':_0x442b2b[_0xf466('0x1a')],'transfereraccountcode':_0x442b2b[_0xf466('0x1b')],'transferercontext':_0x442b2b[_0xf466('0x1c')],'transfererexten':_0x442b2b[_0xf466('0x1d')],'transfererlinkedid':_0x442b2b[_0xf466('0x1e')],'context':_0x442b2b[_0xf466('0x1f')],'extension':_0x442b2b[_0xf466('0x20')],'type':_0xf466('0x4')});if(_[_0xf466('0x21')](_0x442b2b[_0xf466('0x22')])){_0x442b2b=_[_0xf466('0x17')](_0x442b2b,{'transfereechannel':_0x442b2b['transfertargetchannel'],'transfereecalleridnum':_0x442b2b['transfertargetcalleridnum'],'transfereecalleridname':_0x442b2b[_0xf466('0x16')],'transfereeconnectedlinenum':_0x442b2b['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x442b2b[_0xf466('0x23')],'transfereeaccountcode':_0x442b2b[_0xf466('0x24')],'transfereecontext':_0x442b2b[_0xf466('0x25')],'transfereeexten':_0x442b2b[_0xf466('0x26')],'transfereelinkedid':_0x442b2b[_0xf466('0x27')]});}writeDB(_0x442b2b);}catch(_0x12ee9e){utils[_0xf466('0x10')](util[_0xf466('0xa')](_0xf466('0x12'),_0x442b2b[_0xf466('0x13')]),_0x12ee9e);}}; \ No newline at end of file +var _0xddc9=['[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','./utils','info','format'];(function(_0x5563ea,_0x1b65f3){var _0x345d9d=function(_0x1a4bc3){while(--_0x1a4bc3){_0x5563ea['push'](_0x5563ea['shift']());}};_0x345d9d(++_0x1b65f3);}(_0xddc9,0x89));var _0x9ddc=function(_0x444392,_0x40f7fc){_0x444392=_0x444392-0x0;var _0x4fbb68=_0xddc9[_0x444392];return _0x4fbb68;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9ddc('0x0'));function writeDB(_0x374c45){utils[_0x9ddc('0x1')](util[_0x9ddc('0x2')](_0x9ddc('0x3'),_0x374c45[_0x9ddc('0x4')]===_0x9ddc('0x5')?_0x374c45[_0x9ddc('0x6')]:_0x374c45[_0x9ddc('0x7')],_0x374c45[_0x9ddc('0x4')]));utils['request']('CreateVoiceTransferReport',_0x374c45);}exports[_0x9ddc('0x8')]=function(_0x428d24){try{utils[_0x9ddc('0x9')](util[_0x9ddc('0x2')](_0x9ddc('0xa'),_0x428d24[_0x9ddc('0x7')]),_0x428d24);utils[_0x9ddc('0x1')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x428d24[_0x9ddc('0x7')],_0x428d24[_0x9ddc('0xb')],_0x428d24[_0x9ddc('0xc')],_0x428d24['transfereecalleridnum'],_0x428d24[_0x9ddc('0xd')]));_0x428d24[_0x9ddc('0x4')]='blind';writeDB(_0x428d24);}catch(_0x1c9594){utils['error'](util[_0x9ddc('0x2')](_0x9ddc('0xa'),_0x428d24[_0x9ddc('0x7')]),_0x1c9594);}};exports['attendedtransfer']=function(_0x519a60){try{utils[_0x9ddc('0x9')](util[_0x9ddc('0x2')]('[%s][transfers][attendedtransfer]',_0x519a60[_0x9ddc('0x6')]),_0x519a60);utils[_0x9ddc('0x1')](util[_0x9ddc('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x519a60[_0x9ddc('0x6')],_0x519a60[_0x9ddc('0xe')],_0x519a60[_0x9ddc('0xf')],_0x519a60[_0x9ddc('0x10')],_0x519a60['transfertargetcalleridname']));_0x519a60=_['assign'](_0x519a60,{'transfererchannel':_0x519a60[_0x9ddc('0x11')],'transferercalleridnum':_0x519a60[_0x9ddc('0xe')],'transferercalleridname':_0x519a60[_0x9ddc('0xf')],'transfererconnectedlinenum':_0x519a60[_0x9ddc('0x12')],'transfererconnectedlinename':_0x519a60[_0x9ddc('0x13')],'transfereraccountcode':_0x519a60[_0x9ddc('0x14')],'transferercontext':_0x519a60[_0x9ddc('0x15')],'transfererexten':_0x519a60[_0x9ddc('0x16')],'transfererlinkedid':_0x519a60[_0x9ddc('0x17')],'context':_0x519a60[_0x9ddc('0x18')],'extension':_0x519a60[_0x9ddc('0x19')],'type':_0x9ddc('0x5')});if(_[_0x9ddc('0x1a')](_0x519a60[_0x9ddc('0x1b')])){_0x519a60=_[_0x9ddc('0x1c')](_0x519a60,{'transfereechannel':_0x519a60[_0x9ddc('0x1d')],'transfereecalleridnum':_0x519a60[_0x9ddc('0x10')],'transfereecalleridname':_0x519a60['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x519a60['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x519a60[_0x9ddc('0x1e')],'transfereeaccountcode':_0x519a60['transfertargetaccountcode'],'transfereecontext':_0x519a60[_0x9ddc('0x1f')],'transfereeexten':_0x519a60['transfertargetexten'],'transfereelinkedid':_0x519a60[_0x9ddc('0x20')]});}writeDB(_0x519a60);}catch(_0xa298cf){utils[_0x9ddc('0x21')](util['format'](_0x9ddc('0x22'),_0x519a60[_0x9ddc('0x6')]),_0xa298cf);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5a24039..2eb3956 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 _0x84eb=['[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','result'];(function(_0x3ed4d3,_0x18a20a){var _0x5f1bca=function(_0x10a639){while(--_0x10a639){_0x3ed4d3['push'](_0x3ed4d3['shift']());}};_0x5f1bca(++_0x18a20a);}(_0x84eb,0x130));var _0xb84e=function(_0x3d0cd4,_0x474eba){_0x3d0cd4=_0x3d0cd4-0x0;var _0x3f72df=_0x84eb[_0x3d0cd4];return _0x3f72df;};'use strict';var BPromise=require(_0xb84e('0x0'));var jayson=require(_0xb84e('0x1'));var moment=require(_0xb84e('0x2'));var util=require(_0xb84e('0x3'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0xb84e('0x4'))(_0xb84e('0x5'));exports[_0xb84e('0x6')]=function(_0x3fa386,_0x8c9291){logger[_0xb84e('0x6')](_0x3fa386,_0x8c9291?util[_0xb84e('0x7')](_0x8c9291,{'showHidden':![],'depth':null}):'');};exports[_0xb84e('0x8')]=function(_0x14b767,_0x579cba){logger['debug'](_0x14b767,_0x579cba?util[_0xb84e('0x7')](_0x579cba,{'showHidden':![],'depth':null}):'');};exports[_0xb84e('0x9')]=function(_0x263292,_0x5f1cca){logger[_0xb84e('0x9')](_0x263292,_0x5f1cca?util[_0xb84e('0x7')](_0x5f1cca,{'showHidden':![],'depth':null}):'');};exports[_0xb84e('0xa')]=function(_0x3cb9d9,_0xcfbe4a){return client['request'](_0x3cb9d9,{'body':_0xcfbe4a})[_0xb84e('0xb')](function(_0x14bb8c){logger[_0xb84e('0x8')](_0xb84e('0xc'),_0x3cb9d9,_0x14bb8c?util[_0xb84e('0x7')](_0x14bb8c,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4e534b){logger[_0xb84e('0x9')](_0xb84e('0xc'),_0x3cb9d9,_0x4e534b?util[_0xb84e('0x7')](_0x4e534b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x316d71){return client[_0xb84e('0xa')](_0xb84e('0xd'),{'options':{'raw':!![],'attributes':['id',_0xb84e('0xe'),_0xb84e('0xf'),'interface'],'where':_0x316d71,'limit':0x1}})[_0xb84e('0xb')](function(_0x99e3f8){logger[_0xb84e('0x8')](_0xb84e('0x10'),JSON['stringify'](_0x316d71),_0x99e3f8?util['inspect'](_0x99e3f8,{'showHidden':![],'depth':null}):'');return _0x99e3f8[_0xb84e('0x11')]['length']?_0x99e3f8['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x49fb0b){return new BPromise(function(_0x3a1b74,_0xcf988d){if(_0x49fb0b){return getUser({'internal':_0x49fb0b})[_0xb84e('0xb')](function(_0x470ad0){logger[_0xb84e('0x6')](_0xb84e('0x12'),_0x49fb0b,_0x470ad0?'found':_0xb84e('0x13'));return _0x3a1b74(_0x470ad0);})[_0xb84e('0x14')](function(_0x19903f){logger[_0xb84e('0x9')](_0xb84e('0x15'),_0x19903f?util['inspect'](_0x19903f,{'showHidden':![],'depth':null}):'');return _0x3a1b74(null);});}return _0x3a1b74(null);});};exports[_0xb84e('0x16')]=function(_0x2fdd6b){return new BPromise(function(_0x568fad,_0x29a677){if(_0x2fdd6b){return getUser({'interface':_0x2fdd6b})[_0xb84e('0xb')](function(_0x27e05f){logger[_0xb84e('0x6')](_0xb84e('0x17'),_0x2fdd6b,_0x27e05f?_0xb84e('0x18'):_0xb84e('0x13'));return _0x568fad(_0x27e05f);})[_0xb84e('0x14')](function(_0x34793a){logger[_0xb84e('0x9')]('[utils][getUserByInterface]',_0x34793a?util[_0xb84e('0x7')](_0x34793a,{'showHidden':![],'depth':null}):'');return _0x568fad(null);});}return _0x568fad(null);});};exports[_0xb84e('0x19')]=function(_0xac1f86){return new BPromise(function(_0x2f3fb5,_0x6b4f00){if(_0xac1f86){return getUser({'name':_0xac1f86})['then'](function(_0x1b6455){logger[_0xb84e('0x6')](_0xb84e('0x1a'),_0xac1f86,_0x1b6455?'found':_0xb84e('0x13'));return _0x2f3fb5(_0x1b6455);})['catch'](function(_0x50c490){logger[_0xb84e('0x9')](_0xb84e('0x1b'),_0x50c490?util['inspect'](_0x50c490,{'showHidden':![],'depth':null}):'');return _0x2f3fb5(null);});}return _0x2f3fb5(null);});};exports['getVoiceQueueByName']=function(_0x4371d3){return new BPromise(function(_0x224b52,_0xbdc62){if(_0x4371d3){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xb84e('0xf'),_0xb84e('0x1c'),_0xb84e('0x1d'),_0xb84e('0x1e')],'where':{'name':_0x4371d3},'limit':0x1}})['then'](function(_0x127dc7){logger[_0xb84e('0x8')](_0xb84e('0x1f'),_0x4371d3,_0x127dc7?util[_0xb84e('0x7')](_0x127dc7,{'showHidden':![],'depth':null}):'');logger[_0xb84e('0x6')](_0xb84e('0x20'),_0x4371d3,_0x127dc7?'found':_0xb84e('0x13'));return _0x224b52(_0x127dc7['result'][_0xb84e('0x21')]?_0x127dc7[_0xb84e('0x11')][0x0]:null);})[_0xb84e('0x14')](function(_0x5b21ab){logger['error'](_0xb84e('0x22'),_0x5b21ab?util['inspect'](_0x5b21ab,{'showHidden':![],'depth':null}):'');return _0x224b52(null);});}return _0x224b52(null);});};exports[_0xb84e('0x23')]=function(_0x578aac,_0x52e75d){return moment(_0x578aac)['add'](_0x52e75d,_0xb84e('0x24'))[_0xb84e('0x25')](_0xb84e('0x26'));};exports[_0xb84e('0x27')]=function(_0x5aabe6,_0x59475f){return moment(_0x5aabe6)[_0xb84e('0x28')](_0x59475f,_0xb84e('0x24'))[_0xb84e('0x25')](_0xb84e('0x26'));};exports[_0xb84e('0x29')]=function(_0x47ee5b,_0x29770e){return moment(_0x47ee5b)[_0xb84e('0x2a')](moment(_0x29770e),_0xb84e('0x24'));};exports['sumTime']=function(_0x45b1b7,_0x125df2){return parseInt(_0x45b1b7,0xa)+parseInt(_0x125df2,0xa);};exports[_0xb84e('0x2b')]=function(){return moment()[_0xb84e('0x25')](_0xb84e('0x26'));};exports[_0xb84e('0x2c')]=function(_0x3c21c6,_0x5f46c3){if(_0x5f46c3){return moment(_0x3c21c6)[_0xb84e('0x2c')](_0x5f46c3);}return!![];};exports[_0xb84e('0x2d')]=function(_0x22c3d7,_0x3e548c){if(_0x3e548c){return moment(_0x22c3d7)[_0xb84e('0x2d')](_0x3e548c);}else if(_0x22c3d7){return!![];}return![];}; \ No newline at end of file +var _0x0737=['then','[utils][request]\x20name:%s','catch','internal','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request'];(function(_0x549284,_0x41b5e5){var _0x1e9824=function(_0x3b871a){while(--_0x3b871a){_0x549284['push'](_0x549284['shift']());}};_0x1e9824(++_0x41b5e5);}(_0x0737,0xfc));var _0x7073=function(_0x14be78,_0xbb2fed){_0x14be78=_0x14be78-0x0;var _0x13f890=_0x0737[_0x14be78];return _0x13f890;};'use strict';var BPromise=require(_0x7073('0x0'));var jayson=require(_0x7073('0x1'));var moment=require(_0x7073('0x2'));var util=require(_0x7073('0x3'));var client=jayson['client'][_0x7073('0x4')]({'port':0x2329});var logger=require(_0x7073('0x5'))(_0x7073('0x6'));exports[_0x7073('0x7')]=function(_0x4c71d6,_0x34da05){logger[_0x7073('0x7')](_0x4c71d6,_0x34da05?util[_0x7073('0x8')](_0x34da05,{'showHidden':![],'depth':null}):'');};exports[_0x7073('0x9')]=function(_0x27f3b0,_0x3e87a0){logger[_0x7073('0x9')](_0x27f3b0,_0x3e87a0?util[_0x7073('0x8')](_0x3e87a0,{'showHidden':![],'depth':null}):'');};exports[_0x7073('0xa')]=function(_0x5b3ece,_0x3bef23){logger[_0x7073('0xa')](_0x5b3ece,_0x3bef23?util[_0x7073('0x8')](_0x3bef23,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x854419,_0x1c660c){return client[_0x7073('0xb')](_0x854419,{'body':_0x1c660c})[_0x7073('0xc')](function(_0x47fd8f){logger[_0x7073('0x9')](_0x7073('0xd'),_0x854419,_0x47fd8f?util[_0x7073('0x8')](_0x47fd8f,{'showHidden':![],'depth':null}):'');})[_0x7073('0xe')](function(_0x414e7d){logger[_0x7073('0xa')](_0x7073('0xd'),_0x854419,_0x414e7d?util[_0x7073('0x8')](_0x414e7d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x13d198){return client[_0x7073('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x7073('0xf'),'name','interface'],'where':_0x13d198,'limit':0x1}})['then'](function(_0x1895e3){logger[_0x7073('0x9')](_0x7073('0x10'),JSON[_0x7073('0x11')](_0x13d198),_0x1895e3?util['inspect'](_0x1895e3,{'showHidden':![],'depth':null}):'');return _0x1895e3[_0x7073('0x12')][_0x7073('0x13')]?_0x1895e3[_0x7073('0x12')][0x0]:null;});}exports[_0x7073('0x14')]=function(_0x1e4c3c){return new BPromise(function(_0x372554,_0x50ff69){if(_0x1e4c3c){return getUser({'internal':_0x1e4c3c})[_0x7073('0xc')](function(_0x2aa742){logger[_0x7073('0x7')](_0x7073('0x15'),_0x1e4c3c,_0x2aa742?_0x7073('0x16'):_0x7073('0x17'));return _0x372554(_0x2aa742);})[_0x7073('0xe')](function(_0x4fdfd0){logger[_0x7073('0xa')]('[utils][getUserByInternal]',_0x4fdfd0?util[_0x7073('0x8')](_0x4fdfd0,{'showHidden':![],'depth':null}):'');return _0x372554(null);});}return _0x372554(null);});};exports[_0x7073('0x18')]=function(_0x4f7616){return new BPromise(function(_0x43b7b0,_0x1217de){if(_0x4f7616){return getUser({'interface':_0x4f7616})[_0x7073('0xc')](function(_0x5878fb){logger[_0x7073('0x7')](_0x7073('0x19'),_0x4f7616,_0x5878fb?_0x7073('0x16'):'notfound');return _0x43b7b0(_0x5878fb);})[_0x7073('0xe')](function(_0x54d3a8){logger[_0x7073('0xa')](_0x7073('0x1a'),_0x54d3a8?util[_0x7073('0x8')](_0x54d3a8,{'showHidden':![],'depth':null}):'');return _0x43b7b0(null);});}return _0x43b7b0(null);});};exports[_0x7073('0x1b')]=function(_0x365ec4){return new BPromise(function(_0x54b9dc,_0x44a585){if(_0x365ec4){return getUser({'name':_0x365ec4})[_0x7073('0xc')](function(_0x3a100d){logger[_0x7073('0x7')](_0x7073('0x1c'),_0x365ec4,_0x3a100d?'found':_0x7073('0x17'));return _0x54b9dc(_0x3a100d);})[_0x7073('0xe')](function(_0x2fdcd1){logger[_0x7073('0xa')](_0x7073('0x1d'),_0x2fdcd1?util['inspect'](_0x2fdcd1,{'showHidden':![],'depth':null}):'');return _0x54b9dc(null);});}return _0x54b9dc(null);});};exports[_0x7073('0x1e')]=function(_0xfbaac2){return new BPromise(function(_0x487a5f,_0x408f4e){if(_0xfbaac2){return client[_0x7073('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x7073('0x1f'),'acw',_0x7073('0x20')],'where':{'name':_0xfbaac2},'limit':0x1}})[_0x7073('0xc')](function(_0x204614){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0xfbaac2,_0x204614?util[_0x7073('0x8')](_0x204614,{'showHidden':![],'depth':null}):'');logger[_0x7073('0x7')](_0x7073('0x21'),_0xfbaac2,_0x204614?_0x7073('0x16'):'notfound');return _0x487a5f(_0x204614[_0x7073('0x12')][_0x7073('0x13')]?_0x204614[_0x7073('0x12')][0x0]:null);})[_0x7073('0xe')](function(_0x4e94ae){logger[_0x7073('0xa')]('[utils][getVoiceQueueByName]',_0x4e94ae?util[_0x7073('0x8')](_0x4e94ae,{'showHidden':![],'depth':null}):'');return _0x487a5f(null);});}return _0x487a5f(null);});};exports['addTime']=function(_0x355ef6,_0x5c7f0a){return moment(_0x355ef6)[_0x7073('0x22')](_0x5c7f0a,_0x7073('0x23'))[_0x7073('0x24')](_0x7073('0x25'));};exports[_0x7073('0x26')]=function(_0x40c71f,_0x488096){return moment(_0x40c71f)[_0x7073('0x27')](_0x488096,_0x7073('0x23'))[_0x7073('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7073('0x28')]=function(_0x113398,_0x1c3b2d){return moment(_0x113398)['diff'](moment(_0x1c3b2d),_0x7073('0x23'));};exports[_0x7073('0x29')]=function(_0x59b5b7,_0x4f4a02){return parseInt(_0x59b5b7,0xa)+parseInt(_0x4f4a02,0xa);};exports['now']=function(){return moment()['format'](_0x7073('0x25'));};exports[_0x7073('0x2a')]=function(_0x1bd0f8,_0x146f35){if(_0x146f35){return moment(_0x1bd0f8)[_0x7073('0x2a')](_0x146f35);}return!![];};exports[_0x7073('0x2b')]=function(_0x578119,_0x436422){if(_0x436422){return moment(_0x578119)[_0x7073('0x2b')](_0x436422);}else if(_0x578119){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 bdfe343..739c4d3 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 _0xb57e=['log','xcally','role','ensureDir','client','catch','user','no-user','data','error','api','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','maskSensitiveData','join','/var'];(function(_0x47f567,_0x8670ba){var _0x4cce34=function(_0x45753f){while(--_0x45753f){_0x47f567['push'](_0x47f567['shift']());}};_0x4cce34(++_0x8670ba);}(_0xb57e,0xd8));var _0xeb57=function(_0x3c59c5,_0x527f24){_0x3c59c5=_0x3c59c5-0x0;var _0x271aad=_0xb57e[_0x3c59c5];return _0x271aad;};var fs=require(_0xeb57('0x0'));var _=require(_0xeb57('0x1'));var ewinston=require(_0xeb57('0x2'));var path=require('path');var util=require(_0xeb57('0x3'));var fileLogger=require(_0xeb57('0x4'))[_0xeb57('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0xeb57('0x6')];function ClientSideLogger(){function _0x284ddc(_0x12a60d){var _0x4e457f=path[_0xeb57('0x7')](_0xeb57('0x8'),_0xeb57('0x9'),_0xeb57('0xa'));var _0x34f971=path[_0xeb57('0x7')]('client',_0x12a60d[_0xeb57('0xb')]+'-'+_0x12a60d['name']);return fs[_0xeb57('0xc')](path['join'](_0x4e457f,_0x34f971))['then'](function(){var _0x20dfce=fileLogger(_0xeb57('0xd'),path[_0xeb57('0x7')](_0x4e457f,_0x34f971));return _0x20dfce;})[_0xeb57('0xe')](function(_0x4a17d5){throw _0x4a17d5;});}this['log']=function(_0x13b38b,_0x1da9de,_0xeb7549,_0x1ddac8){return _0x284ddc(_0x13b38b[_0xeb57('0xf')])['then'](function(_0x109c62){var _0x4a5a10=_0x109c62[_0x1da9de];return _0x4a5a10;})['then'](function(_0xf2a5a5){var _0x20eab7=_0x13b38b[_0xeb57('0xf')]?_0x13b38b[_0xeb57('0xf')]['id']:_0xeb57('0x10');var _0x4f0acb=_0x1ddac8[_0xeb57('0x11')];var _0x5b0eda=_0x1ddac8['timestamp'];var _0x217553=new Date(Number(_0x5b0eda));return _0xf2a5a5(_0x20eab7,_0x217553,_0xeb7549,_0x4f0acb);})[_0xeb57('0xe')](function(_0x220f14){fileLogger('client')[_0xeb57('0x12')](_0x220f14);});};}function setupLoggers(_0x2f04a1){return new Promise(function(_0x8acf07){var _0x1b614e=new ClientSideLogger();var _0x337ed1=fileLogger(_0xeb57('0x13'));var _0x394f3b=fileLogger('auth');_0x2f04a1[_0xeb57('0x14')](_0xeb57('0x15'),_0x1b614e);_0x2f04a1['use'](ewinston[_0xeb57('0x16')]({'winstonInstance':_0x337ed1,'meta':![],'statusLevels':!![],'msg':function(_0x127cfb,_0xaf2ef1){var _0x2c1edd=_0xeb57('0x17');if(!_[_0xeb57('0x18')](_0x127cfb[_0xeb57('0x19')])){_0x2c1edd+=_0xeb57('0x1a');var _0x54fb7e=_0x127cfb[_0xeb57('0x19')];maskSensitiveData(_0x54fb7e);}return safeTemplate(util[_0xeb57('0x1b')](_0x2c1edd,_0x127cfb[_0xeb57('0x1c')],_0x127cfb[_0xeb57('0x1d')]['x-forwarded-for']?_0x127cfb[_0xeb57('0x1d')][_0xeb57('0x1e')]:_0x127cfb[_0xeb57('0x1f')][_0xeb57('0x20')]||_0x127cfb['ip'],_0x127cfb[_0xeb57('0x21')],_0xaf2ef1[_0xeb57('0x22')],_0xaf2ef1[_0xeb57('0x23')],_0x127cfb[_0xeb57('0xf')]?_0x127cfb[_0xeb57('0xf')]['id']:null,_0x127cfb[_0xeb57('0xf')]?_0x127cfb[_0xeb57('0xf')][_0xeb57('0x24')]:null,_0x127cfb[_0xeb57('0xf')]?_0x127cfb[_0xeb57('0xf')][_0xeb57('0xb')]:null,_0x54fb7e?util[_0xeb57('0x25')](_0x54fb7e,![],null):''));}}));_0x2f04a1['use'](ewinston[_0xeb57('0x16')]({'winstonInstance':_0x394f3b,'meta':![],'statusLevels':!![],'msg':function(_0x222fcd,_0xbc6aa0){var _0x5303a7=_0xeb57('0x26');if(_0x222fcd['body']&&_0x222fcd[_0xeb57('0x19')][_0xeb57('0x27')]&&_0x222fcd['body'][_0xeb57('0x28')]){_0x5303a7=_0xeb57('0x29');}return util['format'](_0x5303a7,_0x222fcd[_0xeb57('0x1c')],_0x222fcd['headers']['x-forwarded-for']?_0x222fcd[_0xeb57('0x1d')]['x-forwarded-for']:_0x222fcd[_0xeb57('0x1f')][_0xeb57('0x20')]||_0x222fcd['ip'],_0x222fcd['url'],_0xbc6aa0[_0xeb57('0x22')],_0xbc6aa0[_0xeb57('0x23')],_0x222fcd[_0xeb57('0xf')]?_0x222fcd[_0xeb57('0xf')]['id']:null,_0x222fcd[_0xeb57('0xf')]?_0x222fcd[_0xeb57('0xf')][_0xeb57('0x24')]:null,_0x222fcd[_0xeb57('0xf')]?_0x222fcd[_0xeb57('0xf')][_0xeb57('0xb')]:null,_0x222fcd['body']&&_0x222fcd[_0xeb57('0x19')][_0xeb57('0x27')]?_0x222fcd[_0xeb57('0x19')]['device']:'other',_0x222fcd[_0xeb57('0x19')]&&_0x222fcd[_0xeb57('0x19')]['agent_id']?_0x222fcd[_0xeb57('0x19')][_0xeb57('0x28')]:'',_0x222fcd[_0xeb57('0x19')]&&_0x222fcd['body'][_0xeb57('0x2a')]?_0x222fcd[_0xeb57('0x19')][_0xeb57('0x2a')]:'');},'ignoreRoute':function(_0x1266bd){var _0x1be6bb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1be6bb[_0xeb57('0x2b')](_0x1266bd[_0xeb57('0x21')]);}}));return _0x8acf07();});}exports[_0xeb57('0x2c')]=setupLoggers; \ No newline at end of file +var _0x9a1b=['api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','join','/var','client','role','ensureDir','then','log','user','no-user','data','timestamp','catch'];(function(_0x112521,_0x178f26){var _0x150f54=function(_0x2074f9){while(--_0x2074f9){_0x112521['push'](_0x112521['shift']());}};_0x150f54(++_0x178f26);}(_0x9a1b,0x1ae));var _0xb9a1=function(_0x172172,_0x18db61){_0x172172=_0x172172-0x0;var _0x1bda0a=_0x9a1b[_0x172172];return _0x1bda0a;};var fs=require(_0xb9a1('0x0'));var _=require(_0xb9a1('0x1'));var ewinston=require(_0xb9a1('0x2'));var path=require('path');var util=require(_0xb9a1('0x3'));var fileLogger=require(_0xb9a1('0x4'))[_0xb9a1('0x5')];var safeTemplate=require(_0xb9a1('0x6'))['safeTemplate'];var maskSensitiveData=require(_0xb9a1('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x13af05(_0x53b591){var _0x18ade4=path[_0xb9a1('0x8')](_0xb9a1('0x9'),'log','xcally');var _0x4ca339=path[_0xb9a1('0x8')](_0xb9a1('0xa'),_0x53b591[_0xb9a1('0xb')]+'-'+_0x53b591['name']);return fs[_0xb9a1('0xc')](path[_0xb9a1('0x8')](_0x18ade4,_0x4ca339))[_0xb9a1('0xd')](function(){var _0x12080a=fileLogger(_0xb9a1('0xa'),path['join'](_0x18ade4,_0x4ca339));return _0x12080a;})['catch'](function(_0x3b0ae2){throw _0x3b0ae2;});}this[_0xb9a1('0xe')]=function(_0x9b7e2,_0x183962,_0x294730,_0x1f1cb3){return _0x13af05(_0x9b7e2[_0xb9a1('0xf')])[_0xb9a1('0xd')](function(_0x2aa23e){var _0x245e07=_0x2aa23e[_0x183962];return _0x245e07;})['then'](function(_0x4861ea){var _0x2b2b28=_0x9b7e2[_0xb9a1('0xf')]?_0x9b7e2[_0xb9a1('0xf')]['id']:_0xb9a1('0x10');var _0x480ec1=_0x1f1cb3[_0xb9a1('0x11')];var _0x30cc4c=_0x1f1cb3[_0xb9a1('0x12')];var _0x492481=new Date(Number(_0x30cc4c));return _0x4861ea(_0x2b2b28,_0x492481,_0x294730,_0x480ec1);})[_0xb9a1('0x13')](function(_0x14fd83){fileLogger('client')['error'](_0x14fd83);});};}function setupLoggers(_0x5e22e4){return new Promise(function(_0x2bf8a4){var _0x173a4a=new ClientSideLogger();var _0x218faa=fileLogger(_0xb9a1('0x14'));var _0x2ac9c2=fileLogger(_0xb9a1('0x15'));_0x5e22e4['set'](_0xb9a1('0x16'),_0x173a4a);_0x5e22e4['use'](ewinston[_0xb9a1('0x17')]({'winstonInstance':_0x218faa,'meta':![],'statusLevels':!![],'msg':function(_0x52858e,_0x44ab2f){var _0x546ff7=_0xb9a1('0x18');if(!_[_0xb9a1('0x19')](_0x52858e[_0xb9a1('0x1a')])){_0x546ff7+='\x20body=%s';var _0x24b09f=_0x52858e[_0xb9a1('0x1a')];maskSensitiveData(_0x24b09f);}return safeTemplate(util[_0xb9a1('0x1b')](_0x546ff7,_0x52858e[_0xb9a1('0x1c')],_0x52858e[_0xb9a1('0x1d')]['x-forwarded-for']?_0x52858e[_0xb9a1('0x1d')]['x-forwarded-for']:_0x52858e[_0xb9a1('0x1e')][_0xb9a1('0x1f')]||_0x52858e['ip'],_0x52858e[_0xb9a1('0x20')],_0x44ab2f[_0xb9a1('0x21')],_0x44ab2f[_0xb9a1('0x22')],_0x52858e[_0xb9a1('0xf')]?_0x52858e[_0xb9a1('0xf')]['id']:null,_0x52858e[_0xb9a1('0xf')]?_0x52858e[_0xb9a1('0xf')]['name']:null,_0x52858e[_0xb9a1('0xf')]?_0x52858e['user'][_0xb9a1('0xb')]:null,_0x24b09f?util[_0xb9a1('0x23')](_0x24b09f,![],null):''));}}));_0x5e22e4['use'](ewinston[_0xb9a1('0x17')]({'winstonInstance':_0x2ac9c2,'meta':![],'statusLevels':!![],'msg':function(_0xbed996,_0x4d62fe){var _0x467855=_0xb9a1('0x24');if(_0xbed996[_0xb9a1('0x1a')]&&_0xbed996['body'][_0xb9a1('0x25')]&&_0xbed996[_0xb9a1('0x1a')][_0xb9a1('0x26')]){_0x467855=_0xb9a1('0x27');}return util['format'](_0x467855,_0xbed996[_0xb9a1('0x1c')],_0xbed996['headers']['x-forwarded-for']?_0xbed996[_0xb9a1('0x1d')]['x-forwarded-for']:_0xbed996[_0xb9a1('0x1e')][_0xb9a1('0x1f')]||_0xbed996['ip'],_0xbed996[_0xb9a1('0x20')],_0x4d62fe[_0xb9a1('0x21')],_0x4d62fe[_0xb9a1('0x22')],_0xbed996['user']?_0xbed996[_0xb9a1('0xf')]['id']:null,_0xbed996[_0xb9a1('0xf')]?_0xbed996['user'][_0xb9a1('0x28')]:null,_0xbed996[_0xb9a1('0xf')]?_0xbed996[_0xb9a1('0xf')][_0xb9a1('0xb')]:null,_0xbed996[_0xb9a1('0x1a')]&&_0xbed996[_0xb9a1('0x1a')]['device']?_0xbed996[_0xb9a1('0x1a')][_0xb9a1('0x25')]:_0xb9a1('0x29'),_0xbed996[_0xb9a1('0x1a')]&&_0xbed996[_0xb9a1('0x1a')]['agent_id']?_0xbed996['body'][_0xb9a1('0x26')]:'',_0xbed996[_0xb9a1('0x1a')]&&_0xbed996[_0xb9a1('0x1a')][_0xb9a1('0x2a')]?_0xbed996[_0xb9a1('0x1a')][_0xb9a1('0x2a')]:'');},'ignoreRoute':function(_0x1eb526){var _0x2f6617=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2f6617[_0xb9a1('0x2b')](_0x1eb526[_0xb9a1('0x20')]);}}));return _0x2bf8a4();});}exports[_0xb9a1('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index fc124bb..3170d23 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d9a=['minutes','isBefore','startOf','day','isBetween','timeCompare','dowCompare','daysInMonth','min','max','format','MMM','guess','isMoment','padStart','length','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone'];(function(_0x7002d0,_0x172db8){var _0x52df28=function(_0x317016){while(--_0x317016){_0x7002d0['push'](_0x7002d0['shift']());}};_0x52df28(++_0x172db8);}(_0x8d9a,0x129));var _0xa8d9=function(_0x49782f,_0x193f81){_0x49782f=_0x49782f-0x0;var _0x4d6769=_0x8d9a[_0x49782f];return _0x4d6769;};var _=require(_0xa8d9('0x0'));var moment=require(_0xa8d9('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]['map'](function(_0x1757bd){return _0x1757bd[_0xa8d9('0x2')];})[_0xa8d9('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa8d9('0x4');var EINVALID_DATE=_0xa8d9('0x5');function throwIfDateNotValid(_0x5f429c){if(!_0x5f429c['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3b9943){var _0x2a0c79=_0x3b9943[_0xa8d9('0x6')](':')[_0xa8d9('0x7')](function(_0x2eb17f){return parseInt(_0x2eb17f,0xa);});var _0x43395d=_0x2a0c79[0x0];var _0x1d5126=_0x2a0c79[0x1];if(_0x43395d<0x0||_0x43395d>0x17||_0x1d5126<0x0||_0x1d5126>0x3b){throw new Error(EINVALID_DATE);}return[_0x43395d,_0x1d5126];}function circularDoWInterval(_0x1591b7,_0x3e1fe4){if(_0x1591b7===_0x3e1fe4){return[_0x1591b7];}else{var _0x5739c1=moment[_0xa8d9('0x8')]();moment[_0xa8d9('0x8')]('en');var _0x3e42ab=moment[_0xa8d9('0x9')]()[_0xa8d9('0x7')](function(_0xdd70bf){return _0xdd70bf[_0xa8d9('0xa')]();});moment[_0xa8d9('0x8')](_0x5739c1);var _0x50b75c=_0x3e42ab[_0xa8d9('0xb')](_0x1591b7);var _0x15a921=_0x3e42ab['indexOf'](_0x3e1fe4);if(_0x15a921>_0x50b75c){return _0x3e42ab[_0xa8d9('0xc')](_0x50b75c,_0x15a921+0x1);}else{var _0x6b67f1=_0x3e42ab['slice'](0x0,_0x15a921+0x1);var _0x13f5e7=_0x3e42ab[_0xa8d9('0xc')](_0x50b75c);return _0x13f5e7[_0xa8d9('0xd')](_0x6b67f1);}}}module[_0xa8d9('0xe')][_0xa8d9('0xf')]=circularDoWInterval;function circularMonthInterval(_0x53203a,_0x387bfc){if(_0x53203a===_0x387bfc){return[_0x53203a];}else{var _0x3eee97=moment[_0xa8d9('0x8')]();moment[_0xa8d9('0x8')]('en');var _0x56ad3a=moment['monthsShort']()[_0xa8d9('0x7')](function(_0x280727){return _0x280727[_0xa8d9('0xa')]();});moment[_0xa8d9('0x8')](_0x3eee97);var _0x473dba=_0x56ad3a[_0xa8d9('0xb')](_0x53203a);var _0x147481=_0x56ad3a['indexOf'](_0x387bfc);if(_0x147481>_0x473dba){return _0x56ad3a[_0xa8d9('0xc')](_0x473dba,_0x147481+0x1);}else{var _0x51411b=_0x56ad3a['slice'](0x0,_0x147481+0x1);var _0x389ceb=_0x56ad3a[_0xa8d9('0xc')](_0x473dba);return _0x389ceb['concat'](_0x51411b);}}}module[_0xa8d9('0xe')][_0xa8d9('0x10')]=circularMonthInterval;function parseDom(_0x26ae43){var _0x1773c8=parseInt(_0x26ae43,0xa);if(_0x1773c8<0x1||_0x1773c8>0x1f){throw new Error(EINVALID_DATE);}return _0x1773c8;}function timeCompare(_0x24fa05,_0x1b2b20,_0x357280){var _0x5d207b=_0x24fa05[_0xa8d9('0x11')]();var _0x206f92=extractTime(_0x1b2b20);var _0x3501f5=_0x206f92[0x0];var _0x437807=_0x206f92[0x1];var _0x1f0860=_0x24fa05['clone']()['hours'](_0x3501f5)[_0xa8d9('0x12')](_0x437807);throwIfDateNotValid(_0x1f0860);var _0x1e5adf=extractTime(_0x357280);var _0x54f310=_0x1e5adf[0x0];var _0x290a0a=_0x1e5adf[0x1];var _0x424660=_0x24fa05[_0xa8d9('0x11')]()['hours'](_0x54f310)[_0xa8d9('0x12')](_0x290a0a);throwIfDateNotValid(_0x424660);if(_0x424660[_0xa8d9('0x13')](_0x1f0860)){var _0x38fd3c=_0x5d207b[_0xa8d9('0x11')]()[_0xa8d9('0x14')](_0xa8d9('0x15'));var _0x1316cd=_0x5d207b[_0xa8d9('0x11')]()['endOf'](_0xa8d9('0x15'));return _0x5d207b[_0xa8d9('0x16')](_0x1f0860,_0x1316cd,undefined,'[]')||_0x5d207b['isBetween'](_0x38fd3c,_0x424660,undefined,'[]');}else{return _0x5d207b[_0xa8d9('0x16')](_0x1f0860,_0x424660,undefined,'[]');}}module[_0xa8d9('0xe')][_0xa8d9('0x17')]=timeCompare;function dowCompare(_0x4c7467,_0x3c3f5b,_0x1ad4d9){var _0x5f270b=_0x4c7467[_0xa8d9('0x8')]('en')['format']('ddd')['toLowerCase']();return circularDoWInterval(_0x3c3f5b,_0x1ad4d9)['includes'](_0x5f270b);}module[_0xa8d9('0xe')][_0xa8d9('0x18')]=dowCompare;function domCompare(_0x4377a7,_0x2ccbed,_0x4cb2af){var _0x5a1fd1=_0x4377a7['date']();if(_0x2ccbed===_0x4cb2af){return _0x5a1fd1===_0x2ccbed;}else{var _0x22e39f=_0x4377a7[_0xa8d9('0x19')]();var _0x5822e1=_0x2ccbed<_0x4cb2af;let _0x420b43=![];var _0x2f1a38=0x0;var _0x560653=0x0;if(_0x5822e1){_0x2f1a38=Math['max'](0x1,_0x2ccbed);_0x560653=Math['min'](_0x4cb2af,_0x22e39f);_0x420b43=_0x5a1fd1>=_0x2f1a38&&_0x5a1fd1<=_0x560653;}else{_0x2f1a38=Math[_0xa8d9('0x1a')](_0x2ccbed,_0x22e39f);_0x560653=Math[_0xa8d9('0x1b')](0x1,_0x4cb2af);_0x420b43=_0x5a1fd1>=_0x2f1a38||_0x5a1fd1<=_0x560653;}return _0x420b43;}}module[_0xa8d9('0xe')]['domCompare']=domCompare;function monthCompare(_0x1a4dbb,_0x1ed2cf,_0x344fd4){var _0x5b31da=_0x1a4dbb['locale']('en')[_0xa8d9('0x1c')](_0xa8d9('0x1d'))[_0xa8d9('0xa')]();return circularMonthInterval(_0x1ed2cf,_0x344fd4)['includes'](_0x5b31da);}module[_0xa8d9('0xe')]['monthCompare']=monthCompare;function iftime(_0x5a519e,_0x1b9773=moment['tz'][_0xa8d9('0x1e')](),_0x4e14fd=moment()){if(!validateRx['test'](_0x5a519e)){throw new Error(EINVALID_STRING);}else{var _0xcc0847=(moment[_0xa8d9('0x1f')](_0x4e14fd)?_0x4e14fd[_0xa8d9('0x11')]():moment(_0x4e14fd))['tz'](_0x1b9773)[_0xa8d9('0x8')]('en');throwIfDateNotValid(_0xcc0847);var _0x3a68e3=_0x5a519e['split'](',');var _0xe0aff9=_0x3a68e3[0x0];var _0x5c667a=_0x3a68e3[0x1];var _0x271afb=_0x3a68e3[0x2];var _0x28d070=_0x3a68e3[0x3];let _0x559f22=!![];if(_0xe0aff9!=='*'){var _0x2354c9=_0xe0aff9[_0xa8d9('0x6')]('-');var _0x3303a9=_[_0xa8d9('0x20')](_0x2354c9[0x0],0x5,'0');var _0x5c604b=_0x2354c9[_0xa8d9('0x21')]===0x2?_['padStart'](_0x2354c9[0x1],0x5,'0'):_0x3303a9;_0x559f22=timeCompare(_0xcc0847,_0x3303a9,_0x5c604b);}let _0x13e4fc=!![];if(_0x5c667a!=='*'){var _0x3b08db=_0x5c667a['split']('-');var _0x12384c=_0x3b08db[0x0];var _0x372097=_0x3b08db[_0xa8d9('0x21')]===0x2?_0x3b08db[0x1]:_0x12384c;_0x13e4fc=dowCompare(_0xcc0847,_0x12384c,_0x372097);}let _0x2a3614=!![];if(_0x271afb!=='*'){var _0x327df4=_0x271afb[_0xa8d9('0x6')]('-');var _0x306371=parseDom(_0x327df4[0x0]);var _0x55a596=_0x327df4[_0xa8d9('0x21')]===0x2?parseDom(_0x327df4[0x1]):_0x306371;_0x2a3614=domCompare(_0xcc0847,_0x306371,_0x55a596);}let _0x52faa5=!![];if(_0x28d070!=='*'){var _0x7a840b=_0x28d070[_0xa8d9('0x6')]('-');var _0x43e7d1=_0x7a840b[0x0];var _0x2aabf9=_0x7a840b[_0xa8d9('0x21')]===0x2?_0x7a840b[0x1]:_0x7a840b[0x0];_0x52faa5=monthCompare(_0xcc0847,_0x43e7d1,_0x2aabf9);}return _0x559f22&&_0x13e4fc&&_0x2a3614&&_0x52faa5;}}module[_0xa8d9('0xe')][_0xa8d9('0x22')]=iftime; \ No newline at end of file +var _0x93fb=['monthCompare','test','isMoment','padStart','length','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','dowCompare','date','max','min','domCompare','includes'];(function(_0x37e069,_0x5edc46){var _0x5cb67e=function(_0x33a3f4){while(--_0x33a3f4){_0x37e069['push'](_0x37e069['shift']());}};_0x5cb67e(++_0x5edc46);}(_0x93fb,0x6e));var _0xb93f=function(_0x3f6708,_0xbd2259){_0x3f6708=_0x3f6708-0x0;var _0x40b453=_0x93fb[_0x3f6708];return _0x40b453;};var _=require('lodash');var moment=require(_0xb93f('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xb93f('0x1')](function(_0x6a02d8){return _0x6a02d8[_0xb93f('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb93f('0x3');var EINVALID_DATE=_0xb93f('0x4');function throwIfDateNotValid(_0x26ba93){if(!_0x26ba93['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x359dff){var _0x2d1a09=_0x359dff[_0xb93f('0x5')](':')['map'](function(_0x4b1a9e){return parseInt(_0x4b1a9e,0xa);});var _0x76e70e=_0x2d1a09[0x0];var _0x19b734=_0x2d1a09[0x1];if(_0x76e70e<0x0||_0x76e70e>0x17||_0x19b734<0x0||_0x19b734>0x3b){throw new Error(EINVALID_DATE);}return[_0x76e70e,_0x19b734];}function circularDoWInterval(_0x31b3b5,_0x345d47){if(_0x31b3b5===_0x345d47){return[_0x31b3b5];}else{var _0x1584a3=moment[_0xb93f('0x6')]();moment['locale']('en');var _0xdce414=moment[_0xb93f('0x7')]()[_0xb93f('0x1')](function(_0x32d86a){return _0x32d86a['toLowerCase']();});moment[_0xb93f('0x6')](_0x1584a3);var _0x4a387f=_0xdce414[_0xb93f('0x8')](_0x31b3b5);var _0x479b21=_0xdce414[_0xb93f('0x8')](_0x345d47);if(_0x479b21>_0x4a387f){return _0xdce414[_0xb93f('0x9')](_0x4a387f,_0x479b21+0x1);}else{var _0x2d4dcd=_0xdce414['slice'](0x0,_0x479b21+0x1);var _0x4e13f6=_0xdce414['slice'](_0x4a387f);return _0x4e13f6[_0xb93f('0xa')](_0x2d4dcd);}}}module[_0xb93f('0xb')][_0xb93f('0xc')]=circularDoWInterval;function circularMonthInterval(_0x4ea8d9,_0x52a258){if(_0x4ea8d9===_0x52a258){return[_0x4ea8d9];}else{var _0x3ee69b=moment[_0xb93f('0x6')]();moment['locale']('en');var _0x4fc1c4=moment[_0xb93f('0xd')]()[_0xb93f('0x1')](function(_0x55a50b){return _0x55a50b['toLowerCase']();});moment['locale'](_0x3ee69b);var _0x14b1e2=_0x4fc1c4[_0xb93f('0x8')](_0x4ea8d9);var _0x1d8b5d=_0x4fc1c4[_0xb93f('0x8')](_0x52a258);if(_0x1d8b5d>_0x14b1e2){return _0x4fc1c4[_0xb93f('0x9')](_0x14b1e2,_0x1d8b5d+0x1);}else{var _0x1b3e73=_0x4fc1c4['slice'](0x0,_0x1d8b5d+0x1);var _0x100971=_0x4fc1c4[_0xb93f('0x9')](_0x14b1e2);return _0x100971[_0xb93f('0xa')](_0x1b3e73);}}}module[_0xb93f('0xb')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3939bf){var _0x4abc41=parseInt(_0x3939bf,0xa);if(_0x4abc41<0x1||_0x4abc41>0x1f){throw new Error(EINVALID_DATE);}return _0x4abc41;}function timeCompare(_0x386412,_0x4f3822,_0x53491a){var _0x2e753b=_0x386412[_0xb93f('0xe')]();var _0x1c711c=extractTime(_0x4f3822);var _0xd79b5e=_0x1c711c[0x0];var _0x1269e8=_0x1c711c[0x1];var _0x5edae7=_0x386412[_0xb93f('0xe')]()[_0xb93f('0xf')](_0xd79b5e)[_0xb93f('0x10')](_0x1269e8);throwIfDateNotValid(_0x5edae7);var _0x4b1b82=extractTime(_0x53491a);var _0x53dd6a=_0x4b1b82[0x0];var _0x1b5870=_0x4b1b82[0x1];var _0x2b6c1e=_0x386412[_0xb93f('0xe')]()[_0xb93f('0xf')](_0x53dd6a)[_0xb93f('0x10')](_0x1b5870);throwIfDateNotValid(_0x2b6c1e);if(_0x2b6c1e[_0xb93f('0x11')](_0x5edae7)){var _0x4f5cc9=_0x2e753b[_0xb93f('0xe')]()[_0xb93f('0x12')]('day');var _0x3b0f6f=_0x2e753b[_0xb93f('0xe')]()['endOf'](_0xb93f('0x13'));return _0x2e753b[_0xb93f('0x14')](_0x5edae7,_0x3b0f6f,undefined,'[]')||_0x2e753b[_0xb93f('0x14')](_0x4f5cc9,_0x2b6c1e,undefined,'[]');}else{return _0x2e753b['isBetween'](_0x5edae7,_0x2b6c1e,undefined,'[]');}}module['exports'][_0xb93f('0x15')]=timeCompare;function dowCompare(_0x4a5437,_0x326e6e,_0x5f54b){var _0x1088c8=_0x4a5437['locale']('en')[_0xb93f('0x16')](_0xb93f('0x17'))['toLowerCase']();return circularDoWInterval(_0x326e6e,_0x5f54b)['includes'](_0x1088c8);}module[_0xb93f('0xb')][_0xb93f('0x18')]=dowCompare;function domCompare(_0x473bcd,_0x2bcf59,_0x4ae751){var _0x9041a2=_0x473bcd[_0xb93f('0x19')]();if(_0x2bcf59===_0x4ae751){return _0x9041a2===_0x2bcf59;}else{var _0x2ec359=_0x473bcd['daysInMonth']();var _0xf4b7d2=_0x2bcf59<_0x4ae751;let _0x21a53c=![];var _0x5a8045=0x0;var _0xa9f404=0x0;if(_0xf4b7d2){_0x5a8045=Math[_0xb93f('0x1a')](0x1,_0x2bcf59);_0xa9f404=Math[_0xb93f('0x1b')](_0x4ae751,_0x2ec359);_0x21a53c=_0x9041a2>=_0x5a8045&&_0x9041a2<=_0xa9f404;}else{_0x5a8045=Math['min'](_0x2bcf59,_0x2ec359);_0xa9f404=Math[_0xb93f('0x1a')](0x1,_0x4ae751);_0x21a53c=_0x9041a2>=_0x5a8045||_0x9041a2<=_0xa9f404;}return _0x21a53c;}}module[_0xb93f('0xb')][_0xb93f('0x1c')]=domCompare;function monthCompare(_0x5f3230,_0x29d397,_0x25db04){var _0x303796=_0x5f3230[_0xb93f('0x6')]('en')[_0xb93f('0x16')]('MMM')['toLowerCase']();return circularMonthInterval(_0x29d397,_0x25db04)[_0xb93f('0x1d')](_0x303796);}module[_0xb93f('0xb')][_0xb93f('0x1e')]=monthCompare;function iftime(_0xc0170d,_0x2fc01b=moment['tz']['guess'](),_0x11584e=moment()){if(!validateRx[_0xb93f('0x1f')](_0xc0170d)){throw new Error(EINVALID_STRING);}else{var _0x323ecb=(moment[_0xb93f('0x20')](_0x11584e)?_0x11584e[_0xb93f('0xe')]():moment(_0x11584e))['tz'](_0x2fc01b)[_0xb93f('0x6')]('en');throwIfDateNotValid(_0x323ecb);var _0x1a709f=_0xc0170d[_0xb93f('0x5')](',');var _0x39aa97=_0x1a709f[0x0];var _0x30d017=_0x1a709f[0x1];var _0x128abc=_0x1a709f[0x2];var _0x58d4d5=_0x1a709f[0x3];let _0x5a7403=!![];if(_0x39aa97!=='*'){var _0x2fe28f=_0x39aa97['split']('-');var _0x54db67=_[_0xb93f('0x21')](_0x2fe28f[0x0],0x5,'0');var _0x20a5a1=_0x2fe28f['length']===0x2?_[_0xb93f('0x21')](_0x2fe28f[0x1],0x5,'0'):_0x54db67;_0x5a7403=timeCompare(_0x323ecb,_0x54db67,_0x20a5a1);}let _0x2b42bc=!![];if(_0x30d017!=='*'){var _0x152b2d=_0x30d017['split']('-');var _0x530d20=_0x152b2d[0x0];var _0x211ba5=_0x152b2d[_0xb93f('0x22')]===0x2?_0x152b2d[0x1]:_0x530d20;_0x2b42bc=dowCompare(_0x323ecb,_0x530d20,_0x211ba5);}let _0x3d0ce2=!![];if(_0x128abc!=='*'){var _0x3989e7=_0x128abc['split']('-');var _0x3659a1=parseDom(_0x3989e7[0x0]);var _0x2044ba=_0x3989e7[_0xb93f('0x22')]===0x2?parseDom(_0x3989e7[0x1]):_0x3659a1;_0x3d0ce2=domCompare(_0x323ecb,_0x3659a1,_0x2044ba);}let _0x560eab=!![];if(_0x58d4d5!=='*'){var _0x32ccbb=_0x58d4d5['split']('-');var _0x468cde=_0x32ccbb[0x0];var _0x16c99b=_0x32ccbb[_0xb93f('0x22')]===0x2?_0x32ccbb[0x1]:_0x32ccbb[0x0];_0x560eab=monthCompare(_0x323ecb,_0x468cde,_0x16c99b);}return _0x5a7403&&_0x2b42bc&&_0x3d0ce2&&_0x560eab;}}module[_0xb93f('0xb')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f585592..0e43439 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x324c=['util','moment','winston','../config/environment','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','path'];(function(_0x572979,_0x3f2c5a){var _0x351b05=function(_0x124247){while(--_0x124247){_0x572979['push'](_0x572979['shift']());}};_0x351b05(++_0x3f2c5a);}(_0x324c,0xc7));var _0xc324=function(_0x397892,_0x163676){_0x397892=_0x397892-0x0;var _0x2947fa=_0x324c[_0x397892];return _0x2947fa;};'use strict';var path=require(_0xc324('0x0'));var util=require(_0xc324('0x1'));var moment=require(_0xc324('0x2'));var winston=require(_0xc324('0x3'));var config=require(_0xc324('0x4'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xc324('0x5')]():_0xc324('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xc324('0x7'),'error':_0xc324('0x8'),'warn':_0xc324('0x9'),'info':_0xc324('0xa'),'print':_0xc324('0xb'),'success':_0xc324('0xc'),'http':_0xc324('0xd'),'verbose':_0xc324('0xe'),'debug':_0xc324('0xf'),'silly':_0xc324('0x10')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x13496d,_0x5506b0,_0x2cad8a){var _0x404f78=_0x13496d||_0xc324('0x11');return path['join'](_0x404f78,util['format']('%s-%s.log',_0x5506b0,_0x2cad8a));}function formatter(_0x4f339e,_0x113954){_0x113954['message']=_0x113954[_0xc324('0x12')][_0xc324('0x13')](/@@{/g,'{{{')[_0xc324('0x13')](/}@@/g,_0xc324('0x14'))[_0xc324('0x13')](/@{/g,'{{')[_0xc324('0x13')](/}@/g,'}}');return util['format'](_0xc324('0x15'),moment()[_0xc324('0x16')](_0xc324('0x17')),_0x113954[_0xc324('0x18')][_0xc324('0x19')](),_0x4f339e,_0x113954[_0xc324('0x12')]);}function fileFormat(_0x3955f4,_0x1b03f2){_0x1b03f2[_0xc324('0x12')]=_0x1b03f2[_0xc324('0x12')][_0xc324('0x13')](/@@{/g,_0xc324('0x1a'))[_0xc324('0x13')](/}@@/g,_0xc324('0x14'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x9ee1d1=_0x1b03f2[_0xc324('0x1b')]&&Object[_0xc324('0x1c')](_0x1b03f2[_0xc324('0x1b')])['length']?'\x0a\x09'+JSON[_0xc324('0x1d')](_0x1b03f2[_0xc324('0x1b')]):'';return util[_0xc324('0x16')](_0xc324('0x1e'),moment()[_0xc324('0x16')](_0xc324('0x17')),_0x1b03f2[_0xc324('0x18')]['toUpperCase'](),_0x3955f4,_0x1b03f2[_0xc324('0x12')],_0x9ee1d1);}function consoleLogger(){var _0x4a0631=new winston[(_0xc324('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc324('0x20'))][(_0xc324('0x21'))]({'level':'warn','json':![],'formatter':function(_0x82dde6){return formatter('',_0x82dde6);}})]});return _0x4a0631;}function fileLogger(_0x1eb0a9,_0x2b13e8){var _0xb2de25=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xc324('0x22'))]({'name':util['format'](_0xc324('0x23'),_0x1eb0a9,_0xc324('0x24')),'filename':getLogFileName(_0x2b13e8,_0x1eb0a9,_0xc324('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x27121e){return fileFormat(_0x1eb0a9,_0x27121e);}}),new winston[(_0xc324('0x20'))][(_0xc324('0x22'))]({'name':util[_0xc324('0x16')](_0xc324('0x23'),_0x1eb0a9,debugLevel),'filename':getLogFileName(_0x2b13e8,_0x1eb0a9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38edff){return fileFormat(_0x1eb0a9,_0x38edff);}}),new winston['transports'][(_0xc324('0x21'))]({'level':_0xc324('0x25'),'json':![],'formatter':function(_0x386393){return fileFormat(_0x1eb0a9,_0x386393);}})]});return _0xb2de25;}exports[_0xc324('0x26')]=consoleLogger;exports[_0xc324('0x27')]=fileLogger; \ No newline at end of file +var _0xcd6f=['toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','{{{','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','%s-%s','error','transports','File','Console','warn','consoleLogger','util','winston','debugLevel'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0xcd6f,0x1c5));var _0xfcd6=function(_0x1971ae,_0x2080bf){_0x1971ae=_0x1971ae-0x0;var _0x422bde=_0xcd6f[_0x1971ae];return _0x422bde;};'use strict';var path=require('path');var util=require(_0xfcd6('0x0'));var moment=require('moment');var winston=require(_0xfcd6('0x1'));var config=require('../config/environment');var debugLevel=config[_0xfcd6('0x2')]?config[_0xfcd6('0x2')][_0xfcd6('0x3')]():_0xfcd6('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':_0xfcd6('0x5'),'error':_0xfcd6('0x6'),'warn':_0xfcd6('0x7'),'info':_0xfcd6('0x8'),'print':_0xfcd6('0x9'),'success':'bold\x20green','http':'gray','verbose':_0xfcd6('0xa'),'debug':_0xfcd6('0xb'),'silly':_0xfcd6('0xc')};winston[_0xfcd6('0xd')](XC_LOG_COLORS);function getLogFileName(_0x800a90,_0xb6ebc1,_0x2f3dde){var _0x5d4f7e=_0x800a90||_0xfcd6('0xe');return path[_0xfcd6('0xf')](_0x5d4f7e,util[_0xfcd6('0x10')](_0xfcd6('0x11'),_0xb6ebc1,_0x2f3dde));}function formatter(_0xf72141,_0x267365){_0x267365[_0xfcd6('0x12')]=_0x267365[_0xfcd6('0x12')][_0xfcd6('0x13')](/@@{/g,'{{{')[_0xfcd6('0x13')](/}@@/g,_0xfcd6('0x14'))[_0xfcd6('0x13')](/@{/g,'{{')[_0xfcd6('0x13')](/}@/g,'}}');return util['format'](_0xfcd6('0x15'),moment()[_0xfcd6('0x10')](_0xfcd6('0x16')),_0x267365[_0xfcd6('0x17')]['toUpperCase'](),_0xf72141,_0x267365[_0xfcd6('0x12')]);}function fileFormat(_0x585523,_0x21bd5d){_0x21bd5d[_0xfcd6('0x12')]=_0x21bd5d[_0xfcd6('0x12')][_0xfcd6('0x13')](/@@{/g,_0xfcd6('0x18'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xfcd6('0x13')](/}@/g,'}}');var _0x5ebbcc=_0x21bd5d[_0xfcd6('0x19')]&&Object[_0xfcd6('0x1a')](_0x21bd5d[_0xfcd6('0x19')])['length']?'\x0a\x09'+JSON[_0xfcd6('0x1b')](_0x21bd5d['meta']):'';return util[_0xfcd6('0x10')](_0xfcd6('0x1c'),moment()[_0xfcd6('0x10')](_0xfcd6('0x16')),_0x21bd5d[_0xfcd6('0x17')][_0xfcd6('0x1d')](),_0x585523,_0x21bd5d[_0xfcd6('0x12')],_0x5ebbcc);}function consoleLogger(){var _0xd80f16=new winston[(_0xfcd6('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x55b834){return formatter('',_0x55b834);}})]});return _0xd80f16;}function fileLogger(_0x53ce85,_0x225fc4){var _0xb5f64d=new winston[(_0xfcd6('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xfcd6('0x10')](_0xfcd6('0x1f'),_0x53ce85,_0xfcd6('0x20')),'filename':getLogFileName(_0x225fc4,_0x53ce85,_0xfcd6('0x20')),'level':_0xfcd6('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x218f36){return fileFormat(_0x53ce85,_0x218f36);}}),new winston[(_0xfcd6('0x21'))][(_0xfcd6('0x22'))]({'name':util[_0xfcd6('0x10')]('%s-%s',_0x53ce85,debugLevel),'filename':getLogFileName(_0x225fc4,_0x53ce85,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x78ab09){return fileFormat(_0x53ce85,_0x78ab09);}}),new winston[(_0xfcd6('0x21'))][(_0xfcd6('0x23'))]({'level':_0xfcd6('0x24'),'json':![],'formatter':function(_0x3a427a){return fileFormat(_0x53ce85,_0x3a427a);}})]});return _0xb5f64d;}exports[_0xfcd6('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 b0a017f..bec8c92 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x41de75,_0x1db803){var _0x778fcc=function(_0x1c7045){while(--_0x1c7045){_0x41de75['push'](_0x41de75['shift']());}};_0x778fcc(++_0x1db803);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x0b0e[_0x2aa0e7];return _0x1472c0;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0x1a85,0x178));var _0x51a8=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0x1a85[_0x1a4a06];return _0x49ec08;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3b5e518..80e58a9 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 _0x087b=['exports','safeTemplate','lodash','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x5f89d5,_0x3c3963){var _0x33306a=function(_0x4127ed){while(--_0x4127ed){_0x5f89d5['push'](_0x5f89d5['shift']());}};_0x33306a(++_0x3c3963);}(_0x087b,0x11a));var _0xb087=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x087b[_0x45783c];return _0x1161da;};var _=require(_0xb087('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x35e3d3){return _0x35e3d3==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x40e6d6){var _0x5aa7a8=_0x40e6d6;if(typeof _0x40e6d6===_0xb087('0x1')){_0x5aa7a8=_0x40e6d6[_0xb087('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xb087('0x3')](_0x40e6d6)){_0x5aa7a8=_0x40e6d6[_0xb087('0x4')](function(_0x183efd){return safeTemplate(_0x183efd);});}else if(_[_0xb087('0x5')](_0x40e6d6)){_0x5aa7a8=Object[_0xb087('0x6')](_0x40e6d6)[_0xb087('0x7')](function(_0xecf080,_0x36ac30){_0xecf080[_0x36ac30]=safeTemplate(_0x40e6d6[_0x36ac30]);return _0xecf080;},{});}return _0x5aa7a8;}module[_0xb087('0x8')][_0xb087('0x9')]=safeTemplate; \ No newline at end of file +var _0xd7d1=['isArray','map','isPlainObject','keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x174c63,_0xae013c){var _0x4263a9=function(_0x59f76f){while(--_0x59f76f){_0x174c63['push'](_0x174c63['shift']());}};_0x4263a9(++_0xae013c);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1bc314,_0xb71ada){_0x1bc314=_0x1bc314-0x0;var _0x1198ae=_0xd7d1[_0x1bc314];return _0x1198ae;};var _=require(_0x1d7d('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x23f73c){return _0x23f73c==='{{'?_0x1d7d('0x1'):_0x1d7d('0x2');}function safeTemplate(_0x1d1926){var _0x3c3a27=_0x1d1926;if(typeof _0x1d1926===_0x1d7d('0x3')){_0x3c3a27=_0x1d1926[_0x1d7d('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x1d7d('0x5')](_0x1d1926)){_0x3c3a27=_0x1d1926[_0x1d7d('0x6')](function(_0x3c0839){return safeTemplate(_0x3c0839);});}else if(_[_0x1d7d('0x7')](_0x1d1926)){_0x3c3a27=Object[_0x1d7d('0x8')](_0x1d1926)['reduce'](function(_0x462ef8,_0x1aa456){_0x462ef8[_0x1aa456]=safeTemplate(_0x1d1926[_0x1aa456]);return _0x462ef8;},{});}return _0x3c3a27;}module[_0x1d7d('0x9')][_0x1d7d('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index ac67a82..26d9ed8 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 _0x69b3=['updated','info','writeJSON','exports','fs-extra','path','../config/environment','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','then','readJSON'];(function(_0x272cb1,_0x53b90c){var _0x1b1609=function(_0x64dcf5){while(--_0x64dcf5){_0x272cb1['push'](_0x272cb1['shift']());}};_0x1b1609(++_0x53b90c);}(_0x69b3,0x9c));var _0x369b=function(_0x40dc65,_0x194f03){_0x40dc65=_0x40dc65-0x0;var _0x3d5b89=_0x69b3[_0x40dc65];return _0x3d5b89;};var fs=require(_0x369b('0x0'));var path=require(_0x369b('0x1'));var config=require(_0x369b('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x369b('0x3')](root,'server/app.json');var NODEPATH=path[_0x369b('0x3')](root,_0x369b('0x4'));function setLegacyLibsNodeEnvPath(_0x5ce070){let _0x338824=![];if(Array[_0x369b('0x5')](_0x5ce070[_0x369b('0x6')])){var _0x45b270=_0x5ce070[_0x369b('0x6')][_0x369b('0x7')](function(_0x194e04){return _0x194e04[_0x369b('0x8')]===_0x369b('0x9');});if(_0x45b270>-0x1){var _0x23c6df=_0x5ce070[_0x369b('0x6')][_0x45b270];if(typeof _0x23c6df['env'][_0x369b('0xa')]!==_0x369b('0xb')){_0x23c6df[_0x369b('0xc')][_0x369b('0xa')]=NODEPATH;_0x338824=!![];}}return{'appConfig':_0x5ce070,'updated':_0x338824};}}function updateAppConfig(_0x4db5b6){return fs['pathExists'](APP_JSON_PATH)[_0x369b('0xd')](function(_0x448200){if(_0x448200){return fs[_0x369b('0xe')](APP_JSON_PATH)[_0x369b('0xd')](function(_0x5bc7d9){var _0x5ca4ee=setLegacyLibsNodeEnvPath(_0x5bc7d9);if(_0x5ca4ee[_0x369b('0xf')]){_0x4db5b6[_0x369b('0x10')]('Updating\x20app.json');return fs[_0x369b('0x11')](APP_JSON_PATH,_0x5bc7d9,{'spaces':0x2});}else{return Promise[_0x369b('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x369b('0x12')]=updateAppConfig; \ No newline at end of file +var _0x2efd=['name','apps','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','exports','../config/environment','resolve','legacy-libs','isArray','findIndex'];(function(_0x2a9250,_0x263508){var _0x1839fe=function(_0x49bd3e){while(--_0x49bd3e){_0x2a9250['push'](_0x2a9250['shift']());}};_0x1839fe(++_0x263508);}(_0x2efd,0xe9));var _0xd2ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2efd[_0x321bb2];return _0x9c12ed;};var fs=require('fs-extra');var path=require('path');var config=require(_0xd2ef('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0xd2ef('0x1')](root,'server/app.json');var NODEPATH=path[_0xd2ef('0x1')](root,_0xd2ef('0x2'));function setLegacyLibsNodeEnvPath(_0x36eb51){let _0x2f2859=![];if(Array[_0xd2ef('0x3')](_0x36eb51['apps'])){var _0x1e0114=_0x36eb51['apps'][_0xd2ef('0x4')](function(_0x4166c8){return _0x4166c8[_0xd2ef('0x5')]==='motion2';});if(_0x1e0114>-0x1){var _0x53e2a3=_0x36eb51[_0xd2ef('0x6')][_0x1e0114];if(typeof _0x53e2a3[_0xd2ef('0x7')][_0xd2ef('0x8')]!==_0xd2ef('0x9')){_0x53e2a3['env'][_0xd2ef('0x8')]=NODEPATH;_0x2f2859=!![];}}return{'appConfig':_0x36eb51,'updated':_0x2f2859};}}function updateAppConfig(_0x33b982){return fs[_0xd2ef('0xa')](APP_JSON_PATH)[_0xd2ef('0xb')](function(_0x136375){if(_0x136375){return fs[_0xd2ef('0xc')](APP_JSON_PATH)['then'](function(_0x5cba9f){var _0x3b877a=setLegacyLibsNodeEnvPath(_0x5cba9f);if(_0x3b877a[_0xd2ef('0xd')]){_0x33b982[_0xd2ef('0xe')](_0xd2ef('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x5cba9f,{'spaces':0x2});}else{return Promise[_0xd2ef('0x1')]();}});}else{return Promise[_0xd2ef('0x1')]();}});}module[_0xd2ef('0x10')]=updateAppConfig; \ No newline at end of file